From d7080dd6a5e5c3d1717aca8278b8b3b01b8a960e Mon Sep 17 00:00:00 2001 From: Andrea Bianco Date: Fri, 31 Dec 2021 15:49:37 +0100 Subject: [PATCH] Built motion from commit c102fb6e.|2.5.44 --- apidoc/api_project.js | 2 +- apidoc/api_project.json | 2 +- server/api/action/action.attributes.js | 2 +- server/api/action/action.controller.js | 2 +- server/api/action/action.model.js | 2 +- server/api/action/action.rpc.js | 2 +- server/api/action/index.js | 2 +- .../analyticCustomReport.attributes.js | 2 +- .../analyticCustomReport.controller.js | 2 +- .../analyticCustomReport.model.js | 2 +- .../analyticCustomReport.rpc.js | 2 +- server/api/analyticCustomReport/index.js | 2 +- .../analyticDefaultReport.attributes.js | 2 +- .../analyticDefaultReport.controller.js | 2 +- .../analyticDefaultReport.model.js | 2 +- .../analyticDefaultReport.rpc.js | 2 +- server/api/analyticDefaultReport/index.js | 2 +- .../analyticExtractedReport.attributes.js | 2 +- .../analyticExtractedReport.controller.js | 2 +- .../analyticExtractedReport.model.js | 2 +- .../analyticExtractedReport.rpc.js | 2 +- server/api/analyticExtractedReport/index.js | 2 +- .../analyticFieldReport.attributes.js | 2 +- .../analyticFieldReport.controller.js | 2 +- .../analyticFieldReport.model.js | 2 +- .../analyticFieldReport/analyticFieldReport.rpc.js | 2 +- server/api/analyticFieldReport/index.js | 2 +- .../analyticMetric/analyticMetric.attributes.js | 2 +- .../analyticMetric/analyticMetric.controller.js | 2 +- server/api/analyticMetric/analyticMetric.model.js | 2 +- server/api/analyticMetric/analyticMetric.rpc.js | 2 +- server/api/analyticMetric/index.js | 2 +- .../analyticTreeReport.attributes.js | 2 +- .../analyticTreeReport.controller.js | 2 +- .../analyticTreeReport/analyticTreeReport.model.js | 2 +- .../analyticTreeReport/analyticTreeReport.rpc.js | 2 +- server/api/analyticTreeReport/index.js | 2 +- server/api/attachment/attachment.attributes.js | 2 +- server/api/attachment/attachment.controller.js | 2 +- server/api/attachment/attachment.model.js | 2 +- server/api/attachment/attachment.rpc.js | 2 +- server/api/attachment/index.js | 2 +- .../authActiveDirectory.controller.js | 2 +- server/api/authActiveDirectory/index.js | 2 +- server/api/authGoogle/authGoogle.controller.js | 2 +- server/api/authGoogle/index.js | 2 +- server/api/authLocal/authLocal.controller.js | 2 +- server/api/authLocal/index.js | 2 +- server/api/automation/automation.attributes.js | 2 +- server/api/automation/automation.controller.js | 2 +- server/api/automation/automation.model.js | 2 +- server/api/automation/automation.rpc.js | 2 +- server/api/automation/index.js | 2 +- server/api/campaign/campaign.attributes.js | 2 +- server/api/campaign/campaign.controller.js | 2 +- server/api/campaign/campaign.model.js | 2 +- server/api/campaign/campaign.rpc.js | 2 +- server/api/campaign/index.js | 2 +- server/api/cannedAnswer/cannedAnswer.attributes.js | 2 +- server/api/cannedAnswer/cannedAnswer.controller.js | 2 +- server/api/cannedAnswer/cannedAnswer.model.js | 2 +- server/api/cannedAnswer/cannedAnswer.rpc.js | 2 +- server/api/cannedAnswer/index.js | 2 +- server/api/cdr/cdr.attributes.js | 2 +- server/api/cdr/cdr.controller.js | 2 +- server/api/cdr/cdr.model.js | 2 +- server/api/cdr/cdr.rpc.js | 2 +- server/api/cdr/index.js | 2 +- .../chatApplication/chatApplication.attributes.js | 2 +- .../chatApplication/chatApplication.controller.js | 2 +- .../api/chatApplication/chatApplication.model.js | 2 +- server/api/chatApplication/chatApplication.rpc.js | 2 +- server/api/chatApplication/index.js | 2 +- server/api/chatGroup/chatGroup.attributes.js | 2 +- server/api/chatGroup/chatGroup.controller.js | 2 +- server/api/chatGroup/chatGroup.events.js | 2 +- server/api/chatGroup/chatGroup.model.js | 2 +- server/api/chatGroup/chatGroup.rpc.js | 2 +- server/api/chatGroup/chatGroup.socket.js | 2 +- server/api/chatGroup/index.js | 2 +- .../chatInteraction/chatInteraction.attributes.js | 2 +- .../chatInteraction/chatInteraction.controller.js | 2 +- .../api/chatInteraction/chatInteraction.events.js | 2 +- .../api/chatInteraction/chatInteraction.model.js | 2 +- server/api/chatInteraction/chatInteraction.rpc.js | 2 +- .../api/chatInteraction/chatInteraction.socket.js | 2 +- server/api/chatInteraction/index.js | 2 +- .../chatInternalMessage.attributes.js | 2 +- .../chatInternalMessage.controller.js | 2 +- .../chatInternalMessage.events.js | 2 +- .../chatInternalMessage.model.js | 2 +- .../chatInternalMessage/chatInternalMessage.rpc.js | 2 +- .../chatInternalMessage.socket.js | 2 +- server/api/chatInternalMessage/index.js | 2 +- server/api/chatMessage/chatMessage.attributes.js | 2 +- server/api/chatMessage/chatMessage.controller.js | 2 +- server/api/chatMessage/chatMessage.events.js | 2 +- server/api/chatMessage/chatMessage.model.js | 2 +- server/api/chatMessage/chatMessage.rpc.js | 2 +- server/api/chatMessage/chatMessage.socket.js | 2 +- server/api/chatMessage/index.js | 2 +- .../chatOfflineMessage.attributes.js | 2 +- .../chatOfflineMessage.controller.js | 2 +- .../chatOfflineMessage.events.js | 2 +- .../chatOfflineMessage/chatOfflineMessage.model.js | 2 +- .../chatOfflineMessage/chatOfflineMessage.rpc.js | 2 +- server/api/chatOfflineMessage/index.js | 2 +- .../chatProactiveAction.attributes.js | 2 +- .../chatProactiveAction.controller.js | 2 +- .../chatProactiveAction.model.js | 2 +- .../chatProactiveAction/chatProactiveAction.rpc.js | 2 +- server/api/chatProactiveAction/index.js | 2 +- server/api/chatQueue/chatQueue.attributes.js | 2 +- server/api/chatQueue/chatQueue.controller.js | 2 +- server/api/chatQueue/chatQueue.events.js | 2 +- server/api/chatQueue/chatQueue.model.js | 2 +- server/api/chatQueue/chatQueue.rpc.js | 2 +- server/api/chatQueue/chatQueue.socket.js | 2 +- server/api/chatQueue/index.js | 2 +- .../chatQueueReport/chatQueueReport.attributes.js | 2 +- .../chatQueueReport/chatQueueReport.controller.js | 2 +- .../api/chatQueueReport/chatQueueReport.model.js | 2 +- server/api/chatQueueReport/chatQueueReport.rpc.js | 2 +- server/api/chatQueueReport/index.js | 2 +- .../chatTransferReport.attributes.js | 2 +- .../chatTransferReport.controller.js | 2 +- .../chatTransferReport/chatTransferReport.model.js | 2 +- .../chatTransferReport/chatTransferReport.rpc.js | 2 +- server/api/chatTransferReport/index.js | 2 +- server/api/chatWebsite/chatWebsite.attributes.js | 2 +- server/api/chatWebsite/chatWebsite.controller.js | 2 +- server/api/chatWebsite/chatWebsite.events.js | 2 +- server/api/chatWebsite/chatWebsite.model.js | 2 +- server/api/chatWebsite/chatWebsite.rpc.js | 2 +- server/api/chatWebsite/chatWebsite.socket.js | 2 +- server/api/chatWebsite/index.js | 2 +- server/api/client-side-logs.js | 2 +- .../api/cloudProvider/cloudProvider.attributes.js | 2 +- .../api/cloudProvider/cloudProvider.controller.js | 2 +- server/api/cloudProvider/cloudProvider.model.js | 2 +- server/api/cloudProvider/cloudProvider.oauth.js | 2 +- server/api/cloudProvider/cloudProvider.rpc.js | 2 +- server/api/cloudProvider/index.js | 2 +- server/api/cmCompany/cmCompany.attributes.js | 2 +- server/api/cmCompany/cmCompany.controller.js | 2 +- server/api/cmCompany/cmCompany.model.js | 2 +- server/api/cmCompany/cmCompany.rpc.js | 2 +- server/api/cmCompany/index.js | 2 +- server/api/cmContact/cmContact.attributes.js | 2 +- server/api/cmContact/cmContact.controller.js | 2 +- server/api/cmContact/cmContact.events.js | 2 +- server/api/cmContact/cmContact.model.js | 2 +- server/api/cmContact/cmContact.rpc.js | 2 +- server/api/cmContact/cmContact.socket.js | 2 +- server/api/cmContact/index.js | 2 +- .../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.events.js | 2 +- server/api/mailSubstatus/mailSubstatus.model.js | 2 +- server/api/mailSubstatus/mailSubstatus.rpc.js | 2 +- server/api/mailTransferReport/index.js | 2 +- .../mailTransferReport.attributes.js | 2 +- .../mailTransferReport.controller.js | 2 +- .../mailTransferReport/mailTransferReport.model.js | 2 +- .../mailTransferReport/mailTransferReport.rpc.js | 2 +- server/api/memberReport/index.js | 2 +- server/api/memberReport/memberReport.attributes.js | 2 +- server/api/memberReport/memberReport.controller.js | 2 +- server/api/memberReport/memberReport.model.js | 2 +- server/api/memberReport/memberReport.rpc.js | 2 +- server/api/migration/index.js | 2 +- server/api/migration/migration.attributes.js | 2 +- server/api/migration/migration.controller.js | 2 +- server/api/migration/migration.model.js | 2 +- server/api/migration/migration.rpc.js | 2 +- server/api/network/index.js | 2 +- server/api/network/network.attributes.js | 2 +- server/api/network/network.controller.js | 2 +- server/api/network/network.model.js | 2 +- server/api/network/network.rpc.js | 2 +- server/api/openchannelAccount/index.js | 2 +- .../openchannelAccount.attributes.js | 2 +- .../openchannelAccount.controller.js | 2 +- .../openchannelAccount.events.js | 2 +- .../openchannelAccount/openchannelAccount.model.js | 2 +- .../openchannelAccount/openchannelAccount.rpc.js | 2 +- .../openchannelAccount.socket.js | 2 +- server/api/openchannelApplication/index.js | 2 +- .../openchannelApplication.attributes.js | 2 +- .../openchannelApplication.controller.js | 2 +- .../openchannelApplication.model.js | 2 +- .../openchannelApplication.rpc.js | 2 +- server/api/openchannelInteraction/index.js | 2 +- .../openchannelInteraction.attributes.js | 2 +- .../openchannelInteraction.controller.js | 2 +- .../openchannelInteraction.events.js | 2 +- .../openchannelInteraction.model.js | 2 +- .../openchannelInteraction.rpc.js | 2 +- .../openchannelInteraction.socket.js | 2 +- server/api/openchannelMessage/index.js | 2 +- .../openchannelMessage.attributes.js | 2 +- .../openchannelMessage.controller.js | 2 +- .../openchannelMessage.events.js | 2 +- .../openchannelMessage/openchannelMessage.model.js | 2 +- .../openchannelMessage/openchannelMessage.rpc.js | 2 +- .../openchannelMessage.socket.js | 2 +- server/api/openchannelQueue/index.js | 2 +- .../openchannelQueue.attributes.js | 2 +- .../openchannelQueue.controller.js | 2 +- .../openchannelQueue/openchannelQueue.events.js | 2 +- .../api/openchannelQueue/openchannelQueue.model.js | 2 +- .../api/openchannelQueue/openchannelQueue.rpc.js | 2 +- .../openchannelQueue/openchannelQueue.socket.js | 2 +- server/api/openchannelQueueReport/index.js | 2 +- .../openchannelQueueReport.attributes.js | 2 +- .../openchannelQueueReport.controller.js | 2 +- .../openchannelQueueReport.model.js | 2 +- .../openchannelQueueReport.rpc.js | 2 +- server/api/openchannelTransferReport/index.js | 2 +- .../openchannelTransferReport.attributes.js | 2 +- .../openchannelTransferReport.controller.js | 2 +- .../openchannelTransferReport.model.js | 2 +- .../openchannelTransferReport.rpc.js | 2 +- server/api/pause/index.js | 2 +- server/api/pause/pause.attributes.js | 2 +- server/api/pause/pause.controller.js | 2 +- server/api/pause/pause.model.js | 2 +- server/api/pause/pause.rpc.js | 2 +- server/api/plugin/index.js | 2 +- server/api/plugin/plugin.attributes.js | 2 +- server/api/plugin/plugin.controller.js | 2 +- server/api/plugin/plugin.events.js | 2 +- server/api/plugin/plugin.model.js | 2 +- server/api/plugin/plugin.rpc.js | 2 +- server/api/plugin/plugin.socket.js | 2 +- server/api/pm2/index.js | 2 +- server/api/pm2/pm2.controller.js | 2 +- server/api/realtime/index.js | 2 +- server/api/realtime/realtime.controller.js | 2 +- server/api/reportAgentPreview/index.js | 2 +- .../reportAgentPreview.attributes.js | 2 +- .../reportAgentPreview/reportAgentPreview.model.js | 2 +- .../reportAgentPreview/reportAgentPreview.rpc.js | 2 +- server/api/rpc/index.js | 2 +- server/api/rpc/rpc.controller.js | 2 +- server/api/schedule/index.js | 2 +- server/api/schedule/schedule.attributes.js | 2 +- server/api/schedule/schedule.controller.js | 2 +- server/api/schedule/schedule.model.js | 2 +- server/api/schedule/schedule.rpc.js | 2 +- server/api/screenRecording/index.js | 2 +- .../screenRecording/screenRecording.attributes.js | 2 +- .../screenRecording/screenRecording.controller.js | 2 +- .../api/screenRecording/screenRecording.model.js | 2 +- server/api/screenRecording/screenRecording.rpc.js | 2 +- server/api/setting/index.js | 2 +- server/api/setting/setting.attributes.js | 2 +- server/api/setting/setting.controller.js | 2 +- server/api/setting/setting.model.js | 2 +- server/api/setting/setting.rpc.js | 2 +- server/api/smsAccount/index.js | 2 +- server/api/smsAccount/smsAccount.attributes.js | 2 +- server/api/smsAccount/smsAccount.controller.js | 2 +- server/api/smsAccount/smsAccount.events.js | 2 +- server/api/smsAccount/smsAccount.model.js | 2 +- server/api/smsAccount/smsAccount.rpc.js | 2 +- server/api/smsAccount/smsAccount.socket.js | 2 +- server/api/smsApplication/index.js | 2 +- .../smsApplication/smsApplication.attributes.js | 2 +- .../smsApplication/smsApplication.controller.js | 2 +- server/api/smsApplication/smsApplication.model.js | 2 +- server/api/smsApplication/smsApplication.rpc.js | 2 +- server/api/smsInteraction/index.js | 2 +- .../smsInteraction/smsInteraction.attributes.js | 2 +- .../smsInteraction/smsInteraction.controller.js | 2 +- server/api/smsInteraction/smsInteraction.events.js | 2 +- server/api/smsInteraction/smsInteraction.model.js | 2 +- server/api/smsInteraction/smsInteraction.rpc.js | 2 +- server/api/smsInteraction/smsInteraction.socket.js | 2 +- server/api/smsMessage/index.js | 2 +- server/api/smsMessage/smsMessage.attributes.js | 2 +- server/api/smsMessage/smsMessage.controller.js | 2 +- server/api/smsMessage/smsMessage.events.js | 2 +- server/api/smsMessage/smsMessage.model.js | 2 +- server/api/smsMessage/smsMessage.rpc.js | 2 +- server/api/smsMessage/smsMessage.socket.js | 2 +- server/api/smsQueue/index.js | 2 +- server/api/smsQueue/smsQueue.attributes.js | 2 +- server/api/smsQueue/smsQueue.controller.js | 2 +- server/api/smsQueue/smsQueue.events.js | 2 +- server/api/smsQueue/smsQueue.model.js | 2 +- server/api/smsQueue/smsQueue.rpc.js | 2 +- server/api/smsQueue/smsQueue.socket.js | 2 +- server/api/smsQueueReport/index.js | 2 +- .../smsQueueReport/smsQueueReport.attributes.js | 2 +- .../smsQueueReport/smsQueueReport.controller.js | 2 +- server/api/smsQueueReport/smsQueueReport.model.js | 2 +- server/api/smsQueueReport/smsQueueReport.rpc.js | 2 +- server/api/smsTransferReport/index.js | 2 +- .../smsTransferReport.attributes.js | 2 +- .../smsTransferReport.controller.js | 2 +- .../smsTransferReport/smsTransferReport.model.js | 2 +- .../api/smsTransferReport/smsTransferReport.rpc.js | 2 +- server/api/sound/index.js | 2 +- server/api/sound/sound.attributes.js | 2 +- server/api/sound/sound.controller.js | 2 +- server/api/sound/sound.model.js | 2 +- server/api/sound/sound.rpc.js | 2 +- server/api/squareMessage/index.js | 2 +- .../api/squareMessage/squareMessage.attributes.js | 2 +- .../api/squareMessage/squareMessage.controller.js | 2 +- server/api/squareMessage/squareMessage.model.js | 2 +- server/api/squareMessage/squareMessage.rpc.js | 2 +- server/api/squareOdbc/index.js | 2 +- server/api/squareOdbc/squareOdbc.attributes.js | 2 +- server/api/squareOdbc/squareOdbc.controller.js | 2 +- server/api/squareOdbc/squareOdbc.model.js | 2 +- server/api/squareOdbc/squareOdbc.rpc.js | 2 +- server/api/squareProject/index.js | 2 +- .../api/squareProject/squareProject.attributes.js | 2 +- .../api/squareProject/squareProject.controller.js | 2 +- server/api/squareProject/squareProject.events.js | 2 +- server/api/squareProject/squareProject.model.js | 2 +- server/api/squareProject/squareProject.rpc.js | 2 +- server/api/squareProject/squareProject.socket.js | 2 +- server/api/squareRecording/index.js | 2 +- .../squareRecording/squareRecording.attributes.js | 2 +- .../squareRecording/squareRecording.controller.js | 2 +- .../api/squareRecording/squareRecording.model.js | 2 +- server/api/squareRecording/squareRecording.rpc.js | 2 +- server/api/squareReport/index.js | 2 +- server/api/squareReport/squareReport.attributes.js | 2 +- server/api/squareReport/squareReport.controller.js | 2 +- server/api/squareReport/squareReport.model.js | 2 +- server/api/squareReport/squareReport.rpc.js | 2 +- server/api/squareReportDetail/index.js | 2 +- .../squareReportDetail.attributes.js | 2 +- .../squareReportDetail.controller.js | 2 +- .../squareReportDetail/squareReportDetail.model.js | 2 +- .../squareReportDetail/squareReportDetail.rpc.js | 2 +- server/api/system/index.js | 2 +- server/api/system/system.controller.js | 2 +- server/api/tag/index.js | 2 +- server/api/tag/tag.attributes.js | 2 +- server/api/tag/tag.controller.js | 2 +- server/api/tag/tag.model.js | 2 +- server/api/tag/tag.rpc.js | 2 +- server/api/team/index.js | 2 +- server/api/team/team.attributes.js | 2 +- server/api/team/team.controller.js | 2 +- server/api/team/team.events.js | 2 +- server/api/team/team.model.js | 2 +- server/api/team/team.rpc.js | 2 +- server/api/team/team.socket.js | 2 +- .../teamVoicePrefix/teamVoicePrefix.attributes.js | 2 +- .../api/teamVoicePrefix/teamVoicePrefix.model.js | 2 +- server/api/teamVoiceQueue/index.js | 2 +- .../teamVoiceQueue/teamVoiceQueue.attributes.js | 2 +- server/api/teamVoiceQueue/teamVoiceQueue.model.js | 2 +- server/api/teamVoiceQueue/teamVoiceQueue.rpc.js | 2 +- server/api/template/index.js | 2 +- server/api/template/template.attributes.js | 2 +- server/api/template/template.controller.js | 2 +- server/api/template/template.model.js | 2 +- server/api/template/template.rpc.js | 2 +- server/api/trigger/index.js | 2 +- server/api/trigger/trigger.attributes.js | 2 +- server/api/trigger/trigger.controller.js | 2 +- server/api/trigger/trigger.model.js | 2 +- server/api/trigger/trigger.rpc.js | 2 +- server/api/trunk/index.js | 2 +- server/api/trunk/trunk.attributes.js | 2 +- server/api/trunk/trunk.controller.js | 2 +- server/api/trunk/trunk.model.js | 2 +- server/api/trunk/trunk.rpc.js | 2 +- server/api/user-setting/index.js | 2 +- server/api/user-setting/user-setting.attributes.js | 2 +- server/api/user-setting/user-setting.controller.js | 2 +- server/api/user-setting/user-setting.events.js | 2 +- server/api/user-setting/user-setting.model.js | 2 +- server/api/user-setting/user-setting.socket.js | 2 +- server/api/user/index.js | 2 +- server/api/user/user.attributes.js | 2 +- server/api/user/user.controller.js | 2 +- server/api/user/user.events.js | 2 +- server/api/user/user.model.js | 2 +- server/api/user/user.rpc.js | 2 +- server/api/user/user.socket.js | 2 +- server/api/userChatQueue/index.js | 2 +- .../api/userChatQueue/userChatQueue.attributes.js | 2 +- server/api/userChatQueue/userChatQueue.model.js | 2 +- server/api/userChatQueue/userChatQueue.rpc.js | 2 +- server/api/userFaxQueue/index.js | 2 +- server/api/userFaxQueue/userFaxQueue.attributes.js | 2 +- server/api/userFaxQueue/userFaxQueue.model.js | 2 +- server/api/userFaxQueue/userFaxQueue.rpc.js | 2 +- server/api/userMailQueue/index.js | 2 +- .../api/userMailQueue/userMailQueue.attributes.js | 2 +- server/api/userMailQueue/userMailQueue.model.js | 2 +- server/api/userMailQueue/userMailQueue.rpc.js | 2 +- server/api/userNotification/index.js | 2 +- .../userNotification.attributes.js | 2 +- .../userNotification.controller.js | 2 +- .../userNotification/userNotification.events.js | 2 +- .../api/userNotification/userNotification.model.js | 2 +- .../api/userNotification/userNotification.rpc.js | 2 +- .../userNotification/userNotification.socket.js | 2 +- server/api/userOpenchannelQueue/index.js | 2 +- .../userOpenchannelQueue.attributes.js | 2 +- .../userOpenchannelQueue.model.js | 2 +- .../userOpenchannelQueue.rpc.js | 2 +- server/api/userProfile/index.js | 2 +- server/api/userProfile/userProfile.attributes.js | 2 +- server/api/userProfile/userProfile.controller.js | 2 +- server/api/userProfile/userProfile.events.js | 2 +- server/api/userProfile/userProfile.model.js | 2 +- server/api/userProfile/userProfile.rpc.js | 2 +- server/api/userProfile/userProfile.socket.js | 2 +- server/api/userProfileResource/index.js | 2 +- .../userProfileResource.attributes.js | 2 +- .../userProfileResource.controller.js | 2 +- .../userProfileResource.model.js | 2 +- .../userProfileResource/userProfileResource.rpc.js | 2 +- server/api/userProfileSection/index.js | 2 +- .../userProfileSection.attributes.js | 2 +- .../userProfileSection.controller.js | 2 +- .../userProfileSection/userProfileSection.model.js | 2 +- .../userProfileSection/userProfileSection.rpc.js | 2 +- server/api/userSmsQueue/index.js | 2 +- server/api/userSmsQueue/userSmsQueue.attributes.js | 2 +- server/api/userSmsQueue/userSmsQueue.model.js | 2 +- server/api/userSmsQueue/userSmsQueue.rpc.js | 2 +- .../userVoicePrefix/userVoicePrefix.attributes.js | 2 +- .../api/userVoicePrefix/userVoicePrefix.model.js | 2 +- server/api/userVoiceQueue/index.js | 2 +- .../userVoiceQueue/userVoiceQueue.attributes.js | 2 +- server/api/userVoiceQueue/userVoiceQueue.model.js | 2 +- server/api/userVoiceQueue/userVoiceQueue.rpc.js | 2 +- server/api/userVoiceQueueRt/index.js | 2 +- .../userVoiceQueueRt.attributes.js | 2 +- .../userVoiceQueueRt/userVoiceQueueRt.events.js | 2 +- .../api/userVoiceQueueRt/userVoiceQueueRt.model.js | 2 +- .../api/userVoiceQueueRt/userVoiceQueueRt.rpc.js | 2 +- .../userVoiceQueueRt/userVoiceQueueRt.socket.js | 2 +- server/api/userWhatsappQueue/index.js | 2 +- .../userWhatsappQueue.attributes.js | 2 +- .../userWhatsappQueue/userWhatsappQueue.model.js | 2 +- .../api/userWhatsappQueue/userWhatsappQueue.rpc.js | 2 +- server/api/variable/index.js | 2 +- server/api/variable/variable.attributes.js | 2 +- server/api/variable/variable.controller.js | 2 +- server/api/variable/variable.model.js | 2 +- server/api/variable/variable.rpc.js | 2 +- server/api/version/index.js | 2 +- server/api/version/version.controller.js | 2 +- server/api/voiceAgentReport/index.js | 2 +- .../voiceAgentReport.attributes.js | 2 +- .../voiceAgentReport.controller.js | 2 +- .../api/voiceAgentReport/voiceAgentReport.model.js | 2 +- .../api/voiceAgentReport/voiceAgentReport.rpc.js | 2 +- server/api/voiceCallReport/index.js | 2 +- .../voiceCallReport/voiceCallReport.attributes.js | 2 +- .../voiceCallReport/voiceCallReport.controller.js | 2 +- .../api/voiceCallReport/voiceCallReport.model.js | 2 +- server/api/voiceCallReport/voiceCallReport.rpc.js | 2 +- server/api/voiceChanSpy/index.js | 2 +- server/api/voiceChanSpy/voiceChanSpy.attributes.js | 2 +- server/api/voiceChanSpy/voiceChanSpy.controller.js | 2 +- server/api/voiceChanSpy/voiceChanSpy.model.js | 2 +- server/api/voiceChanSpy/voiceChanSpy.rpc.js | 2 +- server/api/voiceContext/index.js | 2 +- server/api/voiceContext/voiceContext.attributes.js | 2 +- server/api/voiceContext/voiceContext.controller.js | 2 +- server/api/voiceContext/voiceContext.model.js | 2 +- server/api/voiceContext/voiceContext.rpc.js | 2 +- server/api/voiceDialReport/index.js | 2 +- .../voiceDialReport/voiceDialReport.attributes.js | 2 +- .../voiceDialReport/voiceDialReport.controller.js | 2 +- .../api/voiceDialReport/voiceDialReport.model.js | 2 +- server/api/voiceDialReport/voiceDialReport.rpc.js | 2 +- server/api/voiceExtension/index.js | 2 +- .../voiceExtension/voiceExtension.attributes.js | 2 +- .../voiceExtension/voiceExtension.controller.js | 2 +- server/api/voiceExtension/voiceExtension.events.js | 2 +- server/api/voiceExtension/voiceExtension.model.js | 2 +- server/api/voiceExtension/voiceExtension.rpc.js | 2 +- server/api/voiceExtension/voiceExtension.socket.js | 2 +- server/api/voiceMail/index.js | 2 +- server/api/voiceMail/voiceMail.attributes.js | 2 +- server/api/voiceMail/voiceMail.controller.js | 2 +- server/api/voiceMail/voiceMail.model.js | 2 +- server/api/voiceMail/voiceMail.rpc.js | 2 +- server/api/voiceMailMessage/index.js | 2 +- .../voiceMailMessage.attributes.js | 2 +- .../voiceMailMessage.controller.js | 2 +- .../api/voiceMailMessage/voiceMailMessage.model.js | 2 +- .../api/voiceMailMessage/voiceMailMessage.rpc.js | 2 +- server/api/voiceMusicOnHold/index.js | 2 +- .../voiceMusicOnHold.attributes.js | 2 +- .../voiceMusicOnHold.controller.js | 2 +- .../api/voiceMusicOnHold/voiceMusicOnHold.model.js | 2 +- .../api/voiceMusicOnHold/voiceMusicOnHold.rpc.js | 2 +- server/api/voicePrefix/index.js | 2 +- server/api/voicePrefix/voicePrefix.attributes.js | 2 +- server/api/voicePrefix/voicePrefix.controller.js | 2 +- server/api/voicePrefix/voicePrefix.events.js | 2 +- server/api/voicePrefix/voicePrefix.model.js | 2 +- server/api/voicePrefix/voicePrefix.rpc.js | 2 +- server/api/voicePrefix/voicePrefix.socket.js | 2 +- server/api/voiceQueue/index.js | 2 +- server/api/voiceQueue/voiceQueue.attributes.js | 2 +- server/api/voiceQueue/voiceQueue.controller.js | 2 +- server/api/voiceQueue/voiceQueue.events.js | 2 +- server/api/voiceQueue/voiceQueue.model.js | 2 +- server/api/voiceQueue/voiceQueue.rpc.js | 2 +- server/api/voiceQueue/voiceQueue.socket.js | 2 +- server/api/voiceQueueReport/index.js | 2 +- .../voiceQueueReport.attributes.js | 2 +- .../voiceQueueReport.controller.js | 2 +- .../voiceQueueReport/voiceQueueReport.events.js | 2 +- .../api/voiceQueueReport/voiceQueueReport.model.js | 2 +- .../api/voiceQueueReport/voiceQueueReport.rpc.js | 2 +- .../voiceQueueReport/voiceQueueReport.socket.js | 2 +- server/api/voiceQueuesLog/index.js | 2 +- .../voiceQueuesLog/voiceQueuesLog.attributes.js | 2 +- .../voiceQueuesLog/voiceQueuesLog.controller.js | 2 +- server/api/voiceQueuesLog/voiceQueuesLog.model.js | 2 +- server/api/voiceQueuesLog/voiceQueuesLog.rpc.js | 2 +- server/api/voiceRecording/index.js | 2 +- .../voiceRecording/voiceRecording.attributes.js | 2 +- .../voiceRecording/voiceRecording.controller.js | 2 +- server/api/voiceRecording/voiceRecording.model.js | 2 +- server/api/voiceRecording/voiceRecording.rpc.js | 2 +- server/api/voiceTransferReport/index.js | 2 +- .../voiceTransferReport.attributes.js | 2 +- .../voiceTransferReport.controller.js | 2 +- .../voiceTransferReport.model.js | 2 +- .../voiceTransferReport/voiceTransferReport.rpc.js | 2 +- server/api/webbar/index.js | 2 +- server/api/webbar/webbar.controller.js | 2 +- server/api/whatsappAccount/index.js | 2 +- .../whatsappAccount/whatsappAccount.attributes.js | 2 +- .../whatsappAccount/whatsappAccount.controller.js | 2 +- .../api/whatsappAccount/whatsappAccount.events.js | 2 +- .../api/whatsappAccount/whatsappAccount.model.js | 2 +- server/api/whatsappAccount/whatsappAccount.rpc.js | 2 +- .../api/whatsappAccount/whatsappAccount.socket.js | 2 +- server/api/whatsappApplication/index.js | 2 +- .../whatsappApplication.attributes.js | 2 +- .../whatsappApplication.controller.js | 2 +- .../whatsappApplication.model.js | 2 +- .../whatsappApplication/whatsappApplication.rpc.js | 2 +- server/api/whatsappInteraction/index.js | 2 +- .../whatsappInteraction.attributes.js | 2 +- .../whatsappInteraction.controller.js | 2 +- .../whatsappInteraction.events.js | 2 +- .../whatsappInteraction.model.js | 2 +- .../whatsappInteraction/whatsappInteraction.rpc.js | 2 +- .../whatsappInteraction.socket.js | 2 +- server/api/whatsappMessage/index.js | 2 +- .../whatsappMessage/whatsappMessage.attributes.js | 2 +- .../whatsappMessage/whatsappMessage.controller.js | 2 +- .../api/whatsappMessage/whatsappMessage.events.js | 2 +- .../api/whatsappMessage/whatsappMessage.model.js | 2 +- server/api/whatsappMessage/whatsappMessage.rpc.js | 2 +- .../api/whatsappMessage/whatsappMessage.socket.js | 2 +- server/api/whatsappQueue/index.js | 2 +- .../api/whatsappQueue/whatsappQueue.attributes.js | 2 +- .../api/whatsappQueue/whatsappQueue.controller.js | 2 +- server/api/whatsappQueue/whatsappQueue.events.js | 2 +- server/api/whatsappQueue/whatsappQueue.model.js | 2 +- server/api/whatsappQueue/whatsappQueue.rpc.js | 2 +- server/api/whatsappQueue/whatsappQueue.socket.js | 2 +- server/api/whatsappQueueReport/index.js | 2 +- .../whatsappQueueReport.attributes.js | 2 +- .../whatsappQueueReport.controller.js | 2 +- .../whatsappQueueReport.model.js | 2 +- .../whatsappQueueReport/whatsappQueueReport.rpc.js | 2 +- server/api/whatsappTransferReport/index.js | 2 +- .../whatsappTransferReport.attributes.js | 2 +- .../whatsappTransferReport.controller.js | 2 +- .../whatsappTransferReport.model.js | 2 +- .../whatsappTransferReport.rpc.js | 2 +- server/app.js | 2 +- server/components/auth/service.js | 2 +- server/components/encryptor/index.js | 2 +- server/components/export/csv.js | 2 +- server/components/export/pdf.js | 2 +- server/components/export/xlsx.js | 2 +- server/components/extensions/rewrite.js | 2 +- server/components/import/cm/csv.js | 2 +- server/components/import/cm/csv2.js | 2 +- server/components/integrations/configuration.js | 2 +- server/components/interaction/service.js | 2 +- server/components/license/service.js | 2 +- server/components/parsers/advancedSearch.js | 2 +- server/components/parsers/qs.js | 2 +- server/config/express.js | 2 +- server/config/license/hardware.js | 2 +- server/config/license/index.js | 2 +- server/config/license/util.js | 2 +- server/config/local.env.js | 2 +- server/config/logger.js | 2 +- server/config/pm2/config.js | 2 +- server/config/pm2/index.js | 2 +- server/config/schedule/chat.js | 2 +- server/config/schedule/cloud-provider.js | 2 +- server/config/schedule/index.js | 2 +- server/config/schedule/transcribe.js | 2 +- server/config/schedule/whatsapp.js | 2 +- server/config/seedContact.js | 2 +- server/config/seedUsers.js | 2 +- server/config/socketio.js | 2 +- server/config/triggers/index.js | 2 +- server/config/utils.js | 2 +- server/errors/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/tvox.js | 2 +- .../services/routing/server/applications/utils.js | 2 +- server/services/routing/server/index.js | 2 +- server/services/routing/server/interval.js | 2 +- server/services/xdr/agents.controller.js | 2 +- server/services/xdr/calls.controller.js | 2 +- server/services/xdr/core.controller.js | 2 +- server/services/xdr/dials.controller.js | 2 +- server/services/xdr/index.js | 2 +- server/services/xdr/members.controller.js | 2 +- server/services/xdr/queues.controller.js | 2 +- server/services/xdr/recordings.controller.js | 2 +- server/services/xdr/transfers.controller.js | 2 +- server/services/xdr/utils.js | 2 +- server/utils/client-side-logger.js | 2 +- server/utils/loggers.js | 2 +- server/utils/mask-sensitive-data.js | 2 +- server/utils/safe-template.js | 2 +- 1169 files changed, 1169 insertions(+), 1169 deletions(-) diff --git a/apidoc/api_project.js b/apidoc/api_project.js index cc2637b..447374e 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-12-31T11:38:22.763Z", + "time": "2021-12-31T14:37:19.750Z", "url": "http://apidocjs.com", "version": "0.24.0" } diff --git a/apidoc/api_project.json b/apidoc/api_project.json index e37c6ae..00887be 100644 --- a/apidoc/api_project.json +++ b/apidoc/api_project.json @@ -17,7 +17,7 @@ "apidoc": "0.3.0", "generator": { "name": "apidoc", - "time": "2021-12-31T11:38:22.763Z", + "time": "2021-12-31T14:37:19.750Z", "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 a023ea1..220a67b 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 _0x201e=['contactManager[autoCreate(0=No,1=Yes)],\x20urlForward[URL],\x20script[type],\x20integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20browser[TemplateId,URL]','contactManager[searchFields],\x20script[script],\x20integration[ConfigurationId],\x20motionbar[NULL,eventVariables(0=No,1=Yes),WinAppArguments],\x20browser[NULL,eventVariables(0=No,1=Yes)]','browser[location(0=NewTab,1=NewWindow,2=MotionTab)],\x20contactManager[autoCreateField]','urlForward[timeout],\x20browser[windowWidth],\x20contactManager[ignoreDialerContactId]','urlForward[headers],\x20browser[wsindowHeight]','TEXT','urlForward[body]','sequelize','exports','getDataValue','integration','motionbar','jscripty','urlForward','browser','bot','script','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','STRING'];(function(_0x2b42bf,_0x2f1463){var _0x23c423=function(_0x464e69){while(--_0x464e69){_0x2b42bf['push'](_0x2b42bf['shift']());}};_0x23c423(++_0x2f1463);}(_0x201e,0xd8));var _0xe201=function(_0x19dd7a,_0x51de21){_0x19dd7a=_0x19dd7a-0x0;var _0x3feb6a=_0x201e[_0x19dd7a];return _0x3feb6a;};'use strict';var Sequelize=require(_0xe201('0x0'));module[_0xe201('0x1')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x431d70){return this[_0xe201('0x2')]('action');}},'action':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'isIn':{'args':[['contactManager',_0xe201('0x3'),_0xe201('0x4'),_0xe201('0x5'),_0xe201('0x6'),_0xe201('0x7'),_0xe201('0x8'),_0xe201('0x9')]],'msg':_0xe201('0xa')}},'comment':_0xe201('0xa')},'data1':{'type':Sequelize['STRING'](0x1000),'comment':'jscripty[ProjectId],\x20browser[type(0=Popup,1=CTI\x20URL)],\x20contactManager[ListId],\x20urlForward[type(GET,POST,PUT,DELETE)],\x20script[info],\x20integration[intName(desk,dynamics365,freshdesk,freshsales,salesforce,sugarcrm,vtiger,zendesk,zoho)],\x20motionbar[type(0=Popup,1=CTI\x20URL,2=WinApp)]'},'data2':{'type':Sequelize[_0xe201('0xb')](0x1000),'comment':_0xe201('0xc')},'data3':{'type':Sequelize[_0xe201('0xb')](0x1000),'comment':_0xe201('0xd')},'data4':{'type':Sequelize[_0xe201('0xb')](0x1000),'comments':_0xe201('0xe')},'data5':{'type':Sequelize['STRING'](0x1000),'comments':_0xe201('0xf')},'data6':{'type':Sequelize[_0xe201('0xb')],'comments':_0xe201('0x10')},'data7':{'type':Sequelize[_0xe201('0x11')],'comments':_0xe201('0x12')}}; \ No newline at end of file +var _0x1376=['VIRTUAL','getDataValue','action','STRING','contactManager','motionbar','jscripty','script','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','jscripty[ProjectId],\x20browser[type(0=Popup,1=CTI\x20URL)],\x20contactManager[ListId],\x20urlForward[type(GET,POST,PUT,DELETE)],\x20script[info],\x20integration[intName(desk,dynamics365,freshdesk,freshsales,salesforce,sugarcrm,vtiger,zendesk,zoho)],\x20motionbar[type(0=Popup,1=CTI\x20URL,2=WinApp)]','contactManager[searchFields],\x20script[script],\x20integration[ConfigurationId],\x20motionbar[NULL,eventVariables(0=No,1=Yes),WinAppArguments],\x20browser[NULL,eventVariables(0=No,1=Yes)]','browser[location(0=NewTab,1=NewWindow,2=MotionTab)],\x20contactManager[autoCreateField]','urlForward[headers],\x20browser[wsindowHeight]','TEXT','urlForward[body]','exports'];(function(_0x58345f,_0x4631db){var _0x27d9ef=function(_0x3ac80a){while(--_0x3ac80a){_0x58345f['push'](_0x58345f['shift']());}};_0x27d9ef(++_0x4631db);}(_0x1376,0x6f));var _0x6137=function(_0x1d2992,_0x598caa){_0x1d2992=_0x1d2992-0x0;var _0x30f362=_0x1376[_0x1d2992];return _0x30f362;};'use strict';var Sequelize=require('sequelize');module[_0x6137('0x0')]={'name':{'type':Sequelize[_0x6137('0x1')],'get':function(_0x97fa5){return this[_0x6137('0x2')](_0x6137('0x3'));}},'action':{'type':Sequelize[_0x6137('0x4')],'allowNull':![],'validate':{'isIn':{'args':[[_0x6137('0x5'),'integration',_0x6137('0x6'),_0x6137('0x7'),'urlForward','browser','bot',_0x6137('0x8')]],'msg':_0x6137('0x9')}},'comment':_0x6137('0x9')},'data1':{'type':Sequelize[_0x6137('0x4')](0x1000),'comment':_0x6137('0xa')},'data2':{'type':Sequelize[_0x6137('0x4')](0x1000),'comment':'contactManager[autoCreate(0=No,1=Yes)],\x20urlForward[URL],\x20script[type],\x20integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20browser[TemplateId,URL]'},'data3':{'type':Sequelize[_0x6137('0x4')](0x1000),'comment':_0x6137('0xb')},'data4':{'type':Sequelize[_0x6137('0x4')](0x1000),'comments':_0x6137('0xc')},'data5':{'type':Sequelize[_0x6137('0x4')](0x1000),'comments':'urlForward[timeout],\x20browser[windowWidth],\x20contactManager[ignoreDialerContactId]'},'data6':{'type':Sequelize['STRING'],'comments':_0x6137('0xd')},'data7':{'type':Sequelize[_0x6137('0xe')],'comments':_0x6137('0xf')}}; \ No newline at end of file diff --git a/server/api/action/action.controller.js b/server/api/action/action.controller.js index 46a835b..7ea1277 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 _0xf68f=['lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','limit','undefined','count','offset','set','apply','reject','save','update','then','error','stack','name','send','body','Action','catch','destroy','find','params','eml-format','bluebird','util','path','sox','to-csv','fs-extra'];(function(_0x1f09fa,_0x3265ca){var _0x197c8d=function(_0x91c3b){while(--_0x91c3b){_0x1f09fa['push'](_0x1f09fa['shift']());}};_0x197c8d(++_0x3265ca);}(_0xf68f,0x197));var _0xff68=function(_0x3c4c0a,_0x31d74c){_0x3c4c0a=_0x3c4c0a-0x0;var _0x5bd729=_0xf68f[_0x3c4c0a];return _0x5bd729;};'use strict';var emlformat=require(_0xff68('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xff68('0x1'));var Mustache=require('mustache');var util=require(_0xff68('0x2'));var path=require(_0xff68('0x3'));var sox=require(_0xff68('0x4'));var csv=require(_0xff68('0x5'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xff68('0x6'));var _=require(_0xff68('0x7'));var squel=require('squel');var crypto=require(_0xff68('0x8'));var jsforce=require(_0xff68('0x9'));var deskjs=require(_0xff68('0xa'));var toCsv=require(_0xff68('0x5'));var querystring=require(_0xff68('0xb'));var Papa=require(_0xff68('0xc'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xff68('0xd'));var as=require(_0xff68('0xe'));var hardwareService=require(_0xff68('0xf'));var logger=require(_0xff68('0x10'))(_0xff68('0x11'));var utils=require(_0xff68('0x12'));var config=require(_0xff68('0x13'));var licenseUtil=require(_0xff68('0x14'));var db=require(_0xff68('0x15'))['db'];function respondWithStatusCode(_0x1db935,_0x538f1e){_0x538f1e=_0x538f1e||0xcc;return function(_0x34905c){if(_0x34905c){return _0x1db935[_0xff68('0x16')](_0x538f1e);}return _0x1db935[_0xff68('0x17')](_0x538f1e)[_0xff68('0x18')]();};}function respondWithResult(_0x81fe52,_0x39284a){_0x39284a=_0x39284a||0xc8;return function(_0x517975){if(_0x517975){return _0x81fe52['status'](_0x39284a)[_0xff68('0x19')](_0x517975);}};}function respondWithFilteredResult(_0x2ed6e8,_0x47550a){return function(_0xe9b74){if(_0xe9b74){var _0x1fa53d=typeof _0x47550a['offset']==='undefined'&&typeof _0x47550a[_0xff68('0x1a')]===_0xff68('0x1b');var _0x211497=_0xe9b74[_0xff68('0x1c')];var _0x7c517e=_0x1fa53d?0x0:_0x47550a[_0xff68('0x1d')];var _0x40dafb=_0x1fa53d?_0xe9b74['count']:_0x47550a['offset']+_0x47550a[_0xff68('0x1a')];var _0xdd65f9;if(_0x40dafb>=_0x211497){_0x40dafb=_0x211497;_0xdd65f9=0xc8;}else{_0xdd65f9=0xce;}_0x2ed6e8[_0xff68('0x17')](_0xdd65f9);return _0x2ed6e8[_0xff68('0x1e')]('Content-Range',_0x7c517e+'-'+_0x40dafb+'/'+_0x211497)['json'](_0xe9b74);}return null;};}function patchUpdates(_0x1c034a){return function(_0x599335){try{jsonpatch[_0xff68('0x1f')](_0x599335,_0x1c034a,!![]);}catch(_0x4ec569){return BPromise[_0xff68('0x20')](_0x4ec569);}return _0x599335[_0xff68('0x21')]();};}function saveUpdates(_0x480949,_0x4e116c){return function(_0x339649){if(_0x339649){return _0x339649[_0xff68('0x22')](_0x480949)['then'](function(_0x559a7f){return _0x559a7f;});}return null;};}function removeEntity(_0x55e101,_0x57e501){return function(_0x282012){if(_0x282012){return _0x282012['destroy']()[_0xff68('0x23')](function(){_0x55e101[_0xff68('0x17')](0xcc)[_0xff68('0x18')]();});}};}function handleEntityNotFound(_0x3668f7,_0x48dbf5){return function(_0xabd9c6){if(!_0xabd9c6){_0x3668f7[_0xff68('0x16')](0x194);}return _0xabd9c6;};}function handleError(_0x414a38,_0x12bc40){_0x12bc40=_0x12bc40||0x1f4;return function(_0x24ffd9){logger[_0xff68('0x24')](_0x24ffd9[_0xff68('0x25')]);if(_0x24ffd9['name']){delete _0x24ffd9[_0xff68('0x26')];}_0x414a38[_0xff68('0x17')](_0x12bc40)[_0xff68('0x27')](_0x24ffd9);};}exports[_0xff68('0x22')]=function(_0x28b129,_0x233a91){if(_0x28b129[_0xff68('0x28')]['id']){delete _0x28b129[_0xff68('0x28')]['id'];}return db[_0xff68('0x29')]['find']({'where':{'id':_0x28b129['params']['id']}})[_0xff68('0x23')](handleEntityNotFound(_0x233a91,null))['then'](saveUpdates(_0x28b129[_0xff68('0x28')],null))[_0xff68('0x23')](respondWithResult(_0x233a91,null))[_0xff68('0x2a')](handleError(_0x233a91,null));};exports[_0xff68('0x2b')]=function(_0x11ca18,_0x3769ce){return db[_0xff68('0x29')][_0xff68('0x2c')]({'where':{'id':_0x11ca18[_0xff68('0x2d')]['id']}})[_0xff68('0x23')](handleEntityNotFound(_0x3769ce,null))['then'](removeEntity(_0x3769ce,null))[_0xff68('0x2a')](handleError(_0x3769ce,null));}; \ No newline at end of file +var _0x9e76=['send','body','Action','find','params','catch','eml-format','rimraf','zip-dir','bluebird','util','path','to-csv','ejs','lodash','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','save','update','then','destroy','error','stack','name'];(function(_0x3b826d,_0x1d0b68){var _0x38e1b3=function(_0x314620){while(--_0x314620){_0x3b826d['push'](_0x3b826d['shift']());}};_0x38e1b3(++_0x1d0b68);}(_0x9e76,0x114));var _0x69e7=function(_0x1762b4,_0x33d836){_0x1762b4=_0x1762b4-0x0;var _0x29beda=_0x9e76[_0x1762b4];return _0x29beda;};'use strict';var emlformat=require(_0x69e7('0x0'));var rimraf=require(_0x69e7('0x1'));var zipdir=require(_0x69e7('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x69e7('0x3'));var Mustache=require('mustache');var util=require(_0x69e7('0x4'));var path=require(_0x69e7('0x5'));var sox=require('sox');var csv=require(_0x69e7('0x6'));var ejs=require(_0x69e7('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x69e7('0x8'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x69e7('0x9'));var toCsv=require(_0x69e7('0x6'));var querystring=require(_0x69e7('0xa'));var Papa=require(_0x69e7('0xb'));var Redis=require(_0x69e7('0xc'));var authService=require(_0x69e7('0xd'));var qs=require(_0x69e7('0xe'));var as=require(_0x69e7('0xf'));var hardwareService=require(_0x69e7('0x10'));var logger=require(_0x69e7('0x11'))('api');var utils=require(_0x69e7('0x12'));var config=require(_0x69e7('0x13'));var licenseUtil=require(_0x69e7('0x14'));var db=require(_0x69e7('0x15'))['db'];function respondWithStatusCode(_0x344ee2,_0xc0478d){_0xc0478d=_0xc0478d||0xcc;return function(_0x4a0e23){if(_0x4a0e23){return _0x344ee2[_0x69e7('0x16')](_0xc0478d);}return _0x344ee2[_0x69e7('0x17')](_0xc0478d)[_0x69e7('0x18')]();};}function respondWithResult(_0xff9b77,_0x35eef4){_0x35eef4=_0x35eef4||0xc8;return function(_0x5650ea){if(_0x5650ea){return _0xff9b77[_0x69e7('0x17')](_0x35eef4)[_0x69e7('0x19')](_0x5650ea);}};}function respondWithFilteredResult(_0x233318,_0x533dca){return function(_0x165cca){if(_0x165cca){var _0x33c195=typeof _0x533dca[_0x69e7('0x1a')]===_0x69e7('0x1b')&&typeof _0x533dca[_0x69e7('0x1c')]==='undefined';var _0x41a5ac=_0x165cca[_0x69e7('0x1d')];var _0x1fc4d5=_0x33c195?0x0:_0x533dca[_0x69e7('0x1a')];var _0x50d52f=_0x33c195?_0x165cca[_0x69e7('0x1d')]:_0x533dca['offset']+_0x533dca[_0x69e7('0x1c')];var _0x19be00;if(_0x50d52f>=_0x41a5ac){_0x50d52f=_0x41a5ac;_0x19be00=0xc8;}else{_0x19be00=0xce;}_0x233318[_0x69e7('0x17')](_0x19be00);return _0x233318[_0x69e7('0x1e')]('Content-Range',_0x1fc4d5+'-'+_0x50d52f+'/'+_0x41a5ac)[_0x69e7('0x19')](_0x165cca);}return null;};}function patchUpdates(_0x4519dc){return function(_0x2b9024){try{jsonpatch[_0x69e7('0x1f')](_0x2b9024,_0x4519dc,!![]);}catch(_0x363774){return BPromise['reject'](_0x363774);}return _0x2b9024[_0x69e7('0x20')]();};}function saveUpdates(_0x5371ef,_0x4e9038){return function(_0x16f3f5){if(_0x16f3f5){return _0x16f3f5[_0x69e7('0x21')](_0x5371ef)[_0x69e7('0x22')](function(_0x547b06){return _0x547b06;});}return null;};}function removeEntity(_0xac79a9,_0x86a808){return function(_0x45ab24){if(_0x45ab24){return _0x45ab24[_0x69e7('0x23')]()['then'](function(){_0xac79a9[_0x69e7('0x17')](0xcc)[_0x69e7('0x18')]();});}};}function handleEntityNotFound(_0x2709fc,_0x48d0e9){return function(_0x48adfa){if(!_0x48adfa){_0x2709fc[_0x69e7('0x16')](0x194);}return _0x48adfa;};}function handleError(_0x117efc,_0x1fa0af){_0x1fa0af=_0x1fa0af||0x1f4;return function(_0x188ece){logger[_0x69e7('0x24')](_0x188ece[_0x69e7('0x25')]);if(_0x188ece[_0x69e7('0x26')]){delete _0x188ece[_0x69e7('0x26')];}_0x117efc[_0x69e7('0x17')](_0x1fa0af)[_0x69e7('0x27')](_0x188ece);};}exports[_0x69e7('0x21')]=function(_0x519a47,_0x54af35){if(_0x519a47[_0x69e7('0x28')]['id']){delete _0x519a47[_0x69e7('0x28')]['id'];}return db[_0x69e7('0x29')][_0x69e7('0x2a')]({'where':{'id':_0x519a47[_0x69e7('0x2b')]['id']}})[_0x69e7('0x22')](handleEntityNotFound(_0x54af35,null))[_0x69e7('0x22')](saveUpdates(_0x519a47['body'],null))[_0x69e7('0x22')](respondWithResult(_0x54af35,null))['catch'](handleError(_0x54af35,null));};exports[_0x69e7('0x23')]=function(_0x3f2261,_0x9dcc3e){return db['Action'][_0x69e7('0x2a')]({'where':{'id':_0x3f2261[_0x69e7('0x2b')]['id']}})['then'](handleEntityNotFound(_0x9dcc3e,null))[_0x69e7('0x22')](removeEntity(_0x9dcc3e,null))[_0x69e7('0x2c')](handleError(_0x9dcc3e,null));}; \ No newline at end of file diff --git a/server/api/action/action.model.js b/server/api/action/action.model.js index b1ac685..6144453 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 _0xddc7=['lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','define','Action','tools_actions'];(function(_0x576c74,_0x52aacc){var _0x3c6c9b=function(_0x4544e3){while(--_0x4544e3){_0x576c74['push'](_0x576c74['shift']());}};_0x3c6c9b(++_0x52aacc);}(_0xddc7,0x1b0));var _0x7ddc=function(_0x59ee41,_0xaf7db8){_0x59ee41=_0x59ee41-0x0;var _0x3ecd3e=_0xddc7[_0x59ee41];return _0x3ecd3e;};'use strict';var _=require(_0x7ddc('0x0'));var util=require(_0x7ddc('0x1'));var logger=require(_0x7ddc('0x2'))('api');var moment=require(_0x7ddc('0x3'));var BPromise=require(_0x7ddc('0x4'));var rp=require(_0x7ddc('0x5'));var fs=require('fs');var path=require(_0x7ddc('0x6'));var rimraf=require(_0x7ddc('0x7'));var config=require(_0x7ddc('0x8'));var attributes=require('./action.attributes');module['exports']=function(_0x531548,_0xbde15){return _0x531548[_0x7ddc('0x9')](_0x7ddc('0xa'),attributes,{'tableName':_0x7ddc('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5a41=['tools_actions','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./action.attributes','define'];(function(_0x2f3d29,_0x150e7b){var _0x53d69d=function(_0x45f6ec){while(--_0x45f6ec){_0x2f3d29['push'](_0x2f3d29['shift']());}};_0x53d69d(++_0x150e7b);}(_0x5a41,0x1b1));var _0x15a4=function(_0x3d09e2,_0x58e784){_0x3d09e2=_0x3d09e2-0x0;var _0x5d03cd=_0x5a41[_0x3d09e2];return _0x5d03cd;};'use strict';var _=require(_0x15a4('0x0'));var util=require(_0x15a4('0x1'));var logger=require(_0x15a4('0x2'))(_0x15a4('0x3'));var moment=require(_0x15a4('0x4'));var BPromise=require('bluebird');var rp=require(_0x15a4('0x5'));var fs=require('fs');var path=require(_0x15a4('0x6'));var rimraf=require(_0x15a4('0x7'));var config=require(_0x15a4('0x8'));var attributes=require(_0x15a4('0x9'));module['exports']=function(_0x28841f,_0x209552){return _0x28841f[_0x15a4('0xa')]('Action',attributes,{'tableName':_0x15a4('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/action/action.rpc.js b/server/api/action/action.rpc.js index e7e0de0..d2d7a83 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 _0x1261=['then','info','Action,\x20%s,\x20%s','request\x20sent','Action,\x20%s,\x20%s,\x20%s','error','code','message','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request'];(function(_0x523aab,_0x3a9c5e){var _0x4346ea=function(_0x1a4e5b){while(--_0x1a4e5b){_0x523aab['push'](_0x523aab['shift']());}};_0x4346ea(++_0x3a9c5e);}(_0x1261,0x144));var _0x1126=function(_0x559cc4,_0x44ce57){_0x559cc4=_0x559cc4-0x0;var _0x138971=_0x1261[_0x559cc4];return _0x138971;};'use strict';var _=require('lodash');var util=require(_0x1126('0x0'));var moment=require(_0x1126('0x1'));var BPromise=require(_0x1126('0x2'));var rs=require(_0x1126('0x3'));var fs=require('fs');var Redis=require(_0x1126('0x4'));var db=require(_0x1126('0x5'))['db'];var utils=require(_0x1126('0x6'));var logger=require(_0x1126('0x7'))(_0x1126('0x8'));var config=require(_0x1126('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x1126('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x907180,_0x4f239c,_0x17e5f0){return new BPromise(function(_0x28772d,_0x245be9){return client[_0x1126('0xb')](_0x907180,_0x17e5f0)[_0x1126('0xc')](function(_0x59cfa1){logger[_0x1126('0xd')](_0x1126('0xe'),_0x4f239c,_0x1126('0xf'));logger['debug'](_0x1126('0x10'),_0x4f239c,'request\x20sent',JSON['stringify'](_0x59cfa1));if(_0x59cfa1[_0x1126('0x11')]){if(_0x59cfa1['error'][_0x1126('0x12')]===0x1f4){logger[_0x1126('0x11')](_0x1126('0xe'),_0x4f239c,_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);return _0x245be9(_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);}logger[_0x1126('0x11')](_0x1126('0xe'),_0x4f239c,_0x59cfa1['error']['message']);return _0x28772d(_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);}else{logger[_0x1126('0xd')]('Action,\x20%s,\x20%s',_0x4f239c,_0x1126('0xf'));_0x28772d(_0x59cfa1['result'][_0x1126('0x13')]);}})[_0x1126('0x14')](function(_0x257b5f){logger['error'](_0x1126('0xe'),_0x4f239c,_0x257b5f);_0x245be9(_0x257b5f);});});} \ No newline at end of file +var _0x814b=['info','Action,\x20%s,\x20%s','request\x20sent','debug','Action,\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(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x814b,0x1a2));var _0xb814=function(_0x27a3cb,_0x4af597){_0x27a3cb=_0x27a3cb-0x0;var _0x54ff38=_0x814b[_0x27a3cb];return _0x54ff38;};'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')]('Action,\x20%s,\x20%s',_0x2e6272,_0x21b73f);_0x2913a6(_0x21b73f);});});} \ No newline at end of file diff --git a/server/api/action/index.js b/server/api/action/index.js index dc50ac1..c948935 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 _0x0310=['/:id','isAuthenticated','update','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./action.controller','put'];(function(_0x3c6ec9,_0x40e417){var _0x178f0c=function(_0x280a1e){while(--_0x280a1e){_0x3c6ec9['push'](_0x3c6ec9['shift']());}};_0x178f0c(++_0x40e417);}(_0x0310,0x8b));var _0x0031=function(_0x20ae09,_0x5df3e3){_0x20ae09=_0x20ae09-0x0;var _0x180d2d=_0x0310[_0x20ae09];return _0x180d2d;};'use strict';var multer=require(_0x0031('0x0'));var util=require(_0x0031('0x1'));var path=require(_0x0031('0x2'));var timeout=require(_0x0031('0x3'));var express=require(_0x0031('0x4'));var router=express[_0x0031('0x5')]();var fs_extra=require(_0x0031('0x6'));var auth=require(_0x0031('0x7'));var interaction=require(_0x0031('0x8'));var config=require('../../config/environment');var controller=require(_0x0031('0x9'));router[_0x0031('0xa')](_0x0031('0xb'),auth[_0x0031('0xc')](),controller[_0x0031('0xd')]);router['delete']('/:id',auth[_0x0031('0xc')](),controller['destroy']);module[_0x0031('0xe')]=router; \ No newline at end of file +var _0xabbf=['exports','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','./action.controller','/:id','isAuthenticated','delete'];(function(_0x2855b9,_0x53188f){var _0x70ea14=function(_0x191616){while(--_0x191616){_0x2855b9['push'](_0x2855b9['shift']());}};_0x70ea14(++_0x53188f);}(_0xabbf,0x1c4));var _0xfabb=function(_0x25c988,_0xce8221){_0x25c988=_0x25c988-0x0;var _0x45fcc2=_0xabbf[_0x25c988];return _0x45fcc2;};'use strict';var multer=require('multer');var util=require(_0xfabb('0x0'));var path=require(_0xfabb('0x1'));var timeout=require('connect-timeout');var express=require(_0xfabb('0x2'));var router=express['Router']();var fs_extra=require(_0xfabb('0x3'));var auth=require(_0xfabb('0x4'));var interaction=require(_0xfabb('0x5'));var config=require('../../config/environment');var controller=require(_0xfabb('0x6'));router['put'](_0xfabb('0x7'),auth[_0xfabb('0x8')](),controller['update']);router[_0xfabb('0x9')]('/:id',auth[_0xfabb('0x8')](),controller['destroy']);module[_0xfabb('0xa')]=router; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.attributes.js b/server/api/analyticCustomReport/analyticCustomReport.attributes.js index 758028b..1e56c61 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 _0x425d=['sequelize','STRING','TEXT'];(function(_0x1ee109,_0x342d7d){var _0x968a7e=function(_0x5c40ae){while(--_0x5c40ae){_0x1ee109['push'](_0x1ee109['shift']());}};_0x968a7e(++_0x342d7d);}(_0x425d,0x1e0));var _0xd425=function(_0x1d7bd9,_0x4dc87f){_0x1d7bd9=_0x1d7bd9-0x0;var _0x15384e=_0x425d[_0x1d7bd9];return _0x15384e;};'use strict';var Sequelize=require(_0xd425('0x0'));module['exports']={'name':{'type':Sequelize[_0xd425('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0xd425('0x1')]},'parent':{'type':Sequelize[_0xd425('0x1')]},'table':{'type':Sequelize[_0xd425('0x1')]},'conditions':{'type':Sequelize[_0xd425('0x2')]},'joins':{'type':Sequelize[_0xd425('0x2')]}}; \ No newline at end of file +var _0xafc4=['sequelize','STRING','TEXT'];(function(_0x27530d,_0x46480a){var _0x59e561=function(_0x395fe9){while(--_0x395fe9){_0x27530d['push'](_0x27530d['shift']());}};_0x59e561(++_0x46480a);}(_0xafc4,0x69));var _0x4afc=function(_0x3469b4,_0x3cc80d){_0x3469b4=_0x3469b4-0x0;var _0x263397=_0xafc4[_0x3469b4];return _0x263397;};'use strict';var Sequelize=require(_0x4afc('0x0'));module['exports']={'name':{'type':Sequelize[_0x4afc('0x1')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'parent':{'type':Sequelize[_0x4afc('0x1')]},'table':{'type':Sequelize[_0x4afc('0x1')]},'conditions':{'type':Sequelize[_0x4afc('0x2')]},'joins':{'type':Sequelize[_0x4afc('0x2')]}}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.controller.js b/server/api/analyticCustomReport/analyticCustomReport.controller.js index ac0b66d..a7a8547 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 _0xb480=['IS\x20NOT\x20EMPTY','rules','group','condition','value','getFields','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','findAll','keyBy','select','MetricId','metric','function','replace','format','orderBy','DESC','field','alias','parse','joins','parentKey','foreignTable','table','foreignKey','conditions','clone','debug','sequelize','toString','QueryTypes','SELECT','join','left_join','SUM(%s)','COUNT(%s)','COUNT(DISTINCT\x20%s)','HOUR(%s)','operator','from','%s.%s\x20=\x20%s.%s','output','web','fullPath','randomstring','csv','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','Run\x20Query:','child_process','fork','../../files/reports','savename','runReport','Sequelize','groupBy','Limited\x20Query:','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','dbH','sendStatus','end','json','offset','undefined','count','limit','status','set','apply','reject','update','then','get','UserProfileResource','stack','name','send','AnalyticCustomReport','rawAttributes','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','include','rows','catch','show','params','includeAll','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','Reports','UserProfileSection','userProfileId','autoAssociation','CustomReports','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','destroy','preview','right_join','cross_join','MAX(%s)','MIN(%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)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY'];(function(_0x2158c9,_0x5d139e){var _0xe2a6f0=function(_0x25e08d){while(--_0x25e08d){_0x2158c9['push'](_0x2158c9['shift']());}};_0xe2a6f0(++_0x5d139e);}(_0xb480,0x186));var _0x0b48=function(_0x27c00a,_0x5c3f23){_0x27c00a=_0x27c00a-0x0;var _0x1ad46d=_0xb480[_0x27c00a];return _0x1ad46d;};'use strict';var emlformat=require(_0x0b48('0x0'));var rimraf=require(_0x0b48('0x1'));var zipdir=require(_0x0b48('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x0b48('0x3'));var BPromise=require(_0x0b48('0x4'));var Mustache=require(_0x0b48('0x5'));var util=require(_0x0b48('0x6'));var path=require('path');var sox=require(_0x0b48('0x7'));var csv=require(_0x0b48('0x8'));var ejs=require(_0x0b48('0x9'));var fs=require('fs');var fs_extra=require(_0x0b48('0xa'));var _=require(_0x0b48('0xb'));var squel=require(_0x0b48('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0b48('0xd'));var toCsv=require(_0x0b48('0x8'));var querystring=require(_0x0b48('0xe'));var Papa=require('papaparse');var Redis=require(_0x0b48('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x0b48('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x0b48('0x11'))(_0x0b48('0x12'));var utils=require(_0x0b48('0x13'));var config=require(_0x0b48('0x14'));var licenseUtil=require(_0x0b48('0x15'));var db=require(_0x0b48('0x16'))['db'];var dbH=require(_0x0b48('0x16'))[_0x0b48('0x17')];function respondWithStatusCode(_0x50bd92,_0x2014e9){_0x2014e9=_0x2014e9||0xcc;return function(_0x584a43){if(_0x584a43){return _0x50bd92[_0x0b48('0x18')](_0x2014e9);}return _0x50bd92['status'](_0x2014e9)[_0x0b48('0x19')]();};}function respondWithResult(_0xd09229,_0x14ebd9){_0x14ebd9=_0x14ebd9||0xc8;return function(_0x552fea){if(_0x552fea){return _0xd09229['status'](_0x14ebd9)[_0x0b48('0x1a')](_0x552fea);}};}function respondWithFilteredResult(_0x396950,_0x33abe6){return function(_0x12605b){if(_0x12605b){var _0x5eab15=typeof _0x33abe6[_0x0b48('0x1b')]==='undefined'&&typeof _0x33abe6['limit']===_0x0b48('0x1c');var _0x11bd3b=_0x12605b[_0x0b48('0x1d')];var _0x34ef84=_0x5eab15?0x0:_0x33abe6['offset'];var _0x12a70d=_0x5eab15?_0x12605b[_0x0b48('0x1d')]:_0x33abe6[_0x0b48('0x1b')]+_0x33abe6[_0x0b48('0x1e')];var _0x1a23a5;if(_0x12a70d>=_0x11bd3b){_0x12a70d=_0x11bd3b;_0x1a23a5=0xc8;}else{_0x1a23a5=0xce;}_0x396950[_0x0b48('0x1f')](_0x1a23a5);return _0x396950[_0x0b48('0x20')]('Content-Range',_0x34ef84+'-'+_0x12a70d+'/'+_0x11bd3b)[_0x0b48('0x1a')](_0x12605b);}return null;};}function patchUpdates(_0x5ebbb1){return function(_0x22a3e7){try{jsonpatch[_0x0b48('0x21')](_0x22a3e7,_0x5ebbb1,!![]);}catch(_0x404c0f){return BPromise[_0x0b48('0x22')](_0x404c0f);}return _0x22a3e7['save']();};}function saveUpdates(_0x2e78fb,_0x84bc5c){return function(_0xc31d79){if(_0xc31d79){return _0xc31d79[_0x0b48('0x23')](_0x2e78fb)['then'](function(_0x130f44){return _0x130f44;});}return null;};}function removeEntity(_0x20424c,_0x51ff47){return function(_0x43c756){if(_0x43c756){return _0x43c756['destroy']()[_0x0b48('0x24')](function(){var _0x5b70ec=_0x43c756[_0x0b48('0x25')]({'plain':!![]});var _0x5babb2='CustomReports';return db[_0x0b48('0x26')]['destroy']({'where':{'type':_0x5babb2,'resourceId':_0x5b70ec['id']}})[_0x0b48('0x24')](function(){return _0x43c756;});})[_0x0b48('0x24')](function(){_0x20424c['status'](0xcc)[_0x0b48('0x19')]();});}};}function handleEntityNotFound(_0x5a3041,_0x193fff){return function(_0x5a1d2b){if(!_0x5a1d2b){_0x5a3041[_0x0b48('0x18')](0x194);}return _0x5a1d2b;};}function handleError(_0x1173c2,_0x41f4b5){_0x41f4b5=_0x41f4b5||0x1f4;return function(_0x550a84){logger['error'](_0x550a84[_0x0b48('0x27')]);if(_0x550a84[_0x0b48('0x28')]){delete _0x550a84['name'];}_0x1173c2[_0x0b48('0x1f')](_0x41f4b5)[_0x0b48('0x29')](_0x550a84);};}exports['index']=function(_0x57d3e2,_0x4625da){var _0x2c79ab={},_0x9fa79a={},_0x1b851f={'count':0x0,'rows':[]};var _0x25691d=_['map'](db[_0x0b48('0x2a')][_0x0b48('0x2b')],function(_0x4d02b5){return{'name':_0x4d02b5['fieldName'],'type':_0x4d02b5['type'][_0x0b48('0x2c')]};});_0x9fa79a[_0x0b48('0x2d')]=_[_0x0b48('0x2e')](_0x25691d,'name');_0x9fa79a[_0x0b48('0x2f')]=_[_0x0b48('0x30')](_0x57d3e2[_0x0b48('0x2f')]);_0x9fa79a[_0x0b48('0x31')]=_[_0x0b48('0x32')](_0x9fa79a[_0x0b48('0x2d')],_0x9fa79a[_0x0b48('0x2f')]);_0x2c79ab[_0x0b48('0x33')]=_['intersection'](_0x9fa79a[_0x0b48('0x2d')],qs[_0x0b48('0x34')](_0x57d3e2[_0x0b48('0x2f')][_0x0b48('0x34')]));_0x2c79ab[_0x0b48('0x33')]=_0x2c79ab[_0x0b48('0x33')][_0x0b48('0x35')]?_0x2c79ab[_0x0b48('0x33')]:_0x9fa79a[_0x0b48('0x2d')];if(!_0x57d3e2[_0x0b48('0x2f')][_0x0b48('0x36')](_0x0b48('0x37'))){_0x2c79ab['limit']=qs[_0x0b48('0x1e')](_0x57d3e2['query'][_0x0b48('0x1e')]);_0x2c79ab[_0x0b48('0x1b')]=qs[_0x0b48('0x1b')](_0x57d3e2['query'][_0x0b48('0x1b')]);}_0x2c79ab[_0x0b48('0x38')]=qs[_0x0b48('0x39')](_0x57d3e2['query'][_0x0b48('0x39')]);_0x2c79ab[_0x0b48('0x3a')]=qs[_0x0b48('0x31')](_[_0x0b48('0x3b')](_0x57d3e2[_0x0b48('0x2f')],_0x9fa79a[_0x0b48('0x31')]),_0x25691d);if(_0x57d3e2['query'][_0x0b48('0x3c')]){_0x2c79ab[_0x0b48('0x3a')]=_[_0x0b48('0x3d')](_0x2c79ab[_0x0b48('0x3a')],{'$or':_[_0x0b48('0x2e')](_0x25691d,function(_0x32f748){if(_0x32f748[_0x0b48('0x3e')]!==_0x0b48('0x3f')){var _0x509c86={};_0x509c86[_0x32f748['name']]={'$like':'%'+_0x57d3e2[_0x0b48('0x2f')][_0x0b48('0x3c')]+'%'};return _0x509c86;}})});}_0x2c79ab=_[_0x0b48('0x3d')]({},_0x2c79ab,_0x57d3e2[_0x0b48('0x40')]);var _0x48c78d={'where':_0x2c79ab['where']};return db[_0x0b48('0x2a')]['count'](_0x48c78d)[_0x0b48('0x24')](function(_0x12c284){_0x1b851f[_0x0b48('0x1d')]=_0x12c284;if(_0x57d3e2['query']['includeAll']){_0x2c79ab[_0x0b48('0x41')]=[{'all':!![]}];}return db[_0x0b48('0x2a')]['findAll'](_0x2c79ab);})['then'](function(_0xa17b36){_0x1b851f[_0x0b48('0x42')]=_0xa17b36;return _0x1b851f;})['then'](respondWithFilteredResult(_0x4625da,_0x2c79ab))[_0x0b48('0x43')](handleError(_0x4625da,null));};exports[_0x0b48('0x44')]=function(_0x11b94a,_0x123790){var _0x3cc896={'raw':![],'where':{'id':_0x11b94a[_0x0b48('0x45')]['id']}},_0x3b5f5b={};_0x3b5f5b[_0x0b48('0x2d')]=_['keys'](db['AnalyticCustomReport'][_0x0b48('0x2b')]);_0x3b5f5b['query']=_[_0x0b48('0x30')](_0x11b94a['query']);_0x3b5f5b[_0x0b48('0x31')]=_[_0x0b48('0x32')](_0x3b5f5b['model'],_0x3b5f5b[_0x0b48('0x2f')]);_0x3cc896[_0x0b48('0x33')]=_[_0x0b48('0x32')](_0x3b5f5b[_0x0b48('0x2d')],qs[_0x0b48('0x34')](_0x11b94a[_0x0b48('0x2f')]['fields']));_0x3cc896[_0x0b48('0x33')]=_0x3cc896[_0x0b48('0x33')][_0x0b48('0x35')]?_0x3cc896['attributes']:_0x3b5f5b[_0x0b48('0x2d')];if(_0x11b94a[_0x0b48('0x2f')][_0x0b48('0x46')]){_0x3cc896[_0x0b48('0x41')]=[{'all':!![]}];}_0x3cc896=_[_0x0b48('0x3d')]({},_0x3cc896,_0x11b94a[_0x0b48('0x40')]);return db[_0x0b48('0x2a')][_0x0b48('0x47')](_0x3cc896)[_0x0b48('0x24')](handleEntityNotFound(_0x123790,null))[_0x0b48('0x24')](respondWithResult(_0x123790,null))[_0x0b48('0x43')](handleError(_0x123790,null));};exports[_0x0b48('0x48')]=function(_0x5db271,_0x2b77f4){return db[_0x0b48('0x2a')][_0x0b48('0x48')](_0x5db271[_0x0b48('0x49')],{})['then'](function(_0x2b5608){var _0x563ebf=_0x5db271['user'][_0x0b48('0x25')]({'plain':!![]});if(!_0x563ebf)throw new Error(_0x0b48('0x4a'));if(_0x563ebf[_0x0b48('0x4b')]===_0x0b48('0x4c')){var _0x5db15a=_0x2b5608[_0x0b48('0x25')]({'plain':!![]});var _0x37c331=_0x0b48('0x4d');return db[_0x0b48('0x4e')][_0x0b48('0x47')]({'where':{'name':_0x37c331,'userProfileId':_0x563ebf[_0x0b48('0x4f')]},'raw':!![]})[_0x0b48('0x24')](function(_0x4fc175){if(_0x4fc175&&_0x4fc175[_0x0b48('0x50')]===0x0){return db[_0x0b48('0x26')][_0x0b48('0x48')]({'name':_0x5db15a[_0x0b48('0x28')],'resourceId':_0x5db15a['id'],'type':_0x0b48('0x51'),'sectionId':_0x4fc175['id']},{})['then'](function(){return _0x2b5608;});}else{return _0x2b5608;}})['catch'](function(_0x389dfb){logger[_0x0b48('0x52')](_0x0b48('0x53'),_0x389dfb);throw _0x389dfb;});}return _0x2b5608;})['then'](respondWithResult(_0x2b77f4,0xc9))[_0x0b48('0x43')](handleError(_0x2b77f4,null));};exports[_0x0b48('0x23')]=function(_0x23c870,_0x3ae0f2){if(_0x23c870['body']['id']){delete _0x23c870[_0x0b48('0x49')]['id'];}return db['AnalyticCustomReport'][_0x0b48('0x47')]({'where':{'id':_0x23c870[_0x0b48('0x45')]['id']}})['then'](handleEntityNotFound(_0x3ae0f2,null))[_0x0b48('0x24')](saveUpdates(_0x23c870[_0x0b48('0x49')],null))[_0x0b48('0x24')](respondWithResult(_0x3ae0f2,null))[_0x0b48('0x43')](handleError(_0x3ae0f2,null));};exports[_0x0b48('0x54')]=function(_0x31b094,_0x138299){return db[_0x0b48('0x2a')][_0x0b48('0x47')]({'where':{'id':_0x31b094[_0x0b48('0x45')]['id']}})['then'](handleEntityNotFound(_0x138299,null))[_0x0b48('0x24')](removeEntity(_0x138299,null))['catch'](handleError(_0x138299,null));};exports[_0x0b48('0x55')]=function(_0x4dc6b3,_0x253b43){var _0x153ebe=0xa;var _0x1a25df=['join','left_join',_0x0b48('0x56'),_0x0b48('0x57')];var _0x21e6cb={'SUM':'SUM(%s)','COUNT':'COUNT(%s)','COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0x0b48('0x58'),'MIN':_0x0b48('0x59'),'AVG':_0x0b48('0x5a'),'GROUP_CONCAT':_0x0b48('0x5b'),'GROUP_CONCAT ASC':_0x0b48('0x5c'),'GROUP_CONCAT DESC':_0x0b48('0x5d')};var _0x26dff6={'SEC_TO_TIME':_0x0b48('0x5e'),'DATE':_0x0b48('0x5f'),'HOUR':'HOUR(%s)','ROUND':_0x0b48('0x60'),'UNIX_TIMESTAMP':_0x0b48('0x61')};var _0x8841ad=function(_0x3716d9){return!_[_0x0b48('0x62')]([_0x0b48('0x63'),_0x0b48('0x64'),_0x0b48('0x65'),_0x0b48('0x66')],_0x3716d9);};var _0x33bfb8=function(_0xb5b9f1){if(!_0xb5b9f1||!_0xb5b9f1['rules'][_0x0b48('0x35')]){return'';}for(var _0x14822a='(',_0x44963e=0x0;_0x44963e<_0xb5b9f1[_0x0b48('0x67')]['length'];_0x44963e+=0x1){_0x44963e>0x0&&(_0x14822a+='\x20'+_0xb5b9f1['operator']+'\x20');_0x14822a+=_0xb5b9f1['rules'][_0x44963e]['group']?_0x33bfb8(_0xb5b9f1[_0x0b48('0x67')][_0x44963e][_0x0b48('0x68')]):_0xb5b9f1[_0x0b48('0x67')][_0x44963e]['field']+'\x20'+_0xb5b9f1['rules'][_0x44963e][_0x0b48('0x69')]+(_0x8841ad(_0xb5b9f1['rules'][_0x44963e]['condition'])?'\x20'+_0xb5b9f1[_0x0b48('0x67')][_0x44963e][_0x0b48('0x6a')]:'');}return _0x14822a+')';};var _0x1e6cf9={'where':{'id':_0x4dc6b3[_0x0b48('0x45')]['id']}},_0x3e2ec7,_0x2d0cc4,_0x35dc43,_0x6434d8,_0x45f649;_0x1e6cf9=_[_0x0b48('0x3d')]({},_0x1e6cf9,_0x4dc6b3[_0x0b48('0x40')]);return db[_0x0b48('0x2a')]['find'](_0x1e6cf9)['then'](function(_0x5006a4){if(_0x5006a4){_0x3e2ec7=_0x5006a4;return _0x5006a4[_0x0b48('0x6b')]();}return null;})[_0x0b48('0x24')](function(_0x346827){if(_0x346827){if(!_0x346827[_0x0b48('0x35')]){throw new db['Sequelize'][(_0x0b48('0x6c'))](_0x0b48('0x6d'),0x193);}_0x2d0cc4=_0x346827;return db[_0x0b48('0x6e')][_0x0b48('0x6f')]({'raw':!![]});}return null;})[_0x0b48('0x24')](function(_0x28a50f){if(_0x28a50f){_0x35dc43=_[_0x0b48('0x70')](_0x28a50f,'id');var _0x59dbb6;var _0x216d1e=squel[_0x0b48('0x71')]();_0x216d1e['from'](_0x3e2ec7['table']);for(var _0x225395=0x0;_0x225395<_0x2d0cc4['length'];_0x225395+=0x1){_0x59dbb6=_0x2d0cc4[_0x225395][_0x0b48('0x72')]?_0x35dc43[_0x2d0cc4[_0x225395]['MetricId']][_0x0b48('0x73')]:_0x2d0cc4[_0x225395]['field'];_0x59dbb6=_0x2d0cc4[_0x225395][_0x0b48('0x74')]?_[_0x0b48('0x75')](_0x21e6cb[_0x2d0cc4[_0x225395][_0x0b48('0x74')]],'%s',_0x59dbb6):_0x59dbb6;_0x59dbb6=_0x2d0cc4[_0x225395][_0x0b48('0x76')]?_[_0x0b48('0x75')](_0x26dff6[_0x2d0cc4[_0x225395]['format']],'%s',_0x59dbb6):_0x59dbb6;if(_0x2d0cc4[_0x225395]['groupBy']){_0x216d1e['group'](_0x59dbb6);}_0x2d0cc4[_0x225395]['orderBy']&&_0x216d1e[_0x0b48('0x38')](_0x59dbb6,_0x2d0cc4[_0x225395][_0x0b48('0x77')]===_0x0b48('0x78')?![]:!![]);_0x216d1e[_0x0b48('0x79')](_0x59dbb6,_0x2d0cc4[_0x225395][_0x0b48('0x7a')]||_0x59dbb6);}if(_0x3e2ec7['joins']){_0x3e2ec7['joins']=JSON[_0x0b48('0x7b')](_0x3e2ec7['joins']);for(var _0x2b32f5=0x0;_0x2b32f5<_0x3e2ec7['joins'][_0x0b48('0x35')];_0x2b32f5+=0x1){if(_0x3e2ec7['joins'][_0x2b32f5][_0x0b48('0x3e')]&&_['includes'](_0x1a25df,_0x3e2ec7[_0x0b48('0x7c')][_0x2b32f5][_0x0b48('0x3e')])&&_0x3e2ec7[_0x0b48('0x7c')][_0x2b32f5][_0x0b48('0x7d')]&&_0x3e2ec7[_0x0b48('0x7c')][_0x2b32f5][_0x0b48('0x7e')]&&_0x3e2ec7[_0x0b48('0x7c')][_0x2b32f5]['foreignKey']){_0x216d1e[_0x3e2ec7[_0x0b48('0x7c')][_0x2b32f5][_0x0b48('0x3e')]](_0x3e2ec7[_0x0b48('0x7c')][_0x2b32f5]['foreignTable'],null,util['format']('%s.%s\x20=\x20%s.%s',_0x3e2ec7[_0x0b48('0x7f')],_0x3e2ec7[_0x0b48('0x7c')][_0x2b32f5][_0x0b48('0x7d')],_0x3e2ec7[_0x0b48('0x7c')][_0x2b32f5][_0x0b48('0x7e')],_0x3e2ec7['joins'][_0x2b32f5][_0x0b48('0x80')]));}}}if(_0x3e2ec7[_0x0b48('0x81')]){_0x3e2ec7[_0x0b48('0x81')]=JSON[_0x0b48('0x7b')](_0x3e2ec7['conditions']);_0x216d1e[_0x0b48('0x3a')](_0x33bfb8(_0x3e2ec7['conditions'][_0x0b48('0x68')]));}_0x45f649=_0x216d1e[_0x0b48('0x82')]();_0x216d1e[_0x0b48('0x1e')](_0x153ebe);_0x216d1e[_0x0b48('0x1b')](0x0);logger[_0x0b48('0x83')]('Limited\x20Query:',_0x216d1e['toString']());return dbH[_0x0b48('0x84')]['query'](_0x216d1e[_0x0b48('0x85')](),{'type':dbH[_0x0b48('0x84')][_0x0b48('0x86')][_0x0b48('0x87')]});}})[_0x0b48('0x24')](respondWithResult(_0x253b43,null))[_0x0b48('0x43')](handleError(_0x253b43,null));};function runReport(_0x4fbcbe,_0x18e8e6,_0x482d30){var _0x4c47bc=_0x18e8e6[_0x0b48('0x28')];var _0xc2ddbe=0xa;var _0xe163d6=[_0x0b48('0x88'),_0x0b48('0x89'),_0x0b48('0x56'),_0x0b48('0x57')];var _0x4909c4={'SUM':_0x0b48('0x8a'),'COUNT':_0x0b48('0x8b'),'COUNT DISTINCT':_0x0b48('0x8c'),'MAX':_0x0b48('0x58'),'MIN':_0x0b48('0x59'),'AVG':_0x0b48('0x5a'),'GROUP_CONCAT':_0x0b48('0x5b'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x0b48('0x5d')};var _0xd8ff16={'SEC_TO_TIME':_0x0b48('0x5e'),'DATE':_0x0b48('0x5f'),'HOUR':_0x0b48('0x8d'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0x0b48('0x61')};var _0x1da37b=function(_0x10e039){return!_[_0x0b48('0x62')]([_0x0b48('0x63'),'IS\x20NOT\x20NULL',_0x0b48('0x65'),_0x0b48('0x66')],_0x10e039);};var _0x510de5=function(_0x18d3d4){if(!_0x18d3d4||!_0x18d3d4[_0x0b48('0x67')][_0x0b48('0x35')]){return'';}for(var _0x583ff2='(',_0x1f2323=0x0;_0x1f2323<_0x18d3d4[_0x0b48('0x67')][_0x0b48('0x35')];_0x1f2323+=0x1){_0x1f2323>0x0&&(_0x583ff2+='\x20'+_0x18d3d4[_0x0b48('0x8e')]+'\x20');_0x583ff2+=_0x18d3d4[_0x0b48('0x67')][_0x1f2323][_0x0b48('0x68')]?_0x510de5(_0x18d3d4[_0x0b48('0x67')][_0x1f2323][_0x0b48('0x68')]):_0x18d3d4[_0x0b48('0x67')][_0x1f2323][_0x0b48('0x79')]+'\x20'+_0x18d3d4[_0x0b48('0x67')][_0x1f2323][_0x0b48('0x69')]+(_0x1da37b(_0x18d3d4[_0x0b48('0x67')][_0x1f2323]['condition'])?'\x20'+_0x18d3d4['rules'][_0x1f2323][_0x0b48('0x6a')]:'');}return _0x583ff2+')';};var _0xa7434c={'where':{'id':_0x4fbcbe['id']}},_0x5aec87,_0x336303,_0x5368f3,_0x404f4b,_0x2e6f31;_0xa7434c=_[_0x0b48('0x3d')]({},_0xa7434c,_0x482d30);return db[_0x0b48('0x2a')][_0x0b48('0x47')](_0xa7434c)[_0x0b48('0x24')](function(_0xb019ba){if(_0xb019ba){_0x5aec87=_0xb019ba;return _0xb019ba['getFields']();}return null;})[_0x0b48('0x24')](function(_0x530436){if(_0x530436){if(!_0x530436['length']){throw new db['Sequelize'][(_0x0b48('0x6c'))](_0x0b48('0x6d'),0x193);}_0x336303=_0x530436;return db[_0x0b48('0x6e')][_0x0b48('0x6f')]({'raw':!![]});}return null;})[_0x0b48('0x24')](function(_0x5ee9f1){if(_0x5ee9f1){_0x5368f3=_['keyBy'](_0x5ee9f1,'id');var _0x37b793;var _0x4377bc=squel['select']();_0x4377bc[_0x0b48('0x8f')](_0x5aec87[_0x0b48('0x7f')]);for(var _0x3b295d=0x0;_0x3b295d<_0x336303[_0x0b48('0x35')];_0x3b295d+=0x1){_0x37b793=_0x336303[_0x3b295d][_0x0b48('0x72')]?_0x5368f3[_0x336303[_0x3b295d][_0x0b48('0x72')]][_0x0b48('0x73')]:_0x336303[_0x3b295d][_0x0b48('0x79')];_0x37b793=_0x336303[_0x3b295d][_0x0b48('0x74')]?_['replace'](_0x4909c4[_0x336303[_0x3b295d][_0x0b48('0x74')]],'%s',_0x37b793):_0x37b793;_0x37b793=_0x336303[_0x3b295d][_0x0b48('0x76')]?_[_0x0b48('0x75')](_0xd8ff16[_0x336303[_0x3b295d][_0x0b48('0x76')]],'%s',_0x37b793):_0x37b793;if(_0x336303[_0x3b295d]['groupBy']){_0x4377bc[_0x0b48('0x68')](_0x37b793);}_0x336303[_0x3b295d][_0x0b48('0x77')]&&_0x4377bc['order'](_0x37b793,_0x336303[_0x3b295d]['orderBy']===_0x0b48('0x78')?![]:!![]);_0x4377bc[_0x0b48('0x79')](_0x37b793,_0x336303[_0x3b295d][_0x0b48('0x7a')]||_0x37b793);}if(_0x5aec87[_0x0b48('0x7c')]){_0x5aec87[_0x0b48('0x7c')]=JSON[_0x0b48('0x7b')](_0x5aec87[_0x0b48('0x7c')]);for(var _0xb36097=0x0;_0xb36097<_0x5aec87[_0x0b48('0x7c')][_0x0b48('0x35')];_0xb36097+=0x1){if(_0x5aec87[_0x0b48('0x7c')][_0xb36097]['type']&&_[_0x0b48('0x62')](_0xe163d6,_0x5aec87[_0x0b48('0x7c')][_0xb36097][_0x0b48('0x3e')])&&_0x5aec87[_0x0b48('0x7c')][_0xb36097][_0x0b48('0x7d')]&&_0x5aec87[_0x0b48('0x7c')][_0xb36097]['foreignTable']&&_0x5aec87[_0x0b48('0x7c')][_0xb36097][_0x0b48('0x80')]){_0x4377bc[_0x5aec87[_0x0b48('0x7c')][_0xb36097][_0x0b48('0x3e')]](_0x5aec87[_0x0b48('0x7c')][_0xb36097][_0x0b48('0x7e')],null,util[_0x0b48('0x76')](_0x0b48('0x90'),_0x5aec87[_0x0b48('0x7f')],_0x5aec87['joins'][_0xb36097][_0x0b48('0x7d')],_0x5aec87['joins'][_0xb36097][_0x0b48('0x7e')],_0x5aec87[_0x0b48('0x7c')][_0xb36097][_0x0b48('0x80')]));}}}if(_0x5aec87[_0x0b48('0x81')]){_0x5aec87['conditions']=JSON[_0x0b48('0x7b')](_0x5aec87[_0x0b48('0x81')]);_0x4377bc[_0x0b48('0x3a')](_0x510de5(_0x5aec87[_0x0b48('0x81')][_0x0b48('0x68')]));}_0x2e6f31=_0x4377bc[_0x0b48('0x82')]();_0x4377bc['limit'](_0xc2ddbe);_0x4377bc[_0x0b48('0x1b')](0x0);return;}})[_0x0b48('0x24')](function(){if(_0x18e8e6[_0x0b48('0x91')]===_0x0b48('0x92')){return null;}var _0x240d27=_[_0x0b48('0x3d')](_0x18e8e6,{'name':_0x18e8e6[_0x0b48('0x93')]||_0x18e8e6[_0x0b48('0x28')]||_0x5aec87[_0x0b48('0x28')],'basename':_0x4c47bc,'savename':util['format']('%s-%s.%s',_0x18e8e6[_0x0b48('0x28')]||_0x5aec87[_0x0b48('0x28')],require(_0x0b48('0x94'))['generate'](0x4),_0x18e8e6[_0x0b48('0x91')]||_0x0b48('0x95')),'reportId':_0x5aec87['id'],'reportType':'custom'});return db[_0x0b48('0x96')][_0x0b48('0x48')](_0x240d27,{'raw':!![]});})[_0x0b48('0x24')](function(_0x1bf7fc){if(_0x5aec87['table']===_0x0b48('0x97')){_0x2e6f31[_0x0b48('0x3a')](_0x5aec87['table']+_0x0b48('0x98'),_0x18e8e6[_0x0b48('0x99')],_0x18e8e6['endDate']);}else{_0x2e6f31[_0x0b48('0x3a')](_0x5aec87['table']+_0x0b48('0x9a'),_0x18e8e6['startDate'],_0x18e8e6['endDate']);}if(_0x1bf7fc){logger['info'](_0x0b48('0x9b'),_0x2e6f31[_0x0b48('0x85')]());require(_0x0b48('0x9c'))[_0x0b48('0x9d')](path[_0x0b48('0x88')](__dirname,'../../components/export/',_0x1bf7fc['output']),[_0x1bf7fc['id'],_0x2e6f31['toString'](),path[_0x0b48('0x88')](__dirname,_0x0b48('0x9e'),_0x1bf7fc[_0x0b48('0x9f')]),_0x4c47bc]);return _0x1bf7fc;}else{var _0x565acf=squel[_0x0b48('0x71')]();_0x565acf[_0x0b48('0x8f')]('('+_0x2e6f31[_0x0b48('0x85')]()+')','countTable');_0x565acf['field']('COUNT(*)','count');_0x2e6f31['limit'](_0x18e8e6[_0x0b48('0x1e')]||_0xc2ddbe);_0x2e6f31[_0x0b48('0x1b')](_0x18e8e6[_0x0b48('0x1b')]||0x0);return dbH[_0x0b48('0x84')][_0x0b48('0x2f')](_0x565acf['toString'](),{'type':dbH[_0x0b48('0x84')]['QueryTypes'][_0x0b48('0x87')]})[_0x0b48('0x24')](function(_0x509150){if(!_0x509150['length']){_0x404f4b=0x0;}else{_0x404f4b=_0x509150[0x0]['count']||0x0;}return dbH[_0x0b48('0x84')][_0x0b48('0x2f')](_0x2e6f31[_0x0b48('0x85')](),{'type':dbH[_0x0b48('0x84')][_0x0b48('0x86')]['SELECT']});})['then'](function(_0x3d1ad2){return{'rows':_0x3d1ad2||[],'count':_0x404f4b};});}});}exports['run']=function(_0x17ca44,_0x760f87){return runReport(_0x17ca44[_0x0b48('0x45')],_0x17ca44['query'],_0x17ca44['options'])[_0x0b48('0x24')](respondWithResult(_0x760f87,null))[_0x0b48('0x43')](handleError(_0x760f87,null));};exports[_0x0b48('0xa0')]=runReport;exports['query']=function(_0xf6973a,_0x202e0a){var _0x3b380a=0xa;var _0x387199=[_0x0b48('0x88'),_0x0b48('0x89'),_0x0b48('0x56'),'cross_join'];var _0x387dd7={'SUM':_0x0b48('0x8a'),'COUNT':_0x0b48('0x8b'),'COUNT DISTINCT':_0x0b48('0x8c'),'MAX':_0x0b48('0x58'),'MIN':'MIN(%s)','AVG':'AVG(%s)','GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0x0b48('0x5c'),'GROUP_CONCAT DESC':_0x0b48('0x5d')};var _0x14b3ce={'SEC_TO_TIME':_0x0b48('0x5e'),'DATE':_0x0b48('0x5f'),'HOUR':'HOUR(%s)','ROUND':_0x0b48('0x60'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x105486=function(_0x4909c7){return!_[_0x0b48('0x62')]([_0x0b48('0x63'),_0x0b48('0x64'),_0x0b48('0x65'),'IS\x20NOT\x20EMPTY'],_0x4909c7);};var _0x554119=function(_0x261eef){if(!_0x261eef||!_0x261eef[_0x0b48('0x67')][_0x0b48('0x35')]){return'';}for(var _0x45d138='(',_0x26b310=0x0;_0x26b310<_0x261eef[_0x0b48('0x67')]['length'];_0x26b310+=0x1){_0x26b310>0x0&&(_0x45d138+='\x20'+_0x261eef[_0x0b48('0x8e')]+'\x20');_0x45d138+=_0x261eef[_0x0b48('0x67')][_0x26b310][_0x0b48('0x68')]?_0x554119(_0x261eef[_0x0b48('0x67')][_0x26b310]['group']):_0x261eef[_0x0b48('0x67')][_0x26b310][_0x0b48('0x79')]+'\x20'+_0x261eef[_0x0b48('0x67')][_0x26b310][_0x0b48('0x69')]+(_0x105486(_0x261eef[_0x0b48('0x67')][_0x26b310][_0x0b48('0x69')])?'\x20'+_0x261eef[_0x0b48('0x67')][_0x26b310][_0x0b48('0x6a')]:'');}return _0x45d138+')';};var _0x294e80={'where':{'id':_0xf6973a[_0x0b48('0x45')]['id']}},_0x4e3f73,_0x5ef0d9,_0x3d465b,_0xe07cb3,_0x109373;_0x294e80=_[_0x0b48('0x3d')]({},_0x294e80,_0xf6973a[_0x0b48('0x40')]);return db[_0x0b48('0x2a')][_0x0b48('0x47')](_0x294e80)['then'](function(_0x27242e){if(_0x27242e){_0x4e3f73=_0x27242e;return _0x27242e[_0x0b48('0x6b')]();}return null;})[_0x0b48('0x24')](function(_0x399d31){if(_0x399d31){if(!_0x399d31[_0x0b48('0x35')]){throw new db[(_0x0b48('0xa1'))]['ValidationErrorItem'](_0x0b48('0x6d'),0x193);}_0x5ef0d9=_0x399d31;return db[_0x0b48('0x6e')][_0x0b48('0x6f')]({'raw':!![]});}return null;})[_0x0b48('0x24')](function(_0x5e3e69){if(_0x5e3e69){_0x3d465b=_['keyBy'](_0x5e3e69,'id');var _0x32849a;var _0x2ef775=squel[_0x0b48('0x71')]();_0x2ef775[_0x0b48('0x8f')](_0x4e3f73['table']);for(var _0x75c401=0x0;_0x75c401<_0x5ef0d9['length'];_0x75c401+=0x1){_0x32849a=_0x5ef0d9[_0x75c401]['MetricId']?_0x3d465b[_0x5ef0d9[_0x75c401]['MetricId']][_0x0b48('0x73')]:_0x5ef0d9[_0x75c401][_0x0b48('0x79')];_0x32849a=_0x5ef0d9[_0x75c401][_0x0b48('0x74')]?_['replace'](_0x387dd7[_0x5ef0d9[_0x75c401][_0x0b48('0x74')]],'%s',_0x32849a):_0x32849a;_0x32849a=_0x5ef0d9[_0x75c401][_0x0b48('0x76')]?_['replace'](_0x14b3ce[_0x5ef0d9[_0x75c401]['format']],'%s',_0x32849a):_0x32849a;if(_0x5ef0d9[_0x75c401][_0x0b48('0xa2')]){_0x2ef775['group'](_0x32849a);}_0x5ef0d9[_0x75c401]['orderBy']&&_0x2ef775['order'](_0x32849a,_0x5ef0d9[_0x75c401][_0x0b48('0x77')]===_0x0b48('0x78')?![]:!![]);_0x2ef775[_0x0b48('0x79')](_0x32849a,_0x5ef0d9[_0x75c401][_0x0b48('0x7a')]||_0x32849a);}if(_0x4e3f73[_0x0b48('0x7c')]){_0x4e3f73[_0x0b48('0x7c')]=JSON[_0x0b48('0x7b')](_0x4e3f73[_0x0b48('0x7c')]);for(var _0x476073=0x0;_0x476073<_0x4e3f73[_0x0b48('0x7c')][_0x0b48('0x35')];_0x476073+=0x1){if(_0x4e3f73[_0x0b48('0x7c')][_0x476073]['type']&&_['includes'](_0x387199,_0x4e3f73[_0x0b48('0x7c')][_0x476073]['type'])&&_0x4e3f73[_0x0b48('0x7c')][_0x476073][_0x0b48('0x7d')]&&_0x4e3f73['joins'][_0x476073]['foreignTable']&&_0x4e3f73['joins'][_0x476073][_0x0b48('0x80')]){_0x2ef775[_0x4e3f73[_0x0b48('0x7c')][_0x476073][_0x0b48('0x3e')]](_0x4e3f73[_0x0b48('0x7c')][_0x476073]['foreignTable'],null,util[_0x0b48('0x76')](_0x0b48('0x90'),_0x4e3f73[_0x0b48('0x7f')],_0x4e3f73['joins'][_0x476073]['parentKey'],_0x4e3f73[_0x0b48('0x7c')][_0x476073][_0x0b48('0x7e')],_0x4e3f73['joins'][_0x476073]['foreignKey']));}}}if(_0x4e3f73['conditions']){_0x4e3f73[_0x0b48('0x81')]=JSON['parse'](_0x4e3f73[_0x0b48('0x81')]);_0x2ef775['where'](_0x554119(_0x4e3f73['conditions'][_0x0b48('0x68')]));}_0x109373=_0x2ef775['clone']();_0x2ef775[_0x0b48('0x1e')](_0x3b380a);_0x2ef775[_0x0b48('0x1b')](0x0);logger[_0x0b48('0x83')](_0x0b48('0xa3'),_0x2ef775['toString']());return dbH[_0x0b48('0x84')][_0x0b48('0x2f')](_0x2ef775['toString'](),{'type':dbH[_0x0b48('0x84')]['QueryTypes'][_0x0b48('0x87')]});}})[_0x0b48('0x24')](function(){return{'sql':_0x109373[_0x0b48('0x85')]()};})[_0x0b48('0x24')](respondWithResult(_0x202e0a,null))[_0x0b48('0x43')](handleError(_0x202e0a,null));}; \ No newline at end of file +var _0xd4a3=['name','send','index','AnalyticCustomReport','rawAttributes','fieldName','type','model','map','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','params','length','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Reports','UserProfileSection','find','userProfileId','autoAssociation','UserProfileResource','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','preview','join','left_join','SUM(%s)','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','field','condition','getFields','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','select','table','MetricId','metric','function','format','replace','groupBy','orderBy','DESC','joins','parse','parentKey','foreignTable','foreignKey','conditions','clone','debug','Limited\x20Query:','toString','sequelize','QueryTypes','SELECT','cross_join','ROUND(%s)','IS\x20NOT\x20NULL','value','Sequelize','from','alias','%s.%s\x20=\x20%s.%s','generate','output','csv','custom','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','child_process','fork','countTable','COUNT(*)','run','runReport','right_join','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','eml-format','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','dbH','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','then','destroy','get','CustomReports','error'];(function(_0x29ebf,_0x5d73f0){var _0x3261f2=function(_0x26b9d5){while(--_0x26b9d5){_0x29ebf['push'](_0x29ebf['shift']());}};_0x3261f2(++_0x5d73f0);}(_0xd4a3,0x7a));var _0x3d4a=function(_0x1cfd2d,_0xc2bfae){_0x1cfd2d=_0x1cfd2d-0x0;var _0x227ed0=_0xd4a3[_0x1cfd2d];return _0x227ed0;};'use strict';var emlformat=require(_0x3d4a('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x3d4a('0x1'));var moment=require(_0x3d4a('0x2'));var BPromise=require(_0x3d4a('0x3'));var Mustache=require(_0x3d4a('0x4'));var util=require('util');var path=require('path');var sox=require(_0x3d4a('0x5'));var csv=require(_0x3d4a('0x6'));var ejs=require(_0x3d4a('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x3d4a('0x8'));var toCsv=require('to-csv');var querystring=require(_0x3d4a('0x9'));var Papa=require(_0x3d4a('0xa'));var Redis=require(_0x3d4a('0xb'));var authService=require(_0x3d4a('0xc'));var qs=require(_0x3d4a('0xd'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3d4a('0xe'));var logger=require(_0x3d4a('0xf'))(_0x3d4a('0x10'));var utils=require(_0x3d4a('0x11'));var config=require(_0x3d4a('0x12'));var licenseUtil=require(_0x3d4a('0x13'));var db=require(_0x3d4a('0x14'))['db'];var dbH=require('../../mysqldb')[_0x3d4a('0x15')];function respondWithStatusCode(_0x428024,_0x46367d){_0x46367d=_0x46367d||0xcc;return function(_0xfa35b9){if(_0xfa35b9){return _0x428024[_0x3d4a('0x16')](_0x46367d);}return _0x428024[_0x3d4a('0x17')](_0x46367d)[_0x3d4a('0x18')]();};}function respondWithResult(_0x3b5658,_0x4fda68){_0x4fda68=_0x4fda68||0xc8;return function(_0x5f2282){if(_0x5f2282){return _0x3b5658['status'](_0x4fda68)[_0x3d4a('0x19')](_0x5f2282);}};}function respondWithFilteredResult(_0x149f55,_0x4cf75d){return function(_0x2e29ed){if(_0x2e29ed){var _0x850685=typeof _0x4cf75d[_0x3d4a('0x1a')]===_0x3d4a('0x1b')&&typeof _0x4cf75d[_0x3d4a('0x1c')]===_0x3d4a('0x1b');var _0x3d8944=_0x2e29ed[_0x3d4a('0x1d')];var _0x1274b0=_0x850685?0x0:_0x4cf75d[_0x3d4a('0x1a')];var _0x3aa044=_0x850685?_0x2e29ed[_0x3d4a('0x1d')]:_0x4cf75d[_0x3d4a('0x1a')]+_0x4cf75d[_0x3d4a('0x1c')];var _0x43bb14;if(_0x3aa044>=_0x3d8944){_0x3aa044=_0x3d8944;_0x43bb14=0xc8;}else{_0x43bb14=0xce;}_0x149f55['status'](_0x43bb14);return _0x149f55['set'](_0x3d4a('0x1e'),_0x1274b0+'-'+_0x3aa044+'/'+_0x3d8944)['json'](_0x2e29ed);}return null;};}function patchUpdates(_0x261690){return function(_0x21aa17){try{jsonpatch[_0x3d4a('0x1f')](_0x21aa17,_0x261690,!![]);}catch(_0x3df475){return BPromise[_0x3d4a('0x20')](_0x3df475);}return _0x21aa17[_0x3d4a('0x21')]();};}function saveUpdates(_0x1d4e79,_0x5b1741){return function(_0x19d663){if(_0x19d663){return _0x19d663['update'](_0x1d4e79)[_0x3d4a('0x22')](function(_0x1a10c9){return _0x1a10c9;});}return null;};}function removeEntity(_0x1bd0f6,_0x36038e){return function(_0x544fcc){if(_0x544fcc){return _0x544fcc[_0x3d4a('0x23')]()[_0x3d4a('0x22')](function(){var _0x83880=_0x544fcc[_0x3d4a('0x24')]({'plain':!![]});var _0xfd631f=_0x3d4a('0x25');return db['UserProfileResource'][_0x3d4a('0x23')]({'where':{'type':_0xfd631f,'resourceId':_0x83880['id']}})[_0x3d4a('0x22')](function(){return _0x544fcc;});})['then'](function(){_0x1bd0f6[_0x3d4a('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3de273,_0x323e19){return function(_0x46a717){if(!_0x46a717){_0x3de273[_0x3d4a('0x16')](0x194);}return _0x46a717;};}function handleError(_0x1a6570,_0x441d58){_0x441d58=_0x441d58||0x1f4;return function(_0x5eaa4c){logger[_0x3d4a('0x26')](_0x5eaa4c['stack']);if(_0x5eaa4c['name']){delete _0x5eaa4c[_0x3d4a('0x27')];}_0x1a6570[_0x3d4a('0x17')](_0x441d58)[_0x3d4a('0x28')](_0x5eaa4c);};}exports[_0x3d4a('0x29')]=function(_0x496fc5,_0x2a947c){var _0x9047ef={},_0x487a9d={},_0x51111a={'count':0x0,'rows':[]};var _0x3e0661=_['map'](db[_0x3d4a('0x2a')][_0x3d4a('0x2b')],function(_0x755c7b){return{'name':_0x755c7b[_0x3d4a('0x2c')],'type':_0x755c7b[_0x3d4a('0x2d')]['key']};});_0x487a9d[_0x3d4a('0x2e')]=_[_0x3d4a('0x2f')](_0x3e0661,'name');_0x487a9d[_0x3d4a('0x30')]=_[_0x3d4a('0x31')](_0x496fc5[_0x3d4a('0x30')]);_0x487a9d[_0x3d4a('0x32')]=_[_0x3d4a('0x33')](_0x487a9d[_0x3d4a('0x2e')],_0x487a9d[_0x3d4a('0x30')]);_0x9047ef[_0x3d4a('0x34')]=_[_0x3d4a('0x33')](_0x487a9d[_0x3d4a('0x2e')],qs[_0x3d4a('0x35')](_0x496fc5[_0x3d4a('0x30')][_0x3d4a('0x35')]));_0x9047ef[_0x3d4a('0x34')]=_0x9047ef[_0x3d4a('0x34')]['length']?_0x9047ef[_0x3d4a('0x34')]:_0x487a9d[_0x3d4a('0x2e')];if(!_0x496fc5[_0x3d4a('0x30')][_0x3d4a('0x36')](_0x3d4a('0x37'))){_0x9047ef[_0x3d4a('0x1c')]=qs[_0x3d4a('0x1c')](_0x496fc5[_0x3d4a('0x30')]['limit']);_0x9047ef[_0x3d4a('0x1a')]=qs[_0x3d4a('0x1a')](_0x496fc5[_0x3d4a('0x30')]['offset']);}_0x9047ef[_0x3d4a('0x38')]=qs[_0x3d4a('0x39')](_0x496fc5[_0x3d4a('0x30')][_0x3d4a('0x39')]);_0x9047ef[_0x3d4a('0x3a')]=qs[_0x3d4a('0x32')](_[_0x3d4a('0x3b')](_0x496fc5['query'],_0x487a9d[_0x3d4a('0x32')]),_0x3e0661);if(_0x496fc5[_0x3d4a('0x30')][_0x3d4a('0x3c')]){_0x9047ef[_0x3d4a('0x3a')]=_[_0x3d4a('0x3d')](_0x9047ef[_0x3d4a('0x3a')],{'$or':_[_0x3d4a('0x2f')](_0x3e0661,function(_0x4d17fb){if(_0x4d17fb[_0x3d4a('0x2d')]!==_0x3d4a('0x3e')){var _0x3b9a6a={};_0x3b9a6a[_0x4d17fb[_0x3d4a('0x27')]]={'$like':'%'+_0x496fc5['query'][_0x3d4a('0x3c')]+'%'};return _0x3b9a6a;}})});}_0x9047ef=_[_0x3d4a('0x3d')]({},_0x9047ef,_0x496fc5[_0x3d4a('0x3f')]);var _0x481225={'where':_0x9047ef[_0x3d4a('0x3a')]};return db[_0x3d4a('0x2a')][_0x3d4a('0x1d')](_0x481225)[_0x3d4a('0x22')](function(_0x3103fa){_0x51111a['count']=_0x3103fa;if(_0x496fc5[_0x3d4a('0x30')][_0x3d4a('0x40')]){_0x9047ef[_0x3d4a('0x41')]=[{'all':!![]}];}return db[_0x3d4a('0x2a')][_0x3d4a('0x42')](_0x9047ef);})[_0x3d4a('0x22')](function(_0x355aaf){_0x51111a[_0x3d4a('0x43')]=_0x355aaf;return _0x51111a;})[_0x3d4a('0x22')](respondWithFilteredResult(_0x2a947c,_0x9047ef))['catch'](handleError(_0x2a947c,null));};exports['show']=function(_0x27abc2,_0x48c257){var _0x4b5ce1={'raw':![],'where':{'id':_0x27abc2[_0x3d4a('0x44')]['id']}},_0x529a65={};_0x529a65[_0x3d4a('0x2e')]=_[_0x3d4a('0x31')](db['AnalyticCustomReport'][_0x3d4a('0x2b')]);_0x529a65[_0x3d4a('0x30')]=_[_0x3d4a('0x31')](_0x27abc2['query']);_0x529a65[_0x3d4a('0x32')]=_[_0x3d4a('0x33')](_0x529a65['model'],_0x529a65[_0x3d4a('0x30')]);_0x4b5ce1[_0x3d4a('0x34')]=_[_0x3d4a('0x33')](_0x529a65[_0x3d4a('0x2e')],qs[_0x3d4a('0x35')](_0x27abc2['query'][_0x3d4a('0x35')]));_0x4b5ce1[_0x3d4a('0x34')]=_0x4b5ce1[_0x3d4a('0x34')][_0x3d4a('0x45')]?_0x4b5ce1['attributes']:_0x529a65[_0x3d4a('0x2e')];if(_0x27abc2['query'][_0x3d4a('0x40')]){_0x4b5ce1['include']=[{'all':!![]}];}_0x4b5ce1=_[_0x3d4a('0x3d')]({},_0x4b5ce1,_0x27abc2[_0x3d4a('0x3f')]);return db[_0x3d4a('0x2a')]['find'](_0x4b5ce1)[_0x3d4a('0x22')](handleEntityNotFound(_0x48c257,null))[_0x3d4a('0x22')](respondWithResult(_0x48c257,null))['catch'](handleError(_0x48c257,null));};exports[_0x3d4a('0x46')]=function(_0x364651,_0xaab3b3){return db[_0x3d4a('0x2a')][_0x3d4a('0x46')](_0x364651['body'],{})[_0x3d4a('0x22')](function(_0x4de6a0){var _0x1f3b91=_0x364651[_0x3d4a('0x47')]['get']({'plain':!![]});if(!_0x1f3b91)throw new Error(_0x3d4a('0x48'));if(_0x1f3b91[_0x3d4a('0x49')]===_0x3d4a('0x47')){var _0x1d8a01=_0x4de6a0[_0x3d4a('0x24')]({'plain':!![]});var _0x1c301f=_0x3d4a('0x4a');return db[_0x3d4a('0x4b')][_0x3d4a('0x4c')]({'where':{'name':_0x1c301f,'userProfileId':_0x1f3b91[_0x3d4a('0x4d')]},'raw':!![]})[_0x3d4a('0x22')](function(_0x4a56c9){if(_0x4a56c9&&_0x4a56c9[_0x3d4a('0x4e')]===0x0){return db[_0x3d4a('0x4f')][_0x3d4a('0x46')]({'name':_0x1d8a01['name'],'resourceId':_0x1d8a01['id'],'type':_0x3d4a('0x25'),'sectionId':_0x4a56c9['id']},{})[_0x3d4a('0x22')](function(){return _0x4de6a0;});}else{return _0x4de6a0;}})[_0x3d4a('0x50')](function(_0x1bec5d){logger['error'](_0x3d4a('0x51'),_0x1bec5d);throw _0x1bec5d;});}return _0x4de6a0;})[_0x3d4a('0x22')](respondWithResult(_0xaab3b3,0xc9))[_0x3d4a('0x50')](handleError(_0xaab3b3,null));};exports[_0x3d4a('0x52')]=function(_0x1d7d4d,_0x3e4c05){if(_0x1d7d4d['body']['id']){delete _0x1d7d4d['body']['id'];}return db[_0x3d4a('0x2a')][_0x3d4a('0x4c')]({'where':{'id':_0x1d7d4d[_0x3d4a('0x44')]['id']}})[_0x3d4a('0x22')](handleEntityNotFound(_0x3e4c05,null))[_0x3d4a('0x22')](saveUpdates(_0x1d7d4d['body'],null))[_0x3d4a('0x22')](respondWithResult(_0x3e4c05,null))[_0x3d4a('0x50')](handleError(_0x3e4c05,null));};exports[_0x3d4a('0x23')]=function(_0x19a237,_0x56009f){return db[_0x3d4a('0x2a')][_0x3d4a('0x4c')]({'where':{'id':_0x19a237[_0x3d4a('0x44')]['id']}})[_0x3d4a('0x22')](handleEntityNotFound(_0x56009f,null))['then'](removeEntity(_0x56009f,null))[_0x3d4a('0x50')](handleError(_0x56009f,null));};exports[_0x3d4a('0x53')]=function(_0x21b55d,_0x13e592){var _0x2bcf50=0xa;var _0x188e28=[_0x3d4a('0x54'),_0x3d4a('0x55'),'right_join','cross_join'];var _0x3e33a9={'SUM':_0x3d4a('0x56'),'COUNT':_0x3d4a('0x57'),'COUNT DISTINCT':_0x3d4a('0x58'),'MAX':_0x3d4a('0x59'),'MIN':_0x3d4a('0x5a'),'AVG':_0x3d4a('0x5b'),'GROUP_CONCAT':_0x3d4a('0x5c'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x3d4a('0x5d')};var _0x3547a9={'SEC_TO_TIME':_0x3d4a('0x5e'),'DATE':_0x3d4a('0x5f'),'HOUR':_0x3d4a('0x60'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0x3d4a('0x61')};var _0x1b5b7d=function(_0xc7d9ca){return!_[_0x3d4a('0x62')]([_0x3d4a('0x63'),'IS\x20NOT\x20NULL',_0x3d4a('0x64'),_0x3d4a('0x65')],_0xc7d9ca);};var _0x22fe52=function(_0x2bb5ec){if(!_0x2bb5ec||!_0x2bb5ec[_0x3d4a('0x66')][_0x3d4a('0x45')]){return'';}for(var _0x2d1d46='(',_0xed2a93=0x0;_0xed2a93<_0x2bb5ec[_0x3d4a('0x66')]['length'];_0xed2a93+=0x1){_0xed2a93>0x0&&(_0x2d1d46+='\x20'+_0x2bb5ec[_0x3d4a('0x67')]+'\x20');_0x2d1d46+=_0x2bb5ec['rules'][_0xed2a93][_0x3d4a('0x68')]?_0x22fe52(_0x2bb5ec['rules'][_0xed2a93][_0x3d4a('0x68')]):_0x2bb5ec['rules'][_0xed2a93][_0x3d4a('0x69')]+'\x20'+_0x2bb5ec[_0x3d4a('0x66')][_0xed2a93][_0x3d4a('0x6a')]+(_0x1b5b7d(_0x2bb5ec[_0x3d4a('0x66')][_0xed2a93][_0x3d4a('0x6a')])?'\x20'+_0x2bb5ec[_0x3d4a('0x66')][_0xed2a93]['value']:'');}return _0x2d1d46+')';};var _0x40cf1e={'where':{'id':_0x21b55d[_0x3d4a('0x44')]['id']}},_0x3c1b87,_0x154feb,_0x2a0744,_0x141ee0,_0x398a47;_0x40cf1e=_['merge']({},_0x40cf1e,_0x21b55d[_0x3d4a('0x3f')]);return db[_0x3d4a('0x2a')][_0x3d4a('0x4c')](_0x40cf1e)[_0x3d4a('0x22')](function(_0x951038){if(_0x951038){_0x3c1b87=_0x951038;return _0x951038[_0x3d4a('0x6b')]();}return null;})[_0x3d4a('0x22')](function(_0xa5bdb1){if(_0xa5bdb1){if(!_0xa5bdb1['length']){throw new db['Sequelize'][(_0x3d4a('0x6c'))](_0x3d4a('0x6d'),0x193);}_0x154feb=_0xa5bdb1;return db[_0x3d4a('0x6e')][_0x3d4a('0x42')]({'raw':!![]});}return null;})['then'](function(_0x58e1c8){if(_0x58e1c8){_0x2a0744=_[_0x3d4a('0x6f')](_0x58e1c8,'id');var _0x50cb32;var _0x26ddca=squel[_0x3d4a('0x70')]();_0x26ddca['from'](_0x3c1b87[_0x3d4a('0x71')]);for(var _0x2e65cc=0x0;_0x2e65cc<_0x154feb['length'];_0x2e65cc+=0x1){_0x50cb32=_0x154feb[_0x2e65cc][_0x3d4a('0x72')]?_0x2a0744[_0x154feb[_0x2e65cc][_0x3d4a('0x72')]][_0x3d4a('0x73')]:_0x154feb[_0x2e65cc][_0x3d4a('0x69')];_0x50cb32=_0x154feb[_0x2e65cc][_0x3d4a('0x74')]?_['replace'](_0x3e33a9[_0x154feb[_0x2e65cc]['function']],'%s',_0x50cb32):_0x50cb32;_0x50cb32=_0x154feb[_0x2e65cc][_0x3d4a('0x75')]?_[_0x3d4a('0x76')](_0x3547a9[_0x154feb[_0x2e65cc][_0x3d4a('0x75')]],'%s',_0x50cb32):_0x50cb32;if(_0x154feb[_0x2e65cc][_0x3d4a('0x77')]){_0x26ddca[_0x3d4a('0x68')](_0x50cb32);}_0x154feb[_0x2e65cc][_0x3d4a('0x78')]&&_0x26ddca[_0x3d4a('0x38')](_0x50cb32,_0x154feb[_0x2e65cc]['orderBy']===_0x3d4a('0x79')?![]:!![]);_0x26ddca[_0x3d4a('0x69')](_0x50cb32,_0x154feb[_0x2e65cc]['alias']||_0x50cb32);}if(_0x3c1b87[_0x3d4a('0x7a')]){_0x3c1b87['joins']=JSON[_0x3d4a('0x7b')](_0x3c1b87[_0x3d4a('0x7a')]);for(var _0x640afb=0x0;_0x640afb<_0x3c1b87[_0x3d4a('0x7a')][_0x3d4a('0x45')];_0x640afb+=0x1){if(_0x3c1b87[_0x3d4a('0x7a')][_0x640afb][_0x3d4a('0x2d')]&&_[_0x3d4a('0x62')](_0x188e28,_0x3c1b87[_0x3d4a('0x7a')][_0x640afb][_0x3d4a('0x2d')])&&_0x3c1b87[_0x3d4a('0x7a')][_0x640afb][_0x3d4a('0x7c')]&&_0x3c1b87['joins'][_0x640afb][_0x3d4a('0x7d')]&&_0x3c1b87[_0x3d4a('0x7a')][_0x640afb][_0x3d4a('0x7e')]){_0x26ddca[_0x3c1b87[_0x3d4a('0x7a')][_0x640afb][_0x3d4a('0x2d')]](_0x3c1b87['joins'][_0x640afb][_0x3d4a('0x7d')],null,util[_0x3d4a('0x75')]('%s.%s\x20=\x20%s.%s',_0x3c1b87[_0x3d4a('0x71')],_0x3c1b87['joins'][_0x640afb][_0x3d4a('0x7c')],_0x3c1b87[_0x3d4a('0x7a')][_0x640afb][_0x3d4a('0x7d')],_0x3c1b87[_0x3d4a('0x7a')][_0x640afb][_0x3d4a('0x7e')]));}}}if(_0x3c1b87['conditions']){_0x3c1b87[_0x3d4a('0x7f')]=JSON['parse'](_0x3c1b87[_0x3d4a('0x7f')]);_0x26ddca[_0x3d4a('0x3a')](_0x22fe52(_0x3c1b87[_0x3d4a('0x7f')][_0x3d4a('0x68')]));}_0x398a47=_0x26ddca[_0x3d4a('0x80')]();_0x26ddca['limit'](_0x2bcf50);_0x26ddca[_0x3d4a('0x1a')](0x0);logger[_0x3d4a('0x81')](_0x3d4a('0x82'),_0x26ddca[_0x3d4a('0x83')]());return dbH[_0x3d4a('0x84')][_0x3d4a('0x30')](_0x26ddca['toString'](),{'type':dbH[_0x3d4a('0x84')][_0x3d4a('0x85')][_0x3d4a('0x86')]});}})['then'](respondWithResult(_0x13e592,null))[_0x3d4a('0x50')](handleError(_0x13e592,null));};function runReport(_0x5a78b8,_0xfc1912,_0x5efeb1){var _0x270d0a=_0xfc1912['name'];var _0x3002ff=0xa;var _0x102bb2=[_0x3d4a('0x54'),_0x3d4a('0x55'),'right_join',_0x3d4a('0x87')];var _0x3d7553={'SUM':_0x3d4a('0x56'),'COUNT':_0x3d4a('0x57'),'COUNT DISTINCT':_0x3d4a('0x58'),'MAX':_0x3d4a('0x59'),'MIN':_0x3d4a('0x5a'),'AVG':_0x3d4a('0x5b'),'GROUP_CONCAT':_0x3d4a('0x5c'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x18217f={'SEC_TO_TIME':_0x3d4a('0x5e'),'DATE':_0x3d4a('0x5f'),'HOUR':_0x3d4a('0x60'),'ROUND':_0x3d4a('0x88'),'UNIX_TIMESTAMP':_0x3d4a('0x61')};var _0xec11ce=function(_0x27010a){return!_[_0x3d4a('0x62')](['IS\x20NULL',_0x3d4a('0x89'),_0x3d4a('0x64'),_0x3d4a('0x65')],_0x27010a);};var _0x4ad5db=function(_0x10335d){if(!_0x10335d||!_0x10335d[_0x3d4a('0x66')][_0x3d4a('0x45')]){return'';}for(var _0x3160e1='(',_0x505c88=0x0;_0x505c88<_0x10335d[_0x3d4a('0x66')][_0x3d4a('0x45')];_0x505c88+=0x1){_0x505c88>0x0&&(_0x3160e1+='\x20'+_0x10335d[_0x3d4a('0x67')]+'\x20');_0x3160e1+=_0x10335d[_0x3d4a('0x66')][_0x505c88][_0x3d4a('0x68')]?_0x4ad5db(_0x10335d['rules'][_0x505c88]['group']):_0x10335d['rules'][_0x505c88][_0x3d4a('0x69')]+'\x20'+_0x10335d[_0x3d4a('0x66')][_0x505c88][_0x3d4a('0x6a')]+(_0xec11ce(_0x10335d[_0x3d4a('0x66')][_0x505c88][_0x3d4a('0x6a')])?'\x20'+_0x10335d['rules'][_0x505c88][_0x3d4a('0x8a')]:'');}return _0x3160e1+')';};var _0x499708={'where':{'id':_0x5a78b8['id']}},_0x16d3e5,_0x3caa95,_0x9f73b6,_0x332a1d,_0x242c7c;_0x499708=_[_0x3d4a('0x3d')]({},_0x499708,_0x5efeb1);return db['AnalyticCustomReport'][_0x3d4a('0x4c')](_0x499708)[_0x3d4a('0x22')](function(_0x3f7d86){if(_0x3f7d86){_0x16d3e5=_0x3f7d86;return _0x3f7d86[_0x3d4a('0x6b')]();}return null;})[_0x3d4a('0x22')](function(_0x5cc8f2){if(_0x5cc8f2){if(!_0x5cc8f2[_0x3d4a('0x45')]){throw new db[(_0x3d4a('0x8b'))][(_0x3d4a('0x6c'))](_0x3d4a('0x6d'),0x193);}_0x3caa95=_0x5cc8f2;return db[_0x3d4a('0x6e')][_0x3d4a('0x42')]({'raw':!![]});}return null;})[_0x3d4a('0x22')](function(_0x39e42a){if(_0x39e42a){_0x9f73b6=_[_0x3d4a('0x6f')](_0x39e42a,'id');var _0x11d38c;var _0x30cb71=squel[_0x3d4a('0x70')]();_0x30cb71[_0x3d4a('0x8c')](_0x16d3e5['table']);for(var _0x2f10b0=0x0;_0x2f10b0<_0x3caa95[_0x3d4a('0x45')];_0x2f10b0+=0x1){_0x11d38c=_0x3caa95[_0x2f10b0][_0x3d4a('0x72')]?_0x9f73b6[_0x3caa95[_0x2f10b0][_0x3d4a('0x72')]]['metric']:_0x3caa95[_0x2f10b0]['field'];_0x11d38c=_0x3caa95[_0x2f10b0][_0x3d4a('0x74')]?_['replace'](_0x3d7553[_0x3caa95[_0x2f10b0][_0x3d4a('0x74')]],'%s',_0x11d38c):_0x11d38c;_0x11d38c=_0x3caa95[_0x2f10b0]['format']?_[_0x3d4a('0x76')](_0x18217f[_0x3caa95[_0x2f10b0][_0x3d4a('0x75')]],'%s',_0x11d38c):_0x11d38c;if(_0x3caa95[_0x2f10b0]['groupBy']){_0x30cb71[_0x3d4a('0x68')](_0x11d38c);}_0x3caa95[_0x2f10b0][_0x3d4a('0x78')]&&_0x30cb71[_0x3d4a('0x38')](_0x11d38c,_0x3caa95[_0x2f10b0][_0x3d4a('0x78')]===_0x3d4a('0x79')?![]:!![]);_0x30cb71['field'](_0x11d38c,_0x3caa95[_0x2f10b0][_0x3d4a('0x8d')]||_0x11d38c);}if(_0x16d3e5[_0x3d4a('0x7a')]){_0x16d3e5[_0x3d4a('0x7a')]=JSON[_0x3d4a('0x7b')](_0x16d3e5[_0x3d4a('0x7a')]);for(var _0x59ca45=0x0;_0x59ca45<_0x16d3e5[_0x3d4a('0x7a')][_0x3d4a('0x45')];_0x59ca45+=0x1){if(_0x16d3e5[_0x3d4a('0x7a')][_0x59ca45][_0x3d4a('0x2d')]&&_[_0x3d4a('0x62')](_0x102bb2,_0x16d3e5['joins'][_0x59ca45][_0x3d4a('0x2d')])&&_0x16d3e5['joins'][_0x59ca45][_0x3d4a('0x7c')]&&_0x16d3e5['joins'][_0x59ca45][_0x3d4a('0x7d')]&&_0x16d3e5[_0x3d4a('0x7a')][_0x59ca45][_0x3d4a('0x7e')]){_0x30cb71[_0x16d3e5[_0x3d4a('0x7a')][_0x59ca45]['type']](_0x16d3e5['joins'][_0x59ca45][_0x3d4a('0x7d')],null,util['format'](_0x3d4a('0x8e'),_0x16d3e5[_0x3d4a('0x71')],_0x16d3e5['joins'][_0x59ca45][_0x3d4a('0x7c')],_0x16d3e5['joins'][_0x59ca45]['foreignTable'],_0x16d3e5[_0x3d4a('0x7a')][_0x59ca45][_0x3d4a('0x7e')]));}}}if(_0x16d3e5[_0x3d4a('0x7f')]){_0x16d3e5[_0x3d4a('0x7f')]=JSON[_0x3d4a('0x7b')](_0x16d3e5[_0x3d4a('0x7f')]);_0x30cb71[_0x3d4a('0x3a')](_0x4ad5db(_0x16d3e5[_0x3d4a('0x7f')][_0x3d4a('0x68')]));}_0x242c7c=_0x30cb71['clone']();_0x30cb71[_0x3d4a('0x1c')](_0x3002ff);_0x30cb71[_0x3d4a('0x1a')](0x0);return;}})[_0x3d4a('0x22')](function(){if(_0xfc1912['output']==='web'){return null;}var _0x2fb169=_['merge'](_0xfc1912,{'name':_0xfc1912['fullPath']||_0xfc1912[_0x3d4a('0x27')]||_0x16d3e5['name'],'basename':_0x270d0a,'savename':util[_0x3d4a('0x75')]('%s-%s.%s',_0xfc1912['name']||_0x16d3e5['name'],require('randomstring')[_0x3d4a('0x8f')](0x4),_0xfc1912[_0x3d4a('0x90')]||_0x3d4a('0x91')),'reportId':_0x16d3e5['id'],'reportType':_0x3d4a('0x92')});return db[_0x3d4a('0x93')][_0x3d4a('0x46')](_0x2fb169,{'raw':!![]});})[_0x3d4a('0x22')](function(_0x2420bb){if(_0x16d3e5[_0x3d4a('0x71')]===_0x3d4a('0x94')){_0x242c7c[_0x3d4a('0x3a')](_0x16d3e5['table']+_0x3d4a('0x95'),_0xfc1912[_0x3d4a('0x96')],_0xfc1912['endDate']);}else{_0x242c7c[_0x3d4a('0x3a')](_0x16d3e5[_0x3d4a('0x71')]+_0x3d4a('0x97'),_0xfc1912[_0x3d4a('0x96')],_0xfc1912['endDate']);}if(_0x2420bb){logger[_0x3d4a('0x98')]('Run\x20Query:',_0x242c7c[_0x3d4a('0x83')]());require(_0x3d4a('0x99'))[_0x3d4a('0x9a')](path[_0x3d4a('0x54')](__dirname,'../../components/export/',_0x2420bb[_0x3d4a('0x90')]),[_0x2420bb['id'],_0x242c7c[_0x3d4a('0x83')](),path[_0x3d4a('0x54')](__dirname,'../../files/reports',_0x2420bb['savename']),_0x270d0a]);return _0x2420bb;}else{var _0x317125=squel[_0x3d4a('0x70')]();_0x317125[_0x3d4a('0x8c')]('('+_0x242c7c['toString']()+')',_0x3d4a('0x9b'));_0x317125[_0x3d4a('0x69')](_0x3d4a('0x9c'),_0x3d4a('0x1d'));_0x242c7c[_0x3d4a('0x1c')](_0xfc1912[_0x3d4a('0x1c')]||_0x3002ff);_0x242c7c[_0x3d4a('0x1a')](_0xfc1912['offset']||0x0);return dbH[_0x3d4a('0x84')][_0x3d4a('0x30')](_0x317125[_0x3d4a('0x83')](),{'type':dbH[_0x3d4a('0x84')][_0x3d4a('0x85')][_0x3d4a('0x86')]})[_0x3d4a('0x22')](function(_0x5a0719){if(!_0x5a0719[_0x3d4a('0x45')]){_0x332a1d=0x0;}else{_0x332a1d=_0x5a0719[0x0][_0x3d4a('0x1d')]||0x0;}return dbH[_0x3d4a('0x84')][_0x3d4a('0x30')](_0x242c7c[_0x3d4a('0x83')](),{'type':dbH[_0x3d4a('0x84')][_0x3d4a('0x85')]['SELECT']});})[_0x3d4a('0x22')](function(_0x21fb14){return{'rows':_0x21fb14||[],'count':_0x332a1d};});}});}exports[_0x3d4a('0x9d')]=function(_0x3696b5,_0x1a52d2){return runReport(_0x3696b5[_0x3d4a('0x44')],_0x3696b5[_0x3d4a('0x30')],_0x3696b5[_0x3d4a('0x3f')])['then'](respondWithResult(_0x1a52d2,null))[_0x3d4a('0x50')](handleError(_0x1a52d2,null));};exports[_0x3d4a('0x9e')]=runReport;exports[_0x3d4a('0x30')]=function(_0x5efdc5,_0x1e5240){var _0x2a6c7e=0xa;var _0x508f2e=['join',_0x3d4a('0x55'),_0x3d4a('0x9f'),_0x3d4a('0x87')];var _0x3583ae={'SUM':'SUM(%s)','COUNT':_0x3d4a('0x57'),'COUNT DISTINCT':_0x3d4a('0x58'),'MAX':_0x3d4a('0x59'),'MIN':_0x3d4a('0x5a'),'AVG':'AVG(%s)','GROUP_CONCAT':_0x3d4a('0x5c'),'GROUP_CONCAT ASC':_0x3d4a('0xa0'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x5b1118={'SEC_TO_TIME':_0x3d4a('0x5e'),'DATE':_0x3d4a('0x5f'),'HOUR':'HOUR(%s)','ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0x3d4a('0x61')};var _0x1c0697=function(_0x5e11a6){return!_[_0x3d4a('0x62')]([_0x3d4a('0x63'),_0x3d4a('0x89'),_0x3d4a('0x64'),_0x3d4a('0x65')],_0x5e11a6);};var _0x31540a=function(_0x3a2988){if(!_0x3a2988||!_0x3a2988[_0x3d4a('0x66')]['length']){return'';}for(var _0x10a8d0='(',_0x2d94f5=0x0;_0x2d94f5<_0x3a2988[_0x3d4a('0x66')][_0x3d4a('0x45')];_0x2d94f5+=0x1){_0x2d94f5>0x0&&(_0x10a8d0+='\x20'+_0x3a2988[_0x3d4a('0x67')]+'\x20');_0x10a8d0+=_0x3a2988[_0x3d4a('0x66')][_0x2d94f5][_0x3d4a('0x68')]?_0x31540a(_0x3a2988[_0x3d4a('0x66')][_0x2d94f5][_0x3d4a('0x68')]):_0x3a2988['rules'][_0x2d94f5]['field']+'\x20'+_0x3a2988[_0x3d4a('0x66')][_0x2d94f5][_0x3d4a('0x6a')]+(_0x1c0697(_0x3a2988['rules'][_0x2d94f5][_0x3d4a('0x6a')])?'\x20'+_0x3a2988[_0x3d4a('0x66')][_0x2d94f5]['value']:'');}return _0x10a8d0+')';};var _0x176618={'where':{'id':_0x5efdc5[_0x3d4a('0x44')]['id']}},_0x182208,_0x1a0f7e,_0x306d45,_0x5ee4f5,_0x54ff53;_0x176618=_[_0x3d4a('0x3d')]({},_0x176618,_0x5efdc5[_0x3d4a('0x3f')]);return db['AnalyticCustomReport']['find'](_0x176618)[_0x3d4a('0x22')](function(_0x41efbb){if(_0x41efbb){_0x182208=_0x41efbb;return _0x41efbb[_0x3d4a('0x6b')]();}return null;})[_0x3d4a('0x22')](function(_0x163f91){if(_0x163f91){if(!_0x163f91[_0x3d4a('0x45')]){throw new db[(_0x3d4a('0x8b'))][(_0x3d4a('0x6c'))](_0x3d4a('0x6d'),0x193);}_0x1a0f7e=_0x163f91;return db[_0x3d4a('0x6e')][_0x3d4a('0x42')]({'raw':!![]});}return null;})[_0x3d4a('0x22')](function(_0x2eb139){if(_0x2eb139){_0x306d45=_[_0x3d4a('0x6f')](_0x2eb139,'id');var _0x3d3478;var _0xf58c86=squel[_0x3d4a('0x70')]();_0xf58c86[_0x3d4a('0x8c')](_0x182208[_0x3d4a('0x71')]);for(var _0x454c3f=0x0;_0x454c3f<_0x1a0f7e['length'];_0x454c3f+=0x1){_0x3d3478=_0x1a0f7e[_0x454c3f][_0x3d4a('0x72')]?_0x306d45[_0x1a0f7e[_0x454c3f][_0x3d4a('0x72')]][_0x3d4a('0x73')]:_0x1a0f7e[_0x454c3f][_0x3d4a('0x69')];_0x3d3478=_0x1a0f7e[_0x454c3f][_0x3d4a('0x74')]?_[_0x3d4a('0x76')](_0x3583ae[_0x1a0f7e[_0x454c3f][_0x3d4a('0x74')]],'%s',_0x3d3478):_0x3d3478;_0x3d3478=_0x1a0f7e[_0x454c3f][_0x3d4a('0x75')]?_[_0x3d4a('0x76')](_0x5b1118[_0x1a0f7e[_0x454c3f][_0x3d4a('0x75')]],'%s',_0x3d3478):_0x3d3478;if(_0x1a0f7e[_0x454c3f]['groupBy']){_0xf58c86[_0x3d4a('0x68')](_0x3d3478);}_0x1a0f7e[_0x454c3f][_0x3d4a('0x78')]&&_0xf58c86[_0x3d4a('0x38')](_0x3d3478,_0x1a0f7e[_0x454c3f][_0x3d4a('0x78')]===_0x3d4a('0x79')?![]:!![]);_0xf58c86[_0x3d4a('0x69')](_0x3d3478,_0x1a0f7e[_0x454c3f][_0x3d4a('0x8d')]||_0x3d3478);}if(_0x182208[_0x3d4a('0x7a')]){_0x182208['joins']=JSON[_0x3d4a('0x7b')](_0x182208[_0x3d4a('0x7a')]);for(var _0x3e049c=0x0;_0x3e049c<_0x182208[_0x3d4a('0x7a')][_0x3d4a('0x45')];_0x3e049c+=0x1){if(_0x182208['joins'][_0x3e049c][_0x3d4a('0x2d')]&&_[_0x3d4a('0x62')](_0x508f2e,_0x182208[_0x3d4a('0x7a')][_0x3e049c][_0x3d4a('0x2d')])&&_0x182208[_0x3d4a('0x7a')][_0x3e049c][_0x3d4a('0x7c')]&&_0x182208['joins'][_0x3e049c][_0x3d4a('0x7d')]&&_0x182208[_0x3d4a('0x7a')][_0x3e049c][_0x3d4a('0x7e')]){_0xf58c86[_0x182208['joins'][_0x3e049c]['type']](_0x182208[_0x3d4a('0x7a')][_0x3e049c]['foreignTable'],null,util[_0x3d4a('0x75')](_0x3d4a('0x8e'),_0x182208['table'],_0x182208[_0x3d4a('0x7a')][_0x3e049c][_0x3d4a('0x7c')],_0x182208[_0x3d4a('0x7a')][_0x3e049c]['foreignTable'],_0x182208[_0x3d4a('0x7a')][_0x3e049c][_0x3d4a('0x7e')]));}}}if(_0x182208[_0x3d4a('0x7f')]){_0x182208[_0x3d4a('0x7f')]=JSON[_0x3d4a('0x7b')](_0x182208[_0x3d4a('0x7f')]);_0xf58c86['where'](_0x31540a(_0x182208['conditions'][_0x3d4a('0x68')]));}_0x54ff53=_0xf58c86[_0x3d4a('0x80')]();_0xf58c86['limit'](_0x2a6c7e);_0xf58c86[_0x3d4a('0x1a')](0x0);logger[_0x3d4a('0x81')](_0x3d4a('0x82'),_0xf58c86['toString']());return dbH[_0x3d4a('0x84')][_0x3d4a('0x30')](_0xf58c86['toString'](),{'type':dbH['sequelize']['QueryTypes'][_0x3d4a('0x86')]});}})['then'](function(){return{'sql':_0x54ff53[_0x3d4a('0x83')]()};})[_0x3d4a('0x22')](respondWithResult(_0x1e5240,null))[_0x3d4a('0x50')](handleError(_0x1e5240,null));}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.model.js b/server/api/analyticCustomReport/analyticCustomReport.model.js index 5b0feb9..04ec93f 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 _0x1e4c=['bluebird','request-promise','path','rimraf','../../config/environment','define','AnalyticCustomReport','lodash','util','../../config/logger','api'];(function(_0x59d42d,_0x44eddc){var _0x53ef8b=function(_0x21dee2){while(--_0x21dee2){_0x59d42d['push'](_0x59d42d['shift']());}};_0x53ef8b(++_0x44eddc);}(_0x1e4c,0xb7));var _0xc1e4=function(_0x1d611c,_0x5bf400){_0x1d611c=_0x1d611c-0x0;var _0x25da4f=_0x1e4c[_0x1d611c];return _0x25da4f;};'use strict';var _=require(_0xc1e4('0x0'));var util=require(_0xc1e4('0x1'));var logger=require(_0xc1e4('0x2'))(_0xc1e4('0x3'));var moment=require('moment');var BPromise=require(_0xc1e4('0x4'));var rp=require(_0xc1e4('0x5'));var fs=require('fs');var path=require(_0xc1e4('0x6'));var rimraf=require(_0xc1e4('0x7'));var config=require(_0xc1e4('0x8'));var attributes=require('./analyticCustomReport.attributes');module['exports']=function(_0x59b749,_0x28939a){return _0x59b749[_0xc1e4('0x9')](_0xc1e4('0xa'),attributes,{'tableName':'analytics_custom_reports','paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2d72=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./analyticCustomReport.attributes','exports','AnalyticCustomReport','analytics_custom_reports'];(function(_0xbdc2be,_0x1b9b1e){var _0x3702cc=function(_0x2fde47){while(--_0x2fde47){_0xbdc2be['push'](_0xbdc2be['shift']());}};_0x3702cc(++_0x1b9b1e);}(_0x2d72,0xa8));var _0x22d7=function(_0x391cdd,_0x3c4065){_0x391cdd=_0x391cdd-0x0;var _0x111c4c=_0x2d72[_0x391cdd];return _0x111c4c;};'use strict';var _=require(_0x22d7('0x0'));var util=require(_0x22d7('0x1'));var logger=require(_0x22d7('0x2'))(_0x22d7('0x3'));var moment=require(_0x22d7('0x4'));var BPromise=require(_0x22d7('0x5'));var rp=require(_0x22d7('0x6'));var fs=require('fs');var path=require(_0x22d7('0x7'));var rimraf=require(_0x22d7('0x8'));var config=require(_0x22d7('0x9'));var attributes=require(_0x22d7('0xa'));module[_0x22d7('0xb')]=function(_0x208b5b,_0x100426){return _0x208b5b['define'](_0x22d7('0xc'),attributes,{'tableName':_0x22d7('0xd'),'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 81c15cc..a261e49 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 _0xc639=['message','result','lodash','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','http','then','AnalyticCustomReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x36a8dd,_0x18263b){var _0x306e43=function(_0xe899c0){while(--_0xe899c0){_0x36a8dd['push'](_0x36a8dd['shift']());}};_0x306e43(++_0x18263b);}(_0xc639,0xc0));var _0x9c63=function(_0x4b7d4a,_0x25fb23){_0x4b7d4a=_0x4b7d4a-0x0;var _0x7ea5ad=_0xc639[_0x4b7d4a];return _0x7ea5ad;};'use strict';var _=require(_0x9c63('0x0'));var util=require('util');var moment=require(_0x9c63('0x1'));var BPromise=require(_0x9c63('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9c63('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x9c63('0x4'));var logger=require(_0x9c63('0x5'))(_0x9c63('0x6'));var config=require(_0x9c63('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x9c63('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x308cf3,_0x1b9365,_0x490321){return new BPromise(function(_0x506234,_0x52c13d){return client['request'](_0x308cf3,_0x490321)[_0x9c63('0x9')](function(_0x376245){logger['info'](_0x9c63('0xa'),_0x1b9365,_0x9c63('0xb'));logger[_0x9c63('0xc')](_0x9c63('0xd'),_0x1b9365,_0x9c63('0xb'),JSON[_0x9c63('0xe')](_0x376245));if(_0x376245[_0x9c63('0xf')]){if(_0x376245[_0x9c63('0xf')][_0x9c63('0x10')]===0x1f4){logger[_0x9c63('0xf')](_0x9c63('0xa'),_0x1b9365,_0x376245[_0x9c63('0xf')][_0x9c63('0x11')]);return _0x52c13d(_0x376245['error']['message']);}logger[_0x9c63('0xf')](_0x9c63('0xa'),_0x1b9365,_0x376245[_0x9c63('0xf')][_0x9c63('0x11')]);return _0x506234(_0x376245['error'][_0x9c63('0x11')]);}else{logger['info'](_0x9c63('0xa'),_0x1b9365,'request\x20sent');_0x506234(_0x376245[_0x9c63('0x12')]['message']);}})['catch'](function(_0xc0f75c){logger[_0x9c63('0xf')](_0x9c63('0xa'),_0x1b9365,_0xc0f75c);_0x52c13d(_0xc0f75c);});});} \ No newline at end of file +var _0xc090=['request\x20sent','debug','stringify','error','code','message','result','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','client','request','then','info','AnalyticCustomReport,\x20%s,\x20%s'];(function(_0xb6b229,_0x3637b6){var _0x4aa2cf=function(_0x1a7d7f){while(--_0x1a7d7f){_0xb6b229['push'](_0xb6b229['shift']());}};_0x4aa2cf(++_0x3637b6);}(_0xc090,0x10c));var _0x0c09=function(_0x435470,_0x519a29){_0x435470=_0x435470-0x0;var _0x35ac9a=_0xc090[_0x435470];return _0x35ac9a;};'use strict';var _=require(_0x0c09('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x0c09('0x1'));var rs=require(_0x0c09('0x2'));var fs=require('fs');var Redis=require(_0x0c09('0x3'));var db=require(_0x0c09('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x0c09('0x5'))('rpc');var config=require(_0x0c09('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x0c09('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4bb58d,_0x12a03d,_0x746b9d){return new BPromise(function(_0xb3636f,_0x59eff2){return client[_0x0c09('0x8')](_0x4bb58d,_0x746b9d)[_0x0c09('0x9')](function(_0x2da373){logger[_0x0c09('0xa')](_0x0c09('0xb'),_0x12a03d,_0x0c09('0xc'));logger[_0x0c09('0xd')]('AnalyticCustomReport,\x20%s,\x20%s,\x20%s',_0x12a03d,_0x0c09('0xc'),JSON[_0x0c09('0xe')](_0x2da373));if(_0x2da373[_0x0c09('0xf')]){if(_0x2da373[_0x0c09('0xf')][_0x0c09('0x10')]===0x1f4){logger[_0x0c09('0xf')](_0x0c09('0xb'),_0x12a03d,_0x2da373['error'][_0x0c09('0x11')]);return _0x59eff2(_0x2da373[_0x0c09('0xf')][_0x0c09('0x11')]);}logger[_0x0c09('0xf')](_0x0c09('0xb'),_0x12a03d,_0x2da373['error']['message']);return _0xb3636f(_0x2da373[_0x0c09('0xf')][_0x0c09('0x11')]);}else{logger[_0x0c09('0xa')](_0x0c09('0xb'),_0x12a03d,_0x0c09('0xc'));_0xb3636f(_0x2da373[_0x0c09('0x12')][_0x0c09('0x11')]);}})[_0x0c09('0x13')](function(_0x28ce2c){logger['error'](_0x0c09('0xb'),_0x12a03d,_0x28ce2c);_0x59eff2(_0x28ce2c);});});} \ No newline at end of file diff --git a/server/api/analyticCustomReport/index.js b/server/api/analyticCustomReport/index.js index 64d7ee8..a205dd7 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 _0x7749=['express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','show','/:id/preview','preview','/:id/run','query','post','create','put','/:id','update','delete','destroy','connect-timeout'];(function(_0x44c431,_0x18137a){var _0x33447e=function(_0x401b57){while(--_0x401b57){_0x44c431['push'](_0x44c431['shift']());}};_0x33447e(++_0x18137a);}(_0x7749,0x179));var _0x9774=function(_0x227518,_0x3edf1c){_0x227518=_0x227518-0x0;var _0x46307b=_0x7749[_0x227518];return _0x46307b;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x9774('0x0'));var express=require(_0x9774('0x1'));var router=express[_0x9774('0x2')]();var fs_extra=require(_0x9774('0x3'));var auth=require(_0x9774('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x9774('0x5'));var controller=require('./analyticCustomReport.controller');router[_0x9774('0x6')]('/',auth[_0x9774('0x7')](),controller[_0x9774('0x8')]);router[_0x9774('0x6')]('/:id',auth[_0x9774('0x7')](),controller[_0x9774('0x9')]);router[_0x9774('0x6')](_0x9774('0xa'),auth[_0x9774('0x7')](),controller[_0x9774('0xb')]);router[_0x9774('0x6')](_0x9774('0xc'),auth['isAuthenticated'](),controller['run']);router[_0x9774('0x6')]('/:id/query',auth['isAuthenticated'](),controller[_0x9774('0xd')]);router[_0x9774('0xe')]('/',auth[_0x9774('0x7')](),controller[_0x9774('0xf')]);router[_0x9774('0x10')](_0x9774('0x11'),auth[_0x9774('0x7')](),controller[_0x9774('0x12')]);router[_0x9774('0x13')]('/:id',auth[_0x9774('0x7')](),controller[_0x9774('0x14')]);module['exports']=router; \ No newline at end of file +var _0x83a6=['/:id/query','query','post','create','put','/:id','update','delete','destroy','exports','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','show','/:id/preview','preview','/:id/run','run'];(function(_0x173060,_0xf5ad1){var _0x122cad=function(_0x10a570){while(--_0x10a570){_0x173060['push'](_0x173060['shift']());}};_0x122cad(++_0xf5ad1);}(_0x83a6,0x190));var _0x683a=function(_0x5703f6,_0x4910f9){_0x5703f6=_0x5703f6-0x0;var _0x5cf623=_0x83a6[_0x5703f6];return _0x5cf623;};'use strict';var multer=require(_0x683a('0x0'));var util=require('util');var path=require(_0x683a('0x1'));var timeout=require('connect-timeout');var express=require(_0x683a('0x2'));var router=express[_0x683a('0x3')]();var fs_extra=require(_0x683a('0x4'));var auth=require(_0x683a('0x5'));var interaction=require(_0x683a('0x6'));var config=require(_0x683a('0x7'));var controller=require('./analyticCustomReport.controller');router[_0x683a('0x8')]('/',auth[_0x683a('0x9')](),controller[_0x683a('0xa')]);router['get']('/:id',auth[_0x683a('0x9')](),controller[_0x683a('0xb')]);router['get'](_0x683a('0xc'),auth[_0x683a('0x9')](),controller[_0x683a('0xd')]);router[_0x683a('0x8')](_0x683a('0xe'),auth[_0x683a('0x9')](),controller[_0x683a('0xf')]);router[_0x683a('0x8')](_0x683a('0x10'),auth[_0x683a('0x9')](),controller[_0x683a('0x11')]);router[_0x683a('0x12')]('/',auth[_0x683a('0x9')](),controller[_0x683a('0x13')]);router[_0x683a('0x14')](_0x683a('0x15'),auth['isAuthenticated'](),controller[_0x683a('0x16')]);router[_0x683a('0x17')]('/:id',auth[_0x683a('0x9')](),controller[_0x683a('0x18')]);module[_0x683a('0x19')]=router; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js b/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js index 15b79b0..1f7c0b2 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 _0xdc97=['exports','STRING','TEXT','sequelize'];(function(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0xdc97,0x13b));var _0x7dc9=function(_0x15546f,_0x7f1105){_0x15546f=_0x15546f-0x0;var _0x4859c7=_0xdc97[_0x15546f];return _0x4859c7;};'use strict';var Sequelize=require(_0x7dc9('0x0'));module[_0x7dc9('0x1')]={'name':{'type':Sequelize[_0x7dc9('0x2')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'parent':{'type':Sequelize[_0x7dc9('0x2')]},'table':{'type':Sequelize['STRING']},'conditions':{'type':Sequelize[_0x7dc9('0x3')]},'joins':{'type':Sequelize[_0x7dc9('0x3')]}}; \ No newline at end of file +var _0xe14b=['exports','STRING','TEXT','sequelize'];(function(_0x53f6fb,_0x289c49){var _0x74a568=function(_0x197cba){while(--_0x197cba){_0x53f6fb['push'](_0x53f6fb['shift']());}};_0x74a568(++_0x289c49);}(_0xe14b,0x93));var _0xbe14=function(_0x5b16fa,_0x157f60){_0x5b16fa=_0x5b16fa-0x0;var _0x35dd49=_0xe14b[_0x5b16fa];return _0x35dd49;};'use strict';var Sequelize=require(_0xbe14('0x0'));module[_0xbe14('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize['STRING']},'parent':{'type':Sequelize[_0xbe14('0x2')]},'table':{'type':Sequelize[_0xbe14('0x2')]},'conditions':{'type':Sequelize['TEXT']},'joins':{'type':Sequelize[_0xbe14('0x3')]}}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.controller.js b/server/api/analyticDefaultReport/analyticDefaultReport.controller.js index 2e87544..0eb4a72 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 _0x5fc3=['QueryTypes','right_join','HOUR(%s)','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','dbH','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','get','DefaultReports','destroy','error','stack','name','index','map','AnalyticDefaultReport','rawAttributes','fieldName','type','key','keys','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','params','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Reports','UserProfileSection','find','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','join','left_join','cross_join','SUM(%s)','COUNT(%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)','includes','IS\x20NULL','IS\x20NOT\x20NULL','rules','operator','group','field','condition','value','Sequelize','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','select','from','table','MetricId','metric','function','replace','groupBy','orderBy','order','DESC','alias','joins','parse','parentKey','foreignTable','foreignKey','format','%s.%s\x20=\x20%s.%s','conditions','clone','debug','Limited\x20Query:','sequelize','toString','SELECT','GROUP_CONCAT(%s)','SEC_TO_TIME(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','IS\x20EMPTY','getFields','ValidationErrorItem','fullPath','%s-%s.%s','generate','output','csv','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','child_process','fork','../../components/export/','../../files/reports','countTable','COUNT(*)'];(function(_0xdd5a91,_0x4d10ad){var _0x16c4c2=function(_0x4e4785){while(--_0x4e4785){_0xdd5a91['push'](_0xdd5a91['shift']());}};_0x16c4c2(++_0x4d10ad);}(_0x5fc3,0xa8));var _0x35fc=function(_0x135904,_0x1e252b){_0x135904=_0x135904-0x0;var _0x1ce7d5=_0x5fc3[_0x135904];return _0x1ce7d5;};'use strict';var emlformat=require(_0x35fc('0x0'));var rimraf=require(_0x35fc('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x35fc('0x2'));var rp=require(_0x35fc('0x3'));var moment=require(_0x35fc('0x4'));var BPromise=require(_0x35fc('0x5'));var Mustache=require(_0x35fc('0x6'));var util=require('util');var path=require(_0x35fc('0x7'));var sox=require(_0x35fc('0x8'));var csv=require(_0x35fc('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x35fc('0xa'));var squel=require('squel');var crypto=require(_0x35fc('0xb'));var jsforce=require(_0x35fc('0xc'));var deskjs=require(_0x35fc('0xd'));var toCsv=require(_0x35fc('0x9'));var querystring=require(_0x35fc('0xe'));var Papa=require(_0x35fc('0xf'));var Redis=require(_0x35fc('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x35fc('0x11'));var as=require(_0x35fc('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x35fc('0x13'))(_0x35fc('0x14'));var utils=require('../../config/utils');var config=require(_0x35fc('0x15'));var licenseUtil=require(_0x35fc('0x16'));var db=require('../../mysqldb')['db'];var dbH=require('../../mysqldb')[_0x35fc('0x17')];function respondWithStatusCode(_0x5d462a,_0x397738){_0x397738=_0x397738||0xcc;return function(_0x22055e){if(_0x22055e){return _0x5d462a[_0x35fc('0x18')](_0x397738);}return _0x5d462a[_0x35fc('0x19')](_0x397738)[_0x35fc('0x1a')]();};}function respondWithResult(_0x5cfe94,_0x59507a){_0x59507a=_0x59507a||0xc8;return function(_0x5eac0f){if(_0x5eac0f){return _0x5cfe94['status'](_0x59507a)[_0x35fc('0x1b')](_0x5eac0f);}};}function respondWithFilteredResult(_0x229d56,_0x53b898){return function(_0x154958){if(_0x154958){var _0x227a49=typeof _0x53b898[_0x35fc('0x1c')]==='undefined'&&typeof _0x53b898[_0x35fc('0x1d')]===_0x35fc('0x1e');var _0x553677=_0x154958[_0x35fc('0x1f')];var _0x363e47=_0x227a49?0x0:_0x53b898[_0x35fc('0x1c')];var _0x5f56c6=_0x227a49?_0x154958[_0x35fc('0x1f')]:_0x53b898[_0x35fc('0x1c')]+_0x53b898[_0x35fc('0x1d')];var _0x488234;if(_0x5f56c6>=_0x553677){_0x5f56c6=_0x553677;_0x488234=0xc8;}else{_0x488234=0xce;}_0x229d56[_0x35fc('0x19')](_0x488234);return _0x229d56[_0x35fc('0x20')](_0x35fc('0x21'),_0x363e47+'-'+_0x5f56c6+'/'+_0x553677)[_0x35fc('0x1b')](_0x154958);}return null;};}function patchUpdates(_0x20ffde){return function(_0x21f1a9){try{jsonpatch[_0x35fc('0x22')](_0x21f1a9,_0x20ffde,!![]);}catch(_0x3b05b0){return BPromise[_0x35fc('0x23')](_0x3b05b0);}return _0x21f1a9[_0x35fc('0x24')]();};}function saveUpdates(_0x5bd2b8,_0x323aee){return function(_0xd5399f){if(_0xd5399f){return _0xd5399f[_0x35fc('0x25')](_0x5bd2b8)[_0x35fc('0x26')](function(_0x3b4743){return _0x3b4743;});}return null;};}function removeEntity(_0x55e9e7,_0x33f5e8){return function(_0x4c587a){if(_0x4c587a){return _0x4c587a['destroy']()[_0x35fc('0x26')](function(){var _0x5a93df=_0x4c587a[_0x35fc('0x27')]({'plain':!![]});var _0x51cfec=_0x35fc('0x28');return db['UserProfileResource'][_0x35fc('0x29')]({'where':{'type':_0x51cfec,'resourceId':_0x5a93df['id']}})[_0x35fc('0x26')](function(){return _0x4c587a;});})['then'](function(){_0x55e9e7['status'](0xcc)[_0x35fc('0x1a')]();});}};}function handleEntityNotFound(_0x58edb6,_0x274208){return function(_0x1a5d92){if(!_0x1a5d92){_0x58edb6['sendStatus'](0x194);}return _0x1a5d92;};}function handleError(_0x26b7cb,_0x645eac){_0x645eac=_0x645eac||0x1f4;return function(_0x383837){logger[_0x35fc('0x2a')](_0x383837[_0x35fc('0x2b')]);if(_0x383837[_0x35fc('0x2c')]){delete _0x383837[_0x35fc('0x2c')];}_0x26b7cb[_0x35fc('0x19')](_0x645eac)['send'](_0x383837);};}exports[_0x35fc('0x2d')]=function(_0x220931,_0x22af18){var _0x52acc5={},_0xe79f52={},_0x16f067={'count':0x0,'rows':[]};var _0x3822a8=_[_0x35fc('0x2e')](db[_0x35fc('0x2f')][_0x35fc('0x30')],function(_0x222ddb){return{'name':_0x222ddb[_0x35fc('0x31')],'type':_0x222ddb[_0x35fc('0x32')][_0x35fc('0x33')]};});_0xe79f52['model']=_['map'](_0x3822a8,_0x35fc('0x2c'));_0xe79f52['query']=_[_0x35fc('0x34')](_0x220931[_0x35fc('0x35')]);_0xe79f52[_0x35fc('0x36')]=_[_0x35fc('0x37')](_0xe79f52[_0x35fc('0x38')],_0xe79f52[_0x35fc('0x35')]);_0x52acc5['attributes']=_[_0x35fc('0x37')](_0xe79f52[_0x35fc('0x38')],qs[_0x35fc('0x39')](_0x220931[_0x35fc('0x35')][_0x35fc('0x39')]));_0x52acc5[_0x35fc('0x3a')]=_0x52acc5['attributes'][_0x35fc('0x3b')]?_0x52acc5[_0x35fc('0x3a')]:_0xe79f52[_0x35fc('0x38')];if(!_0x220931['query'][_0x35fc('0x3c')]('nolimit')){_0x52acc5[_0x35fc('0x1d')]=qs[_0x35fc('0x1d')](_0x220931[_0x35fc('0x35')][_0x35fc('0x1d')]);_0x52acc5['offset']=qs['offset'](_0x220931['query'][_0x35fc('0x1c')]);}_0x52acc5['order']=qs[_0x35fc('0x3d')](_0x220931['query'][_0x35fc('0x3d')]);_0x52acc5[_0x35fc('0x3e')]=qs[_0x35fc('0x36')](_[_0x35fc('0x3f')](_0x220931[_0x35fc('0x35')],_0xe79f52[_0x35fc('0x36')]),_0x3822a8);if(_0x220931[_0x35fc('0x35')]['filter']){_0x52acc5[_0x35fc('0x3e')]=_[_0x35fc('0x40')](_0x52acc5['where'],{'$or':_[_0x35fc('0x2e')](_0x3822a8,function(_0x1ccc41){if(_0x1ccc41[_0x35fc('0x32')]!==_0x35fc('0x41')){var _0x813866={};_0x813866[_0x1ccc41[_0x35fc('0x2c')]]={'$like':'%'+_0x220931['query'][_0x35fc('0x42')]+'%'};return _0x813866;}})});}_0x52acc5=_[_0x35fc('0x40')]({},_0x52acc5,_0x220931[_0x35fc('0x43')]);var _0x52543b={'where':_0x52acc5[_0x35fc('0x3e')]};return db[_0x35fc('0x2f')]['count'](_0x52543b)[_0x35fc('0x26')](function(_0x280af1){_0x16f067[_0x35fc('0x1f')]=_0x280af1;if(_0x220931[_0x35fc('0x35')][_0x35fc('0x44')]){_0x52acc5[_0x35fc('0x45')]=[{'all':!![]}];}return db[_0x35fc('0x2f')][_0x35fc('0x46')](_0x52acc5);})['then'](function(_0x596e83){_0x16f067[_0x35fc('0x47')]=_0x596e83;return _0x16f067;})[_0x35fc('0x26')](respondWithFilteredResult(_0x22af18,_0x52acc5))['catch'](handleError(_0x22af18,null));};exports['show']=function(_0x4ff202,_0x79677d){var _0x10f98b={'raw':!![],'where':{'id':_0x4ff202[_0x35fc('0x48')]['id']}},_0x4e56ed={};_0x4e56ed[_0x35fc('0x38')]=_[_0x35fc('0x34')](db[_0x35fc('0x2f')]['rawAttributes']);_0x4e56ed['query']=_['keys'](_0x4ff202['query']);_0x4e56ed['filters']=_[_0x35fc('0x37')](_0x4e56ed[_0x35fc('0x38')],_0x4e56ed['query']);_0x10f98b[_0x35fc('0x3a')]=_['intersection'](_0x4e56ed[_0x35fc('0x38')],qs[_0x35fc('0x39')](_0x4ff202[_0x35fc('0x35')][_0x35fc('0x39')]));_0x10f98b[_0x35fc('0x3a')]=_0x10f98b['attributes'][_0x35fc('0x3b')]?_0x10f98b[_0x35fc('0x3a')]:_0x4e56ed['model'];if(_0x4ff202[_0x35fc('0x35')][_0x35fc('0x44')]){_0x10f98b[_0x35fc('0x45')]=[{'all':!![]}];}_0x10f98b=_[_0x35fc('0x40')]({},_0x10f98b,_0x4ff202['options']);return db[_0x35fc('0x2f')]['find'](_0x10f98b)['then'](handleEntityNotFound(_0x79677d,null))[_0x35fc('0x26')](respondWithResult(_0x79677d,null))[_0x35fc('0x49')](handleError(_0x79677d,null));};exports[_0x35fc('0x4a')]=function(_0xca8aef,_0xf2ca20){return db[_0x35fc('0x2f')][_0x35fc('0x4a')](_0xca8aef[_0x35fc('0x4b')],{})['then'](function(_0x3e2961){var _0x91d7c0=_0xca8aef[_0x35fc('0x4c')][_0x35fc('0x27')]({'plain':!![]});if(!_0x91d7c0)throw new Error(_0x35fc('0x4d'));if(_0x91d7c0[_0x35fc('0x4e')]===_0x35fc('0x4c')){var _0x347a4a=_0x3e2961[_0x35fc('0x27')]({'plain':!![]});var _0xe6eb6a=_0x35fc('0x4f');return db[_0x35fc('0x50')][_0x35fc('0x51')]({'where':{'name':_0xe6eb6a,'userProfileId':_0x91d7c0[_0x35fc('0x52')]},'raw':!![]})['then'](function(_0x553ed6){if(_0x553ed6&&_0x553ed6[_0x35fc('0x53')]===0x0){return db[_0x35fc('0x54')][_0x35fc('0x4a')]({'name':_0x347a4a[_0x35fc('0x2c')],'resourceId':_0x347a4a['id'],'type':_0x35fc('0x28'),'sectionId':_0x553ed6['id']},{})[_0x35fc('0x26')](function(){return _0x3e2961;});}else{return _0x3e2961;}})['catch'](function(_0x4f024c){logger[_0x35fc('0x2a')](_0x35fc('0x55'),_0x4f024c);throw _0x4f024c;});}return _0x3e2961;})[_0x35fc('0x26')](respondWithResult(_0xf2ca20,0xc9))[_0x35fc('0x49')](handleError(_0xf2ca20,null));};exports['update']=function(_0x467980,_0x13281f){if(_0x467980['body']['id']){delete _0x467980[_0x35fc('0x4b')]['id'];}return db[_0x35fc('0x2f')]['find']({'where':{'id':_0x467980[_0x35fc('0x48')]['id']}})[_0x35fc('0x26')](handleEntityNotFound(_0x13281f,null))[_0x35fc('0x26')](saveUpdates(_0x467980[_0x35fc('0x4b')],null))['then'](respondWithResult(_0x13281f,null))['catch'](handleError(_0x13281f,null));};exports['destroy']=function(_0x240338,_0x2ea8d6){return db['AnalyticDefaultReport'][_0x35fc('0x51')]({'where':{'id':_0x240338[_0x35fc('0x48')]['id']}})[_0x35fc('0x26')](handleEntityNotFound(_0x2ea8d6,null))[_0x35fc('0x26')](removeEntity(_0x2ea8d6,null))[_0x35fc('0x49')](handleError(_0x2ea8d6,null));};exports['preview']=function(_0x2d9d45,_0x757aa6){var _0x39d470=0xa;var _0x509e77=[_0x35fc('0x56'),_0x35fc('0x57'),'right_join',_0x35fc('0x58')];var _0x164c7b={'SUM':_0x35fc('0x59'),'COUNT':_0x35fc('0x5a'),'COUNT DISTINCT':_0x35fc('0x5b'),'MAX':_0x35fc('0x5c'),'MIN':_0x35fc('0x5d'),'AVG':_0x35fc('0x5e'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0x35fc('0x5f'),'GROUP_CONCAT DESC':_0x35fc('0x60')};var _0x303927={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0x35fc('0x61'),'HOUR':'HOUR(%s)','ROUND':'ROUND(%s)','UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x23b54f=function(_0xb1c68a){return!_[_0x35fc('0x62')]([_0x35fc('0x63'),_0x35fc('0x64'),'IS\x20EMPTY','IS\x20NOT\x20EMPTY'],_0xb1c68a);};var _0x5353ea=function(_0x4faef4){if(!_0x4faef4||!_0x4faef4['rules'][_0x35fc('0x3b')]){return'';}for(var _0x44250b='(',_0xd470e8=0x0;_0xd470e8<_0x4faef4[_0x35fc('0x65')]['length'];_0xd470e8+=0x1){_0xd470e8>0x0&&(_0x44250b+='\x20'+_0x4faef4[_0x35fc('0x66')]+'\x20');_0x44250b+=_0x4faef4[_0x35fc('0x65')][_0xd470e8][_0x35fc('0x67')]?_0x5353ea(_0x4faef4[_0x35fc('0x65')][_0xd470e8][_0x35fc('0x67')]):_0x4faef4[_0x35fc('0x65')][_0xd470e8][_0x35fc('0x68')]+'\x20'+_0x4faef4[_0x35fc('0x65')][_0xd470e8][_0x35fc('0x69')]+(_0x23b54f(_0x4faef4['rules'][_0xd470e8][_0x35fc('0x69')])?'\x20'+_0x4faef4['rules'][_0xd470e8][_0x35fc('0x6a')]:'');}return _0x44250b+')';};var _0x9029e3={'where':{'id':_0x2d9d45['params']['id']}},_0x2ac8e1,_0x2bc76c,_0x4bdde7,_0x465c14,_0x4af592;_0x9029e3=_['merge']({},_0x9029e3,_0x2d9d45[_0x35fc('0x43')]);return db['AnalyticDefaultReport'][_0x35fc('0x51')](_0x9029e3)['then'](function(_0x11717){if(_0x11717){_0x2ac8e1=_0x11717;return _0x11717['getFields']();}return null;})[_0x35fc('0x26')](function(_0x455b84){if(_0x455b84){if(!_0x455b84[_0x35fc('0x3b')]){throw new db[(_0x35fc('0x6b'))]['ValidationErrorItem'](_0x35fc('0x6c'),0x193);}_0x2bc76c=_0x455b84;return db[_0x35fc('0x6d')][_0x35fc('0x46')]({'raw':!![]});}return null;})['then'](function(_0x3aa7fa){if(_0x3aa7fa){_0x4bdde7=_[_0x35fc('0x6e')](_0x3aa7fa,'id');var _0x37764b;var _0x3c1b56=squel[_0x35fc('0x6f')]();_0x3c1b56[_0x35fc('0x70')](_0x2ac8e1[_0x35fc('0x71')]);for(var _0x4464d5=0x0;_0x4464d5<_0x2bc76c['length'];_0x4464d5+=0x1){_0x37764b=_0x2bc76c[_0x4464d5][_0x35fc('0x72')]?_0x4bdde7[_0x2bc76c[_0x4464d5][_0x35fc('0x72')]][_0x35fc('0x73')]:_0x2bc76c[_0x4464d5]['field'];_0x37764b=_0x2bc76c[_0x4464d5][_0x35fc('0x74')]?_[_0x35fc('0x75')](_0x164c7b[_0x2bc76c[_0x4464d5]['function']],'%s',_0x37764b):_0x37764b;_0x37764b=_0x2bc76c[_0x4464d5]['format']?_[_0x35fc('0x75')](_0x303927[_0x2bc76c[_0x4464d5]['format']],'%s',_0x37764b):_0x37764b;if(_0x2bc76c[_0x4464d5][_0x35fc('0x76')]){_0x3c1b56[_0x35fc('0x67')](_0x37764b);}_0x2bc76c[_0x4464d5][_0x35fc('0x77')]&&_0x3c1b56[_0x35fc('0x78')](_0x37764b,_0x2bc76c[_0x4464d5][_0x35fc('0x77')]===_0x35fc('0x79')?![]:!![]);_0x3c1b56[_0x35fc('0x68')](_0x37764b,_0x2bc76c[_0x4464d5][_0x35fc('0x7a')]||_0x37764b);}if(_0x2ac8e1[_0x35fc('0x7b')]){_0x2ac8e1[_0x35fc('0x7b')]=JSON[_0x35fc('0x7c')](_0x2ac8e1[_0x35fc('0x7b')]);for(var _0x29f2b9=0x0;_0x29f2b9<_0x2ac8e1[_0x35fc('0x7b')][_0x35fc('0x3b')];_0x29f2b9+=0x1){if(_0x2ac8e1[_0x35fc('0x7b')][_0x29f2b9][_0x35fc('0x32')]&&_[_0x35fc('0x62')](_0x509e77,_0x2ac8e1[_0x35fc('0x7b')][_0x29f2b9][_0x35fc('0x32')])&&_0x2ac8e1['joins'][_0x29f2b9][_0x35fc('0x7d')]&&_0x2ac8e1['joins'][_0x29f2b9][_0x35fc('0x7e')]&&_0x2ac8e1[_0x35fc('0x7b')][_0x29f2b9][_0x35fc('0x7f')]){_0x3c1b56[_0x2ac8e1[_0x35fc('0x7b')][_0x29f2b9][_0x35fc('0x32')]](_0x2ac8e1[_0x35fc('0x7b')][_0x29f2b9][_0x35fc('0x7e')],null,util[_0x35fc('0x80')](_0x35fc('0x81'),_0x2ac8e1[_0x35fc('0x71')],_0x2ac8e1[_0x35fc('0x7b')][_0x29f2b9]['parentKey'],_0x2ac8e1[_0x35fc('0x7b')][_0x29f2b9][_0x35fc('0x7e')],_0x2ac8e1[_0x35fc('0x7b')][_0x29f2b9][_0x35fc('0x7f')]));}}}if(_0x2ac8e1[_0x35fc('0x82')]){_0x2ac8e1[_0x35fc('0x82')]=JSON['parse'](_0x2ac8e1[_0x35fc('0x82')]);_0x3c1b56[_0x35fc('0x3e')](_0x5353ea(_0x2ac8e1[_0x35fc('0x82')][_0x35fc('0x67')]));}_0x4af592=_0x3c1b56[_0x35fc('0x83')]();_0x3c1b56[_0x35fc('0x1d')](_0x39d470);_0x3c1b56[_0x35fc('0x1c')](0x0);logger[_0x35fc('0x84')](_0x35fc('0x85'),_0x3c1b56['toString']());return dbH[_0x35fc('0x86')]['query'](_0x3c1b56[_0x35fc('0x87')](),{'type':dbH[_0x35fc('0x86')]['QueryTypes'][_0x35fc('0x88')]});}})[_0x35fc('0x26')](respondWithResult(_0x757aa6,null))[_0x35fc('0x49')](handleError(_0x757aa6,null));};function runReport(_0x4274d6,_0x4026cc,_0x1a765f){var _0x42f87e=_0x4026cc[_0x35fc('0x2c')];var _0x25ee61=0xa;var _0x5806bf=['join','left_join','right_join',_0x35fc('0x58')];var _0x23cf84={'SUM':_0x35fc('0x59'),'COUNT':_0x35fc('0x5a'),'COUNT DISTINCT':_0x35fc('0x5b'),'MAX':'MAX(%s)','MIN':_0x35fc('0x5d'),'AVG':_0x35fc('0x5e'),'GROUP_CONCAT':_0x35fc('0x89'),'GROUP_CONCAT ASC':_0x35fc('0x5f'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x15e936={'SEC_TO_TIME':_0x35fc('0x8a'),'DATE':_0x35fc('0x61'),'HOUR':'HOUR(%s)','ROUND':_0x35fc('0x8b'),'UNIX_TIMESTAMP':_0x35fc('0x8c')};var _0x319033=function(_0x9fe765){return!_[_0x35fc('0x62')]([_0x35fc('0x63'),_0x35fc('0x64'),_0x35fc('0x8d'),'IS\x20NOT\x20EMPTY'],_0x9fe765);};var _0x2faff7=function(_0xa2c5f8){if(!_0xa2c5f8||!_0xa2c5f8[_0x35fc('0x65')][_0x35fc('0x3b')]){return'';}for(var _0x221c5b='(',_0x1fcd36=0x0;_0x1fcd36<_0xa2c5f8['rules'][_0x35fc('0x3b')];_0x1fcd36+=0x1){_0x1fcd36>0x0&&(_0x221c5b+='\x20'+_0xa2c5f8['operator']+'\x20');_0x221c5b+=_0xa2c5f8['rules'][_0x1fcd36][_0x35fc('0x67')]?_0x2faff7(_0xa2c5f8['rules'][_0x1fcd36][_0x35fc('0x67')]):_0xa2c5f8[_0x35fc('0x65')][_0x1fcd36][_0x35fc('0x68')]+'\x20'+_0xa2c5f8['rules'][_0x1fcd36][_0x35fc('0x69')]+(_0x319033(_0xa2c5f8[_0x35fc('0x65')][_0x1fcd36][_0x35fc('0x69')])?'\x20'+_0xa2c5f8[_0x35fc('0x65')][_0x1fcd36][_0x35fc('0x6a')]:'');}return _0x221c5b+')';};var _0x5abdf9={'where':{'id':_0x4274d6['id']}},_0x5512f6,_0x487cb5,_0x23b261,_0x4c742c,_0x2fae26;_0x5abdf9=_[_0x35fc('0x40')]({},_0x5abdf9,_0x1a765f);return db[_0x35fc('0x2f')][_0x35fc('0x51')](_0x5abdf9)['then'](function(_0x28e80d){if(_0x28e80d){_0x5512f6=_0x28e80d;return _0x28e80d[_0x35fc('0x8e')]();}return null;})[_0x35fc('0x26')](function(_0x47c507){if(_0x47c507){if(!_0x47c507[_0x35fc('0x3b')]){throw new db[(_0x35fc('0x6b'))][(_0x35fc('0x8f'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x487cb5=_0x47c507;return db['AnalyticMetric']['findAll']({'raw':!![]});}return null;})[_0x35fc('0x26')](function(_0x2edb1b){if(_0x2edb1b){_0x23b261=_[_0x35fc('0x6e')](_0x2edb1b,'id');var _0x3858a9;var _0x4859be=squel[_0x35fc('0x6f')]();_0x4859be[_0x35fc('0x70')](_0x5512f6['table']);for(var _0x5849a0=0x0;_0x5849a0<_0x487cb5[_0x35fc('0x3b')];_0x5849a0+=0x1){_0x3858a9=_0x487cb5[_0x5849a0][_0x35fc('0x72')]?_0x23b261[_0x487cb5[_0x5849a0][_0x35fc('0x72')]]['metric']:_0x487cb5[_0x5849a0]['field'];_0x3858a9=_0x487cb5[_0x5849a0][_0x35fc('0x74')]?_[_0x35fc('0x75')](_0x23cf84[_0x487cb5[_0x5849a0]['function']],'%s',_0x3858a9):_0x3858a9;_0x3858a9=_0x487cb5[_0x5849a0][_0x35fc('0x80')]?_[_0x35fc('0x75')](_0x15e936[_0x487cb5[_0x5849a0][_0x35fc('0x80')]],'%s',_0x3858a9):_0x3858a9;if(_0x487cb5[_0x5849a0]['groupBy']){_0x4859be[_0x35fc('0x67')](_0x3858a9);}_0x487cb5[_0x5849a0][_0x35fc('0x77')]&&_0x4859be[_0x35fc('0x78')](_0x3858a9,_0x487cb5[_0x5849a0][_0x35fc('0x77')]==='DESC'?![]:!![]);_0x4859be[_0x35fc('0x68')](_0x3858a9,_0x487cb5[_0x5849a0][_0x35fc('0x7a')]||_0x3858a9);}if(_0x5512f6[_0x35fc('0x7b')]){_0x5512f6['joins']=JSON[_0x35fc('0x7c')](_0x5512f6[_0x35fc('0x7b')]);for(var _0x425f72=0x0;_0x425f72<_0x5512f6['joins'][_0x35fc('0x3b')];_0x425f72+=0x1){if(_0x5512f6[_0x35fc('0x7b')][_0x425f72]['type']&&_[_0x35fc('0x62')](_0x5806bf,_0x5512f6[_0x35fc('0x7b')][_0x425f72][_0x35fc('0x32')])&&_0x5512f6[_0x35fc('0x7b')][_0x425f72][_0x35fc('0x7d')]&&_0x5512f6[_0x35fc('0x7b')][_0x425f72][_0x35fc('0x7e')]&&_0x5512f6[_0x35fc('0x7b')][_0x425f72][_0x35fc('0x7f')]){_0x4859be[_0x5512f6['joins'][_0x425f72][_0x35fc('0x32')]](_0x5512f6[_0x35fc('0x7b')][_0x425f72][_0x35fc('0x7e')],null,util[_0x35fc('0x80')]('%s.%s\x20=\x20%s.%s',_0x5512f6[_0x35fc('0x71')],_0x5512f6[_0x35fc('0x7b')][_0x425f72][_0x35fc('0x7d')],_0x5512f6[_0x35fc('0x7b')][_0x425f72][_0x35fc('0x7e')],_0x5512f6[_0x35fc('0x7b')][_0x425f72][_0x35fc('0x7f')]));}}}if(_0x5512f6[_0x35fc('0x82')]){_0x5512f6['conditions']=JSON['parse'](_0x5512f6[_0x35fc('0x82')]);_0x4859be[_0x35fc('0x3e')](_0x2faff7(_0x5512f6[_0x35fc('0x82')]['group']));}_0x2fae26=_0x4859be[_0x35fc('0x83')]();_0x4859be[_0x35fc('0x1d')](_0x25ee61);_0x4859be[_0x35fc('0x1c')](0x0);return;}})[_0x35fc('0x26')](function(){if(_0x4026cc['output']==='web'){return null;}var _0x379650=_['merge'](_0x4026cc,{'name':_0x4026cc[_0x35fc('0x90')]||_0x4026cc[_0x35fc('0x2c')]||_0x5512f6['name'],'basename':_0x42f87e,'savename':util['format'](_0x35fc('0x91'),_0x4026cc[_0x35fc('0x2c')]||_0x5512f6[_0x35fc('0x2c')],require('randomstring')[_0x35fc('0x92')](0x4),_0x4026cc[_0x35fc('0x93')]||_0x35fc('0x94')),'reportId':_0x5512f6['id'],'reportType':'default'});return db[_0x35fc('0x95')][_0x35fc('0x4a')](_0x379650,{'raw':!![]});})[_0x35fc('0x26')](function(_0x328e90){if(_0x5512f6['table']===_0x35fc('0x96')){_0x2fae26[_0x35fc('0x3e')](_0x5512f6[_0x35fc('0x71')]+_0x35fc('0x97'),_0x4026cc[_0x35fc('0x98')],_0x4026cc[_0x35fc('0x99')]);}else{_0x2fae26['where'](_0x5512f6[_0x35fc('0x71')]+_0x35fc('0x9a'),_0x4026cc['startDate'],_0x4026cc[_0x35fc('0x99')]);}if(_0x328e90){logger[_0x35fc('0x9b')]('Run\x20Query:',_0x2fae26[_0x35fc('0x87')]());require(_0x35fc('0x9c'))[_0x35fc('0x9d')](path[_0x35fc('0x56')](__dirname,_0x35fc('0x9e'),_0x328e90['output']),[_0x328e90['id'],_0x2fae26[_0x35fc('0x87')](),path[_0x35fc('0x56')](__dirname,_0x35fc('0x9f'),_0x328e90['savename']),_0x42f87e]);return _0x328e90;}else{var _0x1224cd=squel['select']();_0x1224cd['from']('('+_0x2fae26[_0x35fc('0x87')]()+')',_0x35fc('0xa0'));_0x1224cd[_0x35fc('0x68')](_0x35fc('0xa1'),_0x35fc('0x1f'));_0x2fae26['limit'](_0x4026cc[_0x35fc('0x1d')]||_0x25ee61);_0x2fae26[_0x35fc('0x1c')](_0x4026cc[_0x35fc('0x1c')]||0x0);return dbH['sequelize'][_0x35fc('0x35')](_0x1224cd[_0x35fc('0x87')](),{'type':dbH[_0x35fc('0x86')][_0x35fc('0xa2')][_0x35fc('0x88')]})['then'](function(_0x1a2d73){if(!_0x1a2d73[_0x35fc('0x3b')]){_0x4c742c=0x0;}else{_0x4c742c=_0x1a2d73[0x0]['count']||0x0;}return dbH['sequelize'][_0x35fc('0x35')](_0x2fae26[_0x35fc('0x87')](),{'type':dbH[_0x35fc('0x86')][_0x35fc('0xa2')][_0x35fc('0x88')]});})[_0x35fc('0x26')](function(_0x8c80ca){return{'rows':_0x8c80ca||[],'count':_0x4c742c};});}});}exports['run']=function(_0x5dc286,_0x146ce1){return runReport(_0x5dc286[_0x35fc('0x48')],_0x5dc286[_0x35fc('0x35')],_0x5dc286[_0x35fc('0x43')])[_0x35fc('0x26')](respondWithResult(_0x146ce1,null))['catch'](handleError(_0x146ce1,null));};exports['runReport']=runReport;exports[_0x35fc('0x35')]=function(_0x2451f2,_0x3fff79){var _0x1c6ce9=0xa;var _0x4b2079=['join',_0x35fc('0x57'),_0x35fc('0xa3'),_0x35fc('0x58')];var _0xd46d64={'SUM':'SUM(%s)','COUNT':'COUNT(%s)','COUNT DISTINCT':_0x35fc('0x5b'),'MAX':_0x35fc('0x5c'),'MIN':'MIN(%s)','AVG':_0x35fc('0x5e'),'GROUP_CONCAT':_0x35fc('0x89'),'GROUP_CONCAT ASC':_0x35fc('0x5f'),'GROUP_CONCAT DESC':_0x35fc('0x60')};var _0x274337={'SEC_TO_TIME':_0x35fc('0x8a'),'DATE':_0x35fc('0x61'),'HOUR':_0x35fc('0xa4'),'ROUND':_0x35fc('0x8b'),'UNIX_TIMESTAMP':_0x35fc('0x8c')};var _0x19ae76=function(_0x366a3b){return!_[_0x35fc('0x62')]([_0x35fc('0x63'),_0x35fc('0x64'),_0x35fc('0x8d'),'IS\x20NOT\x20EMPTY'],_0x366a3b);};var _0x345026=function(_0x553f7d){if(!_0x553f7d||!_0x553f7d[_0x35fc('0x65')]['length']){return'';}for(var _0x5aa072='(',_0x3c96ef=0x0;_0x3c96ef<_0x553f7d[_0x35fc('0x65')][_0x35fc('0x3b')];_0x3c96ef+=0x1){_0x3c96ef>0x0&&(_0x5aa072+='\x20'+_0x553f7d['operator']+'\x20');_0x5aa072+=_0x553f7d[_0x35fc('0x65')][_0x3c96ef][_0x35fc('0x67')]?_0x345026(_0x553f7d[_0x35fc('0x65')][_0x3c96ef][_0x35fc('0x67')]):_0x553f7d[_0x35fc('0x65')][_0x3c96ef][_0x35fc('0x68')]+'\x20'+_0x553f7d['rules'][_0x3c96ef]['condition']+(_0x19ae76(_0x553f7d[_0x35fc('0x65')][_0x3c96ef]['condition'])?'\x20'+_0x553f7d['rules'][_0x3c96ef][_0x35fc('0x6a')]:'');}return _0x5aa072+')';};var _0x48b826={'where':{'id':_0x2451f2[_0x35fc('0x48')]['id']}},_0x556f9a,_0x5ae83f,_0x450769,_0x5d461c,_0x355154;_0x48b826=_[_0x35fc('0x40')]({},_0x48b826,_0x2451f2[_0x35fc('0x43')]);return db[_0x35fc('0x2f')][_0x35fc('0x51')](_0x48b826)['then'](function(_0x522ff2){if(_0x522ff2){_0x556f9a=_0x522ff2;return _0x522ff2[_0x35fc('0x8e')]();}return null;})['then'](function(_0x233c94){if(_0x233c94){if(!_0x233c94[_0x35fc('0x3b')]){throw new db['Sequelize']['ValidationErrorItem']('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x5ae83f=_0x233c94;return db[_0x35fc('0x6d')][_0x35fc('0x46')]({'raw':!![]});}return null;})[_0x35fc('0x26')](function(_0x135e18){if(_0x135e18){_0x450769=_[_0x35fc('0x6e')](_0x135e18,'id');var _0x28525f;var _0x9116b1=squel[_0x35fc('0x6f')]();_0x9116b1['from'](_0x556f9a['table']);for(var _0x5cefdb=0x0;_0x5cefdb<_0x5ae83f['length'];_0x5cefdb+=0x1){_0x28525f=_0x5ae83f[_0x5cefdb][_0x35fc('0x72')]?_0x450769[_0x5ae83f[_0x5cefdb]['MetricId']][_0x35fc('0x73')]:_0x5ae83f[_0x5cefdb]['field'];_0x28525f=_0x5ae83f[_0x5cefdb][_0x35fc('0x74')]?_[_0x35fc('0x75')](_0xd46d64[_0x5ae83f[_0x5cefdb]['function']],'%s',_0x28525f):_0x28525f;_0x28525f=_0x5ae83f[_0x5cefdb]['format']?_[_0x35fc('0x75')](_0x274337[_0x5ae83f[_0x5cefdb][_0x35fc('0x80')]],'%s',_0x28525f):_0x28525f;if(_0x5ae83f[_0x5cefdb][_0x35fc('0x76')]){_0x9116b1[_0x35fc('0x67')](_0x28525f);}_0x5ae83f[_0x5cefdb][_0x35fc('0x77')]&&_0x9116b1['order'](_0x28525f,_0x5ae83f[_0x5cefdb]['orderBy']===_0x35fc('0x79')?![]:!![]);_0x9116b1['field'](_0x28525f,_0x5ae83f[_0x5cefdb][_0x35fc('0x7a')]||_0x28525f);}if(_0x556f9a['joins']){_0x556f9a[_0x35fc('0x7b')]=JSON[_0x35fc('0x7c')](_0x556f9a[_0x35fc('0x7b')]);for(var _0x10e30e=0x0;_0x10e30e<_0x556f9a['joins'][_0x35fc('0x3b')];_0x10e30e+=0x1){if(_0x556f9a['joins'][_0x10e30e][_0x35fc('0x32')]&&_['includes'](_0x4b2079,_0x556f9a['joins'][_0x10e30e][_0x35fc('0x32')])&&_0x556f9a['joins'][_0x10e30e][_0x35fc('0x7d')]&&_0x556f9a[_0x35fc('0x7b')][_0x10e30e][_0x35fc('0x7e')]&&_0x556f9a[_0x35fc('0x7b')][_0x10e30e][_0x35fc('0x7f')]){_0x9116b1[_0x556f9a[_0x35fc('0x7b')][_0x10e30e][_0x35fc('0x32')]](_0x556f9a[_0x35fc('0x7b')][_0x10e30e][_0x35fc('0x7e')],null,util['format'](_0x35fc('0x81'),_0x556f9a[_0x35fc('0x71')],_0x556f9a[_0x35fc('0x7b')][_0x10e30e][_0x35fc('0x7d')],_0x556f9a[_0x35fc('0x7b')][_0x10e30e][_0x35fc('0x7e')],_0x556f9a[_0x35fc('0x7b')][_0x10e30e][_0x35fc('0x7f')]));}}}if(_0x556f9a['conditions']){_0x556f9a['conditions']=JSON['parse'](_0x556f9a['conditions']);_0x9116b1['where'](_0x345026(_0x556f9a[_0x35fc('0x82')][_0x35fc('0x67')]));}_0x355154=_0x9116b1[_0x35fc('0x83')]();_0x9116b1[_0x35fc('0x1d')](_0x1c6ce9);_0x9116b1[_0x35fc('0x1c')](0x0);logger['debug'](_0x35fc('0x85'),_0x9116b1[_0x35fc('0x87')]());return dbH[_0x35fc('0x86')][_0x35fc('0x35')](_0x9116b1[_0x35fc('0x87')](),{'type':dbH['sequelize'][_0x35fc('0xa2')][_0x35fc('0x88')]});}})[_0x35fc('0x26')](function(){return{'sql':_0x355154['toString']()};})[_0x35fc('0x26')](respondWithResult(_0x3fff79,null))[_0x35fc('0x49')](handleError(_0x3fff79,null));}; \ No newline at end of file +var _0xc4aa=['Content-Range','apply','reject','save','update','then','destroy','get','DefaultReports','UserProfileResource','name','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','merge','VIRTUAL','filter','options','includeAll','include','AnalyticDefaultReport','findAll','rows','catch','show','length','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Reports','find','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','preview','join','left_join','right_join','cross_join','SUM(%s)','COUNT(DISTINCT\x20%s)','MIN(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','DATE(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','IS\x20NULL','IS\x20EMPTY','rules','operator','group','field','condition','getFields','Sequelize','AnalyticMetric','keyBy','select','from','table','MetricId','metric','function','replace','format','orderBy','joins','parentKey','foreignTable','%s.%s\x20=\x20%s.%s','conditions','parse','clone','Limited\x20Query:','toString','sequelize','QueryTypes','SELECT','COUNT(%s)','MAX(%s)','AVG(%s)','SEC_TO_TIME(%s)','IS\x20NOT\x20EMPTY','value','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','groupBy','alias','includes','foreignKey','output','web','fullPath','%s-%s.%s','randomstring','default','AnalyticExtractedReport','.calldate\x20BETWEEN\x20?\x20AND\x20?','endDate','startDate','info','Run\x20Query:','child_process','fork','countTable','runReport','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','IS\x20NOT\x20NULL','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set'];(function(_0x1a73f7,_0x274c12){var _0x3570fa=function(_0xdb9fc0){while(--_0xdb9fc0){_0x1a73f7['push'](_0x1a73f7['shift']());}};_0x3570fa(++_0x274c12);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x5c2e3e,_0x26ecd3){_0x5c2e3e=_0x5c2e3e-0x0;var _0x53f64a=_0xc4aa[_0x5c2e3e];return _0x53f64a;};'use strict';var emlformat=require(_0xac4a('0x0'));var rimraf=require(_0xac4a('0x1'));var zipdir=require(_0xac4a('0x2'));var jsonpatch=require(_0xac4a('0x3'));var rp=require(_0xac4a('0x4'));var moment=require(_0xac4a('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xac4a('0x6'));var sox=require(_0xac4a('0x7'));var csv=require(_0xac4a('0x8'));var ejs=require(_0xac4a('0x9'));var fs=require('fs');var fs_extra=require(_0xac4a('0xa'));var _=require(_0xac4a('0xb'));var squel=require(_0xac4a('0xc'));var crypto=require(_0xac4a('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xac4a('0x8'));var querystring=require(_0xac4a('0xe'));var Papa=require(_0xac4a('0xf'));var Redis=require('ioredis');var authService=require(_0xac4a('0x10'));var qs=require(_0xac4a('0x11'));var as=require(_0xac4a('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xac4a('0x13'))('api');var utils=require(_0xac4a('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xac4a('0x15'));var db=require(_0xac4a('0x16'))['db'];var dbH=require(_0xac4a('0x16'))['dbH'];function respondWithStatusCode(_0x21a79,_0x68424a){_0x68424a=_0x68424a||0xcc;return function(_0x247b78){if(_0x247b78){return _0x21a79[_0xac4a('0x17')](_0x68424a);}return _0x21a79[_0xac4a('0x18')](_0x68424a)[_0xac4a('0x19')]();};}function respondWithResult(_0x34bc01,_0x33c287){_0x33c287=_0x33c287||0xc8;return function(_0x190418){if(_0x190418){return _0x34bc01[_0xac4a('0x18')](_0x33c287)[_0xac4a('0x1a')](_0x190418);}};}function respondWithFilteredResult(_0x26dbb8,_0x4a2119){return function(_0x402fff){if(_0x402fff){var _0x34d797=typeof _0x4a2119[_0xac4a('0x1b')]===_0xac4a('0x1c')&&typeof _0x4a2119[_0xac4a('0x1d')]===_0xac4a('0x1c');var _0x28e304=_0x402fff[_0xac4a('0x1e')];var _0x546c5d=_0x34d797?0x0:_0x4a2119['offset'];var _0x21a729=_0x34d797?_0x402fff[_0xac4a('0x1e')]:_0x4a2119[_0xac4a('0x1b')]+_0x4a2119['limit'];var _0x39e83e;if(_0x21a729>=_0x28e304){_0x21a729=_0x28e304;_0x39e83e=0xc8;}else{_0x39e83e=0xce;}_0x26dbb8[_0xac4a('0x18')](_0x39e83e);return _0x26dbb8[_0xac4a('0x1f')](_0xac4a('0x20'),_0x546c5d+'-'+_0x21a729+'/'+_0x28e304)[_0xac4a('0x1a')](_0x402fff);}return null;};}function patchUpdates(_0x3e829c){return function(_0xe38996){try{jsonpatch[_0xac4a('0x21')](_0xe38996,_0x3e829c,!![]);}catch(_0x534092){return BPromise[_0xac4a('0x22')](_0x534092);}return _0xe38996[_0xac4a('0x23')]();};}function saveUpdates(_0x599787,_0x3d7ce0){return function(_0x4169c0){if(_0x4169c0){return _0x4169c0[_0xac4a('0x24')](_0x599787)[_0xac4a('0x25')](function(_0x4d2d6c){return _0x4d2d6c;});}return null;};}function removeEntity(_0x1b7998,_0x2503d8){return function(_0x15435c){if(_0x15435c){return _0x15435c[_0xac4a('0x26')]()[_0xac4a('0x25')](function(){var _0x2b0dc2=_0x15435c[_0xac4a('0x27')]({'plain':!![]});var _0x36054a=_0xac4a('0x28');return db[_0xac4a('0x29')][_0xac4a('0x26')]({'where':{'type':_0x36054a,'resourceId':_0x2b0dc2['id']}})[_0xac4a('0x25')](function(){return _0x15435c;});})[_0xac4a('0x25')](function(){_0x1b7998[_0xac4a('0x18')](0xcc)[_0xac4a('0x19')]();});}};}function handleEntityNotFound(_0x20202c,_0x4e17ce){return function(_0x23b061){if(!_0x23b061){_0x20202c[_0xac4a('0x17')](0x194);}return _0x23b061;};}function handleError(_0x42a33c,_0x2772fe){_0x2772fe=_0x2772fe||0x1f4;return function(_0x116700){logger['error'](_0x116700['stack']);if(_0x116700[_0xac4a('0x2a')]){delete _0x116700[_0xac4a('0x2a')];}_0x42a33c[_0xac4a('0x18')](_0x2772fe)['send'](_0x116700);};}exports['index']=function(_0x355755,_0x2896bc){var _0x228629={},_0x432066={},_0x17118e={'count':0x0,'rows':[]};var _0x53d3a5=_[_0xac4a('0x2b')](db['AnalyticDefaultReport'][_0xac4a('0x2c')],function(_0x57adcf){return{'name':_0x57adcf[_0xac4a('0x2d')],'type':_0x57adcf[_0xac4a('0x2e')][_0xac4a('0x2f')]};});_0x432066[_0xac4a('0x30')]=_[_0xac4a('0x2b')](_0x53d3a5,_0xac4a('0x2a'));_0x432066[_0xac4a('0x31')]=_[_0xac4a('0x32')](_0x355755[_0xac4a('0x31')]);_0x432066[_0xac4a('0x33')]=_[_0xac4a('0x34')](_0x432066[_0xac4a('0x30')],_0x432066[_0xac4a('0x31')]);_0x228629[_0xac4a('0x35')]=_['intersection'](_0x432066[_0xac4a('0x30')],qs[_0xac4a('0x36')](_0x355755['query'][_0xac4a('0x36')]));_0x228629[_0xac4a('0x35')]=_0x228629['attributes']['length']?_0x228629[_0xac4a('0x35')]:_0x432066[_0xac4a('0x30')];if(!_0x355755[_0xac4a('0x31')][_0xac4a('0x37')]('nolimit')){_0x228629[_0xac4a('0x1d')]=qs[_0xac4a('0x1d')](_0x355755['query'][_0xac4a('0x1d')]);_0x228629[_0xac4a('0x1b')]=qs[_0xac4a('0x1b')](_0x355755['query'][_0xac4a('0x1b')]);}_0x228629[_0xac4a('0x38')]=qs[_0xac4a('0x39')](_0x355755['query'][_0xac4a('0x39')]);_0x228629[_0xac4a('0x3a')]=qs['filters'](_['pick'](_0x355755[_0xac4a('0x31')],_0x432066['filters']),_0x53d3a5);if(_0x355755['query']['filter']){_0x228629['where']=_[_0xac4a('0x3b')](_0x228629[_0xac4a('0x3a')],{'$or':_[_0xac4a('0x2b')](_0x53d3a5,function(_0x472484){if(_0x472484[_0xac4a('0x2e')]!==_0xac4a('0x3c')){var _0x4220e2={};_0x4220e2[_0x472484[_0xac4a('0x2a')]]={'$like':'%'+_0x355755[_0xac4a('0x31')][_0xac4a('0x3d')]+'%'};return _0x4220e2;}})});}_0x228629=_[_0xac4a('0x3b')]({},_0x228629,_0x355755[_0xac4a('0x3e')]);var _0x4e4994={'where':_0x228629['where']};return db['AnalyticDefaultReport'][_0xac4a('0x1e')](_0x4e4994)[_0xac4a('0x25')](function(_0x14e80b){_0x17118e[_0xac4a('0x1e')]=_0x14e80b;if(_0x355755[_0xac4a('0x31')][_0xac4a('0x3f')]){_0x228629[_0xac4a('0x40')]=[{'all':!![]}];}return db[_0xac4a('0x41')][_0xac4a('0x42')](_0x228629);})[_0xac4a('0x25')](function(_0x561cb7){_0x17118e[_0xac4a('0x43')]=_0x561cb7;return _0x17118e;})[_0xac4a('0x25')](respondWithFilteredResult(_0x2896bc,_0x228629))[_0xac4a('0x44')](handleError(_0x2896bc,null));};exports[_0xac4a('0x45')]=function(_0x1a96cf,_0x57b879){var _0x8700b4={'raw':!![],'where':{'id':_0x1a96cf['params']['id']}},_0x1b77bb={};_0x1b77bb[_0xac4a('0x30')]=_['keys'](db[_0xac4a('0x41')][_0xac4a('0x2c')]);_0x1b77bb[_0xac4a('0x31')]=_[_0xac4a('0x32')](_0x1a96cf[_0xac4a('0x31')]);_0x1b77bb[_0xac4a('0x33')]=_[_0xac4a('0x34')](_0x1b77bb[_0xac4a('0x30')],_0x1b77bb[_0xac4a('0x31')]);_0x8700b4[_0xac4a('0x35')]=_[_0xac4a('0x34')](_0x1b77bb[_0xac4a('0x30')],qs['fields'](_0x1a96cf[_0xac4a('0x31')][_0xac4a('0x36')]));_0x8700b4[_0xac4a('0x35')]=_0x8700b4['attributes'][_0xac4a('0x46')]?_0x8700b4[_0xac4a('0x35')]:_0x1b77bb['model'];if(_0x1a96cf[_0xac4a('0x31')]['includeAll']){_0x8700b4[_0xac4a('0x40')]=[{'all':!![]}];}_0x8700b4=_[_0xac4a('0x3b')]({},_0x8700b4,_0x1a96cf[_0xac4a('0x3e')]);return db['AnalyticDefaultReport']['find'](_0x8700b4)[_0xac4a('0x25')](handleEntityNotFound(_0x57b879,null))['then'](respondWithResult(_0x57b879,null))[_0xac4a('0x44')](handleError(_0x57b879,null));};exports['create']=function(_0x3d2aaf,_0x530bbb){return db[_0xac4a('0x41')][_0xac4a('0x47')](_0x3d2aaf[_0xac4a('0x48')],{})[_0xac4a('0x25')](function(_0x54782f){var _0x31c794=_0x3d2aaf[_0xac4a('0x49')][_0xac4a('0x27')]({'plain':!![]});if(!_0x31c794)throw new Error(_0xac4a('0x4a'));if(_0x31c794[_0xac4a('0x4b')]===_0xac4a('0x49')){var _0x187306=_0x54782f['get']({'plain':!![]});var _0x35dee5=_0xac4a('0x4c');return db['UserProfileSection'][_0xac4a('0x4d')]({'where':{'name':_0x35dee5,'userProfileId':_0x31c794[_0xac4a('0x4e')]},'raw':!![]})[_0xac4a('0x25')](function(_0x3ac36e){if(_0x3ac36e&&_0x3ac36e['autoAssociation']===0x0){return db[_0xac4a('0x29')][_0xac4a('0x47')]({'name':_0x187306[_0xac4a('0x2a')],'resourceId':_0x187306['id'],'type':_0xac4a('0x28'),'sectionId':_0x3ac36e['id']},{})[_0xac4a('0x25')](function(){return _0x54782f;});}else{return _0x54782f;}})['catch'](function(_0x179373){logger['error'](_0xac4a('0x4f'),_0x179373);throw _0x179373;});}return _0x54782f;})[_0xac4a('0x25')](respondWithResult(_0x530bbb,0xc9))['catch'](handleError(_0x530bbb,null));};exports['update']=function(_0x437466,_0x70fdc3){if(_0x437466['body']['id']){delete _0x437466[_0xac4a('0x48')]['id'];}return db[_0xac4a('0x41')][_0xac4a('0x4d')]({'where':{'id':_0x437466[_0xac4a('0x50')]['id']}})['then'](handleEntityNotFound(_0x70fdc3,null))[_0xac4a('0x25')](saveUpdates(_0x437466[_0xac4a('0x48')],null))[_0xac4a('0x25')](respondWithResult(_0x70fdc3,null))[_0xac4a('0x44')](handleError(_0x70fdc3,null));};exports[_0xac4a('0x26')]=function(_0x411547,_0x36179a){return db['AnalyticDefaultReport'][_0xac4a('0x4d')]({'where':{'id':_0x411547[_0xac4a('0x50')]['id']}})[_0xac4a('0x25')](handleEntityNotFound(_0x36179a,null))[_0xac4a('0x25')](removeEntity(_0x36179a,null))[_0xac4a('0x44')](handleError(_0x36179a,null));};exports[_0xac4a('0x51')]=function(_0x213df2,_0x236f57){var _0x159e43=0xa;var _0x786d9=[_0xac4a('0x52'),_0xac4a('0x53'),_0xac4a('0x54'),_0xac4a('0x55')];var _0x5222f3={'SUM':_0xac4a('0x56'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0xac4a('0x57'),'MAX':'MAX(%s)','MIN':_0xac4a('0x58'),'AVG':'AVG(%s)','GROUP_CONCAT':_0xac4a('0x59'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0xac4a('0x5a')};var _0x5cac9b={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0xac4a('0x5b'),'HOUR':_0xac4a('0x5c'),'ROUND':_0xac4a('0x5d'),'UNIX_TIMESTAMP':_0xac4a('0x5e')};var _0x2f9940=function(_0xb7b884){return!_['includes']([_0xac4a('0x5f'),'IS\x20NOT\x20NULL',_0xac4a('0x60'),'IS\x20NOT\x20EMPTY'],_0xb7b884);};var _0x347880=function(_0x19ce2c){if(!_0x19ce2c||!_0x19ce2c[_0xac4a('0x61')][_0xac4a('0x46')]){return'';}for(var _0x429273='(',_0x2bc39a=0x0;_0x2bc39a<_0x19ce2c[_0xac4a('0x61')][_0xac4a('0x46')];_0x2bc39a+=0x1){_0x2bc39a>0x0&&(_0x429273+='\x20'+_0x19ce2c[_0xac4a('0x62')]+'\x20');_0x429273+=_0x19ce2c[_0xac4a('0x61')][_0x2bc39a][_0xac4a('0x63')]?_0x347880(_0x19ce2c[_0xac4a('0x61')][_0x2bc39a][_0xac4a('0x63')]):_0x19ce2c[_0xac4a('0x61')][_0x2bc39a][_0xac4a('0x64')]+'\x20'+_0x19ce2c[_0xac4a('0x61')][_0x2bc39a][_0xac4a('0x65')]+(_0x2f9940(_0x19ce2c['rules'][_0x2bc39a][_0xac4a('0x65')])?'\x20'+_0x19ce2c[_0xac4a('0x61')][_0x2bc39a]['value']:'');}return _0x429273+')';};var _0x3c3576={'where':{'id':_0x213df2['params']['id']}},_0x34bd1c,_0x2d24c7,_0x2b8562,_0x357cac,_0x4d1440;_0x3c3576=_[_0xac4a('0x3b')]({},_0x3c3576,_0x213df2[_0xac4a('0x3e')]);return db[_0xac4a('0x41')][_0xac4a('0x4d')](_0x3c3576)[_0xac4a('0x25')](function(_0x21ef8b){if(_0x21ef8b){_0x34bd1c=_0x21ef8b;return _0x21ef8b[_0xac4a('0x66')]();}return null;})[_0xac4a('0x25')](function(_0x44c60b){if(_0x44c60b){if(!_0x44c60b[_0xac4a('0x46')]){throw new db[(_0xac4a('0x67'))]['ValidationErrorItem']('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x2d24c7=_0x44c60b;return db[_0xac4a('0x68')][_0xac4a('0x42')]({'raw':!![]});}return null;})[_0xac4a('0x25')](function(_0x423f70){if(_0x423f70){_0x2b8562=_[_0xac4a('0x69')](_0x423f70,'id');var _0x283107;var _0x1d24bb=squel[_0xac4a('0x6a')]();_0x1d24bb[_0xac4a('0x6b')](_0x34bd1c[_0xac4a('0x6c')]);for(var _0xb09b89=0x0;_0xb09b89<_0x2d24c7[_0xac4a('0x46')];_0xb09b89+=0x1){_0x283107=_0x2d24c7[_0xb09b89]['MetricId']?_0x2b8562[_0x2d24c7[_0xb09b89][_0xac4a('0x6d')]][_0xac4a('0x6e')]:_0x2d24c7[_0xb09b89][_0xac4a('0x64')];_0x283107=_0x2d24c7[_0xb09b89][_0xac4a('0x6f')]?_['replace'](_0x5222f3[_0x2d24c7[_0xb09b89][_0xac4a('0x6f')]],'%s',_0x283107):_0x283107;_0x283107=_0x2d24c7[_0xb09b89]['format']?_[_0xac4a('0x70')](_0x5cac9b[_0x2d24c7[_0xb09b89][_0xac4a('0x71')]],'%s',_0x283107):_0x283107;if(_0x2d24c7[_0xb09b89]['groupBy']){_0x1d24bb['group'](_0x283107);}_0x2d24c7[_0xb09b89][_0xac4a('0x72')]&&_0x1d24bb[_0xac4a('0x38')](_0x283107,_0x2d24c7[_0xb09b89][_0xac4a('0x72')]==='DESC'?![]:!![]);_0x1d24bb[_0xac4a('0x64')](_0x283107,_0x2d24c7[_0xb09b89]['alias']||_0x283107);}if(_0x34bd1c[_0xac4a('0x73')]){_0x34bd1c['joins']=JSON['parse'](_0x34bd1c[_0xac4a('0x73')]);for(var _0x56ef2a=0x0;_0x56ef2a<_0x34bd1c[_0xac4a('0x73')]['length'];_0x56ef2a+=0x1){if(_0x34bd1c[_0xac4a('0x73')][_0x56ef2a][_0xac4a('0x2e')]&&_['includes'](_0x786d9,_0x34bd1c[_0xac4a('0x73')][_0x56ef2a]['type'])&&_0x34bd1c[_0xac4a('0x73')][_0x56ef2a][_0xac4a('0x74')]&&_0x34bd1c['joins'][_0x56ef2a][_0xac4a('0x75')]&&_0x34bd1c['joins'][_0x56ef2a]['foreignKey']){_0x1d24bb[_0x34bd1c[_0xac4a('0x73')][_0x56ef2a]['type']](_0x34bd1c[_0xac4a('0x73')][_0x56ef2a]['foreignTable'],null,util['format'](_0xac4a('0x76'),_0x34bd1c[_0xac4a('0x6c')],_0x34bd1c[_0xac4a('0x73')][_0x56ef2a]['parentKey'],_0x34bd1c['joins'][_0x56ef2a][_0xac4a('0x75')],_0x34bd1c[_0xac4a('0x73')][_0x56ef2a]['foreignKey']));}}}if(_0x34bd1c['conditions']){_0x34bd1c[_0xac4a('0x77')]=JSON[_0xac4a('0x78')](_0x34bd1c[_0xac4a('0x77')]);_0x1d24bb[_0xac4a('0x3a')](_0x347880(_0x34bd1c[_0xac4a('0x77')][_0xac4a('0x63')]));}_0x4d1440=_0x1d24bb[_0xac4a('0x79')]();_0x1d24bb[_0xac4a('0x1d')](_0x159e43);_0x1d24bb[_0xac4a('0x1b')](0x0);logger['debug'](_0xac4a('0x7a'),_0x1d24bb[_0xac4a('0x7b')]());return dbH[_0xac4a('0x7c')]['query'](_0x1d24bb[_0xac4a('0x7b')](),{'type':dbH[_0xac4a('0x7c')][_0xac4a('0x7d')][_0xac4a('0x7e')]});}})[_0xac4a('0x25')](respondWithResult(_0x236f57,null))['catch'](handleError(_0x236f57,null));};function runReport(_0x290a73,_0x19ce24,_0xc9d040){var _0x37e519=_0x19ce24[_0xac4a('0x2a')];var _0x451248=0xa;var _0xd7bdd6=['join',_0xac4a('0x53'),_0xac4a('0x54'),_0xac4a('0x55')];var _0x35a97c={'SUM':_0xac4a('0x56'),'COUNT':_0xac4a('0x7f'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0xac4a('0x80'),'MIN':_0xac4a('0x58'),'AVG':_0xac4a('0x81'),'GROUP_CONCAT':_0xac4a('0x59'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0xac4a('0x5a')};var _0x56a934={'SEC_TO_TIME':_0xac4a('0x82'),'DATE':_0xac4a('0x5b'),'HOUR':'HOUR(%s)','ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0xac4a('0x5e')};var _0x212a22=function(_0x1fe86a){return!_['includes']([_0xac4a('0x5f'),'IS\x20NOT\x20NULL',_0xac4a('0x60'),_0xac4a('0x83')],_0x1fe86a);};var _0x406b64=function(_0x35328e){if(!_0x35328e||!_0x35328e[_0xac4a('0x61')]['length']){return'';}for(var _0x50f471='(',_0x31cda0=0x0;_0x31cda0<_0x35328e[_0xac4a('0x61')][_0xac4a('0x46')];_0x31cda0+=0x1){_0x31cda0>0x0&&(_0x50f471+='\x20'+_0x35328e[_0xac4a('0x62')]+'\x20');_0x50f471+=_0x35328e[_0xac4a('0x61')][_0x31cda0][_0xac4a('0x63')]?_0x406b64(_0x35328e[_0xac4a('0x61')][_0x31cda0][_0xac4a('0x63')]):_0x35328e['rules'][_0x31cda0]['field']+'\x20'+_0x35328e[_0xac4a('0x61')][_0x31cda0][_0xac4a('0x65')]+(_0x212a22(_0x35328e[_0xac4a('0x61')][_0x31cda0][_0xac4a('0x65')])?'\x20'+_0x35328e[_0xac4a('0x61')][_0x31cda0][_0xac4a('0x84')]:'');}return _0x50f471+')';};var _0xdaa2ef={'where':{'id':_0x290a73['id']}},_0x2e704b,_0x540d8e,_0x5e0be4,_0x32fd0c,_0x168f30;_0xdaa2ef=_[_0xac4a('0x3b')]({},_0xdaa2ef,_0xc9d040);return db[_0xac4a('0x41')][_0xac4a('0x4d')](_0xdaa2ef)[_0xac4a('0x25')](function(_0x338af3){if(_0x338af3){_0x2e704b=_0x338af3;return _0x338af3['getFields']();}return null;})[_0xac4a('0x25')](function(_0x1bacf2){if(_0x1bacf2){if(!_0x1bacf2[_0xac4a('0x46')]){throw new db['Sequelize'][(_0xac4a('0x85'))](_0xac4a('0x86'),0x193);}_0x540d8e=_0x1bacf2;return db[_0xac4a('0x68')][_0xac4a('0x42')]({'raw':!![]});}return null;})[_0xac4a('0x25')](function(_0x27d023){if(_0x27d023){_0x5e0be4=_[_0xac4a('0x69')](_0x27d023,'id');var _0x2ef42a;var _0x322465=squel['select']();_0x322465[_0xac4a('0x6b')](_0x2e704b['table']);for(var _0x203321=0x0;_0x203321<_0x540d8e[_0xac4a('0x46')];_0x203321+=0x1){_0x2ef42a=_0x540d8e[_0x203321][_0xac4a('0x6d')]?_0x5e0be4[_0x540d8e[_0x203321][_0xac4a('0x6d')]][_0xac4a('0x6e')]:_0x540d8e[_0x203321][_0xac4a('0x64')];_0x2ef42a=_0x540d8e[_0x203321][_0xac4a('0x6f')]?_['replace'](_0x35a97c[_0x540d8e[_0x203321][_0xac4a('0x6f')]],'%s',_0x2ef42a):_0x2ef42a;_0x2ef42a=_0x540d8e[_0x203321][_0xac4a('0x71')]?_[_0xac4a('0x70')](_0x56a934[_0x540d8e[_0x203321][_0xac4a('0x71')]],'%s',_0x2ef42a):_0x2ef42a;if(_0x540d8e[_0x203321][_0xac4a('0x87')]){_0x322465['group'](_0x2ef42a);}_0x540d8e[_0x203321][_0xac4a('0x72')]&&_0x322465[_0xac4a('0x38')](_0x2ef42a,_0x540d8e[_0x203321]['orderBy']==='DESC'?![]:!![]);_0x322465[_0xac4a('0x64')](_0x2ef42a,_0x540d8e[_0x203321][_0xac4a('0x88')]||_0x2ef42a);}if(_0x2e704b['joins']){_0x2e704b[_0xac4a('0x73')]=JSON[_0xac4a('0x78')](_0x2e704b[_0xac4a('0x73')]);for(var _0x37657e=0x0;_0x37657e<_0x2e704b[_0xac4a('0x73')][_0xac4a('0x46')];_0x37657e+=0x1){if(_0x2e704b['joins'][_0x37657e][_0xac4a('0x2e')]&&_[_0xac4a('0x89')](_0xd7bdd6,_0x2e704b[_0xac4a('0x73')][_0x37657e]['type'])&&_0x2e704b[_0xac4a('0x73')][_0x37657e][_0xac4a('0x74')]&&_0x2e704b[_0xac4a('0x73')][_0x37657e][_0xac4a('0x75')]&&_0x2e704b[_0xac4a('0x73')][_0x37657e][_0xac4a('0x8a')]){_0x322465[_0x2e704b['joins'][_0x37657e][_0xac4a('0x2e')]](_0x2e704b[_0xac4a('0x73')][_0x37657e]['foreignTable'],null,util[_0xac4a('0x71')]('%s.%s\x20=\x20%s.%s',_0x2e704b[_0xac4a('0x6c')],_0x2e704b[_0xac4a('0x73')][_0x37657e]['parentKey'],_0x2e704b[_0xac4a('0x73')][_0x37657e]['foreignTable'],_0x2e704b[_0xac4a('0x73')][_0x37657e]['foreignKey']));}}}if(_0x2e704b[_0xac4a('0x77')]){_0x2e704b[_0xac4a('0x77')]=JSON[_0xac4a('0x78')](_0x2e704b[_0xac4a('0x77')]);_0x322465[_0xac4a('0x3a')](_0x406b64(_0x2e704b[_0xac4a('0x77')][_0xac4a('0x63')]));}_0x168f30=_0x322465[_0xac4a('0x79')]();_0x322465[_0xac4a('0x1d')](_0x451248);_0x322465[_0xac4a('0x1b')](0x0);return;}})[_0xac4a('0x25')](function(){if(_0x19ce24[_0xac4a('0x8b')]===_0xac4a('0x8c')){return null;}var _0x4217df=_['merge'](_0x19ce24,{'name':_0x19ce24[_0xac4a('0x8d')]||_0x19ce24[_0xac4a('0x2a')]||_0x2e704b['name'],'basename':_0x37e519,'savename':util[_0xac4a('0x71')](_0xac4a('0x8e'),_0x19ce24[_0xac4a('0x2a')]||_0x2e704b[_0xac4a('0x2a')],require(_0xac4a('0x8f'))['generate'](0x4),_0x19ce24[_0xac4a('0x8b')]||'csv'),'reportId':_0x2e704b['id'],'reportType':_0xac4a('0x90')});return db[_0xac4a('0x91')][_0xac4a('0x47')](_0x4217df,{'raw':!![]});})[_0xac4a('0x25')](function(_0x53f23d){if(_0x2e704b[_0xac4a('0x6c')]==='cdr'){_0x168f30[_0xac4a('0x3a')](_0x2e704b[_0xac4a('0x6c')]+_0xac4a('0x92'),_0x19ce24['startDate'],_0x19ce24[_0xac4a('0x93')]);}else{_0x168f30[_0xac4a('0x3a')](_0x2e704b[_0xac4a('0x6c')]+'.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x19ce24[_0xac4a('0x94')],_0x19ce24[_0xac4a('0x93')]);}if(_0x53f23d){logger[_0xac4a('0x95')](_0xac4a('0x96'),_0x168f30[_0xac4a('0x7b')]());require(_0xac4a('0x97'))[_0xac4a('0x98')](path[_0xac4a('0x52')](__dirname,'../../components/export/',_0x53f23d[_0xac4a('0x8b')]),[_0x53f23d['id'],_0x168f30['toString'](),path['join'](__dirname,'../../files/reports',_0x53f23d['savename']),_0x37e519]);return _0x53f23d;}else{var _0x502275=squel[_0xac4a('0x6a')]();_0x502275[_0xac4a('0x6b')]('('+_0x168f30[_0xac4a('0x7b')]()+')',_0xac4a('0x99'));_0x502275[_0xac4a('0x64')]('COUNT(*)',_0xac4a('0x1e'));_0x168f30[_0xac4a('0x1d')](_0x19ce24[_0xac4a('0x1d')]||_0x451248);_0x168f30[_0xac4a('0x1b')](_0x19ce24[_0xac4a('0x1b')]||0x0);return dbH[_0xac4a('0x7c')][_0xac4a('0x31')](_0x502275[_0xac4a('0x7b')](),{'type':dbH['sequelize'][_0xac4a('0x7d')][_0xac4a('0x7e')]})[_0xac4a('0x25')](function(_0x25331f){if(!_0x25331f[_0xac4a('0x46')]){_0x32fd0c=0x0;}else{_0x32fd0c=_0x25331f[0x0][_0xac4a('0x1e')]||0x0;}return dbH[_0xac4a('0x7c')]['query'](_0x168f30['toString'](),{'type':dbH[_0xac4a('0x7c')][_0xac4a('0x7d')]['SELECT']});})[_0xac4a('0x25')](function(_0x366f5a){return{'rows':_0x366f5a||[],'count':_0x32fd0c};});}});}exports['run']=function(_0x5bd013,_0x2fe103){return runReport(_0x5bd013[_0xac4a('0x50')],_0x5bd013[_0xac4a('0x31')],_0x5bd013[_0xac4a('0x3e')])[_0xac4a('0x25')](respondWithResult(_0x2fe103,null))['catch'](handleError(_0x2fe103,null));};exports[_0xac4a('0x9a')]=runReport;exports['query']=function(_0x4f2d85,_0x538cfd){var _0x63c30=0xa;var _0x4301c3=[_0xac4a('0x52'),_0xac4a('0x53'),_0xac4a('0x54'),_0xac4a('0x55')];var _0xcad25d={'SUM':_0xac4a('0x56'),'COUNT':'COUNT(%s)','COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':'MAX(%s)','MIN':_0xac4a('0x58'),'AVG':_0xac4a('0x81'),'GROUP_CONCAT':_0xac4a('0x59'),'GROUP_CONCAT ASC':_0xac4a('0x9b'),'GROUP_CONCAT DESC':_0xac4a('0x5a')};var _0xcd140e={'SEC_TO_TIME':_0xac4a('0x82'),'DATE':_0xac4a('0x5b'),'HOUR':_0xac4a('0x5c'),'ROUND':_0xac4a('0x5d'),'UNIX_TIMESTAMP':_0xac4a('0x5e')};var _0x37cb49=function(_0xe0fd57){return!_[_0xac4a('0x89')]([_0xac4a('0x5f'),_0xac4a('0x9c'),_0xac4a('0x60'),_0xac4a('0x83')],_0xe0fd57);};var _0x41cdb5=function(_0x172d03){if(!_0x172d03||!_0x172d03[_0xac4a('0x61')][_0xac4a('0x46')]){return'';}for(var _0x3e2575='(',_0x4cc581=0x0;_0x4cc581<_0x172d03[_0xac4a('0x61')][_0xac4a('0x46')];_0x4cc581+=0x1){_0x4cc581>0x0&&(_0x3e2575+='\x20'+_0x172d03[_0xac4a('0x62')]+'\x20');_0x3e2575+=_0x172d03[_0xac4a('0x61')][_0x4cc581][_0xac4a('0x63')]?_0x41cdb5(_0x172d03[_0xac4a('0x61')][_0x4cc581][_0xac4a('0x63')]):_0x172d03[_0xac4a('0x61')][_0x4cc581]['field']+'\x20'+_0x172d03['rules'][_0x4cc581][_0xac4a('0x65')]+(_0x37cb49(_0x172d03[_0xac4a('0x61')][_0x4cc581][_0xac4a('0x65')])?'\x20'+_0x172d03['rules'][_0x4cc581]['value']:'');}return _0x3e2575+')';};var _0x5de198={'where':{'id':_0x4f2d85[_0xac4a('0x50')]['id']}},_0x2b6773,_0x52df82,_0x59e82c,_0x216055,_0x52963c;_0x5de198=_['merge']({},_0x5de198,_0x4f2d85[_0xac4a('0x3e')]);return db[_0xac4a('0x41')][_0xac4a('0x4d')](_0x5de198)[_0xac4a('0x25')](function(_0x403a16){if(_0x403a16){_0x2b6773=_0x403a16;return _0x403a16[_0xac4a('0x66')]();}return null;})['then'](function(_0x25bf23){if(_0x25bf23){if(!_0x25bf23[_0xac4a('0x46')]){throw new db[(_0xac4a('0x67'))]['ValidationErrorItem'](_0xac4a('0x86'),0x193);}_0x52df82=_0x25bf23;return db[_0xac4a('0x68')][_0xac4a('0x42')]({'raw':!![]});}return null;})[_0xac4a('0x25')](function(_0x5bb911){if(_0x5bb911){_0x59e82c=_[_0xac4a('0x69')](_0x5bb911,'id');var _0x403f5a;var _0x3eae2f=squel[_0xac4a('0x6a')]();_0x3eae2f[_0xac4a('0x6b')](_0x2b6773[_0xac4a('0x6c')]);for(var _0x4a0cd9=0x0;_0x4a0cd9<_0x52df82['length'];_0x4a0cd9+=0x1){_0x403f5a=_0x52df82[_0x4a0cd9][_0xac4a('0x6d')]?_0x59e82c[_0x52df82[_0x4a0cd9][_0xac4a('0x6d')]][_0xac4a('0x6e')]:_0x52df82[_0x4a0cd9][_0xac4a('0x64')];_0x403f5a=_0x52df82[_0x4a0cd9][_0xac4a('0x6f')]?_[_0xac4a('0x70')](_0xcad25d[_0x52df82[_0x4a0cd9]['function']],'%s',_0x403f5a):_0x403f5a;_0x403f5a=_0x52df82[_0x4a0cd9][_0xac4a('0x71')]?_['replace'](_0xcd140e[_0x52df82[_0x4a0cd9][_0xac4a('0x71')]],'%s',_0x403f5a):_0x403f5a;if(_0x52df82[_0x4a0cd9]['groupBy']){_0x3eae2f[_0xac4a('0x63')](_0x403f5a);}_0x52df82[_0x4a0cd9][_0xac4a('0x72')]&&_0x3eae2f[_0xac4a('0x38')](_0x403f5a,_0x52df82[_0x4a0cd9][_0xac4a('0x72')]==='DESC'?![]:!![]);_0x3eae2f[_0xac4a('0x64')](_0x403f5a,_0x52df82[_0x4a0cd9][_0xac4a('0x88')]||_0x403f5a);}if(_0x2b6773[_0xac4a('0x73')]){_0x2b6773[_0xac4a('0x73')]=JSON[_0xac4a('0x78')](_0x2b6773['joins']);for(var _0x3dd60a=0x0;_0x3dd60a<_0x2b6773[_0xac4a('0x73')][_0xac4a('0x46')];_0x3dd60a+=0x1){if(_0x2b6773[_0xac4a('0x73')][_0x3dd60a][_0xac4a('0x2e')]&&_['includes'](_0x4301c3,_0x2b6773[_0xac4a('0x73')][_0x3dd60a][_0xac4a('0x2e')])&&_0x2b6773[_0xac4a('0x73')][_0x3dd60a][_0xac4a('0x74')]&&_0x2b6773[_0xac4a('0x73')][_0x3dd60a]['foreignTable']&&_0x2b6773['joins'][_0x3dd60a]['foreignKey']){_0x3eae2f[_0x2b6773['joins'][_0x3dd60a][_0xac4a('0x2e')]](_0x2b6773[_0xac4a('0x73')][_0x3dd60a][_0xac4a('0x75')],null,util[_0xac4a('0x71')](_0xac4a('0x76'),_0x2b6773['table'],_0x2b6773[_0xac4a('0x73')][_0x3dd60a][_0xac4a('0x74')],_0x2b6773['joins'][_0x3dd60a][_0xac4a('0x75')],_0x2b6773[_0xac4a('0x73')][_0x3dd60a][_0xac4a('0x8a')]));}}}if(_0x2b6773['conditions']){_0x2b6773[_0xac4a('0x77')]=JSON[_0xac4a('0x78')](_0x2b6773[_0xac4a('0x77')]);_0x3eae2f[_0xac4a('0x3a')](_0x41cdb5(_0x2b6773[_0xac4a('0x77')][_0xac4a('0x63')]));}_0x52963c=_0x3eae2f[_0xac4a('0x79')]();_0x3eae2f[_0xac4a('0x1d')](_0x63c30);_0x3eae2f[_0xac4a('0x1b')](0x0);logger['debug'](_0xac4a('0x7a'),_0x3eae2f[_0xac4a('0x7b')]());return dbH['sequelize'][_0xac4a('0x31')](_0x3eae2f['toString'](),{'type':dbH[_0xac4a('0x7c')][_0xac4a('0x7d')]['SELECT']});}})[_0xac4a('0x25')](function(){return{'sql':_0x52963c[_0xac4a('0x7b')]()};})[_0xac4a('0x25')](respondWithResult(_0x538cfd,null))[_0xac4a('0x44')](handleError(_0x538cfd,null));}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.model.js b/server/api/analyticDefaultReport/analyticDefaultReport.model.js index ffdc097..efea234 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 _0x1d59=['api','moment','bluebird','../../config/environment','./analyticDefaultReport.attributes','define','lodash','util','../../config/logger'];(function(_0x52d8f3,_0x284575){var _0xc93307=function(_0x44844e){while(--_0x44844e){_0x52d8f3['push'](_0x52d8f3['shift']());}};_0xc93307(++_0x284575);}(_0x1d59,0x165));var _0x91d5=function(_0x273750,_0x1c7e8b){_0x273750=_0x273750-0x0;var _0x1b1524=_0x1d59[_0x273750];return _0x1b1524;};'use strict';var _=require(_0x91d5('0x0'));var util=require(_0x91d5('0x1'));var logger=require(_0x91d5('0x2'))(_0x91d5('0x3'));var moment=require(_0x91d5('0x4'));var BPromise=require(_0x91d5('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x91d5('0x6'));var attributes=require(_0x91d5('0x7'));module['exports']=function(_0x5edf84,_0x111387){return _0x5edf84[_0x91d5('0x8')]('AnalyticDefaultReport',attributes,{'tableName':'analytics_default_reports','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x21b0=['bluebird','request-promise','path','rimraf','../../config/environment','./analyticDefaultReport.attributes','define','AnalyticDefaultReport','analytics_default_reports','lodash','util','../../config/logger','api','moment'];(function(_0x1ab5b5,_0x582f1b){var _0x53fafa=function(_0x44e1ff){while(--_0x44e1ff){_0x1ab5b5['push'](_0x1ab5b5['shift']());}};_0x53fafa(++_0x582f1b);}(_0x21b0,0x183));var _0x021b=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x21b0[_0x4565bf];return _0x5610ba;};'use strict';var _=require(_0x021b('0x0'));var util=require(_0x021b('0x1'));var logger=require(_0x021b('0x2'))(_0x021b('0x3'));var moment=require(_0x021b('0x4'));var BPromise=require(_0x021b('0x5'));var rp=require(_0x021b('0x6'));var fs=require('fs');var path=require(_0x021b('0x7'));var rimraf=require(_0x021b('0x8'));var config=require(_0x021b('0x9'));var attributes=require(_0x021b('0xa'));module['exports']=function(_0x216e92,_0x4cb36c){return _0x216e92[_0x021b('0xb')](_0x021b('0xc'),attributes,{'tableName':_0x021b('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 28a4ca9..94abff7 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 _0xc708=['bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','http','then','info','AnalyticDefaultReport,\x20%s,\x20%s','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','lodash','util','moment'];(function(_0x393436,_0x2100f4){var _0x1a54a4=function(_0x2318f3){while(--_0x2318f3){_0x393436['push'](_0x393436['shift']());}};_0x1a54a4(++_0x2100f4);}(_0xc708,0xbb));var _0x8c70=function(_0x1a0ef3,_0x535bbf){_0x1a0ef3=_0x1a0ef3-0x0;var _0x2b86da=_0xc708[_0x1a0ef3];return _0x2b86da;};'use strict';var _=require(_0x8c70('0x0'));var util=require(_0x8c70('0x1'));var moment=require(_0x8c70('0x2'));var BPromise=require(_0x8c70('0x3'));var rs=require(_0x8c70('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x8c70('0x5'));var logger=require(_0x8c70('0x6'))(_0x8c70('0x7'));var config=require(_0x8c70('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x8c70('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x129b1d,_0x316bef,_0x314cb6){return new BPromise(function(_0x4da848,_0x44de48){return client['request'](_0x129b1d,_0x314cb6)[_0x8c70('0xa')](function(_0x14a523){logger[_0x8c70('0xb')](_0x8c70('0xc'),_0x316bef,'request\x20sent');logger['debug'](_0x8c70('0xd'),_0x316bef,_0x8c70('0xe'),JSON[_0x8c70('0xf')](_0x14a523));if(_0x14a523[_0x8c70('0x10')]){if(_0x14a523['error']['code']===0x1f4){logger['error']('AnalyticDefaultReport,\x20%s,\x20%s',_0x316bef,_0x14a523[_0x8c70('0x10')][_0x8c70('0x11')]);return _0x44de48(_0x14a523[_0x8c70('0x10')][_0x8c70('0x11')]);}logger[_0x8c70('0x10')](_0x8c70('0xc'),_0x316bef,_0x14a523['error'][_0x8c70('0x11')]);return _0x4da848(_0x14a523[_0x8c70('0x10')][_0x8c70('0x11')]);}else{logger[_0x8c70('0xb')](_0x8c70('0xc'),_0x316bef,_0x8c70('0xe'));_0x4da848(_0x14a523[_0x8c70('0x12')][_0x8c70('0x11')]);}})['catch'](function(_0x10026a){logger[_0x8c70('0x10')](_0x8c70('0xc'),_0x316bef,_0x10026a);_0x44de48(_0x10026a);});});} \ No newline at end of file +var _0x44ba=['request','then','info','AnalyticDefaultReport,\x20%s,\x20%s','debug','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http'];(function(_0x618414,_0x1a7a60){var _0x21c19a=function(_0x507b17){while(--_0x507b17){_0x618414['push'](_0x618414['shift']());}};_0x21c19a(++_0x1a7a60);}(_0x44ba,0x1b6));var _0xa44b=function(_0x2e2eab,_0x2e609a){_0x2e2eab=_0x2e2eab-0x0;var _0x2357bc=_0x44ba[_0x2e2eab];return _0x2357bc;};'use strict';var _=require(_0xa44b('0x0'));var util=require(_0xa44b('0x1'));var moment=require(_0xa44b('0x2'));var BPromise=require('bluebird');var rs=require(_0xa44b('0x3'));var fs=require('fs');var Redis=require(_0xa44b('0x4'));var db=require(_0xa44b('0x5'))['db'];var utils=require(_0xa44b('0x6'));var logger=require(_0xa44b('0x7'))(_0xa44b('0x8'));var config=require(_0xa44b('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xa44b('0xa')][_0xa44b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x218a5d,_0x1c7589,_0x2244b0){return new BPromise(function(_0x594017,_0x3d048a){return client[_0xa44b('0xc')](_0x218a5d,_0x2244b0)[_0xa44b('0xd')](function(_0x28cc8e){logger[_0xa44b('0xe')](_0xa44b('0xf'),_0x1c7589,'request\x20sent');logger[_0xa44b('0x10')](_0xa44b('0x11'),_0x1c7589,_0xa44b('0x12'),JSON[_0xa44b('0x13')](_0x28cc8e));if(_0x28cc8e[_0xa44b('0x14')]){if(_0x28cc8e['error'][_0xa44b('0x15')]===0x1f4){logger[_0xa44b('0x14')](_0xa44b('0xf'),_0x1c7589,_0x28cc8e[_0xa44b('0x14')]['message']);return _0x3d048a(_0x28cc8e['error'][_0xa44b('0x16')]);}logger[_0xa44b('0x14')](_0xa44b('0xf'),_0x1c7589,_0x28cc8e[_0xa44b('0x14')][_0xa44b('0x16')]);return _0x594017(_0x28cc8e[_0xa44b('0x14')][_0xa44b('0x16')]);}else{logger[_0xa44b('0xe')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x1c7589,_0xa44b('0x12'));_0x594017(_0x28cc8e[_0xa44b('0x17')][_0xa44b('0x16')]);}})[_0xa44b('0x18')](function(_0x41897c){logger['error'](_0xa44b('0xf'),_0x1c7589,_0x41897c);_0x3d048a(_0x41897c);});});} \ No newline at end of file diff --git a/server/api/analyticDefaultReport/index.js b/server/api/analyticDefaultReport/index.js index 1ab0ea4..6923dcf 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 _0xc59f=['/:id/query','query','post','put','update','delete','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','get','isAuthenticated','/:id','show','/:id/preview','preview','/:id/run','run'];(function(_0x3b7962,_0x49f772){var _0x3c42a1=function(_0x8369eb){while(--_0x8369eb){_0x3b7962['push'](_0x3b7962['shift']());}};_0x3c42a1(++_0x49f772);}(_0xc59f,0xe3));var _0xfc59=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc59f[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require(_0xfc59('0x0'));var path=require(_0xfc59('0x1'));var timeout=require(_0xfc59('0x2'));var express=require(_0xfc59('0x3'));var router=express[_0xfc59('0x4')]();var fs_extra=require(_0xfc59('0x5'));var auth=require(_0xfc59('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./analyticDefaultReport.controller');router[_0xfc59('0x7')]('/',auth[_0xfc59('0x8')](),controller['index']);router[_0xfc59('0x7')](_0xfc59('0x9'),auth[_0xfc59('0x8')](),controller[_0xfc59('0xa')]);router['get'](_0xfc59('0xb'),auth['isAuthenticated'](),controller[_0xfc59('0xc')]);router['get'](_0xfc59('0xd'),auth[_0xfc59('0x8')](),controller[_0xfc59('0xe')]);router[_0xfc59('0x7')](_0xfc59('0xf'),auth[_0xfc59('0x8')](),controller[_0xfc59('0x10')]);router[_0xfc59('0x11')]('/',auth[_0xfc59('0x8')](),controller['create']);router[_0xfc59('0x12')](_0xfc59('0x9'),auth[_0xfc59('0x8')](),controller[_0xfc59('0x13')]);router[_0xfc59('0x14')](_0xfc59('0x9'),auth[_0xfc59('0x8')](),controller['destroy']);module[_0xfc59('0x15')]=router; \ No newline at end of file +var _0xcc8d=['get','isAuthenticated','/:id','run','/:id/query','query','post','create','put','update','destroy','exports','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xcc8d,0xfc));var _0xdcc8=function(_0x8abd64,_0x539570){_0x8abd64=_0x8abd64-0x0;var _0xd2511e=_0xcc8d[_0x8abd64];return _0xd2511e;};'use strict';var multer=require(_0xdcc8('0x0'));var util=require(_0xdcc8('0x1'));var path=require('path');var timeout=require(_0xdcc8('0x2'));var express=require('express');var router=express[_0xdcc8('0x3')]();var fs_extra=require(_0xdcc8('0x4'));var auth=require(_0xdcc8('0x5'));var interaction=require(_0xdcc8('0x6'));var config=require(_0xdcc8('0x7'));var controller=require('./analyticDefaultReport.controller');router[_0xdcc8('0x8')]('/',auth[_0xdcc8('0x9')](),controller['index']);router[_0xdcc8('0x8')](_0xdcc8('0xa'),auth[_0xdcc8('0x9')](),controller['show']);router[_0xdcc8('0x8')]('/:id/preview',auth['isAuthenticated'](),controller['preview']);router['get']('/:id/run',auth[_0xdcc8('0x9')](),controller[_0xdcc8('0xb')]);router[_0xdcc8('0x8')](_0xdcc8('0xc'),auth[_0xdcc8('0x9')](),controller[_0xdcc8('0xd')]);router[_0xdcc8('0xe')]('/',auth[_0xdcc8('0x9')](),controller[_0xdcc8('0xf')]);router[_0xdcc8('0x10')](_0xdcc8('0xa'),auth[_0xdcc8('0x9')](),controller[_0xdcc8('0x11')]);router['delete'](_0xdcc8('0xa'),auth[_0xdcc8('0x9')](),controller[_0xdcc8('0x12')]);module[_0xdcc8('0x13')]=router; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js b/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js index 7a14a22..a05fb1d 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 _0xaee3=['Loading','manual','scheduled','INTEGER','sequelize','moment','exports','STRING','ENUM','pdf','csv','DATE'];(function(_0x25609f,_0x2569de){var _0x1dfc22=function(_0x3eae32){while(--_0x3eae32){_0x25609f['push'](_0x25609f['shift']());}};_0x1dfc22(++_0x2569de);}(_0xaee3,0x88));var _0x3aee=function(_0x430459,_0x58519c){_0x430459=_0x430459-0x0;var _0x3a2439=_0xaee3[_0x430459];return _0x3a2439;};'use strict';var Sequelize=require(_0x3aee('0x0'));var moment=require(_0x3aee('0x1'));module[_0x3aee('0x2')]={'name':{'type':Sequelize[_0x3aee('0x3')],'allowNull':![]},'basename':{'type':Sequelize[_0x3aee('0x3')],'allowNull':![]},'output':{'type':Sequelize[_0x3aee('0x4')]('csv',_0x3aee('0x5'),'xlsx'),'allowNull':![],'defaultValue':_0x3aee('0x6')},'savename':{'type':Sequelize[_0x3aee('0x3')],'allowNull':![]},'startDate':{'type':Sequelize[_0x3aee('0x7')]},'endDate':{'type':Sequelize['DATE']},'status':{'type':Sequelize[_0x3aee('0x3')],'defaultValue':_0x3aee('0x8')},'type':{'type':Sequelize[_0x3aee('0x4')](_0x3aee('0x9'),_0x3aee('0xa')),'allowNull':![],'defaultValue':_0x3aee('0x9')},'reportId':{'type':Sequelize[_0x3aee('0xb')](0xb)['UNSIGNED']},'reportType':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xc785=['manual','sequelize','exports','STRING','csv','pdf','Loading','ENUM'];(function(_0x59397f,_0x297dd5){var _0x3b6829=function(_0x4d8d42){while(--_0x4d8d42){_0x59397f['push'](_0x59397f['shift']());}};_0x3b6829(++_0x297dd5);}(_0xc785,0x161));var _0x5c78=function(_0x4e4e4f,_0x54d91b){_0x4e4e4f=_0x4e4e4f-0x0;var _0xb4f281=_0xc785[_0x4e4e4f];return _0xb4f281;};'use strict';var Sequelize=require(_0x5c78('0x0'));var moment=require('moment');module[_0x5c78('0x1')]={'name':{'type':Sequelize[_0x5c78('0x2')],'allowNull':![]},'basename':{'type':Sequelize['STRING'],'allowNull':![]},'output':{'type':Sequelize['ENUM'](_0x5c78('0x3'),_0x5c78('0x4'),'xlsx'),'allowNull':![],'defaultValue':_0x5c78('0x3')},'savename':{'type':Sequelize[_0x5c78('0x2')],'allowNull':![]},'startDate':{'type':Sequelize['DATE']},'endDate':{'type':Sequelize['DATE']},'status':{'type':Sequelize[_0x5c78('0x2')],'defaultValue':_0x5c78('0x5')},'type':{'type':Sequelize[_0x5c78('0x6')](_0x5c78('0x7'),'scheduled'),'allowNull':![],'defaultValue':'manual'},'reportId':{'type':Sequelize['INTEGER'](0xb)['UNSIGNED']},'reportType':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.controller.js b/server/api/analyticExtractedReport/analyticExtractedReport.controller.js index d5c0908..e084797 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 _0x4768=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','count','limit','Content-Range','update','then','destroy','get','UserProfileResource','error','send','map','AnalyticExtractedReport','rawAttributes','fieldName','type','model','name','keys','filters','intersection','query','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','rows','catch','params','length','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','ExtractedReports','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','download','basename','savename','output','existsSync','join','root','server/files/reports','Sequelize','ValidationError','Report\x20not\x20found\x20or\x20empty','exists','format','%s.%s','toLowerCase','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service'];(function(_0x40bdbc,_0x3fabcd){var _0xc603a8=function(_0x17c0e6){while(--_0x17c0e6){_0x40bdbc['push'](_0x40bdbc['shift']());}};_0xc603a8(++_0x3fabcd);}(_0x4768,0xa8));var _0x8476=function(_0x5855e,_0x18d7a3){_0x5855e=_0x5855e-0x0;var _0x58276c=_0x4768[_0x5855e];return _0x58276c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8476('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8476('0x1'));var rp=require(_0x8476('0x2'));var moment=require(_0x8476('0x3'));var BPromise=require(_0x8476('0x4'));var Mustache=require('mustache');var util=require(_0x8476('0x5'));var path=require(_0x8476('0x6'));var sox=require('sox');var csv=require(_0x8476('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x8476('0x8'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x8476('0x9'));var toCsv=require('to-csv');var querystring=require(_0x8476('0xa'));var Papa=require(_0x8476('0xb'));var Redis=require(_0x8476('0xc'));var authService=require(_0x8476('0xd'));var qs=require(_0x8476('0xe'));var as=require(_0x8476('0xf'));var hardwareService=require(_0x8476('0x10'));var logger=require('../../config/logger')(_0x8476('0x11'));var utils=require(_0x8476('0x12'));var config=require(_0x8476('0x13'));var licenseUtil=require(_0x8476('0x14'));var db=require(_0x8476('0x15'))['db'];function respondWithStatusCode(_0x1d1f45,_0x86d59e){_0x86d59e=_0x86d59e||0xcc;return function(_0x213ba2){if(_0x213ba2){return _0x1d1f45[_0x8476('0x16')](_0x86d59e);}return _0x1d1f45['status'](_0x86d59e)[_0x8476('0x17')]();};}function respondWithResult(_0x5794f0,_0x3a0095){_0x3a0095=_0x3a0095||0xc8;return function(_0x39eaf6){if(_0x39eaf6){return _0x5794f0[_0x8476('0x18')](_0x3a0095)[_0x8476('0x19')](_0x39eaf6);}};}function respondWithFilteredResult(_0x459c2d,_0x41f0ac){return function(_0x147987){if(_0x147987){var _0xafb7e4=typeof _0x41f0ac[_0x8476('0x1a')]==='undefined'&&typeof _0x41f0ac['limit']==='undefined';var _0x5e1f32=_0x147987[_0x8476('0x1b')];var _0x126a4b=_0xafb7e4?0x0:_0x41f0ac[_0x8476('0x1a')];var _0x2794bd=_0xafb7e4?_0x147987[_0x8476('0x1b')]:_0x41f0ac[_0x8476('0x1a')]+_0x41f0ac[_0x8476('0x1c')];var _0xa892ba;if(_0x2794bd>=_0x5e1f32){_0x2794bd=_0x5e1f32;_0xa892ba=0xc8;}else{_0xa892ba=0xce;}_0x459c2d['status'](_0xa892ba);return _0x459c2d['set'](_0x8476('0x1d'),_0x126a4b+'-'+_0x2794bd+'/'+_0x5e1f32)[_0x8476('0x19')](_0x147987);}return null;};}function patchUpdates(_0x268b01){return function(_0x415cb1){try{jsonpatch['apply'](_0x415cb1,_0x268b01,!![]);}catch(_0x2b09d9){return BPromise['reject'](_0x2b09d9);}return _0x415cb1['save']();};}function saveUpdates(_0x5bca7f,_0x486a83){return function(_0x13ab74){if(_0x13ab74){return _0x13ab74[_0x8476('0x1e')](_0x5bca7f)[_0x8476('0x1f')](function(_0x253e38){return _0x253e38;});}return null;};}function removeEntity(_0x3649c8,_0x34059c){return function(_0x195e02){if(_0x195e02){return _0x195e02[_0x8476('0x20')]()[_0x8476('0x1f')](function(){var _0x742bc4=_0x195e02[_0x8476('0x21')]({'plain':!![]});var _0x1d67a7='ExtractedReports';return db[_0x8476('0x22')][_0x8476('0x20')]({'where':{'type':_0x1d67a7,'resourceId':_0x742bc4['id']}})[_0x8476('0x1f')](function(){return _0x195e02;});})[_0x8476('0x1f')](function(){_0x3649c8[_0x8476('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x21362d,_0x5792ac){return function(_0x57f052){if(!_0x57f052){_0x21362d[_0x8476('0x16')](0x194);}return _0x57f052;};}function handleError(_0x5a4016,_0x2b512f){_0x2b512f=_0x2b512f||0x1f4;return function(_0x41c15a){logger[_0x8476('0x23')](_0x41c15a['stack']);if(_0x41c15a['name']){delete _0x41c15a['name'];}_0x5a4016[_0x8476('0x18')](_0x2b512f)[_0x8476('0x24')](_0x41c15a);};}exports['index']=function(_0x51e75e,_0x2aa341){var _0x40c430={},_0x454351={},_0x210ab4={'count':0x0,'rows':[]};var _0x4cedf4=_[_0x8476('0x25')](db[_0x8476('0x26')][_0x8476('0x27')],function(_0x34ef21){return{'name':_0x34ef21[_0x8476('0x28')],'type':_0x34ef21[_0x8476('0x29')]['key']};});_0x454351[_0x8476('0x2a')]=_[_0x8476('0x25')](_0x4cedf4,_0x8476('0x2b'));_0x454351['query']=_[_0x8476('0x2c')](_0x51e75e['query']);_0x454351[_0x8476('0x2d')]=_[_0x8476('0x2e')](_0x454351[_0x8476('0x2a')],_0x454351[_0x8476('0x2f')]);_0x40c430['attributes']=_[_0x8476('0x2e')](_0x454351[_0x8476('0x2a')],qs[_0x8476('0x30')](_0x51e75e['query'][_0x8476('0x30')]));_0x40c430[_0x8476('0x31')]=_0x40c430[_0x8476('0x31')]['length']?_0x40c430['attributes']:_0x454351[_0x8476('0x2a')];if(!_0x51e75e[_0x8476('0x2f')][_0x8476('0x32')](_0x8476('0x33'))){_0x40c430[_0x8476('0x1c')]=qs['limit'](_0x51e75e[_0x8476('0x2f')][_0x8476('0x1c')]);_0x40c430[_0x8476('0x1a')]=qs[_0x8476('0x1a')](_0x51e75e[_0x8476('0x2f')]['offset']);}_0x40c430[_0x8476('0x34')]=qs['sort'](_0x51e75e[_0x8476('0x2f')][_0x8476('0x35')]);_0x40c430[_0x8476('0x36')]=qs[_0x8476('0x2d')](_[_0x8476('0x37')](_0x51e75e[_0x8476('0x2f')],_0x454351[_0x8476('0x2d')]),_0x4cedf4);if(_0x51e75e['query'][_0x8476('0x38')]){_0x40c430[_0x8476('0x36')]=_['merge'](_0x40c430[_0x8476('0x36')],{'$or':_[_0x8476('0x25')](_0x4cedf4,function(_0x3ff4d1){if(_0x3ff4d1['type']!==_0x8476('0x39')){var _0x3a864e={};_0x3a864e[_0x3ff4d1['name']]={'$like':'%'+_0x51e75e[_0x8476('0x2f')][_0x8476('0x38')]+'%'};return _0x3a864e;}})});}_0x40c430=_[_0x8476('0x3a')]({},_0x40c430,_0x51e75e[_0x8476('0x3b')]);var _0x2ef267={'where':_0x40c430[_0x8476('0x36')]};return db[_0x8476('0x26')][_0x8476('0x1b')](_0x2ef267)['then'](function(_0x1e8649){_0x210ab4[_0x8476('0x1b')]=_0x1e8649;if(_0x51e75e[_0x8476('0x2f')][_0x8476('0x3c')]){_0x40c430[_0x8476('0x3d')]=[{'all':!![]}];}return db[_0x8476('0x26')]['findAll'](_0x40c430);})['then'](function(_0x165ddb){_0x210ab4[_0x8476('0x3e')]=_0x165ddb;return _0x210ab4;})['then'](respondWithFilteredResult(_0x2aa341,_0x40c430))[_0x8476('0x3f')](handleError(_0x2aa341,null));};exports['show']=function(_0x5ba886,_0x55e29d){var _0x3c97ea={'raw':!![],'where':{'id':_0x5ba886[_0x8476('0x40')]['id']}},_0x44705d={};_0x44705d[_0x8476('0x2a')]=_[_0x8476('0x2c')](db[_0x8476('0x26')][_0x8476('0x27')]);_0x44705d['query']=_[_0x8476('0x2c')](_0x5ba886[_0x8476('0x2f')]);_0x44705d[_0x8476('0x2d')]=_[_0x8476('0x2e')](_0x44705d[_0x8476('0x2a')],_0x44705d['query']);_0x3c97ea[_0x8476('0x31')]=_[_0x8476('0x2e')](_0x44705d['model'],qs[_0x8476('0x30')](_0x5ba886['query']['fields']));_0x3c97ea[_0x8476('0x31')]=_0x3c97ea['attributes'][_0x8476('0x41')]?_0x3c97ea['attributes']:_0x44705d['model'];if(_0x5ba886[_0x8476('0x2f')][_0x8476('0x3c')]){_0x3c97ea[_0x8476('0x3d')]=[{'all':!![]}];}_0x3c97ea=_[_0x8476('0x3a')]({},_0x3c97ea,_0x5ba886[_0x8476('0x3b')]);return db[_0x8476('0x26')][_0x8476('0x42')](_0x3c97ea)[_0x8476('0x1f')](handleEntityNotFound(_0x55e29d,null))[_0x8476('0x1f')](respondWithResult(_0x55e29d,null))[_0x8476('0x3f')](handleError(_0x55e29d,null));};exports[_0x8476('0x43')]=function(_0x539296,_0x304cd2){return db[_0x8476('0x26')][_0x8476('0x43')](_0x539296[_0x8476('0x44')],{})[_0x8476('0x1f')](function(_0x3d880d){var _0x279fe4=_0x539296[_0x8476('0x45')]['get']({'plain':!![]});if(!_0x279fe4)throw new Error(_0x8476('0x46'));if(_0x279fe4[_0x8476('0x47')]===_0x8476('0x45')){var _0x1832e3=_0x3d880d[_0x8476('0x21')]({'plain':!![]});var _0x18328f=_0x8476('0x48');return db[_0x8476('0x49')][_0x8476('0x42')]({'where':{'name':_0x18328f,'userProfileId':_0x279fe4[_0x8476('0x4a')]},'raw':!![]})[_0x8476('0x1f')](function(_0x51e43f){if(_0x51e43f&&_0x51e43f['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x1832e3['name'],'resourceId':_0x1832e3['id'],'type':_0x51e43f[_0x8476('0x2b')],'sectionId':_0x51e43f['id']},{})['then'](function(){return _0x3d880d;});}else{return _0x3d880d;}})[_0x8476('0x3f')](function(_0x281c84){logger[_0x8476('0x23')](_0x8476('0x4b'),_0x281c84);throw _0x281c84;});}return _0x3d880d;})[_0x8476('0x1f')](respondWithResult(_0x304cd2,0xc9))[_0x8476('0x3f')](handleError(_0x304cd2,null));};exports[_0x8476('0x1e')]=function(_0x45d346,_0x50cff0){if(_0x45d346[_0x8476('0x44')]['id']){delete _0x45d346[_0x8476('0x44')]['id'];}return db[_0x8476('0x26')][_0x8476('0x42')]({'where':{'id':_0x45d346[_0x8476('0x40')]['id']}})[_0x8476('0x1f')](handleEntityNotFound(_0x50cff0,null))['then'](saveUpdates(_0x45d346[_0x8476('0x44')],null))[_0x8476('0x1f')](respondWithResult(_0x50cff0,null))[_0x8476('0x3f')](handleError(_0x50cff0,null));};exports[_0x8476('0x20')]=function(_0x25d515,_0x5df9e3){return db[_0x8476('0x26')][_0x8476('0x42')]({'where':{'id':_0x25d515[_0x8476('0x40')]['id']}})[_0x8476('0x1f')](handleEntityNotFound(_0x5df9e3,null))[_0x8476('0x1f')](removeEntity(_0x5df9e3,null))[_0x8476('0x3f')](handleError(_0x5df9e3,null));};exports[_0x8476('0x4c')]=function(_0xa13b4e,_0x2d1acc,_0x4a5ee7){return db[_0x8476('0x26')][_0x8476('0x42')]({'where':{'id':_0xa13b4e[_0x8476('0x40')]['id']},'attributes':[_0x8476('0x2b'),_0x8476('0x4d'),_0x8476('0x4e'),_0x8476('0x4f')],'raw':!![]})[_0x8476('0x1f')](handleEntityNotFound(_0x2d1acc,null))['then'](function(_0x3efb82){if(_0x3efb82){if(!fs[_0x8476('0x50')](path[_0x8476('0x51')](config[_0x8476('0x52')],_0x8476('0x53'),_0x3efb82[_0x8476('0x4e')]))){throw new db[(_0x8476('0x54'))][(_0x8476('0x55'))](_0x8476('0x56'));}if(_0xa13b4e[_0x8476('0x2f')][_0x8476('0x57')]){return _0x2d1acc[_0x8476('0x16')](0xc8);}return _0x2d1acc['download'](path['join'](config[_0x8476('0x52')],_0x8476('0x53'),_0x3efb82['savename']),util[_0x8476('0x58')](_0x8476('0x59'),_0x3efb82[_0x8476('0x4d')]||_0x3efb82[_0x8476('0x2b')],_0x3efb82[_0x8476('0x4f')][_0x8476('0x5a')]()));}})[_0x8476('0x3f')](handleError(_0x2d1acc,null));}; \ No newline at end of file +var _0x09df=['existsSync','join','Sequelize','ValidationError','Report\x20not\x20found\x20or\x20empty','download','root','server/files/reports','format','%s.%s','output','toLowerCase','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','jsforce','desk.js','papaparse','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','reject','save','update','then','destroy','get','ExtractedReports','UserProfileResource','stack','name','index','AnalyticExtractedReport','fieldName','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','rows','catch','rawAttributes','create','user','role','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','basename','savename'];(function(_0x198070,_0x8b89a4){var _0x3e3aac=function(_0x1b89eb){while(--_0x1b89eb){_0x198070['push'](_0x198070['shift']());}};_0x3e3aac(++_0x8b89a4);}(_0x09df,0x123));var _0xf09d=function(_0x2aa0e7,_0x4e5145){_0x2aa0e7=_0x2aa0e7-0x0;var _0x1472c0=_0x09df[_0x2aa0e7];return _0x1472c0;};'use strict';var emlformat=require(_0xf09d('0x0'));var rimraf=require(_0xf09d('0x1'));var zipdir=require(_0xf09d('0x2'));var jsonpatch=require(_0xf09d('0x3'));var rp=require(_0xf09d('0x4'));var moment=require(_0xf09d('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xf09d('0x6'));var util=require(_0xf09d('0x7'));var path=require(_0xf09d('0x8'));var sox=require(_0xf09d('0x9'));var csv=require(_0xf09d('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf09d('0xb'));var _=require(_0xf09d('0xc'));var squel=require(_0xf09d('0xd'));var crypto=require('crypto');var jsforce=require(_0xf09d('0xe'));var deskjs=require(_0xf09d('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xf09d('0x10'));var Redis=require('ioredis');var authService=require(_0xf09d('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf09d('0x12'));var logger=require(_0xf09d('0x13'))(_0xf09d('0x14'));var utils=require(_0xf09d('0x15'));var config=require(_0xf09d('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xf09d('0x17'))['db'];function respondWithStatusCode(_0x2d8814,_0x3cf76f){_0x3cf76f=_0x3cf76f||0xcc;return function(_0x27f885){if(_0x27f885){return _0x2d8814[_0xf09d('0x18')](_0x3cf76f);}return _0x2d8814[_0xf09d('0x19')](_0x3cf76f)[_0xf09d('0x1a')]();};}function respondWithResult(_0x386e2a,_0x4bff69){_0x4bff69=_0x4bff69||0xc8;return function(_0x46798e){if(_0x46798e){return _0x386e2a[_0xf09d('0x19')](_0x4bff69)[_0xf09d('0x1b')](_0x46798e);}};}function respondWithFilteredResult(_0x4a5eef,_0x2570ed){return function(_0x37e245){if(_0x37e245){var _0x532efc=typeof _0x2570ed[_0xf09d('0x1c')]===_0xf09d('0x1d')&&typeof _0x2570ed['limit']===_0xf09d('0x1d');var _0x2c4934=_0x37e245[_0xf09d('0x1e')];var _0x5a7dab=_0x532efc?0x0:_0x2570ed[_0xf09d('0x1c')];var _0x170d79=_0x532efc?_0x37e245[_0xf09d('0x1e')]:_0x2570ed['offset']+_0x2570ed[_0xf09d('0x1f')];var _0x3c7a85;if(_0x170d79>=_0x2c4934){_0x170d79=_0x2c4934;_0x3c7a85=0xc8;}else{_0x3c7a85=0xce;}_0x4a5eef[_0xf09d('0x19')](_0x3c7a85);return _0x4a5eef[_0xf09d('0x20')]('Content-Range',_0x5a7dab+'-'+_0x170d79+'/'+_0x2c4934)[_0xf09d('0x1b')](_0x37e245);}return null;};}function patchUpdates(_0x3e4a5b){return function(_0x2e3ba5){try{jsonpatch['apply'](_0x2e3ba5,_0x3e4a5b,!![]);}catch(_0x397ec9){return BPromise[_0xf09d('0x21')](_0x397ec9);}return _0x2e3ba5[_0xf09d('0x22')]();};}function saveUpdates(_0xc9778e,_0x2777b1){return function(_0x5b4ebb){if(_0x5b4ebb){return _0x5b4ebb[_0xf09d('0x23')](_0xc9778e)[_0xf09d('0x24')](function(_0x443cf2){return _0x443cf2;});}return null;};}function removeEntity(_0x71f53e,_0x42d47e){return function(_0x328bf5){if(_0x328bf5){return _0x328bf5[_0xf09d('0x25')]()['then'](function(){var _0x5313f2=_0x328bf5[_0xf09d('0x26')]({'plain':!![]});var _0x40262e=_0xf09d('0x27');return db[_0xf09d('0x28')][_0xf09d('0x25')]({'where':{'type':_0x40262e,'resourceId':_0x5313f2['id']}})[_0xf09d('0x24')](function(){return _0x328bf5;});})[_0xf09d('0x24')](function(){_0x71f53e[_0xf09d('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3d554b,_0x38d0ea){return function(_0x585e9a){if(!_0x585e9a){_0x3d554b['sendStatus'](0x194);}return _0x585e9a;};}function handleError(_0x211c40,_0x15927e){_0x15927e=_0x15927e||0x1f4;return function(_0x27bbbc){logger['error'](_0x27bbbc[_0xf09d('0x29')]);if(_0x27bbbc[_0xf09d('0x2a')]){delete _0x27bbbc[_0xf09d('0x2a')];}_0x211c40[_0xf09d('0x19')](_0x15927e)['send'](_0x27bbbc);};}exports[_0xf09d('0x2b')]=function(_0x19af85,_0x45c080){var _0x2a5fa7={},_0x57c7d1={},_0x59a54f={'count':0x0,'rows':[]};var _0x20cd68=_['map'](db[_0xf09d('0x2c')]['rawAttributes'],function(_0x2d3745){return{'name':_0x2d3745[_0xf09d('0x2d')],'type':_0x2d3745['type'][_0xf09d('0x2e')]};});_0x57c7d1[_0xf09d('0x2f')]=_[_0xf09d('0x30')](_0x20cd68,_0xf09d('0x2a'));_0x57c7d1[_0xf09d('0x31')]=_[_0xf09d('0x32')](_0x19af85['query']);_0x57c7d1[_0xf09d('0x33')]=_[_0xf09d('0x34')](_0x57c7d1[_0xf09d('0x2f')],_0x57c7d1[_0xf09d('0x31')]);_0x2a5fa7[_0xf09d('0x35')]=_[_0xf09d('0x34')](_0x57c7d1[_0xf09d('0x2f')],qs[_0xf09d('0x36')](_0x19af85['query'][_0xf09d('0x36')]));_0x2a5fa7[_0xf09d('0x35')]=_0x2a5fa7[_0xf09d('0x35')][_0xf09d('0x37')]?_0x2a5fa7['attributes']:_0x57c7d1[_0xf09d('0x2f')];if(!_0x19af85[_0xf09d('0x31')][_0xf09d('0x38')](_0xf09d('0x39'))){_0x2a5fa7['limit']=qs[_0xf09d('0x1f')](_0x19af85[_0xf09d('0x31')][_0xf09d('0x1f')]);_0x2a5fa7[_0xf09d('0x1c')]=qs[_0xf09d('0x1c')](_0x19af85['query']['offset']);}_0x2a5fa7['order']=qs['sort'](_0x19af85[_0xf09d('0x31')]['sort']);_0x2a5fa7[_0xf09d('0x3a')]=qs[_0xf09d('0x33')](_[_0xf09d('0x3b')](_0x19af85[_0xf09d('0x31')],_0x57c7d1[_0xf09d('0x33')]),_0x20cd68);if(_0x19af85[_0xf09d('0x31')][_0xf09d('0x3c')]){_0x2a5fa7[_0xf09d('0x3a')]=_[_0xf09d('0x3d')](_0x2a5fa7['where'],{'$or':_['map'](_0x20cd68,function(_0x46f5dd){if(_0x46f5dd[_0xf09d('0x3e')]!==_0xf09d('0x3f')){var _0x4a8bcd={};_0x4a8bcd[_0x46f5dd[_0xf09d('0x2a')]]={'$like':'%'+_0x19af85['query'][_0xf09d('0x3c')]+'%'};return _0x4a8bcd;}})});}_0x2a5fa7=_['merge']({},_0x2a5fa7,_0x19af85[_0xf09d('0x40')]);var _0x92fb14={'where':_0x2a5fa7['where']};return db[_0xf09d('0x2c')]['count'](_0x92fb14)[_0xf09d('0x24')](function(_0x52e046){_0x59a54f['count']=_0x52e046;if(_0x19af85[_0xf09d('0x31')][_0xf09d('0x41')]){_0x2a5fa7[_0xf09d('0x42')]=[{'all':!![]}];}return db['AnalyticExtractedReport']['findAll'](_0x2a5fa7);})[_0xf09d('0x24')](function(_0x41ebcb){_0x59a54f[_0xf09d('0x43')]=_0x41ebcb;return _0x59a54f;})['then'](respondWithFilteredResult(_0x45c080,_0x2a5fa7))[_0xf09d('0x44')](handleError(_0x45c080,null));};exports['show']=function(_0x3c82a0,_0x25923d){var _0x38de1e={'raw':!![],'where':{'id':_0x3c82a0['params']['id']}},_0x5c3565={};_0x5c3565[_0xf09d('0x2f')]=_[_0xf09d('0x32')](db[_0xf09d('0x2c')][_0xf09d('0x45')]);_0x5c3565[_0xf09d('0x31')]=_[_0xf09d('0x32')](_0x3c82a0[_0xf09d('0x31')]);_0x5c3565[_0xf09d('0x33')]=_[_0xf09d('0x34')](_0x5c3565[_0xf09d('0x2f')],_0x5c3565['query']);_0x38de1e[_0xf09d('0x35')]=_['intersection'](_0x5c3565[_0xf09d('0x2f')],qs[_0xf09d('0x36')](_0x3c82a0[_0xf09d('0x31')][_0xf09d('0x36')]));_0x38de1e['attributes']=_0x38de1e['attributes'][_0xf09d('0x37')]?_0x38de1e[_0xf09d('0x35')]:_0x5c3565[_0xf09d('0x2f')];if(_0x3c82a0[_0xf09d('0x31')][_0xf09d('0x41')]){_0x38de1e['include']=[{'all':!![]}];}_0x38de1e=_[_0xf09d('0x3d')]({},_0x38de1e,_0x3c82a0[_0xf09d('0x40')]);return db['AnalyticExtractedReport']['find'](_0x38de1e)[_0xf09d('0x24')](handleEntityNotFound(_0x25923d,null))[_0xf09d('0x24')](respondWithResult(_0x25923d,null))['catch'](handleError(_0x25923d,null));};exports[_0xf09d('0x46')]=function(_0x519450,_0xddedc0){return db[_0xf09d('0x2c')][_0xf09d('0x46')](_0x519450['body'],{})['then'](function(_0x46cfd3){var _0x164229=_0x519450[_0xf09d('0x47')]['get']({'plain':!![]});if(!_0x164229)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x164229[_0xf09d('0x48')]===_0xf09d('0x47')){var _0x514884=_0x46cfd3[_0xf09d('0x26')]({'plain':!![]});var _0x1b88ac=_0xf09d('0x27');return db['UserProfileSection'][_0xf09d('0x49')]({'where':{'name':_0x1b88ac,'userProfileId':_0x164229[_0xf09d('0x4a')]},'raw':!![]})['then'](function(_0x1e4332){if(_0x1e4332&&_0x1e4332[_0xf09d('0x4b')]===0x0){return db['UserProfileResource']['create']({'name':_0x514884[_0xf09d('0x2a')],'resourceId':_0x514884['id'],'type':_0x1e4332['name'],'sectionId':_0x1e4332['id']},{})[_0xf09d('0x24')](function(){return _0x46cfd3;});}else{return _0x46cfd3;}})[_0xf09d('0x44')](function(_0x2ef3af){logger['error'](_0xf09d('0x4c'),_0x2ef3af);throw _0x2ef3af;});}return _0x46cfd3;})['then'](respondWithResult(_0xddedc0,0xc9))['catch'](handleError(_0xddedc0,null));};exports[_0xf09d('0x23')]=function(_0x446ccc,_0x30244a){if(_0x446ccc[_0xf09d('0x4d')]['id']){delete _0x446ccc['body']['id'];}return db[_0xf09d('0x2c')][_0xf09d('0x49')]({'where':{'id':_0x446ccc[_0xf09d('0x4e')]['id']}})[_0xf09d('0x24')](handleEntityNotFound(_0x30244a,null))[_0xf09d('0x24')](saveUpdates(_0x446ccc[_0xf09d('0x4d')],null))[_0xf09d('0x24')](respondWithResult(_0x30244a,null))[_0xf09d('0x44')](handleError(_0x30244a,null));};exports[_0xf09d('0x25')]=function(_0x504b8f,_0x17759a){return db[_0xf09d('0x2c')]['find']({'where':{'id':_0x504b8f[_0xf09d('0x4e')]['id']}})[_0xf09d('0x24')](handleEntityNotFound(_0x17759a,null))[_0xf09d('0x24')](removeEntity(_0x17759a,null))[_0xf09d('0x44')](handleError(_0x17759a,null));};exports['download']=function(_0xf10987,_0x29101b,_0x42c16e){return db[_0xf09d('0x2c')][_0xf09d('0x49')]({'where':{'id':_0xf10987['params']['id']},'attributes':[_0xf09d('0x2a'),_0xf09d('0x4f'),_0xf09d('0x50'),'output'],'raw':!![]})['then'](handleEntityNotFound(_0x29101b,null))[_0xf09d('0x24')](function(_0x38a956){if(_0x38a956){if(!fs[_0xf09d('0x51')](path[_0xf09d('0x52')](config['root'],'server/files/reports',_0x38a956[_0xf09d('0x50')]))){throw new db[(_0xf09d('0x53'))][(_0xf09d('0x54'))](_0xf09d('0x55'));}if(_0xf10987['query']['exists']){return _0x29101b[_0xf09d('0x18')](0xc8);}return _0x29101b[_0xf09d('0x56')](path[_0xf09d('0x52')](config[_0xf09d('0x57')],_0xf09d('0x58'),_0x38a956[_0xf09d('0x50')]),util[_0xf09d('0x59')](_0xf09d('0x5a'),_0x38a956[_0xf09d('0x4f')]||_0x38a956[_0xf09d('0x2a')],_0x38a956[_0xf09d('0x5b')][_0xf09d('0x5c')]()));}})[_0xf09d('0x44')](handleError(_0x29101b,null));}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.model.js b/server/api/analyticExtractedReport/analyticExtractedReport.model.js index 4d3b65a..2db5538 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 _0x911a=['bluebird','path','../../config/environment','./analyticExtractedReport.attributes','exports','define','AnalyticExtractedReport','lodash','util','api'];(function(_0x49cb18,_0x52be4e){var _0x2bc292=function(_0x3a58ba){while(--_0x3a58ba){_0x49cb18['push'](_0x49cb18['shift']());}};_0x2bc292(++_0x52be4e);}(_0x911a,0x1f1));var _0xa911=function(_0x102e71,_0x284f7e){_0x102e71=_0x102e71-0x0;var _0x46678d=_0x911a[_0x102e71];return _0x46678d;};'use strict';var _=require(_0xa911('0x0'));var util=require(_0xa911('0x1'));var logger=require('../../config/logger')(_0xa911('0x2'));var moment=require('moment');var BPromise=require(_0xa911('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa911('0x4'));var rimraf=require('rimraf');var config=require(_0xa911('0x5'));var attributes=require(_0xa911('0x6'));module[_0xa911('0x7')]=function(_0x1c029b,_0x27d0f0){return _0x1c029b[_0xa911('0x8')](_0xa911('0x9'),attributes,{'tableName':'analytics_extracted_reports','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcb8b=['AnalyticExtractedReport','analytics_extracted_reports','util','../../config/logger','api','moment','path','rimraf','../../config/environment','define'];(function(_0x15feaf,_0x53ff1c){var _0x4dbbec=function(_0x44ffbb){while(--_0x44ffbb){_0x15feaf['push'](_0x15feaf['shift']());}};_0x4dbbec(++_0x53ff1c);}(_0xcb8b,0x1b0));var _0xbcb8=function(_0x498a7a,_0x95fce){_0x498a7a=_0x498a7a-0x0;var _0x4ff437=_0xcb8b[_0x498a7a];return _0x4ff437;};'use strict';var _=require('lodash');var util=require(_0xbcb8('0x0'));var logger=require(_0xbcb8('0x1'))(_0xbcb8('0x2'));var moment=require(_0xbcb8('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xbcb8('0x4'));var rimraf=require(_0xbcb8('0x5'));var config=require(_0xbcb8('0x6'));var attributes=require('./analyticExtractedReport.attributes');module['exports']=function(_0x574b9f,_0x5ea062){return _0x574b9f[_0xbcb8('0x7')](_0xbcb8('0x8'),attributes,{'tableName':_0xbcb8('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 01f44f2..ef4b097 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 _0xea5a=['moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','then','info','request\x20sent','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','AnalyticExtractedReport,\x20%s,\x20%s','result','catch','util'];(function(_0x4ce07d,_0x38003c){var _0x5923e2=function(_0x415580){while(--_0x415580){_0x4ce07d['push'](_0x4ce07d['shift']());}};_0x5923e2(++_0x38003c);}(_0xea5a,0x1e3));var _0xaea5=function(_0x120f46,_0x32cab3){_0x120f46=_0x120f46-0x0;var _0x44cf93=_0xea5a[_0x120f46];return _0x44cf93;};'use strict';var _=require('lodash');var util=require(_0xaea5('0x0'));var moment=require(_0xaea5('0x1'));var BPromise=require('bluebird');var rs=require(_0xaea5('0x2'));var fs=require('fs');var Redis=require(_0xaea5('0x3'));var db=require(_0xaea5('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xaea5('0x5'))(_0xaea5('0x6'));var config=require('../../config/environment');var jayson=require(_0xaea5('0x7'));var client=jayson[_0xaea5('0x8')][_0xaea5('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x10d9ea,_0x15696e,_0x29617e){return new BPromise(function(_0x56ca9b,_0x1736c0){return client[_0xaea5('0xa')](_0x10d9ea,_0x29617e)[_0xaea5('0xb')](function(_0x1b5f90){logger[_0xaea5('0xc')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x15696e,_0xaea5('0xd'));logger['debug'](_0xaea5('0xe'),_0x15696e,_0xaea5('0xd'),JSON[_0xaea5('0xf')](_0x1b5f90));if(_0x1b5f90[_0xaea5('0x10')]){if(_0x1b5f90[_0xaea5('0x10')][_0xaea5('0x11')]===0x1f4){logger['error']('AnalyticExtractedReport,\x20%s,\x20%s',_0x15696e,_0x1b5f90['error']['message']);return _0x1736c0(_0x1b5f90['error'][_0xaea5('0x12')]);}logger[_0xaea5('0x10')](_0xaea5('0x13'),_0x15696e,_0x1b5f90[_0xaea5('0x10')][_0xaea5('0x12')]);return _0x56ca9b(_0x1b5f90['error'][_0xaea5('0x12')]);}else{logger[_0xaea5('0xc')](_0xaea5('0x13'),_0x15696e,'request\x20sent');_0x56ca9b(_0x1b5f90[_0xaea5('0x14')][_0xaea5('0x12')]);}})[_0xaea5('0x15')](function(_0x5df913){logger[_0xaea5('0x10')](_0xaea5('0x13'),_0x15696e,_0x5df913);_0x1736c0(_0x5df913);});});} \ No newline at end of file +var _0x1458=['jayson/promise','client','then','AnalyticExtractedReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','error','code','message','info','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment'];(function(_0x35a5e3,_0xb14268){var _0x5653bb=function(_0x3048f0){while(--_0x3048f0){_0x35a5e3['push'](_0x35a5e3['shift']());}};_0x5653bb(++_0xb14268);}(_0x1458,0x16c));var _0x8145=function(_0x431186,_0x592739){_0x431186=_0x431186-0x0;var _0x401ce8=_0x1458[_0x431186];return _0x401ce8;};'use strict';var _=require(_0x8145('0x0'));var util=require(_0x8145('0x1'));var moment=require(_0x8145('0x2'));var BPromise=require(_0x8145('0x3'));var rs=require(_0x8145('0x4'));var fs=require('fs');var Redis=require(_0x8145('0x5'));var db=require(_0x8145('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x8145('0x7'))(_0x8145('0x8'));var config=require(_0x8145('0x9'));var jayson=require(_0x8145('0xa'));var client=jayson[_0x8145('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0xe25a1b,_0x5f3a02,_0x5b7b04){return new BPromise(function(_0x5d2f25,_0x22468d){return client['request'](_0xe25a1b,_0x5b7b04)[_0x8145('0xc')](function(_0x1bb760){logger['info'](_0x8145('0xd'),_0x5f3a02,_0x8145('0xe'));logger[_0x8145('0xf')](_0x8145('0x10'),_0x5f3a02,_0x8145('0xe'),JSON['stringify'](_0x1bb760));if(_0x1bb760[_0x8145('0x11')]){if(_0x1bb760[_0x8145('0x11')][_0x8145('0x12')]===0x1f4){logger['error']('AnalyticExtractedReport,\x20%s,\x20%s',_0x5f3a02,_0x1bb760[_0x8145('0x11')][_0x8145('0x13')]);return _0x22468d(_0x1bb760[_0x8145('0x11')][_0x8145('0x13')]);}logger[_0x8145('0x11')](_0x8145('0xd'),_0x5f3a02,_0x1bb760[_0x8145('0x11')]['message']);return _0x5d2f25(_0x1bb760[_0x8145('0x11')][_0x8145('0x13')]);}else{logger[_0x8145('0x14')](_0x8145('0xd'),_0x5f3a02,'request\x20sent');_0x5d2f25(_0x1bb760['result'][_0x8145('0x13')]);}})[_0x8145('0x15')](function(_0x19b151){logger[_0x8145('0x11')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x5f3a02,_0x19b151);_0x22468d(_0x19b151);});});} \ No newline at end of file diff --git a/server/api/analyticExtractedReport/index.js b/server/api/analyticExtractedReport/index.js index 931ab3b..7a7cde9 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 _0x2e6f=['put','update','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/download','download','post','create'];(function(_0x58965a,_0x2e71db){var _0x254efc=function(_0xf14fb4){while(--_0xf14fb4){_0x58965a['push'](_0x58965a['shift']());}};_0x254efc(++_0x2e71db);}(_0x2e6f,0x1a6));var _0xf2e6=function(_0x575bca,_0x30a565){_0x575bca=_0x575bca-0x0;var _0x158271=_0x2e6f[_0x575bca];return _0x158271;};'use strict';var multer=require(_0xf2e6('0x0'));var util=require(_0xf2e6('0x1'));var path=require(_0xf2e6('0x2'));var timeout=require(_0xf2e6('0x3'));var express=require(_0xf2e6('0x4'));var router=express[_0xf2e6('0x5')]();var fs_extra=require(_0xf2e6('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xf2e6('0x7'));var config=require(_0xf2e6('0x8'));var controller=require('./analyticExtractedReport.controller');router[_0xf2e6('0x9')]('/',auth[_0xf2e6('0xa')](),controller[_0xf2e6('0xb')]);router[_0xf2e6('0x9')](_0xf2e6('0xc'),auth[_0xf2e6('0xa')](),controller[_0xf2e6('0xd')]);router['get'](_0xf2e6('0xe'),auth[_0xf2e6('0xa')](),controller[_0xf2e6('0xf')]);router[_0xf2e6('0x10')]('/',auth[_0xf2e6('0xa')](),controller[_0xf2e6('0x11')]);router[_0xf2e6('0x12')](_0xf2e6('0xc'),auth[_0xf2e6('0xa')](),controller[_0xf2e6('0x13')]);router[_0xf2e6('0x14')](_0xf2e6('0xc'),auth[_0xf2e6('0xa')](),controller['destroy']);module[_0xf2e6('0x15')]=router; \ No newline at end of file +var _0x5a4e=['index','get','show','download','post','create','put','/:id','update','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticExtractedReport.controller','isAuthenticated'];(function(_0x4b9652,_0x43b335){var _0x35f6e8=function(_0x5efc1c){while(--_0x5efc1c){_0x4b9652['push'](_0x4b9652['shift']());}};_0x35f6e8(++_0x43b335);}(_0x5a4e,0x155));var _0xe5a4=function(_0x35ba71,_0xa2fbbd){_0x35ba71=_0x35ba71-0x0;var _0x5f04f4=_0x5a4e[_0x35ba71];return _0x5f04f4;};'use strict';var multer=require(_0xe5a4('0x0'));var util=require(_0xe5a4('0x1'));var path=require(_0xe5a4('0x2'));var timeout=require(_0xe5a4('0x3'));var express=require('express');var router=express[_0xe5a4('0x4')]();var fs_extra=require(_0xe5a4('0x5'));var auth=require(_0xe5a4('0x6'));var interaction=require(_0xe5a4('0x7'));var config=require(_0xe5a4('0x8'));var controller=require(_0xe5a4('0x9'));router['get']('/',auth[_0xe5a4('0xa')](),controller[_0xe5a4('0xb')]);router[_0xe5a4('0xc')]('/:id',auth[_0xe5a4('0xa')](),controller[_0xe5a4('0xd')]);router[_0xe5a4('0xc')]('/:id/download',auth[_0xe5a4('0xa')](),controller[_0xe5a4('0xe')]);router[_0xe5a4('0xf')]('/',auth[_0xe5a4('0xa')](),controller[_0xe5a4('0x10')]);router[_0xe5a4('0x11')](_0xe5a4('0x12'),auth[_0xe5a4('0xa')](),controller[_0xe5a4('0x13')]);router['delete'](_0xe5a4('0x12'),auth[_0xe5a4('0xa')](),controller[_0xe5a4('0x14')]);module[_0xe5a4('0x15')]=router; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.attributes.js b/server/api/analyticFieldReport/analyticFieldReport.attributes.js index 3c47dbd..02d2e20 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 _0x19ce=['BOOLEAN','sequelize','exports','TEXT','STRING'];(function(_0x4213ba,_0x2e31c7){var _0x3a404e=function(_0x17d161){while(--_0x17d161){_0x4213ba['push'](_0x4213ba['shift']());}};_0x3a404e(++_0x2e31c7);}(_0x19ce,0xa1));var _0xe19c=function(_0x2b817a,_0x4bcba5){_0x2b817a=_0x2b817a-0x0;var _0x209041=_0x19ce[_0x2b817a];return _0x209041;};'use strict';var Sequelize=require(_0xe19c('0x0'));module[_0xe19c('0x1')]={'field':{'type':Sequelize[_0xe19c('0x2')]},'alias':{'type':Sequelize[_0xe19c('0x3')]},'function':{'type':Sequelize['STRING']},'format':{'type':Sequelize[_0xe19c('0x3')]},'groupBy':{'type':Sequelize[_0xe19c('0x4')],'defaultValue':![]},'orderBy':{'type':Sequelize['STRING']},'custom':{'type':Sequelize[_0xe19c('0x4')],'defaultValue':![]}}; \ No newline at end of file +var _0xa04e=['BOOLEAN','sequelize','exports','TEXT','STRING'];(function(_0x5c590f,_0x4b5aa4){var _0x52ef41=function(_0x2ef2d7){while(--_0x2ef2d7){_0x5c590f['push'](_0x5c590f['shift']());}};_0x52ef41(++_0x4b5aa4);}(_0xa04e,0x6a));var _0xea04=function(_0x57f590,_0x31e929){_0x57f590=_0x57f590-0x0;var _0x3181dd=_0xa04e[_0x57f590];return _0x3181dd;};'use strict';var Sequelize=require(_0xea04('0x0'));module[_0xea04('0x1')]={'field':{'type':Sequelize[_0xea04('0x2')]},'alias':{'type':Sequelize[_0xea04('0x3')]},'function':{'type':Sequelize[_0xea04('0x3')]},'format':{'type':Sequelize[_0xea04('0x3')]},'groupBy':{'type':Sequelize[_0xea04('0x4')],'defaultValue':![]},'orderBy':{'type':Sequelize[_0xea04('0x3')]},'custom':{'type':Sequelize[_0xea04('0x4')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.controller.js b/server/api/analyticFieldReport/analyticFieldReport.controller.js index 4c62e21..da28dbc 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 _0xa221=['type','key','model','keys','query','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','find','create','bulkCreate','body','bulkDestroy','destroy','ids','AnalyticCustomReport','findOne','sequelize','transaction','CustomReportId','findAll','eml-format','zip-dir','moment','mustache','util','path','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','reject','update','then','error','stack','name','send','index','map','AnalyticFieldReport','rawAttributes','fieldName'];(function(_0x3507f2,_0x26b02d){var _0xd5e672=function(_0x3a8144){while(--_0x3a8144){_0x3507f2['push'](_0x3507f2['shift']());}};_0xd5e672(++_0x26b02d);}(_0xa221,0x1ba));var _0x1a22=function(_0x1a1c17,_0x385ba8){_0x1a1c17=_0x1a1c17-0x0;var _0x3cae24=_0xa221[_0x1a1c17];return _0x3cae24;};'use strict';var emlformat=require(_0x1a22('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x1a22('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x1a22('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x1a22('0x3'));var util=require(_0x1a22('0x4'));var path=require(_0x1a22('0x5'));var sox=require('sox');var csv=require(_0x1a22('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1a22('0x7'));var _=require(_0x1a22('0x8'));var squel=require(_0x1a22('0x9'));var crypto=require(_0x1a22('0xa'));var jsforce=require(_0x1a22('0xb'));var deskjs=require(_0x1a22('0xc'));var toCsv=require(_0x1a22('0x6'));var querystring=require(_0x1a22('0xd'));var Papa=require(_0x1a22('0xe'));var Redis=require(_0x1a22('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x1a22('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x1a22('0x11'))(_0x1a22('0x12'));var utils=require(_0x1a22('0x13'));var config=require(_0x1a22('0x14'));var licenseUtil=require(_0x1a22('0x15'));var db=require(_0x1a22('0x16'))['db'];function respondWithStatusCode(_0x3fb4c2,_0x1696ce){_0x1696ce=_0x1696ce||0xcc;return function(_0x1d69b2){if(_0x1d69b2){return _0x3fb4c2[_0x1a22('0x17')](_0x1696ce);}return _0x3fb4c2[_0x1a22('0x18')](_0x1696ce)['end']();};}function respondWithResult(_0x35a346,_0x11d654){_0x11d654=_0x11d654||0xc8;return function(_0x1382ca){if(_0x1382ca){return _0x35a346[_0x1a22('0x18')](_0x11d654)[_0x1a22('0x19')](_0x1382ca);}};}function respondWithFilteredResult(_0x1c8c40,_0x1e7640){return function(_0x4b2e60){if(_0x4b2e60){var _0x33f2a9=typeof _0x1e7640[_0x1a22('0x1a')]===_0x1a22('0x1b')&&typeof _0x1e7640[_0x1a22('0x1c')]==='undefined';var _0x36d83d=_0x4b2e60[_0x1a22('0x1d')];var _0x714384=_0x33f2a9?0x0:_0x1e7640[_0x1a22('0x1a')];var _0x9418dd=_0x33f2a9?_0x4b2e60[_0x1a22('0x1d')]:_0x1e7640[_0x1a22('0x1a')]+_0x1e7640[_0x1a22('0x1c')];var _0x5c9ad7;if(_0x9418dd>=_0x36d83d){_0x9418dd=_0x36d83d;_0x5c9ad7=0xc8;}else{_0x5c9ad7=0xce;}_0x1c8c40[_0x1a22('0x18')](_0x5c9ad7);return _0x1c8c40[_0x1a22('0x1e')](_0x1a22('0x1f'),_0x714384+'-'+_0x9418dd+'/'+_0x36d83d)[_0x1a22('0x19')](_0x4b2e60);}return null;};}function patchUpdates(_0x2f0cb2){return function(_0x2ee0a2){try{jsonpatch['apply'](_0x2ee0a2,_0x2f0cb2,!![]);}catch(_0x47b9eb){return BPromise[_0x1a22('0x20')](_0x47b9eb);}return _0x2ee0a2['save']();};}function saveUpdates(_0x299bbe,_0x1c3380){return function(_0x206a4b){if(_0x206a4b){return _0x206a4b[_0x1a22('0x21')](_0x299bbe)[_0x1a22('0x22')](function(_0x325f03){return _0x325f03;});}return null;};}function removeEntity(_0x5b159b,_0x4da751){return function(_0x58839e){if(_0x58839e){return _0x58839e['destroy']()[_0x1a22('0x22')](function(){_0x5b159b[_0x1a22('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x489405,_0x2a539a){return function(_0x346a00){if(!_0x346a00){_0x489405[_0x1a22('0x17')](0x194);}return _0x346a00;};}function handleError(_0x4c7093,_0x49affe){_0x49affe=_0x49affe||0x1f4;return function(_0x4bffe2){logger[_0x1a22('0x23')](_0x4bffe2[_0x1a22('0x24')]);if(_0x4bffe2['name']){delete _0x4bffe2[_0x1a22('0x25')];}_0x4c7093[_0x1a22('0x18')](_0x49affe)[_0x1a22('0x26')](_0x4bffe2);};}exports[_0x1a22('0x27')]=function(_0x527705,_0x5a7269){var _0x3997b4={},_0x4e9add={},_0x1e1409={'count':0x0,'rows':[]};var _0x28e1f2=_[_0x1a22('0x28')](db[_0x1a22('0x29')][_0x1a22('0x2a')],function(_0x546dc4){return{'name':_0x546dc4[_0x1a22('0x2b')],'type':_0x546dc4[_0x1a22('0x2c')][_0x1a22('0x2d')]};});_0x4e9add[_0x1a22('0x2e')]=_[_0x1a22('0x28')](_0x28e1f2,_0x1a22('0x25'));_0x4e9add['query']=_[_0x1a22('0x2f')](_0x527705[_0x1a22('0x30')]);_0x4e9add['filters']=_[_0x1a22('0x31')](_0x4e9add['model'],_0x4e9add[_0x1a22('0x30')]);_0x3997b4[_0x1a22('0x32')]=_['intersection'](_0x4e9add[_0x1a22('0x2e')],qs[_0x1a22('0x33')](_0x527705[_0x1a22('0x30')]['fields']));_0x3997b4['attributes']=_0x3997b4[_0x1a22('0x32')]['length']?_0x3997b4[_0x1a22('0x32')]:_0x4e9add[_0x1a22('0x2e')];if(!_0x527705[_0x1a22('0x30')][_0x1a22('0x34')](_0x1a22('0x35'))){_0x3997b4[_0x1a22('0x1c')]=qs[_0x1a22('0x1c')](_0x527705[_0x1a22('0x30')]['limit']);_0x3997b4[_0x1a22('0x1a')]=qs['offset'](_0x527705[_0x1a22('0x30')]['offset']);}_0x3997b4[_0x1a22('0x36')]=qs[_0x1a22('0x37')](_0x527705[_0x1a22('0x30')][_0x1a22('0x37')]);_0x3997b4[_0x1a22('0x38')]=qs[_0x1a22('0x39')](_['pick'](_0x527705['query'],_0x4e9add[_0x1a22('0x39')]),_0x28e1f2);if(_0x527705[_0x1a22('0x30')][_0x1a22('0x3a')]){_0x3997b4['where']=_[_0x1a22('0x3b')](_0x3997b4[_0x1a22('0x38')],{'$or':_[_0x1a22('0x28')](_0x28e1f2,function(_0x259b24){if(_0x259b24[_0x1a22('0x2c')]!==_0x1a22('0x3c')){var _0xa8652={};_0xa8652[_0x259b24[_0x1a22('0x25')]]={'$like':'%'+_0x527705[_0x1a22('0x30')][_0x1a22('0x3a')]+'%'};return _0xa8652;}})});}_0x3997b4=_[_0x1a22('0x3b')]({},_0x3997b4,_0x527705[_0x1a22('0x3d')]);var _0x484c12={'where':_0x3997b4[_0x1a22('0x38')]};return db[_0x1a22('0x29')][_0x1a22('0x1d')](_0x484c12)['then'](function(_0x2f34df){_0x1e1409[_0x1a22('0x1d')]=_0x2f34df;if(_0x527705[_0x1a22('0x30')][_0x1a22('0x3e')]){_0x3997b4[_0x1a22('0x3f')]=[{'all':!![]}];}return db[_0x1a22('0x29')]['findAll'](_0x3997b4);})[_0x1a22('0x22')](function(_0x4909e9){_0x1e1409[_0x1a22('0x40')]=_0x4909e9;return _0x1e1409;})[_0x1a22('0x22')](respondWithFilteredResult(_0x5a7269,_0x3997b4))[_0x1a22('0x41')](handleError(_0x5a7269,null));};exports[_0x1a22('0x42')]=function(_0x1d4f80,_0x31b38b){var _0x1376a7={'raw':![],'where':{'id':_0x1d4f80[_0x1a22('0x43')]['id']}},_0x3d437d={};_0x3d437d[_0x1a22('0x2e')]=_['keys'](db[_0x1a22('0x29')]['rawAttributes']);_0x3d437d['query']=_[_0x1a22('0x2f')](_0x1d4f80[_0x1a22('0x30')]);_0x3d437d[_0x1a22('0x39')]=_[_0x1a22('0x31')](_0x3d437d[_0x1a22('0x2e')],_0x3d437d[_0x1a22('0x30')]);_0x1376a7[_0x1a22('0x32')]=_[_0x1a22('0x31')](_0x3d437d[_0x1a22('0x2e')],qs[_0x1a22('0x33')](_0x1d4f80['query'][_0x1a22('0x33')]));_0x1376a7[_0x1a22('0x32')]=_0x1376a7[_0x1a22('0x32')]['length']?_0x1376a7[_0x1a22('0x32')]:_0x3d437d[_0x1a22('0x2e')];if(_0x1d4f80[_0x1a22('0x30')][_0x1a22('0x3e')]){_0x1376a7[_0x1a22('0x3f')]=[{'all':!![]}];}_0x1376a7=_[_0x1a22('0x3b')]({},_0x1376a7,_0x1d4f80[_0x1a22('0x3d')]);return db[_0x1a22('0x29')][_0x1a22('0x44')](_0x1376a7)[_0x1a22('0x22')](handleEntityNotFound(_0x31b38b,null))[_0x1a22('0x22')](respondWithResult(_0x31b38b,null))[_0x1a22('0x41')](handleError(_0x31b38b,null));};exports[_0x1a22('0x45')]=function(_0x17e7f9,_0x327c3a){return db[_0x1a22('0x29')][_0x1a22('0x45')](_0x17e7f9['body'],{})[_0x1a22('0x22')](respondWithResult(_0x327c3a,0xc9))[_0x1a22('0x41')](handleError(_0x327c3a,null));};exports[_0x1a22('0x46')]=function(_0x37b6b1,_0x2e135f){return db['AnalyticFieldReport'][_0x1a22('0x46')](_0x37b6b1['body'],{'raw':![],'individualHooks':!![]})[_0x1a22('0x22')](respondWithResult(_0x2e135f,0xc9))[_0x1a22('0x41')](handleError(_0x2e135f,null));};exports[_0x1a22('0x21')]=function(_0x177855,_0x443fa4){if(_0x177855[_0x1a22('0x47')]['id']){delete _0x177855['body']['id'];}return db[_0x1a22('0x29')][_0x1a22('0x44')]({'where':{'id':_0x177855[_0x1a22('0x43')]['id']}})[_0x1a22('0x22')](handleEntityNotFound(_0x443fa4,null))['then'](saveUpdates(_0x177855[_0x1a22('0x47')],null))[_0x1a22('0x22')](respondWithResult(_0x443fa4,null))[_0x1a22('0x41')](handleError(_0x443fa4,null));};exports['destroy']=function(_0x36b945,_0x476e1a){return db[_0x1a22('0x29')][_0x1a22('0x44')]({'where':{'id':_0x36b945[_0x1a22('0x43')]['id']}})[_0x1a22('0x22')](handleEntityNotFound(_0x476e1a,null))[_0x1a22('0x22')](removeEntity(_0x476e1a,null))['catch'](handleError(_0x476e1a,null));};exports[_0x1a22('0x48')]=function(_0x36fb4e,_0x244996){return db[_0x1a22('0x29')][_0x1a22('0x49')]({'where':{'id':_0x36fb4e[_0x1a22('0x30')][_0x1a22('0x4a')]||[]},'raw':![],'individualHooks':!![]})[_0x1a22('0x22')](respondWithResult(_0x244996,0xcc))['catch'](handleError(_0x244996,null));};exports['addFields']=function(_0x2107f9,_0x451161,_0x44ac78){return db[_0x1a22('0x4b')][_0x1a22('0x4c')]({'where':{'id':_0x2107f9[_0x1a22('0x43')]['id']}})[_0x1a22('0x22')](handleEntityNotFound(_0x451161,null))[_0x1a22('0x22')](function(_0x3c5861){if(_0x3c5861){return db[_0x1a22('0x4d')][_0x1a22('0x4e')](function(_0xe484a1){return db[_0x1a22('0x29')]['destroy']({'where':{'CustomReportId':_0x2107f9[_0x1a22('0x43')]['id']},'transaction':_0xe484a1})[_0x1a22('0x22')](function(_0x1104e4){var _0x3caa0d=_[_0x1a22('0x28')](_0x2107f9['body'],function(_0x165738){delete _0x165738['id'];_0x165738[_0x1a22('0x4f')]=_0x2107f9[_0x1a22('0x43')]['id'];return _0x165738;});return db['AnalyticFieldReport']['bulkCreate'](_0x3caa0d,{'transaction':_0xe484a1});});})[_0x1a22('0x22')](function(){return db[_0x1a22('0x29')][_0x1a22('0x50')]({'where':{'CustomReportId':_0x2107f9[_0x1a22('0x43')]['id']}});});}})[_0x1a22('0x22')](respondWithResult(_0x451161,null))[_0x1a22('0x41')](handleError(_0x451161,null));}; \ No newline at end of file +var _0xb6a7=['fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','map','AnalyticFieldReport','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','keys','length','find','create','bulkCreate','body','bulkDestroy','ids','AnalyticCustomReport','findOne','sequelize','transaction','CustomReportId','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs'];(function(_0x52b0b2,_0xf6dbf9){var _0x322769=function(_0x3ad9da){while(--_0x3ad9da){_0x52b0b2['push'](_0x52b0b2['shift']());}};_0x322769(++_0xf6dbf9);}(_0xb6a7,0xf6));var _0x7b6a=function(_0x565ed7,_0x398228){_0x565ed7=_0x565ed7-0x0;var _0x183ad7=_0xb6a7[_0x565ed7];return _0x183ad7;};'use strict';var emlformat=require(_0x7b6a('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x7b6a('0x1'));var jsonpatch=require(_0x7b6a('0x2'));var rp=require(_0x7b6a('0x3'));var moment=require(_0x7b6a('0x4'));var BPromise=require(_0x7b6a('0x5'));var Mustache=require(_0x7b6a('0x6'));var util=require(_0x7b6a('0x7'));var path=require(_0x7b6a('0x8'));var sox=require(_0x7b6a('0x9'));var csv=require(_0x7b6a('0xa'));var ejs=require(_0x7b6a('0xb'));var fs=require('fs');var fs_extra=require(_0x7b6a('0xc'));var _=require(_0x7b6a('0xd'));var squel=require(_0x7b6a('0xe'));var crypto=require(_0x7b6a('0xf'));var jsforce=require(_0x7b6a('0x10'));var deskjs=require(_0x7b6a('0x11'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x7b6a('0x12'));var Redis=require(_0x7b6a('0x13'));var authService=require(_0x7b6a('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0x7b6a('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7b6a('0x16'))('api');var utils=require(_0x7b6a('0x17'));var config=require(_0x7b6a('0x18'));var licenseUtil=require(_0x7b6a('0x19'));var db=require(_0x7b6a('0x1a'))['db'];function respondWithStatusCode(_0x2dd736,_0x1396c0){_0x1396c0=_0x1396c0||0xcc;return function(_0x513ac6){if(_0x513ac6){return _0x2dd736[_0x7b6a('0x1b')](_0x1396c0);}return _0x2dd736[_0x7b6a('0x1c')](_0x1396c0)[_0x7b6a('0x1d')]();};}function respondWithResult(_0x96e7e4,_0x577410){_0x577410=_0x577410||0xc8;return function(_0xb2f03d){if(_0xb2f03d){return _0x96e7e4[_0x7b6a('0x1c')](_0x577410)[_0x7b6a('0x1e')](_0xb2f03d);}};}function respondWithFilteredResult(_0x55f7bd,_0x2eb663){return function(_0x9a6cae){if(_0x9a6cae){var _0x6543b4=typeof _0x2eb663[_0x7b6a('0x1f')]==='undefined'&&typeof _0x2eb663[_0x7b6a('0x20')]===_0x7b6a('0x21');var _0x20f0ad=_0x9a6cae['count'];var _0x9bbeef=_0x6543b4?0x0:_0x2eb663[_0x7b6a('0x1f')];var _0x5b12ec=_0x6543b4?_0x9a6cae[_0x7b6a('0x22')]:_0x2eb663['offset']+_0x2eb663[_0x7b6a('0x20')];var _0x2cb364;if(_0x5b12ec>=_0x20f0ad){_0x5b12ec=_0x20f0ad;_0x2cb364=0xc8;}else{_0x2cb364=0xce;}_0x55f7bd[_0x7b6a('0x1c')](_0x2cb364);return _0x55f7bd[_0x7b6a('0x23')](_0x7b6a('0x24'),_0x9bbeef+'-'+_0x5b12ec+'/'+_0x20f0ad)[_0x7b6a('0x1e')](_0x9a6cae);}return null;};}function patchUpdates(_0x2bff4a){return function(_0x5d45b1){try{jsonpatch['apply'](_0x5d45b1,_0x2bff4a,!![]);}catch(_0x17eb6a){return BPromise[_0x7b6a('0x25')](_0x17eb6a);}return _0x5d45b1[_0x7b6a('0x26')]();};}function saveUpdates(_0x4f9392,_0x72c364){return function(_0x2b092f){if(_0x2b092f){return _0x2b092f[_0x7b6a('0x27')](_0x4f9392)[_0x7b6a('0x28')](function(_0x584ae0){return _0x584ae0;});}return null;};}function removeEntity(_0x2ddab4,_0xc5e36f){return function(_0x5ec37f){if(_0x5ec37f){return _0x5ec37f[_0x7b6a('0x29')]()['then'](function(){_0x2ddab4[_0x7b6a('0x1c')](0xcc)[_0x7b6a('0x1d')]();});}};}function handleEntityNotFound(_0x52de06,_0x218952){return function(_0xbf66a1){if(!_0xbf66a1){_0x52de06['sendStatus'](0x194);}return _0xbf66a1;};}function handleError(_0x3a59a0,_0x41fe1b){_0x41fe1b=_0x41fe1b||0x1f4;return function(_0x3afda3){logger[_0x7b6a('0x2a')](_0x3afda3[_0x7b6a('0x2b')]);if(_0x3afda3[_0x7b6a('0x2c')]){delete _0x3afda3[_0x7b6a('0x2c')];}_0x3a59a0[_0x7b6a('0x1c')](_0x41fe1b)[_0x7b6a('0x2d')](_0x3afda3);};}exports['index']=function(_0x5731aa,_0x300803){var _0x59d689={},_0x3c9e91={},_0x19e449={'count':0x0,'rows':[]};var _0x588598=_[_0x7b6a('0x2e')](db[_0x7b6a('0x2f')][_0x7b6a('0x30')],function(_0x58f045){return{'name':_0x58f045[_0x7b6a('0x31')],'type':_0x58f045[_0x7b6a('0x32')][_0x7b6a('0x33')]};});_0x3c9e91[_0x7b6a('0x34')]=_[_0x7b6a('0x2e')](_0x588598,_0x7b6a('0x2c'));_0x3c9e91[_0x7b6a('0x35')]=_['keys'](_0x5731aa[_0x7b6a('0x35')]);_0x3c9e91[_0x7b6a('0x36')]=_[_0x7b6a('0x37')](_0x3c9e91['model'],_0x3c9e91[_0x7b6a('0x35')]);_0x59d689[_0x7b6a('0x38')]=_[_0x7b6a('0x37')](_0x3c9e91[_0x7b6a('0x34')],qs[_0x7b6a('0x39')](_0x5731aa[_0x7b6a('0x35')][_0x7b6a('0x39')]));_0x59d689[_0x7b6a('0x38')]=_0x59d689[_0x7b6a('0x38')]['length']?_0x59d689['attributes']:_0x3c9e91[_0x7b6a('0x34')];if(!_0x5731aa['query']['hasOwnProperty']('nolimit')){_0x59d689['limit']=qs['limit'](_0x5731aa['query'][_0x7b6a('0x20')]);_0x59d689[_0x7b6a('0x1f')]=qs['offset'](_0x5731aa[_0x7b6a('0x35')][_0x7b6a('0x1f')]);}_0x59d689[_0x7b6a('0x3a')]=qs[_0x7b6a('0x3b')](_0x5731aa['query'][_0x7b6a('0x3b')]);_0x59d689[_0x7b6a('0x3c')]=qs[_0x7b6a('0x36')](_[_0x7b6a('0x3d')](_0x5731aa[_0x7b6a('0x35')],_0x3c9e91[_0x7b6a('0x36')]),_0x588598);if(_0x5731aa[_0x7b6a('0x35')][_0x7b6a('0x3e')]){_0x59d689['where']=_[_0x7b6a('0x3f')](_0x59d689[_0x7b6a('0x3c')],{'$or':_[_0x7b6a('0x2e')](_0x588598,function(_0x42b366){if(_0x42b366[_0x7b6a('0x32')]!==_0x7b6a('0x40')){var _0xf75a11={};_0xf75a11[_0x42b366[_0x7b6a('0x2c')]]={'$like':'%'+_0x5731aa[_0x7b6a('0x35')][_0x7b6a('0x3e')]+'%'};return _0xf75a11;}})});}_0x59d689=_[_0x7b6a('0x3f')]({},_0x59d689,_0x5731aa[_0x7b6a('0x41')]);var _0x184c13={'where':_0x59d689[_0x7b6a('0x3c')]};return db['AnalyticFieldReport'][_0x7b6a('0x22')](_0x184c13)[_0x7b6a('0x28')](function(_0x3abdaa){_0x19e449[_0x7b6a('0x22')]=_0x3abdaa;if(_0x5731aa[_0x7b6a('0x35')][_0x7b6a('0x42')]){_0x59d689[_0x7b6a('0x43')]=[{'all':!![]}];}return db[_0x7b6a('0x2f')][_0x7b6a('0x44')](_0x59d689);})['then'](function(_0x2be885){_0x19e449[_0x7b6a('0x45')]=_0x2be885;return _0x19e449;})[_0x7b6a('0x28')](respondWithFilteredResult(_0x300803,_0x59d689))[_0x7b6a('0x46')](handleError(_0x300803,null));};exports[_0x7b6a('0x47')]=function(_0x54fe12,_0x11ac65){var _0x5e2331={'raw':![],'where':{'id':_0x54fe12[_0x7b6a('0x48')]['id']}},_0x566434={};_0x566434[_0x7b6a('0x34')]=_[_0x7b6a('0x49')](db[_0x7b6a('0x2f')][_0x7b6a('0x30')]);_0x566434[_0x7b6a('0x35')]=_['keys'](_0x54fe12[_0x7b6a('0x35')]);_0x566434[_0x7b6a('0x36')]=_[_0x7b6a('0x37')](_0x566434['model'],_0x566434[_0x7b6a('0x35')]);_0x5e2331[_0x7b6a('0x38')]=_['intersection'](_0x566434['model'],qs[_0x7b6a('0x39')](_0x54fe12['query'][_0x7b6a('0x39')]));_0x5e2331[_0x7b6a('0x38')]=_0x5e2331[_0x7b6a('0x38')][_0x7b6a('0x4a')]?_0x5e2331[_0x7b6a('0x38')]:_0x566434[_0x7b6a('0x34')];if(_0x54fe12[_0x7b6a('0x35')][_0x7b6a('0x42')]){_0x5e2331[_0x7b6a('0x43')]=[{'all':!![]}];}_0x5e2331=_['merge']({},_0x5e2331,_0x54fe12['options']);return db[_0x7b6a('0x2f')][_0x7b6a('0x4b')](_0x5e2331)[_0x7b6a('0x28')](handleEntityNotFound(_0x11ac65,null))[_0x7b6a('0x28')](respondWithResult(_0x11ac65,null))['catch'](handleError(_0x11ac65,null));};exports[_0x7b6a('0x4c')]=function(_0xcaec43,_0x423e92){return db[_0x7b6a('0x2f')][_0x7b6a('0x4c')](_0xcaec43['body'],{})[_0x7b6a('0x28')](respondWithResult(_0x423e92,0xc9))[_0x7b6a('0x46')](handleError(_0x423e92,null));};exports[_0x7b6a('0x4d')]=function(_0x3ac714,_0x47531b){return db[_0x7b6a('0x2f')][_0x7b6a('0x4d')](_0x3ac714['body'],{'raw':![],'individualHooks':!![]})[_0x7b6a('0x28')](respondWithResult(_0x47531b,0xc9))[_0x7b6a('0x46')](handleError(_0x47531b,null));};exports[_0x7b6a('0x27')]=function(_0x189e87,_0xa21ed3){if(_0x189e87[_0x7b6a('0x4e')]['id']){delete _0x189e87[_0x7b6a('0x4e')]['id'];}return db[_0x7b6a('0x2f')][_0x7b6a('0x4b')]({'where':{'id':_0x189e87[_0x7b6a('0x48')]['id']}})[_0x7b6a('0x28')](handleEntityNotFound(_0xa21ed3,null))['then'](saveUpdates(_0x189e87[_0x7b6a('0x4e')],null))['then'](respondWithResult(_0xa21ed3,null))[_0x7b6a('0x46')](handleError(_0xa21ed3,null));};exports[_0x7b6a('0x29')]=function(_0xa8d595,_0x548408){return db[_0x7b6a('0x2f')][_0x7b6a('0x4b')]({'where':{'id':_0xa8d595[_0x7b6a('0x48')]['id']}})[_0x7b6a('0x28')](handleEntityNotFound(_0x548408,null))['then'](removeEntity(_0x548408,null))['catch'](handleError(_0x548408,null));};exports[_0x7b6a('0x4f')]=function(_0x3d7ede,_0xc93eff){return db[_0x7b6a('0x2f')][_0x7b6a('0x29')]({'where':{'id':_0x3d7ede[_0x7b6a('0x35')][_0x7b6a('0x50')]||[]},'raw':![],'individualHooks':!![]})[_0x7b6a('0x28')](respondWithResult(_0xc93eff,0xcc))[_0x7b6a('0x46')](handleError(_0xc93eff,null));};exports['addFields']=function(_0x2d13f3,_0x2fb96a,_0x936728){return db[_0x7b6a('0x51')][_0x7b6a('0x52')]({'where':{'id':_0x2d13f3[_0x7b6a('0x48')]['id']}})[_0x7b6a('0x28')](handleEntityNotFound(_0x2fb96a,null))[_0x7b6a('0x28')](function(_0x2b4312){if(_0x2b4312){return db[_0x7b6a('0x53')][_0x7b6a('0x54')](function(_0x2f900f){return db['AnalyticFieldReport']['destroy']({'where':{'CustomReportId':_0x2d13f3['params']['id']},'transaction':_0x2f900f})[_0x7b6a('0x28')](function(_0x2a7bd2){var _0x1f40bb=_['map'](_0x2d13f3[_0x7b6a('0x4e')],function(_0x18532e){delete _0x18532e['id'];_0x18532e[_0x7b6a('0x55')]=_0x2d13f3[_0x7b6a('0x48')]['id'];return _0x18532e;});return db[_0x7b6a('0x2f')][_0x7b6a('0x4d')](_0x1f40bb,{'transaction':_0x2f900f});});})['then'](function(){return db[_0x7b6a('0x2f')][_0x7b6a('0x44')]({'where':{'CustomReportId':_0x2d13f3['params']['id']}});});}})['then'](respondWithResult(_0x2fb96a,null))['catch'](handleError(_0x2fb96a,null));}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.model.js b/server/api/analyticFieldReport/analyticFieldReport.model.js index af01f2f..8bfb1f4 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 _0xc511=['../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','./analyticFieldReport.attributes','exports','AnalyticFieldReport','analytics_report_fields','lodash','util'];(function(_0x5948a7,_0x944950){var _0x4926e6=function(_0x42c767){while(--_0x42c767){_0x5948a7['push'](_0x5948a7['shift']());}};_0x4926e6(++_0x944950);}(_0xc511,0x166));var _0x1c51=function(_0x18e52b,_0x1fae35){_0x18e52b=_0x18e52b-0x0;var _0x3d3062=_0xc511[_0x18e52b];return _0x3d3062;};'use strict';var _=require(_0x1c51('0x0'));var util=require(_0x1c51('0x1'));var logger=require(_0x1c51('0x2'))('api');var moment=require(_0x1c51('0x3'));var BPromise=require(_0x1c51('0x4'));var rp=require(_0x1c51('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1c51('0x6'));var config=require(_0x1c51('0x7'));var attributes=require(_0x1c51('0x8'));module[_0x1c51('0x9')]=function(_0x21d241,_0x399d5d){return _0x21d241['define'](_0x1c51('0xa'),attributes,{'tableName':_0x1c51('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1346=['path','rimraf','../../config/environment','./analyticFieldReport.attributes','exports','define','AnalyticFieldReport','analytics_report_fields','lodash','util','../../config/logger','moment','bluebird','request-promise'];(function(_0x36a7cf,_0x2dfa31){var _0x4862ec=function(_0x4b8fd1){while(--_0x4b8fd1){_0x36a7cf['push'](_0x36a7cf['shift']());}};_0x4862ec(++_0x2dfa31);}(_0x1346,0xf6));var _0x6134=function(_0xf44ff2,_0x5e9e66){_0xf44ff2=_0xf44ff2-0x0;var _0x241096=_0x1346[_0xf44ff2];return _0x241096;};'use strict';var _=require(_0x6134('0x0'));var util=require(_0x6134('0x1'));var logger=require(_0x6134('0x2'))('api');var moment=require(_0x6134('0x3'));var BPromise=require(_0x6134('0x4'));var rp=require(_0x6134('0x5'));var fs=require('fs');var path=require(_0x6134('0x6'));var rimraf=require(_0x6134('0x7'));var config=require(_0x6134('0x8'));var attributes=require(_0x6134('0x9'));module[_0x6134('0xa')]=function(_0x50e981,_0x4b8d61){return _0x50e981[_0x6134('0xb')](_0x6134('0xc'),attributes,{'tableName':_0x6134('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.rpc.js b/server/api/analyticFieldReport/analyticFieldReport.rpc.js index 1a2c8b8..931db44 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 _0x37fb=['error','code','message','result','catch','util','moment','bluebird','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request','then','info','AnalyticFieldReport,\x20%s,\x20%s','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x2a6809,_0x44edde){var _0x11c371=function(_0x1a4888){while(--_0x1a4888){_0x2a6809['push'](_0x2a6809['shift']());}};_0x11c371(++_0x44edde);}(_0x37fb,0xec));var _0xb37f=function(_0x436ed4,_0x1fb74b){_0x436ed4=_0x436ed4-0x0;var _0x560ac7=_0x37fb[_0x436ed4];return _0x560ac7;};'use strict';var _=require('lodash');var util=require(_0xb37f('0x0'));var moment=require(_0xb37f('0x1'));var BPromise=require(_0xb37f('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb37f('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xb37f('0x4'))(_0xb37f('0x5'));var config=require(_0xb37f('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xb37f('0x7')][_0xb37f('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x256866,_0x6029e4,_0x374a43){return new BPromise(function(_0x172283,_0x80ac6){return client[_0xb37f('0x9')](_0x256866,_0x374a43)[_0xb37f('0xa')](function(_0x89f253){logger[_0xb37f('0xb')](_0xb37f('0xc'),_0x6029e4,'request\x20sent');logger['debug'](_0xb37f('0xd'),_0x6029e4,_0xb37f('0xe'),JSON[_0xb37f('0xf')](_0x89f253));if(_0x89f253[_0xb37f('0x10')]){if(_0x89f253[_0xb37f('0x10')][_0xb37f('0x11')]===0x1f4){logger[_0xb37f('0x10')](_0xb37f('0xc'),_0x6029e4,_0x89f253['error']['message']);return _0x80ac6(_0x89f253[_0xb37f('0x10')][_0xb37f('0x12')]);}logger[_0xb37f('0x10')](_0xb37f('0xc'),_0x6029e4,_0x89f253[_0xb37f('0x10')][_0xb37f('0x12')]);return _0x172283(_0x89f253[_0xb37f('0x10')]['message']);}else{logger['info'](_0xb37f('0xc'),_0x6029e4,_0xb37f('0xe'));_0x172283(_0x89f253[_0xb37f('0x13')]['message']);}})[_0xb37f('0x14')](function(_0x5c34a5){logger['error'](_0xb37f('0xc'),_0x6029e4,_0x5c34a5);_0x80ac6(_0x5c34a5);});});} \ No newline at end of file +var _0x7a1f=['client','http','request','then','info','AnalyticFieldReport,\x20%s,\x20%s','request\x20sent','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','randomstring','../../mysqldb','../../config/logger','../../config/environment','jayson/promise'];(function(_0x2034d2,_0x59d479){var _0x2b99af=function(_0x322771){while(--_0x322771){_0x2034d2['push'](_0x2034d2['shift']());}};_0x2b99af(++_0x59d479);}(_0x7a1f,0x134));var _0xf7a1=function(_0x11946c,_0x12152c){_0x11946c=_0x11946c-0x0;var _0x383935=_0x7a1f[_0x11946c];return _0x383935;};'use strict';var _=require(_0xf7a1('0x0'));var util=require(_0xf7a1('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xf7a1('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf7a1('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xf7a1('0x4'))('rpc');var config=require(_0xf7a1('0x5'));var jayson=require(_0xf7a1('0x6'));var client=jayson[_0xf7a1('0x7')][_0xf7a1('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xe76d88,_0x169f3c,_0x4ae197){return new BPromise(function(_0x9ed9c2,_0x104700){return client[_0xf7a1('0x9')](_0xe76d88,_0x4ae197)[_0xf7a1('0xa')](function(_0x234691){logger[_0xf7a1('0xb')](_0xf7a1('0xc'),_0x169f3c,_0xf7a1('0xd'));logger['debug'](_0xf7a1('0xe'),_0x169f3c,'request\x20sent',JSON[_0xf7a1('0xf')](_0x234691));if(_0x234691['error']){if(_0x234691[_0xf7a1('0x10')][_0xf7a1('0x11')]===0x1f4){logger['error']('AnalyticFieldReport,\x20%s,\x20%s',_0x169f3c,_0x234691[_0xf7a1('0x10')][_0xf7a1('0x12')]);return _0x104700(_0x234691['error']['message']);}logger[_0xf7a1('0x10')]('AnalyticFieldReport,\x20%s,\x20%s',_0x169f3c,_0x234691[_0xf7a1('0x10')][_0xf7a1('0x12')]);return _0x9ed9c2(_0x234691['error'][_0xf7a1('0x12')]);}else{logger[_0xf7a1('0xb')](_0xf7a1('0xc'),_0x169f3c,_0xf7a1('0xd'));_0x9ed9c2(_0x234691[_0xf7a1('0x13')][_0xf7a1('0x12')]);}})[_0xf7a1('0x14')](function(_0x28a43e){logger[_0xf7a1('0x10')](_0xf7a1('0xc'),_0x169f3c,_0x28a43e);_0x104700(_0x28a43e);});});} \ No newline at end of file diff --git a/server/api/analyticFieldReport/index.js b/server/api/analyticFieldReport/index.js index 0b489ad..cb74356 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(_0x5cd7be,_0x255740){var _0x527e37=function(_0x3eb157){while(--_0x3eb157){_0x5cd7be['push'](_0x5cd7be['shift']());}};_0x527e37(++_0x255740);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1ddedd,_0x485606){_0x1ddedd=_0x1ddedd-0x0;var _0xa3e1ac=_0xa9e0[_0x1ddedd];return _0xa3e1ac;};'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(_0x276999,_0x786d6f){var _0x4ac783=function(_0x38ecc2){while(--_0x38ecc2){_0x276999['push'](_0x276999['shift']());}};_0x4ac783(++_0x786d6f);}(_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('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 3a3006a..021e770 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 _0xd820=['exports','name','STRING','sequelize'];(function(_0x134f16,_0x148d1e){var _0x506c95=function(_0x257667){while(--_0x257667){_0x134f16['push'](_0x134f16['shift']());}};_0x506c95(++_0x148d1e);}(_0xd820,0x16f));var _0x0d82=function(_0x34cafa,_0x251fc9){_0x34cafa=_0x34cafa-0x0;var _0x2741d1=_0xd820[_0x34cafa];return _0x2741d1;};'use strict';var Sequelize=require(_0x0d82('0x0'));module[_0x0d82('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x0d82('0x2')},'table':{'type':Sequelize[_0x0d82('0x3')]},'metric':{'type':Sequelize['TEXT']},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xd8b0=['STRING','sequelize','exports','TEXT'];(function(_0x2c341e,_0x414d11){var _0x43c1e8=function(_0xe783f3){while(--_0xe783f3){_0x2c341e['push'](_0x2c341e['shift']());}};_0x43c1e8(++_0x414d11);}(_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'},'table':{'type':Sequelize['STRING']},'metric':{'type':Sequelize[_0x0d8b('0x2')]},'description':{'type':Sequelize[_0x0d8b('0x3')]}}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.controller.js b/server/api/analyticMetric/analyticMetric.controller.js index cfe5f35..7d082a8 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 _0x8ef6=['../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','set','Content-Range','apply','reject','save','then','destroy','get','UserProfileResource','error','stack','name','index','map','fieldName','key','model','keys','query','intersection','attributes','length','hasOwnProperty','order','sort','where','filters','filter','merge','type','VIRTUAL','options','AnalyticMetric','count','includeAll','include','findAll','rows','catch','show','params','rawAttributes','fields','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Metrics','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0x2a8554,_0x2c15cb){var _0x1d14ad=function(_0x404580){while(--_0x404580){_0x2a8554['push'](_0x2a8554['shift']());}};_0x1d14ad(++_0x2c15cb);}(_0x8ef6,0xf2));var _0x68ef=function(_0x4a00cc,_0x297247){_0x4a00cc=_0x4a00cc-0x0;var _0x179c2a=_0x8ef6[_0x4a00cc];return _0x179c2a;};'use strict';var emlformat=require(_0x68ef('0x0'));var rimraf=require(_0x68ef('0x1'));var zipdir=require(_0x68ef('0x2'));var jsonpatch=require(_0x68ef('0x3'));var rp=require(_0x68ef('0x4'));var moment=require(_0x68ef('0x5'));var BPromise=require(_0x68ef('0x6'));var Mustache=require('mustache');var util=require(_0x68ef('0x7'));var path=require(_0x68ef('0x8'));var sox=require(_0x68ef('0x9'));var csv=require(_0x68ef('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x68ef('0xb'));var squel=require(_0x68ef('0xc'));var crypto=require(_0x68ef('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x68ef('0xe'));var toCsv=require(_0x68ef('0xa'));var querystring=require(_0x68ef('0xf'));var Papa=require(_0x68ef('0x10'));var Redis=require(_0x68ef('0x11'));var authService=require(_0x68ef('0x12'));var qs=require(_0x68ef('0x13'));var as=require(_0x68ef('0x14'));var hardwareService=require(_0x68ef('0x15'));var logger=require(_0x68ef('0x16'))(_0x68ef('0x17'));var utils=require(_0x68ef('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x68ef('0x19'));var db=require(_0x68ef('0x1a'))['db'];function respondWithStatusCode(_0x1e117a,_0x454ef4){_0x454ef4=_0x454ef4||0xcc;return function(_0x40f253){if(_0x40f253){return _0x1e117a[_0x68ef('0x1b')](_0x454ef4);}return _0x1e117a['status'](_0x454ef4)[_0x68ef('0x1c')]();};}function respondWithResult(_0xc50cce,_0x2657c5){_0x2657c5=_0x2657c5||0xc8;return function(_0x47fbb5){if(_0x47fbb5){return _0xc50cce[_0x68ef('0x1d')](_0x2657c5)[_0x68ef('0x1e')](_0x47fbb5);}};}function respondWithFilteredResult(_0x24682d,_0x5005ba){return function(_0x35493d){if(_0x35493d){var _0x37c4cc=typeof _0x5005ba[_0x68ef('0x1f')]===_0x68ef('0x20')&&typeof _0x5005ba['limit']===_0x68ef('0x20');var _0x54139e=_0x35493d['count'];var _0x2633c1=_0x37c4cc?0x0:_0x5005ba[_0x68ef('0x1f')];var _0x4ade0d=_0x37c4cc?_0x35493d['count']:_0x5005ba[_0x68ef('0x1f')]+_0x5005ba[_0x68ef('0x21')];var _0x318514;if(_0x4ade0d>=_0x54139e){_0x4ade0d=_0x54139e;_0x318514=0xc8;}else{_0x318514=0xce;}_0x24682d['status'](_0x318514);return _0x24682d[_0x68ef('0x22')](_0x68ef('0x23'),_0x2633c1+'-'+_0x4ade0d+'/'+_0x54139e)[_0x68ef('0x1e')](_0x35493d);}return null;};}function patchUpdates(_0x5b246b){return function(_0x3c46d4){try{jsonpatch[_0x68ef('0x24')](_0x3c46d4,_0x5b246b,!![]);}catch(_0x5af19f){return BPromise[_0x68ef('0x25')](_0x5af19f);}return _0x3c46d4[_0x68ef('0x26')]();};}function saveUpdates(_0x19aa3d,_0x5ddec7){return function(_0x59723c){if(_0x59723c){return _0x59723c['update'](_0x19aa3d)[_0x68ef('0x27')](function(_0x2023f2){return _0x2023f2;});}return null;};}function removeEntity(_0x312cc9,_0x2e6e39){return function(_0x438b4c){if(_0x438b4c){return _0x438b4c[_0x68ef('0x28')]()[_0x68ef('0x27')](function(){var _0x49374f=_0x438b4c[_0x68ef('0x29')]({'plain':!![]});var _0x13280b='Metrics';return db[_0x68ef('0x2a')]['destroy']({'where':{'type':_0x13280b,'resourceId':_0x49374f['id']}})['then'](function(){return _0x438b4c;});})['then'](function(){_0x312cc9[_0x68ef('0x1d')](0xcc)[_0x68ef('0x1c')]();});}};}function handleEntityNotFound(_0x123041,_0x29518e){return function(_0x52e67e){if(!_0x52e67e){_0x123041['sendStatus'](0x194);}return _0x52e67e;};}function handleError(_0x1cbe4f,_0x28907a){_0x28907a=_0x28907a||0x1f4;return function(_0x7bf96){logger[_0x68ef('0x2b')](_0x7bf96[_0x68ef('0x2c')]);if(_0x7bf96[_0x68ef('0x2d')]){delete _0x7bf96[_0x68ef('0x2d')];}_0x1cbe4f[_0x68ef('0x1d')](_0x28907a)['send'](_0x7bf96);};}exports[_0x68ef('0x2e')]=function(_0x4314bd,_0x132d9e){var _0x4c25aa={},_0x370a8f={},_0x523120={'count':0x0,'rows':[]};var _0x133788=_[_0x68ef('0x2f')](db['AnalyticMetric']['rawAttributes'],function(_0x159395){return{'name':_0x159395[_0x68ef('0x30')],'type':_0x159395['type'][_0x68ef('0x31')]};});_0x370a8f[_0x68ef('0x32')]=_[_0x68ef('0x2f')](_0x133788,_0x68ef('0x2d'));_0x370a8f['query']=_[_0x68ef('0x33')](_0x4314bd[_0x68ef('0x34')]);_0x370a8f['filters']=_[_0x68ef('0x35')](_0x370a8f['model'],_0x370a8f[_0x68ef('0x34')]);_0x4c25aa[_0x68ef('0x36')]=_['intersection'](_0x370a8f[_0x68ef('0x32')],qs['fields'](_0x4314bd[_0x68ef('0x34')]['fields']));_0x4c25aa[_0x68ef('0x36')]=_0x4c25aa[_0x68ef('0x36')][_0x68ef('0x37')]?_0x4c25aa['attributes']:_0x370a8f[_0x68ef('0x32')];if(!_0x4314bd['query'][_0x68ef('0x38')]('nolimit')){_0x4c25aa[_0x68ef('0x21')]=qs[_0x68ef('0x21')](_0x4314bd[_0x68ef('0x34')][_0x68ef('0x21')]);_0x4c25aa[_0x68ef('0x1f')]=qs[_0x68ef('0x1f')](_0x4314bd['query'][_0x68ef('0x1f')]);}_0x4c25aa[_0x68ef('0x39')]=qs[_0x68ef('0x3a')](_0x4314bd['query'][_0x68ef('0x3a')]);_0x4c25aa[_0x68ef('0x3b')]=qs[_0x68ef('0x3c')](_['pick'](_0x4314bd['query'],_0x370a8f[_0x68ef('0x3c')]),_0x133788);if(_0x4314bd[_0x68ef('0x34')][_0x68ef('0x3d')]){_0x4c25aa[_0x68ef('0x3b')]=_[_0x68ef('0x3e')](_0x4c25aa[_0x68ef('0x3b')],{'$or':_[_0x68ef('0x2f')](_0x133788,function(_0x5b1246){if(_0x5b1246[_0x68ef('0x3f')]!==_0x68ef('0x40')){var _0x2f6ee0={};_0x2f6ee0[_0x5b1246[_0x68ef('0x2d')]]={'$like':'%'+_0x4314bd['query'][_0x68ef('0x3d')]+'%'};return _0x2f6ee0;}})});}_0x4c25aa=_[_0x68ef('0x3e')]({},_0x4c25aa,_0x4314bd[_0x68ef('0x41')]);var _0x410c10={'where':_0x4c25aa[_0x68ef('0x3b')]};return db[_0x68ef('0x42')]['count'](_0x410c10)[_0x68ef('0x27')](function(_0x3f7699){_0x523120[_0x68ef('0x43')]=_0x3f7699;if(_0x4314bd[_0x68ef('0x34')][_0x68ef('0x44')]){_0x4c25aa[_0x68ef('0x45')]=[{'all':!![]}];}return db[_0x68ef('0x42')][_0x68ef('0x46')](_0x4c25aa);})[_0x68ef('0x27')](function(_0x531096){_0x523120[_0x68ef('0x47')]=_0x531096;return _0x523120;})[_0x68ef('0x27')](respondWithFilteredResult(_0x132d9e,_0x4c25aa))[_0x68ef('0x48')](handleError(_0x132d9e,null));};exports[_0x68ef('0x49')]=function(_0xdeacf2,_0x183377){var _0xcac58f={'raw':!![],'where':{'id':_0xdeacf2[_0x68ef('0x4a')]['id']}},_0x576767={};_0x576767['model']=_[_0x68ef('0x33')](db[_0x68ef('0x42')][_0x68ef('0x4b')]);_0x576767[_0x68ef('0x34')]=_['keys'](_0xdeacf2[_0x68ef('0x34')]);_0x576767['filters']=_[_0x68ef('0x35')](_0x576767['model'],_0x576767[_0x68ef('0x34')]);_0xcac58f[_0x68ef('0x36')]=_[_0x68ef('0x35')](_0x576767['model'],qs['fields'](_0xdeacf2[_0x68ef('0x34')][_0x68ef('0x4c')]));_0xcac58f['attributes']=_0xcac58f['attributes']['length']?_0xcac58f[_0x68ef('0x36')]:_0x576767[_0x68ef('0x32')];if(_0xdeacf2[_0x68ef('0x34')][_0x68ef('0x44')]){_0xcac58f[_0x68ef('0x45')]=[{'all':!![]}];}_0xcac58f=_['merge']({},_0xcac58f,_0xdeacf2['options']);return db[_0x68ef('0x42')][_0x68ef('0x4d')](_0xcac58f)[_0x68ef('0x27')](handleEntityNotFound(_0x183377,null))[_0x68ef('0x27')](respondWithResult(_0x183377,null))['catch'](handleError(_0x183377,null));};exports[_0x68ef('0x4e')]=function(_0x474e5a,_0x1c9b6f){return db[_0x68ef('0x42')]['create'](_0x474e5a['body'],{})[_0x68ef('0x27')](function(_0x3c3074){var _0x566e7c=_0x474e5a[_0x68ef('0x4f')][_0x68ef('0x29')]({'plain':!![]});if(!_0x566e7c)throw new Error(_0x68ef('0x50'));if(_0x566e7c[_0x68ef('0x51')]===_0x68ef('0x4f')){var _0x4f0f77=_0x3c3074[_0x68ef('0x29')]({'plain':!![]});var _0x3984ca=_0x68ef('0x52');return db['UserProfileSection'][_0x68ef('0x4d')]({'where':{'name':_0x3984ca,'userProfileId':_0x566e7c[_0x68ef('0x53')]},'raw':!![]})[_0x68ef('0x27')](function(_0x50ef1f){if(_0x50ef1f&&_0x50ef1f[_0x68ef('0x54')]===0x0){return db['UserProfileResource']['create']({'name':_0x4f0f77[_0x68ef('0x2d')],'resourceId':_0x4f0f77['id'],'type':_0x50ef1f['name'],'sectionId':_0x50ef1f['id']},{})[_0x68ef('0x27')](function(){return _0x3c3074;});}else{return _0x3c3074;}})[_0x68ef('0x48')](function(_0x53ebd){logger[_0x68ef('0x2b')](_0x68ef('0x55'),_0x53ebd);throw _0x53ebd;});}return _0x3c3074;})[_0x68ef('0x27')](respondWithResult(_0x1c9b6f,0xc9))[_0x68ef('0x48')](handleError(_0x1c9b6f,null));};exports[_0x68ef('0x56')]=function(_0x2b35f4,_0x247915){if(_0x2b35f4['body']['id']){delete _0x2b35f4['body']['id'];}return db[_0x68ef('0x42')][_0x68ef('0x4d')]({'where':{'id':_0x2b35f4[_0x68ef('0x4a')]['id']}})[_0x68ef('0x27')](handleEntityNotFound(_0x247915,null))[_0x68ef('0x27')](saveUpdates(_0x2b35f4[_0x68ef('0x57')],null))[_0x68ef('0x27')](respondWithResult(_0x247915,null))[_0x68ef('0x48')](handleError(_0x247915,null));};exports[_0x68ef('0x28')]=function(_0x4c2e9c,_0x5685bb){return db[_0x68ef('0x42')]['find']({'where':{'id':_0x4c2e9c[_0x68ef('0x4a')]['id']}})['then'](handleEntityNotFound(_0x5685bb,null))[_0x68ef('0x27')](removeEntity(_0x5685bb,null))[_0x68ef('0x48')](handleError(_0x5685bb,null));}; \ No newline at end of file +var _0x8d0e=['then','get','Metrics','UserProfileResource','end','sendStatus','error','stack','name','send','AnalyticMetric','fieldName','type','key','model','query','keys','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','rawAttributes','fields','find','catch','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','undefined','limit','offset','count','set','apply','reject','save','update','destroy'];(function(_0x1f88d4,_0x3f2a9c){var _0x31970d=function(_0x439a8a){while(--_0x439a8a){_0x1f88d4['push'](_0x1f88d4['shift']());}};_0x31970d(++_0x3f2a9c);}(_0x8d0e,0x1d7));var _0xe8d0=function(_0x1fa400,_0x850a42){_0x1fa400=_0x1fa400-0x0;var _0x65cddc=_0x8d0e[_0x1fa400];return _0x65cddc;};'use strict';var emlformat=require(_0xe8d0('0x0'));var rimraf=require(_0xe8d0('0x1'));var zipdir=require(_0xe8d0('0x2'));var jsonpatch=require(_0xe8d0('0x3'));var rp=require(_0xe8d0('0x4'));var moment=require(_0xe8d0('0x5'));var BPromise=require(_0xe8d0('0x6'));var Mustache=require(_0xe8d0('0x7'));var util=require(_0xe8d0('0x8'));var path=require('path');var sox=require(_0xe8d0('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe8d0('0xa'));var _=require(_0xe8d0('0xb'));var squel=require(_0xe8d0('0xc'));var crypto=require(_0xe8d0('0xd'));var jsforce=require(_0xe8d0('0xe'));var deskjs=require(_0xe8d0('0xf'));var toCsv=require(_0xe8d0('0x10'));var querystring=require(_0xe8d0('0x11'));var Papa=require('papaparse');var Redis=require(_0xe8d0('0x12'));var authService=require(_0xe8d0('0x13'));var qs=require(_0xe8d0('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xe8d0('0x15'))(_0xe8d0('0x16'));var utils=require(_0xe8d0('0x17'));var config=require(_0xe8d0('0x18'));var licenseUtil=require(_0xe8d0('0x19'));var db=require(_0xe8d0('0x1a'))['db'];function respondWithStatusCode(_0x5934b2,_0x38fac0){_0x38fac0=_0x38fac0||0xcc;return function(_0x15b9e5){if(_0x15b9e5){return _0x5934b2['sendStatus'](_0x38fac0);}return _0x5934b2[_0xe8d0('0x1b')](_0x38fac0)['end']();};}function respondWithResult(_0x59b4b7,_0x90a1ea){_0x90a1ea=_0x90a1ea||0xc8;return function(_0x2aa906){if(_0x2aa906){return _0x59b4b7[_0xe8d0('0x1b')](_0x90a1ea)[_0xe8d0('0x1c')](_0x2aa906);}};}function respondWithFilteredResult(_0x15d3a1,_0x7151c6){return function(_0x52818a){if(_0x52818a){var _0x6ccffa=typeof _0x7151c6['offset']===_0xe8d0('0x1d')&&typeof _0x7151c6[_0xe8d0('0x1e')]===_0xe8d0('0x1d');var _0x4d1db4=_0x52818a['count'];var _0x47c67a=_0x6ccffa?0x0:_0x7151c6[_0xe8d0('0x1f')];var _0x384854=_0x6ccffa?_0x52818a[_0xe8d0('0x20')]:_0x7151c6[_0xe8d0('0x1f')]+_0x7151c6[_0xe8d0('0x1e')];var _0x588133;if(_0x384854>=_0x4d1db4){_0x384854=_0x4d1db4;_0x588133=0xc8;}else{_0x588133=0xce;}_0x15d3a1[_0xe8d0('0x1b')](_0x588133);return _0x15d3a1[_0xe8d0('0x21')]('Content-Range',_0x47c67a+'-'+_0x384854+'/'+_0x4d1db4)['json'](_0x52818a);}return null;};}function patchUpdates(_0x554402){return function(_0x384a60){try{jsonpatch[_0xe8d0('0x22')](_0x384a60,_0x554402,!![]);}catch(_0x25363b){return BPromise[_0xe8d0('0x23')](_0x25363b);}return _0x384a60[_0xe8d0('0x24')]();};}function saveUpdates(_0x23a945,_0x1bd25c){return function(_0x28a6b5){if(_0x28a6b5){return _0x28a6b5[_0xe8d0('0x25')](_0x23a945)['then'](function(_0xed8f2e){return _0xed8f2e;});}return null;};}function removeEntity(_0x9f747,_0x572c25){return function(_0x106614){if(_0x106614){return _0x106614[_0xe8d0('0x26')]()[_0xe8d0('0x27')](function(){var _0xd86c76=_0x106614[_0xe8d0('0x28')]({'plain':!![]});var _0x149dfd=_0xe8d0('0x29');return db[_0xe8d0('0x2a')][_0xe8d0('0x26')]({'where':{'type':_0x149dfd,'resourceId':_0xd86c76['id']}})[_0xe8d0('0x27')](function(){return _0x106614;});})[_0xe8d0('0x27')](function(){_0x9f747['status'](0xcc)[_0xe8d0('0x2b')]();});}};}function handleEntityNotFound(_0x26dd52,_0x10dec2){return function(_0x486f49){if(!_0x486f49){_0x26dd52[_0xe8d0('0x2c')](0x194);}return _0x486f49;};}function handleError(_0x343b08,_0x526240){_0x526240=_0x526240||0x1f4;return function(_0x1519e2){logger[_0xe8d0('0x2d')](_0x1519e2[_0xe8d0('0x2e')]);if(_0x1519e2[_0xe8d0('0x2f')]){delete _0x1519e2[_0xe8d0('0x2f')];}_0x343b08['status'](_0x526240)[_0xe8d0('0x30')](_0x1519e2);};}exports['index']=function(_0x5d3276,_0x50ad3c){var _0x547a2b={},_0x13cd4c={},_0x36ccec={'count':0x0,'rows':[]};var _0x5151fa=_['map'](db[_0xe8d0('0x31')]['rawAttributes'],function(_0x3b5d31){return{'name':_0x3b5d31[_0xe8d0('0x32')],'type':_0x3b5d31[_0xe8d0('0x33')][_0xe8d0('0x34')]};});_0x13cd4c[_0xe8d0('0x35')]=_['map'](_0x5151fa,_0xe8d0('0x2f'));_0x13cd4c[_0xe8d0('0x36')]=_[_0xe8d0('0x37')](_0x5d3276[_0xe8d0('0x36')]);_0x13cd4c['filters']=_[_0xe8d0('0x38')](_0x13cd4c[_0xe8d0('0x35')],_0x13cd4c['query']);_0x547a2b[_0xe8d0('0x39')]=_['intersection'](_0x13cd4c[_0xe8d0('0x35')],qs['fields'](_0x5d3276[_0xe8d0('0x36')]['fields']));_0x547a2b[_0xe8d0('0x39')]=_0x547a2b[_0xe8d0('0x39')][_0xe8d0('0x3a')]?_0x547a2b[_0xe8d0('0x39')]:_0x13cd4c['model'];if(!_0x5d3276[_0xe8d0('0x36')][_0xe8d0('0x3b')](_0xe8d0('0x3c'))){_0x547a2b['limit']=qs[_0xe8d0('0x1e')](_0x5d3276[_0xe8d0('0x36')][_0xe8d0('0x1e')]);_0x547a2b[_0xe8d0('0x1f')]=qs[_0xe8d0('0x1f')](_0x5d3276['query'][_0xe8d0('0x1f')]);}_0x547a2b[_0xe8d0('0x3d')]=qs[_0xe8d0('0x3e')](_0x5d3276[_0xe8d0('0x36')][_0xe8d0('0x3e')]);_0x547a2b[_0xe8d0('0x3f')]=qs[_0xe8d0('0x40')](_[_0xe8d0('0x41')](_0x5d3276['query'],_0x13cd4c['filters']),_0x5151fa);if(_0x5d3276[_0xe8d0('0x36')][_0xe8d0('0x42')]){_0x547a2b[_0xe8d0('0x3f')]=_[_0xe8d0('0x43')](_0x547a2b[_0xe8d0('0x3f')],{'$or':_['map'](_0x5151fa,function(_0x2e4362){if(_0x2e4362['type']!==_0xe8d0('0x44')){var _0x458294={};_0x458294[_0x2e4362[_0xe8d0('0x2f')]]={'$like':'%'+_0x5d3276['query'][_0xe8d0('0x42')]+'%'};return _0x458294;}})});}_0x547a2b=_[_0xe8d0('0x43')]({},_0x547a2b,_0x5d3276[_0xe8d0('0x45')]);var _0x230a90={'where':_0x547a2b[_0xe8d0('0x3f')]};return db['AnalyticMetric']['count'](_0x230a90)['then'](function(_0x4cf0da){_0x36ccec[_0xe8d0('0x20')]=_0x4cf0da;if(_0x5d3276['query'][_0xe8d0('0x46')]){_0x547a2b[_0xe8d0('0x47')]=[{'all':!![]}];}return db[_0xe8d0('0x31')][_0xe8d0('0x48')](_0x547a2b);})[_0xe8d0('0x27')](function(_0x1156da){_0x36ccec[_0xe8d0('0x49')]=_0x1156da;return _0x36ccec;})[_0xe8d0('0x27')](respondWithFilteredResult(_0x50ad3c,_0x547a2b))['catch'](handleError(_0x50ad3c,null));};exports[_0xe8d0('0x4a')]=function(_0x1da8b2,_0x4a3740){var _0x4bcdff={'raw':!![],'where':{'id':_0x1da8b2[_0xe8d0('0x4b')]['id']}},_0x3825a1={};_0x3825a1[_0xe8d0('0x35')]=_['keys'](db[_0xe8d0('0x31')][_0xe8d0('0x4c')]);_0x3825a1['query']=_[_0xe8d0('0x37')](_0x1da8b2[_0xe8d0('0x36')]);_0x3825a1['filters']=_[_0xe8d0('0x38')](_0x3825a1[_0xe8d0('0x35')],_0x3825a1[_0xe8d0('0x36')]);_0x4bcdff[_0xe8d0('0x39')]=_[_0xe8d0('0x38')](_0x3825a1[_0xe8d0('0x35')],qs[_0xe8d0('0x4d')](_0x1da8b2[_0xe8d0('0x36')]['fields']));_0x4bcdff[_0xe8d0('0x39')]=_0x4bcdff[_0xe8d0('0x39')][_0xe8d0('0x3a')]?_0x4bcdff[_0xe8d0('0x39')]:_0x3825a1[_0xe8d0('0x35')];if(_0x1da8b2[_0xe8d0('0x36')][_0xe8d0('0x46')]){_0x4bcdff[_0xe8d0('0x47')]=[{'all':!![]}];}_0x4bcdff=_[_0xe8d0('0x43')]({},_0x4bcdff,_0x1da8b2[_0xe8d0('0x45')]);return db[_0xe8d0('0x31')][_0xe8d0('0x4e')](_0x4bcdff)['then'](handleEntityNotFound(_0x4a3740,null))[_0xe8d0('0x27')](respondWithResult(_0x4a3740,null))[_0xe8d0('0x4f')](handleError(_0x4a3740,null));};exports[_0xe8d0('0x50')]=function(_0xad7d94,_0x34047c){return db[_0xe8d0('0x31')][_0xe8d0('0x50')](_0xad7d94['body'],{})[_0xe8d0('0x27')](function(_0x424764){var _0x151cf4=_0xad7d94[_0xe8d0('0x51')]['get']({'plain':!![]});if(!_0x151cf4)throw new Error(_0xe8d0('0x52'));if(_0x151cf4['role']===_0xe8d0('0x51')){var _0x382ae9=_0x424764[_0xe8d0('0x28')]({'plain':!![]});var _0x158d24=_0xe8d0('0x29');return db[_0xe8d0('0x53')][_0xe8d0('0x4e')]({'where':{'name':_0x158d24,'userProfileId':_0x151cf4['userProfileId']},'raw':!![]})[_0xe8d0('0x27')](function(_0x55f93d){if(_0x55f93d&&_0x55f93d['autoAssociation']===0x0){return db[_0xe8d0('0x2a')]['create']({'name':_0x382ae9[_0xe8d0('0x2f')],'resourceId':_0x382ae9['id'],'type':_0x55f93d['name'],'sectionId':_0x55f93d['id']},{})[_0xe8d0('0x27')](function(){return _0x424764;});}else{return _0x424764;}})[_0xe8d0('0x4f')](function(_0x13713c){logger[_0xe8d0('0x2d')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x13713c);throw _0x13713c;});}return _0x424764;})[_0xe8d0('0x27')](respondWithResult(_0x34047c,0xc9))[_0xe8d0('0x4f')](handleError(_0x34047c,null));};exports[_0xe8d0('0x25')]=function(_0x2e3f1d,_0x18cc14){if(_0x2e3f1d['body']['id']){delete _0x2e3f1d[_0xe8d0('0x54')]['id'];}return db[_0xe8d0('0x31')][_0xe8d0('0x4e')]({'where':{'id':_0x2e3f1d['params']['id']}})[_0xe8d0('0x27')](handleEntityNotFound(_0x18cc14,null))['then'](saveUpdates(_0x2e3f1d['body'],null))[_0xe8d0('0x27')](respondWithResult(_0x18cc14,null))[_0xe8d0('0x4f')](handleError(_0x18cc14,null));};exports['destroy']=function(_0xcb6ce2,_0x3a8074){return db['AnalyticMetric'][_0xe8d0('0x4e')]({'where':{'id':_0xcb6ce2[_0xe8d0('0x4b')]['id']}})[_0xe8d0('0x27')](handleEntityNotFound(_0x3a8074,null))[_0xe8d0('0x27')](removeEntity(_0x3a8074,null))['catch'](handleError(_0x3a8074,null));}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.model.js b/server/api/analyticMetric/analyticMetric.model.js index fa61d76..9d1caeb 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 _0xbc1c=['path','rimraf','./analyticMetric.attributes','exports','define','AnalyticMetric','util','api','bluebird','request-promise'];(function(_0x37a713,_0x59d661){var _0x4ee6b3=function(_0x22b2dd){while(--_0x22b2dd){_0x37a713['push'](_0x37a713['shift']());}};_0x4ee6b3(++_0x59d661);}(_0xbc1c,0xd8));var _0xcbc1=function(_0x152aa1,_0x307718){_0x152aa1=_0x152aa1-0x0;var _0x1bc01a=_0xbc1c[_0x152aa1];return _0x1bc01a;};'use strict';var _=require('lodash');var util=require(_0xcbc1('0x0'));var logger=require('../../config/logger')(_0xcbc1('0x1'));var moment=require('moment');var BPromise=require(_0xcbc1('0x2'));var rp=require(_0xcbc1('0x3'));var fs=require('fs');var path=require(_0xcbc1('0x4'));var rimraf=require(_0xcbc1('0x5'));var config=require('../../config/environment');var attributes=require(_0xcbc1('0x6'));module[_0xcbc1('0x7')]=function(_0x54c13c,_0x27da8d){return _0x54c13c[_0xcbc1('0x8')](_0xcbc1('0x9'),attributes,{'tableName':'analytics_metrics','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe4d9=['moment','path','rimraf','./analyticMetric.attributes','exports','define','lodash','util','../../config/logger'];(function(_0x1e43f3,_0x842e34){var _0x56f416=function(_0x221a26){while(--_0x221a26){_0x1e43f3['push'](_0x1e43f3['shift']());}};_0x56f416(++_0x842e34);}(_0xe4d9,0x141));var _0x9e4d=function(_0x2c62a1,_0x320c52){_0x2c62a1=_0x2c62a1-0x0;var _0xd6e286=_0xe4d9[_0x2c62a1];return _0xd6e286;};'use strict';var _=require(_0x9e4d('0x0'));var util=require(_0x9e4d('0x1'));var logger=require(_0x9e4d('0x2'))('api');var moment=require(_0x9e4d('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x9e4d('0x4'));var rimraf=require(_0x9e4d('0x5'));var config=require('../../config/environment');var attributes=require(_0x9e4d('0x6'));module[_0x9e4d('0x7')]=function(_0x5a4881,_0x493fb5){return _0x5a4881[_0x9e4d('0x8')]('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 b24ae9a..c9cb516 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 _0x5139=['http','request','then','info','AnalyticMetric,\x20%s,\x20%s','debug','AnalyticMetric,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client'];(function(_0x1dae94,_0x239003){var _0x36ce2d=function(_0x295f18){while(--_0x295f18){_0x1dae94['push'](_0x1dae94['shift']());}};_0x36ce2d(++_0x239003);}(_0x5139,0x183));var _0x9513=function(_0x1c695a,_0x186ab4){_0x1c695a=_0x1c695a-0x0;var _0x38b9e0=_0x5139[_0x1c695a];return _0x38b9e0;};'use strict';var _=require(_0x9513('0x0'));var util=require(_0x9513('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x9513('0x2'));var fs=require('fs');var Redis=require(_0x9513('0x3'));var db=require(_0x9513('0x4'))['db'];var utils=require(_0x9513('0x5'));var logger=require(_0x9513('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x9513('0x7'));var client=jayson[_0x9513('0x8')][_0x9513('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4750c5,_0x110c74,_0x292b21){return new BPromise(function(_0x209dc5,_0x126aa2){return client[_0x9513('0xa')](_0x4750c5,_0x292b21)[_0x9513('0xb')](function(_0x4824f7){logger[_0x9513('0xc')](_0x9513('0xd'),_0x110c74,'request\x20sent');logger[_0x9513('0xe')](_0x9513('0xf'),_0x110c74,_0x9513('0x10'),JSON[_0x9513('0x11')](_0x4824f7));if(_0x4824f7[_0x9513('0x12')]){if(_0x4824f7[_0x9513('0x12')][_0x9513('0x13')]===0x1f4){logger['error'](_0x9513('0xd'),_0x110c74,_0x4824f7[_0x9513('0x12')][_0x9513('0x14')]);return _0x126aa2(_0x4824f7[_0x9513('0x12')][_0x9513('0x14')]);}logger[_0x9513('0x12')](_0x9513('0xd'),_0x110c74,_0x4824f7[_0x9513('0x12')][_0x9513('0x14')]);return _0x209dc5(_0x4824f7[_0x9513('0x12')][_0x9513('0x14')]);}else{logger[_0x9513('0xc')](_0x9513('0xd'),_0x110c74,_0x9513('0x10'));_0x209dc5(_0x4824f7[_0x9513('0x15')][_0x9513('0x14')]);}})['catch'](function(_0x16eda6){logger[_0x9513('0x12')](_0x9513('0xd'),_0x110c74,_0x16eda6);_0x126aa2(_0x16eda6);});});} \ No newline at end of file +var _0x876a=['rpc','../../config/environment','jayson/promise','client','http','then','info','AnalyticMetric,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x559757,_0x3be899){var _0x160474=function(_0x4f5a2b){while(--_0x4f5a2b){_0x559757['push'](_0x559757['shift']());}};_0x160474(++_0x3be899);}(_0x876a,0x1f2));var _0xa876=function(_0x2c8574,_0x2c6cde){_0x2c8574=_0x2c8574-0x0;var _0x4c8129=_0x876a[_0x2c8574];return _0x4c8129;};'use strict';var _=require(_0xa876('0x0'));var util=require(_0xa876('0x1'));var moment=require('moment');var BPromise=require(_0xa876('0x2'));var rs=require(_0xa876('0x3'));var fs=require('fs');var Redis=require(_0xa876('0x4'));var db=require(_0xa876('0x5'))['db'];var utils=require(_0xa876('0x6'));var logger=require(_0xa876('0x7'))(_0xa876('0x8'));var config=require(_0xa876('0x9'));var jayson=require(_0xa876('0xa'));var client=jayson[_0xa876('0xb')][_0xa876('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x1e49e4,_0x2e8c80,_0x4b8a85){return new BPromise(function(_0x138be1,_0x519ea6){return client['request'](_0x1e49e4,_0x4b8a85)[_0xa876('0xd')](function(_0x4578c9){logger[_0xa876('0xe')](_0xa876('0xf'),_0x2e8c80,_0xa876('0x10'));logger[_0xa876('0x11')]('AnalyticMetric,\x20%s,\x20%s,\x20%s',_0x2e8c80,_0xa876('0x10'),JSON[_0xa876('0x12')](_0x4578c9));if(_0x4578c9['error']){if(_0x4578c9[_0xa876('0x13')]['code']===0x1f4){logger[_0xa876('0x13')](_0xa876('0xf'),_0x2e8c80,_0x4578c9['error'][_0xa876('0x14')]);return _0x519ea6(_0x4578c9[_0xa876('0x13')][_0xa876('0x14')]);}logger[_0xa876('0x13')](_0xa876('0xf'),_0x2e8c80,_0x4578c9[_0xa876('0x13')]['message']);return _0x138be1(_0x4578c9[_0xa876('0x13')][_0xa876('0x14')]);}else{logger[_0xa876('0xe')](_0xa876('0xf'),_0x2e8c80,'request\x20sent');_0x138be1(_0x4578c9[_0xa876('0x15')][_0xa876('0x14')]);}})[_0xa876('0x16')](function(_0x21243d){logger[_0xa876('0x13')](_0xa876('0xf'),_0x2e8c80,_0x21243d);_0x519ea6(_0x21243d);});});} \ No newline at end of file diff --git a/server/api/analyticMetric/index.js b/server/api/analyticMetric/index.js index ca2f80c..d9c5e53 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 _0xd2bb=['get','isAuthenticated','index','/:id','show','post','put','update','destroy','exports','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./analyticMetric.controller'];(function(_0x24a0b6,_0x3394da){var _0x3cdb5e=function(_0x1f1c11){while(--_0x1f1c11){_0x24a0b6['push'](_0x24a0b6['shift']());}};_0x3cdb5e(++_0x3394da);}(_0xd2bb,0x9a));var _0xbd2b=function(_0x9e0fad,_0x1fcf56){_0x9e0fad=_0x9e0fad-0x0;var _0x1a3f9c=_0xd2bb[_0x9e0fad];return _0x1a3f9c;};'use strict';var multer=require('multer');var util=require(_0xbd2b('0x0'));var path=require('path');var timeout=require(_0xbd2b('0x1'));var express=require(_0xbd2b('0x2'));var router=express[_0xbd2b('0x3')]();var fs_extra=require(_0xbd2b('0x4'));var auth=require(_0xbd2b('0x5'));var interaction=require(_0xbd2b('0x6'));var config=require('../../config/environment');var controller=require(_0xbd2b('0x7'));router[_0xbd2b('0x8')]('/',auth[_0xbd2b('0x9')](),controller[_0xbd2b('0xa')]);router[_0xbd2b('0x8')](_0xbd2b('0xb'),auth[_0xbd2b('0x9')](),controller[_0xbd2b('0xc')]);router[_0xbd2b('0xd')]('/',auth[_0xbd2b('0x9')](),controller['create']);router[_0xbd2b('0xe')]('/:id',auth[_0xbd2b('0x9')](),controller[_0xbd2b('0xf')]);router['delete'](_0xbd2b('0xb'),auth[_0xbd2b('0x9')](),controller[_0xbd2b('0x10')]);module[_0xbd2b('0x11')]=router; \ No newline at end of file +var _0x3561=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticMetric.controller','get','isAuthenticated','index','show','post','put','/:id','update','exports','multer','path','connect-timeout','express'];(function(_0x367eca,_0x20ebf4){var _0x53888a=function(_0x1eea02){while(--_0x1eea02){_0x367eca['push'](_0x367eca['shift']());}};_0x53888a(++_0x20ebf4);}(_0x3561,0x94));var _0x1356=function(_0x5350f4,_0x48a111){_0x5350f4=_0x5350f4-0x0;var _0xf76cfc=_0x3561[_0x5350f4];return _0xf76cfc;};'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')]('/',auth[_0x1356('0xb')](),controller[_0x1356('0xc')]);router[_0x1356('0xa')]('/:id',auth[_0x1356('0xb')](),controller[_0x1356('0xd')]);router[_0x1356('0xe')]('/',auth['isAuthenticated'](),controller['create']);router[_0x1356('0xf')](_0x1356('0x10'),auth['isAuthenticated'](),controller[_0x1356('0x11')]);router['delete'](_0x1356('0x10'),auth[_0x1356('0xb')](),controller['destroy']);module[_0x1356('0x12')]=router; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.attributes.js b/server/api/analyticTreeReport/analyticTreeReport.attributes.js index 71ce92d..b6f3ad8 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 _0x9dd5=['TEXT','sequelize','exports'];(function(_0x13309a,_0x24b152){var _0x482510=function(_0x54d681){while(--_0x54d681){_0x13309a['push'](_0x13309a['shift']());}};_0x482510(++_0x24b152);}(_0x9dd5,0x1d2));var _0x59dd=function(_0x3698b8,_0x5230a1){_0x3698b8=_0x3698b8-0x0;var _0x2bf571=_0x9dd5[_0x3698b8];return _0x2bf571;};'use strict';var Sequelize=require(_0x59dd('0x0'));module[_0x59dd('0x1')]={'tree':{'type':Sequelize[_0x59dd('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x70e2=['sequelize','exports','TEXT'];(function(_0x39665a,_0xc729df){var _0x173185=function(_0x2263f4){while(--_0x2263f4){_0x39665a['push'](_0x39665a['shift']());}};_0x173185(++_0xc729df);}(_0x70e2,0xc3));var _0x270e=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x70e2[_0x3b380d];return _0x54502b;};'use strict';var Sequelize=require(_0x270e('0x0'));module[_0x270e('0x1')]={'tree':{'type':Sequelize[_0x270e('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 c8445d8..8726bf0 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 _0x3c08=['desk.js','../../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','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','destroy','then','error','stack','name','send','index','map','AnalyticTreeReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','merge','where','VIRTUAL','filter','includeAll','include','findAll','show','params','options','find','catch','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','squel','crypto'];(function(_0x58175c,_0x2d9373){var _0x55b88f=function(_0x13ed84){while(--_0x13ed84){_0x58175c['push'](_0x58175c['shift']());}};_0x55b88f(++_0x2d9373);}(_0x3c08,0x12d));var _0x83c0=function(_0x243203,_0x2a9990){_0x243203=_0x243203-0x0;var _0x4707de=_0x3c08[_0x243203];return _0x4707de;};'use strict';var emlformat=require(_0x83c0('0x0'));var rimraf=require(_0x83c0('0x1'));var zipdir=require(_0x83c0('0x2'));var jsonpatch=require(_0x83c0('0x3'));var rp=require(_0x83c0('0x4'));var moment=require(_0x83c0('0x5'));var BPromise=require(_0x83c0('0x6'));var Mustache=require(_0x83c0('0x7'));var util=require(_0x83c0('0x8'));var path=require('path');var sox=require(_0x83c0('0x9'));var csv=require(_0x83c0('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x83c0('0xb'));var _=require(_0x83c0('0xc'));var squel=require(_0x83c0('0xd'));var crypto=require(_0x83c0('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x83c0('0xf'));var toCsv=require(_0x83c0('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x83c0('0x10'));var qs=require(_0x83c0('0x11'));var as=require(_0x83c0('0x12'));var hardwareService=require(_0x83c0('0x13'));var logger=require(_0x83c0('0x14'))(_0x83c0('0x15'));var utils=require(_0x83c0('0x16'));var config=require(_0x83c0('0x17'));var licenseUtil=require(_0x83c0('0x18'));var db=require(_0x83c0('0x19'))['db'];function respondWithStatusCode(_0x483615,_0x1a41b1){_0x1a41b1=_0x1a41b1||0xcc;return function(_0x4d806f){if(_0x4d806f){return _0x483615[_0x83c0('0x1a')](_0x1a41b1);}return _0x483615['status'](_0x1a41b1)[_0x83c0('0x1b')]();};}function respondWithResult(_0x1292af,_0x34f1bd){_0x34f1bd=_0x34f1bd||0xc8;return function(_0x28aa1b){if(_0x28aa1b){return _0x1292af[_0x83c0('0x1c')](_0x34f1bd)['json'](_0x28aa1b);}};}function respondWithFilteredResult(_0x2c527d,_0x10239c){return function(_0x31b9f4){if(_0x31b9f4){var _0x4187aa=typeof _0x10239c[_0x83c0('0x1d')]===_0x83c0('0x1e')&&typeof _0x10239c[_0x83c0('0x1f')]===_0x83c0('0x1e');var _0x58ccbc=_0x31b9f4[_0x83c0('0x20')];var _0x4f8773=_0x4187aa?0x0:_0x10239c[_0x83c0('0x1d')];var _0x43cd84=_0x4187aa?_0x31b9f4[_0x83c0('0x20')]:_0x10239c['offset']+_0x10239c['limit'];var _0x2821a9;if(_0x43cd84>=_0x58ccbc){_0x43cd84=_0x58ccbc;_0x2821a9=0xc8;}else{_0x2821a9=0xce;}_0x2c527d['status'](_0x2821a9);return _0x2c527d[_0x83c0('0x21')](_0x83c0('0x22'),_0x4f8773+'-'+_0x43cd84+'/'+_0x58ccbc)[_0x83c0('0x23')](_0x31b9f4);}return null;};}function patchUpdates(_0x46ade9){return function(_0x153fd7){try{jsonpatch[_0x83c0('0x24')](_0x153fd7,_0x46ade9,!![]);}catch(_0x30f226){return BPromise[_0x83c0('0x25')](_0x30f226);}return _0x153fd7[_0x83c0('0x26')]();};}function saveUpdates(_0x520778,_0x2db38){return function(_0x27f293){if(_0x27f293){return _0x27f293[_0x83c0('0x27')](_0x520778)['then'](function(_0x5642f5){return _0x5642f5;});}return null;};}function removeEntity(_0x7b3567,_0x1b2648){return function(_0x41a962){if(_0x41a962){return _0x41a962[_0x83c0('0x28')]()[_0x83c0('0x29')](function(){_0x7b3567[_0x83c0('0x1c')](0xcc)[_0x83c0('0x1b')]();});}};}function handleEntityNotFound(_0x8bf4c5,_0x7d47de){return function(_0x34c655){if(!_0x34c655){_0x8bf4c5[_0x83c0('0x1a')](0x194);}return _0x34c655;};}function handleError(_0x4e7d31,_0x423672){_0x423672=_0x423672||0x1f4;return function(_0x520b35){logger[_0x83c0('0x2a')](_0x520b35[_0x83c0('0x2b')]);if(_0x520b35[_0x83c0('0x2c')]){delete _0x520b35[_0x83c0('0x2c')];}_0x4e7d31[_0x83c0('0x1c')](_0x423672)[_0x83c0('0x2d')](_0x520b35);};}exports[_0x83c0('0x2e')]=function(_0x4f5d13,_0x455327){var _0x549847={},_0x3f2167={},_0x4fc064={'count':0x0,'rows':[]};var _0x2d8846=_[_0x83c0('0x2f')](db[_0x83c0('0x30')][_0x83c0('0x31')],function(_0x50fa85){return{'name':_0x50fa85[_0x83c0('0x32')],'type':_0x50fa85[_0x83c0('0x33')][_0x83c0('0x34')]};});_0x3f2167[_0x83c0('0x35')]=_[_0x83c0('0x2f')](_0x2d8846,'name');_0x3f2167[_0x83c0('0x36')]=_[_0x83c0('0x37')](_0x4f5d13[_0x83c0('0x36')]);_0x3f2167[_0x83c0('0x38')]=_[_0x83c0('0x39')](_0x3f2167[_0x83c0('0x35')],_0x3f2167['query']);_0x549847[_0x83c0('0x3a')]=_[_0x83c0('0x39')](_0x3f2167[_0x83c0('0x35')],qs[_0x83c0('0x3b')](_0x4f5d13[_0x83c0('0x36')]['fields']));_0x549847[_0x83c0('0x3a')]=_0x549847[_0x83c0('0x3a')][_0x83c0('0x3c')]?_0x549847[_0x83c0('0x3a')]:_0x3f2167[_0x83c0('0x35')];if(!_0x4f5d13[_0x83c0('0x36')][_0x83c0('0x3d')](_0x83c0('0x3e'))){_0x549847[_0x83c0('0x1f')]=qs['limit'](_0x4f5d13['query']['limit']);_0x549847[_0x83c0('0x1d')]=qs[_0x83c0('0x1d')](_0x4f5d13[_0x83c0('0x36')][_0x83c0('0x1d')]);}_0x549847[_0x83c0('0x3f')]=qs[_0x83c0('0x40')](_0x4f5d13[_0x83c0('0x36')][_0x83c0('0x40')]);_0x549847['where']=qs[_0x83c0('0x38')](_['pick'](_0x4f5d13['query'],_0x3f2167[_0x83c0('0x38')]),_0x2d8846);if(_0x4f5d13['query']['filter']){_0x549847['where']=_[_0x83c0('0x41')](_0x549847[_0x83c0('0x42')],{'$or':_[_0x83c0('0x2f')](_0x2d8846,function(_0x458997){if(_0x458997[_0x83c0('0x33')]!==_0x83c0('0x43')){var _0x212281={};_0x212281[_0x458997[_0x83c0('0x2c')]]={'$like':'%'+_0x4f5d13['query'][_0x83c0('0x44')]+'%'};return _0x212281;}})});}_0x549847=_[_0x83c0('0x41')]({},_0x549847,_0x4f5d13['options']);var _0x287893={'where':_0x549847['where']};return db[_0x83c0('0x30')]['count'](_0x287893)['then'](function(_0x3a09f3){_0x4fc064[_0x83c0('0x20')]=_0x3a09f3;if(_0x4f5d13[_0x83c0('0x36')][_0x83c0('0x45')]){_0x549847[_0x83c0('0x46')]=[{'all':!![]}];}return db['AnalyticTreeReport'][_0x83c0('0x47')](_0x549847);})[_0x83c0('0x29')](function(_0x1f2e05){_0x4fc064['rows']=_0x1f2e05;return _0x4fc064;})['then'](respondWithFilteredResult(_0x455327,_0x549847))['catch'](handleError(_0x455327,null));};exports[_0x83c0('0x48')]=function(_0x45148a,_0x14e997){var _0x5593c2={'raw':!![],'where':{'id':_0x45148a[_0x83c0('0x49')]['id']}},_0xa27b9e={};_0xa27b9e[_0x83c0('0x35')]=_[_0x83c0('0x37')](db['AnalyticTreeReport'][_0x83c0('0x31')]);_0xa27b9e[_0x83c0('0x36')]=_[_0x83c0('0x37')](_0x45148a['query']);_0xa27b9e[_0x83c0('0x38')]=_[_0x83c0('0x39')](_0xa27b9e['model'],_0xa27b9e[_0x83c0('0x36')]);_0x5593c2['attributes']=_[_0x83c0('0x39')](_0xa27b9e['model'],qs[_0x83c0('0x3b')](_0x45148a[_0x83c0('0x36')][_0x83c0('0x3b')]));_0x5593c2[_0x83c0('0x3a')]=_0x5593c2[_0x83c0('0x3a')][_0x83c0('0x3c')]?_0x5593c2[_0x83c0('0x3a')]:_0xa27b9e[_0x83c0('0x35')];if(_0x45148a[_0x83c0('0x36')][_0x83c0('0x45')]){_0x5593c2[_0x83c0('0x46')]=[{'all':!![]}];}_0x5593c2=_[_0x83c0('0x41')]({},_0x5593c2,_0x45148a[_0x83c0('0x4a')]);return db[_0x83c0('0x30')][_0x83c0('0x4b')](_0x5593c2)['then'](handleEntityNotFound(_0x14e997,null))[_0x83c0('0x29')](respondWithResult(_0x14e997,null))[_0x83c0('0x4c')](handleError(_0x14e997,null));};exports['create']=function(_0x23e5ed,_0xac391d){return db[_0x83c0('0x30')][_0x83c0('0x4d')](_0x23e5ed[_0x83c0('0x4e')],{})[_0x83c0('0x29')](respondWithResult(_0xac391d,0xc9))['catch'](handleError(_0xac391d,null));};exports[_0x83c0('0x27')]=function(_0x2758d1,_0x27c867){if(_0x2758d1['body']['id']){delete _0x2758d1[_0x83c0('0x4e')]['id'];}return db[_0x83c0('0x30')]['find']({'where':{'id':_0x2758d1[_0x83c0('0x49')]['id']}})[_0x83c0('0x29')](handleEntityNotFound(_0x27c867,null))[_0x83c0('0x29')](saveUpdates(_0x2758d1['body'],null))[_0x83c0('0x29')](respondWithResult(_0x27c867,null))[_0x83c0('0x4c')](handleError(_0x27c867,null));};exports['destroy']=function(_0x1e41f2,_0x48ad4e){return db[_0x83c0('0x30')][_0x83c0('0x4b')]({'where':{'id':_0x1e41f2[_0x83c0('0x49')]['id']}})['then'](handleEntityNotFound(_0x48ad4e,null))['then'](removeEntity(_0x48ad4e,null))[_0x83c0('0x4c')](handleError(_0x48ad4e,null));}; \ No newline at end of file +var _0xe70b=['params','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','name','send','index','map','fieldName','type','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','pick','filter','merge','options','AnalyticTreeReport','catch','show','rawAttributes','length','includeAll','include','find','create','body'];(function(_0x7293b,_0x5a478e){var _0x54e309=function(_0x211dda){while(--_0x211dda){_0x7293b['push'](_0x7293b['shift']());}};_0x54e309(++_0x5a478e);}(_0xe70b,0xd6));var _0xbe70=function(_0x56c8a8,_0x834642){_0x56c8a8=_0x56c8a8-0x0;var _0x3a4430=_0xe70b[_0x56c8a8];return _0x3a4430;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xbe70('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xbe70('0x1'));var rp=require('request-promise');var moment=require(_0xbe70('0x2'));var BPromise=require(_0xbe70('0x3'));var Mustache=require(_0xbe70('0x4'));var util=require(_0xbe70('0x5'));var path=require(_0xbe70('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xbe70('0x7'));var fs=require('fs');var fs_extra=require(_0xbe70('0x8'));var _=require(_0xbe70('0x9'));var squel=require(_0xbe70('0xa'));var crypto=require(_0xbe70('0xb'));var jsforce=require(_0xbe70('0xc'));var deskjs=require(_0xbe70('0xd'));var toCsv=require(_0xbe70('0xe'));var querystring=require('querystring');var Papa=require(_0xbe70('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xbe70('0x10'));var as=require(_0xbe70('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xbe70('0x12'))(_0xbe70('0x13'));var utils=require(_0xbe70('0x14'));var config=require(_0xbe70('0x15'));var licenseUtil=require(_0xbe70('0x16'));var db=require(_0xbe70('0x17'))['db'];function respondWithStatusCode(_0x3ed655,_0x2ab0c2){_0x2ab0c2=_0x2ab0c2||0xcc;return function(_0x1eb5de){if(_0x1eb5de){return _0x3ed655[_0xbe70('0x18')](_0x2ab0c2);}return _0x3ed655[_0xbe70('0x19')](_0x2ab0c2)['end']();};}function respondWithResult(_0x5628c4,_0x47adfa){_0x47adfa=_0x47adfa||0xc8;return function(_0xe04dc0){if(_0xe04dc0){return _0x5628c4[_0xbe70('0x19')](_0x47adfa)[_0xbe70('0x1a')](_0xe04dc0);}};}function respondWithFilteredResult(_0x1b9f34,_0x5782d4){return function(_0x3c0871){if(_0x3c0871){var _0x5c82a7=typeof _0x5782d4['offset']===_0xbe70('0x1b')&&typeof _0x5782d4['limit']==='undefined';var _0x150689=_0x3c0871[_0xbe70('0x1c')];var _0x2bdc18=_0x5c82a7?0x0:_0x5782d4['offset'];var _0x15b6a5=_0x5c82a7?_0x3c0871['count']:_0x5782d4[_0xbe70('0x1d')]+_0x5782d4[_0xbe70('0x1e')];var _0x47b131;if(_0x15b6a5>=_0x150689){_0x15b6a5=_0x150689;_0x47b131=0xc8;}else{_0x47b131=0xce;}_0x1b9f34[_0xbe70('0x19')](_0x47b131);return _0x1b9f34[_0xbe70('0x1f')](_0xbe70('0x20'),_0x2bdc18+'-'+_0x15b6a5+'/'+_0x150689)[_0xbe70('0x1a')](_0x3c0871);}return null;};}function patchUpdates(_0x276682){return function(_0x1f11e9){try{jsonpatch[_0xbe70('0x21')](_0x1f11e9,_0x276682,!![]);}catch(_0x43b4fb){return BPromise[_0xbe70('0x22')](_0x43b4fb);}return _0x1f11e9[_0xbe70('0x23')]();};}function saveUpdates(_0x1646e2,_0x194925){return function(_0xdbb4b6){if(_0xdbb4b6){return _0xdbb4b6[_0xbe70('0x24')](_0x1646e2)[_0xbe70('0x25')](function(_0x76afeb){return _0x76afeb;});}return null;};}function removeEntity(_0x1a69ec,_0x33714c){return function(_0x36a176){if(_0x36a176){return _0x36a176[_0xbe70('0x26')]()['then'](function(){_0x1a69ec[_0xbe70('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0xafaf24,_0x4cc937){return function(_0x6f56f4){if(!_0x6f56f4){_0xafaf24[_0xbe70('0x18')](0x194);}return _0x6f56f4;};}function handleError(_0x565f11,_0x164859){_0x164859=_0x164859||0x1f4;return function(_0x57b7a8){logger['error'](_0x57b7a8['stack']);if(_0x57b7a8[_0xbe70('0x27')]){delete _0x57b7a8[_0xbe70('0x27')];}_0x565f11[_0xbe70('0x19')](_0x164859)[_0xbe70('0x28')](_0x57b7a8);};}exports[_0xbe70('0x29')]=function(_0x136b1b,_0x312b02){var _0x59f602={},_0x3d7fa3={},_0x1b0937={'count':0x0,'rows':[]};var _0x22acd6=_[_0xbe70('0x2a')](db['AnalyticTreeReport']['rawAttributes'],function(_0x1d2b23){return{'name':_0x1d2b23[_0xbe70('0x2b')],'type':_0x1d2b23[_0xbe70('0x2c')]['key']};});_0x3d7fa3[_0xbe70('0x2d')]=_[_0xbe70('0x2a')](_0x22acd6,'name');_0x3d7fa3[_0xbe70('0x2e')]=_[_0xbe70('0x2f')](_0x136b1b['query']);_0x3d7fa3[_0xbe70('0x30')]=_[_0xbe70('0x31')](_0x3d7fa3[_0xbe70('0x2d')],_0x3d7fa3[_0xbe70('0x2e')]);_0x59f602[_0xbe70('0x32')]=_[_0xbe70('0x31')](_0x3d7fa3[_0xbe70('0x2d')],qs[_0xbe70('0x33')](_0x136b1b[_0xbe70('0x2e')][_0xbe70('0x33')]));_0x59f602[_0xbe70('0x32')]=_0x59f602[_0xbe70('0x32')]['length']?_0x59f602[_0xbe70('0x32')]:_0x3d7fa3[_0xbe70('0x2d')];if(!_0x136b1b[_0xbe70('0x2e')][_0xbe70('0x34')]('nolimit')){_0x59f602[_0xbe70('0x1e')]=qs[_0xbe70('0x1e')](_0x136b1b[_0xbe70('0x2e')][_0xbe70('0x1e')]);_0x59f602[_0xbe70('0x1d')]=qs['offset'](_0x136b1b['query'][_0xbe70('0x1d')]);}_0x59f602[_0xbe70('0x35')]=qs[_0xbe70('0x36')](_0x136b1b['query']['sort']);_0x59f602[_0xbe70('0x37')]=qs['filters'](_[_0xbe70('0x38')](_0x136b1b['query'],_0x3d7fa3['filters']),_0x22acd6);if(_0x136b1b[_0xbe70('0x2e')][_0xbe70('0x39')]){_0x59f602['where']=_[_0xbe70('0x3a')](_0x59f602[_0xbe70('0x37')],{'$or':_['map'](_0x22acd6,function(_0x368148){if(_0x368148[_0xbe70('0x2c')]!=='VIRTUAL'){var _0x250c39={};_0x250c39[_0x368148[_0xbe70('0x27')]]={'$like':'%'+_0x136b1b[_0xbe70('0x2e')][_0xbe70('0x39')]+'%'};return _0x250c39;}})});}_0x59f602=_[_0xbe70('0x3a')]({},_0x59f602,_0x136b1b[_0xbe70('0x3b')]);var _0x3a704c={'where':_0x59f602['where']};return db['AnalyticTreeReport']['count'](_0x3a704c)[_0xbe70('0x25')](function(_0xac99e0){_0x1b0937[_0xbe70('0x1c')]=_0xac99e0;if(_0x136b1b[_0xbe70('0x2e')]['includeAll']){_0x59f602['include']=[{'all':!![]}];}return db[_0xbe70('0x3c')]['findAll'](_0x59f602);})[_0xbe70('0x25')](function(_0x25f5f8){_0x1b0937['rows']=_0x25f5f8;return _0x1b0937;})['then'](respondWithFilteredResult(_0x312b02,_0x59f602))[_0xbe70('0x3d')](handleError(_0x312b02,null));};exports[_0xbe70('0x3e')]=function(_0x453010,_0x4e272e){var _0xe62f79={'raw':!![],'where':{'id':_0x453010['params']['id']}},_0x510764={};_0x510764['model']=_[_0xbe70('0x2f')](db[_0xbe70('0x3c')][_0xbe70('0x3f')]);_0x510764[_0xbe70('0x2e')]=_[_0xbe70('0x2f')](_0x453010[_0xbe70('0x2e')]);_0x510764[_0xbe70('0x30')]=_[_0xbe70('0x31')](_0x510764[_0xbe70('0x2d')],_0x510764[_0xbe70('0x2e')]);_0xe62f79[_0xbe70('0x32')]=_['intersection'](_0x510764[_0xbe70('0x2d')],qs[_0xbe70('0x33')](_0x453010['query'][_0xbe70('0x33')]));_0xe62f79['attributes']=_0xe62f79[_0xbe70('0x32')][_0xbe70('0x40')]?_0xe62f79[_0xbe70('0x32')]:_0x510764['model'];if(_0x453010['query'][_0xbe70('0x41')]){_0xe62f79[_0xbe70('0x42')]=[{'all':!![]}];}_0xe62f79=_['merge']({},_0xe62f79,_0x453010[_0xbe70('0x3b')]);return db['AnalyticTreeReport'][_0xbe70('0x43')](_0xe62f79)[_0xbe70('0x25')](handleEntityNotFound(_0x4e272e,null))[_0xbe70('0x25')](respondWithResult(_0x4e272e,null))[_0xbe70('0x3d')](handleError(_0x4e272e,null));};exports[_0xbe70('0x44')]=function(_0x47b43d,_0x1ebcc8){return db['AnalyticTreeReport'][_0xbe70('0x44')](_0x47b43d['body'],{})['then'](respondWithResult(_0x1ebcc8,0xc9))[_0xbe70('0x3d')](handleError(_0x1ebcc8,null));};exports['update']=function(_0x286819,_0x441c78){if(_0x286819[_0xbe70('0x45')]['id']){delete _0x286819[_0xbe70('0x45')]['id'];}return db[_0xbe70('0x3c')][_0xbe70('0x43')]({'where':{'id':_0x286819[_0xbe70('0x46')]['id']}})[_0xbe70('0x25')](handleEntityNotFound(_0x441c78,null))[_0xbe70('0x25')](saveUpdates(_0x286819[_0xbe70('0x45')],null))[_0xbe70('0x25')](respondWithResult(_0x441c78,null))[_0xbe70('0x3d')](handleError(_0x441c78,null));};exports[_0xbe70('0x26')]=function(_0x3390e5,_0x547b89){return db['AnalyticTreeReport'][_0xbe70('0x43')]({'where':{'id':_0x3390e5[_0xbe70('0x46')]['id']}})[_0xbe70('0x25')](handleEntityNotFound(_0x547b89,null))['then'](removeEntity(_0x547b89,null))[_0xbe70('0x3d')](handleError(_0x547b89,null));}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.model.js b/server/api/analyticTreeReport/analyticTreeReport.model.js index 5f92d3d..5aebac7 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 _0xff57=['lodash','util','../../config/logger','api','moment','request-promise','rimraf','./analyticTreeReport.attributes','exports','define','AnalyticTreeReport'];(function(_0x4c1869,_0x1a6600){var _0x9280f6=function(_0x40e2f9){while(--_0x40e2f9){_0x4c1869['push'](_0x4c1869['shift']());}};_0x9280f6(++_0x1a6600);}(_0xff57,0x1e4));var _0x7ff5=function(_0x587b1f,_0x576a41){_0x587b1f=_0x587b1f-0x0;var _0x2caf3b=_0xff57[_0x587b1f];return _0x2caf3b;};'use strict';var _=require(_0x7ff5('0x0'));var util=require(_0x7ff5('0x1'));var logger=require(_0x7ff5('0x2'))(_0x7ff5('0x3'));var moment=require(_0x7ff5('0x4'));var BPromise=require('bluebird');var rp=require(_0x7ff5('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7ff5('0x6'));var config=require('../../config/environment');var attributes=require(_0x7ff5('0x7'));module[_0x7ff5('0x8')]=function(_0x5dca29,_0x383996){return _0x5dca29[_0x7ff5('0x9')](_0x7ff5('0xa'),attributes,{'tableName':'analytics_report_trees','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd15f=['../../config/environment','./analyticTreeReport.attributes','exports','define','lodash','util','../../config/logger','api','moment','request-promise','path'];(function(_0x24259d,_0x64a194){var _0x5a701=function(_0x204516){while(--_0x204516){_0x24259d['push'](_0x24259d['shift']());}};_0x5a701(++_0x64a194);}(_0xd15f,0xf6));var _0xfd15=function(_0x1e8b1e,_0x407bbd){_0x1e8b1e=_0x1e8b1e-0x0;var _0x4a0fde=_0xd15f[_0x1e8b1e];return _0x4a0fde;};'use strict';var _=require(_0xfd15('0x0'));var util=require(_0xfd15('0x1'));var logger=require(_0xfd15('0x2'))(_0xfd15('0x3'));var moment=require(_0xfd15('0x4'));var BPromise=require('bluebird');var rp=require(_0xfd15('0x5'));var fs=require('fs');var path=require(_0xfd15('0x6'));var rimraf=require('rimraf');var config=require(_0xfd15('0x7'));var attributes=require(_0xfd15('0x8'));module[_0xfd15('0x9')]=function(_0x2c6dc9,_0x2e7f87){return _0x2c6dc9[_0xfd15('0xa')]('AnalyticTreeReport',attributes,{'tableName':'analytics_report_trees','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.rpc.js b/server/api/analyticTreeReport/analyticTreeReport.rpc.js index 2786163..2c14b1b 100644 --- a/server/api/analyticTreeReport/analyticTreeReport.rpc.js +++ b/server/api/analyticTreeReport/analyticTreeReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1261=['then','info','AnalyticTreeReport,\x20%s,\x20%s','request\x20sent','AnalyticTreeReport,\x20%s,\x20%s,\x20%s','error','code','message','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request'];(function(_0x2d6b63,_0x26b926){var _0x3681bb=function(_0x25d60d){while(--_0x25d60d){_0x2d6b63['push'](_0x2d6b63['shift']());}};_0x3681bb(++_0x26b926);}(_0x1261,0x144));var _0x1126=function(_0x53ddab,_0x4ada9d){_0x53ddab=_0x53ddab-0x0;var _0x5819ac=_0x1261[_0x53ddab];return _0x5819ac;};'use strict';var _=require('lodash');var util=require(_0x1126('0x0'));var moment=require(_0x1126('0x1'));var BPromise=require(_0x1126('0x2'));var rs=require(_0x1126('0x3'));var fs=require('fs');var Redis=require(_0x1126('0x4'));var db=require(_0x1126('0x5'))['db'];var utils=require(_0x1126('0x6'));var logger=require(_0x1126('0x7'))(_0x1126('0x8'));var config=require(_0x1126('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x1126('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x907180,_0x4f239c,_0x17e5f0){return new BPromise(function(_0x28772d,_0x245be9){return client[_0x1126('0xb')](_0x907180,_0x17e5f0)[_0x1126('0xc')](function(_0x59cfa1){logger[_0x1126('0xd')](_0x1126('0xe'),_0x4f239c,_0x1126('0xf'));logger['debug'](_0x1126('0x10'),_0x4f239c,'request\x20sent',JSON['stringify'](_0x59cfa1));if(_0x59cfa1[_0x1126('0x11')]){if(_0x59cfa1['error'][_0x1126('0x12')]===0x1f4){logger[_0x1126('0x11')](_0x1126('0xe'),_0x4f239c,_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);return _0x245be9(_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);}logger[_0x1126('0x11')](_0x1126('0xe'),_0x4f239c,_0x59cfa1['error']['message']);return _0x28772d(_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);}else{logger[_0x1126('0xd')]('AnalyticTreeReport,\x20%s,\x20%s',_0x4f239c,_0x1126('0xf'));_0x28772d(_0x59cfa1['result'][_0x1126('0x13')]);}})[_0x1126('0x14')](function(_0x257b5f){logger['error'](_0x1126('0xe'),_0x4f239c,_0x257b5f);_0x245be9(_0x257b5f);});});} \ No newline at end of file +var _0x5f2f=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','info','AnalyticTreeReport,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch'];(function(_0x2de1da,_0x49b428){var _0x10ca5f=function(_0x4276cb){while(--_0x4276cb){_0x2de1da['push'](_0x2de1da['shift']());}};_0x10ca5f(++_0x49b428);}(_0x5f2f,0x73));var _0xf5f2=function(_0x707aaa,_0x25752e){_0x707aaa=_0x707aaa-0x0;var _0x1931d3=_0x5f2f[_0x707aaa];return _0x1931d3;};'use strict';var _=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var moment=require(_0xf5f2('0x2'));var BPromise=require(_0xf5f2('0x3'));var rs=require(_0xf5f2('0x4'));var fs=require('fs');var Redis=require(_0xf5f2('0x5'));var db=require(_0xf5f2('0x6'))['db'];var utils=require(_0xf5f2('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0xf5f2('0x8'));var jayson=require(_0xf5f2('0x9'));var client=jayson[_0xf5f2('0xa')][_0xf5f2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3133bc,_0x473100,_0x5907aa){return new BPromise(function(_0x466882,_0x46cd9c){return client[_0xf5f2('0xc')](_0x3133bc,_0x5907aa)['then'](function(_0x375da4){logger[_0xf5f2('0xd')](_0xf5f2('0xe'),_0x473100,'request\x20sent');logger[_0xf5f2('0xf')]('AnalyticTreeReport,\x20%s,\x20%s,\x20%s',_0x473100,'request\x20sent',JSON[_0xf5f2('0x10')](_0x375da4));if(_0x375da4[_0xf5f2('0x11')]){if(_0x375da4['error'][_0xf5f2('0x12')]===0x1f4){logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0x375da4[_0xf5f2('0x11')][_0xf5f2('0x13')]);return _0x46cd9c(_0x375da4[_0xf5f2('0x11')]['message']);}logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0x375da4[_0xf5f2('0x11')][_0xf5f2('0x13')]);return _0x466882(_0x375da4[_0xf5f2('0x11')]['message']);}else{logger[_0xf5f2('0xd')](_0xf5f2('0xe'),_0x473100,_0xf5f2('0x14'));_0x466882(_0x375da4[_0xf5f2('0x15')][_0xf5f2('0x13')]);}})[_0xf5f2('0x16')](function(_0xdb61b3){logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0xdb61b3);_0x46cd9c(_0xdb61b3);});});} \ No newline at end of file diff --git a/server/api/analyticTreeReport/index.js b/server/api/analyticTreeReport/index.js index d949f5b..bcdb64b 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 _0x09af=['exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/:id','show','post','create','put','delete','destroy'];(function(_0x3b627f,_0x4305a2){var _0x2514da=function(_0x17d8de){while(--_0x17d8de){_0x3b627f['push'](_0x3b627f['shift']());}};_0x2514da(++_0x4305a2);}(_0x09af,0xd2));var _0xf09a=function(_0x16c745,_0x43cb6b){_0x16c745=_0x16c745-0x0;var _0x30ecbd=_0x09af[_0x16c745];return _0x30ecbd;};'use strict';var multer=require(_0xf09a('0x0'));var util=require(_0xf09a('0x1'));var path=require(_0xf09a('0x2'));var timeout=require(_0xf09a('0x3'));var express=require('express');var router=express[_0xf09a('0x4')]();var fs_extra=require(_0xf09a('0x5'));var auth=require(_0xf09a('0x6'));var interaction=require(_0xf09a('0x7'));var config=require('../../config/environment');var controller=require('./analyticTreeReport.controller');router[_0xf09a('0x8')]('/',auth[_0xf09a('0x9')](),controller[_0xf09a('0xa')]);router[_0xf09a('0x8')](_0xf09a('0xb'),auth[_0xf09a('0x9')](),controller[_0xf09a('0xc')]);router[_0xf09a('0xd')]('/',auth['isAuthenticated'](),controller[_0xf09a('0xe')]);router[_0xf09a('0xf')](_0xf09a('0xb'),auth[_0xf09a('0x9')](),controller['update']);router[_0xf09a('0x10')]('/:id',auth[_0xf09a('0x9')](),controller[_0xf09a('0x11')]);module[_0xf09a('0x12')]=router; \ No newline at end of file +var _0xd848=['get','isAuthenticated','index','show','post','create','put','delete','/:id','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticTreeReport.controller'];(function(_0x430a79,_0x17b2af){var _0xda6181=function(_0x488aca){while(--_0x488aca){_0x430a79['push'](_0x430a79['shift']());}};_0xda6181(++_0x17b2af);}(_0xd848,0x1ad));var _0x8d84=function(_0x4dcc2d,_0x422839){_0x4dcc2d=_0x4dcc2d-0x0;var _0x1bbd79=_0xd848[_0x4dcc2d];return _0x1bbd79;};'use strict';var multer=require(_0x8d84('0x0'));var util=require(_0x8d84('0x1'));var path=require(_0x8d84('0x2'));var timeout=require(_0x8d84('0x3'));var express=require(_0x8d84('0x4'));var router=express[_0x8d84('0x5')]();var fs_extra=require(_0x8d84('0x6'));var auth=require(_0x8d84('0x7'));var interaction=require(_0x8d84('0x8'));var config=require(_0x8d84('0x9'));var controller=require(_0x8d84('0xa'));router[_0x8d84('0xb')]('/',auth[_0x8d84('0xc')](),controller[_0x8d84('0xd')]);router[_0x8d84('0xb')]('/:id',auth[_0x8d84('0xc')](),controller[_0x8d84('0xe')]);router[_0x8d84('0xf')]('/',auth['isAuthenticated'](),controller[_0x8d84('0x10')]);router[_0x8d84('0x11')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0x8d84('0x12')](_0x8d84('0x13'),auth[_0x8d84('0xc')](),controller[_0x8d84('0x14')]);module[_0x8d84('0x15')]=router; \ No newline at end of file diff --git a/server/api/attachment/attachment.attributes.js b/server/api/attachment/attachment.attributes.js index c4ba723..1c5509e 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 _0xda65=['exports','STRING','sequelize'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xda65,0x1d0));var _0x5da6=function(_0x4b79a9,_0x3aa1ed){_0x4b79a9=_0x4b79a9-0x0;var _0x50ff41=_0xda65[_0x4b79a9];return _0x50ff41;};'use strict';var Sequelize=require(_0x5da6('0x0'));module[_0x5da6('0x1')]={'name':{'type':Sequelize[_0x5da6('0x2')]},'basename':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x5da6('0x2')]}}; \ No newline at end of file +var _0x3cd1=['exports','STRING'];(function(_0x34baf0,_0x44d55c){var _0x30e3a0=function(_0x36445d){while(--_0x36445d){_0x34baf0['push'](_0x34baf0['shift']());}};_0x30e3a0(++_0x44d55c);}(_0x3cd1,0x112));var _0x13cd=function(_0x46cef6,_0x1d434c){_0x46cef6=_0x46cef6-0x0;var _0x239be7=_0x3cd1[_0x46cef6];return _0x239be7;};'use strict';var Sequelize=require('sequelize');module[_0x13cd('0x0')]={'name':{'type':Sequelize[_0x13cd('0x1')]},'basename':{'type':Sequelize[_0x13cd('0x1')]},'type':{'type':Sequelize[_0x13cd('0x1')]}}; \ No newline at end of file diff --git a/server/api/attachment/attachment.controller.js b/server/api/attachment/attachment.controller.js index 8582d27..e5901db 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 _0xec50=['originalname','filename','mimetype','download','findOne','root','server/files/attachments/','join','offline-chat/','basename','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','error','stack','name','index','map','Attachment','fieldName','type','key','keys','query','model','attributes','fields','hasOwnProperty','order','sort','where','pick','filters','filter','merge','options','include','findAll','rows','catch','show','params','rawAttributes','intersection','length','find','clone','includeAll','get','createdAt','updatedAt','body','create','file'];(function(_0x5dd52e,_0x98ee28){var _0x4d2f78=function(_0x239648){while(--_0x239648){_0x5dd52e['push'](_0x5dd52e['shift']());}};_0x4d2f78(++_0x98ee28);}(_0xec50,0xba));var _0x0ec5=function(_0x1bc013,_0x7771c6){_0x1bc013=_0x1bc013-0x0;var _0x55df36=_0xec50[_0x1bc013];return _0x55df36;};'use strict';var emlformat=require(_0x0ec5('0x0'));var rimraf=require(_0x0ec5('0x1'));var zipdir=require(_0x0ec5('0x2'));var jsonpatch=require(_0x0ec5('0x3'));var rp=require(_0x0ec5('0x4'));var moment=require(_0x0ec5('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x0ec5('0x6'));var util=require('util');var path=require(_0x0ec5('0x7'));var sox=require(_0x0ec5('0x8'));var csv=require(_0x0ec5('0x9'));var ejs=require(_0x0ec5('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0ec5('0xb'));var squel=require('squel');var crypto=require(_0x0ec5('0xc'));var jsforce=require(_0x0ec5('0xd'));var deskjs=require(_0x0ec5('0xe'));var toCsv=require('to-csv');var querystring=require(_0x0ec5('0xf'));var Papa=require(_0x0ec5('0x10'));var Redis=require(_0x0ec5('0x11'));var authService=require(_0x0ec5('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0ec5('0x13'));var logger=require(_0x0ec5('0x14'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x0ec5('0x15'));var db=require(_0x0ec5('0x16'))['db'];function respondWithStatusCode(_0x2f8c2d,_0x96c1b3){_0x96c1b3=_0x96c1b3||0xcc;return function(_0x5315fd){if(_0x5315fd){return _0x2f8c2d[_0x0ec5('0x17')](_0x96c1b3);}return _0x2f8c2d[_0x0ec5('0x18')](_0x96c1b3)['end']();};}function respondWithResult(_0x1fc84a,_0xb7d5e4){_0xb7d5e4=_0xb7d5e4||0xc8;return function(_0x1fd75e){if(_0x1fd75e){return _0x1fc84a[_0x0ec5('0x18')](_0xb7d5e4)[_0x0ec5('0x19')](_0x1fd75e);}};}function respondWithFilteredResult(_0x1707b9,_0x296869){return function(_0x5ab9e4){if(_0x5ab9e4){var _0x700bb2=typeof _0x296869[_0x0ec5('0x1a')]===_0x0ec5('0x1b')&&typeof _0x296869[_0x0ec5('0x1c')]===_0x0ec5('0x1b');var _0x5bc5d5=_0x5ab9e4[_0x0ec5('0x1d')];var _0x2d8320=_0x700bb2?0x0:_0x296869[_0x0ec5('0x1a')];var _0x16776d=_0x700bb2?_0x5ab9e4[_0x0ec5('0x1d')]:_0x296869[_0x0ec5('0x1a')]+_0x296869[_0x0ec5('0x1c')];var _0x151ec2;if(_0x16776d>=_0x5bc5d5){_0x16776d=_0x5bc5d5;_0x151ec2=0xc8;}else{_0x151ec2=0xce;}_0x1707b9[_0x0ec5('0x18')](_0x151ec2);return _0x1707b9[_0x0ec5('0x1e')]('Content-Range',_0x2d8320+'-'+_0x16776d+'/'+_0x5bc5d5)[_0x0ec5('0x19')](_0x5ab9e4);}return null;};}function patchUpdates(_0x31ed42){return function(_0x523315){try{jsonpatch[_0x0ec5('0x1f')](_0x523315,_0x31ed42,!![]);}catch(_0x468ee4){return BPromise[_0x0ec5('0x20')](_0x468ee4);}return _0x523315[_0x0ec5('0x21')]();};}function saveUpdates(_0x40afb7,_0x7baa70){return function(_0x2df636){if(_0x2df636){return _0x2df636[_0x0ec5('0x22')](_0x40afb7)[_0x0ec5('0x23')](function(_0x572fab){return _0x572fab;});}return null;};}function removeEntity(_0xeda9be,_0x224241){return function(_0x4ce01e){if(_0x4ce01e){return _0x4ce01e[_0x0ec5('0x24')]()[_0x0ec5('0x23')](function(){_0xeda9be[_0x0ec5('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x41cbc7,_0x2b3a2b){return function(_0x31678b){if(!_0x31678b){_0x41cbc7[_0x0ec5('0x17')](0x194);}return _0x31678b;};}function handleError(_0x5ebd88,_0x1bd6aa){_0x1bd6aa=_0x1bd6aa||0x1f4;return function(_0x4da2dd){logger[_0x0ec5('0x25')](_0x4da2dd[_0x0ec5('0x26')]);if(_0x4da2dd[_0x0ec5('0x27')]){delete _0x4da2dd[_0x0ec5('0x27')];}_0x5ebd88['status'](_0x1bd6aa)['send'](_0x4da2dd);};}exports[_0x0ec5('0x28')]=function(_0x191234,_0x224030){var _0x95e989={},_0x4d49b7={},_0x1719fc={'count':0x0,'rows':[]};var _0x27a2e4=_[_0x0ec5('0x29')](db[_0x0ec5('0x2a')]['rawAttributes'],function(_0x19b30b){return{'name':_0x19b30b[_0x0ec5('0x2b')],'type':_0x19b30b[_0x0ec5('0x2c')][_0x0ec5('0x2d')]};});_0x4d49b7['model']=_[_0x0ec5('0x29')](_0x27a2e4,'name');_0x4d49b7['query']=_[_0x0ec5('0x2e')](_0x191234[_0x0ec5('0x2f')]);_0x4d49b7['filters']=_['intersection'](_0x4d49b7[_0x0ec5('0x30')],_0x4d49b7[_0x0ec5('0x2f')]);_0x95e989[_0x0ec5('0x31')]=_['intersection'](_0x4d49b7[_0x0ec5('0x30')],qs[_0x0ec5('0x32')](_0x191234['query']['fields']));_0x95e989[_0x0ec5('0x31')]=_0x95e989[_0x0ec5('0x31')]['length']?_0x95e989[_0x0ec5('0x31')]:_0x4d49b7['model'];if(!_0x191234['query'][_0x0ec5('0x33')]('nolimit')){_0x95e989[_0x0ec5('0x1c')]=qs[_0x0ec5('0x1c')](_0x191234[_0x0ec5('0x2f')][_0x0ec5('0x1c')]);_0x95e989[_0x0ec5('0x1a')]=qs[_0x0ec5('0x1a')](_0x191234[_0x0ec5('0x2f')]['offset']);}_0x95e989[_0x0ec5('0x34')]=qs['sort'](_0x191234[_0x0ec5('0x2f')][_0x0ec5('0x35')]);_0x95e989[_0x0ec5('0x36')]=qs['filters'](_[_0x0ec5('0x37')](_0x191234[_0x0ec5('0x2f')],_0x4d49b7[_0x0ec5('0x38')]),_0x27a2e4);if(_0x191234['query'][_0x0ec5('0x39')]){_0x95e989[_0x0ec5('0x36')]=_[_0x0ec5('0x3a')](_0x95e989['where'],{'$or':_[_0x0ec5('0x29')](_0x27a2e4,function(_0x5ce369){if(_0x5ce369[_0x0ec5('0x2c')]!=='VIRTUAL'){var _0x202880={};_0x202880[_0x5ce369[_0x0ec5('0x27')]]={'$like':'%'+_0x191234[_0x0ec5('0x2f')][_0x0ec5('0x39')]+'%'};return _0x202880;}})});}_0x95e989=_['merge']({},_0x95e989,_0x191234[_0x0ec5('0x3b')]);var _0x2a4e01={'where':_0x95e989[_0x0ec5('0x36')]};return db['Attachment']['count'](_0x2a4e01)['then'](function(_0x214782){_0x1719fc[_0x0ec5('0x1d')]=_0x214782;if(_0x191234[_0x0ec5('0x2f')]['includeAll']){_0x95e989[_0x0ec5('0x3c')]=[{'all':!![]}];}return db[_0x0ec5('0x2a')][_0x0ec5('0x3d')](_0x95e989);})[_0x0ec5('0x23')](function(_0x5e42be){_0x1719fc[_0x0ec5('0x3e')]=_0x5e42be;return _0x1719fc;})[_0x0ec5('0x23')](respondWithFilteredResult(_0x224030,_0x95e989))[_0x0ec5('0x3f')](handleError(_0x224030,null));};exports[_0x0ec5('0x40')]=function(_0x4609c7,_0x32ab18){var _0x180923={'raw':!![],'where':{'id':_0x4609c7[_0x0ec5('0x41')]['id']}},_0x1e396f={};_0x1e396f[_0x0ec5('0x30')]=_[_0x0ec5('0x2e')](db[_0x0ec5('0x2a')][_0x0ec5('0x42')]);_0x1e396f[_0x0ec5('0x2f')]=_[_0x0ec5('0x2e')](_0x4609c7[_0x0ec5('0x2f')]);_0x1e396f[_0x0ec5('0x38')]=_[_0x0ec5('0x43')](_0x1e396f[_0x0ec5('0x30')],_0x1e396f[_0x0ec5('0x2f')]);_0x180923[_0x0ec5('0x31')]=_['intersection'](_0x1e396f[_0x0ec5('0x30')],qs[_0x0ec5('0x32')](_0x4609c7['query'][_0x0ec5('0x32')]));_0x180923[_0x0ec5('0x31')]=_0x180923[_0x0ec5('0x31')][_0x0ec5('0x44')]?_0x180923['attributes']:_0x1e396f['model'];if(_0x4609c7['query']['includeAll']){_0x180923[_0x0ec5('0x3c')]=[{'all':!![]}];}_0x180923=_[_0x0ec5('0x3a')]({},_0x180923,_0x4609c7[_0x0ec5('0x3b')]);return db[_0x0ec5('0x2a')][_0x0ec5('0x45')](_0x180923)[_0x0ec5('0x23')](handleEntityNotFound(_0x32ab18,null))[_0x0ec5('0x23')](respondWithResult(_0x32ab18,null))[_0x0ec5('0x3f')](handleError(_0x32ab18,null));};exports[_0x0ec5('0x46')]=function(_0x5c01ff,_0x272415){var _0x55d795={'where':{'id':_0x5c01ff['params']['id']}},_0xc4832={};_0xc4832[_0x0ec5('0x30')]=_[_0x0ec5('0x2e')](db[_0x0ec5('0x2a')][_0x0ec5('0x42')]);_0x55d795[_0x0ec5('0x31')]=_['intersection'](_0xc4832['model'],qs[_0x0ec5('0x32')](_0x5c01ff[_0x0ec5('0x2f')][_0x0ec5('0x32')]));_0x55d795[_0x0ec5('0x31')]=_0x55d795[_0x0ec5('0x31')][_0x0ec5('0x44')]?_0x55d795[_0x0ec5('0x31')]:_0xc4832[_0x0ec5('0x30')];if(_0x5c01ff[_0x0ec5('0x2f')][_0x0ec5('0x47')]){_0x55d795['include']=[{'all':!![]}];}_0x55d795=_[_0x0ec5('0x3a')]({},_0x55d795,_0x5c01ff[_0x0ec5('0x3b')]);return db[_0x0ec5('0x2a')][_0x0ec5('0x45')](_0x55d795)[_0x0ec5('0x23')](handleEntityNotFound(_0x272415,null))[_0x0ec5('0x23')](function(_0x542524){if(_0x542524){var _0x26241b=_0x542524[_0x0ec5('0x48')]({'plain':!![]});_0x26241b=qs['omit'](_0x26241b,['id',_0x0ec5('0x49'),_0x0ec5('0x4a')]);_0x5c01ff[_0x0ec5('0x4b')]=_['omit'](_0x5c01ff[_0x0ec5('0x4b')],['id',_0x0ec5('0x49'),_0x0ec5('0x4a')]);return db[_0x0ec5('0x2a')]['create'](_[_0x0ec5('0x3a')](_0x26241b,_0x5c01ff['body']),{'include':_0x5c01ff[_0x0ec5('0x2f')][_0x0ec5('0x47')]?[{'all':!![]}]:undefined});}})[_0x0ec5('0x23')](respondWithResult(_0x272415,0xc9))[_0x0ec5('0x3f')](handleError(_0x272415,null));};exports['update']=function(_0x5b5358,_0x5d7e1d){if(_0x5b5358[_0x0ec5('0x4b')]['id']){delete _0x5b5358[_0x0ec5('0x4b')]['id'];}return db[_0x0ec5('0x2a')][_0x0ec5('0x45')]({'where':{'id':_0x5b5358[_0x0ec5('0x41')]['id']}})['then'](handleEntityNotFound(_0x5d7e1d,null))[_0x0ec5('0x23')](saveUpdates(_0x5b5358['body'],null))[_0x0ec5('0x23')](respondWithResult(_0x5d7e1d,null))[_0x0ec5('0x3f')](handleError(_0x5d7e1d,null));};exports[_0x0ec5('0x24')]=function(_0x26e831,_0x21baaf){return db[_0x0ec5('0x2a')]['find']({'where':{'id':_0x26e831[_0x0ec5('0x41')]['id']}})['then'](handleEntityNotFound(_0x21baaf,null))['then'](removeEntity(_0x21baaf,null))[_0x0ec5('0x3f')](handleError(_0x21baaf,null));};exports[_0x0ec5('0x4c')]=function(_0x531271,_0x406013,_0x366bd4){_0x531271[_0x0ec5('0x4b')]['name']=_0x531271[_0x0ec5('0x4d')][_0x0ec5('0x4e')];_0x531271[_0x0ec5('0x4b')]['basename']=_0x531271[_0x0ec5('0x4d')][_0x0ec5('0x4f')];_0x531271[_0x0ec5('0x4b')][_0x0ec5('0x2c')]=_0x531271[_0x0ec5('0x4d')][_0x0ec5('0x50')];return db[_0x0ec5('0x2a')][_0x0ec5('0x4c')](_0x531271[_0x0ec5('0x4b')])[_0x0ec5('0x23')](respondWithResult(_0x406013,0xc9))[_0x0ec5('0x3f')](handleError(_0x406013,null));};exports[_0x0ec5('0x51')]=function(_0x590e8f,_0x376ff9,_0x11c20d){return db[_0x0ec5('0x2a')][_0x0ec5('0x52')]({'where':{'id':_0x590e8f[_0x0ec5('0x41')]['id']},'raw':!![]})['then'](handleEntityNotFound(_0x376ff9,null))[_0x0ec5('0x23')](function(_0x31c8ef){if(_0x31c8ef){var _0x3ea8ea=_0x31c8ef['ChatOfflineMessageId']!==null;var _0x405930=path['join'](config[_0x0ec5('0x53')],_0x0ec5('0x54'));if(_0x3ea8ea){_0x405930=path[_0x0ec5('0x55')](_0x405930,_0x0ec5('0x56'));}var _0x1b717f=path['join'](_0x405930,_0x31c8ef[_0x0ec5('0x57')]);return _0x376ff9['download'](_0x1b717f);}})['catch'](handleError(_0x376ff9,null));}; \ No newline at end of file +var _0xe7de=['find','catch','get','omit','createdAt','updatedAt','body','create','file','originalname','basename','mimetype','ChatOfflineMessageId','join','root','download','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','apply','reject','save','update','then','destroy','error','stack','name','index','map','rawAttributes','fieldName','type','key','keys','query','filters','attributes','intersection','fields','model','nolimit','order','sort','where','filter','VIRTUAL','merge','Attachment','includeAll','findAll','rows','show','params','include','options'];(function(_0x3340fa,_0x54eae8){var _0x309e22=function(_0x1095ff){while(--_0x1095ff){_0x3340fa['push'](_0x3340fa['shift']());}};_0x309e22(++_0x54eae8);}(_0xe7de,0x109));var _0xee7d=function(_0x53fd72,_0x29776b){_0x53fd72=_0x53fd72-0x0;var _0x52a03a=_0xe7de[_0x53fd72];return _0x52a03a;};'use strict';var emlformat=require(_0xee7d('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xee7d('0x1'));var jsonpatch=require(_0xee7d('0x2'));var rp=require(_0xee7d('0x3'));var moment=require('moment');var BPromise=require(_0xee7d('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0xee7d('0x5'));var sox=require(_0xee7d('0x6'));var csv=require(_0xee7d('0x7'));var ejs=require(_0xee7d('0x8'));var fs=require('fs');var fs_extra=require(_0xee7d('0x9'));var _=require(_0xee7d('0xa'));var squel=require(_0xee7d('0xb'));var crypto=require(_0xee7d('0xc'));var jsforce=require(_0xee7d('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xee7d('0xe'));var Redis=require(_0xee7d('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xee7d('0x10'));var as=require(_0xee7d('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xee7d('0x12'))(_0xee7d('0x13'));var utils=require('../../config/utils');var config=require(_0xee7d('0x14'));var licenseUtil=require(_0xee7d('0x15'));var db=require(_0xee7d('0x16'))['db'];function respondWithStatusCode(_0x59ecbd,_0x4cc96b){_0x4cc96b=_0x4cc96b||0xcc;return function(_0x44552d){if(_0x44552d){return _0x59ecbd[_0xee7d('0x17')](_0x4cc96b);}return _0x59ecbd[_0xee7d('0x18')](_0x4cc96b)[_0xee7d('0x19')]();};}function respondWithResult(_0x4d0a37,_0x40593b){_0x40593b=_0x40593b||0xc8;return function(_0x7428fd){if(_0x7428fd){return _0x4d0a37[_0xee7d('0x18')](_0x40593b)['json'](_0x7428fd);}};}function respondWithFilteredResult(_0x5ee6ea,_0x245027){return function(_0x1f30ae){if(_0x1f30ae){var _0x266469=typeof _0x245027[_0xee7d('0x1a')]===_0xee7d('0x1b')&&typeof _0x245027[_0xee7d('0x1c')]===_0xee7d('0x1b');var _0x3bc737=_0x1f30ae[_0xee7d('0x1d')];var _0x54853d=_0x266469?0x0:_0x245027[_0xee7d('0x1a')];var _0x1231d2=_0x266469?_0x1f30ae[_0xee7d('0x1d')]:_0x245027[_0xee7d('0x1a')]+_0x245027[_0xee7d('0x1c')];var _0x3fe539;if(_0x1231d2>=_0x3bc737){_0x1231d2=_0x3bc737;_0x3fe539=0xc8;}else{_0x3fe539=0xce;}_0x5ee6ea[_0xee7d('0x18')](_0x3fe539);return _0x5ee6ea['set']('Content-Range',_0x54853d+'-'+_0x1231d2+'/'+_0x3bc737)['json'](_0x1f30ae);}return null;};}function patchUpdates(_0xc163f4){return function(_0x512e45){try{jsonpatch[_0xee7d('0x1e')](_0x512e45,_0xc163f4,!![]);}catch(_0x140188){return BPromise[_0xee7d('0x1f')](_0x140188);}return _0x512e45[_0xee7d('0x20')]();};}function saveUpdates(_0x452c88,_0x15a746){return function(_0x215bfe){if(_0x215bfe){return _0x215bfe[_0xee7d('0x21')](_0x452c88)[_0xee7d('0x22')](function(_0x19fd60){return _0x19fd60;});}return null;};}function removeEntity(_0x3d578c,_0xcfeb7e){return function(_0x1e8179){if(_0x1e8179){return _0x1e8179[_0xee7d('0x23')]()[_0xee7d('0x22')](function(){_0x3d578c['status'](0xcc)[_0xee7d('0x19')]();});}};}function handleEntityNotFound(_0x4dc643,_0x48c279){return function(_0x2c14e8){if(!_0x2c14e8){_0x4dc643['sendStatus'](0x194);}return _0x2c14e8;};}function handleError(_0x2bd9f5,_0x541fbc){_0x541fbc=_0x541fbc||0x1f4;return function(_0x1b24d2){logger[_0xee7d('0x24')](_0x1b24d2[_0xee7d('0x25')]);if(_0x1b24d2[_0xee7d('0x26')]){delete _0x1b24d2[_0xee7d('0x26')];}_0x2bd9f5[_0xee7d('0x18')](_0x541fbc)['send'](_0x1b24d2);};}exports[_0xee7d('0x27')]=function(_0x239368,_0x2b7e0d){var _0x5ad5f4={},_0x521e9f={},_0x37466e={'count':0x0,'rows':[]};var _0x182174=_[_0xee7d('0x28')](db['Attachment'][_0xee7d('0x29')],function(_0x48e0e9){return{'name':_0x48e0e9[_0xee7d('0x2a')],'type':_0x48e0e9[_0xee7d('0x2b')][_0xee7d('0x2c')]};});_0x521e9f['model']=_[_0xee7d('0x28')](_0x182174,'name');_0x521e9f['query']=_[_0xee7d('0x2d')](_0x239368[_0xee7d('0x2e')]);_0x521e9f[_0xee7d('0x2f')]=_['intersection'](_0x521e9f['model'],_0x521e9f['query']);_0x5ad5f4[_0xee7d('0x30')]=_[_0xee7d('0x31')](_0x521e9f['model'],qs[_0xee7d('0x32')](_0x239368['query'][_0xee7d('0x32')]));_0x5ad5f4[_0xee7d('0x30')]=_0x5ad5f4[_0xee7d('0x30')]['length']?_0x5ad5f4['attributes']:_0x521e9f[_0xee7d('0x33')];if(!_0x239368[_0xee7d('0x2e')]['hasOwnProperty'](_0xee7d('0x34'))){_0x5ad5f4[_0xee7d('0x1c')]=qs[_0xee7d('0x1c')](_0x239368[_0xee7d('0x2e')]['limit']);_0x5ad5f4[_0xee7d('0x1a')]=qs[_0xee7d('0x1a')](_0x239368['query'][_0xee7d('0x1a')]);}_0x5ad5f4[_0xee7d('0x35')]=qs[_0xee7d('0x36')](_0x239368[_0xee7d('0x2e')]['sort']);_0x5ad5f4[_0xee7d('0x37')]=qs['filters'](_['pick'](_0x239368[_0xee7d('0x2e')],_0x521e9f[_0xee7d('0x2f')]),_0x182174);if(_0x239368[_0xee7d('0x2e')][_0xee7d('0x38')]){_0x5ad5f4[_0xee7d('0x37')]=_['merge'](_0x5ad5f4[_0xee7d('0x37')],{'$or':_[_0xee7d('0x28')](_0x182174,function(_0x4ef8ac){if(_0x4ef8ac[_0xee7d('0x2b')]!==_0xee7d('0x39')){var _0x33a04f={};_0x33a04f[_0x4ef8ac[_0xee7d('0x26')]]={'$like':'%'+_0x239368[_0xee7d('0x2e')][_0xee7d('0x38')]+'%'};return _0x33a04f;}})});}_0x5ad5f4=_[_0xee7d('0x3a')]({},_0x5ad5f4,_0x239368['options']);var _0x895c3f={'where':_0x5ad5f4[_0xee7d('0x37')]};return db[_0xee7d('0x3b')][_0xee7d('0x1d')](_0x895c3f)[_0xee7d('0x22')](function(_0x10e97a){_0x37466e[_0xee7d('0x1d')]=_0x10e97a;if(_0x239368[_0xee7d('0x2e')][_0xee7d('0x3c')]){_0x5ad5f4['include']=[{'all':!![]}];}return db[_0xee7d('0x3b')][_0xee7d('0x3d')](_0x5ad5f4);})[_0xee7d('0x22')](function(_0x2ead51){_0x37466e[_0xee7d('0x3e')]=_0x2ead51;return _0x37466e;})[_0xee7d('0x22')](respondWithFilteredResult(_0x2b7e0d,_0x5ad5f4))['catch'](handleError(_0x2b7e0d,null));};exports[_0xee7d('0x3f')]=function(_0xfcf96b,_0x18fbbf){var _0x9f0627={'raw':!![],'where':{'id':_0xfcf96b[_0xee7d('0x40')]['id']}},_0x4e4e06={};_0x4e4e06[_0xee7d('0x33')]=_[_0xee7d('0x2d')](db[_0xee7d('0x3b')][_0xee7d('0x29')]);_0x4e4e06[_0xee7d('0x2e')]=_[_0xee7d('0x2d')](_0xfcf96b[_0xee7d('0x2e')]);_0x4e4e06[_0xee7d('0x2f')]=_['intersection'](_0x4e4e06['model'],_0x4e4e06[_0xee7d('0x2e')]);_0x9f0627[_0xee7d('0x30')]=_[_0xee7d('0x31')](_0x4e4e06[_0xee7d('0x33')],qs[_0xee7d('0x32')](_0xfcf96b[_0xee7d('0x2e')]['fields']));_0x9f0627['attributes']=_0x9f0627['attributes']['length']?_0x9f0627['attributes']:_0x4e4e06[_0xee7d('0x33')];if(_0xfcf96b['query'][_0xee7d('0x3c')]){_0x9f0627[_0xee7d('0x41')]=[{'all':!![]}];}_0x9f0627=_[_0xee7d('0x3a')]({},_0x9f0627,_0xfcf96b[_0xee7d('0x42')]);return db[_0xee7d('0x3b')][_0xee7d('0x43')](_0x9f0627)[_0xee7d('0x22')](handleEntityNotFound(_0x18fbbf,null))['then'](respondWithResult(_0x18fbbf,null))[_0xee7d('0x44')](handleError(_0x18fbbf,null));};exports['clone']=function(_0x2f4dcd,_0x11e781){var _0x5637d8={'where':{'id':_0x2f4dcd['params']['id']}},_0x8ac70c={};_0x8ac70c[_0xee7d('0x33')]=_[_0xee7d('0x2d')](db[_0xee7d('0x3b')][_0xee7d('0x29')]);_0x5637d8[_0xee7d('0x30')]=_[_0xee7d('0x31')](_0x8ac70c['model'],qs[_0xee7d('0x32')](_0x2f4dcd[_0xee7d('0x2e')][_0xee7d('0x32')]));_0x5637d8[_0xee7d('0x30')]=_0x5637d8[_0xee7d('0x30')]['length']?_0x5637d8['attributes']:_0x8ac70c[_0xee7d('0x33')];if(_0x2f4dcd[_0xee7d('0x2e')][_0xee7d('0x3c')]){_0x5637d8['include']=[{'all':!![]}];}_0x5637d8=_[_0xee7d('0x3a')]({},_0x5637d8,_0x2f4dcd[_0xee7d('0x42')]);return db[_0xee7d('0x3b')]['find'](_0x5637d8)[_0xee7d('0x22')](handleEntityNotFound(_0x11e781,null))[_0xee7d('0x22')](function(_0xeeec01){if(_0xeeec01){var _0x8ed839=_0xeeec01[_0xee7d('0x45')]({'plain':!![]});_0x8ed839=qs[_0xee7d('0x46')](_0x8ed839,['id',_0xee7d('0x47'),_0xee7d('0x48')]);_0x2f4dcd[_0xee7d('0x49')]=_[_0xee7d('0x46')](_0x2f4dcd[_0xee7d('0x49')],['id','createdAt',_0xee7d('0x48')]);return db[_0xee7d('0x3b')][_0xee7d('0x4a')](_[_0xee7d('0x3a')](_0x8ed839,_0x2f4dcd['body']),{'include':_0x2f4dcd[_0xee7d('0x2e')][_0xee7d('0x3c')]?[{'all':!![]}]:undefined});}})[_0xee7d('0x22')](respondWithResult(_0x11e781,0xc9))[_0xee7d('0x44')](handleError(_0x11e781,null));};exports[_0xee7d('0x21')]=function(_0x5be6a0,_0x197cb7){if(_0x5be6a0['body']['id']){delete _0x5be6a0[_0xee7d('0x49')]['id'];}return db[_0xee7d('0x3b')]['find']({'where':{'id':_0x5be6a0['params']['id']}})[_0xee7d('0x22')](handleEntityNotFound(_0x197cb7,null))[_0xee7d('0x22')](saveUpdates(_0x5be6a0[_0xee7d('0x49')],null))[_0xee7d('0x22')](respondWithResult(_0x197cb7,null))['catch'](handleError(_0x197cb7,null));};exports[_0xee7d('0x23')]=function(_0x3cc7a3,_0x1ab3a9){return db[_0xee7d('0x3b')][_0xee7d('0x43')]({'where':{'id':_0x3cc7a3[_0xee7d('0x40')]['id']}})[_0xee7d('0x22')](handleEntityNotFound(_0x1ab3a9,null))['then'](removeEntity(_0x1ab3a9,null))['catch'](handleError(_0x1ab3a9,null));};exports['create']=function(_0x5c1457,_0x492f81,_0xa45a09){_0x5c1457[_0xee7d('0x49')]['name']=_0x5c1457[_0xee7d('0x4b')][_0xee7d('0x4c')];_0x5c1457[_0xee7d('0x49')][_0xee7d('0x4d')]=_0x5c1457[_0xee7d('0x4b')]['filename'];_0x5c1457['body'][_0xee7d('0x2b')]=_0x5c1457[_0xee7d('0x4b')][_0xee7d('0x4e')];return db['Attachment']['create'](_0x5c1457[_0xee7d('0x49')])['then'](respondWithResult(_0x492f81,0xc9))[_0xee7d('0x44')](handleError(_0x492f81,null));};exports['download']=function(_0x58b348,_0x3b2153,_0x246994){return db['Attachment']['findOne']({'where':{'id':_0x58b348['params']['id']},'raw':!![]})[_0xee7d('0x22')](handleEntityNotFound(_0x3b2153,null))['then'](function(_0x34888e){if(_0x34888e){var _0x15d4f0=_0x34888e[_0xee7d('0x4f')]!==null;var _0x3398a1=path[_0xee7d('0x50')](config[_0xee7d('0x51')],'server/files/attachments/');if(_0x15d4f0){_0x3398a1=path['join'](_0x3398a1,'offline-chat/');}var _0x38039b=path[_0xee7d('0x50')](_0x3398a1,_0x34888e[_0xee7d('0x4d')]);return _0x3b2153[_0xee7d('0x52')](_0x38039b);}})[_0xee7d('0x44')](handleError(_0x3b2153,null));}; \ No newline at end of file diff --git a/server/api/attachment/attachment.model.js b/server/api/attachment/attachment.model.js index f8d37b6..4e03c27 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 _0x94ed=['rimraf','../../config/environment','exports','define','attachments','lodash','api','moment','bluebird','request-promise','path'];(function(_0x9c3c56,_0x169b56){var _0x2dd782=function(_0x386962){while(--_0x386962){_0x9c3c56['push'](_0x9c3c56['shift']());}};_0x2dd782(++_0x169b56);}(_0x94ed,0x9f));var _0xd94e=function(_0x828160,_0x26d5be){_0x828160=_0x828160-0x0;var _0x296b5f=_0x94ed[_0x828160];return _0x296b5f;};'use strict';var _=require(_0xd94e('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xd94e('0x1'));var moment=require(_0xd94e('0x2'));var BPromise=require(_0xd94e('0x3'));var rp=require(_0xd94e('0x4'));var fs=require('fs');var path=require(_0xd94e('0x5'));var rimraf=require(_0xd94e('0x6'));var config=require(_0xd94e('0x7'));var attributes=require('./attachment.attributes');module[_0xd94e('0x8')]=function(_0x344e6e,_0x498312){return _0x344e6e[_0xd94e('0x9')]('Attachment',attributes,{'tableName':_0xd94e('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x05a9=['attachments','lodash','../../config/logger','moment','bluebird','request-promise','rimraf','./attachment.attributes','exports','define','Attachment'];(function(_0x1203f,_0x554bbc){var _0x365f0a=function(_0x3531d0){while(--_0x3531d0){_0x1203f['push'](_0x1203f['shift']());}};_0x365f0a(++_0x554bbc);}(_0x05a9,0x9b));var _0x905a=function(_0x2c3869,_0x514109){_0x2c3869=_0x2c3869-0x0;var _0x3af880=_0x05a9[_0x2c3869];return _0x3af880;};'use strict';var _=require(_0x905a('0x0'));var util=require('util');var logger=require(_0x905a('0x1'))('api');var moment=require(_0x905a('0x2'));var BPromise=require(_0x905a('0x3'));var rp=require(_0x905a('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x905a('0x5'));var config=require('../../config/environment');var attributes=require(_0x905a('0x6'));module[_0x905a('0x7')]=function(_0x1933e6,_0x224201){return _0x1933e6[_0x905a('0x8')](_0x905a('0x9'),attributes,{'tableName':_0x905a('0xa'),'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 fc0d189..27d6220 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 _0x7341=['../../config/environment','jayson/promise','client','http','request','info','Attachment,\x20%s,\x20%s','request\x20sent','debug','Attachment,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','options','raw','then','CreateAttachment','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0x5d8dc7,_0x12cb21){var _0x2b7c1c=function(_0x3a8936){while(--_0x3a8936){_0x5d8dc7['push'](_0x5d8dc7['shift']());}};_0x2b7c1c(++_0x12cb21);}(_0x7341,0xe4));var _0x1734=function(_0x74bd5e,_0x2a0da1){_0x74bd5e=_0x74bd5e-0x0;var _0x1cb97c=_0x7341[_0x74bd5e];return _0x1cb97c;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x1734('0x0'));var BPromise=require('bluebird');var rs=require(_0x1734('0x1'));var fs=require('fs');var Redis=require(_0x1734('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x1734('0x3'));var logger=require(_0x1734('0x4'))(_0x1734('0x5'));var config=require(_0x1734('0x6'));var jayson=require(_0x1734('0x7'));var client=jayson[_0x1734('0x8')][_0x1734('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4c7349,_0x1ca30b,_0x2c223d){return new BPromise(function(_0x45c529,_0x5b8977){return client[_0x1734('0xa')](_0x4c7349,_0x2c223d)['then'](function(_0x56f0d5){logger[_0x1734('0xb')](_0x1734('0xc'),_0x1ca30b,_0x1734('0xd'));logger[_0x1734('0xe')](_0x1734('0xf'),_0x1ca30b,_0x1734('0xd'),JSON[_0x1734('0x10')](_0x56f0d5));if(_0x56f0d5[_0x1734('0x11')]){if(_0x56f0d5[_0x1734('0x11')][_0x1734('0x12')]===0x1f4){logger['error'](_0x1734('0xc'),_0x1ca30b,_0x56f0d5[_0x1734('0x11')][_0x1734('0x13')]);return _0x5b8977(_0x56f0d5[_0x1734('0x11')][_0x1734('0x13')]);}logger[_0x1734('0x11')](_0x1734('0xc'),_0x1ca30b,_0x56f0d5[_0x1734('0x11')][_0x1734('0x13')]);return _0x45c529(_0x56f0d5[_0x1734('0x11')][_0x1734('0x13')]);}else{logger[_0x1734('0xb')](_0x1734('0xc'),_0x1ca30b,_0x1734('0xd'));_0x45c529(_0x56f0d5[_0x1734('0x14')][_0x1734('0x13')]);}})[_0x1734('0x15')](function(_0x1ea188){logger[_0x1734('0x11')]('Attachment,\x20%s,\x20%s',_0x1ca30b,_0x1ea188);_0x5b8977(_0x1ea188);});});}exports['CreateAttachment']=function(_0x1fa9c0){var _0x665ddc=this;return new Promise(function(_0x4a86d1,_0x212e63){return db['Attachment']['create'](_0x1fa9c0['body'],{'raw':_0x1fa9c0[_0x1734('0x16')]?_0x1fa9c0['options'][_0x1734('0x17')]===undefined?!![]:![]:!![]})[_0x1734('0x18')](function(_0x4fc4ed){logger['info']('CreateAttachment',_0x1fa9c0);logger[_0x1734('0xe')]('CreateAttachment',_0x1fa9c0,JSON[_0x1734('0x10')](_0x4fc4ed));_0x4a86d1(_0x4fc4ed);})['catch'](function(_0x215ae4){logger[_0x1734('0x11')](_0x1734('0x19'),_0x215ae4[_0x1734('0x13')],_0x1fa9c0);_0x212e63(_0x665ddc[_0x1734('0x11')](0x1f4,_0x215ae4[_0x1734('0x13')]));});});}; \ No newline at end of file +var _0xfa2b=['Attachment','create','options','raw','catch','lodash','util','moment','bluebird','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','code','error','message','result','CreateAttachment'];(function(_0x41582d,_0x291b1c){var _0x59c504=function(_0x4d967e){while(--_0x4d967e){_0x41582d['push'](_0x41582d['shift']());}};_0x59c504(++_0x291b1c);}(_0xfa2b,0x1b7));var _0xbfa2=function(_0x14ff16,_0x18a9ab){_0x14ff16=_0x14ff16-0x0;var _0x16c67a=_0xfa2b[_0x14ff16];return _0x16c67a;};'use strict';var _=require(_0xbfa2('0x0'));var util=require(_0xbfa2('0x1'));var moment=require(_0xbfa2('0x2'));var BPromise=require(_0xbfa2('0x3'));var rs=require(_0xbfa2('0x4'));var fs=require('fs');var Redis=require(_0xbfa2('0x5'));var db=require(_0xbfa2('0x6'))['db'];var utils=require(_0xbfa2('0x7'));var logger=require(_0xbfa2('0x8'))(_0xbfa2('0x9'));var config=require(_0xbfa2('0xa'));var jayson=require(_0xbfa2('0xb'));var client=jayson[_0xbfa2('0xc')][_0xbfa2('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x26ed93,_0x26e9bf,_0x4cd9ae){return new BPromise(function(_0x46a151,_0x4f17e6){return client[_0xbfa2('0xe')](_0x26ed93,_0x4cd9ae)[_0xbfa2('0xf')](function(_0x1b1c13){logger[_0xbfa2('0x10')](_0xbfa2('0x11'),_0x26e9bf,_0xbfa2('0x12'));logger[_0xbfa2('0x13')](_0xbfa2('0x14'),_0x26e9bf,_0xbfa2('0x12'),JSON['stringify'](_0x1b1c13));if(_0x1b1c13['error']){if(_0x1b1c13['error'][_0xbfa2('0x15')]===0x1f4){logger[_0xbfa2('0x16')](_0xbfa2('0x11'),_0x26e9bf,_0x1b1c13[_0xbfa2('0x16')][_0xbfa2('0x17')]);return _0x4f17e6(_0x1b1c13[_0xbfa2('0x16')]['message']);}logger[_0xbfa2('0x16')](_0xbfa2('0x11'),_0x26e9bf,_0x1b1c13[_0xbfa2('0x16')][_0xbfa2('0x17')]);return _0x46a151(_0x1b1c13[_0xbfa2('0x16')]['message']);}else{logger[_0xbfa2('0x10')]('Attachment,\x20%s,\x20%s',_0x26e9bf,'request\x20sent');_0x46a151(_0x1b1c13[_0xbfa2('0x18')]['message']);}})['catch'](function(_0xab2c91){logger[_0xbfa2('0x16')]('Attachment,\x20%s,\x20%s',_0x26e9bf,_0xab2c91);_0x4f17e6(_0xab2c91);});});}exports[_0xbfa2('0x19')]=function(_0x12627a){var _0x28fe6f=this;return new Promise(function(_0x4088c5,_0x37aed6){return db[_0xbfa2('0x1a')][_0xbfa2('0x1b')](_0x12627a['body'],{'raw':_0x12627a[_0xbfa2('0x1c')]?_0x12627a[_0xbfa2('0x1c')][_0xbfa2('0x1d')]===undefined?!![]:![]:!![]})['then'](function(_0x2ac6c3){logger[_0xbfa2('0x10')]('CreateAttachment',_0x12627a);logger[_0xbfa2('0x13')]('CreateAttachment',_0x12627a,JSON['stringify'](_0x2ac6c3));_0x4088c5(_0x2ac6c3);})[_0xbfa2('0x1e')](function(_0xdb059b){logger[_0xbfa2('0x16')](_0xbfa2('0x19'),_0xdb059b['message'],_0x12627a);_0x37aed6(_0x28fe6f['error'](0x1f4,_0xdb059b[_0xbfa2('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/attachment/index.js b/server/api/attachment/index.js index d616fdd..83de210 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 _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(_0x13945a,_0x193193){var _0x23b9f0=function(_0x417933){while(--_0x417933){_0x13945a['push'](_0x13945a['shift']());}};_0x23b9f0(++_0x193193);}(_0xadb5,0xad));var _0x5adb=function(_0x4b9ef7,_0x215516){_0x4b9ef7=_0x4b9ef7-0x0;var _0x5a5da7=_0xadb5[_0x4b9ef7];return _0x5a5da7;};'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 +var _0x2032=['./attachment.controller','get','isAuthenticated','index','/:id','show','download','/:id/clone','clone','root','server/files/attachments/','now','post','single','file','create','put','update','delete','destroy','exports','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment'];(function(_0x2ef8d9,_0x2fb8d0){var _0x18d1db=function(_0x4165bb){while(--_0x4165bb){_0x2ef8d9['push'](_0x2ef8d9['shift']());}};_0x18d1db(++_0x2fb8d0);}(_0x2032,0xd9));var _0x2203=function(_0xb6a7a6,_0x36f65f){_0xb6a7a6=_0xb6a7a6-0x0;var _0x4fdfb2=_0x2032[_0xb6a7a6];return _0x4fdfb2;};'use strict';var multer=require('multer');var util=require(_0x2203('0x0'));var path=require(_0x2203('0x1'));var timeout=require(_0x2203('0x2'));var express=require('express');var router=express[_0x2203('0x3')]();var fs_extra=require(_0x2203('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x2203('0x5'));var config=require(_0x2203('0x6'));var controller=require(_0x2203('0x7'));router[_0x2203('0x8')]('/',auth[_0x2203('0x9')](),controller[_0x2203('0xa')]);router[_0x2203('0x8')](_0x2203('0xb'),auth[_0x2203('0x9')](),controller[_0x2203('0xc')]);router[_0x2203('0x8')]('/:id/download',auth['isAuthenticated'](),controller[_0x2203('0xd')]);router['post'](_0x2203('0xe'),auth[_0x2203('0x9')](),controller[_0x2203('0xf')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x849049,_0x4a6832,_0x3f690a){_0x3f690a(null,path['join'](config[_0x2203('0x10')],_0x2203('0x11')));},'filename':function(_0x4b9376,_0x583bc7,_0x585c76){_0x585c76(null,util['format']('%s-%s',Date[_0x2203('0x12')](),_0x583bc7['originalname']['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x2203('0x13')]('/',upload[_0x2203('0x14')](_0x2203('0x15')),controller[_0x2203('0x16')]);router[_0x2203('0x17')](_0x2203('0xb'),auth[_0x2203('0x9')](),controller[_0x2203('0x18')]);router[_0x2203('0x19')](_0x2203('0xb'),auth['isAuthenticated'](),controller[_0x2203('0x1a')]);module[_0x2203('0x1b')]=router; \ No newline at end of file diff --git a/server/api/authActiveDirectory/authActiveDirectory.controller.js b/server/api/authActiveDirectory/authActiveDirectory.controller.js index 12b86a7..0812d9d 100644 --- a/server/api/authActiveDirectory/authActiveDirectory.controller.js +++ b/server/api/authActiveDirectory/authActiveDirectory.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x61ce=['../../config/logger','api','activedirectory','baseDN','url','authenticate','error','Error\x20authenticate\x20%s:\x20%s','inspect','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','Error\x20authenticate\x20%s:\x20Wrong\x20credentials','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20configured','Setting','then','adSsoEnabled','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20enabled','findOne','password','salt','role','disabled','blocked','blockedAt','online','user','agent','name','domain','blockDuration','minutes','clearBlockUser','getLicense','catch','status','send','message','login','ad-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','json','use','User','passport','passport-local','Strategy','moment','activedirectory2','util','../../mysqldb','../../components/auth/service'];(function(_0x5a92a7,_0x20aaeb){var _0x795d3c=function(_0x46330b){while(--_0x46330b){_0x5a92a7['push'](_0x5a92a7['shift']());}};_0x795d3c(++_0x20aaeb);}(_0x61ce,0x8e));var _0xe61c=function(_0x46836f,_0x3093d1){_0x46836f=_0x46836f-0x0;var _0x310cc0=_0x61ce[_0x46836f];return _0x310cc0;};'use strict';var passport=require(_0xe61c('0x0'));var LocalStrategy=require(_0xe61c('0x1'))[_0xe61c('0x2')];var moment=require(_0xe61c('0x3'));var ActiveDirectory=require(_0xe61c('0x4'));var BPromise=require('bluebird');var util=require(_0xe61c('0x5'));var db=require(_0xe61c('0x6'))['db'];var authService=require(_0xe61c('0x7'));var utils=require('../../config/utils');var config=require('../../config/environment');var logger=require(_0xe61c('0x8'))(_0xe61c('0x9'));function isActiveDirectoryConfigured(_0x569e14){var _0x55d5ef=![];if(typeof _0x569e14[_0xe61c('0xa')]!=='undefined'){_0x55d5ef=_0x569e14['activedirectory'][_0xe61c('0xb')]&&_0x569e14[_0xe61c('0xa')][_0xe61c('0xc')]&&_0x569e14[_0xe61c('0xa')]['domain'];}return _0x55d5ef;}function adAuthenticate(_0x5696cf,_0x1002b1,_0x449fc7){return new BPromise(function(_0x3df490,_0x5df3cb){try{var _0x243ac4=new ActiveDirectory(_0x5696cf);_0x243ac4[_0xe61c('0xd')](_0x1002b1,_0x449fc7,function(_0x59713e,_0x367122){if(_0x59713e){logger[_0xe61c('0xe')](_0xe61c('0xf'),_0x1002b1,util[_0xe61c('0x10')](_0x59713e,{'showHidden':![],'depth':null}));_0x5df3cb(_0xe61c('0x11'));}else if(!_0x367122){logger[_0xe61c('0xe')](_0xe61c('0x12'),_0x1002b1);_0x5df3cb(_0xe61c('0x11'));}else{_0x3df490(_0x367122);}});}catch(_0x1222c4){_0x5df3cb(_0x1222c4);}});}function ActiveDirectoryAuthenticate(_0x1d05fe,_0x4f9b8a,_0x5d1e21,_0x42db2e){var _0x2abf04,_0x4f6f9a;if(!isActiveDirectoryConfigured(config)){logger['error'](_0xe61c('0x13'),_0x4f9b8a);return _0x42db2e(null,![],{'message':_0xe61c('0x11')});}return db[_0xe61c('0x14')]['findOne']({'where':{'id':0x1},'attributes':['adSsoEnabled','blockDuration'],'raw':!![]})[_0xe61c('0x15')](function(_0x2abf5a){_0x2abf04=_0x2abf5a;if(!_0x2abf04[_0xe61c('0x16')]){logger[_0xe61c('0xe')](_0xe61c('0x17'),_0x4f9b8a);throw new Error(_0xe61c('0x11'));}return _0x1d05fe[_0xe61c('0x18')]({'logging':!![],'attributes':['id','name',_0xe61c('0x19'),_0xe61c('0x1a'),_0xe61c('0x1b'),_0xe61c('0x1c'),_0xe61c('0x1d'),_0xe61c('0x1e'),_0xe61c('0x1f')],'where':{'name':_0x4f9b8a,'role':{'$or':['admin',_0xe61c('0x20'),_0xe61c('0x21')]},'adSsoEnabled':!![]}});})[_0xe61c('0x15')](function(_0xa3e3d1){if(!_0xa3e3d1||_0xa3e3d1&&_0xa3e3d1[_0xe61c('0x22')]!==_0x4f9b8a){throw new Error(_0xe61c('0x11'));}_0x4f6f9a=_0xa3e3d1;var _0x1cc890=_0x4f6f9a[_0xe61c('0x22')]+'@'+config[_0xe61c('0xa')][_0xe61c('0x23')];return adAuthenticate(config['activedirectory'],_0x1cc890,_0x5d1e21);})['then'](function(_0x46f6d9){if(_0x4f6f9a['disabled']){throw new Error(_0xe61c('0x11'));}if(_0x2abf04[_0xe61c('0x24')]>0x0){if(_0x4f6f9a[_0xe61c('0x1d')]){if(moment(_0x4f6f9a[_0xe61c('0x1e')])['add'](_0x2abf04[_0xe61c('0x24')],_0xe61c('0x25'))>moment()){throw new Error(_0xe61c('0x11'));}return utils[_0xe61c('0x26')](_0x4f6f9a,0x0,![],null)['then'](function(){return utils[_0xe61c('0x27')](_0x4f6f9a);})[_0xe61c('0x15')](function(){return _0x42db2e(null,_0x4f6f9a);});}else{return utils[_0xe61c('0x27')](_0x4f6f9a)['then'](function(){return _0x42db2e(null,_0x4f6f9a);});}}else{return utils[_0xe61c('0x27')](_0x4f6f9a)[_0xe61c('0x15')](function(){return _0x42db2e(null,_0x4f6f9a);});}})[_0xe61c('0x28')](function(_0x2dd070){return _0x42db2e(null,![],_0x2dd070);});}function handleError(_0x11480b,_0x44cc7f,_0xc1f1e0){return _0x11480b[_0xe61c('0x29')](_0x44cc7f||0x1f4)[_0xe61c('0x2a')]({'message':_0xc1f1e0?_0xc1f1e0[_0xe61c('0x2b')]||_0xc1f1e0:''});}exports[_0xe61c('0x2c')]=function(_0x3eb57c,_0x4214cf,_0x6a8514){passport[_0xe61c('0xd')](_0xe61c('0x2d'),function(_0x17cced,_0x1130c1,_0x4b6099){var _0x4e3c00=_0x17cced||_0x4b6099;if(_0x4e3c00){return handleError(_0x4214cf,0x191,_0x4e3c00);}if(!_0x1130c1){return handleError(_0x4214cf,0x194,{'message':_0xe61c('0x2e')});}else{var _0xf06734={'payload':{'id':_0x1130c1['id'],'role':_0x1130c1[_0xe61c('0x1b')]},'options':{'expiresIn':0x15180}};return authService['signToken'](_0xf06734)[_0xe61c('0x15')](function(_0x24c988){_0x4214cf[_0xe61c('0x2f')]({'id':_0x1130c1['id'],'token':_0x24c988,'statusCall':'','isAlreadyLogged':_0x1130c1[_0xe61c('0x1f')]});});}})(_0x3eb57c,_0x4214cf,_0x6a8514);};passport[_0xe61c('0x30')](_0xe61c('0x2d'),new LocalStrategy({'usernameField':_0xe61c('0x22'),'passwordField':'password'},function(_0x3001ba,_0x39fbf6,_0x2e3159){return ActiveDirectoryAuthenticate(db[_0xe61c('0x31')],_0x3001ba,_0x39fbf6,_0x2e3159);})); \ No newline at end of file +var _0x6a99=['undefined','error','Error\x20authenticate\x20%s:\x20%s','inspect','Error\x20authenticate\x20%s:\x20Wrong\x20credentials','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20configured','Setting','findOne','adSsoEnabled','blockDuration','then','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20enabled','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','name','password','role','blocked','blockedAt','online','admin','user','agent','domain','clearBlockUser','getLicense','catch','status','login','authenticate','ad-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','use','User','passport','passport-local','moment','activedirectory2','../../mysqldb','../../components/auth/service','../../config/logger','activedirectory'];(function(_0xc26c95,_0xed8018){var _0x5626f6=function(_0x4dbc04){while(--_0x4dbc04){_0xc26c95['push'](_0xc26c95['shift']());}};_0x5626f6(++_0xed8018);}(_0x6a99,0x148));var _0x96a9=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x6a99[_0x20a584];return _0x4b41a8;};'use strict';var passport=require(_0x96a9('0x0'));var LocalStrategy=require(_0x96a9('0x1'))['Strategy'];var moment=require(_0x96a9('0x2'));var ActiveDirectory=require(_0x96a9('0x3'));var BPromise=require('bluebird');var util=require('util');var db=require(_0x96a9('0x4'))['db'];var authService=require(_0x96a9('0x5'));var utils=require('../../config/utils');var config=require('../../config/environment');var logger=require(_0x96a9('0x6'))('api');function isActiveDirectoryConfigured(_0xa8aa2){var _0x4b7fbf=![];if(typeof _0xa8aa2[_0x96a9('0x7')]!==_0x96a9('0x8')){_0x4b7fbf=_0xa8aa2[_0x96a9('0x7')]['baseDN']&&_0xa8aa2[_0x96a9('0x7')]['url']&&_0xa8aa2['activedirectory']['domain'];}return _0x4b7fbf;}function adAuthenticate(_0x4fb216,_0x1d856f,_0xf0fbc1){return new BPromise(function(_0x16f995,_0x4e7ba9){try{var _0x26c207=new ActiveDirectory(_0x4fb216);_0x26c207['authenticate'](_0x1d856f,_0xf0fbc1,function(_0x5a8ab6,_0x16000f){if(_0x5a8ab6){logger[_0x96a9('0x9')](_0x96a9('0xa'),_0x1d856f,util[_0x96a9('0xb')](_0x5a8ab6,{'showHidden':![],'depth':null}));_0x4e7ba9('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else if(!_0x16000f){logger[_0x96a9('0x9')](_0x96a9('0xc'),_0x1d856f);_0x4e7ba9('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else{_0x16f995(_0x16000f);}});}catch(_0x201b2d){_0x4e7ba9(_0x201b2d);}});}function ActiveDirectoryAuthenticate(_0x4417df,_0x24be2f,_0x57041e,_0x4db3d3){var _0x31843a,_0x4a5208;if(!isActiveDirectoryConfigured(config)){logger['error'](_0x96a9('0xd'),_0x24be2f);return _0x4db3d3(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}return db[_0x96a9('0xe')][_0x96a9('0xf')]({'where':{'id':0x1},'attributes':[_0x96a9('0x10'),_0x96a9('0x11')],'raw':!![]})[_0x96a9('0x12')](function(_0x1a7ac6){_0x31843a=_0x1a7ac6;if(!_0x31843a[_0x96a9('0x10')]){logger[_0x96a9('0x9')](_0x96a9('0x13'),_0x24be2f);throw new Error(_0x96a9('0x14'));}return _0x4417df['findOne']({'logging':!![],'attributes':['id',_0x96a9('0x15'),_0x96a9('0x16'),'salt',_0x96a9('0x17'),'disabled',_0x96a9('0x18'),_0x96a9('0x19'),_0x96a9('0x1a')],'where':{'name':_0x24be2f,'role':{'$or':[_0x96a9('0x1b'),_0x96a9('0x1c'),_0x96a9('0x1d')]},'adSsoEnabled':!![]}});})[_0x96a9('0x12')](function(_0x2b0d91){if(!_0x2b0d91||_0x2b0d91&&_0x2b0d91['name']!==_0x24be2f){throw new Error(_0x96a9('0x14'));}_0x4a5208=_0x2b0d91;var _0x51aa4b=_0x4a5208[_0x96a9('0x15')]+'@'+config[_0x96a9('0x7')][_0x96a9('0x1e')];return adAuthenticate(config[_0x96a9('0x7')],_0x51aa4b,_0x57041e);})[_0x96a9('0x12')](function(_0x191074){if(_0x4a5208['disabled']){throw new Error(_0x96a9('0x14'));}if(_0x31843a[_0x96a9('0x11')]>0x0){if(_0x4a5208[_0x96a9('0x18')]){if(moment(_0x4a5208[_0x96a9('0x19')])['add'](_0x31843a[_0x96a9('0x11')],'minutes')>moment()){throw new Error(_0x96a9('0x14'));}return utils[_0x96a9('0x1f')](_0x4a5208,0x0,![],null)[_0x96a9('0x12')](function(){return utils[_0x96a9('0x20')](_0x4a5208);})[_0x96a9('0x12')](function(){return _0x4db3d3(null,_0x4a5208);});}else{return utils['getLicense'](_0x4a5208)[_0x96a9('0x12')](function(){return _0x4db3d3(null,_0x4a5208);});}}else{return utils[_0x96a9('0x20')](_0x4a5208)[_0x96a9('0x12')](function(){return _0x4db3d3(null,_0x4a5208);});}})[_0x96a9('0x21')](function(_0x51d99d){return _0x4db3d3(null,![],_0x51d99d);});}function handleError(_0x120b79,_0x452cde,_0x16e0ec){return _0x120b79[_0x96a9('0x22')](_0x452cde||0x1f4)['send']({'message':_0x16e0ec?_0x16e0ec['message']||_0x16e0ec:''});}exports[_0x96a9('0x23')]=function(_0x210c82,_0x3b977f,_0x2b8ac3){passport[_0x96a9('0x24')](_0x96a9('0x25'),function(_0x387c99,_0x3d232f,_0x5b2dbc){var _0x39ad3f=_0x387c99||_0x5b2dbc;if(_0x39ad3f){return handleError(_0x3b977f,0x191,_0x39ad3f);}if(!_0x3d232f){return handleError(_0x3b977f,0x194,{'message':_0x96a9('0x26')});}else{var _0x66c693={'payload':{'id':_0x3d232f['id'],'role':_0x3d232f[_0x96a9('0x17')]},'options':{'expiresIn':0x15180}};return authService[_0x96a9('0x27')](_0x66c693)[_0x96a9('0x12')](function(_0x14c13b){_0x3b977f['json']({'id':_0x3d232f['id'],'token':_0x14c13b,'statusCall':'','isAlreadyLogged':_0x3d232f['online']});});}})(_0x210c82,_0x3b977f,_0x2b8ac3);};passport[_0x96a9('0x28')](_0x96a9('0x25'),new LocalStrategy({'usernameField':_0x96a9('0x15'),'passwordField':'password'},function(_0x1c0319,_0x177dc,_0x6a98c0){return ActiveDirectoryAuthenticate(db[_0x96a9('0x29')],_0x1c0319,_0x177dc,_0x6a98c0);})); \ No newline at end of file diff --git a/server/api/authActiveDirectory/index.js b/server/api/authActiveDirectory/index.js index ff60bb9..5eca1dc 100644 --- a/server/api/authActiveDirectory/index.js +++ b/server/api/authActiveDirectory/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa3ea=['Router','./authActiveDirectory.controller','post','express'];(function(_0x57c8cf,_0x3d2d4b){var _0x31d74e=function(_0x1b1cba){while(--_0x1b1cba){_0x57c8cf['push'](_0x57c8cf['shift']());}};_0x31d74e(++_0x3d2d4b);}(_0xa3ea,0xcb));var _0xaa3e=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0xa3ea[_0x19950b];return _0x3c6b41;};'use strict';var express=require(_0xaa3e('0x0'));var router=express[_0xaa3e('0x1')]();var controller=require(_0xaa3e('0x2'));router[_0xaa3e('0x3')]('/',controller['login']);module['exports']=router; \ No newline at end of file +var _0xcd5e=['login','exports','express','./authActiveDirectory.controller','post'];(function(_0x40df65,_0x317cec){var _0x3c0717=function(_0x128475){while(--_0x128475){_0x40df65['push'](_0x40df65['shift']());}};_0x3c0717(++_0x317cec);}(_0xcd5e,0xe8));var _0xecd5=function(_0xc33e1c,_0x52abd6){_0xc33e1c=_0xc33e1c-0x0;var _0x48a39d=_0xcd5e[_0xc33e1c];return _0x48a39d;};'use strict';var express=require(_0xecd5('0x0'));var router=express['Router']();var controller=require(_0xecd5('0x1'));router[_0xecd5('0x2')]('/',controller[_0xecd5('0x3')]);module[_0xecd5('0x4')]=router; \ No newline at end of file diff --git a/server/api/authGoogle/authGoogle.controller.js b/server/api/authGoogle/authGoogle.controller.js index d9c3233..e42ea44 100644 --- a/server/api/authGoogle/authGoogle.controller.js +++ b/server/api/authGoogle/authGoogle.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['../../config/environment','../../config/utils','login','google','/login','profile','email','callback','authenticate','use','clientID','clientSecret','secret','callbackURL','Setting','findOne','allowedLoginAttempts','User','find','map','emails','value','admin','user','then','disabled','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','blockDuration','blocked','blockedAt','add','getLicense','catch','lodash','passport','passport-google-oauth20','Strategy','../../mysqldb'];(function(_0x5a2adf,_0x39dc46){var _0x37b651=function(_0x24f4a7){while(--_0x24f4a7){_0x5a2adf['push'](_0x5a2adf['shift']());}};_0x37b651(++_0x39dc46);}(_0x9957,0x93));var _0x7995=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x9957[_0x1ac595];return _0x455fff;};'use strict';var _=require(_0x7995('0x0'));var passport=require(_0x7995('0x1'));var GoogleStrategy=require(_0x7995('0x2'))[_0x7995('0x3')];var moment=require('moment');var db=require(_0x7995('0x4'))['db'];var config=require(_0x7995('0x5'));var utils=require(_0x7995('0x6'));exports[_0x7995('0x7')]=passport['authenticate'](_0x7995('0x8'),{'failureRedirect':_0x7995('0x9'),'scope':[_0x7995('0xa'),_0x7995('0xb')],'session':![]});exports[_0x7995('0xc')]=passport[_0x7995('0xd')]('google',{'failureRedirect':_0x7995('0x9'),'session':![]});passport[_0x7995('0xe')](new GoogleStrategy({'clientID':config['google']?config[_0x7995('0x8')][_0x7995('0xf')]:'id','clientSecret':config[_0x7995('0x8')]?config[_0x7995('0x8')][_0x7995('0x10')]:_0x7995('0x11'),'callbackURL':config[_0x7995('0x8')]?config['google'][_0x7995('0x12')]:''},function(_0x41c652,_0x581f22,_0xb0c872,_0x2cb37a){var _0x19a27e,_0x385f00;return db[_0x7995('0x13')][_0x7995('0x14')]({'where':{'id':0x1},'attributes':[_0x7995('0x15'),'blockDuration'],'raw':!![]})['then'](function(_0x2b4e94){_0x19a27e=_0x2b4e94;return db[_0x7995('0x16')][_0x7995('0x17')]({'where':{'email':_[_0x7995('0x18')](_0xb0c872[_0x7995('0x19')],_0x7995('0x1a')),'role':{'$or':[_0x7995('0x1b'),_0x7995('0x1c'),'agent']}}});})[_0x7995('0x1d')](function(_0x565d97){_0x385f00=_0x565d97;if(_0x385f00){if(_0x385f00[_0x7995('0x1e')]){return _0x2cb37a(_0x7995('0x1f'));}else if(_0x19a27e[_0x7995('0x20')]>0x0){if(_0x385f00[_0x7995('0x21')]){if(moment(_0x385f00[_0x7995('0x22')])[_0x7995('0x23')](_0x19a27e['blockDuration'],'minutes')>moment()){return _0x2cb37a(_0x7995('0x1f'));}else{return utils['clearBlockUser'](_0x385f00,0x0,![],null)['then'](function(){return utils[_0x7995('0x24')](_0x385f00);})[_0x7995('0x1d')](function(){return _0x2cb37a(null,_0x385f00);});}}else{return utils['getLicense'](_0x385f00)[_0x7995('0x1d')](function(){return _0x2cb37a(null,_0x385f00);});}}else{return utils['getLicense'](_0x385f00)['then'](function(){return _0x2cb37a(null,_0x385f00);});}}return _0x2cb37a(_0x7995('0x1f'));})[_0x7995('0x25')](function(_0x350fd9){_0x2cb37a(_0x350fd9);});})); \ No newline at end of file +var _0x7a54=['blockedAt','add','minutes','clearBlockUser','getLicense','catch','lodash','passport','passport-google-oauth20','moment','../../mysqldb','../../config/utils','login','authenticate','google','/login','email','use','secret','callbackURL','findOne','allowedLoginAttempts','blockDuration','then','User','find','map','value','admin','user','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'];(function(_0x2be8c2,_0x14a4b5){var _0x97f531=function(_0xcee58d){while(--_0xcee58d){_0x2be8c2['push'](_0x2be8c2['shift']());}};_0x97f531(++_0x14a4b5);}(_0x7a54,0x106));var _0x47a5=function(_0xbfb1ac,_0x5352e9){_0xbfb1ac=_0xbfb1ac-0x0;var _0x79e76d=_0x7a54[_0xbfb1ac];return _0x79e76d;};'use strict';var _=require(_0x47a5('0x0'));var passport=require(_0x47a5('0x1'));var GoogleStrategy=require(_0x47a5('0x2'))['Strategy'];var moment=require(_0x47a5('0x3'));var db=require(_0x47a5('0x4'))['db'];var config=require('../../config/environment');var utils=require(_0x47a5('0x5'));exports[_0x47a5('0x6')]=passport[_0x47a5('0x7')](_0x47a5('0x8'),{'failureRedirect':_0x47a5('0x9'),'scope':['profile',_0x47a5('0xa')],'session':![]});exports['callback']=passport[_0x47a5('0x7')](_0x47a5('0x8'),{'failureRedirect':'/login','session':![]});passport[_0x47a5('0xb')](new GoogleStrategy({'clientID':config['google']?config['google']['clientID']:'id','clientSecret':config[_0x47a5('0x8')]?config[_0x47a5('0x8')]['clientSecret']:_0x47a5('0xc'),'callbackURL':config['google']?config['google'][_0x47a5('0xd')]:''},function(_0x69e4d4,_0x2f399b,_0x250fad,_0xd612dd){var _0xd308b8,_0x1eae59;return db['Setting'][_0x47a5('0xe')]({'where':{'id':0x1},'attributes':[_0x47a5('0xf'),_0x47a5('0x10')],'raw':!![]})[_0x47a5('0x11')](function(_0x139f25){_0xd308b8=_0x139f25;return db[_0x47a5('0x12')][_0x47a5('0x13')]({'where':{'email':_[_0x47a5('0x14')](_0x250fad['emails'],_0x47a5('0x15')),'role':{'$or':[_0x47a5('0x16'),_0x47a5('0x17'),_0x47a5('0x18')]}}});})[_0x47a5('0x11')](function(_0x574af6){_0x1eae59=_0x574af6;if(_0x1eae59){if(_0x1eae59['disabled']){return _0xd612dd(_0x47a5('0x19'));}else if(_0xd308b8['blockDuration']>0x0){if(_0x1eae59['blocked']){if(moment(_0x1eae59[_0x47a5('0x1a')])[_0x47a5('0x1b')](_0xd308b8[_0x47a5('0x10')],_0x47a5('0x1c'))>moment()){return _0xd612dd(_0x47a5('0x19'));}else{return utils[_0x47a5('0x1d')](_0x1eae59,0x0,![],null)[_0x47a5('0x11')](function(){return utils[_0x47a5('0x1e')](_0x1eae59);})[_0x47a5('0x11')](function(){return _0xd612dd(null,_0x1eae59);});}}else{return utils['getLicense'](_0x1eae59)[_0x47a5('0x11')](function(){return _0xd612dd(null,_0x1eae59);});}}else{return utils[_0x47a5('0x1e')](_0x1eae59)['then'](function(){return _0xd612dd(null,_0x1eae59);});}}return _0xd612dd(_0x47a5('0x19'));})[_0x47a5('0x1f')](function(_0x36874d){_0xd612dd(_0x36874d);});})); \ No newline at end of file diff --git a/server/api/authGoogle/index.js b/server/api/authGoogle/index.js index e16d4df..3627148 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 _0x43df=['/callback','callback','isMiddleware','setTokenCookie','exports','passport','Router','../user/user.controller.js','../../components/auth/service','get','login'];(function(_0x324e86,_0x81b1cb){var _0x592846=function(_0x33439c){while(--_0x33439c){_0x324e86['push'](_0x324e86['shift']());}};_0x592846(++_0x81b1cb);}(_0x43df,0x1c8));var _0xf43d=function(_0x33ccaf,_0x192235){_0x33ccaf=_0x33ccaf-0x0;var _0x30abf6=_0x43df[_0x33ccaf];return _0x30abf6;};'use strict';var express=require('express');var passport=require(_0xf43d('0x0'));var router=express[_0xf43d('0x1')]();var controller=require('./authGoogle.controller');var userController=require(_0xf43d('0x2'));var authService=require(_0xf43d('0x3'));router[_0xf43d('0x4')]('/',controller[_0xf43d('0x5')]);router[_0xf43d('0x4')](_0xf43d('0x6'),controller[_0xf43d('0x7')],authService[_0xf43d('0x8')],userController[_0xf43d('0x5')],authService[_0xf43d('0x9')]);module[_0xf43d('0xa')]=router; \ No newline at end of file +var _0xb7fb=['Router','../user/user.controller.js','../../components/auth/service','get','login','/callback','callback','isMiddleware','setTokenCookie','exports','express','passport'];(function(_0x319aee,_0x344705){var _0x596984=function(_0x277dad){while(--_0x277dad){_0x319aee['push'](_0x319aee['shift']());}};_0x596984(++_0x344705);}(_0xb7fb,0x76));var _0xbb7f=function(_0x485fc,_0x170c23){_0x485fc=_0x485fc-0x0;var _0x5ee62c=_0xb7fb[_0x485fc];return _0x5ee62c;};'use strict';var express=require(_0xbb7f('0x0'));var passport=require(_0xbb7f('0x1'));var router=express[_0xbb7f('0x2')]();var controller=require('./authGoogle.controller');var userController=require(_0xbb7f('0x3'));var authService=require(_0xbb7f('0x4'));router[_0xbb7f('0x5')]('/',controller[_0xbb7f('0x6')]);router[_0xbb7f('0x5')](_0xbb7f('0x7'),controller[_0xbb7f('0x8')],authService[_0xbb7f('0x9')],userController[_0xbb7f('0x6')],authService[_0xbb7f('0xa')]);module[_0xbb7f('0xb')]=router; \ No newline at end of file diff --git a/server/api/authLocal/authLocal.controller.js b/server/api/authLocal/authLocal.controller.js index 7f6f03e..b70e0a5 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 _0xdf92=['token','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','enforcePasswordHistory','passwordHistoryLimit','securePassword','validatePasswordPattern','previousPasswords','resetPasswordExpires','save','Password\x20reset!','use','local-login','util','passport','passport-local','Strategy','jayson/promise','lodash','moment','../../mysqldb','../../components/auth/service','../../config/utils','client','Setting','allowedLoginAttempts','then','findOne','name','password','salt','role','blocked','blockedAt','loginAttempts','admin','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','authenticate','blockDuration','minutes','clearBlockUser','disabled','getLicense','catch','find','email','MailServerOut','Smtp','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','service','host','secure','auth','pass','merge','format','\x22%s\x22\x20<%s>','user','request','SendMail','error','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','message','stringify','send','login','Something\x20went\x20wrong,\x20please\x20try\x20again.','json','forgot','body','Email\x20parameter\x20is\x20missing','generate','trim','toLowerCase','This\x20email\x20is\x20not\x20registered.','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','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://','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','status','reset','User','params'];(function(_0x477314,_0x23ec31){var _0x73b4b3=function(_0x3befd9){while(--_0x3befd9){_0x477314['push'](_0x477314['shift']());}};_0x73b4b3(++_0x23ec31);}(_0xdf92,0x15c));var _0x2df9=function(_0x4a3e80,_0x1ceabd){_0x4a3e80=_0x4a3e80-0x0;var _0x4fce61=_0xdf92[_0x4a3e80];return _0x4fce61;};'use strict';var util=require(_0x2df9('0x0'));var passport=require(_0x2df9('0x1'));var LocalStrategy=require(_0x2df9('0x2'))[_0x2df9('0x3')];var jayson=require(_0x2df9('0x4'));var _=require(_0x2df9('0x5'));var rs=require('randomstring');var moment=require(_0x2df9('0x6'));var db=require(_0x2df9('0x7'))['db'];var authService=require(_0x2df9('0x8'));var utils=require(_0x2df9('0x9'));var client=jayson[_0x2df9('0xa')]['http']({'port':0x232b});function localAuthenticate(_0x18b0a6,_0x4b3b48,_0x4659ba,_0x4f5031){var _0xbb5309,_0x354293;return db[_0x2df9('0xb')]['findOne']({'where':{'id':0x1},'attributes':[_0x2df9('0xc'),'blockDuration'],'raw':!![]})[_0x2df9('0xd')](function(_0x3b6202){_0xbb5309=_0x3b6202;return _0x18b0a6[_0x2df9('0xe')]({'attributes':['id',_0x2df9('0xf'),_0x2df9('0x10'),_0x2df9('0x11'),_0x2df9('0x12'),'disabled',_0x2df9('0x13'),_0x2df9('0x14'),_0x2df9('0x15')],'where':{'name':_0x4b3b48,'role':{'$or':[_0x2df9('0x16'),'user',_0x2df9('0x17')]}}});})[_0x2df9('0xd')](function(_0x3b20e7){if(!_0x3b20e7||_0x3b20e7&&_0x3b20e7[_0x2df9('0xf')]!==_0x4b3b48){throw new Error(_0x2df9('0x18'));}else{_0x354293=_0x3b20e7;return _0x354293;}})['then'](function(){_0x354293[_0x2df9('0x19')](_0x4659ba,function(_0x23e49e,_0x447dda){var _0x2f0fbb=_0x354293[_0x2df9('0x15')]+0x1;if(_0x23e49e){return _0x4f5031(_0x23e49e);}else if(!_0x447dda){if(_0x354293['disabled']){return _0x4f5031(null,![],{'message':_0x2df9('0x18')});}else if(_0xbb5309[_0x2df9('0xc')]>0x0){if(_0x354293[_0x2df9('0x13')]){if(_0xbb5309[_0x2df9('0x1a')]>0x0){if(moment(_0x354293['blockedAt'])['add'](_0xbb5309['blockDuration'],_0x2df9('0x1b'))>moment()){return _0x4f5031(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils['clearBlockUser'](_0x354293,_0x2f0fbb,![],null)['then'](function(){return _0x4f5031(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}}else{return _0x4f5031(null,![],{'message':_0x2df9('0x18')});}}else{if(_0x2f0fbb>=_0xbb5309[_0x2df9('0xc')]){return utils[_0x2df9('0x1c')](_0x354293,0x0,!![],moment())['then'](function(){return _0x4f5031(null,![],{'message':_0x2df9('0x18')});});}else{return utils[_0x2df9('0x1c')](_0x354293,_0x2f0fbb,![],null)[_0x2df9('0xd')](function(){return _0x4f5031(null,![],{'message':_0x2df9('0x18')});});}}}else{return _0x4f5031(null,![],{'message':_0x2df9('0x18')});}}else{if(_0x354293[_0x2df9('0x1d')]){return _0x4f5031(null,![],{'message':_0x2df9('0x18')});}else if(_0xbb5309['allowedLoginAttempts']>0x0){if(_0x354293[_0x2df9('0x13')]){if(_0xbb5309[_0x2df9('0x1a')]>0x0){if(moment(_0x354293[_0x2df9('0x14')])['add'](_0xbb5309[_0x2df9('0x1a')],_0x2df9('0x1b'))>moment()){return _0x4f5031(null,![],{'message':_0x2df9('0x18')});}else{return utils[_0x2df9('0x1c')](_0x354293,0x0,![],null)[_0x2df9('0xd')](function(){return utils[_0x2df9('0x1e')](_0x354293);})[_0x2df9('0xd')](function(){return _0x4f5031(null,_0x354293);});}}else{return _0x4f5031(null,![],{'message':_0x2df9('0x18')});}}else{return utils[_0x2df9('0x1c')](_0x354293,0x0,![],null)[_0x2df9('0xd')](function(){return utils[_0x2df9('0x1e')](_0x354293);})['then'](function(){return _0x4f5031(null,_0x354293);})[_0x2df9('0x1f')](function(_0x52ff04){return _0x4f5031(null,![],_0x52ff04);});}}else{if(_0x354293[_0x2df9('0x13')]){return _0x4f5031(null,![],{'message':_0x2df9('0x18')});}else{return utils[_0x2df9('0x1e')](_0x354293)[_0x2df9('0xd')](function(){return _0x4f5031(null,_0x354293);});}}}});})[_0x2df9('0x1f')](function(_0x1f1e32){return _0x4f5031(null,![],_0x1f1e32);});}function sendServiceMail(_0x2a192e){return db['MailAccount'][_0x2df9('0x20')]({'where':{'service':!![]},'attributes':['id',_0x2df9('0xf'),_0x2df9('0x21')],'include':[{'model':db[_0x2df9('0x22')],'as':_0x2df9('0x23')}]})[_0x2df9('0xd')](function(_0x4426d2){if(!_0x4426d2){throw new Error(_0x2df9('0x24'));}var _0x4c09af={'tls':{'rejectUnauthorized':![]}};if(_0x4426d2[_0x2df9('0x23')][_0x2df9('0x25')]){_0x4c09af['service']=_0x4426d2[_0x2df9('0x23')]['service'];}else{_0x4c09af[_0x2df9('0x26')]=_0x4426d2['Smtp']['host'];_0x4c09af['port']=_0x4426d2[_0x2df9('0x23')]['port'];_0x4c09af[_0x2df9('0x27')]=_0x4426d2[_0x2df9('0x23')][_0x2df9('0x27')];}if(_0x4426d2[_0x2df9('0x23')]['authentication']){_0x4c09af[_0x2df9('0x28')]={'user':_0x4426d2[_0x2df9('0x23')]['user'],'pass':_0x4426d2[_0x2df9('0x23')][_0x2df9('0x29')]};}var _0x393494={'account':_0x4c09af,'message':_[_0x2df9('0x2a')]({'from':util[_0x2df9('0x2b')](_0x2df9('0x2c'),_0x4426d2[_0x2df9('0xf')],_0x4426d2[_0x2df9('0x21')]||_0x4426d2['Smtp'][_0x2df9('0x2d')])},_0x2a192e)};return client[_0x2df9('0x2e')](_0x2df9('0x2f'),_0x393494);})[_0x2df9('0xd')](function(_0xcb9b3a){if(_0xcb9b3a[_0x2df9('0x30')]){throw new Error(util[_0x2df9('0x2b')](_0x2df9('0x31'),_0xcb9b3a['error'][_0x2df9('0x32')]||JSON[_0x2df9('0x33')](_0xcb9b3a['error'])));}return!![];});}function handleError(_0x1c2906,_0x2bfa69,_0x80f8ce){return _0x1c2906['status'](_0x2bfa69||0x1f4)[_0x2df9('0x34')]({'message':_0x80f8ce?_0x80f8ce['message']||_0x80f8ce:''});}exports[_0x2df9('0x35')]=function(_0x1dc94a,_0x1f9c66,_0x25d168){passport[_0x2df9('0x19')]('local-login',function(_0x221473,_0x5ecbe4,_0xb2907){var _0x52c3cd=_0x221473||_0xb2907;if(_0x52c3cd){return handleError(_0x1f9c66,0x191,_0x52c3cd);}if(!_0x5ecbe4){return handleError(_0x1f9c66,0x194,{'message':_0x2df9('0x36')});}else{var _0x52a75b={'payload':{'id':_0x5ecbe4['id'],'role':_0x5ecbe4[_0x2df9('0x12')]},'options':{'expiresIn':0x15180}};return authService['signToken'](_0x52a75b)[_0x2df9('0xd')](function(_0x26c23d){_0x1f9c66[_0x2df9('0x37')]({'id':_0x5ecbe4['id'],'token':_0x26c23d,'statusCall':'','isAlreadyLogged':_0x5ecbe4['online']});});}})(_0x1dc94a,_0x1f9c66,_0x25d168);};exports[_0x2df9('0x38')]=function(_0x499497,_0x102cf4,_0x2a5b17){if(!_0x499497[_0x2df9('0x39')][_0x2df9('0x21')]){return handleError(_0x102cf4,0x1f4,{'message':_0x2df9('0x3a')});}var _0x3d0f81=rs[_0x2df9('0x3b')]();_0x499497[_0x2df9('0x39')][_0x2df9('0x21')]=_0x499497[_0x2df9('0x39')]['email'][_0x2df9('0x3c')]()[_0x2df9('0x3d')]();var _0x2669b1;return db[_0x2df9('0xb')][_0x2df9('0xe')]({'where':{'id':0x1},'attributes':[_0x2df9('0xc'),'blockDuration'],'raw':!![]})['then'](function(_0x3aefbb){_0x2669b1=_0x3aefbb;return db['User'][_0x2df9('0x20')]({'where':{'email':_0x499497[_0x2df9('0x39')][_0x2df9('0x21')]}});})[_0x2df9('0xd')](function(_0x25901c){if(!_0x25901c){throw new Error(_0x2df9('0x3e'));}if(_0x25901c['disabled']){throw new Error(_0x2df9('0x3f'));}if(_0x25901c['blocked']){if(moment(_0x25901c[_0x2df9('0x14')])['add'](_0x2669b1[_0x2df9('0x1a')],'minutes')>moment()){throw new Error('The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.');}else{_0x25901c[_0x2df9('0x13')]=![];_0x25901c[_0x2df9('0x14')]=null;}}_0x25901c['resetPasswordToken']=_0x3d0f81;_0x25901c['resetPasswordExpires']=Date['now']()+0x36ee80;return _0x25901c['save']();})[_0x2df9('0xd')](function(){return sendServiceMail({'to':_0x499497[_0x2df9('0x39')][_0x2df9('0x21')],'subject':'xCally\x20Motion\x20Password\x20Reset','text':_0x2df9('0x40')+_0x2df9('0x41')+_0x2df9('0x42')+_0x499497['headers']['host']+'/reset/'+_0x3d0f81+'\x0a\x0a'+_0x2df9('0x43')});})[_0x2df9('0xd')](function(){_0x102cf4[_0x2df9('0x44')](0xc8)[_0x2df9('0x34')]({'message':'Reset\x20Email\x20sent!'});})['catch'](function(_0x8038cb){return handleError(_0x102cf4,0x1f4,_0x8038cb);});};exports[_0x2df9('0x45')]=function(_0x5369ed,_0xc4d593,_0x1974f7){return db[_0x2df9('0x46')][_0x2df9('0x20')]({'where':{'resetPasswordToken':_0x5369ed[_0x2df9('0x47')][_0x2df9('0x48')],'resetPasswordExpires':{'$gt':Date['now']()}}})[_0x2df9('0xd')](function(_0x3fd0bb){if(!_0x3fd0bb){throw new Error(_0x2df9('0x49'));}return db['Setting'][_0x2df9('0xe')]({'attributes':['id','securePassword',_0x2df9('0x4a'),_0x2df9('0x4b')]})['then'](function(_0x4396b6){if(_0x4396b6[_0x2df9('0x4c')])authService[_0x2df9('0x4d')](_0x5369ed[_0x2df9('0x39')][_0x2df9('0x10')]);if(!_0x4396b6[_0x2df9('0x4a')]||!_0x3fd0bb[_0x2df9('0x4e')])return _0x3fd0bb;authService['validatePasswordHistory'](_0x5369ed['body'][_0x2df9('0x10')],_0x3fd0bb['previousPasswords'],_0x4396b6[_0x2df9('0x4b')]);return _0x3fd0bb;})[_0x2df9('0xd')](function(){_0x3fd0bb[_0x2df9('0x10')]=_0x5369ed[_0x2df9('0x39')][_0x2df9('0x10')];_0x3fd0bb['resetPasswordToken']=null;_0x3fd0bb[_0x2df9('0x4f')]=null;return _0x3fd0bb[_0x2df9('0x50')]();});})['then'](function(){_0xc4d593[_0x2df9('0x44')](0xc8)[_0x2df9('0x34')]({'message':_0x2df9('0x51')});})['catch'](function(_0xf9f18d){return handleError(_0xc4d593,0x1f4,_0xf9f18d);});};passport[_0x2df9('0x52')](_0x2df9('0x53'),new LocalStrategy({'usernameField':'name','passwordField':_0x2df9('0x10')},function(_0x64186c,_0x2c48c3,_0x32adb3){return localAuthenticate(db[_0x2df9('0x46')],_0x64186c,_0x2c48c3,_0x32adb3);})); \ No newline at end of file +var _0x6403=['login','authenticate','body','Email\x20parameter\x20is\x20missing','trim','toLowerCase','User','This\x20email\x20is\x20not\x20registered.','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.','resetPasswordToken','resetPasswordExpires','now','save','xCally\x20Motion\x20Password\x20Reset','You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a','Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a','https://','/reset/','send','Reset\x20Email\x20sent!','reset','params','token','securePassword','enforcePasswordHistory','passwordHistoryLimit','validatePasswordPattern','previousPasswords','password','status','Password\x20reset!','use','local-login','passport','passport-local','Strategy','lodash','randomstring','moment','../../config/utils','client','http','Setting','findOne','allowedLoginAttempts','blockDuration','then','salt','role','disabled','blockedAt','user','agent','name','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','loginAttempts','blocked','add','clearBlockUser','minutes','getLicense','catch','MailAccount','find','email','Smtp','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','service','host','port','secure','authentication','pass','format','SendMail','error','stringify','message'];(function(_0x2a8e5f,_0x317747){var _0x425b4a=function(_0x16b158){while(--_0x16b158){_0x2a8e5f['push'](_0x2a8e5f['shift']());}};_0x425b4a(++_0x317747);}(_0x6403,0x71));var _0x3640=function(_0x5c29ef,_0x4c73dd){_0x5c29ef=_0x5c29ef-0x0;var _0x2dad94=_0x6403[_0x5c29ef];return _0x2dad94;};'use strict';var util=require('util');var passport=require(_0x3640('0x0'));var LocalStrategy=require(_0x3640('0x1'))[_0x3640('0x2')];var jayson=require('jayson/promise');var _=require(_0x3640('0x3'));var rs=require(_0x3640('0x4'));var moment=require(_0x3640('0x5'));var db=require('../../mysqldb')['db'];var authService=require('../../components/auth/service');var utils=require(_0x3640('0x6'));var client=jayson[_0x3640('0x7')][_0x3640('0x8')]({'port':0x232b});function localAuthenticate(_0x466de0,_0x227068,_0x1c5509,_0x1d5726){var _0x2db085,_0x2042ae;return db[_0x3640('0x9')][_0x3640('0xa')]({'where':{'id':0x1},'attributes':[_0x3640('0xb'),_0x3640('0xc')],'raw':!![]})[_0x3640('0xd')](function(_0x2604db){_0x2db085=_0x2604db;return _0x466de0[_0x3640('0xa')]({'attributes':['id','name','password',_0x3640('0xe'),_0x3640('0xf'),_0x3640('0x10'),'blocked',_0x3640('0x11'),'loginAttempts'],'where':{'name':_0x227068,'role':{'$or':['admin',_0x3640('0x12'),_0x3640('0x13')]}}});})['then'](function(_0xa2a20d){if(!_0xa2a20d||_0xa2a20d&&_0xa2a20d[_0x3640('0x14')]!==_0x227068){throw new Error(_0x3640('0x15'));}else{_0x2042ae=_0xa2a20d;return _0x2042ae;}})[_0x3640('0xd')](function(){_0x2042ae['authenticate'](_0x1c5509,function(_0x3f03ba,_0x538f1b){var _0x57ce78=_0x2042ae[_0x3640('0x16')]+0x1;if(_0x3f03ba){return _0x1d5726(_0x3f03ba);}else if(!_0x538f1b){if(_0x2042ae['disabled']){return _0x1d5726(null,![],{'message':_0x3640('0x15')});}else if(_0x2db085['allowedLoginAttempts']>0x0){if(_0x2042ae[_0x3640('0x17')]){if(_0x2db085[_0x3640('0xc')]>0x0){if(moment(_0x2042ae[_0x3640('0x11')])[_0x3640('0x18')](_0x2db085[_0x3640('0xc')],'minutes')>moment()){return _0x1d5726(null,![],{'message':_0x3640('0x15')});}else{return utils[_0x3640('0x19')](_0x2042ae,_0x57ce78,![],null)[_0x3640('0xd')](function(){return _0x1d5726(null,![],{'message':_0x3640('0x15')});});}}else{return _0x1d5726(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{if(_0x57ce78>=_0x2db085[_0x3640('0xb')]){return utils[_0x3640('0x19')](_0x2042ae,0x0,!![],moment())[_0x3640('0xd')](function(){return _0x1d5726(null,![],{'message':_0x3640('0x15')});});}else{return utils[_0x3640('0x19')](_0x2042ae,_0x57ce78,![],null)['then'](function(){return _0x1d5726(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}}}else{return _0x1d5726(null,![],{'message':_0x3640('0x15')});}}else{if(_0x2042ae[_0x3640('0x10')]){return _0x1d5726(null,![],{'message':_0x3640('0x15')});}else if(_0x2db085[_0x3640('0xb')]>0x0){if(_0x2042ae['blocked']){if(_0x2db085[_0x3640('0xc')]>0x0){if(moment(_0x2042ae[_0x3640('0x11')])[_0x3640('0x18')](_0x2db085[_0x3640('0xc')],_0x3640('0x1a'))>moment()){return _0x1d5726(null,![],{'message':_0x3640('0x15')});}else{return utils[_0x3640('0x19')](_0x2042ae,0x0,![],null)[_0x3640('0xd')](function(){return utils[_0x3640('0x1b')](_0x2042ae);})['then'](function(){return _0x1d5726(null,_0x2042ae);});}}else{return _0x1d5726(null,![],{'message':_0x3640('0x15')});}}else{return utils[_0x3640('0x19')](_0x2042ae,0x0,![],null)[_0x3640('0xd')](function(){return utils[_0x3640('0x1b')](_0x2042ae);})[_0x3640('0xd')](function(){return _0x1d5726(null,_0x2042ae);})[_0x3640('0x1c')](function(_0x520c87){return _0x1d5726(null,![],_0x520c87);});}}else{if(_0x2042ae['blocked']){return _0x1d5726(null,![],{'message':_0x3640('0x15')});}else{return utils['getLicense'](_0x2042ae)[_0x3640('0xd')](function(){return _0x1d5726(null,_0x2042ae);});}}}});})[_0x3640('0x1c')](function(_0x1f307f){return _0x1d5726(null,![],_0x1f307f);});}function sendServiceMail(_0xfec7b9){return db[_0x3640('0x1d')][_0x3640('0x1e')]({'where':{'service':!![]},'attributes':['id',_0x3640('0x14'),_0x3640('0x1f')],'include':[{'model':db['MailServerOut'],'as':_0x3640('0x20')}]})[_0x3640('0xd')](function(_0xa2de9a){if(!_0xa2de9a){throw new Error(_0x3640('0x21'));}var _0x476a46={'tls':{'rejectUnauthorized':![]}};if(_0xa2de9a[_0x3640('0x20')][_0x3640('0x22')]){_0x476a46[_0x3640('0x22')]=_0xa2de9a[_0x3640('0x20')]['service'];}else{_0x476a46['host']=_0xa2de9a[_0x3640('0x20')][_0x3640('0x23')];_0x476a46[_0x3640('0x24')]=_0xa2de9a[_0x3640('0x20')][_0x3640('0x24')];_0x476a46['secure']=_0xa2de9a[_0x3640('0x20')][_0x3640('0x25')];}if(_0xa2de9a['Smtp'][_0x3640('0x26')]){_0x476a46['auth']={'user':_0xa2de9a[_0x3640('0x20')][_0x3640('0x12')],'pass':_0xa2de9a['Smtp'][_0x3640('0x27')]};}var _0x355d68={'account':_0x476a46,'message':_['merge']({'from':util[_0x3640('0x28')]('\x22%s\x22\x20<%s>',_0xa2de9a[_0x3640('0x14')],_0xa2de9a[_0x3640('0x1f')]||_0xa2de9a[_0x3640('0x20')][_0x3640('0x12')])},_0xfec7b9)};return client['request'](_0x3640('0x29'),_0x355d68);})[_0x3640('0xd')](function(_0x90cf36){if(_0x90cf36[_0x3640('0x2a')]){throw new Error(util[_0x3640('0x28')]('SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!',_0x90cf36[_0x3640('0x2a')]['message']||JSON[_0x3640('0x2b')](_0x90cf36['error'])));}return!![];});}function handleError(_0x4fdf56,_0x1ba96d,_0x2b975f){return _0x4fdf56['status'](_0x1ba96d||0x1f4)['send']({'message':_0x2b975f?_0x2b975f[_0x3640('0x2c')]||_0x2b975f:''});}exports[_0x3640('0x2d')]=function(_0x19bf95,_0x52ede4,_0x47c897){passport[_0x3640('0x2e')]('local-login',function(_0x5bc006,_0x479705,_0x42e1a2){var _0x2d6418=_0x5bc006||_0x42e1a2;if(_0x2d6418){return handleError(_0x52ede4,0x191,_0x2d6418);}if(!_0x479705){return handleError(_0x52ede4,0x194,{'message':'Something\x20went\x20wrong,\x20please\x20try\x20again.'});}else{var _0x4a2368={'payload':{'id':_0x479705['id'],'role':_0x479705[_0x3640('0xf')]},'options':{'expiresIn':0x15180}};return authService['signToken'](_0x4a2368)['then'](function(_0x489f3d){_0x52ede4['json']({'id':_0x479705['id'],'token':_0x489f3d,'statusCall':'','isAlreadyLogged':_0x479705['online']});});}})(_0x19bf95,_0x52ede4,_0x47c897);};exports['forgot']=function(_0x292fdf,_0x275652,_0x5a76f9){if(!_0x292fdf[_0x3640('0x2f')]['email']){return handleError(_0x275652,0x1f4,{'message':_0x3640('0x30')});}var _0x19bb22=rs['generate']();_0x292fdf[_0x3640('0x2f')][_0x3640('0x1f')]=_0x292fdf[_0x3640('0x2f')][_0x3640('0x1f')][_0x3640('0x31')]()[_0x3640('0x32')]();var _0x494e99;return db[_0x3640('0x9')][_0x3640('0xa')]({'where':{'id':0x1},'attributes':[_0x3640('0xb'),_0x3640('0xc')],'raw':!![]})[_0x3640('0xd')](function(_0xdace8e){_0x494e99=_0xdace8e;return db[_0x3640('0x33')][_0x3640('0x1e')]({'where':{'email':_0x292fdf[_0x3640('0x2f')][_0x3640('0x1f')]}});})[_0x3640('0xd')](function(_0xb26788){if(!_0xb26788){throw new Error(_0x3640('0x34'));}if(_0xb26788[_0x3640('0x10')]){throw new Error(_0x3640('0x35'));}if(_0xb26788[_0x3640('0x17')]){if(moment(_0xb26788[_0x3640('0x11')])['add'](_0x494e99['blockDuration'],_0x3640('0x1a'))>moment()){throw new Error(_0x3640('0x36'));}else{_0xb26788[_0x3640('0x17')]=![];_0xb26788['blockedAt']=null;}}_0xb26788[_0x3640('0x37')]=_0x19bb22;_0xb26788[_0x3640('0x38')]=Date[_0x3640('0x39')]()+0x36ee80;return _0xb26788[_0x3640('0x3a')]();})['then'](function(){return sendServiceMail({'to':_0x292fdf[_0x3640('0x2f')][_0x3640('0x1f')],'subject':_0x3640('0x3b'),'text':_0x3640('0x3c')+_0x3640('0x3d')+_0x3640('0x3e')+_0x292fdf['headers']['host']+_0x3640('0x3f')+_0x19bb22+'\x0a\x0a'+'If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a'});})['then'](function(){_0x275652['status'](0xc8)[_0x3640('0x40')]({'message':_0x3640('0x41')});})['catch'](function(_0x539acd){return handleError(_0x275652,0x1f4,_0x539acd);});};exports[_0x3640('0x42')]=function(_0x48be2e,_0x43ff2d,_0xd708e0){return db[_0x3640('0x33')][_0x3640('0x1e')]({'where':{'resetPasswordToken':_0x48be2e[_0x3640('0x43')][_0x3640('0x44')],'resetPasswordExpires':{'$gt':Date[_0x3640('0x39')]()}}})[_0x3640('0xd')](function(_0x3e1a71){if(!_0x3e1a71){throw new Error('Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.');}return db[_0x3640('0x9')][_0x3640('0xa')]({'attributes':['id',_0x3640('0x45'),_0x3640('0x46'),_0x3640('0x47')]})[_0x3640('0xd')](function(_0x157b9f){if(_0x157b9f[_0x3640('0x45')])authService[_0x3640('0x48')](_0x48be2e[_0x3640('0x2f')]['password']);if(!_0x157b9f[_0x3640('0x46')]||!_0x3e1a71[_0x3640('0x49')])return _0x3e1a71;authService['validatePasswordHistory'](_0x48be2e[_0x3640('0x2f')][_0x3640('0x4a')],_0x3e1a71[_0x3640('0x49')],_0x157b9f['passwordHistoryLimit']);return _0x3e1a71;})['then'](function(){_0x3e1a71[_0x3640('0x4a')]=_0x48be2e[_0x3640('0x2f')][_0x3640('0x4a')];_0x3e1a71[_0x3640('0x37')]=null;_0x3e1a71[_0x3640('0x38')]=null;return _0x3e1a71[_0x3640('0x3a')]();});})['then'](function(){_0x43ff2d[_0x3640('0x4b')](0xc8)[_0x3640('0x40')]({'message':_0x3640('0x4c')});})[_0x3640('0x1c')](function(_0x109c31){return handleError(_0x43ff2d,0x1f4,_0x109c31);});};passport[_0x3640('0x4d')](_0x3640('0x4e'),new LocalStrategy({'usernameField':_0x3640('0x14'),'passwordField':'password'},function(_0x5e3418,_0x3f7ef0,_0x2ac1bc){return localAuthenticate(db[_0x3640('0x33')],_0x5e3418,_0x3f7ef0,_0x2ac1bc);})); \ No newline at end of file diff --git a/server/api/authLocal/index.js b/server/api/authLocal/index.js index 158c697..9d0e615 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 _0xf455=['express','Router','./authLocal.controller','post','forgot','/reset/:token','reset'];(function(_0x358162,_0x449f5e){var _0x1c15e9=function(_0x8554b1){while(--_0x8554b1){_0x358162['push'](_0x358162['shift']());}};_0x1c15e9(++_0x449f5e);}(_0xf455,0x1b2));var _0x5f45=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf455[_0x3dd15e];return _0x231fd0;};'use strict';var express=require(_0x5f45('0x0'));var router=express[_0x5f45('0x1')]();var controller=require(_0x5f45('0x2'));router[_0x5f45('0x3')]('/',controller['login']);router[_0x5f45('0x3')]('/forgot',controller[_0x5f45('0x4')]);router[_0x5f45('0x3')](_0x5f45('0x5'),controller[_0x5f45('0x6')]);module['exports']=router; \ No newline at end of file +var _0xeba4=['/reset/:token','reset','exports','express','Router','./authLocal.controller','post','login','forgot'];(function(_0x30f73d,_0x5387af){var _0x20b23d=function(_0x387c1b){while(--_0x387c1b){_0x30f73d['push'](_0x30f73d['shift']());}};_0x20b23d(++_0x5387af);}(_0xeba4,0xc0));var _0x4eba=function(_0x3fba9f,_0x3b7b9b){_0x3fba9f=_0x3fba9f-0x0;var _0x192cf1=_0xeba4[_0x3fba9f];return _0x192cf1;};'use strict';var express=require(_0x4eba('0x0'));var router=express[_0x4eba('0x1')]();var controller=require(_0x4eba('0x2'));router[_0x4eba('0x3')]('/',controller[_0x4eba('0x4')]);router['post']('/forgot',controller[_0x4eba('0x5')]);router[_0x4eba('0x3')](_0x4eba('0x6'),controller[_0x4eba('0x7')]);module[_0x4eba('0x8')]=router; \ No newline at end of file diff --git a/server/api/automation/automation.attributes.js b/server/api/automation/automation.attributes.js index 05c4d6e..0621020 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 _0xa8c3=['STRING','BOOLEAN','INTEGER','sequelize','exports'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0xa8c3,0x16b));var _0x3a8c=function(_0x72a33d,_0x5691da){_0x72a33d=_0x72a33d-0x0;var _0x2621d5=_0xa8c3[_0x72a33d];return _0x2621d5;};'use strict';var Sequelize=require(_0x3a8c('0x0'));module[_0x3a8c('0x1')]={'name':{'type':Sequelize[_0x3a8c('0x2')],'allowNull':![]},'channel':{'type':Sequelize[_0x3a8c('0x2')]},'description':{'type':Sequelize[_0x3a8c('0x2')]},'status':{'type':Sequelize[_0x3a8c('0x3')],'defaultValue':![]},'timeout':{'type':Sequelize[_0x3a8c('0x4')],'defaultValue':0xa}}; \ No newline at end of file +var _0xa9c0=['INTEGER','sequelize','exports','STRING'];(function(_0x5ca79e,_0x185d0e){var _0x8d5177=function(_0x19f16c){while(--_0x19f16c){_0x5ca79e['push'](_0x5ca79e['shift']());}};_0x8d5177(++_0x185d0e);}(_0xa9c0,0x1a9));var _0x0a9c=function(_0x9e1f67,_0x1d30c1){_0x9e1f67=_0x9e1f67-0x0;var _0x8a177d=_0xa9c0[_0x9e1f67];return _0x8a177d;};'use strict';var Sequelize=require(_0x0a9c('0x0'));module[_0x0a9c('0x1')]={'name':{'type':Sequelize[_0x0a9c('0x2')],'allowNull':![]},'channel':{'type':Sequelize[_0x0a9c('0x2')]},'description':{'type':Sequelize[_0x0a9c('0x2')]},'status':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'timeout':{'type':Sequelize[_0x0a9c('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 b664a5e..d7acc8a 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 _0x7f02=['attributes','intersection','fields','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','map','VIRTUAL','options','includeAll','include','findAll','rows','show','params','find','create','catch','body','destroy','addConditions','Condition','ids','omit','getConditions','length','order','addActions','Action','getActions','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','limit','undefined','count','offset','set','Content-Range','apply','reject','update','then','stack','name','send','index','Automation','rawAttributes','fieldName','type','model','keys','query'];(function(_0x4e9751,_0x1dd051){var _0x39186f=function(_0x4e76ff){while(--_0x4e76ff){_0x4e9751['push'](_0x4e9751['shift']());}};_0x39186f(++_0x1dd051);}(_0x7f02,0x77));var _0x27f0=function(_0x570294,_0x139ae4){_0x570294=_0x570294-0x0;var _0x41b542=_0x7f02[_0x570294];return _0x41b542;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x27f0('0x0'));var zipdir=require(_0x27f0('0x1'));var jsonpatch=require(_0x27f0('0x2'));var rp=require(_0x27f0('0x3'));var moment=require(_0x27f0('0x4'));var BPromise=require(_0x27f0('0x5'));var Mustache=require(_0x27f0('0x6'));var util=require(_0x27f0('0x7'));var path=require('path');var sox=require(_0x27f0('0x8'));var csv=require(_0x27f0('0x9'));var ejs=require(_0x27f0('0xa'));var fs=require('fs');var fs_extra=require(_0x27f0('0xb'));var _=require(_0x27f0('0xc'));var squel=require(_0x27f0('0xd'));var crypto=require(_0x27f0('0xe'));var jsforce=require(_0x27f0('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x27f0('0x10'));var Papa=require(_0x27f0('0x11'));var Redis=require(_0x27f0('0x12'));var authService=require(_0x27f0('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x27f0('0x14'));var hardwareService=require(_0x27f0('0x15'));var logger=require('../../config/logger')('api');var utils=require(_0x27f0('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x27f0('0x17'));var db=require(_0x27f0('0x18'))['db'];function respondWithStatusCode(_0x2d1c01,_0x5beeb4){_0x5beeb4=_0x5beeb4||0xcc;return function(_0x56c865){if(_0x56c865){return _0x2d1c01[_0x27f0('0x19')](_0x5beeb4);}return _0x2d1c01[_0x27f0('0x1a')](_0x5beeb4)['end']();};}function respondWithResult(_0x2502db,_0x4a7fdf){_0x4a7fdf=_0x4a7fdf||0xc8;return function(_0x35c4d2){if(_0x35c4d2){return _0x2502db[_0x27f0('0x1a')](_0x4a7fdf)[_0x27f0('0x1b')](_0x35c4d2);}};}function respondWithFilteredResult(_0x95b028,_0x2906bf){return function(_0x47b5a7){if(_0x47b5a7){var _0xe584e4=typeof _0x2906bf['offset']==='undefined'&&typeof _0x2906bf[_0x27f0('0x1c')]===_0x27f0('0x1d');var _0x4d0cad=_0x47b5a7[_0x27f0('0x1e')];var _0x3f7aec=_0xe584e4?0x0:_0x2906bf[_0x27f0('0x1f')];var _0x3fc8cb=_0xe584e4?_0x47b5a7['count']:_0x2906bf[_0x27f0('0x1f')]+_0x2906bf[_0x27f0('0x1c')];var _0x90ea75;if(_0x3fc8cb>=_0x4d0cad){_0x3fc8cb=_0x4d0cad;_0x90ea75=0xc8;}else{_0x90ea75=0xce;}_0x95b028[_0x27f0('0x1a')](_0x90ea75);return _0x95b028[_0x27f0('0x20')](_0x27f0('0x21'),_0x3f7aec+'-'+_0x3fc8cb+'/'+_0x4d0cad)['json'](_0x47b5a7);}return null;};}function patchUpdates(_0x3f2889){return function(_0x27322c){try{jsonpatch[_0x27f0('0x22')](_0x27322c,_0x3f2889,!![]);}catch(_0x3f97be){return BPromise[_0x27f0('0x23')](_0x3f97be);}return _0x27322c['save']();};}function saveUpdates(_0x94115a,_0x58c1f9){return function(_0x24c0cd){if(_0x24c0cd){return _0x24c0cd[_0x27f0('0x24')](_0x94115a)[_0x27f0('0x25')](function(_0x3f7fa6){return _0x3f7fa6;});}return null;};}function removeEntity(_0x34412f,_0x237802){return function(_0x3dd623){if(_0x3dd623){return _0x3dd623['destroy']()['then'](function(){_0x34412f['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1cb62b,_0xa9b66b){return function(_0x7baae5){if(!_0x7baae5){_0x1cb62b[_0x27f0('0x19')](0x194);}return _0x7baae5;};}function handleError(_0x3ec842,_0x3d605e){_0x3d605e=_0x3d605e||0x1f4;return function(_0x8ed955){logger['error'](_0x8ed955[_0x27f0('0x26')]);if(_0x8ed955[_0x27f0('0x27')]){delete _0x8ed955[_0x27f0('0x27')];}_0x3ec842[_0x27f0('0x1a')](_0x3d605e)[_0x27f0('0x28')](_0x8ed955);};}exports[_0x27f0('0x29')]=function(_0x373a86,_0x7d32fb){var _0x408733={},_0x5aba17={},_0x3a78fb={'count':0x0,'rows':[]};var _0x2dcef8=_['map'](db[_0x27f0('0x2a')][_0x27f0('0x2b')],function(_0x1081ac){return{'name':_0x1081ac[_0x27f0('0x2c')],'type':_0x1081ac[_0x27f0('0x2d')]['key']};});_0x5aba17[_0x27f0('0x2e')]=_['map'](_0x2dcef8,_0x27f0('0x27'));_0x5aba17['query']=_[_0x27f0('0x2f')](_0x373a86[_0x27f0('0x30')]);_0x5aba17['filters']=_['intersection'](_0x5aba17['model'],_0x5aba17['query']);_0x408733[_0x27f0('0x31')]=_[_0x27f0('0x32')](_0x5aba17['model'],qs[_0x27f0('0x33')](_0x373a86[_0x27f0('0x30')][_0x27f0('0x33')]));_0x408733[_0x27f0('0x31')]=_0x408733[_0x27f0('0x31')]['length']?_0x408733['attributes']:_0x5aba17[_0x27f0('0x2e')];if(!_0x373a86[_0x27f0('0x30')][_0x27f0('0x34')](_0x27f0('0x35'))){_0x408733[_0x27f0('0x1c')]=qs['limit'](_0x373a86[_0x27f0('0x30')][_0x27f0('0x1c')]);_0x408733[_0x27f0('0x1f')]=qs[_0x27f0('0x1f')](_0x373a86['query'][_0x27f0('0x1f')]);}_0x408733['order']=qs[_0x27f0('0x36')](_0x373a86['query']['sort']);_0x408733[_0x27f0('0x37')]=qs[_0x27f0('0x38')](_[_0x27f0('0x39')](_0x373a86['query'],_0x5aba17['filters']),_0x2dcef8);if(_0x373a86[_0x27f0('0x30')][_0x27f0('0x3a')]){_0x408733[_0x27f0('0x37')]=_[_0x27f0('0x3b')](_0x408733[_0x27f0('0x37')],{'$or':_[_0x27f0('0x3c')](_0x2dcef8,function(_0x5ea7db){if(_0x5ea7db[_0x27f0('0x2d')]!==_0x27f0('0x3d')){var _0x5cdef5={};_0x5cdef5[_0x5ea7db[_0x27f0('0x27')]]={'$like':'%'+_0x373a86[_0x27f0('0x30')][_0x27f0('0x3a')]+'%'};return _0x5cdef5;}})});}_0x408733=_[_0x27f0('0x3b')]({},_0x408733,_0x373a86[_0x27f0('0x3e')]);var _0x1d16c9={'where':_0x408733[_0x27f0('0x37')]};return db[_0x27f0('0x2a')][_0x27f0('0x1e')](_0x1d16c9)[_0x27f0('0x25')](function(_0x2e931c){_0x3a78fb[_0x27f0('0x1e')]=_0x2e931c;if(_0x373a86[_0x27f0('0x30')][_0x27f0('0x3f')]){_0x408733[_0x27f0('0x40')]=[{'all':!![]}];}return db[_0x27f0('0x2a')][_0x27f0('0x41')](_0x408733);})['then'](function(_0x289739){_0x3a78fb[_0x27f0('0x42')]=_0x289739;return _0x3a78fb;})['then'](respondWithFilteredResult(_0x7d32fb,_0x408733))['catch'](handleError(_0x7d32fb,null));};exports[_0x27f0('0x43')]=function(_0x7346ab,_0x4c7010){var _0x32b3cd={'raw':![],'where':{'id':_0x7346ab[_0x27f0('0x44')]['id']}},_0x341691={};_0x341691['model']=_[_0x27f0('0x2f')](db['Automation'][_0x27f0('0x2b')]);_0x341691[_0x27f0('0x30')]=_[_0x27f0('0x2f')](_0x7346ab['query']);_0x341691[_0x27f0('0x38')]=_[_0x27f0('0x32')](_0x341691[_0x27f0('0x2e')],_0x341691[_0x27f0('0x30')]);_0x32b3cd[_0x27f0('0x31')]=_[_0x27f0('0x32')](_0x341691[_0x27f0('0x2e')],qs[_0x27f0('0x33')](_0x7346ab['query'][_0x27f0('0x33')]));_0x32b3cd[_0x27f0('0x31')]=_0x32b3cd['attributes']['length']?_0x32b3cd[_0x27f0('0x31')]:_0x341691[_0x27f0('0x2e')];if(_0x7346ab[_0x27f0('0x30')]['includeAll']){_0x32b3cd['include']=[{'all':!![]}];}_0x32b3cd=_[_0x27f0('0x3b')]({},_0x32b3cd,_0x7346ab[_0x27f0('0x3e')]);return db[_0x27f0('0x2a')][_0x27f0('0x45')](_0x32b3cd)['then'](handleEntityNotFound(_0x4c7010,null))['then'](respondWithResult(_0x4c7010,null))['catch'](handleError(_0x4c7010,null));};exports[_0x27f0('0x46')]=function(_0x8f5e25,_0x5c807a){return db[_0x27f0('0x2a')]['create'](_0x8f5e25['body'],{})[_0x27f0('0x25')](respondWithResult(_0x5c807a,0xc9))[_0x27f0('0x47')](handleError(_0x5c807a,null));};exports[_0x27f0('0x24')]=function(_0x402b14,_0x167ca6){if(_0x402b14[_0x27f0('0x48')]['id']){delete _0x402b14[_0x27f0('0x48')]['id'];}return db[_0x27f0('0x2a')][_0x27f0('0x45')]({'where':{'id':_0x402b14[_0x27f0('0x44')]['id']}})[_0x27f0('0x25')](handleEntityNotFound(_0x167ca6,null))[_0x27f0('0x25')](saveUpdates(_0x402b14['body'],null))[_0x27f0('0x25')](respondWithResult(_0x167ca6,null))[_0x27f0('0x47')](handleError(_0x167ca6,null));};exports[_0x27f0('0x49')]=function(_0x22dc1e,_0x5efeb3){return db[_0x27f0('0x2a')][_0x27f0('0x45')]({'where':{'id':_0x22dc1e[_0x27f0('0x44')]['id']}})[_0x27f0('0x25')](handleEntityNotFound(_0x5efeb3,null))[_0x27f0('0x25')](removeEntity(_0x5efeb3,null))[_0x27f0('0x47')](handleError(_0x5efeb3,null));};exports[_0x27f0('0x4a')]=function(_0x5dc3ee,_0x51b19d,_0x3481bc){return db[_0x27f0('0x4b')][_0x27f0('0x45')]({'where':{'id':_0x5dc3ee[_0x27f0('0x44')]['id']}})[_0x27f0('0x25')](handleEntityNotFound(_0x51b19d,null))['then'](function(_0x538ae1){if(_0x538ae1){return _0x538ae1[_0x27f0('0x4a')](_0x5dc3ee[_0x27f0('0x48')][_0x27f0('0x4c')],_[_0x27f0('0x4d')](_0x5dc3ee[_0x27f0('0x48')],[_0x27f0('0x4c'),'id'])||{});}})[_0x27f0('0x25')](respondWithResult(_0x51b19d,null))[_0x27f0('0x47')](handleError(_0x51b19d,null));};exports[_0x27f0('0x4e')]=function(_0xba1138,_0x406154,_0x7c33c3){var _0x328a91={};var _0x206a95={};var _0x343c5f;var _0x1f69e3;return db[_0x27f0('0x2a')]['findOne']({'where':{'id':_0xba1138[_0x27f0('0x44')]['id']}})[_0x27f0('0x25')](handleEntityNotFound(_0x406154,null))['then'](function(_0x1e5fa9){if(_0x1e5fa9){_0x343c5f=_0x1e5fa9;_0x206a95['model']=_['keys'](db['Condition']['rawAttributes']);_0x206a95[_0x27f0('0x30')]=_[_0x27f0('0x2f')](_0xba1138[_0x27f0('0x30')]);_0x206a95[_0x27f0('0x38')]=_[_0x27f0('0x32')](_0x206a95[_0x27f0('0x2e')],_0x206a95[_0x27f0('0x30')]);_0x328a91[_0x27f0('0x31')]=_['intersection'](_0x206a95[_0x27f0('0x2e')],qs['fields'](_0xba1138[_0x27f0('0x30')][_0x27f0('0x33')]));_0x328a91[_0x27f0('0x31')]=_0x328a91[_0x27f0('0x31')][_0x27f0('0x4f')]?_0x328a91['attributes']:_0x206a95[_0x27f0('0x2e')];_0x328a91[_0x27f0('0x50')]=qs[_0x27f0('0x36')](_0xba1138[_0x27f0('0x30')][_0x27f0('0x36')]);_0x328a91[_0x27f0('0x37')]=qs[_0x27f0('0x38')](_[_0x27f0('0x39')](_0xba1138[_0x27f0('0x30')],_0x206a95['filters']));if(_0xba1138[_0x27f0('0x30')]['filter']){_0x328a91['where']=_[_0x27f0('0x3b')](_0x328a91['where'],{'$or':_[_0x27f0('0x3c')](_0x328a91[_0x27f0('0x31')],function(_0x46d8dd){var _0x1b0c23={};_0x1b0c23[_0x46d8dd]={'$like':'%'+_0xba1138[_0x27f0('0x30')]['filter']+'%'};return _0x1b0c23;})});}_0x328a91=_['merge']({},_0x328a91,_0xba1138[_0x27f0('0x3e')]);return _0x343c5f[_0x27f0('0x4e')](_0x328a91);}})[_0x27f0('0x25')](function(_0x444787){if(_0x444787){_0x1f69e3=_0x444787['length'];if(!_0xba1138['query'][_0x27f0('0x34')](_0x27f0('0x35'))){_0x328a91['limit']=qs[_0x27f0('0x1c')](_0xba1138[_0x27f0('0x30')][_0x27f0('0x1c')]);_0x328a91['offset']=qs['offset'](_0xba1138['query'][_0x27f0('0x1f')]);}return _0x343c5f[_0x27f0('0x4e')](_0x328a91);}})[_0x27f0('0x25')](function(_0xacdd67){if(_0xacdd67){return _0xacdd67?{'count':_0x1f69e3,'rows':_0xacdd67}:null;}})['then'](respondWithResult(_0x406154,null))[_0x27f0('0x47')](handleError(_0x406154,null));};exports[_0x27f0('0x51')]=function(_0x1e48fa,_0x14272b,_0x4b598c){return db[_0x27f0('0x52')][_0x27f0('0x45')]({'where':{'id':_0x1e48fa[_0x27f0('0x44')]['id']}})[_0x27f0('0x25')](handleEntityNotFound(_0x14272b,null))['then'](function(_0xccc41d){if(_0xccc41d){return _0xccc41d['addActions'](_0x1e48fa[_0x27f0('0x48')][_0x27f0('0x4c')],_['omit'](_0x1e48fa[_0x27f0('0x48')],[_0x27f0('0x4c'),'id'])||{});}})[_0x27f0('0x25')](respondWithResult(_0x14272b,null))[_0x27f0('0x47')](handleError(_0x14272b,null));};exports[_0x27f0('0x53')]=function(_0x1784ab,_0x31ae30,_0x8886c){var _0x32d332={};var _0x5c7c2b={};var _0x549126;var _0x223d37;return db[_0x27f0('0x2a')]['findOne']({'where':{'id':_0x1784ab[_0x27f0('0x44')]['id']}})['then'](handleEntityNotFound(_0x31ae30,null))[_0x27f0('0x25')](function(_0x47d733){if(_0x47d733){_0x549126=_0x47d733;_0x5c7c2b[_0x27f0('0x2e')]=_[_0x27f0('0x2f')](db['Action'][_0x27f0('0x2b')]);_0x5c7c2b[_0x27f0('0x30')]=_[_0x27f0('0x2f')](_0x1784ab[_0x27f0('0x30')]);_0x5c7c2b['filters']=_[_0x27f0('0x32')](_0x5c7c2b[_0x27f0('0x2e')],_0x5c7c2b[_0x27f0('0x30')]);_0x32d332[_0x27f0('0x31')]=_['intersection'](_0x5c7c2b[_0x27f0('0x2e')],qs[_0x27f0('0x33')](_0x1784ab[_0x27f0('0x30')][_0x27f0('0x33')]));_0x32d332['attributes']=_0x32d332['attributes']['length']?_0x32d332[_0x27f0('0x31')]:_0x5c7c2b[_0x27f0('0x2e')];_0x32d332[_0x27f0('0x50')]=qs[_0x27f0('0x36')](_0x1784ab[_0x27f0('0x30')][_0x27f0('0x36')]);_0x32d332[_0x27f0('0x37')]=qs[_0x27f0('0x38')](_[_0x27f0('0x39')](_0x1784ab['query'],_0x5c7c2b['filters']));if(_0x1784ab[_0x27f0('0x30')]['filter']){_0x32d332['where']=_['merge'](_0x32d332[_0x27f0('0x37')],{'$or':_['map'](_0x32d332[_0x27f0('0x31')],function(_0x1db23f){var _0x43eb5d={};_0x43eb5d[_0x1db23f]={'$like':'%'+_0x1784ab['query'][_0x27f0('0x3a')]+'%'};return _0x43eb5d;})});}_0x32d332=_['merge']({},_0x32d332,_0x1784ab['options']);return _0x549126[_0x27f0('0x53')](_0x32d332);}})[_0x27f0('0x25')](function(_0x4bd858){if(_0x4bd858){_0x223d37=_0x4bd858[_0x27f0('0x4f')];if(!_0x1784ab[_0x27f0('0x30')][_0x27f0('0x34')](_0x27f0('0x35'))){_0x32d332[_0x27f0('0x1c')]=qs['limit'](_0x1784ab['query'][_0x27f0('0x1c')]);_0x32d332[_0x27f0('0x1f')]=qs[_0x27f0('0x1f')](_0x1784ab[_0x27f0('0x30')][_0x27f0('0x1f')]);}return _0x549126[_0x27f0('0x53')](_0x32d332);}})[_0x27f0('0x25')](function(_0x5f56ac){if(_0x5f56ac){return _0x5f56ac?{'count':_0x223d37,'rows':_0x5f56ac}:null;}})[_0x27f0('0x25')](respondWithResult(_0x31ae30,null))[_0x27f0('0x47')](handleError(_0x31ae30,null));}; \ No newline at end of file +var _0xcd70=['end','error','name','send','index','map','Automation','fieldName','type','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','then','rows','catch','params','find','create','body','omit','ids','getConditions','findOne','Condition','rawAttributes','addActions','getActions','Action','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','update','destroy'];(function(_0x57104f,_0x15879c){var _0x234152=function(_0x4b0a79){while(--_0x4b0a79){_0x57104f['push'](_0x57104f['shift']());}};_0x234152(++_0x15879c);}(_0xcd70,0x1c2));var _0x0cd7=function(_0x817d9b,_0x3c37e3){_0x817d9b=_0x817d9b-0x0;var _0x2752e1=_0xcd70[_0x817d9b];return _0x2752e1;};'use strict';var emlformat=require(_0x0cd7('0x0'));var rimraf=require(_0x0cd7('0x1'));var zipdir=require(_0x0cd7('0x2'));var jsonpatch=require(_0x0cd7('0x3'));var rp=require(_0x0cd7('0x4'));var moment=require(_0x0cd7('0x5'));var BPromise=require(_0x0cd7('0x6'));var Mustache=require(_0x0cd7('0x7'));var util=require(_0x0cd7('0x8'));var path=require(_0x0cd7('0x9'));var sox=require(_0x0cd7('0xa'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0cd7('0xb'));var _=require(_0x0cd7('0xc'));var squel=require(_0x0cd7('0xd'));var crypto=require(_0x0cd7('0xe'));var jsforce=require(_0x0cd7('0xf'));var deskjs=require(_0x0cd7('0x10'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0cd7('0x11'));var Redis=require(_0x0cd7('0x12'));var authService=require(_0x0cd7('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x0cd7('0x14'));var hardwareService=require(_0x0cd7('0x15'));var logger=require(_0x0cd7('0x16'))('api');var utils=require(_0x0cd7('0x17'));var config=require(_0x0cd7('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1e4019,_0x440a9e){_0x440a9e=_0x440a9e||0xcc;return function(_0x73d96b){if(_0x73d96b){return _0x1e4019[_0x0cd7('0x19')](_0x440a9e);}return _0x1e4019[_0x0cd7('0x1a')](_0x440a9e)['end']();};}function respondWithResult(_0x5319e9,_0x5d7ee0){_0x5d7ee0=_0x5d7ee0||0xc8;return function(_0x1a63b8){if(_0x1a63b8){return _0x5319e9[_0x0cd7('0x1a')](_0x5d7ee0)[_0x0cd7('0x1b')](_0x1a63b8);}};}function respondWithFilteredResult(_0x22c3fe,_0x2207c5){return function(_0x19834f){if(_0x19834f){var _0x2c0698=typeof _0x2207c5[_0x0cd7('0x1c')]===_0x0cd7('0x1d')&&typeof _0x2207c5[_0x0cd7('0x1e')]==='undefined';var _0xacb65e=_0x19834f['count'];var _0x526141=_0x2c0698?0x0:_0x2207c5['offset'];var _0x3c69e0=_0x2c0698?_0x19834f[_0x0cd7('0x1f')]:_0x2207c5[_0x0cd7('0x1c')]+_0x2207c5['limit'];var _0x3e1e06;if(_0x3c69e0>=_0xacb65e){_0x3c69e0=_0xacb65e;_0x3e1e06=0xc8;}else{_0x3e1e06=0xce;}_0x22c3fe[_0x0cd7('0x1a')](_0x3e1e06);return _0x22c3fe[_0x0cd7('0x20')](_0x0cd7('0x21'),_0x526141+'-'+_0x3c69e0+'/'+_0xacb65e)['json'](_0x19834f);}return null;};}function patchUpdates(_0x23a2d0){return function(_0x4c5db4){try{jsonpatch['apply'](_0x4c5db4,_0x23a2d0,!![]);}catch(_0x4e91c0){return BPromise['reject'](_0x4e91c0);}return _0x4c5db4['save']();};}function saveUpdates(_0x2b0e11,_0x4138eb){return function(_0x30942a){if(_0x30942a){return _0x30942a[_0x0cd7('0x22')](_0x2b0e11)['then'](function(_0x3c3d6a){return _0x3c3d6a;});}return null;};}function removeEntity(_0x59de24,_0x16881d){return function(_0x2fc374){if(_0x2fc374){return _0x2fc374[_0x0cd7('0x23')]()['then'](function(){_0x59de24[_0x0cd7('0x1a')](0xcc)[_0x0cd7('0x24')]();});}};}function handleEntityNotFound(_0x4728c7,_0x235eee){return function(_0x1d6f8c){if(!_0x1d6f8c){_0x4728c7['sendStatus'](0x194);}return _0x1d6f8c;};}function handleError(_0x39f79e,_0x285f79){_0x285f79=_0x285f79||0x1f4;return function(_0x350f23){logger[_0x0cd7('0x25')](_0x350f23['stack']);if(_0x350f23['name']){delete _0x350f23[_0x0cd7('0x26')];}_0x39f79e[_0x0cd7('0x1a')](_0x285f79)[_0x0cd7('0x27')](_0x350f23);};}exports[_0x0cd7('0x28')]=function(_0x325717,_0x1d81ca){var _0x65fea0={},_0x2da9e2={},_0x3219aa={'count':0x0,'rows':[]};var _0x57d59a=_[_0x0cd7('0x29')](db[_0x0cd7('0x2a')]['rawAttributes'],function(_0x4e61dc){return{'name':_0x4e61dc[_0x0cd7('0x2b')],'type':_0x4e61dc[_0x0cd7('0x2c')]['key']};});_0x2da9e2[_0x0cd7('0x2d')]=_[_0x0cd7('0x29')](_0x57d59a,_0x0cd7('0x26'));_0x2da9e2[_0x0cd7('0x2e')]=_[_0x0cd7('0x2f')](_0x325717[_0x0cd7('0x2e')]);_0x2da9e2[_0x0cd7('0x30')]=_['intersection'](_0x2da9e2[_0x0cd7('0x2d')],_0x2da9e2[_0x0cd7('0x2e')]);_0x65fea0[_0x0cd7('0x31')]=_[_0x0cd7('0x32')](_0x2da9e2[_0x0cd7('0x2d')],qs[_0x0cd7('0x33')](_0x325717[_0x0cd7('0x2e')]['fields']));_0x65fea0[_0x0cd7('0x31')]=_0x65fea0[_0x0cd7('0x31')][_0x0cd7('0x34')]?_0x65fea0['attributes']:_0x2da9e2[_0x0cd7('0x2d')];if(!_0x325717[_0x0cd7('0x2e')][_0x0cd7('0x35')](_0x0cd7('0x36'))){_0x65fea0['limit']=qs['limit'](_0x325717[_0x0cd7('0x2e')][_0x0cd7('0x1e')]);_0x65fea0[_0x0cd7('0x1c')]=qs[_0x0cd7('0x1c')](_0x325717['query']['offset']);}_0x65fea0[_0x0cd7('0x37')]=qs[_0x0cd7('0x38')](_0x325717['query']['sort']);_0x65fea0[_0x0cd7('0x39')]=qs[_0x0cd7('0x30')](_[_0x0cd7('0x3a')](_0x325717['query'],_0x2da9e2['filters']),_0x57d59a);if(_0x325717[_0x0cd7('0x2e')][_0x0cd7('0x3b')]){_0x65fea0['where']=_[_0x0cd7('0x3c')](_0x65fea0[_0x0cd7('0x39')],{'$or':_['map'](_0x57d59a,function(_0x2a43df){if(_0x2a43df['type']!==_0x0cd7('0x3d')){var _0x133b9d={};_0x133b9d[_0x2a43df[_0x0cd7('0x26')]]={'$like':'%'+_0x325717[_0x0cd7('0x2e')][_0x0cd7('0x3b')]+'%'};return _0x133b9d;}})});}_0x65fea0=_['merge']({},_0x65fea0,_0x325717[_0x0cd7('0x3e')]);var _0x2a355f={'where':_0x65fea0[_0x0cd7('0x39')]};return db['Automation']['count'](_0x2a355f)['then'](function(_0x3b61be){_0x3219aa[_0x0cd7('0x1f')]=_0x3b61be;if(_0x325717['query'][_0x0cd7('0x3f')]){_0x65fea0[_0x0cd7('0x40')]=[{'all':!![]}];}return db[_0x0cd7('0x2a')]['findAll'](_0x65fea0);})[_0x0cd7('0x41')](function(_0x41b826){_0x3219aa[_0x0cd7('0x42')]=_0x41b826;return _0x3219aa;})['then'](respondWithFilteredResult(_0x1d81ca,_0x65fea0))[_0x0cd7('0x43')](handleError(_0x1d81ca,null));};exports['show']=function(_0x4b6334,_0x58c6f3){var _0x3f4a86={'raw':![],'where':{'id':_0x4b6334[_0x0cd7('0x44')]['id']}},_0x3dc960={};_0x3dc960[_0x0cd7('0x2d')]=_[_0x0cd7('0x2f')](db[_0x0cd7('0x2a')]['rawAttributes']);_0x3dc960[_0x0cd7('0x2e')]=_[_0x0cd7('0x2f')](_0x4b6334[_0x0cd7('0x2e')]);_0x3dc960[_0x0cd7('0x30')]=_['intersection'](_0x3dc960[_0x0cd7('0x2d')],_0x3dc960[_0x0cd7('0x2e')]);_0x3f4a86[_0x0cd7('0x31')]=_['intersection'](_0x3dc960[_0x0cd7('0x2d')],qs[_0x0cd7('0x33')](_0x4b6334[_0x0cd7('0x2e')]['fields']));_0x3f4a86['attributes']=_0x3f4a86[_0x0cd7('0x31')][_0x0cd7('0x34')]?_0x3f4a86['attributes']:_0x3dc960[_0x0cd7('0x2d')];if(_0x4b6334[_0x0cd7('0x2e')][_0x0cd7('0x3f')]){_0x3f4a86[_0x0cd7('0x40')]=[{'all':!![]}];}_0x3f4a86=_[_0x0cd7('0x3c')]({},_0x3f4a86,_0x4b6334['options']);return db[_0x0cd7('0x2a')][_0x0cd7('0x45')](_0x3f4a86)[_0x0cd7('0x41')](handleEntityNotFound(_0x58c6f3,null))[_0x0cd7('0x41')](respondWithResult(_0x58c6f3,null))[_0x0cd7('0x43')](handleError(_0x58c6f3,null));};exports[_0x0cd7('0x46')]=function(_0x13b9a6,_0x5a337a){return db[_0x0cd7('0x2a')][_0x0cd7('0x46')](_0x13b9a6[_0x0cd7('0x47')],{})['then'](respondWithResult(_0x5a337a,0xc9))[_0x0cd7('0x43')](handleError(_0x5a337a,null));};exports[_0x0cd7('0x22')]=function(_0x8e81cc,_0x5b6b63){if(_0x8e81cc['body']['id']){delete _0x8e81cc['body']['id'];}return db[_0x0cd7('0x2a')][_0x0cd7('0x45')]({'where':{'id':_0x8e81cc['params']['id']}})[_0x0cd7('0x41')](handleEntityNotFound(_0x5b6b63,null))[_0x0cd7('0x41')](saveUpdates(_0x8e81cc[_0x0cd7('0x47')],null))[_0x0cd7('0x41')](respondWithResult(_0x5b6b63,null))['catch'](handleError(_0x5b6b63,null));};exports['destroy']=function(_0x35eaa9,_0x26e05e){return db[_0x0cd7('0x2a')][_0x0cd7('0x45')]({'where':{'id':_0x35eaa9[_0x0cd7('0x44')]['id']}})[_0x0cd7('0x41')](handleEntityNotFound(_0x26e05e,null))[_0x0cd7('0x41')](removeEntity(_0x26e05e,null))['catch'](handleError(_0x26e05e,null));};exports['addConditions']=function(_0x2646d4,_0xea5dec,_0x303c94){return db['Condition'][_0x0cd7('0x45')]({'where':{'id':_0x2646d4[_0x0cd7('0x44')]['id']}})[_0x0cd7('0x41')](handleEntityNotFound(_0xea5dec,null))[_0x0cd7('0x41')](function(_0x13902d){if(_0x13902d){return _0x13902d['addConditions'](_0x2646d4['body']['ids'],_[_0x0cd7('0x48')](_0x2646d4[_0x0cd7('0x47')],[_0x0cd7('0x49'),'id'])||{});}})[_0x0cd7('0x41')](respondWithResult(_0xea5dec,null))['catch'](handleError(_0xea5dec,null));};exports[_0x0cd7('0x4a')]=function(_0x3683a7,_0x47d2bb,_0x407dcb){var _0x402c7c={};var _0x3b8665={};var _0x1bcec6;var _0x2823da;return db['Automation'][_0x0cd7('0x4b')]({'where':{'id':_0x3683a7[_0x0cd7('0x44')]['id']}})['then'](handleEntityNotFound(_0x47d2bb,null))[_0x0cd7('0x41')](function(_0x26138a){if(_0x26138a){_0x1bcec6=_0x26138a;_0x3b8665[_0x0cd7('0x2d')]=_[_0x0cd7('0x2f')](db[_0x0cd7('0x4c')][_0x0cd7('0x4d')]);_0x3b8665[_0x0cd7('0x2e')]=_[_0x0cd7('0x2f')](_0x3683a7[_0x0cd7('0x2e')]);_0x3b8665[_0x0cd7('0x30')]=_[_0x0cd7('0x32')](_0x3b8665[_0x0cd7('0x2d')],_0x3b8665[_0x0cd7('0x2e')]);_0x402c7c['attributes']=_['intersection'](_0x3b8665[_0x0cd7('0x2d')],qs[_0x0cd7('0x33')](_0x3683a7[_0x0cd7('0x2e')][_0x0cd7('0x33')]));_0x402c7c[_0x0cd7('0x31')]=_0x402c7c[_0x0cd7('0x31')][_0x0cd7('0x34')]?_0x402c7c[_0x0cd7('0x31')]:_0x3b8665[_0x0cd7('0x2d')];_0x402c7c['order']=qs['sort'](_0x3683a7['query'][_0x0cd7('0x38')]);_0x402c7c['where']=qs['filters'](_[_0x0cd7('0x3a')](_0x3683a7[_0x0cd7('0x2e')],_0x3b8665[_0x0cd7('0x30')]));if(_0x3683a7[_0x0cd7('0x2e')][_0x0cd7('0x3b')]){_0x402c7c[_0x0cd7('0x39')]=_[_0x0cd7('0x3c')](_0x402c7c[_0x0cd7('0x39')],{'$or':_[_0x0cd7('0x29')](_0x402c7c['attributes'],function(_0x4dc7b1){var _0x50f8e6={};_0x50f8e6[_0x4dc7b1]={'$like':'%'+_0x3683a7[_0x0cd7('0x2e')]['filter']+'%'};return _0x50f8e6;})});}_0x402c7c=_[_0x0cd7('0x3c')]({},_0x402c7c,_0x3683a7[_0x0cd7('0x3e')]);return _0x1bcec6[_0x0cd7('0x4a')](_0x402c7c);}})[_0x0cd7('0x41')](function(_0x2816b0){if(_0x2816b0){_0x2823da=_0x2816b0['length'];if(!_0x3683a7[_0x0cd7('0x2e')][_0x0cd7('0x35')](_0x0cd7('0x36'))){_0x402c7c[_0x0cd7('0x1e')]=qs['limit'](_0x3683a7[_0x0cd7('0x2e')][_0x0cd7('0x1e')]);_0x402c7c['offset']=qs[_0x0cd7('0x1c')](_0x3683a7[_0x0cd7('0x2e')]['offset']);}return _0x1bcec6[_0x0cd7('0x4a')](_0x402c7c);}})[_0x0cd7('0x41')](function(_0x112417){if(_0x112417){return _0x112417?{'count':_0x2823da,'rows':_0x112417}:null;}})[_0x0cd7('0x41')](respondWithResult(_0x47d2bb,null))[_0x0cd7('0x43')](handleError(_0x47d2bb,null));};exports[_0x0cd7('0x4e')]=function(_0x5e643f,_0x413a20,_0xb1fe20){return db['Action']['find']({'where':{'id':_0x5e643f[_0x0cd7('0x44')]['id']}})[_0x0cd7('0x41')](handleEntityNotFound(_0x413a20,null))[_0x0cd7('0x41')](function(_0x14da63){if(_0x14da63){return _0x14da63[_0x0cd7('0x4e')](_0x5e643f[_0x0cd7('0x47')][_0x0cd7('0x49')],_['omit'](_0x5e643f[_0x0cd7('0x47')],[_0x0cd7('0x49'),'id'])||{});}})[_0x0cd7('0x41')](respondWithResult(_0x413a20,null))['catch'](handleError(_0x413a20,null));};exports[_0x0cd7('0x4f')]=function(_0x391248,_0x33d7d4,_0x5be048){var _0x58162b={};var _0xf374b={};var _0x2cfb68;var _0xd1c99d;return db[_0x0cd7('0x2a')][_0x0cd7('0x4b')]({'where':{'id':_0x391248[_0x0cd7('0x44')]['id']}})[_0x0cd7('0x41')](handleEntityNotFound(_0x33d7d4,null))[_0x0cd7('0x41')](function(_0x541fff){if(_0x541fff){_0x2cfb68=_0x541fff;_0xf374b[_0x0cd7('0x2d')]=_[_0x0cd7('0x2f')](db[_0x0cd7('0x50')][_0x0cd7('0x4d')]);_0xf374b[_0x0cd7('0x2e')]=_[_0x0cd7('0x2f')](_0x391248[_0x0cd7('0x2e')]);_0xf374b[_0x0cd7('0x30')]=_[_0x0cd7('0x32')](_0xf374b[_0x0cd7('0x2d')],_0xf374b['query']);_0x58162b[_0x0cd7('0x31')]=_['intersection'](_0xf374b[_0x0cd7('0x2d')],qs[_0x0cd7('0x33')](_0x391248[_0x0cd7('0x2e')]['fields']));_0x58162b['attributes']=_0x58162b[_0x0cd7('0x31')][_0x0cd7('0x34')]?_0x58162b[_0x0cd7('0x31')]:_0xf374b[_0x0cd7('0x2d')];_0x58162b['order']=qs['sort'](_0x391248['query'][_0x0cd7('0x38')]);_0x58162b[_0x0cd7('0x39')]=qs[_0x0cd7('0x30')](_['pick'](_0x391248[_0x0cd7('0x2e')],_0xf374b[_0x0cd7('0x30')]));if(_0x391248['query']['filter']){_0x58162b[_0x0cd7('0x39')]=_[_0x0cd7('0x3c')](_0x58162b[_0x0cd7('0x39')],{'$or':_[_0x0cd7('0x29')](_0x58162b[_0x0cd7('0x31')],function(_0x348768){var _0x1211d3={};_0x1211d3[_0x348768]={'$like':'%'+_0x391248[_0x0cd7('0x2e')]['filter']+'%'};return _0x1211d3;})});}_0x58162b=_[_0x0cd7('0x3c')]({},_0x58162b,_0x391248[_0x0cd7('0x3e')]);return _0x2cfb68['getActions'](_0x58162b);}})['then'](function(_0x97fea6){if(_0x97fea6){_0xd1c99d=_0x97fea6['length'];if(!_0x391248['query'][_0x0cd7('0x35')](_0x0cd7('0x36'))){_0x58162b[_0x0cd7('0x1e')]=qs[_0x0cd7('0x1e')](_0x391248['query']['limit']);_0x58162b[_0x0cd7('0x1c')]=qs[_0x0cd7('0x1c')](_0x391248[_0x0cd7('0x2e')][_0x0cd7('0x1c')]);}return _0x2cfb68[_0x0cd7('0x4f')](_0x58162b);}})['then'](function(_0x121ac7){if(_0x121ac7){return _0x121ac7?{'count':_0xd1c99d,'rows':_0x121ac7}:null;}})[_0x0cd7('0x41')](respondWithResult(_0x33d7d4,null))['catch'](handleError(_0x33d7d4,null));}; \ No newline at end of file diff --git a/server/api/automation/automation.model.js b/server/api/automation/automation.model.js index 13e6298..a47d8e0 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 _0x3c43=['Automation','tools_automations','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./automation.attributes','exports','define'];(function(_0x58252d,_0x2070b3){var _0x55a98c=function(_0x4a2a1e){while(--_0x4a2a1e){_0x58252d['push'](_0x58252d['shift']());}};_0x55a98c(++_0x2070b3);}(_0x3c43,0x15b));var _0x33c4=function(_0xd59cfa,_0x5c7d28){_0xd59cfa=_0xd59cfa-0x0;var _0x39fc91=_0x3c43[_0xd59cfa];return _0x39fc91;};'use strict';var _=require(_0x33c4('0x0'));var util=require(_0x33c4('0x1'));var logger=require(_0x33c4('0x2'))(_0x33c4('0x3'));var moment=require(_0x33c4('0x4'));var BPromise=require(_0x33c4('0x5'));var rp=require(_0x33c4('0x6'));var fs=require('fs');var path=require(_0x33c4('0x7'));var rimraf=require(_0x33c4('0x8'));var config=require(_0x33c4('0x9'));var attributes=require(_0x33c4('0xa'));module[_0x33c4('0xb')]=function(_0x3199ad,_0x143509){return _0x3199ad[_0x33c4('0xc')](_0x33c4('0xd'),attributes,{'tableName':_0x33c4('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x16dd=['api','moment','bluebird','request-promise','rimraf','../../config/environment','./automation.attributes','exports','Automation','tools_automations','util','../../config/logger'];(function(_0x942780,_0x865231){var _0x2fbdd5=function(_0x32ae9b){while(--_0x32ae9b){_0x942780['push'](_0x942780['shift']());}};_0x2fbdd5(++_0x865231);}(_0x16dd,0x17e));var _0xd16d=function(_0x2ea66e,_0xafd23a){_0x2ea66e=_0x2ea66e-0x0;var _0x1d5cf6=_0x16dd[_0x2ea66e];return _0x1d5cf6;};'use strict';var _=require('lodash');var util=require(_0xd16d('0x0'));var logger=require(_0xd16d('0x1'))(_0xd16d('0x2'));var moment=require(_0xd16d('0x3'));var BPromise=require(_0xd16d('0x4'));var rp=require(_0xd16d('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd16d('0x6'));var config=require(_0xd16d('0x7'));var attributes=require(_0xd16d('0x8'));module[_0xd16d('0x9')]=function(_0x5d9f39,_0x3da107){return _0x5d9f39['define'](_0xd16d('0xa'),attributes,{'tableName':_0xd16d('0xb'),'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 b577fdb..974ba55 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 _0xa6ea=['randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','Automation,\x20%s,\x20%s','Automation,\x20%s,\x20%s,\x20%s','error','message','info','request\x20sent','catch','lodash','util','moment','bluebird'];(function(_0x442792,_0x4324fd){var _0x6d8f3a=function(_0x25c381){while(--_0x25c381){_0x442792['push'](_0x442792['shift']());}};_0x6d8f3a(++_0x4324fd);}(_0xa6ea,0x122));var _0xaa6e=function(_0x74ad7c,_0x2f394c){_0x74ad7c=_0x74ad7c-0x0;var _0x4ea94f=_0xa6ea[_0x74ad7c];return _0x4ea94f;};'use strict';var _=require(_0xaa6e('0x0'));var util=require(_0xaa6e('0x1'));var moment=require(_0xaa6e('0x2'));var BPromise=require(_0xaa6e('0x3'));var rs=require(_0xaa6e('0x4'));var fs=require('fs');var Redis=require(_0xaa6e('0x5'));var db=require(_0xaa6e('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xaa6e('0x7'))(_0xaa6e('0x8'));var config=require(_0xaa6e('0x9'));var jayson=require(_0xaa6e('0xa'));var client=jayson[_0xaa6e('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x543fc1,_0x582240,_0x1e3706){return new BPromise(function(_0x22d3e4,_0x2c9dcd){return client[_0xaa6e('0xc')](_0x543fc1,_0x1e3706)[_0xaa6e('0xd')](function(_0x139806){logger['info'](_0xaa6e('0xe'),_0x582240,'request\x20sent');logger['debug'](_0xaa6e('0xf'),_0x582240,'request\x20sent',JSON['stringify'](_0x139806));if(_0x139806[_0xaa6e('0x10')]){if(_0x139806[_0xaa6e('0x10')]['code']===0x1f4){logger[_0xaa6e('0x10')]('Automation,\x20%s,\x20%s',_0x582240,_0x139806[_0xaa6e('0x10')][_0xaa6e('0x11')]);return _0x2c9dcd(_0x139806[_0xaa6e('0x10')][_0xaa6e('0x11')]);}logger[_0xaa6e('0x10')](_0xaa6e('0xe'),_0x582240,_0x139806[_0xaa6e('0x10')][_0xaa6e('0x11')]);return _0x22d3e4(_0x139806[_0xaa6e('0x10')]['message']);}else{logger[_0xaa6e('0x12')](_0xaa6e('0xe'),_0x582240,_0xaa6e('0x13'));_0x22d3e4(_0x139806['result'][_0xaa6e('0x11')]);}})[_0xaa6e('0x14')](function(_0x475b7d){logger[_0xaa6e('0x10')]('Automation,\x20%s,\x20%s',_0x582240,_0x475b7d);_0x2c9dcd(_0x475b7d);});});} \ No newline at end of file +var _0xe2ab=['Automation,\x20%s,\x20%s,\x20%s','stringify','error','Automation,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','info','request\x20sent','debug'];(function(_0x584d37,_0x13fb20){var _0x1a1dbf=function(_0x23cd11){while(--_0x23cd11){_0x584d37['push'](_0x584d37['shift']());}};_0x1a1dbf(++_0x13fb20);}(_0xe2ab,0xc4));var _0xbe2a=function(_0x5cfcaa,_0x70377e){_0x5cfcaa=_0x5cfcaa-0x0;var _0x5e1e7b=_0xe2ab[_0x5cfcaa];return _0x5e1e7b;};'use strict';var _=require(_0xbe2a('0x0'));var util=require(_0xbe2a('0x1'));var moment=require(_0xbe2a('0x2'));var BPromise=require(_0xbe2a('0x3'));var rs=require(_0xbe2a('0x4'));var fs=require('fs');var Redis=require(_0xbe2a('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xbe2a('0x6'));var logger=require(_0xbe2a('0x7'))(_0xbe2a('0x8'));var config=require(_0xbe2a('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xbe2a('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2f504b,_0x58b8f1,_0x5a8a5d){return new BPromise(function(_0xfccbff,_0x232194){return client['request'](_0x2f504b,_0x5a8a5d)['then'](function(_0x83d775){logger[_0xbe2a('0xb')]('Automation,\x20%s,\x20%s',_0x58b8f1,_0xbe2a('0xc'));logger[_0xbe2a('0xd')](_0xbe2a('0xe'),_0x58b8f1,_0xbe2a('0xc'),JSON[_0xbe2a('0xf')](_0x83d775));if(_0x83d775['error']){if(_0x83d775['error']['code']===0x1f4){logger[_0xbe2a('0x10')](_0xbe2a('0x11'),_0x58b8f1,_0x83d775[_0xbe2a('0x10')][_0xbe2a('0x12')]);return _0x232194(_0x83d775[_0xbe2a('0x10')]['message']);}logger[_0xbe2a('0x10')](_0xbe2a('0x11'),_0x58b8f1,_0x83d775[_0xbe2a('0x10')]['message']);return _0xfccbff(_0x83d775[_0xbe2a('0x10')][_0xbe2a('0x12')]);}else{logger[_0xbe2a('0xb')](_0xbe2a('0x11'),_0x58b8f1,_0xbe2a('0xc'));_0xfccbff(_0x83d775[_0xbe2a('0x13')][_0xbe2a('0x12')]);}})[_0xbe2a('0x14')](function(_0x4395fe){logger['error'](_0xbe2a('0x11'),_0x58b8f1,_0x4395fe);_0x232194(_0x4395fe);});});} \ No newline at end of file diff --git a/server/api/automation/index.js b/server/api/automation/index.js index 703439f..080f2f2 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 _0x23d3=['path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','show','getConditions','/:id/actions','getActions','post','create','/:id/conditions','addConditions','addActions','/:id','update','delete','destroy','exports','multer','util'];(function(_0x1beef3,_0x57c4b8){var _0x5af964=function(_0x36f463){while(--_0x36f463){_0x1beef3['push'](_0x1beef3['shift']());}};_0x5af964(++_0x57c4b8);}(_0x23d3,0xe8));var _0x323d=function(_0x18607c,_0x48559e){_0x18607c=_0x18607c-0x0;var _0x5e0619=_0x23d3[_0x18607c];return _0x5e0619;};'use strict';var multer=require(_0x323d('0x0'));var util=require(_0x323d('0x1'));var path=require(_0x323d('0x2'));var timeout=require('connect-timeout');var express=require(_0x323d('0x3'));var router=express[_0x323d('0x4')]();var fs_extra=require(_0x323d('0x5'));var auth=require(_0x323d('0x6'));var interaction=require(_0x323d('0x7'));var config=require(_0x323d('0x8'));var controller=require('./automation.controller');router[_0x323d('0x9')]('/',auth[_0x323d('0xa')](),controller[_0x323d('0xb')]);router[_0x323d('0x9')]('/:id',auth[_0x323d('0xa')](),controller[_0x323d('0xc')]);router[_0x323d('0x9')]('/:id/conditions',auth[_0x323d('0xa')](),controller[_0x323d('0xd')]);router['get'](_0x323d('0xe'),auth[_0x323d('0xa')](),controller[_0x323d('0xf')]);router[_0x323d('0x10')]('/',auth['isAuthenticated'](),controller[_0x323d('0x11')]);router[_0x323d('0x10')](_0x323d('0x12'),auth[_0x323d('0xa')](),controller[_0x323d('0x13')]);router[_0x323d('0x10')](_0x323d('0xe'),auth['isAuthenticated'](),controller[_0x323d('0x14')]);router['put'](_0x323d('0x15'),auth[_0x323d('0xa')](),controller[_0x323d('0x16')]);router[_0x323d('0x17')](_0x323d('0x15'),auth[_0x323d('0xa')](),controller[_0x323d('0x18')]);module[_0x323d('0x19')]=router; \ No newline at end of file +var _0x1798=['getConditions','/:id/actions','getActions','post','addConditions','put','update','delete','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./automation.controller','get','/:id','show','/:id/conditions','isAuthenticated'];(function(_0x123623,_0x9694e2){var _0x3b00d1=function(_0x7e48e0){while(--_0x7e48e0){_0x123623['push'](_0x123623['shift']());}};_0x3b00d1(++_0x9694e2);}(_0x1798,0x1d6));var _0x8179=function(_0x8f3ae9,_0x119634){_0x8f3ae9=_0x8f3ae9-0x0;var _0x53d8a4=_0x1798[_0x8f3ae9];return _0x53d8a4;};'use strict';var multer=require(_0x8179('0x0'));var util=require('util');var path=require(_0x8179('0x1'));var timeout=require(_0x8179('0x2'));var express=require('express');var router=express[_0x8179('0x3')]();var fs_extra=require(_0x8179('0x4'));var auth=require(_0x8179('0x5'));var interaction=require(_0x8179('0x6'));var config=require('../../config/environment');var controller=require(_0x8179('0x7'));router[_0x8179('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x8179('0x8')](_0x8179('0x9'),auth['isAuthenticated'](),controller[_0x8179('0xa')]);router[_0x8179('0x8')](_0x8179('0xb'),auth[_0x8179('0xc')](),controller[_0x8179('0xd')]);router['get'](_0x8179('0xe'),auth[_0x8179('0xc')](),controller[_0x8179('0xf')]);router[_0x8179('0x10')]('/',auth[_0x8179('0xc')](),controller['create']);router[_0x8179('0x10')](_0x8179('0xb'),auth[_0x8179('0xc')](),controller[_0x8179('0x11')]);router[_0x8179('0x10')]('/:id/actions',auth['isAuthenticated'](),controller['addActions']);router[_0x8179('0x12')](_0x8179('0x9'),auth['isAuthenticated'](),controller[_0x8179('0x13')]);router[_0x8179('0x14')](_0x8179('0x9'),auth[_0x8179('0xc')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/campaign/campaign.attributes.js b/server/api/campaign/campaign.attributes.js index 79e4cc9..bf92b90 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 _0xc8e5=['#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','DESC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','#Machine\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','sequelize','exports','STRING','name','ivr','Active/Disactive\x20Campaign','INTEGER','UNSIGNED','Max\x20200\x20calls.','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','ENUM','always','never','BOOLEAN','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence'];(function(_0x4dbf68,_0x243704){var _0x224b3b=function(_0x42d570){while(--_0x42d570){_0x4dbf68['push'](_0x4dbf68['shift']());}};_0x224b3b(++_0x243704);}(_0xc8e5,0xee));var _0x5c8e=function(_0xbe472d,_0x51db05){_0xbe472d=_0xbe472d-0x0;var _0x21a8da=_0xc8e5[_0xbe472d];return _0x21a8da;};'use strict';var Sequelize=require(_0x5c8e('0x0'));module[_0x5c8e('0x1')]={'name':{'type':Sequelize[_0x5c8e('0x2')],'unique':_0x5c8e('0x3'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize['ENUM'](_0x5c8e('0x4')),'allowNull':![],'defaultValue':'ivr'},'description':{'type':Sequelize[_0x5c8e('0x2')]},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0x5c8e('0x5')},'limitCalls':{'type':Sequelize[_0x5c8e('0x6')](0x4)[_0x5c8e('0x7')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0x5c8e('0x8')},'dialOriginateCallerIdName':{'type':Sequelize[_0x5c8e('0x2')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x5c8e('0x2')]},'dialOriginateTimeout':{'type':Sequelize[_0x5c8e('0x6')](0x3)[_0x5c8e('0x7')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x5c8e('0x9')},'dialCongestionMaxRetry':{'type':Sequelize[_0x5c8e('0x6')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x5c8e('0xa')},'dialCongestionRetryFrequency':{'type':Sequelize[_0x5c8e('0x6')](0x5)[_0x5c8e('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x5c8e('0xb')},'dialBusyMaxRetry':{'type':Sequelize[_0x5c8e('0x6')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x5c8e('0xc')},'dialBusyRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x5c8e('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x5c8e('0xd')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x5c8e('0x6')](0x3)[_0x5c8e('0x7')],'defaultValue':0x3,'comment':_0x5c8e('0xe')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x5c8e('0x6')](0x5)[_0x5c8e('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x5c8e('0xf')},'dialGlobalMaxRetry':{'type':Sequelize[_0x5c8e('0x6')](0x3)['UNSIGNED'],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x5c8e('0x10')},'dialTimezone':{'type':Sequelize[_0x5c8e('0x2')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize['STRING'],'defaultValue':_0x5c8e('0x11')},'dialCheckDuplicateType':{'type':Sequelize[_0x5c8e('0x12')](_0x5c8e('0x13'),_0x5c8e('0x14'),'onlyIfOpen'),'defaultValue':'always'},'dialAMDActive':{'type':Sequelize[_0x5c8e('0x15')],'defaultValue':0x0,'comment':_0x5c8e('0x16')},'dialAMDInitialSilence':{'type':Sequelize[_0x5c8e('0x6')](0x9)['UNSIGNED'],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x5c8e('0x17')},'dialAMDGreeting':{'type':Sequelize[_0x5c8e('0x6')](0x9)[_0x5c8e('0x7')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x5c8e('0x18')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x5c8e('0x6')](0x9)[_0x5c8e('0x7')],'defaultValue':0x320,'validate':{'min':0x0},'comment':'#AMD\x20After\x20Greeting\x20Silence'},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x5c8e('0x6')](0x9)[_0x5c8e('0x7')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x5c8e('0x19')},'dialAMDMinWordLength':{'type':Sequelize[_0x5c8e('0x6')](0x9)[_0x5c8e('0x7')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x5c8e('0x1a')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x5c8e('0x6')](0x9)['UNSIGNED'],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x5c8e('0x1b')},'dialAMDMaximumNumberOfWords':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x5c8e('0x1c')},'dialAMDSilenceThreshold':{'type':Sequelize[_0x5c8e('0x6')](0x5)[_0x5c8e('0x7')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x5c8e('0x1d')},'dialAMDMaximumWordLength':{'type':Sequelize['INTEGER'](0x9)[_0x5c8e('0x7')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Word\x20Length'},'dialOrderByScheduledAt':{'type':Sequelize[_0x5c8e('0x12')](_0x5c8e('0x1e'),'ASC'),'defaultValue':_0x5c8e('0x1e')},'dialPrefix':{'type':Sequelize[_0x5c8e('0x2')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x5c8e('0x6')](0x3)[_0x5c8e('0x7')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x5c8e('0x1f')},'dialCutDigit':{'type':Sequelize[_0x5c8e('0x6')](0x3)[_0x5c8e('0x7')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Cut\x20Digit\x20(min:1,\x20max:15)'},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x5c8e('0x6')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)'},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x5c8e('0x6')](0x5)[_0x5c8e('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialDropMaxRetry':{'type':Sequelize[_0x5c8e('0x6')](0x3)[_0x5c8e('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x5c8e('0x20')},'dialDropRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x5c8e('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x5c8e('0x21')},'dialAbandonedMaxRetry':{'type':Sequelize[_0x5c8e('0x6')](0x3)[_0x5c8e('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x5c8e('0x22')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x5c8e('0x6')](0x5)[_0x5c8e('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialMachineMaxRetry':{'type':Sequelize[_0x5c8e('0x6')](0x3)[_0x5c8e('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x5c8e('0x23')},'dialMachineRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x5c8e('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x5c8e('0x24')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x5c8e('0x6')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#AgentReject\x20Retry\x20(min:1,\x20max:999)'},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x5c8e('0x6')](0x5)[_0x5c8e('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x5c8e('0x25')}}; \ No newline at end of file +var _0xb52a=['#AMD\x20Maximum\x20Word\x20Length','DESC','ASC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','#Drop\x20Retry\x20(min:1,\x20max:999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','exports','STRING','ivr','BOOLEAN','Active/Disactive\x20Campaign','INTEGER','Max\x20200\x20calls.','UNSIGNED','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\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,*,*,*','ENUM','always','never','onlyIfOpen','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)'];(function(_0x1fb6be,_0x2fd9a3){var _0x1eebff=function(_0x427c9b){while(--_0x427c9b){_0x1fb6be['push'](_0x1fb6be['shift']());}};_0x1eebff(++_0x2fd9a3);}(_0xb52a,0x76));var _0xab52=function(_0x246148,_0x1358ee){_0x246148=_0x246148-0x0;var _0x453d94=_0xb52a[_0x246148];return _0x453d94;};'use strict';var Sequelize=require('sequelize');module[_0xab52('0x0')]={'name':{'type':Sequelize[_0xab52('0x1')],'unique':'name','allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize['ENUM'](_0xab52('0x2')),'allowNull':![],'defaultValue':_0xab52('0x2')},'description':{'type':Sequelize[_0xab52('0x1')]},'active':{'type':Sequelize[_0xab52('0x3')],'defaultValue':0x0,'comment':_0xab52('0x4')},'limitCalls':{'type':Sequelize[_0xab52('0x5')](0x4)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0xab52('0x6')},'dialOriginateCallerIdName':{'type':Sequelize[_0xab52('0x1')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0xab52('0x1')]},'dialOriginateTimeout':{'type':Sequelize['INTEGER'](0x3)[_0xab52('0x7')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0xab52('0x8')},'dialCongestionMaxRetry':{'type':Sequelize[_0xab52('0x5')](0x3)[_0xab52('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Congestion\x20Retry\x20(min:1,\x20max:999)'},'dialCongestionRetryFrequency':{'type':Sequelize[_0xab52('0x5')](0x5)[_0xab52('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialBusyMaxRetry':{'type':Sequelize[_0xab52('0x5')](0x3)[_0xab52('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xab52('0x9')},'dialBusyRetryFrequency':{'type':Sequelize[_0xab52('0x5')](0x5)[_0xab52('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xab52('0xa')},'dialNoAnswerMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xab52('0x7')],'defaultValue':0x3,'comment':_0xab52('0xb')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0xab52('0x5')](0x5)[_0xab52('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xab52('0xc')},'dialGlobalMaxRetry':{'type':Sequelize[_0xab52('0x5')](0x3)['UNSIGNED'],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0xab52('0xd')},'dialTimezone':{'type':Sequelize[_0xab52('0x1')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0xab52('0x1')],'defaultValue':_0xab52('0xe')},'dialCheckDuplicateType':{'type':Sequelize[_0xab52('0xf')](_0xab52('0x10'),_0xab52('0x11'),_0xab52('0x12')),'defaultValue':_0xab52('0x10')},'dialAMDActive':{'type':Sequelize[_0xab52('0x3')],'defaultValue':0x0,'comment':_0xab52('0x13')},'dialAMDInitialSilence':{'type':Sequelize[_0xab52('0x5')](0x9)[_0xab52('0x7')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0xab52('0x14')},'dialAMDGreeting':{'type':Sequelize[_0xab52('0x5')](0x9)[_0xab52('0x7')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0xab52('0x15')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0xab52('0x5')](0x9)[_0xab52('0x7')],'defaultValue':0x320,'validate':{'min':0x0},'comment':'#AMD\x20After\x20Greeting\x20Silence'},'dialAMDTotalAnalysisTime':{'type':Sequelize['INTEGER'](0x9)[_0xab52('0x7')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xab52('0x16')},'dialAMDMinWordLength':{'type':Sequelize[_0xab52('0x5')](0x9)[_0xab52('0x7')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0xab52('0x17')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0xab52('0x5')](0x9)[_0xab52('0x7')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0xab52('0x18')},'dialAMDMaximumNumberOfWords':{'type':Sequelize['INTEGER'](0x9)[_0xab52('0x7')],'defaultValue':0x3,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Number\x20Of\x20Words'},'dialAMDSilenceThreshold':{'type':Sequelize[_0xab52('0x5')](0x5)[_0xab52('0x7')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0xab52('0x19')},'dialAMDMaximumWordLength':{'type':Sequelize[_0xab52('0x5')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xab52('0x1a')},'dialOrderByScheduledAt':{'type':Sequelize[_0xab52('0xf')](_0xab52('0x1b'),_0xab52('0x1c')),'defaultValue':'DESC'},'dialPrefix':{'type':Sequelize[_0xab52('0x1')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0xab52('0x5')](0x3)[_0xab52('0x7')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xab52('0x1d')},'dialCutDigit':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Cut\x20Digit\x20(min:1,\x20max:15)'},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0xab52('0x5')](0x3)[_0xab52('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)'},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0xab52('0x5')](0x5)[_0xab52('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialDropMaxRetry':{'type':Sequelize[_0xab52('0x5')](0x3)[_0xab52('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xab52('0x1e')},'dialDropRetryFrequency':{'type':Sequelize[_0xab52('0x5')](0x5)[_0xab52('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAbandonedMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xab52('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xab52('0x1f')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0xab52('0x5')](0x5)[_0xab52('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xab52('0x20')},'dialMachineMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xab52('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xab52('0x21')},'dialMachineRetryFrequency':{'type':Sequelize[_0xab52('0x5')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xab52('0x22')},'dialAgentRejectMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xab52('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#AgentReject\x20Retry\x20(min:1,\x20max:999)'},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0xab52('0x5')](0x5)[_0xab52('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xab52('0x23')}}; \ No newline at end of file diff --git a/server/api/campaign/campaign.controller.js b/server/api/campaign/campaign.controller.js index 68afa2b..4de4fc7 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 _0xa196=['getHopperHistories','order','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','CmList','getLists','addLists','ids','spread','dialCheckDuplicateType','always','insert','into','fromQuery','phone','scheduledAt','ContactId','ListId','updatedAt','select','field','NOW()','toString','from','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','CmListId','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','CampaignId\x20=\x20?','COALESCE(phone,\x27\x27)','cm_hopper','onlyIfOpen','cm_contacts','push','all','getBlackLists','addBlackLists','cm_hopper_black','removeBlackLists','zip-dir','request-promise','bluebird','sox','ejs','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','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','count','set','Content-Range','apply','save','update','then','destroy','get','IvrCampaigns','sendStatus','stack','name','send','index','map','Campaign','rawAttributes','fieldName','type','key','query','model','fields','attributes','length','hasOwnProperty','limit','sort','where','pick','filters','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','keys','intersection','includeAll','find','create','user','role','userProfileId','UserProfileResource','error','clone','createdAt','body','omit','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','findOne','CmHopper','nolimit','CampaignId'];(function(_0x5b8779,_0x57d736){var _0x265e9a=function(_0x70ea26){while(--_0x70ea26){_0x5b8779['push'](_0x5b8779['shift']());}};_0x265e9a(++_0x57d736);}(_0xa196,0x1c3));var _0x6a19=function(_0x4ed078,_0x461723){_0x4ed078=_0x4ed078-0x0;var _0x163477=_0xa196[_0x4ed078];return _0x163477;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x6a19('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6a19('0x1'));var moment=require('moment');var BPromise=require(_0x6a19('0x2'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x6a19('0x3'));var csv=require('to-csv');var ejs=require(_0x6a19('0x4'));var fs=require('fs');var fs_extra=require(_0x6a19('0x5'));var _=require(_0x6a19('0x6'));var squel=require(_0x6a19('0x7'));var crypto=require('crypto');var jsforce=require(_0x6a19('0x8'));var deskjs=require(_0x6a19('0x9'));var toCsv=require(_0x6a19('0xa'));var querystring=require(_0x6a19('0xb'));var Papa=require(_0x6a19('0xc'));var Redis=require(_0x6a19('0xd'));var authService=require(_0x6a19('0xe'));var qs=require(_0x6a19('0xf'));var as=require(_0x6a19('0x10'));var hardwareService=require(_0x6a19('0x11'));var logger=require(_0x6a19('0x12'))(_0x6a19('0x13'));var utils=require(_0x6a19('0x14'));var config=require(_0x6a19('0x15'));var licenseUtil=require(_0x6a19('0x16'));var db=require(_0x6a19('0x17'))['db'];function respondWithStatusCode(_0xdeaf87,_0x530f8b){_0x530f8b=_0x530f8b||0xcc;return function(_0xff7411){if(_0xff7411){return _0xdeaf87['sendStatus'](_0x530f8b);}return _0xdeaf87[_0x6a19('0x18')](_0x530f8b)[_0x6a19('0x19')]();};}function respondWithResult(_0x22229e,_0x197b87){_0x197b87=_0x197b87||0xc8;return function(_0x3d8e8a){if(_0x3d8e8a){return _0x22229e[_0x6a19('0x18')](_0x197b87)[_0x6a19('0x1a')](_0x3d8e8a);}};}function respondWithFilteredResult(_0x1bfc9f,_0x5a0847){return function(_0x2a5817){if(_0x2a5817){var _0x57cbd4=typeof _0x5a0847[_0x6a19('0x1b')]===_0x6a19('0x1c')&&typeof _0x5a0847['limit']===_0x6a19('0x1c');var _0x473092=_0x2a5817[_0x6a19('0x1d')];var _0x47a246=_0x57cbd4?0x0:_0x5a0847[_0x6a19('0x1b')];var _0x4397ef=_0x57cbd4?_0x2a5817[_0x6a19('0x1d')]:_0x5a0847['offset']+_0x5a0847['limit'];var _0x2cdf4c;if(_0x4397ef>=_0x473092){_0x4397ef=_0x473092;_0x2cdf4c=0xc8;}else{_0x2cdf4c=0xce;}_0x1bfc9f[_0x6a19('0x18')](_0x2cdf4c);return _0x1bfc9f[_0x6a19('0x1e')](_0x6a19('0x1f'),_0x47a246+'-'+_0x4397ef+'/'+_0x473092)[_0x6a19('0x1a')](_0x2a5817);}return null;};}function patchUpdates(_0x4d609f){return function(_0x371fe0){try{jsonpatch[_0x6a19('0x20')](_0x371fe0,_0x4d609f,!![]);}catch(_0x3be5da){return BPromise['reject'](_0x3be5da);}return _0x371fe0[_0x6a19('0x21')]();};}function saveUpdates(_0x4a555a,_0x495673){return function(_0x1472f4){if(_0x1472f4){return _0x1472f4[_0x6a19('0x22')](_0x4a555a)[_0x6a19('0x23')](function(_0x2f59ee){return _0x2f59ee;});}return null;};}function removeEntity(_0x1116a0,_0x5d20ce){return function(_0x4aa88d){if(_0x4aa88d){return _0x4aa88d[_0x6a19('0x24')]()[_0x6a19('0x23')](function(){var _0x24e36b=_0x4aa88d[_0x6a19('0x25')]({'plain':!![]});var _0x4e0d81=_0x6a19('0x26');return db['UserProfileResource'][_0x6a19('0x24')]({'where':{'type':_0x4e0d81,'resourceId':_0x24e36b['id']}})[_0x6a19('0x23')](function(){return _0x4aa88d;});})[_0x6a19('0x23')](function(){_0x1116a0[_0x6a19('0x18')](0xcc)[_0x6a19('0x19')]();});}};}function handleEntityNotFound(_0x32593c,_0x51abcf){return function(_0x7dcab3){if(!_0x7dcab3){_0x32593c[_0x6a19('0x27')](0x194);}return _0x7dcab3;};}function handleError(_0x1f51a8,_0x5462b9){_0x5462b9=_0x5462b9||0x1f4;return function(_0x4e0d1){logger['error'](_0x4e0d1[_0x6a19('0x28')]);if(_0x4e0d1[_0x6a19('0x29')]){delete _0x4e0d1[_0x6a19('0x29')];}_0x1f51a8['status'](_0x5462b9)[_0x6a19('0x2a')](_0x4e0d1);};}exports[_0x6a19('0x2b')]=function(_0x2246ea,_0x354ad5){var _0xc3e7b2={},_0x3845d5={},_0x128b42={'count':0x0,'rows':[]};var _0x308d52=_[_0x6a19('0x2c')](db[_0x6a19('0x2d')][_0x6a19('0x2e')],function(_0x551153){return{'name':_0x551153[_0x6a19('0x2f')],'type':_0x551153[_0x6a19('0x30')][_0x6a19('0x31')]};});_0x3845d5['model']=_[_0x6a19('0x2c')](_0x308d52,'name');_0x3845d5['query']=_['keys'](_0x2246ea[_0x6a19('0x32')]);_0x3845d5['filters']=_['intersection'](_0x3845d5['model'],_0x3845d5[_0x6a19('0x32')]);_0xc3e7b2['attributes']=_['intersection'](_0x3845d5[_0x6a19('0x33')],qs[_0x6a19('0x34')](_0x2246ea[_0x6a19('0x32')][_0x6a19('0x34')]));_0xc3e7b2[_0x6a19('0x35')]=_0xc3e7b2['attributes'][_0x6a19('0x36')]?_0xc3e7b2[_0x6a19('0x35')]:_0x3845d5['model'];if(!_0x2246ea[_0x6a19('0x32')][_0x6a19('0x37')]('nolimit')){_0xc3e7b2[_0x6a19('0x38')]=qs[_0x6a19('0x38')](_0x2246ea[_0x6a19('0x32')][_0x6a19('0x38')]);_0xc3e7b2['offset']=qs[_0x6a19('0x1b')](_0x2246ea[_0x6a19('0x32')][_0x6a19('0x1b')]);}_0xc3e7b2['order']=qs[_0x6a19('0x39')](_0x2246ea[_0x6a19('0x32')]['sort']);_0xc3e7b2[_0x6a19('0x3a')]=qs['filters'](_[_0x6a19('0x3b')](_0x2246ea[_0x6a19('0x32')],_0x3845d5[_0x6a19('0x3c')]),_0x308d52);if(_0x2246ea[_0x6a19('0x32')][_0x6a19('0x3d')]){_0xc3e7b2[_0x6a19('0x3a')]=_[_0x6a19('0x3e')](_0xc3e7b2[_0x6a19('0x3a')],{'$or':_[_0x6a19('0x2c')](_0x308d52,function(_0x4b5788){if(_0x4b5788[_0x6a19('0x30')]!==_0x6a19('0x3f')){var _0x4ed007={};_0x4ed007[_0x4b5788[_0x6a19('0x29')]]={'$like':'%'+_0x2246ea['query']['filter']+'%'};return _0x4ed007;}})});}_0xc3e7b2=_[_0x6a19('0x3e')]({},_0xc3e7b2,_0x2246ea[_0x6a19('0x40')]);var _0x2543ac={'where':_0xc3e7b2['where']};return db[_0x6a19('0x2d')][_0x6a19('0x1d')](_0x2543ac)[_0x6a19('0x23')](function(_0x382606){_0x128b42[_0x6a19('0x1d')]=_0x382606;if(_0x2246ea[_0x6a19('0x32')]['includeAll']){_0xc3e7b2[_0x6a19('0x41')]=[{'all':!![]}];}return db[_0x6a19('0x2d')][_0x6a19('0x42')](_0xc3e7b2);})[_0x6a19('0x23')](function(_0x3f5db1){_0x128b42[_0x6a19('0x43')]=_0x3f5db1;return _0x128b42;})[_0x6a19('0x23')](respondWithFilteredResult(_0x354ad5,_0xc3e7b2))[_0x6a19('0x44')](handleError(_0x354ad5,null));};exports[_0x6a19('0x45')]=function(_0x34c467,_0x39e08b){var _0x4e8dac={'raw':![],'where':{'id':_0x34c467[_0x6a19('0x46')]['id']}},_0x58775e={};_0x58775e[_0x6a19('0x33')]=_['keys'](db[_0x6a19('0x2d')][_0x6a19('0x2e')]);_0x58775e[_0x6a19('0x32')]=_[_0x6a19('0x47')](_0x34c467[_0x6a19('0x32')]);_0x58775e['filters']=_[_0x6a19('0x48')](_0x58775e[_0x6a19('0x33')],_0x58775e['query']);_0x4e8dac['attributes']=_[_0x6a19('0x48')](_0x58775e[_0x6a19('0x33')],qs[_0x6a19('0x34')](_0x34c467[_0x6a19('0x32')]['fields']));_0x4e8dac[_0x6a19('0x35')]=_0x4e8dac['attributes']['length']?_0x4e8dac[_0x6a19('0x35')]:_0x58775e['model'];if(_0x34c467[_0x6a19('0x32')][_0x6a19('0x49')]){_0x4e8dac[_0x6a19('0x41')]=[{'all':!![]}];}_0x4e8dac=_[_0x6a19('0x3e')]({},_0x4e8dac,_0x34c467[_0x6a19('0x40')]);return db[_0x6a19('0x2d')][_0x6a19('0x4a')](_0x4e8dac)[_0x6a19('0x23')](handleEntityNotFound(_0x39e08b,null))[_0x6a19('0x23')](respondWithResult(_0x39e08b,null))[_0x6a19('0x44')](handleError(_0x39e08b,null));};exports[_0x6a19('0x4b')]=function(_0x4be11b,_0x493186){return db[_0x6a19('0x2d')][_0x6a19('0x4b')](_0x4be11b['body'],{})[_0x6a19('0x23')](function(_0x21b661){var _0x461d6f=_0x4be11b[_0x6a19('0x4c')][_0x6a19('0x25')]({'plain':!![]});if(!_0x461d6f)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x461d6f[_0x6a19('0x4d')]===_0x6a19('0x4c')){var _0xa417ec=_0x21b661['get']({'plain':!![]});var _0x241383=_0x6a19('0x26');return db['UserProfileSection']['find']({'where':{'name':_0x241383,'userProfileId':_0x461d6f[_0x6a19('0x4e')]},'raw':!![]})[_0x6a19('0x23')](function(_0x5a9a81){if(_0x5a9a81&&_0x5a9a81['autoAssociation']===0x0){return db[_0x6a19('0x4f')]['create']({'name':_0xa417ec[_0x6a19('0x29')],'resourceId':_0xa417ec['id'],'type':_0x5a9a81[_0x6a19('0x29')],'sectionId':_0x5a9a81['id']},{})['then'](function(){return _0x21b661;});}else{return _0x21b661;}})[_0x6a19('0x44')](function(_0x863cea){logger[_0x6a19('0x50')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x863cea);throw _0x863cea;});}return _0x21b661;})[_0x6a19('0x23')](respondWithResult(_0x493186,0xc9))['catch'](handleError(_0x493186,null));};exports[_0x6a19('0x51')]=function(_0x4ffa6d,_0x26204c){var _0x5a8d8c={'where':{'id':_0x4ffa6d[_0x6a19('0x46')]['id']}},_0x517e9a={};_0x517e9a[_0x6a19('0x33')]=_[_0x6a19('0x47')](db[_0x6a19('0x2d')][_0x6a19('0x2e')]);_0x5a8d8c[_0x6a19('0x35')]=_[_0x6a19('0x48')](_0x517e9a[_0x6a19('0x33')],qs[_0x6a19('0x34')](_0x4ffa6d['query'][_0x6a19('0x34')]));_0x5a8d8c[_0x6a19('0x35')]=_0x5a8d8c[_0x6a19('0x35')][_0x6a19('0x36')]?_0x5a8d8c[_0x6a19('0x35')]:_0x517e9a[_0x6a19('0x33')];if(_0x4ffa6d[_0x6a19('0x32')][_0x6a19('0x49')]){_0x5a8d8c[_0x6a19('0x41')]=[{'all':!![]}];}_0x5a8d8c=_[_0x6a19('0x3e')]({},_0x5a8d8c,_0x4ffa6d[_0x6a19('0x40')]);return db[_0x6a19('0x2d')][_0x6a19('0x4a')](_0x5a8d8c)[_0x6a19('0x23')](handleEntityNotFound(_0x26204c,null))[_0x6a19('0x23')](function(_0x5a6221){if(_0x5a6221){var _0x3c6700=_0x5a6221['get']({'plain':!![]});_0x3c6700=qs['omit'](_0x3c6700,['id',_0x6a19('0x52'),'updatedAt']);_0x4ffa6d[_0x6a19('0x53')]=_[_0x6a19('0x54')](_0x4ffa6d['body'],['id',_0x6a19('0x52'),'updatedAt']);return db[_0x6a19('0x2d')][_0x6a19('0x4b')](_['merge'](_0x3c6700,_0x4ffa6d[_0x6a19('0x53')]),{'include':_0x4ffa6d['query'][_0x6a19('0x49')]?[{'all':!![]}]:undefined})['then'](function(_0x5a7a6a){var _0xf2732f=_0x4ffa6d[_0x6a19('0x4c')][_0x6a19('0x25')]({'plain':!![]});if(!_0xf2732f)throw new Error(_0x6a19('0x55'));if(_0xf2732f['role']===_0x6a19('0x4c')){var _0x15e87f=_0x5a7a6a[_0x6a19('0x25')]({'plain':!![]});var _0x424f77=_0x6a19('0x26');return db[_0x6a19('0x56')][_0x6a19('0x4a')]({'where':{'name':_0x424f77,'userProfileId':_0xf2732f[_0x6a19('0x4e')]},'raw':!![]})[_0x6a19('0x23')](function(_0x3e9bea){if(_0x3e9bea&&_0x3e9bea[_0x6a19('0x57')]===0x0){return db['UserProfileResource'][_0x6a19('0x4b')]({'name':_0x15e87f['name'],'resourceId':_0x15e87f['id'],'type':_0x3e9bea['name'],'sectionId':_0x3e9bea['id']},{})[_0x6a19('0x23')](function(){return _0x5a7a6a;});}else{return _0x5a7a6a;}})[_0x6a19('0x44')](function(_0x5e1419){logger[_0x6a19('0x50')](_0x6a19('0x58'),_0x5e1419);throw _0x5e1419;});}return _0x5a7a6a;});}})[_0x6a19('0x23')](respondWithResult(_0x26204c,0xc9))[_0x6a19('0x44')](handleError(_0x26204c,null));};exports[_0x6a19('0x22')]=function(_0x2bf86e,_0x430bfc){if(_0x2bf86e['body']['id']){delete _0x2bf86e[_0x6a19('0x53')]['id'];}return db['Campaign'][_0x6a19('0x4a')]({'where':{'id':_0x2bf86e['params']['id']}})[_0x6a19('0x23')](handleEntityNotFound(_0x430bfc,null))[_0x6a19('0x23')](saveUpdates(_0x2bf86e[_0x6a19('0x53')],null))['then'](respondWithResult(_0x430bfc,null))[_0x6a19('0x44')](handleError(_0x430bfc,null));};exports[_0x6a19('0x24')]=function(_0x335fa1,_0x3becde){return db[_0x6a19('0x2d')][_0x6a19('0x4a')]({'where':{'id':_0x335fa1[_0x6a19('0x46')]['id']}})[_0x6a19('0x23')](handleEntityNotFound(_0x3becde,null))['then'](removeEntity(_0x3becde,null))[_0x6a19('0x44')](handleError(_0x3becde,null));};exports['getHoppers']=function(_0xd2dc97,_0x25af8b,_0x3e739a){var _0x5ecbed={'raw':!![],'where':{}};var _0x38817a={};var _0x30f8dc={'count':0x0,'rows':[]};return db[_0x6a19('0x2d')][_0x6a19('0x59')]({'where':{'id':_0xd2dc97[_0x6a19('0x46')]['id']}})[_0x6a19('0x23')](handleEntityNotFound(_0x25af8b,null))[_0x6a19('0x23')](function(_0xa26a88){if(_0xa26a88){_0x38817a[_0x6a19('0x33')]=_[_0x6a19('0x47')](db[_0x6a19('0x5a')][_0x6a19('0x2e')]);_0x38817a['query']=_['keys'](_0xd2dc97[_0x6a19('0x32')]);_0x38817a[_0x6a19('0x3c')]=_['intersection'](_0x38817a['model'],_0x38817a['query']);_0x5ecbed[_0x6a19('0x35')]=_['intersection'](_0x38817a[_0x6a19('0x33')],qs['fields'](_0xd2dc97[_0x6a19('0x32')]['fields']));_0x5ecbed[_0x6a19('0x35')]=_0x5ecbed[_0x6a19('0x35')][_0x6a19('0x36')]?_0x5ecbed['attributes']:_0x38817a[_0x6a19('0x33')];if(!_0xd2dc97[_0x6a19('0x32')]['hasOwnProperty'](_0x6a19('0x5b'))){_0x5ecbed[_0x6a19('0x38')]=qs[_0x6a19('0x38')](_0xd2dc97[_0x6a19('0x32')][_0x6a19('0x38')]);_0x5ecbed[_0x6a19('0x1b')]=qs[_0x6a19('0x1b')](_0xd2dc97['query'][_0x6a19('0x1b')]);}_0x5ecbed['order']=qs[_0x6a19('0x39')](_0xd2dc97['query']['sort']);_0x5ecbed[_0x6a19('0x3a')]=qs[_0x6a19('0x3c')](_['pick'](_0xd2dc97['query'],_0x38817a[_0x6a19('0x3c')]));_0x5ecbed[_0x6a19('0x3a')][_0x6a19('0x5c')]=_0xa26a88['id'];if(_0xd2dc97[_0x6a19('0x32')]['filter']){_0x5ecbed[_0x6a19('0x3a')]=_[_0x6a19('0x3e')](_0x5ecbed[_0x6a19('0x3a')],{'$or':_['map'](_0x5ecbed[_0x6a19('0x35')],function(_0x3c8c82){var _0x176c22={};_0x176c22[_0x3c8c82]={'$like':'%'+_0xd2dc97[_0x6a19('0x32')][_0x6a19('0x3d')]+'%'};return _0x176c22;})});}_0x5ecbed=_['merge']({},_0x5ecbed,_0xd2dc97[_0x6a19('0x40')]);return db[_0x6a19('0x5a')][_0x6a19('0x1d')]({'where':_0x5ecbed[_0x6a19('0x3a')]})[_0x6a19('0x23')](function(_0x1a55d9){_0x30f8dc[_0x6a19('0x1d')]=_0x1a55d9;if(_0xd2dc97[_0x6a19('0x32')][_0x6a19('0x49')]){_0x5ecbed['include']=[{'all':!![]}];}return db[_0x6a19('0x5a')][_0x6a19('0x42')](_0x5ecbed);})['then'](function(_0x2ee7c1){_0x30f8dc[_0x6a19('0x43')]=_0x2ee7c1;return _0x30f8dc;});}})['then'](respondWithFilteredResult(_0x25af8b,_0x5ecbed))[_0x6a19('0x44')](handleError(_0x25af8b,null));};exports[_0x6a19('0x5d')]=function(_0x300556,_0x246dc0,_0x44a45e){var _0x443451={'raw':!![],'where':{}};var _0x4d1813={};var _0x18ec6e={'count':0x0,'rows':[]};return db['Campaign']['findOne']({'where':{'id':_0x300556[_0x6a19('0x46')]['id']}})[_0x6a19('0x23')](handleEntityNotFound(_0x246dc0,null))[_0x6a19('0x23')](function(_0x1705e9){if(_0x1705e9){_0x4d1813['model']=_[_0x6a19('0x47')](db['CmHopperHistory'][_0x6a19('0x2e')]);_0x4d1813[_0x6a19('0x32')]=_[_0x6a19('0x47')](_0x300556[_0x6a19('0x32')]);_0x4d1813[_0x6a19('0x3c')]=_[_0x6a19('0x48')](_0x4d1813[_0x6a19('0x33')],_0x4d1813[_0x6a19('0x32')]);_0x443451[_0x6a19('0x35')]=_[_0x6a19('0x48')](_0x4d1813['model'],qs['fields'](_0x300556[_0x6a19('0x32')][_0x6a19('0x34')]));_0x443451[_0x6a19('0x35')]=_0x443451[_0x6a19('0x35')]['length']?_0x443451[_0x6a19('0x35')]:_0x4d1813[_0x6a19('0x33')];if(!_0x300556['query'][_0x6a19('0x37')](_0x6a19('0x5b'))){_0x443451[_0x6a19('0x38')]=qs[_0x6a19('0x38')](_0x300556['query']['limit']);_0x443451[_0x6a19('0x1b')]=qs[_0x6a19('0x1b')](_0x300556[_0x6a19('0x32')]['offset']);}_0x443451[_0x6a19('0x5e')]=qs[_0x6a19('0x39')](_0x300556[_0x6a19('0x32')][_0x6a19('0x39')]);_0x443451[_0x6a19('0x3a')]=qs['filters'](_[_0x6a19('0x3b')](_0x300556[_0x6a19('0x32')],_0x4d1813['filters']));_0x443451['where'][_0x6a19('0x5c')]=_0x1705e9['id'];if(_0x300556['query'][_0x6a19('0x3d')]){_0x443451[_0x6a19('0x3a')]=_[_0x6a19('0x3e')](_0x443451[_0x6a19('0x3a')],{'$or':_[_0x6a19('0x2c')](_0x443451[_0x6a19('0x35')],function(_0x469494){var _0x52f01a={};_0x52f01a[_0x469494]={'$like':'%'+_0x300556[_0x6a19('0x32')][_0x6a19('0x3d')]+'%'};return _0x52f01a;})});}_0x443451=_[_0x6a19('0x3e')]({},_0x443451,_0x300556[_0x6a19('0x40')]);return db['CmHopperHistory'][_0x6a19('0x1d')]({'where':_0x443451[_0x6a19('0x3a')]})[_0x6a19('0x23')](function(_0x3b9130){_0x18ec6e['count']=_0x3b9130;if(_0x300556[_0x6a19('0x32')][_0x6a19('0x49')]){_0x443451['include']=[{'all':!![]}];}return db['CmHopperHistory']['findAll'](_0x443451);})[_0x6a19('0x23')](function(_0x52a8c0){_0x18ec6e['rows']=_0x52a8c0;return _0x18ec6e;});}})['then'](respondWithFilteredResult(_0x246dc0,_0x443451))[_0x6a19('0x44')](handleError(_0x246dc0,null));};exports[_0x6a19('0x5f')]=function(_0x2843c8,_0x3c3b9e,_0x445278){var _0x5a3d0={'raw':!![],'where':{}};var _0x4800af={};var _0x5d5f0a={'count':0x0,'rows':[]};return db[_0x6a19('0x2d')][_0x6a19('0x59')]({'where':{'id':_0x2843c8[_0x6a19('0x46')]['id']}})[_0x6a19('0x23')](handleEntityNotFound(_0x3c3b9e,null))[_0x6a19('0x23')](function(_0x43fffb){if(_0x43fffb){_0x4800af[_0x6a19('0x33')]=_[_0x6a19('0x47')](db[_0x6a19('0x60')][_0x6a19('0x2e')]);_0x4800af[_0x6a19('0x32')]=_['keys'](_0x2843c8[_0x6a19('0x32')]);_0x4800af['filters']=_[_0x6a19('0x48')](_0x4800af[_0x6a19('0x33')],_0x4800af[_0x6a19('0x32')]);_0x5a3d0[_0x6a19('0x35')]=_[_0x6a19('0x48')](_0x4800af['model'],qs['fields'](_0x2843c8['query'][_0x6a19('0x34')]));_0x5a3d0['attributes']=_0x5a3d0[_0x6a19('0x35')][_0x6a19('0x36')]?_0x5a3d0[_0x6a19('0x35')]:_0x4800af[_0x6a19('0x33')];if(!_0x2843c8['query']['hasOwnProperty']('nolimit')){_0x5a3d0[_0x6a19('0x38')]=qs[_0x6a19('0x38')](_0x2843c8[_0x6a19('0x32')][_0x6a19('0x38')]);_0x5a3d0[_0x6a19('0x1b')]=qs['offset'](_0x2843c8[_0x6a19('0x32')][_0x6a19('0x1b')]);}_0x5a3d0[_0x6a19('0x5e')]=qs[_0x6a19('0x39')](_0x2843c8[_0x6a19('0x32')]['sort']);_0x5a3d0[_0x6a19('0x3a')]=qs[_0x6a19('0x3c')](_[_0x6a19('0x3b')](_0x2843c8['query'],_0x4800af[_0x6a19('0x3c')]));_0x5a3d0[_0x6a19('0x3a')]['CampaignId']=_0x43fffb['id'];if(_0x2843c8[_0x6a19('0x32')][_0x6a19('0x3d')]){_0x5a3d0[_0x6a19('0x3a')]=_['merge'](_0x5a3d0[_0x6a19('0x3a')],{'$or':_[_0x6a19('0x2c')](_0x5a3d0['attributes'],function(_0x44e657){var _0x28de74={};_0x28de74[_0x44e657]={'$like':'%'+_0x2843c8['query']['filter']+'%'};return _0x28de74;})});}_0x5a3d0=_[_0x6a19('0x3e')]({},_0x5a3d0,_0x2843c8[_0x6a19('0x40')]);return db[_0x6a19('0x60')][_0x6a19('0x1d')]({'where':_0x5a3d0[_0x6a19('0x3a')]})[_0x6a19('0x23')](function(_0x11d472){_0x5d5f0a[_0x6a19('0x1d')]=_0x11d472;if(_0x2843c8[_0x6a19('0x32')]['includeAll']){_0x5a3d0['include']=[{'all':!![]}];}return db[_0x6a19('0x60')][_0x6a19('0x42')](_0x5a3d0);})[_0x6a19('0x23')](function(_0x119a30){_0x5d5f0a[_0x6a19('0x43')]=_0x119a30;return _0x5d5f0a;});}})[_0x6a19('0x23')](respondWithFilteredResult(_0x3c3b9e,_0x5a3d0))[_0x6a19('0x44')](handleError(_0x3c3b9e,null));};exports[_0x6a19('0x61')]=function(_0x3a3359,_0x5f6b3d,_0x26a997){var _0x22fe2b={'raw':!![],'where':{}};var _0x3af508={};var _0x2474a0={'count':0x0,'rows':[]};return db[_0x6a19('0x2d')][_0x6a19('0x59')]({'where':{'id':_0x3a3359['params']['id']}})[_0x6a19('0x23')](handleEntityNotFound(_0x5f6b3d,null))[_0x6a19('0x23')](function(_0x32ae01){if(_0x32ae01){_0x3af508[_0x6a19('0x33')]=_['keys'](db[_0x6a19('0x62')][_0x6a19('0x2e')]);_0x3af508[_0x6a19('0x32')]=_[_0x6a19('0x47')](_0x3a3359[_0x6a19('0x32')]);_0x3af508[_0x6a19('0x3c')]=_[_0x6a19('0x48')](_0x3af508[_0x6a19('0x33')],_0x3af508[_0x6a19('0x32')]);_0x22fe2b[_0x6a19('0x35')]=_['intersection'](_0x3af508[_0x6a19('0x33')],qs[_0x6a19('0x34')](_0x3a3359[_0x6a19('0x32')]['fields']));_0x22fe2b[_0x6a19('0x35')]=_0x22fe2b[_0x6a19('0x35')][_0x6a19('0x36')]?_0x22fe2b['attributes']:_0x3af508[_0x6a19('0x33')];if(!_0x3a3359[_0x6a19('0x32')][_0x6a19('0x37')](_0x6a19('0x5b'))){_0x22fe2b['limit']=qs[_0x6a19('0x38')](_0x3a3359[_0x6a19('0x32')][_0x6a19('0x38')]);_0x22fe2b['offset']=qs[_0x6a19('0x1b')](_0x3a3359['query'][_0x6a19('0x1b')]);}_0x22fe2b[_0x6a19('0x5e')]=qs[_0x6a19('0x39')](_0x3a3359['query'][_0x6a19('0x39')]);_0x22fe2b[_0x6a19('0x3a')]=qs[_0x6a19('0x3c')](_['pick'](_0x3a3359[_0x6a19('0x32')],_0x3af508[_0x6a19('0x3c')]));_0x22fe2b[_0x6a19('0x3a')][_0x6a19('0x5c')]=_0x32ae01['id'];if(_0x3a3359['query'][_0x6a19('0x3d')]){_0x22fe2b['where']=_['merge'](_0x22fe2b[_0x6a19('0x3a')],{'$or':_[_0x6a19('0x2c')](_0x22fe2b[_0x6a19('0x35')],function(_0x89a3ae){var _0x42cc28={};_0x42cc28[_0x89a3ae]={'$like':'%'+_0x3a3359[_0x6a19('0x32')]['filter']+'%'};return _0x42cc28;})});}_0x22fe2b=_[_0x6a19('0x3e')]({},_0x22fe2b,_0x3a3359['options']);return db[_0x6a19('0x62')][_0x6a19('0x1d')]({'where':_0x22fe2b['where']})[_0x6a19('0x23')](function(_0x48ca7f){_0x2474a0[_0x6a19('0x1d')]=_0x48ca7f;if(_0x3a3359[_0x6a19('0x32')][_0x6a19('0x49')]){_0x22fe2b[_0x6a19('0x41')]=[{'all':!![]}];}return db['CmHopperBlack'][_0x6a19('0x42')](_0x22fe2b);})[_0x6a19('0x23')](function(_0x2e4acc){_0x2474a0[_0x6a19('0x43')]=_0x2e4acc;return _0x2474a0;});}})['then'](respondWithFilteredResult(_0x5f6b3d,_0x22fe2b))['catch'](handleError(_0x5f6b3d,null));};exports['getLists']=function(_0x2f983f,_0x491a5b,_0x13c4ac){var _0x1e8e3f={};var _0x3b042d={};var _0x1a135e;var _0xc8a94f;return db['Campaign']['findOne']({'where':{'id':_0x2f983f[_0x6a19('0x46')]['id']}})[_0x6a19('0x23')](handleEntityNotFound(_0x491a5b,null))[_0x6a19('0x23')](function(_0x3457ab){if(_0x3457ab){_0x1a135e=_0x3457ab;_0x3b042d['model']=_[_0x6a19('0x47')](db[_0x6a19('0x63')][_0x6a19('0x2e')]);_0x3b042d['query']=_[_0x6a19('0x47')](_0x2f983f['query']);_0x3b042d[_0x6a19('0x3c')]=_[_0x6a19('0x48')](_0x3b042d[_0x6a19('0x33')],_0x3b042d[_0x6a19('0x32')]);_0x1e8e3f[_0x6a19('0x35')]=_['intersection'](_0x3b042d[_0x6a19('0x33')],qs['fields'](_0x2f983f[_0x6a19('0x32')]['fields']));_0x1e8e3f[_0x6a19('0x35')]=_0x1e8e3f['attributes'][_0x6a19('0x36')]?_0x1e8e3f['attributes']:_0x3b042d[_0x6a19('0x33')];_0x1e8e3f[_0x6a19('0x5e')]=qs[_0x6a19('0x39')](_0x2f983f[_0x6a19('0x32')][_0x6a19('0x39')]);_0x1e8e3f['where']=qs['filters'](_[_0x6a19('0x3b')](_0x2f983f[_0x6a19('0x32')],_0x3b042d[_0x6a19('0x3c')]));if(_0x2f983f[_0x6a19('0x32')][_0x6a19('0x3d')]){_0x1e8e3f[_0x6a19('0x3a')]=_['merge'](_0x1e8e3f[_0x6a19('0x3a')],{'$or':_[_0x6a19('0x2c')](_0x1e8e3f[_0x6a19('0x35')],function(_0x4007eb){var _0xf8075f={};_0xf8075f[_0x4007eb]={'$like':'%'+_0x2f983f['query']['filter']+'%'};return _0xf8075f;})});}_0x1e8e3f=_[_0x6a19('0x3e')]({},_0x1e8e3f,_0x2f983f[_0x6a19('0x40')]);return _0x1a135e[_0x6a19('0x64')](_0x1e8e3f);}})['then'](function(_0x51da58){if(_0x51da58){_0xc8a94f=_0x51da58[_0x6a19('0x36')];if(!_0x2f983f[_0x6a19('0x32')][_0x6a19('0x37')](_0x6a19('0x5b'))){_0x1e8e3f[_0x6a19('0x38')]=qs[_0x6a19('0x38')](_0x2f983f[_0x6a19('0x32')][_0x6a19('0x38')]);_0x1e8e3f['offset']=qs['offset'](_0x2f983f['query'][_0x6a19('0x1b')]);}return _0x1a135e[_0x6a19('0x64')](_0x1e8e3f);}})[_0x6a19('0x23')](function(_0x105d91){if(_0x105d91){return _0x105d91?{'count':_0xc8a94f,'rows':_0x105d91}:null;}})['then'](respondWithResult(_0x491a5b,null))['catch'](handleError(_0x491a5b,null));};exports[_0x6a19('0x65')]=function(_0x36a9e7,_0x5cc0d2,_0x3a5b42){var _0x442c24,_0x15d7d7;return db[_0x6a19('0x2d')]['find']({'where':{'id':_0x36a9e7[_0x6a19('0x46')]['id']}})[_0x6a19('0x23')](handleEntityNotFound(_0x5cc0d2,null))['then'](function(_0x10d2b7){if(_0x10d2b7){_0x15d7d7=_0x10d2b7;return _0x10d2b7[_0x6a19('0x65')](_0x36a9e7[_0x6a19('0x53')]['ids'],_[_0x6a19('0x54')](_0x36a9e7[_0x6a19('0x53')],[_0x6a19('0x66'),'id'])||{});}return null;})[_0x6a19('0x67')](function(_0x30256d){var _0xe60359;_0x442c24=_0x30256d||[];var _0x334565=[];if(_0x30256d){for(var _0x50f772=0x0;_0x50f772<_0x30256d[_0x6a19('0x36')];_0x50f772+=0x1){var _0x48266c=_0x30256d[_0x50f772][_0x6a19('0x25')]({'plain':!![]});_0x15d7d7[_0x6a19('0x68')]=_0x36a9e7[_0x6a19('0x53')][_0x6a19('0x68')]?_0x36a9e7[_0x6a19('0x53')][_0x6a19('0x68')]:_0x15d7d7[_0x6a19('0x68')];switch(_0x15d7d7[_0x6a19('0x68')]){case _0x6a19('0x69'):_0xe60359=squel[_0x6a19('0x6a')]()[_0x6a19('0x6b')]('cm_hopper')[_0x6a19('0x6c')]([_0x6a19('0x6d'),_0x6a19('0x6e'),_0x6a19('0x6f'),_0x6a19('0x70'),_0x6a19('0x5c'),_0x6a19('0x52'),_0x6a19('0x71')],squel[_0x6a19('0x72')]()['field']('phone',_0x6a19('0x6d'))[_0x6a19('0x73')](_0x6a19('0x74'),_0x6a19('0x6e'))[_0x6a19('0x73')]('id',_0x6a19('0x6f'))[_0x6a19('0x73')](_0x48266c['CmListId'][_0x6a19('0x75')](),_0x6a19('0x70'))['field'](_0x36a9e7[_0x6a19('0x46')]['id'][_0x6a19('0x75')](),'CampaignId')['field'](_0x6a19('0x74'),_0x6a19('0x52'))['field'](_0x6a19('0x74'),_0x6a19('0x71'))[_0x6a19('0x76')]('cm_contacts')[_0x6a19('0x3a')](_0x6a19('0x77'))[_0x6a19('0x3a')](_0x6a19('0x78'),_0x48266c[_0x6a19('0x79')][_0x6a19('0x75')]())[_0x6a19('0x3a')](_0x6a19('0x7a'))[_0x6a19('0x3a')](_0x6a19('0x7b'),squel[_0x6a19('0x72')]()[_0x6a19('0x73')](_0x6a19('0x7c'))[_0x6a19('0x76')]('cm_hopper_final')[_0x6a19('0x3a')](_0x6a19('0x7d'),_0x36a9e7[_0x6a19('0x46')]['id'][_0x6a19('0x75')]()))['where'](_0x6a19('0x7b'),squel[_0x6a19('0x72')]()[_0x6a19('0x73')](_0x6a19('0x7e'))['from'](_0x6a19('0x7f'))['where']('CampaignId\x20=\x20?',_0x36a9e7[_0x6a19('0x46')]['id'][_0x6a19('0x75')]())))[_0x6a19('0x75')]();break;case _0x6a19('0x80'):_0xe60359=squel[_0x6a19('0x6a')]()['into']('cm_hopper')[_0x6a19('0x6c')]([_0x6a19('0x6d'),_0x6a19('0x6e'),_0x6a19('0x6f'),'ListId',_0x6a19('0x5c'),_0x6a19('0x52'),_0x6a19('0x71')],squel[_0x6a19('0x72')]()[_0x6a19('0x73')](_0x6a19('0x6d'),_0x6a19('0x6d'))[_0x6a19('0x73')](_0x6a19('0x74'),_0x6a19('0x6e'))['field']('id',_0x6a19('0x6f'))[_0x6a19('0x73')](_0x48266c[_0x6a19('0x79')][_0x6a19('0x75')](),'ListId')[_0x6a19('0x73')](_0x36a9e7[_0x6a19('0x46')]['id'][_0x6a19('0x75')](),_0x6a19('0x5c'))[_0x6a19('0x73')]('NOW()',_0x6a19('0x52'))[_0x6a19('0x73')](_0x6a19('0x74'),_0x6a19('0x71'))[_0x6a19('0x76')](_0x6a19('0x81'))[_0x6a19('0x3a')](_0x6a19('0x77'))[_0x6a19('0x3a')](_0x6a19('0x78'),_0x48266c[_0x6a19('0x79')][_0x6a19('0x75')]())[_0x6a19('0x3a')](_0x6a19('0x7a'))[_0x6a19('0x3a')](_0x6a19('0x7b'),squel[_0x6a19('0x72')]()[_0x6a19('0x73')](_0x6a19('0x7e'))[_0x6a19('0x76')](_0x6a19('0x7f'))[_0x6a19('0x3a')](_0x6a19('0x7d'),_0x36a9e7[_0x6a19('0x46')]['id'][_0x6a19('0x75')]())))[_0x6a19('0x75')]();break;default:_0xe60359=squel[_0x6a19('0x6a')]()[_0x6a19('0x6b')](_0x6a19('0x7f'))[_0x6a19('0x6c')]([_0x6a19('0x6d'),_0x6a19('0x6e'),_0x6a19('0x6f'),'ListId','CampaignId',_0x6a19('0x52'),_0x6a19('0x71')],squel[_0x6a19('0x72')]()['field'](_0x6a19('0x6d'),'phone')[_0x6a19('0x73')](_0x6a19('0x74'),_0x6a19('0x6e'))[_0x6a19('0x73')]('id','ContactId')[_0x6a19('0x73')](_0x48266c[_0x6a19('0x79')][_0x6a19('0x75')](),_0x6a19('0x70'))[_0x6a19('0x73')](_0x36a9e7[_0x6a19('0x46')]['id']['toString'](),_0x6a19('0x5c'))['field'](_0x6a19('0x74'),_0x6a19('0x52'))[_0x6a19('0x73')]('NOW()',_0x6a19('0x71'))[_0x6a19('0x76')](_0x6a19('0x81'))[_0x6a19('0x3a')]('deletedAt\x20IS\x20NULL')[_0x6a19('0x3a')]('ListId\x20=\x20?',_0x48266c[_0x6a19('0x79')][_0x6a19('0x75')]())[_0x6a19('0x3a')]('phone\x20IS\x20NOT\x20NULL'))[_0x6a19('0x75')]();}_0x334565[_0x6a19('0x82')](db['sequelize'][_0x6a19('0x32')](_0xe60359));}return BPromise[_0x6a19('0x83')](_0x334565);}})[_0x6a19('0x23')](function(){return _0x442c24;})[_0x6a19('0x23')](respondWithResult(_0x5cc0d2,null))[_0x6a19('0x44')](handleError(_0x5cc0d2,null));};exports['removeLists']=function(_0x2bb064,_0x57929e,_0x1ba558){return db[_0x6a19('0x2d')][_0x6a19('0x4a')]({'where':{'id':_0x2bb064[_0x6a19('0x46')]['id']}})[_0x6a19('0x23')](handleEntityNotFound(_0x57929e,null))[_0x6a19('0x23')](function(_0x21ed5d){if(_0x21ed5d){return _0x21ed5d['removeLists'](_0x2bb064[_0x6a19('0x32')][_0x6a19('0x66')]);}})[_0x6a19('0x23')](function(_0x116d48){if(_0x116d48){return db[_0x6a19('0x5a')][_0x6a19('0x24')]({'where':{'ListId':_0x2bb064[_0x6a19('0x32')][_0x6a19('0x66')],'CampaignId':_0x2bb064[_0x6a19('0x46')]['id']}})['then'](function(){return _0x116d48;});}})[_0x6a19('0x23')](respondWithStatusCode(_0x57929e,null))[_0x6a19('0x44')](handleError(_0x57929e,null));};exports[_0x6a19('0x84')]=function(_0x45ae00,_0x1837a2,_0x27f66b){var _0x2f037a={};var _0x163613={};var _0x2bd794;var _0xe4b4f;return db[_0x6a19('0x2d')][_0x6a19('0x59')]({'where':{'id':_0x45ae00[_0x6a19('0x46')]['id']}})[_0x6a19('0x23')](handleEntityNotFound(_0x1837a2,null))['then'](function(_0x5c015a){if(_0x5c015a){_0x2bd794=_0x5c015a;_0x163613[_0x6a19('0x33')]=_[_0x6a19('0x47')](db[_0x6a19('0x63')][_0x6a19('0x2e')]);_0x163613[_0x6a19('0x32')]=_['keys'](_0x45ae00[_0x6a19('0x32')]);_0x163613['filters']=_[_0x6a19('0x48')](_0x163613[_0x6a19('0x33')],_0x163613['query']);_0x2f037a['attributes']=_['intersection'](_0x163613['model'],qs[_0x6a19('0x34')](_0x45ae00[_0x6a19('0x32')][_0x6a19('0x34')]));_0x2f037a[_0x6a19('0x35')]=_0x2f037a['attributes'][_0x6a19('0x36')]?_0x2f037a[_0x6a19('0x35')]:_0x163613[_0x6a19('0x33')];_0x2f037a['order']=qs[_0x6a19('0x39')](_0x45ae00['query'][_0x6a19('0x39')]);_0x2f037a[_0x6a19('0x3a')]=qs[_0x6a19('0x3c')](_[_0x6a19('0x3b')](_0x45ae00['query'],_0x163613[_0x6a19('0x3c')]));if(_0x45ae00[_0x6a19('0x32')][_0x6a19('0x3d')]){_0x2f037a[_0x6a19('0x3a')]=_['merge'](_0x2f037a[_0x6a19('0x3a')],{'$or':_[_0x6a19('0x2c')](_0x2f037a['attributes'],function(_0x5eb055){var _0x14e222={};_0x14e222[_0x5eb055]={'$like':'%'+_0x45ae00['query'][_0x6a19('0x3d')]+'%'};return _0x14e222;})});}_0x2f037a=_[_0x6a19('0x3e')]({},_0x2f037a,_0x45ae00['options']);return _0x2bd794[_0x6a19('0x84')](_0x2f037a);}})[_0x6a19('0x23')](function(_0x130946){if(_0x130946){_0xe4b4f=_0x130946['length'];if(!_0x45ae00[_0x6a19('0x32')][_0x6a19('0x37')](_0x6a19('0x5b'))){_0x2f037a[_0x6a19('0x38')]=qs[_0x6a19('0x38')](_0x45ae00[_0x6a19('0x32')]['limit']);_0x2f037a[_0x6a19('0x1b')]=qs[_0x6a19('0x1b')](_0x45ae00[_0x6a19('0x32')][_0x6a19('0x1b')]);}return _0x2bd794[_0x6a19('0x84')](_0x2f037a);}})[_0x6a19('0x23')](function(_0x15a7db){if(_0x15a7db){return _0x15a7db?{'count':_0xe4b4f,'rows':_0x15a7db}:null;}})[_0x6a19('0x23')](respondWithResult(_0x1837a2,null))[_0x6a19('0x44')](handleError(_0x1837a2,null));};exports[_0x6a19('0x85')]=function(_0x84eb7f,_0x2f472d,_0x5f20f5){var _0x501b24,_0x38d7da;return db['Campaign'][_0x6a19('0x4a')]({'where':{'id':_0x84eb7f[_0x6a19('0x46')]['id']}})[_0x6a19('0x23')](handleEntityNotFound(_0x2f472d,null))[_0x6a19('0x23')](function(_0x288ed6){if(_0x288ed6){_0x38d7da=_0x288ed6;return _0x288ed6[_0x6a19('0x85')](_0x84eb7f['body'][_0x6a19('0x66')],_[_0x6a19('0x54')](_0x84eb7f[_0x6a19('0x53')],['ids','id'])||{});}return null;})['spread'](function(_0x375c2c){var _0x4368e8;_0x501b24=_0x375c2c||[];var _0x5128c4=[];if(_0x375c2c){for(var _0x31a266=0x0;_0x31a266<_0x375c2c['length'];_0x31a266+=0x1){var _0xfc3caa=_0x375c2c[_0x31a266][_0x6a19('0x25')]({'plain':!![]});_0x4368e8=squel[_0x6a19('0x6a')]()[_0x6a19('0x6b')](_0x6a19('0x86'))[_0x6a19('0x6c')]([_0x6a19('0x6d'),_0x6a19('0x6f'),_0x6a19('0x70'),_0x6a19('0x5c'),_0x6a19('0x52'),_0x6a19('0x71')],squel['select']()[_0x6a19('0x73')](_0x6a19('0x6d'),_0x6a19('0x6d'))[_0x6a19('0x73')]('id',_0x6a19('0x6f'))['field'](_0xfc3caa[_0x6a19('0x79')]['toString'](),_0x6a19('0x70'))[_0x6a19('0x73')](_0x84eb7f['params']['id']['toString'](),'CampaignId')['field'](_0x6a19('0x74'),'createdAt')[_0x6a19('0x73')](_0x6a19('0x74'),_0x6a19('0x71'))[_0x6a19('0x76')](_0x6a19('0x81'))[_0x6a19('0x3a')](_0x6a19('0x77'))[_0x6a19('0x3a')](_0x6a19('0x78'),_0xfc3caa[_0x6a19('0x79')][_0x6a19('0x75')]())[_0x6a19('0x3a')](_0x6a19('0x7a')))[_0x6a19('0x75')]();_0x5128c4[_0x6a19('0x82')](db['sequelize'][_0x6a19('0x32')](_0x4368e8));}return BPromise[_0x6a19('0x83')](_0x5128c4);}})[_0x6a19('0x23')](function(){return _0x501b24;})['then'](respondWithResult(_0x2f472d,null))[_0x6a19('0x44')](handleError(_0x2f472d,null));};exports[_0x6a19('0x87')]=function(_0x180126,_0x13e71f,_0x524d36){return db['Campaign'][_0x6a19('0x4a')]({'where':{'id':_0x180126[_0x6a19('0x46')]['id']}})['then'](handleEntityNotFound(_0x13e71f,null))[_0x6a19('0x23')](function(_0x176906){if(_0x176906){return _0x176906['removeBlackLists'](_0x180126[_0x6a19('0x32')][_0x6a19('0x66')]);}})[_0x6a19('0x23')](function(_0x4c5e48){if(_0x4c5e48){return db[_0x6a19('0x62')][_0x6a19('0x24')]({'where':{'ListId':_0x180126[_0x6a19('0x32')][_0x6a19('0x66')],'CampaignId':_0x180126[_0x6a19('0x46')]['id']}})[_0x6a19('0x23')](function(){return _0x4c5e48;});}})[_0x6a19('0x23')](respondWithStatusCode(_0x13e71f,null))[_0x6a19('0x44')](handleError(_0x13e71f,null));}; \ No newline at end of file +var _0x9990=['into','cm_hopper','ListId','select','field','NOW()','scheduledAt','ContactId','CmListId','toString','updatedAt','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','COALESCE(calleridnum,\x27\x27)','from','cm_hopper_final','CampaignId\x20=\x20?','phone\x20NOT\x20IN\x20(?)','COALESCE(phone,\x27\x27)','onlyIfOpen','fromQuery','phone','sequelize','all','removeLists','getBlackLists','CmList','addBlackLists','cm_hopper_black','push','removeBlackLists','eml-format','zip-dir','request-promise','moment','bluebird','path','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','undefined','count','offset','limit','set','Content-Range','json','apply','reject','update','then','destroy','get','UserProfileResource','error','stack','name','send','index','map','Campaign','rawAttributes','fieldName','type','key','model','filters','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','VIRTUAL','merge','options','include','findAll','rows','catch','params','keys','intersection','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','omit','createdAt','IvrCampaigns','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getHoppers','findOne','CmHopper','getHopperHistories','CmHopperHistory','getHopperFinals','CmHopperFinal','CampaignId','CmHopperBlack','getLists','addLists','ids','spread','dialCheckDuplicateType','insert'];(function(_0x18f713,_0x379588){var _0x4d524a=function(_0x405ef4){while(--_0x405ef4){_0x18f713['push'](_0x18f713['shift']());}};_0x4d524a(++_0x379588);}(_0x9990,0xa8));var _0x0999=function(_0x8033a9,_0x23db75){_0x8033a9=_0x8033a9-0x0;var _0x4af01f=_0x9990[_0x8033a9];return _0x4af01f;};'use strict';var emlformat=require(_0x0999('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x0999('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0999('0x2'));var moment=require(_0x0999('0x3'));var BPromise=require(_0x0999('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x0999('0x5'));var sox=require(_0x0999('0x6'));var csv=require('to-csv');var ejs=require(_0x0999('0x7'));var fs=require('fs');var fs_extra=require(_0x0999('0x8'));var _=require(_0x0999('0x9'));var squel=require(_0x0999('0xa'));var crypto=require(_0x0999('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x0999('0xc'));var toCsv=require(_0x0999('0xd'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x0999('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x0999('0xf'));var as=require(_0x0999('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0999('0x11'))(_0x0999('0x12'));var utils=require(_0x0999('0x13'));var config=require(_0x0999('0x14'));var licenseUtil=require(_0x0999('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x50af2c,_0x508f94){_0x508f94=_0x508f94||0xcc;return function(_0x70c45c){if(_0x70c45c){return _0x50af2c[_0x0999('0x16')](_0x508f94);}return _0x50af2c[_0x0999('0x17')](_0x508f94)[_0x0999('0x18')]();};}function respondWithResult(_0x45fb10,_0xe74d67){_0xe74d67=_0xe74d67||0xc8;return function(_0x6181eb){if(_0x6181eb){return _0x45fb10[_0x0999('0x17')](_0xe74d67)['json'](_0x6181eb);}};}function respondWithFilteredResult(_0x1066f3,_0x97bdaa){return function(_0x1e1d51){if(_0x1e1d51){var _0x11ec09=typeof _0x97bdaa['offset']===_0x0999('0x19')&&typeof _0x97bdaa['limit']==='undefined';var _0x495588=_0x1e1d51[_0x0999('0x1a')];var _0x3f86d8=_0x11ec09?0x0:_0x97bdaa['offset'];var _0x4354d8=_0x11ec09?_0x1e1d51[_0x0999('0x1a')]:_0x97bdaa[_0x0999('0x1b')]+_0x97bdaa[_0x0999('0x1c')];var _0x128933;if(_0x4354d8>=_0x495588){_0x4354d8=_0x495588;_0x128933=0xc8;}else{_0x128933=0xce;}_0x1066f3[_0x0999('0x17')](_0x128933);return _0x1066f3[_0x0999('0x1d')](_0x0999('0x1e'),_0x3f86d8+'-'+_0x4354d8+'/'+_0x495588)[_0x0999('0x1f')](_0x1e1d51);}return null;};}function patchUpdates(_0x55761f){return function(_0x430e77){try{jsonpatch[_0x0999('0x20')](_0x430e77,_0x55761f,!![]);}catch(_0x2605f5){return BPromise[_0x0999('0x21')](_0x2605f5);}return _0x430e77['save']();};}function saveUpdates(_0x45a790,_0x35da19){return function(_0x5c6f8b){if(_0x5c6f8b){return _0x5c6f8b[_0x0999('0x22')](_0x45a790)[_0x0999('0x23')](function(_0xe75920){return _0xe75920;});}return null;};}function removeEntity(_0x1b3a4a,_0x154671){return function(_0x46a931){if(_0x46a931){return _0x46a931[_0x0999('0x24')]()[_0x0999('0x23')](function(){var _0xc95bb2=_0x46a931[_0x0999('0x25')]({'plain':!![]});var _0x5dab60='IvrCampaigns';return db[_0x0999('0x26')][_0x0999('0x24')]({'where':{'type':_0x5dab60,'resourceId':_0xc95bb2['id']}})[_0x0999('0x23')](function(){return _0x46a931;});})[_0x0999('0x23')](function(){_0x1b3a4a[_0x0999('0x17')](0xcc)[_0x0999('0x18')]();});}};}function handleEntityNotFound(_0x47e22c,_0x1221d4){return function(_0x4f1ca1){if(!_0x4f1ca1){_0x47e22c['sendStatus'](0x194);}return _0x4f1ca1;};}function handleError(_0x40c277,_0x4ab939){_0x4ab939=_0x4ab939||0x1f4;return function(_0x400acf){logger[_0x0999('0x27')](_0x400acf[_0x0999('0x28')]);if(_0x400acf[_0x0999('0x29')]){delete _0x400acf[_0x0999('0x29')];}_0x40c277[_0x0999('0x17')](_0x4ab939)[_0x0999('0x2a')](_0x400acf);};}exports[_0x0999('0x2b')]=function(_0x1bde8a,_0x232c73){var _0x320851={},_0x327f86={},_0x25b238={'count':0x0,'rows':[]};var _0x2c0ca1=_[_0x0999('0x2c')](db[_0x0999('0x2d')][_0x0999('0x2e')],function(_0x463678){return{'name':_0x463678[_0x0999('0x2f')],'type':_0x463678[_0x0999('0x30')][_0x0999('0x31')]};});_0x327f86[_0x0999('0x32')]=_['map'](_0x2c0ca1,_0x0999('0x29'));_0x327f86['query']=_['keys'](_0x1bde8a['query']);_0x327f86[_0x0999('0x33')]=_['intersection'](_0x327f86[_0x0999('0x32')],_0x327f86[_0x0999('0x34')]);_0x320851[_0x0999('0x35')]=_['intersection'](_0x327f86[_0x0999('0x32')],qs[_0x0999('0x36')](_0x1bde8a[_0x0999('0x34')]['fields']));_0x320851['attributes']=_0x320851[_0x0999('0x35')][_0x0999('0x37')]?_0x320851[_0x0999('0x35')]:_0x327f86[_0x0999('0x32')];if(!_0x1bde8a[_0x0999('0x34')][_0x0999('0x38')](_0x0999('0x39'))){_0x320851[_0x0999('0x1c')]=qs[_0x0999('0x1c')](_0x1bde8a[_0x0999('0x34')][_0x0999('0x1c')]);_0x320851[_0x0999('0x1b')]=qs[_0x0999('0x1b')](_0x1bde8a[_0x0999('0x34')][_0x0999('0x1b')]);}_0x320851[_0x0999('0x3a')]=qs['sort'](_0x1bde8a[_0x0999('0x34')][_0x0999('0x3b')]);_0x320851['where']=qs[_0x0999('0x33')](_[_0x0999('0x3c')](_0x1bde8a['query'],_0x327f86[_0x0999('0x33')]),_0x2c0ca1);if(_0x1bde8a[_0x0999('0x34')][_0x0999('0x3d')]){_0x320851[_0x0999('0x3e')]=_['merge'](_0x320851[_0x0999('0x3e')],{'$or':_['map'](_0x2c0ca1,function(_0x20454){if(_0x20454[_0x0999('0x30')]!==_0x0999('0x3f')){var _0x438758={};_0x438758[_0x20454[_0x0999('0x29')]]={'$like':'%'+_0x1bde8a['query'][_0x0999('0x3d')]+'%'};return _0x438758;}})});}_0x320851=_[_0x0999('0x40')]({},_0x320851,_0x1bde8a[_0x0999('0x41')]);var _0x5e27d1={'where':_0x320851[_0x0999('0x3e')]};return db[_0x0999('0x2d')]['count'](_0x5e27d1)[_0x0999('0x23')](function(_0x4d11c3){_0x25b238[_0x0999('0x1a')]=_0x4d11c3;if(_0x1bde8a[_0x0999('0x34')]['includeAll']){_0x320851[_0x0999('0x42')]=[{'all':!![]}];}return db[_0x0999('0x2d')][_0x0999('0x43')](_0x320851);})['then'](function(_0x294a8e){_0x25b238[_0x0999('0x44')]=_0x294a8e;return _0x25b238;})['then'](respondWithFilteredResult(_0x232c73,_0x320851))[_0x0999('0x45')](handleError(_0x232c73,null));};exports['show']=function(_0x45b798,_0x464d53){var _0x24c71e={'raw':![],'where':{'id':_0x45b798[_0x0999('0x46')]['id']}},_0x2c6686={};_0x2c6686['model']=_[_0x0999('0x47')](db['Campaign']['rawAttributes']);_0x2c6686[_0x0999('0x34')]=_['keys'](_0x45b798[_0x0999('0x34')]);_0x2c6686[_0x0999('0x33')]=_[_0x0999('0x48')](_0x2c6686[_0x0999('0x32')],_0x2c6686[_0x0999('0x34')]);_0x24c71e[_0x0999('0x35')]=_[_0x0999('0x48')](_0x2c6686[_0x0999('0x32')],qs[_0x0999('0x36')](_0x45b798['query'][_0x0999('0x36')]));_0x24c71e['attributes']=_0x24c71e[_0x0999('0x35')][_0x0999('0x37')]?_0x24c71e[_0x0999('0x35')]:_0x2c6686[_0x0999('0x32')];if(_0x45b798['query'][_0x0999('0x49')]){_0x24c71e[_0x0999('0x42')]=[{'all':!![]}];}_0x24c71e=_[_0x0999('0x40')]({},_0x24c71e,_0x45b798[_0x0999('0x41')]);return db[_0x0999('0x2d')][_0x0999('0x4a')](_0x24c71e)[_0x0999('0x23')](handleEntityNotFound(_0x464d53,null))[_0x0999('0x23')](respondWithResult(_0x464d53,null))[_0x0999('0x45')](handleError(_0x464d53,null));};exports[_0x0999('0x4b')]=function(_0x15abcb,_0x2b7bcf){return db[_0x0999('0x2d')]['create'](_0x15abcb[_0x0999('0x4c')],{})[_0x0999('0x23')](function(_0x557ab5){var _0x457f7c=_0x15abcb[_0x0999('0x4d')][_0x0999('0x25')]({'plain':!![]});if(!_0x457f7c)throw new Error(_0x0999('0x4e'));if(_0x457f7c[_0x0999('0x4f')]==='user'){var _0x28841a=_0x557ab5[_0x0999('0x25')]({'plain':!![]});var _0x43fe4a='IvrCampaigns';return db[_0x0999('0x50')][_0x0999('0x4a')]({'where':{'name':_0x43fe4a,'userProfileId':_0x457f7c[_0x0999('0x51')]},'raw':!![]})[_0x0999('0x23')](function(_0x44db1d){if(_0x44db1d&&_0x44db1d['autoAssociation']===0x0){return db[_0x0999('0x26')][_0x0999('0x4b')]({'name':_0x28841a[_0x0999('0x29')],'resourceId':_0x28841a['id'],'type':_0x44db1d[_0x0999('0x29')],'sectionId':_0x44db1d['id']},{})['then'](function(){return _0x557ab5;});}else{return _0x557ab5;}})[_0x0999('0x45')](function(_0x497e2d){logger[_0x0999('0x27')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x497e2d);throw _0x497e2d;});}return _0x557ab5;})[_0x0999('0x23')](respondWithResult(_0x2b7bcf,0xc9))[_0x0999('0x45')](handleError(_0x2b7bcf,null));};exports['clone']=function(_0x265785,_0x1c7418){var _0x1ba2ee={'where':{'id':_0x265785[_0x0999('0x46')]['id']}},_0x36f561={};_0x36f561[_0x0999('0x32')]=_['keys'](db[_0x0999('0x2d')][_0x0999('0x2e')]);_0x1ba2ee[_0x0999('0x35')]=_[_0x0999('0x48')](_0x36f561[_0x0999('0x32')],qs[_0x0999('0x36')](_0x265785[_0x0999('0x34')][_0x0999('0x36')]));_0x1ba2ee['attributes']=_0x1ba2ee[_0x0999('0x35')][_0x0999('0x37')]?_0x1ba2ee[_0x0999('0x35')]:_0x36f561[_0x0999('0x32')];if(_0x265785[_0x0999('0x34')]['includeAll']){_0x1ba2ee[_0x0999('0x42')]=[{'all':!![]}];}_0x1ba2ee=_['merge']({},_0x1ba2ee,_0x265785[_0x0999('0x41')]);return db[_0x0999('0x2d')][_0x0999('0x4a')](_0x1ba2ee)[_0x0999('0x23')](handleEntityNotFound(_0x1c7418,null))[_0x0999('0x23')](function(_0x64576d){if(_0x64576d){var _0x24ef48=_0x64576d[_0x0999('0x25')]({'plain':!![]});_0x24ef48=qs[_0x0999('0x52')](_0x24ef48,['id',_0x0999('0x53'),'updatedAt']);_0x265785[_0x0999('0x4c')]=_[_0x0999('0x52')](_0x265785[_0x0999('0x4c')],['id',_0x0999('0x53'),'updatedAt']);return db[_0x0999('0x2d')][_0x0999('0x4b')](_[_0x0999('0x40')](_0x24ef48,_0x265785[_0x0999('0x4c')]),{'include':_0x265785['query']['includeAll']?[{'all':!![]}]:undefined})[_0x0999('0x23')](function(_0xa83846){var _0x4428b6=_0x265785['user']['get']({'plain':!![]});if(!_0x4428b6)throw new Error(_0x0999('0x4e'));if(_0x4428b6[_0x0999('0x4f')]==='user'){var _0x106068=_0xa83846[_0x0999('0x25')]({'plain':!![]});var _0x21a436=_0x0999('0x54');return db['UserProfileSection']['find']({'where':{'name':_0x21a436,'userProfileId':_0x4428b6['userProfileId']},'raw':!![]})['then'](function(_0x3e3a56){if(_0x3e3a56&&_0x3e3a56[_0x0999('0x55')]===0x0){return db[_0x0999('0x26')][_0x0999('0x4b')]({'name':_0x106068[_0x0999('0x29')],'resourceId':_0x106068['id'],'type':_0x3e3a56[_0x0999('0x29')],'sectionId':_0x3e3a56['id']},{})[_0x0999('0x23')](function(){return _0xa83846;});}else{return _0xa83846;}})['catch'](function(_0x3f0196){logger[_0x0999('0x27')](_0x0999('0x56'),_0x3f0196);throw _0x3f0196;});}return _0xa83846;});}})['then'](respondWithResult(_0x1c7418,0xc9))[_0x0999('0x45')](handleError(_0x1c7418,null));};exports['update']=function(_0x28b440,_0x386da0){if(_0x28b440[_0x0999('0x4c')]['id']){delete _0x28b440[_0x0999('0x4c')]['id'];}return db[_0x0999('0x2d')][_0x0999('0x4a')]({'where':{'id':_0x28b440[_0x0999('0x46')]['id']}})[_0x0999('0x23')](handleEntityNotFound(_0x386da0,null))['then'](saveUpdates(_0x28b440[_0x0999('0x4c')],null))[_0x0999('0x23')](respondWithResult(_0x386da0,null))[_0x0999('0x45')](handleError(_0x386da0,null));};exports[_0x0999('0x24')]=function(_0xc7b3f4,_0x198a43){return db[_0x0999('0x2d')][_0x0999('0x4a')]({'where':{'id':_0xc7b3f4[_0x0999('0x46')]['id']}})[_0x0999('0x23')](handleEntityNotFound(_0x198a43,null))['then'](removeEntity(_0x198a43,null))[_0x0999('0x45')](handleError(_0x198a43,null));};exports[_0x0999('0x57')]=function(_0x5b8770,_0x4d4607,_0x2a9edc){var _0x4ae2de={'raw':!![],'where':{}};var _0x30a0da={};var _0x3987ee={'count':0x0,'rows':[]};return db[_0x0999('0x2d')][_0x0999('0x58')]({'where':{'id':_0x5b8770[_0x0999('0x46')]['id']}})[_0x0999('0x23')](handleEntityNotFound(_0x4d4607,null))['then'](function(_0x246e42){if(_0x246e42){_0x30a0da['model']=_['keys'](db[_0x0999('0x59')][_0x0999('0x2e')]);_0x30a0da[_0x0999('0x34')]=_[_0x0999('0x47')](_0x5b8770['query']);_0x30a0da[_0x0999('0x33')]=_[_0x0999('0x48')](_0x30a0da[_0x0999('0x32')],_0x30a0da['query']);_0x4ae2de[_0x0999('0x35')]=_['intersection'](_0x30a0da[_0x0999('0x32')],qs[_0x0999('0x36')](_0x5b8770['query'][_0x0999('0x36')]));_0x4ae2de[_0x0999('0x35')]=_0x4ae2de[_0x0999('0x35')][_0x0999('0x37')]?_0x4ae2de[_0x0999('0x35')]:_0x30a0da['model'];if(!_0x5b8770[_0x0999('0x34')][_0x0999('0x38')](_0x0999('0x39'))){_0x4ae2de['limit']=qs['limit'](_0x5b8770[_0x0999('0x34')][_0x0999('0x1c')]);_0x4ae2de[_0x0999('0x1b')]=qs[_0x0999('0x1b')](_0x5b8770[_0x0999('0x34')][_0x0999('0x1b')]);}_0x4ae2de['order']=qs[_0x0999('0x3b')](_0x5b8770[_0x0999('0x34')][_0x0999('0x3b')]);_0x4ae2de[_0x0999('0x3e')]=qs['filters'](_[_0x0999('0x3c')](_0x5b8770[_0x0999('0x34')],_0x30a0da['filters']));_0x4ae2de[_0x0999('0x3e')]['CampaignId']=_0x246e42['id'];if(_0x5b8770[_0x0999('0x34')][_0x0999('0x3d')]){_0x4ae2de[_0x0999('0x3e')]=_[_0x0999('0x40')](_0x4ae2de[_0x0999('0x3e')],{'$or':_['map'](_0x4ae2de[_0x0999('0x35')],function(_0x3712c2){var _0x152aaf={};_0x152aaf[_0x3712c2]={'$like':'%'+_0x5b8770[_0x0999('0x34')][_0x0999('0x3d')]+'%'};return _0x152aaf;})});}_0x4ae2de=_[_0x0999('0x40')]({},_0x4ae2de,_0x5b8770[_0x0999('0x41')]);return db[_0x0999('0x59')][_0x0999('0x1a')]({'where':_0x4ae2de[_0x0999('0x3e')]})[_0x0999('0x23')](function(_0x4452b6){_0x3987ee[_0x0999('0x1a')]=_0x4452b6;if(_0x5b8770[_0x0999('0x34')][_0x0999('0x49')]){_0x4ae2de[_0x0999('0x42')]=[{'all':!![]}];}return db['CmHopper'][_0x0999('0x43')](_0x4ae2de);})['then'](function(_0x2dbd3a){_0x3987ee[_0x0999('0x44')]=_0x2dbd3a;return _0x3987ee;});}})[_0x0999('0x23')](respondWithFilteredResult(_0x4d4607,_0x4ae2de))['catch'](handleError(_0x4d4607,null));};exports[_0x0999('0x5a')]=function(_0x2ee7dd,_0x3526a4,_0x1224ab){var _0x28e7c1={'raw':!![],'where':{}};var _0x1495d5={};var _0x2f8a46={'count':0x0,'rows':[]};return db[_0x0999('0x2d')][_0x0999('0x58')]({'where':{'id':_0x2ee7dd[_0x0999('0x46')]['id']}})['then'](handleEntityNotFound(_0x3526a4,null))[_0x0999('0x23')](function(_0x34c021){if(_0x34c021){_0x1495d5[_0x0999('0x32')]=_[_0x0999('0x47')](db[_0x0999('0x5b')][_0x0999('0x2e')]);_0x1495d5[_0x0999('0x34')]=_[_0x0999('0x47')](_0x2ee7dd[_0x0999('0x34')]);_0x1495d5['filters']=_['intersection'](_0x1495d5[_0x0999('0x32')],_0x1495d5[_0x0999('0x34')]);_0x28e7c1[_0x0999('0x35')]=_[_0x0999('0x48')](_0x1495d5[_0x0999('0x32')],qs[_0x0999('0x36')](_0x2ee7dd[_0x0999('0x34')]['fields']));_0x28e7c1['attributes']=_0x28e7c1[_0x0999('0x35')][_0x0999('0x37')]?_0x28e7c1['attributes']:_0x1495d5[_0x0999('0x32')];if(!_0x2ee7dd[_0x0999('0x34')][_0x0999('0x38')](_0x0999('0x39'))){_0x28e7c1[_0x0999('0x1c')]=qs[_0x0999('0x1c')](_0x2ee7dd[_0x0999('0x34')][_0x0999('0x1c')]);_0x28e7c1[_0x0999('0x1b')]=qs[_0x0999('0x1b')](_0x2ee7dd[_0x0999('0x34')][_0x0999('0x1b')]);}_0x28e7c1[_0x0999('0x3a')]=qs['sort'](_0x2ee7dd['query'][_0x0999('0x3b')]);_0x28e7c1[_0x0999('0x3e')]=qs['filters'](_[_0x0999('0x3c')](_0x2ee7dd[_0x0999('0x34')],_0x1495d5[_0x0999('0x33')]));_0x28e7c1[_0x0999('0x3e')]['CampaignId']=_0x34c021['id'];if(_0x2ee7dd['query']['filter']){_0x28e7c1[_0x0999('0x3e')]=_[_0x0999('0x40')](_0x28e7c1[_0x0999('0x3e')],{'$or':_[_0x0999('0x2c')](_0x28e7c1[_0x0999('0x35')],function(_0x2cc80d){var _0x46847e={};_0x46847e[_0x2cc80d]={'$like':'%'+_0x2ee7dd[_0x0999('0x34')]['filter']+'%'};return _0x46847e;})});}_0x28e7c1=_['merge']({},_0x28e7c1,_0x2ee7dd[_0x0999('0x41')]);return db[_0x0999('0x5b')][_0x0999('0x1a')]({'where':_0x28e7c1[_0x0999('0x3e')]})[_0x0999('0x23')](function(_0x2009f8){_0x2f8a46[_0x0999('0x1a')]=_0x2009f8;if(_0x2ee7dd['query'][_0x0999('0x49')]){_0x28e7c1[_0x0999('0x42')]=[{'all':!![]}];}return db[_0x0999('0x5b')][_0x0999('0x43')](_0x28e7c1);})['then'](function(_0x21b1d5){_0x2f8a46[_0x0999('0x44')]=_0x21b1d5;return _0x2f8a46;});}})[_0x0999('0x23')](respondWithFilteredResult(_0x3526a4,_0x28e7c1))[_0x0999('0x45')](handleError(_0x3526a4,null));};exports[_0x0999('0x5c')]=function(_0x59bd3b,_0x35c1fd,_0x37e888){var _0x219d8b={'raw':!![],'where':{}};var _0x2fea6f={};var _0x2a0265={'count':0x0,'rows':[]};return db[_0x0999('0x2d')]['findOne']({'where':{'id':_0x59bd3b['params']['id']}})[_0x0999('0x23')](handleEntityNotFound(_0x35c1fd,null))['then'](function(_0x525bbe){if(_0x525bbe){_0x2fea6f[_0x0999('0x32')]=_[_0x0999('0x47')](db[_0x0999('0x5d')][_0x0999('0x2e')]);_0x2fea6f[_0x0999('0x34')]=_[_0x0999('0x47')](_0x59bd3b[_0x0999('0x34')]);_0x2fea6f[_0x0999('0x33')]=_['intersection'](_0x2fea6f[_0x0999('0x32')],_0x2fea6f[_0x0999('0x34')]);_0x219d8b[_0x0999('0x35')]=_[_0x0999('0x48')](_0x2fea6f[_0x0999('0x32')],qs[_0x0999('0x36')](_0x59bd3b[_0x0999('0x34')][_0x0999('0x36')]));_0x219d8b[_0x0999('0x35')]=_0x219d8b[_0x0999('0x35')]['length']?_0x219d8b[_0x0999('0x35')]:_0x2fea6f[_0x0999('0x32')];if(!_0x59bd3b[_0x0999('0x34')]['hasOwnProperty'](_0x0999('0x39'))){_0x219d8b[_0x0999('0x1c')]=qs[_0x0999('0x1c')](_0x59bd3b['query'][_0x0999('0x1c')]);_0x219d8b[_0x0999('0x1b')]=qs['offset'](_0x59bd3b[_0x0999('0x34')][_0x0999('0x1b')]);}_0x219d8b['order']=qs[_0x0999('0x3b')](_0x59bd3b[_0x0999('0x34')][_0x0999('0x3b')]);_0x219d8b[_0x0999('0x3e')]=qs[_0x0999('0x33')](_[_0x0999('0x3c')](_0x59bd3b['query'],_0x2fea6f[_0x0999('0x33')]));_0x219d8b['where'][_0x0999('0x5e')]=_0x525bbe['id'];if(_0x59bd3b[_0x0999('0x34')]['filter']){_0x219d8b[_0x0999('0x3e')]=_[_0x0999('0x40')](_0x219d8b[_0x0999('0x3e')],{'$or':_['map'](_0x219d8b[_0x0999('0x35')],function(_0x58ffe7){var _0x54e7d9={};_0x54e7d9[_0x58ffe7]={'$like':'%'+_0x59bd3b[_0x0999('0x34')]['filter']+'%'};return _0x54e7d9;})});}_0x219d8b=_[_0x0999('0x40')]({},_0x219d8b,_0x59bd3b[_0x0999('0x41')]);return db[_0x0999('0x5d')]['count']({'where':_0x219d8b['where']})[_0x0999('0x23')](function(_0xd6019a){_0x2a0265[_0x0999('0x1a')]=_0xd6019a;if(_0x59bd3b[_0x0999('0x34')][_0x0999('0x49')]){_0x219d8b[_0x0999('0x42')]=[{'all':!![]}];}return db[_0x0999('0x5d')][_0x0999('0x43')](_0x219d8b);})[_0x0999('0x23')](function(_0x5c35cf){_0x2a0265[_0x0999('0x44')]=_0x5c35cf;return _0x2a0265;});}})['then'](respondWithFilteredResult(_0x35c1fd,_0x219d8b))['catch'](handleError(_0x35c1fd,null));};exports['getHopperBlacks']=function(_0xb51bb8,_0x3ea772,_0x4a5516){var _0xe9bd52={'raw':!![],'where':{}};var _0x156b05={};var _0x5b47f4={'count':0x0,'rows':[]};return db[_0x0999('0x2d')][_0x0999('0x58')]({'where':{'id':_0xb51bb8[_0x0999('0x46')]['id']}})['then'](handleEntityNotFound(_0x3ea772,null))[_0x0999('0x23')](function(_0x4721aa){if(_0x4721aa){_0x156b05[_0x0999('0x32')]=_[_0x0999('0x47')](db[_0x0999('0x5f')]['rawAttributes']);_0x156b05['query']=_[_0x0999('0x47')](_0xb51bb8[_0x0999('0x34')]);_0x156b05[_0x0999('0x33')]=_[_0x0999('0x48')](_0x156b05['model'],_0x156b05['query']);_0xe9bd52[_0x0999('0x35')]=_[_0x0999('0x48')](_0x156b05[_0x0999('0x32')],qs['fields'](_0xb51bb8[_0x0999('0x34')][_0x0999('0x36')]));_0xe9bd52[_0x0999('0x35')]=_0xe9bd52[_0x0999('0x35')][_0x0999('0x37')]?_0xe9bd52[_0x0999('0x35')]:_0x156b05[_0x0999('0x32')];if(!_0xb51bb8[_0x0999('0x34')][_0x0999('0x38')](_0x0999('0x39'))){_0xe9bd52[_0x0999('0x1c')]=qs[_0x0999('0x1c')](_0xb51bb8['query']['limit']);_0xe9bd52['offset']=qs['offset'](_0xb51bb8['query']['offset']);}_0xe9bd52[_0x0999('0x3a')]=qs[_0x0999('0x3b')](_0xb51bb8['query'][_0x0999('0x3b')]);_0xe9bd52[_0x0999('0x3e')]=qs[_0x0999('0x33')](_[_0x0999('0x3c')](_0xb51bb8[_0x0999('0x34')],_0x156b05[_0x0999('0x33')]));_0xe9bd52['where'][_0x0999('0x5e')]=_0x4721aa['id'];if(_0xb51bb8[_0x0999('0x34')][_0x0999('0x3d')]){_0xe9bd52[_0x0999('0x3e')]=_['merge'](_0xe9bd52[_0x0999('0x3e')],{'$or':_[_0x0999('0x2c')](_0xe9bd52[_0x0999('0x35')],function(_0x241809){var _0x15f647={};_0x15f647[_0x241809]={'$like':'%'+_0xb51bb8['query'][_0x0999('0x3d')]+'%'};return _0x15f647;})});}_0xe9bd52=_[_0x0999('0x40')]({},_0xe9bd52,_0xb51bb8['options']);return db['CmHopperBlack']['count']({'where':_0xe9bd52[_0x0999('0x3e')]})['then'](function(_0x7048b8){_0x5b47f4[_0x0999('0x1a')]=_0x7048b8;if(_0xb51bb8[_0x0999('0x34')][_0x0999('0x49')]){_0xe9bd52[_0x0999('0x42')]=[{'all':!![]}];}return db[_0x0999('0x5f')][_0x0999('0x43')](_0xe9bd52);})['then'](function(_0x74efb2){_0x5b47f4[_0x0999('0x44')]=_0x74efb2;return _0x5b47f4;});}})['then'](respondWithFilteredResult(_0x3ea772,_0xe9bd52))[_0x0999('0x45')](handleError(_0x3ea772,null));};exports[_0x0999('0x60')]=function(_0x5635d6,_0x1bdd98,_0x5382e5){var _0x3fc723={};var _0x4ddf2a={};var _0x2c0d4e;var _0x4cd956;return db[_0x0999('0x2d')]['findOne']({'where':{'id':_0x5635d6[_0x0999('0x46')]['id']}})['then'](handleEntityNotFound(_0x1bdd98,null))['then'](function(_0x5d6c00){if(_0x5d6c00){_0x2c0d4e=_0x5d6c00;_0x4ddf2a[_0x0999('0x32')]=_[_0x0999('0x47')](db['CmList'][_0x0999('0x2e')]);_0x4ddf2a[_0x0999('0x34')]=_[_0x0999('0x47')](_0x5635d6[_0x0999('0x34')]);_0x4ddf2a[_0x0999('0x33')]=_[_0x0999('0x48')](_0x4ddf2a[_0x0999('0x32')],_0x4ddf2a[_0x0999('0x34')]);_0x3fc723['attributes']=_['intersection'](_0x4ddf2a[_0x0999('0x32')],qs[_0x0999('0x36')](_0x5635d6[_0x0999('0x34')][_0x0999('0x36')]));_0x3fc723['attributes']=_0x3fc723[_0x0999('0x35')][_0x0999('0x37')]?_0x3fc723[_0x0999('0x35')]:_0x4ddf2a[_0x0999('0x32')];_0x3fc723[_0x0999('0x3a')]=qs[_0x0999('0x3b')](_0x5635d6[_0x0999('0x34')][_0x0999('0x3b')]);_0x3fc723[_0x0999('0x3e')]=qs[_0x0999('0x33')](_[_0x0999('0x3c')](_0x5635d6[_0x0999('0x34')],_0x4ddf2a[_0x0999('0x33')]));if(_0x5635d6[_0x0999('0x34')][_0x0999('0x3d')]){_0x3fc723[_0x0999('0x3e')]=_[_0x0999('0x40')](_0x3fc723[_0x0999('0x3e')],{'$or':_[_0x0999('0x2c')](_0x3fc723[_0x0999('0x35')],function(_0x2187ab){var _0x5b2a13={};_0x5b2a13[_0x2187ab]={'$like':'%'+_0x5635d6[_0x0999('0x34')][_0x0999('0x3d')]+'%'};return _0x5b2a13;})});}_0x3fc723=_[_0x0999('0x40')]({},_0x3fc723,_0x5635d6[_0x0999('0x41')]);return _0x2c0d4e[_0x0999('0x60')](_0x3fc723);}})['then'](function(_0x5eb6ca){if(_0x5eb6ca){_0x4cd956=_0x5eb6ca[_0x0999('0x37')];if(!_0x5635d6[_0x0999('0x34')][_0x0999('0x38')]('nolimit')){_0x3fc723[_0x0999('0x1c')]=qs[_0x0999('0x1c')](_0x5635d6[_0x0999('0x34')]['limit']);_0x3fc723['offset']=qs[_0x0999('0x1b')](_0x5635d6[_0x0999('0x34')][_0x0999('0x1b')]);}return _0x2c0d4e[_0x0999('0x60')](_0x3fc723);}})['then'](function(_0x5f41f6){if(_0x5f41f6){return _0x5f41f6?{'count':_0x4cd956,'rows':_0x5f41f6}:null;}})[_0x0999('0x23')](respondWithResult(_0x1bdd98,null))[_0x0999('0x45')](handleError(_0x1bdd98,null));};exports[_0x0999('0x61')]=function(_0xb51c01,_0x47cfe2,_0x4546c7){var _0x25c88f,_0x2e759b;return db[_0x0999('0x2d')][_0x0999('0x4a')]({'where':{'id':_0xb51c01[_0x0999('0x46')]['id']}})['then'](handleEntityNotFound(_0x47cfe2,null))['then'](function(_0x809ddd){if(_0x809ddd){_0x2e759b=_0x809ddd;return _0x809ddd[_0x0999('0x61')](_0xb51c01[_0x0999('0x4c')][_0x0999('0x62')],_[_0x0999('0x52')](_0xb51c01[_0x0999('0x4c')],[_0x0999('0x62'),'id'])||{});}return null;})[_0x0999('0x63')](function(_0x8956c){var _0x59e545;_0x25c88f=_0x8956c||[];var _0x1ff849=[];if(_0x8956c){for(var _0x547249=0x0;_0x547249<_0x8956c['length'];_0x547249+=0x1){var _0x27d318=_0x8956c[_0x547249][_0x0999('0x25')]({'plain':!![]});_0x2e759b[_0x0999('0x64')]=_0xb51c01[_0x0999('0x4c')]['dialCheckDuplicateType']?_0xb51c01[_0x0999('0x4c')]['dialCheckDuplicateType']:_0x2e759b[_0x0999('0x64')];switch(_0x2e759b[_0x0999('0x64')]){case'always':_0x59e545=squel[_0x0999('0x65')]()[_0x0999('0x66')](_0x0999('0x67'))['fromQuery'](['phone','scheduledAt','ContactId',_0x0999('0x68'),_0x0999('0x5e'),_0x0999('0x53'),'updatedAt'],squel[_0x0999('0x69')]()['field']('phone','phone')[_0x0999('0x6a')](_0x0999('0x6b'),_0x0999('0x6c'))[_0x0999('0x6a')]('id',_0x0999('0x6d'))[_0x0999('0x6a')](_0x27d318[_0x0999('0x6e')][_0x0999('0x6f')](),_0x0999('0x68'))[_0x0999('0x6a')](_0xb51c01[_0x0999('0x46')]['id']['toString'](),_0x0999('0x5e'))[_0x0999('0x6a')](_0x0999('0x6b'),'createdAt')['field'](_0x0999('0x6b'),_0x0999('0x70'))['from'](_0x0999('0x71'))[_0x0999('0x3e')](_0x0999('0x72'))[_0x0999('0x3e')](_0x0999('0x73'),_0x27d318[_0x0999('0x6e')]['toString']())['where'](_0x0999('0x74'))[_0x0999('0x3e')]('phone\x20NOT\x20IN\x20(?)',squel[_0x0999('0x69')]()[_0x0999('0x6a')](_0x0999('0x75'))[_0x0999('0x76')](_0x0999('0x77'))[_0x0999('0x3e')](_0x0999('0x78'),_0xb51c01[_0x0999('0x46')]['id']['toString']()))[_0x0999('0x3e')](_0x0999('0x79'),squel[_0x0999('0x69')]()[_0x0999('0x6a')](_0x0999('0x7a'))['from'](_0x0999('0x67'))[_0x0999('0x3e')](_0x0999('0x78'),_0xb51c01[_0x0999('0x46')]['id'][_0x0999('0x6f')]())))[_0x0999('0x6f')]();break;case _0x0999('0x7b'):_0x59e545=squel['insert']()[_0x0999('0x66')]('cm_hopper')[_0x0999('0x7c')]([_0x0999('0x7d'),'scheduledAt',_0x0999('0x6d'),_0x0999('0x68'),_0x0999('0x5e'),_0x0999('0x53'),_0x0999('0x70')],squel[_0x0999('0x69')]()[_0x0999('0x6a')](_0x0999('0x7d'),_0x0999('0x7d'))[_0x0999('0x6a')](_0x0999('0x6b'),_0x0999('0x6c'))[_0x0999('0x6a')]('id',_0x0999('0x6d'))['field'](_0x27d318['CmListId'][_0x0999('0x6f')](),_0x0999('0x68'))[_0x0999('0x6a')](_0xb51c01[_0x0999('0x46')]['id'][_0x0999('0x6f')](),_0x0999('0x5e'))[_0x0999('0x6a')](_0x0999('0x6b'),_0x0999('0x53'))[_0x0999('0x6a')](_0x0999('0x6b'),'updatedAt')[_0x0999('0x76')](_0x0999('0x71'))[_0x0999('0x3e')](_0x0999('0x72'))[_0x0999('0x3e')](_0x0999('0x73'),_0x27d318['CmListId']['toString']())['where'](_0x0999('0x74'))['where']('phone\x20NOT\x20IN\x20(?)',squel[_0x0999('0x69')]()[_0x0999('0x6a')](_0x0999('0x7a'))[_0x0999('0x76')]('cm_hopper')['where'](_0x0999('0x78'),_0xb51c01[_0x0999('0x46')]['id']['toString']())))[_0x0999('0x6f')]();break;default:_0x59e545=squel[_0x0999('0x65')]()[_0x0999('0x66')]('cm_hopper')[_0x0999('0x7c')]([_0x0999('0x7d'),_0x0999('0x6c'),'ContactId',_0x0999('0x68'),_0x0999('0x5e'),'createdAt',_0x0999('0x70')],squel[_0x0999('0x69')]()[_0x0999('0x6a')](_0x0999('0x7d'),_0x0999('0x7d'))[_0x0999('0x6a')](_0x0999('0x6b'),_0x0999('0x6c'))['field']('id',_0x0999('0x6d'))[_0x0999('0x6a')](_0x27d318[_0x0999('0x6e')]['toString'](),'ListId')['field'](_0xb51c01[_0x0999('0x46')]['id'][_0x0999('0x6f')](),_0x0999('0x5e'))[_0x0999('0x6a')]('NOW()','createdAt')[_0x0999('0x6a')](_0x0999('0x6b'),_0x0999('0x70'))[_0x0999('0x76')](_0x0999('0x71'))[_0x0999('0x3e')](_0x0999('0x72'))[_0x0999('0x3e')](_0x0999('0x73'),_0x27d318['CmListId'][_0x0999('0x6f')]())[_0x0999('0x3e')](_0x0999('0x74')))[_0x0999('0x6f')]();}_0x1ff849['push'](db[_0x0999('0x7e')][_0x0999('0x34')](_0x59e545));}return BPromise[_0x0999('0x7f')](_0x1ff849);}})[_0x0999('0x23')](function(){return _0x25c88f;})[_0x0999('0x23')](respondWithResult(_0x47cfe2,null))[_0x0999('0x45')](handleError(_0x47cfe2,null));};exports['removeLists']=function(_0x2a4d7a,_0xa13da4,_0x55e8c9){return db[_0x0999('0x2d')][_0x0999('0x4a')]({'where':{'id':_0x2a4d7a[_0x0999('0x46')]['id']}})['then'](handleEntityNotFound(_0xa13da4,null))[_0x0999('0x23')](function(_0x2fdc0b){if(_0x2fdc0b){return _0x2fdc0b[_0x0999('0x80')](_0x2a4d7a[_0x0999('0x34')]['ids']);}})['then'](function(_0x521afa){if(_0x521afa){return db[_0x0999('0x59')]['destroy']({'where':{'ListId':_0x2a4d7a[_0x0999('0x34')][_0x0999('0x62')],'CampaignId':_0x2a4d7a['params']['id']}})[_0x0999('0x23')](function(){return _0x521afa;});}})[_0x0999('0x23')](respondWithStatusCode(_0xa13da4,null))['catch'](handleError(_0xa13da4,null));};exports[_0x0999('0x81')]=function(_0xf542f9,_0x240568,_0x318b79){var _0x5afd71={};var _0x29979d={};var _0x4b4a62;var _0x242913;return db['Campaign']['findOne']({'where':{'id':_0xf542f9[_0x0999('0x46')]['id']}})['then'](handleEntityNotFound(_0x240568,null))[_0x0999('0x23')](function(_0x134b1f){if(_0x134b1f){_0x4b4a62=_0x134b1f;_0x29979d[_0x0999('0x32')]=_[_0x0999('0x47')](db[_0x0999('0x82')][_0x0999('0x2e')]);_0x29979d[_0x0999('0x34')]=_['keys'](_0xf542f9[_0x0999('0x34')]);_0x29979d['filters']=_['intersection'](_0x29979d[_0x0999('0x32')],_0x29979d['query']);_0x5afd71['attributes']=_[_0x0999('0x48')](_0x29979d[_0x0999('0x32')],qs[_0x0999('0x36')](_0xf542f9[_0x0999('0x34')][_0x0999('0x36')]));_0x5afd71[_0x0999('0x35')]=_0x5afd71[_0x0999('0x35')][_0x0999('0x37')]?_0x5afd71[_0x0999('0x35')]:_0x29979d[_0x0999('0x32')];_0x5afd71[_0x0999('0x3a')]=qs[_0x0999('0x3b')](_0xf542f9['query'][_0x0999('0x3b')]);_0x5afd71[_0x0999('0x3e')]=qs[_0x0999('0x33')](_[_0x0999('0x3c')](_0xf542f9[_0x0999('0x34')],_0x29979d[_0x0999('0x33')]));if(_0xf542f9[_0x0999('0x34')][_0x0999('0x3d')]){_0x5afd71['where']=_[_0x0999('0x40')](_0x5afd71[_0x0999('0x3e')],{'$or':_[_0x0999('0x2c')](_0x5afd71[_0x0999('0x35')],function(_0x4dada5){var _0x211877={};_0x211877[_0x4dada5]={'$like':'%'+_0xf542f9[_0x0999('0x34')][_0x0999('0x3d')]+'%'};return _0x211877;})});}_0x5afd71=_[_0x0999('0x40')]({},_0x5afd71,_0xf542f9['options']);return _0x4b4a62[_0x0999('0x81')](_0x5afd71);}})[_0x0999('0x23')](function(_0x19cfb5){if(_0x19cfb5){_0x242913=_0x19cfb5[_0x0999('0x37')];if(!_0xf542f9[_0x0999('0x34')][_0x0999('0x38')](_0x0999('0x39'))){_0x5afd71[_0x0999('0x1c')]=qs[_0x0999('0x1c')](_0xf542f9[_0x0999('0x34')][_0x0999('0x1c')]);_0x5afd71['offset']=qs[_0x0999('0x1b')](_0xf542f9[_0x0999('0x34')][_0x0999('0x1b')]);}return _0x4b4a62['getBlackLists'](_0x5afd71);}})[_0x0999('0x23')](function(_0x2c5bee){if(_0x2c5bee){return _0x2c5bee?{'count':_0x242913,'rows':_0x2c5bee}:null;}})[_0x0999('0x23')](respondWithResult(_0x240568,null))['catch'](handleError(_0x240568,null));};exports[_0x0999('0x83')]=function(_0x50e95f,_0x43f7bb,_0x42191b){var _0xd31557,_0x704d2f;return db[_0x0999('0x2d')][_0x0999('0x4a')]({'where':{'id':_0x50e95f[_0x0999('0x46')]['id']}})[_0x0999('0x23')](handleEntityNotFound(_0x43f7bb,null))[_0x0999('0x23')](function(_0x319ec8){if(_0x319ec8){_0x704d2f=_0x319ec8;return _0x319ec8['addBlackLists'](_0x50e95f[_0x0999('0x4c')]['ids'],_[_0x0999('0x52')](_0x50e95f[_0x0999('0x4c')],[_0x0999('0x62'),'id'])||{});}return null;})[_0x0999('0x63')](function(_0x5b6e10){var _0x16ae05;_0xd31557=_0x5b6e10||[];var _0x42cdeb=[];if(_0x5b6e10){for(var _0x2c36d1=0x0;_0x2c36d1<_0x5b6e10['length'];_0x2c36d1+=0x1){var _0x2cd537=_0x5b6e10[_0x2c36d1][_0x0999('0x25')]({'plain':!![]});_0x16ae05=squel[_0x0999('0x65')]()[_0x0999('0x66')](_0x0999('0x84'))['fromQuery'](['phone',_0x0999('0x6d'),'ListId','CampaignId',_0x0999('0x53'),_0x0999('0x70')],squel[_0x0999('0x69')]()[_0x0999('0x6a')](_0x0999('0x7d'),_0x0999('0x7d'))[_0x0999('0x6a')]('id',_0x0999('0x6d'))['field'](_0x2cd537[_0x0999('0x6e')][_0x0999('0x6f')](),_0x0999('0x68'))['field'](_0x50e95f[_0x0999('0x46')]['id'][_0x0999('0x6f')](),_0x0999('0x5e'))[_0x0999('0x6a')](_0x0999('0x6b'),_0x0999('0x53'))['field'](_0x0999('0x6b'),'updatedAt')[_0x0999('0x76')](_0x0999('0x71'))['where'](_0x0999('0x72'))['where'](_0x0999('0x73'),_0x2cd537[_0x0999('0x6e')][_0x0999('0x6f')]())['where'](_0x0999('0x74')))[_0x0999('0x6f')]();_0x42cdeb[_0x0999('0x85')](db['sequelize'][_0x0999('0x34')](_0x16ae05));}return BPromise[_0x0999('0x7f')](_0x42cdeb);}})['then'](function(){return _0xd31557;})[_0x0999('0x23')](respondWithResult(_0x43f7bb,null))[_0x0999('0x45')](handleError(_0x43f7bb,null));};exports['removeBlackLists']=function(_0x2080d4,_0x55a2a5,_0x1f2102){return db[_0x0999('0x2d')]['find']({'where':{'id':_0x2080d4[_0x0999('0x46')]['id']}})[_0x0999('0x23')](handleEntityNotFound(_0x55a2a5,null))[_0x0999('0x23')](function(_0x18964f){if(_0x18964f){return _0x18964f[_0x0999('0x86')](_0x2080d4[_0x0999('0x34')]['ids']);}})['then'](function(_0x459baf){if(_0x459baf){return db['CmHopperBlack'][_0x0999('0x24')]({'where':{'ListId':_0x2080d4[_0x0999('0x34')][_0x0999('0x62')],'CampaignId':_0x2080d4['params']['id']}})[_0x0999('0x23')](function(){return _0x459baf;});}})['then'](respondWithStatusCode(_0x55a2a5,null))[_0x0999('0x45')](handleError(_0x55a2a5,null));}; \ No newline at end of file diff --git a/server/api/campaign/campaign.model.js b/server/api/campaign/campaign.model.js index df77e50..f1fbe1b 100644 --- a/server/api/campaign/campaign.model.js +++ b/server/api/campaign/campaign.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['exports','define','Campaign','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./campaign.attributes'];(function(_0x2642cb,_0x4b917f){var _0xe6e41=function(_0x281676){while(--_0x281676){_0x2642cb['push'](_0x2642cb['shift']());}};_0xe6e41(++_0x4b917f);}(_0x9957,0x93));var _0x7995=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x9957[_0x5ddb1c];return _0x354adc;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var logger=require(_0x7995('0x2'))(_0x7995('0x3'));var moment=require('moment');var BPromise=require(_0x7995('0x4'));var rp=require(_0x7995('0x5'));var fs=require('fs');var path=require(_0x7995('0x6'));var rimraf=require(_0x7995('0x7'));var config=require('../../config/environment');var attributes=require(_0x7995('0x8'));module[_0x7995('0x9')]=function(_0x137b6b,_0x219534){return _0x137b6b[_0x7995('0xa')](_0x7995('0xb'),attributes,{'tableName':'campaigns','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7a54=['../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./campaign.attributes','exports','Campaign','campaigns','lodash','util'];(function(_0x1c50d6,_0x1097f2){var _0x566560=function(_0x7fad7){while(--_0x7fad7){_0x1c50d6['push'](_0x1c50d6['shift']());}};_0x566560(++_0x1097f2);}(_0x7a54,0x106));var _0x47a5=function(_0x360072,_0x30daf4){_0x360072=_0x360072-0x0;var _0x44cd9b=_0x7a54[_0x360072];return _0x44cd9b;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var logger=require(_0x47a5('0x2'))('api');var moment=require(_0x47a5('0x3'));var BPromise=require(_0x47a5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x47a5('0x5'));var rimraf=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var attributes=require(_0x47a5('0x8'));module[_0x47a5('0x9')]=function(_0x545a97,_0x3d5629){return _0x545a97['define'](_0x47a5('0xa'),attributes,{'tableName':_0x47a5('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/campaign/campaign.rpc.js b/server/api/campaign/campaign.rpc.js index 89858a9..8c312a9 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 _0xa900=['Campaign,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','request\x20sent','result','catch','Campaign','findAll','options','raw','attributes','limit','include','map','model','GetCampaign','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','Campaign,\x20%s,\x20%s','debug'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xa900,0x101));var _0x0a90=function(_0x5ce34a,_0x57887e){_0x5ce34a=_0x5ce34a-0x0;var _0x309350=_0xa900[_0x5ce34a];return _0x309350;};'use strict';var _=require(_0x0a90('0x0'));var util=require(_0x0a90('0x1'));var moment=require(_0x0a90('0x2'));var BPromise=require(_0x0a90('0x3'));var rs=require(_0x0a90('0x4'));var fs=require('fs');var Redis=require(_0x0a90('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a90('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x0a90('0x7'));var jayson=require(_0x0a90('0x8'));var client=jayson[_0x0a90('0x9')][_0x0a90('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x56a1e5,_0x3909ac,_0x4718e9){return new BPromise(function(_0x33e3cf,_0x4f2b58){return client[_0x0a90('0xb')](_0x56a1e5,_0x4718e9)[_0x0a90('0xc')](function(_0x36c82f){logger['info'](_0x0a90('0xd'),_0x3909ac,'request\x20sent');logger[_0x0a90('0xe')](_0x0a90('0xf'),_0x3909ac,'request\x20sent',JSON[_0x0a90('0x10')](_0x36c82f));if(_0x36c82f[_0x0a90('0x11')]){if(_0x36c82f[_0x0a90('0x11')][_0x0a90('0x12')]===0x1f4){logger[_0x0a90('0x11')](_0x0a90('0xd'),_0x3909ac,_0x36c82f[_0x0a90('0x11')][_0x0a90('0x13')]);return _0x4f2b58(_0x36c82f[_0x0a90('0x11')][_0x0a90('0x13')]);}logger[_0x0a90('0x11')](_0x0a90('0xd'),_0x3909ac,_0x36c82f[_0x0a90('0x11')]['message']);return _0x33e3cf(_0x36c82f['error'][_0x0a90('0x13')]);}else{logger[_0x0a90('0x14')](_0x0a90('0xd'),_0x3909ac,_0x0a90('0x15'));_0x33e3cf(_0x36c82f[_0x0a90('0x16')][_0x0a90('0x13')]);}})[_0x0a90('0x17')](function(_0x4c5979){logger[_0x0a90('0x11')](_0x0a90('0xd'),_0x3909ac,_0x4c5979);_0x4f2b58(_0x4c5979);});});}exports['GetCampaign']=function(_0x2c0719){var _0x5cbe3c=this;return new Promise(function(_0x619487,_0x44b75d){return db[_0x0a90('0x18')][_0x0a90('0x19')]({'raw':_0x2c0719['options']?_0x2c0719[_0x0a90('0x1a')][_0x0a90('0x1b')]===undefined?!![]:![]:!![],'where':_0x2c0719[_0x0a90('0x1a')]?_0x2c0719['options']['where']||null:null,'attributes':_0x2c0719[_0x0a90('0x1a')]?_0x2c0719['options'][_0x0a90('0x1c')]||null:null,'limit':_0x2c0719['options']?_0x2c0719[_0x0a90('0x1a')][_0x0a90('0x1d')]||null:null,'include':_0x2c0719[_0x0a90('0x1a')]?_0x2c0719[_0x0a90('0x1a')][_0x0a90('0x1e')]?_[_0x0a90('0x1f')](_0x2c0719[_0x0a90('0x1a')][_0x0a90('0x1e')],function(_0x2c3431){return{'model':db[_0x2c3431[_0x0a90('0x20')]],'as':_0x2c3431['as'],'attributes':_0x2c3431[_0x0a90('0x1c')],'include':_0x2c3431[_0x0a90('0x1e')]?_[_0x0a90('0x1f')](_0x2c3431[_0x0a90('0x1e')],function(_0x569dc3){return{'model':db[_0x569dc3[_0x0a90('0x20')]],'as':_0x569dc3['as'],'attributes':_0x569dc3[_0x0a90('0x1c')],'include':_0x569dc3[_0x0a90('0x1e')]?_[_0x0a90('0x1f')](_0x569dc3['include'],function(_0x1711e2){return{'model':db[_0x1711e2[_0x0a90('0x20')]],'as':_0x1711e2['as'],'attributes':_0x1711e2[_0x0a90('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x0a90('0xc')](function(_0xe4729b){logger[_0x0a90('0x14')](_0x0a90('0x21'),_0x2c0719);logger[_0x0a90('0xe')](_0x0a90('0x21'),_0x2c0719,JSON[_0x0a90('0x10')](_0xe4729b));_0x619487(_0xe4729b);})['catch'](function(_0x3c194e){logger[_0x0a90('0x11')](_0x0a90('0x21'),_0x3c194e['message'],_0x2c0719);_0x44b75d(_0x5cbe3c[_0x0a90('0x11')](0x1f4,_0x3c194e['message']));});});}; \ No newline at end of file +var _0x2f68=['limit','include','map','model','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','jayson/promise','client','request','then','info','Campaign,\x20%s,\x20%s','debug','Campaign,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','GetCampaign','Campaign','findAll','options','attributes'];(function(_0x321504,_0xfde0ac){var _0xf9f5ac=function(_0x462ed7){while(--_0x462ed7){_0x321504['push'](_0x321504['shift']());}};_0xf9f5ac(++_0xfde0ac);}(_0x2f68,0x9a));var _0x82f6=function(_0x5987da,_0x355ca7){_0x5987da=_0x5987da-0x0;var _0x2c18b9=_0x2f68[_0x5987da];return _0x2c18b9;};'use strict';var _=require('lodash');var util=require(_0x82f6('0x0'));var moment=require(_0x82f6('0x1'));var BPromise=require(_0x82f6('0x2'));var rs=require(_0x82f6('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x82f6('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x82f6('0x5'))(_0x82f6('0x6'));var config=require('../../config/environment');var jayson=require(_0x82f6('0x7'));var client=jayson[_0x82f6('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5a8089,_0x1bc0be,_0x5660bf){return new BPromise(function(_0x5daa3c,_0x864400){return client[_0x82f6('0x9')](_0x5a8089,_0x5660bf)[_0x82f6('0xa')](function(_0x5ee0e5){logger[_0x82f6('0xb')](_0x82f6('0xc'),_0x1bc0be,'request\x20sent');logger[_0x82f6('0xd')](_0x82f6('0xe'),_0x1bc0be,_0x82f6('0xf'),JSON[_0x82f6('0x10')](_0x5ee0e5));if(_0x5ee0e5[_0x82f6('0x11')]){if(_0x5ee0e5[_0x82f6('0x11')]['code']===0x1f4){logger[_0x82f6('0x11')](_0x82f6('0xc'),_0x1bc0be,_0x5ee0e5['error'][_0x82f6('0x12')]);return _0x864400(_0x5ee0e5[_0x82f6('0x11')][_0x82f6('0x12')]);}logger[_0x82f6('0x11')](_0x82f6('0xc'),_0x1bc0be,_0x5ee0e5[_0x82f6('0x11')][_0x82f6('0x12')]);return _0x5daa3c(_0x5ee0e5[_0x82f6('0x11')][_0x82f6('0x12')]);}else{logger['info'](_0x82f6('0xc'),_0x1bc0be,'request\x20sent');_0x5daa3c(_0x5ee0e5[_0x82f6('0x13')][_0x82f6('0x12')]);}})[_0x82f6('0x14')](function(_0x1033d3){logger[_0x82f6('0x11')](_0x82f6('0xc'),_0x1bc0be,_0x1033d3);_0x864400(_0x1033d3);});});}exports[_0x82f6('0x15')]=function(_0xcbc95f){var _0x4072f0=this;return new Promise(function(_0x2bfd57,_0x1c79f9){return db[_0x82f6('0x16')][_0x82f6('0x17')]({'raw':_0xcbc95f[_0x82f6('0x18')]?_0xcbc95f[_0x82f6('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0xcbc95f[_0x82f6('0x18')]?_0xcbc95f[_0x82f6('0x18')]['where']||null:null,'attributes':_0xcbc95f[_0x82f6('0x18')]?_0xcbc95f[_0x82f6('0x18')][_0x82f6('0x19')]||null:null,'limit':_0xcbc95f[_0x82f6('0x18')]?_0xcbc95f['options'][_0x82f6('0x1a')]||null:null,'include':_0xcbc95f['options']?_0xcbc95f[_0x82f6('0x18')][_0x82f6('0x1b')]?_['map'](_0xcbc95f['options'][_0x82f6('0x1b')],function(_0x1d96d5){return{'model':db[_0x1d96d5['model']],'as':_0x1d96d5['as'],'attributes':_0x1d96d5['attributes'],'include':_0x1d96d5[_0x82f6('0x1b')]?_[_0x82f6('0x1c')](_0x1d96d5['include'],function(_0xfd8b68){return{'model':db[_0xfd8b68[_0x82f6('0x1d')]],'as':_0xfd8b68['as'],'attributes':_0xfd8b68['attributes'],'include':_0xfd8b68['include']?_[_0x82f6('0x1c')](_0xfd8b68['include'],function(_0x469b6b){return{'model':db[_0x469b6b[_0x82f6('0x1d')]],'as':_0x469b6b['as'],'attributes':_0x469b6b['attributes']};}):[]};}):[]};}):[]:[]})[_0x82f6('0xa')](function(_0x15c9b7){logger[_0x82f6('0xb')](_0x82f6('0x15'),_0xcbc95f);logger['debug'](_0x82f6('0x15'),_0xcbc95f,JSON[_0x82f6('0x10')](_0x15c9b7));_0x2bfd57(_0x15c9b7);})[_0x82f6('0x14')](function(_0x400137){logger[_0x82f6('0x11')](_0x82f6('0x15'),_0x400137[_0x82f6('0x12')],_0xcbc95f);_0x1c79f9(_0x4072f0[_0x82f6('0x11')](0x1f4,_0x400137[_0x82f6('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/campaign/index.js b/server/api/campaign/index.js index 7de9330..9f6924c 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 _0xa232=['getHoppers','/:id/hopper_histories','/:id/hopper_finals','getHopperFinals','/:id/hopper_black','getHopperBlacks','/:id/lists','getLists','getBlackLists','create','post','/:id/clone','clone','addLists','/:id/blacklists','addBlackLists','put','delete','removeLists','removeBlackLists','exports','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./campaign.controller','get','isAuthenticated','/:id'];(function(_0x49c957,_0x3509d8){var _0x5b1d38=function(_0x219976){while(--_0x219976){_0x49c957['push'](_0x49c957['shift']());}};_0x5b1d38(++_0x3509d8);}(_0xa232,0x141));var _0x2a23=function(_0xdb6bb3,_0x385924){_0xdb6bb3=_0xdb6bb3-0x0;var _0x495cd9=_0xa232[_0xdb6bb3];return _0x495cd9;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x2a23('0x0'));var express=require(_0x2a23('0x1'));var router=express[_0x2a23('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x2a23('0x3'));var interaction=require(_0x2a23('0x4'));var config=require('../../config/environment');var controller=require(_0x2a23('0x5'));router[_0x2a23('0x6')]('/',auth[_0x2a23('0x7')](),controller['index']);router['get'](_0x2a23('0x8'),auth[_0x2a23('0x7')](),controller['show']);router['get']('/:id/hoppers',auth[_0x2a23('0x7')](),controller[_0x2a23('0x9')]);router[_0x2a23('0x6')](_0x2a23('0xa'),auth[_0x2a23('0x7')](),controller['getHopperHistories']);router[_0x2a23('0x6')](_0x2a23('0xb'),auth['isAuthenticated'](),controller[_0x2a23('0xc')]);router['get'](_0x2a23('0xd'),auth[_0x2a23('0x7')](),controller[_0x2a23('0xe')]);router[_0x2a23('0x6')](_0x2a23('0xf'),auth['isAuthenticated'](),controller[_0x2a23('0x10')]);router['get']('/:id/blacklists',auth[_0x2a23('0x7')](),controller[_0x2a23('0x11')]);router['post']('/',auth['isAuthenticated'](),controller[_0x2a23('0x12')]);router[_0x2a23('0x13')](_0x2a23('0x14'),auth['isAuthenticated'](),controller[_0x2a23('0x15')]);router[_0x2a23('0x13')](_0x2a23('0xf'),auth[_0x2a23('0x7')](),controller[_0x2a23('0x16')]);router['post'](_0x2a23('0x17'),auth[_0x2a23('0x7')](),controller[_0x2a23('0x18')]);router[_0x2a23('0x19')](_0x2a23('0x8'),auth[_0x2a23('0x7')](),controller['update']);router[_0x2a23('0x1a')](_0x2a23('0x8'),auth[_0x2a23('0x7')](),controller['destroy']);router[_0x2a23('0x1a')]('/:id/lists',auth[_0x2a23('0x7')](),controller[_0x2a23('0x1b')]);router['delete'](_0x2a23('0x17'),auth[_0x2a23('0x7')](),controller[_0x2a23('0x1c')]);module[_0x2a23('0x1d')]=router; \ No newline at end of file +var _0x1e1a=['show','/:id/hoppers','getHoppers','/:id/hopper_histories','getHopperHistories','/:id/hopper_finals','isAuthenticated','getHopperFinals','/:id/hopper_black','getHopperBlacks','/:id/lists','getLists','post','create','clone','addLists','/:id/blacklists','put','update','delete','destroy','removeLists','removeBlackLists','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./campaign.controller','get','index','/:id'];(function(_0x5c082a,_0x19ac27){var _0x3b60ac=function(_0x2f37ef){while(--_0x2f37ef){_0x5c082a['push'](_0x5c082a['shift']());}};_0x3b60ac(++_0x19ac27);}(_0x1e1a,0x175));var _0xa1e1=function(_0x3addef,_0x37deb2){_0x3addef=_0x3addef-0x0;var _0x3a2b8e=_0x1e1a[_0x3addef];return _0x3a2b8e;};'use strict';var multer=require('multer');var util=require(_0xa1e1('0x0'));var path=require(_0xa1e1('0x1'));var timeout=require(_0xa1e1('0x2'));var express=require(_0xa1e1('0x3'));var router=express[_0xa1e1('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xa1e1('0x5'));var interaction=require(_0xa1e1('0x6'));var config=require(_0xa1e1('0x7'));var controller=require(_0xa1e1('0x8'));router[_0xa1e1('0x9')]('/',auth['isAuthenticated'](),controller[_0xa1e1('0xa')]);router[_0xa1e1('0x9')](_0xa1e1('0xb'),auth['isAuthenticated'](),controller[_0xa1e1('0xc')]);router[_0xa1e1('0x9')](_0xa1e1('0xd'),auth['isAuthenticated'](),controller[_0xa1e1('0xe')]);router['get'](_0xa1e1('0xf'),auth['isAuthenticated'](),controller[_0xa1e1('0x10')]);router['get'](_0xa1e1('0x11'),auth[_0xa1e1('0x12')](),controller[_0xa1e1('0x13')]);router['get'](_0xa1e1('0x14'),auth[_0xa1e1('0x12')](),controller[_0xa1e1('0x15')]);router['get'](_0xa1e1('0x16'),auth[_0xa1e1('0x12')](),controller[_0xa1e1('0x17')]);router['get']('/:id/blacklists',auth[_0xa1e1('0x12')](),controller['getBlackLists']);router[_0xa1e1('0x18')]('/',auth['isAuthenticated'](),controller[_0xa1e1('0x19')]);router[_0xa1e1('0x18')]('/:id/clone',auth['isAuthenticated'](),controller[_0xa1e1('0x1a')]);router['post'](_0xa1e1('0x16'),auth['isAuthenticated'](),controller[_0xa1e1('0x1b')]);router['post'](_0xa1e1('0x1c'),auth[_0xa1e1('0x12')](),controller['addBlackLists']);router[_0xa1e1('0x1d')]('/:id',auth[_0xa1e1('0x12')](),controller[_0xa1e1('0x1e')]);router[_0xa1e1('0x1f')](_0xa1e1('0xb'),auth[_0xa1e1('0x12')](),controller[_0xa1e1('0x20')]);router[_0xa1e1('0x1f')](_0xa1e1('0x16'),auth[_0xa1e1('0x12')](),controller[_0xa1e1('0x21')]);router[_0xa1e1('0x1f')](_0xa1e1('0x1c'),auth[_0xa1e1('0x12')](),controller[_0xa1e1('0x22')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.attributes.js b/server/api/cannedAnswer/cannedAnswer.attributes.js index 3d45a55..f84c15d 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 _0xaa21=['STRING','TEXT','getDataValue','exports'];(function(_0x1ddb21,_0x2c3404){var _0x547a7a=function(_0x252bbe){while(--_0x252bbe){_0x1ddb21['push'](_0x1ddb21['shift']());}};_0x547a7a(++_0x2c3404);}(_0xaa21,0x183));var _0x1aa2=function(_0x287c49,_0x1b4ef2){_0x287c49=_0x287c49-0x0;var _0x51cddb=_0xaa21[_0x287c49];return _0x51cddb;};'use strict';var Sequelize=require('sequelize');module[_0x1aa2('0x0')]={'key':{'type':Sequelize[_0x1aa2('0x1')],'allowNull':![]},'value':{'type':Sequelize[_0x1aa2('0x2')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'name':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x1aa2('0x3')]('key');}}}; \ No newline at end of file +var _0xcd78=['getDataValue','key','sequelize','exports','TEXT','STRING','VIRTUAL'];(function(_0x2a8122,_0xd957e){var _0x49a5c7=function(_0x12ab58){while(--_0x12ab58){_0x2a8122['push'](_0x2a8122['shift']());}};_0x49a5c7(++_0xd957e);}(_0xcd78,0x79));var _0x8cd7=function(_0x4fde1b,_0xd723f9){_0x4fde1b=_0x4fde1b-0x0;var _0x1364e5=_0xcd78[_0x4fde1b];return _0x1364e5;};'use strict';var Sequelize=require(_0x8cd7('0x0'));module[_0x8cd7('0x1')]={'key':{'type':Sequelize['STRING'],'allowNull':![]},'value':{'type':Sequelize[_0x8cd7('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x8cd7('0x3')]},'name':{'type':Sequelize[_0x8cd7('0x4')],'get':function(){return this[_0x8cd7('0x5')](_0x8cd7('0x6'));}}}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.controller.js b/server/api/cannedAnswer/cannedAnswer.controller.js index 788b5ea..f2fda09 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 _0x25a8=['querystring','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','count','limit','set','Content-Range','json','apply','reject','save','then','destroy','CannedAnswers','UserProfileResource','end','name','send','index','map','CannedAnswer','fieldName','type','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','sort','pick','filter','where','merge','options','includeAll','include','findAll','catch','show','params','keys','rawAttributes','length','find','update','body','create','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','Sequelize','ValidationError','The\x20inserted\x20key\x20already\x20exists.','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','crypto'];(function(_0x3f6b1b,_0x58d3d6){var _0x4a3d2b=function(_0x5648f0){while(--_0x5648f0){_0x3f6b1b['push'](_0x3f6b1b['shift']());}};_0x4a3d2b(++_0x58d3d6);}(_0x25a8,0x1aa));var _0x825a=function(_0x3a8c64,_0x3ad3bb){_0x3a8c64=_0x3a8c64-0x0;var _0xb72146=_0x25a8[_0x3a8c64];return _0xb72146;};'use strict';var emlformat=require(_0x825a('0x0'));var rimraf=require(_0x825a('0x1'));var zipdir=require(_0x825a('0x2'));var jsonpatch=require(_0x825a('0x3'));var rp=require(_0x825a('0x4'));var moment=require(_0x825a('0x5'));var BPromise=require(_0x825a('0x6'));var Mustache=require(_0x825a('0x7'));var util=require(_0x825a('0x8'));var path=require(_0x825a('0x9'));var sox=require(_0x825a('0xa'));var csv=require('to-csv');var ejs=require(_0x825a('0xb'));var fs=require('fs');var fs_extra=require(_0x825a('0xc'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x825a('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x825a('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x825a('0xf'));var qs=require(_0x825a('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x825a('0x11'));var logger=require(_0x825a('0x12'))(_0x825a('0x13'));var utils=require(_0x825a('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x825a('0x15'));var db=require(_0x825a('0x16'))['db'];function respondWithStatusCode(_0x15ab16,_0x4c75d6){_0x4c75d6=_0x4c75d6||0xcc;return function(_0xd09262){if(_0xd09262){return _0x15ab16[_0x825a('0x17')](_0x4c75d6);}return _0x15ab16[_0x825a('0x18')](_0x4c75d6)['end']();};}function respondWithResult(_0x4c6987,_0x27d37b){_0x27d37b=_0x27d37b||0xc8;return function(_0x15e689){if(_0x15e689){return _0x4c6987[_0x825a('0x18')](_0x27d37b)['json'](_0x15e689);}};}function respondWithFilteredResult(_0xde5d09,_0x689356){return function(_0x598ee2){if(_0x598ee2){var _0x64c780=typeof _0x689356[_0x825a('0x19')]==='undefined'&&typeof _0x689356['limit']===_0x825a('0x1a');var _0x4f3c80=_0x598ee2[_0x825a('0x1b')];var _0x166a98=_0x64c780?0x0:_0x689356[_0x825a('0x19')];var _0x48bd4f=_0x64c780?_0x598ee2[_0x825a('0x1b')]:_0x689356[_0x825a('0x19')]+_0x689356[_0x825a('0x1c')];var _0x42bbbe;if(_0x48bd4f>=_0x4f3c80){_0x48bd4f=_0x4f3c80;_0x42bbbe=0xc8;}else{_0x42bbbe=0xce;}_0xde5d09['status'](_0x42bbbe);return _0xde5d09[_0x825a('0x1d')](_0x825a('0x1e'),_0x166a98+'-'+_0x48bd4f+'/'+_0x4f3c80)[_0x825a('0x1f')](_0x598ee2);}return null;};}function patchUpdates(_0x4d3f3b){return function(_0x4123cb){try{jsonpatch[_0x825a('0x20')](_0x4123cb,_0x4d3f3b,!![]);}catch(_0x320636){return BPromise[_0x825a('0x21')](_0x320636);}return _0x4123cb[_0x825a('0x22')]();};}function saveUpdates(_0x1205b2,_0x2e4abe){return function(_0x4926c3){if(_0x4926c3){return _0x4926c3['update'](_0x1205b2)[_0x825a('0x23')](function(_0x26698a){return _0x26698a;});}return null;};}function removeEntity(_0x22bc99,_0x2b4be5){return function(_0x593ce4){if(_0x593ce4){return _0x593ce4[_0x825a('0x24')]()['then'](function(){var _0x2be7d0=_0x593ce4['get']({'plain':!![]});var _0x5871d8=_0x825a('0x25');return db[_0x825a('0x26')]['destroy']({'where':{'type':_0x5871d8,'resourceId':_0x2be7d0['id']}})[_0x825a('0x23')](function(){return _0x593ce4;});})[_0x825a('0x23')](function(){_0x22bc99[_0x825a('0x18')](0xcc)[_0x825a('0x27')]();});}};}function handleEntityNotFound(_0x16c055,_0x59fef0){return function(_0x2c904d){if(!_0x2c904d){_0x16c055[_0x825a('0x17')](0x194);}return _0x2c904d;};}function handleError(_0x2edafd,_0x29552d){_0x29552d=_0x29552d||0x1f4;return function(_0x1d044d){logger['error'](_0x1d044d['stack']);if(_0x1d044d['name']){delete _0x1d044d[_0x825a('0x28')];}_0x2edafd[_0x825a('0x18')](_0x29552d)[_0x825a('0x29')](_0x1d044d);};}exports[_0x825a('0x2a')]=function(_0x375135,_0x3f2aac){var _0x36551b={},_0x2f8c24={},_0x314732={'count':0x0,'rows':[]};var _0xefc2d4=_[_0x825a('0x2b')](db[_0x825a('0x2c')]['rawAttributes'],function(_0x28ccf8){return{'name':_0x28ccf8[_0x825a('0x2d')],'type':_0x28ccf8[_0x825a('0x2e')][_0x825a('0x2f')]};});_0x2f8c24[_0x825a('0x30')]=_[_0x825a('0x2b')](_0xefc2d4,_0x825a('0x28'));_0x2f8c24['query']=_['keys'](_0x375135[_0x825a('0x31')]);_0x2f8c24[_0x825a('0x32')]=_[_0x825a('0x33')](_0x2f8c24[_0x825a('0x30')],_0x2f8c24[_0x825a('0x31')]);_0x36551b[_0x825a('0x34')]=_[_0x825a('0x33')](_0x2f8c24[_0x825a('0x30')],qs[_0x825a('0x35')](_0x375135[_0x825a('0x31')][_0x825a('0x35')]));_0x36551b[_0x825a('0x34')]=_0x36551b[_0x825a('0x34')]['length']?_0x36551b['attributes']:_0x2f8c24[_0x825a('0x30')];if(!_0x375135[_0x825a('0x31')][_0x825a('0x36')]('nolimit')){_0x36551b[_0x825a('0x1c')]=qs[_0x825a('0x1c')](_0x375135[_0x825a('0x31')]['limit']);_0x36551b[_0x825a('0x19')]=qs['offset'](_0x375135[_0x825a('0x31')][_0x825a('0x19')]);}_0x36551b['order']=qs[_0x825a('0x37')](_0x375135['query'][_0x825a('0x37')]);_0x36551b['where']=qs[_0x825a('0x32')](_[_0x825a('0x38')](_0x375135[_0x825a('0x31')],_0x2f8c24['filters']),_0xefc2d4);if(_0x375135[_0x825a('0x31')][_0x825a('0x39')]){_0x36551b[_0x825a('0x3a')]=_['merge'](_0x36551b[_0x825a('0x3a')],{'$or':[{'key':{'$like':'%'+_0x375135[_0x825a('0x31')][_0x825a('0x39')]+'%'}},{'value':{'$like':'%'+_0x375135[_0x825a('0x31')][_0x825a('0x39')]+'%'}}]});}_0x36551b=_[_0x825a('0x3b')]({},_0x36551b,_0x375135[_0x825a('0x3c')]);var _0x57700c={'where':_0x36551b['where']};return db[_0x825a('0x2c')]['count'](_0x57700c)[_0x825a('0x23')](function(_0x49cbe3){_0x314732[_0x825a('0x1b')]=_0x49cbe3;if(_0x375135['query'][_0x825a('0x3d')]){_0x36551b[_0x825a('0x3e')]=[{'all':!![]}];}return db[_0x825a('0x2c')][_0x825a('0x3f')](_0x36551b);})[_0x825a('0x23')](function(_0x8df2b2){_0x314732['rows']=_0x8df2b2;return _0x314732;})[_0x825a('0x23')](respondWithFilteredResult(_0x3f2aac,_0x36551b))[_0x825a('0x40')](handleError(_0x3f2aac,null));};exports[_0x825a('0x41')]=function(_0x26f4b5,_0x373717){var _0x3cef05={'raw':!![],'where':{'id':_0x26f4b5[_0x825a('0x42')]['id']}},_0x52d022={};_0x52d022['model']=_[_0x825a('0x43')](db[_0x825a('0x2c')][_0x825a('0x44')]);_0x52d022[_0x825a('0x31')]=_[_0x825a('0x43')](_0x26f4b5[_0x825a('0x31')]);_0x52d022[_0x825a('0x32')]=_['intersection'](_0x52d022['model'],_0x52d022[_0x825a('0x31')]);_0x3cef05[_0x825a('0x34')]=_[_0x825a('0x33')](_0x52d022[_0x825a('0x30')],qs[_0x825a('0x35')](_0x26f4b5[_0x825a('0x31')][_0x825a('0x35')]));_0x3cef05[_0x825a('0x34')]=_0x3cef05[_0x825a('0x34')][_0x825a('0x45')]?_0x3cef05[_0x825a('0x34')]:_0x52d022[_0x825a('0x30')];if(_0x26f4b5[_0x825a('0x31')]['includeAll']){_0x3cef05[_0x825a('0x3e')]=[{'all':!![]}];}_0x3cef05=_[_0x825a('0x3b')]({},_0x3cef05,_0x26f4b5['options']);return db[_0x825a('0x2c')][_0x825a('0x46')](_0x3cef05)[_0x825a('0x23')](handleEntityNotFound(_0x373717,null))[_0x825a('0x23')](respondWithResult(_0x373717,null))[_0x825a('0x40')](handleError(_0x373717,null));};exports[_0x825a('0x47')]=function(_0x31ff15,_0x328b27){if(_0x31ff15[_0x825a('0x48')]['id']){delete _0x31ff15['body']['id'];}return db['CannedAnswer']['find']({'where':{'id':_0x31ff15[_0x825a('0x42')]['id']}})[_0x825a('0x23')](handleEntityNotFound(_0x328b27,null))['then'](saveUpdates(_0x31ff15[_0x825a('0x48')],null))[_0x825a('0x23')](respondWithResult(_0x328b27,null))['catch'](handleError(_0x328b27,null));};exports[_0x825a('0x24')]=function(_0x5b186e,_0x11429b){return db['CannedAnswer'][_0x825a('0x46')]({'where':{'id':_0x5b186e[_0x825a('0x42')]['id']}})[_0x825a('0x23')](handleEntityNotFound(_0x11429b,null))[_0x825a('0x23')](removeEntity(_0x11429b,null))[_0x825a('0x40')](handleError(_0x11429b,null));};exports[_0x825a('0x49')]=function(_0x136880,_0xfde2a8){var _0x1eb0ee={'key':_0x136880['body'][_0x825a('0x2f')]};if(_0x136880['body'][_0x825a('0x4a')]){_0x1eb0ee[_0x825a('0x4a')]=_0x136880['body'][_0x825a('0x4a')];}else if(_0x136880[_0x825a('0x48')][_0x825a('0x4b')]){_0x1eb0ee['SmsAccountId']=_0x136880[_0x825a('0x48')]['SmsAccountId'];}else if(_0x136880[_0x825a('0x48')][_0x825a('0x4c')]){_0x1eb0ee['OpenchannelAccountId']=_0x136880[_0x825a('0x48')][_0x825a('0x4c')];}else if(_0x136880[_0x825a('0x48')][_0x825a('0x4d')]){_0x1eb0ee[_0x825a('0x4d')]=_0x136880[_0x825a('0x48')][_0x825a('0x4d')];}return db[_0x825a('0x2c')][_0x825a('0x46')]({'where':_0x1eb0ee})[_0x825a('0x23')](function(_0x1e9565){if(_0x1e9565){throw new db[(_0x825a('0x4e'))][(_0x825a('0x4f'))](_0x825a('0x50'));}return db[_0x825a('0x2c')][_0x825a('0x49')](_0x136880[_0x825a('0x48')]);})[_0x825a('0x23')](function(_0x3c6349){var _0x2c183a=_0x136880[_0x825a('0x51')][_0x825a('0x52')]({'plain':!![]});if(!_0x2c183a)throw new Error(_0x825a('0x53'));if(_0x2c183a[_0x825a('0x54')]==='user'){var _0x34a7fe=_0x3c6349[_0x825a('0x52')]({'plain':!![]});return db[_0x825a('0x55')][_0x825a('0x46')]({'where':{'name':'CannedAnswers','userProfileId':_0x2c183a[_0x825a('0x56')]},'raw':!![]})[_0x825a('0x23')](function(_0x31afd){if(_0x31afd&&_0x31afd['autoAssociation']===0x0){return db[_0x825a('0x26')][_0x825a('0x49')]({'name':_0x34a7fe[_0x825a('0x28')],'resourceId':_0x34a7fe['id'],'type':_0x31afd[_0x825a('0x28')],'sectionId':_0x31afd['id']},{})[_0x825a('0x23')](function(){return _0x3c6349;});}else{return _0x3c6349;}})[_0x825a('0x40')](function(_0x4011c9){logger['error'](_0x825a('0x57'),_0x4011c9);throw _0x4011c9;});}return _0x3c6349;})[_0x825a('0x23')](respondWithResult(_0xfde2a8,0xc9))[_0x825a('0x40')](handleError(_0xfde2a8,null));}; \ No newline at end of file +var _0x69b0=['Content-Range','apply','reject','then','destroy','get','CannedAnswers','UserProfileResource','error','stack','name','send','index','map','CannedAnswer','rawAttributes','fieldName','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','options','includeAll','include','rows','catch','length','update','body','find','create','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','Sequelize','ValidationError','The\x20inserted\x20key\x20already\x20exists.','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','count','limit','set'];(function(_0x5376a2,_0x23e471){var _0x29a3a0=function(_0x12c5cb){while(--_0x12c5cb){_0x5376a2['push'](_0x5376a2['shift']());}};_0x29a3a0(++_0x23e471);}(_0x69b0,0x1a4));var _0x069b=function(_0x33593e,_0x22ddd3){_0x33593e=_0x33593e-0x0;var _0x53db1a=_0x69b0[_0x33593e];return _0x53db1a;};'use strict';var emlformat=require(_0x069b('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x069b('0x1'));var jsonpatch=require(_0x069b('0x2'));var rp=require(_0x069b('0x3'));var moment=require('moment');var BPromise=require(_0x069b('0x4'));var Mustache=require(_0x069b('0x5'));var util=require(_0x069b('0x6'));var path=require(_0x069b('0x7'));var sox=require(_0x069b('0x8'));var csv=require('to-csv');var ejs=require(_0x069b('0x9'));var fs=require('fs');var fs_extra=require(_0x069b('0xa'));var _=require(_0x069b('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x069b('0xc'));var deskjs=require(_0x069b('0xd'));var toCsv=require(_0x069b('0xe'));var querystring=require(_0x069b('0xf'));var Papa=require(_0x069b('0x10'));var Redis=require(_0x069b('0x11'));var authService=require(_0x069b('0x12'));var qs=require(_0x069b('0x13'));var as=require(_0x069b('0x14'));var hardwareService=require(_0x069b('0x15'));var logger=require(_0x069b('0x16'))(_0x069b('0x17'));var utils=require('../../config/utils');var config=require(_0x069b('0x18'));var licenseUtil=require(_0x069b('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x337571,_0x30ea84){_0x30ea84=_0x30ea84||0xcc;return function(_0xe96cd7){if(_0xe96cd7){return _0x337571[_0x069b('0x1a')](_0x30ea84);}return _0x337571[_0x069b('0x1b')](_0x30ea84)[_0x069b('0x1c')]();};}function respondWithResult(_0x33c045,_0x41f637){_0x41f637=_0x41f637||0xc8;return function(_0x1feb88){if(_0x1feb88){return _0x33c045[_0x069b('0x1b')](_0x41f637)[_0x069b('0x1d')](_0x1feb88);}};}function respondWithFilteredResult(_0x35adcf,_0x35e21e){return function(_0x5382dd){if(_0x5382dd){var _0x2e38b0=typeof _0x35e21e[_0x069b('0x1e')]===_0x069b('0x1f')&&typeof _0x35e21e['limit']===_0x069b('0x1f');var _0x523c31=_0x5382dd[_0x069b('0x20')];var _0x5e396a=_0x2e38b0?0x0:_0x35e21e[_0x069b('0x1e')];var _0xe48b55=_0x2e38b0?_0x5382dd['count']:_0x35e21e[_0x069b('0x1e')]+_0x35e21e[_0x069b('0x21')];var _0x7920f;if(_0xe48b55>=_0x523c31){_0xe48b55=_0x523c31;_0x7920f=0xc8;}else{_0x7920f=0xce;}_0x35adcf[_0x069b('0x1b')](_0x7920f);return _0x35adcf[_0x069b('0x22')](_0x069b('0x23'),_0x5e396a+'-'+_0xe48b55+'/'+_0x523c31)[_0x069b('0x1d')](_0x5382dd);}return null;};}function patchUpdates(_0x26733a){return function(_0x8b82f5){try{jsonpatch[_0x069b('0x24')](_0x8b82f5,_0x26733a,!![]);}catch(_0x437715){return BPromise[_0x069b('0x25')](_0x437715);}return _0x8b82f5['save']();};}function saveUpdates(_0x9ffba5,_0x69d307){return function(_0x452cce){if(_0x452cce){return _0x452cce['update'](_0x9ffba5)[_0x069b('0x26')](function(_0x4f74a5){return _0x4f74a5;});}return null;};}function removeEntity(_0x23da2b,_0x4bc3be){return function(_0x3819a8){if(_0x3819a8){return _0x3819a8[_0x069b('0x27')]()[_0x069b('0x26')](function(){var _0x3a8272=_0x3819a8[_0x069b('0x28')]({'plain':!![]});var _0x46e2e8=_0x069b('0x29');return db[_0x069b('0x2a')][_0x069b('0x27')]({'where':{'type':_0x46e2e8,'resourceId':_0x3a8272['id']}})[_0x069b('0x26')](function(){return _0x3819a8;});})[_0x069b('0x26')](function(){_0x23da2b['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x550321,_0x8cfcc4){return function(_0x487ac3){if(!_0x487ac3){_0x550321[_0x069b('0x1a')](0x194);}return _0x487ac3;};}function handleError(_0x3d726d,_0x4f0930){_0x4f0930=_0x4f0930||0x1f4;return function(_0x541540){logger[_0x069b('0x2b')](_0x541540[_0x069b('0x2c')]);if(_0x541540[_0x069b('0x2d')]){delete _0x541540[_0x069b('0x2d')];}_0x3d726d[_0x069b('0x1b')](_0x4f0930)[_0x069b('0x2e')](_0x541540);};}exports[_0x069b('0x2f')]=function(_0x233af5,_0x58c23f){var _0x1a4a1a={},_0x47c381={},_0x39c203={'count':0x0,'rows':[]};var _0x5e5f21=_[_0x069b('0x30')](db[_0x069b('0x31')][_0x069b('0x32')],function(_0x31c438){return{'name':_0x31c438[_0x069b('0x33')],'type':_0x31c438['type'][_0x069b('0x34')]};});_0x47c381[_0x069b('0x35')]=_[_0x069b('0x30')](_0x5e5f21,_0x069b('0x2d'));_0x47c381[_0x069b('0x36')]=_[_0x069b('0x37')](_0x233af5[_0x069b('0x36')]);_0x47c381['filters']=_[_0x069b('0x38')](_0x47c381[_0x069b('0x35')],_0x47c381[_0x069b('0x36')]);_0x1a4a1a[_0x069b('0x39')]=_[_0x069b('0x38')](_0x47c381['model'],qs[_0x069b('0x3a')](_0x233af5[_0x069b('0x36')][_0x069b('0x3a')]));_0x1a4a1a[_0x069b('0x39')]=_0x1a4a1a['attributes']['length']?_0x1a4a1a['attributes']:_0x47c381[_0x069b('0x35')];if(!_0x233af5[_0x069b('0x36')][_0x069b('0x3b')](_0x069b('0x3c'))){_0x1a4a1a[_0x069b('0x21')]=qs['limit'](_0x233af5[_0x069b('0x36')][_0x069b('0x21')]);_0x1a4a1a[_0x069b('0x1e')]=qs[_0x069b('0x1e')](_0x233af5[_0x069b('0x36')][_0x069b('0x1e')]);}_0x1a4a1a[_0x069b('0x3d')]=qs[_0x069b('0x3e')](_0x233af5[_0x069b('0x36')][_0x069b('0x3e')]);_0x1a4a1a[_0x069b('0x3f')]=qs[_0x069b('0x40')](_[_0x069b('0x41')](_0x233af5['query'],_0x47c381['filters']),_0x5e5f21);if(_0x233af5['query'][_0x069b('0x42')]){_0x1a4a1a[_0x069b('0x3f')]=_[_0x069b('0x43')](_0x1a4a1a[_0x069b('0x3f')],{'$or':[{'key':{'$like':'%'+_0x233af5[_0x069b('0x36')]['filter']+'%'}},{'value':{'$like':'%'+_0x233af5['query']['filter']+'%'}}]});}_0x1a4a1a=_[_0x069b('0x43')]({},_0x1a4a1a,_0x233af5[_0x069b('0x44')]);var _0x58da57={'where':_0x1a4a1a[_0x069b('0x3f')]};return db[_0x069b('0x31')][_0x069b('0x20')](_0x58da57)[_0x069b('0x26')](function(_0x46d567){_0x39c203[_0x069b('0x20')]=_0x46d567;if(_0x233af5['query'][_0x069b('0x45')]){_0x1a4a1a[_0x069b('0x46')]=[{'all':!![]}];}return db[_0x069b('0x31')]['findAll'](_0x1a4a1a);})[_0x069b('0x26')](function(_0x491661){_0x39c203[_0x069b('0x47')]=_0x491661;return _0x39c203;})[_0x069b('0x26')](respondWithFilteredResult(_0x58c23f,_0x1a4a1a))[_0x069b('0x48')](handleError(_0x58c23f,null));};exports['show']=function(_0x59d7ca,_0x30b07c){var _0x37f528={'raw':!![],'where':{'id':_0x59d7ca['params']['id']}},_0x3a243b={};_0x3a243b['model']=_[_0x069b('0x37')](db['CannedAnswer'][_0x069b('0x32')]);_0x3a243b['query']=_[_0x069b('0x37')](_0x59d7ca[_0x069b('0x36')]);_0x3a243b[_0x069b('0x40')]=_[_0x069b('0x38')](_0x3a243b[_0x069b('0x35')],_0x3a243b[_0x069b('0x36')]);_0x37f528[_0x069b('0x39')]=_[_0x069b('0x38')](_0x3a243b[_0x069b('0x35')],qs[_0x069b('0x3a')](_0x59d7ca[_0x069b('0x36')]['fields']));_0x37f528[_0x069b('0x39')]=_0x37f528[_0x069b('0x39')][_0x069b('0x49')]?_0x37f528[_0x069b('0x39')]:_0x3a243b['model'];if(_0x59d7ca[_0x069b('0x36')]['includeAll']){_0x37f528[_0x069b('0x46')]=[{'all':!![]}];}_0x37f528=_[_0x069b('0x43')]({},_0x37f528,_0x59d7ca[_0x069b('0x44')]);return db[_0x069b('0x31')]['find'](_0x37f528)[_0x069b('0x26')](handleEntityNotFound(_0x30b07c,null))[_0x069b('0x26')](respondWithResult(_0x30b07c,null))['catch'](handleError(_0x30b07c,null));};exports[_0x069b('0x4a')]=function(_0x3622ac,_0x21b6ea){if(_0x3622ac[_0x069b('0x4b')]['id']){delete _0x3622ac[_0x069b('0x4b')]['id'];}return db['CannedAnswer'][_0x069b('0x4c')]({'where':{'id':_0x3622ac['params']['id']}})[_0x069b('0x26')](handleEntityNotFound(_0x21b6ea,null))[_0x069b('0x26')](saveUpdates(_0x3622ac[_0x069b('0x4b')],null))['then'](respondWithResult(_0x21b6ea,null))[_0x069b('0x48')](handleError(_0x21b6ea,null));};exports[_0x069b('0x27')]=function(_0x25312c,_0x53f1b1){return db[_0x069b('0x31')][_0x069b('0x4c')]({'where':{'id':_0x25312c['params']['id']}})['then'](handleEntityNotFound(_0x53f1b1,null))[_0x069b('0x26')](removeEntity(_0x53f1b1,null))[_0x069b('0x48')](handleError(_0x53f1b1,null));};exports[_0x069b('0x4d')]=function(_0xae4320,_0x4e5371){var _0xae7f40={'key':_0xae4320[_0x069b('0x4b')]['key']};if(_0xae4320[_0x069b('0x4b')][_0x069b('0x4e')]){_0xae7f40[_0x069b('0x4e')]=_0xae4320['body'][_0x069b('0x4e')];}else if(_0xae4320[_0x069b('0x4b')][_0x069b('0x4f')]){_0xae7f40[_0x069b('0x4f')]=_0xae4320['body']['SmsAccountId'];}else if(_0xae4320['body'][_0x069b('0x50')]){_0xae7f40[_0x069b('0x50')]=_0xae4320['body'][_0x069b('0x50')];}else if(_0xae4320['body'][_0x069b('0x51')]){_0xae7f40[_0x069b('0x51')]=_0xae4320[_0x069b('0x4b')][_0x069b('0x51')];}return db[_0x069b('0x31')]['find']({'where':_0xae7f40})[_0x069b('0x26')](function(_0x4f1889){if(_0x4f1889){throw new db[(_0x069b('0x52'))][(_0x069b('0x53'))](_0x069b('0x54'));}return db[_0x069b('0x31')][_0x069b('0x4d')](_0xae4320[_0x069b('0x4b')]);})['then'](function(_0x1010a1){var _0x21fd20=_0xae4320['user'][_0x069b('0x28')]({'plain':!![]});if(!_0x21fd20)throw new Error(_0x069b('0x55'));if(_0x21fd20[_0x069b('0x56')]===_0x069b('0x57')){var _0x59465d=_0x1010a1[_0x069b('0x28')]({'plain':!![]});return db[_0x069b('0x58')][_0x069b('0x4c')]({'where':{'name':_0x069b('0x29'),'userProfileId':_0x21fd20[_0x069b('0x59')]},'raw':!![]})[_0x069b('0x26')](function(_0x45e770){if(_0x45e770&&_0x45e770[_0x069b('0x5a')]===0x0){return db[_0x069b('0x2a')][_0x069b('0x4d')]({'name':_0x59465d[_0x069b('0x2d')],'resourceId':_0x59465d['id'],'type':_0x45e770[_0x069b('0x2d')],'sectionId':_0x45e770['id']},{})['then'](function(){return _0x1010a1;});}else{return _0x1010a1;}})[_0x069b('0x48')](function(_0x3a2f1f){logger[_0x069b('0x2b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3a2f1f);throw _0x3a2f1f;});}return _0x1010a1;})[_0x069b('0x26')](respondWithResult(_0x4e5371,0xc9))[_0x069b('0x48')](handleError(_0x4e5371,null));}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.model.js b/server/api/cannedAnswer/cannedAnswer.model.js index 2643969..f4bb88e 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 _0x68c9=['utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','./cannedAnswer.attributes','define'];(function(_0x4a3da6,_0x16e828){var _0x1d37da=function(_0xa9fb47){while(--_0xa9fb47){_0x4a3da6['push'](_0x4a3da6['shift']());}};_0x1d37da(++_0x16e828);}(_0x68c9,0x18e));var _0x968c=function(_0x4d48b1,_0x4bded7){_0x4d48b1=_0x4d48b1-0x0;var _0x2e2280=_0x68c9[_0x4d48b1];return _0x2e2280;};'use strict';var _=require(_0x968c('0x0'));var util=require(_0x968c('0x1'));var logger=require(_0x968c('0x2'))(_0x968c('0x3'));var moment=require(_0x968c('0x4'));var BPromise=require('bluebird');var rp=require(_0x968c('0x5'));var fs=require('fs');var path=require(_0x968c('0x6'));var rimraf=require(_0x968c('0x7'));var config=require('../../config/environment');var attributes=require(_0x968c('0x8'));module['exports']=function(_0x19484f,_0x2d692d){return _0x19484f[_0x968c('0x9')]('CannedAnswer',attributes,{'tableName':'tools_canned_answers','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x968c('0xa'),'collate':_0x968c('0xb')});}; \ No newline at end of file +var _0x6b0e=['./cannedAnswer.attributes','exports','tools_canned_answers','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','request-promise','path','../../config/environment'];(function(_0x48326a,_0x8cfa0c){var _0x466709=function(_0x5ab1b7){while(--_0x5ab1b7){_0x48326a['push'](_0x48326a['shift']());}};_0x466709(++_0x8cfa0c);}(_0x6b0e,0x185));var _0xe6b0=function(_0x1e851f,_0x1c7630){_0x1e851f=_0x1e851f-0x0;var _0x4c3e02=_0x6b0e[_0x1e851f];return _0x4c3e02;};'use strict';var _=require(_0xe6b0('0x0'));var util=require(_0xe6b0('0x1'));var logger=require(_0xe6b0('0x2'))('api');var moment=require(_0xe6b0('0x3'));var BPromise=require('bluebird');var rp=require(_0xe6b0('0x4'));var fs=require('fs');var path=require(_0xe6b0('0x5'));var rimraf=require('rimraf');var config=require(_0xe6b0('0x6'));var attributes=require(_0xe6b0('0x7'));module[_0xe6b0('0x8')]=function(_0x2eb83e,_0x1eb26c){return _0x2eb83e['define']('CannedAnswer',attributes,{'tableName':_0xe6b0('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xe6b0('0xa'),'collate':_0xe6b0('0xb')});}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.rpc.js b/server/api/cannedAnswer/cannedAnswer.rpc.js index 2cecb81..c1c7e68 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(_0x4465a9,_0x918ca0){var _0x585b2c=function(_0x52ec58){while(--_0x52ec58){_0x4465a9['push'](_0x4465a9['shift']());}};_0x585b2c(++_0x918ca0);}(_0xa9e0,0x123));var _0x0a9e=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xa9e0[_0x19e35c];return _0x3e1fe8;};'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(_0x37545f,_0x4cfc2f){var _0x1d19be=function(_0x50178c){while(--_0x50178c){_0x37545f['push'](_0x37545f['shift']());}};_0x1d19be(++_0x4cfc2f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4fc9e6,_0xc51915){_0x4fc9e6=_0x4fc9e6-0x0;var _0x551d28=_0xa9e0[_0x4fc9e6];return _0x551d28;};'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 a5f40e9..39cd44d 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 _0x4909=['show','create','put','/:id','update','delete','destroy','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./cannedAnswer.controller','get','isAuthenticated','index'];(function(_0x4dd42e,_0x4f109b){var _0x4d78b0=function(_0x3a9a93){while(--_0x3a9a93){_0x4dd42e['push'](_0x4dd42e['shift']());}};_0x4d78b0(++_0x4f109b);}(_0x4909,0x1a9));var _0x9490=function(_0x2e1907,_0x229a70){_0x2e1907=_0x2e1907-0x0;var _0x401555=_0x4909[_0x2e1907];return _0x401555;};'use strict';var multer=require(_0x9490('0x0'));var util=require(_0x9490('0x1'));var path=require(_0x9490('0x2'));var timeout=require(_0x9490('0x3'));var express=require(_0x9490('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x9490('0x5'));var interaction=require(_0x9490('0x6'));var config=require(_0x9490('0x7'));var controller=require(_0x9490('0x8'));router[_0x9490('0x9')]('/',auth[_0x9490('0xa')](),controller[_0x9490('0xb')]);router[_0x9490('0x9')]('/:id',auth['isAuthenticated'](),controller[_0x9490('0xc')]);router['post']('/',auth[_0x9490('0xa')](),controller[_0x9490('0xd')]);router[_0x9490('0xe')](_0x9490('0xf'),auth[_0x9490('0xa')](),controller[_0x9490('0x10')]);router[_0x9490('0x11')](_0x9490('0xf'),auth['isAuthenticated'](),controller[_0x9490('0x12')]);module['exports']=router; \ No newline at end of file +var _0xe879=['update','exports','multer','util','path','express','fs-extra','../../components/interaction/service','../../config/environment','isAuthenticated','index','/:id','post','create','put'];(function(_0x55af25,_0x2d0b4a){var _0x5d94ad=function(_0x1090c6){while(--_0x1090c6){_0x55af25['push'](_0x55af25['shift']());}};_0x5d94ad(++_0x2d0b4a);}(_0xe879,0xf2));var _0x9e87=function(_0x197fde,_0x175d73){_0x197fde=_0x197fde-0x0;var _0x4fe854=_0xe879[_0x197fde];return _0x4fe854;};'use strict';var multer=require(_0x9e87('0x0'));var util=require(_0x9e87('0x1'));var path=require(_0x9e87('0x2'));var timeout=require('connect-timeout');var express=require(_0x9e87('0x3'));var router=express['Router']();var fs_extra=require(_0x9e87('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x9e87('0x5'));var config=require(_0x9e87('0x6'));var controller=require('./cannedAnswer.controller');router['get']('/',auth[_0x9e87('0x7')](),controller[_0x9e87('0x8')]);router['get'](_0x9e87('0x9'),auth[_0x9e87('0x7')](),controller['show']);router[_0x9e87('0xa')]('/',auth['isAuthenticated'](),controller[_0x9e87('0xb')]);router[_0x9e87('0xc')](_0x9e87('0x9'),auth['isAuthenticated'](),controller[_0x9e87('0xd')]);router['delete'](_0x9e87('0x9'),auth[_0x9e87('0x7')](),controller['destroy']);module[_0x9e87('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 833133d..abb30dc 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 _0x938c=['STRING','INTEGER','sequelize','exports','1970-01-01\x2000:00:01'];(function(_0x304ec3,_0x22a58c){var _0x36ccfb=function(_0x20a4ac){while(--_0x20a4ac){_0x304ec3['push'](_0x304ec3['shift']());}};_0x36ccfb(++_0x22a58c);}(_0x938c,0x11f));var _0xc938=function(_0x839358,_0x57c52d){_0x839358=_0x839358-0x0;var _0x2de1cb=_0x938c[_0x839358];return _0x2de1cb;};'use strict';var Sequelize=require(_0xc938('0x0'));module[_0xc938('0x1')]={'calldate':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':_0xc938('0x2')},'clid':{'type':Sequelize['STRING']},'src':{'type':Sequelize['STRING']},'dst':{'type':Sequelize[_0xc938('0x3')]},'dcontext':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0xc938('0x3')]},'dstchannel':{'type':Sequelize[_0xc938('0x3')]},'lastapp':{'type':Sequelize[_0xc938('0x3')]},'lastdata':{'type':Sequelize[_0xc938('0x3')]},'duration':{'type':Sequelize[_0xc938('0x4')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0xc938('0x4')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize['STRING']},'amaflags':{'type':Sequelize[_0xc938('0x4')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0xc938('0x3')]},'userfield':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0xc938('0x3')]},'linkedid':{'type':Sequelize[_0xc938('0x3')]},'sequence':{'type':Sequelize['STRING']},'peeraccount':{'type':Sequelize[_0xc938('0x3')]},'type':{'type':Sequelize['STRING']},'tag':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xd87e=['STRING','INTEGER','sequelize','exports','1970-01-01\x2000:00:01'];(function(_0x284235,_0x3c1a25){var _0x18d480=function(_0x51dd17){while(--_0x51dd17){_0x284235['push'](_0x284235['shift']());}};_0x18d480(++_0x3c1a25);}(_0xd87e,0x1bf));var _0xed87=function(_0x1ef726,_0x16fdea){_0x1ef726=_0x1ef726-0x0;var _0x4c3c66=_0xd87e[_0x1ef726];return _0x4c3c66;};'use strict';var Sequelize=require(_0xed87('0x0'));module[_0xed87('0x1')]={'calldate':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':_0xed87('0x2')},'clid':{'type':Sequelize[_0xed87('0x3')]},'src':{'type':Sequelize[_0xed87('0x3')]},'dst':{'type':Sequelize['STRING']},'dcontext':{'type':Sequelize[_0xed87('0x3')]},'channel':{'type':Sequelize['STRING']},'dstchannel':{'type':Sequelize[_0xed87('0x3')]},'lastapp':{'type':Sequelize[_0xed87('0x3')]},'lastdata':{'type':Sequelize['STRING']},'duration':{'type':Sequelize[_0xed87('0x4')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize['STRING']},'amaflags':{'type':Sequelize[_0xed87('0x4')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0xed87('0x3')]},'userfield':{'type':Sequelize[_0xed87('0x3')]},'uniqueid':{'type':Sequelize[_0xed87('0x3')]},'linkedid':{'type':Sequelize['STRING']},'sequence':{'type':Sequelize[_0xed87('0x3')]},'peeraccount':{'type':Sequelize[_0xed87('0x3')]},'type':{'type':Sequelize[_0xed87('0x3')]},'tag':{'type':Sequelize[_0xed87('0x3')]}}; \ No newline at end of file diff --git a/server/api/cdr/cdr.controller.js b/server/api/cdr/cdr.controller.js index 134422d..88b4b18 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 _0x1c9a=['status','end','json','offset','limit','undefined','count','Content-Range','apply','reject','save','then','error','stack','name','send','index','map','Cdr','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','pick','filter','where','merge','options','includeAll','show','params','find','catch','create','update','body','destroy','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus'];(function(_0x13197f,_0x1a2d35){var _0x5ed097=function(_0x483eec){while(--_0x483eec){_0x13197f['push'](_0x13197f['shift']());}};_0x5ed097(++_0x1a2d35);}(_0x1c9a,0x1a7));var _0xa1c9=function(_0x3372ec,_0x2405f6){_0x3372ec=_0x3372ec-0x0;var _0x4eec8c=_0x1c9a[_0x3372ec];return _0x4eec8c;};'use strict';var emlformat=require(_0xa1c9('0x0'));var rimraf=require(_0xa1c9('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa1c9('0x2'));var rp=require(_0xa1c9('0x3'));var moment=require(_0xa1c9('0x4'));var BPromise=require(_0xa1c9('0x5'));var Mustache=require(_0xa1c9('0x6'));var util=require('util');var path=require(_0xa1c9('0x7'));var sox=require('sox');var csv=require(_0xa1c9('0x8'));var ejs=require(_0xa1c9('0x9'));var fs=require('fs');var fs_extra=require(_0xa1c9('0xa'));var _=require(_0xa1c9('0xb'));var squel=require(_0xa1c9('0xc'));var crypto=require(_0xa1c9('0xd'));var jsforce=require(_0xa1c9('0xe'));var deskjs=require(_0xa1c9('0xf'));var toCsv=require(_0xa1c9('0x8'));var querystring=require(_0xa1c9('0x10'));var Papa=require(_0xa1c9('0x11'));var Redis=require(_0xa1c9('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xa1c9('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa1c9('0x14'))(_0xa1c9('0x15'));var utils=require(_0xa1c9('0x16'));var config=require(_0xa1c9('0x17'));var licenseUtil=require(_0xa1c9('0x18'));var db=require(_0xa1c9('0x19'))['db'];function respondWithStatusCode(_0x390bd3,_0x1b0149){_0x1b0149=_0x1b0149||0xcc;return function(_0x33191d){if(_0x33191d){return _0x390bd3[_0xa1c9('0x1a')](_0x1b0149);}return _0x390bd3[_0xa1c9('0x1b')](_0x1b0149)[_0xa1c9('0x1c')]();};}function respondWithResult(_0x409dcc,_0x9df889){_0x9df889=_0x9df889||0xc8;return function(_0x33aaa8){if(_0x33aaa8){return _0x409dcc[_0xa1c9('0x1b')](_0x9df889)[_0xa1c9('0x1d')](_0x33aaa8);}};}function respondWithFilteredResult(_0x275059,_0x3f16d6){return function(_0x3f4131){if(_0x3f4131){var _0x59463b=typeof _0x3f16d6[_0xa1c9('0x1e')]==='undefined'&&typeof _0x3f16d6[_0xa1c9('0x1f')]===_0xa1c9('0x20');var _0x3f244b=_0x3f4131[_0xa1c9('0x21')];var _0x13086a=_0x59463b?0x0:_0x3f16d6[_0xa1c9('0x1e')];var _0x223932=_0x59463b?_0x3f4131[_0xa1c9('0x21')]:_0x3f16d6[_0xa1c9('0x1e')]+_0x3f16d6[_0xa1c9('0x1f')];var _0x278ba6;if(_0x223932>=_0x3f244b){_0x223932=_0x3f244b;_0x278ba6=0xc8;}else{_0x278ba6=0xce;}_0x275059[_0xa1c9('0x1b')](_0x278ba6);return _0x275059['set'](_0xa1c9('0x22'),_0x13086a+'-'+_0x223932+'/'+_0x3f244b)[_0xa1c9('0x1d')](_0x3f4131);}return null;};}function patchUpdates(_0x5d0599){return function(_0x1cc3c9){try{jsonpatch[_0xa1c9('0x23')](_0x1cc3c9,_0x5d0599,!![]);}catch(_0x22031f){return BPromise[_0xa1c9('0x24')](_0x22031f);}return _0x1cc3c9[_0xa1c9('0x25')]();};}function saveUpdates(_0x58ac15,_0x3c2b40){return function(_0x2acfb7){if(_0x2acfb7){return _0x2acfb7['update'](_0x58ac15)[_0xa1c9('0x26')](function(_0x23e18e){return _0x23e18e;});}return null;};}function removeEntity(_0x33b4ae,_0x25418a){return function(_0x168c19){if(_0x168c19){return _0x168c19['destroy']()[_0xa1c9('0x26')](function(){_0x33b4ae[_0xa1c9('0x1b')](0xcc)[_0xa1c9('0x1c')]();});}};}function handleEntityNotFound(_0x484a6b,_0x1fa411){return function(_0x37da08){if(!_0x37da08){_0x484a6b[_0xa1c9('0x1a')](0x194);}return _0x37da08;};}function handleError(_0x401380,_0x1575cc){_0x1575cc=_0x1575cc||0x1f4;return function(_0x339dee){logger[_0xa1c9('0x27')](_0x339dee[_0xa1c9('0x28')]);if(_0x339dee[_0xa1c9('0x29')]){delete _0x339dee[_0xa1c9('0x29')];}_0x401380[_0xa1c9('0x1b')](_0x1575cc)[_0xa1c9('0x2a')](_0x339dee);};}exports[_0xa1c9('0x2b')]=function(_0x3f43f1,_0x35cea){var _0xf584e2={},_0x568996={},_0x603beb={'count':0x0,'rows':[]};var _0x429f3d=_[_0xa1c9('0x2c')](db[_0xa1c9('0x2d')][_0xa1c9('0x2e')],function(_0x4c6dd4){return{'name':_0x4c6dd4[_0xa1c9('0x2f')],'type':_0x4c6dd4[_0xa1c9('0x30')]['key']};});_0x568996[_0xa1c9('0x31')]=_[_0xa1c9('0x2c')](_0x429f3d,_0xa1c9('0x29'));_0x568996[_0xa1c9('0x32')]=_[_0xa1c9('0x33')](_0x3f43f1[_0xa1c9('0x32')]);_0x568996[_0xa1c9('0x34')]=_[_0xa1c9('0x35')](_0x568996[_0xa1c9('0x31')],_0x568996[_0xa1c9('0x32')]);_0xf584e2[_0xa1c9('0x36')]=_[_0xa1c9('0x35')](_0x568996[_0xa1c9('0x31')],qs[_0xa1c9('0x37')](_0x3f43f1[_0xa1c9('0x32')]['fields']));_0xf584e2[_0xa1c9('0x36')]=_0xf584e2[_0xa1c9('0x36')][_0xa1c9('0x38')]?_0xf584e2[_0xa1c9('0x36')]:_0x568996['model'];if(!_0x3f43f1[_0xa1c9('0x32')][_0xa1c9('0x39')]('nolimit')){_0xf584e2['limit']=qs[_0xa1c9('0x1f')](_0x3f43f1[_0xa1c9('0x32')][_0xa1c9('0x1f')]);_0xf584e2[_0xa1c9('0x1e')]=qs[_0xa1c9('0x1e')](_0x3f43f1[_0xa1c9('0x32')][_0xa1c9('0x1e')]);}_0xf584e2[_0xa1c9('0x3a')]=qs[_0xa1c9('0x3b')](_0x3f43f1[_0xa1c9('0x32')][_0xa1c9('0x3b')]);_0xf584e2['where']=qs[_0xa1c9('0x34')](_[_0xa1c9('0x3c')](_0x3f43f1[_0xa1c9('0x32')],_0x568996[_0xa1c9('0x34')]),_0x429f3d);if(_0x3f43f1[_0xa1c9('0x32')][_0xa1c9('0x3d')]){_0xf584e2[_0xa1c9('0x3e')]=_[_0xa1c9('0x3f')](_0xf584e2['where'],{'$or':_[_0xa1c9('0x2c')](_0x429f3d,function(_0x15d6b2){if(_0x15d6b2[_0xa1c9('0x30')]!=='VIRTUAL'){var _0x211853={};_0x211853[_0x15d6b2[_0xa1c9('0x29')]]={'$like':'%'+_0x3f43f1[_0xa1c9('0x32')][_0xa1c9('0x3d')]+'%'};return _0x211853;}})});}_0xf584e2=_[_0xa1c9('0x3f')]({},_0xf584e2,_0x3f43f1[_0xa1c9('0x40')]);var _0x32502b={'where':_0xf584e2['where']};return db[_0xa1c9('0x2d')]['count'](_0x32502b)[_0xa1c9('0x26')](function(_0x4c1a9e){_0x603beb[_0xa1c9('0x21')]=_0x4c1a9e;if(_0x3f43f1[_0xa1c9('0x32')][_0xa1c9('0x41')]){_0xf584e2['include']=[{'all':!![]}];}return db[_0xa1c9('0x2d')]['findAll'](_0xf584e2);})[_0xa1c9('0x26')](function(_0x57ed69){_0x603beb['rows']=_0x57ed69;return _0x603beb;})[_0xa1c9('0x26')](respondWithFilteredResult(_0x35cea,_0xf584e2))['catch'](handleError(_0x35cea,null));};exports[_0xa1c9('0x42')]=function(_0x525833,_0x550872){var _0x45a528={'raw':!![],'where':{'id':_0x525833[_0xa1c9('0x43')]['id']}},_0x418e95={};_0x418e95[_0xa1c9('0x31')]=_['keys'](db[_0xa1c9('0x2d')]['rawAttributes']);_0x418e95[_0xa1c9('0x32')]=_[_0xa1c9('0x33')](_0x525833[_0xa1c9('0x32')]);_0x418e95[_0xa1c9('0x34')]=_[_0xa1c9('0x35')](_0x418e95[_0xa1c9('0x31')],_0x418e95[_0xa1c9('0x32')]);_0x45a528[_0xa1c9('0x36')]=_[_0xa1c9('0x35')](_0x418e95[_0xa1c9('0x31')],qs['fields'](_0x525833[_0xa1c9('0x32')][_0xa1c9('0x37')]));_0x45a528[_0xa1c9('0x36')]=_0x45a528[_0xa1c9('0x36')][_0xa1c9('0x38')]?_0x45a528[_0xa1c9('0x36')]:_0x418e95[_0xa1c9('0x31')];if(_0x525833[_0xa1c9('0x32')][_0xa1c9('0x41')]){_0x45a528['include']=[{'all':!![]}];}_0x45a528=_[_0xa1c9('0x3f')]({},_0x45a528,_0x525833[_0xa1c9('0x40')]);return db['Cdr'][_0xa1c9('0x44')](_0x45a528)[_0xa1c9('0x26')](handleEntityNotFound(_0x550872,null))['then'](respondWithResult(_0x550872,null))[_0xa1c9('0x45')](handleError(_0x550872,null));};exports[_0xa1c9('0x46')]=function(_0x468894,_0x222d0c){return db['Cdr'][_0xa1c9('0x46')](_0x468894['body'],{})[_0xa1c9('0x26')](respondWithResult(_0x222d0c,0xc9))['catch'](handleError(_0x222d0c,null));};exports[_0xa1c9('0x47')]=function(_0x1c5317,_0x6d28a1){if(_0x1c5317[_0xa1c9('0x48')]['id']){delete _0x1c5317[_0xa1c9('0x48')]['id'];}return db[_0xa1c9('0x2d')][_0xa1c9('0x44')]({'where':{'id':_0x1c5317[_0xa1c9('0x43')]['id']}})[_0xa1c9('0x26')](handleEntityNotFound(_0x6d28a1,null))[_0xa1c9('0x26')](saveUpdates(_0x1c5317[_0xa1c9('0x48')],null))[_0xa1c9('0x26')](respondWithResult(_0x6d28a1,null))[_0xa1c9('0x45')](handleError(_0x6d28a1,null));};exports[_0xa1c9('0x49')]=function(_0x2774d3,_0x4e8cd2){return db[_0xa1c9('0x2d')][_0xa1c9('0x44')]({'where':{'id':_0x2774d3[_0xa1c9('0x43')]['id']}})[_0xa1c9('0x26')](handleEntityNotFound(_0x4e8cd2,null))['then'](removeEntity(_0x4e8cd2,null))[_0xa1c9('0x45')](handleError(_0x4e8cd2,null));};exports[_0xa1c9('0x4a')]=function(_0x2cfba4,_0xef1290){return db['Cdr'][_0xa1c9('0x4a')]()[_0xa1c9('0x26')](respondWithResult(_0xef1290,null))[_0xa1c9('0x45')](handleError(_0xef1290,null));}; \ No newline at end of file +var _0x5577=['../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','limit','count','offset','set','Content-Range','apply','reject','then','destroy','stack','name','send','Cdr','rawAttributes','fieldName','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','type','VIRTUAL','merge','options','includeAll','include','rows','show','find','catch','create','body','update','params','describe','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment'];(function(_0x4dea4e,_0xc1a71b){var _0xca799d=function(_0x5bc9fb){while(--_0x5bc9fb){_0x4dea4e['push'](_0x4dea4e['shift']());}};_0xca799d(++_0xc1a71b);}(_0x5577,0x1b4));var _0x7557=function(_0x21cb5f,_0x2aa2bd){_0x21cb5f=_0x21cb5f-0x0;var _0x394180=_0x5577[_0x21cb5f];return _0x394180;};'use strict';var emlformat=require(_0x7557('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x7557('0x1'));var jsonpatch=require(_0x7557('0x2'));var rp=require('request-promise');var moment=require(_0x7557('0x3'));var BPromise=require(_0x7557('0x4'));var Mustache=require(_0x7557('0x5'));var util=require(_0x7557('0x6'));var path=require(_0x7557('0x7'));var sox=require(_0x7557('0x8'));var csv=require('to-csv');var ejs=require(_0x7557('0x9'));var fs=require('fs');var fs_extra=require(_0x7557('0xa'));var _=require(_0x7557('0xb'));var squel=require(_0x7557('0xc'));var crypto=require(_0x7557('0xd'));var jsforce=require(_0x7557('0xe'));var deskjs=require(_0x7557('0xf'));var toCsv=require(_0x7557('0x10'));var querystring=require(_0x7557('0x11'));var Papa=require(_0x7557('0x12'));var Redis=require(_0x7557('0x13'));var authService=require(_0x7557('0x14'));var qs=require(_0x7557('0x15'));var as=require(_0x7557('0x16'));var hardwareService=require(_0x7557('0x17'));var logger=require('../../config/logger')('api');var utils=require(_0x7557('0x18'));var config=require(_0x7557('0x19'));var licenseUtil=require(_0x7557('0x1a'));var db=require(_0x7557('0x1b'))['db'];function respondWithStatusCode(_0xb6ed30,_0x467ac5){_0x467ac5=_0x467ac5||0xcc;return function(_0x156ac1){if(_0x156ac1){return _0xb6ed30[_0x7557('0x1c')](_0x467ac5);}return _0xb6ed30[_0x7557('0x1d')](_0x467ac5)[_0x7557('0x1e')]();};}function respondWithResult(_0x5468df,_0x276031){_0x276031=_0x276031||0xc8;return function(_0x3fb7a6){if(_0x3fb7a6){return _0x5468df[_0x7557('0x1d')](_0x276031)['json'](_0x3fb7a6);}};}function respondWithFilteredResult(_0x3ad3a1,_0x3c3953){return function(_0x33098f){if(_0x33098f){var _0x325849=typeof _0x3c3953['offset']===_0x7557('0x1f')&&typeof _0x3c3953[_0x7557('0x20')]==='undefined';var _0x4a9cae=_0x33098f[_0x7557('0x21')];var _0x11f186=_0x325849?0x0:_0x3c3953[_0x7557('0x22')];var _0x40a81b=_0x325849?_0x33098f['count']:_0x3c3953[_0x7557('0x22')]+_0x3c3953['limit'];var _0x3e2972;if(_0x40a81b>=_0x4a9cae){_0x40a81b=_0x4a9cae;_0x3e2972=0xc8;}else{_0x3e2972=0xce;}_0x3ad3a1[_0x7557('0x1d')](_0x3e2972);return _0x3ad3a1[_0x7557('0x23')](_0x7557('0x24'),_0x11f186+'-'+_0x40a81b+'/'+_0x4a9cae)['json'](_0x33098f);}return null;};}function patchUpdates(_0x1b60a9){return function(_0x3180cd){try{jsonpatch[_0x7557('0x25')](_0x3180cd,_0x1b60a9,!![]);}catch(_0x34bed5){return BPromise[_0x7557('0x26')](_0x34bed5);}return _0x3180cd['save']();};}function saveUpdates(_0x502e49,_0x4eb212){return function(_0x211fbe){if(_0x211fbe){return _0x211fbe['update'](_0x502e49)[_0x7557('0x27')](function(_0x352b63){return _0x352b63;});}return null;};}function removeEntity(_0x1e97d3,_0x9bbcf6){return function(_0x1533b2){if(_0x1533b2){return _0x1533b2[_0x7557('0x28')]()[_0x7557('0x27')](function(){_0x1e97d3['status'](0xcc)[_0x7557('0x1e')]();});}};}function handleEntityNotFound(_0x5bc953,_0x3daeac){return function(_0x5b2c6a){if(!_0x5b2c6a){_0x5bc953[_0x7557('0x1c')](0x194);}return _0x5b2c6a;};}function handleError(_0x3aa642,_0x4758b9){_0x4758b9=_0x4758b9||0x1f4;return function(_0x42ae94){logger['error'](_0x42ae94[_0x7557('0x29')]);if(_0x42ae94['name']){delete _0x42ae94[_0x7557('0x2a')];}_0x3aa642[_0x7557('0x1d')](_0x4758b9)[_0x7557('0x2b')](_0x42ae94);};}exports['index']=function(_0x3b36eb,_0x2b4ca8){var _0x1c6df9={},_0x1c4649={},_0x19095d={'count':0x0,'rows':[]};var _0x414eec=_['map'](db[_0x7557('0x2c')][_0x7557('0x2d')],function(_0x9080c6){return{'name':_0x9080c6[_0x7557('0x2e')],'type':_0x9080c6['type'][_0x7557('0x2f')]};});_0x1c4649[_0x7557('0x30')]=_[_0x7557('0x31')](_0x414eec,_0x7557('0x2a'));_0x1c4649[_0x7557('0x32')]=_[_0x7557('0x33')](_0x3b36eb[_0x7557('0x32')]);_0x1c4649[_0x7557('0x34')]=_[_0x7557('0x35')](_0x1c4649[_0x7557('0x30')],_0x1c4649[_0x7557('0x32')]);_0x1c6df9[_0x7557('0x36')]=_[_0x7557('0x35')](_0x1c4649[_0x7557('0x30')],qs[_0x7557('0x37')](_0x3b36eb[_0x7557('0x32')][_0x7557('0x37')]));_0x1c6df9[_0x7557('0x36')]=_0x1c6df9[_0x7557('0x36')][_0x7557('0x38')]?_0x1c6df9[_0x7557('0x36')]:_0x1c4649[_0x7557('0x30')];if(!_0x3b36eb['query'][_0x7557('0x39')]('nolimit')){_0x1c6df9['limit']=qs[_0x7557('0x20')](_0x3b36eb['query'][_0x7557('0x20')]);_0x1c6df9['offset']=qs['offset'](_0x3b36eb[_0x7557('0x32')][_0x7557('0x22')]);}_0x1c6df9[_0x7557('0x3a')]=qs['sort'](_0x3b36eb[_0x7557('0x32')][_0x7557('0x3b')]);_0x1c6df9[_0x7557('0x3c')]=qs[_0x7557('0x34')](_[_0x7557('0x3d')](_0x3b36eb[_0x7557('0x32')],_0x1c4649[_0x7557('0x34')]),_0x414eec);if(_0x3b36eb[_0x7557('0x32')]['filter']){_0x1c6df9['where']=_['merge'](_0x1c6df9['where'],{'$or':_['map'](_0x414eec,function(_0x4f3c68){if(_0x4f3c68[_0x7557('0x3e')]!==_0x7557('0x3f')){var _0x3a7c60={};_0x3a7c60[_0x4f3c68[_0x7557('0x2a')]]={'$like':'%'+_0x3b36eb['query']['filter']+'%'};return _0x3a7c60;}})});}_0x1c6df9=_[_0x7557('0x40')]({},_0x1c6df9,_0x3b36eb[_0x7557('0x41')]);var _0x962488={'where':_0x1c6df9[_0x7557('0x3c')]};return db[_0x7557('0x2c')]['count'](_0x962488)[_0x7557('0x27')](function(_0x5149c9){_0x19095d[_0x7557('0x21')]=_0x5149c9;if(_0x3b36eb[_0x7557('0x32')][_0x7557('0x42')]){_0x1c6df9[_0x7557('0x43')]=[{'all':!![]}];}return db[_0x7557('0x2c')]['findAll'](_0x1c6df9);})[_0x7557('0x27')](function(_0x3023e5){_0x19095d[_0x7557('0x44')]=_0x3023e5;return _0x19095d;})[_0x7557('0x27')](respondWithFilteredResult(_0x2b4ca8,_0x1c6df9))['catch'](handleError(_0x2b4ca8,null));};exports[_0x7557('0x45')]=function(_0x59a75a,_0x156f3b){var _0x576461={'raw':!![],'where':{'id':_0x59a75a['params']['id']}},_0x16e40f={};_0x16e40f[_0x7557('0x30')]=_['keys'](db[_0x7557('0x2c')]['rawAttributes']);_0x16e40f[_0x7557('0x32')]=_[_0x7557('0x33')](_0x59a75a[_0x7557('0x32')]);_0x16e40f[_0x7557('0x34')]=_[_0x7557('0x35')](_0x16e40f[_0x7557('0x30')],_0x16e40f['query']);_0x576461['attributes']=_['intersection'](_0x16e40f[_0x7557('0x30')],qs[_0x7557('0x37')](_0x59a75a[_0x7557('0x32')][_0x7557('0x37')]));_0x576461[_0x7557('0x36')]=_0x576461['attributes'][_0x7557('0x38')]?_0x576461['attributes']:_0x16e40f[_0x7557('0x30')];if(_0x59a75a[_0x7557('0x32')][_0x7557('0x42')]){_0x576461[_0x7557('0x43')]=[{'all':!![]}];}_0x576461=_[_0x7557('0x40')]({},_0x576461,_0x59a75a[_0x7557('0x41')]);return db[_0x7557('0x2c')][_0x7557('0x46')](_0x576461)['then'](handleEntityNotFound(_0x156f3b,null))[_0x7557('0x27')](respondWithResult(_0x156f3b,null))[_0x7557('0x47')](handleError(_0x156f3b,null));};exports[_0x7557('0x48')]=function(_0x59904c,_0xb25031){return db['Cdr']['create'](_0x59904c[_0x7557('0x49')],{})[_0x7557('0x27')](respondWithResult(_0xb25031,0xc9))[_0x7557('0x47')](handleError(_0xb25031,null));};exports[_0x7557('0x4a')]=function(_0x3683c9,_0x4d9b43){if(_0x3683c9[_0x7557('0x49')]['id']){delete _0x3683c9[_0x7557('0x49')]['id'];}return db[_0x7557('0x2c')][_0x7557('0x46')]({'where':{'id':_0x3683c9[_0x7557('0x4b')]['id']}})[_0x7557('0x27')](handleEntityNotFound(_0x4d9b43,null))[_0x7557('0x27')](saveUpdates(_0x3683c9['body'],null))['then'](respondWithResult(_0x4d9b43,null))['catch'](handleError(_0x4d9b43,null));};exports['destroy']=function(_0x2b85c5,_0x36a2a1){return db[_0x7557('0x2c')][_0x7557('0x46')]({'where':{'id':_0x2b85c5[_0x7557('0x4b')]['id']}})[_0x7557('0x27')](handleEntityNotFound(_0x36a2a1,null))[_0x7557('0x27')](removeEntity(_0x36a2a1,null))[_0x7557('0x47')](handleError(_0x36a2a1,null));};exports['describe']=function(_0x46b871,_0x445e17){return db['Cdr'][_0x7557('0x4c')]()['then'](respondWithResult(_0x445e17,null))[_0x7557('0x47')](handleError(_0x445e17,null));}; \ No newline at end of file diff --git a/server/api/cdr/cdr.model.js b/server/api/cdr/cdr.model.js index 89a07e3..f79eabb 100644 --- a/server/api/cdr/cdr.model.js +++ b/server/api/cdr/cdr.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['dst','src','uniqueid','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./cdr.attributes','exports','define','Cdr','accountcode','calldate','disposition'];(function(_0x5ceb91,_0x2acd20){var _0x35aecc=function(_0x8c3abc){while(--_0x8c3abc){_0x5ceb91['push'](_0x5ceb91['shift']());}};_0x35aecc(++_0x2acd20);}(_0x9957,0x93));var _0x7995=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x9957[_0x3947c9];return _0x2e7871;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var logger=require(_0x7995('0x2'))(_0x7995('0x3'));var moment=require('moment');var BPromise=require(_0x7995('0x4'));var rp=require(_0x7995('0x5'));var fs=require('fs');var path=require(_0x7995('0x6'));var rimraf=require(_0x7995('0x7'));var config=require('../../config/environment');var attributes=require(_0x7995('0x8'));module[_0x7995('0x9')]=function(_0x137b6b,_0x219534){return _0x137b6b[_0x7995('0xa')](_0x7995('0xb'),attributes,{'tableName':'cdr','paranoid':![],'indexes':[{'name':_0x7995('0xc'),'fields':[_0x7995('0xc')]},{'name':'calldate','fields':[_0x7995('0xd')]},{'name':_0x7995('0xe'),'fields':[_0x7995('0xe')]},{'name':_0x7995('0xf'),'fields':[_0x7995('0xf')]},{'name':_0x7995('0x10'),'fields':[_0x7995('0x10')]},{'name':'uniqueid','fields':[_0x7995('0x11')]}],'timestamps':![]});}; \ No newline at end of file +var _0x7a54=['Cdr','cdr','accountcode','disposition','dst','src','uniqueid','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./cdr.attributes','exports'];(function(_0x571dd4,_0x69bfae){var _0x134b59=function(_0x721b1){while(--_0x721b1){_0x571dd4['push'](_0x571dd4['shift']());}};_0x134b59(++_0x69bfae);}(_0x7a54,0x106));var _0x47a5=function(_0x30ede1,_0xa90d28){_0x30ede1=_0x30ede1-0x0;var _0xe1603d=_0x7a54[_0x30ede1];return _0xe1603d;};'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 99e4294..1e6f871 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 _0x20ff=['request','then','info','Cdr,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http'];(function(_0x237fdb,_0x5485c0){var _0x4d26f1=function(_0x560a98){while(--_0x560a98){_0x237fdb['push'](_0x237fdb['shift']());}};_0x4d26f1(++_0x5485c0);}(_0x20ff,0x193));var _0xf20f=function(_0x1f1801,_0x5471fb){_0x1f1801=_0x1f1801-0x0;var _0x2f993c=_0x20ff[_0x1f1801];return _0x2f993c;};'use strict';var _=require(_0xf20f('0x0'));var util=require(_0xf20f('0x1'));var moment=require(_0xf20f('0x2'));var BPromise=require(_0xf20f('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf20f('0x4'));var db=require(_0xf20f('0x5'))['db'];var utils=require(_0xf20f('0x6'));var logger=require('../../config/logger')(_0xf20f('0x7'));var config=require(_0xf20f('0x8'));var jayson=require(_0xf20f('0x9'));var client=jayson['client'][_0xf20f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x10ed2f,_0x52adb2,_0x474d07){return new BPromise(function(_0x2392ce,_0x3487aa){return client[_0xf20f('0xb')](_0x10ed2f,_0x474d07)[_0xf20f('0xc')](function(_0x58bb61){logger[_0xf20f('0xd')](_0xf20f('0xe'),_0x52adb2,_0xf20f('0xf'));logger[_0xf20f('0x10')]('Cdr,\x20%s,\x20%s,\x20%s',_0x52adb2,_0xf20f('0xf'),JSON[_0xf20f('0x11')](_0x58bb61));if(_0x58bb61[_0xf20f('0x12')]){if(_0x58bb61[_0xf20f('0x12')][_0xf20f('0x13')]===0x1f4){logger[_0xf20f('0x12')](_0xf20f('0xe'),_0x52adb2,_0x58bb61[_0xf20f('0x12')]['message']);return _0x3487aa(_0x58bb61['error'][_0xf20f('0x14')]);}logger[_0xf20f('0x12')](_0xf20f('0xe'),_0x52adb2,_0x58bb61[_0xf20f('0x12')]['message']);return _0x2392ce(_0x58bb61['error'][_0xf20f('0x14')]);}else{logger[_0xf20f('0xd')](_0xf20f('0xe'),_0x52adb2,_0xf20f('0xf'));_0x2392ce(_0x58bb61[_0xf20f('0x15')]['message']);}})[_0xf20f('0x16')](function(_0x1ebc70){logger[_0xf20f('0x12')](_0xf20f('0xe'),_0x52adb2,_0x1ebc70);_0x3487aa(_0x1ebc70);});});} \ No newline at end of file +var _0xc0c0=['lodash','util','moment','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Cdr,\x20%s,\x20%s','request\x20sent','debug','Cdr,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x1658cc,_0x342989){var _0x36ccf6=function(_0x216077){while(--_0x216077){_0x1658cc['push'](_0x1658cc['shift']());}};_0x36ccf6(++_0x342989);}(_0xc0c0,0xd2));var _0x0c0c=function(_0x1a72f3,_0x217011){_0x1a72f3=_0x1a72f3-0x0;var _0x57ef47=_0xc0c0[_0x1a72f3];return _0x57ef47;};'use strict';var _=require(_0x0c0c('0x0'));var util=require(_0x0c0c('0x1'));var moment=require(_0x0c0c('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0c0c('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0c0c('0x4'));var logger=require('../../config/logger')(_0x0c0c('0x5'));var config=require(_0x0c0c('0x6'));var jayson=require(_0x0c0c('0x7'));var client=jayson[_0x0c0c('0x8')][_0x0c0c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3bf174,_0x5be767,_0x3e7e44){return new BPromise(function(_0x3d50b3,_0x29711a){return client[_0x0c0c('0xa')](_0x3bf174,_0x3e7e44)[_0x0c0c('0xb')](function(_0x580341){logger[_0x0c0c('0xc')](_0x0c0c('0xd'),_0x5be767,_0x0c0c('0xe'));logger[_0x0c0c('0xf')](_0x0c0c('0x10'),_0x5be767,'request\x20sent',JSON[_0x0c0c('0x11')](_0x580341));if(_0x580341[_0x0c0c('0x12')]){if(_0x580341[_0x0c0c('0x12')][_0x0c0c('0x13')]===0x1f4){logger[_0x0c0c('0x12')](_0x0c0c('0xd'),_0x5be767,_0x580341[_0x0c0c('0x12')][_0x0c0c('0x14')]);return _0x29711a(_0x580341[_0x0c0c('0x12')][_0x0c0c('0x14')]);}logger[_0x0c0c('0x12')](_0x0c0c('0xd'),_0x5be767,_0x580341['error'][_0x0c0c('0x14')]);return _0x3d50b3(_0x580341[_0x0c0c('0x12')][_0x0c0c('0x14')]);}else{logger['info'](_0x0c0c('0xd'),_0x5be767,_0x0c0c('0xe'));_0x3d50b3(_0x580341['result'][_0x0c0c('0x14')]);}})['catch'](function(_0x4f3d67){logger[_0x0c0c('0x12')]('Cdr,\x20%s,\x20%s',_0x5be767,_0x4f3d67);_0x29711a(_0x4f3d67);});});} \ No newline at end of file diff --git a/server/api/cdr/index.js b/server/api/cdr/index.js index ec0b2fb..4d98c2b 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 _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(_0x20ef64,_0x4a8fe9){var _0x3707d8=function(_0x5b9a88){while(--_0x5b9a88){_0x20ef64['push'](_0x20ef64['shift']());}};_0x3707d8(++_0x4a8fe9);}(_0xa9e0,0x123));var _0x0a9e=function(_0x376b45,_0x5964fb){_0x376b45=_0x376b45-0x0;var _0x2341b3=_0xa9e0[_0x376b45];return _0x2341b3;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x0a9e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0xc')]('/',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')](_0x0a9e('0x10'),auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x11')]);module[_0x0a9e('0x12')]=router; \ No newline at end of file +var _0xb10b=['../../components/interaction/service','../../config/environment','./cdr.controller','get','index','isAuthenticated','describe','/:id','show','post','update','destroy','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service'];(function(_0x565605,_0x17dd6f){var _0x19193b=function(_0x3fb056){while(--_0x3fb056){_0x565605['push'](_0x565605['shift']());}};_0x19193b(++_0x17dd6f);}(_0xb10b,0x12a));var _0xbb10=function(_0x2d3d0d,_0x67ac82){_0x2d3d0d=_0x2d3d0d-0x0;var _0xca35b6=_0xb10b[_0x2d3d0d];return _0xca35b6;};'use strict';var multer=require(_0xbb10('0x0'));var util=require('util');var path=require(_0xbb10('0x1'));var timeout=require(_0xbb10('0x2'));var express=require(_0xbb10('0x3'));var router=express['Router']();var fs_extra=require(_0xbb10('0x4'));var auth=require(_0xbb10('0x5'));var interaction=require(_0xbb10('0x6'));var config=require(_0xbb10('0x7'));var controller=require(_0xbb10('0x8'));router[_0xbb10('0x9')]('/',auth['isAuthenticated'](),controller[_0xbb10('0xa')]);router[_0xbb10('0x9')]('/describe',auth[_0xbb10('0xb')](),controller[_0xbb10('0xc')]);router[_0xbb10('0x9')](_0xbb10('0xd'),auth[_0xbb10('0xb')](),controller[_0xbb10('0xe')]);router[_0xbb10('0xf')]('/',auth[_0xbb10('0xb')](),controller['create']);router['put'](_0xbb10('0xd'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x10')]);router['delete'](_0xbb10('0xd'),auth['isAuthenticated'](),controller[_0xbb10('0x11')]);module[_0xbb10('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 4197a63..bee4ac7 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 _0x5219=['*,*,*,*','sequelize','exports','INTEGER','STRING','noop','TEXT'];(function(_0x2e0661,_0x25f81d){var _0x16c7cb=function(_0x34b90f){while(--_0x34b90f){_0x2e0661['push'](_0x2e0661['shift']());}};_0x16c7cb(++_0x25f81d);}(_0x5219,0x1ac));var _0x9521=function(_0xdc6b17,_0x279612){_0xdc6b17=_0xdc6b17-0x0;var _0x979e36=_0x5219[_0xdc6b17];return _0x979e36;};'use strict';var Sequelize=require(_0x9521('0x0'));module[_0x9521('0x1')]={'priority':{'type':Sequelize[_0x9521('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x9521('0x3')],'allowNull':![],'defaultValue':_0x9521('0x4')},'appdata':{'type':Sequelize[_0x9521('0x5')]()},'description':{'type':Sequelize[_0x9521('0x3')]},'interval':{'type':Sequelize[_0x9521('0x3')],'defaultValue':_0x9521('0x6')}}; \ No newline at end of file +var _0xd2a6=['noop','*,*,*,*','sequelize','exports','INTEGER','STRING'];(function(_0x3f8a03,_0x319b9c){var _0x147fb2=function(_0x523c1c){while(--_0x523c1c){_0x3f8a03['push'](_0x3f8a03['shift']());}};_0x147fb2(++_0x319b9c);}(_0xd2a6,0x170));var _0x6d2a=function(_0x48ec91,_0x212edc){_0x48ec91=_0x48ec91-0x0;var _0x22766c=_0xd2a6[_0x48ec91];return _0x22766c;};'use strict';var Sequelize=require(_0x6d2a('0x0'));module[_0x6d2a('0x1')]={'priority':{'type':Sequelize[_0x6d2a('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x6d2a('0x3')],'allowNull':![],'defaultValue':_0x6d2a('0x4')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0x6d2a('0x3')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0x6d2a('0x5')}}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.controller.js b/server/api/chatApplication/chatApplication.controller.js index 928341f..2787122 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 _0x50a8=['undefined','limit','count','set','Content-Range','json','apply','update','destroy','then','error','stack','name','send','show','params','model','keys','ChatApplication','query','filters','intersection','fields','attributes','length','includeAll','options','find','catch','body','eml-format','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','sendStatus','status','end','offset'];(function(_0x4f0363,_0x12a02c){var _0xa5e67=function(_0x577c65){while(--_0x577c65){_0x4f0363['push'](_0x4f0363['shift']());}};_0xa5e67(++_0x12a02c);}(_0x50a8,0x198));var _0x850a=function(_0x50daa4,_0x3c336d){_0x50daa4=_0x50daa4-0x0;var _0x389935=_0x50a8[_0x50daa4];return _0x389935;};'use strict';var emlformat=require(_0x850a('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x850a('0x1'));var moment=require('moment');var BPromise=require(_0x850a('0x2'));var Mustache=require(_0x850a('0x3'));var util=require(_0x850a('0x4'));var path=require(_0x850a('0x5'));var sox=require(_0x850a('0x6'));var csv=require(_0x850a('0x7'));var ejs=require(_0x850a('0x8'));var fs=require('fs');var fs_extra=require(_0x850a('0x9'));var _=require(_0x850a('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x850a('0xb'));var deskjs=require(_0x850a('0xc'));var toCsv=require(_0x850a('0x7'));var querystring=require(_0x850a('0xd'));var Papa=require('papaparse');var Redis=require(_0x850a('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x850a('0xf'));var hardwareService=require(_0x850a('0x10'));var logger=require(_0x850a('0x11'))(_0x850a('0x12'));var utils=require(_0x850a('0x13'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3b12a1,_0x4d591d){_0x4d591d=_0x4d591d||0xcc;return function(_0x45cd78){if(_0x45cd78){return _0x3b12a1[_0x850a('0x14')](_0x4d591d);}return _0x3b12a1[_0x850a('0x15')](_0x4d591d)[_0x850a('0x16')]();};}function respondWithResult(_0x3328e6,_0x50c199){_0x50c199=_0x50c199||0xc8;return function(_0x355a31){if(_0x355a31){return _0x3328e6['status'](_0x50c199)['json'](_0x355a31);}};}function respondWithFilteredResult(_0x537679,_0x4c0156){return function(_0x3e6e81){if(_0x3e6e81){var _0x5e0fbe=typeof _0x4c0156[_0x850a('0x17')]===_0x850a('0x18')&&typeof _0x4c0156[_0x850a('0x19')]===_0x850a('0x18');var _0x22d759=_0x3e6e81[_0x850a('0x1a')];var _0x3e2715=_0x5e0fbe?0x0:_0x4c0156[_0x850a('0x17')];var _0x57e789=_0x5e0fbe?_0x3e6e81[_0x850a('0x1a')]:_0x4c0156['offset']+_0x4c0156['limit'];var _0x49690e;if(_0x57e789>=_0x22d759){_0x57e789=_0x22d759;_0x49690e=0xc8;}else{_0x49690e=0xce;}_0x537679['status'](_0x49690e);return _0x537679[_0x850a('0x1b')](_0x850a('0x1c'),_0x3e2715+'-'+_0x57e789+'/'+_0x22d759)[_0x850a('0x1d')](_0x3e6e81);}return null;};}function patchUpdates(_0x5b2917){return function(_0x17eadb){try{jsonpatch[_0x850a('0x1e')](_0x17eadb,_0x5b2917,!![]);}catch(_0x15c39b){return BPromise['reject'](_0x15c39b);}return _0x17eadb['save']();};}function saveUpdates(_0x342b50,_0x285ef4){return function(_0x5758af){if(_0x5758af){return _0x5758af[_0x850a('0x1f')](_0x342b50)['then'](function(_0x5eb2a4){return _0x5eb2a4;});}return null;};}function removeEntity(_0x561fde,_0x4363d4){return function(_0x47d527){if(_0x47d527){return _0x47d527[_0x850a('0x20')]()[_0x850a('0x21')](function(){_0x561fde[_0x850a('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4606ef,_0xc52e71){return function(_0x33327e){if(!_0x33327e){_0x4606ef['sendStatus'](0x194);}return _0x33327e;};}function handleError(_0x1da9ad,_0xe46a27){_0xe46a27=_0xe46a27||0x1f4;return function(_0x4d715c){logger[_0x850a('0x22')](_0x4d715c[_0x850a('0x23')]);if(_0x4d715c[_0x850a('0x24')]){delete _0x4d715c[_0x850a('0x24')];}_0x1da9ad[_0x850a('0x15')](_0xe46a27)[_0x850a('0x25')](_0x4d715c);};}exports[_0x850a('0x26')]=function(_0x314d36,_0x3a228f){var _0x177dd6={'raw':!![],'where':{'id':_0x314d36[_0x850a('0x27')]['id']}},_0x44fb58={};_0x44fb58[_0x850a('0x28')]=_[_0x850a('0x29')](db[_0x850a('0x2a')]['rawAttributes']);_0x44fb58[_0x850a('0x2b')]=_['keys'](_0x314d36[_0x850a('0x2b')]);_0x44fb58[_0x850a('0x2c')]=_[_0x850a('0x2d')](_0x44fb58['model'],_0x44fb58['query']);_0x177dd6['attributes']=_[_0x850a('0x2d')](_0x44fb58['model'],qs[_0x850a('0x2e')](_0x314d36[_0x850a('0x2b')][_0x850a('0x2e')]));_0x177dd6[_0x850a('0x2f')]=_0x177dd6['attributes'][_0x850a('0x30')]?_0x177dd6[_0x850a('0x2f')]:_0x44fb58[_0x850a('0x28')];if(_0x314d36[_0x850a('0x2b')][_0x850a('0x31')]){_0x177dd6['include']=[{'all':!![]}];}_0x177dd6=_['merge']({},_0x177dd6,_0x314d36[_0x850a('0x32')]);return db['ChatApplication'][_0x850a('0x33')](_0x177dd6)[_0x850a('0x21')](handleEntityNotFound(_0x3a228f,null))[_0x850a('0x21')](respondWithResult(_0x3a228f,null))[_0x850a('0x34')](handleError(_0x3a228f,null));};exports[_0x850a('0x1f')]=function(_0x172050,_0x3d88bb){if(_0x172050[_0x850a('0x35')]['id']){delete _0x172050[_0x850a('0x35')]['id'];}return db[_0x850a('0x2a')]['find']({'where':{'id':_0x172050[_0x850a('0x27')]['id']}})[_0x850a('0x21')](handleEntityNotFound(_0x3d88bb,null))[_0x850a('0x21')](saveUpdates(_0x172050[_0x850a('0x35')],null))[_0x850a('0x21')](respondWithResult(_0x3d88bb,null))['catch'](handleError(_0x3d88bb,null));};exports[_0x850a('0x20')]=function(_0x376a12,_0x58d34d){return db[_0x850a('0x2a')][_0x850a('0x33')]({'where':{'id':_0x376a12[_0x850a('0x27')]['id']}})['then'](handleEntityNotFound(_0x58d34d,null))['then'](removeEntity(_0x58d34d,null))[_0x850a('0x34')](handleError(_0x58d34d,null));}; \ No newline at end of file +var _0xfa20=['request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','end','stack','name','send','show','params','model','keys','filters','intersection','query','fields','attributes','includeAll','include','merge','options','ChatApplication','find','catch','body','eml-format','rimraf','zip-dir','fast-json-patch'];(function(_0x597f6c,_0x2d7f48){var _0x20e8b8=function(_0x7552e6){while(--_0x7552e6){_0x597f6c['push'](_0x597f6c['shift']());}};_0x20e8b8(++_0x2d7f48);}(_0xfa20,0x141));var _0x0fa2=function(_0x4bf5ec,_0x333deb){_0x4bf5ec=_0x4bf5ec-0x0;var _0x128359=_0xfa20[_0x4bf5ec];return _0x128359;};'use strict';var emlformat=require(_0x0fa2('0x0'));var rimraf=require(_0x0fa2('0x1'));var zipdir=require(_0x0fa2('0x2'));var jsonpatch=require(_0x0fa2('0x3'));var rp=require(_0x0fa2('0x4'));var moment=require(_0x0fa2('0x5'));var BPromise=require(_0x0fa2('0x6'));var Mustache=require(_0x0fa2('0x7'));var util=require(_0x0fa2('0x8'));var path=require(_0x0fa2('0x9'));var sox=require(_0x0fa2('0xa'));var csv=require('to-csv');var ejs=require(_0x0fa2('0xb'));var fs=require('fs');var fs_extra=require(_0x0fa2('0xc'));var _=require('lodash');var squel=require(_0x0fa2('0xd'));var crypto=require(_0x0fa2('0xe'));var jsforce=require(_0x0fa2('0xf'));var deskjs=require(_0x0fa2('0x10'));var toCsv=require(_0x0fa2('0x11'));var querystring=require(_0x0fa2('0x12'));var Papa=require(_0x0fa2('0x13'));var Redis=require(_0x0fa2('0x14'));var authService=require(_0x0fa2('0x15'));var qs=require(_0x0fa2('0x16'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0fa2('0x17'));var logger=require(_0x0fa2('0x18'))(_0x0fa2('0x19'));var utils=require(_0x0fa2('0x1a'));var config=require(_0x0fa2('0x1b'));var licenseUtil=require(_0x0fa2('0x1c'));var db=require(_0x0fa2('0x1d'))['db'];function respondWithStatusCode(_0x15a25c,_0x524360){_0x524360=_0x524360||0xcc;return function(_0x3d86ee){if(_0x3d86ee){return _0x15a25c['sendStatus'](_0x524360);}return _0x15a25c[_0x0fa2('0x1e')](_0x524360)['end']();};}function respondWithResult(_0x539b6b,_0x4a5ba2){_0x4a5ba2=_0x4a5ba2||0xc8;return function(_0x2d4c9d){if(_0x2d4c9d){return _0x539b6b[_0x0fa2('0x1e')](_0x4a5ba2)[_0x0fa2('0x1f')](_0x2d4c9d);}};}function respondWithFilteredResult(_0x157b03,_0x4366a8){return function(_0x46e317){if(_0x46e317){var _0x162cb3=typeof _0x4366a8[_0x0fa2('0x20')]==='undefined'&&typeof _0x4366a8[_0x0fa2('0x21')]===_0x0fa2('0x22');var _0x3e3baf=_0x46e317[_0x0fa2('0x23')];var _0x40f402=_0x162cb3?0x0:_0x4366a8[_0x0fa2('0x20')];var _0x2083a0=_0x162cb3?_0x46e317[_0x0fa2('0x23')]:_0x4366a8[_0x0fa2('0x20')]+_0x4366a8[_0x0fa2('0x21')];var _0x59177e;if(_0x2083a0>=_0x3e3baf){_0x2083a0=_0x3e3baf;_0x59177e=0xc8;}else{_0x59177e=0xce;}_0x157b03['status'](_0x59177e);return _0x157b03[_0x0fa2('0x24')](_0x0fa2('0x25'),_0x40f402+'-'+_0x2083a0+'/'+_0x3e3baf)['json'](_0x46e317);}return null;};}function patchUpdates(_0x383ebd){return function(_0x29b93c){try{jsonpatch[_0x0fa2('0x26')](_0x29b93c,_0x383ebd,!![]);}catch(_0x48d549){return BPromise[_0x0fa2('0x27')](_0x48d549);}return _0x29b93c[_0x0fa2('0x28')]();};}function saveUpdates(_0x5cbca0,_0x3b51bc){return function(_0x574ae0){if(_0x574ae0){return _0x574ae0[_0x0fa2('0x29')](_0x5cbca0)[_0x0fa2('0x2a')](function(_0xb6b606){return _0xb6b606;});}return null;};}function removeEntity(_0x2cf751,_0x7f6eb){return function(_0x4d921b){if(_0x4d921b){return _0x4d921b[_0x0fa2('0x2b')]()[_0x0fa2('0x2a')](function(){_0x2cf751[_0x0fa2('0x1e')](0xcc)[_0x0fa2('0x2c')]();});}};}function handleEntityNotFound(_0x16b313,_0x40d425){return function(_0x38a2c4){if(!_0x38a2c4){_0x16b313['sendStatus'](0x194);}return _0x38a2c4;};}function handleError(_0x461c54,_0x5180d1){_0x5180d1=_0x5180d1||0x1f4;return function(_0x3611ca){logger['error'](_0x3611ca[_0x0fa2('0x2d')]);if(_0x3611ca[_0x0fa2('0x2e')]){delete _0x3611ca[_0x0fa2('0x2e')];}_0x461c54[_0x0fa2('0x1e')](_0x5180d1)[_0x0fa2('0x2f')](_0x3611ca);};}exports[_0x0fa2('0x30')]=function(_0x50779a,_0xda3cdf){var _0x597f53={'raw':!![],'where':{'id':_0x50779a[_0x0fa2('0x31')]['id']}},_0x5060bf={};_0x5060bf[_0x0fa2('0x32')]=_[_0x0fa2('0x33')](db['ChatApplication']['rawAttributes']);_0x5060bf['query']=_['keys'](_0x50779a['query']);_0x5060bf[_0x0fa2('0x34')]=_[_0x0fa2('0x35')](_0x5060bf[_0x0fa2('0x32')],_0x5060bf[_0x0fa2('0x36')]);_0x597f53['attributes']=_['intersection'](_0x5060bf['model'],qs[_0x0fa2('0x37')](_0x50779a['query'][_0x0fa2('0x37')]));_0x597f53[_0x0fa2('0x38')]=_0x597f53[_0x0fa2('0x38')]['length']?_0x597f53['attributes']:_0x5060bf[_0x0fa2('0x32')];if(_0x50779a[_0x0fa2('0x36')][_0x0fa2('0x39')]){_0x597f53[_0x0fa2('0x3a')]=[{'all':!![]}];}_0x597f53=_[_0x0fa2('0x3b')]({},_0x597f53,_0x50779a[_0x0fa2('0x3c')]);return db[_0x0fa2('0x3d')][_0x0fa2('0x3e')](_0x597f53)[_0x0fa2('0x2a')](handleEntityNotFound(_0xda3cdf,null))[_0x0fa2('0x2a')](respondWithResult(_0xda3cdf,null))[_0x0fa2('0x3f')](handleError(_0xda3cdf,null));};exports[_0x0fa2('0x29')]=function(_0x18eb5a,_0x2a6317){if(_0x18eb5a[_0x0fa2('0x40')]['id']){delete _0x18eb5a[_0x0fa2('0x40')]['id'];}return db[_0x0fa2('0x3d')][_0x0fa2('0x3e')]({'where':{'id':_0x18eb5a['params']['id']}})['then'](handleEntityNotFound(_0x2a6317,null))[_0x0fa2('0x2a')](saveUpdates(_0x18eb5a[_0x0fa2('0x40')],null))[_0x0fa2('0x2a')](respondWithResult(_0x2a6317,null))[_0x0fa2('0x3f')](handleError(_0x2a6317,null));};exports[_0x0fa2('0x2b')]=function(_0x4526e7,_0x59df2b){return db[_0x0fa2('0x3d')][_0x0fa2('0x3e')]({'where':{'id':_0x4526e7[_0x0fa2('0x31')]['id']}})[_0x0fa2('0x2a')](handleEntityNotFound(_0x59df2b,null))[_0x0fa2('0x2a')](removeEntity(_0x59df2b,null))['catch'](handleError(_0x59df2b,null));}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.model.js b/server/api/chatApplication/chatApplication.model.js index 2ea966d..7a206a4 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 _0x968b=['util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./chatApplication.attributes','exports','define','ChatApplication','chat_applications','utf8mb4','utf8mb4_unicode_ci','lodash'];(function(_0x1ab180,_0x382b2c){var _0xfb2c2d=function(_0x1c5fd3){while(--_0x1c5fd3){_0x1ab180['push'](_0x1ab180['shift']());}};_0xfb2c2d(++_0x382b2c);}(_0x968b,0x8f));var _0xb968=function(_0x4da3b6,_0x233aff){_0x4da3b6=_0x4da3b6-0x0;var _0x574d38=_0x968b[_0x4da3b6];return _0x574d38;};'use strict';var _=require(_0xb968('0x0'));var util=require(_0xb968('0x1'));var logger=require(_0xb968('0x2'))(_0xb968('0x3'));var moment=require('moment');var BPromise=require(_0xb968('0x4'));var rp=require(_0xb968('0x5'));var fs=require('fs');var path=require(_0xb968('0x6'));var rimraf=require(_0xb968('0x7'));var config=require(_0xb968('0x8'));var attributes=require(_0xb968('0x9'));module[_0xb968('0xa')]=function(_0x482e8d,_0x4c0d59){return _0x482e8d[_0xb968('0xb')](_0xb968('0xc'),attributes,{'tableName':_0xb968('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xb968('0xe'),'collate':_0xb968('0xf')});}; \ No newline at end of file +var _0xc439=['api','moment','bluebird','rimraf','../../config/environment','./chatApplication.attributes','exports','define','ChatApplication','chat_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger'];(function(_0x2373c6,_0x4218c9){var _0xf2aaa9=function(_0x26eb3b){while(--_0x26eb3b){_0x2373c6['push'](_0x2373c6['shift']());}};_0xf2aaa9(++_0x4218c9);}(_0xc439,0x174));var _0x9c43=function(_0x4170cb,_0x20f4b0){_0x4170cb=_0x4170cb-0x0;var _0x396e15=_0xc439[_0x4170cb];return _0x396e15;};'use strict';var _=require(_0x9c43('0x0'));var util=require(_0x9c43('0x1'));var logger=require(_0x9c43('0x2'))(_0x9c43('0x3'));var moment=require(_0x9c43('0x4'));var BPromise=require(_0x9c43('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x9c43('0x6'));var config=require(_0x9c43('0x7'));var attributes=require(_0x9c43('0x8'));module[_0x9c43('0x9')]=function(_0x34e2fc,_0x4e9ad5){return _0x34e2fc[_0x9c43('0xa')](_0x9c43('0xb'),attributes,{'tableName':_0x9c43('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x9c43('0xd'),'collate':_0x9c43('0xe')});}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.rpc.js b/server/api/chatApplication/chatApplication.rpc.js index acf61de..f94c24c 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 _0xfaf4=['error','message','request\x20sent','result','catch','moment','bluebird','randomstring','../../mysqldb','jayson/promise','client','http','info','ChatApplication,\x20%s,\x20%s','debug','ChatApplication,\x20%s,\x20%s,\x20%s'];(function(_0x5e98cc,_0x18c78d){var _0xa2bd7f=function(_0x4b672c){while(--_0x4b672c){_0x5e98cc['push'](_0x5e98cc['shift']());}};_0xa2bd7f(++_0x18c78d);}(_0xfaf4,0x1d5));var _0x4faf=function(_0x180a2a,_0x304a90){_0x180a2a=_0x180a2a-0x0;var _0x5ad1fb=_0xfaf4[_0x180a2a];return _0x5ad1fb;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x4faf('0x0'));var BPromise=require(_0x4faf('0x1'));var rs=require(_0x4faf('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4faf('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x4faf('0x4'));var client=jayson[_0x4faf('0x5')][_0x4faf('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x5a3235,_0x1eddbf,_0x2714a0){return new BPromise(function(_0x44fd93,_0x553358){return client['request'](_0x5a3235,_0x2714a0)['then'](function(_0x5d70c2){logger[_0x4faf('0x7')](_0x4faf('0x8'),_0x1eddbf,'request\x20sent');logger[_0x4faf('0x9')](_0x4faf('0xa'),_0x1eddbf,'request\x20sent',JSON['stringify'](_0x5d70c2));if(_0x5d70c2[_0x4faf('0xb')]){if(_0x5d70c2[_0x4faf('0xb')]['code']===0x1f4){logger[_0x4faf('0xb')](_0x4faf('0x8'),_0x1eddbf,_0x5d70c2[_0x4faf('0xb')][_0x4faf('0xc')]);return _0x553358(_0x5d70c2['error'][_0x4faf('0xc')]);}logger[_0x4faf('0xb')]('ChatApplication,\x20%s,\x20%s',_0x1eddbf,_0x5d70c2[_0x4faf('0xb')]['message']);return _0x44fd93(_0x5d70c2['error'][_0x4faf('0xc')]);}else{logger[_0x4faf('0x7')](_0x4faf('0x8'),_0x1eddbf,_0x4faf('0xd'));_0x44fd93(_0x5d70c2[_0x4faf('0xe')][_0x4faf('0xc')]);}})[_0x4faf('0xf')](function(_0x3dcc47){logger[_0x4faf('0xb')](_0x4faf('0x8'),_0x1eddbf,_0x3dcc47);_0x553358(_0x3dcc47);});});} \ No newline at end of file +var _0x32ab=['../../mysqldb','../../config/logger','jayson/promise','request','info','request\x20sent','ChatApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','ChatApplication,\x20%s,\x20%s','lodash','moment','bluebird','randomstring'];(function(_0x618414,_0x1a7a60){var _0x21c19a=function(_0x507b17){while(--_0x507b17){_0x618414['push'](_0x618414['shift']());}};_0x21c19a(++_0x1a7a60);}(_0x32ab,0x17c));var _0xb32a=function(_0x4b055c,_0x4b870b){_0x4b055c=_0x4b055c-0x0;var _0x4b62bb=_0x32ab[_0x4b055c];return _0x4b62bb;};'use strict';var _=require(_0xb32a('0x0'));var util=require('util');var moment=require(_0xb32a('0x1'));var BPromise=require(_0xb32a('0x2'));var rs=require(_0xb32a('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb32a('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xb32a('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0xb32a('0x6'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2d1638,_0x1e850f,_0x55fb79){return new BPromise(function(_0x4d1ba0,_0x33f31d){return client[_0xb32a('0x7')](_0x2d1638,_0x55fb79)['then'](function(_0x52c373){logger[_0xb32a('0x8')]('ChatApplication,\x20%s,\x20%s',_0x1e850f,_0xb32a('0x9'));logger['debug'](_0xb32a('0xa'),_0x1e850f,_0xb32a('0x9'),JSON[_0xb32a('0xb')](_0x52c373));if(_0x52c373[_0xb32a('0xc')]){if(_0x52c373[_0xb32a('0xc')][_0xb32a('0xd')]===0x1f4){logger[_0xb32a('0xc')]('ChatApplication,\x20%s,\x20%s',_0x1e850f,_0x52c373[_0xb32a('0xc')]['message']);return _0x33f31d(_0x52c373['error'][_0xb32a('0xe')]);}logger['error'](_0xb32a('0xf'),_0x1e850f,_0x52c373[_0xb32a('0xc')][_0xb32a('0xe')]);return _0x4d1ba0(_0x52c373[_0xb32a('0xc')][_0xb32a('0xe')]);}else{logger[_0xb32a('0x8')]('ChatApplication,\x20%s,\x20%s',_0x1e850f,_0xb32a('0x9'));_0x4d1ba0(_0x52c373['result']['message']);}})['catch'](function(_0x23cecd){logger[_0xb32a('0xc')](_0xb32a('0xf'),_0x1e850f,_0x23cecd);_0x33f31d(_0x23cecd);});});} \ No newline at end of file diff --git a/server/api/chatApplication/index.js b/server/api/chatApplication/index.js index 5b12bed..0f08f99 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 _0x5536=['update','destroy','exports','multer','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./chatApplication.controller','/:id','isAuthenticated','show'];(function(_0x330f00,_0x2208d8){var _0x3c79d8=function(_0x1f7e4e){while(--_0x1f7e4e){_0x330f00['push'](_0x330f00['shift']());}};_0x3c79d8(++_0x2208d8);}(_0x5536,0x189));var _0x6553=function(_0x1498e9,_0x267008){_0x1498e9=_0x1498e9-0x0;var _0x5c15f2=_0x5536[_0x1498e9];return _0x5c15f2;};'use strict';var multer=require(_0x6553('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x6553('0x1'));var router=express[_0x6553('0x2')]();var fs_extra=require(_0x6553('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x6553('0x4'));var config=require(_0x6553('0x5'));var controller=require(_0x6553('0x6'));router['get'](_0x6553('0x7'),auth[_0x6553('0x8')](),controller[_0x6553('0x9')]);router['put']('/:id',auth[_0x6553('0x8')](),controller[_0x6553('0xa')]);router['delete'](_0x6553('0x7'),auth[_0x6553('0x8')](),controller[_0x6553('0xb')]);module[_0x6553('0xc')]=router; \ No newline at end of file +var _0x45aa=['delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatApplication.controller','get','/:id','show','put','isAuthenticated','update'];(function(_0x240a63,_0x3403f3){var _0x528aa3=function(_0x4b8b79){while(--_0x4b8b79){_0x240a63['push'](_0x240a63['shift']());}};_0x528aa3(++_0x3403f3);}(_0x45aa,0x1b8));var _0xa45a=function(_0x593567,_0x537f33){_0x593567=_0x593567-0x0;var _0x2e1562=_0x45aa[_0x593567];return _0x2e1562;};'use strict';var multer=require(_0xa45a('0x0'));var util=require(_0xa45a('0x1'));var path=require(_0xa45a('0x2'));var timeout=require(_0xa45a('0x3'));var express=require('express');var router=express[_0xa45a('0x4')]();var fs_extra=require(_0xa45a('0x5'));var auth=require(_0xa45a('0x6'));var interaction=require(_0xa45a('0x7'));var config=require(_0xa45a('0x8'));var controller=require(_0xa45a('0x9'));router[_0xa45a('0xa')](_0xa45a('0xb'),auth['isAuthenticated'](),controller[_0xa45a('0xc')]);router[_0xa45a('0xd')]('/:id',auth[_0xa45a('0xe')](),controller[_0xa45a('0xf')]);router[_0xa45a('0x10')](_0xa45a('0xb'),auth[_0xa45a('0xe')](),controller[_0xa45a('0x11')]);module[_0xa45a('0x12')]=router; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.attributes.js b/server/api/chatGroup/chatGroup.attributes.js index 227b18d..b91720a 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 _0xfa45=['exports','STRING','BOOLEAN','sequelize'];(function(_0x4232ec,_0x58bb90){var _0x36373b=function(_0x5e7195){while(--_0x5e7195){_0x4232ec['push'](_0x4232ec['shift']());}};_0x36373b(++_0x58bb90);}(_0xfa45,0x11b));var _0x5fa4=function(_0x1b4309,_0x4870e9){_0x1b4309=_0x1b4309-0x0;var _0x53e3fc=_0xfa45[_0x1b4309];return _0x53e3fc;};'use strict';var Sequelize=require(_0x5fa4('0x0'));module[_0x5fa4('0x1')]={'name':{'type':Sequelize[_0x5fa4('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x5fa4('0x2')]},'write':{'type':Sequelize[_0x5fa4('0x3')],'defaultValue':!![]}}; \ No newline at end of file +var _0x9541=['exports','STRING','BOOLEAN','sequelize'];(function(_0x3b39b8,_0x1e19b7){var _0x936eb=function(_0x51c343){while(--_0x51c343){_0x3b39b8['push'](_0x3b39b8['shift']());}};_0x936eb(++_0x1e19b7);}(_0x9541,0xb3));var _0x1954=function(_0x1b060d,_0x218177){_0x1b060d=_0x1b060d-0x0;var _0xf36c56=_0x9541[_0x1b060d];return _0xf36c56;};'use strict';var Sequelize=require(_0x1954('0x0'));module[_0x1954('0x1')]={'name':{'type':Sequelize[_0x1954('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x1954('0x2')]},'write':{'type':Sequelize[_0x1954('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 065707d..794c73d 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 _0xc01d=['../../config/environment','../../config/license/util','../../mysqldb','defaults','localhost','redis','./chatGroup.socket','register','end','json','offset','undefined','limit','count','status','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','rawAttributes','fieldName','type','key','model','map','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','ChatGroup','includeAll','include','show','find','catch','create','body','params','describe','getUnread','ChatInternalMessage','user','addMembers','ids','getMembers','findOne','removeMembers','getMessages','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils'];(function(_0x550d12,_0x5384bd){var _0x12103d=function(_0x2a9834){while(--_0x2a9834){_0x550d12['push'](_0x550d12['shift']());}};_0x12103d(++_0x5384bd);}(_0xc01d,0x1db));var _0xdc01=function(_0x4a9386,_0x3d95bf){_0x4a9386=_0x4a9386-0x0;var _0x10b348=_0xc01d[_0x4a9386];return _0x10b348;};'use strict';var emlformat=require(_0xdc01('0x0'));var rimraf=require(_0xdc01('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xdc01('0x2'));var rp=require(_0xdc01('0x3'));var moment=require(_0xdc01('0x4'));var BPromise=require(_0xdc01('0x5'));var Mustache=require(_0xdc01('0x6'));var util=require(_0xdc01('0x7'));var path=require(_0xdc01('0x8'));var sox=require(_0xdc01('0x9'));var csv=require(_0xdc01('0xa'));var ejs=require(_0xdc01('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xdc01('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xdc01('0xd'));var deskjs=require(_0xdc01('0xe'));var toCsv=require(_0xdc01('0xa'));var querystring=require(_0xdc01('0xf'));var Papa=require(_0xdc01('0x10'));var Redis=require(_0xdc01('0x11'));var authService=require(_0xdc01('0x12'));var qs=require(_0xdc01('0x13'));var as=require(_0xdc01('0x14'));var hardwareService=require(_0xdc01('0x15'));var logger=require(_0xdc01('0x16'))(_0xdc01('0x17'));var utils=require(_0xdc01('0x18'));var config=require(_0xdc01('0x19'));var licenseUtil=require(_0xdc01('0x1a'));var db=require(_0xdc01('0x1b'))['db'];config['redis']=_[_0xdc01('0x1c')](config['redis'],{'host':_0xdc01('0x1d'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xdc01('0x1e')]));require(_0xdc01('0x1f'))[_0xdc01('0x20')](socket);function respondWithStatusCode(_0x489417,_0xa0f766){_0xa0f766=_0xa0f766||0xcc;return function(_0x252c04){if(_0x252c04){return _0x489417['sendStatus'](_0xa0f766);}return _0x489417['status'](_0xa0f766)[_0xdc01('0x21')]();};}function respondWithResult(_0x13e3cc,_0x11104e){_0x11104e=_0x11104e||0xc8;return function(_0x20ac77){if(_0x20ac77){return _0x13e3cc['status'](_0x11104e)[_0xdc01('0x22')](_0x20ac77);}};}function respondWithFilteredResult(_0x3c219c,_0x4d290e){return function(_0x353391){if(_0x353391){var _0x2c9580=typeof _0x4d290e[_0xdc01('0x23')]===_0xdc01('0x24')&&typeof _0x4d290e[_0xdc01('0x25')]==='undefined';var _0x5f04fd=_0x353391[_0xdc01('0x26')];var _0x3db98c=_0x2c9580?0x0:_0x4d290e[_0xdc01('0x23')];var _0x87f0fa=_0x2c9580?_0x353391['count']:_0x4d290e[_0xdc01('0x23')]+_0x4d290e[_0xdc01('0x25')];var _0x30e1cf;if(_0x87f0fa>=_0x5f04fd){_0x87f0fa=_0x5f04fd;_0x30e1cf=0xc8;}else{_0x30e1cf=0xce;}_0x3c219c[_0xdc01('0x27')](_0x30e1cf);return _0x3c219c[_0xdc01('0x28')](_0xdc01('0x29'),_0x3db98c+'-'+_0x87f0fa+'/'+_0x5f04fd)[_0xdc01('0x22')](_0x353391);}return null;};}function patchUpdates(_0x58883c){return function(_0x13da54){try{jsonpatch[_0xdc01('0x2a')](_0x13da54,_0x58883c,!![]);}catch(_0x1b17ae){return BPromise[_0xdc01('0x2b')](_0x1b17ae);}return _0x13da54[_0xdc01('0x2c')]();};}function saveUpdates(_0x8a8801,_0x20ccf8){return function(_0x105ca1){if(_0x105ca1){return _0x105ca1[_0xdc01('0x2d')](_0x8a8801)[_0xdc01('0x2e')](function(_0x27b196){return _0x27b196;});}return null;};}function removeEntity(_0xeb32cb,_0x8b0815){return function(_0x2b42e0){if(_0x2b42e0){return _0x2b42e0[_0xdc01('0x2f')]()[_0xdc01('0x2e')](function(){_0xeb32cb[_0xdc01('0x27')](0xcc)[_0xdc01('0x21')]();});}};}function handleEntityNotFound(_0x205a4c,_0x597949){return function(_0x1f5b1f){if(!_0x1f5b1f){_0x205a4c[_0xdc01('0x30')](0x194);}return _0x1f5b1f;};}function handleError(_0x508432,_0x7b9f4f){_0x7b9f4f=_0x7b9f4f||0x1f4;return function(_0x3daf26){logger[_0xdc01('0x31')](_0x3daf26[_0xdc01('0x32')]);if(_0x3daf26[_0xdc01('0x33')]){delete _0x3daf26[_0xdc01('0x33')];}_0x508432[_0xdc01('0x27')](_0x7b9f4f)[_0xdc01('0x34')](_0x3daf26);};}exports[_0xdc01('0x35')]=function(_0x1ecd52,_0x6aefd5){var _0x478660={},_0x4088f8={},_0x309881={'count':0x0,'rows':[]};var _0x211ccd=_['map'](db['ChatGroup'][_0xdc01('0x36')],function(_0x15e16c){return{'name':_0x15e16c[_0xdc01('0x37')],'type':_0x15e16c[_0xdc01('0x38')][_0xdc01('0x39')]};});_0x4088f8[_0xdc01('0x3a')]=_[_0xdc01('0x3b')](_0x211ccd,_0xdc01('0x33'));_0x4088f8[_0xdc01('0x3c')]=_[_0xdc01('0x3d')](_0x1ecd52['query']);_0x4088f8[_0xdc01('0x3e')]=_['intersection'](_0x4088f8[_0xdc01('0x3a')],_0x4088f8[_0xdc01('0x3c')]);_0x478660[_0xdc01('0x3f')]=_[_0xdc01('0x40')](_0x4088f8[_0xdc01('0x3a')],qs[_0xdc01('0x41')](_0x1ecd52[_0xdc01('0x3c')][_0xdc01('0x41')]));_0x478660[_0xdc01('0x3f')]=_0x478660['attributes'][_0xdc01('0x42')]?_0x478660['attributes']:_0x4088f8[_0xdc01('0x3a')];if(!_0x1ecd52['query'][_0xdc01('0x43')](_0xdc01('0x44'))){_0x478660[_0xdc01('0x25')]=qs[_0xdc01('0x25')](_0x1ecd52[_0xdc01('0x3c')]['limit']);_0x478660['offset']=qs[_0xdc01('0x23')](_0x1ecd52[_0xdc01('0x3c')][_0xdc01('0x23')]);}_0x478660[_0xdc01('0x45')]=qs[_0xdc01('0x46')](_0x1ecd52[_0xdc01('0x3c')]['sort']);_0x478660[_0xdc01('0x47')]=qs[_0xdc01('0x3e')](_[_0xdc01('0x48')](_0x1ecd52[_0xdc01('0x3c')],_0x4088f8[_0xdc01('0x3e')]),_0x211ccd);if(_0x1ecd52['query'][_0xdc01('0x49')]){_0x478660['where']=_[_0xdc01('0x4a')](_0x478660[_0xdc01('0x47')],{'$or':_[_0xdc01('0x3b')](_0x211ccd,function(_0x4e2ed1){if(_0x4e2ed1[_0xdc01('0x38')]!==_0xdc01('0x4b')){var _0x2661aa={};_0x2661aa[_0x4e2ed1[_0xdc01('0x33')]]={'$like':'%'+_0x1ecd52[_0xdc01('0x3c')]['filter']+'%'};return _0x2661aa;}})});}_0x478660=_[_0xdc01('0x4a')]({},_0x478660,_0x1ecd52[_0xdc01('0x4c')]);var _0x5bbd7d={'where':_0x478660[_0xdc01('0x47')]};return db[_0xdc01('0x4d')][_0xdc01('0x26')](_0x5bbd7d)[_0xdc01('0x2e')](function(_0x186bd9){_0x309881[_0xdc01('0x26')]=_0x186bd9;if(_0x1ecd52[_0xdc01('0x3c')][_0xdc01('0x4e')]){_0x478660[_0xdc01('0x4f')]=[{'all':!![]}];}return db['ChatGroup']['findAll'](_0x478660);})[_0xdc01('0x2e')](function(_0x36b557){_0x309881['rows']=_0x36b557;return _0x309881;})[_0xdc01('0x2e')](respondWithFilteredResult(_0x6aefd5,_0x478660))['catch'](handleError(_0x6aefd5,null));};exports[_0xdc01('0x50')]=function(_0x4847ea,_0x583846){var _0x313a38={'raw':!![],'where':{'id':_0x4847ea['params']['id']}},_0x636132={};_0x636132[_0xdc01('0x3a')]=_['keys'](db[_0xdc01('0x4d')][_0xdc01('0x36')]);_0x636132[_0xdc01('0x3c')]=_[_0xdc01('0x3d')](_0x4847ea[_0xdc01('0x3c')]);_0x636132[_0xdc01('0x3e')]=_['intersection'](_0x636132['model'],_0x636132['query']);_0x313a38[_0xdc01('0x3f')]=_[_0xdc01('0x40')](_0x636132[_0xdc01('0x3a')],qs[_0xdc01('0x41')](_0x4847ea[_0xdc01('0x3c')][_0xdc01('0x41')]));_0x313a38['attributes']=_0x313a38[_0xdc01('0x3f')][_0xdc01('0x42')]?_0x313a38[_0xdc01('0x3f')]:_0x636132['model'];if(_0x4847ea[_0xdc01('0x3c')]['includeAll']){_0x313a38['include']=[{'all':!![]}];}_0x313a38=_[_0xdc01('0x4a')]({},_0x313a38,_0x4847ea[_0xdc01('0x4c')]);return db['ChatGroup'][_0xdc01('0x51')](_0x313a38)['then'](handleEntityNotFound(_0x583846,null))[_0xdc01('0x2e')](respondWithResult(_0x583846,null))[_0xdc01('0x52')](handleError(_0x583846,null));};exports[_0xdc01('0x53')]=function(_0x459dd1,_0x557796){return db[_0xdc01('0x4d')]['create'](_0x459dd1['body'],{})['then'](respondWithResult(_0x557796,0xc9))[_0xdc01('0x52')](handleError(_0x557796,null));};exports['update']=function(_0x4ac0cc,_0x5e332b){if(_0x4ac0cc[_0xdc01('0x54')]['id']){delete _0x4ac0cc[_0xdc01('0x54')]['id'];}return db['ChatGroup'][_0xdc01('0x51')]({'where':{'id':_0x4ac0cc[_0xdc01('0x55')]['id']}})[_0xdc01('0x2e')](handleEntityNotFound(_0x5e332b,null))[_0xdc01('0x2e')](saveUpdates(_0x4ac0cc[_0xdc01('0x54')],null))['then'](respondWithResult(_0x5e332b,null))[_0xdc01('0x52')](handleError(_0x5e332b,null));};exports[_0xdc01('0x2f')]=function(_0x3555e3,_0x6c8be4){return db[_0xdc01('0x4d')][_0xdc01('0x51')]({'where':{'id':_0x3555e3['params']['id']}})[_0xdc01('0x2e')](handleEntityNotFound(_0x6c8be4,null))['then'](removeEntity(_0x6c8be4,null))['catch'](handleError(_0x6c8be4,null));};exports[_0xdc01('0x56')]=function(_0x2acd2,_0x294ba3){return db['ChatGroup']['describe']()[_0xdc01('0x2e')](respondWithResult(_0x294ba3,null))['catch'](handleError(_0x294ba3,null));};exports[_0xdc01('0x57')]=function(_0x8e61de,_0x55108d,_0x4d9d26){return db[_0xdc01('0x58')]['count']({'where':{'ChatGroupId':_0x8e61de['params']['id'],'ToId':_0x8e61de[_0xdc01('0x59')]['id'],'read':![]}})[_0xdc01('0x2e')](function(_0x331103){return{'id':_['toInteger'](_0x8e61de[_0xdc01('0x55')]['id']),'count':_0x331103};})[_0xdc01('0x2e')](respondWithResult(_0x55108d,null))['catch'](handleError(_0x55108d,null));};exports[_0xdc01('0x5a')]=function(_0x5c87df,_0x3e1bf4,_0x388e76){return db['ChatGroup'][_0xdc01('0x51')]({'where':{'id':_0x5c87df[_0xdc01('0x55')]['id']}})[_0xdc01('0x2e')](handleEntityNotFound(_0x3e1bf4,null))[_0xdc01('0x2e')](function(_0x4fc1f7){if(_0x4fc1f7){return _0x4fc1f7['addMembers'](_0x5c87df[_0xdc01('0x54')]['ids'],_['omit'](_0x5c87df['body'],[_0xdc01('0x5b'),'id'])||{});}})[_0xdc01('0x2e')](respondWithResult(_0x3e1bf4,null))[_0xdc01('0x52')](handleError(_0x3e1bf4,null));};exports[_0xdc01('0x5c')]=function(_0x590f23,_0x4b16ca,_0x5a61a1){var _0x57545d={};var _0x10ebd3={};var _0x546730;var _0x4047ed;return db[_0xdc01('0x4d')][_0xdc01('0x5d')]({'where':{'id':_0x590f23[_0xdc01('0x55')]['id']}})[_0xdc01('0x2e')](handleEntityNotFound(_0x4b16ca,null))[_0xdc01('0x2e')](function(_0x43daa5){if(_0x43daa5){_0x546730=_0x43daa5;_0x10ebd3[_0xdc01('0x3a')]=_['keys'](db['User'][_0xdc01('0x36')]);_0x10ebd3['query']=_[_0xdc01('0x3d')](_0x590f23[_0xdc01('0x3c')]);_0x10ebd3[_0xdc01('0x3e')]=_[_0xdc01('0x40')](_0x10ebd3['model'],_0x10ebd3[_0xdc01('0x3c')]);_0x57545d[_0xdc01('0x3f')]=_['intersection'](_0x10ebd3[_0xdc01('0x3a')],qs[_0xdc01('0x41')](_0x590f23[_0xdc01('0x3c')][_0xdc01('0x41')]));_0x57545d[_0xdc01('0x3f')]=_0x57545d[_0xdc01('0x3f')][_0xdc01('0x42')]?_0x57545d[_0xdc01('0x3f')]:_0x10ebd3[_0xdc01('0x3a')];_0x57545d['order']=qs[_0xdc01('0x46')](_0x590f23[_0xdc01('0x3c')][_0xdc01('0x46')]);_0x57545d[_0xdc01('0x47')]=qs[_0xdc01('0x3e')](_[_0xdc01('0x48')](_0x590f23[_0xdc01('0x3c')],_0x10ebd3[_0xdc01('0x3e')]));if(_0x590f23['query'][_0xdc01('0x49')]){_0x57545d[_0xdc01('0x47')]=_[_0xdc01('0x4a')](_0x57545d[_0xdc01('0x47')],{'$or':_[_0xdc01('0x3b')](_0x57545d['attributes'],function(_0x905c1){var _0xe7aefa={};_0xe7aefa[_0x905c1]={'$like':'%'+_0x590f23[_0xdc01('0x3c')][_0xdc01('0x49')]+'%'};return _0xe7aefa;})});}_0x57545d=_['merge']({},_0x57545d,_0x590f23[_0xdc01('0x4c')]);return _0x546730['getMembers'](_0x57545d);}})[_0xdc01('0x2e')](function(_0x5efb23){if(_0x5efb23){_0x4047ed=_0x5efb23['length'];if(!_0x590f23[_0xdc01('0x3c')][_0xdc01('0x43')](_0xdc01('0x44'))){_0x57545d[_0xdc01('0x25')]=qs[_0xdc01('0x25')](_0x590f23['query']['limit']);_0x57545d[_0xdc01('0x23')]=qs['offset'](_0x590f23['query']['offset']);}return _0x546730[_0xdc01('0x5c')](_0x57545d);}})[_0xdc01('0x2e')](function(_0x5c988e){if(_0x5c988e){return _0x5c988e?{'count':_0x4047ed,'rows':_0x5c988e}:null;}})[_0xdc01('0x2e')](respondWithResult(_0x4b16ca,null))[_0xdc01('0x52')](handleError(_0x4b16ca,null));};exports[_0xdc01('0x5e')]=function(_0x55668b,_0x9d89e,_0x78a689){return db[_0xdc01('0x4d')][_0xdc01('0x51')]({'where':{'id':_0x55668b[_0xdc01('0x55')]['id']}})[_0xdc01('0x2e')](handleEntityNotFound(_0x9d89e,null))[_0xdc01('0x2e')](function(_0x485927){if(_0x485927){return _0x485927[_0xdc01('0x5e')](_0x55668b[_0xdc01('0x3c')][_0xdc01('0x5b')]);}})[_0xdc01('0x2e')](respondWithStatusCode(_0x9d89e,null))[_0xdc01('0x52')](handleError(_0x9d89e,null));};exports['addMessage']=function(_0x29d846,_0x168ba4,_0x238251){if(_0x29d846['body']['id']){delete _0x29d846[_0xdc01('0x54')]['id'];}return db[_0xdc01('0x4d')][_0xdc01('0x51')]({'where':{'id':_0x29d846[_0xdc01('0x55')]['id']}})['then'](handleEntityNotFound(_0x168ba4,null))[_0xdc01('0x2e')](function(_0x552a47){if(_0x552a47){_0x29d846['body']['ChatGroupId']=_0x552a47['id'];return db[_0xdc01('0x58')][_0xdc01('0x53')](_0x29d846['body']);}})[_0xdc01('0x2e')](respondWithResult(_0x168ba4,null))[_0xdc01('0x52')](handleError(_0x168ba4,null));};exports[_0xdc01('0x5f')]=function(_0x15d903,_0x319526,_0x542621){var _0xfa59b9={};var _0x17a3c0={};var _0x3a44ba;var _0x3b7e83;return db[_0xdc01('0x4d')][_0xdc01('0x5d')]({'where':{'id':_0x15d903[_0xdc01('0x55')]['id']}})['then'](handleEntityNotFound(_0x319526,null))[_0xdc01('0x2e')](function(_0x55a272){if(_0x55a272){_0x3a44ba=_0x55a272;_0x17a3c0[_0xdc01('0x3a')]=_[_0xdc01('0x3d')](db['ChatInternalMessage']['rawAttributes']);_0x17a3c0[_0xdc01('0x3c')]=_['keys'](_0x15d903[_0xdc01('0x3c')]);_0x17a3c0[_0xdc01('0x3e')]=_[_0xdc01('0x40')](_0x17a3c0[_0xdc01('0x3a')],_0x17a3c0[_0xdc01('0x3c')]);_0xfa59b9[_0xdc01('0x3f')]=_[_0xdc01('0x40')](_0x17a3c0[_0xdc01('0x3a')],qs[_0xdc01('0x41')](_0x15d903[_0xdc01('0x3c')][_0xdc01('0x41')]));_0xfa59b9[_0xdc01('0x3f')]=_0xfa59b9[_0xdc01('0x3f')][_0xdc01('0x42')]?_0xfa59b9['attributes']:_0x17a3c0['model'];_0xfa59b9['order']=qs[_0xdc01('0x46')](_0x15d903[_0xdc01('0x3c')][_0xdc01('0x46')]);_0xfa59b9['where']=qs[_0xdc01('0x3e')](_['pick'](_0x15d903['query'],_0x17a3c0[_0xdc01('0x3e')]));if(_0x15d903[_0xdc01('0x3c')][_0xdc01('0x49')]){_0xfa59b9[_0xdc01('0x47')]=_[_0xdc01('0x4a')](_0xfa59b9[_0xdc01('0x47')],{'$or':_['map'](_0xfa59b9[_0xdc01('0x3f')],function(_0x57f830){var _0x1624fa={};_0x1624fa[_0x57f830]={'$like':'%'+_0x15d903[_0xdc01('0x3c')][_0xdc01('0x49')]+'%'};return _0x1624fa;})});}if(_0x15d903['query'][_0xdc01('0x60')]){var _0x5caf48=_0x15d903[_0xdc01('0x3c')][_0xdc01('0x60')][_0xdc01('0x61')](',');var _0x5ce1f7={};_0x5ce1f7[_0x5caf48[0x0]]={'$gte':moment(_0x5caf48[0x1])[_0xdc01('0x62')](_0xdc01('0x63'))};_0xfa59b9[_0xdc01('0x47')]=_['merge'](_0xfa59b9[_0xdc01('0x47')],_0x5ce1f7);}_0xfa59b9=_[_0xdc01('0x4a')]({},_0xfa59b9,_0x15d903['options']);return _0x3a44ba[_0xdc01('0x5f')](_0xfa59b9);}})[_0xdc01('0x2e')](function(_0x20a7c6){if(_0x20a7c6){_0x3b7e83=_0x20a7c6[_0xdc01('0x42')];if(!_0x15d903[_0xdc01('0x3c')][_0xdc01('0x43')](_0xdc01('0x44'))){_0xfa59b9['limit']=qs[_0xdc01('0x25')](_0x15d903[_0xdc01('0x3c')][_0xdc01('0x25')]);_0xfa59b9[_0xdc01('0x23')]=qs[_0xdc01('0x23')](_0x15d903[_0xdc01('0x3c')]['offset']);}return _0x3a44ba[_0xdc01('0x5f')](_0xfa59b9);}})[_0xdc01('0x2e')](function(_0x57f810){if(_0x57f810){return _0x57f810?{'count':_0x3b7e83,'rows':_0x57f810}:null;}})[_0xdc01('0x2e')](respondWithResult(_0x319526,null))['catch'](handleError(_0x319526,null));}; \ No newline at end of file +var _0x0b4e=['VIRTUAL','filter','options','includeAll','findAll','catch','show','params','length','include','body','find','describe','getUnread','ChatInternalMessage','user','toInteger','addMembers','ids','omit','getMembers','findOne','User','rawAttributes','nolimit','removeMembers','addMessage','ChatGroupId','create','getMessages','$gte','split','rimraf','zip-dir','fast-json-patch','request-promise','moment','path','sox','ejs','fs-extra','lodash','squel','desk.js','to-csv','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','localhost','socket.io-emitter','redis','./chatGroup.socket','register','sendStatus','status','end','json','offset','undefined','count','limit','set','apply','reject','update','then','destroy','error','stack','name','send','map','ChatGroup','fieldName','type','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','order','sort','where','filters','pick','merge'];(function(_0x42fced,_0x55d428){var _0x12c61e=function(_0x29d41b){while(--_0x29d41b){_0x42fced['push'](_0x42fced['shift']());}};_0x12c61e(++_0x55d428);}(_0x0b4e,0x7f));var _0xe0b4=function(_0xe327b1,_0x333197){_0xe327b1=_0xe327b1-0x0;var _0x364891=_0x0b4e[_0xe327b1];return _0x364891;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe0b4('0x0'));var zipdir=require(_0xe0b4('0x1'));var jsonpatch=require(_0xe0b4('0x2'));var rp=require(_0xe0b4('0x3'));var moment=require(_0xe0b4('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xe0b4('0x5'));var sox=require(_0xe0b4('0x6'));var csv=require('to-csv');var ejs=require(_0xe0b4('0x7'));var fs=require('fs');var fs_extra=require(_0xe0b4('0x8'));var _=require(_0xe0b4('0x9'));var squel=require(_0xe0b4('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xe0b4('0xb'));var toCsv=require(_0xe0b4('0xc'));var querystring=require('querystring');var Papa=require(_0xe0b4('0xd'));var Redis=require(_0xe0b4('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xe0b4('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe0b4('0x10'));var logger=require('../../config/logger')(_0xe0b4('0x11'));var utils=require(_0xe0b4('0x12'));var config=require(_0xe0b4('0x13'));var licenseUtil=require(_0xe0b4('0x14'));var db=require(_0xe0b4('0x15'))['db'];config['redis']=_['defaults'](config['redis'],{'host':_0xe0b4('0x16'),'port':0x18eb});var socket=require(_0xe0b4('0x17'))(new Redis(config[_0xe0b4('0x18')]));require(_0xe0b4('0x19'))[_0xe0b4('0x1a')](socket);function respondWithStatusCode(_0x4dffdc,_0x495562){_0x495562=_0x495562||0xcc;return function(_0x4bce2e){if(_0x4bce2e){return _0x4dffdc[_0xe0b4('0x1b')](_0x495562);}return _0x4dffdc[_0xe0b4('0x1c')](_0x495562)[_0xe0b4('0x1d')]();};}function respondWithResult(_0xbcdd80,_0x5cb099){_0x5cb099=_0x5cb099||0xc8;return function(_0x52ebaa){if(_0x52ebaa){return _0xbcdd80['status'](_0x5cb099)[_0xe0b4('0x1e')](_0x52ebaa);}};}function respondWithFilteredResult(_0x432fc8,_0x5d9bf0){return function(_0x54a73a){if(_0x54a73a){var _0x173522=typeof _0x5d9bf0[_0xe0b4('0x1f')]===_0xe0b4('0x20')&&typeof _0x5d9bf0['limit']==='undefined';var _0x1b1e3c=_0x54a73a[_0xe0b4('0x21')];var _0x220069=_0x173522?0x0:_0x5d9bf0[_0xe0b4('0x1f')];var _0x1a7e93=_0x173522?_0x54a73a[_0xe0b4('0x21')]:_0x5d9bf0[_0xe0b4('0x1f')]+_0x5d9bf0[_0xe0b4('0x22')];var _0x3fad9e;if(_0x1a7e93>=_0x1b1e3c){_0x1a7e93=_0x1b1e3c;_0x3fad9e=0xc8;}else{_0x3fad9e=0xce;}_0x432fc8[_0xe0b4('0x1c')](_0x3fad9e);return _0x432fc8[_0xe0b4('0x23')]('Content-Range',_0x220069+'-'+_0x1a7e93+'/'+_0x1b1e3c)['json'](_0x54a73a);}return null;};}function patchUpdates(_0x532479){return function(_0x65c20d){try{jsonpatch[_0xe0b4('0x24')](_0x65c20d,_0x532479,!![]);}catch(_0x4276d6){return BPromise[_0xe0b4('0x25')](_0x4276d6);}return _0x65c20d['save']();};}function saveUpdates(_0x1d4adb,_0x2a52c7){return function(_0x5c2332){if(_0x5c2332){return _0x5c2332[_0xe0b4('0x26')](_0x1d4adb)[_0xe0b4('0x27')](function(_0x533106){return _0x533106;});}return null;};}function removeEntity(_0x2d33e0,_0x3a06f6){return function(_0x27a6e1){if(_0x27a6e1){return _0x27a6e1[_0xe0b4('0x28')]()[_0xe0b4('0x27')](function(){_0x2d33e0['status'](0xcc)[_0xe0b4('0x1d')]();});}};}function handleEntityNotFound(_0xf459c,_0x33b99f){return function(_0xa1d4bd){if(!_0xa1d4bd){_0xf459c[_0xe0b4('0x1b')](0x194);}return _0xa1d4bd;};}function handleError(_0x12bb5f,_0x4bb78e){_0x4bb78e=_0x4bb78e||0x1f4;return function(_0x415932){logger[_0xe0b4('0x29')](_0x415932[_0xe0b4('0x2a')]);if(_0x415932[_0xe0b4('0x2b')]){delete _0x415932['name'];}_0x12bb5f[_0xe0b4('0x1c')](_0x4bb78e)[_0xe0b4('0x2c')](_0x415932);};}exports['index']=function(_0x4ae48e,_0x3a8c64){var _0x116622={},_0x2e5796={},_0x29c353={'count':0x0,'rows':[]};var _0x416950=_[_0xe0b4('0x2d')](db[_0xe0b4('0x2e')]['rawAttributes'],function(_0x301cc7){return{'name':_0x301cc7[_0xe0b4('0x2f')],'type':_0x301cc7[_0xe0b4('0x30')][_0xe0b4('0x31')]};});_0x2e5796[_0xe0b4('0x32')]=_['map'](_0x416950,'name');_0x2e5796[_0xe0b4('0x33')]=_[_0xe0b4('0x34')](_0x4ae48e['query']);_0x2e5796['filters']=_[_0xe0b4('0x35')](_0x2e5796[_0xe0b4('0x32')],_0x2e5796[_0xe0b4('0x33')]);_0x116622[_0xe0b4('0x36')]=_[_0xe0b4('0x35')](_0x2e5796['model'],qs['fields'](_0x4ae48e[_0xe0b4('0x33')][_0xe0b4('0x37')]));_0x116622[_0xe0b4('0x36')]=_0x116622[_0xe0b4('0x36')]['length']?_0x116622['attributes']:_0x2e5796[_0xe0b4('0x32')];if(!_0x4ae48e[_0xe0b4('0x33')][_0xe0b4('0x38')]('nolimit')){_0x116622['limit']=qs[_0xe0b4('0x22')](_0x4ae48e['query'][_0xe0b4('0x22')]);_0x116622['offset']=qs[_0xe0b4('0x1f')](_0x4ae48e['query'][_0xe0b4('0x1f')]);}_0x116622[_0xe0b4('0x39')]=qs[_0xe0b4('0x3a')](_0x4ae48e[_0xe0b4('0x33')]['sort']);_0x116622[_0xe0b4('0x3b')]=qs[_0xe0b4('0x3c')](_[_0xe0b4('0x3d')](_0x4ae48e[_0xe0b4('0x33')],_0x2e5796[_0xe0b4('0x3c')]),_0x416950);if(_0x4ae48e['query']['filter']){_0x116622[_0xe0b4('0x3b')]=_[_0xe0b4('0x3e')](_0x116622[_0xe0b4('0x3b')],{'$or':_[_0xe0b4('0x2d')](_0x416950,function(_0x14ca18){if(_0x14ca18[_0xe0b4('0x30')]!==_0xe0b4('0x3f')){var _0x24deb1={};_0x24deb1[_0x14ca18[_0xe0b4('0x2b')]]={'$like':'%'+_0x4ae48e[_0xe0b4('0x33')][_0xe0b4('0x40')]+'%'};return _0x24deb1;}})});}_0x116622=_[_0xe0b4('0x3e')]({},_0x116622,_0x4ae48e[_0xe0b4('0x41')]);var _0xf3e698={'where':_0x116622['where']};return db['ChatGroup'][_0xe0b4('0x21')](_0xf3e698)['then'](function(_0x399b6f){_0x29c353[_0xe0b4('0x21')]=_0x399b6f;if(_0x4ae48e[_0xe0b4('0x33')][_0xe0b4('0x42')]){_0x116622['include']=[{'all':!![]}];}return db[_0xe0b4('0x2e')][_0xe0b4('0x43')](_0x116622);})[_0xe0b4('0x27')](function(_0x29e899){_0x29c353['rows']=_0x29e899;return _0x29c353;})[_0xe0b4('0x27')](respondWithFilteredResult(_0x3a8c64,_0x116622))[_0xe0b4('0x44')](handleError(_0x3a8c64,null));};exports[_0xe0b4('0x45')]=function(_0x47d508,_0x5cf259){var _0x61082e={'raw':!![],'where':{'id':_0x47d508[_0xe0b4('0x46')]['id']}},_0x18aa76={};_0x18aa76[_0xe0b4('0x32')]=_[_0xe0b4('0x34')](db[_0xe0b4('0x2e')]['rawAttributes']);_0x18aa76[_0xe0b4('0x33')]=_['keys'](_0x47d508[_0xe0b4('0x33')]);_0x18aa76[_0xe0b4('0x3c')]=_[_0xe0b4('0x35')](_0x18aa76[_0xe0b4('0x32')],_0x18aa76[_0xe0b4('0x33')]);_0x61082e[_0xe0b4('0x36')]=_[_0xe0b4('0x35')](_0x18aa76[_0xe0b4('0x32')],qs[_0xe0b4('0x37')](_0x47d508['query']['fields']));_0x61082e[_0xe0b4('0x36')]=_0x61082e['attributes'][_0xe0b4('0x47')]?_0x61082e[_0xe0b4('0x36')]:_0x18aa76[_0xe0b4('0x32')];if(_0x47d508[_0xe0b4('0x33')][_0xe0b4('0x42')]){_0x61082e[_0xe0b4('0x48')]=[{'all':!![]}];}_0x61082e=_[_0xe0b4('0x3e')]({},_0x61082e,_0x47d508[_0xe0b4('0x41')]);return db['ChatGroup']['find'](_0x61082e)['then'](handleEntityNotFound(_0x5cf259,null))[_0xe0b4('0x27')](respondWithResult(_0x5cf259,null))['catch'](handleError(_0x5cf259,null));};exports['create']=function(_0xe6e600,_0x23778a){return db[_0xe0b4('0x2e')]['create'](_0xe6e600[_0xe0b4('0x49')],{})['then'](respondWithResult(_0x23778a,0xc9))[_0xe0b4('0x44')](handleError(_0x23778a,null));};exports[_0xe0b4('0x26')]=function(_0x348271,_0x1aa0bf){if(_0x348271['body']['id']){delete _0x348271[_0xe0b4('0x49')]['id'];}return db[_0xe0b4('0x2e')][_0xe0b4('0x4a')]({'where':{'id':_0x348271['params']['id']}})[_0xe0b4('0x27')](handleEntityNotFound(_0x1aa0bf,null))[_0xe0b4('0x27')](saveUpdates(_0x348271[_0xe0b4('0x49')],null))[_0xe0b4('0x27')](respondWithResult(_0x1aa0bf,null))['catch'](handleError(_0x1aa0bf,null));};exports[_0xe0b4('0x28')]=function(_0x34f3a5,_0x540ac7){return db[_0xe0b4('0x2e')]['find']({'where':{'id':_0x34f3a5[_0xe0b4('0x46')]['id']}})['then'](handleEntityNotFound(_0x540ac7,null))[_0xe0b4('0x27')](removeEntity(_0x540ac7,null))['catch'](handleError(_0x540ac7,null));};exports[_0xe0b4('0x4b')]=function(_0x11b03d,_0x2f831b){return db[_0xe0b4('0x2e')][_0xe0b4('0x4b')]()[_0xe0b4('0x27')](respondWithResult(_0x2f831b,null))['catch'](handleError(_0x2f831b,null));};exports[_0xe0b4('0x4c')]=function(_0x1771fe,_0x194136,_0x53bf30){return db[_0xe0b4('0x4d')][_0xe0b4('0x21')]({'where':{'ChatGroupId':_0x1771fe[_0xe0b4('0x46')]['id'],'ToId':_0x1771fe[_0xe0b4('0x4e')]['id'],'read':![]}})[_0xe0b4('0x27')](function(_0x3b7337){return{'id':_[_0xe0b4('0x4f')](_0x1771fe[_0xe0b4('0x46')]['id']),'count':_0x3b7337};})[_0xe0b4('0x27')](respondWithResult(_0x194136,null))[_0xe0b4('0x44')](handleError(_0x194136,null));};exports[_0xe0b4('0x50')]=function(_0x84a5e1,_0x576415,_0x562ac3){return db[_0xe0b4('0x2e')][_0xe0b4('0x4a')]({'where':{'id':_0x84a5e1[_0xe0b4('0x46')]['id']}})[_0xe0b4('0x27')](handleEntityNotFound(_0x576415,null))[_0xe0b4('0x27')](function(_0x3e53f4){if(_0x3e53f4){return _0x3e53f4['addMembers'](_0x84a5e1['body'][_0xe0b4('0x51')],_[_0xe0b4('0x52')](_0x84a5e1[_0xe0b4('0x49')],[_0xe0b4('0x51'),'id'])||{});}})[_0xe0b4('0x27')](respondWithResult(_0x576415,null))[_0xe0b4('0x44')](handleError(_0x576415,null));};exports[_0xe0b4('0x53')]=function(_0x556f72,_0x38dc59,_0x201988){var _0x58feea={};var _0x54a853={};var _0xdd8172;var _0x18fa0e;return db[_0xe0b4('0x2e')][_0xe0b4('0x54')]({'where':{'id':_0x556f72[_0xe0b4('0x46')]['id']}})[_0xe0b4('0x27')](handleEntityNotFound(_0x38dc59,null))[_0xe0b4('0x27')](function(_0x52f26b){if(_0x52f26b){_0xdd8172=_0x52f26b;_0x54a853[_0xe0b4('0x32')]=_[_0xe0b4('0x34')](db[_0xe0b4('0x55')][_0xe0b4('0x56')]);_0x54a853[_0xe0b4('0x33')]=_[_0xe0b4('0x34')](_0x556f72[_0xe0b4('0x33')]);_0x54a853[_0xe0b4('0x3c')]=_[_0xe0b4('0x35')](_0x54a853[_0xe0b4('0x32')],_0x54a853[_0xe0b4('0x33')]);_0x58feea[_0xe0b4('0x36')]=_['intersection'](_0x54a853[_0xe0b4('0x32')],qs['fields'](_0x556f72['query'][_0xe0b4('0x37')]));_0x58feea[_0xe0b4('0x36')]=_0x58feea['attributes'][_0xe0b4('0x47')]?_0x58feea[_0xe0b4('0x36')]:_0x54a853[_0xe0b4('0x32')];_0x58feea[_0xe0b4('0x39')]=qs[_0xe0b4('0x3a')](_0x556f72[_0xe0b4('0x33')][_0xe0b4('0x3a')]);_0x58feea[_0xe0b4('0x3b')]=qs[_0xe0b4('0x3c')](_['pick'](_0x556f72[_0xe0b4('0x33')],_0x54a853[_0xe0b4('0x3c')]));if(_0x556f72['query'][_0xe0b4('0x40')]){_0x58feea[_0xe0b4('0x3b')]=_[_0xe0b4('0x3e')](_0x58feea[_0xe0b4('0x3b')],{'$or':_[_0xe0b4('0x2d')](_0x58feea['attributes'],function(_0x1b6725){var _0x3be9be={};_0x3be9be[_0x1b6725]={'$like':'%'+_0x556f72[_0xe0b4('0x33')][_0xe0b4('0x40')]+'%'};return _0x3be9be;})});}_0x58feea=_[_0xe0b4('0x3e')]({},_0x58feea,_0x556f72[_0xe0b4('0x41')]);return _0xdd8172[_0xe0b4('0x53')](_0x58feea);}})[_0xe0b4('0x27')](function(_0x1b92c2){if(_0x1b92c2){_0x18fa0e=_0x1b92c2[_0xe0b4('0x47')];if(!_0x556f72[_0xe0b4('0x33')]['hasOwnProperty'](_0xe0b4('0x57'))){_0x58feea[_0xe0b4('0x22')]=qs[_0xe0b4('0x22')](_0x556f72[_0xe0b4('0x33')][_0xe0b4('0x22')]);_0x58feea[_0xe0b4('0x1f')]=qs[_0xe0b4('0x1f')](_0x556f72[_0xe0b4('0x33')]['offset']);}return _0xdd8172['getMembers'](_0x58feea);}})[_0xe0b4('0x27')](function(_0x125dd2){if(_0x125dd2){return _0x125dd2?{'count':_0x18fa0e,'rows':_0x125dd2}:null;}})[_0xe0b4('0x27')](respondWithResult(_0x38dc59,null))['catch'](handleError(_0x38dc59,null));};exports['removeMembers']=function(_0x4f456e,_0x7718f5,_0x39bc72){return db[_0xe0b4('0x2e')]['find']({'where':{'id':_0x4f456e['params']['id']}})[_0xe0b4('0x27')](handleEntityNotFound(_0x7718f5,null))[_0xe0b4('0x27')](function(_0x2127f7){if(_0x2127f7){return _0x2127f7[_0xe0b4('0x58')](_0x4f456e['query'][_0xe0b4('0x51')]);}})[_0xe0b4('0x27')](respondWithStatusCode(_0x7718f5,null))[_0xe0b4('0x44')](handleError(_0x7718f5,null));};exports[_0xe0b4('0x59')]=function(_0x476332,_0x3aee75,_0x376ace){if(_0x476332[_0xe0b4('0x49')]['id']){delete _0x476332[_0xe0b4('0x49')]['id'];}return db[_0xe0b4('0x2e')]['find']({'where':{'id':_0x476332['params']['id']}})[_0xe0b4('0x27')](handleEntityNotFound(_0x3aee75,null))[_0xe0b4('0x27')](function(_0x2c521e){if(_0x2c521e){_0x476332['body'][_0xe0b4('0x5a')]=_0x2c521e['id'];return db['ChatInternalMessage'][_0xe0b4('0x5b')](_0x476332['body']);}})['then'](respondWithResult(_0x3aee75,null))[_0xe0b4('0x44')](handleError(_0x3aee75,null));};exports[_0xe0b4('0x5c')]=function(_0x9038a5,_0x21a939,_0x1e9d89){var _0x59f82c={};var _0x2ca12d={};var _0x4bdf99;var _0x136a3d;return db[_0xe0b4('0x2e')][_0xe0b4('0x54')]({'where':{'id':_0x9038a5[_0xe0b4('0x46')]['id']}})[_0xe0b4('0x27')](handleEntityNotFound(_0x21a939,null))[_0xe0b4('0x27')](function(_0x4eb0ed){if(_0x4eb0ed){_0x4bdf99=_0x4eb0ed;_0x2ca12d[_0xe0b4('0x32')]=_['keys'](db[_0xe0b4('0x4d')]['rawAttributes']);_0x2ca12d[_0xe0b4('0x33')]=_[_0xe0b4('0x34')](_0x9038a5[_0xe0b4('0x33')]);_0x2ca12d[_0xe0b4('0x3c')]=_[_0xe0b4('0x35')](_0x2ca12d[_0xe0b4('0x32')],_0x2ca12d['query']);_0x59f82c['attributes']=_[_0xe0b4('0x35')](_0x2ca12d[_0xe0b4('0x32')],qs[_0xe0b4('0x37')](_0x9038a5['query']['fields']));_0x59f82c['attributes']=_0x59f82c[_0xe0b4('0x36')][_0xe0b4('0x47')]?_0x59f82c[_0xe0b4('0x36')]:_0x2ca12d[_0xe0b4('0x32')];_0x59f82c[_0xe0b4('0x39')]=qs['sort'](_0x9038a5[_0xe0b4('0x33')][_0xe0b4('0x3a')]);_0x59f82c[_0xe0b4('0x3b')]=qs['filters'](_['pick'](_0x9038a5[_0xe0b4('0x33')],_0x2ca12d['filters']));if(_0x9038a5['query'][_0xe0b4('0x40')]){_0x59f82c[_0xe0b4('0x3b')]=_[_0xe0b4('0x3e')](_0x59f82c['where'],{'$or':_['map'](_0x59f82c['attributes'],function(_0x46cb1c){var _0x22ca84={};_0x22ca84[_0x46cb1c]={'$like':'%'+_0x9038a5[_0xe0b4('0x33')]['filter']+'%'};return _0x22ca84;})});}if(_0x9038a5[_0xe0b4('0x33')]['$gte']){var _0x352203=_0x9038a5[_0xe0b4('0x33')][_0xe0b4('0x5d')][_0xe0b4('0x5e')](',');var _0x9b9392={};_0x9b9392[_0x352203[0x0]]={'$gte':moment(_0x352203[0x1])['format']('YYYY-MM-DD\x20HH:mm:ss')};_0x59f82c[_0xe0b4('0x3b')]=_[_0xe0b4('0x3e')](_0x59f82c['where'],_0x9b9392);}_0x59f82c=_[_0xe0b4('0x3e')]({},_0x59f82c,_0x9038a5[_0xe0b4('0x41')]);return _0x4bdf99['getMessages'](_0x59f82c);}})[_0xe0b4('0x27')](function(_0x15206d){if(_0x15206d){_0x136a3d=_0x15206d['length'];if(!_0x9038a5[_0xe0b4('0x33')][_0xe0b4('0x38')]('nolimit')){_0x59f82c[_0xe0b4('0x22')]=qs['limit'](_0x9038a5[_0xe0b4('0x33')][_0xe0b4('0x22')]);_0x59f82c[_0xe0b4('0x1f')]=qs[_0xe0b4('0x1f')](_0x9038a5[_0xe0b4('0x33')][_0xe0b4('0x1f')]);}return _0x4bdf99[_0xe0b4('0x5c')](_0x59f82c);}})[_0xe0b4('0x27')](function(_0x29e322){if(_0x29e322){return _0x29e322?{'count':_0x136a3d,'rows':_0x29e322}:null;}})[_0xe0b4('0x27')](respondWithResult(_0x21a939,null))[_0xe0b4('0x44')](handleError(_0x21a939,null));}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.events.js b/server/api/chatGroup/chatGroup.events.js index 97f82e1..cfb1948 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 _0xc76e=['ChatGroup','setMaxListeners','save','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x2aa725,_0x2cebe7){var _0x4bfaae=function(_0x126ccd){while(--_0x126ccd){_0x2aa725['push'](_0x2aa725['shift']());}};_0x4bfaae(++_0x2cebe7);}(_0xc76e,0x10c));var _0xec76=function(_0x2d8d50,_0x29e476){_0x2d8d50=_0x2d8d50-0x0;var _0x3b463b=_0xc76e[_0x2d8d50];return _0x3b463b;};'use strict';var EventEmitter=require(_0xec76('0x0'));var ChatGroup=require(_0xec76('0x1'))['db'][_0xec76('0x2')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0xec76('0x3')](0x0);var events={'afterCreate':_0xec76('0x4'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x1cbc61){return function(_0x1d70c9,_0x539538,_0x38695c){ChatGroupEvents['emit'](_0x1cbc61+':'+_0x1d70c9['id'],_0x1d70c9);ChatGroupEvents[_0xec76('0x5')](_0x1cbc61,_0x1d70c9);_0x38695c(null);};}for(var e in events){if(events[_0xec76('0x6')](e)){var event=events[e];ChatGroup[_0xec76('0x7')](e,emitEvent(event));}}module[_0xec76('0x8')]=ChatGroupEvents; \ No newline at end of file +var _0x2186=['update','remove','emit','events','save'];(function(_0x38569a,_0x1279f2){var _0x5aa538=function(_0xc7747f){while(--_0xc7747f){_0x38569a['push'](_0x38569a['shift']());}};_0x5aa538(++_0x1279f2);}(_0x2186,0x1ca));var _0x6218=function(_0x41c011,_0x49be6f){_0x41c011=_0x41c011-0x0;var _0x2bbb98=_0x2186[_0x41c011];return _0x2bbb98;};'use strict';var EventEmitter=require(_0x6218('0x0'));var ChatGroup=require('../../mysqldb')['db']['ChatGroup'];var ChatGroupEvents=new EventEmitter();ChatGroupEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x6218('0x1'),'afterUpdate':_0x6218('0x2'),'afterDestroy':_0x6218('0x3')};function emitEvent(_0x587b23){return function(_0x10aa49,_0x1bc6b1,_0x2b0e28){ChatGroupEvents[_0x6218('0x4')](_0x587b23+':'+_0x10aa49['id'],_0x10aa49);ChatGroupEvents[_0x6218('0x4')](_0x587b23,_0x10aa49);_0x2b0e28(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatGroup['hook'](e,emitEvent(event));}}module['exports']=ChatGroupEvents; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.model.js b/server/api/chatGroup/chatGroup.model.js index e7bfe52..1459413 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 _0xb9c9=['bluebird','request-promise','path','rimraf','../../config/environment','./chatGroup.attributes','exports','define','ChatGroup','chat_groups','lodash','util','../../config/logger','moment'];(function(_0x44a62c,_0x4c35af){var _0x66fe93=function(_0x44ab47){while(--_0x44ab47){_0x44a62c['push'](_0x44a62c['shift']());}};_0x66fe93(++_0x4c35af);}(_0xb9c9,0x184));var _0x9b9c=function(_0x8aeabf,_0x5b5806){_0x8aeabf=_0x8aeabf-0x0;var _0x578064=_0xb9c9[_0x8aeabf];return _0x578064;};'use strict';var _=require(_0x9b9c('0x0'));var util=require(_0x9b9c('0x1'));var logger=require(_0x9b9c('0x2'))('api');var moment=require(_0x9b9c('0x3'));var BPromise=require(_0x9b9c('0x4'));var rp=require(_0x9b9c('0x5'));var fs=require('fs');var path=require(_0x9b9c('0x6'));var rimraf=require(_0x9b9c('0x7'));var config=require(_0x9b9c('0x8'));var attributes=require(_0x9b9c('0x9'));module[_0x9b9c('0xa')]=function(_0xffe64,_0xf8368c){return _0xffe64[_0x9b9c('0xb')](_0x9b9c('0xc'),attributes,{'tableName':_0x9b9c('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xce54=['../../config/environment','./chatGroup.attributes','exports','define','ChatGroup','chat_groups','lodash','moment','bluebird','request-promise','rimraf'];(function(_0x2503dc,_0x24d155){var _0x317eb8=function(_0x41c240){while(--_0x41c240){_0x2503dc['push'](_0x2503dc['shift']());}};_0x317eb8(++_0x24d155);}(_0xce54,0x1c9));var _0x4ce5=function(_0x34c7f3,_0x530552){_0x34c7f3=_0x34c7f3-0x0;var _0x45f682=_0xce54[_0x34c7f3];return _0x45f682;};'use strict';var _=require(_0x4ce5('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x4ce5('0x1'));var BPromise=require(_0x4ce5('0x2'));var rp=require(_0x4ce5('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4ce5('0x4'));var config=require(_0x4ce5('0x5'));var attributes=require(_0x4ce5('0x6'));module[_0x4ce5('0x7')]=function(_0x4ebfe4,_0x389848){return _0x4ebfe4[_0x4ce5('0x8')](_0x4ce5('0x9'),attributes,{'tableName':_0x4ce5('0xa'),'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 f8f47e5..f4f0a1c 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 _0xb453=['defaults','socket.io-emitter','./chatGroup.socket','register','then','info','ChatGroup,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','util','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis'];(function(_0x249a9b,_0x29db45){var _0x2f17e6=function(_0x1fcbb2){while(--_0x1fcbb2){_0x249a9b['push'](_0x249a9b['shift']());}};_0x2f17e6(++_0x29db45);}(_0xb453,0x1e8));var _0x3b45=function(_0x1c6c0c,_0x5c0cd4){_0x1c6c0c=_0x1c6c0c-0x0;var _0x51cbea=_0xb453[_0x1c6c0c];return _0x51cbea;};'use strict';var _=require(_0x3b45('0x0'));var util=require(_0x3b45('0x1'));var moment=require('moment');var BPromise=require(_0x3b45('0x2'));var rs=require(_0x3b45('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x3b45('0x4'));var logger=require(_0x3b45('0x5'))(_0x3b45('0x6'));var config=require(_0x3b45('0x7'));var jayson=require(_0x3b45('0x8'));var client=jayson[_0x3b45('0x9')][_0x3b45('0xa')]({'port':0x232a});config[_0x3b45('0xb')]=_[_0x3b45('0xc')](config[_0x3b45('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x3b45('0xd'))(new Redis(config[_0x3b45('0xb')]));require(_0x3b45('0xe'))[_0x3b45('0xf')](socket);function respondWithRpcPromise(_0x7f50f1,_0x71e2b0,_0x378cda){return new BPromise(function(_0x4ccbdb,_0x7f9f5b){return client['request'](_0x7f50f1,_0x378cda)[_0x3b45('0x10')](function(_0x336b8b){logger[_0x3b45('0x11')](_0x3b45('0x12'),_0x71e2b0,_0x3b45('0x13'));logger['debug']('ChatGroup,\x20%s,\x20%s,\x20%s',_0x71e2b0,_0x3b45('0x13'),JSON[_0x3b45('0x14')](_0x336b8b));if(_0x336b8b['error']){if(_0x336b8b[_0x3b45('0x15')][_0x3b45('0x16')]===0x1f4){logger[_0x3b45('0x15')](_0x3b45('0x12'),_0x71e2b0,_0x336b8b[_0x3b45('0x15')][_0x3b45('0x17')]);return _0x7f9f5b(_0x336b8b[_0x3b45('0x15')][_0x3b45('0x17')]);}logger[_0x3b45('0x15')](_0x3b45('0x12'),_0x71e2b0,_0x336b8b[_0x3b45('0x15')][_0x3b45('0x17')]);return _0x4ccbdb(_0x336b8b['error']['message']);}else{logger[_0x3b45('0x11')](_0x3b45('0x12'),_0x71e2b0,_0x3b45('0x13'));_0x4ccbdb(_0x336b8b['result']['message']);}})[_0x3b45('0x18')](function(_0x47da1d){logger[_0x3b45('0x15')](_0x3b45('0x12'),_0x71e2b0,_0x47da1d);_0x7f9f5b(_0x47da1d);});});} \ No newline at end of file +var _0x1670=['bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','request','then','info','ChatGroup,\x20%s,\x20%s','request\x20sent','debug','ChatGroup,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','lodash','util'];(function(_0xc5e02a,_0xd9da3c){var _0xbeca77=function(_0x2a7d11){while(--_0x2a7d11){_0xc5e02a['push'](_0xc5e02a['shift']());}};_0xbeca77(++_0xd9da3c);}(_0x1670,0x9a));var _0x0167=function(_0x1c3bb1,_0x5a7c99){_0x1c3bb1=_0x1c3bb1-0x0;var _0xf6cc1d=_0x1670[_0x1c3bb1];return _0xf6cc1d;};'use strict';var _=require(_0x0167('0x0'));var util=require(_0x0167('0x1'));var moment=require('moment');var BPromise=require(_0x0167('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0167('0x3'));var db=require(_0x0167('0x4'))['db'];var utils=require(_0x0167('0x5'));var logger=require(_0x0167('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x0167('0x7'));var client=jayson[_0x0167('0x8')][_0x0167('0x9')]({'port':0x232a});config[_0x0167('0xa')]=_[_0x0167('0xb')](config[_0x0167('0xa')],{'host':_0x0167('0xc'),'port':0x18eb});var socket=require(_0x0167('0xd'))(new Redis(config['redis']));require('./chatGroup.socket')[_0x0167('0xe')](socket);function respondWithRpcPromise(_0x178f5f,_0x2b88ec,_0x1632d4){return new BPromise(function(_0x338288,_0x364dc7){return client[_0x0167('0xf')](_0x178f5f,_0x1632d4)[_0x0167('0x10')](function(_0x257ed6){logger[_0x0167('0x11')](_0x0167('0x12'),_0x2b88ec,_0x0167('0x13'));logger[_0x0167('0x14')](_0x0167('0x15'),_0x2b88ec,'request\x20sent',JSON[_0x0167('0x16')](_0x257ed6));if(_0x257ed6['error']){if(_0x257ed6[_0x0167('0x17')]['code']===0x1f4){logger[_0x0167('0x17')](_0x0167('0x12'),_0x2b88ec,_0x257ed6[_0x0167('0x17')]['message']);return _0x364dc7(_0x257ed6['error']['message']);}logger[_0x0167('0x17')](_0x0167('0x12'),_0x2b88ec,_0x257ed6['error'][_0x0167('0x18')]);return _0x338288(_0x257ed6['error']['message']);}else{logger[_0x0167('0x11')]('ChatGroup,\x20%s,\x20%s',_0x2b88ec,_0x0167('0x13'));_0x338288(_0x257ed6['result'][_0x0167('0x18')]);}})[_0x0167('0x19')](function(_0x170207){logger[_0x0167('0x17')](_0x0167('0x12'),_0x2b88ec,_0x170207);_0x364dc7(_0x170207);});});} \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.socket.js b/server/api/chatGroup/chatGroup.socket.js index b41262a..ad62b6a 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 _0x0bd0=['./chatGroup.events','save','update','emit','register','length'];(function(_0x25bb37,_0x471024){var _0x27cec9=function(_0x317341){while(--_0x317341){_0x25bb37['push'](_0x25bb37['shift']());}};_0x27cec9(++_0x471024);}(_0x0bd0,0x14a));var _0x00bd=function(_0x27a5bb,_0x3f4cfb){_0x27a5bb=_0x27a5bb-0x0;var _0x2e17ea=_0x0bd0[_0x27a5bb];return _0x2e17ea;};'use strict';var ChatGroupEvents=require(_0x00bd('0x0'));var events=[_0x00bd('0x1'),'remove',_0x00bd('0x2')];function createListener(_0x3570b1,_0x57b725){return function(_0x2882e5){_0x57b725[_0x00bd('0x3')](_0x3570b1,_0x2882e5);};}function removeListener(_0x1a96ad,_0x3a00c3){return function(){ChatGroupEvents['removeListener'](_0x1a96ad,_0x3a00c3);};}exports[_0x00bd('0x4')]=function(_0x431040){for(var _0x4699db=0x0,_0x5393ee=events[_0x00bd('0x5')];_0x4699db<_0x5393ee;_0x4699db++){var _0x381b38=events[_0x4699db];var _0xc9214=createListener('chatGroup:'+_0x381b38,_0x431040);ChatGroupEvents['on'](_0x381b38,_0xc9214);}}; \ No newline at end of file +var _0x7182=['save','update','emit','removeListener','length','./chatGroup.events'];(function(_0x16ecd6,_0x23b605){var _0x4c4cf9=function(_0xd85893){while(--_0xd85893){_0x16ecd6['push'](_0x16ecd6['shift']());}};_0x4c4cf9(++_0x23b605);}(_0x7182,0xb9));var _0x2718=function(_0x4d0c0c,_0x4f82e8){_0x4d0c0c=_0x4d0c0c-0x0;var _0x5bbee8=_0x7182[_0x4d0c0c];return _0x5bbee8;};'use strict';var ChatGroupEvents=require(_0x2718('0x0'));var events=[_0x2718('0x1'),'remove',_0x2718('0x2')];function createListener(_0x11e8d1,_0x1f019f){return function(_0x1eb4e9){_0x1f019f[_0x2718('0x3')](_0x11e8d1,_0x1eb4e9);};}function removeListener(_0x2bfc07,_0x37edf7){return function(){ChatGroupEvents[_0x2718('0x4')](_0x2bfc07,_0x37edf7);};}exports['register']=function(_0x570198){for(var _0x2d8340=0x0,_0x3842ce=events[_0x2718('0x5')];_0x2d8340<_0x3842ce;_0x2d8340++){var _0x218771=events[_0x2d8340];var _0x144dbc=createListener('chatGroup:'+_0x218771,_0x570198);ChatGroupEvents['on'](_0x218771,_0x144dbc);}}; \ No newline at end of file diff --git a/server/api/chatGroup/index.js b/server/api/chatGroup/index.js index 8911e4f..b4cf03b 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 _0x2b26=['post','addMessage','put','delete','removeMembers','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatGroup.controller','get','isAuthenticated','index','/describe','/:id','show','getUnread','/:id/members','getMembers','/:id/messages','create','addMembers'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x2b26,0x1c6));var _0x62b2=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2b26[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x62b2('0x0'));var util=require(_0x62b2('0x1'));var path=require(_0x62b2('0x2'));var timeout=require(_0x62b2('0x3'));var express=require('express');var router=express[_0x62b2('0x4')]();var fs_extra=require(_0x62b2('0x5'));var auth=require(_0x62b2('0x6'));var interaction=require(_0x62b2('0x7'));var config=require(_0x62b2('0x8'));var controller=require(_0x62b2('0x9'));router[_0x62b2('0xa')]('/',auth[_0x62b2('0xb')](),controller[_0x62b2('0xc')]);router[_0x62b2('0xa')](_0x62b2('0xd'),auth[_0x62b2('0xb')](),controller['describe']);router['get'](_0x62b2('0xe'),auth[_0x62b2('0xb')](),controller[_0x62b2('0xf')]);router[_0x62b2('0xa')]('/:id/unread',auth[_0x62b2('0xb')](),controller[_0x62b2('0x10')]);router[_0x62b2('0xa')](_0x62b2('0x11'),auth[_0x62b2('0xb')](),controller[_0x62b2('0x12')]);router['get'](_0x62b2('0x13'),auth['isAuthenticated'](),controller['getMessages']);router['post']('/',auth['isAuthenticated'](),controller[_0x62b2('0x14')]);router['post'](_0x62b2('0x11'),auth[_0x62b2('0xb')](),controller[_0x62b2('0x15')]);router[_0x62b2('0x16')](_0x62b2('0x13'),auth[_0x62b2('0xb')](),controller[_0x62b2('0x17')]);router[_0x62b2('0x18')](_0x62b2('0xe'),auth[_0x62b2('0xb')](),controller['update']);router[_0x62b2('0x19')](_0x62b2('0xe'),auth[_0x62b2('0xb')](),controller['destroy']);router[_0x62b2('0x19')](_0x62b2('0x11'),auth[_0x62b2('0xb')](),controller[_0x62b2('0x1a')]);module[_0x62b2('0x1b')]=router; \ No newline at end of file +var _0xcdcc=['getMessages','post','create','addMembers','addMessage','update','delete','destroy','removeMembers','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','isAuthenticated','index','/describe','get','/:id','show','getUnread','/:id/members','getMembers','/:id/messages'];(function(_0x55e58c,_0x5278e9){var _0x32ce31=function(_0x4098d2){while(--_0x4098d2){_0x55e58c['push'](_0x55e58c['shift']());}};_0x32ce31(++_0x5278e9);}(_0xcdcc,0x13e));var _0xccdc=function(_0x5657ed,_0x48f5cb){_0x5657ed=_0x5657ed-0x0;var _0x23b0d8=_0xcdcc[_0x5657ed];return _0x23b0d8;};'use strict';var multer=require(_0xccdc('0x0'));var util=require(_0xccdc('0x1'));var path=require(_0xccdc('0x2'));var timeout=require(_0xccdc('0x3'));var express=require(_0xccdc('0x4'));var router=express['Router']();var fs_extra=require(_0xccdc('0x5'));var auth=require(_0xccdc('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xccdc('0x7'));var controller=require('./chatGroup.controller');router['get']('/',auth[_0xccdc('0x8')](),controller[_0xccdc('0x9')]);router['get'](_0xccdc('0xa'),auth[_0xccdc('0x8')](),controller['describe']);router[_0xccdc('0xb')](_0xccdc('0xc'),auth[_0xccdc('0x8')](),controller[_0xccdc('0xd')]);router[_0xccdc('0xb')]('/:id/unread',auth[_0xccdc('0x8')](),controller[_0xccdc('0xe')]);router['get'](_0xccdc('0xf'),auth[_0xccdc('0x8')](),controller[_0xccdc('0x10')]);router[_0xccdc('0xb')](_0xccdc('0x11'),auth['isAuthenticated'](),controller[_0xccdc('0x12')]);router[_0xccdc('0x13')]('/',auth[_0xccdc('0x8')](),controller[_0xccdc('0x14')]);router[_0xccdc('0x13')](_0xccdc('0xf'),auth[_0xccdc('0x8')](),controller[_0xccdc('0x15')]);router[_0xccdc('0x13')](_0xccdc('0x11'),auth[_0xccdc('0x8')](),controller[_0xccdc('0x16')]);router['put'](_0xccdc('0xc'),auth[_0xccdc('0x8')](),controller[_0xccdc('0x17')]);router[_0xccdc('0x18')](_0xccdc('0xc'),auth['isAuthenticated'](),controller[_0xccdc('0x19')]);router[_0xccdc('0x18')]('/:id/members',auth[_0xccdc('0x8')](),controller[_0xccdc('0x1a')]);module[_0xccdc('0x1b')]=router; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.attributes.js b/server/api/chatInteraction/chatInteraction.attributes.js index 0e9dd89..afb0a5f 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 _0x7334=['out','sequelize','exports','BOOLEAN','star','TEXT','STRING','DATE','long'];(function(_0x462c6d,_0x4b63b2){var _0x4e948f=function(_0x1ff084){while(--_0x1ff084){_0x462c6d['push'](_0x462c6d['shift']());}};_0x4e948f(++_0x4b63b2);}(_0x7334,0x184));var _0x4733=function(_0x299994,_0x53b6d0){_0x299994=_0x299994-0x0;var _0x46ac87=_0x7334[_0x299994];return _0x46ac87;};'use strict';var Sequelize=require(_0x4733('0x0'));module[_0x4733('0x1')]={'closed':{'type':Sequelize[_0x4733('0x2')],'defaultValue':![]},'ratingValue':{'type':Sequelize['INTEGER']},'ratingType':{'type':Sequelize['ENUM'](_0x4733('0x3'),'thumb'),'defaultValue':_0x4733('0x3')},'ratingMessage':{'type':Sequelize[_0x4733('0x4')]},'pathTranscript':{'type':Sequelize[_0x4733('0x4')]},'mailTranscript':{'type':Sequelize[_0x4733('0x5')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0x4733('0x6')]},'disposition':{'type':Sequelize[_0x4733('0x5')]},'secondDisposition':{'type':Sequelize[_0x4733('0x5')]},'thirdDisposition':{'type':Sequelize[_0x4733('0x5')]},'note':{'type':Sequelize[_0x4733('0x5')]},'browserName':{'type':Sequelize[_0x4733('0x5')]},'browserVersion':{'type':Sequelize[_0x4733('0x5')]},'osName':{'type':Sequelize[_0x4733('0x5')]},'osVersion':{'type':Sequelize[_0x4733('0x5')]},'deviceModel':{'type':Sequelize[_0x4733('0x5')]},'deviceVendor':{'type':Sequelize[_0x4733('0x5')]},'deviceType':{'type':Sequelize[_0x4733('0x5')]},'referer':{'type':Sequelize[_0x4733('0x4')]},'customerIp':{'type':Sequelize['STRING']},'formData':{'type':Sequelize[_0x4733('0x4')](_0x4733('0x7'))},'read1stAt':{'type':Sequelize['DATE']},'lastMsgAt':{'type':Sequelize[_0x4733('0x6')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x4733('0x8')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0x4733('0x5')]},'customerPort':{'type':Sequelize[_0x4733('0x5')]},'vidaooSessionId':{'type':Sequelize[_0x4733('0x4')]},'autoreplyExecuted':{'type':Sequelize[_0x4733('0x2')],'defaultValue':![]}}; \ No newline at end of file +var _0x4e81=['DATE','long','ENUM','out','sequelize','exports','BOOLEAN','thumb','star','TEXT','STRING'];(function(_0x1f60c2,_0x361dfd){var _0x2958f8=function(_0x3ecdf6){while(--_0x3ecdf6){_0x1f60c2['push'](_0x1f60c2['shift']());}};_0x2958f8(++_0x361dfd);}(_0x4e81,0x1bc));var _0x14e8=function(_0x52ea08,_0x15d935){_0x52ea08=_0x52ea08-0x0;var _0x28d546=_0x4e81[_0x52ea08];return _0x28d546;};'use strict';var Sequelize=require(_0x14e8('0x0'));module[_0x14e8('0x1')]={'closed':{'type':Sequelize[_0x14e8('0x2')],'defaultValue':![]},'ratingValue':{'type':Sequelize['INTEGER']},'ratingType':{'type':Sequelize['ENUM']('star',_0x14e8('0x3')),'defaultValue':_0x14e8('0x4')},'ratingMessage':{'type':Sequelize[_0x14e8('0x5')]},'pathTranscript':{'type':Sequelize[_0x14e8('0x5')]},'mailTranscript':{'type':Sequelize[_0x14e8('0x6')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0x14e8('0x7')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x14e8('0x6')]},'note':{'type':Sequelize[_0x14e8('0x6')]},'browserName':{'type':Sequelize[_0x14e8('0x6')]},'browserVersion':{'type':Sequelize[_0x14e8('0x6')]},'osName':{'type':Sequelize[_0x14e8('0x6')]},'osVersion':{'type':Sequelize[_0x14e8('0x6')]},'deviceModel':{'type':Sequelize[_0x14e8('0x6')]},'deviceVendor':{'type':Sequelize[_0x14e8('0x6')]},'deviceType':{'type':Sequelize[_0x14e8('0x6')]},'referer':{'type':Sequelize['TEXT']},'customerIp':{'type':Sequelize[_0x14e8('0x6')]},'formData':{'type':Sequelize[_0x14e8('0x5')](_0x14e8('0x8'))},'read1stAt':{'type':Sequelize[_0x14e8('0x7')]},'lastMsgAt':{'type':Sequelize[_0x14e8('0x7')]},'lastMsgDirection':{'type':Sequelize[_0x14e8('0x9')]('in',_0x14e8('0xa')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0x14e8('0x6')]},'customerPort':{'type':Sequelize['STRING']},'vidaooSessionId':{'type':Sequelize[_0x14e8('0x5')]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.controller.js b/server/api/chatInteraction/chatInteraction.controller.js index 5a6c7a4..cdced43 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 _0xae86=['CmContact','agentAlias','%s%d','Visitor','System','agent_fullname','[%s]\x20%s:\x20%s\x0a','MM/DD/YYYY\x20HH:mm:ss','direction','secret','appendFileSync','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','ids','omit','getMessages','hasOwnProperty','findAll','getMyMessages','includeAgent','alias','setTags','spread','emit','chatInteractionTags:save','removeTags','download','root','server','tmp','attachments','firstName','Account','Owner','mkdirSync','YYYY-MM-DD\x20HH:mm:ss','browserName','osName','customerIp','customerPort','N.A.','tail','existsSync','createReadStream','pipe','createWriteStream','lastName','out','renderFile','views','downloadInteraction.ejs','transcript-','.pdf','log','err','unlinkSync','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','fs-extra','lodash','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../components/export/pdf','../../config/license/hardware','api','../../config/utils','../../config/environment','redis','defaults','localhost','socket.io-emitter','./chatInteraction.socket','register','jayson/promise','client','http','request','info','ChatInteraction,\x20%s,\x20%s','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','set','Content-Range','apply','reject','then','name','send','render','merge','contact','agent','interaction','account','map','fullname','TagIds','Tags','split','forEach','waiting','talking','abandoned','UserId','closed','disposition','unmanaged','answered','total','index','rawAttributes','fieldName','model','query','filters','attributes','fields','length','nolimit','order','sort','where','pick','select','field','color','from','tools_tags','u.id','u.fullname','ui.ChatInteractionId','user_has_chat_interactions','left_join','users','u.id\x20=\x20ui.UserId','chat_interactions','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','expr','search','sqlOperator','conditions','find','having','`\x20=\x200','`\x20>\x200','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','type','text','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','body','some','compact','isEmpty','ChatWebsiteId','i.ChatWebsiteId\x20IN\x20?','createdAt','parse','$gte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','isNumeric','i.id\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','Sequelize','QueryTypes','SELECT','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages','contactName','DESC','resolve','i.ChatWebsiteId\x20IS\x20NOT\x20NULL','user','getChatWebsites','i.ChatWebsiteId\x20IS\x20NULL','role','toString','count','sequelize','keyBy','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.lastName','Contact.lastName','Contact.phone','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','ui.ChatInteractionId\x20IN\x20?','ChatInteractionId','push','rows','show','params','keys','ChatInteraction','intersection','includeAll','include','options','create','update','destroy','describe','createVidaooSession','findOne','vidaooApiKey','vidaooTopic','vidaooNote','vidaooMetadata','vidaooEscalation','email','https://api-vidaoo.xcally.com/api/v1/meetings','isNull','follow','metadata','ValidationError','Error\x20in\x20Vidaoo\x20configuration','join_url','ChatMessage','Unable\x20to\x20create\x20Vidaoo\x20session','customUpdate','abandon','abandonInteraction,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','Interaction\x20already\x20assigned','AbandonInteraction','attachmentUpload','originalname','basename','file','mimetype','Attachment','attachmentDownload','Unauthorized','attachId','server/files/attachments/','offline-chat/','join','close','mailTranscript','server/files/chat/upload/','format','transcript-%s.txt','now','pathTranscript','Messages','ChatWebsite'];(function(_0x11c573,_0x9e7c6e){var _0x6b72de=function(_0x2e8a61){while(--_0x2e8a61){_0x11c573['push'](_0x11c573['shift']());}};_0x6b72de(++_0x9e7c6e);}(_0xae86,0x17f));var _0x6ae8=function(_0x2126d9,_0x3d5e60){_0x2126d9=_0x2126d9-0x0;var _0x4a21a3=_0xae86[_0x2126d9];return _0x4a21a3;};'use strict';var emlformat=require(_0x6ae8('0x0'));var rimraf=require(_0x6ae8('0x1'));var zipdir=require(_0x6ae8('0x2'));var jsonpatch=require(_0x6ae8('0x3'));var rp=require(_0x6ae8('0x4'));var moment=require('moment');var BPromise=require(_0x6ae8('0x5'));var Mustache=require('mustache');var util=require('util');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(_0x6ae8('0x6'));var _=require(_0x6ae8('0x7'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x6ae8('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x6ae8('0x9'));var authService=require(_0x6ae8('0xa'));var qs=require(_0x6ae8('0xb'));var as=require(_0x6ae8('0xc'));var pdf=require(_0x6ae8('0xd'));var hardwareService=require(_0x6ae8('0xe'));var logger=require('../../config/logger')(_0x6ae8('0xf'));var utils=require(_0x6ae8('0x10'));var config=require(_0x6ae8('0x11'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x6ae8('0x12')]=_[_0x6ae8('0x13')](config['redis'],{'host':_0x6ae8('0x14'),'port':0x18eb});var socket=require(_0x6ae8('0x15'))(new Redis(config[_0x6ae8('0x12')]));require(_0x6ae8('0x16'))[_0x6ae8('0x17')](socket);var jayson=require(_0x6ae8('0x18'));var client=jayson[_0x6ae8('0x19')][_0x6ae8('0x1a')]({'port':0x232b});var client9004=jayson['client'][_0x6ae8('0x1a')]({'port':0x232c});function respondWithRpcPromise(_0x4dfbc2,_0x47d0a8,_0x4fe339,_0x75ca26){return new BPromise(function(_0x24f76a,_0x87ecc8){var _0x2a7cc8=_0x75ca26||client;return _0x2a7cc8[_0x6ae8('0x1b')](_0x4dfbc2,_0x4fe339)['then'](function(_0x1db5c6){logger[_0x6ae8('0x1c')](_0x6ae8('0x1d'),_0x47d0a8,'request\x20sent');logger[_0x6ae8('0x1e')](_0x6ae8('0x1f'),_0x47d0a8,'request\x20sent',JSON['stringify'](_0x1db5c6));if(_0x1db5c6['error']){if(_0x1db5c6[_0x6ae8('0x20')][_0x6ae8('0x21')]===0x1f4){logger[_0x6ae8('0x20')]('ChatInteraction,\x20%s,\x20%s',_0x47d0a8,_0x1db5c6[_0x6ae8('0x20')][_0x6ae8('0x22')]);return _0x87ecc8(_0x1db5c6[_0x6ae8('0x20')][_0x6ae8('0x22')]);}logger[_0x6ae8('0x20')](_0x6ae8('0x1d'),_0x47d0a8,_0x1db5c6['error'][_0x6ae8('0x22')]);return _0x24f76a(_0x1db5c6[_0x6ae8('0x20')]['message']);}else{logger[_0x6ae8('0x1c')](_0x6ae8('0x1d'),_0x47d0a8,'request\x20sent');_0x24f76a(_0x1db5c6[_0x6ae8('0x23')][_0x6ae8('0x22')]);}})[_0x6ae8('0x24')](function(_0x44922c){logger[_0x6ae8('0x20')](_0x6ae8('0x1d'),_0x47d0a8,_0x44922c);_0x87ecc8(_0x44922c);});});}function respondWithStatusCode(_0x3a79d6,_0x585d94){_0x585d94=_0x585d94||0xcc;return function(_0x1550dc){if(_0x1550dc){return _0x3a79d6[_0x6ae8('0x25')](_0x585d94);}return _0x3a79d6[_0x6ae8('0x26')](_0x585d94)[_0x6ae8('0x27')]();};}function respondWithResult(_0x420558,_0xea629d){_0xea629d=_0xea629d||0xc8;return function(_0x472817){if(_0x472817){return _0x420558[_0x6ae8('0x26')](_0xea629d)[_0x6ae8('0x28')](_0x472817);}};}function respondWithFilteredResult(_0x316ab6,_0x115f1a){return function(_0x58cb46){if(_0x58cb46){var _0x1281f6=typeof _0x115f1a[_0x6ae8('0x29')]===_0x6ae8('0x2a')&&typeof _0x115f1a[_0x6ae8('0x2b')]==='undefined';var _0x41b1bc=_0x58cb46['count'];var _0xadccd9=_0x1281f6?0x0:_0x115f1a['offset'];var _0x33e149=_0x1281f6?_0x58cb46['count']:_0x115f1a[_0x6ae8('0x29')]+_0x115f1a[_0x6ae8('0x2b')];var _0x122b74;if(_0x33e149>=_0x41b1bc){_0x33e149=_0x41b1bc;_0x122b74=0xc8;}else{_0x122b74=0xce;}_0x316ab6[_0x6ae8('0x26')](_0x122b74);return _0x316ab6[_0x6ae8('0x2c')](_0x6ae8('0x2d'),_0xadccd9+'-'+_0x33e149+'/'+_0x41b1bc)['json'](_0x58cb46);}return null;};}function patchUpdates(_0x4a4874){return function(_0x5120c9){try{jsonpatch[_0x6ae8('0x2e')](_0x5120c9,_0x4a4874,!![]);}catch(_0x584280){return BPromise[_0x6ae8('0x2f')](_0x584280);}return _0x5120c9['save']();};}function saveUpdates(_0x140950,_0x3f4e71){return function(_0x3b2716){if(_0x3b2716){return _0x3b2716['update'](_0x140950)[_0x6ae8('0x30')](function(_0x46285c){return _0x46285c;});}return null;};}function removeEntity(_0x3f1722,_0x1416dd){return function(_0x4290a3){if(_0x4290a3){return _0x4290a3['destroy']()[_0x6ae8('0x30')](function(){_0x3f1722['status'](0xcc)[_0x6ae8('0x27')]();});}};}function handleEntityNotFound(_0x437446,_0x349bf9){return function(_0xfb5388){if(!_0xfb5388){_0x437446[_0x6ae8('0x25')](0x194);}return _0xfb5388;};}function handleError(_0x163e49,_0x29c48f){_0x29c48f=_0x29c48f||0x1f4;return function(_0x119d1a){logger[_0x6ae8('0x20')](_0x119d1a['stack']);if(_0x119d1a[_0x6ae8('0x31')]){delete _0x119d1a[_0x6ae8('0x31')];}_0x163e49[_0x6ae8('0x26')](_0x29c48f)[_0x6ae8('0x32')](_0x119d1a);};}function getMustacheRender(_0x364682,_0x4d9cb7){return Mustache[_0x6ae8('0x33')](_0x364682,_[_0x6ae8('0x34')](_0x4d9cb7['body'],{'contact':_0x4d9cb7[_0x6ae8('0x35')],'message':_0x4d9cb7[_0x6ae8('0x22')],'agent':_0x4d9cb7[_0x6ae8('0x36')],'interaction':_0x4d9cb7[_0x6ae8('0x37')],'account':_0x4d9cb7[_0x6ae8('0x38')]}))||'';}function getInteractionUsers(_0x1360ab,_0x82f4b7){return new BPromise(function(_0xf41ba8,_0x4278e5){try{if(_0x82f4b7[_0x1360ab['id']]){_0x1360ab['Users']=_[_0x6ae8('0x39')](_0x82f4b7[_0x1360ab['id']],function(_0x25be4b){return{'id':_0x25be4b['id'],'fullname':_0x25be4b[_0x6ae8('0x3a')]};});}}catch(_0xe69d7e){_0x4278e5(_0xe69d7e);}_0xf41ba8(_0x1360ab);});}function getInteractionTags(_0x294cbd,_0x434a02){return new BPromise(function(_0x1a5217,_0x44ed48){try{if(_0x294cbd[_0x6ae8('0x3b')]){_0x294cbd[_0x6ae8('0x3c')]=[];_0x294cbd['TagIds'][_0x6ae8('0x3d')](',')[_0x6ae8('0x3e')](function(_0x564c87){_0x294cbd['Tags']['push'](_0x434a02[_0x564c87]);});}delete _0x294cbd[_0x6ae8('0x3b')];}catch(_0xb04ae8){_0x44ed48(_0xb04ae8);}_0x1a5217(_0x294cbd);});}function updateChatInteraction(_0x3158b6,_0x207780,_0x2dbe95){return new BPromise(function(_0x5ab712,_0x75a73a){return getInteractionUsers(_0x3158b6,_0x2dbe95)[_0x6ae8('0x30')](function(_0x97b6ab){return getInteractionTags(_0x97b6ab,_0x207780);})[_0x6ae8('0x30')](function(_0x37c6fe){return getStateInteraction(_0x37c6fe);})[_0x6ae8('0x30')](function(_0x2e86bb){_0x5ab712(_0x2e86bb);})[_0x6ae8('0x24')](function(_0x1afe66){_0x75a73a(_0x1afe66);});});}function getStateInteraction(_0x7efcd1){return new BPromise(function(_0x21594e){_0x7efcd1[_0x6ae8('0x3f')]=0x0;_0x7efcd1[_0x6ae8('0x40')]=0x0;_0x7efcd1['answered']=0x0;_0x7efcd1['unmanaged']=0x0;_0x7efcd1[_0x6ae8('0x41')]=0x0;_0x7efcd1['total']=0x0;if(!_0x7efcd1['closed']&&!_0x7efcd1[_0x6ae8('0x42')]){_0x7efcd1[_0x6ae8('0x3f')]+=0x1;}if(!_0x7efcd1[_0x6ae8('0x43')]&&_0x7efcd1[_0x6ae8('0x42')]){_0x7efcd1[_0x6ae8('0x40')]+=0x1;if(_0x7efcd1[_0x6ae8('0x3f')]){_0x7efcd1['waiting']-=0x1;}}if(_0x7efcd1[_0x6ae8('0x43')]&&_0x7efcd1[_0x6ae8('0x44')]===_0x6ae8('0x41')){_0x7efcd1[_0x6ae8('0x41')]+=0x1;if(_0x7efcd1[_0x6ae8('0x3f')]){_0x7efcd1['waiting']-=0x1;}}else if(_0x7efcd1[_0x6ae8('0x43')]&&!_0x7efcd1[_0x6ae8('0x42')]&&_0x7efcd1[_0x6ae8('0x44')]){_0x7efcd1[_0x6ae8('0x45')]+=0x1;if(_0x7efcd1[_0x6ae8('0x3f')]){_0x7efcd1['waiting']-=0x1;}}else if(_0x7efcd1[_0x6ae8('0x43')]&&_0x7efcd1['UserId']){_0x7efcd1[_0x6ae8('0x46')]+=0x1;if(_0x7efcd1['talking']){_0x7efcd1[_0x6ae8('0x40')]-=0x1;}}_0x7efcd1[_0x6ae8('0x47')]+=0x1;_0x21594e(_0x7efcd1);});}exports[_0x6ae8('0x48')]=function(_0x4b603a,_0x4aae33){var _0x4f2f67={},_0x4bc9fa={},_0x19a513={'count':0x0,'rows':[]};var _0xd43cea=_['map'](db['ChatInteraction'][_0x6ae8('0x49')],function(_0x58ef38){return{'name':_0x58ef38[_0x6ae8('0x4a')],'type':_0x58ef38['type']['key']};});_0x4bc9fa[_0x6ae8('0x4b')]=_['map'](_0xd43cea,_0x6ae8('0x31'));_0x4bc9fa[_0x6ae8('0x4c')]=_['keys'](_0x4b603a['query']);_0x4bc9fa[_0x6ae8('0x4d')]=_['intersection'](_0x4bc9fa[_0x6ae8('0x4b')],_0x4bc9fa[_0x6ae8('0x4c')]);_0x4f2f67[_0x6ae8('0x4e')]=_['intersection'](_0x4bc9fa['model'],qs[_0x6ae8('0x4f')](_0x4b603a[_0x6ae8('0x4c')][_0x6ae8('0x4f')]));_0x4f2f67[_0x6ae8('0x4e')]=_0x4f2f67[_0x6ae8('0x4e')][_0x6ae8('0x50')]?_0x4f2f67[_0x6ae8('0x4e')]:_0x4bc9fa['model'];if(!_0x4b603a[_0x6ae8('0x4c')]['hasOwnProperty'](_0x6ae8('0x51'))){_0x4f2f67['limit']=qs['limit'](_0x4b603a[_0x6ae8('0x4c')]['limit']);_0x4f2f67[_0x6ae8('0x29')]=qs['offset'](_0x4b603a[_0x6ae8('0x4c')]['offset']);}_0x4f2f67[_0x6ae8('0x52')]=qs[_0x6ae8('0x53')](_0x4b603a[_0x6ae8('0x4c')][_0x6ae8('0x53')]);_0x4f2f67[_0x6ae8('0x54')]=qs['filters'](_[_0x6ae8('0x55')](_0x4b603a[_0x6ae8('0x4c')],_0x4bc9fa[_0x6ae8('0x4d')]),_0xd43cea);var _0x5844ce=[];var _0x321eda=squel[_0x6ae8('0x56')]()[_0x6ae8('0x57')]('id')['field'](_0x6ae8('0x31'))[_0x6ae8('0x57')](_0x6ae8('0x58'))[_0x6ae8('0x59')](_0x6ae8('0x5a'));var _0x2c6f9b=squel[_0x6ae8('0x56')]()[_0x6ae8('0x57')](_0x6ae8('0x5b'))[_0x6ae8('0x57')](_0x6ae8('0x5c'))[_0x6ae8('0x57')](_0x6ae8('0x5d'))[_0x6ae8('0x59')](_0x6ae8('0x5e'),'ui')[_0x6ae8('0x5f')](_0x6ae8('0x60'),'u',_0x6ae8('0x61'));var _0x465d3c=squel[_0x6ae8('0x56')]()[_0x6ae8('0x59')](_0x6ae8('0x62'),'i')[_0x6ae8('0x5f')]('cm_contacts','c',_0x6ae8('0x63'))[_0x6ae8('0x5f')](_0x6ae8('0x60'),'o',_0x6ae8('0x64'))[_0x6ae8('0x5f')](_0x6ae8('0x65'),'a',_0x6ae8('0x66'))[_0x6ae8('0x5f')](_0x6ae8('0x67'),'me',_0x6ae8('0x68'))['left_join'](_0x6ae8('0x69'),'it','it.ChatInteractionId\x20=\x20i.id')[_0x6ae8('0x5f')](_0x6ae8('0x5a'),'t','t.id\x20=\x20it.TagId');var _0x822173=squel[_0x6ae8('0x6a')]();var _0x522618=[];var _0x244e86=squel[_0x6ae8('0x6a')]();var _0x3e57e3;if(_0x4b603a[_0x6ae8('0x4c')][_0x6ae8('0x6b')]){_0x3e57e3=as['parseSearch'](_0x4b603a[_0x6ae8('0x4c')]['search']);var _0x25b86c=_0x3e57e3[_0x6ae8('0x6c')];for(var _0x49c74e=0x0;_0x49c74e<_0x3e57e3['conditions']['length'];_0x49c74e++){var _0x40a745=_0x3e57e3[_0x6ae8('0x6d')][_0x49c74e];var _0x1f9b93='i';var _0x338aad=_[_0x6ae8('0x6e')](_0xd43cea,['name',_0x40a745[_0x6ae8('0x57')]]);if(!_0x338aad){switch(_0x40a745[_0x6ae8('0x57')]){case'unreadMessages':if(_0x40a745['value']==0x1){_0x465d3c[_0x6ae8('0x6f')]('`'+_0x40a745[_0x6ae8('0x57')]+_0x6ae8('0x70'));}else{_0x465d3c[_0x6ae8('0x6f')]('`'+_0x40a745[_0x6ae8('0x57')]+_0x6ae8('0x71'));}break;case _0x6ae8('0x72'):if(_0x40a745[_0x6ae8('0x73')]===_0x6ae8('0x74')){if(_0x40a745[_0x6ae8('0x75')][_0x6ae8('0x3d')]('\x20')['length']>0x1){_0x822173[_0x25b86c](_0x6ae8('0x76'),qs[_0x6ae8('0x77')](_0x40a745[_0x6ae8('0x75')]),null);}else{var _0x17a6e8='%'+_0x40a745[_0x6ae8('0x75')]+'%';_0x822173[_0x25b86c](_0x6ae8('0x78'),_0x17a6e8,_0x17a6e8,_0x17a6e8);}}else{_0x338aad=_[_0x6ae8('0x6e')](_0xd43cea,[_0x6ae8('0x31'),_0x6ae8('0x79')]);_0x40a745['field']='ContactId';_0x50c1d4=as[_0x6ae8('0x7a')](_0x1f9b93,_0x338aad[_0x6ae8('0x7b')],_0x40a745);_0x822173[_0x25b86c](_0x50c1d4[_0x6ae8('0x7c')],_0x50c1d4[_0x6ae8('0x75')][_0x6ae8('0x7d')],_0x50c1d4[_0x6ae8('0x75')][_0x6ae8('0x27')]);}break;case _0x6ae8('0x7e'):var _0x93b90=_0x40a745[_0x6ae8('0x75')]['split'](',')[_0x6ae8('0x39')](function(_0x442983){return Number(_0x442983);});_0x93b90[_0x6ae8('0x3e')](function(_0xb8c6e7){_0x244e86['or'](_0x6ae8('0x7f'),'%,'+_0xb8c6e7+',%');});_0x522618=_[_0x6ae8('0x80')](_0x522618,_0x93b90);break;case _0x6ae8('0x81'):if(_0x40a745[_0x6ae8('0x73')]===_0x6ae8('0x74')){_0x822173[_0x25b86c]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x40a745[_0x6ae8('0x75')]+'%',null);}else{_0x338aad=_[_0x6ae8('0x6e')](_0xd43cea,[_0x6ae8('0x31'),'UserId']);_0x40a745['field']=_0x6ae8('0x42');_0x50c1d4=as[_0x6ae8('0x7a')](_0x1f9b93,_0x338aad[_0x6ae8('0x7b')],_0x40a745);_0x822173[_0x25b86c](_0x50c1d4['text'],_0x50c1d4['value'][_0x6ae8('0x7d')],_0x50c1d4[_0x6ae8('0x75')][_0x6ae8('0x27')]);}break;case _0x6ae8('0x82'):_0x50c1d4=as[_0x6ae8('0x7a')]('me',null,_0x40a745);_0x822173[_0x25b86c](_0x50c1d4[_0x6ae8('0x7c')],_0x50c1d4[_0x6ae8('0x75')][_0x6ae8('0x7d')],_0x50c1d4[_0x6ae8('0x75')]['end']);break;}}else{var _0x50c1d4=as[_0x6ae8('0x7a')](_0x1f9b93,_0x338aad[_0x6ae8('0x7b')],_0x40a745);_0x822173[_0x25b86c](_0x50c1d4['text'],_0x50c1d4[_0x6ae8('0x75')][_0x6ae8('0x7d')],_0x50c1d4[_0x6ae8('0x75')][_0x6ae8('0x27')]);}}}else{var _0x2d644f=_(_0x4b603a[_0x6ae8('0x4c')])['keys']()[_0x6ae8('0x39')](function(_0x3d1c30){return _[_0x6ae8('0x83')](_0xd43cea,[_0x6ae8('0x31'),_0x3d1c30])?_0x3d1c30:undefined;})[_0x6ae8('0x84')]()[_0x6ae8('0x75')]();if(!_[_0x6ae8('0x85')](_0x2d644f)){_0x2d644f[_0x6ae8('0x3e')](function(_0x2b931d){if(_0x2b931d===_0x6ae8('0x86')){_0x465d3c[_0x6ae8('0x54')](_0x6ae8('0x87'),[]['concat'](_0x4b603a[_0x6ae8('0x4c')][_0x2b931d]));}else if(_0x2b931d===_0x6ae8('0x88')){var _0x75e5f7=JSON[_0x6ae8('0x89')](_0x4b603a[_0x6ae8('0x4c')][_0x2b931d])[_0x6ae8('0x8a')];var _0x2d7759=JSON['parse'](_0x4b603a[_0x6ae8('0x4c')][_0x2b931d])['$lte'];_0x465d3c['where'](_0x6ae8('0x8b'),_0x75e5f7,_0x2d7759);}else{if(_0x4b603a[_0x6ae8('0x4c')][_0x2b931d]==='null'){_0x465d3c[_0x6ae8('0x54')]('i.'+_0x2b931d+'\x20IS\x20NULL');}else{_0x465d3c['where']('i.'+_0x2b931d+'\x20=\x20?',_0x4b603a[_0x6ae8('0x4c')][_0x2b931d]);}}});}if(_0x4b603a[_0x6ae8('0x4c')]['read']){if(_0x4b603a[_0x6ae8('0x4c')][_0x6ae8('0x8c')]==0x1){_0x465d3c[_0x6ae8('0x6f')](_0x6ae8('0x8d'));}else{_0x465d3c[_0x6ae8('0x6f')](_0x6ae8('0x8e'));}}if(_0x4b603a[_0x6ae8('0x4c')][_0x6ae8('0x8f')]){_0x522618=_[_0x6ae8('0x90')](_0x4b603a[_0x6ae8('0x4c')]['tag'])?_0x4b603a['query'][_0x6ae8('0x8f')]:new Array(_0x4b603a[_0x6ae8('0x4c')]['tag']);_0x522618[_0x6ae8('0x3e')](function(_0x322a24){_0x244e86['or'](_0x6ae8('0x7f'),'%,'+_0x322a24+',%');});}if(_0x4b603a[_0x6ae8('0x4c')][_0x6ae8('0x91')]){var _0x388b65=_0x4b603a['query'][_0x6ae8('0x91')][_0x6ae8('0x92')]('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs[_0x6ae8('0x93')](_0x388b65)){_0x822173['or'](_0x6ae8('0x94'),_0x388b65+'%');}else{_0x822173['or'](_0x6ae8('0x95'),qs[_0x6ae8('0x77')](_0x388b65))['or'](_0x6ae8('0x96'),_0x388b65+'%');}}}_0x465d3c[_0x6ae8('0x54')](_0x822173);_0x465d3c[_0x6ae8('0x97')](_0x6ae8('0x98'));var _0x4d5ee1={'type':db[_0x6ae8('0x99')][_0x6ae8('0x9a')][_0x6ae8('0x9b')],'raw':!![]};var _0x1e6af5=_0x465d3c['clone']();_0x1e6af5[_0x6ae8('0x57')](_0x6ae8('0x98'));_0x1e6af5[_0x6ae8('0x57')](_0x6ae8('0x9c'),_0x6ae8('0x9d'));if(_0x4f2f67['order']){_0x4f2f67[_0x6ae8('0x52')][_0x6ae8('0x3e')](function(_0x590334){var _0x329300=_0x590334[0x0]===_0x6ae8('0x9e')?_0x590334[0x0]:'i.'+_0x590334[0x0];_0x465d3c[_0x6ae8('0x52')](_0x329300,_0x590334[0x1]===_0x6ae8('0x9f')?![]:!![]);});}if(!_[_0x6ae8('0x85')](_0x522618)){_0x465d3c[_0x6ae8('0x6f')](_0x244e86);_0x1e6af5[_0x6ae8('0x54')]('t.id\x20IN\x20?',_0x522618);}BPromise[_0x6ae8('0xa0')]()['then'](function(){if(!_0x3e57e3){if(_0x4b603a[_0x6ae8('0x4c')][_0x6ae8('0x86')])return;_0x1e6af5[_0x6ae8('0x54')](_0x6ae8('0xa1'));_0x465d3c[_0x6ae8('0x54')](_0x6ae8('0xa1'));return;}if(_0x4b603a['user']['role']!==_0x6ae8('0x36'))return;return _0x4b603a[_0x6ae8('0xa2')][_0x6ae8('0xa3')]({'attributes':['id'],'raw':!![]})['then'](function(_0x401662){if(_[_0x6ae8('0x85')](_0x401662)){_0x1e6af5[_0x6ae8('0x54')](_0x6ae8('0xa4'));_0x465d3c[_0x6ae8('0x54')]('i.ChatWebsiteId\x20IS\x20NULL');}else{_0x1e6af5['where']('i.ChatWebsiteId\x20IN\x20?',_[_0x6ae8('0x39')](_0x401662,'id'));_0x465d3c[_0x6ae8('0x54')]('i.ChatWebsiteId\x20IN\x20?',_['map'](_0x401662,'id'));}});})[_0x6ae8('0x30')](function(){if(_0x4b603a['user'][_0x6ae8('0xa5')]==='agent'&&!_0x3e57e3&&!_0x4b603a[_0x6ae8('0x4c')]['ChatWebsiteId'])return[];return db['sequelize'][_0x6ae8('0x4c')](_0x1e6af5[_0x6ae8('0xa6')](),_0x4d5ee1);})[_0x6ae8('0x30')](function(_0x42e0f8){_0x19a513[_0x6ae8('0xa7')]=_0x42e0f8[_0x6ae8('0x50')];if(_0x19a513[_0x6ae8('0xa7')]===0x0)return[];return db[_0x6ae8('0xa8')][_0x6ae8('0x4c')](_0x321eda[_0x6ae8('0xa6')](),_0x4d5ee1)[_0x6ae8('0x30')](function(_0x4d86be){_0x5844ce=_[_0x6ae8('0xa9')](_0x4d86be,'id');_0x4d5ee1=_[_0x6ae8('0x34')](_0x4d5ee1,{'model':db['ChatInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x4b603a[_0x6ae8('0x4c')]['fields']){_0x4f2f67[_0x6ae8('0x4e')]['forEach'](function(_0x331a3d){_0x465d3c[_0x6ae8('0x57')]('i.'+_0x331a3d);});}else{_0x465d3c[_0x6ae8('0x57')](_0x6ae8('0x9c'),_0x6ae8('0x9d'));_0x465d3c['field'](_0x6ae8('0xaa'),_0x6ae8('0xab'));_0x465d3c[_0x6ae8('0x57')](_0x6ae8('0xac'),'Account.mandatoryDisposition');_0x465d3c['field'](_0x6ae8('0xad'),_0x6ae8('0x9e'));_0x465d3c['field'](_0x6ae8('0xae'));_0x465d3c[_0x6ae8('0x57')]('c.firstName','Contact.firstName');_0x465d3c[_0x6ae8('0x57')](_0x6ae8('0xaf'),_0x6ae8('0xb0'));_0x465d3c[_0x6ae8('0x57')]('c.email','Contact.email');_0x465d3c[_0x6ae8('0x57')]('c.phone',_0x6ae8('0xb1'));_0x465d3c[_0x6ae8('0x57')]('c.mobile',_0x6ae8('0xb2'));_0x465d3c[_0x6ae8('0x57')](_0x6ae8('0xb3'),_0x6ae8('0xb4'));_0x465d3c[_0x6ae8('0x57')](_0x6ae8('0xb5'),_0x6ae8('0xb6'));_0x465d3c[_0x6ae8('0x57')](_0x6ae8('0xb7'),_0x6ae8('0xb8'));_0x465d3c[_0x6ae8('0x57')]('GROUP_CONCAT(DISTINCT\x20t.id)',_0x6ae8('0x3b'));}if(_0x4f2f67[_0x6ae8('0x2b')])_0x465d3c[_0x6ae8('0x2b')](_0x4f2f67[_0x6ae8('0x2b')]);if(_0x4f2f67[_0x6ae8('0x29')])_0x465d3c['offset'](_0x4f2f67[_0x6ae8('0x29')]);return db[_0x6ae8('0xa8')]['query'](_0x465d3c[_0x6ae8('0xa6')](),_0x4d5ee1);})[_0x6ae8('0x30')](function(_0x4c31b7){if(_0x4c31b7[_0x6ae8('0x50')]>0x0)_0x2c6f9b[_0x6ae8('0x54')](_0x6ae8('0xb9'),_['map'](_0x4c31b7,'id'));return db[_0x6ae8('0xa8')][_0x6ae8('0x4c')](_0x2c6f9b[_0x6ae8('0xa6')](),_0x4d5ee1)[_0x6ae8('0x30')](function(_0x12ffa9){var _0x156cca=_['groupBy'](_0x12ffa9,_0x6ae8('0xba'));var _0x4fe4c7=[];_0x4c31b7[_0x6ae8('0x3e')](function(_0x59d62e){_0x4fe4c7[_0x6ae8('0xbb')](updateChatInteraction(_0x59d62e,_0x5844ce,_0x156cca));});return BPromise['all'](_0x4fe4c7);});});})['then'](function(_0x28b04f){_0x19a513[_0x6ae8('0xbc')]=_0x28b04f;return _0x19a513;})[_0x6ae8('0x30')](respondWithFilteredResult(_0x4aae33,_0x4f2f67))[_0x6ae8('0x24')](handleError(_0x4aae33,null));};exports[_0x6ae8('0xbd')]=function(_0x17f8cf,_0x353740){var _0x4e48dc={'raw':![],'where':{'id':_0x17f8cf[_0x6ae8('0xbe')]['id']}},_0x3216c4={};_0x3216c4[_0x6ae8('0x4b')]=_[_0x6ae8('0xbf')](db[_0x6ae8('0xc0')][_0x6ae8('0x49')]);_0x3216c4[_0x6ae8('0x4c')]=_[_0x6ae8('0xbf')](_0x17f8cf[_0x6ae8('0x4c')]);_0x3216c4['filters']=_[_0x6ae8('0xc1')](_0x3216c4[_0x6ae8('0x4b')],_0x3216c4[_0x6ae8('0x4c')]);_0x4e48dc['attributes']=_['intersection'](_0x3216c4[_0x6ae8('0x4b')],qs['fields'](_0x17f8cf['query']['fields']));_0x4e48dc[_0x6ae8('0x4e')]=_0x4e48dc['attributes'][_0x6ae8('0x50')]?_0x4e48dc['attributes']:_0x3216c4[_0x6ae8('0x4b')];if(_0x17f8cf['query'][_0x6ae8('0xc2')]){_0x4e48dc[_0x6ae8('0xc3')]=[{'all':!![]}];}_0x4e48dc=_[_0x6ae8('0x34')]({},_0x4e48dc,_0x17f8cf[_0x6ae8('0xc4')]);return db[_0x6ae8('0xc0')][_0x6ae8('0x6e')](_0x4e48dc)[_0x6ae8('0x30')](handleEntityNotFound(_0x353740,null))['then'](respondWithResult(_0x353740,null))[_0x6ae8('0x24')](handleError(_0x353740,null));};exports[_0x6ae8('0xc5')]=function(_0xccbb28,_0x1a8c0f){return db[_0x6ae8('0xc0')][_0x6ae8('0xc5')](_0xccbb28[_0x6ae8('0x82')],{})['then'](respondWithResult(_0x1a8c0f,0xc9))[_0x6ae8('0x24')](handleError(_0x1a8c0f,null));};exports[_0x6ae8('0xc6')]=function(_0xf53598,_0x1565bb){if(_0xf53598[_0x6ae8('0x82')]['id']){delete _0xf53598[_0x6ae8('0x82')]['id'];}return db[_0x6ae8('0xc0')][_0x6ae8('0x6e')]({'where':{'id':_0xf53598[_0x6ae8('0xbe')]['id']}})[_0x6ae8('0x30')](handleEntityNotFound(_0x1565bb,null))[_0x6ae8('0x30')](saveUpdates(_0xf53598[_0x6ae8('0x82')],null))['then'](respondWithResult(_0x1565bb,null))[_0x6ae8('0x24')](handleError(_0x1565bb,null));};exports[_0x6ae8('0xc7')]=function(_0x4b93bd,_0x232b88){return db[_0x6ae8('0xc0')][_0x6ae8('0x6e')]({'where':{'id':_0x4b93bd['params']['id']}})[_0x6ae8('0x30')](handleEntityNotFound(_0x232b88,null))[_0x6ae8('0x30')](removeEntity(_0x232b88,null))['catch'](handleError(_0x232b88,null));};exports[_0x6ae8('0xc8')]=function(_0x3d3be6,_0x24ee21){return db['ChatInteraction'][_0x6ae8('0xc8')]()[_0x6ae8('0x30')](respondWithResult(_0x24ee21,null))[_0x6ae8('0x24')](handleError(_0x24ee21,null));};exports[_0x6ae8('0xc9')]=function(_0x1e7a7f,_0x2db673){var _0x5e0828=_0x1e7a7f[_0x6ae8('0xbe')]['id'];var _0x44477d;var _0x15a1a1;var _0x2553fa;return db[_0x6ae8('0xc0')][_0x6ae8('0xca')]({'where':{'id':_0x5e0828}})[_0x6ae8('0x30')](function(_0x63534c){_0x44477d=_0x63534c;return db['ChatWebsite'][_0x6ae8('0xca')]({'where':{'id':_0x63534c['ChatWebsiteId']},'attributes':['id',_0x6ae8('0xcb'),'vidaooEscalation',_0x6ae8('0xcc'),_0x6ae8('0xcd'),_0x6ae8('0xce')],'raw':!![]});})[_0x6ae8('0x30')](function(_0x510d7f){if(_0x510d7f&&_0x510d7f[_0x6ae8('0xcb')]&&_0x510d7f[_0x6ae8('0xcf')]){_0x15a1a1=_0x510d7f;var _0x54a0e6={'interaction':{'id':_0x5e0828},'agent':{'id':_0x1e7a7f[_0x6ae8('0xa2')]['id'],'name':_0x1e7a7f[_0x6ae8('0xa2')][_0x6ae8('0x31')],'fullname':_0x1e7a7f[_0x6ae8('0xa2')][_0x6ae8('0x3a')],'email':_0x1e7a7f['user'][_0x6ae8('0xd0')]},'contact':_0x1e7a7f['body'][_0x6ae8('0x35')],'account':_0x1e7a7f[_0x6ae8('0x82')][_0x6ae8('0x38')]};var _0xd17272={'rejectUnauthorized':![],'method':'POST','url':_0x6ae8('0xd1'),'headers':{'X-APIKEY':_0x510d7f[_0x6ae8('0xcb')]},'body':{'duration':null,'scheduledAt':null,'participants':[_0x1e7a7f[_0x6ae8('0xa2')]['email']],'buttons':null,'topic':_0x15a1a1['vidaooTopic'],'note':_[_0x6ae8('0xd2')](_0x15a1a1[_0x6ae8('0xcd')])?null:getMustacheRender(_0x15a1a1[_0x6ae8('0xcd')],_0x54a0e6),'metadata':null},'redirect':_0x6ae8('0xd3'),'json':!![]};try{if(!_[_0x6ae8('0xd2')](_0x15a1a1['vidaooMetadata'])){var _0x69a602=getMustacheRender(_0x15a1a1['vidaooMetadata'],_0x54a0e6);var _0x2c47d9=JSON[_0x6ae8('0x89')](_0x69a602);_0xd17272[_0x6ae8('0x82')][_0x6ae8('0xd4')]=_0x2c47d9;}}catch(_0x45c417){throw new db['Sequelize'][(_0x6ae8('0xd5'))]('Error\x20in\x20conversion\x20vidaooMetadata');}return rp(_0xd17272);}else{throw new db[(_0x6ae8('0x99'))][(_0x6ae8('0xd5'))](_0x6ae8('0xd6'));}})[_0x6ae8('0x30')](function(_0x5b5a2b){_0x2553fa=_0x5b5a2b;if(_0x2553fa['id']){var _0x2a1276={'body':_0x2553fa[_0x6ae8('0xd7')],'ChatWebsiteId':_0x15a1a1['id'],'ChatInteractionId':_0x44477d['id'],'direction':'out','UserId':_0x1e7a7f['user']['id']};return db[_0x6ae8('0xd8')]['create'](_0x2a1276,{});}else{throw new db['Sequelize'][(_0x6ae8('0xd5'))](_0x6ae8('0xd9'));}})['then'](function(){return _0x44477d['updateAttributes']({'vidaooSessionId':_0x2553fa['id']});})[_0x6ae8('0x30')](respondWithResult(_0x2db673,null))['catch'](handleError(_0x2db673,null));};exports[_0x6ae8('0xda')]=function(_0x2f88c9,_0x5f4c43){if(_0x2f88c9[_0x6ae8('0x82')]['id']){delete _0x2f88c9[_0x6ae8('0x82')]['id'];}return db[_0x6ae8('0xc0')][_0x6ae8('0x6e')]({'where':{'id':_0x2f88c9[_0x6ae8('0xbe')]['id']},'include':[{'model':db['CmContact'],'as':'Contact'}]})[_0x6ae8('0x30')](handleEntityNotFound(_0x5f4c43,null))[_0x6ae8('0x30')](saveUpdates(_0x2f88c9[_0x6ae8('0x82')],null))[_0x6ae8('0x30')](respondWithResult(_0x5f4c43,null))[_0x6ae8('0x24')](handleError(_0x5f4c43,null));};exports[_0x6ae8('0xdb')]=function(_0x3a42f4,_0x25c7f4,_0xf29491){if(_0x3a42f4['body']['id']){delete _0x3a42f4['body']['id'];}return db[_0x6ae8('0xc0')][_0x6ae8('0x6e')]({'where':{'id':_0x3a42f4[_0x6ae8('0xbe')]['id']}})['then'](function(_0x1b2468){if(!_0x1b2468){logger[_0x6ae8('0x20')](_0x6ae8('0xdc'),_0x6ae8('0xdb'),0x194,_0x6ae8('0xdd'));_0x25c7f4[_0x6ae8('0x25')](0x194);}else{if(_0x1b2468[_0x6ae8('0x42')]){throw new db[(_0x6ae8('0x99'))][(_0x6ae8('0xd5'))](_0x6ae8('0xde'));}}return _0x1b2468;})[_0x6ae8('0x30')](function(_0xb8e677){if(_0xb8e677){return _0xb8e677[_0x6ae8('0xc6')]({'closed':_0x3a42f4['body'][_0x6ae8('0x43')],'disposition':_0x3a42f4[_0x6ae8('0x82')][_0x6ae8('0x44')]})['then'](function(_0x51e545){return _0x51e545;});}})[_0x6ae8('0x30')](function(_0x57d19c){return respondWithRpcPromise(_0x6ae8('0xdf'),'abandon',_0x3a42f4[_0x6ae8('0x82')],client9004);})[_0x6ae8('0x30')](respondWithResult(_0x25c7f4,null))['catch'](handleError(_0x25c7f4,null));};exports[_0x6ae8('0xe0')]=function(_0xa9c6ce,_0x1ebd34,_0x4e6dc9){_0xa9c6ce[_0x6ae8('0x82')][_0x6ae8('0x31')]=_0xa9c6ce['file'][_0x6ae8('0xe1')];_0xa9c6ce['body'][_0x6ae8('0xe2')]=_0xa9c6ce[_0x6ae8('0xe3')]['filename'];_0xa9c6ce[_0x6ae8('0x82')][_0x6ae8('0x7b')]=_0xa9c6ce[_0x6ae8('0xe3')][_0x6ae8('0xe4')];return db[_0x6ae8('0xe5')][_0x6ae8('0xc5')](_0xa9c6ce[_0x6ae8('0x82')])[_0x6ae8('0x30')](respondWithResult(_0x1ebd34,0xc9))[_0x6ae8('0x24')](handleError(_0x1ebd34,null));};exports[_0x6ae8('0xe6')]=function(_0x124fa6,_0x1879b9,_0x59da3a){return db['ChatInteraction'][_0x6ae8('0xca')]({'where':{'id':_0x124fa6[_0x6ae8('0xbe')]['id']},'raw':!![]})[_0x6ae8('0x30')](handleEntityNotFound(_0x1879b9,null))['then'](function(_0x100969){if(_0x100969){if(_0x100969[_0x6ae8('0x43')]){return _0x1879b9[_0x6ae8('0x26')](0x193)[_0x6ae8('0x28')]({'status':0x193,'message':_0x6ae8('0xe7')});}return db[_0x6ae8('0xe5')][_0x6ae8('0xca')]({'where':{'id':_0x124fa6[_0x6ae8('0x4c')][_0x6ae8('0xe8')]},'raw':!![]})['then'](handleEntityNotFound(_0x1879b9,null));}})['then'](function(_0x482a9c){if(_0x482a9c){var _0x223efa=_0x482a9c['ChatOfflineMessageId']!==null;var _0x4f2a5e=path['join'](config['root'],_0x6ae8('0xe9'));if(_0x223efa){_0x4f2a5e=path['join'](_0x4f2a5e,_0x6ae8('0xea'));}var _0x223c4c=path[_0x6ae8('0xeb')](_0x4f2a5e,_0x482a9c['basename']);return _0x1879b9['download'](_0x223c4c);}})[_0x6ae8('0x24')](handleError(_0x1879b9,null));};exports[_0x6ae8('0xec')]=function(_0x2bf393,_0x14a0d2){var _0xab9903=null;var _0xb937ca=null;var _0x3d50ac=null;var _0x1600a8=null;if(_0x2bf393[_0x6ae8('0x82')]['id']){delete _0x2bf393['body']['id'];}if(_0x2bf393[_0x6ae8('0x82')][_0x6ae8('0xed')]){_0x1600a8=path[_0x6ae8('0xeb')](config['root'],_0x6ae8('0xee'),util[_0x6ae8('0xef')](_0x6ae8('0xf0'),Date[_0x6ae8('0xf1')]()));_0x2bf393[_0x6ae8('0x82')][_0x6ae8('0xf2')]=_0x1600a8;}return db[_0x6ae8('0xc0')][_0x6ae8('0x6e')]({'where':{'id':_0x2bf393[_0x6ae8('0xbe')]['id']},'include':[{'model':db[_0x6ae8('0xd8')],'as':_0x6ae8('0xf3'),'include':[{'model':db[_0x6ae8('0x81')],'as':_0x6ae8('0x81')}]}]})[_0x6ae8('0x30')](handleEntityNotFound(_0x14a0d2,null))[_0x6ae8('0x30')](saveUpdates(_0x2bf393[_0x6ae8('0x82')],null))[_0x6ae8('0x30')](function(_0x4a8355){if(_0x4a8355){_0xab9903=_0x4a8355;return db[_0x6ae8('0xf4')][_0x6ae8('0x6e')]({'where':{'id':_0xab9903[_0x6ae8('0x86')]}});}})[_0x6ae8('0x30')](function(_0x429613){if(_0x429613){_0x3d50ac=_0x429613;return db[_0x6ae8('0xf5')][_0x6ae8('0x6e')]({'where':{'id':_0xab9903[_0x6ae8('0x79')]}});}})[_0x6ae8('0x30')](function(_0x174b01){if(_0x174b01){_0xb937ca=_0x174b01;if(_0x1600a8){var _0x1522a9=null;for(var _0x308dae=0x1;_0x308dae<_0xab9903[_0x6ae8('0xf3')][_0x6ae8('0x50')];++_0x308dae){_0x1522a9=_0xab9903[_0x6ae8('0xf3')][_0x308dae];var _0x4df4fd=_0x1522a9[_0x6ae8('0x42')]?util[_0x6ae8('0xef')]('%s%d',_0x3d50ac[_0x6ae8('0xf6')],_0x1522a9[_0x6ae8('0x42')]):'System';var _0x18ce16=_0x2bf393[_0x6ae8('0x82')]['customer']||util[_0x6ae8('0xef')](_0x6ae8('0xf7'),_0x6ae8('0xf8'),_0x1522a9[_0x6ae8('0x79')]);switch(_0x3d50ac['agentIdentifier']){case'website_alias':_0x4df4fd=_0x1522a9['UserId']?util[_0x6ae8('0xef')](_0x6ae8('0xf7'),_0x3d50ac['agentAlias'],_0x1522a9['UserId']):_0x6ae8('0xf9');break;case'agent_alias':_0x4df4fd=_0x1522a9['UserId']?_0x1522a9[_0x6ae8('0x81')]['alias']||_0x1522a9[_0x6ae8('0x81')][_0x6ae8('0x3a')]:_0x6ae8('0xf9');break;case _0x6ae8('0xfa'):_0x4df4fd=_0x1522a9[_0x6ae8('0x42')]?_0x1522a9[_0x6ae8('0x81')]['fullname']:_0x6ae8('0xf9');break;default:_0x4df4fd=_0x1522a9['UserId']?util[_0x6ae8('0xef')](_0x6ae8('0xf7'),_0x3d50ac['agentAlias'],_0x1522a9[_0x6ae8('0x42')]):_0x6ae8('0xf9');}var _0x32ad20=util[_0x6ae8('0xef')](_0x6ae8('0xfb'),moment(_0x1522a9[_0x6ae8('0x88')])[_0x6ae8('0xef')](_0x6ae8('0xfc')),_0x1522a9[_0x6ae8('0xfd')]==='in'?_0x18ce16:_0x4df4fd,_0x1522a9[_0x6ae8('0x82')]);if(!_0x1522a9[_0x6ae8('0xfe')]){fs[_0x6ae8('0xff')](_0x1600a8,_0x32ad20);}}return db[_0x6ae8('0x100')][_0x6ae8('0xca')]({'where':{'service':!![]},'include':[{'model':db[_0x6ae8('0x101')],'as':_0x6ae8('0x102'),'raw':!![]}]});}}})['then'](function(_0xba8458){if(_0xba8458&&_0xba8458[_0x6ae8('0x102')]&&_0x2bf393[_0x6ae8('0x82')]){var _0x32d510={'tls':{'rejectUnauthorized':![]}};if(_0xba8458[_0x6ae8('0x102')][_0x6ae8('0x103')]){_0x32d510['service']=_0xba8458[_0x6ae8('0x102')][_0x6ae8('0x103')];}else{_0x32d510[_0x6ae8('0x104')]=_0xba8458['Smtp'][_0x6ae8('0x104')];_0x32d510[_0x6ae8('0x105')]=_0xba8458[_0x6ae8('0x102')]['port'];_0x32d510[_0x6ae8('0x106')]=_0xba8458['Smtp'][_0x6ae8('0x106')];}if(_0xba8458[_0x6ae8('0x102')][_0x6ae8('0x107')]){_0x32d510[_0x6ae8('0x108')]={'user':_0xba8458[_0x6ae8('0x102')][_0x6ae8('0xa2')],'pass':_0xba8458[_0x6ae8('0x102')]['pass']};}return respondWithRpcPromise(_0x6ae8('0x109'),_0x6ae8('0x10a'),{'account':_0x32d510,'message':{'from':util[_0x6ae8('0xef')](_0x6ae8('0x10b'),_0xba8458[_0x6ae8('0x31')],_0xba8458['email']||_0xba8458['Smtp'][_0x6ae8('0xa2')]),'to':_0x2bf393['body'][_0x6ae8('0xed')],'subject':_0x6ae8('0x10c'),'text':util[_0x6ae8('0xef')](_0x6ae8('0x10d'),_0x2bf393[_0x6ae8('0x82')][_0x6ae8('0xed')]),'attachments':[{'path':_0x1600a8}]}})[_0x6ae8('0x30')](function(){return _0xab9903;})[_0x6ae8('0x24')](function(_0x3085c1){console['error'](_0x3085c1);});}else{return _0xab9903;}})[_0x6ae8('0x30')](respondWithStatusCode(_0x14a0d2,0xc8))[_0x6ae8('0x24')](handleError(_0x14a0d2,null));};exports[_0x6ae8('0x10e')]=function(_0xf2afa5,_0x2a86ef,_0x2d53d1){return db[_0x6ae8('0xd8')]['find']({'where':{'id':_0xf2afa5[_0x6ae8('0xbe')]['id']}})[_0x6ae8('0x30')](handleEntityNotFound(_0x2a86ef,null))[_0x6ae8('0x30')](function(_0x598f29){if(_0x598f29){return _0x598f29[_0x6ae8('0x10e')](_0xf2afa5[_0x6ae8('0x82')][_0x6ae8('0x10f')],_[_0x6ae8('0x110')](_0xf2afa5['body'],[_0x6ae8('0x10f'),'id'])||{});}})[_0x6ae8('0x30')](respondWithResult(_0x2a86ef,null))['catch'](handleError(_0x2a86ef,null));};exports[_0x6ae8('0x111')]=function(_0x10df22,_0x13ca70,_0xdc6758){var _0x27fb4e={'raw':![],'where':{}};var _0x43f618={};var _0x3e6fe1={'count':0x0,'rows':[]};return db[_0x6ae8('0xc0')][_0x6ae8('0xca')]({'where':{'id':_0x10df22[_0x6ae8('0xbe')]['id']}})['then'](handleEntityNotFound(_0x13ca70,null))[_0x6ae8('0x30')](function(_0xd5c5aa){if(_0xd5c5aa){_0x43f618[_0x6ae8('0x4b')]=_[_0x6ae8('0xbf')](db[_0x6ae8('0xd8')][_0x6ae8('0x49')]);_0x43f618[_0x6ae8('0x4c')]=_[_0x6ae8('0xbf')](_0x10df22[_0x6ae8('0x4c')]);_0x43f618[_0x6ae8('0x4d')]=_[_0x6ae8('0xc1')](_0x43f618[_0x6ae8('0x4b')],_0x43f618['query']);_0x27fb4e['attributes']=_['intersection'](_0x43f618[_0x6ae8('0x4b')],qs[_0x6ae8('0x4f')](_0x10df22[_0x6ae8('0x4c')][_0x6ae8('0x4f')]));_0x27fb4e[_0x6ae8('0x4e')]=_0x27fb4e[_0x6ae8('0x4e')]['length']?_0x27fb4e[_0x6ae8('0x4e')]:_0x43f618[_0x6ae8('0x4b')];if(!_0x10df22[_0x6ae8('0x4c')][_0x6ae8('0x112')](_0x6ae8('0x51'))){_0x27fb4e[_0x6ae8('0x2b')]=qs[_0x6ae8('0x2b')](_0x10df22['query'][_0x6ae8('0x2b')]);_0x27fb4e['offset']=qs[_0x6ae8('0x29')](_0x10df22[_0x6ae8('0x4c')][_0x6ae8('0x29')]);}_0x27fb4e['order']=qs[_0x6ae8('0x53')](_0x10df22['query'][_0x6ae8('0x53')]);_0x27fb4e['where']=qs[_0x6ae8('0x4d')](_[_0x6ae8('0x55')](_0x10df22['query'],_0x43f618[_0x6ae8('0x4d')]));_0x27fb4e[_0x6ae8('0x54')][_0x6ae8('0xba')]=_0xd5c5aa['id'];if(_0x10df22['query']['filter']){_0x27fb4e[_0x6ae8('0x54')]=_[_0x6ae8('0x34')](_0x27fb4e['where'],{'$or':_[_0x6ae8('0x39')](_0x27fb4e['attributes'],function(_0x33667b){var _0x28c4ba={};_0x28c4ba[_0x33667b]={'$like':'%'+_0x10df22[_0x6ae8('0x4c')][_0x6ae8('0x91')]+'%'};return _0x28c4ba;})});}if(_0x10df22[_0x6ae8('0x4c')]['$gte']){var _0x5be917=_0x10df22[_0x6ae8('0x4c')][_0x6ae8('0x8a')][_0x6ae8('0x3d')](',');var _0x3b5f5a={};_0x3b5f5a[_0x5be917[0x0]]={'$gte':moment(_0x5be917[0x1])[_0x6ae8('0xef')]('YYYY-MM-DD\x20HH:mm:ss')};_0x27fb4e[_0x6ae8('0x54')]=_['merge'](_0x27fb4e[_0x6ae8('0x54')],_0x3b5f5a);}_0x27fb4e=_['merge']({},_0x27fb4e,_0x10df22['options']);return db[_0x6ae8('0xd8')][_0x6ae8('0xa7')]({'where':_0x27fb4e[_0x6ae8('0x54')]})[_0x6ae8('0x30')](function(_0xfd7deb){_0x3e6fe1[_0x6ae8('0xa7')]=_0xfd7deb;if(_0x10df22[_0x6ae8('0x4c')][_0x6ae8('0xc2')]){_0x27fb4e[_0x6ae8('0xc3')]=[{'all':!![]}];}return db['ChatMessage'][_0x6ae8('0x113')](_0x27fb4e);})[_0x6ae8('0x30')](function(_0x5793b8){_0x3e6fe1[_0x6ae8('0xbc')]=_0x5793b8;return _0x3e6fe1;});}})[_0x6ae8('0x30')](respondWithFilteredResult(_0x13ca70,_0x27fb4e))[_0x6ae8('0x24')](handleError(_0x13ca70,null));};exports[_0x6ae8('0x114')]=function(_0x36fe9d,_0x324f65,_0xc7bae2){var _0x3fb406={'where':{}},_0x3e60e3={},_0x338449={'count':0x0,'rows':[]};return db['ChatInteraction'][_0x6ae8('0xca')]({'where':{'id':_0x36fe9d['params']['id']}})[_0x6ae8('0x30')](handleEntityNotFound(_0x324f65,null))['then'](function(_0x1d3f96){if(_0x1d3f96){_0x3e60e3['model']=_['keys'](db[_0x6ae8('0xd8')]['rawAttributes']);_0x3e60e3[_0x6ae8('0x4c')]=_['keys'](_0x36fe9d[_0x6ae8('0x4c')]);_0x3e60e3[_0x6ae8('0x4d')]=_[_0x6ae8('0xc1')](_0x3e60e3[_0x6ae8('0x4b')],_0x3e60e3[_0x6ae8('0x4c')]);_0x3fb406[_0x6ae8('0x4e')]=_[_0x6ae8('0xc1')](_0x3e60e3[_0x6ae8('0x4b')],qs[_0x6ae8('0x4f')](_0x36fe9d[_0x6ae8('0x4c')][_0x6ae8('0x4f')]));_0x3fb406[_0x6ae8('0x4e')]=_0x3fb406[_0x6ae8('0x4e')][_0x6ae8('0x50')]?_0x3fb406['attributes']:_0x3e60e3[_0x6ae8('0x4b')];if(!_0x36fe9d[_0x6ae8('0x4c')]['hasOwnProperty']('nolimit')){_0x3fb406[_0x6ae8('0x2b')]=qs[_0x6ae8('0x2b')](_0x36fe9d[_0x6ae8('0x4c')]['limit']);_0x3fb406[_0x6ae8('0x29')]=qs['offset'](_0x36fe9d[_0x6ae8('0x4c')][_0x6ae8('0x29')]);}_0x3fb406[_0x6ae8('0x52')]=qs['sort'](_0x36fe9d[_0x6ae8('0x4c')][_0x6ae8('0x53')]);_0x3fb406[_0x6ae8('0x54')]=qs[_0x6ae8('0x4d')](_[_0x6ae8('0x55')](_0x36fe9d[_0x6ae8('0x4c')],_0x3e60e3[_0x6ae8('0x4d')]));_0x3fb406[_0x6ae8('0x54')][_0x6ae8('0xba')]=_0x1d3f96['id'];if(_0x36fe9d[_0x6ae8('0x4c')][_0x6ae8('0x91')]){_0x3fb406[_0x6ae8('0x54')]=_['merge'](_0x3fb406['where'],{'$or':_[_0x6ae8('0x39')](_0x3fb406[_0x6ae8('0x4e')],function(_0x447b71){var _0x4861b0={};_0x4861b0[_0x447b71]={'$like':'%'+_0x36fe9d[_0x6ae8('0x4c')][_0x6ae8('0x91')]+'%'};return _0x4861b0;})});}_0x3fb406[_0x6ae8('0x54')][_0x6ae8('0xfe')]=![];if(_0x36fe9d[_0x6ae8('0x4c')]['id']){_0x3fb406['where']['id']={'$gt':_0x36fe9d[_0x6ae8('0x4c')]['id']};}_0x3fb406=_[_0x6ae8('0x34')]({},_0x3fb406,_0x36fe9d[_0x6ae8('0xc4')]);return db[_0x6ae8('0xd8')]['count']({'where':_0x3fb406[_0x6ae8('0x54')]})['then'](function(_0xf048cd){_0x338449[_0x6ae8('0xa7')]=_0xf048cd;_0x3fb406[_0x6ae8('0xc3')]=[];if(_0x36fe9d[_0x6ae8('0x4c')][_0x6ae8('0x115')]){_0x3fb406[_0x6ae8('0xc3')][_0x6ae8('0xbb')]({'model':db[_0x6ae8('0x81')],'as':_0x6ae8('0x81'),'attributes':['id',_0x6ae8('0x3a'),_0x6ae8('0x116')]});}if(_0x36fe9d[_0x6ae8('0x4c')]['includeAll']){_0x3fb406[_0x6ae8('0xc3')]=[{'all':!![]}];}return db['ChatMessage'][_0x6ae8('0x113')](_0x3fb406);})[_0x6ae8('0x30')](function(_0x468bc9){_0x338449['rows']=_0x468bc9;return _0x338449;});}})[_0x6ae8('0x30')](respondWithFilteredResult(_0x324f65,_0x3fb406))[_0x6ae8('0x24')](handleError(_0x324f65,null));};exports['addTags']=function(_0x3a29d9,_0x167a6c,_0x1ba72f){return db[_0x6ae8('0xc0')][_0x6ae8('0x6e')]({'where':{'id':_0x3a29d9[_0x6ae8('0xbe')]['id']}})['then'](handleEntityNotFound(_0x167a6c,null))['then'](function(_0x1976f2){if(_0x1976f2){return _0x1976f2[_0x6ae8('0x117')](_0x3a29d9[_0x6ae8('0x82')][_0x6ae8('0x10f')],_['omit'](_0x3a29d9[_0x6ae8('0x82')],[_0x6ae8('0x10f'),'id'])||{})[_0x6ae8('0x118')](function(){return db[_0x6ae8('0x7e')]['findAll']({'attributes':['id',_0x6ae8('0x31'),_0x6ae8('0x58')],'where':{'id':_0x3a29d9['body']['ids']}});})[_0x6ae8('0x30')](function(_0x9228b3){socket[_0x6ae8('0x119')](_0x6ae8('0x11a'),{'id':Number(_0x3a29d9[_0x6ae8('0xbe')]['id']),'tags':_0x9228b3||[]});return{'id':Number(_0x3a29d9[_0x6ae8('0xbe')]['id']),'tags':_0x9228b3||[]};});}})[_0x6ae8('0x30')](respondWithResult(_0x167a6c,null))[_0x6ae8('0x24')](handleError(_0x167a6c,null));};exports[_0x6ae8('0x11b')]=function(_0x266568,_0x4aaed8,_0x431403){return db[_0x6ae8('0xc0')]['find']({'where':{'id':_0x266568['params']['id']}})[_0x6ae8('0x30')](handleEntityNotFound(_0x4aaed8,null))['then'](function(_0x18f638){if(_0x18f638){return _0x18f638[_0x6ae8('0x11b')](_0x266568[_0x6ae8('0x4c')][_0x6ae8('0x10f')]);}})[_0x6ae8('0x30')](respondWithStatusCode(_0x4aaed8,null))[_0x6ae8('0x24')](handleError(_0x4aaed8,null));};exports[_0x6ae8('0x11c')]=function(_0x387fad,_0x49911e){var _0x228d6b=moment()['unix']()[_0x6ae8('0xa6')]();var _0x5dcbd8=path[_0x6ae8('0xeb')](config[_0x6ae8('0x11d')],_0x6ae8('0x11e'),'files',_0x6ae8('0x11f'));var _0x5ec49b=path[_0x6ae8('0xeb')](config[_0x6ae8('0x11d')],_0x6ae8('0x11e'),'files',_0x6ae8('0x120'));var _0x327593=path[_0x6ae8('0xeb')](_0x5dcbd8,_0x228d6b);var _0x37b5ca=util[_0x6ae8('0xef')]('transcript-%d-%s.zip',_0x387fad['params']['id'],_0x228d6b);var _0x1ea845=path['join'](_0x5dcbd8,_0x37b5ca);var _0x73d06c=[];_0x73d06c[_0x6ae8('0xbb')]({'model':db[_0x6ae8('0x81')],'as':_0x6ae8('0x81'),'attributes':['id',_0x6ae8('0x3a')],'raw':!![]});_0x73d06c[_0x6ae8('0xbb')]({'model':db[_0x6ae8('0xf5')],'as':_0x6ae8('0x72'),'attributes':['id',_0x6ae8('0x121'),'lastName'],'raw':!![]});if(_0x387fad[_0x6ae8('0x4c')][_0x6ae8('0x120')]){_0x73d06c[_0x6ae8('0xbb')]({'model':db[_0x6ae8('0xe5')],'as':_0x6ae8('0xe5'),'raw':!![]});}var _0x47dd12=[{'model':db[_0x6ae8('0xd8')],'as':_0x6ae8('0xf3'),'attributes':['id','body',_0x6ae8('0x88'),_0x6ae8('0xfd'),_0x6ae8('0xfe'),_0x6ae8('0x8c')],'include':_0x73d06c}];_0x47dd12[_0x6ae8('0xbb')]({'model':db[_0x6ae8('0xf4')],'as':_0x6ae8('0x122'),'attributes':['id',_0x6ae8('0x31')]});_0x47dd12[_0x6ae8('0xbb')]({'model':db['User'],'as':_0x6ae8('0x123'),'attributes':['id',_0x6ae8('0x3a')]});return db[_0x6ae8('0xc0')][_0x6ae8('0x6e')]({'where':{'id':_0x387fad[_0x6ae8('0xbe')]['id']},'include':_0x47dd12})[_0x6ae8('0x30')](handleEntityNotFound(_0x49911e,null))[_0x6ae8('0x30')](function(_0x124bf3){if(_0x124bf3){var _0x12b28c=_0x124bf3['get']({'plain':!![]});fs[_0x6ae8('0x124')](_0x327593);var _0x5194f1={'channel':'Chat','account':_0x12b28c[_0x6ae8('0x122')]['name'],'agent':_0x12b28c['Owner']?_0x12b28c[_0x6ae8('0x123')]['fullname']:'N.A.','createdAt':moment(_0x12b28c[_0x6ae8('0x88')])['format'](_0x6ae8('0x125'))[_0x6ae8('0xa6')](),'closedAt':_0x12b28c[_0x6ae8('0x43')]?moment(_0x12b28c['closedAt'])['format'](_0x6ae8('0x125'))[_0x6ae8('0xa6')]():'','disposition':_0x12b28c[_0x6ae8('0x44')],'chatInfo':{'browser':_0x12b28c[_0x6ae8('0x126')],'os':_0x12b28c[_0x6ae8('0x127')],'referer':_0x12b28c['referer'],'customerIp':_0x12b28c[_0x6ae8('0x128')],'customerPort':_0x12b28c[_0x6ae8('0x129')]?_0x12b28c[_0x6ae8('0x129')]:_0x6ae8('0x12a')},'messages':_(_0x12b28c['Messages'])[_0x6ae8('0x12b')]()[_0x6ae8('0x91')]({'secret':![]})[_0x6ae8('0x39')](function(_0x275201){if(_0x275201['Attachment']){var _0x5eef4e=path[_0x6ae8('0xeb')](_0x5ec49b,_0x275201[_0x6ae8('0xe5')][_0x6ae8('0xe2')]);if(fs[_0x6ae8('0x12c')](_0x5eef4e)){fs[_0x6ae8('0x12d')](_0x5eef4e)[_0x6ae8('0x12e')](fs[_0x6ae8('0x12f')](path[_0x6ae8('0xeb')](_0x327593,_0x275201[_0x6ae8('0xe5')]['basename'])));}}return{'date':moment(_0x275201['createdAt'])[_0x6ae8('0xef')](_0x6ae8('0x125'))[_0x6ae8('0xa6')](),'sender':_0x275201[_0x6ae8('0xfd')]==='out'?_0x275201[_0x6ae8('0x81')]?_0x275201[_0x6ae8('0x81')][_0x6ae8('0x3a')]:_0x6ae8('0xf9'):_0x275201[_0x6ae8('0x72')]['firstName']+(_0x275201[_0x6ae8('0x72')][_0x6ae8('0x130')]?'\x20'+_0x275201['Contact'][_0x6ae8('0x130')]:''),'body':_0x275201['Attachment']?_0x275201[_0x6ae8('0xe5')][_0x6ae8('0xe2')]:_0x275201[_0x6ae8('0x82')],'direction':_0x275201[_0x6ae8('0xfd')]===_0x6ae8('0x131')?'A':'C','secret':_0x275201['secret'],'read':_0x275201[_0x6ae8('0x8c')],'attachment':_0x275201[_0x6ae8('0xe5')]};})[_0x6ae8('0x75')]()};return ejs[_0x6ae8('0x132')](path['join'](config['root'],_0x6ae8('0x11e'),_0x6ae8('0x133'),_0x6ae8('0x134')),{'interaction':_0x5194f1})[_0x6ae8('0x30')](function(_0xd0cf3c){var _0x3d5da2=path['join'](_0x327593,_0x6ae8('0x135')+_0x12b28c['id']+'-'+_0x228d6b+_0x6ae8('0x136'));var _0x41a369={'path':_0x3d5da2,'channel':'Chat','interactionId':_0x12b28c['id']};return pdf['createPdfFromHTML'](_0xd0cf3c,_0x41a369);})['then'](function(){return new BPromise(function(_0x38f673,_0x1303c3){zipdir(_0x327593,{'saveTo':_0x1ea845},function(_0x391903,_0x3f0e78){if(_0x391903)return _0x1303c3(_0x391903);return _0x38f673(_0x3f0e78);});})[_0x6ae8('0x30')](function(){return new BPromise(function(_0x4bab30,_0x32b9db){rimraf(_0x327593,function(_0x517484){if(_0x517484)_0x32b9db(_0x517484);return _0x4bab30();});});})[_0x6ae8('0x30')](function(){return _0x49911e[_0x6ae8('0x11c')](_0x1ea845,_0x37b5ca,function(_0x3822e4){if(_0x3822e4){console[_0x6ae8('0x137')](_0x6ae8('0x138'),_0x3822e4);}else{fs[_0x6ae8('0x139')](_0x1ea845);}});});});}else{return _0x49911e[_0x6ae8('0x25')](0xc8);}})[_0x6ae8('0x24')](handleError(_0x49911e,null));}; \ No newline at end of file +var _0x6b2b=['pick','YYYY-MM-DD\x20HH:mm:ss','options','findAll','getMyMessages','includeAgent','spread','emit','chatInteractionTags:save','removeTags','server','files','tmp','transcript-%d-%s.zip','lastName','Account','Owner','get','Chat','osName','referer','N.A.','tail','existsSync','createReadStream','pipe','firstName','renderFile','views','downloadInteraction.ejs','.pdf','log','unlinkSync','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','ejs','fs-extra','lodash','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','redis','localhost','socket.io-emitter','register','jayson/promise','client','http','request','request\x20sent','debug','stringify','error','ChatInteraction,\x20%s,\x20%s','message','info','result','sendStatus','end','status','offset','limit','undefined','count','Content-Range','apply','reject','update','then','destroy','stack','name','render','merge','contact','interaction','Users','TagIds','Tags','split','forEach','push','catch','waiting','unmanaged','abandoned','total','UserId','talking','closed','disposition','map','rawAttributes','fieldName','type','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','field','color','from','tools_tags','select','u.fullname','ui.ChatInteractionId','left_join','users','u.id\x20=\x20ui.UserId','chat_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','chat_websites','a.id\x20=\x20i.ChatWebsiteId','chat_messages','chat_interaction_has_tags','it.ChatInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','parseSearch','search','conditions','find','unreadMessages','`\x20=\x200','having','`\x20>\x200','Contact','$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','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','body','keys','some','compact','isEmpty','ChatWebsiteId','concat','createdAt','parse','$gte','$lte','null','\x20=\x20?','read','`unreadMessages`\x20>\x200','isArray','tag','filter','replace','isNumeric','i.id\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','Sequelize','SELECT','clone','contactName','t.id\x20IN\x20?','resolve','i.ChatWebsiteId\x20IS\x20NOT\x20NULL','user','role','agent','getChatWebsites','i.ChatWebsiteId\x20IS\x20NULL','i.ChatWebsiteId\x20IN\x20?','sequelize','toString','keyBy','ChatInteraction','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','a.key','Account.key','Account.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','Contact.firstName','Contact.lastName','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.ChatInteractionId\x20IN\x20?','groupBy','ChatInteractionId','all','rows','show','params','includeAll','include','describe','createVidaooSession','findOne','ChatWebsite','vidaooApiKey','vidaooEscalation','vidaooTopic','vidaooNote','vidaooMetadata','fullname','email','account','isNull','follow','metadata','ValidationError','Error\x20in\x20Vidaoo\x20configuration','out','ChatMessage','create','customUpdate','abandon','entity\x20not\x20found','Interaction\x20already\x20assigned','AbandonInteraction','attachmentUpload','file','originalname','filename','mimetype','Attachment','attachmentDownload','json','Unauthorized','ChatOfflineMessageId','join','server/files/attachments/','offline-chat/','basename','download','close','mailTranscript','root','format','now','pathTranscript','Messages','CmContact','agentAlias','customer','Visitor','agentIdentifier','%s%d','System','agent_alias','alias','agent_fullname','[%s]\x20%s:\x20%s\x0a','MM/DD/YYYY\x20HH:mm:ss','direction','secret','appendFileSync','MailServerOut','Smtp','service','host','secure','authentication','auth','pass','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','ids','omit'];(function(_0x4c445a,_0x4ee80f){var _0x2f611c=function(_0x4f3699){while(--_0x4f3699){_0x4c445a['push'](_0x4c445a['shift']());}};_0x2f611c(++_0x4ee80f);}(_0x6b2b,0x159));var _0xb6b2=function(_0x1abb09,_0x18ee91){_0x1abb09=_0x1abb09-0x0;var _0xea1c07=_0x6b2b[_0x1abb09];return _0xea1c07;};'use strict';var emlformat=require(_0xb6b2('0x0'));var rimraf=require(_0xb6b2('0x1'));var zipdir=require(_0xb6b2('0x2'));var jsonpatch=require(_0xb6b2('0x3'));var rp=require(_0xb6b2('0x4'));var moment=require(_0xb6b2('0x5'));var BPromise=require(_0xb6b2('0x6'));var Mustache=require('mustache');var util=require(_0xb6b2('0x7'));var path=require(_0xb6b2('0x8'));var sox=require('sox');var csv=require(_0xb6b2('0x9'));var ejs=require(_0xb6b2('0xa'));var fs=require('fs');var fs_extra=require(_0xb6b2('0xb'));var _=require(_0xb6b2('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xb6b2('0xd'));var toCsv=require(_0xb6b2('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xb6b2('0xe'));var authService=require(_0xb6b2('0xf'));var qs=require(_0xb6b2('0x10'));var as=require('../../components/parsers/advancedSearch');var pdf=require('../../components/export/pdf');var hardwareService=require(_0xb6b2('0x11'));var logger=require(_0xb6b2('0x12'))(_0xb6b2('0x13'));var utils=require(_0xb6b2('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0xb6b2('0x15')]=_['defaults'](config['redis'],{'host':_0xb6b2('0x16'),'port':0x18eb});var socket=require(_0xb6b2('0x17'))(new Redis(config[_0xb6b2('0x15')]));require('./chatInteraction.socket')[_0xb6b2('0x18')](socket);var jayson=require(_0xb6b2('0x19'));var client=jayson[_0xb6b2('0x1a')][_0xb6b2('0x1b')]({'port':0x232b});var client9004=jayson[_0xb6b2('0x1a')][_0xb6b2('0x1b')]({'port':0x232c});function respondWithRpcPromise(_0x1df918,_0xf772c1,_0x3c404f,_0x486b34){return new BPromise(function(_0x4ad7d8,_0x190814){var _0x5de903=_0x486b34||client;return _0x5de903[_0xb6b2('0x1c')](_0x1df918,_0x3c404f)['then'](function(_0x559b69){logger['info']('ChatInteraction,\x20%s,\x20%s',_0xf772c1,_0xb6b2('0x1d'));logger[_0xb6b2('0x1e')]('ChatInteraction,\x20%s,\x20%s,\x20%s',_0xf772c1,_0xb6b2('0x1d'),JSON[_0xb6b2('0x1f')](_0x559b69));if(_0x559b69[_0xb6b2('0x20')]){if(_0x559b69[_0xb6b2('0x20')]['code']===0x1f4){logger[_0xb6b2('0x20')](_0xb6b2('0x21'),_0xf772c1,_0x559b69[_0xb6b2('0x20')][_0xb6b2('0x22')]);return _0x190814(_0x559b69[_0xb6b2('0x20')]['message']);}logger[_0xb6b2('0x20')](_0xb6b2('0x21'),_0xf772c1,_0x559b69[_0xb6b2('0x20')][_0xb6b2('0x22')]);return _0x4ad7d8(_0x559b69[_0xb6b2('0x20')][_0xb6b2('0x22')]);}else{logger[_0xb6b2('0x23')](_0xb6b2('0x21'),_0xf772c1,_0xb6b2('0x1d'));_0x4ad7d8(_0x559b69[_0xb6b2('0x24')][_0xb6b2('0x22')]);}})['catch'](function(_0x213fa6){logger[_0xb6b2('0x20')](_0xb6b2('0x21'),_0xf772c1,_0x213fa6);_0x190814(_0x213fa6);});});}function respondWithStatusCode(_0xa24596,_0xced468){_0xced468=_0xced468||0xcc;return function(_0x2609cf){if(_0x2609cf){return _0xa24596[_0xb6b2('0x25')](_0xced468);}return _0xa24596['status'](_0xced468)[_0xb6b2('0x26')]();};}function respondWithResult(_0x38e42b,_0x54d614){_0x54d614=_0x54d614||0xc8;return function(_0x4586e2){if(_0x4586e2){return _0x38e42b[_0xb6b2('0x27')](_0x54d614)['json'](_0x4586e2);}};}function respondWithFilteredResult(_0x42f738,_0x280981){return function(_0x3d12ab){if(_0x3d12ab){var _0x3876dc=typeof _0x280981[_0xb6b2('0x28')]==='undefined'&&typeof _0x280981[_0xb6b2('0x29')]===_0xb6b2('0x2a');var _0x40d714=_0x3d12ab[_0xb6b2('0x2b')];var _0xb7a94a=_0x3876dc?0x0:_0x280981['offset'];var _0x348077=_0x3876dc?_0x3d12ab[_0xb6b2('0x2b')]:_0x280981['offset']+_0x280981['limit'];var _0x2ff4e0;if(_0x348077>=_0x40d714){_0x348077=_0x40d714;_0x2ff4e0=0xc8;}else{_0x2ff4e0=0xce;}_0x42f738[_0xb6b2('0x27')](_0x2ff4e0);return _0x42f738['set'](_0xb6b2('0x2c'),_0xb7a94a+'-'+_0x348077+'/'+_0x40d714)['json'](_0x3d12ab);}return null;};}function patchUpdates(_0x21cff1){return function(_0x3bc0ba){try{jsonpatch[_0xb6b2('0x2d')](_0x3bc0ba,_0x21cff1,!![]);}catch(_0xcfdc4d){return BPromise[_0xb6b2('0x2e')](_0xcfdc4d);}return _0x3bc0ba['save']();};}function saveUpdates(_0x25a175,_0x527401){return function(_0x16d410){if(_0x16d410){return _0x16d410[_0xb6b2('0x2f')](_0x25a175)[_0xb6b2('0x30')](function(_0x413158){return _0x413158;});}return null;};}function removeEntity(_0x117b89,_0x407ed1){return function(_0x1f109b){if(_0x1f109b){return _0x1f109b[_0xb6b2('0x31')]()[_0xb6b2('0x30')](function(){_0x117b89[_0xb6b2('0x27')](0xcc)[_0xb6b2('0x26')]();});}};}function handleEntityNotFound(_0x250324,_0x2ae87d){return function(_0x4c05e5){if(!_0x4c05e5){_0x250324[_0xb6b2('0x25')](0x194);}return _0x4c05e5;};}function handleError(_0x218683,_0x5d3eb0){_0x5d3eb0=_0x5d3eb0||0x1f4;return function(_0x224a3e){logger[_0xb6b2('0x20')](_0x224a3e[_0xb6b2('0x32')]);if(_0x224a3e[_0xb6b2('0x33')]){delete _0x224a3e[_0xb6b2('0x33')];}_0x218683['status'](_0x5d3eb0)['send'](_0x224a3e);};}function getMustacheRender(_0x477351,_0x29146c){return Mustache[_0xb6b2('0x34')](_0x477351,_[_0xb6b2('0x35')](_0x29146c['body'],{'contact':_0x29146c[_0xb6b2('0x36')],'message':_0x29146c[_0xb6b2('0x22')],'agent':_0x29146c['agent'],'interaction':_0x29146c[_0xb6b2('0x37')],'account':_0x29146c['account']}))||'';}function getInteractionUsers(_0x8167e6,_0x4f9309){return new BPromise(function(_0x367e5e,_0x1a9865){try{if(_0x4f9309[_0x8167e6['id']]){_0x8167e6[_0xb6b2('0x38')]=_['map'](_0x4f9309[_0x8167e6['id']],function(_0x468075){return{'id':_0x468075['id'],'fullname':_0x468075['fullname']};});}}catch(_0x1b366b){_0x1a9865(_0x1b366b);}_0x367e5e(_0x8167e6);});}function getInteractionTags(_0x474f4f,_0x567330){return new BPromise(function(_0xf530c1,_0x4da618){try{if(_0x474f4f[_0xb6b2('0x39')]){_0x474f4f[_0xb6b2('0x3a')]=[];_0x474f4f[_0xb6b2('0x39')][_0xb6b2('0x3b')](',')[_0xb6b2('0x3c')](function(_0x1e8e01){_0x474f4f[_0xb6b2('0x3a')][_0xb6b2('0x3d')](_0x567330[_0x1e8e01]);});}delete _0x474f4f[_0xb6b2('0x39')];}catch(_0x15b076){_0x4da618(_0x15b076);}_0xf530c1(_0x474f4f);});}function updateChatInteraction(_0x50deeb,_0x22bf5c,_0x34c5ab){return new BPromise(function(_0x52f17e,_0x4b3163){return getInteractionUsers(_0x50deeb,_0x34c5ab)[_0xb6b2('0x30')](function(_0x1b0a76){return getInteractionTags(_0x1b0a76,_0x22bf5c);})['then'](function(_0x194359){return getStateInteraction(_0x194359);})[_0xb6b2('0x30')](function(_0x238ce8){_0x52f17e(_0x238ce8);})[_0xb6b2('0x3e')](function(_0x495280){_0x4b3163(_0x495280);});});}function getStateInteraction(_0x30c3c3){return new BPromise(function(_0x4de027){_0x30c3c3[_0xb6b2('0x3f')]=0x0;_0x30c3c3['talking']=0x0;_0x30c3c3['answered']=0x0;_0x30c3c3[_0xb6b2('0x40')]=0x0;_0x30c3c3[_0xb6b2('0x41')]=0x0;_0x30c3c3[_0xb6b2('0x42')]=0x0;if(!_0x30c3c3['closed']&&!_0x30c3c3['UserId']){_0x30c3c3['waiting']+=0x1;}if(!_0x30c3c3['closed']&&_0x30c3c3[_0xb6b2('0x43')]){_0x30c3c3[_0xb6b2('0x44')]+=0x1;if(_0x30c3c3[_0xb6b2('0x3f')]){_0x30c3c3[_0xb6b2('0x3f')]-=0x1;}}if(_0x30c3c3[_0xb6b2('0x45')]&&_0x30c3c3[_0xb6b2('0x46')]===_0xb6b2('0x41')){_0x30c3c3[_0xb6b2('0x41')]+=0x1;if(_0x30c3c3[_0xb6b2('0x3f')]){_0x30c3c3[_0xb6b2('0x3f')]-=0x1;}}else if(_0x30c3c3['closed']&&!_0x30c3c3[_0xb6b2('0x43')]&&_0x30c3c3['disposition']){_0x30c3c3[_0xb6b2('0x40')]+=0x1;if(_0x30c3c3[_0xb6b2('0x3f')]){_0x30c3c3[_0xb6b2('0x3f')]-=0x1;}}else if(_0x30c3c3['closed']&&_0x30c3c3['UserId']){_0x30c3c3['answered']+=0x1;if(_0x30c3c3[_0xb6b2('0x44')]){_0x30c3c3[_0xb6b2('0x44')]-=0x1;}}_0x30c3c3['total']+=0x1;_0x4de027(_0x30c3c3);});}exports['index']=function(_0x3f1723,_0x31c71e){var _0xe03c4d={},_0x1bfc58={},_0x25f015={'count':0x0,'rows':[]};var _0x39a308=_[_0xb6b2('0x47')](db['ChatInteraction'][_0xb6b2('0x48')],function(_0x4220c3){return{'name':_0x4220c3[_0xb6b2('0x49')],'type':_0x4220c3[_0xb6b2('0x4a')][_0xb6b2('0x4b')]};});_0x1bfc58[_0xb6b2('0x4c')]=_[_0xb6b2('0x47')](_0x39a308,'name');_0x1bfc58['query']=_['keys'](_0x3f1723[_0xb6b2('0x4d')]);_0x1bfc58[_0xb6b2('0x4e')]=_['intersection'](_0x1bfc58[_0xb6b2('0x4c')],_0x1bfc58[_0xb6b2('0x4d')]);_0xe03c4d[_0xb6b2('0x4f')]=_[_0xb6b2('0x50')](_0x1bfc58[_0xb6b2('0x4c')],qs[_0xb6b2('0x51')](_0x3f1723[_0xb6b2('0x4d')][_0xb6b2('0x51')]));_0xe03c4d[_0xb6b2('0x4f')]=_0xe03c4d['attributes'][_0xb6b2('0x52')]?_0xe03c4d[_0xb6b2('0x4f')]:_0x1bfc58[_0xb6b2('0x4c')];if(!_0x3f1723[_0xb6b2('0x4d')][_0xb6b2('0x53')](_0xb6b2('0x54'))){_0xe03c4d['limit']=qs[_0xb6b2('0x29')](_0x3f1723[_0xb6b2('0x4d')][_0xb6b2('0x29')]);_0xe03c4d[_0xb6b2('0x28')]=qs[_0xb6b2('0x28')](_0x3f1723[_0xb6b2('0x4d')][_0xb6b2('0x28')]);}_0xe03c4d[_0xb6b2('0x55')]=qs[_0xb6b2('0x56')](_0x3f1723[_0xb6b2('0x4d')][_0xb6b2('0x56')]);_0xe03c4d[_0xb6b2('0x57')]=qs[_0xb6b2('0x4e')](_['pick'](_0x3f1723[_0xb6b2('0x4d')],_0x1bfc58[_0xb6b2('0x4e')]),_0x39a308);var _0xf564af=[];var _0x1d28e2=squel['select']()[_0xb6b2('0x58')]('id')[_0xb6b2('0x58')](_0xb6b2('0x33'))[_0xb6b2('0x58')](_0xb6b2('0x59'))[_0xb6b2('0x5a')](_0xb6b2('0x5b'));var _0x413f62=squel[_0xb6b2('0x5c')]()[_0xb6b2('0x58')]('u.id')[_0xb6b2('0x58')](_0xb6b2('0x5d'))[_0xb6b2('0x58')](_0xb6b2('0x5e'))[_0xb6b2('0x5a')]('user_has_chat_interactions','ui')[_0xb6b2('0x5f')](_0xb6b2('0x60'),'u',_0xb6b2('0x61'));var _0x562144=squel[_0xb6b2('0x5c')]()['from'](_0xb6b2('0x62'),'i')['left_join'](_0xb6b2('0x63'),'c',_0xb6b2('0x64'))[_0xb6b2('0x5f')](_0xb6b2('0x60'),'o',_0xb6b2('0x65'))[_0xb6b2('0x5f')](_0xb6b2('0x66'),'a',_0xb6b2('0x67'))[_0xb6b2('0x5f')](_0xb6b2('0x68'),'me','me.ChatInteractionId\x20=\x20i.id')['left_join'](_0xb6b2('0x69'),'it',_0xb6b2('0x6a'))[_0xb6b2('0x5f')](_0xb6b2('0x5b'),'t',_0xb6b2('0x6b'));var _0x39be05=squel[_0xb6b2('0x6c')]();var _0x10f99f=[];var _0x2f270e=squel['expr']();var _0x50b05d;if(_0x3f1723[_0xb6b2('0x4d')]['search']){_0x50b05d=as[_0xb6b2('0x6d')](_0x3f1723[_0xb6b2('0x4d')][_0xb6b2('0x6e')]);var _0x5bb7c2=_0x50b05d['sqlOperator'];for(var _0x4b4f0c=0x0;_0x4b4f0c<_0x50b05d['conditions'][_0xb6b2('0x52')];_0x4b4f0c++){var _0x3a156e=_0x50b05d[_0xb6b2('0x6f')][_0x4b4f0c];var _0x43ce06='i';var _0x589603=_[_0xb6b2('0x70')](_0x39a308,[_0xb6b2('0x33'),_0x3a156e[_0xb6b2('0x58')]]);if(!_0x589603){switch(_0x3a156e[_0xb6b2('0x58')]){case _0xb6b2('0x71'):if(_0x3a156e['value']==0x1){_0x562144['having']('`'+_0x3a156e['field']+_0xb6b2('0x72'));}else{_0x562144[_0xb6b2('0x73')]('`'+_0x3a156e['field']+_0xb6b2('0x74'));}break;case _0xb6b2('0x75'):if(_0x3a156e['operator']===_0xb6b2('0x76')){if(_0x3a156e[_0xb6b2('0x77')]['split']('\x20')[_0xb6b2('0x52')]>0x1){_0x39be05[_0x5bb7c2](_0xb6b2('0x78'),qs[_0xb6b2('0x79')](_0x3a156e[_0xb6b2('0x77')]),null);}else{var _0x5880bc='%'+_0x3a156e[_0xb6b2('0x77')]+'%';_0x39be05[_0x5bb7c2](_0xb6b2('0x7a'),_0x5880bc,_0x5880bc,_0x5880bc);}}else{_0x589603=_[_0xb6b2('0x70')](_0x39a308,[_0xb6b2('0x33'),_0xb6b2('0x7b')]);_0x3a156e[_0xb6b2('0x58')]=_0xb6b2('0x7b');_0x50ca0c=as[_0xb6b2('0x7c')](_0x43ce06,_0x589603[_0xb6b2('0x4a')],_0x3a156e);_0x39be05[_0x5bb7c2](_0x50ca0c[_0xb6b2('0x7d')],_0x50ca0c[_0xb6b2('0x77')][_0xb6b2('0x7e')],_0x50ca0c[_0xb6b2('0x77')][_0xb6b2('0x26')]);}break;case _0xb6b2('0x7f'):var _0x5176ba=_0x3a156e[_0xb6b2('0x77')][_0xb6b2('0x3b')](',')[_0xb6b2('0x47')](function(_0x24be70){return Number(_0x24be70);});_0x5176ba[_0xb6b2('0x3c')](function(_0x3433ec){_0x2f270e['or'](_0xb6b2('0x80'),'%,'+_0x3433ec+',%');});_0x10f99f=_[_0xb6b2('0x81')](_0x10f99f,_0x5176ba);break;case _0xb6b2('0x82'):if(_0x3a156e['operator']==='$substring'){_0x39be05[_0x5bb7c2](_0xb6b2('0x83'),'%'+_0x3a156e['value']+'%',null);}else{_0x589603=_['find'](_0x39a308,[_0xb6b2('0x33'),_0xb6b2('0x43')]);_0x3a156e[_0xb6b2('0x58')]=_0xb6b2('0x43');_0x50ca0c=as[_0xb6b2('0x7c')](_0x43ce06,_0x589603[_0xb6b2('0x4a')],_0x3a156e);_0x39be05[_0x5bb7c2](_0x50ca0c[_0xb6b2('0x7d')],_0x50ca0c['value'][_0xb6b2('0x7e')],_0x50ca0c[_0xb6b2('0x77')]['end']);}break;case _0xb6b2('0x84'):_0x50ca0c=as[_0xb6b2('0x7c')]('me',null,_0x3a156e);_0x39be05[_0x5bb7c2](_0x50ca0c[_0xb6b2('0x7d')],_0x50ca0c['value'][_0xb6b2('0x7e')],_0x50ca0c[_0xb6b2('0x77')][_0xb6b2('0x26')]);break;}}else{var _0x50ca0c=as[_0xb6b2('0x7c')](_0x43ce06,_0x589603[_0xb6b2('0x4a')],_0x3a156e);_0x39be05[_0x5bb7c2](_0x50ca0c['text'],_0x50ca0c[_0xb6b2('0x77')][_0xb6b2('0x7e')],_0x50ca0c[_0xb6b2('0x77')][_0xb6b2('0x26')]);}}}else{var _0x32d111=_(_0x3f1723['query'])[_0xb6b2('0x85')]()[_0xb6b2('0x47')](function(_0xda9b6b){return _[_0xb6b2('0x86')](_0x39a308,[_0xb6b2('0x33'),_0xda9b6b])?_0xda9b6b:undefined;})[_0xb6b2('0x87')]()[_0xb6b2('0x77')]();if(!_[_0xb6b2('0x88')](_0x32d111)){_0x32d111[_0xb6b2('0x3c')](function(_0x33ff3a){if(_0x33ff3a===_0xb6b2('0x89')){_0x562144[_0xb6b2('0x57')]('i.ChatWebsiteId\x20IN\x20?',[][_0xb6b2('0x8a')](_0x3f1723['query'][_0x33ff3a]));}else if(_0x33ff3a===_0xb6b2('0x8b')){var _0x4e7443=JSON[_0xb6b2('0x8c')](_0x3f1723['query'][_0x33ff3a])[_0xb6b2('0x8d')];var _0x9138ea=JSON[_0xb6b2('0x8c')](_0x3f1723['query'][_0x33ff3a])[_0xb6b2('0x8e')];_0x562144[_0xb6b2('0x57')]('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x4e7443,_0x9138ea);}else{if(_0x3f1723[_0xb6b2('0x4d')][_0x33ff3a]===_0xb6b2('0x8f')){_0x562144['where']('i.'+_0x33ff3a+'\x20IS\x20NULL');}else{_0x562144[_0xb6b2('0x57')]('i.'+_0x33ff3a+_0xb6b2('0x90'),_0x3f1723[_0xb6b2('0x4d')][_0x33ff3a]);}}});}if(_0x3f1723['query'][_0xb6b2('0x91')]){if(_0x3f1723['query'][_0xb6b2('0x91')]==0x1){_0x562144['having']('`unreadMessages`\x20=\x200');}else{_0x562144[_0xb6b2('0x73')](_0xb6b2('0x92'));}}if(_0x3f1723[_0xb6b2('0x4d')]['tag']){_0x10f99f=_[_0xb6b2('0x93')](_0x3f1723[_0xb6b2('0x4d')][_0xb6b2('0x94')])?_0x3f1723[_0xb6b2('0x4d')]['tag']:new Array(_0x3f1723[_0xb6b2('0x4d')][_0xb6b2('0x94')]);_0x10f99f[_0xb6b2('0x3c')](function(_0x1e7faa){_0x2f270e['or'](_0xb6b2('0x80'),'%,'+_0x1e7faa+',%');});}if(_0x3f1723[_0xb6b2('0x4d')][_0xb6b2('0x95')]){var _0x494900=_0x3f1723['query']['filter'][_0xb6b2('0x96')]('\x5c','\x5c\x5c')[_0xb6b2('0x96')](/'/g,'\x27\x27');if(qs[_0xb6b2('0x97')](_0x494900)){_0x39be05['or'](_0xb6b2('0x98'),_0x494900+'%');}else{_0x39be05['or'](_0xb6b2('0x99'),qs['getFullTextValue'](_0x494900))['or'](_0xb6b2('0x9a'),_0x494900+'%');}}}_0x562144[_0xb6b2('0x57')](_0x39be05);_0x562144[_0xb6b2('0x9b')](_0xb6b2('0x9c'));var _0x2b69b9={'type':db[_0xb6b2('0x9d')]['QueryTypes'][_0xb6b2('0x9e')],'raw':!![]};var _0x467bcc=_0x562144[_0xb6b2('0x9f')]();_0x467bcc['field'](_0xb6b2('0x9c'));_0x467bcc['field']('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0xb6b2('0x71'));if(_0xe03c4d[_0xb6b2('0x55')]){_0xe03c4d[_0xb6b2('0x55')][_0xb6b2('0x3c')](function(_0x2bffe4){var _0x4b12f6=_0x2bffe4[0x0]===_0xb6b2('0xa0')?_0x2bffe4[0x0]:'i.'+_0x2bffe4[0x0];_0x562144[_0xb6b2('0x55')](_0x4b12f6,_0x2bffe4[0x1]==='DESC'?![]:!![]);});}if(!_[_0xb6b2('0x88')](_0x10f99f)){_0x562144[_0xb6b2('0x73')](_0x2f270e);_0x467bcc[_0xb6b2('0x57')](_0xb6b2('0xa1'),_0x10f99f);}BPromise[_0xb6b2('0xa2')]()[_0xb6b2('0x30')](function(){if(!_0x50b05d){if(_0x3f1723[_0xb6b2('0x4d')][_0xb6b2('0x89')])return;_0x467bcc[_0xb6b2('0x57')]('i.ChatWebsiteId\x20IS\x20NOT\x20NULL');_0x562144[_0xb6b2('0x57')](_0xb6b2('0xa3'));return;}if(_0x3f1723[_0xb6b2('0xa4')][_0xb6b2('0xa5')]!==_0xb6b2('0xa6'))return;return _0x3f1723[_0xb6b2('0xa4')][_0xb6b2('0xa7')]({'attributes':['id'],'raw':!![]})[_0xb6b2('0x30')](function(_0x311dc1){if(_[_0xb6b2('0x88')](_0x311dc1)){_0x467bcc[_0xb6b2('0x57')](_0xb6b2('0xa8'));_0x562144['where']('i.ChatWebsiteId\x20IS\x20NULL');}else{_0x467bcc[_0xb6b2('0x57')](_0xb6b2('0xa9'),_[_0xb6b2('0x47')](_0x311dc1,'id'));_0x562144[_0xb6b2('0x57')]('i.ChatWebsiteId\x20IN\x20?',_[_0xb6b2('0x47')](_0x311dc1,'id'));}});})[_0xb6b2('0x30')](function(){if(_0x3f1723[_0xb6b2('0xa4')][_0xb6b2('0xa5')]===_0xb6b2('0xa6')&&!_0x50b05d&&!_0x3f1723[_0xb6b2('0x4d')]['ChatWebsiteId'])return[];return db[_0xb6b2('0xaa')][_0xb6b2('0x4d')](_0x467bcc[_0xb6b2('0xab')](),_0x2b69b9);})[_0xb6b2('0x30')](function(_0x54b460){_0x25f015[_0xb6b2('0x2b')]=_0x54b460['length'];if(_0x25f015[_0xb6b2('0x2b')]===0x0)return[];return db[_0xb6b2('0xaa')]['query'](_0x1d28e2[_0xb6b2('0xab')](),_0x2b69b9)[_0xb6b2('0x30')](function(_0x28861f){_0xf564af=_[_0xb6b2('0xac')](_0x28861f,'id');_0x2b69b9=_[_0xb6b2('0x35')](_0x2b69b9,{'model':db[_0xb6b2('0xad')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x3f1723['query'][_0xb6b2('0x51')]){_0xe03c4d[_0xb6b2('0x4f')][_0xb6b2('0x3c')](function(_0x307c12){_0x562144[_0xb6b2('0x58')]('i.'+_0x307c12);});}else{_0x562144[_0xb6b2('0x58')](_0xb6b2('0xae'),'unreadMessages');_0x562144['field'](_0xb6b2('0xaf'),_0xb6b2('0xb0'));_0x562144[_0xb6b2('0x58')]('a.mandatoryDisposition',_0xb6b2('0xb1'));_0x562144[_0xb6b2('0x58')](_0xb6b2('0xb2'),_0xb6b2('0xa0'));_0x562144[_0xb6b2('0x58')](_0xb6b2('0xb3'));_0x562144['field']('c.firstName',_0xb6b2('0xb4'));_0x562144[_0xb6b2('0x58')]('c.lastName',_0xb6b2('0xb5'));_0x562144[_0xb6b2('0x58')]('c.email',_0xb6b2('0xb6'));_0x562144[_0xb6b2('0x58')](_0xb6b2('0xb7'),_0xb6b2('0xb8'));_0x562144[_0xb6b2('0x58')](_0xb6b2('0xb9'),_0xb6b2('0xba'));_0x562144[_0xb6b2('0x58')](_0xb6b2('0xbb'),_0xb6b2('0xbc'));_0x562144[_0xb6b2('0x58')]('o.fullname','Owner.fullname');_0x562144[_0xb6b2('0x58')](_0xb6b2('0xbd'),_0xb6b2('0xbe'));_0x562144[_0xb6b2('0x58')](_0xb6b2('0xbf'),'TagIds');}if(_0xe03c4d['limit'])_0x562144[_0xb6b2('0x29')](_0xe03c4d[_0xb6b2('0x29')]);if(_0xe03c4d['offset'])_0x562144['offset'](_0xe03c4d[_0xb6b2('0x28')]);return db['sequelize']['query'](_0x562144[_0xb6b2('0xab')](),_0x2b69b9);})['then'](function(_0x42801a){if(_0x42801a['length']>0x0)_0x413f62[_0xb6b2('0x57')](_0xb6b2('0xc0'),_[_0xb6b2('0x47')](_0x42801a,'id'));return db[_0xb6b2('0xaa')][_0xb6b2('0x4d')](_0x413f62['toString'](),_0x2b69b9)['then'](function(_0x579822){var _0x2a1a72=_[_0xb6b2('0xc1')](_0x579822,_0xb6b2('0xc2'));var _0x18033d=[];_0x42801a[_0xb6b2('0x3c')](function(_0x16eca0){_0x18033d['push'](updateChatInteraction(_0x16eca0,_0xf564af,_0x2a1a72));});return BPromise[_0xb6b2('0xc3')](_0x18033d);});});})['then'](function(_0x544207){_0x25f015[_0xb6b2('0xc4')]=_0x544207;return _0x25f015;})['then'](respondWithFilteredResult(_0x31c71e,_0xe03c4d))[_0xb6b2('0x3e')](handleError(_0x31c71e,null));};exports[_0xb6b2('0xc5')]=function(_0x38a48a,_0x6b42b2){var _0x498ae6={'raw':![],'where':{'id':_0x38a48a[_0xb6b2('0xc6')]['id']}},_0x4bb27d={};_0x4bb27d[_0xb6b2('0x4c')]=_[_0xb6b2('0x85')](db[_0xb6b2('0xad')][_0xb6b2('0x48')]);_0x4bb27d[_0xb6b2('0x4d')]=_[_0xb6b2('0x85')](_0x38a48a['query']);_0x4bb27d[_0xb6b2('0x4e')]=_[_0xb6b2('0x50')](_0x4bb27d['model'],_0x4bb27d[_0xb6b2('0x4d')]);_0x498ae6[_0xb6b2('0x4f')]=_['intersection'](_0x4bb27d[_0xb6b2('0x4c')],qs['fields'](_0x38a48a[_0xb6b2('0x4d')][_0xb6b2('0x51')]));_0x498ae6[_0xb6b2('0x4f')]=_0x498ae6[_0xb6b2('0x4f')][_0xb6b2('0x52')]?_0x498ae6[_0xb6b2('0x4f')]:_0x4bb27d['model'];if(_0x38a48a[_0xb6b2('0x4d')][_0xb6b2('0xc7')]){_0x498ae6[_0xb6b2('0xc8')]=[{'all':!![]}];}_0x498ae6=_[_0xb6b2('0x35')]({},_0x498ae6,_0x38a48a['options']);return db['ChatInteraction'][_0xb6b2('0x70')](_0x498ae6)[_0xb6b2('0x30')](handleEntityNotFound(_0x6b42b2,null))[_0xb6b2('0x30')](respondWithResult(_0x6b42b2,null))['catch'](handleError(_0x6b42b2,null));};exports['create']=function(_0x17efe8,_0x5e26f6){return db[_0xb6b2('0xad')]['create'](_0x17efe8[_0xb6b2('0x84')],{})[_0xb6b2('0x30')](respondWithResult(_0x5e26f6,0xc9))['catch'](handleError(_0x5e26f6,null));};exports[_0xb6b2('0x2f')]=function(_0xc842d1,_0x188993){if(_0xc842d1['body']['id']){delete _0xc842d1['body']['id'];}return db[_0xb6b2('0xad')]['find']({'where':{'id':_0xc842d1[_0xb6b2('0xc6')]['id']}})[_0xb6b2('0x30')](handleEntityNotFound(_0x188993,null))['then'](saveUpdates(_0xc842d1[_0xb6b2('0x84')],null))['then'](respondWithResult(_0x188993,null))['catch'](handleError(_0x188993,null));};exports[_0xb6b2('0x31')]=function(_0x3b6d6e,_0x13404a){return db['ChatInteraction'][_0xb6b2('0x70')]({'where':{'id':_0x3b6d6e[_0xb6b2('0xc6')]['id']}})[_0xb6b2('0x30')](handleEntityNotFound(_0x13404a,null))[_0xb6b2('0x30')](removeEntity(_0x13404a,null))['catch'](handleError(_0x13404a,null));};exports[_0xb6b2('0xc9')]=function(_0x58389d,_0x2a5635){return db[_0xb6b2('0xad')][_0xb6b2('0xc9')]()['then'](respondWithResult(_0x2a5635,null))['catch'](handleError(_0x2a5635,null));};exports[_0xb6b2('0xca')]=function(_0x46b423,_0x4faeba){var _0x556665=_0x46b423[_0xb6b2('0xc6')]['id'];var _0x48f595;var _0x4c644e;var _0x3bd135;return db[_0xb6b2('0xad')][_0xb6b2('0xcb')]({'where':{'id':_0x556665}})[_0xb6b2('0x30')](function(_0x27605d){_0x48f595=_0x27605d;return db[_0xb6b2('0xcc')][_0xb6b2('0xcb')]({'where':{'id':_0x27605d[_0xb6b2('0x89')]},'attributes':['id',_0xb6b2('0xcd'),_0xb6b2('0xce'),_0xb6b2('0xcf'),_0xb6b2('0xd0'),_0xb6b2('0xd1')],'raw':!![]});})[_0xb6b2('0x30')](function(_0x10c516){if(_0x10c516&&_0x10c516[_0xb6b2('0xcd')]&&_0x10c516[_0xb6b2('0xce')]){_0x4c644e=_0x10c516;var _0x359314={'interaction':{'id':_0x556665},'agent':{'id':_0x46b423[_0xb6b2('0xa4')]['id'],'name':_0x46b423[_0xb6b2('0xa4')][_0xb6b2('0x33')],'fullname':_0x46b423[_0xb6b2('0xa4')][_0xb6b2('0xd2')],'email':_0x46b423[_0xb6b2('0xa4')][_0xb6b2('0xd3')]},'contact':_0x46b423[_0xb6b2('0x84')][_0xb6b2('0x36')],'account':_0x46b423['body'][_0xb6b2('0xd4')]};var _0x5665b4={'rejectUnauthorized':![],'method':'POST','url':'https://api-vidaoo.xcally.com/api/v1/meetings','headers':{'X-APIKEY':_0x10c516[_0xb6b2('0xcd')]},'body':{'duration':null,'scheduledAt':null,'participants':[_0x46b423[_0xb6b2('0xa4')][_0xb6b2('0xd3')]],'buttons':null,'topic':_0x4c644e[_0xb6b2('0xcf')],'note':_[_0xb6b2('0xd5')](_0x4c644e[_0xb6b2('0xd0')])?null:getMustacheRender(_0x4c644e[_0xb6b2('0xd0')],_0x359314),'metadata':null},'redirect':_0xb6b2('0xd6'),'json':!![]};try{if(!_[_0xb6b2('0xd5')](_0x4c644e['vidaooMetadata'])){var _0x2c3831=getMustacheRender(_0x4c644e['vidaooMetadata'],_0x359314);var _0x18ddaa=JSON[_0xb6b2('0x8c')](_0x2c3831);_0x5665b4['body'][_0xb6b2('0xd7')]=_0x18ddaa;}}catch(_0x585a9a){throw new db['Sequelize']['ValidationError']('Error\x20in\x20conversion\x20vidaooMetadata');}return rp(_0x5665b4);}else{throw new db[(_0xb6b2('0x9d'))][(_0xb6b2('0xd8'))](_0xb6b2('0xd9'));}})[_0xb6b2('0x30')](function(_0x11aaa0){_0x3bd135=_0x11aaa0;if(_0x3bd135['id']){var _0x3d9379={'body':_0x3bd135['join_url'],'ChatWebsiteId':_0x4c644e['id'],'ChatInteractionId':_0x48f595['id'],'direction':_0xb6b2('0xda'),'UserId':_0x46b423[_0xb6b2('0xa4')]['id']};return db[_0xb6b2('0xdb')][_0xb6b2('0xdc')](_0x3d9379,{});}else{throw new db[(_0xb6b2('0x9d'))][(_0xb6b2('0xd8'))]('Unable\x20to\x20create\x20Vidaoo\x20session');}})[_0xb6b2('0x30')](function(){return _0x48f595['updateAttributes']({'vidaooSessionId':_0x3bd135['id']});})[_0xb6b2('0x30')](respondWithResult(_0x4faeba,null))[_0xb6b2('0x3e')](handleError(_0x4faeba,null));};exports[_0xb6b2('0xdd')]=function(_0x1d6aea,_0x369788){if(_0x1d6aea[_0xb6b2('0x84')]['id']){delete _0x1d6aea['body']['id'];}return db[_0xb6b2('0xad')][_0xb6b2('0x70')]({'where':{'id':_0x1d6aea[_0xb6b2('0xc6')]['id']},'include':[{'model':db['CmContact'],'as':_0xb6b2('0x75')}]})['then'](handleEntityNotFound(_0x369788,null))[_0xb6b2('0x30')](saveUpdates(_0x1d6aea[_0xb6b2('0x84')],null))[_0xb6b2('0x30')](respondWithResult(_0x369788,null))[_0xb6b2('0x3e')](handleError(_0x369788,null));};exports[_0xb6b2('0xde')]=function(_0x3c1a40,_0x4c0f3b,_0x42fff2){if(_0x3c1a40['body']['id']){delete _0x3c1a40['body']['id'];}return db[_0xb6b2('0xad')]['find']({'where':{'id':_0x3c1a40['params']['id']}})[_0xb6b2('0x30')](function(_0x16864f){if(!_0x16864f){logger['error']('abandonInteraction,\x20%s,\x20%s,\x20%s',_0xb6b2('0xde'),0x194,_0xb6b2('0xdf'));_0x4c0f3b['sendStatus'](0x194);}else{if(_0x16864f[_0xb6b2('0x43')]){throw new db[(_0xb6b2('0x9d'))]['ValidationError'](_0xb6b2('0xe0'));}}return _0x16864f;})[_0xb6b2('0x30')](function(_0x184b74){if(_0x184b74){return _0x184b74[_0xb6b2('0x2f')]({'closed':_0x3c1a40[_0xb6b2('0x84')]['closed'],'disposition':_0x3c1a40[_0xb6b2('0x84')][_0xb6b2('0x46')]})[_0xb6b2('0x30')](function(_0x26d7b9){return _0x26d7b9;});}})['then'](function(_0x26c9dc){return respondWithRpcPromise(_0xb6b2('0xe1'),_0xb6b2('0xde'),_0x3c1a40[_0xb6b2('0x84')],client9004);})['then'](respondWithResult(_0x4c0f3b,null))['catch'](handleError(_0x4c0f3b,null));};exports[_0xb6b2('0xe2')]=function(_0x5f1d67,_0x3b4797,_0x4910f0){_0x5f1d67[_0xb6b2('0x84')][_0xb6b2('0x33')]=_0x5f1d67[_0xb6b2('0xe3')][_0xb6b2('0xe4')];_0x5f1d67[_0xb6b2('0x84')]['basename']=_0x5f1d67[_0xb6b2('0xe3')][_0xb6b2('0xe5')];_0x5f1d67['body'][_0xb6b2('0x4a')]=_0x5f1d67[_0xb6b2('0xe3')][_0xb6b2('0xe6')];return db[_0xb6b2('0xe7')][_0xb6b2('0xdc')](_0x5f1d67[_0xb6b2('0x84')])['then'](respondWithResult(_0x3b4797,0xc9))[_0xb6b2('0x3e')](handleError(_0x3b4797,null));};exports[_0xb6b2('0xe8')]=function(_0x121900,_0xeff631,_0xe796e0){return db[_0xb6b2('0xad')][_0xb6b2('0xcb')]({'where':{'id':_0x121900[_0xb6b2('0xc6')]['id']},'raw':!![]})[_0xb6b2('0x30')](handleEntityNotFound(_0xeff631,null))[_0xb6b2('0x30')](function(_0x2e44b1){if(_0x2e44b1){if(_0x2e44b1[_0xb6b2('0x45')]){return _0xeff631[_0xb6b2('0x27')](0x193)[_0xb6b2('0xe9')]({'status':0x193,'message':_0xb6b2('0xea')});}return db['Attachment']['findOne']({'where':{'id':_0x121900[_0xb6b2('0x4d')]['attachId']},'raw':!![]})[_0xb6b2('0x30')](handleEntityNotFound(_0xeff631,null));}})[_0xb6b2('0x30')](function(_0x45443a){if(_0x45443a){var _0x1e711a=_0x45443a[_0xb6b2('0xeb')]!==null;var _0xfcdf13=path[_0xb6b2('0xec')](config['root'],_0xb6b2('0xed'));if(_0x1e711a){_0xfcdf13=path[_0xb6b2('0xec')](_0xfcdf13,_0xb6b2('0xee'));}var _0x139bda=path[_0xb6b2('0xec')](_0xfcdf13,_0x45443a[_0xb6b2('0xef')]);return _0xeff631[_0xb6b2('0xf0')](_0x139bda);}})['catch'](handleError(_0xeff631,null));};exports[_0xb6b2('0xf1')]=function(_0x536151,_0x2011aa){var _0x2eb30e=null;var _0x47dff2=null;var _0x461a20=null;var _0x17edce=null;if(_0x536151[_0xb6b2('0x84')]['id']){delete _0x536151[_0xb6b2('0x84')]['id'];}if(_0x536151[_0xb6b2('0x84')][_0xb6b2('0xf2')]){_0x17edce=path['join'](config[_0xb6b2('0xf3')],'server/files/chat/upload/',util[_0xb6b2('0xf4')]('transcript-%s.txt',Date[_0xb6b2('0xf5')]()));_0x536151[_0xb6b2('0x84')][_0xb6b2('0xf6')]=_0x17edce;}return db['ChatInteraction'][_0xb6b2('0x70')]({'where':{'id':_0x536151['params']['id']},'include':[{'model':db[_0xb6b2('0xdb')],'as':_0xb6b2('0xf7'),'include':[{'model':db[_0xb6b2('0x82')],'as':'User'}]}]})[_0xb6b2('0x30')](handleEntityNotFound(_0x2011aa,null))[_0xb6b2('0x30')](saveUpdates(_0x536151[_0xb6b2('0x84')],null))[_0xb6b2('0x30')](function(_0x674576){if(_0x674576){_0x2eb30e=_0x674576;return db[_0xb6b2('0xcc')][_0xb6b2('0x70')]({'where':{'id':_0x2eb30e[_0xb6b2('0x89')]}});}})[_0xb6b2('0x30')](function(_0x5187b7){if(_0x5187b7){_0x461a20=_0x5187b7;return db[_0xb6b2('0xf8')]['find']({'where':{'id':_0x2eb30e[_0xb6b2('0x7b')]}});}})[_0xb6b2('0x30')](function(_0x72931f){if(_0x72931f){_0x47dff2=_0x72931f;if(_0x17edce){var _0x41392e=null;for(var _0x5a656e=0x1;_0x5a656e<_0x2eb30e[_0xb6b2('0xf7')][_0xb6b2('0x52')];++_0x5a656e){_0x41392e=_0x2eb30e[_0xb6b2('0xf7')][_0x5a656e];var _0x29d098=_0x41392e['UserId']?util[_0xb6b2('0xf4')]('%s%d',_0x461a20[_0xb6b2('0xf9')],_0x41392e[_0xb6b2('0x43')]):'System';var _0x2f95ba=_0x536151['body'][_0xb6b2('0xfa')]||util[_0xb6b2('0xf4')]('%s%d',_0xb6b2('0xfb'),_0x41392e[_0xb6b2('0x7b')]);switch(_0x461a20[_0xb6b2('0xfc')]){case'website_alias':_0x29d098=_0x41392e[_0xb6b2('0x43')]?util[_0xb6b2('0xf4')](_0xb6b2('0xfd'),_0x461a20[_0xb6b2('0xf9')],_0x41392e[_0xb6b2('0x43')]):_0xb6b2('0xfe');break;case _0xb6b2('0xff'):_0x29d098=_0x41392e['UserId']?_0x41392e[_0xb6b2('0x82')][_0xb6b2('0x100')]||_0x41392e[_0xb6b2('0x82')][_0xb6b2('0xd2')]:'System';break;case _0xb6b2('0x101'):_0x29d098=_0x41392e[_0xb6b2('0x43')]?_0x41392e[_0xb6b2('0x82')][_0xb6b2('0xd2')]:_0xb6b2('0xfe');break;default:_0x29d098=_0x41392e['UserId']?util[_0xb6b2('0xf4')](_0xb6b2('0xfd'),_0x461a20[_0xb6b2('0xf9')],_0x41392e[_0xb6b2('0x43')]):_0xb6b2('0xfe');}var _0x224bcc=util[_0xb6b2('0xf4')](_0xb6b2('0x102'),moment(_0x41392e['createdAt'])[_0xb6b2('0xf4')](_0xb6b2('0x103')),_0x41392e[_0xb6b2('0x104')]==='in'?_0x2f95ba:_0x29d098,_0x41392e['body']);if(!_0x41392e[_0xb6b2('0x105')]){fs[_0xb6b2('0x106')](_0x17edce,_0x224bcc);}}return db['MailAccount'][_0xb6b2('0xcb')]({'where':{'service':!![]},'include':[{'model':db[_0xb6b2('0x107')],'as':_0xb6b2('0x108'),'raw':!![]}]});}}})['then'](function(_0x5b068a){if(_0x5b068a&&_0x5b068a[_0xb6b2('0x108')]&&_0x536151['body']){var _0x2a3e7c={'tls':{'rejectUnauthorized':![]}};if(_0x5b068a[_0xb6b2('0x108')][_0xb6b2('0x109')]){_0x2a3e7c[_0xb6b2('0x109')]=_0x5b068a[_0xb6b2('0x108')][_0xb6b2('0x109')];}else{_0x2a3e7c[_0xb6b2('0x10a')]=_0x5b068a[_0xb6b2('0x108')][_0xb6b2('0x10a')];_0x2a3e7c['port']=_0x5b068a['Smtp']['port'];_0x2a3e7c[_0xb6b2('0x10b')]=_0x5b068a[_0xb6b2('0x108')][_0xb6b2('0x10b')];}if(_0x5b068a[_0xb6b2('0x108')][_0xb6b2('0x10c')]){_0x2a3e7c[_0xb6b2('0x10d')]={'user':_0x5b068a[_0xb6b2('0x108')][_0xb6b2('0xa4')],'pass':_0x5b068a['Smtp'][_0xb6b2('0x10e')]};}return respondWithRpcPromise(_0xb6b2('0x10f'),_0xb6b2('0x110'),{'account':_0x2a3e7c,'message':{'from':util[_0xb6b2('0xf4')](_0xb6b2('0x111'),_0x5b068a[_0xb6b2('0x33')],_0x5b068a[_0xb6b2('0xd3')]||_0x5b068a[_0xb6b2('0x108')]['user']),'to':_0x536151['body']['mailTranscript'],'subject':_0xb6b2('0x112'),'text':util[_0xb6b2('0xf4')](_0xb6b2('0x113'),_0x536151[_0xb6b2('0x84')][_0xb6b2('0xf2')]),'attachments':[{'path':_0x17edce}]}})[_0xb6b2('0x30')](function(){return _0x2eb30e;})[_0xb6b2('0x3e')](function(_0x29a939){console[_0xb6b2('0x20')](_0x29a939);});}else{return _0x2eb30e;}})[_0xb6b2('0x30')](respondWithStatusCode(_0x2011aa,0xc8))['catch'](handleError(_0x2011aa,null));};exports[_0xb6b2('0x114')]=function(_0x1e6db7,_0x1fa7e5,_0x5e1544){return db[_0xb6b2('0xdb')][_0xb6b2('0x70')]({'where':{'id':_0x1e6db7[_0xb6b2('0xc6')]['id']}})[_0xb6b2('0x30')](handleEntityNotFound(_0x1fa7e5,null))[_0xb6b2('0x30')](function(_0x492d85){if(_0x492d85){return _0x492d85[_0xb6b2('0x114')](_0x1e6db7['body'][_0xb6b2('0x115')],_[_0xb6b2('0x116')](_0x1e6db7['body'],[_0xb6b2('0x115'),'id'])||{});}})[_0xb6b2('0x30')](respondWithResult(_0x1fa7e5,null))[_0xb6b2('0x3e')](handleError(_0x1fa7e5,null));};exports['getMessages']=function(_0x259eef,_0x55a2d8,_0x48f78d){var _0x3229fc={'raw':![],'where':{}};var _0x8458cc={};var _0x543449={'count':0x0,'rows':[]};return db['ChatInteraction'][_0xb6b2('0xcb')]({'where':{'id':_0x259eef[_0xb6b2('0xc6')]['id']}})[_0xb6b2('0x30')](handleEntityNotFound(_0x55a2d8,null))[_0xb6b2('0x30')](function(_0x1b5e04){if(_0x1b5e04){_0x8458cc[_0xb6b2('0x4c')]=_['keys'](db[_0xb6b2('0xdb')]['rawAttributes']);_0x8458cc['query']=_['keys'](_0x259eef['query']);_0x8458cc[_0xb6b2('0x4e')]=_[_0xb6b2('0x50')](_0x8458cc[_0xb6b2('0x4c')],_0x8458cc['query']);_0x3229fc['attributes']=_['intersection'](_0x8458cc[_0xb6b2('0x4c')],qs[_0xb6b2('0x51')](_0x259eef[_0xb6b2('0x4d')]['fields']));_0x3229fc['attributes']=_0x3229fc[_0xb6b2('0x4f')][_0xb6b2('0x52')]?_0x3229fc['attributes']:_0x8458cc[_0xb6b2('0x4c')];if(!_0x259eef[_0xb6b2('0x4d')][_0xb6b2('0x53')](_0xb6b2('0x54'))){_0x3229fc[_0xb6b2('0x29')]=qs[_0xb6b2('0x29')](_0x259eef[_0xb6b2('0x4d')]['limit']);_0x3229fc[_0xb6b2('0x28')]=qs['offset'](_0x259eef[_0xb6b2('0x4d')][_0xb6b2('0x28')]);}_0x3229fc['order']=qs['sort'](_0x259eef['query'][_0xb6b2('0x56')]);_0x3229fc[_0xb6b2('0x57')]=qs[_0xb6b2('0x4e')](_[_0xb6b2('0x117')](_0x259eef[_0xb6b2('0x4d')],_0x8458cc[_0xb6b2('0x4e')]));_0x3229fc[_0xb6b2('0x57')]['ChatInteractionId']=_0x1b5e04['id'];if(_0x259eef[_0xb6b2('0x4d')]['filter']){_0x3229fc['where']=_[_0xb6b2('0x35')](_0x3229fc['where'],{'$or':_['map'](_0x3229fc[_0xb6b2('0x4f')],function(_0x502878){var _0x50be29={};_0x50be29[_0x502878]={'$like':'%'+_0x259eef[_0xb6b2('0x4d')]['filter']+'%'};return _0x50be29;})});}if(_0x259eef[_0xb6b2('0x4d')][_0xb6b2('0x8d')]){var _0x1c23e8=_0x259eef[_0xb6b2('0x4d')][_0xb6b2('0x8d')][_0xb6b2('0x3b')](',');var _0x1bf9ea={};_0x1bf9ea[_0x1c23e8[0x0]]={'$gte':moment(_0x1c23e8[0x1])[_0xb6b2('0xf4')](_0xb6b2('0x118'))};_0x3229fc['where']=_['merge'](_0x3229fc[_0xb6b2('0x57')],_0x1bf9ea);}_0x3229fc=_[_0xb6b2('0x35')]({},_0x3229fc,_0x259eef[_0xb6b2('0x119')]);return db['ChatMessage'][_0xb6b2('0x2b')]({'where':_0x3229fc[_0xb6b2('0x57')]})[_0xb6b2('0x30')](function(_0x406c72){_0x543449[_0xb6b2('0x2b')]=_0x406c72;if(_0x259eef[_0xb6b2('0x4d')][_0xb6b2('0xc7')]){_0x3229fc[_0xb6b2('0xc8')]=[{'all':!![]}];}return db['ChatMessage'][_0xb6b2('0x11a')](_0x3229fc);})[_0xb6b2('0x30')](function(_0x29e297){_0x543449[_0xb6b2('0xc4')]=_0x29e297;return _0x543449;});}})['then'](respondWithFilteredResult(_0x55a2d8,_0x3229fc))[_0xb6b2('0x3e')](handleError(_0x55a2d8,null));};exports[_0xb6b2('0x11b')]=function(_0x7368f3,_0xb9017a,_0x31e38f){var _0x2ddca3={'where':{}},_0x27d92c={},_0x5ba306={'count':0x0,'rows':[]};return db[_0xb6b2('0xad')][_0xb6b2('0xcb')]({'where':{'id':_0x7368f3[_0xb6b2('0xc6')]['id']}})[_0xb6b2('0x30')](handleEntityNotFound(_0xb9017a,null))[_0xb6b2('0x30')](function(_0x37fcc8){if(_0x37fcc8){_0x27d92c[_0xb6b2('0x4c')]=_[_0xb6b2('0x85')](db[_0xb6b2('0xdb')][_0xb6b2('0x48')]);_0x27d92c[_0xb6b2('0x4d')]=_[_0xb6b2('0x85')](_0x7368f3[_0xb6b2('0x4d')]);_0x27d92c[_0xb6b2('0x4e')]=_['intersection'](_0x27d92c['model'],_0x27d92c[_0xb6b2('0x4d')]);_0x2ddca3[_0xb6b2('0x4f')]=_[_0xb6b2('0x50')](_0x27d92c[_0xb6b2('0x4c')],qs[_0xb6b2('0x51')](_0x7368f3[_0xb6b2('0x4d')][_0xb6b2('0x51')]));_0x2ddca3[_0xb6b2('0x4f')]=_0x2ddca3[_0xb6b2('0x4f')][_0xb6b2('0x52')]?_0x2ddca3['attributes']:_0x27d92c[_0xb6b2('0x4c')];if(!_0x7368f3[_0xb6b2('0x4d')][_0xb6b2('0x53')](_0xb6b2('0x54'))){_0x2ddca3[_0xb6b2('0x29')]=qs[_0xb6b2('0x29')](_0x7368f3[_0xb6b2('0x4d')]['limit']);_0x2ddca3[_0xb6b2('0x28')]=qs[_0xb6b2('0x28')](_0x7368f3[_0xb6b2('0x4d')][_0xb6b2('0x28')]);}_0x2ddca3['order']=qs[_0xb6b2('0x56')](_0x7368f3[_0xb6b2('0x4d')][_0xb6b2('0x56')]);_0x2ddca3['where']=qs['filters'](_[_0xb6b2('0x117')](_0x7368f3[_0xb6b2('0x4d')],_0x27d92c[_0xb6b2('0x4e')]));_0x2ddca3[_0xb6b2('0x57')][_0xb6b2('0xc2')]=_0x37fcc8['id'];if(_0x7368f3['query']['filter']){_0x2ddca3[_0xb6b2('0x57')]=_[_0xb6b2('0x35')](_0x2ddca3['where'],{'$or':_['map'](_0x2ddca3[_0xb6b2('0x4f')],function(_0x15ea1e){var _0x20c077={};_0x20c077[_0x15ea1e]={'$like':'%'+_0x7368f3[_0xb6b2('0x4d')][_0xb6b2('0x95')]+'%'};return _0x20c077;})});}_0x2ddca3['where'][_0xb6b2('0x105')]=![];if(_0x7368f3[_0xb6b2('0x4d')]['id']){_0x2ddca3[_0xb6b2('0x57')]['id']={'$gt':_0x7368f3[_0xb6b2('0x4d')]['id']};}_0x2ddca3=_[_0xb6b2('0x35')]({},_0x2ddca3,_0x7368f3['options']);return db[_0xb6b2('0xdb')][_0xb6b2('0x2b')]({'where':_0x2ddca3['where']})[_0xb6b2('0x30')](function(_0x8d955c){_0x5ba306['count']=_0x8d955c;_0x2ddca3[_0xb6b2('0xc8')]=[];if(_0x7368f3[_0xb6b2('0x4d')][_0xb6b2('0x11c')]){_0x2ddca3[_0xb6b2('0xc8')]['push']({'model':db[_0xb6b2('0x82')],'as':'User','attributes':['id',_0xb6b2('0xd2'),_0xb6b2('0x100')]});}if(_0x7368f3[_0xb6b2('0x4d')][_0xb6b2('0xc7')]){_0x2ddca3[_0xb6b2('0xc8')]=[{'all':!![]}];}return db[_0xb6b2('0xdb')][_0xb6b2('0x11a')](_0x2ddca3);})[_0xb6b2('0x30')](function(_0x42281b){_0x5ba306[_0xb6b2('0xc4')]=_0x42281b;return _0x5ba306;});}})['then'](respondWithFilteredResult(_0xb9017a,_0x2ddca3))[_0xb6b2('0x3e')](handleError(_0xb9017a,null));};exports['addTags']=function(_0x27bd38,_0x2ae9dc,_0x126984){return db[_0xb6b2('0xad')]['find']({'where':{'id':_0x27bd38['params']['id']}})['then'](handleEntityNotFound(_0x2ae9dc,null))[_0xb6b2('0x30')](function(_0x173edb){if(_0x173edb){return _0x173edb['setTags'](_0x27bd38['body']['ids'],_[_0xb6b2('0x116')](_0x27bd38[_0xb6b2('0x84')],['ids','id'])||{})[_0xb6b2('0x11d')](function(){return db[_0xb6b2('0x7f')][_0xb6b2('0x11a')]({'attributes':['id','name',_0xb6b2('0x59')],'where':{'id':_0x27bd38[_0xb6b2('0x84')][_0xb6b2('0x115')]}});})[_0xb6b2('0x30')](function(_0xbdef8f){socket[_0xb6b2('0x11e')](_0xb6b2('0x11f'),{'id':Number(_0x27bd38[_0xb6b2('0xc6')]['id']),'tags':_0xbdef8f||[]});return{'id':Number(_0x27bd38[_0xb6b2('0xc6')]['id']),'tags':_0xbdef8f||[]};});}})[_0xb6b2('0x30')](respondWithResult(_0x2ae9dc,null))['catch'](handleError(_0x2ae9dc,null));};exports[_0xb6b2('0x120')]=function(_0x27cd16,_0x1a10aa,_0x3a6610){return db[_0xb6b2('0xad')]['find']({'where':{'id':_0x27cd16['params']['id']}})[_0xb6b2('0x30')](handleEntityNotFound(_0x1a10aa,null))['then'](function(_0x40bd7d){if(_0x40bd7d){return _0x40bd7d[_0xb6b2('0x120')](_0x27cd16[_0xb6b2('0x4d')][_0xb6b2('0x115')]);}})['then'](respondWithStatusCode(_0x1a10aa,null))[_0xb6b2('0x3e')](handleError(_0x1a10aa,null));};exports[_0xb6b2('0xf0')]=function(_0xb33f09,_0x431b79){var _0xb273b7=moment()['unix']()[_0xb6b2('0xab')]();var _0x50328e=path[_0xb6b2('0xec')](config['root'],_0xb6b2('0x121'),_0xb6b2('0x122'),_0xb6b2('0x123'));var _0x40942a=path[_0xb6b2('0xec')](config[_0xb6b2('0xf3')],'server',_0xb6b2('0x122'),'attachments');var _0x92eeba=path[_0xb6b2('0xec')](_0x50328e,_0xb273b7);var _0x3d1f79=util[_0xb6b2('0xf4')](_0xb6b2('0x124'),_0xb33f09['params']['id'],_0xb273b7);var _0x289110=path[_0xb6b2('0xec')](_0x50328e,_0x3d1f79);var _0x34be29=[];_0x34be29[_0xb6b2('0x3d')]({'model':db[_0xb6b2('0x82')],'as':_0xb6b2('0x82'),'attributes':['id',_0xb6b2('0xd2')],'raw':!![]});_0x34be29[_0xb6b2('0x3d')]({'model':db[_0xb6b2('0xf8')],'as':_0xb6b2('0x75'),'attributes':['id','firstName',_0xb6b2('0x125')],'raw':!![]});if(_0xb33f09[_0xb6b2('0x4d')]['attachments']){_0x34be29[_0xb6b2('0x3d')]({'model':db[_0xb6b2('0xe7')],'as':_0xb6b2('0xe7'),'raw':!![]});}var _0x2d0c9f=[{'model':db[_0xb6b2('0xdb')],'as':_0xb6b2('0xf7'),'attributes':['id',_0xb6b2('0x84'),_0xb6b2('0x8b'),_0xb6b2('0x104'),_0xb6b2('0x105'),_0xb6b2('0x91')],'include':_0x34be29}];_0x2d0c9f['push']({'model':db['ChatWebsite'],'as':_0xb6b2('0x126'),'attributes':['id',_0xb6b2('0x33')]});_0x2d0c9f[_0xb6b2('0x3d')]({'model':db[_0xb6b2('0x82')],'as':_0xb6b2('0x127'),'attributes':['id','fullname']});return db[_0xb6b2('0xad')][_0xb6b2('0x70')]({'where':{'id':_0xb33f09[_0xb6b2('0xc6')]['id']},'include':_0x2d0c9f})['then'](handleEntityNotFound(_0x431b79,null))[_0xb6b2('0x30')](function(_0x20ff2e){if(_0x20ff2e){var _0x40f6c1=_0x20ff2e[_0xb6b2('0x128')]({'plain':!![]});fs['mkdirSync'](_0x92eeba);var _0x4bec5f={'channel':_0xb6b2('0x129'),'account':_0x40f6c1[_0xb6b2('0x126')][_0xb6b2('0x33')],'agent':_0x40f6c1['Owner']?_0x40f6c1[_0xb6b2('0x127')][_0xb6b2('0xd2')]:'N.A.','createdAt':moment(_0x40f6c1['createdAt'])[_0xb6b2('0xf4')](_0xb6b2('0x118'))['toString'](),'closedAt':_0x40f6c1['closed']?moment(_0x40f6c1['closedAt'])['format'](_0xb6b2('0x118'))[_0xb6b2('0xab')]():'','disposition':_0x40f6c1[_0xb6b2('0x46')],'chatInfo':{'browser':_0x40f6c1['browserName'],'os':_0x40f6c1[_0xb6b2('0x12a')],'referer':_0x40f6c1[_0xb6b2('0x12b')],'customerIp':_0x40f6c1['customerIp'],'customerPort':_0x40f6c1['customerPort']?_0x40f6c1['customerPort']:_0xb6b2('0x12c')},'messages':_(_0x40f6c1[_0xb6b2('0xf7')])[_0xb6b2('0x12d')]()[_0xb6b2('0x95')]({'secret':![]})['map'](function(_0x4e226e){if(_0x4e226e[_0xb6b2('0xe7')]){var _0x28c834=path['join'](_0x40942a,_0x4e226e[_0xb6b2('0xe7')][_0xb6b2('0xef')]);if(fs[_0xb6b2('0x12e')](_0x28c834)){fs[_0xb6b2('0x12f')](_0x28c834)[_0xb6b2('0x130')](fs['createWriteStream'](path[_0xb6b2('0xec')](_0x92eeba,_0x4e226e[_0xb6b2('0xe7')][_0xb6b2('0xef')])));}}return{'date':moment(_0x4e226e['createdAt'])[_0xb6b2('0xf4')](_0xb6b2('0x118'))['toString'](),'sender':_0x4e226e[_0xb6b2('0x104')]===_0xb6b2('0xda')?_0x4e226e[_0xb6b2('0x82')]?_0x4e226e['User']['fullname']:_0xb6b2('0xfe'):_0x4e226e['Contact'][_0xb6b2('0x131')]+(_0x4e226e['Contact'][_0xb6b2('0x125')]?'\x20'+_0x4e226e[_0xb6b2('0x75')][_0xb6b2('0x125')]:''),'body':_0x4e226e[_0xb6b2('0xe7')]?_0x4e226e[_0xb6b2('0xe7')][_0xb6b2('0xef')]:_0x4e226e[_0xb6b2('0x84')],'direction':_0x4e226e[_0xb6b2('0x104')]===_0xb6b2('0xda')?'A':'C','secret':_0x4e226e[_0xb6b2('0x105')],'read':_0x4e226e[_0xb6b2('0x91')],'attachment':_0x4e226e[_0xb6b2('0xe7')]};})[_0xb6b2('0x77')]()};return ejs[_0xb6b2('0x132')](path[_0xb6b2('0xec')](config['root'],'server',_0xb6b2('0x133'),_0xb6b2('0x134')),{'interaction':_0x4bec5f})['then'](function(_0x3824a2){var _0x53aa75=path[_0xb6b2('0xec')](_0x92eeba,'transcript-'+_0x40f6c1['id']+'-'+_0xb273b7+_0xb6b2('0x135'));var _0x4d9b2a={'path':_0x53aa75,'channel':_0xb6b2('0x129'),'interactionId':_0x40f6c1['id']};return pdf['createPdfFromHTML'](_0x3824a2,_0x4d9b2a);})[_0xb6b2('0x30')](function(){return new BPromise(function(_0x131ad9,_0x5dbe7f){zipdir(_0x92eeba,{'saveTo':_0x289110},function(_0xb6b198,_0x2a8d9b){if(_0xb6b198)return _0x5dbe7f(_0xb6b198);return _0x131ad9(_0x2a8d9b);});})['then'](function(){return new BPromise(function(_0x225ce0,_0x432fd1){rimraf(_0x92eeba,function(_0x36abe8){if(_0x36abe8)_0x432fd1(_0x36abe8);return _0x225ce0();});});})['then'](function(){return _0x431b79['download'](_0x289110,_0x3d1f79,function(_0x1cde6c){if(_0x1cde6c){console[_0xb6b2('0x136')]('err',_0x1cde6c);}else{fs[_0xb6b2('0x137')](_0x289110);}});});});}else{return _0x431b79[_0xb6b2('0x25')](0xc8);}})[_0xb6b2('0x3e')](handleError(_0x431b79,null));}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.events.js b/server/api/chatInteraction/chatInteraction.events.js index bb0e899..737d217 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 _0x977e=['exports','events','../../mysqldb','ChatInteraction','ChatMessage','update','remove','getUsers','then','setDataValue','Users','map','findAll','unreadMessages','length','emit','catch','hasOwnProperty','hook'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x977e,0x1c9));var _0xe977=function(_0x5482b3,_0x522dc0){_0x5482b3=_0x5482b3-0x0;var _0x31284c=_0x977e[_0x5482b3];return _0x31284c;};'use strict';var EventEmitter=require(_0xe977('0x0'));var ChatInteraction=require(_0xe977('0x1'))['db'][_0xe977('0x2')];var ChatMessage=require('../../mysqldb')['db'][_0xe977('0x3')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xe977('0x4'),'afterDestroy':_0xe977('0x5')};function emitEvent(_0x2db67c){return function(_0xd86bbf,_0x49b9f1,_0x1466e7){_0xd86bbf[_0xe977('0x6')]({'attributes':['id'],'raw':!![]})[_0xe977('0x7')](function(_0x19c730){_0xd86bbf[_0xe977('0x8')](_0xe977('0x9'),_0x19c730[_0xe977('0xa')](function(_0x2f9b9b){return{'id':_0x2f9b9b['id']};}));return ChatMessage[_0xe977('0xb')]({'where':{'ChatInteractionId':_0xd86bbf['id'],'direction':'in','read':![]},'raw':!![]});})[_0xe977('0x7')](function(_0x4e3dfc){_0xd86bbf[_0xe977('0x8')](_0xe977('0xc'),_0x4e3dfc[_0xe977('0xd')]);ChatInteractionEvents['emit'](_0x2db67c+':'+_0xd86bbf['id'],_0xd86bbf);ChatInteractionEvents[_0xe977('0xe')](_0x2db67c,_0xd86bbf);_0x1466e7(null);})[_0xe977('0xf')](_0x1466e7(null));};}for(var e in events){if(events[_0xe977('0x10')](e)){var event=events[e];ChatInteraction[_0xe977('0x11')](e,emitEvent(event));}}module[_0xe977('0x12')]=ChatInteractionEvents; \ No newline at end of file +var _0xe6f0=['setMaxListeners','save','remove','then','setDataValue','map','findAll','unreadMessages','length','emit','catch','hook','exports','events','../../mysqldb','ChatInteraction','ChatMessage'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe6f0,0x1a5));var _0x0e6f=function(_0x3fec1f,_0x563512){_0x3fec1f=_0x3fec1f-0x0;var _0x5cb79b=_0xe6f0[_0x3fec1f];return _0x5cb79b;};'use strict';var EventEmitter=require(_0x0e6f('0x0'));var ChatInteraction=require(_0x0e6f('0x1'))['db'][_0x0e6f('0x2')];var ChatMessage=require('../../mysqldb')['db'][_0x0e6f('0x3')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0x0e6f('0x4')](0x0);var events={'afterCreate':_0x0e6f('0x5'),'afterUpdate':'update','afterDestroy':_0x0e6f('0x6')};function emitEvent(_0x3a6e7c){return function(_0x3b60b4,_0x54a845,_0x29197d){_0x3b60b4['getUsers']({'attributes':['id'],'raw':!![]})[_0x0e6f('0x7')](function(_0x4271be){_0x3b60b4[_0x0e6f('0x8')]('Users',_0x4271be[_0x0e6f('0x9')](function(_0x57ac2b){return{'id':_0x57ac2b['id']};}));return ChatMessage[_0x0e6f('0xa')]({'where':{'ChatInteractionId':_0x3b60b4['id'],'direction':'in','read':![]},'raw':!![]});})[_0x0e6f('0x7')](function(_0x238ad9){_0x3b60b4[_0x0e6f('0x8')](_0x0e6f('0xb'),_0x238ad9[_0x0e6f('0xc')]);ChatInteractionEvents[_0x0e6f('0xd')](_0x3a6e7c+':'+_0x3b60b4['id'],_0x3b60b4);ChatInteractionEvents['emit'](_0x3a6e7c,_0x3b60b4);_0x29197d(null);})[_0x0e6f('0xe')](_0x29197d(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatInteraction[_0x0e6f('0xf')](e,emitEvent(event));}}module[_0x0e6f('0x10')]=ChatInteractionEvents; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.model.js b/server/api/chatInteraction/chatInteraction.model.js index 22a6c86..8aebf4e 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 _0x79c9=['YYYY-MM-DD\x20HH:mm:ss','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','bluebird','path','rimraf','../../config/environment','./chatInteraction.attributes','exports','define','ChatInteraction','closed','closedAt','format'];(function(_0x417b27,_0x3d89e8){var _0x2abb16=function(_0x3a7653){while(--_0x3a7653){_0x417b27['push'](_0x417b27['shift']());}};_0x2abb16(++_0x3d89e8);}(_0x79c9,0x159));var _0x979c=function(_0x3c2067,_0xa7f55c){_0x3c2067=_0x3c2067-0x0;var _0x3b6b60=_0x79c9[_0x3c2067];return _0x3b6b60;};'use strict';var _=require(_0x979c('0x0'));var util=require(_0x979c('0x1'));var logger=require(_0x979c('0x2'))(_0x979c('0x3'));var moment=require('moment');var BPromise=require(_0x979c('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x979c('0x5'));var rimraf=require(_0x979c('0x6'));var config=require(_0x979c('0x7'));var attributes=require(_0x979c('0x8'));module[_0x979c('0x9')]=function(_0x5413a1,_0x5cc0ac){return _0x5413a1[_0x979c('0xa')](_0x979c('0xb'),attributes,{'tableName':'chat_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x29b4e1,_0xfef358,_0x53eff9){if(_0x29b4e1['changed'](_0x979c('0xc'))){_0x29b4e1[_0x979c('0xd')]=moment()[_0x979c('0xe')](_0x979c('0xf'));}_0x53eff9(null,_0x29b4e1);}},'charset':_0x979c('0x10'),'collate':_0x979c('0x11')});}; \ No newline at end of file +var _0x692c=['api','moment','bluebird','request-promise','rimraf','define','chat_interactions','changed','closed','closedAt','YYYY-MM-DD\x20HH:mm:ss','utf8mb4','lodash','util','../../config/logger'];(function(_0x533b87,_0x591790){var _0xf39d05=function(_0x3a5f60){while(--_0x3a5f60){_0x533b87['push'](_0x533b87['shift']());}};_0xf39d05(++_0x591790);}(_0x692c,0x84));var _0xc692=function(_0x698254,_0x487811){_0x698254=_0x698254-0x0;var _0x1736c6=_0x692c[_0x698254];return _0x1736c6;};'use strict';var _=require(_0xc692('0x0'));var util=require(_0xc692('0x1'));var logger=require(_0xc692('0x2'))(_0xc692('0x3'));var moment=require(_0xc692('0x4'));var BPromise=require(_0xc692('0x5'));var rp=require(_0xc692('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc692('0x7'));var config=require('../../config/environment');var attributes=require('./chatInteraction.attributes');module['exports']=function(_0x4c837a,_0x400fbd){return _0x4c837a[_0xc692('0x8')]('ChatInteraction',attributes,{'tableName':_0xc692('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0xc93261,_0x4c01c4,_0x598332){if(_0xc93261[_0xc692('0xa')](_0xc692('0xb'))){_0xc93261[_0xc692('0xc')]=moment()['format'](_0xc692('0xd'));}_0x598332(null,_0xc93261);}},'charset':_0xc692('0xe'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.rpc.js b/server/api/chatInteraction/chatInteraction.rpc.js index 2114437..b1b7158 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 _0x63cd=['./chatInteraction.socket','request','then','info','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','ChatInteraction,\x20%s,\x20%s','message','result','catch','UpdateChatInteraction','update','options','where','attributes','limit','AddTagsToChatInteraction','find','body','ids','omit','spread','AddTags','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter'];(function(_0x47a768,_0x3357cc){var _0x5d756d=function(_0x3d89b4){while(--_0x3d89b4){_0x47a768['push'](_0x47a768['shift']());}};_0x5d756d(++_0x3357cc);}(_0x63cd,0xdd));var _0xd63c=function(_0xe3f14c,_0x5967bf){_0xe3f14c=_0xe3f14c-0x0;var _0x41edc0=_0x63cd[_0xe3f14c];return _0x41edc0;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0xd63c('0x0'));var rs=require(_0xd63c('0x1'));var fs=require('fs');var Redis=require(_0xd63c('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xd63c('0x3'));var logger=require(_0xd63c('0x4'))(_0xd63c('0x5'));var config=require(_0xd63c('0x6'));var jayson=require(_0xd63c('0x7'));var client=jayson[_0xd63c('0x8')][_0xd63c('0x9')]({'port':0x232a});config[_0xd63c('0xa')]=_['defaults'](config[_0xd63c('0xa')],{'host':_0xd63c('0xb'),'port':0x18eb});var socket=require(_0xd63c('0xc'))(new Redis(config[_0xd63c('0xa')]));require(_0xd63c('0xd'))['register'](socket);function respondWithRpcPromise(_0x2f22d2,_0xe83b71,_0x16e41e){return new BPromise(function(_0xc6273e,_0x8fbaa5){return client[_0xd63c('0xe')](_0x2f22d2,_0x16e41e)[_0xd63c('0xf')](function(_0x4b598f){logger[_0xd63c('0x10')]('ChatInteraction,\x20%s,\x20%s',_0xe83b71,'request\x20sent');logger[_0xd63c('0x11')](_0xd63c('0x12'),_0xe83b71,_0xd63c('0x13'),JSON[_0xd63c('0x14')](_0x4b598f));if(_0x4b598f[_0xd63c('0x15')]){if(_0x4b598f['error']['code']===0x1f4){logger['error'](_0xd63c('0x16'),_0xe83b71,_0x4b598f[_0xd63c('0x15')][_0xd63c('0x17')]);return _0x8fbaa5(_0x4b598f[_0xd63c('0x15')]['message']);}logger['error'](_0xd63c('0x16'),_0xe83b71,_0x4b598f['error'][_0xd63c('0x17')]);return _0xc6273e(_0x4b598f[_0xd63c('0x15')]['message']);}else{logger['info'](_0xd63c('0x16'),_0xe83b71,_0xd63c('0x13'));_0xc6273e(_0x4b598f[_0xd63c('0x18')][_0xd63c('0x17')]);}})[_0xd63c('0x19')](function(_0x355ec4){logger[_0xd63c('0x15')](_0xd63c('0x16'),_0xe83b71,_0x355ec4);_0x8fbaa5(_0x355ec4);});});}exports[_0xd63c('0x1a')]=function(_0x3b2f68){var _0x2aba87=this;return new Promise(function(_0x4602cd,_0x4d7679){return db['ChatInteraction'][_0xd63c('0x1b')](_0x3b2f68['body'],{'raw':_0x3b2f68[_0xd63c('0x1c')]?_0x3b2f68[_0xd63c('0x1c')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3b2f68[_0xd63c('0x1c')]?_0x3b2f68[_0xd63c('0x1c')][_0xd63c('0x1d')]||null:null,'attributes':_0x3b2f68['options']?_0x3b2f68[_0xd63c('0x1c')][_0xd63c('0x1e')]||null:null,'limit':_0x3b2f68['options']?_0x3b2f68[_0xd63c('0x1c')][_0xd63c('0x1f')]||null:null})[_0xd63c('0xf')](function(_0x1fc213){logger['info'](_0xd63c('0x1a'),_0x3b2f68);logger['debug'](_0xd63c('0x1a'),_0x3b2f68,JSON[_0xd63c('0x14')](_0x1fc213));_0x4602cd(_0x1fc213);})[_0xd63c('0x19')](function(_0x5ebcde){logger[_0xd63c('0x15')](_0xd63c('0x1a'),_0x5ebcde['message'],_0x3b2f68);_0x4d7679(_0x2aba87[_0xd63c('0x15')](0x1f4,_0x5ebcde[_0xd63c('0x17')]));});});};exports[_0xd63c('0x20')]=function(_0x31bd6f){return new Promise(function(_0x455129,_0x34a8eb){return db['ChatInteraction'][_0xd63c('0x21')]({'where':_0x31bd6f[_0xd63c('0x1c')]?_0x31bd6f[_0xd63c('0x1c')][_0xd63c('0x1d')]||null:null})[_0xd63c('0xf')](function(_0x19769f){if(_0x19769f){return _0x19769f['addTags'](_0x31bd6f[_0xd63c('0x22')][_0xd63c('0x23')],_[_0xd63c('0x24')](_0x31bd6f[_0xd63c('0x22')],[_0xd63c('0x23'),'id'])||{});}})[_0xd63c('0x25')](function(_0x483374){logger[_0xd63c('0x10')](_0xd63c('0x26'),_0x31bd6f);logger[_0xd63c('0x11')]('AddTags',_0x31bd6f,JSON[_0xd63c('0x14')](_0x483374));_0x455129(_0x483374);})[_0xd63c('0x19')](function(_0x11f99e){logger[_0xd63c('0x15')](_0xd63c('0x26'),_0x11f99e[_0xd63c('0x17')],_0x31bd6f);_0x34a8eb(_this['error'](0x1f4,_0x11f99e['message']));});});}; \ No newline at end of file +var _0xd062=['socket.io-emitter','./chatInteraction.socket','register','then','info','ChatInteraction,\x20%s,\x20%s','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','UpdateChatInteraction','update','body','options','raw','where','attributes','stringify','catch','AddTagsToChatInteraction','find','addTags','ids','omit','spread','AddTags','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost'];(function(_0x87c726,_0x2235d3){var _0xbcdcdd=function(_0x22565c){while(--_0x22565c){_0x87c726['push'](_0x87c726['shift']());}};_0xbcdcdd(++_0x2235d3);}(_0xd062,0xa0));var _0x2d06=function(_0x543dd8,_0xfe806e){_0x543dd8=_0x543dd8-0x0;var _0x2f8b46=_0xd062[_0x543dd8];return _0x2f8b46;};'use strict';var _=require('lodash');var util=require(_0x2d06('0x0'));var moment=require(_0x2d06('0x1'));var BPromise=require(_0x2d06('0x2'));var rs=require(_0x2d06('0x3'));var fs=require('fs');var Redis=require(_0x2d06('0x4'));var db=require(_0x2d06('0x5'))['db'];var utils=require(_0x2d06('0x6'));var logger=require(_0x2d06('0x7'))(_0x2d06('0x8'));var config=require(_0x2d06('0x9'));var jayson=require(_0x2d06('0xa'));var client=jayson[_0x2d06('0xb')][_0x2d06('0xc')]({'port':0x232a});config[_0x2d06('0xd')]=_[_0x2d06('0xe')](config[_0x2d06('0xd')],{'host':_0x2d06('0xf'),'port':0x18eb});var socket=require(_0x2d06('0x10'))(new Redis(config[_0x2d06('0xd')]));require(_0x2d06('0x11'))[_0x2d06('0x12')](socket);function respondWithRpcPromise(_0x16e6d3,_0x82e084,_0x40e510){return new BPromise(function(_0xd9117d,_0x344c29){return client['request'](_0x16e6d3,_0x40e510)[_0x2d06('0x13')](function(_0x5dd5a9){logger[_0x2d06('0x14')](_0x2d06('0x15'),_0x82e084,'request\x20sent');logger[_0x2d06('0x16')](_0x2d06('0x17'),_0x82e084,_0x2d06('0x18'),JSON['stringify'](_0x5dd5a9));if(_0x5dd5a9[_0x2d06('0x19')]){if(_0x5dd5a9['error'][_0x2d06('0x1a')]===0x1f4){logger['error'](_0x2d06('0x15'),_0x82e084,_0x5dd5a9['error'][_0x2d06('0x1b')]);return _0x344c29(_0x5dd5a9[_0x2d06('0x19')][_0x2d06('0x1b')]);}logger[_0x2d06('0x19')](_0x2d06('0x15'),_0x82e084,_0x5dd5a9[_0x2d06('0x19')][_0x2d06('0x1b')]);return _0xd9117d(_0x5dd5a9['error'][_0x2d06('0x1b')]);}else{logger['info'](_0x2d06('0x15'),_0x82e084,_0x2d06('0x18'));_0xd9117d(_0x5dd5a9['result'][_0x2d06('0x1b')]);}})['catch'](function(_0x3310bf){logger['error']('ChatInteraction,\x20%s,\x20%s',_0x82e084,_0x3310bf);_0x344c29(_0x3310bf);});});}exports[_0x2d06('0x1c')]=function(_0x4f0a96){var _0x4ed3ee=this;return new Promise(function(_0x318168,_0x2bf91e){return db['ChatInteraction'][_0x2d06('0x1d')](_0x4f0a96[_0x2d06('0x1e')],{'raw':_0x4f0a96[_0x2d06('0x1f')]?_0x4f0a96[_0x2d06('0x1f')][_0x2d06('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4f0a96[_0x2d06('0x1f')]?_0x4f0a96[_0x2d06('0x1f')][_0x2d06('0x21')]||null:null,'attributes':_0x4f0a96[_0x2d06('0x1f')]?_0x4f0a96[_0x2d06('0x1f')][_0x2d06('0x22')]||null:null,'limit':_0x4f0a96[_0x2d06('0x1f')]?_0x4f0a96[_0x2d06('0x1f')]['limit']||null:null})[_0x2d06('0x13')](function(_0x5b97f4){logger[_0x2d06('0x14')](_0x2d06('0x1c'),_0x4f0a96);logger[_0x2d06('0x16')](_0x2d06('0x1c'),_0x4f0a96,JSON[_0x2d06('0x23')](_0x5b97f4));_0x318168(_0x5b97f4);})[_0x2d06('0x24')](function(_0x3271c7){logger[_0x2d06('0x19')]('UpdateChatInteraction',_0x3271c7[_0x2d06('0x1b')],_0x4f0a96);_0x2bf91e(_0x4ed3ee[_0x2d06('0x19')](0x1f4,_0x3271c7['message']));});});};exports[_0x2d06('0x25')]=function(_0x8a2f80){return new Promise(function(_0x2d26a7,_0x5d91ac){return db['ChatInteraction'][_0x2d06('0x26')]({'where':_0x8a2f80[_0x2d06('0x1f')]?_0x8a2f80[_0x2d06('0x1f')][_0x2d06('0x21')]||null:null})[_0x2d06('0x13')](function(_0x1096a9){if(_0x1096a9){return _0x1096a9[_0x2d06('0x27')](_0x8a2f80[_0x2d06('0x1e')][_0x2d06('0x28')],_[_0x2d06('0x29')](_0x8a2f80[_0x2d06('0x1e')],['ids','id'])||{});}})[_0x2d06('0x2a')](function(_0x37ce58){logger[_0x2d06('0x14')](_0x2d06('0x2b'),_0x8a2f80);logger[_0x2d06('0x16')](_0x2d06('0x2b'),_0x8a2f80,JSON['stringify'](_0x37ce58));_0x2d26a7(_0x37ce58);})[_0x2d06('0x24')](function(_0x186c7f){logger[_0x2d06('0x19')](_0x2d06('0x2b'),_0x186c7f[_0x2d06('0x1b')],_0x8a2f80);_0x5d91ac(_this[_0x2d06('0x19')](0x1f4,_0x186c7f[_0x2d06('0x1b')]));});});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.socket.js b/server/api/chatInteraction/chatInteraction.socket.js index 4909465..f1db2d5 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 _0xb763=['save','remove','update','emit','removeListener','register','length','chatInteraction:','./chatInteraction.events'];(function(_0x35b211,_0x4276a4){var _0x23c359=function(_0x34fde2){while(--_0x34fde2){_0x35b211['push'](_0x35b211['shift']());}};_0x23c359(++_0x4276a4);}(_0xb763,0x155));var _0x3b76=function(_0x3380f0,_0x2094c6){_0x3380f0=_0x3380f0-0x0;var _0x2a0e64=_0xb763[_0x3380f0];return _0x2a0e64;};'use strict';var ChatInteractionEvents=require(_0x3b76('0x0'));var events=[_0x3b76('0x1'),_0x3b76('0x2'),_0x3b76('0x3')];function createListener(_0x535caf,_0x5d966d){return function(_0x2f6e42){_0x5d966d[_0x3b76('0x4')](_0x535caf,_0x2f6e42);};}function removeListener(_0x32b878,_0x222d63){return function(){ChatInteractionEvents[_0x3b76('0x5')](_0x32b878,_0x222d63);};}exports[_0x3b76('0x6')]=function(_0x54f432){for(var _0x4c5a23=0x0,_0x4a0428=events[_0x3b76('0x7')];_0x4c5a23<_0x4a0428;_0x4c5a23++){var _0xe60f92=events[_0x4c5a23];var _0x4b7b35=createListener(_0x3b76('0x8')+_0xe60f92,_0x54f432);ChatInteractionEvents['on'](_0xe60f92,_0x4b7b35);}}; \ No newline at end of file +var _0xea85=['removeListener','register','length','chatInteraction:','./chatInteraction.events','save','remove','update','emit'];(function(_0x26a591,_0x2202a6){var _0x25bbc3=function(_0x34ba10){while(--_0x34ba10){_0x26a591['push'](_0x26a591['shift']());}};_0x25bbc3(++_0x2202a6);}(_0xea85,0x1ea));var _0x5ea8=function(_0x2dcc5e,_0xee1ec2){_0x2dcc5e=_0x2dcc5e-0x0;var _0x40c2d4=_0xea85[_0x2dcc5e];return _0x40c2d4;};'use strict';var ChatInteractionEvents=require(_0x5ea8('0x0'));var events=[_0x5ea8('0x1'),_0x5ea8('0x2'),_0x5ea8('0x3')];function createListener(_0x664ad7,_0x483e29){return function(_0x2a620b){_0x483e29[_0x5ea8('0x4')](_0x664ad7,_0x2a620b);};}function removeListener(_0x159005,_0x2e9052){return function(){ChatInteractionEvents[_0x5ea8('0x5')](_0x159005,_0x2e9052);};}exports[_0x5ea8('0x6')]=function(_0x4f5975){for(var _0x563fc9=0x0,_0x333b3c=events[_0x5ea8('0x7')];_0x563fc9<_0x333b3c;_0x563fc9++){var _0x2f4142=events[_0x563fc9];var _0x20dd3c=createListener(_0x5ea8('0x8')+_0x2f4142,_0x4f5975);ChatInteractionEvents['on'](_0x2f4142,_0x20dd3c);}}; \ No newline at end of file diff --git a/server/api/chatInteraction/index.js b/server/api/chatInteraction/index.js index 5b134c8..6fbef4e 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 _0xdb3d=['/:id/vidaoo','diskStorage','server/files/attachments/','originalname','/:id/attachment_upload','single','file','post','addMessage','/:id/tags','tracked','chat','addTags','put','update','/:id/custom_update','/:id/abandon','abandon','close','delete','chatinteraction:destroy','destroy','removeTags','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./chatInteraction.controller','isAuthenticated','get','/describe','describe','/:id','isChatInteractionAuthorized','show','/:id/attachment_download','/:id/messages','getMessages','/:id/my_messages','getMyMessages','download'];(function(_0x51c491,_0x3df387){var _0x41a29a=function(_0x2f7dec){while(--_0x2f7dec){_0x51c491['push'](_0x51c491['shift']());}};_0x41a29a(++_0x3df387);}(_0xdb3d,0xa2));var _0xddb3=function(_0x179170,_0x414a7a){_0x179170=_0x179170-0x0;var _0x2e0aac=_0xdb3d[_0x179170];return _0x2e0aac;};'use strict';var multer=require(_0xddb3('0x0'));var util=require(_0xddb3('0x1'));var path=require(_0xddb3('0x2'));var timeout=require(_0xddb3('0x3'));var express=require(_0xddb3('0x4'));var router=express['Router']();var fs_extra=require(_0xddb3('0x5'));var auth=require(_0xddb3('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xddb3('0x7'));var controller=require(_0xddb3('0x8'));router['get']('/',auth[_0xddb3('0x9')](),controller['index']);router[_0xddb3('0xa')](_0xddb3('0xb'),auth[_0xddb3('0x9')](),controller[_0xddb3('0xc')]);router['get'](_0xddb3('0xd'),auth[_0xddb3('0xe')](),controller[_0xddb3('0xf')]);router[_0xddb3('0xa')](_0xddb3('0x10'),auth['isChatInteractionAuthorized'](),controller['attachmentDownload']);router[_0xddb3('0xa')](_0xddb3('0x11'),auth[_0xddb3('0x9')](),controller[_0xddb3('0x12')]);router[_0xddb3('0xa')](_0xddb3('0x13'),auth[_0xddb3('0xe')](),controller[_0xddb3('0x14')]);router[_0xddb3('0xa')]('/:id/download',auth[_0xddb3('0x9')](),controller[_0xddb3('0x15')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router['post'](_0xddb3('0x16'),auth['isAuthenticated'](),controller['createVidaooSession']);var upload=multer({'storage':multer[_0xddb3('0x17')]({'destination':function(_0x363c41,_0x102070,_0x25df61){_0x25df61(null,path['join'](config['root'],_0xddb3('0x18')));},'filename':function(_0x15e317,_0x5503d8,_0x342339){_0x342339(null,util['format']('%s-%s',Date['now'](),_0x5503d8[_0xddb3('0x19')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router['post'](_0xddb3('0x1a'),upload[_0xddb3('0x1b')](_0xddb3('0x1c')),controller['attachmentUpload']);router[_0xddb3('0x1d')](_0xddb3('0x11'),auth[_0xddb3('0xe')](),controller[_0xddb3('0x1e')]);router['post'](_0xddb3('0x1f'),auth['isAuthenticated'](),interaction[_0xddb3('0x20')](_0xddb3('0x21'),'chatinteraction:addtags'),controller[_0xddb3('0x22')]);router[_0xddb3('0x23')](_0xddb3('0xd'),auth['isAuthenticated'](),interaction[_0xddb3('0x20')](_0xddb3('0x21'),'chatinteraction:update'),controller[_0xddb3('0x24')]);router[_0xddb3('0x23')](_0xddb3('0x25'),controller['customUpdate']);router[_0xddb3('0x23')](_0xddb3('0x26'),auth[_0xddb3('0xe')](),controller[_0xddb3('0x27')]);router['put']('/:id/close',controller[_0xddb3('0x28')]);router[_0xddb3('0x29')](_0xddb3('0xd'),auth[_0xddb3('0x9')](),interaction[_0xddb3('0x20')](_0xddb3('0x21'),_0xddb3('0x2a')),controller[_0xddb3('0x2b')]);router[_0xddb3('0x29')]('/:id/tags',auth['isAuthenticated'](),controller[_0xddb3('0x2c')]);module[_0xddb3('0x2d')]=router; \ No newline at end of file +var _0xb18f=['../../components/auth/service','../../components/interaction/service','../../config/environment','./chatInteraction.controller','isAuthenticated','/describe','describe','get','/:id','isChatInteractionAuthorized','show','/:id/attachment_download','/:id/messages','getMessages','/:id/my_messages','getMyMessages','/:id/download','download','create','post','/:id/vidaoo','createVidaooSession','diskStorage','join','root','server/files/attachments/','%s-%s','now','originalname','replace','/:id/attachment_upload','addMessage','tracked','chatinteraction:addtags','put','chatinteraction:update','update','customUpdate','/:id/close','close','delete','chat','destroy','removeTags','exports','multer','path','connect-timeout','Router','fs-extra'];(function(_0x39d182,_0x4c4547){var _0x575302=function(_0x10b878){while(--_0x10b878){_0x39d182['push'](_0x39d182['shift']());}};_0x575302(++_0x4c4547);}(_0xb18f,0x91));var _0xfb18=function(_0x27091c,_0x309348){_0x27091c=_0x27091c-0x0;var _0x3ad65a=_0xb18f[_0x27091c];return _0x3ad65a;};'use strict';var multer=require(_0xfb18('0x0'));var util=require('util');var path=require(_0xfb18('0x1'));var timeout=require(_0xfb18('0x2'));var express=require('express');var router=express[_0xfb18('0x3')]();var fs_extra=require(_0xfb18('0x4'));var auth=require(_0xfb18('0x5'));var interaction=require(_0xfb18('0x6'));var config=require(_0xfb18('0x7'));var controller=require(_0xfb18('0x8'));router['get']('/',auth[_0xfb18('0x9')](),controller['index']);router['get'](_0xfb18('0xa'),auth[_0xfb18('0x9')](),controller[_0xfb18('0xb')]);router[_0xfb18('0xc')](_0xfb18('0xd'),auth[_0xfb18('0xe')](),controller[_0xfb18('0xf')]);router[_0xfb18('0xc')](_0xfb18('0x10'),auth['isChatInteractionAuthorized'](),controller['attachmentDownload']);router[_0xfb18('0xc')](_0xfb18('0x11'),auth[_0xfb18('0x9')](),controller[_0xfb18('0x12')]);router[_0xfb18('0xc')](_0xfb18('0x13'),auth[_0xfb18('0xe')](),controller[_0xfb18('0x14')]);router[_0xfb18('0xc')](_0xfb18('0x15'),auth['isAuthenticated'](),controller[_0xfb18('0x16')]);router['post']('/',auth[_0xfb18('0x9')](),controller[_0xfb18('0x17')]);router[_0xfb18('0x18')](_0xfb18('0x19'),auth['isAuthenticated'](),controller[_0xfb18('0x1a')]);var upload=multer({'storage':multer[_0xfb18('0x1b')]({'destination':function(_0x51d6af,_0x352c92,_0x2b1e0a){_0x2b1e0a(null,path[_0xfb18('0x1c')](config[_0xfb18('0x1d')],_0xfb18('0x1e')));},'filename':function(_0x4fe169,_0xadf240,_0x3ae776){_0x3ae776(null,util['format'](_0xfb18('0x1f'),Date[_0xfb18('0x20')](),_0xadf240[_0xfb18('0x21')][_0xfb18('0x22')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router['post'](_0xfb18('0x23'),upload['single']('file'),controller['attachmentUpload']);router[_0xfb18('0x18')](_0xfb18('0x11'),auth['isChatInteractionAuthorized'](),controller[_0xfb18('0x24')]);router[_0xfb18('0x18')]('/:id/tags',auth['isAuthenticated'](),interaction[_0xfb18('0x25')]('chat',_0xfb18('0x26')),controller['addTags']);router[_0xfb18('0x27')]('/:id',auth[_0xfb18('0x9')](),interaction[_0xfb18('0x25')]('chat',_0xfb18('0x28')),controller[_0xfb18('0x29')]);router[_0xfb18('0x27')]('/:id/custom_update',controller[_0xfb18('0x2a')]);router[_0xfb18('0x27')]('/:id/abandon',auth['isChatInteractionAuthorized'](),controller['abandon']);router[_0xfb18('0x27')](_0xfb18('0x2b'),controller[_0xfb18('0x2c')]);router[_0xfb18('0x2d')](_0xfb18('0xd'),auth[_0xfb18('0x9')](),interaction[_0xfb18('0x25')](_0xfb18('0x2e'),'chatinteraction:destroy'),controller[_0xfb18('0x2f')]);router[_0xfb18('0x2d')]('/:id/tags',auth[_0xfb18('0x9')](),controller[_0xfb18('0x30')]);module[_0xfb18('0x31')]=router; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.attributes.js b/server/api/chatInternalMessage/chatInternalMessage.attributes.js index 5cdbb51..7877309 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 _0xcd1d=['sequelize','BOOLEAN','INTEGER'];(function(_0x2f5ac5,_0x1ee939){var _0x37c9a8=function(_0x15031f){while(--_0x15031f){_0x2f5ac5['push'](_0x2f5ac5['shift']());}};_0x37c9a8(++_0x1ee939);}(_0xcd1d,0x138));var _0xdcd1=function(_0x5cd1d3,_0x45431e){_0x5cd1d3=_0x5cd1d3-0x0;var _0x3edb7c=_0xcd1d[_0x5cd1d3];return _0x3edb7c;};'use strict';var Sequelize=require(_0xdcd1('0x0'));module['exports']={'body':{'type':Sequelize['TEXT']('medium'),'allowNull':![]},'read':{'type':Sequelize[_0xdcd1('0x1')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0xdcd1('0x2')]}}; \ No newline at end of file +var _0x4daa=['BOOLEAN','medium'];(function(_0x39a3e1,_0x7aea5d){var _0x5c142b=function(_0x3e2233){while(--_0x3e2233){_0x39a3e1['push'](_0x39a3e1['shift']());}};_0x5c142b(++_0x7aea5d);}(_0x4daa,0x1c1));var _0xa4da=function(_0x3e3d0a,_0x4745dd){_0x3e3d0a=_0x3e3d0a-0x0;var _0x3fc765=_0x4daa[_0x3e3d0a];return _0x3fc765;};'use strict';var Sequelize=require('sequelize');module['exports']={'body':{'type':Sequelize['TEXT'](_0xa4da('0x0')),'allowNull':![]},'read':{'type':Sequelize[_0xa4da('0x1')],'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 684e375..4ce0f35 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 _0xcd9d=['intersection','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','then','includeAll','include','findAll','show','params','keys','length','create','body','catch','find','describe','get','messages','lastMessageAt','createdAt','lastMessage','format','YYYY-MM-DD\x20HH:mm:ss','getUsers','User','agent','admin','fullname','role','userpic','internal','online','allowmessenger','showWebBar','-online','VoiceQueue','VoiceQueues','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','Agents','userProfileId','autoAssociation','push','ToId','read','all','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','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','defaults','redis','localhost','socket.io-emitter','./chatInternalMessage.socket','register','status','end','json','offset','count','set','Content-Range','apply','reject','save','update','destroy','sendStatus','error','stack','name','send','index','map','ChatInternalMessage','rawAttributes','fieldName','type','key','model','query','filters'];(function(_0x340101,_0x10e146){var _0x41ecad=function(_0x5dbb07){while(--_0x5dbb07){_0x340101['push'](_0x340101['shift']());}};_0x41ecad(++_0x10e146);}(_0xcd9d,0x199));var _0xdcd9=function(_0x2e5480,_0x539dbe){_0x2e5480=_0x2e5480-0x0;var _0x55e079=_0xcd9d[_0x2e5480];return _0x55e079;};'use strict';var emlformat=require(_0xdcd9('0x0'));var rimraf=require(_0xdcd9('0x1'));var zipdir=require(_0xdcd9('0x2'));var jsonpatch=require(_0xdcd9('0x3'));var rp=require(_0xdcd9('0x4'));var moment=require('moment');var BPromise=require(_0xdcd9('0x5'));var Mustache=require('mustache');var util=require(_0xdcd9('0x6'));var path=require(_0xdcd9('0x7'));var sox=require(_0xdcd9('0x8'));var csv=require(_0xdcd9('0x9'));var ejs=require(_0xdcd9('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xdcd9('0xb'));var squel=require(_0xdcd9('0xc'));var crypto=require(_0xdcd9('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xdcd9('0xe'));var toCsv=require(_0xdcd9('0x9'));var querystring=require(_0xdcd9('0xf'));var Papa=require(_0xdcd9('0x10'));var Redis=require(_0xdcd9('0x11'));var authService=require(_0xdcd9('0x12'));var qs=require(_0xdcd9('0x13'));var as=require(_0xdcd9('0x14'));var hardwareService=require(_0xdcd9('0x15'));var logger=require('../../config/logger')(_0xdcd9('0x16'));var utils=require(_0xdcd9('0x17'));var config=require(_0xdcd9('0x18'));var licenseUtil=require(_0xdcd9('0x19'));var db=require('../../mysqldb')['db'];config['redis']=_[_0xdcd9('0x1a')](config[_0xdcd9('0x1b')],{'host':_0xdcd9('0x1c'),'port':0x18eb});var socket=require(_0xdcd9('0x1d'))(new Redis(config['redis']));require(_0xdcd9('0x1e'))[_0xdcd9('0x1f')](socket);function respondWithStatusCode(_0x15d634,_0x754ab3){_0x754ab3=_0x754ab3||0xcc;return function(_0x196e19){if(_0x196e19){return _0x15d634['sendStatus'](_0x754ab3);}return _0x15d634[_0xdcd9('0x20')](_0x754ab3)[_0xdcd9('0x21')]();};}function respondWithResult(_0x4ac2c1,_0x4a3f51){_0x4a3f51=_0x4a3f51||0xc8;return function(_0x4d7a14){if(_0x4d7a14){return _0x4ac2c1[_0xdcd9('0x20')](_0x4a3f51)[_0xdcd9('0x22')](_0x4d7a14);}};}function respondWithFilteredResult(_0x10cb4a,_0x27019b){return function(_0x56012e){if(_0x56012e){var _0x3d23b2=typeof _0x27019b[_0xdcd9('0x23')]==='undefined'&&typeof _0x27019b['limit']==='undefined';var _0x14d9b1=_0x56012e[_0xdcd9('0x24')];var _0x496d54=_0x3d23b2?0x0:_0x27019b['offset'];var _0x38175f=_0x3d23b2?_0x56012e['count']:_0x27019b[_0xdcd9('0x23')]+_0x27019b['limit'];var _0x1b84a7;if(_0x38175f>=_0x14d9b1){_0x38175f=_0x14d9b1;_0x1b84a7=0xc8;}else{_0x1b84a7=0xce;}_0x10cb4a[_0xdcd9('0x20')](_0x1b84a7);return _0x10cb4a[_0xdcd9('0x25')](_0xdcd9('0x26'),_0x496d54+'-'+_0x38175f+'/'+_0x14d9b1)[_0xdcd9('0x22')](_0x56012e);}return null;};}function patchUpdates(_0x218700){return function(_0x37f162){try{jsonpatch[_0xdcd9('0x27')](_0x37f162,_0x218700,!![]);}catch(_0x35f181){return BPromise[_0xdcd9('0x28')](_0x35f181);}return _0x37f162[_0xdcd9('0x29')]();};}function saveUpdates(_0x205905,_0x239a83){return function(_0x321ec7){if(_0x321ec7){return _0x321ec7[_0xdcd9('0x2a')](_0x205905)['then'](function(_0x4cbd73){return _0x4cbd73;});}return null;};}function removeEntity(_0x910b33,_0x5ac919){return function(_0x5b40f8){if(_0x5b40f8){return _0x5b40f8[_0xdcd9('0x2b')]()['then'](function(){_0x910b33[_0xdcd9('0x20')](0xcc)[_0xdcd9('0x21')]();});}};}function handleEntityNotFound(_0x3fc702,_0x41fd73){return function(_0x24ec9c){if(!_0x24ec9c){_0x3fc702[_0xdcd9('0x2c')](0x194);}return _0x24ec9c;};}function handleError(_0x267267,_0x2453a6){_0x2453a6=_0x2453a6||0x1f4;return function(_0xc823b3){logger[_0xdcd9('0x2d')](_0xc823b3[_0xdcd9('0x2e')]);if(_0xc823b3[_0xdcd9('0x2f')]){delete _0xc823b3[_0xdcd9('0x2f')];}_0x267267[_0xdcd9('0x20')](_0x2453a6)[_0xdcd9('0x30')](_0xc823b3);};}exports[_0xdcd9('0x31')]=function(_0x58039f,_0x318a50){var _0x59a969={},_0x5172f8={},_0x402fc6={'count':0x0,'rows':[]};var _0x567ae0=_[_0xdcd9('0x32')](db[_0xdcd9('0x33')][_0xdcd9('0x34')],function(_0x103b6a){return{'name':_0x103b6a[_0xdcd9('0x35')],'type':_0x103b6a[_0xdcd9('0x36')][_0xdcd9('0x37')]};});_0x5172f8[_0xdcd9('0x38')]=_[_0xdcd9('0x32')](_0x567ae0,_0xdcd9('0x2f'));_0x5172f8[_0xdcd9('0x39')]=_['keys'](_0x58039f[_0xdcd9('0x39')]);_0x5172f8[_0xdcd9('0x3a')]=_[_0xdcd9('0x3b')](_0x5172f8['model'],_0x5172f8['query']);_0x59a969[_0xdcd9('0x3c')]=_[_0xdcd9('0x3b')](_0x5172f8['model'],qs[_0xdcd9('0x3d')](_0x58039f[_0xdcd9('0x39')][_0xdcd9('0x3d')]));_0x59a969[_0xdcd9('0x3c')]=_0x59a969[_0xdcd9('0x3c')]['length']?_0x59a969[_0xdcd9('0x3c')]:_0x5172f8['model'];if(!_0x58039f[_0xdcd9('0x39')][_0xdcd9('0x3e')](_0xdcd9('0x3f'))){_0x59a969[_0xdcd9('0x40')]=qs[_0xdcd9('0x40')](_0x58039f['query'][_0xdcd9('0x40')]);_0x59a969[_0xdcd9('0x23')]=qs[_0xdcd9('0x23')](_0x58039f[_0xdcd9('0x39')][_0xdcd9('0x23')]);}_0x59a969[_0xdcd9('0x41')]=qs[_0xdcd9('0x42')](_0x58039f[_0xdcd9('0x39')][_0xdcd9('0x42')]);_0x59a969[_0xdcd9('0x43')]=qs['filters'](_[_0xdcd9('0x44')](_0x58039f[_0xdcd9('0x39')],_0x5172f8[_0xdcd9('0x3a')]),_0x567ae0);if(_0x58039f[_0xdcd9('0x39')][_0xdcd9('0x45')]){_0x59a969['where']=_[_0xdcd9('0x46')](_0x59a969['where'],{'$or':_[_0xdcd9('0x32')](_0x567ae0,function(_0x16826){if(_0x16826['type']!==_0xdcd9('0x47')){var _0x4084b3={};_0x4084b3[_0x16826[_0xdcd9('0x2f')]]={'$like':'%'+_0x58039f[_0xdcd9('0x39')][_0xdcd9('0x45')]+'%'};return _0x4084b3;}})});}_0x59a969=_['merge']({},_0x59a969,_0x58039f[_0xdcd9('0x48')]);var _0x246968={'where':_0x59a969[_0xdcd9('0x43')]};return db[_0xdcd9('0x33')][_0xdcd9('0x24')](_0x246968)[_0xdcd9('0x49')](function(_0x163973){_0x402fc6[_0xdcd9('0x24')]=_0x163973;if(_0x58039f['query'][_0xdcd9('0x4a')]){_0x59a969[_0xdcd9('0x4b')]=[{'all':!![]}];}return db[_0xdcd9('0x33')][_0xdcd9('0x4c')](_0x59a969);})[_0xdcd9('0x49')](function(_0x5480e7){_0x402fc6['rows']=_0x5480e7;return _0x402fc6;})[_0xdcd9('0x49')](respondWithFilteredResult(_0x318a50,_0x59a969))['catch'](handleError(_0x318a50,null));};exports[_0xdcd9('0x4d')]=function(_0x2cf3f1,_0x417b53){var _0x8b772e={'raw':!![],'where':{'id':_0x2cf3f1[_0xdcd9('0x4e')]['id']}},_0x49ddf8={};_0x49ddf8['model']=_[_0xdcd9('0x4f')](db[_0xdcd9('0x33')][_0xdcd9('0x34')]);_0x49ddf8[_0xdcd9('0x39')]=_[_0xdcd9('0x4f')](_0x2cf3f1[_0xdcd9('0x39')]);_0x49ddf8[_0xdcd9('0x3a')]=_[_0xdcd9('0x3b')](_0x49ddf8[_0xdcd9('0x38')],_0x49ddf8[_0xdcd9('0x39')]);_0x8b772e[_0xdcd9('0x3c')]=_[_0xdcd9('0x3b')](_0x49ddf8['model'],qs['fields'](_0x2cf3f1['query'][_0xdcd9('0x3d')]));_0x8b772e[_0xdcd9('0x3c')]=_0x8b772e[_0xdcd9('0x3c')][_0xdcd9('0x50')]?_0x8b772e[_0xdcd9('0x3c')]:_0x49ddf8[_0xdcd9('0x38')];if(_0x2cf3f1['query'][_0xdcd9('0x4a')]){_0x8b772e['include']=[{'all':!![]}];}_0x8b772e=_['merge']({},_0x8b772e,_0x2cf3f1[_0xdcd9('0x48')]);return db[_0xdcd9('0x33')]['find'](_0x8b772e)[_0xdcd9('0x49')](handleEntityNotFound(_0x417b53,null))[_0xdcd9('0x49')](respondWithResult(_0x417b53,null))['catch'](handleError(_0x417b53,null));};exports[_0xdcd9('0x51')]=function(_0x2d556a,_0x1a353f){return db[_0xdcd9('0x33')][_0xdcd9('0x51')](_0x2d556a[_0xdcd9('0x52')],{})[_0xdcd9('0x49')](respondWithResult(_0x1a353f,0xc9))[_0xdcd9('0x53')](handleError(_0x1a353f,null));};exports[_0xdcd9('0x2a')]=function(_0x5b85d0,_0x53c893){if(_0x5b85d0[_0xdcd9('0x52')]['id']){delete _0x5b85d0[_0xdcd9('0x52')]['id'];}return db[_0xdcd9('0x33')][_0xdcd9('0x54')]({'where':{'id':_0x5b85d0['params']['id']}})[_0xdcd9('0x49')](handleEntityNotFound(_0x53c893,null))['then'](saveUpdates(_0x5b85d0[_0xdcd9('0x52')],null))[_0xdcd9('0x49')](respondWithResult(_0x53c893,null))[_0xdcd9('0x53')](handleError(_0x53c893,null));};exports[_0xdcd9('0x2b')]=function(_0x4d64c9,_0x9ea72f){return db[_0xdcd9('0x33')][_0xdcd9('0x54')]({'where':{'id':_0x4d64c9[_0xdcd9('0x4e')]['id']}})[_0xdcd9('0x49')](handleEntityNotFound(_0x9ea72f,null))[_0xdcd9('0x49')](removeEntity(_0x9ea72f,null))[_0xdcd9('0x53')](handleError(_0x9ea72f,null));};exports[_0xdcd9('0x55')]=function(_0x3de6f6,_0x272863){return db['ChatInternalMessage'][_0xdcd9('0x55')]()[_0xdcd9('0x49')](respondWithResult(_0x272863,null))[_0xdcd9('0x53')](handleError(_0x272863,null));};function wrapUser(_0xe69a40){return function(_0x391056){var _0x3396f1=_0xe69a40[_0xdcd9('0x56')]({'plain':!![]});_0x3396f1[_0xdcd9('0x57')]=[];if(_0x391056){_0x3396f1[_0xdcd9('0x58')]=_0x391056[_0xdcd9('0x59')];_0x3396f1[_0xdcd9('0x5a')]=_0x391056;}else{_0x3396f1['lastMessageAt']=moment(0x0)[_0xdcd9('0x5b')](_0xdcd9('0x5c'));_0x3396f1['lastMessage']={};}return _0x3396f1;};}exports[_0xdcd9('0x5d')]=function(_0x322ffe,_0x5b2299,_0x4e8886){var _0x122a52=[];return db[_0xdcd9('0x5e')]['findAll']({'where':{'role':[_0xdcd9('0x5f'),_0xdcd9('0x60'),'user']},'attributes':['id',_0xdcd9('0x61'),_0xdcd9('0x2f'),_0xdcd9('0x62'),_0xdcd9('0x63'),_0xdcd9('0x64'),_0xdcd9('0x65'),'lastLoginAt',_0xdcd9('0x66'),_0xdcd9('0x67')],'order':qs[_0xdcd9('0x42')](_0xdcd9('0x68')),'include':[{'model':db[_0xdcd9('0x69')],'as':_0xdcd9('0x6a'),'attributes':['id','name',_0xdcd9('0x36')],'through':{'attributes':[]}}]})[_0xdcd9('0x49')](function(_0x5d0eeb){if(_0x5d0eeb){var _0xbd1961=_0x322ffe['user'][_0xdcd9('0x56')]({'plain':!![]});if(!_0xbd1961)throw new Error(_0xdcd9('0x6b'));if(_0xbd1961[_0xdcd9('0x62')]===_0xdcd9('0x6c')){return db[_0xdcd9('0x6d')]['find']({'where':{'name':_0xdcd9('0x6e'),'userProfileId':_0xbd1961[_0xdcd9('0x6f')]},'raw':!![]})['then'](function(_0x4f2a8e){if(_0x4f2a8e){if(_0x4f2a8e[_0xdcd9('0x70')]===0x0){return db['UserProfileResource'][_0xdcd9('0x4c')]({'where':{'sectionId':_0x4f2a8e['id']},'raw':!![]})['then'](function(_0x3356a0){var _0x2df4ab=[];if(_['isEmpty'](_0x3356a0)){_0x2df4ab=_['filter'](_0x5d0eeb,function(_0xd966f1){if(_0xd966f1[_0xdcd9('0x62')]!==_0xdcd9('0x5f')){return _0xd966f1;}});return _0x2df4ab;}else{for(var _0x1251eb=0x0;_0x1251eb<_0x5d0eeb['length'];_0x1251eb++){var _0x1e8ac5=_0x5d0eeb[_0x1251eb];if(_0x1e8ac5['role']===_0xdcd9('0x5f')){var _0x524c70=_[_0xdcd9('0x54')](_0x3356a0,function(_0x2a4106){return _0x2a4106['resourceId']===_0x1e8ac5['id'];});if(_0x524c70)_0x2df4ab[_0xdcd9('0x71')](_0x1e8ac5);}else{_0x2df4ab[_0xdcd9('0x71')](_0x1e8ac5);}}return _0x2df4ab;}});}else{return _0x5d0eeb;}}else{var _0x4cafef=_['filter'](_0x5d0eeb,function(_0x2d696c){if(_0x2d696c[_0xdcd9('0x62')]!==_0xdcd9('0x5f')){return _0x2d696c;}});return _0x4cafef;}});}else{return _0x5d0eeb;}}})['then'](function(_0x4e85a7){var _0x1bf3b6=[];if(_0x4e85a7){_0x122a52=_0x4e85a7;for(var _0x5237e8=0x0;_0x5237e8<_0x4e85a7['length'];_0x5237e8+=0x1){_0x122a52[_0x5237e8][_0xdcd9('0x57')]=[];_0x1bf3b6[_0xdcd9('0x71')](db[_0xdcd9('0x33')]['find']({'where':{'FromId':[_0x322ffe[_0xdcd9('0x6c')]['id'],_0x4e85a7[_0x5237e8]['id']],'ToId':[_0x322ffe[_0xdcd9('0x6c')]['id'],_0x4e85a7[_0x5237e8]['id']],'ChatGroupId':null},'attributes':['id',_0xdcd9('0x59'),'FromId',_0xdcd9('0x72'),_0xdcd9('0x73'),_0xdcd9('0x52')],'order':qs['sort']('-createdAt'),'limit':0x1,'offset':0x0,'raw':!![]})[_0xdcd9('0x49')](wrapUser(_0x4e85a7[_0x5237e8])));}return BPromise[_0xdcd9('0x74')](_0x1bf3b6);}return[];})['then'](function(_0x15f70d){return{'rows':_0x15f70d,'count':_0x15f70d[_0xdcd9('0x50')]};})[_0xdcd9('0x49')](respondWithResult(_0x5b2299,null))['catch'](handleError(_0x5b2299,null));}; \ No newline at end of file +var _0x8a20=['../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatInternalMessage.socket','register','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','error','stack','name','send','index','map','rawAttributes','type','key','query','keys','filters','intersection','model','fields','attributes','hasOwnProperty','order','sort','pick','filter','where','merge','VIRTUAL','ChatInternalMessage','includeAll','include','findAll','rows','catch','show','params','options','find','create','body','describe','get','messages','lastMessageAt','createdAt','lastMessage','format','YYYY-MM-DD\x20HH:mm:ss','getUsers','User','agent','admin','user','fullname','role','userpic','internal','online','allowmessenger','showWebBar','-online','VoiceQueue','VoiceQueues','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','isEmpty','length','resourceId','push','FromId','read','-createdAt','all','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api'];(function(_0x39fe18,_0x5a2db7){var _0x9fc66b=function(_0x408b30){while(--_0x408b30){_0x39fe18['push'](_0x39fe18['shift']());}};_0x9fc66b(++_0x5a2db7);}(_0x8a20,0x14e));var _0x08a2=function(_0x160c73,_0x2ee678){_0x160c73=_0x160c73-0x0;var _0xd9302=_0x8a20[_0x160c73];return _0xd9302;};'use strict';var emlformat=require(_0x08a2('0x0'));var rimraf=require(_0x08a2('0x1'));var zipdir=require(_0x08a2('0x2'));var jsonpatch=require(_0x08a2('0x3'));var rp=require('request-promise');var moment=require(_0x08a2('0x4'));var BPromise=require(_0x08a2('0x5'));var Mustache=require(_0x08a2('0x6'));var util=require('util');var path=require(_0x08a2('0x7'));var sox=require('sox');var csv=require(_0x08a2('0x8'));var ejs=require(_0x08a2('0x9'));var fs=require('fs');var fs_extra=require(_0x08a2('0xa'));var _=require(_0x08a2('0xb'));var squel=require(_0x08a2('0xc'));var crypto=require(_0x08a2('0xd'));var jsforce=require(_0x08a2('0xe'));var deskjs=require(_0x08a2('0xf'));var toCsv=require('to-csv');var querystring=require(_0x08a2('0x10'));var Papa=require('papaparse');var Redis=require(_0x08a2('0x11'));var authService=require(_0x08a2('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x08a2('0x13'));var hardwareService=require(_0x08a2('0x14'));var logger=require(_0x08a2('0x15'))(_0x08a2('0x16'));var utils=require(_0x08a2('0x17'));var config=require(_0x08a2('0x18'));var licenseUtil=require(_0x08a2('0x19'));var db=require(_0x08a2('0x1a'))['db'];config[_0x08a2('0x1b')]=_[_0x08a2('0x1c')](config[_0x08a2('0x1b')],{'host':_0x08a2('0x1d'),'port':0x18eb});var socket=require(_0x08a2('0x1e'))(new Redis(config[_0x08a2('0x1b')]));require(_0x08a2('0x1f'))[_0x08a2('0x20')](socket);function respondWithStatusCode(_0x1cec65,_0x523eff){_0x523eff=_0x523eff||0xcc;return function(_0x9fd3ff){if(_0x9fd3ff){return _0x1cec65['sendStatus'](_0x523eff);}return _0x1cec65['status'](_0x523eff)[_0x08a2('0x21')]();};}function respondWithResult(_0x313119,_0x267dfa){_0x267dfa=_0x267dfa||0xc8;return function(_0x5ae8db){if(_0x5ae8db){return _0x313119[_0x08a2('0x22')](_0x267dfa)[_0x08a2('0x23')](_0x5ae8db);}};}function respondWithFilteredResult(_0x4a299c,_0x26b48d){return function(_0x21deea){if(_0x21deea){var _0x508540=typeof _0x26b48d[_0x08a2('0x24')]===_0x08a2('0x25')&&typeof _0x26b48d[_0x08a2('0x26')]==='undefined';var _0x3e6190=_0x21deea[_0x08a2('0x27')];var _0x29f29d=_0x508540?0x0:_0x26b48d[_0x08a2('0x24')];var _0x3b5621=_0x508540?_0x21deea['count']:_0x26b48d['offset']+_0x26b48d[_0x08a2('0x26')];var _0x1bffd3;if(_0x3b5621>=_0x3e6190){_0x3b5621=_0x3e6190;_0x1bffd3=0xc8;}else{_0x1bffd3=0xce;}_0x4a299c[_0x08a2('0x22')](_0x1bffd3);return _0x4a299c[_0x08a2('0x28')](_0x08a2('0x29'),_0x29f29d+'-'+_0x3b5621+'/'+_0x3e6190)[_0x08a2('0x23')](_0x21deea);}return null;};}function patchUpdates(_0x4778b1){return function(_0x49137a){try{jsonpatch[_0x08a2('0x2a')](_0x49137a,_0x4778b1,!![]);}catch(_0x14fc52){return BPromise[_0x08a2('0x2b')](_0x14fc52);}return _0x49137a['save']();};}function saveUpdates(_0x28aac,_0x487596){return function(_0x30ac06){if(_0x30ac06){return _0x30ac06[_0x08a2('0x2c')](_0x28aac)[_0x08a2('0x2d')](function(_0x437ecd){return _0x437ecd;});}return null;};}function removeEntity(_0x1a6bb5,_0x16e0dd){return function(_0x14ac39){if(_0x14ac39){return _0x14ac39[_0x08a2('0x2e')]()[_0x08a2('0x2d')](function(){_0x1a6bb5[_0x08a2('0x22')](0xcc)[_0x08a2('0x21')]();});}};}function handleEntityNotFound(_0x3aaac7,_0x50b518){return function(_0x1d1049){if(!_0x1d1049){_0x3aaac7['sendStatus'](0x194);}return _0x1d1049;};}function handleError(_0x415fce,_0x1a9e2c){_0x1a9e2c=_0x1a9e2c||0x1f4;return function(_0x16c435){logger[_0x08a2('0x2f')](_0x16c435[_0x08a2('0x30')]);if(_0x16c435[_0x08a2('0x31')]){delete _0x16c435[_0x08a2('0x31')];}_0x415fce[_0x08a2('0x22')](_0x1a9e2c)[_0x08a2('0x32')](_0x16c435);};}exports[_0x08a2('0x33')]=function(_0x4d0d70,_0x15d4e1){var _0x106733={},_0x436cfc={},_0x85944a={'count':0x0,'rows':[]};var _0x3b3315=_[_0x08a2('0x34')](db['ChatInternalMessage'][_0x08a2('0x35')],function(_0x4248b4){return{'name':_0x4248b4['fieldName'],'type':_0x4248b4[_0x08a2('0x36')][_0x08a2('0x37')]};});_0x436cfc['model']=_[_0x08a2('0x34')](_0x3b3315,'name');_0x436cfc[_0x08a2('0x38')]=_[_0x08a2('0x39')](_0x4d0d70[_0x08a2('0x38')]);_0x436cfc[_0x08a2('0x3a')]=_[_0x08a2('0x3b')](_0x436cfc['model'],_0x436cfc[_0x08a2('0x38')]);_0x106733['attributes']=_[_0x08a2('0x3b')](_0x436cfc[_0x08a2('0x3c')],qs[_0x08a2('0x3d')](_0x4d0d70[_0x08a2('0x38')]['fields']));_0x106733['attributes']=_0x106733['attributes']['length']?_0x106733[_0x08a2('0x3e')]:_0x436cfc[_0x08a2('0x3c')];if(!_0x4d0d70[_0x08a2('0x38')][_0x08a2('0x3f')]('nolimit')){_0x106733[_0x08a2('0x26')]=qs[_0x08a2('0x26')](_0x4d0d70[_0x08a2('0x38')][_0x08a2('0x26')]);_0x106733[_0x08a2('0x24')]=qs[_0x08a2('0x24')](_0x4d0d70[_0x08a2('0x38')][_0x08a2('0x24')]);}_0x106733[_0x08a2('0x40')]=qs['sort'](_0x4d0d70[_0x08a2('0x38')][_0x08a2('0x41')]);_0x106733['where']=qs[_0x08a2('0x3a')](_[_0x08a2('0x42')](_0x4d0d70[_0x08a2('0x38')],_0x436cfc[_0x08a2('0x3a')]),_0x3b3315);if(_0x4d0d70['query'][_0x08a2('0x43')]){_0x106733[_0x08a2('0x44')]=_[_0x08a2('0x45')](_0x106733['where'],{'$or':_['map'](_0x3b3315,function(_0x25f8d5){if(_0x25f8d5['type']!==_0x08a2('0x46')){var _0x3a7d81={};_0x3a7d81[_0x25f8d5['name']]={'$like':'%'+_0x4d0d70[_0x08a2('0x38')][_0x08a2('0x43')]+'%'};return _0x3a7d81;}})});}_0x106733=_[_0x08a2('0x45')]({},_0x106733,_0x4d0d70['options']);var _0x341132={'where':_0x106733[_0x08a2('0x44')]};return db[_0x08a2('0x47')][_0x08a2('0x27')](_0x341132)['then'](function(_0x54c019){_0x85944a[_0x08a2('0x27')]=_0x54c019;if(_0x4d0d70[_0x08a2('0x38')][_0x08a2('0x48')]){_0x106733[_0x08a2('0x49')]=[{'all':!![]}];}return db[_0x08a2('0x47')][_0x08a2('0x4a')](_0x106733);})[_0x08a2('0x2d')](function(_0x416504){_0x85944a[_0x08a2('0x4b')]=_0x416504;return _0x85944a;})[_0x08a2('0x2d')](respondWithFilteredResult(_0x15d4e1,_0x106733))[_0x08a2('0x4c')](handleError(_0x15d4e1,null));};exports[_0x08a2('0x4d')]=function(_0x55cc7a,_0x5f5391){var _0x3fde89={'raw':!![],'where':{'id':_0x55cc7a[_0x08a2('0x4e')]['id']}},_0x19267b={};_0x19267b[_0x08a2('0x3c')]=_[_0x08a2('0x39')](db[_0x08a2('0x47')]['rawAttributes']);_0x19267b[_0x08a2('0x38')]=_[_0x08a2('0x39')](_0x55cc7a['query']);_0x19267b[_0x08a2('0x3a')]=_['intersection'](_0x19267b[_0x08a2('0x3c')],_0x19267b[_0x08a2('0x38')]);_0x3fde89[_0x08a2('0x3e')]=_['intersection'](_0x19267b[_0x08a2('0x3c')],qs[_0x08a2('0x3d')](_0x55cc7a[_0x08a2('0x38')][_0x08a2('0x3d')]));_0x3fde89[_0x08a2('0x3e')]=_0x3fde89[_0x08a2('0x3e')]['length']?_0x3fde89[_0x08a2('0x3e')]:_0x19267b[_0x08a2('0x3c')];if(_0x55cc7a['query'][_0x08a2('0x48')]){_0x3fde89[_0x08a2('0x49')]=[{'all':!![]}];}_0x3fde89=_[_0x08a2('0x45')]({},_0x3fde89,_0x55cc7a[_0x08a2('0x4f')]);return db[_0x08a2('0x47')][_0x08a2('0x50')](_0x3fde89)[_0x08a2('0x2d')](handleEntityNotFound(_0x5f5391,null))[_0x08a2('0x2d')](respondWithResult(_0x5f5391,null))[_0x08a2('0x4c')](handleError(_0x5f5391,null));};exports[_0x08a2('0x51')]=function(_0x40dc0c,_0x8f39a1){return db[_0x08a2('0x47')][_0x08a2('0x51')](_0x40dc0c[_0x08a2('0x52')],{})[_0x08a2('0x2d')](respondWithResult(_0x8f39a1,0xc9))['catch'](handleError(_0x8f39a1,null));};exports[_0x08a2('0x2c')]=function(_0x17fe4f,_0x51494c){if(_0x17fe4f[_0x08a2('0x52')]['id']){delete _0x17fe4f[_0x08a2('0x52')]['id'];}return db[_0x08a2('0x47')][_0x08a2('0x50')]({'where':{'id':_0x17fe4f[_0x08a2('0x4e')]['id']}})[_0x08a2('0x2d')](handleEntityNotFound(_0x51494c,null))['then'](saveUpdates(_0x17fe4f[_0x08a2('0x52')],null))[_0x08a2('0x2d')](respondWithResult(_0x51494c,null))[_0x08a2('0x4c')](handleError(_0x51494c,null));};exports[_0x08a2('0x2e')]=function(_0x447065,_0x13f789){return db[_0x08a2('0x47')][_0x08a2('0x50')]({'where':{'id':_0x447065[_0x08a2('0x4e')]['id']}})[_0x08a2('0x2d')](handleEntityNotFound(_0x13f789,null))[_0x08a2('0x2d')](removeEntity(_0x13f789,null))['catch'](handleError(_0x13f789,null));};exports[_0x08a2('0x53')]=function(_0x48ec2a,_0x451159){return db[_0x08a2('0x47')][_0x08a2('0x53')]()[_0x08a2('0x2d')](respondWithResult(_0x451159,null))[_0x08a2('0x4c')](handleError(_0x451159,null));};function wrapUser(_0x3d6055){return function(_0x471e3b){var _0x59f9e3=_0x3d6055[_0x08a2('0x54')]({'plain':!![]});_0x59f9e3[_0x08a2('0x55')]=[];if(_0x471e3b){_0x59f9e3[_0x08a2('0x56')]=_0x471e3b[_0x08a2('0x57')];_0x59f9e3[_0x08a2('0x58')]=_0x471e3b;}else{_0x59f9e3[_0x08a2('0x56')]=moment(0x0)[_0x08a2('0x59')](_0x08a2('0x5a'));_0x59f9e3[_0x08a2('0x58')]={};}return _0x59f9e3;};}exports[_0x08a2('0x5b')]=function(_0x5040af,_0x2f13c1,_0x4caaa6){var _0x3278a7=[];return db[_0x08a2('0x5c')]['findAll']({'where':{'role':[_0x08a2('0x5d'),_0x08a2('0x5e'),_0x08a2('0x5f')]},'attributes':['id',_0x08a2('0x60'),_0x08a2('0x31'),_0x08a2('0x61'),_0x08a2('0x62'),_0x08a2('0x63'),_0x08a2('0x64'),'lastLoginAt',_0x08a2('0x65'),_0x08a2('0x66')],'order':qs['sort'](_0x08a2('0x67')),'include':[{'model':db[_0x08a2('0x68')],'as':_0x08a2('0x69'),'attributes':['id',_0x08a2('0x31'),_0x08a2('0x36')],'through':{'attributes':[]}}]})[_0x08a2('0x2d')](function(_0x16a12c){if(_0x16a12c){var _0x5dc640=_0x5040af[_0x08a2('0x5f')][_0x08a2('0x54')]({'plain':!![]});if(!_0x5dc640)throw new Error(_0x08a2('0x6a'));if(_0x5dc640[_0x08a2('0x61')]===_0x08a2('0x5f')){return db[_0x08a2('0x6b')][_0x08a2('0x50')]({'where':{'name':'Agents','userProfileId':_0x5dc640[_0x08a2('0x6c')]},'raw':!![]})[_0x08a2('0x2d')](function(_0x476ad1){if(_0x476ad1){if(_0x476ad1[_0x08a2('0x6d')]===0x0){return db[_0x08a2('0x6e')][_0x08a2('0x4a')]({'where':{'sectionId':_0x476ad1['id']},'raw':!![]})[_0x08a2('0x2d')](function(_0x5adf01){var _0x5bc953=[];if(_[_0x08a2('0x6f')](_0x5adf01)){_0x5bc953=_[_0x08a2('0x43')](_0x16a12c,function(_0x1417c3){if(_0x1417c3[_0x08a2('0x61')]!==_0x08a2('0x5d')){return _0x1417c3;}});return _0x5bc953;}else{for(var _0x138b26=0x0;_0x138b26<_0x16a12c[_0x08a2('0x70')];_0x138b26++){var _0x15f291=_0x16a12c[_0x138b26];if(_0x15f291[_0x08a2('0x61')]==='agent'){var _0x195486=_[_0x08a2('0x50')](_0x5adf01,function(_0x2db0d4){return _0x2db0d4[_0x08a2('0x71')]===_0x15f291['id'];});if(_0x195486)_0x5bc953[_0x08a2('0x72')](_0x15f291);}else{_0x5bc953[_0x08a2('0x72')](_0x15f291);}}return _0x5bc953;}});}else{return _0x16a12c;}}else{var _0x433c21=_['filter'](_0x16a12c,function(_0x52eff6){if(_0x52eff6['role']!==_0x08a2('0x5d')){return _0x52eff6;}});return _0x433c21;}});}else{return _0x16a12c;}}})[_0x08a2('0x2d')](function(_0x4c3a7b){var _0x1de82b=[];if(_0x4c3a7b){_0x3278a7=_0x4c3a7b;for(var _0x497d21=0x0;_0x497d21<_0x4c3a7b['length'];_0x497d21+=0x1){_0x3278a7[_0x497d21][_0x08a2('0x55')]=[];_0x1de82b['push'](db[_0x08a2('0x47')][_0x08a2('0x50')]({'where':{'FromId':[_0x5040af[_0x08a2('0x5f')]['id'],_0x4c3a7b[_0x497d21]['id']],'ToId':[_0x5040af[_0x08a2('0x5f')]['id'],_0x4c3a7b[_0x497d21]['id']],'ChatGroupId':null},'attributes':['id',_0x08a2('0x57'),_0x08a2('0x73'),'ToId',_0x08a2('0x74'),'body'],'order':qs['sort'](_0x08a2('0x75')),'limit':0x1,'offset':0x0,'raw':!![]})[_0x08a2('0x2d')](wrapUser(_0x4c3a7b[_0x497d21])));}return BPromise[_0x08a2('0x76')](_0x1de82b);}return[];})[_0x08a2('0x2d')](function(_0x37a9a2){return{'rows':_0x37a9a2,'count':_0x37a9a2[_0x08a2('0x70')]};})['then'](respondWithResult(_0x2f13c1,null))['catch'](handleError(_0x2f13c1,null));}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.events.js b/server/api/chatInternalMessage/chatInternalMessage.events.js index feeabc5..5fc1845 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 _0xf6f3=['remove','emit','hasOwnProperty','hook','events','../../mysqldb','ChatInternalMessage','setMaxListeners','save','update'];(function(_0x19afa1,_0x2314f1){var _0x3a1e9d=function(_0x191d40){while(--_0x191d40){_0x19afa1['push'](_0x19afa1['shift']());}};_0x3a1e9d(++_0x2314f1);}(_0xf6f3,0xd6));var _0x3f6f=function(_0xba6f5,_0x3c7d08){_0xba6f5=_0xba6f5-0x0;var _0x334f46=_0xf6f3[_0xba6f5];return _0x334f46;};'use strict';var EventEmitter=require(_0x3f6f('0x0'));var ChatInternalMessage=require(_0x3f6f('0x1'))['db'][_0x3f6f('0x2')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0x3f6f('0x3')](0x0);var events={'afterCreate':_0x3f6f('0x4'),'afterUpdate':_0x3f6f('0x5'),'afterDestroy':_0x3f6f('0x6')};function emitEvent(_0x293f79){return function(_0x33e3cf,_0x425fdc,_0x3be385){ChatInternalMessageEvents[_0x3f6f('0x7')](_0x293f79+':'+_0x33e3cf['id'],_0x33e3cf);ChatInternalMessageEvents['emit'](_0x293f79,_0x33e3cf);_0x3be385(null);};}for(var e in events){if(events[_0x3f6f('0x8')](e)){var event=events[e];ChatInternalMessage[_0x3f6f('0x9')](e,emitEvent(event));}}module['exports']=ChatInternalMessageEvents; \ No newline at end of file +var _0xfd6e=['hook','exports','events','../../mysqldb','ChatInternalMessage','setMaxListeners','save','update','emit','hasOwnProperty'];(function(_0x314a07,_0x5bf266){var _0x5ecb57=function(_0x1416bf){while(--_0x1416bf){_0x314a07['push'](_0x314a07['shift']());}};_0x5ecb57(++_0x5bf266);}(_0xfd6e,0x1b0));var _0xefd6=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0xfd6e[_0x3ab51d];return _0x29a04e;};'use strict';var EventEmitter=require(_0xefd6('0x0'));var ChatInternalMessage=require(_0xefd6('0x1'))['db'][_0xefd6('0x2')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0xefd6('0x3')](0x0);var events={'afterCreate':_0xefd6('0x4'),'afterUpdate':_0xefd6('0x5'),'afterDestroy':'remove'};function emitEvent(_0x433511){return function(_0x839f34,_0x1eb842,_0x2df7ed){ChatInternalMessageEvents[_0xefd6('0x6')](_0x433511+':'+_0x839f34['id'],_0x839f34);ChatInternalMessageEvents[_0xefd6('0x6')](_0x433511,_0x839f34);_0x2df7ed(null);};}for(var e in events){if(events[_0xefd6('0x7')](e)){var event=events[e];ChatInternalMessage[_0xefd6('0x8')](e,emitEvent(event));}}module[_0xefd6('0x9')]=ChatInternalMessageEvents; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.model.js b/server/api/chatInternalMessage/chatInternalMessage.model.js index bb0f87b..cf32996 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 _0x95ea=['utf8mb4','utf8mb4_unicode_ci','../../config/logger','api','moment','bluebird','path','../../config/environment','./chatInternalMessage.attributes','exports','define','ChatInternalMessage'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x95ea,0x16a));var _0xa95e=function(_0x42245d,_0x51758f){_0x42245d=_0x42245d-0x0;var _0x4b211a=_0x95ea[_0x42245d];return _0x4b211a;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xa95e('0x0'))(_0xa95e('0x1'));var moment=require(_0xa95e('0x2'));var BPromise=require(_0xa95e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa95e('0x4'));var rimraf=require('rimraf');var config=require(_0xa95e('0x5'));var attributes=require(_0xa95e('0x6'));module[_0xa95e('0x7')]=function(_0x47f834,_0x4e7a44){return _0x47f834[_0xa95e('0x8')](_0xa95e('0x9'),attributes,{'tableName':'chat_internal_messages','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xa95e('0xa'),'collate':_0xa95e('0xb')});}; \ No newline at end of file +var _0x4213=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatInternalMessage.attributes','ChatInternalMessage','chat_internal_messages','utf8mb4_unicode_ci','lodash','util'];(function(_0x10616d,_0x55e992){var _0x2b9b47=function(_0x34c345){while(--_0x34c345){_0x10616d['push'](_0x10616d['shift']());}};_0x2b9b47(++_0x55e992);}(_0x4213,0x140));var _0x3421=function(_0x1532ae,_0xa14bcc){_0x1532ae=_0x1532ae-0x0;var _0x5c09d1=_0x4213[_0x1532ae];return _0x5c09d1;};'use strict';var _=require(_0x3421('0x0'));var util=require(_0x3421('0x1'));var logger=require(_0x3421('0x2'))(_0x3421('0x3'));var moment=require(_0x3421('0x4'));var BPromise=require(_0x3421('0x5'));var rp=require(_0x3421('0x6'));var fs=require('fs');var path=require(_0x3421('0x7'));var rimraf=require(_0x3421('0x8'));var config=require(_0x3421('0x9'));var attributes=require(_0x3421('0xa'));module['exports']=function(_0x1566de,_0xe1d745){return _0x1566de['define'](_0x3421('0xb'),attributes,{'tableName':_0x3421('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x3421('0xd')});}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.rpc.js b/server/api/chatInternalMessage/chatInternalMessage.rpc.js index 42ebb60..a9dc3f9 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 _0xadbd=['then','info','ChatInternalMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','redis','defaults','localhost','socket.io-emitter','register','request'];(function(_0x4923d5,_0x377193){var _0x3de247=function(_0x40d036){while(--_0x40d036){_0x4923d5['push'](_0x4923d5['shift']());}};_0x3de247(++_0x377193);}(_0xadbd,0x150));var _0xdadb=function(_0xda00bc,_0x2af92e){_0xda00bc=_0xda00bc-0x0;var _0x35e2bd=_0xadbd[_0xda00bc];return _0x35e2bd;};'use strict';var _=require(_0xdadb('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xdadb('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xdadb('0x2'))['db'];var utils=require(_0xdadb('0x3'));var logger=require(_0xdadb('0x4'))(_0xdadb('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xdadb('0x6')][_0xdadb('0x7')]({'port':0x232a});config[_0xdadb('0x8')]=_[_0xdadb('0x9')](config[_0xdadb('0x8')],{'host':_0xdadb('0xa'),'port':0x18eb});var socket=require(_0xdadb('0xb'))(new Redis(config[_0xdadb('0x8')]));require('./chatInternalMessage.socket')[_0xdadb('0xc')](socket);function respondWithRpcPromise(_0x5b4138,_0x3532c4,_0x24a0d7){return new BPromise(function(_0x2e13b9,_0x2a661e){return client[_0xdadb('0xd')](_0x5b4138,_0x24a0d7)[_0xdadb('0xe')](function(_0x37cc8e){logger[_0xdadb('0xf')](_0xdadb('0x10'),_0x3532c4,_0xdadb('0x11'));logger[_0xdadb('0x12')]('ChatInternalMessage,\x20%s,\x20%s,\x20%s',_0x3532c4,_0xdadb('0x11'),JSON[_0xdadb('0x13')](_0x37cc8e));if(_0x37cc8e[_0xdadb('0x14')]){if(_0x37cc8e[_0xdadb('0x14')][_0xdadb('0x15')]===0x1f4){logger[_0xdadb('0x14')](_0xdadb('0x10'),_0x3532c4,_0x37cc8e['error'][_0xdadb('0x16')]);return _0x2a661e(_0x37cc8e['error']['message']);}logger[_0xdadb('0x14')]('ChatInternalMessage,\x20%s,\x20%s',_0x3532c4,_0x37cc8e['error'][_0xdadb('0x16')]);return _0x2e13b9(_0x37cc8e[_0xdadb('0x14')][_0xdadb('0x16')]);}else{logger[_0xdadb('0xf')](_0xdadb('0x10'),_0x3532c4,_0xdadb('0x11'));_0x2e13b9(_0x37cc8e[_0xdadb('0x17')][_0xdadb('0x16')]);}})[_0xdadb('0x18')](function(_0x3fafb6){logger[_0xdadb('0x14')](_0xdadb('0x10'),_0x3532c4,_0x3fafb6);_0x2a661e(_0x3fafb6);});});} \ No newline at end of file +var _0xd370=['rpc','../../config/environment','client','http','redis','defaults','socket.io-emitter','register','request','ChatInternalMessage,\x20%s,\x20%s','request\x20sent','debug','ChatInternalMessage,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x2a453b,_0x479c50){var _0x132f79=function(_0x5e3d83){while(--_0x5e3d83){_0x2a453b['push'](_0x2a453b['shift']());}};_0x132f79(++_0x479c50);}(_0xd370,0x1d3));var _0x0d37=function(_0x28beaf,_0x122959){_0x28beaf=_0x28beaf-0x0;var _0x2df201=_0xd370[_0x28beaf];return _0x2df201;};'use strict';var _=require(_0x0d37('0x0'));var util=require(_0x0d37('0x1'));var moment=require(_0x0d37('0x2'));var BPromise=require(_0x0d37('0x3'));var rs=require(_0x0d37('0x4'));var fs=require('fs');var Redis=require(_0x0d37('0x5'));var db=require(_0x0d37('0x6'))['db'];var utils=require(_0x0d37('0x7'));var logger=require(_0x0d37('0x8'))(_0x0d37('0x9'));var config=require(_0x0d37('0xa'));var jayson=require('jayson/promise');var client=jayson[_0x0d37('0xb')][_0x0d37('0xc')]({'port':0x232a});config[_0x0d37('0xd')]=_[_0x0d37('0xe')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x0d37('0xf'))(new Redis(config[_0x0d37('0xd')]));require('./chatInternalMessage.socket')[_0x0d37('0x10')](socket);function respondWithRpcPromise(_0x56a47d,_0x49d2e0,_0x14eede){return new BPromise(function(_0x2afe78,_0x5c1a46){return client[_0x0d37('0x11')](_0x56a47d,_0x14eede)['then'](function(_0x5847f4){logger['info'](_0x0d37('0x12'),_0x49d2e0,_0x0d37('0x13'));logger[_0x0d37('0x14')](_0x0d37('0x15'),_0x49d2e0,'request\x20sent',JSON['stringify'](_0x5847f4));if(_0x5847f4[_0x0d37('0x16')]){if(_0x5847f4[_0x0d37('0x16')][_0x0d37('0x17')]===0x1f4){logger[_0x0d37('0x16')](_0x0d37('0x12'),_0x49d2e0,_0x5847f4['error'][_0x0d37('0x18')]);return _0x5c1a46(_0x5847f4[_0x0d37('0x16')][_0x0d37('0x18')]);}logger[_0x0d37('0x16')]('ChatInternalMessage,\x20%s,\x20%s',_0x49d2e0,_0x5847f4['error'][_0x0d37('0x18')]);return _0x2afe78(_0x5847f4[_0x0d37('0x16')]['message']);}else{logger[_0x0d37('0x19')](_0x0d37('0x12'),_0x49d2e0,'request\x20sent');_0x2afe78(_0x5847f4[_0x0d37('0x1a')][_0x0d37('0x18')]);}})[_0x0d37('0x1b')](function(_0x5db285){logger[_0x0d37('0x16')](_0x0d37('0x12'),_0x49d2e0,_0x5db285);_0x5c1a46(_0x5db285);});});} \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.socket.js b/server/api/chatInternalMessage/chatInternalMessage.socket.js index a47cb47..e2b8527 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 _0x0da6=['length','./chatInternalMessage.events','save','update','emit','register'];(function(_0x1c0567,_0x4c323f){var _0x504619=function(_0x986058){while(--_0x986058){_0x1c0567['push'](_0x1c0567['shift']());}};_0x504619(++_0x4c323f);}(_0x0da6,0x19f));var _0x60da=function(_0x3b0598,_0x15100f){_0x3b0598=_0x3b0598-0x0;var _0x5e2198=_0x0da6[_0x3b0598];return _0x5e2198;};'use strict';var ChatInternalMessageEvents=require(_0x60da('0x0'));var events=[_0x60da('0x1'),'remove',_0x60da('0x2')];function createListener(_0x360c5b,_0x18542a){return function(_0x11cee7){_0x18542a[_0x60da('0x3')](_0x360c5b,_0x11cee7);};}function removeListener(_0x31865d,_0x47b9f9){return function(){ChatInternalMessageEvents['removeListener'](_0x31865d,_0x47b9f9);};}exports[_0x60da('0x4')]=function(_0x396390){for(var _0x5dd7da=0x0,_0x1b3bc3=events[_0x60da('0x5')];_0x5dd7da<_0x1b3bc3;_0x5dd7da++){var _0x32e2dc=events[_0x5dd7da];var _0x107493=createListener('chatInternalMessage:'+_0x32e2dc,_0x396390);ChatInternalMessageEvents['on'](_0x32e2dc,_0x107493);}}; \ No newline at end of file +var _0xc960=['emit','register','length','chatInternalMessage:','./chatInternalMessage.events','save','remove','update'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0xc960,0x114));var _0x0c96=function(_0x12fae2,_0x4045c1){_0x12fae2=_0x12fae2-0x0;var _0x5d6abc=_0xc960[_0x12fae2];return _0x5d6abc;};'use strict';var ChatInternalMessageEvents=require(_0x0c96('0x0'));var events=[_0x0c96('0x1'),_0x0c96('0x2'),_0x0c96('0x3')];function createListener(_0x262812,_0x43699c){return function(_0x1200aa){_0x43699c[_0x0c96('0x4')](_0x262812,_0x1200aa);};}function removeListener(_0x296beb,_0x495e7a){return function(){ChatInternalMessageEvents['removeListener'](_0x296beb,_0x495e7a);};}exports[_0x0c96('0x5')]=function(_0x3b8d56){for(var _0x1aa866=0x0,_0x5886e8=events[_0x0c96('0x6')];_0x1aa866<_0x5886e8;_0x1aa866++){var _0x573004=events[_0x1aa866];var _0x10a702=createListener(_0x0c96('0x7')+_0x573004,_0x3b8d56);ChatInternalMessageEvents['on'](_0x573004,_0x10a702);}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/index.js b/server/api/chatInternalMessage/index.js index f051f47..6f0f1e2 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 _0x8f6e=['path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','/users','getUsers','/:id','show','post','create','put','update','delete','destroy','exports','util'];(function(_0x78bf40,_0x271697){var _0x4d58be=function(_0x468008){while(--_0x468008){_0x78bf40['push'](_0x78bf40['shift']());}};_0x4d58be(++_0x271697);}(_0x8f6e,0x1cb));var _0xe8f6=function(_0x982859,_0x14be5d){_0x982859=_0x982859-0x0;var _0x27adac=_0x8f6e[_0x982859];return _0x27adac;};'use strict';var multer=require('multer');var util=require(_0xe8f6('0x0'));var path=require(_0xe8f6('0x1'));var timeout=require(_0xe8f6('0x2'));var express=require(_0xe8f6('0x3'));var router=express[_0xe8f6('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xe8f6('0x5'));var interaction=require(_0xe8f6('0x6'));var config=require(_0xe8f6('0x7'));var controller=require('./chatInternalMessage.controller');router[_0xe8f6('0x8')]('/',auth[_0xe8f6('0x9')](),controller[_0xe8f6('0xa')]);router['get'](_0xe8f6('0xb'),auth['isAuthenticated'](),controller['describe']);router[_0xe8f6('0x8')](_0xe8f6('0xc'),auth[_0xe8f6('0x9')](),controller[_0xe8f6('0xd')]);router[_0xe8f6('0x8')](_0xe8f6('0xe'),auth[_0xe8f6('0x9')](),controller[_0xe8f6('0xf')]);router[_0xe8f6('0x10')]('/',auth[_0xe8f6('0x9')](),controller[_0xe8f6('0x11')]);router[_0xe8f6('0x12')](_0xe8f6('0xe'),controller[_0xe8f6('0x13')]);router[_0xe8f6('0x14')](_0xe8f6('0xe'),auth['isAuthenticated'](),controller[_0xe8f6('0x15')]);module[_0xe8f6('0x16')]=router; \ No newline at end of file +var _0x30f0=['index','/describe','describe','/users','show','post','create','put','/:id','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatInternalMessage.controller','get','isAuthenticated'];(function(_0x465028,_0x4570ac){var _0xb783d4=function(_0x5458c5){while(--_0x5458c5){_0x465028['push'](_0x465028['shift']());}};_0xb783d4(++_0x4570ac);}(_0x30f0,0x12b));var _0x030f=function(_0x3e9784,_0xf05e6e){_0x3e9784=_0x3e9784-0x0;var _0x2994a1=_0x30f0[_0x3e9784];return _0x2994a1;};'use strict';var multer=require(_0x030f('0x0'));var util=require(_0x030f('0x1'));var path=require(_0x030f('0x2'));var timeout=require(_0x030f('0x3'));var express=require(_0x030f('0x4'));var router=express[_0x030f('0x5')]();var fs_extra=require(_0x030f('0x6'));var auth=require(_0x030f('0x7'));var interaction=require(_0x030f('0x8'));var config=require(_0x030f('0x9'));var controller=require(_0x030f('0xa'));router[_0x030f('0xb')]('/',auth[_0x030f('0xc')](),controller[_0x030f('0xd')]);router[_0x030f('0xb')](_0x030f('0xe'),auth[_0x030f('0xc')](),controller[_0x030f('0xf')]);router[_0x030f('0xb')](_0x030f('0x10'),auth[_0x030f('0xc')](),controller['getUsers']);router['get']('/:id',auth['isAuthenticated'](),controller[_0x030f('0x11')]);router[_0x030f('0x12')]('/',auth[_0x030f('0xc')](),controller[_0x030f('0x13')]);router[_0x030f('0x14')](_0x030f('0x15'),controller['update']);router[_0x030f('0x16')](_0x030f('0x15'),auth[_0x030f('0xc')](),controller['destroy']);module[_0x030f('0x17')]=router; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.attributes.js b/server/api/chatMessage/chatMessage.attributes.js index 701be6e..774dd2e 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 _0x6146=['BOOLEAN','ENUM','out','STRING','sequelize','TEXT','medium'];(function(_0x1667df,_0x266940){var _0x341abf=function(_0x123c3f){while(--_0x123c3f){_0x1667df['push'](_0x1667df['shift']());}};_0x341abf(++_0x266940);}(_0x6146,0xba));var _0x6614=function(_0x4b2090,_0x4cd935){_0x4b2090=_0x4b2090-0x0;var _0x7e8098=_0x6146[_0x4b2090];return _0x7e8098;};'use strict';var Sequelize=require(_0x6614('0x0'));module['exports']={'body':{'type':Sequelize[_0x6614('0x1')](_0x6614('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x6614('0x3')],'defaultValue':![]},'secret':{'type':Sequelize[_0x6614('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x6614('0x4')]('in',_0x6614('0x5')),'defaultValue':_0x6614('0x5'),'allowNull':![]},'readAt':{'type':Sequelize['DATE']},'providerName':{'type':Sequelize[_0x6614('0x6')]},'providerResponse':{'type':Sequelize[_0x6614('0x1')]}}; \ No newline at end of file +var _0xd2bf=['DATE','STRING','TEXT','sequelize','BOOLEAN','out'];(function(_0x457d1a,_0x6b408d){var _0x51388c=function(_0x478abe){while(--_0x478abe){_0x457d1a['push'](_0x457d1a['shift']());}};_0x51388c(++_0x6b408d);}(_0xd2bf,0x1dd));var _0xfd2b=function(_0x199bc4,_0x338105){_0x199bc4=_0x199bc4-0x0;var _0x136ffb=_0xd2bf[_0x199bc4];return _0x136ffb;};'use strict';var Sequelize=require(_0xfd2b('0x0'));module['exports']={'body':{'type':Sequelize['TEXT']('medium'),'allowNull':![]},'read':{'type':Sequelize[_0xfd2b('0x1')],'defaultValue':![]},'secret':{'type':Sequelize[_0xfd2b('0x1')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0xfd2b('0x2')),'defaultValue':'out','allowNull':![]},'readAt':{'type':Sequelize[_0xfd2b('0x3')]},'providerName':{'type':Sequelize[_0xfd2b('0x4')]},'providerResponse':{'type':Sequelize[_0xfd2b('0x5')]}}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.controller.js b/server/api/chatMessage/chatMessage.controller.js index 284cdef..a44dc26 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 _0x0285=['sort','filter','where','VIRTUAL','merge','ChatMessage','includeAll','include','options','find','create','body','params','catch','describe','accept','chat','read','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','ChatInteraction','ChatInteractionId','isNil','read1stAt','format','interaction','[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','Sequelize','contact','User','fullname','email','manual','interface','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','parse','chat-interactions','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','rejectMessage','QueryTypes','SELECT','internal','reject','rejectmessage','formData','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','redis','defaults','localhost','socket.io-emitter','./chatMessage.socket','register','jayson/promise','http','request','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','apply','save','update','then','destroy','stack','name','send','index','rawAttributes','fieldName','type','key','model','map','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order'];(function(_0x595609,_0x4d56f3){var _0x3822ba=function(_0x54a3b0){while(--_0x54a3b0){_0x595609['push'](_0x595609['shift']());}};_0x3822ba(++_0x4d56f3);}(_0x0285,0x148));var _0x5028=function(_0x5983ff,_0x4fe79e){_0x5983ff=_0x5983ff-0x0;var _0x51a562=_0x0285[_0x5983ff];return _0x51a562;};'use strict';var emlformat=require(_0x5028('0x0'));var rimraf=require(_0x5028('0x1'));var zipdir=require(_0x5028('0x2'));var jsonpatch=require(_0x5028('0x3'));var rp=require(_0x5028('0x4'));var moment=require(_0x5028('0x5'));var BPromise=require(_0x5028('0x6'));var Mustache=require('mustache');var util=require(_0x5028('0x7'));var path=require(_0x5028('0x8'));var sox=require('sox');var csv=require(_0x5028('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5028('0xa'));var _=require(_0x5028('0xb'));var squel=require(_0x5028('0xc'));var crypto=require(_0x5028('0xd'));var jsforce=require(_0x5028('0xe'));var deskjs=require(_0x5028('0xf'));var toCsv=require(_0x5028('0x9'));var querystring=require(_0x5028('0x10'));var Papa=require('papaparse');var Redis=require(_0x5028('0x11'));var authService=require(_0x5028('0x12'));var qs=require(_0x5028('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5028('0x14'));var logger=require(_0x5028('0x15'))(_0x5028('0x16'));var utils=require('../../config/utils');var config=require(_0x5028('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x5028('0x18')]=_[_0x5028('0x19')](config[_0x5028('0x18')],{'host':_0x5028('0x1a'),'port':0x18eb});var socket=require(_0x5028('0x1b'))(new Redis(config['redis']));require(_0x5028('0x1c'))[_0x5028('0x1d')](socket);var jayson=require(_0x5028('0x1e'));var client=jayson['client'][_0x5028('0x1f')]({'port':0x232c});var client9002=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x5add0f,_0x317f25,_0x51006b,_0xd43b39){return new BPromise(function(_0x41f71b,_0x3c17a8){var _0x516e4c=_0xd43b39||client;return _0x516e4c[_0x5028('0x20')](_0x5add0f,_0x51006b)['then'](function(_0x57366a){logger['info'](_0x5028('0x21'),_0x317f25,_0x5028('0x22'));logger[_0x5028('0x23')](_0x5028('0x24'),_0x317f25,_0x5028('0x22'),JSON[_0x5028('0x25')](_0x57366a));if(_0x57366a[_0x5028('0x26')]){if(_0x57366a[_0x5028('0x26')][_0x5028('0x27')]===0x1f4){logger['error']('ChatMessage,\x20%s,\x20%s',_0x317f25,_0x57366a[_0x5028('0x26')][_0x5028('0x28')]);return _0x3c17a8(_0x57366a[_0x5028('0x26')][_0x5028('0x28')]);}logger[_0x5028('0x26')](_0x5028('0x21'),_0x317f25,_0x57366a[_0x5028('0x26')][_0x5028('0x28')]);return _0x41f71b(_0x57366a[_0x5028('0x26')][_0x5028('0x28')]);}else{logger[_0x5028('0x29')](_0x5028('0x21'),_0x317f25,'request\x20sent');_0x41f71b(_0x57366a[_0x5028('0x2a')][_0x5028('0x28')]);}})['catch'](function(_0x33e2fb){logger[_0x5028('0x26')]('ChatMessage,\x20%s,\x20%s',_0x317f25,_0x33e2fb);_0x3c17a8(_0x33e2fb);});});}function respondWithStatusCode(_0x1363f6,_0x40f016){_0x40f016=_0x40f016||0xcc;return function(_0x106abc){if(_0x106abc){return _0x1363f6[_0x5028('0x2b')](_0x40f016);}return _0x1363f6[_0x5028('0x2c')](_0x40f016)[_0x5028('0x2d')]();};}function respondWithResult(_0x1be777,_0x1d36b2){_0x1d36b2=_0x1d36b2||0xc8;return function(_0x421cf7){if(_0x421cf7){return _0x1be777[_0x5028('0x2c')](_0x1d36b2)[_0x5028('0x2e')](_0x421cf7);}};}function respondWithFilteredResult(_0x4e2093,_0x58bfa4){return function(_0x5417b5){if(_0x5417b5){var _0x281164=typeof _0x58bfa4[_0x5028('0x2f')]==='undefined'&&typeof _0x58bfa4[_0x5028('0x30')]===_0x5028('0x31');var _0x8ded8b=_0x5417b5[_0x5028('0x32')];var _0x4f42d3=_0x281164?0x0:_0x58bfa4[_0x5028('0x2f')];var _0x47e733=_0x281164?_0x5417b5[_0x5028('0x32')]:_0x58bfa4['offset']+_0x58bfa4[_0x5028('0x30')];var _0xe77763;if(_0x47e733>=_0x8ded8b){_0x47e733=_0x8ded8b;_0xe77763=0xc8;}else{_0xe77763=0xce;}_0x4e2093[_0x5028('0x2c')](_0xe77763);return _0x4e2093['set'](_0x5028('0x33'),_0x4f42d3+'-'+_0x47e733+'/'+_0x8ded8b)[_0x5028('0x2e')](_0x5417b5);}return null;};}function patchUpdates(_0xe3c256){return function(_0x171c12){try{jsonpatch[_0x5028('0x34')](_0x171c12,_0xe3c256,!![]);}catch(_0x592135){return BPromise['reject'](_0x592135);}return _0x171c12[_0x5028('0x35')]();};}function saveUpdates(_0x277a87,_0x3eed19){return function(_0x57f3bf){if(_0x57f3bf){return _0x57f3bf[_0x5028('0x36')](_0x277a87)[_0x5028('0x37')](function(_0x19e571){return _0x19e571;});}return null;};}function removeEntity(_0x330394,_0x3f4929){return function(_0x4f9282){if(_0x4f9282){return _0x4f9282[_0x5028('0x38')]()[_0x5028('0x37')](function(){_0x330394[_0x5028('0x2c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2db8b6,_0x577a53){return function(_0x4b4ae6){if(!_0x4b4ae6){_0x2db8b6['sendStatus'](0x194);}return _0x4b4ae6;};}function handleError(_0x1a1f6d,_0x2399ad){_0x2399ad=_0x2399ad||0x1f4;return function(_0x1fde70){logger[_0x5028('0x26')](_0x1fde70[_0x5028('0x39')]);if(_0x1fde70[_0x5028('0x3a')]){delete _0x1fde70['name'];}_0x1a1f6d['status'](_0x2399ad)[_0x5028('0x3b')](_0x1fde70);};}exports[_0x5028('0x3c')]=function(_0x3bef27,_0x707521){var _0x7a5b9d={},_0x1c59f6={},_0x5c2f1f={'count':0x0,'rows':[]};var _0x490a3f=_['map'](db['ChatMessage'][_0x5028('0x3d')],function(_0x205315){return{'name':_0x205315[_0x5028('0x3e')],'type':_0x205315[_0x5028('0x3f')][_0x5028('0x40')]};});_0x1c59f6[_0x5028('0x41')]=_[_0x5028('0x42')](_0x490a3f,_0x5028('0x3a'));_0x1c59f6[_0x5028('0x43')]=_[_0x5028('0x44')](_0x3bef27[_0x5028('0x43')]);_0x1c59f6[_0x5028('0x45')]=_['intersection'](_0x1c59f6[_0x5028('0x41')],_0x1c59f6[_0x5028('0x43')]);_0x7a5b9d[_0x5028('0x46')]=_[_0x5028('0x47')](_0x1c59f6['model'],qs['fields'](_0x3bef27[_0x5028('0x43')][_0x5028('0x48')]));_0x7a5b9d['attributes']=_0x7a5b9d[_0x5028('0x46')][_0x5028('0x49')]?_0x7a5b9d[_0x5028('0x46')]:_0x1c59f6[_0x5028('0x41')];if(!_0x3bef27[_0x5028('0x43')][_0x5028('0x4a')](_0x5028('0x4b'))){_0x7a5b9d[_0x5028('0x30')]=qs[_0x5028('0x30')](_0x3bef27[_0x5028('0x43')][_0x5028('0x30')]);_0x7a5b9d['offset']=qs['offset'](_0x3bef27[_0x5028('0x43')][_0x5028('0x2f')]);}_0x7a5b9d[_0x5028('0x4c')]=qs['sort'](_0x3bef27[_0x5028('0x43')][_0x5028('0x4d')]);_0x7a5b9d['where']=qs['filters'](_['pick'](_0x3bef27[_0x5028('0x43')],_0x1c59f6[_0x5028('0x45')]),_0x490a3f);if(_0x3bef27['query'][_0x5028('0x4e')]){_0x7a5b9d[_0x5028('0x4f')]=_['merge'](_0x7a5b9d['where'],{'$or':_[_0x5028('0x42')](_0x490a3f,function(_0x45a611){if(_0x45a611[_0x5028('0x3f')]!==_0x5028('0x50')){var _0x21e76d={};_0x21e76d[_0x45a611[_0x5028('0x3a')]]={'$like':'%'+_0x3bef27[_0x5028('0x43')]['filter']+'%'};return _0x21e76d;}})});}_0x7a5b9d=_[_0x5028('0x51')]({},_0x7a5b9d,_0x3bef27['options']);var _0x455729={'where':_0x7a5b9d['where']};return db[_0x5028('0x52')][_0x5028('0x32')](_0x455729)['then'](function(_0x239710){_0x5c2f1f[_0x5028('0x32')]=_0x239710;if(_0x3bef27[_0x5028('0x43')][_0x5028('0x53')]){_0x7a5b9d[_0x5028('0x54')]=[{'all':!![]}];}return db[_0x5028('0x52')]['findAll'](_0x7a5b9d);})['then'](function(_0x443200){_0x5c2f1f['rows']=_0x443200;return _0x5c2f1f;})[_0x5028('0x37')](respondWithFilteredResult(_0x707521,_0x7a5b9d))['catch'](handleError(_0x707521,null));};exports['show']=function(_0x5d733f,_0x4b54c6){var _0x7999ce={'raw':!![],'where':{'id':_0x5d733f['params']['id']}},_0x3cda25={};_0x3cda25[_0x5028('0x41')]=_[_0x5028('0x44')](db['ChatMessage']['rawAttributes']);_0x3cda25[_0x5028('0x43')]=_[_0x5028('0x44')](_0x5d733f['query']);_0x3cda25[_0x5028('0x45')]=_[_0x5028('0x47')](_0x3cda25[_0x5028('0x41')],_0x3cda25[_0x5028('0x43')]);_0x7999ce[_0x5028('0x46')]=_[_0x5028('0x47')](_0x3cda25[_0x5028('0x41')],qs[_0x5028('0x48')](_0x5d733f[_0x5028('0x43')]['fields']));_0x7999ce[_0x5028('0x46')]=_0x7999ce[_0x5028('0x46')]['length']?_0x7999ce[_0x5028('0x46')]:_0x3cda25['model'];if(_0x5d733f[_0x5028('0x43')][_0x5028('0x53')]){_0x7999ce[_0x5028('0x54')]=[{'all':!![]}];}_0x7999ce=_[_0x5028('0x51')]({},_0x7999ce,_0x5d733f[_0x5028('0x55')]);return db[_0x5028('0x52')][_0x5028('0x56')](_0x7999ce)[_0x5028('0x37')](handleEntityNotFound(_0x4b54c6,null))[_0x5028('0x37')](respondWithResult(_0x4b54c6,null))['catch'](handleError(_0x4b54c6,null));};exports[_0x5028('0x57')]=function(_0x2671b1,_0x496ba2){return db['ChatMessage'][_0x5028('0x57')](_0x2671b1['body'],{})[_0x5028('0x37')](respondWithResult(_0x496ba2,0xc9))['catch'](handleError(_0x496ba2,null));};exports['update']=function(_0x104fb5,_0x15f5ae){if(_0x104fb5[_0x5028('0x58')]['id']){delete _0x104fb5[_0x5028('0x58')]['id'];}return db[_0x5028('0x52')][_0x5028('0x56')]({'where':{'id':_0x104fb5[_0x5028('0x59')]['id']}})['then'](handleEntityNotFound(_0x15f5ae,null))['then'](saveUpdates(_0x104fb5[_0x5028('0x58')],null))['then'](respondWithResult(_0x15f5ae,null))[_0x5028('0x5a')](handleError(_0x15f5ae,null));};exports[_0x5028('0x38')]=function(_0x276e0a,_0x9b409d){return db[_0x5028('0x52')][_0x5028('0x56')]({'where':{'id':_0x276e0a[_0x5028('0x59')]['id']}})[_0x5028('0x37')](handleEntityNotFound(_0x9b409d,null))[_0x5028('0x37')](removeEntity(_0x9b409d,null))[_0x5028('0x5a')](handleError(_0x9b409d,null));};exports[_0x5028('0x5b')]=function(_0x2d99f5,_0x2a13e9){return db['ChatMessage']['describe']()[_0x5028('0x37')](respondWithResult(_0x2a13e9,null))[_0x5028('0x5a')](handleError(_0x2a13e9,null));};var interaction_log=require(_0x5028('0x15'))('chat-interactions');exports[_0x5028('0x5c')]=function(_0x1d5306,_0x537bee,_0x332f64){var _0x2d55fd={'agent':{},'channel':_0x5028('0x5d')};if(_0x1d5306[_0x5028('0x58')]['id']){delete _0x1d5306['body']['id'];}_0x1d5306['body'][_0x5028('0x5e')]=!![];_0x1d5306[_0x5028('0x58')][_0x5028('0x5f')]=moment()['format'](_0x5028('0x60'));_0x1d5306[_0x5028('0x58')][_0x5028('0x61')]=_0x1d5306[_0x5028('0x58')][_0x5028('0x61')]||_0x1d5306[_0x5028('0x62')]['id'];_0x2d55fd[_0x5028('0x63')]['id']=_0x1d5306[_0x5028('0x58')][_0x5028('0x61')];return db[_0x5028('0x52')][_0x5028('0x56')]({'where':{'id':_0x1d5306['params']['id'],'UserId':null}})[_0x5028('0x37')](handleEntityNotFound(_0x537bee,null))[_0x5028('0x37')](saveUpdates(_0x1d5306['body'],null))['then'](function(_0xb889e6){if(_0xb889e6){_0x2d55fd['message']=_0xb889e6[_0x5028('0x64')]({'plain':!![]});return db[_0x5028('0x65')]['find']({'where':{'id':_0xb889e6[_0x5028('0x66')]}});}return null;})[_0x5028('0x37')](handleEntityNotFound(_0x537bee,null))[_0x5028('0x37')](function(_0x13b811){if(_0x13b811){return _0x13b811['update']({'UserId':_0x1d5306[_0x5028('0x58')][_0x5028('0x61')],'read1stAt':_[_0x5028('0x67')](_0x13b811[_0x5028('0x68')])?moment()[_0x5028('0x69')](_0x5028('0x60')):undefined});}return null;})[_0x5028('0x37')](function(_0x6d43de){if(_0x6d43de){_0x2d55fd[_0x5028('0x6a')]=_0x6d43de[_0x5028('0x64')]({'plain':!![]});interaction_log[_0x5028('0x29')](_0x5028('0x6b'),_0x1d5306[_0x5028('0x62')]['id'],_0x1d5306[_0x5028('0x62')][_0x5028('0x3a')],_0x1d5306[_0x5028('0x62')][_0x5028('0x6c')],_0x2d55fd[_0x5028('0x6a')]['id'],_0x1d5306[_0x5028('0x58')]?JSON[_0x5028('0x25')](_0x1d5306['body']):_0x5028('0x6d'));return respondWithRpcPromise('AcceptMessage','acceptMessage',_0x2d55fd);}return null;})[_0x5028('0x37')](function(_0x580923){var _0x273370=_0x5028('0x6e')+_0x580923[_0x5028('0x28')]['ContactId'];return db[_0x5028('0x6f')][_0x5028('0x43')](_0x273370,{'type':db[_0x5028('0x70')]['QueryTypes']['SELECT'],'raw':!![]})['then'](function(_0x1d066c){return _0x1d066c;});})[_0x5028('0x37')](function(_0xd9cdba){if(_0xd9cdba){_0x2d55fd['message'][_0x5028('0x71')]=_0xd9cdba[0x0];if(!_0x1d5306[_0x5028('0x58')][_0x5028('0x61')])return;return db[_0x5028('0x72')][_0x5028('0x56')]({'where':{'id':_0x1d5306[_0x5028('0x58')][_0x5028('0x61')],'role':_0x5028('0x63')},'attributes':['id',_0x5028('0x3a'),_0x5028('0x73'),_0x5028('0x74'),'internal'],'raw':!![]});}return null;})[_0x5028('0x37')](function(_0x55ea9b){if(!_0x55ea9b)return null;_0x2d55fd[_0x5028('0x28')][_0x5028('0x63')]=_0x55ea9b;return _0x2d55fd;})[_0x5028('0x37')](function(_0x15a490){if(_0x15a490){if(_0x1d5306['body'][_0x5028('0x75')]){_0x2d55fd['message'][_0x5028('0x76')]=util[_0x5028('0x69')](_0x5028('0x77'),_0x1d5306[_0x5028('0x62')][_0x5028('0x3a')]);_0x2d55fd[_0x5028('0x28')][_0x5028('0x78')]=_0x2d55fd[_0x5028('0x78')];_0x2d55fd[_0x5028('0x28')][_0x5028('0x79')]=_0x2d55fd['channel'];_0x2d55fd[_0x5028('0x28')][_0x5028('0x7a')]='accept';return respondWithRpcPromise(_0x5028('0x7b'),_0x5028('0x7b'),{'event':_0x5028('0x7c'),'message':_[_0x5028('0x51')](_0x2d55fd['message'],JSON[_0x5028('0x7d')](_0x2d55fd['interaction']['formData']))},client9002)[_0x5028('0x37')](function(){return _0x2d55fd;});}return _0x2d55fd;}return null;})[_0x5028('0x37')](respondWithResult(_0x537bee,null))[_0x5028('0x5a')](handleError(_0x537bee,null));};var interaction_log=require(_0x5028('0x15'))(_0x5028('0x7e'));exports['reject']=function(_0x359373,_0xf7f84a,_0x4ebf7a){var _0x30753f={'agent':{},'channel':_0x5028('0x5d')};if(_0x359373['body']['id']){delete _0x359373[_0x5028('0x58')]['id'];}_0x359373[_0x5028('0x58')][_0x5028('0x61')]=_0x359373[_0x5028('0x58')]['UserId']||_0x359373[_0x5028('0x62')]['id'];_0x30753f['agent']['id']=_0x359373[_0x5028('0x58')][_0x5028('0x61')];return db[_0x5028('0x52')]['find']({'where':{'id':_0x359373['params']['id'],'UserId':null}})[_0x5028('0x37')](handleEntityNotFound(_0xf7f84a,null))[_0x5028('0x37')](function(_0x2672a1){if(_0x2672a1){_0x30753f[_0x5028('0x28')]=_0x2672a1['get']({'plain':!![]});return db[_0x5028('0x65')]['find']({'where':{'id':_0x2672a1[_0x5028('0x66')]}});}return null;})[_0x5028('0x37')](handleEntityNotFound(_0xf7f84a,null))[_0x5028('0x37')](function(_0xfe8409){if(_0xfe8409){_0x30753f[_0x5028('0x6a')]=_0xfe8409['get']({'plain':!![]});interaction_log[_0x5028('0x29')](_0x5028('0x7f'),_0x359373[_0x5028('0x62')]['id'],_0x359373[_0x5028('0x62')][_0x5028('0x3a')],_0x359373[_0x5028('0x62')][_0x5028('0x6c')],_0x30753f['interaction']['id'],_0x359373[_0x5028('0x58')]?JSON['stringify'](_0x359373[_0x5028('0x58')]):_0x5028('0x6d'));return respondWithRpcPromise('RejectMessage',_0x5028('0x80'),_0x30753f);}return null;})[_0x5028('0x37')](function(_0x2284a7){var _0xbbfb72=_0x5028('0x6e')+_0x2284a7[_0x5028('0x28')]['ContactId'];return db['sequelize'][_0x5028('0x43')](_0xbbfb72,{'type':db[_0x5028('0x70')][_0x5028('0x81')][_0x5028('0x82')],'raw':!![]})[_0x5028('0x37')](function(_0x403c8f){return _0x403c8f;});})[_0x5028('0x37')](function(_0x1828ad){if(_0x1828ad){_0x30753f['message'][_0x5028('0x71')]=_0x1828ad[0x0];if(!_0x359373[_0x5028('0x58')][_0x5028('0x61')])return;return db[_0x5028('0x72')]['find']({'where':{'id':_0x359373[_0x5028('0x58')][_0x5028('0x61')],'role':_0x5028('0x63')},'attributes':['id',_0x5028('0x3a'),_0x5028('0x73'),_0x5028('0x74'),_0x5028('0x83')],'raw':!![]});}return null;})['then'](function(_0xe0ddb6){if(!_0xe0ddb6)return null;_0x30753f[_0x5028('0x28')][_0x5028('0x63')]=_0xe0ddb6;return _0x30753f;})[_0x5028('0x37')](function(_0x4b012c){if(_0x4b012c){_0x4b012c[_0x5028('0x28')][_0x5028('0x76')]=util[_0x5028('0x69')](_0x5028('0x77'),_0x359373[_0x5028('0x62')][_0x5028('0x3a')]);_0x4b012c[_0x5028('0x28')][_0x5028('0x78')]=_0x30753f['channel'];_0x4b012c[_0x5028('0x28')][_0x5028('0x79')]=_0x30753f['channel'];_0x4b012c[_0x5028('0x28')][_0x5028('0x7a')]=_0x5028('0x84');respondWithRpcPromise('EventManager',_0x5028('0x7b'),{'event':_0x5028('0x85'),'message':_['merge'](_0x30753f[_0x5028('0x28')],JSON[_0x5028('0x7d')](_0x30753f[_0x5028('0x6a')][_0x5028('0x86')]))},client9002);return _0x30753f;}return null;})[_0x5028('0x37')](respondWithResult(_0xf7f84a,null))['catch'](handleError(_0xf7f84a,null));}; \ No newline at end of file +var _0x068a=['path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatMessage.socket','register','jayson/promise','client','http','request','info','ChatMessage,\x20%s,\x20%s','request\x20sent','stringify','error','message','catch','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','stack','name','send','map','ChatMessage','rawAttributes','fieldName','model','query','filters','intersection','attributes','fields','hasOwnProperty','sort','pick','where','type','VIRTUAL','merge','options','includeAll','findAll','rows','show','params','keys','length','find','create','body','describe','chat-interactions','chat','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','ChatInteraction','isNil','read1stAt','interaction','[CHATMESSAGE: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','QueryTypes','SELECT','fullname','email','internal','manual','interface','SIP/%s','channel','motionChannel','event','accept','EventManager','acceptmessage','parse','RejectMessage','rejectMessage','Sequelize','contact','User','eml-format','rimraf','zip-dir','moment','bluebird','mustache'];(function(_0x1c81d7,_0x23fb0f){var _0x52961e=function(_0x2b0022){while(--_0x2b0022){_0x1c81d7['push'](_0x1c81d7['shift']());}};_0x52961e(++_0x23fb0f);}(_0x068a,0xfe));var _0xa068=function(_0x30fddd,_0x16fe5f){_0x30fddd=_0x30fddd-0x0;var _0x3005e3=_0x068a[_0x30fddd];return _0x3005e3;};'use strict';var emlformat=require(_0xa068('0x0'));var rimraf=require(_0xa068('0x1'));var zipdir=require(_0xa068('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xa068('0x3'));var BPromise=require(_0xa068('0x4'));var Mustache=require(_0xa068('0x5'));var util=require('util');var path=require(_0xa068('0x6'));var sox=require('sox');var csv=require(_0xa068('0x7'));var ejs=require(_0xa068('0x8'));var fs=require('fs');var fs_extra=require(_0xa068('0x9'));var _=require(_0xa068('0xa'));var squel=require('squel');var crypto=require(_0xa068('0xb'));var jsforce=require(_0xa068('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xa068('0xd'));var Papa=require(_0xa068('0xe'));var Redis=require(_0xa068('0xf'));var authService=require(_0xa068('0x10'));var qs=require(_0xa068('0x11'));var as=require(_0xa068('0x12'));var hardwareService=require(_0xa068('0x13'));var logger=require(_0xa068('0x14'))('api');var utils=require(_0xa068('0x15'));var config=require(_0xa068('0x16'));var licenseUtil=require(_0xa068('0x17'));var db=require(_0xa068('0x18'))['db'];config[_0xa068('0x19')]=_[_0xa068('0x1a')](config['redis'],{'host':_0xa068('0x1b'),'port':0x18eb});var socket=require(_0xa068('0x1c'))(new Redis(config[_0xa068('0x19')]));require(_0xa068('0x1d'))[_0xa068('0x1e')](socket);var jayson=require(_0xa068('0x1f'));var client=jayson[_0xa068('0x20')][_0xa068('0x21')]({'port':0x232c});var client9002=jayson[_0xa068('0x20')][_0xa068('0x21')]({'port':0x232a});function respondWithRpcPromise(_0x1246a1,_0x32391e,_0x8251c6,_0x59d4f0){return new BPromise(function(_0x1eef08,_0x58f0e3){var _0x1860d7=_0x59d4f0||client;return _0x1860d7[_0xa068('0x22')](_0x1246a1,_0x8251c6)['then'](function(_0xbd45db){logger[_0xa068('0x23')](_0xa068('0x24'),_0x32391e,_0xa068('0x25'));logger['debug']('ChatMessage,\x20%s,\x20%s,\x20%s',_0x32391e,_0xa068('0x25'),JSON[_0xa068('0x26')](_0xbd45db));if(_0xbd45db['error']){if(_0xbd45db[_0xa068('0x27')]['code']===0x1f4){logger[_0xa068('0x27')](_0xa068('0x24'),_0x32391e,_0xbd45db[_0xa068('0x27')][_0xa068('0x28')]);return _0x58f0e3(_0xbd45db[_0xa068('0x27')][_0xa068('0x28')]);}logger[_0xa068('0x27')](_0xa068('0x24'),_0x32391e,_0xbd45db[_0xa068('0x27')]['message']);return _0x1eef08(_0xbd45db['error'][_0xa068('0x28')]);}else{logger[_0xa068('0x23')](_0xa068('0x24'),_0x32391e,_0xa068('0x25'));_0x1eef08(_0xbd45db['result']['message']);}})[_0xa068('0x29')](function(_0x3523a8){logger['error'](_0xa068('0x24'),_0x32391e,_0x3523a8);_0x58f0e3(_0x3523a8);});});}function respondWithStatusCode(_0x4dc0b0,_0x14e25e){_0x14e25e=_0x14e25e||0xcc;return function(_0x27455d){if(_0x27455d){return _0x4dc0b0['sendStatus'](_0x14e25e);}return _0x4dc0b0['status'](_0x14e25e)['end']();};}function respondWithResult(_0x42b4b0,_0x5b4b5b){_0x5b4b5b=_0x5b4b5b||0xc8;return function(_0x72acd6){if(_0x72acd6){return _0x42b4b0[_0xa068('0x2a')](_0x5b4b5b)[_0xa068('0x2b')](_0x72acd6);}};}function respondWithFilteredResult(_0x39a785,_0x5d79d8){return function(_0x3c15e2){if(_0x3c15e2){var _0xa305a5=typeof _0x5d79d8[_0xa068('0x2c')]===_0xa068('0x2d')&&typeof _0x5d79d8[_0xa068('0x2e')]===_0xa068('0x2d');var _0x615939=_0x3c15e2[_0xa068('0x2f')];var _0x2ca324=_0xa305a5?0x0:_0x5d79d8[_0xa068('0x2c')];var _0x5cf276=_0xa305a5?_0x3c15e2['count']:_0x5d79d8[_0xa068('0x2c')]+_0x5d79d8['limit'];var _0x53d19f;if(_0x5cf276>=_0x615939){_0x5cf276=_0x615939;_0x53d19f=0xc8;}else{_0x53d19f=0xce;}_0x39a785[_0xa068('0x2a')](_0x53d19f);return _0x39a785[_0xa068('0x30')](_0xa068('0x31'),_0x2ca324+'-'+_0x5cf276+'/'+_0x615939)[_0xa068('0x2b')](_0x3c15e2);}return null;};}function patchUpdates(_0x106b10){return function(_0x12b1bf){try{jsonpatch[_0xa068('0x32')](_0x12b1bf,_0x106b10,!![]);}catch(_0x4abb8a){return BPromise[_0xa068('0x33')](_0x4abb8a);}return _0x12b1bf[_0xa068('0x34')]();};}function saveUpdates(_0x1c8da8,_0x379bd6){return function(_0x405474){if(_0x405474){return _0x405474[_0xa068('0x35')](_0x1c8da8)[_0xa068('0x36')](function(_0x838f58){return _0x838f58;});}return null;};}function removeEntity(_0x2cc4da,_0x31567a){return function(_0x2c8280){if(_0x2c8280){return _0x2c8280[_0xa068('0x37')]()['then'](function(){_0x2cc4da[_0xa068('0x2a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2e0f5f,_0x524f25){return function(_0x67a15f){if(!_0x67a15f){_0x2e0f5f[_0xa068('0x38')](0x194);}return _0x67a15f;};}function handleError(_0x24406b,_0x3a9db6){_0x3a9db6=_0x3a9db6||0x1f4;return function(_0xde8dec){logger[_0xa068('0x27')](_0xde8dec[_0xa068('0x39')]);if(_0xde8dec[_0xa068('0x3a')]){delete _0xde8dec[_0xa068('0x3a')];}_0x24406b[_0xa068('0x2a')](_0x3a9db6)[_0xa068('0x3b')](_0xde8dec);};}exports['index']=function(_0x3aea29,_0x4d9b3e){var _0x2f1117={},_0xe3b1b8={},_0x2525c8={'count':0x0,'rows':[]};var _0x38f756=_[_0xa068('0x3c')](db[_0xa068('0x3d')][_0xa068('0x3e')],function(_0x35bbf2){return{'name':_0x35bbf2[_0xa068('0x3f')],'type':_0x35bbf2['type']['key']};});_0xe3b1b8[_0xa068('0x40')]=_[_0xa068('0x3c')](_0x38f756,'name');_0xe3b1b8['query']=_['keys'](_0x3aea29[_0xa068('0x41')]);_0xe3b1b8[_0xa068('0x42')]=_[_0xa068('0x43')](_0xe3b1b8[_0xa068('0x40')],_0xe3b1b8[_0xa068('0x41')]);_0x2f1117[_0xa068('0x44')]=_[_0xa068('0x43')](_0xe3b1b8[_0xa068('0x40')],qs[_0xa068('0x45')](_0x3aea29[_0xa068('0x41')][_0xa068('0x45')]));_0x2f1117[_0xa068('0x44')]=_0x2f1117[_0xa068('0x44')]['length']?_0x2f1117[_0xa068('0x44')]:_0xe3b1b8['model'];if(!_0x3aea29['query'][_0xa068('0x46')]('nolimit')){_0x2f1117[_0xa068('0x2e')]=qs[_0xa068('0x2e')](_0x3aea29[_0xa068('0x41')]['limit']);_0x2f1117[_0xa068('0x2c')]=qs[_0xa068('0x2c')](_0x3aea29[_0xa068('0x41')]['offset']);}_0x2f1117['order']=qs[_0xa068('0x47')](_0x3aea29[_0xa068('0x41')][_0xa068('0x47')]);_0x2f1117['where']=qs[_0xa068('0x42')](_[_0xa068('0x48')](_0x3aea29[_0xa068('0x41')],_0xe3b1b8[_0xa068('0x42')]),_0x38f756);if(_0x3aea29['query']['filter']){_0x2f1117[_0xa068('0x49')]=_['merge'](_0x2f1117[_0xa068('0x49')],{'$or':_[_0xa068('0x3c')](_0x38f756,function(_0x54c2c5){if(_0x54c2c5[_0xa068('0x4a')]!==_0xa068('0x4b')){var _0x31cfd7={};_0x31cfd7[_0x54c2c5[_0xa068('0x3a')]]={'$like':'%'+_0x3aea29[_0xa068('0x41')]['filter']+'%'};return _0x31cfd7;}})});}_0x2f1117=_[_0xa068('0x4c')]({},_0x2f1117,_0x3aea29[_0xa068('0x4d')]);var _0x1d6736={'where':_0x2f1117[_0xa068('0x49')]};return db[_0xa068('0x3d')]['count'](_0x1d6736)[_0xa068('0x36')](function(_0x3655c6){_0x2525c8['count']=_0x3655c6;if(_0x3aea29['query'][_0xa068('0x4e')]){_0x2f1117['include']=[{'all':!![]}];}return db[_0xa068('0x3d')][_0xa068('0x4f')](_0x2f1117);})['then'](function(_0x32028b){_0x2525c8[_0xa068('0x50')]=_0x32028b;return _0x2525c8;})['then'](respondWithFilteredResult(_0x4d9b3e,_0x2f1117))[_0xa068('0x29')](handleError(_0x4d9b3e,null));};exports[_0xa068('0x51')]=function(_0x3d16c8,_0x3533b0){var _0x432594={'raw':!![],'where':{'id':_0x3d16c8[_0xa068('0x52')]['id']}},_0x3efd99={};_0x3efd99[_0xa068('0x40')]=_[_0xa068('0x53')](db[_0xa068('0x3d')][_0xa068('0x3e')]);_0x3efd99[_0xa068('0x41')]=_['keys'](_0x3d16c8[_0xa068('0x41')]);_0x3efd99[_0xa068('0x42')]=_[_0xa068('0x43')](_0x3efd99['model'],_0x3efd99[_0xa068('0x41')]);_0x432594[_0xa068('0x44')]=_['intersection'](_0x3efd99[_0xa068('0x40')],qs[_0xa068('0x45')](_0x3d16c8[_0xa068('0x41')][_0xa068('0x45')]));_0x432594[_0xa068('0x44')]=_0x432594['attributes'][_0xa068('0x54')]?_0x432594[_0xa068('0x44')]:_0x3efd99['model'];if(_0x3d16c8[_0xa068('0x41')][_0xa068('0x4e')]){_0x432594['include']=[{'all':!![]}];}_0x432594=_[_0xa068('0x4c')]({},_0x432594,_0x3d16c8['options']);return db[_0xa068('0x3d')][_0xa068('0x55')](_0x432594)[_0xa068('0x36')](handleEntityNotFound(_0x3533b0,null))[_0xa068('0x36')](respondWithResult(_0x3533b0,null))[_0xa068('0x29')](handleError(_0x3533b0,null));};exports[_0xa068('0x56')]=function(_0x20c793,_0x1d1a6d){return db[_0xa068('0x3d')][_0xa068('0x56')](_0x20c793[_0xa068('0x57')],{})[_0xa068('0x36')](respondWithResult(_0x1d1a6d,0xc9))[_0xa068('0x29')](handleError(_0x1d1a6d,null));};exports[_0xa068('0x35')]=function(_0x3ffba6,_0x4cd5f3){if(_0x3ffba6[_0xa068('0x57')]['id']){delete _0x3ffba6[_0xa068('0x57')]['id'];}return db[_0xa068('0x3d')][_0xa068('0x55')]({'where':{'id':_0x3ffba6['params']['id']}})[_0xa068('0x36')](handleEntityNotFound(_0x4cd5f3,null))[_0xa068('0x36')](saveUpdates(_0x3ffba6[_0xa068('0x57')],null))[_0xa068('0x36')](respondWithResult(_0x4cd5f3,null))[_0xa068('0x29')](handleError(_0x4cd5f3,null));};exports[_0xa068('0x37')]=function(_0xf6b510,_0x27be55){return db[_0xa068('0x3d')][_0xa068('0x55')]({'where':{'id':_0xf6b510['params']['id']}})[_0xa068('0x36')](handleEntityNotFound(_0x27be55,null))['then'](removeEntity(_0x27be55,null))['catch'](handleError(_0x27be55,null));};exports[_0xa068('0x58')]=function(_0x4c64cd,_0x2d375c){return db['ChatMessage'][_0xa068('0x58')]()[_0xa068('0x36')](respondWithResult(_0x2d375c,null))[_0xa068('0x29')](handleError(_0x2d375c,null));};var interaction_log=require(_0xa068('0x14'))(_0xa068('0x59'));exports['accept']=function(_0x242f4c,_0x58087b,_0x49b49c){var _0x563238={'agent':{},'channel':_0xa068('0x5a')};if(_0x242f4c[_0xa068('0x57')]['id']){delete _0x242f4c[_0xa068('0x57')]['id'];}_0x242f4c['body']['read']=!![];_0x242f4c[_0xa068('0x57')][_0xa068('0x5b')]=moment()[_0xa068('0x5c')](_0xa068('0x5d'));_0x242f4c[_0xa068('0x57')][_0xa068('0x5e')]=_0x242f4c['body']['UserId']||_0x242f4c[_0xa068('0x5f')]['id'];_0x563238[_0xa068('0x60')]['id']=_0x242f4c[_0xa068('0x57')][_0xa068('0x5e')];return db[_0xa068('0x3d')][_0xa068('0x55')]({'where':{'id':_0x242f4c[_0xa068('0x52')]['id'],'UserId':null}})[_0xa068('0x36')](handleEntityNotFound(_0x58087b,null))[_0xa068('0x36')](saveUpdates(_0x242f4c[_0xa068('0x57')],null))['then'](function(_0x24e995){if(_0x24e995){_0x563238[_0xa068('0x28')]=_0x24e995[_0xa068('0x61')]({'plain':!![]});return db[_0xa068('0x62')][_0xa068('0x55')]({'where':{'id':_0x24e995['ChatInteractionId']}});}return null;})[_0xa068('0x36')](handleEntityNotFound(_0x58087b,null))[_0xa068('0x36')](function(_0x4642cf){if(_0x4642cf){return _0x4642cf[_0xa068('0x35')]({'UserId':_0x242f4c[_0xa068('0x57')][_0xa068('0x5e')],'read1stAt':_[_0xa068('0x63')](_0x4642cf[_0xa068('0x64')])?moment()[_0xa068('0x5c')](_0xa068('0x5d')):undefined});}return null;})[_0xa068('0x36')](function(_0x31304a){if(_0x31304a){_0x563238[_0xa068('0x65')]=_0x31304a[_0xa068('0x61')]({'plain':!![]});interaction_log[_0xa068('0x23')](_0xa068('0x66'),_0x242f4c[_0xa068('0x5f')]['id'],_0x242f4c[_0xa068('0x5f')]['name'],_0x242f4c[_0xa068('0x5f')][_0xa068('0x67')],_0x563238[_0xa068('0x65')]['id'],_0x242f4c[_0xa068('0x57')]?JSON[_0xa068('0x26')](_0x242f4c[_0xa068('0x57')]):_0xa068('0x68'));return respondWithRpcPromise(_0xa068('0x69'),_0xa068('0x6a'),_0x563238);}return null;})['then'](function(_0x5a596f){var _0x3fa311=_0xa068('0x6b')+_0x5a596f['message'][_0xa068('0x6c')];return db[_0xa068('0x6d')][_0xa068('0x41')](_0x3fa311,{'type':db['Sequelize'][_0xa068('0x6e')][_0xa068('0x6f')],'raw':!![]})['then'](function(_0x30a6){return _0x30a6;});})[_0xa068('0x36')](function(_0x2ba909){if(_0x2ba909){_0x563238[_0xa068('0x28')]['contact']=_0x2ba909[0x0];if(!_0x242f4c['body']['UserId'])return;return db['User']['find']({'where':{'id':_0x242f4c[_0xa068('0x57')][_0xa068('0x5e')],'role':_0xa068('0x60')},'attributes':['id',_0xa068('0x3a'),_0xa068('0x70'),_0xa068('0x71'),_0xa068('0x72')],'raw':!![]});}return null;})['then'](function(_0x3621f7){if(!_0x3621f7)return null;_0x563238[_0xa068('0x28')][_0xa068('0x60')]=_0x3621f7;return _0x563238;})[_0xa068('0x36')](function(_0x551ab4){if(_0x551ab4){if(_0x242f4c['body'][_0xa068('0x73')]){_0x563238[_0xa068('0x28')][_0xa068('0x74')]=util[_0xa068('0x5c')](_0xa068('0x75'),_0x242f4c['user'][_0xa068('0x3a')]);_0x563238['message']['channel']=_0x563238[_0xa068('0x76')];_0x563238[_0xa068('0x28')][_0xa068('0x77')]=_0x563238[_0xa068('0x76')];_0x563238[_0xa068('0x28')][_0xa068('0x78')]=_0xa068('0x79');return respondWithRpcPromise(_0xa068('0x7a'),'EventManager',{'event':_0xa068('0x7b'),'message':_[_0xa068('0x4c')](_0x563238[_0xa068('0x28')],JSON[_0xa068('0x7c')](_0x563238[_0xa068('0x65')]['formData']))},client9002)['then'](function(){return _0x563238;});}return _0x563238;}return null;})[_0xa068('0x36')](respondWithResult(_0x58087b,null))['catch'](handleError(_0x58087b,null));};var interaction_log=require('../../config/logger')(_0xa068('0x59'));exports[_0xa068('0x33')]=function(_0x4b16d5,_0x1fee28,_0x5258a8){var _0x3bc5b6={'agent':{},'channel':_0xa068('0x5a')};if(_0x4b16d5[_0xa068('0x57')]['id']){delete _0x4b16d5[_0xa068('0x57')]['id'];}_0x4b16d5[_0xa068('0x57')][_0xa068('0x5e')]=_0x4b16d5[_0xa068('0x57')][_0xa068('0x5e')]||_0x4b16d5[_0xa068('0x5f')]['id'];_0x3bc5b6[_0xa068('0x60')]['id']=_0x4b16d5[_0xa068('0x57')]['UserId'];return db[_0xa068('0x3d')]['find']({'where':{'id':_0x4b16d5[_0xa068('0x52')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x1fee28,null))[_0xa068('0x36')](function(_0x222668){if(_0x222668){_0x3bc5b6[_0xa068('0x28')]=_0x222668[_0xa068('0x61')]({'plain':!![]});return db[_0xa068('0x62')][_0xa068('0x55')]({'where':{'id':_0x222668['ChatInteractionId']}});}return null;})[_0xa068('0x36')](handleEntityNotFound(_0x1fee28,null))[_0xa068('0x36')](function(_0x44bc92){if(_0x44bc92){_0x3bc5b6[_0xa068('0x65')]=_0x44bc92[_0xa068('0x61')]({'plain':!![]});interaction_log[_0xa068('0x23')]('[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x4b16d5[_0xa068('0x5f')]['id'],_0x4b16d5[_0xa068('0x5f')][_0xa068('0x3a')],_0x4b16d5[_0xa068('0x5f')][_0xa068('0x67')],_0x3bc5b6[_0xa068('0x65')]['id'],_0x4b16d5[_0xa068('0x57')]?JSON[_0xa068('0x26')](_0x4b16d5[_0xa068('0x57')]):_0xa068('0x68'));return respondWithRpcPromise(_0xa068('0x7d'),_0xa068('0x7e'),_0x3bc5b6);}return null;})[_0xa068('0x36')](function(_0x4d9922){var _0x381e75=_0xa068('0x6b')+_0x4d9922[_0xa068('0x28')][_0xa068('0x6c')];return db[_0xa068('0x6d')][_0xa068('0x41')](_0x381e75,{'type':db[_0xa068('0x7f')][_0xa068('0x6e')][_0xa068('0x6f')],'raw':!![]})[_0xa068('0x36')](function(_0x55d97f){return _0x55d97f;});})['then'](function(_0x1cc41b){if(_0x1cc41b){_0x3bc5b6[_0xa068('0x28')][_0xa068('0x80')]=_0x1cc41b[0x0];if(!_0x4b16d5[_0xa068('0x57')][_0xa068('0x5e')])return;return db[_0xa068('0x81')]['find']({'where':{'id':_0x4b16d5['body'][_0xa068('0x5e')],'role':_0xa068('0x60')},'attributes':['id',_0xa068('0x3a'),_0xa068('0x70'),_0xa068('0x71'),_0xa068('0x72')],'raw':!![]});}return null;})[_0xa068('0x36')](function(_0x30be5d){if(!_0x30be5d)return null;_0x3bc5b6[_0xa068('0x28')][_0xa068('0x60')]=_0x30be5d;return _0x3bc5b6;})[_0xa068('0x36')](function(_0x3ee4b7){if(_0x3ee4b7){_0x3ee4b7['message'][_0xa068('0x74')]=util[_0xa068('0x5c')]('SIP/%s',_0x4b16d5['user'][_0xa068('0x3a')]);_0x3ee4b7['message']['channel']=_0x3bc5b6['channel'];_0x3ee4b7[_0xa068('0x28')][_0xa068('0x77')]=_0x3bc5b6[_0xa068('0x76')];_0x3ee4b7[_0xa068('0x28')][_0xa068('0x78')]=_0xa068('0x33');respondWithRpcPromise('EventManager','EventManager',{'event':'rejectmessage','message':_[_0xa068('0x4c')](_0x3bc5b6[_0xa068('0x28')],JSON[_0xa068('0x7c')](_0x3bc5b6[_0xa068('0x65')]['formData']))},client9002);return _0x3bc5b6;}return null;})['then'](respondWithResult(_0x1fee28,null))['catch'](handleError(_0x1fee28,null));}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.events.js b/server/api/chatMessage/chatMessage.events.js index c729cb6..c728a62 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 _0xa9c0=['emit','exports','events','../../mysqldb','ChatMessage','save','update'];(function(_0xdbd4f7,_0x4e3bdd){var _0x5c3f9d=function(_0xa7a35a){while(--_0xa7a35a){_0xdbd4f7['push'](_0xdbd4f7['shift']());}};_0x5c3f9d(++_0x4e3bdd);}(_0xa9c0,0x72));var _0x0a9c=function(_0x522505,_0x52d1eb){_0x522505=_0x522505-0x0;var _0x16e2cd=_0xa9c0[_0x522505];return _0x16e2cd;};'use strict';var EventEmitter=require(_0x0a9c('0x0'));var ChatMessage=require(_0x0a9c('0x1'))['db'][_0x0a9c('0x2')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x0a9c('0x3'),'afterUpdate':_0x0a9c('0x4'),'afterDestroy':'remove'};function emitEvent(_0x4ac2b6){return function(_0x159036,_0x319357,_0x1880a1){ChatMessageEvents[_0x0a9c('0x5')](_0x4ac2b6+':'+_0x159036['id'],_0x159036);ChatMessageEvents['emit'](_0x4ac2b6,_0x159036);_0x1880a1(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatMessage['hook'](e,emitEvent(event));}}module[_0x0a9c('0x6')]=ChatMessageEvents; \ No newline at end of file +var _0x2cef=['setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','ChatMessage'];(function(_0x4966a4,_0x39662c){var _0x3c6bf6=function(_0x53c4f2){while(--_0x53c4f2){_0x4966a4['push'](_0x4966a4['shift']());}};_0x3c6bf6(++_0x39662c);}(_0x2cef,0x97));var _0xf2ce=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x2cef[_0x1facfa];return _0x9ec701;};'use strict';var EventEmitter=require(_0xf2ce('0x0'));var ChatMessage=require(_0xf2ce('0x1'))['db'][_0xf2ce('0x2')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0xf2ce('0x3')](0x0);var events={'afterCreate':_0xf2ce('0x4'),'afterUpdate':_0xf2ce('0x5'),'afterDestroy':_0xf2ce('0x6')};function emitEvent(_0x5334cf){return function(_0x4f1b4a,_0x4ef215,_0x3329c1){ChatMessageEvents[_0xf2ce('0x7')](_0x5334cf+':'+_0x4f1b4a['id'],_0x4f1b4a);ChatMessageEvents[_0xf2ce('0x7')](_0x5334cf,_0x4f1b4a);_0x3329c1(null);};}for(var e in events){if(events[_0xf2ce('0x8')](e)){var event=events[e];ChatMessage[_0xf2ce('0x9')](e,emitEvent(event));}}module[_0xf2ce('0xa')]=ChatMessageEvents; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.model.js b/server/api/chatMessage/chatMessage.model.js index e5231ca..5a3e620 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 _0x0a35=['utf8mb4','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./chatMessage.attributes','exports','ChatMessage','chat_messages','body','FULLTEXT','models','get','direction','toLowerCase','secret','isNil','UserId','ChatInteraction','then','update','createdAt','catch'];(function(_0x573311,_0x46eec4){var _0x3ae3ce=function(_0x298f93){while(--_0x298f93){_0x573311['push'](_0x573311['shift']());}};_0x3ae3ce(++_0x46eec4);}(_0x0a35,0xe1));var _0x50a3=function(_0x5e9689,_0x48e034){_0x5e9689=_0x5e9689-0x0;var _0x2fac94=_0x0a35[_0x5e9689];return _0x2fac94;};'use strict';var _=require(_0x50a3('0x0'));var util=require(_0x50a3('0x1'));var logger=require(_0x50a3('0x2'))(_0x50a3('0x3'));var moment=require(_0x50a3('0x4'));var BPromise=require(_0x50a3('0x5'));var rp=require(_0x50a3('0x6'));var fs=require('fs');var path=require(_0x50a3('0x7'));var rimraf=require(_0x50a3('0x8'));var config=require('../../config/environment');var attributes=require(_0x50a3('0x9'));module[_0x50a3('0xa')]=function(_0x5b742,_0x2ee696){return _0x5b742['define'](_0x50a3('0xb'),attributes,{'tableName':_0x50a3('0xc'),'paranoid':![],'indexes':[{'name':'fti_chat_messages','fields':[_0x50a3('0xd')],'type':_0x50a3('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0xc4e4dd,_0xfdcdb,_0x166474){var _0x557506=_0x5b742[_0x50a3('0xf')];var _0x3a526d=_0xc4e4dd[_0x50a3('0x10')]({'plain':!![]});if(_0x3a526d[_0x50a3('0x11')]['toLowerCase']()==='in'||_0x3a526d['direction'][_0x50a3('0x12')]()==='out'&&!_0x3a526d[_0x50a3('0x13')]&&!_[_0x50a3('0x14')](_0x3a526d[_0x50a3('0x15')])){_0x557506[_0x50a3('0x16')]['findOne']({'where':{'id':_0x3a526d['ChatInteractionId']}})[_0x50a3('0x17')](function(_0x1784b1){if(_0x1784b1){_0x1784b1[_0x50a3('0x18')]({'lastMsgAt':_0x3a526d[_0x50a3('0x19')],'lastMsgDirection':_0x3a526d[_0x50a3('0x11')]['toLowerCase']()});}})[_0x50a3('0x1a')](function(_0x180cac){console['error'](_0x180cac);});}_0x166474();}},'charset':_0x50a3('0x1b'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x1f36=['UserId','ChatInteraction','ChatInteractionId','update','catch','error','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','bluebird','path','rimraf','../../config/environment','./chatMessage.attributes','exports','ChatMessage','chat_messages','fti_chat_messages','body','FULLTEXT','models','get','direction','out','secret'];(function(_0xbe200f,_0x4b50eb){var _0x192597=function(_0x106cfd){while(--_0x106cfd){_0xbe200f['push'](_0xbe200f['shift']());}};_0x192597(++_0x4b50eb);}(_0x1f36,0x1ed));var _0x61f3=function(_0x5989e9,_0xef6905){_0x5989e9=_0x5989e9-0x0;var _0xac49f2=_0x1f36[_0x5989e9];return _0xac49f2;};'use strict';var _=require(_0x61f3('0x0'));var util=require(_0x61f3('0x1'));var logger=require(_0x61f3('0x2'))(_0x61f3('0x3'));var moment=require('moment');var BPromise=require(_0x61f3('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x61f3('0x5'));var rimraf=require(_0x61f3('0x6'));var config=require(_0x61f3('0x7'));var attributes=require(_0x61f3('0x8'));module[_0x61f3('0x9')]=function(_0x12c372,_0x72af3d){return _0x12c372['define'](_0x61f3('0xa'),attributes,{'tableName':_0x61f3('0xb'),'paranoid':![],'indexes':[{'name':_0x61f3('0xc'),'fields':[_0x61f3('0xd')],'type':_0x61f3('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x3e184d,_0x3e7987,_0x51f786){var _0x1dba23=_0x12c372[_0x61f3('0xf')];var _0x14b24e=_0x3e184d[_0x61f3('0x10')]({'plain':!![]});if(_0x14b24e[_0x61f3('0x11')]['toLowerCase']()==='in'||_0x14b24e[_0x61f3('0x11')]['toLowerCase']()===_0x61f3('0x12')&&!_0x14b24e[_0x61f3('0x13')]&&!_['isNil'](_0x14b24e[_0x61f3('0x14')])){_0x1dba23[_0x61f3('0x15')]['findOne']({'where':{'id':_0x14b24e[_0x61f3('0x16')]}})['then'](function(_0x42c8b4){if(_0x42c8b4){_0x42c8b4[_0x61f3('0x17')]({'lastMsgAt':_0x14b24e['createdAt'],'lastMsgDirection':_0x14b24e[_0x61f3('0x11')]['toLowerCase']()});}})[_0x61f3('0x18')](function(_0x222d54){console[_0x61f3('0x19')](_0x222d54);});}_0x51f786();}},'charset':'utf8mb4','collate':_0x61f3('0x1a')});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.rpc.js b/server/api/chatMessage/chatMessage.rpc.js index 96a4cf1..e0452ab 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 _0x325a=['body','options','then','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','register','request','ChatMessage,\x20%s,\x20%s','request\x20sent','error','code','message','info','result','catch','CreateChatMessage','ChatMessage','create'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x325a,0x1b5));var _0xa325=function(_0x4847e2,_0x5ac9db){_0x4847e2=_0x4847e2-0x0;var _0x25a9dc=_0x325a[_0x4847e2];return _0x25a9dc;};'use strict';var _=require(_0xa325('0x0'));var util=require(_0xa325('0x1'));var moment=require('moment');var BPromise=require(_0xa325('0x2'));var rs=require(_0xa325('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa325('0x4'))['db'];var utils=require(_0xa325('0x5'));var logger=require(_0xa325('0x6'))(_0xa325('0x7'));var config=require(_0xa325('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xa325('0x9')][_0xa325('0xa')]({'port':0x232a});config[_0xa325('0xb')]=_[_0xa325('0xc')](config[_0xa325('0xb')],{'host':_0xa325('0xd'),'port':0x18eb});var socket=require(_0xa325('0xe'))(new Redis(config[_0xa325('0xb')]));require('./chatMessage.socket')[_0xa325('0xf')](socket);function respondWithRpcPromise(_0x5c7be3,_0x50a13d,_0x2d7684){return new BPromise(function(_0x2b15e5,_0x222664){return client[_0xa325('0x10')](_0x5c7be3,_0x2d7684)['then'](function(_0x1bfb7a){logger['info'](_0xa325('0x11'),_0x50a13d,_0xa325('0x12'));logger['debug']('ChatMessage,\x20%s,\x20%s,\x20%s',_0x50a13d,_0xa325('0x12'),JSON['stringify'](_0x1bfb7a));if(_0x1bfb7a[_0xa325('0x13')]){if(_0x1bfb7a[_0xa325('0x13')][_0xa325('0x14')]===0x1f4){logger[_0xa325('0x13')](_0xa325('0x11'),_0x50a13d,_0x1bfb7a[_0xa325('0x13')][_0xa325('0x15')]);return _0x222664(_0x1bfb7a['error'][_0xa325('0x15')]);}logger[_0xa325('0x13')](_0xa325('0x11'),_0x50a13d,_0x1bfb7a['error'][_0xa325('0x15')]);return _0x2b15e5(_0x1bfb7a[_0xa325('0x13')][_0xa325('0x15')]);}else{logger[_0xa325('0x16')]('ChatMessage,\x20%s,\x20%s',_0x50a13d,_0xa325('0x12'));_0x2b15e5(_0x1bfb7a[_0xa325('0x17')][_0xa325('0x15')]);}})[_0xa325('0x18')](function(_0x36bc88){logger[_0xa325('0x13')](_0xa325('0x11'),_0x50a13d,_0x36bc88);_0x222664(_0x36bc88);});});}exports[_0xa325('0x19')]=function(_0x159bbb){var _0x21f78c=this;return new Promise(function(_0x22272f,_0x5468c4){return db[_0xa325('0x1a')][_0xa325('0x1b')](_0x159bbb[_0xa325('0x1c')],{'raw':_0x159bbb[_0xa325('0x1d')]?_0x159bbb[_0xa325('0x1d')]['raw']===undefined?!![]:![]:!![]})[_0xa325('0x1e')](function(_0x5eacb6){logger['info'](_0xa325('0x19'),_0x159bbb);logger['debug'](_0xa325('0x19'),_0x159bbb,JSON['stringify'](_0x5eacb6));_0x22272f(_0x5eacb6);})['catch'](function(_0x4919c6){logger[_0xa325('0x13')](_0xa325('0x19'),_0x4919c6[_0xa325('0x15')],_0x159bbb);_0x5468c4(_0x21f78c['error'](0x1f4,_0x4919c6['message']));});});}; \ No newline at end of file +var _0xae4e=['client','http','redis','defaults','localhost','socket.io-emitter','./chatMessage.socket','register','request','then','info','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateChatMessage','create','body','options','raw','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x138293,_0x197e7f){var _0x34c4a2=function(_0x20192b){while(--_0x20192b){_0x138293['push'](_0x138293['shift']());}};_0x34c4a2(++_0x197e7f);}(_0xae4e,0x116));var _0xeae4=function(_0x13c223,_0x433b38){_0x13c223=_0x13c223-0x0;var _0x3e8d83=_0xae4e[_0x13c223];return _0x3e8d83;};'use strict';var _=require(_0xeae4('0x0'));var util=require(_0xeae4('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xeae4('0x2'));var fs=require('fs');var Redis=require(_0xeae4('0x3'));var db=require(_0xeae4('0x4'))['db'];var utils=require(_0xeae4('0x5'));var logger=require(_0xeae4('0x6'))(_0xeae4('0x7'));var config=require(_0xeae4('0x8'));var jayson=require(_0xeae4('0x9'));var client=jayson[_0xeae4('0xa')][_0xeae4('0xb')]({'port':0x232a});config[_0xeae4('0xc')]=_[_0xeae4('0xd')](config['redis'],{'host':_0xeae4('0xe'),'port':0x18eb});var socket=require(_0xeae4('0xf'))(new Redis(config[_0xeae4('0xc')]));require(_0xeae4('0x10'))[_0xeae4('0x11')](socket);function respondWithRpcPromise(_0x412af8,_0xea104a,_0x8cbd2d){return new BPromise(function(_0x95276f,_0x44e6c8){return client[_0xeae4('0x12')](_0x412af8,_0x8cbd2d)[_0xeae4('0x13')](function(_0x3f7de4){logger[_0xeae4('0x14')](_0xeae4('0x15'),_0xea104a,_0xeae4('0x16'));logger[_0xeae4('0x17')](_0xeae4('0x18'),_0xea104a,_0xeae4('0x16'),JSON[_0xeae4('0x19')](_0x3f7de4));if(_0x3f7de4[_0xeae4('0x1a')]){if(_0x3f7de4[_0xeae4('0x1a')][_0xeae4('0x1b')]===0x1f4){logger['error'](_0xeae4('0x15'),_0xea104a,_0x3f7de4[_0xeae4('0x1a')][_0xeae4('0x1c')]);return _0x44e6c8(_0x3f7de4['error'][_0xeae4('0x1c')]);}logger[_0xeae4('0x1a')](_0xeae4('0x15'),_0xea104a,_0x3f7de4['error'][_0xeae4('0x1c')]);return _0x95276f(_0x3f7de4['error'][_0xeae4('0x1c')]);}else{logger[_0xeae4('0x14')]('ChatMessage,\x20%s,\x20%s',_0xea104a,_0xeae4('0x16'));_0x95276f(_0x3f7de4[_0xeae4('0x1d')]['message']);}})[_0xeae4('0x1e')](function(_0x414b4a){logger['error'](_0xeae4('0x15'),_0xea104a,_0x414b4a);_0x44e6c8(_0x414b4a);});});}exports[_0xeae4('0x1f')]=function(_0x5efb17){var _0x3bc873=this;return new Promise(function(_0x11f20c,_0x3d98d1){return db['ChatMessage'][_0xeae4('0x20')](_0x5efb17[_0xeae4('0x21')],{'raw':_0x5efb17[_0xeae4('0x22')]?_0x5efb17['options'][_0xeae4('0x23')]===undefined?!![]:![]:!![]})[_0xeae4('0x13')](function(_0x8103be){logger['info'](_0xeae4('0x1f'),_0x5efb17);logger[_0xeae4('0x17')](_0xeae4('0x1f'),_0x5efb17,JSON[_0xeae4('0x19')](_0x8103be));_0x11f20c(_0x8103be);})['catch'](function(_0x341738){logger[_0xeae4('0x1a')](_0xeae4('0x1f'),_0x341738['message'],_0x5efb17);_0x3d98d1(_0x3bc873[_0xeae4('0x1a')](0x1f4,_0x341738['message']));});});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.socket.js b/server/api/chatMessage/chatMessage.socket.js index 96ca8bc..2ce798c 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 _0xe5d5=['length','chatMessage:','remove','removeListener','register'];(function(_0x51b661,_0x566ef8){var _0x5d1971=function(_0x5cc6b8){while(--_0x5cc6b8){_0x51b661['push'](_0x51b661['shift']());}};_0x5d1971(++_0x566ef8);}(_0xe5d5,0x156));var _0x5e5d=function(_0x5404dd,_0xa1b7a3){_0x5404dd=_0x5404dd-0x0;var _0x53afdd=_0xe5d5[_0x5404dd];return _0x53afdd;};'use strict';var ChatMessageEvents=require('./chatMessage.events');var events=['save',_0x5e5d('0x0'),'update'];function createListener(_0x9f47d6,_0x4b8ae9){return function(_0x50afd3){_0x4b8ae9['emit'](_0x9f47d6,_0x50afd3);};}function removeListener(_0x3e2410,_0x191980){return function(){ChatMessageEvents[_0x5e5d('0x1')](_0x3e2410,_0x191980);};}exports[_0x5e5d('0x2')]=function(_0x13bcb7){for(var _0x39077f=0x0,_0x3200d5=events[_0x5e5d('0x3')];_0x39077f<_0x3200d5;_0x39077f++){var _0x23de8d=events[_0x39077f];var _0x131a59=createListener(_0x5e5d('0x4')+_0x23de8d,_0x13bcb7);ChatMessageEvents['on'](_0x23de8d,_0x131a59);}}; \ No newline at end of file +var _0x29d4=['removeListener','register','length','./chatMessage.events','remove','update'];(function(_0x522a3b,_0x22b40a){var _0x761494=function(_0x4c599a){while(--_0x4c599a){_0x522a3b['push'](_0x522a3b['shift']());}};_0x761494(++_0x22b40a);}(_0x29d4,0x1a1));var _0x429d=function(_0x54d4fe,_0x55e869){_0x54d4fe=_0x54d4fe-0x0;var _0x1ab5bb=_0x29d4[_0x54d4fe];return _0x1ab5bb;};'use strict';var ChatMessageEvents=require(_0x429d('0x0'));var events=['save',_0x429d('0x1'),_0x429d('0x2')];function createListener(_0x16ce75,_0x472fc9){return function(_0x45df1c){_0x472fc9['emit'](_0x16ce75,_0x45df1c);};}function removeListener(_0xc3989d,_0x3f43f5){return function(){ChatMessageEvents[_0x429d('0x3')](_0xc3989d,_0x3f43f5);};}exports[_0x429d('0x4')]=function(_0x1c55aa){for(var _0xa71445=0x0,_0x56aa2f=events[_0x429d('0x5')];_0xa71445<_0x56aa2f;_0xa71445++){var _0x4befb9=events[_0xa71445];var _0x9fc337=createListener('chatMessage:'+_0x4befb9,_0x1c55aa);ChatMessageEvents['on'](_0x4befb9,_0x9fc337);}}; \ No newline at end of file diff --git a/server/api/chatMessage/index.js b/server/api/chatMessage/index.js index 5550046..b192b48 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 _0x8ca0=['describe','/:id','post','chat','chatmessage:create','create','put','update','/:id/accept','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatMessage.controller','get','isAuthenticated','/describe'];(function(_0x228516,_0x44b04d){var _0x19fd2b=function(_0x2d63b){while(--_0x2d63b){_0x228516['push'](_0x228516['shift']());}};_0x19fd2b(++_0x44b04d);}(_0x8ca0,0x110));var _0x08ca=function(_0x1a0694,_0x318d2b){_0x1a0694=_0x1a0694-0x0;var _0x48c228=_0x8ca0[_0x1a0694];return _0x48c228;};'use strict';var multer=require(_0x08ca('0x0'));var util=require(_0x08ca('0x1'));var path=require(_0x08ca('0x2'));var timeout=require(_0x08ca('0x3'));var express=require(_0x08ca('0x4'));var router=express[_0x08ca('0x5')]();var fs_extra=require(_0x08ca('0x6'));var auth=require(_0x08ca('0x7'));var interaction=require(_0x08ca('0x8'));var config=require(_0x08ca('0x9'));var controller=require(_0x08ca('0xa'));router[_0x08ca('0xb')]('/',auth[_0x08ca('0xc')](),controller['index']);router[_0x08ca('0xb')](_0x08ca('0xd'),auth[_0x08ca('0xc')](),controller[_0x08ca('0xe')]);router[_0x08ca('0xb')](_0x08ca('0xf'),auth['isAuthenticated'](),controller['show']);router[_0x08ca('0x10')]('/',auth[_0x08ca('0xc')](),interaction['tracked'](_0x08ca('0x11'),_0x08ca('0x12')),controller[_0x08ca('0x13')]);router[_0x08ca('0x14')](_0x08ca('0xf'),controller[_0x08ca('0x15')]);router[_0x08ca('0x14')](_0x08ca('0x16'),auth[_0x08ca('0xc')](),controller['accept']);router[_0x08ca('0x14')]('/:id/reject',auth[_0x08ca('0xc')](),controller['reject']);router[_0x08ca('0x17')](_0x08ca('0xf'),auth[_0x08ca('0xc')](),controller[_0x08ca('0x18')]);module[_0x08ca('0x19')]=router; \ No newline at end of file +var _0xaeee=['/:id/accept','accept','delete','/:id','destroy','exports','multer','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','show','post','tracked','chat','chatmessage:create','create','put','update'];(function(_0x51dd8b,_0x326222){var _0x11cc3d=function(_0x2f1138){while(--_0x2f1138){_0x51dd8b['push'](_0x51dd8b['shift']());}};_0x11cc3d(++_0x326222);}(_0xaeee,0x124));var _0xeaee=function(_0x330bdf,_0x4f10f3){_0x330bdf=_0x330bdf-0x0;var _0x3db14d=_0xaeee[_0x330bdf];return _0x3db14d;};'use strict';var multer=require(_0xeaee('0x0'));var util=require('util');var path=require(_0xeaee('0x1'));var timeout=require(_0xeaee('0x2'));var express=require(_0xeaee('0x3'));var router=express['Router']();var fs_extra=require(_0xeaee('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xeaee('0x5'));var config=require(_0xeaee('0x6'));var controller=require('./chatMessage.controller');router[_0xeaee('0x7')]('/',auth[_0xeaee('0x8')](),controller[_0xeaee('0x9')]);router['get'](_0xeaee('0xa'),auth[_0xeaee('0x8')](),controller[_0xeaee('0xb')]);router[_0xeaee('0x7')]('/:id',auth['isAuthenticated'](),controller[_0xeaee('0xc')]);router[_0xeaee('0xd')]('/',auth[_0xeaee('0x8')](),interaction[_0xeaee('0xe')](_0xeaee('0xf'),_0xeaee('0x10')),controller[_0xeaee('0x11')]);router[_0xeaee('0x12')]('/:id',controller[_0xeaee('0x13')]);router['put'](_0xeaee('0x14'),auth[_0xeaee('0x8')](),controller[_0xeaee('0x15')]);router[_0xeaee('0x12')]('/:id/reject',auth[_0xeaee('0x8')](),controller['reject']);router[_0xeaee('0x16')](_0xeaee('0x17'),auth[_0xeaee('0x8')](),controller[_0xeaee('0x18')]);module[_0xeaee('0x19')]=router; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js b/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js index d5c9592..c2cd8c0 100644 --- a/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js +++ b/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdb28=['TEXT','medium','sequelize','exports'];(function(_0xeb5065,_0x534468){var _0x466f5d=function(_0x5de2ea){while(--_0x5de2ea){_0xeb5065['push'](_0xeb5065['shift']());}};_0x466f5d(++_0x534468);}(_0xdb28,0x106));var _0x8db2=function(_0x2f36bd,_0x4a8866){_0x2f36bd=_0x2f36bd-0x0;var _0x299a9f=_0xdb28[_0x2f36bd];return _0x299a9f;};'use strict';var Sequelize=require(_0x8db2('0x0'));module[_0x8db2('0x1')]={'body':{'type':Sequelize[_0x8db2('0x2')](_0x8db2('0x3')),'allowNull':![]},'plainBody':{'type':Sequelize['TEXT'](_0x8db2('0x3')),'allowNull':![]}}; \ No newline at end of file +var _0x5f66=['medium','TEXT','exports'];(function(_0x51b9cd,_0x2f3f83){var _0x4ebcf7=function(_0x588728){while(--_0x588728){_0x51b9cd['push'](_0x51b9cd['shift']());}};_0x4ebcf7(++_0x2f3f83);}(_0x5f66,0x1a0));var _0x65f6=function(_0xefd519,_0xc62635){_0xefd519=_0xefd519-0x0;var _0x4bb882=_0x5f66[_0xefd519];return _0x4bb882;};'use strict';var Sequelize=require('sequelize');module[_0x65f6('0x0')]={'body':{'type':Sequelize['TEXT'](_0x65f6('0x1')),'allowNull':![]},'plainBody':{'type':Sequelize[_0x65f6('0x2')](_0x65f6('0x1')),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.controller.js b/server/api/chatOfflineMessage/chatOfflineMessage.controller.js index 970c945..ebc95b5 100644 --- a/server/api/chatOfflineMessage/chatOfflineMessage.controller.js +++ b/server/api/chatOfflineMessage/chatOfflineMessage.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['filter','VIRTUAL','includeAll','include','findAll','rows','show','params','length','merge','options','find','catch','body','Attachment','join','server','attachments','offline-chat','basename','remove','describe','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','index','ChatOfflineMessage','fieldName','type','model','map','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick'];(function(_0x220dbb,_0x99328d){var _0x2b77de=function(_0x15e966){while(--_0x15e966){_0x220dbb['push'](_0x220dbb['shift']());}};_0x2b77de(++_0x99328d);}(_0x7a54,0x106));var _0x47a5=function(_0x21e576,_0x24aceb){_0x21e576=_0x21e576-0x0;var _0x3df6e6=_0x7a54[_0x21e576];return _0x3df6e6;};'use strict';var emlformat=require(_0x47a5('0x0'));var rimraf=require(_0x47a5('0x1'));var zipdir=require(_0x47a5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x47a5('0x3'));var moment=require(_0x47a5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x47a5('0x5'));var util=require(_0x47a5('0x6'));var path=require(_0x47a5('0x7'));var sox=require(_0x47a5('0x8'));var csv=require(_0x47a5('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x47a5('0xa'));var _=require('lodash');var squel=require(_0x47a5('0xb'));var crypto=require(_0x47a5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x47a5('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x47a5('0xe'));var authService=require(_0x47a5('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x47a5('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x47a5('0x11'));var utils=require(_0x47a5('0x12'));var config=require(_0x47a5('0x13'));var licenseUtil=require(_0x47a5('0x14'));var db=require(_0x47a5('0x15'))['db'];function respondWithStatusCode(_0xd308b8,_0x1eae59){_0x1eae59=_0x1eae59||0xcc;return function(_0x5beb89){if(_0x5beb89){return _0xd308b8[_0x47a5('0x16')](_0x1eae59);}return _0xd308b8[_0x47a5('0x17')](_0x1eae59)[_0x47a5('0x18')]();};}function respondWithResult(_0x711793,_0x139f25){_0x139f25=_0x139f25||0xc8;return function(_0x620ee9){if(_0x620ee9){return _0x711793[_0x47a5('0x17')](_0x139f25)[_0x47a5('0x19')](_0x620ee9);}};}function respondWithFilteredResult(_0x4e99a8,_0x362359){return function(_0x11faf5){if(_0x11faf5){var _0x3b001e=typeof _0x362359[_0x47a5('0x1a')]===_0x47a5('0x1b')&&typeof _0x362359['limit']==='undefined';var _0x138bc0=_0x11faf5['count'];var _0x5247fd=_0x3b001e?0x0:_0x362359[_0x47a5('0x1a')];var _0xaf70a6=_0x3b001e?_0x11faf5[_0x47a5('0x1c')]:_0x362359[_0x47a5('0x1a')]+_0x362359[_0x47a5('0x1d')];var _0x12b98e;if(_0xaf70a6>=_0x138bc0){_0xaf70a6=_0x138bc0;_0x12b98e=0xc8;}else{_0x12b98e=0xce;}_0x4e99a8[_0x47a5('0x17')](_0x12b98e);return _0x4e99a8[_0x47a5('0x1e')](_0x47a5('0x1f'),_0x5247fd+'-'+_0xaf70a6+'/'+_0x138bc0)['json'](_0x11faf5);}return null;};}function patchUpdates(_0x1570bc){return function(_0xf160ba){try{jsonpatch['apply'](_0xf160ba,_0x1570bc,!![]);}catch(_0x2b0360){return BPromise[_0x47a5('0x20')](_0x2b0360);}return _0xf160ba[_0x47a5('0x21')]();};}function saveUpdates(_0x4c5910,_0xb8ae6c){return function(_0x2f142b){if(_0x2f142b){return _0x2f142b[_0x47a5('0x22')](_0x4c5910)[_0x47a5('0x23')](function(_0x5ef1b1){return _0x5ef1b1;});}return null;};}function removeEntity(_0xe2dea9,_0x385687){return function(_0x513981){if(_0x513981){return _0x513981[_0x47a5('0x24')]()[_0x47a5('0x23')](function(){_0xe2dea9[_0x47a5('0x17')](0xcc)[_0x47a5('0x18')]();});}};}function handleEntityNotFound(_0x3abd6a,_0x50bf17){return function(_0x53078a){if(!_0x53078a){_0x3abd6a[_0x47a5('0x16')](0x194);}return _0x53078a;};}function handleError(_0x5686db,_0x1ea9c8){_0x1ea9c8=_0x1ea9c8||0x1f4;return function(_0x5b6c4e){logger[_0x47a5('0x25')](_0x5b6c4e[_0x47a5('0x26')]);if(_0x5b6c4e[_0x47a5('0x27')]){delete _0x5b6c4e[_0x47a5('0x27')];}_0x5686db[_0x47a5('0x17')](_0x1ea9c8)[_0x47a5('0x28')](_0x5b6c4e);};}exports[_0x47a5('0x29')]=function(_0x136b14,_0x16631f){var _0x361bfa={},_0x1127f8={},_0x11a4fa={'count':0x0,'rows':[]};var _0x3ad507=_['map'](db[_0x47a5('0x2a')]['rawAttributes'],function(_0x2ef875){return{'name':_0x2ef875[_0x47a5('0x2b')],'type':_0x2ef875[_0x47a5('0x2c')]['key']};});_0x1127f8[_0x47a5('0x2d')]=_[_0x47a5('0x2e')](_0x3ad507,_0x47a5('0x27'));_0x1127f8[_0x47a5('0x2f')]=_['keys'](_0x136b14['query']);_0x1127f8[_0x47a5('0x30')]=_[_0x47a5('0x31')](_0x1127f8['model'],_0x1127f8['query']);_0x361bfa[_0x47a5('0x32')]=_[_0x47a5('0x31')](_0x1127f8['model'],qs[_0x47a5('0x33')](_0x136b14['query'][_0x47a5('0x33')]));_0x361bfa[_0x47a5('0x32')]=_0x361bfa['attributes']['length']?_0x361bfa[_0x47a5('0x32')]:_0x1127f8['model'];if(!_0x136b14[_0x47a5('0x2f')][_0x47a5('0x34')](_0x47a5('0x35'))){_0x361bfa['limit']=qs[_0x47a5('0x1d')](_0x136b14['query']['limit']);_0x361bfa[_0x47a5('0x1a')]=qs['offset'](_0x136b14[_0x47a5('0x2f')]['offset']);}_0x361bfa[_0x47a5('0x36')]=qs[_0x47a5('0x37')](_0x136b14[_0x47a5('0x2f')][_0x47a5('0x37')]);_0x361bfa[_0x47a5('0x38')]=qs[_0x47a5('0x30')](_[_0x47a5('0x39')](_0x136b14[_0x47a5('0x2f')],_0x1127f8[_0x47a5('0x30')]),_0x3ad507);if(_0x136b14['query'][_0x47a5('0x3a')]){_0x361bfa[_0x47a5('0x38')]=_['merge'](_0x361bfa[_0x47a5('0x38')],{'$or':_[_0x47a5('0x2e')](_0x3ad507,function(_0x1d4348){if(_0x1d4348['type']!==_0x47a5('0x3b')){var _0x10f660={};_0x10f660[_0x1d4348['name']]={'$like':'%'+_0x136b14[_0x47a5('0x2f')][_0x47a5('0x3a')]+'%'};return _0x10f660;}})});}_0x361bfa=_['merge']({},_0x361bfa,_0x136b14['options']);var _0x5ebd8c={'where':_0x361bfa[_0x47a5('0x38')]};return db['ChatOfflineMessage'][_0x47a5('0x1c')](_0x5ebd8c)[_0x47a5('0x23')](function(_0x301a85){_0x11a4fa[_0x47a5('0x1c')]=_0x301a85;if(_0x136b14[_0x47a5('0x2f')][_0x47a5('0x3c')]){_0x361bfa[_0x47a5('0x3d')]=[{'all':!![]}];}return db[_0x47a5('0x2a')][_0x47a5('0x3e')](_0x361bfa);})[_0x47a5('0x23')](function(_0x280500){_0x11a4fa[_0x47a5('0x3f')]=_0x280500;return _0x11a4fa;})[_0x47a5('0x23')](respondWithFilteredResult(_0x16631f,_0x361bfa))['catch'](handleError(_0x16631f,null));};exports[_0x47a5('0x40')]=function(_0x1c36fa,_0x331474){var _0x23bd8d={'raw':!![],'where':{'id':_0x1c36fa[_0x47a5('0x41')]['id']}},_0x586f4f={};_0x586f4f['model']=_['keys'](db['ChatOfflineMessage']['rawAttributes']);_0x586f4f[_0x47a5('0x2f')]=_['keys'](_0x1c36fa[_0x47a5('0x2f')]);_0x586f4f[_0x47a5('0x30')]=_[_0x47a5('0x31')](_0x586f4f['model'],_0x586f4f[_0x47a5('0x2f')]);_0x23bd8d[_0x47a5('0x32')]=_['intersection'](_0x586f4f['model'],qs[_0x47a5('0x33')](_0x1c36fa['query'][_0x47a5('0x33')]));_0x23bd8d[_0x47a5('0x32')]=_0x23bd8d[_0x47a5('0x32')][_0x47a5('0x42')]?_0x23bd8d[_0x47a5('0x32')]:_0x586f4f[_0x47a5('0x2d')];if(_0x1c36fa[_0x47a5('0x2f')][_0x47a5('0x3c')]){_0x23bd8d[_0x47a5('0x3d')]=[{'all':!![]}];}_0x23bd8d=_[_0x47a5('0x43')]({},_0x23bd8d,_0x1c36fa[_0x47a5('0x44')]);return db[_0x47a5('0x2a')][_0x47a5('0x45')](_0x23bd8d)[_0x47a5('0x23')](handleEntityNotFound(_0x331474,null))[_0x47a5('0x23')](respondWithResult(_0x331474,null))[_0x47a5('0x46')](handleError(_0x331474,null));};exports['create']=function(_0x2d38de,_0x23bb04){return db['ChatOfflineMessage']['create'](_0x2d38de[_0x47a5('0x47')],{})['then'](respondWithResult(_0x23bb04,0xc9))[_0x47a5('0x46')](handleError(_0x23bb04,null));};exports[_0x47a5('0x22')]=function(_0x54c35f,_0x4f62d3){if(_0x54c35f[_0x47a5('0x47')]['id']){delete _0x54c35f['body']['id'];}return db[_0x47a5('0x2a')][_0x47a5('0x45')]({'where':{'id':_0x54c35f[_0x47a5('0x41')]['id']}})[_0x47a5('0x23')](handleEntityNotFound(_0x4f62d3,null))[_0x47a5('0x23')](saveUpdates(_0x54c35f[_0x47a5('0x47')],null))[_0x47a5('0x23')](respondWithResult(_0x4f62d3,null))['catch'](handleError(_0x4f62d3,null));};exports['destroy']=function(_0x2dd1db,_0x411230){return db[_0x47a5('0x48')][_0x47a5('0x3e')]({'where':{'ChatOfflineMessageId':_0x2dd1db[_0x47a5('0x41')]['id']},'raw':!![]})[_0x47a5('0x23')](function(_0x249de5){_0x249de5['forEach'](function(_0x45cca5){var _0x1c9a62=path[_0x47a5('0x49')](config['root'],_0x47a5('0x4a'),'files',_0x47a5('0x4b'),_0x47a5('0x4c'),_0x45cca5[_0x47a5('0x4d')]);var _0xf03bd5=fs['existsSync'](_0x1c9a62);if(_0xf03bd5)fs_extra[_0x47a5('0x4e')](_0x1c9a62);});})[_0x47a5('0x23')](function(){return db[_0x47a5('0x2a')][_0x47a5('0x45')]({'where':{'id':_0x2dd1db[_0x47a5('0x41')]['id']},'individualHooks':!![]});})[_0x47a5('0x23')](handleEntityNotFound(_0x411230,null))[_0x47a5('0x23')](removeEntity(_0x411230,null))['catch'](handleError(_0x411230,null));};exports[_0x47a5('0x4f')]=function(_0x43721b,_0x187d7e){return db[_0x47a5('0x2a')][_0x47a5('0x4f')]()[_0x47a5('0x23')](respondWithResult(_0x187d7e,null))['catch'](handleError(_0x187d7e,null));}; \ No newline at end of file +var _0x9957=['sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','reject','save','then','destroy','error','name','send','index','fieldName','type','key','model','map','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','ChatOfflineMessage','findAll','rows','show','rawAttributes','includeAll','include','find','create','catch','body','params','Attachment','forEach','join','root','server','files','attachments','basename','existsSync','remove','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb'];(function(_0x32612d,_0x17aa87){var _0x487e65=function(_0x5a9fad){while(--_0x5a9fad){_0x32612d['push'](_0x32612d['shift']());}};_0x487e65(++_0x17aa87);}(_0x9957,0x93));var _0x7995=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x9957[_0x5ddb1c];return _0x354adc;};'use strict';var emlformat=require(_0x7995('0x0'));var rimraf=require(_0x7995('0x1'));var zipdir=require(_0x7995('0x2'));var jsonpatch=require(_0x7995('0x3'));var rp=require('request-promise');var moment=require(_0x7995('0x4'));var BPromise=require(_0x7995('0x5'));var Mustache=require(_0x7995('0x6'));var util=require(_0x7995('0x7'));var path=require('path');var sox=require(_0x7995('0x8'));var csv=require(_0x7995('0x9'));var ejs=require(_0x7995('0xa'));var fs=require('fs');var fs_extra=require(_0x7995('0xb'));var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x7995('0x19'));var db=require(_0x7995('0x1a'))['db'];function respondWithStatusCode(_0x19a27e,_0x385f00){_0x385f00=_0x385f00||0xcc;return function(_0x281576){if(_0x281576){return _0x19a27e[_0x7995('0x1b')](_0x385f00);}return _0x19a27e[_0x7995('0x1c')](_0x385f00)['end']();};}function respondWithResult(_0x58f5ad,_0x2b4e94){_0x2b4e94=_0x2b4e94||0xc8;return function(_0x2233dd){if(_0x2233dd){return _0x58f5ad[_0x7995('0x1c')](_0x2b4e94)[_0x7995('0x1d')](_0x2233dd);}};}function respondWithFilteredResult(_0x3f1d3e,_0x1a5310){return function(_0x2202ce){if(_0x2202ce){var _0x41cbf0=typeof _0x1a5310['offset']===_0x7995('0x1e')&&typeof _0x1a5310['limit']===_0x7995('0x1e');var _0x37f297=_0x2202ce[_0x7995('0x1f')];var _0x291317=_0x41cbf0?0x0:_0x1a5310[_0x7995('0x20')];var _0x37a7d4=_0x41cbf0?_0x2202ce['count']:_0x1a5310['offset']+_0x1a5310[_0x7995('0x21')];var _0x5e6f90;if(_0x37a7d4>=_0x37f297){_0x37a7d4=_0x37f297;_0x5e6f90=0xc8;}else{_0x5e6f90=0xce;}_0x3f1d3e['status'](_0x5e6f90);return _0x3f1d3e[_0x7995('0x22')](_0x7995('0x23'),_0x291317+'-'+_0x37a7d4+'/'+_0x37f297)['json'](_0x2202ce);}return null;};}function patchUpdates(_0x3a9b54){return function(_0x51f276){try{jsonpatch['apply'](_0x51f276,_0x3a9b54,!![]);}catch(_0x3e4c54){return BPromise[_0x7995('0x24')](_0x3e4c54);}return _0x51f276[_0x7995('0x25')]();};}function saveUpdates(_0x1a8568,_0x460924){return function(_0x1c278a){if(_0x1c278a){return _0x1c278a['update'](_0x1a8568)[_0x7995('0x26')](function(_0x46ee4b){return _0x46ee4b;});}return null;};}function removeEntity(_0x204507,_0x285437){return function(_0x563799){if(_0x563799){return _0x563799[_0x7995('0x27')]()[_0x7995('0x26')](function(){_0x204507[_0x7995('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39df42,_0x34e70c){return function(_0x401dc3){if(!_0x401dc3){_0x39df42[_0x7995('0x1b')](0x194);}return _0x401dc3;};}function handleError(_0x3a3fcf,_0x2a307e){_0x2a307e=_0x2a307e||0x1f4;return function(_0x56691a){logger[_0x7995('0x28')](_0x56691a['stack']);if(_0x56691a[_0x7995('0x29')]){delete _0x56691a[_0x7995('0x29')];}_0x3a3fcf[_0x7995('0x1c')](_0x2a307e)[_0x7995('0x2a')](_0x56691a);};}exports[_0x7995('0x2b')]=function(_0x4b6f99,_0x9b2a15){var _0x514445={},_0x456a28={},_0x3250e0={'count':0x0,'rows':[]};var _0x4253e5=_['map'](db['ChatOfflineMessage']['rawAttributes'],function(_0x3573be){return{'name':_0x3573be[_0x7995('0x2c')],'type':_0x3573be[_0x7995('0x2d')][_0x7995('0x2e')]};});_0x456a28[_0x7995('0x2f')]=_[_0x7995('0x30')](_0x4253e5,'name');_0x456a28['query']=_[_0x7995('0x31')](_0x4b6f99['query']);_0x456a28[_0x7995('0x32')]=_[_0x7995('0x33')](_0x456a28[_0x7995('0x2f')],_0x456a28[_0x7995('0x34')]);_0x514445[_0x7995('0x35')]=_['intersection'](_0x456a28[_0x7995('0x2f')],qs[_0x7995('0x36')](_0x4b6f99['query']['fields']));_0x514445['attributes']=_0x514445[_0x7995('0x35')][_0x7995('0x37')]?_0x514445['attributes']:_0x456a28[_0x7995('0x2f')];if(!_0x4b6f99['query'][_0x7995('0x38')](_0x7995('0x39'))){_0x514445[_0x7995('0x21')]=qs['limit'](_0x4b6f99['query'][_0x7995('0x21')]);_0x514445['offset']=qs['offset'](_0x4b6f99[_0x7995('0x34')][_0x7995('0x20')]);}_0x514445['order']=qs[_0x7995('0x3a')](_0x4b6f99[_0x7995('0x34')][_0x7995('0x3a')]);_0x514445[_0x7995('0x3b')]=qs[_0x7995('0x32')](_['pick'](_0x4b6f99[_0x7995('0x34')],_0x456a28[_0x7995('0x32')]),_0x4253e5);if(_0x4b6f99[_0x7995('0x34')][_0x7995('0x3c')]){_0x514445['where']=_[_0x7995('0x3d')](_0x514445[_0x7995('0x3b')],{'$or':_[_0x7995('0x30')](_0x4253e5,function(_0xe5ea43){if(_0xe5ea43[_0x7995('0x2d')]!==_0x7995('0x3e')){var _0x5688a1={};_0x5688a1[_0xe5ea43[_0x7995('0x29')]]={'$like':'%'+_0x4b6f99[_0x7995('0x34')][_0x7995('0x3c')]+'%'};return _0x5688a1;}})});}_0x514445=_[_0x7995('0x3d')]({},_0x514445,_0x4b6f99[_0x7995('0x3f')]);var _0x298fc2={'where':_0x514445[_0x7995('0x3b')]};return db[_0x7995('0x40')][_0x7995('0x1f')](_0x298fc2)[_0x7995('0x26')](function(_0x6fe77b){_0x3250e0[_0x7995('0x1f')]=_0x6fe77b;if(_0x4b6f99[_0x7995('0x34')]['includeAll']){_0x514445['include']=[{'all':!![]}];}return db[_0x7995('0x40')][_0x7995('0x41')](_0x514445);})['then'](function(_0x4b0855){_0x3250e0[_0x7995('0x42')]=_0x4b0855;return _0x3250e0;})['then'](respondWithFilteredResult(_0x9b2a15,_0x514445))['catch'](handleError(_0x9b2a15,null));};exports[_0x7995('0x43')]=function(_0x36e28b,_0x35c8ff){var _0x576b96={'raw':!![],'where':{'id':_0x36e28b['params']['id']}},_0x46ac4f={};_0x46ac4f[_0x7995('0x2f')]=_['keys'](db['ChatOfflineMessage'][_0x7995('0x44')]);_0x46ac4f[_0x7995('0x34')]=_[_0x7995('0x31')](_0x36e28b[_0x7995('0x34')]);_0x46ac4f['filters']=_[_0x7995('0x33')](_0x46ac4f[_0x7995('0x2f')],_0x46ac4f[_0x7995('0x34')]);_0x576b96[_0x7995('0x35')]=_['intersection'](_0x46ac4f['model'],qs[_0x7995('0x36')](_0x36e28b['query'][_0x7995('0x36')]));_0x576b96['attributes']=_0x576b96[_0x7995('0x35')]['length']?_0x576b96[_0x7995('0x35')]:_0x46ac4f[_0x7995('0x2f')];if(_0x36e28b['query'][_0x7995('0x45')]){_0x576b96[_0x7995('0x46')]=[{'all':!![]}];}_0x576b96=_[_0x7995('0x3d')]({},_0x576b96,_0x36e28b[_0x7995('0x3f')]);return db['ChatOfflineMessage'][_0x7995('0x47')](_0x576b96)[_0x7995('0x26')](handleEntityNotFound(_0x35c8ff,null))[_0x7995('0x26')](respondWithResult(_0x35c8ff,null))['catch'](handleError(_0x35c8ff,null));};exports[_0x7995('0x48')]=function(_0x44f516,_0x511567){return db[_0x7995('0x40')][_0x7995('0x48')](_0x44f516['body'],{})[_0x7995('0x26')](respondWithResult(_0x511567,0xc9))[_0x7995('0x49')](handleError(_0x511567,null));};exports['update']=function(_0x3d1dbb,_0x5843ba){if(_0x3d1dbb[_0x7995('0x4a')]['id']){delete _0x3d1dbb[_0x7995('0x4a')]['id'];}return db[_0x7995('0x40')][_0x7995('0x47')]({'where':{'id':_0x3d1dbb[_0x7995('0x4b')]['id']}})[_0x7995('0x26')](handleEntityNotFound(_0x5843ba,null))[_0x7995('0x26')](saveUpdates(_0x3d1dbb['body'],null))[_0x7995('0x26')](respondWithResult(_0x5843ba,null))[_0x7995('0x49')](handleError(_0x5843ba,null));};exports[_0x7995('0x27')]=function(_0x4ffc8a,_0x19da63){return db[_0x7995('0x4c')][_0x7995('0x41')]({'where':{'ChatOfflineMessageId':_0x4ffc8a['params']['id']},'raw':!![]})['then'](function(_0x5a592e){_0x5a592e[_0x7995('0x4d')](function(_0x1fd1ca){var _0x4cf5db=path[_0x7995('0x4e')](config[_0x7995('0x4f')],_0x7995('0x50'),_0x7995('0x51'),_0x7995('0x52'),'offline-chat',_0x1fd1ca[_0x7995('0x53')]);var _0x4ab09f=fs[_0x7995('0x54')](_0x4cf5db);if(_0x4ab09f)fs_extra[_0x7995('0x55')](_0x4cf5db);});})[_0x7995('0x26')](function(){return db['ChatOfflineMessage']['find']({'where':{'id':_0x4ffc8a['params']['id']},'individualHooks':!![]});})['then'](handleEntityNotFound(_0x19da63,null))[_0x7995('0x26')](removeEntity(_0x19da63,null))[_0x7995('0x49')](handleError(_0x19da63,null));};exports[_0x7995('0x56')]=function(_0x150261,_0x1d957e){return db[_0x7995('0x40')][_0x7995('0x56')]()[_0x7995('0x26')](respondWithResult(_0x1d957e,null))[_0x7995('0x49')](handleError(_0x1d957e,null));}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.events.js b/server/api/chatOfflineMessage/chatOfflineMessage.events.js index 1dd050b..e859fb5 100644 --- a/server/api/chatOfflineMessage/chatOfflineMessage.events.js +++ b/server/api/chatOfflineMessage/chatOfflineMessage.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1bc3=['exports','events','../../mysqldb','setMaxListeners','remove','emit','hook'];(function(_0x34e030,_0x57c46d){var _0x1a6406=function(_0x74f5ca){while(--_0x74f5ca){_0x34e030['push'](_0x34e030['shift']());}};_0x1a6406(++_0x57c46d);}(_0x1bc3,0x8d));var _0x31bc=function(_0xbb80d,_0xb8a3bc){_0xbb80d=_0xbb80d-0x0;var _0x2cb1ca=_0x1bc3[_0xbb80d];return _0x2cb1ca;};'use strict';var EventEmitter=require(_0x31bc('0x0'));var ChatOfflineMessage=require(_0x31bc('0x1'))['db']['ChatOfflineMessage'];var ChatOfflineMessageEvents=new EventEmitter();ChatOfflineMessageEvents[_0x31bc('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x31bc('0x3')};function emitEvent(_0x9c2632){return function(_0x2978d1,_0x2816d9,_0xa891f4){ChatOfflineMessageEvents[_0x31bc('0x4')](_0x9c2632+':'+_0x2978d1['id'],_0x2978d1);ChatOfflineMessageEvents[_0x31bc('0x4')](_0x9c2632,_0x2978d1);_0xa891f4(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatOfflineMessage[_0x31bc('0x5')](e,emitEvent(event));}}module[_0x31bc('0x6')]=ChatOfflineMessageEvents; \ No newline at end of file +var _0x099f=['exports','events','../../mysqldb','ChatOfflineMessage','setMaxListeners','update','remove','emit','hasOwnProperty'];(function(_0x2610ff,_0x54f0b7){var _0x1c88c3=function(_0x354890){while(--_0x354890){_0x2610ff['push'](_0x2610ff['shift']());}};_0x1c88c3(++_0x54f0b7);}(_0x099f,0x133));var _0xf099=function(_0x1dfb1e,_0x888459){_0x1dfb1e=_0x1dfb1e-0x0;var _0x1d45d0=_0x099f[_0x1dfb1e];return _0x1d45d0;};'use strict';var EventEmitter=require(_0xf099('0x0'));var ChatOfflineMessage=require(_0xf099('0x1'))['db'][_0xf099('0x2')];var ChatOfflineMessageEvents=new EventEmitter();ChatOfflineMessageEvents[_0xf099('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xf099('0x4'),'afterDestroy':_0xf099('0x5')};function emitEvent(_0x8c3488){return function(_0x24270f,_0x3f46c0,_0x35a43a){ChatOfflineMessageEvents[_0xf099('0x6')](_0x8c3488+':'+_0x24270f['id'],_0x24270f);ChatOfflineMessageEvents['emit'](_0x8c3488,_0x24270f);_0x35a43a(null);};}for(var e in events){if(events[_0xf099('0x7')](e)){var event=events[e];ChatOfflineMessage['hook'](e,emitEvent(event));}}module[_0xf099('0x8')]=ChatOfflineMessageEvents; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.model.js b/server/api/chatOfflineMessage/chatOfflineMessage.model.js index 7f39fb7..8c731d3 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 _0xf7ce=['utf8mb4','utf8mb4_unicode_ci','./chatOfflineMessage.attributes','define','ChatOfflineMessage'];(function(_0x31a3b8,_0x43baac){var _0x4a2136=function(_0x78118d){while(--_0x78118d){_0x31a3b8['push'](_0x31a3b8['shift']());}};_0x4a2136(++_0x43baac);}(_0xf7ce,0xa7));var _0xef7c=function(_0x450f20,_0x159bb3){_0x450f20=_0x450f20-0x0;var _0x15bd66=_0xf7ce[_0x450f20];return _0x15bd66;};'use strict';var attributes=require(_0xef7c('0x0'));module['exports']=function(_0x555357){return _0x555357[_0xef7c('0x1')](_0xef7c('0x2'),attributes,{'tableName':'chat_offline_messages','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xef7c('0x3'),'collate':_0xef7c('0x4')});}; \ No newline at end of file +var _0xe667=['utf8mb4','utf8mb4_unicode_ci','./chatOfflineMessage.attributes','exports','define','chat_offline_messages'];(function(_0x2c97be,_0x36e2ab){var _0x305a3f=function(_0x3f40b2){while(--_0x3f40b2){_0x2c97be['push'](_0x2c97be['shift']());}};_0x305a3f(++_0x36e2ab);}(_0xe667,0xb0));var _0x7e66=function(_0x3976c2,_0x60dd0f){_0x3976c2=_0x3976c2-0x0;var _0x1d3076=_0xe667[_0x3976c2];return _0x1d3076;};'use strict';var attributes=require(_0x7e66('0x0'));module[_0x7e66('0x1')]=function(_0x54ee81){return _0x54ee81[_0x7e66('0x2')]('ChatOfflineMessage',attributes,{'tableName':_0x7e66('0x3'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x7e66('0x4'),'collate':_0x7e66('0x5')});}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js b/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js index b59cd39..7896332 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 _0x6f0d=['message','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','http','request','then','info','ChatOfflineMessage,\x20%s,\x20%s','request\x20sent','debug','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','error','code'];(function(_0x477ea6,_0x57d82f){var _0x2c8441=function(_0x6c7ac6){while(--_0x6c7ac6){_0x477ea6['push'](_0x477ea6['shift']());}};_0x2c8441(++_0x57d82f);}(_0x6f0d,0x1e5));var _0xd6f0=function(_0x25f195,_0x12a8a9){_0x25f195=_0x25f195-0x0;var _0x15b90f=_0x6f0d[_0x25f195];return _0x15b90f;};'use strict';var _=require(_0xd6f0('0x0'));var util=require('util');var moment=require(_0xd6f0('0x1'));var BPromise=require(_0xd6f0('0x2'));var rs=require(_0xd6f0('0x3'));var fs=require('fs');var Redis=require(_0xd6f0('0x4'));var db=require(_0xd6f0('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xd6f0('0x6'))(_0xd6f0('0x7'));var config=require(_0xd6f0('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0xd6f0('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1cf8b2,_0x2ba1b2,_0x289bc6){return new BPromise(function(_0x272022,_0x16f3c4){return client[_0xd6f0('0xa')](_0x1cf8b2,_0x289bc6)[_0xd6f0('0xb')](function(_0x4b8c2b){logger[_0xd6f0('0xc')](_0xd6f0('0xd'),_0x2ba1b2,_0xd6f0('0xe'));logger[_0xd6f0('0xf')](_0xd6f0('0x10'),_0x2ba1b2,'request\x20sent',JSON['stringify'](_0x4b8c2b));if(_0x4b8c2b[_0xd6f0('0x11')]){if(_0x4b8c2b['error'][_0xd6f0('0x12')]===0x1f4){logger[_0xd6f0('0x11')](_0xd6f0('0xd'),_0x2ba1b2,_0x4b8c2b[_0xd6f0('0x11')][_0xd6f0('0x13')]);return _0x16f3c4(_0x4b8c2b[_0xd6f0('0x11')][_0xd6f0('0x13')]);}logger[_0xd6f0('0x11')]('ChatOfflineMessage,\x20%s,\x20%s',_0x2ba1b2,_0x4b8c2b[_0xd6f0('0x11')][_0xd6f0('0x13')]);return _0x272022(_0x4b8c2b['error'][_0xd6f0('0x13')]);}else{logger['info'](_0xd6f0('0xd'),_0x2ba1b2,_0xd6f0('0xe'));_0x272022(_0x4b8c2b['result'][_0xd6f0('0x13')]);}})[_0xd6f0('0x14')](function(_0x4b17c2){logger[_0xd6f0('0x11')](_0xd6f0('0xd'),_0x2ba1b2,_0x4b17c2);_0x16f3c4(_0x4b17c2);});});} \ No newline at end of file +var _0x0b1a=['code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then','info','ChatOfflineMessage,\x20%s,\x20%s','request\x20sent','debug','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','error'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x0b1a,0x10c));var _0xa0b1=function(_0x5914a0,_0x4c5621){_0x5914a0=_0x5914a0-0x0;var _0x487478=_0x0b1a[_0x5914a0];return _0x487478;};'use strict';var _=require(_0xa0b1('0x0'));var util=require(_0xa0b1('0x1'));var moment=require(_0xa0b1('0x2'));var BPromise=require(_0xa0b1('0x3'));var rs=require(_0xa0b1('0x4'));var fs=require('fs');var Redis=require(_0xa0b1('0x5'));var db=require(_0xa0b1('0x6'))['db'];var utils=require(_0xa0b1('0x7'));var logger=require(_0xa0b1('0x8'))(_0xa0b1('0x9'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xa0b1('0xa')][_0xa0b1('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2e6d17,_0x692771,_0x96fa55){return new BPromise(function(_0x5d94ca,_0x56a728){return client[_0xa0b1('0xc')](_0x2e6d17,_0x96fa55)[_0xa0b1('0xd')](function(_0x50c1c0){logger[_0xa0b1('0xe')](_0xa0b1('0xf'),_0x692771,_0xa0b1('0x10'));logger[_0xa0b1('0x11')](_0xa0b1('0x12'),_0x692771,'request\x20sent',JSON['stringify'](_0x50c1c0));if(_0x50c1c0[_0xa0b1('0x13')]){if(_0x50c1c0[_0xa0b1('0x13')][_0xa0b1('0x14')]===0x1f4){logger[_0xa0b1('0x13')](_0xa0b1('0xf'),_0x692771,_0x50c1c0[_0xa0b1('0x13')][_0xa0b1('0x15')]);return _0x56a728(_0x50c1c0['error'][_0xa0b1('0x15')]);}logger[_0xa0b1('0x13')]('ChatOfflineMessage,\x20%s,\x20%s',_0x692771,_0x50c1c0[_0xa0b1('0x13')]['message']);return _0x5d94ca(_0x50c1c0[_0xa0b1('0x13')][_0xa0b1('0x15')]);}else{logger['info'](_0xa0b1('0xf'),_0x692771,'request\x20sent');_0x5d94ca(_0x50c1c0[_0xa0b1('0x16')][_0xa0b1('0x15')]);}})[_0xa0b1('0x17')](function(_0x3b1918){logger[_0xa0b1('0x13')](_0xa0b1('0xf'),_0x692771,_0x3b1918);_0x56a728(_0x3b1918);});});} \ No newline at end of file diff --git a/server/api/chatOfflineMessage/index.js b/server/api/chatOfflineMessage/index.js index c597ede..1183c25 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 _0x21ec=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./chatOfflineMessage.controller','isAuthenticated','index','get','describe','/:id','show','put','delete','destroy','exports','multer','path'];(function(_0x43cfe0,_0x39822f){var _0x50d951=function(_0x134d52){while(--_0x134d52){_0x43cfe0['push'](_0x43cfe0['shift']());}};_0x50d951(++_0x39822f);}(_0x21ec,0x167));var _0xc21e=function(_0x39d544,_0x35c14f){_0x39d544=_0x39d544-0x0;var _0x5a5ff2=_0x21ec[_0x39d544];return _0x5a5ff2;};'use strict';var multer=require(_0xc21e('0x0'));var util=require('util');var path=require(_0xc21e('0x1'));var timeout=require(_0xc21e('0x2'));var express=require(_0xc21e('0x3'));var router=express[_0xc21e('0x4')]();var fs_extra=require(_0xc21e('0x5'));var auth=require(_0xc21e('0x6'));var interaction=require(_0xc21e('0x7'));var config=require('../../config/environment');var controller=require(_0xc21e('0x8'));router['get']('/',auth[_0xc21e('0x9')](),controller[_0xc21e('0xa')]);router[_0xc21e('0xb')]('/describe',auth['isAuthenticated'](),controller[_0xc21e('0xc')]);router[_0xc21e('0xb')](_0xc21e('0xd'),auth['isAuthenticated'](),controller[_0xc21e('0xe')]);router['post']('/',auth[_0xc21e('0x9')](),controller['create']);router[_0xc21e('0xf')](_0xc21e('0xd'),auth[_0xc21e('0x9')](),controller['update']);router[_0xc21e('0x10')]('/:id',auth[_0xc21e('0x9')](),controller[_0xc21e('0x11')]);module[_0xc21e('0x12')]=router; \ No newline at end of file +var _0xbee3=['fs-extra','../../components/auth/service','../../config/environment','./chatOfflineMessage.controller','get','isAuthenticated','/describe','/:id','show','post','create','put','update','delete','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x440fde,_0x445ce0){var _0x11052c=function(_0x49f547){while(--_0x49f547){_0x440fde['push'](_0x440fde['shift']());}};_0x11052c(++_0x445ce0);}(_0xbee3,0x135));var _0x3bee=function(_0x541cc4,_0x4e0979){_0x541cc4=_0x541cc4-0x0;var _0x94514c=_0xbee3[_0x541cc4];return _0x94514c;};'use strict';var multer=require(_0x3bee('0x0'));var util=require(_0x3bee('0x1'));var path=require(_0x3bee('0x2'));var timeout=require(_0x3bee('0x3'));var express=require(_0x3bee('0x4'));var router=express[_0x3bee('0x5')]();var fs_extra=require(_0x3bee('0x6'));var auth=require(_0x3bee('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x3bee('0x8'));var controller=require(_0x3bee('0x9'));router[_0x3bee('0xa')]('/',auth[_0x3bee('0xb')](),controller['index']);router['get'](_0x3bee('0xc'),auth[_0x3bee('0xb')](),controller['describe']);router[_0x3bee('0xa')](_0x3bee('0xd'),auth[_0x3bee('0xb')](),controller[_0x3bee('0xe')]);router[_0x3bee('0xf')]('/',auth[_0x3bee('0xb')](),controller[_0x3bee('0x10')]);router[_0x3bee('0x11')](_0x3bee('0xd'),auth[_0x3bee('0xb')](),controller[_0x3bee('0x12')]);router[_0x3bee('0x13')](_0x3bee('0xd'),auth['isAuthenticated'](),controller['destroy']);module[_0x3bee('0x14')]=router; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.attributes.js b/server/api/chatProactiveAction/chatProactiveAction.attributes.js index 27b7ed3..d91dc1a 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 _0x2c99=['ENUM','mouseOver','exports','STRING'];(function(_0x59fbee,_0x12fd1e){var _0x205a62=function(_0x6c7309){while(--_0x6c7309){_0x59fbee['push'](_0x59fbee['shift']());}};_0x205a62(++_0x12fd1e);}(_0x2c99,0x166));var _0x92c9=function(_0xaa1b3e,_0x47d976){_0xaa1b3e=_0xaa1b3e-0x0;var _0x454d7d=_0x2c99[_0xaa1b3e];return _0x454d7d;};'use strict';var Sequelize=require('sequelize');module[_0x92c9('0x0')]={'name':{'type':Sequelize[_0x92c9('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x92c9('0x2')](_0x92c9('0x3'),'timeout'),'defaultValue':_0x92c9('0x3')},'selector':{'type':Sequelize[_0x92c9('0x1')]},'timeout':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x5bf3=['mouseOver','timeout','STRING','INTEGER','sequelize','exports'];(function(_0x554092,_0x211b5f){var _0x33d000=function(_0x43b7a6){while(--_0x43b7a6){_0x554092['push'](_0x554092['shift']());}};_0x33d000(++_0x211b5f);}(_0x5bf3,0xd0));var _0x35bf=function(_0x18df06,_0x26d5cb){_0x18df06=_0x18df06-0x0;var _0x15553a=_0x5bf3[_0x18df06];return _0x15553a;};'use strict';var Sequelize=require(_0x35bf('0x0'));module[_0x35bf('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x35bf('0x2'),_0x35bf('0x3')),'defaultValue':_0x35bf('0x2')},'selector':{'type':Sequelize[_0x35bf('0x4')]},'timeout':{'type':Sequelize[_0x35bf('0x5')]}}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.controller.js b/server/api/chatProactiveAction/chatProactiveAction.controller.js index a263749..7d1a0c5 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 _0x7a59=['fields','length','includeAll','include','merge','options','ChatProactiveAction','find','catch','create','body','update','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','undefined','offset','count','limit','Content-Range','apply','reject','then','destroy','end','error','stack','name','send','params','keys','rawAttributes','query','model','attributes'];(function(_0x5d80de,_0x2cf15d){var _0x1c7556=function(_0x5bd806){while(--_0x5bd806){_0x5d80de['push'](_0x5d80de['shift']());}};_0x1c7556(++_0x2cf15d);}(_0x7a59,0x16e));var _0x97a5=function(_0x26f702,_0x3919bf){_0x26f702=_0x26f702-0x0;var _0x11417d=_0x7a59[_0x26f702];return _0x11417d;};'use strict';var emlformat=require(_0x97a5('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x97a5('0x1'));var rp=require(_0x97a5('0x2'));var moment=require(_0x97a5('0x3'));var BPromise=require(_0x97a5('0x4'));var Mustache=require(_0x97a5('0x5'));var util=require('util');var path=require(_0x97a5('0x6'));var sox=require(_0x97a5('0x7'));var csv=require(_0x97a5('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x97a5('0x9'));var _=require(_0x97a5('0xa'));var squel=require(_0x97a5('0xb'));var crypto=require(_0x97a5('0xc'));var jsforce=require(_0x97a5('0xd'));var deskjs=require(_0x97a5('0xe'));var toCsv=require(_0x97a5('0x8'));var querystring=require('querystring');var Papa=require(_0x97a5('0xf'));var Redis=require(_0x97a5('0x10'));var authService=require(_0x97a5('0x11'));var qs=require(_0x97a5('0x12'));var as=require(_0x97a5('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x97a5('0x14'));var utils=require(_0x97a5('0x15'));var config=require(_0x97a5('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x97a5('0x17'))['db'];function respondWithStatusCode(_0x350720,_0x55305a){_0x55305a=_0x55305a||0xcc;return function(_0x4f85a0){if(_0x4f85a0){return _0x350720[_0x97a5('0x18')](_0x55305a);}return _0x350720[_0x97a5('0x19')](_0x55305a)['end']();};}function respondWithResult(_0x595437,_0x51d5e2){_0x51d5e2=_0x51d5e2||0xc8;return function(_0x5a4471){if(_0x5a4471){return _0x595437[_0x97a5('0x19')](_0x51d5e2)[_0x97a5('0x1a')](_0x5a4471);}};}function respondWithFilteredResult(_0x3603e4,_0x4d8ba7){return function(_0x1a7a62){if(_0x1a7a62){var _0x3fa986=typeof _0x4d8ba7['offset']===_0x97a5('0x1b')&&typeof _0x4d8ba7['limit']===_0x97a5('0x1b');var _0x55071b=_0x1a7a62['count'];var _0x52ce92=_0x3fa986?0x0:_0x4d8ba7[_0x97a5('0x1c')];var _0x5c5740=_0x3fa986?_0x1a7a62[_0x97a5('0x1d')]:_0x4d8ba7[_0x97a5('0x1c')]+_0x4d8ba7[_0x97a5('0x1e')];var _0x1efe8c;if(_0x5c5740>=_0x55071b){_0x5c5740=_0x55071b;_0x1efe8c=0xc8;}else{_0x1efe8c=0xce;}_0x3603e4['status'](_0x1efe8c);return _0x3603e4['set'](_0x97a5('0x1f'),_0x52ce92+'-'+_0x5c5740+'/'+_0x55071b)[_0x97a5('0x1a')](_0x1a7a62);}return null;};}function patchUpdates(_0x4e3386){return function(_0x51858b){try{jsonpatch[_0x97a5('0x20')](_0x51858b,_0x4e3386,!![]);}catch(_0x3d7dba){return BPromise[_0x97a5('0x21')](_0x3d7dba);}return _0x51858b['save']();};}function saveUpdates(_0x34fb55,_0x3a5849){return function(_0x23f4f8){if(_0x23f4f8){return _0x23f4f8['update'](_0x34fb55)[_0x97a5('0x22')](function(_0x33d6da){return _0x33d6da;});}return null;};}function removeEntity(_0x4e2074,_0x5e731e){return function(_0x469592){if(_0x469592){return _0x469592[_0x97a5('0x23')]()[_0x97a5('0x22')](function(){_0x4e2074[_0x97a5('0x19')](0xcc)[_0x97a5('0x24')]();});}};}function handleEntityNotFound(_0x302d78,_0xf7ad1e){return function(_0x4743e0){if(!_0x4743e0){_0x302d78['sendStatus'](0x194);}return _0x4743e0;};}function handleError(_0x2038dd,_0x46ee45){_0x46ee45=_0x46ee45||0x1f4;return function(_0x2ca97c){logger[_0x97a5('0x25')](_0x2ca97c[_0x97a5('0x26')]);if(_0x2ca97c[_0x97a5('0x27')]){delete _0x2ca97c['name'];}_0x2038dd[_0x97a5('0x19')](_0x46ee45)[_0x97a5('0x28')](_0x2ca97c);};}exports['show']=function(_0x274ccb,_0x52248f){var _0x48f1c1={'raw':!![],'where':{'id':_0x274ccb[_0x97a5('0x29')]['id']}},_0x1bdb74={};_0x1bdb74['model']=_[_0x97a5('0x2a')](db['ChatProactiveAction'][_0x97a5('0x2b')]);_0x1bdb74[_0x97a5('0x2c')]=_[_0x97a5('0x2a')](_0x274ccb[_0x97a5('0x2c')]);_0x1bdb74['filters']=_['intersection'](_0x1bdb74[_0x97a5('0x2d')],_0x1bdb74[_0x97a5('0x2c')]);_0x48f1c1[_0x97a5('0x2e')]=_['intersection'](_0x1bdb74[_0x97a5('0x2d')],qs[_0x97a5('0x2f')](_0x274ccb['query'][_0x97a5('0x2f')]));_0x48f1c1[_0x97a5('0x2e')]=_0x48f1c1['attributes'][_0x97a5('0x30')]?_0x48f1c1[_0x97a5('0x2e')]:_0x1bdb74[_0x97a5('0x2d')];if(_0x274ccb['query'][_0x97a5('0x31')]){_0x48f1c1[_0x97a5('0x32')]=[{'all':!![]}];}_0x48f1c1=_[_0x97a5('0x33')]({},_0x48f1c1,_0x274ccb[_0x97a5('0x34')]);return db[_0x97a5('0x35')][_0x97a5('0x36')](_0x48f1c1)[_0x97a5('0x22')](handleEntityNotFound(_0x52248f,null))['then'](respondWithResult(_0x52248f,null))[_0x97a5('0x37')](handleError(_0x52248f,null));};exports[_0x97a5('0x38')]=function(_0xcb2c5b,_0x393994){return db[_0x97a5('0x35')][_0x97a5('0x38')](_0xcb2c5b[_0x97a5('0x39')],{})[_0x97a5('0x22')](respondWithResult(_0x393994,0xc9))[_0x97a5('0x37')](handleError(_0x393994,null));};exports[_0x97a5('0x3a')]=function(_0x1c007d,_0x1d5c4a){if(_0x1c007d[_0x97a5('0x39')]['id']){delete _0x1c007d['body']['id'];}return db[_0x97a5('0x35')][_0x97a5('0x36')]({'where':{'id':_0x1c007d[_0x97a5('0x29')]['id']}})[_0x97a5('0x22')](handleEntityNotFound(_0x1d5c4a,null))[_0x97a5('0x22')](saveUpdates(_0x1c007d['body'],null))['then'](respondWithResult(_0x1d5c4a,null))[_0x97a5('0x37')](handleError(_0x1d5c4a,null));};exports[_0x97a5('0x23')]=function(_0x52d774,_0x45a548){return db[_0x97a5('0x35')][_0x97a5('0x36')]({'where':{'id':_0x52d774['params']['id']}})[_0x97a5('0x22')](handleEntityNotFound(_0x45a548,null))['then'](removeEntity(_0x45a548,null))[_0x97a5('0x37')](handleError(_0x45a548,null));}; \ No newline at end of file +var _0x3ca4=['count','status','Content-Range','apply','reject','save','then','destroy','error','send','show','params','keys','query','filters','intersection','fields','attributes','length','model','includeAll','merge','ChatProactiveAction','find','create','body','catch','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','undefined','limit'];(function(_0x18a8c5,_0x547d26){var _0x2d8579=function(_0x480b7f){while(--_0x480b7f){_0x18a8c5['push'](_0x18a8c5['shift']());}};_0x2d8579(++_0x547d26);}(_0x3ca4,0x17d));var _0x43ca=function(_0x44ace3,_0x52cbcc){_0x44ace3=_0x44ace3-0x0;var _0x1334a2=_0x3ca4[_0x44ace3];return _0x1334a2;};'use strict';var emlformat=require(_0x43ca('0x0'));var rimraf=require(_0x43ca('0x1'));var zipdir=require(_0x43ca('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x43ca('0x3'));var BPromise=require(_0x43ca('0x4'));var Mustache=require(_0x43ca('0x5'));var util=require(_0x43ca('0x6'));var path=require(_0x43ca('0x7'));var sox=require(_0x43ca('0x8'));var csv=require(_0x43ca('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x43ca('0xa'));var _=require(_0x43ca('0xb'));var squel=require(_0x43ca('0xc'));var crypto=require(_0x43ca('0xd'));var jsforce=require(_0x43ca('0xe'));var deskjs=require(_0x43ca('0xf'));var toCsv=require(_0x43ca('0x9'));var querystring=require(_0x43ca('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x43ca('0x11'));var qs=require(_0x43ca('0x12'));var as=require(_0x43ca('0x13'));var hardwareService=require(_0x43ca('0x14'));var logger=require('../../config/logger')(_0x43ca('0x15'));var utils=require(_0x43ca('0x16'));var config=require(_0x43ca('0x17'));var licenseUtil=require(_0x43ca('0x18'));var db=require(_0x43ca('0x19'))['db'];function respondWithStatusCode(_0x246ead,_0x30184f){_0x30184f=_0x30184f||0xcc;return function(_0x2ede07){if(_0x2ede07){return _0x246ead[_0x43ca('0x1a')](_0x30184f);}return _0x246ead['status'](_0x30184f)[_0x43ca('0x1b')]();};}function respondWithResult(_0x13cf26,_0x4b710d){_0x4b710d=_0x4b710d||0xc8;return function(_0x309176){if(_0x309176){return _0x13cf26['status'](_0x4b710d)[_0x43ca('0x1c')](_0x309176);}};}function respondWithFilteredResult(_0x567579,_0xdccc62){return function(_0x1a8bf6){if(_0x1a8bf6){var _0x51a517=typeof _0xdccc62[_0x43ca('0x1d')]===_0x43ca('0x1e')&&typeof _0xdccc62[_0x43ca('0x1f')]==='undefined';var _0x4fb5e4=_0x1a8bf6['count'];var _0x5e50c9=_0x51a517?0x0:_0xdccc62[_0x43ca('0x1d')];var _0x268817=_0x51a517?_0x1a8bf6[_0x43ca('0x20')]:_0xdccc62['offset']+_0xdccc62[_0x43ca('0x1f')];var _0x806f68;if(_0x268817>=_0x4fb5e4){_0x268817=_0x4fb5e4;_0x806f68=0xc8;}else{_0x806f68=0xce;}_0x567579[_0x43ca('0x21')](_0x806f68);return _0x567579['set'](_0x43ca('0x22'),_0x5e50c9+'-'+_0x268817+'/'+_0x4fb5e4)['json'](_0x1a8bf6);}return null;};}function patchUpdates(_0x106d07){return function(_0x9bc5dc){try{jsonpatch[_0x43ca('0x23')](_0x9bc5dc,_0x106d07,!![]);}catch(_0x5ae497){return BPromise[_0x43ca('0x24')](_0x5ae497);}return _0x9bc5dc[_0x43ca('0x25')]();};}function saveUpdates(_0x2af64f,_0x2ad8fa){return function(_0x35d34c){if(_0x35d34c){return _0x35d34c['update'](_0x2af64f)[_0x43ca('0x26')](function(_0x34767e){return _0x34767e;});}return null;};}function removeEntity(_0x557b96,_0x379902){return function(_0x22d6ac){if(_0x22d6ac){return _0x22d6ac[_0x43ca('0x27')]()[_0x43ca('0x26')](function(){_0x557b96[_0x43ca('0x21')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2da1ec,_0xc07cde){return function(_0x29f2ee){if(!_0x29f2ee){_0x2da1ec[_0x43ca('0x1a')](0x194);}return _0x29f2ee;};}function handleError(_0x14287e,_0x1de54b){_0x1de54b=_0x1de54b||0x1f4;return function(_0x3b2078){logger[_0x43ca('0x28')](_0x3b2078['stack']);if(_0x3b2078['name']){delete _0x3b2078['name'];}_0x14287e[_0x43ca('0x21')](_0x1de54b)[_0x43ca('0x29')](_0x3b2078);};}exports[_0x43ca('0x2a')]=function(_0x9d09b9,_0x34dc4f){var _0x36884b={'raw':!![],'where':{'id':_0x9d09b9[_0x43ca('0x2b')]['id']}},_0xffad2d={};_0xffad2d['model']=_[_0x43ca('0x2c')](db['ChatProactiveAction']['rawAttributes']);_0xffad2d[_0x43ca('0x2d')]=_[_0x43ca('0x2c')](_0x9d09b9[_0x43ca('0x2d')]);_0xffad2d[_0x43ca('0x2e')]=_[_0x43ca('0x2f')](_0xffad2d['model'],_0xffad2d[_0x43ca('0x2d')]);_0x36884b['attributes']=_[_0x43ca('0x2f')](_0xffad2d['model'],qs[_0x43ca('0x30')](_0x9d09b9[_0x43ca('0x2d')]['fields']));_0x36884b[_0x43ca('0x31')]=_0x36884b[_0x43ca('0x31')][_0x43ca('0x32')]?_0x36884b[_0x43ca('0x31')]:_0xffad2d[_0x43ca('0x33')];if(_0x9d09b9[_0x43ca('0x2d')][_0x43ca('0x34')]){_0x36884b['include']=[{'all':!![]}];}_0x36884b=_[_0x43ca('0x35')]({},_0x36884b,_0x9d09b9['options']);return db[_0x43ca('0x36')][_0x43ca('0x37')](_0x36884b)['then'](handleEntityNotFound(_0x34dc4f,null))[_0x43ca('0x26')](respondWithResult(_0x34dc4f,null))['catch'](handleError(_0x34dc4f,null));};exports['create']=function(_0x10f75c,_0x2f69ba){return db[_0x43ca('0x36')][_0x43ca('0x38')](_0x10f75c[_0x43ca('0x39')],{})[_0x43ca('0x26')](respondWithResult(_0x2f69ba,0xc9))[_0x43ca('0x3a')](handleError(_0x2f69ba,null));};exports['update']=function(_0x43b29b,_0x67b8b0){if(_0x43b29b['body']['id']){delete _0x43b29b[_0x43ca('0x39')]['id'];}return db[_0x43ca('0x36')]['find']({'where':{'id':_0x43b29b[_0x43ca('0x2b')]['id']}})['then'](handleEntityNotFound(_0x67b8b0,null))['then'](saveUpdates(_0x43b29b[_0x43ca('0x39')],null))[_0x43ca('0x26')](respondWithResult(_0x67b8b0,null))[_0x43ca('0x3a')](handleError(_0x67b8b0,null));};exports[_0x43ca('0x27')]=function(_0xa466c9,_0x2205c4){return db[_0x43ca('0x36')][_0x43ca('0x37')]({'where':{'id':_0xa466c9[_0x43ca('0x2b')]['id']}})[_0x43ca('0x26')](handleEntityNotFound(_0x2205c4,null))[_0x43ca('0x26')](removeEntity(_0x2205c4,null))[_0x43ca('0x3a')](handleError(_0x2205c4,null));}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.model.js b/server/api/chatProactiveAction/chatProactiveAction.model.js index 60ac497..bd40416 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 _0x2763=['define','ChatProactiveAction','chat_proactive_actions','lodash','../../config/logger','api','bluebird','request-promise','path','../../config/environment','exports'];(function(_0xb5a0a0,_0x3b986d){var _0x422626=function(_0x9dabe8){while(--_0x9dabe8){_0xb5a0a0['push'](_0xb5a0a0['shift']());}};_0x422626(++_0x3b986d);}(_0x2763,0x16e));var _0x3276=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2763[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x3276('0x0'));var util=require('util');var logger=require(_0x3276('0x1'))(_0x3276('0x2'));var moment=require('moment');var BPromise=require(_0x3276('0x3'));var rp=require(_0x3276('0x4'));var fs=require('fs');var path=require(_0x3276('0x5'));var rimraf=require('rimraf');var config=require(_0x3276('0x6'));var attributes=require('./chatProactiveAction.attributes');module[_0x3276('0x7')]=function(_0x4d0b19,_0x583559){return _0x4d0b19[_0x3276('0x8')](_0x3276('0x9'),attributes,{'tableName':_0x3276('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa711=['chat_proactive_actions','lodash','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','ChatProactiveAction'];(function(_0x2e7abb,_0x1e2a4a){var _0xb46ecd=function(_0x99533a){while(--_0x99533a){_0x2e7abb['push'](_0x2e7abb['shift']());}};_0xb46ecd(++_0x1e2a4a);}(_0xa711,0x12d));var _0x1a71=function(_0x1c09bf,_0x259ee2){_0x1c09bf=_0x1c09bf-0x0;var _0x40cdfa=_0xa711[_0x1c09bf];return _0x40cdfa;};'use strict';var _=require(_0x1a71('0x0'));var util=require('util');var logger=require(_0x1a71('0x1'))(_0x1a71('0x2'));var moment=require(_0x1a71('0x3'));var BPromise=require(_0x1a71('0x4'));var rp=require(_0x1a71('0x5'));var fs=require('fs');var path=require(_0x1a71('0x6'));var rimraf=require('rimraf');var config=require(_0x1a71('0x7'));var attributes=require('./chatProactiveAction.attributes');module['exports']=function(_0x22d966,_0x3d2e99){return _0x22d966['define'](_0x1a71('0x8'),attributes,{'tableName':_0x1a71('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.rpc.js b/server/api/chatProactiveAction/chatProactiveAction.rpc.js index b8cbd33..eb43acd 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 _0xec68=['rpc','../../config/environment','jayson/promise','client','http','info','debug','ChatProactiveAction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','ChatProactiveAction,\x20%s,\x20%s','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x1f0c2e,_0x22ca22){var _0x11a54a=function(_0xd0545c){while(--_0xd0545c){_0x1f0c2e['push'](_0x1f0c2e['shift']());}};_0x11a54a(++_0x22ca22);}(_0xec68,0x18f));var _0x8ec6=function(_0x2730af,_0x264033){_0x2730af=_0x2730af-0x0;var _0x543058=_0xec68[_0x2730af];return _0x543058;};'use strict';var _=require(_0x8ec6('0x0'));var util=require(_0x8ec6('0x1'));var moment=require(_0x8ec6('0x2'));var BPromise=require(_0x8ec6('0x3'));var rs=require(_0x8ec6('0x4'));var fs=require('fs');var Redis=require(_0x8ec6('0x5'));var db=require(_0x8ec6('0x6'))['db'];var utils=require(_0x8ec6('0x7'));var logger=require(_0x8ec6('0x8'))(_0x8ec6('0x9'));var config=require(_0x8ec6('0xa'));var jayson=require(_0x8ec6('0xb'));var client=jayson[_0x8ec6('0xc')][_0x8ec6('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x23fb29,_0x46a55a,_0x575741){return new BPromise(function(_0xdacf99,_0x1cd1ad){return client['request'](_0x23fb29,_0x575741)['then'](function(_0x35ceb2){logger[_0x8ec6('0xe')]('ChatProactiveAction,\x20%s,\x20%s',_0x46a55a,'request\x20sent');logger[_0x8ec6('0xf')](_0x8ec6('0x10'),_0x46a55a,_0x8ec6('0x11'),JSON[_0x8ec6('0x12')](_0x35ceb2));if(_0x35ceb2[_0x8ec6('0x13')]){if(_0x35ceb2[_0x8ec6('0x13')][_0x8ec6('0x14')]===0x1f4){logger[_0x8ec6('0x13')](_0x8ec6('0x15'),_0x46a55a,_0x35ceb2[_0x8ec6('0x13')][_0x8ec6('0x16')]);return _0x1cd1ad(_0x35ceb2[_0x8ec6('0x13')][_0x8ec6('0x16')]);}logger['error'](_0x8ec6('0x15'),_0x46a55a,_0x35ceb2[_0x8ec6('0x13')][_0x8ec6('0x16')]);return _0xdacf99(_0x35ceb2['error'][_0x8ec6('0x16')]);}else{logger[_0x8ec6('0xe')](_0x8ec6('0x15'),_0x46a55a,_0x8ec6('0x11'));_0xdacf99(_0x35ceb2[_0x8ec6('0x17')][_0x8ec6('0x16')]);}})['catch'](function(_0x1c0897){logger['error'](_0x8ec6('0x15'),_0x46a55a,_0x1c0897);_0x1cd1ad(_0x1c0897);});});} \ No newline at end of file +var _0xcadc=['debug','stringify','error','code','ChatProactiveAction,\x20%s,\x20%s','message','result','catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','request\x20sent'];(function(_0xfde4,_0x30585c){var _0x2328fc=function(_0x389859){while(--_0x389859){_0xfde4['push'](_0xfde4['shift']());}};_0x2328fc(++_0x30585c);}(_0xcadc,0x1a6));var _0xccad=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xcadc[_0x122ef9];return _0x42fba0;};'use strict';var _=require('lodash');var util=require(_0xccad('0x0'));var moment=require(_0xccad('0x1'));var BPromise=require(_0xccad('0x2'));var rs=require(_0xccad('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xccad('0x4'))['db'];var utils=require(_0xccad('0x5'));var logger=require(_0xccad('0x6'))(_0xccad('0x7'));var config=require(_0xccad('0x8'));var jayson=require(_0xccad('0x9'));var client=jayson[_0xccad('0xa')][_0xccad('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x58dbcf,_0x21e6c0,_0x4cf210){return new BPromise(function(_0x5e4347,_0x1e166d){return client[_0xccad('0xc')](_0x58dbcf,_0x4cf210)[_0xccad('0xd')](function(_0x39897b){logger['info']('ChatProactiveAction,\x20%s,\x20%s',_0x21e6c0,_0xccad('0xe'));logger[_0xccad('0xf')]('ChatProactiveAction,\x20%s,\x20%s,\x20%s',_0x21e6c0,_0xccad('0xe'),JSON[_0xccad('0x10')](_0x39897b));if(_0x39897b[_0xccad('0x11')]){if(_0x39897b[_0xccad('0x11')][_0xccad('0x12')]===0x1f4){logger['error'](_0xccad('0x13'),_0x21e6c0,_0x39897b[_0xccad('0x11')][_0xccad('0x14')]);return _0x1e166d(_0x39897b[_0xccad('0x11')]['message']);}logger['error'](_0xccad('0x13'),_0x21e6c0,_0x39897b[_0xccad('0x11')][_0xccad('0x14')]);return _0x5e4347(_0x39897b[_0xccad('0x11')][_0xccad('0x14')]);}else{logger['info'](_0xccad('0x13'),_0x21e6c0,_0xccad('0xe'));_0x5e4347(_0x39897b[_0xccad('0x15')]['message']);}})[_0xccad('0x16')](function(_0x3b49fc){logger[_0xccad('0x11')](_0xccad('0x13'),_0x21e6c0,_0x3b49fc);_0x1e166d(_0x3b49fc);});});} \ No newline at end of file diff --git a/server/api/chatProactiveAction/index.js b/server/api/chatProactiveAction/index.js index e567545..1de1f28 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 _0x6aa7=['/:id','show','post','isAuthenticated','put','delete','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x407a96,_0x262c72){var _0x3ee8f5=function(_0x1e4112){while(--_0x1e4112){_0x407a96['push'](_0x407a96['shift']());}};_0x3ee8f5(++_0x262c72);}(_0x6aa7,0x178));var _0x76aa=function(_0x1fa348,_0x204300){_0x1fa348=_0x1fa348-0x0;var _0x168567=_0x6aa7[_0x1fa348];return _0x168567;};'use strict';var multer=require(_0x76aa('0x0'));var util=require('util');var path=require(_0x76aa('0x1'));var timeout=require(_0x76aa('0x2'));var express=require(_0x76aa('0x3'));var router=express[_0x76aa('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x76aa('0x5'));var interaction=require(_0x76aa('0x6'));var config=require(_0x76aa('0x7'));var controller=require('./chatProactiveAction.controller');router['get'](_0x76aa('0x8'),auth['isAuthenticated'](),controller[_0x76aa('0x9')]);router[_0x76aa('0xa')]('/',auth[_0x76aa('0xb')](),controller['create']);router[_0x76aa('0xc')](_0x76aa('0x8'),auth[_0x76aa('0xb')](),controller['update']);router[_0x76aa('0xd')](_0x76aa('0x8'),auth[_0x76aa('0xb')](),controller[_0x76aa('0xe')]);module[_0x76aa('0xf')]=router; \ No newline at end of file +var _0x4819=['post','isAuthenticated','create','put','update','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatProactiveAction.controller','/:id'];(function(_0x1f3707,_0x3fd9ca){var _0x577ba7=function(_0x590925){while(--_0x590925){_0x1f3707['push'](_0x1f3707['shift']());}};_0x577ba7(++_0x3fd9ca);}(_0x4819,0xcd));var _0x9481=function(_0x2f7c40,_0xb36203){_0x2f7c40=_0x2f7c40-0x0;var _0x57a4a5=_0x4819[_0x2f7c40];return _0x57a4a5;};'use strict';var multer=require('multer');var util=require(_0x9481('0x0'));var path=require(_0x9481('0x1'));var timeout=require(_0x9481('0x2'));var express=require(_0x9481('0x3'));var router=express[_0x9481('0x4')]();var fs_extra=require(_0x9481('0x5'));var auth=require(_0x9481('0x6'));var interaction=require(_0x9481('0x7'));var config=require(_0x9481('0x8'));var controller=require(_0x9481('0x9'));router['get'](_0x9481('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x9481('0xb')]('/',auth[_0x9481('0xc')](),controller[_0x9481('0xd')]);router[_0x9481('0xe')](_0x9481('0xa'),auth['isAuthenticated'](),controller[_0x9481('0xf')]);router['delete'](_0x9481('0xa'),auth['isAuthenticated'](),controller[_0x9481('0x10')]);module[_0x9481('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 7c7056f..412fb97 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 _0xe068=['rrmemory','beepall','roundrobin','sequelize','exports','STRING'];(function(_0x2fe76d,_0x54ed76){var _0x5b0f4b=function(_0x3b136e){while(--_0x3b136e){_0x2fe76d['push'](_0x2fe76d['shift']());}};_0x5b0f4b(++_0x54ed76);}(_0xe068,0x1ef));var _0x8e06=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe068[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x8e06('0x0'));module[_0x8e06('0x1')]={'name':{'type':Sequelize[_0x8e06('0x2')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x8e06('0x3'),_0x8e06('0x4'),_0x8e06('0x5'))}}; \ No newline at end of file +var _0x8721=['rrmemory','beepall','roundrobin','sequelize','exports','STRING','name','INTEGER','ENUM'];(function(_0x1c95f6,_0x440967){var _0x2192b6=function(_0x1c8efd){while(--_0x1c8efd){_0x1c95f6['push'](_0x1c95f6['shift']());}};_0x2192b6(++_0x440967);}(_0x8721,0x11a));var _0x1872=function(_0x5d4f12,_0x11e67c){_0x5d4f12=_0x5d4f12-0x0;var _0x4eb577=_0x8721[_0x5d4f12];return _0x4eb577;};'use strict';var Sequelize=require(_0x1872('0x0'));module[_0x1872('0x1')]={'name':{'type':Sequelize[_0x1872('0x2')],'unique':_0x1872('0x3'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0x1872('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x1872('0x5')](_0x1872('0x6'),_0x1872('0x7'),_0x1872('0x8'))}}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.controller.js b/server/api/chatQueue/chatQueue.controller.js index 76fc068..5453a7b 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 _0x689f=['ut.TeamId\x20=\x20tq.TeamId','ChatQueueId\x20=\x20?','clone','sequelize','QueryTypes','SELECT','every','TeamId','includes','all','union','compact','isEmpty','removeAgents','forEach','addAgents','omit','isArray','userChatQueue:remove','getAgents','eml-format','rimraf','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./chatQueue.socket','register','jayson/promise','client','http','then','info','ChatQueue,\x20%s,\x20%s','debug','ChatQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','status','offset','limit','undefined','count','set','json','apply','reject','save','update','destroy','get','UserProfileResource','end','sendStatus','name','send','index','map','ChatQueue','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','includeAll','rows','show','params','keys','include','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','ChatQueues','UserProfileSection','userProfileId','describe','getMembers','findOne','UserChatQueue','ChatQueueId','User','agent','chatPause','createdAt','format','%s/%s','SIP','updatedAt','getTeams','addTeams','ids','Agents','online','interface','flatMap','transaction','each','emit','userChatQueue:save','removeTeams','findAll','field','tq.TeamId','from','team_has_chat_queues','user_has_teams'];(function(_0x5b78e8,_0x55096b){var _0xf2c321=function(_0x4e0cff){while(--_0x4e0cff){_0x5b78e8['push'](_0x5b78e8['shift']());}};_0xf2c321(++_0x55096b);}(_0x689f,0x14a));var _0xf689=function(_0xa9ecac,_0x2915e4){_0xa9ecac=_0xa9ecac-0x0;var _0x2c284c=_0x689f[_0xa9ecac];return _0x2c284c;};'use strict';var emlformat=require(_0xf689('0x0'));var rimraf=require(_0xf689('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf689('0x2'));var rp=require('request-promise');var moment=require(_0xf689('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xf689('0x4'));var util=require(_0xf689('0x5'));var path=require(_0xf689('0x6'));var sox=require(_0xf689('0x7'));var csv=require(_0xf689('0x8'));var ejs=require(_0xf689('0x9'));var fs=require('fs');var fs_extra=require(_0xf689('0xa'));var _=require(_0xf689('0xb'));var squel=require('squel');var crypto=require(_0xf689('0xc'));var jsforce=require(_0xf689('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xf689('0x8'));var querystring=require(_0xf689('0xe'));var Papa=require(_0xf689('0xf'));var Redis=require(_0xf689('0x10'));var authService=require(_0xf689('0x11'));var qs=require(_0xf689('0x12'));var as=require(_0xf689('0x13'));var hardwareService=require(_0xf689('0x14'));var logger=require(_0xf689('0x15'))(_0xf689('0x16'));var utils=require(_0xf689('0x17'));var config=require(_0xf689('0x18'));var licenseUtil=require(_0xf689('0x19'));var db=require(_0xf689('0x1a'))['db'];config[_0xf689('0x1b')]=_[_0xf689('0x1c')](config['redis'],{'host':_0xf689('0x1d'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xf689('0x1b')]));require(_0xf689('0x1e'))[_0xf689('0x1f')](socket);var jayson=require(_0xf689('0x20'));var client=jayson[_0xf689('0x21')][_0xf689('0x22')]({'port':0x232a});function respondWithRpcPromise(_0x20bb9b,_0x1d01b3,_0x58a940,_0x31ec2b){return new BPromise(function(_0x57f2b8,_0x43c2ce){var _0x474e7=_0x31ec2b||client;return _0x474e7['request'](_0x20bb9b,_0x58a940)[_0xf689('0x23')](function(_0xa4e847){logger[_0xf689('0x24')](_0xf689('0x25'),_0x1d01b3,'request\x20sent');logger[_0xf689('0x26')](_0xf689('0x27'),_0x1d01b3,_0xf689('0x28'),JSON[_0xf689('0x29')](_0xa4e847));if(_0xa4e847[_0xf689('0x2a')]){if(_0xa4e847[_0xf689('0x2a')][_0xf689('0x2b')]===0x1f4){logger[_0xf689('0x2a')]('ChatQueue,\x20%s,\x20%s',_0x1d01b3,_0xa4e847[_0xf689('0x2a')][_0xf689('0x2c')]);return _0x43c2ce(_0xa4e847[_0xf689('0x2a')]['message']);}logger[_0xf689('0x2a')](_0xf689('0x25'),_0x1d01b3,_0xa4e847[_0xf689('0x2a')][_0xf689('0x2c')]);return _0x57f2b8(_0xa4e847['error'][_0xf689('0x2c')]);}else{logger['info'](_0xf689('0x25'),_0x1d01b3,_0xf689('0x28'));_0x57f2b8(_0xa4e847[_0xf689('0x2d')]['message']);}})[_0xf689('0x2e')](function(_0x39f453){logger['error'](_0xf689('0x25'),_0x1d01b3,_0x39f453);_0x43c2ce(_0x39f453);});});}function respondWithStatusCode(_0x3136de,_0x4ed0b9){_0x4ed0b9=_0x4ed0b9||0xcc;return function(_0x186944){if(_0x186944){return _0x3136de['sendStatus'](_0x4ed0b9);}return _0x3136de[_0xf689('0x2f')](_0x4ed0b9)['end']();};}function respondWithResult(_0x1de51e,_0x311257){_0x311257=_0x311257||0xc8;return function(_0x5225b4){if(_0x5225b4){return _0x1de51e['status'](_0x311257)['json'](_0x5225b4);}};}function respondWithFilteredResult(_0x415fc7,_0x67b8b8){return function(_0x20cbda){if(_0x20cbda){var _0x5b024f=typeof _0x67b8b8[_0xf689('0x30')]==='undefined'&&typeof _0x67b8b8[_0xf689('0x31')]===_0xf689('0x32');var _0x1b3ebb=_0x20cbda[_0xf689('0x33')];var _0x25b214=_0x5b024f?0x0:_0x67b8b8[_0xf689('0x30')];var _0x24527e=_0x5b024f?_0x20cbda[_0xf689('0x33')]:_0x67b8b8[_0xf689('0x30')]+_0x67b8b8[_0xf689('0x31')];var _0x53c2df;if(_0x24527e>=_0x1b3ebb){_0x24527e=_0x1b3ebb;_0x53c2df=0xc8;}else{_0x53c2df=0xce;}_0x415fc7[_0xf689('0x2f')](_0x53c2df);return _0x415fc7[_0xf689('0x34')]('Content-Range',_0x25b214+'-'+_0x24527e+'/'+_0x1b3ebb)[_0xf689('0x35')](_0x20cbda);}return null;};}function patchUpdates(_0x946a86){return function(_0x49d9bd){try{jsonpatch[_0xf689('0x36')](_0x49d9bd,_0x946a86,!![]);}catch(_0x3b413e){return BPromise[_0xf689('0x37')](_0x3b413e);}return _0x49d9bd[_0xf689('0x38')]();};}function saveUpdates(_0x1b8270,_0x3d5fad){return function(_0x5d3690){if(_0x5d3690){return _0x5d3690[_0xf689('0x39')](_0x1b8270)['then'](function(_0x24e5b4){return _0x24e5b4;});}return null;};}function removeEntity(_0x3bcfb2,_0x4334c7){return function(_0x5c1589){if(_0x5c1589){return _0x5c1589[_0xf689('0x3a')]()['then'](function(){var _0x21a63d=_0x5c1589[_0xf689('0x3b')]({'plain':!![]});var _0x5a3056='ChatQueues';return db[_0xf689('0x3c')][_0xf689('0x3a')]({'where':{'type':_0x5a3056,'resourceId':_0x21a63d['id']}})['then'](function(){return _0x5c1589;});})[_0xf689('0x23')](function(){_0x3bcfb2[_0xf689('0x2f')](0xcc)[_0xf689('0x3d')]();});}};}function handleEntityNotFound(_0x3ceab2,_0x9534d8){return function(_0x3dd288){if(!_0x3dd288){_0x3ceab2[_0xf689('0x3e')](0x194);}return _0x3dd288;};}function handleError(_0x1e686a,_0x60b82b){_0x60b82b=_0x60b82b||0x1f4;return function(_0x1c9495){logger['error'](_0x1c9495['stack']);if(_0x1c9495['name']){delete _0x1c9495[_0xf689('0x3f')];}_0x1e686a[_0xf689('0x2f')](_0x60b82b)[_0xf689('0x40')](_0x1c9495);};}exports[_0xf689('0x41')]=function(_0x373eaa,_0x294836){var _0x5a71fa={},_0x26a774={},_0x1a99f8={'count':0x0,'rows':[]};var _0x459011=_[_0xf689('0x42')](db[_0xf689('0x43')][_0xf689('0x44')],function(_0x50a03e){return{'name':_0x50a03e[_0xf689('0x45')],'type':_0x50a03e[_0xf689('0x46')][_0xf689('0x47')]};});_0x26a774[_0xf689('0x48')]=_[_0xf689('0x42')](_0x459011,_0xf689('0x3f'));_0x26a774[_0xf689('0x49')]=_['keys'](_0x373eaa[_0xf689('0x49')]);_0x26a774[_0xf689('0x4a')]=_[_0xf689('0x4b')](_0x26a774[_0xf689('0x48')],_0x26a774[_0xf689('0x49')]);_0x5a71fa[_0xf689('0x4c')]=_['intersection'](_0x26a774['model'],qs[_0xf689('0x4d')](_0x373eaa[_0xf689('0x49')][_0xf689('0x4d')]));_0x5a71fa['attributes']=_0x5a71fa[_0xf689('0x4c')][_0xf689('0x4e')]?_0x5a71fa[_0xf689('0x4c')]:_0x26a774['model'];if(!_0x373eaa[_0xf689('0x49')][_0xf689('0x4f')](_0xf689('0x50'))){_0x5a71fa[_0xf689('0x31')]=qs['limit'](_0x373eaa[_0xf689('0x49')][_0xf689('0x31')]);_0x5a71fa[_0xf689('0x30')]=qs[_0xf689('0x30')](_0x373eaa[_0xf689('0x49')][_0xf689('0x30')]);}_0x5a71fa[_0xf689('0x51')]=qs[_0xf689('0x52')](_0x373eaa['query']['sort']);_0x5a71fa['where']=qs[_0xf689('0x4a')](_[_0xf689('0x53')](_0x373eaa[_0xf689('0x49')],_0x26a774['filters']),_0x459011);if(_0x373eaa[_0xf689('0x49')][_0xf689('0x54')]){_0x5a71fa[_0xf689('0x55')]=_[_0xf689('0x56')](_0x5a71fa[_0xf689('0x55')],{'$or':_[_0xf689('0x42')](_0x459011,function(_0x4843be){if(_0x4843be[_0xf689('0x46')]!==_0xf689('0x57')){var _0x407e3f={};_0x407e3f[_0x4843be[_0xf689('0x3f')]]={'$like':'%'+_0x373eaa[_0xf689('0x49')][_0xf689('0x54')]+'%'};return _0x407e3f;}})});}_0x5a71fa=_['merge']({},_0x5a71fa,_0x373eaa['options']);var _0x3aeaaa={'where':_0x5a71fa[_0xf689('0x55')]};return db[_0xf689('0x43')]['count'](_0x3aeaaa)['then'](function(_0x3ebad7){_0x1a99f8[_0xf689('0x33')]=_0x3ebad7;if(_0x373eaa[_0xf689('0x49')][_0xf689('0x58')]){_0x5a71fa['include']=[{'all':!![]}];}return db[_0xf689('0x43')]['findAll'](_0x5a71fa);})['then'](function(_0x505e16){_0x1a99f8[_0xf689('0x59')]=_0x505e16;return _0x1a99f8;})['then'](respondWithFilteredResult(_0x294836,_0x5a71fa))[_0xf689('0x2e')](handleError(_0x294836,null));};exports[_0xf689('0x5a')]=function(_0x3df2ff,_0x1222a7){var _0x555638={'raw':!![],'where':{'id':_0x3df2ff[_0xf689('0x5b')]['id']}},_0x529eb7={};_0x529eb7[_0xf689('0x48')]=_['keys'](db[_0xf689('0x43')][_0xf689('0x44')]);_0x529eb7[_0xf689('0x49')]=_[_0xf689('0x5c')](_0x3df2ff[_0xf689('0x49')]);_0x529eb7[_0xf689('0x4a')]=_[_0xf689('0x4b')](_0x529eb7[_0xf689('0x48')],_0x529eb7[_0xf689('0x49')]);_0x555638[_0xf689('0x4c')]=_[_0xf689('0x4b')](_0x529eb7[_0xf689('0x48')],qs[_0xf689('0x4d')](_0x3df2ff[_0xf689('0x49')]['fields']));_0x555638[_0xf689('0x4c')]=_0x555638[_0xf689('0x4c')][_0xf689('0x4e')]?_0x555638[_0xf689('0x4c')]:_0x529eb7[_0xf689('0x48')];if(_0x3df2ff['query']['includeAll']){_0x555638[_0xf689('0x5d')]=[{'all':!![]}];}_0x555638=_[_0xf689('0x56')]({},_0x555638,_0x3df2ff[_0xf689('0x5e')]);return db[_0xf689('0x43')][_0xf689('0x5f')](_0x555638)[_0xf689('0x23')](handleEntityNotFound(_0x1222a7,null))[_0xf689('0x23')](respondWithResult(_0x1222a7,null))[_0xf689('0x2e')](handleError(_0x1222a7,null));};exports[_0xf689('0x60')]=function(_0x44d1b2,_0xdf6217){return db[_0xf689('0x43')]['create'](_0x44d1b2[_0xf689('0x61')],{})[_0xf689('0x23')](function(_0x5839ec){var _0x14783d=_0x44d1b2[_0xf689('0x62')][_0xf689('0x3b')]({'plain':!![]});if(!_0x14783d)throw new Error(_0xf689('0x63'));if(_0x14783d[_0xf689('0x64')]===_0xf689('0x62')){var _0x12f90e=_0x5839ec[_0xf689('0x3b')]({'plain':!![]});var _0x4ba9fa=_0xf689('0x65');return db[_0xf689('0x66')][_0xf689('0x5f')]({'where':{'name':_0x4ba9fa,'userProfileId':_0x14783d[_0xf689('0x67')]},'raw':!![]})[_0xf689('0x23')](function(_0x3dee8a){if(_0x3dee8a&&_0x3dee8a['autoAssociation']===0x0){return db[_0xf689('0x3c')]['create']({'name':_0x12f90e[_0xf689('0x3f')],'resourceId':_0x12f90e['id'],'type':_0x3dee8a[_0xf689('0x3f')],'sectionId':_0x3dee8a['id']},{})[_0xf689('0x23')](function(){return _0x5839ec;});}else{return _0x5839ec;}})[_0xf689('0x2e')](function(_0x10388d){logger[_0xf689('0x2a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x10388d);throw _0x10388d;});}return _0x5839ec;})['then'](respondWithResult(_0xdf6217,0xc9))[_0xf689('0x2e')](handleError(_0xdf6217,null));};exports[_0xf689('0x39')]=function(_0xf9bbe0,_0x511829){if(_0xf9bbe0['body']['id']){delete _0xf9bbe0[_0xf689('0x61')]['id'];}return db[_0xf689('0x43')][_0xf689('0x5f')]({'where':{'id':_0xf9bbe0[_0xf689('0x5b')]['id']}})[_0xf689('0x23')](handleEntityNotFound(_0x511829,null))[_0xf689('0x23')](saveUpdates(_0xf9bbe0['body'],null))[_0xf689('0x23')](respondWithResult(_0x511829,null))[_0xf689('0x2e')](handleError(_0x511829,null));};exports[_0xf689('0x3a')]=function(_0x2a3ca5,_0x30e40d){return db['ChatQueue'][_0xf689('0x5f')]({'where':{'id':_0x2a3ca5['params']['id']}})[_0xf689('0x23')](handleEntityNotFound(_0x30e40d,null))[_0xf689('0x23')](removeEntity(_0x30e40d,null))[_0xf689('0x2e')](handleError(_0x30e40d,null));};exports['describe']=function(_0x402040,_0x45ce02){return db[_0xf689('0x43')][_0xf689('0x68')]()[_0xf689('0x23')](respondWithResult(_0x45ce02,null))[_0xf689('0x2e')](handleError(_0x45ce02,null));};exports[_0xf689('0x69')]=function(_0x33b37e,_0x2940be,_0x450d74){var _0x315601={'raw':!![],'where':{}},_0x2b7a67={},_0x4f8cc7;return db[_0xf689('0x43')][_0xf689('0x6a')]({'where':{'id':_0x33b37e[_0xf689('0x5b')]['id']}})['then'](handleEntityNotFound(_0x2940be,null))[_0xf689('0x23')](function(_0x44e803){if(_0x44e803){_0x4f8cc7=_0x44e803[_0xf689('0x3b')]({'plain':!![]});_0x2b7a67[_0xf689('0x48')]=_[_0xf689('0x5c')](db[_0xf689('0x6b')][_0xf689('0x44')]);_0x2b7a67[_0xf689('0x49')]=_[_0xf689('0x5c')](_0x33b37e[_0xf689('0x49')]);_0x2b7a67[_0xf689('0x4a')]=_[_0xf689('0x4b')](_0x2b7a67[_0xf689('0x48')],_0x2b7a67[_0xf689('0x49')]);_0x315601['attributes']=_[_0xf689('0x4b')](_0x2b7a67['model'],qs[_0xf689('0x4d')](_0x33b37e[_0xf689('0x49')][_0xf689('0x4d')]));_0x315601[_0xf689('0x4c')]=_0x315601[_0xf689('0x4c')][_0xf689('0x4e')]?_0x315601[_0xf689('0x4c')]:_0x2b7a67[_0xf689('0x48')];if(!_0x33b37e[_0xf689('0x49')][_0xf689('0x4f')](_0xf689('0x50'))){_0x315601['limit']=qs[_0xf689('0x31')](_0x33b37e[_0xf689('0x49')][_0xf689('0x31')]);_0x315601['offset']=qs[_0xf689('0x30')](_0x33b37e['query']['offset']);}_0x315601[_0xf689('0x51')]=qs['sort'](_0x33b37e[_0xf689('0x49')][_0xf689('0x52')]);_0x315601['where']=qs[_0xf689('0x4a')](_[_0xf689('0x53')](_0x33b37e['query'],_0x2b7a67[_0xf689('0x4a')]));_0x315601[_0xf689('0x55')][_0xf689('0x6c')]=_0x44e803['id'];if(_0x33b37e[_0xf689('0x49')][_0xf689('0x54')]){_0x315601['where']=_['merge'](_0x315601[_0xf689('0x55')],{'$or':_['map'](_0x315601[_0xf689('0x4c')],function(_0x22e785){var _0xe516ab={};_0xe516ab[_0x22e785]={'$like':'%'+_0x33b37e['query'][_0xf689('0x54')]+'%'};return _0xe516ab;})});}_0x315601=_[_0xf689('0x56')]({},_0x315601,_0x33b37e[_0xf689('0x5e')]);return db[_0xf689('0x6b')]['findAll'](_0x315601);}})['then'](function(_0x1e6892){if(_0x1e6892){return db[_0xf689('0x6d')]['findAndCountAll']({'where':{'id':_['map'](_0x1e6892,'UserId'),'role':_0xf689('0x6e')},'attributes':['id',_0xf689('0x3f'),_0xf689('0x6f'),'updatedAt',_0xf689('0x70')]});}})[_0xf689('0x23')](function(_0x453389){if(_0x453389){return{'count':_0x453389[_0xf689('0x33')],'rows':_[_0xf689('0x42')](_0x453389[_0xf689('0x59')],function(_0x10b7d2){return{'membername':_0x10b7d2[_0xf689('0x3f')],'UserId':_0x10b7d2['id'],'queue_name':_0x4f8cc7['name'],'ChatQueueId':_0x4f8cc7['id'],'interface':util[_0xf689('0x71')](_0xf689('0x72'),_0xf689('0x73'),_0x10b7d2['name']),'penalty':0x0,'paused':_0x10b7d2['chatPause'],'createdAt':_0x10b7d2[_0xf689('0x70')],'updatedAt':_0x10b7d2[_0xf689('0x74')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xf689('0x23')](respondWithFilteredResult(_0x2940be,_0x315601))[_0xf689('0x2e')](handleError(_0x2940be,null));};exports[_0xf689('0x75')]=function(_0x35a470,_0x2d7dad,_0x10b0cd){var _0x50cf88={};var _0x5f013f={};var _0x115e6b;var _0x3c9549;return db[_0xf689('0x43')][_0xf689('0x6a')]({'where':{'id':_0x35a470[_0xf689('0x5b')]['id']}})[_0xf689('0x23')](handleEntityNotFound(_0x2d7dad,null))[_0xf689('0x23')](function(_0x36238d){if(_0x36238d){_0x115e6b=_0x36238d;_0x5f013f[_0xf689('0x48')]=_['keys'](db['Team'][_0xf689('0x44')]);_0x5f013f[_0xf689('0x49')]=_['keys'](_0x35a470['query']);_0x5f013f['filters']=_[_0xf689('0x4b')](_0x5f013f[_0xf689('0x48')],_0x5f013f[_0xf689('0x49')]);_0x50cf88[_0xf689('0x4c')]=_[_0xf689('0x4b')](_0x5f013f[_0xf689('0x48')],qs[_0xf689('0x4d')](_0x35a470[_0xf689('0x49')][_0xf689('0x4d')]));_0x50cf88['attributes']=_0x50cf88[_0xf689('0x4c')]['length']?_0x50cf88[_0xf689('0x4c')]:_0x5f013f[_0xf689('0x48')];_0x50cf88[_0xf689('0x51')]=qs[_0xf689('0x52')](_0x35a470[_0xf689('0x49')][_0xf689('0x52')]);_0x50cf88['where']=qs[_0xf689('0x4a')](_['pick'](_0x35a470[_0xf689('0x49')],_0x5f013f['filters']));if(_0x35a470[_0xf689('0x49')][_0xf689('0x54')]){_0x50cf88[_0xf689('0x55')]=_[_0xf689('0x56')](_0x50cf88[_0xf689('0x55')],{'$or':_[_0xf689('0x42')](_0x50cf88[_0xf689('0x4c')],function(_0x3067d1){var _0x10ba14={};_0x10ba14[_0x3067d1]={'$like':'%'+_0x35a470[_0xf689('0x49')]['filter']+'%'};return _0x10ba14;})});}_0x50cf88=_[_0xf689('0x56')]({},_0x50cf88,_0x35a470[_0xf689('0x5e')]);return _0x115e6b[_0xf689('0x75')](_0x50cf88);}})['then'](function(_0x57573e){if(_0x57573e){_0x3c9549=_0x57573e[_0xf689('0x4e')];if(!_0x35a470[_0xf689('0x49')][_0xf689('0x4f')]('nolimit')){_0x50cf88[_0xf689('0x31')]=qs['limit'](_0x35a470[_0xf689('0x49')]['limit']);_0x50cf88['offset']=qs[_0xf689('0x30')](_0x35a470[_0xf689('0x49')][_0xf689('0x30')]);}return _0x115e6b[_0xf689('0x75')](_0x50cf88);}})[_0xf689('0x23')](function(_0x2799c0){if(_0x2799c0){return _0x2799c0?{'count':_0x3c9549,'rows':_0x2799c0}:null;}})[_0xf689('0x23')](respondWithResult(_0x2d7dad,null))[_0xf689('0x2e')](handleError(_0x2d7dad,null));};exports[_0xf689('0x76')]=function(_0x3480e0,_0x2dbecd,_0x2ec2c8){var _0x1075a3=_0x3480e0['body'][_0xf689('0x77')];return db['Team']['findAll']({'where':{'id':_0x1075a3},'attributes':['id'],'include':[{'model':db[_0xf689('0x6d')],'as':_0xf689('0x78'),'attributes':['id','name',_0xf689('0x79'),'voicePause',_0xf689('0x7a')],'raw':!![]}]})['then'](function(_0x1bc1bd){if(_0x1bc1bd){var _0x348539=_[_0xf689('0x7b')](_0x1bc1bd,function(_0x3d72ec){var _0xd31998=_0x3d72ec[_0xf689('0x3b')]({'plain':!![]});return _0xd31998[_0xf689('0x78')];});return db['ChatQueue'][_0xf689('0x5f')]({'where':{'id':_0x3480e0[_0xf689('0x5b')]['id']}})['then'](function(_0x43f7f7){return db['sequelize'][_0xf689('0x7c')](function(_0x514355){return _0x43f7f7['addTeams'](_0x1075a3,{'transaction':_0x514355})['then'](function(){return BPromise[_0xf689('0x7d')](_0x348539,function(_0x28e87a){return db[_0xf689('0x6b')]['findOrCreate']({'where':{'UserId':_0x28e87a['id'],'ChatQueueId':_0x3480e0[_0xf689('0x5b')]['id']},'transaction':_0x514355});});})[_0xf689('0x23')](function(){_0x348539['forEach'](function(_0x1b0258){socket[_0xf689('0x7e')](_0xf689('0x7f'),{'UserId':_0x1b0258['id'],'ChatQueueId':_0x43f7f7['id']});});});});});}})[_0xf689('0x23')](respondWithStatusCode(_0x2dbecd,null))[_0xf689('0x2e')](handleError(_0x2dbecd,null));};exports[_0xf689('0x80')]=function(_0x20a29d,_0x2796fc,_0x3eb28e){return db['Team'][_0xf689('0x81')]({'where':{'id':_0x20a29d[_0xf689('0x49')][_0xf689('0x77')]},'attributes':['id'],'include':[{'model':db[_0xf689('0x6d')],'as':_0xf689('0x78'),'attributes':['id'],'raw':!![]}]})[_0xf689('0x23')](handleEntityNotFound(_0x2796fc,null))[_0xf689('0x23')](function(_0x5f8f1b){var _0x5cfbed=_[_0xf689('0x42')](_0x5f8f1b,'id');var _0x125e1a=[];var _0x46eca2=[];var _0x2946fa=squel['select']();_0x2946fa[_0xf689('0x82')](_0xf689('0x83'))[_0xf689('0x84')](_0xf689('0x85'),'tq')['join'](_0xf689('0x86'),'ut',_0xf689('0x87'))[_0xf689('0x55')](_0xf689('0x88'),_0x20a29d[_0xf689('0x5b')]['id']);for(var _0x135431=0x0;_0x135431<_0x5f8f1b[_0xf689('0x4e')];_0x135431+=0x1){let _0xb035e7=_0x5f8f1b[_0x135431];for(var _0x5c34c3=0x0;_0x5c34c3<_0xb035e7[_0xf689('0x78')][_0xf689('0x4e')];_0x5c34c3+=0x1){let _0x2e53c1=_0xb035e7[_0xf689('0x78')][_0x5c34c3];var _0x537568=_0x2946fa[_0xf689('0x89')]();_0x537568[_0xf689('0x55')]('ut.UserId\x20=\x20?',_0x2e53c1['id']);_0x46eca2['push'](db[_0xf689('0x8a')][_0xf689('0x49')](_0x537568['toString'](),{'type':db[_0xf689('0x8a')][_0xf689('0x8b')][_0xf689('0x8c')]})[_0xf689('0x23')](function(_0xa8608a){if(_0xa8608a[_0xf689('0x4e')]===0x1){return _0x2e53c1['id'];}else{var _0x13ef17=_[_0xf689('0x8d')](_[_0xf689('0x42')](_0xa8608a,_0xf689('0x8e')),function(_0x548af6){return _[_0xf689('0x8f')](_0x5cfbed,_0x548af6);});if(_0x13ef17){return _0x2e53c1['id'];}}}));}}return BPromise[_0xf689('0x90')](_0x46eca2)[_0xf689('0x23')](function(_0x114f94){_0x125e1a=_(_0x125e1a)[_0xf689('0x91')](_0x114f94)[_0xf689('0x92')]()['value']();return db[_0xf689('0x43')][_0xf689('0x5f')]({'where':{'id':_0x20a29d[_0xf689('0x5b')]['id']}})[_0xf689('0x23')](function(_0x5b4b9b){return db[_0xf689('0x8a')][_0xf689('0x7c')](function(_0xc18795){return _0x5b4b9b[_0xf689('0x80')](_0x20a29d[_0xf689('0x49')][_0xf689('0x77')],{'transaction':_0xc18795})['then'](function(){if(!_[_0xf689('0x93')](_0x125e1a)){return _0x5b4b9b[_0xf689('0x94')](_0x125e1a,{'transaction':_0xc18795});}})[_0xf689('0x23')](function(){_0x125e1a[_0xf689('0x95')](function(_0x91431e){socket[_0xf689('0x7e')]('userChatQueue:remove',{'UserId':_0x91431e,'ChatQueueId':_0x5b4b9b['id']});});});});});});})['then'](respondWithStatusCode(_0x2796fc,null))[_0xf689('0x2e')](handleError(_0x2796fc,null));};exports[_0xf689('0x96')]=function(_0x4eb55b,_0x54c27d,_0x2c4454){return db[_0xf689('0x43')][_0xf689('0x5f')]({'where':{'id':_0x4eb55b[_0xf689('0x5b')]['id']}})['then'](handleEntityNotFound(_0x54c27d,null))[_0xf689('0x23')](function(_0x5188f3){if(_0x5188f3){return _0x5188f3[_0xf689('0x96')](_0x4eb55b['body'][_0xf689('0x77')],_[_0xf689('0x97')](_0x4eb55b[_0xf689('0x61')],[_0xf689('0x77'),'id'])||{})['spread'](function(_0x474d21){for(var _0x4caa12=0x0;_0x4caa12<_0x4eb55b[_0xf689('0x61')][_0xf689('0x77')]['length'];_0x4caa12+=0x1){socket[_0xf689('0x7e')](_0xf689('0x7f'),{'UserId':Number(_0x4eb55b[_0xf689('0x61')][_0xf689('0x77')][_0x4caa12]),'ChatQueueId':Number(_0x4eb55b[_0xf689('0x5b')]['id'])});}return _0x474d21;});}})[_0xf689('0x23')](respondWithResult(_0x54c27d,null))[_0xf689('0x2e')](handleError(_0x54c27d,null));};exports[_0xf689('0x94')]=function(_0x401c6a,_0xcc0780,_0x1e784d){return db[_0xf689('0x43')][_0xf689('0x5f')]({'where':{'id':_0x401c6a['params']['id']}})['then'](handleEntityNotFound(_0xcc0780,null))[_0xf689('0x23')](function(_0x362ab5){if(_0x362ab5){return _0x362ab5['removeAgents'](_0x401c6a[_0xf689('0x49')][_0xf689('0x77')])[_0xf689('0x23')](function(){if(_[_0xf689('0x98')](_0x401c6a[_0xf689('0x49')]['ids'])){for(var _0x4e471b=0x0;_0x4e471b<_0x401c6a[_0xf689('0x49')][_0xf689('0x77')][_0xf689('0x4e')];_0x4e471b+=0x1){socket[_0xf689('0x7e')]('userChatQueue:remove',{'UserId':Number(_0x401c6a['query'][_0xf689('0x77')][_0x4e471b]),'ChatQueueId':Number(_0x401c6a[_0xf689('0x5b')]['id'])});}}else{socket[_0xf689('0x7e')](_0xf689('0x99'),{'UserId':Number(_0x401c6a[_0xf689('0x49')][_0xf689('0x77')]),'ChatQueueId':Number(_0x401c6a[_0xf689('0x5b')]['id'])});}});}})['then'](respondWithStatusCode(_0xcc0780,null))[_0xf689('0x2e')](handleError(_0xcc0780,null));};exports[_0xf689('0x9a')]=function(_0x211a17,_0x1b3606,_0x287489){var _0x520708={};var _0x367524={};var _0x234683;var _0x187c14;return db[_0xf689('0x43')]['findOne']({'where':{'id':_0x211a17[_0xf689('0x5b')]['id']}})['then'](handleEntityNotFound(_0x1b3606,null))[_0xf689('0x23')](function(_0x4d1baf){if(_0x4d1baf){_0x234683=_0x4d1baf;_0x367524[_0xf689('0x48')]=_[_0xf689('0x5c')](db[_0xf689('0x6d')][_0xf689('0x44')]);_0x367524['query']=_[_0xf689('0x5c')](_0x211a17[_0xf689('0x49')]);_0x367524[_0xf689('0x4a')]=_[_0xf689('0x4b')](_0x367524[_0xf689('0x48')],_0x367524[_0xf689('0x49')]);_0x520708[_0xf689('0x4c')]=_[_0xf689('0x4b')](_0x367524[_0xf689('0x48')],qs[_0xf689('0x4d')](_0x211a17[_0xf689('0x49')][_0xf689('0x4d')]));_0x520708[_0xf689('0x4c')]=_0x520708['attributes'][_0xf689('0x4e')]?_0x520708['attributes']:_0x367524[_0xf689('0x48')];_0x520708['order']=qs[_0xf689('0x52')](_0x211a17[_0xf689('0x49')][_0xf689('0x52')]);_0x520708['where']=qs['filters'](_['pick'](_0x211a17[_0xf689('0x49')],_0x367524[_0xf689('0x4a')]));if(_0x211a17[_0xf689('0x49')][_0xf689('0x54')]){_0x520708[_0xf689('0x55')]=_[_0xf689('0x56')](_0x520708[_0xf689('0x55')],{'$or':_['map'](_0x520708[_0xf689('0x4c')],function(_0x3c96e4){var _0x231124={};_0x231124[_0x3c96e4]={'$like':'%'+_0x211a17[_0xf689('0x49')]['filter']+'%'};return _0x231124;})});}_0x520708=_['merge']({},_0x520708,_0x211a17[_0xf689('0x5e')]);return _0x234683['getAgents'](_0x520708);}})[_0xf689('0x23')](function(_0x2f8a74){if(_0x2f8a74){_0x187c14=_0x2f8a74['length'];if(!_0x211a17[_0xf689('0x49')][_0xf689('0x4f')](_0xf689('0x50'))){_0x520708[_0xf689('0x31')]=qs[_0xf689('0x31')](_0x211a17['query'][_0xf689('0x31')]);_0x520708[_0xf689('0x30')]=qs[_0xf689('0x30')](_0x211a17[_0xf689('0x49')][_0xf689('0x30')]);}return _0x234683['getAgents'](_0x520708);}})['then'](function(_0x5c00ef){if(_0x5c00ef){return _0x5c00ef?{'count':_0x187c14,'rows':_0x5c00ef}:null;}})[_0xf689('0x23')](respondWithResult(_0x1b3606,null))[_0xf689('0x2e')](handleError(_0x1b3606,null));}; \ No newline at end of file +var _0x3572=['../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','register','jayson/promise','client','http','request','info','request\x20sent','debug','error','code','ChatQueue,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','then','destroy','get','ChatQueues','UserProfileResource','stack','name','index','map','rawAttributes','fieldName','key','query','keys','filters','model','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','ChatQueue','include','rows','show','params','intersection','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserChatQueue','order','ChatQueueId','findAll','findAndCountAll','UserId','agent','chatPause','updatedAt','createdAt','format','SIP','getTeams','addTeams','ids','Team','User','Agents','interface','flatMap','sequelize','each','findOrCreate','userChatQueue:save','removeTeams','select','field','tq.TeamId','from','team_has_chat_queues','join','user_has_teams','ChatQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','toString','QueryTypes','SELECT','every','includes','all','union','value','transaction','isEmpty','forEach','userChatQueue:remove','addAgents','spread','emit','removeAgents','isArray','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis'];(function(_0xce8fdb,_0x45943c){var _0x3cc5b8=function(_0x287b17){while(--_0x287b17){_0xce8fdb['push'](_0xce8fdb['shift']());}};_0x3cc5b8(++_0x45943c);}(_0x3572,0x87));var _0x2357=function(_0x3c14ab,_0x1bac70){_0x3c14ab=_0x3c14ab-0x0;var _0x2e4a9f=_0x3572[_0x3c14ab];return _0x2e4a9f;};'use strict';var emlformat=require(_0x2357('0x0'));var rimraf=require(_0x2357('0x1'));var zipdir=require(_0x2357('0x2'));var jsonpatch=require(_0x2357('0x3'));var rp=require(_0x2357('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x2357('0x5'));var util=require(_0x2357('0x6'));var path=require(_0x2357('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2357('0x8'));var _=require(_0x2357('0x9'));var squel=require(_0x2357('0xa'));var crypto=require(_0x2357('0xb'));var jsforce=require(_0x2357('0xc'));var deskjs=require(_0x2357('0xd'));var toCsv=require(_0x2357('0xe'));var querystring=require('querystring');var Papa=require(_0x2357('0xf'));var Redis=require(_0x2357('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x2357('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2357('0x12'))(_0x2357('0x13'));var utils=require(_0x2357('0x14'));var config=require(_0x2357('0x15'));var licenseUtil=require(_0x2357('0x16'));var db=require(_0x2357('0x17'))['db'];config[_0x2357('0x18')]=_[_0x2357('0x19')](config[_0x2357('0x18')],{'host':'localhost','port':0x18eb});var socket=require(_0x2357('0x1a'))(new Redis(config[_0x2357('0x18')]));require('./chatQueue.socket')[_0x2357('0x1b')](socket);var jayson=require(_0x2357('0x1c'));var client=jayson[_0x2357('0x1d')][_0x2357('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x1ea7e0,_0x23373f,_0x161499,_0x323fe8){return new BPromise(function(_0x2c74c3,_0x3046e2){var _0x450232=_0x323fe8||client;return _0x450232[_0x2357('0x1f')](_0x1ea7e0,_0x161499)['then'](function(_0x59548c){logger[_0x2357('0x20')]('ChatQueue,\x20%s,\x20%s',_0x23373f,_0x2357('0x21'));logger[_0x2357('0x22')]('ChatQueue,\x20%s,\x20%s,\x20%s',_0x23373f,_0x2357('0x21'),JSON['stringify'](_0x59548c));if(_0x59548c[_0x2357('0x23')]){if(_0x59548c['error'][_0x2357('0x24')]===0x1f4){logger[_0x2357('0x23')](_0x2357('0x25'),_0x23373f,_0x59548c['error']['message']);return _0x3046e2(_0x59548c[_0x2357('0x23')][_0x2357('0x26')]);}logger[_0x2357('0x23')]('ChatQueue,\x20%s,\x20%s',_0x23373f,_0x59548c[_0x2357('0x23')]['message']);return _0x2c74c3(_0x59548c[_0x2357('0x23')][_0x2357('0x26')]);}else{logger[_0x2357('0x20')]('ChatQueue,\x20%s,\x20%s',_0x23373f,_0x2357('0x21'));_0x2c74c3(_0x59548c[_0x2357('0x27')]['message']);}})[_0x2357('0x28')](function(_0x2e7783){logger[_0x2357('0x23')](_0x2357('0x25'),_0x23373f,_0x2e7783);_0x3046e2(_0x2e7783);});});}function respondWithStatusCode(_0x4972c0,_0x59ed30){_0x59ed30=_0x59ed30||0xcc;return function(_0x1d6594){if(_0x1d6594){return _0x4972c0[_0x2357('0x29')](_0x59ed30);}return _0x4972c0[_0x2357('0x2a')](_0x59ed30)[_0x2357('0x2b')]();};}function respondWithResult(_0x3cb63f,_0xe40b7e){_0xe40b7e=_0xe40b7e||0xc8;return function(_0x5c8c78){if(_0x5c8c78){return _0x3cb63f[_0x2357('0x2a')](_0xe40b7e)[_0x2357('0x2c')](_0x5c8c78);}};}function respondWithFilteredResult(_0x1a4ffc,_0x14ccb6){return function(_0x1479c3){if(_0x1479c3){var _0x50f794=typeof _0x14ccb6[_0x2357('0x2d')]===_0x2357('0x2e')&&typeof _0x14ccb6[_0x2357('0x2f')]===_0x2357('0x2e');var _0x165bff=_0x1479c3[_0x2357('0x30')];var _0x1d89d4=_0x50f794?0x0:_0x14ccb6[_0x2357('0x2d')];var _0x1f8ce0=_0x50f794?_0x1479c3['count']:_0x14ccb6[_0x2357('0x2d')]+_0x14ccb6['limit'];var _0x263949;if(_0x1f8ce0>=_0x165bff){_0x1f8ce0=_0x165bff;_0x263949=0xc8;}else{_0x263949=0xce;}_0x1a4ffc[_0x2357('0x2a')](_0x263949);return _0x1a4ffc[_0x2357('0x31')](_0x2357('0x32'),_0x1d89d4+'-'+_0x1f8ce0+'/'+_0x165bff)[_0x2357('0x2c')](_0x1479c3);}return null;};}function patchUpdates(_0x113dce){return function(_0x2dd8e9){try{jsonpatch[_0x2357('0x33')](_0x2dd8e9,_0x113dce,!![]);}catch(_0x1be753){return BPromise['reject'](_0x1be753);}return _0x2dd8e9['save']();};}function saveUpdates(_0x39d8b6,_0x4f6266){return function(_0x35978c){if(_0x35978c){return _0x35978c['update'](_0x39d8b6)[_0x2357('0x34')](function(_0x300ba0){return _0x300ba0;});}return null;};}function removeEntity(_0x5c97d8,_0x18d53a){return function(_0x7ccb38){if(_0x7ccb38){return _0x7ccb38[_0x2357('0x35')]()[_0x2357('0x34')](function(){var _0x4735f6=_0x7ccb38[_0x2357('0x36')]({'plain':!![]});var _0x44b237=_0x2357('0x37');return db[_0x2357('0x38')][_0x2357('0x35')]({'where':{'type':_0x44b237,'resourceId':_0x4735f6['id']}})[_0x2357('0x34')](function(){return _0x7ccb38;});})[_0x2357('0x34')](function(){_0x5c97d8[_0x2357('0x2a')](0xcc)[_0x2357('0x2b')]();});}};}function handleEntityNotFound(_0x5a5d97,_0x278fce){return function(_0x32eb48){if(!_0x32eb48){_0x5a5d97[_0x2357('0x29')](0x194);}return _0x32eb48;};}function handleError(_0x2436ff,_0x567b22){_0x567b22=_0x567b22||0x1f4;return function(_0x2fc00d){logger['error'](_0x2fc00d[_0x2357('0x39')]);if(_0x2fc00d[_0x2357('0x3a')]){delete _0x2fc00d[_0x2357('0x3a')];}_0x2436ff['status'](_0x567b22)['send'](_0x2fc00d);};}exports[_0x2357('0x3b')]=function(_0x47b921,_0x502dde){var _0xf890cb={},_0x101093={},_0x24539f={'count':0x0,'rows':[]};var _0x2e30d3=_[_0x2357('0x3c')](db['ChatQueue'][_0x2357('0x3d')],function(_0x212293){return{'name':_0x212293[_0x2357('0x3e')],'type':_0x212293['type'][_0x2357('0x3f')]};});_0x101093['model']=_[_0x2357('0x3c')](_0x2e30d3,_0x2357('0x3a'));_0x101093[_0x2357('0x40')]=_[_0x2357('0x41')](_0x47b921[_0x2357('0x40')]);_0x101093[_0x2357('0x42')]=_['intersection'](_0x101093[_0x2357('0x43')],_0x101093['query']);_0xf890cb['attributes']=_['intersection'](_0x101093['model'],qs[_0x2357('0x44')](_0x47b921[_0x2357('0x40')]['fields']));_0xf890cb[_0x2357('0x45')]=_0xf890cb['attributes'][_0x2357('0x46')]?_0xf890cb[_0x2357('0x45')]:_0x101093[_0x2357('0x43')];if(!_0x47b921[_0x2357('0x40')][_0x2357('0x47')](_0x2357('0x48'))){_0xf890cb[_0x2357('0x2f')]=qs['limit'](_0x47b921['query'][_0x2357('0x2f')]);_0xf890cb[_0x2357('0x2d')]=qs[_0x2357('0x2d')](_0x47b921[_0x2357('0x40')][_0x2357('0x2d')]);}_0xf890cb['order']=qs[_0x2357('0x49')](_0x47b921['query'][_0x2357('0x49')]);_0xf890cb[_0x2357('0x4a')]=qs['filters'](_[_0x2357('0x4b')](_0x47b921[_0x2357('0x40')],_0x101093[_0x2357('0x42')]),_0x2e30d3);if(_0x47b921['query'][_0x2357('0x4c')]){_0xf890cb[_0x2357('0x4a')]=_[_0x2357('0x4d')](_0xf890cb[_0x2357('0x4a')],{'$or':_[_0x2357('0x3c')](_0x2e30d3,function(_0x25d4e4){if(_0x25d4e4['type']!=='VIRTUAL'){var _0x2aec50={};_0x2aec50[_0x25d4e4[_0x2357('0x3a')]]={'$like':'%'+_0x47b921[_0x2357('0x40')][_0x2357('0x4c')]+'%'};return _0x2aec50;}})});}_0xf890cb=_['merge']({},_0xf890cb,_0x47b921[_0x2357('0x4e')]);var _0x1be43c={'where':_0xf890cb[_0x2357('0x4a')]};return db[_0x2357('0x4f')][_0x2357('0x30')](_0x1be43c)[_0x2357('0x34')](function(_0x33cab1){_0x24539f['count']=_0x33cab1;if(_0x47b921[_0x2357('0x40')]['includeAll']){_0xf890cb[_0x2357('0x50')]=[{'all':!![]}];}return db['ChatQueue']['findAll'](_0xf890cb);})[_0x2357('0x34')](function(_0x5f326b){_0x24539f[_0x2357('0x51')]=_0x5f326b;return _0x24539f;})[_0x2357('0x34')](respondWithFilteredResult(_0x502dde,_0xf890cb))['catch'](handleError(_0x502dde,null));};exports[_0x2357('0x52')]=function(_0x22d36c,_0x43467a){var _0x3ca3da={'raw':!![],'where':{'id':_0x22d36c[_0x2357('0x53')]['id']}},_0x1cd7ed={};_0x1cd7ed['model']=_['keys'](db[_0x2357('0x4f')][_0x2357('0x3d')]);_0x1cd7ed[_0x2357('0x40')]=_[_0x2357('0x41')](_0x22d36c[_0x2357('0x40')]);_0x1cd7ed['filters']=_[_0x2357('0x54')](_0x1cd7ed['model'],_0x1cd7ed[_0x2357('0x40')]);_0x3ca3da['attributes']=_['intersection'](_0x1cd7ed[_0x2357('0x43')],qs[_0x2357('0x44')](_0x22d36c[_0x2357('0x40')][_0x2357('0x44')]));_0x3ca3da[_0x2357('0x45')]=_0x3ca3da['attributes'][_0x2357('0x46')]?_0x3ca3da[_0x2357('0x45')]:_0x1cd7ed[_0x2357('0x43')];if(_0x22d36c[_0x2357('0x40')][_0x2357('0x55')]){_0x3ca3da['include']=[{'all':!![]}];}_0x3ca3da=_[_0x2357('0x4d')]({},_0x3ca3da,_0x22d36c[_0x2357('0x4e')]);return db['ChatQueue'][_0x2357('0x56')](_0x3ca3da)[_0x2357('0x34')](handleEntityNotFound(_0x43467a,null))[_0x2357('0x34')](respondWithResult(_0x43467a,null))['catch'](handleError(_0x43467a,null));};exports[_0x2357('0x57')]=function(_0x2cbe9e,_0x10a842){return db[_0x2357('0x4f')]['create'](_0x2cbe9e[_0x2357('0x58')],{})['then'](function(_0x21fe74){var _0x27afc0=_0x2cbe9e[_0x2357('0x59')]['get']({'plain':!![]});if(!_0x27afc0)throw new Error(_0x2357('0x5a'));if(_0x27afc0[_0x2357('0x5b')]===_0x2357('0x59')){var _0x3efd6a=_0x21fe74[_0x2357('0x36')]({'plain':!![]});var _0x1df6c9=_0x2357('0x37');return db[_0x2357('0x5c')][_0x2357('0x56')]({'where':{'name':_0x1df6c9,'userProfileId':_0x27afc0[_0x2357('0x5d')]},'raw':!![]})[_0x2357('0x34')](function(_0x410136){if(_0x410136&&_0x410136[_0x2357('0x5e')]===0x0){return db['UserProfileResource'][_0x2357('0x57')]({'name':_0x3efd6a['name'],'resourceId':_0x3efd6a['id'],'type':_0x410136['name'],'sectionId':_0x410136['id']},{})[_0x2357('0x34')](function(){return _0x21fe74;});}else{return _0x21fe74;}})[_0x2357('0x28')](function(_0x4b5319){logger[_0x2357('0x23')](_0x2357('0x5f'),_0x4b5319);throw _0x4b5319;});}return _0x21fe74;})[_0x2357('0x34')](respondWithResult(_0x10a842,0xc9))['catch'](handleError(_0x10a842,null));};exports['update']=function(_0x41fa50,_0x1b72d5){if(_0x41fa50[_0x2357('0x58')]['id']){delete _0x41fa50[_0x2357('0x58')]['id'];}return db[_0x2357('0x4f')]['find']({'where':{'id':_0x41fa50[_0x2357('0x53')]['id']}})['then'](handleEntityNotFound(_0x1b72d5,null))[_0x2357('0x34')](saveUpdates(_0x41fa50['body'],null))[_0x2357('0x34')](respondWithResult(_0x1b72d5,null))[_0x2357('0x28')](handleError(_0x1b72d5,null));};exports[_0x2357('0x35')]=function(_0x16ff9b,_0x221050){return db[_0x2357('0x4f')]['find']({'where':{'id':_0x16ff9b['params']['id']}})['then'](handleEntityNotFound(_0x221050,null))[_0x2357('0x34')](removeEntity(_0x221050,null))['catch'](handleError(_0x221050,null));};exports[_0x2357('0x60')]=function(_0x2843b8,_0x32770a){return db['ChatQueue']['describe']()[_0x2357('0x34')](respondWithResult(_0x32770a,null))['catch'](handleError(_0x32770a,null));};exports[_0x2357('0x61')]=function(_0x16790b,_0x4ea3cc,_0x390697){var _0x6259ea={'raw':!![],'where':{}},_0x241c3f={},_0x37568f;return db[_0x2357('0x4f')][_0x2357('0x62')]({'where':{'id':_0x16790b[_0x2357('0x53')]['id']}})['then'](handleEntityNotFound(_0x4ea3cc,null))[_0x2357('0x34')](function(_0x11575e){if(_0x11575e){_0x37568f=_0x11575e['get']({'plain':!![]});_0x241c3f['model']=_[_0x2357('0x41')](db[_0x2357('0x63')]['rawAttributes']);_0x241c3f['query']=_[_0x2357('0x41')](_0x16790b[_0x2357('0x40')]);_0x241c3f['filters']=_[_0x2357('0x54')](_0x241c3f[_0x2357('0x43')],_0x241c3f[_0x2357('0x40')]);_0x6259ea[_0x2357('0x45')]=_[_0x2357('0x54')](_0x241c3f[_0x2357('0x43')],qs['fields'](_0x16790b[_0x2357('0x40')]['fields']));_0x6259ea[_0x2357('0x45')]=_0x6259ea[_0x2357('0x45')]['length']?_0x6259ea['attributes']:_0x241c3f[_0x2357('0x43')];if(!_0x16790b[_0x2357('0x40')]['hasOwnProperty'](_0x2357('0x48'))){_0x6259ea[_0x2357('0x2f')]=qs['limit'](_0x16790b[_0x2357('0x40')][_0x2357('0x2f')]);_0x6259ea[_0x2357('0x2d')]=qs['offset'](_0x16790b[_0x2357('0x40')][_0x2357('0x2d')]);}_0x6259ea[_0x2357('0x64')]=qs[_0x2357('0x49')](_0x16790b['query'][_0x2357('0x49')]);_0x6259ea[_0x2357('0x4a')]=qs['filters'](_['pick'](_0x16790b[_0x2357('0x40')],_0x241c3f[_0x2357('0x42')]));_0x6259ea[_0x2357('0x4a')][_0x2357('0x65')]=_0x11575e['id'];if(_0x16790b[_0x2357('0x40')][_0x2357('0x4c')]){_0x6259ea[_0x2357('0x4a')]=_[_0x2357('0x4d')](_0x6259ea['where'],{'$or':_[_0x2357('0x3c')](_0x6259ea['attributes'],function(_0x2d7fda){var _0x2fc915={};_0x2fc915[_0x2d7fda]={'$like':'%'+_0x16790b[_0x2357('0x40')][_0x2357('0x4c')]+'%'};return _0x2fc915;})});}_0x6259ea=_[_0x2357('0x4d')]({},_0x6259ea,_0x16790b['options']);return db[_0x2357('0x63')][_0x2357('0x66')](_0x6259ea);}})[_0x2357('0x34')](function(_0xab8a48){if(_0xab8a48){return db['User'][_0x2357('0x67')]({'where':{'id':_[_0x2357('0x3c')](_0xab8a48,_0x2357('0x68')),'role':_0x2357('0x69')},'attributes':['id',_0x2357('0x3a'),_0x2357('0x6a'),_0x2357('0x6b'),_0x2357('0x6c')]});}})[_0x2357('0x34')](function(_0x13f371){if(_0x13f371){return{'count':_0x13f371['count'],'rows':_[_0x2357('0x3c')](_0x13f371[_0x2357('0x51')],function(_0x7077a8){return{'membername':_0x7077a8[_0x2357('0x3a')],'UserId':_0x7077a8['id'],'queue_name':_0x37568f[_0x2357('0x3a')],'ChatQueueId':_0x37568f['id'],'interface':util[_0x2357('0x6d')]('%s/%s',_0x2357('0x6e'),_0x7077a8[_0x2357('0x3a')]),'penalty':0x0,'paused':_0x7077a8['chatPause'],'createdAt':_0x7077a8['createdAt'],'updatedAt':_0x7077a8[_0x2357('0x6b')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x4ea3cc,_0x6259ea))[_0x2357('0x28')](handleError(_0x4ea3cc,null));};exports[_0x2357('0x6f')]=function(_0xcd3e83,_0x8b8546,_0x5e42a5){var _0xd68cbb={};var _0x4dd001={};var _0x285664;var _0x37cef0;return db['ChatQueue'][_0x2357('0x62')]({'where':{'id':_0xcd3e83[_0x2357('0x53')]['id']}})[_0x2357('0x34')](handleEntityNotFound(_0x8b8546,null))[_0x2357('0x34')](function(_0x439670){if(_0x439670){_0x285664=_0x439670;_0x4dd001['model']=_[_0x2357('0x41')](db['Team'][_0x2357('0x3d')]);_0x4dd001[_0x2357('0x40')]=_['keys'](_0xcd3e83[_0x2357('0x40')]);_0x4dd001['filters']=_[_0x2357('0x54')](_0x4dd001[_0x2357('0x43')],_0x4dd001['query']);_0xd68cbb[_0x2357('0x45')]=_[_0x2357('0x54')](_0x4dd001[_0x2357('0x43')],qs['fields'](_0xcd3e83[_0x2357('0x40')]['fields']));_0xd68cbb[_0x2357('0x45')]=_0xd68cbb[_0x2357('0x45')]['length']?_0xd68cbb[_0x2357('0x45')]:_0x4dd001[_0x2357('0x43')];_0xd68cbb['order']=qs[_0x2357('0x49')](_0xcd3e83[_0x2357('0x40')]['sort']);_0xd68cbb[_0x2357('0x4a')]=qs[_0x2357('0x42')](_[_0x2357('0x4b')](_0xcd3e83[_0x2357('0x40')],_0x4dd001[_0x2357('0x42')]));if(_0xcd3e83[_0x2357('0x40')][_0x2357('0x4c')]){_0xd68cbb['where']=_['merge'](_0xd68cbb[_0x2357('0x4a')],{'$or':_[_0x2357('0x3c')](_0xd68cbb['attributes'],function(_0xaa2502){var _0x95900={};_0x95900[_0xaa2502]={'$like':'%'+_0xcd3e83['query'][_0x2357('0x4c')]+'%'};return _0x95900;})});}_0xd68cbb=_[_0x2357('0x4d')]({},_0xd68cbb,_0xcd3e83[_0x2357('0x4e')]);return _0x285664[_0x2357('0x6f')](_0xd68cbb);}})[_0x2357('0x34')](function(_0x11698){if(_0x11698){_0x37cef0=_0x11698[_0x2357('0x46')];if(!_0xcd3e83[_0x2357('0x40')]['hasOwnProperty']('nolimit')){_0xd68cbb['limit']=qs['limit'](_0xcd3e83['query'][_0x2357('0x2f')]);_0xd68cbb[_0x2357('0x2d')]=qs[_0x2357('0x2d')](_0xcd3e83['query']['offset']);}return _0x285664[_0x2357('0x6f')](_0xd68cbb);}})[_0x2357('0x34')](function(_0x4b3e12){if(_0x4b3e12){return _0x4b3e12?{'count':_0x37cef0,'rows':_0x4b3e12}:null;}})[_0x2357('0x34')](respondWithResult(_0x8b8546,null))[_0x2357('0x28')](handleError(_0x8b8546,null));};exports[_0x2357('0x70')]=function(_0x18a956,_0x57b4ee,_0x5bb198){var _0x4c500c=_0x18a956['body'][_0x2357('0x71')];return db[_0x2357('0x72')]['findAll']({'where':{'id':_0x4c500c},'attributes':['id'],'include':[{'model':db[_0x2357('0x73')],'as':_0x2357('0x74'),'attributes':['id',_0x2357('0x3a'),'online','voicePause',_0x2357('0x75')],'raw':!![]}]})[_0x2357('0x34')](function(_0x1701cd){if(_0x1701cd){var _0x55a450=_[_0x2357('0x76')](_0x1701cd,function(_0x54ebd6){var _0x206d6e=_0x54ebd6[_0x2357('0x36')]({'plain':!![]});return _0x206d6e[_0x2357('0x74')];});return db[_0x2357('0x4f')]['find']({'where':{'id':_0x18a956['params']['id']}})[_0x2357('0x34')](function(_0x569cc0){return db[_0x2357('0x77')]['transaction'](function(_0x5dd227){return _0x569cc0[_0x2357('0x70')](_0x4c500c,{'transaction':_0x5dd227})[_0x2357('0x34')](function(){return BPromise[_0x2357('0x78')](_0x55a450,function(_0x5ecdd1){return db[_0x2357('0x63')][_0x2357('0x79')]({'where':{'UserId':_0x5ecdd1['id'],'ChatQueueId':_0x18a956[_0x2357('0x53')]['id']},'transaction':_0x5dd227});});})[_0x2357('0x34')](function(){_0x55a450['forEach'](function(_0x3cc8dd){socket['emit'](_0x2357('0x7a'),{'UserId':_0x3cc8dd['id'],'ChatQueueId':_0x569cc0['id']});});});});});}})['then'](respondWithStatusCode(_0x57b4ee,null))[_0x2357('0x28')](handleError(_0x57b4ee,null));};exports[_0x2357('0x7b')]=function(_0x41bd4c,_0x25a528,_0x2289a9){return db[_0x2357('0x72')][_0x2357('0x66')]({'where':{'id':_0x41bd4c[_0x2357('0x40')]['ids']},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x25a528,null))[_0x2357('0x34')](function(_0x485152){var _0x27d631=_[_0x2357('0x3c')](_0x485152,'id');var _0x17985e=[];var _0x710a0d=[];var _0x2a84d6=squel[_0x2357('0x7c')]();_0x2a84d6[_0x2357('0x7d')](_0x2357('0x7e'))[_0x2357('0x7f')](_0x2357('0x80'),'tq')[_0x2357('0x81')](_0x2357('0x82'),'ut','ut.TeamId\x20=\x20tq.TeamId')['where'](_0x2357('0x83'),_0x41bd4c['params']['id']);for(var _0x3b1437=0x0;_0x3b1437<_0x485152[_0x2357('0x46')];_0x3b1437+=0x1){let _0x357257=_0x485152[_0x3b1437];for(var _0x3ae48e=0x0;_0x3ae48e<_0x357257[_0x2357('0x74')][_0x2357('0x46')];_0x3ae48e+=0x1){let _0x3a1689=_0x357257[_0x2357('0x74')][_0x3ae48e];var _0x4cc835=_0x2a84d6[_0x2357('0x84')]();_0x4cc835[_0x2357('0x4a')](_0x2357('0x85'),_0x3a1689['id']);_0x710a0d['push'](db[_0x2357('0x77')]['query'](_0x4cc835[_0x2357('0x86')](),{'type':db[_0x2357('0x77')][_0x2357('0x87')][_0x2357('0x88')]})[_0x2357('0x34')](function(_0x1776f4){if(_0x1776f4['length']===0x1){return _0x3a1689['id'];}else{var _0x53c9f3=_[_0x2357('0x89')](_[_0x2357('0x3c')](_0x1776f4,'TeamId'),function(_0x27f7f6){return _[_0x2357('0x8a')](_0x27d631,_0x27f7f6);});if(_0x53c9f3){return _0x3a1689['id'];}}}));}}return BPromise[_0x2357('0x8b')](_0x710a0d)[_0x2357('0x34')](function(_0x52b0c1){_0x17985e=_(_0x17985e)[_0x2357('0x8c')](_0x52b0c1)['compact']()[_0x2357('0x8d')]();return db[_0x2357('0x4f')][_0x2357('0x56')]({'where':{'id':_0x41bd4c['params']['id']}})[_0x2357('0x34')](function(_0x402512){return db[_0x2357('0x77')][_0x2357('0x8e')](function(_0x522c33){return _0x402512['removeTeams'](_0x41bd4c[_0x2357('0x40')][_0x2357('0x71')],{'transaction':_0x522c33})[_0x2357('0x34')](function(){if(!_[_0x2357('0x8f')](_0x17985e)){return _0x402512['removeAgents'](_0x17985e,{'transaction':_0x522c33});}})['then'](function(){_0x17985e[_0x2357('0x90')](function(_0xc9bca9){socket['emit'](_0x2357('0x91'),{'UserId':_0xc9bca9,'ChatQueueId':_0x402512['id']});});});});});});})[_0x2357('0x34')](respondWithStatusCode(_0x25a528,null))[_0x2357('0x28')](handleError(_0x25a528,null));};exports[_0x2357('0x92')]=function(_0x1119da,_0xaa0e6e,_0x230df3){return db['ChatQueue'][_0x2357('0x56')]({'where':{'id':_0x1119da[_0x2357('0x53')]['id']}})[_0x2357('0x34')](handleEntityNotFound(_0xaa0e6e,null))[_0x2357('0x34')](function(_0x78f1de){if(_0x78f1de){return _0x78f1de[_0x2357('0x92')](_0x1119da[_0x2357('0x58')][_0x2357('0x71')],_['omit'](_0x1119da['body'],[_0x2357('0x71'),'id'])||{})[_0x2357('0x93')](function(_0x483da7){for(var _0x4071c9=0x0;_0x4071c9<_0x1119da[_0x2357('0x58')][_0x2357('0x71')][_0x2357('0x46')];_0x4071c9+=0x1){socket[_0x2357('0x94')](_0x2357('0x7a'),{'UserId':Number(_0x1119da[_0x2357('0x58')][_0x2357('0x71')][_0x4071c9]),'ChatQueueId':Number(_0x1119da['params']['id'])});}return _0x483da7;});}})[_0x2357('0x34')](respondWithResult(_0xaa0e6e,null))[_0x2357('0x28')](handleError(_0xaa0e6e,null));};exports['removeAgents']=function(_0x32a35f,_0x5e35c9,_0xbda0fb){return db[_0x2357('0x4f')][_0x2357('0x56')]({'where':{'id':_0x32a35f[_0x2357('0x53')]['id']}})[_0x2357('0x34')](handleEntityNotFound(_0x5e35c9,null))['then'](function(_0x1fd4f3){if(_0x1fd4f3){return _0x1fd4f3[_0x2357('0x95')](_0x32a35f[_0x2357('0x40')][_0x2357('0x71')])[_0x2357('0x34')](function(){if(_[_0x2357('0x96')](_0x32a35f[_0x2357('0x40')]['ids'])){for(var _0x276e05=0x0;_0x276e05<_0x32a35f[_0x2357('0x40')][_0x2357('0x71')][_0x2357('0x46')];_0x276e05+=0x1){socket[_0x2357('0x94')](_0x2357('0x91'),{'UserId':Number(_0x32a35f['query'][_0x2357('0x71')][_0x276e05]),'ChatQueueId':Number(_0x32a35f[_0x2357('0x53')]['id'])});}}else{socket[_0x2357('0x94')]('userChatQueue:remove',{'UserId':Number(_0x32a35f[_0x2357('0x40')][_0x2357('0x71')]),'ChatQueueId':Number(_0x32a35f[_0x2357('0x53')]['id'])});}});}})[_0x2357('0x34')](respondWithStatusCode(_0x5e35c9,null))[_0x2357('0x28')](handleError(_0x5e35c9,null));};exports[_0x2357('0x97')]=function(_0xf2bc43,_0x594815,_0x20f369){var _0x5665a2={};var _0x4e1eea={};var _0x6da90c;var _0x1c9e25;return db[_0x2357('0x4f')]['findOne']({'where':{'id':_0xf2bc43['params']['id']}})[_0x2357('0x34')](handleEntityNotFound(_0x594815,null))[_0x2357('0x34')](function(_0x388e32){if(_0x388e32){_0x6da90c=_0x388e32;_0x4e1eea[_0x2357('0x43')]=_[_0x2357('0x41')](db[_0x2357('0x73')]['rawAttributes']);_0x4e1eea['query']=_['keys'](_0xf2bc43[_0x2357('0x40')]);_0x4e1eea[_0x2357('0x42')]=_[_0x2357('0x54')](_0x4e1eea[_0x2357('0x43')],_0x4e1eea[_0x2357('0x40')]);_0x5665a2[_0x2357('0x45')]=_['intersection'](_0x4e1eea[_0x2357('0x43')],qs['fields'](_0xf2bc43['query'][_0x2357('0x44')]));_0x5665a2[_0x2357('0x45')]=_0x5665a2[_0x2357('0x45')][_0x2357('0x46')]?_0x5665a2[_0x2357('0x45')]:_0x4e1eea[_0x2357('0x43')];_0x5665a2[_0x2357('0x64')]=qs[_0x2357('0x49')](_0xf2bc43[_0x2357('0x40')][_0x2357('0x49')]);_0x5665a2[_0x2357('0x4a')]=qs[_0x2357('0x42')](_[_0x2357('0x4b')](_0xf2bc43[_0x2357('0x40')],_0x4e1eea[_0x2357('0x42')]));if(_0xf2bc43[_0x2357('0x40')][_0x2357('0x4c')]){_0x5665a2[_0x2357('0x4a')]=_[_0x2357('0x4d')](_0x5665a2[_0x2357('0x4a')],{'$or':_['map'](_0x5665a2[_0x2357('0x45')],function(_0x4fb6b1){var _0x379e65={};_0x379e65[_0x4fb6b1]={'$like':'%'+_0xf2bc43[_0x2357('0x40')][_0x2357('0x4c')]+'%'};return _0x379e65;})});}_0x5665a2=_['merge']({},_0x5665a2,_0xf2bc43[_0x2357('0x4e')]);return _0x6da90c[_0x2357('0x97')](_0x5665a2);}})[_0x2357('0x34')](function(_0x48910){if(_0x48910){_0x1c9e25=_0x48910['length'];if(!_0xf2bc43[_0x2357('0x40')][_0x2357('0x47')](_0x2357('0x48'))){_0x5665a2[_0x2357('0x2f')]=qs[_0x2357('0x2f')](_0xf2bc43[_0x2357('0x40')][_0x2357('0x2f')]);_0x5665a2[_0x2357('0x2d')]=qs['offset'](_0xf2bc43[_0x2357('0x40')][_0x2357('0x2d')]);}return _0x6da90c[_0x2357('0x97')](_0x5665a2);}})[_0x2357('0x34')](function(_0x52deed){if(_0x52deed){return _0x52deed?{'count':_0x1c9e25,'rows':_0x52deed}:null;}})[_0x2357('0x34')](respondWithResult(_0x594815,null))[_0x2357('0x28')](handleError(_0x594815,null));}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.events.js b/server/api/chatQueue/chatQueue.events.js index 2d89dd3..007b923 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 _0xb19f=['update','remove','emit','hasOwnProperty','exports','events','../../mysqldb','save'];(function(_0x15d409,_0x16c2ee){var _0x379106=function(_0x3ab526){while(--_0x3ab526){_0x15d409['push'](_0x15d409['shift']());}};_0x379106(++_0x16c2ee);}(_0xb19f,0x7d));var _0xfb19=function(_0x5a4b42,_0x2b9c18){_0x5a4b42=_0x5a4b42-0x0;var _0x5e81d6=_0xb19f[_0x5a4b42];return _0x5e81d6;};'use strict';var EventEmitter=require(_0xfb19('0x0'));var ChatQueue=require(_0xfb19('0x1'))['db']['ChatQueue'];var ChatQueueEvents=new EventEmitter();ChatQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xfb19('0x2'),'afterUpdate':_0xfb19('0x3'),'afterDestroy':_0xfb19('0x4')};function emitEvent(_0x4ca48b){return function(_0xe1c6f9,_0x585ed2,_0x520a16){ChatQueueEvents['emit'](_0x4ca48b+':'+_0xe1c6f9['id'],_0xe1c6f9);ChatQueueEvents[_0xfb19('0x5')](_0x4ca48b,_0xe1c6f9);_0x520a16(null);};}for(var e in events){if(events[_0xfb19('0x6')](e)){var event=events[e];ChatQueue['hook'](e,emitEvent(event));}}module[_0xfb19('0x7')]=ChatQueueEvents; \ No newline at end of file +var _0x0662=['emit','hasOwnProperty','hook','exports','../../mysqldb','ChatQueue','setMaxListeners','save','remove'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x0662,0x175));var _0x2066=function(_0x110c3d,_0x12ee06){_0x110c3d=_0x110c3d-0x0;var _0x226d67=_0x0662[_0x110c3d];return _0x226d67;};'use strict';var EventEmitter=require('events');var ChatQueue=require(_0x2066('0x0'))['db'][_0x2066('0x1')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0x2066('0x2')](0x0);var events={'afterCreate':_0x2066('0x3'),'afterUpdate':'update','afterDestroy':_0x2066('0x4')};function emitEvent(_0x1bef84){return function(_0x782930,_0x278653,_0x1db5d5){ChatQueueEvents[_0x2066('0x5')](_0x1bef84+':'+_0x782930['id'],_0x782930);ChatQueueEvents[_0x2066('0x5')](_0x1bef84,_0x782930);_0x1db5d5(null);};}for(var e in events){if(events[_0x2066('0x6')](e)){var event=events[e];ChatQueue[_0x2066('0x7')](e,emitEvent(event));}}module[_0x2066('0x8')]=ChatQueueEvents; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.model.js b/server/api/chatQueue/chatQueue.model.js index ff9f4ea..dfddacc 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 _0xab31=['exports','define','chat_queues','util','api','bluebird','request-promise','path','rimraf','../../config/environment','./chatQueue.attributes'];(function(_0x298a31,_0x29f9ed){var _0x1f254f=function(_0xe20666){while(--_0xe20666){_0x298a31['push'](_0x298a31['shift']());}};_0x1f254f(++_0x29f9ed);}(_0xab31,0x87));var _0x1ab3=function(_0x384e5d,_0x5cedea){_0x384e5d=_0x384e5d-0x0;var _0x47ef61=_0xab31[_0x384e5d];return _0x47ef61;};'use strict';var _=require('lodash');var util=require(_0x1ab3('0x0'));var logger=require('../../config/logger')(_0x1ab3('0x1'));var moment=require('moment');var BPromise=require(_0x1ab3('0x2'));var rp=require(_0x1ab3('0x3'));var fs=require('fs');var path=require(_0x1ab3('0x4'));var rimraf=require(_0x1ab3('0x5'));var config=require(_0x1ab3('0x6'));var attributes=require(_0x1ab3('0x7'));module[_0x1ab3('0x8')]=function(_0x314020,_0x5c7c0c){return _0x314020[_0x1ab3('0x9')]('ChatQueue',attributes,{'tableName':_0x1ab3('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0a5c=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatQueue.attributes','exports','define','ChatQueue','chat_queues','lodash','util','../../config/logger','api'];(function(_0x31a755,_0x203ce1){var _0x4aa72b=function(_0xa3568c){while(--_0xa3568c){_0x31a755['push'](_0x31a755['shift']());}};_0x4aa72b(++_0x203ce1);}(_0x0a5c,0x1af));var _0xc0a5=function(_0x42bdad,_0x12836c){_0x42bdad=_0x42bdad-0x0;var _0x122626=_0x0a5c[_0x42bdad];return _0x122626;};'use strict';var _=require(_0xc0a5('0x0'));var util=require(_0xc0a5('0x1'));var logger=require(_0xc0a5('0x2'))(_0xc0a5('0x3'));var moment=require(_0xc0a5('0x4'));var BPromise=require(_0xc0a5('0x5'));var rp=require(_0xc0a5('0x6'));var fs=require('fs');var path=require(_0xc0a5('0x7'));var rimraf=require(_0xc0a5('0x8'));var config=require(_0xc0a5('0x9'));var attributes=require(_0xc0a5('0xa'));module[_0xc0a5('0xb')]=function(_0x3aaaf6,_0x269c4e){return _0x3aaaf6[_0xc0a5('0xc')](_0xc0a5('0xd'),attributes,{'tableName':_0xc0a5('0xe'),'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 b516964..6cbeaf4 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 _0x342c=['then','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./chatQueue.socket','register','request','info','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','GetChatQueue','findAll','raw','options','where','attributes','limit','include','map','model','catch','ShowChatQueue','ChatQueue'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x342c,0x149));var _0xc342=function(_0x466882,_0x505c6a){_0x466882=_0x466882-0x0;var _0x1d8053=_0x342c[_0x466882];return _0x1d8053;};'use strict';var _=require(_0xc342('0x0'));var util=require(_0xc342('0x1'));var moment=require('moment');var BPromise=require(_0xc342('0x2'));var rs=require(_0xc342('0x3'));var fs=require('fs');var Redis=require(_0xc342('0x4'));var db=require(_0xc342('0x5'))['db'];var utils=require(_0xc342('0x6'));var logger=require('../../config/logger')(_0xc342('0x7'));var config=require(_0xc342('0x8'));var jayson=require(_0xc342('0x9'));var client=jayson[_0xc342('0xa')]['http']({'port':0x232a});config[_0xc342('0xb')]=_[_0xc342('0xc')](config['redis'],{'host':_0xc342('0xd'),'port':0x18eb});var socket=require(_0xc342('0xe'))(new Redis(config['redis']));require(_0xc342('0xf'))[_0xc342('0x10')](socket);function respondWithRpcPromise(_0x451ecf,_0x29a751,_0x55a04c){return new BPromise(function(_0x41db94,_0x4228b9){return client[_0xc342('0x11')](_0x451ecf,_0x55a04c)['then'](function(_0x356575){logger[_0xc342('0x12')](_0xc342('0x13'),_0x29a751,_0xc342('0x14'));logger[_0xc342('0x15')]('ChatQueue,\x20%s,\x20%s,\x20%s',_0x29a751,_0xc342('0x14'),JSON[_0xc342('0x16')](_0x356575));if(_0x356575['error']){if(_0x356575[_0xc342('0x17')][_0xc342('0x18')]===0x1f4){logger[_0xc342('0x17')](_0xc342('0x13'),_0x29a751,_0x356575[_0xc342('0x17')][_0xc342('0x19')]);return _0x4228b9(_0x356575[_0xc342('0x17')][_0xc342('0x19')]);}logger['error'](_0xc342('0x13'),_0x29a751,_0x356575[_0xc342('0x17')][_0xc342('0x19')]);return _0x41db94(_0x356575['error'][_0xc342('0x19')]);}else{logger[_0xc342('0x12')](_0xc342('0x13'),_0x29a751,_0xc342('0x14'));_0x41db94(_0x356575[_0xc342('0x1a')][_0xc342('0x19')]);}})['catch'](function(_0x163c01){logger['error'](_0xc342('0x13'),_0x29a751,_0x163c01);_0x4228b9(_0x163c01);});});}exports[_0xc342('0x1b')]=function(_0x4377cb){var _0x24e8c8=this;return new Promise(function(_0xe6b1ed,_0x2e5e59){return db['ChatQueue'][_0xc342('0x1c')]({'raw':_0x4377cb['options']?_0x4377cb['options'][_0xc342('0x1d')]===undefined?!![]:![]:!![],'where':_0x4377cb['options']?_0x4377cb[_0xc342('0x1e')][_0xc342('0x1f')]||null:null,'attributes':_0x4377cb['options']?_0x4377cb[_0xc342('0x1e')][_0xc342('0x20')]||null:null,'limit':_0x4377cb[_0xc342('0x1e')]?_0x4377cb[_0xc342('0x1e')][_0xc342('0x21')]||null:null,'include':_0x4377cb['options']?_0x4377cb[_0xc342('0x1e')][_0xc342('0x22')]?_[_0xc342('0x23')](_0x4377cb[_0xc342('0x1e')]['include'],function(_0x34c7fd){return{'model':db[_0x34c7fd['model']],'as':_0x34c7fd['as'],'attributes':_0x34c7fd['attributes'],'include':_0x34c7fd[_0xc342('0x22')]?_[_0xc342('0x23')](_0x34c7fd[_0xc342('0x22')],function(_0xffe9fd){return{'model':db[_0xffe9fd[_0xc342('0x24')]],'as':_0xffe9fd['as'],'attributes':_0xffe9fd[_0xc342('0x20')],'include':_0xffe9fd[_0xc342('0x22')]?_['map'](_0xffe9fd[_0xc342('0x22')],function(_0x318e6f){return{'model':db[_0x318e6f[_0xc342('0x24')]],'as':_0x318e6f['as'],'attributes':_0x318e6f[_0xc342('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1051aa){logger[_0xc342('0x12')](_0xc342('0x1b'),_0x4377cb);logger[_0xc342('0x15')](_0xc342('0x1b'),_0x4377cb,JSON['stringify'](_0x1051aa));_0xe6b1ed(_0x1051aa);})[_0xc342('0x25')](function(_0x12432e){logger[_0xc342('0x17')](_0xc342('0x1b'),_0x12432e['message'],_0x4377cb);_0x2e5e59(_0x24e8c8[_0xc342('0x17')](0x1f4,_0x12432e[_0xc342('0x19')]));});});};exports[_0xc342('0x26')]=function(_0x509b3b){var _0x4520c3=this;return new Promise(function(_0x3d5da7,_0x2cadd9){return db[_0xc342('0x27')]['find']({'raw':_0x509b3b[_0xc342('0x1e')]?_0x509b3b[_0xc342('0x1e')][_0xc342('0x1d')]===undefined?!![]:![]:!![],'where':_0x509b3b[_0xc342('0x1e')]?_0x509b3b[_0xc342('0x1e')][_0xc342('0x1f')]||null:null,'attributes':_0x509b3b['options']?_0x509b3b[_0xc342('0x1e')][_0xc342('0x20')]||null:null,'include':_0x509b3b[_0xc342('0x1e')]?_0x509b3b[_0xc342('0x1e')][_0xc342('0x22')]?_[_0xc342('0x23')](_0x509b3b[_0xc342('0x1e')][_0xc342('0x22')],function(_0x156956){return{'model':db[_0x156956[_0xc342('0x24')]],'as':_0x156956['as'],'attributes':_0x156956['attributes'],'include':_0x156956[_0xc342('0x22')]?_[_0xc342('0x23')](_0x156956[_0xc342('0x22')],function(_0x182e3a){return{'model':db[_0x182e3a[_0xc342('0x24')]],'as':_0x182e3a['as'],'attributes':_0x182e3a[_0xc342('0x20')],'include':_0x182e3a[_0xc342('0x22')]?_[_0xc342('0x23')](_0x182e3a[_0xc342('0x22')],function(_0x3ae15e){return{'model':db[_0x3ae15e[_0xc342('0x24')]],'as':_0x3ae15e['as'],'attributes':_0x3ae15e['attributes']};}):[]};}):[]};}):[]:[]})[_0xc342('0x28')](function(_0x3c33c4){logger[_0xc342('0x12')](_0xc342('0x26'),_0x509b3b);logger['debug']('ShowChatQueue',_0x509b3b,JSON[_0xc342('0x16')](_0x3c33c4));_0x3d5da7(_0x3c33c4);})[_0xc342('0x25')](function(_0x24b3ae){logger[_0xc342('0x17')](_0xc342('0x26'),_0x24b3ae[_0xc342('0x19')],_0x509b3b);_0x2cadd9(_0x4520c3[_0xc342('0x17')](0x1f4,_0x24b3ae[_0xc342('0x19')]));});});}; \ No newline at end of file +var _0x161a=['../../config/logger','jayson/promise','client','http','redis','defaults','localhost','./chatQueue.socket','register','request','then','info','ChatQueue,\x20%s,\x20%s','debug','ChatQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','GetChatQueue','findAll','options','raw','where','attributes','limit','include','map','model','ShowChatQueue','moment','bluebird','ioredis','../../config/utils'];(function(_0x1b3db4,_0x3be734){var _0x294216=function(_0x3bce45){while(--_0x3bce45){_0x1b3db4['push'](_0x1b3db4['shift']());}};_0x294216(++_0x3be734);}(_0x161a,0x140));var _0xa161=function(_0x2de0a7,_0x38d3e7){_0x2de0a7=_0x2de0a7-0x0;var _0x429437=_0x161a[_0x2de0a7];return _0x429437;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xa161('0x0'));var BPromise=require(_0xa161('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa161('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xa161('0x3'));var logger=require(_0xa161('0x4'))('rpc');var config=require('../../config/environment');var jayson=require(_0xa161('0x5'));var client=jayson[_0xa161('0x6')][_0xa161('0x7')]({'port':0x232a});config[_0xa161('0x8')]=_[_0xa161('0x9')](config[_0xa161('0x8')],{'host':_0xa161('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa161('0x8')]));require(_0xa161('0xb'))[_0xa161('0xc')](socket);function respondWithRpcPromise(_0x3d3074,_0x306e62,_0x1a3301){return new BPromise(function(_0x1c443e,_0x29f617){return client[_0xa161('0xd')](_0x3d3074,_0x1a3301)[_0xa161('0xe')](function(_0x29574e){logger[_0xa161('0xf')](_0xa161('0x10'),_0x306e62,'request\x20sent');logger[_0xa161('0x11')](_0xa161('0x12'),_0x306e62,_0xa161('0x13'),JSON[_0xa161('0x14')](_0x29574e));if(_0x29574e['error']){if(_0x29574e[_0xa161('0x15')][_0xa161('0x16')]===0x1f4){logger['error'](_0xa161('0x10'),_0x306e62,_0x29574e[_0xa161('0x15')]['message']);return _0x29f617(_0x29574e[_0xa161('0x15')][_0xa161('0x17')]);}logger[_0xa161('0x15')]('ChatQueue,\x20%s,\x20%s',_0x306e62,_0x29574e[_0xa161('0x15')][_0xa161('0x17')]);return _0x1c443e(_0x29574e[_0xa161('0x15')][_0xa161('0x17')]);}else{logger[_0xa161('0xf')](_0xa161('0x10'),_0x306e62,_0xa161('0x13'));_0x1c443e(_0x29574e['result'][_0xa161('0x17')]);}})[_0xa161('0x18')](function(_0x55c558){logger[_0xa161('0x15')]('ChatQueue,\x20%s,\x20%s',_0x306e62,_0x55c558);_0x29f617(_0x55c558);});});}exports[_0xa161('0x19')]=function(_0x3ccf0c){var _0x2dd796=this;return new Promise(function(_0x269d56,_0xf6cd86){return db['ChatQueue'][_0xa161('0x1a')]({'raw':_0x3ccf0c[_0xa161('0x1b')]?_0x3ccf0c[_0xa161('0x1b')][_0xa161('0x1c')]===undefined?!![]:![]:!![],'where':_0x3ccf0c[_0xa161('0x1b')]?_0x3ccf0c[_0xa161('0x1b')][_0xa161('0x1d')]||null:null,'attributes':_0x3ccf0c[_0xa161('0x1b')]?_0x3ccf0c[_0xa161('0x1b')][_0xa161('0x1e')]||null:null,'limit':_0x3ccf0c[_0xa161('0x1b')]?_0x3ccf0c['options'][_0xa161('0x1f')]||null:null,'include':_0x3ccf0c[_0xa161('0x1b')]?_0x3ccf0c[_0xa161('0x1b')][_0xa161('0x20')]?_[_0xa161('0x21')](_0x3ccf0c[_0xa161('0x1b')][_0xa161('0x20')],function(_0x2b1331){return{'model':db[_0x2b1331[_0xa161('0x22')]],'as':_0x2b1331['as'],'attributes':_0x2b1331[_0xa161('0x1e')],'include':_0x2b1331[_0xa161('0x20')]?_['map'](_0x2b1331[_0xa161('0x20')],function(_0x492da1){return{'model':db[_0x492da1[_0xa161('0x22')]],'as':_0x492da1['as'],'attributes':_0x492da1[_0xa161('0x1e')],'include':_0x492da1[_0xa161('0x20')]?_[_0xa161('0x21')](_0x492da1[_0xa161('0x20')],function(_0x20ce3c){return{'model':db[_0x20ce3c[_0xa161('0x22')]],'as':_0x20ce3c['as'],'attributes':_0x20ce3c[_0xa161('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xa161('0xe')](function(_0x150e36){logger[_0xa161('0xf')](_0xa161('0x19'),_0x3ccf0c);logger[_0xa161('0x11')](_0xa161('0x19'),_0x3ccf0c,JSON[_0xa161('0x14')](_0x150e36));_0x269d56(_0x150e36);})['catch'](function(_0x3579b6){logger['error'](_0xa161('0x19'),_0x3579b6['message'],_0x3ccf0c);_0xf6cd86(_0x2dd796[_0xa161('0x15')](0x1f4,_0x3579b6[_0xa161('0x17')]));});});};exports[_0xa161('0x23')]=function(_0x15f3d9){var _0x527870=this;return new Promise(function(_0x306cd5,_0x2a2cdf){return db['ChatQueue']['find']({'raw':_0x15f3d9[_0xa161('0x1b')]?_0x15f3d9['options']['raw']===undefined?!![]:![]:!![],'where':_0x15f3d9['options']?_0x15f3d9[_0xa161('0x1b')][_0xa161('0x1d')]||null:null,'attributes':_0x15f3d9[_0xa161('0x1b')]?_0x15f3d9[_0xa161('0x1b')][_0xa161('0x1e')]||null:null,'include':_0x15f3d9[_0xa161('0x1b')]?_0x15f3d9['options'][_0xa161('0x20')]?_['map'](_0x15f3d9[_0xa161('0x1b')][_0xa161('0x20')],function(_0x56417e){return{'model':db[_0x56417e[_0xa161('0x22')]],'as':_0x56417e['as'],'attributes':_0x56417e[_0xa161('0x1e')],'include':_0x56417e[_0xa161('0x20')]?_['map'](_0x56417e[_0xa161('0x20')],function(_0x305902){return{'model':db[_0x305902[_0xa161('0x22')]],'as':_0x305902['as'],'attributes':_0x305902[_0xa161('0x1e')],'include':_0x305902[_0xa161('0x20')]?_[_0xa161('0x21')](_0x305902[_0xa161('0x20')],function(_0x533a27){return{'model':db[_0x533a27[_0xa161('0x22')]],'as':_0x533a27['as'],'attributes':_0x533a27['attributes']};}):[]};}):[]};}):[]:[]})[_0xa161('0xe')](function(_0x54a278){logger[_0xa161('0xf')](_0xa161('0x23'),_0x15f3d9);logger['debug']('ShowChatQueue',_0x15f3d9,JSON['stringify'](_0x54a278));_0x306cd5(_0x54a278);})[_0xa161('0x18')](function(_0x133f1c){logger[_0xa161('0x15')]('ShowChatQueue',_0x133f1c[_0xa161('0x17')],_0x15f3d9);_0x2a2cdf(_0x527870[_0xa161('0x15')](0x1f4,_0x133f1c[_0xa161('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.socket.js b/server/api/chatQueue/chatQueue.socket.js index c67c60f..4668117 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 _0x4b84=['./chatQueue.events','save','emit','length'];(function(_0x1f62e3,_0x56649a){var _0x4bf19c=function(_0x58dee5){while(--_0x58dee5){_0x1f62e3['push'](_0x1f62e3['shift']());}};_0x4bf19c(++_0x56649a);}(_0x4b84,0x1cc));var _0x44b8=function(_0x5bfa44,_0x76dacc){_0x5bfa44=_0x5bfa44-0x0;var _0x43815f=_0x4b84[_0x5bfa44];return _0x43815f;};'use strict';var ChatQueueEvents=require(_0x44b8('0x0'));var events=[_0x44b8('0x1'),'remove','update'];function createListener(_0x765943,_0x519db3){return function(_0x4b8ad8){_0x519db3[_0x44b8('0x2')](_0x765943,_0x4b8ad8);};}function removeListener(_0x31282a,_0x39ad16){return function(){ChatQueueEvents['removeListener'](_0x31282a,_0x39ad16);};}exports['register']=function(_0x55f25d){for(var _0x996a8b=0x0,_0x54274b=events[_0x44b8('0x3')];_0x996a8b<_0x54274b;_0x996a8b++){var _0x5947f7=events[_0x996a8b];var _0x3e87c5=createListener('chatQueue:'+_0x5947f7,_0x55f25d);ChatQueueEvents['on'](_0x5947f7,_0x3e87c5);}}; \ No newline at end of file +var _0xed1f=['register','length','./chatQueue.events','save','remove','update','emit','removeListener'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0xed1f,0x6a));var _0xfed1=function(_0x178e48,_0x3c9509){_0x178e48=_0x178e48-0x0;var _0x440d7e=_0xed1f[_0x178e48];return _0x440d7e;};'use strict';var ChatQueueEvents=require(_0xfed1('0x0'));var events=[_0xfed1('0x1'),_0xfed1('0x2'),_0xfed1('0x3')];function createListener(_0xa45937,_0x25f345){return function(_0x1dd614){_0x25f345[_0xfed1('0x4')](_0xa45937,_0x1dd614);};}function removeListener(_0x2209b3,_0x45c3c1){return function(){ChatQueueEvents[_0xfed1('0x5')](_0x2209b3,_0x45c3c1);};}exports[_0xfed1('0x6')]=function(_0x3d6706){for(var _0x42751d=0x0,_0x380e18=events[_0xfed1('0x7')];_0x42751d<_0x380e18;_0x42751d++){var _0x2a6082=events[_0x42751d];var _0x2967ef=createListener('chatQueue:'+_0x2a6082,_0x3d6706);ChatQueueEvents['on'](_0x2a6082,_0x2967ef);}}; \ No newline at end of file diff --git a/server/api/chatQueue/index.js b/server/api/chatQueue/index.js index a786178..afbfb80 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(_0x104112,_0x342eb6){var _0x394ab4=function(_0x48db18){while(--_0x48db18){_0x104112['push'](_0x104112['shift']());}};_0x394ab4(++_0x342eb6);}(_0x55ca,0x126));var _0xa55c=function(_0xc1263e,_0x56d738){_0xc1263e=_0xc1263e-0x0;var _0x471f07=_0x55ca[_0xc1263e];return _0x471f07;};'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 _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(_0x6eae2,_0x5e3b82){var _0x5def02=function(_0x168cad){while(--_0x168cad){_0x6eae2['push'](_0x6eae2['shift']());}};_0x5def02(++_0x5e3b82);}(_0x55ca,0x126));var _0xa55c=function(_0x2e689d,_0x4c3b29){_0x2e689d=_0x2e689d-0x0;var _0x540160=_0x55ca[_0x2e689d];return _0x540160;};'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 diff --git a/server/api/chatQueueReport/chatQueueReport.attributes.js b/server/api/chatQueueReport/chatQueueReport.attributes.js index 016dd0f..37ad961 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 _0x132d=['DATE','moment','sequelize','exports','STRING'];(function(_0x14d560,_0x4b390c){var _0x52d471=function(_0x4ffbdd){while(--_0x4ffbdd){_0x14d560['push'](_0x14d560['shift']());}};_0x52d471(++_0x4b390c);}(_0x132d,0xc9));var _0xd132=function(_0x23a3a5,_0x5ca1fe){_0x23a3a5=_0x23a3a5-0x0;var _0x4ef29e=_0x132d[_0x23a3a5];return _0x4ef29e;};'use strict';var moment=require(_0xd132('0x0'));var Sequelize=require(_0xd132('0x1'));module[_0xd132('0x2')]={'uniqueid':{'type':Sequelize[_0xd132('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0xd132('0x3')]},'joinAt':{'type':Sequelize[_0xd132('0x4')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0xd132('0x4')]},'reason':{'type':Sequelize[_0xd132('0x3')]}}; \ No newline at end of file +var _0x3072=['DATE','sequelize','exports','STRING'];(function(_0x3bde1b,_0x8f8f7d){var _0x1029f2=function(_0x24ad4c){while(--_0x24ad4c){_0x3bde1b['push'](_0x3bde1b['shift']());}};_0x1029f2(++_0x8f8f7d);}(_0x3072,0xe1));var _0x2307=function(_0x4d9540,_0x26cc84){_0x4d9540=_0x4d9540-0x0;var _0x2d211e=_0x3072[_0x4d9540];return _0x2d211e;};'use strict';var moment=require('moment');var Sequelize=require(_0x2307('0x0'));module[_0x2307('0x1')]={'uniqueid':{'type':Sequelize[_0x2307('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x2307('0x2')]},'joinAt':{'type':Sequelize[_0x2307('0x3')]},'leaveAt':{'type':Sequelize[_0x2307('0x3')]},'acceptAt':{'type':Sequelize[_0x2307('0x3')]},'exitAt':{'type':Sequelize[_0x2307('0x3')]},'reason':{'type':Sequelize[_0x2307('0x2')]}}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.controller.js b/server/api/chatQueueReport/chatQueueReport.controller.js index cf10c3e..0dadd95 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 _0x6eed=['stack','name','index','map','ChatQueueReport','fieldName','type','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','merge','where','VIRTUAL','filter','options','include','findAll','rows','params','rawAttributes','find','catch','create','update','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','jsforce','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','limit','count','set','Content-Range','reject','save','then','destroy','end','error'];(function(_0x28d1ee,_0x855ec5){var _0x569b83=function(_0x2373b2){while(--_0x2373b2){_0x28d1ee['push'](_0x28d1ee['shift']());}};_0x569b83(++_0x855ec5);}(_0x6eed,0xff));var _0xd6ee=function(_0x47aef8,_0x1acbea){_0x47aef8=_0x47aef8-0x0;var _0x43d389=_0x6eed[_0x47aef8];return _0x43d389;};'use strict';var emlformat=require(_0xd6ee('0x0'));var rimraf=require(_0xd6ee('0x1'));var zipdir=require(_0xd6ee('0x2'));var jsonpatch=require(_0xd6ee('0x3'));var rp=require(_0xd6ee('0x4'));var moment=require('moment');var BPromise=require(_0xd6ee('0x5'));var Mustache=require(_0xd6ee('0x6'));var util=require('util');var path=require('path');var sox=require(_0xd6ee('0x7'));var csv=require(_0xd6ee('0x8'));var ejs=require(_0xd6ee('0x9'));var fs=require('fs');var fs_extra=require(_0xd6ee('0xa'));var _=require(_0xd6ee('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xd6ee('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xd6ee('0xd'));var Redis=require(_0xd6ee('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xd6ee('0xf'));var as=require(_0xd6ee('0x10'));var hardwareService=require(_0xd6ee('0x11'));var logger=require(_0xd6ee('0x12'))('api');var utils=require(_0xd6ee('0x13'));var config=require(_0xd6ee('0x14'));var licenseUtil=require(_0xd6ee('0x15'));var db=require(_0xd6ee('0x16'))['db'];function respondWithStatusCode(_0x268dd1,_0x3fd1df){_0x3fd1df=_0x3fd1df||0xcc;return function(_0x48be63){if(_0x48be63){return _0x268dd1[_0xd6ee('0x17')](_0x3fd1df);}return _0x268dd1[_0xd6ee('0x18')](_0x3fd1df)['end']();};}function respondWithResult(_0x369b4a,_0x15918d){_0x15918d=_0x15918d||0xc8;return function(_0x2bf3b2){if(_0x2bf3b2){return _0x369b4a[_0xd6ee('0x18')](_0x15918d)[_0xd6ee('0x19')](_0x2bf3b2);}};}function respondWithFilteredResult(_0xe66d0d,_0x49bafc){return function(_0x1c2e51){if(_0x1c2e51){var _0xb99b70=typeof _0x49bafc[_0xd6ee('0x1a')]==='undefined'&&typeof _0x49bafc[_0xd6ee('0x1b')]==='undefined';var _0x3a82bf=_0x1c2e51[_0xd6ee('0x1c')];var _0x81d533=_0xb99b70?0x0:_0x49bafc['offset'];var _0x8a2718=_0xb99b70?_0x1c2e51['count']:_0x49bafc[_0xd6ee('0x1a')]+_0x49bafc['limit'];var _0x31ae0f;if(_0x8a2718>=_0x3a82bf){_0x8a2718=_0x3a82bf;_0x31ae0f=0xc8;}else{_0x31ae0f=0xce;}_0xe66d0d[_0xd6ee('0x18')](_0x31ae0f);return _0xe66d0d[_0xd6ee('0x1d')](_0xd6ee('0x1e'),_0x81d533+'-'+_0x8a2718+'/'+_0x3a82bf)[_0xd6ee('0x19')](_0x1c2e51);}return null;};}function patchUpdates(_0x4b33f1){return function(_0xe2f8c4){try{jsonpatch['apply'](_0xe2f8c4,_0x4b33f1,!![]);}catch(_0x17e011){return BPromise[_0xd6ee('0x1f')](_0x17e011);}return _0xe2f8c4[_0xd6ee('0x20')]();};}function saveUpdates(_0x1abedc,_0xec9287){return function(_0x48e6ad){if(_0x48e6ad){return _0x48e6ad['update'](_0x1abedc)[_0xd6ee('0x21')](function(_0x511c18){return _0x511c18;});}return null;};}function removeEntity(_0x2bae66,_0x519373){return function(_0x391844){if(_0x391844){return _0x391844[_0xd6ee('0x22')]()[_0xd6ee('0x21')](function(){_0x2bae66[_0xd6ee('0x18')](0xcc)[_0xd6ee('0x23')]();});}};}function handleEntityNotFound(_0x5476f2,_0x4b1926){return function(_0x2f438c){if(!_0x2f438c){_0x5476f2[_0xd6ee('0x17')](0x194);}return _0x2f438c;};}function handleError(_0x4edb7d,_0x2c9b30){_0x2c9b30=_0x2c9b30||0x1f4;return function(_0xa1e700){logger[_0xd6ee('0x24')](_0xa1e700[_0xd6ee('0x25')]);if(_0xa1e700[_0xd6ee('0x26')]){delete _0xa1e700[_0xd6ee('0x26')];}_0x4edb7d[_0xd6ee('0x18')](_0x2c9b30)['send'](_0xa1e700);};}exports[_0xd6ee('0x27')]=function(_0x124ab7,_0x50b786){var _0x5bcdd6={},_0x1578b3={},_0x4580a7={'count':0x0,'rows':[]};var _0xddca=_[_0xd6ee('0x28')](db[_0xd6ee('0x29')]['rawAttributes'],function(_0x414015){return{'name':_0x414015[_0xd6ee('0x2a')],'type':_0x414015[_0xd6ee('0x2b')]['key']};});_0x1578b3[_0xd6ee('0x2c')]=_[_0xd6ee('0x28')](_0xddca,_0xd6ee('0x26'));_0x1578b3['query']=_[_0xd6ee('0x2d')](_0x124ab7[_0xd6ee('0x2e')]);_0x1578b3[_0xd6ee('0x2f')]=_[_0xd6ee('0x30')](_0x1578b3[_0xd6ee('0x2c')],_0x1578b3[_0xd6ee('0x2e')]);_0x5bcdd6['attributes']=_[_0xd6ee('0x30')](_0x1578b3[_0xd6ee('0x2c')],qs[_0xd6ee('0x31')](_0x124ab7[_0xd6ee('0x2e')]['fields']));_0x5bcdd6[_0xd6ee('0x32')]=_0x5bcdd6[_0xd6ee('0x32')][_0xd6ee('0x33')]?_0x5bcdd6['attributes']:_0x1578b3['model'];if(!_0x124ab7[_0xd6ee('0x2e')][_0xd6ee('0x34')](_0xd6ee('0x35'))){_0x5bcdd6[_0xd6ee('0x1b')]=qs[_0xd6ee('0x1b')](_0x124ab7[_0xd6ee('0x2e')][_0xd6ee('0x1b')]);_0x5bcdd6[_0xd6ee('0x1a')]=qs[_0xd6ee('0x1a')](_0x124ab7[_0xd6ee('0x2e')][_0xd6ee('0x1a')]);}_0x5bcdd6[_0xd6ee('0x36')]=qs[_0xd6ee('0x37')](_0x124ab7[_0xd6ee('0x2e')][_0xd6ee('0x37')]);_0x5bcdd6['where']=qs[_0xd6ee('0x2f')](_[_0xd6ee('0x38')](_0x124ab7[_0xd6ee('0x2e')],_0x1578b3['filters']),_0xddca);if(_0x124ab7['query']['filter']){_0x5bcdd6['where']=_[_0xd6ee('0x39')](_0x5bcdd6[_0xd6ee('0x3a')],{'$or':_[_0xd6ee('0x28')](_0xddca,function(_0x2a6d2f){if(_0x2a6d2f[_0xd6ee('0x2b')]!==_0xd6ee('0x3b')){var _0x2c975a={};_0x2c975a[_0x2a6d2f['name']]={'$like':'%'+_0x124ab7[_0xd6ee('0x2e')][_0xd6ee('0x3c')]+'%'};return _0x2c975a;}})});}_0x5bcdd6=_[_0xd6ee('0x39')]({},_0x5bcdd6,_0x124ab7[_0xd6ee('0x3d')]);var _0x407748={'where':_0x5bcdd6[_0xd6ee('0x3a')]};return db[_0xd6ee('0x29')][_0xd6ee('0x1c')](_0x407748)[_0xd6ee('0x21')](function(_0x24a7cb){_0x4580a7['count']=_0x24a7cb;if(_0x124ab7['query']['includeAll']){_0x5bcdd6[_0xd6ee('0x3e')]=[{'all':!![]}];}return db['ChatQueueReport'][_0xd6ee('0x3f')](_0x5bcdd6);})[_0xd6ee('0x21')](function(_0x96aa7f){_0x4580a7[_0xd6ee('0x40')]=_0x96aa7f;return _0x4580a7;})[_0xd6ee('0x21')](respondWithFilteredResult(_0x50b786,_0x5bcdd6))['catch'](handleError(_0x50b786,null));};exports['show']=function(_0x4db1e9,_0x557936){var _0x3337a1={'raw':!![],'where':{'id':_0x4db1e9[_0xd6ee('0x41')]['id']}},_0xf38fc4={};_0xf38fc4[_0xd6ee('0x2c')]=_[_0xd6ee('0x2d')](db[_0xd6ee('0x29')][_0xd6ee('0x42')]);_0xf38fc4[_0xd6ee('0x2e')]=_[_0xd6ee('0x2d')](_0x4db1e9['query']);_0xf38fc4[_0xd6ee('0x2f')]=_[_0xd6ee('0x30')](_0xf38fc4['model'],_0xf38fc4[_0xd6ee('0x2e')]);_0x3337a1['attributes']=_['intersection'](_0xf38fc4[_0xd6ee('0x2c')],qs[_0xd6ee('0x31')](_0x4db1e9[_0xd6ee('0x2e')][_0xd6ee('0x31')]));_0x3337a1[_0xd6ee('0x32')]=_0x3337a1[_0xd6ee('0x32')]['length']?_0x3337a1['attributes']:_0xf38fc4[_0xd6ee('0x2c')];if(_0x4db1e9[_0xd6ee('0x2e')]['includeAll']){_0x3337a1[_0xd6ee('0x3e')]=[{'all':!![]}];}_0x3337a1=_['merge']({},_0x3337a1,_0x4db1e9[_0xd6ee('0x3d')]);return db[_0xd6ee('0x29')][_0xd6ee('0x43')](_0x3337a1)[_0xd6ee('0x21')](handleEntityNotFound(_0x557936,null))[_0xd6ee('0x21')](respondWithResult(_0x557936,null))[_0xd6ee('0x44')](handleError(_0x557936,null));};exports[_0xd6ee('0x45')]=function(_0x1b02c4,_0x37c3ba){return db[_0xd6ee('0x29')][_0xd6ee('0x45')](_0x1b02c4['body'],{})[_0xd6ee('0x21')](respondWithResult(_0x37c3ba,0xc9))[_0xd6ee('0x44')](handleError(_0x37c3ba,null));};exports[_0xd6ee('0x46')]=function(_0x360e34,_0x418680){if(_0x360e34[_0xd6ee('0x47')]['id']){delete _0x360e34[_0xd6ee('0x47')]['id'];}return db[_0xd6ee('0x29')][_0xd6ee('0x43')]({'where':{'id':_0x360e34[_0xd6ee('0x41')]['id']}})[_0xd6ee('0x21')](handleEntityNotFound(_0x418680,null))[_0xd6ee('0x21')](saveUpdates(_0x360e34['body'],null))[_0xd6ee('0x21')](respondWithResult(_0x418680,null))[_0xd6ee('0x44')](handleError(_0x418680,null));};exports[_0xd6ee('0x22')]=function(_0x52dfd3,_0x2f1bef){return db['ChatQueueReport'][_0xd6ee('0x43')]({'where':{'id':_0x52dfd3['params']['id']}})[_0xd6ee('0x21')](handleEntityNotFound(_0x2f1bef,null))[_0xd6ee('0x21')](removeEntity(_0x2f1bef,null))['catch'](handleError(_0x2f1bef,null));};exports[_0xd6ee('0x48')]=function(_0x164df4,_0xaef499){return db['ChatQueueReport'][_0xd6ee('0x48')]()[_0xd6ee('0x21')](respondWithResult(_0xaef499,null))['catch'](handleError(_0xaef499,null));}; \ No newline at end of file +var _0x1db9=['merge','VIRTUAL','include','findAll','rows','show','keys','includeAll','find','catch','create','body','params','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','stack','name','index','map','ChatQueueReport','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filter','where'];(function(_0x87506e,_0x5680ec){var _0x5496a4=function(_0x1e29ab){while(--_0x1e29ab){_0x87506e['push'](_0x87506e['shift']());}};_0x5496a4(++_0x5680ec);}(_0x1db9,0x176));var _0x91db=function(_0x589032,_0x34c698){_0x589032=_0x589032-0x0;var _0x2df59c=_0x1db9[_0x589032];return _0x2df59c;};'use strict';var emlformat=require(_0x91db('0x0'));var rimraf=require(_0x91db('0x1'));var zipdir=require(_0x91db('0x2'));var jsonpatch=require(_0x91db('0x3'));var rp=require(_0x91db('0x4'));var moment=require(_0x91db('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x91db('0x6'));var util=require(_0x91db('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x91db('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x91db('0x9'));var squel=require(_0x91db('0xa'));var crypto=require(_0x91db('0xb'));var jsforce=require(_0x91db('0xc'));var deskjs=require(_0x91db('0xd'));var toCsv=require('to-csv');var querystring=require(_0x91db('0xe'));var Papa=require('papaparse');var Redis=require(_0x91db('0xf'));var authService=require(_0x91db('0x10'));var qs=require(_0x91db('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x91db('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x91db('0x13'));var licenseUtil=require(_0x91db('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x540c48,_0x2b9b98){_0x2b9b98=_0x2b9b98||0xcc;return function(_0x329277){if(_0x329277){return _0x540c48[_0x91db('0x15')](_0x2b9b98);}return _0x540c48[_0x91db('0x16')](_0x2b9b98)[_0x91db('0x17')]();};}function respondWithResult(_0x4c3124,_0x371158){_0x371158=_0x371158||0xc8;return function(_0x285052){if(_0x285052){return _0x4c3124[_0x91db('0x16')](_0x371158)[_0x91db('0x18')](_0x285052);}};}function respondWithFilteredResult(_0x2df307,_0x33b39d){return function(_0x260b56){if(_0x260b56){var _0x143bc4=typeof _0x33b39d[_0x91db('0x19')]===_0x91db('0x1a')&&typeof _0x33b39d[_0x91db('0x1b')]===_0x91db('0x1a');var _0x5f5440=_0x260b56[_0x91db('0x1c')];var _0x23d125=_0x143bc4?0x0:_0x33b39d[_0x91db('0x19')];var _0x42e66c=_0x143bc4?_0x260b56[_0x91db('0x1c')]:_0x33b39d[_0x91db('0x19')]+_0x33b39d['limit'];var _0x4ae820;if(_0x42e66c>=_0x5f5440){_0x42e66c=_0x5f5440;_0x4ae820=0xc8;}else{_0x4ae820=0xce;}_0x2df307[_0x91db('0x16')](_0x4ae820);return _0x2df307[_0x91db('0x1d')](_0x91db('0x1e'),_0x23d125+'-'+_0x42e66c+'/'+_0x5f5440)[_0x91db('0x18')](_0x260b56);}return null;};}function patchUpdates(_0x50cf9c){return function(_0x168dea){try{jsonpatch[_0x91db('0x1f')](_0x168dea,_0x50cf9c,!![]);}catch(_0x6e3ca6){return BPromise[_0x91db('0x20')](_0x6e3ca6);}return _0x168dea[_0x91db('0x21')]();};}function saveUpdates(_0x31b96c,_0xaad1f6){return function(_0x8e323f){if(_0x8e323f){return _0x8e323f[_0x91db('0x22')](_0x31b96c)[_0x91db('0x23')](function(_0x554454){return _0x554454;});}return null;};}function removeEntity(_0x58774f,_0x134caa){return function(_0x2ac8d5){if(_0x2ac8d5){return _0x2ac8d5['destroy']()[_0x91db('0x23')](function(){_0x58774f[_0x91db('0x16')](0xcc)[_0x91db('0x17')]();});}};}function handleEntityNotFound(_0x6e3a9c,_0x3729d3){return function(_0x4e2a8f){if(!_0x4e2a8f){_0x6e3a9c['sendStatus'](0x194);}return _0x4e2a8f;};}function handleError(_0x42e53f,_0x2f0b86){_0x2f0b86=_0x2f0b86||0x1f4;return function(_0x329118){logger['error'](_0x329118[_0x91db('0x24')]);if(_0x329118[_0x91db('0x25')]){delete _0x329118[_0x91db('0x25')];}_0x42e53f[_0x91db('0x16')](_0x2f0b86)['send'](_0x329118);};}exports[_0x91db('0x26')]=function(_0x2a00d1,_0x1805ef){var _0x49c504={},_0x2ff6c8={},_0x69fdc2={'count':0x0,'rows':[]};var _0x2d3ebd=_[_0x91db('0x27')](db[_0x91db('0x28')][_0x91db('0x29')],function(_0x2e6a27){return{'name':_0x2e6a27[_0x91db('0x2a')],'type':_0x2e6a27[_0x91db('0x2b')][_0x91db('0x2c')]};});_0x2ff6c8[_0x91db('0x2d')]=_[_0x91db('0x27')](_0x2d3ebd,_0x91db('0x25'));_0x2ff6c8[_0x91db('0x2e')]=_['keys'](_0x2a00d1[_0x91db('0x2e')]);_0x2ff6c8[_0x91db('0x2f')]=_[_0x91db('0x30')](_0x2ff6c8[_0x91db('0x2d')],_0x2ff6c8[_0x91db('0x2e')]);_0x49c504['attributes']=_[_0x91db('0x30')](_0x2ff6c8[_0x91db('0x2d')],qs[_0x91db('0x31')](_0x2a00d1['query'][_0x91db('0x31')]));_0x49c504['attributes']=_0x49c504[_0x91db('0x32')][_0x91db('0x33')]?_0x49c504[_0x91db('0x32')]:_0x2ff6c8[_0x91db('0x2d')];if(!_0x2a00d1['query'][_0x91db('0x34')](_0x91db('0x35'))){_0x49c504[_0x91db('0x1b')]=qs['limit'](_0x2a00d1[_0x91db('0x2e')][_0x91db('0x1b')]);_0x49c504['offset']=qs[_0x91db('0x19')](_0x2a00d1[_0x91db('0x2e')]['offset']);}_0x49c504[_0x91db('0x36')]=qs['sort'](_0x2a00d1[_0x91db('0x2e')][_0x91db('0x37')]);_0x49c504['where']=qs['filters'](_['pick'](_0x2a00d1[_0x91db('0x2e')],_0x2ff6c8[_0x91db('0x2f')]),_0x2d3ebd);if(_0x2a00d1['query'][_0x91db('0x38')]){_0x49c504[_0x91db('0x39')]=_[_0x91db('0x3a')](_0x49c504[_0x91db('0x39')],{'$or':_[_0x91db('0x27')](_0x2d3ebd,function(_0x3cccc7){if(_0x3cccc7[_0x91db('0x2b')]!==_0x91db('0x3b')){var _0xcdc472={};_0xcdc472[_0x3cccc7[_0x91db('0x25')]]={'$like':'%'+_0x2a00d1[_0x91db('0x2e')]['filter']+'%'};return _0xcdc472;}})});}_0x49c504=_[_0x91db('0x3a')]({},_0x49c504,_0x2a00d1['options']);var _0x14de6d={'where':_0x49c504[_0x91db('0x39')]};return db['ChatQueueReport'][_0x91db('0x1c')](_0x14de6d)[_0x91db('0x23')](function(_0x16a7e9){_0x69fdc2[_0x91db('0x1c')]=_0x16a7e9;if(_0x2a00d1[_0x91db('0x2e')]['includeAll']){_0x49c504[_0x91db('0x3c')]=[{'all':!![]}];}return db[_0x91db('0x28')][_0x91db('0x3d')](_0x49c504);})['then'](function(_0x4733a4){_0x69fdc2[_0x91db('0x3e')]=_0x4733a4;return _0x69fdc2;})[_0x91db('0x23')](respondWithFilteredResult(_0x1805ef,_0x49c504))['catch'](handleError(_0x1805ef,null));};exports[_0x91db('0x3f')]=function(_0x2b7830,_0x29831c){var _0x3d73a7={'raw':!![],'where':{'id':_0x2b7830['params']['id']}},_0x3609e1={};_0x3609e1[_0x91db('0x2d')]=_['keys'](db[_0x91db('0x28')][_0x91db('0x29')]);_0x3609e1[_0x91db('0x2e')]=_[_0x91db('0x40')](_0x2b7830[_0x91db('0x2e')]);_0x3609e1[_0x91db('0x2f')]=_[_0x91db('0x30')](_0x3609e1[_0x91db('0x2d')],_0x3609e1[_0x91db('0x2e')]);_0x3d73a7[_0x91db('0x32')]=_[_0x91db('0x30')](_0x3609e1['model'],qs['fields'](_0x2b7830[_0x91db('0x2e')][_0x91db('0x31')]));_0x3d73a7[_0x91db('0x32')]=_0x3d73a7['attributes'][_0x91db('0x33')]?_0x3d73a7[_0x91db('0x32')]:_0x3609e1[_0x91db('0x2d')];if(_0x2b7830[_0x91db('0x2e')][_0x91db('0x41')]){_0x3d73a7['include']=[{'all':!![]}];}_0x3d73a7=_[_0x91db('0x3a')]({},_0x3d73a7,_0x2b7830['options']);return db[_0x91db('0x28')][_0x91db('0x42')](_0x3d73a7)[_0x91db('0x23')](handleEntityNotFound(_0x29831c,null))[_0x91db('0x23')](respondWithResult(_0x29831c,null))[_0x91db('0x43')](handleError(_0x29831c,null));};exports[_0x91db('0x44')]=function(_0x17f7b3,_0xd5a8fb){return db[_0x91db('0x28')]['create'](_0x17f7b3['body'],{})[_0x91db('0x23')](respondWithResult(_0xd5a8fb,0xc9))[_0x91db('0x43')](handleError(_0xd5a8fb,null));};exports[_0x91db('0x22')]=function(_0x410423,_0x27e224){if(_0x410423['body']['id']){delete _0x410423[_0x91db('0x45')]['id'];}return db[_0x91db('0x28')][_0x91db('0x42')]({'where':{'id':_0x410423[_0x91db('0x46')]['id']}})[_0x91db('0x23')](handleEntityNotFound(_0x27e224,null))['then'](saveUpdates(_0x410423[_0x91db('0x45')],null))[_0x91db('0x23')](respondWithResult(_0x27e224,null))[_0x91db('0x43')](handleError(_0x27e224,null));};exports[_0x91db('0x47')]=function(_0x50b269,_0x3d8dfb){return db['ChatQueueReport']['find']({'where':{'id':_0x50b269[_0x91db('0x46')]['id']}})['then'](handleEntityNotFound(_0x3d8dfb,null))[_0x91db('0x23')](removeEntity(_0x3d8dfb,null))['catch'](handleError(_0x3d8dfb,null));};exports['describe']=function(_0x2c30ff,_0x371277){return db[_0x91db('0x28')]['describe']()[_0x91db('0x23')](respondWithResult(_0x371277,null))[_0x91db('0x43')](handleError(_0x371277,null));}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.model.js b/server/api/chatQueueReport/chatQueueReport.model.js index 027976c..4487deb 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 _0xd8b0=['define','report_chat_queue','uniqueid','lodash','util','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x77d0d9,_0x5660b9){var _0x57c5fd=function(_0x1ac780){while(--_0x1ac780){_0x77d0d9['push'](_0x77d0d9['shift']());}};_0x57c5fd(++_0x5660b9);}(_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('./chatQueueReport.attributes');module['exports']=function(_0x3f8b6f,_0x227c63){return _0x3f8b6f[_0x0d8b('0x7')]('ChatQueueReport',attributes,{'tableName':_0x0d8b('0x8'),'paranoid':![],'indexes':[{'name':_0x0d8b('0x9'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xbaf0=['define','ChatQueueReport','report_chat_queue','uniqueid','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./chatQueueReport.attributes','exports'];(function(_0x2e6448,_0x417d91){var _0xfb736b=function(_0x2b0a86){while(--_0x2b0a86){_0x2e6448['push'](_0x2e6448['shift']());}};_0xfb736b(++_0x417d91);}(_0xbaf0,0x12a));var _0x0baf=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xbaf0[_0x14add3];return _0x4a174f;};'use strict';var _=require('lodash');var util=require(_0x0baf('0x0'));var logger=require(_0x0baf('0x1'))(_0x0baf('0x2'));var moment=require(_0x0baf('0x3'));var BPromise=require(_0x0baf('0x4'));var rp=require(_0x0baf('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0baf('0x6'));var config=require(_0x0baf('0x7'));var attributes=require(_0x0baf('0x8'));module[_0x0baf('0x9')]=function(_0xe4c3c4,_0x335e24){return _0xe4c3c4[_0x0baf('0xa')](_0x0baf('0xb'),attributes,{'tableName':_0x0baf('0xc'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x0baf('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.rpc.js b/server/api/chatQueueReport/chatQueueReport.rpc.js index c3aada8..ca42ea3 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 _0x99cd=['http','request','then','info','ChatQueueReport,\x20%s,\x20%s','request\x20sent','debug','ChatQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','ChatQueueReport','create','body','raw','CreateChatQueueReport','update','options','attributes','limit','UpdateChatQueueReport','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x75f270,_0x20ee05){var _0x33bad2=function(_0x4fbc7a){while(--_0x4fbc7a){_0x75f270['push'](_0x75f270['shift']());}};_0x33bad2(++_0x20ee05);}(_0x99cd,0x1df));var _0xd99c=function(_0x581381,_0x3f399e){_0x581381=_0x581381-0x0;var _0x116ed4=_0x99cd[_0x581381];return _0x116ed4;};'use strict';var _=require(_0xd99c('0x0'));var util=require('util');var moment=require(_0xd99c('0x1'));var BPromise=require(_0xd99c('0x2'));var rs=require(_0xd99c('0x3'));var fs=require('fs');var Redis=require(_0xd99c('0x4'));var db=require(_0xd99c('0x5'))['db'];var utils=require(_0xd99c('0x6'));var logger=require(_0xd99c('0x7'))(_0xd99c('0x8'));var config=require(_0xd99c('0x9'));var jayson=require(_0xd99c('0xa'));var client=jayson['client'][_0xd99c('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4a56d5,_0x26ebac,_0x4b739c){return new BPromise(function(_0x53d8b2,_0x28ea88){return client[_0xd99c('0xc')](_0x4a56d5,_0x4b739c)[_0xd99c('0xd')](function(_0x2bcd16){logger[_0xd99c('0xe')](_0xd99c('0xf'),_0x26ebac,_0xd99c('0x10'));logger[_0xd99c('0x11')](_0xd99c('0x12'),_0x26ebac,_0xd99c('0x10'),JSON[_0xd99c('0x13')](_0x2bcd16));if(_0x2bcd16[_0xd99c('0x14')]){if(_0x2bcd16[_0xd99c('0x14')][_0xd99c('0x15')]===0x1f4){logger['error'](_0xd99c('0xf'),_0x26ebac,_0x2bcd16[_0xd99c('0x14')][_0xd99c('0x16')]);return _0x28ea88(_0x2bcd16[_0xd99c('0x14')][_0xd99c('0x16')]);}logger['error'](_0xd99c('0xf'),_0x26ebac,_0x2bcd16[_0xd99c('0x14')][_0xd99c('0x16')]);return _0x53d8b2(_0x2bcd16[_0xd99c('0x14')][_0xd99c('0x16')]);}else{logger['info'](_0xd99c('0xf'),_0x26ebac,_0xd99c('0x10'));_0x53d8b2(_0x2bcd16[_0xd99c('0x17')][_0xd99c('0x16')]);}})[_0xd99c('0x18')](function(_0x41936e){logger[_0xd99c('0x14')](_0xd99c('0xf'),_0x26ebac,_0x41936e);_0x28ea88(_0x41936e);});});}exports['CreateChatQueueReport']=function(_0x486607){var _0x27db70=this;return new Promise(function(_0x2d98cb,_0xeb2165){return db[_0xd99c('0x19')][_0xd99c('0x1a')](_0x486607[_0xd99c('0x1b')],{'raw':_0x486607['options']?_0x486607['options'][_0xd99c('0x1c')]===undefined?!![]:![]:!![]})[_0xd99c('0xd')](function(_0x271a35){logger[_0xd99c('0xe')](_0xd99c('0x1d'),_0x486607);logger[_0xd99c('0x11')](_0xd99c('0x1d'),_0x486607,JSON[_0xd99c('0x13')](_0x271a35));_0x2d98cb(_0x271a35);})[_0xd99c('0x18')](function(_0x1d84bb){logger[_0xd99c('0x14')](_0xd99c('0x1d'),_0x1d84bb['message'],_0x486607);_0xeb2165(_0x27db70[_0xd99c('0x14')](0x1f4,_0x1d84bb['message']));});});};exports['UpdateChatQueueReport']=function(_0x14ffb8){var _0x2604f1=this;return new Promise(function(_0x547364,_0x4af932){return db['ChatQueueReport'][_0xd99c('0x1e')](_0x14ffb8['body'],{'raw':_0x14ffb8[_0xd99c('0x1f')]?_0x14ffb8[_0xd99c('0x1f')][_0xd99c('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x14ffb8['options']?_0x14ffb8[_0xd99c('0x1f')]['where']||null:null,'attributes':_0x14ffb8[_0xd99c('0x1f')]?_0x14ffb8[_0xd99c('0x1f')][_0xd99c('0x20')]||null:null,'limit':_0x14ffb8['options']?_0x14ffb8['options'][_0xd99c('0x21')]||null:null})[_0xd99c('0xd')](function(_0x20ce01){logger[_0xd99c('0xe')](_0xd99c('0x22'),_0x14ffb8);logger[_0xd99c('0x11')]('UpdateChatQueueReport',_0x14ffb8,JSON[_0xd99c('0x13')](_0x20ce01));_0x547364(_0x20ce01);})[_0xd99c('0x18')](function(_0x4dbbc){logger['error'](_0xd99c('0x22'),_0x4dbbc[_0xd99c('0x16')],_0x14ffb8);_0x4af932(_0x2604f1['error'](0x1f4,_0x4dbbc[_0xd99c('0x16')]));});});}; \ No newline at end of file +var _0x0056=['message','catch','CreateChatQueueReport','body','options','raw','stringify','ChatQueueReport','attributes','limit','UpdateChatQueueReport','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','client','request','then','info','ChatQueueReport,\x20%s,\x20%s','request\x20sent','debug','ChatQueueReport,\x20%s,\x20%s,\x20%s','error'];(function(_0x231b2e,_0x2a33f9){var _0x3feb2a=function(_0x5aa472){while(--_0x5aa472){_0x231b2e['push'](_0x231b2e['shift']());}};_0x3feb2a(++_0x2a33f9);}(_0x0056,0xdb));var _0x6005=function(_0x5bc5fe,_0x2afaef){_0x5bc5fe=_0x5bc5fe-0x0;var _0x298ea7=_0x0056[_0x5bc5fe];return _0x298ea7;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x6005('0x0'));var BPromise=require(_0x6005('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6005('0x2'));var db=require(_0x6005('0x3'))['db'];var utils=require(_0x6005('0x4'));var logger=require(_0x6005('0x5'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x6005('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3ee6d4,_0x377a38,_0x3aef8a){return new BPromise(function(_0x58491d,_0xa09a6b){return client[_0x6005('0x7')](_0x3ee6d4,_0x3aef8a)[_0x6005('0x8')](function(_0x33d361){logger[_0x6005('0x9')](_0x6005('0xa'),_0x377a38,_0x6005('0xb'));logger[_0x6005('0xc')](_0x6005('0xd'),_0x377a38,_0x6005('0xb'),JSON['stringify'](_0x33d361));if(_0x33d361[_0x6005('0xe')]){if(_0x33d361[_0x6005('0xe')]['code']===0x1f4){logger[_0x6005('0xe')]('ChatQueueReport,\x20%s,\x20%s',_0x377a38,_0x33d361[_0x6005('0xe')][_0x6005('0xf')]);return _0xa09a6b(_0x33d361[_0x6005('0xe')][_0x6005('0xf')]);}logger['error']('ChatQueueReport,\x20%s,\x20%s',_0x377a38,_0x33d361[_0x6005('0xe')][_0x6005('0xf')]);return _0x58491d(_0x33d361[_0x6005('0xe')]['message']);}else{logger[_0x6005('0x9')]('ChatQueueReport,\x20%s,\x20%s',_0x377a38,_0x6005('0xb'));_0x58491d(_0x33d361['result'][_0x6005('0xf')]);}})[_0x6005('0x10')](function(_0x1217f0){logger['error'](_0x6005('0xa'),_0x377a38,_0x1217f0);_0xa09a6b(_0x1217f0);});});}exports[_0x6005('0x11')]=function(_0xf4207a){var _0x4a40c6=this;return new Promise(function(_0x41e7d3,_0x4c0b40){return db['ChatQueueReport']['create'](_0xf4207a[_0x6005('0x12')],{'raw':_0xf4207a[_0x6005('0x13')]?_0xf4207a[_0x6005('0x13')][_0x6005('0x14')]===undefined?!![]:![]:!![]})['then'](function(_0x53c30b){logger[_0x6005('0x9')](_0x6005('0x11'),_0xf4207a);logger[_0x6005('0xc')]('CreateChatQueueReport',_0xf4207a,JSON[_0x6005('0x15')](_0x53c30b));_0x41e7d3(_0x53c30b);})[_0x6005('0x10')](function(_0x213c90){logger[_0x6005('0xe')]('CreateChatQueueReport',_0x213c90[_0x6005('0xf')],_0xf4207a);_0x4c0b40(_0x4a40c6[_0x6005('0xe')](0x1f4,_0x213c90[_0x6005('0xf')]));});});};exports['UpdateChatQueueReport']=function(_0x59f6c9){var _0x3d4d90=this;return new Promise(function(_0x5a8474,_0x4659a4){return db[_0x6005('0x16')]['update'](_0x59f6c9['body'],{'raw':_0x59f6c9[_0x6005('0x13')]?_0x59f6c9[_0x6005('0x13')][_0x6005('0x14')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x59f6c9['options']?_0x59f6c9[_0x6005('0x13')]['where']||null:null,'attributes':_0x59f6c9[_0x6005('0x13')]?_0x59f6c9[_0x6005('0x13')][_0x6005('0x17')]||null:null,'limit':_0x59f6c9[_0x6005('0x13')]?_0x59f6c9[_0x6005('0x13')][_0x6005('0x18')]||null:null})[_0x6005('0x8')](function(_0x576390){logger[_0x6005('0x9')](_0x6005('0x19'),_0x59f6c9);logger['debug']('UpdateChatQueueReport',_0x59f6c9,JSON['stringify'](_0x576390));_0x5a8474(_0x576390);})['catch'](function(_0x58223c){logger['error']('UpdateChatQueueReport',_0x58223c['message'],_0x59f6c9);_0x4659a4(_0x3d4d90[_0x6005('0xe')](0x1f4,_0x58223c[_0x6005('0xf')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/index.js b/server/api/chatQueueReport/index.js index 8de6ab0..5cbe377 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 _0xd73a=['create','put','update','delete','exports','path','connect-timeout','express','../../components/interaction/service','../../config/environment','./chatQueueReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post'];(function(_0x896db1,_0x2a0ff9){var _0xc1adb6=function(_0x5608f){while(--_0x5608f){_0x896db1['push'](_0x896db1['shift']());}};_0xc1adb6(++_0x2a0ff9);}(_0xd73a,0xd6));var _0xad73=function(_0x4edac5,_0x41d853){_0x4edac5=_0x4edac5-0x0;var _0x572b3b=_0xd73a[_0x4edac5];return _0x572b3b;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xad73('0x0'));var timeout=require(_0xad73('0x1'));var express=require(_0xad73('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xad73('0x3'));var config=require(_0xad73('0x4'));var controller=require(_0xad73('0x5'));router[_0xad73('0x6')]('/',auth[_0xad73('0x7')](),controller[_0xad73('0x8')]);router[_0xad73('0x6')](_0xad73('0x9'),auth[_0xad73('0x7')](),controller[_0xad73('0xa')]);router[_0xad73('0x6')](_0xad73('0xb'),auth[_0xad73('0x7')](),controller[_0xad73('0xc')]);router[_0xad73('0xd')]('/',auth['isAuthenticated'](),controller[_0xad73('0xe')]);router[_0xad73('0xf')]('/:id',auth['isAuthenticated'](),controller[_0xad73('0x10')]);router[_0xad73('0x11')](_0xad73('0xb'),auth[_0xad73('0x7')](),controller['destroy']);module[_0xad73('0x12')]=router; \ No newline at end of file +var _0x2631=['destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatQueueReport.controller','get','isAuthenticated','index','/describe','post','create','update','delete','/:id'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x2631,0x6a));var _0x1263=function(_0x447fe7,_0x340107){_0x447fe7=_0x447fe7-0x0;var _0x539c72=_0x2631[_0x447fe7];return _0x539c72;};'use strict';var multer=require(_0x1263('0x0'));var util=require(_0x1263('0x1'));var path=require(_0x1263('0x2'));var timeout=require(_0x1263('0x3'));var express=require(_0x1263('0x4'));var router=express[_0x1263('0x5')]();var fs_extra=require(_0x1263('0x6'));var auth=require(_0x1263('0x7'));var interaction=require(_0x1263('0x8'));var config=require(_0x1263('0x9'));var controller=require(_0x1263('0xa'));router[_0x1263('0xb')]('/',auth[_0x1263('0xc')](),controller[_0x1263('0xd')]);router['get'](_0x1263('0xe'),auth['isAuthenticated'](),controller['describe']);router[_0x1263('0xb')]('/:id',auth[_0x1263('0xc')](),controller['show']);router[_0x1263('0xf')]('/',auth[_0x1263('0xc')](),controller[_0x1263('0x10')]);router['put']('/:id',auth[_0x1263('0xc')](),controller[_0x1263('0x11')]);router[_0x1263('0x12')](_0x1263('0x13'),auth[_0x1263('0xc')](),controller[_0x1263('0x14')]);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 4d6dfd8..13145f6 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 _0x4b84=['moment','sequelize','ENUM','queue','DATE'];(function(_0x597b14,_0x4eadc8){var _0x32dd31=function(_0x388ba3){while(--_0x388ba3){_0x597b14['push'](_0x597b14['shift']());}};_0x32dd31(++_0x4eadc8);}(_0x4b84,0x1cc));var _0x44b8=function(_0x5e7514,_0x30c2e1){_0x5e7514=_0x5e7514-0x0;var _0x12f472=_0x4b84[_0x5e7514];return _0x12f472;};'use strict';var moment=require(_0x44b8('0x0'));var Sequelize=require(_0x44b8('0x1'));module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x44b8('0x2')]('account','agent',_0x44b8('0x3')),'allowNull':![],'defaultValue':_0x44b8('0x3')},'transferredAt':{'type':Sequelize[_0x44b8('0x4')],'allowNull':![],'defaultValue':Sequelize['NOW']}}; \ No newline at end of file +var _0xaa88=['account','agent','queue','DATE','NOW','moment','sequelize','exports','STRING'];(function(_0x3ba74d,_0x3e0456){var _0x3bcd85=function(_0x464df6){while(--_0x464df6){_0x3ba74d['push'](_0x3ba74d['shift']());}};_0x3bcd85(++_0x3e0456);}(_0xaa88,0x137));var _0x8aa8=function(_0x5ce15c,_0x19c917){_0x5ce15c=_0x5ce15c-0x0;var _0x36e4f5=_0xaa88[_0x5ce15c];return _0x36e4f5;};'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 8e693cd..ecc89ae 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 _0x23d0=['to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','reject','save','update','then','error','name','send','index','map','ChatTransferReport','rawAttributes','type','key','model','filters','intersection','query','fields','attributes','length','hasOwnProperty','nolimit','order','where','pick','filter','merge','options','include','findAll','catch','params','keys','includeAll','create','body','find','describe','eml-format','fast-json-patch','bluebird','util','path','sox'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x23d0,0xd2));var _0x023d=function(_0x4dea61,_0x3df253){_0x4dea61=_0x4dea61-0x0;var _0x40ec79=_0x23d0[_0x4dea61];return _0x40ec79;};'use strict';var emlformat=require(_0x023d('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x023d('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x023d('0x2'));var Mustache=require('mustache');var util=require(_0x023d('0x3'));var path=require(_0x023d('0x4'));var sox=require(_0x023d('0x5'));var csv=require(_0x023d('0x6'));var ejs=require(_0x023d('0x7'));var fs=require('fs');var fs_extra=require(_0x023d('0x8'));var _=require(_0x023d('0x9'));var squel=require(_0x023d('0xa'));var crypto=require(_0x023d('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x023d('0xc'));var toCsv=require('to-csv');var querystring=require(_0x023d('0xd'));var Papa=require(_0x023d('0xe'));var Redis=require('ioredis');var authService=require(_0x023d('0xf'));var qs=require(_0x023d('0x10'));var as=require(_0x023d('0x11'));var hardwareService=require(_0x023d('0x12'));var logger=require(_0x023d('0x13'))(_0x023d('0x14'));var utils=require(_0x023d('0x15'));var config=require(_0x023d('0x16'));var licenseUtil=require(_0x023d('0x17'));var db=require(_0x023d('0x18'))['db'];function respondWithStatusCode(_0x3a8dc3,_0x3501a8){_0x3501a8=_0x3501a8||0xcc;return function(_0x58455f){if(_0x58455f){return _0x3a8dc3[_0x023d('0x19')](_0x3501a8);}return _0x3a8dc3[_0x023d('0x1a')](_0x3501a8)[_0x023d('0x1b')]();};}function respondWithResult(_0x2a48bf,_0x203d83){_0x203d83=_0x203d83||0xc8;return function(_0x44cbc3){if(_0x44cbc3){return _0x2a48bf[_0x023d('0x1a')](_0x203d83)[_0x023d('0x1c')](_0x44cbc3);}};}function respondWithFilteredResult(_0x44917a,_0x28e147){return function(_0x1e5d80){if(_0x1e5d80){var _0x5a3f75=typeof _0x28e147[_0x023d('0x1d')]===_0x023d('0x1e')&&typeof _0x28e147[_0x023d('0x1f')]===_0x023d('0x1e');var _0x532baa=_0x1e5d80[_0x023d('0x20')];var _0x64bc7e=_0x5a3f75?0x0:_0x28e147[_0x023d('0x1d')];var _0x259b98=_0x5a3f75?_0x1e5d80[_0x023d('0x20')]:_0x28e147['offset']+_0x28e147[_0x023d('0x1f')];var _0x56408f;if(_0x259b98>=_0x532baa){_0x259b98=_0x532baa;_0x56408f=0xc8;}else{_0x56408f=0xce;}_0x44917a[_0x023d('0x1a')](_0x56408f);return _0x44917a[_0x023d('0x21')]('Content-Range',_0x64bc7e+'-'+_0x259b98+'/'+_0x532baa)[_0x023d('0x1c')](_0x1e5d80);}return null;};}function patchUpdates(_0x1400dc){return function(_0x2bd785){try{jsonpatch['apply'](_0x2bd785,_0x1400dc,!![]);}catch(_0x52374a){return BPromise[_0x023d('0x22')](_0x52374a);}return _0x2bd785[_0x023d('0x23')]();};}function saveUpdates(_0x300961,_0x1cee71){return function(_0x2d4842){if(_0x2d4842){return _0x2d4842[_0x023d('0x24')](_0x300961)[_0x023d('0x25')](function(_0x15d7e5){return _0x15d7e5;});}return null;};}function removeEntity(_0x3ddb97,_0x377fcc){return function(_0xfafac1){if(_0xfafac1){return _0xfafac1['destroy']()[_0x023d('0x25')](function(){_0x3ddb97[_0x023d('0x1a')](0xcc)[_0x023d('0x1b')]();});}};}function handleEntityNotFound(_0x21351e,_0x48bb8a){return function(_0x158fbf){if(!_0x158fbf){_0x21351e[_0x023d('0x19')](0x194);}return _0x158fbf;};}function handleError(_0xd8105f,_0x464b13){_0x464b13=_0x464b13||0x1f4;return function(_0x1aabae){logger[_0x023d('0x26')](_0x1aabae['stack']);if(_0x1aabae[_0x023d('0x27')]){delete _0x1aabae[_0x023d('0x27')];}_0xd8105f[_0x023d('0x1a')](_0x464b13)[_0x023d('0x28')](_0x1aabae);};}exports[_0x023d('0x29')]=function(_0x144ecd,_0x5d9ba8){var _0x2dec2d={},_0x3f1e4a={},_0x330849={'count':0x0,'rows':[]};var _0x5ccc36=_[_0x023d('0x2a')](db[_0x023d('0x2b')][_0x023d('0x2c')],function(_0x12254e){return{'name':_0x12254e['fieldName'],'type':_0x12254e[_0x023d('0x2d')][_0x023d('0x2e')]};});_0x3f1e4a[_0x023d('0x2f')]=_[_0x023d('0x2a')](_0x5ccc36,'name');_0x3f1e4a['query']=_['keys'](_0x144ecd['query']);_0x3f1e4a[_0x023d('0x30')]=_[_0x023d('0x31')](_0x3f1e4a['model'],_0x3f1e4a[_0x023d('0x32')]);_0x2dec2d['attributes']=_[_0x023d('0x31')](_0x3f1e4a['model'],qs[_0x023d('0x33')](_0x144ecd[_0x023d('0x32')][_0x023d('0x33')]));_0x2dec2d[_0x023d('0x34')]=_0x2dec2d[_0x023d('0x34')][_0x023d('0x35')]?_0x2dec2d[_0x023d('0x34')]:_0x3f1e4a['model'];if(!_0x144ecd[_0x023d('0x32')][_0x023d('0x36')](_0x023d('0x37'))){_0x2dec2d[_0x023d('0x1f')]=qs[_0x023d('0x1f')](_0x144ecd[_0x023d('0x32')]['limit']);_0x2dec2d[_0x023d('0x1d')]=qs['offset'](_0x144ecd[_0x023d('0x32')][_0x023d('0x1d')]);}_0x2dec2d[_0x023d('0x38')]=qs['sort'](_0x144ecd['query']['sort']);_0x2dec2d[_0x023d('0x39')]=qs[_0x023d('0x30')](_[_0x023d('0x3a')](_0x144ecd['query'],_0x3f1e4a[_0x023d('0x30')]),_0x5ccc36);if(_0x144ecd['query'][_0x023d('0x3b')]){_0x2dec2d[_0x023d('0x39')]=_[_0x023d('0x3c')](_0x2dec2d[_0x023d('0x39')],{'$or':_[_0x023d('0x2a')](_0x5ccc36,function(_0x691184){if(_0x691184[_0x023d('0x2d')]!=='VIRTUAL'){var _0x3d4b23={};_0x3d4b23[_0x691184['name']]={'$like':'%'+_0x144ecd[_0x023d('0x32')][_0x023d('0x3b')]+'%'};return _0x3d4b23;}})});}_0x2dec2d=_[_0x023d('0x3c')]({},_0x2dec2d,_0x144ecd[_0x023d('0x3d')]);var _0x463e38={'where':_0x2dec2d[_0x023d('0x39')]};return db[_0x023d('0x2b')][_0x023d('0x20')](_0x463e38)[_0x023d('0x25')](function(_0x1dd953){_0x330849[_0x023d('0x20')]=_0x1dd953;if(_0x144ecd[_0x023d('0x32')]['includeAll']){_0x2dec2d[_0x023d('0x3e')]=[{'all':!![]}];}return db[_0x023d('0x2b')][_0x023d('0x3f')](_0x2dec2d);})[_0x023d('0x25')](function(_0x45ffb2){_0x330849['rows']=_0x45ffb2;return _0x330849;})[_0x023d('0x25')](respondWithFilteredResult(_0x5d9ba8,_0x2dec2d))[_0x023d('0x40')](handleError(_0x5d9ba8,null));};exports['show']=function(_0x5ee10b,_0x20b836){var _0x33a7ff={'raw':!![],'where':{'id':_0x5ee10b[_0x023d('0x41')]['id']}},_0x41249a={};_0x41249a[_0x023d('0x2f')]=_['keys'](db[_0x023d('0x2b')][_0x023d('0x2c')]);_0x41249a[_0x023d('0x32')]=_[_0x023d('0x42')](_0x5ee10b['query']);_0x41249a['filters']=_['intersection'](_0x41249a[_0x023d('0x2f')],_0x41249a[_0x023d('0x32')]);_0x33a7ff[_0x023d('0x34')]=_[_0x023d('0x31')](_0x41249a[_0x023d('0x2f')],qs[_0x023d('0x33')](_0x5ee10b[_0x023d('0x32')]['fields']));_0x33a7ff['attributes']=_0x33a7ff['attributes'][_0x023d('0x35')]?_0x33a7ff[_0x023d('0x34')]:_0x41249a[_0x023d('0x2f')];if(_0x5ee10b[_0x023d('0x32')][_0x023d('0x43')]){_0x33a7ff[_0x023d('0x3e')]=[{'all':!![]}];}_0x33a7ff=_[_0x023d('0x3c')]({},_0x33a7ff,_0x5ee10b[_0x023d('0x3d')]);return db[_0x023d('0x2b')]['find'](_0x33a7ff)[_0x023d('0x25')](handleEntityNotFound(_0x20b836,null))['then'](respondWithResult(_0x20b836,null))[_0x023d('0x40')](handleError(_0x20b836,null));};exports['create']=function(_0x1b2141,_0x4a9a90){return db[_0x023d('0x2b')][_0x023d('0x44')](_0x1b2141[_0x023d('0x45')],{})[_0x023d('0x25')](respondWithResult(_0x4a9a90,0xc9))[_0x023d('0x40')](handleError(_0x4a9a90,null));};exports[_0x023d('0x24')]=function(_0x23d1a4,_0x244c88){if(_0x23d1a4[_0x023d('0x45')]['id']){delete _0x23d1a4[_0x023d('0x45')]['id'];}return db['ChatTransferReport'][_0x023d('0x46')]({'where':{'id':_0x23d1a4[_0x023d('0x41')]['id']}})['then'](handleEntityNotFound(_0x244c88,null))[_0x023d('0x25')](saveUpdates(_0x23d1a4[_0x023d('0x45')],null))[_0x023d('0x25')](respondWithResult(_0x244c88,null))[_0x023d('0x40')](handleError(_0x244c88,null));};exports['destroy']=function(_0x494bea,_0x31d850){return db[_0x023d('0x2b')][_0x023d('0x46')]({'where':{'id':_0x494bea[_0x023d('0x41')]['id']}})[_0x023d('0x25')](handleEntityNotFound(_0x31d850,null))[_0x023d('0x25')](removeEntity(_0x31d850,null))[_0x023d('0x40')](handleError(_0x31d850,null));};exports[_0x023d('0x47')]=function(_0xcde993,_0xd80e24){return db[_0x023d('0x2b')][_0x023d('0x47')]()['then'](respondWithResult(_0xd80e24,null))[_0x023d('0x40')](handleError(_0xd80e24,null));}; \ No newline at end of file +var _0x8972=['lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','save','then','destroy','error','send','index','map','ChatTransferReport','rawAttributes','fieldName','type','name','query','keys','filters','intersection','model','fields','attributes','length','nolimit','order','sort','where','filter','merge','options','includeAll','findAll','rows','show','params','include','find','create','catch','update','body','describe','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra'];(function(_0x319a7a,_0x1d3fef){var _0xd50de4=function(_0x435c1f){while(--_0x435c1f){_0x319a7a['push'](_0x319a7a['shift']());}};_0xd50de4(++_0x1d3fef);}(_0x8972,0xd8));var _0x2897=function(_0x44c7ce,_0x5eea1b){_0x44c7ce=_0x44c7ce-0x0;var _0x2fee57=_0x8972[_0x44c7ce];return _0x2fee57;};'use strict';var emlformat=require(_0x2897('0x0'));var rimraf=require(_0x2897('0x1'));var zipdir=require(_0x2897('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x2897('0x3'));var moment=require(_0x2897('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x2897('0x5'));var util=require(_0x2897('0x6'));var path=require(_0x2897('0x7'));var sox=require(_0x2897('0x8'));var csv=require(_0x2897('0x9'));var ejs=require(_0x2897('0xa'));var fs=require('fs');var fs_extra=require(_0x2897('0xb'));var _=require(_0x2897('0xc'));var squel=require(_0x2897('0xd'));var crypto=require(_0x2897('0xe'));var jsforce=require(_0x2897('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x2897('0x10'));var Papa=require('papaparse');var Redis=require(_0x2897('0x11'));var authService=require(_0x2897('0x12'));var qs=require(_0x2897('0x13'));var as=require(_0x2897('0x14'));var hardwareService=require(_0x2897('0x15'));var logger=require(_0x2897('0x16'))(_0x2897('0x17'));var utils=require('../../config/utils');var config=require(_0x2897('0x18'));var licenseUtil=require(_0x2897('0x19'));var db=require(_0x2897('0x1a'))['db'];function respondWithStatusCode(_0x1e13ea,_0x14bcba){_0x14bcba=_0x14bcba||0xcc;return function(_0x5cc092){if(_0x5cc092){return _0x1e13ea[_0x2897('0x1b')](_0x14bcba);}return _0x1e13ea[_0x2897('0x1c')](_0x14bcba)[_0x2897('0x1d')]();};}function respondWithResult(_0x18d5ce,_0x333dee){_0x333dee=_0x333dee||0xc8;return function(_0x10e536){if(_0x10e536){return _0x18d5ce['status'](_0x333dee)[_0x2897('0x1e')](_0x10e536);}};}function respondWithFilteredResult(_0x476997,_0x36ea56){return function(_0x22e07c){if(_0x22e07c){var _0x3eedaf=typeof _0x36ea56[_0x2897('0x1f')]===_0x2897('0x20')&&typeof _0x36ea56[_0x2897('0x21')]===_0x2897('0x20');var _0x30215c=_0x22e07c['count'];var _0x5298dd=_0x3eedaf?0x0:_0x36ea56[_0x2897('0x1f')];var _0x2e5e07=_0x3eedaf?_0x22e07c[_0x2897('0x22')]:_0x36ea56[_0x2897('0x1f')]+_0x36ea56[_0x2897('0x21')];var _0x531de5;if(_0x2e5e07>=_0x30215c){_0x2e5e07=_0x30215c;_0x531de5=0xc8;}else{_0x531de5=0xce;}_0x476997['status'](_0x531de5);return _0x476997[_0x2897('0x23')](_0x2897('0x24'),_0x5298dd+'-'+_0x2e5e07+'/'+_0x30215c)['json'](_0x22e07c);}return null;};}function patchUpdates(_0x6fa1af){return function(_0x30f920){try{jsonpatch['apply'](_0x30f920,_0x6fa1af,!![]);}catch(_0x3f14ac){return BPromise['reject'](_0x3f14ac);}return _0x30f920[_0x2897('0x25')]();};}function saveUpdates(_0x1929da,_0x2eb70a){return function(_0xcca818){if(_0xcca818){return _0xcca818['update'](_0x1929da)[_0x2897('0x26')](function(_0x576799){return _0x576799;});}return null;};}function removeEntity(_0x21fb77,_0x53de22){return function(_0x59758c){if(_0x59758c){return _0x59758c[_0x2897('0x27')]()[_0x2897('0x26')](function(){_0x21fb77[_0x2897('0x1c')](0xcc)[_0x2897('0x1d')]();});}};}function handleEntityNotFound(_0x4857ff,_0x15a823){return function(_0x56da22){if(!_0x56da22){_0x4857ff['sendStatus'](0x194);}return _0x56da22;};}function handleError(_0x4e62ac,_0x37a20e){_0x37a20e=_0x37a20e||0x1f4;return function(_0x55374f){logger[_0x2897('0x28')](_0x55374f['stack']);if(_0x55374f['name']){delete _0x55374f['name'];}_0x4e62ac['status'](_0x37a20e)[_0x2897('0x29')](_0x55374f);};}exports[_0x2897('0x2a')]=function(_0x942599,_0x84bc74){var _0x3bb17d={},_0x8c4c32={},_0x118288={'count':0x0,'rows':[]};var _0x21579f=_[_0x2897('0x2b')](db[_0x2897('0x2c')][_0x2897('0x2d')],function(_0x2623da){return{'name':_0x2623da[_0x2897('0x2e')],'type':_0x2623da[_0x2897('0x2f')]['key']};});_0x8c4c32['model']=_[_0x2897('0x2b')](_0x21579f,_0x2897('0x30'));_0x8c4c32[_0x2897('0x31')]=_[_0x2897('0x32')](_0x942599[_0x2897('0x31')]);_0x8c4c32[_0x2897('0x33')]=_[_0x2897('0x34')](_0x8c4c32['model'],_0x8c4c32[_0x2897('0x31')]);_0x3bb17d['attributes']=_[_0x2897('0x34')](_0x8c4c32[_0x2897('0x35')],qs['fields'](_0x942599['query'][_0x2897('0x36')]));_0x3bb17d[_0x2897('0x37')]=_0x3bb17d['attributes'][_0x2897('0x38')]?_0x3bb17d[_0x2897('0x37')]:_0x8c4c32[_0x2897('0x35')];if(!_0x942599['query']['hasOwnProperty'](_0x2897('0x39'))){_0x3bb17d[_0x2897('0x21')]=qs['limit'](_0x942599[_0x2897('0x31')][_0x2897('0x21')]);_0x3bb17d[_0x2897('0x1f')]=qs[_0x2897('0x1f')](_0x942599[_0x2897('0x31')][_0x2897('0x1f')]);}_0x3bb17d[_0x2897('0x3a')]=qs[_0x2897('0x3b')](_0x942599[_0x2897('0x31')][_0x2897('0x3b')]);_0x3bb17d[_0x2897('0x3c')]=qs[_0x2897('0x33')](_['pick'](_0x942599['query'],_0x8c4c32[_0x2897('0x33')]),_0x21579f);if(_0x942599[_0x2897('0x31')][_0x2897('0x3d')]){_0x3bb17d[_0x2897('0x3c')]=_[_0x2897('0x3e')](_0x3bb17d[_0x2897('0x3c')],{'$or':_[_0x2897('0x2b')](_0x21579f,function(_0x1a49cd){if(_0x1a49cd[_0x2897('0x2f')]!=='VIRTUAL'){var _0x5ded23={};_0x5ded23[_0x1a49cd['name']]={'$like':'%'+_0x942599[_0x2897('0x31')][_0x2897('0x3d')]+'%'};return _0x5ded23;}})});}_0x3bb17d=_[_0x2897('0x3e')]({},_0x3bb17d,_0x942599[_0x2897('0x3f')]);var _0x2b21af={'where':_0x3bb17d['where']};return db[_0x2897('0x2c')][_0x2897('0x22')](_0x2b21af)[_0x2897('0x26')](function(_0x2dc83a){_0x118288[_0x2897('0x22')]=_0x2dc83a;if(_0x942599[_0x2897('0x31')][_0x2897('0x40')]){_0x3bb17d['include']=[{'all':!![]}];}return db[_0x2897('0x2c')][_0x2897('0x41')](_0x3bb17d);})[_0x2897('0x26')](function(_0x5e6993){_0x118288[_0x2897('0x42')]=_0x5e6993;return _0x118288;})['then'](respondWithFilteredResult(_0x84bc74,_0x3bb17d))['catch'](handleError(_0x84bc74,null));};exports[_0x2897('0x43')]=function(_0x53f349,_0x314bba){var _0x1394dc={'raw':!![],'where':{'id':_0x53f349[_0x2897('0x44')]['id']}},_0x604c4c={};_0x604c4c['model']=_[_0x2897('0x32')](db[_0x2897('0x2c')][_0x2897('0x2d')]);_0x604c4c[_0x2897('0x31')]=_['keys'](_0x53f349[_0x2897('0x31')]);_0x604c4c[_0x2897('0x33')]=_[_0x2897('0x34')](_0x604c4c[_0x2897('0x35')],_0x604c4c[_0x2897('0x31')]);_0x1394dc[_0x2897('0x37')]=_[_0x2897('0x34')](_0x604c4c[_0x2897('0x35')],qs[_0x2897('0x36')](_0x53f349[_0x2897('0x31')][_0x2897('0x36')]));_0x1394dc[_0x2897('0x37')]=_0x1394dc['attributes'][_0x2897('0x38')]?_0x1394dc[_0x2897('0x37')]:_0x604c4c['model'];if(_0x53f349[_0x2897('0x31')][_0x2897('0x40')]){_0x1394dc[_0x2897('0x45')]=[{'all':!![]}];}_0x1394dc=_[_0x2897('0x3e')]({},_0x1394dc,_0x53f349['options']);return db['ChatTransferReport'][_0x2897('0x46')](_0x1394dc)[_0x2897('0x26')](handleEntityNotFound(_0x314bba,null))['then'](respondWithResult(_0x314bba,null))['catch'](handleError(_0x314bba,null));};exports[_0x2897('0x47')]=function(_0x39fd1b,_0x563803){return db[_0x2897('0x2c')][_0x2897('0x47')](_0x39fd1b['body'],{})[_0x2897('0x26')](respondWithResult(_0x563803,0xc9))[_0x2897('0x48')](handleError(_0x563803,null));};exports[_0x2897('0x49')]=function(_0x4b4317,_0x248e51){if(_0x4b4317[_0x2897('0x4a')]['id']){delete _0x4b4317['body']['id'];}return db[_0x2897('0x2c')]['find']({'where':{'id':_0x4b4317[_0x2897('0x44')]['id']}})[_0x2897('0x26')](handleEntityNotFound(_0x248e51,null))['then'](saveUpdates(_0x4b4317[_0x2897('0x4a')],null))[_0x2897('0x26')](respondWithResult(_0x248e51,null))[_0x2897('0x48')](handleError(_0x248e51,null));};exports[_0x2897('0x27')]=function(_0x22a301,_0x52a166){return db['ChatTransferReport']['find']({'where':{'id':_0x22a301[_0x2897('0x44')]['id']}})[_0x2897('0x26')](handleEntityNotFound(_0x52a166,null))['then'](removeEntity(_0x52a166,null))[_0x2897('0x48')](handleError(_0x52a166,null));};exports[_0x2897('0x4b')]=function(_0x49cbed,_0x25f9d9){return db[_0x2897('0x2c')][_0x2897('0x4b')]()['then'](respondWithResult(_0x25f9d9,null))[_0x2897('0x48')](handleError(_0x25f9d9,null));}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.model.js b/server/api/chatTransferReport/chatTransferReport.model.js index 1154eb3..db30f08 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 _0xf807=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatTransferReport.attributes','exports','define','ChatTransferReport','report_chat_transfer','uniqueid','lodash','util'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xf807,0xae));var _0x7f80=function(_0x23b1d5,_0x3043fa){_0x23b1d5=_0x23b1d5-0x0;var _0x3f5702=_0xf807[_0x23b1d5];return _0x3f5702;};'use strict';var _=require(_0x7f80('0x0'));var util=require(_0x7f80('0x1'));var logger=require(_0x7f80('0x2'))(_0x7f80('0x3'));var moment=require(_0x7f80('0x4'));var BPromise=require(_0x7f80('0x5'));var rp=require(_0x7f80('0x6'));var fs=require('fs');var path=require(_0x7f80('0x7'));var rimraf=require(_0x7f80('0x8'));var config=require(_0x7f80('0x9'));var attributes=require(_0x7f80('0xa'));module[_0x7f80('0xb')]=function(_0x219dfd,_0x5ef10b){return _0x219dfd[_0x7f80('0xc')](_0x7f80('0xd'),attributes,{'tableName':_0x7f80('0xe'),'paranoid':![],'indexes':[{'name':_0x7f80('0xf'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x6106=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatTransferReport.attributes','exports','define','ChatTransferReport','uniqueid','lodash','util','../../config/logger'];(function(_0x721852,_0x3fceef){var _0x5d4ed0=function(_0x880af5){while(--_0x880af5){_0x721852['push'](_0x721852['shift']());}};_0x5d4ed0(++_0x3fceef);}(_0x6106,0x129));var _0x6610=function(_0x36ed48,_0x1ee0d4){_0x36ed48=_0x36ed48-0x0;var _0x51c63a=_0x6106[_0x36ed48];return _0x51c63a;};'use strict';var _=require(_0x6610('0x0'));var util=require(_0x6610('0x1'));var logger=require(_0x6610('0x2'))(_0x6610('0x3'));var moment=require(_0x6610('0x4'));var BPromise=require(_0x6610('0x5'));var rp=require(_0x6610('0x6'));var fs=require('fs');var path=require(_0x6610('0x7'));var rimraf=require(_0x6610('0x8'));var config=require(_0x6610('0x9'));var attributes=require(_0x6610('0xa'));module[_0x6610('0xb')]=function(_0x1776ca,_0x51b4e5){return _0x1776ca[_0x6610('0xc')](_0x6610('0xd'),attributes,{'tableName':'report_chat_transfer','paranoid':![],'indexes':[{'name':_0x6610('0xe'),'fields':[_0x6610('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.rpc.js b/server/api/chatTransferReport/chatTransferReport.rpc.js index 77cd12b..5dca2fc 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 _0x05db=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','then','info','ChatTransferReport,\x20%s,\x20%s','request\x20sent','debug','ChatTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch'];(function(_0x2063e4,_0x444018){var _0x269649=function(_0x5f3121){while(--_0x5f3121){_0x2063e4['push'](_0x2063e4['shift']());}};_0x269649(++_0x444018);}(_0x05db,0x177));var _0xb05d=function(_0x4f3cd1,_0x4b666e){_0x4f3cd1=_0x4f3cd1-0x0;var _0x4f304d=_0x05db[_0x4f3cd1];return _0x4f304d;};'use strict';var _=require(_0xb05d('0x0'));var util=require(_0xb05d('0x1'));var moment=require(_0xb05d('0x2'));var BPromise=require(_0xb05d('0x3'));var rs=require(_0xb05d('0x4'));var fs=require('fs');var Redis=require(_0xb05d('0x5'));var db=require(_0xb05d('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xb05d('0x7'))(_0xb05d('0x8'));var config=require('../../config/environment');var jayson=require(_0xb05d('0x9'));var client=jayson[_0xb05d('0xa')][_0xb05d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5bd29f,_0x399b9a,_0x47facf){return new BPromise(function(_0x5c7c27,_0x9519b8){return client[_0xb05d('0xc')](_0x5bd29f,_0x47facf)[_0xb05d('0xd')](function(_0x48fa50){logger[_0xb05d('0xe')](_0xb05d('0xf'),_0x399b9a,_0xb05d('0x10'));logger[_0xb05d('0x11')](_0xb05d('0x12'),_0x399b9a,'request\x20sent',JSON[_0xb05d('0x13')](_0x48fa50));if(_0x48fa50[_0xb05d('0x14')]){if(_0x48fa50[_0xb05d('0x14')][_0xb05d('0x15')]===0x1f4){logger[_0xb05d('0x14')](_0xb05d('0xf'),_0x399b9a,_0x48fa50[_0xb05d('0x14')][_0xb05d('0x16')]);return _0x9519b8(_0x48fa50[_0xb05d('0x14')][_0xb05d('0x16')]);}logger[_0xb05d('0x14')]('ChatTransferReport,\x20%s,\x20%s',_0x399b9a,_0x48fa50[_0xb05d('0x14')]['message']);return _0x5c7c27(_0x48fa50[_0xb05d('0x14')]['message']);}else{logger[_0xb05d('0xe')](_0xb05d('0xf'),_0x399b9a,_0xb05d('0x10'));_0x5c7c27(_0x48fa50[_0xb05d('0x17')]['message']);}})[_0xb05d('0x18')](function(_0x177b0d){logger[_0xb05d('0x14')]('ChatTransferReport,\x20%s,\x20%s',_0x399b9a,_0x177b0d);_0x9519b8(_0x177b0d);});});} \ No newline at end of file +var _0x0cbb=['info','ChatTransferReport,\x20%s,\x20%s','request\x20sent','error','code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','jayson/promise','client','then'];(function(_0x1e6659,_0x1f860c){var _0x4d16e4=function(_0x21c05a){while(--_0x21c05a){_0x1e6659['push'](_0x1e6659['shift']());}};_0x4d16e4(++_0x1f860c);}(_0x0cbb,0x16f));var _0xb0cb=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0cbb[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xb0cb('0x0'));var util=require(_0xb0cb('0x1'));var moment=require(_0xb0cb('0x2'));var BPromise=require(_0xb0cb('0x3'));var rs=require(_0xb0cb('0x4'));var fs=require('fs');var Redis=require(_0xb0cb('0x5'));var db=require(_0xb0cb('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xb0cb('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0xb0cb('0x8'));var client=jayson[_0xb0cb('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2c8c76,_0x30244b,_0x3f472d){return new BPromise(function(_0x45d22e,_0x18dc1a){return client['request'](_0x2c8c76,_0x3f472d)[_0xb0cb('0xa')](function(_0x104915){logger[_0xb0cb('0xb')](_0xb0cb('0xc'),_0x30244b,'request\x20sent');logger['debug']('ChatTransferReport,\x20%s,\x20%s,\x20%s',_0x30244b,_0xb0cb('0xd'),JSON['stringify'](_0x104915));if(_0x104915[_0xb0cb('0xe')]){if(_0x104915[_0xb0cb('0xe')][_0xb0cb('0xf')]===0x1f4){logger['error'](_0xb0cb('0xc'),_0x30244b,_0x104915['error']['message']);return _0x18dc1a(_0x104915[_0xb0cb('0xe')][_0xb0cb('0x10')]);}logger[_0xb0cb('0xe')](_0xb0cb('0xc'),_0x30244b,_0x104915[_0xb0cb('0xe')][_0xb0cb('0x10')]);return _0x45d22e(_0x104915['error'][_0xb0cb('0x10')]);}else{logger[_0xb0cb('0xb')](_0xb0cb('0xc'),_0x30244b,'request\x20sent');_0x45d22e(_0x104915['result'][_0xb0cb('0x10')]);}})[_0xb0cb('0x11')](function(_0x26f23f){logger['error'](_0xb0cb('0xc'),_0x30244b,_0x26f23f);_0x18dc1a(_0x26f23f);});});} \ No newline at end of file diff --git a/server/api/chatTransferReport/index.js b/server/api/chatTransferReport/index.js index ec11ea3..9fe1835 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 _0x2ec1=['index','/describe','describe','/:id','isAuthenticated','create','put','update','delete','destroy','exports','multer','util','connect-timeout','Router','fs-extra','../../config/environment','./chatTransferReport.controller','get'];(function(_0x4c96cd,_0x27292a){var _0xec172c=function(_0x84836d){while(--_0x84836d){_0x4c96cd['push'](_0x4c96cd['shift']());}};_0xec172c(++_0x27292a);}(_0x2ec1,0x1e6));var _0x12ec=function(_0x5e9b84,_0x41bd6f){_0x5e9b84=_0x5e9b84-0x0;var _0x274bd8=_0x2ec1[_0x5e9b84];return _0x274bd8;};'use strict';var multer=require(_0x12ec('0x0'));var util=require(_0x12ec('0x1'));var path=require('path');var timeout=require(_0x12ec('0x2'));var express=require('express');var router=express[_0x12ec('0x3')]();var fs_extra=require(_0x12ec('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x12ec('0x5'));var controller=require(_0x12ec('0x6'));router[_0x12ec('0x7')]('/',auth['isAuthenticated'](),controller[_0x12ec('0x8')]);router[_0x12ec('0x7')](_0x12ec('0x9'),auth['isAuthenticated'](),controller[_0x12ec('0xa')]);router['get'](_0x12ec('0xb'),auth[_0x12ec('0xc')](),controller['show']);router['post']('/',auth[_0x12ec('0xc')](),controller[_0x12ec('0xd')]);router[_0x12ec('0xe')](_0x12ec('0xb'),auth[_0x12ec('0xc')](),controller[_0x12ec('0xf')]);router[_0x12ec('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x12ec('0x11')]);module[_0x12ec('0x12')]=router; \ No newline at end of file +var _0xe08f=['post','create','update','exports','multer','util','connect-timeout','Router','fs-extra','../../components/interaction/service','./chatTransferReport.controller','get','isAuthenticated','/describe','describe','/:id','show'];(function(_0x44989b,_0x1824e8){var _0x1c771c=function(_0xbbfbac){while(--_0xbbfbac){_0x44989b['push'](_0x44989b['shift']());}};_0x1c771c(++_0x1824e8);}(_0xe08f,0x17a));var _0xfe08=function(_0x287af7,_0x241f71){_0x287af7=_0x287af7-0x0;var _0x3dedb8=_0xe08f[_0x287af7];return _0x3dedb8;};'use strict';var multer=require(_0xfe08('0x0'));var util=require(_0xfe08('0x1'));var path=require('path');var timeout=require(_0xfe08('0x2'));var express=require('express');var router=express[_0xfe08('0x3')]();var fs_extra=require(_0xfe08('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xfe08('0x5'));var config=require('../../config/environment');var controller=require(_0xfe08('0x6'));router[_0xfe08('0x7')]('/',auth[_0xfe08('0x8')](),controller['index']);router['get'](_0xfe08('0x9'),auth[_0xfe08('0x8')](),controller[_0xfe08('0xa')]);router[_0xfe08('0x7')](_0xfe08('0xb'),auth[_0xfe08('0x8')](),controller[_0xfe08('0xc')]);router[_0xfe08('0xd')]('/',auth[_0xfe08('0x8')](),controller[_0xfe08('0xe')]);router['put'](_0xfe08('0xb'),auth['isAuthenticated'](),controller[_0xfe08('0xf')]);router['delete'](_0xfe08('0xb'),auth[_0xfe08('0x8')](),controller['destroy']);module[_0xfe08('0x10')]=router; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.attributes.js b/server/api/chatWebsite/chatWebsite.attributes.js index 47fe676..780c5bb 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 _0x7378=['stringify','input','name','text','getDataValue','onlineForm','parse','setDataValue','textarea','Comments','Leave\x20your\x20comments','offlineForm','generate','All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.','You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:','Your\x20request\x20has\x20not\x20been\x20processed.','Skip','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','bottom_right','alternate','#fafafa','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','email','#011F6A','#ffffff','BOOLEAN','ENUM','rounded','squared','We\x20are\x20here!','Chat','Send','Contact\x20us','INTEGER','Powered\x20by\x20xCALLY','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20properly\x20submitted','Form\x20submission\x20error','Note','Thanks\x20you\x20for\x20your\x20time!','Feedback','star','TEXT'];(function(_0x1f7984,_0xb98bd9){var _0x679f60=function(_0x16b213){while(--_0x16b213){_0x1f7984['push'](_0x1f7984['shift']());}};_0x679f60(++_0xb98bd9);}(_0x7378,0x81));var _0x8737=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x7378[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require('sequelize');var rs=require(_0x8737('0x0'));module[_0x8737('0x1')]={'name':{'type':Sequelize[_0x8737('0x2')],'allowNull':![]},'address':{'type':Sequelize['STRING'],'allowNull':![],'unique':'address'},'description':{'type':Sequelize[_0x8737('0x2')]},'mapKey':{'type':Sequelize['STRING'],'defaultValue':_0x8737('0x3')},'mapKeyOffline':{'type':Sequelize[_0x8737('0x2')],'defaultValue':_0x8737('0x3')},'key':{'type':Sequelize[_0x8737('0x2')],'allowNull':![]},'agentAlias':{'type':Sequelize['STRING'],'defaultValue':'Agent'},'customerAlias':{'type':Sequelize[_0x8737('0x2')],'defaultValue':'Me'},'color':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x8737('0x4'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0x8737('0x2')],'allowNull':![],'defaultValue':_0x8737('0x4'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0x8737('0x2')],'allowNull':![],'defaultValue':_0x8737('0x5'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xf},'remote':{'type':Sequelize['STRING']},'animation':{'type':Sequelize[_0x8737('0x6')],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0x8737('0x7')](_0x8737('0x8'),_0x8737('0x9')),'defaultValue':_0x8737('0x8')},'header_online':{'type':Sequelize[_0x8737('0x2')],'defaultValue':_0x8737('0xa')},'start_chat_button':{'type':Sequelize[_0x8737('0x2')],'defaultValue':_0x8737('0xb')},'offline_chat_button':{'type':Sequelize[_0x8737('0x2')],'defaultValue':_0x8737('0xc')},'header_offline':{'type':Sequelize[_0x8737('0x2')],'defaultValue':_0x8737('0xd')},'download_transcript':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'timeout':{'type':Sequelize[_0x8737('0xe')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0x8737('0x2')],'defaultValue':_0x8737('0xf')},'defaultWhiteLabel':{'type':Sequelize[_0x8737('0x6')],'defaultValue':!![]},'sitepic':{'type':Sequelize['TEXT']},'closingQuestion':{'type':Sequelize[_0x8737('0x2')],'defaultValue':_0x8737('0x10')},'formSubmitSuccessMessage':{'type':Sequelize[_0x8737('0x2')],'defaultValue':_0x8737('0x11')},'formSubmitFailureMessage':{'type':Sequelize[_0x8737('0x2')],'defaultValue':_0x8737('0x12')},'noteTitle':{'type':Sequelize[_0x8737('0x2')],'defaultValue':_0x8737('0x13')},'placeholderMessage':{'type':Sequelize['STRING'],'defaultValue':'Type\x20a\x20message'},'closingMessage':{'type':Sequelize[_0x8737('0x2')],'defaultValue':_0x8737('0x14')},'closingMessageButton':{'type':Sequelize['STRING'],'defaultValue':_0x8737('0xc')},'skipMessageButton':{'type':Sequelize[_0x8737('0x2')],'defaultValue':'Skip'},'conditionAgreement':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableRating':{'type':Sequelize[_0x8737('0x6')],'defaultValue':![]},'enableFeedback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0x8737('0x6')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0x8737('0x2')],'defaultValue':_0x8737('0x15')},'ratingType':{'type':Sequelize['ENUM'](_0x8737('0x16'),'thumb'),'defaultValue':_0x8737('0x16')},'ratingStarsNumber':{'type':Sequelize[_0x8737('0xe')],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0x8737('0x17')],'defaultValue':function(){return JSON[_0x8737('0x18')]({'items':[{'type':_0x8737('0x19'),'variable':null,'config':{'placeholder':_0x8737('0x1a'),'type':_0x8737('0x1b'),'required':!![]},'props':{'title':'name','helpText':''}},{'type':_0x8737('0x19'),'props':{'title':_0x8737('0x3'),'helpText':''},'config':{'required':!![],'placeholder':_0x8737('0x3'),'type':'email'},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0x8737('0x1c')](_0x8737('0x1d'))?JSON[_0x8737('0x1e')](this[_0x8737('0x1c')](_0x8737('0x1d'))):{};},'set':function(_0x2a9f99){return this[_0x8737('0x1f')](_0x8737('0x1d'),JSON['stringify'](_0x2a9f99));}},'offlineForm':{'type':Sequelize['TEXT'],'defaultValue':function(){return JSON['stringify']({'items':[{'type':_0x8737('0x19'),'props':{'title':_0x8737('0x3'),'helpText':''},'config':{'required':!![],'placeholder':_0x8737('0x3'),'type':_0x8737('0x3')},'variable':null},{'type':_0x8737('0x20'),'config':{'placeholder':_0x8737('0x21')},'props':{'title':_0x8737('0x21'),'helpText':_0x8737('0x22')}}],'fromKey':0x0});},'get':function(){return this[_0x8737('0x1c')]('offlineForm')?JSON[_0x8737('0x1e')](this[_0x8737('0x1c')](_0x8737('0x23'))):{};},'set':function(_0x58834b){return this['setDataValue']('offlineForm',JSON['stringify'](_0x58834b));}},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0x8737('0x24')]();}},'autoclose':{'type':Sequelize[_0x8737('0x6')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0x8737('0x6')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0x8737('0x2')]},'forwardOffline':{'type':Sequelize[_0x8737('0x6')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize['STRING']},'waitingTitle':{'type':Sequelize[_0x8737('0x2')],'defaultValue':_0x8737('0x25')},'waitingMessage':{'type':Sequelize['STRING'],'defaultValue':'Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.'},'offlineMessageSubject':{'type':Sequelize[_0x8737('0x2')],'defaultValue':'New\x20offline\x20message\x20from\x20websiteName'},'offlineMessageBody':{'type':Sequelize[_0x8737('0x2')],'defaultValue':_0x8737('0x26')},'enableUnmanagedNote':{'type':Sequelize[_0x8737('0x6')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0x8737('0x2')],'defaultValue':_0x8737('0x27')},'skipUnmanaged':{'type':Sequelize[_0x8737('0x2')],'defaultValue':_0x8737('0x28')},'sendUnmanaged':{'type':Sequelize[_0x8737('0x2')],'defaultValue':_0x8737('0xc')},'enableCustomerAttachment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0x8737('0x6')],'defaultValue':![]},'agentAvatar':{'type':Sequelize['TEXT']},'showAgentAvatar':{'type':Sequelize[_0x8737('0x6')],'defaultValue':![]},'timezone':{'type':Sequelize[_0x8737('0x2')]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x8737('0x29');}},'notificationSound':{'type':Sequelize[_0x8737('0x6')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x8737('0x6')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0x8737('0x2')],'defaultValue':'website_alias'},'waitForTheAssignedAgent':{'type':Sequelize[_0x8737('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize['STRING'],'defaultValue':_0x8737('0x2a')},'verticalAlignment':{'type':Sequelize[_0x8737('0xe')],'defaultValue':0x1e},'labelText':{'type':Sequelize[_0x8737('0x2')],'defaultValue':'CHAT'},'messagesAlignment':{'type':Sequelize[_0x8737('0x2')],'defaultValue':_0x8737('0x2b')},'defaultTitle':{'type':Sequelize[_0x8737('0x2')]},'customerAvatar':{'type':Sequelize['TEXT']},'showCustomerAvatar':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'messageFontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0x8737('0x2')],'allowNull':![],'defaultValue':_0x8737('0x2c'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0x8737('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},'systemAlias':{'type':Sequelize[_0x8737('0x2')],'defaultValue':'System'},'systemAvatar':{'type':Sequelize['TEXT']},'mandatoryDispositionPauseId':{'type':Sequelize[_0x8737('0xe')],'comment':_0x8737('0x2d')},'mandatoryDisposition':{'type':Sequelize[_0x8737('0x6')],'defaultValue':![],'comment':_0x8737('0x2e'),'set':function(_0x410655){if(!_0x410655)this['setDataValue'](_0x8737('0x2f'),null);this[_0x8737('0x1f')](_0x8737('0x30'),_0x410655);}},'vidaooEscalation':{'type':Sequelize[_0x8737('0x6')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0x8737('0x2')]},'vidaooTopic':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x8737('0x31')},'vidaooNote':{'type':Sequelize[_0x8737('0x2')],'defaultValue':function(){return _0x8737('0x32');}},'vidaooMetadata':{'type':Sequelize[_0x8737('0x17')],'defaultValue':null},'openNewInteraction':{'type':Sequelize[_0x8737('0x6')],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize[_0x8737('0x17')]}}; \ No newline at end of file +var _0xead1=['STRING','address','email','Agent','#011F6A','INTEGER','ENUM','rounded','We\x20are\x20here!','Chat','Contact\x20us','BOOLEAN','Powered\x20by\x20xCALLY','TEXT','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20submission\x20error','Note','Thanks\x20you\x20for\x20your\x20time!','Send','Skip','Feedback','star','thumb','input','name','text','getDataValue','onlineForm','setDataValue','stringify','Comments','Leave\x20your\x20comments','offlineForm','All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.','Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.','You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:','Your\x20request\x20has\x20not\x20been\x20processed.','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','website_alias','CHAT','alternate','System','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDisposition','Generated\x20by\x20XCALLY\x20Motion','Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}','sequelize','randomstring','exports'];(function(_0x4ec6db,_0x393d10){var _0x5b46fc=function(_0x18d087){while(--_0x18d087){_0x4ec6db['push'](_0x4ec6db['shift']());}};_0x5b46fc(++_0x393d10);}(_0xead1,0x129));var _0x1ead=function(_0x4fc9e6,_0xc51915){_0x4fc9e6=_0x4fc9e6-0x0;var _0x551d28=_0xead1[_0x4fc9e6];return _0x551d28;};'use strict';var Sequelize=require(_0x1ead('0x0'));var rs=require(_0x1ead('0x1'));module[_0x1ead('0x2')]={'name':{'type':Sequelize[_0x1ead('0x3')],'allowNull':![]},'address':{'type':Sequelize[_0x1ead('0x3')],'allowNull':![],'unique':_0x1ead('0x4')},'description':{'type':Sequelize[_0x1ead('0x3')]},'mapKey':{'type':Sequelize[_0x1ead('0x3')],'defaultValue':_0x1ead('0x5')},'mapKeyOffline':{'type':Sequelize[_0x1ead('0x3')],'defaultValue':_0x1ead('0x5')},'key':{'type':Sequelize['STRING'],'allowNull':![]},'agentAlias':{'type':Sequelize[_0x1ead('0x3')],'defaultValue':_0x1ead('0x6')},'customerAlias':{'type':Sequelize[_0x1ead('0x3')],'defaultValue':'Me'},'color':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x1ead('0x7'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x1ead('0x7'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'#ffffff','validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0x1ead('0x8')],'defaultValue':0xf},'remote':{'type':Sequelize[_0x1ead('0x3')]},'animation':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0x1ead('0x9')](_0x1ead('0xa'),'squared'),'defaultValue':_0x1ead('0xa')},'header_online':{'type':Sequelize[_0x1ead('0x3')],'defaultValue':_0x1ead('0xb')},'start_chat_button':{'type':Sequelize[_0x1ead('0x3')],'defaultValue':_0x1ead('0xc')},'offline_chat_button':{'type':Sequelize[_0x1ead('0x3')],'defaultValue':'Send'},'header_offline':{'type':Sequelize[_0x1ead('0x3')],'defaultValue':_0x1ead('0xd')},'download_transcript':{'type':Sequelize[_0x1ead('0xe')],'defaultValue':!![]},'timeout':{'type':Sequelize[_0x1ead('0x8')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0x1ead('0x3')],'defaultValue':_0x1ead('0xf')},'defaultWhiteLabel':{'type':Sequelize[_0x1ead('0xe')],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0x1ead('0x10')]},'closingQuestion':{'type':Sequelize['STRING'],'defaultValue':_0x1ead('0x11')},'formSubmitSuccessMessage':{'type':Sequelize['STRING'],'defaultValue':'Form\x20properly\x20submitted'},'formSubmitFailureMessage':{'type':Sequelize[_0x1ead('0x3')],'defaultValue':_0x1ead('0x12')},'noteTitle':{'type':Sequelize[_0x1ead('0x3')],'defaultValue':_0x1ead('0x13')},'placeholderMessage':{'type':Sequelize[_0x1ead('0x3')],'defaultValue':'Type\x20a\x20message'},'closingMessage':{'type':Sequelize[_0x1ead('0x3')],'defaultValue':_0x1ead('0x14')},'closingMessageButton':{'type':Sequelize[_0x1ead('0x3')],'defaultValue':_0x1ead('0x15')},'skipMessageButton':{'type':Sequelize[_0x1ead('0x3')],'defaultValue':_0x1ead('0x16')},'conditionAgreement':{'type':Sequelize[_0x1ead('0xe')],'defaultValue':![]},'enableRating':{'type':Sequelize[_0x1ead('0xe')],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0x1ead('0xe')],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0x1ead('0xe')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0x1ead('0x3')],'defaultValue':_0x1ead('0x17')},'ratingType':{'type':Sequelize[_0x1ead('0x9')](_0x1ead('0x18'),_0x1ead('0x19')),'defaultValue':_0x1ead('0x18')},'ratingStarsNumber':{'type':Sequelize[_0x1ead('0x8')],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0x1ead('0x10')],'defaultValue':function(){return JSON['stringify']({'items':[{'type':_0x1ead('0x1a'),'variable':null,'config':{'placeholder':_0x1ead('0x1b'),'type':_0x1ead('0x1c'),'required':!![]},'props':{'title':_0x1ead('0x1b'),'helpText':''}},{'type':_0x1ead('0x1a'),'props':{'title':'email','helpText':''},'config':{'required':!![],'placeholder':'email','type':_0x1ead('0x5')},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0x1ead('0x1d')]('onlineForm')?JSON['parse'](this[_0x1ead('0x1d')](_0x1ead('0x1e'))):{};},'set':function(_0x5a56b1){return this[_0x1ead('0x1f')]('onlineForm',JSON[_0x1ead('0x20')](_0x5a56b1));}},'offlineForm':{'type':Sequelize['TEXT'],'defaultValue':function(){return JSON[_0x1ead('0x20')]({'items':[{'type':_0x1ead('0x1a'),'props':{'title':'email','helpText':''},'config':{'required':!![],'placeholder':_0x1ead('0x5'),'type':_0x1ead('0x5')},'variable':null},{'type':'textarea','config':{'placeholder':'Comments'},'props':{'title':_0x1ead('0x21'),'helpText':_0x1ead('0x22')}}],'fromKey':0x0});},'get':function(){return this[_0x1ead('0x1d')](_0x1ead('0x23'))?JSON['parse'](this[_0x1ead('0x1d')](_0x1ead('0x23'))):{};},'set':function(_0x244b1a){return this['setDataValue'](_0x1ead('0x23'),JSON[_0x1ead('0x20')](_0x244b1a));}},'token':{'type':Sequelize[_0x1ead('0x3')],'defaultValue':function(){return rs['generate']();}},'autoclose':{'type':Sequelize[_0x1ead('0xe')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0x1ead('0xe')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0x1ead('0xe')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize['STRING']},'forwardOffline':{'type':Sequelize[_0x1ead('0xe')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0x1ead('0x3')]},'waitingTitle':{'type':Sequelize[_0x1ead('0x3')],'defaultValue':_0x1ead('0x24')},'waitingMessage':{'type':Sequelize[_0x1ead('0x3')],'defaultValue':_0x1ead('0x25')},'offlineMessageSubject':{'type':Sequelize[_0x1ead('0x3')],'defaultValue':'New\x20offline\x20message\x20from\x20websiteName'},'offlineMessageBody':{'type':Sequelize[_0x1ead('0x3')],'defaultValue':_0x1ead('0x26')},'enableUnmanagedNote':{'type':Sequelize[_0x1ead('0xe')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0x1ead('0x3')],'defaultValue':_0x1ead('0x27')},'skipUnmanaged':{'type':Sequelize['STRING'],'defaultValue':_0x1ead('0x16')},'sendUnmanaged':{'type':Sequelize[_0x1ead('0x3')],'defaultValue':'Send'},'enableCustomerAttachment':{'type':Sequelize[_0x1ead('0xe')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0x1ead('0xe')],'defaultValue':![]},'agentAvatar':{'type':Sequelize['TEXT']},'showAgentAvatar':{'type':Sequelize[_0x1ead('0xe')],'defaultValue':![]},'timezone':{'type':Sequelize[_0x1ead('0x3')]},'notificationTemplate':{'type':Sequelize[_0x1ead('0x10')],'defaultValue':function(){return _0x1ead('0x28');}},'notificationSound':{'type':Sequelize[_0x1ead('0xe')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0x1ead('0xe')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0x1ead('0x3')],'defaultValue':_0x1ead('0x29')},'waitForTheAssignedAgent':{'type':Sequelize[_0x1ead('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0x1ead('0x3')],'defaultValue':'bottom_right'},'verticalAlignment':{'type':Sequelize[_0x1ead('0x8')],'defaultValue':0x1e},'labelText':{'type':Sequelize[_0x1ead('0x3')],'defaultValue':_0x1ead('0x2a')},'messagesAlignment':{'type':Sequelize['STRING'],'defaultValue':_0x1ead('0x2b')},'defaultTitle':{'type':Sequelize[_0x1ead('0x3')]},'customerAvatar':{'type':Sequelize[_0x1ead('0x10')]},'showCustomerAvatar':{'type':Sequelize[_0x1ead('0xe')],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0x1ead('0x8')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'#fafafa','validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0x1ead('0xe')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x1ead('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0x1ead('0x3')],'defaultValue':_0x1ead('0x2c')},'systemAvatar':{'type':Sequelize[_0x1ead('0x10')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x1ead('0x8')],'comment':_0x1ead('0x2d')},'mandatoryDisposition':{'type':Sequelize[_0x1ead('0xe')],'defaultValue':![],'comment':_0x1ead('0x2e'),'set':function(_0x5645bd){if(!_0x5645bd)this[_0x1ead('0x1f')]('mandatoryDispositionPauseId',null);this['setDataValue'](_0x1ead('0x2f'),_0x5645bd);}},'vidaooEscalation':{'type':Sequelize[_0x1ead('0xe')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0x1ead('0x3')]},'vidaooTopic':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x1ead('0x30')},'vidaooNote':{'type':Sequelize[_0x1ead('0x3')],'defaultValue':function(){return _0x1ead('0x31');}},'vidaooMetadata':{'type':Sequelize['TEXT'],'defaultValue':null},'openNewInteraction':{'type':Sequelize[_0x1ead('0xe')],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize[_0x1ead('0x10')]}}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.controller.js b/server/api/chatWebsite/chatWebsite.controller.js index 8e03824..2c32eaa 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 _0xbaf0=['userChatWebsite:remove','getAgents','mustache','util','path','ejs','fs-extra','lodash','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./chatWebsite.socket','register','html-to-text','jayson/promise','client','http','then','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','sendStatus','status','json','offset','undefined','limit','count','set','update','destroy','get','ChatWebsites','UserProfileResource','end','stack','name','send','Pause','mandatoryDispositionPause','ChatWebsite','rawAttributes','fieldName','model','map','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','type','VIRTUAL','options','includeAll','include','rows','show','params','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getDispositions','findOne','Disposition','findAll','removeDispositions','ids','addAnswer','ChatWebsiteId','CannedAnswer','length','removeAnswers','addLogo','sitepic','file','filename','addAvatar','agentAvatar','addCustomerAvatar','customerAvatar','addSystemAvatar','systemAvatar','getLogo','join','root','server/files/images/logos/default_logo.svg','getLicense','custom','isNil','server/files/images/logos/','download','server/files/images/avatars/default_avatar.png','existsSync','server/files/images/avatars/','getCustomerAvatar','server/files/images/avatars/customer_avatar.png','showCustomerAvatar','server/files/images/avatars/system_avatar.png','notify','headers','user-agent','getResult','chat','CmContact','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','from','Sequelize','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','includes','CmList','Contacts','DESC','Applications','List','account','applications','list','orderBy','priority','asc','ListId','contact','customerIp','cf-connecting-ip','first','x-forwarded-for','split','firstName','x-real-port','browser','format','%s\x20%s','version','unknown','device','vendor','threadId','ChatInteraction','externalUrl','ContactId','interaction','spread','lastName','messageId','created','unmanaged','*,*,*,*','AttachmentId','UserId','User','unshift','waitForTheAssignedAgent','forcedOwnership','Start','startRouting','EventManager','offline','mapKeyOffline','MailAccount','findOrCreate','readFileSync','server/files/templates/chatOfflineMessage.ejs','utf8','render','toPairs','offlineMessageBody','ChatOfflineMessage','fromString','originalname','mimetype','server','files','attachments','offline-chat','basename','openNewInteraction','sequelize','Attachment','bulkCreate','MailServerOut','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','notifyMail','remove','addInteraction','Contact','Owner','fullname','internal','Tags','Command','iftime\x20%s,%s','interval','timezone','iftime\x20%s','true','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','OFFLINE','No\x20timezone','inspect','getSnippet','Interval','Intervals','getProactiveActions','../../config/license/util','virtual','License','increment','chatLicenseExceeded','push','all','server/files/chat/iframe.ejs','remote','referer','alignment','verticalAlignment','labelText','textColor','color_button','backgroundColor','addApplications','transaction','ISOLATION_LEVELS','READ_COMMITTED','ChatApplication','finally','getApplications','chatProactiveAction','addProactiveActions','omit','getFields','online','false','onlineForm','items','fromKey','Attachments','addAgents','emit','userChatWebsite:save','removeAgents'];(function(_0x55e90e,_0x1f2887){var _0x35553f=function(_0x5289db){while(--_0x5289db){_0x55e90e['push'](_0x55e90e['shift']());}};_0x35553f(++_0x1f2887);}(_0xbaf0,0x12a));var _0x0baf=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0xbaf0[_0x2b4411];return _0x8e41ef;};'use strict';var BPromise=require('bluebird');var Mustache=require(_0x0baf('0x0'));var util=require(_0x0baf('0x1'));var path=require(_0x0baf('0x2'));var ejs=require(_0x0baf('0x3'));var fs=require('fs');var fs_extra=require(_0x0baf('0x4'));var _=require(_0x0baf('0x5'));var querystring=require('querystring');var Redis=require(_0x0baf('0x6'));var qs=require(_0x0baf('0x7'));var logger=require(_0x0baf('0x8'))(_0x0baf('0x9'));var config=require(_0x0baf('0xa'));var db=require(_0x0baf('0xb'))['db'];config[_0x0baf('0xc')]=_[_0x0baf('0xd')](config[_0x0baf('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x0baf('0xe'))(new Redis(config['redis']));require(_0x0baf('0xf'))[_0x0baf('0x10')](socket);var htmlToText=require(_0x0baf('0x11'));var jayson=require(_0x0baf('0x12'));var client=jayson[_0x0baf('0x13')][_0x0baf('0x14')]({'port':0x232c});var client9002=jayson[_0x0baf('0x13')][_0x0baf('0x14')]({'port':0x232a});var client9003=jayson[_0x0baf('0x13')][_0x0baf('0x14')]({'port':0x232b});var client9001=jayson[_0x0baf('0x13')]['http']({'port':0x2329});function respondWithRpcPromise(_0x5a53e2,_0x465dd7,_0xe4378c,_0x5db689){return new BPromise(function(_0x13df17,_0x5a0583){var _0x2ab33e=_0x5db689||client;return _0x2ab33e['request'](_0x5a53e2,_0xe4378c)[_0x0baf('0x15')](function(_0x1f50c3){logger[_0x0baf('0x16')](_0x0baf('0x17'),_0x465dd7,_0x0baf('0x18'));logger[_0x0baf('0x19')]('ChatWebsite,\x20%s,\x20%s,\x20%s',_0x465dd7,'request\x20sent',JSON[_0x0baf('0x1a')](_0x1f50c3));if(_0x1f50c3[_0x0baf('0x1b')]){if(_0x1f50c3[_0x0baf('0x1b')][_0x0baf('0x1c')]===0x1f4){logger[_0x0baf('0x1b')](_0x0baf('0x17'),_0x465dd7,_0x1f50c3['error'][_0x0baf('0x1d')]);return _0x5a0583(_0x1f50c3[_0x0baf('0x1b')][_0x0baf('0x1d')]);}logger[_0x0baf('0x1b')](_0x0baf('0x17'),_0x465dd7,_0x1f50c3[_0x0baf('0x1b')]['message']);return _0x13df17(_0x1f50c3['error'][_0x0baf('0x1d')]);}else{logger[_0x0baf('0x16')](_0x0baf('0x17'),_0x465dd7,_0x0baf('0x18'));_0x13df17(_0x1f50c3[_0x0baf('0x1e')][_0x0baf('0x1d')]);}})[_0x0baf('0x1f')](function(_0x636a13){logger[_0x0baf('0x1b')](_0x0baf('0x17'),_0x465dd7,_0x636a13);_0x5a0583(_0x636a13);});});}function respondWithStatusCode(_0x54f2fa,_0x334bd6){_0x334bd6=_0x334bd6||0xcc;return function(_0x482522){if(_0x482522){return _0x54f2fa[_0x0baf('0x20')](_0x334bd6);}return _0x54f2fa['status'](_0x334bd6)['end']();};}function respondWithResult(_0x2ef0aa,_0x48a0e9){_0x48a0e9=_0x48a0e9||0xc8;return function(_0x4be1b9){if(_0x4be1b9){return _0x2ef0aa[_0x0baf('0x21')](_0x48a0e9)[_0x0baf('0x22')](_0x4be1b9);}};}function respondWithFilteredResult(_0x34e264,_0x19d9fd){return function(_0x3a1ba1){if(_0x3a1ba1){var _0x56b299=typeof _0x19d9fd[_0x0baf('0x23')]===_0x0baf('0x24')&&typeof _0x19d9fd[_0x0baf('0x25')]===_0x0baf('0x24');var _0x3843b8=_0x3a1ba1[_0x0baf('0x26')];var _0x453525=_0x56b299?0x0:_0x19d9fd['offset'];var _0x1590b4=_0x56b299?_0x3a1ba1[_0x0baf('0x26')]:_0x19d9fd[_0x0baf('0x23')]+_0x19d9fd[_0x0baf('0x25')];var _0x55c715;if(_0x1590b4>=_0x3843b8){_0x1590b4=_0x3843b8;_0x55c715=0xc8;}else{_0x55c715=0xce;}_0x34e264[_0x0baf('0x21')](_0x55c715);return _0x34e264[_0x0baf('0x27')]('Content-Range',_0x453525+'-'+_0x1590b4+'/'+_0x3843b8)[_0x0baf('0x22')](_0x3a1ba1);}return null;};}function saveUpdates(_0x32e4fb){return function(_0x478ce8){if(_0x478ce8){return _0x478ce8[_0x0baf('0x28')](_0x32e4fb)[_0x0baf('0x15')](function(_0x366924){return _0x366924;});}return null;};}function removeEntity(_0x213a6a){return function(_0x57476f){if(_0x57476f){return _0x57476f[_0x0baf('0x29')]()[_0x0baf('0x15')](function(){var _0x37be4e=_0x57476f[_0x0baf('0x2a')]({'plain':!![]});var _0x24ecee=_0x0baf('0x2b');return db[_0x0baf('0x2c')][_0x0baf('0x29')]({'where':{'type':_0x24ecee,'resourceId':_0x37be4e['id']}})[_0x0baf('0x15')](function(){return _0x57476f;});})[_0x0baf('0x15')](function(){_0x213a6a[_0x0baf('0x21')](0xcc)[_0x0baf('0x2d')]();});}};}function handleEntityNotFound(_0x45294a){return function(_0x3a3353){if(!_0x3a3353){_0x45294a['sendStatus'](0x194);}return _0x3a3353;};}function handleError(_0x2fd426,_0x53ae1d){_0x53ae1d=_0x53ae1d||0x1f4;return function(_0x1aa474){logger[_0x0baf('0x1b')](_0x1aa474[_0x0baf('0x2e')]);if(_0x1aa474[_0x0baf('0x2f')]){delete _0x1aa474['name'];}_0x2fd426[_0x0baf('0x21')](_0x53ae1d)[_0x0baf('0x30')](_0x1aa474);};}exports['index']=function(_0x23d890,_0x2447c2){var _0x62a2ed={'include':[{'model':db[_0x0baf('0x31')],'as':_0x0baf('0x32')}]},_0xbaa9a7={},_0x1f60bd={'count':0x0,'rows':[]};var _0x675461=_['map'](db[_0x0baf('0x33')][_0x0baf('0x34')],function(_0x5b991f){return{'name':_0x5b991f[_0x0baf('0x35')],'type':_0x5b991f['type']['key']};});_0xbaa9a7[_0x0baf('0x36')]=_[_0x0baf('0x37')](_0x675461,'name');_0xbaa9a7['query']=_[_0x0baf('0x38')](_0x23d890[_0x0baf('0x39')]);_0xbaa9a7[_0x0baf('0x3a')]=_[_0x0baf('0x3b')](_0xbaa9a7[_0x0baf('0x36')],_0xbaa9a7[_0x0baf('0x39')]);_0x62a2ed[_0x0baf('0x3c')]=_[_0x0baf('0x3b')](_0xbaa9a7[_0x0baf('0x36')],qs[_0x0baf('0x3d')](_0x23d890[_0x0baf('0x39')][_0x0baf('0x3d')]));_0x62a2ed[_0x0baf('0x3c')]=_0x62a2ed[_0x0baf('0x3c')]['length']?_0x62a2ed[_0x0baf('0x3c')]:_0xbaa9a7[_0x0baf('0x36')];if(!_0x23d890['query'][_0x0baf('0x3e')](_0x0baf('0x3f'))){_0x62a2ed[_0x0baf('0x25')]=qs[_0x0baf('0x25')](_0x23d890[_0x0baf('0x39')][_0x0baf('0x25')]);_0x62a2ed['offset']=qs[_0x0baf('0x23')](_0x23d890[_0x0baf('0x39')]['offset']);}_0x62a2ed[_0x0baf('0x40')]=qs[_0x0baf('0x41')](_0x23d890[_0x0baf('0x39')][_0x0baf('0x41')]);_0x62a2ed['where']=qs[_0x0baf('0x3a')](_[_0x0baf('0x42')](_0x23d890[_0x0baf('0x39')],_0xbaa9a7[_0x0baf('0x3a')]),_0x675461);if(_0x23d890[_0x0baf('0x39')][_0x0baf('0x43')]){_0x62a2ed[_0x0baf('0x44')]=_[_0x0baf('0x45')](_0x62a2ed[_0x0baf('0x44')],{'$or':_[_0x0baf('0x37')](_0x675461,function(_0x56270e){if(_0x56270e[_0x0baf('0x46')]!==_0x0baf('0x47')){var _0x1daf1d={};_0x1daf1d[_0x56270e[_0x0baf('0x2f')]]={'$like':'%'+_0x23d890[_0x0baf('0x39')]['filter']+'%'};return _0x1daf1d;}})});}_0x62a2ed=_[_0x0baf('0x45')]({},_0x62a2ed,_0x23d890[_0x0baf('0x48')]);var _0x27c3ee={'where':_0x62a2ed[_0x0baf('0x44')]};return db[_0x0baf('0x33')]['count'](_0x27c3ee)[_0x0baf('0x15')](function(_0x85bedb){_0x1f60bd[_0x0baf('0x26')]=_0x85bedb;if(_0x23d890[_0x0baf('0x39')][_0x0baf('0x49')]){_0x62a2ed[_0x0baf('0x4a')]=[{'all':!![]}];}return db[_0x0baf('0x33')]['findAll'](_0x62a2ed);})[_0x0baf('0x15')](function(_0x167fb8){_0x1f60bd[_0x0baf('0x4b')]=_0x167fb8;return _0x1f60bd;})['then'](respondWithFilteredResult(_0x2447c2,_0x62a2ed))[_0x0baf('0x1f')](handleError(_0x2447c2,null));};exports[_0x0baf('0x4c')]=function(_0x10fa62,_0x3fabec){var _0x204d77={'raw':![],'where':{'id':_0x10fa62[_0x0baf('0x4d')]['id']},'include':[{'model':db['Pause'],'as':_0x0baf('0x32')}]},_0x1b71a3={};_0x1b71a3[_0x0baf('0x36')]=_[_0x0baf('0x38')](db[_0x0baf('0x33')][_0x0baf('0x34')]);_0x1b71a3[_0x0baf('0x39')]=_[_0x0baf('0x38')](_0x10fa62[_0x0baf('0x39')]);_0x1b71a3[_0x0baf('0x3a')]=_[_0x0baf('0x3b')](_0x1b71a3[_0x0baf('0x36')],_0x1b71a3['query']);_0x204d77['attributes']=_[_0x0baf('0x3b')](_0x1b71a3[_0x0baf('0x36')],qs[_0x0baf('0x3d')](_0x10fa62[_0x0baf('0x39')][_0x0baf('0x3d')]));_0x204d77[_0x0baf('0x3c')]=_0x204d77[_0x0baf('0x3c')]['length']?_0x204d77[_0x0baf('0x3c')]:_0x1b71a3[_0x0baf('0x36')];if(_0x10fa62[_0x0baf('0x39')][_0x0baf('0x49')]){_0x204d77[_0x0baf('0x4a')]=[{'all':!![]}];}_0x204d77=_[_0x0baf('0x45')]({},_0x204d77,_0x10fa62['options']);return db[_0x0baf('0x33')]['find'](_0x204d77)[_0x0baf('0x15')](handleEntityNotFound(_0x3fabec,null))['then'](respondWithResult(_0x3fabec,null))[_0x0baf('0x1f')](handleError(_0x3fabec,null));};exports['create']=function(_0x35b1a5,_0x4c035b){return db[_0x0baf('0x33')][_0x0baf('0x4e')](_0x35b1a5[_0x0baf('0x4f')],{})[_0x0baf('0x15')](function(_0x42a68b){var _0x576475=_0x35b1a5[_0x0baf('0x50')][_0x0baf('0x2a')]({'plain':!![]});if(!_0x576475)throw new Error(_0x0baf('0x51'));if(_0x576475[_0x0baf('0x52')]===_0x0baf('0x50')){var _0xa19b21=_0x42a68b['get']({'plain':!![]});var _0x402f4d=_0x0baf('0x2b');return db[_0x0baf('0x53')][_0x0baf('0x54')]({'where':{'name':_0x402f4d,'userProfileId':_0x576475[_0x0baf('0x55')]},'raw':!![]})[_0x0baf('0x15')](function(_0x3834a2){if(_0x3834a2&&_0x3834a2['autoAssociation']===0x0){return db['UserProfileResource'][_0x0baf('0x4e')]({'name':_0xa19b21[_0x0baf('0x2f')],'resourceId':_0xa19b21['id'],'type':_0x3834a2[_0x0baf('0x2f')],'sectionId':_0x3834a2['id']},{})[_0x0baf('0x15')](function(){return _0x42a68b;});}else{return _0x42a68b;}})[_0x0baf('0x1f')](function(_0x35221e){logger[_0x0baf('0x1b')](_0x0baf('0x56'),_0x35221e);throw _0x35221e;});}return _0x42a68b;})[_0x0baf('0x15')](respondWithResult(_0x4c035b,0xc9))['catch'](handleError(_0x4c035b,null));};exports[_0x0baf('0x28')]=function(_0x268be8,_0x3c2d03){if(_0x268be8[_0x0baf('0x4f')]['id']){delete _0x268be8[_0x0baf('0x4f')]['id'];}return db[_0x0baf('0x33')][_0x0baf('0x54')]({'where':{'id':_0x268be8['params']['id']},'include':[{'model':db[_0x0baf('0x31')],'as':_0x0baf('0x32')}]})[_0x0baf('0x15')](handleEntityNotFound(_0x3c2d03,null))[_0x0baf('0x15')](saveUpdates(_0x268be8[_0x0baf('0x4f')],null))[_0x0baf('0x15')](respondWithResult(_0x3c2d03,null))[_0x0baf('0x1f')](handleError(_0x3c2d03,null));};exports[_0x0baf('0x29')]=function(_0x498405,_0x178495){return db['ChatWebsite'][_0x0baf('0x54')]({'where':{'id':_0x498405['params']['id']}})['then'](handleEntityNotFound(_0x178495,null))[_0x0baf('0x15')](removeEntity(_0x178495,null))['catch'](handleError(_0x178495,null));};exports[_0x0baf('0x57')]=function(_0x2b17f8,_0x49d713){return db[_0x0baf('0x33')][_0x0baf('0x57')]()[_0x0baf('0x15')](respondWithResult(_0x49d713,null))['catch'](handleError(_0x49d713,null));};exports['addDisposition']=function(_0x2438df,_0x7e8946){if(_0x2438df[_0x0baf('0x4f')]['id']){delete _0x2438df[_0x0baf('0x4f')]['id'];}return db[_0x0baf('0x33')]['find']({'where':{'id':_0x2438df[_0x0baf('0x4d')]['id']}})['then'](handleEntityNotFound(_0x7e8946,null))['then'](function(_0x59a0b2){if(_0x59a0b2){_0x2438df[_0x0baf('0x4f')]['ChatWebsiteId']=_0x59a0b2['id'];return db['Disposition'][_0x0baf('0x4e')](_0x2438df[_0x0baf('0x4f')]);}})[_0x0baf('0x15')](respondWithResult(_0x7e8946,null))[_0x0baf('0x1f')](handleError(_0x7e8946,null));};exports[_0x0baf('0x58')]=function(_0x27ddc7,_0x4c05d6){var _0xec3b32={'raw':![],'where':{}};var _0x1a0a67={};var _0x185473={'count':0x0,'rows':[]};return db[_0x0baf('0x33')][_0x0baf('0x59')]({'where':{'id':_0x27ddc7[_0x0baf('0x4d')]['id']}})['then'](handleEntityNotFound(_0x4c05d6,null))[_0x0baf('0x15')](function(_0x468363){if(_0x468363){_0x1a0a67[_0x0baf('0x36')]=_['keys'](db[_0x0baf('0x5a')][_0x0baf('0x34')]);_0x1a0a67[_0x0baf('0x39')]=_[_0x0baf('0x38')](_0x27ddc7[_0x0baf('0x39')]);_0x1a0a67[_0x0baf('0x3a')]=_[_0x0baf('0x3b')](_0x1a0a67['model'],_0x1a0a67['query']);_0xec3b32['attributes']=_[_0x0baf('0x3b')](_0x1a0a67[_0x0baf('0x36')],qs[_0x0baf('0x3d')](_0x27ddc7[_0x0baf('0x39')][_0x0baf('0x3d')]));_0xec3b32[_0x0baf('0x3c')]=_0xec3b32['attributes']['length']?_0xec3b32[_0x0baf('0x3c')]:_0x1a0a67['model'];if(!_0x27ddc7[_0x0baf('0x39')][_0x0baf('0x3e')]('nolimit')){_0xec3b32[_0x0baf('0x25')]=qs[_0x0baf('0x25')](_0x27ddc7[_0x0baf('0x39')][_0x0baf('0x25')]);_0xec3b32[_0x0baf('0x23')]=qs[_0x0baf('0x23')](_0x27ddc7[_0x0baf('0x39')][_0x0baf('0x23')]);}_0xec3b32[_0x0baf('0x40')]=qs['sort'](_0x27ddc7['query']['sort']);_0xec3b32['where']=qs['filters'](_[_0x0baf('0x42')](_0x27ddc7[_0x0baf('0x39')],_0x1a0a67[_0x0baf('0x3a')]));_0xec3b32[_0x0baf('0x44')]['ChatWebsiteId']=_0x468363['id'];if(_0x27ddc7[_0x0baf('0x39')][_0x0baf('0x43')]){_0xec3b32['where']=_['merge'](_0xec3b32[_0x0baf('0x44')],{'$or':_[_0x0baf('0x37')](_0xec3b32[_0x0baf('0x3c')],function(_0x442e5f){var _0x30b35e={};_0x30b35e[_0x442e5f]={'$like':'%'+_0x27ddc7[_0x0baf('0x39')][_0x0baf('0x43')]+'%'};return _0x30b35e;})});}_0xec3b32=_[_0x0baf('0x45')]({},_0xec3b32,_0x27ddc7['options']);return db[_0x0baf('0x5a')][_0x0baf('0x26')]({'where':_0xec3b32['where']})[_0x0baf('0x15')](function(_0x2db4ec){_0x185473['count']=_0x2db4ec;if(_0x27ddc7[_0x0baf('0x39')][_0x0baf('0x49')]){_0xec3b32[_0x0baf('0x4a')]=[{'all':!![]}];}return db[_0x0baf('0x5a')][_0x0baf('0x5b')](_0xec3b32);})['then'](function(_0x4807fc){_0x185473[_0x0baf('0x4b')]=_0x4807fc;return _0x185473;});}})[_0x0baf('0x15')](respondWithFilteredResult(_0x4c05d6,_0xec3b32))['catch'](handleError(_0x4c05d6,null));};exports[_0x0baf('0x5c')]=function(_0x59dad5,_0x21ad25){return db['ChatWebsite'][_0x0baf('0x54')]({'where':{'id':_0x59dad5[_0x0baf('0x4d')]['id']}})[_0x0baf('0x15')](handleEntityNotFound(_0x21ad25,null))['then'](function(_0x3c2bc1){if(_0x3c2bc1){return _0x3c2bc1['removeDispositions'](_0x59dad5[_0x0baf('0x39')][_0x0baf('0x5d')]);}})[_0x0baf('0x15')](respondWithStatusCode(_0x21ad25,null))[_0x0baf('0x1f')](handleError(_0x21ad25,null));};exports[_0x0baf('0x5e')]=function(_0x52e845,_0x866e6e){if(_0x52e845[_0x0baf('0x4f')]['id']){delete _0x52e845['body']['id'];}return db[_0x0baf('0x33')][_0x0baf('0x54')]({'where':{'id':_0x52e845[_0x0baf('0x4d')]['id']}})[_0x0baf('0x15')](handleEntityNotFound(_0x866e6e,null))[_0x0baf('0x15')](function(_0x250df2){if(_0x250df2){_0x52e845[_0x0baf('0x4f')][_0x0baf('0x5f')]=_0x250df2['id'];return db[_0x0baf('0x60')][_0x0baf('0x4e')](_0x52e845[_0x0baf('0x4f')]);}})[_0x0baf('0x15')](respondWithResult(_0x866e6e,null))['catch'](handleError(_0x866e6e,null));};exports['getAnswers']=function(_0x29a036,_0x322a09){var _0x384c29={'raw':![],'where':{}};var _0x52f267={};var _0x507783={'count':0x0,'rows':[]};return db[_0x0baf('0x33')][_0x0baf('0x59')]({'where':{'id':_0x29a036[_0x0baf('0x4d')]['id']}})[_0x0baf('0x15')](handleEntityNotFound(_0x322a09,null))[_0x0baf('0x15')](function(_0x3033c8){if(_0x3033c8){_0x52f267[_0x0baf('0x36')]=_[_0x0baf('0x38')](db[_0x0baf('0x60')]['rawAttributes']);_0x52f267[_0x0baf('0x39')]=_[_0x0baf('0x38')](_0x29a036[_0x0baf('0x39')]);_0x52f267[_0x0baf('0x3a')]=_['intersection'](_0x52f267['model'],_0x52f267['query']);_0x384c29[_0x0baf('0x3c')]=_[_0x0baf('0x3b')](_0x52f267['model'],qs['fields'](_0x29a036[_0x0baf('0x39')][_0x0baf('0x3d')]));_0x384c29['attributes']=_0x384c29[_0x0baf('0x3c')][_0x0baf('0x61')]?_0x384c29[_0x0baf('0x3c')]:_0x52f267[_0x0baf('0x36')];if(!_0x29a036[_0x0baf('0x39')][_0x0baf('0x3e')](_0x0baf('0x3f'))){_0x384c29[_0x0baf('0x25')]=qs[_0x0baf('0x25')](_0x29a036[_0x0baf('0x39')][_0x0baf('0x25')]);_0x384c29[_0x0baf('0x23')]=qs['offset'](_0x29a036[_0x0baf('0x39')][_0x0baf('0x23')]);}_0x384c29[_0x0baf('0x40')]=qs[_0x0baf('0x41')](_0x29a036[_0x0baf('0x39')][_0x0baf('0x41')]);_0x384c29['where']=qs[_0x0baf('0x3a')](_[_0x0baf('0x42')](_0x29a036[_0x0baf('0x39')],_0x52f267[_0x0baf('0x3a')]));_0x384c29[_0x0baf('0x44')]['ChatWebsiteId']=_0x3033c8['id'];if(_0x29a036[_0x0baf('0x39')][_0x0baf('0x43')]){_0x384c29[_0x0baf('0x44')]=_[_0x0baf('0x45')](_0x384c29[_0x0baf('0x44')],{'$or':_['map'](_0x384c29['attributes'],function(_0xb5f4e5){var _0x5a2454={};_0x5a2454[_0xb5f4e5]={'$like':'%'+_0x29a036[_0x0baf('0x39')]['filter']+'%'};return _0x5a2454;})});}_0x384c29=_[_0x0baf('0x45')]({},_0x384c29,_0x29a036[_0x0baf('0x48')]);return db[_0x0baf('0x60')][_0x0baf('0x26')]({'where':_0x384c29['where']})[_0x0baf('0x15')](function(_0x106ffa){_0x507783[_0x0baf('0x26')]=_0x106ffa;if(_0x29a036['query']['includeAll']){_0x384c29['include']=[{'all':!![]}];}return db['CannedAnswer'][_0x0baf('0x5b')](_0x384c29);})[_0x0baf('0x15')](function(_0x2b7f13){_0x507783[_0x0baf('0x4b')]=_0x2b7f13;return _0x507783;});}})['then'](respondWithFilteredResult(_0x322a09,_0x384c29))[_0x0baf('0x1f')](handleError(_0x322a09,null));};exports[_0x0baf('0x62')]=function(_0x1843eb,_0x4b4ef8){return db[_0x0baf('0x33')][_0x0baf('0x54')]({'where':{'id':_0x1843eb['params']['id']}})[_0x0baf('0x15')](handleEntityNotFound(_0x4b4ef8,null))['then'](function(_0x8a0a1b){if(_0x8a0a1b){return _0x8a0a1b[_0x0baf('0x62')](_0x1843eb[_0x0baf('0x39')][_0x0baf('0x5d')]);}})['then'](respondWithStatusCode(_0x4b4ef8,null))['catch'](handleError(_0x4b4ef8,null));};exports[_0x0baf('0x63')]=function(_0x4e1a7e,_0x3b4ae3){_0x4e1a7e[_0x0baf('0x4f')][_0x0baf('0x64')]=_0x4e1a7e[_0x0baf('0x65')][_0x0baf('0x66')];return db['ChatWebsite'][_0x0baf('0x54')]({'where':{'id':_0x4e1a7e['params']['id']}})[_0x0baf('0x15')](handleEntityNotFound(_0x3b4ae3,null))['then'](saveUpdates(_0x4e1a7e[_0x0baf('0x4f')],null))['then'](respondWithResult(_0x3b4ae3,null))[_0x0baf('0x1f')](handleError(_0x3b4ae3,null));};exports[_0x0baf('0x67')]=function(_0x443f62,_0x5033f3){_0x443f62['body'][_0x0baf('0x68')]=_0x443f62[_0x0baf('0x65')][_0x0baf('0x66')];return db[_0x0baf('0x33')][_0x0baf('0x54')]({'where':{'id':_0x443f62[_0x0baf('0x4d')]['id']}})['then'](handleEntityNotFound(_0x5033f3,null))[_0x0baf('0x15')](saveUpdates(_0x443f62['body'],null))[_0x0baf('0x15')](respondWithResult(_0x5033f3,null))['catch'](handleError(_0x5033f3,null));};exports[_0x0baf('0x69')]=function(_0x4df797,_0x30f32b){_0x4df797['body'][_0x0baf('0x6a')]=_0x4df797[_0x0baf('0x65')]['filename'];return db['ChatWebsite'][_0x0baf('0x54')]({'where':{'id':_0x4df797[_0x0baf('0x4d')]['id']}})[_0x0baf('0x15')](handleEntityNotFound(_0x30f32b,null))[_0x0baf('0x15')](saveUpdates(_0x4df797['body'],null))['then'](respondWithResult(_0x30f32b,null))[_0x0baf('0x1f')](handleError(_0x30f32b,null));};exports[_0x0baf('0x6b')]=function(_0x116d52,_0x2c7417){_0x116d52[_0x0baf('0x4f')][_0x0baf('0x6c')]=_0x116d52[_0x0baf('0x65')][_0x0baf('0x66')];return db[_0x0baf('0x33')][_0x0baf('0x54')]({'where':{'id':_0x116d52['params']['id']}})[_0x0baf('0x15')](handleEntityNotFound(_0x2c7417,null))['then'](saveUpdates(_0x116d52[_0x0baf('0x4f')],null))[_0x0baf('0x15')](respondWithResult(_0x2c7417,null))[_0x0baf('0x1f')](handleError(_0x2c7417,null));};exports[_0x0baf('0x6d')]=function(_0x4d7d29,_0x227fbd){var _0x647233=path[_0x0baf('0x6e')](config[_0x0baf('0x6f')],_0x0baf('0x70'));var _0x2c2b77={'where':{'id':_0x4d7d29[_0x0baf('0x4d')]['id']},'attributes':['id',_0x0baf('0x64')],'raw':!![]};var _0xb61593=![];return require('../../config/license/util')[_0x0baf('0x71')]()[_0x0baf('0x15')](function(_0x4d501e){if(_0x4d501e){_0xb61593=_0x4d501e[_0x0baf('0x72')];}})[_0x0baf('0x15')](function(){return db[_0x0baf('0x33')][_0x0baf('0x54')](_0x2c2b77);})[_0x0baf('0x15')](handleEntityNotFound(_0x227fbd,null))[_0x0baf('0x15')](function(_0x3c5654){if(_0x3c5654){if(!_[_0x0baf('0x73')](_0x3c5654[_0x0baf('0x64')])){if(fs['existsSync'](path[_0x0baf('0x6e')](config[_0x0baf('0x6f')],_0x0baf('0x74'),_0x3c5654[_0x0baf('0x64')]))&&_0xb61593){_0x647233=path[_0x0baf('0x6e')](config[_0x0baf('0x6f')],'server/files/images/logos/',_0x3c5654[_0x0baf('0x64')]);}}return _0x227fbd[_0x0baf('0x75')](_0x647233);}})[_0x0baf('0x1f')](handleError(_0x227fbd,null));};exports['getAvatar']=function(_0x49855a,_0x5adbd9){var _0x1adb84=path[_0x0baf('0x6e')](config['root'],_0x0baf('0x76'));var _0x577536={'where':{'id':_0x49855a[_0x0baf('0x4d')]['id']},'attributes':['id','agentAvatar'],'raw':!![]};return db[_0x0baf('0x33')][_0x0baf('0x54')](_0x577536)['then'](handleEntityNotFound(_0x5adbd9,null))[_0x0baf('0x15')](function(_0x290686){if(_0x290686){if(!_[_0x0baf('0x73')](_0x290686[_0x0baf('0x68')])){if(fs[_0x0baf('0x77')](path[_0x0baf('0x6e')](config[_0x0baf('0x6f')],'server/files/images/avatars/',_0x290686[_0x0baf('0x68')]))){_0x1adb84=path[_0x0baf('0x6e')](config[_0x0baf('0x6f')],_0x0baf('0x78'),_0x290686[_0x0baf('0x68')]);}}return _0x5adbd9[_0x0baf('0x75')](_0x1adb84);}})[_0x0baf('0x1f')](handleError(_0x5adbd9,null));};exports[_0x0baf('0x79')]=function(_0x4415c2,_0x46103a){var _0x308b3f=path[_0x0baf('0x6e')](config[_0x0baf('0x6f')],_0x0baf('0x7a'));var _0x59dd6c={'where':{'id':_0x4415c2['params']['id']},'attributes':['id',_0x0baf('0x6a'),_0x0baf('0x7b')],'raw':!![]};return db[_0x0baf('0x33')][_0x0baf('0x54')](_0x59dd6c)['then'](handleEntityNotFound(_0x46103a,null))[_0x0baf('0x15')](function(_0xc6c049){if(_0xc6c049){if(!_[_0x0baf('0x73')](_0xc6c049[_0x0baf('0x6a')])){if(fs[_0x0baf('0x77')](path[_0x0baf('0x6e')](config['root'],_0x0baf('0x78'),_0xc6c049[_0x0baf('0x6a')]))&&_0xc6c049[_0x0baf('0x7b')]){_0x308b3f=path['join'](config[_0x0baf('0x6f')],_0x0baf('0x78'),_0xc6c049[_0x0baf('0x6a')]);}}return _0x46103a['download'](_0x308b3f);}})['catch'](handleError(_0x46103a,null));};exports['getSystemAvatar']=function(_0x11a85a,_0x51c895){var _0x2f0104=path[_0x0baf('0x6e')](config['root'],_0x0baf('0x7c'));var _0x5b5cd5={'where':{'id':_0x11a85a['params']['id']},'attributes':['id',_0x0baf('0x6c')],'raw':!![]};return db['ChatWebsite'][_0x0baf('0x54')](_0x5b5cd5)['then'](handleEntityNotFound(_0x51c895,null))['then'](function(_0x56c377){if(_0x56c377){if(!_[_0x0baf('0x73')](_0x56c377[_0x0baf('0x6c')])){if(fs[_0x0baf('0x77')](path[_0x0baf('0x6e')](config[_0x0baf('0x6f')],_0x0baf('0x78'),_0x56c377[_0x0baf('0x6c')]))){_0x2f0104=path['join'](config[_0x0baf('0x6f')],_0x0baf('0x78'),_0x56c377[_0x0baf('0x6c')]);}}return _0x51c895['download'](_0x2f0104);}})[_0x0baf('0x1f')](handleError(_0x51c895,null));};exports[_0x0baf('0x7d')]=function(_0x12311d,_0x52c7f7){var _0x25eccd=require('user-agent-parser');var _0x235bd5=new _0x25eccd();var _0x12ff07=_0x235bd5['setUA'](_0x12311d[_0x0baf('0x7e')][_0x0baf('0x7f')])[_0x0baf('0x80')]();var _0x1805ff={'body':_0x12311d['body'],'channel':_0x0baf('0x81')};var _0x39eb13=[];var _0x4d4eab=[];var _0x5054f9={};var _0x1ac8eb=![];return db[_0x0baf('0x82')][_0x0baf('0x57')]()[_0x0baf('0x15')](function(_0x4d4a7f){if(!_0x4d4a7f){throw new db['Sequelize'][(_0x0baf('0x83'))](_0x0baf('0x84'));}_0x39eb13=_[_0x0baf('0x85')](_[_0x0baf('0x38')](_0x4d4a7f),[_0x0baf('0x86'),'updatedAt']);_0x4d4eab=_[_0x0baf('0x85')](_[_0x0baf('0x38')](_0x4d4a7f),['createdAt',_0x0baf('0x87'),_0x0baf('0x88'),'ListId']);if(_0x12311d[_0x0baf('0x4f')]['id']){delete _0x12311d[_0x0baf('0x4f')]['id'];}if(_[_0x0baf('0x73')](_0x12311d[_0x0baf('0x4f')][_0x0baf('0x89')])){throw new db[(_0x0baf('0x8a'))][(_0x0baf('0x83'))](_0x0baf('0x8b'));}if(_['isNil'](_0x12311d[_0x0baf('0x4f')][_0x0baf('0x4f')])||_0x12311d[_0x0baf('0x4f')][_0x0baf('0x4f')]===''){throw new db['Sequelize'][(_0x0baf('0x83'))](_0x0baf('0x8c'));}if(_['isNil'](_0x12311d[_0x0baf('0x4f')][_0x0baf('0x8d')])){throw new db[(_0x0baf('0x8a'))][(_0x0baf('0x83'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x4d4eab);}if(!_[_0x0baf('0x8e')](_0x4d4eab,_0x12311d[_0x0baf('0x4f')][_0x0baf('0x8d')])){throw new db[(_0x0baf('0x8a'))][(_0x0baf('0x83'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x4d4eab);}_0x5054f9[_0x12311d[_0x0baf('0x4f')][_0x0baf('0x8d')]]=_0x12311d[_0x0baf('0x4f')]['from'];})[_0x0baf('0x15')](function(){return db[_0x0baf('0x33')][_0x0baf('0x54')]({'where':{'id':_0x12311d[_0x0baf('0x4d')]['id']},'include':[{'model':db[_0x0baf('0x8f')],'as':'List','include':[{'model':db['CmContact'],'as':_0x0baf('0x90'),'where':_0x5054f9,'limit':0x1,'order':[[_0x0baf('0x87'),_0x0baf('0x91')]]}]},{'model':db['ChatApplication'],'as':_0x0baf('0x92')}]});})[_0x0baf('0x15')](handleEntityNotFound(_0x52c7f7,null))[_0x0baf('0x15')](function(_0x3cfb49){if(_0x3cfb49&&_0x3cfb49[_0x0baf('0x93')]){_0x1805ff[_0x0baf('0x94')]=_0x3cfb49;_0x1805ff[_0x0baf('0x95')]=_0x3cfb49[_0x0baf('0x92')];_0x1805ff[_0x0baf('0x96')]=_0x3cfb49[_0x0baf('0x93')];_0x1805ff['applications']=_[_0x0baf('0x97')](_0x1805ff[_0x0baf('0x95')],[_0x0baf('0x98')],[_0x0baf('0x99')]);if(_0x1805ff['account'][_0x0baf('0x92')]){delete _0x1805ff[_0x0baf('0x94')][_0x0baf('0x92')];}if(_0x1805ff['account'][_0x0baf('0x93')]&&_0x1805ff[_0x0baf('0x94')][_0x0baf('0x93')][_0x0baf('0x90')][_0x0baf('0x61')]){return _0x1805ff['account'][_0x0baf('0x93')][_0x0baf('0x90')][0x0];}var _0x53df55=_['defaults'](_0x12311d[_0x0baf('0x4f')],{'firstName':_0x12311d[_0x0baf('0x4f')][_0x0baf('0x89')],'ListId':_0x3cfb49[_0x0baf('0x9a')]});_0x53df55[_0x12311d[_0x0baf('0x4f')][_0x0baf('0x8d')]]=_0x12311d[_0x0baf('0x4f')]['from'];return db['CmContact'][_0x0baf('0x4e')](_0x53df55,{'fields':_0x39eb13,'raw':!![]});}})[_0x0baf('0x15')](handleEntityNotFound(_0x52c7f7,null))[_0x0baf('0x15')](function(_0x47de3f){_0x1805ff[_0x0baf('0x9b')]=_0x47de3f;var _0x3a6bf8=_0x12311d['body'][_0x0baf('0x9c')];if(_0x12311d[_0x0baf('0x7e')]['cf-connecting-ip']){_0x3a6bf8=_0x12311d[_0x0baf('0x7e')][_0x0baf('0x9d')];}else if(_0x12311d[_0x0baf('0x7e')]['x-forwarded-for']){_0x3a6bf8=_[_0x0baf('0x9e')](_0x12311d[_0x0baf('0x7e')][_0x0baf('0x9f')][_0x0baf('0xa0')](','));}if(_0x47de3f){var _0x3021f7={'ContactId':_0x47de3f['id'],'ChatWebsiteId':_0x12311d[_0x0baf('0x4d')]['id'],'from':(_0x47de3f[_0x0baf('0xa1')]||'')+'\x20'+(_0x47de3f['lastName']||''),'customerIp':_0x3a6bf8,'customerPort':_0x12311d[_0x0baf('0x7e')]['x-real-port']?_0x12311d[_0x0baf('0x7e')][_0x0baf('0xa2')]:null,'referer':_0x12311d['body']['referer'],'browserName':_0x12ff07[_0x0baf('0xa3')][_0x0baf('0x2f')]&&_0x12ff07[_0x0baf('0xa3')]['version']?util[_0x0baf('0xa4')](_0x0baf('0xa5'),_0x12ff07[_0x0baf('0xa3')][_0x0baf('0x2f')],_0x12ff07[_0x0baf('0xa3')][_0x0baf('0xa6')]):_0x0baf('0xa7'),'browserVersion':_0x12ff07[_0x0baf('0xa3')]['version']||'unknown','osName':util[_0x0baf('0xa4')](_0x0baf('0xa5'),_0x12ff07['os']['name'],_0x12ff07['os'][_0x0baf('0xa6')]),'osVersion':_0x12ff07['os'][_0x0baf('0xa6')],'deviceModel':_0x12ff07[_0x0baf('0xa8')][_0x0baf('0x36')]&&_0x12ff07[_0x0baf('0xa8')][_0x0baf('0xa9')]?util[_0x0baf('0xa4')]('%s\x20%s\x20%s',_0x12ff07[_0x0baf('0xa8')]['model'],_0x12ff07[_0x0baf('0xa8')][_0x0baf('0xa9')],_0x12ff07['device']['type']):null,'deviceVendor':_0x12ff07[_0x0baf('0xa8')][_0x0baf('0xa9')],'deviceType':_0x12ff07[_0x0baf('0xa8')][_0x0baf('0x46')],'formData':JSON[_0x0baf('0x1a')](_0x12311d[_0x0baf('0x4f')])};var _0x18f7bd={'ChatWebsiteId':_0x12311d['params']['id'],'closed':![]};if(_0x12311d['body']['threadId']){_0x18f7bd[_0x0baf('0xaa')]=_0x12311d['body'][_0x0baf('0xaa')];return db[_0x0baf('0xab')]['find']({'where':_0x18f7bd})['then'](function(_0x40785c){if(_0x40785c){return[_0x40785c,![]];}_0x3021f7[_0x0baf('0xaa')]=_0x12311d[_0x0baf('0x4f')][_0x0baf('0xaa')];_0x3021f7[_0x0baf('0xac')]=_0x12311d['body'][_0x0baf('0xac')];return db[_0x0baf('0xab')][_0x0baf('0x4e')](_0x3021f7)[_0x0baf('0x15')](function(_0xf784df){return[_0xf784df,!![]];});});}_0x18f7bd[_0x0baf('0xad')]=_0x47de3f['id'];if(_0x12311d['body'][_0x0baf('0xae')]&&_0x12311d[_0x0baf('0x4f')][_0x0baf('0xae')]['id']){_0x18f7bd['id']=_0x12311d['body'][_0x0baf('0xae')]['id'];return db[_0x0baf('0xab')]['find']({'where':_0x18f7bd})[_0x0baf('0x15')](function(_0xe93008){if(_0xe93008){return[_0xe93008,![]];}return db[_0x0baf('0xab')][_0x0baf('0x4e')](_0x3021f7)['then'](function(_0x4ffc8e){return[_0x4ffc8e,!![]];});});}return db[_0x0baf('0xab')][_0x0baf('0x4e')](_0x3021f7)['then'](function(_0x43022c){return[_0x43022c,!![]];});}})[_0x0baf('0xaf')](function(_0xcd88a1,_0x13ac02){if(_0xcd88a1){_0x1ac8eb=_0x13ac02;if(!_0x13ac02){var _0x122a1a={'from':(_0x1805ff['contact'][_0x0baf('0xa1')]||'')+'\x20'+(_0x1805ff[_0x0baf('0x9b')][_0x0baf('0xb0')]||'')};if(_0x12311d[_0x0baf('0x4f')]['threadId']&&_0x12311d[_0x0baf('0x4f')]['messageId']&&_0x12311d[_0x0baf('0x4f')][_0x0baf('0xaa')]!=_0x12311d[_0x0baf('0x4f')]['messageId']){_0x122a1a[_0x0baf('0xaa')]=_0x12311d[_0x0baf('0x4f')][_0x0baf('0xb1')];}return _0xcd88a1[_0x0baf('0x28')](_0x122a1a);}else{return _0xcd88a1;}}})[_0x0baf('0x15')](function(_0x2a72b3){_0x1805ff[_0x0baf('0xae')]=_0x2a72b3[_0x0baf('0x2a')]({'plain':!![]});_0x1805ff[_0x0baf('0xae')][_0x0baf('0xb2')]=_0x1ac8eb;if(_0x1805ff[_0x0baf('0xae')][_0x0baf('0xb2')]){if(_0x1805ff['account']['autoclose']){_0x1805ff[_0x0baf('0x95')]['push']({'id':0x0,'priority':_0x1805ff['applications']['length']+0x1,'app':'close','appdata':_0x0baf('0xb3'),'interval':_0x0baf('0xb4')});}}return db['ChatMessage']['create']({'body':_0x12311d['body']['body'],'ChatWebsiteId':_0x12311d[_0x0baf('0x4d')]['id'],'ChatInteractionId':_0x2a72b3['id'],'direction':'in','ContactId':_0x1805ff['contact']['id'],'AttachmentId':_0x12311d[_0x0baf('0x4f')][_0x0baf('0xb5')]});})[_0x0baf('0x15')](function(_0xa1b680){_0x1805ff[_0x0baf('0x1d')]=_0xa1b680;if(_0x1805ff[_0x0baf('0xae')][_0x0baf('0xb6')]){return db[_0x0baf('0xb7')]['find']({'attributes':['id','name'],'where':{'id':_0x1805ff[_0x0baf('0xae')][_0x0baf('0xb6')]}})['then'](function(_0x21a72d){if(_0x21a72d){_0x1805ff['applications'][_0x0baf('0xb8')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x21a72d['name']+','+(_0x1805ff[_0x0baf('0x94')][_0x0baf('0xb9')]||0xa),'interval':_0x0baf('0xb4')});_0x1805ff[_0x0baf('0xba')]=!![];}return respondWithRpcPromise(_0x0baf('0xbb'),_0x0baf('0xbc'),_0x1805ff);});}return respondWithRpcPromise(_0x0baf('0xbb'),_0x0baf('0xbc'),_0x1805ff);})[_0x0baf('0x15')](function(_0x3348c6){respondWithRpcPromise(_0x0baf('0xbd'),_0x0baf('0xbd'),{'event':_0x0baf('0x7d'),'message':_0x3348c6},client9002);return _0x3348c6;})[_0x0baf('0x15')](respondWithResult(_0x52c7f7,null))[_0x0baf('0x1f')](handleError(_0x52c7f7,null));};exports[_0x0baf('0xbe')]=function(_0x5b61ff,_0x3c78ca){var _0x1a016f,_0x5b9e60,_0x9f2b22;var _0x39526b=[];var _0x5ee76f={};var _0x186d83=_0x5b61ff['files']||[];var _0x3f816f=[];var _0x569bbb;return db[_0x0baf('0x82')]['describe']()[_0x0baf('0x15')](function(_0x298cb5){if(!_0x298cb5){throw new db[(_0x0baf('0x8a'))][(_0x0baf('0x83'))]('no\x20available\x20attributes');}_0x39526b=_[_0x0baf('0x85')](_[_0x0baf('0x38')](_0x298cb5),[_0x0baf('0x86'),_0x0baf('0x87'),'CompanyId','ListId']);if(_0x5b61ff[_0x0baf('0x4f')]['id']){delete _0x5b61ff[_0x0baf('0x4f')]['id'];}if(_[_0x0baf('0x73')](_0x5b61ff[_0x0baf('0x4f')]['from'])){throw _0x3c78ca[_0x0baf('0x21')](0x1f4)[_0x0baf('0x30')](new db[(_0x0baf('0x8a'))]['ValidationError']('from\x20is\x20mandatory'));}if(_[_0x0baf('0x73')](_0x5b61ff['body'][_0x0baf('0x4f')])||_0x5b61ff['body'][_0x0baf('0x4f')]===''){throw _0x3c78ca[_0x0baf('0x21')](0x1f4)[_0x0baf('0x30')](new db['Sequelize'][(_0x0baf('0x83'))](_0x0baf('0x8c')));}if(_['isNil'](_0x5b61ff['body'][_0x0baf('0xbf')])){throw _0x3c78ca['status'](0x1f4)[_0x0baf('0x30')](new db[(_0x0baf('0x8a'))]['ValidationError']('mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x39526b));}if(!_[_0x0baf('0x8e')](_0x39526b,_0x5b61ff[_0x0baf('0x4f')]['mapKeyOffline'])){throw _0x3c78ca[_0x0baf('0x21')](0x1f4)['send'](new db[(_0x0baf('0x8a'))][(_0x0baf('0x83'))]('mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x39526b));}_0x5ee76f[_0x5b61ff[_0x0baf('0x4f')][_0x0baf('0xbf')]]=_0x5b61ff[_0x0baf('0x4f')][_0x0baf('0x89')];})[_0x0baf('0x15')](function(){return db['ChatWebsite'][_0x0baf('0x54')]({'where':{'id':_0x5b61ff['params']['id']},'include':[{'model':db['CmList'],'as':'List'},{'model':db[_0x0baf('0xc0')],'as':_0x0baf('0xc0')}]});})['then'](handleEntityNotFound(_0x3c78ca,null))[_0x0baf('0x15')](function(_0x58e1ae){if(_0x58e1ae&&_0x58e1ae['List']){_0x5b9e60=_0x58e1ae;var _0x30a982=_[_0x0baf('0xd')](_0x5b61ff[_0x0baf('0x4f')],{'firstName':_0x5b61ff[_0x0baf('0x4f')][_0x0baf('0x89')],'phone':_0x5b61ff[_0x0baf('0x4f')][_0x0baf('0x89')],'ListId':_0x58e1ae[_0x0baf('0x9a')]});_0x30a982[_0x5b61ff[_0x0baf('0x4f')][_0x0baf('0xbf')]]=_0x5b61ff['body'][_0x0baf('0x89')];return db[_0x0baf('0x82')][_0x0baf('0xc1')]({'where':_0x5ee76f,'defaults':_0x30a982});}})[_0x0baf('0xaf')](function(_0x1d1ed6){if(_0x1d1ed6){_0x9f2b22=_0x1d1ed6;var _0x57b26e=fs[_0x0baf('0xc2')](path['join'](config[_0x0baf('0x6f')],_0x0baf('0xc3')),_0x0baf('0xc4'));var _0x44f822=ejs[_0x0baf('0xc5')](_0x57b26e,{'body':_[_0x0baf('0xc6')](_0x5b61ff[_0x0baf('0x4f')]['body']),'bodyTitle':_0x5b9e60[_0x0baf('0xc7')]});return db[_0x0baf('0xc8')][_0x0baf('0x4e')]({'body':_0x44f822,'plainBody':htmlToText[_0x0baf('0xc9')](_0x44f822),'ContactId':_0x1d1ed6['id'],'ChatWebsiteId':_0x5b9e60['id']});}})[_0x0baf('0x15')](function(_0x130ad1){_0x569bbb=_0x130ad1;if(_0x186d83[_0x0baf('0x61')]){var _0x17ef4f=_0x186d83[_0x0baf('0x37')](function(_0x1ee4c7){return{'name':_0x1ee4c7[_0x0baf('0xca')],'basename':_0x1ee4c7[_0x0baf('0x66')],'type':_0x1ee4c7[_0x0baf('0xcb')],'ChatOfflineMessageId':_0x130ad1['id']};});_0x3f816f=_0x17ef4f[_0x0baf('0x37')](_0x37430c=>{var _0x3fffe8={'filename':_0x37430c[_0x0baf('0x2f')],'path':path[_0x0baf('0x6e')](config['root'],_0x0baf('0xcc'),_0x0baf('0xcd'),_0x0baf('0xce'),_0x0baf('0xcf'),_0x37430c[_0x0baf('0xd0')])};return _0x3fffe8;});if(!_0x5b9e60[_0x0baf('0xd1')]){return db[_0x0baf('0xd2')]['transaction'](function(_0xa7a73a){return db[_0x0baf('0xd3')][_0x0baf('0xd4')](_0x17ef4f,{'transaction':_0xa7a73a});});}}})[_0x0baf('0x15')](function(){if(_0x569bbb){_0x1a016f=_0x569bbb;return db[_0x0baf('0xc0')][_0x0baf('0x59')]({'where':{'active':!![]},'include':[{'model':db[_0x0baf('0xd5')],'as':'Smtp','raw':!![]}]});}})[_0x0baf('0x15')](function(_0x17b3a9){if(_0x17b3a9&&_0x17b3a9[_0x0baf('0xd6')]&&_0x5b9e60[_0x0baf('0xd7')]&&_0x5b9e60[_0x0baf('0xd8')]){var _0x1912ff={'tls':{'rejectUnauthorized':![]}};if(_0x17b3a9['Smtp'][_0x0baf('0xd9')]){_0x1912ff[_0x0baf('0xd9')]=_0x17b3a9[_0x0baf('0xd6')][_0x0baf('0xd9')];}else{_0x1912ff[_0x0baf('0xda')]=_0x17b3a9['Smtp']['host'];_0x1912ff[_0x0baf('0xdb')]=_0x17b3a9[_0x0baf('0xd6')][_0x0baf('0xdb')];_0x1912ff[_0x0baf('0xdc')]=_0x17b3a9[_0x0baf('0xd6')][_0x0baf('0xdc')];}if(_0x17b3a9[_0x0baf('0xd6')][_0x0baf('0xdd')]){_0x1912ff[_0x0baf('0xde')]={'user':_0x17b3a9[_0x0baf('0xd6')][_0x0baf('0x50')],'pass':_0x17b3a9[_0x0baf('0xd6')][_0x0baf('0xdf')]};}return respondWithRpcPromise(_0x0baf('0xe0'),_0x0baf('0xe1'),{'account':_0x1912ff,'message':{'from':util[_0x0baf('0xa4')](_0x0baf('0xe2'),_0x17b3a9[_0x0baf('0x2f')],_0x17b3a9[_0x0baf('0xe3')]||_0x17b3a9[_0x0baf('0xd6')][_0x0baf('0x50')]),'to':_0x5b9e60[_0x0baf('0xd8')],'subject':_0x5b9e60[_0x0baf('0xe4')],'html':_0x1a016f[_0x0baf('0x4f')],'attachments':_0x3f816f}},client9003)[_0x0baf('0x15')](function(){return _0x1a016f;})[_0x0baf('0x1f')](function(_0x1d4581){console['error'](_0x1d4581);});}})[_0x0baf('0x15')](function(){if(_0x5b9e60&&_0x5b9e60[_0x0baf('0xd1')]&&_0x5b9e60[_0x0baf('0xe5')]){var _0x14a397=[];if(_0x186d83[_0x0baf('0x61')]){_0x14a397=_0x186d83['map'](function(_0x3e3fba){return{'name':_0x3e3fba[_0x0baf('0xca')],'basename':_0x3e3fba[_0x0baf('0x66')],'type':_0x3e3fba[_0x0baf('0xcb')],'ChatOfflineMessageId':_0x569bbb['id']};});}var _0x1db841;if(!_[_0x0baf('0x73')](_0x5b9e60[_0x0baf('0xe6')])){var _0x237a20=_[_0x0baf('0x37')](_0x5b61ff[_0x0baf('0x4f')],function(_0xe840f2){return _0xe840f2;});var _0x12726d=_[_0x0baf('0xe7')](_0x237a20)[0x0];var _0x1b2278=_[_0x0baf('0xe8')](_0x12726d,function(_0x221aac){return _0x221aac;});_0x1db841=_0x1b2278[0x1][_0x5b9e60[_0x0baf('0xe6')]];}var _0x3e970a={'from':_0x9f2b22['email'],'firstName':_0x9f2b22[_0x0baf('0xa1')],'lastName':_0x9f2b22['lastName'],'mapKey':'email','message':{'from':_0x9f2b22[_0x0baf('0xe3')],'to':_0x5b9e60[_0x0baf('0xc0')][_0x0baf('0xe3')],'cc':'','subject':_['isNil'](_0x1db841)?_0x5b9e60[_0x0baf('0xe4')]:_0x1db841,'messageId':'','sentAt':new Date(),'attach':_0x14a397[_0x0baf('0x61')],'attachments':_0x14a397,'originChannel':_0x0baf('0xe9'),'ChatWebsiteId':_0x5b9e60['id'],'ChatOfflineMessageId':_0x1a016f['id'],'originTo':_0x5b9e60[_0x0baf('0xc0')][_0x0baf('0xe3')]},'body':_0x1a016f[_0x0baf('0x4f')]};var _0x49543e={'account':{'id':_0x5b9e60[_0x0baf('0xe5')]},'body':_0x3e970a,'log':_0x0baf('0xea')};return respondWithRpcPromise(_0x0baf('0xea'),_0x0baf('0xeb'),_0x49543e,client9001)[_0x0baf('0x15')](function(){return _0x1a016f;})[_0x0baf('0x1f')](function(_0x4c2bae){console[_0x0baf('0x1b')](_0x4c2bae);});}return;})['then'](function(){if(_0x1a016f){return _0x1a016f;}})[_0x0baf('0x15')](respondWithResult(_0x3c78ca,null))[_0x0baf('0x1f')](function(_0x47b168){console['error'](_0x0baf('0x1f'),_0x47b168);for(var _0x1de1dd of _0x186d83){var _0xf4da6a=path['join'](config[_0x0baf('0x6f')],_0x0baf('0xcc'),'files',_0x0baf('0xce'),_0x0baf('0xcf'),_0x1de1dd[_0x0baf('0x66')]);fs_extra[_0x0baf('0xec')](_0xf4da6a)[_0x0baf('0x1f')](function(_0x2759bb){console[_0x0baf('0x1b')]('Could\x20not\x20remove\x20attachment\x20file',_0xf4da6a,_0x2759bb);});}});};exports['addInteraction']=function(_0x131573,_0x1bd67f){return db[_0x0baf('0xab')][_0x0baf('0x54')]({'where':{'id':_0x131573[_0x0baf('0x4d')]['id']}})[_0x0baf('0x15')](handleEntityNotFound(_0x1bd67f,null))[_0x0baf('0x15')](function(_0x4316c5){if(_0x4316c5){return _0x4316c5[_0x0baf('0xed')](_0x131573[_0x0baf('0x4f')]['ids'],_['omit'](_0x131573[_0x0baf('0x4f')],[_0x0baf('0x5d'),'id'])||{});}})[_0x0baf('0x15')](respondWithResult(_0x1bd67f,null))['catch'](handleError(_0x1bd67f,null));};exports['getInteractions']=function(_0x3d740a,_0x2cb735){var _0xf82eb5={'raw':![],'where':{}};var _0x197bbe={};var _0x4a6a50={'count':0x0,'rows':[]};return db[_0x0baf('0x33')][_0x0baf('0x59')]({'where':{'id':_0x3d740a[_0x0baf('0x4d')]['id']}})[_0x0baf('0x15')](handleEntityNotFound(_0x2cb735,null))[_0x0baf('0x15')](function(_0x120c18){if(_0x120c18){_0x197bbe[_0x0baf('0x36')]=_[_0x0baf('0x38')](db['ChatInteraction'][_0x0baf('0x34')]);_0x197bbe[_0x0baf('0x39')]=_[_0x0baf('0x38')](_0x3d740a[_0x0baf('0x39')]);_0x197bbe[_0x0baf('0x3a')]=_[_0x0baf('0x3b')](_0x197bbe['model'],_0x197bbe[_0x0baf('0x39')]);_0xf82eb5[_0x0baf('0x3c')]=_['intersection'](_0x197bbe['model'],qs[_0x0baf('0x3d')](_0x3d740a['query'][_0x0baf('0x3d')]));_0xf82eb5[_0x0baf('0x3c')]=_0xf82eb5[_0x0baf('0x3c')][_0x0baf('0x61')]?_0xf82eb5['attributes']:_0x197bbe[_0x0baf('0x36')];if(!_0x3d740a[_0x0baf('0x39')][_0x0baf('0x3e')]('nolimit')){_0xf82eb5[_0x0baf('0x25')]=qs[_0x0baf('0x25')](_0x3d740a['query'][_0x0baf('0x25')]);_0xf82eb5['offset']=qs[_0x0baf('0x23')](_0x3d740a[_0x0baf('0x39')][_0x0baf('0x23')]);}_0xf82eb5[_0x0baf('0x40')]=qs['sort'](_0x3d740a[_0x0baf('0x39')][_0x0baf('0x41')]);_0xf82eb5['where']=qs[_0x0baf('0x3a')](_[_0x0baf('0x42')](_0x3d740a['query'],_0x197bbe[_0x0baf('0x3a')]));_0xf82eb5[_0x0baf('0x44')]['ChatWebsiteId']=_0x120c18['id'];if(_0x3d740a[_0x0baf('0x39')][_0x0baf('0x43')]){_0xf82eb5[_0x0baf('0x44')]=_[_0x0baf('0x45')](_0xf82eb5[_0x0baf('0x44')],{'$or':_[_0x0baf('0x37')](_0xf82eb5['attributes'],function(_0x181385){var _0x120f68={};_0x120f68[_0x181385]={'$like':'%'+_0x3d740a[_0x0baf('0x39')][_0x0baf('0x43')]+'%'};return _0x120f68;})});}_0xf82eb5=_[_0x0baf('0x45')]({},_0xf82eb5,_0x3d740a[_0x0baf('0x48')]);return db[_0x0baf('0xab')][_0x0baf('0x26')]({'where':_0xf82eb5[_0x0baf('0x44')]})[_0x0baf('0x15')](function(_0x72e44c){_0x4a6a50[_0x0baf('0x26')]=_0x72e44c;if(_0x3d740a[_0x0baf('0x39')][_0x0baf('0x49')]){_0xf82eb5[_0x0baf('0x4a')]=[{'model':db[_0x0baf('0x82')],'as':_0x0baf('0xee'),'required':![]},{'model':db[_0x0baf('0xb7')],'as':_0x0baf('0xef'),'attributes':[_0x0baf('0x2f'),_0x0baf('0xf0'),_0x0baf('0xf1')],'required':![]},{'model':db['Tag'],'as':_0x0baf('0xf2'),'attributes':['id',_0x0baf('0x2f'),'color'],'where':_0x3d740a['query']['tag']?{'id':_0x3d740a[_0x0baf('0x39')]['tag']}:undefined,'required':_0x3d740a['query']['tag']?!![]:![]}];}return db[_0x0baf('0xab')][_0x0baf('0x5b')](_0xf82eb5);})[_0x0baf('0x15')](function(_0x5ab269){_0x4a6a50[_0x0baf('0x4b')]=_0x5ab269;return _0x4a6a50;});}})['then'](respondWithFilteredResult(_0x2cb735,_0xf82eb5))['catch'](handleError(_0x2cb735,null));};function iftimePromise(_0x743f4b,_0xc93c2b){return respondWithRpcPromise(_0x0baf('0xf3'),'getSnippet',{'command':_0xc93c2b['timezone']?util[_0x0baf('0xa4')](_0x0baf('0xf4'),_0x743f4b[_0x0baf('0xf5')],_0xc93c2b[_0x0baf('0xf6')]):util[_0x0baf('0xa4')](_0x0baf('0xf7'),_0x743f4b['interval'])},client9002)['then'](function(_0x217cd8){var _0x21e3b1=_0x217cd8&&_0x217cd8['indexOf'](_0x0baf('0xf8'))>=0x0?!![]:![];logger[_0x0baf('0x16')](_0x0baf('0xf9'),_0xc93c2b['id'],_0x743f4b['id'],_0x743f4b[_0x0baf('0xf5')],_0x21e3b1?'ONLINE':_0x0baf('0xfa'),_0xc93c2b['timezone']?_0xc93c2b['timezone']:_0x0baf('0xfb'));return _0x21e3b1;})['catch'](function(_0x4a0f32){logger[_0x0baf('0x1b')](_0x0baf('0xf9'),_0xc93c2b['id'],_0x743f4b['id'],_0x743f4b['interval'],util[_0x0baf('0xfc')](_0x4a0f32,{'showHidden':![],'depth':null}),_0xc93c2b[_0x0baf('0xf6')]?_0xc93c2b[_0x0baf('0xf6')]:_0x0baf('0xfb'));return![];});}exports[_0x0baf('0xfd')]=function(_0x1ad92d,_0x532e4b){var _0x395ad5=0x0;var _0x47fcb1=0x0;var _0x2a4997=![];var _0x2997b3;var _0x4e0fc6;return db['ChatWebsite'][_0x0baf('0x54')]({'where':{'id':_0x1ad92d[_0x0baf('0x4d')]['id']},'include':[{'model':db['Interval'],'as':_0x0baf('0xfe'),'include':[{'model':db[_0x0baf('0xfe')],'as':_0x0baf('0xff'),'attributes':['id',_0x0baf('0xf5')],'raw':!![]}]}]})[_0x0baf('0x15')](handleEntityNotFound(_0x532e4b,null))[_0x0baf('0x15')](function(_0x20f37b){if(_0x20f37b){_0x2997b3=_0x20f37b;return _0x20f37b[_0x0baf('0x100')]({'raw':!![]});}})['then'](function(_0x3f136e){if(_0x2997b3){if(_0x3f136e){_0x4e0fc6=_0x3f136e;}}return require(_0x0baf('0x101'))['getLicense']();})['then'](function(_0x276d39){if(_0x276d39){_0x47fcb1=_0x276d39[_0x0baf('0x102')];_0x2a4997=_0x276d39['custom'];}})[_0x0baf('0x15')](function(){return db[_0x0baf('0xab')]['count']({'where':{'closed':![]}});})[_0x0baf('0x15')](function(_0x47825b){_0x395ad5=_0x47825b;if(_0x47fcb1&&_0x47825b>_0x47fcb1){return db[_0x0baf('0x103')][_0x0baf('0x59')]({'where':{'id':0x1}})[_0x0baf('0x15')](function(_0x9f5f16){if(_0x9f5f16){_0x9f5f16[_0x0baf('0x104')](_0x0baf('0x105'));}});}})[_0x0baf('0x15')](function(){if(_0x2997b3['Interval']&&_0x2997b3[_0x0baf('0xfe')][_0x0baf('0xff')]){var _0x547a10=[];for(var _0x4ef69a=0x0;_0x4ef69a<_0x2997b3[_0x0baf('0xfe')]['Intervals'][_0x0baf('0x61')];_0x4ef69a++){var _0x3752fd=_0x2997b3[_0x0baf('0xfe')][_0x0baf('0xff')][_0x4ef69a][_0x0baf('0x2a')]({'plain':!![]});_0x547a10[_0x0baf('0x106')](iftimePromise(_0x3752fd,_0x2997b3));}return BPromise[_0x0baf('0x107')](_0x547a10)[_0x0baf('0x15')](function(_0x148b9a){return _['some'](_0x148b9a);});}else{return!![];}})[_0x0baf('0x15')](function(_0x6721e9){var _0x2d4336=fs[_0x0baf('0xc2')](path['join'](config[_0x0baf('0x6f')],_0x0baf('0x108')),_0x0baf('0xc4'));var _0x550db0={'remote':_0x2997b3[_0x0baf('0x109')],'query':querystring[_0x0baf('0x1a')](_[_0x0baf('0x45')](_0x2997b3[_0x0baf('0x2a')]({'plain':!![]}),{'customerIp':_0x1ad92d['headers'][_0x0baf('0x9f')]||_0x1ad92d[_0x0baf('0x7e')]['x-real-ip']||_0x1ad92d['connection']['remoteAddress']||_0x1ad92d['ip'],'referer':_0x1ad92d[_0x0baf('0x7e')][_0x0baf('0x10a')],'openedInteractions':_0x395ad5,'maxInteractions':_0x47fcb1,'virtual':_0x2a4997[_0x0baf('0x102')],'online':_0x6721e9,'custom':_0x2a4997}))['replace'](/'/g,'\x5c\x27')};_0x532e4b[_0x0baf('0x30')](ejs[_0x0baf('0xc5')](Mustache[_0x0baf('0xc5')](_0x2d4336,_0x550db0),{'proactiveActions':_0x4e0fc6,'alignment':_0x2997b3[_0x0baf('0x10b')],'verticalAlignment':_0x2997b3[_0x0baf('0x10c')],'div_color':_0x2997b3['color'],'labelText':_0x2997b3[_0x0baf('0x10d')],'text_color':_0x2997b3[_0x0baf('0x10e')],'button_color':_0x2997b3[_0x0baf('0x10f')],'background_color':_0x2997b3[_0x0baf('0x110')]}));})[_0x0baf('0x1f')](handleError(_0x532e4b,null));};exports[_0x0baf('0x111')]=function(_0x5ab670,_0x4c4ffe){var _0x181980=_0x5ab670[_0x0baf('0x4d')]['id'];var _0x313e3e=_0x5ab670[_0x0baf('0x4f')];var _0x1cf4b5=0xc8;var _0x5d1985=null;return db[_0x0baf('0xd2')][_0x0baf('0x112')]({'isolationLevel':db[_0x0baf('0xd2')]['Transaction'][_0x0baf('0x113')][_0x0baf('0x114')]},function(_0x1e10a4){return db[_0x0baf('0x33')]['findOne']({'where':{'id':_0x181980},'transaction':_0x1e10a4})[_0x0baf('0x15')](function(_0x4d6e8e){if(_0x4d6e8e){return db[_0x0baf('0x115')][_0x0baf('0x29')]({'where':{'ChatWebsiteId':_0x181980},'transaction':_0x1e10a4})[_0x0baf('0x15')](function(){var _0x594a08=_['map'](_0x313e3e,function(_0x45e0ec){_0x45e0ec[_0x0baf('0x5f')]=_0x181980;return _0x45e0ec;});return db[_0x0baf('0x115')][_0x0baf('0xd4')](_0x594a08,{'transaction':_0x1e10a4});});}else{_0x1cf4b5=0x194;_0x5d1985=[];}});})['then'](function(){if(_0x1cf4b5!==0x194){return db['ChatApplication']['findAndCountAll']({'where':{'ChatWebsiteId':_0x181980},'order':_0x0baf('0x98')})[_0x0baf('0x15')](function(_0x46171d){_0x5d1985=_0x46171d;});}})['catch'](function(_0x2ba54d){_0x1cf4b5=0x1f4;logger[_0x0baf('0x1b')](_0x2ba54d[_0x0baf('0x2e')]);if(_0x2ba54d['name']){delete _0x2ba54d[_0x0baf('0x2f')];}_0x5d1985=_0x2ba54d;})[_0x0baf('0x116')](function(){if(_0x5d1985===null){_0x4c4ffe[_0x0baf('0x20')](_0x1cf4b5);}else{if(_0x1cf4b5===0x1f4){_0x4c4ffe['status'](_0x1cf4b5)['send'](_0x5d1985);}else{_0x4c4ffe['status'](_0x1cf4b5)['json'](_0x5d1985);}}});};exports[_0x0baf('0x117')]=function(_0x1c8b91,_0x3124bc){var _0x5ba16f={};var _0xcbc041={};var _0x5b1808;var _0x1abba8;return db[_0x0baf('0x33')]['findOne']({'where':{'id':_0x1c8b91['params']['id']}})[_0x0baf('0x15')](handleEntityNotFound(_0x3124bc,null))[_0x0baf('0x15')](function(_0xc0952d){if(_0xc0952d){_0x5b1808=_0xc0952d;_0xcbc041['model']=_[_0x0baf('0x38')](db[_0x0baf('0x115')]['rawAttributes']);_0xcbc041['query']=_[_0x0baf('0x38')](_0x1c8b91[_0x0baf('0x39')]);_0xcbc041[_0x0baf('0x3a')]=_[_0x0baf('0x3b')](_0xcbc041[_0x0baf('0x36')],_0xcbc041[_0x0baf('0x39')]);_0x5ba16f[_0x0baf('0x3c')]=_[_0x0baf('0x3b')](_0xcbc041[_0x0baf('0x36')],qs[_0x0baf('0x3d')](_0x1c8b91[_0x0baf('0x39')][_0x0baf('0x3d')]));_0x5ba16f[_0x0baf('0x3c')]=_0x5ba16f[_0x0baf('0x3c')][_0x0baf('0x61')]?_0x5ba16f['attributes']:_0xcbc041[_0x0baf('0x36')];_0x5ba16f[_0x0baf('0x40')]=qs[_0x0baf('0x41')](_0x1c8b91['query']['sort']);_0x5ba16f[_0x0baf('0x44')]=qs[_0x0baf('0x3a')](_[_0x0baf('0x42')](_0x1c8b91[_0x0baf('0x39')],_0xcbc041[_0x0baf('0x3a')]));if(_0x1c8b91[_0x0baf('0x39')][_0x0baf('0x43')]){_0x5ba16f[_0x0baf('0x44')]=_[_0x0baf('0x45')](_0x5ba16f[_0x0baf('0x44')],{'$or':_[_0x0baf('0x37')](_0x5ba16f[_0x0baf('0x3c')],function(_0x4306bb){var _0x2c2d4b={};_0x2c2d4b[_0x4306bb]={'$like':'%'+_0x1c8b91[_0x0baf('0x39')]['filter']+'%'};return _0x2c2d4b;})});}_0x5ba16f=_[_0x0baf('0x45')]({},_0x5ba16f,_0x1c8b91[_0x0baf('0x48')]);return _0x5b1808[_0x0baf('0x117')](_0x5ba16f);}})[_0x0baf('0x15')](function(_0x4056b6){if(_0x4056b6){_0x1abba8=_0x4056b6[_0x0baf('0x61')];if(!_0x1c8b91[_0x0baf('0x39')]['hasOwnProperty']('nolimit')){_0x5ba16f[_0x0baf('0x25')]=qs['limit'](_0x1c8b91['query'][_0x0baf('0x25')]);_0x5ba16f['offset']=qs[_0x0baf('0x23')](_0x1c8b91[_0x0baf('0x39')][_0x0baf('0x23')]);}return _0x5b1808[_0x0baf('0x117')](_0x5ba16f);}})[_0x0baf('0x15')](function(_0x2a02e6){if(_0x2a02e6){return _0x2a02e6?{'count':_0x1abba8,'rows':_0x2a02e6}:null;}})[_0x0baf('0x15')](respondWithResult(_0x3124bc,null))[_0x0baf('0x1f')](handleError(_0x3124bc,null));};exports['addProactiveActions']=function(_0x4bcc76,_0xae7f71){return db[_0x0baf('0x118')][_0x0baf('0x54')]({'where':{'id':_0x4bcc76[_0x0baf('0x4d')]['id']}})[_0x0baf('0x15')](handleEntityNotFound(_0xae7f71,null))['then'](function(_0x123037){if(_0x123037){return _0x123037[_0x0baf('0x119')](_0x4bcc76[_0x0baf('0x4f')][_0x0baf('0x5d')],_[_0x0baf('0x11a')](_0x4bcc76[_0x0baf('0x4f')],[_0x0baf('0x5d'),'id'])||{});}})[_0x0baf('0x15')](respondWithResult(_0xae7f71,null))[_0x0baf('0x1f')](handleError(_0xae7f71,null));};exports[_0x0baf('0x100')]=function(_0x238649,_0x30ef34){var _0x43c6a6={};var _0x2448dd={};var _0x4a999b;var _0x165555;return db[_0x0baf('0x33')][_0x0baf('0x59')]({'where':{'id':_0x238649[_0x0baf('0x4d')]['id']}})[_0x0baf('0x15')](handleEntityNotFound(_0x30ef34,null))['then'](function(_0x2723ea){if(_0x2723ea){_0x4a999b=_0x2723ea;_0x2448dd[_0x0baf('0x36')]=_[_0x0baf('0x38')](db['ChatProactiveAction']['rawAttributes']);_0x2448dd[_0x0baf('0x39')]=_[_0x0baf('0x38')](_0x238649['query']);_0x2448dd[_0x0baf('0x3a')]=_[_0x0baf('0x3b')](_0x2448dd['model'],_0x2448dd[_0x0baf('0x39')]);_0x43c6a6[_0x0baf('0x3c')]=_[_0x0baf('0x3b')](_0x2448dd[_0x0baf('0x36')],qs[_0x0baf('0x3d')](_0x238649[_0x0baf('0x39')][_0x0baf('0x3d')]));_0x43c6a6['attributes']=_0x43c6a6['attributes'][_0x0baf('0x61')]?_0x43c6a6['attributes']:_0x2448dd[_0x0baf('0x36')];_0x43c6a6[_0x0baf('0x40')]=qs[_0x0baf('0x41')](_0x238649['query'][_0x0baf('0x41')]);_0x43c6a6[_0x0baf('0x44')]=qs['filters'](_[_0x0baf('0x42')](_0x238649[_0x0baf('0x39')],_0x2448dd[_0x0baf('0x3a')]));if(_0x238649[_0x0baf('0x39')][_0x0baf('0x43')]){_0x43c6a6[_0x0baf('0x44')]=_[_0x0baf('0x45')](_0x43c6a6[_0x0baf('0x44')],{'$or':_[_0x0baf('0x37')](_0x43c6a6['attributes'],function(_0x2739c7){var _0x1bea85={};_0x1bea85[_0x2739c7]={'$like':'%'+_0x238649['query']['filter']+'%'};return _0x1bea85;})});}_0x43c6a6=_[_0x0baf('0x45')]({},_0x43c6a6,_0x238649[_0x0baf('0x48')]);return _0x4a999b[_0x0baf('0x100')](_0x43c6a6);}})[_0x0baf('0x15')](function(_0x34d2db){if(_0x34d2db){_0x165555=_0x34d2db['length'];if(!_0x238649['query'][_0x0baf('0x3e')]('nolimit')){_0x43c6a6[_0x0baf('0x25')]=qs['limit'](_0x238649[_0x0baf('0x39')][_0x0baf('0x25')]);_0x43c6a6[_0x0baf('0x23')]=qs['offset'](_0x238649[_0x0baf('0x39')][_0x0baf('0x23')]);}return _0x4a999b[_0x0baf('0x100')](_0x43c6a6);}})['then'](function(_0xb3a031){if(_0xb3a031){return _0xb3a031?{'count':_0x165555,'rows':_0xb3a031}:null;}})[_0x0baf('0x15')](respondWithResult(_0x30ef34,null))[_0x0baf('0x1f')](handleError(_0x30ef34,null));};exports[_0x0baf('0x11b')]=function(_0x3597fe,_0x132995){var _0x12c4bf=_0x3597fe[_0x0baf('0x39')][_0x0baf('0x11c')]===_0x0baf('0x11d')?'offlineForm':_0x0baf('0x11e');return db[_0x0baf('0x33')]['find']({'attributes':['id',_0x12c4bf],'where':{'id':_0x3597fe[_0x0baf('0x4d')]['id']}})[_0x0baf('0x15')](handleEntityNotFound(_0x132995,null))[_0x0baf('0x15')](function(_0xc2b22e){if(_0xc2b22e){var _0x51f903=_0xc2b22e[_0x12c4bf];var _0x423e9c=_0x51f903&&_0x51f903[_0x0baf('0x11f')]?_0x51f903[_0x0baf('0x11f')]:[];_0x132995['send']({'fromKey':_['isNil'](_0x51f903[_0x0baf('0x120')])?undefined:_0x51f903['fromKey'],'count':_0x423e9c[_0x0baf('0x61')],'rows':_0x423e9c});}})[_0x0baf('0x1f')](handleError(_0x132995,null));};exports['getOfflineMessages']=function(_0x53e81a,_0x572289){var _0x4fc936={'raw':![],'where':{}};var _0x423636={};var _0x51f03c={'count':0x0,'rows':[]};return db[_0x0baf('0x33')][_0x0baf('0x59')]({'where':{'id':_0x53e81a[_0x0baf('0x4d')]['id']}})['then'](handleEntityNotFound(_0x572289,null))['then'](function(_0xa010ed){if(_0xa010ed){_0x423636[_0x0baf('0x36')]=_['keys'](db[_0x0baf('0xc8')]['rawAttributes']);_0x423636[_0x0baf('0x39')]=_[_0x0baf('0x38')](_0x53e81a['query']);_0x423636[_0x0baf('0x3a')]=_[_0x0baf('0x3b')](_0x423636['model'],_0x423636[_0x0baf('0x39')]);_0x4fc936[_0x0baf('0x3c')]=_[_0x0baf('0x3b')](_0x423636[_0x0baf('0x36')],qs['fields'](_0x53e81a[_0x0baf('0x39')]['fields']));_0x4fc936[_0x0baf('0x3c')]=_0x4fc936[_0x0baf('0x3c')][_0x0baf('0x61')]?_0x4fc936['attributes']:_0x423636['model'];if(!_0x53e81a[_0x0baf('0x39')][_0x0baf('0x3e')](_0x0baf('0x3f'))){_0x4fc936['limit']=qs[_0x0baf('0x25')](_0x53e81a[_0x0baf('0x39')][_0x0baf('0x25')]);_0x4fc936['offset']=qs[_0x0baf('0x23')](_0x53e81a['query'][_0x0baf('0x23')]);}_0x4fc936[_0x0baf('0x40')]=qs[_0x0baf('0x41')](_0x53e81a[_0x0baf('0x39')][_0x0baf('0x41')]);_0x4fc936[_0x0baf('0x44')]=qs[_0x0baf('0x3a')](_[_0x0baf('0x42')](_0x53e81a[_0x0baf('0x39')],_0x423636['filters']));_0x4fc936[_0x0baf('0x44')][_0x0baf('0x5f')]=_0xa010ed['id'];if(_0x53e81a[_0x0baf('0x39')][_0x0baf('0x43')]){_0x4fc936[_0x0baf('0x44')]=_[_0x0baf('0x45')](_0x4fc936[_0x0baf('0x44')],{'$or':_[_0x0baf('0x37')](_0x4fc936[_0x0baf('0x3c')],function(_0x410e8e){var _0x54facf={};_0x54facf[_0x410e8e]={'$like':'%'+_0x53e81a[_0x0baf('0x39')][_0x0baf('0x43')]+'%'};return _0x54facf;})});}_0x4fc936=_['merge']({},_0x4fc936,_0x53e81a[_0x0baf('0x48')]);return db[_0x0baf('0xc8')][_0x0baf('0x26')]({'where':_0x4fc936[_0x0baf('0x44')]})[_0x0baf('0x15')](function(_0x1fb9f7){_0x51f03c[_0x0baf('0x26')]=_0x1fb9f7;if(_0x53e81a[_0x0baf('0x39')][_0x0baf('0x49')]){_0x4fc936['include']=[{'all':!![]}];}else{_0x4fc936[_0x0baf('0x4a')]=[{'model':db[_0x0baf('0x82')],'as':_0x0baf('0xee'),'required':![]},{'model':db[_0x0baf('0xd3')],'as':_0x0baf('0x121'),'required':![]}];}return db['ChatOfflineMessage']['findAll'](_0x4fc936);})[_0x0baf('0x15')](function(_0x58b532){_0x51f03c[_0x0baf('0x4b')]=_0x58b532;return _0x51f03c;});}})[_0x0baf('0x15')](respondWithFilteredResult(_0x572289,_0x4fc936))[_0x0baf('0x1f')](handleError(_0x572289,null));};exports[_0x0baf('0x122')]=function(_0x3a667a,_0x2629e9){return db[_0x0baf('0x33')][_0x0baf('0x54')]({'where':{'id':_0x3a667a[_0x0baf('0x4d')]['id']}})['then'](handleEntityNotFound(_0x2629e9,null))['then'](function(_0x274787){if(_0x274787){return _0x274787[_0x0baf('0x122')](_0x3a667a[_0x0baf('0x4f')][_0x0baf('0x5d')],_['omit'](_0x3a667a[_0x0baf('0x4f')],['ids','id'])||{})[_0x0baf('0xaf')](function(_0x548f40){for(var _0x64dd21=0x0;_0x64dd21<_0x3a667a[_0x0baf('0x4f')][_0x0baf('0x5d')]['length'];_0x64dd21+=0x1){socket[_0x0baf('0x123')](_0x0baf('0x124'),{'UserId':Number(_0x3a667a['body']['ids'][_0x64dd21]),'ChatWebsiteId':Number(_0x3a667a['params']['id'])});}return _0x548f40;});}})['then'](respondWithResult(_0x2629e9,null))[_0x0baf('0x1f')](handleError(_0x2629e9,null));};exports[_0x0baf('0x125')]=function(_0x1c414,_0x27c810){return db[_0x0baf('0x33')][_0x0baf('0x54')]({'where':{'id':_0x1c414[_0x0baf('0x4d')]['id']}})[_0x0baf('0x15')](handleEntityNotFound(_0x27c810,null))[_0x0baf('0x15')](function(_0xfa0191){if(_0xfa0191){return _0xfa0191[_0x0baf('0x125')](_0x1c414[_0x0baf('0x39')]['ids'])[_0x0baf('0x15')](function(){if(_['isArray'](_0x1c414[_0x0baf('0x39')][_0x0baf('0x5d')])){for(var _0x93dcbd=0x0;_0x93dcbd<_0x1c414[_0x0baf('0x39')][_0x0baf('0x5d')][_0x0baf('0x61')];_0x93dcbd+=0x1){socket[_0x0baf('0x123')]('userChatWebsite:remove',{'UserId':Number(_0x1c414[_0x0baf('0x39')]['ids'][_0x93dcbd]),'ChatWebsiteId':Number(_0x1c414[_0x0baf('0x4d')]['id'])});}}else{socket[_0x0baf('0x123')](_0x0baf('0x126'),{'UserId':Number(_0x1c414[_0x0baf('0x39')][_0x0baf('0x5d')]),'ChatWebsiteId':Number(_0x1c414['params']['id'])});}});}})['then'](respondWithStatusCode(_0x27c810,null))[_0x0baf('0x1f')](handleError(_0x27c810,null));};exports[_0x0baf('0x127')]=function(_0x28c059,_0x51c9e0){var _0x52faae={};var _0x47868e={};var _0x2849c1;var _0x3dd487;return db[_0x0baf('0x33')][_0x0baf('0x59')]({'where':{'id':_0x28c059[_0x0baf('0x4d')]['id']}})[_0x0baf('0x15')](handleEntityNotFound(_0x51c9e0,null))[_0x0baf('0x15')](function(_0x393408){if(_0x393408){_0x2849c1=_0x393408;_0x47868e['model']=_['keys'](db[_0x0baf('0xb7')][_0x0baf('0x34')]);_0x47868e[_0x0baf('0x39')]=_[_0x0baf('0x38')](_0x28c059['query']);_0x47868e[_0x0baf('0x3a')]=_[_0x0baf('0x3b')](_0x47868e[_0x0baf('0x36')],_0x47868e['query']);_0x52faae[_0x0baf('0x3c')]=_[_0x0baf('0x3b')](_0x47868e[_0x0baf('0x36')],qs[_0x0baf('0x3d')](_0x28c059['query'][_0x0baf('0x3d')]));_0x52faae[_0x0baf('0x3c')]=_0x52faae[_0x0baf('0x3c')]['length']?_0x52faae[_0x0baf('0x3c')]:_0x47868e[_0x0baf('0x36')];_0x52faae['order']=qs[_0x0baf('0x41')](_0x28c059[_0x0baf('0x39')][_0x0baf('0x41')]);_0x52faae[_0x0baf('0x44')]=qs[_0x0baf('0x3a')](_['pick'](_0x28c059['query'],_0x47868e[_0x0baf('0x3a')]));if(_0x28c059['query'][_0x0baf('0x43')]){_0x52faae[_0x0baf('0x44')]=_[_0x0baf('0x45')](_0x52faae[_0x0baf('0x44')],{'$or':_[_0x0baf('0x37')](_0x52faae[_0x0baf('0x3c')],function(_0xe30e49){var _0x3a5d39={};_0x3a5d39[_0xe30e49]={'$like':'%'+_0x28c059[_0x0baf('0x39')][_0x0baf('0x43')]+'%'};return _0x3a5d39;})});}_0x52faae=_[_0x0baf('0x45')]({},_0x52faae,_0x28c059[_0x0baf('0x48')]);return _0x2849c1[_0x0baf('0x127')](_0x52faae);}})['then'](function(_0x1684e5){if(_0x1684e5){_0x3dd487=_0x1684e5[_0x0baf('0x61')];if(!_0x28c059[_0x0baf('0x39')][_0x0baf('0x3e')](_0x0baf('0x3f'))){_0x52faae[_0x0baf('0x25')]=qs[_0x0baf('0x25')](_0x28c059[_0x0baf('0x39')][_0x0baf('0x25')]);_0x52faae[_0x0baf('0x23')]=qs[_0x0baf('0x23')](_0x28c059[_0x0baf('0x39')]['offset']);}return _0x2849c1[_0x0baf('0x127')](_0x52faae);}})[_0x0baf('0x15')](function(_0x1ea92f){if(_0x1ea92f){return _0x1ea92f?{'count':_0x3dd487,'rows':_0x1ea92f}:null;}})['then'](respondWithResult(_0x51c9e0,null))[_0x0baf('0x1f')](handleError(_0x51c9e0,null));}; \ No newline at end of file +var _0xb10b=['removeAgents','isArray','userChatWebsite:remove','getAgents','bluebird','util','path','ejs','lodash','querystring','ioredis','../../components/parsers/qs','../../config/logger','api','../../mysqldb','redis','localhost','socket.io-emitter','./chatWebsite.socket','register','html-to-text','jayson/promise','client','http','request','then','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','destroy','get','UserProfileResource','stack','name','index','map','ChatWebsite','rawAttributes','fieldName','key','model','keys','query','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','where','merge','type','filter','options','includeAll','findAll','rows','mandatoryDispositionPause','intersection','include','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','ChatWebsites','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','find','params','Pause','ChatWebsiteId','Disposition','getDispositions','findOne','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','addLogo','sitepic','addAvatar','agentAvatar','file','addCustomerAvatar','customerAvatar','filename','systemAvatar','join','root','server/files/images/logos/default_logo.svg','../../config/license/util','custom','isNil','existsSync','server/files/images/logos/','download','getAvatar','server/files/images/avatars/default_avatar.png','server/files/images/avatars/','server/files/images/avatars/customer_avatar.png','getSystemAvatar','server/files/images/avatars/system_avatar.png','notify','user-agent-parser','setUA','user-agent','getResult','chat','CmContact','Sequelize','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','from','ValidationError','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','includes','CmList','List','Contacts','ChatApplication','Applications','account','applications','list','orderBy','asc','defaults','contact','customerIp','cf-connecting-ip','headers','x-forwarded-for','first','split','firstName','lastName','referer','browser','version','format','%s\x20%s','unknown','device','threadId','ChatInteraction','ContactId','interaction','spread','messageId','created','close','unmanaged','ChatMessage','AttachmentId','UserId','User','unshift','agent','*,*,*,*','forcedOwnership','Start','startRouting','EventManager','offline','describe','ListId','send','mapKeyOffline','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','MailAccount','findOrCreate','server/files/templates/chatOfflineMessage.ejs','render','toPairs','offlineMessageBody','ChatOfflineMessage','originalname','attachments','offline-chat','basename','openNewInteraction','sequelize','transaction','Attachment','bulkCreate','MailServerOut','Smtp','forwardOffline','service','host','port','authentication','auth','pass','sendMail','\x22%s\x22\x20<%s>','email','forwardOfflineAddress','offlineMessageSubject','mimetype','subjectOffline','toPairsIn','mapValues','Chat','MailAccountId','NotifyMailAccount','notifyMail','Could\x20not\x20remove\x20attachment\x20file','addInteraction','omit','Contact','Owner','fullname','internal','Tag','Tags','color','tag','Command','timezone','interval','iftime\x20%s','indexOf','true','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','ONLINE','OFFLINE','No\x20timezone','inspect','getSnippet','Interval','Intervals','getProactiveActions','getLicense','virtual','License','chatLicenseExceeded','readFileSync','server/files/chat/iframe.ejs','remote','x-real-ip','connection','labelText','textColor','backgroundColor','addApplications','Transaction','ISOLATION_LEVELS','READ_COMMITTED','findAndCountAll','finally','getApplications','addProactiveActions','ChatProactiveAction','getFields','false','offlineForm','onlineForm','items','fromKey','getOfflineMessages','Attachments','addAgents','emit'];(function(_0x267a7f,_0x49ebfc){var _0x341f37=function(_0x178ac8){while(--_0x178ac8){_0x267a7f['push'](_0x267a7f['shift']());}};_0x341f37(++_0x49ebfc);}(_0xb10b,0x12a));var _0xbb10=function(_0x39686e,_0x3d83bb){_0x39686e=_0x39686e-0x0;var _0x1b765e=_0xb10b[_0x39686e];return _0x1b765e;};'use strict';var BPromise=require(_0xbb10('0x0'));var Mustache=require('mustache');var util=require(_0xbb10('0x1'));var path=require(_0xbb10('0x2'));var ejs=require(_0xbb10('0x3'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xbb10('0x4'));var querystring=require(_0xbb10('0x5'));var Redis=require(_0xbb10('0x6'));var qs=require(_0xbb10('0x7'));var logger=require(_0xbb10('0x8'))(_0xbb10('0x9'));var config=require('../../config/environment');var db=require(_0xbb10('0xa'))['db'];config[_0xbb10('0xb')]=_['defaults'](config[_0xbb10('0xb')],{'host':_0xbb10('0xc'),'port':0x18eb});var socket=require(_0xbb10('0xd'))(new Redis(config[_0xbb10('0xb')]));require(_0xbb10('0xe'))[_0xbb10('0xf')](socket);var htmlToText=require(_0xbb10('0x10'));var jayson=require(_0xbb10('0x11'));var client=jayson['client']['http']({'port':0x232c});var client9002=jayson[_0xbb10('0x12')][_0xbb10('0x13')]({'port':0x232a});var client9003=jayson[_0xbb10('0x12')]['http']({'port':0x232b});var client9001=jayson[_0xbb10('0x12')]['http']({'port':0x2329});function respondWithRpcPromise(_0x44fb19,_0x916a32,_0x285009,_0x193a27){return new BPromise(function(_0x442548,_0x147230){var _0x58a612=_0x193a27||client;return _0x58a612[_0xbb10('0x14')](_0x44fb19,_0x285009)[_0xbb10('0x15')](function(_0x45b9d6){logger[_0xbb10('0x16')](_0xbb10('0x17'),_0x916a32,_0xbb10('0x18'));logger[_0xbb10('0x19')](_0xbb10('0x1a'),_0x916a32,_0xbb10('0x18'),JSON[_0xbb10('0x1b')](_0x45b9d6));if(_0x45b9d6['error']){if(_0x45b9d6[_0xbb10('0x1c')][_0xbb10('0x1d')]===0x1f4){logger[_0xbb10('0x1c')](_0xbb10('0x17'),_0x916a32,_0x45b9d6[_0xbb10('0x1c')][_0xbb10('0x1e')]);return _0x147230(_0x45b9d6[_0xbb10('0x1c')][_0xbb10('0x1e')]);}logger[_0xbb10('0x1c')](_0xbb10('0x17'),_0x916a32,_0x45b9d6['error'][_0xbb10('0x1e')]);return _0x442548(_0x45b9d6[_0xbb10('0x1c')][_0xbb10('0x1e')]);}else{logger[_0xbb10('0x16')](_0xbb10('0x17'),_0x916a32,_0xbb10('0x18'));_0x442548(_0x45b9d6['result'][_0xbb10('0x1e')]);}})[_0xbb10('0x1f')](function(_0x50aea1){logger['error'](_0xbb10('0x17'),_0x916a32,_0x50aea1);_0x147230(_0x50aea1);});});}function respondWithStatusCode(_0x311abe,_0x2e911d){_0x2e911d=_0x2e911d||0xcc;return function(_0x317da4){if(_0x317da4){return _0x311abe[_0xbb10('0x20')](_0x2e911d);}return _0x311abe[_0xbb10('0x21')](_0x2e911d)[_0xbb10('0x22')]();};}function respondWithResult(_0x436104,_0x7f2377){_0x7f2377=_0x7f2377||0xc8;return function(_0x395404){if(_0x395404){return _0x436104[_0xbb10('0x21')](_0x7f2377)[_0xbb10('0x23')](_0x395404);}};}function respondWithFilteredResult(_0x537898,_0x4fedac){return function(_0x4fb5e0){if(_0x4fb5e0){var _0xc93a04=typeof _0x4fedac[_0xbb10('0x24')]===_0xbb10('0x25')&&typeof _0x4fedac['limit']===_0xbb10('0x25');var _0x24d586=_0x4fb5e0[_0xbb10('0x26')];var _0x1d5e95=_0xc93a04?0x0:_0x4fedac[_0xbb10('0x24')];var _0x20d946=_0xc93a04?_0x4fb5e0[_0xbb10('0x26')]:_0x4fedac['offset']+_0x4fedac[_0xbb10('0x27')];var _0x21ac54;if(_0x20d946>=_0x24d586){_0x20d946=_0x24d586;_0x21ac54=0xc8;}else{_0x21ac54=0xce;}_0x537898[_0xbb10('0x21')](_0x21ac54);return _0x537898[_0xbb10('0x28')](_0xbb10('0x29'),_0x1d5e95+'-'+_0x20d946+'/'+_0x24d586)[_0xbb10('0x23')](_0x4fb5e0);}return null;};}function saveUpdates(_0x5d5c80){return function(_0x221624){if(_0x221624){return _0x221624['update'](_0x5d5c80)[_0xbb10('0x15')](function(_0x56f2da){return _0x56f2da;});}return null;};}function removeEntity(_0x16ad2a){return function(_0x1dcc9c){if(_0x1dcc9c){return _0x1dcc9c[_0xbb10('0x2a')]()['then'](function(){var _0x518d47=_0x1dcc9c[_0xbb10('0x2b')]({'plain':!![]});var _0x34f65e='ChatWebsites';return db[_0xbb10('0x2c')][_0xbb10('0x2a')]({'where':{'type':_0x34f65e,'resourceId':_0x518d47['id']}})[_0xbb10('0x15')](function(){return _0x1dcc9c;});})[_0xbb10('0x15')](function(){_0x16ad2a[_0xbb10('0x21')](0xcc)[_0xbb10('0x22')]();});}};}function handleEntityNotFound(_0xf85197){return function(_0x4975f5){if(!_0x4975f5){_0xf85197[_0xbb10('0x20')](0x194);}return _0x4975f5;};}function handleError(_0x1da9c9,_0x441d15){_0x441d15=_0x441d15||0x1f4;return function(_0x8c1ce6){logger[_0xbb10('0x1c')](_0x8c1ce6[_0xbb10('0x2d')]);if(_0x8c1ce6[_0xbb10('0x2e')]){delete _0x8c1ce6[_0xbb10('0x2e')];}_0x1da9c9[_0xbb10('0x21')](_0x441d15)['send'](_0x8c1ce6);};}exports[_0xbb10('0x2f')]=function(_0x150107,_0x1ddd9e){var _0x3c3c45={'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0x570f5a={},_0x111762={'count':0x0,'rows':[]};var _0x3eb3cc=_[_0xbb10('0x30')](db[_0xbb10('0x31')][_0xbb10('0x32')],function(_0x15d895){return{'name':_0x15d895[_0xbb10('0x33')],'type':_0x15d895['type'][_0xbb10('0x34')]};});_0x570f5a[_0xbb10('0x35')]=_['map'](_0x3eb3cc,'name');_0x570f5a['query']=_[_0xbb10('0x36')](_0x150107[_0xbb10('0x37')]);_0x570f5a[_0xbb10('0x38')]=_['intersection'](_0x570f5a[_0xbb10('0x35')],_0x570f5a[_0xbb10('0x37')]);_0x3c3c45[_0xbb10('0x39')]=_['intersection'](_0x570f5a[_0xbb10('0x35')],qs[_0xbb10('0x3a')](_0x150107[_0xbb10('0x37')][_0xbb10('0x3a')]));_0x3c3c45['attributes']=_0x3c3c45[_0xbb10('0x39')][_0xbb10('0x3b')]?_0x3c3c45['attributes']:_0x570f5a[_0xbb10('0x35')];if(!_0x150107[_0xbb10('0x37')][_0xbb10('0x3c')](_0xbb10('0x3d'))){_0x3c3c45[_0xbb10('0x27')]=qs[_0xbb10('0x27')](_0x150107['query'][_0xbb10('0x27')]);_0x3c3c45[_0xbb10('0x24')]=qs[_0xbb10('0x24')](_0x150107[_0xbb10('0x37')]['offset']);}_0x3c3c45[_0xbb10('0x3e')]=qs[_0xbb10('0x3f')](_0x150107[_0xbb10('0x37')][_0xbb10('0x3f')]);_0x3c3c45['where']=qs[_0xbb10('0x38')](_[_0xbb10('0x40')](_0x150107['query'],_0x570f5a['filters']),_0x3eb3cc);if(_0x150107[_0xbb10('0x37')]['filter']){_0x3c3c45[_0xbb10('0x41')]=_[_0xbb10('0x42')](_0x3c3c45['where'],{'$or':_[_0xbb10('0x30')](_0x3eb3cc,function(_0x1d82bf){if(_0x1d82bf[_0xbb10('0x43')]!=='VIRTUAL'){var _0x2dd02b={};_0x2dd02b[_0x1d82bf[_0xbb10('0x2e')]]={'$like':'%'+_0x150107[_0xbb10('0x37')][_0xbb10('0x44')]+'%'};return _0x2dd02b;}})});}_0x3c3c45=_[_0xbb10('0x42')]({},_0x3c3c45,_0x150107[_0xbb10('0x45')]);var _0x190781={'where':_0x3c3c45[_0xbb10('0x41')]};return db[_0xbb10('0x31')][_0xbb10('0x26')](_0x190781)[_0xbb10('0x15')](function(_0x1eadd2){_0x111762['count']=_0x1eadd2;if(_0x150107[_0xbb10('0x37')][_0xbb10('0x46')]){_0x3c3c45['include']=[{'all':!![]}];}return db[_0xbb10('0x31')][_0xbb10('0x47')](_0x3c3c45);})[_0xbb10('0x15')](function(_0x5a5226){_0x111762[_0xbb10('0x48')]=_0x5a5226;return _0x111762;})[_0xbb10('0x15')](respondWithFilteredResult(_0x1ddd9e,_0x3c3c45))[_0xbb10('0x1f')](handleError(_0x1ddd9e,null));};exports['show']=function(_0x4a9793,_0xcb3354){var _0x76a208={'raw':![],'where':{'id':_0x4a9793['params']['id']},'include':[{'model':db['Pause'],'as':_0xbb10('0x49')}]},_0x2b12bd={};_0x2b12bd[_0xbb10('0x35')]=_[_0xbb10('0x36')](db[_0xbb10('0x31')][_0xbb10('0x32')]);_0x2b12bd[_0xbb10('0x37')]=_[_0xbb10('0x36')](_0x4a9793[_0xbb10('0x37')]);_0x2b12bd[_0xbb10('0x38')]=_[_0xbb10('0x4a')](_0x2b12bd['model'],_0x2b12bd['query']);_0x76a208[_0xbb10('0x39')]=_[_0xbb10('0x4a')](_0x2b12bd[_0xbb10('0x35')],qs[_0xbb10('0x3a')](_0x4a9793[_0xbb10('0x37')][_0xbb10('0x3a')]));_0x76a208[_0xbb10('0x39')]=_0x76a208[_0xbb10('0x39')][_0xbb10('0x3b')]?_0x76a208[_0xbb10('0x39')]:_0x2b12bd[_0xbb10('0x35')];if(_0x4a9793[_0xbb10('0x37')][_0xbb10('0x46')]){_0x76a208[_0xbb10('0x4b')]=[{'all':!![]}];}_0x76a208=_[_0xbb10('0x42')]({},_0x76a208,_0x4a9793['options']);return db[_0xbb10('0x31')]['find'](_0x76a208)[_0xbb10('0x15')](handleEntityNotFound(_0xcb3354,null))[_0xbb10('0x15')](respondWithResult(_0xcb3354,null))[_0xbb10('0x1f')](handleError(_0xcb3354,null));};exports[_0xbb10('0x4c')]=function(_0x26e66e,_0x32d8e9){return db[_0xbb10('0x31')][_0xbb10('0x4c')](_0x26e66e[_0xbb10('0x4d')],{})[_0xbb10('0x15')](function(_0x44a056){var _0x1c2dce=_0x26e66e[_0xbb10('0x4e')][_0xbb10('0x2b')]({'plain':!![]});if(!_0x1c2dce)throw new Error(_0xbb10('0x4f'));if(_0x1c2dce['role']===_0xbb10('0x4e')){var _0x466eb7=_0x44a056[_0xbb10('0x2b')]({'plain':!![]});var _0x4ce8e7=_0xbb10('0x50');return db[_0xbb10('0x51')]['find']({'where':{'name':_0x4ce8e7,'userProfileId':_0x1c2dce[_0xbb10('0x52')]},'raw':!![]})[_0xbb10('0x15')](function(_0x2909a1){if(_0x2909a1&&_0x2909a1[_0xbb10('0x53')]===0x0){return db[_0xbb10('0x2c')][_0xbb10('0x4c')]({'name':_0x466eb7[_0xbb10('0x2e')],'resourceId':_0x466eb7['id'],'type':_0x2909a1[_0xbb10('0x2e')],'sectionId':_0x2909a1['id']},{})[_0xbb10('0x15')](function(){return _0x44a056;});}else{return _0x44a056;}})[_0xbb10('0x1f')](function(_0x2eb05a){logger[_0xbb10('0x1c')](_0xbb10('0x54'),_0x2eb05a);throw _0x2eb05a;});}return _0x44a056;})['then'](respondWithResult(_0x32d8e9,0xc9))['catch'](handleError(_0x32d8e9,null));};exports[_0xbb10('0x55')]=function(_0x3e6338,_0x3d0cb7){if(_0x3e6338[_0xbb10('0x4d')]['id']){delete _0x3e6338['body']['id'];}return db['ChatWebsite'][_0xbb10('0x56')]({'where':{'id':_0x3e6338[_0xbb10('0x57')]['id']},'include':[{'model':db[_0xbb10('0x58')],'as':_0xbb10('0x49')}]})[_0xbb10('0x15')](handleEntityNotFound(_0x3d0cb7,null))[_0xbb10('0x15')](saveUpdates(_0x3e6338[_0xbb10('0x4d')],null))['then'](respondWithResult(_0x3d0cb7,null))[_0xbb10('0x1f')](handleError(_0x3d0cb7,null));};exports[_0xbb10('0x2a')]=function(_0x4917a5,_0x5e03cb){return db['ChatWebsite'][_0xbb10('0x56')]({'where':{'id':_0x4917a5[_0xbb10('0x57')]['id']}})[_0xbb10('0x15')](handleEntityNotFound(_0x5e03cb,null))['then'](removeEntity(_0x5e03cb,null))['catch'](handleError(_0x5e03cb,null));};exports['describe']=function(_0x3ebc5f,_0x249b33){return db[_0xbb10('0x31')]['describe']()[_0xbb10('0x15')](respondWithResult(_0x249b33,null))[_0xbb10('0x1f')](handleError(_0x249b33,null));};exports['addDisposition']=function(_0x4a560c,_0x27d7b9){if(_0x4a560c[_0xbb10('0x4d')]['id']){delete _0x4a560c[_0xbb10('0x4d')]['id'];}return db[_0xbb10('0x31')]['find']({'where':{'id':_0x4a560c[_0xbb10('0x57')]['id']}})[_0xbb10('0x15')](handleEntityNotFound(_0x27d7b9,null))[_0xbb10('0x15')](function(_0x5202d7){if(_0x5202d7){_0x4a560c[_0xbb10('0x4d')][_0xbb10('0x59')]=_0x5202d7['id'];return db[_0xbb10('0x5a')]['create'](_0x4a560c[_0xbb10('0x4d')]);}})[_0xbb10('0x15')](respondWithResult(_0x27d7b9,null))[_0xbb10('0x1f')](handleError(_0x27d7b9,null));};exports[_0xbb10('0x5b')]=function(_0x5e4a6e,_0x251417){var _0x258e55={'raw':![],'where':{}};var _0x108e5b={};var _0x2d0f4b={'count':0x0,'rows':[]};return db['ChatWebsite'][_0xbb10('0x5c')]({'where':{'id':_0x5e4a6e[_0xbb10('0x57')]['id']}})[_0xbb10('0x15')](handleEntityNotFound(_0x251417,null))[_0xbb10('0x15')](function(_0x12f750){if(_0x12f750){_0x108e5b[_0xbb10('0x35')]=_[_0xbb10('0x36')](db['Disposition']['rawAttributes']);_0x108e5b['query']=_[_0xbb10('0x36')](_0x5e4a6e[_0xbb10('0x37')]);_0x108e5b[_0xbb10('0x38')]=_['intersection'](_0x108e5b['model'],_0x108e5b[_0xbb10('0x37')]);_0x258e55[_0xbb10('0x39')]=_[_0xbb10('0x4a')](_0x108e5b[_0xbb10('0x35')],qs[_0xbb10('0x3a')](_0x5e4a6e[_0xbb10('0x37')]['fields']));_0x258e55[_0xbb10('0x39')]=_0x258e55[_0xbb10('0x39')][_0xbb10('0x3b')]?_0x258e55[_0xbb10('0x39')]:_0x108e5b[_0xbb10('0x35')];if(!_0x5e4a6e['query']['hasOwnProperty']('nolimit')){_0x258e55[_0xbb10('0x27')]=qs[_0xbb10('0x27')](_0x5e4a6e[_0xbb10('0x37')][_0xbb10('0x27')]);_0x258e55[_0xbb10('0x24')]=qs[_0xbb10('0x24')](_0x5e4a6e['query'][_0xbb10('0x24')]);}_0x258e55['order']=qs['sort'](_0x5e4a6e['query'][_0xbb10('0x3f')]);_0x258e55[_0xbb10('0x41')]=qs[_0xbb10('0x38')](_[_0xbb10('0x40')](_0x5e4a6e['query'],_0x108e5b[_0xbb10('0x38')]));_0x258e55['where']['ChatWebsiteId']=_0x12f750['id'];if(_0x5e4a6e[_0xbb10('0x37')][_0xbb10('0x44')]){_0x258e55[_0xbb10('0x41')]=_[_0xbb10('0x42')](_0x258e55[_0xbb10('0x41')],{'$or':_['map'](_0x258e55[_0xbb10('0x39')],function(_0x19fcec){var _0x2c6429={};_0x2c6429[_0x19fcec]={'$like':'%'+_0x5e4a6e[_0xbb10('0x37')][_0xbb10('0x44')]+'%'};return _0x2c6429;})});}_0x258e55=_[_0xbb10('0x42')]({},_0x258e55,_0x5e4a6e[_0xbb10('0x45')]);return db['Disposition'][_0xbb10('0x26')]({'where':_0x258e55[_0xbb10('0x41')]})[_0xbb10('0x15')](function(_0x322b41){_0x2d0f4b[_0xbb10('0x26')]=_0x322b41;if(_0x5e4a6e[_0xbb10('0x37')][_0xbb10('0x46')]){_0x258e55[_0xbb10('0x4b')]=[{'all':!![]}];}return db['Disposition'][_0xbb10('0x47')](_0x258e55);})[_0xbb10('0x15')](function(_0x145baf){_0x2d0f4b['rows']=_0x145baf;return _0x2d0f4b;});}})['then'](respondWithFilteredResult(_0x251417,_0x258e55))['catch'](handleError(_0x251417,null));};exports[_0xbb10('0x5d')]=function(_0x5a3c44,_0x4e3d6a){return db[_0xbb10('0x31')][_0xbb10('0x56')]({'where':{'id':_0x5a3c44[_0xbb10('0x57')]['id']}})[_0xbb10('0x15')](handleEntityNotFound(_0x4e3d6a,null))[_0xbb10('0x15')](function(_0x24dca6){if(_0x24dca6){return _0x24dca6[_0xbb10('0x5d')](_0x5a3c44[_0xbb10('0x37')][_0xbb10('0x5e')]);}})['then'](respondWithStatusCode(_0x4e3d6a,null))[_0xbb10('0x1f')](handleError(_0x4e3d6a,null));};exports[_0xbb10('0x5f')]=function(_0x46b6d2,_0x35b811){if(_0x46b6d2['body']['id']){delete _0x46b6d2['body']['id'];}return db[_0xbb10('0x31')][_0xbb10('0x56')]({'where':{'id':_0x46b6d2[_0xbb10('0x57')]['id']}})[_0xbb10('0x15')](handleEntityNotFound(_0x35b811,null))['then'](function(_0x17d596){if(_0x17d596){_0x46b6d2[_0xbb10('0x4d')][_0xbb10('0x59')]=_0x17d596['id'];return db[_0xbb10('0x60')][_0xbb10('0x4c')](_0x46b6d2['body']);}})['then'](respondWithResult(_0x35b811,null))[_0xbb10('0x1f')](handleError(_0x35b811,null));};exports[_0xbb10('0x61')]=function(_0x22c030,_0x5239da){var _0x256b35={'raw':![],'where':{}};var _0x13e2ab={};var _0x50bcc9={'count':0x0,'rows':[]};return db['ChatWebsite'][_0xbb10('0x5c')]({'where':{'id':_0x22c030[_0xbb10('0x57')]['id']}})[_0xbb10('0x15')](handleEntityNotFound(_0x5239da,null))['then'](function(_0x32d5a5){if(_0x32d5a5){_0x13e2ab[_0xbb10('0x35')]=_[_0xbb10('0x36')](db[_0xbb10('0x60')][_0xbb10('0x32')]);_0x13e2ab[_0xbb10('0x37')]=_[_0xbb10('0x36')](_0x22c030[_0xbb10('0x37')]);_0x13e2ab[_0xbb10('0x38')]=_['intersection'](_0x13e2ab[_0xbb10('0x35')],_0x13e2ab[_0xbb10('0x37')]);_0x256b35[_0xbb10('0x39')]=_[_0xbb10('0x4a')](_0x13e2ab[_0xbb10('0x35')],qs[_0xbb10('0x3a')](_0x22c030[_0xbb10('0x37')][_0xbb10('0x3a')]));_0x256b35[_0xbb10('0x39')]=_0x256b35[_0xbb10('0x39')][_0xbb10('0x3b')]?_0x256b35[_0xbb10('0x39')]:_0x13e2ab['model'];if(!_0x22c030['query'][_0xbb10('0x3c')](_0xbb10('0x3d'))){_0x256b35[_0xbb10('0x27')]=qs[_0xbb10('0x27')](_0x22c030[_0xbb10('0x37')]['limit']);_0x256b35[_0xbb10('0x24')]=qs[_0xbb10('0x24')](_0x22c030[_0xbb10('0x37')][_0xbb10('0x24')]);}_0x256b35[_0xbb10('0x3e')]=qs[_0xbb10('0x3f')](_0x22c030['query'][_0xbb10('0x3f')]);_0x256b35[_0xbb10('0x41')]=qs['filters'](_[_0xbb10('0x40')](_0x22c030['query'],_0x13e2ab[_0xbb10('0x38')]));_0x256b35[_0xbb10('0x41')][_0xbb10('0x59')]=_0x32d5a5['id'];if(_0x22c030[_0xbb10('0x37')][_0xbb10('0x44')]){_0x256b35['where']=_[_0xbb10('0x42')](_0x256b35['where'],{'$or':_[_0xbb10('0x30')](_0x256b35[_0xbb10('0x39')],function(_0x5d767f){var _0x5aaa20={};_0x5aaa20[_0x5d767f]={'$like':'%'+_0x22c030[_0xbb10('0x37')][_0xbb10('0x44')]+'%'};return _0x5aaa20;})});}_0x256b35=_[_0xbb10('0x42')]({},_0x256b35,_0x22c030[_0xbb10('0x45')]);return db[_0xbb10('0x60')][_0xbb10('0x26')]({'where':_0x256b35[_0xbb10('0x41')]})[_0xbb10('0x15')](function(_0x252ab8){_0x50bcc9[_0xbb10('0x26')]=_0x252ab8;if(_0x22c030[_0xbb10('0x37')]['includeAll']){_0x256b35[_0xbb10('0x4b')]=[{'all':!![]}];}return db[_0xbb10('0x60')][_0xbb10('0x47')](_0x256b35);})[_0xbb10('0x15')](function(_0xfe02f5){_0x50bcc9[_0xbb10('0x48')]=_0xfe02f5;return _0x50bcc9;});}})[_0xbb10('0x15')](respondWithFilteredResult(_0x5239da,_0x256b35))[_0xbb10('0x1f')](handleError(_0x5239da,null));};exports[_0xbb10('0x62')]=function(_0x18a136,_0x1c4235){return db[_0xbb10('0x31')]['find']({'where':{'id':_0x18a136[_0xbb10('0x57')]['id']}})['then'](handleEntityNotFound(_0x1c4235,null))[_0xbb10('0x15')](function(_0x3675cd){if(_0x3675cd){return _0x3675cd[_0xbb10('0x62')](_0x18a136[_0xbb10('0x37')][_0xbb10('0x5e')]);}})['then'](respondWithStatusCode(_0x1c4235,null))[_0xbb10('0x1f')](handleError(_0x1c4235,null));};exports[_0xbb10('0x63')]=function(_0x44d1d2,_0x12e89d){_0x44d1d2[_0xbb10('0x4d')][_0xbb10('0x64')]=_0x44d1d2['file']['filename'];return db[_0xbb10('0x31')][_0xbb10('0x56')]({'where':{'id':_0x44d1d2[_0xbb10('0x57')]['id']}})['then'](handleEntityNotFound(_0x12e89d,null))[_0xbb10('0x15')](saveUpdates(_0x44d1d2[_0xbb10('0x4d')],null))['then'](respondWithResult(_0x12e89d,null))[_0xbb10('0x1f')](handleError(_0x12e89d,null));};exports[_0xbb10('0x65')]=function(_0x5642c3,_0xdd3c7e){_0x5642c3['body'][_0xbb10('0x66')]=_0x5642c3[_0xbb10('0x67')]['filename'];return db[_0xbb10('0x31')][_0xbb10('0x56')]({'where':{'id':_0x5642c3['params']['id']}})['then'](handleEntityNotFound(_0xdd3c7e,null))[_0xbb10('0x15')](saveUpdates(_0x5642c3[_0xbb10('0x4d')],null))[_0xbb10('0x15')](respondWithResult(_0xdd3c7e,null))[_0xbb10('0x1f')](handleError(_0xdd3c7e,null));};exports[_0xbb10('0x68')]=function(_0x4c3bdc,_0xe7c0a3){_0x4c3bdc[_0xbb10('0x4d')][_0xbb10('0x69')]=_0x4c3bdc['file'][_0xbb10('0x6a')];return db[_0xbb10('0x31')][_0xbb10('0x56')]({'where':{'id':_0x4c3bdc[_0xbb10('0x57')]['id']}})[_0xbb10('0x15')](handleEntityNotFound(_0xe7c0a3,null))[_0xbb10('0x15')](saveUpdates(_0x4c3bdc[_0xbb10('0x4d')],null))[_0xbb10('0x15')](respondWithResult(_0xe7c0a3,null))[_0xbb10('0x1f')](handleError(_0xe7c0a3,null));};exports['addSystemAvatar']=function(_0x4fc544,_0x37e40c){_0x4fc544[_0xbb10('0x4d')][_0xbb10('0x6b')]=_0x4fc544[_0xbb10('0x67')][_0xbb10('0x6a')];return db[_0xbb10('0x31')][_0xbb10('0x56')]({'where':{'id':_0x4fc544[_0xbb10('0x57')]['id']}})[_0xbb10('0x15')](handleEntityNotFound(_0x37e40c,null))[_0xbb10('0x15')](saveUpdates(_0x4fc544[_0xbb10('0x4d')],null))[_0xbb10('0x15')](respondWithResult(_0x37e40c,null))[_0xbb10('0x1f')](handleError(_0x37e40c,null));};exports['getLogo']=function(_0x1e022d,_0x123587){var _0x24076a=path[_0xbb10('0x6c')](config[_0xbb10('0x6d')],_0xbb10('0x6e'));var _0x4258fc={'where':{'id':_0x1e022d[_0xbb10('0x57')]['id']},'attributes':['id',_0xbb10('0x64')],'raw':!![]};var _0x3c92f4=![];return require(_0xbb10('0x6f'))['getLicense']()[_0xbb10('0x15')](function(_0x5e1ac5){if(_0x5e1ac5){_0x3c92f4=_0x5e1ac5[_0xbb10('0x70')];}})[_0xbb10('0x15')](function(){return db[_0xbb10('0x31')][_0xbb10('0x56')](_0x4258fc);})[_0xbb10('0x15')](handleEntityNotFound(_0x123587,null))[_0xbb10('0x15')](function(_0x4e9cad){if(_0x4e9cad){if(!_[_0xbb10('0x71')](_0x4e9cad['sitepic'])){if(fs[_0xbb10('0x72')](path[_0xbb10('0x6c')](config[_0xbb10('0x6d')],_0xbb10('0x73'),_0x4e9cad[_0xbb10('0x64')]))&&_0x3c92f4){_0x24076a=path[_0xbb10('0x6c')](config[_0xbb10('0x6d')],_0xbb10('0x73'),_0x4e9cad[_0xbb10('0x64')]);}}return _0x123587[_0xbb10('0x74')](_0x24076a);}})[_0xbb10('0x1f')](handleError(_0x123587,null));};exports[_0xbb10('0x75')]=function(_0x589565,_0x3696b3){var _0x516520=path[_0xbb10('0x6c')](config[_0xbb10('0x6d')],_0xbb10('0x76'));var _0x7673a0={'where':{'id':_0x589565[_0xbb10('0x57')]['id']},'attributes':['id',_0xbb10('0x66')],'raw':!![]};return db[_0xbb10('0x31')]['find'](_0x7673a0)[_0xbb10('0x15')](handleEntityNotFound(_0x3696b3,null))['then'](function(_0x51063a){if(_0x51063a){if(!_[_0xbb10('0x71')](_0x51063a[_0xbb10('0x66')])){if(fs[_0xbb10('0x72')](path[_0xbb10('0x6c')](config[_0xbb10('0x6d')],_0xbb10('0x77'),_0x51063a['agentAvatar']))){_0x516520=path[_0xbb10('0x6c')](config[_0xbb10('0x6d')],_0xbb10('0x77'),_0x51063a[_0xbb10('0x66')]);}}return _0x3696b3[_0xbb10('0x74')](_0x516520);}})[_0xbb10('0x1f')](handleError(_0x3696b3,null));};exports['getCustomerAvatar']=function(_0xdfdc42,_0x4093a4){var _0xb7c454=path[_0xbb10('0x6c')](config[_0xbb10('0x6d')],_0xbb10('0x78'));var _0x2764e1={'where':{'id':_0xdfdc42['params']['id']},'attributes':['id',_0xbb10('0x69'),'showCustomerAvatar'],'raw':!![]};return db[_0xbb10('0x31')]['find'](_0x2764e1)['then'](handleEntityNotFound(_0x4093a4,null))[_0xbb10('0x15')](function(_0x225064){if(_0x225064){if(!_[_0xbb10('0x71')](_0x225064[_0xbb10('0x69')])){if(fs[_0xbb10('0x72')](path['join'](config[_0xbb10('0x6d')],'server/files/images/avatars/',_0x225064['customerAvatar']))&&_0x225064['showCustomerAvatar']){_0xb7c454=path[_0xbb10('0x6c')](config[_0xbb10('0x6d')],_0xbb10('0x77'),_0x225064[_0xbb10('0x69')]);}}return _0x4093a4[_0xbb10('0x74')](_0xb7c454);}})['catch'](handleError(_0x4093a4,null));};exports[_0xbb10('0x79')]=function(_0x42a2d7,_0x352de4){var _0x1bd1c1=path[_0xbb10('0x6c')](config[_0xbb10('0x6d')],_0xbb10('0x7a'));var _0x485c1a={'where':{'id':_0x42a2d7['params']['id']},'attributes':['id','systemAvatar'],'raw':!![]};return db[_0xbb10('0x31')][_0xbb10('0x56')](_0x485c1a)[_0xbb10('0x15')](handleEntityNotFound(_0x352de4,null))[_0xbb10('0x15')](function(_0x25cba1){if(_0x25cba1){if(!_[_0xbb10('0x71')](_0x25cba1[_0xbb10('0x6b')])){if(fs[_0xbb10('0x72')](path[_0xbb10('0x6c')](config[_0xbb10('0x6d')],'server/files/images/avatars/',_0x25cba1['systemAvatar']))){_0x1bd1c1=path['join'](config[_0xbb10('0x6d')],_0xbb10('0x77'),_0x25cba1[_0xbb10('0x6b')]);}}return _0x352de4['download'](_0x1bd1c1);}})[_0xbb10('0x1f')](handleError(_0x352de4,null));};exports[_0xbb10('0x7b')]=function(_0x2c638d,_0x290280){var _0x2a6589=require(_0xbb10('0x7c'));var _0x485f46=new _0x2a6589();var _0x57fe03=_0x485f46[_0xbb10('0x7d')](_0x2c638d['headers'][_0xbb10('0x7e')])[_0xbb10('0x7f')]();var _0x152ca9={'body':_0x2c638d[_0xbb10('0x4d')],'channel':_0xbb10('0x80')};var _0x2dfa04=[];var _0x13a29e=[];var _0x1388f6={};var _0xd3c2c8=![];return db[_0xbb10('0x81')]['describe']()[_0xbb10('0x15')](function(_0x5a9277){if(!_0x5a9277){throw new db[(_0xbb10('0x82'))]['ValidationError'](_0xbb10('0x83'));}_0x2dfa04=_[_0xbb10('0x84')](_[_0xbb10('0x36')](_0x5a9277),[_0xbb10('0x85'),'updatedAt']);_0x13a29e=_[_0xbb10('0x84')](_['keys'](_0x5a9277),[_0xbb10('0x85'),_0xbb10('0x86'),_0xbb10('0x87'),'ListId']);if(_0x2c638d[_0xbb10('0x4d')]['id']){delete _0x2c638d[_0xbb10('0x4d')]['id'];}if(_[_0xbb10('0x71')](_0x2c638d[_0xbb10('0x4d')][_0xbb10('0x88')])){throw new db[(_0xbb10('0x82'))]['ValidationError']('from\x20is\x20mandatory');}if(_['isNil'](_0x2c638d[_0xbb10('0x4d')]['body'])||_0x2c638d[_0xbb10('0x4d')]['body']===''){throw new db[(_0xbb10('0x82'))][(_0xbb10('0x89'))](_0xbb10('0x8a'));}if(_['isNil'](_0x2c638d['body'][_0xbb10('0x8b')])){throw new db[(_0xbb10('0x82'))][(_0xbb10('0x89'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x13a29e);}if(!_[_0xbb10('0x8c')](_0x13a29e,_0x2c638d[_0xbb10('0x4d')][_0xbb10('0x8b')])){throw new db['Sequelize']['ValidationError']('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x13a29e);}_0x1388f6[_0x2c638d[_0xbb10('0x4d')]['mapKey']]=_0x2c638d[_0xbb10('0x4d')][_0xbb10('0x88')];})[_0xbb10('0x15')](function(){return db[_0xbb10('0x31')][_0xbb10('0x56')]({'where':{'id':_0x2c638d[_0xbb10('0x57')]['id']},'include':[{'model':db[_0xbb10('0x8d')],'as':_0xbb10('0x8e'),'include':[{'model':db[_0xbb10('0x81')],'as':_0xbb10('0x8f'),'where':_0x1388f6,'limit':0x1,'order':[[_0xbb10('0x86'),'DESC']]}]},{'model':db[_0xbb10('0x90')],'as':_0xbb10('0x91')}]});})['then'](handleEntityNotFound(_0x290280,null))[_0xbb10('0x15')](function(_0x5e3fac){if(_0x5e3fac&&_0x5e3fac['List']){_0x152ca9[_0xbb10('0x92')]=_0x5e3fac;_0x152ca9[_0xbb10('0x93')]=_0x5e3fac[_0xbb10('0x91')];_0x152ca9[_0xbb10('0x94')]=_0x5e3fac[_0xbb10('0x8e')];_0x152ca9['applications']=_[_0xbb10('0x95')](_0x152ca9[_0xbb10('0x93')],['priority'],[_0xbb10('0x96')]);if(_0x152ca9[_0xbb10('0x92')]['Applications']){delete _0x152ca9[_0xbb10('0x92')]['Applications'];}if(_0x152ca9[_0xbb10('0x92')][_0xbb10('0x8e')]&&_0x152ca9[_0xbb10('0x92')][_0xbb10('0x8e')][_0xbb10('0x8f')][_0xbb10('0x3b')]){return _0x152ca9[_0xbb10('0x92')]['List'][_0xbb10('0x8f')][0x0];}var _0x4720a1=_[_0xbb10('0x97')](_0x2c638d[_0xbb10('0x4d')],{'firstName':_0x2c638d[_0xbb10('0x4d')][_0xbb10('0x88')],'ListId':_0x5e3fac['ListId']});_0x4720a1[_0x2c638d['body']['mapKey']]=_0x2c638d[_0xbb10('0x4d')][_0xbb10('0x88')];return db[_0xbb10('0x81')][_0xbb10('0x4c')](_0x4720a1,{'fields':_0x2dfa04,'raw':!![]});}})['then'](handleEntityNotFound(_0x290280,null))[_0xbb10('0x15')](function(_0x3d7b4d){_0x152ca9[_0xbb10('0x98')]=_0x3d7b4d;var _0x577d27=_0x2c638d['body'][_0xbb10('0x99')];if(_0x2c638d['headers'][_0xbb10('0x9a')]){_0x577d27=_0x2c638d[_0xbb10('0x9b')][_0xbb10('0x9a')];}else if(_0x2c638d[_0xbb10('0x9b')][_0xbb10('0x9c')]){_0x577d27=_[_0xbb10('0x9d')](_0x2c638d[_0xbb10('0x9b')]['x-forwarded-for'][_0xbb10('0x9e')](','));}if(_0x3d7b4d){var _0x1eca6c={'ContactId':_0x3d7b4d['id'],'ChatWebsiteId':_0x2c638d['params']['id'],'from':(_0x3d7b4d[_0xbb10('0x9f')]||'')+'\x20'+(_0x3d7b4d[_0xbb10('0xa0')]||''),'customerIp':_0x577d27,'customerPort':_0x2c638d[_0xbb10('0x9b')]['x-real-port']?_0x2c638d['headers']['x-real-port']:null,'referer':_0x2c638d[_0xbb10('0x4d')][_0xbb10('0xa1')],'browserName':_0x57fe03['browser'][_0xbb10('0x2e')]&&_0x57fe03[_0xbb10('0xa2')][_0xbb10('0xa3')]?util[_0xbb10('0xa4')](_0xbb10('0xa5'),_0x57fe03[_0xbb10('0xa2')][_0xbb10('0x2e')],_0x57fe03['browser'][_0xbb10('0xa3')]):'unknown','browserVersion':_0x57fe03['browser']['version']||_0xbb10('0xa6'),'osName':util[_0xbb10('0xa4')]('%s\x20%s',_0x57fe03['os'][_0xbb10('0x2e')],_0x57fe03['os']['version']),'osVersion':_0x57fe03['os'][_0xbb10('0xa3')],'deviceModel':_0x57fe03[_0xbb10('0xa7')][_0xbb10('0x35')]&&_0x57fe03['device']['vendor']?util[_0xbb10('0xa4')]('%s\x20%s\x20%s',_0x57fe03[_0xbb10('0xa7')][_0xbb10('0x35')],_0x57fe03['device']['vendor'],_0x57fe03[_0xbb10('0xa7')][_0xbb10('0x43')]):null,'deviceVendor':_0x57fe03[_0xbb10('0xa7')]['vendor'],'deviceType':_0x57fe03[_0xbb10('0xa7')][_0xbb10('0x43')],'formData':JSON[_0xbb10('0x1b')](_0x2c638d['body'])};var _0x414066={'ChatWebsiteId':_0x2c638d[_0xbb10('0x57')]['id'],'closed':![]};if(_0x2c638d[_0xbb10('0x4d')][_0xbb10('0xa8')]){_0x414066[_0xbb10('0xa8')]=_0x2c638d[_0xbb10('0x4d')][_0xbb10('0xa8')];return db[_0xbb10('0xa9')][_0xbb10('0x56')]({'where':_0x414066})[_0xbb10('0x15')](function(_0x10ca4a){if(_0x10ca4a){return[_0x10ca4a,![]];}_0x1eca6c[_0xbb10('0xa8')]=_0x2c638d[_0xbb10('0x4d')]['threadId'];_0x1eca6c['externalUrl']=_0x2c638d[_0xbb10('0x4d')]['externalUrl'];return db[_0xbb10('0xa9')][_0xbb10('0x4c')](_0x1eca6c)[_0xbb10('0x15')](function(_0x4e5236){return[_0x4e5236,!![]];});});}_0x414066[_0xbb10('0xaa')]=_0x3d7b4d['id'];if(_0x2c638d[_0xbb10('0x4d')][_0xbb10('0xab')]&&_0x2c638d[_0xbb10('0x4d')][_0xbb10('0xab')]['id']){_0x414066['id']=_0x2c638d['body'][_0xbb10('0xab')]['id'];return db[_0xbb10('0xa9')][_0xbb10('0x56')]({'where':_0x414066})[_0xbb10('0x15')](function(_0x150d4c){if(_0x150d4c){return[_0x150d4c,![]];}return db[_0xbb10('0xa9')]['create'](_0x1eca6c)[_0xbb10('0x15')](function(_0x2f0262){return[_0x2f0262,!![]];});});}return db['ChatInteraction'][_0xbb10('0x4c')](_0x1eca6c)[_0xbb10('0x15')](function(_0x2d0de5){return[_0x2d0de5,!![]];});}})[_0xbb10('0xac')](function(_0x3abc15,_0x43df3c){if(_0x3abc15){_0xd3c2c8=_0x43df3c;if(!_0x43df3c){var _0x45593c={'from':(_0x152ca9[_0xbb10('0x98')][_0xbb10('0x9f')]||'')+'\x20'+(_0x152ca9[_0xbb10('0x98')][_0xbb10('0xa0')]||'')};if(_0x2c638d[_0xbb10('0x4d')][_0xbb10('0xa8')]&&_0x2c638d[_0xbb10('0x4d')][_0xbb10('0xad')]&&_0x2c638d['body'][_0xbb10('0xa8')]!=_0x2c638d[_0xbb10('0x4d')]['messageId']){_0x45593c['threadId']=_0x2c638d[_0xbb10('0x4d')][_0xbb10('0xad')];}return _0x3abc15[_0xbb10('0x55')](_0x45593c);}else{return _0x3abc15;}}})[_0xbb10('0x15')](function(_0x27fb82){_0x152ca9[_0xbb10('0xab')]=_0x27fb82[_0xbb10('0x2b')]({'plain':!![]});_0x152ca9[_0xbb10('0xab')][_0xbb10('0xae')]=_0xd3c2c8;if(_0x152ca9['interaction']['created']){if(_0x152ca9['account']['autoclose']){_0x152ca9['applications']['push']({'id':0x0,'priority':_0x152ca9[_0xbb10('0x93')][_0xbb10('0x3b')]+0x1,'app':_0xbb10('0xaf'),'appdata':_0xbb10('0xb0'),'interval':'*,*,*,*'});}}return db[_0xbb10('0xb1')][_0xbb10('0x4c')]({'body':_0x2c638d[_0xbb10('0x4d')][_0xbb10('0x4d')],'ChatWebsiteId':_0x2c638d['params']['id'],'ChatInteractionId':_0x27fb82['id'],'direction':'in','ContactId':_0x152ca9['contact']['id'],'AttachmentId':_0x2c638d[_0xbb10('0x4d')][_0xbb10('0xb2')]});})['then'](function(_0x581832){_0x152ca9[_0xbb10('0x1e')]=_0x581832;if(_0x152ca9[_0xbb10('0xab')][_0xbb10('0xb3')]){return db[_0xbb10('0xb4')][_0xbb10('0x56')]({'attributes':['id','name'],'where':{'id':_0x152ca9[_0xbb10('0xab')]['UserId']}})['then'](function(_0x9d96e2){if(_0x9d96e2){_0x152ca9[_0xbb10('0x93')][_0xbb10('0xb5')]({'id':0x0,'priority':0x0,'app':_0xbb10('0xb6'),'appdata':_0x9d96e2[_0xbb10('0x2e')]+','+(_0x152ca9[_0xbb10('0x92')]['waitForTheAssignedAgent']||0xa),'interval':_0xbb10('0xb7')});_0x152ca9[_0xbb10('0xb8')]=!![];}return respondWithRpcPromise(_0xbb10('0xb9'),_0xbb10('0xba'),_0x152ca9);});}return respondWithRpcPromise(_0xbb10('0xb9'),_0xbb10('0xba'),_0x152ca9);})[_0xbb10('0x15')](function(_0xce60f4){respondWithRpcPromise(_0xbb10('0xbb'),_0xbb10('0xbb'),{'event':_0xbb10('0x7b'),'message':_0xce60f4},client9002);return _0xce60f4;})[_0xbb10('0x15')](respondWithResult(_0x290280,null))[_0xbb10('0x1f')](handleError(_0x290280,null));};exports[_0xbb10('0xbc')]=function(_0x45b31c,_0x3cf074){var _0x232a1b,_0xbdc520,_0x246ee3;var _0x43a203=[];var _0x1ca43e={};var _0x1f84b0=_0x45b31c['files']||[];var _0x2158e2=[];var _0x47883f;return db[_0xbb10('0x81')][_0xbb10('0xbd')]()[_0xbb10('0x15')](function(_0x2b1f0f){if(!_0x2b1f0f){throw new db[(_0xbb10('0x82'))]['ValidationError']('no\x20available\x20attributes');}_0x43a203=_['difference'](_[_0xbb10('0x36')](_0x2b1f0f),[_0xbb10('0x85'),'updatedAt',_0xbb10('0x87'),_0xbb10('0xbe')]);if(_0x45b31c[_0xbb10('0x4d')]['id']){delete _0x45b31c['body']['id'];}if(_[_0xbb10('0x71')](_0x45b31c[_0xbb10('0x4d')][_0xbb10('0x88')])){throw _0x3cf074['status'](0x1f4)[_0xbb10('0xbf')](new db['Sequelize'][(_0xbb10('0x89'))]('from\x20is\x20mandatory'));}if(_['isNil'](_0x45b31c['body']['body'])||_0x45b31c['body']['body']===''){throw _0x3cf074[_0xbb10('0x21')](0x1f4)[_0xbb10('0xbf')](new db[(_0xbb10('0x82'))][(_0xbb10('0x89'))]('body\x20is\x20mandatory\x20and\x20not\x20empty'));}if(_[_0xbb10('0x71')](_0x45b31c[_0xbb10('0x4d')][_0xbb10('0xc0')])){throw _0x3cf074[_0xbb10('0x21')](0x1f4)[_0xbb10('0xbf')](new db[(_0xbb10('0x82'))][(_0xbb10('0x89'))](_0xbb10('0xc1')+_0x43a203));}if(!_[_0xbb10('0x8c')](_0x43a203,_0x45b31c[_0xbb10('0x4d')]['mapKeyOffline'])){throw _0x3cf074[_0xbb10('0x21')](0x1f4)[_0xbb10('0xbf')](new db[(_0xbb10('0x82'))]['ValidationError'](_0xbb10('0xc2')+_0x43a203));}_0x1ca43e[_0x45b31c[_0xbb10('0x4d')][_0xbb10('0xc0')]]=_0x45b31c[_0xbb10('0x4d')]['from'];})[_0xbb10('0x15')](function(){return db[_0xbb10('0x31')][_0xbb10('0x56')]({'where':{'id':_0x45b31c[_0xbb10('0x57')]['id']},'include':[{'model':db[_0xbb10('0x8d')],'as':_0xbb10('0x8e')},{'model':db[_0xbb10('0xc3')],'as':_0xbb10('0xc3')}]});})[_0xbb10('0x15')](handleEntityNotFound(_0x3cf074,null))[_0xbb10('0x15')](function(_0x3c01ff){if(_0x3c01ff&&_0x3c01ff['List']){_0xbdc520=_0x3c01ff;var _0x59d917=_[_0xbb10('0x97')](_0x45b31c['body'],{'firstName':_0x45b31c['body'][_0xbb10('0x88')],'phone':_0x45b31c[_0xbb10('0x4d')]['from'],'ListId':_0x3c01ff[_0xbb10('0xbe')]});_0x59d917[_0x45b31c[_0xbb10('0x4d')]['mapKeyOffline']]=_0x45b31c[_0xbb10('0x4d')][_0xbb10('0x88')];return db[_0xbb10('0x81')][_0xbb10('0xc4')]({'where':_0x1ca43e,'defaults':_0x59d917});}})[_0xbb10('0xac')](function(_0x4d2c76){if(_0x4d2c76){_0x246ee3=_0x4d2c76;var _0x4fc260=fs['readFileSync'](path[_0xbb10('0x6c')](config['root'],_0xbb10('0xc5')),'utf8');var _0x510467=ejs[_0xbb10('0xc6')](_0x4fc260,{'body':_[_0xbb10('0xc7')](_0x45b31c[_0xbb10('0x4d')][_0xbb10('0x4d')]),'bodyTitle':_0xbdc520[_0xbb10('0xc8')]});return db[_0xbb10('0xc9')]['create']({'body':_0x510467,'plainBody':htmlToText['fromString'](_0x510467),'ContactId':_0x4d2c76['id'],'ChatWebsiteId':_0xbdc520['id']});}})['then'](function(_0x5ad067){_0x47883f=_0x5ad067;if(_0x1f84b0[_0xbb10('0x3b')]){var _0x18632f=_0x1f84b0[_0xbb10('0x30')](function(_0x26bc1c){return{'name':_0x26bc1c[_0xbb10('0xca')],'basename':_0x26bc1c[_0xbb10('0x6a')],'type':_0x26bc1c['mimetype'],'ChatOfflineMessageId':_0x5ad067['id']};});_0x2158e2=_0x18632f[_0xbb10('0x30')](_0x207bbb=>{var _0x35586a={'filename':_0x207bbb[_0xbb10('0x2e')],'path':path['join'](config[_0xbb10('0x6d')],'server','files',_0xbb10('0xcb'),_0xbb10('0xcc'),_0x207bbb[_0xbb10('0xcd')])};return _0x35586a;});if(!_0xbdc520[_0xbb10('0xce')]){return db[_0xbb10('0xcf')][_0xbb10('0xd0')](function(_0x4b7bf8){return db[_0xbb10('0xd1')][_0xbb10('0xd2')](_0x18632f,{'transaction':_0x4b7bf8});});}}})[_0xbb10('0x15')](function(){if(_0x47883f){_0x232a1b=_0x47883f;return db[_0xbb10('0xc3')][_0xbb10('0x5c')]({'where':{'active':!![]},'include':[{'model':db[_0xbb10('0xd3')],'as':_0xbb10('0xd4'),'raw':!![]}]});}})['then'](function(_0x2cbbb6){if(_0x2cbbb6&&_0x2cbbb6[_0xbb10('0xd4')]&&_0xbdc520[_0xbb10('0xd5')]&&_0xbdc520['forwardOfflineAddress']){var _0x595664={'tls':{'rejectUnauthorized':![]}};if(_0x2cbbb6[_0xbb10('0xd4')][_0xbb10('0xd6')]){_0x595664[_0xbb10('0xd6')]=_0x2cbbb6[_0xbb10('0xd4')][_0xbb10('0xd6')];}else{_0x595664[_0xbb10('0xd7')]=_0x2cbbb6[_0xbb10('0xd4')]['host'];_0x595664[_0xbb10('0xd8')]=_0x2cbbb6[_0xbb10('0xd4')][_0xbb10('0xd8')];_0x595664['secure']=_0x2cbbb6['Smtp']['secure'];}if(_0x2cbbb6['Smtp'][_0xbb10('0xd9')]){_0x595664[_0xbb10('0xda')]={'user':_0x2cbbb6[_0xbb10('0xd4')][_0xbb10('0x4e')],'pass':_0x2cbbb6['Smtp'][_0xbb10('0xdb')]};}return respondWithRpcPromise('SendMail',_0xbb10('0xdc'),{'account':_0x595664,'message':{'from':util[_0xbb10('0xa4')](_0xbb10('0xdd'),_0x2cbbb6[_0xbb10('0x2e')],_0x2cbbb6[_0xbb10('0xde')]||_0x2cbbb6[_0xbb10('0xd4')][_0xbb10('0x4e')]),'to':_0xbdc520[_0xbb10('0xdf')],'subject':_0xbdc520[_0xbb10('0xe0')],'html':_0x232a1b[_0xbb10('0x4d')],'attachments':_0x2158e2}},client9003)[_0xbb10('0x15')](function(){return _0x232a1b;})[_0xbb10('0x1f')](function(_0x4c969d){console[_0xbb10('0x1c')](_0x4c969d);});}})[_0xbb10('0x15')](function(){if(_0xbdc520&&_0xbdc520[_0xbb10('0xce')]&&_0xbdc520['MailAccountId']){var _0x204ebf=[];if(_0x1f84b0['length']){_0x204ebf=_0x1f84b0[_0xbb10('0x30')](function(_0x446bcf){return{'name':_0x446bcf[_0xbb10('0xca')],'basename':_0x446bcf[_0xbb10('0x6a')],'type':_0x446bcf[_0xbb10('0xe1')],'ChatOfflineMessageId':_0x47883f['id']};});}var _0x533327;if(!_['isNil'](_0xbdc520[_0xbb10('0xe2')])){var _0x4cf5cc=_['map'](_0x45b31c[_0xbb10('0x4d')],function(_0x5621b1){return _0x5621b1;});var _0xa9ed32=_[_0xbb10('0xe3')](_0x4cf5cc)[0x0];var _0x3f0a4e=_[_0xbb10('0xe4')](_0xa9ed32,function(_0x309b4a){return _0x309b4a;});_0x533327=_0x3f0a4e[0x1][_0xbdc520[_0xbb10('0xe2')]];}var _0x3a0940={'from':_0x246ee3[_0xbb10('0xde')],'firstName':_0x246ee3['firstName'],'lastName':_0x246ee3[_0xbb10('0xa0')],'mapKey':'email','message':{'from':_0x246ee3[_0xbb10('0xde')],'to':_0xbdc520['MailAccount'][_0xbb10('0xde')],'cc':'','subject':_[_0xbb10('0x71')](_0x533327)?_0xbdc520['offlineMessageSubject']:_0x533327,'messageId':'','sentAt':new Date(),'attach':_0x204ebf[_0xbb10('0x3b')],'attachments':_0x204ebf,'originChannel':_0xbb10('0xe5'),'ChatWebsiteId':_0xbdc520['id'],'ChatOfflineMessageId':_0x232a1b['id'],'originTo':_0xbdc520[_0xbb10('0xc3')]['email']},'body':_0x232a1b[_0xbb10('0x4d')]};var _0x1a8503={'account':{'id':_0xbdc520[_0xbb10('0xe6')]},'body':_0x3a0940,'log':'NotifyMailAccount'};return respondWithRpcPromise(_0xbb10('0xe7'),_0xbb10('0xe8'),_0x1a8503,client9001)[_0xbb10('0x15')](function(){return _0x232a1b;})['catch'](function(_0x3e6756){console['error'](_0x3e6756);});}return;})[_0xbb10('0x15')](function(){if(_0x232a1b){return _0x232a1b;}})[_0xbb10('0x15')](respondWithResult(_0x3cf074,null))[_0xbb10('0x1f')](function(_0xd94118){console[_0xbb10('0x1c')](_0xbb10('0x1f'),_0xd94118);for(var _0x23e592 of _0x1f84b0){var _0x44d28a=path[_0xbb10('0x6c')](config[_0xbb10('0x6d')],'server','files',_0xbb10('0xcb'),_0xbb10('0xcc'),_0x23e592[_0xbb10('0x6a')]);fs_extra['remove'](_0x44d28a)[_0xbb10('0x1f')](function(_0x1067f2){console[_0xbb10('0x1c')](_0xbb10('0xe9'),_0x44d28a,_0x1067f2);});}});};exports[_0xbb10('0xea')]=function(_0x431673,_0x81d970){return db[_0xbb10('0xa9')][_0xbb10('0x56')]({'where':{'id':_0x431673['params']['id']}})[_0xbb10('0x15')](handleEntityNotFound(_0x81d970,null))[_0xbb10('0x15')](function(_0x4102af){if(_0x4102af){return _0x4102af[_0xbb10('0xea')](_0x431673['body'][_0xbb10('0x5e')],_[_0xbb10('0xeb')](_0x431673[_0xbb10('0x4d')],['ids','id'])||{});}})['then'](respondWithResult(_0x81d970,null))[_0xbb10('0x1f')](handleError(_0x81d970,null));};exports['getInteractions']=function(_0x37c688,_0x4874be){var _0x3fd69e={'raw':![],'where':{}};var _0x1aa860={};var _0x28cd8e={'count':0x0,'rows':[]};return db[_0xbb10('0x31')][_0xbb10('0x5c')]({'where':{'id':_0x37c688[_0xbb10('0x57')]['id']}})[_0xbb10('0x15')](handleEntityNotFound(_0x4874be,null))['then'](function(_0x20c514){if(_0x20c514){_0x1aa860[_0xbb10('0x35')]=_[_0xbb10('0x36')](db[_0xbb10('0xa9')][_0xbb10('0x32')]);_0x1aa860[_0xbb10('0x37')]=_['keys'](_0x37c688[_0xbb10('0x37')]);_0x1aa860[_0xbb10('0x38')]=_[_0xbb10('0x4a')](_0x1aa860[_0xbb10('0x35')],_0x1aa860[_0xbb10('0x37')]);_0x3fd69e[_0xbb10('0x39')]=_[_0xbb10('0x4a')](_0x1aa860['model'],qs[_0xbb10('0x3a')](_0x37c688[_0xbb10('0x37')][_0xbb10('0x3a')]));_0x3fd69e['attributes']=_0x3fd69e[_0xbb10('0x39')]['length']?_0x3fd69e[_0xbb10('0x39')]:_0x1aa860[_0xbb10('0x35')];if(!_0x37c688[_0xbb10('0x37')]['hasOwnProperty']('nolimit')){_0x3fd69e[_0xbb10('0x27')]=qs[_0xbb10('0x27')](_0x37c688[_0xbb10('0x37')][_0xbb10('0x27')]);_0x3fd69e[_0xbb10('0x24')]=qs[_0xbb10('0x24')](_0x37c688[_0xbb10('0x37')][_0xbb10('0x24')]);}_0x3fd69e[_0xbb10('0x3e')]=qs[_0xbb10('0x3f')](_0x37c688[_0xbb10('0x37')]['sort']);_0x3fd69e['where']=qs[_0xbb10('0x38')](_[_0xbb10('0x40')](_0x37c688['query'],_0x1aa860['filters']));_0x3fd69e[_0xbb10('0x41')][_0xbb10('0x59')]=_0x20c514['id'];if(_0x37c688[_0xbb10('0x37')]['filter']){_0x3fd69e[_0xbb10('0x41')]=_[_0xbb10('0x42')](_0x3fd69e['where'],{'$or':_[_0xbb10('0x30')](_0x3fd69e[_0xbb10('0x39')],function(_0x544c9c){var _0x5a5349={};_0x5a5349[_0x544c9c]={'$like':'%'+_0x37c688[_0xbb10('0x37')][_0xbb10('0x44')]+'%'};return _0x5a5349;})});}_0x3fd69e=_[_0xbb10('0x42')]({},_0x3fd69e,_0x37c688['options']);return db['ChatInteraction'][_0xbb10('0x26')]({'where':_0x3fd69e[_0xbb10('0x41')]})['then'](function(_0x1e9dd2){_0x28cd8e[_0xbb10('0x26')]=_0x1e9dd2;if(_0x37c688['query'][_0xbb10('0x46')]){_0x3fd69e[_0xbb10('0x4b')]=[{'model':db[_0xbb10('0x81')],'as':_0xbb10('0xec'),'required':![]},{'model':db['User'],'as':_0xbb10('0xed'),'attributes':['name',_0xbb10('0xee'),_0xbb10('0xef')],'required':![]},{'model':db[_0xbb10('0xf0')],'as':_0xbb10('0xf1'),'attributes':['id',_0xbb10('0x2e'),_0xbb10('0xf2')],'where':_0x37c688[_0xbb10('0x37')][_0xbb10('0xf3')]?{'id':_0x37c688['query'][_0xbb10('0xf3')]}:undefined,'required':_0x37c688[_0xbb10('0x37')][_0xbb10('0xf3')]?!![]:![]}];}return db[_0xbb10('0xa9')]['findAll'](_0x3fd69e);})['then'](function(_0xd23108){_0x28cd8e[_0xbb10('0x48')]=_0xd23108;return _0x28cd8e;});}})[_0xbb10('0x15')](respondWithFilteredResult(_0x4874be,_0x3fd69e))[_0xbb10('0x1f')](handleError(_0x4874be,null));};function iftimePromise(_0x5b2e0b,_0x215028){return respondWithRpcPromise(_0xbb10('0xf4'),'getSnippet',{'command':_0x215028[_0xbb10('0xf5')]?util['format']('iftime\x20%s,%s',_0x5b2e0b[_0xbb10('0xf6')],_0x215028[_0xbb10('0xf5')]):util[_0xbb10('0xa4')](_0xbb10('0xf7'),_0x5b2e0b[_0xbb10('0xf6')])},client9002)['then'](function(_0x38403e){var _0x262078=_0x38403e&&_0x38403e[_0xbb10('0xf8')](_0xbb10('0xf9'))>=0x0?!![]:![];logger[_0xbb10('0x16')](_0xbb10('0xfa'),_0x215028['id'],_0x5b2e0b['id'],_0x5b2e0b[_0xbb10('0xf6')],_0x262078?_0xbb10('0xfb'):_0xbb10('0xfc'),_0x215028[_0xbb10('0xf5')]?_0x215028[_0xbb10('0xf5')]:_0xbb10('0xfd'));return _0x262078;})[_0xbb10('0x1f')](function(_0x9fcc26){logger[_0xbb10('0x1c')](_0xbb10('0xfa'),_0x215028['id'],_0x5b2e0b['id'],_0x5b2e0b[_0xbb10('0xf6')],util[_0xbb10('0xfe')](_0x9fcc26,{'showHidden':![],'depth':null}),_0x215028[_0xbb10('0xf5')]?_0x215028[_0xbb10('0xf5')]:_0xbb10('0xfd'));return![];});}exports[_0xbb10('0xff')]=function(_0x1b4873,_0x1ca72c){var _0x36615e=0x0;var _0x2f38d3=0x0;var _0x5a4d21=![];var _0x57b891;var _0x19eaa2;return db[_0xbb10('0x31')]['find']({'where':{'id':_0x1b4873[_0xbb10('0x57')]['id']},'include':[{'model':db[_0xbb10('0x100')],'as':'Interval','include':[{'model':db[_0xbb10('0x100')],'as':_0xbb10('0x101'),'attributes':['id','interval'],'raw':!![]}]}]})[_0xbb10('0x15')](handleEntityNotFound(_0x1ca72c,null))[_0xbb10('0x15')](function(_0xb4fdea){if(_0xb4fdea){_0x57b891=_0xb4fdea;return _0xb4fdea[_0xbb10('0x102')]({'raw':!![]});}})['then'](function(_0x170061){if(_0x57b891){if(_0x170061){_0x19eaa2=_0x170061;}}return require(_0xbb10('0x6f'))[_0xbb10('0x103')]();})[_0xbb10('0x15')](function(_0x5c0732){if(_0x5c0732){_0x2f38d3=_0x5c0732[_0xbb10('0x104')];_0x5a4d21=_0x5c0732[_0xbb10('0x70')];}})[_0xbb10('0x15')](function(){return db[_0xbb10('0xa9')][_0xbb10('0x26')]({'where':{'closed':![]}});})[_0xbb10('0x15')](function(_0x2f626b){_0x36615e=_0x2f626b;if(_0x2f38d3&&_0x2f626b>_0x2f38d3){return db[_0xbb10('0x105')][_0xbb10('0x5c')]({'where':{'id':0x1}})[_0xbb10('0x15')](function(_0x2fd942){if(_0x2fd942){_0x2fd942['increment'](_0xbb10('0x106'));}});}})[_0xbb10('0x15')](function(){if(_0x57b891[_0xbb10('0x100')]&&_0x57b891[_0xbb10('0x100')]['Intervals']){var _0x5116d8=[];for(var _0x8bfc0f=0x0;_0x8bfc0f<_0x57b891[_0xbb10('0x100')][_0xbb10('0x101')][_0xbb10('0x3b')];_0x8bfc0f++){var _0x5f0576=_0x57b891[_0xbb10('0x100')][_0xbb10('0x101')][_0x8bfc0f][_0xbb10('0x2b')]({'plain':!![]});_0x5116d8['push'](iftimePromise(_0x5f0576,_0x57b891));}return BPromise['all'](_0x5116d8)[_0xbb10('0x15')](function(_0xd6b33){return _['some'](_0xd6b33);});}else{return!![];}})['then'](function(_0x424bb1){var _0x615606=fs[_0xbb10('0x107')](path[_0xbb10('0x6c')](config[_0xbb10('0x6d')],_0xbb10('0x108')),'utf8');var _0x408544={'remote':_0x57b891[_0xbb10('0x109')],'query':querystring[_0xbb10('0x1b')](_[_0xbb10('0x42')](_0x57b891[_0xbb10('0x2b')]({'plain':!![]}),{'customerIp':_0x1b4873[_0xbb10('0x9b')][_0xbb10('0x9c')]||_0x1b4873[_0xbb10('0x9b')][_0xbb10('0x10a')]||_0x1b4873[_0xbb10('0x10b')]['remoteAddress']||_0x1b4873['ip'],'referer':_0x1b4873[_0xbb10('0x9b')][_0xbb10('0xa1')],'openedInteractions':_0x36615e,'maxInteractions':_0x2f38d3,'virtual':_0x5a4d21['virtual'],'online':_0x424bb1,'custom':_0x5a4d21}))['replace'](/'/g,'\x5c\x27')};_0x1ca72c['send'](ejs['render'](Mustache['render'](_0x615606,_0x408544),{'proactiveActions':_0x19eaa2,'alignment':_0x57b891['alignment'],'verticalAlignment':_0x57b891['verticalAlignment'],'div_color':_0x57b891['color'],'labelText':_0x57b891[_0xbb10('0x10c')],'text_color':_0x57b891[_0xbb10('0x10d')],'button_color':_0x57b891['color_button'],'background_color':_0x57b891[_0xbb10('0x10e')]}));})[_0xbb10('0x1f')](handleError(_0x1ca72c,null));};exports[_0xbb10('0x10f')]=function(_0x3b9bec,_0x1d099a){var _0x1d36fa=_0x3b9bec[_0xbb10('0x57')]['id'];var _0x23179d=_0x3b9bec[_0xbb10('0x4d')];var _0x14d9e7=0xc8;var _0x19dfef=null;return db[_0xbb10('0xcf')]['transaction']({'isolationLevel':db[_0xbb10('0xcf')][_0xbb10('0x110')][_0xbb10('0x111')][_0xbb10('0x112')]},function(_0x155f92){return db['ChatWebsite'][_0xbb10('0x5c')]({'where':{'id':_0x1d36fa},'transaction':_0x155f92})['then'](function(_0x52209c){if(_0x52209c){return db[_0xbb10('0x90')][_0xbb10('0x2a')]({'where':{'ChatWebsiteId':_0x1d36fa},'transaction':_0x155f92})['then'](function(){var _0x3e433b=_[_0xbb10('0x30')](_0x23179d,function(_0x201e05){_0x201e05[_0xbb10('0x59')]=_0x1d36fa;return _0x201e05;});return db[_0xbb10('0x90')]['bulkCreate'](_0x3e433b,{'transaction':_0x155f92});});}else{_0x14d9e7=0x194;_0x19dfef=[];}});})['then'](function(){if(_0x14d9e7!==0x194){return db[_0xbb10('0x90')][_0xbb10('0x113')]({'where':{'ChatWebsiteId':_0x1d36fa},'order':'priority'})[_0xbb10('0x15')](function(_0x4cf976){_0x19dfef=_0x4cf976;});}})[_0xbb10('0x1f')](function(_0x1a2f42){_0x14d9e7=0x1f4;logger[_0xbb10('0x1c')](_0x1a2f42[_0xbb10('0x2d')]);if(_0x1a2f42[_0xbb10('0x2e')]){delete _0x1a2f42[_0xbb10('0x2e')];}_0x19dfef=_0x1a2f42;})[_0xbb10('0x114')](function(){if(_0x19dfef===null){_0x1d099a['sendStatus'](_0x14d9e7);}else{if(_0x14d9e7===0x1f4){_0x1d099a[_0xbb10('0x21')](_0x14d9e7)[_0xbb10('0xbf')](_0x19dfef);}else{_0x1d099a[_0xbb10('0x21')](_0x14d9e7)[_0xbb10('0x23')](_0x19dfef);}}});};exports['getApplications']=function(_0x20347b,_0x22ffc6){var _0x530785={};var _0x49ef50={};var _0xeac82d;var _0x5a4de3;return db[_0xbb10('0x31')][_0xbb10('0x5c')]({'where':{'id':_0x20347b[_0xbb10('0x57')]['id']}})[_0xbb10('0x15')](handleEntityNotFound(_0x22ffc6,null))['then'](function(_0x90ab9f){if(_0x90ab9f){_0xeac82d=_0x90ab9f;_0x49ef50['model']=_[_0xbb10('0x36')](db[_0xbb10('0x90')][_0xbb10('0x32')]);_0x49ef50[_0xbb10('0x37')]=_[_0xbb10('0x36')](_0x20347b[_0xbb10('0x37')]);_0x49ef50[_0xbb10('0x38')]=_[_0xbb10('0x4a')](_0x49ef50[_0xbb10('0x35')],_0x49ef50['query']);_0x530785[_0xbb10('0x39')]=_[_0xbb10('0x4a')](_0x49ef50[_0xbb10('0x35')],qs[_0xbb10('0x3a')](_0x20347b[_0xbb10('0x37')]['fields']));_0x530785[_0xbb10('0x39')]=_0x530785[_0xbb10('0x39')][_0xbb10('0x3b')]?_0x530785[_0xbb10('0x39')]:_0x49ef50[_0xbb10('0x35')];_0x530785['order']=qs['sort'](_0x20347b['query'][_0xbb10('0x3f')]);_0x530785['where']=qs['filters'](_[_0xbb10('0x40')](_0x20347b['query'],_0x49ef50[_0xbb10('0x38')]));if(_0x20347b[_0xbb10('0x37')]['filter']){_0x530785[_0xbb10('0x41')]=_[_0xbb10('0x42')](_0x530785[_0xbb10('0x41')],{'$or':_[_0xbb10('0x30')](_0x530785['attributes'],function(_0x4b08b2){var _0x57abfe={};_0x57abfe[_0x4b08b2]={'$like':'%'+_0x20347b[_0xbb10('0x37')][_0xbb10('0x44')]+'%'};return _0x57abfe;})});}_0x530785=_['merge']({},_0x530785,_0x20347b[_0xbb10('0x45')]);return _0xeac82d[_0xbb10('0x115')](_0x530785);}})[_0xbb10('0x15')](function(_0x33a92a){if(_0x33a92a){_0x5a4de3=_0x33a92a[_0xbb10('0x3b')];if(!_0x20347b['query'][_0xbb10('0x3c')](_0xbb10('0x3d'))){_0x530785[_0xbb10('0x27')]=qs['limit'](_0x20347b[_0xbb10('0x37')]['limit']);_0x530785[_0xbb10('0x24')]=qs[_0xbb10('0x24')](_0x20347b[_0xbb10('0x37')]['offset']);}return _0xeac82d[_0xbb10('0x115')](_0x530785);}})[_0xbb10('0x15')](function(_0x4ba58f){if(_0x4ba58f){return _0x4ba58f?{'count':_0x5a4de3,'rows':_0x4ba58f}:null;}})[_0xbb10('0x15')](respondWithResult(_0x22ffc6,null))[_0xbb10('0x1f')](handleError(_0x22ffc6,null));};exports[_0xbb10('0x116')]=function(_0x2e03eb,_0x24e7bc){return db['chatProactiveAction']['find']({'where':{'id':_0x2e03eb[_0xbb10('0x57')]['id']}})[_0xbb10('0x15')](handleEntityNotFound(_0x24e7bc,null))[_0xbb10('0x15')](function(_0x1b0734){if(_0x1b0734){return _0x1b0734[_0xbb10('0x116')](_0x2e03eb['body'][_0xbb10('0x5e')],_[_0xbb10('0xeb')](_0x2e03eb[_0xbb10('0x4d')],[_0xbb10('0x5e'),'id'])||{});}})[_0xbb10('0x15')](respondWithResult(_0x24e7bc,null))['catch'](handleError(_0x24e7bc,null));};exports['getProactiveActions']=function(_0x2f675c,_0x18f6b1){var _0x1052f5={};var _0x119e8f={};var _0x5a031b;var _0x4c8e28;return db[_0xbb10('0x31')]['findOne']({'where':{'id':_0x2f675c['params']['id']}})['then'](handleEntityNotFound(_0x18f6b1,null))['then'](function(_0x3758dd){if(_0x3758dd){_0x5a031b=_0x3758dd;_0x119e8f[_0xbb10('0x35')]=_[_0xbb10('0x36')](db[_0xbb10('0x117')][_0xbb10('0x32')]);_0x119e8f['query']=_[_0xbb10('0x36')](_0x2f675c[_0xbb10('0x37')]);_0x119e8f[_0xbb10('0x38')]=_['intersection'](_0x119e8f[_0xbb10('0x35')],_0x119e8f[_0xbb10('0x37')]);_0x1052f5[_0xbb10('0x39')]=_[_0xbb10('0x4a')](_0x119e8f[_0xbb10('0x35')],qs[_0xbb10('0x3a')](_0x2f675c[_0xbb10('0x37')][_0xbb10('0x3a')]));_0x1052f5[_0xbb10('0x39')]=_0x1052f5[_0xbb10('0x39')][_0xbb10('0x3b')]?_0x1052f5[_0xbb10('0x39')]:_0x119e8f[_0xbb10('0x35')];_0x1052f5[_0xbb10('0x3e')]=qs[_0xbb10('0x3f')](_0x2f675c['query']['sort']);_0x1052f5['where']=qs[_0xbb10('0x38')](_['pick'](_0x2f675c[_0xbb10('0x37')],_0x119e8f['filters']));if(_0x2f675c[_0xbb10('0x37')]['filter']){_0x1052f5['where']=_[_0xbb10('0x42')](_0x1052f5[_0xbb10('0x41')],{'$or':_['map'](_0x1052f5[_0xbb10('0x39')],function(_0x131d48){var _0x338e7a={};_0x338e7a[_0x131d48]={'$like':'%'+_0x2f675c[_0xbb10('0x37')]['filter']+'%'};return _0x338e7a;})});}_0x1052f5=_['merge']({},_0x1052f5,_0x2f675c[_0xbb10('0x45')]);return _0x5a031b[_0xbb10('0x102')](_0x1052f5);}})[_0xbb10('0x15')](function(_0x53f3c2){if(_0x53f3c2){_0x4c8e28=_0x53f3c2[_0xbb10('0x3b')];if(!_0x2f675c[_0xbb10('0x37')][_0xbb10('0x3c')]('nolimit')){_0x1052f5[_0xbb10('0x27')]=qs['limit'](_0x2f675c['query'][_0xbb10('0x27')]);_0x1052f5['offset']=qs[_0xbb10('0x24')](_0x2f675c[_0xbb10('0x37')][_0xbb10('0x24')]);}return _0x5a031b[_0xbb10('0x102')](_0x1052f5);}})[_0xbb10('0x15')](function(_0x57a6bc){if(_0x57a6bc){return _0x57a6bc?{'count':_0x4c8e28,'rows':_0x57a6bc}:null;}})[_0xbb10('0x15')](respondWithResult(_0x18f6b1,null))[_0xbb10('0x1f')](handleError(_0x18f6b1,null));};exports[_0xbb10('0x118')]=function(_0x2701e8,_0x1b0086){var _0x1c387b=_0x2701e8['query']['online']===_0xbb10('0x119')?_0xbb10('0x11a'):_0xbb10('0x11b');return db[_0xbb10('0x31')][_0xbb10('0x56')]({'attributes':['id',_0x1c387b],'where':{'id':_0x2701e8['params']['id']}})['then'](handleEntityNotFound(_0x1b0086,null))[_0xbb10('0x15')](function(_0x23cbf4){if(_0x23cbf4){var _0x536519=_0x23cbf4[_0x1c387b];var _0x50dde9=_0x536519&&_0x536519[_0xbb10('0x11c')]?_0x536519[_0xbb10('0x11c')]:[];_0x1b0086[_0xbb10('0xbf')]({'fromKey':_[_0xbb10('0x71')](_0x536519[_0xbb10('0x11d')])?undefined:_0x536519[_0xbb10('0x11d')],'count':_0x50dde9['length'],'rows':_0x50dde9});}})[_0xbb10('0x1f')](handleError(_0x1b0086,null));};exports[_0xbb10('0x11e')]=function(_0x261c9b,_0x232794){var _0x35b3f8={'raw':![],'where':{}};var _0x3783d0={};var _0xdd7d5c={'count':0x0,'rows':[]};return db[_0xbb10('0x31')][_0xbb10('0x5c')]({'where':{'id':_0x261c9b['params']['id']}})['then'](handleEntityNotFound(_0x232794,null))['then'](function(_0x111c15){if(_0x111c15){_0x3783d0[_0xbb10('0x35')]=_[_0xbb10('0x36')](db[_0xbb10('0xc9')]['rawAttributes']);_0x3783d0['query']=_['keys'](_0x261c9b[_0xbb10('0x37')]);_0x3783d0[_0xbb10('0x38')]=_[_0xbb10('0x4a')](_0x3783d0[_0xbb10('0x35')],_0x3783d0[_0xbb10('0x37')]);_0x35b3f8[_0xbb10('0x39')]=_[_0xbb10('0x4a')](_0x3783d0[_0xbb10('0x35')],qs[_0xbb10('0x3a')](_0x261c9b[_0xbb10('0x37')][_0xbb10('0x3a')]));_0x35b3f8[_0xbb10('0x39')]=_0x35b3f8[_0xbb10('0x39')][_0xbb10('0x3b')]?_0x35b3f8['attributes']:_0x3783d0[_0xbb10('0x35')];if(!_0x261c9b[_0xbb10('0x37')][_0xbb10('0x3c')](_0xbb10('0x3d'))){_0x35b3f8[_0xbb10('0x27')]=qs[_0xbb10('0x27')](_0x261c9b['query'][_0xbb10('0x27')]);_0x35b3f8[_0xbb10('0x24')]=qs[_0xbb10('0x24')](_0x261c9b[_0xbb10('0x37')][_0xbb10('0x24')]);}_0x35b3f8[_0xbb10('0x3e')]=qs[_0xbb10('0x3f')](_0x261c9b[_0xbb10('0x37')][_0xbb10('0x3f')]);_0x35b3f8['where']=qs[_0xbb10('0x38')](_[_0xbb10('0x40')](_0x261c9b[_0xbb10('0x37')],_0x3783d0[_0xbb10('0x38')]));_0x35b3f8[_0xbb10('0x41')][_0xbb10('0x59')]=_0x111c15['id'];if(_0x261c9b[_0xbb10('0x37')][_0xbb10('0x44')]){_0x35b3f8[_0xbb10('0x41')]=_['merge'](_0x35b3f8[_0xbb10('0x41')],{'$or':_['map'](_0x35b3f8[_0xbb10('0x39')],function(_0x2cd1b0){var _0x57e0b2={};_0x57e0b2[_0x2cd1b0]={'$like':'%'+_0x261c9b['query'][_0xbb10('0x44')]+'%'};return _0x57e0b2;})});}_0x35b3f8=_[_0xbb10('0x42')]({},_0x35b3f8,_0x261c9b[_0xbb10('0x45')]);return db[_0xbb10('0xc9')][_0xbb10('0x26')]({'where':_0x35b3f8[_0xbb10('0x41')]})[_0xbb10('0x15')](function(_0x40a208){_0xdd7d5c[_0xbb10('0x26')]=_0x40a208;if(_0x261c9b[_0xbb10('0x37')][_0xbb10('0x46')]){_0x35b3f8[_0xbb10('0x4b')]=[{'all':!![]}];}else{_0x35b3f8[_0xbb10('0x4b')]=[{'model':db[_0xbb10('0x81')],'as':_0xbb10('0xec'),'required':![]},{'model':db['Attachment'],'as':_0xbb10('0x11f'),'required':![]}];}return db['ChatOfflineMessage'][_0xbb10('0x47')](_0x35b3f8);})[_0xbb10('0x15')](function(_0x234dc5){_0xdd7d5c[_0xbb10('0x48')]=_0x234dc5;return _0xdd7d5c;});}})[_0xbb10('0x15')](respondWithFilteredResult(_0x232794,_0x35b3f8))[_0xbb10('0x1f')](handleError(_0x232794,null));};exports[_0xbb10('0x120')]=function(_0x45dcaa,_0x5c88bd){return db['ChatWebsite']['find']({'where':{'id':_0x45dcaa[_0xbb10('0x57')]['id']}})[_0xbb10('0x15')](handleEntityNotFound(_0x5c88bd,null))[_0xbb10('0x15')](function(_0x54c61c){if(_0x54c61c){return _0x54c61c[_0xbb10('0x120')](_0x45dcaa['body'][_0xbb10('0x5e')],_[_0xbb10('0xeb')](_0x45dcaa['body'],[_0xbb10('0x5e'),'id'])||{})[_0xbb10('0xac')](function(_0xa52322){for(var _0xc1691=0x0;_0xc1691<_0x45dcaa[_0xbb10('0x4d')]['ids'][_0xbb10('0x3b')];_0xc1691+=0x1){socket[_0xbb10('0x121')]('userChatWebsite:save',{'UserId':Number(_0x45dcaa[_0xbb10('0x4d')][_0xbb10('0x5e')][_0xc1691]),'ChatWebsiteId':Number(_0x45dcaa['params']['id'])});}return _0xa52322;});}})[_0xbb10('0x15')](respondWithResult(_0x5c88bd,null))[_0xbb10('0x1f')](handleError(_0x5c88bd,null));};exports[_0xbb10('0x122')]=function(_0x24f1d2,_0x481a0a){return db[_0xbb10('0x31')][_0xbb10('0x56')]({'where':{'id':_0x24f1d2[_0xbb10('0x57')]['id']}})['then'](handleEntityNotFound(_0x481a0a,null))['then'](function(_0x284b77){if(_0x284b77){return _0x284b77[_0xbb10('0x122')](_0x24f1d2[_0xbb10('0x37')][_0xbb10('0x5e')])['then'](function(){if(_[_0xbb10('0x123')](_0x24f1d2[_0xbb10('0x37')][_0xbb10('0x5e')])){for(var _0x28c680=0x0;_0x28c680<_0x24f1d2[_0xbb10('0x37')]['ids']['length'];_0x28c680+=0x1){socket[_0xbb10('0x121')](_0xbb10('0x124'),{'UserId':Number(_0x24f1d2['query']['ids'][_0x28c680]),'ChatWebsiteId':Number(_0x24f1d2[_0xbb10('0x57')]['id'])});}}else{socket[_0xbb10('0x121')](_0xbb10('0x124'),{'UserId':Number(_0x24f1d2[_0xbb10('0x37')][_0xbb10('0x5e')]),'ChatWebsiteId':Number(_0x24f1d2[_0xbb10('0x57')]['id'])});}});}})['then'](respondWithStatusCode(_0x481a0a,null))['catch'](handleError(_0x481a0a,null));};exports[_0xbb10('0x125')]=function(_0x1c3cbc,_0x24bda8){var _0x27ddfc={};var _0x39a047={};var _0x9a80a7;var _0x5e08c5;return db[_0xbb10('0x31')][_0xbb10('0x5c')]({'where':{'id':_0x1c3cbc[_0xbb10('0x57')]['id']}})[_0xbb10('0x15')](handleEntityNotFound(_0x24bda8,null))['then'](function(_0x21ad98){if(_0x21ad98){_0x9a80a7=_0x21ad98;_0x39a047[_0xbb10('0x35')]=_[_0xbb10('0x36')](db[_0xbb10('0xb4')][_0xbb10('0x32')]);_0x39a047[_0xbb10('0x37')]=_[_0xbb10('0x36')](_0x1c3cbc[_0xbb10('0x37')]);_0x39a047[_0xbb10('0x38')]=_[_0xbb10('0x4a')](_0x39a047[_0xbb10('0x35')],_0x39a047[_0xbb10('0x37')]);_0x27ddfc['attributes']=_[_0xbb10('0x4a')](_0x39a047[_0xbb10('0x35')],qs['fields'](_0x1c3cbc[_0xbb10('0x37')][_0xbb10('0x3a')]));_0x27ddfc[_0xbb10('0x39')]=_0x27ddfc['attributes'][_0xbb10('0x3b')]?_0x27ddfc[_0xbb10('0x39')]:_0x39a047[_0xbb10('0x35')];_0x27ddfc[_0xbb10('0x3e')]=qs[_0xbb10('0x3f')](_0x1c3cbc[_0xbb10('0x37')]['sort']);_0x27ddfc[_0xbb10('0x41')]=qs['filters'](_[_0xbb10('0x40')](_0x1c3cbc[_0xbb10('0x37')],_0x39a047[_0xbb10('0x38')]));if(_0x1c3cbc[_0xbb10('0x37')]['filter']){_0x27ddfc[_0xbb10('0x41')]=_[_0xbb10('0x42')](_0x27ddfc['where'],{'$or':_[_0xbb10('0x30')](_0x27ddfc['attributes'],function(_0x31c086){var _0x40845c={};_0x40845c[_0x31c086]={'$like':'%'+_0x1c3cbc[_0xbb10('0x37')][_0xbb10('0x44')]+'%'};return _0x40845c;})});}_0x27ddfc=_[_0xbb10('0x42')]({},_0x27ddfc,_0x1c3cbc[_0xbb10('0x45')]);return _0x9a80a7[_0xbb10('0x125')](_0x27ddfc);}})[_0xbb10('0x15')](function(_0x55ee36){if(_0x55ee36){_0x5e08c5=_0x55ee36['length'];if(!_0x1c3cbc[_0xbb10('0x37')][_0xbb10('0x3c')](_0xbb10('0x3d'))){_0x27ddfc[_0xbb10('0x27')]=qs[_0xbb10('0x27')](_0x1c3cbc[_0xbb10('0x37')][_0xbb10('0x27')]);_0x27ddfc[_0xbb10('0x24')]=qs[_0xbb10('0x24')](_0x1c3cbc['query'][_0xbb10('0x24')]);}return _0x9a80a7['getAgents'](_0x27ddfc);}})[_0xbb10('0x15')](function(_0x2a618a){if(_0x2a618a){return _0x2a618a?{'count':_0x5e08c5,'rows':_0x2a618a}:null;}})['then'](respondWithResult(_0x24bda8,null))[_0xbb10('0x1f')](handleError(_0x24bda8,null));}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.events.js b/server/api/chatWebsite/chatWebsite.events.js index e8eb855..081e806 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 _0x2e3b=['emit','hasOwnProperty','hook','../../mysqldb','ChatWebsite','setMaxListeners','save','update','remove'];(function(_0x2b4411,_0x2625ed){var _0x8e41ef=function(_0x2aa8c1){while(--_0x2aa8c1){_0x2b4411['push'](_0x2b4411['shift']());}};_0x8e41ef(++_0x2625ed);}(_0x2e3b,0x81));var _0xb2e3=function(_0x6e5298,_0x5e4838){_0x6e5298=_0x6e5298-0x0;var _0x4269f5=_0x2e3b[_0x6e5298];return _0x4269f5;};'use strict';var EventEmitter=require('events');var ChatWebsite=require(_0xb2e3('0x0'))['db'][_0xb2e3('0x1')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0xb2e3('0x2')](0x0);var events={'afterCreate':_0xb2e3('0x3'),'afterUpdate':_0xb2e3('0x4'),'afterDestroy':_0xb2e3('0x5')};function emitEvent(_0x1529ca){return function(_0xcb4d04,_0x4d30d7,_0x2bc877){ChatWebsiteEvents[_0xb2e3('0x6')](_0x1529ca+':'+_0xcb4d04['id'],_0xcb4d04);ChatWebsiteEvents['emit'](_0x1529ca,_0xcb4d04);_0x2bc877(null);};}for(var e in events){if(events[_0xb2e3('0x7')](e)){var event=events[e];ChatWebsite[_0xb2e3('0x8')](e,emitEvent(event));}}module['exports']=ChatWebsiteEvents; \ No newline at end of file +var _0xd7ce=['hasOwnProperty','hook','exports','events','../../mysqldb','ChatWebsite','setMaxListeners','remove','emit'];(function(_0x4a450a,_0x54d42f){var _0x28baf9=function(_0x5cb70a){while(--_0x5cb70a){_0x4a450a['push'](_0x4a450a['shift']());}};_0x28baf9(++_0x54d42f);}(_0xd7ce,0x16b));var _0xed7c=function(_0x5cc51f,_0x22c480){_0x5cc51f=_0x5cc51f-0x0;var _0x315a2f=_0xd7ce[_0x5cc51f];return _0x315a2f;};'use strict';var EventEmitter=require(_0xed7c('0x0'));var ChatWebsite=require(_0xed7c('0x1'))['db'][_0xed7c('0x2')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0xed7c('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0xed7c('0x4')};function emitEvent(_0x5e454c){return function(_0x4a6138,_0x587c5a,_0x17560f){ChatWebsiteEvents[_0xed7c('0x5')](_0x5e454c+':'+_0x4a6138['id'],_0x4a6138);ChatWebsiteEvents[_0xed7c('0x5')](_0x5e454c,_0x4a6138);_0x17560f(null);};}for(var e in events){if(events[_0xed7c('0x6')](e)){var event=events[e];ChatWebsite[_0xed7c('0x7')](e,emitEvent(event));}}module[_0xed7c('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 8a23ac1..b72f6b3 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 _0x465a=['rimraf','exports','define','chat_websites','lodash','../../config/logger','api'];(function(_0x2442ee,_0x27cb98){var _0x427cee=function(_0x2bcce5){while(--_0x2bcce5){_0x2442ee['push'](_0x2442ee['shift']());}};_0x427cee(++_0x27cb98);}(_0x465a,0x6d));var _0xa465=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x465a[_0x21a9d9];return _0x46adce;};'use strict';var _=require(_0xa465('0x0'));var util=require('util');var logger=require(_0xa465('0x1'))(_0xa465('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(_0xa465('0x3'));var config=require('../../config/environment');var attributes=require('./chatWebsite.attributes');module[_0xa465('0x4')]=function(_0x110f1a,_0x21f450){return _0x110f1a[_0xa465('0x5')]('ChatWebsite',attributes,{'tableName':_0xa465('0x6'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xae04=['bluebird','request-promise','path','rimraf','./chatWebsite.attributes','define','ChatWebsite','chat_websites','lodash','../../config/logger','api','moment'];(function(_0x35c4ca,_0xb02844){var _0x40df5f=function(_0x15ad59){while(--_0x15ad59){_0x35c4ca['push'](_0x35c4ca['shift']());}};_0x40df5f(++_0xb02844);}(_0xae04,0x1dc));var _0x4ae0=function(_0x2f39cf,_0x3c59ec){_0x2f39cf=_0x2f39cf-0x0;var _0xd0ece8=_0xae04[_0x2f39cf];return _0xd0ece8;};'use strict';var _=require(_0x4ae0('0x0'));var util=require('util');var logger=require(_0x4ae0('0x1'))(_0x4ae0('0x2'));var moment=require(_0x4ae0('0x3'));var BPromise=require(_0x4ae0('0x4'));var rp=require(_0x4ae0('0x5'));var fs=require('fs');var path=require(_0x4ae0('0x6'));var rimraf=require(_0x4ae0('0x7'));var config=require('../../config/environment');var attributes=require(_0x4ae0('0x8'));module['exports']=function(_0x556c5d,_0x5930d5){return _0x556c5d[_0x4ae0('0x9')](_0x4ae0('0xa'),attributes,{'tableName':_0x4ae0('0xb'),'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 8c93d1d..78e111e 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 _0x196c=['request\x20sent','ChatWebsite,\x20%s,\x20%s,\x20%s','error','message','result','catch','lodash','util','bluebird','randomstring','../../config/utils','../../config/logger','rpc','jayson/promise','http','redis','defaults','socket.io-emitter','register','request','then','info','ChatWebsite,\x20%s,\x20%s'];(function(_0x5b643b,_0x2670a7){var _0x48d2e6=function(_0x58f8c8){while(--_0x58f8c8){_0x5b643b['push'](_0x5b643b['shift']());}};_0x48d2e6(++_0x2670a7);}(_0x196c,0x79));var _0xc196=function(_0x3e9722,_0x4e5f88){_0x3e9722=_0x3e9722-0x0;var _0x2321dd=_0x196c[_0x3e9722];return _0x2321dd;};'use strict';var _=require(_0xc196('0x0'));var util=require(_0xc196('0x1'));var moment=require('moment');var BPromise=require(_0xc196('0x2'));var rs=require(_0xc196('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xc196('0x4'));var logger=require(_0xc196('0x5'))(_0xc196('0x6'));var config=require('../../config/environment');var jayson=require(_0xc196('0x7'));var client=jayson['client'][_0xc196('0x8')]({'port':0x232a});config[_0xc196('0x9')]=_[_0xc196('0xa')](config[_0xc196('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0xc196('0xb'))(new Redis(config['redis']));require('./chatWebsite.socket')[_0xc196('0xc')](socket);function respondWithRpcPromise(_0x4cab9e,_0x3e1710,_0x2f0c67){return new BPromise(function(_0xff297e,_0x22e787){return client[_0xc196('0xd')](_0x4cab9e,_0x2f0c67)[_0xc196('0xe')](function(_0x1f2a7d){logger[_0xc196('0xf')](_0xc196('0x10'),_0x3e1710,_0xc196('0x11'));logger['debug'](_0xc196('0x12'),_0x3e1710,_0xc196('0x11'),JSON['stringify'](_0x1f2a7d));if(_0x1f2a7d[_0xc196('0x13')]){if(_0x1f2a7d[_0xc196('0x13')]['code']===0x1f4){logger['error'](_0xc196('0x10'),_0x3e1710,_0x1f2a7d[_0xc196('0x13')][_0xc196('0x14')]);return _0x22e787(_0x1f2a7d[_0xc196('0x13')]['message']);}logger[_0xc196('0x13')]('ChatWebsite,\x20%s,\x20%s',_0x3e1710,_0x1f2a7d[_0xc196('0x13')][_0xc196('0x14')]);return _0xff297e(_0x1f2a7d[_0xc196('0x13')][_0xc196('0x14')]);}else{logger[_0xc196('0xf')](_0xc196('0x10'),_0x3e1710,'request\x20sent');_0xff297e(_0x1f2a7d[_0xc196('0x15')][_0xc196('0x14')]);}})[_0xc196('0x16')](function(_0x47cfbd){logger[_0xc196('0x13')](_0xc196('0x10'),_0x3e1710,_0x47cfbd);_0x22e787(_0x47cfbd);});});} \ No newline at end of file +var _0x45a8=['redis','request','then','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','http'];(function(_0x2ea69b,_0x34b143){var _0x229d90=function(_0x297059){while(--_0x297059){_0x2ea69b['push'](_0x2ea69b['shift']());}};_0x229d90(++_0x34b143);}(_0x45a8,0xca));var _0x845a=function(_0x3b2919,_0xe974ed){_0x3b2919=_0x3b2919-0x0;var _0x4a7dbf=_0x45a8[_0x3b2919];return _0x4a7dbf;};'use strict';var _=require(_0x845a('0x0'));var util=require(_0x845a('0x1'));var moment=require(_0x845a('0x2'));var BPromise=require(_0x845a('0x3'));var rs=require(_0x845a('0x4'));var fs=require('fs');var Redis=require(_0x845a('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x845a('0x6'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x845a('0x7')]({'port':0x232a});config[_0x845a('0x8')]=_['defaults'](config[_0x845a('0x8')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./chatWebsite.socket')['register'](socket);function respondWithRpcPromise(_0x2b347d,_0x14a4d0,_0x18b06d){return new BPromise(function(_0x2131dc,_0x3b955b){return client[_0x845a('0x9')](_0x2b347d,_0x18b06d)[_0x845a('0xa')](function(_0xa3d9b7){logger['info'](_0x845a('0xb'),_0x14a4d0,_0x845a('0xc'));logger[_0x845a('0xd')](_0x845a('0xe'),_0x14a4d0,_0x845a('0xc'),JSON['stringify'](_0xa3d9b7));if(_0xa3d9b7[_0x845a('0xf')]){if(_0xa3d9b7['error'][_0x845a('0x10')]===0x1f4){logger[_0x845a('0xf')](_0x845a('0xb'),_0x14a4d0,_0xa3d9b7['error'][_0x845a('0x11')]);return _0x3b955b(_0xa3d9b7[_0x845a('0xf')]['message']);}logger[_0x845a('0xf')]('ChatWebsite,\x20%s,\x20%s',_0x14a4d0,_0xa3d9b7[_0x845a('0xf')][_0x845a('0x11')]);return _0x2131dc(_0xa3d9b7['error'][_0x845a('0x11')]);}else{logger[_0x845a('0x12')](_0x845a('0xb'),_0x14a4d0,_0x845a('0xc'));_0x2131dc(_0xa3d9b7[_0x845a('0x13')][_0x845a('0x11')]);}})[_0x845a('0x14')](function(_0x298c77){logger['error'](_0x845a('0xb'),_0x14a4d0,_0x298c77);_0x3b955b(_0x298c77);});});} \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.socket.js b/server/api/chatWebsite/chatWebsite.socket.js index e86b710..be6b04a 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 _0xb1e7=['./chatWebsite.events','save','remove','update','emit','removeListener','register','length','chatWebsite:'];(function(_0x3861d9,_0x3b12a1){var _0x4e171a=function(_0x4662f3){while(--_0x4662f3){_0x3861d9['push'](_0x3861d9['shift']());}};_0x4e171a(++_0x3b12a1);}(_0xb1e7,0x105));var _0x7b1e=function(_0x576faa,_0x40825d){_0x576faa=_0x576faa-0x0;var _0x455ed3=_0xb1e7[_0x576faa];return _0x455ed3;};'use strict';var ChatWebsiteEvents=require(_0x7b1e('0x0'));var events=[_0x7b1e('0x1'),_0x7b1e('0x2'),_0x7b1e('0x3')];function createListener(_0x147c6e,_0x419dce){return function(_0x3322a4){_0x419dce[_0x7b1e('0x4')](_0x147c6e,_0x3322a4);};}function removeListener(_0x25d3ac,_0x572aa3){return function(){ChatWebsiteEvents[_0x7b1e('0x5')](_0x25d3ac,_0x572aa3);};}exports[_0x7b1e('0x6')]=function(_0x4f894d){for(var _0x52d2c9=0x0,_0x5489b4=events[_0x7b1e('0x7')];_0x52d2c9<_0x5489b4;_0x52d2c9++){var _0x1d8ccc=events[_0x52d2c9];var _0x296336=createListener(_0x7b1e('0x8')+_0x1d8ccc,_0x4f894d);ChatWebsiteEvents['on'](_0x1d8ccc,_0x296336);}}; \ No newline at end of file +var _0x00b4=['emit','register','length','chatWebsite:','./chatWebsite.events','save','remove','update'];(function(_0x42ebba,_0x4cbf87){var _0x3fd2af=function(_0x26d999){while(--_0x26d999){_0x42ebba['push'](_0x42ebba['shift']());}};_0x3fd2af(++_0x4cbf87);}(_0x00b4,0x11c));var _0x400b=function(_0x161d59,_0x11d2ec){_0x161d59=_0x161d59-0x0;var _0xd33fcd=_0x00b4[_0x161d59];return _0xd33fcd;};'use strict';var ChatWebsiteEvents=require(_0x400b('0x0'));var events=[_0x400b('0x1'),_0x400b('0x2'),_0x400b('0x3')];function createListener(_0x22cf2a,_0x1b9b10){return function(_0x2e33c4){_0x1b9b10[_0x400b('0x4')](_0x22cf2a,_0x2e33c4);};}function removeListener(_0x141a22,_0xcbca7f){return function(){ChatWebsiteEvents['removeListener'](_0x141a22,_0xcbca7f);};}exports[_0x400b('0x5')]=function(_0x487793){for(var _0x2682c0=0x0,_0x211f34=events[_0x400b('0x6')];_0x2682c0<_0x211f34;_0x2682c0++){var _0xb6be39=events[_0x2682c0];var _0x332ccc=createListener(_0x400b('0x7')+_0xb6be39,_0x487793);ChatWebsiteEvents['on'](_0xb6be39,_0x332ccc);}}; \ No newline at end of file diff --git a/server/api/chatWebsite/index.js b/server/api/chatWebsite/index.js index d65b726..53463fd 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 _0x3ec0=['index','get','describe','/:id','show','/:id/dispositions','getDispositions','/:id/logo','getLogo','/:id/avatar','getAvatar','/:id/customer_avatar','getCustomerAvatar','/:id/system_avatar','getSystemAvatar','/:id/interactions','/:id/snippet','getSnippet','/:id/applications','getApplications','/:id/proactive_actions','/:id/fields','getFields','/:id/offline_messages','getOfflineMessages','/:id/users','getAgents','post','create','addDisposition','/:id/canned_answers','addAnswer','server/files/images/logos/','format','%s-%s','now','single','file','addLogo','diskStorage','root','originalname','addAvatar','server/files/images/avatars/','addCustomerAvatar','join','addSystemAvatar','notify','server/files','attachments','offline-chat','ensureDir','replace','/:id/offline','any','addInteraction','addApplications','addProactiveActions','put','update','delete','removeDispositions','exports','multer','util','path','connect-timeout','Router','fs-extra','../../config/environment','./chatWebsite.controller','isAuthenticated'];(function(_0xbe5564,_0x18b61a){var _0x507f83=function(_0x555eec){while(--_0x555eec){_0xbe5564['push'](_0xbe5564['shift']());}};_0x507f83(++_0x18b61a);}(_0x3ec0,0x1a7));var _0x03ec=function(_0x23506f,_0x541afa){_0x23506f=_0x23506f-0x0;var _0xf84917=_0x3ec0[_0x23506f];return _0xf84917;};'use strict';var multer=require(_0x03ec('0x0'));var util=require(_0x03ec('0x1'));var path=require(_0x03ec('0x2'));var timeout=require(_0x03ec('0x3'));var express=require('express');var router=express[_0x03ec('0x4')]();var fs_extra=require(_0x03ec('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x03ec('0x6'));var controller=require(_0x03ec('0x7'));router['get']('/',auth[_0x03ec('0x8')](),controller[_0x03ec('0x9')]);router[_0x03ec('0xa')]('/describe',auth[_0x03ec('0x8')](),controller[_0x03ec('0xb')]);router['get'](_0x03ec('0xc'),auth[_0x03ec('0x8')](),controller[_0x03ec('0xd')]);router[_0x03ec('0xa')](_0x03ec('0xe'),auth[_0x03ec('0x8')](),controller[_0x03ec('0xf')]);router[_0x03ec('0xa')]('/:id/canned_answers',auth[_0x03ec('0x8')](),controller['getAnswers']);router[_0x03ec('0xa')](_0x03ec('0x10'),controller[_0x03ec('0x11')]);router['get'](_0x03ec('0x12'),controller[_0x03ec('0x13')]);router[_0x03ec('0xa')](_0x03ec('0x14'),controller[_0x03ec('0x15')]);router['get'](_0x03ec('0x16'),controller[_0x03ec('0x17')]);router[_0x03ec('0xa')](_0x03ec('0x18'),auth[_0x03ec('0x8')](),controller['getInteractions']);router['get'](_0x03ec('0x19'),controller[_0x03ec('0x1a')]);router['get'](_0x03ec('0x1b'),auth[_0x03ec('0x8')](),controller[_0x03ec('0x1c')]);router[_0x03ec('0xa')](_0x03ec('0x1d'),auth[_0x03ec('0x8')](),controller['getProactiveActions']);router[_0x03ec('0xa')](_0x03ec('0x1e'),controller[_0x03ec('0x1f')]);router[_0x03ec('0xa')](_0x03ec('0x20'),auth[_0x03ec('0x8')](),controller[_0x03ec('0x21')]);router['get'](_0x03ec('0x22'),auth[_0x03ec('0x8')](),controller[_0x03ec('0x23')]);router[_0x03ec('0x24')]('/',auth[_0x03ec('0x8')](),controller[_0x03ec('0x25')]);router['post'](_0x03ec('0xe'),auth['isAuthenticated'](),controller[_0x03ec('0x26')]);router[_0x03ec('0x24')](_0x03ec('0x27'),auth[_0x03ec('0x8')](),controller[_0x03ec('0x28')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x3f4ab4,_0x3bae53,_0x54dd23){_0x54dd23(null,path['join'](config['root'],_0x03ec('0x29')));},'filename':function(_0x5b4b0f,_0x28074e,_0x1d806a){_0x1d806a(null,util[_0x03ec('0x2a')](_0x03ec('0x2b'),Date[_0x03ec('0x2c')](),_0x28074e['originalname']));}})});router['post'](_0x03ec('0x10'),upload[_0x03ec('0x2d')](_0x03ec('0x2e')),controller[_0x03ec('0x2f')]);var upload=multer({'storage':multer[_0x03ec('0x30')]({'destination':function(_0x5d227f,_0x511678,_0x113d48){_0x113d48(null,path['join'](config[_0x03ec('0x31')],'server/files/images/avatars/'));},'filename':function(_0x516aff,_0x2e0671,_0x560773){_0x560773(null,util[_0x03ec('0x2a')](_0x03ec('0x2b'),Date['now'](),_0x2e0671[_0x03ec('0x32')]));}})});router[_0x03ec('0x24')](_0x03ec('0x12'),upload[_0x03ec('0x2d')](_0x03ec('0x2e')),controller[_0x03ec('0x33')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x1aab10,_0x1f638b,_0x2b7f9c){_0x2b7f9c(null,path['join'](config[_0x03ec('0x31')],_0x03ec('0x34')));},'filename':function(_0x37722b,_0x13863d,_0x421c5c){_0x421c5c(null,util[_0x03ec('0x2a')](_0x03ec('0x2b'),Date[_0x03ec('0x2c')](),_0x13863d['originalname']));}})});router[_0x03ec('0x24')]('/:id/customer_avatar',upload[_0x03ec('0x2d')](_0x03ec('0x2e')),controller[_0x03ec('0x35')]);var upload=multer({'storage':multer[_0x03ec('0x30')]({'destination':function(_0x3eb85d,_0xee4bd4,_0x3bf145){_0x3bf145(null,path[_0x03ec('0x36')](config[_0x03ec('0x31')],_0x03ec('0x34')));},'filename':function(_0x458d16,_0x273e99,_0x551403){_0x551403(null,util[_0x03ec('0x2a')]('%s-%s',Date[_0x03ec('0x2c')](),_0x273e99[_0x03ec('0x32')]));}})});router[_0x03ec('0x24')]('/:id/system_avatar',upload[_0x03ec('0x2d')](_0x03ec('0x2e')),controller[_0x03ec('0x37')]);router[_0x03ec('0x24')]('/:id/notify',controller[_0x03ec('0x38')]);const offlineUploadMulter=multer({'storage':multer[_0x03ec('0x30')]({'destination':function(_0x275b83,_0x15788e,_0x1992f8){const _0x1dfc8b=path[_0x03ec('0x36')](config[_0x03ec('0x31')],_0x03ec('0x39'),_0x03ec('0x3a'),_0x03ec('0x3b'));fs_extra[_0x03ec('0x3c')](_0x1dfc8b,function(){_0x1992f8(null,_0x1dfc8b);});},'filename':function(_0x113d23,_0x427193,_0x1969e2){const _0x323100=_0x427193[_0x03ec('0x32')][_0x03ec('0x3d')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x4592a6=path['extname'](_0x323100);const _0x1e70fb=Date['now']()+'-'+_0x323100['replace'](_0x4592a6,'')+_0x4592a6;_0x1969e2(null,_0x1e70fb);}})});router['post'](_0x03ec('0x3e'),offlineUploadMulter[_0x03ec('0x3f')](),controller['offline']);router[_0x03ec('0x24')]('/:id/interactions',auth[_0x03ec('0x8')](),controller[_0x03ec('0x40')]);router[_0x03ec('0x24')](_0x03ec('0x1b'),auth[_0x03ec('0x8')](),controller[_0x03ec('0x41')]);router[_0x03ec('0x24')]('/:id/proactive_actions',auth[_0x03ec('0x8')](),controller[_0x03ec('0x42')]);router['post'](_0x03ec('0x22'),auth[_0x03ec('0x8')](),controller['addAgents']);router[_0x03ec('0x43')](_0x03ec('0xc'),auth[_0x03ec('0x8')](),controller[_0x03ec('0x44')]);router[_0x03ec('0x45')]('/:id',auth['isAuthenticated'](),controller['destroy']);router['delete'](_0x03ec('0xe'),auth[_0x03ec('0x8')](),controller[_0x03ec('0x46')]);router[_0x03ec('0x45')](_0x03ec('0x27'),auth['isAuthenticated'](),controller['removeAnswers']);router['delete'](_0x03ec('0x22'),auth[_0x03ec('0x8')](),controller['removeAgents']);module[_0x03ec('0x47')]=router; \ No newline at end of file +var _0x020f=['addAvatar','%s-%s','/:id/customer_avatar','file','addCustomerAvatar','addSystemAvatar','/:id/notify','attachments','offline-chat','replace','extname','/:id/offline','any','offline','addInteraction','addApplications','addProactiveActions','addAgents','put','update','destroy','delete','removeDispositions','/:id/canned_answers','removeAgents','exports','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatWebsite.controller','get','isAuthenticated','/describe','describe','/:id','show','/:id/dispositions','getDispositions','getAnswers','/:id/logo','getLogo','/:id/avatar','getCustomerAvatar','/:id/system_avatar','getSystemAvatar','/:id/interactions','/:id/snippet','getApplications','/:id/proactive_actions','getProactiveActions','/:id/fields','getFields','/:id/offline_messages','getOfflineMessages','/:id/users','getAgents','post','create','addDisposition','addAnswer','diskStorage','server/files/images/logos/','format','originalname','single','join','root','server/files/images/avatars/','now'];(function(_0x469ac7,_0x38e416){var _0x22f3b0=function(_0x1a1447){while(--_0x1a1447){_0x469ac7['push'](_0x469ac7['shift']());}};_0x22f3b0(++_0x38e416);}(_0x020f,0xf8));var _0xf020=function(_0x591c55,_0x45a0e2){_0x591c55=_0x591c55-0x0;var _0x118d45=_0x020f[_0x591c55];return _0x118d45;};'use strict';var multer=require(_0xf020('0x0'));var util=require(_0xf020('0x1'));var path=require('path');var timeout=require(_0xf020('0x2'));var express=require(_0xf020('0x3'));var router=express['Router']();var fs_extra=require(_0xf020('0x4'));var auth=require(_0xf020('0x5'));var interaction=require(_0xf020('0x6'));var config=require(_0xf020('0x7'));var controller=require(_0xf020('0x8'));router[_0xf020('0x9')]('/',auth[_0xf020('0xa')](),controller['index']);router['get'](_0xf020('0xb'),auth[_0xf020('0xa')](),controller[_0xf020('0xc')]);router[_0xf020('0x9')](_0xf020('0xd'),auth['isAuthenticated'](),controller[_0xf020('0xe')]);router[_0xf020('0x9')](_0xf020('0xf'),auth[_0xf020('0xa')](),controller[_0xf020('0x10')]);router[_0xf020('0x9')]('/:id/canned_answers',auth[_0xf020('0xa')](),controller[_0xf020('0x11')]);router[_0xf020('0x9')](_0xf020('0x12'),controller[_0xf020('0x13')]);router[_0xf020('0x9')](_0xf020('0x14'),controller['getAvatar']);router['get']('/:id/customer_avatar',controller[_0xf020('0x15')]);router['get'](_0xf020('0x16'),controller[_0xf020('0x17')]);router[_0xf020('0x9')](_0xf020('0x18'),auth['isAuthenticated'](),controller['getInteractions']);router[_0xf020('0x9')](_0xf020('0x19'),controller['getSnippet']);router[_0xf020('0x9')]('/:id/applications',auth[_0xf020('0xa')](),controller[_0xf020('0x1a')]);router[_0xf020('0x9')](_0xf020('0x1b'),auth[_0xf020('0xa')](),controller[_0xf020('0x1c')]);router[_0xf020('0x9')](_0xf020('0x1d'),controller[_0xf020('0x1e')]);router['get'](_0xf020('0x1f'),auth[_0xf020('0xa')](),controller[_0xf020('0x20')]);router[_0xf020('0x9')](_0xf020('0x21'),auth['isAuthenticated'](),controller[_0xf020('0x22')]);router[_0xf020('0x23')]('/',auth[_0xf020('0xa')](),controller[_0xf020('0x24')]);router['post']('/:id/dispositions',auth[_0xf020('0xa')](),controller[_0xf020('0x25')]);router[_0xf020('0x23')]('/:id/canned_answers',auth[_0xf020('0xa')](),controller[_0xf020('0x26')]);var upload=multer({'storage':multer[_0xf020('0x27')]({'destination':function(_0x2deba1,_0x5bd9fa,_0x12f5f3){_0x12f5f3(null,path['join'](config['root'],_0xf020('0x28')));},'filename':function(_0x2003f7,_0x303c28,_0x48a5f7){_0x48a5f7(null,util[_0xf020('0x29')]('%s-%s',Date['now'](),_0x303c28[_0xf020('0x2a')]));}})});router[_0xf020('0x23')](_0xf020('0x12'),upload[_0xf020('0x2b')]('file'),controller['addLogo']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x44104f,_0x1f87a0,_0x50199d){_0x50199d(null,path[_0xf020('0x2c')](config[_0xf020('0x2d')],_0xf020('0x2e')));},'filename':function(_0x2f6683,_0x506fab,_0x464fe8){_0x464fe8(null,util[_0xf020('0x29')]('%s-%s',Date[_0xf020('0x2f')](),_0x506fab[_0xf020('0x2a')]));}})});router[_0xf020('0x23')](_0xf020('0x14'),upload['single']('file'),controller[_0xf020('0x30')]);var upload=multer({'storage':multer[_0xf020('0x27')]({'destination':function(_0x365bd0,_0x4dda53,_0x480b14){_0x480b14(null,path['join'](config['root'],_0xf020('0x2e')));},'filename':function(_0x2ca704,_0x1807ed,_0x4b7dd1){_0x4b7dd1(null,util[_0xf020('0x29')](_0xf020('0x31'),Date[_0xf020('0x2f')](),_0x1807ed[_0xf020('0x2a')]));}})});router[_0xf020('0x23')](_0xf020('0x32'),upload[_0xf020('0x2b')](_0xf020('0x33')),controller[_0xf020('0x34')]);var upload=multer({'storage':multer[_0xf020('0x27')]({'destination':function(_0x1b7283,_0x1694ad,_0x17bf16){_0x17bf16(null,path[_0xf020('0x2c')](config['root'],_0xf020('0x2e')));},'filename':function(_0x476a2d,_0x3601e8,_0x3f50d2){_0x3f50d2(null,util[_0xf020('0x29')](_0xf020('0x31'),Date[_0xf020('0x2f')](),_0x3601e8['originalname']));}})});router[_0xf020('0x23')](_0xf020('0x16'),upload[_0xf020('0x2b')](_0xf020('0x33')),controller[_0xf020('0x35')]);router[_0xf020('0x23')](_0xf020('0x36'),controller['notify']);const offlineUploadMulter=multer({'storage':multer[_0xf020('0x27')]({'destination':function(_0x404c29,_0x51f179,_0x5af0fc){const _0x2a7c89=path[_0xf020('0x2c')](config['root'],'server/files',_0xf020('0x37'),_0xf020('0x38'));fs_extra['ensureDir'](_0x2a7c89,function(){_0x5af0fc(null,_0x2a7c89);});},'filename':function(_0x236f37,_0x543ee2,_0x27c910){const _0x2ad216=_0x543ee2[_0xf020('0x2a')][_0xf020('0x39')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x4f6b30=path[_0xf020('0x3a')](_0x2ad216);const _0x5d6e9b=Date[_0xf020('0x2f')]()+'-'+_0x2ad216[_0xf020('0x39')](_0x4f6b30,'')+_0x4f6b30;_0x27c910(null,_0x5d6e9b);}})});router['post'](_0xf020('0x3b'),offlineUploadMulter[_0xf020('0x3c')](),controller[_0xf020('0x3d')]);router[_0xf020('0x23')](_0xf020('0x18'),auth[_0xf020('0xa')](),controller[_0xf020('0x3e')]);router[_0xf020('0x23')]('/:id/applications',auth[_0xf020('0xa')](),controller[_0xf020('0x3f')]);router[_0xf020('0x23')](_0xf020('0x1b'),auth[_0xf020('0xa')](),controller[_0xf020('0x40')]);router['post'](_0xf020('0x21'),auth['isAuthenticated'](),controller[_0xf020('0x41')]);router[_0xf020('0x42')]('/:id',auth[_0xf020('0xa')](),controller[_0xf020('0x43')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xf020('0x44')]);router[_0xf020('0x45')](_0xf020('0xf'),auth[_0xf020('0xa')](),controller[_0xf020('0x46')]);router[_0xf020('0x45')](_0xf020('0x47'),auth[_0xf020('0xa')](),controller['removeAnswers']);router[_0xf020('0x45')]('/:id/users',auth[_0xf020('0xa')](),controller[_0xf020('0x48')]);module[_0xf020('0x49')]=router; \ No newline at end of file diff --git a/server/api/client-side-logs.js b/server/api/client-side-logs.js index 072daf3..3de26b3 100644 --- a/server/api/client-side-logs.js +++ b/server/api/client-side-logs.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7229=['get','client-side-logger','Client-Side\x20logger\x20not\x20found!','expressEndpoint','/client-logs','use','exports','../components/auth/service','env','production','app'];(function(_0x11a220,_0x4e470a){var _0x20d8fe=function(_0xbedfd){while(--_0xbedfd){_0x11a220['push'](_0x11a220['shift']());}};_0x20d8fe(++_0x4e470a);}(_0x7229,0xd8));var _0x9722=function(_0x2b5eae,_0x55010d){_0x2b5eae=_0x2b5eae-0x0;var _0x5f3ac9=_0x7229[_0x2b5eae];return _0x5f3ac9;};var beaverLogger=require('beaver-logger/server');var express=require('express');var auth=require(_0x9722('0x0'));var config=require('../config/environment');var router=express['Router']();var isProduction=config[_0x9722('0x1')]===_0x9722('0x2')||![];function clientSideLogs(_0x205967,_0x5df605,_0x235c26){var _0x15afba=_0x205967[_0x9722('0x3')][_0x9722('0x4')](_0x9722('0x5'));if(!_0x15afba){throw new Error(_0x9722('0x6'));}return beaverLogger[_0x9722('0x7')]({'uri':_0x9722('0x8'),'logger':_0x15afba,'enableCors':!isProduction})(_0x205967,_0x5df605,_0x235c26);}router[_0x9722('0x9')](auth['isAuthenticated'](),clientSideLogs);module[_0x9722('0xa')]=router; \ No newline at end of file +var _0x40e4=['exports','beaver-logger/server','express','../components/auth/service','app','get','client-side-logger','expressEndpoint','/client-logs','use'];(function(_0xc2dde6,_0x1cccc9){var _0x9fc29c=function(_0x54ba28){while(--_0x54ba28){_0xc2dde6['push'](_0xc2dde6['shift']());}};_0x9fc29c(++_0x1cccc9);}(_0x40e4,0x97));var _0x440e=function(_0xfdb740,_0x14c2da){_0xfdb740=_0xfdb740-0x0;var _0x4a837d=_0x40e4[_0xfdb740];return _0x4a837d;};var beaverLogger=require(_0x440e('0x0'));var express=require(_0x440e('0x1'));var auth=require(_0x440e('0x2'));var config=require('../config/environment');var router=express['Router']();var isProduction=config['env']==='production'||![];function clientSideLogs(_0x10a0b8,_0x791745,_0xd0adf4){var _0x59b844=_0x10a0b8[_0x440e('0x3')][_0x440e('0x4')](_0x440e('0x5'));if(!_0x59b844){throw new Error('Client-Side\x20logger\x20not\x20found!');}return beaverLogger[_0x440e('0x6')]({'uri':_0x440e('0x7'),'logger':_0x59b844,'enableCors':!isProduction})(_0x10a0b8,_0x791745,_0xd0adf4);}router[_0x440e('0x8')](auth['isAuthenticated'](),clientSideLogs);module[_0x440e('0x9')]=router; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.attributes.js b/server/api/cloudProvider/cloudProvider.attributes.js index d7391cb..4adb302 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 _0xb824=['ENUM','Outlook365','Dynamics365','MicrosoftAzure\x20=>\x20tenant','TEXT','MicrosoftAzure\x20=>\x20access_token','MicrosoftAzure\x20=>\x20Dynamics365\x20=>\x20remote_uri','exports','STRING','AmazonAWS','Google','MicrosoftAzure'];(function(_0x1e4f74,_0x559af){var _0x267e66=function(_0x66b7b8){while(--_0x66b7b8){_0x1e4f74['push'](_0x1e4f74['shift']());}};_0x267e66(++_0x559af);}(_0xb824,0x1b7));var _0x4b82=function(_0x58c372,_0x3c434a){_0x58c372=_0x58c372-0x0;var _0x258921=_0xb824[_0x58c372];return _0x258921;};'use strict';var Sequelize=require('sequelize');module[_0x4b82('0x0')]={'name':{'type':Sequelize[_0x4b82('0x1')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize['ENUM'](_0x4b82('0x2'),_0x4b82('0x3'),_0x4b82('0x4')),'allowNull':![],'validate':{'notEmpty':!![]}},'type':{'type':Sequelize[_0x4b82('0x5')](_0x4b82('0x6'),_0x4b82('0x7'))},'data1':{'type':Sequelize[_0x4b82('0x1')],'comment':'MicrosoftAzure\x20=>\x20client_id'},'data2':{'type':Sequelize['STRING'],'comment':_0x4b82('0x8')},'data3':{'type':Sequelize[_0x4b82('0x1')],'comment':'MicrosoftAzure\x20=>\x20client_secret'},'data4':{'type':Sequelize[_0x4b82('0x1')],'comment':'MicrosoftAzure\x20=>\x20redirect_uri'},'data5':{'type':Sequelize[_0x4b82('0x9')],'comment':_0x4b82('0xa')},'data6':{'type':Sequelize[_0x4b82('0x9')],'comment':'MicrosoftAzure\x20=>\x20refresh_token'},'data7':{'type':Sequelize[_0x4b82('0x9')],'comment':_0x4b82('0xb')}}; \ No newline at end of file +var _0x41f9=['Outlook365','Dynamics365','MicrosoftAzure\x20=>\x20access_token','TEXT','MicrosoftAzure\x20=>\x20refresh_token','MicrosoftAzure\x20=>\x20Dynamics365\x20=>\x20remote_uri','sequelize','exports','STRING','AmazonAWS','Google','MicrosoftAzure','ENUM'];(function(_0x335ef9,_0x280744){var _0x51ec48=function(_0x204824){while(--_0x204824){_0x335ef9['push'](_0x335ef9['shift']());}};_0x51ec48(++_0x280744);}(_0x41f9,0xe3));var _0x941f=function(_0x199572,_0x33e667){_0x199572=_0x199572-0x0;var _0x13cfa3=_0x41f9[_0x199572];return _0x13cfa3;};'use strict';var Sequelize=require(_0x941f('0x0'));module[_0x941f('0x1')]={'name':{'type':Sequelize[_0x941f('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize['ENUM'](_0x941f('0x3'),_0x941f('0x4'),_0x941f('0x5')),'allowNull':![],'validate':{'notEmpty':!![]}},'type':{'type':Sequelize[_0x941f('0x6')](_0x941f('0x7'),_0x941f('0x8'))},'data1':{'type':Sequelize[_0x941f('0x2')],'comment':'MicrosoftAzure\x20=>\x20client_id'},'data2':{'type':Sequelize['STRING'],'comment':'MicrosoftAzure\x20=>\x20tenant'},'data3':{'type':Sequelize[_0x941f('0x2')],'comment':'MicrosoftAzure\x20=>\x20client_secret'},'data4':{'type':Sequelize['STRING'],'comment':'MicrosoftAzure\x20=>\x20redirect_uri'},'data5':{'type':Sequelize['TEXT'],'comment':_0x941f('0x9')},'data6':{'type':Sequelize[_0x941f('0xa')],'comment':_0x941f('0xb')},'data7':{'type':Sequelize[_0x941f('0xa')],'comment':_0x941f('0xc')}}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.controller.js b/server/api/cloudProvider/cloudProvider.controller.js index 75d2e38..daffa4f 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 _0xfe65=['merge','VIRTUAL','filter','includeAll','include','rows','MicrosoftAzure','decryptString','data3','catch','params','fields','options','find','service','create','body','Name\x20parameter\x20not\x20specified','Service\x20parameter\x20not\x20specified','values','includes','Invalid\x20service\x20parameter.\x20Allowed\x20values:\x20','join','encryptString','findOne','generateMicrosoftAuthorizationUrl','user','oauth2MicrosoftCallback','error','get','state','parse','from','toString','ascii','isValidIdToken','id_token','oauth2Claims','Unable\x20to\x20validate\x20id_token','getOauth2MicrosoftAccessToken','code','data5','data6','refresh_token','startRefreshInterval','microsoftAuthorization:error','Invalid\x20authentication\x20state\x20parameter','Authentication\x20failed\x20for\x20cloud\x20provider\x20#%s','lodash','ioredis','../../components/parsers/qs','../../components/encryptor','api','../../mysqldb','redis','defaults','localhost','socket.io-emitter','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','stack','name','send','slice','map','CloudProvider','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick'];(function(_0x34566e,_0x296fbc){var _0x1b0238=function(_0x5bd03f){while(--_0x5bd03f){_0x34566e['push'](_0x34566e['shift']());}};_0x1b0238(++_0x296fbc);}(_0xfe65,0x1a8));var _0x5fe6=function(_0x2a3bde,_0x3f15b3){_0x2a3bde=_0x2a3bde-0x0;var _0x46f677=_0xfe65[_0x2a3bde];return _0x46f677;};'use strict';var _=require(_0x5fe6('0x0'));var Redis=require(_0x5fe6('0x1'));var qs=require(_0x5fe6('0x2'));var encryptor=require(_0x5fe6('0x3'));var config=require('../../config/environment');var logger=require('../../config/logger')(_0x5fe6('0x4'));var db=require(_0x5fe6('0x5'))['db'];var oauth=require('./cloudProvider.oauth');config[_0x5fe6('0x6')]=_[_0x5fe6('0x7')](config['redis'],{'host':_0x5fe6('0x8'),'port':0x18eb});var socket=require(_0x5fe6('0x9'))(new Redis(config[_0x5fe6('0x6')]));var redis=new Redis(config[_0x5fe6('0x6')]);function respondWithStatusCode(_0x567998,_0x38ffa2){_0x38ffa2=_0x38ffa2||0xcc;return function(_0x94f49){if(_0x94f49){return _0x567998[_0x5fe6('0xa')](_0x38ffa2);}return _0x567998[_0x5fe6('0xb')](_0x38ffa2)[_0x5fe6('0xc')]();};}function respondWithResult(_0x2534c3,_0x2b6ee4){_0x2b6ee4=_0x2b6ee4||0xc8;return function(_0x1d9540){if(_0x1d9540){return _0x2534c3[_0x5fe6('0xb')](_0x2b6ee4)[_0x5fe6('0xd')](_0x1d9540);}};}function respondWithFilteredResult(_0x6a5df7,_0x58cd0d){return function(_0x25b159){if(_0x25b159){var _0x598a40=typeof _0x58cd0d[_0x5fe6('0xe')]===_0x5fe6('0xf')&&typeof _0x58cd0d[_0x5fe6('0x10')]===_0x5fe6('0xf');var _0x5ceaec=_0x25b159[_0x5fe6('0x11')];var _0x46b2bf=_0x598a40?0x0:_0x58cd0d[_0x5fe6('0xe')];var _0x4d728f=_0x598a40?_0x25b159[_0x5fe6('0x11')]:_0x58cd0d['offset']+_0x58cd0d[_0x5fe6('0x10')];var _0x202834;if(_0x4d728f>=_0x5ceaec){_0x4d728f=_0x5ceaec;_0x202834=0xc8;}else{_0x202834=0xce;}_0x6a5df7[_0x5fe6('0xb')](_0x202834);return _0x6a5df7[_0x5fe6('0x12')](_0x5fe6('0x13'),_0x46b2bf+'-'+_0x4d728f+'/'+_0x5ceaec)['json'](_0x25b159);}return null;};}function saveUpdates(_0x1d01ab){return function(_0x4e61f7){if(_0x4e61f7){return _0x4e61f7[_0x5fe6('0x14')](_0x1d01ab)[_0x5fe6('0x15')](function(_0x5738b6){return _0x5738b6;});}return null;};}function removeEntity(_0x49522b){return function(_0x50fa85){if(_0x50fa85){return _0x50fa85[_0x5fe6('0x16')]()[_0x5fe6('0x15')](function(){_0x49522b[_0x5fe6('0xb')](0xcc)[_0x5fe6('0xc')]();});}};}function handleEntityNotFound(_0x75e417){return function(_0x1e97d5){if(!_0x1e97d5){_0x75e417[_0x5fe6('0xa')](0x194);}return _0x1e97d5;};}function handleError(_0x1cec84,_0x558c28){_0x558c28=_0x558c28||0x1f4;return function(_0x1bed3c){logger['error'](_0x1bed3c[_0x5fe6('0x17')]);if(_0x1bed3c[_0x5fe6('0x18')]){delete _0x1bed3c[_0x5fe6('0x18')];}_0x1cec84[_0x5fe6('0xb')](_0x558c28)[_0x5fe6('0x19')](_0x1bed3c);};}function maskClientSecret(_0x3e86cb){return _['padEnd'](_0x3e86cb[_0x5fe6('0x1a')](0x0,0x3),0x14,'*');}exports['index']=function(_0x35b763,_0xec8513){var _0x3e3a9d={},_0x48d4c9={},_0x422783={'count':0x0,'rows':[]};var _0x4c2ad6=_[_0x5fe6('0x1b')](db[_0x5fe6('0x1c')][_0x5fe6('0x1d')],function(_0x4364ec){return{'name':_0x4364ec[_0x5fe6('0x1e')],'type':_0x4364ec[_0x5fe6('0x1f')][_0x5fe6('0x20')]};});_0x48d4c9['model']=_[_0x5fe6('0x1b')](_0x4c2ad6,'name');_0x48d4c9[_0x5fe6('0x21')]=_[_0x5fe6('0x22')](_0x35b763[_0x5fe6('0x21')]);_0x48d4c9[_0x5fe6('0x23')]=_[_0x5fe6('0x24')](_0x48d4c9[_0x5fe6('0x25')],_0x48d4c9['query']);_0x3e3a9d[_0x5fe6('0x26')]=_[_0x5fe6('0x24')](_0x48d4c9[_0x5fe6('0x25')],qs['fields'](_0x35b763[_0x5fe6('0x21')]['fields']));_0x3e3a9d[_0x5fe6('0x26')]=_0x3e3a9d[_0x5fe6('0x26')][_0x5fe6('0x27')]?_0x3e3a9d[_0x5fe6('0x26')]:_0x48d4c9['model'];if(!_0x35b763[_0x5fe6('0x21')][_0x5fe6('0x28')](_0x5fe6('0x29'))){_0x3e3a9d[_0x5fe6('0x10')]=qs[_0x5fe6('0x10')](_0x35b763[_0x5fe6('0x21')]['limit']);_0x3e3a9d[_0x5fe6('0xe')]=qs[_0x5fe6('0xe')](_0x35b763[_0x5fe6('0x21')][_0x5fe6('0xe')]);}_0x3e3a9d[_0x5fe6('0x2a')]=qs[_0x5fe6('0x2b')](_0x35b763[_0x5fe6('0x21')][_0x5fe6('0x2b')]);_0x3e3a9d[_0x5fe6('0x2c')]=qs[_0x5fe6('0x23')](_[_0x5fe6('0x2d')](_0x35b763[_0x5fe6('0x21')],_0x48d4c9[_0x5fe6('0x23')]),_0x4c2ad6);if(_0x35b763['query']['filter']){_0x3e3a9d[_0x5fe6('0x2c')]=_[_0x5fe6('0x2e')](_0x3e3a9d[_0x5fe6('0x2c')],{'$or':_[_0x5fe6('0x1b')](_0x4c2ad6,function(_0x3f9996){if(_0x3f9996[_0x5fe6('0x1f')]!==_0x5fe6('0x2f')){var _0x3120eb={};_0x3120eb[_0x3f9996[_0x5fe6('0x18')]]={'$like':'%'+_0x35b763[_0x5fe6('0x21')][_0x5fe6('0x30')]+'%'};return _0x3120eb;}})});}_0x3e3a9d=_[_0x5fe6('0x2e')]({},_0x3e3a9d,_0x35b763['options']);var _0x2a6cc0={'where':_0x3e3a9d['where']};return db[_0x5fe6('0x1c')][_0x5fe6('0x11')](_0x2a6cc0)['then'](function(_0x5b130a){_0x422783[_0x5fe6('0x11')]=_0x5b130a;if(_0x35b763['query'][_0x5fe6('0x31')]){_0x3e3a9d[_0x5fe6('0x32')]=[{'all':!![]}];}return db[_0x5fe6('0x1c')]['findAll'](_0x3e3a9d);})[_0x5fe6('0x15')](function(_0x23b401){_0x422783[_0x5fe6('0x33')]=_[_0x5fe6('0x1b')](_0x23b401,function(_0x129f26){if(_0x129f26['service']===_0x5fe6('0x34')){var _0x4f8da0=encryptor[_0x5fe6('0x35')](_0x129f26[_0x5fe6('0x36')]);_0x129f26[_0x5fe6('0x36')]=maskClientSecret(_0x4f8da0);}return _0x129f26;});return _0x422783;})[_0x5fe6('0x15')](respondWithFilteredResult(_0xec8513,_0x3e3a9d))[_0x5fe6('0x37')](handleError(_0xec8513,null));};exports['show']=function(_0x1f823d,_0x48bb4f){var _0x5f52d4={'raw':!![],'where':{'id':_0x1f823d[_0x5fe6('0x38')]['id']}},_0x2f4cf4={};_0x2f4cf4[_0x5fe6('0x25')]=_[_0x5fe6('0x22')](db[_0x5fe6('0x1c')][_0x5fe6('0x1d')]);_0x2f4cf4[_0x5fe6('0x21')]=_[_0x5fe6('0x22')](_0x1f823d[_0x5fe6('0x21')]);_0x2f4cf4['filters']=_[_0x5fe6('0x24')](_0x2f4cf4[_0x5fe6('0x25')],_0x2f4cf4[_0x5fe6('0x21')]);_0x5f52d4[_0x5fe6('0x26')]=_[_0x5fe6('0x24')](_0x2f4cf4['model'],qs[_0x5fe6('0x39')](_0x1f823d[_0x5fe6('0x21')][_0x5fe6('0x39')]));_0x5f52d4[_0x5fe6('0x26')]=_0x5f52d4[_0x5fe6('0x26')][_0x5fe6('0x27')]?_0x5f52d4[_0x5fe6('0x26')]:_0x2f4cf4[_0x5fe6('0x25')];if(_0x1f823d['query'][_0x5fe6('0x31')]){_0x5f52d4[_0x5fe6('0x32')]=[{'all':!![]}];}_0x5f52d4=_[_0x5fe6('0x2e')]({},_0x5f52d4,_0x1f823d[_0x5fe6('0x3a')]);return db[_0x5fe6('0x1c')][_0x5fe6('0x3b')](_0x5f52d4)[_0x5fe6('0x15')](handleEntityNotFound(_0x48bb4f,null))[_0x5fe6('0x15')](function(_0x36d213){if(_0x36d213[_0x5fe6('0x3c')]===_0x5fe6('0x34')){var _0x556ba9=encryptor['decryptString'](_0x36d213[_0x5fe6('0x36')]);_0x36d213[_0x5fe6('0x36')]=maskClientSecret(_0x556ba9);}return _0x36d213;})[_0x5fe6('0x15')](respondWithResult(_0x48bb4f,null))['catch'](handleError(_0x48bb4f,null));};exports[_0x5fe6('0x3d')]=function(_0x486549,_0x23df3b){if(!_0x486549[_0x5fe6('0x3e')][_0x5fe6('0x18')])throw new Error(_0x5fe6('0x3f'));if(!_0x486549[_0x5fe6('0x3e')]['service'])throw new Error(_0x5fe6('0x40'));var _0x571a9e=db[_0x5fe6('0x1c')][_0x5fe6('0x1d')][_0x5fe6('0x3c')][_0x5fe6('0x41')];if(!_0x571a9e[_0x5fe6('0x42')](_0x486549[_0x5fe6('0x3e')][_0x5fe6('0x3c')]))throw new Error(_0x5fe6('0x43')+_0x571a9e[_0x5fe6('0x44')](',\x20'));if(_0x486549[_0x5fe6('0x3e')][_0x5fe6('0x3c')]===_0x5fe6('0x34')&&_0x486549[_0x5fe6('0x3e')]['data3']){_0x486549[_0x5fe6('0x3e')][_0x5fe6('0x36')]=encryptor[_0x5fe6('0x45')](_0x486549[_0x5fe6('0x3e')][_0x5fe6('0x36')]);}return db[_0x5fe6('0x1c')][_0x5fe6('0x3d')](_0x486549[_0x5fe6('0x3e')],{})[_0x5fe6('0x15')](respondWithResult(_0x23df3b,0xc9))['catch'](handleError(_0x23df3b,null));};exports[_0x5fe6('0x14')]=function(_0x3110c1,_0xeade2d){if(_0x3110c1[_0x5fe6('0x3e')]['id']){delete _0x3110c1[_0x5fe6('0x3e')]['id'];}return db[_0x5fe6('0x1c')][_0x5fe6('0x3b')]({'where':{'id':_0x3110c1[_0x5fe6('0x38')]['id']}})[_0x5fe6('0x15')](handleEntityNotFound(_0xeade2d,null))[_0x5fe6('0x15')](function(_0x24cd35){if(_0x24cd35[_0x5fe6('0x3c')]===_0x5fe6('0x34')&&_0x3110c1[_0x5fe6('0x3e')][_0x5fe6('0x36')]){_0x3110c1[_0x5fe6('0x3e')][_0x5fe6('0x36')]=encryptor[_0x5fe6('0x45')](_0x3110c1[_0x5fe6('0x3e')][_0x5fe6('0x36')]);}return _0x24cd35;})[_0x5fe6('0x15')](saveUpdates(_0x3110c1[_0x5fe6('0x3e')],null))[_0x5fe6('0x15')](respondWithResult(_0xeade2d,null))['catch'](handleError(_0xeade2d,null));};exports[_0x5fe6('0x16')]=function(_0x48dc62,_0x312a8f){return db['CloudProvider']['find']({'where':{'id':_0x48dc62[_0x5fe6('0x38')]['id']}})[_0x5fe6('0x15')](handleEntityNotFound(_0x312a8f,null))[_0x5fe6('0x15')](removeEntity(_0x312a8f,null))[_0x5fe6('0x37')](handleError(_0x312a8f,null));};exports['oauth2MicrosoftAuthorize']=function(_0x2d2469,_0x1e3402){return db[_0x5fe6('0x1c')][_0x5fe6('0x46')]({'where':{'id':_0x2d2469[_0x5fe6('0x38')]['id']},'raw':!![]})['then'](function(_0x1440b7){if(!_0x1440b7)return _0x1e3402['sendStatus'](0x194);return{'url':oauth[_0x5fe6('0x47')](_0x1440b7,_0x2d2469[_0x5fe6('0x48')]['id'])};})[_0x5fe6('0x15')](respondWithResult(_0x1e3402,null))['catch'](handleError(_0x1e3402,null));};exports[_0x5fe6('0x49')]=function(_0x45044c,_0x525d07){var _0x49f213=_0x45044c[_0x5fe6('0x3e')];var _0xb848d4;var _0x3d8856;if(_0x49f213[_0x5fe6('0x4a')])throw _0x49f213;redis[_0x5fe6('0x4b')](_0x49f213[_0x5fe6('0x4c')])[_0x5fe6('0x15')](function(_0x55b99f){if(!_0x55b99f)throw new Error('Invalid\x20state\x20parameter');_0xb848d4=JSON[_0x5fe6('0x4d')](_0x55b99f);var _0x14ac9e=Buffer[_0x5fe6('0x4e')](_0x49f213[_0x5fe6('0x4c')],'base64')[_0x5fe6('0x4f')](_0x5fe6('0x50'));_0x3d8856=JSON[_0x5fe6('0x4d')](_0x14ac9e);if(!oauth[_0x5fe6('0x51')](_0x49f213[_0x5fe6('0x52')],_0xb848d4[_0x5fe6('0x53')]))throw new Error(_0x5fe6('0x54'));redis['del'](_0x49f213[_0x5fe6('0x4c')]);return oauth[_0x5fe6('0x55')](_0x49f213[_0x5fe6('0x56')],_0xb848d4);})[_0x5fe6('0x15')](function(_0x1c2f11){_0xb848d4[_0x5fe6('0x57')]=_0x1c2f11['access_token'];_0xb848d4[_0x5fe6('0x58')]=_0x1c2f11[_0x5fe6('0x59')];return db['CloudProvider'][_0x5fe6('0x14')]({'data5':_0xb848d4[_0x5fe6('0x57')],'data6':_0xb848d4['data6']},{'where':{'id':_0xb848d4['id']}});})[_0x5fe6('0x15')](function(){oauth[_0x5fe6('0x5a')](_0xb848d4);socket['emit']('microsoftAuthorization:success',{'id':_0x3d8856['id']});return;})[_0x5fe6('0x15')](respondWithStatusCode(_0x525d07,null))[_0x5fe6('0x37')](function(_0x271c18){if(_0x3d8856){socket['emit'](_0x5fe6('0x5b'),{'id':_0x3d8856['id']});}if(!_0xb848d4){logger[_0x5fe6('0x4a')](_0x5fe6('0x5c'),_0x271c18);return _0x525d07[_0x5fe6('0xb')](0x1f4)[_0x5fe6('0x19')](_0x271c18['message']);}logger['error'](_0x5fe6('0x5d'),_0xb848d4['id'],_0x271c18);});}; \ No newline at end of file +var _0x3978=['findOne','user','oauth2MicrosoftCallback','get','Invalid\x20state\x20parameter','parse','from','state','base64','id_token','oauth2Claims','Unable\x20to\x20validate\x20id_token','del','data5','access_token','data6','refresh_token','emit','microsoftAuthorization:success','microsoftAuthorization:error','message','Authentication\x20failed\x20for\x20cloud\x20provider\x20#%s','../../components/parsers/qs','../../components/encryptor','../../config/environment','../../config/logger','api','../../mysqldb','redis','defaults','localhost','socket.io-emitter','sendStatus','end','status','offset','undefined','limit','count','set','json','then','destroy','error','name','index','CloudProvider','rawAttributes','key','map','keys','query','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','service','MicrosoftAzure','decryptString','data3','params','find','catch','body','Service\x20parameter\x20not\x20specified','includes','Invalid\x20service\x20parameter.\x20Allowed\x20values:\x20','join','encryptString','update','oauth2MicrosoftAuthorize'];(function(_0xe50651,_0x78b476){var _0xc8931c=function(_0x1c2902){while(--_0x1c2902){_0xe50651['push'](_0xe50651['shift']());}};_0xc8931c(++_0x78b476);}(_0x3978,0x6e));var _0x8397=function(_0x101f0d,_0x223697){_0x101f0d=_0x101f0d-0x0;var _0x59aade=_0x3978[_0x101f0d];return _0x59aade;};'use strict';var _=require('lodash');var Redis=require('ioredis');var qs=require(_0x8397('0x0'));var encryptor=require(_0x8397('0x1'));var config=require(_0x8397('0x2'));var logger=require(_0x8397('0x3'))(_0x8397('0x4'));var db=require(_0x8397('0x5'))['db'];var oauth=require('./cloudProvider.oauth');config[_0x8397('0x6')]=_[_0x8397('0x7')](config[_0x8397('0x6')],{'host':_0x8397('0x8'),'port':0x18eb});var socket=require(_0x8397('0x9'))(new Redis(config[_0x8397('0x6')]));var redis=new Redis(config[_0x8397('0x6')]);function respondWithStatusCode(_0xa2b089,_0x3ae5e4){_0x3ae5e4=_0x3ae5e4||0xcc;return function(_0x7ac31f){if(_0x7ac31f){return _0xa2b089[_0x8397('0xa')](_0x3ae5e4);}return _0xa2b089['status'](_0x3ae5e4)[_0x8397('0xb')]();};}function respondWithResult(_0x5ecc73,_0x36c13a){_0x36c13a=_0x36c13a||0xc8;return function(_0x32fae5){if(_0x32fae5){return _0x5ecc73[_0x8397('0xc')](_0x36c13a)['json'](_0x32fae5);}};}function respondWithFilteredResult(_0x36b24e,_0x2b93c7){return function(_0x343b1f){if(_0x343b1f){var _0x4272b9=typeof _0x2b93c7[_0x8397('0xd')]===_0x8397('0xe')&&typeof _0x2b93c7[_0x8397('0xf')]===_0x8397('0xe');var _0x509d74=_0x343b1f[_0x8397('0x10')];var _0x59f438=_0x4272b9?0x0:_0x2b93c7['offset'];var _0x44f56d=_0x4272b9?_0x343b1f[_0x8397('0x10')]:_0x2b93c7['offset']+_0x2b93c7[_0x8397('0xf')];var _0x5c5bc5;if(_0x44f56d>=_0x509d74){_0x44f56d=_0x509d74;_0x5c5bc5=0xc8;}else{_0x5c5bc5=0xce;}_0x36b24e[_0x8397('0xc')](_0x5c5bc5);return _0x36b24e[_0x8397('0x11')]('Content-Range',_0x59f438+'-'+_0x44f56d+'/'+_0x509d74)[_0x8397('0x12')](_0x343b1f);}return null;};}function saveUpdates(_0x6a9af7){return function(_0x2db637){if(_0x2db637){return _0x2db637['update'](_0x6a9af7)[_0x8397('0x13')](function(_0x25c5ef){return _0x25c5ef;});}return null;};}function removeEntity(_0x33d7b5){return function(_0x2c76ae){if(_0x2c76ae){return _0x2c76ae[_0x8397('0x14')]()[_0x8397('0x13')](function(){_0x33d7b5['status'](0xcc)[_0x8397('0xb')]();});}};}function handleEntityNotFound(_0x137fe0){return function(_0x1c01c1){if(!_0x1c01c1){_0x137fe0[_0x8397('0xa')](0x194);}return _0x1c01c1;};}function handleError(_0x6303f0,_0x25a193){_0x25a193=_0x25a193||0x1f4;return function(_0x5cccd1){logger[_0x8397('0x15')](_0x5cccd1['stack']);if(_0x5cccd1[_0x8397('0x16')]){delete _0x5cccd1['name'];}_0x6303f0[_0x8397('0xc')](_0x25a193)['send'](_0x5cccd1);};}function maskClientSecret(_0x1f5720){return _['padEnd'](_0x1f5720['slice'](0x0,0x3),0x14,'*');}exports[_0x8397('0x17')]=function(_0x3c4633,_0xb50b8c){var _0x257121={},_0xf43617={},_0x27b304={'count':0x0,'rows':[]};var _0xfba76c=_['map'](db[_0x8397('0x18')][_0x8397('0x19')],function(_0x52e9b5){return{'name':_0x52e9b5['fieldName'],'type':_0x52e9b5['type'][_0x8397('0x1a')]};});_0xf43617['model']=_[_0x8397('0x1b')](_0xfba76c,_0x8397('0x16'));_0xf43617['query']=_[_0x8397('0x1c')](_0x3c4633[_0x8397('0x1d')]);_0xf43617['filters']=_[_0x8397('0x1e')](_0xf43617[_0x8397('0x1f')],_0xf43617[_0x8397('0x1d')]);_0x257121[_0x8397('0x20')]=_[_0x8397('0x1e')](_0xf43617[_0x8397('0x1f')],qs[_0x8397('0x21')](_0x3c4633[_0x8397('0x1d')]['fields']));_0x257121['attributes']=_0x257121[_0x8397('0x20')][_0x8397('0x22')]?_0x257121[_0x8397('0x20')]:_0xf43617[_0x8397('0x1f')];if(!_0x3c4633[_0x8397('0x1d')][_0x8397('0x23')](_0x8397('0x24'))){_0x257121[_0x8397('0xf')]=qs['limit'](_0x3c4633[_0x8397('0x1d')]['limit']);_0x257121[_0x8397('0xd')]=qs['offset'](_0x3c4633[_0x8397('0x1d')]['offset']);}_0x257121[_0x8397('0x25')]=qs['sort'](_0x3c4633['query'][_0x8397('0x26')]);_0x257121[_0x8397('0x27')]=qs[_0x8397('0x28')](_[_0x8397('0x29')](_0x3c4633[_0x8397('0x1d')],_0xf43617[_0x8397('0x28')]),_0xfba76c);if(_0x3c4633[_0x8397('0x1d')][_0x8397('0x2a')]){_0x257121[_0x8397('0x27')]=_[_0x8397('0x2b')](_0x257121[_0x8397('0x27')],{'$or':_[_0x8397('0x1b')](_0xfba76c,function(_0x4d0cf9){if(_0x4d0cf9[_0x8397('0x2c')]!==_0x8397('0x2d')){var _0x527022={};_0x527022[_0x4d0cf9['name']]={'$like':'%'+_0x3c4633['query'][_0x8397('0x2a')]+'%'};return _0x527022;}})});}_0x257121=_[_0x8397('0x2b')]({},_0x257121,_0x3c4633[_0x8397('0x2e')]);var _0x3065af={'where':_0x257121[_0x8397('0x27')]};return db[_0x8397('0x18')][_0x8397('0x10')](_0x3065af)[_0x8397('0x13')](function(_0x32006a){_0x27b304[_0x8397('0x10')]=_0x32006a;if(_0x3c4633[_0x8397('0x1d')][_0x8397('0x2f')]){_0x257121[_0x8397('0x30')]=[{'all':!![]}];}return db[_0x8397('0x18')][_0x8397('0x31')](_0x257121);})[_0x8397('0x13')](function(_0x96439b){_0x27b304[_0x8397('0x32')]=_[_0x8397('0x1b')](_0x96439b,function(_0x260285){if(_0x260285[_0x8397('0x33')]===_0x8397('0x34')){var _0x1d5b57=encryptor[_0x8397('0x35')](_0x260285[_0x8397('0x36')]);_0x260285[_0x8397('0x36')]=maskClientSecret(_0x1d5b57);}return _0x260285;});return _0x27b304;})['then'](respondWithFilteredResult(_0xb50b8c,_0x257121))['catch'](handleError(_0xb50b8c,null));};exports['show']=function(_0x3b64d1,_0x2c65ee){var _0x180ece={'raw':!![],'where':{'id':_0x3b64d1[_0x8397('0x37')]['id']}},_0x4e637e={};_0x4e637e[_0x8397('0x1f')]=_[_0x8397('0x1c')](db['CloudProvider'][_0x8397('0x19')]);_0x4e637e[_0x8397('0x1d')]=_[_0x8397('0x1c')](_0x3b64d1[_0x8397('0x1d')]);_0x4e637e[_0x8397('0x28')]=_['intersection'](_0x4e637e['model'],_0x4e637e[_0x8397('0x1d')]);_0x180ece[_0x8397('0x20')]=_[_0x8397('0x1e')](_0x4e637e[_0x8397('0x1f')],qs[_0x8397('0x21')](_0x3b64d1[_0x8397('0x1d')][_0x8397('0x21')]));_0x180ece[_0x8397('0x20')]=_0x180ece[_0x8397('0x20')]['length']?_0x180ece['attributes']:_0x4e637e[_0x8397('0x1f')];if(_0x3b64d1['query'][_0x8397('0x2f')]){_0x180ece[_0x8397('0x30')]=[{'all':!![]}];}_0x180ece=_[_0x8397('0x2b')]({},_0x180ece,_0x3b64d1['options']);return db[_0x8397('0x18')][_0x8397('0x38')](_0x180ece)[_0x8397('0x13')](handleEntityNotFound(_0x2c65ee,null))[_0x8397('0x13')](function(_0x2a138c){if(_0x2a138c[_0x8397('0x33')]==='MicrosoftAzure'){var _0x1d0d26=encryptor['decryptString'](_0x2a138c[_0x8397('0x36')]);_0x2a138c[_0x8397('0x36')]=maskClientSecret(_0x1d0d26);}return _0x2a138c;})[_0x8397('0x13')](respondWithResult(_0x2c65ee,null))[_0x8397('0x39')](handleError(_0x2c65ee,null));};exports['create']=function(_0x13f63a,_0x57ba7c){if(!_0x13f63a[_0x8397('0x3a')][_0x8397('0x16')])throw new Error('Name\x20parameter\x20not\x20specified');if(!_0x13f63a['body'][_0x8397('0x33')])throw new Error(_0x8397('0x3b'));var _0x1bc0c2=db[_0x8397('0x18')][_0x8397('0x19')][_0x8397('0x33')]['values'];if(!_0x1bc0c2[_0x8397('0x3c')](_0x13f63a['body']['service']))throw new Error(_0x8397('0x3d')+_0x1bc0c2[_0x8397('0x3e')](',\x20'));if(_0x13f63a['body']['service']===_0x8397('0x34')&&_0x13f63a['body'][_0x8397('0x36')]){_0x13f63a[_0x8397('0x3a')][_0x8397('0x36')]=encryptor[_0x8397('0x3f')](_0x13f63a[_0x8397('0x3a')]['data3']);}return db[_0x8397('0x18')]['create'](_0x13f63a['body'],{})[_0x8397('0x13')](respondWithResult(_0x57ba7c,0xc9))[_0x8397('0x39')](handleError(_0x57ba7c,null));};exports[_0x8397('0x40')]=function(_0x88ea75,_0x411cbb){if(_0x88ea75[_0x8397('0x3a')]['id']){delete _0x88ea75['body']['id'];}return db[_0x8397('0x18')][_0x8397('0x38')]({'where':{'id':_0x88ea75['params']['id']}})[_0x8397('0x13')](handleEntityNotFound(_0x411cbb,null))[_0x8397('0x13')](function(_0x569418){if(_0x569418['service']==='MicrosoftAzure'&&_0x88ea75['body'][_0x8397('0x36')]){_0x88ea75[_0x8397('0x3a')][_0x8397('0x36')]=encryptor[_0x8397('0x3f')](_0x88ea75[_0x8397('0x3a')]['data3']);}return _0x569418;})[_0x8397('0x13')](saveUpdates(_0x88ea75[_0x8397('0x3a')],null))['then'](respondWithResult(_0x411cbb,null))[_0x8397('0x39')](handleError(_0x411cbb,null));};exports[_0x8397('0x14')]=function(_0x163338,_0xef32a){return db[_0x8397('0x18')][_0x8397('0x38')]({'where':{'id':_0x163338['params']['id']}})[_0x8397('0x13')](handleEntityNotFound(_0xef32a,null))[_0x8397('0x13')](removeEntity(_0xef32a,null))[_0x8397('0x39')](handleError(_0xef32a,null));};exports[_0x8397('0x41')]=function(_0x39437b,_0x4a9b0d){return db['CloudProvider'][_0x8397('0x42')]({'where':{'id':_0x39437b[_0x8397('0x37')]['id']},'raw':!![]})[_0x8397('0x13')](function(_0x50c486){if(!_0x50c486)return _0x4a9b0d[_0x8397('0xa')](0x194);return{'url':oauth['generateMicrosoftAuthorizationUrl'](_0x50c486,_0x39437b[_0x8397('0x43')]['id'])};})['then'](respondWithResult(_0x4a9b0d,null))[_0x8397('0x39')](handleError(_0x4a9b0d,null));};exports[_0x8397('0x44')]=function(_0x21c0d3,_0x3ec255){var _0x219246=_0x21c0d3[_0x8397('0x3a')];var _0x35e66d;var _0x5c591a;if(_0x219246[_0x8397('0x15')])throw _0x219246;redis[_0x8397('0x45')](_0x219246['state'])[_0x8397('0x13')](function(_0x48467e){if(!_0x48467e)throw new Error(_0x8397('0x46'));_0x35e66d=JSON[_0x8397('0x47')](_0x48467e);var _0x12820a=Buffer[_0x8397('0x48')](_0x219246[_0x8397('0x49')],_0x8397('0x4a'))['toString']('ascii');_0x5c591a=JSON['parse'](_0x12820a);if(!oauth['isValidIdToken'](_0x219246[_0x8397('0x4b')],_0x35e66d[_0x8397('0x4c')]))throw new Error(_0x8397('0x4d'));redis[_0x8397('0x4e')](_0x219246[_0x8397('0x49')]);return oauth['getOauth2MicrosoftAccessToken'](_0x219246['code'],_0x35e66d);})[_0x8397('0x13')](function(_0x3cbf7f){_0x35e66d[_0x8397('0x4f')]=_0x3cbf7f[_0x8397('0x50')];_0x35e66d[_0x8397('0x51')]=_0x3cbf7f[_0x8397('0x52')];return db['CloudProvider']['update']({'data5':_0x35e66d['data5'],'data6':_0x35e66d[_0x8397('0x51')]},{'where':{'id':_0x35e66d['id']}});})['then'](function(){oauth['startRefreshInterval'](_0x35e66d);socket[_0x8397('0x53')](_0x8397('0x54'),{'id':_0x5c591a['id']});return;})[_0x8397('0x13')](respondWithStatusCode(_0x3ec255,null))[_0x8397('0x39')](function(_0x55b474){if(_0x5c591a){socket[_0x8397('0x53')](_0x8397('0x55'),{'id':_0x5c591a['id']});}if(!_0x35e66d){logger['error']('Invalid\x20authentication\x20state\x20parameter',_0x55b474);return _0x3ec255[_0x8397('0xc')](0x1f4)['send'](_0x55b474[_0x8397('0x56')]);}logger[_0x8397('0x15')](_0x8397('0x57'),_0x35e66d['id'],_0x55b474);});}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.model.js b/server/api/cloudProvider/cloudProvider.model.js index 7767b03..f25f580 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 _0x7634=['./cloudProvider.attributes','CloudProvider','cloud_providers','lodash','api','moment','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x367acb,_0x1378f5){var _0x492fdc=function(_0x531bac){while(--_0x531bac){_0x367acb['push'](_0x367acb['shift']());}};_0x492fdc(++_0x1378f5);}(_0x7634,0x107));var _0x4763=function(_0x308275,_0x5d8a30){_0x308275=_0x308275-0x0;var _0x219f2e=_0x7634[_0x308275];return _0x219f2e;};'use strict';var _=require(_0x4763('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x4763('0x1'));var moment=require(_0x4763('0x2'));var BPromise=require(_0x4763('0x3'));var rp=require(_0x4763('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4763('0x5'));var config=require(_0x4763('0x6'));var attributes=require(_0x4763('0x7'));module['exports']=function(_0x351bd5,_0x415b2a){return _0x351bd5['define'](_0x4763('0x8'),attributes,{'tableName':_0x4763('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7314=['../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./cloudProvider.attributes','CloudProvider','lodash','util'];(function(_0x8da7e1,_0x57cd87){var _0x5b670c=function(_0x5cbe9e){while(--_0x5cbe9e){_0x8da7e1['push'](_0x8da7e1['shift']());}};_0x5b670c(++_0x57cd87);}(_0x7314,0x1b6));var _0x4731=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x7314[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x4731('0x0'));var util=require(_0x4731('0x1'));var logger=require(_0x4731('0x2'))(_0x4731('0x3'));var moment=require('moment');var BPromise=require(_0x4731('0x4'));var rp=require(_0x4731('0x5'));var fs=require('fs');var path=require(_0x4731('0x6'));var rimraf=require(_0x4731('0x7'));var config=require(_0x4731('0x8'));var attributes=require(_0x4731('0x9'));module['exports']=function(_0x5aa514,_0x114c3a){return _0x5aa514['define'](_0x4731('0xa'),attributes,{'tableName':'cloud_providers','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.oauth.js b/server/api/cloudProvider/cloudProvider.oauth.js index c432957..345f06e 100644 --- a/server/api/cloudProvider/cloudProvider.oauth.js +++ b/server/api/cloudProvider/cloudProvider.oauth.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1261=['toString','randomBytes','data1','response_type','redirect_uri','response_mode','form_post','state','key','value','oauth2Claims','replace','set','stringify','decode','payload','iss','aud','nonce','isAfter','exp','then','data3','CloudProvider','refresh_token','data6','data4','POST','data5','access_token','update','error','decryptString','intervals','bind','findAll','all','catch','[CLOUD_PROVIDER]\x20Error\x20while\x20refreshing\x20the\x20tokens\x20after\x20service\x20restart','exports','crypto','jsonwebtoken','moment','ioredis','request-promise','util','../../components/encryptor','../../config/environment','../../config/logger','api','redis','defaults','localhost','https://login.microsoftonline.com/{TENANT_ID}/oauth2/v2.0','openid','profile','offline_access','https://outlook.office365.com/IMAP.AccessAsUser.All','https://outlook.office.com/POP.AccessAsUser.All','/token','map','type','Dynamics365','push','data7','/.default','join','Outlook365','{TENANT_ID}','data2','id_token'];(function(_0x15e800,_0x4a82f9){var _0x176659=function(_0x589597){while(--_0x589597){_0x15e800['push'](_0x15e800['shift']());}};_0x176659(++_0x4a82f9);}(_0x1261,0x144));var _0x1126=function(_0x1ee5be,_0x5f46e3){_0x1ee5be=_0x1ee5be-0x0;var _0x177140=_0x1261[_0x1ee5be];return _0x177140;};'use strict';var _=require('lodash');var crypto=require(_0x1126('0x0'));var jwt=require(_0x1126('0x1'));var moment=require(_0x1126('0x2'));var Redis=require(_0x1126('0x3'));var rp=require(_0x1126('0x4'));var util=require(_0x1126('0x5'));var encryptor=require(_0x1126('0x6'));var config=require(_0x1126('0x7'));var logger=require(_0x1126('0x8'))(_0x1126('0x9'));var schedule=require('../../config/schedule/cloud-provider');var db=require('../../mysqldb')['db'];config[_0x1126('0xa')]=_[_0x1126('0xb')](config['redis'],{'host':_0x1126('0xc'),'port':0x18eb});var redis=new Redis(config[_0x1126('0xa')]);var MICROSOFT_AUTH_URL=_0x1126('0xd');var AZURE_AUTH_SCOPES={'Outlook365':[_0x1126('0xe'),_0x1126('0xf'),'email',_0x1126('0x10'),_0x1126('0x11'),_0x1126('0x12'),'https://outlook.office.com/SMTP.Send'],'Dynamics365':[_0x1126('0xe'),'offline_access']};var MICROSOFT_AUTH_ENDPOINT='/authorize';var MICROSOFT_TOKEN_ENDPOINT=_0x1126('0x13');var OAUTH_REFRESH_INTERVAL=0xfa;function getAuthorizationScopes(_0x561b93){var _0x15e89b=_[_0x1126('0x14')](AZURE_AUTH_SCOPES[_0x561b93[_0x1126('0x15')]]);if(_0x561b93[_0x1126('0x15')]===_0x1126('0x16'))_0x15e89b[_0x1126('0x17')](_0x561b93[_0x1126('0x18')]+_0x1126('0x19'));return _0x15e89b[_0x1126('0x1a')]('\x20');}function getAccessTokenScope(_0x53a8f0){if(_0x53a8f0['type']===_0x1126('0x1b'))return _0x1126('0x11');if(_0x53a8f0[_0x1126('0x15')]==='Dynamics365')return _0x53a8f0[_0x1126('0x18')]+'/.default';}function generateMicrosoftAuthorizationUrl(_0x35fe9f,_0x42f379){var _0x257b5f=MICROSOFT_AUTH_URL['replace'](_0x1126('0x1c'),_0x35fe9f[_0x1126('0x1d')]);var _0x4a7b49=['code',_0x1126('0x1e')];var _0x2b2487=Buffer['from'](JSON['stringify']({'id':_0x42f379}))[_0x1126('0x1f')]('base64');var _0x22ed37=crypto[_0x1126('0x20')](0x10)[_0x1126('0x1f')]('hex');var _0x2a08ba=getAuthorizationScopes(_0x35fe9f);var _0x49d209=[{'key':'client_id','value':_0x35fe9f[_0x1126('0x21')]},{'key':_0x1126('0x22'),'value':encodeURIComponent(_0x4a7b49[_0x1126('0x1a')]('\x20'))},{'key':_0x1126('0x23'),'value':_0x35fe9f['data4']},{'key':_0x1126('0x24'),'value':_0x1126('0x25')},{'key':'scope','value':encodeURIComponent(_0x2a08ba)},{'key':_0x1126('0x26'),'value':_0x2b2487},{'key':'nonce','value':_0x22ed37},{'key':'prompt','value':'login'}];var _0x2199d9=_0x257b5f+MICROSOFT_AUTH_ENDPOINT+'?'+_[_0x1126('0x14')](_0x49d209,function(_0x329914){return _0x329914[_0x1126('0x27')]+'='+_0x329914[_0x1126('0x28')];})[_0x1126('0x1a')]('&');_0x35fe9f[_0x1126('0x29')]={'issuer':_0x257b5f[_0x1126('0x2a')]('oauth2/',''),'audience':_0x35fe9f[_0x1126('0x21')],'state':_0x2b2487,'nonce':_0x22ed37};redis[_0x1126('0x2b')](_0x2b2487,JSON[_0x1126('0x2c')](_0x35fe9f));return _0x2199d9;}function isValidIdToken(_0x5ddf63,_0x541bc9){try{var _0xeb7d89=jwt[_0x1126('0x2d')](_0x5ddf63,{'complete':!![]});var _0x55e195=_0xeb7d89[_0x1126('0x2e')];if(_0x55e195[_0x1126('0x2f')]!==_0x541bc9['issuer'])return![];if(_0x55e195[_0x1126('0x30')]!==_0x541bc9['audience'])return![];if(_0x55e195[_0x1126('0x31')]!==_0x541bc9['nonce'])return![];if(moment()[_0x1126('0x32')](moment['unix'](_0x55e195[_0x1126('0x33')])))return![];return!![];}catch(_0x5f2611){throw _0x5f2611;}}function refreshOauth2MicrosoftAccessToken(_0x5252e0){return Promise['resolve']()[_0x1126('0x34')](function(){if(_0x5252e0[_0x1126('0x35')])return _0x5252e0;return db[_0x1126('0x36')]['findOne']({'where':{'id':_0x5252e0['id']},'raw':!![]});})[_0x1126('0x34')](function(_0x226afb){var _0x56f7f8={'grant_type':_0x1126('0x37'),'refresh_token':_0x226afb[_0x1126('0x38')],'scope':getAccessTokenScope(_0x226afb),'redirect_uri':_0x226afb[_0x1126('0x39')],'client_id':_0x226afb[_0x1126('0x21')],'client_secret':encryptor['decryptString'](_0x226afb['data3'])};var _0x2a7edc={'method':_0x1126('0x3a'),'uri':MICROSOFT_AUTH_URL[_0x1126('0x2a')](_0x1126('0x1c'),_0x226afb['data2'])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x56f7f8,'json':!![]};return rp(_0x2a7edc);})[_0x1126('0x34')](function(_0x6f4312){_0x5252e0[_0x1126('0x3b')]=_0x6f4312[_0x1126('0x3c')];_0x5252e0[_0x1126('0x38')]=_0x6f4312['refresh_token'];return db[_0x1126('0x36')][_0x1126('0x3d')]({'data5':_0x5252e0[_0x1126('0x3b')],'data6':_0x5252e0[_0x1126('0x38')]},{'where':{'id':_0x5252e0['id']}});})['then'](function(){return _0x5252e0;})['catch'](function(_0x22827a){logger[_0x1126('0x3e')]('Failed\x20to\x20refresh\x20access\x20token\x20for\x20cloud\x20provider\x20#%s',_0x5252e0['id'],_0x22827a);});}function getOauth2MicrosoftAccessToken(_0xde37cf,_0xf3c21b){var _0x11b0f6={'grant_type':'authorization_code','code':_0xde37cf,'scope':getAccessTokenScope(_0xf3c21b),'redirect_uri':_0xf3c21b['data4'],'client_id':_0xf3c21b[_0x1126('0x21')],'client_secret':encryptor[_0x1126('0x3f')](_0xf3c21b[_0x1126('0x35')])};var _0x156554={'method':'POST','uri':MICROSOFT_AUTH_URL[_0x1126('0x2a')]('{TENANT_ID}',_0xf3c21b[_0x1126('0x1d')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x11b0f6,'json':!![]};return rp(_0x156554);}function startRefreshInterval(_0x20e43a){var _0xfa96e0=schedule[_0x1126('0x40')];if(_0xfa96e0[_0x20e43a['id']])clearInterval(_0xfa96e0[_0x20e43a['id']]);_0xfa96e0[_0x20e43a['id']]=setInterval(refreshOauth2MicrosoftAccessToken[_0x1126('0x41')](this,{'id':_0x20e43a['id']}),OAUTH_REFRESH_INTERVAL*0x3e8);schedule['intervals']=_0xfa96e0;}function startAllRefreshIntervals(){return db[_0x1126('0x36')][_0x1126('0x42')]({'where':{'data6':{'$ne':null}},'raw':!![]})[_0x1126('0x34')](function(_0x397e3b){var _0x3469a2=_0x397e3b[_0x1126('0x14')](function(_0x3052f9){return refreshOauth2MicrosoftAccessToken(_0x3052f9)['then'](function(_0x1c8d8a){startRefreshInterval(_0x1c8d8a);});});return Promise[_0x1126('0x43')](_0x3469a2);})[_0x1126('0x44')](function(_0xf3a0bd){var _0xcf0483=_0xf3a0bd?util['inspect'](_0xf3a0bd,{'showHidden':![],'depth':null}):'';logger['error'](_0x1126('0x45'),_0xcf0483);});}module[_0x1126('0x46')]={'generateMicrosoftAuthorizationUrl':generateMicrosoftAuthorizationUrl,'getOauth2MicrosoftAccessToken':getOauth2MicrosoftAccessToken,'isValidIdToken':isValidIdToken,'startAllRefreshIntervals':startAllRefreshIntervals,'refreshOauth2MicrosoftAccessToken':refreshOauth2MicrosoftAccessToken,'startRefreshInterval':startRefreshInterval}; \ No newline at end of file +var _0x5f2f=['stringify','toString','randomBytes','data1','response_type','redirect_uri','data4','form_post','scope','state','nonce','prompt','key','value','oauth2Claims','oauth2/','decode','issuer','aud','audience','isAfter','unix','exp','data3','findOne','refresh_token','data6','decryptString','POST','then','data5','update','catch','intervals','CloudProvider','findAll','inspect','error','[CLOUD_PROVIDER]\x20Error\x20while\x20refreshing\x20the\x20tokens\x20after\x20service\x20restart','exports','lodash','crypto','jsonwebtoken','moment','ioredis','request-promise','util','../../components/encryptor','api','../../config/schedule/cloud-provider','../../mysqldb','redis','defaults','https://login.microsoftonline.com/{TENANT_ID}/oauth2/v2.0','openid','email','offline_access','https://outlook.office365.com/IMAP.AccessAsUser.All','https://outlook.office.com/SMTP.Send','/authorize','/token','map','type','Dynamics365','push','/.default','join','Outlook365','data7','replace','{TENANT_ID}','data2','code','id_token','from'];(function(_0x386c3e,_0x44a375){var _0x4b8e13=function(_0x583c8f){while(--_0x583c8f){_0x386c3e['push'](_0x386c3e['shift']());}};_0x4b8e13(++_0x44a375);}(_0x5f2f,0x73));var _0xf5f2=function(_0x383f7f,_0x11b7c2){_0x383f7f=_0x383f7f-0x0;var _0x4e2f71=_0x5f2f[_0x383f7f];return _0x4e2f71;};'use strict';var _=require(_0xf5f2('0x0'));var crypto=require(_0xf5f2('0x1'));var jwt=require(_0xf5f2('0x2'));var moment=require(_0xf5f2('0x3'));var Redis=require(_0xf5f2('0x4'));var rp=require(_0xf5f2('0x5'));var util=require(_0xf5f2('0x6'));var encryptor=require(_0xf5f2('0x7'));var config=require('../../config/environment');var logger=require('../../config/logger')(_0xf5f2('0x8'));var schedule=require(_0xf5f2('0x9'));var db=require(_0xf5f2('0xa'))['db'];config[_0xf5f2('0xb')]=_[_0xf5f2('0xc')](config[_0xf5f2('0xb')],{'host':'localhost','port':0x18eb});var redis=new Redis(config[_0xf5f2('0xb')]);var MICROSOFT_AUTH_URL=_0xf5f2('0xd');var AZURE_AUTH_SCOPES={'Outlook365':[_0xf5f2('0xe'),'profile',_0xf5f2('0xf'),_0xf5f2('0x10'),_0xf5f2('0x11'),'https://outlook.office.com/POP.AccessAsUser.All',_0xf5f2('0x12')],'Dynamics365':['openid','offline_access']};var MICROSOFT_AUTH_ENDPOINT=_0xf5f2('0x13');var MICROSOFT_TOKEN_ENDPOINT=_0xf5f2('0x14');var OAUTH_REFRESH_INTERVAL=0xfa;function getAuthorizationScopes(_0x4b78cd){var _0x336f6b=_[_0xf5f2('0x15')](AZURE_AUTH_SCOPES[_0x4b78cd[_0xf5f2('0x16')]]);if(_0x4b78cd[_0xf5f2('0x16')]===_0xf5f2('0x17'))_0x336f6b[_0xf5f2('0x18')](_0x4b78cd['data7']+_0xf5f2('0x19'));return _0x336f6b[_0xf5f2('0x1a')]('\x20');}function getAccessTokenScope(_0x269909){if(_0x269909[_0xf5f2('0x16')]===_0xf5f2('0x1b'))return'https://outlook.office365.com/IMAP.AccessAsUser.All';if(_0x269909[_0xf5f2('0x16')]===_0xf5f2('0x17'))return _0x269909[_0xf5f2('0x1c')]+_0xf5f2('0x19');}function generateMicrosoftAuthorizationUrl(_0x23e23a,_0x3a9dbb){var _0xdb61b3=MICROSOFT_AUTH_URL[_0xf5f2('0x1d')](_0xf5f2('0x1e'),_0x23e23a[_0xf5f2('0x1f')]);var _0x20fccd=[_0xf5f2('0x20'),_0xf5f2('0x21')];var _0x3ee69=Buffer[_0xf5f2('0x22')](JSON[_0xf5f2('0x23')]({'id':_0x3a9dbb}))[_0xf5f2('0x24')]('base64');var _0x34706d=crypto[_0xf5f2('0x25')](0x10)['toString']('hex');var _0x2d2805=getAuthorizationScopes(_0x23e23a);var _0x388e6c=[{'key':'client_id','value':_0x23e23a[_0xf5f2('0x26')]},{'key':_0xf5f2('0x27'),'value':encodeURIComponent(_0x20fccd[_0xf5f2('0x1a')]('\x20'))},{'key':_0xf5f2('0x28'),'value':_0x23e23a[_0xf5f2('0x29')]},{'key':'response_mode','value':_0xf5f2('0x2a')},{'key':_0xf5f2('0x2b'),'value':encodeURIComponent(_0x2d2805)},{'key':_0xf5f2('0x2c'),'value':_0x3ee69},{'key':_0xf5f2('0x2d'),'value':_0x34706d},{'key':_0xf5f2('0x2e'),'value':'login'}];var _0x529f07=_0xdb61b3+MICROSOFT_AUTH_ENDPOINT+'?'+_[_0xf5f2('0x15')](_0x388e6c,function(_0x3f79d5){return _0x3f79d5[_0xf5f2('0x2f')]+'='+_0x3f79d5[_0xf5f2('0x30')];})[_0xf5f2('0x1a')]('&');_0x23e23a[_0xf5f2('0x31')]={'issuer':_0xdb61b3[_0xf5f2('0x1d')](_0xf5f2('0x32'),''),'audience':_0x23e23a[_0xf5f2('0x26')],'state':_0x3ee69,'nonce':_0x34706d};redis['set'](_0x3ee69,JSON[_0xf5f2('0x23')](_0x23e23a));return _0x529f07;}function isValidIdToken(_0x102449,_0x375ca8){try{var _0x31bfcb=jwt[_0xf5f2('0x33')](_0x102449,{'complete':!![]});var _0x477604=_0x31bfcb['payload'];if(_0x477604['iss']!==_0x375ca8[_0xf5f2('0x34')])return![];if(_0x477604[_0xf5f2('0x35')]!==_0x375ca8[_0xf5f2('0x36')])return![];if(_0x477604['nonce']!==_0x375ca8['nonce'])return![];if(moment()[_0xf5f2('0x37')](moment[_0xf5f2('0x38')](_0x477604[_0xf5f2('0x39')])))return![];return!![];}catch(_0x153924){throw _0x153924;}}function refreshOauth2MicrosoftAccessToken(_0x1b381e){return Promise['resolve']()['then'](function(){if(_0x1b381e[_0xf5f2('0x3a')])return _0x1b381e;return db['CloudProvider'][_0xf5f2('0x3b')]({'where':{'id':_0x1b381e['id']},'raw':!![]});})['then'](function(_0x45b643){var _0x31087c={'grant_type':_0xf5f2('0x3c'),'refresh_token':_0x45b643[_0xf5f2('0x3d')],'scope':getAccessTokenScope(_0x45b643),'redirect_uri':_0x45b643[_0xf5f2('0x29')],'client_id':_0x45b643[_0xf5f2('0x26')],'client_secret':encryptor[_0xf5f2('0x3e')](_0x45b643[_0xf5f2('0x3a')])};var _0x5ca917={'method':_0xf5f2('0x3f'),'uri':MICROSOFT_AUTH_URL[_0xf5f2('0x1d')](_0xf5f2('0x1e'),_0x45b643[_0xf5f2('0x1f')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x31087c,'json':!![]};return rp(_0x5ca917);})[_0xf5f2('0x40')](function(_0x27c0e7){_0x1b381e[_0xf5f2('0x41')]=_0x27c0e7['access_token'];_0x1b381e[_0xf5f2('0x3d')]=_0x27c0e7[_0xf5f2('0x3c')];return db['CloudProvider'][_0xf5f2('0x42')]({'data5':_0x1b381e['data5'],'data6':_0x1b381e[_0xf5f2('0x3d')]},{'where':{'id':_0x1b381e['id']}});})[_0xf5f2('0x40')](function(){return _0x1b381e;})[_0xf5f2('0x43')](function(_0x2e3cca){logger['error']('Failed\x20to\x20refresh\x20access\x20token\x20for\x20cloud\x20provider\x20#%s',_0x1b381e['id'],_0x2e3cca);});}function getOauth2MicrosoftAccessToken(_0x41088b,_0x46ad4a){var _0x20eb74={'grant_type':'authorization_code','code':_0x41088b,'scope':getAccessTokenScope(_0x46ad4a),'redirect_uri':_0x46ad4a[_0xf5f2('0x29')],'client_id':_0x46ad4a['data1'],'client_secret':encryptor[_0xf5f2('0x3e')](_0x46ad4a['data3'])};var _0x46f464={'method':_0xf5f2('0x3f'),'uri':MICROSOFT_AUTH_URL['replace'](_0xf5f2('0x1e'),_0x46ad4a[_0xf5f2('0x1f')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x20eb74,'json':!![]};return rp(_0x46f464);}function startRefreshInterval(_0x5a4441){var _0x35f738=schedule['intervals'];if(_0x35f738[_0x5a4441['id']])clearInterval(_0x35f738[_0x5a4441['id']]);_0x35f738[_0x5a4441['id']]=setInterval(refreshOauth2MicrosoftAccessToken['bind'](this,{'id':_0x5a4441['id']}),OAUTH_REFRESH_INTERVAL*0x3e8);schedule[_0xf5f2('0x44')]=_0x35f738;}function startAllRefreshIntervals(){return db[_0xf5f2('0x45')][_0xf5f2('0x46')]({'where':{'data6':{'$ne':null}},'raw':!![]})[_0xf5f2('0x40')](function(_0x2c7f65){var _0xe62b57=_0x2c7f65[_0xf5f2('0x15')](function(_0x4c0ac7){return refreshOauth2MicrosoftAccessToken(_0x4c0ac7)[_0xf5f2('0x40')](function(_0x3b4ea6){startRefreshInterval(_0x3b4ea6);});});return Promise['all'](_0xe62b57);})[_0xf5f2('0x43')](function(_0x3f3895){var _0x71b0e7=_0x3f3895?util[_0xf5f2('0x47')](_0x3f3895,{'showHidden':![],'depth':null}):'';logger[_0xf5f2('0x48')](_0xf5f2('0x49'),_0x71b0e7);});}module[_0xf5f2('0x4a')]={'generateMicrosoftAuthorizationUrl':generateMicrosoftAuthorizationUrl,'getOauth2MicrosoftAccessToken':getOauth2MicrosoftAccessToken,'isValidIdToken':isValidIdToken,'startAllRefreshIntervals':startAllRefreshIntervals,'refreshOauth2MicrosoftAccessToken':refreshOauth2MicrosoftAccessToken,'startRefreshInterval':startRefreshInterval}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.rpc.js b/server/api/cloudProvider/cloudProvider.rpc.js index 74e9557..655da12 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 _0xed03=['info','CloudProvider,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','lodash','util','bluebird','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x3fa127,_0x12e7ab){var _0x2b7a29=function(_0x439ab7){while(--_0x439ab7){_0x3fa127['push'](_0x3fa127['shift']());}};_0x2b7a29(++_0x12e7ab);}(_0xed03,0xdc));var _0x3ed0=function(_0x4ae625,_0xf396d0){_0x4ae625=_0x4ae625-0x0;var _0x31accf=_0xed03[_0x4ae625];return _0x31accf;};'use strict';var _=require(_0x3ed0('0x0'));var util=require(_0x3ed0('0x1'));var moment=require('moment');var BPromise=require(_0x3ed0('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3ed0('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x3ed0('0x4'))('rpc');var config=require(_0x3ed0('0x5'));var jayson=require(_0x3ed0('0x6'));var client=jayson[_0x3ed0('0x7')][_0x3ed0('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x8470b7,_0x3f1277,_0xd729a0){return new BPromise(function(_0x4500aa,_0xddc4c5){return client[_0x3ed0('0x9')](_0x8470b7,_0xd729a0)[_0x3ed0('0xa')](function(_0x34950c){logger[_0x3ed0('0xb')](_0x3ed0('0xc'),_0x3f1277,'request\x20sent');logger[_0x3ed0('0xd')]('CloudProvider,\x20%s,\x20%s,\x20%s',_0x3f1277,_0x3ed0('0xe'),JSON[_0x3ed0('0xf')](_0x34950c));if(_0x34950c[_0x3ed0('0x10')]){if(_0x34950c['error'][_0x3ed0('0x11')]===0x1f4){logger[_0x3ed0('0x10')](_0x3ed0('0xc'),_0x3f1277,_0x34950c[_0x3ed0('0x10')][_0x3ed0('0x12')]);return _0xddc4c5(_0x34950c['error'][_0x3ed0('0x12')]);}logger[_0x3ed0('0x10')](_0x3ed0('0xc'),_0x3f1277,_0x34950c[_0x3ed0('0x10')][_0x3ed0('0x12')]);return _0x4500aa(_0x34950c['error'][_0x3ed0('0x12')]);}else{logger[_0x3ed0('0xb')]('CloudProvider,\x20%s,\x20%s',_0x3f1277,_0x3ed0('0xe'));_0x4500aa(_0x34950c[_0x3ed0('0x13')][_0x3ed0('0x12')]);}})[_0x3ed0('0x14')](function(_0xaa73cd){logger[_0x3ed0('0x10')]('CloudProvider,\x20%s,\x20%s',_0x3f1277,_0xaa73cd);_0xddc4c5(_0xaa73cd);});});} \ No newline at end of file +var _0x6edc=['code','message','result','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','CloudProvider,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x24348e,_0x360eb9){var _0x41a5b1=function(_0x3ee79b){while(--_0x3ee79b){_0x24348e['push'](_0x24348e['shift']());}};_0x41a5b1(++_0x360eb9);}(_0x6edc,0x138));var _0xc6ed=function(_0x2957d6,_0x363bbb){_0x2957d6=_0x2957d6-0x0;var _0x379052=_0x6edc[_0x2957d6];return _0x379052;};'use strict';var _=require(_0xc6ed('0x0'));var util=require(_0xc6ed('0x1'));var moment=require(_0xc6ed('0x2'));var BPromise=require(_0xc6ed('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc6ed('0x4'))['db'];var utils=require(_0xc6ed('0x5'));var logger=require(_0xc6ed('0x6'))(_0xc6ed('0x7'));var config=require('../../config/environment');var jayson=require(_0xc6ed('0x8'));var client=jayson[_0xc6ed('0x9')][_0xc6ed('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x548a14,_0x274b0d,_0x5a077d){return new BPromise(function(_0xd46c3f,_0x13fed0){return client[_0xc6ed('0xb')](_0x548a14,_0x5a077d)[_0xc6ed('0xc')](function(_0x496e6a){logger[_0xc6ed('0xd')](_0xc6ed('0xe'),_0x274b0d,_0xc6ed('0xf'));logger['debug']('CloudProvider,\x20%s,\x20%s,\x20%s',_0x274b0d,_0xc6ed('0xf'),JSON[_0xc6ed('0x10')](_0x496e6a));if(_0x496e6a[_0xc6ed('0x11')]){if(_0x496e6a[_0xc6ed('0x11')][_0xc6ed('0x12')]===0x1f4){logger['error'](_0xc6ed('0xe'),_0x274b0d,_0x496e6a['error'][_0xc6ed('0x13')]);return _0x13fed0(_0x496e6a['error'][_0xc6ed('0x13')]);}logger[_0xc6ed('0x11')](_0xc6ed('0xe'),_0x274b0d,_0x496e6a['error'][_0xc6ed('0x13')]);return _0xd46c3f(_0x496e6a[_0xc6ed('0x11')][_0xc6ed('0x13')]);}else{logger['info'](_0xc6ed('0xe'),_0x274b0d,'request\x20sent');_0xd46c3f(_0x496e6a[_0xc6ed('0x14')][_0xc6ed('0x13')]);}})[_0xc6ed('0x15')](function(_0x5346fe){logger[_0xc6ed('0x11')](_0xc6ed('0xe'),_0x274b0d,_0x5346fe);_0x13fed0(_0x5346fe);});});} \ No newline at end of file diff --git a/server/api/cloudProvider/index.js b/server/api/cloudProvider/index.js index cf0523c..befffbb 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 _0xadb5=['put','update','delete','destroy','/:id/oauth2/microsoft/authorize/','/oauth2/microsoft/callback','oauth2MicrosoftCallback','exports','Router','./cloudProvider.controller','get','isAuthenticated','/:id','post','create'];(function(_0x421357,_0x2692ec){var _0x131815=function(_0x4d5078){while(--_0x4d5078){_0x421357['push'](_0x421357['shift']());}};_0x131815(++_0x2692ec);}(_0xadb5,0xad));var _0x5adb=function(_0x40d0f2,_0x345838){_0x40d0f2=_0x40d0f2-0x0;var _0x3c0ffd=_0xadb5[_0x40d0f2];return _0x3c0ffd;};'use strict';var express=require('express');var router=express[_0x5adb('0x0')]();var auth=require('../../components/auth/service');var controller=require(_0x5adb('0x1'));router[_0x5adb('0x2')]('/',auth[_0x5adb('0x3')](),controller['index']);router[_0x5adb('0x2')](_0x5adb('0x4'),auth[_0x5adb('0x3')](),controller['show']);router[_0x5adb('0x5')]('/',auth[_0x5adb('0x3')](),controller[_0x5adb('0x6')]);router[_0x5adb('0x7')](_0x5adb('0x4'),auth[_0x5adb('0x3')](),controller[_0x5adb('0x8')]);router[_0x5adb('0x9')](_0x5adb('0x4'),auth[_0x5adb('0x3')](),controller[_0x5adb('0xa')]);router[_0x5adb('0x2')](_0x5adb('0xb'),auth[_0x5adb('0x3')](),controller['oauth2MicrosoftAuthorize']);router['post'](_0x5adb('0xc'),controller[_0x5adb('0xd')]);module[_0x5adb('0xe')]=router; \ No newline at end of file +var _0x1261=['/:id','show','create','put','update','delete','/:id/oauth2/microsoft/authorize/','post','exports','Router','../../components/auth/service','./cloudProvider.controller','get','isAuthenticated','index'];(function(_0x489c95,_0x53159c){var _0x10e7a7=function(_0xcb4342){while(--_0xcb4342){_0x489c95['push'](_0x489c95['shift']());}};_0x10e7a7(++_0x53159c);}(_0x1261,0x144));var _0x1126=function(_0x21eb3c,_0x7ce88b){_0x21eb3c=_0x21eb3c-0x0;var _0x4bd2aa=_0x1261[_0x21eb3c];return _0x4bd2aa;};'use strict';var express=require('express');var router=express[_0x1126('0x0')]();var auth=require(_0x1126('0x1'));var controller=require(_0x1126('0x2'));router[_0x1126('0x3')]('/',auth[_0x1126('0x4')](),controller[_0x1126('0x5')]);router[_0x1126('0x3')](_0x1126('0x6'),auth[_0x1126('0x4')](),controller[_0x1126('0x7')]);router['post']('/',auth['isAuthenticated'](),controller[_0x1126('0x8')]);router[_0x1126('0x9')]('/:id',auth[_0x1126('0x4')](),controller[_0x1126('0xa')]);router[_0x1126('0xb')](_0x1126('0x6'),auth[_0x1126('0x4')](),controller['destroy']);router[_0x1126('0x3')](_0x1126('0xc'),auth[_0x1126('0x4')](),controller['oauth2MicrosoftAuthorize']);router[_0x1126('0xd')]('/oauth2/microsoft/callback',controller['oauth2MicrosoftCallback']);module[_0x1126('0xe')]=router; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.attributes.js b/server/api/cmCompany/cmCompany.attributes.js index 16e16b7..69744f9 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 _0x0902=['STRING','sequelize','name'];(function(_0x372a76,_0x1052f8){var _0x36f1f2=function(_0x4b485c){while(--_0x4b485c){_0x372a76['push'](_0x372a76['shift']());}};_0x36f1f2(++_0x1052f8);}(_0x0902,0xaf));var _0x2090=function(_0x8c7987,_0x3d6936){_0x8c7987=_0x8c7987-0x0;var _0x582752=_0x0902[_0x8c7987];return _0x582752;};'use strict';var Sequelize=require(_0x2090('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0x2090('0x1'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0x2090('0x2')]},'companyId':{'type':Sequelize[_0x2090('0x2')]},'website':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0x2090('0x2')]},'fax':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x2090('0x2')]},'street':{'type':Sequelize['STRING']},'postalCode':{'type':Sequelize[_0x2090('0x2')]},'city':{'type':Sequelize[_0x2090('0x2')]},'country':{'type':Sequelize[_0x2090('0x2')]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize['STRING']},'sStreet':{'type':Sequelize[_0x2090('0x2')]},'sPostalCode':{'type':Sequelize[_0x2090('0x2')]},'sCity':{'type':Sequelize['STRING']},'sCountry':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x2090('0x2')]}}; \ No newline at end of file +var _0xb33f=['exports','name','STRING','sequelize'];(function(_0x4bc0de,_0x1089b5){var _0x5db9c3=function(_0x408a55){while(--_0x408a55){_0x4bc0de['push'](_0x4bc0de['shift']());}};_0x5db9c3(++_0x1089b5);}(_0xb33f,0x1cf));var _0xfb33=function(_0x17ff2b,_0x3eb0ca){_0x17ff2b=_0x17ff2b-0x0;var _0x315754=_0xb33f[_0x17ff2b];return _0x315754;};'use strict';var Sequelize=require(_0xfb33('0x0'));module[_0xfb33('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xfb33('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize['STRING']},'companyId':{'type':Sequelize['STRING']},'website':{'type':Sequelize[_0xfb33('0x3')]},'phone':{'type':Sequelize['STRING']},'fax':{'type':Sequelize['STRING']},'type':{'type':Sequelize['STRING']},'street':{'type':Sequelize[_0xfb33('0x3')]},'postalCode':{'type':Sequelize[_0xfb33('0x3')]},'city':{'type':Sequelize[_0xfb33('0x3')]},'country':{'type':Sequelize[_0xfb33('0x3')]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0xfb33('0x3')]},'sStreet':{'type':Sequelize[_0xfb33('0x3')]},'sPostalCode':{'type':Sequelize[_0xfb33('0x3')]},'sCity':{'type':Sequelize['STRING']},'sCountry':{'type':Sequelize[_0xfb33('0x3')]},'description':{'type':Sequelize[_0xfb33('0x3')]}}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.controller.js b/server/api/cmCompany/cmCompany.controller.js index fb21ffd..8db1420 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 _0x925d=['error','stack','name','send','CmCompany','describe','model','keys','query','filters','intersection','attributes','fields','nolimit','sort','where','pick','filter','merge','options','include','findAll','rows','catch','show','params','length','includeAll','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addContacts','CmContact','ids','getContacts','findOne','rawAttributes','order','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','reject','save','update','then','destroy','UserProfileResource'];(function(_0x2dcb46,_0x264a0d){var _0x32d8ca=function(_0x5708d6){while(--_0x5708d6){_0x2dcb46['push'](_0x2dcb46['shift']());}};_0x32d8ca(++_0x264a0d);}(_0x925d,0x129));var _0xd925=function(_0x2f0a8e,_0xa0731b){_0x2f0a8e=_0x2f0a8e-0x0;var _0x265e84=_0x925d[_0x2f0a8e];return _0x265e84;};'use strict';var emlformat=require(_0xd925('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd925('0x1'));var jsonpatch=require(_0xd925('0x2'));var rp=require(_0xd925('0x3'));var moment=require('moment');var BPromise=require(_0xd925('0x4'));var Mustache=require('mustache');var util=require(_0xd925('0x5'));var path=require(_0xd925('0x6'));var sox=require(_0xd925('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd925('0x8'));var _=require(_0xd925('0x9'));var squel=require(_0xd925('0xa'));var crypto=require(_0xd925('0xb'));var jsforce=require(_0xd925('0xc'));var deskjs=require(_0xd925('0xd'));var toCsv=require('to-csv');var querystring=require(_0xd925('0xe'));var Papa=require(_0xd925('0xf'));var Redis=require('ioredis');var authService=require(_0xd925('0x10'));var qs=require(_0xd925('0x11'));var as=require(_0xd925('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd925('0x13'))(_0xd925('0x14'));var utils=require(_0xd925('0x15'));var config=require(_0xd925('0x16'));var licenseUtil=require(_0xd925('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3fd7df,_0x56baec){_0x56baec=_0x56baec||0xcc;return function(_0x4e7704){if(_0x4e7704){return _0x3fd7df[_0xd925('0x18')](_0x56baec);}return _0x3fd7df[_0xd925('0x19')](_0x56baec)[_0xd925('0x1a')]();};}function respondWithResult(_0x3b3d79,_0x24c1da){_0x24c1da=_0x24c1da||0xc8;return function(_0x288abc){if(_0x288abc){return _0x3b3d79[_0xd925('0x19')](_0x24c1da)[_0xd925('0x1b')](_0x288abc);}};}function respondWithFilteredResult(_0xcd784d,_0x259e81){return function(_0x36f525){if(_0x36f525){var _0x2e2e3b=typeof _0x259e81[_0xd925('0x1c')]===_0xd925('0x1d')&&typeof _0x259e81[_0xd925('0x1e')]==='undefined';var _0x40d1c4=_0x36f525[_0xd925('0x1f')];var _0x473698=_0x2e2e3b?0x0:_0x259e81['offset'];var _0x2ebad7=_0x2e2e3b?_0x36f525['count']:_0x259e81['offset']+_0x259e81[_0xd925('0x1e')];var _0x33514a;if(_0x2ebad7>=_0x40d1c4){_0x2ebad7=_0x40d1c4;_0x33514a=0xc8;}else{_0x33514a=0xce;}_0xcd784d['status'](_0x33514a);return _0xcd784d['set'](_0xd925('0x20'),_0x473698+'-'+_0x2ebad7+'/'+_0x40d1c4)[_0xd925('0x1b')](_0x36f525);}return null;};}function patchUpdates(_0x3be87b){return function(_0x57ecb5){try{jsonpatch['apply'](_0x57ecb5,_0x3be87b,!![]);}catch(_0x53ffa0){return BPromise[_0xd925('0x21')](_0x53ffa0);}return _0x57ecb5[_0xd925('0x22')]();};}function saveUpdates(_0x58e904,_0xd8b508){return function(_0x3884cb){if(_0x3884cb){return _0x3884cb[_0xd925('0x23')](_0x58e904)[_0xd925('0x24')](function(_0x29f1c2){return _0x29f1c2;});}return null;};}function removeEntity(_0x2a2ab6,_0x148336){return function(_0x9e2e78){if(_0x9e2e78){return _0x9e2e78[_0xd925('0x25')]()['then'](function(){var _0x2733af=_0x9e2e78['get']({'plain':!![]});var _0x59aae2='Companies';return db[_0xd925('0x26')][_0xd925('0x25')]({'where':{'type':_0x59aae2,'resourceId':_0x2733af['id']}})['then'](function(){return _0x9e2e78;});})['then'](function(){_0x2a2ab6['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x41a22d,_0x343ca1){return function(_0x4ea50e){if(!_0x4ea50e){_0x41a22d[_0xd925('0x18')](0x194);}return _0x4ea50e;};}function handleError(_0x344fed,_0x29dbaf){_0x29dbaf=_0x29dbaf||0x1f4;return function(_0x58074f){logger[_0xd925('0x27')](_0x58074f[_0xd925('0x28')]);if(_0x58074f[_0xd925('0x29')]){delete _0x58074f[_0xd925('0x29')];}_0x344fed[_0xd925('0x19')](_0x29dbaf)[_0xd925('0x2a')](_0x58074f);};}exports['index']=function(_0x24aaea,_0x521576){var _0x543f52={},_0x245e4e={},_0x43084e={'count':0x0,'rows':[]};return db[_0xd925('0x2b')][_0xd925('0x2c')]()[_0xd925('0x24')](function(_0x219b9f){_0x245e4e[_0xd925('0x2d')]=_[_0xd925('0x2e')](_0x219b9f);_0x245e4e['query']=_[_0xd925('0x2e')](_0x24aaea[_0xd925('0x2f')]);_0x245e4e[_0xd925('0x30')]=_[_0xd925('0x31')](_0x245e4e[_0xd925('0x2d')],_0x245e4e[_0xd925('0x2f')]);_0x543f52[_0xd925('0x32')]=_[_0xd925('0x31')](_0x245e4e[_0xd925('0x2d')],qs[_0xd925('0x33')](_0x24aaea[_0xd925('0x2f')]['fields']));_0x543f52[_0xd925('0x32')]=_0x543f52[_0xd925('0x32')]['length']?_0x543f52['attributes']:_0x245e4e[_0xd925('0x2d')];if(!_0x24aaea[_0xd925('0x2f')]['hasOwnProperty'](_0xd925('0x34'))){_0x543f52['limit']=qs[_0xd925('0x1e')](_0x24aaea[_0xd925('0x2f')][_0xd925('0x1e')]);_0x543f52[_0xd925('0x1c')]=qs['offset'](_0x24aaea['query'][_0xd925('0x1c')]);}_0x543f52['order']=qs[_0xd925('0x35')](_0x24aaea[_0xd925('0x2f')]['sort']);_0x543f52[_0xd925('0x36')]=qs[_0xd925('0x30')](_[_0xd925('0x37')](_0x24aaea[_0xd925('0x2f')],_0x245e4e[_0xd925('0x30')]),_0x219b9f);if(_0x24aaea[_0xd925('0x2f')][_0xd925('0x38')]){_0x543f52[_0xd925('0x36')]=_[_0xd925('0x39')](_0x543f52['where'],{'$or':_['map'](_0x543f52[_0xd925('0x32')],function(_0x13456a){var _0x541f3b={};_0x541f3b[_0x13456a]={'$like':'%'+_0x24aaea[_0xd925('0x2f')][_0xd925('0x38')]+'%'};return _0x541f3b;})});}_0x543f52=_[_0xd925('0x39')]({},_0x543f52,_0x24aaea[_0xd925('0x3a')]);var _0x4974df={'where':_0x543f52[_0xd925('0x36')]};return db[_0xd925('0x2b')]['count'](_0x4974df)['then'](function(_0x4b9fec){_0x43084e['count']=_0x4b9fec;if(_0x24aaea['query']['includeAll']){_0x543f52[_0xd925('0x3b')]=[{'all':!![]}];}return db[_0xd925('0x2b')][_0xd925('0x3c')](_0x543f52);})[_0xd925('0x24')](function(_0x1a8668){_0x43084e[_0xd925('0x3d')]=_0x1a8668;return _0x43084e;})[_0xd925('0x24')](respondWithFilteredResult(_0x521576,_0x543f52))[_0xd925('0x3e')](handleError(_0x521576,null));})[_0xd925('0x3e')](handleError(_0x521576,null));};exports[_0xd925('0x3f')]=function(_0x560339,_0x3bcfae){var _0x2bc36f={'raw':![],'where':{'id':_0x560339[_0xd925('0x40')]['id']}},_0x9ec95a={};_0x9ec95a['model']=_[_0xd925('0x2e')](db[_0xd925('0x2b')]['rawAttributes']);_0x9ec95a[_0xd925('0x2f')]=_[_0xd925('0x2e')](_0x560339[_0xd925('0x2f')]);_0x9ec95a[_0xd925('0x30')]=_[_0xd925('0x31')](_0x9ec95a['model'],_0x9ec95a[_0xd925('0x2f')]);_0x2bc36f[_0xd925('0x32')]=_['intersection'](_0x9ec95a[_0xd925('0x2d')],qs[_0xd925('0x33')](_0x560339[_0xd925('0x2f')][_0xd925('0x33')]));_0x2bc36f[_0xd925('0x32')]=_0x2bc36f[_0xd925('0x32')][_0xd925('0x41')]?_0x2bc36f[_0xd925('0x32')]:_0x9ec95a[_0xd925('0x2d')];if(_0x560339['query'][_0xd925('0x42')]){_0x2bc36f[_0xd925('0x3b')]=[{'all':!![]}];}_0x2bc36f=_[_0xd925('0x39')]({},_0x2bc36f,_0x560339[_0xd925('0x3a')]);return db['CmCompany'][_0xd925('0x43')](_0x2bc36f)[_0xd925('0x24')](handleEntityNotFound(_0x3bcfae,null))[_0xd925('0x24')](respondWithResult(_0x3bcfae,null))[_0xd925('0x3e')](handleError(_0x3bcfae,null));};exports[_0xd925('0x44')]=function(_0x376de6,_0x482eca){return db[_0xd925('0x2b')][_0xd925('0x44')](_0x376de6[_0xd925('0x45')],{})[_0xd925('0x24')](function(_0x4da284){var _0x89a3b2=_0x376de6[_0xd925('0x46')][_0xd925('0x47')]({'plain':!![]});if(!_0x89a3b2)throw new Error(_0xd925('0x48'));if(_0x89a3b2['role']===_0xd925('0x46')){var _0x22978b=_0x4da284['get']({'plain':!![]});var _0x4fe211='Companies';return db[_0xd925('0x49')][_0xd925('0x43')]({'where':{'name':_0x4fe211,'userProfileId':_0x89a3b2[_0xd925('0x4a')]},'raw':!![]})['then'](function(_0x3fe78f){if(_0x3fe78f&&_0x3fe78f[_0xd925('0x4b')]===0x0){return db['UserProfileResource']['create']({'name':_0x22978b[_0xd925('0x29')],'resourceId':_0x22978b['id'],'type':_0x3fe78f['name'],'sectionId':_0x3fe78f['id']},{})[_0xd925('0x24')](function(){return _0x4da284;});}else{return _0x4da284;}})['catch'](function(_0x3acdae){logger[_0xd925('0x27')](_0xd925('0x4c'),_0x3acdae);throw _0x3acdae;});}return _0x4da284;})[_0xd925('0x24')](respondWithResult(_0x482eca,0xc9))[_0xd925('0x3e')](handleError(_0x482eca,null));};exports[_0xd925('0x23')]=function(_0x349208,_0x196869){if(_0x349208[_0xd925('0x45')]['id']){delete _0x349208[_0xd925('0x45')]['id'];}return db[_0xd925('0x2b')][_0xd925('0x43')]({'where':{'id':_0x349208[_0xd925('0x40')]['id']}})[_0xd925('0x24')](handleEntityNotFound(_0x196869,null))['then'](saveUpdates(_0x349208[_0xd925('0x45')],null))[_0xd925('0x24')](respondWithResult(_0x196869,null))[_0xd925('0x3e')](handleError(_0x196869,null));};exports[_0xd925('0x25')]=function(_0x542a6d,_0x4c4bc5){return db[_0xd925('0x2b')][_0xd925('0x43')]({'where':{'id':_0x542a6d[_0xd925('0x40')]['id']}})['then'](handleEntityNotFound(_0x4c4bc5,null))[_0xd925('0x24')](removeEntity(_0x4c4bc5,null))[_0xd925('0x3e')](handleError(_0x4c4bc5,null));};exports[_0xd925('0x2c')]=function(_0x48f481,_0x3677ca){return db[_0xd925('0x2b')][_0xd925('0x2c')]()[_0xd925('0x24')](respondWithResult(_0x3677ca,null))['catch'](handleError(_0x3677ca,null));};exports[_0xd925('0x4d')]=function(_0x2880e5,_0x2dbf46,_0x2991c8){return db[_0xd925('0x4e')][_0xd925('0x43')]({'where':{'id':_0x2880e5['params']['id']}})[_0xd925('0x24')](handleEntityNotFound(_0x2dbf46,null))[_0xd925('0x24')](function(_0x47fb9d){if(_0x47fb9d){return _0x47fb9d[_0xd925('0x4d')](_0x2880e5[_0xd925('0x45')][_0xd925('0x4f')],_['omit'](_0x2880e5['body'],[_0xd925('0x4f'),'id'])||{});}})['then'](respondWithResult(_0x2dbf46,null))[_0xd925('0x3e')](handleError(_0x2dbf46,null));};exports[_0xd925('0x50')]=function(_0x4e8bca,_0x321087,_0x19abd0){var _0x55ec7c={};var _0x1377a8={};var _0x3ed30d;var _0x5c15d5;return db['CmCompany'][_0xd925('0x51')]({'where':{'id':_0x4e8bca['params']['id']}})[_0xd925('0x24')](handleEntityNotFound(_0x321087,null))[_0xd925('0x24')](function(_0x1377f5){if(_0x1377f5){_0x3ed30d=_0x1377f5;_0x1377a8[_0xd925('0x2d')]=_[_0xd925('0x2e')](db[_0xd925('0x4e')][_0xd925('0x52')]);_0x1377a8['query']=_[_0xd925('0x2e')](_0x4e8bca[_0xd925('0x2f')]);_0x1377a8[_0xd925('0x30')]=_[_0xd925('0x31')](_0x1377a8['model'],_0x1377a8[_0xd925('0x2f')]);_0x55ec7c[_0xd925('0x32')]=_[_0xd925('0x31')](_0x1377a8[_0xd925('0x2d')],qs[_0xd925('0x33')](_0x4e8bca[_0xd925('0x2f')][_0xd925('0x33')]));_0x55ec7c[_0xd925('0x32')]=_0x55ec7c[_0xd925('0x32')][_0xd925('0x41')]?_0x55ec7c['attributes']:_0x1377a8[_0xd925('0x2d')];_0x55ec7c[_0xd925('0x53')]=qs[_0xd925('0x35')](_0x4e8bca[_0xd925('0x2f')][_0xd925('0x35')]);_0x55ec7c[_0xd925('0x36')]=qs[_0xd925('0x30')](_['pick'](_0x4e8bca[_0xd925('0x2f')],_0x1377a8[_0xd925('0x30')]));if(_0x4e8bca[_0xd925('0x2f')][_0xd925('0x38')]){_0x55ec7c[_0xd925('0x36')]=_[_0xd925('0x39')](_0x55ec7c[_0xd925('0x36')],{'$or':_['map'](_0x55ec7c[_0xd925('0x32')],function(_0x19a148){var _0x2d4b4b={};_0x2d4b4b[_0x19a148]={'$like':'%'+_0x4e8bca[_0xd925('0x2f')][_0xd925('0x38')]+'%'};return _0x2d4b4b;})});}_0x55ec7c=_[_0xd925('0x39')]({},_0x55ec7c,_0x4e8bca[_0xd925('0x3a')]);return _0x3ed30d['getContacts'](_0x55ec7c);}})[_0xd925('0x24')](function(_0x29fd38){if(_0x29fd38){_0x5c15d5=_0x29fd38['length'];if(!_0x4e8bca[_0xd925('0x2f')]['hasOwnProperty']('nolimit')){_0x55ec7c[_0xd925('0x1e')]=qs['limit'](_0x4e8bca[_0xd925('0x2f')][_0xd925('0x1e')]);_0x55ec7c[_0xd925('0x1c')]=qs[_0xd925('0x1c')](_0x4e8bca['query'][_0xd925('0x1c')]);}return _0x3ed30d[_0xd925('0x50')](_0x55ec7c);}})[_0xd925('0x24')](function(_0x5ae4fe){if(_0x5ae4fe){return _0x5ae4fe?{'count':_0x5c15d5,'rows':_0x5ae4fe}:null;}})[_0xd925('0x24')](respondWithResult(_0x321087,null))['catch'](handleError(_0x321087,null));}; \ No newline at end of file +var _0x93db=['name','send','CmCompany','model','keys','filters','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','filter','map','merge','includeAll','include','findAll','rows','catch','rawAttributes','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','addContacts','omit','ids','findOne','CmContact','order','pick','getContacts','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','get','Companies','end','error','stack'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x93db,0xd5));var _0xb93d=function(_0x1ed15d,_0xdfa8bc){_0x1ed15d=_0x1ed15d-0x0;var _0x39d7e4=_0x93db[_0x1ed15d];return _0x39d7e4;};'use strict';var emlformat=require(_0xb93d('0x0'));var rimraf=require(_0xb93d('0x1'));var zipdir=require(_0xb93d('0x2'));var jsonpatch=require(_0xb93d('0x3'));var rp=require(_0xb93d('0x4'));var moment=require(_0xb93d('0x5'));var BPromise=require(_0xb93d('0x6'));var Mustache=require(_0xb93d('0x7'));var util=require(_0xb93d('0x8'));var path=require(_0xb93d('0x9'));var sox=require(_0xb93d('0xa'));var csv=require(_0xb93d('0xb'));var ejs=require(_0xb93d('0xc'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb93d('0xd'));var squel=require('squel');var crypto=require(_0xb93d('0xe'));var jsforce=require(_0xb93d('0xf'));var deskjs=require(_0xb93d('0x10'));var toCsv=require(_0xb93d('0xb'));var querystring=require(_0xb93d('0x11'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xb93d('0x12'));var as=require(_0xb93d('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb93d('0x14'))(_0xb93d('0x15'));var utils=require('../../config/utils');var config=require(_0xb93d('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xb93d('0x17'))['db'];function respondWithStatusCode(_0x449a47,_0x515daa){_0x515daa=_0x515daa||0xcc;return function(_0x3b63d8){if(_0x3b63d8){return _0x449a47[_0xb93d('0x18')](_0x515daa);}return _0x449a47[_0xb93d('0x19')](_0x515daa)['end']();};}function respondWithResult(_0x590b6a,_0x25e9c4){_0x25e9c4=_0x25e9c4||0xc8;return function(_0x5a838c){if(_0x5a838c){return _0x590b6a['status'](_0x25e9c4)['json'](_0x5a838c);}};}function respondWithFilteredResult(_0x3b053c,_0x2f27cb){return function(_0xdc6e57){if(_0xdc6e57){var _0x502d32=typeof _0x2f27cb[_0xb93d('0x1a')]===_0xb93d('0x1b')&&typeof _0x2f27cb[_0xb93d('0x1c')]===_0xb93d('0x1b');var _0x28428a=_0xdc6e57[_0xb93d('0x1d')];var _0x16c148=_0x502d32?0x0:_0x2f27cb[_0xb93d('0x1a')];var _0x431ff7=_0x502d32?_0xdc6e57['count']:_0x2f27cb[_0xb93d('0x1a')]+_0x2f27cb['limit'];var _0xcc4654;if(_0x431ff7>=_0x28428a){_0x431ff7=_0x28428a;_0xcc4654=0xc8;}else{_0xcc4654=0xce;}_0x3b053c[_0xb93d('0x19')](_0xcc4654);return _0x3b053c[_0xb93d('0x1e')](_0xb93d('0x1f'),_0x16c148+'-'+_0x431ff7+'/'+_0x28428a)['json'](_0xdc6e57);}return null;};}function patchUpdates(_0x19e309){return function(_0x7285bb){try{jsonpatch[_0xb93d('0x20')](_0x7285bb,_0x19e309,!![]);}catch(_0x1283ee){return BPromise['reject'](_0x1283ee);}return _0x7285bb[_0xb93d('0x21')]();};}function saveUpdates(_0x44b5c0,_0x34522a){return function(_0x3eaf81){if(_0x3eaf81){return _0x3eaf81[_0xb93d('0x22')](_0x44b5c0)[_0xb93d('0x23')](function(_0x4a0be1){return _0x4a0be1;});}return null;};}function removeEntity(_0x5e1199,_0x548c31){return function(_0x5dd27a){if(_0x5dd27a){return _0x5dd27a[_0xb93d('0x24')]()['then'](function(){var _0x12ec52=_0x5dd27a[_0xb93d('0x25')]({'plain':!![]});var _0x313895=_0xb93d('0x26');return db['UserProfileResource'][_0xb93d('0x24')]({'where':{'type':_0x313895,'resourceId':_0x12ec52['id']}})[_0xb93d('0x23')](function(){return _0x5dd27a;});})['then'](function(){_0x5e1199[_0xb93d('0x19')](0xcc)[_0xb93d('0x27')]();});}};}function handleEntityNotFound(_0x2304f0,_0x138e8e){return function(_0x2416ea){if(!_0x2416ea){_0x2304f0[_0xb93d('0x18')](0x194);}return _0x2416ea;};}function handleError(_0x334a4a,_0x4f178a){_0x4f178a=_0x4f178a||0x1f4;return function(_0x344081){logger[_0xb93d('0x28')](_0x344081[_0xb93d('0x29')]);if(_0x344081[_0xb93d('0x2a')]){delete _0x344081[_0xb93d('0x2a')];}_0x334a4a[_0xb93d('0x19')](_0x4f178a)[_0xb93d('0x2b')](_0x344081);};}exports['index']=function(_0x122f08,_0x55a9e3){var _0x54d456={},_0x5c5e41={},_0x4749b7={'count':0x0,'rows':[]};return db[_0xb93d('0x2c')]['describe']()[_0xb93d('0x23')](function(_0x1cf260){_0x5c5e41[_0xb93d('0x2d')]=_[_0xb93d('0x2e')](_0x1cf260);_0x5c5e41['query']=_[_0xb93d('0x2e')](_0x122f08['query']);_0x5c5e41[_0xb93d('0x2f')]=_['intersection'](_0x5c5e41[_0xb93d('0x2d')],_0x5c5e41[_0xb93d('0x30')]);_0x54d456[_0xb93d('0x31')]=_[_0xb93d('0x32')](_0x5c5e41[_0xb93d('0x2d')],qs[_0xb93d('0x33')](_0x122f08[_0xb93d('0x30')]['fields']));_0x54d456[_0xb93d('0x31')]=_0x54d456['attributes'][_0xb93d('0x34')]?_0x54d456['attributes']:_0x5c5e41[_0xb93d('0x2d')];if(!_0x122f08[_0xb93d('0x30')][_0xb93d('0x35')](_0xb93d('0x36'))){_0x54d456['limit']=qs[_0xb93d('0x1c')](_0x122f08[_0xb93d('0x30')]['limit']);_0x54d456[_0xb93d('0x1a')]=qs[_0xb93d('0x1a')](_0x122f08['query'][_0xb93d('0x1a')]);}_0x54d456['order']=qs['sort'](_0x122f08[_0xb93d('0x30')][_0xb93d('0x37')]);_0x54d456[_0xb93d('0x38')]=qs[_0xb93d('0x2f')](_['pick'](_0x122f08[_0xb93d('0x30')],_0x5c5e41[_0xb93d('0x2f')]),_0x1cf260);if(_0x122f08[_0xb93d('0x30')][_0xb93d('0x39')]){_0x54d456[_0xb93d('0x38')]=_['merge'](_0x54d456[_0xb93d('0x38')],{'$or':_[_0xb93d('0x3a')](_0x54d456['attributes'],function(_0x13f4ff){var _0x4e2819={};_0x4e2819[_0x13f4ff]={'$like':'%'+_0x122f08[_0xb93d('0x30')]['filter']+'%'};return _0x4e2819;})});}_0x54d456=_[_0xb93d('0x3b')]({},_0x54d456,_0x122f08['options']);var _0x463771={'where':_0x54d456[_0xb93d('0x38')]};return db[_0xb93d('0x2c')]['count'](_0x463771)[_0xb93d('0x23')](function(_0x1d8c31){_0x4749b7[_0xb93d('0x1d')]=_0x1d8c31;if(_0x122f08['query'][_0xb93d('0x3c')]){_0x54d456[_0xb93d('0x3d')]=[{'all':!![]}];}return db[_0xb93d('0x2c')][_0xb93d('0x3e')](_0x54d456);})[_0xb93d('0x23')](function(_0x215da1){_0x4749b7[_0xb93d('0x3f')]=_0x215da1;return _0x4749b7;})[_0xb93d('0x23')](respondWithFilteredResult(_0x55a9e3,_0x54d456))[_0xb93d('0x40')](handleError(_0x55a9e3,null));})[_0xb93d('0x40')](handleError(_0x55a9e3,null));};exports['show']=function(_0xece3c2,_0x4e4bed){var _0xdc2adc={'raw':![],'where':{'id':_0xece3c2['params']['id']}},_0x199844={};_0x199844[_0xb93d('0x2d')]=_[_0xb93d('0x2e')](db[_0xb93d('0x2c')][_0xb93d('0x41')]);_0x199844[_0xb93d('0x30')]=_[_0xb93d('0x2e')](_0xece3c2[_0xb93d('0x30')]);_0x199844['filters']=_[_0xb93d('0x32')](_0x199844[_0xb93d('0x2d')],_0x199844[_0xb93d('0x30')]);_0xdc2adc[_0xb93d('0x31')]=_[_0xb93d('0x32')](_0x199844[_0xb93d('0x2d')],qs[_0xb93d('0x33')](_0xece3c2['query'][_0xb93d('0x33')]));_0xdc2adc['attributes']=_0xdc2adc[_0xb93d('0x31')][_0xb93d('0x34')]?_0xdc2adc['attributes']:_0x199844[_0xb93d('0x2d')];if(_0xece3c2[_0xb93d('0x30')][_0xb93d('0x3c')]){_0xdc2adc['include']=[{'all':!![]}];}_0xdc2adc=_[_0xb93d('0x3b')]({},_0xdc2adc,_0xece3c2['options']);return db[_0xb93d('0x2c')][_0xb93d('0x42')](_0xdc2adc)[_0xb93d('0x23')](handleEntityNotFound(_0x4e4bed,null))[_0xb93d('0x23')](respondWithResult(_0x4e4bed,null))['catch'](handleError(_0x4e4bed,null));};exports['create']=function(_0x12dc64,_0x50165a){return db[_0xb93d('0x2c')][_0xb93d('0x43')](_0x12dc64[_0xb93d('0x44')],{})[_0xb93d('0x23')](function(_0x5b2aa1){var _0x27ab0e=_0x12dc64['user'][_0xb93d('0x25')]({'plain':!![]});if(!_0x27ab0e)throw new Error(_0xb93d('0x45'));if(_0x27ab0e['role']==='user'){var _0x4ccccd=_0x5b2aa1['get']({'plain':!![]});var _0x308082=_0xb93d('0x26');return db[_0xb93d('0x46')][_0xb93d('0x42')]({'where':{'name':_0x308082,'userProfileId':_0x27ab0e[_0xb93d('0x47')]},'raw':!![]})[_0xb93d('0x23')](function(_0x5d9a4a){if(_0x5d9a4a&&_0x5d9a4a[_0xb93d('0x48')]===0x0){return db[_0xb93d('0x49')][_0xb93d('0x43')]({'name':_0x4ccccd[_0xb93d('0x2a')],'resourceId':_0x4ccccd['id'],'type':_0x5d9a4a[_0xb93d('0x2a')],'sectionId':_0x5d9a4a['id']},{})[_0xb93d('0x23')](function(){return _0x5b2aa1;});}else{return _0x5b2aa1;}})['catch'](function(_0x533736){logger[_0xb93d('0x28')](_0xb93d('0x4a'),_0x533736);throw _0x533736;});}return _0x5b2aa1;})[_0xb93d('0x23')](respondWithResult(_0x50165a,0xc9))[_0xb93d('0x40')](handleError(_0x50165a,null));};exports[_0xb93d('0x22')]=function(_0x4211c3,_0x1fbe94){if(_0x4211c3[_0xb93d('0x44')]['id']){delete _0x4211c3[_0xb93d('0x44')]['id'];}return db['CmCompany'][_0xb93d('0x42')]({'where':{'id':_0x4211c3[_0xb93d('0x4b')]['id']}})[_0xb93d('0x23')](handleEntityNotFound(_0x1fbe94,null))[_0xb93d('0x23')](saveUpdates(_0x4211c3['body'],null))[_0xb93d('0x23')](respondWithResult(_0x1fbe94,null))[_0xb93d('0x40')](handleError(_0x1fbe94,null));};exports[_0xb93d('0x24')]=function(_0x2f9852,_0x3bfbdf){return db[_0xb93d('0x2c')]['find']({'where':{'id':_0x2f9852[_0xb93d('0x4b')]['id']}})[_0xb93d('0x23')](handleEntityNotFound(_0x3bfbdf,null))[_0xb93d('0x23')](removeEntity(_0x3bfbdf,null))[_0xb93d('0x40')](handleError(_0x3bfbdf,null));};exports[_0xb93d('0x4c')]=function(_0x383cc2,_0xab1d5c){return db['CmCompany'][_0xb93d('0x4c')]()['then'](respondWithResult(_0xab1d5c,null))['catch'](handleError(_0xab1d5c,null));};exports[_0xb93d('0x4d')]=function(_0x12004e,_0x310b85,_0x14be66){return db['CmContact']['find']({'where':{'id':_0x12004e[_0xb93d('0x4b')]['id']}})[_0xb93d('0x23')](handleEntityNotFound(_0x310b85,null))[_0xb93d('0x23')](function(_0x2d4f9b){if(_0x2d4f9b){return _0x2d4f9b[_0xb93d('0x4d')](_0x12004e['body']['ids'],_[_0xb93d('0x4e')](_0x12004e[_0xb93d('0x44')],[_0xb93d('0x4f'),'id'])||{});}})[_0xb93d('0x23')](respondWithResult(_0x310b85,null))[_0xb93d('0x40')](handleError(_0x310b85,null));};exports['getContacts']=function(_0x4cdff0,_0x127eb7,_0x5cb8d3){var _0x3a3811={};var _0x55e408={};var _0x59812a;var _0x35c7cb;return db['CmCompany'][_0xb93d('0x50')]({'where':{'id':_0x4cdff0[_0xb93d('0x4b')]['id']}})[_0xb93d('0x23')](handleEntityNotFound(_0x127eb7,null))['then'](function(_0x60a0b5){if(_0x60a0b5){_0x59812a=_0x60a0b5;_0x55e408[_0xb93d('0x2d')]=_[_0xb93d('0x2e')](db[_0xb93d('0x51')][_0xb93d('0x41')]);_0x55e408[_0xb93d('0x30')]=_[_0xb93d('0x2e')](_0x4cdff0['query']);_0x55e408[_0xb93d('0x2f')]=_[_0xb93d('0x32')](_0x55e408[_0xb93d('0x2d')],_0x55e408[_0xb93d('0x30')]);_0x3a3811['attributes']=_[_0xb93d('0x32')](_0x55e408[_0xb93d('0x2d')],qs['fields'](_0x4cdff0[_0xb93d('0x30')][_0xb93d('0x33')]));_0x3a3811['attributes']=_0x3a3811['attributes'][_0xb93d('0x34')]?_0x3a3811['attributes']:_0x55e408[_0xb93d('0x2d')];_0x3a3811[_0xb93d('0x52')]=qs[_0xb93d('0x37')](_0x4cdff0[_0xb93d('0x30')][_0xb93d('0x37')]);_0x3a3811[_0xb93d('0x38')]=qs['filters'](_[_0xb93d('0x53')](_0x4cdff0[_0xb93d('0x30')],_0x55e408[_0xb93d('0x2f')]));if(_0x4cdff0[_0xb93d('0x30')][_0xb93d('0x39')]){_0x3a3811['where']=_[_0xb93d('0x3b')](_0x3a3811[_0xb93d('0x38')],{'$or':_[_0xb93d('0x3a')](_0x3a3811[_0xb93d('0x31')],function(_0x3377dd){var _0x32d2ae={};_0x32d2ae[_0x3377dd]={'$like':'%'+_0x4cdff0[_0xb93d('0x30')][_0xb93d('0x39')]+'%'};return _0x32d2ae;})});}_0x3a3811=_['merge']({},_0x3a3811,_0x4cdff0['options']);return _0x59812a[_0xb93d('0x54')](_0x3a3811);}})[_0xb93d('0x23')](function(_0x966659){if(_0x966659){_0x35c7cb=_0x966659[_0xb93d('0x34')];if(!_0x4cdff0[_0xb93d('0x30')][_0xb93d('0x35')](_0xb93d('0x36'))){_0x3a3811['limit']=qs[_0xb93d('0x1c')](_0x4cdff0[_0xb93d('0x30')][_0xb93d('0x1c')]);_0x3a3811[_0xb93d('0x1a')]=qs['offset'](_0x4cdff0[_0xb93d('0x30')]['offset']);}return _0x59812a[_0xb93d('0x54')](_0x3a3811);}})['then'](function(_0x287a6a){if(_0x287a6a){return _0x287a6a?{'count':_0x35c7cb,'rows':_0x287a6a}:null;}})[_0xb93d('0x23')](respondWithResult(_0x127eb7,null))[_0xb93d('0x40')](handleError(_0x127eb7,null));}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.model.js b/server/api/cmCompany/cmCompany.model.js index 8a3b8e8..278cb99 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 _0x4e0f=['cm_companies','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmCompany.attributes','exports','define','CmCompany'];(function(_0x1e7c0e,_0x1c699d){var _0x111e34=function(_0x245e25){while(--_0x245e25){_0x1e7c0e['push'](_0x1e7c0e['shift']());}};_0x111e34(++_0x1c699d);}(_0x4e0f,0x189));var _0xf4e0=function(_0x571a17,_0x63fb3d){_0x571a17=_0x571a17-0x0;var _0x3ef337=_0x4e0f[_0x571a17];return _0x3ef337;};'use strict';var _=require(_0xf4e0('0x0'));var util=require('util');var logger=require(_0xf4e0('0x1'))(_0xf4e0('0x2'));var moment=require(_0xf4e0('0x3'));var BPromise=require(_0xf4e0('0x4'));var rp=require(_0xf4e0('0x5'));var fs=require('fs');var path=require(_0xf4e0('0x6'));var rimraf=require(_0xf4e0('0x7'));var config=require(_0xf4e0('0x8'));var attributes=require(_0xf4e0('0x9'));module[_0xf4e0('0xa')]=function(_0x51fe91,_0x1551e7){return _0x51fe91[_0xf4e0('0xb')](_0xf4e0('0xc'),attributes,{'tableName':_0xf4e0('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0f97=['bluebird','request-promise','path','../../config/environment','./cmCompany.attributes','define','CmCompany','cm_companies','lodash','util','api','moment'];(function(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0x0f97,0x164));var _0x70f9=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x0f97[_0x19950b];return _0x3c6b41;};'use strict';var _=require(_0x70f9('0x0'));var util=require(_0x70f9('0x1'));var logger=require('../../config/logger')(_0x70f9('0x2'));var moment=require(_0x70f9('0x3'));var BPromise=require(_0x70f9('0x4'));var rp=require(_0x70f9('0x5'));var fs=require('fs');var path=require(_0x70f9('0x6'));var rimraf=require('rimraf');var config=require(_0x70f9('0x7'));var attributes=require(_0x70f9('0x8'));module['exports']=function(_0x3c98d1,_0x144366){return _0x3c98d1[_0x70f9('0x9')](_0x70f9('0xa'),attributes,{'tableName':_0x70f9('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.rpc.js b/server/api/cmCompany/cmCompany.rpc.js index 4d405f0..bd24b73 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 _0xe7b1=['code','CmCompany,\x20%s,\x20%s','message','catch','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','debug','CmCompany,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x641afe,_0x22d726){var _0x2dfe9a=function(_0x33a370){while(--_0x33a370){_0x641afe['push'](_0x641afe['shift']());}};_0x2dfe9a(++_0x22d726);}(_0xe7b1,0x1e7));var _0x1e7b=function(_0x4e472d,_0x596a83){_0x4e472d=_0x4e472d-0x0;var _0x2fe1b7=_0xe7b1[_0x4e472d];return _0x2fe1b7;};'use strict';var _=require(_0x1e7b('0x0'));var util=require(_0x1e7b('0x1'));var moment=require('moment');var BPromise=require(_0x1e7b('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1e7b('0x3'));var db=require(_0x1e7b('0x4'))['db'];var utils=require(_0x1e7b('0x5'));var logger=require(_0x1e7b('0x6'))(_0x1e7b('0x7'));var config=require(_0x1e7b('0x8'));var jayson=require(_0x1e7b('0x9'));var client=jayson[_0x1e7b('0xa')][_0x1e7b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x333a68,_0x2bf9cc,_0x3a4a3b){return new BPromise(function(_0x40e910,_0x972fa3){return client['request'](_0x333a68,_0x3a4a3b)[_0x1e7b('0xc')](function(_0x12601b){logger[_0x1e7b('0xd')]('CmCompany,\x20%s,\x20%s',_0x2bf9cc,_0x1e7b('0xe'));logger[_0x1e7b('0xf')](_0x1e7b('0x10'),_0x2bf9cc,_0x1e7b('0xe'),JSON[_0x1e7b('0x11')](_0x12601b));if(_0x12601b[_0x1e7b('0x12')]){if(_0x12601b[_0x1e7b('0x12')][_0x1e7b('0x13')]===0x1f4){logger[_0x1e7b('0x12')](_0x1e7b('0x14'),_0x2bf9cc,_0x12601b['error'][_0x1e7b('0x15')]);return _0x972fa3(_0x12601b[_0x1e7b('0x12')][_0x1e7b('0x15')]);}logger[_0x1e7b('0x12')](_0x1e7b('0x14'),_0x2bf9cc,_0x12601b[_0x1e7b('0x12')][_0x1e7b('0x15')]);return _0x40e910(_0x12601b[_0x1e7b('0x12')]['message']);}else{logger[_0x1e7b('0xd')]('CmCompany,\x20%s,\x20%s',_0x2bf9cc,_0x1e7b('0xe'));_0x40e910(_0x12601b['result'][_0x1e7b('0x15')]);}})[_0x1e7b('0x16')](function(_0x33011a){logger[_0x1e7b('0x12')](_0x1e7b('0x14'),_0x2bf9cc,_0x33011a);_0x972fa3(_0x33011a);});});} \ No newline at end of file +var _0xa3a5=['error','code','CmCompany,\x20%s,\x20%s','message','result','catch','randomstring','ioredis','../../config/utils','../../config/environment','jayson/promise','client','then','info','request\x20sent','debug','CmCompany,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x11309c,_0xe18a74){var _0x3fea9c=function(_0xeb11c3){while(--_0xeb11c3){_0x11309c['push'](_0x11309c['shift']());}};_0x3fea9c(++_0xe18a74);}(_0xa3a5,0x126));var _0x5a3a=function(_0x53dcbd,_0x1250b4){_0x53dcbd=_0x53dcbd-0x0;var _0x484902=_0xa3a5[_0x53dcbd];return _0x484902;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x5a3a('0x0'));var fs=require('fs');var Redis=require(_0x5a3a('0x1'));var db=require('../../mysqldb')['db'];var utils=require(_0x5a3a('0x2'));var logger=require('../../config/logger')('rpc');var config=require(_0x5a3a('0x3'));var jayson=require(_0x5a3a('0x4'));var client=jayson[_0x5a3a('0x5')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1f1117,_0x7804ba,_0x38122e){return new BPromise(function(_0x59dd9a,_0xbe2975){return client['request'](_0x1f1117,_0x38122e)[_0x5a3a('0x6')](function(_0x4673a5){logger[_0x5a3a('0x7')]('CmCompany,\x20%s,\x20%s',_0x7804ba,_0x5a3a('0x8'));logger[_0x5a3a('0x9')](_0x5a3a('0xa'),_0x7804ba,'request\x20sent',JSON[_0x5a3a('0xb')](_0x4673a5));if(_0x4673a5[_0x5a3a('0xc')]){if(_0x4673a5[_0x5a3a('0xc')][_0x5a3a('0xd')]===0x1f4){logger[_0x5a3a('0xc')](_0x5a3a('0xe'),_0x7804ba,_0x4673a5[_0x5a3a('0xc')][_0x5a3a('0xf')]);return _0xbe2975(_0x4673a5[_0x5a3a('0xc')]['message']);}logger['error'](_0x5a3a('0xe'),_0x7804ba,_0x4673a5[_0x5a3a('0xc')][_0x5a3a('0xf')]);return _0x59dd9a(_0x4673a5[_0x5a3a('0xc')][_0x5a3a('0xf')]);}else{logger[_0x5a3a('0x7')](_0x5a3a('0xe'),_0x7804ba,'request\x20sent');_0x59dd9a(_0x4673a5[_0x5a3a('0x10')][_0x5a3a('0xf')]);}})[_0x5a3a('0x11')](function(_0xd56772){logger[_0x5a3a('0xc')](_0x5a3a('0xe'),_0x7804ba,_0xd56772);_0xbe2975(_0xd56772);});});} \ No newline at end of file diff --git a/server/api/cmCompany/index.js b/server/api/cmCompany/index.js index 37ea1fd..4bf9f8f 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 _0x4941=['addContacts','put','exports','multer','path','connect-timeout','Router','../../components/auth/service','../../config/environment','get','isAuthenticated','describe','/:id','/:id/contacts','create'];(function(_0x3a8782,_0x4f5e38){var _0x127835=function(_0x4e7b40){while(--_0x4e7b40){_0x3a8782['push'](_0x3a8782['shift']());}};_0x127835(++_0x4f5e38);}(_0x4941,0x1c5));var _0x1494=function(_0x264545,_0x214037){_0x264545=_0x264545-0x0;var _0x114d10=_0x4941[_0x264545];return _0x114d10;};'use strict';var multer=require(_0x1494('0x0'));var util=require('util');var path=require(_0x1494('0x1'));var timeout=require(_0x1494('0x2'));var express=require('express');var router=express[_0x1494('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1494('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x1494('0x5'));var controller=require('./cmCompany.controller');router[_0x1494('0x6')]('/',auth[_0x1494('0x7')](),controller['index']);router[_0x1494('0x6')]('/describe',auth[_0x1494('0x7')](),controller[_0x1494('0x8')]);router[_0x1494('0x6')](_0x1494('0x9'),auth[_0x1494('0x7')](),controller['show']);router[_0x1494('0x6')](_0x1494('0xa'),auth[_0x1494('0x7')](),controller['getContacts']);router['post']('/',auth[_0x1494('0x7')](),controller[_0x1494('0xb')]);router['post'](_0x1494('0xa'),auth['isAuthenticated'](),controller[_0x1494('0xc')]);router[_0x1494('0xd')](_0x1494('0x9'),auth['isAuthenticated'](),controller['update']);router['delete'](_0x1494('0x9'),auth[_0x1494('0x7')](),controller['destroy']);module[_0x1494('0xe')]=router; \ No newline at end of file +var _0x93c2=['exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmCompany.controller','get','isAuthenticated','describe','/:id','show','/:id/contacts','post','create','put','update','delete','destroy'];(function(_0x259556,_0x488aca){var _0x5009de=function(_0x280287){while(--_0x280287){_0x259556['push'](_0x259556['shift']());}};_0x5009de(++_0x488aca);}(_0x93c2,0x15a));var _0x293c=function(_0x1ba2b7,_0x10a4d3){_0x1ba2b7=_0x1ba2b7-0x0;var _0x13d403=_0x93c2[_0x1ba2b7];return _0x13d403;};'use strict';var multer=require('multer');var util=require(_0x293c('0x0'));var path=require(_0x293c('0x1'));var timeout=require(_0x293c('0x2'));var express=require(_0x293c('0x3'));var router=express[_0x293c('0x4')]();var fs_extra=require(_0x293c('0x5'));var auth=require(_0x293c('0x6'));var interaction=require(_0x293c('0x7'));var config=require(_0x293c('0x8'));var controller=require(_0x293c('0x9'));router[_0x293c('0xa')]('/',auth[_0x293c('0xb')](),controller['index']);router[_0x293c('0xa')]('/describe',auth['isAuthenticated'](),controller[_0x293c('0xc')]);router[_0x293c('0xa')](_0x293c('0xd'),auth[_0x293c('0xb')](),controller[_0x293c('0xe')]);router['get'](_0x293c('0xf'),auth[_0x293c('0xb')](),controller['getContacts']);router[_0x293c('0x10')]('/',auth['isAuthenticated'](),controller[_0x293c('0x11')]);router[_0x293c('0x10')](_0x293c('0xf'),auth[_0x293c('0xb')](),controller['addContacts']);router[_0x293c('0x12')](_0x293c('0xd'),auth[_0x293c('0xb')](),controller[_0x293c('0x13')]);router[_0x293c('0x14')]('/:id',auth[_0x293c('0xb')](),controller[_0x293c('0x15')]);module[_0x293c('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 96c80dd..276f695 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 _0x5f2f=['INTEGER','DATE','NOW','lodash','sequelize','exports','STRING','TEXT'];(function(_0x320a79,_0x25f987){var _0x31aae3=function(_0x43fe32){while(--_0x43fe32){_0x320a79['push'](_0x320a79['shift']());}};_0x31aae3(++_0x25f987);}(_0x5f2f,0x73));var _0xf5f2=function(_0xfb31f4,_0x2856a0){_0xfb31f4=_0xfb31f4-0x0;var _0x192663=_0x5f2f[_0xfb31f4];return _0x192663;};'use strict';var _=require(_0xf5f2('0x0'));var Sequelize=require(_0xf5f2('0x1'));module[_0xf5f2('0x2')]={'firstName':{'type':Sequelize[_0xf5f2('0x3')],'allowNull':![]},'lastName':{'type':Sequelize[_0xf5f2('0x3')]},'street':{'type':Sequelize[_0xf5f2('0x3')]},'postalCode':{'type':Sequelize[_0xf5f2('0x3')]},'city':{'type':Sequelize[_0xf5f2('0x3')]},'country':{'type':Sequelize['STRING']},'dateOfBirth':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xf5f2('0x4')]},'phone':{'type':Sequelize[_0xf5f2('0x3')]},'mobile':{'type':Sequelize[_0xf5f2('0x3')]},'fax':{'type':Sequelize[_0xf5f2('0x3')]},'email':{'type':Sequelize[_0xf5f2('0x3')]},'url':{'type':Sequelize[_0xf5f2('0x3')]},'facebook':{'type':Sequelize['STRING']},'fb_data':{'type':Sequelize[_0xf5f2('0x3')]},'twitter':{'type':Sequelize[_0xf5f2('0x3')]},'skype':{'type':Sequelize[_0xf5f2('0x3')]},'teams':{'type':Sequelize['STRING']},'viber':{'type':Sequelize[_0xf5f2('0x3')]},'line':{'type':Sequelize[_0xf5f2('0x3')]},'wechat':{'type':Sequelize[_0xf5f2('0x3')]},'telegram':{'type':Sequelize['STRING']},'UserId':{'type':Sequelize[_0xf5f2('0x5')]},'priority':{'type':Sequelize['INTEGER'](0x2)['UNSIGNED'],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0xf5f2('0x6')],'defaultValue':Sequelize[_0xf5f2('0x7')]},'dialTimezone':{'type':Sequelize['STRING']},'utcOffset':{'type':Sequelize[_0xf5f2('0x5')]}}; \ No newline at end of file +var _0x2032=['sequelize','exports','STRING','TEXT','INTEGER','UNSIGNED','NOW'];(function(_0x38537f,_0x252124){var _0x141e23=function(_0x2809b5){while(--_0x2809b5){_0x38537f['push'](_0x38537f['shift']());}};_0x141e23(++_0x252124);}(_0x2032,0xd9));var _0x2203=function(_0x4e3c92,_0x353fa4){_0x4e3c92=_0x4e3c92-0x0;var _0x455d28=_0x2032[_0x4e3c92];return _0x455d28;};'use strict';var _=require('lodash');var Sequelize=require(_0x2203('0x0'));module[_0x2203('0x1')]={'firstName':{'type':Sequelize[_0x2203('0x2')],'allowNull':![]},'lastName':{'type':Sequelize['STRING']},'street':{'type':Sequelize[_0x2203('0x2')]},'postalCode':{'type':Sequelize[_0x2203('0x2')]},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize[_0x2203('0x2')]},'dateOfBirth':{'type':Sequelize[_0x2203('0x2')]},'description':{'type':Sequelize[_0x2203('0x3')]},'phone':{'type':Sequelize[_0x2203('0x2')]},'mobile':{'type':Sequelize[_0x2203('0x2')]},'fax':{'type':Sequelize[_0x2203('0x2')]},'email':{'type':Sequelize[_0x2203('0x2')]},'url':{'type':Sequelize[_0x2203('0x2')]},'facebook':{'type':Sequelize[_0x2203('0x2')]},'fb_data':{'type':Sequelize[_0x2203('0x2')]},'twitter':{'type':Sequelize[_0x2203('0x2')]},'skype':{'type':Sequelize['STRING']},'teams':{'type':Sequelize['STRING']},'viber':{'type':Sequelize[_0x2203('0x2')]},'line':{'type':Sequelize['STRING']},'wechat':{'type':Sequelize[_0x2203('0x2')]},'telegram':{'type':Sequelize[_0x2203('0x2')]},'UserId':{'type':Sequelize[_0x2203('0x4')]},'priority':{'type':Sequelize['INTEGER'](0x2)[_0x2203('0x5')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize['DATE'],'defaultValue':Sequelize[_0x2203('0x6')]},'dialTimezone':{'type':Sequelize['STRING']},'utcOffset':{'type':Sequelize[_0x2203('0x4')]}}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.controller.js b/server/api/cmContact/cmContact.controller.js index 47449b0..6de0674 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 _0xcb30=['duplicates','$or','findOrCreate','spread','show','$and','omit','format','cf_%d','pickBy','table','id\x20=\x20?','toParam','CmHopper','phone','rawAttributes','options','nolimit','getTags','setTags','ids','getHoppers','ContactId','getHopperHistories','includeAll','include','CmHopperFinal','getJscriptySessions','uploadCsv','binding_keys','No\x20association\x20values\x20specified!','socket_timestamp','Incorrect\x20binding\x20parameters\x20passed!','No\x20phone\x20column\x20specified','firstName','root','file','filename','chmodSync','child_process','fork','../../components/import/cm/csv','binding_values','CompanyId','File\x20uploaded\x20correctly!','pid','send','upload','createReadStream','parse','import','No\x20ListId\x20specified','binding','No\x20firstName\x20column\x20specified','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','message','start\x20child\x20process\x20correctly!','getJourney','mail','chat','sms','openchannel','fax','channel','Invalid\x20channel','toLowerCase','range','Invalid\x20date\x20for\x20range\x20from\x20filter','isValid','Invalid\x20date\x20for\x20range\x20to\x20filter','Invalid\x20createdAt\x20filter','uniqueid','destination','callerid','endtime','duration','note','createdAt','userThirdDisposition','UserId','fullname','findAndCountAll','startCase','Website','Account','disposition','thirdDisposition','browserName','customerIp','customerPort','deviceModel','osName','ratingMessage','ratingType','ratingValue','referer','subject','substatus','externalUrl','threadId','Interaction','Owner','flatten','reverse','moment','bluebird','path','squel','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment/shared','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','status','json','undefined','limit','count','offset','set','then','destroy','sendStatus','error','stack','name','CmContact','describe','keys','length','startsWith','cf_','CmCustomField','findOne','fieldType','model','query','filters','intersection','attributes','fields','order','sort','where','pick','field','color','from','tools_tags','select','left_join','cm_user_has_contacts','uc.CmContactId\x20=\x20c.id','cm_contact_has_tags','ct.CmContactId\x20=\x20c.id','t.id\x20=\x20ct.TagId','c.deletedAt\x20IS\x20NULL','expr','search','parseSearch','sqlOperator','conditions','find','Tag','split','map','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','and','uc.UserId\x20=\x20?','value','dateOfBirth','datetime','castTo','buildExpression','type','text','start','end','hasOwnProperty','filter','isNil','Contact','push','isEmpty','ListId','c.ListId\x20IN\x20?','CONCAT_WS(\x27\x20\x27,\x20c.firstName,\x20c.lastName,\x20c.email)\x20LIKE\x20?','\x20=\x20?','isArray','tag','replace','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.phone\x20LIKE\x20?','c.fax\x20LIKE\x20?','isEmail','c.firstName\x20LIKE\x20?','c.lastName\x20LIKE\x20?','c.email\x20LIKE\x20?','group','Sequelize','SELECT','clone','DESC','t.id\x20IN\x20?','resolve','user','agent','some','getLists','c.ListId\x20IS\x20NULL','role','sequelize','toString','keyBy','merge','c.id','c.lastName','c.phone','c.fax','c.email','c.deletedAt','c.CompanyId','GROUP_CONCAT(DISTINCT\x20t.id)','TagIds','Tags','rows','catch','params','tags','columnName','displayName','analytics','findAll','alias','custom','values','body','get','mergeWith','join','[CmContact][merge]\x20to\x20%s\x20from\x20%s','info','[CmContact][merge][destroy][CmHopper],\x20%s','CmHopperBlack','[CmContact][merge][destroy][CmHopperBlack],\x20%s','create','ChatInteraction','update','MailInteraction','MailMessage','SmsInteraction','FaxMessage','OpenchannelInteraction','OpenchannelMessage','CmHopperHistory','ReportAgentPreview','VoiceCallReport','FaxQueueReport','MailQueueReport','OpenchannelQueueReport','SmsQueueReport','JscriptySessionReport','WhatsappInteraction','WhatsappMessage','WhatsappQueueReport','dialTimezone','timezones','utcOffset','bulkCreate','each'];(function(_0x1f2136,_0x4e4560){var _0x6c81a6=function(_0x4ff6f3){while(--_0x4ff6f3){_0x1f2136['push'](_0x1f2136['shift']());}};_0x6c81a6(++_0x4e4560);}(_0xcb30,0x17f));var _0x0cb3=function(_0x160aff,_0x301f60){_0x160aff=_0x160aff-0x0;var _0x324312=_0xcb30[_0x160aff];return _0x324312;};'use strict';var moment=require(_0x0cb3('0x0'));var BPromise=require(_0x0cb3('0x1'));var util=require('util');var path=require(_0x0cb3('0x2'));var fs=require('fs');var _=require('lodash');var squel=require(_0x0cb3('0x3'));var Papa=require('papaparse');var Redis=require('ioredis');var qs=require('../../components/parsers/qs');var as=require(_0x0cb3('0x4'));var logger=require(_0x0cb3('0x5'))(_0x0cb3('0x6'));var config=require('../../config/environment');var shared=require(_0x0cb3('0x7'));var db=require(_0x0cb3('0x8'))['db'];config[_0x0cb3('0x9')]=_[_0x0cb3('0xa')](config['redis'],{'host':_0x0cb3('0xb'),'port':0x18eb});var socket=require(_0x0cb3('0xc'))(new Redis(config[_0x0cb3('0x9')]));require('./cmContact.socket')[_0x0cb3('0xd')](socket);function respondWithResult(_0x195797,_0x95069c){_0x95069c=_0x95069c||0xc8;return function(_0x1db7fa){if(_0x1db7fa){return _0x195797[_0x0cb3('0xe')](_0x95069c)[_0x0cb3('0xf')](_0x1db7fa);}};}function respondWithFilteredResult(_0x4274df,_0x5e3f74){return function(_0x2c4c4b){if(_0x2c4c4b){var _0x1860b1=typeof _0x5e3f74['offset']===_0x0cb3('0x10')&&typeof _0x5e3f74[_0x0cb3('0x11')]===_0x0cb3('0x10');var _0x3a9484=_0x2c4c4b[_0x0cb3('0x12')];var _0x4e58b6=_0x1860b1?0x0:_0x5e3f74[_0x0cb3('0x13')];var _0x5f1450=_0x1860b1?_0x2c4c4b[_0x0cb3('0x12')]:_0x5e3f74[_0x0cb3('0x13')]+_0x5e3f74[_0x0cb3('0x11')];var _0x14c459;if(_0x5f1450>=_0x3a9484){_0x5f1450=_0x3a9484;_0x14c459=0xc8;}else{_0x14c459=0xce;}_0x4274df[_0x0cb3('0xe')](_0x14c459);return _0x4274df[_0x0cb3('0x14')]('Content-Range',_0x4e58b6+'-'+_0x5f1450+'/'+_0x3a9484)[_0x0cb3('0xf')](_0x2c4c4b);}return null;};}function saveUpdates(_0x4bd40f){return function(_0x53e105){if(_0x53e105){return _0x53e105['update'](_0x4bd40f)[_0x0cb3('0x15')](function(_0x4a1f13){return _0x4a1f13;});}return null;};}function removeEntity(_0x47b1ec){return function(_0x19efa5){if(_0x19efa5){return _0x19efa5[_0x0cb3('0x16')]()[_0x0cb3('0x15')](function(){_0x47b1ec['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x36b093){return function(_0x527d0b){if(!_0x527d0b){_0x36b093[_0x0cb3('0x17')](0x194);}return _0x527d0b;};}function handleError(_0x453074,_0x1995b8){_0x1995b8=_0x1995b8||0x1f4;return function(_0x56a263){logger[_0x0cb3('0x18')](_0x56a263[_0x0cb3('0x19')]);if(_0x56a263[_0x0cb3('0x1a')]){delete _0x56a263[_0x0cb3('0x1a')];}_0x453074[_0x0cb3('0xe')](_0x1995b8)['send'](_0x56a263);};}exports['index']=function(_0x3f05a9,_0x4349f8){var _0x6b0a3e={},_0x4500f1={},_0xa3c190={'count':0x0,'rows':[]};return db[_0x0cb3('0x1b')][_0x0cb3('0x1c')]()[_0x0cb3('0x15')](function(_0x4b306d){var _0x3918fb=[];for(var _0x2a92d6=0x0;_0x2a92d60x1){_0x30f5bf['or'](_0x0cb3('0x5f'),qs[_0x0cb3('0x60')](_0x5b0a3a),null);}else{if(qs['isNumeric'](_0x5b0a3a)){_0x30f5bf['or']('c.id\x20LIKE\x20?',_0x5b0a3a+'%');_0x30f5bf['or'](_0x0cb3('0x61'),_0x5b0a3a+'%');_0x30f5bf['or']('c.mobile\x20LIKE\x20?',_0x5b0a3a+'%');_0x30f5bf['or'](_0x0cb3('0x62'),_0x5b0a3a+'%');}else if(qs[_0x0cb3('0x63')](_0x5b0a3a)){_0x30f5bf['or']('c.email\x20LIKE\x20?',_0x5b0a3a+'%');}else{_0x30f5bf['or'](_0x0cb3('0x64'),'%'+_0x5b0a3a+'%');_0x30f5bf['or'](_0x0cb3('0x65'),'%'+_0x5b0a3a+'%');_0x30f5bf['or'](_0x0cb3('0x66'),'%'+_0x5b0a3a+'%');}}}}_0x1172bc['where'](_0x30f5bf);_0x1172bc[_0x0cb3('0x67')]('c.id');var _0x3b833b={'type':db[_0x0cb3('0x68')]['QueryTypes'][_0x0cb3('0x69')],'raw':!![]};var _0x4dba44=_0x1172bc[_0x0cb3('0x6a')]()[_0x0cb3('0x2e')]('c.id');if(_0x6b0a3e[_0x0cb3('0x2a')]){_0x6b0a3e[_0x0cb3('0x2a')]['forEach'](function(_0x54ad7a){_0x1172bc[_0x0cb3('0x2a')]('c.'+_0x54ad7a[0x0],_0x54ad7a[0x1]===_0x0cb3('0x6b')?![]:!![]);});}if(!_[_0x0cb3('0x57')](_0x227bd6)){_0x1172bc['having'](_0xf464ec);_0x4dba44[_0x0cb3('0x2c')](_0x0cb3('0x6c'),_0x227bd6);}BPromise[_0x0cb3('0x6d')]()[_0x0cb3('0x15')](function(){if(!_0x36fa66)return;if(_0x3f05a9[_0x0cb3('0x6e')]['role']!==_0x0cb3('0x6f'))return;if(!_[_0x0cb3('0x70')](_0x36fa66[_0x0cb3('0x3e')],[_0x0cb3('0x2e'),_0x0cb3('0x46')])){return _0x3f05a9[_0x0cb3('0x6e')][_0x0cb3('0x71')]({'attributes':['id'],'raw':!![]})[_0x0cb3('0x15')](function(_0x16da98){if(_[_0x0cb3('0x57')](_0x16da98)){_0x4dba44[_0x0cb3('0x2c')]('c.ListId\x20IS\x20NULL');_0x1172bc[_0x0cb3('0x2c')](_0x0cb3('0x72'));}else{_0x4dba44[_0x0cb3('0x2c')](_0x0cb3('0x59'),_['map'](_0x16da98,'id'));_0x1172bc[_0x0cb3('0x2c')](_0x0cb3('0x59'),_[_0x0cb3('0x42')](_0x16da98,'id'));}});}})[_0x0cb3('0x15')](function(){if(_0x3f05a9['user'][_0x0cb3('0x73')]==='agent'&&!_0x36fa66&&!_0x3f05a9[_0x0cb3('0x25')]['ListId'])return[];return db[_0x0cb3('0x74')]['query'](_0x4dba44[_0x0cb3('0x75')](),_0x3b833b);})[_0x0cb3('0x15')](function(_0x558b4b){_0xa3c190[_0x0cb3('0x12')]=_0x558b4b[_0x0cb3('0x1e')];if(_0xa3c190['count']===0x0)return[];return db['sequelize'][_0x0cb3('0x25')](_0x23c339[_0x0cb3('0x75')](),_0x3b833b)[_0x0cb3('0x15')](function(_0x420299){_0x52e757=_[_0x0cb3('0x76')](_0x420299,'id');_0x3b833b=_[_0x0cb3('0x77')](_0x3b833b,{'model':db['CmContact'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x3f05a9[_0x0cb3('0x25')][_0x0cb3('0x29')]){_0x6b0a3e[_0x0cb3('0x28')]['forEach'](function(_0x23d3b9){_0x1172bc[_0x0cb3('0x2e')]('c.'+_0x23d3b9);});}else{_0x1172bc['field'](_0x0cb3('0x78'));_0x1172bc[_0x0cb3('0x2e')]('c.firstName');_0x1172bc[_0x0cb3('0x2e')](_0x0cb3('0x79'));_0x1172bc['field'](_0x0cb3('0x7a'));_0x1172bc[_0x0cb3('0x2e')]('c.mobile');_0x1172bc[_0x0cb3('0x2e')](_0x0cb3('0x7b'));_0x1172bc['field'](_0x0cb3('0x7c'));_0x1172bc[_0x0cb3('0x2e')]('c.ListId');_0x1172bc[_0x0cb3('0x2e')]('c.createdAt');_0x1172bc[_0x0cb3('0x2e')](_0x0cb3('0x7d'));_0x1172bc[_0x0cb3('0x2e')](_0x0cb3('0x7e'));_0x1172bc[_0x0cb3('0x2e')](_0x0cb3('0x7f'),_0x0cb3('0x80'));}if(_0x6b0a3e[_0x0cb3('0x11')])_0x1172bc[_0x0cb3('0x11')](_0x6b0a3e[_0x0cb3('0x11')]);if(_0x6b0a3e[_0x0cb3('0x13')])_0x1172bc[_0x0cb3('0x13')](_0x6b0a3e['offset']);return db['sequelize'][_0x0cb3('0x25')](_0x1172bc['toString'](),_0x3b833b);});})[_0x0cb3('0x15')](function(_0x317870){_0x317870[_0x0cb3('0x43')](function(_0x1bf5d7){if(_0x1bf5d7[_0x0cb3('0x80')]){_0x1bf5d7[_0x0cb3('0x81')]=[];_0x1bf5d7['TagIds']['split'](',')[_0x0cb3('0x43')](function(_0x34695f){_0x1bf5d7[_0x0cb3('0x81')][_0x0cb3('0x56')](_0x52e757[_0x34695f]);});}delete _0x1bf5d7['TagIds'];});_0xa3c190[_0x0cb3('0x82')]=_0x317870;return _0xa3c190;})[_0x0cb3('0x15')](respondWithFilteredResult(_0x4349f8,_0x6b0a3e));})[_0x0cb3('0x83')](handleError(_0x4349f8,null));};exports['destroy']=function(_0x5ee766,_0x394b13){return db[_0x0cb3('0x1b')][_0x0cb3('0x3f')]({'where':{'id':_0x5ee766[_0x0cb3('0x84')]['id']}})[_0x0cb3('0x15')](handleEntityNotFound(_0x394b13,null))[_0x0cb3('0x15')](removeEntity(_0x394b13,null))[_0x0cb3('0x83')](handleError(_0x394b13,null));};exports['describe']=function(_0x3177ae,_0x5dc22d){return db[_0x0cb3('0x1b')][_0x0cb3('0x1c')]()[_0x0cb3('0x15')](function(_0x4beede){delete _0x4beede[_0x0cb3('0x85')];for(var _0x349ce7=0x0;_0x349ce7=_0x4c15b1){_0x2b60a9=_0x4c15b1;_0x105a7d=0xc8;}else{_0x105a7d=0xce;}_0x21e001[_0x5585('0x10')](_0x105a7d);return _0x21e001['set']('Content-Range',_0x45517c+'-'+_0x2b60a9+'/'+_0x4c15b1)[_0x5585('0x11')](_0x11c462);}return null;};}function saveUpdates(_0x4c778a){return function(_0x4c84a4){if(_0x4c84a4){return _0x4c84a4['update'](_0x4c778a)[_0x5585('0x16')](function(_0x310efe){return _0x310efe;});}return null;};}function removeEntity(_0x88fb85){return function(_0x49744c){if(_0x49744c){return _0x49744c['destroy']()[_0x5585('0x16')](function(){_0x88fb85[_0x5585('0x10')](0xcc)[_0x5585('0x17')]();});}};}function handleEntityNotFound(_0x20e501){return function(_0xff21bc){if(!_0xff21bc){_0x20e501['sendStatus'](0x194);}return _0xff21bc;};}function handleError(_0x2fcf90,_0x5f614f){_0x5f614f=_0x5f614f||0x1f4;return function(_0x34e9db){logger[_0x5585('0x18')](_0x34e9db[_0x5585('0x19')]);if(_0x34e9db['name']){delete _0x34e9db[_0x5585('0x1a')];}_0x2fcf90[_0x5585('0x10')](_0x5f614f)[_0x5585('0x1b')](_0x34e9db);};}exports[_0x5585('0x1c')]=function(_0x34b5e7,_0x3e9a70){var _0x5f1685={},_0x1bc378={},_0xec6964={'count':0x0,'rows':[]};return db[_0x5585('0x1d')][_0x5585('0x1e')]()[_0x5585('0x16')](function(_0x37aaf6){var _0x3d43f6=[];for(var _0x2ea739=0x0;_0x2ea7390x1){_0x478617['or'](_0x5585('0x55'),qs['getFullTextValue'](_0x5f3802),null);}else{if(qs[_0x5585('0x56')](_0x5f3802)){_0x478617['or'](_0x5585('0x57'),_0x5f3802+'%');_0x478617['or'](_0x5585('0x58'),_0x5f3802+'%');_0x478617['or'](_0x5585('0x59'),_0x5f3802+'%');_0x478617['or'](_0x5585('0x5a'),_0x5f3802+'%');}else if(qs[_0x5585('0x5b')](_0x5f3802)){_0x478617['or'](_0x5585('0x5c'),_0x5f3802+'%');}else{_0x478617['or']('c.firstName\x20LIKE\x20?','%'+_0x5f3802+'%');_0x478617['or']('c.lastName\x20LIKE\x20?','%'+_0x5f3802+'%');_0x478617['or'](_0x5585('0x5c'),'%'+_0x5f3802+'%');}}}}_0x2c738c[_0x5585('0x37')](_0x478617);_0x2c738c[_0x5585('0x5d')]('c.id');var _0x1b0174={'type':db['Sequelize'][_0x5585('0x5e')][_0x5585('0x5f')],'raw':!![]};var _0x26c2ab=_0x2c738c[_0x5585('0x60')]()['field']('c.id');if(_0x5f1685[_0x5585('0x2d')]){_0x5f1685[_0x5585('0x2d')]['forEach'](function(_0x3ccd3f){_0x2c738c[_0x5585('0x2d')]('c.'+_0x3ccd3f[0x0],_0x3ccd3f[0x1]===_0x5585('0x61')?![]:!![]);});}if(!_[_0x5585('0x4b')](_0x5b5b80)){_0x2c738c[_0x5585('0x62')](_0x2f5b61);_0x26c2ab[_0x5585('0x37')](_0x5585('0x63'),_0x5b5b80);}BPromise[_0x5585('0x64')]()['then'](function(){if(!_0x2ad015)return;if(_0x34b5e7[_0x5585('0x65')][_0x5585('0x66')]!==_0x5585('0x67'))return;if(!_[_0x5585('0x68')](_0x2ad015[_0x5585('0x69')],[_0x5585('0x2f'),_0x5585('0x6a')])){return _0x34b5e7[_0x5585('0x65')][_0x5585('0x6b')]({'attributes':['id'],'raw':!![]})[_0x5585('0x16')](function(_0x218c82){if(_[_0x5585('0x4b')](_0x218c82)){_0x26c2ab[_0x5585('0x37')](_0x5585('0x6c'));_0x2c738c[_0x5585('0x37')](_0x5585('0x6c'));}else{_0x26c2ab['where']('c.ListId\x20IN\x20?',_[_0x5585('0x6d')](_0x218c82,'id'));_0x2c738c['where']('c.ListId\x20IN\x20?',_[_0x5585('0x6d')](_0x218c82,'id'));}});}})[_0x5585('0x16')](function(){if(_0x34b5e7['user']['role']===_0x5585('0x67')&&!_0x2ad015&&!_0x34b5e7[_0x5585('0x26')]['ListId'])return[];return db[_0x5585('0x6e')][_0x5585('0x26')](_0x26c2ab['toString'](),_0x1b0174);})[_0x5585('0x16')](function(_0x58583f){_0xec6964[_0x5585('0x14')]=_0x58583f[_0x5585('0x20')];if(_0xec6964['count']===0x0)return[];return db[_0x5585('0x6e')][_0x5585('0x26')](_0x5682b4['toString'](),_0x1b0174)[_0x5585('0x16')](function(_0x570d26){_0x486845=_[_0x5585('0x6f')](_0x570d26,'id');_0x1b0174=_[_0x5585('0x70')](_0x1b0174,{'model':db['CmContact'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x34b5e7[_0x5585('0x26')][_0x5585('0x2a')]){_0x5f1685[_0x5585('0x29')][_0x5585('0x3d')](function(_0x421c33){_0x2c738c[_0x5585('0x2f')]('c.'+_0x421c33);});}else{_0x2c738c[_0x5585('0x2f')](_0x5585('0x71'));_0x2c738c[_0x5585('0x2f')](_0x5585('0x72'));_0x2c738c[_0x5585('0x2f')](_0x5585('0x73'));_0x2c738c['field'](_0x5585('0x74'));_0x2c738c[_0x5585('0x2f')](_0x5585('0x75'));_0x2c738c[_0x5585('0x2f')]('c.fax');_0x2c738c['field'](_0x5585('0x76'));_0x2c738c[_0x5585('0x2f')](_0x5585('0x77'));_0x2c738c['field'](_0x5585('0x78'));_0x2c738c[_0x5585('0x2f')](_0x5585('0x79'));_0x2c738c['field'](_0x5585('0x7a'));_0x2c738c['field'](_0x5585('0x7b'),_0x5585('0x7c'));}if(_0x5f1685[_0x5585('0x15')])_0x2c738c[_0x5585('0x15')](_0x5f1685['limit']);if(_0x5f1685[_0x5585('0x12')])_0x2c738c[_0x5585('0x12')](_0x5f1685[_0x5585('0x12')]);return db[_0x5585('0x6e')][_0x5585('0x26')](_0x2c738c[_0x5585('0x7d')](),_0x1b0174);});})[_0x5585('0x16')](function(_0x316291){_0x316291['forEach'](function(_0x4362f1){if(_0x4362f1[_0x5585('0x7c')]){_0x4362f1[_0x5585('0x7e')]=[];_0x4362f1[_0x5585('0x7c')][_0x5585('0x54')](',')[_0x5585('0x3d')](function(_0x96675f){_0x4362f1[_0x5585('0x7e')][_0x5585('0x4a')](_0x486845[_0x96675f]);});}delete _0x4362f1[_0x5585('0x7c')];});_0xec6964[_0x5585('0x7f')]=_0x316291;return _0xec6964;})[_0x5585('0x16')](respondWithFilteredResult(_0x3e9a70,_0x5f1685));})['catch'](handleError(_0x3e9a70,null));};exports['destroy']=function(_0x5bf5b8,_0x36eae8){return db[_0x5585('0x1d')][_0x5585('0x80')]({'where':{'id':_0x5bf5b8[_0x5585('0x81')]['id']}})[_0x5585('0x16')](handleEntityNotFound(_0x36eae8,null))[_0x5585('0x16')](removeEntity(_0x36eae8,null))[_0x5585('0x82')](handleError(_0x36eae8,null));};exports[_0x5585('0x1e')]=function(_0x41f197,_0xec86fd){return db[_0x5585('0x1d')][_0x5585('0x1e')]()[_0x5585('0x16')](function(_0x5137e5){delete _0x5137e5['tags'];for(var _0x26d09a=0x0;_0x26d09a{}\s\\|]/g,'-');_0xeca696(null,util['format']('%s-%s%s',path['basename'](_0x6c03bb[_0xe5d2('0x23')],path[_0xe5d2('0x25')](_0x6c03bb['originalname'])),Date[_0xe5d2('0x26')](),path[_0xe5d2('0x25')](_0x6c03bb['originalname'])));}})});router[_0xe5d2('0x1a')](_0xe5d2('0x27'),upload['single'](_0xe5d2('0x28')),controller['uploadCsv']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0xaf3692,_0x551cf5,_0x2d4852){_0x2d4852(null,path[_0xe5d2('0x20')](config['root'],_0xe5d2('0x22')));},'filename':function(_0xa6980d,_0x42b69b,_0x5b746d){_0x42b69b[_0xe5d2('0x23')]=_0x42b69b[_0xe5d2('0x23')][_0xe5d2('0x24')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x5b746d(null,util[_0xe5d2('0x29')](_0xe5d2('0x2a'),path[_0xe5d2('0x2b')](_0x42b69b['originalname'],path[_0xe5d2('0x25')](_0x42b69b[_0xe5d2('0x23')])),Date[_0xe5d2('0x26')](),path['extname'](_0x42b69b[_0xe5d2('0x23')])));}})});router[_0xe5d2('0x1a')](_0xe5d2('0x2c'),upload[_0xe5d2('0x2d')](_0xe5d2('0x28')),controller[_0xe5d2('0x2e')]);router['post'](_0xe5d2('0x2f'),auth['isAuthenticated'](),controller[_0xe5d2('0x30')]);router[_0xe5d2('0x31')](_0xe5d2('0xe'),auth[_0xe5d2('0xb')](),controller[_0xe5d2('0x32')]);router['delete'](_0xe5d2('0xe'),auth['isAuthenticated'](),controller[_0xe5d2('0x33')]);module['exports']=router; \ No newline at end of file +var _0xb096=['create','bulkCreate','join','root','server/files/tmp','originalname','format','%s-%s%s','basename','extname','now','/csv','file','uploadCsv','diskStorage','replace','/upload','single','upload','/upload/:id','import','put','update','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/tags','getTags','/:id/hoppers','getHoppers','/:id/hopper_histories','getHopperHistories','/:id/hopper_finals','getHopperFinals','getJscriptySessions','/:id/journey','getJourney','post','/merge','merge'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0xb096,0x116));var _0x6b09=function(_0x2bf5a4,_0x33f376){_0x2bf5a4=_0x2bf5a4-0x0;var _0x77e57a=_0xb096[_0x2bf5a4];return _0x77e57a;};'use strict';var multer=require('multer');var util=require(_0x6b09('0x0'));var path=require('path');var timeout=require(_0x6b09('0x1'));var express=require(_0x6b09('0x2'));var router=express[_0x6b09('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x6b09('0x4'));var interaction=require(_0x6b09('0x5'));var config=require(_0x6b09('0x6'));var controller=require('./cmContact.controller');router[_0x6b09('0x7')]('/',auth[_0x6b09('0x8')](),controller[_0x6b09('0x9')]);router[_0x6b09('0x7')](_0x6b09('0xa'),auth['isAuthenticated'](),controller[_0x6b09('0xb')]);router[_0x6b09('0x7')](_0x6b09('0xc'),auth['isAuthenticated'](),controller[_0x6b09('0xd')]);router[_0x6b09('0x7')](_0x6b09('0xe'),auth['isAuthenticated'](),controller[_0x6b09('0xf')]);router[_0x6b09('0x7')](_0x6b09('0x10'),auth[_0x6b09('0x8')](),controller[_0x6b09('0x11')]);router[_0x6b09('0x7')](_0x6b09('0x12'),auth[_0x6b09('0x8')](),controller[_0x6b09('0x13')]);router[_0x6b09('0x7')](_0x6b09('0x14'),auth[_0x6b09('0x8')](),controller[_0x6b09('0x15')]);router[_0x6b09('0x7')]('/:id/jscripty_sessions',auth[_0x6b09('0x8')](),controller[_0x6b09('0x16')]);router[_0x6b09('0x7')](_0x6b09('0x17'),auth['isAuthenticated'](),controller[_0x6b09('0x18')]);router[_0x6b09('0x19')](_0x6b09('0x1a'),auth['isAuthenticated'](),controller[_0x6b09('0x1b')]);router['post']('/',auth[_0x6b09('0x8')](),controller[_0x6b09('0x1c')]);router['post']('/create_many',auth[_0x6b09('0x8')](),controller[_0x6b09('0x1d')]);router[_0x6b09('0x19')](_0x6b09('0xe'),auth[_0x6b09('0x8')](),controller['setTags']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x1bff6c,_0x38e1c7,_0x3ef197){_0x3ef197(null,path[_0x6b09('0x1e')](config[_0x6b09('0x1f')],_0x6b09('0x20')));},'filename':function(_0x1becc7,_0x3d0370,_0x455097){_0x3d0370[_0x6b09('0x21')]=_0x3d0370[_0x6b09('0x21')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x455097(null,util[_0x6b09('0x22')](_0x6b09('0x23'),path[_0x6b09('0x24')](_0x3d0370['originalname'],path[_0x6b09('0x25')](_0x3d0370[_0x6b09('0x21')])),Date[_0x6b09('0x26')](),path[_0x6b09('0x25')](_0x3d0370[_0x6b09('0x21')])));}})});router['post'](_0x6b09('0x27'),upload['single'](_0x6b09('0x28')),controller[_0x6b09('0x29')]);var upload=multer({'storage':multer[_0x6b09('0x2a')]({'destination':function(_0x3f9a32,_0x12b9f4,_0x409870){_0x409870(null,path['join'](config['root'],_0x6b09('0x20')));},'filename':function(_0x36fb6f,_0x2ce4b7,_0x237c7d){_0x2ce4b7['originalname']=_0x2ce4b7['originalname'][_0x6b09('0x2b')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x237c7d(null,util['format'](_0x6b09('0x23'),path[_0x6b09('0x24')](_0x2ce4b7[_0x6b09('0x21')],path[_0x6b09('0x25')](_0x2ce4b7[_0x6b09('0x21')])),Date[_0x6b09('0x26')](),path[_0x6b09('0x25')](_0x2ce4b7[_0x6b09('0x21')])));}})});router[_0x6b09('0x19')](_0x6b09('0x2c'),upload[_0x6b09('0x2d')](_0x6b09('0x28')),controller[_0x6b09('0x2e')]);router[_0x6b09('0x19')](_0x6b09('0x2f'),auth[_0x6b09('0x8')](),controller[_0x6b09('0x30')]);router[_0x6b09('0x31')](_0x6b09('0xc'),auth['isAuthenticated'](),controller[_0x6b09('0x32')]);router['delete'](_0x6b09('0xc'),auth[_0x6b09('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.attributes.js b/server/api/cmCustomField/cmCustomField.attributes.js index a9f8fa0..252bd04 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 _0x4aaa=['lodash','exports','VIRTUAL','alias','STRING','TEXT','long','getDataValue','select','values','isArray','setDataValue','stringify','BOOLEAN','voice','sequelize'];(function(_0x292fbe,_0x1148ec){var _0x53ddce=function(_0x1890e5){while(--_0x1890e5){_0x292fbe['push'](_0x292fbe['shift']());}};_0x53ddce(++_0x1148ec);}(_0x4aaa,0x17f));var _0xa4aa=function(_0x2340f3,_0x7071ba){_0x2340f3=_0x2340f3-0x0;var _0x4aca8b=_0x4aaa[_0x2340f3];return _0x4aca8b;};'use strict';var Sequelize=require(_0xa4aa('0x0'));var _=require(_0xa4aa('0x1'));module[_0xa4aa('0x2')]={'name':{'type':Sequelize[_0xa4aa('0x3')],'get':function(_0x38dd65){return this['getDataValue']('alias');}},'alias':{'type':Sequelize['STRING'],'allowNull':![],'set':function(_0x2b04d1){this['setDataValue'](_0xa4aa('0x4'),_0x2b04d1?_0x2b04d1:this['getDataValue']('name'));}},'type':{'type':Sequelize[_0xa4aa('0x5')],'allowNull':![]},'values':{'type':Sequelize[_0xa4aa('0x6')](_0xa4aa('0x7')),'get':function(){if(this[_0xa4aa('0x8')]('type')===_0xa4aa('0x9')){return JSON['parse'](this['getDataValue'](_0xa4aa('0xa')));}else{return this['getDataValue']('values');}},'set':function(_0x238c24){if(Array[_0xa4aa('0xb')](_0x238c24)){this[_0xa4aa('0xc')]('values',JSON[_0xa4aa('0xd')](_0x238c24));}else{this[_0xa4aa('0xc')](_0xa4aa('0xa'),_0x238c24);}}},'required':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'clickToAction':{'type':Sequelize[_0xa4aa('0xe')],'defaultValue':![]},'actionType':{'type':Sequelize['ENUM'](_0xa4aa('0xf'))}}; \ No newline at end of file +var _0x9cda=['exports','VIRTUAL','getDataValue','alias','name','STRING','TEXT','long','type','select','values','isArray','setDataValue','stringify','BOOLEAN','ENUM','voice','sequelize','lodash'];(function(_0xb1a861,_0x3d5de1){var _0x10ed93=function(_0x744869){while(--_0x744869){_0xb1a861['push'](_0xb1a861['shift']());}};_0x10ed93(++_0x3d5de1);}(_0x9cda,0xbc));var _0xa9cd=function(_0x5b6aca,_0x4cba88){_0x5b6aca=_0x5b6aca-0x0;var _0x59c26d=_0x9cda[_0x5b6aca];return _0x59c26d;};'use strict';var Sequelize=require(_0xa9cd('0x0'));var _=require(_0xa9cd('0x1'));module[_0xa9cd('0x2')]={'name':{'type':Sequelize[_0xa9cd('0x3')],'get':function(_0x5bdc69){return this[_0xa9cd('0x4')](_0xa9cd('0x5'));}},'alias':{'type':Sequelize['STRING'],'allowNull':![],'set':function(_0x6a2317){this['setDataValue'](_0xa9cd('0x5'),_0x6a2317?_0x6a2317:this['getDataValue'](_0xa9cd('0x6')));}},'type':{'type':Sequelize[_0xa9cd('0x7')],'allowNull':![]},'values':{'type':Sequelize[_0xa9cd('0x8')](_0xa9cd('0x9')),'get':function(){if(this['getDataValue'](_0xa9cd('0xa'))===_0xa9cd('0xb')){return JSON['parse'](this[_0xa9cd('0x4')](_0xa9cd('0xc')));}else{return this[_0xa9cd('0x4')](_0xa9cd('0xc'));}},'set':function(_0x3565e1){if(Array[_0xa9cd('0xd')](_0x3565e1)){this[_0xa9cd('0xe')](_0xa9cd('0xc'),JSON[_0xa9cd('0xf')](_0x3565e1));}else{this[_0xa9cd('0xe')](_0xa9cd('0xc'),_0x3565e1);}}},'required':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'clickToAction':{'type':Sequelize[_0xa9cd('0x10')],'defaultValue':![]},'actionType':{'type':Sequelize[_0xa9cd('0x11')](_0xa9cd('0x12'))}}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.controller.js b/server/api/cmCustomField/cmCustomField.controller.js index 08a8fde..b7878e6 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 _0x048d=['merge','type','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','rawAttributes','intersection','fields','options','find','body','sequelize','transaction','Sequelize','number','INTEGER','switch','BOOLEAN','defaultValue','addColumn','cm_contacts','format','cf_%d','eml-format','rimraf','fast-json-patch','moment','bluebird','util','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','index','map','CmCustomField','fieldName','key','model','differenceBy','query','keys','attributes','length','hasOwnProperty','nolimit','offset','sort','where','pick','filters','filter'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x048d,0x1de));var _0xd048=function(_0x11e1c2,_0x65c9a8){_0x11e1c2=_0x11e1c2-0x0;var _0xfc6810=_0x048d[_0x11e1c2];return _0xfc6810;};'use strict';var emlformat=require(_0xd048('0x0'));var rimraf=require(_0xd048('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd048('0x2'));var rp=require('request-promise');var moment=require(_0xd048('0x3'));var BPromise=require(_0xd048('0x4'));var Mustache=require('mustache');var util=require(_0xd048('0x5'));var path=require(_0xd048('0x6'));var sox=require('sox');var csv=require(_0xd048('0x7'));var ejs=require(_0xd048('0x8'));var fs=require('fs');var fs_extra=require(_0xd048('0x9'));var _=require(_0xd048('0xa'));var squel=require(_0xd048('0xb'));var crypto=require('crypto');var jsforce=require(_0xd048('0xc'));var deskjs=require(_0xd048('0xd'));var toCsv=require(_0xd048('0x7'));var querystring=require(_0xd048('0xe'));var Papa=require(_0xd048('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xd048('0x10'));var as=require(_0xd048('0x11'));var hardwareService=require(_0xd048('0x12'));var logger=require(_0xd048('0x13'))(_0xd048('0x14'));var utils=require(_0xd048('0x15'));var config=require(_0xd048('0x16'));var licenseUtil=require(_0xd048('0x17'));var db=require(_0xd048('0x18'))['db'];function respondWithStatusCode(_0x57ec23,_0x1c34c8){_0x1c34c8=_0x1c34c8||0xcc;return function(_0xa703bb){if(_0xa703bb){return _0x57ec23[_0xd048('0x19')](_0x1c34c8);}return _0x57ec23['status'](_0x1c34c8)[_0xd048('0x1a')]();};}function respondWithResult(_0x49c9cf,_0x15346d){_0x15346d=_0x15346d||0xc8;return function(_0x583aa5){if(_0x583aa5){return _0x49c9cf[_0xd048('0x1b')](_0x15346d)[_0xd048('0x1c')](_0x583aa5);}};}function respondWithFilteredResult(_0xba387b,_0x4ee9cc){return function(_0x41ca5a){if(_0x41ca5a){var _0x326060=typeof _0x4ee9cc['offset']===_0xd048('0x1d')&&typeof _0x4ee9cc[_0xd048('0x1e')]===_0xd048('0x1d');var _0x4b7f9c=_0x41ca5a[_0xd048('0x1f')];var _0x362d00=_0x326060?0x0:_0x4ee9cc['offset'];var _0x598b82=_0x326060?_0x41ca5a[_0xd048('0x1f')]:_0x4ee9cc['offset']+_0x4ee9cc['limit'];var _0x149464;if(_0x598b82>=_0x4b7f9c){_0x598b82=_0x4b7f9c;_0x149464=0xc8;}else{_0x149464=0xce;}_0xba387b[_0xd048('0x1b')](_0x149464);return _0xba387b[_0xd048('0x20')](_0xd048('0x21'),_0x362d00+'-'+_0x598b82+'/'+_0x4b7f9c)['json'](_0x41ca5a);}return null;};}function patchUpdates(_0x45c170){return function(_0x2de2c5){try{jsonpatch[_0xd048('0x22')](_0x2de2c5,_0x45c170,!![]);}catch(_0x261a29){return BPromise[_0xd048('0x23')](_0x261a29);}return _0x2de2c5[_0xd048('0x24')]();};}function saveUpdates(_0x66715a,_0x53f04d){return function(_0x507f03){if(_0x507f03){return _0x507f03[_0xd048('0x25')](_0x66715a)[_0xd048('0x26')](function(_0x543e04){return _0x543e04;});}return null;};}function removeEntity(_0x4baf48,_0x247e47){return function(_0x167a59){if(_0x167a59){return _0x167a59[_0xd048('0x27')]()[_0xd048('0x26')](function(){_0x4baf48[_0xd048('0x1b')](0xcc)[_0xd048('0x1a')]();});}};}function handleEntityNotFound(_0x258d77,_0x2c0953){return function(_0x4bc432){if(!_0x4bc432){_0x258d77[_0xd048('0x19')](0x194);}return _0x4bc432;};}function handleError(_0x423e33,_0x46bbbd){_0x46bbbd=_0x46bbbd||0x1f4;return function(_0x27ffb1){logger[_0xd048('0x28')](_0x27ffb1[_0xd048('0x29')]);if(_0x27ffb1[_0xd048('0x2a')]){delete _0x27ffb1[_0xd048('0x2a')];}_0x423e33[_0xd048('0x1b')](_0x46bbbd)['send'](_0x27ffb1);};}exports[_0xd048('0x2b')]=function(_0x2cad95,_0x496b43){var _0x15af5a={},_0x52439c={},_0xb9f29f={'count':0x0,'rows':[]};var _0x342b27=_[_0xd048('0x2c')](db[_0xd048('0x2d')]['rawAttributes'],function(_0xfd87d5){return{'name':_0xfd87d5[_0xd048('0x2e')],'type':_0xfd87d5['type'][_0xd048('0x2f')]};});_0x52439c[_0xd048('0x30')]=_[_0xd048('0x31')](_[_0xd048('0x2c')](_0x342b27,'name'),[_0xd048('0x2a')]);_0x52439c[_0xd048('0x32')]=_[_0xd048('0x33')](_0x2cad95['query']);_0x52439c['filters']=_['intersection'](_0x52439c[_0xd048('0x30')],_0x52439c[_0xd048('0x32')]);_0x15af5a[_0xd048('0x34')]=_['intersection'](_0x52439c[_0xd048('0x30')],qs['fields'](_0x2cad95[_0xd048('0x32')]['fields']));_0x15af5a[_0xd048('0x34')]=_0x15af5a['attributes'][_0xd048('0x35')]?_0x15af5a['attributes']:_0x52439c['model'];if(!_0x2cad95[_0xd048('0x32')][_0xd048('0x36')](_0xd048('0x37'))){_0x15af5a[_0xd048('0x1e')]=qs['limit'](_0x2cad95[_0xd048('0x32')][_0xd048('0x1e')]);_0x15af5a['offset']=qs[_0xd048('0x38')](_0x2cad95[_0xd048('0x32')][_0xd048('0x38')]);}_0x15af5a['order']=qs[_0xd048('0x39')](_0x2cad95[_0xd048('0x32')][_0xd048('0x39')]);_0x15af5a[_0xd048('0x3a')]=qs['filters'](_[_0xd048('0x3b')](_0x2cad95['query'],_0x52439c[_0xd048('0x3c')]),_0x342b27);if(_0x2cad95['query'][_0xd048('0x3d')]){_0x15af5a[_0xd048('0x3a')]=_[_0xd048('0x3e')](_0x15af5a[_0xd048('0x3a')],{'$or':_[_0xd048('0x2c')](_0x342b27,function(_0x140b87){if(_0x140b87[_0xd048('0x3f')]!==_0xd048('0x40')){var _0x109c36={};_0x109c36[_0x140b87[_0xd048('0x2a')]]={'$like':'%'+_0x2cad95[_0xd048('0x32')][_0xd048('0x3d')]+'%'};return _0x109c36;}})});}_0x15af5a=_['merge']({},_0x15af5a,_0x2cad95['options']);var _0x154b21={'where':_0x15af5a[_0xd048('0x3a')]};return db[_0xd048('0x2d')]['count'](_0x154b21)[_0xd048('0x26')](function(_0x1aa4cd){_0xb9f29f[_0xd048('0x1f')]=_0x1aa4cd;if(_0x2cad95['query'][_0xd048('0x41')]){_0x15af5a[_0xd048('0x42')]=[{'all':!![]}];}return db['CmCustomField'][_0xd048('0x43')](_0x15af5a);})[_0xd048('0x26')](function(_0x61a39b){_0xb9f29f[_0xd048('0x44')]=_0x61a39b;return _0xb9f29f;})[_0xd048('0x26')](respondWithFilteredResult(_0x496b43,_0x15af5a))[_0xd048('0x45')](handleError(_0x496b43,null));};exports[_0xd048('0x46')]=function(_0x3b5242,_0x2ab7c9){var _0x6ab41f={'raw':!![],'where':{'id':_0x3b5242[_0xd048('0x47')]['id']}},_0x704550={};_0x704550[_0xd048('0x30')]=_['keys'](db[_0xd048('0x2d')][_0xd048('0x48')]);_0x704550[_0xd048('0x32')]=_['keys'](_0x3b5242[_0xd048('0x32')]);_0x704550[_0xd048('0x3c')]=_[_0xd048('0x49')](_0x704550['model'],_0x704550['query']);_0x6ab41f[_0xd048('0x34')]=_[_0xd048('0x49')](_0x704550[_0xd048('0x30')],qs[_0xd048('0x4a')](_0x3b5242[_0xd048('0x32')]['fields']));_0x6ab41f[_0xd048('0x34')]=_0x6ab41f[_0xd048('0x34')][_0xd048('0x35')]?_0x6ab41f['attributes']:_0x704550[_0xd048('0x30')];if(_0x3b5242['query'][_0xd048('0x41')]){_0x6ab41f[_0xd048('0x42')]=[{'all':!![]}];}_0x6ab41f=_[_0xd048('0x3e')]({},_0x6ab41f,_0x3b5242[_0xd048('0x4b')]);return db[_0xd048('0x2d')][_0xd048('0x4c')](_0x6ab41f)[_0xd048('0x26')](handleEntityNotFound(_0x2ab7c9,null))[_0xd048('0x26')](respondWithResult(_0x2ab7c9,null))[_0xd048('0x45')](handleError(_0x2ab7c9,null));};exports[_0xd048('0x25')]=function(_0x1a01bb,_0x17d065){if(_0x1a01bb['body']['id']){delete _0x1a01bb[_0xd048('0x4d')]['id'];}return db[_0xd048('0x2d')][_0xd048('0x4c')]({'where':{'id':_0x1a01bb[_0xd048('0x47')]['id']}})[_0xd048('0x26')](handleEntityNotFound(_0x17d065,null))[_0xd048('0x26')](saveUpdates(_0x1a01bb[_0xd048('0x4d')],null))[_0xd048('0x26')](respondWithResult(_0x17d065,null))[_0xd048('0x45')](handleError(_0x17d065,null));};exports[_0xd048('0x27')]=function(_0x440b92,_0x18477f){return db['CmCustomField'][_0xd048('0x4c')]({'where':{'id':_0x440b92[_0xd048('0x47')]['id']}})[_0xd048('0x26')](handleEntityNotFound(_0x18477f,null))[_0xd048('0x26')](removeEntity(_0x18477f,null))[_0xd048('0x45')](handleError(_0x18477f,null));};exports['create']=function(_0x6ea6b8,_0x30e825){var _0x25cd22;return db[_0xd048('0x4e')][_0xd048('0x4f')](function(_0x55a9fc){return db[_0xd048('0x2d')]['create'](_0x6ea6b8[_0xd048('0x4d')],{'transaction':_0x55a9fc})['then'](function(_0x4c769f){_0x25cd22=_0x4c769f;var _0x54f2ca={'type':db[_0xd048('0x50')]['TEXT'],'transaction':_0x55a9fc};switch(_0x6ea6b8['body'][_0xd048('0x3f')]){case'text':_0x54f2ca[_0xd048('0x3f')]=db[_0xd048('0x50')]['TEXT'];break;case _0xd048('0x51'):_0x54f2ca[_0xd048('0x3f')]=db[_0xd048('0x50')][_0xd048('0x52')];break;case _0xd048('0x53'):_0x54f2ca[_0xd048('0x3f')]=db[_0xd048('0x50')][_0xd048('0x54')];_0x54f2ca[_0xd048('0x55')]=![];break;default:}return db[_0xd048('0x4e')]['queryInterface'][_0xd048('0x56')](_0xd048('0x57'),util[_0xd048('0x58')](_0xd048('0x59'),_0x25cd22['id']),_0x54f2ca);})['then'](function(){return _0x25cd22;});})[_0xd048('0x26')](respondWithResult(_0x30e825,0xc9))[_0xd048('0x45')](handleError(_0x30e825,null));}; \ No newline at end of file +var _0x26a1=['params','body','find','create','sequelize','transaction','Sequelize','text','number','switch','BOOLEAN','defaultValue','queryInterface','addColumn','cm_contacts','format','cf_%d','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','ejs','lodash','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','json','offset','limit','undefined','count','reject','save','update','then','destroy','end','error','stack','name','send','map','CmCustomField','rawAttributes','fieldName','type','model','differenceBy','query','keys','filters','intersection','fields','attributes','length','order','sort','where','pick','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x26a1,0x10a));var _0x126a=function(_0x55f8b4,_0x43f30d){_0x55f8b4=_0x55f8b4-0x0;var _0x2475f9=_0x26a1[_0x55f8b4];return _0x2475f9;};'use strict';var emlformat=require(_0x126a('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x126a('0x1'));var jsonpatch=require(_0x126a('0x2'));var rp=require(_0x126a('0x3'));var moment=require(_0x126a('0x4'));var BPromise=require(_0x126a('0x5'));var Mustache=require('mustache');var util=require(_0x126a('0x6'));var path=require(_0x126a('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x126a('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x126a('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x126a('0xa'));var deskjs=require(_0x126a('0xb'));var toCsv=require(_0x126a('0xc'));var querystring=require('querystring');var Papa=require(_0x126a('0xd'));var Redis=require(_0x126a('0xe'));var authService=require(_0x126a('0xf'));var qs=require(_0x126a('0x10'));var as=require(_0x126a('0x11'));var hardwareService=require(_0x126a('0x12'));var logger=require(_0x126a('0x13'))(_0x126a('0x14'));var utils=require(_0x126a('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x126a('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x506c6a,_0x395ac9){_0x395ac9=_0x395ac9||0xcc;return function(_0x354b7f){if(_0x354b7f){return _0x506c6a[_0x126a('0x17')](_0x395ac9);}return _0x506c6a['status'](_0x395ac9)['end']();};}function respondWithResult(_0x22673e,_0x25b172){_0x25b172=_0x25b172||0xc8;return function(_0x30bc92){if(_0x30bc92){return _0x22673e[_0x126a('0x18')](_0x25b172)[_0x126a('0x19')](_0x30bc92);}};}function respondWithFilteredResult(_0x3b7438,_0x28d9c2){return function(_0x51e621){if(_0x51e621){var _0x20e1d2=typeof _0x28d9c2[_0x126a('0x1a')]==='undefined'&&typeof _0x28d9c2[_0x126a('0x1b')]===_0x126a('0x1c');var _0x5d19e4=_0x51e621['count'];var _0x229668=_0x20e1d2?0x0:_0x28d9c2[_0x126a('0x1a')];var _0x5180bd=_0x20e1d2?_0x51e621[_0x126a('0x1d')]:_0x28d9c2[_0x126a('0x1a')]+_0x28d9c2[_0x126a('0x1b')];var _0x3831a7;if(_0x5180bd>=_0x5d19e4){_0x5180bd=_0x5d19e4;_0x3831a7=0xc8;}else{_0x3831a7=0xce;}_0x3b7438[_0x126a('0x18')](_0x3831a7);return _0x3b7438['set']('Content-Range',_0x229668+'-'+_0x5180bd+'/'+_0x5d19e4)['json'](_0x51e621);}return null;};}function patchUpdates(_0x47b225){return function(_0x20f695){try{jsonpatch['apply'](_0x20f695,_0x47b225,!![]);}catch(_0x530098){return BPromise[_0x126a('0x1e')](_0x530098);}return _0x20f695[_0x126a('0x1f')]();};}function saveUpdates(_0x32921c,_0x23deb0){return function(_0x4cdc6a){if(_0x4cdc6a){return _0x4cdc6a[_0x126a('0x20')](_0x32921c)[_0x126a('0x21')](function(_0x8b6a0d){return _0x8b6a0d;});}return null;};}function removeEntity(_0x31ea14,_0x3e18cc){return function(_0xef9d1e){if(_0xef9d1e){return _0xef9d1e[_0x126a('0x22')]()[_0x126a('0x21')](function(){_0x31ea14['status'](0xcc)[_0x126a('0x23')]();});}};}function handleEntityNotFound(_0x33f8a9,_0x1f1676){return function(_0x40899f){if(!_0x40899f){_0x33f8a9['sendStatus'](0x194);}return _0x40899f;};}function handleError(_0x7982b,_0x39b38e){_0x39b38e=_0x39b38e||0x1f4;return function(_0x2f8737){logger[_0x126a('0x24')](_0x2f8737[_0x126a('0x25')]);if(_0x2f8737['name']){delete _0x2f8737[_0x126a('0x26')];}_0x7982b[_0x126a('0x18')](_0x39b38e)[_0x126a('0x27')](_0x2f8737);};}exports['index']=function(_0x5d4dd9,_0x5a8ebd){var _0x4edb74={},_0x49f974={},_0x50deef={'count':0x0,'rows':[]};var _0x1831b5=_[_0x126a('0x28')](db[_0x126a('0x29')][_0x126a('0x2a')],function(_0xadeb82){return{'name':_0xadeb82[_0x126a('0x2b')],'type':_0xadeb82[_0x126a('0x2c')]['key']};});_0x49f974[_0x126a('0x2d')]=_[_0x126a('0x2e')](_[_0x126a('0x28')](_0x1831b5,_0x126a('0x26')),[_0x126a('0x26')]);_0x49f974[_0x126a('0x2f')]=_[_0x126a('0x30')](_0x5d4dd9[_0x126a('0x2f')]);_0x49f974[_0x126a('0x31')]=_[_0x126a('0x32')](_0x49f974[_0x126a('0x2d')],_0x49f974[_0x126a('0x2f')]);_0x4edb74['attributes']=_[_0x126a('0x32')](_0x49f974[_0x126a('0x2d')],qs['fields'](_0x5d4dd9[_0x126a('0x2f')][_0x126a('0x33')]));_0x4edb74[_0x126a('0x34')]=_0x4edb74['attributes'][_0x126a('0x35')]?_0x4edb74[_0x126a('0x34')]:_0x49f974[_0x126a('0x2d')];if(!_0x5d4dd9['query']['hasOwnProperty']('nolimit')){_0x4edb74[_0x126a('0x1b')]=qs['limit'](_0x5d4dd9[_0x126a('0x2f')]['limit']);_0x4edb74[_0x126a('0x1a')]=qs[_0x126a('0x1a')](_0x5d4dd9['query'][_0x126a('0x1a')]);}_0x4edb74[_0x126a('0x36')]=qs[_0x126a('0x37')](_0x5d4dd9[_0x126a('0x2f')][_0x126a('0x37')]);_0x4edb74[_0x126a('0x38')]=qs[_0x126a('0x31')](_[_0x126a('0x39')](_0x5d4dd9['query'],_0x49f974[_0x126a('0x31')]),_0x1831b5);if(_0x5d4dd9[_0x126a('0x2f')]['filter']){_0x4edb74[_0x126a('0x38')]=_[_0x126a('0x3a')](_0x4edb74[_0x126a('0x38')],{'$or':_['map'](_0x1831b5,function(_0x2b978d){if(_0x2b978d[_0x126a('0x2c')]!==_0x126a('0x3b')){var _0x2d106d={};_0x2d106d[_0x2b978d[_0x126a('0x26')]]={'$like':'%'+_0x5d4dd9[_0x126a('0x2f')]['filter']+'%'};return _0x2d106d;}})});}_0x4edb74=_[_0x126a('0x3a')]({},_0x4edb74,_0x5d4dd9[_0x126a('0x3c')]);var _0xdb8ed8={'where':_0x4edb74['where']};return db[_0x126a('0x29')][_0x126a('0x1d')](_0xdb8ed8)[_0x126a('0x21')](function(_0x46c943){_0x50deef[_0x126a('0x1d')]=_0x46c943;if(_0x5d4dd9['query'][_0x126a('0x3d')]){_0x4edb74[_0x126a('0x3e')]=[{'all':!![]}];}return db[_0x126a('0x29')][_0x126a('0x3f')](_0x4edb74);})[_0x126a('0x21')](function(_0x574ed7){_0x50deef[_0x126a('0x40')]=_0x574ed7;return _0x50deef;})[_0x126a('0x21')](respondWithFilteredResult(_0x5a8ebd,_0x4edb74))[_0x126a('0x41')](handleError(_0x5a8ebd,null));};exports['show']=function(_0x365933,_0x13433f){var _0x13d1fb={'raw':!![],'where':{'id':_0x365933[_0x126a('0x42')]['id']}},_0x56589d={};_0x56589d[_0x126a('0x2d')]=_[_0x126a('0x30')](db['CmCustomField'][_0x126a('0x2a')]);_0x56589d[_0x126a('0x2f')]=_[_0x126a('0x30')](_0x365933[_0x126a('0x2f')]);_0x56589d['filters']=_[_0x126a('0x32')](_0x56589d[_0x126a('0x2d')],_0x56589d[_0x126a('0x2f')]);_0x13d1fb[_0x126a('0x34')]=_[_0x126a('0x32')](_0x56589d[_0x126a('0x2d')],qs[_0x126a('0x33')](_0x365933[_0x126a('0x2f')][_0x126a('0x33')]));_0x13d1fb[_0x126a('0x34')]=_0x13d1fb[_0x126a('0x34')][_0x126a('0x35')]?_0x13d1fb[_0x126a('0x34')]:_0x56589d['model'];if(_0x365933[_0x126a('0x2f')][_0x126a('0x3d')]){_0x13d1fb[_0x126a('0x3e')]=[{'all':!![]}];}_0x13d1fb=_[_0x126a('0x3a')]({},_0x13d1fb,_0x365933[_0x126a('0x3c')]);return db[_0x126a('0x29')]['find'](_0x13d1fb)['then'](handleEntityNotFound(_0x13433f,null))[_0x126a('0x21')](respondWithResult(_0x13433f,null))[_0x126a('0x41')](handleError(_0x13433f,null));};exports[_0x126a('0x20')]=function(_0xd442ac,_0xd655f0){if(_0xd442ac[_0x126a('0x43')]['id']){delete _0xd442ac['body']['id'];}return db[_0x126a('0x29')][_0x126a('0x44')]({'where':{'id':_0xd442ac['params']['id']}})['then'](handleEntityNotFound(_0xd655f0,null))[_0x126a('0x21')](saveUpdates(_0xd442ac[_0x126a('0x43')],null))[_0x126a('0x21')](respondWithResult(_0xd655f0,null))[_0x126a('0x41')](handleError(_0xd655f0,null));};exports['destroy']=function(_0x323621,_0x2ef492){return db['CmCustomField'][_0x126a('0x44')]({'where':{'id':_0x323621[_0x126a('0x42')]['id']}})['then'](handleEntityNotFound(_0x2ef492,null))[_0x126a('0x21')](removeEntity(_0x2ef492,null))[_0x126a('0x41')](handleError(_0x2ef492,null));};exports[_0x126a('0x45')]=function(_0x8e612,_0x2ab04a){var _0x4a2c66;return db[_0x126a('0x46')][_0x126a('0x47')](function(_0x1ff2cf){return db[_0x126a('0x29')][_0x126a('0x45')](_0x8e612[_0x126a('0x43')],{'transaction':_0x1ff2cf})[_0x126a('0x21')](function(_0x2ae372){_0x4a2c66=_0x2ae372;var _0x5269d6={'type':db[_0x126a('0x48')]['TEXT'],'transaction':_0x1ff2cf};switch(_0x8e612[_0x126a('0x43')]['type']){case _0x126a('0x49'):_0x5269d6[_0x126a('0x2c')]=db['Sequelize']['TEXT'];break;case _0x126a('0x4a'):_0x5269d6[_0x126a('0x2c')]=db['Sequelize']['INTEGER'];break;case _0x126a('0x4b'):_0x5269d6['type']=db['Sequelize'][_0x126a('0x4c')];_0x5269d6[_0x126a('0x4d')]=![];break;default:}return db['sequelize'][_0x126a('0x4e')][_0x126a('0x4f')](_0x126a('0x50'),util[_0x126a('0x51')](_0x126a('0x52'),_0x4a2c66['id']),_0x5269d6);})[_0x126a('0x21')](function(){return _0x4a2c66;});})[_0x126a('0x21')](respondWithResult(_0x2ab04a,0xc9))[_0x126a('0x41')](handleError(_0x2ab04a,null));}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.model.js b/server/api/cmCustomField/cmCustomField.model.js index d26fe31..577d46a 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 _0x0f58=['./cmCustomField.attributes','CmCustomField','cm_custom_fields','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x186288,_0x3906e9){var _0x1086f4=function(_0x27aa45){while(--_0x27aa45){_0x186288['push'](_0x186288['shift']());}};_0x1086f4(++_0x3906e9);}(_0x0f58,0x18f));var _0x80f5=function(_0x1aa8f6,_0x1f1c93){_0x1aa8f6=_0x1aa8f6-0x0;var _0x3050ea=_0x0f58[_0x1aa8f6];return _0x3050ea;};'use strict';var _=require('lodash');var util=require(_0x80f5('0x0'));var logger=require(_0x80f5('0x1'))(_0x80f5('0x2'));var moment=require(_0x80f5('0x3'));var BPromise=require(_0x80f5('0x4'));var rp=require(_0x80f5('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x80f5('0x6'));module['exports']=function(_0x15f976,_0x117491){return _0x15f976['define'](_0x80f5('0x7'),attributes,{'tableName':_0x80f5('0x8'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7cb7=['../../config/logger','api','moment','exports','define','CmCustomField','cm_custom_fields','lodash','util'];(function(_0x96602e,_0x3d75d4){var _0x5c004d=function(_0x1432ba){while(--_0x1432ba){_0x96602e['push'](_0x96602e['shift']());}};_0x5c004d(++_0x3d75d4);}(_0x7cb7,0xfa));var _0x77cb=function(_0x185a9f,_0x5d995a){_0x185a9f=_0x185a9f-0x0;var _0x4536e8=_0x7cb7[_0x185a9f];return _0x4536e8;};'use strict';var _=require(_0x77cb('0x0'));var util=require(_0x77cb('0x1'));var logger=require(_0x77cb('0x2'))(_0x77cb('0x3'));var moment=require(_0x77cb('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./cmCustomField.attributes');module[_0x77cb('0x5')]=function(_0x5f221a,_0x1f9988){return _0x5f221a[_0x77cb('0x6')](_0x77cb('0x7'),attributes,{'tableName':_0x77cb('0x8'),'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 2e8adea..93dc6c4 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 _0x787f=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','then','info','debug','request\x20sent','stringify','error','code','CmCustomField,\x20%s,\x20%s','message','result','catch'];(function(_0x141e03,_0x18340e){var _0x2074e3=function(_0x2b7ece){while(--_0x2b7ece){_0x141e03['push'](_0x141e03['shift']());}};_0x2074e3(++_0x18340e);}(_0x787f,0xd8));var _0xf787=function(_0x48c9b3,_0x1fb678){_0x48c9b3=_0x48c9b3-0x0;var _0x4c782f=_0x787f[_0x48c9b3];return _0x4c782f;};'use strict';var _=require(_0xf787('0x0'));var util=require(_0xf787('0x1'));var moment=require(_0xf787('0x2'));var BPromise=require(_0xf787('0x3'));var rs=require(_0xf787('0x4'));var fs=require('fs');var Redis=require(_0xf787('0x5'));var db=require(_0xf787('0x6'))['db'];var utils=require(_0xf787('0x7'));var logger=require('../../config/logger')(_0xf787('0x8'));var config=require(_0xf787('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xf787('0xa')][_0xf787('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x324898,_0x108a7e,_0x2ecc31){return new BPromise(function(_0x5dd5aa,_0x2980b8){return client[_0xf787('0xc')](_0x324898,_0x2ecc31)[_0xf787('0xd')](function(_0x4b2d37){logger[_0xf787('0xe')]('CmCustomField,\x20%s,\x20%s',_0x108a7e,'request\x20sent');logger[_0xf787('0xf')]('CmCustomField,\x20%s,\x20%s,\x20%s',_0x108a7e,_0xf787('0x10'),JSON[_0xf787('0x11')](_0x4b2d37));if(_0x4b2d37[_0xf787('0x12')]){if(_0x4b2d37[_0xf787('0x12')][_0xf787('0x13')]===0x1f4){logger['error'](_0xf787('0x14'),_0x108a7e,_0x4b2d37['error'][_0xf787('0x15')]);return _0x2980b8(_0x4b2d37[_0xf787('0x12')]['message']);}logger[_0xf787('0x12')]('CmCustomField,\x20%s,\x20%s',_0x108a7e,_0x4b2d37[_0xf787('0x12')]['message']);return _0x5dd5aa(_0x4b2d37['error'][_0xf787('0x15')]);}else{logger[_0xf787('0xe')]('CmCustomField,\x20%s,\x20%s',_0x108a7e,_0xf787('0x10'));_0x5dd5aa(_0x4b2d37[_0xf787('0x16')][_0xf787('0x15')]);}})[_0xf787('0x17')](function(_0xb4a1f3){logger['error'](_0xf787('0x14'),_0x108a7e,_0xb4a1f3);_0x2980b8(_0xb4a1f3);});});} \ No newline at end of file +var _0x83fe=['lodash','util','bluebird','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then','info','CmCustomField,\x20%s,\x20%s','request\x20sent','CmCustomField,\x20%s,\x20%s,\x20%s','error','code','message','result','catch'];(function(_0x12baed,_0x45a719){var _0x630772=function(_0x449242){while(--_0x449242){_0x12baed['push'](_0x12baed['shift']());}};_0x630772(++_0x45a719);}(_0x83fe,0x1b8));var _0xe83f=function(_0x3d641a,_0x213a8b){_0x3d641a=_0x3d641a-0x0;var _0xa071a9=_0x83fe[_0x3d641a];return _0xa071a9;};'use strict';var _=require(_0xe83f('0x0'));var util=require(_0xe83f('0x1'));var moment=require('moment');var BPromise=require(_0xe83f('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe83f('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xe83f('0x4'));var logger=require('../../config/logger')(_0xe83f('0x5'));var config=require(_0xe83f('0x6'));var jayson=require(_0xe83f('0x7'));var client=jayson[_0xe83f('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x675479,_0xc4ff2,_0x4a1637){return new BPromise(function(_0x13b737,_0xf0db72){return client[_0xe83f('0x9')](_0x675479,_0x4a1637)[_0xe83f('0xa')](function(_0x59a9f8){logger[_0xe83f('0xb')](_0xe83f('0xc'),_0xc4ff2,_0xe83f('0xd'));logger['debug'](_0xe83f('0xe'),_0xc4ff2,_0xe83f('0xd'),JSON['stringify'](_0x59a9f8));if(_0x59a9f8[_0xe83f('0xf')]){if(_0x59a9f8[_0xe83f('0xf')][_0xe83f('0x10')]===0x1f4){logger[_0xe83f('0xf')]('CmCustomField,\x20%s,\x20%s',_0xc4ff2,_0x59a9f8[_0xe83f('0xf')]['message']);return _0xf0db72(_0x59a9f8[_0xe83f('0xf')]['message']);}logger[_0xe83f('0xf')](_0xe83f('0xc'),_0xc4ff2,_0x59a9f8[_0xe83f('0xf')][_0xe83f('0x11')]);return _0x13b737(_0x59a9f8[_0xe83f('0xf')][_0xe83f('0x11')]);}else{logger[_0xe83f('0xb')](_0xe83f('0xc'),_0xc4ff2,_0xe83f('0xd'));_0x13b737(_0x59a9f8[_0xe83f('0x12')][_0xe83f('0x11')]);}})[_0xe83f('0x13')](function(_0x4bd53d){logger[_0xe83f('0xf')](_0xe83f('0xc'),_0xc4ff2,_0x4bd53d);_0xf0db72(_0x4bd53d);});});} \ No newline at end of file diff --git a/server/api/cmCustomField/index.js b/server/api/cmCustomField/index.js index 456d440..ee890a5 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 _0x3641=['../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/:id','show','post','isAuthenticated','create','put','update','delete','destroy','util','express','Router'];(function(_0x3dd93c,_0x773411){var _0x3b2d49=function(_0x309467){while(--_0x309467){_0x3dd93c['push'](_0x3dd93c['shift']());}};_0x3b2d49(++_0x773411);}(_0x3641,0x173));var _0x1364=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3641[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require(_0x1364('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x1364('0x1'));var router=express[_0x1364('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x1364('0x3'));var interaction=require(_0x1364('0x4'));var config=require(_0x1364('0x5'));var controller=require('./cmCustomField.controller');router[_0x1364('0x6')]('/',auth['isAuthenticated'](),controller[_0x1364('0x7')]);router[_0x1364('0x6')](_0x1364('0x8'),auth['isAuthenticated'](),controller[_0x1364('0x9')]);router[_0x1364('0xa')]('/',auth[_0x1364('0xb')](),controller[_0x1364('0xc')]);router[_0x1364('0xd')](_0x1364('0x8'),auth[_0x1364('0xb')](),controller[_0x1364('0xe')]);router[_0x1364('0xf')](_0x1364('0x8'),auth[_0x1364('0xb')](),controller[_0x1364('0x10')]);module['exports']=router; \ No newline at end of file +var _0x7dfd=['isAuthenticated','index','/:id','post','create','put','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmCustomField.controller','get'];(function(_0xe339d0,_0x20b0ef){var _0x5385a1=function(_0x11bd3a){while(--_0x11bd3a){_0xe339d0['push'](_0xe339d0['shift']());}};_0x5385a1(++_0x20b0ef);}(_0x7dfd,0x1c2));var _0xd7df=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7dfd[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xd7df('0x0'));var util=require(_0xd7df('0x1'));var path=require(_0xd7df('0x2'));var timeout=require(_0xd7df('0x3'));var express=require(_0xd7df('0x4'));var router=express[_0xd7df('0x5')]();var fs_extra=require(_0xd7df('0x6'));var auth=require(_0xd7df('0x7'));var interaction=require(_0xd7df('0x8'));var config=require(_0xd7df('0x9'));var controller=require(_0xd7df('0xa'));router[_0xd7df('0xb')]('/',auth[_0xd7df('0xc')](),controller[_0xd7df('0xd')]);router[_0xd7df('0xb')](_0xd7df('0xe'),auth[_0xd7df('0xc')](),controller['show']);router[_0xd7df('0xf')]('/',auth[_0xd7df('0xc')](),controller[_0xd7df('0x10')]);router[_0xd7df('0x11')]('/:id',auth[_0xd7df('0xc')](),controller['update']);router[_0xd7df('0x12')]('/:id',auth[_0xd7df('0xc')](),controller[_0xd7df('0x13')]);module[_0xd7df('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 20bd90a..5742600 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 _0x5f66=['UNSIGNED','contactListQueue','sequelize','STRING','BOOLEAN','DATE','format','YYYY-MM-DD\x20HH:mm:ss','INTEGER'];(function(_0x1d211b,_0x475f3b){var _0x47c88b=function(_0x3126f5){while(--_0x3126f5){_0x1d211b['push'](_0x1d211b['shift']());}};_0x47c88b(++_0x475f3b);}(_0x5f66,0x1a0));var _0x65f6=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x5f66[_0x17d9e3];return _0x14192d;};'use strict';var moment=require('moment');var Sequelize=require(_0x65f6('0x0'));module['exports']={'phone':{'type':Sequelize[_0x65f6('0x1')],'allowNull':![]},'active':{'type':Sequelize[_0x65f6('0x2')],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0x65f6('0x3')],'defaultValue':moment()[_0x65f6('0x4')](_0x65f6('0x5'))},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x65f6('0x6')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'callback':{'type':Sequelize[_0x65f6('0x2')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x65f6('0x1')],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'priority':{'type':Sequelize['INTEGER'](0x2)[_0x65f6('0x7')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0x65f6('0x2')],'defaultValue':![]},'ContactId':{'type':Sequelize[_0x65f6('0x6')],'unique':_0x65f6('0x8')},'ListId':{'type':Sequelize[_0x65f6('0x6')],'unique':_0x65f6('0x8')},'UserId':{'type':Sequelize['INTEGER']},'VoiceQueueId':{'type':Sequelize['INTEGER'],'unique':_0x65f6('0x8')},'CampaignId':{'type':Sequelize[_0x65f6('0x6')]},'countnosuchnumberretry':{'type':Sequelize[_0x65f6('0x6')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x65f6('0x6')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x65f6('0x6')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dialTimezone':{'type':Sequelize['STRING']},'recallmeNotifiedDate':{'type':Sequelize[_0x65f6('0x3')],'allowNull':!![],'defaultValue':null}}; \ No newline at end of file +var _0x5c3c=['DATE','format','YYYY-MM-DD\x20HH:mm:ss','INTEGER','BOOLEAN','contactListQueue','moment','sequelize','exports','STRING'];(function(_0x3e68ac,_0x2e0cb2){var _0x313b72=function(_0x39da08){while(--_0x39da08){_0x3e68ac['push'](_0x3e68ac['shift']());}};_0x313b72(++_0x2e0cb2);}(_0x5c3c,0x132));var _0xc5c3=function(_0xf50820,_0x56f041){_0xf50820=_0xf50820-0x0;var _0x2a9b10=_0x5c3c[_0xf50820];return _0x2a9b10;};'use strict';var moment=require(_0xc5c3('0x0'));var Sequelize=require(_0xc5c3('0x1'));module[_0xc5c3('0x2')]={'phone':{'type':Sequelize[_0xc5c3('0x3')],'allowNull':![]},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0xc5c3('0x4')],'defaultValue':moment()[_0xc5c3('0x5')](_0xc5c3('0x6'))},'countbusyretry':{'type':Sequelize[_0xc5c3('0x7')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xc5c3('0x7')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xc5c3('0x7')],'defaultValue':0x0},'callback':{'type':Sequelize[_0xc5c3('0x8')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xc5c3('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize[_0xc5c3('0x4')]},'priority':{'type':Sequelize['INTEGER'](0x2)['UNSIGNED'],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ContactId':{'type':Sequelize[_0xc5c3('0x7')],'unique':_0xc5c3('0x9')},'ListId':{'type':Sequelize['INTEGER'],'unique':_0xc5c3('0x9')},'UserId':{'type':Sequelize[_0xc5c3('0x7')]},'VoiceQueueId':{'type':Sequelize['INTEGER'],'unique':_0xc5c3('0x9')},'CampaignId':{'type':Sequelize[_0xc5c3('0x7')]},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xc5c3('0x7')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xc5c3('0x7')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xc5c3('0x7')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0xc5c3('0x3')]},'recallmeNotifiedDate':{'type':Sequelize[_0xc5c3('0x4')],'allowNull':!![],'defaultValue':null}}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.controller.js b/server/api/cmHopper/cmHopper.controller.js index 66117e2..939f011 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 _0xc7b8=['firstName','calleridname','finally','CmHopperFinal','end','getVoiceQueues','outbound','preview','sequelize','transaction','value','direction','prev','hopperIds','priority','ASC','scheduledAt','dialOrderByScheduledAt','literal','COALESCE(CmHopper.UserId,\x200)\x20ASC','DESC','scheduledat','recallme','LOCK','UPDATE','Company','CmList','dialActive','getPreviewRecall','Contact','CmCompany','List','Queue','getOpenContacts','isNumber','CmHopper,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','timezones','push','getTimezone','moment','../../components/parsers/qs','../../config/logger','api','../../config/environment','status','json','offset','undefined','count','Content-Range','update','sendStatus','error','stack','name','send','index','map','CmHopper','rawAttributes','fieldName','type','key','model','query','keys','intersection','concat','filters','$or','$gt','$ne','$eq','$not','$between','$in','$notIn','$like','$notLike','$iLike','$notILike','$overlap','$contains','$contained','$any','attributes','fields','length','hasOwnProperty','limit','order','sort','where','pick','merge','VIRTUAL','filter','then','include','rows','catch','show','includeAll','options','find','create','body','params','describe','destroy','VoiceQueueId','VoiceQueue','Campaign','CampaignId','omit','dataValues','createdAt','updatedAt','campaign','membername','user','deletedat','format','YYYY-MM-DD\x20HH:mm:ss','calleridnum','campaigntype','queue','ivr','CmContact','ContactId','lastName','isNil'];(function(_0x3fc867,_0x34b25e){var _0x43568b=function(_0x1884d2){while(--_0x1884d2){_0x3fc867['push'](_0x3fc867['shift']());}};_0x43568b(++_0x34b25e);}(_0xc7b8,0x132));var _0x8c7b=function(_0x49c87a,_0x1fc157){_0x49c87a=_0x49c87a-0x0;var _0x2e1b83=_0xc7b8[_0x49c87a];return _0x2e1b83;};'use strict';var moment=require(_0x8c7b('0x0'));var _=require('lodash');var qs=require(_0x8c7b('0x1'));var logger=require(_0x8c7b('0x2'))(_0x8c7b('0x3'));var shared=require(_0x8c7b('0x4'));var db=require('../../mysqldb')['db'];function respondWithResult(_0x3f27d2,_0xea22fe){_0xea22fe=_0xea22fe||0xc8;return function(_0x10196d){if(_0x10196d){return _0x3f27d2[_0x8c7b('0x5')](_0xea22fe)[_0x8c7b('0x6')](_0x10196d);}};}function respondWithFilteredResult(_0x4aeaf1,_0x407e84){return function(_0x2c61c1){if(_0x2c61c1){var _0x272238=typeof _0x407e84[_0x8c7b('0x7')]===_0x8c7b('0x8')&&typeof _0x407e84['limit']==='undefined';var _0xd5a90c=_0x2c61c1[_0x8c7b('0x9')];var _0x46ce4d=_0x272238?0x0:_0x407e84[_0x8c7b('0x7')];var _0x58e5cb=_0x272238?_0x2c61c1[_0x8c7b('0x9')]:_0x407e84[_0x8c7b('0x7')]+_0x407e84['limit'];var _0x379d31;if(_0x58e5cb>=_0xd5a90c){_0x58e5cb=_0xd5a90c;_0x379d31=0xc8;}else{_0x379d31=0xce;}_0x4aeaf1[_0x8c7b('0x5')](_0x379d31);return _0x4aeaf1['set'](_0x8c7b('0xa'),_0x46ce4d+'-'+_0x58e5cb+'/'+_0xd5a90c)[_0x8c7b('0x6')](_0x2c61c1);}return null;};}function saveUpdates(_0x2a9834,_0x4ead67){return function(_0x36c6f0){if(_0x36c6f0){return _0x36c6f0[_0x8c7b('0xb')](_0x2a9834)['then'](function(_0x24057b){return _0x24057b;});}return null;};}function handleEntityNotFound(_0xad1c4e,_0x4ffcc6){return function(_0x224f01){if(!_0x224f01){_0xad1c4e[_0x8c7b('0xc')](0x194);}return _0x224f01;};}function handleError(_0x320be4,_0x5cac9c){_0x5cac9c=_0x5cac9c||0x1f4;return function(_0x459105){logger[_0x8c7b('0xd')](_0x459105[_0x8c7b('0xe')]);if(_0x459105[_0x8c7b('0xf')]){delete _0x459105[_0x8c7b('0xf')];}_0x320be4[_0x8c7b('0x5')](_0x5cac9c)[_0x8c7b('0x10')](_0x459105);};}exports[_0x8c7b('0x11')]=function(_0x3eb6f9,_0x20d254){var _0x4696e2={},_0x49f4d1={},_0x18023b={'count':0x0,'rows':[]};var _0x5cb9fa=_[_0x8c7b('0x12')](db[_0x8c7b('0x13')][_0x8c7b('0x14')],function(_0x20f6a1){return{'name':_0x20f6a1[_0x8c7b('0x15')],'type':_0x20f6a1[_0x8c7b('0x16')][_0x8c7b('0x17')]};});_0x49f4d1[_0x8c7b('0x18')]=_[_0x8c7b('0x12')](_0x5cb9fa,_0x8c7b('0xf'));_0x49f4d1[_0x8c7b('0x19')]=_[_0x8c7b('0x1a')](_0x3eb6f9['query']);_0x49f4d1['filters']=_[_0x8c7b('0x1b')](_0x49f4d1[_0x8c7b('0x18')],_0x49f4d1[_0x8c7b('0x19')]);_0x49f4d1['filters']=_[_0x8c7b('0x1c')](_0x49f4d1[_0x8c7b('0x1d')],['$and',_0x8c7b('0x1e'),_0x8c7b('0x1f'),'$gte','$lt','$lte',_0x8c7b('0x20'),_0x8c7b('0x21'),_0x8c7b('0x22'),_0x8c7b('0x23'),'$notBetween',_0x8c7b('0x24'),_0x8c7b('0x25'),_0x8c7b('0x26'),_0x8c7b('0x27'),_0x8c7b('0x28'),_0x8c7b('0x29'),_0x8c7b('0x26'),_0x8c7b('0x2a'),_0x8c7b('0x2b'),_0x8c7b('0x2c'),_0x8c7b('0x2d')]);_0x4696e2[_0x8c7b('0x2e')]=_[_0x8c7b('0x1b')](_0x49f4d1['model'],qs[_0x8c7b('0x2f')](_0x3eb6f9[_0x8c7b('0x19')]['fields']));_0x4696e2['attributes']=_0x4696e2['attributes'][_0x8c7b('0x30')]?_0x4696e2[_0x8c7b('0x2e')]:_0x49f4d1[_0x8c7b('0x18')];if(!_0x3eb6f9[_0x8c7b('0x19')][_0x8c7b('0x31')]('nolimit')){_0x4696e2[_0x8c7b('0x32')]=qs[_0x8c7b('0x32')](_0x3eb6f9[_0x8c7b('0x19')][_0x8c7b('0x32')]);_0x4696e2[_0x8c7b('0x7')]=qs['offset'](_0x3eb6f9[_0x8c7b('0x19')][_0x8c7b('0x7')]);}_0x4696e2[_0x8c7b('0x33')]=qs[_0x8c7b('0x34')](_0x3eb6f9[_0x8c7b('0x19')][_0x8c7b('0x34')]);_0x4696e2[_0x8c7b('0x35')]=qs[_0x8c7b('0x1d')](_[_0x8c7b('0x36')](_0x3eb6f9[_0x8c7b('0x19')],_0x49f4d1[_0x8c7b('0x1d')]),_0x5cb9fa);if(_0x3eb6f9[_0x8c7b('0x19')]['filter']){_0x4696e2[_0x8c7b('0x35')]=_[_0x8c7b('0x37')](_0x4696e2[_0x8c7b('0x35')],{'$or':_['map'](_0x5cb9fa,function(_0x3669b6){if(_0x3669b6[_0x8c7b('0x16')]!==_0x8c7b('0x38')){var _0x4f3fc2={};_0x4f3fc2[_0x3669b6[_0x8c7b('0xf')]]={'$like':'%'+_0x3eb6f9['query'][_0x8c7b('0x39')]+'%'};return _0x4f3fc2;}})});}_0x4696e2=_[_0x8c7b('0x37')]({},_0x4696e2,_0x3eb6f9['options']);var _0x5d5c4a={'where':_0x4696e2[_0x8c7b('0x35')]};return db[_0x8c7b('0x13')][_0x8c7b('0x9')](_0x5d5c4a)[_0x8c7b('0x3a')](function(_0x3f00ab){_0x18023b[_0x8c7b('0x9')]=_0x3f00ab;if(_0x3eb6f9[_0x8c7b('0x19')]['includeAll']){_0x4696e2[_0x8c7b('0x3b')]=[{'all':!![]}];}return db[_0x8c7b('0x13')]['findAll'](_0x4696e2);})['then'](function(_0x33939f){_0x18023b[_0x8c7b('0x3c')]=_0x33939f;return _0x18023b;})[_0x8c7b('0x3a')](respondWithFilteredResult(_0x20d254,_0x4696e2))[_0x8c7b('0x3d')](handleError(_0x20d254,null));};exports[_0x8c7b('0x3e')]=function(_0x1fa312,_0xbfa477){var _0x90c8a2={'raw':!![],'where':{'id':_0x1fa312['params']['id']}},_0x2d52b0={};_0x2d52b0[_0x8c7b('0x18')]=_[_0x8c7b('0x1a')](db[_0x8c7b('0x13')][_0x8c7b('0x14')]);_0x2d52b0['query']=_[_0x8c7b('0x1a')](_0x1fa312['query']);_0x2d52b0[_0x8c7b('0x1d')]=_['intersection'](_0x2d52b0[_0x8c7b('0x18')],_0x2d52b0[_0x8c7b('0x19')]);_0x90c8a2[_0x8c7b('0x2e')]=_[_0x8c7b('0x1b')](_0x2d52b0[_0x8c7b('0x18')],qs[_0x8c7b('0x2f')](_0x1fa312[_0x8c7b('0x19')][_0x8c7b('0x2f')]));_0x90c8a2[_0x8c7b('0x2e')]=_0x90c8a2[_0x8c7b('0x2e')][_0x8c7b('0x30')]?_0x90c8a2[_0x8c7b('0x2e')]:_0x2d52b0[_0x8c7b('0x18')];if(_0x1fa312[_0x8c7b('0x19')][_0x8c7b('0x3f')]){_0x90c8a2['include']=[{'all':!![]}];}_0x90c8a2=_[_0x8c7b('0x37')]({},_0x90c8a2,_0x1fa312[_0x8c7b('0x40')]);return db['CmHopper'][_0x8c7b('0x41')](_0x90c8a2)[_0x8c7b('0x3a')](handleEntityNotFound(_0xbfa477,null))['then'](respondWithResult(_0xbfa477,null))['catch'](handleError(_0xbfa477,null));};exports[_0x8c7b('0x42')]=function(_0x22a4a9,_0x5d5d3d){return db[_0x8c7b('0x13')]['create'](_0x22a4a9[_0x8c7b('0x43')],{})[_0x8c7b('0x3a')](respondWithResult(_0x5d5d3d,0xc9))['catch'](handleError(_0x5d5d3d,null));};exports['update']=function(_0x33809b,_0x3600c1){if(_0x33809b[_0x8c7b('0x43')]['id']){delete _0x33809b[_0x8c7b('0x43')]['id'];}return db[_0x8c7b('0x13')]['find']({'where':{'id':_0x33809b[_0x8c7b('0x44')]['id']}})['then'](handleEntityNotFound(_0x3600c1,null))[_0x8c7b('0x3a')](saveUpdates(_0x33809b[_0x8c7b('0x43')],null))[_0x8c7b('0x3a')](respondWithResult(_0x3600c1,null))['catch'](handleError(_0x3600c1,null));};exports[_0x8c7b('0x45')]=function(_0x54507c,_0x2760da){return db[_0x8c7b('0x13')]['describe']()['then'](respondWithResult(_0x2760da,null))[_0x8c7b('0x3d')](handleError(_0x2760da,null));};exports[_0x8c7b('0x46')]=function(_0x1fa733,_0x54219b){var _0x1a668e;return db[_0x8c7b('0x13')][_0x8c7b('0x41')]({'where':{'id':_0x1fa733['params']['id']}})[_0x8c7b('0x3a')](handleEntityNotFound(_0x54219b,null))[_0x8c7b('0x3a')](function(_0x242102){if(_0x242102){return _0x242102[_0x8c7b('0x46')]()[_0x8c7b('0x3a')](function(_0x50e0a1){return _0x50e0a1;});}})['then'](function(_0x297ca5){_0x1a668e=_0x297ca5;if(_0x297ca5){if(_0x297ca5['VoiceQueueId']||_0x297ca5['CampaignId']){return db[_0x297ca5[_0x8c7b('0x47')]?_0x8c7b('0x48'):_0x8c7b('0x49')][_0x8c7b('0x41')]({'where':{'id':_0x297ca5['VoiceQueueId']?_0x297ca5[_0x8c7b('0x47')]:_0x297ca5[_0x8c7b('0x4a')]},'attributes':['id',_0x8c7b('0xf')],'raw':!![]});}}})[_0x8c7b('0x3a')](function(_0x4f74f7){var _0x3314f0={};if(_0x4f74f7){_[_0x8c7b('0x37')](_0x3314f0,_[_0x8c7b('0x4b')](_0x1a668e[_0x8c7b('0x4c')],[_0x8c7b('0x4d'),_0x8c7b('0x4e'),'id']));_0x3314f0['state']=0x15;_0x3314f0['statedesc']='deleted';_0x3314f0[_0x8c7b('0x4f')]=_0x4f74f7[_0x8c7b('0xf')];_0x3314f0[_0x8c7b('0x50')]=_0x1fa733['user'][_0x8c7b('0xf')];_0x3314f0['UserId']=_0x1fa733[_0x8c7b('0x51')]['id'];_0x3314f0['deleted']=!![];_0x3314f0[_0x8c7b('0x52')]=moment()[_0x8c7b('0x53')](_0x8c7b('0x54'));_0x3314f0[_0x8c7b('0x55')]=_0x1a668e['phone'];_0x3314f0[_0x8c7b('0x56')]=_0x1a668e['VoiceQueueId']?_0x8c7b('0x57'):_0x8c7b('0x58');return db[_0x8c7b('0x59')][_0x8c7b('0x41')]({'where':{'id':_0x3314f0[_0x8c7b('0x5a')]},'attributes':['firstName',_0x8c7b('0x5b')]})['then'](function(_0x27bc57){if(!_[_0x8c7b('0x5c')](_0x54219b)&&!_[_0x8c7b('0x5c')](_0x27bc57[_0x8c7b('0x5d')])){_0x3314f0[_0x8c7b('0x5e')]=_0x27bc57[_0x8c7b('0x5d')];if(!_['isNil'](_0x27bc57[_0x8c7b('0x5b')])){_0x3314f0['calleridname']+='\x20'+_0x27bc57[_0x8c7b('0x5b')];}}})[_0x8c7b('0x5f')](function(){return db[_0x8c7b('0x60')][_0x8c7b('0x42')](_0x3314f0);});}})[_0x8c7b('0x3a')](function(){return _0x54219b[_0x8c7b('0x5')](0xcc)[_0x8c7b('0x61')]();})[_0x8c7b('0x3d')](handleError(_0x54219b,null));};exports['getPreview']=function(_0x918929,_0x3ed2b8){var _0x1218d8=[];return db[_0x8c7b('0x59')]['describe']()[_0x8c7b('0x3a')](function(_0x465755){_0x1218d8=_['keys'](_0x465755);return _0x918929[_0x8c7b('0x51')][_0x8c7b('0x62')]({'where':{'type':_0x8c7b('0x63'),'dialActive':!![],'dialMethod':_0x8c7b('0x64')},'attributes':['id','dialOrderByScheduledAt','dialPreviewAutoRecallMe'],'raw':!![]});})[_0x8c7b('0x3a')](function(_0x1d09c5){if(_0x1d09c5&&_0x1d09c5[_0x8c7b('0x30')]){return db[_0x8c7b('0x65')][_0x8c7b('0x66')](function(_0x31365f){var _0x641305={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x8c7b('0x53')](_0x8c7b('0x54'))},'VoiceQueueId':{'$in':_[_0x8c7b('0x12')](_0x1d09c5,'id')},'$or':[{'UserId':null},{'UserId':_0x918929[_0x8c7b('0x51')]['id']}]};var _0x43ca49={'active':![],'recallme':!![],'VoiceQueueId':{'$in':_(_0x1d09c5)[_0x8c7b('0x39')](['dialPreviewAutoRecallMe',0x0])['map']('id')[_0x8c7b('0x67')]()},'$or':[{'UserId':null},{'UserId':_0x918929['user']['id']}]};var _0x1e4cd2={'$or':[_0x641305,_0x43ca49]};var _0x24363a=[];if(_0x918929[_0x8c7b('0x43')][_0x8c7b('0x68')]&&_0x918929[_0x8c7b('0x43')][_0x8c7b('0x68')]===_0x8c7b('0x69')){if(!_['isEmpty'](_0x918929[_0x8c7b('0x43')][_0x8c7b('0x6a')])){_0x1e4cd2['id']={'$in':_0x918929['body']['hopperIds']};}_0x24363a=[[_0x8c7b('0x6b'),_0x8c7b('0x6c')],[_0x8c7b('0x6d'),_0x1d09c5[0x0][_0x8c7b('0x6e')]==='ASC'?'DESC':'ASC'],db[_0x8c7b('0x65')][_0x8c7b('0x6f')](_0x8c7b('0x70')),['id',_0x8c7b('0x71')]];}else{if(!_['isEmpty'](_0x918929['body']['hopperIds'])){_0x1e4cd2['id']={'$notIn':_0x918929[_0x8c7b('0x43')][_0x8c7b('0x6a')]};}_0x24363a=[['priority',_0x8c7b('0x71')],[_0x8c7b('0x6d'),_0x1d09c5[0x0][_0x8c7b('0x6e')]],db[_0x8c7b('0x65')]['literal']('COALESCE(CmHopper.UserId,\x200)\x20DESC'),['id',_0x8c7b('0x6c')]];}return db[_0x8c7b('0x13')]['findOne']({'attributes':['id',_0x8c7b('0x72'),_0x8c7b('0x73')],'where':_0x1e4cd2,'order':_0x24363a,'transaction':_0x31365f,'lock':_0x31365f[_0x8c7b('0x74')][_0x8c7b('0x75')],'include':[{'model':db['CmContact'],'as':'Contact','attributes':_0x1218d8,'include':[{'model':db['CmCompany'],'as':_0x8c7b('0x76'),'attributes':['id','name']}]},{'model':db[_0x8c7b('0x77')],'as':'List','attributes':['id',_0x8c7b('0xf')]},{'model':db[_0x8c7b('0x48')],'as':'Queue','attributes':['id','name',_0x8c7b('0x78')]}]})[_0x8c7b('0x3a')](function(_0x450ea9){if(_0x450ea9){return _0x450ea9['update']({'UserId':_0x918929[_0x8c7b('0x51')]['id']},{'transaction':_0x31365f});}});});}})['then'](handleEntityNotFound(_0x3ed2b8,null))[_0x8c7b('0x3a')](respondWithResult(_0x3ed2b8,null))[_0x8c7b('0x3d')](handleError(_0x3ed2b8,null));};exports[_0x8c7b('0x79')]=function(_0x1e64e0,_0x42a5c0,_0x3dbc9b){var _0x5e8476=[];var _0x39e4c2=_0x1e64e0[_0x8c7b('0x44')]['id'];var _0x3a3aa2=_0x1e64e0[_0x8c7b('0x51')]['id'];return db[_0x8c7b('0x59')][_0x8c7b('0x45')]()[_0x8c7b('0x3a')](function(_0x4031fc){_0x5e8476=_[_0x8c7b('0x1a')](_0x4031fc);return db[_0x8c7b('0x65')]['transaction'](function(_0x4682ae){const _0x1c6227={'id':_0x39e4c2};return db['CmHopper']['findOne']({'attributes':['id','scheduledat','recallme'],'where':_0x1c6227,'transaction':_0x4682ae,'lock':_0x4682ae[_0x8c7b('0x74')][_0x8c7b('0x75')],'include':[{'model':db[_0x8c7b('0x59')],'as':_0x8c7b('0x7a'),'attributes':_0x5e8476,'include':[{'model':db[_0x8c7b('0x7b')],'as':_0x8c7b('0x76'),'attributes':['id',_0x8c7b('0xf')]}]},{'model':db[_0x8c7b('0x77')],'as':_0x8c7b('0x7c'),'attributes':['id',_0x8c7b('0xf')]},{'model':db[_0x8c7b('0x48')],'as':_0x8c7b('0x7d'),'attributes':['id',_0x8c7b('0xf'),'dialActive']}]})['then'](function(_0x46c2da){if(_0x46c2da){return _0x46c2da[_0x8c7b('0xb')]({'UserId':_0x3a3aa2},{'transaction':_0x4682ae});}});});})['then'](handleEntityNotFound(_0x42a5c0,null))['then'](respondWithResult(_0x42a5c0,null))['catch'](handleError(_0x42a5c0,null));};exports[_0x8c7b('0x7e')]=function(_0x114e68,_0x28a725){return _0x114e68[_0x8c7b('0x51')][_0x8c7b('0x62')]({'where':{'type':_0x8c7b('0x63'),'dialActive':!![],'dialMethod':'preview'},'attributes':['id'],'raw':!![]})[_0x8c7b('0x3a')](function(_0x148f21){if(_0x148f21&&_0x148f21['length']){return db['CmHopper']['count']({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')},'VoiceQueueId':{'$in':_['map'](_0x148f21,'id')},'$or':[{'UserId':null},{'UserId':_0x114e68[_0x8c7b('0x51')]['id']}]}});}return 0x0;})['then'](function(_0x351267){if(!_[_0x8c7b('0x5c')](_0x351267)&&_[_0x8c7b('0x7f')](_0x351267)){return _0x28a725['status'](0xc8)[_0x8c7b('0x6')]({'contacts':_0x351267});}else{logger[_0x8c7b('0xd')](_0x8c7b('0x80'),_0x8c7b('0x7e'),0x194,_0x8c7b('0x81'));_0x28a725[_0x8c7b('0xc')](0x194);}})[_0x8c7b('0x3d')](handleError(_0x28a725,null));};exports['getTimezones']=function(_0x2bf519,_0x5c9172){var _0xa999fc=shared[_0x8c7b('0x82')];var _0x34dfb6=[];_['map'](_0xa999fc,function(_0x355153){_0x34dfb6[_0x8c7b('0x83')]({'id':_0x355153['name'],'name':_0x355153[_0x8c7b('0xf')],'utcOffset':_0x355153['utcOffset']});});return _0x5c9172[_0x8c7b('0x5')](0xc8)[_0x8c7b('0x6')]({'tz':_0x34dfb6});};exports[_0x8c7b('0x84')]=function(_0x5cf4ad,_0x1da616){var _0x59171b=shared[_0x8c7b('0x82')];var _0x2e6720={};if(!_['isNil'](_0x59171b[_0x5cf4ad[_0x8c7b('0x43')]['id']]))_0x2e6720=_0x59171b[_0x5cf4ad[_0x8c7b('0x43')]['id']];return _0x1da616[_0x8c7b('0x5')](0xc8)[_0x8c7b('0x6')](_0x2e6720);}; \ No newline at end of file +var _0x0cae=['deletedat','format','YYYY-MM-DD\x20HH:mm:ss','phone','queue','ivr','CmContact','ContactId','firstName','lastName','isNil','calleridname','finally','CmHopperFinal','end','getPreview','getVoiceQueues','outbound','preview','dialOrderByScheduledAt','sequelize','transaction','dialPreviewAutoRecallMe','value','direction','prev','hopperIds','ASC','scheduledAt','DESC','literal','isEmpty','COALESCE(CmHopper.UserId,\x200)\x20DESC','scheduledat','recallme','UPDATE','Contact','CmCompany','Company','CmList','List','dialActive','getPreviewRecall','findOne','getOpenContacts','CmHopper,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','sendStatus','timezones','utcOffset','getTimezone','moment','../../components/parsers/qs','api','../../config/environment','../../mysqldb','status','json','offset','limit','undefined','count','set','Content-Range','update','then','error','stack','name','send','index','map','CmHopper','model','query','keys','filters','concat','$or','$gt','$ne','$not','$between','$in','$like','$iLike','$notILike','$overlap','$contains','$any','attributes','fields','length','order','sort','where','filter','merge','type','options','includeAll','findAll','rows','show','params','include','find','catch','create','body','describe','destroy','CampaignId','VoiceQueue','Campaign','VoiceQueueId','omit','dataValues','createdAt','updatedAt','state','statedesc','campaign','membername','user','UserId'];(function(_0x2d0d97,_0x2d9560){var _0xfb96e9=function(_0x52a340){while(--_0x52a340){_0x2d0d97['push'](_0x2d0d97['shift']());}};_0xfb96e9(++_0x2d9560);}(_0x0cae,0x1ad));var _0xe0ca=function(_0x314afb,_0x328688){_0x314afb=_0x314afb-0x0;var _0x1e5988=_0x0cae[_0x314afb];return _0x1e5988;};'use strict';var moment=require(_0xe0ca('0x0'));var _=require('lodash');var qs=require(_0xe0ca('0x1'));var logger=require('../../config/logger')(_0xe0ca('0x2'));var shared=require(_0xe0ca('0x3'));var db=require(_0xe0ca('0x4'))['db'];function respondWithResult(_0x262d86,_0x18fda8){_0x18fda8=_0x18fda8||0xc8;return function(_0x4b9a7a){if(_0x4b9a7a){return _0x262d86[_0xe0ca('0x5')](_0x18fda8)[_0xe0ca('0x6')](_0x4b9a7a);}};}function respondWithFilteredResult(_0x2fe8bb,_0x5d7ba9){return function(_0x545712){if(_0x545712){var _0x399111=typeof _0x5d7ba9[_0xe0ca('0x7')]==='undefined'&&typeof _0x5d7ba9[_0xe0ca('0x8')]===_0xe0ca('0x9');var _0x2032f5=_0x545712[_0xe0ca('0xa')];var _0x1cb875=_0x399111?0x0:_0x5d7ba9[_0xe0ca('0x7')];var _0x3b3db3=_0x399111?_0x545712[_0xe0ca('0xa')]:_0x5d7ba9[_0xe0ca('0x7')]+_0x5d7ba9[_0xe0ca('0x8')];var _0x3df0d5;if(_0x3b3db3>=_0x2032f5){_0x3b3db3=_0x2032f5;_0x3df0d5=0xc8;}else{_0x3df0d5=0xce;}_0x2fe8bb[_0xe0ca('0x5')](_0x3df0d5);return _0x2fe8bb[_0xe0ca('0xb')](_0xe0ca('0xc'),_0x1cb875+'-'+_0x3b3db3+'/'+_0x2032f5)['json'](_0x545712);}return null;};}function saveUpdates(_0x573791,_0x412ad3){return function(_0xdbce33){if(_0xdbce33){return _0xdbce33[_0xe0ca('0xd')](_0x573791)[_0xe0ca('0xe')](function(_0x264188){return _0x264188;});}return null;};}function handleEntityNotFound(_0x19d8b4,_0x233a9b){return function(_0x3d9c1c){if(!_0x3d9c1c){_0x19d8b4['sendStatus'](0x194);}return _0x3d9c1c;};}function handleError(_0x1f4695,_0xb0aa5b){_0xb0aa5b=_0xb0aa5b||0x1f4;return function(_0x22f571){logger[_0xe0ca('0xf')](_0x22f571[_0xe0ca('0x10')]);if(_0x22f571[_0xe0ca('0x11')]){delete _0x22f571[_0xe0ca('0x11')];}_0x1f4695[_0xe0ca('0x5')](_0xb0aa5b)[_0xe0ca('0x12')](_0x22f571);};}exports[_0xe0ca('0x13')]=function(_0x3040f2,_0x4d9ccc){var _0x3565d8={},_0x4f4973={},_0xc2934b={'count':0x0,'rows':[]};var _0x241871=_[_0xe0ca('0x14')](db[_0xe0ca('0x15')]['rawAttributes'],function(_0x26a539){return{'name':_0x26a539['fieldName'],'type':_0x26a539['type']['key']};});_0x4f4973[_0xe0ca('0x16')]=_[_0xe0ca('0x14')](_0x241871,_0xe0ca('0x11'));_0x4f4973[_0xe0ca('0x17')]=_[_0xe0ca('0x18')](_0x3040f2['query']);_0x4f4973[_0xe0ca('0x19')]=_['intersection'](_0x4f4973[_0xe0ca('0x16')],_0x4f4973[_0xe0ca('0x17')]);_0x4f4973[_0xe0ca('0x19')]=_[_0xe0ca('0x1a')](_0x4f4973[_0xe0ca('0x19')],['$and',_0xe0ca('0x1b'),_0xe0ca('0x1c'),'$gte','$lt','$lte',_0xe0ca('0x1d'),'$eq',_0xe0ca('0x1e'),_0xe0ca('0x1f'),'$notBetween',_0xe0ca('0x20'),'$notIn',_0xe0ca('0x21'),'$notLike',_0xe0ca('0x22'),_0xe0ca('0x23'),_0xe0ca('0x21'),_0xe0ca('0x24'),_0xe0ca('0x25'),'$contained',_0xe0ca('0x26')]);_0x3565d8[_0xe0ca('0x27')]=_['intersection'](_0x4f4973[_0xe0ca('0x16')],qs['fields'](_0x3040f2[_0xe0ca('0x17')][_0xe0ca('0x28')]));_0x3565d8[_0xe0ca('0x27')]=_0x3565d8[_0xe0ca('0x27')][_0xe0ca('0x29')]?_0x3565d8[_0xe0ca('0x27')]:_0x4f4973[_0xe0ca('0x16')];if(!_0x3040f2['query']['hasOwnProperty']('nolimit')){_0x3565d8[_0xe0ca('0x8')]=qs[_0xe0ca('0x8')](_0x3040f2[_0xe0ca('0x17')][_0xe0ca('0x8')]);_0x3565d8[_0xe0ca('0x7')]=qs['offset'](_0x3040f2['query'][_0xe0ca('0x7')]);}_0x3565d8[_0xe0ca('0x2a')]=qs[_0xe0ca('0x2b')](_0x3040f2[_0xe0ca('0x17')][_0xe0ca('0x2b')]);_0x3565d8[_0xe0ca('0x2c')]=qs['filters'](_['pick'](_0x3040f2['query'],_0x4f4973[_0xe0ca('0x19')]),_0x241871);if(_0x3040f2[_0xe0ca('0x17')][_0xe0ca('0x2d')]){_0x3565d8[_0xe0ca('0x2c')]=_[_0xe0ca('0x2e')](_0x3565d8[_0xe0ca('0x2c')],{'$or':_[_0xe0ca('0x14')](_0x241871,function(_0x256a9d){if(_0x256a9d[_0xe0ca('0x2f')]!=='VIRTUAL'){var _0x213315={};_0x213315[_0x256a9d['name']]={'$like':'%'+_0x3040f2[_0xe0ca('0x17')]['filter']+'%'};return _0x213315;}})});}_0x3565d8=_[_0xe0ca('0x2e')]({},_0x3565d8,_0x3040f2[_0xe0ca('0x30')]);var _0x31e80e={'where':_0x3565d8[_0xe0ca('0x2c')]};return db[_0xe0ca('0x15')]['count'](_0x31e80e)['then'](function(_0x2d2e7b){_0xc2934b[_0xe0ca('0xa')]=_0x2d2e7b;if(_0x3040f2['query'][_0xe0ca('0x31')]){_0x3565d8['include']=[{'all':!![]}];}return db[_0xe0ca('0x15')][_0xe0ca('0x32')](_0x3565d8);})[_0xe0ca('0xe')](function(_0x2531d0){_0xc2934b[_0xe0ca('0x33')]=_0x2531d0;return _0xc2934b;})[_0xe0ca('0xe')](respondWithFilteredResult(_0x4d9ccc,_0x3565d8))['catch'](handleError(_0x4d9ccc,null));};exports[_0xe0ca('0x34')]=function(_0x356363,_0x8af324){var _0x100b8a={'raw':!![],'where':{'id':_0x356363[_0xe0ca('0x35')]['id']}},_0x78888e={};_0x78888e[_0xe0ca('0x16')]=_[_0xe0ca('0x18')](db['CmHopper']['rawAttributes']);_0x78888e[_0xe0ca('0x17')]=_[_0xe0ca('0x18')](_0x356363['query']);_0x78888e[_0xe0ca('0x19')]=_['intersection'](_0x78888e['model'],_0x78888e[_0xe0ca('0x17')]);_0x100b8a['attributes']=_['intersection'](_0x78888e[_0xe0ca('0x16')],qs[_0xe0ca('0x28')](_0x356363['query'][_0xe0ca('0x28')]));_0x100b8a[_0xe0ca('0x27')]=_0x100b8a[_0xe0ca('0x27')]['length']?_0x100b8a[_0xe0ca('0x27')]:_0x78888e[_0xe0ca('0x16')];if(_0x356363[_0xe0ca('0x17')][_0xe0ca('0x31')]){_0x100b8a[_0xe0ca('0x36')]=[{'all':!![]}];}_0x100b8a=_[_0xe0ca('0x2e')]({},_0x100b8a,_0x356363[_0xe0ca('0x30')]);return db[_0xe0ca('0x15')][_0xe0ca('0x37')](_0x100b8a)[_0xe0ca('0xe')](handleEntityNotFound(_0x8af324,null))[_0xe0ca('0xe')](respondWithResult(_0x8af324,null))[_0xe0ca('0x38')](handleError(_0x8af324,null));};exports[_0xe0ca('0x39')]=function(_0x8b5786,_0x404c14){return db[_0xe0ca('0x15')][_0xe0ca('0x39')](_0x8b5786[_0xe0ca('0x3a')],{})[_0xe0ca('0xe')](respondWithResult(_0x404c14,0xc9))[_0xe0ca('0x38')](handleError(_0x404c14,null));};exports[_0xe0ca('0xd')]=function(_0x1561df,_0x5c27be){if(_0x1561df[_0xe0ca('0x3a')]['id']){delete _0x1561df[_0xe0ca('0x3a')]['id'];}return db[_0xe0ca('0x15')][_0xe0ca('0x37')]({'where':{'id':_0x1561df[_0xe0ca('0x35')]['id']}})[_0xe0ca('0xe')](handleEntityNotFound(_0x5c27be,null))['then'](saveUpdates(_0x1561df[_0xe0ca('0x3a')],null))['then'](respondWithResult(_0x5c27be,null))[_0xe0ca('0x38')](handleError(_0x5c27be,null));};exports[_0xe0ca('0x3b')]=function(_0xf09a5f,_0x2471b2){return db['CmHopper'][_0xe0ca('0x3b')]()[_0xe0ca('0xe')](respondWithResult(_0x2471b2,null))[_0xe0ca('0x38')](handleError(_0x2471b2,null));};exports[_0xe0ca('0x3c')]=function(_0x48ed5d,_0x52fe5c){var _0x10c76e;return db[_0xe0ca('0x15')]['find']({'where':{'id':_0x48ed5d[_0xe0ca('0x35')]['id']}})[_0xe0ca('0xe')](handleEntityNotFound(_0x52fe5c,null))[_0xe0ca('0xe')](function(_0x5447fa){if(_0x5447fa){return _0x5447fa[_0xe0ca('0x3c')]()[_0xe0ca('0xe')](function(_0x334fe5){return _0x334fe5;});}})[_0xe0ca('0xe')](function(_0x1fb85e){_0x10c76e=_0x1fb85e;if(_0x1fb85e){if(_0x1fb85e['VoiceQueueId']||_0x1fb85e[_0xe0ca('0x3d')]){return db[_0x1fb85e['VoiceQueueId']?_0xe0ca('0x3e'):_0xe0ca('0x3f')][_0xe0ca('0x37')]({'where':{'id':_0x1fb85e[_0xe0ca('0x40')]?_0x1fb85e[_0xe0ca('0x40')]:_0x1fb85e[_0xe0ca('0x3d')]},'attributes':['id','name'],'raw':!![]});}}})[_0xe0ca('0xe')](function(_0x4ff111){var _0xbfd8fa={};if(_0x4ff111){_[_0xe0ca('0x2e')](_0xbfd8fa,_[_0xe0ca('0x41')](_0x10c76e[_0xe0ca('0x42')],[_0xe0ca('0x43'),_0xe0ca('0x44'),'id']));_0xbfd8fa[_0xe0ca('0x45')]=0x15;_0xbfd8fa[_0xe0ca('0x46')]='deleted';_0xbfd8fa[_0xe0ca('0x47')]=_0x4ff111[_0xe0ca('0x11')];_0xbfd8fa[_0xe0ca('0x48')]=_0x48ed5d[_0xe0ca('0x49')][_0xe0ca('0x11')];_0xbfd8fa[_0xe0ca('0x4a')]=_0x48ed5d[_0xe0ca('0x49')]['id'];_0xbfd8fa['deleted']=!![];_0xbfd8fa[_0xe0ca('0x4b')]=moment()[_0xe0ca('0x4c')](_0xe0ca('0x4d'));_0xbfd8fa['calleridnum']=_0x10c76e[_0xe0ca('0x4e')];_0xbfd8fa['campaigntype']=_0x10c76e[_0xe0ca('0x40')]?_0xe0ca('0x4f'):_0xe0ca('0x50');return db[_0xe0ca('0x51')][_0xe0ca('0x37')]({'where':{'id':_0xbfd8fa[_0xe0ca('0x52')]},'attributes':[_0xe0ca('0x53'),_0xe0ca('0x54')]})[_0xe0ca('0xe')](function(_0x5b13ae){if(!_['isNil'](_0x52fe5c)&&!_[_0xe0ca('0x55')](_0x5b13ae[_0xe0ca('0x53')])){_0xbfd8fa['calleridname']=_0x5b13ae[_0xe0ca('0x53')];if(!_['isNil'](_0x5b13ae[_0xe0ca('0x54')])){_0xbfd8fa[_0xe0ca('0x56')]+='\x20'+_0x5b13ae[_0xe0ca('0x54')];}}})[_0xe0ca('0x57')](function(){return db[_0xe0ca('0x58')][_0xe0ca('0x39')](_0xbfd8fa);});}})[_0xe0ca('0xe')](function(){return _0x52fe5c[_0xe0ca('0x5')](0xcc)[_0xe0ca('0x59')]();})['catch'](handleError(_0x52fe5c,null));};exports[_0xe0ca('0x5a')]=function(_0x555ea3,_0x49a03e){var _0x23b362=[];return db['CmContact'][_0xe0ca('0x3b')]()[_0xe0ca('0xe')](function(_0xd1fc29){_0x23b362=_[_0xe0ca('0x18')](_0xd1fc29);return _0x555ea3[_0xe0ca('0x49')][_0xe0ca('0x5b')]({'where':{'type':_0xe0ca('0x5c'),'dialActive':!![],'dialMethod':_0xe0ca('0x5d')},'attributes':['id',_0xe0ca('0x5e'),'dialPreviewAutoRecallMe'],'raw':!![]});})[_0xe0ca('0xe')](function(_0x5d00d0){if(_0x5d00d0&&_0x5d00d0[_0xe0ca('0x29')]){return db[_0xe0ca('0x5f')][_0xe0ca('0x60')](function(_0x2ba241){var _0x57bcd5={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()['format'](_0xe0ca('0x4d'))},'VoiceQueueId':{'$in':_[_0xe0ca('0x14')](_0x5d00d0,'id')},'$or':[{'UserId':null},{'UserId':_0x555ea3[_0xe0ca('0x49')]['id']}]};var _0x2b3b4e={'active':![],'recallme':!![],'VoiceQueueId':{'$in':_(_0x5d00d0)['filter']([_0xe0ca('0x61'),0x0])[_0xe0ca('0x14')]('id')[_0xe0ca('0x62')]()},'$or':[{'UserId':null},{'UserId':_0x555ea3[_0xe0ca('0x49')]['id']}]};var _0x395f19={'$or':[_0x57bcd5,_0x2b3b4e]};var _0x399a09=[];if(_0x555ea3[_0xe0ca('0x3a')]['direction']&&_0x555ea3[_0xe0ca('0x3a')][_0xe0ca('0x63')]===_0xe0ca('0x64')){if(!_['isEmpty'](_0x555ea3[_0xe0ca('0x3a')]['hopperIds'])){_0x395f19['id']={'$in':_0x555ea3[_0xe0ca('0x3a')][_0xe0ca('0x65')]};}_0x399a09=[['priority',_0xe0ca('0x66')],[_0xe0ca('0x67'),_0x5d00d0[0x0][_0xe0ca('0x5e')]===_0xe0ca('0x66')?_0xe0ca('0x68'):_0xe0ca('0x66')],db[_0xe0ca('0x5f')][_0xe0ca('0x69')]('COALESCE(CmHopper.UserId,\x200)\x20ASC'),['id',_0xe0ca('0x68')]];}else{if(!_[_0xe0ca('0x6a')](_0x555ea3['body']['hopperIds'])){_0x395f19['id']={'$notIn':_0x555ea3[_0xe0ca('0x3a')][_0xe0ca('0x65')]};}_0x399a09=[['priority',_0xe0ca('0x68')],['scheduledAt',_0x5d00d0[0x0][_0xe0ca('0x5e')]],db[_0xe0ca('0x5f')][_0xe0ca('0x69')](_0xe0ca('0x6b')),['id','ASC']];}return db['CmHopper']['findOne']({'attributes':['id',_0xe0ca('0x6c'),_0xe0ca('0x6d')],'where':_0x395f19,'order':_0x399a09,'transaction':_0x2ba241,'lock':_0x2ba241['LOCK'][_0xe0ca('0x6e')],'include':[{'model':db[_0xe0ca('0x51')],'as':_0xe0ca('0x6f'),'attributes':_0x23b362,'include':[{'model':db[_0xe0ca('0x70')],'as':_0xe0ca('0x71'),'attributes':['id',_0xe0ca('0x11')]}]},{'model':db[_0xe0ca('0x72')],'as':_0xe0ca('0x73'),'attributes':['id',_0xe0ca('0x11')]},{'model':db[_0xe0ca('0x3e')],'as':'Queue','attributes':['id',_0xe0ca('0x11'),_0xe0ca('0x74')]}]})[_0xe0ca('0xe')](function(_0x1e18f5){if(_0x1e18f5){return _0x1e18f5[_0xe0ca('0xd')]({'UserId':_0x555ea3[_0xe0ca('0x49')]['id']},{'transaction':_0x2ba241});}});});}})[_0xe0ca('0xe')](handleEntityNotFound(_0x49a03e,null))[_0xe0ca('0xe')](respondWithResult(_0x49a03e,null))[_0xe0ca('0x38')](handleError(_0x49a03e,null));};exports[_0xe0ca('0x75')]=function(_0x1b4bbf,_0x22a67a,_0x57ece9){var _0x14239b=[];var _0x81340=_0x1b4bbf[_0xe0ca('0x35')]['id'];var _0x1b088c=_0x1b4bbf['user']['id'];return db[_0xe0ca('0x51')]['describe']()[_0xe0ca('0xe')](function(_0x141828){_0x14239b=_[_0xe0ca('0x18')](_0x141828);return db[_0xe0ca('0x5f')][_0xe0ca('0x60')](function(_0x28b38f){const _0x4e161b={'id':_0x81340};return db[_0xe0ca('0x15')][_0xe0ca('0x76')]({'attributes':['id','scheduledat',_0xe0ca('0x6d')],'where':_0x4e161b,'transaction':_0x28b38f,'lock':_0x28b38f['LOCK']['UPDATE'],'include':[{'model':db[_0xe0ca('0x51')],'as':_0xe0ca('0x6f'),'attributes':_0x14239b,'include':[{'model':db[_0xe0ca('0x70')],'as':_0xe0ca('0x71'),'attributes':['id',_0xe0ca('0x11')]}]},{'model':db[_0xe0ca('0x72')],'as':_0xe0ca('0x73'),'attributes':['id','name']},{'model':db[_0xe0ca('0x3e')],'as':'Queue','attributes':['id','name',_0xe0ca('0x74')]}]})[_0xe0ca('0xe')](function(_0x6c8a18){if(_0x6c8a18){return _0x6c8a18[_0xe0ca('0xd')]({'UserId':_0x1b088c},{'transaction':_0x28b38f});}});});})[_0xe0ca('0xe')](handleEntityNotFound(_0x22a67a,null))[_0xe0ca('0xe')](respondWithResult(_0x22a67a,null))[_0xe0ca('0x38')](handleError(_0x22a67a,null));};exports[_0xe0ca('0x77')]=function(_0x3bf714,_0x42d244){return _0x3bf714[_0xe0ca('0x49')][_0xe0ca('0x5b')]({'where':{'type':_0xe0ca('0x5c'),'dialActive':!![],'dialMethod':'preview'},'attributes':['id'],'raw':!![]})[_0xe0ca('0xe')](function(_0x460863){if(_0x460863&&_0x460863[_0xe0ca('0x29')]){return db[_0xe0ca('0x15')]['count']({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0xe0ca('0x4c')]('YYYY-MM-DD\x20HH:mm:ss')},'VoiceQueueId':{'$in':_[_0xe0ca('0x14')](_0x460863,'id')},'$or':[{'UserId':null},{'UserId':_0x3bf714['user']['id']}]}});}return 0x0;})[_0xe0ca('0xe')](function(_0x99a38a){if(!_[_0xe0ca('0x55')](_0x99a38a)&&_['isNumber'](_0x99a38a)){return _0x42d244['status'](0xc8)['json']({'contacts':_0x99a38a});}else{logger[_0xe0ca('0xf')](_0xe0ca('0x78'),'getOpenContacts',0x194,_0xe0ca('0x79'));_0x42d244[_0xe0ca('0x7a')](0x194);}})[_0xe0ca('0x38')](handleError(_0x42d244,null));};exports['getTimezones']=function(_0x2e128c,_0x13b60a){var _0xe428=shared[_0xe0ca('0x7b')];var _0x2f0c76=[];_['map'](_0xe428,function(_0x31fee8){_0x2f0c76['push']({'id':_0x31fee8[_0xe0ca('0x11')],'name':_0x31fee8[_0xe0ca('0x11')],'utcOffset':_0x31fee8[_0xe0ca('0x7c')]});});return _0x13b60a['status'](0xc8)[_0xe0ca('0x6')]({'tz':_0x2f0c76});};exports[_0xe0ca('0x7d')]=function(_0x195b00,_0x291712){var _0x298d68=shared[_0xe0ca('0x7b')];var _0x4d3c9c={};if(!_[_0xe0ca('0x55')](_0x298d68[_0x195b00[_0xe0ca('0x3a')]['id']]))_0x4d3c9c=_0x298d68[_0x195b00[_0xe0ca('0x3a')]['id']];return _0x291712[_0xe0ca('0x5')](0xc8)[_0xe0ca('0x6')](_0x4d3c9c);}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.model.js b/server/api/cmHopper/cmHopper.model.js index d36aec7..c125b49 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 _0x7c09=['scheduledat','phone','priority','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmHopper.attributes','define','CmHopper','cm_hopper'];(function(_0x5d5c1e,_0x154a68){var _0x2c0a73=function(_0x1afb88){while(--_0x1afb88){_0x5d5c1e['push'](_0x5d5c1e['shift']());}};_0x2c0a73(++_0x154a68);}(_0x7c09,0x102));var _0x97c0=function(_0x29671c,_0x35c1c6){_0x29671c=_0x29671c-0x0;var _0x43efd8=_0x7c09[_0x29671c];return _0x43efd8;};'use strict';var _=require('lodash');var util=require(_0x97c0('0x0'));var logger=require(_0x97c0('0x1'))('api');var moment=require(_0x97c0('0x2'));var BPromise=require(_0x97c0('0x3'));var rp=require(_0x97c0('0x4'));var fs=require('fs');var path=require(_0x97c0('0x5'));var rimraf=require(_0x97c0('0x6'));var config=require(_0x97c0('0x7'));var attributes=require(_0x97c0('0x8'));module['exports']=function(_0x4b2f81,_0x590368){return _0x4b2f81[_0x97c0('0x9')](_0x97c0('0xa'),attributes,{'tableName':_0x97c0('0xb'),'paranoid':![],'indexes':[{'name':_0x97c0('0xc'),'fields':[_0x97c0('0xc')]},{'name':'phone','fields':[_0x97c0('0xd')]},{'name':'priority','fields':[_0x97c0('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x5fab=['./cmHopper.attributes','exports','CmHopper','cm_hopper','scheduledat','phone','priority','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x274864,_0x145f4c){var _0x503594=function(_0x2d978f){while(--_0x2d978f){_0x274864['push'](_0x274864['shift']());}};_0x503594(++_0x145f4c);}(_0x5fab,0x177));var _0xb5fa=function(_0x2dd976,_0x1b5dc4){_0x2dd976=_0x2dd976-0x0;var _0x2265fd=_0x5fab[_0x2dd976];return _0x2265fd;};'use strict';var _=require(_0xb5fa('0x0'));var util=require(_0xb5fa('0x1'));var logger=require('../../config/logger')(_0xb5fa('0x2'));var moment=require(_0xb5fa('0x3'));var BPromise=require(_0xb5fa('0x4'));var rp=require(_0xb5fa('0x5'));var fs=require('fs');var path=require(_0xb5fa('0x6'));var rimraf=require(_0xb5fa('0x7'));var config=require(_0xb5fa('0x8'));var attributes=require(_0xb5fa('0x9'));module[_0xb5fa('0xa')]=function(_0x44df89,_0x4a0249){return _0x44df89['define'](_0xb5fa('0xb'),attributes,{'tableName':_0xb5fa('0xc'),'paranoid':![],'indexes':[{'name':_0xb5fa('0xd'),'fields':['scheduledat']},{'name':_0xb5fa('0xe'),'fields':[_0xb5fa('0xe')]},{'name':_0xb5fa('0xf'),'fields':['priority']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.rpc.js b/server/api/cmHopper/cmHopper.rpc.js index 287a3e4..3027ed8 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 _0x25e4=['active','DestroyCmHopper','destroy','sequelize','transaction','order','UPDATE','CmContact','Contact','keys','User','voicePause','length','UserId','push','all','dataValues','ContactId','GetContactDialer','CmHopperFinal','MoveContactManagedDialer\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','MoveContactManagedDialer','COUNT','`scheduledat`\x20>=\x20','\x22%s\x22','CountReScheduled','GetContactRecallMe','describe','LOCK','GetCmHopperPreview','GetContactByPhone','dialTimezone','DESC','ResetActiveCalls','CmHopperHandlePreviewRecallNotifications','voiceQueueId','NOW()\x20+\x20INTERVAL\x20','\x20MINUTE','NOW()','name','CmList','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','info','request\x20sent','debug','CmHopper,\x20%s,\x20%s,\x20%s','stringify','error','code','CmHopper,\x20%s,\x20%s','message','result','catch','CmHopper','findAll','options','raw','where','limit','include','map','model','attributes','then','GetCmHopper','ShowCmHopper','find','CreateCmHopper','create','UpdateCmHopper','update','body','UpdateCmHopper\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]'];(function(_0x317722,_0x58fba2){var _0xa152ad=function(_0x1a1b4e){while(--_0x1a1b4e){_0x317722['push'](_0x317722['shift']());}};_0xa152ad(++_0x58fba2);}(_0x25e4,0x1cd));var _0x425e=function(_0x2f38c9,_0x47e7a2){_0x2f38c9=_0x2f38c9-0x0;var _0x230414=_0x25e4[_0x2f38c9];return _0x230414;};'use strict';var _=require(_0x425e('0x0'));var util=require(_0x425e('0x1'));var moment=require(_0x425e('0x2'));var BPromise=require(_0x425e('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x425e('0x4'));var db=require(_0x425e('0x5'))['db'];var utils=require(_0x425e('0x6'));var logger=require(_0x425e('0x7'))('rpc');var config=require(_0x425e('0x8'));var jayson=require('jayson/promise');const {validateExpressRequest}=require('twilio/lib/webhooks/webhooks');var client=jayson[_0x425e('0x9')][_0x425e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x49602d,_0x5b949d,_0x10a7df){return new BPromise(function(_0x334d1d,_0x292932){return client[_0x425e('0xb')](_0x49602d,_0x10a7df)['then'](function(_0x2cb87a){logger[_0x425e('0xc')]('CmHopper,\x20%s,\x20%s',_0x5b949d,_0x425e('0xd'));logger[_0x425e('0xe')](_0x425e('0xf'),_0x5b949d,_0x425e('0xd'),JSON[_0x425e('0x10')](_0x2cb87a));if(_0x2cb87a[_0x425e('0x11')]){if(_0x2cb87a[_0x425e('0x11')][_0x425e('0x12')]===0x1f4){logger[_0x425e('0x11')](_0x425e('0x13'),_0x5b949d,_0x2cb87a[_0x425e('0x11')][_0x425e('0x14')]);return _0x292932(_0x2cb87a['error']['message']);}logger[_0x425e('0x11')](_0x425e('0x13'),_0x5b949d,_0x2cb87a[_0x425e('0x11')][_0x425e('0x14')]);return _0x334d1d(_0x2cb87a[_0x425e('0x11')][_0x425e('0x14')]);}else{logger[_0x425e('0xc')](_0x425e('0x13'),_0x5b949d,_0x425e('0xd'));_0x334d1d(_0x2cb87a[_0x425e('0x15')][_0x425e('0x14')]);}})[_0x425e('0x16')](function(_0x5e9215){logger[_0x425e('0x11')](_0x425e('0x13'),_0x5b949d,_0x5e9215);_0x292932(_0x5e9215);});});}exports['GetCmHopper']=function(_0x68e162){var _0x53bd06=this;return new Promise(function(_0x5e7ab8,_0x45ae3e){return db[_0x425e('0x17')][_0x425e('0x18')]({'raw':_0x68e162[_0x425e('0x19')]?_0x68e162[_0x425e('0x19')][_0x425e('0x1a')]===undefined?!![]:![]:!![],'where':_0x68e162[_0x425e('0x19')]?_0x68e162[_0x425e('0x19')][_0x425e('0x1b')]||null:null,'attributes':_0x68e162[_0x425e('0x19')]?_0x68e162['options']['attributes']||null:null,'limit':_0x68e162[_0x425e('0x19')]?_0x68e162[_0x425e('0x19')][_0x425e('0x1c')]||null:null,'include':_0x68e162['options']?_0x68e162[_0x425e('0x19')][_0x425e('0x1d')]?_[_0x425e('0x1e')](_0x68e162[_0x425e('0x19')][_0x425e('0x1d')],function(_0x280a16){return{'model':db[_0x280a16[_0x425e('0x1f')]],'as':_0x280a16['as'],'attributes':_0x280a16['attributes'],'include':_0x280a16[_0x425e('0x1d')]?_[_0x425e('0x1e')](_0x280a16[_0x425e('0x1d')],function(_0x2c9618){return{'model':db[_0x2c9618['model']],'as':_0x2c9618['as'],'attributes':_0x2c9618['attributes'],'include':_0x2c9618[_0x425e('0x1d')]?_['map'](_0x2c9618['include'],function(_0x73c585){return{'model':db[_0x73c585[_0x425e('0x1f')]],'as':_0x73c585['as'],'attributes':_0x73c585[_0x425e('0x20')]};}):[]};}):[]};}):[]:[]})[_0x425e('0x21')](function(_0x191c66){logger['info'](_0x425e('0x22'),_0x68e162);logger[_0x425e('0xe')](_0x425e('0x22'),_0x68e162,JSON[_0x425e('0x10')](_0x191c66));_0x5e7ab8(_0x191c66);})[_0x425e('0x16')](function(_0x1519c5){logger[_0x425e('0x11')](_0x425e('0x22'),_0x1519c5['message'],_0x68e162);_0x45ae3e(_0x53bd06[_0x425e('0x11')](0x1f4,_0x1519c5[_0x425e('0x14')]));});});};exports[_0x425e('0x23')]=function(_0x291ad1){var _0x4dd774=this;return new Promise(function(_0x535191,_0x52b23){return db[_0x425e('0x17')][_0x425e('0x24')]({'raw':_0x291ad1[_0x425e('0x19')]?_0x291ad1[_0x425e('0x19')][_0x425e('0x1a')]===undefined?!![]:![]:!![],'where':_0x291ad1[_0x425e('0x19')]?_0x291ad1[_0x425e('0x19')][_0x425e('0x1b')]||null:null,'attributes':_0x291ad1[_0x425e('0x19')]?_0x291ad1[_0x425e('0x19')][_0x425e('0x20')]||null:null,'include':_0x291ad1['options']?_0x291ad1[_0x425e('0x19')][_0x425e('0x1d')]?_[_0x425e('0x1e')](_0x291ad1[_0x425e('0x19')][_0x425e('0x1d')],function(_0x5a9400){return{'model':db[_0x5a9400[_0x425e('0x1f')]],'as':_0x5a9400['as'],'attributes':_0x5a9400[_0x425e('0x20')],'include':_0x5a9400['include']?_[_0x425e('0x1e')](_0x5a9400[_0x425e('0x1d')],function(_0x2146df){return{'model':db[_0x2146df[_0x425e('0x1f')]],'as':_0x2146df['as'],'attributes':_0x2146df['attributes'],'include':_0x2146df[_0x425e('0x1d')]?_[_0x425e('0x1e')](_0x2146df[_0x425e('0x1d')],function(_0x58277b){return{'model':db[_0x58277b[_0x425e('0x1f')]],'as':_0x58277b['as'],'attributes':_0x58277b[_0x425e('0x20')]};}):[]};}):[]};}):[]:[]})[_0x425e('0x21')](function(_0x467e29){logger['info'](_0x425e('0x23'),_0x291ad1);logger[_0x425e('0xe')](_0x425e('0x23'),_0x291ad1,JSON[_0x425e('0x10')](_0x467e29));_0x535191(_0x467e29);})[_0x425e('0x16')](function(_0x133e79){logger[_0x425e('0x11')](_0x425e('0x23'),_0x133e79[_0x425e('0x14')],_0x291ad1);_0x52b23(_0x4dd774[_0x425e('0x11')](0x1f4,_0x133e79[_0x425e('0x14')]));});});};exports[_0x425e('0x25')]=function(_0x154382){var _0x5840fd=this;return new Promise(function(_0x4675ee,_0x978717){return db['CmHopper'][_0x425e('0x26')](_0x154382['body'],{'raw':_0x154382[_0x425e('0x19')]?_0x154382[_0x425e('0x19')][_0x425e('0x1a')]===undefined?!![]:![]:!![]})['then'](function(_0x1f01db){logger[_0x425e('0xc')](_0x425e('0x25'),_0x154382);logger[_0x425e('0xe')](_0x425e('0x25'),_0x154382,JSON[_0x425e('0x10')](_0x1f01db));_0x4675ee(_0x1f01db);})['catch'](function(_0x14d3e2){logger['error'](_0x425e('0x25'),_0x14d3e2[_0x425e('0x14')],_0x154382);_0x978717(_0x5840fd[_0x425e('0x11')](0x1f4,_0x14d3e2[_0x425e('0x14')]));});});};exports[_0x425e('0x27')]=function(_0x594a59){var _0x38ebba=this;return new Promise(function(_0x15954a,_0x21d9e0){return db[_0x425e('0x17')][_0x425e('0x28')](_0x594a59[_0x425e('0x29')],{'raw':_0x594a59[_0x425e('0x19')]?_0x594a59[_0x425e('0x19')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x594a59['options']?_0x594a59[_0x425e('0x19')][_0x425e('0x1b')]||null:null,'attributes':_0x594a59[_0x425e('0x19')]?_0x594a59[_0x425e('0x19')]['attributes']||null:null,'limit':_0x594a59[_0x425e('0x19')]?_0x594a59['options'][_0x425e('0x1c')]||null:null})[_0x425e('0x21')](function(_0x32dfa5){logger[_0x425e('0xc')](_0x425e('0x27'),_0x594a59);logger[_0x425e('0xc')](_0x425e('0x2a'),JSON[_0x425e('0x10')](_0x594a59[_0x425e('0x19')][_0x425e('0x1b')]),_0x594a59['body'][_0x425e('0x2b')]);logger[_0x425e('0xe')](_0x425e('0x27'),_0x594a59,JSON[_0x425e('0x10')](_0x32dfa5));_0x15954a(_0x32dfa5);})[_0x425e('0x16')](function(_0x500d78){logger[_0x425e('0x11')](_0x425e('0x27'),_0x500d78['message'],_0x594a59);_0x21d9e0(_0x38ebba[_0x425e('0x11')](0x1f4,_0x500d78[_0x425e('0x14')]));});});};exports[_0x425e('0x2c')]=function(_0x4f4ba9){var _0x29ee32=this;return new Promise(function(_0x4a4a52,_0x509339){return db[_0x425e('0x17')][_0x425e('0x2d')]({'where':_0x4f4ba9[_0x425e('0x19')]?_0x4f4ba9[_0x425e('0x19')][_0x425e('0x1b')]||null:null})[_0x425e('0x21')](function(_0x42c2c9){logger[_0x425e('0xc')](_0x425e('0x2c'),_0x4f4ba9);logger[_0x425e('0xe')]('DestroyCmHopper',_0x4f4ba9,JSON[_0x425e('0x10')](_0x42c2c9));_0x4a4a52(_0x42c2c9);})[_0x425e('0x16')](function(_0x872060){logger[_0x425e('0x11')](_0x425e('0x2c'),_0x872060[_0x425e('0x14')],_0x4f4ba9);_0x509339(_0x29ee32[_0x425e('0x11')](0x1f4,_0x872060[_0x425e('0x14')]));});});};exports['GetContactDialer']=function(_0x60348e){var _0x1761e0=this;return new Promise(function(_0x11128e,_0x6d1837){return db['CmContact']['describe']()[_0x425e('0x21')](function(_0x177805){return db[_0x425e('0x2e')][_0x425e('0x2f')](function(_0x3073f2){return db[_0x425e('0x17')][_0x425e('0x18')]({'where':_0x60348e['options']?_0x60348e['options']['where']||null:null,'attributes':_0x60348e[_0x425e('0x19')]?_0x60348e[_0x425e('0x19')]['attributes']||null:null,'limit':_0x60348e[_0x425e('0x19')]?_0x60348e[_0x425e('0x19')][_0x425e('0x1c')]||null:null,'order':_0x60348e[_0x425e('0x19')]?_0x60348e[_0x425e('0x19')][_0x425e('0x30')]||null:null,'transaction':_0x3073f2,'lock':_0x3073f2['LOCK'][_0x425e('0x31')],'include':[{'model':db[_0x425e('0x32')],'as':_0x425e('0x33'),'attributes':_[_0x425e('0x34')](_0x177805)},{'model':db[_0x425e('0x35')],'as':'Agent','attributes':['id','name',_0x425e('0x36')]}]})[_0x425e('0x21')](function(_0x2dd8b4){var _0x5e2caa=[];var _0x1a22c3=[];for(var _0x370d1a=0x0;_0x370d1a<_0x2dd8b4[_0x425e('0x37')];_0x370d1a+=0x1){var _0x2f9d81=_0x2dd8b4[_0x370d1a][_0x425e('0x38')];if(_0x2f9d81===null){_0x5e2caa[_0x425e('0x39')](_0x2dd8b4[_0x370d1a][_0x425e('0x28')](_0x60348e['body'],{'transaction':_0x3073f2}));}else if(!_0x1a22c3['includes'](_0x2f9d81)){_0x1a22c3[_0x425e('0x39')](_0x2f9d81);_0x5e2caa[_0x425e('0x39')](_0x2dd8b4[_0x370d1a][_0x425e('0x28')](_0x60348e['body'],{'transaction':_0x3073f2}));}}return BPromise[_0x425e('0x3a')](_0x5e2caa);});})['then'](function(_0x54f408){logger[_0x425e('0xc')]('GetContactDialer',_0x60348e);if(_0x54f408[_0x425e('0x37')]>0x0){logger[_0x425e('0xc')]('GetContactDialer\x20hopperId\x20[%s]\x20-\x20contactId\x20[%s]\x20-\x20active\x20status\x20[%s]',_0x54f408[0x0][_0x425e('0x3b')]['id'],_0x54f408[0x0]['dataValues'][_0x425e('0x3c')],_0x54f408[0x0]['dataValues']['active']);}logger['debug'](_0x425e('0x3d'),_0x60348e,JSON['stringify'](_0x54f408));_0x11128e(_0x54f408);})[_0x425e('0x16')](function(_0x1afcb1){logger[_0x425e('0x11')]('GetContactDialer',_0x1afcb1[_0x425e('0x14')],_0x60348e);_0x6d1837(_0x1761e0['error'](0x1f4,_0x1afcb1['message']));});});});};exports['MoveContactManagedDialer']=function(_0x3a14a2){var _0xa03d53=this;return new Promise(function(_0x25f7af,_0x24342f){return db[_0x425e('0x2e')]['transaction'](function(_0xde5971){return db[_0x425e('0x3e')][_0x425e('0x26')](_0x3a14a2[_0x425e('0x29')],{'raw':_0x3a14a2[_0x425e('0x19')]?_0x3a14a2['options'][_0x425e('0x1a')]===undefined?!![]:![]:!![],'transaction':_0xde5971})[_0x425e('0x21')](function(){logger['info'](_0x425e('0x3f'),JSON[_0x425e('0x10')](_0x3a14a2[_0x425e('0x19')][_0x425e('0x1b')]),_0x3a14a2['options']['where'][_0x425e('0x2b')]);return db[_0x425e('0x17')][_0x425e('0x2d')]({'where':_0x3a14a2[_0x425e('0x19')]?_0x3a14a2[_0x425e('0x19')][_0x425e('0x1b')]||null:null,'transaction':_0xde5971});});})[_0x425e('0x21')](function(_0x243db3){logger[_0x425e('0xc')](_0x425e('0x40'),_0x3a14a2);logger[_0x425e('0xe')](_0x425e('0x40'),_0x3a14a2,JSON['stringify'](_0x243db3));_0x25f7af(_0x243db3);})[_0x425e('0x16')](function(_0x1ad307){logger[_0x425e('0x11')]('MoveContactManagedDialer',_0x1ad307[_0x425e('0x14')],_0x3a14a2);_0x24342f(_0xa03d53[_0x425e('0x11')](0x1f4,_0x1ad307[_0x425e('0x14')]));});});};exports['CountReScheduled']=function(_0x341ac0){var _0x5075dd=this;return new Promise(function(_0x46a168,_0x3f1d71){return db[_0x425e('0x17')][_0x425e('0x18')]({'raw':_0x341ac0[_0x425e('0x19')]?_0x341ac0[_0x425e('0x19')][_0x425e('0x1a')]===undefined?!![]:![]:!![],'where':_0x341ac0[_0x425e('0x19')]?_0x341ac0[_0x425e('0x19')][_0x425e('0x1b')]||null:null,'attributes':[[db[_0x425e('0x2e')]['fn'](_0x425e('0x41'),db[_0x425e('0x2e')]['fn']('IF',db['sequelize']['literal'](_0x425e('0x42')+util['format'](_0x425e('0x43'),moment()['format']('YYYY-MM-DD\x20HH:mm:ss'))+'\x20,\x201,\x20null'))),'contactsRescheduled']]})[_0x425e('0x21')](function(_0x11b104){logger['info'](_0x425e('0x44'),_0x341ac0);logger[_0x425e('0xe')](_0x425e('0x44'),_0x341ac0,JSON[_0x425e('0x10')](_0x11b104));_0x46a168(_0x11b104);})[_0x425e('0x16')](function(_0x5de724){logger[_0x425e('0x11')](_0x425e('0x44'),_0x5de724[_0x425e('0x14')],_0x341ac0);_0x3f1d71(_0x5075dd['error'](0x1f4,_0x5de724['message']));});});};exports[_0x425e('0x45')]=function(_0x328441){var _0x1546cf=this;return new Promise(function(_0x3f0f33,_0x43fd30){return db[_0x425e('0x32')][_0x425e('0x46')]()['then'](function(_0x5beb12){return db[_0x425e('0x2e')][_0x425e('0x2f')](function(_0x22ac1e){return db['CmHopper'][_0x425e('0x18')]({'where':_0x328441[_0x425e('0x19')]?_0x328441[_0x425e('0x19')][_0x425e('0x1b')]||null:null,'attributes':_0x328441['options']?_0x328441[_0x425e('0x19')]['attributes']||null:null,'limit':0x1,'order':_0x328441['options']?_0x328441[_0x425e('0x19')]['order']||null:null,'group':db[_0x425e('0x17')][_0x425e('0x38')],'transaction':_0x22ac1e,'lock':_0x22ac1e[_0x425e('0x47')][_0x425e('0x31')],'include':_0x328441[_0x425e('0x19')]?_0x328441['options'][_0x425e('0x1d')]?_[_0x425e('0x1e')](_0x328441['options'][_0x425e('0x1d')],function(_0x355b4e){return{'model':db[_0x355b4e['model']],'as':_0x355b4e['as'],'attributes':_0x355b4e[_0x425e('0x20')],'include':_0x355b4e[_0x425e('0x1d')]?_[_0x425e('0x1e')](_0x355b4e[_0x425e('0x1d')],function(_0x4ad5b3){return{'model':db[_0x4ad5b3['model']],'as':_0x4ad5b3['as'],'attributes':_0x4ad5b3['attributes'],'include':_0x4ad5b3['include']?_[_0x425e('0x1e')](_0x4ad5b3[_0x425e('0x1d')],function(_0x52dffc){return{'model':db[_0x52dffc[_0x425e('0x1f')]],'as':_0x52dffc['as'],'attributes':_0x52dffc[_0x425e('0x20')]};}):[]};}):[]};}):[]:[]})[_0x425e('0x21')](function(_0x158974){var _0x17a653=[];for(var _0x3cfa62=0x0;_0x3cfa62<_0x158974[_0x425e('0x37')];_0x3cfa62+=0x1){_0x17a653['push'](_0x158974[_0x3cfa62][_0x425e('0x28')](_0x328441['body'],{'transaction':_0x22ac1e}));}return BPromise[_0x425e('0x3a')](_0x17a653);});})['then'](function(_0xbcbf80){logger[_0x425e('0xc')](_0x425e('0x45'),_0x328441);logger[_0x425e('0xe')]('GetContactRecallMe',_0x328441,JSON[_0x425e('0x10')](_0xbcbf80));_0x3f0f33(_0xbcbf80);})['catch'](function(_0x1e6a3a){logger['error'](_0x425e('0x45'),_0x1e6a3a[_0x425e('0x14')],_0x328441);_0x43fd30(_0x1546cf[_0x425e('0x11')](0x1f4,_0x1e6a3a[_0x425e('0x14')]));});});});};exports[_0x425e('0x48')]=function(_0x35814e){var _0x314348=this;return new Promise(function(_0x5ea3c1,_0x3dacf4){db[_0x425e('0x32')][_0x425e('0x46')]()[_0x425e('0x21')](function(_0x24c2e2){return db[_0x425e('0x17')][_0x425e('0x18')]({'raw':_0x35814e[_0x425e('0x19')]?_0x35814e[_0x425e('0x19')][_0x425e('0x1a')]===undefined?!![]:![]:!![],'where':_0x35814e[_0x425e('0x19')]?_0x35814e[_0x425e('0x19')]['where']||null:null,'attributes':_0x35814e[_0x425e('0x19')]?_0x35814e[_0x425e('0x19')][_0x425e('0x20')]||null:null,'limit':_0x35814e[_0x425e('0x19')]?_0x35814e['options'][_0x425e('0x1c')]||null:null,'include':_0x35814e[_0x425e('0x19')]?_0x35814e[_0x425e('0x19')][_0x425e('0x1d')]?_[_0x425e('0x1e')](_0x35814e['options'][_0x425e('0x1d')],function(_0x269476){return{'model':db[_0x269476[_0x425e('0x1f')]],'as':_0x269476['as'],'attributes':_0x269476['as']===_0x425e('0x33')?_['keys'](_0x24c2e2):_0x269476[_0x425e('0x20')],'include':_0x269476[_0x425e('0x1d')]?_['map'](_0x269476['include'],function(_0x592d28){return{'model':db[_0x592d28['model']],'as':_0x592d28['as'],'attributes':_0x592d28[_0x425e('0x20')],'include':_0x592d28['include']?_[_0x425e('0x1e')](_0x592d28['include'],function(_0xab1f43){return{'model':db[_0xab1f43[_0x425e('0x1f')]],'as':_0xab1f43['as'],'attributes':_0xab1f43[_0x425e('0x20')]};}):[]};}):[]};}):[]:[]})[_0x425e('0x21')](function(_0x5d0ac5){logger[_0x425e('0xc')](_0x425e('0x22'),_0x35814e);logger[_0x425e('0xe')](_0x425e('0x22'),_0x35814e,JSON[_0x425e('0x10')](_0x5d0ac5));_0x5ea3c1(_0x5d0ac5);})[_0x425e('0x16')](function(_0x4a6e83){logger[_0x425e('0x11')](_0x425e('0x22'),_0x4a6e83[_0x425e('0x14')],_0x35814e);_0x3dacf4(_0x314348[_0x425e('0x11')](0x1f4,_0x4a6e83[_0x425e('0x14')]));});});});};exports[_0x425e('0x49')]=function(_0x40bd4e){var _0x35a672=this;return new Promise(function(_0x9ecc09,_0x3dd331){return db[_0x425e('0x32')]['findOne']({'raw':!![],'where':{'phone':_0x40bd4e[_0x425e('0x19')]['where']['phone']},'attributes':['id',_0x425e('0x4a')],'order':[['id',_0x425e('0x4b')]]})[_0x425e('0x21')](function(_0x879a0a){logger[_0x425e('0xc')]('getContactByPhone',_0x40bd4e);logger[_0x425e('0xe')]('getContactByPhone',_0x40bd4e,JSON[_0x425e('0x10')](_0x879a0a));_0x9ecc09(_0x879a0a);})[_0x425e('0x16')](function(_0x468e4e){logger['error']('getContactByPhone',_0x468e4e[_0x425e('0x14')],_0x40bd4e);_0x3dd331(_0x35a672['error'](0x1f4,_0x468e4e[_0x425e('0x14')]));});});};exports[_0x425e('0x4c')]=function(_0x20034a){var _0x37c927=this;return new Promise(function(_0x3fdf15,_0x4166f6){return db[_0x425e('0x2e')][_0x425e('0x2f')](function(_0x16762e){return db[_0x425e('0x17')][_0x425e('0x28')]({'active':![]},{'where':{},'transaction':_0x16762e})[_0x425e('0x21')](function(_0x5ef00b){logger['info'](_0x425e('0x4c'),_0x20034a);logger[_0x425e('0xe')](_0x425e('0x4c'),_0x20034a,JSON[_0x425e('0x10')](_0x5ef00b));_0x3fdf15(_0x5ef00b);})[_0x425e('0x16')](function(_0x4d8fe8){logger[_0x425e('0x11')]('ResetActiveCalls',_0x4d8fe8[_0x425e('0x14')],_0x20034a);_0x4166f6(_0x37c927[_0x425e('0x11')](0x1f4,_0x4d8fe8[_0x425e('0x14')]));});});});};exports[_0x425e('0x4d')]=function(_0x16ff47){var _0x35dd43=this;var _0x4e84b1=_0x16ff47['body'][_0x425e('0x1b')][_0x425e('0x4e')];var _0x2c2470=_0x16ff47[_0x425e('0x29')][_0x425e('0x1b')]['interval'];return new Promise(function(_0x3a815c,_0x51292f){return db[_0x425e('0x17')]['findAll']({'logging':!![],'where':{'voiceQueueId':_0x4e84b1,'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$and':{'$lte':db[_0x425e('0x2e')]['literal'](_0x425e('0x4f')+_0x2c2470+_0x425e('0x50')),'$gt':db[_0x425e('0x2e')]['literal'](_0x425e('0x51'))}}},'include':[{'model':db['CmContact'],'as':_0x425e('0x33')},{'model':db[_0x425e('0x35')],'as':'Agent','attributes':['id',_0x425e('0x52'),'voicePause']},{'model':db[_0x425e('0x53')],'as':'List'}]})[_0x425e('0x21')](function(_0x3da0ac){return db[_0x425e('0x2e')][_0x425e('0x2f')](function(_0x13df8c){return db['CmHopper'][_0x425e('0x28')]({'recallmeNotifiedDate':new Date()},{'where':{'id':{'$in':_[_0x425e('0x1e')](_0x3da0ac,'id')}},'logging':!![],'transaction':_0x13df8c})[_0x425e('0x21')](function(_0x510101){_0x3a815c(_0x3da0ac);})['catch'](function(_0x10a96e){logger[_0x425e('0x11')](_0x425e('0x4d'),_0x10a96e[_0x425e('0x14')],_0x16ff47);_0x51292f(validateExpressRequest);});});})[_0x425e('0x16')](function(_0x4d10a6){logger[_0x425e('0x11')](_0x425e('0x4d'),_0x4d10a6['message'],_0x16ff47);_0x51292f(_0x35dd43[_0x425e('0x11')](0x1f4,_0x4d10a6[_0x425e('0x14')]));});});}; \ No newline at end of file +var _0x58e6=['push','update','all','GetContactDialer\x20hopperId\x20[%s]\x20-\x20contactId\x20[%s]\x20-\x20active\x20status\x20[%s]','dataValues','ContactId','MoveContactManagedDialer','sequelize','transaction','CmHopperFinal','MoveContactManagedDialer\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','COUNT','literal','`scheduledat`\x20>=\x20','\x22%s\x22','YYYY-MM-DD\x20HH:mm:ss','contactsRescheduled','CountReScheduled','GetContactRecallMe','UPDATE','GetCmHopperPreview','Contact','GetContactByPhone','findOne','phone','DESC','getContactByPhone','ResetActiveCalls','CmHopperHandlePreviewRecallNotifications','NOW()\x20+\x20INTERVAL\x20','User','CmList','List','log','NOW()','lodash','util','../../config/logger','jayson/promise','client','http','then','info','request\x20sent','debug','CmHopper,\x20%s,\x20%s,\x20%s','stringify','error','CmHopper,\x20%s,\x20%s','message','catch','GetCmHopper','CmHopper','findAll','options','raw','where','include','map','model','attributes','ShowCmHopper','find','CreateCmHopper','create','body','UpdateCmHopper','limit','UpdateCmHopper\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','active','DestroyCmHopper','destroy','GetContactDialer','CmContact','describe','order','LOCK','keys','Agent','name','voicePause','length','UserId'];(function(_0x4ae34b,_0x51e416){var _0x5dc785=function(_0x1e0b6d){while(--_0x1e0b6d){_0x4ae34b['push'](_0x4ae34b['shift']());}};_0x5dc785(++_0x51e416);}(_0x58e6,0x1c2));var _0x658e=function(_0x58338c,_0x358ca6){_0x58338c=_0x58338c-0x0;var _0x544b97=_0x58e6[_0x58338c];return _0x544b97;};'use strict';var _=require(_0x658e('0x0'));var util=require(_0x658e('0x1'));var moment=require('moment');var BPromise=require('bluebird');var db=require('../../mysqldb')['db'];var logger=require(_0x658e('0x2'))('rpc');var jayson=require(_0x658e('0x3'));var client=jayson[_0x658e('0x4')][_0x658e('0x5')]({'port':0x232a});function respondWithRpcPromise(_0x187e6a,_0x465134,_0x2add44){return new BPromise(function(_0x3251b8,_0x4ea631){return client['request'](_0x187e6a,_0x2add44)[_0x658e('0x6')](function(_0xa73acf){logger[_0x658e('0x7')]('CmHopper,\x20%s,\x20%s',_0x465134,_0x658e('0x8'));logger[_0x658e('0x9')](_0x658e('0xa'),_0x465134,_0x658e('0x8'),JSON[_0x658e('0xb')](_0xa73acf));if(_0xa73acf[_0x658e('0xc')]){if(_0xa73acf['error']['code']===0x1f4){logger[_0x658e('0xc')](_0x658e('0xd'),_0x465134,_0xa73acf[_0x658e('0xc')][_0x658e('0xe')]);return _0x4ea631(_0xa73acf[_0x658e('0xc')][_0x658e('0xe')]);}logger[_0x658e('0xc')]('CmHopper,\x20%s,\x20%s',_0x465134,_0xa73acf[_0x658e('0xc')][_0x658e('0xe')]);return _0x3251b8(_0xa73acf[_0x658e('0xc')][_0x658e('0xe')]);}else{logger['info'](_0x658e('0xd'),_0x465134,_0x658e('0x8'));_0x3251b8(_0xa73acf['result']['message']);}})[_0x658e('0xf')](function(_0x17c487){logger[_0x658e('0xc')]('CmHopper,\x20%s,\x20%s',_0x465134,_0x17c487);_0x4ea631(_0x17c487);});});}exports[_0x658e('0x10')]=function(_0x4f9ccd){var _0x1c5c4e=this;return new Promise(function(_0x1f1edc,_0x22deed){return db[_0x658e('0x11')][_0x658e('0x12')]({'raw':_0x4f9ccd[_0x658e('0x13')]?_0x4f9ccd['options'][_0x658e('0x14')]===undefined?!![]:![]:!![],'where':_0x4f9ccd[_0x658e('0x13')]?_0x4f9ccd[_0x658e('0x13')][_0x658e('0x15')]||null:null,'attributes':_0x4f9ccd[_0x658e('0x13')]?_0x4f9ccd['options']['attributes']||null:null,'limit':_0x4f9ccd[_0x658e('0x13')]?_0x4f9ccd[_0x658e('0x13')]['limit']||null:null,'include':_0x4f9ccd[_0x658e('0x13')]?_0x4f9ccd[_0x658e('0x13')][_0x658e('0x16')]?_[_0x658e('0x17')](_0x4f9ccd['options'][_0x658e('0x16')],function(_0x142e58){return{'model':db[_0x142e58[_0x658e('0x18')]],'as':_0x142e58['as'],'attributes':_0x142e58[_0x658e('0x19')],'include':_0x142e58[_0x658e('0x16')]?_[_0x658e('0x17')](_0x142e58[_0x658e('0x16')],function(_0x1a5fa6){return{'model':db[_0x1a5fa6[_0x658e('0x18')]],'as':_0x1a5fa6['as'],'attributes':_0x1a5fa6[_0x658e('0x19')],'include':_0x1a5fa6[_0x658e('0x16')]?_['map'](_0x1a5fa6[_0x658e('0x16')],function(_0x478705){return{'model':db[_0x478705['model']],'as':_0x478705['as'],'attributes':_0x478705[_0x658e('0x19')]};}):[]};}):[]};}):[]:[]})[_0x658e('0x6')](function(_0x410642){logger[_0x658e('0x7')](_0x658e('0x10'),_0x4f9ccd);logger[_0x658e('0x9')](_0x658e('0x10'),_0x4f9ccd,JSON['stringify'](_0x410642));_0x1f1edc(_0x410642);})['catch'](function(_0x2eb63d){logger[_0x658e('0xc')](_0x658e('0x10'),_0x2eb63d['message'],_0x4f9ccd);_0x22deed(_0x1c5c4e[_0x658e('0xc')](0x1f4,_0x2eb63d[_0x658e('0xe')]));});});};exports[_0x658e('0x1a')]=function(_0x4edddd){var _0x48fc5a=this;return new Promise(function(_0x131420,_0x4ee4c0){return db[_0x658e('0x11')][_0x658e('0x1b')]({'raw':_0x4edddd[_0x658e('0x13')]?_0x4edddd[_0x658e('0x13')][_0x658e('0x14')]===undefined?!![]:![]:!![],'where':_0x4edddd[_0x658e('0x13')]?_0x4edddd[_0x658e('0x13')]['where']||null:null,'attributes':_0x4edddd[_0x658e('0x13')]?_0x4edddd['options'][_0x658e('0x19')]||null:null,'include':_0x4edddd[_0x658e('0x13')]?_0x4edddd['options'][_0x658e('0x16')]?_[_0x658e('0x17')](_0x4edddd[_0x658e('0x13')][_0x658e('0x16')],function(_0x5f3c71){return{'model':db[_0x5f3c71['model']],'as':_0x5f3c71['as'],'attributes':_0x5f3c71[_0x658e('0x19')],'include':_0x5f3c71[_0x658e('0x16')]?_['map'](_0x5f3c71['include'],function(_0xd847b2){return{'model':db[_0xd847b2['model']],'as':_0xd847b2['as'],'attributes':_0xd847b2[_0x658e('0x19')],'include':_0xd847b2[_0x658e('0x16')]?_[_0x658e('0x17')](_0xd847b2['include'],function(_0x4cfcc7){return{'model':db[_0x4cfcc7[_0x658e('0x18')]],'as':_0x4cfcc7['as'],'attributes':_0x4cfcc7['attributes']};}):[]};}):[]};}):[]:[]})[_0x658e('0x6')](function(_0x3a25fc){logger[_0x658e('0x7')](_0x658e('0x1a'),_0x4edddd);logger[_0x658e('0x9')](_0x658e('0x1a'),_0x4edddd,JSON[_0x658e('0xb')](_0x3a25fc));_0x131420(_0x3a25fc);})[_0x658e('0xf')](function(_0x5ce007){logger['error'](_0x658e('0x1a'),_0x5ce007[_0x658e('0xe')],_0x4edddd);_0x4ee4c0(_0x48fc5a['error'](0x1f4,_0x5ce007[_0x658e('0xe')]));});});};exports[_0x658e('0x1c')]=function(_0x137079){var _0x588cc5=this;return new Promise(function(_0x3bf0d3,_0x5d9a89){return db[_0x658e('0x11')][_0x658e('0x1d')](_0x137079[_0x658e('0x1e')],{'raw':_0x137079[_0x658e('0x13')]?_0x137079[_0x658e('0x13')][_0x658e('0x14')]===undefined?!![]:![]:!![]})[_0x658e('0x6')](function(_0x51f7f5){logger[_0x658e('0x7')]('CreateCmHopper',_0x137079);logger['debug'](_0x658e('0x1c'),_0x137079,JSON[_0x658e('0xb')](_0x51f7f5));_0x3bf0d3(_0x51f7f5);})[_0x658e('0xf')](function(_0x18da49){logger[_0x658e('0xc')](_0x658e('0x1c'),_0x18da49[_0x658e('0xe')],_0x137079);_0x5d9a89(_0x588cc5[_0x658e('0xc')](0x1f4,_0x18da49['message']));});});};exports[_0x658e('0x1f')]=function(_0xce3ca9){var _0x563b95=this;return new Promise(function(_0x329acc,_0xb2dfbb){return db[_0x658e('0x11')]['update'](_0xce3ca9[_0x658e('0x1e')],{'raw':_0xce3ca9[_0x658e('0x13')]?_0xce3ca9[_0x658e('0x13')][_0x658e('0x14')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xce3ca9[_0x658e('0x13')]?_0xce3ca9[_0x658e('0x13')]['where']||null:null,'attributes':_0xce3ca9['options']?_0xce3ca9['options']['attributes']||null:null,'limit':_0xce3ca9[_0x658e('0x13')]?_0xce3ca9[_0x658e('0x13')][_0x658e('0x20')]||null:null})[_0x658e('0x6')](function(_0x2fb4a5){logger['info'](_0x658e('0x1f'),_0xce3ca9);logger[_0x658e('0x7')](_0x658e('0x21'),JSON['stringify'](_0xce3ca9[_0x658e('0x13')][_0x658e('0x15')]),_0xce3ca9[_0x658e('0x1e')][_0x658e('0x22')]);logger[_0x658e('0x9')](_0x658e('0x1f'),_0xce3ca9,JSON[_0x658e('0xb')](_0x2fb4a5));_0x329acc(_0x2fb4a5);})[_0x658e('0xf')](function(_0x57ddde){logger[_0x658e('0xc')](_0x658e('0x1f'),_0x57ddde['message'],_0xce3ca9);_0xb2dfbb(_0x563b95[_0x658e('0xc')](0x1f4,_0x57ddde['message']));});});};exports[_0x658e('0x23')]=function(_0x418d19){var _0x54a164=this;return new Promise(function(_0x43821c,_0x5423aa){return db[_0x658e('0x11')][_0x658e('0x24')]({'where':_0x418d19['options']?_0x418d19['options'][_0x658e('0x15')]||null:null})[_0x658e('0x6')](function(_0x365b3a){logger[_0x658e('0x7')]('DestroyCmHopper',_0x418d19);logger[_0x658e('0x9')](_0x658e('0x23'),_0x418d19,JSON['stringify'](_0x365b3a));_0x43821c(_0x365b3a);})['catch'](function(_0x49ac13){logger[_0x658e('0xc')](_0x658e('0x23'),_0x49ac13['message'],_0x418d19);_0x5423aa(_0x54a164[_0x658e('0xc')](0x1f4,_0x49ac13[_0x658e('0xe')]));});});};exports[_0x658e('0x25')]=function(_0x34b1c4){var _0x4e82db=this;return new Promise(function(_0x226b90,_0x29d119){return db[_0x658e('0x26')][_0x658e('0x27')]()[_0x658e('0x6')](function(_0x46f76e){return db['sequelize']['transaction'](function(_0x4f7fdc){return db['CmHopper']['findAll']({'where':_0x34b1c4['options']?_0x34b1c4[_0x658e('0x13')][_0x658e('0x15')]||null:null,'attributes':_0x34b1c4[_0x658e('0x13')]?_0x34b1c4['options'][_0x658e('0x19')]||null:null,'limit':_0x34b1c4[_0x658e('0x13')]?_0x34b1c4[_0x658e('0x13')][_0x658e('0x20')]||null:null,'order':_0x34b1c4[_0x658e('0x13')]?_0x34b1c4[_0x658e('0x13')][_0x658e('0x28')]||null:null,'transaction':_0x4f7fdc,'lock':_0x4f7fdc[_0x658e('0x29')]['UPDATE'],'include':[{'model':db[_0x658e('0x26')],'as':'Contact','attributes':_[_0x658e('0x2a')](_0x46f76e)},{'model':db['User'],'as':_0x658e('0x2b'),'attributes':['id',_0x658e('0x2c'),_0x658e('0x2d')]}]})[_0x658e('0x6')](function(_0x141b95){var _0x304bb5=[];var _0x26d0c6=[];for(var _0x100cba=0x0;_0x100cba<_0x141b95[_0x658e('0x2e')];_0x100cba+=0x1){var _0x22d50f=_0x141b95[_0x100cba][_0x658e('0x2f')];if(_0x22d50f===null){_0x304bb5[_0x658e('0x30')](_0x141b95[_0x100cba]['update'](_0x34b1c4['body'],{'transaction':_0x4f7fdc}));}else if(!_0x26d0c6['includes'](_0x22d50f)){_0x26d0c6[_0x658e('0x30')](_0x22d50f);_0x304bb5[_0x658e('0x30')](_0x141b95[_0x100cba][_0x658e('0x31')](_0x34b1c4[_0x658e('0x1e')],{'transaction':_0x4f7fdc}));}}return BPromise[_0x658e('0x32')](_0x304bb5);});})[_0x658e('0x6')](function(_0xd4c4e2){logger[_0x658e('0x7')](_0x658e('0x25'),_0x34b1c4);if(_0xd4c4e2[_0x658e('0x2e')]>0x0){logger[_0x658e('0x7')](_0x658e('0x33'),_0xd4c4e2[0x0][_0x658e('0x34')]['id'],_0xd4c4e2[0x0][_0x658e('0x34')][_0x658e('0x35')],_0xd4c4e2[0x0][_0x658e('0x34')]['active']);}logger[_0x658e('0x9')]('GetContactDialer',_0x34b1c4,JSON[_0x658e('0xb')](_0xd4c4e2));_0x226b90(_0xd4c4e2);})[_0x658e('0xf')](function(_0x166038){logger[_0x658e('0xc')](_0x658e('0x25'),_0x166038[_0x658e('0xe')],_0x34b1c4);_0x29d119(_0x4e82db[_0x658e('0xc')](0x1f4,_0x166038[_0x658e('0xe')]));});});});};exports[_0x658e('0x36')]=function(_0x384502){var _0x33f783=this;return new Promise(function(_0xf7b83e,_0x7bc5c7){return db[_0x658e('0x37')][_0x658e('0x38')](function(_0x1a7dc4){return db[_0x658e('0x39')]['create'](_0x384502[_0x658e('0x1e')],{'raw':_0x384502[_0x658e('0x13')]?_0x384502['options'][_0x658e('0x14')]===undefined?!![]:![]:!![],'transaction':_0x1a7dc4})[_0x658e('0x6')](function(){logger[_0x658e('0x7')](_0x658e('0x3a'),JSON['stringify'](_0x384502[_0x658e('0x13')][_0x658e('0x15')]),_0x384502[_0x658e('0x13')]['where']['active']);return db[_0x658e('0x11')][_0x658e('0x24')]({'where':_0x384502[_0x658e('0x13')]?_0x384502['options'][_0x658e('0x15')]||null:null,'transaction':_0x1a7dc4});});})[_0x658e('0x6')](function(_0x1d4031){logger[_0x658e('0x7')](_0x658e('0x36'),_0x384502);logger[_0x658e('0x9')](_0x658e('0x36'),_0x384502,JSON[_0x658e('0xb')](_0x1d4031));_0xf7b83e(_0x1d4031);})[_0x658e('0xf')](function(_0x56fce9){logger[_0x658e('0xc')](_0x658e('0x36'),_0x56fce9['message'],_0x384502);_0x7bc5c7(_0x33f783[_0x658e('0xc')](0x1f4,_0x56fce9['message']));});});};exports['CountReScheduled']=function(_0x35026c){var _0x9503e0=this;return new Promise(function(_0x4e4b88,_0x59806e){return db['CmHopper'][_0x658e('0x12')]({'raw':_0x35026c[_0x658e('0x13')]?_0x35026c[_0x658e('0x13')][_0x658e('0x14')]===undefined?!![]:![]:!![],'where':_0x35026c[_0x658e('0x13')]?_0x35026c[_0x658e('0x13')][_0x658e('0x15')]||null:null,'attributes':[[db[_0x658e('0x37')]['fn'](_0x658e('0x3b'),db['sequelize']['fn']('IF',db[_0x658e('0x37')][_0x658e('0x3c')](_0x658e('0x3d')+util['format'](_0x658e('0x3e'),moment()['format'](_0x658e('0x3f')))+'\x20,\x201,\x20null'))),_0x658e('0x40')]]})[_0x658e('0x6')](function(_0x2596a4){logger[_0x658e('0x7')](_0x658e('0x41'),_0x35026c);logger[_0x658e('0x9')](_0x658e('0x41'),_0x35026c,JSON['stringify'](_0x2596a4));_0x4e4b88(_0x2596a4);})['catch'](function(_0x498c78){logger[_0x658e('0xc')](_0x658e('0x41'),_0x498c78[_0x658e('0xe')],_0x35026c);_0x59806e(_0x9503e0['error'](0x1f4,_0x498c78[_0x658e('0xe')]));});});};exports[_0x658e('0x42')]=function(_0x267a0e){var _0x45f500=this;return new Promise(function(_0x5e6d14,_0x3621ef){return db['CmContact'][_0x658e('0x27')]()['then'](function(_0x4cc0be){return db[_0x658e('0x37')][_0x658e('0x38')](function(_0x3d39d5){return db['CmHopper'][_0x658e('0x12')]({'where':_0x267a0e['options']?_0x267a0e['options'][_0x658e('0x15')]||null:null,'attributes':_0x267a0e[_0x658e('0x13')]?_0x267a0e[_0x658e('0x13')]['attributes']||null:null,'limit':0x1,'order':_0x267a0e['options']?_0x267a0e['options']['order']||null:null,'group':db[_0x658e('0x11')][_0x658e('0x2f')],'transaction':_0x3d39d5,'lock':_0x3d39d5[_0x658e('0x29')][_0x658e('0x43')],'include':_0x267a0e[_0x658e('0x13')]?_0x267a0e['options'][_0x658e('0x16')]?_['map'](_0x267a0e['options'][_0x658e('0x16')],function(_0x34c89e){return{'model':db[_0x34c89e[_0x658e('0x18')]],'as':_0x34c89e['as'],'attributes':_0x34c89e[_0x658e('0x19')],'include':_0x34c89e[_0x658e('0x16')]?_[_0x658e('0x17')](_0x34c89e['include'],function(_0x25b2ac){return{'model':db[_0x25b2ac[_0x658e('0x18')]],'as':_0x25b2ac['as'],'attributes':_0x25b2ac[_0x658e('0x19')],'include':_0x25b2ac[_0x658e('0x16')]?_[_0x658e('0x17')](_0x25b2ac[_0x658e('0x16')],function(_0x564560){return{'model':db[_0x564560['model']],'as':_0x564560['as'],'attributes':_0x564560[_0x658e('0x19')]};}):[]};}):[]};}):[]:[]})[_0x658e('0x6')](function(_0x19dd6c){var _0x541a5e=[];for(var _0x16369d=0x0;_0x16369d<_0x19dd6c['length'];_0x16369d+=0x1){_0x541a5e[_0x658e('0x30')](_0x19dd6c[_0x16369d]['update'](_0x267a0e[_0x658e('0x1e')],{'transaction':_0x3d39d5}));}return BPromise[_0x658e('0x32')](_0x541a5e);});})[_0x658e('0x6')](function(_0x3011e1){logger[_0x658e('0x7')](_0x658e('0x42'),_0x267a0e);logger[_0x658e('0x9')](_0x658e('0x42'),_0x267a0e,JSON['stringify'](_0x3011e1));_0x5e6d14(_0x3011e1);})[_0x658e('0xf')](function(_0x4c6a02){logger[_0x658e('0xc')]('GetContactRecallMe',_0x4c6a02[_0x658e('0xe')],_0x267a0e);_0x3621ef(_0x45f500[_0x658e('0xc')](0x1f4,_0x4c6a02[_0x658e('0xe')]));});});});};exports[_0x658e('0x44')]=function(_0x43f583){var _0x1db9a3=this;return new Promise(function(_0x3e9ecf,_0x1228fb){db[_0x658e('0x26')][_0x658e('0x27')]()[_0x658e('0x6')](function(_0x108120){return db[_0x658e('0x11')][_0x658e('0x12')]({'raw':_0x43f583[_0x658e('0x13')]?_0x43f583[_0x658e('0x13')]['raw']===undefined?!![]:![]:!![],'where':_0x43f583[_0x658e('0x13')]?_0x43f583[_0x658e('0x13')][_0x658e('0x15')]||null:null,'attributes':_0x43f583['options']?_0x43f583['options'][_0x658e('0x19')]||null:null,'limit':_0x43f583[_0x658e('0x13')]?_0x43f583['options'][_0x658e('0x20')]||null:null,'include':_0x43f583[_0x658e('0x13')]?_0x43f583[_0x658e('0x13')][_0x658e('0x16')]?_[_0x658e('0x17')](_0x43f583[_0x658e('0x13')][_0x658e('0x16')],function(_0x1145a1){return{'model':db[_0x1145a1['model']],'as':_0x1145a1['as'],'attributes':_0x1145a1['as']===_0x658e('0x45')?_[_0x658e('0x2a')](_0x108120):_0x1145a1[_0x658e('0x19')],'include':_0x1145a1['include']?_[_0x658e('0x17')](_0x1145a1[_0x658e('0x16')],function(_0x5ee312){return{'model':db[_0x5ee312[_0x658e('0x18')]],'as':_0x5ee312['as'],'attributes':_0x5ee312[_0x658e('0x19')],'include':_0x5ee312[_0x658e('0x16')]?_[_0x658e('0x17')](_0x5ee312[_0x658e('0x16')],function(_0x4a1616){return{'model':db[_0x4a1616[_0x658e('0x18')]],'as':_0x4a1616['as'],'attributes':_0x4a1616[_0x658e('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x17084b){logger[_0x658e('0x7')]('GetCmHopper',_0x43f583);logger[_0x658e('0x9')](_0x658e('0x10'),_0x43f583,JSON['stringify'](_0x17084b));_0x3e9ecf(_0x17084b);})[_0x658e('0xf')](function(_0x31e41c){logger[_0x658e('0xc')](_0x658e('0x10'),_0x31e41c[_0x658e('0xe')],_0x43f583);_0x1228fb(_0x1db9a3[_0x658e('0xc')](0x1f4,_0x31e41c[_0x658e('0xe')]));});});});};exports[_0x658e('0x46')]=function(_0x1b9365){var _0x4819e9=this;return new Promise(function(_0x545408,_0x288052){return db[_0x658e('0x26')][_0x658e('0x47')]({'raw':!![],'where':{'phone':_0x1b9365[_0x658e('0x13')][_0x658e('0x15')][_0x658e('0x48')]},'attributes':['id','dialTimezone'],'order':[['id',_0x658e('0x49')]]})['then'](function(_0x29c7c4){logger[_0x658e('0x7')]('getContactByPhone',_0x1b9365);logger['debug']('getContactByPhone',_0x1b9365,JSON[_0x658e('0xb')](_0x29c7c4));_0x545408(_0x29c7c4);})['catch'](function(_0x439373){logger[_0x658e('0xc')](_0x658e('0x4a'),_0x439373['message'],_0x1b9365);_0x288052(_0x4819e9[_0x658e('0xc')](0x1f4,_0x439373[_0x658e('0xe')]));});});};exports[_0x658e('0x4b')]=function(_0x3ae9b8){var _0x4849a0=this;return new Promise(function(_0x578a86,_0x1bae9c){return db[_0x658e('0x37')][_0x658e('0x38')](function(_0x2706b1){return db[_0x658e('0x11')][_0x658e('0x31')]({'active':![]},{'where':{},'transaction':_0x2706b1})['then'](function(_0x2bc216){logger[_0x658e('0x7')](_0x658e('0x4b'),_0x3ae9b8);logger[_0x658e('0x9')](_0x658e('0x4b'),_0x3ae9b8,JSON[_0x658e('0xb')](_0x2bc216));_0x578a86(_0x2bc216);})[_0x658e('0xf')](function(_0x56dd6b){logger[_0x658e('0xc')](_0x658e('0x4b'),_0x56dd6b[_0x658e('0xe')],_0x3ae9b8);_0x1bae9c(_0x4849a0[_0x658e('0xc')](0x1f4,_0x56dd6b[_0x658e('0xe')]));});});});};exports[_0x658e('0x4c')]=function(_0x5d2c34){var _0x3ec1f9=this;var _0x427519=_0x5d2c34[_0x658e('0x1e')][_0x658e('0x15')]['voiceQueueId'];var _0x21a266=_0x5d2c34[_0x658e('0x1e')][_0x658e('0x15')]['interval'];return new Promise(function(_0x15a1bd,_0x242533){return db['CmHopper']['findAll']({'logging':!![],'where':{'voiceQueueId':_0x427519,'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$and':{'$lte':db[_0x658e('0x37')][_0x658e('0x3c')](_0x658e('0x4d')+_0x21a266+'\x20MINUTE'),'$gt':db['sequelize'][_0x658e('0x3c')]('NOW()')}}},'include':[{'model':db[_0x658e('0x26')],'as':_0x658e('0x45')},{'model':db[_0x658e('0x4e')],'as':_0x658e('0x2b'),'attributes':['id',_0x658e('0x2c'),'voicePause']},{'model':db[_0x658e('0x4f')],'as':_0x658e('0x50')}]})['then'](function(_0x28212e){console[_0x658e('0x51')](_0x28212e);return db['sequelize']['transaction'](function(_0x845485){return BPromise['all'](_0x28212e[_0x658e('0x17')](function(_0x4c8552){_0x4c8552[_0x658e('0x31')]({'recallmeNotifiedDate':db['sequelize'][_0x658e('0x3c')](_0x658e('0x52'))},{'transaction':_0x845485,'logging':!![]});}))['then'](function(_0x1ae2ea){console['log'](_0x1ae2ea);_0x15a1bd(_0x28212e);})[_0x658e('0xf')](function(_0x1066db){logger[_0x658e('0xc')](_0x658e('0x4c'),_0x1066db[_0x658e('0xe')],_0x5d2c34);_0x242533(_0x3ec1f9[_0x658e('0xc')](0x1f4,_0x1066db[_0x658e('0xe')]));});})[_0x658e('0xf')](function(_0x2c0ac2){logger['error'](_0x658e('0x4c'),_0x2c0ac2[_0x658e('0xe')],_0x5d2c34);_0x242533(_0x3ec1f9[_0x658e('0xc')](0x1f4,_0x2c0ac2['message']));});});});}; \ No newline at end of file diff --git a/server/api/cmHopper/index.js b/server/api/cmHopper/index.js index 4cc2eca..9bb031c 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 _0x8535=['getPreview','/timezone','put','update','delete','destroy','exports','express','Router','../../components/auth/service','./cmHopper.controller','isAuthenticated','index','/describe','describe','get','/opencontacts','getOpenContacts','/timezones','getTimezones','/:id','show','/:id/previewrecall','getPreviewRecall','post'];(function(_0x1bd17d,_0x20b6ff){var _0xf0345e=function(_0x235e01){while(--_0x235e01){_0x1bd17d['push'](_0x1bd17d['shift']());}};_0xf0345e(++_0x20b6ff);}(_0x8535,0x1c9));var _0x5853=function(_0x1186bd,_0x450893){_0x1186bd=_0x1186bd-0x0;var _0x2cdd91=_0x8535[_0x1186bd];return _0x2cdd91;};'use strict';var express=require(_0x5853('0x0'));var router=express[_0x5853('0x1')]();var auth=require(_0x5853('0x2'));var controller=require(_0x5853('0x3'));router['get']('/',auth[_0x5853('0x4')](),controller[_0x5853('0x5')]);router['get'](_0x5853('0x6'),auth[_0x5853('0x4')](),controller[_0x5853('0x7')]);router[_0x5853('0x8')](_0x5853('0x9'),auth['isAuthenticated'](),controller[_0x5853('0xa')]);router[_0x5853('0x8')](_0x5853('0xb'),auth[_0x5853('0x4')](),controller[_0x5853('0xc')]);router[_0x5853('0x8')](_0x5853('0xd'),auth[_0x5853('0x4')](),controller[_0x5853('0xe')]);router['get'](_0x5853('0xf'),auth[_0x5853('0x4')](),controller[_0x5853('0x10')]);router[_0x5853('0x11')]('/',auth[_0x5853('0x4')](),controller['create']);router[_0x5853('0x11')]('/preview',auth[_0x5853('0x4')](),controller[_0x5853('0x12')]);router[_0x5853('0x11')](_0x5853('0x13'),auth[_0x5853('0x4')](),controller['getTimezone']);router[_0x5853('0x14')](_0x5853('0xd'),auth['isAuthenticated'](),controller[_0x5853('0x15')]);router[_0x5853('0x16')](_0x5853('0xd'),auth[_0x5853('0x4')](),controller[_0x5853('0x17')]);module[_0x5853('0x18')]=router; \ No newline at end of file +var _0x4878=['show','/:id/previewrecall','getPreviewRecall','create','/preview','getPreview','getTimezone','update','delete','destroy','Router','../../components/auth/service','./cmHopper.controller','isAuthenticated','index','get','/describe','describe','/opencontacts','/timezones','getTimezones','/:id'];(function(_0x478481,_0x52705e){var _0x2e1674=function(_0x4f909e){while(--_0x4f909e){_0x478481['push'](_0x478481['shift']());}};_0x2e1674(++_0x52705e);}(_0x4878,0xa4));var _0x8487=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x4878[_0x17d9e3];return _0x14192d;};'use strict';var express=require('express');var router=express[_0x8487('0x0')]();var auth=require(_0x8487('0x1'));var controller=require(_0x8487('0x2'));router['get']('/',auth[_0x8487('0x3')](),controller[_0x8487('0x4')]);router[_0x8487('0x5')](_0x8487('0x6'),auth[_0x8487('0x3')](),controller[_0x8487('0x7')]);router[_0x8487('0x5')](_0x8487('0x8'),auth['isAuthenticated'](),controller['getOpenContacts']);router[_0x8487('0x5')](_0x8487('0x9'),auth[_0x8487('0x3')](),controller[_0x8487('0xa')]);router[_0x8487('0x5')](_0x8487('0xb'),auth[_0x8487('0x3')](),controller[_0x8487('0xc')]);router[_0x8487('0x5')](_0x8487('0xd'),auth[_0x8487('0x3')](),controller[_0x8487('0xe')]);router['post']('/',auth[_0x8487('0x3')](),controller[_0x8487('0xf')]);router['post'](_0x8487('0x10'),auth[_0x8487('0x3')](),controller[_0x8487('0x11')]);router['post']('/timezone',auth[_0x8487('0x3')](),controller[_0x8487('0x12')]);router['put'](_0x8487('0xb'),auth[_0x8487('0x3')](),controller[_0x8487('0x13')]);router[_0x8487('0x14')](_0x8487('0xb'),auth[_0x8487('0x3')](),controller[_0x8487('0x15')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.attributes.js b/server/api/cmHopperBlack/cmHopperBlack.attributes.js index 84192b7..58a474a 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 _0x0699=['INTEGER','moment','sequelize','exports','STRING','contactListQueue'];(function(_0x3e70be,_0x165e2a){var _0x1a997e=function(_0x186e3e){while(--_0x186e3e){_0x3e70be['push'](_0x3e70be['shift']());}};_0x1a997e(++_0x165e2a);}(_0x0699,0x181));var _0x9069=function(_0x5898df,_0x21a57e){_0x5898df=_0x5898df-0x0;var _0x2e1630=_0x0699[_0x5898df];return _0x2e1630;};'use strict';var moment=require(_0x9069('0x0'));var Sequelize=require(_0x9069('0x1'));module[_0x9069('0x2')]={'phone':{'type':Sequelize[_0x9069('0x3')],'allowNull':![]},'ContactId':{'type':Sequelize['INTEGER'],'unique':_0x9069('0x4')},'ListId':{'type':Sequelize[_0x9069('0x5')],'unique':'contactListQueue'},'VoiceQueueId':{'type':Sequelize[_0x9069('0x5')],'unique':_0x9069('0x4')}}; \ No newline at end of file +var _0xed08=['STRING','INTEGER','contactListQueue','sequelize','exports'];(function(_0xf913b3,_0x23f46a){var _0x288876=function(_0x5d35fb){while(--_0x5d35fb){_0xf913b3['push'](_0xf913b3['shift']());}};_0x288876(++_0x23f46a);}(_0xed08,0x67));var _0x8ed0=function(_0x442fc6,_0x1e9553){_0x442fc6=_0x442fc6-0x0;var _0x4185a8=_0xed08[_0x442fc6];return _0x4185a8;};'use strict';var moment=require('moment');var Sequelize=require(_0x8ed0('0x0'));module[_0x8ed0('0x1')]={'phone':{'type':Sequelize[_0x8ed0('0x2')],'allowNull':![]},'ContactId':{'type':Sequelize[_0x8ed0('0x3')],'unique':_0x8ed0('0x4')},'ListId':{'type':Sequelize[_0x8ed0('0x3')],'unique':_0x8ed0('0x4')},'VoiceQueueId':{'type':Sequelize[_0x8ed0('0x3')],'unique':_0x8ed0('0x4')}}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.controller.js b/server/api/cmHopperBlack/cmHopperBlack.controller.js index b5a68ad..c80e829 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 _0xe2e9=['squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','limit','undefined','count','offset','Content-Range','apply','reject','save','update','then','error','stack','name','send','map','CmHopperBlack','rawAttributes','fieldName','type','key','model','keys','filters','query','intersection','fields','attributes','length','nolimit','sort','where','pick','filter','merge','VIRTUAL','includeAll','findAll','rows','show','params','include','find','catch','body','destroy','describe','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','fs-extra'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xe2e9,0x167));var _0x9e2e=function(_0x4cc85f,_0x335b29){_0x4cc85f=_0x4cc85f-0x0;var _0x4560de=_0xe2e9[_0x4cc85f];return _0x4560de;};'use strict';var emlformat=require(_0x9e2e('0x0'));var rimraf=require(_0x9e2e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9e2e('0x2'));var rp=require(_0x9e2e('0x3'));var moment=require('moment');var BPromise=require(_0x9e2e('0x4'));var Mustache=require(_0x9e2e('0x5'));var util=require(_0x9e2e('0x6'));var path=require(_0x9e2e('0x7'));var sox=require(_0x9e2e('0x8'));var csv=require('to-csv');var ejs=require(_0x9e2e('0x9'));var fs=require('fs');var fs_extra=require(_0x9e2e('0xa'));var _=require('lodash');var squel=require(_0x9e2e('0xb'));var crypto=require(_0x9e2e('0xc'));var jsforce=require(_0x9e2e('0xd'));var deskjs=require(_0x9e2e('0xe'));var toCsv=require(_0x9e2e('0xf'));var querystring=require(_0x9e2e('0x10'));var Papa=require(_0x9e2e('0x11'));var Redis=require(_0x9e2e('0x12'));var authService=require(_0x9e2e('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9e2e('0x14'));var logger=require('../../config/logger')(_0x9e2e('0x15'));var utils=require(_0x9e2e('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x9e2e('0x17'));var db=require(_0x9e2e('0x18'))['db'];function respondWithStatusCode(_0x1b903c,_0x201975){_0x201975=_0x201975||0xcc;return function(_0x4ba548){if(_0x4ba548){return _0x1b903c[_0x9e2e('0x19')](_0x201975);}return _0x1b903c[_0x9e2e('0x1a')](_0x201975)[_0x9e2e('0x1b')]();};}function respondWithResult(_0x2c19da,_0x331b6e){_0x331b6e=_0x331b6e||0xc8;return function(_0x36039c){if(_0x36039c){return _0x2c19da[_0x9e2e('0x1a')](_0x331b6e)['json'](_0x36039c);}};}function respondWithFilteredResult(_0x17a634,_0x179520){return function(_0x5a2b1c){if(_0x5a2b1c){var _0x37e7ee=typeof _0x179520['offset']==='undefined'&&typeof _0x179520[_0x9e2e('0x1c')]===_0x9e2e('0x1d');var _0x4704bb=_0x5a2b1c[_0x9e2e('0x1e')];var _0xa6ea4d=_0x37e7ee?0x0:_0x179520['offset'];var _0x15e69f=_0x37e7ee?_0x5a2b1c[_0x9e2e('0x1e')]:_0x179520[_0x9e2e('0x1f')]+_0x179520[_0x9e2e('0x1c')];var _0x483701;if(_0x15e69f>=_0x4704bb){_0x15e69f=_0x4704bb;_0x483701=0xc8;}else{_0x483701=0xce;}_0x17a634[_0x9e2e('0x1a')](_0x483701);return _0x17a634['set'](_0x9e2e('0x20'),_0xa6ea4d+'-'+_0x15e69f+'/'+_0x4704bb)['json'](_0x5a2b1c);}return null;};}function patchUpdates(_0x32ebc6){return function(_0x3e5df7){try{jsonpatch[_0x9e2e('0x21')](_0x3e5df7,_0x32ebc6,!![]);}catch(_0x185ebd){return BPromise[_0x9e2e('0x22')](_0x185ebd);}return _0x3e5df7[_0x9e2e('0x23')]();};}function saveUpdates(_0x5dcd77,_0x8d2a4e){return function(_0x5029e5){if(_0x5029e5){return _0x5029e5[_0x9e2e('0x24')](_0x5dcd77)[_0x9e2e('0x25')](function(_0xa9b1ad){return _0xa9b1ad;});}return null;};}function removeEntity(_0x2ebcc0,_0x2fe531){return function(_0x2f7679){if(_0x2f7679){return _0x2f7679['destroy']()[_0x9e2e('0x25')](function(){_0x2ebcc0[_0x9e2e('0x1a')](0xcc)[_0x9e2e('0x1b')]();});}};}function handleEntityNotFound(_0x1b86a7,_0x35140b){return function(_0x27a427){if(!_0x27a427){_0x1b86a7[_0x9e2e('0x19')](0x194);}return _0x27a427;};}function handleError(_0x3d8f68,_0x2e9f45){_0x2e9f45=_0x2e9f45||0x1f4;return function(_0x230539){logger[_0x9e2e('0x26')](_0x230539[_0x9e2e('0x27')]);if(_0x230539['name']){delete _0x230539[_0x9e2e('0x28')];}_0x3d8f68[_0x9e2e('0x1a')](_0x2e9f45)[_0x9e2e('0x29')](_0x230539);};}exports['index']=function(_0x17ce4e,_0x40e278){var _0x2acb3e={},_0x425020={},_0x40de04={'count':0x0,'rows':[]};var _0x1bb4cd=_[_0x9e2e('0x2a')](db[_0x9e2e('0x2b')][_0x9e2e('0x2c')],function(_0xcc12bf){return{'name':_0xcc12bf[_0x9e2e('0x2d')],'type':_0xcc12bf[_0x9e2e('0x2e')][_0x9e2e('0x2f')]};});_0x425020[_0x9e2e('0x30')]=_[_0x9e2e('0x2a')](_0x1bb4cd,_0x9e2e('0x28'));_0x425020['query']=_[_0x9e2e('0x31')](_0x17ce4e['query']);_0x425020[_0x9e2e('0x32')]=_['intersection'](_0x425020['model'],_0x425020[_0x9e2e('0x33')]);_0x2acb3e['attributes']=_[_0x9e2e('0x34')](_0x425020[_0x9e2e('0x30')],qs[_0x9e2e('0x35')](_0x17ce4e[_0x9e2e('0x33')][_0x9e2e('0x35')]));_0x2acb3e['attributes']=_0x2acb3e[_0x9e2e('0x36')][_0x9e2e('0x37')]?_0x2acb3e[_0x9e2e('0x36')]:_0x425020[_0x9e2e('0x30')];if(!_0x17ce4e[_0x9e2e('0x33')]['hasOwnProperty'](_0x9e2e('0x38'))){_0x2acb3e[_0x9e2e('0x1c')]=qs['limit'](_0x17ce4e['query'][_0x9e2e('0x1c')]);_0x2acb3e[_0x9e2e('0x1f')]=qs[_0x9e2e('0x1f')](_0x17ce4e['query'][_0x9e2e('0x1f')]);}_0x2acb3e['order']=qs[_0x9e2e('0x39')](_0x17ce4e[_0x9e2e('0x33')][_0x9e2e('0x39')]);_0x2acb3e[_0x9e2e('0x3a')]=qs[_0x9e2e('0x32')](_[_0x9e2e('0x3b')](_0x17ce4e[_0x9e2e('0x33')],_0x425020[_0x9e2e('0x32')]),_0x1bb4cd);if(_0x17ce4e['query'][_0x9e2e('0x3c')]){_0x2acb3e[_0x9e2e('0x3a')]=_[_0x9e2e('0x3d')](_0x2acb3e[_0x9e2e('0x3a')],{'$or':_[_0x9e2e('0x2a')](_0x1bb4cd,function(_0x3fb04f){if(_0x3fb04f[_0x9e2e('0x2e')]!==_0x9e2e('0x3e')){var _0x4bb7eb={};_0x4bb7eb[_0x3fb04f[_0x9e2e('0x28')]]={'$like':'%'+_0x17ce4e[_0x9e2e('0x33')][_0x9e2e('0x3c')]+'%'};return _0x4bb7eb;}})});}_0x2acb3e=_[_0x9e2e('0x3d')]({},_0x2acb3e,_0x17ce4e['options']);var _0x3072e3={'where':_0x2acb3e[_0x9e2e('0x3a')]};return db['CmHopperBlack'][_0x9e2e('0x1e')](_0x3072e3)[_0x9e2e('0x25')](function(_0x2e77f7){_0x40de04[_0x9e2e('0x1e')]=_0x2e77f7;if(_0x17ce4e[_0x9e2e('0x33')][_0x9e2e('0x3f')]){_0x2acb3e['include']=[{'all':!![]}];}return db[_0x9e2e('0x2b')][_0x9e2e('0x40')](_0x2acb3e);})[_0x9e2e('0x25')](function(_0x16888e){_0x40de04[_0x9e2e('0x41')]=_0x16888e;return _0x40de04;})['then'](respondWithFilteredResult(_0x40e278,_0x2acb3e))['catch'](handleError(_0x40e278,null));};exports[_0x9e2e('0x42')]=function(_0x478d7d,_0x10ce6b){var _0x4fc0f0={'raw':!![],'where':{'id':_0x478d7d[_0x9e2e('0x43')]['id']}},_0x4594a7={};_0x4594a7[_0x9e2e('0x30')]=_[_0x9e2e('0x31')](db[_0x9e2e('0x2b')][_0x9e2e('0x2c')]);_0x4594a7[_0x9e2e('0x33')]=_[_0x9e2e('0x31')](_0x478d7d[_0x9e2e('0x33')]);_0x4594a7[_0x9e2e('0x32')]=_[_0x9e2e('0x34')](_0x4594a7['model'],_0x4594a7[_0x9e2e('0x33')]);_0x4fc0f0[_0x9e2e('0x36')]=_['intersection'](_0x4594a7['model'],qs[_0x9e2e('0x35')](_0x478d7d[_0x9e2e('0x33')][_0x9e2e('0x35')]));_0x4fc0f0[_0x9e2e('0x36')]=_0x4fc0f0[_0x9e2e('0x36')][_0x9e2e('0x37')]?_0x4fc0f0['attributes']:_0x4594a7[_0x9e2e('0x30')];if(_0x478d7d[_0x9e2e('0x33')][_0x9e2e('0x3f')]){_0x4fc0f0[_0x9e2e('0x44')]=[{'all':!![]}];}_0x4fc0f0=_[_0x9e2e('0x3d')]({},_0x4fc0f0,_0x478d7d['options']);return db['CmHopperBlack'][_0x9e2e('0x45')](_0x4fc0f0)['then'](handleEntityNotFound(_0x10ce6b,null))[_0x9e2e('0x25')](respondWithResult(_0x10ce6b,null))[_0x9e2e('0x46')](handleError(_0x10ce6b,null));};exports[_0x9e2e('0x24')]=function(_0x30a92c,_0x991fdb){if(_0x30a92c[_0x9e2e('0x47')]['id']){delete _0x30a92c[_0x9e2e('0x47')]['id'];}return db[_0x9e2e('0x2b')][_0x9e2e('0x45')]({'where':{'id':_0x30a92c['params']['id']}})[_0x9e2e('0x25')](handleEntityNotFound(_0x991fdb,null))[_0x9e2e('0x25')](saveUpdates(_0x30a92c[_0x9e2e('0x47')],null))[_0x9e2e('0x25')](respondWithResult(_0x991fdb,null))['catch'](handleError(_0x991fdb,null));};exports[_0x9e2e('0x48')]=function(_0x13a5a7,_0x51fade){return db[_0x9e2e('0x2b')][_0x9e2e('0x45')]({'where':{'id':_0x13a5a7[_0x9e2e('0x43')]['id']}})[_0x9e2e('0x25')](handleEntityNotFound(_0x51fade,null))[_0x9e2e('0x25')](removeEntity(_0x51fade,null))[_0x9e2e('0x46')](handleError(_0x51fade,null));};exports['describe']=function(_0x9baa67,_0x2d1727){return db['CmHopperBlack'][_0x9e2e('0x49')]()[_0x9e2e('0x25')](respondWithResult(_0x2d1727,null))[_0x9e2e('0x46')](handleError(_0x2d1727,null));}; \ No newline at end of file +var _0x1a4a=['query','filters','intersection','attributes','fields','length','limit','where','pick','filter','VIRTUAL','options','include','findAll','rows','catch','show','params','keys','includeAll','merge','find','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','CmHopperBlack','rawAttributes','type','key','model'];(function(_0x5c5abc,_0x5ae71a){var _0x3de931=function(_0x5792b2){while(--_0x5792b2){_0x5c5abc['push'](_0x5c5abc['shift']());}};_0x3de931(++_0x5ae71a);}(_0x1a4a,0xae));var _0xa1a4=function(_0x2532a5,_0x34a44a){_0x2532a5=_0x2532a5-0x0;var _0x451e10=_0x1a4a[_0x2532a5];return _0x451e10;};'use strict';var emlformat=require(_0xa1a4('0x0'));var rimraf=require(_0xa1a4('0x1'));var zipdir=require(_0xa1a4('0x2'));var jsonpatch=require(_0xa1a4('0x3'));var rp=require(_0xa1a4('0x4'));var moment=require(_0xa1a4('0x5'));var BPromise=require(_0xa1a4('0x6'));var Mustache=require(_0xa1a4('0x7'));var util=require(_0xa1a4('0x8'));var path=require(_0xa1a4('0x9'));var sox=require(_0xa1a4('0xa'));var csv=require(_0xa1a4('0xb'));var ejs=require(_0xa1a4('0xc'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xa1a4('0xd'));var squel=require(_0xa1a4('0xe'));var crypto=require(_0xa1a4('0xf'));var jsforce=require(_0xa1a4('0x10'));var deskjs=require(_0xa1a4('0x11'));var toCsv=require(_0xa1a4('0xb'));var querystring=require(_0xa1a4('0x12'));var Papa=require(_0xa1a4('0x13'));var Redis=require(_0xa1a4('0x14'));var authService=require(_0xa1a4('0x15'));var qs=require(_0xa1a4('0x16'));var as=require(_0xa1a4('0x17'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0xa1a4('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xa1a4('0x19'))['db'];function respondWithStatusCode(_0xe359f4,_0xea77f){_0xea77f=_0xea77f||0xcc;return function(_0x17f768){if(_0x17f768){return _0xe359f4[_0xa1a4('0x1a')](_0xea77f);}return _0xe359f4[_0xa1a4('0x1b')](_0xea77f)[_0xa1a4('0x1c')]();};}function respondWithResult(_0x2751fc,_0x130174){_0x130174=_0x130174||0xc8;return function(_0x16c14d){if(_0x16c14d){return _0x2751fc[_0xa1a4('0x1b')](_0x130174)[_0xa1a4('0x1d')](_0x16c14d);}};}function respondWithFilteredResult(_0x3e8c06,_0x5ad88){return function(_0x162f41){if(_0x162f41){var _0x42d6c4=typeof _0x5ad88[_0xa1a4('0x1e')]===_0xa1a4('0x1f')&&typeof _0x5ad88['limit']===_0xa1a4('0x1f');var _0x251554=_0x162f41[_0xa1a4('0x20')];var _0x19ba43=_0x42d6c4?0x0:_0x5ad88[_0xa1a4('0x1e')];var _0x1b7a0c=_0x42d6c4?_0x162f41[_0xa1a4('0x20')]:_0x5ad88[_0xa1a4('0x1e')]+_0x5ad88['limit'];var _0x53a87f;if(_0x1b7a0c>=_0x251554){_0x1b7a0c=_0x251554;_0x53a87f=0xc8;}else{_0x53a87f=0xce;}_0x3e8c06[_0xa1a4('0x1b')](_0x53a87f);return _0x3e8c06['set'](_0xa1a4('0x21'),_0x19ba43+'-'+_0x1b7a0c+'/'+_0x251554)['json'](_0x162f41);}return null;};}function patchUpdates(_0x5cf5c1){return function(_0x5eef6f){try{jsonpatch[_0xa1a4('0x22')](_0x5eef6f,_0x5cf5c1,!![]);}catch(_0x5235a9){return BPromise[_0xa1a4('0x23')](_0x5235a9);}return _0x5eef6f[_0xa1a4('0x24')]();};}function saveUpdates(_0x36f281,_0x21e64f){return function(_0x4c50ea){if(_0x4c50ea){return _0x4c50ea[_0xa1a4('0x25')](_0x36f281)[_0xa1a4('0x26')](function(_0x2b160e){return _0x2b160e;});}return null;};}function removeEntity(_0x599091,_0x3c2dfc){return function(_0x76b288){if(_0x76b288){return _0x76b288[_0xa1a4('0x27')]()[_0xa1a4('0x26')](function(){_0x599091['status'](0xcc)[_0xa1a4('0x1c')]();});}};}function handleEntityNotFound(_0x454576,_0x53435d){return function(_0x1d55d4){if(!_0x1d55d4){_0x454576[_0xa1a4('0x1a')](0x194);}return _0x1d55d4;};}function handleError(_0x2a6e16,_0x53e5d9){_0x53e5d9=_0x53e5d9||0x1f4;return function(_0x2fd66f){logger[_0xa1a4('0x28')](_0x2fd66f[_0xa1a4('0x29')]);if(_0x2fd66f[_0xa1a4('0x2a')]){delete _0x2fd66f[_0xa1a4('0x2a')];}_0x2a6e16[_0xa1a4('0x1b')](_0x53e5d9)[_0xa1a4('0x2b')](_0x2fd66f);};}exports[_0xa1a4('0x2c')]=function(_0x17b179,_0x22d8e7){var _0x5432fb={},_0x34765d={},_0x525810={'count':0x0,'rows':[]};var _0x14c8b0=_[_0xa1a4('0x2d')](db[_0xa1a4('0x2e')][_0xa1a4('0x2f')],function(_0x5869e7){return{'name':_0x5869e7['fieldName'],'type':_0x5869e7[_0xa1a4('0x30')][_0xa1a4('0x31')]};});_0x34765d[_0xa1a4('0x32')]=_['map'](_0x14c8b0,_0xa1a4('0x2a'));_0x34765d[_0xa1a4('0x33')]=_['keys'](_0x17b179[_0xa1a4('0x33')]);_0x34765d[_0xa1a4('0x34')]=_[_0xa1a4('0x35')](_0x34765d[_0xa1a4('0x32')],_0x34765d[_0xa1a4('0x33')]);_0x5432fb[_0xa1a4('0x36')]=_[_0xa1a4('0x35')](_0x34765d['model'],qs[_0xa1a4('0x37')](_0x17b179[_0xa1a4('0x33')][_0xa1a4('0x37')]));_0x5432fb['attributes']=_0x5432fb[_0xa1a4('0x36')][_0xa1a4('0x38')]?_0x5432fb[_0xa1a4('0x36')]:_0x34765d['model'];if(!_0x17b179[_0xa1a4('0x33')]['hasOwnProperty']('nolimit')){_0x5432fb[_0xa1a4('0x39')]=qs[_0xa1a4('0x39')](_0x17b179['query'][_0xa1a4('0x39')]);_0x5432fb[_0xa1a4('0x1e')]=qs[_0xa1a4('0x1e')](_0x17b179[_0xa1a4('0x33')]['offset']);}_0x5432fb['order']=qs['sort'](_0x17b179[_0xa1a4('0x33')]['sort']);_0x5432fb[_0xa1a4('0x3a')]=qs[_0xa1a4('0x34')](_[_0xa1a4('0x3b')](_0x17b179[_0xa1a4('0x33')],_0x34765d[_0xa1a4('0x34')]),_0x14c8b0);if(_0x17b179[_0xa1a4('0x33')][_0xa1a4('0x3c')]){_0x5432fb[_0xa1a4('0x3a')]=_['merge'](_0x5432fb[_0xa1a4('0x3a')],{'$or':_[_0xa1a4('0x2d')](_0x14c8b0,function(_0x3e551a){if(_0x3e551a['type']!==_0xa1a4('0x3d')){var _0xed30db={};_0xed30db[_0x3e551a['name']]={'$like':'%'+_0x17b179[_0xa1a4('0x33')]['filter']+'%'};return _0xed30db;}})});}_0x5432fb=_['merge']({},_0x5432fb,_0x17b179[_0xa1a4('0x3e')]);var _0x3dc047={'where':_0x5432fb[_0xa1a4('0x3a')]};return db[_0xa1a4('0x2e')][_0xa1a4('0x20')](_0x3dc047)['then'](function(_0x201861){_0x525810[_0xa1a4('0x20')]=_0x201861;if(_0x17b179[_0xa1a4('0x33')]['includeAll']){_0x5432fb[_0xa1a4('0x3f')]=[{'all':!![]}];}return db[_0xa1a4('0x2e')][_0xa1a4('0x40')](_0x5432fb);})['then'](function(_0x24ab66){_0x525810[_0xa1a4('0x41')]=_0x24ab66;return _0x525810;})['then'](respondWithFilteredResult(_0x22d8e7,_0x5432fb))[_0xa1a4('0x42')](handleError(_0x22d8e7,null));};exports[_0xa1a4('0x43')]=function(_0x5eecfd,_0xbbe207){var _0x49bbf5={'raw':!![],'where':{'id':_0x5eecfd[_0xa1a4('0x44')]['id']}},_0x34691b={};_0x34691b[_0xa1a4('0x32')]=_[_0xa1a4('0x45')](db['CmHopperBlack'][_0xa1a4('0x2f')]);_0x34691b[_0xa1a4('0x33')]=_[_0xa1a4('0x45')](_0x5eecfd['query']);_0x34691b[_0xa1a4('0x34')]=_['intersection'](_0x34691b[_0xa1a4('0x32')],_0x34691b['query']);_0x49bbf5['attributes']=_['intersection'](_0x34691b['model'],qs[_0xa1a4('0x37')](_0x5eecfd['query']['fields']));_0x49bbf5[_0xa1a4('0x36')]=_0x49bbf5[_0xa1a4('0x36')][_0xa1a4('0x38')]?_0x49bbf5['attributes']:_0x34691b[_0xa1a4('0x32')];if(_0x5eecfd[_0xa1a4('0x33')][_0xa1a4('0x46')]){_0x49bbf5['include']=[{'all':!![]}];}_0x49bbf5=_[_0xa1a4('0x47')]({},_0x49bbf5,_0x5eecfd[_0xa1a4('0x3e')]);return db[_0xa1a4('0x2e')][_0xa1a4('0x48')](_0x49bbf5)['then'](handleEntityNotFound(_0xbbe207,null))[_0xa1a4('0x26')](respondWithResult(_0xbbe207,null))[_0xa1a4('0x42')](handleError(_0xbbe207,null));};exports[_0xa1a4('0x25')]=function(_0x5cfd7b,_0x551074){if(_0x5cfd7b['body']['id']){delete _0x5cfd7b['body']['id'];}return db[_0xa1a4('0x2e')][_0xa1a4('0x48')]({'where':{'id':_0x5cfd7b[_0xa1a4('0x44')]['id']}})['then'](handleEntityNotFound(_0x551074,null))[_0xa1a4('0x26')](saveUpdates(_0x5cfd7b[_0xa1a4('0x49')],null))[_0xa1a4('0x26')](respondWithResult(_0x551074,null))[_0xa1a4('0x42')](handleError(_0x551074,null));};exports[_0xa1a4('0x27')]=function(_0x382d37,_0x1b99dc){return db[_0xa1a4('0x2e')][_0xa1a4('0x48')]({'where':{'id':_0x382d37[_0xa1a4('0x44')]['id']}})[_0xa1a4('0x26')](handleEntityNotFound(_0x1b99dc,null))[_0xa1a4('0x26')](removeEntity(_0x1b99dc,null))['catch'](handleError(_0x1b99dc,null));};exports[_0xa1a4('0x4a')]=function(_0x150cfb,_0x1b2b9b){return db[_0xa1a4('0x2e')]['describe']()['then'](respondWithResult(_0x1b2b9b,null))[_0xa1a4('0x42')](handleError(_0x1b2b9b,null));}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.model.js b/server/api/cmHopperBlack/cmHopperBlack.model.js index b453ea8..3439f59 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 _0x18b0=['exports','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmHopperBlack.attributes'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x18b0,0x1ed));var _0x018b=function(_0x14eaca,_0x5c2719){_0x14eaca=_0x14eaca-0x0;var _0x270dfd=_0x18b0[_0x14eaca];return _0x270dfd;};'use strict';var _=require(_0x018b('0x0'));var util=require(_0x018b('0x1'));var logger=require(_0x018b('0x2'))(_0x018b('0x3'));var moment=require(_0x018b('0x4'));var BPromise=require(_0x018b('0x5'));var rp=require(_0x018b('0x6'));var fs=require('fs');var path=require(_0x018b('0x7'));var rimraf=require(_0x018b('0x8'));var config=require(_0x018b('0x9'));var attributes=require(_0x018b('0xa'));module[_0x018b('0xb')]=function(_0x57a53,_0x1c09af){return _0x57a53['define']('CmHopperBlack',attributes,{'tableName':'cm_hopper_black','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0eab=['CmHopperBlack','cm_hopper_black','lodash','../../config/logger','api','path','rimraf','../../config/environment','./cmHopperBlack.attributes','exports','define'];(function(_0x28127e,_0x28a8d6){var _0x3a36ee=function(_0x58d46f){while(--_0x58d46f){_0x28127e['push'](_0x28127e['shift']());}};_0x3a36ee(++_0x28a8d6);}(_0x0eab,0x1af));var _0xb0ea=function(_0xf7f1ab,_0x65b6cb){_0xf7f1ab=_0xf7f1ab-0x0;var _0x391bf0=_0x0eab[_0xf7f1ab];return _0x391bf0;};'use strict';var _=require(_0xb0ea('0x0'));var util=require('util');var logger=require(_0xb0ea('0x1'))(_0xb0ea('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xb0ea('0x3'));var rimraf=require(_0xb0ea('0x4'));var config=require(_0xb0ea('0x5'));var attributes=require(_0xb0ea('0x6'));module[_0xb0ea('0x7')]=function(_0x11ed12,_0x4e758f){return _0x11ed12[_0xb0ea('0x8')](_0xb0ea('0x9'),attributes,{'tableName':_0xb0ea('0xa'),'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 7459f8b..e2501f7 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 _0x199a=['../../config/environment','jayson/promise','http','request','then','info','CmHopperBlack,\x20%s,\x20%s','request\x20sent','debug','CmHopperBlack,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','GetCmHopperBlack','CmHopperBlack','findAll','options','raw','where','limit','include','map','model','attributes','UpdateCmHopperBlack','update','body','DestroyCmHopperBlack','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x199a,0xe7));var _0xa199=function(_0x38617e,_0x39d755){_0x38617e=_0x38617e-0x0;var _0x369b3c=_0x199a[_0x38617e];return _0x369b3c;};'use strict';var _=require(_0xa199('0x0'));var util=require(_0xa199('0x1'));var moment=require(_0xa199('0x2'));var BPromise=require('bluebird');var rs=require(_0xa199('0x3'));var fs=require('fs');var Redis=require(_0xa199('0x4'));var db=require(_0xa199('0x5'))['db'];var utils=require(_0xa199('0x6'));var logger=require(_0xa199('0x7'))(_0xa199('0x8'));var config=require(_0xa199('0x9'));var jayson=require(_0xa199('0xa'));var client=jayson['client'][_0xa199('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xd0568b,_0x4ba723,_0x579093){return new BPromise(function(_0x4a8314,_0x4eef95){return client[_0xa199('0xc')](_0xd0568b,_0x579093)[_0xa199('0xd')](function(_0x2e3dab){logger[_0xa199('0xe')](_0xa199('0xf'),_0x4ba723,_0xa199('0x10'));logger[_0xa199('0x11')](_0xa199('0x12'),_0x4ba723,'request\x20sent',JSON[_0xa199('0x13')](_0x2e3dab));if(_0x2e3dab['error']){if(_0x2e3dab['error'][_0xa199('0x14')]===0x1f4){logger[_0xa199('0x15')](_0xa199('0xf'),_0x4ba723,_0x2e3dab[_0xa199('0x15')][_0xa199('0x16')]);return _0x4eef95(_0x2e3dab[_0xa199('0x15')]['message']);}logger[_0xa199('0x15')]('CmHopperBlack,\x20%s,\x20%s',_0x4ba723,_0x2e3dab['error'][_0xa199('0x16')]);return _0x4a8314(_0x2e3dab[_0xa199('0x15')][_0xa199('0x16')]);}else{logger['info'](_0xa199('0xf'),_0x4ba723,_0xa199('0x10'));_0x4a8314(_0x2e3dab[_0xa199('0x17')][_0xa199('0x16')]);}})[_0xa199('0x18')](function(_0x42c5e8){logger['error']('CmHopperBlack,\x20%s,\x20%s',_0x4ba723,_0x42c5e8);_0x4eef95(_0x42c5e8);});});}exports[_0xa199('0x19')]=function(_0x57e567){var _0x56ee0b=this;return new Promise(function(_0x235a86,_0x21c4be){return db[_0xa199('0x1a')][_0xa199('0x1b')]({'raw':_0x57e567[_0xa199('0x1c')]?_0x57e567[_0xa199('0x1c')][_0xa199('0x1d')]===undefined?!![]:![]:!![],'where':_0x57e567[_0xa199('0x1c')]?_0x57e567[_0xa199('0x1c')][_0xa199('0x1e')]||null:null,'attributes':_0x57e567[_0xa199('0x1c')]?_0x57e567[_0xa199('0x1c')]['attributes']||null:null,'limit':_0x57e567['options']?_0x57e567['options'][_0xa199('0x1f')]||null:null,'include':_0x57e567[_0xa199('0x1c')]?_0x57e567[_0xa199('0x1c')][_0xa199('0x20')]?_[_0xa199('0x21')](_0x57e567[_0xa199('0x1c')][_0xa199('0x20')],function(_0x45b061){return{'model':db[_0x45b061[_0xa199('0x22')]],'as':_0x45b061['as'],'attributes':_0x45b061[_0xa199('0x23')],'include':_0x45b061[_0xa199('0x20')]?_[_0xa199('0x21')](_0x45b061[_0xa199('0x20')],function(_0x31c976){return{'model':db[_0x31c976[_0xa199('0x22')]],'as':_0x31c976['as'],'attributes':_0x31c976[_0xa199('0x23')],'include':_0x31c976['include']?_['map'](_0x31c976[_0xa199('0x20')],function(_0x175174){return{'model':db[_0x175174[_0xa199('0x22')]],'as':_0x175174['as'],'attributes':_0x175174[_0xa199('0x23')]};}):[]};}):[]};}):[]:[]})[_0xa199('0xd')](function(_0x45ac93){logger[_0xa199('0xe')](_0xa199('0x19'),_0x57e567);logger['debug'](_0xa199('0x19'),_0x57e567,JSON[_0xa199('0x13')](_0x45ac93));_0x235a86(_0x45ac93);})[_0xa199('0x18')](function(_0x43079f){logger[_0xa199('0x15')]('GetCmHopperBlack',_0x43079f['message'],_0x57e567);_0x21c4be(_0x56ee0b[_0xa199('0x15')](0x1f4,_0x43079f[_0xa199('0x16')]));});});};exports[_0xa199('0x24')]=function(_0x198129){var _0x3f8c01=this;return new Promise(function(_0x3f205c,_0x5f2a9b){return db[_0xa199('0x1a')][_0xa199('0x25')](_0x198129[_0xa199('0x26')],{'raw':_0x198129[_0xa199('0x1c')]?_0x198129[_0xa199('0x1c')][_0xa199('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x198129[_0xa199('0x1c')]?_0x198129['options'][_0xa199('0x1e')]||null:null,'attributes':_0x198129['options']?_0x198129[_0xa199('0x1c')][_0xa199('0x23')]||null:null,'limit':_0x198129['options']?_0x198129[_0xa199('0x1c')][_0xa199('0x1f')]||null:null})['then'](function(_0x5f4996){logger[_0xa199('0xe')](_0xa199('0x24'),_0x198129);logger[_0xa199('0x11')](_0xa199('0x24'),_0x198129,JSON[_0xa199('0x13')](_0x5f4996));_0x3f205c(_0x5f4996);})[_0xa199('0x18')](function(_0x5ac059){logger['error']('UpdateCmHopperBlack',_0x5ac059[_0xa199('0x16')],_0x198129);_0x5f2a9b(_0x3f8c01[_0xa199('0x15')](0x1f4,_0x5ac059[_0xa199('0x16')]));});});};exports[_0xa199('0x27')]=function(_0x2e3899){var _0x5c05d2=this;return new Promise(function(_0x404f18,_0x2225e9){return db['CmHopperBlack']['destroy']({'where':_0x2e3899[_0xa199('0x1c')]?_0x2e3899[_0xa199('0x1c')]['where']||null:null})['then'](function(_0x54bbb6){logger[_0xa199('0xe')]('DestroyCmHopperBlack',_0x2e3899);logger[_0xa199('0x11')](_0xa199('0x27'),_0x2e3899,JSON[_0xa199('0x13')](_0x54bbb6));_0x404f18(_0x54bbb6);})[_0xa199('0x18')](function(_0x29c014){logger[_0xa199('0x15')](_0xa199('0x27'),_0x29c014[_0xa199('0x16')],_0x2e3899);_0x2225e9(_0x5c05d2[_0xa199('0x15')](0x1f4,_0x29c014[_0xa199('0x16')]));});});}; \ No newline at end of file +var _0xd4db=['CmHopperBlack','findAll','options','raw','where','attributes','limit','include','map','model','UpdateCmHopperBlack','update','DestroyCmHopperBlack','destroy','lodash','moment','bluebird','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then','info','CmHopperBlack,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','GetCmHopperBlack'];(function(_0x2a2df3,_0x30084e){var _0x3f9eb8=function(_0x3efd2e){while(--_0x3efd2e){_0x2a2df3['push'](_0x2a2df3['shift']());}};_0x3f9eb8(++_0x30084e);}(_0xd4db,0x1e2));var _0xbd4d=function(_0x59113d,_0x5ba181){_0x59113d=_0x59113d-0x0;var _0x5bde53=_0xd4db[_0x59113d];return _0x5bde53;};'use strict';var _=require(_0xbd4d('0x0'));var util=require('util');var moment=require(_0xbd4d('0x1'));var BPromise=require(_0xbd4d('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbd4d('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xbd4d('0x4'));var logger=require('../../config/logger')(_0xbd4d('0x5'));var config=require(_0xbd4d('0x6'));var jayson=require(_0xbd4d('0x7'));var client=jayson[_0xbd4d('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5c089e,_0x1d15dc,_0x2ba7bf){return new BPromise(function(_0x48c55f,_0x5693c6){return client[_0xbd4d('0x9')](_0x5c089e,_0x2ba7bf)[_0xbd4d('0xa')](function(_0x22b3a0){logger[_0xbd4d('0xb')](_0xbd4d('0xc'),_0x1d15dc,_0xbd4d('0xd'));logger[_0xbd4d('0xe')]('CmHopperBlack,\x20%s,\x20%s,\x20%s',_0x1d15dc,_0xbd4d('0xd'),JSON[_0xbd4d('0xf')](_0x22b3a0));if(_0x22b3a0[_0xbd4d('0x10')]){if(_0x22b3a0[_0xbd4d('0x10')][_0xbd4d('0x11')]===0x1f4){logger[_0xbd4d('0x10')](_0xbd4d('0xc'),_0x1d15dc,_0x22b3a0[_0xbd4d('0x10')][_0xbd4d('0x12')]);return _0x5693c6(_0x22b3a0[_0xbd4d('0x10')][_0xbd4d('0x12')]);}logger['error'](_0xbd4d('0xc'),_0x1d15dc,_0x22b3a0[_0xbd4d('0x10')][_0xbd4d('0x12')]);return _0x48c55f(_0x22b3a0[_0xbd4d('0x10')][_0xbd4d('0x12')]);}else{logger[_0xbd4d('0xb')](_0xbd4d('0xc'),_0x1d15dc,_0xbd4d('0xd'));_0x48c55f(_0x22b3a0[_0xbd4d('0x13')][_0xbd4d('0x12')]);}})[_0xbd4d('0x14')](function(_0x2c645f){logger[_0xbd4d('0x10')](_0xbd4d('0xc'),_0x1d15dc,_0x2c645f);_0x5693c6(_0x2c645f);});});}exports[_0xbd4d('0x15')]=function(_0x15eff4){var _0x38c22b=this;return new Promise(function(_0x1e0c71,_0x15758b){return db[_0xbd4d('0x16')][_0xbd4d('0x17')]({'raw':_0x15eff4[_0xbd4d('0x18')]?_0x15eff4[_0xbd4d('0x18')][_0xbd4d('0x19')]===undefined?!![]:![]:!![],'where':_0x15eff4['options']?_0x15eff4['options'][_0xbd4d('0x1a')]||null:null,'attributes':_0x15eff4[_0xbd4d('0x18')]?_0x15eff4[_0xbd4d('0x18')][_0xbd4d('0x1b')]||null:null,'limit':_0x15eff4[_0xbd4d('0x18')]?_0x15eff4['options'][_0xbd4d('0x1c')]||null:null,'include':_0x15eff4['options']?_0x15eff4['options'][_0xbd4d('0x1d')]?_[_0xbd4d('0x1e')](_0x15eff4[_0xbd4d('0x18')][_0xbd4d('0x1d')],function(_0x28a7c3){return{'model':db[_0x28a7c3[_0xbd4d('0x1f')]],'as':_0x28a7c3['as'],'attributes':_0x28a7c3[_0xbd4d('0x1b')],'include':_0x28a7c3[_0xbd4d('0x1d')]?_[_0xbd4d('0x1e')](_0x28a7c3[_0xbd4d('0x1d')],function(_0x241993){return{'model':db[_0x241993['model']],'as':_0x241993['as'],'attributes':_0x241993[_0xbd4d('0x1b')],'include':_0x241993['include']?_[_0xbd4d('0x1e')](_0x241993[_0xbd4d('0x1d')],function(_0x12b93c){return{'model':db[_0x12b93c[_0xbd4d('0x1f')]],'as':_0x12b93c['as'],'attributes':_0x12b93c[_0xbd4d('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xbd4d('0xa')](function(_0x4ad3ad){logger[_0xbd4d('0xb')]('GetCmHopperBlack',_0x15eff4);logger[_0xbd4d('0xe')]('GetCmHopperBlack',_0x15eff4,JSON[_0xbd4d('0xf')](_0x4ad3ad));_0x1e0c71(_0x4ad3ad);})[_0xbd4d('0x14')](function(_0x426fc9){logger['error'](_0xbd4d('0x15'),_0x426fc9[_0xbd4d('0x12')],_0x15eff4);_0x15758b(_0x38c22b['error'](0x1f4,_0x426fc9[_0xbd4d('0x12')]));});});};exports[_0xbd4d('0x20')]=function(_0x463681){var _0x17c831=this;return new Promise(function(_0xa35b6c,_0x2ce6f5){return db[_0xbd4d('0x16')][_0xbd4d('0x21')](_0x463681['body'],{'raw':_0x463681[_0xbd4d('0x18')]?_0x463681[_0xbd4d('0x18')][_0xbd4d('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x463681[_0xbd4d('0x18')]?_0x463681[_0xbd4d('0x18')][_0xbd4d('0x1a')]||null:null,'attributes':_0x463681[_0xbd4d('0x18')]?_0x463681['options'][_0xbd4d('0x1b')]||null:null,'limit':_0x463681[_0xbd4d('0x18')]?_0x463681['options'][_0xbd4d('0x1c')]||null:null})['then'](function(_0x287460){logger[_0xbd4d('0xb')](_0xbd4d('0x20'),_0x463681);logger[_0xbd4d('0xe')](_0xbd4d('0x20'),_0x463681,JSON[_0xbd4d('0xf')](_0x287460));_0xa35b6c(_0x287460);})[_0xbd4d('0x14')](function(_0x273b18){logger[_0xbd4d('0x10')](_0xbd4d('0x20'),_0x273b18[_0xbd4d('0x12')],_0x463681);_0x2ce6f5(_0x17c831[_0xbd4d('0x10')](0x1f4,_0x273b18[_0xbd4d('0x12')]));});});};exports[_0xbd4d('0x22')]=function(_0x4a04cb){var _0x4706e6=this;return new Promise(function(_0x442e73,_0x132c0e){return db[_0xbd4d('0x16')][_0xbd4d('0x23')]({'where':_0x4a04cb[_0xbd4d('0x18')]?_0x4a04cb[_0xbd4d('0x18')]['where']||null:null})[_0xbd4d('0xa')](function(_0x2384e5){logger[_0xbd4d('0xb')]('DestroyCmHopperBlack',_0x4a04cb);logger[_0xbd4d('0xe')](_0xbd4d('0x22'),_0x4a04cb,JSON['stringify'](_0x2384e5));_0x442e73(_0x2384e5);})['catch'](function(_0x269abd){logger[_0xbd4d('0x10')]('DestroyCmHopperBlack',_0x269abd[_0xbd4d('0x12')],_0x4a04cb);_0x132c0e(_0x4706e6[_0xbd4d('0x10')](0x1f4,_0x269abd['message']));});});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/index.js b/server/api/cmHopperBlack/index.js index ab5e2f8..c7e9366 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 _0x781d=['isAuthenticated','index','/describe','describe','put','/:id','update','delete','destroy','exports','multer','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperBlack.controller','get'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x781d,0x14a));var _0xd781=function(_0x1035c1,_0x2d8583){_0x1035c1=_0x1035c1-0x0;var _0x308d67=_0x781d[_0x1035c1];return _0x308d67;};'use strict';var multer=require(_0xd781('0x0'));var util=require(_0xd781('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xd781('0x2'));var router=express[_0xd781('0x3')]();var fs_extra=require(_0xd781('0x4'));var auth=require(_0xd781('0x5'));var interaction=require(_0xd781('0x6'));var config=require(_0xd781('0x7'));var controller=require(_0xd781('0x8'));router[_0xd781('0x9')]('/',auth[_0xd781('0xa')](),controller[_0xd781('0xb')]);router['get'](_0xd781('0xc'),auth[_0xd781('0xa')](),controller[_0xd781('0xd')]);router[_0xd781('0x9')]('/:id',auth[_0xd781('0xa')](),controller['show']);router[_0xd781('0xe')](_0xd781('0xf'),auth['isAuthenticated'](),controller[_0xd781('0x10')]);router[_0xd781('0x11')]('/:id',auth['isAuthenticated'](),controller[_0xd781('0x12')]);module[_0xd781('0x13')]=router; \ No newline at end of file +var _0x7a54=['./cmHopperBlack.controller','get','index','/describe','isAuthenticated','put','/:id','update','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x5dbdb8,_0x200701){var _0x40ba7e=function(_0x391def){while(--_0x391def){_0x5dbdb8['push'](_0x5dbdb8['shift']());}};_0x40ba7e(++_0x200701);}(_0x7a54,0x106));var _0x47a5=function(_0x12d686,_0x11f2ad){_0x12d686=_0x12d686-0x0;var _0x30fc61=_0x7a54[_0x12d686];return _0x30fc61;};'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['describe']);router[_0x47a5('0x9')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x47a5('0xd')](_0x47a5('0xe'),auth['isAuthenticated'](),controller[_0x47a5('0xf')]);router['delete']('/:id',auth[_0x47a5('0xc')](),controller[_0x47a5('0x10')]);module[_0x47a5('0x11')]=router; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.attributes.js b/server/api/cmHopperFinal/cmHopperFinal.attributes.js index 2af10dd..7c5ac49 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 _0xe05f=['diff','seconds','dispositionat','BOOLEAN','sequelize','moment','INTEGER','STRING','DATE','getDataValue','endtime','setDataValue'];(function(_0x28db2b,_0x439fd2){var _0x26b681=function(_0x404c69){while(--_0x404c69){_0x28db2b['push'](_0x28db2b['shift']());}};_0x26b681(++_0x439fd2);}(_0xe05f,0x16c));var _0xfe05=function(_0x47ec07,_0x41fb42){_0x47ec07=_0x47ec07-0x0;var _0xe680a3=_0xe05f[_0x47ec07];return _0xe680a3;};'use strict';var Sequelize=require(_0xfe05('0x0'));var moment=require(_0xfe05('0x1'));module['exports']={'state':{'type':Sequelize[_0xfe05('0x2')](0x2)},'statedesc':{'type':Sequelize[_0xfe05('0x3')]},'scheduledat':{'type':Sequelize[_0xfe05('0x4')]},'countbusyretry':{'type':Sequelize[_0xfe05('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xfe05('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xfe05('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0xfe05('0x2')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0xfe05('0x3')]},'originatecalleridnum':{'type':Sequelize['STRING']},'originatecalleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0xfe05('0x3')]},'calleridname':{'type':Sequelize[_0xfe05('0x3')]},'starttime':{'type':Sequelize[_0xfe05('0x4')]},'responsetime':{'type':Sequelize[_0xfe05('0x4')]},'answertime':{'type':Sequelize['DATE']},'droptime':{'type':Sequelize[_0xfe05('0x4')]},'endtime':{'type':Sequelize[_0xfe05('0x4')]},'ringtime':{'type':Sequelize[_0xfe05('0x2')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0xfe05('0x2')],'defaultValue':0x0},'talktime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0xfe05('0x2')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0xfe05('0x3')]},'campaign':{'type':Sequelize[_0xfe05('0x3')]},'campaigntype':{'type':Sequelize[_0xfe05('0x3')]},'membername':{'type':Sequelize[_0xfe05('0x3')]},'reason':{'type':Sequelize[_0xfe05('0x3')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0xfe05('0x3')]},'dispositionat':{'type':Sequelize[_0xfe05('0x4')],'set':function(_0x3b5071){var _0x254b7d=this[_0xfe05('0x5')](_0xfe05('0x6'));if(_0x254b7d&&_0x3b5071){this[_0xfe05('0x7')]('followuptime',moment(_0x3b5071)[_0xfe05('0x8')](moment(_0x254b7d),_0xfe05('0x9')));}return this[_0xfe05('0x7')](_0xfe05('0xa'),_0x3b5071);}},'amd':{'type':Sequelize[_0xfe05('0xb')],'defaultValue':![]},'fax':{'type':Sequelize[_0xfe05('0xb')],'defaultValue':![]},'blacklist':{'type':Sequelize[_0xfe05('0xb')],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0xfe05('0xb')],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0xfe05('0x4')]},'callback':{'type':Sequelize[_0xfe05('0xb')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'deleted':{'type':Sequelize['STRING'],'defaultValue':null},'deletedat':{'type':Sequelize[_0xfe05('0x4')]},'recallme':{'type':Sequelize[_0xfe05('0xb')],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0xfe05('0x4')]},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xfe05('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xfe05('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xfe05('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x3f2b=['moment','exports','INTEGER','STRING','DATE','endtime','setDataValue','followuptime','diff','seconds','BOOLEAN','sequelize'];(function(_0x140bd5,_0x332b8e){var _0x59d5e2=function(_0x3f48bc){while(--_0x3f48bc){_0x140bd5['push'](_0x140bd5['shift']());}};_0x59d5e2(++_0x332b8e);}(_0x3f2b,0x1a3));var _0xb3f2=function(_0x24d827,_0x4f6755){_0x24d827=_0x24d827-0x0;var _0x5d45b2=_0x3f2b[_0x24d827];return _0x5d45b2;};'use strict';var Sequelize=require(_0xb3f2('0x0'));var moment=require(_0xb3f2('0x1'));module[_0xb3f2('0x2')]={'state':{'type':Sequelize[_0xb3f2('0x3')](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize['DATE']},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xb3f2('0x3')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0xb3f2('0x3')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0xb3f2('0x4')]},'originatecalleridnum':{'type':Sequelize['STRING']},'originatecalleridname':{'type':Sequelize[_0xb3f2('0x4')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0xb3f2('0x4')]},'starttime':{'type':Sequelize[_0xb3f2('0x5')]},'responsetime':{'type':Sequelize[_0xb3f2('0x5')]},'answertime':{'type':Sequelize[_0xb3f2('0x5')]},'droptime':{'type':Sequelize[_0xb3f2('0x5')]},'endtime':{'type':Sequelize[_0xb3f2('0x5')]},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0xb3f2('0x3')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0xb3f2('0x3')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0xb3f2('0x3')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0xb3f2('0x4')]},'campaign':{'type':Sequelize[_0xb3f2('0x4')]},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize['STRING']},'reason':{'type':Sequelize[_0xb3f2('0x4')]},'disposition':{'type':Sequelize[_0xb3f2('0x4')]},'secondDisposition':{'type':Sequelize[_0xb3f2('0x4')]},'thirdDisposition':{'type':Sequelize[_0xb3f2('0x4')]},'dispositionat':{'type':Sequelize[_0xb3f2('0x5')],'set':function(_0x8e0e5f){var _0x364990=this['getDataValue'](_0xb3f2('0x6'));if(_0x364990&&_0x8e0e5f){this[_0xb3f2('0x7')](_0xb3f2('0x8'),moment(_0x8e0e5f)[_0xb3f2('0x9')](moment(_0x364990),_0xb3f2('0xa')));}return this[_0xb3f2('0x7')]('dispositionat',_0x8e0e5f);}},'amd':{'type':Sequelize[_0xb3f2('0xb')],'defaultValue':![]},'fax':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'blacklist':{'type':Sequelize[_0xb3f2('0xb')],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0xb3f2('0xb')],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0xb3f2('0x5')]},'callback':{'type':Sequelize[_0xb3f2('0xb')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xb3f2('0x4')],'defaultValue':null},'callbackat':{'type':Sequelize[_0xb3f2('0x5')]},'deleted':{'type':Sequelize['STRING'],'defaultValue':null},'deletedat':{'type':Sequelize[_0xb3f2('0x5')]},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0xb3f2('0x5')]},'countnosuchnumberretry':{'type':Sequelize[_0xb3f2('0x3')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xb3f2('0x3')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xb3f2('0x3')],'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 4764fef..dfc3efe 100644 --- a/server/api/cmHopperFinal/cmHopperFinal.controller.js +++ b/server/api/cmHopperFinal/cmHopperFinal.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4975=['ANY_VALUE(CampaignId)','CampaignId\x20=\x20?','CmHopper','findOne','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','set','Content-Range','apply','save','update','then','destroy','error','stack','name','fieldName','type','keys','query','filters','model','intersection','fields','attributes','length','hasOwnProperty','sort','pick','filter','where','map','VIRTUAL','options','CmHopperFinal','count','includeAll','include','findAll','catch','show','params','rawAttributes','find','describe','uniqueid','body','countContactsQueueCampaignHopperFinal','sequelize','`state`\x20=\x200,\x201,\x20null','noSuchContacts','COUNT','literal','noAnswerContacts','congestionContacts','`state`\x20=\x2010\x20,\x201,\x20null','dropContacts','`state`\x20=\x2011\x20,\x201,\x20null','abandonedContacts','`state`\x20=\x2022,\x201,\x20null','reCallContacts','`state`\x20=\x2019,\x201,\x20null','answeringMachine','countContactsIvrCampaignHopperFinal','`state`\x20=\x205,\x201,\x20null','busyContacts','`state`\x20=\x208,\x201,\x20null','moveContactsQueueCampaignHopperFinal','VoiceQueue','into','cm_hopper','fromQuery','scheduledAt','ContactId','VoiceQueueId','createdAt','updatedAt','ANY_VALUE(calleridnum)','phone','field','NOW()','ANY_VALUE(ContactId)','ANY_VALUE(ListId)','ListId','ANY_VALUE(VoiceQueueId)','from','cm_hopper_final','VoiceQueueId\x20=\x20?','toString','state\x20=\x20?','state','calleridnum\x20IS\x20NOT\x20NULL','calleridnum\x20NOT\x20IN\x20(?)','calleridnum','state\x20=\x204','group','moveContactsIvrCampaignHopperFinal','Campaign','insert','CampaignId','select'];(function(_0x6c993a,_0x5ea3ab){var _0x27f547=function(_0x22df20){while(--_0x22df20){_0x6c993a['push'](_0x6c993a['shift']());}};_0x27f547(++_0x5ea3ab);}(_0x4975,0x86));var _0x5497=function(_0x25fb77,_0x5aeb2c){_0x25fb77=_0x25fb77-0x0;var _0x1aaf2c=_0x4975[_0x25fb77];return _0x1aaf2c;};'use strict';var emlformat=require(_0x5497('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x5497('0x1'));var jsonpatch=require(_0x5497('0x2'));var rp=require(_0x5497('0x3'));var moment=require(_0x5497('0x4'));var BPromise=require(_0x5497('0x5'));var Mustache=require(_0x5497('0x6'));var util=require(_0x5497('0x7'));var path=require(_0x5497('0x8'));var sox=require(_0x5497('0x9'));var csv=require(_0x5497('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5497('0xb'));var _=require('lodash');var squel=require(_0x5497('0xc'));var crypto=require(_0x5497('0xd'));var jsforce=require(_0x5497('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x5497('0xa'));var querystring=require('querystring');var Papa=require(_0x5497('0xf'));var Redis=require(_0x5497('0x10'));var authService=require(_0x5497('0x11'));var qs=require(_0x5497('0x12'));var as=require(_0x5497('0x13'));var hardwareService=require(_0x5497('0x14'));var logger=require(_0x5497('0x15'))(_0x5497('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x5497('0x17'))['db'];function respondWithStatusCode(_0x1b23df,_0x1bb794){_0x1bb794=_0x1bb794||0xcc;return function(_0x984990){if(_0x984990){return _0x1b23df[_0x5497('0x18')](_0x1bb794);}return _0x1b23df[_0x5497('0x19')](_0x1bb794)[_0x5497('0x1a')]();};}function respondWithResult(_0xaca97d,_0x363a5b){_0x363a5b=_0x363a5b||0xc8;return function(_0x1a4c74){if(_0x1a4c74){return _0xaca97d['status'](_0x363a5b)[_0x5497('0x1b')](_0x1a4c74);}};}function respondWithFilteredResult(_0x4fb8e9,_0x4237a9){return function(_0x2bfd8a){if(_0x2bfd8a){var _0x19e5f3=typeof _0x4237a9[_0x5497('0x1c')]===_0x5497('0x1d')&&typeof _0x4237a9[_0x5497('0x1e')]===_0x5497('0x1d');var _0x575f6b=_0x2bfd8a['count'];var _0x3f4d20=_0x19e5f3?0x0:_0x4237a9[_0x5497('0x1c')];var _0x3a47fd=_0x19e5f3?_0x2bfd8a['count']:_0x4237a9[_0x5497('0x1c')]+_0x4237a9[_0x5497('0x1e')];var _0x18e8a8;if(_0x3a47fd>=_0x575f6b){_0x3a47fd=_0x575f6b;_0x18e8a8=0xc8;}else{_0x18e8a8=0xce;}_0x4fb8e9[_0x5497('0x19')](_0x18e8a8);return _0x4fb8e9[_0x5497('0x1f')](_0x5497('0x20'),_0x3f4d20+'-'+_0x3a47fd+'/'+_0x575f6b)[_0x5497('0x1b')](_0x2bfd8a);}return null;};}function patchUpdates(_0x10226f){return function(_0x2e3960){try{jsonpatch[_0x5497('0x21')](_0x2e3960,_0x10226f,!![]);}catch(_0x186065){return BPromise['reject'](_0x186065);}return _0x2e3960[_0x5497('0x22')]();};}function saveUpdates(_0x4d1b27,_0x19200a){return function(_0xd0868d){if(_0xd0868d){return _0xd0868d[_0x5497('0x23')](_0x4d1b27)[_0x5497('0x24')](function(_0x35ecd9){return _0x35ecd9;});}return null;};}function removeEntity(_0x3b2fbc,_0x5018fa){return function(_0x54043a){if(_0x54043a){return _0x54043a[_0x5497('0x25')]()[_0x5497('0x24')](function(){_0x3b2fbc[_0x5497('0x19')](0xcc)[_0x5497('0x1a')]();});}};}function handleEntityNotFound(_0x5223b5,_0x13b7a4){return function(_0x57268c){if(!_0x57268c){_0x5223b5[_0x5497('0x18')](0x194);}return _0x57268c;};}function handleError(_0x16a2b4,_0x429d36){_0x429d36=_0x429d36||0x1f4;return function(_0x34a1a5){logger[_0x5497('0x26')](_0x34a1a5[_0x5497('0x27')]);if(_0x34a1a5['name']){delete _0x34a1a5[_0x5497('0x28')];}_0x16a2b4['status'](_0x429d36)['send'](_0x34a1a5);};}exports['index']=function(_0x39a2b7,_0x48d146){var _0x5e9356={},_0xc3465={},_0xb14593={'count':0x0,'rows':[]};var _0x1cf908=_['map'](db['CmHopperFinal']['rawAttributes'],function(_0x371874){return{'name':_0x371874[_0x5497('0x29')],'type':_0x371874[_0x5497('0x2a')]['key']};});_0xc3465['model']=_['map'](_0x1cf908,_0x5497('0x28'));_0xc3465['query']=_[_0x5497('0x2b')](_0x39a2b7[_0x5497('0x2c')]);_0xc3465[_0x5497('0x2d')]=_['intersection'](_0xc3465[_0x5497('0x2e')],_0xc3465[_0x5497('0x2c')]);_0x5e9356['attributes']=_[_0x5497('0x2f')](_0xc3465[_0x5497('0x2e')],qs[_0x5497('0x30')](_0x39a2b7['query'][_0x5497('0x30')]));_0x5e9356[_0x5497('0x31')]=_0x5e9356[_0x5497('0x31')][_0x5497('0x32')]?_0x5e9356[_0x5497('0x31')]:_0xc3465['model'];if(!_0x39a2b7[_0x5497('0x2c')][_0x5497('0x33')]('nolimit')){_0x5e9356[_0x5497('0x1e')]=qs[_0x5497('0x1e')](_0x39a2b7[_0x5497('0x2c')][_0x5497('0x1e')]);_0x5e9356[_0x5497('0x1c')]=qs[_0x5497('0x1c')](_0x39a2b7['query'][_0x5497('0x1c')]);}_0x5e9356['order']=qs[_0x5497('0x34')](_0x39a2b7[_0x5497('0x2c')][_0x5497('0x34')]);_0x5e9356['where']=qs['filters'](_[_0x5497('0x35')](_0x39a2b7[_0x5497('0x2c')],_0xc3465[_0x5497('0x2d')]),_0x1cf908);if(_0x39a2b7[_0x5497('0x2c')][_0x5497('0x36')]){_0x5e9356[_0x5497('0x37')]=_['merge'](_0x5e9356[_0x5497('0x37')],{'$or':_[_0x5497('0x38')](_0x1cf908,function(_0x3de8fe){if(_0x3de8fe[_0x5497('0x2a')]!==_0x5497('0x39')){var _0x468902={};_0x468902[_0x3de8fe[_0x5497('0x28')]]={'$like':'%'+_0x39a2b7[_0x5497('0x2c')][_0x5497('0x36')]+'%'};return _0x468902;}})});}_0x5e9356=_['merge']({},_0x5e9356,_0x39a2b7[_0x5497('0x3a')]);var _0x32fa2b={'where':_0x5e9356[_0x5497('0x37')]};return db[_0x5497('0x3b')][_0x5497('0x3c')](_0x32fa2b)[_0x5497('0x24')](function(_0x4299be){_0xb14593['count']=_0x4299be;if(_0x39a2b7[_0x5497('0x2c')][_0x5497('0x3d')]){_0x5e9356[_0x5497('0x3e')]=[{'all':!![]}];}return db[_0x5497('0x3b')][_0x5497('0x3f')](_0x5e9356);})[_0x5497('0x24')](function(_0x114471){_0xb14593['rows']=_0x114471;return _0xb14593;})[_0x5497('0x24')](respondWithFilteredResult(_0x48d146,_0x5e9356))[_0x5497('0x40')](handleError(_0x48d146,null));};exports[_0x5497('0x41')]=function(_0x1e6389,_0x20e947){var _0xd90608={'raw':!![],'where':{'id':_0x1e6389[_0x5497('0x42')]['id']}},_0xc1a999={};_0xc1a999[_0x5497('0x2e')]=_[_0x5497('0x2b')](db['CmHopperFinal'][_0x5497('0x43')]);_0xc1a999['query']=_[_0x5497('0x2b')](_0x1e6389[_0x5497('0x2c')]);_0xc1a999[_0x5497('0x2d')]=_[_0x5497('0x2f')](_0xc1a999[_0x5497('0x2e')],_0xc1a999['query']);_0xd90608[_0x5497('0x31')]=_[_0x5497('0x2f')](_0xc1a999['model'],qs[_0x5497('0x30')](_0x1e6389['query'][_0x5497('0x30')]));_0xd90608['attributes']=_0xd90608[_0x5497('0x31')][_0x5497('0x32')]?_0xd90608[_0x5497('0x31')]:_0xc1a999[_0x5497('0x2e')];if(_0x1e6389[_0x5497('0x2c')]['includeAll']){_0xd90608['include']=[{'all':!![]}];}_0xd90608=_['merge']({},_0xd90608,_0x1e6389['options']);return db[_0x5497('0x3b')][_0x5497('0x44')](_0xd90608)[_0x5497('0x24')](handleEntityNotFound(_0x20e947,null))[_0x5497('0x24')](respondWithResult(_0x20e947,null))[_0x5497('0x40')](handleError(_0x20e947,null));};exports[_0x5497('0x45')]=function(_0xc78abe,_0x466287){return db[_0x5497('0x3b')]['describe']()[_0x5497('0x24')](respondWithResult(_0x466287,null))[_0x5497('0x40')](handleError(_0x466287,null));};exports[_0x5497('0x23')]=function(_0x52a189,_0x3e4da2){if(_0x52a189['body'][_0x5497('0x46')]){delete _0x52a189[_0x5497('0x47')][_0x5497('0x46')];}return db['CmHopperFinal'][_0x5497('0x44')]({'where':{'uniqueid':_0x52a189[_0x5497('0x42')]['id']}})['then'](handleEntityNotFound(_0x3e4da2,null))[_0x5497('0x24')](saveUpdates(_0x52a189['body'],null))[_0x5497('0x24')](respondWithResult(_0x3e4da2,null))['catch'](handleError(_0x3e4da2,null));};exports[_0x5497('0x48')]=function(_0x400860,_0x26fd9f,_0xf07541){return db[_0x5497('0x3b')][_0x5497('0x3f')]({'raw':![],'where':{'VoiceQueueId':_0x400860[_0x5497('0x42')]['id']},'attributes':[[db[_0x5497('0x49')]['fn']('COUNT',db[_0x5497('0x49')]['fn']('IF',db['sequelize']['literal'](_0x5497('0x4a')))),_0x5497('0x4b')],[db['sequelize']['fn'](_0x5497('0x4c'),db[_0x5497('0x49')]['fn']('IF',db[_0x5497('0x49')][_0x5497('0x4d')]('`state`\x20=\x203,\x201,\x20null'))),_0x5497('0x4e')],[db['sequelize']['fn']('COUNT',db[_0x5497('0x49')]['fn']('IF',db[_0x5497('0x49')][_0x5497('0x4d')]('`state`\x20=\x205,\x201,\x20null'))),'busyContacts'],[db[_0x5497('0x49')]['fn']('COUNT',db[_0x5497('0x49')]['fn']('IF',db['sequelize'][_0x5497('0x4d')]('`state`\x20=\x208,\x201,\x20null'))),_0x5497('0x4f')],[db[_0x5497('0x49')]['fn']('COUNT',db[_0x5497('0x49')]['fn']('IF',db['sequelize']['literal'](_0x5497('0x50')))),_0x5497('0x51')],[db['sequelize']['fn'](_0x5497('0x4c'),db[_0x5497('0x49')]['fn']('IF',db[_0x5497('0x49')][_0x5497('0x4d')](_0x5497('0x52')))),_0x5497('0x53')],[db['sequelize']['fn'](_0x5497('0x4c'),db['sequelize']['fn']('IF',db['sequelize']['literal'](_0x5497('0x54')))),_0x5497('0x55')],[db[_0x5497('0x49')]['fn']('COUNT',db[_0x5497('0x49')]['fn']('IF',db['sequelize']['literal'](_0x5497('0x56')))),_0x5497('0x57')]]})[_0x5497('0x24')](handleEntityNotFound(_0x26fd9f,null))[_0x5497('0x24')](respondWithResult(_0x26fd9f,null))[_0x5497('0x40')](handleError(_0x26fd9f,null));};exports[_0x5497('0x58')]=function(_0x573f93,_0x18b30c,_0x3b0350){return db[_0x5497('0x3b')][_0x5497('0x3f')]({'raw':![],'where':{'CampaignId':_0x573f93['params']['id']},'attributes':[[db[_0x5497('0x49')]['fn'](_0x5497('0x4c'),db[_0x5497('0x49')]['fn']('IF',db[_0x5497('0x49')]['literal'](_0x5497('0x4a')))),_0x5497('0x4b')],[db[_0x5497('0x49')]['fn']('COUNT',db[_0x5497('0x49')]['fn']('IF',db['sequelize']['literal']('`state`\x20=\x203,\x201,\x20null'))),_0x5497('0x4e')],[db[_0x5497('0x49')]['fn'](_0x5497('0x4c'),db['sequelize']['fn']('IF',db[_0x5497('0x49')][_0x5497('0x4d')](_0x5497('0x59')))),_0x5497('0x5a')],[db['sequelize']['fn'](_0x5497('0x4c'),db[_0x5497('0x49')]['fn']('IF',db[_0x5497('0x49')]['literal'](_0x5497('0x5b')))),_0x5497('0x4f')],[db[_0x5497('0x49')]['fn'](_0x5497('0x4c'),db[_0x5497('0x49')]['fn']('IF',db[_0x5497('0x49')][_0x5497('0x4d')]('`state`\x20=\x2010\x20,\x201,\x20null'))),_0x5497('0x51')],[db[_0x5497('0x49')]['fn'](_0x5497('0x4c'),db[_0x5497('0x49')]['fn']('IF',db['sequelize']['literal']('`state`\x20=\x2011\x20,\x201,\x20null'))),_0x5497('0x53')],[db[_0x5497('0x49')]['fn'](_0x5497('0x4c'),db['sequelize']['fn']('IF',db[_0x5497('0x49')][_0x5497('0x4d')](_0x5497('0x54')))),_0x5497('0x55')],[db[_0x5497('0x49')]['fn'](_0x5497('0x4c'),db[_0x5497('0x49')]['fn']('IF',db[_0x5497('0x49')][_0x5497('0x4d')](_0x5497('0x56')))),_0x5497('0x57')]]})['then'](handleEntityNotFound(_0x18b30c,null))[_0x5497('0x24')](respondWithResult(_0x18b30c,null))[_0x5497('0x40')](handleError(_0x18b30c,null));};exports[_0x5497('0x5c')]=function(_0x4ef195,_0x5794ff,_0x589008){return db[_0x5497('0x5d')][_0x5497('0x44')]({'where':{'id':_0x4ef195['params']['id']}})[_0x5497('0x24')](handleEntityNotFound(_0x5794ff,null))[_0x5497('0x24')](function(_0x21c715){var _0x286af8;if(_0x21c715){_0x286af8=squel['insert']()[_0x5497('0x5e')](_0x5497('0x5f'))[_0x5497('0x60')](['phone',_0x5497('0x61'),_0x5497('0x62'),'ListId',_0x5497('0x63'),_0x5497('0x64'),_0x5497('0x65')],squel['select']()['field'](_0x5497('0x66'),_0x5497('0x67'))[_0x5497('0x68')](_0x5497('0x69'),_0x5497('0x61'))[_0x5497('0x68')](_0x5497('0x6a'),'ContactId')['field'](_0x5497('0x6b'),_0x5497('0x6c'))['field'](_0x5497('0x6d'),_0x5497('0x63'))[_0x5497('0x68')]('NOW()',_0x5497('0x64'))[_0x5497('0x68')]('NOW()',_0x5497('0x65'))[_0x5497('0x6e')](_0x5497('0x6f'))[_0x5497('0x37')](_0x5497('0x70'),_0x4ef195['params']['id'][_0x5497('0x71')]())[_0x5497('0x37')](_0x5497('0x72'),_0x4ef195[_0x5497('0x47')][_0x5497('0x73')]['toString']())[_0x5497('0x37')](_0x5497('0x74'))[_0x5497('0x37')](_0x5497('0x75'),squel['select']()[_0x5497('0x68')](_0x5497('0x67'))['from'](_0x5497('0x5f'))[_0x5497('0x37')](_0x5497('0x70'),_0x4ef195[_0x5497('0x42')]['id']['toString']()))['where']('calleridnum\x20NOT\x20IN\x20(?)',squel['select']()['field'](_0x5497('0x76'))[_0x5497('0x6e')](_0x5497('0x6f'))[_0x5497('0x37')](_0x5497('0x70'),_0x4ef195['params']['id']['toString']())[_0x5497('0x37')](_0x5497('0x77')))[_0x5497('0x78')](_0x5497('0x62')))[_0x5497('0x71')]();return db[_0x5497('0x49')][_0x5497('0x2c')](_0x286af8);}return[];})[_0x5497('0x24')](respondWithResult(_0x5794ff,null))[_0x5497('0x40')](handleError(_0x5794ff,null));};exports[_0x5497('0x79')]=function(_0x4c41c4,_0x1515f1,_0x4118ec){return db[_0x5497('0x7a')][_0x5497('0x44')]({'where':{'id':_0x4c41c4[_0x5497('0x42')]['id']}})[_0x5497('0x24')](handleEntityNotFound(_0x1515f1,null))['then'](function(_0x1ef7fc){var _0x5903b7;if(_0x1ef7fc){_0x5903b7=squel[_0x5497('0x7b')]()[_0x5497('0x5e')](_0x5497('0x5f'))['fromQuery'](['phone',_0x5497('0x61'),_0x5497('0x62'),_0x5497('0x6c'),_0x5497('0x7c'),_0x5497('0x64'),_0x5497('0x65')],squel[_0x5497('0x7d')]()[_0x5497('0x68')]('ANY_VALUE(calleridnum)','phone')['field'](_0x5497('0x69'),_0x5497('0x61'))[_0x5497('0x68')](_0x5497('0x6a'),'ContactId')['field'](_0x5497('0x6b'),_0x5497('0x6c'))['field'](_0x5497('0x7e'),_0x5497('0x7c'))[_0x5497('0x68')](_0x5497('0x69'),'createdAt')['field']('NOW()','updatedAt')['from'](_0x5497('0x6f'))['where'](_0x5497('0x7f'),_0x4c41c4['params']['id'][_0x5497('0x71')]())[_0x5497('0x37')](_0x5497('0x72'),_0x4c41c4[_0x5497('0x47')][_0x5497('0x73')][_0x5497('0x71')]())['where'](_0x5497('0x74'))['where'](_0x5497('0x75'),squel[_0x5497('0x7d')]()[_0x5497('0x68')](_0x5497('0x67'))[_0x5497('0x6e')](_0x5497('0x5f'))[_0x5497('0x37')](_0x5497('0x7f'),_0x4c41c4[_0x5497('0x42')]['id'][_0x5497('0x71')]()))['where'](_0x5497('0x75'),squel['select']()[_0x5497('0x68')](_0x5497('0x76'))['from'](_0x5497('0x6f'))[_0x5497('0x37')](_0x5497('0x7f'),_0x4c41c4[_0x5497('0x42')]['id'][_0x5497('0x71')]())[_0x5497('0x37')](_0x5497('0x77')))[_0x5497('0x78')](_0x5497('0x62')))[_0x5497('0x71')]();return db[_0x5497('0x49')][_0x5497('0x2c')](_0x5903b7);}return[];})[_0x5497('0x24')](respondWithResult(_0x1515f1,null))[_0x5497('0x40')](handleError(_0x1515f1,null));};exports['checkContactHopper']=function(_0x37c17e,_0x163b5b,_0x3a31be){return db[_0x5497('0x80')][_0x5497('0x81')]({'where':{'VoiceQueueId':_0x37c17e['body'][_0x5497('0x63')],'CampaignId':_0x37c17e[_0x5497('0x47')]['CampaignId'],'ContactId':_0x37c17e['body'][_0x5497('0x62')]}})[_0x5497('0x24')](handleEntityNotFound(_0x163b5b,null))[_0x5497('0x24')](function(_0x14f693){if(_0x14f693){return _0x14f693;}return null;})[_0x5497('0x24')](respondWithResult(_0x163b5b,null))['catch'](handleError(_0x163b5b,null));}; \ No newline at end of file +var _0x33af=['end','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','update','then','destroy','stack','name','send','index','map','CmHopperFinal','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','order','sort','where','merge','VIRTUAL','filter','includeAll','findAll','rows','catch','show','params','length','include','describe','body','uniqueid','find','countContactsQueueCampaignHopperFinal','COUNT','sequelize','`state`\x20=\x200,\x201,\x20null','noSuchContacts','literal','`state`\x20=\x203,\x201,\x20null','`state`\x20=\x205,\x201,\x20null','busyContacts','congestionContacts','`state`\x20=\x2010\x20,\x201,\x20null','`state`\x20=\x2022,\x201,\x20null','reCallContacts','`state`\x20=\x2019,\x201,\x20null','countContactsIvrCampaignHopperFinal','noAnswerContacts','`state`\x20=\x208,\x201,\x20null','dropContacts','`state`\x20=\x2011\x20,\x201,\x20null','abandonedContacts','answeringMachine','moveContactsQueueCampaignHopperFinal','cm_hopper','phone','scheduledAt','ContactId','ListId','VoiceQueueId','select','field','ANY_VALUE(calleridnum)','NOW()','ANY_VALUE(ContactId)','ANY_VALUE(VoiceQueueId)','createdAt','updatedAt','from','cm_hopper_final','VoiceQueueId\x20=\x20?','toString','state\x20=\x20?','state','calleridnum\x20IS\x20NOT\x20NULL','calleridnum\x20NOT\x20IN\x20(?)','calleridnum','state\x20=\x204','group','moveContactsIvrCampaignHopperFinal','insert','fromQuery','CampaignId','ANY_VALUE(ListId)','CampaignId\x20=\x20?','checkContactHopper','CmHopper','findOne','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb'];(function(_0x13e398,_0x52695d){var _0x5bfe4b=function(_0x531e49){while(--_0x531e49){_0x13e398['push'](_0x13e398['shift']());}};_0x5bfe4b(++_0x52695d);}(_0x33af,0xec));var _0xf33a=function(_0x2aefff,_0x26a24b){_0x2aefff=_0x2aefff-0x0;var _0x4e4534=_0x33af[_0x2aefff];return _0x4e4534;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf33a('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf33a('0x1'));var rp=require(_0xf33a('0x2'));var moment=require(_0xf33a('0x3'));var BPromise=require(_0xf33a('0x4'));var Mustache=require(_0xf33a('0x5'));var util=require(_0xf33a('0x6'));var path=require('path');var sox=require(_0xf33a('0x7'));var csv=require(_0xf33a('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf33a('0x9'));var _=require(_0xf33a('0xa'));var squel=require(_0xf33a('0xb'));var crypto=require(_0xf33a('0xc'));var jsforce=require(_0xf33a('0xd'));var deskjs=require(_0xf33a('0xe'));var toCsv=require('to-csv');var querystring=require(_0xf33a('0xf'));var Papa=require(_0xf33a('0x10'));var Redis=require(_0xf33a('0x11'));var authService=require(_0xf33a('0x12'));var qs=require(_0xf33a('0x13'));var as=require(_0xf33a('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xf33a('0x15'));var utils=require(_0xf33a('0x16'));var config=require(_0xf33a('0x17'));var licenseUtil=require(_0xf33a('0x18'));var db=require(_0xf33a('0x19'))['db'];function respondWithStatusCode(_0x5959c9,_0x9f87bc){_0x9f87bc=_0x9f87bc||0xcc;return function(_0x21b80e){if(_0x21b80e){return _0x5959c9['sendStatus'](_0x9f87bc);}return _0x5959c9['status'](_0x9f87bc)[_0xf33a('0x1a')]();};}function respondWithResult(_0x1b3bf0,_0x17043){_0x17043=_0x17043||0xc8;return function(_0x153bda){if(_0x153bda){return _0x1b3bf0[_0xf33a('0x1b')](_0x17043)[_0xf33a('0x1c')](_0x153bda);}};}function respondWithFilteredResult(_0x45e311,_0x1f2b1b){return function(_0x507cb9){if(_0x507cb9){var _0x441f59=typeof _0x1f2b1b['offset']===_0xf33a('0x1d')&&typeof _0x1f2b1b[_0xf33a('0x1e')]==='undefined';var _0x37e76c=_0x507cb9[_0xf33a('0x1f')];var _0x524109=_0x441f59?0x0:_0x1f2b1b[_0xf33a('0x20')];var _0x23d9e2=_0x441f59?_0x507cb9[_0xf33a('0x1f')]:_0x1f2b1b[_0xf33a('0x20')]+_0x1f2b1b['limit'];var _0x11efa0;if(_0x23d9e2>=_0x37e76c){_0x23d9e2=_0x37e76c;_0x11efa0=0xc8;}else{_0x11efa0=0xce;}_0x45e311[_0xf33a('0x1b')](_0x11efa0);return _0x45e311[_0xf33a('0x21')](_0xf33a('0x22'),_0x524109+'-'+_0x23d9e2+'/'+_0x37e76c)[_0xf33a('0x1c')](_0x507cb9);}return null;};}function patchUpdates(_0x6cdf7b){return function(_0x19986f){try{jsonpatch[_0xf33a('0x23')](_0x19986f,_0x6cdf7b,!![]);}catch(_0x19055e){return BPromise[_0xf33a('0x24')](_0x19055e);}return _0x19986f['save']();};}function saveUpdates(_0x3854b4,_0x272e60){return function(_0x1bf9bc){if(_0x1bf9bc){return _0x1bf9bc[_0xf33a('0x25')](_0x3854b4)[_0xf33a('0x26')](function(_0x51d3fd){return _0x51d3fd;});}return null;};}function removeEntity(_0x44654c,_0x5882ba){return function(_0x492986){if(_0x492986){return _0x492986[_0xf33a('0x27')]()[_0xf33a('0x26')](function(){_0x44654c[_0xf33a('0x1b')](0xcc)[_0xf33a('0x1a')]();});}};}function handleEntityNotFound(_0x4b9801,_0x57cb1d){return function(_0x393005){if(!_0x393005){_0x4b9801['sendStatus'](0x194);}return _0x393005;};}function handleError(_0x4af24a,_0x16ef31){_0x16ef31=_0x16ef31||0x1f4;return function(_0x5f0a53){logger['error'](_0x5f0a53[_0xf33a('0x28')]);if(_0x5f0a53['name']){delete _0x5f0a53[_0xf33a('0x29')];}_0x4af24a['status'](_0x16ef31)[_0xf33a('0x2a')](_0x5f0a53);};}exports[_0xf33a('0x2b')]=function(_0x469741,_0x729fca){var _0x4552c9={},_0x3068a9={},_0x1d19ee={'count':0x0,'rows':[]};var _0x1246ff=_[_0xf33a('0x2c')](db[_0xf33a('0x2d')][_0xf33a('0x2e')],function(_0x8f8ddc){return{'name':_0x8f8ddc[_0xf33a('0x2f')],'type':_0x8f8ddc[_0xf33a('0x30')][_0xf33a('0x31')]};});_0x3068a9['model']=_[_0xf33a('0x2c')](_0x1246ff,_0xf33a('0x29'));_0x3068a9[_0xf33a('0x32')]=_[_0xf33a('0x33')](_0x469741['query']);_0x3068a9[_0xf33a('0x34')]=_[_0xf33a('0x35')](_0x3068a9[_0xf33a('0x36')],_0x3068a9[_0xf33a('0x32')]);_0x4552c9[_0xf33a('0x37')]=_[_0xf33a('0x35')](_0x3068a9['model'],qs[_0xf33a('0x38')](_0x469741[_0xf33a('0x32')][_0xf33a('0x38')]));_0x4552c9[_0xf33a('0x37')]=_0x4552c9[_0xf33a('0x37')]['length']?_0x4552c9['attributes']:_0x3068a9[_0xf33a('0x36')];if(!_0x469741['query']['hasOwnProperty']('nolimit')){_0x4552c9[_0xf33a('0x1e')]=qs[_0xf33a('0x1e')](_0x469741['query'][_0xf33a('0x1e')]);_0x4552c9['offset']=qs[_0xf33a('0x20')](_0x469741[_0xf33a('0x32')][_0xf33a('0x20')]);}_0x4552c9[_0xf33a('0x39')]=qs[_0xf33a('0x3a')](_0x469741[_0xf33a('0x32')]['sort']);_0x4552c9[_0xf33a('0x3b')]=qs[_0xf33a('0x34')](_['pick'](_0x469741[_0xf33a('0x32')],_0x3068a9[_0xf33a('0x34')]),_0x1246ff);if(_0x469741[_0xf33a('0x32')]['filter']){_0x4552c9[_0xf33a('0x3b')]=_[_0xf33a('0x3c')](_0x4552c9[_0xf33a('0x3b')],{'$or':_[_0xf33a('0x2c')](_0x1246ff,function(_0x3ec562){if(_0x3ec562[_0xf33a('0x30')]!==_0xf33a('0x3d')){var _0x128baf={};_0x128baf[_0x3ec562[_0xf33a('0x29')]]={'$like':'%'+_0x469741['query'][_0xf33a('0x3e')]+'%'};return _0x128baf;}})});}_0x4552c9=_[_0xf33a('0x3c')]({},_0x4552c9,_0x469741['options']);var _0x1e8800={'where':_0x4552c9['where']};return db['CmHopperFinal'][_0xf33a('0x1f')](_0x1e8800)[_0xf33a('0x26')](function(_0x4dada1){_0x1d19ee[_0xf33a('0x1f')]=_0x4dada1;if(_0x469741[_0xf33a('0x32')][_0xf33a('0x3f')]){_0x4552c9['include']=[{'all':!![]}];}return db[_0xf33a('0x2d')][_0xf33a('0x40')](_0x4552c9);})['then'](function(_0x1e9748){_0x1d19ee[_0xf33a('0x41')]=_0x1e9748;return _0x1d19ee;})[_0xf33a('0x26')](respondWithFilteredResult(_0x729fca,_0x4552c9))[_0xf33a('0x42')](handleError(_0x729fca,null));};exports[_0xf33a('0x43')]=function(_0x5044f9,_0x45ae15){var _0x1722e5={'raw':!![],'where':{'id':_0x5044f9[_0xf33a('0x44')]['id']}},_0x2325eb={};_0x2325eb[_0xf33a('0x36')]=_['keys'](db[_0xf33a('0x2d')][_0xf33a('0x2e')]);_0x2325eb[_0xf33a('0x32')]=_['keys'](_0x5044f9[_0xf33a('0x32')]);_0x2325eb[_0xf33a('0x34')]=_[_0xf33a('0x35')](_0x2325eb[_0xf33a('0x36')],_0x2325eb[_0xf33a('0x32')]);_0x1722e5[_0xf33a('0x37')]=_['intersection'](_0x2325eb[_0xf33a('0x36')],qs[_0xf33a('0x38')](_0x5044f9[_0xf33a('0x32')][_0xf33a('0x38')]));_0x1722e5[_0xf33a('0x37')]=_0x1722e5['attributes'][_0xf33a('0x45')]?_0x1722e5[_0xf33a('0x37')]:_0x2325eb[_0xf33a('0x36')];if(_0x5044f9['query'][_0xf33a('0x3f')]){_0x1722e5[_0xf33a('0x46')]=[{'all':!![]}];}_0x1722e5=_['merge']({},_0x1722e5,_0x5044f9['options']);return db[_0xf33a('0x2d')]['find'](_0x1722e5)[_0xf33a('0x26')](handleEntityNotFound(_0x45ae15,null))[_0xf33a('0x26')](respondWithResult(_0x45ae15,null))[_0xf33a('0x42')](handleError(_0x45ae15,null));};exports[_0xf33a('0x47')]=function(_0xecc82f,_0x1a98f9){return db[_0xf33a('0x2d')][_0xf33a('0x47')]()[_0xf33a('0x26')](respondWithResult(_0x1a98f9,null))[_0xf33a('0x42')](handleError(_0x1a98f9,null));};exports[_0xf33a('0x25')]=function(_0x4107b1,_0x190a2b){if(_0x4107b1[_0xf33a('0x48')][_0xf33a('0x49')]){delete _0x4107b1[_0xf33a('0x48')][_0xf33a('0x49')];}return db[_0xf33a('0x2d')][_0xf33a('0x4a')]({'where':{'uniqueid':_0x4107b1[_0xf33a('0x44')]['id']}})[_0xf33a('0x26')](handleEntityNotFound(_0x190a2b,null))[_0xf33a('0x26')](saveUpdates(_0x4107b1[_0xf33a('0x48')],null))[_0xf33a('0x26')](respondWithResult(_0x190a2b,null))[_0xf33a('0x42')](handleError(_0x190a2b,null));};exports[_0xf33a('0x4b')]=function(_0x3bab07,_0x1f7d8c,_0x57815c){return db['CmHopperFinal'][_0xf33a('0x40')]({'raw':![],'where':{'VoiceQueueId':_0x3bab07[_0xf33a('0x44')]['id']},'attributes':[[db['sequelize']['fn'](_0xf33a('0x4c'),db[_0xf33a('0x4d')]['fn']('IF',db[_0xf33a('0x4d')]['literal'](_0xf33a('0x4e')))),_0xf33a('0x4f')],[db[_0xf33a('0x4d')]['fn']('COUNT',db[_0xf33a('0x4d')]['fn']('IF',db['sequelize'][_0xf33a('0x50')](_0xf33a('0x51')))),'noAnswerContacts'],[db['sequelize']['fn'](_0xf33a('0x4c'),db[_0xf33a('0x4d')]['fn']('IF',db[_0xf33a('0x4d')]['literal'](_0xf33a('0x52')))),_0xf33a('0x53')],[db[_0xf33a('0x4d')]['fn'](_0xf33a('0x4c'),db[_0xf33a('0x4d')]['fn']('IF',db[_0xf33a('0x4d')][_0xf33a('0x50')]('`state`\x20=\x208,\x201,\x20null'))),_0xf33a('0x54')],[db['sequelize']['fn']('COUNT',db['sequelize']['fn']('IF',db[_0xf33a('0x4d')][_0xf33a('0x50')](_0xf33a('0x55')))),'dropContacts'],[db[_0xf33a('0x4d')]['fn'](_0xf33a('0x4c'),db[_0xf33a('0x4d')]['fn']('IF',db[_0xf33a('0x4d')][_0xf33a('0x50')]('`state`\x20=\x2011\x20,\x201,\x20null'))),'abandonedContacts'],[db['sequelize']['fn'](_0xf33a('0x4c'),db['sequelize']['fn']('IF',db[_0xf33a('0x4d')][_0xf33a('0x50')](_0xf33a('0x56')))),_0xf33a('0x57')],[db[_0xf33a('0x4d')]['fn'](_0xf33a('0x4c'),db['sequelize']['fn']('IF',db[_0xf33a('0x4d')][_0xf33a('0x50')](_0xf33a('0x58')))),'answeringMachine']]})[_0xf33a('0x26')](handleEntityNotFound(_0x1f7d8c,null))[_0xf33a('0x26')](respondWithResult(_0x1f7d8c,null))[_0xf33a('0x42')](handleError(_0x1f7d8c,null));};exports[_0xf33a('0x59')]=function(_0x2f1fef,_0x129229,_0x473484){return db[_0xf33a('0x2d')][_0xf33a('0x40')]({'raw':![],'where':{'CampaignId':_0x2f1fef[_0xf33a('0x44')]['id']},'attributes':[[db[_0xf33a('0x4d')]['fn'](_0xf33a('0x4c'),db[_0xf33a('0x4d')]['fn']('IF',db[_0xf33a('0x4d')]['literal']('`state`\x20=\x200,\x201,\x20null'))),_0xf33a('0x4f')],[db[_0xf33a('0x4d')]['fn'](_0xf33a('0x4c'),db[_0xf33a('0x4d')]['fn']('IF',db[_0xf33a('0x4d')][_0xf33a('0x50')](_0xf33a('0x51')))),_0xf33a('0x5a')],[db[_0xf33a('0x4d')]['fn'](_0xf33a('0x4c'),db[_0xf33a('0x4d')]['fn']('IF',db['sequelize'][_0xf33a('0x50')](_0xf33a('0x52')))),_0xf33a('0x53')],[db[_0xf33a('0x4d')]['fn'](_0xf33a('0x4c'),db[_0xf33a('0x4d')]['fn']('IF',db[_0xf33a('0x4d')][_0xf33a('0x50')](_0xf33a('0x5b')))),'congestionContacts'],[db[_0xf33a('0x4d')]['fn'](_0xf33a('0x4c'),db['sequelize']['fn']('IF',db[_0xf33a('0x4d')][_0xf33a('0x50')](_0xf33a('0x55')))),_0xf33a('0x5c')],[db[_0xf33a('0x4d')]['fn'](_0xf33a('0x4c'),db['sequelize']['fn']('IF',db[_0xf33a('0x4d')][_0xf33a('0x50')](_0xf33a('0x5d')))),_0xf33a('0x5e')],[db[_0xf33a('0x4d')]['fn'](_0xf33a('0x4c'),db[_0xf33a('0x4d')]['fn']('IF',db['sequelize'][_0xf33a('0x50')](_0xf33a('0x56')))),'reCallContacts'],[db['sequelize']['fn']('COUNT',db[_0xf33a('0x4d')]['fn']('IF',db[_0xf33a('0x4d')][_0xf33a('0x50')](_0xf33a('0x58')))),_0xf33a('0x5f')]]})[_0xf33a('0x26')](handleEntityNotFound(_0x129229,null))[_0xf33a('0x26')](respondWithResult(_0x129229,null))[_0xf33a('0x42')](handleError(_0x129229,null));};exports[_0xf33a('0x60')]=function(_0x3bebca,_0x40bb02,_0x10a271){return db['VoiceQueue'][_0xf33a('0x4a')]({'where':{'id':_0x3bebca['params']['id']}})['then'](handleEntityNotFound(_0x40bb02,null))[_0xf33a('0x26')](function(_0x25cc49){var _0x132764;if(_0x25cc49){_0x132764=squel['insert']()['into'](_0xf33a('0x61'))['fromQuery']([_0xf33a('0x62'),_0xf33a('0x63'),_0xf33a('0x64'),_0xf33a('0x65'),_0xf33a('0x66'),'createdAt','updatedAt'],squel[_0xf33a('0x67')]()[_0xf33a('0x68')](_0xf33a('0x69'),_0xf33a('0x62'))['field'](_0xf33a('0x6a'),_0xf33a('0x63'))['field'](_0xf33a('0x6b'),_0xf33a('0x64'))[_0xf33a('0x68')]('ANY_VALUE(ListId)',_0xf33a('0x65'))[_0xf33a('0x68')](_0xf33a('0x6c'),_0xf33a('0x66'))['field'](_0xf33a('0x6a'),_0xf33a('0x6d'))[_0xf33a('0x68')]('NOW()',_0xf33a('0x6e'))[_0xf33a('0x6f')](_0xf33a('0x70'))[_0xf33a('0x3b')](_0xf33a('0x71'),_0x3bebca[_0xf33a('0x44')]['id'][_0xf33a('0x72')]())[_0xf33a('0x3b')](_0xf33a('0x73'),_0x3bebca[_0xf33a('0x48')][_0xf33a('0x74')][_0xf33a('0x72')]())[_0xf33a('0x3b')](_0xf33a('0x75'))[_0xf33a('0x3b')]('calleridnum\x20NOT\x20IN\x20(?)',squel[_0xf33a('0x67')]()[_0xf33a('0x68')](_0xf33a('0x62'))[_0xf33a('0x6f')](_0xf33a('0x61'))[_0xf33a('0x3b')](_0xf33a('0x71'),_0x3bebca[_0xf33a('0x44')]['id'][_0xf33a('0x72')]()))[_0xf33a('0x3b')](_0xf33a('0x76'),squel[_0xf33a('0x67')]()[_0xf33a('0x68')](_0xf33a('0x77'))['from'](_0xf33a('0x70'))[_0xf33a('0x3b')](_0xf33a('0x71'),_0x3bebca[_0xf33a('0x44')]['id']['toString']())[_0xf33a('0x3b')](_0xf33a('0x78')))[_0xf33a('0x79')](_0xf33a('0x64')))[_0xf33a('0x72')]();return db[_0xf33a('0x4d')][_0xf33a('0x32')](_0x132764);}return[];})[_0xf33a('0x26')](respondWithResult(_0x40bb02,null))['catch'](handleError(_0x40bb02,null));};exports[_0xf33a('0x7a')]=function(_0x1dfb59,_0x9c0b99,_0x17b2fa){return db['Campaign']['find']({'where':{'id':_0x1dfb59[_0xf33a('0x44')]['id']}})['then'](handleEntityNotFound(_0x9c0b99,null))[_0xf33a('0x26')](function(_0x1595b7){var _0x3d8dbe;if(_0x1595b7){_0x3d8dbe=squel[_0xf33a('0x7b')]()['into']('cm_hopper')[_0xf33a('0x7c')](['phone',_0xf33a('0x63'),_0xf33a('0x64'),_0xf33a('0x65'),_0xf33a('0x7d'),_0xf33a('0x6d'),_0xf33a('0x6e')],squel[_0xf33a('0x67')]()[_0xf33a('0x68')](_0xf33a('0x69'),_0xf33a('0x62'))[_0xf33a('0x68')](_0xf33a('0x6a'),_0xf33a('0x63'))[_0xf33a('0x68')](_0xf33a('0x6b'),_0xf33a('0x64'))['field'](_0xf33a('0x7e'),'ListId')[_0xf33a('0x68')]('ANY_VALUE(CampaignId)','CampaignId')['field'](_0xf33a('0x6a'),_0xf33a('0x6d'))['field'](_0xf33a('0x6a'),_0xf33a('0x6e'))[_0xf33a('0x6f')](_0xf33a('0x70'))[_0xf33a('0x3b')](_0xf33a('0x7f'),_0x1dfb59['params']['id'][_0xf33a('0x72')]())[_0xf33a('0x3b')]('state\x20=\x20?',_0x1dfb59[_0xf33a('0x48')][_0xf33a('0x74')][_0xf33a('0x72')]())['where'](_0xf33a('0x75'))[_0xf33a('0x3b')](_0xf33a('0x76'),squel[_0xf33a('0x67')]()[_0xf33a('0x68')]('phone')[_0xf33a('0x6f')](_0xf33a('0x61'))[_0xf33a('0x3b')](_0xf33a('0x7f'),_0x1dfb59[_0xf33a('0x44')]['id']['toString']()))[_0xf33a('0x3b')](_0xf33a('0x76'),squel[_0xf33a('0x67')]()[_0xf33a('0x68')](_0xf33a('0x77'))['from'](_0xf33a('0x70'))['where']('CampaignId\x20=\x20?',_0x1dfb59[_0xf33a('0x44')]['id']['toString']())[_0xf33a('0x3b')](_0xf33a('0x78')))['group'](_0xf33a('0x64')))[_0xf33a('0x72')]();return db[_0xf33a('0x4d')][_0xf33a('0x32')](_0x3d8dbe);}return[];})[_0xf33a('0x26')](respondWithResult(_0x9c0b99,null))[_0xf33a('0x42')](handleError(_0x9c0b99,null));};exports[_0xf33a('0x80')]=function(_0x4abd84,_0x1205d1,_0x1d83a0){return db[_0xf33a('0x81')][_0xf33a('0x82')]({'where':{'VoiceQueueId':_0x4abd84['body'][_0xf33a('0x66')],'CampaignId':_0x4abd84['body'][_0xf33a('0x7d')],'ContactId':_0x4abd84[_0xf33a('0x48')][_0xf33a('0x64')]}})[_0xf33a('0x26')](handleEntityNotFound(_0x1205d1,null))[_0xf33a('0x26')](function(_0x49c40a){if(_0x49c40a){return _0x49c40a;}return null;})[_0xf33a('0x26')](respondWithResult(_0x1205d1,null))[_0xf33a('0x42')](handleError(_0x1205d1,null));}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.model.js b/server/api/cmHopperFinal/cmHopperFinal.model.js index ada4645..ad8b1c4 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 _0x29cd=['../../config/logger','api','moment','request-promise','../../config/environment','./cmHopperFinal.attributes','exports','define','CmHopperFinal','cm_hopper_final','calleridnum','uniqueid','lodash','util'];(function(_0x46238b,_0x35cbac){var _0xd3a6e1=function(_0x4b1d54){while(--_0x4b1d54){_0x46238b['push'](_0x46238b['shift']());}};_0xd3a6e1(++_0x35cbac);}(_0x29cd,0x186));var _0xd29c=function(_0x107b56,_0x1cf6a7){_0x107b56=_0x107b56-0x0;var _0x6d62ae=_0x29cd[_0x107b56];return _0x6d62ae;};'use strict';var _=require(_0xd29c('0x0'));var util=require(_0xd29c('0x1'));var logger=require(_0xd29c('0x2'))(_0xd29c('0x3'));var moment=require(_0xd29c('0x4'));var BPromise=require('bluebird');var rp=require(_0xd29c('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xd29c('0x6'));var attributes=require(_0xd29c('0x7'));module[_0xd29c('0x8')]=function(_0x1f15cd,_0x1bda26){return _0x1f15cd[_0xd29c('0x9')](_0xd29c('0xa'),attributes,{'tableName':_0xd29c('0xb'),'paranoid':![],'indexes':[{'name':_0xd29c('0xc'),'fields':[_0xd29c('0xc')]},{'name':_0xd29c('0xd'),'fields':[_0xd29c('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x23ed=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmHopperFinal.attributes','exports','define','cm_hopper_final','calleridnum','uniqueid','lodash','util','../../config/logger','api'];(function(_0x2c4973,_0x3184cd){var _0x37189c=function(_0x1cf1d9){while(--_0x1cf1d9){_0x2c4973['push'](_0x2c4973['shift']());}};_0x37189c(++_0x3184cd);}(_0x23ed,0x6c));var _0xd23e=function(_0x45996b,_0x145516){_0x45996b=_0x45996b-0x0;var _0x2defda=_0x23ed[_0x45996b];return _0x2defda;};'use strict';var _=require(_0xd23e('0x0'));var util=require(_0xd23e('0x1'));var logger=require(_0xd23e('0x2'))(_0xd23e('0x3'));var moment=require(_0xd23e('0x4'));var BPromise=require(_0xd23e('0x5'));var rp=require(_0xd23e('0x6'));var fs=require('fs');var path=require(_0xd23e('0x7'));var rimraf=require(_0xd23e('0x8'));var config=require(_0xd23e('0x9'));var attributes=require(_0xd23e('0xa'));module[_0xd23e('0xb')]=function(_0x3f0126,_0x42da8b){return _0x3f0126[_0xd23e('0xc')]('CmHopperFinal',attributes,{'tableName':_0xd23e('0xd'),'paranoid':![],'indexes':[{'name':_0xd23e('0xe'),'fields':[_0xd23e('0xe')]},{'name':_0xd23e('0xf'),'fields':[_0xd23e('0xf')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.rpc.js b/server/api/cmHopperFinal/cmHopperFinal.rpc.js index 136c558..3705c35 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 _0xb10b=['debug','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','CmHopperFinal,\x20%s,\x20%s','CmHopperFinal,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','CreateCmHopperFinal','CmHopperFinal','create','options','raw'];(function(_0x48f3c9,_0x322426){var _0x21b8f9=function(_0x71c6f1){while(--_0x71c6f1){_0x48f3c9['push'](_0x48f3c9['shift']());}};_0x21b8f9(++_0x322426);}(_0xb10b,0x12a));var _0xbb10=function(_0x2da402,_0x14a691){_0x2da402=_0x2da402-0x0;var _0x31a57d=_0xb10b[_0x2da402];return _0x31a57d;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cdd53,_0x513741,_0x1b9e94){return new BPromise(function(_0x3fb675,_0x21370f){return client[_0xbb10('0xb')](_0x3cdd53,_0x1b9e94)[_0xbb10('0xc')](function(_0x1ce33e){logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,'request\x20sent');logger['debug'](_0xbb10('0xf'),_0x513741,_0xbb10('0x10'),JSON[_0xbb10('0x11')](_0x1ce33e));if(_0x1ce33e['error']){if(_0x1ce33e[_0xbb10('0x12')]['code']===0x1f4){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x21370f(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}logger['error'](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x3fb675(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}else{logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,_0xbb10('0x10'));_0x3fb675(_0x1ce33e[_0xbb10('0x14')][_0xbb10('0x13')]);}})['catch'](function(_0x2eca0f){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x2eca0f);_0x21370f(_0x2eca0f);});});}exports[_0xbb10('0x15')]=function(_0x378da8){var _0x1682a4=this;return new Promise(function(_0x575cca,_0x30efc6){return db[_0xbb10('0x16')][_0xbb10('0x17')](_0x378da8['body'],{'raw':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x19')]===undefined?!![]:![]:!![]})[_0xbb10('0xc')](function(_0xdf237d){logger[_0xbb10('0xd')]('CreateCmHopperFinal',_0x378da8);logger[_0xbb10('0x1a')](_0xbb10('0x15'),_0x378da8,JSON['stringify'](_0xdf237d));_0x575cca(_0xdf237d);})['catch'](function(_0x8e2b97){logger[_0xbb10('0x12')](_0xbb10('0x15'),_0x8e2b97[_0xbb10('0x13')],_0x378da8);_0x30efc6(_0x1682a4[_0xbb10('0x12')](0x1f4,_0x8e2b97[_0xbb10('0x13')]));});});}; \ No newline at end of file +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(_0x427038,_0x2f4733){var _0x4e96ed=function(_0x561a7f){while(--_0x561a7f){_0x427038['push'](_0x427038['shift']());}};_0x4e96ed(++_0x2f4733);}(_0x7a54,0x106));var _0x47a5=function(_0x1db59b,_0x457cb2){_0x1db59b=_0x1db59b-0x0;var _0x54044d=_0x7a54[_0x1db59b];return _0x54044d;};'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 ea25453..f73d413 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 _0x633b=['countContactsIvrCampaignHopperFinal','/voice/queue/moveContacts/:id','moveContactsQueueCampaignHopperFinal','/voice/campaign/moveContacts/:id','moveContactsIvrCampaignHopperFinal','checkContactHopper','update','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperFinal.controller','get','isAuthenticated','/describe','describe','/:id','show','/voice/queue/countAttributes/:id','/campaign/countAttributes/:id'];(function(_0x148861,_0x2d512f){var _0x4373ca=function(_0xd6834b){while(--_0xd6834b){_0x148861['push'](_0x148861['shift']());}};_0x4373ca(++_0x2d512f);}(_0x633b,0xd8));var _0xb633=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x633b[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0xb633('0x0'));var util=require(_0xb633('0x1'));var path=require(_0xb633('0x2'));var timeout=require(_0xb633('0x3'));var express=require(_0xb633('0x4'));var router=express['Router']();var fs_extra=require(_0xb633('0x5'));var auth=require(_0xb633('0x6'));var interaction=require(_0xb633('0x7'));var config=require(_0xb633('0x8'));var controller=require(_0xb633('0x9'));router[_0xb633('0xa')]('/',auth[_0xb633('0xb')](),controller['index']);router[_0xb633('0xa')](_0xb633('0xc'),auth['isAuthenticated'](),controller[_0xb633('0xd')]);router[_0xb633('0xa')](_0xb633('0xe'),auth[_0xb633('0xb')](),controller[_0xb633('0xf')]);router[_0xb633('0xa')](_0xb633('0x10'),auth[_0xb633('0xb')](),controller['countContactsQueueCampaignHopperFinal']);router[_0xb633('0xa')](_0xb633('0x11'),auth['isAuthenticated'](),controller[_0xb633('0x12')]);router['post'](_0xb633('0x13'),auth[_0xb633('0xb')](),controller[_0xb633('0x14')]);router['post'](_0xb633('0x15'),auth[_0xb633('0xb')](),controller[_0xb633('0x16')]);router['post']('/checkContactHopper',auth[_0xb633('0xb')](),controller[_0xb633('0x17')]);router['put'](_0xb633('0xe'),auth[_0xb633('0xb')](),controller[_0xb633('0x18')]);module[_0xb633('0x19')]=router; \ No newline at end of file +var _0x347d=['connect-timeout','express','Router','fs-extra','../../components/interaction/service','./cmHopperFinal.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/voice/queue/countAttributes/:id','countContactsQueueCampaignHopperFinal','/campaign/countAttributes/:id','/voice/queue/moveContacts/:id','post','/voice/campaign/moveContacts/:id','/checkContactHopper','checkContactHopper','put','update','exports','multer','util','path'];(function(_0x4bf1c5,_0x17f0a4){var _0x3975c3=function(_0x40d02c){while(--_0x40d02c){_0x4bf1c5['push'](_0x4bf1c5['shift']());}};_0x3975c3(++_0x17f0a4);}(_0x347d,0x177));var _0xd347=function(_0x1e3db9,_0x10f2e1){_0x1e3db9=_0x1e3db9-0x0;var _0x2a28e6=_0x347d[_0x1e3db9];return _0x2a28e6;};'use strict';var multer=require(_0xd347('0x0'));var util=require(_0xd347('0x1'));var path=require(_0xd347('0x2'));var timeout=require(_0xd347('0x3'));var express=require(_0xd347('0x4'));var router=express[_0xd347('0x5')]();var fs_extra=require(_0xd347('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xd347('0x7'));var config=require('../../config/environment');var controller=require(_0xd347('0x8'));router[_0xd347('0x9')]('/',auth[_0xd347('0xa')](),controller[_0xd347('0xb')]);router[_0xd347('0x9')](_0xd347('0xc'),auth['isAuthenticated'](),controller[_0xd347('0xd')]);router[_0xd347('0x9')](_0xd347('0xe'),auth['isAuthenticated'](),controller[_0xd347('0xf')]);router[_0xd347('0x9')](_0xd347('0x10'),auth['isAuthenticated'](),controller[_0xd347('0x11')]);router[_0xd347('0x9')](_0xd347('0x12'),auth[_0xd347('0xa')](),controller['countContactsIvrCampaignHopperFinal']);router['post'](_0xd347('0x13'),auth[_0xd347('0xa')](),controller['moveContactsQueueCampaignHopperFinal']);router[_0xd347('0x14')](_0xd347('0x15'),auth['isAuthenticated'](),controller['moveContactsIvrCampaignHopperFinal']);router[_0xd347('0x14')](_0xd347('0x16'),auth[_0xd347('0xa')](),controller[_0xd347('0x17')]);router[_0xd347('0x18')](_0xd347('0xe'),auth[_0xd347('0xa')](),controller[_0xd347('0x19')]);module[_0xd347('0x1a')]=router; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.attributes.js b/server/api/cmHopperHistory/cmHopperHistory.attributes.js index 0826b7f..03791f5 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 _0x7eab=['STRING','DATE','BOOLEAN','exports','INTEGER'];(function(_0x47b58b,_0x41a189){var _0x46bebe=function(_0x22bbfa){while(--_0x22bbfa){_0x47b58b['push'](_0x47b58b['shift']());}};_0x46bebe(++_0x41a189);}(_0x7eab,0xf8));var _0xb7ea=function(_0x4cd377,_0x18e2fd){_0x4cd377=_0x4cd377-0x0;var _0x7bca1f=_0x7eab[_0x4cd377];return _0x7bca1f;};'use strict';var Sequelize=require('sequelize');module[_0xb7ea('0x0')]={'state':{'type':Sequelize[_0xb7ea('0x1')](0x2)},'statedesc':{'type':Sequelize[_0xb7ea('0x2')]},'scheduledat':{'type':Sequelize[_0xb7ea('0x3')]},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xb7ea('0x1')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0xb7ea('0x1')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0xb7ea('0x2')]},'originatecalleridnum':{'type':Sequelize[_0xb7ea('0x2')]},'originatecalleridname':{'type':Sequelize[_0xb7ea('0x2')]},'calleridnum':{'type':Sequelize[_0xb7ea('0x2')]},'calleridname':{'type':Sequelize[_0xb7ea('0x2')]},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize[_0xb7ea('0x3')]},'droptime':{'type':Sequelize[_0xb7ea('0x3')]},'endtime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize[_0xb7ea('0x1')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0xb7ea('0x1')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0xb7ea('0x1')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0xb7ea('0x1')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0xb7ea('0x2')]},'campaign':{'type':Sequelize[_0xb7ea('0x2')]},'campaigntype':{'type':Sequelize[_0xb7ea('0x2')]},'membername':{'type':Sequelize[_0xb7ea('0x2')]},'reason':{'type':Sequelize['STRING']},'amd':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fax':{'type':Sequelize[_0xb7ea('0x4')],'defaultValue':![]},'callback':{'type':Sequelize[_0xb7ea('0x4')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xb7ea('0x2')],'defaultValue':null},'callbackat':{'type':Sequelize[_0xb7ea('0x3')]},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'editedat':{'type':Sequelize[_0xb7ea('0x3')]},'edited':{'type':Sequelize[_0xb7ea('0x4')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0xb7ea('0x1')],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xb7ea('0x1')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0xb7ea('0x2')]}}; \ No newline at end of file +var _0x911d=['sequelize','exports','INTEGER','DATE','STRING','BOOLEAN'];(function(_0x348ae5,_0x3dddf9){var _0x2e6abf=function(_0x2c4e27){while(--_0x2c4e27){_0x348ae5['push'](_0x348ae5['shift']());}};_0x2e6abf(++_0x3dddf9);}(_0x911d,0xea));var _0xd911=function(_0x503679,_0x1d99bf){_0x503679=_0x503679-0x0;var _0x2c6c2b=_0x911d[_0x503679];return _0x2c6c2b;};'use strict';var Sequelize=require(_0xd911('0x0'));module[_0xd911('0x1')]={'state':{'type':Sequelize[_0xd911('0x2')](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize[_0xd911('0x3')]},'countbusyretry':{'type':Sequelize[_0xd911('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xd911('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0xd911('0x2')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0xd911('0x4')]},'originatecalleridnum':{'type':Sequelize[_0xd911('0x4')]},'originatecalleridname':{'type':Sequelize[_0xd911('0x4')]},'calleridnum':{'type':Sequelize[_0xd911('0x4')]},'calleridname':{'type':Sequelize[_0xd911('0x4')]},'starttime':{'type':Sequelize[_0xd911('0x3')]},'responsetime':{'type':Sequelize[_0xd911('0x3')]},'answertime':{'type':Sequelize['DATE']},'droptime':{'type':Sequelize[_0xd911('0x3')]},'endtime':{'type':Sequelize[_0xd911('0x3')]},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0xd911('0x2')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0xd911('0x2')],'defaultValue':0x0},'followuptime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0xd911('0x4')]},'campaign':{'type':Sequelize[_0xd911('0x4')]},'campaigntype':{'type':Sequelize[_0xd911('0x4')]},'membername':{'type':Sequelize['STRING']},'reason':{'type':Sequelize['STRING']},'amd':{'type':Sequelize[_0xd911('0x5')],'defaultValue':![]},'fax':{'type':Sequelize[_0xd911('0x5')],'defaultValue':![]},'callback':{'type':Sequelize[_0xd911('0x5')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'recallme':{'type':Sequelize[_0xd911('0x5')],'defaultValue':![]},'editedat':{'type':Sequelize[_0xd911('0x3')]},'edited':{'type':Sequelize[_0xd911('0x5')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xd911('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0xd911('0x4')]}}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.controller.js b/server/api/cmHopperHistory/cmHopperHistory.controller.js index 5d5b01e..837182f 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 _0x5b2a=['Content-Range','json','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','CmHopperHistory','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','pick','merge','VIRTUAL','options','findAll','rows','catch','show','includeAll','include','find','body','describe','params','eml-format','zip-dir','request-promise','bluebird','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/logger','api','../../config/license/util','end','status','offset','limit','undefined','count','set'];(function(_0x4f6d88,_0xaaf54a){var _0x395681=function(_0x37bc66){while(--_0x37bc66){_0x4f6d88['push'](_0x4f6d88['shift']());}};_0x395681(++_0xaaf54a);}(_0x5b2a,0x150));var _0xa5b2=function(_0x37d3f3,_0xca010f){_0x37d3f3=_0x37d3f3-0x0;var _0x185c9c=_0x5b2a[_0x37d3f3];return _0x185c9c;};'use strict';var emlformat=require(_0xa5b2('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xa5b2('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa5b2('0x2'));var moment=require('moment');var BPromise=require(_0xa5b2('0x3'));var Mustache=require('mustache');var util=require(_0xa5b2('0x4'));var path=require('path');var sox=require(_0xa5b2('0x5'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa5b2('0x6'));var _=require(_0xa5b2('0x7'));var squel=require(_0xa5b2('0x8'));var crypto=require(_0xa5b2('0x9'));var jsforce=require(_0xa5b2('0xa'));var deskjs=require(_0xa5b2('0xb'));var toCsv=require(_0xa5b2('0xc'));var querystring=require(_0xa5b2('0xd'));var Papa=require(_0xa5b2('0xe'));var Redis=require(_0xa5b2('0xf'));var authService=require(_0xa5b2('0x10'));var qs=require(_0xa5b2('0x11'));var as=require(_0xa5b2('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa5b2('0x13'))(_0xa5b2('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xa5b2('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x508252,_0x5a52b5){_0x5a52b5=_0x5a52b5||0xcc;return function(_0x40d34b){if(_0x40d34b){return _0x508252['sendStatus'](_0x5a52b5);}return _0x508252['status'](_0x5a52b5)[_0xa5b2('0x16')]();};}function respondWithResult(_0x3dcf97,_0x3f06f8){_0x3f06f8=_0x3f06f8||0xc8;return function(_0x4621fe){if(_0x4621fe){return _0x3dcf97[_0xa5b2('0x17')](_0x3f06f8)['json'](_0x4621fe);}};}function respondWithFilteredResult(_0x1e2c69,_0x52dcfe){return function(_0x4efcde){if(_0x4efcde){var _0x125304=typeof _0x52dcfe[_0xa5b2('0x18')]==='undefined'&&typeof _0x52dcfe[_0xa5b2('0x19')]===_0xa5b2('0x1a');var _0x2cb0f3=_0x4efcde[_0xa5b2('0x1b')];var _0x5fe23c=_0x125304?0x0:_0x52dcfe[_0xa5b2('0x18')];var _0x38541f=_0x125304?_0x4efcde['count']:_0x52dcfe[_0xa5b2('0x18')]+_0x52dcfe[_0xa5b2('0x19')];var _0x16525b;if(_0x38541f>=_0x2cb0f3){_0x38541f=_0x2cb0f3;_0x16525b=0xc8;}else{_0x16525b=0xce;}_0x1e2c69[_0xa5b2('0x17')](_0x16525b);return _0x1e2c69[_0xa5b2('0x1c')](_0xa5b2('0x1d'),_0x5fe23c+'-'+_0x38541f+'/'+_0x2cb0f3)[_0xa5b2('0x1e')](_0x4efcde);}return null;};}function patchUpdates(_0x56270d){return function(_0x271616){try{jsonpatch[_0xa5b2('0x1f')](_0x271616,_0x56270d,!![]);}catch(_0x2371c6){return BPromise[_0xa5b2('0x20')](_0x2371c6);}return _0x271616[_0xa5b2('0x21')]();};}function saveUpdates(_0x6fd2ed,_0x49770b){return function(_0x162c0f){if(_0x162c0f){return _0x162c0f[_0xa5b2('0x22')](_0x6fd2ed)[_0xa5b2('0x23')](function(_0x152d6e){return _0x152d6e;});}return null;};}function removeEntity(_0x47a9ab,_0x27dcf3){return function(_0x483563){if(_0x483563){return _0x483563[_0xa5b2('0x24')]()[_0xa5b2('0x23')](function(){_0x47a9ab[_0xa5b2('0x17')](0xcc)[_0xa5b2('0x16')]();});}};}function handleEntityNotFound(_0x5d0895,_0x5a742d){return function(_0x62a31d){if(!_0x62a31d){_0x5d0895[_0xa5b2('0x25')](0x194);}return _0x62a31d;};}function handleError(_0x243422,_0x472e6f){_0x472e6f=_0x472e6f||0x1f4;return function(_0x9a2625){logger[_0xa5b2('0x26')](_0x9a2625[_0xa5b2('0x27')]);if(_0x9a2625[_0xa5b2('0x28')]){delete _0x9a2625['name'];}_0x243422[_0xa5b2('0x17')](_0x472e6f)[_0xa5b2('0x29')](_0x9a2625);};}exports[_0xa5b2('0x2a')]=function(_0xe782bf,_0x3ad11c){var _0x508d64={},_0x2e8230={},_0x2b015d={'count':0x0,'rows':[]};var _0x13e6d2=_[_0xa5b2('0x2b')](db[_0xa5b2('0x2c')]['rawAttributes'],function(_0x18d3ec){return{'name':_0x18d3ec['fieldName'],'type':_0x18d3ec[_0xa5b2('0x2d')][_0xa5b2('0x2e')]};});_0x2e8230[_0xa5b2('0x2f')]=_['map'](_0x13e6d2,_0xa5b2('0x28'));_0x2e8230[_0xa5b2('0x30')]=_[_0xa5b2('0x31')](_0xe782bf[_0xa5b2('0x30')]);_0x2e8230[_0xa5b2('0x32')]=_['intersection'](_0x2e8230[_0xa5b2('0x2f')],_0x2e8230[_0xa5b2('0x30')]);_0x508d64[_0xa5b2('0x33')]=_[_0xa5b2('0x34')](_0x2e8230[_0xa5b2('0x2f')],qs[_0xa5b2('0x35')](_0xe782bf[_0xa5b2('0x30')]['fields']));_0x508d64[_0xa5b2('0x33')]=_0x508d64[_0xa5b2('0x33')][_0xa5b2('0x36')]?_0x508d64[_0xa5b2('0x33')]:_0x2e8230['model'];if(!_0xe782bf['query'][_0xa5b2('0x37')](_0xa5b2('0x38'))){_0x508d64[_0xa5b2('0x19')]=qs['limit'](_0xe782bf[_0xa5b2('0x30')][_0xa5b2('0x19')]);_0x508d64[_0xa5b2('0x18')]=qs[_0xa5b2('0x18')](_0xe782bf[_0xa5b2('0x30')][_0xa5b2('0x18')]);}_0x508d64['order']=qs[_0xa5b2('0x39')](_0xe782bf[_0xa5b2('0x30')][_0xa5b2('0x39')]);_0x508d64[_0xa5b2('0x3a')]=qs[_0xa5b2('0x32')](_[_0xa5b2('0x3b')](_0xe782bf[_0xa5b2('0x30')],_0x2e8230[_0xa5b2('0x32')]),_0x13e6d2);if(_0xe782bf[_0xa5b2('0x30')]['filter']){_0x508d64[_0xa5b2('0x3a')]=_[_0xa5b2('0x3c')](_0x508d64[_0xa5b2('0x3a')],{'$or':_['map'](_0x13e6d2,function(_0x22cd11){if(_0x22cd11[_0xa5b2('0x2d')]!==_0xa5b2('0x3d')){var _0x3bab2e={};_0x3bab2e[_0x22cd11[_0xa5b2('0x28')]]={'$like':'%'+_0xe782bf[_0xa5b2('0x30')]['filter']+'%'};return _0x3bab2e;}})});}_0x508d64=_[_0xa5b2('0x3c')]({},_0x508d64,_0xe782bf[_0xa5b2('0x3e')]);var _0x5e3a07={'where':_0x508d64[_0xa5b2('0x3a')]};return db[_0xa5b2('0x2c')]['count'](_0x5e3a07)[_0xa5b2('0x23')](function(_0x47c0c4){_0x2b015d['count']=_0x47c0c4;if(_0xe782bf[_0xa5b2('0x30')]['includeAll']){_0x508d64['include']=[{'all':!![]}];}return db[_0xa5b2('0x2c')][_0xa5b2('0x3f')](_0x508d64);})['then'](function(_0x27fde4){_0x2b015d[_0xa5b2('0x40')]=_0x27fde4;return _0x2b015d;})[_0xa5b2('0x23')](respondWithFilteredResult(_0x3ad11c,_0x508d64))[_0xa5b2('0x41')](handleError(_0x3ad11c,null));};exports[_0xa5b2('0x42')]=function(_0x5a207e,_0x1adf9a){var _0x563ecc={'raw':!![],'where':{'id':_0x5a207e['params']['id']}},_0x58174f={};_0x58174f[_0xa5b2('0x2f')]=_['keys'](db['CmHopperHistory']['rawAttributes']);_0x58174f[_0xa5b2('0x30')]=_[_0xa5b2('0x31')](_0x5a207e[_0xa5b2('0x30')]);_0x58174f[_0xa5b2('0x32')]=_['intersection'](_0x58174f[_0xa5b2('0x2f')],_0x58174f[_0xa5b2('0x30')]);_0x563ecc['attributes']=_[_0xa5b2('0x34')](_0x58174f[_0xa5b2('0x2f')],qs[_0xa5b2('0x35')](_0x5a207e[_0xa5b2('0x30')][_0xa5b2('0x35')]));_0x563ecc[_0xa5b2('0x33')]=_0x563ecc[_0xa5b2('0x33')]['length']?_0x563ecc[_0xa5b2('0x33')]:_0x58174f[_0xa5b2('0x2f')];if(_0x5a207e[_0xa5b2('0x30')][_0xa5b2('0x43')]){_0x563ecc[_0xa5b2('0x44')]=[{'all':!![]}];}_0x563ecc=_[_0xa5b2('0x3c')]({},_0x563ecc,_0x5a207e[_0xa5b2('0x3e')]);return db['CmHopperHistory'][_0xa5b2('0x45')](_0x563ecc)['then'](handleEntityNotFound(_0x1adf9a,null))[_0xa5b2('0x23')](respondWithResult(_0x1adf9a,null))['catch'](handleError(_0x1adf9a,null));};exports['create']=function(_0x5eeee9,_0x2e9079){return db[_0xa5b2('0x2c')]['create'](_0x5eeee9[_0xa5b2('0x46')],{})['then'](respondWithResult(_0x2e9079,0xc9))['catch'](handleError(_0x2e9079,null));};exports['describe']=function(_0x18f5b2,_0x35534f){return db[_0xa5b2('0x2c')][_0xa5b2('0x47')]()['then'](respondWithResult(_0x35534f,null))['catch'](handleError(_0x35534f,null));};exports[_0xa5b2('0x22')]=function(_0xfc109d,_0x126911){if(_0xfc109d[_0xa5b2('0x46')]['uniqueid']){delete _0xfc109d[_0xa5b2('0x46')]['uniqueid'];}return db[_0xa5b2('0x2c')][_0xa5b2('0x45')]({'where':{'uniqueid':_0xfc109d[_0xa5b2('0x48')]['id']}})[_0xa5b2('0x23')](handleEntityNotFound(_0x126911,null))[_0xa5b2('0x23')](saveUpdates(_0xfc109d[_0xa5b2('0x46')],null))[_0xa5b2('0x23')](respondWithResult(_0x126911,null))['catch'](handleError(_0x126911,null));}; \ No newline at end of file +var _0xa273=['order','sort','where','pick','filter','merge','includeAll','include','findAll','rows','params','length','options','find','catch','create','body','describe','uniqueid','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','undefined','count','offset','limit','apply','reject','save','update','then','destroy','error','name','send','index','map','CmHopperHistory','rawAttributes','type','query','keys','filters','model','intersection','fields','attributes','hasOwnProperty','nolimit'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa273,0x137));var _0x3a27=function(_0x3f4cbd,_0x1757bd){_0x3f4cbd=_0x3f4cbd-0x0;var _0x418022=_0xa273[_0x3f4cbd];return _0x418022;};'use strict';var emlformat=require(_0x3a27('0x0'));var rimraf=require(_0x3a27('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3a27('0x2'));var rp=require('request-promise');var moment=require(_0x3a27('0x3'));var BPromise=require(_0x3a27('0x4'));var Mustache=require(_0x3a27('0x5'));var util=require(_0x3a27('0x6'));var path=require(_0x3a27('0x7'));var sox=require('sox');var csv=require(_0x3a27('0x8'));var ejs=require(_0x3a27('0x9'));var fs=require('fs');var fs_extra=require(_0x3a27('0xa'));var _=require(_0x3a27('0xb'));var squel=require(_0x3a27('0xc'));var crypto=require(_0x3a27('0xd'));var jsforce=require(_0x3a27('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x3a27('0x8'));var querystring=require(_0x3a27('0xf'));var Papa=require('papaparse');var Redis=require(_0x3a27('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x3a27('0x11'));var as=require(_0x3a27('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x3a27('0x13'))('api');var utils=require(_0x3a27('0x14'));var config=require(_0x3a27('0x15'));var licenseUtil=require(_0x3a27('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3d2075,_0x2e05c6){_0x2e05c6=_0x2e05c6||0xcc;return function(_0x29b244){if(_0x29b244){return _0x3d2075[_0x3a27('0x17')](_0x2e05c6);}return _0x3d2075[_0x3a27('0x18')](_0x2e05c6)[_0x3a27('0x19')]();};}function respondWithResult(_0x5b370e,_0x5d5b9c){_0x5d5b9c=_0x5d5b9c||0xc8;return function(_0x928275){if(_0x928275){return _0x5b370e[_0x3a27('0x18')](_0x5d5b9c)[_0x3a27('0x1a')](_0x928275);}};}function respondWithFilteredResult(_0x1c24b5,_0x4b6fb3){return function(_0x774c2b){if(_0x774c2b){var _0x30c9b5=typeof _0x4b6fb3['offset']===_0x3a27('0x1b')&&typeof _0x4b6fb3['limit']===_0x3a27('0x1b');var _0x1840df=_0x774c2b[_0x3a27('0x1c')];var _0x1f3809=_0x30c9b5?0x0:_0x4b6fb3[_0x3a27('0x1d')];var _0x17ec59=_0x30c9b5?_0x774c2b[_0x3a27('0x1c')]:_0x4b6fb3[_0x3a27('0x1d')]+_0x4b6fb3[_0x3a27('0x1e')];var _0xbdb2ea;if(_0x17ec59>=_0x1840df){_0x17ec59=_0x1840df;_0xbdb2ea=0xc8;}else{_0xbdb2ea=0xce;}_0x1c24b5[_0x3a27('0x18')](_0xbdb2ea);return _0x1c24b5['set']('Content-Range',_0x1f3809+'-'+_0x17ec59+'/'+_0x1840df)[_0x3a27('0x1a')](_0x774c2b);}return null;};}function patchUpdates(_0x30466c){return function(_0x57f49e){try{jsonpatch[_0x3a27('0x1f')](_0x57f49e,_0x30466c,!![]);}catch(_0x47161e){return BPromise[_0x3a27('0x20')](_0x47161e);}return _0x57f49e[_0x3a27('0x21')]();};}function saveUpdates(_0x1670dd,_0x7c44d3){return function(_0x219c8f){if(_0x219c8f){return _0x219c8f[_0x3a27('0x22')](_0x1670dd)[_0x3a27('0x23')](function(_0x349f67){return _0x349f67;});}return null;};}function removeEntity(_0x587cc6,_0x11688f){return function(_0x1eb462){if(_0x1eb462){return _0x1eb462[_0x3a27('0x24')]()['then'](function(){_0x587cc6[_0x3a27('0x18')](0xcc)[_0x3a27('0x19')]();});}};}function handleEntityNotFound(_0x3a681e,_0x2d4bf4){return function(_0x40e9b2){if(!_0x40e9b2){_0x3a681e[_0x3a27('0x17')](0x194);}return _0x40e9b2;};}function handleError(_0x616b87,_0x42efcb){_0x42efcb=_0x42efcb||0x1f4;return function(_0x179e1f){logger[_0x3a27('0x25')](_0x179e1f['stack']);if(_0x179e1f[_0x3a27('0x26')]){delete _0x179e1f['name'];}_0x616b87[_0x3a27('0x18')](_0x42efcb)[_0x3a27('0x27')](_0x179e1f);};}exports[_0x3a27('0x28')]=function(_0x37e68b,_0x2e9a2f){var _0x541c14={},_0x598b67={},_0x99da42={'count':0x0,'rows':[]};var _0xfe07fb=_[_0x3a27('0x29')](db[_0x3a27('0x2a')][_0x3a27('0x2b')],function(_0x15ccae){return{'name':_0x15ccae['fieldName'],'type':_0x15ccae[_0x3a27('0x2c')]['key']};});_0x598b67['model']=_['map'](_0xfe07fb,_0x3a27('0x26'));_0x598b67[_0x3a27('0x2d')]=_[_0x3a27('0x2e')](_0x37e68b[_0x3a27('0x2d')]);_0x598b67[_0x3a27('0x2f')]=_['intersection'](_0x598b67[_0x3a27('0x30')],_0x598b67[_0x3a27('0x2d')]);_0x541c14['attributes']=_[_0x3a27('0x31')](_0x598b67[_0x3a27('0x30')],qs[_0x3a27('0x32')](_0x37e68b[_0x3a27('0x2d')]['fields']));_0x541c14[_0x3a27('0x33')]=_0x541c14['attributes']['length']?_0x541c14[_0x3a27('0x33')]:_0x598b67[_0x3a27('0x30')];if(!_0x37e68b[_0x3a27('0x2d')][_0x3a27('0x34')](_0x3a27('0x35'))){_0x541c14['limit']=qs[_0x3a27('0x1e')](_0x37e68b[_0x3a27('0x2d')][_0x3a27('0x1e')]);_0x541c14[_0x3a27('0x1d')]=qs['offset'](_0x37e68b[_0x3a27('0x2d')][_0x3a27('0x1d')]);}_0x541c14[_0x3a27('0x36')]=qs[_0x3a27('0x37')](_0x37e68b[_0x3a27('0x2d')][_0x3a27('0x37')]);_0x541c14[_0x3a27('0x38')]=qs['filters'](_[_0x3a27('0x39')](_0x37e68b[_0x3a27('0x2d')],_0x598b67[_0x3a27('0x2f')]),_0xfe07fb);if(_0x37e68b['query'][_0x3a27('0x3a')]){_0x541c14[_0x3a27('0x38')]=_['merge'](_0x541c14[_0x3a27('0x38')],{'$or':_['map'](_0xfe07fb,function(_0x427157){if(_0x427157[_0x3a27('0x2c')]!=='VIRTUAL'){var _0xcbd6e={};_0xcbd6e[_0x427157[_0x3a27('0x26')]]={'$like':'%'+_0x37e68b['query'][_0x3a27('0x3a')]+'%'};return _0xcbd6e;}})});}_0x541c14=_[_0x3a27('0x3b')]({},_0x541c14,_0x37e68b['options']);var _0xe8bd71={'where':_0x541c14['where']};return db['CmHopperHistory'][_0x3a27('0x1c')](_0xe8bd71)[_0x3a27('0x23')](function(_0x3ca5fb){_0x99da42[_0x3a27('0x1c')]=_0x3ca5fb;if(_0x37e68b[_0x3a27('0x2d')][_0x3a27('0x3c')]){_0x541c14[_0x3a27('0x3d')]=[{'all':!![]}];}return db['CmHopperHistory'][_0x3a27('0x3e')](_0x541c14);})[_0x3a27('0x23')](function(_0x561638){_0x99da42[_0x3a27('0x3f')]=_0x561638;return _0x99da42;})[_0x3a27('0x23')](respondWithFilteredResult(_0x2e9a2f,_0x541c14))['catch'](handleError(_0x2e9a2f,null));};exports['show']=function(_0x2ab313,_0x100720){var _0x5ecd76={'raw':!![],'where':{'id':_0x2ab313[_0x3a27('0x40')]['id']}},_0x86bbc0={};_0x86bbc0[_0x3a27('0x30')]=_[_0x3a27('0x2e')](db[_0x3a27('0x2a')][_0x3a27('0x2b')]);_0x86bbc0[_0x3a27('0x2d')]=_['keys'](_0x2ab313[_0x3a27('0x2d')]);_0x86bbc0[_0x3a27('0x2f')]=_['intersection'](_0x86bbc0[_0x3a27('0x30')],_0x86bbc0[_0x3a27('0x2d')]);_0x5ecd76[_0x3a27('0x33')]=_['intersection'](_0x86bbc0[_0x3a27('0x30')],qs[_0x3a27('0x32')](_0x2ab313[_0x3a27('0x2d')][_0x3a27('0x32')]));_0x5ecd76[_0x3a27('0x33')]=_0x5ecd76['attributes'][_0x3a27('0x41')]?_0x5ecd76[_0x3a27('0x33')]:_0x86bbc0[_0x3a27('0x30')];if(_0x2ab313['query'][_0x3a27('0x3c')]){_0x5ecd76[_0x3a27('0x3d')]=[{'all':!![]}];}_0x5ecd76=_[_0x3a27('0x3b')]({},_0x5ecd76,_0x2ab313[_0x3a27('0x42')]);return db[_0x3a27('0x2a')][_0x3a27('0x43')](_0x5ecd76)[_0x3a27('0x23')](handleEntityNotFound(_0x100720,null))[_0x3a27('0x23')](respondWithResult(_0x100720,null))[_0x3a27('0x44')](handleError(_0x100720,null));};exports[_0x3a27('0x45')]=function(_0x3f440e,_0x3ec5e2){return db[_0x3a27('0x2a')]['create'](_0x3f440e[_0x3a27('0x46')],{})[_0x3a27('0x23')](respondWithResult(_0x3ec5e2,0xc9))['catch'](handleError(_0x3ec5e2,null));};exports[_0x3a27('0x47')]=function(_0x5e0846,_0x26852c){return db['CmHopperHistory']['describe']()[_0x3a27('0x23')](respondWithResult(_0x26852c,null))[_0x3a27('0x44')](handleError(_0x26852c,null));};exports['update']=function(_0x4a0781,_0x37a5ab){if(_0x4a0781[_0x3a27('0x46')][_0x3a27('0x48')]){delete _0x4a0781[_0x3a27('0x46')][_0x3a27('0x48')];}return db[_0x3a27('0x2a')][_0x3a27('0x43')]({'where':{'uniqueid':_0x4a0781[_0x3a27('0x40')]['id']}})[_0x3a27('0x23')](handleEntityNotFound(_0x37a5ab,null))[_0x3a27('0x23')](saveUpdates(_0x4a0781['body'],null))[_0x3a27('0x23')](respondWithResult(_0x37a5ab,null))['catch'](handleError(_0x37a5ab,null));}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.model.js b/server/api/cmHopperHistory/cmHopperHistory.model.js index c269cfe..80de75e 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 _0xd945=['./cmHopperHistory.attributes','exports','define','cm_hopper_history','endtime','uniqueid','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf'];(function(_0x456f08,_0x150572){var _0x4a10bc=function(_0x3e6b8a){while(--_0x3e6b8a){_0x456f08['push'](_0x456f08['shift']());}};_0x4a10bc(++_0x150572);}(_0xd945,0x84));var _0x5d94=function(_0xaa1e08,_0x666878){_0xaa1e08=_0xaa1e08-0x0;var _0x56a968=_0xd945[_0xaa1e08];return _0x56a968;};'use strict';var _=require(_0x5d94('0x0'));var util=require(_0x5d94('0x1'));var logger=require(_0x5d94('0x2'))('api');var moment=require(_0x5d94('0x3'));var BPromise=require(_0x5d94('0x4'));var rp=require(_0x5d94('0x5'));var fs=require('fs');var path=require(_0x5d94('0x6'));var rimraf=require(_0x5d94('0x7'));var config=require('../../config/environment');var attributes=require(_0x5d94('0x8'));module[_0x5d94('0x9')]=function(_0x30b667,_0x3056d3){return _0x30b667[_0x5d94('0xa')]('CmHopperHistory',attributes,{'tableName':_0x5d94('0xb'),'paranoid':![],'indexes':[{'name':_0x5d94('0xc'),'fields':[_0x5d94('0xc')]},{'name':'uniqueid','fields':[_0x5d94('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x1d63=['moment','request-promise','path','rimraf','../../config/environment','./cmHopperHistory.attributes','exports','define','CmHopperHistory','endtime','lodash','util','../../config/logger','api'];(function(_0x54d52,_0x2473ba){var _0x968345=function(_0x3fcd06){while(--_0x3fcd06){_0x54d52['push'](_0x54d52['shift']());}};_0x968345(++_0x2473ba);}(_0x1d63,0xa4));var _0x31d6=function(_0x1cd183,_0xcd1d44){_0x1cd183=_0x1cd183-0x0;var _0x19f585=_0x1d63[_0x1cd183];return _0x19f585;};'use strict';var _=require(_0x31d6('0x0'));var util=require(_0x31d6('0x1'));var logger=require(_0x31d6('0x2'))(_0x31d6('0x3'));var moment=require(_0x31d6('0x4'));var BPromise=require('bluebird');var rp=require(_0x31d6('0x5'));var fs=require('fs');var path=require(_0x31d6('0x6'));var rimraf=require(_0x31d6('0x7'));var config=require(_0x31d6('0x8'));var attributes=require(_0x31d6('0x9'));module[_0x31d6('0xa')]=function(_0x45b5ab,_0x510a88){return _0x45b5ab[_0x31d6('0xb')](_0x31d6('0xc'),attributes,{'tableName':'cm_hopper_history','paranoid':![],'indexes':[{'name':_0x31d6('0xd'),'fields':[_0x31d6('0xd')]},{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.rpc.js b/server/api/cmHopperHistory/cmHopperHistory.rpc.js index 2cef220..17c0d8f 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 _0xda55=['CmHopperHistory','create','body','options','AvgHandleTime','findAll','sequelize','COUNT','col','predictiveIntervalTotalCalls','literal','`state`\x20=\x204,\x201,\x20null','predictiveIntervalDroppedCallsCallersExit','`state`\x20=\x204,\x20`holdtime`,\x20null','predictiveIntervalAvgHoldtime','AVG','predictiveIntervalAvgTalktime','raw','where','campaign','`state`\x20=\x200,\x201,\x20null','outboundNoAnswerCallsDay','outboundAnswerCallsDay','`state`\x20=\x205,\x201,\x20null','outboundBusyCallsDay','`state`\x20=\x208,\x201,\x20null','outboundCongestionCallsDay','outboundDropCallsDayTimeout','`state`\x20=\x2011\x20,\x201,\x20null','outboundDropCallsDayCallersExit','outboundUnknownCallsDay','`state`\x20=\x2013,\x201,\x20null','outboundBlacklistCallsDay','`state`\x20=\x2014,\x201,\x20null','outboundOriginateFailureCallsDay','`state`\x20=\x2018,\x201,\x20null','`state`\x20=\x2016,\x201,\x20null','outboundAnswerAgiCallsDay','outboundRejectCallsDay','`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null','GetVoiceQueueHopperHistory','GetCampaignHopperHistory','name','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','request','then','CmHopperHistory,\x20%s,\x20%s','request\x20sent','debug','CmHopperHistory,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','CreateCmHopperHistory'];(function(_0x5c99f8,_0x5bdd2c){var _0x27b161=function(_0x5608e2){while(--_0x5608e2){_0x5c99f8['push'](_0x5c99f8['shift']());}};_0x27b161(++_0x5bdd2c);}(_0xda55,0x6d));var _0x5da5=function(_0x1f1230,_0x12ae82){_0x1f1230=_0x1f1230-0x0;var _0x3ab793=_0xda55[_0x1f1230];return _0x3ab793;};'use strict';var _=require(_0x5da5('0x0'));var util=require(_0x5da5('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x5da5('0x2'));var fs=require('fs');var Redis=require(_0x5da5('0x3'));var db=require(_0x5da5('0x4'))['db'];var utils=require(_0x5da5('0x5'));var logger=require(_0x5da5('0x6'))('rpc');var config=require(_0x5da5('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x5da5('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2fd877,_0x267469,_0x71b187){return new BPromise(function(_0x46290d,_0x3debdf){return client[_0x5da5('0x9')](_0x2fd877,_0x71b187)[_0x5da5('0xa')](function(_0x302795){logger['info'](_0x5da5('0xb'),_0x267469,_0x5da5('0xc'));logger[_0x5da5('0xd')](_0x5da5('0xe'),_0x267469,_0x5da5('0xc'),JSON[_0x5da5('0xf')](_0x302795));if(_0x302795[_0x5da5('0x10')]){if(_0x302795['error'][_0x5da5('0x11')]===0x1f4){logger[_0x5da5('0x10')]('CmHopperHistory,\x20%s,\x20%s',_0x267469,_0x302795[_0x5da5('0x10')][_0x5da5('0x12')]);return _0x3debdf(_0x302795[_0x5da5('0x10')][_0x5da5('0x12')]);}logger[_0x5da5('0x10')](_0x5da5('0xb'),_0x267469,_0x302795['error']['message']);return _0x46290d(_0x302795['error'][_0x5da5('0x12')]);}else{logger[_0x5da5('0x13')](_0x5da5('0xb'),_0x267469,_0x5da5('0xc'));_0x46290d(_0x302795[_0x5da5('0x14')][_0x5da5('0x12')]);}})[_0x5da5('0x15')](function(_0x4a952a){logger[_0x5da5('0x10')](_0x5da5('0xb'),_0x267469,_0x4a952a);_0x3debdf(_0x4a952a);});});}exports[_0x5da5('0x16')]=function(_0x16b11f){var _0x3f7e98=this;return new Promise(function(_0x428b07,_0x547c58){return db[_0x5da5('0x17')][_0x5da5('0x18')](_0x16b11f[_0x5da5('0x19')],{'raw':_0x16b11f[_0x5da5('0x1a')]?_0x16b11f[_0x5da5('0x1a')]['raw']===undefined?!![]:![]:!![]})[_0x5da5('0xa')](function(_0x3372fc){logger[_0x5da5('0x13')]('CreateCmHopperHistory',_0x16b11f);logger[_0x5da5('0xd')](_0x5da5('0x16'),_0x16b11f,JSON[_0x5da5('0xf')](_0x3372fc));_0x428b07(_0x3372fc);})[_0x5da5('0x15')](function(_0xec69f2){logger[_0x5da5('0x10')]('CreateCmHopperHistory',_0xec69f2[_0x5da5('0x12')],_0x16b11f);_0x547c58(_0x3f7e98['error'](0x1f4,_0xec69f2[_0x5da5('0x12')]));});});};exports[_0x5da5('0x1b')]=function(_0x2dd138){var _0x5d983c=this;return new Promise(function(_0x31c6ed,_0x236bf3){return db[_0x5da5('0x17')][_0x5da5('0x1c')]({'raw':_0x2dd138['options']?_0x2dd138['options']['raw']===undefined?!![]:![]:!![],'where':_0x2dd138[_0x5da5('0x1a')]?_0x2dd138['options']['where']||null:null,'attributes':[[db[_0x5da5('0x1d')]['fn'](_0x5da5('0x1e'),db['sequelize'][_0x5da5('0x1f')]('id')),_0x5da5('0x20')],[db['sequelize']['fn'](_0x5da5('0x1e'),db[_0x5da5('0x1d')]['fn']('IF',db[_0x5da5('0x1d')][_0x5da5('0x21')](_0x5da5('0x22')))),'predictiveIntervalAnsweredCalls'],[db[_0x5da5('0x1d')]['fn'](_0x5da5('0x1e'),db[_0x5da5('0x1d')]['fn']('IF',db[_0x5da5('0x1d')]['literal']('`state`\x20=\x2010,\x201,\x20null'))),'predictiveIntervalDroppedCallsTimeout'],[db[_0x5da5('0x1d')]['fn'](_0x5da5('0x1e'),db[_0x5da5('0x1d')]['fn']('IF',db[_0x5da5('0x1d')]['literal']('`state`\x20=\x2011,\x201,\x20null'))),_0x5da5('0x23')],[db['sequelize']['fn']('AVG',db[_0x5da5('0x1d')]['fn']('IF',db['sequelize'][_0x5da5('0x21')](_0x5da5('0x24')))),_0x5da5('0x25')],[db[_0x5da5('0x1d')]['fn'](_0x5da5('0x26'),db[_0x5da5('0x1d')]['fn']('IF',db[_0x5da5('0x1d')][_0x5da5('0x21')]('`state`\x20=\x204,\x20`talktime`,\x20null'))),_0x5da5('0x27')]]})['then'](function(_0x203f47){logger[_0x5da5('0x13')](_0x5da5('0x1b'),_0x2dd138);logger[_0x5da5('0xd')](_0x5da5('0x1b'),_0x2dd138,JSON[_0x5da5('0xf')](_0x203f47));_0x31c6ed(_0x203f47);})[_0x5da5('0x15')](function(_0x117610){logger[_0x5da5('0x10')](_0x5da5('0x1b'),_0x117610[_0x5da5('0x12')],_0x2dd138);_0x236bf3(_0x5d983c[_0x5da5('0x10')](0x1f4,_0x117610[_0x5da5('0x12')]));});});};exports['GetVoiceQueueHopperHistory']=function(_0x43686c){var _0x4cf3ad=this;return new Promise(function(_0x2d6280,_0x40f6c6){return db[_0x5da5('0x17')][_0x5da5('0x1c')]({'raw':_0x43686c['options']?_0x43686c[_0x5da5('0x1a')][_0x5da5('0x28')]===undefined?!![]:![]:!![],'where':_0x43686c[_0x5da5('0x1a')]?_0x43686c['options'][_0x5da5('0x29')]||null:null,'attributes':[[_0x5da5('0x2a'),'name'],[db[_0x5da5('0x1d')]['fn'](_0x5da5('0x1e'),db[_0x5da5('0x1d')]['fn']('IF',db[_0x5da5('0x1d')][_0x5da5('0x21')](_0x5da5('0x2b')))),'outboundNoSuchCallsDay'],[db[_0x5da5('0x1d')]['fn'](_0x5da5('0x1e'),db[_0x5da5('0x1d')]['fn']('IF',db[_0x5da5('0x1d')][_0x5da5('0x21')]('`state`\x20=\x203,\x201,\x20null'))),_0x5da5('0x2c')],[db[_0x5da5('0x1d')]['fn']('COUNT',db[_0x5da5('0x1d')]['fn']('IF',db['sequelize']['literal'](_0x5da5('0x22')))),_0x5da5('0x2d')],[db[_0x5da5('0x1d')]['fn'](_0x5da5('0x1e'),db[_0x5da5('0x1d')]['fn']('IF',db[_0x5da5('0x1d')][_0x5da5('0x21')](_0x5da5('0x2e')))),_0x5da5('0x2f')],[db[_0x5da5('0x1d')]['fn'](_0x5da5('0x1e'),db[_0x5da5('0x1d')]['fn']('IF',db[_0x5da5('0x1d')][_0x5da5('0x21')](_0x5da5('0x30')))),_0x5da5('0x31')],[db[_0x5da5('0x1d')]['fn'](_0x5da5('0x1e'),db[_0x5da5('0x1d')]['fn']('IF',db[_0x5da5('0x1d')]['literal']('`state`\x20=\x2010\x20,\x201,\x20null'))),_0x5da5('0x32')],[db[_0x5da5('0x1d')]['fn']('COUNT',db[_0x5da5('0x1d')]['fn']('IF',db[_0x5da5('0x1d')][_0x5da5('0x21')](_0x5da5('0x33')))),_0x5da5('0x34')],[db[_0x5da5('0x1d')]['fn'](_0x5da5('0x1e'),db[_0x5da5('0x1d')]['fn']('IF',db[_0x5da5('0x1d')][_0x5da5('0x21')]('`state`\x20=\x2012,\x201,\x20null'))),_0x5da5('0x35')],[db['sequelize']['fn']('COUNT',db[_0x5da5('0x1d')]['fn']('IF',db[_0x5da5('0x1d')][_0x5da5('0x21')](_0x5da5('0x36')))),_0x5da5('0x37')],[db[_0x5da5('0x1d')]['fn']('COUNT',db[_0x5da5('0x1d')]['fn']('IF',db['sequelize']['literal'](_0x5da5('0x38')))),_0x5da5('0x39')],[db['sequelize']['fn'](_0x5da5('0x1e'),db[_0x5da5('0x1d')]['fn']('IF',db[_0x5da5('0x1d')][_0x5da5('0x21')](_0x5da5('0x3a')))),'outboundRejectCallsDay'],[db[_0x5da5('0x1d')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x5da5('0x1d')]['literal'](_0x5da5('0x3b')))),_0x5da5('0x3c')],[db[_0x5da5('0x1d')]['fn'](_0x5da5('0x1e'),db[_0x5da5('0x1d')]['fn']('IF',db[_0x5da5('0x1d')]['literal']('`state`\x20=\x2020,\x201,\x20null'))),_0x5da5('0x3d')],[db[_0x5da5('0x1d')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x5da5('0x1d')]['literal'](_0x5da5('0x3e')))),'outboundReCallsDay']],'group':['campaign']})[_0x5da5('0xa')](function(_0x323655){logger[_0x5da5('0x13')](_0x5da5('0x3f'),_0x43686c);logger['debug'](_0x5da5('0x3f'),_0x43686c,JSON[_0x5da5('0xf')](_0x323655));_0x2d6280(_0x323655);})[_0x5da5('0x15')](function(_0x56523b){logger[_0x5da5('0x10')](_0x5da5('0x3f'),_0x56523b[_0x5da5('0x12')],_0x43686c);_0x40f6c6(_0x4cf3ad[_0x5da5('0x10')](0x1f4,_0x56523b[_0x5da5('0x12')]));});});};exports[_0x5da5('0x40')]=function(_0x1ba087){var _0x53c7dd=this;return new Promise(function(_0x3d1a54,_0xc8b955){return db[_0x5da5('0x17')][_0x5da5('0x1c')]({'raw':_0x1ba087[_0x5da5('0x1a')]?_0x1ba087[_0x5da5('0x1a')][_0x5da5('0x28')]===undefined?!![]:![]:!![],'where':_0x1ba087[_0x5da5('0x1a')]?_0x1ba087[_0x5da5('0x1a')][_0x5da5('0x29')]||null:null,'attributes':[[_0x5da5('0x2a'),_0x5da5('0x41')],[db[_0x5da5('0x1d')]['fn']('COUNT',db[_0x5da5('0x1d')][_0x5da5('0x1f')]('id')),'ivrTotalCallsDays'],[db['sequelize']['fn']('COUNT',db[_0x5da5('0x1d')]['fn']('IF',db[_0x5da5('0x1d')][_0x5da5('0x21')]('`state`\x20=\x204,\x201,\x20null'))),'ivrAnswerCallsDay']],'group':[_0x5da5('0x2a')]})[_0x5da5('0xa')](function(_0x2b085b){logger[_0x5da5('0x13')]('GetCampaignHopperHistory',_0x1ba087);logger[_0x5da5('0xd')](_0x5da5('0x40'),_0x1ba087,JSON[_0x5da5('0xf')](_0x2b085b));_0x3d1a54(_0x2b085b);})['catch'](function(_0x2d6e0f){logger['error'](_0x5da5('0x40'),_0x2d6e0f[_0x5da5('0x12')],_0x1ba087);_0xc8b955(_0x53c7dd[_0x5da5('0x10')](0x1f4,_0x2d6e0f[_0x5da5('0x12')]));});});}; \ No newline at end of file +var _0x3bc8=['rpc','../../config/environment','http','then','CmHopperHistory,\x20%s,\x20%s','request\x20sent','debug','CmHopperHistory,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','CreateCmHopperHistory','CmHopperHistory','create','body','options','raw','AvgHandleTime','sequelize','COUNT','literal','`state`\x20=\x204,\x201,\x20null','predictiveIntervalAnsweredCalls','`state`\x20=\x2010,\x201,\x20null','predictiveIntervalDroppedCallsTimeout','`state`\x20=\x2011,\x201,\x20null','`state`\x20=\x204,\x20`holdtime`,\x20null','predictiveIntervalAvgHoldtime','AVG','`state`\x20=\x204,\x20`talktime`,\x20null','predictiveIntervalAvgTalktime','GetVoiceQueueHopperHistory','findAll','where','campaign','name','outboundNoSuchCallsDay','`state`\x20=\x203,\x201,\x20null','outboundNoAnswerCallsDay','outboundAnswerCallsDay','outboundBusyCallsDay','`state`\x20=\x2010\x20,\x201,\x20null','outboundDropCallsDayTimeout','`state`\x20=\x2011\x20,\x201,\x20null','outboundUnknownCallsDay','`state`\x20=\x2013,\x201,\x20null','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','`state`\x20=\x2018,\x201,\x20null','outboundRejectCallsDay','`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null','outboundReCallsDay','GetCampaignHopperHistory','col','util','moment','bluebird','ioredis','../../config/logger'];(function(_0x3b510b,_0x227e17){var _0x1428e0=function(_0x902791){while(--_0x902791){_0x3b510b['push'](_0x3b510b['shift']());}};_0x1428e0(++_0x227e17);}(_0x3bc8,0x1f3));var _0x83bc=function(_0x4b90b3,_0x164fb2){_0x4b90b3=_0x4b90b3-0x0;var _0x45472e=_0x3bc8[_0x4b90b3];return _0x45472e;};'use strict';var _=require('lodash');var util=require(_0x83bc('0x0'));var moment=require(_0x83bc('0x1'));var BPromise=require(_0x83bc('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x83bc('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x83bc('0x4'))(_0x83bc('0x5'));var config=require(_0x83bc('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0x83bc('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x571287,_0x2672d6,_0x4e952c){return new BPromise(function(_0x2793b6,_0x4a1bfe){return client['request'](_0x571287,_0x4e952c)[_0x83bc('0x8')](function(_0x465f13){logger['info'](_0x83bc('0x9'),_0x2672d6,_0x83bc('0xa'));logger[_0x83bc('0xb')](_0x83bc('0xc'),_0x2672d6,'request\x20sent',JSON[_0x83bc('0xd')](_0x465f13));if(_0x465f13[_0x83bc('0xe')]){if(_0x465f13['error'][_0x83bc('0xf')]===0x1f4){logger[_0x83bc('0xe')](_0x83bc('0x9'),_0x2672d6,_0x465f13[_0x83bc('0xe')][_0x83bc('0x10')]);return _0x4a1bfe(_0x465f13[_0x83bc('0xe')][_0x83bc('0x10')]);}logger['error'](_0x83bc('0x9'),_0x2672d6,_0x465f13[_0x83bc('0xe')][_0x83bc('0x10')]);return _0x2793b6(_0x465f13[_0x83bc('0xe')][_0x83bc('0x10')]);}else{logger[_0x83bc('0x11')](_0x83bc('0x9'),_0x2672d6,_0x83bc('0xa'));_0x2793b6(_0x465f13[_0x83bc('0x12')]['message']);}})[_0x83bc('0x13')](function(_0x252dc0){logger[_0x83bc('0xe')](_0x83bc('0x9'),_0x2672d6,_0x252dc0);_0x4a1bfe(_0x252dc0);});});}exports[_0x83bc('0x14')]=function(_0x1b9955){var _0xec1d21=this;return new Promise(function(_0x3eb1c0,_0x3e2760){return db[_0x83bc('0x15')][_0x83bc('0x16')](_0x1b9955[_0x83bc('0x17')],{'raw':_0x1b9955['options']?_0x1b9955[_0x83bc('0x18')][_0x83bc('0x19')]===undefined?!![]:![]:!![]})[_0x83bc('0x8')](function(_0x4b8813){logger[_0x83bc('0x11')](_0x83bc('0x14'),_0x1b9955);logger[_0x83bc('0xb')](_0x83bc('0x14'),_0x1b9955,JSON[_0x83bc('0xd')](_0x4b8813));_0x3eb1c0(_0x4b8813);})[_0x83bc('0x13')](function(_0x4f3409){logger['error']('CreateCmHopperHistory',_0x4f3409[_0x83bc('0x10')],_0x1b9955);_0x3e2760(_0xec1d21[_0x83bc('0xe')](0x1f4,_0x4f3409[_0x83bc('0x10')]));});});};exports[_0x83bc('0x1a')]=function(_0x32b308){var _0x5d8b59=this;return new Promise(function(_0x3cf002,_0x5ea9f2){return db[_0x83bc('0x15')]['findAll']({'raw':_0x32b308[_0x83bc('0x18')]?_0x32b308['options'][_0x83bc('0x19')]===undefined?!![]:![]:!![],'where':_0x32b308[_0x83bc('0x18')]?_0x32b308[_0x83bc('0x18')]['where']||null:null,'attributes':[[db['sequelize']['fn']('COUNT',db[_0x83bc('0x1b')]['col']('id')),'predictiveIntervalTotalCalls'],[db[_0x83bc('0x1b')]['fn'](_0x83bc('0x1c'),db[_0x83bc('0x1b')]['fn']('IF',db['sequelize'][_0x83bc('0x1d')](_0x83bc('0x1e')))),_0x83bc('0x1f')],[db['sequelize']['fn'](_0x83bc('0x1c'),db[_0x83bc('0x1b')]['fn']('IF',db[_0x83bc('0x1b')]['literal'](_0x83bc('0x20')))),_0x83bc('0x21')],[db[_0x83bc('0x1b')]['fn']('COUNT',db[_0x83bc('0x1b')]['fn']('IF',db['sequelize'][_0x83bc('0x1d')](_0x83bc('0x22')))),'predictiveIntervalDroppedCallsCallersExit'],[db[_0x83bc('0x1b')]['fn']('AVG',db[_0x83bc('0x1b')]['fn']('IF',db[_0x83bc('0x1b')][_0x83bc('0x1d')](_0x83bc('0x23')))),_0x83bc('0x24')],[db[_0x83bc('0x1b')]['fn'](_0x83bc('0x25'),db[_0x83bc('0x1b')]['fn']('IF',db['sequelize'][_0x83bc('0x1d')](_0x83bc('0x26')))),_0x83bc('0x27')]]})['then'](function(_0x1931d9){logger[_0x83bc('0x11')]('AvgHandleTime',_0x32b308);logger['debug'](_0x83bc('0x1a'),_0x32b308,JSON['stringify'](_0x1931d9));_0x3cf002(_0x1931d9);})[_0x83bc('0x13')](function(_0x4c2eb4){logger[_0x83bc('0xe')]('AvgHandleTime',_0x4c2eb4[_0x83bc('0x10')],_0x32b308);_0x5ea9f2(_0x5d8b59[_0x83bc('0xe')](0x1f4,_0x4c2eb4[_0x83bc('0x10')]));});});};exports[_0x83bc('0x28')]=function(_0x9729f1){var _0x3463cd=this;return new Promise(function(_0x4fefe5,_0x55bb2a){return db[_0x83bc('0x15')][_0x83bc('0x29')]({'raw':_0x9729f1[_0x83bc('0x18')]?_0x9729f1[_0x83bc('0x18')][_0x83bc('0x19')]===undefined?!![]:![]:!![],'where':_0x9729f1[_0x83bc('0x18')]?_0x9729f1[_0x83bc('0x18')][_0x83bc('0x2a')]||null:null,'attributes':[[_0x83bc('0x2b'),_0x83bc('0x2c')],[db[_0x83bc('0x1b')]['fn']('COUNT',db[_0x83bc('0x1b')]['fn']('IF',db[_0x83bc('0x1b')][_0x83bc('0x1d')]('`state`\x20=\x200,\x201,\x20null'))),_0x83bc('0x2d')],[db[_0x83bc('0x1b')]['fn']('COUNT',db[_0x83bc('0x1b')]['fn']('IF',db['sequelize'][_0x83bc('0x1d')](_0x83bc('0x2e')))),_0x83bc('0x2f')],[db[_0x83bc('0x1b')]['fn']('COUNT',db[_0x83bc('0x1b')]['fn']('IF',db[_0x83bc('0x1b')][_0x83bc('0x1d')](_0x83bc('0x1e')))),_0x83bc('0x30')],[db[_0x83bc('0x1b')]['fn'](_0x83bc('0x1c'),db[_0x83bc('0x1b')]['fn']('IF',db[_0x83bc('0x1b')][_0x83bc('0x1d')]('`state`\x20=\x205,\x201,\x20null'))),_0x83bc('0x31')],[db['sequelize']['fn'](_0x83bc('0x1c'),db[_0x83bc('0x1b')]['fn']('IF',db[_0x83bc('0x1b')][_0x83bc('0x1d')]('`state`\x20=\x208,\x201,\x20null'))),'outboundCongestionCallsDay'],[db[_0x83bc('0x1b')]['fn'](_0x83bc('0x1c'),db[_0x83bc('0x1b')]['fn']('IF',db[_0x83bc('0x1b')][_0x83bc('0x1d')](_0x83bc('0x32')))),_0x83bc('0x33')],[db[_0x83bc('0x1b')]['fn'](_0x83bc('0x1c'),db[_0x83bc('0x1b')]['fn']('IF',db['sequelize'][_0x83bc('0x1d')](_0x83bc('0x34')))),'outboundDropCallsDayCallersExit'],[db[_0x83bc('0x1b')]['fn']('COUNT',db[_0x83bc('0x1b')]['fn']('IF',db['sequelize']['literal']('`state`\x20=\x2012,\x201,\x20null'))),_0x83bc('0x35')],[db['sequelize']['fn'](_0x83bc('0x1c'),db[_0x83bc('0x1b')]['fn']('IF',db['sequelize'][_0x83bc('0x1d')](_0x83bc('0x36')))),_0x83bc('0x37')],[db[_0x83bc('0x1b')]['fn'](_0x83bc('0x1c'),db['sequelize']['fn']('IF',db[_0x83bc('0x1b')][_0x83bc('0x1d')]('`state`\x20=\x2014,\x201,\x20null'))),_0x83bc('0x38')],[db[_0x83bc('0x1b')]['fn'](_0x83bc('0x1c'),db['sequelize']['fn']('IF',db[_0x83bc('0x1b')][_0x83bc('0x1d')](_0x83bc('0x39')))),_0x83bc('0x3a')],[db[_0x83bc('0x1b')]['fn'](_0x83bc('0x1c'),db[_0x83bc('0x1b')]['fn']('IF',db[_0x83bc('0x1b')][_0x83bc('0x1d')]('`state`\x20=\x2016,\x201,\x20null'))),'outboundAnswerAgiCallsDay'],[db[_0x83bc('0x1b')]['fn'](_0x83bc('0x1c'),db[_0x83bc('0x1b')]['fn']('IF',db['sequelize']['literal']('`state`\x20=\x2020,\x201,\x20null'))),_0x83bc('0x3a')],[db[_0x83bc('0x1b')]['fn'](_0x83bc('0x1c'),db[_0x83bc('0x1b')]['fn']('IF',db['sequelize'][_0x83bc('0x1d')](_0x83bc('0x3b')))),_0x83bc('0x3c')]],'group':[_0x83bc('0x2b')]})['then'](function(_0x10763e){logger['info']('GetVoiceQueueHopperHistory',_0x9729f1);logger[_0x83bc('0xb')](_0x83bc('0x28'),_0x9729f1,JSON['stringify'](_0x10763e));_0x4fefe5(_0x10763e);})['catch'](function(_0x5c2d24){logger[_0x83bc('0xe')](_0x83bc('0x28'),_0x5c2d24[_0x83bc('0x10')],_0x9729f1);_0x55bb2a(_0x3463cd[_0x83bc('0xe')](0x1f4,_0x5c2d24['message']));});});};exports[_0x83bc('0x3d')]=function(_0x1dee77){var _0x5a8364=this;return new Promise(function(_0x545751,_0x2dc9eb){return db[_0x83bc('0x15')][_0x83bc('0x29')]({'raw':_0x1dee77['options']?_0x1dee77[_0x83bc('0x18')][_0x83bc('0x19')]===undefined?!![]:![]:!![],'where':_0x1dee77[_0x83bc('0x18')]?_0x1dee77[_0x83bc('0x18')][_0x83bc('0x2a')]||null:null,'attributes':[[_0x83bc('0x2b'),_0x83bc('0x2c')],[db['sequelize']['fn'](_0x83bc('0x1c'),db[_0x83bc('0x1b')][_0x83bc('0x3e')]('id')),'ivrTotalCallsDays'],[db[_0x83bc('0x1b')]['fn']('COUNT',db[_0x83bc('0x1b')]['fn']('IF',db[_0x83bc('0x1b')][_0x83bc('0x1d')](_0x83bc('0x1e')))),'ivrAnswerCallsDay']],'group':[_0x83bc('0x2b')]})[_0x83bc('0x8')](function(_0x406a16){logger[_0x83bc('0x11')](_0x83bc('0x3d'),_0x1dee77);logger[_0x83bc('0xb')](_0x83bc('0x3d'),_0x1dee77,JSON['stringify'](_0x406a16));_0x545751(_0x406a16);})[_0x83bc('0x13')](function(_0x5dc04c){logger[_0x83bc('0xe')]('GetCampaignHopperHistory',_0x5dc04c[_0x83bc('0x10')],_0x1dee77);_0x2dc9eb(_0x5a8364['error'](0x1f4,_0x5dc04c[_0x83bc('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/index.js b/server/api/cmHopperHistory/index.js index af93f42..11366b7 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 _0x3959=['put','update','exports','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./cmHopperHistory.controller','isAuthenticated','get','/describe','describe','/:id','show','create'];(function(_0x2a8c21,_0x163576){var _0x5f3061=function(_0x4dc8eb){while(--_0x4dc8eb){_0x2a8c21['push'](_0x2a8c21['shift']());}};_0x5f3061(++_0x163576);}(_0x3959,0x123));var _0x9395=function(_0x13e827,_0x361cf1){_0x13e827=_0x13e827-0x0;var _0x5b5256=_0x3959[_0x13e827];return _0x5b5256;};'use strict';var multer=require(_0x9395('0x0'));var util=require(_0x9395('0x1'));var path=require(_0x9395('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x9395('0x3')]();var fs_extra=require(_0x9395('0x4'));var auth=require(_0x9395('0x5'));var interaction=require(_0x9395('0x6'));var config=require('../../config/environment');var controller=require(_0x9395('0x7'));router['get']('/',auth[_0x9395('0x8')](),controller['index']);router[_0x9395('0x9')](_0x9395('0xa'),auth[_0x9395('0x8')](),controller[_0x9395('0xb')]);router[_0x9395('0x9')](_0x9395('0xc'),auth['isAuthenticated'](),controller[_0x9395('0xd')]);router['post']('/',auth[_0x9395('0x8')](),controller[_0x9395('0xe')]);router[_0x9395('0xf')](_0x9395('0xc'),auth['isAuthenticated'](),controller[_0x9395('0x10')]);module[_0x9395('0x11')]=router; \ No newline at end of file +var _0x51bf=['./cmHopperHistory.controller','isAuthenticated','index','get','/describe','describe','/:id','show','post','create','put','update','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x5f1e1c,_0x329fc6){var _0x5981f5=function(_0x2f1db5){while(--_0x2f1db5){_0x5f1e1c['push'](_0x5f1e1c['shift']());}};_0x5981f5(++_0x329fc6);}(_0x51bf,0x1b1));var _0xf51b=function(_0x1788cc,_0x8ed663){_0x1788cc=_0x1788cc-0x0;var _0x865d6d=_0x51bf[_0x1788cc];return _0x865d6d;};'use strict';var multer=require(_0xf51b('0x0'));var util=require('util');var path=require(_0xf51b('0x1'));var timeout=require(_0xf51b('0x2'));var express=require(_0xf51b('0x3'));var router=express[_0xf51b('0x4')]();var fs_extra=require(_0xf51b('0x5'));var auth=require(_0xf51b('0x6'));var interaction=require(_0xf51b('0x7'));var config=require('../../config/environment');var controller=require(_0xf51b('0x8'));router['get']('/',auth[_0xf51b('0x9')](),controller[_0xf51b('0xa')]);router[_0xf51b('0xb')](_0xf51b('0xc'),auth['isAuthenticated'](),controller[_0xf51b('0xd')]);router[_0xf51b('0xb')](_0xf51b('0xe'),auth[_0xf51b('0x9')](),controller[_0xf51b('0xf')]);router[_0xf51b('0x10')]('/',auth[_0xf51b('0x9')](),controller[_0xf51b('0x11')]);router[_0xf51b('0x12')](_0xf51b('0xe'),auth[_0xf51b('0x9')](),controller[_0xf51b('0x13')]);module[_0xf51b('0x14')]=router; \ No newline at end of file diff --git a/server/api/cmList/cmList.attributes.js b/server/api/cmList/cmList.attributes.js index 61d6850..9f3f334 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 _0x96a2=['sequelize','STRING','name'];(function(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0x96a2,0x96));var _0x296a=function(_0x4500d3,_0x4340fc){_0x4500d3=_0x4500d3-0x0;var _0x3c85ce=_0x96a2[_0x4500d3];return _0x3c85ce;};'use strict';var Sequelize=require(_0x296a('0x0'));module['exports']={'name':{'type':Sequelize[_0x296a('0x1')],'unique':_0x296a('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x296a('0x1')]},'dialPrefix':{'type':Sequelize[_0x296a('0x1')]}}; \ No newline at end of file +var _0x165d=['STRING','name','sequelize','exports'];(function(_0x5c3ae9,_0x450f9a){var _0x3f5950=function(_0x594c1f){while(--_0x594c1f){_0x5c3ae9['push'](_0x5c3ae9['shift']());}};_0x3f5950(++_0x450f9a);}(_0x165d,0x14a));var _0xd165=function(_0x496b38,_0x62925c){_0x496b38=_0x496b38-0x0;var _0x3183c2=_0x165d[_0x496b38];return _0x3183c2;};'use strict';var Sequelize=require(_0xd165('0x0'));module[_0xd165('0x1')]={'name':{'type':Sequelize[_0xd165('0x2')],'unique':_0xd165('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xd165('0x2')]},'dialPrefix':{'type':Sequelize[_0xd165('0x2')]}}; \ No newline at end of file diff --git a/server/api/cmList/cmList.controller.js b/server/api/cmList/cmList.controller.js index 31b91aa..91e22fe 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 _0x9553=['sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./cmList.socket','register','status','end','json','undefined','count','set','Content-Range','reject','save','update','then','destroy','get','Lists','UserProfileResource','sendStatus','name','send','map','CmList','type','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','offset','sort','where','pick','filter','VIRTUAL','merge','options','rows','show','keys','rawAttributes','include','find','catch','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','params','describe','addDisposition','getDispositions','findOne','Disposition','ListId','findAll','removeDispositions','ids','addContacts','CmContact','isArray','tags','join','push','each','omit','success','dataValues','errors','message','Malformed\x20request\x20syntax','getContacts','CmCustomField','CustomFields','concat','format','cf_%d','order','raw','getContactsCsv','writeFileSync','/tmp/list_%d_%s.csv','setHeader','Content-disposition','attachment;\x20filename=','Content-type','text/csv','download','addCustomField','transaction','addCustomFields','text','Sequelize','number','INTEGER','switch','BOOLEAN','defaultValue','sequelize','queryInterface','addColumn','cf_%s','getCustomFields','findAndCountAll','addAgents','spread','emit','userCmList:save','removeAgents','userCmList:remove','getAgents','User','rimraf','fast-json-patch','bluebird','mustache','path'];(function(_0xbe200f,_0x4b50eb){var _0x192597=function(_0x106cfd){while(--_0x106cfd){_0xbe200f['push'](_0xbe200f['shift']());}};_0x192597(++_0x4b50eb);}(_0x9553,0x91));var _0x3955=function(_0x45d55e,_0x2fede3){_0x45d55e=_0x45d55e-0x0;var _0x29812a=_0x9553[_0x45d55e];return _0x29812a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3955('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3955('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x3955('0x2'));var Mustache=require(_0x3955('0x3'));var util=require('util');var path=require(_0x3955('0x4'));var sox=require(_0x3955('0x5'));var csv=require(_0x3955('0x6'));var ejs=require(_0x3955('0x7'));var fs=require('fs');var fs_extra=require(_0x3955('0x8'));var _=require(_0x3955('0x9'));var squel=require(_0x3955('0xa'));var crypto=require(_0x3955('0xb'));var jsforce=require(_0x3955('0xc'));var deskjs=require(_0x3955('0xd'));var toCsv=require(_0x3955('0x6'));var querystring=require(_0x3955('0xe'));var Papa=require(_0x3955('0xf'));var Redis=require(_0x3955('0x10'));var authService=require(_0x3955('0x11'));var qs=require(_0x3955('0x12'));var as=require(_0x3955('0x13'));var hardwareService=require(_0x3955('0x14'));var logger=require('../../config/logger')(_0x3955('0x15'));var utils=require('../../config/utils');var config=require(_0x3955('0x16'));var licenseUtil=require(_0x3955('0x17'));var db=require(_0x3955('0x18'))['db'];config[_0x3955('0x19')]=_[_0x3955('0x1a')](config[_0x3955('0x19')],{'host':_0x3955('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x3955('0x19')]));require(_0x3955('0x1c'))[_0x3955('0x1d')](socket);function respondWithStatusCode(_0x15d84a,_0x42f7ec){_0x42f7ec=_0x42f7ec||0xcc;return function(_0xeab3b){if(_0xeab3b){return _0x15d84a['sendStatus'](_0x42f7ec);}return _0x15d84a[_0x3955('0x1e')](_0x42f7ec)[_0x3955('0x1f')]();};}function respondWithResult(_0x486778,_0x5bcfaa){_0x5bcfaa=_0x5bcfaa||0xc8;return function(_0x45aee3){if(_0x45aee3){return _0x486778['status'](_0x5bcfaa)[_0x3955('0x20')](_0x45aee3);}};}function respondWithFilteredResult(_0x9a3bc4,_0x219b7a){return function(_0x3ac7dd){if(_0x3ac7dd){var _0x2d0549=typeof _0x219b7a['offset']===_0x3955('0x21')&&typeof _0x219b7a['limit']==='undefined';var _0x1cc1f8=_0x3ac7dd[_0x3955('0x22')];var _0x339895=_0x2d0549?0x0:_0x219b7a['offset'];var _0x4030df=_0x2d0549?_0x3ac7dd[_0x3955('0x22')]:_0x219b7a['offset']+_0x219b7a['limit'];var _0xbc5908;if(_0x4030df>=_0x1cc1f8){_0x4030df=_0x1cc1f8;_0xbc5908=0xc8;}else{_0xbc5908=0xce;}_0x9a3bc4['status'](_0xbc5908);return _0x9a3bc4[_0x3955('0x23')](_0x3955('0x24'),_0x339895+'-'+_0x4030df+'/'+_0x1cc1f8)[_0x3955('0x20')](_0x3ac7dd);}return null;};}function patchUpdates(_0x44cf35){return function(_0xb74f07){try{jsonpatch['apply'](_0xb74f07,_0x44cf35,!![]);}catch(_0x4a9812){return BPromise[_0x3955('0x25')](_0x4a9812);}return _0xb74f07[_0x3955('0x26')]();};}function saveUpdates(_0x390665,_0x186977){return function(_0x261a53){if(_0x261a53){return _0x261a53[_0x3955('0x27')](_0x390665)[_0x3955('0x28')](function(_0x5b699e){return _0x5b699e;});}return null;};}function removeEntity(_0x4a8b35,_0x38b217){return function(_0x59b1d9){if(_0x59b1d9){return _0x59b1d9[_0x3955('0x29')]()[_0x3955('0x28')](function(){var _0x1f6490=_0x59b1d9[_0x3955('0x2a')]({'plain':!![]});var _0x4c4b4f=_0x3955('0x2b');return db[_0x3955('0x2c')][_0x3955('0x29')]({'where':{'type':_0x4c4b4f,'resourceId':_0x1f6490['id']}})[_0x3955('0x28')](function(){return _0x59b1d9;});})['then'](function(){_0x4a8b35[_0x3955('0x1e')](0xcc)[_0x3955('0x1f')]();});}};}function handleEntityNotFound(_0x381a86,_0x5dba2a){return function(_0x363dac){if(!_0x363dac){_0x381a86[_0x3955('0x2d')](0x194);}return _0x363dac;};}function handleError(_0x4d68f9,_0x2dda9c){_0x2dda9c=_0x2dda9c||0x1f4;return function(_0x17be7a){logger['error'](_0x17be7a['stack']);if(_0x17be7a[_0x3955('0x2e')]){delete _0x17be7a[_0x3955('0x2e')];}_0x4d68f9['status'](_0x2dda9c)[_0x3955('0x2f')](_0x17be7a);};}exports['index']=function(_0x53d8eb,_0x3c29ed){var _0x18231a={},_0x59a962={},_0x3e8e22={'count':0x0,'rows':[]};var _0x1417d3=_[_0x3955('0x30')](db[_0x3955('0x31')]['rawAttributes'],function(_0x4e4415){return{'name':_0x4e4415['fieldName'],'type':_0x4e4415[_0x3955('0x32')]['key']};});_0x59a962[_0x3955('0x33')]=_['map'](_0x1417d3,_0x3955('0x2e'));_0x59a962[_0x3955('0x34')]=_['keys'](_0x53d8eb['query']);_0x59a962[_0x3955('0x35')]=_[_0x3955('0x36')](_0x59a962[_0x3955('0x33')],_0x59a962[_0x3955('0x34')]);_0x18231a['attributes']=_[_0x3955('0x36')](_0x59a962['model'],qs['fields'](_0x53d8eb[_0x3955('0x34')][_0x3955('0x37')]));_0x18231a[_0x3955('0x38')]=_0x18231a['attributes'][_0x3955('0x39')]?_0x18231a[_0x3955('0x38')]:_0x59a962[_0x3955('0x33')];if(!_0x53d8eb[_0x3955('0x34')][_0x3955('0x3a')](_0x3955('0x3b'))){_0x18231a[_0x3955('0x3c')]=qs[_0x3955('0x3c')](_0x53d8eb[_0x3955('0x34')][_0x3955('0x3c')]);_0x18231a[_0x3955('0x3d')]=qs['offset'](_0x53d8eb['query']['offset']);}_0x18231a['order']=qs[_0x3955('0x3e')](_0x53d8eb['query'][_0x3955('0x3e')]);_0x18231a[_0x3955('0x3f')]=qs[_0x3955('0x35')](_[_0x3955('0x40')](_0x53d8eb[_0x3955('0x34')],_0x59a962[_0x3955('0x35')]),_0x1417d3);if(_0x53d8eb[_0x3955('0x34')][_0x3955('0x41')]){_0x18231a['where']=_['merge'](_0x18231a[_0x3955('0x3f')],{'$or':_['map'](_0x1417d3,function(_0x4673d0){if(_0x4673d0['type']!==_0x3955('0x42')){var _0x25bfe5={};_0x25bfe5[_0x4673d0[_0x3955('0x2e')]]={'$like':'%'+_0x53d8eb[_0x3955('0x34')][_0x3955('0x41')]+'%'};return _0x25bfe5;}})});}_0x18231a=_[_0x3955('0x43')]({},_0x18231a,_0x53d8eb[_0x3955('0x44')]);var _0x6cb642={'where':_0x18231a[_0x3955('0x3f')]};return db[_0x3955('0x31')][_0x3955('0x22')](_0x6cb642)[_0x3955('0x28')](function(_0x5e66ac){_0x3e8e22['count']=_0x5e66ac;if(_0x53d8eb['query']['includeAll']){_0x18231a['include']=[{'all':!![]}];}return db[_0x3955('0x31')]['findAll'](_0x18231a);})[_0x3955('0x28')](function(_0xe0269b){_0x3e8e22[_0x3955('0x45')]=_0xe0269b;return _0x3e8e22;})[_0x3955('0x28')](respondWithFilteredResult(_0x3c29ed,_0x18231a))['catch'](handleError(_0x3c29ed,null));};exports[_0x3955('0x46')]=function(_0x2df0e2,_0x427301){var _0x437f97={'raw':![],'where':{'id':_0x2df0e2['params']['id']}},_0x162ff2={};_0x162ff2[_0x3955('0x33')]=_[_0x3955('0x47')](db[_0x3955('0x31')][_0x3955('0x48')]);_0x162ff2[_0x3955('0x34')]=_['keys'](_0x2df0e2[_0x3955('0x34')]);_0x162ff2[_0x3955('0x35')]=_[_0x3955('0x36')](_0x162ff2[_0x3955('0x33')],_0x162ff2[_0x3955('0x34')]);_0x437f97['attributes']=_[_0x3955('0x36')](_0x162ff2[_0x3955('0x33')],qs[_0x3955('0x37')](_0x2df0e2[_0x3955('0x34')]['fields']));_0x437f97[_0x3955('0x38')]=_0x437f97[_0x3955('0x38')][_0x3955('0x39')]?_0x437f97[_0x3955('0x38')]:_0x162ff2[_0x3955('0x33')];if(_0x2df0e2[_0x3955('0x34')]['includeAll']){_0x437f97[_0x3955('0x49')]=[{'all':!![]}];}_0x437f97=_[_0x3955('0x43')]({},_0x437f97,_0x2df0e2[_0x3955('0x44')]);return db[_0x3955('0x31')][_0x3955('0x4a')](_0x437f97)[_0x3955('0x28')](handleEntityNotFound(_0x427301,null))[_0x3955('0x28')](respondWithResult(_0x427301,null))[_0x3955('0x4b')](handleError(_0x427301,null));};exports[_0x3955('0x4c')]=function(_0x2c893a,_0x5438c1){return db[_0x3955('0x31')][_0x3955('0x4c')](_0x2c893a[_0x3955('0x4d')],{})[_0x3955('0x28')](function(_0x46bbb9){var _0x315ebf=_0x2c893a[_0x3955('0x4e')][_0x3955('0x2a')]({'plain':!![]});if(!_0x315ebf)throw new Error(_0x3955('0x4f'));if(_0x315ebf[_0x3955('0x50')]===_0x3955('0x4e')){var _0x482e64=_0x46bbb9[_0x3955('0x2a')]({'plain':!![]});var _0x4aa254=_0x3955('0x2b');return db[_0x3955('0x51')][_0x3955('0x4a')]({'where':{'name':_0x4aa254,'userProfileId':_0x315ebf[_0x3955('0x52')]},'raw':!![]})[_0x3955('0x28')](function(_0x551724){if(_0x551724&&_0x551724[_0x3955('0x53')]===0x0){return db[_0x3955('0x2c')]['create']({'name':_0x482e64[_0x3955('0x2e')],'resourceId':_0x482e64['id'],'type':_0x551724['name'],'sectionId':_0x551724['id']},{})[_0x3955('0x28')](function(){return _0x46bbb9;});}else{return _0x46bbb9;}})['catch'](function(_0x4b89d8){logger[_0x3955('0x54')](_0x3955('0x55'),_0x4b89d8);throw _0x4b89d8;});}return _0x46bbb9;})[_0x3955('0x28')](respondWithResult(_0x5438c1,0xc9))[_0x3955('0x4b')](handleError(_0x5438c1,null));};exports[_0x3955('0x27')]=function(_0x191e2d,_0x5baf68){if(_0x191e2d[_0x3955('0x4d')]['id']){delete _0x191e2d['body']['id'];}return db[_0x3955('0x31')]['find']({'where':{'id':_0x191e2d[_0x3955('0x56')]['id']}})[_0x3955('0x28')](handleEntityNotFound(_0x5baf68,null))[_0x3955('0x28')](saveUpdates(_0x191e2d[_0x3955('0x4d')],null))[_0x3955('0x28')](respondWithResult(_0x5baf68,null))[_0x3955('0x4b')](handleError(_0x5baf68,null));};exports[_0x3955('0x29')]=function(_0x5586a9,_0x5997fa){return db[_0x3955('0x31')][_0x3955('0x4a')]({'where':{'id':_0x5586a9[_0x3955('0x56')]['id']}})['then'](handleEntityNotFound(_0x5997fa,null))[_0x3955('0x28')](removeEntity(_0x5997fa,null))[_0x3955('0x4b')](handleError(_0x5997fa,null));};exports[_0x3955('0x57')]=function(_0x293492,_0x18e482){return db['CmList']['describe']()[_0x3955('0x28')](respondWithResult(_0x18e482,null))['catch'](handleError(_0x18e482,null));};exports[_0x3955('0x58')]=function(_0x575645,_0x22ab0b,_0x3eea89){if(_0x575645[_0x3955('0x4d')]['id']){delete _0x575645[_0x3955('0x4d')]['id'];}return db[_0x3955('0x31')]['find']({'where':{'id':_0x575645[_0x3955('0x56')]['id']}})[_0x3955('0x28')](handleEntityNotFound(_0x22ab0b,null))[_0x3955('0x28')](function(_0x5c0b51){if(_0x5c0b51){_0x575645[_0x3955('0x4d')]['ListId']=_0x5c0b51['id'];return db['Disposition'][_0x3955('0x4c')](_0x575645['body']);}})[_0x3955('0x28')](respondWithResult(_0x22ab0b,null))[_0x3955('0x4b')](handleError(_0x22ab0b,null));};exports[_0x3955('0x59')]=function(_0x861479,_0x55767a,_0x453f86){var _0x261daa={'raw':![],'where':{}};var _0x5f41db={};var _0x5b57c4={'count':0x0,'rows':[]};return db['CmList'][_0x3955('0x5a')]({'where':{'id':_0x861479[_0x3955('0x56')]['id']}})[_0x3955('0x28')](handleEntityNotFound(_0x55767a,null))[_0x3955('0x28')](function(_0x216ae1){if(_0x216ae1){_0x5f41db[_0x3955('0x33')]=_[_0x3955('0x47')](db[_0x3955('0x5b')]['rawAttributes']);_0x5f41db[_0x3955('0x34')]=_[_0x3955('0x47')](_0x861479['query']);_0x5f41db[_0x3955('0x35')]=_[_0x3955('0x36')](_0x5f41db[_0x3955('0x33')],_0x5f41db[_0x3955('0x34')]);_0x261daa[_0x3955('0x38')]=_[_0x3955('0x36')](_0x5f41db[_0x3955('0x33')],qs[_0x3955('0x37')](_0x861479[_0x3955('0x34')][_0x3955('0x37')]));_0x261daa[_0x3955('0x38')]=_0x261daa['attributes'][_0x3955('0x39')]?_0x261daa['attributes']:_0x5f41db['model'];if(!_0x861479['query'][_0x3955('0x3a')](_0x3955('0x3b'))){_0x261daa[_0x3955('0x3c')]=qs[_0x3955('0x3c')](_0x861479[_0x3955('0x34')]['limit']);_0x261daa[_0x3955('0x3d')]=qs[_0x3955('0x3d')](_0x861479[_0x3955('0x34')][_0x3955('0x3d')]);}_0x261daa['order']=qs[_0x3955('0x3e')](_0x861479['query'][_0x3955('0x3e')]);_0x261daa[_0x3955('0x3f')]=qs[_0x3955('0x35')](_['pick'](_0x861479[_0x3955('0x34')],_0x5f41db[_0x3955('0x35')]));_0x261daa['where'][_0x3955('0x5c')]=_0x216ae1['id'];if(_0x861479[_0x3955('0x34')]['filter']){_0x261daa[_0x3955('0x3f')]=_[_0x3955('0x43')](_0x261daa[_0x3955('0x3f')],{'$or':_[_0x3955('0x30')](_0x261daa[_0x3955('0x38')],function(_0x244ccf){var _0x3ea5a4={};_0x3ea5a4[_0x244ccf]={'$like':'%'+_0x861479[_0x3955('0x34')]['filter']+'%'};return _0x3ea5a4;})});}_0x261daa=_[_0x3955('0x43')]({},_0x261daa,_0x861479[_0x3955('0x44')]);return db['Disposition'][_0x3955('0x22')]({'where':_0x261daa[_0x3955('0x3f')]})[_0x3955('0x28')](function(_0x54ff97){_0x5b57c4[_0x3955('0x22')]=_0x54ff97;if(_0x861479['query']['includeAll']){_0x261daa[_0x3955('0x49')]=[{'all':!![]}];}return db[_0x3955('0x5b')][_0x3955('0x5d')](_0x261daa);})['then'](function(_0x109ea2){_0x5b57c4[_0x3955('0x45')]=_0x109ea2;return _0x5b57c4;});}})['then'](respondWithFilteredResult(_0x55767a,_0x261daa))['catch'](handleError(_0x55767a,null));};exports[_0x3955('0x5e')]=function(_0x4daae8,_0x1602fb,_0x4ee0fe){return db[_0x3955('0x31')]['find']({'where':{'id':_0x4daae8[_0x3955('0x56')]['id']}})[_0x3955('0x28')](handleEntityNotFound(_0x1602fb,null))[_0x3955('0x28')](function(_0x2d2b0d){if(_0x2d2b0d){return _0x2d2b0d['removeDispositions'](_0x4daae8[_0x3955('0x34')][_0x3955('0x5f')]);}})[_0x3955('0x28')](respondWithStatusCode(_0x1602fb,null))[_0x3955('0x4b')](handleError(_0x1602fb,null));};exports[_0x3955('0x60')]=function(_0x49529c,_0x51c365,_0x3ac05c){return db[_0x3955('0x31')]['find']({'where':{'id':_0x49529c['params']['id']}})[_0x3955('0x28')](handleEntityNotFound(_0x51c365,null))[_0x3955('0x28')](function(_0x4a153f){if(_0x4a153f){var _0x45c0a5=[];var _0x4de8c2={'success':[],'errors':[]};return db[_0x3955('0x61')][_0x3955('0x57')]()['then'](function(_0x1262d1){if(_0x49529c[_0x3955('0x4d')]['tags']&&_[_0x3955('0x62')](_0x49529c[_0x3955('0x4d')][_0x3955('0x63')])){if(_0x49529c['body'][_0x3955('0x63')][_0x3955('0x39')]){_0x49529c[_0x3955('0x4d')][_0x3955('0x63')]=_0x49529c[_0x3955('0x4d')][_0x3955('0x63')][_0x3955('0x64')](';')+';';}else{_0x49529c[_0x3955('0x4d')][_0x3955('0x63')]=null;}}else{_0x49529c[_0x3955('0x4d')][_0x3955('0x63')]=null;}if(_0x49529c[_0x3955('0x4d')]&&_[_0x3955('0x62')](_0x49529c[_0x3955('0x4d')])){for(var _0x3be1a5=0x0;_0x3be1a5<_0x49529c['body'][_0x3955('0x39')];_0x3be1a5+=0x1){_0x49529c[_0x3955('0x4d')][_0x3be1a5]['ListId']=_0x49529c[_0x3955('0x56')]['id'];_0x45c0a5[_0x3955('0x65')](_0x49529c[_0x3955('0x4d')][_0x3be1a5]);}return BPromise[_0x3955('0x66')](_0x45c0a5,function(_0x3fa07f){return db[_0x3955('0x61')][_0x3955('0x4c')](_[_0x3955('0x67')](_0x3fa07f,[_0x3955('0x5f'),'id'])||{},{'fields':_[_0x3955('0x47')](_0x1262d1),'raw':!![]})['then'](function(_0x4c6641){_0x4de8c2[_0x3955('0x68')][_0x3955('0x65')](_0x4c6641[_0x3955('0x69')]);})[_0x3955('0x4b')](function(_0x386ccc){_0x4de8c2[_0x3955('0x6a')][_0x3955('0x65')]({'data':_0x3fa07f,'error':_0x386ccc[_0x3955('0x6b')]});});})[_0x3955('0x28')](function(_0x1cd3f8){return _0x4de8c2;})[_0x3955('0x4b')](function(_0x408f66){return _0x408f66;});}else{_0x51c365[_0x3955('0x1e')](0x190)[_0x3955('0x20')]({'message':_0x3955('0x6c')});}});}})[_0x3955('0x28')](respondWithResult(_0x51c365,null))[_0x3955('0x4b')](handleError(_0x51c365,null));};exports[_0x3955('0x6d')]=function(_0x2abdea,_0x59ccbf,_0x595766){var _0x344a97;return db['CmList'][_0x3955('0x4a')]({'where':{'id':_0x2abdea[_0x3955('0x56')]['id']},'include':[{'model':db[_0x3955('0x6e')],'as':_0x3955('0x6f')}]})[_0x3955('0x28')](handleEntityNotFound(_0x59ccbf,null))['then'](function(_0x29ba2e){if(_0x29ba2e){_0x344a97=_0x29ba2e;return db['CmContact'][_0x3955('0x48')];}})['then'](function(_0x311d87){if(_0x311d87){var _0x2bb7af={};var _0x5a7880={};_0x5a7880[_0x3955('0x33')]=_[_0x3955('0x70')](_['keys'](_0x311d87),_[_0x3955('0x30')](_0x344a97['CustomFields'],function(_0x5ba127){return util[_0x3955('0x71')](_0x3955('0x72'),_0x5ba127['id']);}));_0x5a7880[_0x3955('0x34')]=_[_0x3955('0x47')](_0x2abdea[_0x3955('0x34')]);_0x5a7880[_0x3955('0x35')]=_[_0x3955('0x36')](_0x5a7880[_0x3955('0x33')],_0x5a7880['query']);_0x2bb7af[_0x3955('0x38')]=_['intersection'](_0x5a7880[_0x3955('0x33')],qs['fields'](_0x2abdea[_0x3955('0x34')][_0x3955('0x37')]));_0x2bb7af[_0x3955('0x38')]=_0x2bb7af[_0x3955('0x38')][_0x3955('0x39')]?_0x2bb7af['attributes']:_0x5a7880['model'];if(!_0x2abdea[_0x3955('0x34')]['hasOwnProperty'](_0x3955('0x3b'))){_0x2bb7af[_0x3955('0x3c')]=qs[_0x3955('0x3c')](_0x2abdea[_0x3955('0x34')][_0x3955('0x3c')]);_0x2bb7af[_0x3955('0x3d')]=qs[_0x3955('0x3d')](_0x2abdea['query']['offset']);}_0x2bb7af[_0x3955('0x73')]=qs[_0x3955('0x3e')](_0x2abdea[_0x3955('0x34')][_0x3955('0x3e')]);_0x2bb7af[_0x3955('0x3f')]=qs[_0x3955('0x35')](_[_0x3955('0x40')](_0x2abdea['query'],_0x5a7880['filters']));_0x2bb7af[_0x3955('0x74')]=!![];if(_0x2abdea[_0x3955('0x34')][_0x3955('0x41')]){_0x2bb7af[_0x3955('0x3f')]=_[_0x3955('0x43')](_0x2bb7af[_0x3955('0x3f')],{'$or':_['map'](_0x2bb7af[_0x3955('0x38')],function(_0x2080fd){var _0x5da356={};_0x5da356[_0x2080fd]={'$like':'%'+_0x2abdea[_0x3955('0x34')][_0x3955('0x41')]+'%'};return _0x5da356;})});}_0x2bb7af=_['merge']({},_0x2bb7af,_0x2abdea[_0x3955('0x44')]);return _0x344a97[_0x3955('0x6d')](_0x2bb7af);}})[_0x3955('0x28')](respondWithResult(_0x59ccbf,null))[_0x3955('0x4b')](handleError(_0x59ccbf,null));};exports[_0x3955('0x75')]=function(_0x3c7fa4,_0x29cb35,_0x2a706c){var _0x207a73;return db[_0x3955('0x31')][_0x3955('0x4a')]({'where':{'id':_0x3c7fa4['params']['id']},'include':[{'model':db[_0x3955('0x6e')],'as':_0x3955('0x6f')}]})[_0x3955('0x28')](handleEntityNotFound(_0x29cb35,null))[_0x3955('0x28')](function(_0x2a3f44){if(_0x2a3f44){_0x207a73=_0x2a3f44;return db[_0x3955('0x61')]['rawAttributes'];}})[_0x3955('0x28')](function(_0x1a91b2){if(_0x1a91b2){var _0x1f3052={};var _0x15495a={};_0x15495a[_0x3955('0x33')]=_[_0x3955('0x70')](_['keys'](_0x1a91b2),_[_0x3955('0x30')](_0x207a73[_0x3955('0x6f')],function(_0x2cae60){return util[_0x3955('0x71')](_0x3955('0x72'),_0x2cae60['id']);}));_0x15495a[_0x3955('0x34')]=_['keys'](_0x3c7fa4[_0x3955('0x34')]);_0x15495a[_0x3955('0x35')]=_['intersection'](_0x15495a[_0x3955('0x33')],_0x15495a[_0x3955('0x34')]);_0x1f3052[_0x3955('0x38')]=_[_0x3955('0x36')](_0x15495a['model'],qs[_0x3955('0x37')](_0x3c7fa4[_0x3955('0x34')][_0x3955('0x37')]));_0x1f3052[_0x3955('0x38')]=_0x1f3052['attributes'][_0x3955('0x39')]?_0x1f3052['attributes']:_0x15495a[_0x3955('0x33')];if(!_0x3c7fa4[_0x3955('0x34')][_0x3955('0x3a')]('nolimit')){_0x1f3052['limit']=qs[_0x3955('0x3c')](_0x3c7fa4[_0x3955('0x34')][_0x3955('0x3c')]);_0x1f3052['offset']=qs[_0x3955('0x3d')](_0x3c7fa4['query']['offset']);}_0x1f3052[_0x3955('0x73')]=qs[_0x3955('0x3e')](_0x3c7fa4[_0x3955('0x34')][_0x3955('0x3e')]);_0x1f3052[_0x3955('0x3f')]=qs[_0x3955('0x35')](_[_0x3955('0x40')](_0x3c7fa4[_0x3955('0x34')],_0x15495a[_0x3955('0x35')]));_0x1f3052[_0x3955('0x74')]=!![];if(_0x3c7fa4[_0x3955('0x34')][_0x3955('0x41')]){_0x1f3052[_0x3955('0x3f')]=_[_0x3955('0x43')](_0x1f3052[_0x3955('0x3f')],{'$or':_[_0x3955('0x30')](_0x1f3052['attributes'],function(_0xf6abad){var _0x588370={};_0x588370[_0xf6abad]={'$like':'%'+_0x3c7fa4['query'][_0x3955('0x41')]+'%'};return _0x588370;})});}_0x1f3052=_[_0x3955('0x43')]({},_0x1f3052,_0x3c7fa4[_0x3955('0x44')]);return _0x207a73[_0x3955('0x6d')](_0x1f3052);}})[_0x3955('0x28')](function(_0x140a6a){if(!_['isEmpty'](_0x140a6a)){var _0x58eb82=toCsv(_0x140a6a);var _0x500278=Date['now']();fs[_0x3955('0x76')](util['format'](_0x3955('0x77'),_0x207a73['id'],_0x500278),_0x58eb82);_0x29cb35[_0x3955('0x78')](_0x3955('0x79'),_0x3955('0x7a')+util[_0x3955('0x71')]('list_%d_%s.csv',_0x207a73['id'],_0x500278));_0x29cb35[_0x3955('0x78')](_0x3955('0x7b'),_0x3955('0x7c'));return _0x29cb35[_0x3955('0x7d')](util['format'](_0x3955('0x77'),_0x207a73['id'],_0x500278));}else{return _0x29cb35[_0x3955('0x2d')](0xcc);}})['catch'](handleError(_0x29cb35,null));};exports[_0x3955('0x7e')]=function(_0xa78e63,_0x566cf0,_0x291505){var _0xf615d0;delete _0xa78e63[_0x3955('0x4d')]['id'];return db[_0x3955('0x31')][_0x3955('0x5a')]({'where':{'id':_0xa78e63[_0x3955('0x56')]['id']}})['then'](handleEntityNotFound(_0x566cf0,null))[_0x3955('0x28')](function(_0x446e89){if(_0x446e89){return db['sequelize'][_0x3955('0x7f')](function(_0x27ea29){return db[_0x3955('0x6e')]['create'](_0xa78e63[_0x3955('0x4d')],{'transaction':_0x27ea29})['then'](function(_0x358220){_0xf615d0=_0x358220;return _0x446e89[_0x3955('0x80')](_0x358220,{'transaction':_0x27ea29});})[_0x3955('0x28')](function(){var _0x7f965a={'type':db['Sequelize']['TEXT'],'transaction':_0x27ea29};switch(_0xa78e63[_0x3955('0x4d')]['type']){case _0x3955('0x81'):_0x7f965a['type']=db[_0x3955('0x82')]['TEXT'];break;case _0x3955('0x83'):_0x7f965a[_0x3955('0x32')]=db[_0x3955('0x82')][_0x3955('0x84')];break;case _0x3955('0x85'):_0x7f965a[_0x3955('0x32')]=db['Sequelize'][_0x3955('0x86')];_0x7f965a[_0x3955('0x87')]=![];break;default:}return db[_0x3955('0x88')][_0x3955('0x89')][_0x3955('0x8a')]('cm_contacts',util['format'](_0x3955('0x8b'),_0xf615d0['id']),_0x7f965a);})[_0x3955('0x28')](function(){return _0xf615d0;});});}})['then'](respondWithResult(_0x566cf0,null))[_0x3955('0x4b')](handleError(_0x566cf0,null));};exports[_0x3955('0x8c')]=function(_0x44afb9,_0x48968b,_0x3076ff){var _0x4a97a6={};var _0x174857={};var _0x482401;var _0x2a6d06;return db[_0x3955('0x31')]['findOne']({'where':{'id':_0x44afb9['params']['id']}})['then'](handleEntityNotFound(_0x48968b,null))['then'](function(_0x2eb358){if(_0x2eb358){_0x482401=_0x2eb358;_0x174857[_0x3955('0x33')]=_[_0x3955('0x47')](db['CmCustomField'][_0x3955('0x48')]);_0x174857[_0x3955('0x34')]=_[_0x3955('0x47')](_0x44afb9['query']);_0x174857[_0x3955('0x35')]=_[_0x3955('0x36')](_0x174857[_0x3955('0x33')],_0x174857[_0x3955('0x34')]);_0x4a97a6[_0x3955('0x38')]=_[_0x3955('0x36')](_0x174857[_0x3955('0x33')],qs[_0x3955('0x37')](_0x44afb9[_0x3955('0x34')][_0x3955('0x37')]));_0x4a97a6[_0x3955('0x38')]=_0x4a97a6[_0x3955('0x38')]['length']?_0x4a97a6[_0x3955('0x38')]:_0x174857[_0x3955('0x33')];_0x4a97a6[_0x3955('0x73')]=qs[_0x3955('0x3e')](_0x44afb9[_0x3955('0x34')][_0x3955('0x3e')]);_0x4a97a6[_0x3955('0x3f')]=qs['filters'](_[_0x3955('0x40')](_0x44afb9[_0x3955('0x34')],_0x174857[_0x3955('0x35')]));_0x4a97a6['where']=_[_0x3955('0x43')](_0x4a97a6['where'],{'$or':[{'ListId':_0x2eb358['id']},{'ListId':null}]});if(_0x44afb9[_0x3955('0x34')][_0x3955('0x41')]){_0x4a97a6[_0x3955('0x3f')]=_[_0x3955('0x43')](_0x4a97a6[_0x3955('0x3f')],{'$or':_[_0x3955('0x30')](_0x4a97a6[_0x3955('0x38')],function(_0x1609f7){var _0x3ac8f7={};_0x3ac8f7[_0x1609f7]={'$like':'%'+_0x44afb9[_0x3955('0x34')][_0x3955('0x41')]+'%'};return _0x3ac8f7;})});}_0x4a97a6=_['merge']({},_0x4a97a6,_0x44afb9[_0x3955('0x44')]);return db[_0x3955('0x6e')][_0x3955('0x8d')](_0x4a97a6);}})[_0x3955('0x28')](respondWithResult(_0x48968b,null))[_0x3955('0x4b')](handleError(_0x48968b,null));};exports[_0x3955('0x8e')]=function(_0x5dbcc2,_0x1d998d,_0x7b92bd){return db['CmList'][_0x3955('0x4a')]({'where':{'id':_0x5dbcc2[_0x3955('0x56')]['id']}})[_0x3955('0x28')](handleEntityNotFound(_0x1d998d,null))[_0x3955('0x28')](function(_0x36c1f0){if(_0x36c1f0){return _0x36c1f0['addAgents'](_0x5dbcc2[_0x3955('0x4d')]['ids'],_['omit'](_0x5dbcc2['body'],['ids','id'])||{})[_0x3955('0x8f')](function(_0x506d5c){for(var _0x55d0a0=0x0;_0x55d0a0<_0x5dbcc2[_0x3955('0x4d')][_0x3955('0x5f')][_0x3955('0x39')];_0x55d0a0+=0x1){socket[_0x3955('0x90')](_0x3955('0x91'),{'UserId':Number(_0x5dbcc2[_0x3955('0x4d')][_0x3955('0x5f')][_0x55d0a0]),'CmListId':Number(_0x5dbcc2['params']['id'])});}return _0x506d5c;});}})['then'](respondWithResult(_0x1d998d,null))[_0x3955('0x4b')](handleError(_0x1d998d,null));};exports[_0x3955('0x92')]=function(_0x2b44f4,_0x1abc18,_0x3edbb7){return db[_0x3955('0x31')]['find']({'where':{'id':_0x2b44f4[_0x3955('0x56')]['id']}})[_0x3955('0x28')](handleEntityNotFound(_0x1abc18,null))[_0x3955('0x28')](function(_0x2a7bdb){if(_0x2a7bdb){return _0x2a7bdb[_0x3955('0x92')](_0x2b44f4[_0x3955('0x34')][_0x3955('0x5f')])[_0x3955('0x28')](function(){if(_[_0x3955('0x62')](_0x2b44f4[_0x3955('0x34')][_0x3955('0x5f')])){for(var _0x2f2ab2=0x0;_0x2f2ab2<_0x2b44f4[_0x3955('0x34')][_0x3955('0x5f')]['length'];_0x2f2ab2+=0x1){socket['emit'](_0x3955('0x93'),{'UserId':Number(_0x2b44f4['query'][_0x3955('0x5f')][_0x2f2ab2]),'CmListId':Number(_0x2b44f4[_0x3955('0x56')]['id'])});}}else{socket[_0x3955('0x90')](_0x3955('0x93'),{'UserId':Number(_0x2b44f4[_0x3955('0x34')][_0x3955('0x5f')]),'CmListId':Number(_0x2b44f4['params']['id'])});}});}})[_0x3955('0x28')](respondWithStatusCode(_0x1abc18,null))[_0x3955('0x4b')](handleError(_0x1abc18,null));};exports[_0x3955('0x94')]=function(_0x21c53d,_0x2c6f97,_0x25a428){var _0x1e5f30={};var _0x5efee7={};var _0x36c2b1;var _0x585787;return db[_0x3955('0x31')][_0x3955('0x5a')]({'where':{'id':_0x21c53d[_0x3955('0x56')]['id']}})[_0x3955('0x28')](handleEntityNotFound(_0x2c6f97,null))[_0x3955('0x28')](function(_0x4faa89){if(_0x4faa89){_0x36c2b1=_0x4faa89;_0x5efee7[_0x3955('0x33')]=_[_0x3955('0x47')](db[_0x3955('0x95')][_0x3955('0x48')]);_0x5efee7[_0x3955('0x34')]=_['keys'](_0x21c53d[_0x3955('0x34')]);_0x5efee7['filters']=_[_0x3955('0x36')](_0x5efee7['model'],_0x5efee7[_0x3955('0x34')]);_0x1e5f30[_0x3955('0x38')]=_[_0x3955('0x36')](_0x5efee7[_0x3955('0x33')],qs[_0x3955('0x37')](_0x21c53d[_0x3955('0x34')]['fields']));_0x1e5f30[_0x3955('0x38')]=_0x1e5f30[_0x3955('0x38')][_0x3955('0x39')]?_0x1e5f30[_0x3955('0x38')]:_0x5efee7['model'];_0x1e5f30[_0x3955('0x73')]=qs['sort'](_0x21c53d[_0x3955('0x34')][_0x3955('0x3e')]);_0x1e5f30['where']=qs[_0x3955('0x35')](_[_0x3955('0x40')](_0x21c53d[_0x3955('0x34')],_0x5efee7['filters']));if(_0x21c53d['query'][_0x3955('0x41')]){_0x1e5f30[_0x3955('0x3f')]=_[_0x3955('0x43')](_0x1e5f30[_0x3955('0x3f')],{'$or':_['map'](_0x1e5f30[_0x3955('0x38')],function(_0x53def5){var _0x7f0749={};_0x7f0749[_0x53def5]={'$like':'%'+_0x21c53d[_0x3955('0x34')][_0x3955('0x41')]+'%'};return _0x7f0749;})});}_0x1e5f30=_[_0x3955('0x43')]({},_0x1e5f30,_0x21c53d[_0x3955('0x44')]);return _0x36c2b1['getAgents'](_0x1e5f30);}})['then'](function(_0x516ae6){if(_0x516ae6){_0x585787=_0x516ae6[_0x3955('0x39')];if(!_0x21c53d[_0x3955('0x34')]['hasOwnProperty'](_0x3955('0x3b'))){_0x1e5f30[_0x3955('0x3c')]=qs['limit'](_0x21c53d[_0x3955('0x34')]['limit']);_0x1e5f30[_0x3955('0x3d')]=qs[_0x3955('0x3d')](_0x21c53d[_0x3955('0x34')][_0x3955('0x3d')]);}return _0x36c2b1['getAgents'](_0x1e5f30);}})[_0x3955('0x28')](function(_0x340645){if(_0x340645){return _0x340645?{'count':_0x585787,'rows':_0x340645}:null;}})['then'](respondWithResult(_0x2c6f97,null))[_0x3955('0x4b')](handleError(_0x2c6f97,null));}; \ No newline at end of file +var _0x7380=['format','cf_%d','raw','isEmpty','now','writeFileSync','/tmp/list_%d_%s.csv','setHeader','attachment;\x20filename=','list_%d_%s.csv','Content-type','text/csv','download','addCustomField','Sequelize','TEXT','text','number','INTEGER','switch','defaultValue','sequelize','queryInterface','addColumn','cm_contacts','cf_%s','getCustomFields','findAndCountAll','addAgents','spread','emit','userCmList:save','removeAgents','userCmList:remove','getAgents','User','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/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','socket.io-emitter','./cmList.socket','register','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','destroy','then','get','UserProfileResource','sendStatus','stack','name','index','CmList','rawAttributes','fieldName','type','key','model','map','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','params','find','catch','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','Lists','UserProfileSection','userProfileId','autoAssociation','error','body','describe','addDisposition','findOne','nolimit','order','ListId','Disposition','removeDispositions','ids','addContacts','CmContact','isArray','tags','join','push','each','omit','success','dataValues','errors','Malformed\x20request\x20syntax','getContacts','CmCustomField','CustomFields','concat'];(function(_0x45f9a4,_0x40ecbd){var _0x47c24c=function(_0x1ff989){while(--_0x1ff989){_0x45f9a4['push'](_0x45f9a4['shift']());}};_0x47c24c(++_0x40ecbd);}(_0x7380,0xbc));var _0x0738=function(_0x234ae1,_0x42bdd6){_0x234ae1=_0x234ae1-0x0;var _0x227ba0=_0x7380[_0x234ae1];return _0x227ba0;};'use strict';var emlformat=require(_0x0738('0x0'));var rimraf=require(_0x0738('0x1'));var zipdir=require(_0x0738('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0738('0x3'));var moment=require(_0x0738('0x4'));var BPromise=require(_0x0738('0x5'));var Mustache=require(_0x0738('0x6'));var util=require(_0x0738('0x7'));var path=require(_0x0738('0x8'));var sox=require(_0x0738('0x9'));var csv=require(_0x0738('0xa'));var ejs=require(_0x0738('0xb'));var fs=require('fs');var fs_extra=require(_0x0738('0xc'));var _=require(_0x0738('0xd'));var squel=require(_0x0738('0xe'));var crypto=require(_0x0738('0xf'));var jsforce=require(_0x0738('0x10'));var deskjs=require(_0x0738('0x11'));var toCsv=require(_0x0738('0xa'));var querystring=require(_0x0738('0x12'));var Papa=require(_0x0738('0x13'));var Redis=require(_0x0738('0x14'));var authService=require(_0x0738('0x15'));var qs=require(_0x0738('0x16'));var as=require(_0x0738('0x17'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0738('0x18'))(_0x0738('0x19'));var utils=require(_0x0738('0x1a'));var config=require(_0x0738('0x1b'));var licenseUtil=require('../../config/license/util');var db=require(_0x0738('0x1c'))['db'];config[_0x0738('0x1d')]=_['defaults'](config[_0x0738('0x1d')],{'host':'localhost','port':0x18eb});var socket=require(_0x0738('0x1e'))(new Redis(config[_0x0738('0x1d')]));require(_0x0738('0x1f'))[_0x0738('0x20')](socket);function respondWithStatusCode(_0x4976f6,_0x55fb85){_0x55fb85=_0x55fb85||0xcc;return function(_0x2c79a1){if(_0x2c79a1){return _0x4976f6['sendStatus'](_0x55fb85);}return _0x4976f6[_0x0738('0x21')](_0x55fb85)[_0x0738('0x22')]();};}function respondWithResult(_0x54026e,_0x18662f){_0x18662f=_0x18662f||0xc8;return function(_0x2fda76){if(_0x2fda76){return _0x54026e['status'](_0x18662f)[_0x0738('0x23')](_0x2fda76);}};}function respondWithFilteredResult(_0x59b738,_0x235290){return function(_0x161f82){if(_0x161f82){var _0x240937=typeof _0x235290[_0x0738('0x24')]===_0x0738('0x25')&&typeof _0x235290[_0x0738('0x26')]===_0x0738('0x25');var _0x2ffe76=_0x161f82['count'];var _0x4dfa34=_0x240937?0x0:_0x235290[_0x0738('0x24')];var _0x90f4=_0x240937?_0x161f82[_0x0738('0x27')]:_0x235290['offset']+_0x235290['limit'];var _0x42debf;if(_0x90f4>=_0x2ffe76){_0x90f4=_0x2ffe76;_0x42debf=0xc8;}else{_0x42debf=0xce;}_0x59b738[_0x0738('0x21')](_0x42debf);return _0x59b738['set'](_0x0738('0x28'),_0x4dfa34+'-'+_0x90f4+'/'+_0x2ffe76)['json'](_0x161f82);}return null;};}function patchUpdates(_0x5655e0){return function(_0x111b83){try{jsonpatch[_0x0738('0x29')](_0x111b83,_0x5655e0,!![]);}catch(_0x254388){return BPromise[_0x0738('0x2a')](_0x254388);}return _0x111b83[_0x0738('0x2b')]();};}function saveUpdates(_0x4552de,_0x148a64){return function(_0x58df77){if(_0x58df77){return _0x58df77[_0x0738('0x2c')](_0x4552de)['then'](function(_0x4260d3){return _0x4260d3;});}return null;};}function removeEntity(_0x861086,_0x328f2f){return function(_0x16516f){if(_0x16516f){return _0x16516f[_0x0738('0x2d')]()[_0x0738('0x2e')](function(){var _0x52ae7e=_0x16516f[_0x0738('0x2f')]({'plain':!![]});var _0x23b87d='Lists';return db[_0x0738('0x30')][_0x0738('0x2d')]({'where':{'type':_0x23b87d,'resourceId':_0x52ae7e['id']}})[_0x0738('0x2e')](function(){return _0x16516f;});})['then'](function(){_0x861086[_0x0738('0x21')](0xcc)['end']();});}};}function handleEntityNotFound(_0x7722be,_0x54b2bf){return function(_0x5dcbbd){if(!_0x5dcbbd){_0x7722be[_0x0738('0x31')](0x194);}return _0x5dcbbd;};}function handleError(_0x44b58d,_0x596714){_0x596714=_0x596714||0x1f4;return function(_0x29e06e){logger['error'](_0x29e06e[_0x0738('0x32')]);if(_0x29e06e[_0x0738('0x33')]){delete _0x29e06e[_0x0738('0x33')];}_0x44b58d[_0x0738('0x21')](_0x596714)['send'](_0x29e06e);};}exports[_0x0738('0x34')]=function(_0x3b92c1,_0x1a5c87){var _0x48ca1d={},_0x454299={},_0x365eb0={'count':0x0,'rows':[]};var _0x336f93=_['map'](db[_0x0738('0x35')][_0x0738('0x36')],function(_0x32c725){return{'name':_0x32c725[_0x0738('0x37')],'type':_0x32c725[_0x0738('0x38')][_0x0738('0x39')]};});_0x454299[_0x0738('0x3a')]=_[_0x0738('0x3b')](_0x336f93,_0x0738('0x33'));_0x454299['query']=_[_0x0738('0x3c')](_0x3b92c1[_0x0738('0x3d')]);_0x454299[_0x0738('0x3e')]=_[_0x0738('0x3f')](_0x454299[_0x0738('0x3a')],_0x454299[_0x0738('0x3d')]);_0x48ca1d[_0x0738('0x40')]=_['intersection'](_0x454299[_0x0738('0x3a')],qs[_0x0738('0x41')](_0x3b92c1[_0x0738('0x3d')][_0x0738('0x41')]));_0x48ca1d['attributes']=_0x48ca1d['attributes'][_0x0738('0x42')]?_0x48ca1d[_0x0738('0x40')]:_0x454299[_0x0738('0x3a')];if(!_0x3b92c1[_0x0738('0x3d')][_0x0738('0x43')]('nolimit')){_0x48ca1d[_0x0738('0x26')]=qs[_0x0738('0x26')](_0x3b92c1['query']['limit']);_0x48ca1d['offset']=qs['offset'](_0x3b92c1[_0x0738('0x3d')][_0x0738('0x24')]);}_0x48ca1d['order']=qs[_0x0738('0x44')](_0x3b92c1['query'][_0x0738('0x44')]);_0x48ca1d[_0x0738('0x45')]=qs[_0x0738('0x3e')](_[_0x0738('0x46')](_0x3b92c1['query'],_0x454299[_0x0738('0x3e')]),_0x336f93);if(_0x3b92c1['query']['filter']){_0x48ca1d[_0x0738('0x45')]=_[_0x0738('0x47')](_0x48ca1d[_0x0738('0x45')],{'$or':_[_0x0738('0x3b')](_0x336f93,function(_0x5251dc){if(_0x5251dc[_0x0738('0x38')]!==_0x0738('0x48')){var _0x48bdac={};_0x48bdac[_0x5251dc[_0x0738('0x33')]]={'$like':'%'+_0x3b92c1[_0x0738('0x3d')][_0x0738('0x49')]+'%'};return _0x48bdac;}})});}_0x48ca1d=_[_0x0738('0x47')]({},_0x48ca1d,_0x3b92c1[_0x0738('0x4a')]);var _0x6252f3={'where':_0x48ca1d['where']};return db['CmList'][_0x0738('0x27')](_0x6252f3)[_0x0738('0x2e')](function(_0x5c3d17){_0x365eb0['count']=_0x5c3d17;if(_0x3b92c1[_0x0738('0x3d')][_0x0738('0x4b')]){_0x48ca1d[_0x0738('0x4c')]=[{'all':!![]}];}return db[_0x0738('0x35')][_0x0738('0x4d')](_0x48ca1d);})[_0x0738('0x2e')](function(_0x1cf159){_0x365eb0[_0x0738('0x4e')]=_0x1cf159;return _0x365eb0;})['then'](respondWithFilteredResult(_0x1a5c87,_0x48ca1d))['catch'](handleError(_0x1a5c87,null));};exports['show']=function(_0x4bb10a,_0x5efd94){var _0x13551d={'raw':![],'where':{'id':_0x4bb10a[_0x0738('0x4f')]['id']}},_0xf5a652={};_0xf5a652[_0x0738('0x3a')]=_[_0x0738('0x3c')](db[_0x0738('0x35')]['rawAttributes']);_0xf5a652['query']=_[_0x0738('0x3c')](_0x4bb10a[_0x0738('0x3d')]);_0xf5a652[_0x0738('0x3e')]=_[_0x0738('0x3f')](_0xf5a652['model'],_0xf5a652[_0x0738('0x3d')]);_0x13551d[_0x0738('0x40')]=_[_0x0738('0x3f')](_0xf5a652['model'],qs[_0x0738('0x41')](_0x4bb10a[_0x0738('0x3d')]['fields']));_0x13551d['attributes']=_0x13551d[_0x0738('0x40')]['length']?_0x13551d[_0x0738('0x40')]:_0xf5a652['model'];if(_0x4bb10a[_0x0738('0x3d')][_0x0738('0x4b')]){_0x13551d[_0x0738('0x4c')]=[{'all':!![]}];}_0x13551d=_['merge']({},_0x13551d,_0x4bb10a[_0x0738('0x4a')]);return db['CmList'][_0x0738('0x50')](_0x13551d)[_0x0738('0x2e')](handleEntityNotFound(_0x5efd94,null))[_0x0738('0x2e')](respondWithResult(_0x5efd94,null))[_0x0738('0x51')](handleError(_0x5efd94,null));};exports[_0x0738('0x52')]=function(_0x15a635,_0x4d6da3){return db[_0x0738('0x35')][_0x0738('0x52')](_0x15a635['body'],{})['then'](function(_0x8e4fa4){var _0x476878=_0x15a635[_0x0738('0x53')][_0x0738('0x2f')]({'plain':!![]});if(!_0x476878)throw new Error(_0x0738('0x54'));if(_0x476878['role']===_0x0738('0x53')){var _0x5c676f=_0x8e4fa4[_0x0738('0x2f')]({'plain':!![]});var _0x6257f4=_0x0738('0x55');return db[_0x0738('0x56')][_0x0738('0x50')]({'where':{'name':_0x6257f4,'userProfileId':_0x476878[_0x0738('0x57')]},'raw':!![]})[_0x0738('0x2e')](function(_0x1134f6){if(_0x1134f6&&_0x1134f6[_0x0738('0x58')]===0x0){return db['UserProfileResource']['create']({'name':_0x5c676f[_0x0738('0x33')],'resourceId':_0x5c676f['id'],'type':_0x1134f6['name'],'sectionId':_0x1134f6['id']},{})[_0x0738('0x2e')](function(){return _0x8e4fa4;});}else{return _0x8e4fa4;}})[_0x0738('0x51')](function(_0x38cabe){logger[_0x0738('0x59')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x38cabe);throw _0x38cabe;});}return _0x8e4fa4;})['then'](respondWithResult(_0x4d6da3,0xc9))[_0x0738('0x51')](handleError(_0x4d6da3,null));};exports['update']=function(_0x57e840,_0x27ae9b){if(_0x57e840[_0x0738('0x5a')]['id']){delete _0x57e840['body']['id'];}return db[_0x0738('0x35')][_0x0738('0x50')]({'where':{'id':_0x57e840['params']['id']}})[_0x0738('0x2e')](handleEntityNotFound(_0x27ae9b,null))['then'](saveUpdates(_0x57e840['body'],null))['then'](respondWithResult(_0x27ae9b,null))[_0x0738('0x51')](handleError(_0x27ae9b,null));};exports[_0x0738('0x2d')]=function(_0x2265db,_0x3220c6){return db[_0x0738('0x35')][_0x0738('0x50')]({'where':{'id':_0x2265db[_0x0738('0x4f')]['id']}})['then'](handleEntityNotFound(_0x3220c6,null))['then'](removeEntity(_0x3220c6,null))[_0x0738('0x51')](handleError(_0x3220c6,null));};exports[_0x0738('0x5b')]=function(_0x4f89c1,_0x1a0009){return db[_0x0738('0x35')][_0x0738('0x5b')]()['then'](respondWithResult(_0x1a0009,null))['catch'](handleError(_0x1a0009,null));};exports[_0x0738('0x5c')]=function(_0x4e8143,_0xd198d,_0x15691a){if(_0x4e8143[_0x0738('0x5a')]['id']){delete _0x4e8143[_0x0738('0x5a')]['id'];}return db[_0x0738('0x35')]['find']({'where':{'id':_0x4e8143[_0x0738('0x4f')]['id']}})['then'](handleEntityNotFound(_0xd198d,null))[_0x0738('0x2e')](function(_0x283f19){if(_0x283f19){_0x4e8143[_0x0738('0x5a')]['ListId']=_0x283f19['id'];return db['Disposition'][_0x0738('0x52')](_0x4e8143['body']);}})['then'](respondWithResult(_0xd198d,null))[_0x0738('0x51')](handleError(_0xd198d,null));};exports['getDispositions']=function(_0x548ce8,_0x214de8,_0x2a1906){var _0x33a2fa={'raw':![],'where':{}};var _0x5c7125={};var _0xfa31ff={'count':0x0,'rows':[]};return db[_0x0738('0x35')][_0x0738('0x5d')]({'where':{'id':_0x548ce8[_0x0738('0x4f')]['id']}})['then'](handleEntityNotFound(_0x214de8,null))['then'](function(_0x5ec88f){if(_0x5ec88f){_0x5c7125[_0x0738('0x3a')]=_[_0x0738('0x3c')](db['Disposition'][_0x0738('0x36')]);_0x5c7125[_0x0738('0x3d')]=_[_0x0738('0x3c')](_0x548ce8[_0x0738('0x3d')]);_0x5c7125[_0x0738('0x3e')]=_['intersection'](_0x5c7125[_0x0738('0x3a')],_0x5c7125[_0x0738('0x3d')]);_0x33a2fa[_0x0738('0x40')]=_[_0x0738('0x3f')](_0x5c7125[_0x0738('0x3a')],qs[_0x0738('0x41')](_0x548ce8[_0x0738('0x3d')][_0x0738('0x41')]));_0x33a2fa[_0x0738('0x40')]=_0x33a2fa[_0x0738('0x40')][_0x0738('0x42')]?_0x33a2fa[_0x0738('0x40')]:_0x5c7125[_0x0738('0x3a')];if(!_0x548ce8[_0x0738('0x3d')]['hasOwnProperty'](_0x0738('0x5e'))){_0x33a2fa['limit']=qs['limit'](_0x548ce8[_0x0738('0x3d')][_0x0738('0x26')]);_0x33a2fa[_0x0738('0x24')]=qs[_0x0738('0x24')](_0x548ce8[_0x0738('0x3d')][_0x0738('0x24')]);}_0x33a2fa[_0x0738('0x5f')]=qs[_0x0738('0x44')](_0x548ce8[_0x0738('0x3d')]['sort']);_0x33a2fa[_0x0738('0x45')]=qs[_0x0738('0x3e')](_[_0x0738('0x46')](_0x548ce8[_0x0738('0x3d')],_0x5c7125[_0x0738('0x3e')]));_0x33a2fa[_0x0738('0x45')][_0x0738('0x60')]=_0x5ec88f['id'];if(_0x548ce8[_0x0738('0x3d')]['filter']){_0x33a2fa['where']=_[_0x0738('0x47')](_0x33a2fa['where'],{'$or':_['map'](_0x33a2fa[_0x0738('0x40')],function(_0x272b9f){var _0x223909={};_0x223909[_0x272b9f]={'$like':'%'+_0x548ce8['query'][_0x0738('0x49')]+'%'};return _0x223909;})});}_0x33a2fa=_[_0x0738('0x47')]({},_0x33a2fa,_0x548ce8[_0x0738('0x4a')]);return db['Disposition'][_0x0738('0x27')]({'where':_0x33a2fa[_0x0738('0x45')]})['then'](function(_0x1be8c2){_0xfa31ff[_0x0738('0x27')]=_0x1be8c2;if(_0x548ce8[_0x0738('0x3d')][_0x0738('0x4b')]){_0x33a2fa[_0x0738('0x4c')]=[{'all':!![]}];}return db[_0x0738('0x61')][_0x0738('0x4d')](_0x33a2fa);})[_0x0738('0x2e')](function(_0x4ca99f){_0xfa31ff[_0x0738('0x4e')]=_0x4ca99f;return _0xfa31ff;});}})['then'](respondWithFilteredResult(_0x214de8,_0x33a2fa))[_0x0738('0x51')](handleError(_0x214de8,null));};exports[_0x0738('0x62')]=function(_0x1f9b6c,_0x712526,_0x177c27){return db[_0x0738('0x35')][_0x0738('0x50')]({'where':{'id':_0x1f9b6c[_0x0738('0x4f')]['id']}})[_0x0738('0x2e')](handleEntityNotFound(_0x712526,null))[_0x0738('0x2e')](function(_0x46342d){if(_0x46342d){return _0x46342d['removeDispositions'](_0x1f9b6c[_0x0738('0x3d')][_0x0738('0x63')]);}})[_0x0738('0x2e')](respondWithStatusCode(_0x712526,null))[_0x0738('0x51')](handleError(_0x712526,null));};exports[_0x0738('0x64')]=function(_0x37efb1,_0x4fa80a,_0x137e6f){return db[_0x0738('0x35')]['find']({'where':{'id':_0x37efb1[_0x0738('0x4f')]['id']}})[_0x0738('0x2e')](handleEntityNotFound(_0x4fa80a,null))[_0x0738('0x2e')](function(_0x30cc93){if(_0x30cc93){var _0x3831b2=[];var _0x58e282={'success':[],'errors':[]};return db[_0x0738('0x65')][_0x0738('0x5b')]()[_0x0738('0x2e')](function(_0x2b43c3){if(_0x37efb1[_0x0738('0x5a')]['tags']&&_[_0x0738('0x66')](_0x37efb1[_0x0738('0x5a')]['tags'])){if(_0x37efb1[_0x0738('0x5a')]['tags'][_0x0738('0x42')]){_0x37efb1[_0x0738('0x5a')][_0x0738('0x67')]=_0x37efb1[_0x0738('0x5a')]['tags'][_0x0738('0x68')](';')+';';}else{_0x37efb1[_0x0738('0x5a')][_0x0738('0x67')]=null;}}else{_0x37efb1[_0x0738('0x5a')][_0x0738('0x67')]=null;}if(_0x37efb1[_0x0738('0x5a')]&&_[_0x0738('0x66')](_0x37efb1[_0x0738('0x5a')])){for(var _0x2f78ff=0x0;_0x2f78ff<_0x37efb1[_0x0738('0x5a')][_0x0738('0x42')];_0x2f78ff+=0x1){_0x37efb1[_0x0738('0x5a')][_0x2f78ff][_0x0738('0x60')]=_0x37efb1[_0x0738('0x4f')]['id'];_0x3831b2[_0x0738('0x69')](_0x37efb1[_0x0738('0x5a')][_0x2f78ff]);}return BPromise[_0x0738('0x6a')](_0x3831b2,function(_0x1d1cd3){return db['CmContact'][_0x0738('0x52')](_[_0x0738('0x6b')](_0x1d1cd3,[_0x0738('0x63'),'id'])||{},{'fields':_[_0x0738('0x3c')](_0x2b43c3),'raw':!![]})['then'](function(_0x3a3f27){_0x58e282[_0x0738('0x6c')][_0x0738('0x69')](_0x3a3f27[_0x0738('0x6d')]);})[_0x0738('0x51')](function(_0xdf3799){_0x58e282[_0x0738('0x6e')][_0x0738('0x69')]({'data':_0x1d1cd3,'error':_0xdf3799['message']});});})[_0x0738('0x2e')](function(_0x2b3861){return _0x58e282;})[_0x0738('0x51')](function(_0x2a939f){return _0x2a939f;});}else{_0x4fa80a[_0x0738('0x21')](0x190)[_0x0738('0x23')]({'message':_0x0738('0x6f')});}});}})['then'](respondWithResult(_0x4fa80a,null))[_0x0738('0x51')](handleError(_0x4fa80a,null));};exports[_0x0738('0x70')]=function(_0x465cda,_0x4f9ef7,_0x29b7f9){var _0x38330f;return db[_0x0738('0x35')][_0x0738('0x50')]({'where':{'id':_0x465cda[_0x0738('0x4f')]['id']},'include':[{'model':db[_0x0738('0x71')],'as':_0x0738('0x72')}]})[_0x0738('0x2e')](handleEntityNotFound(_0x4f9ef7,null))[_0x0738('0x2e')](function(_0x1f578a){if(_0x1f578a){_0x38330f=_0x1f578a;return db['CmContact'][_0x0738('0x36')];}})['then'](function(_0x45fc6d){if(_0x45fc6d){var _0x2ddacf={};var _0x58c393={};_0x58c393['model']=_[_0x0738('0x73')](_[_0x0738('0x3c')](_0x45fc6d),_[_0x0738('0x3b')](_0x38330f[_0x0738('0x72')],function(_0x43075e){return util[_0x0738('0x74')](_0x0738('0x75'),_0x43075e['id']);}));_0x58c393[_0x0738('0x3d')]=_[_0x0738('0x3c')](_0x465cda[_0x0738('0x3d')]);_0x58c393[_0x0738('0x3e')]=_['intersection'](_0x58c393[_0x0738('0x3a')],_0x58c393[_0x0738('0x3d')]);_0x2ddacf['attributes']=_[_0x0738('0x3f')](_0x58c393[_0x0738('0x3a')],qs[_0x0738('0x41')](_0x465cda[_0x0738('0x3d')][_0x0738('0x41')]));_0x2ddacf[_0x0738('0x40')]=_0x2ddacf[_0x0738('0x40')][_0x0738('0x42')]?_0x2ddacf[_0x0738('0x40')]:_0x58c393[_0x0738('0x3a')];if(!_0x465cda[_0x0738('0x3d')]['hasOwnProperty'](_0x0738('0x5e'))){_0x2ddacf[_0x0738('0x26')]=qs[_0x0738('0x26')](_0x465cda[_0x0738('0x3d')][_0x0738('0x26')]);_0x2ddacf[_0x0738('0x24')]=qs[_0x0738('0x24')](_0x465cda['query'][_0x0738('0x24')]);}_0x2ddacf[_0x0738('0x5f')]=qs['sort'](_0x465cda[_0x0738('0x3d')][_0x0738('0x44')]);_0x2ddacf['where']=qs[_0x0738('0x3e')](_['pick'](_0x465cda['query'],_0x58c393[_0x0738('0x3e')]));_0x2ddacf[_0x0738('0x76')]=!![];if(_0x465cda[_0x0738('0x3d')][_0x0738('0x49')]){_0x2ddacf[_0x0738('0x45')]=_[_0x0738('0x47')](_0x2ddacf[_0x0738('0x45')],{'$or':_[_0x0738('0x3b')](_0x2ddacf[_0x0738('0x40')],function(_0x32792f){var _0xdaf4cf={};_0xdaf4cf[_0x32792f]={'$like':'%'+_0x465cda[_0x0738('0x3d')][_0x0738('0x49')]+'%'};return _0xdaf4cf;})});}_0x2ddacf=_[_0x0738('0x47')]({},_0x2ddacf,_0x465cda[_0x0738('0x4a')]);return _0x38330f[_0x0738('0x70')](_0x2ddacf);}})[_0x0738('0x2e')](respondWithResult(_0x4f9ef7,null))['catch'](handleError(_0x4f9ef7,null));};exports['getContactsCsv']=function(_0x3c9def,_0x1f4af8,_0x203efe){var _0x3b7127;return db[_0x0738('0x35')][_0x0738('0x50')]({'where':{'id':_0x3c9def[_0x0738('0x4f')]['id']},'include':[{'model':db['CmCustomField'],'as':'CustomFields'}]})['then'](handleEntityNotFound(_0x1f4af8,null))[_0x0738('0x2e')](function(_0x2ea299){if(_0x2ea299){_0x3b7127=_0x2ea299;return db[_0x0738('0x65')]['rawAttributes'];}})[_0x0738('0x2e')](function(_0x495895){if(_0x495895){var _0x504a0c={};var _0x5a1def={};_0x5a1def['model']=_[_0x0738('0x73')](_[_0x0738('0x3c')](_0x495895),_[_0x0738('0x3b')](_0x3b7127[_0x0738('0x72')],function(_0x59b5e3){return util[_0x0738('0x74')](_0x0738('0x75'),_0x59b5e3['id']);}));_0x5a1def[_0x0738('0x3d')]=_[_0x0738('0x3c')](_0x3c9def['query']);_0x5a1def[_0x0738('0x3e')]=_[_0x0738('0x3f')](_0x5a1def['model'],_0x5a1def[_0x0738('0x3d')]);_0x504a0c[_0x0738('0x40')]=_['intersection'](_0x5a1def[_0x0738('0x3a')],qs[_0x0738('0x41')](_0x3c9def[_0x0738('0x3d')][_0x0738('0x41')]));_0x504a0c[_0x0738('0x40')]=_0x504a0c[_0x0738('0x40')]['length']?_0x504a0c['attributes']:_0x5a1def[_0x0738('0x3a')];if(!_0x3c9def[_0x0738('0x3d')][_0x0738('0x43')](_0x0738('0x5e'))){_0x504a0c[_0x0738('0x26')]=qs['limit'](_0x3c9def[_0x0738('0x3d')][_0x0738('0x26')]);_0x504a0c[_0x0738('0x24')]=qs[_0x0738('0x24')](_0x3c9def[_0x0738('0x3d')][_0x0738('0x24')]);}_0x504a0c[_0x0738('0x5f')]=qs[_0x0738('0x44')](_0x3c9def[_0x0738('0x3d')][_0x0738('0x44')]);_0x504a0c['where']=qs[_0x0738('0x3e')](_[_0x0738('0x46')](_0x3c9def['query'],_0x5a1def['filters']));_0x504a0c[_0x0738('0x76')]=!![];if(_0x3c9def['query']['filter']){_0x504a0c[_0x0738('0x45')]=_['merge'](_0x504a0c[_0x0738('0x45')],{'$or':_[_0x0738('0x3b')](_0x504a0c['attributes'],function(_0x267589){var _0x47f72a={};_0x47f72a[_0x267589]={'$like':'%'+_0x3c9def[_0x0738('0x3d')]['filter']+'%'};return _0x47f72a;})});}_0x504a0c=_['merge']({},_0x504a0c,_0x3c9def[_0x0738('0x4a')]);return _0x3b7127[_0x0738('0x70')](_0x504a0c);}})[_0x0738('0x2e')](function(_0x286b9d){if(!_[_0x0738('0x77')](_0x286b9d)){var _0x49ca84=toCsv(_0x286b9d);var _0x2dc392=Date[_0x0738('0x78')]();fs[_0x0738('0x79')](util[_0x0738('0x74')](_0x0738('0x7a'),_0x3b7127['id'],_0x2dc392),_0x49ca84);_0x1f4af8[_0x0738('0x7b')]('Content-disposition',_0x0738('0x7c')+util['format'](_0x0738('0x7d'),_0x3b7127['id'],_0x2dc392));_0x1f4af8[_0x0738('0x7b')](_0x0738('0x7e'),_0x0738('0x7f'));return _0x1f4af8[_0x0738('0x80')](util[_0x0738('0x74')](_0x0738('0x7a'),_0x3b7127['id'],_0x2dc392));}else{return _0x1f4af8['sendStatus'](0xcc);}})['catch'](handleError(_0x1f4af8,null));};exports[_0x0738('0x81')]=function(_0x3eb10c,_0x52c0ab,_0x5ea9b4){var _0x457d95;delete _0x3eb10c[_0x0738('0x5a')]['id'];return db[_0x0738('0x35')][_0x0738('0x5d')]({'where':{'id':_0x3eb10c[_0x0738('0x4f')]['id']}})[_0x0738('0x2e')](handleEntityNotFound(_0x52c0ab,null))[_0x0738('0x2e')](function(_0x5923c1){if(_0x5923c1){return db['sequelize']['transaction'](function(_0x156a1f){return db['CmCustomField'][_0x0738('0x52')](_0x3eb10c[_0x0738('0x5a')],{'transaction':_0x156a1f})['then'](function(_0x31de8e){_0x457d95=_0x31de8e;return _0x5923c1['addCustomFields'](_0x31de8e,{'transaction':_0x156a1f});})[_0x0738('0x2e')](function(){var _0x3e4aa0={'type':db[_0x0738('0x82')][_0x0738('0x83')],'transaction':_0x156a1f};switch(_0x3eb10c[_0x0738('0x5a')][_0x0738('0x38')]){case _0x0738('0x84'):_0x3e4aa0[_0x0738('0x38')]=db[_0x0738('0x82')][_0x0738('0x83')];break;case _0x0738('0x85'):_0x3e4aa0[_0x0738('0x38')]=db['Sequelize'][_0x0738('0x86')];break;case _0x0738('0x87'):_0x3e4aa0[_0x0738('0x38')]=db[_0x0738('0x82')]['BOOLEAN'];_0x3e4aa0[_0x0738('0x88')]=![];break;default:}return db[_0x0738('0x89')][_0x0738('0x8a')][_0x0738('0x8b')](_0x0738('0x8c'),util[_0x0738('0x74')](_0x0738('0x8d'),_0x457d95['id']),_0x3e4aa0);})['then'](function(){return _0x457d95;});});}})['then'](respondWithResult(_0x52c0ab,null))[_0x0738('0x51')](handleError(_0x52c0ab,null));};exports[_0x0738('0x8e')]=function(_0xa95a8,_0x15cedc,_0x572fdd){var _0x135193={};var _0x23d297={};var _0x5c0b37;var _0x33dbb9;return db['CmList'][_0x0738('0x5d')]({'where':{'id':_0xa95a8[_0x0738('0x4f')]['id']}})['then'](handleEntityNotFound(_0x15cedc,null))[_0x0738('0x2e')](function(_0x379256){if(_0x379256){_0x5c0b37=_0x379256;_0x23d297[_0x0738('0x3a')]=_[_0x0738('0x3c')](db[_0x0738('0x71')][_0x0738('0x36')]);_0x23d297[_0x0738('0x3d')]=_[_0x0738('0x3c')](_0xa95a8[_0x0738('0x3d')]);_0x23d297[_0x0738('0x3e')]=_[_0x0738('0x3f')](_0x23d297[_0x0738('0x3a')],_0x23d297[_0x0738('0x3d')]);_0x135193[_0x0738('0x40')]=_[_0x0738('0x3f')](_0x23d297[_0x0738('0x3a')],qs[_0x0738('0x41')](_0xa95a8[_0x0738('0x3d')]['fields']));_0x135193[_0x0738('0x40')]=_0x135193[_0x0738('0x40')]['length']?_0x135193['attributes']:_0x23d297[_0x0738('0x3a')];_0x135193[_0x0738('0x5f')]=qs[_0x0738('0x44')](_0xa95a8[_0x0738('0x3d')]['sort']);_0x135193[_0x0738('0x45')]=qs[_0x0738('0x3e')](_[_0x0738('0x46')](_0xa95a8[_0x0738('0x3d')],_0x23d297[_0x0738('0x3e')]));_0x135193[_0x0738('0x45')]=_[_0x0738('0x47')](_0x135193[_0x0738('0x45')],{'$or':[{'ListId':_0x379256['id']},{'ListId':null}]});if(_0xa95a8[_0x0738('0x3d')][_0x0738('0x49')]){_0x135193[_0x0738('0x45')]=_[_0x0738('0x47')](_0x135193[_0x0738('0x45')],{'$or':_[_0x0738('0x3b')](_0x135193[_0x0738('0x40')],function(_0x1cc4f7){var _0x42a88b={};_0x42a88b[_0x1cc4f7]={'$like':'%'+_0xa95a8['query'][_0x0738('0x49')]+'%'};return _0x42a88b;})});}_0x135193=_[_0x0738('0x47')]({},_0x135193,_0xa95a8[_0x0738('0x4a')]);return db[_0x0738('0x71')][_0x0738('0x8f')](_0x135193);}})[_0x0738('0x2e')](respondWithResult(_0x15cedc,null))[_0x0738('0x51')](handleError(_0x15cedc,null));};exports[_0x0738('0x90')]=function(_0x21a26c,_0x43b728,_0xf38672){return db[_0x0738('0x35')]['find']({'where':{'id':_0x21a26c['params']['id']}})[_0x0738('0x2e')](handleEntityNotFound(_0x43b728,null))[_0x0738('0x2e')](function(_0x3c6e50){if(_0x3c6e50){return _0x3c6e50[_0x0738('0x90')](_0x21a26c[_0x0738('0x5a')][_0x0738('0x63')],_[_0x0738('0x6b')](_0x21a26c['body'],[_0x0738('0x63'),'id'])||{})[_0x0738('0x91')](function(_0x5a782c){for(var _0x5d0b9b=0x0;_0x5d0b9b<_0x21a26c[_0x0738('0x5a')]['ids'][_0x0738('0x42')];_0x5d0b9b+=0x1){socket[_0x0738('0x92')](_0x0738('0x93'),{'UserId':Number(_0x21a26c[_0x0738('0x5a')][_0x0738('0x63')][_0x5d0b9b]),'CmListId':Number(_0x21a26c[_0x0738('0x4f')]['id'])});}return _0x5a782c;});}})['then'](respondWithResult(_0x43b728,null))['catch'](handleError(_0x43b728,null));};exports[_0x0738('0x94')]=function(_0xceebdb,_0x56aa5c,_0x1ab4f0){return db[_0x0738('0x35')][_0x0738('0x50')]({'where':{'id':_0xceebdb[_0x0738('0x4f')]['id']}})[_0x0738('0x2e')](handleEntityNotFound(_0x56aa5c,null))[_0x0738('0x2e')](function(_0x7b53c6){if(_0x7b53c6){return _0x7b53c6['removeAgents'](_0xceebdb[_0x0738('0x3d')][_0x0738('0x63')])['then'](function(){if(_[_0x0738('0x66')](_0xceebdb['query']['ids'])){for(var _0x781e10=0x0;_0x781e10<_0xceebdb[_0x0738('0x3d')][_0x0738('0x63')][_0x0738('0x42')];_0x781e10+=0x1){socket['emit'](_0x0738('0x95'),{'UserId':Number(_0xceebdb[_0x0738('0x3d')]['ids'][_0x781e10]),'CmListId':Number(_0xceebdb['params']['id'])});}}else{socket[_0x0738('0x92')](_0x0738('0x95'),{'UserId':Number(_0xceebdb[_0x0738('0x3d')]['ids']),'CmListId':Number(_0xceebdb[_0x0738('0x4f')]['id'])});}});}})[_0x0738('0x2e')](respondWithStatusCode(_0x56aa5c,null))[_0x0738('0x51')](handleError(_0x56aa5c,null));};exports[_0x0738('0x96')]=function(_0x359bbf,_0x4d0068,_0x284157){var _0x8ae08b={};var _0x5be26b={};var _0x5aeef5;var _0x44f694;return db[_0x0738('0x35')][_0x0738('0x5d')]({'where':{'id':_0x359bbf[_0x0738('0x4f')]['id']}})['then'](handleEntityNotFound(_0x4d0068,null))[_0x0738('0x2e')](function(_0x2366bb){if(_0x2366bb){_0x5aeef5=_0x2366bb;_0x5be26b[_0x0738('0x3a')]=_['keys'](db[_0x0738('0x97')][_0x0738('0x36')]);_0x5be26b[_0x0738('0x3d')]=_[_0x0738('0x3c')](_0x359bbf['query']);_0x5be26b[_0x0738('0x3e')]=_['intersection'](_0x5be26b[_0x0738('0x3a')],_0x5be26b['query']);_0x8ae08b[_0x0738('0x40')]=_['intersection'](_0x5be26b[_0x0738('0x3a')],qs['fields'](_0x359bbf[_0x0738('0x3d')][_0x0738('0x41')]));_0x8ae08b[_0x0738('0x40')]=_0x8ae08b[_0x0738('0x40')]['length']?_0x8ae08b[_0x0738('0x40')]:_0x5be26b[_0x0738('0x3a')];_0x8ae08b[_0x0738('0x5f')]=qs[_0x0738('0x44')](_0x359bbf['query'][_0x0738('0x44')]);_0x8ae08b['where']=qs[_0x0738('0x3e')](_[_0x0738('0x46')](_0x359bbf[_0x0738('0x3d')],_0x5be26b['filters']));if(_0x359bbf[_0x0738('0x3d')][_0x0738('0x49')]){_0x8ae08b[_0x0738('0x45')]=_[_0x0738('0x47')](_0x8ae08b[_0x0738('0x45')],{'$or':_[_0x0738('0x3b')](_0x8ae08b[_0x0738('0x40')],function(_0x349428){var _0x46345a={};_0x46345a[_0x349428]={'$like':'%'+_0x359bbf[_0x0738('0x3d')][_0x0738('0x49')]+'%'};return _0x46345a;})});}_0x8ae08b=_[_0x0738('0x47')]({},_0x8ae08b,_0x359bbf[_0x0738('0x4a')]);return _0x5aeef5[_0x0738('0x96')](_0x8ae08b);}})[_0x0738('0x2e')](function(_0x5e8c92){if(_0x5e8c92){_0x44f694=_0x5e8c92[_0x0738('0x42')];if(!_0x359bbf['query']['hasOwnProperty'](_0x0738('0x5e'))){_0x8ae08b[_0x0738('0x26')]=qs[_0x0738('0x26')](_0x359bbf[_0x0738('0x3d')][_0x0738('0x26')]);_0x8ae08b[_0x0738('0x24')]=qs[_0x0738('0x24')](_0x359bbf[_0x0738('0x3d')][_0x0738('0x24')]);}return _0x5aeef5[_0x0738('0x96')](_0x8ae08b);}})[_0x0738('0x2e')](function(_0x56437f){if(_0x56437f){return _0x56437f?{'count':_0x44f694,'rows':_0x56437f}:null;}})[_0x0738('0x2e')](respondWithResult(_0x4d0068,null))['catch'](handleError(_0x4d0068,null));}; \ No newline at end of file diff --git a/server/api/cmList/cmList.events.js b/server/api/cmList/cmList.events.js index d888922..27f3244 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 _0x814b=['update','emit','hook','exports','events','../../mysqldb','CmList','setMaxListeners','save'];(function(_0x1cfdcd,_0x1e2fbd){var _0x1ee13a=function(_0x5d94c7){while(--_0x5d94c7){_0x1cfdcd['push'](_0x1cfdcd['shift']());}};_0x1ee13a(++_0x1e2fbd);}(_0x814b,0x1a2));var _0xb814=function(_0x260859,_0x3cfcff){_0x260859=_0x260859-0x0;var _0x4b77f8=_0x814b[_0x260859];return _0x4b77f8;};'use strict';var EventEmitter=require(_0xb814('0x0'));var CmList=require(_0xb814('0x1'))['db'][_0xb814('0x2')];var CmListEvents=new EventEmitter();CmListEvents[_0xb814('0x3')](0x0);var events={'afterCreate':_0xb814('0x4'),'afterUpdate':_0xb814('0x5'),'afterDestroy':'remove'};function emitEvent(_0x38c21a){return function(_0x3e1e9,_0x258866,_0x4237bc){CmListEvents[_0xb814('0x6')](_0x38c21a+':'+_0x3e1e9['id'],_0x3e1e9);CmListEvents[_0xb814('0x6')](_0x38c21a,_0x3e1e9);_0x4237bc(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];CmList[_0xb814('0x7')](e,emitEvent(event));}}module[_0xb814('0x8')]=CmListEvents; \ No newline at end of file +var _0x3e74=['hasOwnProperty','exports','events','CmList','setMaxListeners','save','emit'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3e74,0x175));var _0x43e7=function(_0x261edf,_0x19c783){_0x261edf=_0x261edf-0x0;var _0x2f25a2=_0x3e74[_0x261edf];return _0x2f25a2;};'use strict';var EventEmitter=require(_0x43e7('0x0'));var CmList=require('../../mysqldb')['db'][_0x43e7('0x1')];var CmListEvents=new EventEmitter();CmListEvents[_0x43e7('0x2')](0x0);var events={'afterCreate':_0x43e7('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0xc58479){return function(_0x4f9bbe,_0x128b0f,_0xe838b4){CmListEvents[_0x43e7('0x4')](_0xc58479+':'+_0x4f9bbe['id'],_0x4f9bbe);CmListEvents[_0x43e7('0x4')](_0xc58479,_0x4f9bbe);_0xe838b4(null);};}for(var e in events){if(events[_0x43e7('0x5')](e)){var event=events[e];CmList['hook'](e,emitEvent(event));}}module[_0x43e7('0x6')]=CmListEvents; \ No newline at end of file diff --git a/server/api/cmList/cmList.model.js b/server/api/cmList/cmList.model.js index d43cd17..fad114c 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 _0x2547=['rimraf','./cmList.attributes','exports','CmList','cm_lists','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x29c7fb,_0x3147bd){var _0x2603ea=function(_0x51e624){while(--_0x51e624){_0x29c7fb['push'](_0x29c7fb['shift']());}};_0x2603ea(++_0x3147bd);}(_0x2547,0x1cd));var _0x7254=function(_0x5f28aa,_0x22271a){_0x5f28aa=_0x5f28aa-0x0;var _0xec7c83=_0x2547[_0x5f28aa];return _0xec7c83;};'use strict';var _=require('lodash');var util=require(_0x7254('0x0'));var logger=require(_0x7254('0x1'))(_0x7254('0x2'));var moment=require(_0x7254('0x3'));var BPromise=require(_0x7254('0x4'));var rp=require(_0x7254('0x5'));var fs=require('fs');var path=require(_0x7254('0x6'));var rimraf=require(_0x7254('0x7'));var config=require('../../config/environment');var attributes=require(_0x7254('0x8'));module[_0x7254('0x9')]=function(_0x67f427,_0x119f66){return _0x67f427['define'](_0x7254('0xa'),attributes,{'tableName':_0x7254('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(_0x328b9b,_0x13082a){var _0x3a2d51=function(_0x63002b){while(--_0x63002b){_0x328b9b['push'](_0x328b9b['shift']());}};_0x3a2d51(++_0x13082a);}(_0xd64b,0xc1));var _0xbd64=function(_0x33dea9,_0x1ff0fd){_0x33dea9=_0x33dea9-0x0;var _0x531efa=_0xd64b[_0x33dea9];return _0x531efa;};'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 a6f5d13..c0007a9 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 _0x33c1=['redis','localhost','./cmList.socket','register','request','then','info','CmList,\x20%s,\x20%s','debug','CmList,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','defaults'];(function(_0x2901aa,_0x1bb75f){var _0x5ce3a8=function(_0x3b1a69){while(--_0x3b1a69){_0x2901aa['push'](_0x2901aa['shift']());}};_0x5ce3a8(++_0x1bb75f);}(_0x33c1,0x7d));var _0x133c=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x33c1[_0x2641f9];return _0x585741;};'use strict';var _=require('lodash');var util=require(_0x133c('0x0'));var moment=require(_0x133c('0x1'));var BPromise=require(_0x133c('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x133c('0x3'));var db=require(_0x133c('0x4'))['db'];var utils=require(_0x133c('0x5'));var logger=require(_0x133c('0x6'))(_0x133c('0x7'));var config=require('../../config/environment');var jayson=require(_0x133c('0x8'));var client=jayson['client']['http']({'port':0x232a});config['redis']=_[_0x133c('0x9')](config[_0x133c('0xa')],{'host':_0x133c('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x133c('0xa')]));require(_0x133c('0xc'))[_0x133c('0xd')](socket);function respondWithRpcPromise(_0x5c0faf,_0x2ea1ff,_0x189e4d){return new BPromise(function(_0x1787bd,_0x40c3c3){return client[_0x133c('0xe')](_0x5c0faf,_0x189e4d)[_0x133c('0xf')](function(_0xacf591){logger[_0x133c('0x10')](_0x133c('0x11'),_0x2ea1ff,'request\x20sent');logger[_0x133c('0x12')](_0x133c('0x13'),_0x2ea1ff,'request\x20sent',JSON[_0x133c('0x14')](_0xacf591));if(_0xacf591[_0x133c('0x15')]){if(_0xacf591[_0x133c('0x15')][_0x133c('0x16')]===0x1f4){logger[_0x133c('0x15')]('CmList,\x20%s,\x20%s',_0x2ea1ff,_0xacf591['error'][_0x133c('0x17')]);return _0x40c3c3(_0xacf591['error']['message']);}logger[_0x133c('0x15')](_0x133c('0x11'),_0x2ea1ff,_0xacf591[_0x133c('0x15')][_0x133c('0x17')]);return _0x1787bd(_0xacf591[_0x133c('0x15')][_0x133c('0x17')]);}else{logger[_0x133c('0x10')](_0x133c('0x11'),_0x2ea1ff,_0x133c('0x18'));_0x1787bd(_0xacf591[_0x133c('0x19')][_0x133c('0x17')]);}})[_0x133c('0x1a')](function(_0x21c425){logger[_0x133c('0x15')](_0x133c('0x11'),_0x2ea1ff,_0x21c425);_0x40c3c3(_0x21c425);});});} \ No newline at end of file +var _0xe37b=['../../config/utils','../../config/logger','rpc','jayson/promise','client','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','stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x35147e,_0x15b598){var _0x243826=function(_0x3687b2){while(--_0x3687b2){_0x35147e['push'](_0x35147e['shift']());}};_0x243826(++_0x15b598);}(_0xe37b,0x1bc));var _0xbe37=function(_0x40168a,_0x37798a){_0x40168a=_0x40168a-0x0;var _0x46a9cc=_0xe37b[_0x40168a];return _0x46a9cc;};'use strict';var _=require(_0xbe37('0x0'));var util=require('util');var moment=require(_0xbe37('0x1'));var BPromise=require(_0xbe37('0x2'));var rs=require(_0xbe37('0x3'));var fs=require('fs');var Redis=require(_0xbe37('0x4'));var db=require(_0xbe37('0x5'))['db'];var utils=require(_0xbe37('0x6'));var logger=require(_0xbe37('0x7'))(_0xbe37('0x8'));var config=require('../../config/environment');var jayson=require(_0xbe37('0x9'));var client=jayson[_0xbe37('0xa')]['http']({'port':0x232a});config[_0xbe37('0xb')]=_[_0xbe37('0xc')](config[_0xbe37('0xb')],{'host':_0xbe37('0xd'),'port':0x18eb});var socket=require(_0xbe37('0xe'))(new Redis(config['redis']));require(_0xbe37('0xf'))[_0xbe37('0x10')](socket);function respondWithRpcPromise(_0x406370,_0x1de5fc,_0x25dd35){return new BPromise(function(_0x2a6af1,_0xa18490){return client[_0xbe37('0x11')](_0x406370,_0x25dd35)[_0xbe37('0x12')](function(_0x4268ef){logger[_0xbe37('0x13')](_0xbe37('0x14'),_0x1de5fc,_0xbe37('0x15'));logger[_0xbe37('0x16')](_0xbe37('0x17'),_0x1de5fc,'request\x20sent',JSON[_0xbe37('0x18')](_0x4268ef));if(_0x4268ef[_0xbe37('0x19')]){if(_0x4268ef['error'][_0xbe37('0x1a')]===0x1f4){logger[_0xbe37('0x19')](_0xbe37('0x14'),_0x1de5fc,_0x4268ef['error'][_0xbe37('0x1b')]);return _0xa18490(_0x4268ef['error'][_0xbe37('0x1b')]);}logger[_0xbe37('0x19')]('CmList,\x20%s,\x20%s',_0x1de5fc,_0x4268ef['error']['message']);return _0x2a6af1(_0x4268ef[_0xbe37('0x19')][_0xbe37('0x1b')]);}else{logger[_0xbe37('0x13')](_0xbe37('0x14'),_0x1de5fc,'request\x20sent');_0x2a6af1(_0x4268ef[_0xbe37('0x1c')]['message']);}})[_0xbe37('0x1d')](function(_0x55f324){logger[_0xbe37('0x19')](_0xbe37('0x14'),_0x1de5fc,_0x55f324);_0xa18490(_0x55f324);});});} \ No newline at end of file diff --git a/server/api/cmList/cmList.socket.js b/server/api/cmList/cmList.socket.js index abf4d7b..1e99b78 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 _0x821a=['removeListener','cmList:','./cmList.events','save','update','emit'];(function(_0xd511d,_0x3546b9){var _0x3f148e=function(_0x51f35f){while(--_0x51f35f){_0xd511d['push'](_0xd511d['shift']());}};_0x3f148e(++_0x3546b9);}(_0x821a,0xd4));var _0xa821=function(_0xd50172,_0x480d1e){_0xd50172=_0xd50172-0x0;var _0x5cfcea=_0x821a[_0xd50172];return _0x5cfcea;};'use strict';var CmListEvents=require(_0xa821('0x0'));var events=[_0xa821('0x1'),'remove',_0xa821('0x2')];function createListener(_0x53fdb0,_0x6d9bbc){return function(_0x3012aa){_0x6d9bbc[_0xa821('0x3')](_0x53fdb0,_0x3012aa);};}function removeListener(_0xe8d46d,_0x15b812){return function(){CmListEvents[_0xa821('0x4')](_0xe8d46d,_0x15b812);};}exports['register']=function(_0xb618ba){for(var _0x2ec034=0x0,_0x49e2af=events['length'];_0x2ec034<_0x49e2af;_0x2ec034++){var _0x44809d=events[_0x2ec034];var _0x16ad97=createListener(_0xa821('0x5')+_0x44809d,_0xb618ba);CmListEvents['on'](_0x44809d,_0x16ad97);}}; \ No newline at end of file +var _0x586c=['save','remove','update','emit','length','./cmList.events'];(function(_0x2e6594,_0x5455d3){var _0x22835e=function(_0x28436c){while(--_0x28436c){_0x2e6594['push'](_0x2e6594['shift']());}};_0x22835e(++_0x5455d3);}(_0x586c,0x18b));var _0xc586=function(_0x4314d7,_0x355218){_0x4314d7=_0x4314d7-0x0;var _0x5c599b=_0x586c[_0x4314d7];return _0x5c599b;};'use strict';var CmListEvents=require(_0xc586('0x0'));var events=[_0xc586('0x1'),_0xc586('0x2'),_0xc586('0x3')];function createListener(_0x4e3e34,_0x214d36){return function(_0x303689){_0x214d36[_0xc586('0x4')](_0x4e3e34,_0x303689);};}function removeListener(_0xf33443,_0x1eaf09){return function(){CmListEvents['removeListener'](_0xf33443,_0x1eaf09);};}exports['register']=function(_0x1cffb2){for(var _0x400727=0x0,_0x496f4e=events[_0xc586('0x5')];_0x400727<_0x496f4e;_0x400727++){var _0x156832=events[_0x400727];var _0x37a170=createListener('cmList:'+_0x156832,_0x1cffb2);CmListEvents['on'](_0x156832,_0x37a170);}}; \ No newline at end of file diff --git a/server/api/cmList/index.js b/server/api/cmList/index.js index 5b751fd..524f57b 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 _0x9aba=['getContacts','/:id/contacts/csv','getContactsCsv','/:id/users','getAgents','create','post','/:id/dispositions','addDisposition','addCustomField','addAgents','put','update','delete','destroy','removeDispositions','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./cmList.controller','get','isAuthenticated','index','/describe','describe','/:id','/:id/contacts'];(function(_0x39e027,_0x10874c){var _0x1ca6ea=function(_0x283665){while(--_0x283665){_0x39e027['push'](_0x39e027['shift']());}};_0x1ca6ea(++_0x10874c);}(_0x9aba,0x1df));var _0xa9ab=function(_0x2794b5,_0x465159){_0x2794b5=_0x2794b5-0x0;var _0x15466c=_0x9aba[_0x2794b5];return _0x15466c;};'use strict';var multer=require(_0xa9ab('0x0'));var util=require(_0xa9ab('0x1'));var path=require(_0xa9ab('0x2'));var timeout=require(_0xa9ab('0x3'));var express=require('express');var router=express[_0xa9ab('0x4')]();var fs_extra=require(_0xa9ab('0x5'));var auth=require(_0xa9ab('0x6'));var interaction=require(_0xa9ab('0x7'));var config=require('../../config/environment');var controller=require(_0xa9ab('0x8'));router[_0xa9ab('0x9')]('/',auth[_0xa9ab('0xa')](),controller[_0xa9ab('0xb')]);router['get'](_0xa9ab('0xc'),auth[_0xa9ab('0xa')](),controller[_0xa9ab('0xd')]);router[_0xa9ab('0x9')](_0xa9ab('0xe'),auth[_0xa9ab('0xa')](),controller['show']);router[_0xa9ab('0x9')]('/:id/dispositions',auth['isAuthenticated'](),controller['getDispositions']);router['get'](_0xa9ab('0xf'),auth[_0xa9ab('0xa')](),controller[_0xa9ab('0x10')]);router[_0xa9ab('0x9')](_0xa9ab('0x11'),auth[_0xa9ab('0xa')](),controller[_0xa9ab('0x12')]);router['get']('/:id/fields',auth[_0xa9ab('0xa')](),controller['getCustomFields']);router[_0xa9ab('0x9')](_0xa9ab('0x13'),auth[_0xa9ab('0xa')](),controller[_0xa9ab('0x14')]);router['post']('/',auth[_0xa9ab('0xa')](),controller[_0xa9ab('0x15')]);router[_0xa9ab('0x16')](_0xa9ab('0x17'),auth[_0xa9ab('0xa')](),controller[_0xa9ab('0x18')]);router['post'](_0xa9ab('0xf'),auth[_0xa9ab('0xa')](),controller['addContacts']);router[_0xa9ab('0x16')]('/:id/fields',auth['isAuthenticated'](),controller[_0xa9ab('0x19')]);router[_0xa9ab('0x16')](_0xa9ab('0x13'),auth[_0xa9ab('0xa')](),controller[_0xa9ab('0x1a')]);router[_0xa9ab('0x1b')]('/:id',auth[_0xa9ab('0xa')](),controller[_0xa9ab('0x1c')]);router[_0xa9ab('0x1d')](_0xa9ab('0xe'),auth[_0xa9ab('0xa')](),controller[_0xa9ab('0x1e')]);router['delete']('/:id/dispositions',auth['isAuthenticated'](),controller[_0xa9ab('0x1f')]);router[_0xa9ab('0x1d')](_0xa9ab('0x13'),auth['isAuthenticated'](),controller['removeAgents']);module[_0xa9ab('0x20')]=router; \ No newline at end of file +var _0x5178=['update','delete','destroy','removeDispositions','removeAgents','exports','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','get','index','/describe','isAuthenticated','describe','/:id','/:id/dispositions','getDispositions','/:id/contacts','getContacts','/:id/contacts/csv','/:id/fields','getCustomFields','getAgents','post','create','addDisposition','addCustomField','/:id/users','put'];(function(_0x5ddb1c,_0x5ea4df){var _0x354adc=function(_0x2dfb1f){while(--_0x2dfb1f){_0x5ddb1c['push'](_0x5ddb1c['shift']());}};_0x354adc(++_0x5ea4df);}(_0x5178,0x171));var _0x8517=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x5178[_0x3b380d];return _0x54502b;};'use strict';var multer=require('multer');var util=require(_0x8517('0x0'));var path=require(_0x8517('0x1'));var timeout=require(_0x8517('0x2'));var express=require(_0x8517('0x3'));var router=express[_0x8517('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x8517('0x5'));var config=require(_0x8517('0x6'));var controller=require('./cmList.controller');router[_0x8517('0x7')]('/',auth['isAuthenticated'](),controller[_0x8517('0x8')]);router[_0x8517('0x7')](_0x8517('0x9'),auth[_0x8517('0xa')](),controller[_0x8517('0xb')]);router['get'](_0x8517('0xc'),auth['isAuthenticated'](),controller['show']);router[_0x8517('0x7')](_0x8517('0xd'),auth['isAuthenticated'](),controller[_0x8517('0xe')]);router[_0x8517('0x7')](_0x8517('0xf'),auth[_0x8517('0xa')](),controller[_0x8517('0x10')]);router[_0x8517('0x7')](_0x8517('0x11'),auth[_0x8517('0xa')](),controller['getContactsCsv']);router[_0x8517('0x7')](_0x8517('0x12'),auth[_0x8517('0xa')](),controller[_0x8517('0x13')]);router[_0x8517('0x7')]('/:id/users',auth[_0x8517('0xa')](),controller[_0x8517('0x14')]);router[_0x8517('0x15')]('/',auth[_0x8517('0xa')](),controller[_0x8517('0x16')]);router[_0x8517('0x15')](_0x8517('0xd'),auth[_0x8517('0xa')](),controller[_0x8517('0x17')]);router[_0x8517('0x15')](_0x8517('0xf'),auth[_0x8517('0xa')](),controller['addContacts']);router[_0x8517('0x15')](_0x8517('0x12'),auth[_0x8517('0xa')](),controller[_0x8517('0x18')]);router[_0x8517('0x15')](_0x8517('0x19'),auth[_0x8517('0xa')](),controller['addAgents']);router[_0x8517('0x1a')]('/:id',auth['isAuthenticated'](),controller[_0x8517('0x1b')]);router[_0x8517('0x1c')](_0x8517('0xc'),auth[_0x8517('0xa')](),controller[_0x8517('0x1d')]);router[_0x8517('0x1c')]('/:id/dispositions',auth['isAuthenticated'](),controller[_0x8517('0x1e')]);router[_0x8517('0x1c')](_0x8517('0x19'),auth[_0x8517('0xa')](),controller[_0x8517('0x1f')]);module[_0x8517('0x20')]=router; \ No newline at end of file diff --git a/server/api/condition/condition.attributes.js b/server/api/condition/condition.attributes.js index 5ec1571..c2a6f93 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 _0x56bb=['field','STRING','exports','VIRTUAL'];(function(_0x51dc7e,_0x2b8f6f){var _0x39b9ef=function(_0x338ba7){while(--_0x338ba7){_0x51dc7e['push'](_0x51dc7e['shift']());}};_0x39b9ef(++_0x2b8f6f);}(_0x56bb,0x10e));var _0xb56b=function(_0x58792d,_0x14025a){_0x58792d=_0x58792d-0x0;var _0x418c8a=_0x56bb[_0x58792d];return _0x418c8a;};'use strict';var Sequelize=require('sequelize');module[_0xb56b('0x0')]={'name':{'type':Sequelize[_0xb56b('0x1')],'get':function(_0x139c53){return this['getDataValue'](_0xb56b('0x2'));}},'field':{'type':Sequelize[_0xb56b('0x3')],'allowNull':![]},'operator':{'type':Sequelize[_0xb56b('0x3')],'allowNull':![]},'value':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file +var _0x6efa=['field','STRING','exports','VIRTUAL','getDataValue'];(function(_0x580140,_0x21d7f7){var _0x3257bc=function(_0x1d44d5){while(--_0x1d44d5){_0x580140['push'](_0x580140['shift']());}};_0x3257bc(++_0x21d7f7);}(_0x6efa,0x192));var _0xa6ef=function(_0x2e4e19,_0x493b50){_0x2e4e19=_0x2e4e19-0x0;var _0x9ba20b=_0x6efa[_0x2e4e19];return _0x9ba20b;};'use strict';var Sequelize=require('sequelize');module[_0xa6ef('0x0')]={'name':{'type':Sequelize[_0xa6ef('0x1')],'get':function(_0x1683c1){return this[_0xa6ef('0x2')](_0xa6ef('0x3'));}},'field':{'type':Sequelize[_0xa6ef('0x4')],'allowNull':![]},'operator':{'type':Sequelize[_0xa6ef('0x4')],'allowNull':![]},'value':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/condition/condition.controller.js b/server/api/condition/condition.controller.js index 813d128..cd3e803 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(_0x1ec2b5,_0x5965ab){var _0x359b21=function(_0x45316e){while(--_0x45316e){_0x1ec2b5['push'](_0x1ec2b5['shift']());}};_0x359b21(++_0x5965ab);}(_0x7a54,0x106));var _0x47a5=function(_0x14889b,_0xdaf5ad){_0x14889b=_0x14889b-0x0;var _0x3cc4a2=_0x7a54[_0x14889b];return _0x3cc4a2;};'use strict';var emlformat=require(_0x47a5('0x0'));var rimraf=require(_0x47a5('0x1'));var zipdir=require(_0x47a5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x47a5('0x3'));var moment=require(_0x47a5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x47a5('0x5'));var util=require(_0x47a5('0x6'));var path=require(_0x47a5('0x7'));var sox=require(_0x47a5('0x8'));var csv=require(_0x47a5('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x47a5('0xa'));var _=require('lodash');var squel=require(_0x47a5('0xb'));var crypto=require(_0x47a5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x47a5('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x47a5('0xe'));var authService=require(_0x47a5('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x47a5('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x47a5('0x11'));var utils=require(_0x47a5('0x12'));var config=require(_0x47a5('0x13'));var licenseUtil=require(_0x47a5('0x14'));var db=require(_0x47a5('0x15'))['db'];function respondWithStatusCode(_0xd308b8,_0x1eae59){_0x1eae59=_0x1eae59||0xcc;return function(_0x5beb89){if(_0x5beb89){return _0xd308b8[_0x47a5('0x16')](_0x1eae59);}return _0xd308b8[_0x47a5('0x17')](_0x1eae59)[_0x47a5('0x18')]();};}function respondWithResult(_0x711793,_0x139f25){_0x139f25=_0x139f25||0xc8;return function(_0x620ee9){if(_0x620ee9){return _0x711793[_0x47a5('0x17')](_0x139f25)[_0x47a5('0x19')](_0x620ee9);}};}function respondWithFilteredResult(_0x4e99a8,_0x362359){return function(_0x11faf5){if(_0x11faf5){var _0x3b001e=typeof _0x362359[_0x47a5('0x1a')]===_0x47a5('0x1b')&&typeof _0x362359['limit']==='undefined';var _0x138bc0=_0x11faf5['count'];var _0x5247fd=_0x3b001e?0x0:_0x362359[_0x47a5('0x1a')];var _0xaf70a6=_0x3b001e?_0x11faf5[_0x47a5('0x1c')]:_0x362359[_0x47a5('0x1a')]+_0x362359[_0x47a5('0x1d')];var _0x12b98e;if(_0xaf70a6>=_0x138bc0){_0xaf70a6=_0x138bc0;_0x12b98e=0xc8;}else{_0x12b98e=0xce;}_0x4e99a8[_0x47a5('0x17')](_0x12b98e);return _0x4e99a8[_0x47a5('0x1e')](_0x47a5('0x1f'),_0x5247fd+'-'+_0xaf70a6+'/'+_0x138bc0)['json'](_0x11faf5);}return null;};}function patchUpdates(_0x1570bc){return function(_0xf160ba){try{jsonpatch['apply'](_0xf160ba,_0x1570bc,!![]);}catch(_0x2b0360){return BPromise[_0x47a5('0x20')](_0x2b0360);}return _0xf160ba[_0x47a5('0x21')]();};}function saveUpdates(_0x4c5910,_0xb8ae6c){return function(_0x2f142b){if(_0x2f142b){return _0x2f142b[_0x47a5('0x22')](_0x4c5910)[_0x47a5('0x23')](function(_0x5ef1b1){return _0x5ef1b1;});}return null;};}function removeEntity(_0xe2dea9,_0x385687){return function(_0x513981){if(_0x513981){return _0x513981[_0x47a5('0x24')]()[_0x47a5('0x23')](function(){_0xe2dea9[_0x47a5('0x17')](0xcc)[_0x47a5('0x18')]();});}};}function handleEntityNotFound(_0x3abd6a,_0x50bf17){return function(_0x53078a){if(!_0x53078a){_0x3abd6a[_0x47a5('0x16')](0x194);}return _0x53078a;};}function handleError(_0x5686db,_0x1ea9c8){_0x1ea9c8=_0x1ea9c8||0x1f4;return function(_0x5b6c4e){logger[_0x47a5('0x25')](_0x5b6c4e[_0x47a5('0x26')]);if(_0x5b6c4e[_0x47a5('0x27')]){delete _0x5b6c4e[_0x47a5('0x27')];}_0x5686db[_0x47a5('0x17')](_0x1ea9c8)[_0x47a5('0x28')](_0x5b6c4e);};}exports[_0x47a5('0x22')]=function(_0x136b14,_0x16631f){if(_0x136b14[_0x47a5('0x29')]['id']){delete _0x136b14[_0x47a5('0x29')]['id'];}return db[_0x47a5('0x2a')][_0x47a5('0x2b')]({'where':{'id':_0x136b14['params']['id']}})[_0x47a5('0x23')](handleEntityNotFound(_0x16631f,null))['then'](saveUpdates(_0x136b14[_0x47a5('0x29')],null))[_0x47a5('0x23')](respondWithResult(_0x16631f,null))[_0x47a5('0x2c')](handleError(_0x16631f,null));};exports['destroy']=function(_0x256650,_0x625952){return db[_0x47a5('0x2a')][_0x47a5('0x2b')]({'where':{'id':_0x256650['params']['id']}})['then'](handleEntityNotFound(_0x625952,null))[_0x47a5('0x23')](removeEntity(_0x625952,null))[_0x47a5('0x2c')](handleError(_0x625952,null));}; \ No newline at end of file +var _0x9957=['eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','reject','save','then','destroy','error','name','send','update','body','Condition','find','catch','params'];(function(_0x17ccac,_0x1c475c){var _0x5cae93=function(_0x2b13d1){while(--_0x2b13d1){_0x17ccac['push'](_0x17ccac['shift']());}};_0x5cae93(++_0x1c475c);}(_0x9957,0x93));var _0x7995=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x9957[_0x3947c9];return _0x2e7871;};'use strict';var emlformat=require(_0x7995('0x0'));var rimraf=require(_0x7995('0x1'));var zipdir=require(_0x7995('0x2'));var jsonpatch=require(_0x7995('0x3'));var rp=require('request-promise');var moment=require(_0x7995('0x4'));var BPromise=require(_0x7995('0x5'));var Mustache=require(_0x7995('0x6'));var util=require(_0x7995('0x7'));var path=require('path');var sox=require(_0x7995('0x8'));var csv=require(_0x7995('0x9'));var ejs=require(_0x7995('0xa'));var fs=require('fs');var fs_extra=require(_0x7995('0xb'));var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x7995('0x19'));var db=require(_0x7995('0x1a'))['db'];function respondWithStatusCode(_0x19a27e,_0x385f00){_0x385f00=_0x385f00||0xcc;return function(_0x281576){if(_0x281576){return _0x19a27e[_0x7995('0x1b')](_0x385f00);}return _0x19a27e[_0x7995('0x1c')](_0x385f00)['end']();};}function respondWithResult(_0x58f5ad,_0x2b4e94){_0x2b4e94=_0x2b4e94||0xc8;return function(_0x2233dd){if(_0x2233dd){return _0x58f5ad[_0x7995('0x1c')](_0x2b4e94)[_0x7995('0x1d')](_0x2233dd);}};}function respondWithFilteredResult(_0x3f1d3e,_0x1a5310){return function(_0x2202ce){if(_0x2202ce){var _0x41cbf0=typeof _0x1a5310['offset']===_0x7995('0x1e')&&typeof _0x1a5310['limit']===_0x7995('0x1e');var _0x37f297=_0x2202ce[_0x7995('0x1f')];var _0x291317=_0x41cbf0?0x0:_0x1a5310[_0x7995('0x20')];var _0x37a7d4=_0x41cbf0?_0x2202ce['count']:_0x1a5310['offset']+_0x1a5310[_0x7995('0x21')];var _0x5e6f90;if(_0x37a7d4>=_0x37f297){_0x37a7d4=_0x37f297;_0x5e6f90=0xc8;}else{_0x5e6f90=0xce;}_0x3f1d3e['status'](_0x5e6f90);return _0x3f1d3e[_0x7995('0x22')](_0x7995('0x23'),_0x291317+'-'+_0x37a7d4+'/'+_0x37f297)['json'](_0x2202ce);}return null;};}function patchUpdates(_0x3a9b54){return function(_0x51f276){try{jsonpatch['apply'](_0x51f276,_0x3a9b54,!![]);}catch(_0x3e4c54){return BPromise[_0x7995('0x24')](_0x3e4c54);}return _0x51f276[_0x7995('0x25')]();};}function saveUpdates(_0x1a8568,_0x460924){return function(_0x1c278a){if(_0x1c278a){return _0x1c278a['update'](_0x1a8568)[_0x7995('0x26')](function(_0x46ee4b){return _0x46ee4b;});}return null;};}function removeEntity(_0x204507,_0x285437){return function(_0x563799){if(_0x563799){return _0x563799[_0x7995('0x27')]()[_0x7995('0x26')](function(){_0x204507[_0x7995('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39df42,_0x34e70c){return function(_0x401dc3){if(!_0x401dc3){_0x39df42[_0x7995('0x1b')](0x194);}return _0x401dc3;};}function handleError(_0x3a3fcf,_0x2a307e){_0x2a307e=_0x2a307e||0x1f4;return function(_0x56691a){logger[_0x7995('0x28')](_0x56691a['stack']);if(_0x56691a[_0x7995('0x29')]){delete _0x56691a[_0x7995('0x29')];}_0x3a3fcf[_0x7995('0x1c')](_0x2a307e)[_0x7995('0x2a')](_0x56691a);};}exports[_0x7995('0x2b')]=function(_0x4b6f99,_0x9b2a15){if(_0x4b6f99['body']['id']){delete _0x4b6f99[_0x7995('0x2c')]['id'];}return db[_0x7995('0x2d')][_0x7995('0x2e')]({'where':{'id':_0x4b6f99['params']['id']}})['then'](handleEntityNotFound(_0x9b2a15,null))['then'](saveUpdates(_0x4b6f99[_0x7995('0x2c')],null))[_0x7995('0x26')](respondWithResult(_0x9b2a15,null))[_0x7995('0x2f')](handleError(_0x9b2a15,null));};exports[_0x7995('0x27')]=function(_0x2e3493,_0x1ca460){return db['Condition']['find']({'where':{'id':_0x2e3493[_0x7995('0x30')]['id']}})['then'](handleEntityNotFound(_0x1ca460,null))[_0x7995('0x26')](removeEntity(_0x1ca460,null))[_0x7995('0x2f')](handleError(_0x1ca460,null));}; \ No newline at end of file diff --git a/server/api/condition/condition.model.js b/server/api/condition/condition.model.js index 84c24ed..8e4a89c 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 _0x0dab=['rimraf','../../config/environment','./condition.attributes','exports','define','Condition','lodash','util','api','bluebird','request-promise','path'];(function(_0x134620,_0x4757df){var _0x7596c1=function(_0xb67974){while(--_0xb67974){_0x134620['push'](_0x134620['shift']());}};_0x7596c1(++_0x4757df);}(_0x0dab,0x96));var _0xb0da=function(_0x49576f,_0x31b631){_0x49576f=_0x49576f-0x0;var _0x39fb31=_0x0dab[_0x49576f];return _0x39fb31;};'use strict';var _=require(_0xb0da('0x0'));var util=require(_0xb0da('0x1'));var logger=require('../../config/logger')(_0xb0da('0x2'));var moment=require('moment');var BPromise=require(_0xb0da('0x3'));var rp=require(_0xb0da('0x4'));var fs=require('fs');var path=require(_0xb0da('0x5'));var rimraf=require(_0xb0da('0x6'));var config=require(_0xb0da('0x7'));var attributes=require(_0xb0da('0x8'));module[_0xb0da('0x9')]=function(_0x26020c,_0x46783b){return _0x26020c[_0xb0da('0xa')](_0xb0da('0xb'),attributes,{'tableName':'tools_conditions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9b87=['define','Condition','tools_conditions','util','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','./condition.attributes'];(function(_0x42b395,_0x31f665){var _0x4b072e=function(_0x274771){while(--_0x274771){_0x42b395['push'](_0x42b395['shift']());}};_0x4b072e(++_0x31f665);}(_0x9b87,0x1c6));var _0x79b8=function(_0x2c279f,_0x43c94c){_0x2c279f=_0x2c279f-0x0;var _0x4532d8=_0x9b87[_0x2c279f];return _0x4532d8;};'use strict';var _=require('lodash');var util=require(_0x79b8('0x0'));var logger=require(_0x79b8('0x1'))('api');var moment=require(_0x79b8('0x2'));var BPromise=require(_0x79b8('0x3'));var rp=require(_0x79b8('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x79b8('0x5'));var config=require(_0x79b8('0x6'));var attributes=require(_0x79b8('0x7'));module['exports']=function(_0x5eec9c,_0x2d14e7){return _0x5eec9c[_0x79b8('0x8')](_0x79b8('0x9'),attributes,{'tableName':_0x79b8('0xa'),'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 bdec700..9e999c8 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 _0x737a=['Condition,\x20%s,\x20%s','request\x20sent','debug','Condition,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then'];(function(_0x573808,_0x28a4df){var _0x282c64=function(_0x26b717){while(--_0x26b717){_0x573808['push'](_0x573808['shift']());}};_0x282c64(++_0x28a4df);}(_0x737a,0x14b));var _0xa737=function(_0x3ed97c,_0x5084cc){_0x3ed97c=_0x3ed97c-0x0;var _0x4409e7=_0x737a[_0x3ed97c];return _0x4409e7;};'use strict';var _=require(_0xa737('0x0'));var util=require(_0xa737('0x1'));var moment=require(_0xa737('0x2'));var BPromise=require(_0xa737('0x3'));var rs=require(_0xa737('0x4'));var fs=require('fs');var Redis=require(_0xa737('0x5'));var db=require(_0xa737('0x6'))['db'];var utils=require(_0xa737('0x7'));var logger=require('../../config/logger')(_0xa737('0x8'));var config=require(_0xa737('0x9'));var jayson=require(_0xa737('0xa'));var client=jayson[_0xa737('0xb')][_0xa737('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x9e32f9,_0x27d655,_0x1efa13){return new BPromise(function(_0x4b8ced,_0x6c1090){return client['request'](_0x9e32f9,_0x1efa13)[_0xa737('0xd')](function(_0x30a35a){logger['info'](_0xa737('0xe'),_0x27d655,_0xa737('0xf'));logger[_0xa737('0x10')](_0xa737('0x11'),_0x27d655,_0xa737('0xf'),JSON[_0xa737('0x12')](_0x30a35a));if(_0x30a35a[_0xa737('0x13')]){if(_0x30a35a[_0xa737('0x13')]['code']===0x1f4){logger[_0xa737('0x13')](_0xa737('0xe'),_0x27d655,_0x30a35a[_0xa737('0x13')]['message']);return _0x6c1090(_0x30a35a[_0xa737('0x13')][_0xa737('0x14')]);}logger['error'](_0xa737('0xe'),_0x27d655,_0x30a35a[_0xa737('0x13')][_0xa737('0x14')]);return _0x4b8ced(_0x30a35a[_0xa737('0x13')]['message']);}else{logger['info']('Condition,\x20%s,\x20%s',_0x27d655,_0xa737('0xf'));_0x4b8ced(_0x30a35a[_0xa737('0x15')][_0xa737('0x14')]);}})[_0xa737('0x16')](function(_0x35e45f){logger[_0xa737('0x13')](_0xa737('0xe'),_0x27d655,_0x35e45f);_0x6c1090(_0x35e45f);});});} \ No newline at end of file +var _0xa1f8=['message','catch','util','moment','randomstring','ioredis','../../config/logger','rpc','client','http','request','then','info','Condition,\x20%s,\x20%s','request\x20sent','debug','error','code'];(function(_0x582f72,_0x886d8){var _0x4cd5fe=function(_0x4ac1c7){while(--_0x4ac1c7){_0x582f72['push'](_0x582f72['shift']());}};_0x4cd5fe(++_0x886d8);}(_0xa1f8,0x110));var _0x8a1f=function(_0x237557,_0x5a14e6){_0x237557=_0x237557-0x0;var _0x5bec0a=_0xa1f8[_0x237557];return _0x5bec0a;};'use strict';var _=require('lodash');var util=require(_0x8a1f('0x0'));var moment=require(_0x8a1f('0x1'));var BPromise=require('bluebird');var rs=require(_0x8a1f('0x2'));var fs=require('fs');var Redis=require(_0x8a1f('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x8a1f('0x4'))(_0x8a1f('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x8a1f('0x6')][_0x8a1f('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x598e91,_0x5f2eb1,_0x3229fb){return new BPromise(function(_0x42e9b2,_0x289557){return client[_0x8a1f('0x8')](_0x598e91,_0x3229fb)[_0x8a1f('0x9')](function(_0x561016){logger[_0x8a1f('0xa')](_0x8a1f('0xb'),_0x5f2eb1,_0x8a1f('0xc'));logger[_0x8a1f('0xd')]('Condition,\x20%s,\x20%s,\x20%s',_0x5f2eb1,_0x8a1f('0xc'),JSON['stringify'](_0x561016));if(_0x561016[_0x8a1f('0xe')]){if(_0x561016[_0x8a1f('0xe')][_0x8a1f('0xf')]===0x1f4){logger[_0x8a1f('0xe')](_0x8a1f('0xb'),_0x5f2eb1,_0x561016[_0x8a1f('0xe')][_0x8a1f('0x10')]);return _0x289557(_0x561016[_0x8a1f('0xe')][_0x8a1f('0x10')]);}logger[_0x8a1f('0xe')](_0x8a1f('0xb'),_0x5f2eb1,_0x561016['error'][_0x8a1f('0x10')]);return _0x42e9b2(_0x561016[_0x8a1f('0xe')][_0x8a1f('0x10')]);}else{logger[_0x8a1f('0xa')](_0x8a1f('0xb'),_0x5f2eb1,_0x8a1f('0xc'));_0x42e9b2(_0x561016['result']['message']);}})[_0x8a1f('0x11')](function(_0xa356e8){logger[_0x8a1f('0xe')]('Condition,\x20%s,\x20%s',_0x5f2eb1,_0xa356e8);_0x289557(_0xa356e8);});});} \ No newline at end of file diff --git a/server/api/condition/index.js b/server/api/condition/index.js index 8583f53..2935a33 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 _0x81b9=['../../config/environment','put','/:id','update','delete','destroy','exports','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x16499e,_0x3c0e45){var _0xb48ff4=function(_0x5bae8a){while(--_0x5bae8a){_0x16499e['push'](_0x16499e['shift']());}};_0xb48ff4(++_0x3c0e45);}(_0x81b9,0x180));var _0x981b=function(_0x3bac46,_0x276fad){_0x3bac46=_0x3bac46-0x0;var _0x4f011f=_0x81b9[_0x3bac46];return _0x4f011f;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x981b('0x0'));var timeout=require(_0x981b('0x1'));var express=require(_0x981b('0x2'));var router=express[_0x981b('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x981b('0x4'));var interaction=require(_0x981b('0x5'));var config=require(_0x981b('0x6'));var controller=require('./condition.controller');router[_0x981b('0x7')](_0x981b('0x8'),auth['isAuthenticated'](),controller[_0x981b('0x9')]);router[_0x981b('0xa')](_0x981b('0x8'),auth['isAuthenticated'](),controller[_0x981b('0xb')]);module[_0x981b('0xc')]=router; \ No newline at end of file +var _0x1cc7=['destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','./condition.controller','put','/:id','isAuthenticated','update'];(function(_0x47c75a,_0x447086){var _0x1e6f62=function(_0x1a2907){while(--_0x1a2907){_0x47c75a['push'](_0x47c75a['shift']());}};_0x1e6f62(++_0x447086);}(_0x1cc7,0x1d0));var _0x71cc=function(_0x15798a,_0x5317ab){_0x15798a=_0x15798a-0x0;var _0xaa737a=_0x1cc7[_0x15798a];return _0xaa737a;};'use strict';var multer=require(_0x71cc('0x0'));var util=require(_0x71cc('0x1'));var path=require(_0x71cc('0x2'));var timeout=require(_0x71cc('0x3'));var express=require(_0x71cc('0x4'));var router=express[_0x71cc('0x5')]();var fs_extra=require(_0x71cc('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x71cc('0x7'));router[_0x71cc('0x8')](_0x71cc('0x9'),auth[_0x71cc('0xa')](),controller[_0x71cc('0xb')]);router['delete'](_0x71cc('0x9'),auth[_0x71cc('0xa')](),controller[_0x71cc('0xc')]);module[_0x71cc('0xd')]=router; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.attributes.js b/server/api/dashboard/dashboard.attributes.js index 94067fd..786d669 100644 --- a/server/api/dashboard/dashboard.attributes.js +++ b/server/api/dashboard/dashboard.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0713=['STRING','name'];(function(_0x413bb8,_0x5466f5){var _0x275992=function(_0x148419){while(--_0x148419){_0x413bb8['push'](_0x413bb8['shift']());}};_0x275992(++_0x5466f5);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x3071('0x0')],'allowNull':![],'unique':_0x3071('0x1')},'description':{'type':Sequelize[_0x3071('0x0')]}}; \ No newline at end of file +var _0x0713=['STRING','name'];(function(_0x2ed418,_0x3692c7){var _0x13e0c1=function(_0x43e746){while(--_0x43e746){_0x2ed418['push'](_0x2ed418['shift']());}};_0x13e0c1(++_0x3692c7);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x3071('0x0')],'allowNull':![],'unique':_0x3071('0x1')},'description':{'type':Sequelize[_0x3071('0x0')]}}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.controller.js b/server/api/dashboard/dashboard.controller.js index 4ddfe6a..a1c9277 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 _0x7746=['create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','CustomDashboards','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','iframe','attrs','https://','custom','attrPath','clock','HH:mm:ss','attrTimezone','value','0.00','attrFontSize','counter','attrMetric','attrChannel','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','pie-chart','attrSerie1','total','attrSerie2','attrSerie3','attrVoiceQueues','voice','web-report','reportType','attrReport','attrRefresh','widgetAttributes:\x20%s','stringify','addItem','DashboardId','getItems','findOne','DashboardItem','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','get','UserProfileResource','error','stack','name','send','index','map','Dashboard','rawAttributes','fieldName','type','key','model','keys','query','filters','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','include','findAll','catch','show','params','intersection','includeAll','find'];(function(_0x54ecf0,_0x5a0e76){var _0x3e157e=function(_0x3d9d0f){while(--_0x3d9d0f){_0x54ecf0['push'](_0x54ecf0['shift']());}};_0x3e157e(++_0x5a0e76);}(_0x7746,0x1d6));var _0x6774=function(_0x1584d3,_0x26bd64){_0x1584d3=_0x1584d3-0x0;var _0x5e2d76=_0x7746[_0x1584d3];return _0x5e2d76;};'use strict';var emlformat=require(_0x6774('0x0'));var rimraf=require(_0x6774('0x1'));var zipdir=require(_0x6774('0x2'));var jsonpatch=require(_0x6774('0x3'));var rp=require(_0x6774('0x4'));var moment=require(_0x6774('0x5'));var BPromise=require(_0x6774('0x6'));var Mustache=require('mustache');var util=require(_0x6774('0x7'));var path=require(_0x6774('0x8'));var sox=require(_0x6774('0x9'));var csv=require(_0x6774('0xa'));var ejs=require(_0x6774('0xb'));var fs=require('fs');var fs_extra=require(_0x6774('0xc'));var _=require('lodash');var squel=require(_0x6774('0xd'));var crypto=require(_0x6774('0xe'));var jsforce=require(_0x6774('0xf'));var deskjs=require(_0x6774('0x10'));var toCsv=require(_0x6774('0xa'));var querystring=require(_0x6774('0x11'));var Papa=require(_0x6774('0x12'));var Redis=require('ioredis');var authService=require(_0x6774('0x13'));var qs=require(_0x6774('0x14'));var as=require(_0x6774('0x15'));var hardwareService=require(_0x6774('0x16'));var logger=require('../../config/logger')(_0x6774('0x17'));var utils=require('../../config/utils');var config=require(_0x6774('0x18'));var licenseUtil=require(_0x6774('0x19'));var db=require(_0x6774('0x1a'))['db'];config[_0x6774('0x1b')]=_[_0x6774('0x1c')](config['redis'],{'host':_0x6774('0x1d'),'port':0x18eb});var socket=require(_0x6774('0x1e'))(new Redis(config['redis']));require('./dashboard.socket')[_0x6774('0x1f')](socket);function respondWithStatusCode(_0x223e79,_0x3be741){_0x3be741=_0x3be741||0xcc;return function(_0xf4add5){if(_0xf4add5){return _0x223e79[_0x6774('0x20')](_0x3be741);}return _0x223e79[_0x6774('0x21')](_0x3be741)[_0x6774('0x22')]();};}function respondWithResult(_0x42ebbb,_0x5a65f9){_0x5a65f9=_0x5a65f9||0xc8;return function(_0x3b7828){if(_0x3b7828){return _0x42ebbb[_0x6774('0x21')](_0x5a65f9)[_0x6774('0x23')](_0x3b7828);}};}function respondWithFilteredResult(_0x38dc10,_0xa488){return function(_0x236429){if(_0x236429){var _0x326362=typeof _0xa488[_0x6774('0x24')]===_0x6774('0x25')&&typeof _0xa488[_0x6774('0x26')]===_0x6774('0x25');var _0x5c0f9b=_0x236429[_0x6774('0x27')];var _0xc963f0=_0x326362?0x0:_0xa488[_0x6774('0x24')];var _0x5f4c1a=_0x326362?_0x236429['count']:_0xa488[_0x6774('0x24')]+_0xa488[_0x6774('0x26')];var _0x8fa7a8;if(_0x5f4c1a>=_0x5c0f9b){_0x5f4c1a=_0x5c0f9b;_0x8fa7a8=0xc8;}else{_0x8fa7a8=0xce;}_0x38dc10[_0x6774('0x21')](_0x8fa7a8);return _0x38dc10[_0x6774('0x28')](_0x6774('0x29'),_0xc963f0+'-'+_0x5f4c1a+'/'+_0x5c0f9b)[_0x6774('0x23')](_0x236429);}return null;};}function patchUpdates(_0x543ce1){return function(_0x45a04f){try{jsonpatch[_0x6774('0x2a')](_0x45a04f,_0x543ce1,!![]);}catch(_0x3626d6){return BPromise[_0x6774('0x2b')](_0x3626d6);}return _0x45a04f[_0x6774('0x2c')]();};}function saveUpdates(_0x5c6f19,_0x5e21f2){return function(_0x1f5e66){if(_0x1f5e66){return _0x1f5e66[_0x6774('0x2d')](_0x5c6f19)[_0x6774('0x2e')](function(_0x7d0770){return _0x7d0770;});}return null;};}function removeEntity(_0x5f87ce,_0x47d287){return function(_0x13bc3d){if(_0x13bc3d){return _0x13bc3d[_0x6774('0x2f')]()[_0x6774('0x2e')](function(){var _0x3e37db=_0x13bc3d[_0x6774('0x30')]({'plain':!![]});var _0x1a05ae='CustomDashboards';return db[_0x6774('0x31')]['destroy']({'where':{'type':_0x1a05ae,'resourceId':_0x3e37db['id']}})['then'](function(){return _0x13bc3d;});})['then'](function(){_0x5f87ce[_0x6774('0x21')](0xcc)[_0x6774('0x22')]();});}};}function handleEntityNotFound(_0x46c980,_0x455c58){return function(_0x287942){if(!_0x287942){_0x46c980['sendStatus'](0x194);}return _0x287942;};}function handleError(_0xd7d74f,_0x5a7166){_0x5a7166=_0x5a7166||0x1f4;return function(_0x16a227){logger[_0x6774('0x32')](_0x16a227[_0x6774('0x33')]);if(_0x16a227[_0x6774('0x34')]){delete _0x16a227[_0x6774('0x34')];}_0xd7d74f[_0x6774('0x21')](_0x5a7166)[_0x6774('0x35')](_0x16a227);};}exports[_0x6774('0x36')]=function(_0x4d69bc,_0xbbf4ff){var _0x1731da={},_0x261282={},_0x113004={'count':0x0,'rows':[]};var _0x2fbd65=_[_0x6774('0x37')](db[_0x6774('0x38')][_0x6774('0x39')],function(_0x41211a){return{'name':_0x41211a[_0x6774('0x3a')],'type':_0x41211a[_0x6774('0x3b')][_0x6774('0x3c')]};});_0x261282[_0x6774('0x3d')]=_[_0x6774('0x37')](_0x2fbd65,_0x6774('0x34'));_0x261282['query']=_[_0x6774('0x3e')](_0x4d69bc[_0x6774('0x3f')]);_0x261282[_0x6774('0x40')]=_['intersection'](_0x261282[_0x6774('0x3d')],_0x261282[_0x6774('0x3f')]);_0x1731da['attributes']=_['intersection'](_0x261282['model'],qs[_0x6774('0x41')](_0x4d69bc[_0x6774('0x3f')]['fields']));_0x1731da[_0x6774('0x42')]=_0x1731da['attributes'][_0x6774('0x43')]?_0x1731da[_0x6774('0x42')]:_0x261282[_0x6774('0x3d')];if(!_0x4d69bc['query'][_0x6774('0x44')](_0x6774('0x45'))){_0x1731da['limit']=qs['limit'](_0x4d69bc[_0x6774('0x3f')][_0x6774('0x26')]);_0x1731da['offset']=qs['offset'](_0x4d69bc[_0x6774('0x3f')][_0x6774('0x24')]);}_0x1731da[_0x6774('0x46')]=qs[_0x6774('0x47')](_0x4d69bc[_0x6774('0x3f')][_0x6774('0x47')]);_0x1731da['where']=qs[_0x6774('0x40')](_[_0x6774('0x48')](_0x4d69bc[_0x6774('0x3f')],_0x261282[_0x6774('0x40')]),_0x2fbd65);if(_0x4d69bc[_0x6774('0x3f')][_0x6774('0x49')]){_0x1731da[_0x6774('0x4a')]=_[_0x6774('0x4b')](_0x1731da['where'],{'$or':_[_0x6774('0x37')](_0x2fbd65,function(_0x2e7ca5){if(_0x2e7ca5[_0x6774('0x3b')]!==_0x6774('0x4c')){var _0x1a9314={};_0x1a9314[_0x2e7ca5[_0x6774('0x34')]]={'$like':'%'+_0x4d69bc[_0x6774('0x3f')][_0x6774('0x49')]+'%'};return _0x1a9314;}})});}_0x1731da=_[_0x6774('0x4b')]({},_0x1731da,_0x4d69bc[_0x6774('0x4d')]);var _0x135c31={'where':_0x1731da[_0x6774('0x4a')]};return db[_0x6774('0x38')][_0x6774('0x27')](_0x135c31)['then'](function(_0x28d0e3){_0x113004['count']=_0x28d0e3;if(_0x4d69bc[_0x6774('0x3f')]['includeAll']){_0x1731da[_0x6774('0x4e')]=[{'all':!![]}];}return db[_0x6774('0x38')][_0x6774('0x4f')](_0x1731da);})[_0x6774('0x2e')](function(_0x538e9f){_0x113004['rows']=_0x538e9f;return _0x113004;})[_0x6774('0x2e')](respondWithFilteredResult(_0xbbf4ff,_0x1731da))[_0x6774('0x50')](handleError(_0xbbf4ff,null));};exports[_0x6774('0x51')]=function(_0x35c7d0,_0x2eb42e){var _0x3861b5={'raw':![],'where':{'id':_0x35c7d0[_0x6774('0x52')]['id']}},_0x570b6b={};_0x570b6b[_0x6774('0x3d')]=_['keys'](db[_0x6774('0x38')]['rawAttributes']);_0x570b6b[_0x6774('0x3f')]=_[_0x6774('0x3e')](_0x35c7d0['query']);_0x570b6b[_0x6774('0x40')]=_[_0x6774('0x53')](_0x570b6b[_0x6774('0x3d')],_0x570b6b['query']);_0x3861b5[_0x6774('0x42')]=_['intersection'](_0x570b6b[_0x6774('0x3d')],qs['fields'](_0x35c7d0['query']['fields']));_0x3861b5[_0x6774('0x42')]=_0x3861b5[_0x6774('0x42')][_0x6774('0x43')]?_0x3861b5[_0x6774('0x42')]:_0x570b6b[_0x6774('0x3d')];if(_0x35c7d0[_0x6774('0x3f')][_0x6774('0x54')]){_0x3861b5['include']=[{'all':!![]}];}_0x3861b5=_[_0x6774('0x4b')]({},_0x3861b5,_0x35c7d0[_0x6774('0x4d')]);return db[_0x6774('0x38')][_0x6774('0x55')](_0x3861b5)['then'](handleEntityNotFound(_0x2eb42e,null))[_0x6774('0x2e')](respondWithResult(_0x2eb42e,null))['catch'](handleError(_0x2eb42e,null));};exports[_0x6774('0x56')]=function(_0x4a088a,_0x1f4e30){return db[_0x6774('0x38')][_0x6774('0x56')](_0x4a088a[_0x6774('0x57')],{})['then'](function(_0x48ec1a){var _0x592bf8=_0x4a088a['user'][_0x6774('0x30')]({'plain':!![]});if(!_0x592bf8)throw new Error(_0x6774('0x58'));if(_0x592bf8[_0x6774('0x59')]===_0x6774('0x5a')){var _0x53b9cc=_0x48ec1a[_0x6774('0x30')]({'plain':!![]});var _0x1a1243=_0x6774('0x5b');return db[_0x6774('0x5c')]['find']({'where':{'name':_0x1a1243,'userProfileId':_0x592bf8[_0x6774('0x5d')]},'raw':!![]})[_0x6774('0x2e')](function(_0x26cbe8){if(_0x26cbe8&&_0x26cbe8[_0x6774('0x5e')]===0x0){return db['UserProfileResource'][_0x6774('0x56')]({'name':_0x53b9cc['name'],'resourceId':_0x53b9cc['id'],'type':_0x26cbe8['name'],'sectionId':_0x26cbe8['id']},{})[_0x6774('0x2e')](function(){return _0x48ec1a;});}else{return _0x48ec1a;}})[_0x6774('0x50')](function(_0x4d9e05){logger[_0x6774('0x32')](_0x6774('0x5f'),_0x4d9e05);throw _0x4d9e05;});}return _0x48ec1a;})['then'](respondWithResult(_0x1f4e30,0xc9))['catch'](handleError(_0x1f4e30,null));};exports[_0x6774('0x60')]=function(_0x4febfa,_0x5c8e47){var _0x24492c={'where':{'id':_0x4febfa[_0x6774('0x52')]['id']}},_0x467ad7={};_0x467ad7['model']=_['keys'](db[_0x6774('0x38')][_0x6774('0x39')]);_0x24492c[_0x6774('0x42')]=_['intersection'](_0x467ad7[_0x6774('0x3d')],qs['fields'](_0x4febfa[_0x6774('0x3f')][_0x6774('0x41')]));_0x24492c[_0x6774('0x42')]=_0x24492c['attributes'][_0x6774('0x43')]?_0x24492c[_0x6774('0x42')]:_0x467ad7[_0x6774('0x3d')];if(_0x4febfa[_0x6774('0x3f')][_0x6774('0x54')]){_0x24492c[_0x6774('0x4e')]=[{'all':!![]}];}_0x24492c=_[_0x6774('0x4b')]({},_0x24492c,_0x4febfa[_0x6774('0x4d')]);return db[_0x6774('0x38')][_0x6774('0x55')](_0x24492c)[_0x6774('0x2e')](handleEntityNotFound(_0x5c8e47,null))[_0x6774('0x2e')](function(_0x393da9){if(_0x393da9){var _0x462198=_0x393da9[_0x6774('0x30')]({'plain':!![]});_0x462198=qs[_0x6774('0x61')](_0x462198,['id',_0x6774('0x62'),_0x6774('0x63')]);_0x4febfa['body']=_[_0x6774('0x61')](_0x4febfa['body'],['id',_0x6774('0x62'),_0x6774('0x63')]);return db[_0x6774('0x38')][_0x6774('0x56')](_[_0x6774('0x4b')](_0x462198,_0x4febfa['body']),{'include':_0x4febfa[_0x6774('0x3f')][_0x6774('0x54')]?[{'all':!![]}]:undefined})[_0x6774('0x2e')](function(_0x20bbfb){var _0x4c7f80=_0x4febfa[_0x6774('0x5a')][_0x6774('0x30')]({'plain':!![]});if(!_0x4c7f80)throw new Error(_0x6774('0x58'));if(_0x4c7f80[_0x6774('0x59')]===_0x6774('0x5a')){var _0x3cb787=_0x20bbfb[_0x6774('0x30')]({'plain':!![]});var _0x46b5a4='CustomDashboards';return db[_0x6774('0x5c')][_0x6774('0x55')]({'where':{'name':_0x46b5a4,'userProfileId':_0x4c7f80[_0x6774('0x5d')]},'raw':!![]})[_0x6774('0x2e')](function(_0x5c66d1){if(_0x5c66d1&&_0x5c66d1[_0x6774('0x5e')]===0x0){return db[_0x6774('0x31')]['create']({'name':_0x3cb787['name'],'resourceId':_0x3cb787['id'],'type':_0x5c66d1[_0x6774('0x34')],'sectionId':_0x5c66d1['id']},{})[_0x6774('0x2e')](function(){return _0x20bbfb;});}else{return _0x20bbfb;}})[_0x6774('0x50')](function(_0x1d8262){logger[_0x6774('0x32')](_0x6774('0x5f'),_0x1d8262);throw _0x1d8262;});}return _0x20bbfb;});}})['then'](respondWithResult(_0x5c8e47,0xc9))[_0x6774('0x50')](handleError(_0x5c8e47,null));};exports[_0x6774('0x2d')]=function(_0x2640ec,_0x15c9c9){if(_0x2640ec[_0x6774('0x57')]['id']){delete _0x2640ec['body']['id'];}return db[_0x6774('0x38')][_0x6774('0x55')]({'where':{'id':_0x2640ec[_0x6774('0x52')]['id']}})[_0x6774('0x2e')](handleEntityNotFound(_0x15c9c9,null))[_0x6774('0x2e')](saveUpdates(_0x2640ec[_0x6774('0x57')],null))['then'](respondWithResult(_0x15c9c9,null))[_0x6774('0x50')](handleError(_0x15c9c9,null));};exports[_0x6774('0x2f')]=function(_0x1d0561,_0x4cd4fb){return db[_0x6774('0x38')][_0x6774('0x55')]({'where':{'id':_0x1d0561[_0x6774('0x52')]['id']}})[_0x6774('0x2e')](handleEntityNotFound(_0x4cd4fb,null))[_0x6774('0x2e')](removeEntity(_0x4cd4fb,null))['catch'](handleError(_0x4cd4fb,null));};function widgetAttributes(_0x1029e1){try{switch(_0x1029e1[_0x6774('0x3b')]){case _0x6774('0x64'):return[{'name':'attrUrl','value':_0x1029e1['attrUrl']||(_0x1029e1[_0x6774('0x65')]&&_0x1029e1[_0x6774('0x65')][0x0]?_0x1029e1[_0x6774('0x65')][0x0]['value']:undefined)||_0x6774('0x66')}];case _0x6774('0x67'):return[{'name':_0x6774('0x68'),'value':_0x1029e1[_0x6774('0x68')]||(_0x1029e1[_0x6774('0x65')]&&_0x1029e1[_0x6774('0x65')][0x0]?_0x1029e1[_0x6774('0x65')][0x0]['value']:undefined)||''}];case _0x6774('0x69'):return[{'name':'attrHourFormat','value':_0x1029e1['attrHourFormat']||(_0x1029e1[_0x6774('0x65')]&&_0x1029e1[_0x6774('0x65')][0x0]?_0x1029e1[_0x6774('0x65')][0x0]['value']:undefined)||_0x6774('0x6a')},{'name':_0x6774('0x6b'),'value':_0x1029e1[_0x6774('0x6b')]||(_0x1029e1['attrs']&&_0x1029e1[_0x6774('0x65')][0x1]?_0x1029e1[_0x6774('0x65')][0x1][_0x6774('0x6c')]:undefined)||_0x6774('0x6d')},{'name':_0x6774('0x6e'),'value':_0x1029e1[_0x6774('0x6e')]||(_0x1029e1[_0x6774('0x65')]&&_0x1029e1[_0x6774('0x65')][0x2]?_0x1029e1[_0x6774('0x65')][0x2][_0x6774('0x6c')]:undefined)||0xc}];case _0x6774('0x6f'):return[{'name':_0x6774('0x70'),'value':_0x1029e1[_0x6774('0x70')]||(_0x1029e1[_0x6774('0x65')]&&_0x1029e1[_0x6774('0x65')][0x0]?_0x1029e1['attrs'][0x0][_0x6774('0x6c')]:undefined)||'total'},{'name':'attrVoiceQueues','value':_0x1029e1['attrVoiceQueues']||(_0x1029e1['attrs']&&_0x1029e1[_0x6774('0x65')][0x1]?_0x1029e1[_0x6774('0x65')][0x1]['value']:undefined)||[]},{'name':_0x6774('0x6e'),'value':_0x1029e1[_0x6774('0x6e')]||(_0x1029e1['attrs']&&_0x1029e1[_0x6774('0x65')][0x2]?_0x1029e1[_0x6774('0x65')][0x2][_0x6774('0x6c')]:undefined)||0x14},{'name':_0x6774('0x71'),'value':_0x1029e1[_0x6774('0x71')]||(_0x1029e1[_0x6774('0x65')]&&_0x1029e1[_0x6774('0x65')][0x3]?_0x1029e1[_0x6774('0x65')][0x3][_0x6774('0x6c')]:undefined)||'voice'},{'name':'attrEmailAccounts','value':_0x1029e1[_0x6774('0x72')]||(_0x1029e1[_0x6774('0x65')]&&_0x1029e1[_0x6774('0x65')][0x4]?_0x1029e1[_0x6774('0x65')][0x4][_0x6774('0x6c')]:undefined)||''},{'name':_0x6774('0x73'),'value':_0x1029e1[_0x6774('0x73')]||(_0x1029e1['attrs']&&_0x1029e1[_0x6774('0x65')][0x5]?_0x1029e1[_0x6774('0x65')][0x5][_0x6774('0x6c')]:undefined)||''},{'name':_0x6774('0x74'),'value':_0x1029e1[_0x6774('0x74')]||(_0x1029e1[_0x6774('0x65')]&&_0x1029e1['attrs'][0x6]?_0x1029e1['attrs'][0x6]['value']:undefined)||''},{'name':_0x6774('0x75'),'value':_0x1029e1[_0x6774('0x75')]||(_0x1029e1[_0x6774('0x65')]&&_0x1029e1[_0x6774('0x65')][0x7]?_0x1029e1[_0x6774('0x65')][0x7]['value']:undefined)||''},{'name':_0x6774('0x76'),'value':_0x1029e1[_0x6774('0x76')]||(_0x1029e1[_0x6774('0x65')]&&_0x1029e1[_0x6774('0x65')][0x8]?_0x1029e1[_0x6774('0x65')][0x8]['value']:undefined)||''},{'name':_0x6774('0x77'),'value':_0x1029e1['attrChatWebsites']||(_0x1029e1[_0x6774('0x65')]&&_0x1029e1['attrs'][0x9]?_0x1029e1['attrs'][0x9][_0x6774('0x6c')]:undefined)||''}];case _0x6774('0x78'):case _0x6774('0x79'):return[{'name':_0x6774('0x7a'),'value':_0x1029e1['attrSerie1']||(_0x1029e1[_0x6774('0x65')]&&_0x1029e1['attrs'][0x0]?_0x1029e1[_0x6774('0x65')][0x0][_0x6774('0x6c')]:undefined)||_0x6774('0x7b')},{'name':'attrSerie2','value':_0x1029e1[_0x6774('0x7c')]||(_0x1029e1['attrs']&&_0x1029e1['attrs'][0x1]?_0x1029e1[_0x6774('0x65')][0x1][_0x6774('0x6c')]:undefined)||null},{'name':_0x6774('0x7d'),'value':_0x1029e1['attrSerie3']||(_0x1029e1['attrs']&&_0x1029e1[_0x6774('0x65')][0x2]?_0x1029e1['attrs'][0x2][_0x6774('0x6c')]:undefined)||null},{'name':_0x6774('0x7e'),'value':_0x1029e1[_0x6774('0x7e')]||(_0x1029e1[_0x6774('0x65')]&&_0x1029e1[_0x6774('0x65')][0x3]?_0x1029e1[_0x6774('0x65')][0x3]['value']:undefined)||[]},{'name':_0x6774('0x71'),'value':_0x1029e1[_0x6774('0x71')]||(_0x1029e1[_0x6774('0x65')]&&_0x1029e1[_0x6774('0x65')][0x4]?_0x1029e1['attrs'][0x4][_0x6774('0x6c')]:undefined)||_0x6774('0x7f')},{'name':_0x6774('0x72'),'value':_0x1029e1['attrEmailAccounts']||(_0x1029e1[_0x6774('0x65')]&&_0x1029e1[_0x6774('0x65')][0x5]?_0x1029e1['attrs'][0x5][_0x6774('0x6c')]:undefined)||''},{'name':_0x6774('0x73'),'value':_0x1029e1[_0x6774('0x73')]||(_0x1029e1[_0x6774('0x65')]&&_0x1029e1[_0x6774('0x65')][0x6]?_0x1029e1[_0x6774('0x65')][0x6]['value']:undefined)||''},{'name':'attrSmsAccounts','value':_0x1029e1[_0x6774('0x74')]||(_0x1029e1['attrs']&&_0x1029e1[_0x6774('0x65')][0x7]?_0x1029e1[_0x6774('0x65')][0x7][_0x6774('0x6c')]:undefined)||''},{'name':_0x6774('0x75'),'value':_0x1029e1['attrOpenchannelAccounts']||(_0x1029e1[_0x6774('0x65')]&&_0x1029e1[_0x6774('0x65')][0x8]?_0x1029e1[_0x6774('0x65')][0x8][_0x6774('0x6c')]:undefined)||''},{'name':_0x6774('0x76'),'value':_0x1029e1[_0x6774('0x76')]||(_0x1029e1[_0x6774('0x65')]&&_0x1029e1[_0x6774('0x65')][0x9]?_0x1029e1[_0x6774('0x65')][0x9][_0x6774('0x6c')]:undefined)||''},{'name':_0x6774('0x77'),'value':_0x1029e1[_0x6774('0x77')]||(_0x1029e1['attrs']&&_0x1029e1[_0x6774('0x65')][0xa]?_0x1029e1[_0x6774('0x65')][0xa]['value']:undefined)||''}];case _0x6774('0x80'):return[{'name':'attrReport','type':_0x1029e1[_0x6774('0x81')]||(_0x1029e1[_0x6774('0x65')]&&_0x1029e1['attrs'][0x0]?_0x1029e1[_0x6774('0x65')][0x0][_0x6774('0x3b')]:undefined)||null,'value':_0x1029e1[_0x6774('0x82')]||(_0x1029e1[_0x6774('0x65')]&&_0x1029e1[_0x6774('0x65')][0x0]?_0x1029e1['attrs'][0x0][_0x6774('0x6c')]:undefined)||null},{'name':_0x6774('0x83'),'value':_0x1029e1[_0x6774('0x83')]||(_0x1029e1[_0x6774('0x65')]&&_0x1029e1['attrs'][0x1]?_0x1029e1[_0x6774('0x65')][0x1][_0x6774('0x6c')]:undefined)||0x0}];default:return[];}}catch(_0xe088f6){logger['error'](_0x6774('0x84'),JSON[_0x6774('0x85')](_0xe088f6));return[];}}exports[_0x6774('0x86')]=function(_0x17c5c0,_0x59ecda,_0x309a45){if(_0x17c5c0[_0x6774('0x57')]['id']){delete _0x17c5c0[_0x6774('0x57')]['id'];}return db[_0x6774('0x38')][_0x6774('0x55')]({'where':{'id':_0x17c5c0['params']['id']}})['then'](handleEntityNotFound(_0x59ecda,null))['then'](function(_0x451085){if(_0x451085){_0x17c5c0[_0x6774('0x57')][_0x6774('0x87')]=_0x451085['id'];_0x17c5c0[_0x6774('0x57')][_0x6774('0x65')]=widgetAttributes(_0x17c5c0['body']);return db['DashboardItem'][_0x6774('0x56')](_0x17c5c0[_0x6774('0x57')]);}})[_0x6774('0x2e')](respondWithResult(_0x59ecda,null))[_0x6774('0x50')](handleError(_0x59ecda,null));};exports[_0x6774('0x88')]=function(_0x2e3694,_0x3a4f46,_0x33cfbc){var _0x5b1350={};var _0x3b24de={};var _0x3cb9de;var _0x4788af;return db['Dashboard'][_0x6774('0x89')]({'where':{'id':_0x2e3694['params']['id']}})['then'](handleEntityNotFound(_0x3a4f46,null))['then'](function(_0x3aab89){if(_0x3aab89){_0x3cb9de=_0x3aab89;_0x3b24de[_0x6774('0x3d')]=_[_0x6774('0x3e')](db[_0x6774('0x8a')][_0x6774('0x39')]);_0x3b24de[_0x6774('0x3f')]=_[_0x6774('0x3e')](_0x2e3694[_0x6774('0x3f')]);_0x3b24de['filters']=_[_0x6774('0x53')](_0x3b24de[_0x6774('0x3d')],_0x3b24de[_0x6774('0x3f')]);_0x5b1350[_0x6774('0x42')]=_['intersection'](_0x3b24de[_0x6774('0x3d')],qs[_0x6774('0x41')](_0x2e3694[_0x6774('0x3f')]['fields']));_0x5b1350[_0x6774('0x42')]=_0x5b1350[_0x6774('0x42')][_0x6774('0x43')]?_0x5b1350['attributes']:_0x3b24de[_0x6774('0x3d')];_0x5b1350[_0x6774('0x46')]=qs[_0x6774('0x47')](_0x2e3694['query']['sort']);_0x5b1350[_0x6774('0x4a')]=qs[_0x6774('0x40')](_[_0x6774('0x48')](_0x2e3694[_0x6774('0x3f')],_0x3b24de[_0x6774('0x40')]));if(_0x2e3694[_0x6774('0x3f')][_0x6774('0x49')]){_0x5b1350[_0x6774('0x4a')]=_[_0x6774('0x4b')](_0x5b1350[_0x6774('0x4a')],{'$or':_[_0x6774('0x37')](_0x5b1350['attributes'],function(_0x2dcc6e){var _0x1158fd={};_0x1158fd[_0x2dcc6e]={'$like':'%'+_0x2e3694[_0x6774('0x3f')][_0x6774('0x49')]+'%'};return _0x1158fd;})});}_0x5b1350=_[_0x6774('0x4b')]({},_0x5b1350,_0x2e3694[_0x6774('0x4d')]);return _0x3cb9de['getItems'](_0x5b1350);}})[_0x6774('0x2e')](function(_0x44b962){if(_0x44b962){_0x4788af=_0x44b962[_0x6774('0x43')];if(!_0x2e3694[_0x6774('0x3f')][_0x6774('0x44')](_0x6774('0x45'))){_0x5b1350[_0x6774('0x26')]=qs[_0x6774('0x26')](_0x2e3694[_0x6774('0x3f')]['limit']);_0x5b1350[_0x6774('0x24')]=qs[_0x6774('0x24')](_0x2e3694[_0x6774('0x3f')]['offset']);}return _0x3cb9de[_0x6774('0x88')](_0x5b1350);}})['then'](function(_0x332b30){if(_0x332b30){return _0x332b30?{'count':_0x4788af,'rows':_0x332b30}:null;}})[_0x6774('0x2e')](respondWithResult(_0x3a4f46,null))['catch'](handleError(_0x3a4f46,null));}; \ No newline at end of file +var _0x2c8c=['limit','set','Content-Range','apply','save','then','destroy','get','CustomDashboards','UserProfileResource','sendStatus','error','stack','send','index','map','Dashboard','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','name','options','includeAll','include','findAll','rows','catch','show','length','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','omit','createdAt','body','updatedAt','update','attrUrl','attrs','https://','custom','attrPath','value','clock','attrHourFormat','HH:mm:ss','attrTimezone','attrFontSize','counter','attrMetric','total','attrVoiceQueues','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrChatWebsites','multibar-chart','attrSerie1','attrSerie3','attrWhatsappAccounts','web-report','attrReport','reportType','attrRefresh','stringify','addItem','findOne','DashboardItem','getItems','nolimit','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','fs-extra','lodash','crypto','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','localhost','socket.io-emitter','redis','register','end','status','json','undefined','count','offset'];(function(_0x33f5ed,_0x3c69b0){var _0x34cf07=function(_0x32e720){while(--_0x32e720){_0x33f5ed['push'](_0x33f5ed['shift']());}};_0x34cf07(++_0x3c69b0);}(_0x2c8c,0x1e8));var _0xc2c8=function(_0x4aaa5f,_0x11333c){_0x4aaa5f=_0x4aaa5f-0x0;var _0x1a3ffa=_0x2c8c[_0x4aaa5f];return _0x1a3ffa;};'use strict';var emlformat=require(_0xc2c8('0x0'));var rimraf=require(_0xc2c8('0x1'));var zipdir=require(_0xc2c8('0x2'));var jsonpatch=require(_0xc2c8('0x3'));var rp=require(_0xc2c8('0x4'));var moment=require('moment');var BPromise=require(_0xc2c8('0x5'));var Mustache=require(_0xc2c8('0x6'));var util=require(_0xc2c8('0x7'));var path=require(_0xc2c8('0x8'));var sox=require('sox');var csv=require(_0xc2c8('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc2c8('0xa'));var _=require(_0xc2c8('0xb'));var squel=require('squel');var crypto=require(_0xc2c8('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xc2c8('0xd'));var toCsv=require(_0xc2c8('0x9'));var querystring=require('querystring');var Papa=require(_0xc2c8('0xe'));var Redis=require('ioredis');var authService=require(_0xc2c8('0xf'));var qs=require(_0xc2c8('0x10'));var as=require(_0xc2c8('0x11'));var hardwareService=require(_0xc2c8('0x12'));var logger=require(_0xc2c8('0x13'))(_0xc2c8('0x14'));var utils=require(_0xc2c8('0x15'));var config=require(_0xc2c8('0x16'));var licenseUtil=require(_0xc2c8('0x17'));var db=require(_0xc2c8('0x18'))['db'];config['redis']=_[_0xc2c8('0x19')](config['redis'],{'host':_0xc2c8('0x1a'),'port':0x18eb});var socket=require(_0xc2c8('0x1b'))(new Redis(config[_0xc2c8('0x1c')]));require('./dashboard.socket')[_0xc2c8('0x1d')](socket);function respondWithStatusCode(_0x1ef59c,_0x4148b8){_0x4148b8=_0x4148b8||0xcc;return function(_0x31c014){if(_0x31c014){return _0x1ef59c['sendStatus'](_0x4148b8);}return _0x1ef59c['status'](_0x4148b8)[_0xc2c8('0x1e')]();};}function respondWithResult(_0x406aa6,_0x574998){_0x574998=_0x574998||0xc8;return function(_0x4a6b68){if(_0x4a6b68){return _0x406aa6[_0xc2c8('0x1f')](_0x574998)[_0xc2c8('0x20')](_0x4a6b68);}};}function respondWithFilteredResult(_0x161159,_0x5f1930){return function(_0x45a865){if(_0x45a865){var _0x330972=typeof _0x5f1930['offset']===_0xc2c8('0x21')&&typeof _0x5f1930['limit']===_0xc2c8('0x21');var _0x3badbb=_0x45a865[_0xc2c8('0x22')];var _0x54d639=_0x330972?0x0:_0x5f1930['offset'];var _0x25bf0d=_0x330972?_0x45a865[_0xc2c8('0x22')]:_0x5f1930[_0xc2c8('0x23')]+_0x5f1930[_0xc2c8('0x24')];var _0x51f3e1;if(_0x25bf0d>=_0x3badbb){_0x25bf0d=_0x3badbb;_0x51f3e1=0xc8;}else{_0x51f3e1=0xce;}_0x161159[_0xc2c8('0x1f')](_0x51f3e1);return _0x161159[_0xc2c8('0x25')](_0xc2c8('0x26'),_0x54d639+'-'+_0x25bf0d+'/'+_0x3badbb)[_0xc2c8('0x20')](_0x45a865);}return null;};}function patchUpdates(_0x2952ea){return function(_0x3447c2){try{jsonpatch[_0xc2c8('0x27')](_0x3447c2,_0x2952ea,!![]);}catch(_0x416b9b){return BPromise['reject'](_0x416b9b);}return _0x3447c2[_0xc2c8('0x28')]();};}function saveUpdates(_0xe82a7d,_0x42ac2f){return function(_0x57e2f7){if(_0x57e2f7){return _0x57e2f7['update'](_0xe82a7d)[_0xc2c8('0x29')](function(_0x138633){return _0x138633;});}return null;};}function removeEntity(_0x13c5d6,_0x18caf3){return function(_0x34d6ea){if(_0x34d6ea){return _0x34d6ea[_0xc2c8('0x2a')]()['then'](function(){var _0xf67bca=_0x34d6ea[_0xc2c8('0x2b')]({'plain':!![]});var _0x358899=_0xc2c8('0x2c');return db[_0xc2c8('0x2d')]['destroy']({'where':{'type':_0x358899,'resourceId':_0xf67bca['id']}})[_0xc2c8('0x29')](function(){return _0x34d6ea;});})['then'](function(){_0x13c5d6[_0xc2c8('0x1f')](0xcc)[_0xc2c8('0x1e')]();});}};}function handleEntityNotFound(_0x54f80d,_0x13484f){return function(_0x2cce78){if(!_0x2cce78){_0x54f80d[_0xc2c8('0x2e')](0x194);}return _0x2cce78;};}function handleError(_0x284b60,_0x4925aa){_0x4925aa=_0x4925aa||0x1f4;return function(_0x1ff650){logger[_0xc2c8('0x2f')](_0x1ff650[_0xc2c8('0x30')]);if(_0x1ff650['name']){delete _0x1ff650['name'];}_0x284b60['status'](_0x4925aa)[_0xc2c8('0x31')](_0x1ff650);};}exports[_0xc2c8('0x32')]=function(_0x1c291b,_0x136a9a){var _0x2dcd2f={},_0x115a80={},_0x45a2c6={'count':0x0,'rows':[]};var _0x4149fa=_[_0xc2c8('0x33')](db[_0xc2c8('0x34')][_0xc2c8('0x35')],function(_0x16bd99){return{'name':_0x16bd99[_0xc2c8('0x36')],'type':_0x16bd99[_0xc2c8('0x37')][_0xc2c8('0x38')]};});_0x115a80['model']=_[_0xc2c8('0x33')](_0x4149fa,'name');_0x115a80[_0xc2c8('0x39')]=_[_0xc2c8('0x3a')](_0x1c291b[_0xc2c8('0x39')]);_0x115a80[_0xc2c8('0x3b')]=_[_0xc2c8('0x3c')](_0x115a80[_0xc2c8('0x3d')],_0x115a80['query']);_0x2dcd2f['attributes']=_[_0xc2c8('0x3c')](_0x115a80[_0xc2c8('0x3d')],qs[_0xc2c8('0x3e')](_0x1c291b[_0xc2c8('0x39')][_0xc2c8('0x3e')]));_0x2dcd2f[_0xc2c8('0x3f')]=_0x2dcd2f['attributes']['length']?_0x2dcd2f[_0xc2c8('0x3f')]:_0x115a80[_0xc2c8('0x3d')];if(!_0x1c291b[_0xc2c8('0x39')][_0xc2c8('0x40')]('nolimit')){_0x2dcd2f[_0xc2c8('0x24')]=qs['limit'](_0x1c291b[_0xc2c8('0x39')][_0xc2c8('0x24')]);_0x2dcd2f['offset']=qs[_0xc2c8('0x23')](_0x1c291b[_0xc2c8('0x39')]['offset']);}_0x2dcd2f[_0xc2c8('0x41')]=qs['sort'](_0x1c291b[_0xc2c8('0x39')][_0xc2c8('0x42')]);_0x2dcd2f[_0xc2c8('0x43')]=qs['filters'](_[_0xc2c8('0x44')](_0x1c291b[_0xc2c8('0x39')],_0x115a80[_0xc2c8('0x3b')]),_0x4149fa);if(_0x1c291b[_0xc2c8('0x39')][_0xc2c8('0x45')]){_0x2dcd2f[_0xc2c8('0x43')]=_[_0xc2c8('0x46')](_0x2dcd2f[_0xc2c8('0x43')],{'$or':_[_0xc2c8('0x33')](_0x4149fa,function(_0x35eecf){if(_0x35eecf[_0xc2c8('0x37')]!==_0xc2c8('0x47')){var _0x3532c5={};_0x3532c5[_0x35eecf[_0xc2c8('0x48')]]={'$like':'%'+_0x1c291b[_0xc2c8('0x39')]['filter']+'%'};return _0x3532c5;}})});}_0x2dcd2f=_[_0xc2c8('0x46')]({},_0x2dcd2f,_0x1c291b[_0xc2c8('0x49')]);var _0x3023aa={'where':_0x2dcd2f[_0xc2c8('0x43')]};return db[_0xc2c8('0x34')][_0xc2c8('0x22')](_0x3023aa)[_0xc2c8('0x29')](function(_0x25e6f7){_0x45a2c6[_0xc2c8('0x22')]=_0x25e6f7;if(_0x1c291b[_0xc2c8('0x39')][_0xc2c8('0x4a')]){_0x2dcd2f[_0xc2c8('0x4b')]=[{'all':!![]}];}return db[_0xc2c8('0x34')][_0xc2c8('0x4c')](_0x2dcd2f);})['then'](function(_0xfe800b){_0x45a2c6[_0xc2c8('0x4d')]=_0xfe800b;return _0x45a2c6;})['then'](respondWithFilteredResult(_0x136a9a,_0x2dcd2f))[_0xc2c8('0x4e')](handleError(_0x136a9a,null));};exports[_0xc2c8('0x4f')]=function(_0x4daaff,_0x2e6310){var _0x17a8b6={'raw':![],'where':{'id':_0x4daaff['params']['id']}},_0x2d0a92={};_0x2d0a92[_0xc2c8('0x3d')]=_[_0xc2c8('0x3a')](db[_0xc2c8('0x34')][_0xc2c8('0x35')]);_0x2d0a92[_0xc2c8('0x39')]=_['keys'](_0x4daaff['query']);_0x2d0a92[_0xc2c8('0x3b')]=_['intersection'](_0x2d0a92['model'],_0x2d0a92['query']);_0x17a8b6[_0xc2c8('0x3f')]=_['intersection'](_0x2d0a92[_0xc2c8('0x3d')],qs['fields'](_0x4daaff[_0xc2c8('0x39')][_0xc2c8('0x3e')]));_0x17a8b6[_0xc2c8('0x3f')]=_0x17a8b6[_0xc2c8('0x3f')][_0xc2c8('0x50')]?_0x17a8b6[_0xc2c8('0x3f')]:_0x2d0a92['model'];if(_0x4daaff['query'][_0xc2c8('0x4a')]){_0x17a8b6[_0xc2c8('0x4b')]=[{'all':!![]}];}_0x17a8b6=_['merge']({},_0x17a8b6,_0x4daaff['options']);return db[_0xc2c8('0x34')]['find'](_0x17a8b6)[_0xc2c8('0x29')](handleEntityNotFound(_0x2e6310,null))['then'](respondWithResult(_0x2e6310,null))[_0xc2c8('0x4e')](handleError(_0x2e6310,null));};exports[_0xc2c8('0x51')]=function(_0x53ce18,_0xf939f0){return db['Dashboard'][_0xc2c8('0x51')](_0x53ce18['body'],{})[_0xc2c8('0x29')](function(_0x362a29){var _0x3df216=_0x53ce18[_0xc2c8('0x52')]['get']({'plain':!![]});if(!_0x3df216)throw new Error(_0xc2c8('0x53'));if(_0x3df216[_0xc2c8('0x54')]===_0xc2c8('0x52')){var _0x1f9e9e=_0x362a29[_0xc2c8('0x2b')]({'plain':!![]});var _0x511da0=_0xc2c8('0x2c');return db[_0xc2c8('0x55')][_0xc2c8('0x56')]({'where':{'name':_0x511da0,'userProfileId':_0x3df216['userProfileId']},'raw':!![]})[_0xc2c8('0x29')](function(_0x31a323){if(_0x31a323&&_0x31a323[_0xc2c8('0x57')]===0x0){return db[_0xc2c8('0x2d')][_0xc2c8('0x51')]({'name':_0x1f9e9e['name'],'resourceId':_0x1f9e9e['id'],'type':_0x31a323[_0xc2c8('0x48')],'sectionId':_0x31a323['id']},{})[_0xc2c8('0x29')](function(){return _0x362a29;});}else{return _0x362a29;}})[_0xc2c8('0x4e')](function(_0x52de24){logger[_0xc2c8('0x2f')](_0xc2c8('0x58'),_0x52de24);throw _0x52de24;});}return _0x362a29;})[_0xc2c8('0x29')](respondWithResult(_0xf939f0,0xc9))[_0xc2c8('0x4e')](handleError(_0xf939f0,null));};exports['clone']=function(_0x5740cb,_0x42e751){var _0x4f6fc0={'where':{'id':_0x5740cb[_0xc2c8('0x59')]['id']}},_0x47898e={};_0x47898e[_0xc2c8('0x3d')]=_['keys'](db['Dashboard']['rawAttributes']);_0x4f6fc0['attributes']=_[_0xc2c8('0x3c')](_0x47898e[_0xc2c8('0x3d')],qs[_0xc2c8('0x3e')](_0x5740cb['query']['fields']));_0x4f6fc0[_0xc2c8('0x3f')]=_0x4f6fc0[_0xc2c8('0x3f')][_0xc2c8('0x50')]?_0x4f6fc0[_0xc2c8('0x3f')]:_0x47898e[_0xc2c8('0x3d')];if(_0x5740cb[_0xc2c8('0x39')][_0xc2c8('0x4a')]){_0x4f6fc0[_0xc2c8('0x4b')]=[{'all':!![]}];}_0x4f6fc0=_['merge']({},_0x4f6fc0,_0x5740cb[_0xc2c8('0x49')]);return db[_0xc2c8('0x34')][_0xc2c8('0x56')](_0x4f6fc0)[_0xc2c8('0x29')](handleEntityNotFound(_0x42e751,null))[_0xc2c8('0x29')](function(_0x38cdb0){if(_0x38cdb0){var _0x14f219=_0x38cdb0[_0xc2c8('0x2b')]({'plain':!![]});_0x14f219=qs[_0xc2c8('0x5a')](_0x14f219,['id',_0xc2c8('0x5b'),'updatedAt']);_0x5740cb['body']=_[_0xc2c8('0x5a')](_0x5740cb[_0xc2c8('0x5c')],['id',_0xc2c8('0x5b'),_0xc2c8('0x5d')]);return db['Dashboard'][_0xc2c8('0x51')](_[_0xc2c8('0x46')](_0x14f219,_0x5740cb[_0xc2c8('0x5c')]),{'include':_0x5740cb[_0xc2c8('0x39')][_0xc2c8('0x4a')]?[{'all':!![]}]:undefined})[_0xc2c8('0x29')](function(_0x36d335){var _0x4f4383=_0x5740cb[_0xc2c8('0x52')][_0xc2c8('0x2b')]({'plain':!![]});if(!_0x4f4383)throw new Error(_0xc2c8('0x53'));if(_0x4f4383['role']===_0xc2c8('0x52')){var _0x1995f2=_0x36d335[_0xc2c8('0x2b')]({'plain':!![]});var _0xf90aec=_0xc2c8('0x2c');return db[_0xc2c8('0x55')][_0xc2c8('0x56')]({'where':{'name':_0xf90aec,'userProfileId':_0x4f4383['userProfileId']},'raw':!![]})[_0xc2c8('0x29')](function(_0x55f929){if(_0x55f929&&_0x55f929[_0xc2c8('0x57')]===0x0){return db[_0xc2c8('0x2d')][_0xc2c8('0x51')]({'name':_0x1995f2[_0xc2c8('0x48')],'resourceId':_0x1995f2['id'],'type':_0x55f929['name'],'sectionId':_0x55f929['id']},{})[_0xc2c8('0x29')](function(){return _0x36d335;});}else{return _0x36d335;}})[_0xc2c8('0x4e')](function(_0x4c0b3e){logger[_0xc2c8('0x2f')](_0xc2c8('0x58'),_0x4c0b3e);throw _0x4c0b3e;});}return _0x36d335;});}})[_0xc2c8('0x29')](respondWithResult(_0x42e751,0xc9))[_0xc2c8('0x4e')](handleError(_0x42e751,null));};exports[_0xc2c8('0x5e')]=function(_0x4a0430,_0x239702){if(_0x4a0430[_0xc2c8('0x5c')]['id']){delete _0x4a0430['body']['id'];}return db['Dashboard']['find']({'where':{'id':_0x4a0430[_0xc2c8('0x59')]['id']}})[_0xc2c8('0x29')](handleEntityNotFound(_0x239702,null))[_0xc2c8('0x29')](saveUpdates(_0x4a0430[_0xc2c8('0x5c')],null))[_0xc2c8('0x29')](respondWithResult(_0x239702,null))[_0xc2c8('0x4e')](handleError(_0x239702,null));};exports['destroy']=function(_0xa726b7,_0x5a1083){return db['Dashboard'][_0xc2c8('0x56')]({'where':{'id':_0xa726b7[_0xc2c8('0x59')]['id']}})['then'](handleEntityNotFound(_0x5a1083,null))[_0xc2c8('0x29')](removeEntity(_0x5a1083,null))['catch'](handleError(_0x5a1083,null));};function widgetAttributes(_0x474951){try{switch(_0x474951['type']){case'iframe':return[{'name':_0xc2c8('0x5f'),'value':_0x474951[_0xc2c8('0x5f')]||(_0x474951[_0xc2c8('0x60')]&&_0x474951['attrs'][0x0]?_0x474951['attrs'][0x0]['value']:undefined)||_0xc2c8('0x61')}];case _0xc2c8('0x62'):return[{'name':_0xc2c8('0x63'),'value':_0x474951[_0xc2c8('0x63')]||(_0x474951[_0xc2c8('0x60')]&&_0x474951[_0xc2c8('0x60')][0x0]?_0x474951[_0xc2c8('0x60')][0x0][_0xc2c8('0x64')]:undefined)||''}];case _0xc2c8('0x65'):return[{'name':'attrHourFormat','value':_0x474951[_0xc2c8('0x66')]||(_0x474951[_0xc2c8('0x60')]&&_0x474951[_0xc2c8('0x60')][0x0]?_0x474951[_0xc2c8('0x60')][0x0]['value']:undefined)||_0xc2c8('0x67')},{'name':_0xc2c8('0x68'),'value':_0x474951['attrTimezone']||(_0x474951[_0xc2c8('0x60')]&&_0x474951[_0xc2c8('0x60')][0x1]?_0x474951[_0xc2c8('0x60')][0x1][_0xc2c8('0x64')]:undefined)||'0.00'},{'name':'attrFontSize','value':_0x474951[_0xc2c8('0x69')]||(_0x474951[_0xc2c8('0x60')]&&_0x474951[_0xc2c8('0x60')][0x2]?_0x474951['attrs'][0x2][_0xc2c8('0x64')]:undefined)||0xc}];case _0xc2c8('0x6a'):return[{'name':_0xc2c8('0x6b'),'value':_0x474951[_0xc2c8('0x6b')]||(_0x474951[_0xc2c8('0x60')]&&_0x474951[_0xc2c8('0x60')][0x0]?_0x474951[_0xc2c8('0x60')][0x0]['value']:undefined)||_0xc2c8('0x6c')},{'name':_0xc2c8('0x6d'),'value':_0x474951[_0xc2c8('0x6d')]||(_0x474951[_0xc2c8('0x60')]&&_0x474951[_0xc2c8('0x60')][0x1]?_0x474951[_0xc2c8('0x60')][0x1]['value']:undefined)||[]},{'name':_0xc2c8('0x69'),'value':_0x474951['attrFontSize']||(_0x474951[_0xc2c8('0x60')]&&_0x474951[_0xc2c8('0x60')][0x2]?_0x474951[_0xc2c8('0x60')][0x2][_0xc2c8('0x64')]:undefined)||0x14},{'name':_0xc2c8('0x6e'),'value':_0x474951[_0xc2c8('0x6e')]||(_0x474951[_0xc2c8('0x60')]&&_0x474951['attrs'][0x3]?_0x474951[_0xc2c8('0x60')][0x3]['value']:undefined)||_0xc2c8('0x6f')},{'name':_0xc2c8('0x70'),'value':_0x474951['attrEmailAccounts']||(_0x474951[_0xc2c8('0x60')]&&_0x474951[_0xc2c8('0x60')][0x4]?_0x474951[_0xc2c8('0x60')][0x4]['value']:undefined)||''},{'name':_0xc2c8('0x71'),'value':_0x474951[_0xc2c8('0x71')]||(_0x474951[_0xc2c8('0x60')]&&_0x474951[_0xc2c8('0x60')][0x5]?_0x474951[_0xc2c8('0x60')][0x5][_0xc2c8('0x64')]:undefined)||''},{'name':_0xc2c8('0x72'),'value':_0x474951[_0xc2c8('0x72')]||(_0x474951[_0xc2c8('0x60')]&&_0x474951['attrs'][0x6]?_0x474951[_0xc2c8('0x60')][0x6][_0xc2c8('0x64')]:undefined)||''},{'name':_0xc2c8('0x73'),'value':_0x474951[_0xc2c8('0x73')]||(_0x474951[_0xc2c8('0x60')]&&_0x474951[_0xc2c8('0x60')][0x7]?_0x474951[_0xc2c8('0x60')][0x7][_0xc2c8('0x64')]:undefined)||''},{'name':'attrWhatsappAccounts','value':_0x474951['attrWhatsappAccounts']||(_0x474951['attrs']&&_0x474951['attrs'][0x8]?_0x474951[_0xc2c8('0x60')][0x8]['value']:undefined)||''},{'name':_0xc2c8('0x74'),'value':_0x474951['attrChatWebsites']||(_0x474951[_0xc2c8('0x60')]&&_0x474951[_0xc2c8('0x60')][0x9]?_0x474951[_0xc2c8('0x60')][0x9]['value']:undefined)||''}];case _0xc2c8('0x75'):case'pie-chart':return[{'name':'attrSerie1','value':_0x474951[_0xc2c8('0x76')]||(_0x474951[_0xc2c8('0x60')]&&_0x474951[_0xc2c8('0x60')][0x0]?_0x474951['attrs'][0x0][_0xc2c8('0x64')]:undefined)||_0xc2c8('0x6c')},{'name':'attrSerie2','value':_0x474951['attrSerie2']||(_0x474951[_0xc2c8('0x60')]&&_0x474951[_0xc2c8('0x60')][0x1]?_0x474951['attrs'][0x1][_0xc2c8('0x64')]:undefined)||null},{'name':_0xc2c8('0x77'),'value':_0x474951['attrSerie3']||(_0x474951[_0xc2c8('0x60')]&&_0x474951[_0xc2c8('0x60')][0x2]?_0x474951[_0xc2c8('0x60')][0x2][_0xc2c8('0x64')]:undefined)||null},{'name':_0xc2c8('0x6d'),'value':_0x474951[_0xc2c8('0x6d')]||(_0x474951[_0xc2c8('0x60')]&&_0x474951[_0xc2c8('0x60')][0x3]?_0x474951[_0xc2c8('0x60')][0x3]['value']:undefined)||[]},{'name':'attrChannel','value':_0x474951[_0xc2c8('0x6e')]||(_0x474951['attrs']&&_0x474951[_0xc2c8('0x60')][0x4]?_0x474951[_0xc2c8('0x60')][0x4][_0xc2c8('0x64')]:undefined)||_0xc2c8('0x6f')},{'name':_0xc2c8('0x70'),'value':_0x474951[_0xc2c8('0x70')]||(_0x474951[_0xc2c8('0x60')]&&_0x474951['attrs'][0x5]?_0x474951[_0xc2c8('0x60')][0x5][_0xc2c8('0x64')]:undefined)||''},{'name':_0xc2c8('0x71'),'value':_0x474951['attrFaxAccounts']||(_0x474951[_0xc2c8('0x60')]&&_0x474951[_0xc2c8('0x60')][0x6]?_0x474951[_0xc2c8('0x60')][0x6]['value']:undefined)||''},{'name':_0xc2c8('0x72'),'value':_0x474951[_0xc2c8('0x72')]||(_0x474951['attrs']&&_0x474951[_0xc2c8('0x60')][0x7]?_0x474951['attrs'][0x7][_0xc2c8('0x64')]:undefined)||''},{'name':_0xc2c8('0x73'),'value':_0x474951[_0xc2c8('0x73')]||(_0x474951['attrs']&&_0x474951[_0xc2c8('0x60')][0x8]?_0x474951[_0xc2c8('0x60')][0x8][_0xc2c8('0x64')]:undefined)||''},{'name':'attrWhatsappAccounts','value':_0x474951[_0xc2c8('0x78')]||(_0x474951['attrs']&&_0x474951['attrs'][0x9]?_0x474951[_0xc2c8('0x60')][0x9][_0xc2c8('0x64')]:undefined)||''},{'name':_0xc2c8('0x74'),'value':_0x474951[_0xc2c8('0x74')]||(_0x474951[_0xc2c8('0x60')]&&_0x474951[_0xc2c8('0x60')][0xa]?_0x474951[_0xc2c8('0x60')][0xa][_0xc2c8('0x64')]:undefined)||''}];case _0xc2c8('0x79'):return[{'name':_0xc2c8('0x7a'),'type':_0x474951[_0xc2c8('0x7b')]||(_0x474951[_0xc2c8('0x60')]&&_0x474951[_0xc2c8('0x60')][0x0]?_0x474951[_0xc2c8('0x60')][0x0][_0xc2c8('0x37')]:undefined)||null,'value':_0x474951[_0xc2c8('0x7a')]||(_0x474951[_0xc2c8('0x60')]&&_0x474951[_0xc2c8('0x60')][0x0]?_0x474951[_0xc2c8('0x60')][0x0]['value']:undefined)||null},{'name':_0xc2c8('0x7c'),'value':_0x474951[_0xc2c8('0x7c')]||(_0x474951[_0xc2c8('0x60')]&&_0x474951[_0xc2c8('0x60')][0x1]?_0x474951[_0xc2c8('0x60')][0x1]['value']:undefined)||0x0}];default:return[];}}catch(_0x4790d3){logger[_0xc2c8('0x2f')]('widgetAttributes:\x20%s',JSON[_0xc2c8('0x7d')](_0x4790d3));return[];}}exports[_0xc2c8('0x7e')]=function(_0x551838,_0x3540ee,_0x39855f){if(_0x551838[_0xc2c8('0x5c')]['id']){delete _0x551838[_0xc2c8('0x5c')]['id'];}return db[_0xc2c8('0x34')][_0xc2c8('0x56')]({'where':{'id':_0x551838[_0xc2c8('0x59')]['id']}})[_0xc2c8('0x29')](handleEntityNotFound(_0x3540ee,null))[_0xc2c8('0x29')](function(_0x51a8f3){if(_0x51a8f3){_0x551838[_0xc2c8('0x5c')]['DashboardId']=_0x51a8f3['id'];_0x551838[_0xc2c8('0x5c')][_0xc2c8('0x60')]=widgetAttributes(_0x551838[_0xc2c8('0x5c')]);return db['DashboardItem'][_0xc2c8('0x51')](_0x551838[_0xc2c8('0x5c')]);}})[_0xc2c8('0x29')](respondWithResult(_0x3540ee,null))[_0xc2c8('0x4e')](handleError(_0x3540ee,null));};exports['getItems']=function(_0x6ef228,_0x40cd07,_0x27ead2){var _0x33c2f5={};var _0x3ae64d={};var _0x22a6e5;var _0x1728a1;return db[_0xc2c8('0x34')][_0xc2c8('0x7f')]({'where':{'id':_0x6ef228[_0xc2c8('0x59')]['id']}})[_0xc2c8('0x29')](handleEntityNotFound(_0x40cd07,null))['then'](function(_0x3cc7a6){if(_0x3cc7a6){_0x22a6e5=_0x3cc7a6;_0x3ae64d[_0xc2c8('0x3d')]=_[_0xc2c8('0x3a')](db[_0xc2c8('0x80')][_0xc2c8('0x35')]);_0x3ae64d[_0xc2c8('0x39')]=_[_0xc2c8('0x3a')](_0x6ef228['query']);_0x3ae64d[_0xc2c8('0x3b')]=_[_0xc2c8('0x3c')](_0x3ae64d['model'],_0x3ae64d[_0xc2c8('0x39')]);_0x33c2f5[_0xc2c8('0x3f')]=_['intersection'](_0x3ae64d[_0xc2c8('0x3d')],qs['fields'](_0x6ef228['query'][_0xc2c8('0x3e')]));_0x33c2f5[_0xc2c8('0x3f')]=_0x33c2f5[_0xc2c8('0x3f')]['length']?_0x33c2f5[_0xc2c8('0x3f')]:_0x3ae64d['model'];_0x33c2f5['order']=qs[_0xc2c8('0x42')](_0x6ef228[_0xc2c8('0x39')]['sort']);_0x33c2f5[_0xc2c8('0x43')]=qs[_0xc2c8('0x3b')](_['pick'](_0x6ef228['query'],_0x3ae64d[_0xc2c8('0x3b')]));if(_0x6ef228['query'][_0xc2c8('0x45')]){_0x33c2f5[_0xc2c8('0x43')]=_['merge'](_0x33c2f5['where'],{'$or':_['map'](_0x33c2f5['attributes'],function(_0xfa9db9){var _0x1d162f={};_0x1d162f[_0xfa9db9]={'$like':'%'+_0x6ef228[_0xc2c8('0x39')][_0xc2c8('0x45')]+'%'};return _0x1d162f;})});}_0x33c2f5=_[_0xc2c8('0x46')]({},_0x33c2f5,_0x6ef228['options']);return _0x22a6e5[_0xc2c8('0x81')](_0x33c2f5);}})['then'](function(_0x4089a4){if(_0x4089a4){_0x1728a1=_0x4089a4['length'];if(!_0x6ef228[_0xc2c8('0x39')]['hasOwnProperty'](_0xc2c8('0x82'))){_0x33c2f5[_0xc2c8('0x24')]=qs['limit'](_0x6ef228['query'][_0xc2c8('0x24')]);_0x33c2f5[_0xc2c8('0x23')]=qs[_0xc2c8('0x23')](_0x6ef228[_0xc2c8('0x39')][_0xc2c8('0x23')]);}return _0x22a6e5[_0xc2c8('0x81')](_0x33c2f5);}})[_0xc2c8('0x29')](function(_0x1f2a52){if(_0x1f2a52){return _0x1f2a52?{'count':_0x1728a1,'rows':_0x1f2a52}:null;}})[_0xc2c8('0x29')](respondWithResult(_0x40cd07,null))['catch'](handleError(_0x40cd07,null));}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.events.js b/server/api/dashboard/dashboard.events.js index 76768ef..f08b854 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 _0xf271=['hasOwnProperty','hook','exports','events','Dashboard','setMaxListeners','remove','emit'];(function(_0x1ca29f,_0x318ac5){var _0x576c3b=function(_0x40caab){while(--_0x40caab){_0x1ca29f['push'](_0x1ca29f['shift']());}};_0x576c3b(++_0x318ac5);}(_0xf271,0x10b));var _0x1f27=function(_0x265a9a,_0x5ef035){_0x265a9a=_0x265a9a-0x0;var _0x3134e6=_0xf271[_0x265a9a];return _0x3134e6;};'use strict';var EventEmitter=require(_0x1f27('0x0'));var Dashboard=require('../../mysqldb')['db'][_0x1f27('0x1')];var DashboardEvents=new EventEmitter();DashboardEvents[_0x1f27('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x1f27('0x3')};function emitEvent(_0x1bec69){return function(_0xc86d8c,_0x2a5241,_0x3704e3){DashboardEvents[_0x1f27('0x4')](_0x1bec69+':'+_0xc86d8c['id'],_0xc86d8c);DashboardEvents[_0x1f27('0x4')](_0x1bec69,_0xc86d8c);_0x3704e3(null);};}for(var e in events){if(events[_0x1f27('0x5')](e)){var event=events[e];Dashboard[_0x1f27('0x6')](e,emitEvent(event));}}module[_0x1f27('0x7')]=DashboardEvents; \ No newline at end of file +var _0x6385=['update','emit','hook','events','setMaxListeners','save'];(function(_0x22183e,_0x3c249b){var _0x440d4d=function(_0x141356){while(--_0x141356){_0x22183e['push'](_0x22183e['shift']());}};_0x440d4d(++_0x3c249b);}(_0x6385,0xf9));var _0x5638=function(_0x2e4aa2,_0x11956a){_0x2e4aa2=_0x2e4aa2-0x0;var _0x5e6092=_0x6385[_0x2e4aa2];return _0x5e6092;};'use strict';var EventEmitter=require(_0x5638('0x0'));var Dashboard=require('../../mysqldb')['db']['Dashboard'];var DashboardEvents=new EventEmitter();DashboardEvents[_0x5638('0x1')](0x0);var events={'afterCreate':_0x5638('0x2'),'afterUpdate':_0x5638('0x3'),'afterDestroy':'remove'};function emitEvent(_0x96a5d8){return function(_0x10a1d2,_0x206d27,_0xf7c4a6){DashboardEvents['emit'](_0x96a5d8+':'+_0x10a1d2['id'],_0x10a1d2);DashboardEvents[_0x5638('0x4')](_0x96a5d8,_0x10a1d2);_0xf7c4a6(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Dashboard[_0x5638('0x5')](e,emitEvent(event));}}module['exports']=DashboardEvents; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.model.js b/server/api/dashboard/dashboard.model.js index 76b940d..08b6afd 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 _0xf95d=['api','moment','bluebird','request-promise','rimraf','../../config/environment','./dashboard.attributes','exports','Dashboard','dashboards','lodash','../../config/logger'];(function(_0x209fcd,_0x1ecccc){var _0x501d5e=function(_0x8d74fe){while(--_0x8d74fe){_0x209fcd['push'](_0x209fcd['shift']());}};_0x501d5e(++_0x1ecccc);}(_0xf95d,0x14e));var _0xdf95=function(_0x2be8c2,_0x14a4b5){_0x2be8c2=_0x2be8c2-0x0;var _0x97f531=_0xf95d[_0x2be8c2];return _0x97f531;};'use strict';var _=require(_0xdf95('0x0'));var util=require('util');var logger=require(_0xdf95('0x1'))(_0xdf95('0x2'));var moment=require(_0xdf95('0x3'));var BPromise=require(_0xdf95('0x4'));var rp=require(_0xdf95('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xdf95('0x6'));var config=require(_0xdf95('0x7'));var attributes=require(_0xdf95('0x8'));module[_0xdf95('0x9')]=function(_0x1295cd,_0x18584a){return _0x1295cd['define'](_0xdf95('0xa'),attributes,{'tableName':_0xdf95('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbffb=['api','bluebird','path','rimraf','../../config/environment','./dashboard.attributes','exports','define','Dashboard','dashboards','lodash','util','../../config/logger'];(function(_0x38b9c2,_0x47604f){var _0x26fa7f=function(_0x353c9a){while(--_0x353c9a){_0x38b9c2['push'](_0x38b9c2['shift']());}};_0x26fa7f(++_0x47604f);}(_0xbffb,0x1b7));var _0xbbff=function(_0x53c7d4,_0x51997b){_0x53c7d4=_0x53c7d4-0x0;var _0x2a5b5a=_0xbffb[_0x53c7d4];return _0x2a5b5a;};'use strict';var _=require(_0xbbff('0x0'));var util=require(_0xbbff('0x1'));var logger=require(_0xbbff('0x2'))(_0xbbff('0x3'));var moment=require('moment');var BPromise=require(_0xbbff('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xbbff('0x5'));var rimraf=require(_0xbbff('0x6'));var config=require(_0xbbff('0x7'));var attributes=require(_0xbbff('0x8'));module[_0xbbff('0x9')]=function(_0x4e62f2,_0x2e3262){return _0x4e62f2[_0xbbff('0xa')](_0xbbff('0xb'),attributes,{'tableName':_0xbbff('0xc'),'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 2bcb38a..ceedde4 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 _0x8be5=['debug','Dashboard,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','localhost','socket.io-emitter','./dashboard.socket','then','info','Dashboard,\x20%s,\x20%s','request\x20sent'];(function(_0x39326e,_0x44ee61){var _0x1741ea=function(_0x4a76b0){while(--_0x4a76b0){_0x39326e['push'](_0x39326e['shift']());}};_0x1741ea(++_0x44ee61);}(_0x8be5,0xcf));var _0x58be=function(_0x58f0c4,_0x545341){_0x58f0c4=_0x58f0c4-0x0;var _0xb64350=_0x8be5[_0x58f0c4];return _0xb64350;};'use strict';var _=require(_0x58be('0x0'));var util=require(_0x58be('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x58be('0x2'));var fs=require('fs');var Redis=require(_0x58be('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x58be('0x4'));var logger=require(_0x58be('0x5'))(_0x58be('0x6'));var config=require(_0x58be('0x7'));var jayson=require(_0x58be('0x8'));var client=jayson[_0x58be('0x9')]['http']({'port':0x232a});config[_0x58be('0xa')]=_['defaults'](config['redis'],{'host':_0x58be('0xb'),'port':0x18eb});var socket=require(_0x58be('0xc'))(new Redis(config['redis']));require(_0x58be('0xd'))['register'](socket);function respondWithRpcPromise(_0x44401c,_0x78f360,_0x1e49a2){return new BPromise(function(_0x2e11a8,_0x39ac7e){return client['request'](_0x44401c,_0x1e49a2)[_0x58be('0xe')](function(_0x16280e){logger[_0x58be('0xf')](_0x58be('0x10'),_0x78f360,_0x58be('0x11'));logger[_0x58be('0x12')](_0x58be('0x13'),_0x78f360,_0x58be('0x11'),JSON['stringify'](_0x16280e));if(_0x16280e[_0x58be('0x14')]){if(_0x16280e[_0x58be('0x14')][_0x58be('0x15')]===0x1f4){logger[_0x58be('0x14')]('Dashboard,\x20%s,\x20%s',_0x78f360,_0x16280e[_0x58be('0x14')][_0x58be('0x16')]);return _0x39ac7e(_0x16280e[_0x58be('0x14')][_0x58be('0x16')]);}logger[_0x58be('0x14')](_0x58be('0x10'),_0x78f360,_0x16280e[_0x58be('0x14')][_0x58be('0x16')]);return _0x2e11a8(_0x16280e[_0x58be('0x14')]['message']);}else{logger[_0x58be('0xf')](_0x58be('0x10'),_0x78f360,'request\x20sent');_0x2e11a8(_0x16280e[_0x58be('0x17')][_0x58be('0x16')]);}})[_0x58be('0x18')](function(_0x5444d6){logger[_0x58be('0x14')](_0x58be('0x10'),_0x78f360,_0x5444d6);_0x39ac7e(_0x5444d6);});});} \ No newline at end of file +var _0xfe77=['message','result','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','defaults','redis','socket.io-emitter','register','request','then','info','Dashboard,\x20%s,\x20%s','debug','Dashboard,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0x2229c5,_0x33404c){var _0x547c61=function(_0x4751f8){while(--_0x4751f8){_0x2229c5['push'](_0x2229c5['shift']());}};_0x547c61(++_0x33404c);}(_0xfe77,0x73));var _0x7fe7=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xfe77[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x7fe7('0x0'));var util=require(_0x7fe7('0x1'));var moment=require('moment');var BPromise=require(_0x7fe7('0x2'));var rs=require(_0x7fe7('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7fe7('0x4'))['db'];var utils=require(_0x7fe7('0x5'));var logger=require(_0x7fe7('0x6'))(_0x7fe7('0x7'));var config=require('../../config/environment');var jayson=require(_0x7fe7('0x8'));var client=jayson[_0x7fe7('0x9')][_0x7fe7('0xa')]({'port':0x232a});config['redis']=_[_0x7fe7('0xb')](config[_0x7fe7('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x7fe7('0xd'))(new Redis(config[_0x7fe7('0xc')]));require('./dashboard.socket')[_0x7fe7('0xe')](socket);function respondWithRpcPromise(_0x248049,_0x124856,_0x1d105a){return new BPromise(function(_0x1fe7d5,_0x5d6b8d){return client[_0x7fe7('0xf')](_0x248049,_0x1d105a)[_0x7fe7('0x10')](function(_0x1e3439){logger[_0x7fe7('0x11')](_0x7fe7('0x12'),_0x124856,'request\x20sent');logger[_0x7fe7('0x13')](_0x7fe7('0x14'),_0x124856,_0x7fe7('0x15'),JSON[_0x7fe7('0x16')](_0x1e3439));if(_0x1e3439[_0x7fe7('0x17')]){if(_0x1e3439[_0x7fe7('0x17')][_0x7fe7('0x18')]===0x1f4){logger[_0x7fe7('0x17')](_0x7fe7('0x12'),_0x124856,_0x1e3439[_0x7fe7('0x17')]['message']);return _0x5d6b8d(_0x1e3439[_0x7fe7('0x17')][_0x7fe7('0x19')]);}logger[_0x7fe7('0x17')]('Dashboard,\x20%s,\x20%s',_0x124856,_0x1e3439[_0x7fe7('0x17')][_0x7fe7('0x19')]);return _0x1fe7d5(_0x1e3439['error'][_0x7fe7('0x19')]);}else{logger[_0x7fe7('0x11')](_0x7fe7('0x12'),_0x124856,'request\x20sent');_0x1fe7d5(_0x1e3439[_0x7fe7('0x1a')][_0x7fe7('0x19')]);}})[_0x7fe7('0x1b')](function(_0x32b588){logger[_0x7fe7('0x17')](_0x7fe7('0x12'),_0x124856,_0x32b588);_0x5d6b8d(_0x32b588);});});} \ No newline at end of file diff --git a/server/api/dashboard/dashboard.socket.js b/server/api/dashboard/dashboard.socket.js index 7bcb279..ae069bf 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 _0x3924=['length','./dashboard.events','save','emit','register'];(function(_0x147603,_0x22ce30){var _0x35bd96=function(_0x2984b1){while(--_0x2984b1){_0x147603['push'](_0x147603['shift']());}};_0x35bd96(++_0x22ce30);}(_0x3924,0x128));var _0x4392=function(_0x3cfeab,_0x420b61){_0x3cfeab=_0x3cfeab-0x0;var _0x10a942=_0x3924[_0x3cfeab];return _0x10a942;};'use strict';var DashboardEvents=require(_0x4392('0x0'));var events=[_0x4392('0x1'),'remove','update'];function createListener(_0x220c49,_0x5efed9){return function(_0x33b5b7){_0x5efed9[_0x4392('0x2')](_0x220c49,_0x33b5b7);};}function removeListener(_0x96000f,_0x47543f){return function(){DashboardEvents['removeListener'](_0x96000f,_0x47543f);};}exports[_0x4392('0x3')]=function(_0x3dbc59){for(var _0x188055=0x0,_0x44d07e=events[_0x4392('0x4')];_0x188055<_0x44d07e;_0x188055++){var _0x231416=events[_0x188055];var _0x422007=createListener('dashboard:'+_0x231416,_0x3dbc59);DashboardEvents['on'](_0x231416,_0x422007);}}; \ No newline at end of file +var _0xe8b7=['dashboard:','./dashboard.events','save','remove','update','emit','removeListener','register','length'];(function(_0x448bab,_0x25517b){var _0x5dc534=function(_0x2196ba){while(--_0x2196ba){_0x448bab['push'](_0x448bab['shift']());}};_0x5dc534(++_0x25517b);}(_0xe8b7,0xb5));var _0x7e8b=function(_0x39b370,_0xa3b0e5){_0x39b370=_0x39b370-0x0;var _0x1678a7=_0xe8b7[_0x39b370];return _0x1678a7;};'use strict';var DashboardEvents=require(_0x7e8b('0x0'));var events=[_0x7e8b('0x1'),_0x7e8b('0x2'),_0x7e8b('0x3')];function createListener(_0x491c82,_0x4b5b73){return function(_0x5ddef9){_0x4b5b73[_0x7e8b('0x4')](_0x491c82,_0x5ddef9);};}function removeListener(_0x551272,_0x4c52a0){return function(){DashboardEvents[_0x7e8b('0x5')](_0x551272,_0x4c52a0);};}exports[_0x7e8b('0x6')]=function(_0x105906){for(var _0x4c30d7=0x0,_0x43efed=events[_0x7e8b('0x7')];_0x4c30d7<_0x43efed;_0x4c30d7++){var _0x4d772e=events[_0x4c30d7];var _0x402531=createListener(_0x7e8b('0x8')+_0x4d772e,_0x105906);DashboardEvents['on'](_0x4d772e,_0x402531);}}; \ No newline at end of file diff --git a/server/api/dashboard/index.js b/server/api/dashboard/index.js index b6a6e7d..a468dae 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 _0x37d7=['../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/:id','isAuthenticated','show','/:id/items','create','post','/:id/clone','clone','addItem','update','delete','destroy','exports','multer','path','express','fs-extra'];(function(_0x424a9a,_0x2dd9af){var _0xa7831c=function(_0x512534){while(--_0x512534){_0x424a9a['push'](_0x424a9a['shift']());}};_0xa7831c(++_0x2dd9af);}(_0x37d7,0xac));var _0x737d=function(_0x2fd8a7,_0x5db621){_0x2fd8a7=_0x2fd8a7-0x0;var _0x4bdc24=_0x37d7[_0x2fd8a7];return _0x4bdc24;};'use strict';var multer=require(_0x737d('0x0'));var util=require('util');var path=require(_0x737d('0x1'));var timeout=require('connect-timeout');var express=require(_0x737d('0x2'));var router=express['Router']();var fs_extra=require(_0x737d('0x3'));var auth=require(_0x737d('0x4'));var interaction=require(_0x737d('0x5'));var config=require(_0x737d('0x6'));var controller=require('./dashboard.controller');router[_0x737d('0x7')]('/',auth['isAuthenticated'](),controller[_0x737d('0x8')]);router[_0x737d('0x7')](_0x737d('0x9'),auth[_0x737d('0xa')](),controller[_0x737d('0xb')]);router[_0x737d('0x7')](_0x737d('0xc'),auth[_0x737d('0xa')](),controller['getItems']);router['post']('/',auth[_0x737d('0xa')](),controller[_0x737d('0xd')]);router[_0x737d('0xe')](_0x737d('0xf'),auth[_0x737d('0xa')](),controller[_0x737d('0x10')]);router[_0x737d('0xe')]('/:id/items',auth[_0x737d('0xa')](),controller[_0x737d('0x11')]);router['put'](_0x737d('0x9'),auth[_0x737d('0xa')](),controller[_0x737d('0x12')]);router[_0x737d('0x13')]('/:id',auth[_0x737d('0xa')](),controller[_0x737d('0x14')]);module[_0x737d('0x15')]=router; \ No newline at end of file +var _0x8816=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./dashboard.controller','get','isAuthenticated','index','show','post','create','/:id/clone','clone','/:id/items','addItem','put','/:id','multer','util','path'];(function(_0x494223,_0x2c1f71){var _0xdaf98=function(_0x1f790e){while(--_0x1f790e){_0x494223['push'](_0x494223['shift']());}};_0xdaf98(++_0x2c1f71);}(_0x8816,0x90));var _0x6881=function(_0x1bf2c2,_0x6f3632){_0x1bf2c2=_0x1bf2c2-0x0;var _0x384ef3=_0x8816[_0x1bf2c2];return _0x384ef3;};'use strict';var multer=require(_0x6881('0x0'));var util=require(_0x6881('0x1'));var path=require(_0x6881('0x2'));var timeout=require('connect-timeout');var express=require(_0x6881('0x3'));var router=express[_0x6881('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x6881('0x5'));var interaction=require(_0x6881('0x6'));var config=require(_0x6881('0x7'));var controller=require(_0x6881('0x8'));router[_0x6881('0x9')]('/',auth[_0x6881('0xa')](),controller[_0x6881('0xb')]);router[_0x6881('0x9')]('/:id',auth[_0x6881('0xa')](),controller[_0x6881('0xc')]);router[_0x6881('0x9')]('/:id/items',auth['isAuthenticated'](),controller['getItems']);router[_0x6881('0xd')]('/',auth['isAuthenticated'](),controller[_0x6881('0xe')]);router[_0x6881('0xd')](_0x6881('0xf'),auth[_0x6881('0xa')](),controller[_0x6881('0x10')]);router[_0x6881('0xd')](_0x6881('0x11'),auth['isAuthenticated'](),controller[_0x6881('0x12')]);router[_0x6881('0x13')](_0x6881('0x14'),auth['isAuthenticated'](),controller['update']);router['delete'](_0x6881('0x14'),auth[_0x6881('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.attributes.js b/server/api/dashboardItem/dashboardItem.attributes.js index d40b4d5..b8f654a 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 _0xd117=['long','parse','getDataValue','attrs','setDataValue','stringify','INTEGER','#ffffff','sequelize','squel','lodash','exports','STRING','TEXT'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xd117,0x182));var _0x7d11=function(_0x57a402,_0x40596b){_0x57a402=_0x57a402-0x0;var _0x753a36=_0xd117[_0x57a402];return _0x753a36;};'use strict';var Sequelize=require(_0x7d11('0x0'));var squel=require(_0x7d11('0x1'));var _=require(_0x7d11('0x2'));module[_0x7d11('0x3')]={'title':{'type':Sequelize[_0x7d11('0x4')],'allowNull':![]},'type':{'type':Sequelize[_0x7d11('0x4')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0x7d11('0x5')](_0x7d11('0x6')),'get':function(){try{return JSON[_0x7d11('0x7')](this[_0x7d11('0x8')](_0x7d11('0x9')));}catch(_0x2689c6){return[];}},'set':function(_0x27d7e8){try{this[_0x7d11('0xa')](_0x7d11('0x9'),JSON[_0x7d11('0xb')](_0x27d7e8));}catch(_0x47b5e6){this[_0x7d11('0xa')](_0x7d11('0x9'),JSON[_0x7d11('0xb')]([]));}}},'sizeX':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0x7d11('0xc')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0x7d11('0xc')]},'col':{'type':Sequelize[_0x7d11('0xc')]},'background':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x7d11('0xd'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'#2196f3','validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0x7d11('0x4')]},'titleFontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xc}}; \ No newline at end of file +var _0x71ab=['setDataValue','stringify','INTEGER','#2196f3','squel','exports','STRING','TEXT','long','parse','getDataValue','attrs'];(function(_0x318256,_0xa773f3){var _0xb1e352=function(_0x4bb14e){while(--_0x4bb14e){_0x318256['push'](_0x318256['shift']());}};_0xb1e352(++_0xa773f3);}(_0x71ab,0x64));var _0xb71a=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x71ab[_0x19e35c];return _0x3e1fe8;};'use strict';var Sequelize=require('sequelize');var squel=require(_0xb71a('0x0'));var _=require('lodash');module[_0xb71a('0x1')]={'title':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xb71a('0x2')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0xb71a('0x3')](_0xb71a('0x4')),'get':function(){try{return JSON[_0xb71a('0x5')](this[_0xb71a('0x6')](_0xb71a('0x7')));}catch(_0x2192e8){return[];}},'set':function(_0x38d931){try{this[_0xb71a('0x8')](_0xb71a('0x7'),JSON[_0xb71a('0x9')](_0x38d931));}catch(_0x2a4c86){this[_0xb71a('0x8')](_0xb71a('0x7'),JSON[_0xb71a('0x9')]([]));}}},'sizeX':{'type':Sequelize[_0xb71a('0xa')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0xb71a('0xa')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0xb71a('0xa')]},'col':{'type':Sequelize['INTEGER']},'background':{'type':Sequelize[_0xb71a('0x2')],'allowNull':![],'defaultValue':'#ffffff','validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0xb71a('0x2')],'allowNull':![],'defaultValue':_0xb71a('0xb'),'validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0xb71a('0x2')]},'titleFontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xc}}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.controller.js b/server/api/dashboardItem/dashboardItem.controller.js index 6609647..f2e4726 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 _0x3cd8=['params','attrUrl','attrs','value','https://','custom','attrPath','clock','attrHourFormat','attrTimezone','0.00','attrFontSize','counter','total','attrVoiceQueues','attrChannel','voice','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrChatWebsites','pie-chart','attrSerie1','attrSerie2','attrSerie3','attrEmailAccounts','attrWhatsappAccounts','attrReport','type','attrRefresh','widgetAttributes:\x20%s','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./dashboardItem.socket','register','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','apply','save','update','destroy','then','end','error','stack','name','show','DashboardItem','rawAttributes','keys','query','filters','intersection','model','attributes','fields','length','include','find','catch'];(function(_0x3511f2,_0x532e4a){var _0x39e594=function(_0x27b737){while(--_0x27b737){_0x3511f2['push'](_0x3511f2['shift']());}};_0x39e594(++_0x532e4a);}(_0x3cd8,0x150));var _0x83cd=function(_0x3cea78,_0x4a6751){_0x3cea78=_0x3cea78-0x0;var _0x33b66b=_0x3cd8[_0x3cea78];return _0x33b66b;};'use strict';var emlformat=require(_0x83cd('0x0'));var rimraf=require(_0x83cd('0x1'));var zipdir=require(_0x83cd('0x2'));var jsonpatch=require(_0x83cd('0x3'));var rp=require(_0x83cd('0x4'));var moment=require(_0x83cd('0x5'));var BPromise=require(_0x83cd('0x6'));var Mustache=require(_0x83cd('0x7'));var util=require('util');var path=require(_0x83cd('0x8'));var sox=require(_0x83cd('0x9'));var csv=require(_0x83cd('0xa'));var ejs=require(_0x83cd('0xb'));var fs=require('fs');var fs_extra=require(_0x83cd('0xc'));var _=require(_0x83cd('0xd'));var squel=require(_0x83cd('0xe'));var crypto=require(_0x83cd('0xf'));var jsforce=require(_0x83cd('0x10'));var deskjs=require(_0x83cd('0x11'));var toCsv=require(_0x83cd('0xa'));var querystring=require(_0x83cd('0x12'));var Papa=require(_0x83cd('0x13'));var Redis=require(_0x83cd('0x14'));var authService=require(_0x83cd('0x15'));var qs=require(_0x83cd('0x16'));var as=require(_0x83cd('0x17'));var hardwareService=require(_0x83cd('0x18'));var logger=require(_0x83cd('0x19'))(_0x83cd('0x1a'));var utils=require('../../config/utils');var config=require(_0x83cd('0x1b'));var licenseUtil=require(_0x83cd('0x1c'));var db=require(_0x83cd('0x1d'))['db'];config[_0x83cd('0x1e')]=_[_0x83cd('0x1f')](config[_0x83cd('0x1e')],{'host':_0x83cd('0x20'),'port':0x18eb});var socket=require(_0x83cd('0x21'))(new Redis(config['redis']));require(_0x83cd('0x22'))[_0x83cd('0x23')](socket);function respondWithStatusCode(_0x2d330d,_0x28dccb){_0x28dccb=_0x28dccb||0xcc;return function(_0x2adc87){if(_0x2adc87){return _0x2d330d[_0x83cd('0x24')](_0x28dccb);}return _0x2d330d['status'](_0x28dccb)['end']();};}function respondWithResult(_0x268f58,_0x40ba0f){_0x40ba0f=_0x40ba0f||0xc8;return function(_0x2eafe7){if(_0x2eafe7){return _0x268f58[_0x83cd('0x25')](_0x40ba0f)[_0x83cd('0x26')](_0x2eafe7);}};}function respondWithFilteredResult(_0x3d6303,_0x7343f7){return function(_0x1e136e){if(_0x1e136e){var _0x5e35e3=typeof _0x7343f7[_0x83cd('0x27')]==='undefined'&&typeof _0x7343f7[_0x83cd('0x28')]===_0x83cd('0x29');var _0x23d9e4=_0x1e136e['count'];var _0x4c84d3=_0x5e35e3?0x0:_0x7343f7[_0x83cd('0x27')];var _0x50e044=_0x5e35e3?_0x1e136e[_0x83cd('0x2a')]:_0x7343f7[_0x83cd('0x27')]+_0x7343f7['limit'];var _0x327f7e;if(_0x50e044>=_0x23d9e4){_0x50e044=_0x23d9e4;_0x327f7e=0xc8;}else{_0x327f7e=0xce;}_0x3d6303[_0x83cd('0x25')](_0x327f7e);return _0x3d6303[_0x83cd('0x2b')](_0x83cd('0x2c'),_0x4c84d3+'-'+_0x50e044+'/'+_0x23d9e4)[_0x83cd('0x26')](_0x1e136e);}return null;};}function patchUpdates(_0x3f6c85){return function(_0x10b957){try{jsonpatch[_0x83cd('0x2d')](_0x10b957,_0x3f6c85,!![]);}catch(_0x507f7e){return BPromise['reject'](_0x507f7e);}return _0x10b957[_0x83cd('0x2e')]();};}function saveUpdates(_0x56c424,_0xf338c6){return function(_0x2a99aa){if(_0x2a99aa){return _0x2a99aa[_0x83cd('0x2f')](_0x56c424)['then'](function(_0x30c29e){return _0x30c29e;});}return null;};}function removeEntity(_0x33bb16,_0x3558fa){return function(_0x4029a1){if(_0x4029a1){return _0x4029a1[_0x83cd('0x30')]()[_0x83cd('0x31')](function(){_0x33bb16[_0x83cd('0x25')](0xcc)[_0x83cd('0x32')]();});}};}function handleEntityNotFound(_0x5a9899,_0x21d938){return function(_0x12dac7){if(!_0x12dac7){_0x5a9899[_0x83cd('0x24')](0x194);}return _0x12dac7;};}function handleError(_0x3e468e,_0x78734f){_0x78734f=_0x78734f||0x1f4;return function(_0x9dbb16){logger[_0x83cd('0x33')](_0x9dbb16[_0x83cd('0x34')]);if(_0x9dbb16[_0x83cd('0x35')]){delete _0x9dbb16[_0x83cd('0x35')];}_0x3e468e[_0x83cd('0x25')](_0x78734f)['send'](_0x9dbb16);};}exports[_0x83cd('0x36')]=function(_0x2ace11,_0x51bdf3){var _0x38590e={'raw':![],'where':{'id':_0x2ace11['params']['id']}},_0xbedd59={};_0xbedd59['model']=_['keys'](db[_0x83cd('0x37')][_0x83cd('0x38')]);_0xbedd59['query']=_[_0x83cd('0x39')](_0x2ace11[_0x83cd('0x3a')]);_0xbedd59[_0x83cd('0x3b')]=_[_0x83cd('0x3c')](_0xbedd59[_0x83cd('0x3d')],_0xbedd59[_0x83cd('0x3a')]);_0x38590e[_0x83cd('0x3e')]=_[_0x83cd('0x3c')](_0xbedd59[_0x83cd('0x3d')],qs[_0x83cd('0x3f')](_0x2ace11[_0x83cd('0x3a')]['fields']));_0x38590e[_0x83cd('0x3e')]=_0x38590e[_0x83cd('0x3e')][_0x83cd('0x40')]?_0x38590e[_0x83cd('0x3e')]:_0xbedd59['model'];if(_0x2ace11['query']['includeAll']){_0x38590e[_0x83cd('0x41')]=[{'all':!![]}];}_0x38590e=_['merge']({},_0x38590e,_0x2ace11['options']);return db['DashboardItem'][_0x83cd('0x42')](_0x38590e)[_0x83cd('0x31')](handleEntityNotFound(_0x51bdf3,null))[_0x83cd('0x31')](respondWithResult(_0x51bdf3,null))[_0x83cd('0x43')](handleError(_0x51bdf3,null));};exports[_0x83cd('0x30')]=function(_0x2c87aa,_0x58a782){return db[_0x83cd('0x37')][_0x83cd('0x42')]({'where':{'id':_0x2c87aa[_0x83cd('0x44')]['id']}})['then'](handleEntityNotFound(_0x58a782,null))[_0x83cd('0x31')](removeEntity(_0x58a782,null))[_0x83cd('0x43')](handleError(_0x58a782,null));};function widgetAttributes(_0x40a206){try{switch(_0x40a206['type']){case'iframe':return[{'name':_0x83cd('0x45'),'value':_0x40a206[_0x83cd('0x45')]||(_0x40a206['attrs']&&_0x40a206[_0x83cd('0x46')][0x0]?_0x40a206[_0x83cd('0x46')][0x0][_0x83cd('0x47')]:undefined)||_0x83cd('0x48')}];case _0x83cd('0x49'):return[{'name':'attrPath','value':_0x40a206[_0x83cd('0x4a')]||(_0x40a206['attrs']&&_0x40a206[_0x83cd('0x46')][0x0]?_0x40a206[_0x83cd('0x46')][0x0][_0x83cd('0x47')]:undefined)||''}];case _0x83cd('0x4b'):return[{'name':'attrHourFormat','value':_0x40a206[_0x83cd('0x4c')]||(_0x40a206[_0x83cd('0x46')]&&_0x40a206['attrs'][0x0]?_0x40a206[_0x83cd('0x46')][0x0][_0x83cd('0x47')]:undefined)||'HH:mm:ss'},{'name':'attrTimezone','value':_0x40a206[_0x83cd('0x4d')]||(_0x40a206[_0x83cd('0x46')]&&_0x40a206[_0x83cd('0x46')][0x1]?_0x40a206['attrs'][0x1][_0x83cd('0x47')]:undefined)||_0x83cd('0x4e')},{'name':_0x83cd('0x4f'),'value':_0x40a206['attrFontSize']||(_0x40a206['attrs']&&_0x40a206[_0x83cd('0x46')][0x2]?_0x40a206[_0x83cd('0x46')][0x2][_0x83cd('0x47')]:undefined)||0xc}];case _0x83cd('0x50'):return[{'name':'attrMetric','value':_0x40a206['attrMetric']||(_0x40a206[_0x83cd('0x46')]&&_0x40a206[_0x83cd('0x46')][0x0]?_0x40a206['attrs'][0x0][_0x83cd('0x47')]:undefined)||_0x83cd('0x51')},{'name':'attrVoiceQueues','value':_0x40a206[_0x83cd('0x52')]||(_0x40a206[_0x83cd('0x46')]&&_0x40a206[_0x83cd('0x46')][0x1]?_0x40a206[_0x83cd('0x46')][0x1][_0x83cd('0x47')]:undefined)||[]},{'name':'attrFontSize','value':_0x40a206[_0x83cd('0x4f')]||(_0x40a206['attrs']&&_0x40a206['attrs'][0x2]?_0x40a206['attrs'][0x2]['value']:undefined)||0x14},{'name':_0x83cd('0x53'),'value':_0x40a206['attrChannel']||(_0x40a206[_0x83cd('0x46')]&&_0x40a206['attrs'][0x3]?_0x40a206['attrs'][0x3][_0x83cd('0x47')]:undefined)||_0x83cd('0x54')},{'name':'attrEmailAccounts','value':_0x40a206['attrEmailAccounts']||(_0x40a206[_0x83cd('0x46')]&&_0x40a206[_0x83cd('0x46')][0x4]?_0x40a206['attrs'][0x4]['value']:undefined)||''},{'name':_0x83cd('0x55'),'value':_0x40a206[_0x83cd('0x55')]||(_0x40a206[_0x83cd('0x46')]&&_0x40a206['attrs'][0x5]?_0x40a206[_0x83cd('0x46')][0x5][_0x83cd('0x47')]:undefined)||''},{'name':_0x83cd('0x56'),'value':_0x40a206[_0x83cd('0x56')]||(_0x40a206[_0x83cd('0x46')]&&_0x40a206[_0x83cd('0x46')][0x6]?_0x40a206[_0x83cd('0x46')][0x6][_0x83cd('0x47')]:undefined)||''},{'name':_0x83cd('0x57'),'value':_0x40a206['attrOpenchannelAccounts']||(_0x40a206[_0x83cd('0x46')]&&_0x40a206[_0x83cd('0x46')][0x7]?_0x40a206['attrs'][0x7][_0x83cd('0x47')]:undefined)||''},{'name':'attrWhatsappAccounts','value':_0x40a206['attrWhatsappAccounts']||(_0x40a206['attrs']&&_0x40a206[_0x83cd('0x46')][0x8]?_0x40a206[_0x83cd('0x46')][0x8][_0x83cd('0x47')]:undefined)||''},{'name':'attrChatWebsites','value':_0x40a206[_0x83cd('0x58')]||(_0x40a206[_0x83cd('0x46')]&&_0x40a206['attrs'][0x9]?_0x40a206[_0x83cd('0x46')][0x9]['value']:undefined)||''}];case'multibar-chart':case _0x83cd('0x59'):return[{'name':_0x83cd('0x5a'),'value':_0x40a206[_0x83cd('0x5a')]||(_0x40a206[_0x83cd('0x46')]&&_0x40a206[_0x83cd('0x46')][0x0]?_0x40a206[_0x83cd('0x46')][0x0][_0x83cd('0x47')]:undefined)||'total'},{'name':_0x83cd('0x5b'),'value':_0x40a206[_0x83cd('0x5b')]||(_0x40a206[_0x83cd('0x46')]&&_0x40a206[_0x83cd('0x46')][0x1]?_0x40a206[_0x83cd('0x46')][0x1][_0x83cd('0x47')]:undefined)||null},{'name':'attrSerie3','value':_0x40a206[_0x83cd('0x5c')]||(_0x40a206[_0x83cd('0x46')]&&_0x40a206[_0x83cd('0x46')][0x2]?_0x40a206[_0x83cd('0x46')][0x2][_0x83cd('0x47')]:undefined)||null},{'name':_0x83cd('0x52'),'value':_0x40a206['attrVoiceQueues']||(_0x40a206[_0x83cd('0x46')]&&_0x40a206[_0x83cd('0x46')][0x3]?_0x40a206[_0x83cd('0x46')][0x3][_0x83cd('0x47')]:undefined)||[]},{'name':'attrChannel','value':_0x40a206[_0x83cd('0x53')]||(_0x40a206['attrs']&&_0x40a206[_0x83cd('0x46')][0x4]?_0x40a206[_0x83cd('0x46')][0x4][_0x83cd('0x47')]:undefined)||_0x83cd('0x54')},{'name':_0x83cd('0x5d'),'value':_0x40a206['attrEmailAccounts']||(_0x40a206[_0x83cd('0x46')]&&_0x40a206[_0x83cd('0x46')][0x5]?_0x40a206[_0x83cd('0x46')][0x5][_0x83cd('0x47')]:undefined)||''},{'name':_0x83cd('0x55'),'value':_0x40a206[_0x83cd('0x55')]||(_0x40a206[_0x83cd('0x46')]&&_0x40a206[_0x83cd('0x46')][0x6]?_0x40a206[_0x83cd('0x46')][0x6][_0x83cd('0x47')]:undefined)||''},{'name':_0x83cd('0x56'),'value':_0x40a206[_0x83cd('0x56')]||(_0x40a206[_0x83cd('0x46')]&&_0x40a206[_0x83cd('0x46')][0x7]?_0x40a206[_0x83cd('0x46')][0x7]['value']:undefined)||''},{'name':_0x83cd('0x57'),'value':_0x40a206[_0x83cd('0x57')]||(_0x40a206['attrs']&&_0x40a206[_0x83cd('0x46')][0x8]?_0x40a206['attrs'][0x8][_0x83cd('0x47')]:undefined)||''},{'name':_0x83cd('0x5e'),'value':_0x40a206['attrWhatsappAccounts']||(_0x40a206[_0x83cd('0x46')]&&_0x40a206[_0x83cd('0x46')][0x9]?_0x40a206[_0x83cd('0x46')][0x9]['value']:undefined)||''},{'name':_0x83cd('0x58'),'value':_0x40a206[_0x83cd('0x58')]||(_0x40a206['attrs']&&_0x40a206[_0x83cd('0x46')][0xa]?_0x40a206[_0x83cd('0x46')][0xa]['value']:undefined)||''}];case'web-report':return[{'name':_0x83cd('0x5f'),'type':_0x40a206['reportType']||(_0x40a206['attrs']&&_0x40a206[_0x83cd('0x46')][0x0]?_0x40a206[_0x83cd('0x46')][0x0][_0x83cd('0x60')]:undefined)||null,'value':_0x40a206[_0x83cd('0x5f')]||(_0x40a206[_0x83cd('0x46')]&&_0x40a206[_0x83cd('0x46')][0x0]?_0x40a206[_0x83cd('0x46')][0x0][_0x83cd('0x47')]:undefined)||null},{'name':_0x83cd('0x61'),'value':_0x40a206[_0x83cd('0x61')]||(_0x40a206[_0x83cd('0x46')]&&_0x40a206[_0x83cd('0x46')][0x1]?_0x40a206[_0x83cd('0x46')][0x1]['value']:undefined)||0x0}];default:return[];}}catch(_0x144979){logger[_0x83cd('0x33')](_0x83cd('0x62'),JSON['stringify'](_0x144979));return[];}}exports[_0x83cd('0x63')]=function(_0x3dd814,_0xa03b48){if(_0x3dd814[_0x83cd('0x64')]){_0x3dd814[_0x83cd('0x64')][_0x83cd('0x46')]=widgetAttributes(_0x3dd814[_0x83cd('0x64')]);}return db['DashboardItem'][_0x83cd('0x63')](_0x3dd814['body'],{})[_0x83cd('0x31')](respondWithResult(_0xa03b48,0xc9))[_0x83cd('0x43')](handleError(_0xa03b48,null));};exports[_0x83cd('0x2f')]=function(_0x11417c,_0x243fa0){if(_0x11417c['body']['id']){delete _0x11417c[_0x83cd('0x64')]['id'];}_0x11417c['body'][_0x83cd('0x46')]=widgetAttributes(_0x11417c['body']);return db[_0x83cd('0x37')][_0x83cd('0x42')]({'where':{'id':_0x11417c[_0x83cd('0x44')]['id']}})[_0x83cd('0x31')](handleEntityNotFound(_0x243fa0,null))['then'](saveUpdates(_0x11417c[_0x83cd('0x64')],null))[_0x83cd('0x31')](respondWithResult(_0x243fa0,null))['catch'](handleError(_0x243fa0,null));}; \ No newline at end of file +var _0x0024=['./dashboardItem.socket','register','sendStatus','status','end','json','limit','undefined','count','offset','set','Content-Range','apply','save','update','destroy','then','error','stack','name','show','params','model','keys','DashboardItem','rawAttributes','query','filters','intersection','attributes','fields','length','includeAll','include','options','catch','find','iframe','attrUrl','value','attrPath','attrs','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','attrMetric','total','attrVoiceQueues','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrOpenchannelAccounts','attrChatWebsites','pie-chart','attrSerie1','attrSerie2','attrSerie3','attrSmsAccounts','attrWhatsappAccounts','web-report','attrReport','reportType','type','attrRefresh','widgetAttributes:\x20%s','stringify','create','body','rimraf','fast-json-patch','moment','util','path','ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter'];(function(_0x339912,_0x43c859){var _0x35e346=function(_0x111e8d){while(--_0x111e8d){_0x339912['push'](_0x339912['shift']());}};_0x35e346(++_0x43c859);}(_0x0024,0xa8));var _0x4002=function(_0x114bdb,_0x5cd54f){_0x114bdb=_0x114bdb-0x0;var _0x38b98e=_0x0024[_0x114bdb];return _0x38b98e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x4002('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4002('0x1'));var rp=require('request-promise');var moment=require(_0x4002('0x2'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x4002('0x3'));var path=require(_0x4002('0x4'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x4002('0x5'));var fs=require('fs');var fs_extra=require(_0x4002('0x6'));var _=require(_0x4002('0x7'));var squel=require(_0x4002('0x8'));var crypto=require('crypto');var jsforce=require(_0x4002('0x9'));var deskjs=require(_0x4002('0xa'));var toCsv=require(_0x4002('0xb'));var querystring=require(_0x4002('0xc'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x4002('0xd'));var qs=require(_0x4002('0xe'));var as=require(_0x4002('0xf'));var hardwareService=require(_0x4002('0x10'));var logger=require(_0x4002('0x11'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x4002('0x12'));var db=require(_0x4002('0x13'))['db'];config[_0x4002('0x14')]=_[_0x4002('0x15')](config['redis'],{'host':_0x4002('0x16'),'port':0x18eb});var socket=require(_0x4002('0x17'))(new Redis(config[_0x4002('0x14')]));require(_0x4002('0x18'))[_0x4002('0x19')](socket);function respondWithStatusCode(_0x50a1a8,_0x77b4c0){_0x77b4c0=_0x77b4c0||0xcc;return function(_0x4fe0b5){if(_0x4fe0b5){return _0x50a1a8[_0x4002('0x1a')](_0x77b4c0);}return _0x50a1a8[_0x4002('0x1b')](_0x77b4c0)[_0x4002('0x1c')]();};}function respondWithResult(_0x5813ff,_0x43a7e1){_0x43a7e1=_0x43a7e1||0xc8;return function(_0x5c4a33){if(_0x5c4a33){return _0x5813ff['status'](_0x43a7e1)[_0x4002('0x1d')](_0x5c4a33);}};}function respondWithFilteredResult(_0x3facc1,_0x4c0071){return function(_0x1b3401){if(_0x1b3401){var _0x4d5754=typeof _0x4c0071['offset']==='undefined'&&typeof _0x4c0071[_0x4002('0x1e')]===_0x4002('0x1f');var _0x283708=_0x1b3401[_0x4002('0x20')];var _0x514dfe=_0x4d5754?0x0:_0x4c0071[_0x4002('0x21')];var _0x1a5364=_0x4d5754?_0x1b3401[_0x4002('0x20')]:_0x4c0071['offset']+_0x4c0071[_0x4002('0x1e')];var _0x51b709;if(_0x1a5364>=_0x283708){_0x1a5364=_0x283708;_0x51b709=0xc8;}else{_0x51b709=0xce;}_0x3facc1[_0x4002('0x1b')](_0x51b709);return _0x3facc1[_0x4002('0x22')](_0x4002('0x23'),_0x514dfe+'-'+_0x1a5364+'/'+_0x283708)['json'](_0x1b3401);}return null;};}function patchUpdates(_0x52add8){return function(_0x447851){try{jsonpatch[_0x4002('0x24')](_0x447851,_0x52add8,!![]);}catch(_0x254b67){return BPromise['reject'](_0x254b67);}return _0x447851[_0x4002('0x25')]();};}function saveUpdates(_0x27732c,_0x18b000){return function(_0x23e917){if(_0x23e917){return _0x23e917[_0x4002('0x26')](_0x27732c)['then'](function(_0x3396d8){return _0x3396d8;});}return null;};}function removeEntity(_0x1dfb81,_0x385c35){return function(_0x425b3f){if(_0x425b3f){return _0x425b3f[_0x4002('0x27')]()[_0x4002('0x28')](function(){_0x1dfb81['status'](0xcc)[_0x4002('0x1c')]();});}};}function handleEntityNotFound(_0x2d148e,_0x49e273){return function(_0xf5ae88){if(!_0xf5ae88){_0x2d148e[_0x4002('0x1a')](0x194);}return _0xf5ae88;};}function handleError(_0x569154,_0xa7b46a){_0xa7b46a=_0xa7b46a||0x1f4;return function(_0x278907){logger[_0x4002('0x29')](_0x278907[_0x4002('0x2a')]);if(_0x278907[_0x4002('0x2b')]){delete _0x278907[_0x4002('0x2b')];}_0x569154[_0x4002('0x1b')](_0xa7b46a)['send'](_0x278907);};}exports[_0x4002('0x2c')]=function(_0x162173,_0x237704){var _0x598048={'raw':![],'where':{'id':_0x162173[_0x4002('0x2d')]['id']}},_0x52f488={};_0x52f488[_0x4002('0x2e')]=_[_0x4002('0x2f')](db[_0x4002('0x30')][_0x4002('0x31')]);_0x52f488[_0x4002('0x32')]=_[_0x4002('0x2f')](_0x162173[_0x4002('0x32')]);_0x52f488[_0x4002('0x33')]=_[_0x4002('0x34')](_0x52f488['model'],_0x52f488[_0x4002('0x32')]);_0x598048[_0x4002('0x35')]=_[_0x4002('0x34')](_0x52f488['model'],qs[_0x4002('0x36')](_0x162173[_0x4002('0x32')][_0x4002('0x36')]));_0x598048['attributes']=_0x598048[_0x4002('0x35')][_0x4002('0x37')]?_0x598048[_0x4002('0x35')]:_0x52f488[_0x4002('0x2e')];if(_0x162173[_0x4002('0x32')][_0x4002('0x38')]){_0x598048[_0x4002('0x39')]=[{'all':!![]}];}_0x598048=_['merge']({},_0x598048,_0x162173[_0x4002('0x3a')]);return db[_0x4002('0x30')]['find'](_0x598048)['then'](handleEntityNotFound(_0x237704,null))[_0x4002('0x28')](respondWithResult(_0x237704,null))[_0x4002('0x3b')](handleError(_0x237704,null));};exports[_0x4002('0x27')]=function(_0x5e412,_0x94ecc3){return db[_0x4002('0x30')][_0x4002('0x3c')]({'where':{'id':_0x5e412[_0x4002('0x2d')]['id']}})['then'](handleEntityNotFound(_0x94ecc3,null))[_0x4002('0x28')](removeEntity(_0x94ecc3,null))[_0x4002('0x3b')](handleError(_0x94ecc3,null));};function widgetAttributes(_0x3c1330){try{switch(_0x3c1330['type']){case _0x4002('0x3d'):return[{'name':'attrUrl','value':_0x3c1330[_0x4002('0x3e')]||(_0x3c1330['attrs']&&_0x3c1330['attrs'][0x0]?_0x3c1330['attrs'][0x0][_0x4002('0x3f')]:undefined)||'https://'}];case'custom':return[{'name':'attrPath','value':_0x3c1330[_0x4002('0x40')]||(_0x3c1330[_0x4002('0x41')]&&_0x3c1330[_0x4002('0x41')][0x0]?_0x3c1330['attrs'][0x0][_0x4002('0x3f')]:undefined)||''}];case _0x4002('0x42'):return[{'name':_0x4002('0x43'),'value':_0x3c1330[_0x4002('0x43')]||(_0x3c1330[_0x4002('0x41')]&&_0x3c1330[_0x4002('0x41')][0x0]?_0x3c1330['attrs'][0x0][_0x4002('0x3f')]:undefined)||_0x4002('0x44')},{'name':_0x4002('0x45'),'value':_0x3c1330[_0x4002('0x45')]||(_0x3c1330[_0x4002('0x41')]&&_0x3c1330['attrs'][0x1]?_0x3c1330[_0x4002('0x41')][0x1]['value']:undefined)||_0x4002('0x46')},{'name':_0x4002('0x47'),'value':_0x3c1330['attrFontSize']||(_0x3c1330['attrs']&&_0x3c1330[_0x4002('0x41')][0x2]?_0x3c1330[_0x4002('0x41')][0x2]['value']:undefined)||0xc}];case'counter':return[{'name':_0x4002('0x48'),'value':_0x3c1330[_0x4002('0x48')]||(_0x3c1330['attrs']&&_0x3c1330[_0x4002('0x41')][0x0]?_0x3c1330[_0x4002('0x41')][0x0][_0x4002('0x3f')]:undefined)||_0x4002('0x49')},{'name':_0x4002('0x4a'),'value':_0x3c1330[_0x4002('0x4a')]||(_0x3c1330[_0x4002('0x41')]&&_0x3c1330[_0x4002('0x41')][0x1]?_0x3c1330['attrs'][0x1]['value']:undefined)||[]},{'name':'attrFontSize','value':_0x3c1330[_0x4002('0x47')]||(_0x3c1330['attrs']&&_0x3c1330[_0x4002('0x41')][0x2]?_0x3c1330['attrs'][0x2][_0x4002('0x3f')]:undefined)||0x14},{'name':_0x4002('0x4b'),'value':_0x3c1330[_0x4002('0x4b')]||(_0x3c1330['attrs']&&_0x3c1330[_0x4002('0x41')][0x3]?_0x3c1330['attrs'][0x3]['value']:undefined)||_0x4002('0x4c')},{'name':_0x4002('0x4d'),'value':_0x3c1330[_0x4002('0x4d')]||(_0x3c1330[_0x4002('0x41')]&&_0x3c1330['attrs'][0x4]?_0x3c1330['attrs'][0x4][_0x4002('0x3f')]:undefined)||''},{'name':_0x4002('0x4e'),'value':_0x3c1330[_0x4002('0x4e')]||(_0x3c1330['attrs']&&_0x3c1330[_0x4002('0x41')][0x5]?_0x3c1330['attrs'][0x5][_0x4002('0x3f')]:undefined)||''},{'name':'attrSmsAccounts','value':_0x3c1330['attrSmsAccounts']||(_0x3c1330[_0x4002('0x41')]&&_0x3c1330[_0x4002('0x41')][0x6]?_0x3c1330['attrs'][0x6][_0x4002('0x3f')]:undefined)||''},{'name':_0x4002('0x4f'),'value':_0x3c1330[_0x4002('0x4f')]||(_0x3c1330[_0x4002('0x41')]&&_0x3c1330['attrs'][0x7]?_0x3c1330['attrs'][0x7][_0x4002('0x3f')]:undefined)||''},{'name':'attrWhatsappAccounts','value':_0x3c1330['attrWhatsappAccounts']||(_0x3c1330['attrs']&&_0x3c1330[_0x4002('0x41')][0x8]?_0x3c1330[_0x4002('0x41')][0x8]['value']:undefined)||''},{'name':_0x4002('0x50'),'value':_0x3c1330[_0x4002('0x50')]||(_0x3c1330[_0x4002('0x41')]&&_0x3c1330[_0x4002('0x41')][0x9]?_0x3c1330[_0x4002('0x41')][0x9][_0x4002('0x3f')]:undefined)||''}];case'multibar-chart':case _0x4002('0x51'):return[{'name':_0x4002('0x52'),'value':_0x3c1330['attrSerie1']||(_0x3c1330[_0x4002('0x41')]&&_0x3c1330[_0x4002('0x41')][0x0]?_0x3c1330['attrs'][0x0][_0x4002('0x3f')]:undefined)||_0x4002('0x49')},{'name':_0x4002('0x53'),'value':_0x3c1330[_0x4002('0x53')]||(_0x3c1330['attrs']&&_0x3c1330[_0x4002('0x41')][0x1]?_0x3c1330[_0x4002('0x41')][0x1][_0x4002('0x3f')]:undefined)||null},{'name':_0x4002('0x54'),'value':_0x3c1330[_0x4002('0x54')]||(_0x3c1330[_0x4002('0x41')]&&_0x3c1330[_0x4002('0x41')][0x2]?_0x3c1330[_0x4002('0x41')][0x2][_0x4002('0x3f')]:undefined)||null},{'name':'attrVoiceQueues','value':_0x3c1330[_0x4002('0x4a')]||(_0x3c1330['attrs']&&_0x3c1330['attrs'][0x3]?_0x3c1330[_0x4002('0x41')][0x3]['value']:undefined)||[]},{'name':_0x4002('0x4b'),'value':_0x3c1330[_0x4002('0x4b')]||(_0x3c1330[_0x4002('0x41')]&&_0x3c1330[_0x4002('0x41')][0x4]?_0x3c1330[_0x4002('0x41')][0x4][_0x4002('0x3f')]:undefined)||_0x4002('0x4c')},{'name':_0x4002('0x4d'),'value':_0x3c1330[_0x4002('0x4d')]||(_0x3c1330[_0x4002('0x41')]&&_0x3c1330[_0x4002('0x41')][0x5]?_0x3c1330[_0x4002('0x41')][0x5][_0x4002('0x3f')]:undefined)||''},{'name':_0x4002('0x4e'),'value':_0x3c1330[_0x4002('0x4e')]||(_0x3c1330[_0x4002('0x41')]&&_0x3c1330[_0x4002('0x41')][0x6]?_0x3c1330[_0x4002('0x41')][0x6][_0x4002('0x3f')]:undefined)||''},{'name':_0x4002('0x55'),'value':_0x3c1330[_0x4002('0x55')]||(_0x3c1330[_0x4002('0x41')]&&_0x3c1330[_0x4002('0x41')][0x7]?_0x3c1330[_0x4002('0x41')][0x7][_0x4002('0x3f')]:undefined)||''},{'name':_0x4002('0x4f'),'value':_0x3c1330[_0x4002('0x4f')]||(_0x3c1330[_0x4002('0x41')]&&_0x3c1330[_0x4002('0x41')][0x8]?_0x3c1330[_0x4002('0x41')][0x8][_0x4002('0x3f')]:undefined)||''},{'name':'attrWhatsappAccounts','value':_0x3c1330[_0x4002('0x56')]||(_0x3c1330[_0x4002('0x41')]&&_0x3c1330['attrs'][0x9]?_0x3c1330[_0x4002('0x41')][0x9]['value']:undefined)||''},{'name':'attrChatWebsites','value':_0x3c1330[_0x4002('0x50')]||(_0x3c1330[_0x4002('0x41')]&&_0x3c1330[_0x4002('0x41')][0xa]?_0x3c1330['attrs'][0xa]['value']:undefined)||''}];case _0x4002('0x57'):return[{'name':_0x4002('0x58'),'type':_0x3c1330[_0x4002('0x59')]||(_0x3c1330['attrs']&&_0x3c1330['attrs'][0x0]?_0x3c1330[_0x4002('0x41')][0x0][_0x4002('0x5a')]:undefined)||null,'value':_0x3c1330['attrReport']||(_0x3c1330[_0x4002('0x41')]&&_0x3c1330[_0x4002('0x41')][0x0]?_0x3c1330[_0x4002('0x41')][0x0]['value']:undefined)||null},{'name':_0x4002('0x5b'),'value':_0x3c1330[_0x4002('0x5b')]||(_0x3c1330[_0x4002('0x41')]&&_0x3c1330['attrs'][0x1]?_0x3c1330[_0x4002('0x41')][0x1][_0x4002('0x3f')]:undefined)||0x0}];default:return[];}}catch(_0x51a951){logger[_0x4002('0x29')](_0x4002('0x5c'),JSON[_0x4002('0x5d')](_0x51a951));return[];}}exports[_0x4002('0x5e')]=function(_0x5d1c12,_0x57922d){if(_0x5d1c12[_0x4002('0x5f')]){_0x5d1c12['body'][_0x4002('0x41')]=widgetAttributes(_0x5d1c12[_0x4002('0x5f')]);}return db[_0x4002('0x30')][_0x4002('0x5e')](_0x5d1c12['body'],{})[_0x4002('0x28')](respondWithResult(_0x57922d,0xc9))['catch'](handleError(_0x57922d,null));};exports[_0x4002('0x26')]=function(_0x4f596d,_0x2c0af7){if(_0x4f596d['body']['id']){delete _0x4f596d[_0x4002('0x5f')]['id'];}_0x4f596d['body'][_0x4002('0x41')]=widgetAttributes(_0x4f596d[_0x4002('0x5f')]);return db[_0x4002('0x30')][_0x4002('0x3c')]({'where':{'id':_0x4f596d[_0x4002('0x2d')]['id']}})['then'](handleEntityNotFound(_0x2c0af7,null))[_0x4002('0x28')](saveUpdates(_0x4f596d['body'],null))[_0x4002('0x28')](respondWithResult(_0x2c0af7,null))[_0x4002('0x3b')](handleError(_0x2c0af7,null));}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.events.js b/server/api/dashboardItem/dashboardItem.events.js index 51dd83b..a001d23 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 _0x16f5=['save','remove','emit','hasOwnProperty','hook','../../mysqldb'];(function(_0x5a3c7b,_0x1dd28b){var _0x3911fd=function(_0x14762b){while(--_0x14762b){_0x5a3c7b['push'](_0x5a3c7b['shift']());}};_0x3911fd(++_0x1dd28b);}(_0x16f5,0x8f));var _0x516f=function(_0x4d57a9,_0x4773ec){_0x4d57a9=_0x4d57a9-0x0;var _0xd41b16=_0x16f5[_0x4d57a9];return _0xd41b16;};'use strict';var EventEmitter=require('events');var DashboardItem=require(_0x516f('0x0'))['db']['DashboardItem'];var DashboardItemEvents=new EventEmitter();DashboardItemEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x516f('0x1'),'afterUpdate':'update','afterDestroy':_0x516f('0x2')};function emitEvent(_0x57b2d9){return function(_0x2fbd93,_0x7a3dc4,_0x23aceb){DashboardItemEvents[_0x516f('0x3')](_0x57b2d9+':'+_0x2fbd93['id'],_0x2fbd93);DashboardItemEvents[_0x516f('0x3')](_0x57b2d9,_0x2fbd93);_0x23aceb(null);};}for(var e in events){if(events[_0x516f('0x4')](e)){var event=events[e];DashboardItem[_0x516f('0x5')](e,emitEvent(event));}}module['exports']=DashboardItemEvents; \ No newline at end of file +var _0x9d6d=['remove','emit','hasOwnProperty','hook','events','../../mysqldb','DashboardItem','setMaxListeners','save','update'];(function(_0x3e57ef,_0x388fab){var _0x5ade66=function(_0xcbbd3){while(--_0xcbbd3){_0x3e57ef['push'](_0x3e57ef['shift']());}};_0x5ade66(++_0x388fab);}(_0x9d6d,0xc2));var _0xd9d6=function(_0x5b561d,_0x422b7c){_0x5b561d=_0x5b561d-0x0;var _0x431060=_0x9d6d[_0x5b561d];return _0x431060;};'use strict';var EventEmitter=require(_0xd9d6('0x0'));var DashboardItem=require(_0xd9d6('0x1'))['db'][_0xd9d6('0x2')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0xd9d6('0x3')](0x0);var events={'afterCreate':_0xd9d6('0x4'),'afterUpdate':_0xd9d6('0x5'),'afterDestroy':_0xd9d6('0x6')};function emitEvent(_0x3d80ae){return function(_0x5ed21b,_0x3e9b33,_0x4aab3e){DashboardItemEvents[_0xd9d6('0x7')](_0x3d80ae+':'+_0x5ed21b['id'],_0x5ed21b);DashboardItemEvents['emit'](_0x3d80ae,_0x5ed21b);_0x4aab3e(null);};}for(var e in events){if(events[_0xd9d6('0x8')](e)){var event=events[e];DashboardItem[_0xd9d6('0x9')](e,emitEvent(event));}}module['exports']=DashboardItemEvents; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.model.js b/server/api/dashboardItem/dashboardItem.model.js index 1a78c4b..fd9ebd2 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 _0x5139=['rimraf','../../config/environment','./dashboardItem.attributes','DashboardItem','util','api','moment','bluebird','request-promise','path'];(function(_0x4bbe9b,_0x550b33){var _0xa1b9c9=function(_0x16ee49){while(--_0x16ee49){_0x4bbe9b['push'](_0x4bbe9b['shift']());}};_0xa1b9c9(++_0x550b33);}(_0x5139,0xa4));var _0x9513=function(_0xfd7aff,_0x2ef300){_0xfd7aff=_0xfd7aff-0x0;var _0x47d7db=_0x5139[_0xfd7aff];return _0x47d7db;};'use strict';var _=require('lodash');var util=require(_0x9513('0x0'));var logger=require('../../config/logger')(_0x9513('0x1'));var moment=require(_0x9513('0x2'));var BPromise=require(_0x9513('0x3'));var rp=require(_0x9513('0x4'));var fs=require('fs');var path=require(_0x9513('0x5'));var rimraf=require(_0x9513('0x6'));var config=require(_0x9513('0x7'));var attributes=require(_0x9513('0x8'));module['exports']=function(_0x3facde,_0x437174){return _0x3facde['define'](_0x9513('0x9'),attributes,{'tableName':'dashboard_items','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x31ee=['./dashboardItem.attributes','exports','define','dashboard_items','lodash','util','../../config/logger','api','moment','request-promise','path','../../config/environment'];(function(_0x5a13cd,_0x3e956d){var _0x42fc30=function(_0x4587e2){while(--_0x4587e2){_0x5a13cd['push'](_0x5a13cd['shift']());}};_0x42fc30(++_0x3e956d);}(_0x31ee,0xf4));var _0xe31e=function(_0x27831b,_0xad5a4c){_0x27831b=_0x27831b-0x0;var _0x9dc835=_0x31ee[_0x27831b];return _0x9dc835;};'use strict';var _=require(_0xe31e('0x0'));var util=require(_0xe31e('0x1'));var logger=require(_0xe31e('0x2'))(_0xe31e('0x3'));var moment=require(_0xe31e('0x4'));var BPromise=require('bluebird');var rp=require(_0xe31e('0x5'));var fs=require('fs');var path=require(_0xe31e('0x6'));var rimraf=require('rimraf');var config=require(_0xe31e('0x7'));var attributes=require(_0xe31e('0x8'));module[_0xe31e('0x9')]=function(_0x1483aa,_0x10de21){return _0x1483aa[_0xe31e('0xa')]('DashboardItem',attributes,{'tableName':_0xe31e('0xb'),'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 c34aabb..bef6d16 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 _0x5141=['request','info','DashboardItem,\x20%s,\x20%s','request\x20sent','debug','DashboardItem,\x20%s,\x20%s,\x20%s','error','code','message','result','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','redis','localhost','socket.io-emitter','./dashboardItem.socket','register'];(function(_0x3489dc,_0x5c9f11){var _0x53b272=function(_0x465420){while(--_0x465420){_0x3489dc['push'](_0x3489dc['shift']());}};_0x53b272(++_0x5c9f11);}(_0x5141,0xa6));var _0x1514=function(_0x2800e8,_0x24de42){_0x2800e8=_0x2800e8-0x0;var _0x1f4e11=_0x5141[_0x2800e8];return _0x1f4e11;};'use strict';var _=require(_0x1514('0x0'));var util=require('util');var moment=require(_0x1514('0x1'));var BPromise=require(_0x1514('0x2'));var rs=require(_0x1514('0x3'));var fs=require('fs');var Redis=require(_0x1514('0x4'));var db=require(_0x1514('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x1514('0x6'))(_0x1514('0x7'));var config=require(_0x1514('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x1514('0x9')][_0x1514('0xa')]({'port':0x232a});config['redis']=_['defaults'](config[_0x1514('0xb')],{'host':_0x1514('0xc'),'port':0x18eb});var socket=require(_0x1514('0xd'))(new Redis(config[_0x1514('0xb')]));require(_0x1514('0xe'))[_0x1514('0xf')](socket);function respondWithRpcPromise(_0x4b5db9,_0x2962ad,_0x423746){return new BPromise(function(_0x3f1848,_0x304abf){return client[_0x1514('0x10')](_0x4b5db9,_0x423746)['then'](function(_0x4b007a){logger[_0x1514('0x11')](_0x1514('0x12'),_0x2962ad,_0x1514('0x13'));logger[_0x1514('0x14')](_0x1514('0x15'),_0x2962ad,_0x1514('0x13'),JSON['stringify'](_0x4b007a));if(_0x4b007a[_0x1514('0x16')]){if(_0x4b007a[_0x1514('0x16')][_0x1514('0x17')]===0x1f4){logger['error'](_0x1514('0x12'),_0x2962ad,_0x4b007a[_0x1514('0x16')][_0x1514('0x18')]);return _0x304abf(_0x4b007a[_0x1514('0x16')][_0x1514('0x18')]);}logger[_0x1514('0x16')](_0x1514('0x12'),_0x2962ad,_0x4b007a['error']['message']);return _0x3f1848(_0x4b007a[_0x1514('0x16')]['message']);}else{logger[_0x1514('0x11')](_0x1514('0x12'),_0x2962ad,'request\x20sent');_0x3f1848(_0x4b007a[_0x1514('0x19')][_0x1514('0x18')]);}})['catch'](function(_0x39b66f){logger[_0x1514('0x16')](_0x1514('0x12'),_0x2962ad,_0x39b66f);_0x304abf(_0x39b66f);});});} \ No newline at end of file +var _0x5bee=['info','DashboardItem,\x20%s,\x20%s','request\x20sent','DashboardItem,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','register','request','then'];(function(_0x4dead7,_0x30fdd5){var _0x254d4f=function(_0x343749){while(--_0x343749){_0x4dead7['push'](_0x4dead7['shift']());}};_0x254d4f(++_0x30fdd5);}(_0x5bee,0x165));var _0xe5be=function(_0x53b0ec,_0x125d81){_0x53b0ec=_0x53b0ec-0x0;var _0x1f7ff4=_0x5bee[_0x53b0ec];return _0x1f7ff4;};'use strict';var _=require(_0xe5be('0x0'));var util=require(_0xe5be('0x1'));var moment=require(_0xe5be('0x2'));var BPromise=require(_0xe5be('0x3'));var rs=require(_0xe5be('0x4'));var fs=require('fs');var Redis=require(_0xe5be('0x5'));var db=require(_0xe5be('0x6'))['db'];var utils=require(_0xe5be('0x7'));var logger=require(_0xe5be('0x8'))(_0xe5be('0x9'));var config=require(_0xe5be('0xa'));var jayson=require('jayson/promise');var client=jayson[_0xe5be('0xb')][_0xe5be('0xc')]({'port':0x232a});config[_0xe5be('0xd')]=_[_0xe5be('0xe')](config['redis'],{'host':_0xe5be('0xf'),'port':0x18eb});var socket=require(_0xe5be('0x10'))(new Redis(config[_0xe5be('0xd')]));require('./dashboardItem.socket')[_0xe5be('0x11')](socket);function respondWithRpcPromise(_0x47bc4c,_0x2ae9e4,_0xc5f0cc){return new BPromise(function(_0x1bc6ac,_0x405768){return client[_0xe5be('0x12')](_0x47bc4c,_0xc5f0cc)[_0xe5be('0x13')](function(_0x5e77be){logger[_0xe5be('0x14')](_0xe5be('0x15'),_0x2ae9e4,_0xe5be('0x16'));logger['debug'](_0xe5be('0x17'),_0x2ae9e4,_0xe5be('0x16'),JSON['stringify'](_0x5e77be));if(_0x5e77be['error']){if(_0x5e77be[_0xe5be('0x18')][_0xe5be('0x19')]===0x1f4){logger[_0xe5be('0x18')]('DashboardItem,\x20%s,\x20%s',_0x2ae9e4,_0x5e77be['error']['message']);return _0x405768(_0x5e77be[_0xe5be('0x18')][_0xe5be('0x1a')]);}logger['error'](_0xe5be('0x15'),_0x2ae9e4,_0x5e77be[_0xe5be('0x18')][_0xe5be('0x1a')]);return _0x1bc6ac(_0x5e77be['error'][_0xe5be('0x1a')]);}else{logger[_0xe5be('0x14')]('DashboardItem,\x20%s,\x20%s',_0x2ae9e4,'request\x20sent');_0x1bc6ac(_0x5e77be[_0xe5be('0x1b')][_0xe5be('0x1a')]);}})[_0xe5be('0x1c')](function(_0x3aaba7){logger[_0xe5be('0x18')](_0xe5be('0x15'),_0x2ae9e4,_0x3aaba7);_0x405768(_0x3aaba7);});});} \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.socket.js b/server/api/dashboardItem/dashboardItem.socket.js index c13d51a..49c89a1 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 _0xe226=['remove','update','removeListener','dashboardItem:','save'];(function(_0x3a883e,_0xe3d75c){var _0x21b6e0=function(_0x161ab2){while(--_0x161ab2){_0x3a883e['push'](_0x3a883e['shift']());}};_0x21b6e0(++_0xe3d75c);}(_0xe226,0x149));var _0x6e22=function(_0x454dd8,_0x5e8abd){_0x454dd8=_0x454dd8-0x0;var _0x577dc1=_0xe226[_0x454dd8];return _0x577dc1;};'use strict';var DashboardItemEvents=require('./dashboardItem.events');var events=[_0x6e22('0x0'),_0x6e22('0x1'),_0x6e22('0x2')];function createListener(_0x42e224,_0x32579e){return function(_0x20ba14){_0x32579e['emit'](_0x42e224,_0x20ba14);};}function removeListener(_0x26384f,_0x18c240){return function(){DashboardItemEvents[_0x6e22('0x3')](_0x26384f,_0x18c240);};}exports['register']=function(_0x57fad1){for(var _0x25d4e2=0x0,_0x47c6b5=events['length'];_0x25d4e2<_0x47c6b5;_0x25d4e2++){var _0x1d7a65=events[_0x25d4e2];var _0x19d256=createListener(_0x6e22('0x4')+_0x1d7a65,_0x57fad1);DashboardItemEvents['on'](_0x1d7a65,_0x19d256);}}; \ No newline at end of file +var _0x4ae4=['save','remove','update','emit','removeListener','register','length','dashboardItem:'];(function(_0x4dc7b9,_0x319d5a){var _0x3ab114=function(_0x51a9df){while(--_0x51a9df){_0x4dc7b9['push'](_0x4dc7b9['shift']());}};_0x3ab114(++_0x319d5a);}(_0x4ae4,0x1c0));var _0x44ae=function(_0x140479,_0x2bb4b4){_0x140479=_0x140479-0x0;var _0x1def3c=_0x4ae4[_0x140479];return _0x1def3c;};'use strict';var DashboardItemEvents=require('./dashboardItem.events');var events=[_0x44ae('0x0'),_0x44ae('0x1'),_0x44ae('0x2')];function createListener(_0x1b9598,_0x2e8387){return function(_0x46e0ae){_0x2e8387[_0x44ae('0x3')](_0x1b9598,_0x46e0ae);};}function removeListener(_0x141199,_0x3402ab){return function(){DashboardItemEvents[_0x44ae('0x4')](_0x141199,_0x3402ab);};}exports[_0x44ae('0x5')]=function(_0x28f06e){for(var _0x4caa7e=0x0,_0x4a43f7=events[_0x44ae('0x6')];_0x4caa7e<_0x4a43f7;_0x4caa7e++){var _0x71e3b2=events[_0x4caa7e];var _0x5cc0d3=createListener(_0x44ae('0x7')+_0x71e3b2,_0x28f06e);DashboardItemEvents['on'](_0x71e3b2,_0x5cc0d3);}}; \ No newline at end of file diff --git a/server/api/dashboardItem/index.js b/server/api/dashboardItem/index.js index 34cbb8a..5354186 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 _0xe8b8=['util','connect-timeout','express','Router','fs-extra','../../components/auth/service','./dashboardItem.controller','get','/:id','show','post','isAuthenticated','put','update','delete','destroy','multer'];(function(_0x5d4600,_0x2c572f){var _0x5e71ef=function(_0x4f046f){while(--_0x4f046f){_0x5d4600['push'](_0x5d4600['shift']());}};_0x5e71ef(++_0x2c572f);}(_0xe8b8,0x175));var _0x8e8b=function(_0x2dab08,_0xae0571){_0x2dab08=_0x2dab08-0x0;var _0x3b72b6=_0xe8b8[_0x2dab08];return _0x3b72b6;};'use strict';var multer=require(_0x8e8b('0x0'));var util=require(_0x8e8b('0x1'));var path=require('path');var timeout=require(_0x8e8b('0x2'));var express=require(_0x8e8b('0x3'));var router=express[_0x8e8b('0x4')]();var fs_extra=require(_0x8e8b('0x5'));var auth=require(_0x8e8b('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x8e8b('0x7'));router[_0x8e8b('0x8')](_0x8e8b('0x9'),auth['isAuthenticated'](),controller[_0x8e8b('0xa')]);router[_0x8e8b('0xb')]('/',auth[_0x8e8b('0xc')](),controller['create']);router[_0x8e8b('0xd')]('/:id',auth[_0x8e8b('0xc')](),controller[_0x8e8b('0xe')]);router[_0x8e8b('0xf')](_0x8e8b('0x9'),auth[_0x8e8b('0xc')](),controller[_0x8e8b('0x10')]);module['exports']=router; \ No newline at end of file +var _0xf9a5=['../../components/interaction/service','../../config/environment','./dashboardItem.controller','isAuthenticated','post','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra'];(function(_0x5cb58e,_0x58e675){var _0x5c703e=function(_0x1c2cd4){while(--_0x1c2cd4){_0x5cb58e['push'](_0x5cb58e['shift']());}};_0x5c703e(++_0x58e675);}(_0xf9a5,0x170));var _0x5f9a=function(_0x5685f7,_0x53e368){_0x5685f7=_0x5685f7-0x0;var _0x446dab=_0xf9a5[_0x5685f7];return _0x446dab;};'use strict';var multer=require(_0x5f9a('0x0'));var util=require(_0x5f9a('0x1'));var path=require(_0x5f9a('0x2'));var timeout=require(_0x5f9a('0x3'));var express=require(_0x5f9a('0x4'));var router=express['Router']();var fs_extra=require(_0x5f9a('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x5f9a('0x6'));var config=require(_0x5f9a('0x7'));var controller=require(_0x5f9a('0x8'));router['get']('/:id',auth[_0x5f9a('0x9')](),controller['show']);router[_0x5f9a('0xa')]('/',auth[_0x5f9a('0x9')](),controller['create']);router[_0x5f9a('0xb')](_0x5f9a('0xc'),auth[_0x5f9a('0x9')](),controller[_0x5f9a('0xd')]);router[_0x5f9a('0xe')]('/:id',auth[_0x5f9a('0x9')](),controller[_0x5f9a('0xf')]);module[_0x5f9a('0x10')]=router; \ No newline at end of file diff --git a/server/api/disposition/disposition.attributes.js b/server/api/disposition/disposition.attributes.js index d6da946..9ab4453 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 _0xa25b=['first','second','third','sequelize','exports','STRING'];(function(_0x1a3984,_0x492a1d){var _0x386311=function(_0x124884){while(--_0x124884){_0x1a3984['push'](_0x1a3984['shift']());}};_0x386311(++_0x492a1d);}(_0xa25b,0x1b9));var _0xba25=function(_0x5edb6d,_0x263f4b){_0x5edb6d=_0x5edb6d-0x0;var _0x1d2ae2=_0xa25b[_0x5edb6d];return _0x1d2ae2;};'use strict';var Sequelize=require(_0xba25('0x0'));module[_0xba25('0x1')]={'name':{'type':Sequelize[_0xba25('0x2')],'allowNull':![]},'level':{'type':Sequelize['ENUM'](_0xba25('0x3'),_0xba25('0x4'),_0xba25('0x5')),'allowNull':![],'defaultValue':_0xba25('0x3')},'description':{'type':Sequelize[_0xba25('0x2')]}}; \ No newline at end of file +var _0xa7ef=['STRING','ENUM','first','second','sequelize','exports'];(function(_0x54f353,_0x478ad0){var _0x1efc86=function(_0x1956b7){while(--_0x1956b7){_0x54f353['push'](_0x54f353['shift']());}};_0x1efc86(++_0x478ad0);}(_0xa7ef,0x14e));var _0xfa7e=function(_0x4839d8,_0x4803cb){_0x4839d8=_0x4839d8-0x0;var _0x144326=_0xa7ef[_0x4839d8];return _0x144326;};'use strict';var Sequelize=require(_0xfa7e('0x0'));module[_0xfa7e('0x1')]={'name':{'type':Sequelize[_0xfa7e('0x2')],'allowNull':![]},'level':{'type':Sequelize[_0xfa7e('0x3')](_0xfa7e('0x4'),_0xfa7e('0x5'),'third'),'allowNull':![],'defaultValue':_0xfa7e('0x4')},'description':{'type':Sequelize[_0xfa7e('0x2')]}}; \ No newline at end of file diff --git a/server/api/disposition/disposition.controller.js b/server/api/disposition/disposition.controller.js index 588ecfb..a6d826f 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 _0xd819=['save','update','then','destroy','get','Dispositions','UserProfileResource','sendStatus','error','stack','name','send','index','map','Disposition','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','catch','show','options','find','create','body','user','role','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject'];(function(_0xc7348b,_0x145880){var _0x307cec=function(_0x4f1554){while(--_0x4f1554){_0xc7348b['push'](_0xc7348b['shift']());}};_0x307cec(++_0x145880);}(_0xd819,0x181));var _0x9d81=function(_0x112929,_0x7da466){_0x112929=_0x112929-0x0;var _0x333c16=_0xd819[_0x112929];return _0x333c16;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9d81('0x0'));var zipdir=require(_0x9d81('0x1'));var jsonpatch=require(_0x9d81('0x2'));var rp=require(_0x9d81('0x3'));var moment=require('moment');var BPromise=require(_0x9d81('0x4'));var Mustache=require('mustache');var util=require(_0x9d81('0x5'));var path=require('path');var sox=require(_0x9d81('0x6'));var csv=require(_0x9d81('0x7'));var ejs=require(_0x9d81('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x9d81('0x9'));var squel=require(_0x9d81('0xa'));var crypto=require(_0x9d81('0xb'));var jsforce=require(_0x9d81('0xc'));var deskjs=require(_0x9d81('0xd'));var toCsv=require(_0x9d81('0x7'));var querystring=require(_0x9d81('0xe'));var Papa=require(_0x9d81('0xf'));var Redis=require(_0x9d81('0x10'));var authService=require(_0x9d81('0x11'));var qs=require(_0x9d81('0x12'));var as=require(_0x9d81('0x13'));var hardwareService=require(_0x9d81('0x14'));var logger=require(_0x9d81('0x15'))('api');var utils=require(_0x9d81('0x16'));var config=require(_0x9d81('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x9d81('0x18'))['db'];function respondWithStatusCode(_0x3fb6b5,_0x18a3fc){_0x18a3fc=_0x18a3fc||0xcc;return function(_0x25b9e8){if(_0x25b9e8){return _0x3fb6b5['sendStatus'](_0x18a3fc);}return _0x3fb6b5[_0x9d81('0x19')](_0x18a3fc)['end']();};}function respondWithResult(_0x228553,_0x59cc99){_0x59cc99=_0x59cc99||0xc8;return function(_0x21508a){if(_0x21508a){return _0x228553[_0x9d81('0x19')](_0x59cc99)['json'](_0x21508a);}};}function respondWithFilteredResult(_0x3caeb8,_0x436d33){return function(_0x2ba83e){if(_0x2ba83e){var _0x20ee18=typeof _0x436d33[_0x9d81('0x1a')]===_0x9d81('0x1b')&&typeof _0x436d33[_0x9d81('0x1c')]===_0x9d81('0x1b');var _0x5bc816=_0x2ba83e[_0x9d81('0x1d')];var _0x1bb0d7=_0x20ee18?0x0:_0x436d33[_0x9d81('0x1a')];var _0x406588=_0x20ee18?_0x2ba83e[_0x9d81('0x1d')]:_0x436d33['offset']+_0x436d33['limit'];var _0x2879ad;if(_0x406588>=_0x5bc816){_0x406588=_0x5bc816;_0x2879ad=0xc8;}else{_0x2879ad=0xce;}_0x3caeb8[_0x9d81('0x19')](_0x2879ad);return _0x3caeb8[_0x9d81('0x1e')](_0x9d81('0x1f'),_0x1bb0d7+'-'+_0x406588+'/'+_0x5bc816)[_0x9d81('0x20')](_0x2ba83e);}return null;};}function patchUpdates(_0x175d4f){return function(_0x1c4cd8){try{jsonpatch[_0x9d81('0x21')](_0x1c4cd8,_0x175d4f,!![]);}catch(_0x291249){return BPromise[_0x9d81('0x22')](_0x291249);}return _0x1c4cd8[_0x9d81('0x23')]();};}function saveUpdates(_0xd7d5cf,_0x7c5c52){return function(_0x4a9c9c){if(_0x4a9c9c){return _0x4a9c9c[_0x9d81('0x24')](_0xd7d5cf)[_0x9d81('0x25')](function(_0x2ebd66){return _0x2ebd66;});}return null;};}function removeEntity(_0x466454,_0x46d0b5){return function(_0x12a1e4){if(_0x12a1e4){return _0x12a1e4[_0x9d81('0x26')]()[_0x9d81('0x25')](function(){var _0x56fcd7=_0x12a1e4[_0x9d81('0x27')]({'plain':!![]});var _0xcb0df5=_0x9d81('0x28');return db[_0x9d81('0x29')]['destroy']({'where':{'type':_0xcb0df5,'resourceId':_0x56fcd7['id']}})[_0x9d81('0x25')](function(){return _0x12a1e4;});})['then'](function(){_0x466454[_0x9d81('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3835b5,_0x5cba30){return function(_0x3f44c0){if(!_0x3f44c0){_0x3835b5[_0x9d81('0x2a')](0x194);}return _0x3f44c0;};}function handleError(_0x1fd874,_0x3ccdbf){_0x3ccdbf=_0x3ccdbf||0x1f4;return function(_0xb82d79){logger[_0x9d81('0x2b')](_0xb82d79[_0x9d81('0x2c')]);if(_0xb82d79[_0x9d81('0x2d')]){delete _0xb82d79[_0x9d81('0x2d')];}_0x1fd874[_0x9d81('0x19')](_0x3ccdbf)[_0x9d81('0x2e')](_0xb82d79);};}exports[_0x9d81('0x2f')]=function(_0x397957,_0x28a5bf){var _0x25a9e0={},_0xe0cf0d={},_0x494226={'count':0x0,'rows':[]};var _0x593041=_[_0x9d81('0x30')](db[_0x9d81('0x31')][_0x9d81('0x32')],function(_0x4e96cc){return{'name':_0x4e96cc[_0x9d81('0x33')],'type':_0x4e96cc[_0x9d81('0x34')][_0x9d81('0x35')]};});_0xe0cf0d['model']=_[_0x9d81('0x30')](_0x593041,_0x9d81('0x2d'));_0xe0cf0d[_0x9d81('0x36')]=_[_0x9d81('0x37')](_0x397957[_0x9d81('0x36')]);_0xe0cf0d[_0x9d81('0x38')]=_[_0x9d81('0x39')](_0xe0cf0d[_0x9d81('0x3a')],_0xe0cf0d[_0x9d81('0x36')]);_0x25a9e0[_0x9d81('0x3b')]=_[_0x9d81('0x39')](_0xe0cf0d[_0x9d81('0x3a')],qs[_0x9d81('0x3c')](_0x397957['query'][_0x9d81('0x3c')]));_0x25a9e0[_0x9d81('0x3b')]=_0x25a9e0[_0x9d81('0x3b')][_0x9d81('0x3d')]?_0x25a9e0[_0x9d81('0x3b')]:_0xe0cf0d['model'];if(!_0x397957[_0x9d81('0x36')][_0x9d81('0x3e')](_0x9d81('0x3f'))){_0x25a9e0[_0x9d81('0x1c')]=qs[_0x9d81('0x1c')](_0x397957[_0x9d81('0x36')][_0x9d81('0x1c')]);_0x25a9e0[_0x9d81('0x1a')]=qs['offset'](_0x397957[_0x9d81('0x36')][_0x9d81('0x1a')]);}_0x25a9e0[_0x9d81('0x40')]=qs['sort'](_0x397957[_0x9d81('0x36')]['sort']);_0x25a9e0[_0x9d81('0x41')]=qs['filters'](_[_0x9d81('0x42')](_0x397957[_0x9d81('0x36')],_0xe0cf0d[_0x9d81('0x38')]),_0x593041);if(_0x397957['query'][_0x9d81('0x43')]){_0x25a9e0[_0x9d81('0x41')]=_[_0x9d81('0x44')](_0x25a9e0[_0x9d81('0x41')],{'$or':_[_0x9d81('0x30')](_0x593041,function(_0x15a3a6){if(_0x15a3a6[_0x9d81('0x34')]!==_0x9d81('0x45')){var _0x4dca21={};_0x4dca21[_0x15a3a6['name']]={'$like':'%'+_0x397957['query'][_0x9d81('0x43')]+'%'};return _0x4dca21;}})});}_0x25a9e0=_[_0x9d81('0x44')]({},_0x25a9e0,_0x397957['options']);var _0x323956={'where':_0x25a9e0[_0x9d81('0x41')]};return db[_0x9d81('0x31')]['count'](_0x323956)[_0x9d81('0x25')](function(_0x1e2ab8){_0x494226[_0x9d81('0x1d')]=_0x1e2ab8;if(_0x397957[_0x9d81('0x36')][_0x9d81('0x46')]){_0x25a9e0[_0x9d81('0x47')]=[{'all':!![]}];}return db[_0x9d81('0x31')][_0x9d81('0x48')](_0x25a9e0);})['then'](function(_0xd37559){_0x494226['rows']=_0xd37559;return _0x494226;})[_0x9d81('0x25')](respondWithFilteredResult(_0x28a5bf,_0x25a9e0))[_0x9d81('0x49')](handleError(_0x28a5bf,null));};exports[_0x9d81('0x4a')]=function(_0x4b7d1e,_0x5975c7){var _0x307391={'raw':!![],'where':{'id':_0x4b7d1e['params']['id']}},_0x41341a={};_0x41341a[_0x9d81('0x3a')]=_[_0x9d81('0x37')](db[_0x9d81('0x31')][_0x9d81('0x32')]);_0x41341a[_0x9d81('0x36')]=_[_0x9d81('0x37')](_0x4b7d1e[_0x9d81('0x36')]);_0x41341a['filters']=_[_0x9d81('0x39')](_0x41341a[_0x9d81('0x3a')],_0x41341a[_0x9d81('0x36')]);_0x307391[_0x9d81('0x3b')]=_['intersection'](_0x41341a[_0x9d81('0x3a')],qs['fields'](_0x4b7d1e[_0x9d81('0x36')][_0x9d81('0x3c')]));_0x307391[_0x9d81('0x3b')]=_0x307391[_0x9d81('0x3b')][_0x9d81('0x3d')]?_0x307391[_0x9d81('0x3b')]:_0x41341a[_0x9d81('0x3a')];if(_0x4b7d1e['query']['includeAll']){_0x307391[_0x9d81('0x47')]=[{'all':!![]}];}_0x307391=_['merge']({},_0x307391,_0x4b7d1e[_0x9d81('0x4b')]);return db[_0x9d81('0x31')][_0x9d81('0x4c')](_0x307391)[_0x9d81('0x25')](handleEntityNotFound(_0x5975c7,null))[_0x9d81('0x25')](respondWithResult(_0x5975c7,null))[_0x9d81('0x49')](handleError(_0x5975c7,null));};exports[_0x9d81('0x4d')]=function(_0x5a1fc3,_0x3692fe){return db[_0x9d81('0x31')]['create'](_0x5a1fc3[_0x9d81('0x4e')],{})['then'](function(_0x4c17b5){var _0x3848ea=_0x5a1fc3[_0x9d81('0x4f')][_0x9d81('0x27')]({'plain':!![]});if(!_0x3848ea)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3848ea[_0x9d81('0x50')]==='user'){var _0x424f06=_0x4c17b5[_0x9d81('0x27')]({'plain':!![]});var _0x37e05a=_0x9d81('0x28');return db['UserProfileSection']['find']({'where':{'name':_0x37e05a,'userProfileId':_0x3848ea['userProfileId']},'raw':!![]})[_0x9d81('0x25')](function(_0x5d8345){if(_0x5d8345&&_0x5d8345[_0x9d81('0x51')]===0x0){return db['UserProfileResource'][_0x9d81('0x4d')]({'name':_0x424f06[_0x9d81('0x2d')],'resourceId':_0x424f06['id'],'type':_0x5d8345[_0x9d81('0x2d')],'sectionId':_0x5d8345['id']},{})[_0x9d81('0x25')](function(){return _0x4c17b5;});}else{return _0x4c17b5;}})[_0x9d81('0x49')](function(_0x4836f7){logger['error'](_0x9d81('0x52'),_0x4836f7);throw _0x4836f7;});}return _0x4c17b5;})['then'](respondWithResult(_0x3692fe,0xc9))['catch'](handleError(_0x3692fe,null));};exports['update']=function(_0x57fc9a,_0x2f6df8){if(_0x57fc9a[_0x9d81('0x4e')]['id']){delete _0x57fc9a[_0x9d81('0x4e')]['id'];}return db[_0x9d81('0x31')]['find']({'where':{'id':_0x57fc9a[_0x9d81('0x53')]['id']}})[_0x9d81('0x25')](handleEntityNotFound(_0x2f6df8,null))[_0x9d81('0x25')](saveUpdates(_0x57fc9a[_0x9d81('0x4e')],null))['then'](respondWithResult(_0x2f6df8,null))[_0x9d81('0x49')](handleError(_0x2f6df8,null));};exports[_0x9d81('0x26')]=function(_0x31bd8e,_0x459c8d){return db['Disposition'][_0x9d81('0x4c')]({'where':{'id':_0x31bd8e[_0x9d81('0x53')]['id']}})[_0x9d81('0x25')](handleEntityNotFound(_0x459c8d,null))[_0x9d81('0x25')](removeEntity(_0x459c8d,null))[_0x9d81('0x49')](handleError(_0x459c8d,null));}; \ No newline at end of file +var _0x9de8=['../../mysqldb','status','json','offset','limit','count','set','Content-Range','apply','reject','save','update','destroy','get','Dispositions','UserProfileResource','then','end','sendStatus','error','stack','name','send','index','Disposition','rawAttributes','type','key','model','map','query','keys','intersection','attributes','fields','length','order','filters','filter','where','VIRTUAL','merge','options','include','findAll','catch','show','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','to-csv','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','../../config/license/util'];(function(_0x3e0fd6,_0x47ef6f){var _0x1b4744=function(_0x5723bd){while(--_0x5723bd){_0x3e0fd6['push'](_0x3e0fd6['shift']());}};_0x1b4744(++_0x47ef6f);}(_0x9de8,0x88));var _0x89de=function(_0x207417,_0x3f96a2){_0x207417=_0x207417-0x0;var _0x1c7975=_0x9de8[_0x207417];return _0x1c7975;};'use strict';var emlformat=require(_0x89de('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x89de('0x1'));var jsonpatch=require(_0x89de('0x2'));var rp=require('request-promise');var moment=require(_0x89de('0x3'));var BPromise=require(_0x89de('0x4'));var Mustache=require(_0x89de('0x5'));var util=require(_0x89de('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x89de('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x89de('0x8'));var crypto=require('crypto');var jsforce=require(_0x89de('0x9'));var deskjs=require(_0x89de('0xa'));var toCsv=require(_0x89de('0x7'));var querystring=require(_0x89de('0xb'));var Papa=require('papaparse');var Redis=require(_0x89de('0xc'));var authService=require(_0x89de('0xd'));var qs=require(_0x89de('0xe'));var as=require(_0x89de('0xf'));var hardwareService=require(_0x89de('0x10'));var logger=require(_0x89de('0x11'))(_0x89de('0x12'));var utils=require(_0x89de('0x13'));var config=require(_0x89de('0x14'));var licenseUtil=require(_0x89de('0x15'));var db=require(_0x89de('0x16'))['db'];function respondWithStatusCode(_0x24a3bf,_0x3261f9){_0x3261f9=_0x3261f9||0xcc;return function(_0x3d02fc){if(_0x3d02fc){return _0x24a3bf['sendStatus'](_0x3261f9);}return _0x24a3bf[_0x89de('0x17')](_0x3261f9)['end']();};}function respondWithResult(_0x3b7ad7,_0x58979f){_0x58979f=_0x58979f||0xc8;return function(_0x186e72){if(_0x186e72){return _0x3b7ad7[_0x89de('0x17')](_0x58979f)[_0x89de('0x18')](_0x186e72);}};}function respondWithFilteredResult(_0x2a607f,_0x17b9e1){return function(_0x32f245){if(_0x32f245){var _0x2ccade=typeof _0x17b9e1[_0x89de('0x19')]==='undefined'&&typeof _0x17b9e1[_0x89de('0x1a')]==='undefined';var _0xe73bb8=_0x32f245[_0x89de('0x1b')];var _0x5c4700=_0x2ccade?0x0:_0x17b9e1['offset'];var _0x4980c2=_0x2ccade?_0x32f245['count']:_0x17b9e1[_0x89de('0x19')]+_0x17b9e1[_0x89de('0x1a')];var _0x498670;if(_0x4980c2>=_0xe73bb8){_0x4980c2=_0xe73bb8;_0x498670=0xc8;}else{_0x498670=0xce;}_0x2a607f[_0x89de('0x17')](_0x498670);return _0x2a607f[_0x89de('0x1c')](_0x89de('0x1d'),_0x5c4700+'-'+_0x4980c2+'/'+_0xe73bb8)[_0x89de('0x18')](_0x32f245);}return null;};}function patchUpdates(_0x4724c2){return function(_0x577536){try{jsonpatch[_0x89de('0x1e')](_0x577536,_0x4724c2,!![]);}catch(_0x5a54b1){return BPromise[_0x89de('0x1f')](_0x5a54b1);}return _0x577536[_0x89de('0x20')]();};}function saveUpdates(_0x2c7594,_0x2dba2e){return function(_0x280322){if(_0x280322){return _0x280322[_0x89de('0x21')](_0x2c7594)['then'](function(_0x3342c3){return _0x3342c3;});}return null;};}function removeEntity(_0x2b50c1,_0x1361a0){return function(_0x4bfbd5){if(_0x4bfbd5){return _0x4bfbd5[_0x89de('0x22')]()['then'](function(){var _0x2a96d0=_0x4bfbd5[_0x89de('0x23')]({'plain':!![]});var _0x1c0adc=_0x89de('0x24');return db[_0x89de('0x25')][_0x89de('0x22')]({'where':{'type':_0x1c0adc,'resourceId':_0x2a96d0['id']}})[_0x89de('0x26')](function(){return _0x4bfbd5;});})[_0x89de('0x26')](function(){_0x2b50c1[_0x89de('0x17')](0xcc)[_0x89de('0x27')]();});}};}function handleEntityNotFound(_0xb68947,_0x1abba7){return function(_0xa5563c){if(!_0xa5563c){_0xb68947[_0x89de('0x28')](0x194);}return _0xa5563c;};}function handleError(_0x38efe7,_0x218ec7){_0x218ec7=_0x218ec7||0x1f4;return function(_0xa18ea6){logger[_0x89de('0x29')](_0xa18ea6[_0x89de('0x2a')]);if(_0xa18ea6['name']){delete _0xa18ea6[_0x89de('0x2b')];}_0x38efe7['status'](_0x218ec7)[_0x89de('0x2c')](_0xa18ea6);};}exports[_0x89de('0x2d')]=function(_0xcbd7bc,_0x4e8c45){var _0x45cb1e={},_0x3eec88={},_0x5753c2={'count':0x0,'rows':[]};var _0x2ac2fb=_['map'](db[_0x89de('0x2e')][_0x89de('0x2f')],function(_0x4445ff){return{'name':_0x4445ff['fieldName'],'type':_0x4445ff[_0x89de('0x30')][_0x89de('0x31')]};});_0x3eec88[_0x89de('0x32')]=_[_0x89de('0x33')](_0x2ac2fb,_0x89de('0x2b'));_0x3eec88[_0x89de('0x34')]=_[_0x89de('0x35')](_0xcbd7bc[_0x89de('0x34')]);_0x3eec88['filters']=_[_0x89de('0x36')](_0x3eec88[_0x89de('0x32')],_0x3eec88['query']);_0x45cb1e[_0x89de('0x37')]=_[_0x89de('0x36')](_0x3eec88['model'],qs[_0x89de('0x38')](_0xcbd7bc[_0x89de('0x34')][_0x89de('0x38')]));_0x45cb1e[_0x89de('0x37')]=_0x45cb1e[_0x89de('0x37')][_0x89de('0x39')]?_0x45cb1e[_0x89de('0x37')]:_0x3eec88[_0x89de('0x32')];if(!_0xcbd7bc[_0x89de('0x34')]['hasOwnProperty']('nolimit')){_0x45cb1e['limit']=qs[_0x89de('0x1a')](_0xcbd7bc[_0x89de('0x34')][_0x89de('0x1a')]);_0x45cb1e[_0x89de('0x19')]=qs[_0x89de('0x19')](_0xcbd7bc[_0x89de('0x34')][_0x89de('0x19')]);}_0x45cb1e[_0x89de('0x3a')]=qs['sort'](_0xcbd7bc['query']['sort']);_0x45cb1e['where']=qs[_0x89de('0x3b')](_['pick'](_0xcbd7bc['query'],_0x3eec88[_0x89de('0x3b')]),_0x2ac2fb);if(_0xcbd7bc[_0x89de('0x34')][_0x89de('0x3c')]){_0x45cb1e[_0x89de('0x3d')]=_['merge'](_0x45cb1e['where'],{'$or':_['map'](_0x2ac2fb,function(_0x26cafa){if(_0x26cafa[_0x89de('0x30')]!==_0x89de('0x3e')){var _0xa8572={};_0xa8572[_0x26cafa['name']]={'$like':'%'+_0xcbd7bc[_0x89de('0x34')][_0x89de('0x3c')]+'%'};return _0xa8572;}})});}_0x45cb1e=_[_0x89de('0x3f')]({},_0x45cb1e,_0xcbd7bc[_0x89de('0x40')]);var _0x40cc2f={'where':_0x45cb1e['where']};return db[_0x89de('0x2e')][_0x89de('0x1b')](_0x40cc2f)['then'](function(_0x4eb062){_0x5753c2[_0x89de('0x1b')]=_0x4eb062;if(_0xcbd7bc[_0x89de('0x34')]['includeAll']){_0x45cb1e[_0x89de('0x41')]=[{'all':!![]}];}return db[_0x89de('0x2e')][_0x89de('0x42')](_0x45cb1e);})['then'](function(_0x36476c){_0x5753c2['rows']=_0x36476c;return _0x5753c2;})['then'](respondWithFilteredResult(_0x4e8c45,_0x45cb1e))[_0x89de('0x43')](handleError(_0x4e8c45,null));};exports[_0x89de('0x44')]=function(_0x50d9e5,_0x53ab6c){var _0x2d2778={'raw':!![],'where':{'id':_0x50d9e5['params']['id']}},_0x411627={};_0x411627[_0x89de('0x32')]=_[_0x89de('0x35')](db['Disposition'][_0x89de('0x2f')]);_0x411627[_0x89de('0x34')]=_[_0x89de('0x35')](_0x50d9e5[_0x89de('0x34')]);_0x411627[_0x89de('0x3b')]=_[_0x89de('0x36')](_0x411627[_0x89de('0x32')],_0x411627[_0x89de('0x34')]);_0x2d2778['attributes']=_[_0x89de('0x36')](_0x411627[_0x89de('0x32')],qs[_0x89de('0x38')](_0x50d9e5[_0x89de('0x34')][_0x89de('0x38')]));_0x2d2778[_0x89de('0x37')]=_0x2d2778['attributes'][_0x89de('0x39')]?_0x2d2778['attributes']:_0x411627[_0x89de('0x32')];if(_0x50d9e5[_0x89de('0x34')][_0x89de('0x45')]){_0x2d2778['include']=[{'all':!![]}];}_0x2d2778=_[_0x89de('0x3f')]({},_0x2d2778,_0x50d9e5[_0x89de('0x40')]);return db['Disposition'][_0x89de('0x46')](_0x2d2778)['then'](handleEntityNotFound(_0x53ab6c,null))[_0x89de('0x26')](respondWithResult(_0x53ab6c,null))[_0x89de('0x43')](handleError(_0x53ab6c,null));};exports[_0x89de('0x47')]=function(_0x1d6b32,_0x9476c1){return db[_0x89de('0x2e')][_0x89de('0x47')](_0x1d6b32[_0x89de('0x48')],{})[_0x89de('0x26')](function(_0x492a54){var _0x49f84f=_0x1d6b32[_0x89de('0x49')][_0x89de('0x23')]({'plain':!![]});if(!_0x49f84f)throw new Error(_0x89de('0x4a'));if(_0x49f84f[_0x89de('0x4b')]==='user'){var _0x390571=_0x492a54[_0x89de('0x23')]({'plain':!![]});var _0x40096a='Dispositions';return db['UserProfileSection']['find']({'where':{'name':_0x40096a,'userProfileId':_0x49f84f['userProfileId']},'raw':!![]})['then'](function(_0x388058){if(_0x388058&&_0x388058[_0x89de('0x4c')]===0x0){return db[_0x89de('0x25')][_0x89de('0x47')]({'name':_0x390571[_0x89de('0x2b')],'resourceId':_0x390571['id'],'type':_0x388058[_0x89de('0x2b')],'sectionId':_0x388058['id']},{})[_0x89de('0x26')](function(){return _0x492a54;});}else{return _0x492a54;}})[_0x89de('0x43')](function(_0x5a9f84){logger[_0x89de('0x29')](_0x89de('0x4d'),_0x5a9f84);throw _0x5a9f84;});}return _0x492a54;})[_0x89de('0x26')](respondWithResult(_0x9476c1,0xc9))[_0x89de('0x43')](handleError(_0x9476c1,null));};exports[_0x89de('0x21')]=function(_0x2a96c4,_0xed7cc9){if(_0x2a96c4[_0x89de('0x48')]['id']){delete _0x2a96c4[_0x89de('0x48')]['id'];}return db[_0x89de('0x2e')][_0x89de('0x46')]({'where':{'id':_0x2a96c4[_0x89de('0x4e')]['id']}})[_0x89de('0x26')](handleEntityNotFound(_0xed7cc9,null))[_0x89de('0x26')](saveUpdates(_0x2a96c4[_0x89de('0x48')],null))['then'](respondWithResult(_0xed7cc9,null))[_0x89de('0x43')](handleError(_0xed7cc9,null));};exports[_0x89de('0x22')]=function(_0x75c1e8,_0x203661){return db[_0x89de('0x2e')][_0x89de('0x46')]({'where':{'id':_0x75c1e8[_0x89de('0x4e')]['id']}})[_0x89de('0x26')](handleEntityNotFound(_0x203661,null))['then'](removeEntity(_0x203661,null))['catch'](handleError(_0x203661,null));}; \ No newline at end of file diff --git a/server/api/disposition/disposition.model.js b/server/api/disposition/disposition.model.js index 7a31c93..56c0199 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 _0x1e05=['name_voice','name_chat','name','name_fax','FaxAccountId','name_openchannel','OpenchannelAccountId','WhatsappAccountId','lodash','util','moment','bluebird','request-promise','path','../../config/environment','./disposition.attributes','exports','define'];(function(_0x44d91f,_0x2c589d){var _0x5b5c39=function(_0x3bffa2){while(--_0x3bffa2){_0x44d91f['push'](_0x44d91f['shift']());}};_0x5b5c39(++_0x2c589d);}(_0x1e05,0x170));var _0x51e0=function(_0x819464,_0x46fc91){_0x819464=_0x819464-0x0;var _0x49dcc0=_0x1e05[_0x819464];return _0x49dcc0;};'use strict';var _=require(_0x51e0('0x0'));var util=require(_0x51e0('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x51e0('0x2'));var BPromise=require(_0x51e0('0x3'));var rp=require(_0x51e0('0x4'));var fs=require('fs');var path=require(_0x51e0('0x5'));var rimraf=require('rimraf');var config=require(_0x51e0('0x6'));var attributes=require(_0x51e0('0x7'));module[_0x51e0('0x8')]=function(_0x3c4a14,_0x367c9f){return _0x3c4a14[_0x51e0('0x9')]('Disposition',attributes,{'tableName':'tools_dispositions','paranoid':![],'indexes':[{'unique':!![],'name':_0x51e0('0xa'),'fields':['name','ListId']},{'unique':!![],'name':_0x51e0('0xb'),'fields':[_0x51e0('0xc'),'ChatWebsiteId']},{'unique':!![],'name':'name_mail','fields':[_0x51e0('0xc'),'MailAccountId']},{'unique':!![],'name':'name_sms','fields':[_0x51e0('0xc'),'SmsAccountId']},{'unique':!![],'name':_0x51e0('0xd'),'fields':[_0x51e0('0xc'),_0x51e0('0xe')]},{'unique':!![],'name':_0x51e0('0xf'),'fields':[_0x51e0('0xc'),_0x51e0('0x10')]},{'unique':!![],'name':'name_whatsapp','fields':[_0x51e0('0xc'),_0x51e0('0x11')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x63f3=['name','ListId','name_chat','MailAccountId','name_sms','name_fax','name_openchannel','OpenchannelAccountId','name_whatsapp','lodash','../../config/logger','api','moment','request-promise','rimraf','./disposition.attributes','exports','define','Disposition','name_voice'];(function(_0x2499af,_0xcd4a1){var _0x442775=function(_0x318603){while(--_0x318603){_0x2499af['push'](_0x2499af['shift']());}};_0x442775(++_0xcd4a1);}(_0x63f3,0x199));var _0x363f=function(_0x264545,_0x214037){_0x264545=_0x264545-0x0;var _0x114d10=_0x63f3[_0x264545];return _0x114d10;};'use strict';var _=require(_0x363f('0x0'));var util=require('util');var logger=require(_0x363f('0x1'))(_0x363f('0x2'));var moment=require(_0x363f('0x3'));var BPromise=require('bluebird');var rp=require(_0x363f('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x363f('0x5'));var config=require('../../config/environment');var attributes=require(_0x363f('0x6'));module[_0x363f('0x7')]=function(_0x2fc9ea,_0x358c0e){return _0x2fc9ea[_0x363f('0x8')](_0x363f('0x9'),attributes,{'tableName':'tools_dispositions','paranoid':![],'indexes':[{'unique':!![],'name':_0x363f('0xa'),'fields':[_0x363f('0xb'),_0x363f('0xc')]},{'unique':!![],'name':_0x363f('0xd'),'fields':[_0x363f('0xb'),'ChatWebsiteId']},{'unique':!![],'name':'name_mail','fields':[_0x363f('0xb'),_0x363f('0xe')]},{'unique':!![],'name':_0x363f('0xf'),'fields':[_0x363f('0xb'),'SmsAccountId']},{'unique':!![],'name':_0x363f('0x10'),'fields':[_0x363f('0xb'),'FaxAccountId']},{'unique':!![],'name':_0x363f('0x11'),'fields':['name',_0x363f('0x12')]},{'unique':!![],'name':_0x363f('0x13'),'fields':['name','WhatsappAccountId']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/disposition/disposition.rpc.js b/server/api/disposition/disposition.rpc.js index 6ac19b9..3c42202 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(_0x587e1a,_0x28697c){var _0x4add8f=function(_0x518a8b){while(--_0x518a8b){_0x587e1a['push'](_0x587e1a['shift']());}};_0x4add8f(++_0x28697c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5b78e8,_0x55096b){_0x5b78e8=_0x5b78e8-0x0;var _0xf2c321=_0xa9e0[_0x5b78e8];return _0xf2c321;};'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(_0x29a9cb,_0x443012){var _0x317f12=function(_0x119c51){while(--_0x119c51){_0x29a9cb['push'](_0x29a9cb['shift']());}};_0x317f12(++_0x443012);}(_0xa9e0,0x123));var _0x0a9e=function(_0x491a7f,_0x28bb80){_0x491a7f=_0x491a7f-0x0;var _0x3d8f44=_0xa9e0[_0x491a7f];return _0x3d8f44;};'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 bbc14a5..3f1d60f 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 _0x6b21=['get','/:id','show','create','put','isAuthenticated','update','delete','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./disposition.controller'];(function(_0x21f88f,_0x48cfba){var _0x3b9ff5=function(_0x292aee){while(--_0x292aee){_0x21f88f['push'](_0x21f88f['shift']());}};_0x3b9ff5(++_0x48cfba);}(_0x6b21,0x75));var _0x16b2=function(_0x2a1bf8,_0x27987d){_0x2a1bf8=_0x2a1bf8-0x0;var _0x4f578d=_0x6b21[_0x2a1bf8];return _0x4f578d;};'use strict';var multer=require(_0x16b2('0x0'));var util=require(_0x16b2('0x1'));var path=require(_0x16b2('0x2'));var timeout=require(_0x16b2('0x3'));var express=require('express');var router=express[_0x16b2('0x4')]();var fs_extra=require(_0x16b2('0x5'));var auth=require(_0x16b2('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x16b2('0x7'));var controller=require(_0x16b2('0x8'));router[_0x16b2('0x9')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x16b2('0xa'),auth['isAuthenticated'](),controller[_0x16b2('0xb')]);router['post']('/',auth['isAuthenticated'](),controller[_0x16b2('0xc')]);router[_0x16b2('0xd')](_0x16b2('0xa'),auth[_0x16b2('0xe')](),controller[_0x16b2('0xf')]);router[_0x16b2('0x10')](_0x16b2('0xa'),auth[_0x16b2('0xe')](),controller['destroy']);module[_0x16b2('0x11')]=router; \ No newline at end of file +var _0x6fe5=['put','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./disposition.controller','isAuthenticated','index','/:id','show','post','create'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6fe5,0x1c2));var _0x56fe=function(_0x102062,_0x48ed6d){_0x102062=_0x102062-0x0;var _0x3a22db=_0x6fe5[_0x102062];return _0x3a22db;};'use strict';var multer=require('multer');var util=require(_0x56fe('0x0'));var path=require(_0x56fe('0x1'));var timeout=require(_0x56fe('0x2'));var express=require(_0x56fe('0x3'));var router=express[_0x56fe('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x56fe('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x56fe('0x6'));var controller=require(_0x56fe('0x7'));router['get']('/',auth[_0x56fe('0x8')](),controller[_0x56fe('0x9')]);router['get'](_0x56fe('0xa'),auth['isAuthenticated'](),controller[_0x56fe('0xb')]);router[_0x56fe('0xc')]('/',auth[_0x56fe('0x8')](),controller[_0x56fe('0xd')]);router[_0x56fe('0xe')](_0x56fe('0xa'),auth['isAuthenticated'](),controller['update']);router['delete'](_0x56fe('0xa'),auth[_0x56fe('0x8')](),controller['destroy']);module[_0x56fe('0xf')]=router; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.attributes.js b/server/api/faxAccount/faxAccount.attributes.js index e3cf075..b8c00c6 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 _0xc6a7=['9600','14400','4800','7200','12000','v17,v27,v29','INTEGER','SIP','KHOMP','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','STRING','ENUM','yes','2400'];(function(_0x1969a7,_0x5a133a){var _0x3d665f=function(_0x39c64b){while(--_0x39c64b){_0x1969a7['push'](_0x1969a7['shift']());}};_0x3d665f(++_0x5a133a);}(_0xc6a7,0x8f));var _0x7c6a=function(_0x4e7d25,_0x58285f){_0x4e7d25=_0x4e7d25-0x0;var _0x526fe6=_0xc6a7[_0x4e7d25];return _0x526fe6;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x7c6a('0x0')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x7c6a('0x0')]},'ecm':{'type':Sequelize[_0x7c6a('0x1')]('yes','no'),'defaultValue':_0x7c6a('0x2')},'headerinfo':{'type':Sequelize[_0x7c6a('0x0')],'defaultValue':'xCALLY\x20Motion\x20Fax'},'localstationid':{'type':Sequelize[_0x7c6a('0x0')],'unique':'localstationid'},'minrate':{'type':Sequelize['ENUM'](_0x7c6a('0x3'),'4800','7200',_0x7c6a('0x4'),'12000',_0x7c6a('0x5')),'defaultValue':_0x7c6a('0x6')},'maxrate':{'type':Sequelize[_0x7c6a('0x1')](_0x7c6a('0x3'),_0x7c6a('0x6'),_0x7c6a('0x7'),_0x7c6a('0x4'),_0x7c6a('0x8'),'14400'),'defaultValue':_0x7c6a('0x5')},'modem':{'type':Sequelize[_0x7c6a('0x0')],'defaultValue':_0x7c6a('0x9')},'gateway':{'type':Sequelize[_0x7c6a('0x0')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0x7c6a('0x0')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0x7c6a('0xa')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0x7c6a('0x1')](_0x7c6a('0xb'),'IAX','DADHI',_0x7c6a('0xc')),'defaultValue':_0x7c6a('0xb')},'key':{'type':Sequelize[_0x7c6a('0x0')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x7c6a('0xd')],'defaultValue':function(){return _0x7c6a('0xe');}},'notificationSound':{'type':Sequelize[_0x7c6a('0xf')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x7c6a('0xf')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x7c6a('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x7c6a('0xf')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x7c6a('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x7c6a('0xf')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x7c6a('0xa')],'allowNull':!![],'defaultValue':null,'comment':_0x7c6a('0x10')},'mandatoryDisposition':{'type':Sequelize[_0x7c6a('0xf')],'defaultValue':![],'comment':_0x7c6a('0x11'),'set':function(_0x1a6b98){if(!_0x1a6b98)this[_0x7c6a('0x12')](_0x7c6a('0x13'),null);this['setDataValue'](_0x7c6a('0x14'),_0x1a6b98);}}}; \ No newline at end of file +var _0x152e=['12000','14400','v17,v27,v29','INTEGER','SIP','DADHI','KHOMP','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','setDataValue','mandatoryDisposition','sequelize','exports','STRING','xCALLY\x20Motion\x20Fax','localstationid','ENUM','4800','7200','9600'];(function(_0x243b59,_0x3f9495){var _0x3e1676=function(_0x354052){while(--_0x354052){_0x243b59['push'](_0x243b59['shift']());}};_0x3e1676(++_0x3f9495);}(_0x152e,0x199));var _0xe152=function(_0x88fab1,_0x1accff){_0x88fab1=_0x88fab1-0x0;var _0x20c571=_0x152e[_0x88fab1];return _0x20c571;};'use strict';var Sequelize=require(_0xe152('0x0'));module[_0xe152('0x1')]={'name':{'type':Sequelize[_0xe152('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']},'ecm':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'yes'},'headerinfo':{'type':Sequelize['STRING'],'defaultValue':_0xe152('0x3')},'localstationid':{'type':Sequelize['STRING'],'unique':_0xe152('0x4')},'minrate':{'type':Sequelize[_0xe152('0x5')]('2400',_0xe152('0x6'),_0xe152('0x7'),_0xe152('0x8'),_0xe152('0x9'),_0xe152('0xa')),'defaultValue':_0xe152('0x6')},'maxrate':{'type':Sequelize[_0xe152('0x5')]('2400',_0xe152('0x6'),_0xe152('0x7'),_0xe152('0x8'),'12000',_0xe152('0xa')),'defaultValue':'14400'},'modem':{'type':Sequelize[_0xe152('0x2')],'defaultValue':_0xe152('0xb')},'gateway':{'type':Sequelize[_0xe152('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize['STRING'],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0xe152('0xc')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0xe152('0x5')](_0xe152('0xd'),'IAX',_0xe152('0xe'),_0xe152('0xf')),'defaultValue':_0xe152('0xd')},'key':{'type':Sequelize[_0xe152('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0xe152('0x10')],'defaultValue':function(){return _0xe152('0x11');}},'notificationSound':{'type':Sequelize[_0xe152('0x12')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xe152('0x12')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xe152('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xe152('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xe152('0x12')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xe152('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xe152('0xc')],'allowNull':!![],'defaultValue':null,'comment':_0xe152('0x13')},'mandatoryDisposition':{'type':Sequelize[_0xe152('0x12')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x2ce2db){if(!_0x2ce2db)this[_0xe152('0x14')]('mandatoryDispositionPauseId',null);this[_0xe152('0x14')](_0xe152('0x15'),_0x2ce2db);}}}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.controller.js b/server/api/faxAccount/faxAccount.controller.js index 9608860..9eb92c4 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 _0x615e=['Wait','/var/opt/motion2/server/files/attachments/fax-${CALLERID(num)}-${CUT(UNIQUEID,.,1)}-${CUT(UNIQUEID,.,2)}-${STRFTIME(,,%C%y%m%d%H%M%S)}-rx.tif,d','ReceiveFax','addAccountApplications','VoiceExtension','tech','key','createdAt','updatedAt','TrunkId','ListId','findById','getMessages','FaxMessage','$gte','format','CmList','List','attachments','join','server/files/attachments','basename','isNil','path','from','\x22%s\x22\x20<%s>','Contacts','List\x20not\x20found','Send\x20Fax\x20failed','out','filename','Messages','Contact\x20not\x20found','spread','ContactId','dataValues','SendFax','SendFaxRpc,\x20%s','addAgents','ids','userFaxAccount:save','removeAgents','isArray','emit','userFaxAccount:remove','getAgents','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./faxAccount.socket','register','jayson/promise','client','http','request','then','info','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','FaxAccount,\x20%s,\x20%s','result','catch','status','end','json','offset','undefined','limit','set','apply','reject','destroy','get','FaxAccounts','UserProfileResource','stack','name','send','Pause','map','FaxAccount','rawAttributes','fieldName','type','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','count','includeAll','include','findAll','rows','show','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','addDisposition','FaxAccountId','Disposition','options','removeDispositions','CannedAnswer','getAnswers','findOne','removeAnswers','addInteraction','omit','getInteractions','FaxInteraction','CmContact','User','Owner','Tag','Tags','tag','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','bulkCreate','FaxApplication','findAndCountAll','priority','finally','sendStatus','getApplications','pick','context','from-voip-provider','exten','localstationid','system','description','push','Answer','CDR(type)=inbound-fax','Set','faxdetect','minrate','modem','t38timeout','FAXOPT('];(function(_0x128e39,_0x187361){var _0x40141f=function(_0x4eceb9){while(--_0x4eceb9){_0x128e39['push'](_0x128e39['shift']());}};_0x40141f(++_0x187361);}(_0x615e,0xee));var _0xe615=function(_0x17e83c,_0x58c63f){_0x17e83c=_0x17e83c-0x0;var _0x3b16d3=_0x615e[_0x17e83c];return _0x3b16d3;};'use strict';var emlformat=require(_0xe615('0x0'));var rimraf=require(_0xe615('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe615('0x2'));var rp=require(_0xe615('0x3'));var moment=require(_0xe615('0x4'));var BPromise=require(_0xe615('0x5'));var Mustache=require(_0xe615('0x6'));var util=require(_0xe615('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0xe615('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe615('0x9'));var _=require(_0xe615('0xa'));var squel=require(_0xe615('0xb'));var crypto=require(_0xe615('0xc'));var jsforce=require(_0xe615('0xd'));var deskjs=require(_0xe615('0xe'));var toCsv=require(_0xe615('0x8'));var querystring=require(_0xe615('0xf'));var Papa=require('papaparse');var Redis=require(_0xe615('0x10'));var authService=require(_0xe615('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xe615('0x12'));var hardwareService=require(_0xe615('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0xe615('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xe615('0x15'));var db=require(_0xe615('0x16'))['db'];config[_0xe615('0x17')]=_[_0xe615('0x18')](config[_0xe615('0x17')],{'host':'localhost','port':0x18eb});var socket=require(_0xe615('0x19'))(new Redis(config['redis']));require(_0xe615('0x1a'))[_0xe615('0x1b')](socket);var jayson=require(_0xe615('0x1c'));var client=jayson[_0xe615('0x1d')][_0xe615('0x1e')]({'port':0x232c});var client9002=jayson[_0xe615('0x1d')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2e843f,_0x3ef98b,_0x54f770,_0x2348e9){return new BPromise(function(_0x422766,_0x1171fa){var _0x584cc1=_0x2348e9||client;return _0x584cc1[_0xe615('0x1f')](_0x2e843f,_0x54f770)[_0xe615('0x20')](function(_0x353010){logger[_0xe615('0x21')]('FaxAccount,\x20%s,\x20%s',_0x3ef98b,_0xe615('0x22'));logger[_0xe615('0x23')](_0xe615('0x24'),_0x3ef98b,'request\x20sent',JSON[_0xe615('0x25')](_0x353010));if(_0x353010[_0xe615('0x26')]){if(_0x353010[_0xe615('0x26')][_0xe615('0x27')]===0x1f4){logger['error']('FaxAccount,\x20%s,\x20%s',_0x3ef98b,_0x353010['error']['message']);return _0x1171fa(_0x353010['error'][_0xe615('0x28')]);}logger[_0xe615('0x26')](_0xe615('0x29'),_0x3ef98b,_0x353010['error'][_0xe615('0x28')]);return _0x422766(_0x353010[_0xe615('0x26')][_0xe615('0x28')]);}else{logger[_0xe615('0x21')]('FaxAccount,\x20%s,\x20%s',_0x3ef98b,_0xe615('0x22'));_0x422766(_0x353010[_0xe615('0x2a')][_0xe615('0x28')]);}})[_0xe615('0x2b')](function(_0x339f25){logger[_0xe615('0x26')](_0xe615('0x29'),_0x3ef98b,_0x339f25);_0x1171fa(_0x339f25);});});}function respondWithStatusCode(_0x4ee367,_0x539be5){_0x539be5=_0x539be5||0xcc;return function(_0x581c35){if(_0x581c35){return _0x4ee367['sendStatus'](_0x539be5);}return _0x4ee367[_0xe615('0x2c')](_0x539be5)[_0xe615('0x2d')]();};}function respondWithResult(_0x3d5648,_0x4a378a){_0x4a378a=_0x4a378a||0xc8;return function(_0x426621){if(_0x426621){return _0x3d5648['status'](_0x4a378a)[_0xe615('0x2e')](_0x426621);}};}function respondWithFilteredResult(_0x2159ac,_0x24da41){return function(_0x43c91d){if(_0x43c91d){var _0x5895ac=typeof _0x24da41[_0xe615('0x2f')]===_0xe615('0x30')&&typeof _0x24da41[_0xe615('0x31')]===_0xe615('0x30');var _0x3af74d=_0x43c91d['count'];var _0xa995ca=_0x5895ac?0x0:_0x24da41['offset'];var _0x3e59cf=_0x5895ac?_0x43c91d['count']:_0x24da41['offset']+_0x24da41[_0xe615('0x31')];var _0x1a5c54;if(_0x3e59cf>=_0x3af74d){_0x3e59cf=_0x3af74d;_0x1a5c54=0xc8;}else{_0x1a5c54=0xce;}_0x2159ac[_0xe615('0x2c')](_0x1a5c54);return _0x2159ac[_0xe615('0x32')]('Content-Range',_0xa995ca+'-'+_0x3e59cf+'/'+_0x3af74d)[_0xe615('0x2e')](_0x43c91d);}return null;};}function patchUpdates(_0x4117f9){return function(_0x1c3447){try{jsonpatch[_0xe615('0x33')](_0x1c3447,_0x4117f9,!![]);}catch(_0x17b86f){return BPromise[_0xe615('0x34')](_0x17b86f);}return _0x1c3447['save']();};}function saveUpdates(_0xe1e201,_0x434b59){return function(_0x5a65ed){if(_0x5a65ed){return _0x5a65ed['update'](_0xe1e201)[_0xe615('0x20')](function(_0x5bbeeb){return _0x5bbeeb;});}return null;};}function removeEntity(_0x3ef6c7,_0x25ab1f){return function(_0x2747eb){if(_0x2747eb){return _0x2747eb[_0xe615('0x35')]()[_0xe615('0x20')](function(){var _0x7c2666=_0x2747eb[_0xe615('0x36')]({'plain':!![]});var _0x27992e=_0xe615('0x37');return db[_0xe615('0x38')][_0xe615('0x35')]({'where':{'type':_0x27992e,'resourceId':_0x7c2666['id']}})[_0xe615('0x20')](function(){return _0x2747eb;});})[_0xe615('0x20')](function(){_0x3ef6c7[_0xe615('0x2c')](0xcc)[_0xe615('0x2d')]();});}};}function handleEntityNotFound(_0x4d64c7,_0x1eb71e){return function(_0x58d00e){if(!_0x58d00e){_0x4d64c7['sendStatus'](0x194);}return _0x58d00e;};}function handleError(_0x1c0311,_0x4ced51){_0x4ced51=_0x4ced51||0x1f4;return function(_0x12c5a8){logger[_0xe615('0x26')](_0x12c5a8[_0xe615('0x39')]);if(_0x12c5a8[_0xe615('0x3a')]){delete _0x12c5a8[_0xe615('0x3a')];}_0x1c0311[_0xe615('0x2c')](_0x4ced51)[_0xe615('0x3b')](_0x12c5a8);};}exports['index']=function(_0x452b5d,_0xdf9509){var _0x5b138c={'include':[{'model':db[_0xe615('0x3c')],'as':'mandatoryDispositionPause'}]},_0x3ec4a8={},_0x323404={'count':0x0,'rows':[]};var _0x61ce5d=_[_0xe615('0x3d')](db[_0xe615('0x3e')][_0xe615('0x3f')],function(_0x667b8c){return{'name':_0x667b8c[_0xe615('0x40')],'type':_0x667b8c[_0xe615('0x41')]['key']};});_0x3ec4a8['model']=_[_0xe615('0x3d')](_0x61ce5d,_0xe615('0x3a'));_0x3ec4a8['query']=_[_0xe615('0x42')](_0x452b5d[_0xe615('0x43')]);_0x3ec4a8[_0xe615('0x44')]=_[_0xe615('0x45')](_0x3ec4a8[_0xe615('0x46')],_0x3ec4a8[_0xe615('0x43')]);_0x5b138c[_0xe615('0x47')]=_[_0xe615('0x45')](_0x3ec4a8[_0xe615('0x46')],qs[_0xe615('0x48')](_0x452b5d[_0xe615('0x43')][_0xe615('0x48')]));_0x5b138c[_0xe615('0x47')]=_0x5b138c[_0xe615('0x47')][_0xe615('0x49')]?_0x5b138c[_0xe615('0x47')]:_0x3ec4a8['model'];if(!_0x452b5d['query'][_0xe615('0x4a')](_0xe615('0x4b'))){_0x5b138c[_0xe615('0x31')]=qs[_0xe615('0x31')](_0x452b5d[_0xe615('0x43')][_0xe615('0x31')]);_0x5b138c['offset']=qs['offset'](_0x452b5d[_0xe615('0x43')][_0xe615('0x2f')]);}_0x5b138c[_0xe615('0x4c')]=qs['sort'](_0x452b5d[_0xe615('0x43')][_0xe615('0x4d')]);_0x5b138c[_0xe615('0x4e')]=qs['filters'](_['pick'](_0x452b5d[_0xe615('0x43')],_0x3ec4a8[_0xe615('0x44')]),_0x61ce5d);if(_0x452b5d[_0xe615('0x43')][_0xe615('0x4f')]){_0x5b138c[_0xe615('0x4e')]=_[_0xe615('0x50')](_0x5b138c[_0xe615('0x4e')],{'$or':_['map'](_0x61ce5d,function(_0x55e42d){if(_0x55e42d[_0xe615('0x41')]!==_0xe615('0x51')){var _0x518dfa={};_0x518dfa[_0x55e42d['name']]={'$like':'%'+_0x452b5d['query']['filter']+'%'};return _0x518dfa;}})});}_0x5b138c=_[_0xe615('0x50')]({},_0x5b138c,_0x452b5d['options']);var _0x2bbe62={'where':_0x5b138c[_0xe615('0x4e')]};return db[_0xe615('0x3e')][_0xe615('0x52')](_0x2bbe62)[_0xe615('0x20')](function(_0x3a07ac){_0x323404[_0xe615('0x52')]=_0x3a07ac;if(_0x452b5d[_0xe615('0x43')][_0xe615('0x53')]){_0x5b138c[_0xe615('0x54')]=[{'all':!![]}];}return db[_0xe615('0x3e')][_0xe615('0x55')](_0x5b138c);})[_0xe615('0x20')](function(_0x46204e){_0x323404[_0xe615('0x56')]=_0x46204e;return _0x323404;})[_0xe615('0x20')](respondWithFilteredResult(_0xdf9509,_0x5b138c))['catch'](handleError(_0xdf9509,null));};exports[_0xe615('0x57')]=function(_0x522faa,_0x3320d7){var _0x3c124e={'raw':![],'where':{'id':_0x522faa[_0xe615('0x58')]['id']},'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0x1a846f={};_0x1a846f['model']=_['keys'](db[_0xe615('0x3e')][_0xe615('0x3f')]);_0x1a846f[_0xe615('0x43')]=_['keys'](_0x522faa[_0xe615('0x43')]);_0x1a846f['filters']=_[_0xe615('0x45')](_0x1a846f['model'],_0x1a846f[_0xe615('0x43')]);_0x3c124e['attributes']=_[_0xe615('0x45')](_0x1a846f[_0xe615('0x46')],qs[_0xe615('0x48')](_0x522faa['query'][_0xe615('0x48')]));_0x3c124e['attributes']=_0x3c124e[_0xe615('0x47')]['length']?_0x3c124e[_0xe615('0x47')]:_0x1a846f[_0xe615('0x46')];if(_0x522faa['query']['includeAll']){_0x3c124e[_0xe615('0x54')]=[{'all':!![]}];}_0x3c124e=_[_0xe615('0x50')]({},_0x3c124e,_0x522faa['options']);return db[_0xe615('0x3e')][_0xe615('0x59')](_0x3c124e)['then'](handleEntityNotFound(_0x3320d7,null))['then'](respondWithResult(_0x3320d7,null))[_0xe615('0x2b')](handleError(_0x3320d7,null));};exports[_0xe615('0x5a')]=function(_0x52bfe2,_0x1d4c42){return db[_0xe615('0x3e')][_0xe615('0x5a')](_0x52bfe2[_0xe615('0x5b')],{})[_0xe615('0x20')](function(_0xb9fe99){var _0x5cf530=_0x52bfe2[_0xe615('0x5c')][_0xe615('0x36')]({'plain':!![]});if(!_0x5cf530)throw new Error(_0xe615('0x5d'));if(_0x5cf530[_0xe615('0x5e')]===_0xe615('0x5c')){var _0x124883=_0xb9fe99[_0xe615('0x36')]({'plain':!![]});var _0x57beba=_0xe615('0x37');return db[_0xe615('0x5f')][_0xe615('0x59')]({'where':{'name':_0x57beba,'userProfileId':_0x5cf530['userProfileId']},'raw':!![]})[_0xe615('0x20')](function(_0x371c29){if(_0x371c29&&_0x371c29['autoAssociation']===0x0){return db[_0xe615('0x38')][_0xe615('0x5a')]({'name':_0x124883['name'],'resourceId':_0x124883['id'],'type':_0x371c29['name'],'sectionId':_0x371c29['id']},{})[_0xe615('0x20')](function(){return _0xb9fe99;});}else{return _0xb9fe99;}})[_0xe615('0x2b')](function(_0x336a9){logger[_0xe615('0x26')](_0xe615('0x60'),_0x336a9);throw _0x336a9;});}return _0xb9fe99;})[_0xe615('0x20')](respondWithResult(_0x1d4c42,0xc9))[_0xe615('0x2b')](handleError(_0x1d4c42,null));};exports[_0xe615('0x61')]=function(_0x354a7f,_0x1cb593){if(_0x354a7f[_0xe615('0x5b')]['id']){delete _0x354a7f['body']['id'];}return db[_0xe615('0x3e')][_0xe615('0x59')]({'where':{'id':_0x354a7f['params']['id']},'include':[{'model':db[_0xe615('0x3c')],'as':'mandatoryDispositionPause'}]})[_0xe615('0x20')](handleEntityNotFound(_0x1cb593,null))[_0xe615('0x20')](saveUpdates(_0x354a7f['body'],null))[_0xe615('0x20')](respondWithResult(_0x1cb593,null))[_0xe615('0x2b')](handleError(_0x1cb593,null));};exports[_0xe615('0x35')]=function(_0x299b2f,_0x49f9a7){return db[_0xe615('0x3e')]['find']({'where':{'id':_0x299b2f[_0xe615('0x58')]['id']}})[_0xe615('0x20')](handleEntityNotFound(_0x49f9a7,null))[_0xe615('0x20')](removeEntity(_0x49f9a7,null))['catch'](handleError(_0x49f9a7,null));};exports[_0xe615('0x62')]=function(_0x124ab4,_0x494d93){return db[_0xe615('0x3e')][_0xe615('0x62')]()['then'](respondWithResult(_0x494d93,null))['catch'](handleError(_0x494d93,null));};exports[_0xe615('0x63')]=function(_0x2f7d9a,_0x53dab3,_0x12e472){if(_0x2f7d9a[_0xe615('0x5b')]['id']){delete _0x2f7d9a[_0xe615('0x5b')]['id'];}return db[_0xe615('0x3e')]['find']({'where':{'id':_0x2f7d9a[_0xe615('0x58')]['id']}})[_0xe615('0x20')](handleEntityNotFound(_0x53dab3,null))[_0xe615('0x20')](function(_0x3e7612){if(_0x3e7612){_0x2f7d9a[_0xe615('0x5b')][_0xe615('0x64')]=_0x3e7612['id'];return db[_0xe615('0x65')][_0xe615('0x5a')](_0x2f7d9a[_0xe615('0x5b')]);}})['then'](respondWithResult(_0x53dab3,null))[_0xe615('0x2b')](handleError(_0x53dab3,null));};exports['getDispositions']=function(_0x48bc75,_0x3d1df4,_0x4357c8){var _0x4b9d60={'raw':![],'where':{}};var _0x5a7fda={};var _0x4805e7={'count':0x0,'rows':[]};return db[_0xe615('0x3e')]['findOne']({'where':{'id':_0x48bc75[_0xe615('0x58')]['id']}})['then'](handleEntityNotFound(_0x3d1df4,null))[_0xe615('0x20')](function(_0x55eb3c){if(_0x55eb3c){_0x5a7fda[_0xe615('0x46')]=_[_0xe615('0x42')](db[_0xe615('0x65')]['rawAttributes']);_0x5a7fda['query']=_[_0xe615('0x42')](_0x48bc75['query']);_0x5a7fda[_0xe615('0x44')]=_[_0xe615('0x45')](_0x5a7fda[_0xe615('0x46')],_0x5a7fda['query']);_0x4b9d60[_0xe615('0x47')]=_[_0xe615('0x45')](_0x5a7fda[_0xe615('0x46')],qs['fields'](_0x48bc75['query'][_0xe615('0x48')]));_0x4b9d60[_0xe615('0x47')]=_0x4b9d60[_0xe615('0x47')]['length']?_0x4b9d60['attributes']:_0x5a7fda['model'];if(!_0x48bc75[_0xe615('0x43')]['hasOwnProperty']('nolimit')){_0x4b9d60[_0xe615('0x31')]=qs[_0xe615('0x31')](_0x48bc75['query']['limit']);_0x4b9d60[_0xe615('0x2f')]=qs[_0xe615('0x2f')](_0x48bc75[_0xe615('0x43')][_0xe615('0x2f')]);}_0x4b9d60[_0xe615('0x4c')]=qs[_0xe615('0x4d')](_0x48bc75[_0xe615('0x43')][_0xe615('0x4d')]);_0x4b9d60['where']=qs[_0xe615('0x44')](_['pick'](_0x48bc75[_0xe615('0x43')],_0x5a7fda['filters']));_0x4b9d60[_0xe615('0x4e')][_0xe615('0x64')]=_0x55eb3c['id'];if(_0x48bc75[_0xe615('0x43')][_0xe615('0x4f')]){_0x4b9d60['where']=_[_0xe615('0x50')](_0x4b9d60[_0xe615('0x4e')],{'$or':_['map'](_0x4b9d60[_0xe615('0x47')],function(_0x14bbd9){var _0x3c3449={};_0x3c3449[_0x14bbd9]={'$like':'%'+_0x48bc75[_0xe615('0x43')][_0xe615('0x4f')]+'%'};return _0x3c3449;})});}_0x4b9d60=_[_0xe615('0x50')]({},_0x4b9d60,_0x48bc75[_0xe615('0x66')]);return db[_0xe615('0x65')][_0xe615('0x52')]({'where':_0x4b9d60[_0xe615('0x4e')]})[_0xe615('0x20')](function(_0x4c0939){_0x4805e7['count']=_0x4c0939;if(_0x48bc75[_0xe615('0x43')][_0xe615('0x53')]){_0x4b9d60[_0xe615('0x54')]=[{'all':!![]}];}return db[_0xe615('0x65')]['findAll'](_0x4b9d60);})[_0xe615('0x20')](function(_0x379a71){_0x4805e7[_0xe615('0x56')]=_0x379a71;return _0x4805e7;});}})[_0xe615('0x20')](respondWithFilteredResult(_0x3d1df4,_0x4b9d60))[_0xe615('0x2b')](handleError(_0x3d1df4,null));};exports[_0xe615('0x67')]=function(_0x2ee861,_0x366e89,_0x42c532){return db[_0xe615('0x3e')][_0xe615('0x59')]({'where':{'id':_0x2ee861[_0xe615('0x58')]['id']}})[_0xe615('0x20')](handleEntityNotFound(_0x366e89,null))[_0xe615('0x20')](function(_0x38faa8){if(_0x38faa8){return _0x38faa8[_0xe615('0x67')](_0x2ee861[_0xe615('0x43')]['ids']);}})[_0xe615('0x20')](respondWithStatusCode(_0x366e89,null))[_0xe615('0x2b')](handleError(_0x366e89,null));};exports['addAnswer']=function(_0x4ca916,_0x3f4067,_0xc19897){if(_0x4ca916[_0xe615('0x5b')]['id']){delete _0x4ca916[_0xe615('0x5b')]['id'];}return db[_0xe615('0x3e')][_0xe615('0x59')]({'where':{'id':_0x4ca916[_0xe615('0x58')]['id']}})[_0xe615('0x20')](handleEntityNotFound(_0x3f4067,null))['then'](function(_0x570ba2){if(_0x570ba2){_0x4ca916['body']['FaxAccountId']=_0x570ba2['id'];return db[_0xe615('0x68')][_0xe615('0x5a')](_0x4ca916[_0xe615('0x5b')]);}})[_0xe615('0x20')](respondWithResult(_0x3f4067,null))['catch'](handleError(_0x3f4067,null));};exports[_0xe615('0x69')]=function(_0x50fe78,_0x553c8d,_0x37273c){var _0x368cf8={'raw':![],'where':{}};var _0x38a7f0={};var _0x397729={'count':0x0,'rows':[]};return db['FaxAccount'][_0xe615('0x6a')]({'where':{'id':_0x50fe78[_0xe615('0x58')]['id']}})[_0xe615('0x20')](handleEntityNotFound(_0x553c8d,null))[_0xe615('0x20')](function(_0x8b3ebf){if(_0x8b3ebf){_0x38a7f0[_0xe615('0x46')]=_[_0xe615('0x42')](db[_0xe615('0x68')]['rawAttributes']);_0x38a7f0['query']=_[_0xe615('0x42')](_0x50fe78[_0xe615('0x43')]);_0x38a7f0[_0xe615('0x44')]=_[_0xe615('0x45')](_0x38a7f0[_0xe615('0x46')],_0x38a7f0[_0xe615('0x43')]);_0x368cf8[_0xe615('0x47')]=_[_0xe615('0x45')](_0x38a7f0[_0xe615('0x46')],qs['fields'](_0x50fe78[_0xe615('0x43')][_0xe615('0x48')]));_0x368cf8['attributes']=_0x368cf8['attributes'][_0xe615('0x49')]?_0x368cf8[_0xe615('0x47')]:_0x38a7f0[_0xe615('0x46')];if(!_0x50fe78[_0xe615('0x43')]['hasOwnProperty'](_0xe615('0x4b'))){_0x368cf8[_0xe615('0x31')]=qs[_0xe615('0x31')](_0x50fe78[_0xe615('0x43')][_0xe615('0x31')]);_0x368cf8[_0xe615('0x2f')]=qs[_0xe615('0x2f')](_0x50fe78[_0xe615('0x43')][_0xe615('0x2f')]);}_0x368cf8['order']=qs[_0xe615('0x4d')](_0x50fe78['query'][_0xe615('0x4d')]);_0x368cf8[_0xe615('0x4e')]=qs[_0xe615('0x44')](_['pick'](_0x50fe78[_0xe615('0x43')],_0x38a7f0['filters']));_0x368cf8[_0xe615('0x4e')][_0xe615('0x64')]=_0x8b3ebf['id'];if(_0x50fe78[_0xe615('0x43')][_0xe615('0x4f')]){_0x368cf8[_0xe615('0x4e')]=_[_0xe615('0x50')](_0x368cf8[_0xe615('0x4e')],{'$or':_[_0xe615('0x3d')](_0x368cf8['attributes'],function(_0x301acf){var _0x121e2e={};_0x121e2e[_0x301acf]={'$like':'%'+_0x50fe78[_0xe615('0x43')][_0xe615('0x4f')]+'%'};return _0x121e2e;})});}_0x368cf8=_[_0xe615('0x50')]({},_0x368cf8,_0x50fe78['options']);return db['CannedAnswer'][_0xe615('0x52')]({'where':_0x368cf8['where']})['then'](function(_0x2072b3){_0x397729[_0xe615('0x52')]=_0x2072b3;if(_0x50fe78[_0xe615('0x43')][_0xe615('0x53')]){_0x368cf8[_0xe615('0x54')]=[{'all':!![]}];}return db[_0xe615('0x68')][_0xe615('0x55')](_0x368cf8);})['then'](function(_0x42681f){_0x397729[_0xe615('0x56')]=_0x42681f;return _0x397729;});}})[_0xe615('0x20')](respondWithFilteredResult(_0x553c8d,_0x368cf8))[_0xe615('0x2b')](handleError(_0x553c8d,null));};exports[_0xe615('0x6b')]=function(_0x3e0e39,_0x5379c2,_0x225a58){return db[_0xe615('0x3e')]['find']({'where':{'id':_0x3e0e39[_0xe615('0x58')]['id']}})[_0xe615('0x20')](handleEntityNotFound(_0x5379c2,null))['then'](function(_0x22f8b4){if(_0x22f8b4){return _0x22f8b4['removeAnswers'](_0x3e0e39['query']['ids']);}})[_0xe615('0x20')](respondWithStatusCode(_0x5379c2,null))[_0xe615('0x2b')](handleError(_0x5379c2,null));};exports[_0xe615('0x6c')]=function(_0x35bad0,_0x198ee3,_0x24419e){return db['FaxInteraction']['find']({'where':{'id':_0x35bad0['params']['id']}})[_0xe615('0x20')](handleEntityNotFound(_0x198ee3,null))[_0xe615('0x20')](function(_0x493baf){if(_0x493baf){return _0x493baf['addInteraction'](_0x35bad0[_0xe615('0x5b')]['ids'],_[_0xe615('0x6d')](_0x35bad0[_0xe615('0x5b')],['ids','id'])||{});}})['then'](respondWithResult(_0x198ee3,null))[_0xe615('0x2b')](handleError(_0x198ee3,null));};exports[_0xe615('0x6e')]=function(_0x125c3b,_0x457836,_0x4c8d13){var _0x4d116f={'raw':![],'where':{}};var _0x4911a6={};var _0x48e6cf={'count':0x0,'rows':[]};return db['FaxAccount']['findOne']({'where':{'id':_0x125c3b[_0xe615('0x58')]['id']}})['then'](handleEntityNotFound(_0x457836,null))[_0xe615('0x20')](function(_0x21cfc8){if(_0x21cfc8){_0x4911a6[_0xe615('0x46')]=_['keys'](db[_0xe615('0x6f')][_0xe615('0x3f')]);_0x4911a6[_0xe615('0x43')]=_[_0xe615('0x42')](_0x125c3b[_0xe615('0x43')]);_0x4911a6[_0xe615('0x44')]=_[_0xe615('0x45')](_0x4911a6[_0xe615('0x46')],_0x4911a6[_0xe615('0x43')]);_0x4d116f[_0xe615('0x47')]=_[_0xe615('0x45')](_0x4911a6['model'],qs[_0xe615('0x48')](_0x125c3b[_0xe615('0x43')]['fields']));_0x4d116f['attributes']=_0x4d116f[_0xe615('0x47')][_0xe615('0x49')]?_0x4d116f[_0xe615('0x47')]:_0x4911a6[_0xe615('0x46')];if(!_0x125c3b['query'][_0xe615('0x4a')](_0xe615('0x4b'))){_0x4d116f[_0xe615('0x31')]=qs[_0xe615('0x31')](_0x125c3b[_0xe615('0x43')][_0xe615('0x31')]);_0x4d116f[_0xe615('0x2f')]=qs['offset'](_0x125c3b[_0xe615('0x43')][_0xe615('0x2f')]);}_0x4d116f[_0xe615('0x4c')]=qs[_0xe615('0x4d')](_0x125c3b['query']['sort']);_0x4d116f['where']=qs['filters'](_['pick'](_0x125c3b[_0xe615('0x43')],_0x4911a6[_0xe615('0x44')]));_0x4d116f[_0xe615('0x4e')][_0xe615('0x64')]=_0x21cfc8['id'];if(_0x125c3b[_0xe615('0x43')][_0xe615('0x4f')]){_0x4d116f['where']=_[_0xe615('0x50')](_0x4d116f['where'],{'$or':_['map'](_0x4d116f[_0xe615('0x47')],function(_0x399a05){var _0x1da208={};_0x1da208[_0x399a05]={'$like':'%'+_0x125c3b[_0xe615('0x43')][_0xe615('0x4f')]+'%'};return _0x1da208;})});}_0x4d116f=_[_0xe615('0x50')]({},_0x4d116f,_0x125c3b['options']);return db[_0xe615('0x6f')][_0xe615('0x52')]({'where':_0x4d116f['where']})['then'](function(_0xde111f){_0x48e6cf[_0xe615('0x52')]=_0xde111f;if(_0x125c3b[_0xe615('0x43')][_0xe615('0x53')]){_0x4d116f[_0xe615('0x54')]=[{'model':db[_0xe615('0x70')],'as':'Contact','required':![]},{'model':db[_0xe615('0x71')],'as':_0xe615('0x72'),'attributes':['name','fullname','internal'],'required':![]},{'model':db[_0xe615('0x73')],'as':_0xe615('0x74'),'attributes':['id',_0xe615('0x3a'),'color'],'where':_0x125c3b['query'][_0xe615('0x75')]?{'id':_0x125c3b[_0xe615('0x43')][_0xe615('0x75')]}:undefined,'required':_0x125c3b[_0xe615('0x43')][_0xe615('0x75')]?!![]:![]}];}return db[_0xe615('0x6f')]['findAll'](_0x4d116f);})[_0xe615('0x20')](function(_0x18ff97){_0x48e6cf[_0xe615('0x56')]=_0x18ff97;return _0x48e6cf;});}})[_0xe615('0x20')](respondWithFilteredResult(_0x457836,_0x4d116f))[_0xe615('0x2b')](handleError(_0x457836,null));};exports[_0xe615('0x76')]=function(_0x287404,_0x5b2c2f){var _0x2ad81e=_0x287404['params']['id'];var _0xc2a187=_0x287404[_0xe615('0x5b')];var _0x4d78e0=0xc8;var _0x443800=null;return db[_0xe615('0x77')][_0xe615('0x78')]({'isolationLevel':db[_0xe615('0x77')][_0xe615('0x79')][_0xe615('0x7a')]['READ_COMMITTED']},function(_0x23c3da){return db[_0xe615('0x3e')][_0xe615('0x6a')]({'where':{'id':_0x2ad81e},'transaction':_0x23c3da})[_0xe615('0x20')](function(_0x59fc27){if(_0x59fc27){return db['FaxApplication'][_0xe615('0x35')]({'where':{'FaxAccountId':_0x2ad81e},'transaction':_0x23c3da})['then'](function(){var _0x57fecc=_[_0xe615('0x3d')](_0xc2a187,function(_0xae9c4d){_0xae9c4d[_0xe615('0x64')]=_0x2ad81e;return _0xae9c4d;});return db['FaxApplication'][_0xe615('0x7b')](_0x57fecc,{'transaction':_0x23c3da});});}else{_0x4d78e0=0x194;_0x443800=[];}});})[_0xe615('0x20')](function(){if(_0x4d78e0!==0x194){return db[_0xe615('0x7c')][_0xe615('0x7d')]({'where':{'FaxAccountId':_0x2ad81e},'order':_0xe615('0x7e')})[_0xe615('0x20')](function(_0x2b0863){_0x443800=_0x2b0863;});}})[_0xe615('0x2b')](function(_0x1a5f78){_0x4d78e0=0x1f4;logger[_0xe615('0x26')](_0x1a5f78[_0xe615('0x39')]);if(_0x1a5f78[_0xe615('0x3a')]){delete _0x1a5f78[_0xe615('0x3a')];}_0x443800=_0x1a5f78;})[_0xe615('0x7f')](function(){if(_0x443800===null){_0x5b2c2f[_0xe615('0x80')](_0x4d78e0);}else{if(_0x4d78e0===0x1f4){_0x5b2c2f['status'](_0x4d78e0)[_0xe615('0x3b')](_0x443800);}else{_0x5b2c2f[_0xe615('0x2c')](_0x4d78e0)[_0xe615('0x2e')](_0x443800);}}});};exports[_0xe615('0x81')]=function(_0xd658d8,_0x3b563b,_0x2f6d58){var _0xc724f2={};var _0x4856dc={};var _0x16ca35;var _0x2a5b70;return db[_0xe615('0x3e')]['findOne']({'where':{'id':_0xd658d8[_0xe615('0x58')]['id']}})[_0xe615('0x20')](handleEntityNotFound(_0x3b563b,null))[_0xe615('0x20')](function(_0x3eef52){if(_0x3eef52){_0x16ca35=_0x3eef52;_0x4856dc['model']=_['keys'](db[_0xe615('0x7c')]['rawAttributes']);_0x4856dc[_0xe615('0x43')]=_[_0xe615('0x42')](_0xd658d8[_0xe615('0x43')]);_0x4856dc[_0xe615('0x44')]=_[_0xe615('0x45')](_0x4856dc[_0xe615('0x46')],_0x4856dc[_0xe615('0x43')]);_0xc724f2[_0xe615('0x47')]=_[_0xe615('0x45')](_0x4856dc[_0xe615('0x46')],qs[_0xe615('0x48')](_0xd658d8['query'][_0xe615('0x48')]));_0xc724f2[_0xe615('0x47')]=_0xc724f2[_0xe615('0x47')][_0xe615('0x49')]?_0xc724f2[_0xe615('0x47')]:_0x4856dc[_0xe615('0x46')];_0xc724f2[_0xe615('0x4c')]=qs[_0xe615('0x4d')](_0xd658d8[_0xe615('0x43')][_0xe615('0x4d')]);_0xc724f2['where']=qs['filters'](_[_0xe615('0x82')](_0xd658d8['query'],_0x4856dc[_0xe615('0x44')]));if(_0xd658d8[_0xe615('0x43')][_0xe615('0x4f')]){_0xc724f2['where']=_[_0xe615('0x50')](_0xc724f2[_0xe615('0x4e')],{'$or':_['map'](_0xc724f2[_0xe615('0x47')],function(_0x3ae3bb){var _0xaa33a0={};_0xaa33a0[_0x3ae3bb]={'$like':'%'+_0xd658d8['query'][_0xe615('0x4f')]+'%'};return _0xaa33a0;})});}_0xc724f2=_[_0xe615('0x50')]({},_0xc724f2,_0xd658d8[_0xe615('0x66')]);return _0x16ca35['getApplications'](_0xc724f2);}})['then'](function(_0x44925c){if(_0x44925c){_0x2a5b70=_0x44925c[_0xe615('0x49')];if(!_0xd658d8[_0xe615('0x43')][_0xe615('0x4a')](_0xe615('0x4b'))){_0xc724f2[_0xe615('0x31')]=qs[_0xe615('0x31')](_0xd658d8[_0xe615('0x43')][_0xe615('0x31')]);_0xc724f2[_0xe615('0x2f')]=qs[_0xe615('0x2f')](_0xd658d8['query'][_0xe615('0x2f')]);}return _0x16ca35[_0xe615('0x81')](_0xc724f2);}})[_0xe615('0x20')](function(_0x412350){if(_0x412350){return _0x412350?{'count':_0x2a5b70,'rows':_0x412350}:null;}})[_0xe615('0x20')](respondWithResult(_0x3b563b,null))[_0xe615('0x2b')](handleError(_0x3b563b,null));};function Extension(_0x1fb65f,_0x58fb1f,_0x43cbe1,_0x2b705a){this[_0xe615('0x83')]=_0xe615('0x84');this[_0xe615('0x85')]=_0x1fb65f[_0xe615('0x86')];this['app']=_0x2b705a;this[_0xe615('0x41')]=_0xe615('0x87');this[_0xe615('0x88')]='Fax\x20Extension';this[_0xe615('0x64')]=_0x1fb65f['id'];this[_0xe615('0x7e')]=_0x58fb1f;this['appdata']=_0x43cbe1;}function createExtensionsReciveFax(_0x121fe3){var _0x1f18e4=0x1;var _0x3f9ebe=[];_0x3f9ebe[_0xe615('0x89')](new Extension(_0x121fe3,_0x1f18e4,'',_0xe615('0x8a')));_0x1f18e4+=0x1;_0x3f9ebe[_0xe615('0x89')](new Extension(_0x121fe3,_0x1f18e4,_0xe615('0x8b'),_0xe615('0x8c')));_0x1f18e4+=0x1;for(var _0x76cc42 in _0x121fe3){if(_0x121fe3[_0xe615('0x4a')](_0x76cc42)&&(_0x76cc42==='ecm'||_0x76cc42===_0xe615('0x86')||_0x76cc42==='gateway'||_0x76cc42===_0xe615('0x8d')||_0x76cc42==='headerinfo'||_0x76cc42==='maxrate'||_0x76cc42===_0xe615('0x8e')||_0x76cc42===_0xe615('0x8f')||_0x76cc42===_0xe615('0x90'))){_0x3f9ebe['push'](new Extension(_0x121fe3,_0x1f18e4,_0xe615('0x91')+_0x76cc42+')='+_0x121fe3[_0x76cc42],_0xe615('0x8c')));_0x1f18e4+=0x1;}}_0x3f9ebe[_0xe615('0x89')](new Extension(_0x121fe3,_0x1f18e4,'6',_0xe615('0x92')));_0x1f18e4+=0x1;_0x3f9ebe[_0xe615('0x89')](new Extension(_0x121fe3,_0x1f18e4,_0xe615('0x93'),_0xe615('0x94')));_0x1f18e4=0x0;return _0x3f9ebe;}exports[_0xe615('0x95')]=function(_0xda8e54,_0x2a7da7,_0x85edc1){var _0x5885d0;return db[_0xe615('0x77')][_0xe615('0x78')](function(_0x4004cf){return db[_0xe615('0x3e')]['create'](_0xda8e54[_0xe615('0x5b')],{'transaction':_0x4004cf})[_0xe615('0x20')](function(_0x15a216){_0x5885d0=_0x15a216['get']({'plain':!![]});return db['VoiceExtension'][_0xe615('0x7b')](createExtensionsReciveFax(_0x5885d0),{'transaction':_0x4004cf});});})[_0xe615('0x20')](function(){return _0x5885d0;})[_0xe615('0x20')](respondWithResult(_0x2a7da7,null))[_0xe615('0x2b')](handleError(_0x2a7da7,null));};exports['updateAccountApplications']=function(_0x202f1f,_0x26f217,_0x1ef3fb){var _0x448772;return db[_0xe615('0x77')][_0xe615('0x78')](function(_0x472a43){return db[_0xe615('0x3e')][_0xe615('0x61')](_0x202f1f[_0xe615('0x5b')],{'where':{'id':_0x202f1f['body']['id']},'transaction':_0x472a43})[_0xe615('0x20')](function(_0x29be43){return db['VoiceExtension'][_0xe615('0x35')]({'where':{'FaxAccountId':_0x202f1f['body']['id']},'transaction':_0x472a43})[_0xe615('0x20')](function(_0xab95d4){return db[_0xe615('0x96')][_0xe615('0x7b')](createExtensionsReciveFax(_[_0xe615('0x6d')](_0x202f1f[_0xe615('0x5b')],[_0xe615('0x97'),_0xe615('0x98'),_0xe615('0x99'),_0xe615('0x9a'),_0xe615('0x9b'),_0xe615('0x9c')])),{'transaction':_0x472a43});});});})['then'](function(){return db['FaxAccount'][_0xe615('0x9d')](_0x202f1f[_0xe615('0x5b')]['id']);})[_0xe615('0x20')](respondWithResult(_0x26f217,null))[_0xe615('0x2b')](handleError(_0x26f217,null));};exports[_0xe615('0x9e')]=function(_0x5beb64,_0x39c692,_0x4fcc1a){var _0xb909e0={'raw':!![],'where':{}};var _0x275826={};var _0x3e756c={'count':0x0,'rows':[]};return db[_0xe615('0x3e')][_0xe615('0x6a')]({'where':{'id':_0x5beb64[_0xe615('0x58')]['id']}})[_0xe615('0x20')](handleEntityNotFound(_0x39c692,null))[_0xe615('0x20')](function(_0x5070a1){if(_0x5070a1){_0x275826[_0xe615('0x46')]=_[_0xe615('0x42')](db[_0xe615('0x9f')][_0xe615('0x3f')]);_0x275826[_0xe615('0x43')]=_['keys'](_0x5beb64[_0xe615('0x43')]);_0x275826[_0xe615('0x44')]=_['intersection'](_0x275826[_0xe615('0x46')],_0x275826[_0xe615('0x43')]);_0xb909e0['attributes']=_[_0xe615('0x45')](_0x275826[_0xe615('0x46')],qs[_0xe615('0x48')](_0x5beb64[_0xe615('0x43')][_0xe615('0x48')]));_0xb909e0['attributes']=_0xb909e0['attributes']['length']?_0xb909e0['attributes']:_0x275826[_0xe615('0x46')];if(!_0x5beb64[_0xe615('0x43')][_0xe615('0x4a')](_0xe615('0x4b'))){_0xb909e0[_0xe615('0x31')]=qs['limit'](_0x5beb64[_0xe615('0x43')][_0xe615('0x31')]);_0xb909e0['offset']=qs['offset'](_0x5beb64[_0xe615('0x43')][_0xe615('0x2f')]);}_0xb909e0['order']=qs[_0xe615('0x4d')](_0x5beb64[_0xe615('0x43')][_0xe615('0x4d')]);_0xb909e0[_0xe615('0x4e')]=qs[_0xe615('0x44')](_['pick'](_0x5beb64['query'],_0x275826[_0xe615('0x44')]));_0xb909e0[_0xe615('0x4e')][_0xe615('0x64')]=_0x5070a1['id'];if(_0x5beb64[_0xe615('0x43')][_0xe615('0x4f')]){_0xb909e0[_0xe615('0x4e')]=_[_0xe615('0x50')](_0xb909e0['where'],{'$or':_[_0xe615('0x3d')](_0xb909e0['attributes'],function(_0xe6115f){var _0x4c5757={};_0x4c5757[_0xe6115f]={'$like':'%'+_0x5beb64['query']['filter']+'%'};return _0x4c5757;})});}if(_0x5beb64['query'][_0xe615('0xa0')]){var _0x5a1dc0=_0x5beb64[_0xe615('0x43')][_0xe615('0xa0')]['split'](',');var _0x4a0bbe={};_0x4a0bbe[_0x5a1dc0[0x0]]={'$gte':moment(_0x5a1dc0[0x1])[_0xe615('0xa1')]('YYYY-MM-DD\x20HH:mm:ss')};_0xb909e0[_0xe615('0x4e')]=_[_0xe615('0x50')](_0xb909e0['where'],_0x4a0bbe);}_0xb909e0=_[_0xe615('0x50')]({},_0xb909e0,_0x5beb64[_0xe615('0x66')]);return db[_0xe615('0x9f')][_0xe615('0x52')]({'where':_0xb909e0[_0xe615('0x4e')]})[_0xe615('0x20')](function(_0x13ba22){_0x3e756c[_0xe615('0x52')]=_0x13ba22;if(_0x5beb64[_0xe615('0x43')][_0xe615('0x53')]){_0xb909e0[_0xe615('0x54')]=[{'all':!![]}];}return db[_0xe615('0x9f')]['findAll'](_0xb909e0);})[_0xe615('0x20')](function(_0x59cb42){_0x3e756c[_0xe615('0x56')]=_0x59cb42;return _0x3e756c;});}})[_0xe615('0x20')](respondWithFilteredResult(_0x39c692,_0xb909e0))[_0xe615('0x2b')](handleError(_0x39c692,null));};exports[_0xe615('0x3b')]=function(_0x25dc0d,_0x48ec55,_0x30eee8){var _0x39f9d3,_0x1ecd24={},_0x2204ef;if(_0x25dc0d[_0xe615('0x5b')]['to']){_0x2204ef=_0x25dc0d[_0xe615('0x5b')]['to'][0x0];}return db[_0xe615('0x3e')][_0xe615('0x59')]({'where':{'id':_0x25dc0d[_0xe615('0x58')]['id']},'include':[{'model':db[_0xe615('0xa2')],'as':_0xe615('0xa3'),'include':[{'model':db[_0xe615('0x70')],'as':'Contacts','where':{'fax':_0x2204ef},'limit':0x1,'order':[[_0xe615('0x9a'),'DESC']]}]}]})['then'](handleEntityNotFound(_0x48ec55,null))[_0xe615('0x20')](function(_0x526d94){_0x39f9d3=_0x526d94;if(_0x25dc0d['body'][_0xe615('0xa4')]&&_0x25dc0d[_0xe615('0x5b')][_0xe615('0xa4')]['length']){for(var _0x138bea=0x0;_0x138bea<_0x25dc0d[_0xe615('0x5b')][_0xe615('0xa4')][_0xe615('0x49')];_0x138bea+=0x1){_0x25dc0d[_0xe615('0x5b')][_0xe615('0xa4')][_0x138bea]={'filename':_0x25dc0d[_0xe615('0x5b')][_0xe615('0xa4')][_0x138bea]['name'],'id':_0x25dc0d['body'][_0xe615('0xa4')][_0x138bea]['id'],'path':path[_0xe615('0xa5')](config['root'],_0xe615('0xa6'),_0x25dc0d[_0xe615('0x5b')]['attachments'][_0x138bea][_0xe615('0xa7')])};}}return respondWithRpcPromise('CheckAfterSend','CheckAfterSend',{'FaxAccountId':_[_0xe615('0xa8')](_0x25dc0d[_0xe615('0x58')]['id'])?undefined:_0x25dc0d['params']['id'],'path':_[_0xe615('0xa8')](_0x25dc0d[_0xe615('0x5b')][_0xe615('0xa4')][0x0][_0xe615('0xa9')])?undefined:_0x25dc0d[_0xe615('0x5b')][_0xe615('0xa4')][0x0][_0xe615('0xa9')],'fax':_['isNil'](_0x25dc0d[_0xe615('0x5b')]['to'][0x0])?undefined:_0x25dc0d[_0xe615('0x5b')]['to'][0x0]},client9002);})[_0xe615('0x20')](function(){if(_0x39f9d3){if(_[_0xe615('0xa8')](_0x25dc0d[_0xe615('0x5b')][_0xe615('0xaa')])){_0x25dc0d[_0xe615('0x5b')][_0xe615('0xaa')]=util[_0xe615('0xa1')](_0xe615('0xab'),_0x39f9d3[_0xe615('0x3a')],_0x39f9d3['fax']);}if(_0x39f9d3[_0xe615('0xa3')]){if(_0x39f9d3[_0xe615('0xa3')][_0xe615('0xac')][_0xe615('0x49')]){return _0x39f9d3[_0xe615('0xa3')]['Contacts'][0x0];}else{return db[_0xe615('0x70')][_0xe615('0x5a')](_[_0xe615('0x18')](_0x25dc0d[_0xe615('0x5b')],{'firstName':_0x25dc0d[_0xe615('0x5b')]['to'][0x0],'phone':_0x25dc0d['body']['to'][0x0],'fax':_0x25dc0d['body']['to'][0x0],'ListId':_0x39f9d3[_0xe615('0x9c')]}));}}else{throw new Error(_0xe615('0xad'));}}else{throw new Error(_0xe615('0xae'));}})['then'](function(_0x66f21f){if(_0x66f21f){return db[_0xe615('0x6f')][_0xe615('0x59')]({'where':{'ContactId':_0x66f21f['id'],'closed':![],'FaxAccountId':_0x39f9d3['id']}})[_0xe615('0x20')](function(_0x5f4f22){if(_0x5f4f22){return[_0x5f4f22,![]];}return db[_0xe615('0x6f')][_0xe615('0x5a')]({'UserId':_0x25dc0d[_0xe615('0x5c')]['id'],'ContactId':_0x66f21f['id'],'FaxAccountId':_0x39f9d3['id'],'fax':_0x25dc0d[_0xe615('0x5b')]['to'][0x0],'firstMsgDirection':_0xe615('0xaf'),'Messages':[_[_0xe615('0x50')](_0x25dc0d[_0xe615('0x5b')],{'read':![],'body':_0x25dc0d[_0xe615('0x5b')][_0xe615('0xa4')][0x0][_0xe615('0xb0')],'FaxAccountId':_0x39f9d3['id'],'UserId':_0x25dc0d[_0xe615('0x5c')]['id'],'ContactId':_0x66f21f['id'],'AttachmentId':_0x25dc0d[_0xe615('0x5b')][_0xe615('0xa4')][0x0]['id']})]},{'include':[{'model':db[_0xe615('0x9f')],'as':_0xe615('0xb1')}]})[_0xe615('0x20')](function(_0x23934e){return[_0x23934e,!![]];});});}else{throw new Error(_0xe615('0xb2'));}})[_0xe615('0xb3')](function(_0x38b0f6,_0x5ef8a8){if(_0x5ef8a8){return _0x38b0f6;}return db[_0xe615('0x9f')][_0xe615('0x5a')]({'direction':'out','read':![],'body':_0x25dc0d[_0xe615('0x5b')][_0xe615('0xa4')][0x0][_0xe615('0xb0')],'FaxAccountId':_0x39f9d3['id'],'FaxInteractionId':_0x38b0f6['id'],'UserId':_0x25dc0d[_0xe615('0x5c')]['id'],'ContactId':_0x38b0f6[_0xe615('0xb4')],'AttachmentId':_0x25dc0d[_0xe615('0x5b')]['attachments'][0x0]['id']})[_0xe615('0x20')](function(_0x3aaa35){_0x38b0f6[_0xe615('0xb5')][_0xe615('0xb1')]=[];_0x38b0f6[_0xe615('0xb5')][_0xe615('0xb1')][_0xe615('0x89')](_0x3aaa35['dataValues']);return _0x38b0f6;});})['then'](function(_0x504969){respondWithRpcPromise(_0xe615('0xb6'),'SendFax',{'FaxAccountId':_[_0xe615('0xa8')](_0x25dc0d[_0xe615('0x58')]['id'])?undefined:_0x25dc0d[_0xe615('0x58')]['id'],'path':_[_0xe615('0xa8')](_0x25dc0d[_0xe615('0x5b')][_0xe615('0xa4')][0x0][_0xe615('0xa9')])?undefined:_0x25dc0d[_0xe615('0x5b')][_0xe615('0xa4')][0x0][_0xe615('0xa9')],'fax':_[_0xe615('0xa8')](_0x25dc0d['body']['to'][0x0])?undefined:_0x25dc0d['body']['to'][0x0],'AttachmentId':_0x25dc0d[_0xe615('0x5b')][_0xe615('0xa4')][0x0]['id']},client9002)[_0xe615('0x20')](function(_0x521c43){logger['info'](_0xe615('0xb7'),_0x521c43);})[_0xe615('0x2b')](function(_0x2c3236){logger[_0xe615('0x21')](_0xe615('0xb7'),_0x2c3236);});return _0x504969;})['then'](respondWithResult(_0x48ec55,null))['catch'](handleError(_0x48ec55,null));};exports[_0xe615('0xb8')]=function(_0x20cfb5,_0xce9f9c,_0x57bd9e){return db['FaxAccount'][_0xe615('0x59')]({'where':{'id':_0x20cfb5['params']['id']}})['then'](handleEntityNotFound(_0xce9f9c,null))[_0xe615('0x20')](function(_0x5c2ce6){if(_0x5c2ce6){return _0x5c2ce6[_0xe615('0xb8')](_0x20cfb5['body'][_0xe615('0xb9')],_[_0xe615('0x6d')](_0x20cfb5[_0xe615('0x5b')],['ids','id'])||{})[_0xe615('0xb3')](function(_0x4924ae){for(var _0x2406c2=0x0;_0x2406c2<_0x20cfb5['body'][_0xe615('0xb9')][_0xe615('0x49')];_0x2406c2+=0x1){socket['emit'](_0xe615('0xba'),{'UserId':Number(_0x20cfb5[_0xe615('0x5b')][_0xe615('0xb9')][_0x2406c2]),'FaxAccountId':Number(_0x20cfb5[_0xe615('0x58')]['id'])});}return _0x4924ae;});}})['then'](respondWithResult(_0xce9f9c,null))[_0xe615('0x2b')](handleError(_0xce9f9c,null));};exports['removeAgents']=function(_0x5b440a,_0x2e481b,_0xd56a40){return db['FaxAccount'][_0xe615('0x59')]({'where':{'id':_0x5b440a[_0xe615('0x58')]['id']}})[_0xe615('0x20')](handleEntityNotFound(_0x2e481b,null))['then'](function(_0x4c56ec){if(_0x4c56ec){return _0x4c56ec[_0xe615('0xbb')](_0x5b440a[_0xe615('0x43')]['ids'])[_0xe615('0x20')](function(){if(_[_0xe615('0xbc')](_0x5b440a[_0xe615('0x43')][_0xe615('0xb9')])){for(var _0x2afd57=0x0;_0x2afd57<_0x5b440a['query']['ids']['length'];_0x2afd57+=0x1){socket[_0xe615('0xbd')](_0xe615('0xbe'),{'UserId':Number(_0x5b440a[_0xe615('0x43')][_0xe615('0xb9')][_0x2afd57]),'FaxAccountId':Number(_0x5b440a['params']['id'])});}}else{socket[_0xe615('0xbd')](_0xe615('0xbe'),{'UserId':Number(_0x5b440a[_0xe615('0x43')][_0xe615('0xb9')]),'FaxAccountId':Number(_0x5b440a[_0xe615('0x58')]['id'])});}});}})['then'](respondWithStatusCode(_0x2e481b,null))['catch'](handleError(_0x2e481b,null));};exports[_0xe615('0xbf')]=function(_0x61a99f,_0x180e51,_0x507c8a){var _0x5df3ae={};var _0x143443={};var _0x1fee32;var _0xd0f9c2;return db[_0xe615('0x3e')]['findOne']({'where':{'id':_0x61a99f['params']['id']}})[_0xe615('0x20')](handleEntityNotFound(_0x180e51,null))['then'](function(_0x1b1f92){if(_0x1b1f92){_0x1fee32=_0x1b1f92;_0x143443[_0xe615('0x46')]=_[_0xe615('0x42')](db['User'][_0xe615('0x3f')]);_0x143443[_0xe615('0x43')]=_[_0xe615('0x42')](_0x61a99f[_0xe615('0x43')]);_0x143443['filters']=_[_0xe615('0x45')](_0x143443['model'],_0x143443[_0xe615('0x43')]);_0x5df3ae['attributes']=_['intersection'](_0x143443[_0xe615('0x46')],qs['fields'](_0x61a99f[_0xe615('0x43')][_0xe615('0x48')]));_0x5df3ae['attributes']=_0x5df3ae[_0xe615('0x47')][_0xe615('0x49')]?_0x5df3ae[_0xe615('0x47')]:_0x143443['model'];_0x5df3ae['order']=qs[_0xe615('0x4d')](_0x61a99f['query'][_0xe615('0x4d')]);_0x5df3ae['where']=qs[_0xe615('0x44')](_[_0xe615('0x82')](_0x61a99f[_0xe615('0x43')],_0x143443[_0xe615('0x44')]));if(_0x61a99f['query']['filter']){_0x5df3ae[_0xe615('0x4e')]=_[_0xe615('0x50')](_0x5df3ae['where'],{'$or':_[_0xe615('0x3d')](_0x5df3ae['attributes'],function(_0x204d81){var _0x350ccd={};_0x350ccd[_0x204d81]={'$like':'%'+_0x61a99f[_0xe615('0x43')]['filter']+'%'};return _0x350ccd;})});}_0x5df3ae=_['merge']({},_0x5df3ae,_0x61a99f['options']);return _0x1fee32[_0xe615('0xbf')](_0x5df3ae);}})[_0xe615('0x20')](function(_0x289b4c){if(_0x289b4c){_0xd0f9c2=_0x289b4c[_0xe615('0x49')];if(!_0x61a99f[_0xe615('0x43')][_0xe615('0x4a')](_0xe615('0x4b'))){_0x5df3ae['limit']=qs[_0xe615('0x31')](_0x61a99f['query'][_0xe615('0x31')]);_0x5df3ae[_0xe615('0x2f')]=qs[_0xe615('0x2f')](_0x61a99f[_0xe615('0x43')][_0xe615('0x2f')]);}return _0x1fee32[_0xe615('0xbf')](_0x5df3ae);}})[_0xe615('0x20')](function(_0x3b2d88){if(_0x3b2d88){return _0x3b2d88?{'count':_0xd0f9c2,'rows':_0x3b2d88}:null;}})[_0xe615('0x20')](respondWithResult(_0x180e51,null))[_0xe615('0x2b')](handleError(_0x180e51,null));}; \ No newline at end of file +var _0x1d80=['$gte','split','CmList','Contacts','DESC','attachments','join','root','basename','CheckAfterSend','isNil','from','format','\x22%s\x22\x20<%s>','fax','List','CmContact','ListId','List\x20not\x20found','create','out','filename','Messages','spread','ContactId','dataValues','SendFax','SendFaxRpc,\x20%s','addAgents','userFaxAccount:save','removeAgents','isArray','emit','userFaxAccount:remove','getAgents','User','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxAccount.socket','register','jayson/promise','client','http','info','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','destroy','UserProfileResource','then','stack','name','send','index','Pause','mandatoryDispositionPause','map','FaxAccount','rawAttributes','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','merge','type','VIRTUAL','filter','options','findAll','show','keys','includeAll','include','find','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','FaxAccounts','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','addDisposition','params','FaxAccountId','Disposition','getDispositions','findOne','nolimit','rows','removeDispositions','ids','addAnswer','pick','CannedAnswer','removeAnswers','FaxInteraction','addInteraction','omit','getInteractions','Contact','Owner','fullname','internal','Tag','Tags','color','tag','addApplications','transaction','FaxApplication','priority','finally','getApplications','context','from-voip-provider','exten','localstationid','app','system','Fax\x20Extension','appdata','push','Answer','CDR(type)=inbound-fax','Set','headerinfo','maxrate','modem','t38timeout','FAXOPT(','Wait','sequelize','VoiceExtension','updateAccountApplications','bulkCreate','tech','createdAt','updatedAt','TrunkId','findById','getMessages','FaxMessage'];(function(_0x3ebee4,_0x47fb7e){var _0x1eb05e=function(_0xd1fcd7){while(--_0xd1fcd7){_0x3ebee4['push'](_0x3ebee4['shift']());}};_0x1eb05e(++_0x47fb7e);}(_0x1d80,0xe8));var _0x01d8=function(_0x2949e1,_0x51987d){_0x2949e1=_0x2949e1-0x0;var _0x25eb3e=_0x1d80[_0x2949e1];return _0x25eb3e;};'use strict';var emlformat=require(_0x01d8('0x0'));var rimraf=require(_0x01d8('0x1'));var zipdir=require(_0x01d8('0x2'));var jsonpatch=require(_0x01d8('0x3'));var rp=require('request-promise');var moment=require(_0x01d8('0x4'));var BPromise=require(_0x01d8('0x5'));var Mustache=require('mustache');var util=require(_0x01d8('0x6'));var path=require(_0x01d8('0x7'));var sox=require('sox');var csv=require(_0x01d8('0x8'));var ejs=require(_0x01d8('0x9'));var fs=require('fs');var fs_extra=require(_0x01d8('0xa'));var _=require('lodash');var squel=require(_0x01d8('0xb'));var crypto=require('crypto');var jsforce=require(_0x01d8('0xc'));var deskjs=require(_0x01d8('0xd'));var toCsv=require('to-csv');var querystring=require(_0x01d8('0xe'));var Papa=require(_0x01d8('0xf'));var Redis=require(_0x01d8('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x01d8('0x11'));var hardwareService=require(_0x01d8('0x12'));var logger=require(_0x01d8('0x13'))(_0x01d8('0x14'));var utils=require(_0x01d8('0x15'));var config=require(_0x01d8('0x16'));var licenseUtil=require(_0x01d8('0x17'));var db=require(_0x01d8('0x18'))['db'];config[_0x01d8('0x19')]=_[_0x01d8('0x1a')](config[_0x01d8('0x19')],{'host':_0x01d8('0x1b'),'port':0x18eb});var socket=require(_0x01d8('0x1c'))(new Redis(config['redis']));require(_0x01d8('0x1d'))[_0x01d8('0x1e')](socket);var jayson=require(_0x01d8('0x1f'));var client=jayson[_0x01d8('0x20')][_0x01d8('0x21')]({'port':0x232c});var client9002=jayson[_0x01d8('0x20')][_0x01d8('0x21')]({'port':0x232a});function respondWithRpcPromise(_0x43e658,_0x12d135,_0x255371,_0x153ace){return new BPromise(function(_0x33a814,_0x42de54){var _0x3586d0=_0x153ace||client;return _0x3586d0['request'](_0x43e658,_0x255371)['then'](function(_0xc1b056){logger[_0x01d8('0x22')](_0x01d8('0x23'),_0x12d135,_0x01d8('0x24'));logger[_0x01d8('0x25')]('FaxAccount,\x20%s,\x20%s,\x20%s',_0x12d135,_0x01d8('0x24'),JSON[_0x01d8('0x26')](_0xc1b056));if(_0xc1b056[_0x01d8('0x27')]){if(_0xc1b056[_0x01d8('0x27')]['code']===0x1f4){logger[_0x01d8('0x27')](_0x01d8('0x23'),_0x12d135,_0xc1b056['error'][_0x01d8('0x28')]);return _0x42de54(_0xc1b056[_0x01d8('0x27')]['message']);}logger[_0x01d8('0x27')](_0x01d8('0x23'),_0x12d135,_0xc1b056[_0x01d8('0x27')][_0x01d8('0x28')]);return _0x33a814(_0xc1b056['error'][_0x01d8('0x28')]);}else{logger[_0x01d8('0x22')](_0x01d8('0x23'),_0x12d135,'request\x20sent');_0x33a814(_0xc1b056[_0x01d8('0x29')]['message']);}})[_0x01d8('0x2a')](function(_0x2b9900){logger[_0x01d8('0x27')]('FaxAccount,\x20%s,\x20%s',_0x12d135,_0x2b9900);_0x42de54(_0x2b9900);});});}function respondWithStatusCode(_0x21431b,_0x2ab078){_0x2ab078=_0x2ab078||0xcc;return function(_0x3067a1){if(_0x3067a1){return _0x21431b[_0x01d8('0x2b')](_0x2ab078);}return _0x21431b[_0x01d8('0x2c')](_0x2ab078)[_0x01d8('0x2d')]();};}function respondWithResult(_0x57a228,_0x593b04){_0x593b04=_0x593b04||0xc8;return function(_0x36317b){if(_0x36317b){return _0x57a228[_0x01d8('0x2c')](_0x593b04)[_0x01d8('0x2e')](_0x36317b);}};}function respondWithFilteredResult(_0x48bb5f,_0x2d8a14){return function(_0x20717d){if(_0x20717d){var _0x140728=typeof _0x2d8a14[_0x01d8('0x2f')]===_0x01d8('0x30')&&typeof _0x2d8a14[_0x01d8('0x31')]===_0x01d8('0x30');var _0x555d78=_0x20717d[_0x01d8('0x32')];var _0x4e91c9=_0x140728?0x0:_0x2d8a14['offset'];var _0x37c856=_0x140728?_0x20717d[_0x01d8('0x32')]:_0x2d8a14['offset']+_0x2d8a14[_0x01d8('0x31')];var _0x33eef3;if(_0x37c856>=_0x555d78){_0x37c856=_0x555d78;_0x33eef3=0xc8;}else{_0x33eef3=0xce;}_0x48bb5f['status'](_0x33eef3);return _0x48bb5f[_0x01d8('0x33')](_0x01d8('0x34'),_0x4e91c9+'-'+_0x37c856+'/'+_0x555d78)['json'](_0x20717d);}return null;};}function patchUpdates(_0x30fdfd){return function(_0x50522a){try{jsonpatch[_0x01d8('0x35')](_0x50522a,_0x30fdfd,!![]);}catch(_0x434f43){return BPromise['reject'](_0x434f43);}return _0x50522a[_0x01d8('0x36')]();};}function saveUpdates(_0x36fd34,_0x3d403f){return function(_0x1f618a){if(_0x1f618a){return _0x1f618a['update'](_0x36fd34)['then'](function(_0x24b971){return _0x24b971;});}return null;};}function removeEntity(_0x586dfd,_0x387429){return function(_0x4c0119){if(_0x4c0119){return _0x4c0119[_0x01d8('0x37')]()['then'](function(){var _0x2d946a=_0x4c0119['get']({'plain':!![]});var _0x27865e='FaxAccounts';return db[_0x01d8('0x38')][_0x01d8('0x37')]({'where':{'type':_0x27865e,'resourceId':_0x2d946a['id']}})['then'](function(){return _0x4c0119;});})[_0x01d8('0x39')](function(){_0x586dfd[_0x01d8('0x2c')](0xcc)[_0x01d8('0x2d')]();});}};}function handleEntityNotFound(_0x5e5173,_0x16097c){return function(_0x369809){if(!_0x369809){_0x5e5173[_0x01d8('0x2b')](0x194);}return _0x369809;};}function handleError(_0x38dd8e,_0x56f0aa){_0x56f0aa=_0x56f0aa||0x1f4;return function(_0x39bca8){logger[_0x01d8('0x27')](_0x39bca8[_0x01d8('0x3a')]);if(_0x39bca8['name']){delete _0x39bca8[_0x01d8('0x3b')];}_0x38dd8e['status'](_0x56f0aa)[_0x01d8('0x3c')](_0x39bca8);};}exports[_0x01d8('0x3d')]=function(_0x3c3784,_0x2f0308){var _0x428204={'include':[{'model':db[_0x01d8('0x3e')],'as':_0x01d8('0x3f')}]},_0x5a82c7={},_0x450b31={'count':0x0,'rows':[]};var _0x557a83=_[_0x01d8('0x40')](db[_0x01d8('0x41')][_0x01d8('0x42')],function(_0x723d2a){return{'name':_0x723d2a['fieldName'],'type':_0x723d2a['type'][_0x01d8('0x43')]};});_0x5a82c7[_0x01d8('0x44')]=_[_0x01d8('0x40')](_0x557a83,_0x01d8('0x3b'));_0x5a82c7[_0x01d8('0x45')]=_['keys'](_0x3c3784[_0x01d8('0x45')]);_0x5a82c7[_0x01d8('0x46')]=_['intersection'](_0x5a82c7[_0x01d8('0x44')],_0x5a82c7[_0x01d8('0x45')]);_0x428204[_0x01d8('0x47')]=_[_0x01d8('0x48')](_0x5a82c7[_0x01d8('0x44')],qs[_0x01d8('0x49')](_0x3c3784[_0x01d8('0x45')][_0x01d8('0x49')]));_0x428204[_0x01d8('0x47')]=_0x428204['attributes'][_0x01d8('0x4a')]?_0x428204[_0x01d8('0x47')]:_0x5a82c7[_0x01d8('0x44')];if(!_0x3c3784['query'][_0x01d8('0x4b')]('nolimit')){_0x428204['limit']=qs['limit'](_0x3c3784['query'][_0x01d8('0x31')]);_0x428204['offset']=qs[_0x01d8('0x2f')](_0x3c3784[_0x01d8('0x45')][_0x01d8('0x2f')]);}_0x428204[_0x01d8('0x4c')]=qs['sort'](_0x3c3784[_0x01d8('0x45')][_0x01d8('0x4d')]);_0x428204[_0x01d8('0x4e')]=qs[_0x01d8('0x46')](_['pick'](_0x3c3784[_0x01d8('0x45')],_0x5a82c7[_0x01d8('0x46')]),_0x557a83);if(_0x3c3784[_0x01d8('0x45')]['filter']){_0x428204[_0x01d8('0x4e')]=_[_0x01d8('0x4f')](_0x428204[_0x01d8('0x4e')],{'$or':_[_0x01d8('0x40')](_0x557a83,function(_0x1bb020){if(_0x1bb020[_0x01d8('0x50')]!==_0x01d8('0x51')){var _0x39868a={};_0x39868a[_0x1bb020['name']]={'$like':'%'+_0x3c3784[_0x01d8('0x45')][_0x01d8('0x52')]+'%'};return _0x39868a;}})});}_0x428204=_[_0x01d8('0x4f')]({},_0x428204,_0x3c3784[_0x01d8('0x53')]);var _0x4c8df7={'where':_0x428204[_0x01d8('0x4e')]};return db[_0x01d8('0x41')]['count'](_0x4c8df7)[_0x01d8('0x39')](function(_0x53068c){_0x450b31['count']=_0x53068c;if(_0x3c3784[_0x01d8('0x45')]['includeAll']){_0x428204['include']=[{'all':!![]}];}return db['FaxAccount'][_0x01d8('0x54')](_0x428204);})['then'](function(_0x4be82c){_0x450b31['rows']=_0x4be82c;return _0x450b31;})[_0x01d8('0x39')](respondWithFilteredResult(_0x2f0308,_0x428204))[_0x01d8('0x2a')](handleError(_0x2f0308,null));};exports[_0x01d8('0x55')]=function(_0xbe760e,_0x349b71){var _0x3b04c4={'raw':![],'where':{'id':_0xbe760e['params']['id']},'include':[{'model':db[_0x01d8('0x3e')],'as':_0x01d8('0x3f')}]},_0x2e2e07={};_0x2e2e07[_0x01d8('0x44')]=_[_0x01d8('0x56')](db[_0x01d8('0x41')][_0x01d8('0x42')]);_0x2e2e07[_0x01d8('0x45')]=_['keys'](_0xbe760e[_0x01d8('0x45')]);_0x2e2e07[_0x01d8('0x46')]=_[_0x01d8('0x48')](_0x2e2e07[_0x01d8('0x44')],_0x2e2e07['query']);_0x3b04c4['attributes']=_['intersection'](_0x2e2e07['model'],qs[_0x01d8('0x49')](_0xbe760e[_0x01d8('0x45')][_0x01d8('0x49')]));_0x3b04c4[_0x01d8('0x47')]=_0x3b04c4[_0x01d8('0x47')][_0x01d8('0x4a')]?_0x3b04c4[_0x01d8('0x47')]:_0x2e2e07[_0x01d8('0x44')];if(_0xbe760e[_0x01d8('0x45')][_0x01d8('0x57')]){_0x3b04c4[_0x01d8('0x58')]=[{'all':!![]}];}_0x3b04c4=_[_0x01d8('0x4f')]({},_0x3b04c4,_0xbe760e[_0x01d8('0x53')]);return db[_0x01d8('0x41')][_0x01d8('0x59')](_0x3b04c4)[_0x01d8('0x39')](handleEntityNotFound(_0x349b71,null))[_0x01d8('0x39')](respondWithResult(_0x349b71,null))['catch'](handleError(_0x349b71,null));};exports['create']=function(_0x4fa2f4,_0x1f512e){return db[_0x01d8('0x41')]['create'](_0x4fa2f4[_0x01d8('0x5a')],{})[_0x01d8('0x39')](function(_0x16c7b1){var _0x37f9a9=_0x4fa2f4[_0x01d8('0x5b')]['get']({'plain':!![]});if(!_0x37f9a9)throw new Error(_0x01d8('0x5c'));if(_0x37f9a9[_0x01d8('0x5d')]===_0x01d8('0x5b')){var _0xa63499=_0x16c7b1['get']({'plain':!![]});var _0x30951d=_0x01d8('0x5e');return db[_0x01d8('0x5f')][_0x01d8('0x59')]({'where':{'name':_0x30951d,'userProfileId':_0x37f9a9['userProfileId']},'raw':!![]})[_0x01d8('0x39')](function(_0x1b243f){if(_0x1b243f&&_0x1b243f[_0x01d8('0x60')]===0x0){return db['UserProfileResource']['create']({'name':_0xa63499[_0x01d8('0x3b')],'resourceId':_0xa63499['id'],'type':_0x1b243f[_0x01d8('0x3b')],'sectionId':_0x1b243f['id']},{})[_0x01d8('0x39')](function(){return _0x16c7b1;});}else{return _0x16c7b1;}})[_0x01d8('0x2a')](function(_0x1db132){logger['error'](_0x01d8('0x61'),_0x1db132);throw _0x1db132;});}return _0x16c7b1;})[_0x01d8('0x39')](respondWithResult(_0x1f512e,0xc9))[_0x01d8('0x2a')](handleError(_0x1f512e,null));};exports[_0x01d8('0x62')]=function(_0x4e8811,_0x1b3bca){if(_0x4e8811[_0x01d8('0x5a')]['id']){delete _0x4e8811[_0x01d8('0x5a')]['id'];}return db[_0x01d8('0x41')]['find']({'where':{'id':_0x4e8811['params']['id']},'include':[{'model':db[_0x01d8('0x3e')],'as':_0x01d8('0x3f')}]})[_0x01d8('0x39')](handleEntityNotFound(_0x1b3bca,null))[_0x01d8('0x39')](saveUpdates(_0x4e8811['body'],null))[_0x01d8('0x39')](respondWithResult(_0x1b3bca,null))['catch'](handleError(_0x1b3bca,null));};exports[_0x01d8('0x37')]=function(_0x477e53,_0x35812a){return db[_0x01d8('0x41')][_0x01d8('0x59')]({'where':{'id':_0x477e53['params']['id']}})[_0x01d8('0x39')](handleEntityNotFound(_0x35812a,null))[_0x01d8('0x39')](removeEntity(_0x35812a,null))[_0x01d8('0x2a')](handleError(_0x35812a,null));};exports['describe']=function(_0x4059c0,_0x374cdb){return db['FaxAccount']['describe']()[_0x01d8('0x39')](respondWithResult(_0x374cdb,null))[_0x01d8('0x2a')](handleError(_0x374cdb,null));};exports[_0x01d8('0x63')]=function(_0xc64b5,_0x12dce4,_0x459da9){if(_0xc64b5[_0x01d8('0x5a')]['id']){delete _0xc64b5[_0x01d8('0x5a')]['id'];}return db['FaxAccount']['find']({'where':{'id':_0xc64b5[_0x01d8('0x64')]['id']}})[_0x01d8('0x39')](handleEntityNotFound(_0x12dce4,null))[_0x01d8('0x39')](function(_0x3275b6){if(_0x3275b6){_0xc64b5[_0x01d8('0x5a')][_0x01d8('0x65')]=_0x3275b6['id'];return db[_0x01d8('0x66')]['create'](_0xc64b5[_0x01d8('0x5a')]);}})[_0x01d8('0x39')](respondWithResult(_0x12dce4,null))[_0x01d8('0x2a')](handleError(_0x12dce4,null));};exports[_0x01d8('0x67')]=function(_0x36c338,_0x1be7ef,_0x1464a3){var _0x5f1357={'raw':![],'where':{}};var _0x317d42={};var _0xa2416={'count':0x0,'rows':[]};return db[_0x01d8('0x41')][_0x01d8('0x68')]({'where':{'id':_0x36c338[_0x01d8('0x64')]['id']}})[_0x01d8('0x39')](handleEntityNotFound(_0x1be7ef,null))['then'](function(_0x128eae){if(_0x128eae){_0x317d42[_0x01d8('0x44')]=_[_0x01d8('0x56')](db['Disposition']['rawAttributes']);_0x317d42[_0x01d8('0x45')]=_[_0x01d8('0x56')](_0x36c338[_0x01d8('0x45')]);_0x317d42['filters']=_['intersection'](_0x317d42[_0x01d8('0x44')],_0x317d42[_0x01d8('0x45')]);_0x5f1357[_0x01d8('0x47')]=_[_0x01d8('0x48')](_0x317d42['model'],qs[_0x01d8('0x49')](_0x36c338['query'][_0x01d8('0x49')]));_0x5f1357[_0x01d8('0x47')]=_0x5f1357[_0x01d8('0x47')][_0x01d8('0x4a')]?_0x5f1357['attributes']:_0x317d42[_0x01d8('0x44')];if(!_0x36c338[_0x01d8('0x45')][_0x01d8('0x4b')](_0x01d8('0x69'))){_0x5f1357[_0x01d8('0x31')]=qs[_0x01d8('0x31')](_0x36c338[_0x01d8('0x45')]['limit']);_0x5f1357['offset']=qs[_0x01d8('0x2f')](_0x36c338[_0x01d8('0x45')][_0x01d8('0x2f')]);}_0x5f1357[_0x01d8('0x4c')]=qs[_0x01d8('0x4d')](_0x36c338['query']['sort']);_0x5f1357[_0x01d8('0x4e')]=qs[_0x01d8('0x46')](_['pick'](_0x36c338['query'],_0x317d42[_0x01d8('0x46')]));_0x5f1357[_0x01d8('0x4e')][_0x01d8('0x65')]=_0x128eae['id'];if(_0x36c338[_0x01d8('0x45')][_0x01d8('0x52')]){_0x5f1357[_0x01d8('0x4e')]=_[_0x01d8('0x4f')](_0x5f1357[_0x01d8('0x4e')],{'$or':_[_0x01d8('0x40')](_0x5f1357['attributes'],function(_0x25d8ed){var _0x1ced71={};_0x1ced71[_0x25d8ed]={'$like':'%'+_0x36c338[_0x01d8('0x45')]['filter']+'%'};return _0x1ced71;})});}_0x5f1357=_['merge']({},_0x5f1357,_0x36c338[_0x01d8('0x53')]);return db[_0x01d8('0x66')]['count']({'where':_0x5f1357['where']})['then'](function(_0xe7c81){_0xa2416[_0x01d8('0x32')]=_0xe7c81;if(_0x36c338[_0x01d8('0x45')]['includeAll']){_0x5f1357[_0x01d8('0x58')]=[{'all':!![]}];}return db['Disposition'][_0x01d8('0x54')](_0x5f1357);})['then'](function(_0x39c4ae){_0xa2416[_0x01d8('0x6a')]=_0x39c4ae;return _0xa2416;});}})[_0x01d8('0x39')](respondWithFilteredResult(_0x1be7ef,_0x5f1357))[_0x01d8('0x2a')](handleError(_0x1be7ef,null));};exports[_0x01d8('0x6b')]=function(_0x5e77ed,_0x3b93ed,_0x2febd3){return db['FaxAccount'][_0x01d8('0x59')]({'where':{'id':_0x5e77ed[_0x01d8('0x64')]['id']}})['then'](handleEntityNotFound(_0x3b93ed,null))[_0x01d8('0x39')](function(_0x2fa30f){if(_0x2fa30f){return _0x2fa30f[_0x01d8('0x6b')](_0x5e77ed[_0x01d8('0x45')][_0x01d8('0x6c')]);}})['then'](respondWithStatusCode(_0x3b93ed,null))['catch'](handleError(_0x3b93ed,null));};exports[_0x01d8('0x6d')]=function(_0xca252e,_0x36bd43,_0x2f0553){if(_0xca252e[_0x01d8('0x5a')]['id']){delete _0xca252e[_0x01d8('0x5a')]['id'];}return db['FaxAccount'][_0x01d8('0x59')]({'where':{'id':_0xca252e[_0x01d8('0x64')]['id']}})[_0x01d8('0x39')](handleEntityNotFound(_0x36bd43,null))['then'](function(_0x1ce99f){if(_0x1ce99f){_0xca252e[_0x01d8('0x5a')][_0x01d8('0x65')]=_0x1ce99f['id'];return db['CannedAnswer']['create'](_0xca252e[_0x01d8('0x5a')]);}})['then'](respondWithResult(_0x36bd43,null))[_0x01d8('0x2a')](handleError(_0x36bd43,null));};exports['getAnswers']=function(_0x52c140,_0x4a589c,_0x30e972){var _0x16117a={'raw':![],'where':{}};var _0x2dd283={};var _0xe3abfe={'count':0x0,'rows':[]};return db[_0x01d8('0x41')][_0x01d8('0x68')]({'where':{'id':_0x52c140['params']['id']}})[_0x01d8('0x39')](handleEntityNotFound(_0x4a589c,null))[_0x01d8('0x39')](function(_0x584acf){if(_0x584acf){_0x2dd283[_0x01d8('0x44')]=_[_0x01d8('0x56')](db['CannedAnswer']['rawAttributes']);_0x2dd283[_0x01d8('0x45')]=_['keys'](_0x52c140[_0x01d8('0x45')]);_0x2dd283[_0x01d8('0x46')]=_[_0x01d8('0x48')](_0x2dd283['model'],_0x2dd283[_0x01d8('0x45')]);_0x16117a[_0x01d8('0x47')]=_['intersection'](_0x2dd283[_0x01d8('0x44')],qs[_0x01d8('0x49')](_0x52c140[_0x01d8('0x45')][_0x01d8('0x49')]));_0x16117a[_0x01d8('0x47')]=_0x16117a[_0x01d8('0x47')][_0x01d8('0x4a')]?_0x16117a[_0x01d8('0x47')]:_0x2dd283[_0x01d8('0x44')];if(!_0x52c140[_0x01d8('0x45')][_0x01d8('0x4b')](_0x01d8('0x69'))){_0x16117a['limit']=qs[_0x01d8('0x31')](_0x52c140[_0x01d8('0x45')][_0x01d8('0x31')]);_0x16117a[_0x01d8('0x2f')]=qs['offset'](_0x52c140[_0x01d8('0x45')][_0x01d8('0x2f')]);}_0x16117a[_0x01d8('0x4c')]=qs[_0x01d8('0x4d')](_0x52c140[_0x01d8('0x45')][_0x01d8('0x4d')]);_0x16117a[_0x01d8('0x4e')]=qs[_0x01d8('0x46')](_[_0x01d8('0x6e')](_0x52c140['query'],_0x2dd283['filters']));_0x16117a[_0x01d8('0x4e')][_0x01d8('0x65')]=_0x584acf['id'];if(_0x52c140[_0x01d8('0x45')][_0x01d8('0x52')]){_0x16117a[_0x01d8('0x4e')]=_[_0x01d8('0x4f')](_0x16117a['where'],{'$or':_[_0x01d8('0x40')](_0x16117a[_0x01d8('0x47')],function(_0x5cc5f5){var _0x3f2fd1={};_0x3f2fd1[_0x5cc5f5]={'$like':'%'+_0x52c140[_0x01d8('0x45')][_0x01d8('0x52')]+'%'};return _0x3f2fd1;})});}_0x16117a=_[_0x01d8('0x4f')]({},_0x16117a,_0x52c140[_0x01d8('0x53')]);return db[_0x01d8('0x6f')][_0x01d8('0x32')]({'where':_0x16117a[_0x01d8('0x4e')]})[_0x01d8('0x39')](function(_0x41b668){_0xe3abfe[_0x01d8('0x32')]=_0x41b668;if(_0x52c140['query'][_0x01d8('0x57')]){_0x16117a[_0x01d8('0x58')]=[{'all':!![]}];}return db[_0x01d8('0x6f')][_0x01d8('0x54')](_0x16117a);})[_0x01d8('0x39')](function(_0x1bbcac){_0xe3abfe['rows']=_0x1bbcac;return _0xe3abfe;});}})[_0x01d8('0x39')](respondWithFilteredResult(_0x4a589c,_0x16117a))[_0x01d8('0x2a')](handleError(_0x4a589c,null));};exports[_0x01d8('0x70')]=function(_0x577824,_0x23a777,_0x71a0c4){return db[_0x01d8('0x41')][_0x01d8('0x59')]({'where':{'id':_0x577824[_0x01d8('0x64')]['id']}})['then'](handleEntityNotFound(_0x23a777,null))[_0x01d8('0x39')](function(_0x7854f5){if(_0x7854f5){return _0x7854f5[_0x01d8('0x70')](_0x577824[_0x01d8('0x45')][_0x01d8('0x6c')]);}})['then'](respondWithStatusCode(_0x23a777,null))[_0x01d8('0x2a')](handleError(_0x23a777,null));};exports['addInteraction']=function(_0x9090b3,_0x3e7981,_0x56477c){return db[_0x01d8('0x71')][_0x01d8('0x59')]({'where':{'id':_0x9090b3[_0x01d8('0x64')]['id']}})[_0x01d8('0x39')](handleEntityNotFound(_0x3e7981,null))[_0x01d8('0x39')](function(_0x5b5922){if(_0x5b5922){return _0x5b5922[_0x01d8('0x72')](_0x9090b3['body'][_0x01d8('0x6c')],_[_0x01d8('0x73')](_0x9090b3['body'],[_0x01d8('0x6c'),'id'])||{});}})[_0x01d8('0x39')](respondWithResult(_0x3e7981,null))['catch'](handleError(_0x3e7981,null));};exports[_0x01d8('0x74')]=function(_0x11e501,_0x4161f3,_0x16d218){var _0x59e788={'raw':![],'where':{}};var _0x8012f9={};var _0x1bdf74={'count':0x0,'rows':[]};return db['FaxAccount'][_0x01d8('0x68')]({'where':{'id':_0x11e501[_0x01d8('0x64')]['id']}})[_0x01d8('0x39')](handleEntityNotFound(_0x4161f3,null))[_0x01d8('0x39')](function(_0x51a620){if(_0x51a620){_0x8012f9[_0x01d8('0x44')]=_['keys'](db[_0x01d8('0x71')][_0x01d8('0x42')]);_0x8012f9[_0x01d8('0x45')]=_['keys'](_0x11e501[_0x01d8('0x45')]);_0x8012f9[_0x01d8('0x46')]=_[_0x01d8('0x48')](_0x8012f9[_0x01d8('0x44')],_0x8012f9[_0x01d8('0x45')]);_0x59e788[_0x01d8('0x47')]=_[_0x01d8('0x48')](_0x8012f9['model'],qs[_0x01d8('0x49')](_0x11e501[_0x01d8('0x45')][_0x01d8('0x49')]));_0x59e788[_0x01d8('0x47')]=_0x59e788[_0x01d8('0x47')][_0x01d8('0x4a')]?_0x59e788[_0x01d8('0x47')]:_0x8012f9['model'];if(!_0x11e501[_0x01d8('0x45')][_0x01d8('0x4b')](_0x01d8('0x69'))){_0x59e788[_0x01d8('0x31')]=qs[_0x01d8('0x31')](_0x11e501[_0x01d8('0x45')][_0x01d8('0x31')]);_0x59e788[_0x01d8('0x2f')]=qs[_0x01d8('0x2f')](_0x11e501[_0x01d8('0x45')]['offset']);}_0x59e788[_0x01d8('0x4c')]=qs[_0x01d8('0x4d')](_0x11e501[_0x01d8('0x45')][_0x01d8('0x4d')]);_0x59e788[_0x01d8('0x4e')]=qs[_0x01d8('0x46')](_[_0x01d8('0x6e')](_0x11e501[_0x01d8('0x45')],_0x8012f9[_0x01d8('0x46')]));_0x59e788[_0x01d8('0x4e')]['FaxAccountId']=_0x51a620['id'];if(_0x11e501[_0x01d8('0x45')]['filter']){_0x59e788[_0x01d8('0x4e')]=_[_0x01d8('0x4f')](_0x59e788[_0x01d8('0x4e')],{'$or':_[_0x01d8('0x40')](_0x59e788[_0x01d8('0x47')],function(_0x5531bc){var _0x1a76d5={};_0x1a76d5[_0x5531bc]={'$like':'%'+_0x11e501[_0x01d8('0x45')][_0x01d8('0x52')]+'%'};return _0x1a76d5;})});}_0x59e788=_[_0x01d8('0x4f')]({},_0x59e788,_0x11e501[_0x01d8('0x53')]);return db[_0x01d8('0x71')][_0x01d8('0x32')]({'where':_0x59e788[_0x01d8('0x4e')]})[_0x01d8('0x39')](function(_0x4f5494){_0x1bdf74[_0x01d8('0x32')]=_0x4f5494;if(_0x11e501[_0x01d8('0x45')][_0x01d8('0x57')]){_0x59e788[_0x01d8('0x58')]=[{'model':db['CmContact'],'as':_0x01d8('0x75'),'required':![]},{'model':db['User'],'as':_0x01d8('0x76'),'attributes':[_0x01d8('0x3b'),_0x01d8('0x77'),_0x01d8('0x78')],'required':![]},{'model':db[_0x01d8('0x79')],'as':_0x01d8('0x7a'),'attributes':['id',_0x01d8('0x3b'),_0x01d8('0x7b')],'where':_0x11e501[_0x01d8('0x45')]['tag']?{'id':_0x11e501[_0x01d8('0x45')][_0x01d8('0x7c')]}:undefined,'required':_0x11e501[_0x01d8('0x45')][_0x01d8('0x7c')]?!![]:![]}];}return db['FaxInteraction'][_0x01d8('0x54')](_0x59e788);})[_0x01d8('0x39')](function(_0xd02134){_0x1bdf74['rows']=_0xd02134;return _0x1bdf74;});}})[_0x01d8('0x39')](respondWithFilteredResult(_0x4161f3,_0x59e788))[_0x01d8('0x2a')](handleError(_0x4161f3,null));};exports[_0x01d8('0x7d')]=function(_0xcda7e4,_0xff9089){var _0x1485ad=_0xcda7e4['params']['id'];var _0x5ac4ff=_0xcda7e4[_0x01d8('0x5a')];var _0x50b987=0xc8;var _0x334d17=null;return db['sequelize'][_0x01d8('0x7e')]({'isolationLevel':db['sequelize']['Transaction']['ISOLATION_LEVELS']['READ_COMMITTED']},function(_0x446ea2){return db[_0x01d8('0x41')][_0x01d8('0x68')]({'where':{'id':_0x1485ad},'transaction':_0x446ea2})[_0x01d8('0x39')](function(_0x36b5ac){if(_0x36b5ac){return db[_0x01d8('0x7f')][_0x01d8('0x37')]({'where':{'FaxAccountId':_0x1485ad},'transaction':_0x446ea2})[_0x01d8('0x39')](function(){var _0x5d811a=_[_0x01d8('0x40')](_0x5ac4ff,function(_0x15d7be){_0x15d7be[_0x01d8('0x65')]=_0x1485ad;return _0x15d7be;});return db['FaxApplication']['bulkCreate'](_0x5d811a,{'transaction':_0x446ea2});});}else{_0x50b987=0x194;_0x334d17=[];}});})[_0x01d8('0x39')](function(){if(_0x50b987!==0x194){return db['FaxApplication']['findAndCountAll']({'where':{'FaxAccountId':_0x1485ad},'order':_0x01d8('0x80')})[_0x01d8('0x39')](function(_0x4f2ecc){_0x334d17=_0x4f2ecc;});}})[_0x01d8('0x2a')](function(_0x55981a){_0x50b987=0x1f4;logger[_0x01d8('0x27')](_0x55981a['stack']);if(_0x55981a[_0x01d8('0x3b')]){delete _0x55981a[_0x01d8('0x3b')];}_0x334d17=_0x55981a;})[_0x01d8('0x81')](function(){if(_0x334d17===null){_0xff9089['sendStatus'](_0x50b987);}else{if(_0x50b987===0x1f4){_0xff9089[_0x01d8('0x2c')](_0x50b987)[_0x01d8('0x3c')](_0x334d17);}else{_0xff9089[_0x01d8('0x2c')](_0x50b987)[_0x01d8('0x2e')](_0x334d17);}}});};exports['getApplications']=function(_0x306fb1,_0x33b8d3,_0x4f408b){var _0x1b8e14={};var _0x22318b={};var _0x24013d;var _0x2f9295;return db[_0x01d8('0x41')][_0x01d8('0x68')]({'where':{'id':_0x306fb1[_0x01d8('0x64')]['id']}})['then'](handleEntityNotFound(_0x33b8d3,null))[_0x01d8('0x39')](function(_0x2bd6f7){if(_0x2bd6f7){_0x24013d=_0x2bd6f7;_0x22318b['model']=_[_0x01d8('0x56')](db[_0x01d8('0x7f')][_0x01d8('0x42')]);_0x22318b[_0x01d8('0x45')]=_[_0x01d8('0x56')](_0x306fb1[_0x01d8('0x45')]);_0x22318b[_0x01d8('0x46')]=_[_0x01d8('0x48')](_0x22318b[_0x01d8('0x44')],_0x22318b['query']);_0x1b8e14[_0x01d8('0x47')]=_[_0x01d8('0x48')](_0x22318b['model'],qs[_0x01d8('0x49')](_0x306fb1[_0x01d8('0x45')][_0x01d8('0x49')]));_0x1b8e14[_0x01d8('0x47')]=_0x1b8e14[_0x01d8('0x47')][_0x01d8('0x4a')]?_0x1b8e14[_0x01d8('0x47')]:_0x22318b['model'];_0x1b8e14[_0x01d8('0x4c')]=qs[_0x01d8('0x4d')](_0x306fb1[_0x01d8('0x45')][_0x01d8('0x4d')]);_0x1b8e14[_0x01d8('0x4e')]=qs[_0x01d8('0x46')](_['pick'](_0x306fb1[_0x01d8('0x45')],_0x22318b[_0x01d8('0x46')]));if(_0x306fb1['query'][_0x01d8('0x52')]){_0x1b8e14[_0x01d8('0x4e')]=_[_0x01d8('0x4f')](_0x1b8e14[_0x01d8('0x4e')],{'$or':_[_0x01d8('0x40')](_0x1b8e14[_0x01d8('0x47')],function(_0x184ca6){var _0x4ba473={};_0x4ba473[_0x184ca6]={'$like':'%'+_0x306fb1[_0x01d8('0x45')]['filter']+'%'};return _0x4ba473;})});}_0x1b8e14=_[_0x01d8('0x4f')]({},_0x1b8e14,_0x306fb1['options']);return _0x24013d[_0x01d8('0x82')](_0x1b8e14);}})[_0x01d8('0x39')](function(_0x1fec73){if(_0x1fec73){_0x2f9295=_0x1fec73['length'];if(!_0x306fb1[_0x01d8('0x45')][_0x01d8('0x4b')](_0x01d8('0x69'))){_0x1b8e14['limit']=qs['limit'](_0x306fb1[_0x01d8('0x45')][_0x01d8('0x31')]);_0x1b8e14[_0x01d8('0x2f')]=qs[_0x01d8('0x2f')](_0x306fb1[_0x01d8('0x45')]['offset']);}return _0x24013d[_0x01d8('0x82')](_0x1b8e14);}})[_0x01d8('0x39')](function(_0xf807a7){if(_0xf807a7){return _0xf807a7?{'count':_0x2f9295,'rows':_0xf807a7}:null;}})[_0x01d8('0x39')](respondWithResult(_0x33b8d3,null))['catch'](handleError(_0x33b8d3,null));};function Extension(_0x25a616,_0x538a0d,_0x55911b,_0x2325ff){this[_0x01d8('0x83')]=_0x01d8('0x84');this[_0x01d8('0x85')]=_0x25a616[_0x01d8('0x86')];this[_0x01d8('0x87')]=_0x2325ff;this[_0x01d8('0x50')]=_0x01d8('0x88');this['description']=_0x01d8('0x89');this['FaxAccountId']=_0x25a616['id'];this[_0x01d8('0x80')]=_0x538a0d;this[_0x01d8('0x8a')]=_0x55911b;}function createExtensionsReciveFax(_0x586259){var _0x62b66b=0x1;var _0x5f3fd2=[];_0x5f3fd2[_0x01d8('0x8b')](new Extension(_0x586259,_0x62b66b,'',_0x01d8('0x8c')));_0x62b66b+=0x1;_0x5f3fd2['push'](new Extension(_0x586259,_0x62b66b,_0x01d8('0x8d'),_0x01d8('0x8e')));_0x62b66b+=0x1;for(var _0x1dc8b3 in _0x586259){if(_0x586259[_0x01d8('0x4b')](_0x1dc8b3)&&(_0x1dc8b3==='ecm'||_0x1dc8b3===_0x01d8('0x86')||_0x1dc8b3==='gateway'||_0x1dc8b3==='faxdetect'||_0x1dc8b3===_0x01d8('0x8f')||_0x1dc8b3===_0x01d8('0x90')||_0x1dc8b3==='minrate'||_0x1dc8b3===_0x01d8('0x91')||_0x1dc8b3===_0x01d8('0x92'))){_0x5f3fd2[_0x01d8('0x8b')](new Extension(_0x586259,_0x62b66b,_0x01d8('0x93')+_0x1dc8b3+')='+_0x586259[_0x1dc8b3],'Set'));_0x62b66b+=0x1;}}_0x5f3fd2[_0x01d8('0x8b')](new Extension(_0x586259,_0x62b66b,'6',_0x01d8('0x94')));_0x62b66b+=0x1;_0x5f3fd2[_0x01d8('0x8b')](new Extension(_0x586259,_0x62b66b,'/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'));_0x62b66b=0x0;return _0x5f3fd2;}exports['addAccountApplications']=function(_0x35d7f6,_0x3b88d0,_0x33bf6e){var _0x830074;return db[_0x01d8('0x95')][_0x01d8('0x7e')](function(_0x39ba44){return db[_0x01d8('0x41')]['create'](_0x35d7f6[_0x01d8('0x5a')],{'transaction':_0x39ba44})['then'](function(_0x355902){_0x830074=_0x355902['get']({'plain':!![]});return db[_0x01d8('0x96')]['bulkCreate'](createExtensionsReciveFax(_0x830074),{'transaction':_0x39ba44});});})['then'](function(){return _0x830074;})[_0x01d8('0x39')](respondWithResult(_0x3b88d0,null))[_0x01d8('0x2a')](handleError(_0x3b88d0,null));};exports[_0x01d8('0x97')]=function(_0xd1fcb7,_0x2a4ae3,_0x1a7607){var _0x46e821;return db[_0x01d8('0x95')]['transaction'](function(_0x214dbf){return db['FaxAccount']['update'](_0xd1fcb7[_0x01d8('0x5a')],{'where':{'id':_0xd1fcb7[_0x01d8('0x5a')]['id']},'transaction':_0x214dbf})[_0x01d8('0x39')](function(_0x59d1c3){return db[_0x01d8('0x96')]['destroy']({'where':{'FaxAccountId':_0xd1fcb7[_0x01d8('0x5a')]['id']},'transaction':_0x214dbf})['then'](function(_0x2db002){return db[_0x01d8('0x96')][_0x01d8('0x98')](createExtensionsReciveFax(_[_0x01d8('0x73')](_0xd1fcb7[_0x01d8('0x5a')],[_0x01d8('0x99'),_0x01d8('0x43'),_0x01d8('0x9a'),_0x01d8('0x9b'),_0x01d8('0x9c'),'ListId'])),{'transaction':_0x214dbf});});});})[_0x01d8('0x39')](function(){return db['FaxAccount'][_0x01d8('0x9d')](_0xd1fcb7[_0x01d8('0x5a')]['id']);})['then'](respondWithResult(_0x2a4ae3,null))[_0x01d8('0x2a')](handleError(_0x2a4ae3,null));};exports[_0x01d8('0x9e')]=function(_0x45831b,_0x3b8caf,_0x1d3692){var _0x1f123a={'raw':!![],'where':{}};var _0x38cb59={};var _0x5c9dff={'count':0x0,'rows':[]};return db[_0x01d8('0x41')][_0x01d8('0x68')]({'where':{'id':_0x45831b[_0x01d8('0x64')]['id']}})[_0x01d8('0x39')](handleEntityNotFound(_0x3b8caf,null))[_0x01d8('0x39')](function(_0x510b1e){if(_0x510b1e){_0x38cb59[_0x01d8('0x44')]=_[_0x01d8('0x56')](db[_0x01d8('0x9f')][_0x01d8('0x42')]);_0x38cb59[_0x01d8('0x45')]=_['keys'](_0x45831b[_0x01d8('0x45')]);_0x38cb59[_0x01d8('0x46')]=_[_0x01d8('0x48')](_0x38cb59[_0x01d8('0x44')],_0x38cb59[_0x01d8('0x45')]);_0x1f123a[_0x01d8('0x47')]=_[_0x01d8('0x48')](_0x38cb59[_0x01d8('0x44')],qs['fields'](_0x45831b[_0x01d8('0x45')][_0x01d8('0x49')]));_0x1f123a[_0x01d8('0x47')]=_0x1f123a[_0x01d8('0x47')]['length']?_0x1f123a['attributes']:_0x38cb59[_0x01d8('0x44')];if(!_0x45831b[_0x01d8('0x45')][_0x01d8('0x4b')]('nolimit')){_0x1f123a[_0x01d8('0x31')]=qs[_0x01d8('0x31')](_0x45831b[_0x01d8('0x45')][_0x01d8('0x31')]);_0x1f123a['offset']=qs[_0x01d8('0x2f')](_0x45831b['query'][_0x01d8('0x2f')]);}_0x1f123a['order']=qs[_0x01d8('0x4d')](_0x45831b['query'][_0x01d8('0x4d')]);_0x1f123a[_0x01d8('0x4e')]=qs['filters'](_[_0x01d8('0x6e')](_0x45831b[_0x01d8('0x45')],_0x38cb59['filters']));_0x1f123a['where'][_0x01d8('0x65')]=_0x510b1e['id'];if(_0x45831b[_0x01d8('0x45')][_0x01d8('0x52')]){_0x1f123a['where']=_['merge'](_0x1f123a[_0x01d8('0x4e')],{'$or':_[_0x01d8('0x40')](_0x1f123a['attributes'],function(_0x1f4704){var _0x5c28df={};_0x5c28df[_0x1f4704]={'$like':'%'+_0x45831b['query'][_0x01d8('0x52')]+'%'};return _0x5c28df;})});}if(_0x45831b['query'][_0x01d8('0xa0')]){var _0x5e0a47=_0x45831b[_0x01d8('0x45')][_0x01d8('0xa0')][_0x01d8('0xa1')](',');var _0x1cd2f2={};_0x1cd2f2[_0x5e0a47[0x0]]={'$gte':moment(_0x5e0a47[0x1])['format']('YYYY-MM-DD\x20HH:mm:ss')};_0x1f123a['where']=_[_0x01d8('0x4f')](_0x1f123a[_0x01d8('0x4e')],_0x1cd2f2);}_0x1f123a=_[_0x01d8('0x4f')]({},_0x1f123a,_0x45831b[_0x01d8('0x53')]);return db[_0x01d8('0x9f')][_0x01d8('0x32')]({'where':_0x1f123a['where']})[_0x01d8('0x39')](function(_0x3fd6d9){_0x5c9dff[_0x01d8('0x32')]=_0x3fd6d9;if(_0x45831b[_0x01d8('0x45')][_0x01d8('0x57')]){_0x1f123a['include']=[{'all':!![]}];}return db['FaxMessage'][_0x01d8('0x54')](_0x1f123a);})[_0x01d8('0x39')](function(_0x26f92b){_0x5c9dff['rows']=_0x26f92b;return _0x5c9dff;});}})[_0x01d8('0x39')](respondWithFilteredResult(_0x3b8caf,_0x1f123a))[_0x01d8('0x2a')](handleError(_0x3b8caf,null));};exports[_0x01d8('0x3c')]=function(_0x4568a8,_0x4fa68a,_0x20b880){var _0x2a0a90,_0x14e8a1={},_0x2dd960;if(_0x4568a8[_0x01d8('0x5a')]['to']){_0x2dd960=_0x4568a8['body']['to'][0x0];}return db['FaxAccount'][_0x01d8('0x59')]({'where':{'id':_0x4568a8[_0x01d8('0x64')]['id']},'include':[{'model':db[_0x01d8('0xa2')],'as':'List','include':[{'model':db['CmContact'],'as':_0x01d8('0xa3'),'where':{'fax':_0x2dd960},'limit':0x1,'order':[['updatedAt',_0x01d8('0xa4')]]}]}]})[_0x01d8('0x39')](handleEntityNotFound(_0x4fa68a,null))['then'](function(_0x142033){_0x2a0a90=_0x142033;if(_0x4568a8[_0x01d8('0x5a')]['attachments']&&_0x4568a8[_0x01d8('0x5a')][_0x01d8('0xa5')][_0x01d8('0x4a')]){for(var _0x451472=0x0;_0x451472<_0x4568a8[_0x01d8('0x5a')][_0x01d8('0xa5')][_0x01d8('0x4a')];_0x451472+=0x1){_0x4568a8[_0x01d8('0x5a')]['attachments'][_0x451472]={'filename':_0x4568a8[_0x01d8('0x5a')][_0x01d8('0xa5')][_0x451472][_0x01d8('0x3b')],'id':_0x4568a8[_0x01d8('0x5a')][_0x01d8('0xa5')][_0x451472]['id'],'path':path[_0x01d8('0xa6')](config[_0x01d8('0xa7')],'server/files/attachments',_0x4568a8['body']['attachments'][_0x451472][_0x01d8('0xa8')])};}}return respondWithRpcPromise(_0x01d8('0xa9'),'CheckAfterSend',{'FaxAccountId':_[_0x01d8('0xaa')](_0x4568a8['params']['id'])?undefined:_0x4568a8['params']['id'],'path':_[_0x01d8('0xaa')](_0x4568a8[_0x01d8('0x5a')][_0x01d8('0xa5')][0x0]['path'])?undefined:_0x4568a8[_0x01d8('0x5a')][_0x01d8('0xa5')][0x0][_0x01d8('0x7')],'fax':_[_0x01d8('0xaa')](_0x4568a8[_0x01d8('0x5a')]['to'][0x0])?undefined:_0x4568a8[_0x01d8('0x5a')]['to'][0x0]},client9002);})['then'](function(){if(_0x2a0a90){if(_['isNil'](_0x4568a8[_0x01d8('0x5a')][_0x01d8('0xab')])){_0x4568a8[_0x01d8('0x5a')]['from']=util[_0x01d8('0xac')](_0x01d8('0xad'),_0x2a0a90['name'],_0x2a0a90[_0x01d8('0xae')]);}if(_0x2a0a90[_0x01d8('0xaf')]){if(_0x2a0a90[_0x01d8('0xaf')]['Contacts']['length']){return _0x2a0a90[_0x01d8('0xaf')][_0x01d8('0xa3')][0x0];}else{return db[_0x01d8('0xb0')]['create'](_[_0x01d8('0x1a')](_0x4568a8[_0x01d8('0x5a')],{'firstName':_0x4568a8[_0x01d8('0x5a')]['to'][0x0],'phone':_0x4568a8['body']['to'][0x0],'fax':_0x4568a8[_0x01d8('0x5a')]['to'][0x0],'ListId':_0x2a0a90[_0x01d8('0xb1')]}));}}else{throw new Error(_0x01d8('0xb2'));}}else{throw new Error('Send\x20Fax\x20failed');}})[_0x01d8('0x39')](function(_0x10a966){if(_0x10a966){return db[_0x01d8('0x71')][_0x01d8('0x59')]({'where':{'ContactId':_0x10a966['id'],'closed':![],'FaxAccountId':_0x2a0a90['id']}})[_0x01d8('0x39')](function(_0x4e7126){if(_0x4e7126){return[_0x4e7126,![]];}return db[_0x01d8('0x71')][_0x01d8('0xb3')]({'UserId':_0x4568a8[_0x01d8('0x5b')]['id'],'ContactId':_0x10a966['id'],'FaxAccountId':_0x2a0a90['id'],'fax':_0x4568a8[_0x01d8('0x5a')]['to'][0x0],'firstMsgDirection':_0x01d8('0xb4'),'Messages':[_[_0x01d8('0x4f')](_0x4568a8['body'],{'read':![],'body':_0x4568a8[_0x01d8('0x5a')][_0x01d8('0xa5')][0x0][_0x01d8('0xb5')],'FaxAccountId':_0x2a0a90['id'],'UserId':_0x4568a8[_0x01d8('0x5b')]['id'],'ContactId':_0x10a966['id'],'AttachmentId':_0x4568a8[_0x01d8('0x5a')][_0x01d8('0xa5')][0x0]['id']})]},{'include':[{'model':db['FaxMessage'],'as':_0x01d8('0xb6')}]})[_0x01d8('0x39')](function(_0x4af6e2){return[_0x4af6e2,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})[_0x01d8('0xb7')](function(_0x7bcd51,_0xa46279){if(_0xa46279){return _0x7bcd51;}return db[_0x01d8('0x9f')]['create']({'direction':_0x01d8('0xb4'),'read':![],'body':_0x4568a8[_0x01d8('0x5a')][_0x01d8('0xa5')][0x0][_0x01d8('0xb5')],'FaxAccountId':_0x2a0a90['id'],'FaxInteractionId':_0x7bcd51['id'],'UserId':_0x4568a8['user']['id'],'ContactId':_0x7bcd51[_0x01d8('0xb8')],'AttachmentId':_0x4568a8['body'][_0x01d8('0xa5')][0x0]['id']})['then'](function(_0x22a3c2){_0x7bcd51[_0x01d8('0xb9')][_0x01d8('0xb6')]=[];_0x7bcd51[_0x01d8('0xb9')][_0x01d8('0xb6')][_0x01d8('0x8b')](_0x22a3c2[_0x01d8('0xb9')]);return _0x7bcd51;});})[_0x01d8('0x39')](function(_0x5a8f68){respondWithRpcPromise(_0x01d8('0xba'),_0x01d8('0xba'),{'FaxAccountId':_[_0x01d8('0xaa')](_0x4568a8['params']['id'])?undefined:_0x4568a8[_0x01d8('0x64')]['id'],'path':_[_0x01d8('0xaa')](_0x4568a8[_0x01d8('0x5a')][_0x01d8('0xa5')][0x0][_0x01d8('0x7')])?undefined:_0x4568a8[_0x01d8('0x5a')][_0x01d8('0xa5')][0x0][_0x01d8('0x7')],'fax':_['isNil'](_0x4568a8[_0x01d8('0x5a')]['to'][0x0])?undefined:_0x4568a8[_0x01d8('0x5a')]['to'][0x0],'AttachmentId':_0x4568a8['body'][_0x01d8('0xa5')][0x0]['id']},client9002)[_0x01d8('0x39')](function(_0x553b70){logger[_0x01d8('0x22')](_0x01d8('0xbb'),_0x553b70);})['catch'](function(_0x1642c5){logger[_0x01d8('0x22')](_0x01d8('0xbb'),_0x1642c5);});return _0x5a8f68;})['then'](respondWithResult(_0x4fa68a,null))['catch'](handleError(_0x4fa68a,null));};exports[_0x01d8('0xbc')]=function(_0x109be3,_0x524ccd,_0x1364aa){return db[_0x01d8('0x41')]['find']({'where':{'id':_0x109be3['params']['id']}})[_0x01d8('0x39')](handleEntityNotFound(_0x524ccd,null))[_0x01d8('0x39')](function(_0x536ff7){if(_0x536ff7){return _0x536ff7[_0x01d8('0xbc')](_0x109be3['body']['ids'],_['omit'](_0x109be3[_0x01d8('0x5a')],[_0x01d8('0x6c'),'id'])||{})[_0x01d8('0xb7')](function(_0x46ffb3){for(var _0x3a26aa=0x0;_0x3a26aa<_0x109be3[_0x01d8('0x5a')]['ids'][_0x01d8('0x4a')];_0x3a26aa+=0x1){socket['emit'](_0x01d8('0xbd'),{'UserId':Number(_0x109be3[_0x01d8('0x5a')][_0x01d8('0x6c')][_0x3a26aa]),'FaxAccountId':Number(_0x109be3[_0x01d8('0x64')]['id'])});}return _0x46ffb3;});}})[_0x01d8('0x39')](respondWithResult(_0x524ccd,null))['catch'](handleError(_0x524ccd,null));};exports[_0x01d8('0xbe')]=function(_0x5ad3f7,_0x3422ad,_0x33dba8){return db[_0x01d8('0x41')][_0x01d8('0x59')]({'where':{'id':_0x5ad3f7['params']['id']}})[_0x01d8('0x39')](handleEntityNotFound(_0x3422ad,null))['then'](function(_0x432aaf){if(_0x432aaf){return _0x432aaf['removeAgents'](_0x5ad3f7[_0x01d8('0x45')][_0x01d8('0x6c')])[_0x01d8('0x39')](function(){if(_[_0x01d8('0xbf')](_0x5ad3f7[_0x01d8('0x45')][_0x01d8('0x6c')])){for(var _0x4ec0aa=0x0;_0x4ec0aa<_0x5ad3f7[_0x01d8('0x45')]['ids']['length'];_0x4ec0aa+=0x1){socket[_0x01d8('0xc0')]('userFaxAccount:remove',{'UserId':Number(_0x5ad3f7['query'][_0x01d8('0x6c')][_0x4ec0aa]),'FaxAccountId':Number(_0x5ad3f7['params']['id'])});}}else{socket[_0x01d8('0xc0')](_0x01d8('0xc1'),{'UserId':Number(_0x5ad3f7[_0x01d8('0x45')][_0x01d8('0x6c')]),'FaxAccountId':Number(_0x5ad3f7[_0x01d8('0x64')]['id'])});}});}})[_0x01d8('0x39')](respondWithStatusCode(_0x3422ad,null))['catch'](handleError(_0x3422ad,null));};exports[_0x01d8('0xc2')]=function(_0x4c3157,_0x22e67f,_0x5ed5ea){var _0x4f847a={};var _0x2d216d={};var _0x341048;var _0x4c101c;return db[_0x01d8('0x41')][_0x01d8('0x68')]({'where':{'id':_0x4c3157[_0x01d8('0x64')]['id']}})[_0x01d8('0x39')](handleEntityNotFound(_0x22e67f,null))[_0x01d8('0x39')](function(_0x5ad0a8){if(_0x5ad0a8){_0x341048=_0x5ad0a8;_0x2d216d[_0x01d8('0x44')]=_[_0x01d8('0x56')](db[_0x01d8('0xc3')][_0x01d8('0x42')]);_0x2d216d[_0x01d8('0x45')]=_['keys'](_0x4c3157[_0x01d8('0x45')]);_0x2d216d[_0x01d8('0x46')]=_[_0x01d8('0x48')](_0x2d216d['model'],_0x2d216d['query']);_0x4f847a[_0x01d8('0x47')]=_[_0x01d8('0x48')](_0x2d216d[_0x01d8('0x44')],qs[_0x01d8('0x49')](_0x4c3157[_0x01d8('0x45')][_0x01d8('0x49')]));_0x4f847a[_0x01d8('0x47')]=_0x4f847a['attributes'][_0x01d8('0x4a')]?_0x4f847a[_0x01d8('0x47')]:_0x2d216d['model'];_0x4f847a[_0x01d8('0x4c')]=qs[_0x01d8('0x4d')](_0x4c3157[_0x01d8('0x45')][_0x01d8('0x4d')]);_0x4f847a['where']=qs[_0x01d8('0x46')](_[_0x01d8('0x6e')](_0x4c3157[_0x01d8('0x45')],_0x2d216d[_0x01d8('0x46')]));if(_0x4c3157[_0x01d8('0x45')]['filter']){_0x4f847a[_0x01d8('0x4e')]=_[_0x01d8('0x4f')](_0x4f847a['where'],{'$or':_[_0x01d8('0x40')](_0x4f847a[_0x01d8('0x47')],function(_0xb2b8ae){var _0x4b340d={};_0x4b340d[_0xb2b8ae]={'$like':'%'+_0x4c3157[_0x01d8('0x45')][_0x01d8('0x52')]+'%'};return _0x4b340d;})});}_0x4f847a=_[_0x01d8('0x4f')]({},_0x4f847a,_0x4c3157['options']);return _0x341048[_0x01d8('0xc2')](_0x4f847a);}})[_0x01d8('0x39')](function(_0x37806d){if(_0x37806d){_0x4c101c=_0x37806d[_0x01d8('0x4a')];if(!_0x4c3157['query']['hasOwnProperty'](_0x01d8('0x69'))){_0x4f847a['limit']=qs[_0x01d8('0x31')](_0x4c3157[_0x01d8('0x45')][_0x01d8('0x31')]);_0x4f847a[_0x01d8('0x2f')]=qs[_0x01d8('0x2f')](_0x4c3157[_0x01d8('0x45')]['offset']);}return _0x341048[_0x01d8('0xc2')](_0x4f847a);}})[_0x01d8('0x39')](function(_0x566b05){if(_0x566b05){return _0x566b05?{'count':_0x4c101c,'rows':_0x566b05}:null;}})[_0x01d8('0x39')](respondWithResult(_0x22e67f,null))[_0x01d8('0x2a')](handleError(_0x22e67f,null));}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.events.js b/server/api/faxAccount/faxAccount.events.js index 9194245..32b9ba4 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 _0xb180=['hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners','save','remove','emit'];(function(_0x32ad42,_0x4c6948){var _0x672a14=function(_0x38950b){while(--_0x38950b){_0x32ad42['push'](_0x32ad42['shift']());}};_0x672a14(++_0x4c6948);}(_0xb180,0x1aa));var _0x0b18=function(_0x40393f,_0x16a66e){_0x40393f=_0x40393f-0x0;var _0x444ccf=_0xb180[_0x40393f];return _0x444ccf;};'use strict';var EventEmitter=require(_0x0b18('0x0'));var FaxAccount=require(_0x0b18('0x1'))['db']['FaxAccount'];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0x0b18('0x2')](0x0);var events={'afterCreate':_0x0b18('0x3'),'afterUpdate':'update','afterDestroy':_0x0b18('0x4')};function emitEvent(_0x2961cb){return function(_0x3feb0e,_0x448afb,_0x1c01eb){FaxAccountEvents[_0x0b18('0x5')](_0x2961cb+':'+_0x3feb0e['id'],_0x3feb0e);FaxAccountEvents['emit'](_0x2961cb,_0x3feb0e);_0x1c01eb(null);};}for(var e in events){if(events[_0x0b18('0x6')](e)){var event=events[e];FaxAccount[_0x0b18('0x7')](e,emitEvent(event));}}module[_0x0b18('0x8')]=FaxAccountEvents; \ No newline at end of file +var _0xc25d=['remove','emit','hook','exports','../../mysqldb','FaxAccount','setMaxListeners','save'];(function(_0xc37c8,_0x182df1){var _0x77188f=function(_0xfbdddc){while(--_0xfbdddc){_0xc37c8['push'](_0xc37c8['shift']());}};_0x77188f(++_0x182df1);}(_0xc25d,0xe4));var _0xdc25=function(_0x4e1d03,_0x786f3a){_0x4e1d03=_0x4e1d03-0x0;var _0x362d4b=_0xc25d[_0x4e1d03];return _0x362d4b;};'use strict';var EventEmitter=require('events');var FaxAccount=require(_0xdc25('0x0'))['db'][_0xdc25('0x1')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0xdc25('0x2')](0x0);var events={'afterCreate':_0xdc25('0x3'),'afterUpdate':'update','afterDestroy':_0xdc25('0x4')};function emitEvent(_0x31d59b){return function(_0x33d3ef,_0x325434,_0x54af61){FaxAccountEvents['emit'](_0x31d59b+':'+_0x33d3ef['id'],_0x33d3ef);FaxAccountEvents[_0xdc25('0x5')](_0x31d59b,_0x33d3ef);_0x54af61(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxAccount[_0xdc25('0x6')](e,emitEvent(event));}}module[_0xdc25('0x7')]=FaxAccountEvents; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.model.js b/server/api/faxAccount/faxAccount.model.js index 19d518e..2cf4cd0 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 _0xbe99=['define','lodash','util','api','moment','request-promise','rimraf','../../config/environment','./faxAccount.attributes','exports'];(function(_0x45c4df,_0x930169){var _0x4a5f41=function(_0x5f2f8d){while(--_0x5f2f8d){_0x45c4df['push'](_0x45c4df['shift']());}};_0x4a5f41(++_0x930169);}(_0xbe99,0x65));var _0x9be9=function(_0x10caed,_0x1938bf){_0x10caed=_0x10caed-0x0;var _0xf825d=_0xbe99[_0x10caed];return _0xf825d;};'use strict';var _=require(_0x9be9('0x0'));var util=require(_0x9be9('0x1'));var logger=require('../../config/logger')(_0x9be9('0x2'));var moment=require(_0x9be9('0x3'));var BPromise=require('bluebird');var rp=require(_0x9be9('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9be9('0x5'));var config=require(_0x9be9('0x6'));var attributes=require(_0x9be9('0x7'));module[_0x9be9('0x8')]=function(_0x52bc96,_0x1366b8){return _0x52bc96[_0x9be9('0x9')]('FaxAccount',attributes,{'tableName':'fax_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x98f1=['util','../../config/logger','api','request-promise','path','rimraf','../../config/environment','./faxAccount.attributes','exports','define','FaxAccount','lodash'];(function(_0x3ffbea,_0x183053){var _0x411daf=function(_0x1184cb){while(--_0x1184cb){_0x3ffbea['push'](_0x3ffbea['shift']());}};_0x411daf(++_0x183053);}(_0x98f1,0xd7));var _0x198f=function(_0xb692d1,_0x1245d7){_0xb692d1=_0xb692d1-0x0;var _0x462754=_0x98f1[_0xb692d1];return _0x462754;};'use strict';var _=require(_0x198f('0x0'));var util=require(_0x198f('0x1'));var logger=require(_0x198f('0x2'))(_0x198f('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x198f('0x4'));var fs=require('fs');var path=require(_0x198f('0x5'));var rimraf=require(_0x198f('0x6'));var config=require(_0x198f('0x7'));var attributes=require(_0x198f('0x8'));module[_0x198f('0x9')]=function(_0x2c5c61,_0xd22620){return _0x2c5c61[_0x198f('0xa')](_0x198f('0xb'),attributes,{'tableName':'fax_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.rpc.js b/server/api/faxAccount/faxAccount.rpc.js index 9ed0952..3e224a2 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 _0xba55=['spread','autoclose','push','close','unmanaged','*,*,*,*','created','interaction','FaxMessage','ContactId','User','UserId','unshift','agent','name','waitForTheAssignedAgent','Start','startRouting','lodash','util','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','redis','defaults','localhost','./faxAccount.socket','register','request','then','FaxAccount,\x20%s,\x20%s','request\x20sent','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetFaxAccount','findAll','options','raw','where','attributes','include','map','model','info','debug','body','fax','CmContact','describe','Sequelize','no\x20available\x20attributes','difference','updatedAt','createdAt','ListId','isNil','from','ValidationError','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','FaxAccount','find','CmList','List','Contacts','DESC','FaxApplication','Applications','get','account','applications','list','orderBy','priority','asc','length','create','contact','FaxInteraction','Contact\x20not\x20found'];(function(_0x264a46,_0x45c04b){var _0x1a46d8=function(_0x1abb45){while(--_0x1abb45){_0x264a46['push'](_0x264a46['shift']());}};_0x1a46d8(++_0x45c04b);}(_0xba55,0x6e));var _0x5ba5=function(_0x452655,_0x2b2d1d){_0x452655=_0x452655-0x0;var _0x126d26=_0xba55[_0x452655];return _0x126d26;};'use strict';var _=require(_0x5ba5('0x0'));var util=require(_0x5ba5('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x5ba5('0x2'));var fs=require('fs');var Redis=require(_0x5ba5('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x5ba5('0x4'));var logger=require(_0x5ba5('0x5'))('rpc');var config=require(_0x5ba5('0x6'));var jayson=require(_0x5ba5('0x7'));var client=jayson['client'][_0x5ba5('0x8')]({'port':0x232c});config[_0x5ba5('0x9')]=_[_0x5ba5('0xa')](config[_0x5ba5('0x9')],{'host':_0x5ba5('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x5ba5('0x9')]));require(_0x5ba5('0xc'))[_0x5ba5('0xd')](socket);function respondWithRpcPromise(_0x562bcb,_0x40105d,_0x1fc42c){return new BPromise(function(_0x1a3fb5,_0x171313){return client[_0x5ba5('0xe')](_0x562bcb,_0x1fc42c)[_0x5ba5('0xf')](function(_0x5cca2d){logger['info'](_0x5ba5('0x10'),_0x40105d,_0x5ba5('0x11'));logger['debug'](_0x5ba5('0x12'),_0x40105d,_0x5ba5('0x11'),JSON[_0x5ba5('0x13')](_0x5cca2d));if(_0x5cca2d[_0x5ba5('0x14')]){if(_0x5cca2d['error'][_0x5ba5('0x15')]===0x1f4){logger[_0x5ba5('0x14')](_0x5ba5('0x10'),_0x40105d,_0x5cca2d[_0x5ba5('0x14')][_0x5ba5('0x16')]);return _0x171313(_0x5cca2d['error'][_0x5ba5('0x16')]);}logger[_0x5ba5('0x14')](_0x5ba5('0x10'),_0x40105d,_0x5cca2d[_0x5ba5('0x14')][_0x5ba5('0x16')]);return _0x1a3fb5(_0x5cca2d['error']['message']);}else{logger['info'](_0x5ba5('0x10'),_0x40105d,_0x5ba5('0x11'));_0x1a3fb5(_0x5cca2d[_0x5ba5('0x17')][_0x5ba5('0x16')]);}})[_0x5ba5('0x18')](function(_0x232833){logger[_0x5ba5('0x14')](_0x5ba5('0x10'),_0x40105d,_0x232833);_0x171313(_0x232833);});});}exports[_0x5ba5('0x19')]=function(_0x5c26c0){var _0x4fa71d=this;return new Promise(function(_0x4810f7,_0x2dbc92){return db['FaxAccount'][_0x5ba5('0x1a')]({'raw':_0x5c26c0['options']?_0x5c26c0[_0x5ba5('0x1b')][_0x5ba5('0x1c')]===undefined?!![]:![]:!![],'where':_0x5c26c0['options']?_0x5c26c0[_0x5ba5('0x1b')][_0x5ba5('0x1d')]||null:null,'attributes':_0x5c26c0[_0x5ba5('0x1b')]?_0x5c26c0[_0x5ba5('0x1b')][_0x5ba5('0x1e')]||null:null,'limit':_0x5c26c0[_0x5ba5('0x1b')]?_0x5c26c0[_0x5ba5('0x1b')]['limit']||null:null,'include':_0x5c26c0[_0x5ba5('0x1b')]?_0x5c26c0[_0x5ba5('0x1b')][_0x5ba5('0x1f')]?_[_0x5ba5('0x20')](_0x5c26c0[_0x5ba5('0x1b')]['include'],function(_0x1990e0){return{'model':db[_0x1990e0[_0x5ba5('0x21')]],'as':_0x1990e0['as'],'attributes':_0x1990e0['attributes'],'include':_0x1990e0[_0x5ba5('0x1f')]?_[_0x5ba5('0x20')](_0x1990e0['include'],function(_0x55d51a){return{'model':db[_0x55d51a[_0x5ba5('0x21')]],'as':_0x55d51a['as'],'attributes':_0x55d51a[_0x5ba5('0x1e')],'include':_0x55d51a[_0x5ba5('0x1f')]?_['map'](_0x55d51a['include'],function(_0x4c52b6){return{'model':db[_0x4c52b6[_0x5ba5('0x21')]],'as':_0x4c52b6['as'],'attributes':_0x4c52b6['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x4ab834){logger[_0x5ba5('0x22')](_0x5ba5('0x19'),_0x5c26c0);logger[_0x5ba5('0x23')]('GetFaxAccount',_0x5c26c0,JSON[_0x5ba5('0x13')](_0x4ab834));_0x4810f7(_0x4ab834);})['catch'](function(_0x441245){logger[_0x5ba5('0x14')]('GetFaxAccount',_0x441245[_0x5ba5('0x16')],_0x5c26c0);_0x2dbc92(_0x4fa71d[_0x5ba5('0x14')](0x1f4,_0x441245['message']));});});};exports['NotifyFaxAccount']=function(_0x5c128c,_0x55f414,_0x323ba9){var _0x383b19=this;return new Promise(function(_0x18dd11,_0x6cd92f){var _0x45ca0d={'body':_0x5c128c[_0x5ba5('0x24')],'channel':_0x5ba5('0x25')};var _0x846b3c=[];var _0x40447f=[];var _0xf26c6e={};return db[_0x5ba5('0x26')][_0x5ba5('0x27')]()['then'](function(_0x195ac6){if(!_0x195ac6){throw new db[(_0x5ba5('0x28'))]['ValidationError'](_0x5ba5('0x29'));}_0x846b3c=_[_0x5ba5('0x2a')](_['keys'](_0x195ac6),['createdAt',_0x5ba5('0x2b')]);_0x40447f=_['difference'](_['keys'](_0x195ac6),[_0x5ba5('0x2c'),_0x5ba5('0x2b'),'CompanyId',_0x5ba5('0x2d')]);if(_0x5c128c[_0x5ba5('0x24')]['id']){delete _0x5c128c[_0x5ba5('0x24')]['id'];}if(_[_0x5ba5('0x2e')](_0x5c128c[_0x5ba5('0x24')][_0x5ba5('0x2f')])){throw new db[(_0x5ba5('0x28'))][(_0x5ba5('0x30'))](_0x5ba5('0x31'));}if(_[_0x5ba5('0x2e')](_0x5c128c['body'][_0x5ba5('0x24')])||_0x5c128c[_0x5ba5('0x24')][_0x5ba5('0x24')]===''){throw new db[(_0x5ba5('0x28'))][(_0x5ba5('0x30'))](_0x5ba5('0x32'));}if(_[_0x5ba5('0x2e')](_0x5c128c[_0x5ba5('0x24')][_0x5ba5('0x33')])){throw new db['Sequelize'][(_0x5ba5('0x30'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x40447f);}if(!_[_0x5ba5('0x34')](_0x40447f,_0x5c128c[_0x5ba5('0x24')][_0x5ba5('0x33')])){throw new db['Sequelize'][(_0x5ba5('0x30'))](_0x5ba5('0x35')+_0x40447f);}_0xf26c6e[_0x5c128c[_0x5ba5('0x24')][_0x5ba5('0x33')]]=_0x5c128c[_0x5ba5('0x24')][_0x5ba5('0x2f')];})[_0x5ba5('0xf')](function(){return db[_0x5ba5('0x36')][_0x5ba5('0x37')]({'where':{'id':_0x5c128c['account']['id']},'include':[{'model':db[_0x5ba5('0x38')],'as':_0x5ba5('0x39'),'include':[{'model':db[_0x5ba5('0x26')],'as':_0x5ba5('0x3a'),'where':_0xf26c6e,'limit':0x1,'order':[[_0x5ba5('0x2b'),_0x5ba5('0x3b')]]}]},{'model':db[_0x5ba5('0x3c')],'as':_0x5ba5('0x3d')}]});})[_0x5ba5('0xf')](function(_0x3ae911){if(_0x3ae911&&_0x3ae911[_0x5ba5('0x39')]){var _0x2a941e=_0x3ae911[_0x5ba5('0x3e')]({'plain':!![]});_0x45ca0d[_0x5ba5('0x3f')]=_0x2a941e;_0x45ca0d[_0x5ba5('0x40')]=_0x2a941e['Applications'];_0x45ca0d[_0x5ba5('0x41')]=_0x2a941e[_0x5ba5('0x39')];_0x45ca0d[_0x5ba5('0x40')]=_[_0x5ba5('0x42')](_0x45ca0d[_0x5ba5('0x40')],[_0x5ba5('0x43')],[_0x5ba5('0x44')]);if(_0x45ca0d[_0x5ba5('0x3f')]['Applications']){delete _0x45ca0d['account'][_0x5ba5('0x3d')];}if(_0x45ca0d[_0x5ba5('0x3f')][_0x5ba5('0x39')]&&_0x45ca0d[_0x5ba5('0x3f')][_0x5ba5('0x39')][_0x5ba5('0x3a')][_0x5ba5('0x45')]){return _0x45ca0d[_0x5ba5('0x3f')]['List'][_0x5ba5('0x3a')][0x0];}var _0x2be342=_[_0x5ba5('0xa')](_0x5c128c[_0x5ba5('0x24')],{'firstName':_0x5c128c['body'][_0x5ba5('0x2f')],'ListId':_0x2a941e[_0x5ba5('0x2d')]});_0x2be342[_0x5c128c[_0x5ba5('0x24')][_0x5ba5('0x33')]]=_0x5c128c[_0x5ba5('0x24')][_0x5ba5('0x2f')];return db['CmContact'][_0x5ba5('0x46')](_0x2be342,{'fields':_0x846b3c,'raw':!![]});}})['then'](function(_0x26b55f){_0x45ca0d[_0x5ba5('0x47')]=_0x26b55f;if(_0x26b55f){var _0x299316={'ContactId':_0x26b55f['id'],'FaxAccountId':_0x5c128c[_0x5ba5('0x3f')]['id'],'fax':_0x26b55f['fax']};return db[_0x5ba5('0x48')][_0x5ba5('0x37')]({'where':{'ContactId':_0x26b55f['id'],'closed':![],'FaxAccountId':_0x5c128c[_0x5ba5('0x3f')]['id']}})[_0x5ba5('0xf')](function(_0x53ad71){if(_0x53ad71){return[_0x53ad71,![]];}return db[_0x5ba5('0x48')]['create'](_0x299316)['then'](function(_0xafe82e){return[_0xafe82e,!![]];});});}else{throw new Error(_0x5ba5('0x49'));}})[_0x5ba5('0x4a')](function(_0x4b04e5,_0x1abf9b){var _0x28a5e1=_0x4b04e5[_0x5ba5('0x3e')]({'plain':!![]});if(_0x1abf9b){if(_0x45ca0d['account'][_0x5ba5('0x4b')]){_0x45ca0d['applications'][_0x5ba5('0x4c')]({'id':0x0,'priority':_0x45ca0d[_0x5ba5('0x40')][_0x5ba5('0x45')]+0x1,'app':_0x5ba5('0x4d'),'appdata':_0x5ba5('0x4e'),'interval':_0x5ba5('0x4f')});}_0x28a5e1['created']=!![];}else{_0x28a5e1[_0x5ba5('0x50')]=![];}_0x45ca0d[_0x5ba5('0x51')]=_0x28a5e1;return db[_0x5ba5('0x52')][_0x5ba5('0x46')]({'body':_0x5c128c[_0x5ba5('0x24')][_0x5ba5('0x24')],'FaxAccountId':_0x5c128c[_0x5ba5('0x3f')]['id'],'FaxInteractionId':_0x4b04e5['id'],'direction':'in','ContactId':_0x4b04e5[_0x5ba5('0x53')],'AttachmentId':_0x5c128c[_0x5ba5('0x24')]['AttachmentId']});})[_0x5ba5('0xf')](function(_0x3b91c5){_0x45ca0d[_0x5ba5('0x16')]=_0x3b91c5;if(_0x45ca0d[_0x5ba5('0x51')]['UserId']){return db[_0x5ba5('0x54')][_0x5ba5('0x37')]({'attributes':['id','name'],'where':{'id':_0x45ca0d[_0x5ba5('0x51')][_0x5ba5('0x55')]}})[_0x5ba5('0xf')](function(_0x33deda){if(_0x33deda){_0x45ca0d[_0x5ba5('0x40')][_0x5ba5('0x56')]({'id':0x0,'priority':0x0,'app':_0x5ba5('0x57'),'appdata':_0x33deda[_0x5ba5('0x58')]+','+(_0x45ca0d[_0x5ba5('0x3f')][_0x5ba5('0x59')]||0xa),'interval':_0x5ba5('0x4f')});}return respondWithRpcPromise(_0x5ba5('0x5a'),_0x5ba5('0x5b'),_0x45ca0d);});}return respondWithRpcPromise('Start',_0x5ba5('0x5b'),_0x45ca0d);})[_0x5ba5('0xf')](function(_0x50224a){_0x18dd11(_0x50224a);})[_0x5ba5('0x18')](function(_0x1fde46){_0x6cd92f(_0x383b19[_0x5ba5('0x14')](0x1f4,_0x1fde46[_0x5ba5('0x16')]));});});}; \ No newline at end of file +var _0x53dd=['keys','createdAt','updatedAt','CompanyId','ListId','isNil','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','from','FaxAccount','find','account','CmList','Contacts','DESC','FaxApplication','Applications','List','get','applications','list','orderBy','length','create','contact','FaxInteraction','Contact\x20not\x20found','spread','autoclose','push','close','unmanaged','*,*,*,*','created','FaxMessage','ContactId','AttachmentId','interaction','UserId','User','name','unshift','agent','waitForTheAssignedAgent','startRouting','Start','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./faxAccount.socket','register','info','FaxAccount,\x20%s,\x20%s','request\x20sent','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','options','raw','attributes','limit','include','map','model','then','GetFaxAccount','debug','NotifyFaxAccount','body','fax','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference'];(function(_0x3aa0b1,_0x372e9d){var _0x30ec46=function(_0x4a0e41){while(--_0x4a0e41){_0x3aa0b1['push'](_0x3aa0b1['shift']());}};_0x30ec46(++_0x372e9d);}(_0x53dd,0x197));var _0xd53d=function(_0xe28e32,_0xa4a1fe){_0xe28e32=_0xe28e32-0x0;var _0x387bf1=_0x53dd[_0xe28e32];return _0x387bf1;};'use strict';var _=require(_0xd53d('0x0'));var util=require('util');var moment=require(_0xd53d('0x1'));var BPromise=require(_0xd53d('0x2'));var rs=require(_0xd53d('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd53d('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xd53d('0x5'))('rpc');var config=require(_0xd53d('0x6'));var jayson=require(_0xd53d('0x7'));var client=jayson[_0xd53d('0x8')][_0xd53d('0x9')]({'port':0x232c});config[_0xd53d('0xa')]=_[_0xd53d('0xb')](config[_0xd53d('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0xd53d('0xc'))(new Redis(config[_0xd53d('0xa')]));require(_0xd53d('0xd'))[_0xd53d('0xe')](socket);function respondWithRpcPromise(_0x69c361,_0x4e4540,_0x4784f6){return new BPromise(function(_0x3b427c,_0x9ad208){return client['request'](_0x69c361,_0x4784f6)['then'](function(_0x3a2b3a){logger[_0xd53d('0xf')](_0xd53d('0x10'),_0x4e4540,_0xd53d('0x11'));logger['debug'](_0xd53d('0x12'),_0x4e4540,_0xd53d('0x11'),JSON[_0xd53d('0x13')](_0x3a2b3a));if(_0x3a2b3a[_0xd53d('0x14')]){if(_0x3a2b3a[_0xd53d('0x14')][_0xd53d('0x15')]===0x1f4){logger['error'](_0xd53d('0x10'),_0x4e4540,_0x3a2b3a[_0xd53d('0x14')][_0xd53d('0x16')]);return _0x9ad208(_0x3a2b3a[_0xd53d('0x14')]['message']);}logger[_0xd53d('0x14')]('FaxAccount,\x20%s,\x20%s',_0x4e4540,_0x3a2b3a[_0xd53d('0x14')][_0xd53d('0x16')]);return _0x3b427c(_0x3a2b3a[_0xd53d('0x14')][_0xd53d('0x16')]);}else{logger['info']('FaxAccount,\x20%s,\x20%s',_0x4e4540,_0xd53d('0x11'));_0x3b427c(_0x3a2b3a[_0xd53d('0x17')][_0xd53d('0x16')]);}})[_0xd53d('0x18')](function(_0x4e3d5d){logger['error'](_0xd53d('0x10'),_0x4e4540,_0x4e3d5d);_0x9ad208(_0x4e3d5d);});});}exports['GetFaxAccount']=function(_0x280c4f){var _0xcb004a=this;return new Promise(function(_0x1ffa22,_0x156d0b){return db['FaxAccount']['findAll']({'raw':_0x280c4f[_0xd53d('0x19')]?_0x280c4f[_0xd53d('0x19')][_0xd53d('0x1a')]===undefined?!![]:![]:!![],'where':_0x280c4f[_0xd53d('0x19')]?_0x280c4f['options']['where']||null:null,'attributes':_0x280c4f[_0xd53d('0x19')]?_0x280c4f['options'][_0xd53d('0x1b')]||null:null,'limit':_0x280c4f[_0xd53d('0x19')]?_0x280c4f[_0xd53d('0x19')][_0xd53d('0x1c')]||null:null,'include':_0x280c4f[_0xd53d('0x19')]?_0x280c4f[_0xd53d('0x19')][_0xd53d('0x1d')]?_[_0xd53d('0x1e')](_0x280c4f[_0xd53d('0x19')][_0xd53d('0x1d')],function(_0x52eb8b){return{'model':db[_0x52eb8b[_0xd53d('0x1f')]],'as':_0x52eb8b['as'],'attributes':_0x52eb8b[_0xd53d('0x1b')],'include':_0x52eb8b['include']?_['map'](_0x52eb8b[_0xd53d('0x1d')],function(_0x2696e8){return{'model':db[_0x2696e8['model']],'as':_0x2696e8['as'],'attributes':_0x2696e8[_0xd53d('0x1b')],'include':_0x2696e8[_0xd53d('0x1d')]?_[_0xd53d('0x1e')](_0x2696e8[_0xd53d('0x1d')],function(_0x144744){return{'model':db[_0x144744['model']],'as':_0x144744['as'],'attributes':_0x144744[_0xd53d('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xd53d('0x20')](function(_0x4ad0e6){logger[_0xd53d('0xf')](_0xd53d('0x21'),_0x280c4f);logger[_0xd53d('0x22')](_0xd53d('0x21'),_0x280c4f,JSON['stringify'](_0x4ad0e6));_0x1ffa22(_0x4ad0e6);})['catch'](function(_0x9f7891){logger[_0xd53d('0x14')]('GetFaxAccount',_0x9f7891[_0xd53d('0x16')],_0x280c4f);_0x156d0b(_0xcb004a[_0xd53d('0x14')](0x1f4,_0x9f7891[_0xd53d('0x16')]));});});};exports[_0xd53d('0x23')]=function(_0xdf2a59,_0x395b84,_0x2ee139){var _0x1b425=this;return new Promise(function(_0x1f4b14,_0x219384){var _0x300781={'body':_0xdf2a59[_0xd53d('0x24')],'channel':_0xd53d('0x25')};var _0x5ad6a8=[];var _0x4f8f7c=[];var _0x4595d6={};return db[_0xd53d('0x26')]['describe']()[_0xd53d('0x20')](function(_0x5a0016){if(!_0x5a0016){throw new db[(_0xd53d('0x27'))][(_0xd53d('0x28'))](_0xd53d('0x29'));}_0x5ad6a8=_[_0xd53d('0x2a')](_[_0xd53d('0x2b')](_0x5a0016),[_0xd53d('0x2c'),_0xd53d('0x2d')]);_0x4f8f7c=_[_0xd53d('0x2a')](_['keys'](_0x5a0016),[_0xd53d('0x2c'),_0xd53d('0x2d'),_0xd53d('0x2e'),_0xd53d('0x2f')]);if(_0xdf2a59[_0xd53d('0x24')]['id']){delete _0xdf2a59['body']['id'];}if(_[_0xd53d('0x30')](_0xdf2a59[_0xd53d('0x24')]['from'])){throw new db[(_0xd53d('0x27'))][(_0xd53d('0x28'))]('from\x20is\x20mandatory');}if(_[_0xd53d('0x30')](_0xdf2a59[_0xd53d('0x24')][_0xd53d('0x24')])||_0xdf2a59[_0xd53d('0x24')][_0xd53d('0x24')]===''){throw new db[(_0xd53d('0x27'))][(_0xd53d('0x28'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0xd53d('0x30')](_0xdf2a59[_0xd53d('0x24')]['mapKey'])){throw new db['Sequelize'][(_0xd53d('0x28'))](_0xd53d('0x31')+_0x4f8f7c);}if(!_['includes'](_0x4f8f7c,_0xdf2a59[_0xd53d('0x24')][_0xd53d('0x32')])){throw new db[(_0xd53d('0x27'))]['ValidationError'](_0xd53d('0x33')+_0x4f8f7c);}_0x4595d6[_0xdf2a59[_0xd53d('0x24')]['mapKey']]=_0xdf2a59[_0xd53d('0x24')][_0xd53d('0x34')];})['then'](function(){return db[_0xd53d('0x35')][_0xd53d('0x36')]({'where':{'id':_0xdf2a59[_0xd53d('0x37')]['id']},'include':[{'model':db[_0xd53d('0x38')],'as':'List','include':[{'model':db['CmContact'],'as':_0xd53d('0x39'),'where':_0x4595d6,'limit':0x1,'order':[[_0xd53d('0x2d'),_0xd53d('0x3a')]]}]},{'model':db[_0xd53d('0x3b')],'as':_0xd53d('0x3c')}]});})[_0xd53d('0x20')](function(_0x43b169){if(_0x43b169&&_0x43b169[_0xd53d('0x3d')]){var _0x1cace8=_0x43b169[_0xd53d('0x3e')]({'plain':!![]});_0x300781[_0xd53d('0x37')]=_0x1cace8;_0x300781[_0xd53d('0x3f')]=_0x1cace8[_0xd53d('0x3c')];_0x300781[_0xd53d('0x40')]=_0x1cace8[_0xd53d('0x3d')];_0x300781[_0xd53d('0x3f')]=_[_0xd53d('0x41')](_0x300781[_0xd53d('0x3f')],['priority'],['asc']);if(_0x300781[_0xd53d('0x37')][_0xd53d('0x3c')]){delete _0x300781['account'][_0xd53d('0x3c')];}if(_0x300781[_0xd53d('0x37')][_0xd53d('0x3d')]&&_0x300781['account'][_0xd53d('0x3d')][_0xd53d('0x39')][_0xd53d('0x42')]){return _0x300781[_0xd53d('0x37')][_0xd53d('0x3d')]['Contacts'][0x0];}var _0x2da2c2=_[_0xd53d('0xb')](_0xdf2a59[_0xd53d('0x24')],{'firstName':_0xdf2a59[_0xd53d('0x24')]['from'],'ListId':_0x1cace8['ListId']});_0x2da2c2[_0xdf2a59[_0xd53d('0x24')]['mapKey']]=_0xdf2a59['body']['from'];return db[_0xd53d('0x26')][_0xd53d('0x43')](_0x2da2c2,{'fields':_0x5ad6a8,'raw':!![]});}})[_0xd53d('0x20')](function(_0x3c46a0){_0x300781[_0xd53d('0x44')]=_0x3c46a0;if(_0x3c46a0){var _0x42a9c4={'ContactId':_0x3c46a0['id'],'FaxAccountId':_0xdf2a59['account']['id'],'fax':_0x3c46a0['fax']};return db[_0xd53d('0x45')][_0xd53d('0x36')]({'where':{'ContactId':_0x3c46a0['id'],'closed':![],'FaxAccountId':_0xdf2a59[_0xd53d('0x37')]['id']}})[_0xd53d('0x20')](function(_0x2d255d){if(_0x2d255d){return[_0x2d255d,![]];}return db[_0xd53d('0x45')][_0xd53d('0x43')](_0x42a9c4)['then'](function(_0x13a429){return[_0x13a429,!![]];});});}else{throw new Error(_0xd53d('0x46'));}})[_0xd53d('0x47')](function(_0x849347,_0x46882b){var _0x444fd6=_0x849347['get']({'plain':!![]});if(_0x46882b){if(_0x300781[_0xd53d('0x37')][_0xd53d('0x48')]){_0x300781[_0xd53d('0x3f')][_0xd53d('0x49')]({'id':0x0,'priority':_0x300781[_0xd53d('0x3f')]['length']+0x1,'app':_0xd53d('0x4a'),'appdata':_0xd53d('0x4b'),'interval':_0xd53d('0x4c')});}_0x444fd6[_0xd53d('0x4d')]=!![];}else{_0x444fd6[_0xd53d('0x4d')]=![];}_0x300781['interaction']=_0x444fd6;return db[_0xd53d('0x4e')][_0xd53d('0x43')]({'body':_0xdf2a59['body'][_0xd53d('0x24')],'FaxAccountId':_0xdf2a59[_0xd53d('0x37')]['id'],'FaxInteractionId':_0x849347['id'],'direction':'in','ContactId':_0x849347[_0xd53d('0x4f')],'AttachmentId':_0xdf2a59[_0xd53d('0x24')][_0xd53d('0x50')]});})['then'](function(_0x2481e3){_0x300781['message']=_0x2481e3;if(_0x300781[_0xd53d('0x51')][_0xd53d('0x52')]){return db[_0xd53d('0x53')][_0xd53d('0x36')]({'attributes':['id',_0xd53d('0x54')],'where':{'id':_0x300781['interaction']['UserId']}})[_0xd53d('0x20')](function(_0x45cd9c){if(_0x45cd9c){_0x300781['applications'][_0xd53d('0x55')]({'id':0x0,'priority':0x0,'app':_0xd53d('0x56'),'appdata':_0x45cd9c[_0xd53d('0x54')]+','+(_0x300781[_0xd53d('0x37')][_0xd53d('0x57')]||0xa),'interval':_0xd53d('0x4c')});}return respondWithRpcPromise('Start',_0xd53d('0x58'),_0x300781);});}return respondWithRpcPromise(_0xd53d('0x59'),_0xd53d('0x58'),_0x300781);})[_0xd53d('0x20')](function(_0x21f7e8){_0x1f4b14(_0x21f7e8);})[_0xd53d('0x18')](function(_0x36a7e7){_0x219384(_0x1b425[_0xd53d('0x14')](0x1f4,_0x36a7e7[_0xd53d('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.socket.js b/server/api/faxAccount/faxAccount.socket.js index 770bc05..84663ab 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 _0x48ea=['removeListener','register','faxAccount:','./faxAccount.events','save','remove','update','emit'];(function(_0x4db9fc,_0x53fc01){var _0x1a0965=function(_0x5aae85){while(--_0x5aae85){_0x4db9fc['push'](_0x4db9fc['shift']());}};_0x1a0965(++_0x53fc01);}(_0x48ea,0x103));var _0xa48e=function(_0x274423,_0x41c89f){_0x274423=_0x274423-0x0;var _0x4c09dd=_0x48ea[_0x274423];return _0x4c09dd;};'use strict';var FaxAccountEvents=require(_0xa48e('0x0'));var events=[_0xa48e('0x1'),_0xa48e('0x2'),_0xa48e('0x3')];function createListener(_0xd18fe1,_0xab0e58){return function(_0x342872){_0xab0e58[_0xa48e('0x4')](_0xd18fe1,_0x342872);};}function removeListener(_0x50e87d,_0x281597){return function(){FaxAccountEvents[_0xa48e('0x5')](_0x50e87d,_0x281597);};}exports[_0xa48e('0x6')]=function(_0x57d0f8){for(var _0x26c157=0x0,_0x9ab9bf=events['length'];_0x26c157<_0x9ab9bf;_0x26c157++){var _0xd7431a=events[_0x26c157];var _0x36653b=createListener(_0xa48e('0x7')+_0xd7431a,_0x57d0f8);FaxAccountEvents['on'](_0xd7431a,_0x36653b);}}; \ No newline at end of file +var _0xf3c6=['save','update','removeListener','register','length','faxAccount:','./faxAccount.events'];(function(_0x2f1872,_0x9b3dc3){var _0x392b2d=function(_0x19dffa){while(--_0x19dffa){_0x2f1872['push'](_0x2f1872['shift']());}};_0x392b2d(++_0x9b3dc3);}(_0xf3c6,0x125));var _0x6f3c=function(_0x41810d,_0x548e26){_0x41810d=_0x41810d-0x0;var _0x34cf94=_0xf3c6[_0x41810d];return _0x34cf94;};'use strict';var FaxAccountEvents=require(_0x6f3c('0x0'));var events=[_0x6f3c('0x1'),'remove',_0x6f3c('0x2')];function createListener(_0xc09ddd,_0x436815){return function(_0x481537){_0x436815['emit'](_0xc09ddd,_0x481537);};}function removeListener(_0x3355ed,_0x51bd73){return function(){FaxAccountEvents[_0x6f3c('0x3')](_0x3355ed,_0x51bd73);};}exports[_0x6f3c('0x4')]=function(_0x5d5a6d){for(var _0x2d2ba9=0x0,_0x5590bd=events[_0x6f3c('0x5')];_0x2d2ba9<_0x5590bd;_0x2d2ba9++){var _0x1467a8=events[_0x2d2ba9];var _0x21b653=createListener(_0x6f3c('0x6')+_0x1467a8,_0x5d5a6d);FaxAccountEvents['on'](_0x1467a8,_0x21b653);}}; \ No newline at end of file diff --git a/server/api/faxAccount/index.js b/server/api/faxAccount/index.js index c7e0255..1c87722 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(_0x4abcb2,_0x89015f){var _0x3928d4=function(_0x49376d){while(--_0x49376d){_0x4abcb2['push'](_0x4abcb2['shift']());}};_0x3928d4(++_0x89015f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x521929,_0x479be5){_0x521929=_0x521929-0x0;var _0x632436=_0xa9e0[_0x521929];return _0x632436;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x0a9e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0x8')]('/:id/canned_answers',auth['isAuthenticated'](),controller['getAnswers']);router['get'](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x8')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller['getApplications']);router[_0x0a9e('0x8')](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);router[_0x0a9e('0x8')](_0x0a9e('0x14'),auth['isAuthenticated'](),controller[_0x0a9e('0x15')]);router['post']('/',auth[_0x0a9e('0xd')](),controller['create']);router[_0x0a9e('0x16')](_0x0a9e('0xc'),auth['isAuthenticated'](),controller[_0x0a9e('0x17')]);router['post'](_0x0a9e('0x18'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x19')]);router[_0x0a9e('0x16')](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1a')]);router[_0x0a9e('0x16')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1b')]);router[_0x0a9e('0x16')]('/addaccountapplications',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1c')]);router['post'](_0x0a9e('0x1d'),auth['isAuthenticated'](),controller['updateAccountApplications']);router[_0x0a9e('0x16')](_0x0a9e('0x1e'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1f')]);router['post'](_0x0a9e('0x14'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x20')]);router[_0x0a9e('0x21')](_0x0a9e('0x22'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x23')]);router['delete']('/:id',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x24')]);router[_0x0a9e('0x25')](_0x0a9e('0xc'),auth['isAuthenticated'](),controller[_0x0a9e('0x26')]);router['delete'](_0x0a9e('0x18'),auth['isAuthenticated'](),controller[_0x0a9e('0x27')]);router[_0x0a9e('0x25')](_0x0a9e('0x14'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x28')]);module[_0x0a9e('0x29')]=router; \ No newline at end of file +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(_0xa5e664,_0x4ddb13){var _0x25088e=function(_0x57515a){while(--_0x57515a){_0xa5e664['push'](_0xa5e664['shift']());}};_0x25088e(++_0x4ddb13);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4baae2,_0x487ab6){_0x4baae2=_0x4baae2-0x0;var _0x1a2285=_0xa9e0[_0x4baae2];return _0x1a2285;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['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 5bd55f7..573e12c 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 _0xdc86=['*,*,*,*','sequelize','exports','STRING','noop','TEXT'];(function(_0x75d83e,_0x2adb17){var _0x18e264=function(_0xb330d2){while(--_0xb330d2){_0x75d83e['push'](_0x75d83e['shift']());}};_0x18e264(++_0x2adb17);}(_0xdc86,0x151));var _0x6dc8=function(_0x172747,_0x1732bd){_0x172747=_0x172747-0x0;var _0x509692=_0xdc86[_0x172747];return _0x509692;};'use strict';var Sequelize=require(_0x6dc8('0x0'));module[_0x6dc8('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x6dc8('0x2')],'allowNull':![],'defaultValue':_0x6dc8('0x3')},'appdata':{'type':Sequelize[_0x6dc8('0x4')]()},'description':{'type':Sequelize[_0x6dc8('0x2')]},'interval':{'type':Sequelize[_0x6dc8('0x2')],'defaultValue':_0x6dc8('0x5')}}; \ No newline at end of file +var _0x2f76=['exports','INTEGER','noop','TEXT','STRING','*,*,*,*'];(function(_0x5f3de3,_0x40f0f5){var _0x287e0d=function(_0x3189dc){while(--_0x3189dc){_0x5f3de3['push'](_0x5f3de3['shift']());}};_0x287e0d(++_0x40f0f5);}(_0x2f76,0x1aa));var _0x62f7=function(_0xcde94c,_0x5c06d0){_0xcde94c=_0xcde94c-0x0;var _0x6ac41a=_0x2f76[_0xcde94c];return _0x6ac41a;};'use strict';var Sequelize=require('sequelize');module[_0x62f7('0x0')]={'priority':{'type':Sequelize[_0x62f7('0x1')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x62f7('0x2')},'appdata':{'type':Sequelize[_0x62f7('0x3')]()},'description':{'type':Sequelize[_0x62f7('0x4')]},'interval':{'type':Sequelize[_0x62f7('0x4')],'defaultValue':_0x62f7('0x5')}}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.controller.js b/server/api/faxApplication/faxApplication.controller.js index 7a0a61a..de2353f 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 _0xda73=['length','hasOwnProperty','order','sort','pick','where','merge','VIRTUAL','options','include','findAll','rows','show','params','find','catch','create','body','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','lodash','squel','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','map','FaxApplication','rawAttributes','fieldName','type','key','model','keys','filters','attributes','intersection','query','fields'];(function(_0x5027b1,_0x1409a5){var _0x4a46cf=function(_0x121920){while(--_0x121920){_0x5027b1['push'](_0x5027b1['shift']());}};_0x4a46cf(++_0x1409a5);}(_0xda73,0x1c8));var _0x3da7=function(_0x4e1d4b,_0x46b1af){_0x4e1d4b=_0x4e1d4b-0x0;var _0x474ebb=_0xda73[_0x4e1d4b];return _0x474ebb;};'use strict';var emlformat=require(_0x3da7('0x0'));var rimraf=require(_0x3da7('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3da7('0x2'));var rp=require(_0x3da7('0x3'));var moment=require(_0x3da7('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x3da7('0x5'));var util=require(_0x3da7('0x6'));var path=require('path');var sox=require(_0x3da7('0x7'));var csv=require(_0x3da7('0x8'));var ejs=require(_0x3da7('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3da7('0xa'));var squel=require(_0x3da7('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x3da7('0xc'));var toCsv=require(_0x3da7('0x8'));var querystring=require(_0x3da7('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x3da7('0xe'));var qs=require(_0x3da7('0xf'));var as=require(_0x3da7('0x10'));var hardwareService=require(_0x3da7('0x11'));var logger=require(_0x3da7('0x12'))(_0x3da7('0x13'));var utils=require(_0x3da7('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x3da7('0x15'));var db=require(_0x3da7('0x16'))['db'];function respondWithStatusCode(_0x2db739,_0x6bb592){_0x6bb592=_0x6bb592||0xcc;return function(_0x52ce75){if(_0x52ce75){return _0x2db739[_0x3da7('0x17')](_0x6bb592);}return _0x2db739[_0x3da7('0x18')](_0x6bb592)[_0x3da7('0x19')]();};}function respondWithResult(_0x356514,_0x384768){_0x384768=_0x384768||0xc8;return function(_0x2ddc3c){if(_0x2ddc3c){return _0x356514['status'](_0x384768)[_0x3da7('0x1a')](_0x2ddc3c);}};}function respondWithFilteredResult(_0x5afc93,_0x2564bf){return function(_0x206337){if(_0x206337){var _0x24321a=typeof _0x2564bf[_0x3da7('0x1b')]===_0x3da7('0x1c')&&typeof _0x2564bf[_0x3da7('0x1d')]===_0x3da7('0x1c');var _0x34d712=_0x206337[_0x3da7('0x1e')];var _0x5c6fc5=_0x24321a?0x0:_0x2564bf['offset'];var _0x2ab92f=_0x24321a?_0x206337['count']:_0x2564bf[_0x3da7('0x1b')]+_0x2564bf['limit'];var _0x211af9;if(_0x2ab92f>=_0x34d712){_0x2ab92f=_0x34d712;_0x211af9=0xc8;}else{_0x211af9=0xce;}_0x5afc93[_0x3da7('0x18')](_0x211af9);return _0x5afc93['set'](_0x3da7('0x1f'),_0x5c6fc5+'-'+_0x2ab92f+'/'+_0x34d712)[_0x3da7('0x1a')](_0x206337);}return null;};}function patchUpdates(_0x3796c4){return function(_0x1162e7){try{jsonpatch[_0x3da7('0x20')](_0x1162e7,_0x3796c4,!![]);}catch(_0x3bbc85){return BPromise[_0x3da7('0x21')](_0x3bbc85);}return _0x1162e7[_0x3da7('0x22')]();};}function saveUpdates(_0x41c956,_0x3656ea){return function(_0x383c57){if(_0x383c57){return _0x383c57[_0x3da7('0x23')](_0x41c956)[_0x3da7('0x24')](function(_0x39e81a){return _0x39e81a;});}return null;};}function removeEntity(_0x18bac8,_0x3453e5){return function(_0x29798d){if(_0x29798d){return _0x29798d[_0x3da7('0x25')]()[_0x3da7('0x24')](function(){_0x18bac8['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x56c9e2,_0x44281f){return function(_0xf0e3ab){if(!_0xf0e3ab){_0x56c9e2[_0x3da7('0x17')](0x194);}return _0xf0e3ab;};}function handleError(_0x262ff8,_0x2cbeb5){_0x2cbeb5=_0x2cbeb5||0x1f4;return function(_0x11556b){logger[_0x3da7('0x26')](_0x11556b[_0x3da7('0x27')]);if(_0x11556b[_0x3da7('0x28')]){delete _0x11556b[_0x3da7('0x28')];}_0x262ff8['status'](_0x2cbeb5)[_0x3da7('0x29')](_0x11556b);};}exports['index']=function(_0x478a0f,_0x3d2fae){var _0x207f30={},_0x1bb4ea={},_0x5f3472={'count':0x0,'rows':[]};var _0x5464e3=_[_0x3da7('0x2a')](db[_0x3da7('0x2b')][_0x3da7('0x2c')],function(_0x292e6f){return{'name':_0x292e6f[_0x3da7('0x2d')],'type':_0x292e6f[_0x3da7('0x2e')][_0x3da7('0x2f')]};});_0x1bb4ea[_0x3da7('0x30')]=_[_0x3da7('0x2a')](_0x5464e3,'name');_0x1bb4ea['query']=_[_0x3da7('0x31')](_0x478a0f['query']);_0x1bb4ea[_0x3da7('0x32')]=_['intersection'](_0x1bb4ea[_0x3da7('0x30')],_0x1bb4ea['query']);_0x207f30[_0x3da7('0x33')]=_[_0x3da7('0x34')](_0x1bb4ea[_0x3da7('0x30')],qs['fields'](_0x478a0f[_0x3da7('0x35')][_0x3da7('0x36')]));_0x207f30[_0x3da7('0x33')]=_0x207f30[_0x3da7('0x33')][_0x3da7('0x37')]?_0x207f30[_0x3da7('0x33')]:_0x1bb4ea[_0x3da7('0x30')];if(!_0x478a0f[_0x3da7('0x35')][_0x3da7('0x38')]('nolimit')){_0x207f30['limit']=qs[_0x3da7('0x1d')](_0x478a0f[_0x3da7('0x35')][_0x3da7('0x1d')]);_0x207f30['offset']=qs[_0x3da7('0x1b')](_0x478a0f[_0x3da7('0x35')][_0x3da7('0x1b')]);}_0x207f30[_0x3da7('0x39')]=qs[_0x3da7('0x3a')](_0x478a0f[_0x3da7('0x35')][_0x3da7('0x3a')]);_0x207f30['where']=qs[_0x3da7('0x32')](_[_0x3da7('0x3b')](_0x478a0f[_0x3da7('0x35')],_0x1bb4ea[_0x3da7('0x32')]),_0x5464e3);if(_0x478a0f[_0x3da7('0x35')]['filter']){_0x207f30[_0x3da7('0x3c')]=_[_0x3da7('0x3d')](_0x207f30['where'],{'$or':_['map'](_0x5464e3,function(_0x126ff1){if(_0x126ff1[_0x3da7('0x2e')]!==_0x3da7('0x3e')){var _0x5b2d49={};_0x5b2d49[_0x126ff1['name']]={'$like':'%'+_0x478a0f[_0x3da7('0x35')]['filter']+'%'};return _0x5b2d49;}})});}_0x207f30=_[_0x3da7('0x3d')]({},_0x207f30,_0x478a0f[_0x3da7('0x3f')]);var _0x516bf0={'where':_0x207f30[_0x3da7('0x3c')]};return db[_0x3da7('0x2b')][_0x3da7('0x1e')](_0x516bf0)[_0x3da7('0x24')](function(_0x447f1a){_0x5f3472[_0x3da7('0x1e')]=_0x447f1a;if(_0x478a0f['query']['includeAll']){_0x207f30[_0x3da7('0x40')]=[{'all':!![]}];}return db[_0x3da7('0x2b')][_0x3da7('0x41')](_0x207f30);})[_0x3da7('0x24')](function(_0x27eedf){_0x5f3472[_0x3da7('0x42')]=_0x27eedf;return _0x5f3472;})['then'](respondWithFilteredResult(_0x3d2fae,_0x207f30))['catch'](handleError(_0x3d2fae,null));};exports[_0x3da7('0x43')]=function(_0x200c47,_0x1d069d){var _0x5cd678={'raw':!![],'where':{'id':_0x200c47[_0x3da7('0x44')]['id']}},_0x2d00e5={};_0x2d00e5['model']=_[_0x3da7('0x31')](db['FaxApplication'][_0x3da7('0x2c')]);_0x2d00e5[_0x3da7('0x35')]=_['keys'](_0x200c47[_0x3da7('0x35')]);_0x2d00e5[_0x3da7('0x32')]=_[_0x3da7('0x34')](_0x2d00e5[_0x3da7('0x30')],_0x2d00e5[_0x3da7('0x35')]);_0x5cd678['attributes']=_['intersection'](_0x2d00e5[_0x3da7('0x30')],qs['fields'](_0x200c47[_0x3da7('0x35')][_0x3da7('0x36')]));_0x5cd678[_0x3da7('0x33')]=_0x5cd678[_0x3da7('0x33')][_0x3da7('0x37')]?_0x5cd678[_0x3da7('0x33')]:_0x2d00e5[_0x3da7('0x30')];if(_0x200c47[_0x3da7('0x35')]['includeAll']){_0x5cd678[_0x3da7('0x40')]=[{'all':!![]}];}_0x5cd678=_[_0x3da7('0x3d')]({},_0x5cd678,_0x200c47['options']);return db[_0x3da7('0x2b')][_0x3da7('0x45')](_0x5cd678)[_0x3da7('0x24')](handleEntityNotFound(_0x1d069d,null))[_0x3da7('0x24')](respondWithResult(_0x1d069d,null))[_0x3da7('0x46')](handleError(_0x1d069d,null));};exports[_0x3da7('0x47')]=function(_0x1fe527,_0x10829e){return db[_0x3da7('0x2b')][_0x3da7('0x47')](_0x1fe527['body'],{})[_0x3da7('0x24')](respondWithResult(_0x10829e,0xc9))[_0x3da7('0x46')](handleError(_0x10829e,null));};exports[_0x3da7('0x23')]=function(_0x489e41,_0x2172ff){if(_0x489e41[_0x3da7('0x48')]['id']){delete _0x489e41[_0x3da7('0x48')]['id'];}return db[_0x3da7('0x2b')][_0x3da7('0x45')]({'where':{'id':_0x489e41[_0x3da7('0x44')]['id']}})[_0x3da7('0x24')](handleEntityNotFound(_0x2172ff,null))[_0x3da7('0x24')](saveUpdates(_0x489e41[_0x3da7('0x48')],null))['then'](respondWithResult(_0x2172ff,null))[_0x3da7('0x46')](handleError(_0x2172ff,null));};exports[_0x3da7('0x25')]=function(_0x2d843e,_0x221ffc){return db[_0x3da7('0x2b')][_0x3da7('0x45')]({'where':{'id':_0x2d843e[_0x3da7('0x44')]['id']}})[_0x3da7('0x24')](handleEntityNotFound(_0x221ffc,null))[_0x3da7('0x24')](removeEntity(_0x221ffc,null))['catch'](handleError(_0x221ffc,null));}; \ No newline at end of file +var _0x8de0=['key','model','map','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','params','create','body','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../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','save','destroy','then','error','stack','name','send','FaxApplication','rawAttributes','fieldName','type'];(function(_0x2b45b5,_0x474458){var _0x1d9c06=function(_0x9a3264){while(--_0x9a3264){_0x2b45b5['push'](_0x2b45b5['shift']());}};_0x1d9c06(++_0x474458);}(_0x8de0,0x1e9));var _0x08de=function(_0x1f66bc,_0x2744e5){_0x1f66bc=_0x1f66bc-0x0;var _0x50b266=_0x8de0[_0x1f66bc];return _0x50b266;};'use strict';var emlformat=require(_0x08de('0x0'));var rimraf=require(_0x08de('0x1'));var zipdir=require(_0x08de('0x2'));var jsonpatch=require(_0x08de('0x3'));var rp=require(_0x08de('0x4'));var moment=require(_0x08de('0x5'));var BPromise=require(_0x08de('0x6'));var Mustache=require(_0x08de('0x7'));var util=require(_0x08de('0x8'));var path=require(_0x08de('0x9'));var sox=require(_0x08de('0xa'));var csv=require(_0x08de('0xb'));var ejs=require(_0x08de('0xc'));var fs=require('fs');var fs_extra=require(_0x08de('0xd'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x08de('0xe'));var jsforce=require(_0x08de('0xf'));var deskjs=require(_0x08de('0x10'));var toCsv=require(_0x08de('0xb'));var querystring=require(_0x08de('0x11'));var Papa=require(_0x08de('0x12'));var Redis=require(_0x08de('0x13'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x08de('0x14'));var hardwareService=require(_0x08de('0x15'));var logger=require(_0x08de('0x16'))(_0x08de('0x17'));var utils=require(_0x08de('0x18'));var config=require(_0x08de('0x19'));var licenseUtil=require(_0x08de('0x1a'));var db=require(_0x08de('0x1b'))['db'];function respondWithStatusCode(_0x41e26d,_0x4e107a){_0x4e107a=_0x4e107a||0xcc;return function(_0x52107b){if(_0x52107b){return _0x41e26d[_0x08de('0x1c')](_0x4e107a);}return _0x41e26d[_0x08de('0x1d')](_0x4e107a)[_0x08de('0x1e')]();};}function respondWithResult(_0x1fa945,_0x3aa1fe){_0x3aa1fe=_0x3aa1fe||0xc8;return function(_0x222092){if(_0x222092){return _0x1fa945['status'](_0x3aa1fe)[_0x08de('0x1f')](_0x222092);}};}function respondWithFilteredResult(_0x202668,_0x174561){return function(_0xfc0ec9){if(_0xfc0ec9){var _0x4b98d4=typeof _0x174561[_0x08de('0x20')]===_0x08de('0x21')&&typeof _0x174561[_0x08de('0x22')]===_0x08de('0x21');var _0x1f291a=_0xfc0ec9[_0x08de('0x23')];var _0x3b91aa=_0x4b98d4?0x0:_0x174561['offset'];var _0x497ace=_0x4b98d4?_0xfc0ec9['count']:_0x174561[_0x08de('0x20')]+_0x174561[_0x08de('0x22')];var _0x5a8abc;if(_0x497ace>=_0x1f291a){_0x497ace=_0x1f291a;_0x5a8abc=0xc8;}else{_0x5a8abc=0xce;}_0x202668['status'](_0x5a8abc);return _0x202668[_0x08de('0x24')](_0x08de('0x25'),_0x3b91aa+'-'+_0x497ace+'/'+_0x1f291a)[_0x08de('0x1f')](_0xfc0ec9);}return null;};}function patchUpdates(_0x10144e){return function(_0x1c7278){try{jsonpatch[_0x08de('0x26')](_0x1c7278,_0x10144e,!![]);}catch(_0x4ab215){return BPromise['reject'](_0x4ab215);}return _0x1c7278[_0x08de('0x27')]();};}function saveUpdates(_0x2b6568,_0x2550a7){return function(_0x23a4f1){if(_0x23a4f1){return _0x23a4f1['update'](_0x2b6568)['then'](function(_0x35e0c7){return _0x35e0c7;});}return null;};}function removeEntity(_0xb2b326,_0x17e9b4){return function(_0x45186f){if(_0x45186f){return _0x45186f[_0x08de('0x28')]()[_0x08de('0x29')](function(){_0xb2b326[_0x08de('0x1d')](0xcc)[_0x08de('0x1e')]();});}};}function handleEntityNotFound(_0x330dba,_0x510ce4){return function(_0x55506f){if(!_0x55506f){_0x330dba[_0x08de('0x1c')](0x194);}return _0x55506f;};}function handleError(_0xd6de9c,_0x4eee6a){_0x4eee6a=_0x4eee6a||0x1f4;return function(_0x6128b2){logger[_0x08de('0x2a')](_0x6128b2[_0x08de('0x2b')]);if(_0x6128b2[_0x08de('0x2c')]){delete _0x6128b2[_0x08de('0x2c')];}_0xd6de9c['status'](_0x4eee6a)[_0x08de('0x2d')](_0x6128b2);};}exports['index']=function(_0x19e692,_0x73858f){var _0x47465b={},_0x122bb9={},_0x3b20ad={'count':0x0,'rows':[]};var _0x4c7df7=_['map'](db[_0x08de('0x2e')][_0x08de('0x2f')],function(_0x8af46f){return{'name':_0x8af46f[_0x08de('0x30')],'type':_0x8af46f[_0x08de('0x31')][_0x08de('0x32')]};});_0x122bb9[_0x08de('0x33')]=_[_0x08de('0x34')](_0x4c7df7,_0x08de('0x2c'));_0x122bb9[_0x08de('0x35')]=_['keys'](_0x19e692['query']);_0x122bb9[_0x08de('0x36')]=_[_0x08de('0x37')](_0x122bb9['model'],_0x122bb9[_0x08de('0x35')]);_0x47465b['attributes']=_[_0x08de('0x37')](_0x122bb9[_0x08de('0x33')],qs[_0x08de('0x38')](_0x19e692[_0x08de('0x35')][_0x08de('0x38')]));_0x47465b[_0x08de('0x39')]=_0x47465b[_0x08de('0x39')][_0x08de('0x3a')]?_0x47465b['attributes']:_0x122bb9[_0x08de('0x33')];if(!_0x19e692[_0x08de('0x35')][_0x08de('0x3b')](_0x08de('0x3c'))){_0x47465b['limit']=qs[_0x08de('0x22')](_0x19e692['query'][_0x08de('0x22')]);_0x47465b[_0x08de('0x20')]=qs['offset'](_0x19e692[_0x08de('0x35')][_0x08de('0x20')]);}_0x47465b[_0x08de('0x3d')]=qs[_0x08de('0x3e')](_0x19e692['query'][_0x08de('0x3e')]);_0x47465b[_0x08de('0x3f')]=qs[_0x08de('0x36')](_[_0x08de('0x40')](_0x19e692['query'],_0x122bb9[_0x08de('0x36')]),_0x4c7df7);if(_0x19e692[_0x08de('0x35')][_0x08de('0x41')]){_0x47465b['where']=_[_0x08de('0x42')](_0x47465b[_0x08de('0x3f')],{'$or':_[_0x08de('0x34')](_0x4c7df7,function(_0x47dfdd){if(_0x47dfdd[_0x08de('0x31')]!==_0x08de('0x43')){var _0x5d7618={};_0x5d7618[_0x47dfdd[_0x08de('0x2c')]]={'$like':'%'+_0x19e692[_0x08de('0x35')][_0x08de('0x41')]+'%'};return _0x5d7618;}})});}_0x47465b=_[_0x08de('0x42')]({},_0x47465b,_0x19e692[_0x08de('0x44')]);var _0x1bde91={'where':_0x47465b[_0x08de('0x3f')]};return db[_0x08de('0x2e')][_0x08de('0x23')](_0x1bde91)[_0x08de('0x29')](function(_0xd2dcdb){_0x3b20ad['count']=_0xd2dcdb;if(_0x19e692[_0x08de('0x35')][_0x08de('0x45')]){_0x47465b[_0x08de('0x46')]=[{'all':!![]}];}return db[_0x08de('0x2e')][_0x08de('0x47')](_0x47465b);})['then'](function(_0x57b856){_0x3b20ad['rows']=_0x57b856;return _0x3b20ad;})[_0x08de('0x29')](respondWithFilteredResult(_0x73858f,_0x47465b))[_0x08de('0x48')](handleError(_0x73858f,null));};exports['show']=function(_0x41d579,_0x223303){var _0x244bde={'raw':!![],'where':{'id':_0x41d579[_0x08de('0x49')]['id']}},_0x242046={};_0x242046[_0x08de('0x33')]=_['keys'](db[_0x08de('0x2e')][_0x08de('0x2f')]);_0x242046[_0x08de('0x35')]=_['keys'](_0x41d579[_0x08de('0x35')]);_0x242046[_0x08de('0x36')]=_[_0x08de('0x37')](_0x242046[_0x08de('0x33')],_0x242046[_0x08de('0x35')]);_0x244bde[_0x08de('0x39')]=_['intersection'](_0x242046[_0x08de('0x33')],qs['fields'](_0x41d579[_0x08de('0x35')]['fields']));_0x244bde[_0x08de('0x39')]=_0x244bde[_0x08de('0x39')][_0x08de('0x3a')]?_0x244bde['attributes']:_0x242046[_0x08de('0x33')];if(_0x41d579['query'][_0x08de('0x45')]){_0x244bde[_0x08de('0x46')]=[{'all':!![]}];}_0x244bde=_[_0x08de('0x42')]({},_0x244bde,_0x41d579['options']);return db[_0x08de('0x2e')]['find'](_0x244bde)[_0x08de('0x29')](handleEntityNotFound(_0x223303,null))[_0x08de('0x29')](respondWithResult(_0x223303,null))['catch'](handleError(_0x223303,null));};exports[_0x08de('0x4a')]=function(_0x3accce,_0x2c8e03){return db['FaxApplication'][_0x08de('0x4a')](_0x3accce[_0x08de('0x4b')],{})[_0x08de('0x29')](respondWithResult(_0x2c8e03,0xc9))[_0x08de('0x48')](handleError(_0x2c8e03,null));};exports['update']=function(_0x209a7b,_0x56ee4a){if(_0x209a7b['body']['id']){delete _0x209a7b[_0x08de('0x4b')]['id'];}return db['FaxApplication'][_0x08de('0x4c')]({'where':{'id':_0x209a7b[_0x08de('0x49')]['id']}})[_0x08de('0x29')](handleEntityNotFound(_0x56ee4a,null))[_0x08de('0x29')](saveUpdates(_0x209a7b[_0x08de('0x4b')],null))[_0x08de('0x29')](respondWithResult(_0x56ee4a,null))[_0x08de('0x48')](handleError(_0x56ee4a,null));};exports[_0x08de('0x28')]=function(_0x3c819e,_0x5b6ca4){return db[_0x08de('0x2e')][_0x08de('0x4c')]({'where':{'id':_0x3c819e[_0x08de('0x49')]['id']}})[_0x08de('0x29')](handleEntityNotFound(_0x5b6ca4,null))[_0x08de('0x29')](removeEntity(_0x5b6ca4,null))[_0x08de('0x48')](handleError(_0x5b6ca4,null));}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.model.js b/server/api/faxApplication/faxApplication.model.js index 7ec6bdb..a11832a 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 _0xba5a=['utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxApplication.attributes','define','FaxApplication','fax_applications','utf8mb4'];(function(_0x45433e,_0x157e01){var _0x2157d4=function(_0x3d4400){while(--_0x3d4400){_0x45433e['push'](_0x45433e['shift']());}};_0x2157d4(++_0x157e01);}(_0xba5a,0x88));var _0xaba5=function(_0x48cb1f,_0x5ca68d){_0x48cb1f=_0x48cb1f-0x0;var _0x172c4d=_0xba5a[_0x48cb1f];return _0x172c4d;};'use strict';var _=require(_0xaba5('0x0'));var util=require('util');var logger=require(_0xaba5('0x1'))(_0xaba5('0x2'));var moment=require(_0xaba5('0x3'));var BPromise=require(_0xaba5('0x4'));var rp=require(_0xaba5('0x5'));var fs=require('fs');var path=require(_0xaba5('0x6'));var rimraf=require(_0xaba5('0x7'));var config=require(_0xaba5('0x8'));var attributes=require(_0xaba5('0x9'));module['exports']=function(_0x2fa5ce,_0x2234f0){return _0x2fa5ce[_0xaba5('0xa')](_0xaba5('0xb'),attributes,{'tableName':_0xaba5('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xaba5('0xd'),'collate':_0xaba5('0xe')});}; \ No newline at end of file +var _0x0d72=['lodash','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','./faxApplication.attributes','exports','define','FaxApplication','fax_applications','utf8mb4_unicode_ci'];(function(_0x2366c8,_0x3cbc5){var _0x1688b9=function(_0x719ce2){while(--_0x719ce2){_0x2366c8['push'](_0x2366c8['shift']());}};_0x1688b9(++_0x3cbc5);}(_0x0d72,0x11e));var _0x20d7=function(_0x5b6ba6,_0x521220){_0x5b6ba6=_0x5b6ba6-0x0;var _0x3ecff6=_0x0d72[_0x5b6ba6];return _0x3ecff6;};'use strict';var _=require(_0x20d7('0x0'));var util=require('util');var logger=require(_0x20d7('0x1'))(_0x20d7('0x2'));var moment=require(_0x20d7('0x3'));var BPromise=require('bluebird');var rp=require(_0x20d7('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x20d7('0x5'));var config=require(_0x20d7('0x6'));var attributes=require(_0x20d7('0x7'));module[_0x20d7('0x8')]=function(_0x380c5a,_0x3851cc){return _0x380c5a[_0x20d7('0x9')](_0x20d7('0xa'),attributes,{'tableName':_0x20d7('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x20d7('0xc')});}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.rpc.js b/server/api/faxApplication/faxApplication.rpc.js index 59b55fa..9d97660 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 _0x39b1=['http','request','then','info','FaxApplication,\x20%s,\x20%s','FaxApplication,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','UpdateFaxApplication','FaxApplication','update','body','options','raw','where','attributes','limit','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client'];(function(_0x32fad8,_0xde8b4d){var _0x4ddf4f=function(_0xdfdf69){while(--_0xdfdf69){_0x32fad8['push'](_0x32fad8['shift']());}};_0x4ddf4f(++_0xde8b4d);}(_0x39b1,0x1a2));var _0x139b=function(_0x4f2930,_0x40ad4b){_0x4f2930=_0x4f2930-0x0;var _0x397db7=_0x39b1[_0x4f2930];return _0x397db7;};'use strict';var _=require(_0x139b('0x0'));var util=require('util');var moment=require(_0x139b('0x1'));var BPromise=require(_0x139b('0x2'));var rs=require(_0x139b('0x3'));var fs=require('fs');var Redis=require(_0x139b('0x4'));var db=require(_0x139b('0x5'))['db'];var utils=require(_0x139b('0x6'));var logger=require('../../config/logger')(_0x139b('0x7'));var config=require(_0x139b('0x8'));var jayson=require(_0x139b('0x9'));var client=jayson[_0x139b('0xa')][_0x139b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5c3340,_0x2e10a8,_0x58c733){return new BPromise(function(_0x171cd9,_0x2a9fa9){return client[_0x139b('0xc')](_0x5c3340,_0x58c733)[_0x139b('0xd')](function(_0x454f46){logger[_0x139b('0xe')](_0x139b('0xf'),_0x2e10a8,'request\x20sent');logger['debug'](_0x139b('0x10'),_0x2e10a8,_0x139b('0x11'),JSON[_0x139b('0x12')](_0x454f46));if(_0x454f46[_0x139b('0x13')]){if(_0x454f46['error'][_0x139b('0x14')]===0x1f4){logger[_0x139b('0x13')](_0x139b('0xf'),_0x2e10a8,_0x454f46[_0x139b('0x13')][_0x139b('0x15')]);return _0x2a9fa9(_0x454f46[_0x139b('0x13')]['message']);}logger['error']('FaxApplication,\x20%s,\x20%s',_0x2e10a8,_0x454f46[_0x139b('0x13')][_0x139b('0x15')]);return _0x171cd9(_0x454f46[_0x139b('0x13')]['message']);}else{logger[_0x139b('0xe')](_0x139b('0xf'),_0x2e10a8,'request\x20sent');_0x171cd9(_0x454f46[_0x139b('0x16')][_0x139b('0x15')]);}})[_0x139b('0x17')](function(_0x57530c){logger[_0x139b('0x13')](_0x139b('0xf'),_0x2e10a8,_0x57530c);_0x2a9fa9(_0x57530c);});});}exports[_0x139b('0x18')]=function(_0x5391a5){var _0x1bcc0f=this;return new Promise(function(_0x115266,_0x4e1b96){return db[_0x139b('0x19')][_0x139b('0x1a')](_0x5391a5[_0x139b('0x1b')],{'raw':_0x5391a5['options']?_0x5391a5[_0x139b('0x1c')][_0x139b('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5391a5[_0x139b('0x1c')]?_0x5391a5[_0x139b('0x1c')][_0x139b('0x1e')]||null:null,'attributes':_0x5391a5['options']?_0x5391a5[_0x139b('0x1c')][_0x139b('0x1f')]||null:null,'limit':_0x5391a5[_0x139b('0x1c')]?_0x5391a5[_0x139b('0x1c')][_0x139b('0x20')]||null:null})['then'](function(_0x44b100){logger[_0x139b('0xe')](_0x139b('0x18'),_0x5391a5);logger['debug'](_0x139b('0x18'),_0x5391a5,JSON['stringify'](_0x44b100));_0x115266(_0x44b100);})[_0x139b('0x17')](function(_0x34aab8){logger[_0x139b('0x13')](_0x139b('0x18'),_0x34aab8[_0x139b('0x15')],_0x5391a5);_0x4e1b96(_0x1bcc0f[_0x139b('0x13')](0x1f4,_0x34aab8['message']));});});}; \ No newline at end of file +var _0x257b=['../../config/utils','../../config/logger','rpc','client','http','info','request\x20sent','debug','FaxApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','FaxApplication,\x20%s,\x20%s','message','result','catch','update','body','options','raw','attributes','limit','then','UpdateFaxApplication','moment','bluebird','randomstring','ioredis'];(function(_0x59625f,_0x3b2c76){var _0x498e1e=function(_0x85bb84){while(--_0x85bb84){_0x59625f['push'](_0x59625f['shift']());}};_0x498e1e(++_0x3b2c76);}(_0x257b,0xf8));var _0xb257=function(_0x4989d0,_0x46492b){_0x4989d0=_0x4989d0-0x0;var _0x2dddfa=_0x257b[_0x4989d0];return _0x2dddfa;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xb257('0x0'));var BPromise=require(_0xb257('0x1'));var rs=require(_0xb257('0x2'));var fs=require('fs');var Redis=require(_0xb257('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xb257('0x4'));var logger=require(_0xb257('0x5'))(_0xb257('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xb257('0x7')][_0xb257('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x7496e3,_0x11b048,_0x533fe5){return new BPromise(function(_0x196f9a,_0x29b2fc){return client['request'](_0x7496e3,_0x533fe5)['then'](function(_0x1211a4){logger[_0xb257('0x9')]('FaxApplication,\x20%s,\x20%s',_0x11b048,_0xb257('0xa'));logger[_0xb257('0xb')](_0xb257('0xc'),_0x11b048,_0xb257('0xa'),JSON[_0xb257('0xd')](_0x1211a4));if(_0x1211a4[_0xb257('0xe')]){if(_0x1211a4['error'][_0xb257('0xf')]===0x1f4){logger[_0xb257('0xe')](_0xb257('0x10'),_0x11b048,_0x1211a4['error']['message']);return _0x29b2fc(_0x1211a4[_0xb257('0xe')][_0xb257('0x11')]);}logger['error'](_0xb257('0x10'),_0x11b048,_0x1211a4['error'][_0xb257('0x11')]);return _0x196f9a(_0x1211a4[_0xb257('0xe')][_0xb257('0x11')]);}else{logger[_0xb257('0x9')](_0xb257('0x10'),_0x11b048,'request\x20sent');_0x196f9a(_0x1211a4[_0xb257('0x12')][_0xb257('0x11')]);}})[_0xb257('0x13')](function(_0x489433){logger['error']('FaxApplication,\x20%s,\x20%s',_0x11b048,_0x489433);_0x29b2fc(_0x489433);});});}exports['UpdateFaxApplication']=function(_0xfae58d){var _0x23a030=this;return new Promise(function(_0x4a3b0c,_0x128dab){return db['FaxApplication'][_0xb257('0x14')](_0xfae58d[_0xb257('0x15')],{'raw':_0xfae58d['options']?_0xfae58d[_0xb257('0x16')][_0xb257('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xfae58d[_0xb257('0x16')]?_0xfae58d['options']['where']||null:null,'attributes':_0xfae58d[_0xb257('0x16')]?_0xfae58d[_0xb257('0x16')][_0xb257('0x18')]||null:null,'limit':_0xfae58d[_0xb257('0x16')]?_0xfae58d[_0xb257('0x16')][_0xb257('0x19')]||null:null})[_0xb257('0x1a')](function(_0x4025d3){logger[_0xb257('0x9')](_0xb257('0x1b'),_0xfae58d);logger[_0xb257('0xb')](_0xb257('0x1b'),_0xfae58d,JSON[_0xb257('0xd')](_0x4025d3));_0x4a3b0c(_0x4025d3);})[_0xb257('0x13')](function(_0x5299ec){logger[_0xb257('0xe')](_0xb257('0x1b'),_0x5299ec['message'],_0xfae58d);_0x128dab(_0x23a030[_0xb257('0xe')](0x1f4,_0x5299ec['message']));});});}; \ No newline at end of file diff --git a/server/api/faxApplication/index.js b/server/api/faxApplication/index.js index 5c56b2a..957172c 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 _0x1eba=['express','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxApplication.controller','get','isAuthenticated','index','/:id','show','post','create','update','destroy','exports','multer','util','path','connect-timeout'];(function(_0x1beef3,_0x57c4b8){var _0x5af964=function(_0x36f463){while(--_0x36f463){_0x1beef3['push'](_0x1beef3['shift']());}};_0x5af964(++_0x57c4b8);}(_0x1eba,0x1d7));var _0xa1eb=function(_0x36dfbd,_0x5bfe2d){_0x36dfbd=_0x36dfbd-0x0;var _0x4ecad9=_0x1eba[_0x36dfbd];return _0x4ecad9;};'use strict';var multer=require(_0xa1eb('0x0'));var util=require(_0xa1eb('0x1'));var path=require(_0xa1eb('0x2'));var timeout=require(_0xa1eb('0x3'));var express=require(_0xa1eb('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xa1eb('0x5'));var interaction=require(_0xa1eb('0x6'));var config=require(_0xa1eb('0x7'));var controller=require(_0xa1eb('0x8'));router[_0xa1eb('0x9')]('/',auth[_0xa1eb('0xa')](),controller[_0xa1eb('0xb')]);router[_0xa1eb('0x9')](_0xa1eb('0xc'),auth[_0xa1eb('0xa')](),controller[_0xa1eb('0xd')]);router[_0xa1eb('0xe')]('/',auth['isAuthenticated'](),controller[_0xa1eb('0xf')]);router['put'](_0xa1eb('0xc'),auth['isAuthenticated'](),controller[_0xa1eb('0x10')]);router['delete'](_0xa1eb('0xc'),auth['isAuthenticated'](),controller[_0xa1eb('0x11')]);module[_0xa1eb('0x12')]=router; \ No newline at end of file +var _0xefda=['post','create','update','delete','destroy','exports','multer','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxApplication.controller','get','index','/:id','isAuthenticated'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xefda,0x96));var _0xaefd=function(_0x4566a8,_0x1302ed){_0x4566a8=_0x4566a8-0x0;var _0x343e02=_0xefda[_0x4566a8];return _0x343e02;};'use strict';var multer=require(_0xaefd('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xaefd('0x1'));var express=require(_0xaefd('0x2'));var router=express['Router']();var fs_extra=require(_0xaefd('0x3'));var auth=require(_0xaefd('0x4'));var interaction=require(_0xaefd('0x5'));var config=require(_0xaefd('0x6'));var controller=require(_0xaefd('0x7'));router[_0xaefd('0x8')]('/',auth['isAuthenticated'](),controller[_0xaefd('0x9')]);router[_0xaefd('0x8')](_0xaefd('0xa'),auth[_0xaefd('0xb')](),controller['show']);router[_0xaefd('0xc')]('/',auth[_0xaefd('0xb')](),controller[_0xaefd('0xd')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0xaefd('0xe')]);router[_0xaefd('0xf')](_0xaefd('0xa'),auth[_0xaefd('0xb')](),controller[_0xaefd('0x10')]);module[_0xaefd('0x11')]=router; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.attributes.js b/server/api/faxInteraction/faxInteraction.attributes.js index 41cdac7..62556ad 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 _0xab7b=['sequelize','exports','BOOLEAN','STRING','ENUM','out','DATE'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xab7b,0x11f));var _0xbab7=function(_0x1f97e8,_0x445a4a){_0x1f97e8=_0x1f97e8-0x0;var _0x1ed77c=_0xab7b[_0x1f97e8];return _0x1ed77c;};'use strict';var Sequelize=require(_0xbab7('0x0'));module[_0xbab7('0x1')]={'closed':{'type':Sequelize[_0xbab7('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0xbab7('0x3')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0xbab7('0x3')]},'read1stAt':{'type':Sequelize['DATE']},'fax':{'type':Sequelize['STRING']},'firstMsgDirection':{'type':Sequelize[_0xbab7('0x4')]('in',_0xbab7('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xbab7('0x6')]},'lastMsgDirection':{'type':Sequelize[_0xbab7('0x4')]('in',_0xbab7('0x5')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file +var _0x26c9=['out','sequelize','BOOLEAN','DATE','STRING','ENUM'];(function(_0x370b3f,_0x48437a){var _0x2031c4=function(_0x136c2e){while(--_0x136c2e){_0x370b3f['push'](_0x370b3f['shift']());}};_0x2031c4(++_0x48437a);}(_0x26c9,0x199));var _0x926c=function(_0x1e0f48,_0x50829e){_0x1e0f48=_0x1e0f48-0x0;var _0x5dd59e=_0x26c9[_0x1e0f48];return _0x5dd59e;};'use strict';var Sequelize=require(_0x926c('0x0'));module['exports']={'closed':{'type':Sequelize[_0x926c('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x926c('0x2')]},'disposition':{'type':Sequelize[_0x926c('0x3')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x926c('0x3')]},'note':{'type':Sequelize[_0x926c('0x3')]},'read1stAt':{'type':Sequelize['DATE']},'fax':{'type':Sequelize[_0x926c('0x3')]},'firstMsgDirection':{'type':Sequelize[_0x926c('0x4')]('in',_0x926c('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x926c('0x2')]},'lastMsgDirection':{'type':Sequelize[_0x926c('0x4')]('in',_0x926c('0x5')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.controller.js b/server/api/faxInteraction/faxInteraction.controller.js index a4d0459..29cf1c7 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 _0x6b60=['push','catch','waiting','answered','unmanaged','closed','UserId','talking','total','FaxInteraction','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','field','color','from','u.id','u.fullname','ui.FaxInteractionId','user_has_fax_interactions','left_join','u.id\x20=\x20ui.UserId','select','fax_interactions','cm_contacts','users','o.id\x20=\x20i.UserId','fax_accounts','a.id\x20=\x20i.FaxAccountId','fax_messages','me.FaxInteractionId\x20=\x20i.id','it.FaxInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','length','value','having','`\x20=\x200','Contact','operator','$substring','split','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','find','ContactId','buildExpression','text','start','Tag','union','User','body','some','compact','FaxAccountId','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','isArray','tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','filter','replace','isNumeric','i.id\x20LIKE\x20?','i.fax\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','Sequelize','QueryTypes','SELECT','clone','unreadMessages','contactName','isEmpty','i.FaxAccountId\x20IS\x20NOT\x20NULL','role','agent','user','getFaxAccounts','i.FaxAccountId\x20IS\x20NULL','i.FaxAccountId\x20IN\x20?','toString','sequelize','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','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','groupBy','FaxInteractionId','all','rows','show','includeAll','include','options','create','params','describe','addMessage','ids','omit','findOne','FaxMessage','format','YYYY-MM-DD\x20HH:mm:ss','addTags','setTags','spread','findAll','emit','faxInteractionTags:save','removeTags','unix','join','files','tmp','root','attachments','transcript-%d-%s.zip','Attachment','createdAt','mkdirSync','Messages','basename','existsSync','createReadStream','pipe','createWriteStream','resolve','download','log','err','unlinkSync','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxInteraction.socket','register','sendStatus','status','json','offset','undefined','limit','count','Content-Range','reject','save','update','then','destroy','end','error','stack','name','send','map','fullname','TagIds','forEach','Tags'];(function(_0x24074,_0x1efba3){var _0x3ff6a8=function(_0x2fd7dd){while(--_0x2fd7dd){_0x24074['push'](_0x24074['shift']());}};_0x3ff6a8(++_0x1efba3);}(_0x6b60,0x19e));var _0x06b6=function(_0x55fa03,_0xcb96c2){_0x55fa03=_0x55fa03-0x0;var _0x2cd7cd=_0x6b60[_0x55fa03];return _0x2cd7cd;};'use strict';var emlformat=require(_0x06b6('0x0'));var rimraf=require(_0x06b6('0x1'));var zipdir=require(_0x06b6('0x2'));var jsonpatch=require(_0x06b6('0x3'));var rp=require(_0x06b6('0x4'));var moment=require('moment');var BPromise=require(_0x06b6('0x5'));var Mustache=require('mustache');var util=require(_0x06b6('0x6'));var path=require('path');var sox=require(_0x06b6('0x7'));var csv=require(_0x06b6('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x06b6('0x9'));var _=require(_0x06b6('0xa'));var squel=require(_0x06b6('0xb'));var crypto=require(_0x06b6('0xc'));var jsforce=require(_0x06b6('0xd'));var deskjs=require(_0x06b6('0xe'));var toCsv=require(_0x06b6('0x8'));var querystring=require(_0x06b6('0xf'));var Papa=require(_0x06b6('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x06b6('0x11'));var as=require(_0x06b6('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x06b6('0x13'))(_0x06b6('0x14'));var utils=require(_0x06b6('0x15'));var config=require(_0x06b6('0x16'));var licenseUtil=require(_0x06b6('0x17'));var db=require(_0x06b6('0x18'))['db'];config[_0x06b6('0x19')]=_[_0x06b6('0x1a')](config[_0x06b6('0x19')],{'host':_0x06b6('0x1b'),'port':0x18eb});var socket=require(_0x06b6('0x1c'))(new Redis(config[_0x06b6('0x19')]));require(_0x06b6('0x1d'))[_0x06b6('0x1e')](socket);function respondWithStatusCode(_0x32ac92,_0x49b92d){_0x49b92d=_0x49b92d||0xcc;return function(_0x30468c){if(_0x30468c){return _0x32ac92[_0x06b6('0x1f')](_0x49b92d);}return _0x32ac92[_0x06b6('0x20')](_0x49b92d)['end']();};}function respondWithResult(_0x1d9ed4,_0x273cb7){_0x273cb7=_0x273cb7||0xc8;return function(_0x5d7609){if(_0x5d7609){return _0x1d9ed4[_0x06b6('0x20')](_0x273cb7)[_0x06b6('0x21')](_0x5d7609);}};}function respondWithFilteredResult(_0x529d5f,_0x499ed2){return function(_0x27ea64){if(_0x27ea64){var _0x523f5c=typeof _0x499ed2[_0x06b6('0x22')]===_0x06b6('0x23')&&typeof _0x499ed2[_0x06b6('0x24')]===_0x06b6('0x23');var _0x3fd70f=_0x27ea64[_0x06b6('0x25')];var _0xca4f92=_0x523f5c?0x0:_0x499ed2[_0x06b6('0x22')];var _0x3e22df=_0x523f5c?_0x27ea64[_0x06b6('0x25')]:_0x499ed2[_0x06b6('0x22')]+_0x499ed2['limit'];var _0x255c33;if(_0x3e22df>=_0x3fd70f){_0x3e22df=_0x3fd70f;_0x255c33=0xc8;}else{_0x255c33=0xce;}_0x529d5f[_0x06b6('0x20')](_0x255c33);return _0x529d5f['set'](_0x06b6('0x26'),_0xca4f92+'-'+_0x3e22df+'/'+_0x3fd70f)['json'](_0x27ea64);}return null;};}function patchUpdates(_0x6cbfaa){return function(_0x5a1ca2){try{jsonpatch['apply'](_0x5a1ca2,_0x6cbfaa,!![]);}catch(_0xb805de){return BPromise[_0x06b6('0x27')](_0xb805de);}return _0x5a1ca2[_0x06b6('0x28')]();};}function saveUpdates(_0x3ba679,_0x4c07a7){return function(_0x5bf6a7){if(_0x5bf6a7){return _0x5bf6a7[_0x06b6('0x29')](_0x3ba679)[_0x06b6('0x2a')](function(_0x19d4a3){return _0x19d4a3;});}return null;};}function removeEntity(_0x330e4f,_0x3ec269){return function(_0xd97f62){if(_0xd97f62){return _0xd97f62[_0x06b6('0x2b')]()[_0x06b6('0x2a')](function(){_0x330e4f['status'](0xcc)[_0x06b6('0x2c')]();});}};}function handleEntityNotFound(_0x4356d5,_0x5b90aa){return function(_0x4d2870){if(!_0x4d2870){_0x4356d5['sendStatus'](0x194);}return _0x4d2870;};}function handleError(_0x1237b9,_0x368f84){_0x368f84=_0x368f84||0x1f4;return function(_0x16bfcb){logger[_0x06b6('0x2d')](_0x16bfcb[_0x06b6('0x2e')]);if(_0x16bfcb['name']){delete _0x16bfcb[_0x06b6('0x2f')];}_0x1237b9[_0x06b6('0x20')](_0x368f84)[_0x06b6('0x30')](_0x16bfcb);};}function getInteractionUsers(_0x1cd1ee,_0x3501bb){return new BPromise(function(_0xe214db,_0x11d340){try{if(_0x3501bb[_0x1cd1ee['id']]){_0x1cd1ee['Users']=_[_0x06b6('0x31')](_0x3501bb[_0x1cd1ee['id']],function(_0x2c3454){return{'id':_0x2c3454['id'],'fullname':_0x2c3454[_0x06b6('0x32')]};});}}catch(_0x555b24){_0x11d340(_0x555b24);}_0xe214db(_0x1cd1ee);});}function getInteractionTags(_0x4ab56a,_0x562c43){return new BPromise(function(_0x21b5be,_0xb9bae0){try{if(_0x4ab56a[_0x06b6('0x33')]){_0x4ab56a['Tags']=[];_0x4ab56a[_0x06b6('0x33')]['split'](',')[_0x06b6('0x34')](function(_0x587063){_0x4ab56a[_0x06b6('0x35')][_0x06b6('0x36')](_0x562c43[_0x587063]);});}delete _0x4ab56a[_0x06b6('0x33')];}catch(_0x47ec76){_0xb9bae0(_0x47ec76);}_0x21b5be(_0x4ab56a);});}function updateFaxInteraction(_0x2943b9,_0x527dc1,_0x409c08){return new BPromise(function(_0x46011e,_0x451e1f){return getInteractionUsers(_0x2943b9,_0x409c08)[_0x06b6('0x2a')](function(_0x6707f5){return getInteractionTags(_0x6707f5,_0x527dc1);})[_0x06b6('0x2a')](function(_0x1d87cb){return getStateInteraction(_0x1d87cb);})['then'](function(_0x4864b3){_0x46011e(_0x4864b3);})[_0x06b6('0x37')](function(_0x596ea5){_0x451e1f(_0x596ea5);});});}function getStateInteraction(_0x29866f){return new BPromise(function(_0x3fcc0c){_0x29866f[_0x06b6('0x38')]=0x0;_0x29866f['talking']=0x0;_0x29866f[_0x06b6('0x39')]=0x0;_0x29866f[_0x06b6('0x3a')]=0x0;_0x29866f['total']=0x0;if(!_0x29866f['closed']&&!_0x29866f['UserId']){_0x29866f[_0x06b6('0x38')]+=0x1;}if(!_0x29866f[_0x06b6('0x3b')]&&_0x29866f[_0x06b6('0x3c')]){_0x29866f[_0x06b6('0x3d')]+=0x1;if(_0x29866f['waiting']){_0x29866f[_0x06b6('0x38')]-=0x1;}}if(_0x29866f[_0x06b6('0x3b')]&&_0x29866f[_0x06b6('0x3c')]){_0x29866f[_0x06b6('0x39')]+=0x1;if(_0x29866f[_0x06b6('0x3d')]){_0x29866f[_0x06b6('0x3d')]-=0x1;}}if(_0x29866f['closed']&&!_0x29866f['UserId']){_0x29866f['unmanaged']+=0x1;if(_0x29866f[_0x06b6('0x38')]){_0x29866f['waiting']-=0x1;}}_0x29866f[_0x06b6('0x3e')]+=0x1;_0x3fcc0c(_0x29866f);});}exports['index']=function(_0x5c395f,_0x4878d6){var _0x142bdd={},_0x12a1ab={},_0x265654={'count':0x0,'rows':[]};var _0x1081df=_['map'](db[_0x06b6('0x3f')][_0x06b6('0x40')],function(_0x4f1fce){return{'name':_0x4f1fce[_0x06b6('0x41')],'type':_0x4f1fce[_0x06b6('0x42')][_0x06b6('0x43')]};});_0x12a1ab[_0x06b6('0x44')]=_['map'](_0x1081df,_0x06b6('0x2f'));_0x12a1ab[_0x06b6('0x45')]=_[_0x06b6('0x46')](_0x5c395f[_0x06b6('0x45')]);_0x12a1ab[_0x06b6('0x47')]=_[_0x06b6('0x48')](_0x12a1ab[_0x06b6('0x44')],_0x12a1ab[_0x06b6('0x45')]);_0x142bdd[_0x06b6('0x49')]=_[_0x06b6('0x48')](_0x12a1ab[_0x06b6('0x44')],qs['fields'](_0x5c395f[_0x06b6('0x45')][_0x06b6('0x4a')]));_0x142bdd[_0x06b6('0x49')]=_0x142bdd['attributes']['length']?_0x142bdd[_0x06b6('0x49')]:_0x12a1ab['model'];if(!_0x5c395f[_0x06b6('0x45')][_0x06b6('0x4b')](_0x06b6('0x4c'))){_0x142bdd[_0x06b6('0x24')]=qs[_0x06b6('0x24')](_0x5c395f[_0x06b6('0x45')]['limit']);_0x142bdd[_0x06b6('0x22')]=qs[_0x06b6('0x22')](_0x5c395f[_0x06b6('0x45')][_0x06b6('0x22')]);}_0x142bdd[_0x06b6('0x4d')]=qs[_0x06b6('0x4e')](_0x5c395f[_0x06b6('0x45')][_0x06b6('0x4e')]);_0x142bdd[_0x06b6('0x4f')]=qs[_0x06b6('0x47')](_[_0x06b6('0x50')](_0x5c395f[_0x06b6('0x45')],_0x12a1ab[_0x06b6('0x47')]),_0x1081df);var _0xd5eab0=[];var _0x3db01a=squel['select']()[_0x06b6('0x51')]('id')['field'](_0x06b6('0x2f'))[_0x06b6('0x51')](_0x06b6('0x52'))[_0x06b6('0x53')]('tools_tags');var _0x2d555a=squel['select']()['field'](_0x06b6('0x54'))[_0x06b6('0x51')](_0x06b6('0x55'))[_0x06b6('0x51')](_0x06b6('0x56'))[_0x06b6('0x53')](_0x06b6('0x57'),'ui')[_0x06b6('0x58')]('users','u',_0x06b6('0x59'));var _0x126a54=squel[_0x06b6('0x5a')]()[_0x06b6('0x53')](_0x06b6('0x5b'),'i')[_0x06b6('0x58')](_0x06b6('0x5c'),'c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')[_0x06b6('0x58')](_0x06b6('0x5d'),'o',_0x06b6('0x5e'))[_0x06b6('0x58')](_0x06b6('0x5f'),'a',_0x06b6('0x60'))[_0x06b6('0x58')](_0x06b6('0x61'),'me',_0x06b6('0x62'))['left_join']('fax_interaction_has_tags','it',_0x06b6('0x63'))[_0x06b6('0x58')]('tools_tags','t',_0x06b6('0x64'));var _0x1cc0ab=squel[_0x06b6('0x65')]();var _0x1f0446=[];var _0xa087e6=squel['expr']();var _0x4b0f3b;if(_0x5c395f[_0x06b6('0x45')][_0x06b6('0x66')]){_0x4b0f3b=as[_0x06b6('0x67')](_0x5c395f[_0x06b6('0x45')][_0x06b6('0x66')]);var _0xabb10=_0x4b0f3b[_0x06b6('0x68')];for(var _0x257842=0x0;_0x257842<_0x4b0f3b[_0x06b6('0x69')][_0x06b6('0x6a')];_0x257842++){var _0x51c47a=_0x4b0f3b[_0x06b6('0x69')][_0x257842];var _0x3d9e4d='i';var _0x440f7a=_['find'](_0x1081df,[_0x06b6('0x2f'),_0x51c47a[_0x06b6('0x51')]]);if(!_0x440f7a){switch(_0x51c47a['field']){case'unreadMessages':if(_0x51c47a[_0x06b6('0x6b')]==0x1){_0x126a54[_0x06b6('0x6c')]('`'+_0x51c47a['field']+_0x06b6('0x6d'));}else{_0x126a54['having']('`'+_0x51c47a[_0x06b6('0x51')]+'`\x20>\x200');}break;case _0x06b6('0x6e'):if(_0x51c47a[_0x06b6('0x6f')]===_0x06b6('0x70')){if(_0x51c47a[_0x06b6('0x6b')][_0x06b6('0x71')]('\x20')['length']>0x1){_0x1cc0ab[_0xabb10](_0x06b6('0x72'),qs[_0x06b6('0x73')](_0x51c47a['value']),null);}else{var _0x1c6a20='%'+_0x51c47a[_0x06b6('0x6b')]+'%';_0x1cc0ab[_0xabb10](_0x06b6('0x74'),_0x1c6a20,_0x1c6a20,_0x1c6a20);}}else{_0x440f7a=_[_0x06b6('0x75')](_0x1081df,[_0x06b6('0x2f'),'ContactId']);_0x51c47a[_0x06b6('0x51')]=_0x06b6('0x76');_0x1eaac5=as[_0x06b6('0x77')](_0x3d9e4d,_0x440f7a[_0x06b6('0x42')],_0x51c47a);_0x1cc0ab[_0xabb10](_0x1eaac5[_0x06b6('0x78')],_0x1eaac5['value'][_0x06b6('0x79')],_0x1eaac5['value'][_0x06b6('0x2c')]);}break;case _0x06b6('0x7a'):var _0x576da7=_0x51c47a['value'][_0x06b6('0x71')](',')[_0x06b6('0x31')](function(_0x3db7a4){return Number(_0x3db7a4);});_0x576da7[_0x06b6('0x34')](function(_0x566ec9){_0xa087e6['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x566ec9+',%');});_0x1f0446=_[_0x06b6('0x7b')](_0x1f0446,_0x576da7);break;case _0x06b6('0x7c'):if(_0x51c47a[_0x06b6('0x6f')]==='$substring'){_0x1cc0ab[_0xabb10]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x51c47a[_0x06b6('0x6b')]+'%',null);}else{_0x440f7a=_[_0x06b6('0x75')](_0x1081df,[_0x06b6('0x2f'),_0x06b6('0x3c')]);_0x51c47a[_0x06b6('0x51')]=_0x06b6('0x3c');_0x1eaac5=as[_0x06b6('0x77')](_0x3d9e4d,_0x440f7a[_0x06b6('0x42')],_0x51c47a);_0x1cc0ab[_0xabb10](_0x1eaac5[_0x06b6('0x78')],_0x1eaac5[_0x06b6('0x6b')]['start'],_0x1eaac5[_0x06b6('0x6b')][_0x06b6('0x2c')]);}break;case _0x06b6('0x7d'):_0x1eaac5=as[_0x06b6('0x77')]('me',null,_0x51c47a);_0x1cc0ab[_0xabb10](_0x1eaac5[_0x06b6('0x78')],_0x1eaac5[_0x06b6('0x6b')][_0x06b6('0x79')],_0x1eaac5[_0x06b6('0x6b')][_0x06b6('0x2c')]);break;}}else{var _0x1eaac5=as['buildExpression'](_0x3d9e4d,_0x440f7a[_0x06b6('0x42')],_0x51c47a);_0x1cc0ab[_0xabb10](_0x1eaac5[_0x06b6('0x78')],_0x1eaac5[_0x06b6('0x6b')][_0x06b6('0x79')],_0x1eaac5[_0x06b6('0x6b')][_0x06b6('0x2c')]);}}}else{var _0x17e4ef=_(_0x5c395f['query'])[_0x06b6('0x46')]()[_0x06b6('0x31')](function(_0x4b77ee){return _[_0x06b6('0x7e')](_0x1081df,[_0x06b6('0x2f'),_0x4b77ee])?_0x4b77ee:undefined;})[_0x06b6('0x7f')]()[_0x06b6('0x6b')]();if(!_['isEmpty'](_0x17e4ef)){_0x17e4ef[_0x06b6('0x34')](function(_0x36b10f){if(_0x36b10f===_0x06b6('0x80')){_0x126a54['where']('i.FaxAccountId\x20IN\x20?',[]['concat'](_0x5c395f[_0x06b6('0x45')][_0x36b10f]));}else if(_0x36b10f==='createdAt'){var _0x1e8670=JSON[_0x06b6('0x81')](_0x5c395f['query'][_0x36b10f])[_0x06b6('0x82')];var _0x412ac5=JSON[_0x06b6('0x81')](_0x5c395f[_0x06b6('0x45')][_0x36b10f])[_0x06b6('0x83')];_0x126a54['where'](_0x06b6('0x84'),_0x1e8670,_0x412ac5);}else{if(_0x5c395f[_0x06b6('0x45')][_0x36b10f]===_0x06b6('0x85')){_0x126a54['where']('i.'+_0x36b10f+_0x06b6('0x86'));}else{_0x126a54[_0x06b6('0x4f')]('i.'+_0x36b10f+_0x06b6('0x87'),_0x5c395f[_0x06b6('0x45')][_0x36b10f]);}}});}if(_0x5c395f[_0x06b6('0x45')][_0x06b6('0x88')]){if(_0x5c395f[_0x06b6('0x45')][_0x06b6('0x88')]==0x1){_0x126a54[_0x06b6('0x6c')](_0x06b6('0x89'));}else{_0x126a54[_0x06b6('0x6c')](_0x06b6('0x8a'));}}if(_0x5c395f['query']['tag']){_0x1f0446=_[_0x06b6('0x8b')](_0x5c395f[_0x06b6('0x45')][_0x06b6('0x8c')])?_0x5c395f[_0x06b6('0x45')]['tag']:new Array(_0x5c395f[_0x06b6('0x45')][_0x06b6('0x8c')]);_0x1f0446[_0x06b6('0x34')](function(_0x57854a){_0xa087e6['or'](_0x06b6('0x8d'),'%,'+_0x57854a+',%');});}if(_0x5c395f[_0x06b6('0x45')][_0x06b6('0x8e')]){var _0x41bb4d=_0x5c395f['query']['filter'][_0x06b6('0x8f')]('\x5c','\x5c\x5c')[_0x06b6('0x8f')](/'/g,'\x27\x27');if(qs[_0x06b6('0x90')](_0x41bb4d)){_0x1cc0ab['or'](_0x06b6('0x91'),_0x41bb4d+'%')['or'](_0x06b6('0x92'),_0x41bb4d+'%');}_0x1cc0ab['or'](_0x06b6('0x93'),_0x41bb4d+'%');}}_0x126a54[_0x06b6('0x4f')](_0x1cc0ab);_0x126a54[_0x06b6('0x94')]('i.id');var _0x44ac55={'type':db[_0x06b6('0x95')][_0x06b6('0x96')][_0x06b6('0x97')],'raw':!![]};var _0x192d56=_0x126a54[_0x06b6('0x98')]();_0x192d56['field']('i.id');_0x192d56[_0x06b6('0x51')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x06b6('0x99'));if(_0x142bdd[_0x06b6('0x4d')]){_0x142bdd[_0x06b6('0x4d')]['forEach'](function(_0x21baea){var _0x109699=_0x21baea[0x0]===_0x06b6('0x9a')?_0x21baea[0x0]:'i.'+_0x21baea[0x0];_0x126a54['order'](_0x109699,_0x21baea[0x1]==='DESC'?![]:!![]);});}if(!_[_0x06b6('0x9b')](_0x1f0446)){_0x126a54['having'](_0xa087e6);_0x192d56['where']('t.id\x20IN\x20?',_0x1f0446);}BPromise['resolve']()[_0x06b6('0x2a')](function(){if(!_0x4b0f3b){if(_0x5c395f[_0x06b6('0x45')][_0x06b6('0x80')])return;_0x192d56[_0x06b6('0x4f')](_0x06b6('0x9c'));_0x126a54['where'](_0x06b6('0x9c'));return;}if(_0x5c395f['user'][_0x06b6('0x9d')]!==_0x06b6('0x9e'))return;return _0x5c395f[_0x06b6('0x9f')][_0x06b6('0xa0')]({'attributes':['id'],'raw':!![]})[_0x06b6('0x2a')](function(_0x44d23c){if(_[_0x06b6('0x9b')](_0x44d23c)){_0x192d56[_0x06b6('0x4f')](_0x06b6('0xa1'));_0x126a54[_0x06b6('0x4f')](_0x06b6('0xa1'));}else{_0x192d56['where']('i.FaxAccountId\x20IN\x20?',_[_0x06b6('0x31')](_0x44d23c,'id'));_0x126a54[_0x06b6('0x4f')](_0x06b6('0xa2'),_[_0x06b6('0x31')](_0x44d23c,'id'));}});})[_0x06b6('0x2a')](function(){if(_0x5c395f[_0x06b6('0x9f')][_0x06b6('0x9d')]===_0x06b6('0x9e')&&!_0x4b0f3b&&!_0x5c395f[_0x06b6('0x45')][_0x06b6('0x80')])return[];return db['sequelize']['query'](_0x192d56[_0x06b6('0xa3')](),_0x44ac55);})[_0x06b6('0x2a')](function(_0x543f1c){_0x265654[_0x06b6('0x25')]=_0x543f1c[_0x06b6('0x6a')];if(_0x265654['count']===0x0)return[];return db[_0x06b6('0xa4')]['query'](_0x3db01a[_0x06b6('0xa3')](),_0x44ac55)[_0x06b6('0x2a')](function(_0x149c7c){_0xd5eab0=_[_0x06b6('0xa5')](_0x149c7c,'id');_0x44ac55=_[_0x06b6('0xa6')](_0x44ac55,{'model':db[_0x06b6('0x3f')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x5c395f[_0x06b6('0x45')][_0x06b6('0x4a')]){_0x142bdd[_0x06b6('0x49')][_0x06b6('0x34')](function(_0x17400f){_0x126a54[_0x06b6('0x51')]('i.'+_0x17400f);});}else{_0x126a54[_0x06b6('0x51')](_0x06b6('0xa7'),_0x06b6('0x99'));_0x126a54[_0x06b6('0x51')](_0x06b6('0xa8'),_0x06b6('0xa9'));_0x126a54[_0x06b6('0x51')](_0x06b6('0xaa'),_0x06b6('0xab'));_0x126a54[_0x06b6('0x51')](_0x06b6('0xac'),'contactName');_0x126a54[_0x06b6('0x51')]('i.*');_0x126a54[_0x06b6('0x51')]('c.firstName',_0x06b6('0xad'));_0x126a54[_0x06b6('0x51')](_0x06b6('0xae'),_0x06b6('0xaf'));_0x126a54[_0x06b6('0x51')](_0x06b6('0xb0'),_0x06b6('0xb1'));_0x126a54[_0x06b6('0x51')](_0x06b6('0xb2'),_0x06b6('0xb3'));_0x126a54[_0x06b6('0x51')](_0x06b6('0xb4'),'Contact.mobile');_0x126a54[_0x06b6('0x51')](_0x06b6('0xb5'),_0x06b6('0xb6'));_0x126a54[_0x06b6('0x51')](_0x06b6('0xb7'),_0x06b6('0xb8'));_0x126a54[_0x06b6('0x51')](_0x06b6('0xb9'),_0x06b6('0xba'));_0x126a54[_0x06b6('0x51')](_0x06b6('0xbb'),_0x06b6('0x33'));}if(_0x142bdd['limit'])_0x126a54[_0x06b6('0x24')](_0x142bdd[_0x06b6('0x24')]);if(_0x142bdd[_0x06b6('0x22')])_0x126a54['offset'](_0x142bdd[_0x06b6('0x22')]);return db[_0x06b6('0xa4')][_0x06b6('0x45')](_0x126a54['toString'](),_0x44ac55);})[_0x06b6('0x2a')](function(_0x45566f){if(_0x45566f[_0x06b6('0x6a')]>0x0)_0x2d555a[_0x06b6('0x4f')]('ui.FaxInteractionId\x20IN\x20?',_[_0x06b6('0x31')](_0x45566f,'id'));return db[_0x06b6('0xa4')][_0x06b6('0x45')](_0x2d555a[_0x06b6('0xa3')](),_0x44ac55)[_0x06b6('0x2a')](function(_0x45eac8){var _0x1b3e5f=_[_0x06b6('0xbc')](_0x45eac8,_0x06b6('0xbd'));var _0x13f60a=[];_0x45566f['forEach'](function(_0x4337dc){_0x13f60a['push'](updateFaxInteraction(_0x4337dc,_0xd5eab0,_0x1b3e5f));});return BPromise[_0x06b6('0xbe')](_0x13f60a);});});})['then'](function(_0x430028){_0x265654[_0x06b6('0xbf')]=_0x430028;return _0x265654;})['then'](respondWithFilteredResult(_0x4878d6,_0x142bdd))[_0x06b6('0x37')](handleError(_0x4878d6,null));};exports[_0x06b6('0xc0')]=function(_0x2c262d,_0x41dafc){var _0x12e728={'raw':![],'where':{'id':_0x2c262d['params']['id']}},_0xae3852={};_0xae3852[_0x06b6('0x44')]=_[_0x06b6('0x46')](db['FaxInteraction'][_0x06b6('0x40')]);_0xae3852[_0x06b6('0x45')]=_[_0x06b6('0x46')](_0x2c262d['query']);_0xae3852[_0x06b6('0x47')]=_[_0x06b6('0x48')](_0xae3852[_0x06b6('0x44')],_0xae3852[_0x06b6('0x45')]);_0x12e728[_0x06b6('0x49')]=_[_0x06b6('0x48')](_0xae3852['model'],qs[_0x06b6('0x4a')](_0x2c262d[_0x06b6('0x45')][_0x06b6('0x4a')]));_0x12e728['attributes']=_0x12e728['attributes'][_0x06b6('0x6a')]?_0x12e728[_0x06b6('0x49')]:_0xae3852['model'];if(_0x2c262d[_0x06b6('0x45')][_0x06b6('0xc1')]){_0x12e728[_0x06b6('0xc2')]=[{'all':!![]}];}_0x12e728=_['merge']({},_0x12e728,_0x2c262d[_0x06b6('0xc3')]);return db[_0x06b6('0x3f')][_0x06b6('0x75')](_0x12e728)[_0x06b6('0x2a')](handleEntityNotFound(_0x41dafc,null))[_0x06b6('0x2a')](respondWithResult(_0x41dafc,null))['catch'](handleError(_0x41dafc,null));};exports[_0x06b6('0xc4')]=function(_0x55ddf3,_0x224d53){return db[_0x06b6('0x3f')][_0x06b6('0xc4')](_0x55ddf3['body'],{})['then'](respondWithResult(_0x224d53,0xc9))[_0x06b6('0x37')](handleError(_0x224d53,null));};exports[_0x06b6('0x29')]=function(_0xe9ae4d,_0x41a4c4){if(_0xe9ae4d[_0x06b6('0x7d')]['id']){delete _0xe9ae4d['body']['id'];}return db[_0x06b6('0x3f')][_0x06b6('0x75')]({'where':{'id':_0xe9ae4d[_0x06b6('0xc5')]['id']}})['then'](handleEntityNotFound(_0x41a4c4,null))[_0x06b6('0x2a')](saveUpdates(_0xe9ae4d[_0x06b6('0x7d')],null))[_0x06b6('0x2a')](respondWithResult(_0x41a4c4,null))[_0x06b6('0x37')](handleError(_0x41a4c4,null));};exports[_0x06b6('0x2b')]=function(_0x33f465,_0x140f79){return db[_0x06b6('0x3f')][_0x06b6('0x75')]({'where':{'id':_0x33f465[_0x06b6('0xc5')]['id']}})['then'](handleEntityNotFound(_0x140f79,null))[_0x06b6('0x2a')](removeEntity(_0x140f79,null))[_0x06b6('0x37')](handleError(_0x140f79,null));};exports[_0x06b6('0xc6')]=function(_0x128665,_0x30940){return db['FaxInteraction'][_0x06b6('0xc6')]()['then'](respondWithResult(_0x30940,null))[_0x06b6('0x37')](handleError(_0x30940,null));};exports[_0x06b6('0xc7')]=function(_0x523968,_0x4db12a,_0x23d907){return db['FaxMessage'][_0x06b6('0x75')]({'where':{'id':_0x523968['params']['id']}})[_0x06b6('0x2a')](handleEntityNotFound(_0x4db12a,null))[_0x06b6('0x2a')](function(_0x32299a){if(_0x32299a){return _0x32299a['addMessage'](_0x523968[_0x06b6('0x7d')][_0x06b6('0xc8')],_[_0x06b6('0xc9')](_0x523968[_0x06b6('0x7d')],[_0x06b6('0xc8'),'id'])||{});}})[_0x06b6('0x2a')](respondWithResult(_0x4db12a,null))[_0x06b6('0x37')](handleError(_0x4db12a,null));};exports['getMessages']=function(_0x34263e,_0x7de7df,_0xb3d929){var _0x128782={'raw':![],'where':{}};var _0x262696={};var _0x356fec={'count':0x0,'rows':[]};return db[_0x06b6('0x3f')][_0x06b6('0xca')]({'where':{'id':_0x34263e[_0x06b6('0xc5')]['id']}})[_0x06b6('0x2a')](handleEntityNotFound(_0x7de7df,null))[_0x06b6('0x2a')](function(_0x8d8677){if(_0x8d8677){_0x262696[_0x06b6('0x44')]=_[_0x06b6('0x46')](db[_0x06b6('0xcb')][_0x06b6('0x40')]);_0x262696['query']=_[_0x06b6('0x46')](_0x34263e['query']);_0x262696[_0x06b6('0x47')]=_[_0x06b6('0x48')](_0x262696[_0x06b6('0x44')],_0x262696[_0x06b6('0x45')]);_0x128782[_0x06b6('0x49')]=_[_0x06b6('0x48')](_0x262696[_0x06b6('0x44')],qs[_0x06b6('0x4a')](_0x34263e[_0x06b6('0x45')][_0x06b6('0x4a')]));_0x128782[_0x06b6('0x49')]=_0x128782[_0x06b6('0x49')][_0x06b6('0x6a')]?_0x128782[_0x06b6('0x49')]:_0x262696[_0x06b6('0x44')];if(!_0x34263e[_0x06b6('0x45')]['hasOwnProperty'](_0x06b6('0x4c'))){_0x128782['limit']=qs['limit'](_0x34263e[_0x06b6('0x45')][_0x06b6('0x24')]);_0x128782[_0x06b6('0x22')]=qs[_0x06b6('0x22')](_0x34263e[_0x06b6('0x45')][_0x06b6('0x22')]);}_0x128782[_0x06b6('0x4d')]=qs['sort'](_0x34263e[_0x06b6('0x45')][_0x06b6('0x4e')]);_0x128782[_0x06b6('0x4f')]=qs[_0x06b6('0x47')](_[_0x06b6('0x50')](_0x34263e[_0x06b6('0x45')],_0x262696[_0x06b6('0x47')]));_0x128782[_0x06b6('0x4f')]['FaxInteractionId']=_0x8d8677['id'];if(_0x34263e[_0x06b6('0x45')]['filter']){_0x128782[_0x06b6('0x4f')]=_['merge'](_0x128782[_0x06b6('0x4f')],{'$or':_[_0x06b6('0x31')](_0x128782[_0x06b6('0x49')],function(_0x56ca9c){var _0x1273fe={};_0x1273fe[_0x56ca9c]={'$like':'%'+_0x34263e[_0x06b6('0x45')]['filter']+'%'};return _0x1273fe;})});}if(_0x34263e[_0x06b6('0x45')][_0x06b6('0x82')]){var _0x55f7ee=_0x34263e[_0x06b6('0x45')]['$gte']['split'](',');var _0x1ab70f={};_0x1ab70f[_0x55f7ee[0x0]]={'$gte':moment(_0x55f7ee[0x1])[_0x06b6('0xcc')](_0x06b6('0xcd'))};_0x128782[_0x06b6('0x4f')]=_['merge'](_0x128782['where'],_0x1ab70f);}_0x128782=_[_0x06b6('0xa6')]({},_0x128782,_0x34263e[_0x06b6('0xc3')]);return db[_0x06b6('0xcb')]['count']({'where':_0x128782[_0x06b6('0x4f')]})[_0x06b6('0x2a')](function(_0x157d61){_0x356fec[_0x06b6('0x25')]=_0x157d61;if(_0x34263e[_0x06b6('0x45')]['includeAll']){_0x128782[_0x06b6('0xc2')]=[{'all':!![]}];}return db['FaxMessage']['findAll'](_0x128782);})[_0x06b6('0x2a')](function(_0x2630d){_0x356fec[_0x06b6('0xbf')]=_0x2630d;return _0x356fec;});}})[_0x06b6('0x2a')](respondWithFilteredResult(_0x7de7df,_0x128782))[_0x06b6('0x37')](handleError(_0x7de7df,null));};exports[_0x06b6('0xce')]=function(_0x213d83,_0x39f767,_0x4dd055){return db[_0x06b6('0x3f')]['find']({'where':{'id':_0x213d83[_0x06b6('0xc5')]['id']}})[_0x06b6('0x2a')](handleEntityNotFound(_0x39f767,null))['then'](function(_0x4d97b2){if(_0x4d97b2){return _0x4d97b2[_0x06b6('0xcf')](_0x213d83[_0x06b6('0x7d')][_0x06b6('0xc8')],_[_0x06b6('0xc9')](_0x213d83[_0x06b6('0x7d')],[_0x06b6('0xc8'),'id'])||{})[_0x06b6('0xd0')](function(){return db[_0x06b6('0x7a')][_0x06b6('0xd1')]({'attributes':['id',_0x06b6('0x2f'),'color'],'where':{'id':_0x213d83['body'][_0x06b6('0xc8')]}});})[_0x06b6('0x2a')](function(_0x50f531){socket[_0x06b6('0xd2')](_0x06b6('0xd3'),{'id':Number(_0x213d83['params']['id']),'tags':_0x50f531||[]});return{'id':Number(_0x213d83[_0x06b6('0xc5')]['id']),'tags':_0x50f531||[]};});}})[_0x06b6('0x2a')](respondWithResult(_0x39f767,null))[_0x06b6('0x37')](handleError(_0x39f767,null));};exports[_0x06b6('0xd4')]=function(_0x594a35,_0x299817,_0x122b8f){return db[_0x06b6('0x3f')][_0x06b6('0x75')]({'where':{'id':_0x594a35[_0x06b6('0xc5')]['id']}})[_0x06b6('0x2a')](handleEntityNotFound(_0x299817,null))[_0x06b6('0x2a')](function(_0x35758e){if(_0x35758e){return _0x35758e['removeTags'](_0x594a35[_0x06b6('0x45')][_0x06b6('0xc8')]);}})[_0x06b6('0x2a')](respondWithStatusCode(_0x299817,null))[_0x06b6('0x37')](handleError(_0x299817,null));};exports['download']=function(_0x161127,_0x474f21){var _0x212590=moment()[_0x06b6('0xd5')]()[_0x06b6('0xa3')]();var _0x562633=path[_0x06b6('0xd6')](config['root'],'server',_0x06b6('0xd7'),_0x06b6('0xd8'));var _0x44f531=path[_0x06b6('0xd6')](config[_0x06b6('0xd9')],'server',_0x06b6('0xd7'),_0x06b6('0xda'));var _0x3eb7b9=path[_0x06b6('0xd6')](_0x562633,_0x212590);var _0x597ce8=util[_0x06b6('0xcc')](_0x06b6('0xdb'),_0x161127[_0x06b6('0xc5')]['id'],_0x212590);var _0x4d6474=path[_0x06b6('0xd6')](_0x562633,_0x597ce8);var _0x55a1d5=[];_0x55a1d5[_0x06b6('0x36')]({'model':db[_0x06b6('0xdc')],'as':_0x06b6('0xdc'),'raw':!![]});var _0x3d9210=[{'model':db[_0x06b6('0xcb')],'as':'Messages','attributes':['id',_0x06b6('0x7d'),_0x06b6('0xdd')],'include':_0x55a1d5}];return db['FaxInteraction'][_0x06b6('0x75')]({'where':{'id':_0x161127[_0x06b6('0xc5')]['id']},'include':_0x3d9210})['then'](handleEntityNotFound(_0x474f21,null))[_0x06b6('0x2a')](function(_0x4b71b4){if(_0x4b71b4&&_0x4b71b4['Messages']){var _0x18b71d=_0x4b71b4['get']({'plain':!![]});fs[_0x06b6('0xde')](_0x3eb7b9);for(var _0xa0292f=0x0;_0xa0292f<_0x18b71d[_0x06b6('0xdf')][_0x06b6('0x6a')];_0xa0292f++){var _0xf2a2dc=_0x18b71d['Messages'][_0xa0292f]['Attachment'];if(_0xf2a2dc){var _0x16cc25=path[_0x06b6('0xd6')](_0x44f531,_0xf2a2dc[_0x06b6('0xe0')]);if(fs[_0x06b6('0xe1')](_0x16cc25)){fs[_0x06b6('0xe2')](_0x16cc25)[_0x06b6('0xe3')](fs[_0x06b6('0xe4')](path[_0x06b6('0xd6')](_0x3eb7b9,_0xf2a2dc[_0x06b6('0xe0')])));}}}return BPromise[_0x06b6('0xe5')]()[_0x06b6('0x2a')](function(){return new BPromise(function(_0xbd40a1,_0x15f8cc){zipdir(_0x3eb7b9,{'saveTo':_0x4d6474},function(_0x30229b,_0xc4f7bb){if(_0x30229b)return _0x15f8cc(_0x30229b);return _0xbd40a1(_0xc4f7bb);});})[_0x06b6('0x2a')](function(){return new BPromise(function(_0x4c5072,_0x31b02f){rimraf(_0x3eb7b9,function(_0x238fc9){if(_0x238fc9)_0x31b02f(_0x238fc9);return _0x4c5072();});});})[_0x06b6('0x2a')](function(){return _0x474f21[_0x06b6('0xe6')](_0x4d6474,_0x597ce8,function(_0x34d4ee){if(_0x34d4ee){console[_0x06b6('0xe7')](_0x06b6('0xe8'),_0x34d4ee);}else{fs[_0x06b6('0xe9')](_0x4d6474);}});});});}else{return _0x474f21['sendStatus'](0xc8);}})[_0x06b6('0x37')](handleError(_0x474f21,null));}; \ No newline at end of file +var _0xf4e2=['defaults','socket.io-emitter','./faxInteraction.socket','register','sendStatus','end','status','json','offset','limit','undefined','count','set','Content-Range','reject','save','update','then','error','name','send','Users','map','TagIds','Tags','split','forEach','catch','talking','answered','total','closed','UserId','waiting','unmanaged','index','rawAttributes','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','select','field','color','from','tools_tags','user_has_fax_interactions','users','u.id\x20=\x20ui.UserId','fax_interactions','left_join','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','fax_accounts','a.id\x20=\x20i.FaxAccountId','fax_messages','me.FaxInteractionId\x20=\x20i.id','fax_interaction_has_tags','it.FaxInteractionId\x20=\x20i.id','expr','search','parseSearch','sqlOperator','conditions','find','unreadMessages','having','`\x20=\x200','`\x20>\x200','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','type','text','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','start','some','compact','FaxAccountId','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20=\x20?','read','tag','isArray','filter','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','SELECT','clone','contactName','t.id\x20IN\x20?','resolve','i.FaxAccountId\x20IS\x20NOT\x20NULL','agent','user','getFaxAccounts','isEmpty','i.FaxAccountId\x20IS\x20NULL','i.FaxAccountId\x20IN\x20?','role','sequelize','toString','keyBy','merge','FaxInteraction','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','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.*','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','groupBy','FaxInteractionId','push','all','rows','params','includeAll','include','options','create','body','destroy','describe','addMessage','ids','omit','getMessages','findOne','FaxMessage','format','YYYY-MM-DD\x20HH:mm:ss','findAll','addTags','setTags','spread','emit','faxInteractionTags:save','removeTags','download','unix','root','server','tmp','join','attachments','transcript-%d-%s.zip','Attachment','Messages','mkdirSync','pipe','basename','log','err','unlinkSync','fast-json-patch','request-promise','moment','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','../../config/logger','api','../../config/utils','../../config/license/util','redis'];(function(_0x33d98e,_0x5b154d){var _0xb296=function(_0x125496){while(--_0x125496){_0x33d98e['push'](_0x33d98e['shift']());}};_0xb296(++_0x5b154d);}(_0xf4e2,0x1a7));var _0x2f4e=function(_0x3ee55a,_0x19aeea){_0x3ee55a=_0x3ee55a-0x0;var _0x581800=_0xf4e2[_0x3ee55a];return _0x581800;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x2f4e('0x0'));var rp=require(_0x2f4e('0x1'));var moment=require(_0x2f4e('0x2'));var BPromise=require(_0x2f4e('0x3'));var Mustache=require(_0x2f4e('0x4'));var util=require(_0x2f4e('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0x2f4e('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2f4e('0x7'));var _=require('lodash');var squel=require(_0x2f4e('0x8'));var crypto=require(_0x2f4e('0x9'));var jsforce=require(_0x2f4e('0xa'));var deskjs=require(_0x2f4e('0xb'));var toCsv=require(_0x2f4e('0x6'));var querystring=require(_0x2f4e('0xc'));var Papa=require(_0x2f4e('0xd'));var Redis=require('ioredis');var authService=require(_0x2f4e('0xe'));var qs=require(_0x2f4e('0xf'));var as=require(_0x2f4e('0x10'));var hardwareService=require(_0x2f4e('0x11'));var logger=require(_0x2f4e('0x12'))(_0x2f4e('0x13'));var utils=require(_0x2f4e('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x2f4e('0x15'));var db=require('../../mysqldb')['db'];config[_0x2f4e('0x16')]=_[_0x2f4e('0x17')](config[_0x2f4e('0x16')],{'host':'localhost','port':0x18eb});var socket=require(_0x2f4e('0x18'))(new Redis(config['redis']));require(_0x2f4e('0x19'))[_0x2f4e('0x1a')](socket);function respondWithStatusCode(_0x57890e,_0x5bb13a){_0x5bb13a=_0x5bb13a||0xcc;return function(_0x52e25b){if(_0x52e25b){return _0x57890e[_0x2f4e('0x1b')](_0x5bb13a);}return _0x57890e['status'](_0x5bb13a)[_0x2f4e('0x1c')]();};}function respondWithResult(_0x54770c,_0x439715){_0x439715=_0x439715||0xc8;return function(_0x125b99){if(_0x125b99){return _0x54770c[_0x2f4e('0x1d')](_0x439715)[_0x2f4e('0x1e')](_0x125b99);}};}function respondWithFilteredResult(_0x47a4ca,_0x127d19){return function(_0xf99bb7){if(_0xf99bb7){var _0x185ed5=typeof _0x127d19[_0x2f4e('0x1f')]==='undefined'&&typeof _0x127d19[_0x2f4e('0x20')]===_0x2f4e('0x21');var _0x447d0a=_0xf99bb7[_0x2f4e('0x22')];var _0x34a53c=_0x185ed5?0x0:_0x127d19[_0x2f4e('0x1f')];var _0x51d3ad=_0x185ed5?_0xf99bb7[_0x2f4e('0x22')]:_0x127d19['offset']+_0x127d19[_0x2f4e('0x20')];var _0x12a7d5;if(_0x51d3ad>=_0x447d0a){_0x51d3ad=_0x447d0a;_0x12a7d5=0xc8;}else{_0x12a7d5=0xce;}_0x47a4ca['status'](_0x12a7d5);return _0x47a4ca[_0x2f4e('0x23')](_0x2f4e('0x24'),_0x34a53c+'-'+_0x51d3ad+'/'+_0x447d0a)[_0x2f4e('0x1e')](_0xf99bb7);}return null;};}function patchUpdates(_0x27ceeb){return function(_0x5bd77f){try{jsonpatch['apply'](_0x5bd77f,_0x27ceeb,!![]);}catch(_0x8647cb){return BPromise[_0x2f4e('0x25')](_0x8647cb);}return _0x5bd77f[_0x2f4e('0x26')]();};}function saveUpdates(_0x64adc2,_0x337d65){return function(_0x3c2435){if(_0x3c2435){return _0x3c2435[_0x2f4e('0x27')](_0x64adc2)[_0x2f4e('0x28')](function(_0x320dc2){return _0x320dc2;});}return null;};}function removeEntity(_0x22baa0,_0x72f43e){return function(_0x48e0dc){if(_0x48e0dc){return _0x48e0dc['destroy']()['then'](function(){_0x22baa0[_0x2f4e('0x1d')](0xcc)[_0x2f4e('0x1c')]();});}};}function handleEntityNotFound(_0x537594,_0x302b49){return function(_0x2e2534){if(!_0x2e2534){_0x537594['sendStatus'](0x194);}return _0x2e2534;};}function handleError(_0x229ca7,_0x33a5b9){_0x33a5b9=_0x33a5b9||0x1f4;return function(_0x4f2b3f){logger[_0x2f4e('0x29')](_0x4f2b3f['stack']);if(_0x4f2b3f[_0x2f4e('0x2a')]){delete _0x4f2b3f[_0x2f4e('0x2a')];}_0x229ca7['status'](_0x33a5b9)[_0x2f4e('0x2b')](_0x4f2b3f);};}function getInteractionUsers(_0xc968d7,_0x8eae34){return new BPromise(function(_0x3319ac,_0x907501){try{if(_0x8eae34[_0xc968d7['id']]){_0xc968d7[_0x2f4e('0x2c')]=_[_0x2f4e('0x2d')](_0x8eae34[_0xc968d7['id']],function(_0x26d80f){return{'id':_0x26d80f['id'],'fullname':_0x26d80f['fullname']};});}}catch(_0x1ec960){_0x907501(_0x1ec960);}_0x3319ac(_0xc968d7);});}function getInteractionTags(_0x58f1db,_0x2fe52e){return new BPromise(function(_0x374352,_0x23106c){try{if(_0x58f1db[_0x2f4e('0x2e')]){_0x58f1db[_0x2f4e('0x2f')]=[];_0x58f1db[_0x2f4e('0x2e')][_0x2f4e('0x30')](',')[_0x2f4e('0x31')](function(_0x427f5a){_0x58f1db[_0x2f4e('0x2f')]['push'](_0x2fe52e[_0x427f5a]);});}delete _0x58f1db[_0x2f4e('0x2e')];}catch(_0x5532c5){_0x23106c(_0x5532c5);}_0x374352(_0x58f1db);});}function updateFaxInteraction(_0x5d2787,_0x5d3542,_0x49a96c){return new BPromise(function(_0x33e096,_0x2cab82){return getInteractionUsers(_0x5d2787,_0x49a96c)[_0x2f4e('0x28')](function(_0x55dbaa){return getInteractionTags(_0x55dbaa,_0x5d3542);})[_0x2f4e('0x28')](function(_0x2a2a2c){return getStateInteraction(_0x2a2a2c);})['then'](function(_0x7956f3){_0x33e096(_0x7956f3);})[_0x2f4e('0x32')](function(_0x507227){_0x2cab82(_0x507227);});});}function getStateInteraction(_0x44ed71){return new BPromise(function(_0xbd1b44){_0x44ed71['waiting']=0x0;_0x44ed71[_0x2f4e('0x33')]=0x0;_0x44ed71[_0x2f4e('0x34')]=0x0;_0x44ed71['unmanaged']=0x0;_0x44ed71[_0x2f4e('0x35')]=0x0;if(!_0x44ed71[_0x2f4e('0x36')]&&!_0x44ed71[_0x2f4e('0x37')]){_0x44ed71[_0x2f4e('0x38')]+=0x1;}if(!_0x44ed71['closed']&&_0x44ed71[_0x2f4e('0x37')]){_0x44ed71['talking']+=0x1;if(_0x44ed71['waiting']){_0x44ed71[_0x2f4e('0x38')]-=0x1;}}if(_0x44ed71[_0x2f4e('0x36')]&&_0x44ed71['UserId']){_0x44ed71[_0x2f4e('0x34')]+=0x1;if(_0x44ed71[_0x2f4e('0x33')]){_0x44ed71['talking']-=0x1;}}if(_0x44ed71[_0x2f4e('0x36')]&&!_0x44ed71['UserId']){_0x44ed71[_0x2f4e('0x39')]+=0x1;if(_0x44ed71['waiting']){_0x44ed71[_0x2f4e('0x38')]-=0x1;}}_0x44ed71[_0x2f4e('0x35')]+=0x1;_0xbd1b44(_0x44ed71);});}exports[_0x2f4e('0x3a')]=function(_0x28228d,_0x1ba3ba){var _0x22bf20={},_0x15f692={},_0x4ef109={'count':0x0,'rows':[]};var _0x41fb6d=_[_0x2f4e('0x2d')](db['FaxInteraction'][_0x2f4e('0x3b')],function(_0x1a0c54){return{'name':_0x1a0c54['fieldName'],'type':_0x1a0c54['type'][_0x2f4e('0x3c')]};});_0x15f692[_0x2f4e('0x3d')]=_['map'](_0x41fb6d,'name');_0x15f692[_0x2f4e('0x3e')]=_[_0x2f4e('0x3f')](_0x28228d[_0x2f4e('0x3e')]);_0x15f692[_0x2f4e('0x40')]=_[_0x2f4e('0x41')](_0x15f692[_0x2f4e('0x3d')],_0x15f692['query']);_0x22bf20[_0x2f4e('0x42')]=_['intersection'](_0x15f692[_0x2f4e('0x3d')],qs[_0x2f4e('0x43')](_0x28228d[_0x2f4e('0x3e')][_0x2f4e('0x43')]));_0x22bf20[_0x2f4e('0x42')]=_0x22bf20[_0x2f4e('0x42')][_0x2f4e('0x44')]?_0x22bf20[_0x2f4e('0x42')]:_0x15f692[_0x2f4e('0x3d')];if(!_0x28228d[_0x2f4e('0x3e')][_0x2f4e('0x45')](_0x2f4e('0x46'))){_0x22bf20[_0x2f4e('0x20')]=qs[_0x2f4e('0x20')](_0x28228d[_0x2f4e('0x3e')]['limit']);_0x22bf20[_0x2f4e('0x1f')]=qs[_0x2f4e('0x1f')](_0x28228d['query'][_0x2f4e('0x1f')]);}_0x22bf20[_0x2f4e('0x47')]=qs[_0x2f4e('0x48')](_0x28228d[_0x2f4e('0x3e')][_0x2f4e('0x48')]);_0x22bf20[_0x2f4e('0x49')]=qs[_0x2f4e('0x40')](_[_0x2f4e('0x4a')](_0x28228d[_0x2f4e('0x3e')],_0x15f692['filters']),_0x41fb6d);var _0x45697d=[];var _0x2084f5=squel[_0x2f4e('0x4b')]()[_0x2f4e('0x4c')]('id')[_0x2f4e('0x4c')]('name')[_0x2f4e('0x4c')](_0x2f4e('0x4d'))[_0x2f4e('0x4e')](_0x2f4e('0x4f'));var _0x16b017=squel['select']()[_0x2f4e('0x4c')]('u.id')[_0x2f4e('0x4c')]('u.fullname')[_0x2f4e('0x4c')]('ui.FaxInteractionId')[_0x2f4e('0x4e')](_0x2f4e('0x50'),'ui')['left_join'](_0x2f4e('0x51'),'u',_0x2f4e('0x52'));var _0x859cf0=squel[_0x2f4e('0x4b')]()[_0x2f4e('0x4e')](_0x2f4e('0x53'),'i')[_0x2f4e('0x54')](_0x2f4e('0x55'),'c',_0x2f4e('0x56'))[_0x2f4e('0x54')](_0x2f4e('0x51'),'o',_0x2f4e('0x57'))[_0x2f4e('0x54')](_0x2f4e('0x58'),'a',_0x2f4e('0x59'))[_0x2f4e('0x54')](_0x2f4e('0x5a'),'me',_0x2f4e('0x5b'))[_0x2f4e('0x54')](_0x2f4e('0x5c'),'it',_0x2f4e('0x5d'))[_0x2f4e('0x54')](_0x2f4e('0x4f'),'t','t.id\x20=\x20it.TagId');var _0x2e2bc6=squel[_0x2f4e('0x5e')]();var _0x5a32e9=[];var _0x41fd11=squel['expr']();var _0x43bb07;if(_0x28228d['query'][_0x2f4e('0x5f')]){_0x43bb07=as[_0x2f4e('0x60')](_0x28228d[_0x2f4e('0x3e')][_0x2f4e('0x5f')]);var _0x1f3d64=_0x43bb07[_0x2f4e('0x61')];for(var _0x5488fc=0x0;_0x5488fc<_0x43bb07[_0x2f4e('0x62')][_0x2f4e('0x44')];_0x5488fc++){var _0x324e1a=_0x43bb07[_0x2f4e('0x62')][_0x5488fc];var _0x13004a='i';var _0x4465e6=_[_0x2f4e('0x63')](_0x41fb6d,[_0x2f4e('0x2a'),_0x324e1a[_0x2f4e('0x4c')]]);if(!_0x4465e6){switch(_0x324e1a[_0x2f4e('0x4c')]){case _0x2f4e('0x64'):if(_0x324e1a['value']==0x1){_0x859cf0[_0x2f4e('0x65')]('`'+_0x324e1a['field']+_0x2f4e('0x66'));}else{_0x859cf0['having']('`'+_0x324e1a[_0x2f4e('0x4c')]+_0x2f4e('0x67'));}break;case _0x2f4e('0x68'):if(_0x324e1a[_0x2f4e('0x69')]===_0x2f4e('0x6a')){if(_0x324e1a[_0x2f4e('0x6b')][_0x2f4e('0x30')]('\x20')[_0x2f4e('0x44')]>0x1){_0x2e2bc6[_0x1f3d64](_0x2f4e('0x6c'),qs[_0x2f4e('0x6d')](_0x324e1a[_0x2f4e('0x6b')]),null);}else{var _0xa930e9='%'+_0x324e1a[_0x2f4e('0x6b')]+'%';_0x2e2bc6[_0x1f3d64](_0x2f4e('0x6e'),_0xa930e9,_0xa930e9,_0xa930e9);}}else{_0x4465e6=_[_0x2f4e('0x63')](_0x41fb6d,['name',_0x2f4e('0x6f')]);_0x324e1a[_0x2f4e('0x4c')]='ContactId';_0xd17be6=as[_0x2f4e('0x70')](_0x13004a,_0x4465e6[_0x2f4e('0x71')],_0x324e1a);_0x2e2bc6[_0x1f3d64](_0xd17be6[_0x2f4e('0x72')],_0xd17be6['value']['start'],_0xd17be6[_0x2f4e('0x6b')][_0x2f4e('0x1c')]);}break;case _0x2f4e('0x73'):var _0x4deb48=_0x324e1a[_0x2f4e('0x6b')][_0x2f4e('0x30')](',')[_0x2f4e('0x2d')](function(_0x405660){return Number(_0x405660);});_0x4deb48[_0x2f4e('0x31')](function(_0x338fb5){_0x41fd11['or'](_0x2f4e('0x74'),'%,'+_0x338fb5+',%');});_0x5a32e9=_['union'](_0x5a32e9,_0x4deb48);break;case _0x2f4e('0x75'):if(_0x324e1a[_0x2f4e('0x69')]===_0x2f4e('0x6a')){_0x2e2bc6[_0x1f3d64](_0x2f4e('0x76'),'%'+_0x324e1a[_0x2f4e('0x6b')]+'%',null);}else{_0x4465e6=_[_0x2f4e('0x63')](_0x41fb6d,[_0x2f4e('0x2a'),_0x2f4e('0x37')]);_0x324e1a[_0x2f4e('0x4c')]=_0x2f4e('0x37');_0xd17be6=as[_0x2f4e('0x70')](_0x13004a,_0x4465e6[_0x2f4e('0x71')],_0x324e1a);_0x2e2bc6[_0x1f3d64](_0xd17be6[_0x2f4e('0x72')],_0xd17be6[_0x2f4e('0x6b')][_0x2f4e('0x77')],_0xd17be6[_0x2f4e('0x6b')][_0x2f4e('0x1c')]);}break;case'body':_0xd17be6=as['buildExpression']('me',null,_0x324e1a);_0x2e2bc6[_0x1f3d64](_0xd17be6[_0x2f4e('0x72')],_0xd17be6[_0x2f4e('0x6b')][_0x2f4e('0x77')],_0xd17be6[_0x2f4e('0x6b')]['end']);break;}}else{var _0xd17be6=as['buildExpression'](_0x13004a,_0x4465e6[_0x2f4e('0x71')],_0x324e1a);_0x2e2bc6[_0x1f3d64](_0xd17be6[_0x2f4e('0x72')],_0xd17be6[_0x2f4e('0x6b')][_0x2f4e('0x77')],_0xd17be6[_0x2f4e('0x6b')][_0x2f4e('0x1c')]);}}}else{var _0x549e8b=_(_0x28228d[_0x2f4e('0x3e')])[_0x2f4e('0x3f')]()['map'](function(_0x5a13a4){return _[_0x2f4e('0x78')](_0x41fb6d,[_0x2f4e('0x2a'),_0x5a13a4])?_0x5a13a4:undefined;})[_0x2f4e('0x79')]()['value']();if(!_['isEmpty'](_0x549e8b)){_0x549e8b[_0x2f4e('0x31')](function(_0x25d482){if(_0x25d482===_0x2f4e('0x7a')){_0x859cf0[_0x2f4e('0x49')]('i.FaxAccountId\x20IN\x20?',[]['concat'](_0x28228d[_0x2f4e('0x3e')][_0x25d482]));}else if(_0x25d482===_0x2f4e('0x7b')){var _0x53fabd=JSON[_0x2f4e('0x7c')](_0x28228d[_0x2f4e('0x3e')][_0x25d482])[_0x2f4e('0x7d')];var _0x2e2d50=JSON[_0x2f4e('0x7c')](_0x28228d[_0x2f4e('0x3e')][_0x25d482])[_0x2f4e('0x7e')];_0x859cf0[_0x2f4e('0x49')](_0x2f4e('0x7f'),_0x53fabd,_0x2e2d50);}else{if(_0x28228d['query'][_0x25d482]===_0x2f4e('0x80')){_0x859cf0[_0x2f4e('0x49')]('i.'+_0x25d482+'\x20IS\x20NULL');}else{_0x859cf0[_0x2f4e('0x49')]('i.'+_0x25d482+_0x2f4e('0x81'),_0x28228d['query'][_0x25d482]);}}});}if(_0x28228d[_0x2f4e('0x3e')][_0x2f4e('0x82')]){if(_0x28228d['query'][_0x2f4e('0x82')]==0x1){_0x859cf0['having']('`unreadMessages`\x20=\x200');}else{_0x859cf0[_0x2f4e('0x65')]('`unreadMessages`\x20>\x200');}}if(_0x28228d[_0x2f4e('0x3e')][_0x2f4e('0x83')]){_0x5a32e9=_[_0x2f4e('0x84')](_0x28228d['query']['tag'])?_0x28228d[_0x2f4e('0x3e')][_0x2f4e('0x83')]:new Array(_0x28228d[_0x2f4e('0x3e')][_0x2f4e('0x83')]);_0x5a32e9[_0x2f4e('0x31')](function(_0x28b3c0){_0x41fd11['or'](_0x2f4e('0x74'),'%,'+_0x28b3c0+',%');});}if(_0x28228d[_0x2f4e('0x3e')][_0x2f4e('0x85')]){var _0x29035c=_0x28228d['query'][_0x2f4e('0x85')][_0x2f4e('0x86')]('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs[_0x2f4e('0x87')](_0x29035c)){_0x2e2bc6['or'](_0x2f4e('0x88'),_0x29035c+'%')['or'](_0x2f4e('0x89'),_0x29035c+'%');}_0x2e2bc6['or'](_0x2f4e('0x8a'),_0x29035c+'%');}}_0x859cf0[_0x2f4e('0x49')](_0x2e2bc6);_0x859cf0[_0x2f4e('0x8b')](_0x2f4e('0x8c'));var _0x33daaf={'type':db[_0x2f4e('0x8d')][_0x2f4e('0x8e')][_0x2f4e('0x8f')],'raw':!![]};var _0x4c125a=_0x859cf0[_0x2f4e('0x90')]();_0x4c125a[_0x2f4e('0x4c')](_0x2f4e('0x8c'));_0x4c125a[_0x2f4e('0x4c')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x2f4e('0x64'));if(_0x22bf20[_0x2f4e('0x47')]){_0x22bf20[_0x2f4e('0x47')]['forEach'](function(_0x75dd68){var _0x25ff87=_0x75dd68[0x0]===_0x2f4e('0x91')?_0x75dd68[0x0]:'i.'+_0x75dd68[0x0];_0x859cf0[_0x2f4e('0x47')](_0x25ff87,_0x75dd68[0x1]==='DESC'?![]:!![]);});}if(!_['isEmpty'](_0x5a32e9)){_0x859cf0[_0x2f4e('0x65')](_0x41fd11);_0x4c125a[_0x2f4e('0x49')](_0x2f4e('0x92'),_0x5a32e9);}BPromise[_0x2f4e('0x93')]()[_0x2f4e('0x28')](function(){if(!_0x43bb07){if(_0x28228d[_0x2f4e('0x3e')]['FaxAccountId'])return;_0x4c125a['where'](_0x2f4e('0x94'));_0x859cf0['where'](_0x2f4e('0x94'));return;}if(_0x28228d['user']['role']!==_0x2f4e('0x95'))return;return _0x28228d[_0x2f4e('0x96')][_0x2f4e('0x97')]({'attributes':['id'],'raw':!![]})['then'](function(_0x3a342d){if(_[_0x2f4e('0x98')](_0x3a342d)){_0x4c125a[_0x2f4e('0x49')](_0x2f4e('0x99'));_0x859cf0['where']('i.FaxAccountId\x20IS\x20NULL');}else{_0x4c125a['where']('i.FaxAccountId\x20IN\x20?',_['map'](_0x3a342d,'id'));_0x859cf0[_0x2f4e('0x49')](_0x2f4e('0x9a'),_[_0x2f4e('0x2d')](_0x3a342d,'id'));}});})[_0x2f4e('0x28')](function(){if(_0x28228d[_0x2f4e('0x96')][_0x2f4e('0x9b')]===_0x2f4e('0x95')&&!_0x43bb07&&!_0x28228d[_0x2f4e('0x3e')][_0x2f4e('0x7a')])return[];return db[_0x2f4e('0x9c')][_0x2f4e('0x3e')](_0x4c125a['toString'](),_0x33daaf);})[_0x2f4e('0x28')](function(_0x5e453e){_0x4ef109[_0x2f4e('0x22')]=_0x5e453e['length'];if(_0x4ef109[_0x2f4e('0x22')]===0x0)return[];return db[_0x2f4e('0x9c')][_0x2f4e('0x3e')](_0x2084f5[_0x2f4e('0x9d')](),_0x33daaf)['then'](function(_0xf44d62){_0x45697d=_[_0x2f4e('0x9e')](_0xf44d62,'id');_0x33daaf=_[_0x2f4e('0x9f')](_0x33daaf,{'model':db[_0x2f4e('0xa0')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x28228d[_0x2f4e('0x3e')][_0x2f4e('0x43')]){_0x22bf20[_0x2f4e('0x42')][_0x2f4e('0x31')](function(_0x9f102a){_0x859cf0[_0x2f4e('0x4c')]('i.'+_0x9f102a);});}else{_0x859cf0[_0x2f4e('0x4c')](_0x2f4e('0xa1'),_0x2f4e('0x64'));_0x859cf0[_0x2f4e('0x4c')]('a.key',_0x2f4e('0xa2'));_0x859cf0['field'](_0x2f4e('0xa3'),_0x2f4e('0xa4'));_0x859cf0['field'](_0x2f4e('0xa5'),_0x2f4e('0x91'));_0x859cf0[_0x2f4e('0x4c')](_0x2f4e('0xa6'));_0x859cf0[_0x2f4e('0x4c')]('c.firstName',_0x2f4e('0xa7'));_0x859cf0['field'](_0x2f4e('0xa8'),_0x2f4e('0xa9'));_0x859cf0[_0x2f4e('0x4c')](_0x2f4e('0xaa'),_0x2f4e('0xab'));_0x859cf0[_0x2f4e('0x4c')]('c.phone','Contact.phone');_0x859cf0[_0x2f4e('0x4c')](_0x2f4e('0xac'),_0x2f4e('0xad'));_0x859cf0[_0x2f4e('0x4c')](_0x2f4e('0xae'),_0x2f4e('0xaf'));_0x859cf0['field'](_0x2f4e('0xb0'),_0x2f4e('0xb1'));_0x859cf0[_0x2f4e('0x4c')](_0x2f4e('0xb2'),'Owner.internal');_0x859cf0[_0x2f4e('0x4c')]('GROUP_CONCAT(DISTINCT\x20t.id)','TagIds');}if(_0x22bf20[_0x2f4e('0x20')])_0x859cf0[_0x2f4e('0x20')](_0x22bf20[_0x2f4e('0x20')]);if(_0x22bf20[_0x2f4e('0x1f')])_0x859cf0[_0x2f4e('0x1f')](_0x22bf20[_0x2f4e('0x1f')]);return db[_0x2f4e('0x9c')]['query'](_0x859cf0[_0x2f4e('0x9d')](),_0x33daaf);})['then'](function(_0x532798){if(_0x532798[_0x2f4e('0x44')]>0x0)_0x16b017[_0x2f4e('0x49')]('ui.FaxInteractionId\x20IN\x20?',_[_0x2f4e('0x2d')](_0x532798,'id'));return db[_0x2f4e('0x9c')][_0x2f4e('0x3e')](_0x16b017[_0x2f4e('0x9d')](),_0x33daaf)[_0x2f4e('0x28')](function(_0x357723){var _0x171d20=_[_0x2f4e('0xb3')](_0x357723,_0x2f4e('0xb4'));var _0xc965d2=[];_0x532798[_0x2f4e('0x31')](function(_0x325c82){_0xc965d2[_0x2f4e('0xb5')](updateFaxInteraction(_0x325c82,_0x45697d,_0x171d20));});return BPromise[_0x2f4e('0xb6')](_0xc965d2);});});})[_0x2f4e('0x28')](function(_0x2f019b){_0x4ef109[_0x2f4e('0xb7')]=_0x2f019b;return _0x4ef109;})['then'](respondWithFilteredResult(_0x1ba3ba,_0x22bf20))[_0x2f4e('0x32')](handleError(_0x1ba3ba,null));};exports['show']=function(_0x15b8fa,_0x28e41b){var _0x791b0f={'raw':![],'where':{'id':_0x15b8fa[_0x2f4e('0xb8')]['id']}},_0x5ccc8d={};_0x5ccc8d[_0x2f4e('0x3d')]=_[_0x2f4e('0x3f')](db['FaxInteraction'][_0x2f4e('0x3b')]);_0x5ccc8d[_0x2f4e('0x3e')]=_['keys'](_0x15b8fa[_0x2f4e('0x3e')]);_0x5ccc8d[_0x2f4e('0x40')]=_[_0x2f4e('0x41')](_0x5ccc8d['model'],_0x5ccc8d[_0x2f4e('0x3e')]);_0x791b0f[_0x2f4e('0x42')]=_[_0x2f4e('0x41')](_0x5ccc8d[_0x2f4e('0x3d')],qs['fields'](_0x15b8fa[_0x2f4e('0x3e')][_0x2f4e('0x43')]));_0x791b0f[_0x2f4e('0x42')]=_0x791b0f[_0x2f4e('0x42')][_0x2f4e('0x44')]?_0x791b0f[_0x2f4e('0x42')]:_0x5ccc8d[_0x2f4e('0x3d')];if(_0x15b8fa['query'][_0x2f4e('0xb9')]){_0x791b0f[_0x2f4e('0xba')]=[{'all':!![]}];}_0x791b0f=_[_0x2f4e('0x9f')]({},_0x791b0f,_0x15b8fa[_0x2f4e('0xbb')]);return db[_0x2f4e('0xa0')][_0x2f4e('0x63')](_0x791b0f)[_0x2f4e('0x28')](handleEntityNotFound(_0x28e41b,null))[_0x2f4e('0x28')](respondWithResult(_0x28e41b,null))[_0x2f4e('0x32')](handleError(_0x28e41b,null));};exports[_0x2f4e('0xbc')]=function(_0x24923f,_0x5c3759){return db['FaxInteraction'][_0x2f4e('0xbc')](_0x24923f[_0x2f4e('0xbd')],{})[_0x2f4e('0x28')](respondWithResult(_0x5c3759,0xc9))[_0x2f4e('0x32')](handleError(_0x5c3759,null));};exports[_0x2f4e('0x27')]=function(_0x5f4607,_0x4b08ed){if(_0x5f4607[_0x2f4e('0xbd')]['id']){delete _0x5f4607[_0x2f4e('0xbd')]['id'];}return db[_0x2f4e('0xa0')][_0x2f4e('0x63')]({'where':{'id':_0x5f4607[_0x2f4e('0xb8')]['id']}})['then'](handleEntityNotFound(_0x4b08ed,null))[_0x2f4e('0x28')](saveUpdates(_0x5f4607[_0x2f4e('0xbd')],null))[_0x2f4e('0x28')](respondWithResult(_0x4b08ed,null))[_0x2f4e('0x32')](handleError(_0x4b08ed,null));};exports[_0x2f4e('0xbe')]=function(_0x76b304,_0x5b47cf){return db[_0x2f4e('0xa0')]['find']({'where':{'id':_0x76b304[_0x2f4e('0xb8')]['id']}})[_0x2f4e('0x28')](handleEntityNotFound(_0x5b47cf,null))[_0x2f4e('0x28')](removeEntity(_0x5b47cf,null))[_0x2f4e('0x32')](handleError(_0x5b47cf,null));};exports[_0x2f4e('0xbf')]=function(_0x3f9f09,_0x3236ea){return db['FaxInteraction'][_0x2f4e('0xbf')]()[_0x2f4e('0x28')](respondWithResult(_0x3236ea,null))['catch'](handleError(_0x3236ea,null));};exports[_0x2f4e('0xc0')]=function(_0x2187a8,_0x311509,_0x4d15ee){return db['FaxMessage']['find']({'where':{'id':_0x2187a8['params']['id']}})[_0x2f4e('0x28')](handleEntityNotFound(_0x311509,null))['then'](function(_0x9521a0){if(_0x9521a0){return _0x9521a0['addMessage'](_0x2187a8['body'][_0x2f4e('0xc1')],_[_0x2f4e('0xc2')](_0x2187a8[_0x2f4e('0xbd')],['ids','id'])||{});}})[_0x2f4e('0x28')](respondWithResult(_0x311509,null))[_0x2f4e('0x32')](handleError(_0x311509,null));};exports[_0x2f4e('0xc3')]=function(_0x5e394a,_0x5505ae,_0xb9bd69){var _0x257824={'raw':![],'where':{}};var _0x224d51={};var _0x2c57e2={'count':0x0,'rows':[]};return db[_0x2f4e('0xa0')][_0x2f4e('0xc4')]({'where':{'id':_0x5e394a[_0x2f4e('0xb8')]['id']}})['then'](handleEntityNotFound(_0x5505ae,null))[_0x2f4e('0x28')](function(_0x270c73){if(_0x270c73){_0x224d51[_0x2f4e('0x3d')]=_['keys'](db[_0x2f4e('0xc5')]['rawAttributes']);_0x224d51[_0x2f4e('0x3e')]=_['keys'](_0x5e394a[_0x2f4e('0x3e')]);_0x224d51['filters']=_[_0x2f4e('0x41')](_0x224d51['model'],_0x224d51[_0x2f4e('0x3e')]);_0x257824[_0x2f4e('0x42')]=_['intersection'](_0x224d51['model'],qs[_0x2f4e('0x43')](_0x5e394a[_0x2f4e('0x3e')]['fields']));_0x257824[_0x2f4e('0x42')]=_0x257824[_0x2f4e('0x42')]['length']?_0x257824[_0x2f4e('0x42')]:_0x224d51[_0x2f4e('0x3d')];if(!_0x5e394a[_0x2f4e('0x3e')]['hasOwnProperty']('nolimit')){_0x257824[_0x2f4e('0x20')]=qs[_0x2f4e('0x20')](_0x5e394a[_0x2f4e('0x3e')][_0x2f4e('0x20')]);_0x257824[_0x2f4e('0x1f')]=qs[_0x2f4e('0x1f')](_0x5e394a['query'][_0x2f4e('0x1f')]);}_0x257824[_0x2f4e('0x47')]=qs[_0x2f4e('0x48')](_0x5e394a[_0x2f4e('0x3e')][_0x2f4e('0x48')]);_0x257824[_0x2f4e('0x49')]=qs['filters'](_[_0x2f4e('0x4a')](_0x5e394a[_0x2f4e('0x3e')],_0x224d51[_0x2f4e('0x40')]));_0x257824[_0x2f4e('0x49')][_0x2f4e('0xb4')]=_0x270c73['id'];if(_0x5e394a[_0x2f4e('0x3e')]['filter']){_0x257824[_0x2f4e('0x49')]=_[_0x2f4e('0x9f')](_0x257824[_0x2f4e('0x49')],{'$or':_[_0x2f4e('0x2d')](_0x257824['attributes'],function(_0x453770){var _0x386f49={};_0x386f49[_0x453770]={'$like':'%'+_0x5e394a['query'][_0x2f4e('0x85')]+'%'};return _0x386f49;})});}if(_0x5e394a['query'][_0x2f4e('0x7d')]){var _0x12ee58=_0x5e394a[_0x2f4e('0x3e')][_0x2f4e('0x7d')][_0x2f4e('0x30')](',');var _0x388b1a={};_0x388b1a[_0x12ee58[0x0]]={'$gte':moment(_0x12ee58[0x1])[_0x2f4e('0xc6')](_0x2f4e('0xc7'))};_0x257824[_0x2f4e('0x49')]=_['merge'](_0x257824[_0x2f4e('0x49')],_0x388b1a);}_0x257824=_[_0x2f4e('0x9f')]({},_0x257824,_0x5e394a['options']);return db[_0x2f4e('0xc5')]['count']({'where':_0x257824[_0x2f4e('0x49')]})['then'](function(_0x518162){_0x2c57e2[_0x2f4e('0x22')]=_0x518162;if(_0x5e394a[_0x2f4e('0x3e')][_0x2f4e('0xb9')]){_0x257824[_0x2f4e('0xba')]=[{'all':!![]}];}return db['FaxMessage'][_0x2f4e('0xc8')](_0x257824);})[_0x2f4e('0x28')](function(_0x2f0abd){_0x2c57e2[_0x2f4e('0xb7')]=_0x2f0abd;return _0x2c57e2;});}})[_0x2f4e('0x28')](respondWithFilteredResult(_0x5505ae,_0x257824))[_0x2f4e('0x32')](handleError(_0x5505ae,null));};exports[_0x2f4e('0xc9')]=function(_0xd353c3,_0x4c8fed,_0x55d9fb){return db[_0x2f4e('0xa0')][_0x2f4e('0x63')]({'where':{'id':_0xd353c3['params']['id']}})[_0x2f4e('0x28')](handleEntityNotFound(_0x4c8fed,null))[_0x2f4e('0x28')](function(_0x491384){if(_0x491384){return _0x491384[_0x2f4e('0xca')](_0xd353c3['body'][_0x2f4e('0xc1')],_[_0x2f4e('0xc2')](_0xd353c3[_0x2f4e('0xbd')],[_0x2f4e('0xc1'),'id'])||{})[_0x2f4e('0xcb')](function(){return db[_0x2f4e('0x73')][_0x2f4e('0xc8')]({'attributes':['id',_0x2f4e('0x2a'),_0x2f4e('0x4d')],'where':{'id':_0xd353c3[_0x2f4e('0xbd')][_0x2f4e('0xc1')]}});})[_0x2f4e('0x28')](function(_0x2e9156){socket[_0x2f4e('0xcc')](_0x2f4e('0xcd'),{'id':Number(_0xd353c3[_0x2f4e('0xb8')]['id']),'tags':_0x2e9156||[]});return{'id':Number(_0xd353c3['params']['id']),'tags':_0x2e9156||[]};});}})[_0x2f4e('0x28')](respondWithResult(_0x4c8fed,null))['catch'](handleError(_0x4c8fed,null));};exports[_0x2f4e('0xce')]=function(_0x5a63e3,_0x2956cd,_0x183f27){return db['FaxInteraction'][_0x2f4e('0x63')]({'where':{'id':_0x5a63e3[_0x2f4e('0xb8')]['id']}})[_0x2f4e('0x28')](handleEntityNotFound(_0x2956cd,null))[_0x2f4e('0x28')](function(_0x304269){if(_0x304269){return _0x304269[_0x2f4e('0xce')](_0x5a63e3[_0x2f4e('0x3e')][_0x2f4e('0xc1')]);}})['then'](respondWithStatusCode(_0x2956cd,null))[_0x2f4e('0x32')](handleError(_0x2956cd,null));};exports[_0x2f4e('0xcf')]=function(_0x2e87b8,_0x209d19){var _0x122356=moment()[_0x2f4e('0xd0')]()[_0x2f4e('0x9d')]();var _0x32f56c=path['join'](config[_0x2f4e('0xd1')],_0x2f4e('0xd2'),'files',_0x2f4e('0xd3'));var _0x505389=path[_0x2f4e('0xd4')](config['root'],_0x2f4e('0xd2'),'files',_0x2f4e('0xd5'));var _0x58c730=path['join'](_0x32f56c,_0x122356);var _0x53779a=util[_0x2f4e('0xc6')](_0x2f4e('0xd6'),_0x2e87b8[_0x2f4e('0xb8')]['id'],_0x122356);var _0x42fe0c=path[_0x2f4e('0xd4')](_0x32f56c,_0x53779a);var _0x3066e9=[];_0x3066e9[_0x2f4e('0xb5')]({'model':db[_0x2f4e('0xd7')],'as':_0x2f4e('0xd7'),'raw':!![]});var _0x74b617=[{'model':db[_0x2f4e('0xc5')],'as':_0x2f4e('0xd8'),'attributes':['id',_0x2f4e('0xbd'),_0x2f4e('0x7b')],'include':_0x3066e9}];return db[_0x2f4e('0xa0')][_0x2f4e('0x63')]({'where':{'id':_0x2e87b8[_0x2f4e('0xb8')]['id']},'include':_0x74b617})['then'](handleEntityNotFound(_0x209d19,null))[_0x2f4e('0x28')](function(_0x8de00){if(_0x8de00&&_0x8de00[_0x2f4e('0xd8')]){var _0x41d33b=_0x8de00['get']({'plain':!![]});fs[_0x2f4e('0xd9')](_0x58c730);for(var _0x560f1e=0x0;_0x560f1e<_0x41d33b[_0x2f4e('0xd8')][_0x2f4e('0x44')];_0x560f1e++){var _0xca7e2c=_0x41d33b[_0x2f4e('0xd8')][_0x560f1e][_0x2f4e('0xd7')];if(_0xca7e2c){var _0x6ab51f=path[_0x2f4e('0xd4')](_0x505389,_0xca7e2c['basename']);if(fs['existsSync'](_0x6ab51f)){fs['createReadStream'](_0x6ab51f)[_0x2f4e('0xda')](fs['createWriteStream'](path['join'](_0x58c730,_0xca7e2c[_0x2f4e('0xdb')])));}}}return BPromise[_0x2f4e('0x93')]()[_0x2f4e('0x28')](function(){return new BPromise(function(_0x3d71f6,_0x2fbf88){zipdir(_0x58c730,{'saveTo':_0x42fe0c},function(_0x5b9929,_0x232bd9){if(_0x5b9929)return _0x2fbf88(_0x5b9929);return _0x3d71f6(_0x232bd9);});})[_0x2f4e('0x28')](function(){return new BPromise(function(_0x115c14,_0x407b93){rimraf(_0x58c730,function(_0x18bea4){if(_0x18bea4)_0x407b93(_0x18bea4);return _0x115c14();});});})[_0x2f4e('0x28')](function(){return _0x209d19[_0x2f4e('0xcf')](_0x42fe0c,_0x53779a,function(_0x538cc2){if(_0x538cc2){console[_0x2f4e('0xdc')](_0x2f4e('0xdd'),_0x538cc2);}else{fs[_0x2f4e('0xde')](_0x42fe0c);}});});});}else{return _0x209d19[_0x2f4e('0x1b')](0xc8);}})[_0x2f4e('0x32')](handleError(_0x209d19,null));}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.events.js b/server/api/faxInteraction/faxInteraction.events.js index 111618a..c887349 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 _0xb146=['unreadMessages','length','emit','catch','hasOwnProperty','exports','events','../../mysqldb','FaxInteraction','FaxMessage','save','getUsers','then','setDataValue','Users','map'];(function(_0x4d8d55,_0x6cb9ab){var _0x46885e=function(_0x26f400){while(--_0x26f400){_0x4d8d55['push'](_0x4d8d55['shift']());}};_0x46885e(++_0x6cb9ab);}(_0xb146,0x146));var _0x6b14=function(_0x1389ae,_0x1caf91){_0x1389ae=_0x1389ae-0x0;var _0x1514d4=_0xb146[_0x1389ae];return _0x1514d4;};'use strict';var EventEmitter=require(_0x6b14('0x0'));var FaxInteraction=require(_0x6b14('0x1'))['db'][_0x6b14('0x2')];var FaxMessage=require(_0x6b14('0x1'))['db'][_0x6b14('0x3')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x6b14('0x4'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x110a85){return function(_0x4fcef8,_0x172ac9,_0x10f46e){_0x4fcef8[_0x6b14('0x5')]({'attributes':['id'],'raw':!![]})[_0x6b14('0x6')](function(_0x448591){_0x4fcef8[_0x6b14('0x7')](_0x6b14('0x8'),_0x448591[_0x6b14('0x9')](function(_0x3a08c0){return{'id':_0x3a08c0['id']};}));return FaxMessage['findAll']({'where':{'FaxInteractionId':_0x4fcef8['id'],'direction':'in','read':![]},'raw':!![]});})[_0x6b14('0x6')](function(_0x4c4de4){_0x4fcef8[_0x6b14('0x7')](_0x6b14('0xa'),_0x4c4de4[_0x6b14('0xb')]);FaxInteractionEvents[_0x6b14('0xc')](_0x110a85+':'+_0x4fcef8['id'],_0x4fcef8);FaxInteractionEvents[_0x6b14('0xc')](_0x110a85,_0x4fcef8);_0x10f46e(null);})[_0x6b14('0xd')](_0x10f46e(null));};}for(var e in events){if(events[_0x6b14('0xe')](e)){var event=events[e];FaxInteraction['hook'](e,emitEvent(event));}}module[_0x6b14('0xf')]=FaxInteractionEvents; \ No newline at end of file +var _0xddb4=['FaxInteraction','FaxMessage','save','update','remove','map','findAll','setDataValue','unreadMessages','emit','hook','exports'];(function(_0x200561,_0x39a526){var _0x587ab4=function(_0x5d30da){while(--_0x5d30da){_0x200561['push'](_0x200561['shift']());}};_0x587ab4(++_0x39a526);}(_0xddb4,0x108));var _0x4ddb=function(_0x4695e2,_0x3d5f15){_0x4695e2=_0x4695e2-0x0;var _0x160563=_0xddb4[_0x4695e2];return _0x160563;};'use strict';var EventEmitter=require('events');var FaxInteraction=require('../../mysqldb')['db'][_0x4ddb('0x0')];var FaxMessage=require('../../mysqldb')['db'][_0x4ddb('0x1')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x4ddb('0x2'),'afterUpdate':_0x4ddb('0x3'),'afterDestroy':_0x4ddb('0x4')};function emitEvent(_0x2d18bf){return function(_0x73b602,_0x450246,_0x4cf92a){_0x73b602['getUsers']({'attributes':['id'],'raw':!![]})['then'](function(_0x5ec968){_0x73b602['setDataValue']('Users',_0x5ec968[_0x4ddb('0x5')](function(_0x45355e){return{'id':_0x45355e['id']};}));return FaxMessage[_0x4ddb('0x6')]({'where':{'FaxInteractionId':_0x73b602['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x34b0a4){_0x73b602[_0x4ddb('0x7')](_0x4ddb('0x8'),_0x34b0a4['length']);FaxInteractionEvents[_0x4ddb('0x9')](_0x2d18bf+':'+_0x73b602['id'],_0x73b602);FaxInteractionEvents[_0x4ddb('0x9')](_0x2d18bf,_0x73b602);_0x4cf92a(null);})['catch'](_0x4cf92a(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxInteraction[_0x4ddb('0xa')](e,emitEvent(event));}}module[_0x4ddb('0xb')]=FaxInteractionEvents; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.model.js b/server/api/faxInteraction/faxInteraction.model.js index 74c605e..2ad3734 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 _0x3ab0=['bluebird','request-promise','path','rimraf','../../config/environment','exports','define','FaxInteraction','fax_interactions','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','moment'];(function(_0x416565,_0x438371){var _0x53dc21=function(_0x56d30d){while(--_0x56d30d){_0x416565['push'](_0x416565['shift']());}};_0x53dc21(++_0x438371);}(_0x3ab0,0xb6));var _0x03ab=function(_0x354631,_0x314500){_0x354631=_0x354631-0x0;var _0x4acc2f=_0x3ab0[_0x354631];return _0x4acc2f;};'use strict';var _=require(_0x03ab('0x0'));var util=require(_0x03ab('0x1'));var logger=require(_0x03ab('0x2'))(_0x03ab('0x3'));var moment=require(_0x03ab('0x4'));var BPromise=require(_0x03ab('0x5'));var rp=require(_0x03ab('0x6'));var fs=require('fs');var path=require(_0x03ab('0x7'));var rimraf=require(_0x03ab('0x8'));var config=require(_0x03ab('0x9'));var attributes=require('./faxInteraction.attributes');module[_0x03ab('0xa')]=function(_0x24e6fb,_0x367129){return _0x24e6fb[_0x03ab('0xb')](_0x03ab('0xc'),attributes,{'tableName':_0x03ab('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x12492b,_0x83f969,_0x1866ee){if(_0x12492b['changed']('closed')){_0x12492b[_0x03ab('0xe')]=moment()[_0x03ab('0xf')](_0x03ab('0x10'));}_0x1866ee(null,_0x12492b);}}});}; \ No newline at end of file +var _0x9d6f=['../../config/logger','moment','bluebird','request-promise','path','../../config/environment','./faxInteraction.attributes','define','fax_interactions','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util'];(function(_0x4f1a69,_0x88be26){var _0x269f35=function(_0x128ac8){while(--_0x128ac8){_0x4f1a69['push'](_0x4f1a69['shift']());}};_0x269f35(++_0x88be26);}(_0x9d6f,0x12e));var _0xf9d6=function(_0x3242de,_0x31a176){_0x3242de=_0x3242de-0x0;var _0x15aa8f=_0x9d6f[_0x3242de];return _0x15aa8f;};'use strict';var _=require(_0xf9d6('0x0'));var util=require(_0xf9d6('0x1'));var logger=require(_0xf9d6('0x2'))('api');var moment=require(_0xf9d6('0x3'));var BPromise=require(_0xf9d6('0x4'));var rp=require(_0xf9d6('0x5'));var fs=require('fs');var path=require(_0xf9d6('0x6'));var rimraf=require('rimraf');var config=require(_0xf9d6('0x7'));var attributes=require(_0xf9d6('0x8'));module['exports']=function(_0x8e12c,_0x2008c3){return _0x8e12c[_0xf9d6('0x9')]('FaxInteraction',attributes,{'tableName':_0xf9d6('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x543220,_0x329397,_0x4ca0d9){if(_0x543220[_0xf9d6('0xb')](_0xf9d6('0xc'))){_0x543220[_0xf9d6('0xd')]=moment()[_0xf9d6('0xe')](_0xf9d6('0xf'));}_0x4ca0d9(null,_0x543220);}}});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.rpc.js b/server/api/faxInteraction/faxInteraction.rpc.js index 3155985..cd6f1e3 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 _0xdc4a=['rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./faxInteraction.socket','register','then','info','FaxInteraction,\x20%s,\x20%s','request\x20sent','debug','FaxInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','UpdateFaxInteraction','FaxInteraction','update','body','options','raw','attributes','AddTagsToFaxInteraction','find','addTags','ids','omit','spread','AddTags','lodash','bluebird','ioredis','../../config/utils','../../config/logger'];(function(_0x218c33,_0x237584){var _0x34d427=function(_0x55211d){while(--_0x55211d){_0x218c33['push'](_0x218c33['shift']());}};_0x34d427(++_0x237584);}(_0xdc4a,0x11a));var _0xadc4=function(_0xdde123,_0x3a6751){_0xdde123=_0xdde123-0x0;var _0x5379bc=_0xdc4a[_0xdde123];return _0x5379bc;};'use strict';var _=require(_0xadc4('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xadc4('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xadc4('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xadc4('0x3'));var logger=require(_0xadc4('0x4'))(_0xadc4('0x5'));var config=require(_0xadc4('0x6'));var jayson=require(_0xadc4('0x7'));var client=jayson[_0xadc4('0x8')][_0xadc4('0x9')]({'port':0x232a});config['redis']=_['defaults'](config[_0xadc4('0xa')],{'host':_0xadc4('0xb'),'port':0x18eb});var socket=require(_0xadc4('0xc'))(new Redis(config[_0xadc4('0xa')]));require(_0xadc4('0xd'))[_0xadc4('0xe')](socket);function respondWithRpcPromise(_0x390be7,_0x99691f,_0x31e9d0){return new BPromise(function(_0x4fde5e,_0x3e5500){return client['request'](_0x390be7,_0x31e9d0)[_0xadc4('0xf')](function(_0x5e019b){logger[_0xadc4('0x10')](_0xadc4('0x11'),_0x99691f,_0xadc4('0x12'));logger[_0xadc4('0x13')](_0xadc4('0x14'),_0x99691f,'request\x20sent',JSON[_0xadc4('0x15')](_0x5e019b));if(_0x5e019b['error']){if(_0x5e019b[_0xadc4('0x16')][_0xadc4('0x17')]===0x1f4){logger[_0xadc4('0x16')](_0xadc4('0x11'),_0x99691f,_0x5e019b['error'][_0xadc4('0x18')]);return _0x3e5500(_0x5e019b[_0xadc4('0x16')][_0xadc4('0x18')]);}logger[_0xadc4('0x16')](_0xadc4('0x11'),_0x99691f,_0x5e019b[_0xadc4('0x16')][_0xadc4('0x18')]);return _0x4fde5e(_0x5e019b[_0xadc4('0x16')][_0xadc4('0x18')]);}else{logger[_0xadc4('0x10')](_0xadc4('0x11'),_0x99691f,_0xadc4('0x12'));_0x4fde5e(_0x5e019b[_0xadc4('0x19')][_0xadc4('0x18')]);}})[_0xadc4('0x1a')](function(_0x33c4c){logger[_0xadc4('0x16')](_0xadc4('0x11'),_0x99691f,_0x33c4c);_0x3e5500(_0x33c4c);});});}exports[_0xadc4('0x1b')]=function(_0x54fbc7){var _0x484b5c=this;return new Promise(function(_0x15372f,_0x246c73){return db[_0xadc4('0x1c')][_0xadc4('0x1d')](_0x54fbc7[_0xadc4('0x1e')],{'raw':_0x54fbc7[_0xadc4('0x1f')]?_0x54fbc7[_0xadc4('0x1f')][_0xadc4('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x54fbc7['options']?_0x54fbc7[_0xadc4('0x1f')]['where']||null:null,'attributes':_0x54fbc7[_0xadc4('0x1f')]?_0x54fbc7[_0xadc4('0x1f')][_0xadc4('0x21')]||null:null,'limit':_0x54fbc7[_0xadc4('0x1f')]?_0x54fbc7['options']['limit']||null:null})[_0xadc4('0xf')](function(_0x5a0a13){logger[_0xadc4('0x10')](_0xadc4('0x1b'),_0x54fbc7);logger[_0xadc4('0x13')](_0xadc4('0x1b'),_0x54fbc7,JSON[_0xadc4('0x15')](_0x5a0a13));_0x15372f(_0x5a0a13);})[_0xadc4('0x1a')](function(_0x494b3e){logger[_0xadc4('0x16')](_0xadc4('0x1b'),_0x494b3e[_0xadc4('0x18')],_0x54fbc7);_0x246c73(_0x484b5c['error'](0x1f4,_0x494b3e['message']));});});};exports[_0xadc4('0x22')]=function(_0xd95820){return new Promise(function(_0x5d584a,_0x33c267){return db[_0xadc4('0x1c')][_0xadc4('0x23')]({'where':_0xd95820[_0xadc4('0x1f')]?_0xd95820[_0xadc4('0x1f')]['where']||null:null})[_0xadc4('0xf')](function(_0xf6d411){if(_0xf6d411){return _0xf6d411[_0xadc4('0x24')](_0xd95820[_0xadc4('0x1e')][_0xadc4('0x25')],_[_0xadc4('0x26')](_0xd95820[_0xadc4('0x1e')],[_0xadc4('0x25'),'id'])||{});}})[_0xadc4('0x27')](function(_0x381543){logger[_0xadc4('0x10')](_0xadc4('0x28'),_0xd95820);logger[_0xadc4('0x13')](_0xadc4('0x28'),_0xd95820,JSON[_0xadc4('0x15')](_0x381543));_0x5d584a(_0x381543);})[_0xadc4('0x1a')](function(_0x3b4f20){logger[_0xadc4('0x16')](_0xadc4('0x28'),_0x3b4f20[_0xadc4('0x18')],_0xd95820);_0x33c267(_this['error'](0x1f4,_0x3b4f20['message']));});});}; \ No newline at end of file +var _0xbffa=['socket.io-emitter','./faxInteraction.socket','register','then','info','FaxInteraction,\x20%s,\x20%s','request\x20sent','debug','FaxInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','UpdateFaxInteraction','FaxInteraction','body','options','raw','where','attributes','limit','catch','AddTagsToFaxInteraction','find','addTags','omit','ids','spread','AddTags','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost'];(function(_0x15e055,_0x4d13d7){var _0x4959e4=function(_0x1be37c){while(--_0x1be37c){_0x15e055['push'](_0x15e055['shift']());}};_0x4959e4(++_0x4d13d7);}(_0xbffa,0x186));var _0xabff=function(_0x4fe601,_0x2d9f72){_0x4fe601=_0x4fe601-0x0;var _0x2b7333=_0xbffa[_0x4fe601];return _0x2b7333;};'use strict';var _=require(_0xabff('0x0'));var util=require(_0xabff('0x1'));var moment=require('moment');var BPromise=require(_0xabff('0x2'));var rs=require(_0xabff('0x3'));var fs=require('fs');var Redis=require(_0xabff('0x4'));var db=require(_0xabff('0x5'))['db'];var utils=require(_0xabff('0x6'));var logger=require(_0xabff('0x7'))('rpc');var config=require(_0xabff('0x8'));var jayson=require(_0xabff('0x9'));var client=jayson[_0xabff('0xa')][_0xabff('0xb')]({'port':0x232a});config[_0xabff('0xc')]=_[_0xabff('0xd')](config[_0xabff('0xc')],{'host':_0xabff('0xe'),'port':0x18eb});var socket=require(_0xabff('0xf'))(new Redis(config[_0xabff('0xc')]));require(_0xabff('0x10'))[_0xabff('0x11')](socket);function respondWithRpcPromise(_0x367605,_0x43617b,_0x564e7b){return new BPromise(function(_0xe0f854,_0x4803bb){return client['request'](_0x367605,_0x564e7b)[_0xabff('0x12')](function(_0x70e57b){logger[_0xabff('0x13')](_0xabff('0x14'),_0x43617b,_0xabff('0x15'));logger[_0xabff('0x16')](_0xabff('0x17'),_0x43617b,_0xabff('0x15'),JSON[_0xabff('0x18')](_0x70e57b));if(_0x70e57b[_0xabff('0x19')]){if(_0x70e57b[_0xabff('0x19')][_0xabff('0x1a')]===0x1f4){logger[_0xabff('0x19')](_0xabff('0x14'),_0x43617b,_0x70e57b[_0xabff('0x19')][_0xabff('0x1b')]);return _0x4803bb(_0x70e57b[_0xabff('0x19')][_0xabff('0x1b')]);}logger['error'](_0xabff('0x14'),_0x43617b,_0x70e57b['error'][_0xabff('0x1b')]);return _0xe0f854(_0x70e57b[_0xabff('0x19')][_0xabff('0x1b')]);}else{logger['info'](_0xabff('0x14'),_0x43617b,_0xabff('0x15'));_0xe0f854(_0x70e57b[_0xabff('0x1c')][_0xabff('0x1b')]);}})['catch'](function(_0x4927e1){logger['error'](_0xabff('0x14'),_0x43617b,_0x4927e1);_0x4803bb(_0x4927e1);});});}exports[_0xabff('0x1d')]=function(_0x4598ea){var _0x33cfb1=this;return new Promise(function(_0x29af1a,_0x37a08b){return db[_0xabff('0x1e')]['update'](_0x4598ea[_0xabff('0x1f')],{'raw':_0x4598ea['options']?_0x4598ea[_0xabff('0x20')][_0xabff('0x21')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4598ea[_0xabff('0x20')]?_0x4598ea[_0xabff('0x20')][_0xabff('0x22')]||null:null,'attributes':_0x4598ea['options']?_0x4598ea[_0xabff('0x20')][_0xabff('0x23')]||null:null,'limit':_0x4598ea[_0xabff('0x20')]?_0x4598ea[_0xabff('0x20')][_0xabff('0x24')]||null:null})['then'](function(_0x4f61fc){logger[_0xabff('0x13')](_0xabff('0x1d'),_0x4598ea);logger[_0xabff('0x16')]('UpdateFaxInteraction',_0x4598ea,JSON[_0xabff('0x18')](_0x4f61fc));_0x29af1a(_0x4f61fc);})[_0xabff('0x25')](function(_0x21198f){logger[_0xabff('0x19')](_0xabff('0x1d'),_0x21198f['message'],_0x4598ea);_0x37a08b(_0x33cfb1[_0xabff('0x19')](0x1f4,_0x21198f[_0xabff('0x1b')]));});});};exports[_0xabff('0x26')]=function(_0x55fa44){return new Promise(function(_0x42ccf7,_0x4da880){return db[_0xabff('0x1e')][_0xabff('0x27')]({'where':_0x55fa44[_0xabff('0x20')]?_0x55fa44['options'][_0xabff('0x22')]||null:null})[_0xabff('0x12')](function(_0x5e00d6){if(_0x5e00d6){return _0x5e00d6[_0xabff('0x28')](_0x55fa44['body']['ids'],_[_0xabff('0x29')](_0x55fa44[_0xabff('0x1f')],[_0xabff('0x2a'),'id'])||{});}})[_0xabff('0x2b')](function(_0x268148){logger[_0xabff('0x13')](_0xabff('0x2c'),_0x55fa44);logger[_0xabff('0x16')](_0xabff('0x2c'),_0x55fa44,JSON[_0xabff('0x18')](_0x268148));_0x42ccf7(_0x268148);})[_0xabff('0x25')](function(_0x304002){logger[_0xabff('0x19')]('AddTags',_0x304002[_0xabff('0x1b')],_0x55fa44);_0x4da880(_this[_0xabff('0x19')](0x1f4,_0x304002[_0xabff('0x1b')]));});});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.socket.js b/server/api/faxInteraction/faxInteraction.socket.js index fe56a2d..1eec369 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 _0xa752=['save','remove','emit','removeListener','faxInteraction:','./faxInteraction.events'];(function(_0x14a606,_0x5efa95){var _0x241f3d=function(_0x42c1ea){while(--_0x42c1ea){_0x14a606['push'](_0x14a606['shift']());}};_0x241f3d(++_0x5efa95);}(_0xa752,0x8f));var _0x2a75=function(_0x1bddda,_0x184d88){_0x1bddda=_0x1bddda-0x0;var _0x48a258=_0xa752[_0x1bddda];return _0x48a258;};'use strict';var FaxInteractionEvents=require(_0x2a75('0x0'));var events=[_0x2a75('0x1'),_0x2a75('0x2'),'update'];function createListener(_0x33396a,_0x1f4bc9){return function(_0x110312){_0x1f4bc9[_0x2a75('0x3')](_0x33396a,_0x110312);};}function removeListener(_0x1c2205,_0x22d0e5){return function(){FaxInteractionEvents[_0x2a75('0x4')](_0x1c2205,_0x22d0e5);};}exports['register']=function(_0x339855){for(var _0x36c580=0x0,_0x32dfed=events['length'];_0x36c580<_0x32dfed;_0x36c580++){var _0x2c587c=events[_0x36c580];var _0x17c9bc=createListener(_0x2a75('0x5')+_0x2c587c,_0x339855);FaxInteractionEvents['on'](_0x2c587c,_0x17c9bc);}}; \ No newline at end of file +var _0x2ba0=['./faxInteraction.events','update','register','length'];(function(_0x35e25c,_0x301f23){var _0x5266c6=function(_0x2d4330){while(--_0x2d4330){_0x35e25c['push'](_0x35e25c['shift']());}};_0x5266c6(++_0x301f23);}(_0x2ba0,0x138));var _0x02ba=function(_0x2e4309,_0x2d0290){_0x2e4309=_0x2e4309-0x0;var _0x8c3f43=_0x2ba0[_0x2e4309];return _0x8c3f43;};'use strict';var FaxInteractionEvents=require(_0x02ba('0x0'));var events=['save','remove',_0x02ba('0x1')];function createListener(_0x47c53b,_0x12f7f6){return function(_0x431926){_0x12f7f6['emit'](_0x47c53b,_0x431926);};}function removeListener(_0x194011,_0x59709c){return function(){FaxInteractionEvents['removeListener'](_0x194011,_0x59709c);};}exports[_0x02ba('0x2')]=function(_0x5b1726){for(var _0x1a8f82=0x0,_0x480532=events[_0x02ba('0x3')];_0x1a8f82<_0x480532;_0x1a8f82++){var _0x299f4c=events[_0x1a8f82];var _0x1eccf3=createListener('faxInteraction:'+_0x299f4c,_0x5b1726);FaxInteractionEvents['on'](_0x299f4c,_0x1eccf3);}}; \ No newline at end of file diff --git a/server/api/faxInteraction/index.js b/server/api/faxInteraction/index.js index 8cdf7c0..505a024 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 _0xf109=['path','express','Router','fs-extra','get','index','/describe','isAuthenticated','describe','/:id','show','/:id/messages','getMessages','/:id/download','download','post','create','/:id/tags','tracked','fax','put','faxinteraction:update','update','delete','faxinteraction:destroy','destroy','removeTags','exports','multer','util'];(function(_0x2940d0,_0x58a274){var _0x19a54f=function(_0x16b496){while(--_0x16b496){_0x2940d0['push'](_0x2940d0['shift']());}};_0x19a54f(++_0x58a274);}(_0xf109,0x1de));var _0x9f10=function(_0x17406a,_0x1e2320){_0x17406a=_0x17406a-0x0;var _0x1501ff=_0xf109[_0x17406a];return _0x1501ff;};'use strict';var multer=require(_0x9f10('0x0'));var util=require(_0x9f10('0x1'));var path=require(_0x9f10('0x2'));var timeout=require('connect-timeout');var express=require(_0x9f10('0x3'));var router=express[_0x9f10('0x4')]();var fs_extra=require(_0x9f10('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./faxInteraction.controller');router[_0x9f10('0x6')]('/',auth['isAuthenticated'](),controller[_0x9f10('0x7')]);router[_0x9f10('0x6')](_0x9f10('0x8'),auth[_0x9f10('0x9')](),controller[_0x9f10('0xa')]);router[_0x9f10('0x6')](_0x9f10('0xb'),auth[_0x9f10('0x9')](),controller[_0x9f10('0xc')]);router[_0x9f10('0x6')](_0x9f10('0xd'),auth[_0x9f10('0x9')](),controller[_0x9f10('0xe')]);router[_0x9f10('0x6')](_0x9f10('0xf'),auth[_0x9f10('0x9')](),controller[_0x9f10('0x10')]);router[_0x9f10('0x11')]('/',auth['isAuthenticated'](),controller[_0x9f10('0x12')]);router[_0x9f10('0x11')](_0x9f10('0xd'),auth[_0x9f10('0x9')](),controller['addMessage']);router[_0x9f10('0x11')](_0x9f10('0x13'),auth[_0x9f10('0x9')](),interaction[_0x9f10('0x14')](_0x9f10('0x15'),'faxinteraction:addtags'),controller['addTags']);router[_0x9f10('0x16')]('/:id',auth[_0x9f10('0x9')](),interaction['tracked']('fax',_0x9f10('0x17')),controller[_0x9f10('0x18')]);router[_0x9f10('0x19')](_0x9f10('0xb'),auth[_0x9f10('0x9')](),interaction[_0x9f10('0x14')]('fax',_0x9f10('0x1a')),controller[_0x9f10('0x1b')]);router[_0x9f10('0x19')](_0x9f10('0x13'),auth[_0x9f10('0x9')](),controller[_0x9f10('0x1c')]);module[_0x9f10('0x1d')]=router; \ No newline at end of file +var _0xad71=['update','delete','faxinteraction:destroy','destroy','removeTags','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxInteraction.controller','get','index','isAuthenticated','describe','show','/:id/messages','/:id/download','download','post','create','addMessage','/:id/tags','tracked','fax','addTags','/:id','faxinteraction:update'];(function(_0x6c993a,_0x5ea3ab){var _0x27f547=function(_0x22df20){while(--_0x22df20){_0x6c993a['push'](_0x6c993a['shift']());}};_0x27f547(++_0x5ea3ab);}(_0xad71,0x185));var _0x1ad7=function(_0x1a156d,_0x3009f3){_0x1a156d=_0x1a156d-0x0;var _0x1c1969=_0xad71[_0x1a156d];return _0x1c1969;};'use strict';var multer=require(_0x1ad7('0x0'));var util=require(_0x1ad7('0x1'));var path=require(_0x1ad7('0x2'));var timeout=require(_0x1ad7('0x3'));var express=require(_0x1ad7('0x4'));var router=express['Router']();var fs_extra=require(_0x1ad7('0x5'));var auth=require(_0x1ad7('0x6'));var interaction=require(_0x1ad7('0x7'));var config=require(_0x1ad7('0x8'));var controller=require(_0x1ad7('0x9'));router[_0x1ad7('0xa')]('/',auth['isAuthenticated'](),controller[_0x1ad7('0xb')]);router[_0x1ad7('0xa')]('/describe',auth[_0x1ad7('0xc')](),controller[_0x1ad7('0xd')]);router[_0x1ad7('0xa')]('/:id',auth[_0x1ad7('0xc')](),controller[_0x1ad7('0xe')]);router[_0x1ad7('0xa')](_0x1ad7('0xf'),auth[_0x1ad7('0xc')](),controller['getMessages']);router[_0x1ad7('0xa')](_0x1ad7('0x10'),auth[_0x1ad7('0xc')](),controller[_0x1ad7('0x11')]);router[_0x1ad7('0x12')]('/',auth[_0x1ad7('0xc')](),controller[_0x1ad7('0x13')]);router['post']('/:id/messages',auth[_0x1ad7('0xc')](),controller[_0x1ad7('0x14')]);router[_0x1ad7('0x12')](_0x1ad7('0x15'),auth[_0x1ad7('0xc')](),interaction[_0x1ad7('0x16')](_0x1ad7('0x17'),'faxinteraction:addtags'),controller[_0x1ad7('0x18')]);router['put'](_0x1ad7('0x19'),auth['isAuthenticated'](),interaction['tracked'](_0x1ad7('0x17'),_0x1ad7('0x1a')),controller[_0x1ad7('0x1b')]);router[_0x1ad7('0x1c')](_0x1ad7('0x19'),auth[_0x1ad7('0xc')](),interaction['tracked'](_0x1ad7('0x17'),_0x1ad7('0x1d')),controller[_0x1ad7('0x1e')]);router[_0x1ad7('0x1c')](_0x1ad7('0x15'),auth[_0x1ad7('0xc')](),controller[_0x1ad7('0x1f')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.attributes.js b/server/api/faxMessage/faxMessage.attributes.js index c9b7ecd..8bf6fe5 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 _0xb201=['TEXT','medium','BOOLEAN','ENUM','out','DATE','sequelize'];(function(_0x38faec,_0x501a14){var _0x1d44b0=function(_0x496730){while(--_0x496730){_0x38faec['push'](_0x38faec['shift']());}};_0x1d44b0(++_0x501a14);}(_0xb201,0x1b1));var _0x1b20=function(_0xe6b059,_0x309bec){_0xe6b059=_0xe6b059-0x0;var _0x617d44=_0xb201[_0xe6b059];return _0x617d44;};'use strict';var Sequelize=require(_0x1b20('0x0'));module['exports']={'body':{'type':Sequelize[_0x1b20('0x1')](_0x1b20('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x1b20('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x1b20('0x4')]('in',_0x1b20('0x5')),'defaultValue':_0x1b20('0x5'),'allowNull':![]},'failMessage':{'type':Sequelize['TEXT'],'defaultValue':null},'readAt':{'type':Sequelize[_0x1b20('0x6')]}}; \ No newline at end of file +var _0xd382=['TEXT','medium','BOOLEAN','ENUM','out','DATE','sequelize','exports'];(function(_0x290c29,_0xe54d31){var _0x4e4548=function(_0x2de16f){while(--_0x2de16f){_0x290c29['push'](_0x290c29['shift']());}};_0x4e4548(++_0xe54d31);}(_0xd382,0x1b6));var _0x2d38=function(_0x8b0068,_0x311e26){_0x8b0068=_0x8b0068-0x0;var _0x6169d6=_0xd382[_0x8b0068];return _0x6169d6;};'use strict';var Sequelize=require(_0x2d38('0x0'));module[_0x2d38('0x1')]={'body':{'type':Sequelize[_0x2d38('0x2')](_0x2d38('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x2d38('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0x2d38('0x5')]('in',_0x2d38('0x6')),'defaultValue':_0x2d38('0x6'),'allowNull':![]},'failMessage':{'type':Sequelize[_0x2d38('0x2')],'defaultValue':null},'readAt':{'type':Sequelize[_0x2d38('0x7')]}}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.controller.js b/server/api/faxMessage/faxMessage.controller.js index c993ddf..a4e0bc3 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 _0x535f=['AttachmentId','SendFax','/var/opt/motion2/server/files/attachments/%s','basename','download','root','files','attachments','join','eml-format','rimraf','request-promise','moment','mustache','util','path','ejs','lodash','squel','desk.js','to-csv','querystring','papaparse','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./faxMessage.socket','register','http','client','request','info','FaxMessage,\x20%s,\x20%s','debug','FaxMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','end','name','index','map','rawAttributes','type','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filter','VIRTUAL','merge','FaxMessage','includeAll','include','rows','show','options','body','find','describe','fax-interactions','accept','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','agent','UserId','params','get','FaxInteraction','FaxInteractionId','isNil','interaction','[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','null','AcceptMessage','acceptMessage','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','User','fullname','email','internal','manual','interface','SIP/%s','channel','motionChannel','EventManager','fax','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','event','rejectmessage','create','CmContact','findOne','Attachment'];(function(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0x535f,0x125));var _0xf535=function(_0x32b1c0,_0x2396f){_0x32b1c0=_0x32b1c0-0x0;var _0x50bd24=_0x535f[_0x32b1c0];return _0x50bd24;};'use strict';var emlformat=require(_0xf535('0x0'));var rimraf=require(_0xf535('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xf535('0x2'));var moment=require(_0xf535('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xf535('0x4'));var util=require(_0xf535('0x5'));var path=require(_0xf535('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xf535('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf535('0x8'));var squel=require(_0xf535('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xf535('0xa'));var toCsv=require(_0xf535('0xb'));var querystring=require(_0xf535('0xc'));var Papa=require(_0xf535('0xd'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xf535('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf535('0xf'));var logger=require(_0xf535('0x10'))(_0xf535('0x11'));var utils=require(_0xf535('0x12'));var config=require(_0xf535('0x13'));var licenseUtil=require(_0xf535('0x14'));var db=require('../../mysqldb')['db'];config[_0xf535('0x15')]=_[_0xf535('0x16')](config['redis'],{'host':_0xf535('0x17'),'port':0x18eb});var socket=require(_0xf535('0x18'))(new Redis(config[_0xf535('0x15')]));require(_0xf535('0x19'))[_0xf535('0x1a')](socket);var jayson=require('jayson/promise');var client=jayson['client'][_0xf535('0x1b')]({'port':0x232c});var client9002=jayson[_0xf535('0x1c')][_0xf535('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x3149bd,_0x4cc536,_0x3bb2a1,_0x4440d5){return new BPromise(function(_0x548882,_0x190349){var _0x36fda0=_0x4440d5||client;return _0x36fda0[_0xf535('0x1d')](_0x3149bd,_0x3bb2a1)['then'](function(_0x22e315){logger[_0xf535('0x1e')](_0xf535('0x1f'),_0x4cc536,'request\x20sent');logger[_0xf535('0x20')](_0xf535('0x21'),_0x4cc536,_0xf535('0x22'),JSON[_0xf535('0x23')](_0x22e315));if(_0x22e315[_0xf535('0x24')]){if(_0x22e315['error'][_0xf535('0x25')]===0x1f4){logger[_0xf535('0x24')]('FaxMessage,\x20%s,\x20%s',_0x4cc536,_0x22e315[_0xf535('0x24')][_0xf535('0x26')]);return _0x190349(_0x22e315[_0xf535('0x24')][_0xf535('0x26')]);}logger['error'](_0xf535('0x1f'),_0x4cc536,_0x22e315[_0xf535('0x24')]['message']);return _0x548882(_0x22e315[_0xf535('0x24')][_0xf535('0x26')]);}else{logger['info'](_0xf535('0x1f'),_0x4cc536,_0xf535('0x22'));_0x548882(_0x22e315[_0xf535('0x27')][_0xf535('0x26')]);}})[_0xf535('0x28')](function(_0x4f8d5b){logger[_0xf535('0x24')](_0xf535('0x1f'),_0x4cc536,_0x4f8d5b);_0x190349(_0x4f8d5b);});});}function respondWithStatusCode(_0xac55fd,_0x457758){_0x457758=_0x457758||0xcc;return function(_0xc00fee){if(_0xc00fee){return _0xac55fd[_0xf535('0x29')](_0x457758);}return _0xac55fd[_0xf535('0x2a')](_0x457758)['end']();};}function respondWithResult(_0x23bfc3,_0xd24ac0){_0xd24ac0=_0xd24ac0||0xc8;return function(_0x4e0ec2){if(_0x4e0ec2){return _0x23bfc3[_0xf535('0x2a')](_0xd24ac0)[_0xf535('0x2b')](_0x4e0ec2);}};}function respondWithFilteredResult(_0x7e9a1c,_0x50a1e0){return function(_0x2b2fd8){if(_0x2b2fd8){var _0x541f66=typeof _0x50a1e0['offset']===_0xf535('0x2c')&&typeof _0x50a1e0[_0xf535('0x2d')]===_0xf535('0x2c');var _0x2df34d=_0x2b2fd8[_0xf535('0x2e')];var _0x40665f=_0x541f66?0x0:_0x50a1e0[_0xf535('0x2f')];var _0x24156f=_0x541f66?_0x2b2fd8[_0xf535('0x2e')]:_0x50a1e0[_0xf535('0x2f')]+_0x50a1e0['limit'];var _0x3970a1;if(_0x24156f>=_0x2df34d){_0x24156f=_0x2df34d;_0x3970a1=0xc8;}else{_0x3970a1=0xce;}_0x7e9a1c[_0xf535('0x2a')](_0x3970a1);return _0x7e9a1c[_0xf535('0x30')](_0xf535('0x31'),_0x40665f+'-'+_0x24156f+'/'+_0x2df34d)['json'](_0x2b2fd8);}return null;};}function patchUpdates(_0x11faf0){return function(_0xc5b6c0){try{jsonpatch[_0xf535('0x32')](_0xc5b6c0,_0x11faf0,!![]);}catch(_0x36a31c){return BPromise[_0xf535('0x33')](_0x36a31c);}return _0xc5b6c0[_0xf535('0x34')]();};}function saveUpdates(_0x466934,_0x4eb335){return function(_0x297d53){if(_0x297d53){return _0x297d53[_0xf535('0x35')](_0x466934)[_0xf535('0x36')](function(_0x516f4f){return _0x516f4f;});}return null;};}function removeEntity(_0x17d8f7,_0x50b44e){return function(_0x34dab6){if(_0x34dab6){return _0x34dab6[_0xf535('0x37')]()['then'](function(){_0x17d8f7['status'](0xcc)[_0xf535('0x38')]();});}};}function handleEntityNotFound(_0x287bad,_0x2530c7){return function(_0x263ce8){if(!_0x263ce8){_0x287bad[_0xf535('0x29')](0x194);}return _0x263ce8;};}function handleError(_0x5e640e,_0x3eadfc){_0x3eadfc=_0x3eadfc||0x1f4;return function(_0x8d9c25){logger[_0xf535('0x24')](_0x8d9c25['stack']);if(_0x8d9c25['name']){delete _0x8d9c25[_0xf535('0x39')];}_0x5e640e[_0xf535('0x2a')](_0x3eadfc)['send'](_0x8d9c25);};}exports[_0xf535('0x3a')]=function(_0x39be50,_0x4eacf4){var _0x2440a5={},_0x3e41cc={},_0x492d76={'count':0x0,'rows':[]};var _0x4e5abd=_[_0xf535('0x3b')](db['FaxMessage'][_0xf535('0x3c')],function(_0x63eb5f){return{'name':_0x63eb5f['fieldName'],'type':_0x63eb5f[_0xf535('0x3d')]['key']};});_0x3e41cc[_0xf535('0x3e')]=_[_0xf535('0x3b')](_0x4e5abd,'name');_0x3e41cc['query']=_[_0xf535('0x3f')](_0x39be50[_0xf535('0x40')]);_0x3e41cc[_0xf535('0x41')]=_[_0xf535('0x42')](_0x3e41cc[_0xf535('0x3e')],_0x3e41cc[_0xf535('0x40')]);_0x2440a5[_0xf535('0x43')]=_[_0xf535('0x42')](_0x3e41cc[_0xf535('0x3e')],qs[_0xf535('0x44')](_0x39be50[_0xf535('0x40')][_0xf535('0x44')]));_0x2440a5[_0xf535('0x43')]=_0x2440a5[_0xf535('0x43')]['length']?_0x2440a5[_0xf535('0x43')]:_0x3e41cc[_0xf535('0x3e')];if(!_0x39be50[_0xf535('0x40')][_0xf535('0x45')](_0xf535('0x46'))){_0x2440a5['limit']=qs[_0xf535('0x2d')](_0x39be50[_0xf535('0x40')][_0xf535('0x2d')]);_0x2440a5[_0xf535('0x2f')]=qs[_0xf535('0x2f')](_0x39be50[_0xf535('0x40')][_0xf535('0x2f')]);}_0x2440a5['order']=qs[_0xf535('0x47')](_0x39be50[_0xf535('0x40')][_0xf535('0x47')]);_0x2440a5[_0xf535('0x48')]=qs[_0xf535('0x41')](_[_0xf535('0x49')](_0x39be50['query'],_0x3e41cc[_0xf535('0x41')]),_0x4e5abd);if(_0x39be50[_0xf535('0x40')][_0xf535('0x4a')]){_0x2440a5[_0xf535('0x48')]=_['merge'](_0x2440a5[_0xf535('0x48')],{'$or':_[_0xf535('0x3b')](_0x4e5abd,function(_0x13bfc6){if(_0x13bfc6['type']!==_0xf535('0x4b')){var _0x2b3483={};_0x2b3483[_0x13bfc6[_0xf535('0x39')]]={'$like':'%'+_0x39be50[_0xf535('0x40')][_0xf535('0x4a')]+'%'};return _0x2b3483;}})});}_0x2440a5=_[_0xf535('0x4c')]({},_0x2440a5,_0x39be50['options']);var _0x76a46f={'where':_0x2440a5[_0xf535('0x48')]};return db[_0xf535('0x4d')][_0xf535('0x2e')](_0x76a46f)[_0xf535('0x36')](function(_0x32a60c){_0x492d76[_0xf535('0x2e')]=_0x32a60c;if(_0x39be50[_0xf535('0x40')][_0xf535('0x4e')]){_0x2440a5[_0xf535('0x4f')]=[{'all':!![]}];}return db['FaxMessage']['findAll'](_0x2440a5);})[_0xf535('0x36')](function(_0x2fa555){_0x492d76[_0xf535('0x50')]=_0x2fa555;return _0x492d76;})[_0xf535('0x36')](respondWithFilteredResult(_0x4eacf4,_0x2440a5))[_0xf535('0x28')](handleError(_0x4eacf4,null));};exports[_0xf535('0x51')]=function(_0x4e0454,_0x12beba){var _0x1221b4={'raw':!![],'where':{'id':_0x4e0454['params']['id']}},_0x3ccdf0={};_0x3ccdf0[_0xf535('0x3e')]=_[_0xf535('0x3f')](db[_0xf535('0x4d')][_0xf535('0x3c')]);_0x3ccdf0['query']=_[_0xf535('0x3f')](_0x4e0454[_0xf535('0x40')]);_0x3ccdf0['filters']=_[_0xf535('0x42')](_0x3ccdf0[_0xf535('0x3e')],_0x3ccdf0[_0xf535('0x40')]);_0x1221b4[_0xf535('0x43')]=_[_0xf535('0x42')](_0x3ccdf0[_0xf535('0x3e')],qs['fields'](_0x4e0454['query'][_0xf535('0x44')]));_0x1221b4['attributes']=_0x1221b4['attributes']['length']?_0x1221b4['attributes']:_0x3ccdf0['model'];if(_0x4e0454[_0xf535('0x40')][_0xf535('0x4e')]){_0x1221b4[_0xf535('0x4f')]=[{'all':!![]}];}_0x1221b4=_[_0xf535('0x4c')]({},_0x1221b4,_0x4e0454[_0xf535('0x52')]);return db[_0xf535('0x4d')]['find'](_0x1221b4)[_0xf535('0x36')](handleEntityNotFound(_0x12beba,null))[_0xf535('0x36')](respondWithResult(_0x12beba,null))['catch'](handleError(_0x12beba,null));};exports[_0xf535('0x35')]=function(_0x48aca9,_0x163694){if(_0x48aca9[_0xf535('0x53')]['id']){delete _0x48aca9[_0xf535('0x53')]['id'];}return db[_0xf535('0x4d')]['find']({'where':{'id':_0x48aca9['params']['id']}})[_0xf535('0x36')](handleEntityNotFound(_0x163694,null))[_0xf535('0x36')](saveUpdates(_0x48aca9[_0xf535('0x53')],null))[_0xf535('0x36')](respondWithResult(_0x163694,null))[_0xf535('0x28')](handleError(_0x163694,null));};exports[_0xf535('0x37')]=function(_0x458db9,_0x5e1e07){return db[_0xf535('0x4d')][_0xf535('0x54')]({'where':{'id':_0x458db9['params']['id']}})[_0xf535('0x36')](handleEntityNotFound(_0x5e1e07,null))['then'](removeEntity(_0x5e1e07,null))[_0xf535('0x28')](handleError(_0x5e1e07,null));};exports['describe']=function(_0xc28b26,_0x228523){return db['FaxMessage'][_0xf535('0x55')]()['then'](respondWithResult(_0x228523,null))[_0xf535('0x28')](handleError(_0x228523,null));};var interaction_log=require(_0xf535('0x10'))(_0xf535('0x56'));exports[_0xf535('0x57')]=function(_0x2d3516,_0x114e84,_0x4245f7){var _0x5059c9={'agent':{},'channel':'fax'};if(_0x2d3516[_0xf535('0x53')]['id']){delete _0x2d3516[_0xf535('0x53')]['id'];}_0x2d3516[_0xf535('0x53')][_0xf535('0x58')]=!![];_0x2d3516['body'][_0xf535('0x59')]=moment()[_0xf535('0x5a')](_0xf535('0x5b'));_0x2d3516['body']['UserId']=_0x2d3516[_0xf535('0x53')]['UserId']||_0x2d3516['user']['id'];_0x5059c9[_0xf535('0x5c')]['id']=_0x2d3516[_0xf535('0x53')][_0xf535('0x5d')];return db[_0xf535('0x4d')][_0xf535('0x54')]({'where':{'id':_0x2d3516[_0xf535('0x5e')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x114e84,null))[_0xf535('0x36')](saveUpdates(_0x2d3516[_0xf535('0x53')],null))[_0xf535('0x36')](function(_0x59b24f){if(_0x59b24f){_0x5059c9[_0xf535('0x26')]=_0x59b24f[_0xf535('0x5f')]({'plain':!![]});return db[_0xf535('0x60')][_0xf535('0x54')]({'where':{'id':_0x59b24f[_0xf535('0x61')]}});}return null;})[_0xf535('0x36')](handleEntityNotFound(_0x114e84,null))[_0xf535('0x36')](function(_0x2e31cb){if(_0x2e31cb){return _0x2e31cb[_0xf535('0x35')]({'UserId':_0x2d3516['body'][_0xf535('0x5d')],'read1stAt':_[_0xf535('0x62')](_0x2e31cb['read1stAt'])?moment()[_0xf535('0x5a')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0xf535('0x36')](function(_0x496345){if(_0x496345){_0x5059c9[_0xf535('0x63')]=_0x496345[_0xf535('0x5f')]({'plain':!![]});interaction_log['info'](_0xf535('0x64'),_0x2d3516['user']['id'],_0x2d3516[_0xf535('0x65')][_0xf535('0x39')],_0x2d3516[_0xf535('0x65')][_0xf535('0x66')],_0x5059c9['interaction']['id'],_0x2d3516['body']?JSON[_0xf535('0x23')](_0x2d3516['body']):_0xf535('0x67'));return respondWithRpcPromise(_0xf535('0x68'),_0xf535('0x69'),_0x5059c9);}return null;})[_0xf535('0x36')](function(_0x1e3207){var _0x190ce0='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x1e3207[_0xf535('0x26')][_0xf535('0x6a')];return db[_0xf535('0x6b')][_0xf535('0x40')](_0x190ce0,{'type':db[_0xf535('0x6c')][_0xf535('0x6d')][_0xf535('0x6e')],'raw':!![]})[_0xf535('0x36')](function(_0x42bee1){return _0x42bee1;});})[_0xf535('0x36')](function(_0x3a66ba){if(_0x3a66ba){_0x5059c9[_0xf535('0x26')][_0xf535('0x6f')]=_0x3a66ba[0x0];if(!_0x2d3516[_0xf535('0x53')]['UserId'])return;return db[_0xf535('0x70')]['find']({'where':{'id':_0x2d3516[_0xf535('0x53')][_0xf535('0x5d')],'role':_0xf535('0x5c')},'attributes':['id',_0xf535('0x39'),_0xf535('0x71'),_0xf535('0x72'),_0xf535('0x73')],'raw':!![]});}return null;})[_0xf535('0x36')](function(_0x3ea2d6){if(!_0x3ea2d6)return null;_0x5059c9[_0xf535('0x26')][_0xf535('0x5c')]=_0x3ea2d6;return _0x5059c9;})[_0xf535('0x36')](function(_0x1e67b6){if(_0x1e67b6){if(_0x2d3516['body'][_0xf535('0x74')]){_0x5059c9[_0xf535('0x26')][_0xf535('0x75')]=util['format'](_0xf535('0x76'),_0x2d3516[_0xf535('0x65')][_0xf535('0x39')]);_0x5059c9['message'][_0xf535('0x77')]=_0x5059c9[_0xf535('0x77')];_0x5059c9[_0xf535('0x26')][_0xf535('0x78')]=_0x5059c9[_0xf535('0x77')];_0x5059c9[_0xf535('0x26')]['event']=_0xf535('0x57');return respondWithRpcPromise(_0xf535('0x79'),_0xf535('0x79'),{'event':'acceptmessage','message':_0x5059c9[_0xf535('0x26')]},client9002)['then'](function(){return _0x5059c9;});}return _0x5059c9;}return null;})[_0xf535('0x36')](respondWithResult(_0x114e84,null))[_0xf535('0x28')](handleError(_0x114e84,null));};var interaction_log=require('../../config/logger')('fax-interactions');exports[_0xf535('0x33')]=function(_0x5a24ae,_0x5541d9,_0x318960){var _0x165c98={'agent':{},'channel':_0xf535('0x7a')};if(_0x5a24ae[_0xf535('0x53')]['id']){delete _0x5a24ae[_0xf535('0x53')]['id'];}_0x5a24ae[_0xf535('0x53')][_0xf535('0x5d')]=_0x5a24ae['body'][_0xf535('0x5d')]||_0x5a24ae[_0xf535('0x65')]['id'];_0x165c98['agent']['id']=_0x5a24ae[_0xf535('0x53')]['UserId'];return db[_0xf535('0x4d')]['find']({'where':{'id':_0x5a24ae[_0xf535('0x5e')]['id'],'UserId':null}})[_0xf535('0x36')](handleEntityNotFound(_0x5541d9,null))[_0xf535('0x36')](function(_0x34ad40){if(_0x34ad40){_0x165c98[_0xf535('0x26')]=_0x34ad40[_0xf535('0x5f')]({'plain':!![]});return db[_0xf535('0x60')][_0xf535('0x54')]({'where':{'id':_0x34ad40[_0xf535('0x61')]}});}return null;})[_0xf535('0x36')](handleEntityNotFound(_0x5541d9,null))[_0xf535('0x36')](function(_0x23c2c0){if(_0x23c2c0){_0x165c98[_0xf535('0x63')]=_0x23c2c0['get']({'plain':!![]});interaction_log['info'](_0xf535('0x7b'),_0x5a24ae[_0xf535('0x65')]['id'],_0x5a24ae[_0xf535('0x65')][_0xf535('0x39')],_0x5a24ae[_0xf535('0x65')][_0xf535('0x66')],_0x165c98[_0xf535('0x63')]['id'],_0x5a24ae[_0xf535('0x53')]?JSON[_0xf535('0x23')](_0x5a24ae['body']):_0xf535('0x67'));return respondWithRpcPromise(_0xf535('0x7c'),_0xf535('0x7d'),_0x165c98);}return null;})[_0xf535('0x36')](function(_0x5bb0c8){var _0x4ba7f3=_0xf535('0x7e')+_0x5bb0c8[_0xf535('0x26')][_0xf535('0x6a')];return db[_0xf535('0x6b')]['query'](_0x4ba7f3,{'type':db[_0xf535('0x6c')][_0xf535('0x6d')][_0xf535('0x6e')],'raw':!![]})[_0xf535('0x36')](function(_0x57def0){return _0x57def0;});})[_0xf535('0x36')](function(_0x49ad43){if(_0x49ad43){_0x165c98[_0xf535('0x26')][_0xf535('0x6f')]=_0x49ad43[0x0];if(!_0x5a24ae['body'][_0xf535('0x5d')])return;return db[_0xf535('0x70')][_0xf535('0x54')]({'where':{'id':_0x5a24ae[_0xf535('0x53')][_0xf535('0x5d')],'role':'agent'},'attributes':['id','name',_0xf535('0x71'),'email',_0xf535('0x73')],'raw':!![]});}return null;})[_0xf535('0x36')](function(_0x2feaf){if(!_0x2feaf)return null;_0x165c98[_0xf535('0x26')][_0xf535('0x5c')]=_0x2feaf;return _0x165c98;})[_0xf535('0x36')](function(_0x21ffb8){if(_0x21ffb8){_0x21ffb8[_0xf535('0x26')]['interface']=util[_0xf535('0x5a')](_0xf535('0x76'),_0x5a24ae[_0xf535('0x65')]['name']);_0x21ffb8[_0xf535('0x26')][_0xf535('0x77')]=_0x165c98[_0xf535('0x77')];_0x21ffb8[_0xf535('0x26')][_0xf535('0x78')]=_0x165c98['channel'];_0x21ffb8[_0xf535('0x26')][_0xf535('0x7f')]=_0xf535('0x33');respondWithRpcPromise(_0xf535('0x79'),_0xf535('0x79'),{'event':_0xf535('0x80'),'message':_0x21ffb8[_0xf535('0x26')]},client9002);return _0x165c98;}return null;})[_0xf535('0x36')](respondWithResult(_0x5541d9,null))['catch'](handleError(_0x5541d9,null));};exports[_0xf535('0x81')]=function(_0x121eae,_0x12c61c){var _0x415593;return db['FaxMessage'][_0xf535('0x81')](_0x121eae[_0xf535('0x53')],{})[_0xf535('0x36')](function(_0x7a7721){_0x415593=_0x7a7721;return db[_0xf535('0x82')][_0xf535('0x83')]({'where':{'id':_0x415593[_0xf535('0x6a')]}});})[_0xf535('0x36')](function(_0x48ee85){if(_[_0xf535('0x62')](_0x48ee85)){return;}else{_0x415593['fax']=_0x48ee85[_0xf535('0x7a')];return db[_0xf535('0x84')][_0xf535('0x83')]({'where':{'id':_0x415593[_0xf535('0x85')]}});}})[_0xf535('0x36')](function(_0x518c61){return respondWithRpcPromise(_0xf535('0x86'),_0xf535('0x86'),{'FaxAccountId':_['isNil'](_0x121eae[_0xf535('0x53')])?undefined:_0x121eae[_0xf535('0x53')]['FaxAccountId'],'path':_[_0xf535('0x62')](_0x518c61)?undefined:util[_0xf535('0x5a')](_0xf535('0x87'),_0x518c61[_0xf535('0x88')]),'fax':_[_0xf535('0x62')](_0x415593['fax'])?undefined:_0x415593['fax'],'AttachmentId':_0x415593[_0xf535('0x85')]},client9002);})[_0xf535('0x36')](respondWithResult(_0x12c61c,0xc9))['catch'](handleError(_0x12c61c,null));};exports[_0xf535('0x89')]=function(_0x54d114,_0x230322){var _0x38b3c5=path['join'](config[_0xf535('0x8a')],'server',_0xf535('0x8b'),_0xf535('0x8c'));return db[_0xf535('0x4d')][_0xf535('0x54')]({'where':{'id':_0x54d114[_0xf535('0x5e')]['id']},'include':[{'model':db[_0xf535('0x84')],'as':_0xf535('0x84')}]})[_0xf535('0x36')](handleEntityNotFound(_0x230322,null))[_0xf535('0x36')](function(_0x57a90b){if(_0x57a90b){return _0x230322[_0xf535('0x89')](path[_0xf535('0x8d')](_0x38b3c5,_0x57a90b[_0xf535('0x84')][_0xf535('0x88')]));}})['catch'](handleError(_0x230322,null));}; \ No newline at end of file +var _0xf3a7=['type','VIRTUAL','includeAll','include','findAll','rows','show','params','merge','options','find','body','describe','fax','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','FaxInteraction','FaxInteractionId','isNil','read1stAt','interaction','[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','stringify','null','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','QueryTypes','SELECT','contact','User','interface','SIP/%s','channel','motionChannel','event','accept','EventManager','acceptmessage','fax-interactions','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','sequelize','Sequelize','email','internal','rejectmessage','create','CmContact','findOne','Attachment','AttachmentId','SendFax','FaxAccountId','/var/opt/motion2/server/files/attachments/%s','basename','download','join','root','files','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','redis','defaults','socket.io-emitter','./faxMessage.socket','register','jayson/promise','http','request','then','info','FaxMessage,\x20%s,\x20%s','debug','FaxMessage,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','sendStatus','end','limit','undefined','count','offset','status','apply','reject','save','update','destroy','name','send','index','FaxMessage','rawAttributes','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter'];(function(_0x53b93b,_0x1bfab1){var _0x485761=function(_0x41592e){while(--_0x41592e){_0x53b93b['push'](_0x53b93b['shift']());}};_0x485761(++_0x1bfab1);}(_0xf3a7,0xd1));var _0x7f3a=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf3a7[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x7f3a('0x0'));var rimraf=require(_0x7f3a('0x1'));var zipdir=require(_0x7f3a('0x2'));var jsonpatch=require(_0x7f3a('0x3'));var rp=require(_0x7f3a('0x4'));var moment=require(_0x7f3a('0x5'));var BPromise=require(_0x7f3a('0x6'));var Mustache=require(_0x7f3a('0x7'));var util=require('util');var path=require(_0x7f3a('0x8'));var sox=require('sox');var csv=require(_0x7f3a('0x9'));var ejs=require(_0x7f3a('0xa'));var fs=require('fs');var fs_extra=require(_0x7f3a('0xb'));var _=require('lodash');var squel=require(_0x7f3a('0xc'));var crypto=require(_0x7f3a('0xd'));var jsforce=require(_0x7f3a('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x7f3a('0xf'));var Papa=require(_0x7f3a('0x10'));var Redis=require(_0x7f3a('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x7f3a('0x12'));var hardwareService=require(_0x7f3a('0x13'));var logger=require(_0x7f3a('0x14'))('api');var utils=require(_0x7f3a('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x7f3a('0x16'));var db=require('../../mysqldb')['db'];config[_0x7f3a('0x17')]=_[_0x7f3a('0x18')](config[_0x7f3a('0x17')],{'host':'localhost','port':0x18eb});var socket=require(_0x7f3a('0x19'))(new Redis(config[_0x7f3a('0x17')]));require(_0x7f3a('0x1a'))[_0x7f3a('0x1b')](socket);var jayson=require(_0x7f3a('0x1c'));var client=jayson['client'][_0x7f3a('0x1d')]({'port':0x232c});var client9002=jayson['client'][_0x7f3a('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x2968e2,_0x36b532,_0x5294f8,_0x521eac){return new BPromise(function(_0x47b46f,_0x1ee2f3){var _0x3b1fa6=_0x521eac||client;return _0x3b1fa6[_0x7f3a('0x1e')](_0x2968e2,_0x5294f8)[_0x7f3a('0x1f')](function(_0x28ff4e){logger[_0x7f3a('0x20')](_0x7f3a('0x21'),_0x36b532,'request\x20sent');logger[_0x7f3a('0x22')](_0x7f3a('0x23'),_0x36b532,_0x7f3a('0x24'),JSON['stringify'](_0x28ff4e));if(_0x28ff4e[_0x7f3a('0x25')]){if(_0x28ff4e[_0x7f3a('0x25')][_0x7f3a('0x26')]===0x1f4){logger[_0x7f3a('0x25')](_0x7f3a('0x21'),_0x36b532,_0x28ff4e[_0x7f3a('0x25')][_0x7f3a('0x27')]);return _0x1ee2f3(_0x28ff4e[_0x7f3a('0x25')][_0x7f3a('0x27')]);}logger[_0x7f3a('0x25')]('FaxMessage,\x20%s,\x20%s',_0x36b532,_0x28ff4e[_0x7f3a('0x25')][_0x7f3a('0x27')]);return _0x47b46f(_0x28ff4e['error'][_0x7f3a('0x27')]);}else{logger[_0x7f3a('0x20')]('FaxMessage,\x20%s,\x20%s',_0x36b532,_0x7f3a('0x24'));_0x47b46f(_0x28ff4e[_0x7f3a('0x28')][_0x7f3a('0x27')]);}})[_0x7f3a('0x29')](function(_0x43a124){logger[_0x7f3a('0x25')](_0x7f3a('0x21'),_0x36b532,_0x43a124);_0x1ee2f3(_0x43a124);});});}function respondWithStatusCode(_0x241a49,_0x2ab147){_0x2ab147=_0x2ab147||0xcc;return function(_0x123f24){if(_0x123f24){return _0x241a49[_0x7f3a('0x2a')](_0x2ab147);}return _0x241a49['status'](_0x2ab147)[_0x7f3a('0x2b')]();};}function respondWithResult(_0x7d5fbc,_0x114e54){_0x114e54=_0x114e54||0xc8;return function(_0x2663ea){if(_0x2663ea){return _0x7d5fbc['status'](_0x114e54)['json'](_0x2663ea);}};}function respondWithFilteredResult(_0x5e0ccf,_0x55fcbe){return function(_0x3eabb5){if(_0x3eabb5){var _0x931283=typeof _0x55fcbe['offset']==='undefined'&&typeof _0x55fcbe[_0x7f3a('0x2c')]===_0x7f3a('0x2d');var _0xf47051=_0x3eabb5[_0x7f3a('0x2e')];var _0xfd7b5f=_0x931283?0x0:_0x55fcbe[_0x7f3a('0x2f')];var _0x198ccd=_0x931283?_0x3eabb5[_0x7f3a('0x2e')]:_0x55fcbe[_0x7f3a('0x2f')]+_0x55fcbe[_0x7f3a('0x2c')];var _0x10dee4;if(_0x198ccd>=_0xf47051){_0x198ccd=_0xf47051;_0x10dee4=0xc8;}else{_0x10dee4=0xce;}_0x5e0ccf[_0x7f3a('0x30')](_0x10dee4);return _0x5e0ccf['set']('Content-Range',_0xfd7b5f+'-'+_0x198ccd+'/'+_0xf47051)['json'](_0x3eabb5);}return null;};}function patchUpdates(_0x5008cf){return function(_0x2a75b8){try{jsonpatch[_0x7f3a('0x31')](_0x2a75b8,_0x5008cf,!![]);}catch(_0x30fff7){return BPromise[_0x7f3a('0x32')](_0x30fff7);}return _0x2a75b8[_0x7f3a('0x33')]();};}function saveUpdates(_0x4776da,_0x3bd32a){return function(_0x22ff8e){if(_0x22ff8e){return _0x22ff8e[_0x7f3a('0x34')](_0x4776da)[_0x7f3a('0x1f')](function(_0x2d1c06){return _0x2d1c06;});}return null;};}function removeEntity(_0x3c0ee3,_0x23fdc7){return function(_0x1e1088){if(_0x1e1088){return _0x1e1088[_0x7f3a('0x35')]()[_0x7f3a('0x1f')](function(){_0x3c0ee3[_0x7f3a('0x30')](0xcc)[_0x7f3a('0x2b')]();});}};}function handleEntityNotFound(_0x201fe3,_0x17a199){return function(_0x1f3538){if(!_0x1f3538){_0x201fe3[_0x7f3a('0x2a')](0x194);}return _0x1f3538;};}function handleError(_0x46aa7c,_0x17b71f){_0x17b71f=_0x17b71f||0x1f4;return function(_0x18ade1){logger['error'](_0x18ade1['stack']);if(_0x18ade1[_0x7f3a('0x36')]){delete _0x18ade1['name'];}_0x46aa7c['status'](_0x17b71f)[_0x7f3a('0x37')](_0x18ade1);};}exports[_0x7f3a('0x38')]=function(_0x5513bf,_0x47c1b8){var _0x3ecc9d={},_0x31676b={},_0x2b2562={'count':0x0,'rows':[]};var _0x4a49cb=_['map'](db[_0x7f3a('0x39')][_0x7f3a('0x3a')],function(_0x10f89c){return{'name':_0x10f89c['fieldName'],'type':_0x10f89c['type']['key']};});_0x31676b[_0x7f3a('0x3b')]=_[_0x7f3a('0x3c')](_0x4a49cb,_0x7f3a('0x36'));_0x31676b[_0x7f3a('0x3d')]=_[_0x7f3a('0x3e')](_0x5513bf[_0x7f3a('0x3d')]);_0x31676b[_0x7f3a('0x3f')]=_[_0x7f3a('0x40')](_0x31676b[_0x7f3a('0x3b')],_0x31676b[_0x7f3a('0x3d')]);_0x3ecc9d[_0x7f3a('0x41')]=_[_0x7f3a('0x40')](_0x31676b[_0x7f3a('0x3b')],qs[_0x7f3a('0x42')](_0x5513bf[_0x7f3a('0x3d')]['fields']));_0x3ecc9d['attributes']=_0x3ecc9d[_0x7f3a('0x41')][_0x7f3a('0x43')]?_0x3ecc9d[_0x7f3a('0x41')]:_0x31676b[_0x7f3a('0x3b')];if(!_0x5513bf['query'][_0x7f3a('0x44')](_0x7f3a('0x45'))){_0x3ecc9d[_0x7f3a('0x2c')]=qs[_0x7f3a('0x2c')](_0x5513bf['query'][_0x7f3a('0x2c')]);_0x3ecc9d[_0x7f3a('0x2f')]=qs[_0x7f3a('0x2f')](_0x5513bf[_0x7f3a('0x3d')][_0x7f3a('0x2f')]);}_0x3ecc9d[_0x7f3a('0x46')]=qs[_0x7f3a('0x47')](_0x5513bf['query'][_0x7f3a('0x47')]);_0x3ecc9d[_0x7f3a('0x48')]=qs[_0x7f3a('0x3f')](_[_0x7f3a('0x49')](_0x5513bf[_0x7f3a('0x3d')],_0x31676b[_0x7f3a('0x3f')]),_0x4a49cb);if(_0x5513bf[_0x7f3a('0x3d')][_0x7f3a('0x4a')]){_0x3ecc9d[_0x7f3a('0x48')]=_['merge'](_0x3ecc9d[_0x7f3a('0x48')],{'$or':_[_0x7f3a('0x3c')](_0x4a49cb,function(_0x326b86){if(_0x326b86[_0x7f3a('0x4b')]!==_0x7f3a('0x4c')){var _0x13a9e1={};_0x13a9e1[_0x326b86[_0x7f3a('0x36')]]={'$like':'%'+_0x5513bf['query']['filter']+'%'};return _0x13a9e1;}})});}_0x3ecc9d=_['merge']({},_0x3ecc9d,_0x5513bf['options']);var _0x340eaa={'where':_0x3ecc9d['where']};return db[_0x7f3a('0x39')][_0x7f3a('0x2e')](_0x340eaa)[_0x7f3a('0x1f')](function(_0x30ff44){_0x2b2562[_0x7f3a('0x2e')]=_0x30ff44;if(_0x5513bf[_0x7f3a('0x3d')][_0x7f3a('0x4d')]){_0x3ecc9d[_0x7f3a('0x4e')]=[{'all':!![]}];}return db[_0x7f3a('0x39')][_0x7f3a('0x4f')](_0x3ecc9d);})[_0x7f3a('0x1f')](function(_0x4f49fb){_0x2b2562[_0x7f3a('0x50')]=_0x4f49fb;return _0x2b2562;})[_0x7f3a('0x1f')](respondWithFilteredResult(_0x47c1b8,_0x3ecc9d))['catch'](handleError(_0x47c1b8,null));};exports[_0x7f3a('0x51')]=function(_0x5d646d,_0x16a81d){var _0x5f30c0={'raw':!![],'where':{'id':_0x5d646d[_0x7f3a('0x52')]['id']}},_0x503524={};_0x503524['model']=_[_0x7f3a('0x3e')](db['FaxMessage'][_0x7f3a('0x3a')]);_0x503524['query']=_['keys'](_0x5d646d['query']);_0x503524['filters']=_['intersection'](_0x503524[_0x7f3a('0x3b')],_0x503524[_0x7f3a('0x3d')]);_0x5f30c0[_0x7f3a('0x41')]=_[_0x7f3a('0x40')](_0x503524['model'],qs[_0x7f3a('0x42')](_0x5d646d[_0x7f3a('0x3d')][_0x7f3a('0x42')]));_0x5f30c0[_0x7f3a('0x41')]=_0x5f30c0[_0x7f3a('0x41')][_0x7f3a('0x43')]?_0x5f30c0['attributes']:_0x503524['model'];if(_0x5d646d[_0x7f3a('0x3d')][_0x7f3a('0x4d')]){_0x5f30c0['include']=[{'all':!![]}];}_0x5f30c0=_[_0x7f3a('0x53')]({},_0x5f30c0,_0x5d646d[_0x7f3a('0x54')]);return db['FaxMessage'][_0x7f3a('0x55')](_0x5f30c0)[_0x7f3a('0x1f')](handleEntityNotFound(_0x16a81d,null))[_0x7f3a('0x1f')](respondWithResult(_0x16a81d,null))['catch'](handleError(_0x16a81d,null));};exports[_0x7f3a('0x34')]=function(_0x3243a8,_0x52e438){if(_0x3243a8[_0x7f3a('0x56')]['id']){delete _0x3243a8[_0x7f3a('0x56')]['id'];}return db[_0x7f3a('0x39')]['find']({'where':{'id':_0x3243a8[_0x7f3a('0x52')]['id']}})[_0x7f3a('0x1f')](handleEntityNotFound(_0x52e438,null))[_0x7f3a('0x1f')](saveUpdates(_0x3243a8['body'],null))['then'](respondWithResult(_0x52e438,null))['catch'](handleError(_0x52e438,null));};exports[_0x7f3a('0x35')]=function(_0x1f7ed4,_0x47bc14){return db[_0x7f3a('0x39')]['find']({'where':{'id':_0x1f7ed4[_0x7f3a('0x52')]['id']}})[_0x7f3a('0x1f')](handleEntityNotFound(_0x47bc14,null))[_0x7f3a('0x1f')](removeEntity(_0x47bc14,null))[_0x7f3a('0x29')](handleError(_0x47bc14,null));};exports[_0x7f3a('0x57')]=function(_0x2b6f50,_0x52d744){return db[_0x7f3a('0x39')][_0x7f3a('0x57')]()['then'](respondWithResult(_0x52d744,null))[_0x7f3a('0x29')](handleError(_0x52d744,null));};var interaction_log=require(_0x7f3a('0x14'))('fax-interactions');exports['accept']=function(_0x378a67,_0x2c1388,_0xf07743){var _0x2e2446={'agent':{},'channel':_0x7f3a('0x58')};if(_0x378a67[_0x7f3a('0x56')]['id']){delete _0x378a67[_0x7f3a('0x56')]['id'];}_0x378a67[_0x7f3a('0x56')]['read']=!![];_0x378a67['body'][_0x7f3a('0x59')]=moment()[_0x7f3a('0x5a')](_0x7f3a('0x5b'));_0x378a67[_0x7f3a('0x56')][_0x7f3a('0x5c')]=_0x378a67[_0x7f3a('0x56')][_0x7f3a('0x5c')]||_0x378a67[_0x7f3a('0x5d')]['id'];_0x2e2446[_0x7f3a('0x5e')]['id']=_0x378a67[_0x7f3a('0x56')][_0x7f3a('0x5c')];return db[_0x7f3a('0x39')]['find']({'where':{'id':_0x378a67[_0x7f3a('0x52')]['id'],'UserId':null}})[_0x7f3a('0x1f')](handleEntityNotFound(_0x2c1388,null))[_0x7f3a('0x1f')](saveUpdates(_0x378a67[_0x7f3a('0x56')],null))['then'](function(_0x3b254a){if(_0x3b254a){_0x2e2446[_0x7f3a('0x27')]=_0x3b254a[_0x7f3a('0x5f')]({'plain':!![]});return db[_0x7f3a('0x60')]['find']({'where':{'id':_0x3b254a[_0x7f3a('0x61')]}});}return null;})[_0x7f3a('0x1f')](handleEntityNotFound(_0x2c1388,null))[_0x7f3a('0x1f')](function(_0x17d079){if(_0x17d079){return _0x17d079['update']({'UserId':_0x378a67[_0x7f3a('0x56')][_0x7f3a('0x5c')],'read1stAt':_[_0x7f3a('0x62')](_0x17d079[_0x7f3a('0x63')])?moment()[_0x7f3a('0x5a')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0x7f3a('0x1f')](function(_0x35780d){if(_0x35780d){_0x2e2446[_0x7f3a('0x64')]=_0x35780d[_0x7f3a('0x5f')]({'plain':!![]});interaction_log['info'](_0x7f3a('0x65'),_0x378a67['user']['id'],_0x378a67[_0x7f3a('0x5d')][_0x7f3a('0x36')],_0x378a67[_0x7f3a('0x5d')][_0x7f3a('0x66')],_0x2e2446[_0x7f3a('0x64')]['id'],_0x378a67[_0x7f3a('0x56')]?JSON[_0x7f3a('0x67')](_0x378a67[_0x7f3a('0x56')]):_0x7f3a('0x68'));return respondWithRpcPromise('AcceptMessage',_0x7f3a('0x69'),_0x2e2446);}return null;})[_0x7f3a('0x1f')](function(_0x11110b){var _0x1169d2=_0x7f3a('0x6a')+_0x11110b[_0x7f3a('0x27')][_0x7f3a('0x6b')];return db['sequelize']['query'](_0x1169d2,{'type':db['Sequelize'][_0x7f3a('0x6c')][_0x7f3a('0x6d')],'raw':!![]})[_0x7f3a('0x1f')](function(_0x481805){return _0x481805;});})[_0x7f3a('0x1f')](function(_0x4381b4){if(_0x4381b4){_0x2e2446['message'][_0x7f3a('0x6e')]=_0x4381b4[0x0];if(!_0x378a67[_0x7f3a('0x56')][_0x7f3a('0x5c')])return;return db[_0x7f3a('0x6f')][_0x7f3a('0x55')]({'where':{'id':_0x378a67[_0x7f3a('0x56')][_0x7f3a('0x5c')],'role':_0x7f3a('0x5e')},'attributes':['id',_0x7f3a('0x36'),'fullname','email','internal'],'raw':!![]});}return null;})[_0x7f3a('0x1f')](function(_0x2c1106){if(!_0x2c1106)return null;_0x2e2446[_0x7f3a('0x27')][_0x7f3a('0x5e')]=_0x2c1106;return _0x2e2446;})[_0x7f3a('0x1f')](function(_0x796c5f){if(_0x796c5f){if(_0x378a67[_0x7f3a('0x56')]['manual']){_0x2e2446[_0x7f3a('0x27')][_0x7f3a('0x70')]=util[_0x7f3a('0x5a')](_0x7f3a('0x71'),_0x378a67[_0x7f3a('0x5d')]['name']);_0x2e2446[_0x7f3a('0x27')][_0x7f3a('0x72')]=_0x2e2446[_0x7f3a('0x72')];_0x2e2446['message'][_0x7f3a('0x73')]=_0x2e2446['channel'];_0x2e2446[_0x7f3a('0x27')][_0x7f3a('0x74')]=_0x7f3a('0x75');return respondWithRpcPromise(_0x7f3a('0x76'),_0x7f3a('0x76'),{'event':_0x7f3a('0x77'),'message':_0x2e2446['message']},client9002)[_0x7f3a('0x1f')](function(){return _0x2e2446;});}return _0x2e2446;}return null;})[_0x7f3a('0x1f')](respondWithResult(_0x2c1388,null))[_0x7f3a('0x29')](handleError(_0x2c1388,null));};var interaction_log=require('../../config/logger')(_0x7f3a('0x78'));exports[_0x7f3a('0x32')]=function(_0x2d8091,_0x26d9cf,_0x2816d0){var _0x2e5fc6={'agent':{},'channel':_0x7f3a('0x58')};if(_0x2d8091[_0x7f3a('0x56')]['id']){delete _0x2d8091['body']['id'];}_0x2d8091['body']['UserId']=_0x2d8091['body'][_0x7f3a('0x5c')]||_0x2d8091[_0x7f3a('0x5d')]['id'];_0x2e5fc6[_0x7f3a('0x5e')]['id']=_0x2d8091['body']['UserId'];return db[_0x7f3a('0x39')][_0x7f3a('0x55')]({'where':{'id':_0x2d8091['params']['id'],'UserId':null}})[_0x7f3a('0x1f')](handleEntityNotFound(_0x26d9cf,null))[_0x7f3a('0x1f')](function(_0x1b70af){if(_0x1b70af){_0x2e5fc6[_0x7f3a('0x27')]=_0x1b70af['get']({'plain':!![]});return db[_0x7f3a('0x60')][_0x7f3a('0x55')]({'where':{'id':_0x1b70af['FaxInteractionId']}});}return null;})[_0x7f3a('0x1f')](handleEntityNotFound(_0x26d9cf,null))[_0x7f3a('0x1f')](function(_0xa9761b){if(_0xa9761b){_0x2e5fc6[_0x7f3a('0x64')]=_0xa9761b[_0x7f3a('0x5f')]({'plain':!![]});interaction_log['info'](_0x7f3a('0x79'),_0x2d8091[_0x7f3a('0x5d')]['id'],_0x2d8091[_0x7f3a('0x5d')][_0x7f3a('0x36')],_0x2d8091[_0x7f3a('0x5d')]['role'],_0x2e5fc6['interaction']['id'],_0x2d8091[_0x7f3a('0x56')]?JSON[_0x7f3a('0x67')](_0x2d8091[_0x7f3a('0x56')]):_0x7f3a('0x68'));return respondWithRpcPromise(_0x7f3a('0x7a'),_0x7f3a('0x7b'),_0x2e5fc6);}return null;})[_0x7f3a('0x1f')](function(_0x3f90e6){var _0x393a65=_0x7f3a('0x6a')+_0x3f90e6[_0x7f3a('0x27')][_0x7f3a('0x6b')];return db[_0x7f3a('0x7c')][_0x7f3a('0x3d')](_0x393a65,{'type':db[_0x7f3a('0x7d')][_0x7f3a('0x6c')][_0x7f3a('0x6d')],'raw':!![]})[_0x7f3a('0x1f')](function(_0x254f73){return _0x254f73;});})[_0x7f3a('0x1f')](function(_0x47c186){if(_0x47c186){_0x2e5fc6[_0x7f3a('0x27')]['contact']=_0x47c186[0x0];if(!_0x2d8091[_0x7f3a('0x56')]['UserId'])return;return db[_0x7f3a('0x6f')][_0x7f3a('0x55')]({'where':{'id':_0x2d8091[_0x7f3a('0x56')][_0x7f3a('0x5c')],'role':'agent'},'attributes':['id',_0x7f3a('0x36'),'fullname',_0x7f3a('0x7e'),_0x7f3a('0x7f')],'raw':!![]});}return null;})[_0x7f3a('0x1f')](function(_0x516f5f){if(!_0x516f5f)return null;_0x2e5fc6['message'][_0x7f3a('0x5e')]=_0x516f5f;return _0x2e5fc6;})[_0x7f3a('0x1f')](function(_0x51203f){if(_0x51203f){_0x51203f[_0x7f3a('0x27')][_0x7f3a('0x70')]=util[_0x7f3a('0x5a')](_0x7f3a('0x71'),_0x2d8091[_0x7f3a('0x5d')][_0x7f3a('0x36')]);_0x51203f[_0x7f3a('0x27')][_0x7f3a('0x72')]=_0x2e5fc6[_0x7f3a('0x72')];_0x51203f['message'][_0x7f3a('0x73')]=_0x2e5fc6[_0x7f3a('0x72')];_0x51203f['message']['event']=_0x7f3a('0x32');respondWithRpcPromise(_0x7f3a('0x76'),_0x7f3a('0x76'),{'event':_0x7f3a('0x80'),'message':_0x51203f[_0x7f3a('0x27')]},client9002);return _0x2e5fc6;}return null;})[_0x7f3a('0x1f')](respondWithResult(_0x26d9cf,null))['catch'](handleError(_0x26d9cf,null));};exports[_0x7f3a('0x81')]=function(_0xd62bc6,_0x1e64ad){var _0x44dfcb;return db['FaxMessage'][_0x7f3a('0x81')](_0xd62bc6['body'],{})[_0x7f3a('0x1f')](function(_0x2b9ac6){_0x44dfcb=_0x2b9ac6;return db[_0x7f3a('0x82')][_0x7f3a('0x83')]({'where':{'id':_0x44dfcb['ContactId']}});})[_0x7f3a('0x1f')](function(_0x446119){if(_[_0x7f3a('0x62')](_0x446119)){return;}else{_0x44dfcb[_0x7f3a('0x58')]=_0x446119[_0x7f3a('0x58')];return db[_0x7f3a('0x84')][_0x7f3a('0x83')]({'where':{'id':_0x44dfcb[_0x7f3a('0x85')]}});}})['then'](function(_0x2dfeb6){return respondWithRpcPromise(_0x7f3a('0x86'),'SendFax',{'FaxAccountId':_[_0x7f3a('0x62')](_0xd62bc6['body'])?undefined:_0xd62bc6[_0x7f3a('0x56')][_0x7f3a('0x87')],'path':_[_0x7f3a('0x62')](_0x2dfeb6)?undefined:util[_0x7f3a('0x5a')](_0x7f3a('0x88'),_0x2dfeb6[_0x7f3a('0x89')]),'fax':_[_0x7f3a('0x62')](_0x44dfcb['fax'])?undefined:_0x44dfcb[_0x7f3a('0x58')],'AttachmentId':_0x44dfcb[_0x7f3a('0x85')]},client9002);})['then'](respondWithResult(_0x1e64ad,0xc9))['catch'](handleError(_0x1e64ad,null));};exports[_0x7f3a('0x8a')]=function(_0x51b41a,_0x494741){var _0x1c4ba8=path[_0x7f3a('0x8b')](config[_0x7f3a('0x8c')],'server',_0x7f3a('0x8d'),'attachments');return db[_0x7f3a('0x39')]['find']({'where':{'id':_0x51b41a[_0x7f3a('0x52')]['id']},'include':[{'model':db['Attachment'],'as':_0x7f3a('0x84')}]})[_0x7f3a('0x1f')](handleEntityNotFound(_0x494741,null))['then'](function(_0x2e64f1){if(_0x2e64f1){return _0x494741[_0x7f3a('0x8a')](path[_0x7f3a('0x8b')](_0x1c4ba8,_0x2e64f1[_0x7f3a('0x84')][_0x7f3a('0x89')]));}})[_0x7f3a('0x29')](handleError(_0x494741,null));}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.events.js b/server/api/faxMessage/faxMessage.events.js index aabb6d6..5ab08d3 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 _0x9134=['hook','exports','../../mysqldb','FaxMessage','setMaxListeners','save','emit'];(function(_0xb24a3e,_0x4a3594){var _0x4038d7=function(_0x1ea3c3){while(--_0x1ea3c3){_0xb24a3e['push'](_0xb24a3e['shift']());}};_0x4038d7(++_0x4a3594);}(_0x9134,0x87));var _0x4913=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x9134[_0x2dafbe];return _0x58a45a;};'use strict';var EventEmitter=require('events');var FaxMessage=require(_0x4913('0x0'))['db'][_0x4913('0x1')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0x4913('0x2')](0x0);var events={'afterCreate':_0x4913('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x352f58){return function(_0x488795,_0x367836,_0x349c8c){FaxMessageEvents[_0x4913('0x4')](_0x352f58+':'+_0x488795['id'],_0x488795);FaxMessageEvents[_0x4913('0x4')](_0x352f58,_0x488795);_0x349c8c(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxMessage[_0x4913('0x5')](e,emitEvent(event));}}module[_0x4913('0x6')]=FaxMessageEvents; \ No newline at end of file +var _0xdbb9=['save','remove','emit','exports','../../mysqldb','FaxMessage','setMaxListeners'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xdbb9,0xf9));var _0x9dbb=function(_0x556313,_0x5590af){_0x556313=_0x556313-0x0;var _0x25854a=_0xdbb9[_0x556313];return _0x25854a;};'use strict';var EventEmitter=require('events');var FaxMessage=require(_0x9dbb('0x0'))['db'][_0x9dbb('0x1')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0x9dbb('0x2')](0x0);var events={'afterCreate':_0x9dbb('0x3'),'afterUpdate':'update','afterDestroy':_0x9dbb('0x4')};function emitEvent(_0x3a95f2){return function(_0x19ebd7,_0x3b4460,_0xb960a5){FaxMessageEvents[_0x9dbb('0x5')](_0x3a95f2+':'+_0x19ebd7['id'],_0x19ebd7);FaxMessageEvents['emit'](_0x3a95f2,_0x19ebd7);_0xb960a5(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxMessage['hook'](e,emitEvent(event));}}module[_0x9dbb('0x6')]=FaxMessageEvents; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.model.js b/server/api/faxMessage/faxMessage.model.js index b8fd84a..d6f1823 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 _0xde51=['FULLTEXT','models','get','direction','toLowerCase','out','isNil','UserId','FaxInteraction','FaxInteractionId','then','update','catch','error','utf8mb4','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./faxMessage.attributes','exports','define','FaxMessage','fax_messages','fti_fax_messages','body'];(function(_0x122ac4,_0x125911){var _0x7df91=function(_0xb88cca){while(--_0xb88cca){_0x122ac4['push'](_0x122ac4['shift']());}};_0x7df91(++_0x125911);}(_0xde51,0xaa));var _0x1de5=function(_0x2b0275,_0x3fe1fe){_0x2b0275=_0x2b0275-0x0;var _0x43708e=_0xde51[_0x2b0275];return _0x43708e;};'use strict';var _=require(_0x1de5('0x0'));var util=require(_0x1de5('0x1'));var logger=require(_0x1de5('0x2'))(_0x1de5('0x3'));var moment=require(_0x1de5('0x4'));var BPromise=require(_0x1de5('0x5'));var rp=require(_0x1de5('0x6'));var fs=require('fs');var path=require(_0x1de5('0x7'));var rimraf=require('rimraf');var config=require(_0x1de5('0x8'));var attributes=require(_0x1de5('0x9'));module[_0x1de5('0xa')]=function(_0x5d8c63,_0x5b1bc6){return _0x5d8c63[_0x1de5('0xb')](_0x1de5('0xc'),attributes,{'tableName':_0x1de5('0xd'),'paranoid':![],'indexes':[{'name':_0x1de5('0xe'),'fields':[_0x1de5('0xf')],'type':_0x1de5('0x10')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x526863,_0x1378ca,_0x206776){var _0x113e9c=_0x5d8c63[_0x1de5('0x11')];var _0x1d6667=_0x526863[_0x1de5('0x12')]({'plain':!![]});if(_0x1d6667['direction']['toLowerCase']()==='in'||_0x1d6667[_0x1de5('0x13')][_0x1de5('0x14')]()===_0x1de5('0x15')&&!_0x1d6667['secret']&&!_[_0x1de5('0x16')](_0x1d6667[_0x1de5('0x17')])){_0x113e9c[_0x1de5('0x18')]['findOne']({'where':{'id':_0x1d6667[_0x1de5('0x19')]}})[_0x1de5('0x1a')](function(_0x3b6baa){if(_0x3b6baa){_0x3b6baa[_0x1de5('0x1b')]({'lastMsgAt':_0x1d6667['createdAt'],'lastMsgDirection':_0x1d6667[_0x1de5('0x13')]['toLowerCase']()});}})[_0x1de5('0x1c')](function(_0x3c1a94){console[_0x1de5('0x1d')](_0x3c1a94);});}_0x206776();}},'charset':_0x1de5('0x1e'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xbe3f=['utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','./faxMessage.attributes','define','FaxMessage','fax_messages','fti_fax_messages','body','FULLTEXT','models','get','direction','toLowerCase','secret','isNil','UserId','FaxInteraction','FaxInteractionId','then','update','createdAt','catch','error'];(function(_0x104a84,_0x285970){var _0x4973ff=function(_0x5064e7){while(--_0x5064e7){_0x104a84['push'](_0x104a84['shift']());}};_0x4973ff(++_0x285970);}(_0xbe3f,0x195));var _0xfbe3=function(_0x4ef351,_0x10eb1f){_0x4ef351=_0x4ef351-0x0;var _0x4dcb59=_0xbe3f[_0x4ef351];return _0x4dcb59;};'use strict';var _=require(_0xfbe3('0x0'));var util=require(_0xfbe3('0x1'));var logger=require(_0xfbe3('0x2'))('api');var moment=require(_0xfbe3('0x3'));var BPromise=require(_0xfbe3('0x4'));var rp=require(_0xfbe3('0x5'));var fs=require('fs');var path=require(_0xfbe3('0x6'));var rimraf=require('rimraf');var config=require(_0xfbe3('0x7'));var attributes=require(_0xfbe3('0x8'));module['exports']=function(_0x3a48bf,_0x43e836){return _0x3a48bf[_0xfbe3('0x9')](_0xfbe3('0xa'),attributes,{'tableName':_0xfbe3('0xb'),'paranoid':![],'indexes':[{'name':_0xfbe3('0xc'),'fields':[_0xfbe3('0xd')],'type':_0xfbe3('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x18ca31,_0x3ed044,_0x33cab2){var _0x3bd4df=_0x3a48bf[_0xfbe3('0xf')];var _0x52d6af=_0x18ca31[_0xfbe3('0x10')]({'plain':!![]});if(_0x52d6af[_0xfbe3('0x11')][_0xfbe3('0x12')]()==='in'||_0x52d6af['direction']['toLowerCase']()==='out'&&!_0x52d6af[_0xfbe3('0x13')]&&!_[_0xfbe3('0x14')](_0x52d6af[_0xfbe3('0x15')])){_0x3bd4df[_0xfbe3('0x16')]['findOne']({'where':{'id':_0x52d6af[_0xfbe3('0x17')]}})[_0xfbe3('0x18')](function(_0x466a31){if(_0x466a31){_0x466a31[_0xfbe3('0x19')]({'lastMsgAt':_0x52d6af[_0xfbe3('0x1a')],'lastMsgDirection':_0x52d6af['direction'][_0xfbe3('0x12')]()});}})[_0xfbe3('0x1b')](function(_0x4e8cff){console[_0xfbe3('0x1c')](_0x4e8cff);});}_0x33cab2();}},'charset':_0xfbe3('0x1d'),'collate':_0xfbe3('0x1e')});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.rpc.js b/server/api/faxMessage/faxMessage.rpc.js index e627e76..04b17c2 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 _0xa8a8=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','request','then','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','FaxMessage','create','body','options','raw','CreateFaxMessage','UpdateFaxMessage','where','attributes','limit','lodash','util','moment','bluebird'];(function(_0x513aa5,_0x1fba79){var _0x1a1a7c=function(_0x240e3f){while(--_0x240e3f){_0x513aa5['push'](_0x513aa5['shift']());}};_0x1a1a7c(++_0x1fba79);}(_0xa8a8,0xec));var _0x8a8a=function(_0x10c7a7,_0x14e5b3){_0x10c7a7=_0x10c7a7-0x0;var _0x202069=_0xa8a8[_0x10c7a7];return _0x202069;};'use strict';var _=require(_0x8a8a('0x0'));var util=require(_0x8a8a('0x1'));var moment=require(_0x8a8a('0x2'));var BPromise=require(_0x8a8a('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8a8a('0x4'));var db=require(_0x8a8a('0x5'))['db'];var utils=require(_0x8a8a('0x6'));var logger=require(_0x8a8a('0x7'))(_0x8a8a('0x8'));var config=require(_0x8a8a('0x9'));var jayson=require(_0x8a8a('0xa'));var client=jayson[_0x8a8a('0xb')][_0x8a8a('0xc')]({'port':0x232a});config[_0x8a8a('0xd')]=_[_0x8a8a('0xe')](config[_0x8a8a('0xd')],{'host':_0x8a8a('0xf'),'port':0x18eb});var socket=require(_0x8a8a('0x10'))(new Redis(config[_0x8a8a('0xd')]));require('./faxMessage.socket')['register'](socket);function respondWithRpcPromise(_0x3c01cd,_0x497b8a,_0x11788d){return new BPromise(function(_0x3d3a00,_0x532621){return client[_0x8a8a('0x11')](_0x3c01cd,_0x11788d)[_0x8a8a('0x12')](function(_0xb13fca){logger['info'](_0x8a8a('0x13'),_0x497b8a,_0x8a8a('0x14'));logger[_0x8a8a('0x15')](_0x8a8a('0x16'),_0x497b8a,'request\x20sent',JSON[_0x8a8a('0x17')](_0xb13fca));if(_0xb13fca['error']){if(_0xb13fca[_0x8a8a('0x18')][_0x8a8a('0x19')]===0x1f4){logger[_0x8a8a('0x18')](_0x8a8a('0x13'),_0x497b8a,_0xb13fca[_0x8a8a('0x18')][_0x8a8a('0x1a')]);return _0x532621(_0xb13fca[_0x8a8a('0x18')]['message']);}logger[_0x8a8a('0x18')]('FaxMessage,\x20%s,\x20%s',_0x497b8a,_0xb13fca[_0x8a8a('0x18')][_0x8a8a('0x1a')]);return _0x3d3a00(_0xb13fca[_0x8a8a('0x18')][_0x8a8a('0x1a')]);}else{logger[_0x8a8a('0x1b')]('FaxMessage,\x20%s,\x20%s',_0x497b8a,_0x8a8a('0x14'));_0x3d3a00(_0xb13fca[_0x8a8a('0x1c')][_0x8a8a('0x1a')]);}})[_0x8a8a('0x1d')](function(_0x299827){logger[_0x8a8a('0x18')]('FaxMessage,\x20%s,\x20%s',_0x497b8a,_0x299827);_0x532621(_0x299827);});});}exports['CreateFaxMessage']=function(_0x5181b2){var _0x4e3d0a=this;return new Promise(function(_0x4a6601,_0x3a9b2f){return db[_0x8a8a('0x1e')][_0x8a8a('0x1f')](_0x5181b2[_0x8a8a('0x20')],{'raw':_0x5181b2[_0x8a8a('0x21')]?_0x5181b2[_0x8a8a('0x21')][_0x8a8a('0x22')]===undefined?!![]:![]:!![]})[_0x8a8a('0x12')](function(_0x25d5d4){logger[_0x8a8a('0x1b')](_0x8a8a('0x23'),_0x5181b2);logger[_0x8a8a('0x15')](_0x8a8a('0x23'),_0x5181b2,JSON[_0x8a8a('0x17')](_0x25d5d4));_0x4a6601(_0x25d5d4);})[_0x8a8a('0x1d')](function(_0x545a38){logger[_0x8a8a('0x18')](_0x8a8a('0x23'),_0x545a38[_0x8a8a('0x1a')],_0x5181b2);_0x3a9b2f(_0x4e3d0a[_0x8a8a('0x18')](0x1f4,_0x545a38[_0x8a8a('0x1a')]));});});};exports[_0x8a8a('0x24')]=function(_0x3aa46d){var _0x5f4dcc=this;return new Promise(function(_0x31d21a,_0x38c1e0){return db[_0x8a8a('0x1e')]['update'](_0x3aa46d['body'],{'raw':_0x3aa46d[_0x8a8a('0x21')]?_0x3aa46d[_0x8a8a('0x21')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3aa46d['options']?_0x3aa46d['options'][_0x8a8a('0x25')]||null:null,'attributes':_0x3aa46d['options']?_0x3aa46d[_0x8a8a('0x21')][_0x8a8a('0x26')]||null:null,'limit':_0x3aa46d['options']?_0x3aa46d[_0x8a8a('0x21')][_0x8a8a('0x27')]||null:null})[_0x8a8a('0x12')](function(_0x8df0cb){logger[_0x8a8a('0x1b')](_0x8a8a('0x24'),_0x3aa46d);logger[_0x8a8a('0x15')](_0x8a8a('0x24'),_0x3aa46d,JSON['stringify'](_0x8df0cb));_0x31d21a(_0x8df0cb);})['catch'](function(_0x56e79e){logger[_0x8a8a('0x18')](_0x8a8a('0x24'),_0x56e79e['message'],_0x3aa46d);_0x38c1e0(_0x5f4dcc[_0x8a8a('0x18')](0x1f4,_0x56e79e[_0x8a8a('0x1a')]));});});}; \ No newline at end of file +var _0x5636=['error','code','message','result','CreateFaxMessage','FaxMessage','body','options','then','UpdateFaxMessage','update','where','catch','lodash','util','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./faxMessage.socket','register','info','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x8014d8,_0x134a36){var _0x581b7b=function(_0x45c7ce){while(--_0x45c7ce){_0x8014d8['push'](_0x8014d8['shift']());}};_0x581b7b(++_0x134a36);}(_0x5636,0x102));var _0x6563=function(_0x47511a,_0x16d40a){_0x47511a=_0x47511a-0x0;var _0x5bbc4b=_0x5636[_0x47511a];return _0x5bbc4b;};'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});config[_0x6563('0xa')]=_[_0x6563('0xb')](config[_0x6563('0xa')],{'host':_0x6563('0xc'),'port':0x18eb});var socket=require(_0x6563('0xd'))(new Redis(config[_0x6563('0xa')]));require(_0x6563('0xe'))[_0x6563('0xf')](socket);function respondWithRpcPromise(_0x516d1a,_0x51fdc2,_0x2946f3){return new BPromise(function(_0x129fa3,_0x490a56){return client['request'](_0x516d1a,_0x2946f3)['then'](function(_0x1ef002){logger[_0x6563('0x10')](_0x6563('0x11'),_0x51fdc2,_0x6563('0x12'));logger[_0x6563('0x13')](_0x6563('0x14'),_0x51fdc2,_0x6563('0x12'),JSON[_0x6563('0x15')](_0x1ef002));if(_0x1ef002[_0x6563('0x16')]){if(_0x1ef002['error'][_0x6563('0x17')]===0x1f4){logger['error'](_0x6563('0x11'),_0x51fdc2,_0x1ef002[_0x6563('0x16')][_0x6563('0x18')]);return _0x490a56(_0x1ef002[_0x6563('0x16')]['message']);}logger[_0x6563('0x16')](_0x6563('0x11'),_0x51fdc2,_0x1ef002[_0x6563('0x16')][_0x6563('0x18')]);return _0x129fa3(_0x1ef002['error'][_0x6563('0x18')]);}else{logger['info']('FaxMessage,\x20%s,\x20%s',_0x51fdc2,'request\x20sent');_0x129fa3(_0x1ef002[_0x6563('0x19')]['message']);}})['catch'](function(_0x27651b){logger[_0x6563('0x16')](_0x6563('0x11'),_0x51fdc2,_0x27651b);_0x490a56(_0x27651b);});});}exports[_0x6563('0x1a')]=function(_0xf8b544){var _0x10811d=this;return new Promise(function(_0x37ba3,_0x93a45){return db[_0x6563('0x1b')]['create'](_0xf8b544[_0x6563('0x1c')],{'raw':_0xf8b544[_0x6563('0x1d')]?_0xf8b544[_0x6563('0x1d')]['raw']===undefined?!![]:![]:!![]})[_0x6563('0x1e')](function(_0x5c37bb){logger[_0x6563('0x10')](_0x6563('0x1a'),_0xf8b544);logger['debug']('CreateFaxMessage',_0xf8b544,JSON[_0x6563('0x15')](_0x5c37bb));_0x37ba3(_0x5c37bb);})['catch'](function(_0x1097d0){logger[_0x6563('0x16')](_0x6563('0x1a'),_0x1097d0['message'],_0xf8b544);_0x93a45(_0x10811d[_0x6563('0x16')](0x1f4,_0x1097d0['message']));});});};exports[_0x6563('0x1f')]=function(_0x1590e6){var _0x5e5aeb=this;return new Promise(function(_0x365b16,_0x28252d){return db['FaxMessage'][_0x6563('0x20')](_0x1590e6['body'],{'raw':_0x1590e6[_0x6563('0x1d')]?_0x1590e6['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1590e6[_0x6563('0x1d')]?_0x1590e6[_0x6563('0x1d')][_0x6563('0x21')]||null:null,'attributes':_0x1590e6[_0x6563('0x1d')]?_0x1590e6[_0x6563('0x1d')]['attributes']||null:null,'limit':_0x1590e6[_0x6563('0x1d')]?_0x1590e6['options']['limit']||null:null})[_0x6563('0x1e')](function(_0x35af37){logger[_0x6563('0x10')](_0x6563('0x1f'),_0x1590e6);logger[_0x6563('0x13')](_0x6563('0x1f'),_0x1590e6,JSON[_0x6563('0x15')](_0x35af37));_0x365b16(_0x35af37);})[_0x6563('0x22')](function(_0x101b24){logger[_0x6563('0x16')]('UpdateFaxMessage',_0x101b24[_0x6563('0x18')],_0x1590e6);_0x28252d(_0x5e5aeb[_0x6563('0x16')](0x1f4,_0x101b24[_0x6563('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.socket.js b/server/api/faxMessage/faxMessage.socket.js index b1dc7c2..73d1d47 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 _0xe768=['remove','update','removeListener','register','faxMessage:','./faxMessage.events','save'];(function(_0xfae495,_0x1934ab){var _0x562791=function(_0x4d7698){while(--_0x4d7698){_0xfae495['push'](_0xfae495['shift']());}};_0x562791(++_0x1934ab);}(_0xe768,0x1e1));var _0x8e76=function(_0x42a404,_0x89d6bf){_0x42a404=_0x42a404-0x0;var _0x39e8a3=_0xe768[_0x42a404];return _0x39e8a3;};'use strict';var FaxMessageEvents=require(_0x8e76('0x0'));var events=[_0x8e76('0x1'),_0x8e76('0x2'),_0x8e76('0x3')];function createListener(_0x1af684,_0x154907){return function(_0x52a933){_0x154907['emit'](_0x1af684,_0x52a933);};}function removeListener(_0x461bc4,_0x2b67cc){return function(){FaxMessageEvents[_0x8e76('0x4')](_0x461bc4,_0x2b67cc);};}exports[_0x8e76('0x5')]=function(_0x42d4c9){for(var _0x4838ca=0x0,_0x5189d9=events['length'];_0x4838ca<_0x5189d9;_0x4838ca++){var _0x332667=events[_0x4838ca];var _0x4675ce=createListener(_0x8e76('0x6')+_0x332667,_0x42d4c9);FaxMessageEvents['on'](_0x332667,_0x4675ce);}}; \ No newline at end of file +var _0xc44a=['./faxMessage.events','save','remove','update','emit','removeListener','register','length','faxMessage:'];(function(_0x35eace,_0x152807){var _0x491a33=function(_0x22b90a){while(--_0x22b90a){_0x35eace['push'](_0x35eace['shift']());}};_0x491a33(++_0x152807);}(_0xc44a,0x129));var _0xac44=function(_0x297fd3,_0x115406){_0x297fd3=_0x297fd3-0x0;var _0x2af381=_0xc44a[_0x297fd3];return _0x2af381;};'use strict';var FaxMessageEvents=require(_0xac44('0x0'));var events=[_0xac44('0x1'),_0xac44('0x2'),_0xac44('0x3')];function createListener(_0x316a79,_0x42ee13){return function(_0xdcbabf){_0x42ee13[_0xac44('0x4')](_0x316a79,_0xdcbabf);};}function removeListener(_0x26224e,_0x2b12e6){return function(){FaxMessageEvents[_0xac44('0x5')](_0x26224e,_0x2b12e6);};}exports[_0xac44('0x6')]=function(_0x47f594){for(var _0x512345=0x0,_0x378613=events[_0xac44('0x7')];_0x512345<_0x378613;_0x512345++){var _0x239d0f=events[_0x512345];var _0xeb6dd6=createListener(_0xac44('0x8')+_0x239d0f,_0x47f594);FaxMessageEvents['on'](_0x239d0f,_0xeb6dd6);}}; \ No newline at end of file diff --git a/server/api/faxMessage/index.js b/server/api/faxMessage/index.js index 39aabb4..41f6cd6 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 _0x0102=['show','/:id/download','download','post','tracked','fax','faxmessage:create','create','put','/:id','update','accept','/:id/reject','reject','exports','util','path','connect-timeout','express','./faxMessage.controller','get','isAuthenticated','index','/describe','describe'];(function(_0x19159a,_0x1cb5c3){var _0xa677f4=function(_0x24bb85){while(--_0x24bb85){_0x19159a['push'](_0x19159a['shift']());}};_0xa677f4(++_0x1cb5c3);}(_0x0102,0x186));var _0x2010=function(_0x25f665,_0xa2e787){_0x25f665=_0x25f665-0x0;var _0xcc6a05=_0x0102[_0x25f665];return _0xcc6a05;};'use strict';var multer=require('multer');var util=require(_0x2010('0x0'));var path=require(_0x2010('0x1'));var timeout=require(_0x2010('0x2'));var express=require(_0x2010('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x2010('0x4'));router[_0x2010('0x5')]('/',auth[_0x2010('0x6')](),controller[_0x2010('0x7')]);router['get'](_0x2010('0x8'),auth['isAuthenticated'](),controller[_0x2010('0x9')]);router[_0x2010('0x5')]('/:id',auth[_0x2010('0x6')](),controller[_0x2010('0xa')]);router[_0x2010('0x5')](_0x2010('0xb'),auth[_0x2010('0x6')](),controller[_0x2010('0xc')]);router[_0x2010('0xd')]('/',auth[_0x2010('0x6')](),interaction[_0x2010('0xe')](_0x2010('0xf'),_0x2010('0x10')),controller[_0x2010('0x11')]);router[_0x2010('0x12')](_0x2010('0x13'),auth[_0x2010('0x6')](),controller[_0x2010('0x14')]);router['put']('/:id/accept',auth[_0x2010('0x6')](),controller[_0x2010('0x15')]);router[_0x2010('0x12')](_0x2010('0x16'),auth[_0x2010('0x6')](),controller[_0x2010('0x17')]);router['delete'](_0x2010('0x13'),auth[_0x2010('0x6')](),controller['destroy']);module[_0x2010('0x18')]=router; \ No newline at end of file +var _0xb332=['exports','multer','path','connect-timeout','Router','../../components/auth/service','../../config/environment','get','isAuthenticated','index','describe','/:id','show','download','post','tracked','fax','faxmessage:create','create','put','/:id/accept','reject','delete','destroy'];(function(_0x68c979,_0x431cff){var _0x4f0001=function(_0xa7595d){while(--_0xa7595d){_0x68c979['push'](_0x68c979['shift']());}};_0x4f0001(++_0x431cff);}(_0xb332,0xd9));var _0x2b33=function(_0x32729c,_0xf5afd8){_0x32729c=_0x32729c-0x0;var _0x482cfd=_0xb332[_0x32729c];return _0x482cfd;};'use strict';var multer=require(_0x2b33('0x0'));var util=require('util');var path=require(_0x2b33('0x1'));var timeout=require(_0x2b33('0x2'));var express=require('express');var router=express[_0x2b33('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x2b33('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x2b33('0x5'));var controller=require('./faxMessage.controller');router[_0x2b33('0x6')]('/',auth[_0x2b33('0x7')](),controller[_0x2b33('0x8')]);router[_0x2b33('0x6')]('/describe',auth['isAuthenticated'](),controller[_0x2b33('0x9')]);router['get'](_0x2b33('0xa'),auth[_0x2b33('0x7')](),controller[_0x2b33('0xb')]);router[_0x2b33('0x6')]('/:id/download',auth[_0x2b33('0x7')](),controller[_0x2b33('0xc')]);router[_0x2b33('0xd')]('/',auth[_0x2b33('0x7')](),interaction[_0x2b33('0xe')](_0x2b33('0xf'),_0x2b33('0x10')),controller[_0x2b33('0x11')]);router[_0x2b33('0x12')](_0x2b33('0xa'),auth[_0x2b33('0x7')](),controller['update']);router[_0x2b33('0x12')](_0x2b33('0x13'),auth[_0x2b33('0x7')](),controller['accept']);router[_0x2b33('0x12')]('/:id/reject',auth[_0x2b33('0x7')](),controller[_0x2b33('0x14')]);router[_0x2b33('0x15')]('/:id',auth['isAuthenticated'](),controller[_0x2b33('0x16')]);module[_0x2b33('0x17')]=router; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.attributes.js b/server/api/faxQueue/faxQueue.attributes.js index 5313f9f..ee3059c 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 _0xf069=['beepall','roundrobin','sequelize','exports','STRING','name','INTEGER','ENUM'];(function(_0x2070da,_0x45e586){var _0x4f9fe1=function(_0x5b6f2a){while(--_0x5b6f2a){_0x2070da['push'](_0x2070da['shift']());}};_0x4f9fe1(++_0x45e586);}(_0xf069,0x1ca));var _0x9f06=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf069[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x9f06('0x0'));module[_0x9f06('0x1')]={'name':{'type':Sequelize[_0x9f06('0x2')],'unique':_0x9f06('0x3'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x9f06('0x2')]},'timeout':{'type':Sequelize[_0x9f06('0x4')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x9f06('0x5')]('rrmemory',_0x9f06('0x6'),_0x9f06('0x7')),'allowNull':![]},'lastAgent':{'type':Sequelize[_0x9f06('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0xa342=['name','ENUM','INTEGER','exports','STRING'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xa342,0x99));var _0x2a34=function(_0x486615,_0x4c0f28){_0x486615=_0x486615-0x0;var _0x29f93f=_0xa342[_0x486615];return _0x29f93f;};'use strict';var Sequelize=require('sequelize');module[_0x2a34('0x0')]={'name':{'type':Sequelize[_0x2a34('0x1')],'unique':_0x2a34('0x2'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x2a34('0x1')]},'timeout':{'type':Sequelize['INTEGER'],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x2a34('0x3')]('rrmemory','beepall','roundrobin'),'allowNull':![]},'lastAgent':{'type':Sequelize[_0x2a34('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 6f24d86..2d42508 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 _0x41cd=['isEmpty','removeAgents','forEach','userFaxQueue:remove','addAgents','omit','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','jsforce','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./faxQueue.socket','register','sendStatus','status','end','json','offset','undefined','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','error','stack','name','index','map','FaxQueue','rawAttributes','type','key','model','query','keys','filters','intersection','fields','attributes','length','nolimit','sort','where','pick','filter','merge','options','count','include','show','includeAll','find','catch','create','body','user','role','FaxQueues','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','findOne','order','FaxQueueId','UserFaxQueue','findAll','findAndCountAll','UserId','agent','faxPause','rows','format','%s/%s','SIP','createdAt','updatedAt','getTeams','Team','hasOwnProperty','addTeams','ids','User','online','voicePause','interface','flatMap','Agents','sequelize','transaction','each','findOrCreate','emit','userFaxQueue:save','removeTeams','select','tq.TeamId','from','team_has_fax_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','FaxQueueId\x20=\x20?','push','toString','QueryTypes','SELECT','TeamId','all','union','compact','value'];(function(_0x5b14da,_0x287e59){var _0x5589b9=function(_0x3d3137){while(--_0x3d3137){_0x5b14da['push'](_0x5b14da['shift']());}};_0x5589b9(++_0x287e59);}(_0x41cd,0x97));var _0xd41c=function(_0x1903aa,_0x343458){_0x1903aa=_0x1903aa-0x0;var _0x51fe28=_0x41cd[_0x1903aa];return _0x51fe28;};'use strict';var emlformat=require(_0xd41c('0x0'));var rimraf=require(_0xd41c('0x1'));var zipdir=require(_0xd41c('0x2'));var jsonpatch=require(_0xd41c('0x3'));var rp=require(_0xd41c('0x4'));var moment=require(_0xd41c('0x5'));var BPromise=require(_0xd41c('0x6'));var Mustache=require(_0xd41c('0x7'));var util=require(_0xd41c('0x8'));var path=require(_0xd41c('0x9'));var sox=require('sox');var csv=require(_0xd41c('0xa'));var ejs=require(_0xd41c('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xd41c('0xc'));var squel=require(_0xd41c('0xd'));var crypto=require('crypto');var jsforce=require(_0xd41c('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xd41c('0xf'));var Redis=require(_0xd41c('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xd41c('0x11'));var as=require(_0xd41c('0x12'));var hardwareService=require(_0xd41c('0x13'));var logger=require(_0xd41c('0x14'))(_0xd41c('0x15'));var utils=require(_0xd41c('0x16'));var config=require(_0xd41c('0x17'));var licenseUtil=require(_0xd41c('0x18'));var db=require(_0xd41c('0x19'))['db'];config[_0xd41c('0x1a')]=_['defaults'](config[_0xd41c('0x1a')],{'host':_0xd41c('0x1b'),'port':0x18eb});var socket=require(_0xd41c('0x1c'))(new Redis(config[_0xd41c('0x1a')]));require(_0xd41c('0x1d'))[_0xd41c('0x1e')](socket);function respondWithStatusCode(_0x196e1f,_0x1abb1f){_0x1abb1f=_0x1abb1f||0xcc;return function(_0x5aa6d5){if(_0x5aa6d5){return _0x196e1f[_0xd41c('0x1f')](_0x1abb1f);}return _0x196e1f[_0xd41c('0x20')](_0x1abb1f)[_0xd41c('0x21')]();};}function respondWithResult(_0x1e7779,_0x4ddaf6){_0x4ddaf6=_0x4ddaf6||0xc8;return function(_0x45bf8b){if(_0x45bf8b){return _0x1e7779['status'](_0x4ddaf6)[_0xd41c('0x22')](_0x45bf8b);}};}function respondWithFilteredResult(_0x4a6ef8,_0x186d00){return function(_0x58acdc){if(_0x58acdc){var _0x540b29=typeof _0x186d00[_0xd41c('0x23')]===_0xd41c('0x24')&&typeof _0x186d00[_0xd41c('0x25')]===_0xd41c('0x24');var _0x17a066=_0x58acdc['count'];var _0x41a8b0=_0x540b29?0x0:_0x186d00[_0xd41c('0x23')];var _0x319d08=_0x540b29?_0x58acdc['count']:_0x186d00[_0xd41c('0x23')]+_0x186d00[_0xd41c('0x25')];var _0x3db12e;if(_0x319d08>=_0x17a066){_0x319d08=_0x17a066;_0x3db12e=0xc8;}else{_0x3db12e=0xce;}_0x4a6ef8[_0xd41c('0x20')](_0x3db12e);return _0x4a6ef8[_0xd41c('0x26')](_0xd41c('0x27'),_0x41a8b0+'-'+_0x319d08+'/'+_0x17a066)[_0xd41c('0x22')](_0x58acdc);}return null;};}function patchUpdates(_0x54da1b){return function(_0x49894f){try{jsonpatch[_0xd41c('0x28')](_0x49894f,_0x54da1b,!![]);}catch(_0x311998){return BPromise[_0xd41c('0x29')](_0x311998);}return _0x49894f[_0xd41c('0x2a')]();};}function saveUpdates(_0x94f3f6,_0x21dc88){return function(_0x36a5fa){if(_0x36a5fa){return _0x36a5fa[_0xd41c('0x2b')](_0x94f3f6)[_0xd41c('0x2c')](function(_0x2649f8){return _0x2649f8;});}return null;};}function removeEntity(_0x404cc7,_0x37bc83){return function(_0x321a2c){if(_0x321a2c){return _0x321a2c[_0xd41c('0x2d')]()[_0xd41c('0x2c')](function(){var _0xd5f769=_0x321a2c[_0xd41c('0x2e')]({'plain':!![]});var _0x58e60b='FaxQueues';return db['UserProfileResource'][_0xd41c('0x2d')]({'where':{'type':_0x58e60b,'resourceId':_0xd5f769['id']}})[_0xd41c('0x2c')](function(){return _0x321a2c;});})[_0xd41c('0x2c')](function(){_0x404cc7[_0xd41c('0x20')](0xcc)[_0xd41c('0x21')]();});}};}function handleEntityNotFound(_0x4866e0,_0x4575b2){return function(_0x396d35){if(!_0x396d35){_0x4866e0[_0xd41c('0x1f')](0x194);}return _0x396d35;};}function handleError(_0x28857a,_0x1b8a11){_0x1b8a11=_0x1b8a11||0x1f4;return function(_0x40b8c5){logger[_0xd41c('0x2f')](_0x40b8c5[_0xd41c('0x30')]);if(_0x40b8c5[_0xd41c('0x31')]){delete _0x40b8c5['name'];}_0x28857a[_0xd41c('0x20')](_0x1b8a11)['send'](_0x40b8c5);};}exports[_0xd41c('0x32')]=function(_0xd33c47,_0x4e1af3){var _0x17565c={},_0x4665af={},_0xf0987={'count':0x0,'rows':[]};var _0x2684f8=_[_0xd41c('0x33')](db[_0xd41c('0x34')][_0xd41c('0x35')],function(_0x53779b){return{'name':_0x53779b['fieldName'],'type':_0x53779b[_0xd41c('0x36')][_0xd41c('0x37')]};});_0x4665af[_0xd41c('0x38')]=_[_0xd41c('0x33')](_0x2684f8,_0xd41c('0x31'));_0x4665af[_0xd41c('0x39')]=_[_0xd41c('0x3a')](_0xd33c47[_0xd41c('0x39')]);_0x4665af[_0xd41c('0x3b')]=_[_0xd41c('0x3c')](_0x4665af[_0xd41c('0x38')],_0x4665af['query']);_0x17565c['attributes']=_[_0xd41c('0x3c')](_0x4665af[_0xd41c('0x38')],qs['fields'](_0xd33c47[_0xd41c('0x39')][_0xd41c('0x3d')]));_0x17565c['attributes']=_0x17565c[_0xd41c('0x3e')][_0xd41c('0x3f')]?_0x17565c['attributes']:_0x4665af['model'];if(!_0xd33c47[_0xd41c('0x39')]['hasOwnProperty'](_0xd41c('0x40'))){_0x17565c[_0xd41c('0x25')]=qs[_0xd41c('0x25')](_0xd33c47[_0xd41c('0x39')][_0xd41c('0x25')]);_0x17565c['offset']=qs[_0xd41c('0x23')](_0xd33c47[_0xd41c('0x39')][_0xd41c('0x23')]);}_0x17565c['order']=qs[_0xd41c('0x41')](_0xd33c47[_0xd41c('0x39')][_0xd41c('0x41')]);_0x17565c[_0xd41c('0x42')]=qs[_0xd41c('0x3b')](_[_0xd41c('0x43')](_0xd33c47[_0xd41c('0x39')],_0x4665af[_0xd41c('0x3b')]),_0x2684f8);if(_0xd33c47[_0xd41c('0x39')][_0xd41c('0x44')]){_0x17565c['where']=_['merge'](_0x17565c['where'],{'$or':_[_0xd41c('0x33')](_0x2684f8,function(_0x45dbed){if(_0x45dbed[_0xd41c('0x36')]!=='VIRTUAL'){var _0x407234={};_0x407234[_0x45dbed['name']]={'$like':'%'+_0xd33c47['query'][_0xd41c('0x44')]+'%'};return _0x407234;}})});}_0x17565c=_[_0xd41c('0x45')]({},_0x17565c,_0xd33c47[_0xd41c('0x46')]);var _0x3b587b={'where':_0x17565c[_0xd41c('0x42')]};return db['FaxQueue'][_0xd41c('0x47')](_0x3b587b)['then'](function(_0xa242b9){_0xf0987[_0xd41c('0x47')]=_0xa242b9;if(_0xd33c47[_0xd41c('0x39')]['includeAll']){_0x17565c[_0xd41c('0x48')]=[{'all':!![]}];}return db[_0xd41c('0x34')]['findAll'](_0x17565c);})[_0xd41c('0x2c')](function(_0x1dbed5){_0xf0987['rows']=_0x1dbed5;return _0xf0987;})[_0xd41c('0x2c')](respondWithFilteredResult(_0x4e1af3,_0x17565c))['catch'](handleError(_0x4e1af3,null));};exports[_0xd41c('0x49')]=function(_0x4983cc,_0x867b97){var _0x54a704={'raw':!![],'where':{'id':_0x4983cc['params']['id']}},_0x252f22={};_0x252f22['model']=_[_0xd41c('0x3a')](db[_0xd41c('0x34')]['rawAttributes']);_0x252f22[_0xd41c('0x39')]=_[_0xd41c('0x3a')](_0x4983cc[_0xd41c('0x39')]);_0x252f22['filters']=_[_0xd41c('0x3c')](_0x252f22[_0xd41c('0x38')],_0x252f22[_0xd41c('0x39')]);_0x54a704[_0xd41c('0x3e')]=_[_0xd41c('0x3c')](_0x252f22[_0xd41c('0x38')],qs[_0xd41c('0x3d')](_0x4983cc[_0xd41c('0x39')][_0xd41c('0x3d')]));_0x54a704[_0xd41c('0x3e')]=_0x54a704[_0xd41c('0x3e')][_0xd41c('0x3f')]?_0x54a704['attributes']:_0x252f22[_0xd41c('0x38')];if(_0x4983cc[_0xd41c('0x39')][_0xd41c('0x4a')]){_0x54a704[_0xd41c('0x48')]=[{'all':!![]}];}_0x54a704=_['merge']({},_0x54a704,_0x4983cc[_0xd41c('0x46')]);return db[_0xd41c('0x34')][_0xd41c('0x4b')](_0x54a704)[_0xd41c('0x2c')](handleEntityNotFound(_0x867b97,null))[_0xd41c('0x2c')](respondWithResult(_0x867b97,null))[_0xd41c('0x4c')](handleError(_0x867b97,null));};exports['create']=function(_0x2bc247,_0x21a55e){return db[_0xd41c('0x34')][_0xd41c('0x4d')](_0x2bc247[_0xd41c('0x4e')],{})['then'](function(_0x1034bf){var _0x1573ec=_0x2bc247[_0xd41c('0x4f')][_0xd41c('0x2e')]({'plain':!![]});if(!_0x1573ec)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1573ec[_0xd41c('0x50')]===_0xd41c('0x4f')){var _0x2a7dfa=_0x1034bf[_0xd41c('0x2e')]({'plain':!![]});var _0x16ea61=_0xd41c('0x51');return db['UserProfileSection']['find']({'where':{'name':_0x16ea61,'userProfileId':_0x1573ec[_0xd41c('0x52')]},'raw':!![]})[_0xd41c('0x2c')](function(_0x53b95e){if(_0x53b95e&&_0x53b95e[_0xd41c('0x53')]===0x0){return db['UserProfileResource'][_0xd41c('0x4d')]({'name':_0x2a7dfa[_0xd41c('0x31')],'resourceId':_0x2a7dfa['id'],'type':_0x53b95e[_0xd41c('0x31')],'sectionId':_0x53b95e['id']},{})[_0xd41c('0x2c')](function(){return _0x1034bf;});}else{return _0x1034bf;}})[_0xd41c('0x4c')](function(_0x2e11ee){logger[_0xd41c('0x2f')](_0xd41c('0x54'),_0x2e11ee);throw _0x2e11ee;});}return _0x1034bf;})[_0xd41c('0x2c')](respondWithResult(_0x21a55e,0xc9))[_0xd41c('0x4c')](handleError(_0x21a55e,null));};exports['update']=function(_0x5d2656,_0x40d37e){if(_0x5d2656['body']['id']){delete _0x5d2656[_0xd41c('0x4e')]['id'];}return db[_0xd41c('0x34')][_0xd41c('0x4b')]({'where':{'id':_0x5d2656[_0xd41c('0x55')]['id']}})['then'](handleEntityNotFound(_0x40d37e,null))[_0xd41c('0x2c')](saveUpdates(_0x5d2656[_0xd41c('0x4e')],null))[_0xd41c('0x2c')](respondWithResult(_0x40d37e,null))[_0xd41c('0x4c')](handleError(_0x40d37e,null));};exports[_0xd41c('0x2d')]=function(_0x5601fb,_0x4c1388){return db[_0xd41c('0x34')][_0xd41c('0x4b')]({'where':{'id':_0x5601fb['params']['id']}})[_0xd41c('0x2c')](handleEntityNotFound(_0x4c1388,null))[_0xd41c('0x2c')](removeEntity(_0x4c1388,null))[_0xd41c('0x4c')](handleError(_0x4c1388,null));};exports[_0xd41c('0x56')]=function(_0x5d7169,_0x24799a){return db['FaxQueue'][_0xd41c('0x56')]()[_0xd41c('0x2c')](respondWithResult(_0x24799a,null))[_0xd41c('0x4c')](handleError(_0x24799a,null));};exports['getMembers']=function(_0x469c6b,_0x4d7876,_0x55c37e){var _0x57396c={'raw':!![],'where':{}},_0x25404a={},_0x24ff3a;return db['FaxQueue'][_0xd41c('0x57')]({'where':{'id':_0x469c6b[_0xd41c('0x55')]['id']}})[_0xd41c('0x2c')](handleEntityNotFound(_0x4d7876,null))['then'](function(_0x4f9648){if(_0x4f9648){_0x24ff3a=_0x4f9648[_0xd41c('0x2e')]({'plain':!![]});_0x25404a[_0xd41c('0x38')]=_[_0xd41c('0x3a')](db['UserFaxQueue'][_0xd41c('0x35')]);_0x25404a[_0xd41c('0x39')]=_[_0xd41c('0x3a')](_0x469c6b[_0xd41c('0x39')]);_0x25404a[_0xd41c('0x3b')]=_[_0xd41c('0x3c')](_0x25404a[_0xd41c('0x38')],_0x25404a[_0xd41c('0x39')]);_0x57396c[_0xd41c('0x3e')]=_[_0xd41c('0x3c')](_0x25404a['model'],qs[_0xd41c('0x3d')](_0x469c6b[_0xd41c('0x39')][_0xd41c('0x3d')]));_0x57396c[_0xd41c('0x3e')]=_0x57396c[_0xd41c('0x3e')]['length']?_0x57396c[_0xd41c('0x3e')]:_0x25404a[_0xd41c('0x38')];if(!_0x469c6b[_0xd41c('0x39')]['hasOwnProperty']('nolimit')){_0x57396c[_0xd41c('0x25')]=qs[_0xd41c('0x25')](_0x469c6b[_0xd41c('0x39')]['limit']);_0x57396c['offset']=qs[_0xd41c('0x23')](_0x469c6b[_0xd41c('0x39')][_0xd41c('0x23')]);}_0x57396c[_0xd41c('0x58')]=qs[_0xd41c('0x41')](_0x469c6b[_0xd41c('0x39')][_0xd41c('0x41')]);_0x57396c[_0xd41c('0x42')]=qs[_0xd41c('0x3b')](_[_0xd41c('0x43')](_0x469c6b[_0xd41c('0x39')],_0x25404a['filters']));_0x57396c[_0xd41c('0x42')][_0xd41c('0x59')]=_0x4f9648['id'];if(_0x469c6b['query'][_0xd41c('0x44')]){_0x57396c[_0xd41c('0x42')]=_[_0xd41c('0x45')](_0x57396c[_0xd41c('0x42')],{'$or':_['map'](_0x57396c[_0xd41c('0x3e')],function(_0x33f841){var _0x12862e={};_0x12862e[_0x33f841]={'$like':'%'+_0x469c6b[_0xd41c('0x39')][_0xd41c('0x44')]+'%'};return _0x12862e;})});}_0x57396c=_[_0xd41c('0x45')]({},_0x57396c,_0x469c6b[_0xd41c('0x46')]);return db[_0xd41c('0x5a')][_0xd41c('0x5b')](_0x57396c);}})[_0xd41c('0x2c')](function(_0x5086d0){if(_0x5086d0){return db['User'][_0xd41c('0x5c')]({'where':{'id':_[_0xd41c('0x33')](_0x5086d0,_0xd41c('0x5d')),'role':_0xd41c('0x5e')},'attributes':['id',_0xd41c('0x31'),_0xd41c('0x5f'),'updatedAt','createdAt']});}})['then'](function(_0x5ae329){if(_0x5ae329){return{'count':_0x5ae329[_0xd41c('0x47')],'rows':_[_0xd41c('0x33')](_0x5ae329[_0xd41c('0x60')],function(_0x1f9e90){return{'membername':_0x1f9e90['name'],'UserId':_0x1f9e90['id'],'queue_name':_0x24ff3a[_0xd41c('0x31')],'FaxQueueId':_0x24ff3a['id'],'interface':util[_0xd41c('0x61')](_0xd41c('0x62'),_0xd41c('0x63'),_0x1f9e90[_0xd41c('0x31')]),'penalty':0x0,'paused':_0x1f9e90[_0xd41c('0x5f')],'createdAt':_0x1f9e90[_0xd41c('0x64')],'updatedAt':_0x1f9e90[_0xd41c('0x65')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xd41c('0x2c')](respondWithFilteredResult(_0x4d7876,_0x57396c))['catch'](handleError(_0x4d7876,null));};exports[_0xd41c('0x66')]=function(_0x29e2af,_0x3ff5fb,_0x2f5b0c){var _0x45d2cb={};var _0x209b2e={};var _0x10df3d;var _0x202c69;return db['FaxQueue']['findOne']({'where':{'id':_0x29e2af[_0xd41c('0x55')]['id']}})['then'](handleEntityNotFound(_0x3ff5fb,null))[_0xd41c('0x2c')](function(_0x5e31aa){if(_0x5e31aa){_0x10df3d=_0x5e31aa;_0x209b2e['model']=_['keys'](db[_0xd41c('0x67')][_0xd41c('0x35')]);_0x209b2e[_0xd41c('0x39')]=_['keys'](_0x29e2af[_0xd41c('0x39')]);_0x209b2e[_0xd41c('0x3b')]=_[_0xd41c('0x3c')](_0x209b2e['model'],_0x209b2e[_0xd41c('0x39')]);_0x45d2cb['attributes']=_[_0xd41c('0x3c')](_0x209b2e[_0xd41c('0x38')],qs[_0xd41c('0x3d')](_0x29e2af[_0xd41c('0x39')]['fields']));_0x45d2cb[_0xd41c('0x3e')]=_0x45d2cb[_0xd41c('0x3e')]['length']?_0x45d2cb[_0xd41c('0x3e')]:_0x209b2e[_0xd41c('0x38')];_0x45d2cb[_0xd41c('0x58')]=qs['sort'](_0x29e2af['query'][_0xd41c('0x41')]);_0x45d2cb[_0xd41c('0x42')]=qs['filters'](_[_0xd41c('0x43')](_0x29e2af[_0xd41c('0x39')],_0x209b2e[_0xd41c('0x3b')]));if(_0x29e2af[_0xd41c('0x39')][_0xd41c('0x44')]){_0x45d2cb[_0xd41c('0x42')]=_[_0xd41c('0x45')](_0x45d2cb[_0xd41c('0x42')],{'$or':_[_0xd41c('0x33')](_0x45d2cb[_0xd41c('0x3e')],function(_0x43cbf8){var _0x244fa1={};_0x244fa1[_0x43cbf8]={'$like':'%'+_0x29e2af['query'][_0xd41c('0x44')]+'%'};return _0x244fa1;})});}_0x45d2cb=_[_0xd41c('0x45')]({},_0x45d2cb,_0x29e2af[_0xd41c('0x46')]);return _0x10df3d['getTeams'](_0x45d2cb);}})[_0xd41c('0x2c')](function(_0x30d86d){if(_0x30d86d){_0x202c69=_0x30d86d[_0xd41c('0x3f')];if(!_0x29e2af[_0xd41c('0x39')][_0xd41c('0x68')](_0xd41c('0x40'))){_0x45d2cb[_0xd41c('0x25')]=qs[_0xd41c('0x25')](_0x29e2af[_0xd41c('0x39')]['limit']);_0x45d2cb['offset']=qs[_0xd41c('0x23')](_0x29e2af[_0xd41c('0x39')]['offset']);}return _0x10df3d[_0xd41c('0x66')](_0x45d2cb);}})[_0xd41c('0x2c')](function(_0x5d4f9c){if(_0x5d4f9c){return _0x5d4f9c?{'count':_0x202c69,'rows':_0x5d4f9c}:null;}})[_0xd41c('0x2c')](respondWithResult(_0x3ff5fb,null))[_0xd41c('0x4c')](handleError(_0x3ff5fb,null));};exports[_0xd41c('0x69')]=function(_0x116f98,_0x44f726,_0x11e39b){var _0x1beb8d=_0x116f98['body'][_0xd41c('0x6a')];return db[_0xd41c('0x67')][_0xd41c('0x5b')]({'where':{'id':_0x1beb8d},'attributes':['id'],'include':[{'model':db[_0xd41c('0x6b')],'as':'Agents','attributes':['id',_0xd41c('0x31'),_0xd41c('0x6c'),_0xd41c('0x6d'),_0xd41c('0x6e')],'raw':!![]}]})[_0xd41c('0x2c')](function(_0x40c0fa){if(_0x40c0fa){var _0x4255e5=_[_0xd41c('0x6f')](_0x40c0fa,function(_0x4a296a){var _0x424297=_0x4a296a[_0xd41c('0x2e')]({'plain':!![]});return _0x424297[_0xd41c('0x70')];});return db[_0xd41c('0x34')][_0xd41c('0x4b')]({'where':{'id':_0x116f98[_0xd41c('0x55')]['id']}})[_0xd41c('0x2c')](function(_0x1bfccc){return db[_0xd41c('0x71')][_0xd41c('0x72')](function(_0x16b32f){return _0x1bfccc[_0xd41c('0x69')](_0x1beb8d,{'transaction':_0x16b32f})[_0xd41c('0x2c')](function(){return BPromise[_0xd41c('0x73')](_0x4255e5,function(_0x141c9c){return db['UserFaxQueue'][_0xd41c('0x74')]({'where':{'UserId':_0x141c9c['id'],'FaxQueueId':_0x116f98['params']['id']},'transaction':_0x16b32f});});})[_0xd41c('0x2c')](function(){_0x4255e5['forEach'](function(_0x29a2d5){socket[_0xd41c('0x75')](_0xd41c('0x76'),{'UserId':_0x29a2d5['id'],'FaxQueueId':_0x1bfccc['id']});});});});});}})[_0xd41c('0x2c')](respondWithStatusCode(_0x44f726,null))[_0xd41c('0x4c')](handleError(_0x44f726,null));};exports[_0xd41c('0x77')]=function(_0x512c2f,_0x3a531f,_0x181003){return db['Team']['findAll']({'where':{'id':_0x512c2f[_0xd41c('0x39')]['ids']},'attributes':['id'],'include':[{'model':db[_0xd41c('0x6b')],'as':_0xd41c('0x70'),'attributes':['id'],'raw':!![]}]})[_0xd41c('0x2c')](handleEntityNotFound(_0x3a531f,null))[_0xd41c('0x2c')](function(_0x7bd70a){var _0x229169=_[_0xd41c('0x33')](_0x7bd70a,'id');var _0x4906cf=[];var _0x17f4ea=[];var _0x1694df=squel[_0xd41c('0x78')]();_0x1694df['field'](_0xd41c('0x79'))[_0xd41c('0x7a')](_0xd41c('0x7b'),'tq')[_0xd41c('0x7c')](_0xd41c('0x7d'),'ut',_0xd41c('0x7e'))[_0xd41c('0x42')](_0xd41c('0x7f'),_0x512c2f['params']['id']);for(var _0xfb77a6=0x0;_0xfb77a6<_0x7bd70a[_0xd41c('0x3f')];_0xfb77a6+=0x1){let _0x2c4777=_0x7bd70a[_0xfb77a6];for(var _0x5a8135=0x0;_0x5a8135<_0x2c4777[_0xd41c('0x70')][_0xd41c('0x3f')];_0x5a8135+=0x1){let _0x354d8c=_0x2c4777[_0xd41c('0x70')][_0x5a8135];var _0x2e50c4=_0x1694df['clone']();_0x2e50c4['where']('ut.UserId\x20=\x20?',_0x354d8c['id']);_0x17f4ea[_0xd41c('0x80')](db[_0xd41c('0x71')][_0xd41c('0x39')](_0x2e50c4[_0xd41c('0x81')](),{'type':db[_0xd41c('0x71')][_0xd41c('0x82')][_0xd41c('0x83')]})[_0xd41c('0x2c')](function(_0x312de8){if(_0x312de8[_0xd41c('0x3f')]===0x1){return _0x354d8c['id'];}else{var _0x539af8=_['every'](_['map'](_0x312de8,_0xd41c('0x84')),function(_0x7df4f5){return _['includes'](_0x229169,_0x7df4f5);});if(_0x539af8){return _0x354d8c['id'];}}}));}}return BPromise[_0xd41c('0x85')](_0x17f4ea)[_0xd41c('0x2c')](function(_0x149e43){_0x4906cf=_(_0x4906cf)[_0xd41c('0x86')](_0x149e43)[_0xd41c('0x87')]()[_0xd41c('0x88')]();return db['FaxQueue'][_0xd41c('0x4b')]({'where':{'id':_0x512c2f[_0xd41c('0x55')]['id']}})['then'](function(_0x10690b){return db[_0xd41c('0x71')]['transaction'](function(_0x12d4c5){return _0x10690b[_0xd41c('0x77')](_0x512c2f[_0xd41c('0x39')][_0xd41c('0x6a')],{'transaction':_0x12d4c5})[_0xd41c('0x2c')](function(){if(!_[_0xd41c('0x89')](_0x4906cf)){return _0x10690b[_0xd41c('0x8a')](_0x4906cf,{'transaction':_0x12d4c5});}})['then'](function(){_0x4906cf[_0xd41c('0x8b')](function(_0xa77b98){socket[_0xd41c('0x75')](_0xd41c('0x8c'),{'UserId':_0xa77b98,'FaxQueueId':_0x10690b['id']});});});});});});})[_0xd41c('0x2c')](respondWithStatusCode(_0x3a531f,null))['catch'](handleError(_0x3a531f,null));};exports[_0xd41c('0x8d')]=function(_0xc1d0,_0x5b79b1,_0x57abde){return db[_0xd41c('0x34')][_0xd41c('0x4b')]({'where':{'id':_0xc1d0[_0xd41c('0x55')]['id']}})['then'](handleEntityNotFound(_0x5b79b1,null))[_0xd41c('0x2c')](function(_0x2294e8){if(_0x2294e8){return _0x2294e8[_0xd41c('0x8d')](_0xc1d0[_0xd41c('0x4e')][_0xd41c('0x6a')],_[_0xd41c('0x8e')](_0xc1d0['body'],[_0xd41c('0x6a'),'id'])||{})['spread'](function(_0x15ef04){for(var _0x36b1cd=0x0;_0x36b1cd<_0xc1d0[_0xd41c('0x4e')]['ids'][_0xd41c('0x3f')];_0x36b1cd+=0x1){socket['emit'](_0xd41c('0x76'),{'UserId':Number(_0xc1d0['body']['ids'][_0x36b1cd]),'FaxQueueId':Number(_0xc1d0[_0xd41c('0x55')]['id'])});}return _0x15ef04;});}})[_0xd41c('0x2c')](respondWithResult(_0x5b79b1,null))[_0xd41c('0x4c')](handleError(_0x5b79b1,null));};exports[_0xd41c('0x8a')]=function(_0x4daeda,_0x2efe2b,_0x2ce06f){return db[_0xd41c('0x34')]['find']({'where':{'id':_0x4daeda[_0xd41c('0x55')]['id']}})[_0xd41c('0x2c')](handleEntityNotFound(_0x2efe2b,null))[_0xd41c('0x2c')](function(_0x150a0f){if(_0x150a0f){return _0x150a0f[_0xd41c('0x8a')](_0x4daeda[_0xd41c('0x39')][_0xd41c('0x6a')])[_0xd41c('0x2c')](function(){if(_['isArray'](_0x4daeda[_0xd41c('0x39')]['ids'])){for(var _0x3558c1=0x0;_0x3558c1<_0x4daeda[_0xd41c('0x39')][_0xd41c('0x6a')]['length'];_0x3558c1+=0x1){socket[_0xd41c('0x75')](_0xd41c('0x8c'),{'UserId':Number(_0x4daeda[_0xd41c('0x39')][_0xd41c('0x6a')][_0x3558c1]),'FaxQueueId':Number(_0x4daeda['params']['id'])});}}else{socket[_0xd41c('0x75')](_0xd41c('0x8c'),{'UserId':Number(_0x4daeda['query'][_0xd41c('0x6a')]),'FaxQueueId':Number(_0x4daeda[_0xd41c('0x55')]['id'])});}});}})['then'](respondWithStatusCode(_0x2efe2b,null))['catch'](handleError(_0x2efe2b,null));};exports['getAgents']=function(_0x52820f,_0x48e9f4,_0x20b42d){var _0x3d9531={};var _0x5d6909={};var _0x2eff9e;var _0x40fd73;return db['FaxQueue']['findOne']({'where':{'id':_0x52820f[_0xd41c('0x55')]['id']}})[_0xd41c('0x2c')](handleEntityNotFound(_0x48e9f4,null))['then'](function(_0x4ee857){if(_0x4ee857){_0x2eff9e=_0x4ee857;_0x5d6909[_0xd41c('0x38')]=_[_0xd41c('0x3a')](db[_0xd41c('0x6b')]['rawAttributes']);_0x5d6909[_0xd41c('0x39')]=_[_0xd41c('0x3a')](_0x52820f[_0xd41c('0x39')]);_0x5d6909[_0xd41c('0x3b')]=_['intersection'](_0x5d6909[_0xd41c('0x38')],_0x5d6909[_0xd41c('0x39')]);_0x3d9531[_0xd41c('0x3e')]=_[_0xd41c('0x3c')](_0x5d6909[_0xd41c('0x38')],qs[_0xd41c('0x3d')](_0x52820f[_0xd41c('0x39')][_0xd41c('0x3d')]));_0x3d9531[_0xd41c('0x3e')]=_0x3d9531[_0xd41c('0x3e')]['length']?_0x3d9531[_0xd41c('0x3e')]:_0x5d6909[_0xd41c('0x38')];_0x3d9531[_0xd41c('0x58')]=qs[_0xd41c('0x41')](_0x52820f[_0xd41c('0x39')]['sort']);_0x3d9531[_0xd41c('0x42')]=qs[_0xd41c('0x3b')](_[_0xd41c('0x43')](_0x52820f[_0xd41c('0x39')],_0x5d6909[_0xd41c('0x3b')]));if(_0x52820f[_0xd41c('0x39')][_0xd41c('0x44')]){_0x3d9531[_0xd41c('0x42')]=_[_0xd41c('0x45')](_0x3d9531[_0xd41c('0x42')],{'$or':_['map'](_0x3d9531['attributes'],function(_0x2f8be7){var _0xf4680d={};_0xf4680d[_0x2f8be7]={'$like':'%'+_0x52820f[_0xd41c('0x39')][_0xd41c('0x44')]+'%'};return _0xf4680d;})});}_0x3d9531=_['merge']({},_0x3d9531,_0x52820f['options']);return _0x2eff9e[_0xd41c('0x8f')](_0x3d9531);}})[_0xd41c('0x2c')](function(_0x30e71b){if(_0x30e71b){_0x40fd73=_0x30e71b[_0xd41c('0x3f')];if(!_0x52820f[_0xd41c('0x39')]['hasOwnProperty'](_0xd41c('0x40'))){_0x3d9531[_0xd41c('0x25')]=qs[_0xd41c('0x25')](_0x52820f[_0xd41c('0x39')]['limit']);_0x3d9531['offset']=qs['offset'](_0x52820f[_0xd41c('0x39')][_0xd41c('0x23')]);}return _0x2eff9e[_0xd41c('0x8f')](_0x3d9531);}})['then'](function(_0x5557df){if(_0x5557df){return _0x5557df?{'count':_0x40fd73,'rows':_0x5557df}:null;}})[_0xd41c('0x2c')](respondWithResult(_0x48e9f4,null))[_0xd41c('0x4c')](handleError(_0x48e9f4,null));}; \ No newline at end of file +var _0x6f73=['ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','register','sendStatus','status','json','undefined','count','offset','limit','Content-Range','save','update','destroy','then','get','FaxQueues','end','stack','name','send','map','FaxQueue','rawAttributes','fieldName','type','key','model','keys','filters','query','attributes','intersection','fields','hasOwnProperty','order','sort','where','pick','VIRTUAL','filter','merge','includeAll','findAll','rows','show','params','include','options','catch','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','getMembers','findOne','length','FaxQueueId','UserFaxQueue','findAndCountAll','UserId','agent','faxPause','updatedAt','format','%s/%s','createdAt','getTeams','nolimit','ids','Team','User','online','voicePause','interface','addTeams','each','findOrCreate','forEach','emit','userFaxQueue:save','removeTeams','Agents','select','field','tq.TeamId','from','team_has_fax_queues','ut.TeamId\x20=\x20tq.TeamId','FaxQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','sequelize','toString','SELECT','every','TeamId','all','value','isEmpty','removeAgents','addAgents','spread','isArray','userFaxQueue:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x6f73,0x7b));var _0x36f7=function(_0x21e09f,_0x409c8a){_0x21e09f=_0x21e09f-0x0;var _0x20687a=_0x6f73[_0x21e09f];return _0x20687a;};'use strict';var emlformat=require(_0x36f7('0x0'));var rimraf=require(_0x36f7('0x1'));var zipdir=require(_0x36f7('0x2'));var jsonpatch=require(_0x36f7('0x3'));var rp=require(_0x36f7('0x4'));var moment=require('moment');var BPromise=require(_0x36f7('0x5'));var Mustache=require(_0x36f7('0x6'));var util=require(_0x36f7('0x7'));var path=require(_0x36f7('0x8'));var sox=require(_0x36f7('0x9'));var csv=require(_0x36f7('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x36f7('0xb'));var _=require(_0x36f7('0xc'));var squel=require(_0x36f7('0xd'));var crypto=require(_0x36f7('0xe'));var jsforce=require(_0x36f7('0xf'));var deskjs=require(_0x36f7('0x10'));var toCsv=require(_0x36f7('0xa'));var querystring=require(_0x36f7('0x11'));var Papa=require(_0x36f7('0x12'));var Redis=require(_0x36f7('0x13'));var authService=require(_0x36f7('0x14'));var qs=require(_0x36f7('0x15'));var as=require(_0x36f7('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x36f7('0x17'))('api');var utils=require('../../config/utils');var config=require(_0x36f7('0x18'));var licenseUtil=require(_0x36f7('0x19'));var db=require(_0x36f7('0x1a'))['db'];config[_0x36f7('0x1b')]=_['defaults'](config['redis'],{'host':_0x36f7('0x1c'),'port':0x18eb});var socket=require(_0x36f7('0x1d'))(new Redis(config['redis']));require('./faxQueue.socket')[_0x36f7('0x1e')](socket);function respondWithStatusCode(_0x30a538,_0x5a823b){_0x5a823b=_0x5a823b||0xcc;return function(_0x50afa4){if(_0x50afa4){return _0x30a538[_0x36f7('0x1f')](_0x5a823b);}return _0x30a538['status'](_0x5a823b)['end']();};}function respondWithResult(_0x49d277,_0xd88eb2){_0xd88eb2=_0xd88eb2||0xc8;return function(_0x2a1651){if(_0x2a1651){return _0x49d277[_0x36f7('0x20')](_0xd88eb2)[_0x36f7('0x21')](_0x2a1651);}};}function respondWithFilteredResult(_0x55ee13,_0x28205a){return function(_0x4479a3){if(_0x4479a3){var _0x5ae357=typeof _0x28205a['offset']===_0x36f7('0x22')&&typeof _0x28205a['limit']===_0x36f7('0x22');var _0x4bb3be=_0x4479a3[_0x36f7('0x23')];var _0x4db519=_0x5ae357?0x0:_0x28205a[_0x36f7('0x24')];var _0x1f9a82=_0x5ae357?_0x4479a3['count']:_0x28205a[_0x36f7('0x24')]+_0x28205a[_0x36f7('0x25')];var _0x3fbf96;if(_0x1f9a82>=_0x4bb3be){_0x1f9a82=_0x4bb3be;_0x3fbf96=0xc8;}else{_0x3fbf96=0xce;}_0x55ee13[_0x36f7('0x20')](_0x3fbf96);return _0x55ee13['set'](_0x36f7('0x26'),_0x4db519+'-'+_0x1f9a82+'/'+_0x4bb3be)[_0x36f7('0x21')](_0x4479a3);}return null;};}function patchUpdates(_0x3e2ff6){return function(_0x559ec9){try{jsonpatch['apply'](_0x559ec9,_0x3e2ff6,!![]);}catch(_0xa6a7e){return BPromise['reject'](_0xa6a7e);}return _0x559ec9[_0x36f7('0x27')]();};}function saveUpdates(_0x12e517,_0x3808f4){return function(_0x530f1f){if(_0x530f1f){return _0x530f1f[_0x36f7('0x28')](_0x12e517)['then'](function(_0x1d9e07){return _0x1d9e07;});}return null;};}function removeEntity(_0x1198cc,_0x2583d5){return function(_0x42ac73){if(_0x42ac73){return _0x42ac73[_0x36f7('0x29')]()[_0x36f7('0x2a')](function(){var _0x426d6c=_0x42ac73[_0x36f7('0x2b')]({'plain':!![]});var _0x56a49d=_0x36f7('0x2c');return db['UserProfileResource'][_0x36f7('0x29')]({'where':{'type':_0x56a49d,'resourceId':_0x426d6c['id']}})[_0x36f7('0x2a')](function(){return _0x42ac73;});})[_0x36f7('0x2a')](function(){_0x1198cc[_0x36f7('0x20')](0xcc)[_0x36f7('0x2d')]();});}};}function handleEntityNotFound(_0x4509f5,_0x228df3){return function(_0x51774a){if(!_0x51774a){_0x4509f5[_0x36f7('0x1f')](0x194);}return _0x51774a;};}function handleError(_0x5eca88,_0x3f8a9e){_0x3f8a9e=_0x3f8a9e||0x1f4;return function(_0x249282){logger['error'](_0x249282[_0x36f7('0x2e')]);if(_0x249282[_0x36f7('0x2f')]){delete _0x249282[_0x36f7('0x2f')];}_0x5eca88[_0x36f7('0x20')](_0x3f8a9e)[_0x36f7('0x30')](_0x249282);};}exports['index']=function(_0x4ec051,_0x3a1bad){var _0x352467={},_0x209e23={},_0x2c5b9d={'count':0x0,'rows':[]};var _0x4b89e5=_[_0x36f7('0x31')](db[_0x36f7('0x32')][_0x36f7('0x33')],function(_0x5e18db){return{'name':_0x5e18db[_0x36f7('0x34')],'type':_0x5e18db[_0x36f7('0x35')][_0x36f7('0x36')]};});_0x209e23[_0x36f7('0x37')]=_[_0x36f7('0x31')](_0x4b89e5,_0x36f7('0x2f'));_0x209e23['query']=_[_0x36f7('0x38')](_0x4ec051['query']);_0x209e23[_0x36f7('0x39')]=_['intersection'](_0x209e23[_0x36f7('0x37')],_0x209e23[_0x36f7('0x3a')]);_0x352467[_0x36f7('0x3b')]=_[_0x36f7('0x3c')](_0x209e23['model'],qs['fields'](_0x4ec051[_0x36f7('0x3a')][_0x36f7('0x3d')]));_0x352467['attributes']=_0x352467[_0x36f7('0x3b')]['length']?_0x352467[_0x36f7('0x3b')]:_0x209e23[_0x36f7('0x37')];if(!_0x4ec051[_0x36f7('0x3a')][_0x36f7('0x3e')]('nolimit')){_0x352467[_0x36f7('0x25')]=qs['limit'](_0x4ec051['query']['limit']);_0x352467[_0x36f7('0x24')]=qs[_0x36f7('0x24')](_0x4ec051['query'][_0x36f7('0x24')]);}_0x352467[_0x36f7('0x3f')]=qs['sort'](_0x4ec051['query'][_0x36f7('0x40')]);_0x352467[_0x36f7('0x41')]=qs[_0x36f7('0x39')](_[_0x36f7('0x42')](_0x4ec051[_0x36f7('0x3a')],_0x209e23[_0x36f7('0x39')]),_0x4b89e5);if(_0x4ec051[_0x36f7('0x3a')]['filter']){_0x352467['where']=_['merge'](_0x352467[_0x36f7('0x41')],{'$or':_[_0x36f7('0x31')](_0x4b89e5,function(_0x1fb5b2){if(_0x1fb5b2[_0x36f7('0x35')]!==_0x36f7('0x43')){var _0x1255d={};_0x1255d[_0x1fb5b2[_0x36f7('0x2f')]]={'$like':'%'+_0x4ec051[_0x36f7('0x3a')][_0x36f7('0x44')]+'%'};return _0x1255d;}})});}_0x352467=_[_0x36f7('0x45')]({},_0x352467,_0x4ec051['options']);var _0x3d15c8={'where':_0x352467[_0x36f7('0x41')]};return db[_0x36f7('0x32')]['count'](_0x3d15c8)[_0x36f7('0x2a')](function(_0x59eec1){_0x2c5b9d[_0x36f7('0x23')]=_0x59eec1;if(_0x4ec051['query'][_0x36f7('0x46')]){_0x352467['include']=[{'all':!![]}];}return db[_0x36f7('0x32')][_0x36f7('0x47')](_0x352467);})['then'](function(_0x4c9288){_0x2c5b9d[_0x36f7('0x48')]=_0x4c9288;return _0x2c5b9d;})[_0x36f7('0x2a')](respondWithFilteredResult(_0x3a1bad,_0x352467))['catch'](handleError(_0x3a1bad,null));};exports[_0x36f7('0x49')]=function(_0x17e895,_0x413353){var _0x5c032e={'raw':!![],'where':{'id':_0x17e895[_0x36f7('0x4a')]['id']}},_0x39f24b={};_0x39f24b[_0x36f7('0x37')]=_[_0x36f7('0x38')](db[_0x36f7('0x32')][_0x36f7('0x33')]);_0x39f24b[_0x36f7('0x3a')]=_[_0x36f7('0x38')](_0x17e895['query']);_0x39f24b[_0x36f7('0x39')]=_[_0x36f7('0x3c')](_0x39f24b[_0x36f7('0x37')],_0x39f24b['query']);_0x5c032e['attributes']=_[_0x36f7('0x3c')](_0x39f24b[_0x36f7('0x37')],qs[_0x36f7('0x3d')](_0x17e895[_0x36f7('0x3a')][_0x36f7('0x3d')]));_0x5c032e['attributes']=_0x5c032e[_0x36f7('0x3b')]['length']?_0x5c032e[_0x36f7('0x3b')]:_0x39f24b[_0x36f7('0x37')];if(_0x17e895['query']['includeAll']){_0x5c032e[_0x36f7('0x4b')]=[{'all':!![]}];}_0x5c032e=_[_0x36f7('0x45')]({},_0x5c032e,_0x17e895[_0x36f7('0x4c')]);return db[_0x36f7('0x32')]['find'](_0x5c032e)[_0x36f7('0x2a')](handleEntityNotFound(_0x413353,null))['then'](respondWithResult(_0x413353,null))[_0x36f7('0x4d')](handleError(_0x413353,null));};exports[_0x36f7('0x4e')]=function(_0x41c101,_0x299746){return db[_0x36f7('0x32')][_0x36f7('0x4e')](_0x41c101['body'],{})[_0x36f7('0x2a')](function(_0x442b3d){var _0x539dfb=_0x41c101[_0x36f7('0x4f')]['get']({'plain':!![]});if(!_0x539dfb)throw new Error(_0x36f7('0x50'));if(_0x539dfb[_0x36f7('0x51')]===_0x36f7('0x4f')){var _0x1a8d6c=_0x442b3d[_0x36f7('0x2b')]({'plain':!![]});var _0x36e05d='FaxQueues';return db[_0x36f7('0x52')][_0x36f7('0x53')]({'where':{'name':_0x36e05d,'userProfileId':_0x539dfb['userProfileId']},'raw':!![]})[_0x36f7('0x2a')](function(_0x2ddcd4){if(_0x2ddcd4&&_0x2ddcd4[_0x36f7('0x54')]===0x0){return db['UserProfileResource']['create']({'name':_0x1a8d6c[_0x36f7('0x2f')],'resourceId':_0x1a8d6c['id'],'type':_0x2ddcd4['name'],'sectionId':_0x2ddcd4['id']},{})[_0x36f7('0x2a')](function(){return _0x442b3d;});}else{return _0x442b3d;}})['catch'](function(_0x4cf43a){logger[_0x36f7('0x55')](_0x36f7('0x56'),_0x4cf43a);throw _0x4cf43a;});}return _0x442b3d;})['then'](respondWithResult(_0x299746,0xc9))[_0x36f7('0x4d')](handleError(_0x299746,null));};exports[_0x36f7('0x28')]=function(_0x44791d,_0x1eba9a){if(_0x44791d[_0x36f7('0x57')]['id']){delete _0x44791d[_0x36f7('0x57')]['id'];}return db[_0x36f7('0x32')][_0x36f7('0x53')]({'where':{'id':_0x44791d['params']['id']}})[_0x36f7('0x2a')](handleEntityNotFound(_0x1eba9a,null))['then'](saveUpdates(_0x44791d['body'],null))[_0x36f7('0x2a')](respondWithResult(_0x1eba9a,null))['catch'](handleError(_0x1eba9a,null));};exports['destroy']=function(_0x3e4598,_0x512c2e){return db['FaxQueue']['find']({'where':{'id':_0x3e4598[_0x36f7('0x4a')]['id']}})[_0x36f7('0x2a')](handleEntityNotFound(_0x512c2e,null))[_0x36f7('0x2a')](removeEntity(_0x512c2e,null))[_0x36f7('0x4d')](handleError(_0x512c2e,null));};exports[_0x36f7('0x58')]=function(_0x1520d7,_0x4e04e8){return db[_0x36f7('0x32')][_0x36f7('0x58')]()[_0x36f7('0x2a')](respondWithResult(_0x4e04e8,null))[_0x36f7('0x4d')](handleError(_0x4e04e8,null));};exports[_0x36f7('0x59')]=function(_0x451928,_0x347fab,_0x1436a5){var _0x427ac0={'raw':!![],'where':{}},_0xdb79e6={},_0xa256bd;return db[_0x36f7('0x32')][_0x36f7('0x5a')]({'where':{'id':_0x451928['params']['id']}})[_0x36f7('0x2a')](handleEntityNotFound(_0x347fab,null))[_0x36f7('0x2a')](function(_0x1d7986){if(_0x1d7986){_0xa256bd=_0x1d7986['get']({'plain':!![]});_0xdb79e6[_0x36f7('0x37')]=_[_0x36f7('0x38')](db['UserFaxQueue'][_0x36f7('0x33')]);_0xdb79e6[_0x36f7('0x3a')]=_[_0x36f7('0x38')](_0x451928['query']);_0xdb79e6[_0x36f7('0x39')]=_[_0x36f7('0x3c')](_0xdb79e6[_0x36f7('0x37')],_0xdb79e6[_0x36f7('0x3a')]);_0x427ac0[_0x36f7('0x3b')]=_[_0x36f7('0x3c')](_0xdb79e6[_0x36f7('0x37')],qs[_0x36f7('0x3d')](_0x451928[_0x36f7('0x3a')][_0x36f7('0x3d')]));_0x427ac0[_0x36f7('0x3b')]=_0x427ac0[_0x36f7('0x3b')][_0x36f7('0x5b')]?_0x427ac0[_0x36f7('0x3b')]:_0xdb79e6['model'];if(!_0x451928[_0x36f7('0x3a')][_0x36f7('0x3e')]('nolimit')){_0x427ac0[_0x36f7('0x25')]=qs[_0x36f7('0x25')](_0x451928['query'][_0x36f7('0x25')]);_0x427ac0[_0x36f7('0x24')]=qs[_0x36f7('0x24')](_0x451928[_0x36f7('0x3a')][_0x36f7('0x24')]);}_0x427ac0[_0x36f7('0x3f')]=qs[_0x36f7('0x40')](_0x451928[_0x36f7('0x3a')][_0x36f7('0x40')]);_0x427ac0[_0x36f7('0x41')]=qs[_0x36f7('0x39')](_[_0x36f7('0x42')](_0x451928[_0x36f7('0x3a')],_0xdb79e6['filters']));_0x427ac0[_0x36f7('0x41')][_0x36f7('0x5c')]=_0x1d7986['id'];if(_0x451928[_0x36f7('0x3a')]['filter']){_0x427ac0[_0x36f7('0x41')]=_[_0x36f7('0x45')](_0x427ac0[_0x36f7('0x41')],{'$or':_['map'](_0x427ac0[_0x36f7('0x3b')],function(_0x540c15){var _0x515488={};_0x515488[_0x540c15]={'$like':'%'+_0x451928['query'][_0x36f7('0x44')]+'%'};return _0x515488;})});}_0x427ac0=_[_0x36f7('0x45')]({},_0x427ac0,_0x451928['options']);return db[_0x36f7('0x5d')][_0x36f7('0x47')](_0x427ac0);}})[_0x36f7('0x2a')](function(_0x31c4e1){if(_0x31c4e1){return db['User'][_0x36f7('0x5e')]({'where':{'id':_[_0x36f7('0x31')](_0x31c4e1,_0x36f7('0x5f')),'role':_0x36f7('0x60')},'attributes':['id','name',_0x36f7('0x61'),_0x36f7('0x62'),'createdAt']});}})[_0x36f7('0x2a')](function(_0x2beb60){if(_0x2beb60){return{'count':_0x2beb60['count'],'rows':_[_0x36f7('0x31')](_0x2beb60[_0x36f7('0x48')],function(_0x1ded50){return{'membername':_0x1ded50[_0x36f7('0x2f')],'UserId':_0x1ded50['id'],'queue_name':_0xa256bd[_0x36f7('0x2f')],'FaxQueueId':_0xa256bd['id'],'interface':util[_0x36f7('0x63')](_0x36f7('0x64'),'SIP',_0x1ded50[_0x36f7('0x2f')]),'penalty':0x0,'paused':_0x1ded50[_0x36f7('0x61')],'createdAt':_0x1ded50[_0x36f7('0x65')],'updatedAt':_0x1ded50[_0x36f7('0x62')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x36f7('0x2a')](respondWithFilteredResult(_0x347fab,_0x427ac0))[_0x36f7('0x4d')](handleError(_0x347fab,null));};exports[_0x36f7('0x66')]=function(_0x439ea1,_0x52fef5,_0xab2a08){var _0x436f8a={};var _0xed0c35={};var _0x554fdc;var _0x4debb0;return db[_0x36f7('0x32')][_0x36f7('0x5a')]({'where':{'id':_0x439ea1[_0x36f7('0x4a')]['id']}})[_0x36f7('0x2a')](handleEntityNotFound(_0x52fef5,null))[_0x36f7('0x2a')](function(_0xa73c38){if(_0xa73c38){_0x554fdc=_0xa73c38;_0xed0c35[_0x36f7('0x37')]=_['keys'](db['Team'][_0x36f7('0x33')]);_0xed0c35['query']=_[_0x36f7('0x38')](_0x439ea1[_0x36f7('0x3a')]);_0xed0c35[_0x36f7('0x39')]=_[_0x36f7('0x3c')](_0xed0c35[_0x36f7('0x37')],_0xed0c35[_0x36f7('0x3a')]);_0x436f8a[_0x36f7('0x3b')]=_[_0x36f7('0x3c')](_0xed0c35['model'],qs[_0x36f7('0x3d')](_0x439ea1['query'][_0x36f7('0x3d')]));_0x436f8a[_0x36f7('0x3b')]=_0x436f8a[_0x36f7('0x3b')][_0x36f7('0x5b')]?_0x436f8a[_0x36f7('0x3b')]:_0xed0c35[_0x36f7('0x37')];_0x436f8a['order']=qs[_0x36f7('0x40')](_0x439ea1[_0x36f7('0x3a')][_0x36f7('0x40')]);_0x436f8a[_0x36f7('0x41')]=qs[_0x36f7('0x39')](_[_0x36f7('0x42')](_0x439ea1[_0x36f7('0x3a')],_0xed0c35[_0x36f7('0x39')]));if(_0x439ea1['query']['filter']){_0x436f8a[_0x36f7('0x41')]=_['merge'](_0x436f8a[_0x36f7('0x41')],{'$or':_[_0x36f7('0x31')](_0x436f8a[_0x36f7('0x3b')],function(_0xfee980){var _0x565fc1={};_0x565fc1[_0xfee980]={'$like':'%'+_0x439ea1['query'][_0x36f7('0x44')]+'%'};return _0x565fc1;})});}_0x436f8a=_['merge']({},_0x436f8a,_0x439ea1['options']);return _0x554fdc[_0x36f7('0x66')](_0x436f8a);}})[_0x36f7('0x2a')](function(_0x57d511){if(_0x57d511){_0x4debb0=_0x57d511[_0x36f7('0x5b')];if(!_0x439ea1[_0x36f7('0x3a')][_0x36f7('0x3e')](_0x36f7('0x67'))){_0x436f8a[_0x36f7('0x25')]=qs[_0x36f7('0x25')](_0x439ea1['query'][_0x36f7('0x25')]);_0x436f8a[_0x36f7('0x24')]=qs['offset'](_0x439ea1[_0x36f7('0x3a')][_0x36f7('0x24')]);}return _0x554fdc['getTeams'](_0x436f8a);}})[_0x36f7('0x2a')](function(_0x59a151){if(_0x59a151){return _0x59a151?{'count':_0x4debb0,'rows':_0x59a151}:null;}})[_0x36f7('0x2a')](respondWithResult(_0x52fef5,null))[_0x36f7('0x4d')](handleError(_0x52fef5,null));};exports['addTeams']=function(_0x1ec03f,_0x13650a,_0x5aca29){var _0x3f19d7=_0x1ec03f[_0x36f7('0x57')][_0x36f7('0x68')];return db[_0x36f7('0x69')]['findAll']({'where':{'id':_0x3f19d7},'attributes':['id'],'include':[{'model':db[_0x36f7('0x6a')],'as':'Agents','attributes':['id','name',_0x36f7('0x6b'),_0x36f7('0x6c'),_0x36f7('0x6d')],'raw':!![]}]})[_0x36f7('0x2a')](function(_0x3089b6){if(_0x3089b6){var _0x15feeb=_['flatMap'](_0x3089b6,function(_0x4e0ff0){var _0x20202f=_0x4e0ff0[_0x36f7('0x2b')]({'plain':!![]});return _0x20202f['Agents'];});return db['FaxQueue'][_0x36f7('0x53')]({'where':{'id':_0x1ec03f[_0x36f7('0x4a')]['id']}})[_0x36f7('0x2a')](function(_0x47aa74){return db['sequelize']['transaction'](function(_0x361261){return _0x47aa74[_0x36f7('0x6e')](_0x3f19d7,{'transaction':_0x361261})['then'](function(){return BPromise[_0x36f7('0x6f')](_0x15feeb,function(_0xfbc9f8){return db[_0x36f7('0x5d')][_0x36f7('0x70')]({'where':{'UserId':_0xfbc9f8['id'],'FaxQueueId':_0x1ec03f[_0x36f7('0x4a')]['id']},'transaction':_0x361261});});})[_0x36f7('0x2a')](function(){_0x15feeb[_0x36f7('0x71')](function(_0x498d1d){socket[_0x36f7('0x72')](_0x36f7('0x73'),{'UserId':_0x498d1d['id'],'FaxQueueId':_0x47aa74['id']});});});});});}})[_0x36f7('0x2a')](respondWithStatusCode(_0x13650a,null))[_0x36f7('0x4d')](handleError(_0x13650a,null));};exports[_0x36f7('0x74')]=function(_0x132073,_0x4f5ba1,_0x1d5ba1){return db[_0x36f7('0x69')][_0x36f7('0x47')]({'where':{'id':_0x132073[_0x36f7('0x3a')][_0x36f7('0x68')]},'attributes':['id'],'include':[{'model':db[_0x36f7('0x6a')],'as':_0x36f7('0x75'),'attributes':['id'],'raw':!![]}]})[_0x36f7('0x2a')](handleEntityNotFound(_0x4f5ba1,null))[_0x36f7('0x2a')](function(_0x44c3e5){var _0x2a5299=_[_0x36f7('0x31')](_0x44c3e5,'id');var _0x31c5ae=[];var _0x4d38a4=[];var _0x447920=squel[_0x36f7('0x76')]();_0x447920[_0x36f7('0x77')](_0x36f7('0x78'))[_0x36f7('0x79')](_0x36f7('0x7a'),'tq')['join']('user_has_teams','ut',_0x36f7('0x7b'))[_0x36f7('0x41')](_0x36f7('0x7c'),_0x132073[_0x36f7('0x4a')]['id']);for(var _0x571b27=0x0;_0x571b27<_0x44c3e5[_0x36f7('0x5b')];_0x571b27+=0x1){let _0x5a6328=_0x44c3e5[_0x571b27];for(var _0x262c0e=0x0;_0x262c0e<_0x5a6328[_0x36f7('0x75')][_0x36f7('0x5b')];_0x262c0e+=0x1){let _0x584442=_0x5a6328['Agents'][_0x262c0e];var _0x314952=_0x447920[_0x36f7('0x7d')]();_0x314952['where'](_0x36f7('0x7e'),_0x584442['id']);_0x4d38a4[_0x36f7('0x7f')](db[_0x36f7('0x80')][_0x36f7('0x3a')](_0x314952[_0x36f7('0x81')](),{'type':db[_0x36f7('0x80')]['QueryTypes'][_0x36f7('0x82')]})[_0x36f7('0x2a')](function(_0xa68294){if(_0xa68294[_0x36f7('0x5b')]===0x1){return _0x584442['id'];}else{var _0x4fb65d=_[_0x36f7('0x83')](_[_0x36f7('0x31')](_0xa68294,_0x36f7('0x84')),function(_0x4fc318){return _['includes'](_0x2a5299,_0x4fc318);});if(_0x4fb65d){return _0x584442['id'];}}}));}}return BPromise[_0x36f7('0x85')](_0x4d38a4)[_0x36f7('0x2a')](function(_0xa7ef51){_0x31c5ae=_(_0x31c5ae)['union'](_0xa7ef51)['compact']()[_0x36f7('0x86')]();return db[_0x36f7('0x32')][_0x36f7('0x53')]({'where':{'id':_0x132073['params']['id']}})['then'](function(_0x44ac8c){return db[_0x36f7('0x80')]['transaction'](function(_0xae9dce){return _0x44ac8c[_0x36f7('0x74')](_0x132073['query'][_0x36f7('0x68')],{'transaction':_0xae9dce})[_0x36f7('0x2a')](function(){if(!_[_0x36f7('0x87')](_0x31c5ae)){return _0x44ac8c[_0x36f7('0x88')](_0x31c5ae,{'transaction':_0xae9dce});}})[_0x36f7('0x2a')](function(){_0x31c5ae['forEach'](function(_0x184c9f){socket[_0x36f7('0x72')]('userFaxQueue:remove',{'UserId':_0x184c9f,'FaxQueueId':_0x44ac8c['id']});});});});});});})[_0x36f7('0x2a')](respondWithStatusCode(_0x4f5ba1,null))[_0x36f7('0x4d')](handleError(_0x4f5ba1,null));};exports[_0x36f7('0x89')]=function(_0x347220,_0x41cbd3,_0x5518ae){return db[_0x36f7('0x32')]['find']({'where':{'id':_0x347220[_0x36f7('0x4a')]['id']}})[_0x36f7('0x2a')](handleEntityNotFound(_0x41cbd3,null))['then'](function(_0x30ee68){if(_0x30ee68){return _0x30ee68['addAgents'](_0x347220[_0x36f7('0x57')][_0x36f7('0x68')],_['omit'](_0x347220[_0x36f7('0x57')],[_0x36f7('0x68'),'id'])||{})[_0x36f7('0x8a')](function(_0x1a499f){for(var _0x31a1f1=0x0;_0x31a1f1<_0x347220['body'][_0x36f7('0x68')]['length'];_0x31a1f1+=0x1){socket['emit'](_0x36f7('0x73'),{'UserId':Number(_0x347220[_0x36f7('0x57')]['ids'][_0x31a1f1]),'FaxQueueId':Number(_0x347220['params']['id'])});}return _0x1a499f;});}})[_0x36f7('0x2a')](respondWithResult(_0x41cbd3,null))[_0x36f7('0x4d')](handleError(_0x41cbd3,null));};exports[_0x36f7('0x88')]=function(_0x45c91c,_0x21c722,_0x242bae){return db[_0x36f7('0x32')]['find']({'where':{'id':_0x45c91c[_0x36f7('0x4a')]['id']}})[_0x36f7('0x2a')](handleEntityNotFound(_0x21c722,null))[_0x36f7('0x2a')](function(_0x3d4ae2){if(_0x3d4ae2){return _0x3d4ae2[_0x36f7('0x88')](_0x45c91c[_0x36f7('0x3a')][_0x36f7('0x68')])[_0x36f7('0x2a')](function(){if(_[_0x36f7('0x8b')](_0x45c91c[_0x36f7('0x3a')][_0x36f7('0x68')])){for(var _0x46b040=0x0;_0x46b040<_0x45c91c[_0x36f7('0x3a')][_0x36f7('0x68')][_0x36f7('0x5b')];_0x46b040+=0x1){socket[_0x36f7('0x72')](_0x36f7('0x8c'),{'UserId':Number(_0x45c91c[_0x36f7('0x3a')][_0x36f7('0x68')][_0x46b040]),'FaxQueueId':Number(_0x45c91c[_0x36f7('0x4a')]['id'])});}}else{socket['emit'](_0x36f7('0x8c'),{'UserId':Number(_0x45c91c[_0x36f7('0x3a')][_0x36f7('0x68')]),'FaxQueueId':Number(_0x45c91c[_0x36f7('0x4a')]['id'])});}});}})['then'](respondWithStatusCode(_0x21c722,null))['catch'](handleError(_0x21c722,null));};exports['getAgents']=function(_0xdab19b,_0x2166e2,_0x232f50){var _0x580aa6={};var _0x5872f4={};var _0xc29aff;var _0x29ccba;return db[_0x36f7('0x32')][_0x36f7('0x5a')]({'where':{'id':_0xdab19b['params']['id']}})[_0x36f7('0x2a')](handleEntityNotFound(_0x2166e2,null))['then'](function(_0x2d2c49){if(_0x2d2c49){_0xc29aff=_0x2d2c49;_0x5872f4[_0x36f7('0x37')]=_[_0x36f7('0x38')](db[_0x36f7('0x6a')][_0x36f7('0x33')]);_0x5872f4[_0x36f7('0x3a')]=_[_0x36f7('0x38')](_0xdab19b['query']);_0x5872f4[_0x36f7('0x39')]=_[_0x36f7('0x3c')](_0x5872f4['model'],_0x5872f4['query']);_0x580aa6[_0x36f7('0x3b')]=_[_0x36f7('0x3c')](_0x5872f4[_0x36f7('0x37')],qs[_0x36f7('0x3d')](_0xdab19b[_0x36f7('0x3a')]['fields']));_0x580aa6[_0x36f7('0x3b')]=_0x580aa6['attributes'][_0x36f7('0x5b')]?_0x580aa6[_0x36f7('0x3b')]:_0x5872f4[_0x36f7('0x37')];_0x580aa6[_0x36f7('0x3f')]=qs[_0x36f7('0x40')](_0xdab19b['query']['sort']);_0x580aa6[_0x36f7('0x41')]=qs[_0x36f7('0x39')](_['pick'](_0xdab19b[_0x36f7('0x3a')],_0x5872f4['filters']));if(_0xdab19b[_0x36f7('0x3a')][_0x36f7('0x44')]){_0x580aa6[_0x36f7('0x41')]=_['merge'](_0x580aa6['where'],{'$or':_['map'](_0x580aa6[_0x36f7('0x3b')],function(_0x1a0849){var _0x51698b={};_0x51698b[_0x1a0849]={'$like':'%'+_0xdab19b['query'][_0x36f7('0x44')]+'%'};return _0x51698b;})});}_0x580aa6=_[_0x36f7('0x45')]({},_0x580aa6,_0xdab19b[_0x36f7('0x4c')]);return _0xc29aff[_0x36f7('0x8d')](_0x580aa6);}})[_0x36f7('0x2a')](function(_0x38cb91){if(_0x38cb91){_0x29ccba=_0x38cb91[_0x36f7('0x5b')];if(!_0xdab19b[_0x36f7('0x3a')][_0x36f7('0x3e')](_0x36f7('0x67'))){_0x580aa6[_0x36f7('0x25')]=qs[_0x36f7('0x25')](_0xdab19b[_0x36f7('0x3a')][_0x36f7('0x25')]);_0x580aa6[_0x36f7('0x24')]=qs['offset'](_0xdab19b[_0x36f7('0x3a')][_0x36f7('0x24')]);}return _0xc29aff[_0x36f7('0x8d')](_0x580aa6);}})[_0x36f7('0x2a')](function(_0x571530){if(_0x571530){return _0x571530?{'count':_0x29ccba,'rows':_0x571530}:null;}})[_0x36f7('0x2a')](respondWithResult(_0x2166e2,null))[_0x36f7('0x4d')](handleError(_0x2166e2,null));}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.events.js b/server/api/faxQueue/faxQueue.events.js index 9150826..c36ea4a 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 _0x10fb=['save','update','remove','emit','hasOwnProperty','exports','events','setMaxListeners'];(function(_0x2cd93e,_0x58acfd){var _0x36a294=function(_0x483caf){while(--_0x483caf){_0x2cd93e['push'](_0x2cd93e['shift']());}};_0x36a294(++_0x58acfd);}(_0x10fb,0xe6));var _0xb10f=function(_0x3a3e30,_0x5996b5){_0x3a3e30=_0x3a3e30-0x0;var _0x19f849=_0x10fb[_0x3a3e30];return _0x19f849;};'use strict';var EventEmitter=require(_0xb10f('0x0'));var FaxQueue=require('../../mysqldb')['db']['FaxQueue'];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0xb10f('0x1')](0x0);var events={'afterCreate':_0xb10f('0x2'),'afterUpdate':_0xb10f('0x3'),'afterDestroy':_0xb10f('0x4')};function emitEvent(_0x2b6e43){return function(_0x59743a,_0x3ed8c8,_0x541411){FaxQueueEvents[_0xb10f('0x5')](_0x2b6e43+':'+_0x59743a['id'],_0x59743a);FaxQueueEvents[_0xb10f('0x5')](_0x2b6e43,_0x59743a);_0x541411(null);};}for(var e in events){if(events[_0xb10f('0x6')](e)){var event=events[e];FaxQueue['hook'](e,emitEvent(event));}}module[_0xb10f('0x7')]=FaxQueueEvents; \ No newline at end of file +var _0x445e=['exports','../../mysqldb','save','update','remove','emit','hasOwnProperty','hook'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x445e,0x1e1));var _0xe445=function(_0x1d086b,_0x46c897){_0x1d086b=_0x1d086b-0x0;var _0x5f4bee=_0x445e[_0x1d086b];return _0x5f4bee;};'use strict';var EventEmitter=require('events');var FaxQueue=require(_0xe445('0x0'))['db']['FaxQueue'];var FaxQueueEvents=new EventEmitter();FaxQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xe445('0x1'),'afterUpdate':_0xe445('0x2'),'afterDestroy':_0xe445('0x3')};function emitEvent(_0x51d085){return function(_0x2dbec4,_0x42e0d6,_0x12d7ee){FaxQueueEvents[_0xe445('0x4')](_0x51d085+':'+_0x2dbec4['id'],_0x2dbec4);FaxQueueEvents['emit'](_0x51d085,_0x2dbec4);_0x12d7ee(null);};}for(var e in events){if(events[_0xe445('0x5')](e)){var event=events[e];FaxQueue[_0xe445('0x6')](e,emitEvent(event));}}module[_0xe445('0x7')]=FaxQueueEvents; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.model.js b/server/api/faxQueue/faxQueue.model.js index f2a9066..84faafc 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 _0xba58=['./faxQueue.attributes','define','FaxQueue','fax_queues','lodash','util','api','moment','path','../../config/environment'];(function(_0x10494e,_0x3fa2fc){var _0x52cbd7=function(_0x7c54a3){while(--_0x7c54a3){_0x10494e['push'](_0x10494e['shift']());}};_0x52cbd7(++_0x3fa2fc);}(_0xba58,0x112));var _0x8ba5=function(_0x42d984,_0x4813c6){_0x42d984=_0x42d984-0x0;var _0x3df18b=_0xba58[_0x42d984];return _0x3df18b;};'use strict';var _=require(_0x8ba5('0x0'));var util=require(_0x8ba5('0x1'));var logger=require('../../config/logger')(_0x8ba5('0x2'));var moment=require(_0x8ba5('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x8ba5('0x4'));var rimraf=require('rimraf');var config=require(_0x8ba5('0x5'));var attributes=require(_0x8ba5('0x6'));module['exports']=function(_0x764eb0,_0x3c55de){return _0x764eb0[_0x8ba5('0x7')](_0x8ba5('0x8'),attributes,{'tableName':_0x8ba5('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2068=['fax_queues','../../config/logger','api','moment','bluebird','request-promise','../../config/environment','exports','define','FaxQueue'];(function(_0x17e674,_0x3c8f35){var _0x2bb0a9=function(_0x1d8286){while(--_0x1d8286){_0x17e674['push'](_0x17e674['shift']());}};_0x2bb0a9(++_0x3c8f35);}(_0x2068,0x1a5));var _0x8206=function(_0x55a787,_0x1466a3){_0x55a787=_0x55a787-0x0;var _0x5d90a0=_0x2068[_0x55a787];return _0x5d90a0;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x8206('0x0'))(_0x8206('0x1'));var moment=require(_0x8206('0x2'));var BPromise=require(_0x8206('0x3'));var rp=require(_0x8206('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x8206('0x5'));var attributes=require('./faxQueue.attributes');module[_0x8206('0x6')]=function(_0x436f68,_0x2b28c1){return _0x436f68[_0x8206('0x7')](_0x8206('0x8'),attributes,{'tableName':_0x8206('0x9'),'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 55b27ef..7b86d48 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 _0x5bc3=['result','catch','FaxQueue','options','raw','where','attributes','limit','include','map','model','then','GetFaxQueue','ShowFaxQueue','find','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','socket.io-emitter','redis','./faxQueue.socket','register','request','info','FaxQueue,\x20%s,\x20%s','debug','FaxQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message'];(function(_0x138adb,_0x193fee){var _0x1b27f2=function(_0x5e97a2){while(--_0x5e97a2){_0x138adb['push'](_0x138adb['shift']());}};_0x1b27f2(++_0x193fee);}(_0x5bc3,0xf9));var _0x35bc=function(_0x323576,_0x83b9fa){_0x323576=_0x323576-0x0;var _0xfbe143=_0x5bc3[_0x323576];return _0xfbe143;};'use strict';var _=require(_0x35bc('0x0'));var util=require(_0x35bc('0x1'));var moment=require(_0x35bc('0x2'));var BPromise=require(_0x35bc('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x35bc('0x4'));var db=require(_0x35bc('0x5'))['db'];var utils=require(_0x35bc('0x6'));var logger=require(_0x35bc('0x7'))(_0x35bc('0x8'));var config=require(_0x35bc('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x35bc('0xa')]({'port':0x232a});config['redis']=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x35bc('0xb'))(new Redis(config[_0x35bc('0xc')]));require(_0x35bc('0xd'))[_0x35bc('0xe')](socket);function respondWithRpcPromise(_0x466b83,_0x474df7,_0x454252){return new BPromise(function(_0x67a6a5,_0x1b1619){return client[_0x35bc('0xf')](_0x466b83,_0x454252)['then'](function(_0x39c966){logger[_0x35bc('0x10')](_0x35bc('0x11'),_0x474df7,'request\x20sent');logger[_0x35bc('0x12')](_0x35bc('0x13'),_0x474df7,_0x35bc('0x14'),JSON[_0x35bc('0x15')](_0x39c966));if(_0x39c966['error']){if(_0x39c966['error']['code']===0x1f4){logger[_0x35bc('0x16')](_0x35bc('0x11'),_0x474df7,_0x39c966[_0x35bc('0x16')][_0x35bc('0x17')]);return _0x1b1619(_0x39c966[_0x35bc('0x16')][_0x35bc('0x17')]);}logger[_0x35bc('0x16')](_0x35bc('0x11'),_0x474df7,_0x39c966[_0x35bc('0x16')][_0x35bc('0x17')]);return _0x67a6a5(_0x39c966['error'][_0x35bc('0x17')]);}else{logger['info'](_0x35bc('0x11'),_0x474df7,'request\x20sent');_0x67a6a5(_0x39c966[_0x35bc('0x18')][_0x35bc('0x17')]);}})[_0x35bc('0x19')](function(_0x4e7258){logger[_0x35bc('0x16')](_0x35bc('0x11'),_0x474df7,_0x4e7258);_0x1b1619(_0x4e7258);});});}exports['GetFaxQueue']=function(_0x5e527d){var _0x29eb89=this;return new Promise(function(_0x3cb83a,_0x58510f){return db[_0x35bc('0x1a')]['findAll']({'raw':_0x5e527d['options']?_0x5e527d[_0x35bc('0x1b')][_0x35bc('0x1c')]===undefined?!![]:![]:!![],'where':_0x5e527d[_0x35bc('0x1b')]?_0x5e527d[_0x35bc('0x1b')][_0x35bc('0x1d')]||null:null,'attributes':_0x5e527d[_0x35bc('0x1b')]?_0x5e527d[_0x35bc('0x1b')][_0x35bc('0x1e')]||null:null,'limit':_0x5e527d[_0x35bc('0x1b')]?_0x5e527d[_0x35bc('0x1b')][_0x35bc('0x1f')]||null:null,'include':_0x5e527d[_0x35bc('0x1b')]?_0x5e527d[_0x35bc('0x1b')][_0x35bc('0x20')]?_[_0x35bc('0x21')](_0x5e527d['options'][_0x35bc('0x20')],function(_0x58a769){return{'model':db[_0x58a769[_0x35bc('0x22')]],'as':_0x58a769['as'],'attributes':_0x58a769[_0x35bc('0x1e')],'include':_0x58a769[_0x35bc('0x20')]?_['map'](_0x58a769['include'],function(_0x5ac3f7){return{'model':db[_0x5ac3f7[_0x35bc('0x22')]],'as':_0x5ac3f7['as'],'attributes':_0x5ac3f7[_0x35bc('0x1e')],'include':_0x5ac3f7[_0x35bc('0x20')]?_[_0x35bc('0x21')](_0x5ac3f7[_0x35bc('0x20')],function(_0x473b36){return{'model':db[_0x473b36[_0x35bc('0x22')]],'as':_0x473b36['as'],'attributes':_0x473b36[_0x35bc('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x35bc('0x23')](function(_0x1b099e){logger[_0x35bc('0x10')]('GetFaxQueue',_0x5e527d);logger[_0x35bc('0x12')](_0x35bc('0x24'),_0x5e527d,JSON[_0x35bc('0x15')](_0x1b099e));_0x3cb83a(_0x1b099e);})['catch'](function(_0x418586){logger['error'](_0x35bc('0x24'),_0x418586[_0x35bc('0x17')],_0x5e527d);_0x58510f(_0x29eb89[_0x35bc('0x16')](0x1f4,_0x418586[_0x35bc('0x17')]));});});};exports[_0x35bc('0x25')]=function(_0x4293c9){var _0x32c1c4=this;return new Promise(function(_0x4ce53d,_0x15425b){return db[_0x35bc('0x1a')][_0x35bc('0x26')]({'raw':_0x4293c9[_0x35bc('0x1b')]?_0x4293c9[_0x35bc('0x1b')][_0x35bc('0x1c')]===undefined?!![]:![]:!![],'where':_0x4293c9[_0x35bc('0x1b')]?_0x4293c9[_0x35bc('0x1b')][_0x35bc('0x1d')]||null:null,'attributes':_0x4293c9[_0x35bc('0x1b')]?_0x4293c9[_0x35bc('0x1b')][_0x35bc('0x1e')]||null:null,'include':_0x4293c9['options']?_0x4293c9[_0x35bc('0x1b')][_0x35bc('0x20')]?_[_0x35bc('0x21')](_0x4293c9[_0x35bc('0x1b')]['include'],function(_0x8a1062){return{'model':db[_0x8a1062[_0x35bc('0x22')]],'as':_0x8a1062['as'],'attributes':_0x8a1062[_0x35bc('0x1e')],'include':_0x8a1062[_0x35bc('0x20')]?_[_0x35bc('0x21')](_0x8a1062[_0x35bc('0x20')],function(_0xd14fee){return{'model':db[_0xd14fee[_0x35bc('0x22')]],'as':_0xd14fee['as'],'attributes':_0xd14fee[_0x35bc('0x1e')],'include':_0xd14fee['include']?_[_0x35bc('0x21')](_0xd14fee['include'],function(_0x1e9179){return{'model':db[_0x1e9179[_0x35bc('0x22')]],'as':_0x1e9179['as'],'attributes':_0x1e9179[_0x35bc('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x35bc('0x23')](function(_0x5f905c){logger[_0x35bc('0x10')]('ShowFaxQueue',_0x4293c9);logger[_0x35bc('0x12')](_0x35bc('0x25'),_0x4293c9,JSON['stringify'](_0x5f905c));_0x4ce53d(_0x5f905c);})['catch'](function(_0x4642c7){logger[_0x35bc('0x16')]('ShowFaxQueue',_0x4642c7['message'],_0x4293c9);_0x15425b(_0x32c1c4[_0x35bc('0x16')](0x1f4,_0x4642c7[_0x35bc('0x17')]));});});}; \ No newline at end of file +var _0x1c4e=['debug','FaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','GetFaxQueue','options','raw','limit','include','map','model','attributes','FaxQueue','find','ShowFaxQueue','lodash','moment','bluebird','ioredis','../../config/utils','../../config/environment','jayson/promise','http','defaults','redis','localhost','socket.io-emitter','./faxQueue.socket','register','request','then','info','FaxQueue,\x20%s,\x20%s','request\x20sent'];(function(_0xad4203,_0x5c5fc5){var _0x455ee1=function(_0x44fd8d){while(--_0x44fd8d){_0xad4203['push'](_0xad4203['shift']());}};_0x455ee1(++_0x5c5fc5);}(_0x1c4e,0x1f3));var _0xe1c4=function(_0x5dac37,_0x430287){_0x5dac37=_0x5dac37-0x0;var _0x4cb576=_0x1c4e[_0x5dac37];return _0x4cb576;};'use strict';var _=require(_0xe1c4('0x0'));var util=require('util');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('../../mysqldb')['db'];var utils=require(_0xe1c4('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0xe1c4('0x5'));var jayson=require(_0xe1c4('0x6'));var client=jayson['client'][_0xe1c4('0x7')]({'port':0x232a});config['redis']=_[_0xe1c4('0x8')](config[_0xe1c4('0x9')],{'host':_0xe1c4('0xa'),'port':0x18eb});var socket=require(_0xe1c4('0xb'))(new Redis(config[_0xe1c4('0x9')]));require(_0xe1c4('0xc'))[_0xe1c4('0xd')](socket);function respondWithRpcPromise(_0x27e340,_0x3f935e,_0x2db7fa){return new BPromise(function(_0x140d24,_0x3edf46){return client[_0xe1c4('0xe')](_0x27e340,_0x2db7fa)[_0xe1c4('0xf')](function(_0x4f419f){logger[_0xe1c4('0x10')](_0xe1c4('0x11'),_0x3f935e,_0xe1c4('0x12'));logger[_0xe1c4('0x13')](_0xe1c4('0x14'),_0x3f935e,_0xe1c4('0x12'),JSON[_0xe1c4('0x15')](_0x4f419f));if(_0x4f419f[_0xe1c4('0x16')]){if(_0x4f419f[_0xe1c4('0x16')]['code']===0x1f4){logger['error'](_0xe1c4('0x11'),_0x3f935e,_0x4f419f[_0xe1c4('0x16')][_0xe1c4('0x17')]);return _0x3edf46(_0x4f419f[_0xe1c4('0x16')][_0xe1c4('0x17')]);}logger[_0xe1c4('0x16')](_0xe1c4('0x11'),_0x3f935e,_0x4f419f[_0xe1c4('0x16')][_0xe1c4('0x17')]);return _0x140d24(_0x4f419f[_0xe1c4('0x16')][_0xe1c4('0x17')]);}else{logger[_0xe1c4('0x10')](_0xe1c4('0x11'),_0x3f935e,_0xe1c4('0x12'));_0x140d24(_0x4f419f[_0xe1c4('0x18')]['message']);}})[_0xe1c4('0x19')](function(_0x4f9954){logger[_0xe1c4('0x16')](_0xe1c4('0x11'),_0x3f935e,_0x4f9954);_0x3edf46(_0x4f9954);});});}exports[_0xe1c4('0x1a')]=function(_0x41d5d7){var _0x22a6c0=this;return new Promise(function(_0x3e19e4,_0x8307ce){return db['FaxQueue']['findAll']({'raw':_0x41d5d7['options']?_0x41d5d7[_0xe1c4('0x1b')][_0xe1c4('0x1c')]===undefined?!![]:![]:!![],'where':_0x41d5d7[_0xe1c4('0x1b')]?_0x41d5d7[_0xe1c4('0x1b')]['where']||null:null,'attributes':_0x41d5d7[_0xe1c4('0x1b')]?_0x41d5d7[_0xe1c4('0x1b')]['attributes']||null:null,'limit':_0x41d5d7[_0xe1c4('0x1b')]?_0x41d5d7[_0xe1c4('0x1b')][_0xe1c4('0x1d')]||null:null,'include':_0x41d5d7[_0xe1c4('0x1b')]?_0x41d5d7[_0xe1c4('0x1b')][_0xe1c4('0x1e')]?_[_0xe1c4('0x1f')](_0x41d5d7[_0xe1c4('0x1b')][_0xe1c4('0x1e')],function(_0xb2387e){return{'model':db[_0xb2387e[_0xe1c4('0x20')]],'as':_0xb2387e['as'],'attributes':_0xb2387e[_0xe1c4('0x21')],'include':_0xb2387e[_0xe1c4('0x1e')]?_['map'](_0xb2387e['include'],function(_0x3ae3a0){return{'model':db[_0x3ae3a0[_0xe1c4('0x20')]],'as':_0x3ae3a0['as'],'attributes':_0x3ae3a0[_0xe1c4('0x21')],'include':_0x3ae3a0[_0xe1c4('0x1e')]?_[_0xe1c4('0x1f')](_0x3ae3a0[_0xe1c4('0x1e')],function(_0x47a202){return{'model':db[_0x47a202[_0xe1c4('0x20')]],'as':_0x47a202['as'],'attributes':_0x47a202['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x4c80fd){logger['info'](_0xe1c4('0x1a'),_0x41d5d7);logger['debug'](_0xe1c4('0x1a'),_0x41d5d7,JSON[_0xe1c4('0x15')](_0x4c80fd));_0x3e19e4(_0x4c80fd);})[_0xe1c4('0x19')](function(_0x5ec7b1){logger[_0xe1c4('0x16')]('GetFaxQueue',_0x5ec7b1['message'],_0x41d5d7);_0x8307ce(_0x22a6c0[_0xe1c4('0x16')](0x1f4,_0x5ec7b1[_0xe1c4('0x17')]));});});};exports['ShowFaxQueue']=function(_0x2b0af6){var _0x2a01d8=this;return new Promise(function(_0x38dee2,_0x2c03e5){return db[_0xe1c4('0x22')][_0xe1c4('0x23')]({'raw':_0x2b0af6[_0xe1c4('0x1b')]?_0x2b0af6['options'][_0xe1c4('0x1c')]===undefined?!![]:![]:!![],'where':_0x2b0af6['options']?_0x2b0af6[_0xe1c4('0x1b')]['where']||null:null,'attributes':_0x2b0af6[_0xe1c4('0x1b')]?_0x2b0af6['options'][_0xe1c4('0x21')]||null:null,'include':_0x2b0af6[_0xe1c4('0x1b')]?_0x2b0af6[_0xe1c4('0x1b')][_0xe1c4('0x1e')]?_[_0xe1c4('0x1f')](_0x2b0af6['options']['include'],function(_0x4cfa74){return{'model':db[_0x4cfa74['model']],'as':_0x4cfa74['as'],'attributes':_0x4cfa74[_0xe1c4('0x21')],'include':_0x4cfa74[_0xe1c4('0x1e')]?_['map'](_0x4cfa74[_0xe1c4('0x1e')],function(_0x19e468){return{'model':db[_0x19e468[_0xe1c4('0x20')]],'as':_0x19e468['as'],'attributes':_0x19e468[_0xe1c4('0x21')],'include':_0x19e468[_0xe1c4('0x1e')]?_[_0xe1c4('0x1f')](_0x19e468[_0xe1c4('0x1e')],function(_0x3ca4c7){return{'model':db[_0x3ca4c7['model']],'as':_0x3ca4c7['as'],'attributes':_0x3ca4c7[_0xe1c4('0x21')]};}):[]};}):[]};}):[]:[]})[_0xe1c4('0xf')](function(_0x55be42){logger['info']('ShowFaxQueue',_0x2b0af6);logger['debug'](_0xe1c4('0x24'),_0x2b0af6,JSON[_0xe1c4('0x15')](_0x55be42));_0x38dee2(_0x55be42);})[_0xe1c4('0x19')](function(_0x257997){logger[_0xe1c4('0x16')](_0xe1c4('0x24'),_0x257997['message'],_0x2b0af6);_0x2c03e5(_0x2a01d8[_0xe1c4('0x16')](0x1f4,_0x257997[_0xe1c4('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.socket.js b/server/api/faxQueue/faxQueue.socket.js index c6f1c11..21a6c5d 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 _0xd337=['removeListener','register','length','./faxQueue.events','save','remove','update','emit'];(function(_0x3f57c0,_0x522a3a){var _0x4aa216=function(_0x32a4ca){while(--_0x32a4ca){_0x3f57c0['push'](_0x3f57c0['shift']());}};_0x4aa216(++_0x522a3a);}(_0xd337,0xc3));var _0x7d33=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd337[_0x3dd15e];return _0x231fd0;};'use strict';var FaxQueueEvents=require(_0x7d33('0x0'));var events=[_0x7d33('0x1'),_0x7d33('0x2'),_0x7d33('0x3')];function createListener(_0x1bf6d1,_0x1aad0f){return function(_0x15a9b2){_0x1aad0f[_0x7d33('0x4')](_0x1bf6d1,_0x15a9b2);};}function removeListener(_0x5bdfa4,_0x2a185b){return function(){FaxQueueEvents[_0x7d33('0x5')](_0x5bdfa4,_0x2a185b);};}exports[_0x7d33('0x6')]=function(_0xad1047){for(var _0x2774ef=0x0,_0x360bd5=events[_0x7d33('0x7')];_0x2774ef<_0x360bd5;_0x2774ef++){var _0xe48785=events[_0x2774ef];var _0x3ebff5=createListener('faxQueue:'+_0xe48785,_0xad1047);FaxQueueEvents['on'](_0xe48785,_0x3ebff5);}}; \ No newline at end of file +var _0x7fcf=['length','faxQueue:','./faxQueue.events','save','update','emit','register'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x7fcf,0x128));var _0xf7fc=function(_0x543084,_0x4337f5){_0x543084=_0x543084-0x0;var _0x306a57=_0x7fcf[_0x543084];return _0x306a57;};'use strict';var FaxQueueEvents=require(_0xf7fc('0x0'));var events=[_0xf7fc('0x1'),'remove',_0xf7fc('0x2')];function createListener(_0x2f23a7,_0x51f612){return function(_0x4a9be3){_0x51f612[_0xf7fc('0x3')](_0x2f23a7,_0x4a9be3);};}function removeListener(_0xa754e7,_0x5d294a){return function(){FaxQueueEvents['removeListener'](_0xa754e7,_0x5d294a);};}exports[_0xf7fc('0x4')]=function(_0x2f6173){for(var _0x4c75b2=0x0,_0x4ffe98=events[_0xf7fc('0x5')];_0x4c75b2<_0x4ffe98;_0x4c75b2++){var _0x41533d=events[_0x4c75b2];var _0x283e9b=createListener(_0xf7fc('0x6')+_0x41533d,_0x2f6173);FaxQueueEvents['on'](_0x41533d,_0x283e9b);}}; \ No newline at end of file diff --git a/server/api/faxQueue/index.js b/server/api/faxQueue/index.js index e5b38dc..24f5bde 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 _0x2675=['index','/describe','describe','/:id/members','/:id/users','getAgents','post','create','/:id/teams','addTeams','put','/:id','update','delete','destroy','removeTeams','exports','multer','express','Router','../../components/auth/service','../../components/interaction/service','./faxQueue.controller','get','isAuthenticated'];(function(_0x4c24d2,_0x33b0e3){var _0x26abf3=function(_0x2b5622){while(--_0x2b5622){_0x4c24d2['push'](_0x4c24d2['shift']());}};_0x26abf3(++_0x33b0e3);}(_0x2675,0x75));var _0x5267=function(_0x2cd7eb,_0x14c73a){_0x2cd7eb=_0x2cd7eb-0x0;var _0x3a4a0e=_0x2675[_0x2cd7eb];return _0x3a4a0e;};'use strict';var multer=require(_0x5267('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x5267('0x1'));var router=express[_0x5267('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x5267('0x3'));var interaction=require(_0x5267('0x4'));var config=require('../../config/environment');var controller=require(_0x5267('0x5'));router[_0x5267('0x6')]('/',auth[_0x5267('0x7')](),controller[_0x5267('0x8')]);router[_0x5267('0x6')](_0x5267('0x9'),auth['isAuthenticated'](),controller[_0x5267('0xa')]);router[_0x5267('0x6')]('/:id',auth[_0x5267('0x7')](),controller['show']);router[_0x5267('0x6')](_0x5267('0xb'),auth[_0x5267('0x7')](),controller['getMembers']);router[_0x5267('0x6')]('/:id/teams',auth[_0x5267('0x7')](),controller['getTeams']);router[_0x5267('0x6')](_0x5267('0xc'),auth[_0x5267('0x7')](),controller[_0x5267('0xd')]);router[_0x5267('0xe')]('/',auth[_0x5267('0x7')](),controller[_0x5267('0xf')]);router[_0x5267('0xe')](_0x5267('0x10'),auth[_0x5267('0x7')](),controller[_0x5267('0x11')]);router[_0x5267('0xe')](_0x5267('0xc'),auth['isAuthenticated'](),controller['addAgents']);router[_0x5267('0x12')](_0x5267('0x13'),auth[_0x5267('0x7')](),controller[_0x5267('0x14')]);router[_0x5267('0x15')](_0x5267('0x13'),auth[_0x5267('0x7')](),controller[_0x5267('0x16')]);router[_0x5267('0x15')](_0x5267('0x10'),auth[_0x5267('0x7')](),controller[_0x5267('0x17')]);router['delete'](_0x5267('0xc'),auth[_0x5267('0x7')](),controller['removeAgents']);module[_0x5267('0x18')]=router; \ No newline at end of file +var _0x741c=['getMembers','/:id/teams','getTeams','post','create','addTeams','addAgents','put','destroy','delete','removeTeams','/:id/users','removeAgents','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','./faxQueue.controller','get','isAuthenticated','index','/describe','/:id','show'];(function(_0x213f49,_0x7eacb7){var _0x124559=function(_0x21b027){while(--_0x21b027){_0x213f49['push'](_0x213f49['shift']());}};_0x124559(++_0x7eacb7);}(_0x741c,0x196));var _0xc741=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x741c[_0x40a045];return _0x1a687c;};'use strict';var multer=require(_0xc741('0x0'));var util=require(_0xc741('0x1'));var path=require(_0xc741('0x2'));var timeout=require(_0xc741('0x3'));var express=require(_0xc741('0x4'));var router=express[_0xc741('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xc741('0x6'));var config=require('../../config/environment');var controller=require(_0xc741('0x7'));router[_0xc741('0x8')]('/',auth[_0xc741('0x9')](),controller[_0xc741('0xa')]);router[_0xc741('0x8')](_0xc741('0xb'),auth[_0xc741('0x9')](),controller['describe']);router[_0xc741('0x8')](_0xc741('0xc'),auth['isAuthenticated'](),controller[_0xc741('0xd')]);router['get']('/:id/members',auth[_0xc741('0x9')](),controller[_0xc741('0xe')]);router[_0xc741('0x8')](_0xc741('0xf'),auth[_0xc741('0x9')](),controller[_0xc741('0x10')]);router[_0xc741('0x8')]('/:id/users',auth['isAuthenticated'](),controller['getAgents']);router[_0xc741('0x11')]('/',auth[_0xc741('0x9')](),controller[_0xc741('0x12')]);router[_0xc741('0x11')](_0xc741('0xf'),auth['isAuthenticated'](),controller[_0xc741('0x13')]);router[_0xc741('0x11')]('/:id/users',auth[_0xc741('0x9')](),controller[_0xc741('0x14')]);router[_0xc741('0x15')](_0xc741('0xc'),auth[_0xc741('0x9')](),controller['update']);router['delete'](_0xc741('0xc'),auth['isAuthenticated'](),controller[_0xc741('0x16')]);router[_0xc741('0x17')]('/:id/teams',auth['isAuthenticated'](),controller[_0xc741('0x18')]);router[_0xc741('0x17')](_0xc741('0x19'),auth['isAuthenticated'](),controller[_0xc741('0x1a')]);module[_0xc741('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 f536a78..2ce8c03 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 _0xf2d7=['DATE','moment','exports','STRING'];(function(_0x1b3b41,_0x78bcf7){var _0x3b05da=function(_0x3b593a){while(--_0x3b593a){_0x1b3b41['push'](_0x1b3b41['shift']());}};_0x3b05da(++_0x78bcf7);}(_0xf2d7,0x121));var _0x7f2d=function(_0x4d8814,_0x566228){_0x4d8814=_0x4d8814-0x0;var _0x222fc2=_0xf2d7[_0x4d8814];return _0x222fc2;};'use strict';var moment=require(_0x7f2d('0x0'));var Sequelize=require('sequelize');module[_0x7f2d('0x1')]={'uniqueid':{'type':Sequelize[_0x7f2d('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x7f2d('0x2')]},'joinAt':{'type':Sequelize[_0x7f2d('0x3')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0x7f2d('0x2')]}}; \ No newline at end of file +var _0x5da0=['STRING','DATE','moment','exports'];(function(_0x3ebcde,_0x55cc41){var _0x278c97=function(_0x371127){while(--_0x371127){_0x3ebcde['push'](_0x3ebcde['shift']());}};_0x278c97(++_0x55cc41);}(_0x5da0,0x1be));var _0x05da=function(_0x5e371a,_0x41ec81){_0x5e371a=_0x5e371a-0x0;var _0x14f313=_0x5da0[_0x5e371a];return _0x14f313;};'use strict';var moment=require(_0x05da('0x0'));var Sequelize=require('sequelize');module[_0x05da('0x1')]={'uniqueid':{'type':Sequelize[_0x05da('0x2')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x05da('0x3')]},'acceptAt':{'type':Sequelize[_0x05da('0x3')]},'exitAt':{'type':Sequelize[_0x05da('0x3')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.controller.js b/server/api/faxQueueReport/faxQueueReport.controller.js index 1c46009..5656fb3 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 _0xc820=['intersection','fields','attributes','length','nolimit','order','sort','pick','filter','merge','where','VIRTUAL','options','FaxQueueReport','includeAll','include','catch','show','params','find','create','body','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','offset','limit','undefined','Content-Range','apply','save','update','then','destroy','sendStatus','name','send','index','rawAttributes','type','key','model','map','query','keys','filters'];(function(_0xce49f7,_0x312346){var _0xd52da4=function(_0x14c17c){while(--_0x14c17c){_0xce49f7['push'](_0xce49f7['shift']());}};_0xd52da4(++_0x312346);}(_0xc820,0x13f));var _0x0c82=function(_0x2064e5,_0xd75a8d){_0x2064e5=_0x2064e5-0x0;var _0x37e2f7=_0xc820[_0x2064e5];return _0x37e2f7;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0c82('0x0'));var zipdir=require(_0x0c82('0x1'));var jsonpatch=require(_0x0c82('0x2'));var rp=require(_0x0c82('0x3'));var moment=require(_0x0c82('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x0c82('0x5'));var util=require('util');var path=require(_0x0c82('0x6'));var sox=require(_0x0c82('0x7'));var csv=require(_0x0c82('0x8'));var ejs=require(_0x0c82('0x9'));var fs=require('fs');var fs_extra=require(_0x0c82('0xa'));var _=require(_0x0c82('0xb'));var squel=require(_0x0c82('0xc'));var crypto=require(_0x0c82('0xd'));var jsforce=require(_0x0c82('0xe'));var deskjs=require(_0x0c82('0xf'));var toCsv=require(_0x0c82('0x8'));var querystring=require(_0x0c82('0x10'));var Papa=require(_0x0c82('0x11'));var Redis=require(_0x0c82('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x0c82('0x13'));var as=require(_0x0c82('0x14'));var hardwareService=require(_0x0c82('0x15'));var logger=require(_0x0c82('0x16'))(_0x0c82('0x17'));var utils=require(_0x0c82('0x18'));var config=require(_0x0c82('0x19'));var licenseUtil=require(_0x0c82('0x1a'));var db=require(_0x0c82('0x1b'))['db'];function respondWithStatusCode(_0x1e8188,_0x505706){_0x505706=_0x505706||0xcc;return function(_0xc9a01b){if(_0xc9a01b){return _0x1e8188['sendStatus'](_0x505706);}return _0x1e8188['status'](_0x505706)[_0x0c82('0x1c')]();};}function respondWithResult(_0x9074e7,_0x3e1ff8){_0x3e1ff8=_0x3e1ff8||0xc8;return function(_0x1bf511){if(_0x1bf511){return _0x9074e7[_0x0c82('0x1d')](_0x3e1ff8)['json'](_0x1bf511);}};}function respondWithFilteredResult(_0x4610e5,_0x17376c){return function(_0x693427){if(_0x693427){var _0x54caf2=typeof _0x17376c[_0x0c82('0x1e')]==='undefined'&&typeof _0x17376c[_0x0c82('0x1f')]===_0x0c82('0x20');var _0xc12162=_0x693427['count'];var _0x53d28f=_0x54caf2?0x0:_0x17376c[_0x0c82('0x1e')];var _0x3dbfd1=_0x54caf2?_0x693427['count']:_0x17376c[_0x0c82('0x1e')]+_0x17376c['limit'];var _0x2f8ecb;if(_0x3dbfd1>=_0xc12162){_0x3dbfd1=_0xc12162;_0x2f8ecb=0xc8;}else{_0x2f8ecb=0xce;}_0x4610e5[_0x0c82('0x1d')](_0x2f8ecb);return _0x4610e5['set'](_0x0c82('0x21'),_0x53d28f+'-'+_0x3dbfd1+'/'+_0xc12162)['json'](_0x693427);}return null;};}function patchUpdates(_0x3ec9aa){return function(_0x55e106){try{jsonpatch[_0x0c82('0x22')](_0x55e106,_0x3ec9aa,!![]);}catch(_0x13a61d){return BPromise['reject'](_0x13a61d);}return _0x55e106[_0x0c82('0x23')]();};}function saveUpdates(_0x1eb3d3,_0x8a6e02){return function(_0x4a4a04){if(_0x4a4a04){return _0x4a4a04[_0x0c82('0x24')](_0x1eb3d3)[_0x0c82('0x25')](function(_0xaa834){return _0xaa834;});}return null;};}function removeEntity(_0x1d2691,_0x514993){return function(_0x2bcc7f){if(_0x2bcc7f){return _0x2bcc7f[_0x0c82('0x26')]()[_0x0c82('0x25')](function(){_0x1d2691[_0x0c82('0x1d')](0xcc)[_0x0c82('0x1c')]();});}};}function handleEntityNotFound(_0x1ba2bd,_0x807d12){return function(_0x590553){if(!_0x590553){_0x1ba2bd[_0x0c82('0x27')](0x194);}return _0x590553;};}function handleError(_0x1c29f9,_0x4e7f33){_0x4e7f33=_0x4e7f33||0x1f4;return function(_0x17031f){logger['error'](_0x17031f['stack']);if(_0x17031f[_0x0c82('0x28')]){delete _0x17031f[_0x0c82('0x28')];}_0x1c29f9[_0x0c82('0x1d')](_0x4e7f33)[_0x0c82('0x29')](_0x17031f);};}exports[_0x0c82('0x2a')]=function(_0x16e074,_0x4c58e1){var _0x206283={},_0x5ab0c7={},_0x548e98={'count':0x0,'rows':[]};var _0x17b569=_['map'](db['FaxQueueReport'][_0x0c82('0x2b')],function(_0x5048ea){return{'name':_0x5048ea['fieldName'],'type':_0x5048ea[_0x0c82('0x2c')][_0x0c82('0x2d')]};});_0x5ab0c7[_0x0c82('0x2e')]=_[_0x0c82('0x2f')](_0x17b569,_0x0c82('0x28'));_0x5ab0c7[_0x0c82('0x30')]=_[_0x0c82('0x31')](_0x16e074[_0x0c82('0x30')]);_0x5ab0c7[_0x0c82('0x32')]=_[_0x0c82('0x33')](_0x5ab0c7[_0x0c82('0x2e')],_0x5ab0c7[_0x0c82('0x30')]);_0x206283['attributes']=_['intersection'](_0x5ab0c7[_0x0c82('0x2e')],qs[_0x0c82('0x34')](_0x16e074[_0x0c82('0x30')][_0x0c82('0x34')]));_0x206283[_0x0c82('0x35')]=_0x206283[_0x0c82('0x35')][_0x0c82('0x36')]?_0x206283['attributes']:_0x5ab0c7[_0x0c82('0x2e')];if(!_0x16e074[_0x0c82('0x30')]['hasOwnProperty'](_0x0c82('0x37'))){_0x206283['limit']=qs['limit'](_0x16e074[_0x0c82('0x30')]['limit']);_0x206283['offset']=qs[_0x0c82('0x1e')](_0x16e074[_0x0c82('0x30')][_0x0c82('0x1e')]);}_0x206283[_0x0c82('0x38')]=qs[_0x0c82('0x39')](_0x16e074[_0x0c82('0x30')]['sort']);_0x206283['where']=qs[_0x0c82('0x32')](_[_0x0c82('0x3a')](_0x16e074[_0x0c82('0x30')],_0x5ab0c7['filters']),_0x17b569);if(_0x16e074[_0x0c82('0x30')][_0x0c82('0x3b')]){_0x206283['where']=_[_0x0c82('0x3c')](_0x206283[_0x0c82('0x3d')],{'$or':_['map'](_0x17b569,function(_0x455292){if(_0x455292[_0x0c82('0x2c')]!==_0x0c82('0x3e')){var _0x94f60e={};_0x94f60e[_0x455292['name']]={'$like':'%'+_0x16e074[_0x0c82('0x30')][_0x0c82('0x3b')]+'%'};return _0x94f60e;}})});}_0x206283=_[_0x0c82('0x3c')]({},_0x206283,_0x16e074[_0x0c82('0x3f')]);var _0x3c8103={'where':_0x206283[_0x0c82('0x3d')]};return db[_0x0c82('0x40')]['count'](_0x3c8103)[_0x0c82('0x25')](function(_0x18e98d){_0x548e98['count']=_0x18e98d;if(_0x16e074[_0x0c82('0x30')][_0x0c82('0x41')]){_0x206283[_0x0c82('0x42')]=[{'all':!![]}];}return db[_0x0c82('0x40')]['findAll'](_0x206283);})['then'](function(_0x40c796){_0x548e98['rows']=_0x40c796;return _0x548e98;})[_0x0c82('0x25')](respondWithFilteredResult(_0x4c58e1,_0x206283))[_0x0c82('0x43')](handleError(_0x4c58e1,null));};exports[_0x0c82('0x44')]=function(_0x4aff97,_0x4b3257){var _0x3b09f6={'raw':!![],'where':{'id':_0x4aff97[_0x0c82('0x45')]['id']}},_0x161077={};_0x161077[_0x0c82('0x2e')]=_[_0x0c82('0x31')](db['FaxQueueReport']['rawAttributes']);_0x161077[_0x0c82('0x30')]=_['keys'](_0x4aff97['query']);_0x161077['filters']=_[_0x0c82('0x33')](_0x161077[_0x0c82('0x2e')],_0x161077['query']);_0x3b09f6[_0x0c82('0x35')]=_[_0x0c82('0x33')](_0x161077[_0x0c82('0x2e')],qs['fields'](_0x4aff97['query'][_0x0c82('0x34')]));_0x3b09f6['attributes']=_0x3b09f6[_0x0c82('0x35')][_0x0c82('0x36')]?_0x3b09f6[_0x0c82('0x35')]:_0x161077[_0x0c82('0x2e')];if(_0x4aff97[_0x0c82('0x30')][_0x0c82('0x41')]){_0x3b09f6[_0x0c82('0x42')]=[{'all':!![]}];}_0x3b09f6=_[_0x0c82('0x3c')]({},_0x3b09f6,_0x4aff97[_0x0c82('0x3f')]);return db[_0x0c82('0x40')][_0x0c82('0x46')](_0x3b09f6)['then'](handleEntityNotFound(_0x4b3257,null))['then'](respondWithResult(_0x4b3257,null))[_0x0c82('0x43')](handleError(_0x4b3257,null));};exports[_0x0c82('0x47')]=function(_0x4000a1,_0x4b0660){return db[_0x0c82('0x40')][_0x0c82('0x47')](_0x4000a1[_0x0c82('0x48')],{})['then'](respondWithResult(_0x4b0660,0xc9))['catch'](handleError(_0x4b0660,null));};exports[_0x0c82('0x24')]=function(_0x3d87d0,_0x4e789d){if(_0x3d87d0[_0x0c82('0x48')]['id']){delete _0x3d87d0['body']['id'];}return db[_0x0c82('0x40')][_0x0c82('0x46')]({'where':{'id':_0x3d87d0['params']['id']}})[_0x0c82('0x25')](handleEntityNotFound(_0x4e789d,null))[_0x0c82('0x25')](saveUpdates(_0x3d87d0[_0x0c82('0x48')],null))[_0x0c82('0x25')](respondWithResult(_0x4e789d,null))[_0x0c82('0x43')](handleError(_0x4e789d,null));};exports[_0x0c82('0x26')]=function(_0x4bf459,_0x5cf09e){return db[_0x0c82('0x40')][_0x0c82('0x46')]({'where':{'id':_0x4bf459[_0x0c82('0x45')]['id']}})[_0x0c82('0x25')](handleEntityNotFound(_0x5cf09e,null))[_0x0c82('0x25')](removeEntity(_0x5cf09e,null))[_0x0c82('0x43')](handleError(_0x5cf09e,null));};exports[_0x0c82('0x49')]=function(_0x576fe5,_0x584e0d){return db[_0x0c82('0x40')]['describe']()[_0x0c82('0x25')](respondWithResult(_0x584e0d,null))[_0x0c82('0x43')](handleError(_0x584e0d,null));}; \ No newline at end of file +var _0x4156=['where','filters','pick','filter','VIRTUAL','merge','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','limit','undefined','count','offset','set','Content-Range','apply','reject','update','then','stack','name','map','FaxQueueReport','rawAttributes','type','key','model','query','intersection','attributes','fields','length','hasOwnProperty','order','sort'];(function(_0x12acd3,_0x4a3f86){var _0x3e234a=function(_0x14eac1){while(--_0x14eac1){_0x12acd3['push'](_0x12acd3['shift']());}};_0x3e234a(++_0x4a3f86);}(_0x4156,0xf1));var _0x6415=function(_0x5e00c1,_0x12b7e5){_0x5e00c1=_0x5e00c1-0x0;var _0xba5f38=_0x4156[_0x5e00c1];return _0xba5f38;};'use strict';var emlformat=require(_0x6415('0x0'));var rimraf=require(_0x6415('0x1'));var zipdir=require(_0x6415('0x2'));var jsonpatch=require(_0x6415('0x3'));var rp=require(_0x6415('0x4'));var moment=require('moment');var BPromise=require(_0x6415('0x5'));var Mustache=require(_0x6415('0x6'));var util=require(_0x6415('0x7'));var path=require(_0x6415('0x8'));var sox=require(_0x6415('0x9'));var csv=require(_0x6415('0xa'));var ejs=require(_0x6415('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x6415('0xc'));var squel=require('squel');var crypto=require(_0x6415('0xd'));var jsforce=require(_0x6415('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x6415('0xa'));var querystring=require(_0x6415('0xf'));var Papa=require(_0x6415('0x10'));var Redis=require(_0x6415('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x6415('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x6415('0x13'))(_0x6415('0x14'));var utils=require(_0x6415('0x15'));var config=require(_0x6415('0x16'));var licenseUtil=require(_0x6415('0x17'));var db=require(_0x6415('0x18'))['db'];function respondWithStatusCode(_0x455f44,_0x596b97){_0x596b97=_0x596b97||0xcc;return function(_0x5b3493){if(_0x5b3493){return _0x455f44[_0x6415('0x19')](_0x596b97);}return _0x455f44[_0x6415('0x1a')](_0x596b97)[_0x6415('0x1b')]();};}function respondWithResult(_0xf75bec,_0x21ae74){_0x21ae74=_0x21ae74||0xc8;return function(_0x5b2a26){if(_0x5b2a26){return _0xf75bec['status'](_0x21ae74)[_0x6415('0x1c')](_0x5b2a26);}};}function respondWithFilteredResult(_0x780643,_0x48017d){return function(_0x1d540c){if(_0x1d540c){var _0x41f9b0=typeof _0x48017d['offset']==='undefined'&&typeof _0x48017d[_0x6415('0x1d')]===_0x6415('0x1e');var _0x3f739d=_0x1d540c[_0x6415('0x1f')];var _0x2ef73b=_0x41f9b0?0x0:_0x48017d[_0x6415('0x20')];var _0x2c74c6=_0x41f9b0?_0x1d540c[_0x6415('0x1f')]:_0x48017d[_0x6415('0x20')]+_0x48017d['limit'];var _0x551985;if(_0x2c74c6>=_0x3f739d){_0x2c74c6=_0x3f739d;_0x551985=0xc8;}else{_0x551985=0xce;}_0x780643['status'](_0x551985);return _0x780643[_0x6415('0x21')](_0x6415('0x22'),_0x2ef73b+'-'+_0x2c74c6+'/'+_0x3f739d)[_0x6415('0x1c')](_0x1d540c);}return null;};}function patchUpdates(_0x1e58f2){return function(_0x551632){try{jsonpatch[_0x6415('0x23')](_0x551632,_0x1e58f2,!![]);}catch(_0x3f4400){return BPromise[_0x6415('0x24')](_0x3f4400);}return _0x551632['save']();};}function saveUpdates(_0x287ac9,_0x266f97){return function(_0x7c567f){if(_0x7c567f){return _0x7c567f[_0x6415('0x25')](_0x287ac9)[_0x6415('0x26')](function(_0x3e33d3){return _0x3e33d3;});}return null;};}function removeEntity(_0x339c50,_0x41c266){return function(_0x1496c1){if(_0x1496c1){return _0x1496c1['destroy']()[_0x6415('0x26')](function(){_0x339c50[_0x6415('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x15be31,_0x2b202c){return function(_0x2a936f){if(!_0x2a936f){_0x15be31[_0x6415('0x19')](0x194);}return _0x2a936f;};}function handleError(_0x31dabc,_0x5b5f39){_0x5b5f39=_0x5b5f39||0x1f4;return function(_0x30d857){logger['error'](_0x30d857[_0x6415('0x27')]);if(_0x30d857[_0x6415('0x28')]){delete _0x30d857[_0x6415('0x28')];}_0x31dabc['status'](_0x5b5f39)['send'](_0x30d857);};}exports['index']=function(_0x61e827,_0x31f717){var _0x581bc7={},_0x5bf08d={},_0xf3e415={'count':0x0,'rows':[]};var _0x4426ed=_[_0x6415('0x29')](db[_0x6415('0x2a')][_0x6415('0x2b')],function(_0x2ba17d){return{'name':_0x2ba17d['fieldName'],'type':_0x2ba17d[_0x6415('0x2c')][_0x6415('0x2d')]};});_0x5bf08d[_0x6415('0x2e')]=_[_0x6415('0x29')](_0x4426ed,'name');_0x5bf08d['query']=_['keys'](_0x61e827[_0x6415('0x2f')]);_0x5bf08d['filters']=_[_0x6415('0x30')](_0x5bf08d['model'],_0x5bf08d[_0x6415('0x2f')]);_0x581bc7[_0x6415('0x31')]=_[_0x6415('0x30')](_0x5bf08d[_0x6415('0x2e')],qs['fields'](_0x61e827['query'][_0x6415('0x32')]));_0x581bc7[_0x6415('0x31')]=_0x581bc7[_0x6415('0x31')][_0x6415('0x33')]?_0x581bc7[_0x6415('0x31')]:_0x5bf08d[_0x6415('0x2e')];if(!_0x61e827['query'][_0x6415('0x34')]('nolimit')){_0x581bc7['limit']=qs['limit'](_0x61e827['query'][_0x6415('0x1d')]);_0x581bc7[_0x6415('0x20')]=qs[_0x6415('0x20')](_0x61e827['query'][_0x6415('0x20')]);}_0x581bc7[_0x6415('0x35')]=qs['sort'](_0x61e827[_0x6415('0x2f')][_0x6415('0x36')]);_0x581bc7[_0x6415('0x37')]=qs[_0x6415('0x38')](_[_0x6415('0x39')](_0x61e827['query'],_0x5bf08d[_0x6415('0x38')]),_0x4426ed);if(_0x61e827['query'][_0x6415('0x3a')]){_0x581bc7[_0x6415('0x37')]=_['merge'](_0x581bc7[_0x6415('0x37')],{'$or':_[_0x6415('0x29')](_0x4426ed,function(_0x51b0f1){if(_0x51b0f1['type']!==_0x6415('0x3b')){var _0x47ff72={};_0x47ff72[_0x51b0f1[_0x6415('0x28')]]={'$like':'%'+_0x61e827['query'][_0x6415('0x3a')]+'%'};return _0x47ff72;}})});}_0x581bc7=_[_0x6415('0x3c')]({},_0x581bc7,_0x61e827['options']);var _0x3dddfb={'where':_0x581bc7['where']};return db[_0x6415('0x2a')][_0x6415('0x1f')](_0x3dddfb)[_0x6415('0x26')](function(_0x3bad43){_0xf3e415[_0x6415('0x1f')]=_0x3bad43;if(_0x61e827[_0x6415('0x2f')][_0x6415('0x3d')]){_0x581bc7[_0x6415('0x3e')]=[{'all':!![]}];}return db[_0x6415('0x2a')][_0x6415('0x3f')](_0x581bc7);})[_0x6415('0x26')](function(_0x35b203){_0xf3e415[_0x6415('0x40')]=_0x35b203;return _0xf3e415;})[_0x6415('0x26')](respondWithFilteredResult(_0x31f717,_0x581bc7))[_0x6415('0x41')](handleError(_0x31f717,null));};exports[_0x6415('0x42')]=function(_0x53e600,_0x368e52){var _0x747baa={'raw':!![],'where':{'id':_0x53e600[_0x6415('0x43')]['id']}},_0x581573={};_0x581573['model']=_[_0x6415('0x44')](db[_0x6415('0x2a')]['rawAttributes']);_0x581573[_0x6415('0x2f')]=_[_0x6415('0x44')](_0x53e600[_0x6415('0x2f')]);_0x581573[_0x6415('0x38')]=_['intersection'](_0x581573['model'],_0x581573[_0x6415('0x2f')]);_0x747baa['attributes']=_[_0x6415('0x30')](_0x581573['model'],qs[_0x6415('0x32')](_0x53e600[_0x6415('0x2f')][_0x6415('0x32')]));_0x747baa[_0x6415('0x31')]=_0x747baa[_0x6415('0x31')][_0x6415('0x33')]?_0x747baa[_0x6415('0x31')]:_0x581573['model'];if(_0x53e600[_0x6415('0x2f')][_0x6415('0x3d')]){_0x747baa['include']=[{'all':!![]}];}_0x747baa=_[_0x6415('0x3c')]({},_0x747baa,_0x53e600['options']);return db[_0x6415('0x2a')][_0x6415('0x45')](_0x747baa)[_0x6415('0x26')](handleEntityNotFound(_0x368e52,null))[_0x6415('0x26')](respondWithResult(_0x368e52,null))[_0x6415('0x41')](handleError(_0x368e52,null));};exports['create']=function(_0x3894d8,_0x4d9708){return db[_0x6415('0x2a')][_0x6415('0x46')](_0x3894d8[_0x6415('0x47')],{})[_0x6415('0x26')](respondWithResult(_0x4d9708,0xc9))['catch'](handleError(_0x4d9708,null));};exports[_0x6415('0x25')]=function(_0x518643,_0x4130c5){if(_0x518643[_0x6415('0x47')]['id']){delete _0x518643['body']['id'];}return db[_0x6415('0x2a')][_0x6415('0x45')]({'where':{'id':_0x518643[_0x6415('0x43')]['id']}})['then'](handleEntityNotFound(_0x4130c5,null))[_0x6415('0x26')](saveUpdates(_0x518643[_0x6415('0x47')],null))[_0x6415('0x26')](respondWithResult(_0x4130c5,null))[_0x6415('0x41')](handleError(_0x4130c5,null));};exports[_0x6415('0x48')]=function(_0x14b1e1,_0x5957ae){return db[_0x6415('0x2a')]['find']({'where':{'id':_0x14b1e1[_0x6415('0x43')]['id']}})[_0x6415('0x26')](handleEntityNotFound(_0x5957ae,null))[_0x6415('0x26')](removeEntity(_0x5957ae,null))[_0x6415('0x41')](handleError(_0x5957ae,null));};exports[_0x6415('0x49')]=function(_0x48f4fa,_0xdd3293){return db[_0x6415('0x2a')][_0x6415('0x49')]()[_0x6415('0x26')](respondWithResult(_0xdd3293,null))[_0x6415('0x41')](handleError(_0xdd3293,null));}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.model.js b/server/api/faxQueueReport/faxQueueReport.model.js index ac31082..eb4a24e 100644 --- a/server/api/faxQueueReport/faxQueueReport.model.js +++ b/server/api/faxQueueReport/faxQueueReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x814b=['../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./faxQueueReport.attributes','exports','define','FaxQueueReport','uniqueid','lodash','util'];(function(_0x386c3e,_0x44a375){var _0x4b8e13=function(_0x583c8f){while(--_0x583c8f){_0x386c3e['push'](_0x386c3e['shift']());}};_0x4b8e13(++_0x44a375);}(_0x814b,0x1a2));var _0xb814=function(_0x4da382,_0x4cfc5d){_0x4da382=_0x4da382-0x0;var _0x10073f=_0x814b[_0x4da382];return _0x10073f;};'use strict';var _=require(_0xb814('0x0'));var util=require(_0xb814('0x1'));var logger=require(_0xb814('0x2'))(_0xb814('0x3'));var moment=require(_0xb814('0x4'));var BPromise=require(_0xb814('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb814('0x6'));var rimraf=require(_0xb814('0x7'));var config=require(_0xb814('0x8'));var attributes=require(_0xb814('0x9'));module[_0xb814('0xa')]=function(_0x322a70,_0x53e507){return _0x322a70[_0xb814('0xb')](_0xb814('0xc'),attributes,{'tableName':'report_fax_queue','paranoid':![],'indexes':[{'name':_0xb814('0xd'),'fields':[_0xb814('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x7a54=['report_fax_queue','uniqueid','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./faxQueueReport.attributes','exports','FaxQueueReport'];(function(_0x5a50a1,_0x48ff99){var _0x3a947c=function(_0x4a003d){while(--_0x4a003d){_0x5a50a1['push'](_0x5a50a1['shift']());}};_0x3a947c(++_0x48ff99);}(_0x7a54,0x106));var _0x47a5=function(_0x58d1bd,_0x34727d){_0x58d1bd=_0x58d1bd-0x0;var _0x4adf62=_0x7a54[_0x58d1bd];return _0x4adf62;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var logger=require(_0x47a5('0x2'))('api');var moment=require(_0x47a5('0x3'));var BPromise=require(_0x47a5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x47a5('0x5'));var rimraf=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var attributes=require(_0x47a5('0x8'));module[_0x47a5('0x9')]=function(_0x545a97,_0x3d5629){return _0x545a97['define'](_0x47a5('0xa'),attributes,{'tableName':_0x47a5('0xb'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x47a5('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.rpc.js b/server/api/faxQueueReport/faxQueueReport.rpc.js index 1a7b24a..545305b 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 _0x103c=['error','code','message','info','result','catch','CreateFaxQueueReport','create','options','UpdateFaxQueueReport','update','limit','util','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','then','FaxQueueReport,\x20%s,\x20%s','request\x20sent','debug','FaxQueueReport,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x219e20,_0x8743c){var _0x284b00=function(_0x235dbe){while(--_0x235dbe){_0x219e20['push'](_0x219e20['shift']());}};_0x284b00(++_0x8743c);}(_0x103c,0x192));var _0xc103=function(_0x327feb,_0x57ca69){_0x327feb=_0x327feb-0x0;var _0x16f343=_0x103c[_0x327feb];return _0x16f343;};'use strict';var _=require('lodash');var util=require(_0xc103('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc103('0x1'));var db=require('../../mysqldb')['db'];var utils=require(_0xc103('0x2'));var logger=require('../../config/logger')(_0xc103('0x3'));var config=require(_0xc103('0x4'));var jayson=require(_0xc103('0x5'));var client=jayson['client'][_0xc103('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x52290f,_0x27b490,_0xadff80){return new BPromise(function(_0x21077e,_0x2c5210){return client[_0xc103('0x7')](_0x52290f,_0xadff80)[_0xc103('0x8')](function(_0x3e9f3c){logger['info'](_0xc103('0x9'),_0x27b490,_0xc103('0xa'));logger[_0xc103('0xb')](_0xc103('0xc'),_0x27b490,_0xc103('0xa'),JSON[_0xc103('0xd')](_0x3e9f3c));if(_0x3e9f3c[_0xc103('0xe')]){if(_0x3e9f3c['error'][_0xc103('0xf')]===0x1f4){logger[_0xc103('0xe')](_0xc103('0x9'),_0x27b490,_0x3e9f3c[_0xc103('0xe')][_0xc103('0x10')]);return _0x2c5210(_0x3e9f3c['error'][_0xc103('0x10')]);}logger['error'](_0xc103('0x9'),_0x27b490,_0x3e9f3c[_0xc103('0xe')][_0xc103('0x10')]);return _0x21077e(_0x3e9f3c[_0xc103('0xe')][_0xc103('0x10')]);}else{logger[_0xc103('0x11')]('FaxQueueReport,\x20%s,\x20%s',_0x27b490,_0xc103('0xa'));_0x21077e(_0x3e9f3c[_0xc103('0x12')]['message']);}})[_0xc103('0x13')](function(_0x15c14b){logger[_0xc103('0xe')]('FaxQueueReport,\x20%s,\x20%s',_0x27b490,_0x15c14b);_0x2c5210(_0x15c14b);});});}exports[_0xc103('0x14')]=function(_0x2485c6){var _0x1f1c1d=this;return new Promise(function(_0xbc85a3,_0x4c595b){return db['FaxQueueReport'][_0xc103('0x15')](_0x2485c6['body'],{'raw':_0x2485c6[_0xc103('0x16')]?_0x2485c6[_0xc103('0x16')]['raw']===undefined?!![]:![]:!![]})[_0xc103('0x8')](function(_0x5a3efd){logger['info'](_0xc103('0x14'),_0x2485c6);logger[_0xc103('0xb')](_0xc103('0x14'),_0x2485c6,JSON[_0xc103('0xd')](_0x5a3efd));_0xbc85a3(_0x5a3efd);})['catch'](function(_0xe19b89){logger[_0xc103('0xe')](_0xc103('0x14'),_0xe19b89[_0xc103('0x10')],_0x2485c6);_0x4c595b(_0x1f1c1d[_0xc103('0xe')](0x1f4,_0xe19b89[_0xc103('0x10')]));});});};exports[_0xc103('0x17')]=function(_0x631380){var _0x44a92a=this;return new Promise(function(_0x521599,_0xbc6f56){return db['FaxQueueReport'][_0xc103('0x18')](_0x631380['body'],{'raw':_0x631380[_0xc103('0x16')]?_0x631380[_0xc103('0x16')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x631380[_0xc103('0x16')]?_0x631380[_0xc103('0x16')]['where']||null:null,'attributes':_0x631380[_0xc103('0x16')]?_0x631380[_0xc103('0x16')]['attributes']||null:null,'limit':_0x631380[_0xc103('0x16')]?_0x631380[_0xc103('0x16')][_0xc103('0x19')]||null:null})[_0xc103('0x8')](function(_0x6a5380){logger[_0xc103('0x11')](_0xc103('0x17'),_0x631380);logger[_0xc103('0xb')](_0xc103('0x17'),_0x631380,JSON[_0xc103('0xd')](_0x6a5380));_0x521599(_0x6a5380);})[_0xc103('0x13')](function(_0x48d058){logger[_0xc103('0xe')](_0xc103('0x17'),_0x48d058[_0xc103('0x10')],_0x631380);_0xbc6f56(_0x44a92a[_0xc103('0xe')](0x1f4,_0x48d058[_0xc103('0x10')]));});});}; \ No newline at end of file +var _0x2f74=['CreateFaxQueueReport','FaxQueueReport','body','options','raw','UpdateFaxQueueReport','update','attributes','limit','debug','lodash','moment','bluebird','randomstring','rpc','../../config/environment','jayson/promise','client','http','request','then','info','FaxQueueReport,\x20%s,\x20%s','request\x20sent','FaxQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch'];(function(_0x1fcaf1,_0x21c3c2){var _0x55f464=function(_0x348eb3){while(--_0x348eb3){_0x1fcaf1['push'](_0x1fcaf1['shift']());}};_0x55f464(++_0x21c3c2);}(_0x2f74,0x15f));var _0x42f7=function(_0x644560,_0x1783aa){_0x644560=_0x644560-0x0;var _0x41b76b=_0x2f74[_0x644560];return _0x41b76b;};'use strict';var _=require(_0x42f7('0x0'));var util=require('util');var moment=require(_0x42f7('0x1'));var BPromise=require(_0x42f7('0x2'));var rs=require(_0x42f7('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x42f7('0x4'));var config=require(_0x42f7('0x5'));var jayson=require(_0x42f7('0x6'));var client=jayson[_0x42f7('0x7')][_0x42f7('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5a599b,_0x8831be,_0x1c7bef){return new BPromise(function(_0x4e1b54,_0x1a1434){return client[_0x42f7('0x9')](_0x5a599b,_0x1c7bef)[_0x42f7('0xa')](function(_0x5e8fa7){logger[_0x42f7('0xb')](_0x42f7('0xc'),_0x8831be,_0x42f7('0xd'));logger['debug'](_0x42f7('0xe'),_0x8831be,_0x42f7('0xd'),JSON[_0x42f7('0xf')](_0x5e8fa7));if(_0x5e8fa7[_0x42f7('0x10')]){if(_0x5e8fa7['error'][_0x42f7('0x11')]===0x1f4){logger['error'](_0x42f7('0xc'),_0x8831be,_0x5e8fa7[_0x42f7('0x10')][_0x42f7('0x12')]);return _0x1a1434(_0x5e8fa7['error']['message']);}logger[_0x42f7('0x10')](_0x42f7('0xc'),_0x8831be,_0x5e8fa7[_0x42f7('0x10')][_0x42f7('0x12')]);return _0x4e1b54(_0x5e8fa7[_0x42f7('0x10')][_0x42f7('0x12')]);}else{logger[_0x42f7('0xb')](_0x42f7('0xc'),_0x8831be,_0x42f7('0xd'));_0x4e1b54(_0x5e8fa7[_0x42f7('0x13')]['message']);}})[_0x42f7('0x14')](function(_0x45d3a8){logger[_0x42f7('0x10')](_0x42f7('0xc'),_0x8831be,_0x45d3a8);_0x1a1434(_0x45d3a8);});});}exports[_0x42f7('0x15')]=function(_0x3e8a26){var _0x322371=this;return new Promise(function(_0x1cf3e8,_0x1114ff){return db[_0x42f7('0x16')]['create'](_0x3e8a26[_0x42f7('0x17')],{'raw':_0x3e8a26[_0x42f7('0x18')]?_0x3e8a26[_0x42f7('0x18')][_0x42f7('0x19')]===undefined?!![]:![]:!![]})[_0x42f7('0xa')](function(_0x1c9641){logger[_0x42f7('0xb')](_0x42f7('0x15'),_0x3e8a26);logger['debug'](_0x42f7('0x15'),_0x3e8a26,JSON['stringify'](_0x1c9641));_0x1cf3e8(_0x1c9641);})[_0x42f7('0x14')](function(_0xd2b7dc){logger['error']('CreateFaxQueueReport',_0xd2b7dc[_0x42f7('0x12')],_0x3e8a26);_0x1114ff(_0x322371[_0x42f7('0x10')](0x1f4,_0xd2b7dc[_0x42f7('0x12')]));});});};exports[_0x42f7('0x1a')]=function(_0x96944e){var _0x314854=this;return new Promise(function(_0x38673b,_0x446bb8){return db[_0x42f7('0x16')][_0x42f7('0x1b')](_0x96944e[_0x42f7('0x17')],{'raw':_0x96944e['options']?_0x96944e[_0x42f7('0x18')][_0x42f7('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x96944e[_0x42f7('0x18')]?_0x96944e[_0x42f7('0x18')]['where']||null:null,'attributes':_0x96944e[_0x42f7('0x18')]?_0x96944e['options'][_0x42f7('0x1c')]||null:null,'limit':_0x96944e['options']?_0x96944e[_0x42f7('0x18')][_0x42f7('0x1d')]||null:null})[_0x42f7('0xa')](function(_0x1449c3){logger[_0x42f7('0xb')](_0x42f7('0x1a'),_0x96944e);logger[_0x42f7('0x1e')](_0x42f7('0x1a'),_0x96944e,JSON['stringify'](_0x1449c3));_0x38673b(_0x1449c3);})['catch'](function(_0x50a0d3){logger[_0x42f7('0x10')]('UpdateFaxQueueReport',_0x50a0d3[_0x42f7('0x12')],_0x96944e);_0x446bb8(_0x314854['error'](0x1f4,_0x50a0d3[_0x42f7('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/index.js b/server/api/faxQueueReport/index.js index 342f173..0c26418 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 _0x7045=['../../components/auth/service','../../config/environment','get','isAuthenticated','index','/describe','/:id','show','post','put','update','delete','destroy','exports','multer','util','path','express'];(function(_0x144502,_0x15b311){var _0x1203ad=function(_0xc5806d){while(--_0xc5806d){_0x144502['push'](_0x144502['shift']());}};_0x1203ad(++_0x15b311);}(_0x7045,0x164));var _0x5704=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7045[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x5704('0x0'));var util=require(_0x5704('0x1'));var path=require(_0x5704('0x2'));var timeout=require('connect-timeout');var express=require(_0x5704('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x5704('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x5704('0x5'));var controller=require('./faxQueueReport.controller');router[_0x5704('0x6')]('/',auth[_0x5704('0x7')](),controller[_0x5704('0x8')]);router['get'](_0x5704('0x9'),auth[_0x5704('0x7')](),controller['describe']);router[_0x5704('0x6')](_0x5704('0xa'),auth['isAuthenticated'](),controller[_0x5704('0xb')]);router[_0x5704('0xc')]('/',auth[_0x5704('0x7')](),controller['create']);router[_0x5704('0xd')]('/:id',auth['isAuthenticated'](),controller[_0x5704('0xe')]);router[_0x5704('0xf')]('/:id',auth[_0x5704('0x7')](),controller[_0x5704('0x10')]);module[_0x5704('0x11')]=router; \ No newline at end of file +var _0x6bac=['post','create','put','update','delete','/:id','destroy','multer','util','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxQueueReport.controller','get','isAuthenticated','/describe','describe','show'];(function(_0x3afbdf,_0x9e463b){var _0x5b6861=function(_0x31d287){while(--_0x31d287){_0x3afbdf['push'](_0x3afbdf['shift']());}};_0x5b6861(++_0x9e463b);}(_0x6bac,0x11f));var _0xc6ba=function(_0xec5b05,_0x11c334){_0xec5b05=_0xec5b05-0x0;var _0x3144af=_0x6bac[_0xec5b05];return _0x3144af;};'use strict';var multer=require(_0xc6ba('0x0'));var util=require(_0xc6ba('0x1'));var path=require(_0xc6ba('0x2'));var timeout=require('connect-timeout');var express=require(_0xc6ba('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xc6ba('0x4'));var interaction=require(_0xc6ba('0x5'));var config=require(_0xc6ba('0x6'));var controller=require(_0xc6ba('0x7'));router[_0xc6ba('0x8')]('/',auth[_0xc6ba('0x9')](),controller['index']);router[_0xc6ba('0x8')](_0xc6ba('0xa'),auth[_0xc6ba('0x9')](),controller[_0xc6ba('0xb')]);router['get']('/:id',auth[_0xc6ba('0x9')](),controller[_0xc6ba('0xc')]);router[_0xc6ba('0xd')]('/',auth[_0xc6ba('0x9')](),controller[_0xc6ba('0xe')]);router[_0xc6ba('0xf')]('/:id',auth[_0xc6ba('0x9')](),controller[_0xc6ba('0x10')]);router[_0xc6ba('0x11')](_0xc6ba('0x12'),auth[_0xc6ba('0x9')](),controller[_0xc6ba('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.attributes.js b/server/api/faxTransferReport/faxTransferReport.attributes.js index cf7927e..bb2c37d 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 _0xaa88=['account','agent','queue','DATE','NOW','moment','sequelize','exports','STRING'];(function(_0xfaf8e8,_0x4a91a4){var _0x3405cf=function(_0x3b97f5){while(--_0x3b97f5){_0xfaf8e8['push'](_0xfaf8e8['shift']());}};_0x3405cf(++_0x4a91a4);}(_0xaa88,0x137));var _0x8aa8=function(_0x2bd88d,_0x2d5dc3){_0x2bd88d=_0x2bd88d-0x0;var _0x5516d4=_0xaa88[_0x2bd88d];return _0x5516d4;};'use strict';var moment=require(_0x8aa8('0x0'));var Sequelize=require(_0x8aa8('0x1'));module[_0x8aa8('0x2')]={'uniqueid':{'type':Sequelize[_0x8aa8('0x3')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x8aa8('0x4'),_0x8aa8('0x5'),_0x8aa8('0x6')),'allowNull':![],'defaultValue':_0x8aa8('0x6')},'transferredAt':{'type':Sequelize[_0x8aa8('0x7')],'allowNull':![],'defaultValue':Sequelize[_0x8aa8('0x8')]}}; \ No newline at end of file +var _0x70e0=['NOW','moment','sequelize','exports','account','agent','queue'];(function(_0x3d974b,_0x120487){var _0x5c9c13=function(_0x2aa3eb){while(--_0x2aa3eb){_0x3d974b['push'](_0x3d974b['shift']());}};_0x5c9c13(++_0x120487);}(_0x70e0,0x17b));var _0x070e=function(_0x2aa0f2,_0x37228d){_0x2aa0f2=_0x2aa0f2-0x0;var _0xc55c93=_0x70e0[_0x2aa0f2];return _0xc55c93;};'use strict';var moment=require(_0x070e('0x0'));var Sequelize=require(_0x070e('0x1'));module[_0x070e('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x070e('0x3'),_0x070e('0x4'),_0x070e('0x5')),'allowNull':![],'defaultValue':_0x070e('0x5')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x070e('0x6')]}}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.controller.js b/server/api/faxTransferReport/faxTransferReport.controller.js index cfa6a2a..c7633d8 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 _0xcceb=['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','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','FaxTransferReport','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','merge','where','options','includeAll','rows','catch','params','include','create','body','find','describe','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','to-csv','ejs','squel'];(function(_0x133748,_0x2b4453){var _0x5d147b=function(_0x5306c4){while(--_0x5306c4){_0x133748['push'](_0x133748['shift']());}};_0x5d147b(++_0x2b4453);}(_0xcceb,0x12d));var _0xbcce=function(_0xc144be,_0x385142){_0xc144be=_0xc144be-0x0;var _0x4ffd89=_0xcceb[_0xc144be];return _0x4ffd89;};'use strict';var emlformat=require(_0xbcce('0x0'));var rimraf=require(_0xbcce('0x1'));var zipdir=require(_0xbcce('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xbcce('0x3'));var moment=require(_0xbcce('0x4'));var BPromise=require(_0xbcce('0x5'));var Mustache=require(_0xbcce('0x6'));var util=require(_0xbcce('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0xbcce('0x8'));var ejs=require(_0xbcce('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xbcce('0xa'));var crypto=require(_0xbcce('0xb'));var jsforce=require(_0xbcce('0xc'));var deskjs=require(_0xbcce('0xd'));var toCsv=require(_0xbcce('0x8'));var querystring=require(_0xbcce('0xe'));var Papa=require(_0xbcce('0xf'));var Redis=require(_0xbcce('0x10'));var authService=require(_0xbcce('0x11'));var qs=require(_0xbcce('0x12'));var as=require(_0xbcce('0x13'));var hardwareService=require(_0xbcce('0x14'));var logger=require(_0xbcce('0x15'))(_0xbcce('0x16'));var utils=require(_0xbcce('0x17'));var config=require(_0xbcce('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x489675,_0x2214d7){_0x2214d7=_0x2214d7||0xcc;return function(_0x2ee303){if(_0x2ee303){return _0x489675[_0xbcce('0x19')](_0x2214d7);}return _0x489675[_0xbcce('0x1a')](_0x2214d7)[_0xbcce('0x1b')]();};}function respondWithResult(_0x36addb,_0x40a552){_0x40a552=_0x40a552||0xc8;return function(_0x1c5ab6){if(_0x1c5ab6){return _0x36addb[_0xbcce('0x1a')](_0x40a552)[_0xbcce('0x1c')](_0x1c5ab6);}};}function respondWithFilteredResult(_0xfe73a3,_0x33d7de){return function(_0x256440){if(_0x256440){var _0x5006ae=typeof _0x33d7de[_0xbcce('0x1d')]===_0xbcce('0x1e')&&typeof _0x33d7de[_0xbcce('0x1f')]===_0xbcce('0x1e');var _0x193619=_0x256440[_0xbcce('0x20')];var _0x1299b6=_0x5006ae?0x0:_0x33d7de[_0xbcce('0x1d')];var _0x1eca96=_0x5006ae?_0x256440[_0xbcce('0x20')]:_0x33d7de[_0xbcce('0x1d')]+_0x33d7de[_0xbcce('0x1f')];var _0x4d5fca;if(_0x1eca96>=_0x193619){_0x1eca96=_0x193619;_0x4d5fca=0xc8;}else{_0x4d5fca=0xce;}_0xfe73a3[_0xbcce('0x1a')](_0x4d5fca);return _0xfe73a3[_0xbcce('0x21')](_0xbcce('0x22'),_0x1299b6+'-'+_0x1eca96+'/'+_0x193619)[_0xbcce('0x1c')](_0x256440);}return null;};}function patchUpdates(_0x56e300){return function(_0x21fc44){try{jsonpatch[_0xbcce('0x23')](_0x21fc44,_0x56e300,!![]);}catch(_0x48f8dd){return BPromise[_0xbcce('0x24')](_0x48f8dd);}return _0x21fc44[_0xbcce('0x25')]();};}function saveUpdates(_0x56a41a,_0x34aadd){return function(_0x2454e1){if(_0x2454e1){return _0x2454e1[_0xbcce('0x26')](_0x56a41a)[_0xbcce('0x27')](function(_0x3525c9){return _0x3525c9;});}return null;};}function removeEntity(_0x28497d,_0x4da787){return function(_0x32f455){if(_0x32f455){return _0x32f455[_0xbcce('0x28')]()[_0xbcce('0x27')](function(){_0x28497d[_0xbcce('0x1a')](0xcc)[_0xbcce('0x1b')]();});}};}function handleEntityNotFound(_0x73b9f,_0x424c21){return function(_0x50517c){if(!_0x50517c){_0x73b9f[_0xbcce('0x19')](0x194);}return _0x50517c;};}function handleError(_0x4228e2,_0x4c9c13){_0x4c9c13=_0x4c9c13||0x1f4;return function(_0x38aa03){logger[_0xbcce('0x29')](_0x38aa03[_0xbcce('0x2a')]);if(_0x38aa03[_0xbcce('0x2b')]){delete _0x38aa03[_0xbcce('0x2b')];}_0x4228e2[_0xbcce('0x1a')](_0x4c9c13)[_0xbcce('0x2c')](_0x38aa03);};}exports[_0xbcce('0x2d')]=function(_0x2ba84c,_0x3c6654){var _0x557d62={},_0x172011={},_0x56cd58={'count':0x0,'rows':[]};var _0x166c07=_['map'](db[_0xbcce('0x2e')][_0xbcce('0x2f')],function(_0xc317b3){return{'name':_0xc317b3[_0xbcce('0x30')],'type':_0xc317b3[_0xbcce('0x31')][_0xbcce('0x32')]};});_0x172011[_0xbcce('0x33')]=_[_0xbcce('0x34')](_0x166c07,_0xbcce('0x2b'));_0x172011[_0xbcce('0x35')]=_[_0xbcce('0x36')](_0x2ba84c[_0xbcce('0x35')]);_0x172011[_0xbcce('0x37')]=_[_0xbcce('0x38')](_0x172011[_0xbcce('0x33')],_0x172011['query']);_0x557d62[_0xbcce('0x39')]=_[_0xbcce('0x38')](_0x172011[_0xbcce('0x33')],qs['fields'](_0x2ba84c['query'][_0xbcce('0x3a')]));_0x557d62[_0xbcce('0x39')]=_0x557d62[_0xbcce('0x39')][_0xbcce('0x3b')]?_0x557d62['attributes']:_0x172011[_0xbcce('0x33')];if(!_0x2ba84c[_0xbcce('0x35')][_0xbcce('0x3c')](_0xbcce('0x3d'))){_0x557d62[_0xbcce('0x1f')]=qs[_0xbcce('0x1f')](_0x2ba84c[_0xbcce('0x35')][_0xbcce('0x1f')]);_0x557d62['offset']=qs[_0xbcce('0x1d')](_0x2ba84c[_0xbcce('0x35')][_0xbcce('0x1d')]);}_0x557d62[_0xbcce('0x3e')]=qs[_0xbcce('0x3f')](_0x2ba84c['query'][_0xbcce('0x3f')]);_0x557d62['where']=qs[_0xbcce('0x37')](_[_0xbcce('0x40')](_0x2ba84c[_0xbcce('0x35')],_0x172011['filters']),_0x166c07);if(_0x2ba84c[_0xbcce('0x35')][_0xbcce('0x41')]){_0x557d62['where']=_[_0xbcce('0x42')](_0x557d62[_0xbcce('0x43')],{'$or':_[_0xbcce('0x34')](_0x166c07,function(_0xc412ed){if(_0xc412ed[_0xbcce('0x31')]!=='VIRTUAL'){var _0x15f874={};_0x15f874[_0xc412ed[_0xbcce('0x2b')]]={'$like':'%'+_0x2ba84c[_0xbcce('0x35')]['filter']+'%'};return _0x15f874;}})});}_0x557d62=_[_0xbcce('0x42')]({},_0x557d62,_0x2ba84c[_0xbcce('0x44')]);var _0x414b27={'where':_0x557d62[_0xbcce('0x43')]};return db[_0xbcce('0x2e')][_0xbcce('0x20')](_0x414b27)[_0xbcce('0x27')](function(_0x5a8cef){_0x56cd58[_0xbcce('0x20')]=_0x5a8cef;if(_0x2ba84c['query'][_0xbcce('0x45')]){_0x557d62['include']=[{'all':!![]}];}return db[_0xbcce('0x2e')]['findAll'](_0x557d62);})[_0xbcce('0x27')](function(_0x401395){_0x56cd58[_0xbcce('0x46')]=_0x401395;return _0x56cd58;})[_0xbcce('0x27')](respondWithFilteredResult(_0x3c6654,_0x557d62))[_0xbcce('0x47')](handleError(_0x3c6654,null));};exports['show']=function(_0x4a3be6,_0x3300cd){var _0x42e62f={'raw':!![],'where':{'id':_0x4a3be6[_0xbcce('0x48')]['id']}},_0x5872ea={};_0x5872ea[_0xbcce('0x33')]=_[_0xbcce('0x36')](db[_0xbcce('0x2e')]['rawAttributes']);_0x5872ea[_0xbcce('0x35')]=_['keys'](_0x4a3be6[_0xbcce('0x35')]);_0x5872ea[_0xbcce('0x37')]=_[_0xbcce('0x38')](_0x5872ea[_0xbcce('0x33')],_0x5872ea['query']);_0x42e62f[_0xbcce('0x39')]=_[_0xbcce('0x38')](_0x5872ea[_0xbcce('0x33')],qs[_0xbcce('0x3a')](_0x4a3be6['query'][_0xbcce('0x3a')]));_0x42e62f[_0xbcce('0x39')]=_0x42e62f[_0xbcce('0x39')]['length']?_0x42e62f[_0xbcce('0x39')]:_0x5872ea['model'];if(_0x4a3be6[_0xbcce('0x35')][_0xbcce('0x45')]){_0x42e62f[_0xbcce('0x49')]=[{'all':!![]}];}_0x42e62f=_[_0xbcce('0x42')]({},_0x42e62f,_0x4a3be6[_0xbcce('0x44')]);return db['FaxTransferReport']['find'](_0x42e62f)[_0xbcce('0x27')](handleEntityNotFound(_0x3300cd,null))['then'](respondWithResult(_0x3300cd,null))[_0xbcce('0x47')](handleError(_0x3300cd,null));};exports['create']=function(_0x655e99,_0x847cc9){return db[_0xbcce('0x2e')][_0xbcce('0x4a')](_0x655e99['body'],{})[_0xbcce('0x27')](respondWithResult(_0x847cc9,0xc9))['catch'](handleError(_0x847cc9,null));};exports[_0xbcce('0x26')]=function(_0x322dd0,_0x196f6e){if(_0x322dd0[_0xbcce('0x4b')]['id']){delete _0x322dd0['body']['id'];}return db['FaxTransferReport']['find']({'where':{'id':_0x322dd0[_0xbcce('0x48')]['id']}})[_0xbcce('0x27')](handleEntityNotFound(_0x196f6e,null))[_0xbcce('0x27')](saveUpdates(_0x322dd0[_0xbcce('0x4b')],null))[_0xbcce('0x27')](respondWithResult(_0x196f6e,null))['catch'](handleError(_0x196f6e,null));};exports[_0xbcce('0x28')]=function(_0x15196d,_0x539a8d){return db[_0xbcce('0x2e')][_0xbcce('0x4c')]({'where':{'id':_0x15196d[_0xbcce('0x48')]['id']}})[_0xbcce('0x27')](handleEntityNotFound(_0x539a8d,null))[_0xbcce('0x27')](removeEntity(_0x539a8d,null))[_0xbcce('0x47')](handleError(_0x539a8d,null));};exports[_0xbcce('0x4d')]=function(_0x46bb10,_0x458ab5){return db[_0xbcce('0x2e')][_0xbcce('0x4d')]()[_0xbcce('0x27')](respondWithResult(_0x458ab5,null))[_0xbcce('0x47')](handleError(_0x458ab5,null));}; \ No newline at end of file +var _0xa710=['reject','save','update','then','destroy','sendStatus','stack','name','send','index','map','fieldName','key','query','keys','intersection','model','attributes','fields','nolimit','order','sort','filters','filter','where','merge','type','VIRTUAL','options','include','FaxTransferReport','findAll','rows','catch','show','rawAttributes','length','includeAll','find','create','body','params','describe','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','json','offset','undefined','limit','count','status','set','Content-Range','apply'];(function(_0x541a67,_0x50728d){var _0x45da2a=function(_0x158929){while(--_0x158929){_0x541a67['push'](_0x541a67['shift']());}};_0x45da2a(++_0x50728d);}(_0xa710,0x7a));var _0x0a71=function(_0x34b855,_0x28b4cf){_0x34b855=_0x34b855-0x0;var _0x351c0e=_0xa710[_0x34b855];return _0x351c0e;};'use strict';var emlformat=require(_0x0a71('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x0a71('0x1'));var rp=require(_0x0a71('0x2'));var moment=require(_0x0a71('0x3'));var BPromise=require(_0x0a71('0x4'));var Mustache=require(_0x0a71('0x5'));var util=require(_0x0a71('0x6'));var path=require(_0x0a71('0x7'));var sox=require(_0x0a71('0x8'));var csv=require(_0x0a71('0x9'));var ejs=require(_0x0a71('0xa'));var fs=require('fs');var fs_extra=require(_0x0a71('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x0a71('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x0a71('0xd'));var toCsv=require('to-csv');var querystring=require(_0x0a71('0xe'));var Papa=require('papaparse');var Redis=require(_0x0a71('0xf'));var authService=require(_0x0a71('0x10'));var qs=require(_0x0a71('0x11'));var as=require(_0x0a71('0x12'));var hardwareService=require(_0x0a71('0x13'));var logger=require(_0x0a71('0x14'))(_0x0a71('0x15'));var utils=require(_0x0a71('0x16'));var config=require(_0x0a71('0x17'));var licenseUtil=require(_0x0a71('0x18'));var db=require(_0x0a71('0x19'))['db'];function respondWithStatusCode(_0x3ffdf8,_0x5d1a1e){_0x5d1a1e=_0x5d1a1e||0xcc;return function(_0x2a9822){if(_0x2a9822){return _0x3ffdf8['sendStatus'](_0x5d1a1e);}return _0x3ffdf8['status'](_0x5d1a1e)[_0x0a71('0x1a')]();};}function respondWithResult(_0x5f2120,_0x2a2226){_0x2a2226=_0x2a2226||0xc8;return function(_0x1f63bb){if(_0x1f63bb){return _0x5f2120['status'](_0x2a2226)[_0x0a71('0x1b')](_0x1f63bb);}};}function respondWithFilteredResult(_0x277540,_0x12014b){return function(_0x326fe2){if(_0x326fe2){var _0xd11d63=typeof _0x12014b[_0x0a71('0x1c')]===_0x0a71('0x1d')&&typeof _0x12014b[_0x0a71('0x1e')]==='undefined';var _0x515b4f=_0x326fe2['count'];var _0x82ac1d=_0xd11d63?0x0:_0x12014b[_0x0a71('0x1c')];var _0x53bda8=_0xd11d63?_0x326fe2[_0x0a71('0x1f')]:_0x12014b[_0x0a71('0x1c')]+_0x12014b[_0x0a71('0x1e')];var _0x4d3fd6;if(_0x53bda8>=_0x515b4f){_0x53bda8=_0x515b4f;_0x4d3fd6=0xc8;}else{_0x4d3fd6=0xce;}_0x277540[_0x0a71('0x20')](_0x4d3fd6);return _0x277540[_0x0a71('0x21')](_0x0a71('0x22'),_0x82ac1d+'-'+_0x53bda8+'/'+_0x515b4f)[_0x0a71('0x1b')](_0x326fe2);}return null;};}function patchUpdates(_0x3d4e96){return function(_0x224fa6){try{jsonpatch[_0x0a71('0x23')](_0x224fa6,_0x3d4e96,!![]);}catch(_0x2267b3){return BPromise[_0x0a71('0x24')](_0x2267b3);}return _0x224fa6[_0x0a71('0x25')]();};}function saveUpdates(_0x127a7b,_0x547fae){return function(_0x2b4fed){if(_0x2b4fed){return _0x2b4fed[_0x0a71('0x26')](_0x127a7b)[_0x0a71('0x27')](function(_0xde46cd){return _0xde46cd;});}return null;};}function removeEntity(_0x4c6af2,_0x3c299b){return function(_0x1eccf4){if(_0x1eccf4){return _0x1eccf4[_0x0a71('0x28')]()['then'](function(){_0x4c6af2[_0x0a71('0x20')](0xcc)['end']();});}};}function handleEntityNotFound(_0x79fb68,_0xe75ab8){return function(_0x428e80){if(!_0x428e80){_0x79fb68[_0x0a71('0x29')](0x194);}return _0x428e80;};}function handleError(_0x24d59a,_0x35c58c){_0x35c58c=_0x35c58c||0x1f4;return function(_0x3bc0c2){logger['error'](_0x3bc0c2[_0x0a71('0x2a')]);if(_0x3bc0c2['name']){delete _0x3bc0c2[_0x0a71('0x2b')];}_0x24d59a['status'](_0x35c58c)[_0x0a71('0x2c')](_0x3bc0c2);};}exports[_0x0a71('0x2d')]=function(_0x40a52c,_0x5cb643){var _0x398c47={},_0x352dde={},_0x48d726={'count':0x0,'rows':[]};var _0x51611b=_[_0x0a71('0x2e')](db['FaxTransferReport']['rawAttributes'],function(_0x1c4dea){return{'name':_0x1c4dea[_0x0a71('0x2f')],'type':_0x1c4dea['type'][_0x0a71('0x30')]};});_0x352dde['model']=_[_0x0a71('0x2e')](_0x51611b,'name');_0x352dde[_0x0a71('0x31')]=_[_0x0a71('0x32')](_0x40a52c[_0x0a71('0x31')]);_0x352dde['filters']=_[_0x0a71('0x33')](_0x352dde[_0x0a71('0x34')],_0x352dde[_0x0a71('0x31')]);_0x398c47[_0x0a71('0x35')]=_[_0x0a71('0x33')](_0x352dde['model'],qs['fields'](_0x40a52c[_0x0a71('0x31')][_0x0a71('0x36')]));_0x398c47[_0x0a71('0x35')]=_0x398c47['attributes']['length']?_0x398c47['attributes']:_0x352dde[_0x0a71('0x34')];if(!_0x40a52c[_0x0a71('0x31')]['hasOwnProperty'](_0x0a71('0x37'))){_0x398c47[_0x0a71('0x1e')]=qs[_0x0a71('0x1e')](_0x40a52c[_0x0a71('0x31')]['limit']);_0x398c47[_0x0a71('0x1c')]=qs[_0x0a71('0x1c')](_0x40a52c[_0x0a71('0x31')][_0x0a71('0x1c')]);}_0x398c47[_0x0a71('0x38')]=qs[_0x0a71('0x39')](_0x40a52c[_0x0a71('0x31')][_0x0a71('0x39')]);_0x398c47['where']=qs['filters'](_['pick'](_0x40a52c[_0x0a71('0x31')],_0x352dde[_0x0a71('0x3a')]),_0x51611b);if(_0x40a52c[_0x0a71('0x31')][_0x0a71('0x3b')]){_0x398c47[_0x0a71('0x3c')]=_[_0x0a71('0x3d')](_0x398c47['where'],{'$or':_[_0x0a71('0x2e')](_0x51611b,function(_0x39a4cc){if(_0x39a4cc[_0x0a71('0x3e')]!==_0x0a71('0x3f')){var _0x5402c4={};_0x5402c4[_0x39a4cc[_0x0a71('0x2b')]]={'$like':'%'+_0x40a52c['query'][_0x0a71('0x3b')]+'%'};return _0x5402c4;}})});}_0x398c47=_['merge']({},_0x398c47,_0x40a52c[_0x0a71('0x40')]);var _0x1fede5={'where':_0x398c47[_0x0a71('0x3c')]};return db['FaxTransferReport'][_0x0a71('0x1f')](_0x1fede5)[_0x0a71('0x27')](function(_0x721833){_0x48d726[_0x0a71('0x1f')]=_0x721833;if(_0x40a52c[_0x0a71('0x31')]['includeAll']){_0x398c47[_0x0a71('0x41')]=[{'all':!![]}];}return db[_0x0a71('0x42')][_0x0a71('0x43')](_0x398c47);})['then'](function(_0x588f79){_0x48d726[_0x0a71('0x44')]=_0x588f79;return _0x48d726;})[_0x0a71('0x27')](respondWithFilteredResult(_0x5cb643,_0x398c47))[_0x0a71('0x45')](handleError(_0x5cb643,null));};exports[_0x0a71('0x46')]=function(_0x5620e6,_0x2f46d9){var _0x4c1dc9={'raw':!![],'where':{'id':_0x5620e6['params']['id']}},_0x514c31={};_0x514c31[_0x0a71('0x34')]=_[_0x0a71('0x32')](db['FaxTransferReport'][_0x0a71('0x47')]);_0x514c31['query']=_[_0x0a71('0x32')](_0x5620e6[_0x0a71('0x31')]);_0x514c31[_0x0a71('0x3a')]=_[_0x0a71('0x33')](_0x514c31[_0x0a71('0x34')],_0x514c31[_0x0a71('0x31')]);_0x4c1dc9[_0x0a71('0x35')]=_[_0x0a71('0x33')](_0x514c31['model'],qs[_0x0a71('0x36')](_0x5620e6[_0x0a71('0x31')]['fields']));_0x4c1dc9[_0x0a71('0x35')]=_0x4c1dc9[_0x0a71('0x35')][_0x0a71('0x48')]?_0x4c1dc9[_0x0a71('0x35')]:_0x514c31[_0x0a71('0x34')];if(_0x5620e6['query'][_0x0a71('0x49')]){_0x4c1dc9['include']=[{'all':!![]}];}_0x4c1dc9=_[_0x0a71('0x3d')]({},_0x4c1dc9,_0x5620e6[_0x0a71('0x40')]);return db['FaxTransferReport'][_0x0a71('0x4a')](_0x4c1dc9)[_0x0a71('0x27')](handleEntityNotFound(_0x2f46d9,null))[_0x0a71('0x27')](respondWithResult(_0x2f46d9,null))[_0x0a71('0x45')](handleError(_0x2f46d9,null));};exports[_0x0a71('0x4b')]=function(_0x34d9c8,_0x32629c){return db['FaxTransferReport']['create'](_0x34d9c8[_0x0a71('0x4c')],{})[_0x0a71('0x27')](respondWithResult(_0x32629c,0xc9))['catch'](handleError(_0x32629c,null));};exports[_0x0a71('0x26')]=function(_0x42c5d0,_0x1cb98a){if(_0x42c5d0[_0x0a71('0x4c')]['id']){delete _0x42c5d0[_0x0a71('0x4c')]['id'];}return db['FaxTransferReport'][_0x0a71('0x4a')]({'where':{'id':_0x42c5d0[_0x0a71('0x4d')]['id']}})[_0x0a71('0x27')](handleEntityNotFound(_0x1cb98a,null))['then'](saveUpdates(_0x42c5d0['body'],null))[_0x0a71('0x27')](respondWithResult(_0x1cb98a,null))[_0x0a71('0x45')](handleError(_0x1cb98a,null));};exports['destroy']=function(_0x3e25d0,_0x327d09){return db[_0x0a71('0x42')]['find']({'where':{'id':_0x3e25d0['params']['id']}})[_0x0a71('0x27')](handleEntityNotFound(_0x327d09,null))[_0x0a71('0x27')](removeEntity(_0x327d09,null))[_0x0a71('0x45')](handleError(_0x327d09,null));};exports[_0x0a71('0x4e')]=function(_0x22f43b,_0x49e840){return db[_0x0a71('0x42')]['describe']()['then'](respondWithResult(_0x49e840,null))[_0x0a71('0x45')](handleError(_0x49e840,null));}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.model.js b/server/api/faxTransferReport/faxTransferReport.model.js index dcf5197..c8b7483 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 _0x21fe=['api','moment','path','rimraf','../../config/environment','./faxTransferReport.attributes','exports','define','FaxTransferReport','report_fax_transfer','uniqueid','lodash','../../config/logger'];(function(_0x174d8b,_0x30ed1c){var _0x2d271d=function(_0x425dac){while(--_0x425dac){_0x174d8b['push'](_0x174d8b['shift']());}};_0x2d271d(++_0x30ed1c);}(_0x21fe,0x136));var _0xe21f=function(_0x49d648,_0x2ec450){_0x49d648=_0x49d648-0x0;var _0x1671c6=_0x21fe[_0x49d648];return _0x1671c6;};'use strict';var _=require(_0xe21f('0x0'));var util=require('util');var logger=require(_0xe21f('0x1'))(_0xe21f('0x2'));var moment=require(_0xe21f('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xe21f('0x4'));var rimraf=require(_0xe21f('0x5'));var config=require(_0xe21f('0x6'));var attributes=require(_0xe21f('0x7'));module[_0xe21f('0x8')]=function(_0x3c6530,_0x4e3e21){return _0x3c6530[_0xe21f('0x9')](_0xe21f('0xa'),attributes,{'tableName':_0xe21f('0xb'),'paranoid':![],'indexes':[{'name':_0xe21f('0xc'),'fields':[_0xe21f('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x117c=['../../config/logger','moment','bluebird','request-promise','rimraf','./faxTransferReport.attributes','exports','FaxTransferReport','report_fax_transfer','uniqueid','lodash'];(function(_0x2d357c,_0x58bd29){var _0x1a3480=function(_0x4d8264){while(--_0x4d8264){_0x2d357c['push'](_0x2d357c['shift']());}};_0x1a3480(++_0x58bd29);}(_0x117c,0x11d));var _0xc117=function(_0x39868e,_0x4b6da9){_0x39868e=_0x39868e-0x0;var _0x4eadec=_0x117c[_0x39868e];return _0x4eadec;};'use strict';var _=require(_0xc117('0x0'));var util=require('util');var logger=require(_0xc117('0x1'))('api');var moment=require(_0xc117('0x2'));var BPromise=require(_0xc117('0x3'));var rp=require(_0xc117('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc117('0x5'));var config=require('../../config/environment');var attributes=require(_0xc117('0x6'));module[_0xc117('0x7')]=function(_0x5e7641,_0x1212a7){return _0x5e7641['define'](_0xc117('0x8'),attributes,{'tableName':_0xc117('0x9'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0xc117('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.rpc.js b/server/api/faxTransferReport/faxTransferReport.rpc.js index d2ee7c0..69162b2 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 _0xb4ce=['debug','FaxTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','FaxTransferReport,\x20%s,\x20%s','request\x20sent'];(function(_0x465614,_0x477fb3){var _0x5a0074=function(_0x5b2df9){while(--_0x5b2df9){_0x465614['push'](_0x465614['shift']());}};_0x5a0074(++_0x477fb3);}(_0xb4ce,0xa8));var _0xeb4c=function(_0x11d241,_0x4899b7){_0x11d241=_0x11d241-0x0;var _0x352c73=_0xb4ce[_0x11d241];return _0x352c73;};'use strict';var _=require(_0xeb4c('0x0'));var util=require(_0xeb4c('0x1'));var moment=require(_0xeb4c('0x2'));var BPromise=require(_0xeb4c('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xeb4c('0x4'));var db=require(_0xeb4c('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xeb4c('0x6'))(_0xeb4c('0x7'));var config=require(_0xeb4c('0x8'));var jayson=require(_0xeb4c('0x9'));var client=jayson[_0xeb4c('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1b8114,_0x27ab2e,_0x564495){return new BPromise(function(_0x27167b,_0x4ed958){return client[_0xeb4c('0xb')](_0x1b8114,_0x564495)[_0xeb4c('0xc')](function(_0x12fa41){logger[_0xeb4c('0xd')](_0xeb4c('0xe'),_0x27ab2e,_0xeb4c('0xf'));logger[_0xeb4c('0x10')](_0xeb4c('0x11'),_0x27ab2e,_0xeb4c('0xf'),JSON[_0xeb4c('0x12')](_0x12fa41));if(_0x12fa41[_0xeb4c('0x13')]){if(_0x12fa41[_0xeb4c('0x13')]['code']===0x1f4){logger[_0xeb4c('0x13')](_0xeb4c('0xe'),_0x27ab2e,_0x12fa41[_0xeb4c('0x13')]['message']);return _0x4ed958(_0x12fa41[_0xeb4c('0x13')][_0xeb4c('0x14')]);}logger[_0xeb4c('0x13')](_0xeb4c('0xe'),_0x27ab2e,_0x12fa41[_0xeb4c('0x13')][_0xeb4c('0x14')]);return _0x27167b(_0x12fa41['error'][_0xeb4c('0x14')]);}else{logger[_0xeb4c('0xd')](_0xeb4c('0xe'),_0x27ab2e,_0xeb4c('0xf'));_0x27167b(_0x12fa41[_0xeb4c('0x15')][_0xeb4c('0x14')]);}})[_0xeb4c('0x16')](function(_0x6e80ac){logger[_0xeb4c('0x13')]('FaxTransferReport,\x20%s,\x20%s',_0x27ab2e,_0x6e80ac);_0x4ed958(_0x6e80ac);});});} \ No newline at end of file +var _0x4a0f=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','FaxTransferReport,\x20%s,\x20%s','request\x20sent','FaxTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','moment'];(function(_0x18f7e5,_0x547ea5){var _0x84094e=function(_0x338f10){while(--_0x338f10){_0x18f7e5['push'](_0x18f7e5['shift']());}};_0x84094e(++_0x547ea5);}(_0x4a0f,0x111));var _0xf4a0=function(_0x4301e8,_0x2db3c6){_0x4301e8=_0x4301e8-0x0;var _0x1b8df2=_0x4a0f[_0x4301e8];return _0x1b8df2;};'use strict';var _=require(_0xf4a0('0x0'));var util=require(_0xf4a0('0x1'));var moment=require(_0xf4a0('0x2'));var BPromise=require(_0xf4a0('0x3'));var rs=require(_0xf4a0('0x4'));var fs=require('fs');var Redis=require(_0xf4a0('0x5'));var db=require(_0xf4a0('0x6'))['db'];var utils=require(_0xf4a0('0x7'));var logger=require(_0xf4a0('0x8'))(_0xf4a0('0x9'));var config=require(_0xf4a0('0xa'));var jayson=require(_0xf4a0('0xb'));var client=jayson['client'][_0xf4a0('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x4a69aa,_0x4f224d,_0x8a1ad6){return new BPromise(function(_0x4ca5c8,_0x4303ce){return client[_0xf4a0('0xd')](_0x4a69aa,_0x8a1ad6)['then'](function(_0x3994d0){logger[_0xf4a0('0xe')](_0xf4a0('0xf'),_0x4f224d,_0xf4a0('0x10'));logger['debug'](_0xf4a0('0x11'),_0x4f224d,_0xf4a0('0x10'),JSON[_0xf4a0('0x12')](_0x3994d0));if(_0x3994d0[_0xf4a0('0x13')]){if(_0x3994d0[_0xf4a0('0x13')][_0xf4a0('0x14')]===0x1f4){logger['error'](_0xf4a0('0xf'),_0x4f224d,_0x3994d0['error'][_0xf4a0('0x15')]);return _0x4303ce(_0x3994d0[_0xf4a0('0x13')]['message']);}logger[_0xf4a0('0x13')](_0xf4a0('0xf'),_0x4f224d,_0x3994d0[_0xf4a0('0x13')][_0xf4a0('0x15')]);return _0x4ca5c8(_0x3994d0['error'][_0xf4a0('0x15')]);}else{logger[_0xf4a0('0xe')](_0xf4a0('0xf'),_0x4f224d,_0xf4a0('0x10'));_0x4ca5c8(_0x3994d0['result']['message']);}})[_0xf4a0('0x16')](function(_0x3774c1){logger[_0xf4a0('0x13')]('FaxTransferReport,\x20%s,\x20%s',_0x4f224d,_0x3774c1);_0x4303ce(_0x3774c1);});});} \ No newline at end of file diff --git a/server/api/faxTransferReport/index.js b/server/api/faxTransferReport/index.js index 0445523..f1532b6 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 _0x42ca=['../../config/environment','./faxTransferReport.controller','isAuthenticated','index','get','/describe','describe','show','post','update','delete','/:id','destroy','exports','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x20f7b7,_0x4e9d8b){var _0xbad511=function(_0x49cd47){while(--_0x49cd47){_0x20f7b7['push'](_0x20f7b7['shift']());}};_0xbad511(++_0x4e9d8b);}(_0x42ca,0x1b2));var _0xa42c=function(_0x4259a3,_0x2f9e82){_0x4259a3=_0x4259a3-0x0;var _0x5dfed4=_0x42ca[_0x4259a3];return _0x5dfed4;};'use strict';var multer=require('multer');var util=require(_0xa42c('0x0'));var path=require(_0xa42c('0x1'));var timeout=require(_0xa42c('0x2'));var express=require(_0xa42c('0x3'));var router=express['Router']();var fs_extra=require(_0xa42c('0x4'));var auth=require(_0xa42c('0x5'));var interaction=require(_0xa42c('0x6'));var config=require(_0xa42c('0x7'));var controller=require(_0xa42c('0x8'));router['get']('/',auth[_0xa42c('0x9')](),controller[_0xa42c('0xa')]);router[_0xa42c('0xb')](_0xa42c('0xc'),auth[_0xa42c('0x9')](),controller[_0xa42c('0xd')]);router[_0xa42c('0xb')]('/:id',auth['isAuthenticated'](),controller[_0xa42c('0xe')]);router[_0xa42c('0xf')]('/',auth[_0xa42c('0x9')](),controller['create']);router['put']('/:id',auth['isAuthenticated'](),controller[_0xa42c('0x10')]);router[_0xa42c('0x11')](_0xa42c('0x12'),auth['isAuthenticated'](),controller[_0xa42c('0x13')]);module[_0xa42c('0x14')]=router; \ No newline at end of file +var _0x15b0=['connect-timeout','express','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','create','put','update','delete','destroy','exports','multer'];(function(_0x5e3a45,_0x45f0c5){var _0x13419f=function(_0x5ac996){while(--_0x5ac996){_0x5e3a45['push'](_0x5e3a45['shift']());}};_0x13419f(++_0x45f0c5);}(_0x15b0,0x131));var _0x015b=function(_0x1e73fc,_0x533750){_0x1e73fc=_0x1e73fc-0x0;var _0xeceac4=_0x15b0[_0x1e73fc];return _0xeceac4;};'use strict';var multer=require(_0x015b('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x015b('0x1'));var express=require(_0x015b('0x2'));var router=express[_0x015b('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x015b('0x4'));var config=require(_0x015b('0x5'));var controller=require('./faxTransferReport.controller');router[_0x015b('0x6')]('/',auth[_0x015b('0x7')](),controller[_0x015b('0x8')]);router[_0x015b('0x6')](_0x015b('0x9'),auth[_0x015b('0x7')](),controller[_0x015b('0xa')]);router[_0x015b('0x6')](_0x015b('0xb'),auth[_0x015b('0x7')](),controller['show']);router['post']('/',auth[_0x015b('0x7')](),controller[_0x015b('0xc')]);router[_0x015b('0xd')]('/:id',auth[_0x015b('0x7')](),controller[_0x015b('0xe')]);router[_0x015b('0xf')](_0x015b('0xb'),auth[_0x015b('0x7')](),controller[_0x015b('0x10')]);module[_0x015b('0x11')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/index.js b/server/api/intDeskAccount/index.js index fc6d930..72dd508 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 _0x4c2a=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./intDeskAccount.controller','get','index','/:id','isAuthenticated','/:id/configurations','getConfigurations','/:id/fields','post','create','put','update','delete','destroy','exports'];(function(_0x473a79,_0x5e608b){var _0x5a91b3=function(_0x302411){while(--_0x302411){_0x473a79['push'](_0x473a79['shift']());}};_0x5a91b3(++_0x5e608b);}(_0x4c2a,0x1b5));var _0xa4c2=function(_0x1dfc71,_0x52cbd3){_0x1dfc71=_0x1dfc71-0x0;var _0x449188=_0x4c2a[_0x1dfc71];return _0x449188;};'use strict';var multer=require('multer');var util=require(_0xa4c2('0x0'));var path=require(_0xa4c2('0x1'));var timeout=require(_0xa4c2('0x2'));var express=require(_0xa4c2('0x3'));var router=express[_0xa4c2('0x4')]();var fs_extra=require(_0xa4c2('0x5'));var auth=require(_0xa4c2('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xa4c2('0x7'));var controller=require(_0xa4c2('0x8'));router[_0xa4c2('0x9')]('/',auth['isAuthenticated'](),controller[_0xa4c2('0xa')]);router[_0xa4c2('0x9')](_0xa4c2('0xb'),auth[_0xa4c2('0xc')](),controller['show']);router[_0xa4c2('0x9')](_0xa4c2('0xd'),auth[_0xa4c2('0xc')](),controller[_0xa4c2('0xe')]);router['get'](_0xa4c2('0xf'),auth['isAuthenticated'](),controller['getFields']);router[_0xa4c2('0x10')]('/',auth[_0xa4c2('0xc')](),controller[_0xa4c2('0x11')]);router['post']('/:id/configurations',auth[_0xa4c2('0xc')](),controller['addConfiguration']);router[_0xa4c2('0x12')](_0xa4c2('0xb'),auth[_0xa4c2('0xc')](),controller[_0xa4c2('0x13')]);router[_0xa4c2('0x14')](_0xa4c2('0xb'),auth[_0xa4c2('0xc')](),controller[_0xa4c2('0x15')]);module[_0xa4c2('0x16')]=router; \ No newline at end of file +var _0xc113=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intDeskAccount.controller','get','index','/:id','show','getConfigurations','isAuthenticated','getFields','post','create','/:id/configurations','addConfiguration','delete','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x43a6cd,_0x1abe8f){var _0x1395b2=function(_0x20645a){while(--_0x20645a){_0x43a6cd['push'](_0x43a6cd['shift']());}};_0x1395b2(++_0x1abe8f);}(_0xc113,0x1ab));var _0x3c11=function(_0x3005f1,_0x247258){_0x3005f1=_0x3005f1-0x0;var _0x2d292b=_0xc113[_0x3005f1];return _0x2d292b;};'use strict';var multer=require(_0x3c11('0x0'));var util=require(_0x3c11('0x1'));var path=require(_0x3c11('0x2'));var timeout=require(_0x3c11('0x3'));var express=require(_0x3c11('0x4'));var router=express[_0x3c11('0x5')]();var fs_extra=require(_0x3c11('0x6'));var auth=require(_0x3c11('0x7'));var interaction=require(_0x3c11('0x8'));var config=require('../../config/environment');var controller=require(_0x3c11('0x9'));router[_0x3c11('0xa')]('/',auth['isAuthenticated'](),controller[_0x3c11('0xb')]);router[_0x3c11('0xa')](_0x3c11('0xc'),auth['isAuthenticated'](),controller[_0x3c11('0xd')]);router['get']('/:id/configurations',auth['isAuthenticated'](),controller[_0x3c11('0xe')]);router[_0x3c11('0xa')]('/:id/fields',auth[_0x3c11('0xf')](),controller[_0x3c11('0x10')]);router[_0x3c11('0x11')]('/',auth['isAuthenticated'](),controller[_0x3c11('0x12')]);router[_0x3c11('0x11')](_0x3c11('0x13'),auth[_0x3c11('0xf')](),controller[_0x3c11('0x14')]);router['put'](_0x3c11('0xc'),auth[_0x3c11('0xf')](),controller['update']);router[_0x3c11('0x15')](_0x3c11('0xc'),auth[_0x3c11('0xf')](),controller[_0x3c11('0x16')]);module[_0x3c11('0x17')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.attributes.js b/server/api/intDeskAccount/intDeskAccount.attributes.js index 35e5ac9..d3f40f6 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 _0xe145=['STRING','ENUM','basic','integrationTab','newTab','sequelize'];(function(_0x1e9653,_0x16eb29){var _0x39f6c2=function(_0x448a5e){while(--_0x448a5e){_0x1e9653['push'](_0x1e9653['shift']());}};_0x39f6c2(++_0x16eb29);}(_0xe145,0x1d3));var _0x5e14=function(_0x325226,_0x1103c7){_0x325226=_0x325226-0x0;var _0x181883=_0xe145[_0x325226];return _0x181883;};'use strict';var Sequelize=require(_0x5e14('0x0'));module['exports']={'name':{'type':Sequelize[_0x5e14('0x1')]},'description':{'type':Sequelize[_0x5e14('0x1')]},'username':{'type':Sequelize[_0x5e14('0x1')]},'remoteUri':{'type':Sequelize[_0x5e14('0x1')]},'authType':{'type':Sequelize[_0x5e14('0x2')](_0x5e14('0x3')),'defaultValue':_0x5e14('0x3')},'password':{'type':Sequelize[_0x5e14('0x1')]},'consumerKey':{'type':Sequelize['STRING']},'consumerSecret':{'type':Sequelize['STRING']},'token':{'type':Sequelize['STRING']},'tokenSecret':{'type':Sequelize[_0x5e14('0x1')]},'serverUrl':{'type':Sequelize[_0x5e14('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x5e14('0x2')](_0x5e14('0x4'),_0x5e14('0x5')),'defaultValue':'integrationTab'}}; \ No newline at end of file +var _0xf892=['sequelize','STRING','ENUM','basic','integrationTab','newTab'];(function(_0x4dce97,_0x1b9719){var _0x417143=function(_0x1a5472){while(--_0x1a5472){_0x4dce97['push'](_0x4dce97['shift']());}};_0x417143(++_0x1b9719);}(_0xf892,0x9c));var _0x2f89=function(_0x1ae139,_0x529c60){_0x1ae139=_0x1ae139-0x0;var _0x5e0de7=_0xf892[_0x1ae139];return _0x5e0de7;};'use strict';var Sequelize=require(_0x2f89('0x0'));module['exports']={'name':{'type':Sequelize[_0x2f89('0x1')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x2f89('0x1')]},'remoteUri':{'type':Sequelize[_0x2f89('0x1')]},'authType':{'type':Sequelize[_0x2f89('0x2')](_0x2f89('0x3')),'defaultValue':_0x2f89('0x3')},'password':{'type':Sequelize[_0x2f89('0x1')]},'consumerKey':{'type':Sequelize[_0x2f89('0x1')]},'consumerSecret':{'type':Sequelize['STRING']},'token':{'type':Sequelize[_0x2f89('0x1')]},'tokenSecret':{'type':Sequelize[_0x2f89('0x1')]},'serverUrl':{'type':Sequelize[_0x2f89('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x2f89('0x2')](_0x2f89('0x4'),_0x2f89('0x5')),'defaultValue':'integrationTab'}}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.controller.js b/server/api/intDeskAccount/intDeskAccount.controller.js index 8bc835f..e428bc1 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 _0xc2e5=['username','consumerKey','consumerSecret','tokenSecret','slice','substring','GET','format','%s/custom_fields','application/json','headers','%s:%s','password','_embedded','entries','active','label','test','statusCode','stringify','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','limit','count','offset','set','Content-Range','save','update','then','destroy','error','stack','name','send','index','map','DeskAccount','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','keys','rawAttributes','find','create','body','getConfigurations','findOne','DeskConfiguration','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','DeskField','getFields','priority','remoteUri','authType'];(function(_0x14bd97,_0x48f9e6){var _0x5a11c5=function(_0x95238){while(--_0x95238){_0x14bd97['push'](_0x14bd97['shift']());}};_0x5a11c5(++_0x48f9e6);}(_0xc2e5,0x87));var _0x5c2e=function(_0x149a9b,_0x5bb275){_0x149a9b=_0x149a9b-0x0;var _0x2c2bf6=_0xc2e5[_0x149a9b];return _0x2c2bf6;};'use strict';var emlformat=require(_0x5c2e('0x0'));var rimraf=require(_0x5c2e('0x1'));var zipdir=require(_0x5c2e('0x2'));var jsonpatch=require(_0x5c2e('0x3'));var rp=require(_0x5c2e('0x4'));var moment=require('moment');var BPromise=require(_0x5c2e('0x5'));var Mustache=require(_0x5c2e('0x6'));var util=require('util');var path=require('path');var sox=require(_0x5c2e('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5c2e('0x8'));var _=require(_0x5c2e('0x9'));var squel=require(_0x5c2e('0xa'));var crypto=require(_0x5c2e('0xb'));var jsforce=require(_0x5c2e('0xc'));var deskjs=require(_0x5c2e('0xd'));var toCsv=require(_0x5c2e('0xe'));var querystring=require(_0x5c2e('0xf'));var Papa=require(_0x5c2e('0x10'));var Redis=require(_0x5c2e('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x5c2e('0x12'));var as=require(_0x5c2e('0x13'));var hardwareService=require(_0x5c2e('0x14'));var logger=require(_0x5c2e('0x15'))(_0x5c2e('0x16'));var utils=require(_0x5c2e('0x17'));var config=require(_0x5c2e('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x5c2e('0x19'))['db'];var integrations=require(_0x5c2e('0x1a'));function respondWithStatusCode(_0x5f2759,_0x5587a7){_0x5587a7=_0x5587a7||0xcc;return function(_0xaec169){if(_0xaec169){return _0x5f2759[_0x5c2e('0x1b')](_0x5587a7);}return _0x5f2759[_0x5c2e('0x1c')](_0x5587a7)[_0x5c2e('0x1d')]();};}function respondWithResult(_0x154ae7,_0x15e616){_0x15e616=_0x15e616||0xc8;return function(_0x1c791e){if(_0x1c791e){return _0x154ae7[_0x5c2e('0x1c')](_0x15e616)[_0x5c2e('0x1e')](_0x1c791e);}};}function respondWithFilteredResult(_0x44a113,_0x495eb6){return function(_0x42b3cd){if(_0x42b3cd){var _0x46e47d=typeof _0x495eb6['offset']==='undefined'&&typeof _0x495eb6[_0x5c2e('0x1f')]==='undefined';var _0x7f0cad=_0x42b3cd[_0x5c2e('0x20')];var _0x5237e3=_0x46e47d?0x0:_0x495eb6[_0x5c2e('0x21')];var _0x1aafdc=_0x46e47d?_0x42b3cd[_0x5c2e('0x20')]:_0x495eb6[_0x5c2e('0x21')]+_0x495eb6['limit'];var _0x35e8ef;if(_0x1aafdc>=_0x7f0cad){_0x1aafdc=_0x7f0cad;_0x35e8ef=0xc8;}else{_0x35e8ef=0xce;}_0x44a113[_0x5c2e('0x1c')](_0x35e8ef);return _0x44a113[_0x5c2e('0x22')](_0x5c2e('0x23'),_0x5237e3+'-'+_0x1aafdc+'/'+_0x7f0cad)[_0x5c2e('0x1e')](_0x42b3cd);}return null;};}function patchUpdates(_0x459b2f){return function(_0x5205ae){try{jsonpatch['apply'](_0x5205ae,_0x459b2f,!![]);}catch(_0xadaf50){return BPromise['reject'](_0xadaf50);}return _0x5205ae[_0x5c2e('0x24')]();};}function saveUpdates(_0x5b8e2a,_0x509c48){return function(_0x569321){if(_0x569321){return _0x569321[_0x5c2e('0x25')](_0x5b8e2a)[_0x5c2e('0x26')](function(_0x106d01){return _0x106d01;});}return null;};}function removeEntity(_0x1660f3,_0x5f051d){return function(_0x819453){if(_0x819453){return _0x819453[_0x5c2e('0x27')]()[_0x5c2e('0x26')](function(){_0x1660f3[_0x5c2e('0x1c')](0xcc)[_0x5c2e('0x1d')]();});}};}function handleEntityNotFound(_0x53c6f7,_0x35a56b){return function(_0x2e18c2){if(!_0x2e18c2){_0x53c6f7[_0x5c2e('0x1b')](0x194);}return _0x2e18c2;};}function handleError(_0x52c04f,_0x475c4d){_0x475c4d=_0x475c4d||0x1f4;return function(_0x596c75){logger[_0x5c2e('0x28')](_0x596c75[_0x5c2e('0x29')]);if(_0x596c75[_0x5c2e('0x2a')]){delete _0x596c75[_0x5c2e('0x2a')];}_0x52c04f['status'](_0x475c4d)[_0x5c2e('0x2b')](_0x596c75);};}exports[_0x5c2e('0x2c')]=function(_0x412eb5,_0x3b3bac){var _0x2de061={},_0x588beb={},_0x533fd8={'count':0x0,'rows':[]};var _0x417e73=_[_0x5c2e('0x2d')](db[_0x5c2e('0x2e')]['rawAttributes'],function(_0xb245b6){return{'name':_0xb245b6[_0x5c2e('0x2f')],'type':_0xb245b6[_0x5c2e('0x30')][_0x5c2e('0x31')]};});_0x588beb[_0x5c2e('0x32')]=_[_0x5c2e('0x2d')](_0x417e73,_0x5c2e('0x2a'));_0x588beb[_0x5c2e('0x33')]=_['keys'](_0x412eb5[_0x5c2e('0x33')]);_0x588beb[_0x5c2e('0x34')]=_[_0x5c2e('0x35')](_0x588beb[_0x5c2e('0x32')],_0x588beb[_0x5c2e('0x33')]);_0x2de061[_0x5c2e('0x36')]=_[_0x5c2e('0x35')](_0x588beb[_0x5c2e('0x32')],qs[_0x5c2e('0x37')](_0x412eb5[_0x5c2e('0x33')][_0x5c2e('0x37')]));_0x2de061[_0x5c2e('0x36')]=_0x2de061[_0x5c2e('0x36')][_0x5c2e('0x38')]?_0x2de061[_0x5c2e('0x36')]:_0x588beb[_0x5c2e('0x32')];if(!_0x412eb5[_0x5c2e('0x33')]['hasOwnProperty'](_0x5c2e('0x39'))){_0x2de061[_0x5c2e('0x1f')]=qs[_0x5c2e('0x1f')](_0x412eb5['query'][_0x5c2e('0x1f')]);_0x2de061['offset']=qs[_0x5c2e('0x21')](_0x412eb5['query'][_0x5c2e('0x21')]);}_0x2de061[_0x5c2e('0x3a')]=qs[_0x5c2e('0x3b')](_0x412eb5[_0x5c2e('0x33')][_0x5c2e('0x3b')]);_0x2de061[_0x5c2e('0x3c')]=qs[_0x5c2e('0x34')](_[_0x5c2e('0x3d')](_0x412eb5[_0x5c2e('0x33')],_0x588beb[_0x5c2e('0x34')]),_0x417e73);if(_0x412eb5['query'][_0x5c2e('0x3e')]){_0x2de061[_0x5c2e('0x3c')]=_[_0x5c2e('0x3f')](_0x2de061[_0x5c2e('0x3c')],{'$or':_[_0x5c2e('0x2d')](_0x417e73,function(_0x23379b){if(_0x23379b[_0x5c2e('0x30')]!==_0x5c2e('0x40')){var _0x2aeffa={};_0x2aeffa[_0x23379b[_0x5c2e('0x2a')]]={'$like':'%'+_0x412eb5[_0x5c2e('0x33')][_0x5c2e('0x3e')]+'%'};return _0x2aeffa;}})});}_0x2de061=_[_0x5c2e('0x3f')]({},_0x2de061,_0x412eb5[_0x5c2e('0x41')]);var _0x46faa5={'where':_0x2de061[_0x5c2e('0x3c')]};return db[_0x5c2e('0x2e')][_0x5c2e('0x20')](_0x46faa5)['then'](function(_0x46b690){_0x533fd8['count']=_0x46b690;if(_0x412eb5[_0x5c2e('0x33')][_0x5c2e('0x42')]){_0x2de061[_0x5c2e('0x43')]=[{'all':!![]}];}return db[_0x5c2e('0x2e')][_0x5c2e('0x44')](_0x2de061);})[_0x5c2e('0x26')](function(_0x205429){_0x533fd8[_0x5c2e('0x45')]=_0x205429;return _0x533fd8;})[_0x5c2e('0x26')](respondWithFilteredResult(_0x3b3bac,_0x2de061))[_0x5c2e('0x46')](handleError(_0x3b3bac,null));};exports[_0x5c2e('0x47')]=function(_0x3e182c,_0x47ce34){var _0x124e36={'raw':![],'where':{'id':_0x3e182c[_0x5c2e('0x48')]['id']}},_0x830bf6={};_0x830bf6[_0x5c2e('0x32')]=_[_0x5c2e('0x49')](db[_0x5c2e('0x2e')][_0x5c2e('0x4a')]);_0x830bf6['query']=_[_0x5c2e('0x49')](_0x3e182c['query']);_0x830bf6[_0x5c2e('0x34')]=_[_0x5c2e('0x35')](_0x830bf6['model'],_0x830bf6[_0x5c2e('0x33')]);_0x124e36['attributes']=_[_0x5c2e('0x35')](_0x830bf6['model'],qs[_0x5c2e('0x37')](_0x3e182c['query'][_0x5c2e('0x37')]));_0x124e36['attributes']=_0x124e36[_0x5c2e('0x36')][_0x5c2e('0x38')]?_0x124e36[_0x5c2e('0x36')]:_0x830bf6['model'];if(_0x3e182c[_0x5c2e('0x33')][_0x5c2e('0x42')]){_0x124e36[_0x5c2e('0x43')]=[{'all':!![]}];}_0x124e36=_[_0x5c2e('0x3f')]({},_0x124e36,_0x3e182c['options']);return db[_0x5c2e('0x2e')][_0x5c2e('0x4b')](_0x124e36)[_0x5c2e('0x26')](handleEntityNotFound(_0x47ce34,null))['then'](respondWithResult(_0x47ce34,null))[_0x5c2e('0x46')](handleError(_0x47ce34,null));};exports['create']=function(_0x4fd115,_0x2762d6){return db[_0x5c2e('0x2e')][_0x5c2e('0x4c')](_0x4fd115['body'],{})[_0x5c2e('0x26')](respondWithResult(_0x2762d6,0xc9))[_0x5c2e('0x46')](handleError(_0x2762d6,null));};exports['update']=function(_0x2c7533,_0x36157c){if(_0x2c7533[_0x5c2e('0x4d')]['id']){delete _0x2c7533[_0x5c2e('0x4d')]['id'];}return db['DeskAccount'][_0x5c2e('0x4b')]({'where':{'id':_0x2c7533[_0x5c2e('0x48')]['id']}})['then'](handleEntityNotFound(_0x36157c,null))[_0x5c2e('0x26')](saveUpdates(_0x2c7533[_0x5c2e('0x4d')],null))[_0x5c2e('0x26')](respondWithResult(_0x36157c,null))[_0x5c2e('0x46')](handleError(_0x36157c,null));};exports[_0x5c2e('0x27')]=function(_0x50ecd6,_0x5e27e1){return db[_0x5c2e('0x2e')][_0x5c2e('0x4b')]({'where':{'id':_0x50ecd6['params']['id']}})[_0x5c2e('0x26')](handleEntityNotFound(_0x5e27e1,null))[_0x5c2e('0x26')](removeEntity(_0x5e27e1,null))['catch'](handleError(_0x5e27e1,null));};exports[_0x5c2e('0x4e')]=function(_0x1fed00,_0x3e36f3,_0x28ef1f){var _0x17b096={};var _0x5efd3e={};var _0x124971;var _0x237fa5;return db[_0x5c2e('0x2e')][_0x5c2e('0x4f')]({'where':{'id':_0x1fed00[_0x5c2e('0x48')]['id']}})[_0x5c2e('0x26')](handleEntityNotFound(_0x3e36f3,null))[_0x5c2e('0x26')](function(_0x3c106f){if(_0x3c106f){_0x124971=_0x3c106f;_0x5efd3e[_0x5c2e('0x32')]=_[_0x5c2e('0x49')](db[_0x5c2e('0x50')][_0x5c2e('0x4a')]);_0x5efd3e[_0x5c2e('0x33')]=_['keys'](_0x1fed00[_0x5c2e('0x33')]);_0x5efd3e[_0x5c2e('0x34')]=_[_0x5c2e('0x35')](_0x5efd3e['model'],_0x5efd3e['query']);_0x17b096['attributes']=_[_0x5c2e('0x35')](_0x5efd3e[_0x5c2e('0x32')],qs[_0x5c2e('0x37')](_0x1fed00['query'][_0x5c2e('0x37')]));_0x17b096[_0x5c2e('0x36')]=_0x17b096[_0x5c2e('0x36')][_0x5c2e('0x38')]?_0x17b096[_0x5c2e('0x36')]:_0x5efd3e['model'];_0x17b096['order']=qs[_0x5c2e('0x3b')](_0x1fed00[_0x5c2e('0x33')][_0x5c2e('0x3b')]);_0x17b096['where']=qs['filters'](_['pick'](_0x1fed00[_0x5c2e('0x33')],_0x5efd3e[_0x5c2e('0x34')]));if(_0x1fed00[_0x5c2e('0x33')][_0x5c2e('0x3e')]){_0x17b096[_0x5c2e('0x3c')]=_['merge'](_0x17b096[_0x5c2e('0x3c')],{'$or':_['map'](_0x17b096[_0x5c2e('0x36')],function(_0x31b840){var _0x30dd8f={};_0x30dd8f[_0x31b840]={'$like':'%'+_0x1fed00['query']['filter']+'%'};return _0x30dd8f;})});}_0x17b096=_[_0x5c2e('0x3f')]({},_0x17b096,_0x1fed00[_0x5c2e('0x41')]);return _0x124971['getConfigurations'](_0x17b096);}})[_0x5c2e('0x26')](function(_0x437d8f){if(_0x437d8f){_0x237fa5=_0x437d8f[_0x5c2e('0x38')];if(!_0x1fed00[_0x5c2e('0x33')]['hasOwnProperty']('nolimit')){_0x17b096[_0x5c2e('0x1f')]=qs[_0x5c2e('0x1f')](_0x1fed00[_0x5c2e('0x33')][_0x5c2e('0x1f')]);_0x17b096[_0x5c2e('0x21')]=qs['offset'](_0x1fed00[_0x5c2e('0x33')]['offset']);}return _0x124971[_0x5c2e('0x4e')](_0x17b096);}})[_0x5c2e('0x26')](function(_0x127450){if(_0x127450){return _0x127450?{'count':_0x237fa5,'rows':_0x127450}:null;}})['then'](respondWithResult(_0x3e36f3,null))[_0x5c2e('0x46')](handleError(_0x3e36f3,null));};exports[_0x5c2e('0x51')]=function(_0xfe57d5,_0x3b23b3,_0x217bd3){if(_0xfe57d5[_0x5c2e('0x4d')]['id']){delete _0xfe57d5[_0x5c2e('0x4d')]['id'];}return db['DeskAccount'][_0x5c2e('0x4f')]({'where':{'id':_0xfe57d5['params']['id']}})[_0x5c2e('0x26')](handleEntityNotFound(_0x3b23b3,null))['then'](function(_0x410168){if(_0x410168){_0xfe57d5[_0x5c2e('0x4d')][_0x5c2e('0x52')]=_0x410168['id'];_0xfe57d5[_0x5c2e('0x4d')][_0x5c2e('0x53')]=integrations[_0x5c2e('0x54')](_0xfe57d5[_0x5c2e('0x4d')][_0x5c2e('0x55')],_0xfe57d5[_0x5c2e('0x4d')][_0x5c2e('0x30')]);_0xfe57d5[_0x5c2e('0x4d')][_0x5c2e('0x56')]=integrations[_0x5c2e('0x57')](_0xfe57d5[_0x5c2e('0x4d')][_0x5c2e('0x55')],_0xfe57d5[_0x5c2e('0x4d')][_0x5c2e('0x30')]);return db['DeskConfiguration'][_0x5c2e('0x4c')](_0xfe57d5[_0x5c2e('0x4d')],{'include':[{'model':db[_0x5c2e('0x58')],'as':'Subjects'},{'model':db['DeskField'],'as':'Descriptions'}]});}return null;})[_0x5c2e('0x26')](respondWithResult(_0x3b23b3,null))[_0x5c2e('0x46')](handleError(_0x3b23b3,null));};exports[_0x5c2e('0x59')]=function(_0x10d613,_0x27b657,_0x5dd7de){var _0x2320f3=[{'name':_0x5c2e('0x5a'),'label':_0x5c2e('0x5a'),'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 _0x528ca7='';return db[_0x5c2e('0x2e')][_0x5c2e('0x4f')]({'where':{'id':_0x10d613[_0x5c2e('0x48')]['id']},'attributes':['id',_0x5c2e('0x5b'),_0x5c2e('0x5c'),_0x5c2e('0x5d'),'password',_0x5c2e('0x5e'),_0x5c2e('0x5f'),'token',_0x5c2e('0x60')]})[_0x5c2e('0x26')](handleEntityNotFound(_0x27b657,null))['then'](function(_0x1d59db){if(_0x1d59db){_0x528ca7=_0x1d59db[_0x5c2e('0x5b')];var _0x1dd931=_0x528ca7[_0x5c2e('0x61')](-0x1);if(_0x1dd931==='/'){_0x528ca7=_0x528ca7[_0x5c2e('0x62')](0x0,_0x528ca7['lastIndexOf'](_0x1dd931));}var _0x17fd7d={'method':_0x5c2e('0x63'),'uri':util[_0x5c2e('0x64')](_0x5c2e('0x65'),_0x528ca7),'headers':{'Content-Type':_0x5c2e('0x66'),'Accept':'application/json'},'json':!![]};if(_0x1d59db['authType']==='basic'){_0x17fd7d[_0x5c2e('0x67')]['Authorization']=util[_0x5c2e('0x64')]('Basic\x20%s',new Buffer(util[_0x5c2e('0x64')](_0x5c2e('0x68'),_0x1d59db[_0x5c2e('0x5d')],_0x1d59db[_0x5c2e('0x69')]))['toString']('base64'));}return rp(_0x17fd7d)['then'](function(_0x407969){return _0x2320f3['concat'](_[_0x5c2e('0x2d')](_0x407969[_0x5c2e('0x6a')][_0x5c2e('0x6b')],function(_0x31ee94){return{'id':_0x31ee94[_0x5c2e('0x2a')],'name':_0x31ee94['name'],'type':_0x31ee94['type'],'active':_0x31ee94[_0x5c2e('0x6c')],'label':_0x31ee94[_0x5c2e('0x6d')],'custom':!![]};}));});}})['then'](function(_0x5d95fc){return{'count':_0x5d95fc[_0x5c2e('0x38')],'rows':_0x5d95fc};})['then'](respondWithResult(_0x27b657,null))['catch'](function(_0x200c93){var _0x904476=_0x10d613[_0x5c2e('0x33')][_0x5c2e('0x6e')]?0x1f4:_0x200c93[_0x5c2e('0x6f')]||0x1f4;logger['error']('getFields,\x20%s,\x20%s,\x20%s',_0x5c2e('0x59'),_0x904476,JSON[_0x5c2e('0x70')](_0x200c93));delete _0x200c93[_0x5c2e('0x2a')];if(_0x904476===0x191){_0x904476=0x190;}_0x27b657[_0x5c2e('0x1c')](_0x904476)[_0x5c2e('0x2b')](_0x10d613['query'][_0x5c2e('0x6e')]?{'message':_0x5c2e('0x71'),'statusCode':_0x200c93[_0x5c2e('0x6f')]}:_0x200c93);});}; \ No newline at end of file +var _0x5f10=['rows','catch','show','params','filters','includeAll','include','find','create','update','body','getConfigurations','DeskConfiguration','order','addConfiguration','findOne','Subjects','getDescriptions','channel','DeskField','priority','authType','username','password','consumerKey','consumerSecret','tokenSecret','remoteUri','substring','lastIndexOf','GET','format','%s/custom_fields','basic','headers','Authorization','Basic\x20%s','%s:%s','toString','base64','concat','entries','active','label','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','stringify','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','undefined','count','offset','limit','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','send','map','DeskAccount','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','type','options','findAll'];(function(_0x47d7fb,_0x381133){var _0x1afe19=function(_0x139ab7){while(--_0x139ab7){_0x47d7fb['push'](_0x47d7fb['shift']());}};_0x1afe19(++_0x381133);}(_0x5f10,0x18b));var _0x05f1=function(_0x303875,_0x29fc7f){_0x303875=_0x303875-0x0;var _0x507814=_0x5f10[_0x303875];return _0x507814;};'use strict';var emlformat=require(_0x05f1('0x0'));var rimraf=require(_0x05f1('0x1'));var zipdir=require(_0x05f1('0x2'));var jsonpatch=require(_0x05f1('0x3'));var rp=require(_0x05f1('0x4'));var moment=require('moment');var BPromise=require(_0x05f1('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x05f1('0x6'));var sox=require(_0x05f1('0x7'));var csv=require(_0x05f1('0x8'));var ejs=require(_0x05f1('0x9'));var fs=require('fs');var fs_extra=require(_0x05f1('0xa'));var _=require(_0x05f1('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x05f1('0xc'));var toCsv=require('to-csv');var querystring=require(_0x05f1('0xd'));var Papa=require(_0x05f1('0xe'));var Redis=require(_0x05f1('0xf'));var authService=require(_0x05f1('0x10'));var qs=require(_0x05f1('0x11'));var as=require(_0x05f1('0x12'));var hardwareService=require(_0x05f1('0x13'));var logger=require(_0x05f1('0x14'))(_0x05f1('0x15'));var utils=require(_0x05f1('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x05f1('0x17'));var db=require(_0x05f1('0x18'))['db'];var integrations=require(_0x05f1('0x19'));function respondWithStatusCode(_0x484d06,_0x2c7f2c){_0x2c7f2c=_0x2c7f2c||0xcc;return function(_0x3a3d72){if(_0x3a3d72){return _0x484d06[_0x05f1('0x1a')](_0x2c7f2c);}return _0x484d06[_0x05f1('0x1b')](_0x2c7f2c)[_0x05f1('0x1c')]();};}function respondWithResult(_0x3d60ce,_0xc2fc18){_0xc2fc18=_0xc2fc18||0xc8;return function(_0x310104){if(_0x310104){return _0x3d60ce[_0x05f1('0x1b')](_0xc2fc18)[_0x05f1('0x1d')](_0x310104);}};}function respondWithFilteredResult(_0x4b3f74,_0x408b7b){return function(_0x1b11c2){if(_0x1b11c2){var _0x247dd5=typeof _0x408b7b['offset']===_0x05f1('0x1e')&&typeof _0x408b7b['limit']===_0x05f1('0x1e');var _0x5b996a=_0x1b11c2[_0x05f1('0x1f')];var _0x30645a=_0x247dd5?0x0:_0x408b7b[_0x05f1('0x20')];var _0x426998=_0x247dd5?_0x1b11c2[_0x05f1('0x1f')]:_0x408b7b['offset']+_0x408b7b[_0x05f1('0x21')];var _0x2ded14;if(_0x426998>=_0x5b996a){_0x426998=_0x5b996a;_0x2ded14=0xc8;}else{_0x2ded14=0xce;}_0x4b3f74['status'](_0x2ded14);return _0x4b3f74[_0x05f1('0x22')](_0x05f1('0x23'),_0x30645a+'-'+_0x426998+'/'+_0x5b996a)[_0x05f1('0x1d')](_0x1b11c2);}return null;};}function patchUpdates(_0x215f92){return function(_0x4d57a7){try{jsonpatch[_0x05f1('0x24')](_0x4d57a7,_0x215f92,!![]);}catch(_0x3c6ac2){return BPromise[_0x05f1('0x25')](_0x3c6ac2);}return _0x4d57a7[_0x05f1('0x26')]();};}function saveUpdates(_0x114631,_0x19f9e6){return function(_0x427d89){if(_0x427d89){return _0x427d89['update'](_0x114631)[_0x05f1('0x27')](function(_0x1a6ab3){return _0x1a6ab3;});}return null;};}function removeEntity(_0x171bb5,_0x4fb840){return function(_0x4d5900){if(_0x4d5900){return _0x4d5900[_0x05f1('0x28')]()[_0x05f1('0x27')](function(){_0x171bb5[_0x05f1('0x1b')](0xcc)[_0x05f1('0x1c')]();});}};}function handleEntityNotFound(_0x9def9c,_0x55c208){return function(_0x57770e){if(!_0x57770e){_0x9def9c[_0x05f1('0x1a')](0x194);}return _0x57770e;};}function handleError(_0x53d9ca,_0x1ac238){_0x1ac238=_0x1ac238||0x1f4;return function(_0x15a22f){logger[_0x05f1('0x29')](_0x15a22f[_0x05f1('0x2a')]);if(_0x15a22f['name']){delete _0x15a22f[_0x05f1('0x2b')];}_0x53d9ca['status'](_0x1ac238)[_0x05f1('0x2c')](_0x15a22f);};}exports['index']=function(_0x2afe18,_0x563ac3){var _0x1f02e3={},_0xb48da2={},_0xd2d491={'count':0x0,'rows':[]};var _0x3f9551=_[_0x05f1('0x2d')](db[_0x05f1('0x2e')]['rawAttributes'],function(_0x3b1e49){return{'name':_0x3b1e49['fieldName'],'type':_0x3b1e49['type'][_0x05f1('0x2f')]};});_0xb48da2[_0x05f1('0x30')]=_[_0x05f1('0x2d')](_0x3f9551,_0x05f1('0x2b'));_0xb48da2[_0x05f1('0x31')]=_[_0x05f1('0x32')](_0x2afe18[_0x05f1('0x31')]);_0xb48da2['filters']=_[_0x05f1('0x33')](_0xb48da2[_0x05f1('0x30')],_0xb48da2['query']);_0x1f02e3[_0x05f1('0x34')]=_[_0x05f1('0x33')](_0xb48da2[_0x05f1('0x30')],qs[_0x05f1('0x35')](_0x2afe18[_0x05f1('0x31')][_0x05f1('0x35')]));_0x1f02e3[_0x05f1('0x34')]=_0x1f02e3[_0x05f1('0x34')][_0x05f1('0x36')]?_0x1f02e3[_0x05f1('0x34')]:_0xb48da2[_0x05f1('0x30')];if(!_0x2afe18[_0x05f1('0x31')][_0x05f1('0x37')](_0x05f1('0x38'))){_0x1f02e3['limit']=qs['limit'](_0x2afe18[_0x05f1('0x31')][_0x05f1('0x21')]);_0x1f02e3[_0x05f1('0x20')]=qs[_0x05f1('0x20')](_0x2afe18['query'][_0x05f1('0x20')]);}_0x1f02e3['order']=qs['sort'](_0x2afe18[_0x05f1('0x31')][_0x05f1('0x39')]);_0x1f02e3[_0x05f1('0x3a')]=qs['filters'](_[_0x05f1('0x3b')](_0x2afe18[_0x05f1('0x31')],_0xb48da2['filters']),_0x3f9551);if(_0x2afe18[_0x05f1('0x31')][_0x05f1('0x3c')]){_0x1f02e3['where']=_[_0x05f1('0x3d')](_0x1f02e3[_0x05f1('0x3a')],{'$or':_['map'](_0x3f9551,function(_0x29a0f3){if(_0x29a0f3[_0x05f1('0x3e')]!=='VIRTUAL'){var _0x3124ce={};_0x3124ce[_0x29a0f3[_0x05f1('0x2b')]]={'$like':'%'+_0x2afe18[_0x05f1('0x31')][_0x05f1('0x3c')]+'%'};return _0x3124ce;}})});}_0x1f02e3=_['merge']({},_0x1f02e3,_0x2afe18[_0x05f1('0x3f')]);var _0x42a60b={'where':_0x1f02e3[_0x05f1('0x3a')]};return db[_0x05f1('0x2e')][_0x05f1('0x1f')](_0x42a60b)[_0x05f1('0x27')](function(_0x53b205){_0xd2d491[_0x05f1('0x1f')]=_0x53b205;if(_0x2afe18[_0x05f1('0x31')]['includeAll']){_0x1f02e3['include']=[{'all':!![]}];}return db[_0x05f1('0x2e')][_0x05f1('0x40')](_0x1f02e3);})[_0x05f1('0x27')](function(_0x1fdb10){_0xd2d491[_0x05f1('0x41')]=_0x1fdb10;return _0xd2d491;})[_0x05f1('0x27')](respondWithFilteredResult(_0x563ac3,_0x1f02e3))[_0x05f1('0x42')](handleError(_0x563ac3,null));};exports[_0x05f1('0x43')]=function(_0x4c0bf6,_0x5a1c34){var _0x587d14={'raw':![],'where':{'id':_0x4c0bf6[_0x05f1('0x44')]['id']}},_0x298127={};_0x298127[_0x05f1('0x30')]=_[_0x05f1('0x32')](db[_0x05f1('0x2e')]['rawAttributes']);_0x298127[_0x05f1('0x31')]=_[_0x05f1('0x32')](_0x4c0bf6[_0x05f1('0x31')]);_0x298127[_0x05f1('0x45')]=_[_0x05f1('0x33')](_0x298127['model'],_0x298127['query']);_0x587d14['attributes']=_[_0x05f1('0x33')](_0x298127[_0x05f1('0x30')],qs[_0x05f1('0x35')](_0x4c0bf6['query']['fields']));_0x587d14[_0x05f1('0x34')]=_0x587d14['attributes'][_0x05f1('0x36')]?_0x587d14[_0x05f1('0x34')]:_0x298127[_0x05f1('0x30')];if(_0x4c0bf6['query'][_0x05f1('0x46')]){_0x587d14[_0x05f1('0x47')]=[{'all':!![]}];}_0x587d14=_[_0x05f1('0x3d')]({},_0x587d14,_0x4c0bf6[_0x05f1('0x3f')]);return db[_0x05f1('0x2e')][_0x05f1('0x48')](_0x587d14)[_0x05f1('0x27')](handleEntityNotFound(_0x5a1c34,null))[_0x05f1('0x27')](respondWithResult(_0x5a1c34,null))[_0x05f1('0x42')](handleError(_0x5a1c34,null));};exports[_0x05f1('0x49')]=function(_0x1469a8,_0x2a1077){return db[_0x05f1('0x2e')][_0x05f1('0x49')](_0x1469a8['body'],{})['then'](respondWithResult(_0x2a1077,0xc9))[_0x05f1('0x42')](handleError(_0x2a1077,null));};exports[_0x05f1('0x4a')]=function(_0x421ce7,_0x38338b){if(_0x421ce7[_0x05f1('0x4b')]['id']){delete _0x421ce7[_0x05f1('0x4b')]['id'];}return db['DeskAccount'][_0x05f1('0x48')]({'where':{'id':_0x421ce7[_0x05f1('0x44')]['id']}})[_0x05f1('0x27')](handleEntityNotFound(_0x38338b,null))['then'](saveUpdates(_0x421ce7[_0x05f1('0x4b')],null))[_0x05f1('0x27')](respondWithResult(_0x38338b,null))['catch'](handleError(_0x38338b,null));};exports[_0x05f1('0x28')]=function(_0x5a13f5,_0x5c50e8){return db[_0x05f1('0x2e')][_0x05f1('0x48')]({'where':{'id':_0x5a13f5[_0x05f1('0x44')]['id']}})['then'](handleEntityNotFound(_0x5c50e8,null))[_0x05f1('0x27')](removeEntity(_0x5c50e8,null))[_0x05f1('0x42')](handleError(_0x5c50e8,null));};exports[_0x05f1('0x4c')]=function(_0x31531c,_0x4beecc,_0xb5e804){var _0x11f6f8={};var _0x4f343d={};var _0x29b4b9;var _0x44e994;return db['DeskAccount']['findOne']({'where':{'id':_0x31531c['params']['id']}})[_0x05f1('0x27')](handleEntityNotFound(_0x4beecc,null))['then'](function(_0x264cd7){if(_0x264cd7){_0x29b4b9=_0x264cd7;_0x4f343d['model']=_[_0x05f1('0x32')](db[_0x05f1('0x4d')]['rawAttributes']);_0x4f343d[_0x05f1('0x31')]=_['keys'](_0x31531c[_0x05f1('0x31')]);_0x4f343d[_0x05f1('0x45')]=_[_0x05f1('0x33')](_0x4f343d[_0x05f1('0x30')],_0x4f343d['query']);_0x11f6f8[_0x05f1('0x34')]=_['intersection'](_0x4f343d['model'],qs['fields'](_0x31531c['query'][_0x05f1('0x35')]));_0x11f6f8['attributes']=_0x11f6f8[_0x05f1('0x34')][_0x05f1('0x36')]?_0x11f6f8[_0x05f1('0x34')]:_0x4f343d[_0x05f1('0x30')];_0x11f6f8[_0x05f1('0x4e')]=qs['sort'](_0x31531c['query'][_0x05f1('0x39')]);_0x11f6f8[_0x05f1('0x3a')]=qs[_0x05f1('0x45')](_['pick'](_0x31531c['query'],_0x4f343d[_0x05f1('0x45')]));if(_0x31531c[_0x05f1('0x31')]['filter']){_0x11f6f8[_0x05f1('0x3a')]=_['merge'](_0x11f6f8[_0x05f1('0x3a')],{'$or':_['map'](_0x11f6f8['attributes'],function(_0x2e3e6d){var _0x1086e0={};_0x1086e0[_0x2e3e6d]={'$like':'%'+_0x31531c[_0x05f1('0x31')][_0x05f1('0x3c')]+'%'};return _0x1086e0;})});}_0x11f6f8=_['merge']({},_0x11f6f8,_0x31531c[_0x05f1('0x3f')]);return _0x29b4b9['getConfigurations'](_0x11f6f8);}})['then'](function(_0x3a8b92){if(_0x3a8b92){_0x44e994=_0x3a8b92[_0x05f1('0x36')];if(!_0x31531c[_0x05f1('0x31')][_0x05f1('0x37')](_0x05f1('0x38'))){_0x11f6f8[_0x05f1('0x21')]=qs[_0x05f1('0x21')](_0x31531c['query']['limit']);_0x11f6f8[_0x05f1('0x20')]=qs[_0x05f1('0x20')](_0x31531c[_0x05f1('0x31')][_0x05f1('0x20')]);}return _0x29b4b9[_0x05f1('0x4c')](_0x11f6f8);}})['then'](function(_0x36e98a){if(_0x36e98a){return _0x36e98a?{'count':_0x44e994,'rows':_0x36e98a}:null;}})[_0x05f1('0x27')](respondWithResult(_0x4beecc,null))[_0x05f1('0x42')](handleError(_0x4beecc,null));};exports[_0x05f1('0x4f')]=function(_0x2bbd3f,_0x7fecf4,_0x2c68e1){if(_0x2bbd3f['body']['id']){delete _0x2bbd3f[_0x05f1('0x4b')]['id'];}return db[_0x05f1('0x2e')][_0x05f1('0x50')]({'where':{'id':_0x2bbd3f[_0x05f1('0x44')]['id']}})[_0x05f1('0x27')](handleEntityNotFound(_0x7fecf4,null))[_0x05f1('0x27')](function(_0x19c4cd){if(_0x19c4cd){_0x2bbd3f['body']['AccountId']=_0x19c4cd['id'];_0x2bbd3f[_0x05f1('0x4b')][_0x05f1('0x51')]=integrations['getSubjects'](_0x2bbd3f[_0x05f1('0x4b')]['channel'],_0x2bbd3f[_0x05f1('0x4b')][_0x05f1('0x3e')]);_0x2bbd3f['body']['Descriptions']=integrations[_0x05f1('0x52')](_0x2bbd3f[_0x05f1('0x4b')][_0x05f1('0x53')],_0x2bbd3f[_0x05f1('0x4b')][_0x05f1('0x3e')]);return db[_0x05f1('0x4d')]['create'](_0x2bbd3f[_0x05f1('0x4b')],{'include':[{'model':db[_0x05f1('0x54')],'as':_0x05f1('0x51')},{'model':db['DeskField'],'as':'Descriptions'}]});}return null;})['then'](respondWithResult(_0x7fecf4,null))['catch'](handleError(_0x7fecf4,null));};exports['getFields']=function(_0x744447,_0x556e08,_0x118ff1){var _0xe14e95=[{'name':_0x05f1('0x55'),'label':_0x05f1('0x55'),'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 _0x5e8c06='';return db['DeskAccount'][_0x05f1('0x50')]({'where':{'id':_0x744447['params']['id']},'attributes':['id','remoteUri',_0x05f1('0x56'),_0x05f1('0x57'),_0x05f1('0x58'),_0x05f1('0x59'),_0x05f1('0x5a'),'token',_0x05f1('0x5b')]})[_0x05f1('0x27')](handleEntityNotFound(_0x556e08,null))[_0x05f1('0x27')](function(_0x3bb75f){if(_0x3bb75f){_0x5e8c06=_0x3bb75f[_0x05f1('0x5c')];var _0x4abe7f=_0x5e8c06['slice'](-0x1);if(_0x4abe7f==='/'){_0x5e8c06=_0x5e8c06[_0x05f1('0x5d')](0x0,_0x5e8c06[_0x05f1('0x5e')](_0x4abe7f));}var _0x1b7d42={'method':_0x05f1('0x5f'),'uri':util[_0x05f1('0x60')](_0x05f1('0x61'),_0x5e8c06),'headers':{'Content-Type':'application/json','Accept':'application/json'},'json':!![]};if(_0x3bb75f[_0x05f1('0x56')]===_0x05f1('0x62')){_0x1b7d42[_0x05f1('0x63')][_0x05f1('0x64')]=util[_0x05f1('0x60')](_0x05f1('0x65'),new Buffer(util[_0x05f1('0x60')](_0x05f1('0x66'),_0x3bb75f[_0x05f1('0x57')],_0x3bb75f[_0x05f1('0x58')]))[_0x05f1('0x67')](_0x05f1('0x68')));}return rp(_0x1b7d42)[_0x05f1('0x27')](function(_0x48f81a){return _0xe14e95[_0x05f1('0x69')](_['map'](_0x48f81a['_embedded'][_0x05f1('0x6a')],function(_0xb6e9a0){return{'id':_0xb6e9a0[_0x05f1('0x2b')],'name':_0xb6e9a0['name'],'type':_0xb6e9a0['type'],'active':_0xb6e9a0[_0x05f1('0x6b')],'label':_0xb6e9a0[_0x05f1('0x6c')],'custom':!![]};}));});}})[_0x05f1('0x27')](function(_0x134768){return{'count':_0x134768[_0x05f1('0x36')],'rows':_0x134768};})[_0x05f1('0x27')](respondWithResult(_0x556e08,null))[_0x05f1('0x42')](function(_0x13fd85){var _0x4a5b07=_0x744447['query'][_0x05f1('0x6d')]?0x1f4:_0x13fd85[_0x05f1('0x6e')]||0x1f4;logger['error'](_0x05f1('0x6f'),_0x05f1('0x70'),_0x4a5b07,JSON[_0x05f1('0x71')](_0x13fd85));delete _0x13fd85['name'];if(_0x4a5b07===0x191){_0x4a5b07=0x190;}_0x556e08[_0x05f1('0x1b')](_0x4a5b07)[_0x05f1('0x2c')](_0x744447[_0x05f1('0x31')]['test']?{'message':_0x05f1('0x72'),'statusCode':_0x13fd85[_0x05f1('0x6e')]}:_0x13fd85);});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.model.js b/server/api/intDeskAccount/intDeskAccount.model.js index 8e51457..7cceb3e 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 _0x6591=['util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./intDeskAccount.attributes','../../components/integrations/configuration','define','DeskAccount','int_desk_accounts','lodash'];(function(_0x576d8a,_0x2d7bde){var _0x3dc3ef=function(_0xc76758){while(--_0xc76758){_0x576d8a['push'](_0x576d8a['shift']());}};_0x3dc3ef(++_0x2d7bde);}(_0x6591,0xd1));var _0x1659=function(_0x587577,_0x53a237){_0x587577=_0x587577-0x0;var _0x75d167=_0x6591[_0x587577];return _0x75d167;};'use strict';var _=require(_0x1659('0x0'));var util=require(_0x1659('0x1'));var logger=require(_0x1659('0x2'))(_0x1659('0x3'));var moment=require('moment');var BPromise=require(_0x1659('0x4'));var rp=require(_0x1659('0x5'));var fs=require('fs');var path=require(_0x1659('0x6'));var rimraf=require(_0x1659('0x7'));var config=require(_0x1659('0x8'));var attributes=require(_0x1659('0x9'));var integrations=require(_0x1659('0xa'));module['exports']=function(_0x412e67,_0x2ad6da){return _0x412e67[_0x1659('0xb')](_0x1659('0xc'),attributes,{'tableName':_0x1659('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb48e=['define','DeskAccount','moment','bluebird','request-promise','rimraf','../../config/environment','./intDeskAccount.attributes','exports'];(function(_0x51da0d,_0xcb16e3){var _0x44f479=function(_0x2fdf1b){while(--_0x2fdf1b){_0x51da0d['push'](_0x51da0d['shift']());}};_0x44f479(++_0xcb16e3);}(_0xb48e,0x9b));var _0xeb48=function(_0x53cb64,_0x2ddeff){_0x53cb64=_0x53cb64-0x0;var _0x5a161a=_0xb48e[_0x53cb64];return _0x5a161a;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xeb48('0x0'));var BPromise=require(_0xeb48('0x1'));var rp=require(_0xeb48('0x2'));var fs=require('fs');var path=require('path');var rimraf=require(_0xeb48('0x3'));var config=require(_0xeb48('0x4'));var attributes=require(_0xeb48('0x5'));var integrations=require('../../components/integrations/configuration');module[_0xeb48('0x6')]=function(_0x2d990f,_0x20bd22){return _0x2d990f[_0xeb48('0x7')](_0xeb48('0x8'),attributes,{'tableName':'int_desk_accounts','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 92d6e7f..38a2058 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 _0x0de4=['attributes','limit','include','map','model','GetDeskAccount','debug','ShowDeskAccount','DeskAccount','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','stringify','error','code','DeskAccount,\x20%s,\x20%s','message','info','result','catch','raw','options','where'];(function(_0x5f2ac9,_0x4b00bf){var _0x5b73d7=function(_0x424fd9){while(--_0x424fd9){_0x5f2ac9['push'](_0x5f2ac9['shift']());}};_0x5b73d7(++_0x4b00bf);}(_0x0de4,0x91));var _0x40de=function(_0x8ac85e,_0x51a76b){_0x8ac85e=_0x8ac85e-0x0;var _0x434720=_0x0de4[_0x8ac85e];return _0x434720;};'use strict';var _=require('lodash');var util=require(_0x40de('0x0'));var moment=require(_0x40de('0x1'));var BPromise=require('bluebird');var rs=require(_0x40de('0x2'));var fs=require('fs');var Redis=require(_0x40de('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x40de('0x4'));var logger=require(_0x40de('0x5'))(_0x40de('0x6'));var config=require(_0x40de('0x7'));var jayson=require(_0x40de('0x8'));var client=jayson[_0x40de('0x9')][_0x40de('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x58bea0,_0x3cbe8a,_0x37bdf5){return new BPromise(function(_0xaf5585,_0x6cf769){return client[_0x40de('0xb')](_0x58bea0,_0x37bdf5)[_0x40de('0xc')](function(_0x1cb1ed){logger['info']('DeskAccount,\x20%s,\x20%s',_0x3cbe8a,_0x40de('0xd'));logger['debug']('DeskAccount,\x20%s,\x20%s,\x20%s',_0x3cbe8a,_0x40de('0xd'),JSON[_0x40de('0xe')](_0x1cb1ed));if(_0x1cb1ed[_0x40de('0xf')]){if(_0x1cb1ed[_0x40de('0xf')][_0x40de('0x10')]===0x1f4){logger[_0x40de('0xf')](_0x40de('0x11'),_0x3cbe8a,_0x1cb1ed[_0x40de('0xf')][_0x40de('0x12')]);return _0x6cf769(_0x1cb1ed[_0x40de('0xf')][_0x40de('0x12')]);}logger[_0x40de('0xf')](_0x40de('0x11'),_0x3cbe8a,_0x1cb1ed['error'][_0x40de('0x12')]);return _0xaf5585(_0x1cb1ed[_0x40de('0xf')][_0x40de('0x12')]);}else{logger[_0x40de('0x13')](_0x40de('0x11'),_0x3cbe8a,'request\x20sent');_0xaf5585(_0x1cb1ed[_0x40de('0x14')]['message']);}})[_0x40de('0x15')](function(_0x39abb9){logger[_0x40de('0xf')](_0x40de('0x11'),_0x3cbe8a,_0x39abb9);_0x6cf769(_0x39abb9);});});}exports['GetDeskAccount']=function(_0x238cc5){var _0x2afffc=this;return new Promise(function(_0x428a44,_0x5cf5d0){return db['DeskAccount']['findAll']({'raw':_0x238cc5['options']?_0x238cc5['options'][_0x40de('0x16')]===undefined?!![]:![]:!![],'where':_0x238cc5[_0x40de('0x17')]?_0x238cc5[_0x40de('0x17')][_0x40de('0x18')]||null:null,'attributes':_0x238cc5[_0x40de('0x17')]?_0x238cc5[_0x40de('0x17')][_0x40de('0x19')]||null:null,'limit':_0x238cc5['options']?_0x238cc5[_0x40de('0x17')][_0x40de('0x1a')]||null:null,'include':_0x238cc5[_0x40de('0x17')]?_0x238cc5[_0x40de('0x17')][_0x40de('0x1b')]?_[_0x40de('0x1c')](_0x238cc5[_0x40de('0x17')][_0x40de('0x1b')],function(_0x2fc0c7){return{'model':db[_0x2fc0c7[_0x40de('0x1d')]],'as':_0x2fc0c7['as'],'attributes':_0x2fc0c7[_0x40de('0x19')],'include':_0x2fc0c7['include']?_['map'](_0x2fc0c7[_0x40de('0x1b')],function(_0x178a6a){return{'model':db[_0x178a6a[_0x40de('0x1d')]],'as':_0x178a6a['as'],'attributes':_0x178a6a['attributes'],'include':_0x178a6a[_0x40de('0x1b')]?_[_0x40de('0x1c')](_0x178a6a[_0x40de('0x1b')],function(_0x1cc061){return{'model':db[_0x1cc061['model']],'as':_0x1cc061['as'],'attributes':_0x1cc061['attributes']};}):[]};}):[]};}):[]:[]})[_0x40de('0xc')](function(_0x4b083a){logger[_0x40de('0x13')](_0x40de('0x1e'),_0x238cc5);logger[_0x40de('0x1f')]('GetDeskAccount',_0x238cc5,JSON[_0x40de('0xe')](_0x4b083a));_0x428a44(_0x4b083a);})[_0x40de('0x15')](function(_0x6e843){logger['error'](_0x40de('0x1e'),_0x6e843[_0x40de('0x12')],_0x238cc5);_0x5cf5d0(_0x2afffc[_0x40de('0xf')](0x1f4,_0x6e843['message']));});});};exports[_0x40de('0x20')]=function(_0x151b9e){var _0x3cbbca=this;return new Promise(function(_0x4d9bbe,_0x492895){return db[_0x40de('0x21')]['find']({'raw':_0x151b9e[_0x40de('0x17')]?_0x151b9e[_0x40de('0x17')][_0x40de('0x16')]===undefined?!![]:![]:!![],'where':_0x151b9e[_0x40de('0x17')]?_0x151b9e[_0x40de('0x17')][_0x40de('0x18')]||null:null,'attributes':_0x151b9e['options']?_0x151b9e['options'][_0x40de('0x19')]||null:null,'include':_0x151b9e[_0x40de('0x17')]?_0x151b9e[_0x40de('0x17')][_0x40de('0x1b')]?_[_0x40de('0x1c')](_0x151b9e[_0x40de('0x17')]['include'],function(_0x44837d){return{'model':db[_0x44837d[_0x40de('0x1d')]],'as':_0x44837d['as'],'attributes':_0x44837d[_0x40de('0x19')],'include':_0x44837d[_0x40de('0x1b')]?_[_0x40de('0x1c')](_0x44837d[_0x40de('0x1b')],function(_0x496b0d){return{'model':db[_0x496b0d['model']],'as':_0x496b0d['as'],'attributes':_0x496b0d[_0x40de('0x19')],'include':_0x496b0d['include']?_[_0x40de('0x1c')](_0x496b0d[_0x40de('0x1b')],function(_0x127335){return{'model':db[_0x127335[_0x40de('0x1d')]],'as':_0x127335['as'],'attributes':_0x127335['attributes']};}):[]};}):[]};}):[]:[]})[_0x40de('0xc')](function(_0x51a36d){logger[_0x40de('0x13')](_0x40de('0x20'),_0x151b9e);logger[_0x40de('0x1f')](_0x40de('0x20'),_0x151b9e,JSON[_0x40de('0xe')](_0x51a36d));_0x4d9bbe(_0x51a36d);})['catch'](function(_0x5c42e3){logger[_0x40de('0xf')](_0x40de('0x20'),_0x5c42e3[_0x40de('0x12')],_0x151b9e);_0x492895(_0x3cbbca[_0x40de('0xf')](0x1f4,_0x5c42e3[_0x40de('0x12')]));});});}; \ No newline at end of file +var _0xe407=['attributes','limit','include','map','model','GetDeskAccount','catch','ShowDeskAccount','find','stringify','lodash','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','then','info','debug','DeskAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','DeskAccount,\x20%s,\x20%s','message','result','DeskAccount','findAll','options','raw','where'];(function(_0x9cd4c3,_0x1c9b2c){var _0x4c9025=function(_0x25b3c6){while(--_0x25b3c6){_0x9cd4c3['push'](_0x9cd4c3['shift']());}};_0x4c9025(++_0x1c9b2c);}(_0xe407,0x1a2));var _0x7e40=function(_0x516206,_0x463e33){_0x516206=_0x516206-0x0;var _0x36eb7b=_0xe407[_0x516206];return _0x36eb7b;};'use strict';var _=require(_0x7e40('0x0'));var util=require('util');var moment=require(_0x7e40('0x1'));var BPromise=require(_0x7e40('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7e40('0x3'))['db'];var utils=require(_0x7e40('0x4'));var logger=require(_0x7e40('0x5'))(_0x7e40('0x6'));var config=require(_0x7e40('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x7e40('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x39bde6,_0x4b055e,_0x493101){return new BPromise(function(_0x25982c,_0x1fdf62){return client['request'](_0x39bde6,_0x493101)[_0x7e40('0x9')](function(_0x3bd945){logger[_0x7e40('0xa')]('DeskAccount,\x20%s,\x20%s',_0x4b055e,'request\x20sent');logger[_0x7e40('0xb')](_0x7e40('0xc'),_0x4b055e,_0x7e40('0xd'),JSON['stringify'](_0x3bd945));if(_0x3bd945[_0x7e40('0xe')]){if(_0x3bd945[_0x7e40('0xe')][_0x7e40('0xf')]===0x1f4){logger[_0x7e40('0xe')](_0x7e40('0x10'),_0x4b055e,_0x3bd945[_0x7e40('0xe')]['message']);return _0x1fdf62(_0x3bd945[_0x7e40('0xe')][_0x7e40('0x11')]);}logger[_0x7e40('0xe')](_0x7e40('0x10'),_0x4b055e,_0x3bd945[_0x7e40('0xe')][_0x7e40('0x11')]);return _0x25982c(_0x3bd945[_0x7e40('0xe')][_0x7e40('0x11')]);}else{logger[_0x7e40('0xa')]('DeskAccount,\x20%s,\x20%s',_0x4b055e,_0x7e40('0xd'));_0x25982c(_0x3bd945[_0x7e40('0x12')][_0x7e40('0x11')]);}})['catch'](function(_0x38edbf){logger[_0x7e40('0xe')]('DeskAccount,\x20%s,\x20%s',_0x4b055e,_0x38edbf);_0x1fdf62(_0x38edbf);});});}exports['GetDeskAccount']=function(_0x39c174){var _0x414e90=this;return new Promise(function(_0x412d1a,_0x350dba){return db[_0x7e40('0x13')][_0x7e40('0x14')]({'raw':_0x39c174['options']?_0x39c174[_0x7e40('0x15')][_0x7e40('0x16')]===undefined?!![]:![]:!![],'where':_0x39c174[_0x7e40('0x15')]?_0x39c174[_0x7e40('0x15')][_0x7e40('0x17')]||null:null,'attributes':_0x39c174['options']?_0x39c174[_0x7e40('0x15')][_0x7e40('0x18')]||null:null,'limit':_0x39c174[_0x7e40('0x15')]?_0x39c174[_0x7e40('0x15')][_0x7e40('0x19')]||null:null,'include':_0x39c174['options']?_0x39c174[_0x7e40('0x15')][_0x7e40('0x1a')]?_[_0x7e40('0x1b')](_0x39c174[_0x7e40('0x15')][_0x7e40('0x1a')],function(_0x2b824e){return{'model':db[_0x2b824e[_0x7e40('0x1c')]],'as':_0x2b824e['as'],'attributes':_0x2b824e['attributes'],'include':_0x2b824e[_0x7e40('0x1a')]?_['map'](_0x2b824e['include'],function(_0x51abdb){return{'model':db[_0x51abdb[_0x7e40('0x1c')]],'as':_0x51abdb['as'],'attributes':_0x51abdb['attributes'],'include':_0x51abdb[_0x7e40('0x1a')]?_[_0x7e40('0x1b')](_0x51abdb[_0x7e40('0x1a')],function(_0x49444e){return{'model':db[_0x49444e[_0x7e40('0x1c')]],'as':_0x49444e['as'],'attributes':_0x49444e[_0x7e40('0x18')]};}):[]};}):[]};}):[]:[]})[_0x7e40('0x9')](function(_0x544b41){logger[_0x7e40('0xa')](_0x7e40('0x1d'),_0x39c174);logger['debug']('GetDeskAccount',_0x39c174,JSON['stringify'](_0x544b41));_0x412d1a(_0x544b41);})[_0x7e40('0x1e')](function(_0x34ffd8){logger[_0x7e40('0xe')]('GetDeskAccount',_0x34ffd8[_0x7e40('0x11')],_0x39c174);_0x350dba(_0x414e90[_0x7e40('0xe')](0x1f4,_0x34ffd8[_0x7e40('0x11')]));});});};exports[_0x7e40('0x1f')]=function(_0x187f9e){var _0x1fb77b=this;return new Promise(function(_0x1937a0,_0xca67b1){return db[_0x7e40('0x13')][_0x7e40('0x20')]({'raw':_0x187f9e[_0x7e40('0x15')]?_0x187f9e['options'][_0x7e40('0x16')]===undefined?!![]:![]:!![],'where':_0x187f9e[_0x7e40('0x15')]?_0x187f9e[_0x7e40('0x15')][_0x7e40('0x17')]||null:null,'attributes':_0x187f9e[_0x7e40('0x15')]?_0x187f9e['options']['attributes']||null:null,'include':_0x187f9e[_0x7e40('0x15')]?_0x187f9e['options'][_0x7e40('0x1a')]?_['map'](_0x187f9e[_0x7e40('0x15')][_0x7e40('0x1a')],function(_0x368834){return{'model':db[_0x368834['model']],'as':_0x368834['as'],'attributes':_0x368834[_0x7e40('0x18')],'include':_0x368834[_0x7e40('0x1a')]?_[_0x7e40('0x1b')](_0x368834[_0x7e40('0x1a')],function(_0x53c3a0){return{'model':db[_0x53c3a0[_0x7e40('0x1c')]],'as':_0x53c3a0['as'],'attributes':_0x53c3a0[_0x7e40('0x18')],'include':_0x53c3a0['include']?_[_0x7e40('0x1b')](_0x53c3a0[_0x7e40('0x1a')],function(_0x3a396e){return{'model':db[_0x3a396e['model']],'as':_0x3a396e['as'],'attributes':_0x3a396e[_0x7e40('0x18')]};}):[]};}):[]};}):[]:[]})[_0x7e40('0x9')](function(_0x295fa1){logger[_0x7e40('0xa')](_0x7e40('0x1f'),_0x187f9e);logger[_0x7e40('0xb')](_0x7e40('0x1f'),_0x187f9e,JSON[_0x7e40('0x21')](_0x295fa1));_0x1937a0(_0x295fa1);})[_0x7e40('0x1e')](function(_0x527ffc){logger[_0x7e40('0xe')]('ShowDeskAccount',_0x527ffc[_0x7e40('0x11')],_0x187f9e);_0xca67b1(_0x1fb77b[_0x7e40('0xe')](0x1f4,_0x527ffc[_0x7e40('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/index.js b/server/api/intDeskConfiguration/index.js index 7ef53af..a401c8e 100644 --- a/server/api/intDeskConfiguration/index.js +++ b/server/api/intDeskConfiguration/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c44=['destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./intDeskConfiguration.controller','isAuthenticated','index','get','/:id','/:id/fields','getFields','getSubjects','/:id/descriptions','/:id/tags','post','setTags','put','update'];(function(_0x41568e,_0x5ab27b){var _0x40db40=function(_0x14969b){while(--_0x14969b){_0x41568e['push'](_0x41568e['shift']());}};_0x40db40(++_0x5ab27b);}(_0x9c44,0x178));var _0x49c4=function(_0x2d7f0e,_0x3e6fbd){_0x2d7f0e=_0x2d7f0e-0x0;var _0x110b07=_0x9c44[_0x2d7f0e];return _0x110b07;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x49c4('0x6'));router['get']('/',auth[_0x49c4('0x7')](),controller[_0x49c4('0x8')]);router[_0x49c4('0x9')](_0x49c4('0xa'),auth[_0x49c4('0x7')](),controller['show']);router[_0x49c4('0x9')](_0x49c4('0xb'),auth[_0x49c4('0x7')](),controller[_0x49c4('0xc')]);router['get']('/:id/subjects',auth[_0x49c4('0x7')](),controller[_0x49c4('0xd')]);router['get'](_0x49c4('0xe'),auth[_0x49c4('0x7')](),controller['getDescriptions']);router['get'](_0x49c4('0xf'),auth[_0x49c4('0x7')](),controller['getTags']);router[_0x49c4('0x10')]('/',auth[_0x49c4('0x7')](),controller['create']);router[_0x49c4('0x10')](_0x49c4('0xf'),auth[_0x49c4('0x7')](),controller[_0x49c4('0x11')]);router[_0x49c4('0x12')](_0x49c4('0xa'),auth[_0x49c4('0x7')](),controller[_0x49c4('0x13')]);router['delete'](_0x49c4('0xa'),auth[_0x49c4('0x7')](),controller[_0x49c4('0x14')]);module[_0x49c4('0x15')]=router; \ No newline at end of file +var _0x55ca=['../../config/environment','./intDeskConfiguration.controller','get','isAuthenticated','index','show','/:id/fields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','setTags','put','/:id','update','destroy','exports','multer','util','Router','fs-extra','../../components/interaction/service'];(function(_0x1406ae,_0x292395){var _0x23a076=function(_0x5e147a){while(--_0x5e147a){_0x1406ae['push'](_0x1406ae['shift']());}};_0x23a076(++_0x292395);}(_0x55ca,0x126));var _0xa55c=function(_0x101d5b,_0x40cfd){_0x101d5b=_0x101d5b-0x0;var _0x382a50=_0x55ca[_0x101d5b];return _0x382a50;};'use strict';var multer=require(_0xa55c('0x0'));var util=require(_0xa55c('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xa55c('0x2')]();var fs_extra=require(_0xa55c('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xa55c('0x4'));var config=require(_0xa55c('0x5'));var controller=require(_0xa55c('0x6'));router[_0xa55c('0x7')]('/',auth[_0xa55c('0x8')](),controller[_0xa55c('0x9')]);router[_0xa55c('0x7')]('/:id',auth[_0xa55c('0x8')](),controller[_0xa55c('0xa')]);router['get'](_0xa55c('0xb'),auth[_0xa55c('0x8')](),controller['getFields']);router['get'](_0xa55c('0xc'),auth[_0xa55c('0x8')](),controller[_0xa55c('0xd')]);router[_0xa55c('0x7')](_0xa55c('0xe'),auth[_0xa55c('0x8')](),controller[_0xa55c('0xf')]);router[_0xa55c('0x7')](_0xa55c('0x10'),auth[_0xa55c('0x8')](),controller['getTags']);router['post']('/',auth[_0xa55c('0x8')](),controller['create']);router['post']('/:id/tags',auth[_0xa55c('0x8')](),controller[_0xa55c('0x11')]);router[_0xa55c('0x12')](_0xa55c('0x13'),auth[_0xa55c('0x8')](),controller[_0xa55c('0x14')]);router['delete'](_0xa55c('0x13'),auth[_0xa55c('0x8')](),controller[_0xa55c('0x15')]);module[_0xa55c('0x16')]=router; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js b/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js index 3af7dbe..4fc0eb0 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 _0x39d2=['sequelize','exports','STRING'];(function(_0x17823f,_0xffd807){var _0x51fc21=function(_0x5e4921){while(--_0x5e4921){_0x17823f['push'](_0x17823f['shift']());}};_0x51fc21(++_0xffd807);}(_0x39d2,0x11d));var _0x239d=function(_0x26bf51,_0x5e261a){_0x26bf51=_0x26bf51-0x0;var _0x503415=_0x39d2[_0x26bf51];return _0x503415;};'use strict';var Sequelize=require(_0x239d('0x0'));module[_0x239d('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x239d('0x2')]}}; \ No newline at end of file +var _0xb611=['sequelize','exports','STRING'];(function(_0x5339b1,_0x4f7ba8){var _0x34a8be=function(_0x130f87){while(--_0x130f87){_0x5339b1['push'](_0x5339b1['shift']());}};_0x34a8be(++_0x4f7ba8);}(_0xb611,0x192));var _0x1b61=function(_0x3b81eb,_0x175f32){_0x3b81eb=_0x3b81eb-0x0;var _0x149491=_0xb611[_0x3b81eb];return _0x149491;};'use strict';var Sequelize=require(_0x1b61('0x0'));module[_0x1b61('0x1')]={'name':{'type':Sequelize[_0x1b61('0x2')]},'description':{'type':Sequelize[_0x1b61('0x2')]}}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.controller.js b/server/api/intDeskConfiguration/intDeskConfiguration.controller.js index 49cfa36..2831147 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 _0x85a3=['getSubjects','getDescriptions','getTags','Tag','setTags','ids','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','papaparse','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','save','update','then','destroy','error','stack','name','send','index','map','DeskConfiguration','rawAttributes','fieldName','type','key','model','query','keys','intersection','fields','attributes','length','nolimit','sort','where','filters','filter','merge','VIRTUAL','options','findAll','rows','catch','params','includeAll','find','create','body','getFields','findOne','DeskField','order','pick','hasOwnProperty'];(function(_0x1b91c7,_0x539acd){var _0xbbe014=function(_0x57ff15){while(--_0x57ff15){_0x1b91c7['push'](_0x1b91c7['shift']());}};_0xbbe014(++_0x539acd);}(_0x85a3,0xae));var _0x385a=function(_0x24c1ad,_0x1cf402){_0x24c1ad=_0x24c1ad-0x0;var _0x2fdab5=_0x85a3[_0x24c1ad];return _0x2fdab5;};'use strict';var emlformat=require(_0x385a('0x0'));var rimraf=require(_0x385a('0x1'));var zipdir=require(_0x385a('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x385a('0x3'));var moment=require(_0x385a('0x4'));var BPromise=require(_0x385a('0x5'));var Mustache=require(_0x385a('0x6'));var util=require(_0x385a('0x7'));var path=require(_0x385a('0x8'));var sox=require(_0x385a('0x9'));var csv=require(_0x385a('0xa'));var ejs=require(_0x385a('0xb'));var fs=require('fs');var fs_extra=require(_0x385a('0xc'));var _=require('lodash');var squel=require(_0x385a('0xd'));var crypto=require('crypto');var jsforce=require(_0x385a('0xe'));var deskjs=require(_0x385a('0xf'));var toCsv=require(_0x385a('0xa'));var querystring=require(_0x385a('0x10'));var Papa=require(_0x385a('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x385a('0x12'));var logger=require('../../config/logger')(_0x385a('0x13'));var utils=require(_0x385a('0x14'));var config=require(_0x385a('0x15'));var licenseUtil=require(_0x385a('0x16'));var db=require(_0x385a('0x17'))['db'];function respondWithStatusCode(_0x564e35,_0x16fe8b){_0x16fe8b=_0x16fe8b||0xcc;return function(_0x460219){if(_0x460219){return _0x564e35[_0x385a('0x18')](_0x16fe8b);}return _0x564e35[_0x385a('0x19')](_0x16fe8b)[_0x385a('0x1a')]();};}function respondWithResult(_0x585f48,_0x2ce1c3){_0x2ce1c3=_0x2ce1c3||0xc8;return function(_0x3d3a8a){if(_0x3d3a8a){return _0x585f48[_0x385a('0x19')](_0x2ce1c3)[_0x385a('0x1b')](_0x3d3a8a);}};}function respondWithFilteredResult(_0x1e161b,_0x393b77){return function(_0x3bccc8){if(_0x3bccc8){var _0x1dee5c=typeof _0x393b77[_0x385a('0x1c')]===_0x385a('0x1d')&&typeof _0x393b77[_0x385a('0x1e')]==='undefined';var _0x31bd48=_0x3bccc8[_0x385a('0x1f')];var _0x19f2f2=_0x1dee5c?0x0:_0x393b77[_0x385a('0x1c')];var _0x293776=_0x1dee5c?_0x3bccc8[_0x385a('0x1f')]:_0x393b77[_0x385a('0x1c')]+_0x393b77[_0x385a('0x1e')];var _0x4d3374;if(_0x293776>=_0x31bd48){_0x293776=_0x31bd48;_0x4d3374=0xc8;}else{_0x4d3374=0xce;}_0x1e161b['status'](_0x4d3374);return _0x1e161b[_0x385a('0x20')](_0x385a('0x21'),_0x19f2f2+'-'+_0x293776+'/'+_0x31bd48)[_0x385a('0x1b')](_0x3bccc8);}return null;};}function patchUpdates(_0x3bafd6){return function(_0x24ac0a){try{jsonpatch['apply'](_0x24ac0a,_0x3bafd6,!![]);}catch(_0x5ef361){return BPromise['reject'](_0x5ef361);}return _0x24ac0a[_0x385a('0x22')]();};}function saveUpdates(_0x88dec,_0x17b499){return function(_0x15cd9f){if(_0x15cd9f){return _0x15cd9f[_0x385a('0x23')](_0x88dec)[_0x385a('0x24')](function(_0x4a8c5c){return _0x4a8c5c;});}return null;};}function removeEntity(_0x3bccaa,_0x291522){return function(_0x26a821){if(_0x26a821){return _0x26a821[_0x385a('0x25')]()[_0x385a('0x24')](function(){_0x3bccaa[_0x385a('0x19')](0xcc)[_0x385a('0x1a')]();});}};}function handleEntityNotFound(_0x2aba5c,_0x472b66){return function(_0x25a5b1){if(!_0x25a5b1){_0x2aba5c[_0x385a('0x18')](0x194);}return _0x25a5b1;};}function handleError(_0x314ec4,_0xc5561e){_0xc5561e=_0xc5561e||0x1f4;return function(_0x467cf1){logger[_0x385a('0x26')](_0x467cf1[_0x385a('0x27')]);if(_0x467cf1[_0x385a('0x28')]){delete _0x467cf1[_0x385a('0x28')];}_0x314ec4[_0x385a('0x19')](_0xc5561e)[_0x385a('0x29')](_0x467cf1);};}exports[_0x385a('0x2a')]=function(_0x5e9c72,_0x2de376){var _0x361a33={},_0x2153c2={},_0x42439f={'count':0x0,'rows':[]};var _0x45f919=_[_0x385a('0x2b')](db[_0x385a('0x2c')][_0x385a('0x2d')],function(_0x56fd47){return{'name':_0x56fd47[_0x385a('0x2e')],'type':_0x56fd47[_0x385a('0x2f')][_0x385a('0x30')]};});_0x2153c2[_0x385a('0x31')]=_[_0x385a('0x2b')](_0x45f919,_0x385a('0x28'));_0x2153c2[_0x385a('0x32')]=_[_0x385a('0x33')](_0x5e9c72[_0x385a('0x32')]);_0x2153c2['filters']=_[_0x385a('0x34')](_0x2153c2[_0x385a('0x31')],_0x2153c2[_0x385a('0x32')]);_0x361a33['attributes']=_[_0x385a('0x34')](_0x2153c2[_0x385a('0x31')],qs[_0x385a('0x35')](_0x5e9c72[_0x385a('0x32')][_0x385a('0x35')]));_0x361a33[_0x385a('0x36')]=_0x361a33[_0x385a('0x36')][_0x385a('0x37')]?_0x361a33[_0x385a('0x36')]:_0x2153c2['model'];if(!_0x5e9c72[_0x385a('0x32')]['hasOwnProperty'](_0x385a('0x38'))){_0x361a33[_0x385a('0x1e')]=qs[_0x385a('0x1e')](_0x5e9c72[_0x385a('0x32')][_0x385a('0x1e')]);_0x361a33[_0x385a('0x1c')]=qs[_0x385a('0x1c')](_0x5e9c72[_0x385a('0x32')]['offset']);}_0x361a33['order']=qs[_0x385a('0x39')](_0x5e9c72[_0x385a('0x32')][_0x385a('0x39')]);_0x361a33[_0x385a('0x3a')]=qs[_0x385a('0x3b')](_['pick'](_0x5e9c72[_0x385a('0x32')],_0x2153c2[_0x385a('0x3b')]),_0x45f919);if(_0x5e9c72[_0x385a('0x32')][_0x385a('0x3c')]){_0x361a33[_0x385a('0x3a')]=_[_0x385a('0x3d')](_0x361a33[_0x385a('0x3a')],{'$or':_[_0x385a('0x2b')](_0x45f919,function(_0x37f4cc){if(_0x37f4cc[_0x385a('0x2f')]!==_0x385a('0x3e')){var _0x51f5f4={};_0x51f5f4[_0x37f4cc[_0x385a('0x28')]]={'$like':'%'+_0x5e9c72[_0x385a('0x32')][_0x385a('0x3c')]+'%'};return _0x51f5f4;}})});}_0x361a33=_[_0x385a('0x3d')]({},_0x361a33,_0x5e9c72[_0x385a('0x3f')]);var _0x2390a1={'where':_0x361a33['where']};return db[_0x385a('0x2c')][_0x385a('0x1f')](_0x2390a1)[_0x385a('0x24')](function(_0x4aa189){_0x42439f[_0x385a('0x1f')]=_0x4aa189;if(_0x5e9c72[_0x385a('0x32')]['includeAll']){_0x361a33['include']=[{'all':!![]}];}return db['DeskConfiguration'][_0x385a('0x40')](_0x361a33);})[_0x385a('0x24')](function(_0x453f5e){_0x42439f[_0x385a('0x41')]=_0x453f5e;return _0x42439f;})[_0x385a('0x24')](respondWithFilteredResult(_0x2de376,_0x361a33))[_0x385a('0x42')](handleError(_0x2de376,null));};exports['show']=function(_0x5d8812,_0x2235f3){var _0x242b1e={'raw':![],'where':{'id':_0x5d8812[_0x385a('0x43')]['id']}},_0x450b20={};_0x450b20['model']=_[_0x385a('0x33')](db['DeskConfiguration'][_0x385a('0x2d')]);_0x450b20[_0x385a('0x32')]=_[_0x385a('0x33')](_0x5d8812[_0x385a('0x32')]);_0x450b20[_0x385a('0x3b')]=_[_0x385a('0x34')](_0x450b20[_0x385a('0x31')],_0x450b20[_0x385a('0x32')]);_0x242b1e[_0x385a('0x36')]=_[_0x385a('0x34')](_0x450b20[_0x385a('0x31')],qs[_0x385a('0x35')](_0x5d8812[_0x385a('0x32')][_0x385a('0x35')]));_0x242b1e[_0x385a('0x36')]=_0x242b1e[_0x385a('0x36')][_0x385a('0x37')]?_0x242b1e[_0x385a('0x36')]:_0x450b20['model'];if(_0x5d8812['query'][_0x385a('0x44')]){_0x242b1e['include']=[{'all':!![]}];}_0x242b1e=_[_0x385a('0x3d')]({},_0x242b1e,_0x5d8812[_0x385a('0x3f')]);return db['DeskConfiguration'][_0x385a('0x45')](_0x242b1e)[_0x385a('0x24')](handleEntityNotFound(_0x2235f3,null))[_0x385a('0x24')](respondWithResult(_0x2235f3,null))[_0x385a('0x42')](handleError(_0x2235f3,null));};exports[_0x385a('0x46')]=function(_0x4a5763,_0x28a887){return db['DeskConfiguration'][_0x385a('0x46')](_0x4a5763['body'],{})['then'](respondWithResult(_0x28a887,0xc9))[_0x385a('0x42')](handleError(_0x28a887,null));};exports[_0x385a('0x23')]=function(_0x497f45,_0x199658){if(_0x497f45[_0x385a('0x47')]['id']){delete _0x497f45[_0x385a('0x47')]['id'];}return db[_0x385a('0x2c')][_0x385a('0x45')]({'where':{'id':_0x497f45['params']['id']}})[_0x385a('0x24')](handleEntityNotFound(_0x199658,null))[_0x385a('0x24')](saveUpdates(_0x497f45['body'],null))['then'](respondWithResult(_0x199658,null))[_0x385a('0x42')](handleError(_0x199658,null));};exports['destroy']=function(_0x9d9139,_0x5ec6c8){return db[_0x385a('0x2c')][_0x385a('0x45')]({'where':{'id':_0x9d9139[_0x385a('0x43')]['id']}})[_0x385a('0x24')](handleEntityNotFound(_0x5ec6c8,null))['then'](removeEntity(_0x5ec6c8,null))[_0x385a('0x42')](handleError(_0x5ec6c8,null));};exports[_0x385a('0x48')]=function(_0x11bdbb,_0x31627b,_0xbabd8c){var _0x42afcb={};var _0x3b2d3d={};var _0x357cef;var _0x402b02;return db['DeskConfiguration'][_0x385a('0x49')]({'where':{'id':_0x11bdbb[_0x385a('0x43')]['id']}})[_0x385a('0x24')](handleEntityNotFound(_0x31627b,null))[_0x385a('0x24')](function(_0x46bc66){if(_0x46bc66){_0x357cef=_0x46bc66;_0x3b2d3d[_0x385a('0x31')]=_[_0x385a('0x33')](db[_0x385a('0x4a')][_0x385a('0x2d')]);_0x3b2d3d[_0x385a('0x32')]=_['keys'](_0x11bdbb[_0x385a('0x32')]);_0x3b2d3d[_0x385a('0x3b')]=_[_0x385a('0x34')](_0x3b2d3d[_0x385a('0x31')],_0x3b2d3d[_0x385a('0x32')]);_0x42afcb[_0x385a('0x36')]=_[_0x385a('0x34')](_0x3b2d3d['model'],qs[_0x385a('0x35')](_0x11bdbb[_0x385a('0x32')][_0x385a('0x35')]));_0x42afcb['attributes']=_0x42afcb[_0x385a('0x36')]['length']?_0x42afcb[_0x385a('0x36')]:_0x3b2d3d['model'];_0x42afcb[_0x385a('0x4b')]=qs[_0x385a('0x39')](_0x11bdbb[_0x385a('0x32')][_0x385a('0x39')]);_0x42afcb[_0x385a('0x3a')]=qs['filters'](_[_0x385a('0x4c')](_0x11bdbb[_0x385a('0x32')],_0x3b2d3d['filters']));if(_0x11bdbb[_0x385a('0x32')][_0x385a('0x3c')]){_0x42afcb[_0x385a('0x3a')]=_['merge'](_0x42afcb[_0x385a('0x3a')],{'$or':_[_0x385a('0x2b')](_0x42afcb[_0x385a('0x36')],function(_0x47d73b){var _0x1e6f4a={};_0x1e6f4a[_0x47d73b]={'$like':'%'+_0x11bdbb[_0x385a('0x32')][_0x385a('0x3c')]+'%'};return _0x1e6f4a;})});}_0x42afcb=_[_0x385a('0x3d')]({},_0x42afcb,_0x11bdbb[_0x385a('0x3f')]);return _0x357cef['getFields'](_0x42afcb);}})[_0x385a('0x24')](function(_0x3eba10){if(_0x3eba10){_0x402b02=_0x3eba10[_0x385a('0x37')];if(!_0x11bdbb[_0x385a('0x32')][_0x385a('0x4d')]('nolimit')){_0x42afcb['limit']=qs[_0x385a('0x1e')](_0x11bdbb[_0x385a('0x32')][_0x385a('0x1e')]);_0x42afcb[_0x385a('0x1c')]=qs['offset'](_0x11bdbb[_0x385a('0x32')][_0x385a('0x1c')]);}return _0x357cef[_0x385a('0x48')](_0x42afcb);}})[_0x385a('0x24')](function(_0x4e2a2f){if(_0x4e2a2f){return _0x4e2a2f?{'count':_0x402b02,'rows':_0x4e2a2f}:null;}})['then'](respondWithResult(_0x31627b,null))[_0x385a('0x42')](handleError(_0x31627b,null));};exports['getSubjects']=function(_0x24e3a8,_0x1b6ca8,_0x3eb22c){var _0x33df4f={};var _0x359014={};var _0x1c3340;var _0x3b58b4;return db[_0x385a('0x2c')][_0x385a('0x49')]({'where':{'id':_0x24e3a8[_0x385a('0x43')]['id']}})[_0x385a('0x24')](handleEntityNotFound(_0x1b6ca8,null))[_0x385a('0x24')](function(_0x1e774c){if(_0x1e774c){_0x1c3340=_0x1e774c;_0x359014[_0x385a('0x31')]=_[_0x385a('0x33')](db['DeskField'][_0x385a('0x2d')]);_0x359014[_0x385a('0x32')]=_['keys'](_0x24e3a8[_0x385a('0x32')]);_0x359014['filters']=_['intersection'](_0x359014[_0x385a('0x31')],_0x359014[_0x385a('0x32')]);_0x33df4f[_0x385a('0x36')]=_['intersection'](_0x359014['model'],qs[_0x385a('0x35')](_0x24e3a8['query'][_0x385a('0x35')]));_0x33df4f['attributes']=_0x33df4f[_0x385a('0x36')][_0x385a('0x37')]?_0x33df4f[_0x385a('0x36')]:_0x359014['model'];_0x33df4f[_0x385a('0x4b')]=qs[_0x385a('0x39')](_0x24e3a8[_0x385a('0x32')][_0x385a('0x39')]);_0x33df4f[_0x385a('0x3a')]=qs[_0x385a('0x3b')](_[_0x385a('0x4c')](_0x24e3a8[_0x385a('0x32')],_0x359014['filters']));if(_0x24e3a8[_0x385a('0x32')]['filter']){_0x33df4f[_0x385a('0x3a')]=_['merge'](_0x33df4f['where'],{'$or':_[_0x385a('0x2b')](_0x33df4f[_0x385a('0x36')],function(_0x3cd53a){var _0x57b9b2={};_0x57b9b2[_0x3cd53a]={'$like':'%'+_0x24e3a8['query']['filter']+'%'};return _0x57b9b2;})});}_0x33df4f=_[_0x385a('0x3d')]({},_0x33df4f,_0x24e3a8[_0x385a('0x3f')]);return _0x1c3340[_0x385a('0x4e')](_0x33df4f);}})[_0x385a('0x24')](function(_0xf6ee04){if(_0xf6ee04){_0x3b58b4=_0xf6ee04[_0x385a('0x37')];if(!_0x24e3a8['query'][_0x385a('0x4d')](_0x385a('0x38'))){_0x33df4f[_0x385a('0x1e')]=qs['limit'](_0x24e3a8[_0x385a('0x32')][_0x385a('0x1e')]);_0x33df4f[_0x385a('0x1c')]=qs['offset'](_0x24e3a8[_0x385a('0x32')]['offset']);}return _0x1c3340['getSubjects'](_0x33df4f);}})[_0x385a('0x24')](function(_0x564680){if(_0x564680){return _0x564680?{'count':_0x3b58b4,'rows':_0x564680}:null;}})[_0x385a('0x24')](respondWithResult(_0x1b6ca8,null))['catch'](handleError(_0x1b6ca8,null));};exports[_0x385a('0x4f')]=function(_0x563472,_0x1dc219,_0x34ea6c){var _0xcf09bd={};var _0x5c049d={};var _0x967677;var _0x29517a;return db[_0x385a('0x2c')][_0x385a('0x49')]({'where':{'id':_0x563472[_0x385a('0x43')]['id']}})['then'](handleEntityNotFound(_0x1dc219,null))[_0x385a('0x24')](function(_0x5bdab9){if(_0x5bdab9){_0x967677=_0x5bdab9;_0x5c049d['model']=_[_0x385a('0x33')](db[_0x385a('0x4a')][_0x385a('0x2d')]);_0x5c049d['query']=_[_0x385a('0x33')](_0x563472[_0x385a('0x32')]);_0x5c049d[_0x385a('0x3b')]=_[_0x385a('0x34')](_0x5c049d[_0x385a('0x31')],_0x5c049d[_0x385a('0x32')]);_0xcf09bd[_0x385a('0x36')]=_[_0x385a('0x34')](_0x5c049d[_0x385a('0x31')],qs[_0x385a('0x35')](_0x563472[_0x385a('0x32')][_0x385a('0x35')]));_0xcf09bd[_0x385a('0x36')]=_0xcf09bd['attributes'][_0x385a('0x37')]?_0xcf09bd[_0x385a('0x36')]:_0x5c049d[_0x385a('0x31')];_0xcf09bd[_0x385a('0x4b')]=qs['sort'](_0x563472[_0x385a('0x32')][_0x385a('0x39')]);_0xcf09bd['where']=qs[_0x385a('0x3b')](_[_0x385a('0x4c')](_0x563472[_0x385a('0x32')],_0x5c049d[_0x385a('0x3b')]));if(_0x563472[_0x385a('0x32')]['filter']){_0xcf09bd[_0x385a('0x3a')]=_['merge'](_0xcf09bd[_0x385a('0x3a')],{'$or':_[_0x385a('0x2b')](_0xcf09bd[_0x385a('0x36')],function(_0x16cfeb){var _0x1567b8={};_0x1567b8[_0x16cfeb]={'$like':'%'+_0x563472[_0x385a('0x32')]['filter']+'%'};return _0x1567b8;})});}_0xcf09bd=_[_0x385a('0x3d')]({},_0xcf09bd,_0x563472[_0x385a('0x3f')]);return _0x967677[_0x385a('0x4f')](_0xcf09bd);}})[_0x385a('0x24')](function(_0x2b7a11){if(_0x2b7a11){_0x29517a=_0x2b7a11[_0x385a('0x37')];if(!_0x563472[_0x385a('0x32')][_0x385a('0x4d')](_0x385a('0x38'))){_0xcf09bd[_0x385a('0x1e')]=qs['limit'](_0x563472[_0x385a('0x32')][_0x385a('0x1e')]);_0xcf09bd[_0x385a('0x1c')]=qs[_0x385a('0x1c')](_0x563472[_0x385a('0x32')][_0x385a('0x1c')]);}return _0x967677[_0x385a('0x4f')](_0xcf09bd);}})[_0x385a('0x24')](function(_0x2c808c){if(_0x2c808c){return _0x2c808c?{'count':_0x29517a,'rows':_0x2c808c}:null;}})[_0x385a('0x24')](respondWithResult(_0x1dc219,null))['catch'](handleError(_0x1dc219,null));};exports[_0x385a('0x50')]=function(_0x29dcb9,_0x3dfc5a,_0x35489a){var _0x294380={};var _0x203a52={};var _0x4771e5;var _0x565dc7;return db[_0x385a('0x2c')]['findOne']({'where':{'id':_0x29dcb9['params']['id']}})['then'](handleEntityNotFound(_0x3dfc5a,null))[_0x385a('0x24')](function(_0x28cbfc){if(_0x28cbfc){_0x4771e5=_0x28cbfc;_0x203a52[_0x385a('0x31')]=_['keys'](db[_0x385a('0x51')][_0x385a('0x2d')]);_0x203a52['query']=_['keys'](_0x29dcb9[_0x385a('0x32')]);_0x203a52[_0x385a('0x3b')]=_[_0x385a('0x34')](_0x203a52['model'],_0x203a52[_0x385a('0x32')]);_0x294380['attributes']=_[_0x385a('0x34')](_0x203a52['model'],qs[_0x385a('0x35')](_0x29dcb9[_0x385a('0x32')]['fields']));_0x294380['attributes']=_0x294380[_0x385a('0x36')]['length']?_0x294380[_0x385a('0x36')]:_0x203a52[_0x385a('0x31')];_0x294380['order']=qs[_0x385a('0x39')](_0x29dcb9['query'][_0x385a('0x39')]);_0x294380[_0x385a('0x3a')]=qs[_0x385a('0x3b')](_['pick'](_0x29dcb9['query'],_0x203a52['filters']));if(_0x29dcb9[_0x385a('0x32')][_0x385a('0x3c')]){_0x294380[_0x385a('0x3a')]=_['merge'](_0x294380[_0x385a('0x3a')],{'$or':_[_0x385a('0x2b')](_0x294380['attributes'],function(_0x593376){var _0x58fea1={};_0x58fea1[_0x593376]={'$like':'%'+_0x29dcb9['query'][_0x385a('0x3c')]+'%'};return _0x58fea1;})});}_0x294380=_['merge']({},_0x294380,_0x29dcb9[_0x385a('0x3f')]);return _0x4771e5[_0x385a('0x50')](_0x294380);}})[_0x385a('0x24')](function(_0x22eaba){if(_0x22eaba){_0x565dc7=_0x22eaba['length'];if(!_0x29dcb9['query'][_0x385a('0x4d')](_0x385a('0x38'))){_0x294380[_0x385a('0x1e')]=qs[_0x385a('0x1e')](_0x29dcb9['query'][_0x385a('0x1e')]);_0x294380[_0x385a('0x1c')]=qs[_0x385a('0x1c')](_0x29dcb9[_0x385a('0x32')][_0x385a('0x1c')]);}return _0x4771e5[_0x385a('0x50')](_0x294380);}})['then'](function(_0x1b157b){if(_0x1b157b){return _0x1b157b?{'count':_0x565dc7,'rows':_0x1b157b}:null;}})[_0x385a('0x24')](respondWithResult(_0x3dfc5a,null))[_0x385a('0x42')](handleError(_0x3dfc5a,null));};exports[_0x385a('0x52')]=function(_0x555bfb,_0x32bf76,_0x53cbe0){if(_0x555bfb[_0x385a('0x47')]['id']){delete _0x555bfb[_0x385a('0x47')]['id'];}return db[_0x385a('0x2c')][_0x385a('0x49')]({'where':{'id':_0x555bfb[_0x385a('0x43')]['id']}})[_0x385a('0x24')](handleEntityNotFound(_0x32bf76,null))[_0x385a('0x24')](function(_0x31d7ce){if(_0x31d7ce){return _0x31d7ce[_0x385a('0x52')](_0x555bfb[_0x385a('0x47')][_0x385a('0x53')]||[]);}return null;})[_0x385a('0x24')](respondWithResult(_0x32bf76,null))['catch'](handleError(_0x32bf76,null));}; \ No newline at end of file +var _0x9e24=['merge','include','show','params','includeAll','options','find','create','body','catch','findOne','DeskField','order','getFields','getSubjects','getDescriptions','getTags','Tag','setTags','ids','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','undefined','limit','count','offset','apply','save','update','then','destroy','error','stack','name','index','map','DeskConfiguration','rawAttributes','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter'];(function(_0x18e0d1,_0xbca4cb){var _0x58db41=function(_0x5ccffd){while(--_0x5ccffd){_0x18e0d1['push'](_0x18e0d1['shift']());}};_0x58db41(++_0xbca4cb);}(_0x9e24,0xb8));var _0x49e2=function(_0x1ff575,_0xdba21f){_0x1ff575=_0x1ff575-0x0;var _0x48fc9e=_0x9e24[_0x1ff575];return _0x48fc9e;};'use strict';var emlformat=require(_0x49e2('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x49e2('0x1'));var jsonpatch=require(_0x49e2('0x2'));var rp=require('request-promise');var moment=require(_0x49e2('0x3'));var BPromise=require(_0x49e2('0x4'));var Mustache=require(_0x49e2('0x5'));var util=require('util');var path=require(_0x49e2('0x6'));var sox=require(_0x49e2('0x7'));var csv=require('to-csv');var ejs=require(_0x49e2('0x8'));var fs=require('fs');var fs_extra=require(_0x49e2('0x9'));var _=require(_0x49e2('0xa'));var squel=require(_0x49e2('0xb'));var crypto=require(_0x49e2('0xc'));var jsforce=require(_0x49e2('0xd'));var deskjs=require(_0x49e2('0xe'));var toCsv=require('to-csv');var querystring=require(_0x49e2('0xf'));var Papa=require(_0x49e2('0x10'));var Redis=require(_0x49e2('0x11'));var authService=require(_0x49e2('0x12'));var qs=require(_0x49e2('0x13'));var as=require(_0x49e2('0x14'));var hardwareService=require(_0x49e2('0x15'));var logger=require(_0x49e2('0x16'))(_0x49e2('0x17'));var utils=require(_0x49e2('0x18'));var config=require(_0x49e2('0x19'));var licenseUtil=require(_0x49e2('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4a5b16,_0x321dc8){_0x321dc8=_0x321dc8||0xcc;return function(_0x321751){if(_0x321751){return _0x4a5b16[_0x49e2('0x1b')](_0x321dc8);}return _0x4a5b16[_0x49e2('0x1c')](_0x321dc8)[_0x49e2('0x1d')]();};}function respondWithResult(_0x27e4f7,_0x58410c){_0x58410c=_0x58410c||0xc8;return function(_0x44d69d){if(_0x44d69d){return _0x27e4f7[_0x49e2('0x1c')](_0x58410c)[_0x49e2('0x1e')](_0x44d69d);}};}function respondWithFilteredResult(_0x503a21,_0x64c56e){return function(_0x180944){if(_0x180944){var _0x4ce52c=typeof _0x64c56e['offset']===_0x49e2('0x1f')&&typeof _0x64c56e[_0x49e2('0x20')]===_0x49e2('0x1f');var _0x272e89=_0x180944[_0x49e2('0x21')];var _0x19a279=_0x4ce52c?0x0:_0x64c56e[_0x49e2('0x22')];var _0x28c4e7=_0x4ce52c?_0x180944[_0x49e2('0x21')]:_0x64c56e['offset']+_0x64c56e[_0x49e2('0x20')];var _0x2d731a;if(_0x28c4e7>=_0x272e89){_0x28c4e7=_0x272e89;_0x2d731a=0xc8;}else{_0x2d731a=0xce;}_0x503a21[_0x49e2('0x1c')](_0x2d731a);return _0x503a21['set']('Content-Range',_0x19a279+'-'+_0x28c4e7+'/'+_0x272e89)['json'](_0x180944);}return null;};}function patchUpdates(_0x27b9f0){return function(_0x60c055){try{jsonpatch[_0x49e2('0x23')](_0x60c055,_0x27b9f0,!![]);}catch(_0x534ebc){return BPromise['reject'](_0x534ebc);}return _0x60c055[_0x49e2('0x24')]();};}function saveUpdates(_0x201142,_0x4e44e6){return function(_0x1776a7){if(_0x1776a7){return _0x1776a7[_0x49e2('0x25')](_0x201142)[_0x49e2('0x26')](function(_0xa84765){return _0xa84765;});}return null;};}function removeEntity(_0x259765,_0x793e4e){return function(_0xae99ff){if(_0xae99ff){return _0xae99ff[_0x49e2('0x27')]()[_0x49e2('0x26')](function(){_0x259765[_0x49e2('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4bf559,_0x448b81){return function(_0x12144a){if(!_0x12144a){_0x4bf559[_0x49e2('0x1b')](0x194);}return _0x12144a;};}function handleError(_0x1d7886,_0x17ab05){_0x17ab05=_0x17ab05||0x1f4;return function(_0x126ce3){logger[_0x49e2('0x28')](_0x126ce3[_0x49e2('0x29')]);if(_0x126ce3['name']){delete _0x126ce3[_0x49e2('0x2a')];}_0x1d7886[_0x49e2('0x1c')](_0x17ab05)['send'](_0x126ce3);};}exports[_0x49e2('0x2b')]=function(_0x190b37,_0x26123f){var _0x2e4dcd={},_0x407f9a={},_0x109303={'count':0x0,'rows':[]};var _0x154ce5=_[_0x49e2('0x2c')](db[_0x49e2('0x2d')][_0x49e2('0x2e')],function(_0x1acda0){return{'name':_0x1acda0['fieldName'],'type':_0x1acda0['type'][_0x49e2('0x2f')]};});_0x407f9a[_0x49e2('0x30')]=_[_0x49e2('0x2c')](_0x154ce5,'name');_0x407f9a[_0x49e2('0x31')]=_[_0x49e2('0x32')](_0x190b37[_0x49e2('0x31')]);_0x407f9a[_0x49e2('0x33')]=_[_0x49e2('0x34')](_0x407f9a['model'],_0x407f9a[_0x49e2('0x31')]);_0x2e4dcd['attributes']=_['intersection'](_0x407f9a[_0x49e2('0x30')],qs['fields'](_0x190b37[_0x49e2('0x31')][_0x49e2('0x35')]));_0x2e4dcd[_0x49e2('0x36')]=_0x2e4dcd[_0x49e2('0x36')][_0x49e2('0x37')]?_0x2e4dcd[_0x49e2('0x36')]:_0x407f9a[_0x49e2('0x30')];if(!_0x190b37['query'][_0x49e2('0x38')](_0x49e2('0x39'))){_0x2e4dcd[_0x49e2('0x20')]=qs[_0x49e2('0x20')](_0x190b37[_0x49e2('0x31')]['limit']);_0x2e4dcd[_0x49e2('0x22')]=qs['offset'](_0x190b37[_0x49e2('0x31')][_0x49e2('0x22')]);}_0x2e4dcd['order']=qs['sort'](_0x190b37['query'][_0x49e2('0x3a')]);_0x2e4dcd[_0x49e2('0x3b')]=qs[_0x49e2('0x33')](_[_0x49e2('0x3c')](_0x190b37['query'],_0x407f9a[_0x49e2('0x33')]),_0x154ce5);if(_0x190b37[_0x49e2('0x31')][_0x49e2('0x3d')]){_0x2e4dcd[_0x49e2('0x3b')]=_[_0x49e2('0x3e')](_0x2e4dcd[_0x49e2('0x3b')],{'$or':_[_0x49e2('0x2c')](_0x154ce5,function(_0x253afa){if(_0x253afa['type']!=='VIRTUAL'){var _0x2f716f={};_0x2f716f[_0x253afa['name']]={'$like':'%'+_0x190b37[_0x49e2('0x31')][_0x49e2('0x3d')]+'%'};return _0x2f716f;}})});}_0x2e4dcd=_[_0x49e2('0x3e')]({},_0x2e4dcd,_0x190b37['options']);var _0x116465={'where':_0x2e4dcd['where']};return db['DeskConfiguration'][_0x49e2('0x21')](_0x116465)[_0x49e2('0x26')](function(_0x9cb02d){_0x109303[_0x49e2('0x21')]=_0x9cb02d;if(_0x190b37[_0x49e2('0x31')]['includeAll']){_0x2e4dcd[_0x49e2('0x3f')]=[{'all':!![]}];}return db['DeskConfiguration']['findAll'](_0x2e4dcd);})[_0x49e2('0x26')](function(_0x27ec55){_0x109303['rows']=_0x27ec55;return _0x109303;})[_0x49e2('0x26')](respondWithFilteredResult(_0x26123f,_0x2e4dcd))['catch'](handleError(_0x26123f,null));};exports[_0x49e2('0x40')]=function(_0x1d9ce5,_0x449362){var _0x1a1157={'raw':![],'where':{'id':_0x1d9ce5[_0x49e2('0x41')]['id']}},_0x136491={};_0x136491['model']=_[_0x49e2('0x32')](db['DeskConfiguration'][_0x49e2('0x2e')]);_0x136491[_0x49e2('0x31')]=_[_0x49e2('0x32')](_0x1d9ce5[_0x49e2('0x31')]);_0x136491['filters']=_[_0x49e2('0x34')](_0x136491[_0x49e2('0x30')],_0x136491[_0x49e2('0x31')]);_0x1a1157[_0x49e2('0x36')]=_[_0x49e2('0x34')](_0x136491['model'],qs[_0x49e2('0x35')](_0x1d9ce5[_0x49e2('0x31')]['fields']));_0x1a1157['attributes']=_0x1a1157[_0x49e2('0x36')][_0x49e2('0x37')]?_0x1a1157['attributes']:_0x136491[_0x49e2('0x30')];if(_0x1d9ce5['query'][_0x49e2('0x42')]){_0x1a1157[_0x49e2('0x3f')]=[{'all':!![]}];}_0x1a1157=_['merge']({},_0x1a1157,_0x1d9ce5[_0x49e2('0x43')]);return db[_0x49e2('0x2d')][_0x49e2('0x44')](_0x1a1157)['then'](handleEntityNotFound(_0x449362,null))[_0x49e2('0x26')](respondWithResult(_0x449362,null))['catch'](handleError(_0x449362,null));};exports[_0x49e2('0x45')]=function(_0x581dda,_0x3e52e4){return db['DeskConfiguration'][_0x49e2('0x45')](_0x581dda[_0x49e2('0x46')],{})[_0x49e2('0x26')](respondWithResult(_0x3e52e4,0xc9))[_0x49e2('0x47')](handleError(_0x3e52e4,null));};exports[_0x49e2('0x25')]=function(_0x2e7283,_0x69176f){if(_0x2e7283['body']['id']){delete _0x2e7283[_0x49e2('0x46')]['id'];}return db[_0x49e2('0x2d')][_0x49e2('0x44')]({'where':{'id':_0x2e7283[_0x49e2('0x41')]['id']}})[_0x49e2('0x26')](handleEntityNotFound(_0x69176f,null))[_0x49e2('0x26')](saveUpdates(_0x2e7283[_0x49e2('0x46')],null))[_0x49e2('0x26')](respondWithResult(_0x69176f,null))[_0x49e2('0x47')](handleError(_0x69176f,null));};exports[_0x49e2('0x27')]=function(_0x2d4886,_0x3902bc){return db[_0x49e2('0x2d')][_0x49e2('0x44')]({'where':{'id':_0x2d4886['params']['id']}})[_0x49e2('0x26')](handleEntityNotFound(_0x3902bc,null))['then'](removeEntity(_0x3902bc,null))['catch'](handleError(_0x3902bc,null));};exports['getFields']=function(_0x2b3987,_0x559bb6,_0x37e739){var _0x162404={};var _0x113873={};var _0x27a27d;var _0x55fcc0;return db[_0x49e2('0x2d')][_0x49e2('0x48')]({'where':{'id':_0x2b3987['params']['id']}})[_0x49e2('0x26')](handleEntityNotFound(_0x559bb6,null))[_0x49e2('0x26')](function(_0x321f85){if(_0x321f85){_0x27a27d=_0x321f85;_0x113873[_0x49e2('0x30')]=_[_0x49e2('0x32')](db[_0x49e2('0x49')][_0x49e2('0x2e')]);_0x113873['query']=_['keys'](_0x2b3987[_0x49e2('0x31')]);_0x113873['filters']=_['intersection'](_0x113873[_0x49e2('0x30')],_0x113873['query']);_0x162404[_0x49e2('0x36')]=_[_0x49e2('0x34')](_0x113873[_0x49e2('0x30')],qs[_0x49e2('0x35')](_0x2b3987['query'][_0x49e2('0x35')]));_0x162404[_0x49e2('0x36')]=_0x162404[_0x49e2('0x36')][_0x49e2('0x37')]?_0x162404[_0x49e2('0x36')]:_0x113873[_0x49e2('0x30')];_0x162404[_0x49e2('0x4a')]=qs[_0x49e2('0x3a')](_0x2b3987[_0x49e2('0x31')]['sort']);_0x162404[_0x49e2('0x3b')]=qs[_0x49e2('0x33')](_[_0x49e2('0x3c')](_0x2b3987['query'],_0x113873[_0x49e2('0x33')]));if(_0x2b3987[_0x49e2('0x31')][_0x49e2('0x3d')]){_0x162404[_0x49e2('0x3b')]=_[_0x49e2('0x3e')](_0x162404[_0x49e2('0x3b')],{'$or':_[_0x49e2('0x2c')](_0x162404[_0x49e2('0x36')],function(_0x1a5a9f){var _0x2ba757={};_0x2ba757[_0x1a5a9f]={'$like':'%'+_0x2b3987[_0x49e2('0x31')][_0x49e2('0x3d')]+'%'};return _0x2ba757;})});}_0x162404=_[_0x49e2('0x3e')]({},_0x162404,_0x2b3987[_0x49e2('0x43')]);return _0x27a27d[_0x49e2('0x4b')](_0x162404);}})['then'](function(_0x16eda0){if(_0x16eda0){_0x55fcc0=_0x16eda0[_0x49e2('0x37')];if(!_0x2b3987['query'][_0x49e2('0x38')]('nolimit')){_0x162404[_0x49e2('0x20')]=qs[_0x49e2('0x20')](_0x2b3987[_0x49e2('0x31')]['limit']);_0x162404[_0x49e2('0x22')]=qs[_0x49e2('0x22')](_0x2b3987[_0x49e2('0x31')]['offset']);}return _0x27a27d[_0x49e2('0x4b')](_0x162404);}})[_0x49e2('0x26')](function(_0x568a57){if(_0x568a57){return _0x568a57?{'count':_0x55fcc0,'rows':_0x568a57}:null;}})[_0x49e2('0x26')](respondWithResult(_0x559bb6,null))[_0x49e2('0x47')](handleError(_0x559bb6,null));};exports[_0x49e2('0x4c')]=function(_0x52e9f3,_0x3293bf,_0x3c30fb){var _0xf727d9={};var _0xa2503e={};var _0xb25694;var _0xae77cf;return db[_0x49e2('0x2d')][_0x49e2('0x48')]({'where':{'id':_0x52e9f3['params']['id']}})[_0x49e2('0x26')](handleEntityNotFound(_0x3293bf,null))[_0x49e2('0x26')](function(_0x7a6502){if(_0x7a6502){_0xb25694=_0x7a6502;_0xa2503e['model']=_[_0x49e2('0x32')](db[_0x49e2('0x49')][_0x49e2('0x2e')]);_0xa2503e[_0x49e2('0x31')]=_[_0x49e2('0x32')](_0x52e9f3[_0x49e2('0x31')]);_0xa2503e[_0x49e2('0x33')]=_[_0x49e2('0x34')](_0xa2503e[_0x49e2('0x30')],_0xa2503e[_0x49e2('0x31')]);_0xf727d9[_0x49e2('0x36')]=_[_0x49e2('0x34')](_0xa2503e[_0x49e2('0x30')],qs[_0x49e2('0x35')](_0x52e9f3['query'][_0x49e2('0x35')]));_0xf727d9['attributes']=_0xf727d9[_0x49e2('0x36')][_0x49e2('0x37')]?_0xf727d9['attributes']:_0xa2503e[_0x49e2('0x30')];_0xf727d9[_0x49e2('0x4a')]=qs['sort'](_0x52e9f3[_0x49e2('0x31')][_0x49e2('0x3a')]);_0xf727d9[_0x49e2('0x3b')]=qs['filters'](_['pick'](_0x52e9f3[_0x49e2('0x31')],_0xa2503e[_0x49e2('0x33')]));if(_0x52e9f3[_0x49e2('0x31')][_0x49e2('0x3d')]){_0xf727d9['where']=_[_0x49e2('0x3e')](_0xf727d9[_0x49e2('0x3b')],{'$or':_[_0x49e2('0x2c')](_0xf727d9[_0x49e2('0x36')],function(_0x355214){var _0x4f7192={};_0x4f7192[_0x355214]={'$like':'%'+_0x52e9f3[_0x49e2('0x31')][_0x49e2('0x3d')]+'%'};return _0x4f7192;})});}_0xf727d9=_[_0x49e2('0x3e')]({},_0xf727d9,_0x52e9f3[_0x49e2('0x43')]);return _0xb25694[_0x49e2('0x4c')](_0xf727d9);}})[_0x49e2('0x26')](function(_0xd90a7b){if(_0xd90a7b){_0xae77cf=_0xd90a7b[_0x49e2('0x37')];if(!_0x52e9f3['query'][_0x49e2('0x38')]('nolimit')){_0xf727d9[_0x49e2('0x20')]=qs[_0x49e2('0x20')](_0x52e9f3['query'][_0x49e2('0x20')]);_0xf727d9['offset']=qs[_0x49e2('0x22')](_0x52e9f3['query'][_0x49e2('0x22')]);}return _0xb25694['getSubjects'](_0xf727d9);}})[_0x49e2('0x26')](function(_0x3835b9){if(_0x3835b9){return _0x3835b9?{'count':_0xae77cf,'rows':_0x3835b9}:null;}})[_0x49e2('0x26')](respondWithResult(_0x3293bf,null))[_0x49e2('0x47')](handleError(_0x3293bf,null));};exports['getDescriptions']=function(_0x2065c1,_0x5e13e0,_0x56d61f){var _0x57cc1b={};var _0x2608af={};var _0x367064;var _0x564033;return db[_0x49e2('0x2d')]['findOne']({'where':{'id':_0x2065c1[_0x49e2('0x41')]['id']}})[_0x49e2('0x26')](handleEntityNotFound(_0x5e13e0,null))[_0x49e2('0x26')](function(_0xc7abf6){if(_0xc7abf6){_0x367064=_0xc7abf6;_0x2608af[_0x49e2('0x30')]=_[_0x49e2('0x32')](db['DeskField'][_0x49e2('0x2e')]);_0x2608af[_0x49e2('0x31')]=_[_0x49e2('0x32')](_0x2065c1[_0x49e2('0x31')]);_0x2608af[_0x49e2('0x33')]=_[_0x49e2('0x34')](_0x2608af[_0x49e2('0x30')],_0x2608af[_0x49e2('0x31')]);_0x57cc1b[_0x49e2('0x36')]=_[_0x49e2('0x34')](_0x2608af['model'],qs['fields'](_0x2065c1['query'][_0x49e2('0x35')]));_0x57cc1b[_0x49e2('0x36')]=_0x57cc1b['attributes'][_0x49e2('0x37')]?_0x57cc1b['attributes']:_0x2608af[_0x49e2('0x30')];_0x57cc1b[_0x49e2('0x4a')]=qs[_0x49e2('0x3a')](_0x2065c1[_0x49e2('0x31')][_0x49e2('0x3a')]);_0x57cc1b[_0x49e2('0x3b')]=qs[_0x49e2('0x33')](_[_0x49e2('0x3c')](_0x2065c1[_0x49e2('0x31')],_0x2608af['filters']));if(_0x2065c1['query'][_0x49e2('0x3d')]){_0x57cc1b[_0x49e2('0x3b')]=_[_0x49e2('0x3e')](_0x57cc1b[_0x49e2('0x3b')],{'$or':_['map'](_0x57cc1b[_0x49e2('0x36')],function(_0x14f1c3){var _0x18cd74={};_0x18cd74[_0x14f1c3]={'$like':'%'+_0x2065c1[_0x49e2('0x31')][_0x49e2('0x3d')]+'%'};return _0x18cd74;})});}_0x57cc1b=_[_0x49e2('0x3e')]({},_0x57cc1b,_0x2065c1[_0x49e2('0x43')]);return _0x367064[_0x49e2('0x4d')](_0x57cc1b);}})[_0x49e2('0x26')](function(_0x378055){if(_0x378055){_0x564033=_0x378055[_0x49e2('0x37')];if(!_0x2065c1[_0x49e2('0x31')]['hasOwnProperty']('nolimit')){_0x57cc1b[_0x49e2('0x20')]=qs[_0x49e2('0x20')](_0x2065c1[_0x49e2('0x31')][_0x49e2('0x20')]);_0x57cc1b[_0x49e2('0x22')]=qs[_0x49e2('0x22')](_0x2065c1[_0x49e2('0x31')]['offset']);}return _0x367064[_0x49e2('0x4d')](_0x57cc1b);}})[_0x49e2('0x26')](function(_0x43d2ad){if(_0x43d2ad){return _0x43d2ad?{'count':_0x564033,'rows':_0x43d2ad}:null;}})[_0x49e2('0x26')](respondWithResult(_0x5e13e0,null))[_0x49e2('0x47')](handleError(_0x5e13e0,null));};exports[_0x49e2('0x4e')]=function(_0x25366e,_0x5879ad,_0x3093a3){var _0x80cb11={};var _0x4c6630={};var _0xb37d39;var _0x55d477;return db['DeskConfiguration'][_0x49e2('0x48')]({'where':{'id':_0x25366e[_0x49e2('0x41')]['id']}})[_0x49e2('0x26')](handleEntityNotFound(_0x5879ad,null))[_0x49e2('0x26')](function(_0xd8c8df){if(_0xd8c8df){_0xb37d39=_0xd8c8df;_0x4c6630['model']=_['keys'](db[_0x49e2('0x4f')][_0x49e2('0x2e')]);_0x4c6630[_0x49e2('0x31')]=_[_0x49e2('0x32')](_0x25366e[_0x49e2('0x31')]);_0x4c6630[_0x49e2('0x33')]=_[_0x49e2('0x34')](_0x4c6630[_0x49e2('0x30')],_0x4c6630[_0x49e2('0x31')]);_0x80cb11[_0x49e2('0x36')]=_['intersection'](_0x4c6630[_0x49e2('0x30')],qs[_0x49e2('0x35')](_0x25366e[_0x49e2('0x31')][_0x49e2('0x35')]));_0x80cb11[_0x49e2('0x36')]=_0x80cb11[_0x49e2('0x36')][_0x49e2('0x37')]?_0x80cb11[_0x49e2('0x36')]:_0x4c6630[_0x49e2('0x30')];_0x80cb11['order']=qs[_0x49e2('0x3a')](_0x25366e[_0x49e2('0x31')][_0x49e2('0x3a')]);_0x80cb11['where']=qs[_0x49e2('0x33')](_[_0x49e2('0x3c')](_0x25366e['query'],_0x4c6630[_0x49e2('0x33')]));if(_0x25366e['query'][_0x49e2('0x3d')]){_0x80cb11[_0x49e2('0x3b')]=_[_0x49e2('0x3e')](_0x80cb11[_0x49e2('0x3b')],{'$or':_[_0x49e2('0x2c')](_0x80cb11[_0x49e2('0x36')],function(_0x5a253e){var _0x33cb95={};_0x33cb95[_0x5a253e]={'$like':'%'+_0x25366e[_0x49e2('0x31')][_0x49e2('0x3d')]+'%'};return _0x33cb95;})});}_0x80cb11=_['merge']({},_0x80cb11,_0x25366e[_0x49e2('0x43')]);return _0xb37d39[_0x49e2('0x4e')](_0x80cb11);}})[_0x49e2('0x26')](function(_0x8a9e45){if(_0x8a9e45){_0x55d477=_0x8a9e45['length'];if(!_0x25366e['query']['hasOwnProperty'](_0x49e2('0x39'))){_0x80cb11[_0x49e2('0x20')]=qs[_0x49e2('0x20')](_0x25366e[_0x49e2('0x31')][_0x49e2('0x20')]);_0x80cb11['offset']=qs[_0x49e2('0x22')](_0x25366e[_0x49e2('0x31')][_0x49e2('0x22')]);}return _0xb37d39[_0x49e2('0x4e')](_0x80cb11);}})['then'](function(_0xd75031){if(_0xd75031){return _0xd75031?{'count':_0x55d477,'rows':_0xd75031}:null;}})[_0x49e2('0x26')](respondWithResult(_0x5879ad,null))[_0x49e2('0x47')](handleError(_0x5879ad,null));};exports['setTags']=function(_0x54a5fe,_0x450f02,_0x26c2f2){if(_0x54a5fe[_0x49e2('0x46')]['id']){delete _0x54a5fe[_0x49e2('0x46')]['id'];}return db[_0x49e2('0x2d')][_0x49e2('0x48')]({'where':{'id':_0x54a5fe['params']['id']}})['then'](handleEntityNotFound(_0x450f02,null))[_0x49e2('0x26')](function(_0x294758){if(_0x294758){return _0x294758[_0x49e2('0x50')](_0x54a5fe['body'][_0x49e2('0x51')]||[]);}return null;})[_0x49e2('0x26')](respondWithResult(_0x450f02,null))[_0x49e2('0x47')](handleError(_0x450f02,null));}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.model.js b/server/api/intDeskConfiguration/intDeskConfiguration.model.js index f267216..f1fb11d 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 _0x9f1b=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intDeskConfiguration.attributes','define','DeskConfiguration','int_desk_configurations','lodash'];(function(_0x4c6ce5,_0x2381c6){var _0x4de221=function(_0x207e3d){while(--_0x207e3d){_0x4c6ce5['push'](_0x4c6ce5['shift']());}};_0x4de221(++_0x2381c6);}(_0x9f1b,0x178));var _0xb9f1=function(_0x455ba4,_0x1d7f84){_0x455ba4=_0x455ba4-0x0;var _0x6a6600=_0x9f1b[_0x455ba4];return _0x6a6600;};'use strict';var _=require(_0xb9f1('0x0'));var util=require('util');var logger=require(_0xb9f1('0x1'))(_0xb9f1('0x2'));var moment=require(_0xb9f1('0x3'));var BPromise=require(_0xb9f1('0x4'));var rp=require(_0xb9f1('0x5'));var fs=require('fs');var path=require(_0xb9f1('0x6'));var rimraf=require(_0xb9f1('0x7'));var config=require(_0xb9f1('0x8'));var attributes=require(_0xb9f1('0x9'));module['exports']=function(_0x2a5d76,_0x59bdb4){return _0x2a5d76[_0xb9f1('0xa')](_0xb9f1('0xb'),attributes,{'tableName':_0xb9f1('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9b56=['bluebird','request-promise','rimraf','../../config/environment','./intDeskConfiguration.attributes','exports','define','DeskConfiguration','lodash','util','../../config/logger','api','moment'];(function(_0x58a4b9,_0x1a8f42){var _0x69dbe1=function(_0x5a3066){while(--_0x5a3066){_0x58a4b9['push'](_0x58a4b9['shift']());}};_0x69dbe1(++_0x1a8f42);}(_0x9b56,0x1c2));var _0x69b5=function(_0x2df507,_0x553862){_0x2df507=_0x2df507-0x0;var _0x1f7167=_0x9b56[_0x2df507];return _0x1f7167;};'use strict';var _=require(_0x69b5('0x0'));var util=require(_0x69b5('0x1'));var logger=require(_0x69b5('0x2'))(_0x69b5('0x3'));var moment=require(_0x69b5('0x4'));var BPromise=require(_0x69b5('0x5'));var rp=require(_0x69b5('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x69b5('0x7'));var config=require(_0x69b5('0x8'));var attributes=require(_0x69b5('0x9'));module[_0x69b5('0xa')]=function(_0x1a2f25,_0x1a1eb6){return _0x1a2f25[_0x69b5('0xb')](_0x69b5('0xc'),attributes,{'tableName':'int_desk_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.rpc.js b/server/api/intDeskConfiguration/intDeskConfiguration.rpc.js index 67bad75..cb44f1f 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 _0x5074=['error','code','message','result','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','info','DeskConfiguration,\x20%s,\x20%s','request\x20sent','DeskConfiguration,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x3c51d4,_0x36ba53){var _0x53c45f=function(_0x3d6683){while(--_0x3d6683){_0x3c51d4['push'](_0x3c51d4['shift']());}};_0x53c45f(++_0x36ba53);}(_0x5074,0x1e7));var _0x4507=function(_0x322bef,_0x4890d4){_0x322bef=_0x322bef-0x0;var _0x229e60=_0x5074[_0x322bef];return _0x229e60;};'use strict';var _=require('lodash');var util=require(_0x4507('0x0'));var moment=require(_0x4507('0x1'));var BPromise=require('bluebird');var rs=require(_0x4507('0x2'));var fs=require('fs');var Redis=require(_0x4507('0x3'));var db=require(_0x4507('0x4'))['db'];var utils=require(_0x4507('0x5'));var logger=require(_0x4507('0x6'))(_0x4507('0x7'));var config=require(_0x4507('0x8'));var jayson=require(_0x4507('0x9'));var client=jayson[_0x4507('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x32401a,_0x510dbc,_0xfae19a){return new BPromise(function(_0x44c8c7,_0xf6b7a9){return client[_0x4507('0xb')](_0x32401a,_0xfae19a)['then'](function(_0xd4e669){logger[_0x4507('0xc')](_0x4507('0xd'),_0x510dbc,_0x4507('0xe'));logger['debug'](_0x4507('0xf'),_0x510dbc,_0x4507('0xe'),JSON[_0x4507('0x10')](_0xd4e669));if(_0xd4e669['error']){if(_0xd4e669[_0x4507('0x11')][_0x4507('0x12')]===0x1f4){logger['error']('DeskConfiguration,\x20%s,\x20%s',_0x510dbc,_0xd4e669[_0x4507('0x11')]['message']);return _0xf6b7a9(_0xd4e669[_0x4507('0x11')]['message']);}logger['error'](_0x4507('0xd'),_0x510dbc,_0xd4e669[_0x4507('0x11')][_0x4507('0x13')]);return _0x44c8c7(_0xd4e669[_0x4507('0x11')]['message']);}else{logger['info'](_0x4507('0xd'),_0x510dbc,'request\x20sent');_0x44c8c7(_0xd4e669[_0x4507('0x14')][_0x4507('0x13')]);}})['catch'](function(_0x28d580){logger['error'](_0x4507('0xd'),_0x510dbc,_0x28d580);_0xf6b7a9(_0x28d580);});});} \ No newline at end of file +var _0x2f68=['code','message','request\x20sent','result','catch','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','then','info','DeskConfiguration,\x20%s,\x20%s','debug','stringify','error'];(function(_0x122481,_0x4ab9ec){var _0x8f8026=function(_0x146f26){while(--_0x146f26){_0x122481['push'](_0x122481['shift']());}};_0x8f8026(++_0x4ab9ec);}(_0x2f68,0x12b));var _0x82f6=function(_0x188d8e,_0x8d8e82){_0x188d8e=_0x188d8e-0x0;var _0x5083a8=_0x2f68[_0x188d8e];return _0x5083a8;};'use strict';var _=require('lodash');var util=require(_0x82f6('0x0'));var moment=require(_0x82f6('0x1'));var BPromise=require(_0x82f6('0x2'));var rs=require(_0x82f6('0x3'));var fs=require('fs');var Redis=require(_0x82f6('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x82f6('0x5'));var logger=require(_0x82f6('0x6'))(_0x82f6('0x7'));var config=require(_0x82f6('0x8'));var jayson=require(_0x82f6('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x9ad1f,_0x4fa10f,_0x282bc8){return new BPromise(function(_0x3fd6ef,_0x159ea8){return client['request'](_0x9ad1f,_0x282bc8)[_0x82f6('0xa')](function(_0x415226){logger[_0x82f6('0xb')](_0x82f6('0xc'),_0x4fa10f,'request\x20sent');logger[_0x82f6('0xd')]('DeskConfiguration,\x20%s,\x20%s,\x20%s',_0x4fa10f,'request\x20sent',JSON[_0x82f6('0xe')](_0x415226));if(_0x415226['error']){if(_0x415226[_0x82f6('0xf')][_0x82f6('0x10')]===0x1f4){logger['error'](_0x82f6('0xc'),_0x4fa10f,_0x415226['error'][_0x82f6('0x11')]);return _0x159ea8(_0x415226['error']['message']);}logger[_0x82f6('0xf')](_0x82f6('0xc'),_0x4fa10f,_0x415226[_0x82f6('0xf')][_0x82f6('0x11')]);return _0x3fd6ef(_0x415226[_0x82f6('0xf')][_0x82f6('0x11')]);}else{logger[_0x82f6('0xb')](_0x82f6('0xc'),_0x4fa10f,_0x82f6('0x12'));_0x3fd6ef(_0x415226[_0x82f6('0x13')][_0x82f6('0x11')]);}})[_0x82f6('0x14')](function(_0x412d1f){logger[_0x82f6('0xf')](_0x82f6('0xc'),_0x4fa10f,_0x412d1f);_0x159ea8(_0x412d1f);});});} \ No newline at end of file diff --git a/server/api/intDeskField/index.js b/server/api/intDeskField/index.js index 613a2c8..70c4296 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 _0x4bec=['put','/:id','update','destroy','multer','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intDeskField.controller','index','get','isAuthenticated','show','post'];(function(_0x323178,_0x355c8e){var _0x295238=function(_0x4e2d24){while(--_0x4e2d24){_0x323178['push'](_0x323178['shift']());}};_0x295238(++_0x355c8e);}(_0x4bec,0xdc));var _0xc4be=function(_0x1124ba,_0x907024){_0x1124ba=_0x1124ba-0x0;var _0x41dc3a=_0x4bec[_0x1124ba];return _0x41dc3a;};'use strict';var multer=require(_0xc4be('0x0'));var util=require(_0xc4be('0x1'));var path=require('path');var timeout=require(_0xc4be('0x2'));var express=require(_0xc4be('0x3'));var router=express[_0xc4be('0x4')]();var fs_extra=require(_0xc4be('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xc4be('0x6'));var config=require(_0xc4be('0x7'));var controller=require(_0xc4be('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0xc4be('0x9')]);router[_0xc4be('0xa')]('/:id',auth[_0xc4be('0xb')](),controller[_0xc4be('0xc')]);router[_0xc4be('0xd')]('/',auth[_0xc4be('0xb')](),controller['create']);router[_0xc4be('0xe')](_0xc4be('0xf'),auth[_0xc4be('0xb')](),controller[_0xc4be('0x10')]);router['delete'](_0xc4be('0xf'),auth[_0xc4be('0xb')](),controller[_0xc4be('0x11')]);module['exports']=router; \ No newline at end of file +var _0x4f7a=['create','/:id','update','delete','destroy','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./intDeskField.controller','isAuthenticated','index','show','post'];(function(_0x277af0,_0x1f0361){var _0x43bd7c=function(_0x3ad480){while(--_0x3ad480){_0x277af0['push'](_0x277af0['shift']());}};_0x43bd7c(++_0x1f0361);}(_0x4f7a,0x105));var _0xa4f7=function(_0x10f66e,_0x64907e){_0x10f66e=_0x10f66e-0x0;var _0x5693ce=_0x4f7a[_0x10f66e];return _0x5693ce;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xa4f7('0x0'));var timeout=require(_0xa4f7('0x1'));var express=require(_0xa4f7('0x2'));var router=express['Router']();var fs_extra=require(_0xa4f7('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xa4f7('0x4'));var config=require(_0xa4f7('0x5'));var controller=require(_0xa4f7('0x6'));router['get']('/',auth[_0xa4f7('0x7')](),controller[_0xa4f7('0x8')]);router['get']('/:id',auth[_0xa4f7('0x7')](),controller[_0xa4f7('0x9')]);router[_0xa4f7('0xa')]('/',auth[_0xa4f7('0x7')](),controller[_0xa4f7('0xb')]);router['put'](_0xa4f7('0xc'),auth[_0xa4f7('0x7')](),controller[_0xa4f7('0xd')]);router[_0xa4f7('0xe')](_0xa4f7('0xc'),auth[_0xa4f7('0x7')](),controller[_0xa4f7('0xf')]);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 f5f82a0..45c7896 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 _0xd833=['variable','customVariable','keyValue','picklist','STRING','ENUM','sequelize','string'];(function(_0x22a080,_0x202bb7){var _0x18625c=function(_0x2bd535){while(--_0x2bd535){_0x22a080['push'](_0x22a080['shift']());}};_0x18625c(++_0x202bb7);}(_0xd833,0x166));var _0x3d83=function(_0x1d654f,_0x9cf763){_0x1d654f=_0x1d654f-0x0;var _0x5416d5=_0xd833[_0x1d654f];return _0x5416d5;};'use strict';var Sequelize=require(_0x3d83('0x0'));module['exports']={'type':{'type':Sequelize['ENUM'](_0x3d83('0x1'),_0x3d83('0x2'),_0x3d83('0x3'),_0x3d83('0x4'),_0x3d83('0x5')),'defaultValue':_0x3d83('0x1')},'content':{'type':Sequelize[_0x3d83('0x6')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x3d83('0x7')]('string',_0x3d83('0x2'),_0x3d83('0x3'))},'keyContent':{'type':Sequelize[_0x3d83('0x6')]},'idField':{'type':Sequelize[_0x3d83('0x6')]},'nameField':{'type':Sequelize[_0x3d83('0x6')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x3d83('0x6')]}}; \ No newline at end of file +var _0x1f62=['string','variable','customVariable','BOOLEAN','sequelize','exports','ENUM','keyValue','picklist','STRING'];(function(_0xb729d2,_0x131a0e){var _0x181500=function(_0x38cdec){while(--_0x38cdec){_0xb729d2['push'](_0xb729d2['shift']());}};_0x181500(++_0x131a0e);}(_0x1f62,0x1ee));var _0x21f6=function(_0x30fe8c,_0x272cb9){_0x30fe8c=_0x30fe8c-0x0;var _0x4f1068=_0x1f62[_0x30fe8c];return _0x4f1068;};'use strict';var Sequelize=require(_0x21f6('0x0'));module[_0x21f6('0x1')]={'type':{'type':Sequelize[_0x21f6('0x2')]('string','variable','customVariable',_0x21f6('0x3'),_0x21f6('0x4')),'defaultValue':'string'},'content':{'type':Sequelize[_0x21f6('0x5')]},'key':{'type':Sequelize[_0x21f6('0x5')]},'keyType':{'type':Sequelize['ENUM'](_0x21f6('0x6'),_0x21f6('0x7'),_0x21f6('0x8'))},'keyContent':{'type':Sequelize[_0x21f6('0x5')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x21f6('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x21f6('0x5')]}}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.controller.js b/server/api/intDeskField/intDeskField.controller.js index 6f2f078..fd78fe7 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 _0xe928=['count','set','reject','save','destroy','then','end','name','send','map','DeskField','fieldName','key','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','params','rawAttributes','find','catch','create','body','update','eml-format','rimraf','zip-dir','request-promise','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','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','limit'];(function(_0x4243a3,_0x447337){var _0x1b2a33=function(_0x6a8200){while(--_0x6a8200){_0x4243a3['push'](_0x4243a3['shift']());}};_0x1b2a33(++_0x447337);}(_0xe928,0x145));var _0x8e92=function(_0x205cec,_0x2e133a){_0x205cec=_0x205cec-0x0;var _0x82be7a=_0xe928[_0x205cec];return _0x82be7a;};'use strict';var emlformat=require(_0x8e92('0x0'));var rimraf=require(_0x8e92('0x1'));var zipdir=require(_0x8e92('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8e92('0x3'));var moment=require('moment');var BPromise=require(_0x8e92('0x4'));var Mustache=require(_0x8e92('0x5'));var util=require(_0x8e92('0x6'));var path=require(_0x8e92('0x7'));var sox=require('sox');var csv=require(_0x8e92('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8e92('0x9'));var _=require(_0x8e92('0xa'));var squel=require(_0x8e92('0xb'));var crypto=require(_0x8e92('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x8e92('0xd'));var toCsv=require('to-csv');var querystring=require(_0x8e92('0xe'));var Papa=require(_0x8e92('0xf'));var Redis=require(_0x8e92('0x10'));var authService=require(_0x8e92('0x11'));var qs=require(_0x8e92('0x12'));var as=require(_0x8e92('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8e92('0x14'))(_0x8e92('0x15'));var utils=require(_0x8e92('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x8e92('0x17'));var db=require(_0x8e92('0x18'))['db'];function respondWithStatusCode(_0x3cbe0a,_0x3b19fa){_0x3b19fa=_0x3b19fa||0xcc;return function(_0x324f3f){if(_0x324f3f){return _0x3cbe0a[_0x8e92('0x19')](_0x3b19fa);}return _0x3cbe0a[_0x8e92('0x1a')](_0x3b19fa)['end']();};}function respondWithResult(_0x97be72,_0x5c06fd){_0x5c06fd=_0x5c06fd||0xc8;return function(_0x1cf5ee){if(_0x1cf5ee){return _0x97be72[_0x8e92('0x1a')](_0x5c06fd)['json'](_0x1cf5ee);}};}function respondWithFilteredResult(_0x101ea1,_0x57ff38){return function(_0x1d866f){if(_0x1d866f){var _0x26cce1=typeof _0x57ff38[_0x8e92('0x1b')]===_0x8e92('0x1c')&&typeof _0x57ff38[_0x8e92('0x1d')]===_0x8e92('0x1c');var _0x182e05=_0x1d866f[_0x8e92('0x1e')];var _0x55f325=_0x26cce1?0x0:_0x57ff38[_0x8e92('0x1b')];var _0x192b0b=_0x26cce1?_0x1d866f[_0x8e92('0x1e')]:_0x57ff38[_0x8e92('0x1b')]+_0x57ff38[_0x8e92('0x1d')];var _0x5ab67b;if(_0x192b0b>=_0x182e05){_0x192b0b=_0x182e05;_0x5ab67b=0xc8;}else{_0x5ab67b=0xce;}_0x101ea1[_0x8e92('0x1a')](_0x5ab67b);return _0x101ea1[_0x8e92('0x1f')]('Content-Range',_0x55f325+'-'+_0x192b0b+'/'+_0x182e05)['json'](_0x1d866f);}return null;};}function patchUpdates(_0x558694){return function(_0x334628){try{jsonpatch['apply'](_0x334628,_0x558694,!![]);}catch(_0x3d23f1){return BPromise[_0x8e92('0x20')](_0x3d23f1);}return _0x334628[_0x8e92('0x21')]();};}function saveUpdates(_0x3147ef,_0x368253){return function(_0x70f846){if(_0x70f846){return _0x70f846['update'](_0x3147ef)['then'](function(_0x53b5aa){return _0x53b5aa;});}return null;};}function removeEntity(_0x5b5ea2,_0x322765){return function(_0x3a86e4){if(_0x3a86e4){return _0x3a86e4[_0x8e92('0x22')]()[_0x8e92('0x23')](function(){_0x5b5ea2[_0x8e92('0x1a')](0xcc)[_0x8e92('0x24')]();});}};}function handleEntityNotFound(_0x585adb,_0x1b0e14){return function(_0x22cdbe){if(!_0x22cdbe){_0x585adb[_0x8e92('0x19')](0x194);}return _0x22cdbe;};}function handleError(_0x127fff,_0x40b576){_0x40b576=_0x40b576||0x1f4;return function(_0x2aaf1d){logger['error'](_0x2aaf1d['stack']);if(_0x2aaf1d['name']){delete _0x2aaf1d[_0x8e92('0x25')];}_0x127fff['status'](_0x40b576)[_0x8e92('0x26')](_0x2aaf1d);};}exports['index']=function(_0x3bfb1e,_0x492c89){var _0x208384={},_0x57c4de={},_0xc7e9c0={'count':0x0,'rows':[]};var _0x3c8897=_[_0x8e92('0x27')](db[_0x8e92('0x28')]['rawAttributes'],function(_0x456d0b){return{'name':_0x456d0b[_0x8e92('0x29')],'type':_0x456d0b['type'][_0x8e92('0x2a')]};});_0x57c4de['model']=_[_0x8e92('0x27')](_0x3c8897,_0x8e92('0x25'));_0x57c4de['query']=_[_0x8e92('0x2b')](_0x3bfb1e[_0x8e92('0x2c')]);_0x57c4de[_0x8e92('0x2d')]=_[_0x8e92('0x2e')](_0x57c4de[_0x8e92('0x2f')],_0x57c4de[_0x8e92('0x2c')]);_0x208384[_0x8e92('0x30')]=_[_0x8e92('0x2e')](_0x57c4de[_0x8e92('0x2f')],qs['fields'](_0x3bfb1e['query'][_0x8e92('0x31')]));_0x208384['attributes']=_0x208384['attributes'][_0x8e92('0x32')]?_0x208384[_0x8e92('0x30')]:_0x57c4de[_0x8e92('0x2f')];if(!_0x3bfb1e['query'][_0x8e92('0x33')](_0x8e92('0x34'))){_0x208384[_0x8e92('0x1d')]=qs['limit'](_0x3bfb1e['query'][_0x8e92('0x1d')]);_0x208384['offset']=qs[_0x8e92('0x1b')](_0x3bfb1e[_0x8e92('0x2c')][_0x8e92('0x1b')]);}_0x208384[_0x8e92('0x35')]=qs[_0x8e92('0x36')](_0x3bfb1e['query'][_0x8e92('0x36')]);_0x208384[_0x8e92('0x37')]=qs[_0x8e92('0x2d')](_['pick'](_0x3bfb1e['query'],_0x57c4de[_0x8e92('0x2d')]),_0x3c8897);if(_0x3bfb1e['query'][_0x8e92('0x38')]){_0x208384[_0x8e92('0x37')]=_[_0x8e92('0x39')](_0x208384[_0x8e92('0x37')],{'$or':_['map'](_0x3c8897,function(_0x4b74c4){if(_0x4b74c4['type']!==_0x8e92('0x3a')){var _0x5c5f5d={};_0x5c5f5d[_0x4b74c4[_0x8e92('0x25')]]={'$like':'%'+_0x3bfb1e['query']['filter']+'%'};return _0x5c5f5d;}})});}_0x208384=_['merge']({},_0x208384,_0x3bfb1e[_0x8e92('0x3b')]);var _0x3c3d83={'where':_0x208384[_0x8e92('0x37')]};return db[_0x8e92('0x28')][_0x8e92('0x1e')](_0x3c3d83)[_0x8e92('0x23')](function(_0x5e0f6f){_0xc7e9c0[_0x8e92('0x1e')]=_0x5e0f6f;if(_0x3bfb1e[_0x8e92('0x2c')][_0x8e92('0x3c')]){_0x208384[_0x8e92('0x3d')]=[{'all':!![]}];}return db['DeskField'][_0x8e92('0x3e')](_0x208384);})[_0x8e92('0x23')](function(_0x5c4a29){_0xc7e9c0[_0x8e92('0x3f')]=_0x5c4a29;return _0xc7e9c0;})[_0x8e92('0x23')](respondWithFilteredResult(_0x492c89,_0x208384))['catch'](handleError(_0x492c89,null));};exports['show']=function(_0x105114,_0x4fd1e2){var _0x543e7f={'raw':!![],'where':{'id':_0x105114[_0x8e92('0x40')]['id']}},_0x4e9683={};_0x4e9683[_0x8e92('0x2f')]=_['keys'](db[_0x8e92('0x28')][_0x8e92('0x41')]);_0x4e9683[_0x8e92('0x2c')]=_[_0x8e92('0x2b')](_0x105114['query']);_0x4e9683[_0x8e92('0x2d')]=_['intersection'](_0x4e9683[_0x8e92('0x2f')],_0x4e9683[_0x8e92('0x2c')]);_0x543e7f['attributes']=_[_0x8e92('0x2e')](_0x4e9683[_0x8e92('0x2f')],qs[_0x8e92('0x31')](_0x105114[_0x8e92('0x2c')][_0x8e92('0x31')]));_0x543e7f[_0x8e92('0x30')]=_0x543e7f[_0x8e92('0x30')][_0x8e92('0x32')]?_0x543e7f[_0x8e92('0x30')]:_0x4e9683[_0x8e92('0x2f')];if(_0x105114[_0x8e92('0x2c')][_0x8e92('0x3c')]){_0x543e7f['include']=[{'all':!![]}];}_0x543e7f=_[_0x8e92('0x39')]({},_0x543e7f,_0x105114[_0x8e92('0x3b')]);return db[_0x8e92('0x28')][_0x8e92('0x42')](_0x543e7f)['then'](handleEntityNotFound(_0x4fd1e2,null))[_0x8e92('0x23')](respondWithResult(_0x4fd1e2,null))[_0x8e92('0x43')](handleError(_0x4fd1e2,null));};exports[_0x8e92('0x44')]=function(_0x508c6e,_0x33e097){return db[_0x8e92('0x28')][_0x8e92('0x44')](_0x508c6e[_0x8e92('0x45')],{})[_0x8e92('0x23')](respondWithResult(_0x33e097,0xc9))[_0x8e92('0x43')](handleError(_0x33e097,null));};exports[_0x8e92('0x46')]=function(_0x399047,_0x113a6a){if(_0x399047[_0x8e92('0x45')]['id']){delete _0x399047[_0x8e92('0x45')]['id'];}return db[_0x8e92('0x28')]['find']({'where':{'id':_0x399047[_0x8e92('0x40')]['id']}})[_0x8e92('0x23')](handleEntityNotFound(_0x113a6a,null))[_0x8e92('0x23')](saveUpdates(_0x399047[_0x8e92('0x45')],null))[_0x8e92('0x23')](respondWithResult(_0x113a6a,null))[_0x8e92('0x43')](handleError(_0x113a6a,null));};exports['destroy']=function(_0x2baafa,_0x3d6991){return db[_0x8e92('0x28')][_0x8e92('0x42')]({'where':{'id':_0x2baafa[_0x8e92('0x40')]['id']}})[_0x8e92('0x23')](handleEntityNotFound(_0x3d6991,null))[_0x8e92('0x23')](removeEntity(_0x3d6991,null))[_0x8e92('0x43')](handleError(_0x3d6991,null));}; \ No newline at end of file +var _0x9206=['util','path','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','error','stack','name','send','index','DeskField','fieldName','key','model','map','keys','intersection','query','attributes','fields','hasOwnProperty','nolimit','sort','where','filters','filter','merge','type','VIRTUAL','options','findAll','catch','show','params','length','includeAll','include','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment'];(function(_0x511bd1,_0x223e5b){var _0x4c48ec=function(_0x31814e){while(--_0x31814e){_0x511bd1['push'](_0x511bd1['shift']());}};_0x4c48ec(++_0x223e5b);}(_0x9206,0x176));var _0x6920=function(_0x1343fb,_0x162991){_0x1343fb=_0x1343fb-0x0;var _0xf6d216=_0x9206[_0x1343fb];return _0xf6d216;};'use strict';var emlformat=require(_0x6920('0x0'));var rimraf=require(_0x6920('0x1'));var zipdir=require(_0x6920('0x2'));var jsonpatch=require(_0x6920('0x3'));var rp=require(_0x6920('0x4'));var moment=require(_0x6920('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x6920('0x6'));var path=require(_0x6920('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x6920('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x6920('0x9'));var squel=require(_0x6920('0xa'));var crypto=require(_0x6920('0xb'));var jsforce=require(_0x6920('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x6920('0xd'));var Papa=require(_0x6920('0xe'));var Redis=require(_0x6920('0xf'));var authService=require(_0x6920('0x10'));var qs=require(_0x6920('0x11'));var as=require(_0x6920('0x12'));var hardwareService=require(_0x6920('0x13'));var logger=require(_0x6920('0x14'))(_0x6920('0x15'));var utils=require(_0x6920('0x16'));var config=require(_0x6920('0x17'));var licenseUtil=require(_0x6920('0x18'));var db=require(_0x6920('0x19'))['db'];function respondWithStatusCode(_0x5ad438,_0x4f8430){_0x4f8430=_0x4f8430||0xcc;return function(_0x31730c){if(_0x31730c){return _0x5ad438[_0x6920('0x1a')](_0x4f8430);}return _0x5ad438['status'](_0x4f8430)[_0x6920('0x1b')]();};}function respondWithResult(_0xfa2823,_0x18140a){_0x18140a=_0x18140a||0xc8;return function(_0x2c3a35){if(_0x2c3a35){return _0xfa2823[_0x6920('0x1c')](_0x18140a)['json'](_0x2c3a35);}};}function respondWithFilteredResult(_0x338e5f,_0x20cdfb){return function(_0x15d8af){if(_0x15d8af){var _0xa64034=typeof _0x20cdfb[_0x6920('0x1d')]===_0x6920('0x1e')&&typeof _0x20cdfb[_0x6920('0x1f')]===_0x6920('0x1e');var _0x11ce91=_0x15d8af[_0x6920('0x20')];var _0x462500=_0xa64034?0x0:_0x20cdfb[_0x6920('0x1d')];var _0xc6e86b=_0xa64034?_0x15d8af[_0x6920('0x20')]:_0x20cdfb[_0x6920('0x1d')]+_0x20cdfb['limit'];var _0x3a0c0c;if(_0xc6e86b>=_0x11ce91){_0xc6e86b=_0x11ce91;_0x3a0c0c=0xc8;}else{_0x3a0c0c=0xce;}_0x338e5f[_0x6920('0x1c')](_0x3a0c0c);return _0x338e5f[_0x6920('0x21')](_0x6920('0x22'),_0x462500+'-'+_0xc6e86b+'/'+_0x11ce91)[_0x6920('0x23')](_0x15d8af);}return null;};}function patchUpdates(_0x16cb96){return function(_0x2cce0b){try{jsonpatch[_0x6920('0x24')](_0x2cce0b,_0x16cb96,!![]);}catch(_0xaf93ba){return BPromise[_0x6920('0x25')](_0xaf93ba);}return _0x2cce0b[_0x6920('0x26')]();};}function saveUpdates(_0x39013e,_0x1df372){return function(_0x2dd788){if(_0x2dd788){return _0x2dd788[_0x6920('0x27')](_0x39013e)[_0x6920('0x28')](function(_0x1ae686){return _0x1ae686;});}return null;};}function removeEntity(_0x3a6e48,_0xa8f55){return function(_0x258986){if(_0x258986){return _0x258986['destroy']()[_0x6920('0x28')](function(){_0x3a6e48['status'](0xcc)[_0x6920('0x1b')]();});}};}function handleEntityNotFound(_0x4dd08b,_0x72316a){return function(_0x32a6ae){if(!_0x32a6ae){_0x4dd08b[_0x6920('0x1a')](0x194);}return _0x32a6ae;};}function handleError(_0xd069c,_0x5868e1){_0x5868e1=_0x5868e1||0x1f4;return function(_0x1cab00){logger[_0x6920('0x29')](_0x1cab00[_0x6920('0x2a')]);if(_0x1cab00[_0x6920('0x2b')]){delete _0x1cab00[_0x6920('0x2b')];}_0xd069c[_0x6920('0x1c')](_0x5868e1)[_0x6920('0x2c')](_0x1cab00);};}exports[_0x6920('0x2d')]=function(_0x400894,_0x2f5ce8){var _0x6860c7={},_0x2b2cd9={},_0x548fbc={'count':0x0,'rows':[]};var _0x182f1b=_['map'](db[_0x6920('0x2e')]['rawAttributes'],function(_0x31aa90){return{'name':_0x31aa90[_0x6920('0x2f')],'type':_0x31aa90['type'][_0x6920('0x30')]};});_0x2b2cd9[_0x6920('0x31')]=_[_0x6920('0x32')](_0x182f1b,'name');_0x2b2cd9['query']=_[_0x6920('0x33')](_0x400894['query']);_0x2b2cd9['filters']=_[_0x6920('0x34')](_0x2b2cd9[_0x6920('0x31')],_0x2b2cd9[_0x6920('0x35')]);_0x6860c7[_0x6920('0x36')]=_[_0x6920('0x34')](_0x2b2cd9[_0x6920('0x31')],qs[_0x6920('0x37')](_0x400894['query'][_0x6920('0x37')]));_0x6860c7['attributes']=_0x6860c7[_0x6920('0x36')]['length']?_0x6860c7['attributes']:_0x2b2cd9[_0x6920('0x31')];if(!_0x400894[_0x6920('0x35')][_0x6920('0x38')](_0x6920('0x39'))){_0x6860c7[_0x6920('0x1f')]=qs[_0x6920('0x1f')](_0x400894[_0x6920('0x35')][_0x6920('0x1f')]);_0x6860c7[_0x6920('0x1d')]=qs[_0x6920('0x1d')](_0x400894[_0x6920('0x35')][_0x6920('0x1d')]);}_0x6860c7['order']=qs[_0x6920('0x3a')](_0x400894['query'][_0x6920('0x3a')]);_0x6860c7[_0x6920('0x3b')]=qs[_0x6920('0x3c')](_['pick'](_0x400894[_0x6920('0x35')],_0x2b2cd9[_0x6920('0x3c')]),_0x182f1b);if(_0x400894[_0x6920('0x35')][_0x6920('0x3d')]){_0x6860c7['where']=_[_0x6920('0x3e')](_0x6860c7[_0x6920('0x3b')],{'$or':_['map'](_0x182f1b,function(_0x49be52){if(_0x49be52[_0x6920('0x3f')]!==_0x6920('0x40')){var _0x56ca8f={};_0x56ca8f[_0x49be52[_0x6920('0x2b')]]={'$like':'%'+_0x400894[_0x6920('0x35')]['filter']+'%'};return _0x56ca8f;}})});}_0x6860c7=_['merge']({},_0x6860c7,_0x400894[_0x6920('0x41')]);var _0x1f0c5f={'where':_0x6860c7[_0x6920('0x3b')]};return db[_0x6920('0x2e')][_0x6920('0x20')](_0x1f0c5f)['then'](function(_0x58f0e8){_0x548fbc['count']=_0x58f0e8;if(_0x400894[_0x6920('0x35')]['includeAll']){_0x6860c7['include']=[{'all':!![]}];}return db[_0x6920('0x2e')][_0x6920('0x42')](_0x6860c7);})['then'](function(_0x3aad11){_0x548fbc['rows']=_0x3aad11;return _0x548fbc;})[_0x6920('0x28')](respondWithFilteredResult(_0x2f5ce8,_0x6860c7))[_0x6920('0x43')](handleError(_0x2f5ce8,null));};exports[_0x6920('0x44')]=function(_0x1b3ebb,_0x3a994d){var _0x55d7b5={'raw':!![],'where':{'id':_0x1b3ebb[_0x6920('0x45')]['id']}},_0x4dfa0c={};_0x4dfa0c['model']=_['keys'](db['DeskField']['rawAttributes']);_0x4dfa0c[_0x6920('0x35')]=_[_0x6920('0x33')](_0x1b3ebb[_0x6920('0x35')]);_0x4dfa0c['filters']=_[_0x6920('0x34')](_0x4dfa0c[_0x6920('0x31')],_0x4dfa0c[_0x6920('0x35')]);_0x55d7b5[_0x6920('0x36')]=_[_0x6920('0x34')](_0x4dfa0c[_0x6920('0x31')],qs['fields'](_0x1b3ebb[_0x6920('0x35')][_0x6920('0x37')]));_0x55d7b5[_0x6920('0x36')]=_0x55d7b5[_0x6920('0x36')][_0x6920('0x46')]?_0x55d7b5[_0x6920('0x36')]:_0x4dfa0c[_0x6920('0x31')];if(_0x1b3ebb[_0x6920('0x35')][_0x6920('0x47')]){_0x55d7b5[_0x6920('0x48')]=[{'all':!![]}];}_0x55d7b5=_[_0x6920('0x3e')]({},_0x55d7b5,_0x1b3ebb[_0x6920('0x41')]);return db['DeskField'][_0x6920('0x49')](_0x55d7b5)[_0x6920('0x28')](handleEntityNotFound(_0x3a994d,null))['then'](respondWithResult(_0x3a994d,null))['catch'](handleError(_0x3a994d,null));};exports[_0x6920('0x4a')]=function(_0x3c231e,_0x20fab4){return db[_0x6920('0x2e')][_0x6920('0x4a')](_0x3c231e['body'],{})[_0x6920('0x28')](respondWithResult(_0x20fab4,0xc9))[_0x6920('0x43')](handleError(_0x20fab4,null));};exports[_0x6920('0x27')]=function(_0x51b12d,_0x4d1c79){if(_0x51b12d[_0x6920('0x4b')]['id']){delete _0x51b12d[_0x6920('0x4b')]['id'];}return db[_0x6920('0x2e')][_0x6920('0x49')]({'where':{'id':_0x51b12d['params']['id']}})[_0x6920('0x28')](handleEntityNotFound(_0x4d1c79,null))[_0x6920('0x28')](saveUpdates(_0x51b12d[_0x6920('0x4b')],null))[_0x6920('0x28')](respondWithResult(_0x4d1c79,null))[_0x6920('0x43')](handleError(_0x4d1c79,null));};exports['destroy']=function(_0x1c0dd9,_0x3fe81d){return db[_0x6920('0x2e')][_0x6920('0x49')]({'where':{'id':_0x1c0dd9[_0x6920('0x45')]['id']}})[_0x6920('0x28')](handleEntityNotFound(_0x3fe81d,null))[_0x6920('0x28')](removeEntity(_0x3fe81d,null))[_0x6920('0x43')](handleError(_0x3fe81d,null));}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.model.js b/server/api/intDeskField/intDeskField.model.js index d3c0889..57de8e0 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 _0xb1b9=['bluebird','request-promise','path','rimraf','../../config/environment','define','desk_unique_index','idField','util','../../config/logger','api','moment'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xb1b9,0x194));var _0x9b1b=function(_0x353ac0,_0x7996c2){_0x353ac0=_0x353ac0-0x0;var _0x31e280=_0xb1b9[_0x353ac0];return _0x31e280;};'use strict';var _=require('lodash');var util=require(_0x9b1b('0x0'));var logger=require(_0x9b1b('0x1'))(_0x9b1b('0x2'));var moment=require(_0x9b1b('0x3'));var BPromise=require(_0x9b1b('0x4'));var rp=require(_0x9b1b('0x5'));var fs=require('fs');var path=require(_0x9b1b('0x6'));var rimraf=require(_0x9b1b('0x7'));var config=require(_0x9b1b('0x8'));var attributes=require('./intDeskField.attributes');module['exports']=function(_0xdd0e5c,_0xd6319){return _0xdd0e5c[_0x9b1b('0x9')]('DeskField',attributes,{'tableName':'int_desk_fields','paranoid':![],'indexes':[{'name':_0x9b1b('0xa'),'fields':[_0x9b1b('0xb'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xb1b0=['idField','FieldId','lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intDeskField.attributes','define','DeskField','int_desk_fields','desk_unique_index'];(function(_0x385eee,_0x270cca){var _0x41fd49=function(_0x6bb501){while(--_0x6bb501){_0x385eee['push'](_0x385eee['shift']());}};_0x41fd49(++_0x270cca);}(_0xb1b0,0xa7));var _0x0b1b=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xb1b0[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x0b1b('0x0'));var util=require('util');var logger=require(_0x0b1b('0x1'))('api');var moment=require(_0x0b1b('0x2'));var BPromise=require(_0x0b1b('0x3'));var rp=require(_0x0b1b('0x4'));var fs=require('fs');var path=require(_0x0b1b('0x5'));var rimraf=require(_0x0b1b('0x6'));var config=require(_0x0b1b('0x7'));var attributes=require(_0x0b1b('0x8'));module['exports']=function(_0x5515c0,_0xd590c2){return _0x5515c0[_0x0b1b('0x9')](_0x0b1b('0xa'),attributes,{'tableName':_0x0b1b('0xb'),'paranoid':![],'indexes':[{'name':_0x0b1b('0xc'),'fields':[_0x0b1b('0xd'),_0x0b1b('0xe')],'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 822d2b0..20c3d17 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 _0x367c=['info','DeskField,\x20%s,\x20%s,\x20%s','error','code','DeskField,\x20%s,\x20%s','message','request\x20sent','result','catch','lodash','moment','ioredis','../../config/utils','../../config/logger','../../config/environment','client','http','then'];(function(_0x4ef44e,_0xbbaee1){var _0x237812=function(_0x40f806){while(--_0x40f806){_0x4ef44e['push'](_0x4ef44e['shift']());}};_0x237812(++_0xbbaee1);}(_0x367c,0x87));var _0xc367=function(_0x178668,_0x1ec300){_0x178668=_0x178668-0x0;var _0x26107d=_0x367c[_0x178668];return _0x26107d;};'use strict';var _=require(_0xc367('0x0'));var util=require('util');var moment=require(_0xc367('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc367('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xc367('0x3'));var logger=require(_0xc367('0x4'))('rpc');var config=require(_0xc367('0x5'));var jayson=require('jayson/promise');var client=jayson[_0xc367('0x6')][_0xc367('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x30859b,_0x294311,_0x46009a){return new BPromise(function(_0x7cf40d,_0x2dfa1a){return client['request'](_0x30859b,_0x46009a)[_0xc367('0x8')](function(_0x2b18c8){logger[_0xc367('0x9')]('DeskField,\x20%s,\x20%s',_0x294311,'request\x20sent');logger['debug'](_0xc367('0xa'),_0x294311,'request\x20sent',JSON['stringify'](_0x2b18c8));if(_0x2b18c8[_0xc367('0xb')]){if(_0x2b18c8[_0xc367('0xb')][_0xc367('0xc')]===0x1f4){logger['error'](_0xc367('0xd'),_0x294311,_0x2b18c8[_0xc367('0xb')][_0xc367('0xe')]);return _0x2dfa1a(_0x2b18c8['error']['message']);}logger[_0xc367('0xb')](_0xc367('0xd'),_0x294311,_0x2b18c8['error']['message']);return _0x7cf40d(_0x2b18c8[_0xc367('0xb')][_0xc367('0xe')]);}else{logger['info'](_0xc367('0xd'),_0x294311,_0xc367('0xf'));_0x7cf40d(_0x2b18c8[_0xc367('0x10')][_0xc367('0xe')]);}})[_0xc367('0x11')](function(_0x47b1c4){logger[_0xc367('0xb')](_0xc367('0xd'),_0x294311,_0x47b1c4);_0x2dfa1a(_0x47b1c4);});});} \ No newline at end of file +var _0x291c=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','DeskField,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message','result','lodash','util','moment','bluebird','ioredis','../../config/utils'];(function(_0x45c0da,_0x4f9492){var _0x51efff=function(_0x53b3b2){while(--_0x53b3b2){_0x45c0da['push'](_0x45c0da['shift']());}};_0x51efff(++_0x4f9492);}(_0x291c,0x144));var _0xc291=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x291c[_0x2c91e9];return _0x13f0ff;};'use strict';var _=require(_0xc291('0x0'));var util=require(_0xc291('0x1'));var moment=require(_0xc291('0x2'));var BPromise=require(_0xc291('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc291('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xc291('0x5'));var logger=require(_0xc291('0x6'))(_0xc291('0x7'));var config=require(_0xc291('0x8'));var jayson=require(_0xc291('0x9'));var client=jayson[_0xc291('0xa')][_0xc291('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x8bd2f2,_0x4c5e84,_0x542478){return new BPromise(function(_0x1682a4,_0x4b9314){return client[_0xc291('0xc')](_0x8bd2f2,_0x542478)[_0xc291('0xd')](function(_0x368b6c){logger[_0xc291('0xe')](_0xc291('0xf'),_0x4c5e84,'request\x20sent');logger[_0xc291('0x10')]('DeskField,\x20%s,\x20%s,\x20%s',_0x4c5e84,_0xc291('0x11'),JSON[_0xc291('0x12')](_0x368b6c));if(_0x368b6c[_0xc291('0x13')]){if(_0x368b6c['error']['code']===0x1f4){logger[_0xc291('0x13')]('DeskField,\x20%s,\x20%s',_0x4c5e84,_0x368b6c[_0xc291('0x13')][_0xc291('0x14')]);return _0x4b9314(_0x368b6c[_0xc291('0x13')]['message']);}logger[_0xc291('0x13')](_0xc291('0xf'),_0x4c5e84,_0x368b6c['error'][_0xc291('0x14')]);return _0x1682a4(_0x368b6c[_0xc291('0x13')][_0xc291('0x14')]);}else{logger[_0xc291('0xe')]('DeskField,\x20%s,\x20%s',_0x4c5e84,_0xc291('0x11'));_0x1682a4(_0x368b6c[_0xc291('0x15')][_0xc291('0x14')]);}})['catch'](function(_0x1e5947){logger[_0xc291('0x13')](_0xc291('0xf'),_0x4c5e84,_0x1e5947);_0x4b9314(_0x1e5947);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/index.js b/server/api/intDynamics365Account/index.js index aa29397..38d9fb8 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 _0x2043=['Router','../../components/interaction/service','../../config/environment','./intDynamics365Account.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','getFields','post','addConfiguration','put','update','multer','util','path','connect-timeout'];(function(_0x5e28c2,_0x1e48ab){var _0x1a8cc6=function(_0x1218bf){while(--_0x1218bf){_0x5e28c2['push'](_0x5e28c2['shift']());}};_0x1a8cc6(++_0x1e48ab);}(_0x2043,0x9c));var _0x3204=function(_0xc36ee6,_0x5717bf){_0xc36ee6=_0xc36ee6-0x0;var _0x464205=_0x2043[_0xc36ee6];return _0x464205;};'use strict';var multer=require(_0x3204('0x0'));var util=require(_0x3204('0x1'));var path=require(_0x3204('0x2'));var timeout=require(_0x3204('0x3'));var express=require('express');var router=express[_0x3204('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x3204('0x5'));var config=require(_0x3204('0x6'));var controller=require(_0x3204('0x7'));router[_0x3204('0x8')]('/',auth[_0x3204('0x9')](),controller[_0x3204('0xa')]);router['get'](_0x3204('0xb'),auth[_0x3204('0x9')](),controller[_0x3204('0xc')]);router[_0x3204('0x8')](_0x3204('0xd'),auth['isAuthenticated'](),controller[_0x3204('0xe')]);router[_0x3204('0x8')]('/:id/fields',auth[_0x3204('0x9')](),controller[_0x3204('0xf')]);router[_0x3204('0x10')]('/',auth[_0x3204('0x9')](),controller['create']);router[_0x3204('0x10')]('/:id/configurations',auth[_0x3204('0x9')](),controller[_0x3204('0x11')]);router[_0x3204('0x12')](_0x3204('0xb'),auth[_0x3204('0x9')](),controller[_0x3204('0x13')]);router['delete'](_0x3204('0xb'),auth[_0x3204('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x88cd=['addConfiguration','put','/:id','exports','util','express','Router','fs-extra','../../config/environment','./intDynamics365Account.controller','isAuthenticated','get','/:id/configurations','getConfigurations','post','create'];(function(_0x2f5d75,_0x297b02){var _0x10d62b=function(_0x1771e3){while(--_0x1771e3){_0x2f5d75['push'](_0x2f5d75['shift']());}};_0x10d62b(++_0x297b02);}(_0x88cd,0xd4));var _0xd88c=function(_0x536f07,_0x5cebb2){_0x536f07=_0x536f07-0x0;var _0x6ff79f=_0x88cd[_0x536f07];return _0x6ff79f;};'use strict';var multer=require('multer');var util=require(_0xd88c('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xd88c('0x1'));var router=express[_0xd88c('0x2')]();var fs_extra=require(_0xd88c('0x3'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xd88c('0x4'));var controller=require(_0xd88c('0x5'));router['get']('/',auth[_0xd88c('0x6')](),controller['index']);router[_0xd88c('0x7')]('/:id',auth[_0xd88c('0x6')](),controller['show']);router[_0xd88c('0x7')](_0xd88c('0x8'),auth[_0xd88c('0x6')](),controller[_0xd88c('0x9')]);router[_0xd88c('0x7')]('/:id/fields',auth['isAuthenticated'](),controller['getFields']);router[_0xd88c('0xa')]('/',auth[_0xd88c('0x6')](),controller[_0xd88c('0xb')]);router['post']('/:id/configurations',auth[_0xd88c('0x6')](),controller[_0xd88c('0xc')]);router[_0xd88c('0xd')](_0xd88c('0xe'),auth[_0xd88c('0x6')](),controller['update']);router['delete'](_0xd88c('0xe'),auth['isAuthenticated'](),controller['destroy']);module[_0xd88c('0xf')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.attributes.js b/server/api/intDynamics365Account/intDynamics365Account.attributes.js index a51ccb6..dd1b170 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 _0xa4f0=['exports','STRING','sequelize'];(function(_0x2da71d,_0x34f66b){var _0x16c334=function(_0x4fd1cf){while(--_0x4fd1cf){_0x2da71d['push'](_0x2da71d['shift']());}};_0x16c334(++_0x34f66b);}(_0xa4f0,0x104));var _0x0a4f=function(_0x5d98cd,_0x4c4477){_0x5d98cd=_0x5d98cd-0x0;var _0x3d88c2=_0xa4f0[_0x5d98cd];return _0x3d88c2;};'use strict';var Sequelize=require(_0x0a4f('0x0'));module[_0x0a4f('0x1')]={'name':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x0a4f('0x2')]},'password':{'type':Sequelize[_0x0a4f('0x2')]},'remoteUri':{'type':Sequelize[_0x0a4f('0x2')]},'tenantId':{'type':Sequelize[_0x0a4f('0x2')]},'clientId':{'type':Sequelize[_0x0a4f('0x2')]},'clientSecret':{'type':Sequelize[_0x0a4f('0x2')]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0x0a4f('0x2')]}}; \ No newline at end of file +var _0xf2b0=['exports','STRING','sequelize'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf2b0,0x155));var _0x0f2b=function(_0x3d7c68,_0x40a266){_0x3d7c68=_0x3d7c68-0x0;var _0x53e025=_0xf2b0[_0x3d7c68];return _0x53e025;};'use strict';var Sequelize=require(_0x0f2b('0x0'));module[_0x0f2b('0x1')]={'name':{'type':Sequelize[_0x0f2b('0x2')]},'username':{'type':Sequelize[_0x0f2b('0x2')]},'password':{'type':Sequelize[_0x0f2b('0x2')]},'remoteUri':{'type':Sequelize[_0x0f2b('0x2')]},'tenantId':{'type':Sequelize[_0x0f2b('0x2')]},'clientId':{'type':Sequelize[_0x0f2b('0x2')]},'clientSecret':{'type':Sequelize[_0x0f2b('0x2')]},'serverUrl':{'type':Sequelize[_0x0f2b('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x0f2b('0x2')]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.controller.js b/server/api/intDynamics365Account/intDynamics365Account.controller.js index fa2e48e..f98d17d 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 _0x98e1=['catch','show','params','fields','includeAll','find','create','body','destroy','getConfigurations','findOne','Dynamics365Configuration','AccountId','Subjects','getSubjects','channel','getDescriptions','Dynamics365Field','getFields','ticketType','Incident','PhoneCall','customerid','ownerid','caseorigincode','subject','phonenumber','regardingobjectid','directioncode','phonecall_activity_parties','accountidname','accountidyominame','actualserviceunits','billedserviceunits','contactidname','contactidyominame','contractdetailidname','contractidname','createdbyexternalpartyname','createdbyexternalpartyyominame','createdbyname','createdbyyominame','createdon','createdonbehalfbyyominame','customeridname','customeridtype','customeridyominame','emailaddress','entitlementidname','escalatedon','exchangerate','firstresponsebykpiidname','followupby','importsequencenumber','kbarticleidname','lastonholdtime','masteridname','modifiedbyexternalpartyyominame','modifiedbyname','modifiedbyyominame','modifiedon','modifiedonbehalfbyname','msdyn_incidenttypename','msdyn_iotalertname','numberofchildincidents','onholdtime','overriddencreatedon','owneridname','owneridtype','owneridyominame','primarycontactidname','primarycontactidyominame','prioritycodename','productidname','productserialnumber','resolveby','resolvebykpiidname','responseby','responsiblecontactidname','responsiblecontactidyominame','sentimentvalue','slainvokedidname','slaname','socialprofileidname','statecode','timezoneruleversionnumber','transactioncurrencyidname','traversedpath','utcconversiontimezonecode','versionnumber','username','password','tenantId','clientId','clientSecret','remoteUri','slice','substring','lastIndexOf','format','%s/api/data/v9.0/','https://login.microsoftonline.com/','/oauth2/token','access_token','GET','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','Bearer\x20','4.0','value','MetadataId','Attributes','remove','includes','LogicalName','@odata.type','PicklistAttributeMetadata','isNil','push','forEach','StringAttributeMetadata','BigIntAttributeMetadata','MemoAttributeMetadata','StatusAttributeMetadata','EntityNameAttributeMetadata','DecimalAttributeMetadata','concat','test','statusCode','error','Wrong\x20credentials','EntityDefinitions(',')/Attributes(','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','Options','Label','UserLocalizedLabel','Value','DisplayName',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','OptionSet','TrueOption','FalseOption','false','?$select=DisplayName,LogicalName','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','path','sox','to-csv','ejs','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','end','status','json','limit','count','offset','Content-Range','apply','reject','save','update','then','sendStatus','stack','name','send','index','map','Dynamics365Account','rawAttributes','fieldName','key','model','keys','query','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','type','VIRTUAL','merge','include','findAll','rows'];(function(_0x2cbd7b,_0x480583){var _0x22113c=function(_0x440522){while(--_0x440522){_0x2cbd7b['push'](_0x2cbd7b['shift']());}};_0x22113c(++_0x480583);}(_0x98e1,0x160));var _0x198e=function(_0x3173ff,_0x8aed7){_0x3173ff=_0x3173ff-0x0;var _0xea17ab=_0x98e1[_0x3173ff];return _0xea17ab;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x198e('0x0'));var zipdir=require(_0x198e('0x1'));var jsonpatch=require(_0x198e('0x2'));var rp=require(_0x198e('0x3'));var moment=require('moment');var BPromise=require(_0x198e('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x198e('0x5'));var sox=require(_0x198e('0x6'));var csv=require(_0x198e('0x7'));var ejs=require(_0x198e('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x198e('0x9'));var crypto=require('crypto');var jsforce=require(_0x198e('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x198e('0x7'));var querystring=require(_0x198e('0xb'));var Papa=require(_0x198e('0xc'));var Redis=require(_0x198e('0xd'));var authService=require(_0x198e('0xe'));var qs=require(_0x198e('0xf'));var as=require(_0x198e('0x10'));var hardwareService=require(_0x198e('0x11'));var logger=require(_0x198e('0x12'))('api');var utils=require(_0x198e('0x13'));var config=require(_0x198e('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x198e('0x15'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x358746,_0x4ceda9){_0x4ceda9=_0x4ceda9||0xcc;return function(_0x58b2c9){if(_0x58b2c9){return _0x358746['sendStatus'](_0x4ceda9);}return _0x358746['status'](_0x4ceda9)[_0x198e('0x16')]();};}function respondWithResult(_0x2c9017,_0x10d24e){_0x10d24e=_0x10d24e||0xc8;return function(_0x4bd409){if(_0x4bd409){return _0x2c9017[_0x198e('0x17')](_0x10d24e)[_0x198e('0x18')](_0x4bd409);}};}function respondWithFilteredResult(_0x3b4101,_0x5035de){return function(_0x53e4c1){if(_0x53e4c1){var _0x5bb7dc=typeof _0x5035de['offset']==='undefined'&&typeof _0x5035de[_0x198e('0x19')]==='undefined';var _0x514315=_0x53e4c1[_0x198e('0x1a')];var _0x46c980=_0x5bb7dc?0x0:_0x5035de[_0x198e('0x1b')];var _0x4cbf50=_0x5bb7dc?_0x53e4c1[_0x198e('0x1a')]:_0x5035de[_0x198e('0x1b')]+_0x5035de[_0x198e('0x19')];var _0x10c4cd;if(_0x4cbf50>=_0x514315){_0x4cbf50=_0x514315;_0x10c4cd=0xc8;}else{_0x10c4cd=0xce;}_0x3b4101[_0x198e('0x17')](_0x10c4cd);return _0x3b4101['set'](_0x198e('0x1c'),_0x46c980+'-'+_0x4cbf50+'/'+_0x514315)[_0x198e('0x18')](_0x53e4c1);}return null;};}function patchUpdates(_0x59814c){return function(_0x10d94d){try{jsonpatch[_0x198e('0x1d')](_0x10d94d,_0x59814c,!![]);}catch(_0x3d55ff){return BPromise[_0x198e('0x1e')](_0x3d55ff);}return _0x10d94d[_0x198e('0x1f')]();};}function saveUpdates(_0x41e27f,_0x503986){return function(_0x2509e1){if(_0x2509e1){return _0x2509e1[_0x198e('0x20')](_0x41e27f)[_0x198e('0x21')](function(_0x43042f){return _0x43042f;});}return null;};}function removeEntity(_0x17d04d,_0x2ab945){return function(_0xe6c8f3){if(_0xe6c8f3){return _0xe6c8f3['destroy']()[_0x198e('0x21')](function(){_0x17d04d[_0x198e('0x17')](0xcc)[_0x198e('0x16')]();});}};}function handleEntityNotFound(_0x2ed96f,_0xbd105b){return function(_0x2c27c0){if(!_0x2c27c0){_0x2ed96f[_0x198e('0x22')](0x194);}return _0x2c27c0;};}function handleError(_0x436992,_0x66c071){_0x66c071=_0x66c071||0x1f4;return function(_0x4bb713){logger['error'](_0x4bb713[_0x198e('0x23')]);if(_0x4bb713[_0x198e('0x24')]){delete _0x4bb713['name'];}_0x436992['status'](_0x66c071)[_0x198e('0x25')](_0x4bb713);};}exports[_0x198e('0x26')]=function(_0x337c73,_0x505dd8){var _0x5e657e={},_0x37ee38={},_0x17a5b5={'count':0x0,'rows':[]};var _0x3f7bf6=_[_0x198e('0x27')](db[_0x198e('0x28')][_0x198e('0x29')],function(_0x3525d5){return{'name':_0x3525d5[_0x198e('0x2a')],'type':_0x3525d5['type'][_0x198e('0x2b')]};});_0x37ee38[_0x198e('0x2c')]=_[_0x198e('0x27')](_0x3f7bf6,'name');_0x37ee38['query']=_[_0x198e('0x2d')](_0x337c73[_0x198e('0x2e')]);_0x37ee38['filters']=_[_0x198e('0x2f')](_0x37ee38[_0x198e('0x2c')],_0x37ee38[_0x198e('0x2e')]);_0x5e657e[_0x198e('0x30')]=_[_0x198e('0x2f')](_0x37ee38['model'],qs['fields'](_0x337c73[_0x198e('0x2e')]['fields']));_0x5e657e['attributes']=_0x5e657e['attributes'][_0x198e('0x31')]?_0x5e657e[_0x198e('0x30')]:_0x37ee38['model'];if(!_0x337c73[_0x198e('0x2e')][_0x198e('0x32')](_0x198e('0x33'))){_0x5e657e['limit']=qs[_0x198e('0x19')](_0x337c73[_0x198e('0x2e')][_0x198e('0x19')]);_0x5e657e[_0x198e('0x1b')]=qs[_0x198e('0x1b')](_0x337c73[_0x198e('0x2e')][_0x198e('0x1b')]);}_0x5e657e[_0x198e('0x34')]=qs['sort'](_0x337c73[_0x198e('0x2e')][_0x198e('0x35')]);_0x5e657e[_0x198e('0x36')]=qs[_0x198e('0x37')](_[_0x198e('0x38')](_0x337c73[_0x198e('0x2e')],_0x37ee38[_0x198e('0x37')]),_0x3f7bf6);if(_0x337c73[_0x198e('0x2e')][_0x198e('0x39')]){_0x5e657e[_0x198e('0x36')]=_['merge'](_0x5e657e[_0x198e('0x36')],{'$or':_[_0x198e('0x27')](_0x3f7bf6,function(_0x37078f){if(_0x37078f[_0x198e('0x3a')]!==_0x198e('0x3b')){var _0x1e5ea8={};_0x1e5ea8[_0x37078f[_0x198e('0x24')]]={'$like':'%'+_0x337c73['query'][_0x198e('0x39')]+'%'};return _0x1e5ea8;}})});}_0x5e657e=_[_0x198e('0x3c')]({},_0x5e657e,_0x337c73['options']);var _0x2b0a8d={'where':_0x5e657e[_0x198e('0x36')]};return db[_0x198e('0x28')][_0x198e('0x1a')](_0x2b0a8d)[_0x198e('0x21')](function(_0x57a10a){_0x17a5b5[_0x198e('0x1a')]=_0x57a10a;if(_0x337c73[_0x198e('0x2e')]['includeAll']){_0x5e657e[_0x198e('0x3d')]=[{'all':!![]}];}return db[_0x198e('0x28')][_0x198e('0x3e')](_0x5e657e);})['then'](function(_0x511d21){_0x17a5b5[_0x198e('0x3f')]=_0x511d21;return _0x17a5b5;})[_0x198e('0x21')](respondWithFilteredResult(_0x505dd8,_0x5e657e))[_0x198e('0x40')](handleError(_0x505dd8,null));};exports[_0x198e('0x41')]=function(_0x5a863b,_0x4d46d0){var _0x3dcca6={'raw':![],'where':{'id':_0x5a863b[_0x198e('0x42')]['id']}},_0x10e73b={};_0x10e73b['model']=_['keys'](db['Dynamics365Account'][_0x198e('0x29')]);_0x10e73b[_0x198e('0x2e')]=_[_0x198e('0x2d')](_0x5a863b[_0x198e('0x2e')]);_0x10e73b[_0x198e('0x37')]=_[_0x198e('0x2f')](_0x10e73b[_0x198e('0x2c')],_0x10e73b[_0x198e('0x2e')]);_0x3dcca6[_0x198e('0x30')]=_[_0x198e('0x2f')](_0x10e73b[_0x198e('0x2c')],qs[_0x198e('0x43')](_0x5a863b[_0x198e('0x2e')][_0x198e('0x43')]));_0x3dcca6[_0x198e('0x30')]=_0x3dcca6['attributes'][_0x198e('0x31')]?_0x3dcca6['attributes']:_0x10e73b[_0x198e('0x2c')];if(_0x5a863b[_0x198e('0x2e')][_0x198e('0x44')]){_0x3dcca6['include']=[{'all':!![]}];}_0x3dcca6=_[_0x198e('0x3c')]({},_0x3dcca6,_0x5a863b['options']);return db[_0x198e('0x28')][_0x198e('0x45')](_0x3dcca6)[_0x198e('0x21')](handleEntityNotFound(_0x4d46d0,null))[_0x198e('0x21')](respondWithResult(_0x4d46d0,null))[_0x198e('0x40')](handleError(_0x4d46d0,null));};exports[_0x198e('0x46')]=function(_0x10d688,_0x5db967){return db[_0x198e('0x28')][_0x198e('0x46')](_0x10d688[_0x198e('0x47')],{})[_0x198e('0x21')](respondWithResult(_0x5db967,0xc9))[_0x198e('0x40')](handleError(_0x5db967,null));};exports[_0x198e('0x20')]=function(_0x3b85ea,_0x4138e4){if(_0x3b85ea[_0x198e('0x47')]['id']){delete _0x3b85ea[_0x198e('0x47')]['id'];}return db[_0x198e('0x28')][_0x198e('0x45')]({'where':{'id':_0x3b85ea['params']['id']}})[_0x198e('0x21')](handleEntityNotFound(_0x4138e4,null))[_0x198e('0x21')](saveUpdates(_0x3b85ea[_0x198e('0x47')],null))[_0x198e('0x21')](respondWithResult(_0x4138e4,null))[_0x198e('0x40')](handleError(_0x4138e4,null));};exports[_0x198e('0x48')]=function(_0x2b6e06,_0x33f776){return db['Dynamics365Account'][_0x198e('0x45')]({'where':{'id':_0x2b6e06[_0x198e('0x42')]['id']}})['then'](handleEntityNotFound(_0x33f776,null))[_0x198e('0x21')](removeEntity(_0x33f776,null))['catch'](handleError(_0x33f776,null));};exports[_0x198e('0x49')]=function(_0x1f97aa,_0x2e2165,_0x3af27f){var _0x4c5954={};var _0x49bb9c={};var _0x11d941;var _0x17d253;return db['Dynamics365Account'][_0x198e('0x4a')]({'where':{'id':_0x1f97aa['params']['id']}})['then'](handleEntityNotFound(_0x2e2165,null))[_0x198e('0x21')](function(_0x18c030){if(_0x18c030){_0x11d941=_0x18c030;_0x49bb9c[_0x198e('0x2c')]=_[_0x198e('0x2d')](db[_0x198e('0x4b')]['rawAttributes']);_0x49bb9c['query']=_[_0x198e('0x2d')](_0x1f97aa[_0x198e('0x2e')]);_0x49bb9c[_0x198e('0x37')]=_[_0x198e('0x2f')](_0x49bb9c[_0x198e('0x2c')],_0x49bb9c['query']);_0x4c5954[_0x198e('0x30')]=_[_0x198e('0x2f')](_0x49bb9c[_0x198e('0x2c')],qs['fields'](_0x1f97aa[_0x198e('0x2e')][_0x198e('0x43')]));_0x4c5954[_0x198e('0x30')]=_0x4c5954[_0x198e('0x30')]['length']?_0x4c5954['attributes']:_0x49bb9c['model'];_0x4c5954[_0x198e('0x34')]=qs['sort'](_0x1f97aa['query'][_0x198e('0x35')]);_0x4c5954[_0x198e('0x36')]=qs[_0x198e('0x37')](_['pick'](_0x1f97aa['query'],_0x49bb9c[_0x198e('0x37')]));if(_0x1f97aa['query'][_0x198e('0x39')]){_0x4c5954[_0x198e('0x36')]=_['merge'](_0x4c5954['where'],{'$or':_['map'](_0x4c5954['attributes'],function(_0x2f6d75){var _0x189c67={};_0x189c67[_0x2f6d75]={'$like':'%'+_0x1f97aa[_0x198e('0x2e')][_0x198e('0x39')]+'%'};return _0x189c67;})});}_0x4c5954=_[_0x198e('0x3c')]({},_0x4c5954,_0x1f97aa['options']);return _0x11d941[_0x198e('0x49')](_0x4c5954);}})[_0x198e('0x21')](function(_0x538eeb){if(_0x538eeb){_0x17d253=_0x538eeb[_0x198e('0x31')];if(!_0x1f97aa['query'][_0x198e('0x32')](_0x198e('0x33'))){_0x4c5954[_0x198e('0x19')]=qs[_0x198e('0x19')](_0x1f97aa[_0x198e('0x2e')][_0x198e('0x19')]);_0x4c5954['offset']=qs[_0x198e('0x1b')](_0x1f97aa[_0x198e('0x2e')]['offset']);}return _0x11d941[_0x198e('0x49')](_0x4c5954);}})['then'](function(_0x238839){if(_0x238839){return _0x238839?{'count':_0x17d253,'rows':_0x238839}:null;}})[_0x198e('0x21')](respondWithResult(_0x2e2165,null))['catch'](handleError(_0x2e2165,null));};exports['addConfiguration']=function(_0x12c953,_0x356407,_0xd4713d){if(_0x12c953[_0x198e('0x47')]['id']){delete _0x12c953['body']['id'];}return db[_0x198e('0x28')][_0x198e('0x4a')]({'where':{'id':_0x12c953['params']['id']}})[_0x198e('0x21')](handleEntityNotFound(_0x356407,null))[_0x198e('0x21')](function(_0x12d078){if(_0x12d078){_0x12c953[_0x198e('0x47')][_0x198e('0x4c')]=_0x12d078['id'];_0x12c953[_0x198e('0x47')][_0x198e('0x4d')]=integrations[_0x198e('0x4e')](_0x12c953[_0x198e('0x47')][_0x198e('0x4f')],_0x12c953['body']['type']);_0x12c953[_0x198e('0x47')]['Descriptions']=integrations[_0x198e('0x50')](_0x12c953[_0x198e('0x47')][_0x198e('0x4f')],_0x12c953['body'][_0x198e('0x3a')]);return db[_0x198e('0x4b')][_0x198e('0x46')](_0x12c953[_0x198e('0x47')],{'include':[{'model':db['Dynamics365Field'],'as':_0x198e('0x4d')},{'model':db[_0x198e('0x51')],'as':'Descriptions'}]});}return null;})['then'](respondWithResult(_0x356407,null))[_0x198e('0x40')](handleError(_0x356407,null));};exports[_0x198e('0x52')]=function(_0x91bac0,_0x54694c,_0x10cc63){var _0x2357db=_0x91bac0['query'][_0x198e('0x53')];var _0x5ce2e7=_0x2357db==='incident'?_0x198e('0x54'):_0x198e('0x55');var _0x3f3872='';var _0x12a8a1='';var _0x3460bb='';var _0x225348='';var _0x28e331='';var _0xb497ad='';var _0x2997c6='';var _0x1b203a='';var _0xf942b7=['title','description',_0x198e('0x56'),_0x198e('0x57'),_0x198e('0x58'),_0x198e('0x59'),_0x198e('0x5a'),_0x198e('0x5b'),_0x198e('0x5c'),_0x198e('0x5d')];var _0xbc3d1c=[_0x198e('0x5e'),_0x198e('0x5f'),_0x198e('0x60'),_0x198e('0x61'),_0x198e('0x62'),_0x198e('0x63'),_0x198e('0x64'),_0x198e('0x65'),_0x198e('0x66'),_0x198e('0x67'),_0x198e('0x68'),_0x198e('0x69'),_0x198e('0x6a'),'createdonbehalfbyname',_0x198e('0x6b'),_0x198e('0x6c'),_0x198e('0x6d'),_0x198e('0x6e'),_0x198e('0x6f'),_0x198e('0x70'),'entityimage_timestamp','entityimage_url',_0x198e('0x71'),_0x198e('0x72'),_0x198e('0x73'),_0x198e('0x74'),_0x198e('0x75'),'influencescore',_0x198e('0x76'),_0x198e('0x77'),_0x198e('0x78'),'modifiedbyexternalpartyname',_0x198e('0x79'),_0x198e('0x7a'),_0x198e('0x7b'),_0x198e('0x7c'),_0x198e('0x7d'),'modifiedonbehalfbyyominame',_0x198e('0x7e'),_0x198e('0x7f'),_0x198e('0x80'),_0x198e('0x81'),_0x198e('0x82'),_0x198e('0x83'),_0x198e('0x84'),_0x198e('0x85'),'parentcaseidname',_0x198e('0x86'),_0x198e('0x87'),_0x198e('0x88'),_0x198e('0x89'),_0x198e('0x8a'),_0x198e('0x8b'),_0x198e('0x8c'),_0x198e('0x8d'),_0x198e('0x8e'),_0x198e('0x8f'),_0x198e('0x90'),_0x198e('0x91'),_0x198e('0x92'),_0x198e('0x93'),_0x198e('0x94'),'statuscode','subjectidname','ticketnumber',_0x198e('0x95'),_0x198e('0x96'),_0x198e('0x97'),_0x198e('0x98'),_0x198e('0x99')];var _0x4f0068=_0xf942b7['concat'](_0xbc3d1c);return db['Dynamics365Account']['findOne']({'where':{'id':_0x91bac0[_0x198e('0x42')]['id']},'attributes':['id',_0x198e('0x9a'),_0x198e('0x9b'),'remoteUri',_0x198e('0x9c'),_0x198e('0x9d'),_0x198e('0x9e')]})[_0x198e('0x21')](handleEntityNotFound(_0x54694c,null))['then'](function(_0xa55f36){if(_0xa55f36){_0x1b203a=_0xa55f36[_0x198e('0x9f')];var _0x71e7d2=_0x1b203a[_0x198e('0xa0')](-0x1);if(_0x71e7d2==='/'){_0x1b203a=_0x1b203a[_0x198e('0xa1')](0x0,_0x1b203a[_0x198e('0xa2')](_0x71e7d2));}_0x2997c6=util[_0x198e('0xa3')](_0x198e('0xa4'),_0x1b203a);var _0x4cef0e={'method':'POST','uri':_0x198e('0xa5')+_0xa55f36[_0x198e('0x9c')]+_0x198e('0xa6'),'form':{'client_id':_0xa55f36[_0x198e('0x9d')],'resource':_0x1b203a,'username':_0xa55f36['username'],'password':_0xa55f36[_0x198e('0x9b')],'grant_type':_0x198e('0x9b'),'client_secret':_0xa55f36['clientSecret']},'json':!![]};return rp(_0x4cef0e);}})['then'](function(_0x513a5f){_0xb497ad=_0x513a5f[_0x198e('0xa7')];var _0xc0ea9e={'method':_0x198e('0xa8'),'uri':encodeURI(_0x2997c6+_0x198e('0xa9')+_0x5ce2e7+'\x27'),'headers':{'Authorization':_0x198e('0xaa')+_0xb497ad,'If-None-Match':null,'OData-Version':_0x198e('0xab')},'json':!![]};return rp(_0xc0ea9e);})[_0x198e('0x21')](function(_0x2e1836){var _0x5327cd=_0x2e1836[_0x198e('0xac')][0x0];var _0x29f311=_0x5327cd[_0x198e('0xad')];var _0x2ac098={'method':_0x198e('0xa8'),'uri':_0x2997c6+'EntityDefinitions('+_0x29f311+')?$select=LogicalName&$expand=Attributes($select=LogicalName)','headers':{'Authorization':_0x198e('0xaa')+_0xb497ad,'If-None-Match':null,'OData-Version':_0x198e('0xab')},'json':!![]};return rp(_0x2ac098);})[_0x198e('0x21')](function(_0x121e09){_0x3f3872=_0x121e09;_0x12a8a1=_0x3f3872[_0x198e('0xae')];_0x12a8a1=_[_0x198e('0xaf')](_0x12a8a1,function(_0x515b05){return!_0x4f0068[_0x198e('0xb0')](_0x515b05[_0x198e('0xb1')]);});var _0x473643=[];var _0x56a706=[];_0x12a8a1['forEach'](function(_0x4b1663){if(_0x4b1663[_0x198e('0xb2')]){var _0x35ac5b=_0x4b1663[_0x198e('0xb2')]['substring'](_0x4b1663[_0x198e('0xb2')][_0x198e('0xa2')]('.')+0x1);if(_0x35ac5b===_0x198e('0xb3')){_0x473643['push'](getSelectList(_0x2997c6,_0x2357db,_0x56a706,_0x3f3872[_0x198e('0xad')],_0x4b1663[_0x198e('0xad')],_0xb497ad));}}});return Promise['all'](_0x473643);})[_0x198e('0x21')](function(_0x4cdd7f){_0x3460bb=_0x4cdd7f[0x0];var _0x395de7=[];var _0x357f36=[];_0x12a8a1['forEach'](function(_0x2d5cef){if(!_[_0x198e('0xb4')](_0x2d5cef['@odata.type'])){var _0x13c03a=_0x2d5cef[_0x198e('0xb2')][_0x198e('0xa1')](_0x2d5cef['@odata.type'][_0x198e('0xa2')]('.')+0x1);if(_0x13c03a==='BooleanAttributeMetadata'){_0x395de7[_0x198e('0xb5')](getBooleanList(_0x2997c6,_0x2357db,_0x357f36,_0x3f3872['MetadataId'],_0x2d5cef[_0x198e('0xad')],_0xb497ad));}}});return Promise['all'](_0x395de7);})['then'](function(_0x3f6688){_0x225348=_0x3f6688[0x0];var _0x49b455=[];var _0x2d957a=[];_0x12a8a1[_0x198e('0xb6')](function(_0x118718){if(_0x118718['@odata.type']){var _0x5453be=_0x118718[_0x198e('0xb2')]['substring'](_0x118718['@odata.type'][_0x198e('0xa2')]('.')+0x1);if(_0x5453be===_0x198e('0xb7')||_0x5453be==='DoubleAttributeMetadata'||_0x5453be===_0x198e('0xb8')||_0x5453be==='IntegerAttributeMetadata'||_0x5453be===_0x198e('0xb9')||_0x5453be==='DateTimeAttributeMetadata'||_0x5453be===_0x198e('0xba')||_0x5453be===_0x198e('0xbb')||_0x5453be==='StateAttributeMetadata'||_0x5453be===_0x198e('0xbc')){_0x49b455[_0x198e('0xb5')](getInputList(_0x2997c6,_0x2357db,_0x5453be,_0x2d957a,_0x3f3872[_0x198e('0xad')],_0x118718['MetadataId'],_0xb497ad));}}});return Promise['all'](_0x49b455);})[_0x198e('0x21')](function(_0x406f78){_0x28e331=_0x406f78[0x0];var _0x234420=_0x3460bb[_0x198e('0xbd')](_0x225348)['concat'](_0x28e331);var _0x457339={'count':_0x234420[_0x198e('0x31')],'rows':_0x234420};return _0x457339;})[_0x198e('0x21')](respondWithResult(_0x54694c,null))['catch'](function(_0x524ad5){var _0x148574=_0x91bac0[_0x198e('0x2e')][_0x198e('0xbe')]?0x1f4:_0x524ad5[_0x198e('0xbf')]||0x1f4;logger[_0x198e('0xc0')](_0x524ad5[_0x198e('0x23')]);delete _0x524ad5[_0x198e('0x24')];if(_0x148574===0x191){_0x148574=0x190;}_0x54694c[_0x198e('0x17')](_0x148574)[_0x198e('0x25')](_0x91bac0[_0x198e('0x2e')]['test']?{'message':_0x198e('0xc1'),'statusCode':_0x524ad5[_0x198e('0xbf')]}:_0x524ad5);});};function getSelectList(_0x429274,_0x115e82,_0x54662e,_0x4f5e3f,_0x237c6b,_0x287920){var _0x197c0e={'method':_0x198e('0xa8'),'uri':_0x429274+_0x198e('0xc2')+_0x4f5e3f+_0x198e('0xc3')+_0x237c6b+')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?'+_0x198e('0xc4'),'headers':{'Authorization':_0x198e('0xaa')+_0x287920,'If-None-Match':null,'OData-Version':_0x198e('0xab')},'json':!![]};return rp(_0x197c0e)[_0x198e('0x21')](function(_0x321df9){var _0x333196=[];var _0x178dc0=_0x321df9['OptionSet'][_0x198e('0xc5')];_0x178dc0[_0x198e('0xb6')](function(_0x468121){_0x333196[_0x198e('0xb5')]({'name':_0x468121[_0x198e('0xc6')][_0x198e('0xc7')]['Label'],'value':String(_0x468121[_0x198e('0xc8')])});});var _0x32bcf2={'id':_0x115e82+'_'+_0x321df9[_0x198e('0xb1')],'name':_0x321df9[_0x198e('0xc9')]['UserLocalizedLabel'][_0x198e('0xc6')],'custom':![],'options':_0x333196};_0x54662e['push'](_0x32bcf2);return _0x54662e;});}function getBooleanList(_0x3fb57f,_0x47592e,_0x5d72d2,_0x3dc3f4,_0x23b76e,_0x320da3){var _0x2bb79a={'method':_0x198e('0xa8'),'uri':_0x3fb57f+'EntityDefinitions('+_0x3dc3f4+')/Attributes('+_0x23b76e+_0x198e('0xca'),'headers':{'Authorization':_0x198e('0xaa')+_0x320da3,'If-None-Match':null,'OData-Version':_0x198e('0xab')},'json':!![]};return rp(_0x2bb79a)[_0x198e('0x21')](function(_0x289ad1){var _0x4edcc7=[];_0x4edcc7[_0x198e('0xb5')]({'name':_0x289ad1[_0x198e('0xcb')][_0x198e('0xcc')]['Label'][_0x198e('0xc7')]['Label'],'value':'true'},{'name':_0x289ad1[_0x198e('0xcb')][_0x198e('0xcd')]['Label'][_0x198e('0xc7')][_0x198e('0xc6')],'value':_0x198e('0xce')});var _0x2b638f={'id':_0x47592e+'_'+_0x289ad1[_0x198e('0xb1')],'name':_0x289ad1[_0x198e('0xc9')][_0x198e('0xc7')]['Label'],'custom':![],'options':_0x4edcc7};_0x5d72d2[_0x198e('0xb5')](_0x2b638f);return _0x5d72d2;});}function getInputList(_0x2bba7f,_0x4d6cc5,_0x5a3c53,_0x1bc40b,_0xce450b,_0x17e79a,_0x2e693a){var _0x2a4309={'method':_0x198e('0xa8'),'uri':_0x2bba7f+_0x198e('0xc2')+_0xce450b+_0x198e('0xc3')+_0x17e79a+')/Microsoft.Dynamics.CRM.'+_0x5a3c53+_0x198e('0xcf'),'headers':{'Authorization':'Bearer\x20'+_0x2e693a,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x2a4309)[_0x198e('0x21')](function(_0x45c476){var _0x351606={'id':_0x4d6cc5+'_'+_0x45c476['LogicalName'],'name':_0x45c476[_0x198e('0xc9')]['UserLocalizedLabel']?_0x45c476[_0x198e('0xc9')][_0x198e('0xc7')][_0x198e('0xc6')]:_0x45c476['LogicalName'],'custom':![],'options':[]};_0x1bc40b['push'](_0x351606);return _0x1bc40b;});} \ No newline at end of file +var _0x4fde=[')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','TrueOption','false',')/Microsoft.Dynamics.CRM.','?$select=DisplayName,LogicalName','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','../../components/integrations/configuration','status','end','undefined','count','offset','limit','set','Content-Range','json','reject','then','sendStatus','error','stack','name','send','index','Dynamics365Account','rawAttributes','type','key','model','map','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','find','create','body','update','params','destroy','getConfigurations','findOne','addConfiguration','AccountId','Subjects','channel','Descriptions','getDescriptions','Dynamics365Configuration','Dynamics365Field','getFields','ticketType','incident','Incident','PhoneCall','title','description','customerid','ownerid','caseorigincode','subject','phonenumber','directioncode','phonecall_activity_parties','accountidyominame','actualserviceunits','contactidname','contactidyominame','contractdetailidname','contractidname','createdbyexternalpartyname','createdbyexternalpartyyominame','createdbyname','createdbyyominame','createdon','createdonbehalfbyname','customeridname','entitlementidname','escalatedon','exchangerate','firstresponsebykpiidname','importsequencenumber','influencescore','kbarticleidname','lastonholdtime','modifiedbyexternalpartyname','modifiedbyname','modifiedon','modifiedonbehalfbyname','modifiedonbehalfbyyominame','msdyn_incidenttypename','msdyn_iotalertname','numberofchildincidents','owneridname','owneridtype','owneridyominame','parentcaseidname','primarycontactidname','primarycontactidyominame','prioritycodename','productidname','productserialnumber','resolveby','resolvebykpiidname','responseby','responsiblecontactidname','responsiblecontactidyominame','sentimentvalue','slainvokedidname','slaname','socialprofileidname','statecode','statuscode','subjectidname','ticketnumber','transactioncurrencyidname','utcconversiontimezonecode','versionnumber','username','password','remoteUri','tenantId','clientId','clientSecret','slice','substring','lastIndexOf','format','%s/api/data/v9.0/','/oauth2/token','access_token','GET','4.0','value','MetadataId','EntityDefinitions(',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','Attributes','remove','includes','LogicalName','forEach','@odata.type','PicklistAttributeMetadata','push','all','isNil','StringAttributeMetadata','DoubleAttributeMetadata','IntegerAttributeMetadata','DateTimeAttributeMetadata','StatusAttributeMetadata','EntityNameAttributeMetadata','DecimalAttributeMetadata','test','statusCode','Wrong\x20credentials',')/Attributes(','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','OptionSet','Options','UserLocalizedLabel','Label','DisplayName'];(function(_0xce5ec0,_0x5bc0db){var _0x9971a3=function(_0x56e7ec){while(--_0x56e7ec){_0xce5ec0['push'](_0xce5ec0['shift']());}};_0x9971a3(++_0x5bc0db);}(_0x4fde,0x19f));var _0xe4fd=function(_0x26d6d9,_0x431cb8){_0x26d6d9=_0x26d6d9-0x0;var _0x1b4875=_0x4fde[_0x26d6d9];return _0x1b4875;};'use strict';var emlformat=require(_0xe4fd('0x0'));var rimraf=require(_0xe4fd('0x1'));var zipdir=require(_0xe4fd('0x2'));var jsonpatch=require(_0xe4fd('0x3'));var rp=require('request-promise');var moment=require(_0xe4fd('0x4'));var BPromise=require(_0xe4fd('0x5'));var Mustache=require('mustache');var util=require(_0xe4fd('0x6'));var path=require(_0xe4fd('0x7'));var sox=require(_0xe4fd('0x8'));var csv=require(_0xe4fd('0x9'));var ejs=require(_0xe4fd('0xa'));var fs=require('fs');var fs_extra=require(_0xe4fd('0xb'));var _=require(_0xe4fd('0xc'));var squel=require(_0xe4fd('0xd'));var crypto=require(_0xe4fd('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xe4fd('0xf'));var toCsv=require('to-csv');var querystring=require(_0xe4fd('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xe4fd('0x11'));var qs=require(_0xe4fd('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xe4fd('0x13'))(_0xe4fd('0x14'));var utils=require(_0xe4fd('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xe4fd('0x16'));var db=require(_0xe4fd('0x17'))['db'];var integrations=require(_0xe4fd('0x18'));function respondWithStatusCode(_0xcedd85,_0x2faa76){_0x2faa76=_0x2faa76||0xcc;return function(_0x2df77c){if(_0x2df77c){return _0xcedd85['sendStatus'](_0x2faa76);}return _0xcedd85[_0xe4fd('0x19')](_0x2faa76)[_0xe4fd('0x1a')]();};}function respondWithResult(_0x5499c6,_0x5c88de){_0x5c88de=_0x5c88de||0xc8;return function(_0x2ae150){if(_0x2ae150){return _0x5499c6[_0xe4fd('0x19')](_0x5c88de)['json'](_0x2ae150);}};}function respondWithFilteredResult(_0x5578e1,_0x2bf08c){return function(_0x431150){if(_0x431150){var _0x23de5e=typeof _0x2bf08c['offset']===_0xe4fd('0x1b')&&typeof _0x2bf08c['limit']==='undefined';var _0x2c3bfc=_0x431150[_0xe4fd('0x1c')];var _0x326cc7=_0x23de5e?0x0:_0x2bf08c[_0xe4fd('0x1d')];var _0x1eb295=_0x23de5e?_0x431150['count']:_0x2bf08c[_0xe4fd('0x1d')]+_0x2bf08c[_0xe4fd('0x1e')];var _0x9f3663;if(_0x1eb295>=_0x2c3bfc){_0x1eb295=_0x2c3bfc;_0x9f3663=0xc8;}else{_0x9f3663=0xce;}_0x5578e1[_0xe4fd('0x19')](_0x9f3663);return _0x5578e1[_0xe4fd('0x1f')](_0xe4fd('0x20'),_0x326cc7+'-'+_0x1eb295+'/'+_0x2c3bfc)[_0xe4fd('0x21')](_0x431150);}return null;};}function patchUpdates(_0x30d545){return function(_0x43d3a4){try{jsonpatch['apply'](_0x43d3a4,_0x30d545,!![]);}catch(_0x2532bb){return BPromise[_0xe4fd('0x22')](_0x2532bb);}return _0x43d3a4['save']();};}function saveUpdates(_0x49aa8c,_0x5741dc){return function(_0x29c2d7){if(_0x29c2d7){return _0x29c2d7['update'](_0x49aa8c)[_0xe4fd('0x23')](function(_0x5941b5){return _0x5941b5;});}return null;};}function removeEntity(_0x261259,_0x394878){return function(_0xd4a22c){if(_0xd4a22c){return _0xd4a22c['destroy']()[_0xe4fd('0x23')](function(){_0x261259[_0xe4fd('0x19')](0xcc)[_0xe4fd('0x1a')]();});}};}function handleEntityNotFound(_0x40a748,_0x18901c){return function(_0x4bfdf7){if(!_0x4bfdf7){_0x40a748[_0xe4fd('0x24')](0x194);}return _0x4bfdf7;};}function handleError(_0x196fe8,_0xef9721){_0xef9721=_0xef9721||0x1f4;return function(_0x38f206){logger[_0xe4fd('0x25')](_0x38f206[_0xe4fd('0x26')]);if(_0x38f206[_0xe4fd('0x27')]){delete _0x38f206[_0xe4fd('0x27')];}_0x196fe8[_0xe4fd('0x19')](_0xef9721)[_0xe4fd('0x28')](_0x38f206);};}exports[_0xe4fd('0x29')]=function(_0x144c45,_0x92eed0){var _0x1507e8={},_0xf96ab0={},_0x22a304={'count':0x0,'rows':[]};var _0x392eba=_['map'](db[_0xe4fd('0x2a')][_0xe4fd('0x2b')],function(_0x8dcc87){return{'name':_0x8dcc87['fieldName'],'type':_0x8dcc87[_0xe4fd('0x2c')][_0xe4fd('0x2d')]};});_0xf96ab0[_0xe4fd('0x2e')]=_[_0xe4fd('0x2f')](_0x392eba,_0xe4fd('0x27'));_0xf96ab0['query']=_[_0xe4fd('0x30')](_0x144c45[_0xe4fd('0x31')]);_0xf96ab0[_0xe4fd('0x32')]=_[_0xe4fd('0x33')](_0xf96ab0[_0xe4fd('0x2e')],_0xf96ab0[_0xe4fd('0x31')]);_0x1507e8[_0xe4fd('0x34')]=_[_0xe4fd('0x33')](_0xf96ab0[_0xe4fd('0x2e')],qs[_0xe4fd('0x35')](_0x144c45[_0xe4fd('0x31')][_0xe4fd('0x35')]));_0x1507e8[_0xe4fd('0x34')]=_0x1507e8[_0xe4fd('0x34')][_0xe4fd('0x36')]?_0x1507e8[_0xe4fd('0x34')]:_0xf96ab0[_0xe4fd('0x2e')];if(!_0x144c45[_0xe4fd('0x31')][_0xe4fd('0x37')](_0xe4fd('0x38'))){_0x1507e8[_0xe4fd('0x1e')]=qs[_0xe4fd('0x1e')](_0x144c45[_0xe4fd('0x31')][_0xe4fd('0x1e')]);_0x1507e8[_0xe4fd('0x1d')]=qs['offset'](_0x144c45['query'][_0xe4fd('0x1d')]);}_0x1507e8[_0xe4fd('0x39')]=qs[_0xe4fd('0x3a')](_0x144c45[_0xe4fd('0x31')]['sort']);_0x1507e8[_0xe4fd('0x3b')]=qs[_0xe4fd('0x32')](_[_0xe4fd('0x3c')](_0x144c45[_0xe4fd('0x31')],_0xf96ab0[_0xe4fd('0x32')]),_0x392eba);if(_0x144c45[_0xe4fd('0x31')][_0xe4fd('0x3d')]){_0x1507e8[_0xe4fd('0x3b')]=_[_0xe4fd('0x3e')](_0x1507e8['where'],{'$or':_[_0xe4fd('0x2f')](_0x392eba,function(_0x583716){if(_0x583716[_0xe4fd('0x2c')]!==_0xe4fd('0x3f')){var _0x36d748={};_0x36d748[_0x583716[_0xe4fd('0x27')]]={'$like':'%'+_0x144c45[_0xe4fd('0x31')]['filter']+'%'};return _0x36d748;}})});}_0x1507e8=_[_0xe4fd('0x3e')]({},_0x1507e8,_0x144c45[_0xe4fd('0x40')]);var _0x598c6a={'where':_0x1507e8[_0xe4fd('0x3b')]};return db[_0xe4fd('0x2a')][_0xe4fd('0x1c')](_0x598c6a)['then'](function(_0x2b8859){_0x22a304[_0xe4fd('0x1c')]=_0x2b8859;if(_0x144c45[_0xe4fd('0x31')]['includeAll']){_0x1507e8[_0xe4fd('0x41')]=[{'all':!![]}];}return db[_0xe4fd('0x2a')][_0xe4fd('0x42')](_0x1507e8);})[_0xe4fd('0x23')](function(_0x596915){_0x22a304[_0xe4fd('0x43')]=_0x596915;return _0x22a304;})[_0xe4fd('0x23')](respondWithFilteredResult(_0x92eed0,_0x1507e8))[_0xe4fd('0x44')](handleError(_0x92eed0,null));};exports[_0xe4fd('0x45')]=function(_0x4ecf6d,_0x4f7a59){var _0x1601d5={'raw':![],'where':{'id':_0x4ecf6d['params']['id']}},_0x465b22={};_0x465b22[_0xe4fd('0x2e')]=_[_0xe4fd('0x30')](db[_0xe4fd('0x2a')][_0xe4fd('0x2b')]);_0x465b22[_0xe4fd('0x31')]=_[_0xe4fd('0x30')](_0x4ecf6d['query']);_0x465b22['filters']=_['intersection'](_0x465b22[_0xe4fd('0x2e')],_0x465b22[_0xe4fd('0x31')]);_0x1601d5[_0xe4fd('0x34')]=_[_0xe4fd('0x33')](_0x465b22[_0xe4fd('0x2e')],qs[_0xe4fd('0x35')](_0x4ecf6d[_0xe4fd('0x31')][_0xe4fd('0x35')]));_0x1601d5[_0xe4fd('0x34')]=_0x1601d5[_0xe4fd('0x34')][_0xe4fd('0x36')]?_0x1601d5[_0xe4fd('0x34')]:_0x465b22[_0xe4fd('0x2e')];if(_0x4ecf6d[_0xe4fd('0x31')]['includeAll']){_0x1601d5[_0xe4fd('0x41')]=[{'all':!![]}];}_0x1601d5=_[_0xe4fd('0x3e')]({},_0x1601d5,_0x4ecf6d[_0xe4fd('0x40')]);return db['Dynamics365Account'][_0xe4fd('0x46')](_0x1601d5)['then'](handleEntityNotFound(_0x4f7a59,null))['then'](respondWithResult(_0x4f7a59,null))[_0xe4fd('0x44')](handleError(_0x4f7a59,null));};exports[_0xe4fd('0x47')]=function(_0x312114,_0x1c88d4){return db[_0xe4fd('0x2a')][_0xe4fd('0x47')](_0x312114[_0xe4fd('0x48')],{})['then'](respondWithResult(_0x1c88d4,0xc9))[_0xe4fd('0x44')](handleError(_0x1c88d4,null));};exports[_0xe4fd('0x49')]=function(_0x16bd52,_0x42d006){if(_0x16bd52[_0xe4fd('0x48')]['id']){delete _0x16bd52[_0xe4fd('0x48')]['id'];}return db[_0xe4fd('0x2a')][_0xe4fd('0x46')]({'where':{'id':_0x16bd52[_0xe4fd('0x4a')]['id']}})[_0xe4fd('0x23')](handleEntityNotFound(_0x42d006,null))[_0xe4fd('0x23')](saveUpdates(_0x16bd52[_0xe4fd('0x48')],null))[_0xe4fd('0x23')](respondWithResult(_0x42d006,null))[_0xe4fd('0x44')](handleError(_0x42d006,null));};exports[_0xe4fd('0x4b')]=function(_0x4d93c0,_0x1c3644){return db[_0xe4fd('0x2a')][_0xe4fd('0x46')]({'where':{'id':_0x4d93c0[_0xe4fd('0x4a')]['id']}})['then'](handleEntityNotFound(_0x1c3644,null))['then'](removeEntity(_0x1c3644,null))[_0xe4fd('0x44')](handleError(_0x1c3644,null));};exports[_0xe4fd('0x4c')]=function(_0x37240a,_0x48ef90,_0x4232be){var _0x20c37f={};var _0x4cbc10={};var _0xa1d3e0;var _0x21e444;return db[_0xe4fd('0x2a')][_0xe4fd('0x4d')]({'where':{'id':_0x37240a[_0xe4fd('0x4a')]['id']}})[_0xe4fd('0x23')](handleEntityNotFound(_0x48ef90,null))[_0xe4fd('0x23')](function(_0x24f9c6){if(_0x24f9c6){_0xa1d3e0=_0x24f9c6;_0x4cbc10[_0xe4fd('0x2e')]=_['keys'](db['Dynamics365Configuration']['rawAttributes']);_0x4cbc10[_0xe4fd('0x31')]=_[_0xe4fd('0x30')](_0x37240a['query']);_0x4cbc10[_0xe4fd('0x32')]=_[_0xe4fd('0x33')](_0x4cbc10[_0xe4fd('0x2e')],_0x4cbc10[_0xe4fd('0x31')]);_0x20c37f['attributes']=_['intersection'](_0x4cbc10['model'],qs['fields'](_0x37240a[_0xe4fd('0x31')][_0xe4fd('0x35')]));_0x20c37f[_0xe4fd('0x34')]=_0x20c37f[_0xe4fd('0x34')][_0xe4fd('0x36')]?_0x20c37f['attributes']:_0x4cbc10[_0xe4fd('0x2e')];_0x20c37f['order']=qs['sort'](_0x37240a[_0xe4fd('0x31')][_0xe4fd('0x3a')]);_0x20c37f[_0xe4fd('0x3b')]=qs['filters'](_[_0xe4fd('0x3c')](_0x37240a[_0xe4fd('0x31')],_0x4cbc10['filters']));if(_0x37240a[_0xe4fd('0x31')][_0xe4fd('0x3d')]){_0x20c37f[_0xe4fd('0x3b')]=_[_0xe4fd('0x3e')](_0x20c37f[_0xe4fd('0x3b')],{'$or':_['map'](_0x20c37f['attributes'],function(_0x35af9d){var _0x313027={};_0x313027[_0x35af9d]={'$like':'%'+_0x37240a[_0xe4fd('0x31')][_0xe4fd('0x3d')]+'%'};return _0x313027;})});}_0x20c37f=_[_0xe4fd('0x3e')]({},_0x20c37f,_0x37240a['options']);return _0xa1d3e0[_0xe4fd('0x4c')](_0x20c37f);}})[_0xe4fd('0x23')](function(_0x263c07){if(_0x263c07){_0x21e444=_0x263c07[_0xe4fd('0x36')];if(!_0x37240a[_0xe4fd('0x31')][_0xe4fd('0x37')](_0xe4fd('0x38'))){_0x20c37f['limit']=qs[_0xe4fd('0x1e')](_0x37240a[_0xe4fd('0x31')][_0xe4fd('0x1e')]);_0x20c37f[_0xe4fd('0x1d')]=qs[_0xe4fd('0x1d')](_0x37240a['query'][_0xe4fd('0x1d')]);}return _0xa1d3e0[_0xe4fd('0x4c')](_0x20c37f);}})[_0xe4fd('0x23')](function(_0x1bd083){if(_0x1bd083){return _0x1bd083?{'count':_0x21e444,'rows':_0x1bd083}:null;}})[_0xe4fd('0x23')](respondWithResult(_0x48ef90,null))[_0xe4fd('0x44')](handleError(_0x48ef90,null));};exports[_0xe4fd('0x4e')]=function(_0x3c9844,_0x3aa002,_0xdefeeb){if(_0x3c9844[_0xe4fd('0x48')]['id']){delete _0x3c9844[_0xe4fd('0x48')]['id'];}return db[_0xe4fd('0x2a')][_0xe4fd('0x4d')]({'where':{'id':_0x3c9844['params']['id']}})[_0xe4fd('0x23')](handleEntityNotFound(_0x3aa002,null))['then'](function(_0x17d19a){if(_0x17d19a){_0x3c9844[_0xe4fd('0x48')][_0xe4fd('0x4f')]=_0x17d19a['id'];_0x3c9844[_0xe4fd('0x48')][_0xe4fd('0x50')]=integrations['getSubjects'](_0x3c9844['body'][_0xe4fd('0x51')],_0x3c9844[_0xe4fd('0x48')][_0xe4fd('0x2c')]);_0x3c9844[_0xe4fd('0x48')][_0xe4fd('0x52')]=integrations[_0xe4fd('0x53')](_0x3c9844[_0xe4fd('0x48')][_0xe4fd('0x51')],_0x3c9844[_0xe4fd('0x48')]['type']);return db[_0xe4fd('0x54')][_0xe4fd('0x47')](_0x3c9844[_0xe4fd('0x48')],{'include':[{'model':db[_0xe4fd('0x55')],'as':_0xe4fd('0x50')},{'model':db['Dynamics365Field'],'as':'Descriptions'}]});}return null;})['then'](respondWithResult(_0x3aa002,null))[_0xe4fd('0x44')](handleError(_0x3aa002,null));};exports[_0xe4fd('0x56')]=function(_0x3de7c3,_0x39ed9c,_0xf15367){var _0x53376a=_0x3de7c3[_0xe4fd('0x31')][_0xe4fd('0x57')];var _0x355826=_0x53376a===_0xe4fd('0x58')?_0xe4fd('0x59'):_0xe4fd('0x5a');var _0x490bf3='';var _0x53bb60='';var _0x39ae8c='';var _0x57ccea='';var _0x4ab898='';var _0x426dc6='';var _0x66da94='';var _0x349e75='';var _0x5b6326=[_0xe4fd('0x5b'),_0xe4fd('0x5c'),_0xe4fd('0x5d'),_0xe4fd('0x5e'),_0xe4fd('0x5f'),_0xe4fd('0x60'),_0xe4fd('0x61'),'regardingobjectid',_0xe4fd('0x62'),_0xe4fd('0x63')];var _0x1de85e=['accountidname',_0xe4fd('0x64'),_0xe4fd('0x65'),'billedserviceunits',_0xe4fd('0x66'),_0xe4fd('0x67'),_0xe4fd('0x68'),_0xe4fd('0x69'),_0xe4fd('0x6a'),_0xe4fd('0x6b'),_0xe4fd('0x6c'),_0xe4fd('0x6d'),_0xe4fd('0x6e'),_0xe4fd('0x6f'),'createdonbehalfbyyominame',_0xe4fd('0x70'),'customeridtype','customeridyominame','emailaddress',_0xe4fd('0x71'),'entityimage_timestamp','entityimage_url',_0xe4fd('0x72'),_0xe4fd('0x73'),_0xe4fd('0x74'),'followupby',_0xe4fd('0x75'),_0xe4fd('0x76'),_0xe4fd('0x77'),_0xe4fd('0x78'),'masteridname',_0xe4fd('0x79'),'modifiedbyexternalpartyyominame',_0xe4fd('0x7a'),'modifiedbyyominame',_0xe4fd('0x7b'),_0xe4fd('0x7c'),_0xe4fd('0x7d'),_0xe4fd('0x7e'),_0xe4fd('0x7f'),_0xe4fd('0x80'),'onholdtime','overriddencreatedon',_0xe4fd('0x81'),_0xe4fd('0x82'),_0xe4fd('0x83'),_0xe4fd('0x84'),_0xe4fd('0x85'),_0xe4fd('0x86'),_0xe4fd('0x87'),_0xe4fd('0x88'),_0xe4fd('0x89'),_0xe4fd('0x8a'),_0xe4fd('0x8b'),_0xe4fd('0x8c'),_0xe4fd('0x8d'),_0xe4fd('0x8e'),_0xe4fd('0x8f'),_0xe4fd('0x90'),_0xe4fd('0x91'),_0xe4fd('0x92'),_0xe4fd('0x93'),_0xe4fd('0x94'),_0xe4fd('0x95'),_0xe4fd('0x96'),'timezoneruleversionnumber',_0xe4fd('0x97'),'traversedpath',_0xe4fd('0x98'),_0xe4fd('0x99')];var _0x247dcc=_0x5b6326['concat'](_0x1de85e);return db[_0xe4fd('0x2a')]['findOne']({'where':{'id':_0x3de7c3[_0xe4fd('0x4a')]['id']},'attributes':['id',_0xe4fd('0x9a'),_0xe4fd('0x9b'),_0xe4fd('0x9c'),_0xe4fd('0x9d'),_0xe4fd('0x9e'),_0xe4fd('0x9f')]})[_0xe4fd('0x23')](handleEntityNotFound(_0x39ed9c,null))[_0xe4fd('0x23')](function(_0x50ca9e){if(_0x50ca9e){_0x349e75=_0x50ca9e[_0xe4fd('0x9c')];var _0x17c83b=_0x349e75[_0xe4fd('0xa0')](-0x1);if(_0x17c83b==='/'){_0x349e75=_0x349e75[_0xe4fd('0xa1')](0x0,_0x349e75[_0xe4fd('0xa2')](_0x17c83b));}_0x66da94=util[_0xe4fd('0xa3')](_0xe4fd('0xa4'),_0x349e75);var _0x1f271d={'method':'POST','uri':'https://login.microsoftonline.com/'+_0x50ca9e[_0xe4fd('0x9d')]+_0xe4fd('0xa5'),'form':{'client_id':_0x50ca9e['clientId'],'resource':_0x349e75,'username':_0x50ca9e[_0xe4fd('0x9a')],'password':_0x50ca9e[_0xe4fd('0x9b')],'grant_type':_0xe4fd('0x9b'),'client_secret':_0x50ca9e[_0xe4fd('0x9f')]},'json':!![]};return rp(_0x1f271d);}})[_0xe4fd('0x23')](function(_0x249ca9){_0x426dc6=_0x249ca9[_0xe4fd('0xa6')];var _0x17cac3={'method':_0xe4fd('0xa7'),'uri':encodeURI(_0x66da94+'EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27'+_0x355826+'\x27'),'headers':{'Authorization':'Bearer\x20'+_0x426dc6,'If-None-Match':null,'OData-Version':_0xe4fd('0xa8')},'json':!![]};return rp(_0x17cac3);})['then'](function(_0x1fa990){var _0xafc0f4=_0x1fa990[_0xe4fd('0xa9')][0x0];var _0x2f3ff6=_0xafc0f4[_0xe4fd('0xaa')];var _0x2f557e={'method':_0xe4fd('0xa7'),'uri':_0x66da94+_0xe4fd('0xab')+_0x2f3ff6+_0xe4fd('0xac'),'headers':{'Authorization':'Bearer\x20'+_0x426dc6,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x2f557e);})[_0xe4fd('0x23')](function(_0x48f7c8){_0x490bf3=_0x48f7c8;_0x53bb60=_0x490bf3[_0xe4fd('0xad')];_0x53bb60=_[_0xe4fd('0xae')](_0x53bb60,function(_0x52e68c){return!_0x247dcc[_0xe4fd('0xaf')](_0x52e68c[_0xe4fd('0xb0')]);});var _0x1169e6=[];var _0x57450d=[];_0x53bb60[_0xe4fd('0xb1')](function(_0x37ea7a){if(_0x37ea7a[_0xe4fd('0xb2')]){var _0x315da6=_0x37ea7a[_0xe4fd('0xb2')][_0xe4fd('0xa1')](_0x37ea7a[_0xe4fd('0xb2')][_0xe4fd('0xa2')]('.')+0x1);if(_0x315da6===_0xe4fd('0xb3')){_0x1169e6[_0xe4fd('0xb4')](getSelectList(_0x66da94,_0x53376a,_0x57450d,_0x490bf3[_0xe4fd('0xaa')],_0x37ea7a['MetadataId'],_0x426dc6));}}});return Promise[_0xe4fd('0xb5')](_0x1169e6);})['then'](function(_0x3b6f71){_0x39ae8c=_0x3b6f71[0x0];var _0x104c7a=[];var _0x50fa56=[];_0x53bb60[_0xe4fd('0xb1')](function(_0x3afadc){if(!_[_0xe4fd('0xb6')](_0x3afadc[_0xe4fd('0xb2')])){var _0x4c78a7=_0x3afadc[_0xe4fd('0xb2')][_0xe4fd('0xa1')](_0x3afadc[_0xe4fd('0xb2')][_0xe4fd('0xa2')]('.')+0x1);if(_0x4c78a7==='BooleanAttributeMetadata'){_0x104c7a['push'](getBooleanList(_0x66da94,_0x53376a,_0x50fa56,_0x490bf3['MetadataId'],_0x3afadc[_0xe4fd('0xaa')],_0x426dc6));}}});return Promise[_0xe4fd('0xb5')](_0x104c7a);})[_0xe4fd('0x23')](function(_0x1a6bad){_0x57ccea=_0x1a6bad[0x0];var _0x6d0f2c=[];var _0x20907c=[];_0x53bb60[_0xe4fd('0xb1')](function(_0x428197){if(_0x428197[_0xe4fd('0xb2')]){var _0x38d139=_0x428197[_0xe4fd('0xb2')][_0xe4fd('0xa1')](_0x428197['@odata.type'][_0xe4fd('0xa2')]('.')+0x1);if(_0x38d139===_0xe4fd('0xb7')||_0x38d139===_0xe4fd('0xb8')||_0x38d139==='BigIntAttributeMetadata'||_0x38d139===_0xe4fd('0xb9')||_0x38d139==='MemoAttributeMetadata'||_0x38d139===_0xe4fd('0xba')||_0x38d139===_0xe4fd('0xbb')||_0x38d139===_0xe4fd('0xbc')||_0x38d139==='StateAttributeMetadata'||_0x38d139===_0xe4fd('0xbd')){_0x6d0f2c[_0xe4fd('0xb4')](getInputList(_0x66da94,_0x53376a,_0x38d139,_0x20907c,_0x490bf3[_0xe4fd('0xaa')],_0x428197[_0xe4fd('0xaa')],_0x426dc6));}}});return Promise[_0xe4fd('0xb5')](_0x6d0f2c);})[_0xe4fd('0x23')](function(_0x455aa8){_0x4ab898=_0x455aa8[0x0];var _0x4eaff1=_0x39ae8c['concat'](_0x57ccea)['concat'](_0x4ab898);var _0x33c221={'count':_0x4eaff1[_0xe4fd('0x36')],'rows':_0x4eaff1};return _0x33c221;})[_0xe4fd('0x23')](respondWithResult(_0x39ed9c,null))[_0xe4fd('0x44')](function(_0x551e77){var _0x36d73e=_0x3de7c3[_0xe4fd('0x31')][_0xe4fd('0xbe')]?0x1f4:_0x551e77[_0xe4fd('0xbf')]||0x1f4;logger['error'](_0x551e77[_0xe4fd('0x26')]);delete _0x551e77[_0xe4fd('0x27')];if(_0x36d73e===0x191){_0x36d73e=0x190;}_0x39ed9c[_0xe4fd('0x19')](_0x36d73e)['send'](_0x3de7c3['query'][_0xe4fd('0xbe')]?{'message':_0xe4fd('0xc0'),'statusCode':_0x551e77[_0xe4fd('0xbf')]}:_0x551e77);});};function getSelectList(_0xab091b,_0xe90dc0,_0x4e4c07,_0x4708e7,_0x58d0d3,_0x36daf7){var _0x39286c={'method':_0xe4fd('0xa7'),'uri':_0xab091b+_0xe4fd('0xab')+_0x4708e7+_0xe4fd('0xc1')+_0x58d0d3+')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?'+_0xe4fd('0xc2'),'headers':{'Authorization':'Bearer\x20'+_0x36daf7,'If-None-Match':null,'OData-Version':_0xe4fd('0xa8')},'json':!![]};return rp(_0x39286c)[_0xe4fd('0x23')](function(_0x134971){var _0x2693fa=[];var _0x1f5197=_0x134971[_0xe4fd('0xc3')][_0xe4fd('0xc4')];_0x1f5197[_0xe4fd('0xb1')](function(_0x328abc){_0x2693fa[_0xe4fd('0xb4')]({'name':_0x328abc['Label'][_0xe4fd('0xc5')][_0xe4fd('0xc6')],'value':String(_0x328abc['Value'])});});var _0x48d959={'id':_0xe90dc0+'_'+_0x134971[_0xe4fd('0xb0')],'name':_0x134971[_0xe4fd('0xc7')][_0xe4fd('0xc5')][_0xe4fd('0xc6')],'custom':![],'options':_0x2693fa};_0x4e4c07['push'](_0x48d959);return _0x4e4c07;});}function getBooleanList(_0x23a8ac,_0xbcf22e,_0x5063a8,_0x40b11f,_0x30039c,_0x19c66d){var _0x14850e={'method':'GET','uri':_0x23a8ac+_0xe4fd('0xab')+_0x40b11f+_0xe4fd('0xc1')+_0x30039c+_0xe4fd('0xc8'),'headers':{'Authorization':'Bearer\x20'+_0x19c66d,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x14850e)[_0xe4fd('0x23')](function(_0x53f2c2){var _0x3060dd=[];_0x3060dd[_0xe4fd('0xb4')]({'name':_0x53f2c2[_0xe4fd('0xc3')][_0xe4fd('0xc9')][_0xe4fd('0xc6')][_0xe4fd('0xc5')][_0xe4fd('0xc6')],'value':'true'},{'name':_0x53f2c2[_0xe4fd('0xc3')]['FalseOption'][_0xe4fd('0xc6')][_0xe4fd('0xc5')][_0xe4fd('0xc6')],'value':_0xe4fd('0xca')});var _0x5b4e1a={'id':_0xbcf22e+'_'+_0x53f2c2[_0xe4fd('0xb0')],'name':_0x53f2c2[_0xe4fd('0xc7')][_0xe4fd('0xc5')][_0xe4fd('0xc6')],'custom':![],'options':_0x3060dd};_0x5063a8[_0xe4fd('0xb4')](_0x5b4e1a);return _0x5063a8;});}function getInputList(_0x5687b3,_0x1faf5f,_0x1599a6,_0x461568,_0x407d4f,_0x1179a6,_0x149805){var _0x48efde={'method':_0xe4fd('0xa7'),'uri':_0x5687b3+'EntityDefinitions('+_0x407d4f+')/Attributes('+_0x1179a6+_0xe4fd('0xcb')+_0x1599a6+_0xe4fd('0xcc'),'headers':{'Authorization':'Bearer\x20'+_0x149805,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x48efde)['then'](function(_0x2d6e48){var _0x296f38={'id':_0x1faf5f+'_'+_0x2d6e48[_0xe4fd('0xb0')],'name':_0x2d6e48[_0xe4fd('0xc7')][_0xe4fd('0xc5')]?_0x2d6e48[_0xe4fd('0xc7')][_0xe4fd('0xc5')]['Label']:_0x2d6e48[_0xe4fd('0xb0')],'custom':![],'options':[]};_0x461568[_0xe4fd('0xb4')](_0x296f38);return _0x461568;});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.model.js b/server/api/intDynamics365Account/intDynamics365Account.model.js index 4bb3e12..f0a473a 100644 --- a/server/api/intDynamics365Account/intDynamics365Account.model.js +++ b/server/api/intDynamics365Account/intDynamics365Account.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['exports','Dynamics365Account','int_dynamics365_accounts','lodash','util','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0xd9cc28,_0x5c448c){var _0x9e6ad7=function(_0x120faa){while(--_0x120faa){_0xd9cc28['push'](_0xd9cc28['shift']());}};_0x9e6ad7(++_0x5c448c);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x0d8b('0x2'));var rp=require(_0x0d8b('0x3'));var fs=require('fs');var path=require(_0x0d8b('0x4'));var rimraf=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var attributes=require('./intDynamics365Account.attributes');var integrations=require('../../components/integrations/configuration');module[_0x0d8b('0x7')]=function(_0x227c63,_0x39f43a){return _0x227c63['define'](_0x0d8b('0x8'),attributes,{'tableName':_0x0d8b('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd8b0=['exports','Dynamics365Account','int_dynamics365_accounts','lodash','util','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x51faa8,_0x5555dd){var _0x18c49f=function(_0x560a16){while(--_0x560a16){_0x51faa8['push'](_0x51faa8['shift']());}};_0x18c49f(++_0x5555dd);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x0d8b('0x2'));var rp=require(_0x0d8b('0x3'));var fs=require('fs');var path=require(_0x0d8b('0x4'));var rimraf=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var attributes=require('./intDynamics365Account.attributes');var integrations=require('../../components/integrations/configuration');module[_0x0d8b('0x7')]=function(_0x227c63,_0x39f43a){return _0x227c63['define'](_0x0d8b('0x8'),attributes,{'tableName':_0x0d8b('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.rpc.js b/server/api/intDynamics365Account/intDynamics365Account.rpc.js index f6f2c40..d246c54 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 _0x65c0=['request\x20sent','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','Dynamics365Account','findAll','options','raw','where','attributes','limit','include','map','model','GetDynamics365Account','ShowDynamics365Account','find','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','info','Dynamics365Account,\x20%s,\x20%s'];(function(_0x56aa0f,_0x55d43a){var _0x5bb736=function(_0x563156){while(--_0x563156){_0x56aa0f['push'](_0x56aa0f['shift']());}};_0x5bb736(++_0x55d43a);}(_0x65c0,0x150));var _0x065c=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x65c0[_0x5b644e];return _0x49c6bf;};'use strict';var _=require('lodash');var util=require(_0x065c('0x0'));var moment=require(_0x065c('0x1'));var BPromise=require(_0x065c('0x2'));var rs=require(_0x065c('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x065c('0x4'))['db'];var utils=require(_0x065c('0x5'));var logger=require(_0x065c('0x6'))(_0x065c('0x7'));var config=require(_0x065c('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x065c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5537ce,_0x102740,_0x3579ef){return new BPromise(function(_0x49d9d5,_0x29a072){return client[_0x065c('0xa')](_0x5537ce,_0x3579ef)[_0x065c('0xb')](function(_0x26470d){logger[_0x065c('0xc')](_0x065c('0xd'),_0x102740,_0x065c('0xe'));logger[_0x065c('0xf')](_0x065c('0x10'),_0x102740,'request\x20sent',JSON[_0x065c('0x11')](_0x26470d));if(_0x26470d[_0x065c('0x12')]){if(_0x26470d[_0x065c('0x12')][_0x065c('0x13')]===0x1f4){logger[_0x065c('0x12')](_0x065c('0xd'),_0x102740,_0x26470d[_0x065c('0x12')][_0x065c('0x14')]);return _0x29a072(_0x26470d['error'][_0x065c('0x14')]);}logger[_0x065c('0x12')](_0x065c('0xd'),_0x102740,_0x26470d[_0x065c('0x12')][_0x065c('0x14')]);return _0x49d9d5(_0x26470d[_0x065c('0x12')][_0x065c('0x14')]);}else{logger[_0x065c('0xc')](_0x065c('0xd'),_0x102740,_0x065c('0xe'));_0x49d9d5(_0x26470d['result']['message']);}})[_0x065c('0x15')](function(_0x5adda3){logger[_0x065c('0x12')]('Dynamics365Account,\x20%s,\x20%s',_0x102740,_0x5adda3);_0x29a072(_0x5adda3);});});}exports['GetDynamics365Account']=function(_0x5e8adc){var _0x153ce1=this;return new Promise(function(_0x1b66dd,_0x9158f0){return db[_0x065c('0x16')][_0x065c('0x17')]({'raw':_0x5e8adc['options']?_0x5e8adc[_0x065c('0x18')][_0x065c('0x19')]===undefined?!![]:![]:!![],'where':_0x5e8adc['options']?_0x5e8adc[_0x065c('0x18')][_0x065c('0x1a')]||null:null,'attributes':_0x5e8adc[_0x065c('0x18')]?_0x5e8adc[_0x065c('0x18')][_0x065c('0x1b')]||null:null,'limit':_0x5e8adc[_0x065c('0x18')]?_0x5e8adc[_0x065c('0x18')][_0x065c('0x1c')]||null:null,'include':_0x5e8adc['options']?_0x5e8adc[_0x065c('0x18')][_0x065c('0x1d')]?_[_0x065c('0x1e')](_0x5e8adc['options'][_0x065c('0x1d')],function(_0x5d6db7){return{'model':db[_0x5d6db7[_0x065c('0x1f')]],'as':_0x5d6db7['as'],'attributes':_0x5d6db7['attributes'],'include':_0x5d6db7['include']?_[_0x065c('0x1e')](_0x5d6db7[_0x065c('0x1d')],function(_0x3c3c03){return{'model':db[_0x3c3c03[_0x065c('0x1f')]],'as':_0x3c3c03['as'],'attributes':_0x3c3c03[_0x065c('0x1b')],'include':_0x3c3c03[_0x065c('0x1d')]?_['map'](_0x3c3c03[_0x065c('0x1d')],function(_0x303c20){return{'model':db[_0x303c20[_0x065c('0x1f')]],'as':_0x303c20['as'],'attributes':_0x303c20[_0x065c('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x065c('0xb')](function(_0x1f6da2){logger['info']('GetDynamics365Account',_0x5e8adc);logger[_0x065c('0xf')]('GetDynamics365Account',_0x5e8adc,JSON[_0x065c('0x11')](_0x1f6da2));_0x1b66dd(_0x1f6da2);})[_0x065c('0x15')](function(_0x56c789){logger[_0x065c('0x12')](_0x065c('0x20'),_0x56c789[_0x065c('0x14')],_0x5e8adc);_0x9158f0(_0x153ce1[_0x065c('0x12')](0x1f4,_0x56c789[_0x065c('0x14')]));});});};exports[_0x065c('0x21')]=function(_0x1c2c76){var _0x3f9c6c=this;return new Promise(function(_0x1c2884,_0x1de403){return db['Dynamics365Account'][_0x065c('0x22')]({'raw':_0x1c2c76['options']?_0x1c2c76[_0x065c('0x18')][_0x065c('0x19')]===undefined?!![]:![]:!![],'where':_0x1c2c76[_0x065c('0x18')]?_0x1c2c76[_0x065c('0x18')][_0x065c('0x1a')]||null:null,'attributes':_0x1c2c76[_0x065c('0x18')]?_0x1c2c76[_0x065c('0x18')][_0x065c('0x1b')]||null:null,'include':_0x1c2c76[_0x065c('0x18')]?_0x1c2c76['options'][_0x065c('0x1d')]?_[_0x065c('0x1e')](_0x1c2c76[_0x065c('0x18')]['include'],function(_0x158273){return{'model':db[_0x158273[_0x065c('0x1f')]],'as':_0x158273['as'],'attributes':_0x158273['attributes'],'include':_0x158273[_0x065c('0x1d')]?_[_0x065c('0x1e')](_0x158273['include'],function(_0x5744bd){return{'model':db[_0x5744bd[_0x065c('0x1f')]],'as':_0x5744bd['as'],'attributes':_0x5744bd[_0x065c('0x1b')],'include':_0x5744bd['include']?_[_0x065c('0x1e')](_0x5744bd[_0x065c('0x1d')],function(_0x1d5eb6){return{'model':db[_0x1d5eb6['model']],'as':_0x1d5eb6['as'],'attributes':_0x1d5eb6['attributes']};}):[]};}):[]};}):[]:[]})[_0x065c('0xb')](function(_0x26dc3f){logger['info'](_0x065c('0x21'),_0x1c2c76);logger[_0x065c('0xf')]('ShowDynamics365Account',_0x1c2c76,JSON['stringify'](_0x26dc3f));_0x1c2884(_0x26dc3f);})[_0x065c('0x15')](function(_0xb83ff1){logger[_0x065c('0x12')]('ShowDynamics365Account',_0xb83ff1[_0x065c('0x14')],_0x1c2c76);_0x1de403(_0x3f9c6c[_0x065c('0x12')](0x1f4,_0xb83ff1[_0x065c('0x14')]));});});}; \ No newline at end of file +var _0xcb2a=['model','map','then','GetDynamics365Account','ShowDynamics365Account','find','lodash','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','request','info','Dynamics365Account,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message','result','catch','Dynamics365Account','findAll','options','raw','where','attributes','limit','include'];(function(_0x1c85a7,_0x56f1d9){var _0x2b9b29=function(_0x4001cb){while(--_0x4001cb){_0x1c85a7['push'](_0x1c85a7['shift']());}};_0x2b9b29(++_0x56f1d9);}(_0xcb2a,0xc0));var _0xacb2=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0xcb2a[_0x502c7d];return _0x30b7ed;};'use strict';var _=require(_0xacb2('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xacb2('0x1'));var fs=require('fs');var Redis=require(_0xacb2('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xacb2('0x3'));var logger=require('../../config/logger')(_0xacb2('0x4'));var config=require(_0xacb2('0x5'));var jayson=require(_0xacb2('0x6'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x165ea0,_0x29cf62,_0x6c5f8){return new BPromise(function(_0x261636,_0x387d4d){return client[_0xacb2('0x7')](_0x165ea0,_0x6c5f8)['then'](function(_0x29ec50){logger[_0xacb2('0x8')](_0xacb2('0x9'),_0x29cf62,'request\x20sent');logger[_0xacb2('0xa')]('Dynamics365Account,\x20%s,\x20%s,\x20%s',_0x29cf62,_0xacb2('0xb'),JSON[_0xacb2('0xc')](_0x29ec50));if(_0x29ec50[_0xacb2('0xd')]){if(_0x29ec50[_0xacb2('0xd')]['code']===0x1f4){logger[_0xacb2('0xd')](_0xacb2('0x9'),_0x29cf62,_0x29ec50['error']['message']);return _0x387d4d(_0x29ec50[_0xacb2('0xd')][_0xacb2('0xe')]);}logger[_0xacb2('0xd')](_0xacb2('0x9'),_0x29cf62,_0x29ec50[_0xacb2('0xd')][_0xacb2('0xe')]);return _0x261636(_0x29ec50[_0xacb2('0xd')][_0xacb2('0xe')]);}else{logger[_0xacb2('0x8')](_0xacb2('0x9'),_0x29cf62,_0xacb2('0xb'));_0x261636(_0x29ec50[_0xacb2('0xf')]['message']);}})[_0xacb2('0x10')](function(_0x5e119c){logger[_0xacb2('0xd')](_0xacb2('0x9'),_0x29cf62,_0x5e119c);_0x387d4d(_0x5e119c);});});}exports['GetDynamics365Account']=function(_0x1598ca){var _0x3f49bd=this;return new Promise(function(_0x38599d,_0x4a83ee){return db[_0xacb2('0x11')][_0xacb2('0x12')]({'raw':_0x1598ca[_0xacb2('0x13')]?_0x1598ca[_0xacb2('0x13')][_0xacb2('0x14')]===undefined?!![]:![]:!![],'where':_0x1598ca[_0xacb2('0x13')]?_0x1598ca[_0xacb2('0x13')][_0xacb2('0x15')]||null:null,'attributes':_0x1598ca[_0xacb2('0x13')]?_0x1598ca[_0xacb2('0x13')][_0xacb2('0x16')]||null:null,'limit':_0x1598ca[_0xacb2('0x13')]?_0x1598ca[_0xacb2('0x13')][_0xacb2('0x17')]||null:null,'include':_0x1598ca['options']?_0x1598ca[_0xacb2('0x13')]['include']?_['map'](_0x1598ca[_0xacb2('0x13')][_0xacb2('0x18')],function(_0x1b1601){return{'model':db[_0x1b1601[_0xacb2('0x19')]],'as':_0x1b1601['as'],'attributes':_0x1b1601['attributes'],'include':_0x1b1601['include']?_['map'](_0x1b1601[_0xacb2('0x18')],function(_0x3e0ef7){return{'model':db[_0x3e0ef7[_0xacb2('0x19')]],'as':_0x3e0ef7['as'],'attributes':_0x3e0ef7[_0xacb2('0x16')],'include':_0x3e0ef7[_0xacb2('0x18')]?_[_0xacb2('0x1a')](_0x3e0ef7['include'],function(_0x2f211b){return{'model':db[_0x2f211b[_0xacb2('0x19')]],'as':_0x2f211b['as'],'attributes':_0x2f211b['attributes']};}):[]};}):[]};}):[]:[]})[_0xacb2('0x1b')](function(_0x1bedca){logger['info'](_0xacb2('0x1c'),_0x1598ca);logger[_0xacb2('0xa')](_0xacb2('0x1c'),_0x1598ca,JSON[_0xacb2('0xc')](_0x1bedca));_0x38599d(_0x1bedca);})[_0xacb2('0x10')](function(_0x5db68f){logger[_0xacb2('0xd')](_0xacb2('0x1c'),_0x5db68f[_0xacb2('0xe')],_0x1598ca);_0x4a83ee(_0x3f49bd[_0xacb2('0xd')](0x1f4,_0x5db68f[_0xacb2('0xe')]));});});};exports[_0xacb2('0x1d')]=function(_0x551872){var _0x25d44b=this;return new Promise(function(_0x1f5097,_0x490533){return db['Dynamics365Account'][_0xacb2('0x1e')]({'raw':_0x551872[_0xacb2('0x13')]?_0x551872['options'][_0xacb2('0x14')]===undefined?!![]:![]:!![],'where':_0x551872[_0xacb2('0x13')]?_0x551872['options'][_0xacb2('0x15')]||null:null,'attributes':_0x551872['options']?_0x551872[_0xacb2('0x13')]['attributes']||null:null,'include':_0x551872[_0xacb2('0x13')]?_0x551872[_0xacb2('0x13')][_0xacb2('0x18')]?_['map'](_0x551872[_0xacb2('0x13')]['include'],function(_0x23072b){return{'model':db[_0x23072b[_0xacb2('0x19')]],'as':_0x23072b['as'],'attributes':_0x23072b[_0xacb2('0x16')],'include':_0x23072b[_0xacb2('0x18')]?_[_0xacb2('0x1a')](_0x23072b[_0xacb2('0x18')],function(_0x1853f0){return{'model':db[_0x1853f0[_0xacb2('0x19')]],'as':_0x1853f0['as'],'attributes':_0x1853f0[_0xacb2('0x16')],'include':_0x1853f0[_0xacb2('0x18')]?_[_0xacb2('0x1a')](_0x1853f0[_0xacb2('0x18')],function(_0x1ea1a4){return{'model':db[_0x1ea1a4[_0xacb2('0x19')]],'as':_0x1ea1a4['as'],'attributes':_0x1ea1a4[_0xacb2('0x16')]};}):[]};}):[]};}):[]:[]})[_0xacb2('0x1b')](function(_0x4e598e){logger[_0xacb2('0x8')]('ShowDynamics365Account',_0x551872);logger[_0xacb2('0xa')](_0xacb2('0x1d'),_0x551872,JSON['stringify'](_0x4e598e));_0x1f5097(_0x4e598e);})['catch'](function(_0x26abc1){logger[_0xacb2('0xd')](_0xacb2('0x1d'),_0x26abc1[_0xacb2('0xe')],_0x551872);_0x490533(_0x25d44b[_0xacb2('0xd')](0x1f4,_0x26abc1[_0xacb2('0xe')]));});});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/index.js b/server/api/intDynamics365Configuration/index.js index 7252c77..be22ddf 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 _0x04b5=['isAuthenticated','show','/:id/fields','getFields','getSubjects','getDescriptions','post','create','put','destroy','exports','util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./intDynamics365Configuration.controller','get','index','/:id'];(function(_0x4c7b3a,_0x146dc9){var _0x334fb2=function(_0xa5a530){while(--_0xa5a530){_0x4c7b3a['push'](_0x4c7b3a['shift']());}};_0x334fb2(++_0x146dc9);}(_0x04b5,0x1ef));var _0x504b=function(_0x3f1ea6,_0x2a6cbf){_0x3f1ea6=_0x3f1ea6-0x0;var _0x5b4432=_0x04b5[_0x3f1ea6];return _0x5b4432;};'use strict';var multer=require('multer');var util=require(_0x504b('0x0'));var path=require(_0x504b('0x1'));var timeout=require('connect-timeout');var express=require(_0x504b('0x2'));var router=express[_0x504b('0x3')]();var fs_extra=require(_0x504b('0x4'));var auth=require(_0x504b('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x504b('0x6'));var controller=require(_0x504b('0x7'));router[_0x504b('0x8')]('/',auth['isAuthenticated'](),controller[_0x504b('0x9')]);router[_0x504b('0x8')](_0x504b('0xa'),auth[_0x504b('0xb')](),controller[_0x504b('0xc')]);router[_0x504b('0x8')](_0x504b('0xd'),auth[_0x504b('0xb')](),controller[_0x504b('0xe')]);router[_0x504b('0x8')]('/:id/subjects',auth[_0x504b('0xb')](),controller[_0x504b('0xf')]);router['get']('/:id/descriptions',auth[_0x504b('0xb')](),controller[_0x504b('0x10')]);router[_0x504b('0x11')]('/',auth[_0x504b('0xb')](),controller[_0x504b('0x12')]);router[_0x504b('0x13')](_0x504b('0xa'),auth[_0x504b('0xb')](),controller['update']);router['delete'](_0x504b('0xa'),auth[_0x504b('0xb')](),controller[_0x504b('0x14')]);module[_0x504b('0x15')]=router; \ No newline at end of file +var _0x24ba=['index','/:id','isAuthenticated','show','get','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','update','delete','destroy','exports','multer','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./intDynamics365Configuration.controller'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x24ba,0xa1));var _0xa24b=function(_0x4e8190,_0x1e485f){_0x4e8190=_0x4e8190-0x0;var _0x11b432=_0x24ba[_0x4e8190];return _0x11b432;};'use strict';var multer=require(_0xa24b('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xa24b('0x1'));var express=require(_0xa24b('0x2'));var router=express[_0xa24b('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xa24b('0x4'));var interaction=require(_0xa24b('0x5'));var config=require('../../config/environment');var controller=require(_0xa24b('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0xa24b('0x7')]);router['get'](_0xa24b('0x8'),auth[_0xa24b('0x9')](),controller[_0xa24b('0xa')]);router[_0xa24b('0xb')](_0xa24b('0xc'),auth[_0xa24b('0x9')](),controller[_0xa24b('0xd')]);router[_0xa24b('0xb')](_0xa24b('0xe'),auth['isAuthenticated'](),controller[_0xa24b('0xf')]);router['get'](_0xa24b('0x10'),auth[_0xa24b('0x9')](),controller[_0xa24b('0x11')]);router[_0xa24b('0x12')]('/',auth[_0xa24b('0x9')](),controller[_0xa24b('0x13')]);router['put']('/:id',auth[_0xa24b('0x9')](),controller[_0xa24b('0x14')]);router[_0xa24b('0x15')](_0xa24b('0x8'),auth[_0xa24b('0x9')](),controller[_0xa24b('0x16')]);module[_0xa24b('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 ad3ef58..1b7041b 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 _0xc7a5=['ENUM','incident','phonecall','contact','nothing','sequelize','exports','STRING'];(function(_0x29ec0b,_0x4bff43){var _0x67ccd=function(_0x2d2215){while(--_0x2d2215){_0x29ec0b['push'](_0x29ec0b['shift']());}};_0x67ccd(++_0x4bff43);}(_0xc7a5,0x155));var _0x5c7a=function(_0x3aa2f9,_0x2e8e49){_0x3aa2f9=_0x3aa2f9-0x0;var _0x9a7f3d=_0xc7a5[_0x3aa2f9];return _0x9a7f3d;};'use strict';var Sequelize=require(_0x5c7a('0x0'));module[_0x5c7a('0x1')]={'name':{'type':Sequelize[_0x5c7a('0x2')]},'description':{'type':Sequelize['STRING']},'ticketType':{'type':Sequelize[_0x5c7a('0x3')](_0x5c7a('0x4'),_0x5c7a('0x5')),'defaultValue':_0x5c7a('0x4')},'moduleCreate':{'type':Sequelize[_0x5c7a('0x3')](_0x5c7a('0x6'),_0x5c7a('0x7')),'defaultValue':_0x5c7a('0x6'),'allowNull':![]}}; \ No newline at end of file +var _0x9c38=['ENUM','incident','phonecall','contact','nothing','sequelize','exports','STRING'];(function(_0x3af528,_0x2beded){var _0x4cf2f7=function(_0x2f4ce4){while(--_0x2f4ce4){_0x3af528['push'](_0x3af528['shift']());}};_0x4cf2f7(++_0x2beded);}(_0x9c38,0xe5));var _0x89c3=function(_0x48391d,_0x1be86f){_0x48391d=_0x48391d-0x0;var _0x19419e=_0x9c38[_0x48391d];return _0x19419e;};'use strict';var Sequelize=require(_0x89c3('0x0'));module[_0x89c3('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x89c3('0x2')]},'ticketType':{'type':Sequelize[_0x89c3('0x3')](_0x89c3('0x4'),_0x89c3('0x5')),'defaultValue':_0x89c3('0x4')},'moduleCreate':{'type':Sequelize[_0x89c3('0x3')](_0x89c3('0x6'),_0x89c3('0x7')),'defaultValue':'contact','allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js index 9ad7f21..9903046 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 _0x239e=['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','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','then','destroy','error','name','index','map','Dynamics365Configuration','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','show','length','create','body','update','params','catch','find','getFields','Dynamics365Field','hasOwnProperty','getSubjects','findOne','getDescriptions','eml-format','request-promise','mustache','util','path','sox','ejs'];(function(_0x19115e,_0x507bab){var _0x45bbd4=function(_0x1308bf){while(--_0x1308bf){_0x19115e['push'](_0x19115e['shift']());}};_0x45bbd4(++_0x507bab);}(_0x239e,0x97));var _0xe239=function(_0x300b26,_0x3a9b67){_0x300b26=_0x300b26-0x0;var _0x5cb1ae=_0x239e[_0x300b26];return _0x5cb1ae;};'use strict';var emlformat=require(_0xe239('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xe239('0x1'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xe239('0x2'));var util=require(_0xe239('0x3'));var path=require(_0xe239('0x4'));var sox=require(_0xe239('0x5'));var csv=require('to-csv');var ejs=require(_0xe239('0x6'));var fs=require('fs');var fs_extra=require(_0xe239('0x7'));var _=require('lodash');var squel=require(_0xe239('0x8'));var crypto=require(_0xe239('0x9'));var jsforce=require(_0xe239('0xa'));var deskjs=require(_0xe239('0xb'));var toCsv=require('to-csv');var querystring=require(_0xe239('0xc'));var Papa=require(_0xe239('0xd'));var Redis=require(_0xe239('0xe'));var authService=require(_0xe239('0xf'));var qs=require(_0xe239('0x10'));var as=require(_0xe239('0x11'));var hardwareService=require(_0xe239('0x12'));var logger=require(_0xe239('0x13'))(_0xe239('0x14'));var utils=require(_0xe239('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xe239('0x16'))['db'];function respondWithStatusCode(_0x190830,_0x5ac3f1){_0x5ac3f1=_0x5ac3f1||0xcc;return function(_0x513c19){if(_0x513c19){return _0x190830[_0xe239('0x17')](_0x5ac3f1);}return _0x190830[_0xe239('0x18')](_0x5ac3f1)[_0xe239('0x19')]();};}function respondWithResult(_0x4f3ae1,_0x5b5010){_0x5b5010=_0x5b5010||0xc8;return function(_0x4010e2){if(_0x4010e2){return _0x4f3ae1[_0xe239('0x18')](_0x5b5010)[_0xe239('0x1a')](_0x4010e2);}};}function respondWithFilteredResult(_0x24ff96,_0x9722c6){return function(_0x1c6ad8){if(_0x1c6ad8){var _0x1ca33d=typeof _0x9722c6[_0xe239('0x1b')]===_0xe239('0x1c')&&typeof _0x9722c6[_0xe239('0x1d')]===_0xe239('0x1c');var _0x47d86f=_0x1c6ad8['count'];var _0x1e466e=_0x1ca33d?0x0:_0x9722c6[_0xe239('0x1b')];var _0x42f6ee=_0x1ca33d?_0x1c6ad8[_0xe239('0x1e')]:_0x9722c6[_0xe239('0x1b')]+_0x9722c6['limit'];var _0x2fb770;if(_0x42f6ee>=_0x47d86f){_0x42f6ee=_0x47d86f;_0x2fb770=0xc8;}else{_0x2fb770=0xce;}_0x24ff96[_0xe239('0x18')](_0x2fb770);return _0x24ff96[_0xe239('0x1f')]('Content-Range',_0x1e466e+'-'+_0x42f6ee+'/'+_0x47d86f)[_0xe239('0x1a')](_0x1c6ad8);}return null;};}function patchUpdates(_0x4305c9){return function(_0x2e76d8){try{jsonpatch[_0xe239('0x20')](_0x2e76d8,_0x4305c9,!![]);}catch(_0x4583dc){return BPromise[_0xe239('0x21')](_0x4583dc);}return _0x2e76d8['save']();};}function saveUpdates(_0x48485f,_0x32b325){return function(_0x244e57){if(_0x244e57){return _0x244e57['update'](_0x48485f)[_0xe239('0x22')](function(_0x2fb175){return _0x2fb175;});}return null;};}function removeEntity(_0x22f209,_0x208eef){return function(_0x35a4d3){if(_0x35a4d3){return _0x35a4d3[_0xe239('0x23')]()[_0xe239('0x22')](function(){_0x22f209['status'](0xcc)[_0xe239('0x19')]();});}};}function handleEntityNotFound(_0x4e6d97,_0x6fa816){return function(_0x9d6552){if(!_0x9d6552){_0x4e6d97[_0xe239('0x17')](0x194);}return _0x9d6552;};}function handleError(_0x1601b5,_0x38bff1){_0x38bff1=_0x38bff1||0x1f4;return function(_0xdb26c6){logger[_0xe239('0x24')](_0xdb26c6['stack']);if(_0xdb26c6[_0xe239('0x25')]){delete _0xdb26c6['name'];}_0x1601b5['status'](_0x38bff1)['send'](_0xdb26c6);};}exports[_0xe239('0x26')]=function(_0x2975cb,_0x1a2e8e){var _0x51b542={},_0x4d14e8={},_0x57fdea={'count':0x0,'rows':[]};var _0x5a5403=_[_0xe239('0x27')](db[_0xe239('0x28')][_0xe239('0x29')],function(_0x1f23f2){return{'name':_0x1f23f2[_0xe239('0x2a')],'type':_0x1f23f2[_0xe239('0x2b')][_0xe239('0x2c')]};});_0x4d14e8[_0xe239('0x2d')]=_[_0xe239('0x27')](_0x5a5403,'name');_0x4d14e8[_0xe239('0x2e')]=_[_0xe239('0x2f')](_0x2975cb[_0xe239('0x2e')]);_0x4d14e8[_0xe239('0x30')]=_[_0xe239('0x31')](_0x4d14e8['model'],_0x4d14e8[_0xe239('0x2e')]);_0x51b542[_0xe239('0x32')]=_['intersection'](_0x4d14e8['model'],qs[_0xe239('0x33')](_0x2975cb['query'][_0xe239('0x33')]));_0x51b542[_0xe239('0x32')]=_0x51b542['attributes']['length']?_0x51b542[_0xe239('0x32')]:_0x4d14e8[_0xe239('0x2d')];if(!_0x2975cb[_0xe239('0x2e')]['hasOwnProperty'](_0xe239('0x34'))){_0x51b542['limit']=qs['limit'](_0x2975cb[_0xe239('0x2e')]['limit']);_0x51b542[_0xe239('0x1b')]=qs[_0xe239('0x1b')](_0x2975cb['query'][_0xe239('0x1b')]);}_0x51b542[_0xe239('0x35')]=qs[_0xe239('0x36')](_0x2975cb[_0xe239('0x2e')][_0xe239('0x36')]);_0x51b542[_0xe239('0x37')]=qs['filters'](_[_0xe239('0x38')](_0x2975cb[_0xe239('0x2e')],_0x4d14e8['filters']),_0x5a5403);if(_0x2975cb[_0xe239('0x2e')]['filter']){_0x51b542[_0xe239('0x37')]=_[_0xe239('0x39')](_0x51b542[_0xe239('0x37')],{'$or':_[_0xe239('0x27')](_0x5a5403,function(_0x1f695b){if(_0x1f695b[_0xe239('0x2b')]!==_0xe239('0x3a')){var _0x2a9e21={};_0x2a9e21[_0x1f695b[_0xe239('0x25')]]={'$like':'%'+_0x2975cb[_0xe239('0x2e')][_0xe239('0x3b')]+'%'};return _0x2a9e21;}})});}_0x51b542=_['merge']({},_0x51b542,_0x2975cb[_0xe239('0x3c')]);var _0x5461dc={'where':_0x51b542[_0xe239('0x37')]};return db[_0xe239('0x28')][_0xe239('0x1e')](_0x5461dc)[_0xe239('0x22')](function(_0x352d78){_0x57fdea[_0xe239('0x1e')]=_0x352d78;if(_0x2975cb[_0xe239('0x2e')][_0xe239('0x3d')]){_0x51b542[_0xe239('0x3e')]=[{'all':!![]}];}return db[_0xe239('0x28')][_0xe239('0x3f')](_0x51b542);})[_0xe239('0x22')](function(_0x8d527){_0x57fdea[_0xe239('0x40')]=_0x8d527;return _0x57fdea;})[_0xe239('0x22')](respondWithFilteredResult(_0x1a2e8e,_0x51b542))['catch'](handleError(_0x1a2e8e,null));};exports[_0xe239('0x41')]=function(_0x447ab,_0x1ee6bb){var _0x13f178={'raw':![],'where':{'id':_0x447ab['params']['id']}},_0x28a866={};_0x28a866[_0xe239('0x2d')]=_[_0xe239('0x2f')](db[_0xe239('0x28')][_0xe239('0x29')]);_0x28a866['query']=_[_0xe239('0x2f')](_0x447ab[_0xe239('0x2e')]);_0x28a866[_0xe239('0x30')]=_[_0xe239('0x31')](_0x28a866['model'],_0x28a866[_0xe239('0x2e')]);_0x13f178['attributes']=_['intersection'](_0x28a866['model'],qs['fields'](_0x447ab[_0xe239('0x2e')][_0xe239('0x33')]));_0x13f178[_0xe239('0x32')]=_0x13f178[_0xe239('0x32')][_0xe239('0x42')]?_0x13f178[_0xe239('0x32')]:_0x28a866[_0xe239('0x2d')];if(_0x447ab[_0xe239('0x2e')][_0xe239('0x3d')]){_0x13f178[_0xe239('0x3e')]=[{'all':!![]}];}_0x13f178=_[_0xe239('0x39')]({},_0x13f178,_0x447ab[_0xe239('0x3c')]);return db[_0xe239('0x28')]['find'](_0x13f178)[_0xe239('0x22')](handleEntityNotFound(_0x1ee6bb,null))[_0xe239('0x22')](respondWithResult(_0x1ee6bb,null))['catch'](handleError(_0x1ee6bb,null));};exports['create']=function(_0x18aace,_0x556561){return db['Dynamics365Configuration'][_0xe239('0x43')](_0x18aace[_0xe239('0x44')],{})[_0xe239('0x22')](respondWithResult(_0x556561,0xc9))['catch'](handleError(_0x556561,null));};exports[_0xe239('0x45')]=function(_0x1a94a7,_0x2b65c5){if(_0x1a94a7[_0xe239('0x44')]['id']){delete _0x1a94a7[_0xe239('0x44')]['id'];}return db[_0xe239('0x28')]['find']({'where':{'id':_0x1a94a7[_0xe239('0x46')]['id']}})[_0xe239('0x22')](handleEntityNotFound(_0x2b65c5,null))[_0xe239('0x22')](saveUpdates(_0x1a94a7['body'],null))[_0xe239('0x22')](respondWithResult(_0x2b65c5,null))[_0xe239('0x47')](handleError(_0x2b65c5,null));};exports[_0xe239('0x23')]=function(_0x3664dd,_0x416bdf){return db[_0xe239('0x28')][_0xe239('0x48')]({'where':{'id':_0x3664dd[_0xe239('0x46')]['id']}})[_0xe239('0x22')](handleEntityNotFound(_0x416bdf,null))[_0xe239('0x22')](removeEntity(_0x416bdf,null))['catch'](handleError(_0x416bdf,null));};exports[_0xe239('0x49')]=function(_0x2ca932,_0x356024,_0x20abac){var _0x11cb55={};var _0x38c22d={};var _0x4ba77a;var _0x1dd46a;return db['Dynamics365Configuration']['findOne']({'where':{'id':_0x2ca932['params']['id']}})[_0xe239('0x22')](handleEntityNotFound(_0x356024,null))['then'](function(_0x1f0e14){if(_0x1f0e14){_0x4ba77a=_0x1f0e14;_0x38c22d[_0xe239('0x2d')]=_[_0xe239('0x2f')](db[_0xe239('0x4a')][_0xe239('0x29')]);_0x38c22d[_0xe239('0x2e')]=_[_0xe239('0x2f')](_0x2ca932[_0xe239('0x2e')]);_0x38c22d['filters']=_['intersection'](_0x38c22d[_0xe239('0x2d')],_0x38c22d['query']);_0x11cb55[_0xe239('0x32')]=_['intersection'](_0x38c22d['model'],qs[_0xe239('0x33')](_0x2ca932[_0xe239('0x2e')][_0xe239('0x33')]));_0x11cb55[_0xe239('0x32')]=_0x11cb55[_0xe239('0x32')]['length']?_0x11cb55['attributes']:_0x38c22d[_0xe239('0x2d')];_0x11cb55[_0xe239('0x35')]=qs[_0xe239('0x36')](_0x2ca932[_0xe239('0x2e')][_0xe239('0x36')]);_0x11cb55[_0xe239('0x37')]=qs[_0xe239('0x30')](_[_0xe239('0x38')](_0x2ca932[_0xe239('0x2e')],_0x38c22d[_0xe239('0x30')]));if(_0x2ca932[_0xe239('0x2e')][_0xe239('0x3b')]){_0x11cb55[_0xe239('0x37')]=_[_0xe239('0x39')](_0x11cb55[_0xe239('0x37')],{'$or':_[_0xe239('0x27')](_0x11cb55[_0xe239('0x32')],function(_0x26ee14){var _0x343d2f={};_0x343d2f[_0x26ee14]={'$like':'%'+_0x2ca932[_0xe239('0x2e')][_0xe239('0x3b')]+'%'};return _0x343d2f;})});}_0x11cb55=_[_0xe239('0x39')]({},_0x11cb55,_0x2ca932[_0xe239('0x3c')]);return _0x4ba77a[_0xe239('0x49')](_0x11cb55);}})['then'](function(_0x376071){if(_0x376071){_0x1dd46a=_0x376071['length'];if(!_0x2ca932[_0xe239('0x2e')][_0xe239('0x4b')]('nolimit')){_0x11cb55[_0xe239('0x1d')]=qs[_0xe239('0x1d')](_0x2ca932[_0xe239('0x2e')][_0xe239('0x1d')]);_0x11cb55[_0xe239('0x1b')]=qs[_0xe239('0x1b')](_0x2ca932[_0xe239('0x2e')][_0xe239('0x1b')]);}return _0x4ba77a[_0xe239('0x49')](_0x11cb55);}})[_0xe239('0x22')](function(_0xdb40a0){if(_0xdb40a0){return _0xdb40a0?{'count':_0x1dd46a,'rows':_0xdb40a0}:null;}})[_0xe239('0x22')](respondWithResult(_0x356024,null))['catch'](handleError(_0x356024,null));};exports[_0xe239('0x4c')]=function(_0x272d5e,_0x5f43cf,_0x46faef){var _0x518585={};var _0x209819={};var _0x23192f;var _0x6c0928;return db['Dynamics365Configuration'][_0xe239('0x4d')]({'where':{'id':_0x272d5e[_0xe239('0x46')]['id']}})[_0xe239('0x22')](handleEntityNotFound(_0x5f43cf,null))['then'](function(_0x196b4c){if(_0x196b4c){_0x23192f=_0x196b4c;_0x209819['model']=_['keys'](db[_0xe239('0x4a')][_0xe239('0x29')]);_0x209819[_0xe239('0x2e')]=_[_0xe239('0x2f')](_0x272d5e[_0xe239('0x2e')]);_0x209819[_0xe239('0x30')]=_[_0xe239('0x31')](_0x209819[_0xe239('0x2d')],_0x209819[_0xe239('0x2e')]);_0x518585[_0xe239('0x32')]=_[_0xe239('0x31')](_0x209819[_0xe239('0x2d')],qs['fields'](_0x272d5e[_0xe239('0x2e')][_0xe239('0x33')]));_0x518585[_0xe239('0x32')]=_0x518585[_0xe239('0x32')][_0xe239('0x42')]?_0x518585[_0xe239('0x32')]:_0x209819[_0xe239('0x2d')];_0x518585[_0xe239('0x35')]=qs[_0xe239('0x36')](_0x272d5e[_0xe239('0x2e')][_0xe239('0x36')]);_0x518585[_0xe239('0x37')]=qs[_0xe239('0x30')](_[_0xe239('0x38')](_0x272d5e[_0xe239('0x2e')],_0x209819[_0xe239('0x30')]));if(_0x272d5e['query'][_0xe239('0x3b')]){_0x518585[_0xe239('0x37')]=_[_0xe239('0x39')](_0x518585[_0xe239('0x37')],{'$or':_[_0xe239('0x27')](_0x518585['attributes'],function(_0x9ffcff){var _0x38c659={};_0x38c659[_0x9ffcff]={'$like':'%'+_0x272d5e[_0xe239('0x2e')]['filter']+'%'};return _0x38c659;})});}_0x518585=_[_0xe239('0x39')]({},_0x518585,_0x272d5e[_0xe239('0x3c')]);return _0x23192f[_0xe239('0x4c')](_0x518585);}})[_0xe239('0x22')](function(_0x1076d4){if(_0x1076d4){_0x6c0928=_0x1076d4[_0xe239('0x42')];if(!_0x272d5e[_0xe239('0x2e')][_0xe239('0x4b')](_0xe239('0x34'))){_0x518585[_0xe239('0x1d')]=qs['limit'](_0x272d5e[_0xe239('0x2e')][_0xe239('0x1d')]);_0x518585['offset']=qs['offset'](_0x272d5e[_0xe239('0x2e')]['offset']);}return _0x23192f['getSubjects'](_0x518585);}})[_0xe239('0x22')](function(_0x12d8f0){if(_0x12d8f0){return _0x12d8f0?{'count':_0x6c0928,'rows':_0x12d8f0}:null;}})[_0xe239('0x22')](respondWithResult(_0x5f43cf,null))[_0xe239('0x47')](handleError(_0x5f43cf,null));};exports[_0xe239('0x4e')]=function(_0x1d29f8,_0x1bde22,_0x14ef4f){var _0x1f0fd2={};var _0x3ae2a7={};var _0x5c7b35;var _0x3beb67;return db[_0xe239('0x28')][_0xe239('0x4d')]({'where':{'id':_0x1d29f8[_0xe239('0x46')]['id']}})[_0xe239('0x22')](handleEntityNotFound(_0x1bde22,null))[_0xe239('0x22')](function(_0x493d76){if(_0x493d76){_0x5c7b35=_0x493d76;_0x3ae2a7['model']=_['keys'](db[_0xe239('0x4a')]['rawAttributes']);_0x3ae2a7[_0xe239('0x2e')]=_[_0xe239('0x2f')](_0x1d29f8['query']);_0x3ae2a7[_0xe239('0x30')]=_[_0xe239('0x31')](_0x3ae2a7['model'],_0x3ae2a7['query']);_0x1f0fd2[_0xe239('0x32')]=_[_0xe239('0x31')](_0x3ae2a7[_0xe239('0x2d')],qs['fields'](_0x1d29f8[_0xe239('0x2e')][_0xe239('0x33')]));_0x1f0fd2[_0xe239('0x32')]=_0x1f0fd2['attributes'][_0xe239('0x42')]?_0x1f0fd2[_0xe239('0x32')]:_0x3ae2a7['model'];_0x1f0fd2[_0xe239('0x35')]=qs[_0xe239('0x36')](_0x1d29f8[_0xe239('0x2e')][_0xe239('0x36')]);_0x1f0fd2[_0xe239('0x37')]=qs[_0xe239('0x30')](_[_0xe239('0x38')](_0x1d29f8[_0xe239('0x2e')],_0x3ae2a7[_0xe239('0x30')]));if(_0x1d29f8['query'][_0xe239('0x3b')]){_0x1f0fd2['where']=_[_0xe239('0x39')](_0x1f0fd2[_0xe239('0x37')],{'$or':_[_0xe239('0x27')](_0x1f0fd2[_0xe239('0x32')],function(_0x489519){var _0x55e677={};_0x55e677[_0x489519]={'$like':'%'+_0x1d29f8[_0xe239('0x2e')][_0xe239('0x3b')]+'%'};return _0x55e677;})});}_0x1f0fd2=_[_0xe239('0x39')]({},_0x1f0fd2,_0x1d29f8[_0xe239('0x3c')]);return _0x5c7b35[_0xe239('0x4e')](_0x1f0fd2);}})[_0xe239('0x22')](function(_0x47e5e4){if(_0x47e5e4){_0x3beb67=_0x47e5e4[_0xe239('0x42')];if(!_0x1d29f8[_0xe239('0x2e')][_0xe239('0x4b')](_0xe239('0x34'))){_0x1f0fd2[_0xe239('0x1d')]=qs[_0xe239('0x1d')](_0x1d29f8[_0xe239('0x2e')][_0xe239('0x1d')]);_0x1f0fd2[_0xe239('0x1b')]=qs[_0xe239('0x1b')](_0x1d29f8[_0xe239('0x2e')]['offset']);}return _0x5c7b35[_0xe239('0x4e')](_0x1f0fd2);}})[_0xe239('0x22')](function(_0x37fe5f){if(_0x37fe5f){return _0x37fe5f?{'count':_0x3beb67,'rows':_0x37fe5f}:null;}})[_0xe239('0x22')](respondWithResult(_0x1bde22,null))['catch'](handleError(_0x1bde22,null));}; \ No newline at end of file +var _0x20b0=['where','merge','type','VIRTUAL','includeAll','include','findAll','keys','rawAttributes','length','options','catch','create','body','find','params','findOne','Dynamics365Field','intersection','getFields','nolimit','getSubjects','getDescriptions','eml-format','rimraf','request-promise','moment','util','path','sox','to-csv','fs-extra','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','update','then','destroy','error','stack','name','send','index','map','Dynamics365Configuration','fieldName','key','model','query','attributes','fields','hasOwnProperty','order','sort','filters','pick','filter'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x20b0,0x1e5));var _0x020b=function(_0x236341,_0x16f0de){_0x236341=_0x236341-0x0;var _0x52aa96=_0x20b0[_0x236341];return _0x52aa96;};'use strict';var emlformat=require(_0x020b('0x0'));var rimraf=require(_0x020b('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x020b('0x2'));var moment=require(_0x020b('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x020b('0x4'));var path=require(_0x020b('0x5'));var sox=require(_0x020b('0x6'));var csv=require(_0x020b('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x020b('0x8'));var _=require(_0x020b('0x9'));var squel=require('squel');var crypto=require(_0x020b('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x020b('0xb'));var toCsv=require(_0x020b('0x7'));var querystring=require(_0x020b('0xc'));var Papa=require(_0x020b('0xd'));var Redis=require(_0x020b('0xe'));var authService=require(_0x020b('0xf'));var qs=require(_0x020b('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x020b('0x11'))(_0x020b('0x12'));var utils=require(_0x020b('0x13'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x020b('0x14'))['db'];function respondWithStatusCode(_0x5a559d,_0x4bb932){_0x4bb932=_0x4bb932||0xcc;return function(_0x164813){if(_0x164813){return _0x5a559d[_0x020b('0x15')](_0x4bb932);}return _0x5a559d[_0x020b('0x16')](_0x4bb932)[_0x020b('0x17')]();};}function respondWithResult(_0x47bd18,_0x1caffc){_0x1caffc=_0x1caffc||0xc8;return function(_0x1e13da){if(_0x1e13da){return _0x47bd18[_0x020b('0x16')](_0x1caffc)[_0x020b('0x18')](_0x1e13da);}};}function respondWithFilteredResult(_0x352285,_0x11641e){return function(_0xefc155){if(_0xefc155){var _0x365c82=typeof _0x11641e[_0x020b('0x19')]===_0x020b('0x1a')&&typeof _0x11641e[_0x020b('0x1b')]===_0x020b('0x1a');var _0x173798=_0xefc155['count'];var _0x5153d0=_0x365c82?0x0:_0x11641e[_0x020b('0x19')];var _0x288460=_0x365c82?_0xefc155[_0x020b('0x1c')]:_0x11641e[_0x020b('0x19')]+_0x11641e['limit'];var _0x5ecaac;if(_0x288460>=_0x173798){_0x288460=_0x173798;_0x5ecaac=0xc8;}else{_0x5ecaac=0xce;}_0x352285[_0x020b('0x16')](_0x5ecaac);return _0x352285[_0x020b('0x1d')](_0x020b('0x1e'),_0x5153d0+'-'+_0x288460+'/'+_0x173798)[_0x020b('0x18')](_0xefc155);}return null;};}function patchUpdates(_0x228ca0){return function(_0x29e7d0){try{jsonpatch['apply'](_0x29e7d0,_0x228ca0,!![]);}catch(_0x2ef3c3){return BPromise[_0x020b('0x1f')](_0x2ef3c3);}return _0x29e7d0['save']();};}function saveUpdates(_0xea755c,_0x3aad32){return function(_0x33a23c){if(_0x33a23c){return _0x33a23c[_0x020b('0x20')](_0xea755c)[_0x020b('0x21')](function(_0x2796e3){return _0x2796e3;});}return null;};}function removeEntity(_0x39f0c5,_0x473329){return function(_0x151068){if(_0x151068){return _0x151068[_0x020b('0x22')]()['then'](function(){_0x39f0c5['status'](0xcc)[_0x020b('0x17')]();});}};}function handleEntityNotFound(_0x461e8f,_0x2a0148){return function(_0x481f75){if(!_0x481f75){_0x461e8f[_0x020b('0x15')](0x194);}return _0x481f75;};}function handleError(_0x5cf46b,_0x17dd53){_0x17dd53=_0x17dd53||0x1f4;return function(_0x4ddeac){logger[_0x020b('0x23')](_0x4ddeac[_0x020b('0x24')]);if(_0x4ddeac[_0x020b('0x25')]){delete _0x4ddeac['name'];}_0x5cf46b[_0x020b('0x16')](_0x17dd53)[_0x020b('0x26')](_0x4ddeac);};}exports[_0x020b('0x27')]=function(_0x591c02,_0x5bb19f){var _0x4736e1={},_0x4f2f1f={},_0x266bf5={'count':0x0,'rows':[]};var _0x44d015=_[_0x020b('0x28')](db[_0x020b('0x29')]['rawAttributes'],function(_0x425b09){return{'name':_0x425b09[_0x020b('0x2a')],'type':_0x425b09['type'][_0x020b('0x2b')]};});_0x4f2f1f[_0x020b('0x2c')]=_[_0x020b('0x28')](_0x44d015,_0x020b('0x25'));_0x4f2f1f['query']=_['keys'](_0x591c02[_0x020b('0x2d')]);_0x4f2f1f['filters']=_['intersection'](_0x4f2f1f['model'],_0x4f2f1f[_0x020b('0x2d')]);_0x4736e1[_0x020b('0x2e')]=_['intersection'](_0x4f2f1f[_0x020b('0x2c')],qs[_0x020b('0x2f')](_0x591c02[_0x020b('0x2d')]['fields']));_0x4736e1[_0x020b('0x2e')]=_0x4736e1[_0x020b('0x2e')]['length']?_0x4736e1[_0x020b('0x2e')]:_0x4f2f1f[_0x020b('0x2c')];if(!_0x591c02[_0x020b('0x2d')][_0x020b('0x30')]('nolimit')){_0x4736e1[_0x020b('0x1b')]=qs[_0x020b('0x1b')](_0x591c02[_0x020b('0x2d')][_0x020b('0x1b')]);_0x4736e1['offset']=qs[_0x020b('0x19')](_0x591c02[_0x020b('0x2d')][_0x020b('0x19')]);}_0x4736e1[_0x020b('0x31')]=qs[_0x020b('0x32')](_0x591c02[_0x020b('0x2d')][_0x020b('0x32')]);_0x4736e1['where']=qs[_0x020b('0x33')](_[_0x020b('0x34')](_0x591c02['query'],_0x4f2f1f['filters']),_0x44d015);if(_0x591c02[_0x020b('0x2d')][_0x020b('0x35')]){_0x4736e1[_0x020b('0x36')]=_[_0x020b('0x37')](_0x4736e1[_0x020b('0x36')],{'$or':_['map'](_0x44d015,function(_0x3aa3d5){if(_0x3aa3d5[_0x020b('0x38')]!==_0x020b('0x39')){var _0x1c8129={};_0x1c8129[_0x3aa3d5['name']]={'$like':'%'+_0x591c02['query'][_0x020b('0x35')]+'%'};return _0x1c8129;}})});}_0x4736e1=_['merge']({},_0x4736e1,_0x591c02['options']);var _0x9dfa84={'where':_0x4736e1[_0x020b('0x36')]};return db[_0x020b('0x29')][_0x020b('0x1c')](_0x9dfa84)[_0x020b('0x21')](function(_0x5b38c1){_0x266bf5[_0x020b('0x1c')]=_0x5b38c1;if(_0x591c02['query'][_0x020b('0x3a')]){_0x4736e1[_0x020b('0x3b')]=[{'all':!![]}];}return db[_0x020b('0x29')][_0x020b('0x3c')](_0x4736e1);})[_0x020b('0x21')](function(_0x58ac47){_0x266bf5['rows']=_0x58ac47;return _0x266bf5;})[_0x020b('0x21')](respondWithFilteredResult(_0x5bb19f,_0x4736e1))['catch'](handleError(_0x5bb19f,null));};exports['show']=function(_0x36c810,_0x3e88a8){var _0x403b5a={'raw':![],'where':{'id':_0x36c810['params']['id']}},_0x1acebb={};_0x1acebb[_0x020b('0x2c')]=_[_0x020b('0x3d')](db[_0x020b('0x29')][_0x020b('0x3e')]);_0x1acebb[_0x020b('0x2d')]=_[_0x020b('0x3d')](_0x36c810['query']);_0x1acebb['filters']=_['intersection'](_0x1acebb['model'],_0x1acebb[_0x020b('0x2d')]);_0x403b5a[_0x020b('0x2e')]=_['intersection'](_0x1acebb[_0x020b('0x2c')],qs[_0x020b('0x2f')](_0x36c810['query'][_0x020b('0x2f')]));_0x403b5a[_0x020b('0x2e')]=_0x403b5a[_0x020b('0x2e')][_0x020b('0x3f')]?_0x403b5a['attributes']:_0x1acebb[_0x020b('0x2c')];if(_0x36c810[_0x020b('0x2d')]['includeAll']){_0x403b5a[_0x020b('0x3b')]=[{'all':!![]}];}_0x403b5a=_[_0x020b('0x37')]({},_0x403b5a,_0x36c810[_0x020b('0x40')]);return db[_0x020b('0x29')]['find'](_0x403b5a)[_0x020b('0x21')](handleEntityNotFound(_0x3e88a8,null))[_0x020b('0x21')](respondWithResult(_0x3e88a8,null))[_0x020b('0x41')](handleError(_0x3e88a8,null));};exports[_0x020b('0x42')]=function(_0x27f1d2,_0x4bb6f9){return db[_0x020b('0x29')][_0x020b('0x42')](_0x27f1d2[_0x020b('0x43')],{})['then'](respondWithResult(_0x4bb6f9,0xc9))[_0x020b('0x41')](handleError(_0x4bb6f9,null));};exports[_0x020b('0x20')]=function(_0x343487,_0x308e6f){if(_0x343487[_0x020b('0x43')]['id']){delete _0x343487[_0x020b('0x43')]['id'];}return db[_0x020b('0x29')][_0x020b('0x44')]({'where':{'id':_0x343487['params']['id']}})['then'](handleEntityNotFound(_0x308e6f,null))[_0x020b('0x21')](saveUpdates(_0x343487[_0x020b('0x43')],null))[_0x020b('0x21')](respondWithResult(_0x308e6f,null))[_0x020b('0x41')](handleError(_0x308e6f,null));};exports[_0x020b('0x22')]=function(_0x3e2dfb,_0x460376){return db[_0x020b('0x29')]['find']({'where':{'id':_0x3e2dfb[_0x020b('0x45')]['id']}})[_0x020b('0x21')](handleEntityNotFound(_0x460376,null))[_0x020b('0x21')](removeEntity(_0x460376,null))['catch'](handleError(_0x460376,null));};exports['getFields']=function(_0x36ae89,_0x48c08a,_0x58ffdc){var _0x28d3a6={};var _0x25ed74={};var _0x3932a9;var _0x3002c1;return db['Dynamics365Configuration'][_0x020b('0x46')]({'where':{'id':_0x36ae89['params']['id']}})['then'](handleEntityNotFound(_0x48c08a,null))['then'](function(_0x5128e0){if(_0x5128e0){_0x3932a9=_0x5128e0;_0x25ed74[_0x020b('0x2c')]=_[_0x020b('0x3d')](db[_0x020b('0x47')][_0x020b('0x3e')]);_0x25ed74[_0x020b('0x2d')]=_[_0x020b('0x3d')](_0x36ae89[_0x020b('0x2d')]);_0x25ed74[_0x020b('0x33')]=_[_0x020b('0x48')](_0x25ed74[_0x020b('0x2c')],_0x25ed74[_0x020b('0x2d')]);_0x28d3a6['attributes']=_[_0x020b('0x48')](_0x25ed74['model'],qs['fields'](_0x36ae89[_0x020b('0x2d')]['fields']));_0x28d3a6[_0x020b('0x2e')]=_0x28d3a6[_0x020b('0x2e')]['length']?_0x28d3a6[_0x020b('0x2e')]:_0x25ed74['model'];_0x28d3a6[_0x020b('0x31')]=qs['sort'](_0x36ae89['query'][_0x020b('0x32')]);_0x28d3a6[_0x020b('0x36')]=qs[_0x020b('0x33')](_['pick'](_0x36ae89[_0x020b('0x2d')],_0x25ed74[_0x020b('0x33')]));if(_0x36ae89['query'][_0x020b('0x35')]){_0x28d3a6[_0x020b('0x36')]=_['merge'](_0x28d3a6['where'],{'$or':_[_0x020b('0x28')](_0x28d3a6[_0x020b('0x2e')],function(_0x10ff61){var _0x36fbc6={};_0x36fbc6[_0x10ff61]={'$like':'%'+_0x36ae89[_0x020b('0x2d')][_0x020b('0x35')]+'%'};return _0x36fbc6;})});}_0x28d3a6=_[_0x020b('0x37')]({},_0x28d3a6,_0x36ae89[_0x020b('0x40')]);return _0x3932a9[_0x020b('0x49')](_0x28d3a6);}})['then'](function(_0x56892a){if(_0x56892a){_0x3002c1=_0x56892a['length'];if(!_0x36ae89['query'][_0x020b('0x30')](_0x020b('0x4a'))){_0x28d3a6['limit']=qs[_0x020b('0x1b')](_0x36ae89['query'][_0x020b('0x1b')]);_0x28d3a6[_0x020b('0x19')]=qs[_0x020b('0x19')](_0x36ae89[_0x020b('0x2d')][_0x020b('0x19')]);}return _0x3932a9[_0x020b('0x49')](_0x28d3a6);}})[_0x020b('0x21')](function(_0x65152a){if(_0x65152a){return _0x65152a?{'count':_0x3002c1,'rows':_0x65152a}:null;}})['then'](respondWithResult(_0x48c08a,null))[_0x020b('0x41')](handleError(_0x48c08a,null));};exports[_0x020b('0x4b')]=function(_0x2be3,_0x4ef8d2,_0x500418){var _0x5bc94c={};var _0x1cf434={};var _0x58a326;var _0x469e41;return db[_0x020b('0x29')][_0x020b('0x46')]({'where':{'id':_0x2be3['params']['id']}})[_0x020b('0x21')](handleEntityNotFound(_0x4ef8d2,null))[_0x020b('0x21')](function(_0x54cbf2){if(_0x54cbf2){_0x58a326=_0x54cbf2;_0x1cf434[_0x020b('0x2c')]=_['keys'](db['Dynamics365Field'][_0x020b('0x3e')]);_0x1cf434[_0x020b('0x2d')]=_[_0x020b('0x3d')](_0x2be3[_0x020b('0x2d')]);_0x1cf434['filters']=_[_0x020b('0x48')](_0x1cf434[_0x020b('0x2c')],_0x1cf434[_0x020b('0x2d')]);_0x5bc94c[_0x020b('0x2e')]=_[_0x020b('0x48')](_0x1cf434[_0x020b('0x2c')],qs[_0x020b('0x2f')](_0x2be3['query'][_0x020b('0x2f')]));_0x5bc94c[_0x020b('0x2e')]=_0x5bc94c[_0x020b('0x2e')][_0x020b('0x3f')]?_0x5bc94c['attributes']:_0x1cf434[_0x020b('0x2c')];_0x5bc94c[_0x020b('0x31')]=qs[_0x020b('0x32')](_0x2be3[_0x020b('0x2d')]['sort']);_0x5bc94c[_0x020b('0x36')]=qs[_0x020b('0x33')](_[_0x020b('0x34')](_0x2be3[_0x020b('0x2d')],_0x1cf434[_0x020b('0x33')]));if(_0x2be3[_0x020b('0x2d')]['filter']){_0x5bc94c[_0x020b('0x36')]=_['merge'](_0x5bc94c[_0x020b('0x36')],{'$or':_[_0x020b('0x28')](_0x5bc94c[_0x020b('0x2e')],function(_0x36b470){var _0x5bcd93={};_0x5bcd93[_0x36b470]={'$like':'%'+_0x2be3[_0x020b('0x2d')]['filter']+'%'};return _0x5bcd93;})});}_0x5bc94c=_[_0x020b('0x37')]({},_0x5bc94c,_0x2be3['options']);return _0x58a326[_0x020b('0x4b')](_0x5bc94c);}})[_0x020b('0x21')](function(_0x69d813){if(_0x69d813){_0x469e41=_0x69d813[_0x020b('0x3f')];if(!_0x2be3[_0x020b('0x2d')][_0x020b('0x30')](_0x020b('0x4a'))){_0x5bc94c[_0x020b('0x1b')]=qs[_0x020b('0x1b')](_0x2be3[_0x020b('0x2d')][_0x020b('0x1b')]);_0x5bc94c[_0x020b('0x19')]=qs[_0x020b('0x19')](_0x2be3[_0x020b('0x2d')][_0x020b('0x19')]);}return _0x58a326['getSubjects'](_0x5bc94c);}})[_0x020b('0x21')](function(_0x1a37db){if(_0x1a37db){return _0x1a37db?{'count':_0x469e41,'rows':_0x1a37db}:null;}})[_0x020b('0x21')](respondWithResult(_0x4ef8d2,null))[_0x020b('0x41')](handleError(_0x4ef8d2,null));};exports['getDescriptions']=function(_0x113d2d,_0x219aa7,_0x480a9d){var _0x25527d={};var _0x381f9d={};var _0x3900d4;var _0x3191a1;return db[_0x020b('0x29')][_0x020b('0x46')]({'where':{'id':_0x113d2d[_0x020b('0x45')]['id']}})['then'](handleEntityNotFound(_0x219aa7,null))[_0x020b('0x21')](function(_0xb5f6e){if(_0xb5f6e){_0x3900d4=_0xb5f6e;_0x381f9d[_0x020b('0x2c')]=_[_0x020b('0x3d')](db[_0x020b('0x47')][_0x020b('0x3e')]);_0x381f9d[_0x020b('0x2d')]=_[_0x020b('0x3d')](_0x113d2d[_0x020b('0x2d')]);_0x381f9d['filters']=_['intersection'](_0x381f9d['model'],_0x381f9d[_0x020b('0x2d')]);_0x25527d[_0x020b('0x2e')]=_[_0x020b('0x48')](_0x381f9d[_0x020b('0x2c')],qs[_0x020b('0x2f')](_0x113d2d[_0x020b('0x2d')][_0x020b('0x2f')]));_0x25527d[_0x020b('0x2e')]=_0x25527d[_0x020b('0x2e')][_0x020b('0x3f')]?_0x25527d['attributes']:_0x381f9d[_0x020b('0x2c')];_0x25527d[_0x020b('0x31')]=qs[_0x020b('0x32')](_0x113d2d[_0x020b('0x2d')][_0x020b('0x32')]);_0x25527d['where']=qs[_0x020b('0x33')](_[_0x020b('0x34')](_0x113d2d[_0x020b('0x2d')],_0x381f9d[_0x020b('0x33')]));if(_0x113d2d['query'][_0x020b('0x35')]){_0x25527d[_0x020b('0x36')]=_['merge'](_0x25527d['where'],{'$or':_[_0x020b('0x28')](_0x25527d['attributes'],function(_0x5d4fe3){var _0x533c10={};_0x533c10[_0x5d4fe3]={'$like':'%'+_0x113d2d[_0x020b('0x2d')][_0x020b('0x35')]+'%'};return _0x533c10;})});}_0x25527d=_[_0x020b('0x37')]({},_0x25527d,_0x113d2d['options']);return _0x3900d4[_0x020b('0x4c')](_0x25527d);}})[_0x020b('0x21')](function(_0x1a1d9b){if(_0x1a1d9b){_0x3191a1=_0x1a1d9b[_0x020b('0x3f')];if(!_0x113d2d['query']['hasOwnProperty'](_0x020b('0x4a'))){_0x25527d[_0x020b('0x1b')]=qs[_0x020b('0x1b')](_0x113d2d[_0x020b('0x2d')][_0x020b('0x1b')]);_0x25527d[_0x020b('0x19')]=qs[_0x020b('0x19')](_0x113d2d[_0x020b('0x2d')][_0x020b('0x19')]);}return _0x3900d4[_0x020b('0x4c')](_0x25527d);}})['then'](function(_0x1b9663){if(_0x1b9663){return _0x1b9663?{'count':_0x3191a1,'rows':_0x1b9663}:null;}})[_0x020b('0x21')](respondWithResult(_0x219aa7,null))['catch'](handleError(_0x219aa7,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js index d9dd41e..d85ba10 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 _0xdace=['../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','exports','Dynamics365Configuration','int_dynamics365_configurations','lodash'];(function(_0x37ff0b,_0x43e1d6){var _0x3d7c63=function(_0x446343){while(--_0x446343){_0x37ff0b['push'](_0x37ff0b['shift']());}};_0x3d7c63(++_0x43e1d6);}(_0xdace,0xc5));var _0xedac=function(_0x50aa2e,_0xfbd6f0){_0x50aa2e=_0x50aa2e-0x0;var _0x5e07f0=_0xdace[_0x50aa2e];return _0x5e07f0;};'use strict';var _=require(_0xedac('0x0'));var util=require('util');var logger=require(_0xedac('0x1'))(_0xedac('0x2'));var moment=require(_0xedac('0x3'));var BPromise=require('bluebird');var rp=require(_0xedac('0x4'));var fs=require('fs');var path=require(_0xedac('0x5'));var rimraf=require(_0xedac('0x6'));var config=require(_0xedac('0x7'));var attributes=require('./intDynamics365Configuration.attributes');module[_0xedac('0x8')]=function(_0x1cba89,_0x39328a){return _0x1cba89['define'](_0xedac('0x9'),attributes,{'tableName':_0xedac('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9bde=['request-promise','path','rimraf','../../config/environment','./intDynamics365Configuration.attributes','exports','define','Dynamics365Configuration','int_dynamics365_configurations','util','api','bluebird'];(function(_0x4e3252,_0x5888f8){var _0x41589f=function(_0x5aabf9){while(--_0x5aabf9){_0x4e3252['push'](_0x4e3252['shift']());}};_0x41589f(++_0x5888f8);}(_0x9bde,0xe1));var _0xe9bd=function(_0x1cb02c,_0x3f4bd0){_0x1cb02c=_0x1cb02c-0x0;var _0x397c4c=_0x9bde[_0x1cb02c];return _0x397c4c;};'use strict';var _=require('lodash');var util=require(_0xe9bd('0x0'));var logger=require('../../config/logger')(_0xe9bd('0x1'));var moment=require('moment');var BPromise=require(_0xe9bd('0x2'));var rp=require(_0xe9bd('0x3'));var fs=require('fs');var path=require(_0xe9bd('0x4'));var rimraf=require(_0xe9bd('0x5'));var config=require(_0xe9bd('0x6'));var attributes=require(_0xe9bd('0x7'));module[_0xe9bd('0x8')]=function(_0x4fd7b8,_0x4763e9){return _0x4fd7b8[_0xe9bd('0x9')](_0xe9bd('0xa'),attributes,{'tableName':_0xe9bd('0xb'),'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 4fc6092..95b877e 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 _0xd758=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','info','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util','bluebird'];(function(_0x413feb,_0x10477f){var _0x40ee88=function(_0x32a3f6){while(--_0x32a3f6){_0x413feb['push'](_0x413feb['shift']());}};_0x40ee88(++_0x10477f);}(_0xd758,0x1e1));var _0x8d75=function(_0x2cfca6,_0x4756bd){_0x2cfca6=_0x2cfca6-0x0;var _0xeb27c2=_0xd758[_0x2cfca6];return _0xeb27c2;};'use strict';var _=require(_0x8d75('0x0'));var util=require(_0x8d75('0x1'));var moment=require('moment');var BPromise=require(_0x8d75('0x2'));var rs=require(_0x8d75('0x3'));var fs=require('fs');var Redis=require(_0x8d75('0x4'));var db=require(_0x8d75('0x5'))['db'];var utils=require(_0x8d75('0x6'));var logger=require(_0x8d75('0x7'))(_0x8d75('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x8d75('0x9')][_0x8d75('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xbbf743,_0x4d84d1,_0x29f7f0){return new BPromise(function(_0x555e60,_0x2b9044){return client[_0x8d75('0xb')](_0xbbf743,_0x29f7f0)['then'](function(_0x26766e){logger[_0x8d75('0xc')](_0x8d75('0xd'),_0x4d84d1,_0x8d75('0xe'));logger[_0x8d75('0xf')]('Dynamics365Configuration,\x20%s,\x20%s,\x20%s',_0x4d84d1,_0x8d75('0xe'),JSON[_0x8d75('0x10')](_0x26766e));if(_0x26766e[_0x8d75('0x11')]){if(_0x26766e[_0x8d75('0x11')][_0x8d75('0x12')]===0x1f4){logger[_0x8d75('0x11')]('Dynamics365Configuration,\x20%s,\x20%s',_0x4d84d1,_0x26766e[_0x8d75('0x11')][_0x8d75('0x13')]);return _0x2b9044(_0x26766e[_0x8d75('0x11')][_0x8d75('0x13')]);}logger[_0x8d75('0x11')]('Dynamics365Configuration,\x20%s,\x20%s',_0x4d84d1,_0x26766e[_0x8d75('0x11')][_0x8d75('0x13')]);return _0x555e60(_0x26766e[_0x8d75('0x11')][_0x8d75('0x13')]);}else{logger[_0x8d75('0xc')](_0x8d75('0xd'),_0x4d84d1,_0x8d75('0xe'));_0x555e60(_0x26766e[_0x8d75('0x14')][_0x8d75('0x13')]);}})[_0x8d75('0x15')](function(_0xc6a51e){logger[_0x8d75('0x11')](_0x8d75('0xd'),_0x4d84d1,_0xc6a51e);_0x2b9044(_0xc6a51e);});});} \ No newline at end of file +var _0xa520=['debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','stringify','error','code','Dynamics365Configuration,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','request\x20sent'];(function(_0x231a47,_0x46a963){var _0x48d7c9=function(_0x1e69b1){while(--_0x1e69b1){_0x231a47['push'](_0x231a47['shift']());}};_0x48d7c9(++_0x46a963);}(_0xa520,0xe1));var _0x0a52=function(_0x5c2d51,_0x400d19){_0x5c2d51=_0x5c2d51-0x0;var _0x10f8ab=_0xa520[_0x5c2d51];return _0x10f8ab;};'use strict';var _=require(_0x0a52('0x0'));var util=require(_0x0a52('0x1'));var moment=require(_0x0a52('0x2'));var BPromise=require(_0x0a52('0x3'));var rs=require(_0x0a52('0x4'));var fs=require('fs');var Redis=require(_0x0a52('0x5'));var db=require(_0x0a52('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x0a52('0x7'))('rpc');var config=require(_0x0a52('0x8'));var jayson=require(_0x0a52('0x9'));var client=jayson[_0x0a52('0xa')][_0x0a52('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3bc972,_0x8b9a55,_0x3e0764){return new BPromise(function(_0x24ae33,_0x2f909e){return client['request'](_0x3bc972,_0x3e0764)[_0x0a52('0xc')](function(_0x5b485f){logger[_0x0a52('0xd')]('Dynamics365Configuration,\x20%s,\x20%s',_0x8b9a55,_0x0a52('0xe'));logger[_0x0a52('0xf')](_0x0a52('0x10'),_0x8b9a55,_0x0a52('0xe'),JSON[_0x0a52('0x11')](_0x5b485f));if(_0x5b485f['error']){if(_0x5b485f[_0x0a52('0x12')][_0x0a52('0x13')]===0x1f4){logger[_0x0a52('0x12')](_0x0a52('0x14'),_0x8b9a55,_0x5b485f[_0x0a52('0x12')]['message']);return _0x2f909e(_0x5b485f[_0x0a52('0x12')][_0x0a52('0x15')]);}logger[_0x0a52('0x12')](_0x0a52('0x14'),_0x8b9a55,_0x5b485f['error'][_0x0a52('0x15')]);return _0x24ae33(_0x5b485f[_0x0a52('0x12')][_0x0a52('0x15')]);}else{logger[_0x0a52('0xd')]('Dynamics365Configuration,\x20%s,\x20%s',_0x8b9a55,_0x0a52('0xe'));_0x24ae33(_0x5b485f[_0x0a52('0x16')]['message']);}})[_0x0a52('0x17')](function(_0x16142){logger[_0x0a52('0x12')](_0x0a52('0x14'),_0x8b9a55,_0x16142);_0x2f909e(_0x16142);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Field/index.js b/server/api/intDynamics365Field/index.js index 842f832..ac25ee9 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 _0x8570=['util','express','Router','fs-extra','../../components/auth/service','../../config/environment','./intDynamics365Field.controller','get','isAuthenticated','index','/:id','show','post','put','update','destroy','exports','multer'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x8570,0xc5));var _0x0857=function(_0x260523,_0x187e1e){_0x260523=_0x260523-0x0;var _0x27979e=_0x8570[_0x260523];return _0x27979e;};'use strict';var multer=require(_0x0857('0x0'));var util=require(_0x0857('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x0857('0x2'));var router=express[_0x0857('0x3')]();var fs_extra=require(_0x0857('0x4'));var auth=require(_0x0857('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x0857('0x6'));var controller=require(_0x0857('0x7'));router[_0x0857('0x8')]('/',auth[_0x0857('0x9')](),controller[_0x0857('0xa')]);router[_0x0857('0x8')](_0x0857('0xb'),auth[_0x0857('0x9')](),controller[_0x0857('0xc')]);router[_0x0857('0xd')]('/',auth[_0x0857('0x9')](),controller['create']);router[_0x0857('0xe')](_0x0857('0xb'),auth[_0x0857('0x9')](),controller[_0x0857('0xf')]);router['delete'](_0x0857('0xb'),auth[_0x0857('0x9')](),controller[_0x0857('0x10')]);module[_0x0857('0x11')]=router; \ No newline at end of file +var _0x66eb=['post','create','put','update','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Field.controller','get','isAuthenticated','index','/:id','show'];(function(_0x6dd5c,_0x4bfc19){var _0x5a87fa=function(_0x3b068b){while(--_0x3b068b){_0x6dd5c['push'](_0x6dd5c['shift']());}};_0x5a87fa(++_0x4bfc19);}(_0x66eb,0x1d5));var _0xb66e=function(_0x156a0d,_0x3946ce){_0x156a0d=_0x156a0d-0x0;var _0x98a9ba=_0x66eb[_0x156a0d];return _0x98a9ba;};'use strict';var multer=require(_0xb66e('0x0'));var util=require(_0xb66e('0x1'));var path=require(_0xb66e('0x2'));var timeout=require('connect-timeout');var express=require(_0xb66e('0x3'));var router=express[_0xb66e('0x4')]();var fs_extra=require(_0xb66e('0x5'));var auth=require(_0xb66e('0x6'));var interaction=require(_0xb66e('0x7'));var config=require(_0xb66e('0x8'));var controller=require(_0xb66e('0x9'));router[_0xb66e('0xa')]('/',auth[_0xb66e('0xb')](),controller[_0xb66e('0xc')]);router[_0xb66e('0xa')](_0xb66e('0xd'),auth[_0xb66e('0xb')](),controller[_0xb66e('0xe')]);router[_0xb66e('0xf')]('/',auth['isAuthenticated'](),controller[_0xb66e('0x10')]);router[_0xb66e('0x11')](_0xb66e('0xd'),auth['isAuthenticated'](),controller[_0xb66e('0x12')]);router[_0xb66e('0x13')](_0xb66e('0xd'),auth['isAuthenticated'](),controller[_0xb66e('0x14')]);module[_0xb66e('0x15')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.attributes.js b/server/api/intDynamics365Field/intDynamics365Field.attributes.js index ae583ae..80169c0 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 _0x3123=['variable','customVariable','keyValue','picklist','STRING','sequelize','exports','ENUM','string'];(function(_0x2a5700,_0x4804bd){var _0x220aac=function(_0x3193e3){while(--_0x3193e3){_0x2a5700['push'](_0x2a5700['shift']());}};_0x220aac(++_0x4804bd);}(_0x3123,0x140));var _0x3312=function(_0xca72ed,_0x67cde1){_0xca72ed=_0xca72ed-0x0;var _0x2a6da1=_0x3123[_0xca72ed];return _0x2a6da1;};'use strict';var Sequelize=require(_0x3312('0x0'));module[_0x3312('0x1')]={'type':{'type':Sequelize[_0x3312('0x2')](_0x3312('0x3'),_0x3312('0x4'),_0x3312('0x5'),_0x3312('0x6'),_0x3312('0x7')),'defaultValue':_0x3312('0x3')},'content':{'type':Sequelize[_0x3312('0x8')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x3312('0x2')](_0x3312('0x3'),'variable','customVariable')},'keyContent':{'type':Sequelize[_0x3312('0x8')]},'idField':{'type':Sequelize[_0x3312('0x8')]},'nameField':{'type':Sequelize[_0x3312('0x8')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x3312('0x8')]}}; \ No newline at end of file +var _0x3356=['keyValue','picklist','STRING','BOOLEAN','sequelize','exports','string','variable','customVariable'];(function(_0x3e18fd,_0x42ade7){var _0x3639a2=function(_0x4347ed){while(--_0x4347ed){_0x3e18fd['push'](_0x3e18fd['shift']());}};_0x3639a2(++_0x42ade7);}(_0x3356,0x1bd));var _0x6335=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x3356[_0xfae23b];return _0x200640;};'use strict';var Sequelize=require(_0x6335('0x0'));module[_0x6335('0x1')]={'type':{'type':Sequelize['ENUM'](_0x6335('0x2'),_0x6335('0x3'),_0x6335('0x4'),_0x6335('0x5'),_0x6335('0x6')),'defaultValue':'string'},'content':{'type':Sequelize[_0x6335('0x7')]},'key':{'type':Sequelize[_0x6335('0x7')]},'keyType':{'type':Sequelize['ENUM']('string','variable','customVariable')},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x6335('0x7')]},'nameField':{'type':Sequelize[_0x6335('0x7')]},'customField':{'type':Sequelize[_0x6335('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x6335('0x7')]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.controller.js b/server/api/intDynamics365Field/intDynamics365Field.controller.js index 03c7764..a6aefce 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 _0x6c5b=['status','end','json','offset','undefined','limit','count','apply','reject','save','update','then','error','stack','name','send','index','map','Dynamics365Field','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','params','rawAttributes','include','catch','create','body','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus'];(function(_0x53909e,_0x1b7ab6){var _0xb3232=function(_0x5c475d){while(--_0x5c475d){_0x53909e['push'](_0x53909e['shift']());}};_0xb3232(++_0x1b7ab6);}(_0x6c5b,0x119));var _0xb6c5=function(_0x59fa6d,_0x462288){_0x59fa6d=_0x59fa6d-0x0;var _0x420751=_0x6c5b[_0x59fa6d];return _0x420751;};'use strict';var emlformat=require(_0xb6c5('0x0'));var rimraf=require(_0xb6c5('0x1'));var zipdir=require(_0xb6c5('0x2'));var jsonpatch=require(_0xb6c5('0x3'));var rp=require(_0xb6c5('0x4'));var moment=require('moment');var BPromise=require(_0xb6c5('0x5'));var Mustache=require(_0xb6c5('0x6'));var util=require(_0xb6c5('0x7'));var path=require('path');var sox=require(_0xb6c5('0x8'));var csv=require(_0xb6c5('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb6c5('0xa'));var _=require(_0xb6c5('0xb'));var squel=require(_0xb6c5('0xc'));var crypto=require(_0xb6c5('0xd'));var jsforce=require(_0xb6c5('0xe'));var deskjs=require(_0xb6c5('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xb6c5('0x10'));var Redis=require(_0xb6c5('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xb6c5('0x12'));var as=require(_0xb6c5('0x13'));var hardwareService=require(_0xb6c5('0x14'));var logger=require('../../config/logger')(_0xb6c5('0x15'));var utils=require(_0xb6c5('0x16'));var config=require(_0xb6c5('0x17'));var licenseUtil=require(_0xb6c5('0x18'));var db=require(_0xb6c5('0x19'))['db'];function respondWithStatusCode(_0x25d816,_0x1484ac){_0x1484ac=_0x1484ac||0xcc;return function(_0x237b69){if(_0x237b69){return _0x25d816[_0xb6c5('0x1a')](_0x1484ac);}return _0x25d816[_0xb6c5('0x1b')](_0x1484ac)[_0xb6c5('0x1c')]();};}function respondWithResult(_0x4ac196,_0x365106){_0x365106=_0x365106||0xc8;return function(_0x1edf9c){if(_0x1edf9c){return _0x4ac196[_0xb6c5('0x1b')](_0x365106)[_0xb6c5('0x1d')](_0x1edf9c);}};}function respondWithFilteredResult(_0x1a2ef1,_0x54409b){return function(_0x4de563){if(_0x4de563){var _0x3ccec4=typeof _0x54409b[_0xb6c5('0x1e')]===_0xb6c5('0x1f')&&typeof _0x54409b[_0xb6c5('0x20')]===_0xb6c5('0x1f');var _0x26b8ac=_0x4de563[_0xb6c5('0x21')];var _0x5168d6=_0x3ccec4?0x0:_0x54409b['offset'];var _0x1a4acb=_0x3ccec4?_0x4de563[_0xb6c5('0x21')]:_0x54409b[_0xb6c5('0x1e')]+_0x54409b[_0xb6c5('0x20')];var _0x5ab5fc;if(_0x1a4acb>=_0x26b8ac){_0x1a4acb=_0x26b8ac;_0x5ab5fc=0xc8;}else{_0x5ab5fc=0xce;}_0x1a2ef1[_0xb6c5('0x1b')](_0x5ab5fc);return _0x1a2ef1['set']('Content-Range',_0x5168d6+'-'+_0x1a4acb+'/'+_0x26b8ac)[_0xb6c5('0x1d')](_0x4de563);}return null;};}function patchUpdates(_0x50057b){return function(_0x1d92a8){try{jsonpatch[_0xb6c5('0x22')](_0x1d92a8,_0x50057b,!![]);}catch(_0x5206aa){return BPromise[_0xb6c5('0x23')](_0x5206aa);}return _0x1d92a8[_0xb6c5('0x24')]();};}function saveUpdates(_0x266be0,_0x318f4a){return function(_0x3de272){if(_0x3de272){return _0x3de272[_0xb6c5('0x25')](_0x266be0)[_0xb6c5('0x26')](function(_0x47c30b){return _0x47c30b;});}return null;};}function removeEntity(_0x193929,_0x35bf6e){return function(_0x5112f8){if(_0x5112f8){return _0x5112f8['destroy']()[_0xb6c5('0x26')](function(){_0x193929[_0xb6c5('0x1b')](0xcc)[_0xb6c5('0x1c')]();});}};}function handleEntityNotFound(_0xfc37b,_0xa83ddb){return function(_0x1fc59e){if(!_0x1fc59e){_0xfc37b['sendStatus'](0x194);}return _0x1fc59e;};}function handleError(_0x4001ba,_0x257a3b){_0x257a3b=_0x257a3b||0x1f4;return function(_0x3c39b4){logger[_0xb6c5('0x27')](_0x3c39b4[_0xb6c5('0x28')]);if(_0x3c39b4[_0xb6c5('0x29')]){delete _0x3c39b4[_0xb6c5('0x29')];}_0x4001ba[_0xb6c5('0x1b')](_0x257a3b)[_0xb6c5('0x2a')](_0x3c39b4);};}exports[_0xb6c5('0x2b')]=function(_0x535724,_0x5829df){var _0x1344cb={},_0x4725a0={},_0x2913ae={'count':0x0,'rows':[]};var _0x15df8f=_[_0xb6c5('0x2c')](db[_0xb6c5('0x2d')]['rawAttributes'],function(_0x2987af){return{'name':_0x2987af[_0xb6c5('0x2e')],'type':_0x2987af[_0xb6c5('0x2f')][_0xb6c5('0x30')]};});_0x4725a0[_0xb6c5('0x31')]=_[_0xb6c5('0x2c')](_0x15df8f,_0xb6c5('0x29'));_0x4725a0[_0xb6c5('0x32')]=_[_0xb6c5('0x33')](_0x535724[_0xb6c5('0x32')]);_0x4725a0[_0xb6c5('0x34')]=_[_0xb6c5('0x35')](_0x4725a0['model'],_0x4725a0[_0xb6c5('0x32')]);_0x1344cb['attributes']=_[_0xb6c5('0x35')](_0x4725a0[_0xb6c5('0x31')],qs[_0xb6c5('0x36')](_0x535724[_0xb6c5('0x32')][_0xb6c5('0x36')]));_0x1344cb[_0xb6c5('0x37')]=_0x1344cb[_0xb6c5('0x37')][_0xb6c5('0x38')]?_0x1344cb[_0xb6c5('0x37')]:_0x4725a0[_0xb6c5('0x31')];if(!_0x535724[_0xb6c5('0x32')][_0xb6c5('0x39')](_0xb6c5('0x3a'))){_0x1344cb[_0xb6c5('0x20')]=qs['limit'](_0x535724['query'][_0xb6c5('0x20')]);_0x1344cb[_0xb6c5('0x1e')]=qs[_0xb6c5('0x1e')](_0x535724['query'][_0xb6c5('0x1e')]);}_0x1344cb[_0xb6c5('0x3b')]=qs[_0xb6c5('0x3c')](_0x535724[_0xb6c5('0x32')][_0xb6c5('0x3c')]);_0x1344cb[_0xb6c5('0x3d')]=qs[_0xb6c5('0x34')](_[_0xb6c5('0x3e')](_0x535724[_0xb6c5('0x32')],_0x4725a0['filters']),_0x15df8f);if(_0x535724[_0xb6c5('0x32')][_0xb6c5('0x3f')]){_0x1344cb['where']=_[_0xb6c5('0x40')](_0x1344cb[_0xb6c5('0x3d')],{'$or':_[_0xb6c5('0x2c')](_0x15df8f,function(_0x5722eb){if(_0x5722eb[_0xb6c5('0x2f')]!==_0xb6c5('0x41')){var _0x3b5e09={};_0x3b5e09[_0x5722eb[_0xb6c5('0x29')]]={'$like':'%'+_0x535724[_0xb6c5('0x32')][_0xb6c5('0x3f')]+'%'};return _0x3b5e09;}})});}_0x1344cb=_[_0xb6c5('0x40')]({},_0x1344cb,_0x535724[_0xb6c5('0x42')]);var _0xc68dd0={'where':_0x1344cb['where']};return db[_0xb6c5('0x2d')][_0xb6c5('0x21')](_0xc68dd0)['then'](function(_0x2e1f2e){_0x2913ae[_0xb6c5('0x21')]=_0x2e1f2e;if(_0x535724[_0xb6c5('0x32')][_0xb6c5('0x43')]){_0x1344cb['include']=[{'all':!![]}];}return db[_0xb6c5('0x2d')][_0xb6c5('0x44')](_0x1344cb);})[_0xb6c5('0x26')](function(_0x192dc7){_0x2913ae[_0xb6c5('0x45')]=_0x192dc7;return _0x2913ae;})[_0xb6c5('0x26')](respondWithFilteredResult(_0x5829df,_0x1344cb))['catch'](handleError(_0x5829df,null));};exports['show']=function(_0x52a263,_0x3c6758){var _0x29a22a={'raw':!![],'where':{'id':_0x52a263[_0xb6c5('0x46')]['id']}},_0x14eb2f={};_0x14eb2f['model']=_[_0xb6c5('0x33')](db[_0xb6c5('0x2d')][_0xb6c5('0x47')]);_0x14eb2f[_0xb6c5('0x32')]=_['keys'](_0x52a263[_0xb6c5('0x32')]);_0x14eb2f['filters']=_[_0xb6c5('0x35')](_0x14eb2f[_0xb6c5('0x31')],_0x14eb2f[_0xb6c5('0x32')]);_0x29a22a['attributes']=_[_0xb6c5('0x35')](_0x14eb2f['model'],qs[_0xb6c5('0x36')](_0x52a263[_0xb6c5('0x32')][_0xb6c5('0x36')]));_0x29a22a[_0xb6c5('0x37')]=_0x29a22a[_0xb6c5('0x37')][_0xb6c5('0x38')]?_0x29a22a[_0xb6c5('0x37')]:_0x14eb2f[_0xb6c5('0x31')];if(_0x52a263[_0xb6c5('0x32')]['includeAll']){_0x29a22a[_0xb6c5('0x48')]=[{'all':!![]}];}_0x29a22a=_[_0xb6c5('0x40')]({},_0x29a22a,_0x52a263['options']);return db[_0xb6c5('0x2d')]['find'](_0x29a22a)['then'](handleEntityNotFound(_0x3c6758,null))[_0xb6c5('0x26')](respondWithResult(_0x3c6758,null))[_0xb6c5('0x49')](handleError(_0x3c6758,null));};exports[_0xb6c5('0x4a')]=function(_0x80dd8b,_0x3c151a){return db[_0xb6c5('0x2d')]['create'](_0x80dd8b[_0xb6c5('0x4b')],{})[_0xb6c5('0x26')](respondWithResult(_0x3c151a,0xc9))[_0xb6c5('0x49')](handleError(_0x3c151a,null));};exports[_0xb6c5('0x25')]=function(_0x20c5d3,_0x37cd4b){if(_0x20c5d3['body']['id']){delete _0x20c5d3[_0xb6c5('0x4b')]['id'];}return db['Dynamics365Field'][_0xb6c5('0x4c')]({'where':{'id':_0x20c5d3[_0xb6c5('0x46')]['id']}})[_0xb6c5('0x26')](handleEntityNotFound(_0x37cd4b,null))[_0xb6c5('0x26')](saveUpdates(_0x20c5d3[_0xb6c5('0x4b')],null))[_0xb6c5('0x26')](respondWithResult(_0x37cd4b,null))['catch'](handleError(_0x37cd4b,null));};exports['destroy']=function(_0x74e2bf,_0x3a0473){return db[_0xb6c5('0x2d')]['find']({'where':{'id':_0x74e2bf['params']['id']}})[_0xb6c5('0x26')](handleEntityNotFound(_0x3a0473,null))[_0xb6c5('0x26')](removeEntity(_0x3a0473,null))[_0xb6c5('0x49')](handleError(_0x3a0473,null));}; \ No newline at end of file +var _0xa1de=['map','Dynamics365Field','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','pick','filter','where','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','then','catch','show','find','create','body','params','zip-dir','fast-json-patch','request-promise','moment','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/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','destroy','error','stack','name','index'];(function(_0x1c08c7,_0x29e9d1){var _0x2045e2=function(_0x8b7369){while(--_0x8b7369){_0x1c08c7['push'](_0x1c08c7['shift']());}};_0x2045e2(++_0x29e9d1);}(_0xa1de,0x109));var _0xea1d=function(_0x4a4d8f,_0x13aae4){_0x4a4d8f=_0x4a4d8f-0x0;var _0xf1b3d5=_0xa1de[_0x4a4d8f];return _0xf1b3d5;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xea1d('0x0'));var jsonpatch=require(_0xea1d('0x1'));var rp=require(_0xea1d('0x2'));var moment=require(_0xea1d('0x3'));var BPromise=require(_0xea1d('0x4'));var Mustache=require('mustache');var util=require(_0xea1d('0x5'));var path=require(_0xea1d('0x6'));var sox=require(_0xea1d('0x7'));var csv=require('to-csv');var ejs=require(_0xea1d('0x8'));var fs=require('fs');var fs_extra=require(_0xea1d('0x9'));var _=require(_0xea1d('0xa'));var squel=require(_0xea1d('0xb'));var crypto=require(_0xea1d('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xea1d('0xd'));var toCsv=require(_0xea1d('0xe'));var querystring=require(_0xea1d('0xf'));var Papa=require(_0xea1d('0x10'));var Redis=require(_0xea1d('0x11'));var authService=require(_0xea1d('0x12'));var qs=require(_0xea1d('0x13'));var as=require(_0xea1d('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xea1d('0x15'))(_0xea1d('0x16'));var utils=require(_0xea1d('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xea1d('0x18'));var db=require(_0xea1d('0x19'))['db'];function respondWithStatusCode(_0x1e0b59,_0x3967da){_0x3967da=_0x3967da||0xcc;return function(_0x479b2b){if(_0x479b2b){return _0x1e0b59[_0xea1d('0x1a')](_0x3967da);}return _0x1e0b59[_0xea1d('0x1b')](_0x3967da)[_0xea1d('0x1c')]();};}function respondWithResult(_0x697b65,_0xe3494b){_0xe3494b=_0xe3494b||0xc8;return function(_0x10aa19){if(_0x10aa19){return _0x697b65[_0xea1d('0x1b')](_0xe3494b)[_0xea1d('0x1d')](_0x10aa19);}};}function respondWithFilteredResult(_0xeb8bf,_0x1c840f){return function(_0x138798){if(_0x138798){var _0x24c9e4=typeof _0x1c840f['offset']==='undefined'&&typeof _0x1c840f['limit']==='undefined';var _0x127d5d=_0x138798[_0xea1d('0x1e')];var _0x3cac29=_0x24c9e4?0x0:_0x1c840f[_0xea1d('0x1f')];var _0x26c77d=_0x24c9e4?_0x138798['count']:_0x1c840f[_0xea1d('0x1f')]+_0x1c840f[_0xea1d('0x20')];var _0x1cb180;if(_0x26c77d>=_0x127d5d){_0x26c77d=_0x127d5d;_0x1cb180=0xc8;}else{_0x1cb180=0xce;}_0xeb8bf['status'](_0x1cb180);return _0xeb8bf[_0xea1d('0x21')](_0xea1d('0x22'),_0x3cac29+'-'+_0x26c77d+'/'+_0x127d5d)[_0xea1d('0x1d')](_0x138798);}return null;};}function patchUpdates(_0x1ba98d){return function(_0x1f8325){try{jsonpatch[_0xea1d('0x23')](_0x1f8325,_0x1ba98d,!![]);}catch(_0x3fb4b3){return BPromise[_0xea1d('0x24')](_0x3fb4b3);}return _0x1f8325[_0xea1d('0x25')]();};}function saveUpdates(_0xd08c1f,_0x52df24){return function(_0x21018f){if(_0x21018f){return _0x21018f['update'](_0xd08c1f)['then'](function(_0x5981e0){return _0x5981e0;});}return null;};}function removeEntity(_0x245141,_0x1d30d9){return function(_0xd33dba){if(_0xd33dba){return _0xd33dba[_0xea1d('0x26')]()['then'](function(){_0x245141[_0xea1d('0x1b')](0xcc)[_0xea1d('0x1c')]();});}};}function handleEntityNotFound(_0x2c59e9,_0x539685){return function(_0x1e0982){if(!_0x1e0982){_0x2c59e9[_0xea1d('0x1a')](0x194);}return _0x1e0982;};}function handleError(_0x176256,_0x5f5588){_0x5f5588=_0x5f5588||0x1f4;return function(_0x1035da){logger[_0xea1d('0x27')](_0x1035da[_0xea1d('0x28')]);if(_0x1035da[_0xea1d('0x29')]){delete _0x1035da[_0xea1d('0x29')];}_0x176256[_0xea1d('0x1b')](_0x5f5588)['send'](_0x1035da);};}exports[_0xea1d('0x2a')]=function(_0x550082,_0xaafdd0){var _0xf1232c={},_0x19f47b={},_0x170ba5={'count':0x0,'rows':[]};var _0x171384=_[_0xea1d('0x2b')](db[_0xea1d('0x2c')][_0xea1d('0x2d')],function(_0x4ca636){return{'name':_0x4ca636[_0xea1d('0x2e')],'type':_0x4ca636['type'][_0xea1d('0x2f')]};});_0x19f47b[_0xea1d('0x30')]=_[_0xea1d('0x2b')](_0x171384,_0xea1d('0x29'));_0x19f47b[_0xea1d('0x31')]=_[_0xea1d('0x32')](_0x550082[_0xea1d('0x31')]);_0x19f47b[_0xea1d('0x33')]=_[_0xea1d('0x34')](_0x19f47b[_0xea1d('0x30')],_0x19f47b[_0xea1d('0x31')]);_0xf1232c['attributes']=_['intersection'](_0x19f47b[_0xea1d('0x30')],qs['fields'](_0x550082[_0xea1d('0x31')][_0xea1d('0x35')]));_0xf1232c[_0xea1d('0x36')]=_0xf1232c[_0xea1d('0x36')][_0xea1d('0x37')]?_0xf1232c['attributes']:_0x19f47b[_0xea1d('0x30')];if(!_0x550082[_0xea1d('0x31')][_0xea1d('0x38')]('nolimit')){_0xf1232c[_0xea1d('0x20')]=qs[_0xea1d('0x20')](_0x550082[_0xea1d('0x31')][_0xea1d('0x20')]);_0xf1232c[_0xea1d('0x1f')]=qs['offset'](_0x550082[_0xea1d('0x31')]['offset']);}_0xf1232c[_0xea1d('0x39')]=qs[_0xea1d('0x3a')](_0x550082['query']['sort']);_0xf1232c['where']=qs[_0xea1d('0x33')](_[_0xea1d('0x3b')](_0x550082[_0xea1d('0x31')],_0x19f47b[_0xea1d('0x33')]),_0x171384);if(_0x550082[_0xea1d('0x31')][_0xea1d('0x3c')]){_0xf1232c[_0xea1d('0x3d')]=_[_0xea1d('0x3e')](_0xf1232c[_0xea1d('0x3d')],{'$or':_[_0xea1d('0x2b')](_0x171384,function(_0x24c62a){if(_0x24c62a[_0xea1d('0x3f')]!==_0xea1d('0x40')){var _0xb689a2={};_0xb689a2[_0x24c62a[_0xea1d('0x29')]]={'$like':'%'+_0x550082['query']['filter']+'%'};return _0xb689a2;}})});}_0xf1232c=_[_0xea1d('0x3e')]({},_0xf1232c,_0x550082[_0xea1d('0x41')]);var _0x54c9f5={'where':_0xf1232c['where']};return db[_0xea1d('0x2c')][_0xea1d('0x1e')](_0x54c9f5)['then'](function(_0x3b861e){_0x170ba5[_0xea1d('0x1e')]=_0x3b861e;if(_0x550082[_0xea1d('0x31')][_0xea1d('0x42')]){_0xf1232c[_0xea1d('0x43')]=[{'all':!![]}];}return db[_0xea1d('0x2c')][_0xea1d('0x44')](_0xf1232c);})['then'](function(_0x31b05f){_0x170ba5[_0xea1d('0x45')]=_0x31b05f;return _0x170ba5;})[_0xea1d('0x46')](respondWithFilteredResult(_0xaafdd0,_0xf1232c))[_0xea1d('0x47')](handleError(_0xaafdd0,null));};exports[_0xea1d('0x48')]=function(_0x1c9aad,_0x38f79f){var _0x259db1={'raw':!![],'where':{'id':_0x1c9aad['params']['id']}},_0x2a5ee5={};_0x2a5ee5[_0xea1d('0x30')]=_['keys'](db['Dynamics365Field'][_0xea1d('0x2d')]);_0x2a5ee5['query']=_[_0xea1d('0x32')](_0x1c9aad['query']);_0x2a5ee5['filters']=_['intersection'](_0x2a5ee5[_0xea1d('0x30')],_0x2a5ee5[_0xea1d('0x31')]);_0x259db1[_0xea1d('0x36')]=_[_0xea1d('0x34')](_0x2a5ee5[_0xea1d('0x30')],qs[_0xea1d('0x35')](_0x1c9aad[_0xea1d('0x31')][_0xea1d('0x35')]));_0x259db1[_0xea1d('0x36')]=_0x259db1[_0xea1d('0x36')][_0xea1d('0x37')]?_0x259db1[_0xea1d('0x36')]:_0x2a5ee5[_0xea1d('0x30')];if(_0x1c9aad[_0xea1d('0x31')][_0xea1d('0x42')]){_0x259db1[_0xea1d('0x43')]=[{'all':!![]}];}_0x259db1=_['merge']({},_0x259db1,_0x1c9aad['options']);return db[_0xea1d('0x2c')][_0xea1d('0x49')](_0x259db1)[_0xea1d('0x46')](handleEntityNotFound(_0x38f79f,null))['then'](respondWithResult(_0x38f79f,null))[_0xea1d('0x47')](handleError(_0x38f79f,null));};exports[_0xea1d('0x4a')]=function(_0x3367e0,_0x53b083){return db[_0xea1d('0x2c')]['create'](_0x3367e0[_0xea1d('0x4b')],{})[_0xea1d('0x46')](respondWithResult(_0x53b083,0xc9))[_0xea1d('0x47')](handleError(_0x53b083,null));};exports['update']=function(_0x3b8ff6,_0x3df312){if(_0x3b8ff6[_0xea1d('0x4b')]['id']){delete _0x3b8ff6[_0xea1d('0x4b')]['id'];}return db['Dynamics365Field']['find']({'where':{'id':_0x3b8ff6[_0xea1d('0x4c')]['id']}})[_0xea1d('0x46')](handleEntityNotFound(_0x3df312,null))['then'](saveUpdates(_0x3b8ff6[_0xea1d('0x4b')],null))[_0xea1d('0x46')](respondWithResult(_0x3df312,null))[_0xea1d('0x47')](handleError(_0x3df312,null));};exports[_0xea1d('0x26')]=function(_0x18b3f0,_0x8d6bcb){return db[_0xea1d('0x2c')][_0xea1d('0x49')]({'where':{'id':_0x18b3f0[_0xea1d('0x4c')]['id']}})[_0xea1d('0x46')](handleEntityNotFound(_0x8d6bcb,null))[_0xea1d('0x46')](removeEntity(_0x8d6bcb,null))[_0xea1d('0x47')](handleError(_0x8d6bcb,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.model.js b/server/api/intDynamics365Field/intDynamics365Field.model.js index 7ac26d3..c82371c 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 _0xb5a1=['bluebird','request-promise','../../config/environment','./intDynamics365Field.attributes','exports','define','Dynamics365Field','int_dynamics365_fields','dynamics365_unique_index','idField','FieldId','lodash','util','../../config/logger','api'];(function(_0x39009d,_0xbbf4e){var _0x5d0400=function(_0x4a1e39){while(--_0x4a1e39){_0x39009d['push'](_0x39009d['shift']());}};_0x5d0400(++_0xbbf4e);}(_0xb5a1,0x1eb));var _0x1b5a=function(_0x43de22,_0x1eced6){_0x43de22=_0x43de22-0x0;var _0x4b15ee=_0xb5a1[_0x43de22];return _0x4b15ee;};'use strict';var _=require(_0x1b5a('0x0'));var util=require(_0x1b5a('0x1'));var logger=require(_0x1b5a('0x2'))(_0x1b5a('0x3'));var moment=require('moment');var BPromise=require(_0x1b5a('0x4'));var rp=require(_0x1b5a('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x1b5a('0x6'));var attributes=require(_0x1b5a('0x7'));module[_0x1b5a('0x8')]=function(_0x34a44f,_0x242342){return _0x34a44f[_0x1b5a('0x9')](_0x1b5a('0xa'),attributes,{'tableName':_0x1b5a('0xb'),'paranoid':![],'indexes':[{'name':_0x1b5a('0xc'),'fields':[_0x1b5a('0xd'),_0x1b5a('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x5d35=['request-promise','rimraf','../../config/environment','./intDynamics365Field.attributes','exports','Dynamics365Field','int_dynamics365_fields','dynamics365_unique_index','idField','FieldId','lodash','util','moment'];(function(_0x6131cd,_0x4c26a1){var _0x47e916=function(_0x1f2bce){while(--_0x1f2bce){_0x6131cd['push'](_0x6131cd['shift']());}};_0x47e916(++_0x4c26a1);}(_0x5d35,0xf4));var _0x55d3=function(_0x2146e5,_0x45b9f4){_0x2146e5=_0x2146e5-0x0;var _0x4c2734=_0x5d35[_0x2146e5];return _0x4c2734;};'use strict';var _=require(_0x55d3('0x0'));var util=require(_0x55d3('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x55d3('0x2'));var BPromise=require('bluebird');var rp=require(_0x55d3('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x55d3('0x4'));var config=require(_0x55d3('0x5'));var attributes=require(_0x55d3('0x6'));module[_0x55d3('0x7')]=function(_0x1478a8,_0x5d688c){return _0x1478a8['define'](_0x55d3('0x8'),attributes,{'tableName':_0x55d3('0x9'),'paranoid':![],'indexes':[{'name':_0x55d3('0xa'),'fields':[_0x55d3('0xb'),_0x55d3('0xc')],'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 f4fcd54..8994231 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 _0x85e6=['jayson/promise','client','http','info','Dynamics365Field,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','Dynamics365Field,\x20%s,\x20%s','message','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x1fa381,_0x758c2a){var _0x47eefe=function(_0x127f8c){while(--_0x127f8c){_0x1fa381['push'](_0x1fa381['shift']());}};_0x47eefe(++_0x758c2a);}(_0x85e6,0x156));var _0x685e=function(_0x232fe1,_0x439e9f){_0x232fe1=_0x232fe1-0x0;var _0x2363ab=_0x85e6[_0x232fe1];return _0x2363ab;};'use strict';var _=require('lodash');var util=require(_0x685e('0x0'));var moment=require(_0x685e('0x1'));var BPromise=require(_0x685e('0x2'));var rs=require(_0x685e('0x3'));var fs=require('fs');var Redis=require(_0x685e('0x4'));var db=require(_0x685e('0x5'))['db'];var utils=require(_0x685e('0x6'));var logger=require(_0x685e('0x7'))(_0x685e('0x8'));var config=require(_0x685e('0x9'));var jayson=require(_0x685e('0xa'));var client=jayson[_0x685e('0xb')][_0x685e('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x7a610a,_0x5ba6b2,_0x57e0de){return new BPromise(function(_0x32008,_0x2b8f67){return client['request'](_0x7a610a,_0x57e0de)['then'](function(_0x4703dc){logger[_0x685e('0xd')]('Dynamics365Field,\x20%s,\x20%s',_0x5ba6b2,'request\x20sent');logger['debug'](_0x685e('0xe'),_0x5ba6b2,_0x685e('0xf'),JSON[_0x685e('0x10')](_0x4703dc));if(_0x4703dc[_0x685e('0x11')]){if(_0x4703dc[_0x685e('0x11')][_0x685e('0x12')]===0x1f4){logger[_0x685e('0x11')](_0x685e('0x13'),_0x5ba6b2,_0x4703dc[_0x685e('0x11')][_0x685e('0x14')]);return _0x2b8f67(_0x4703dc['error']['message']);}logger[_0x685e('0x11')](_0x685e('0x13'),_0x5ba6b2,_0x4703dc['error']['message']);return _0x32008(_0x4703dc['error']['message']);}else{logger[_0x685e('0xd')](_0x685e('0x13'),_0x5ba6b2,_0x685e('0xf'));_0x32008(_0x4703dc['result']['message']);}})[_0x685e('0x15')](function(_0x3774d0){logger['error'](_0x685e('0x13'),_0x5ba6b2,_0x3774d0);_0x2b8f67(_0x3774d0);});});} \ No newline at end of file +var _0xd022=['code','message','catch','util','bluebird','randomstring','../../config/utils','../../config/environment','jayson/promise','client','request','Dynamics365Field,\x20%s,\x20%s','debug','Dynamics365Field,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x3f02d3,_0x4e3def){var _0x129fbb=function(_0x3101e8){while(--_0x3101e8){_0x3f02d3['push'](_0x3f02d3['shift']());}};_0x129fbb(++_0x4e3def);}(_0xd022,0x146));var _0x2d02=function(_0x68c979,_0x431cff){_0x68c979=_0x68c979-0x0;var _0x4f0001=_0xd022[_0x68c979];return _0x4f0001;};'use strict';var _=require('lodash');var util=require(_0x2d02('0x0'));var moment=require('moment');var BPromise=require(_0x2d02('0x1'));var rs=require(_0x2d02('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x2d02('0x3'));var logger=require('../../config/logger')('rpc');var config=require(_0x2d02('0x4'));var jayson=require(_0x2d02('0x5'));var client=jayson[_0x2d02('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5e9d96,_0x3ff879,_0x361717){return new BPromise(function(_0x3545cc,_0x231f30){return client[_0x2d02('0x7')](_0x5e9d96,_0x361717)['then'](function(_0x133314){logger['info'](_0x2d02('0x8'),_0x3ff879,'request\x20sent');logger[_0x2d02('0x9')](_0x2d02('0xa'),_0x3ff879,_0x2d02('0xb'),JSON[_0x2d02('0xc')](_0x133314));if(_0x133314[_0x2d02('0xd')]){if(_0x133314[_0x2d02('0xd')][_0x2d02('0xe')]===0x1f4){logger[_0x2d02('0xd')](_0x2d02('0x8'),_0x3ff879,_0x133314[_0x2d02('0xd')][_0x2d02('0xf')]);return _0x231f30(_0x133314[_0x2d02('0xd')][_0x2d02('0xf')]);}logger['error'](_0x2d02('0x8'),_0x3ff879,_0x133314['error'][_0x2d02('0xf')]);return _0x3545cc(_0x133314['error'][_0x2d02('0xf')]);}else{logger['info'](_0x2d02('0x8'),_0x3ff879,_0x2d02('0xb'));_0x3545cc(_0x133314['result'][_0x2d02('0xf')]);}})[_0x2d02('0x10')](function(_0x257797){logger[_0x2d02('0xd')]('Dynamics365Field,\x20%s,\x20%s',_0x3ff879,_0x257797);_0x231f30(_0x257797);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/index.js b/server/api/intFreshdeskAccount/index.js index c3d2adc..1fc74eb 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 _0x1f75=['get','isAuthenticated','index','show','/:id/configurations','getConfigurations','post','create','addConfiguration','put','/:id','update','delete','destroy','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskAccount.controller'];(function(_0x339f5d,_0x13baef){var _0x5626c5=function(_0x326be7){while(--_0x326be7){_0x339f5d['push'](_0x339f5d['shift']());}};_0x5626c5(++_0x13baef);}(_0x1f75,0x15e));var _0x51f7=function(_0xae7c2f,_0xf31e04){_0xae7c2f=_0xae7c2f-0x0;var _0x5d7001=_0x1f75[_0xae7c2f];return _0x5d7001;};'use strict';var multer=require('multer');var util=require(_0x51f7('0x0'));var path=require(_0x51f7('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x51f7('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x51f7('0x3'));var interaction=require(_0x51f7('0x4'));var config=require(_0x51f7('0x5'));var controller=require(_0x51f7('0x6'));router[_0x51f7('0x7')]('/',auth[_0x51f7('0x8')](),controller[_0x51f7('0x9')]);router[_0x51f7('0x7')]('/:id',auth[_0x51f7('0x8')](),controller[_0x51f7('0xa')]);router[_0x51f7('0x7')](_0x51f7('0xb'),auth[_0x51f7('0x8')](),controller[_0x51f7('0xc')]);router['get']('/:id/fields',auth[_0x51f7('0x8')](),controller['getFields']);router[_0x51f7('0xd')]('/',auth[_0x51f7('0x8')](),controller[_0x51f7('0xe')]);router[_0x51f7('0xd')](_0x51f7('0xb'),auth['isAuthenticated'](),controller[_0x51f7('0xf')]);router[_0x51f7('0x10')](_0x51f7('0x11'),auth[_0x51f7('0x8')](),controller[_0x51f7('0x12')]);router[_0x51f7('0x13')](_0x51f7('0x11'),auth['isAuthenticated'](),controller[_0x51f7('0x14')]);module['exports']=router; \ No newline at end of file +var _0x6904=['./intFreshdeskAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x70d002,_0x1afd25){var _0xd4fe2a=function(_0x1613af){while(--_0x1613af){_0x70d002['push'](_0x70d002['shift']());}};_0xd4fe2a(++_0x1afd25);}(_0x6904,0x191));var _0x4690=function(_0x1cbcf1,_0x3f9fd9){_0x1cbcf1=_0x1cbcf1-0x0;var _0x3a06f0=_0x6904[_0x1cbcf1];return _0x3a06f0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x4690('0x0'));var timeout=require(_0x4690('0x1'));var express=require(_0x4690('0x2'));var router=express[_0x4690('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x4690('0x4'));var interaction=require(_0x4690('0x5'));var config=require(_0x4690('0x6'));var controller=require(_0x4690('0x7'));router[_0x4690('0x8')]('/',auth[_0x4690('0x9')](),controller[_0x4690('0xa')]);router[_0x4690('0x8')](_0x4690('0xb'),auth[_0x4690('0x9')](),controller[_0x4690('0xc')]);router[_0x4690('0x8')](_0x4690('0xd'),auth['isAuthenticated'](),controller['getConfigurations']);router[_0x4690('0x8')](_0x4690('0xe'),auth[_0x4690('0x9')](),controller[_0x4690('0xf')]);router[_0x4690('0x10')]('/',auth['isAuthenticated'](),controller[_0x4690('0x11')]);router[_0x4690('0x10')](_0x4690('0xd'),auth[_0x4690('0x9')](),controller[_0x4690('0x12')]);router[_0x4690('0x13')]('/:id',auth[_0x4690('0x9')](),controller[_0x4690('0x14')]);router[_0x4690('0x15')](_0x4690('0xb'),auth[_0x4690('0x9')](),controller[_0x4690('0x16')]);module[_0x4690('0x17')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js index d802a59..e869094 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 _0x8e3f=['STRING','username','remoteUri','sequelize','exports'];(function(_0x161700,_0x25c6e5){var _0x487ad0=function(_0x361f11){while(--_0x361f11){_0x161700['push'](_0x161700['shift']());}};_0x487ad0(++_0x25c6e5);}(_0x8e3f,0xc1));var _0xf8e3=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x8e3f[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require(_0xf8e3('0x0'));module[_0xf8e3('0x1')]={'name':{'type':Sequelize[_0xf8e3('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xf8e3('0x2')],'unique':_0xf8e3('0x3')},'apiKey':{'type':Sequelize[_0xf8e3('0x2')]},'remoteUri':{'type':Sequelize['STRING'],'unique':_0xf8e3('0x4')},'serverUrl':{'type':Sequelize[_0xf8e3('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x77d4=['exports','STRING','username'];(function(_0x3fe440,_0x18d0cb){var _0x30cf95=function(_0x1f7af5){while(--_0x1f7af5){_0x3fe440['push'](_0x3fe440['shift']());}};_0x30cf95(++_0x18d0cb);}(_0x77d4,0x108));var _0x477d=function(_0x251429,_0x55f265){_0x251429=_0x251429-0x0;var _0x2d5d69=_0x77d4[_0x251429];return _0x2d5d69;};'use strict';var Sequelize=require('sequelize');module[_0x477d('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x477d('0x1')]},'username':{'type':Sequelize['STRING'],'unique':_0x477d('0x2')},'apiKey':{'type':Sequelize[_0x477d('0x1')]},'remoteUri':{'type':Sequelize['STRING'],'unique':'remoteUri'},'serverUrl':{'type':Sequelize[_0x477d('0x1')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js index eee2024..ed3688a 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 _0xdb76=['ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/license/util','../../mysqldb','../../components/integrations/configuration','end','status','json','offset','undefined','count','limit','set','apply','reject','update','then','sendStatus','error','name','send','index','map','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','catch','show','params','fields','length','find','create','FreshdeskAccount','body','destroy','findOne','FreshdeskConfiguration','getConfigurations','nolimit','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','FreshdeskField','getFields','remoteUri','apiKey','slice','substring','lastIndexOf','GET','format','api/v2/ticket_fields','Basic\x20%s','toString','base64','requester','subject','agent','priority','group','source','ticket_type','remove','custom_text','custom_dropdown','label','default','choices','capitalize','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse'];(function(_0x1825dd,_0x319bfd){var _0x254f72=function(_0xaeba2b){while(--_0xaeba2b){_0x1825dd['push'](_0x1825dd['shift']());}};_0x254f72(++_0x319bfd);}(_0xdb76,0x1be));var _0x6db7=function(_0xf43ed7,_0x1ee456){_0xf43ed7=_0xf43ed7-0x0;var _0x3e4dfa=_0xdb76[_0xf43ed7];return _0x3e4dfa;};'use strict';var emlformat=require(_0x6db7('0x0'));var rimraf=require(_0x6db7('0x1'));var zipdir=require(_0x6db7('0x2'));var jsonpatch=require(_0x6db7('0x3'));var rp=require(_0x6db7('0x4'));var moment=require('moment');var BPromise=require(_0x6db7('0x5'));var Mustache=require(_0x6db7('0x6'));var util=require(_0x6db7('0x7'));var path=require(_0x6db7('0x8'));var sox=require('sox');var csv=require(_0x6db7('0x9'));var ejs=require(_0x6db7('0xa'));var fs=require('fs');var fs_extra=require(_0x6db7('0xb'));var _=require(_0x6db7('0xc'));var squel=require(_0x6db7('0xd'));var crypto=require('crypto');var jsforce=require(_0x6db7('0xe'));var deskjs=require(_0x6db7('0xf'));var toCsv=require('to-csv');var querystring=require(_0x6db7('0x10'));var Papa=require(_0x6db7('0x11'));var Redis=require(_0x6db7('0x12'));var authService=require(_0x6db7('0x13'));var qs=require(_0x6db7('0x14'));var as=require(_0x6db7('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x6db7('0x16'));var utils=require(_0x6db7('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x6db7('0x18'));var db=require(_0x6db7('0x19'))['db'];var integrations=require(_0x6db7('0x1a'));function respondWithStatusCode(_0x1658dd,_0x375f4a){_0x375f4a=_0x375f4a||0xcc;return function(_0x4640ef){if(_0x4640ef){return _0x1658dd['sendStatus'](_0x375f4a);}return _0x1658dd['status'](_0x375f4a)[_0x6db7('0x1b')]();};}function respondWithResult(_0x348ccf,_0x167384){_0x167384=_0x167384||0xc8;return function(_0xaf495){if(_0xaf495){return _0x348ccf[_0x6db7('0x1c')](_0x167384)[_0x6db7('0x1d')](_0xaf495);}};}function respondWithFilteredResult(_0x144684,_0x43f66c){return function(_0x1432ac){if(_0x1432ac){var _0x3e4a49=typeof _0x43f66c[_0x6db7('0x1e')]===_0x6db7('0x1f')&&typeof _0x43f66c['limit']===_0x6db7('0x1f');var _0x116bfe=_0x1432ac[_0x6db7('0x20')];var _0x53ea04=_0x3e4a49?0x0:_0x43f66c[_0x6db7('0x1e')];var _0x272bda=_0x3e4a49?_0x1432ac[_0x6db7('0x20')]:_0x43f66c[_0x6db7('0x1e')]+_0x43f66c[_0x6db7('0x21')];var _0x3b0c56;if(_0x272bda>=_0x116bfe){_0x272bda=_0x116bfe;_0x3b0c56=0xc8;}else{_0x3b0c56=0xce;}_0x144684[_0x6db7('0x1c')](_0x3b0c56);return _0x144684[_0x6db7('0x22')]('Content-Range',_0x53ea04+'-'+_0x272bda+'/'+_0x116bfe)[_0x6db7('0x1d')](_0x1432ac);}return null;};}function patchUpdates(_0x206aa2){return function(_0x13a7e4){try{jsonpatch[_0x6db7('0x23')](_0x13a7e4,_0x206aa2,!![]);}catch(_0x25aa7a){return BPromise[_0x6db7('0x24')](_0x25aa7a);}return _0x13a7e4['save']();};}function saveUpdates(_0x1b0f04,_0x2795ab){return function(_0x4dca90){if(_0x4dca90){return _0x4dca90[_0x6db7('0x25')](_0x1b0f04)[_0x6db7('0x26')](function(_0x7ca54f){return _0x7ca54f;});}return null;};}function removeEntity(_0x48e3af,_0x24d818){return function(_0x524669){if(_0x524669){return _0x524669['destroy']()[_0x6db7('0x26')](function(){_0x48e3af[_0x6db7('0x1c')](0xcc)[_0x6db7('0x1b')]();});}};}function handleEntityNotFound(_0x558d58,_0x559e14){return function(_0x396f40){if(!_0x396f40){_0x558d58[_0x6db7('0x27')](0x194);}return _0x396f40;};}function handleError(_0xdbd9f1,_0x4f28e9){_0x4f28e9=_0x4f28e9||0x1f4;return function(_0x3efff1){logger[_0x6db7('0x28')](_0x3efff1['stack']);if(_0x3efff1['name']){delete _0x3efff1[_0x6db7('0x29')];}_0xdbd9f1[_0x6db7('0x1c')](_0x4f28e9)[_0x6db7('0x2a')](_0x3efff1);};}exports[_0x6db7('0x2b')]=function(_0x11185d,_0xc4f615){var _0x4fb6dd={},_0x81d08b={},_0x3856d5={'count':0x0,'rows':[]};var _0x4a619d=_[_0x6db7('0x2c')](db['FreshdeskAccount'][_0x6db7('0x2d')],function(_0x554f49){return{'name':_0x554f49[_0x6db7('0x2e')],'type':_0x554f49[_0x6db7('0x2f')]['key']};});_0x81d08b[_0x6db7('0x30')]=_[_0x6db7('0x2c')](_0x4a619d,_0x6db7('0x29'));_0x81d08b[_0x6db7('0x31')]=_[_0x6db7('0x32')](_0x11185d['query']);_0x81d08b[_0x6db7('0x33')]=_[_0x6db7('0x34')](_0x81d08b[_0x6db7('0x30')],_0x81d08b['query']);_0x4fb6dd[_0x6db7('0x35')]=_[_0x6db7('0x34')](_0x81d08b[_0x6db7('0x30')],qs['fields'](_0x11185d[_0x6db7('0x31')]['fields']));_0x4fb6dd[_0x6db7('0x35')]=_0x4fb6dd['attributes']['length']?_0x4fb6dd[_0x6db7('0x35')]:_0x81d08b[_0x6db7('0x30')];if(!_0x11185d[_0x6db7('0x31')][_0x6db7('0x36')]('nolimit')){_0x4fb6dd['limit']=qs[_0x6db7('0x21')](_0x11185d[_0x6db7('0x31')]['limit']);_0x4fb6dd[_0x6db7('0x1e')]=qs['offset'](_0x11185d[_0x6db7('0x31')]['offset']);}_0x4fb6dd[_0x6db7('0x37')]=qs['sort'](_0x11185d['query'][_0x6db7('0x38')]);_0x4fb6dd[_0x6db7('0x39')]=qs[_0x6db7('0x33')](_[_0x6db7('0x3a')](_0x11185d[_0x6db7('0x31')],_0x81d08b['filters']),_0x4a619d);if(_0x11185d[_0x6db7('0x31')][_0x6db7('0x3b')]){_0x4fb6dd[_0x6db7('0x39')]=_[_0x6db7('0x3c')](_0x4fb6dd[_0x6db7('0x39')],{'$or':_[_0x6db7('0x2c')](_0x4a619d,function(_0x491d53){if(_0x491d53[_0x6db7('0x2f')]!==_0x6db7('0x3d')){var _0x2298a9={};_0x2298a9[_0x491d53['name']]={'$like':'%'+_0x11185d[_0x6db7('0x31')]['filter']+'%'};return _0x2298a9;}})});}_0x4fb6dd=_[_0x6db7('0x3c')]({},_0x4fb6dd,_0x11185d[_0x6db7('0x3e')]);var _0x5b2c68={'where':_0x4fb6dd[_0x6db7('0x39')]};return db['FreshdeskAccount'][_0x6db7('0x20')](_0x5b2c68)['then'](function(_0xb9628e){_0x3856d5['count']=_0xb9628e;if(_0x11185d[_0x6db7('0x31')]['includeAll']){_0x4fb6dd[_0x6db7('0x3f')]=[{'all':!![]}];}return db['FreshdeskAccount'][_0x6db7('0x40')](_0x4fb6dd);})[_0x6db7('0x26')](function(_0x14b1c){_0x3856d5['rows']=_0x14b1c;return _0x3856d5;})[_0x6db7('0x26')](respondWithFilteredResult(_0xc4f615,_0x4fb6dd))[_0x6db7('0x41')](handleError(_0xc4f615,null));};exports[_0x6db7('0x42')]=function(_0x4d82c7,_0xe0f5aa){var _0x1c495b={'raw':![],'where':{'id':_0x4d82c7[_0x6db7('0x43')]['id']}},_0x3958e2={};_0x3958e2[_0x6db7('0x30')]=_[_0x6db7('0x32')](db['FreshdeskAccount'][_0x6db7('0x2d')]);_0x3958e2[_0x6db7('0x31')]=_['keys'](_0x4d82c7['query']);_0x3958e2[_0x6db7('0x33')]=_[_0x6db7('0x34')](_0x3958e2[_0x6db7('0x30')],_0x3958e2['query']);_0x1c495b[_0x6db7('0x35')]=_[_0x6db7('0x34')](_0x3958e2[_0x6db7('0x30')],qs[_0x6db7('0x44')](_0x4d82c7[_0x6db7('0x31')]['fields']));_0x1c495b[_0x6db7('0x35')]=_0x1c495b[_0x6db7('0x35')][_0x6db7('0x45')]?_0x1c495b['attributes']:_0x3958e2['model'];if(_0x4d82c7[_0x6db7('0x31')]['includeAll']){_0x1c495b[_0x6db7('0x3f')]=[{'all':!![]}];}_0x1c495b=_[_0x6db7('0x3c')]({},_0x1c495b,_0x4d82c7['options']);return db['FreshdeskAccount'][_0x6db7('0x46')](_0x1c495b)[_0x6db7('0x26')](handleEntityNotFound(_0xe0f5aa,null))[_0x6db7('0x26')](respondWithResult(_0xe0f5aa,null))[_0x6db7('0x41')](handleError(_0xe0f5aa,null));};exports[_0x6db7('0x47')]=function(_0x980eaa,_0x57855){return db[_0x6db7('0x48')]['create'](_0x980eaa[_0x6db7('0x49')],{})[_0x6db7('0x26')](respondWithResult(_0x57855,0xc9))[_0x6db7('0x41')](handleError(_0x57855,null));};exports['update']=function(_0x48b8a7,_0x676f8f){if(_0x48b8a7[_0x6db7('0x49')]['id']){delete _0x48b8a7[_0x6db7('0x49')]['id'];}return db[_0x6db7('0x48')][_0x6db7('0x46')]({'where':{'id':_0x48b8a7[_0x6db7('0x43')]['id']}})[_0x6db7('0x26')](handleEntityNotFound(_0x676f8f,null))['then'](saveUpdates(_0x48b8a7[_0x6db7('0x49')],null))[_0x6db7('0x26')](respondWithResult(_0x676f8f,null))[_0x6db7('0x41')](handleError(_0x676f8f,null));};exports[_0x6db7('0x4a')]=function(_0x4f8fb1,_0x30258d){return db[_0x6db7('0x48')][_0x6db7('0x46')]({'where':{'id':_0x4f8fb1[_0x6db7('0x43')]['id']}})['then'](handleEntityNotFound(_0x30258d,null))[_0x6db7('0x26')](removeEntity(_0x30258d,null))[_0x6db7('0x41')](handleError(_0x30258d,null));};exports['getConfigurations']=function(_0x599090,_0x1c307,_0x4b3e01){var _0x12879f={};var _0x548532={};var _0x46e385;var _0x5ce9f3;return db['FreshdeskAccount'][_0x6db7('0x4b')]({'where':{'id':_0x599090[_0x6db7('0x43')]['id']}})[_0x6db7('0x26')](handleEntityNotFound(_0x1c307,null))[_0x6db7('0x26')](function(_0x1f7a0f){if(_0x1f7a0f){_0x46e385=_0x1f7a0f;_0x548532[_0x6db7('0x30')]=_['keys'](db[_0x6db7('0x4c')][_0x6db7('0x2d')]);_0x548532[_0x6db7('0x31')]=_[_0x6db7('0x32')](_0x599090[_0x6db7('0x31')]);_0x548532['filters']=_[_0x6db7('0x34')](_0x548532[_0x6db7('0x30')],_0x548532[_0x6db7('0x31')]);_0x12879f[_0x6db7('0x35')]=_[_0x6db7('0x34')](_0x548532[_0x6db7('0x30')],qs[_0x6db7('0x44')](_0x599090[_0x6db7('0x31')][_0x6db7('0x44')]));_0x12879f[_0x6db7('0x35')]=_0x12879f['attributes']['length']?_0x12879f[_0x6db7('0x35')]:_0x548532[_0x6db7('0x30')];_0x12879f[_0x6db7('0x37')]=qs[_0x6db7('0x38')](_0x599090[_0x6db7('0x31')][_0x6db7('0x38')]);_0x12879f['where']=qs['filters'](_[_0x6db7('0x3a')](_0x599090[_0x6db7('0x31')],_0x548532['filters']));if(_0x599090[_0x6db7('0x31')]['filter']){_0x12879f['where']=_[_0x6db7('0x3c')](_0x12879f[_0x6db7('0x39')],{'$or':_[_0x6db7('0x2c')](_0x12879f[_0x6db7('0x35')],function(_0x78598d){var _0x37d00b={};_0x37d00b[_0x78598d]={'$like':'%'+_0x599090['query'][_0x6db7('0x3b')]+'%'};return _0x37d00b;})});}_0x12879f=_[_0x6db7('0x3c')]({},_0x12879f,_0x599090[_0x6db7('0x3e')]);return _0x46e385[_0x6db7('0x4d')](_0x12879f);}})[_0x6db7('0x26')](function(_0x4ee67c){if(_0x4ee67c){_0x5ce9f3=_0x4ee67c[_0x6db7('0x45')];if(!_0x599090['query'][_0x6db7('0x36')](_0x6db7('0x4e'))){_0x12879f[_0x6db7('0x21')]=qs[_0x6db7('0x21')](_0x599090[_0x6db7('0x31')]['limit']);_0x12879f[_0x6db7('0x1e')]=qs['offset'](_0x599090[_0x6db7('0x31')][_0x6db7('0x1e')]);}return _0x46e385[_0x6db7('0x4d')](_0x12879f);}})[_0x6db7('0x26')](function(_0x1fcaa4){if(_0x1fcaa4){return _0x1fcaa4?{'count':_0x5ce9f3,'rows':_0x1fcaa4}:null;}})['then'](respondWithResult(_0x1c307,null))[_0x6db7('0x41')](handleError(_0x1c307,null));};exports[_0x6db7('0x4f')]=function(_0x2d2a4f,_0x7bd77e,_0x5ee607){if(_0x2d2a4f[_0x6db7('0x49')]['id']){delete _0x2d2a4f[_0x6db7('0x49')]['id'];}return db[_0x6db7('0x48')][_0x6db7('0x4b')]({'where':{'id':_0x2d2a4f[_0x6db7('0x43')]['id']}})[_0x6db7('0x26')](handleEntityNotFound(_0x7bd77e,null))[_0x6db7('0x26')](function(_0x7440f7){if(_0x7440f7){_0x2d2a4f[_0x6db7('0x49')][_0x6db7('0x50')]=_0x7440f7['id'];_0x2d2a4f['body'][_0x6db7('0x51')]=integrations[_0x6db7('0x52')](_0x2d2a4f[_0x6db7('0x49')][_0x6db7('0x53')],_0x2d2a4f[_0x6db7('0x49')]['type']);_0x2d2a4f[_0x6db7('0x49')][_0x6db7('0x54')]=integrations[_0x6db7('0x55')](_0x2d2a4f[_0x6db7('0x49')]['channel'],_0x2d2a4f[_0x6db7('0x49')][_0x6db7('0x2f')]);return db[_0x6db7('0x4c')][_0x6db7('0x47')](_0x2d2a4f['body'],{'include':[{'model':db[_0x6db7('0x56')],'as':_0x6db7('0x51')},{'model':db[_0x6db7('0x56')],'as':_0x6db7('0x54')}]});}return null;})[_0x6db7('0x26')](respondWithResult(_0x7bd77e,null))[_0x6db7('0x41')](handleError(_0x7bd77e,null));};exports[_0x6db7('0x57')]=function(_0x3a6859,_0x379c58,_0x41c665){var _0x4c5755='';return db[_0x6db7('0x48')][_0x6db7('0x4b')]({'where':{'id':_0x3a6859[_0x6db7('0x43')]['id']},'attributes':['id',_0x6db7('0x58'),_0x6db7('0x59')]})[_0x6db7('0x26')](handleEntityNotFound(_0x379c58,null))['then'](function(_0x37fe30){if(_0x37fe30){_0x4c5755=_0x37fe30[_0x6db7('0x58')];var _0x13ce1c=_0x4c5755[_0x6db7('0x5a')](-0x1);if(_0x13ce1c==='/'){_0x4c5755=_0x4c5755[_0x6db7('0x5b')](0x0,_0x4c5755[_0x6db7('0x5c')](_0x13ce1c));}return rp({'method':_0x6db7('0x5d'),'uri':util[_0x6db7('0x5e')]('%s/%s',_0x4c5755,_0x6db7('0x5f')),'headers':{'Authorization':util[_0x6db7('0x5e')](_0x6db7('0x60'),new Buffer(util[_0x6db7('0x5e')]('%s:X',_0x37fe30[_0x6db7('0x59')]))[_0x6db7('0x61')](_0x6db7('0x62')))},'json':!![]});}})[_0x6db7('0x26')](function(_0x14de39){if(_0x14de39){var _0xb650b8=[_0x6db7('0x63'),_0x6db7('0x64'),_0x6db7('0x65'),'description',_0x6db7('0x1c'),_0x6db7('0x66'),_0x6db7('0x67'),_0x6db7('0x68'),_0x6db7('0x69'),_0x6db7('0x67'),'company'];_[_0x6db7('0x6a')](_0x14de39,function(_0x1f2b4e){return _0xb650b8['includes'](_0x1f2b4e[_0x6db7('0x29')])||!_0x1f2b4e['default']&&_0x1f2b4e['type']!==_0x6db7('0x6b')&&_0x1f2b4e['type']!==_0x6db7('0x6c');});return{'count':_0x14de39[_0x6db7('0x45')],'rows':_[_0x6db7('0x2c')](_0x14de39,function(_0x1ef0a3){return{'id':_0x1ef0a3['name'],'name':_0x1ef0a3[_0x6db7('0x6d')],'custom':!_0x1ef0a3[_0x6db7('0x6e')],'options':_0x1ef0a3[_0x6db7('0x6f')]?_[_0x6db7('0x2c')](_0x1ef0a3[_0x6db7('0x6f')],function(_0xc3e029){return{'name':_[_0x6db7('0x70')](_0xc3e029),'value':_0xc3e029};}):[]};})};}})[_0x6db7('0x26')](respondWithResult(_0x379c58,null))[_0x6db7('0x41')](function(_0x18eb57){var _0x3615d2=_0x3a6859[_0x6db7('0x31')][_0x6db7('0x71')]?0x1f4:_0x18eb57[_0x6db7('0x72')]||0x1f4;logger[_0x6db7('0x28')](_0x6db7('0x73'),'getFields',_0x3615d2,JSON['stringify'](_0x18eb57));delete _0x18eb57[_0x6db7('0x29')];if(_0x3615d2===0x191){_0x3615d2=0x190;}_0x379c58[_0x6db7('0x1c')](_0x3615d2)[_0x6db7('0x2a')](_0x3a6859[_0x6db7('0x31')]['test']?{'message':'Wrong\x20credentials','statusCode':_0x18eb57[_0x6db7('0x72')]}:_0x18eb57);});}; \ No newline at end of file +var _0xfc73=['requester','subject','description','priority','group','source','ticket_type','company','remove','includes','custom_dropdown','label','default','choices','capitalize','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','send','Wrong\x20credentials','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../components/integrations/configuration','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','sendStatus','error','stack','name','index','FreshdeskAccount','rawAttributes','fieldName','type','key','model','map','query','keys','intersection','attributes','fields','length','hasOwnProperty','sort','where','filters','pick','VIRTUAL','filter','options','then','includeAll','include','findAll','catch','show','params','merge','find','create','body','destroy','getConfigurations','findOne','order','nolimit','AccountId','Subjects','getSubjects','channel','Descriptions','FreshdeskConfiguration','FreshdeskField','getFields','remoteUri','apiKey','slice','substring','lastIndexOf','format','%s/%s','api/v2/ticket_fields','Basic\x20%s','%s:X'];(function(_0x3b2116,_0x287d1b){var _0x5ed69a=function(_0x15ba92){while(--_0x15ba92){_0x3b2116['push'](_0x3b2116['shift']());}};_0x5ed69a(++_0x287d1b);}(_0xfc73,0x8d));var _0x3fc7=function(_0x819464,_0x46fc91){_0x819464=_0x819464-0x0;var _0x49dcc0=_0xfc73[_0x819464];return _0x49dcc0;};'use strict';var emlformat=require(_0x3fc7('0x0'));var rimraf=require(_0x3fc7('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3fc7('0x2'));var rp=require(_0x3fc7('0x3'));var moment=require(_0x3fc7('0x4'));var BPromise=require(_0x3fc7('0x5'));var Mustache=require(_0x3fc7('0x6'));var util=require(_0x3fc7('0x7'));var path=require(_0x3fc7('0x8'));var sox=require(_0x3fc7('0x9'));var csv=require(_0x3fc7('0xa'));var ejs=require(_0x3fc7('0xb'));var fs=require('fs');var fs_extra=require(_0x3fc7('0xc'));var _=require(_0x3fc7('0xd'));var squel=require('squel');var crypto=require(_0x3fc7('0xe'));var jsforce=require(_0x3fc7('0xf'));var deskjs=require(_0x3fc7('0x10'));var toCsv=require(_0x3fc7('0xa'));var querystring=require(_0x3fc7('0x11'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x3fc7('0x12'));var qs=require(_0x3fc7('0x13'));var as=require(_0x3fc7('0x14'));var hardwareService=require(_0x3fc7('0x15'));var logger=require(_0x3fc7('0x16'))(_0x3fc7('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x3fc7('0x18'));var db=require('../../mysqldb')['db'];var integrations=require(_0x3fc7('0x19'));function respondWithStatusCode(_0x16daa1,_0x1e5358){_0x1e5358=_0x1e5358||0xcc;return function(_0x309fa3){if(_0x309fa3){return _0x16daa1['sendStatus'](_0x1e5358);}return _0x16daa1[_0x3fc7('0x1a')](_0x1e5358)[_0x3fc7('0x1b')]();};}function respondWithResult(_0x3a3573,_0x34db32){_0x34db32=_0x34db32||0xc8;return function(_0x2bb4c4){if(_0x2bb4c4){return _0x3a3573[_0x3fc7('0x1a')](_0x34db32)[_0x3fc7('0x1c')](_0x2bb4c4);}};}function respondWithFilteredResult(_0x24267f,_0x105047){return function(_0x1c1f91){if(_0x1c1f91){var _0x31577b=typeof _0x105047[_0x3fc7('0x1d')]===_0x3fc7('0x1e')&&typeof _0x105047[_0x3fc7('0x1f')]===_0x3fc7('0x1e');var _0x16e3c8=_0x1c1f91[_0x3fc7('0x20')];var _0x2583d4=_0x31577b?0x0:_0x105047[_0x3fc7('0x1d')];var _0x502490=_0x31577b?_0x1c1f91['count']:_0x105047[_0x3fc7('0x1d')]+_0x105047['limit'];var _0x4e4997;if(_0x502490>=_0x16e3c8){_0x502490=_0x16e3c8;_0x4e4997=0xc8;}else{_0x4e4997=0xce;}_0x24267f[_0x3fc7('0x1a')](_0x4e4997);return _0x24267f[_0x3fc7('0x21')](_0x3fc7('0x22'),_0x2583d4+'-'+_0x502490+'/'+_0x16e3c8)['json'](_0x1c1f91);}return null;};}function patchUpdates(_0x4fa736){return function(_0x3d5b53){try{jsonpatch[_0x3fc7('0x23')](_0x3d5b53,_0x4fa736,!![]);}catch(_0x302bc5){return BPromise[_0x3fc7('0x24')](_0x302bc5);}return _0x3d5b53[_0x3fc7('0x25')]();};}function saveUpdates(_0x483018,_0x536336){return function(_0x151257){if(_0x151257){return _0x151257[_0x3fc7('0x26')](_0x483018)['then'](function(_0x5590c4){return _0x5590c4;});}return null;};}function removeEntity(_0x4956bf,_0x456ddc){return function(_0x1cfd17){if(_0x1cfd17){return _0x1cfd17['destroy']()['then'](function(){_0x4956bf[_0x3fc7('0x1a')](0xcc)[_0x3fc7('0x1b')]();});}};}function handleEntityNotFound(_0x789c3,_0x31459f){return function(_0x297dd1){if(!_0x297dd1){_0x789c3[_0x3fc7('0x27')](0x194);}return _0x297dd1;};}function handleError(_0x2311c6,_0x7a7cff){_0x7a7cff=_0x7a7cff||0x1f4;return function(_0x13bcf9){logger[_0x3fc7('0x28')](_0x13bcf9[_0x3fc7('0x29')]);if(_0x13bcf9[_0x3fc7('0x2a')]){delete _0x13bcf9[_0x3fc7('0x2a')];}_0x2311c6[_0x3fc7('0x1a')](_0x7a7cff)['send'](_0x13bcf9);};}exports[_0x3fc7('0x2b')]=function(_0xe6297a,_0x4dcfef){var _0x36b6c1={},_0x3ea756={},_0x1defee={'count':0x0,'rows':[]};var _0x268784=_['map'](db[_0x3fc7('0x2c')][_0x3fc7('0x2d')],function(_0x3c89e0){return{'name':_0x3c89e0[_0x3fc7('0x2e')],'type':_0x3c89e0[_0x3fc7('0x2f')][_0x3fc7('0x30')]};});_0x3ea756[_0x3fc7('0x31')]=_[_0x3fc7('0x32')](_0x268784,'name');_0x3ea756[_0x3fc7('0x33')]=_[_0x3fc7('0x34')](_0xe6297a[_0x3fc7('0x33')]);_0x3ea756['filters']=_[_0x3fc7('0x35')](_0x3ea756[_0x3fc7('0x31')],_0x3ea756[_0x3fc7('0x33')]);_0x36b6c1[_0x3fc7('0x36')]=_[_0x3fc7('0x35')](_0x3ea756[_0x3fc7('0x31')],qs['fields'](_0xe6297a['query'][_0x3fc7('0x37')]));_0x36b6c1[_0x3fc7('0x36')]=_0x36b6c1[_0x3fc7('0x36')][_0x3fc7('0x38')]?_0x36b6c1['attributes']:_0x3ea756[_0x3fc7('0x31')];if(!_0xe6297a[_0x3fc7('0x33')][_0x3fc7('0x39')]('nolimit')){_0x36b6c1[_0x3fc7('0x1f')]=qs[_0x3fc7('0x1f')](_0xe6297a[_0x3fc7('0x33')]['limit']);_0x36b6c1['offset']=qs[_0x3fc7('0x1d')](_0xe6297a['query'][_0x3fc7('0x1d')]);}_0x36b6c1['order']=qs[_0x3fc7('0x3a')](_0xe6297a['query'][_0x3fc7('0x3a')]);_0x36b6c1[_0x3fc7('0x3b')]=qs[_0x3fc7('0x3c')](_[_0x3fc7('0x3d')](_0xe6297a[_0x3fc7('0x33')],_0x3ea756['filters']),_0x268784);if(_0xe6297a['query']['filter']){_0x36b6c1['where']=_['merge'](_0x36b6c1[_0x3fc7('0x3b')],{'$or':_[_0x3fc7('0x32')](_0x268784,function(_0x498b7c){if(_0x498b7c[_0x3fc7('0x2f')]!==_0x3fc7('0x3e')){var _0x2c6942={};_0x2c6942[_0x498b7c['name']]={'$like':'%'+_0xe6297a['query'][_0x3fc7('0x3f')]+'%'};return _0x2c6942;}})});}_0x36b6c1=_['merge']({},_0x36b6c1,_0xe6297a[_0x3fc7('0x40')]);var _0x29c65a={'where':_0x36b6c1[_0x3fc7('0x3b')]};return db[_0x3fc7('0x2c')][_0x3fc7('0x20')](_0x29c65a)[_0x3fc7('0x41')](function(_0x463562){_0x1defee['count']=_0x463562;if(_0xe6297a[_0x3fc7('0x33')][_0x3fc7('0x42')]){_0x36b6c1[_0x3fc7('0x43')]=[{'all':!![]}];}return db[_0x3fc7('0x2c')][_0x3fc7('0x44')](_0x36b6c1);})['then'](function(_0x23fa78){_0x1defee['rows']=_0x23fa78;return _0x1defee;})[_0x3fc7('0x41')](respondWithFilteredResult(_0x4dcfef,_0x36b6c1))[_0x3fc7('0x45')](handleError(_0x4dcfef,null));};exports[_0x3fc7('0x46')]=function(_0x46c367,_0x5d93fa){var _0x218f48={'raw':![],'where':{'id':_0x46c367[_0x3fc7('0x47')]['id']}},_0x5991ae={};_0x5991ae[_0x3fc7('0x31')]=_['keys'](db[_0x3fc7('0x2c')][_0x3fc7('0x2d')]);_0x5991ae['query']=_['keys'](_0x46c367['query']);_0x5991ae[_0x3fc7('0x3c')]=_[_0x3fc7('0x35')](_0x5991ae[_0x3fc7('0x31')],_0x5991ae[_0x3fc7('0x33')]);_0x218f48[_0x3fc7('0x36')]=_[_0x3fc7('0x35')](_0x5991ae[_0x3fc7('0x31')],qs[_0x3fc7('0x37')](_0x46c367[_0x3fc7('0x33')][_0x3fc7('0x37')]));_0x218f48[_0x3fc7('0x36')]=_0x218f48[_0x3fc7('0x36')]['length']?_0x218f48[_0x3fc7('0x36')]:_0x5991ae[_0x3fc7('0x31')];if(_0x46c367[_0x3fc7('0x33')][_0x3fc7('0x42')]){_0x218f48[_0x3fc7('0x43')]=[{'all':!![]}];}_0x218f48=_[_0x3fc7('0x48')]({},_0x218f48,_0x46c367[_0x3fc7('0x40')]);return db['FreshdeskAccount'][_0x3fc7('0x49')](_0x218f48)['then'](handleEntityNotFound(_0x5d93fa,null))[_0x3fc7('0x41')](respondWithResult(_0x5d93fa,null))[_0x3fc7('0x45')](handleError(_0x5d93fa,null));};exports[_0x3fc7('0x4a')]=function(_0x2379c9,_0x36f17e){return db[_0x3fc7('0x2c')][_0x3fc7('0x4a')](_0x2379c9[_0x3fc7('0x4b')],{})['then'](respondWithResult(_0x36f17e,0xc9))[_0x3fc7('0x45')](handleError(_0x36f17e,null));};exports[_0x3fc7('0x26')]=function(_0x1a813c,_0x5ae3c7){if(_0x1a813c[_0x3fc7('0x4b')]['id']){delete _0x1a813c['body']['id'];}return db[_0x3fc7('0x2c')][_0x3fc7('0x49')]({'where':{'id':_0x1a813c[_0x3fc7('0x47')]['id']}})[_0x3fc7('0x41')](handleEntityNotFound(_0x5ae3c7,null))['then'](saveUpdates(_0x1a813c[_0x3fc7('0x4b')],null))[_0x3fc7('0x41')](respondWithResult(_0x5ae3c7,null))['catch'](handleError(_0x5ae3c7,null));};exports[_0x3fc7('0x4c')]=function(_0x3f5167,_0x5234e4){return db['FreshdeskAccount']['find']({'where':{'id':_0x3f5167['params']['id']}})['then'](handleEntityNotFound(_0x5234e4,null))[_0x3fc7('0x41')](removeEntity(_0x5234e4,null))[_0x3fc7('0x45')](handleError(_0x5234e4,null));};exports[_0x3fc7('0x4d')]=function(_0x588ec2,_0x2045d9,_0x142782){var _0x3e0ccb={};var _0x54dc15={};var _0x3a5c51;var _0x12b93b;return db[_0x3fc7('0x2c')][_0x3fc7('0x4e')]({'where':{'id':_0x588ec2[_0x3fc7('0x47')]['id']}})[_0x3fc7('0x41')](handleEntityNotFound(_0x2045d9,null))['then'](function(_0x4fe18a){if(_0x4fe18a){_0x3a5c51=_0x4fe18a;_0x54dc15[_0x3fc7('0x31')]=_[_0x3fc7('0x34')](db['FreshdeskConfiguration'][_0x3fc7('0x2d')]);_0x54dc15[_0x3fc7('0x33')]=_['keys'](_0x588ec2['query']);_0x54dc15[_0x3fc7('0x3c')]=_[_0x3fc7('0x35')](_0x54dc15[_0x3fc7('0x31')],_0x54dc15['query']);_0x3e0ccb[_0x3fc7('0x36')]=_[_0x3fc7('0x35')](_0x54dc15[_0x3fc7('0x31')],qs[_0x3fc7('0x37')](_0x588ec2[_0x3fc7('0x33')][_0x3fc7('0x37')]));_0x3e0ccb[_0x3fc7('0x36')]=_0x3e0ccb[_0x3fc7('0x36')][_0x3fc7('0x38')]?_0x3e0ccb['attributes']:_0x54dc15['model'];_0x3e0ccb[_0x3fc7('0x4f')]=qs[_0x3fc7('0x3a')](_0x588ec2[_0x3fc7('0x33')][_0x3fc7('0x3a')]);_0x3e0ccb[_0x3fc7('0x3b')]=qs[_0x3fc7('0x3c')](_['pick'](_0x588ec2['query'],_0x54dc15['filters']));if(_0x588ec2['query'][_0x3fc7('0x3f')]){_0x3e0ccb[_0x3fc7('0x3b')]=_[_0x3fc7('0x48')](_0x3e0ccb[_0x3fc7('0x3b')],{'$or':_[_0x3fc7('0x32')](_0x3e0ccb[_0x3fc7('0x36')],function(_0x58bb00){var _0x4e11bd={};_0x4e11bd[_0x58bb00]={'$like':'%'+_0x588ec2[_0x3fc7('0x33')][_0x3fc7('0x3f')]+'%'};return _0x4e11bd;})});}_0x3e0ccb=_['merge']({},_0x3e0ccb,_0x588ec2[_0x3fc7('0x40')]);return _0x3a5c51[_0x3fc7('0x4d')](_0x3e0ccb);}})[_0x3fc7('0x41')](function(_0x57653d){if(_0x57653d){_0x12b93b=_0x57653d[_0x3fc7('0x38')];if(!_0x588ec2[_0x3fc7('0x33')][_0x3fc7('0x39')](_0x3fc7('0x50'))){_0x3e0ccb[_0x3fc7('0x1f')]=qs[_0x3fc7('0x1f')](_0x588ec2[_0x3fc7('0x33')]['limit']);_0x3e0ccb[_0x3fc7('0x1d')]=qs[_0x3fc7('0x1d')](_0x588ec2[_0x3fc7('0x33')][_0x3fc7('0x1d')]);}return _0x3a5c51['getConfigurations'](_0x3e0ccb);}})['then'](function(_0x3bb8f6){if(_0x3bb8f6){return _0x3bb8f6?{'count':_0x12b93b,'rows':_0x3bb8f6}:null;}})[_0x3fc7('0x41')](respondWithResult(_0x2045d9,null))['catch'](handleError(_0x2045d9,null));};exports['addConfiguration']=function(_0x5953e9,_0x429fe8,_0x353728){if(_0x5953e9[_0x3fc7('0x4b')]['id']){delete _0x5953e9['body']['id'];}return db[_0x3fc7('0x2c')]['findOne']({'where':{'id':_0x5953e9[_0x3fc7('0x47')]['id']}})[_0x3fc7('0x41')](handleEntityNotFound(_0x429fe8,null))[_0x3fc7('0x41')](function(_0x3b6933){if(_0x3b6933){_0x5953e9[_0x3fc7('0x4b')][_0x3fc7('0x51')]=_0x3b6933['id'];_0x5953e9['body'][_0x3fc7('0x52')]=integrations[_0x3fc7('0x53')](_0x5953e9[_0x3fc7('0x4b')][_0x3fc7('0x54')],_0x5953e9[_0x3fc7('0x4b')][_0x3fc7('0x2f')]);_0x5953e9['body'][_0x3fc7('0x55')]=integrations['getDescriptions'](_0x5953e9[_0x3fc7('0x4b')][_0x3fc7('0x54')],_0x5953e9[_0x3fc7('0x4b')]['type']);return db[_0x3fc7('0x56')][_0x3fc7('0x4a')](_0x5953e9[_0x3fc7('0x4b')],{'include':[{'model':db[_0x3fc7('0x57')],'as':'Subjects'},{'model':db[_0x3fc7('0x57')],'as':'Descriptions'}]});}return null;})[_0x3fc7('0x41')](respondWithResult(_0x429fe8,null))['catch'](handleError(_0x429fe8,null));};exports[_0x3fc7('0x58')]=function(_0x2c4486,_0x228bff,_0x1b0eaa){var _0x5e4fb2='';return db[_0x3fc7('0x2c')][_0x3fc7('0x4e')]({'where':{'id':_0x2c4486[_0x3fc7('0x47')]['id']},'attributes':['id',_0x3fc7('0x59'),_0x3fc7('0x5a')]})[_0x3fc7('0x41')](handleEntityNotFound(_0x228bff,null))[_0x3fc7('0x41')](function(_0x422406){if(_0x422406){_0x5e4fb2=_0x422406[_0x3fc7('0x59')];var _0x48cee0=_0x5e4fb2[_0x3fc7('0x5b')](-0x1);if(_0x48cee0==='/'){_0x5e4fb2=_0x5e4fb2[_0x3fc7('0x5c')](0x0,_0x5e4fb2[_0x3fc7('0x5d')](_0x48cee0));}return rp({'method':'GET','uri':util[_0x3fc7('0x5e')](_0x3fc7('0x5f'),_0x5e4fb2,_0x3fc7('0x60')),'headers':{'Authorization':util[_0x3fc7('0x5e')](_0x3fc7('0x61'),new Buffer(util[_0x3fc7('0x5e')](_0x3fc7('0x62'),_0x422406[_0x3fc7('0x5a')]))['toString']('base64'))},'json':!![]});}})['then'](function(_0x29fc88){if(_0x29fc88){var _0x2b6bce=[_0x3fc7('0x63'),_0x3fc7('0x64'),'agent',_0x3fc7('0x65'),_0x3fc7('0x1a'),_0x3fc7('0x66'),_0x3fc7('0x67'),_0x3fc7('0x68'),_0x3fc7('0x69'),_0x3fc7('0x67'),_0x3fc7('0x6a')];_[_0x3fc7('0x6b')](_0x29fc88,function(_0x3fb497){return _0x2b6bce[_0x3fc7('0x6c')](_0x3fb497[_0x3fc7('0x2a')])||!_0x3fb497['default']&&_0x3fb497[_0x3fc7('0x2f')]!=='custom_text'&&_0x3fb497['type']!==_0x3fc7('0x6d');});return{'count':_0x29fc88[_0x3fc7('0x38')],'rows':_['map'](_0x29fc88,function(_0x46b109){return{'id':_0x46b109['name'],'name':_0x46b109[_0x3fc7('0x6e')],'custom':!_0x46b109[_0x3fc7('0x6f')],'options':_0x46b109[_0x3fc7('0x70')]?_[_0x3fc7('0x32')](_0x46b109[_0x3fc7('0x70')],function(_0x44cf7f){return{'name':_[_0x3fc7('0x71')](_0x44cf7f),'value':_0x44cf7f};}):[]};})};}})[_0x3fc7('0x41')](respondWithResult(_0x228bff,null))['catch'](function(_0x2f5e9f){var _0x26b1ca=_0x2c4486[_0x3fc7('0x33')][_0x3fc7('0x72')]?0x1f4:_0x2f5e9f[_0x3fc7('0x73')]||0x1f4;logger[_0x3fc7('0x28')](_0x3fc7('0x74'),_0x3fc7('0x58'),_0x26b1ca,JSON[_0x3fc7('0x75')](_0x2f5e9f));delete _0x2f5e9f[_0x3fc7('0x2a')];if(_0x26b1ca===0x191){_0x26b1ca=0x190;}_0x228bff[_0x3fc7('0x1a')](_0x26b1ca)[_0x3fc7('0x76')](_0x2c4486[_0x3fc7('0x33')][_0x3fc7('0x72')]?{'message':_0x3fc7('0x77'),'statusCode':_0x2f5e9f[_0x3fc7('0x73')]}:_0x2f5e9f);});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js index 73e45bd..a5db2f3 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 _0x9606=['path','rimraf','../../config/environment','./intFreshdeskAccount.attributes','exports','FreshdeskAccount','util','../../config/logger','moment','bluebird','request-promise'];(function(_0x4b4d13,_0x50d646){var _0x3115be=function(_0x19e903){while(--_0x19e903){_0x4b4d13['push'](_0x4b4d13['shift']());}};_0x3115be(++_0x50d646);}(_0x9606,0x119));var _0x6960=function(_0x1b7c8b,_0x4813b3){_0x1b7c8b=_0x1b7c8b-0x0;var _0x587109=_0x9606[_0x1b7c8b];return _0x587109;};'use strict';var _=require('lodash');var util=require(_0x6960('0x0'));var logger=require(_0x6960('0x1'))('api');var moment=require(_0x6960('0x2'));var BPromise=require(_0x6960('0x3'));var rp=require(_0x6960('0x4'));var fs=require('fs');var path=require(_0x6960('0x5'));var rimraf=require(_0x6960('0x6'));var config=require(_0x6960('0x7'));var attributes=require(_0x6960('0x8'));var integrations=require('../../components/integrations/configuration');module[_0x6960('0x9')]=function(_0x229f40,_0x3d1f46){return _0x229f40['define'](_0x6960('0xa'),attributes,{'tableName':'int_freshdesk_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x916c=['int_freshdesk_accounts','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','exports','define'];(function(_0xba78e1,_0x452ddb){var _0x4a7b98=function(_0x72a5ef){while(--_0x72a5ef){_0xba78e1['push'](_0xba78e1['shift']());}};_0x4a7b98(++_0x452ddb);}(_0x916c,0x109));var _0xc916=function(_0x2ac5f8,_0x4c3a9f){_0x2ac5f8=_0x2ac5f8-0x0;var _0x3b8229=_0x916c[_0x2ac5f8];return _0x3b8229;};'use strict';var _=require(_0xc916('0x0'));var util=require(_0xc916('0x1'));var logger=require(_0xc916('0x2'))(_0xc916('0x3'));var moment=require(_0xc916('0x4'));var BPromise=require('bluebird');var rp=require(_0xc916('0x5'));var fs=require('fs');var path=require(_0xc916('0x6'));var rimraf=require(_0xc916('0x7'));var config=require(_0xc916('0x8'));var attributes=require('./intFreshdeskAccount.attributes');var integrations=require('../../components/integrations/configuration');module[_0xc916('0x9')]=function(_0x50cb82,_0x3fe8cf){return _0x50cb82[_0xc916('0xa')]('FreshdeskAccount',attributes,{'tableName':_0xc916('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.rpc.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.rpc.js index 4fb0df3..d44aaf1 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 _0x4119=['debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','GetFreshdeskAccount','FreshdeskAccount','findAll','options','raw','attributes','limit','map','include','model','then','stringify','catch','ShowFreshdeskAccount','find','where','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','FreshdeskAccount,\x20%s,\x20%s','request\x20sent'];(function(_0x4b3032,_0xb06e2d){var _0x139f4d=function(_0x31a55d){while(--_0x31a55d){_0x4b3032['push'](_0x4b3032['shift']());}};_0x139f4d(++_0xb06e2d);}(_0x4119,0xfa));var _0x9411=function(_0xae7c2f,_0xf31e04){_0xae7c2f=_0xae7c2f-0x0;var _0x5d7001=_0x4119[_0xae7c2f];return _0x5d7001;};'use strict';var _=require(_0x9411('0x0'));var util=require(_0x9411('0x1'));var moment=require(_0x9411('0x2'));var BPromise=require(_0x9411('0x3'));var rs=require(_0x9411('0x4'));var fs=require('fs');var Redis=require(_0x9411('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x9411('0x6'));var logger=require(_0x9411('0x7'))('rpc');var config=require(_0x9411('0x8'));var jayson=require(_0x9411('0x9'));var client=jayson[_0x9411('0xa')][_0x9411('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x318510,_0x3fd5fa,_0x5f1fb7){return new BPromise(function(_0x9e2af3,_0x7251ff){return client[_0x9411('0xc')](_0x318510,_0x5f1fb7)['then'](function(_0x1aaeb9){logger[_0x9411('0xd')](_0x9411('0xe'),_0x3fd5fa,_0x9411('0xf'));logger[_0x9411('0x10')](_0x9411('0x11'),_0x3fd5fa,_0x9411('0xf'),JSON['stringify'](_0x1aaeb9));if(_0x1aaeb9[_0x9411('0x12')]){if(_0x1aaeb9['error'][_0x9411('0x13')]===0x1f4){logger[_0x9411('0x12')](_0x9411('0xe'),_0x3fd5fa,_0x1aaeb9['error'][_0x9411('0x14')]);return _0x7251ff(_0x1aaeb9[_0x9411('0x12')][_0x9411('0x14')]);}logger[_0x9411('0x12')](_0x9411('0xe'),_0x3fd5fa,_0x1aaeb9['error'][_0x9411('0x14')]);return _0x9e2af3(_0x1aaeb9['error'][_0x9411('0x14')]);}else{logger[_0x9411('0xd')](_0x9411('0xe'),_0x3fd5fa,_0x9411('0xf'));_0x9e2af3(_0x1aaeb9[_0x9411('0x15')][_0x9411('0x14')]);}})['catch'](function(_0x32013c){logger[_0x9411('0x12')](_0x9411('0xe'),_0x3fd5fa,_0x32013c);_0x7251ff(_0x32013c);});});}exports[_0x9411('0x16')]=function(_0x35e04c){var _0x53858e=this;return new Promise(function(_0x2c87cd,_0x2ad1ee){return db[_0x9411('0x17')][_0x9411('0x18')]({'raw':_0x35e04c[_0x9411('0x19')]?_0x35e04c[_0x9411('0x19')][_0x9411('0x1a')]===undefined?!![]:![]:!![],'where':_0x35e04c[_0x9411('0x19')]?_0x35e04c[_0x9411('0x19')]['where']||null:null,'attributes':_0x35e04c['options']?_0x35e04c[_0x9411('0x19')][_0x9411('0x1b')]||null:null,'limit':_0x35e04c[_0x9411('0x19')]?_0x35e04c['options'][_0x9411('0x1c')]||null:null,'include':_0x35e04c[_0x9411('0x19')]?_0x35e04c[_0x9411('0x19')]['include']?_[_0x9411('0x1d')](_0x35e04c[_0x9411('0x19')][_0x9411('0x1e')],function(_0x5abbb8){return{'model':db[_0x5abbb8[_0x9411('0x1f')]],'as':_0x5abbb8['as'],'attributes':_0x5abbb8['attributes'],'include':_0x5abbb8[_0x9411('0x1e')]?_[_0x9411('0x1d')](_0x5abbb8[_0x9411('0x1e')],function(_0x2ea237){return{'model':db[_0x2ea237[_0x9411('0x1f')]],'as':_0x2ea237['as'],'attributes':_0x2ea237['attributes'],'include':_0x2ea237['include']?_[_0x9411('0x1d')](_0x2ea237['include'],function(_0x494823){return{'model':db[_0x494823['model']],'as':_0x494823['as'],'attributes':_0x494823[_0x9411('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x9411('0x20')](function(_0x3f7ee3){logger[_0x9411('0xd')]('GetFreshdeskAccount',_0x35e04c);logger[_0x9411('0x10')](_0x9411('0x16'),_0x35e04c,JSON[_0x9411('0x21')](_0x3f7ee3));_0x2c87cd(_0x3f7ee3);})[_0x9411('0x22')](function(_0x289cdd){logger[_0x9411('0x12')](_0x9411('0x16'),_0x289cdd[_0x9411('0x14')],_0x35e04c);_0x2ad1ee(_0x53858e['error'](0x1f4,_0x289cdd[_0x9411('0x14')]));});});};exports[_0x9411('0x23')]=function(_0x269c40){var _0x60e72e=this;return new Promise(function(_0x1c7474,_0x581d80){return db['FreshdeskAccount'][_0x9411('0x24')]({'raw':_0x269c40[_0x9411('0x19')]?_0x269c40[_0x9411('0x19')][_0x9411('0x1a')]===undefined?!![]:![]:!![],'where':_0x269c40['options']?_0x269c40['options'][_0x9411('0x25')]||null:null,'attributes':_0x269c40[_0x9411('0x19')]?_0x269c40[_0x9411('0x19')][_0x9411('0x1b')]||null:null,'include':_0x269c40[_0x9411('0x19')]?_0x269c40['options'][_0x9411('0x1e')]?_['map'](_0x269c40[_0x9411('0x19')][_0x9411('0x1e')],function(_0x492f3d){return{'model':db[_0x492f3d[_0x9411('0x1f')]],'as':_0x492f3d['as'],'attributes':_0x492f3d[_0x9411('0x1b')],'include':_0x492f3d['include']?_[_0x9411('0x1d')](_0x492f3d[_0x9411('0x1e')],function(_0x2b0f95){return{'model':db[_0x2b0f95[_0x9411('0x1f')]],'as':_0x2b0f95['as'],'attributes':_0x2b0f95[_0x9411('0x1b')],'include':_0x2b0f95[_0x9411('0x1e')]?_[_0x9411('0x1d')](_0x2b0f95[_0x9411('0x1e')],function(_0x20dff6){return{'model':db[_0x20dff6['model']],'as':_0x20dff6['as'],'attributes':_0x20dff6[_0x9411('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x9411('0x20')](function(_0x2103af){logger[_0x9411('0xd')](_0x9411('0x23'),_0x269c40);logger[_0x9411('0x10')](_0x9411('0x23'),_0x269c40,JSON[_0x9411('0x21')](_0x2103af));_0x1c7474(_0x2103af);})['catch'](function(_0x33a492){logger[_0x9411('0x12')](_0x9411('0x23'),_0x33a492[_0x9411('0x14')],_0x269c40);_0x581d80(_0x60e72e[_0x9411('0x12')](0x1f4,_0x33a492[_0x9411('0x14')]));});});}; \ No newline at end of file +var _0x8767=['error','code','message','result','catch','GetFreshdeskAccount','FreshdeskAccount','findAll','raw','options','attributes','limit','include','model','map','info','stringify','ShowFreshdeskAccount','find','where','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','then','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x8767,0x134));var _0x7876=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8767[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x7876('0x0'));var moment=require(_0x7876('0x1'));var BPromise=require(_0x7876('0x2'));var rs=require(_0x7876('0x3'));var fs=require('fs');var Redis=require(_0x7876('0x4'));var db=require(_0x7876('0x5'))['db'];var utils=require(_0x7876('0x6'));var logger=require(_0x7876('0x7'))(_0x7876('0x8'));var config=require(_0x7876('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x7876('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x484227,_0x43e86f,_0x167524){return new BPromise(function(_0x11fdd1,_0x19e7d3){return client['request'](_0x484227,_0x167524)[_0x7876('0xb')](function(_0x50136a){logger['info'](_0x7876('0xc'),_0x43e86f,_0x7876('0xd'));logger[_0x7876('0xe')](_0x7876('0xf'),_0x43e86f,_0x7876('0xd'),JSON['stringify'](_0x50136a));if(_0x50136a[_0x7876('0x10')]){if(_0x50136a[_0x7876('0x10')][_0x7876('0x11')]===0x1f4){logger[_0x7876('0x10')](_0x7876('0xc'),_0x43e86f,_0x50136a[_0x7876('0x10')][_0x7876('0x12')]);return _0x19e7d3(_0x50136a[_0x7876('0x10')][_0x7876('0x12')]);}logger[_0x7876('0x10')](_0x7876('0xc'),_0x43e86f,_0x50136a[_0x7876('0x10')]['message']);return _0x11fdd1(_0x50136a[_0x7876('0x10')][_0x7876('0x12')]);}else{logger['info'](_0x7876('0xc'),_0x43e86f,'request\x20sent');_0x11fdd1(_0x50136a[_0x7876('0x13')][_0x7876('0x12')]);}})[_0x7876('0x14')](function(_0x4c825d){logger[_0x7876('0x10')](_0x7876('0xc'),_0x43e86f,_0x4c825d);_0x19e7d3(_0x4c825d);});});}exports[_0x7876('0x15')]=function(_0x18a301){var _0x594503=this;return new Promise(function(_0xaf8a14,_0x8c969e){return db[_0x7876('0x16')][_0x7876('0x17')]({'raw':_0x18a301['options']?_0x18a301['options'][_0x7876('0x18')]===undefined?!![]:![]:!![],'where':_0x18a301['options']?_0x18a301[_0x7876('0x19')]['where']||null:null,'attributes':_0x18a301[_0x7876('0x19')]?_0x18a301[_0x7876('0x19')][_0x7876('0x1a')]||null:null,'limit':_0x18a301['options']?_0x18a301[_0x7876('0x19')][_0x7876('0x1b')]||null:null,'include':_0x18a301[_0x7876('0x19')]?_0x18a301['options'][_0x7876('0x1c')]?_['map'](_0x18a301[_0x7876('0x19')][_0x7876('0x1c')],function(_0x140f5e){return{'model':db[_0x140f5e[_0x7876('0x1d')]],'as':_0x140f5e['as'],'attributes':_0x140f5e[_0x7876('0x1a')],'include':_0x140f5e[_0x7876('0x1c')]?_[_0x7876('0x1e')](_0x140f5e['include'],function(_0x30bfed){return{'model':db[_0x30bfed[_0x7876('0x1d')]],'as':_0x30bfed['as'],'attributes':_0x30bfed[_0x7876('0x1a')],'include':_0x30bfed[_0x7876('0x1c')]?_[_0x7876('0x1e')](_0x30bfed['include'],function(_0x35ce2b){return{'model':db[_0x35ce2b[_0x7876('0x1d')]],'as':_0x35ce2b['as'],'attributes':_0x35ce2b[_0x7876('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x7876('0xb')](function(_0x3a6646){logger[_0x7876('0x1f')](_0x7876('0x15'),_0x18a301);logger[_0x7876('0xe')](_0x7876('0x15'),_0x18a301,JSON[_0x7876('0x20')](_0x3a6646));_0xaf8a14(_0x3a6646);})[_0x7876('0x14')](function(_0x346799){logger[_0x7876('0x10')](_0x7876('0x15'),_0x346799[_0x7876('0x12')],_0x18a301);_0x8c969e(_0x594503[_0x7876('0x10')](0x1f4,_0x346799[_0x7876('0x12')]));});});};exports[_0x7876('0x21')]=function(_0x3aceab){var _0x307cb2=this;return new Promise(function(_0x49648a,_0x3c614a){return db[_0x7876('0x16')][_0x7876('0x22')]({'raw':_0x3aceab[_0x7876('0x19')]?_0x3aceab['options'][_0x7876('0x18')]===undefined?!![]:![]:!![],'where':_0x3aceab[_0x7876('0x19')]?_0x3aceab[_0x7876('0x19')][_0x7876('0x23')]||null:null,'attributes':_0x3aceab[_0x7876('0x19')]?_0x3aceab['options'][_0x7876('0x1a')]||null:null,'include':_0x3aceab[_0x7876('0x19')]?_0x3aceab[_0x7876('0x19')][_0x7876('0x1c')]?_[_0x7876('0x1e')](_0x3aceab[_0x7876('0x19')][_0x7876('0x1c')],function(_0x4f5ab6){return{'model':db[_0x4f5ab6[_0x7876('0x1d')]],'as':_0x4f5ab6['as'],'attributes':_0x4f5ab6[_0x7876('0x1a')],'include':_0x4f5ab6['include']?_[_0x7876('0x1e')](_0x4f5ab6[_0x7876('0x1c')],function(_0x5d301f){return{'model':db[_0x5d301f[_0x7876('0x1d')]],'as':_0x5d301f['as'],'attributes':_0x5d301f[_0x7876('0x1a')],'include':_0x5d301f[_0x7876('0x1c')]?_[_0x7876('0x1e')](_0x5d301f[_0x7876('0x1c')],function(_0x3e382b){return{'model':db[_0x3e382b['model']],'as':_0x3e382b['as'],'attributes':_0x3e382b['attributes']};}):[]};}):[]};}):[]:[]})[_0x7876('0xb')](function(_0x326cc9){logger[_0x7876('0x1f')](_0x7876('0x21'),_0x3aceab);logger[_0x7876('0xe')](_0x7876('0x21'),_0x3aceab,JSON[_0x7876('0x20')](_0x326cc9));_0x49648a(_0x326cc9);})[_0x7876('0x14')](function(_0x2ca9fe){logger['error'](_0x7876('0x21'),_0x2ca9fe['message'],_0x3aceab);_0x3c614a(_0x307cb2[_0x7876('0x10')](0x1f4,_0x2ca9fe[_0x7876('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/index.js b/server/api/intFreshdeskConfiguration/index.js index c3b15f8..0b45f77 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 _0x4de3=['destroy','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./intFreshdeskConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','getTags','post','create','setTags','put','update'];(function(_0x2b4411,_0x2625ed){var _0x8e41ef=function(_0x2aa8c1){while(--_0x2aa8c1){_0x2b4411['push'](_0x2b4411['shift']());}};_0x8e41ef(++_0x2625ed);}(_0x4de3,0x16d));var _0x34de=function(_0x404820,_0xfb6cdd){_0x404820=_0x404820-0x0;var _0x30fbf1=_0x4de3[_0x404820];return _0x30fbf1;};'use strict';var multer=require('multer');var util=require(_0x34de('0x0'));var path=require(_0x34de('0x1'));var timeout=require(_0x34de('0x2'));var express=require(_0x34de('0x3'));var router=express['Router']();var fs_extra=require(_0x34de('0x4'));var auth=require(_0x34de('0x5'));var interaction=require(_0x34de('0x6'));var config=require('../../config/environment');var controller=require(_0x34de('0x7'));router[_0x34de('0x8')]('/',auth[_0x34de('0x9')](),controller[_0x34de('0xa')]);router[_0x34de('0x8')](_0x34de('0xb'),auth['isAuthenticated'](),controller[_0x34de('0xc')]);router[_0x34de('0x8')](_0x34de('0xd'),auth[_0x34de('0x9')](),controller[_0x34de('0xe')]);router[_0x34de('0x8')]('/:id/subjects',auth[_0x34de('0x9')](),controller[_0x34de('0xf')]);router[_0x34de('0x8')](_0x34de('0x10'),auth[_0x34de('0x9')](),controller[_0x34de('0x11')]);router['get'](_0x34de('0x12'),auth['isAuthenticated'](),controller[_0x34de('0x13')]);router[_0x34de('0x14')]('/',auth[_0x34de('0x9')](),controller[_0x34de('0x15')]);router[_0x34de('0x14')]('/:id/tags',auth[_0x34de('0x9')](),controller[_0x34de('0x16')]);router[_0x34de('0x17')](_0x34de('0xb'),auth[_0x34de('0x9')](),controller[_0x34de('0x18')]);router['delete'](_0x34de('0xb'),auth[_0x34de('0x9')](),controller[_0x34de('0x19')]);module['exports']=router; \ No newline at end of file +var _0xda6f=['delete','multer','util','path','connect-timeout','express','../../components/interaction/service','../../config/environment','./intFreshdeskConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','create','post','/:id/tags','setTags','put','update'];(function(_0x791857,_0x1792be){var _0x377b2a=function(_0x38e7bf){while(--_0x38e7bf){_0x791857['push'](_0x791857['shift']());}};_0x377b2a(++_0x1792be);}(_0xda6f,0x1ef));var _0xfda6=function(_0x29c565,_0x1cc9cd){_0x29c565=_0x29c565-0x0;var _0x1bdf36=_0xda6f[_0x29c565];return _0x1bdf36;};'use strict';var multer=require(_0xfda6('0x0'));var util=require(_0xfda6('0x1'));var path=require(_0xfda6('0x2'));var timeout=require(_0xfda6('0x3'));var express=require(_0xfda6('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xfda6('0x5'));var config=require(_0xfda6('0x6'));var controller=require(_0xfda6('0x7'));router[_0xfda6('0x8')]('/',auth[_0xfda6('0x9')](),controller[_0xfda6('0xa')]);router[_0xfda6('0x8')](_0xfda6('0xb'),auth[_0xfda6('0x9')](),controller[_0xfda6('0xc')]);router[_0xfda6('0x8')](_0xfda6('0xd'),auth[_0xfda6('0x9')](),controller[_0xfda6('0xe')]);router[_0xfda6('0x8')](_0xfda6('0xf'),auth['isAuthenticated'](),controller[_0xfda6('0x10')]);router[_0xfda6('0x8')](_0xfda6('0x11'),auth['isAuthenticated'](),controller[_0xfda6('0x12')]);router['get']('/:id/tags',auth[_0xfda6('0x9')](),controller['getTags']);router['post']('/',auth['isAuthenticated'](),controller[_0xfda6('0x13')]);router[_0xfda6('0x14')](_0xfda6('0x15'),auth[_0xfda6('0x9')](),controller[_0xfda6('0x16')]);router[_0xfda6('0x17')]('/:id',auth[_0xfda6('0x9')](),controller[_0xfda6('0x18')]);router[_0xfda6('0x19')](_0xfda6('0xb'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js index fb2d6aa..7367176 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 _0xae4e=['exports','STRING','sequelize'];(function(_0x2f04fa,_0x2b82a1){var _0x7b762=function(_0x1f4fd4){while(--_0x1f4fd4){_0x2f04fa['push'](_0x2f04fa['shift']());}};_0x7b762(++_0x2b82a1);}(_0xae4e,0x1df));var _0xeae4=function(_0x45a1b1,_0x5258a5){_0x45a1b1=_0x45a1b1-0x0;var _0x3fb8d7=_0xae4e[_0x45a1b1];return _0x3fb8d7;};'use strict';var Sequelize=require(_0xeae4('0x0'));module[_0xeae4('0x1')]={'name':{'type':Sequelize[_0xeae4('0x2')]},'description':{'type':Sequelize[_0xeae4('0x2')]}}; \ No newline at end of file +var _0x670b=['exports','STRING','sequelize'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x670b,0x1e8));var _0xb670=function(_0x4c074d,_0x27d130){_0x4c074d=_0x4c074d-0x0;var _0x23a6d2=_0x670b[_0x4c074d];return _0x23a6d2;};'use strict';var Sequelize=require(_0xb670('0x0'));module[_0xb670('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xb670('0x2')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js index 02d9c46..d457eda 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 _0xbdcc=['setTags','ids','eml-format','rimraf','zip-dir','fast-json-patch','mustache','util','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','status','json','undefined','offset','count','set','apply','reject','save','update','then','end','name','index','FreshdeskConfiguration','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','map','VIRTUAL','includeAll','rows','catch','show','params','keys','options','create','body','destroy','find','findOne','FreshdeskField','getFields','getSubjects','getTags','Tag'];(function(_0x110552,_0x241f68){var _0x45cb8a=function(_0x53b752){while(--_0x53b752){_0x110552['push'](_0x110552['shift']());}};_0x45cb8a(++_0x241f68);}(_0xbdcc,0x1d6));var _0xcbdc=function(_0xbf27a5,_0x46e7d3){_0xbf27a5=_0xbf27a5-0x0;var _0x733bbf=_0xbdcc[_0xbf27a5];return _0x733bbf;};'use strict';var emlformat=require(_0xcbdc('0x0'));var rimraf=require(_0xcbdc('0x1'));var zipdir=require(_0xcbdc('0x2'));var jsonpatch=require(_0xcbdc('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xcbdc('0x4'));var util=require(_0xcbdc('0x5'));var path=require('path');var sox=require(_0xcbdc('0x6'));var csv=require(_0xcbdc('0x7'));var ejs=require(_0xcbdc('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xcbdc('0x9'));var squel=require(_0xcbdc('0xa'));var crypto=require('crypto');var jsforce=require(_0xcbdc('0xb'));var deskjs=require(_0xcbdc('0xc'));var toCsv=require(_0xcbdc('0x7'));var querystring=require('querystring');var Papa=require(_0xcbdc('0xd'));var Redis=require(_0xcbdc('0xe'));var authService=require(_0xcbdc('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xcbdc('0x10'));var hardwareService=require(_0xcbdc('0x11'));var logger=require(_0xcbdc('0x12'))('api');var utils=require(_0xcbdc('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0xcbdc('0x14'));var db=require(_0xcbdc('0x15'))['db'];function respondWithStatusCode(_0x36dfc2,_0x2aedbf){_0x2aedbf=_0x2aedbf||0xcc;return function(_0x3665ce){if(_0x3665ce){return _0x36dfc2['sendStatus'](_0x2aedbf);}return _0x36dfc2[_0xcbdc('0x16')](_0x2aedbf)['end']();};}function respondWithResult(_0x3399ad,_0x1f6bea){_0x1f6bea=_0x1f6bea||0xc8;return function(_0x22545d){if(_0x22545d){return _0x3399ad[_0xcbdc('0x16')](_0x1f6bea)[_0xcbdc('0x17')](_0x22545d);}};}function respondWithFilteredResult(_0x4e003e,_0x49558b){return function(_0x396100){if(_0x396100){var _0x2a7337=typeof _0x49558b['offset']===_0xcbdc('0x18')&&typeof _0x49558b['limit']===_0xcbdc('0x18');var _0x3b215f=_0x396100['count'];var _0x2c8611=_0x2a7337?0x0:_0x49558b[_0xcbdc('0x19')];var _0x1cf76a=_0x2a7337?_0x396100[_0xcbdc('0x1a')]:_0x49558b[_0xcbdc('0x19')]+_0x49558b['limit'];var _0x2c6767;if(_0x1cf76a>=_0x3b215f){_0x1cf76a=_0x3b215f;_0x2c6767=0xc8;}else{_0x2c6767=0xce;}_0x4e003e[_0xcbdc('0x16')](_0x2c6767);return _0x4e003e[_0xcbdc('0x1b')]('Content-Range',_0x2c8611+'-'+_0x1cf76a+'/'+_0x3b215f)['json'](_0x396100);}return null;};}function patchUpdates(_0x3efe32){return function(_0xd683e5){try{jsonpatch[_0xcbdc('0x1c')](_0xd683e5,_0x3efe32,!![]);}catch(_0x2d846f){return BPromise[_0xcbdc('0x1d')](_0x2d846f);}return _0xd683e5[_0xcbdc('0x1e')]();};}function saveUpdates(_0x16a824,_0x21fd3c){return function(_0xfc77c1){if(_0xfc77c1){return _0xfc77c1[_0xcbdc('0x1f')](_0x16a824)[_0xcbdc('0x20')](function(_0x343a91){return _0x343a91;});}return null;};}function removeEntity(_0x34aed3,_0x10f87d){return function(_0x47455e){if(_0x47455e){return _0x47455e['destroy']()[_0xcbdc('0x20')](function(){_0x34aed3[_0xcbdc('0x16')](0xcc)[_0xcbdc('0x21')]();});}};}function handleEntityNotFound(_0x5ac1c7,_0x11b5d5){return function(_0x3965e2){if(!_0x3965e2){_0x5ac1c7['sendStatus'](0x194);}return _0x3965e2;};}function handleError(_0x19b83f,_0x3accd1){_0x3accd1=_0x3accd1||0x1f4;return function(_0xedadb1){logger['error'](_0xedadb1['stack']);if(_0xedadb1[_0xcbdc('0x22')]){delete _0xedadb1['name'];}_0x19b83f[_0xcbdc('0x16')](_0x3accd1)['send'](_0xedadb1);};}exports[_0xcbdc('0x23')]=function(_0x5ca7ee,_0x307386){var _0x1944c5={},_0x496b27={},_0x4c307f={'count':0x0,'rows':[]};var _0x4894d5=_['map'](db[_0xcbdc('0x24')][_0xcbdc('0x25')],function(_0x3e2f3e){return{'name':_0x3e2f3e[_0xcbdc('0x26')],'type':_0x3e2f3e[_0xcbdc('0x27')][_0xcbdc('0x28')]};});_0x496b27[_0xcbdc('0x29')]=_['map'](_0x4894d5,_0xcbdc('0x22'));_0x496b27[_0xcbdc('0x2a')]=_['keys'](_0x5ca7ee['query']);_0x496b27[_0xcbdc('0x2b')]=_[_0xcbdc('0x2c')](_0x496b27[_0xcbdc('0x29')],_0x496b27['query']);_0x1944c5[_0xcbdc('0x2d')]=_[_0xcbdc('0x2c')](_0x496b27[_0xcbdc('0x29')],qs['fields'](_0x5ca7ee['query'][_0xcbdc('0x2e')]));_0x1944c5[_0xcbdc('0x2d')]=_0x1944c5[_0xcbdc('0x2d')][_0xcbdc('0x2f')]?_0x1944c5[_0xcbdc('0x2d')]:_0x496b27[_0xcbdc('0x29')];if(!_0x5ca7ee[_0xcbdc('0x2a')][_0xcbdc('0x30')](_0xcbdc('0x31'))){_0x1944c5[_0xcbdc('0x32')]=qs['limit'](_0x5ca7ee[_0xcbdc('0x2a')][_0xcbdc('0x32')]);_0x1944c5[_0xcbdc('0x19')]=qs['offset'](_0x5ca7ee[_0xcbdc('0x2a')]['offset']);}_0x1944c5[_0xcbdc('0x33')]=qs[_0xcbdc('0x34')](_0x5ca7ee[_0xcbdc('0x2a')][_0xcbdc('0x34')]);_0x1944c5[_0xcbdc('0x35')]=qs['filters'](_[_0xcbdc('0x36')](_0x5ca7ee['query'],_0x496b27['filters']),_0x4894d5);if(_0x5ca7ee['query'][_0xcbdc('0x37')]){_0x1944c5[_0xcbdc('0x35')]=_[_0xcbdc('0x38')](_0x1944c5[_0xcbdc('0x35')],{'$or':_[_0xcbdc('0x39')](_0x4894d5,function(_0x294512){if(_0x294512['type']!==_0xcbdc('0x3a')){var _0x3b466d={};_0x3b466d[_0x294512['name']]={'$like':'%'+_0x5ca7ee[_0xcbdc('0x2a')][_0xcbdc('0x37')]+'%'};return _0x3b466d;}})});}_0x1944c5=_[_0xcbdc('0x38')]({},_0x1944c5,_0x5ca7ee['options']);var _0x54db09={'where':_0x1944c5[_0xcbdc('0x35')]};return db['FreshdeskConfiguration']['count'](_0x54db09)[_0xcbdc('0x20')](function(_0xebd71f){_0x4c307f[_0xcbdc('0x1a')]=_0xebd71f;if(_0x5ca7ee[_0xcbdc('0x2a')][_0xcbdc('0x3b')]){_0x1944c5['include']=[{'all':!![]}];}return db['FreshdeskConfiguration']['findAll'](_0x1944c5);})[_0xcbdc('0x20')](function(_0x52da80){_0x4c307f[_0xcbdc('0x3c')]=_0x52da80;return _0x4c307f;})[_0xcbdc('0x20')](respondWithFilteredResult(_0x307386,_0x1944c5))[_0xcbdc('0x3d')](handleError(_0x307386,null));};exports[_0xcbdc('0x3e')]=function(_0x37c5f7,_0x47305a){var _0x563b36={'raw':![],'where':{'id':_0x37c5f7[_0xcbdc('0x3f')]['id']}},_0x5e7455={};_0x5e7455['model']=_[_0xcbdc('0x40')](db[_0xcbdc('0x24')][_0xcbdc('0x25')]);_0x5e7455['query']=_[_0xcbdc('0x40')](_0x37c5f7[_0xcbdc('0x2a')]);_0x5e7455['filters']=_[_0xcbdc('0x2c')](_0x5e7455[_0xcbdc('0x29')],_0x5e7455[_0xcbdc('0x2a')]);_0x563b36[_0xcbdc('0x2d')]=_['intersection'](_0x5e7455[_0xcbdc('0x29')],qs['fields'](_0x37c5f7['query'][_0xcbdc('0x2e')]));_0x563b36[_0xcbdc('0x2d')]=_0x563b36[_0xcbdc('0x2d')][_0xcbdc('0x2f')]?_0x563b36[_0xcbdc('0x2d')]:_0x5e7455[_0xcbdc('0x29')];if(_0x37c5f7[_0xcbdc('0x2a')][_0xcbdc('0x3b')]){_0x563b36['include']=[{'all':!![]}];}_0x563b36=_[_0xcbdc('0x38')]({},_0x563b36,_0x37c5f7[_0xcbdc('0x41')]);return db['FreshdeskConfiguration']['find'](_0x563b36)[_0xcbdc('0x20')](handleEntityNotFound(_0x47305a,null))['then'](respondWithResult(_0x47305a,null))[_0xcbdc('0x3d')](handleError(_0x47305a,null));};exports[_0xcbdc('0x42')]=function(_0x5b3fc9,_0x53059d){return db[_0xcbdc('0x24')][_0xcbdc('0x42')](_0x5b3fc9[_0xcbdc('0x43')],{})[_0xcbdc('0x20')](respondWithResult(_0x53059d,0xc9))['catch'](handleError(_0x53059d,null));};exports[_0xcbdc('0x1f')]=function(_0x5381a6,_0x205b20){if(_0x5381a6[_0xcbdc('0x43')]['id']){delete _0x5381a6['body']['id'];}return db[_0xcbdc('0x24')]['find']({'where':{'id':_0x5381a6['params']['id']}})[_0xcbdc('0x20')](handleEntityNotFound(_0x205b20,null))['then'](saveUpdates(_0x5381a6[_0xcbdc('0x43')],null))[_0xcbdc('0x20')](respondWithResult(_0x205b20,null))[_0xcbdc('0x3d')](handleError(_0x205b20,null));};exports[_0xcbdc('0x44')]=function(_0x53c08,_0x36fad3){return db['FreshdeskConfiguration'][_0xcbdc('0x45')]({'where':{'id':_0x53c08[_0xcbdc('0x3f')]['id']}})['then'](handleEntityNotFound(_0x36fad3,null))[_0xcbdc('0x20')](removeEntity(_0x36fad3,null))['catch'](handleError(_0x36fad3,null));};exports['getFields']=function(_0xb25bdd,_0x217644,_0x3f440f){var _0x11afb8={};var _0x6eacfc={};var _0x32410c;var _0x32929b;return db[_0xcbdc('0x24')][_0xcbdc('0x46')]({'where':{'id':_0xb25bdd[_0xcbdc('0x3f')]['id']}})[_0xcbdc('0x20')](handleEntityNotFound(_0x217644,null))['then'](function(_0x46d49b){if(_0x46d49b){_0x32410c=_0x46d49b;_0x6eacfc['model']=_[_0xcbdc('0x40')](db[_0xcbdc('0x47')][_0xcbdc('0x25')]);_0x6eacfc[_0xcbdc('0x2a')]=_['keys'](_0xb25bdd[_0xcbdc('0x2a')]);_0x6eacfc[_0xcbdc('0x2b')]=_[_0xcbdc('0x2c')](_0x6eacfc[_0xcbdc('0x29')],_0x6eacfc[_0xcbdc('0x2a')]);_0x11afb8[_0xcbdc('0x2d')]=_[_0xcbdc('0x2c')](_0x6eacfc[_0xcbdc('0x29')],qs[_0xcbdc('0x2e')](_0xb25bdd[_0xcbdc('0x2a')][_0xcbdc('0x2e')]));_0x11afb8[_0xcbdc('0x2d')]=_0x11afb8[_0xcbdc('0x2d')][_0xcbdc('0x2f')]?_0x11afb8[_0xcbdc('0x2d')]:_0x6eacfc[_0xcbdc('0x29')];_0x11afb8[_0xcbdc('0x33')]=qs[_0xcbdc('0x34')](_0xb25bdd[_0xcbdc('0x2a')][_0xcbdc('0x34')]);_0x11afb8[_0xcbdc('0x35')]=qs[_0xcbdc('0x2b')](_[_0xcbdc('0x36')](_0xb25bdd[_0xcbdc('0x2a')],_0x6eacfc[_0xcbdc('0x2b')]));if(_0xb25bdd[_0xcbdc('0x2a')][_0xcbdc('0x37')]){_0x11afb8['where']=_['merge'](_0x11afb8[_0xcbdc('0x35')],{'$or':_[_0xcbdc('0x39')](_0x11afb8[_0xcbdc('0x2d')],function(_0x3cde1b){var _0x238ece={};_0x238ece[_0x3cde1b]={'$like':'%'+_0xb25bdd[_0xcbdc('0x2a')][_0xcbdc('0x37')]+'%'};return _0x238ece;})});}_0x11afb8=_[_0xcbdc('0x38')]({},_0x11afb8,_0xb25bdd[_0xcbdc('0x41')]);return _0x32410c[_0xcbdc('0x48')](_0x11afb8);}})[_0xcbdc('0x20')](function(_0x5a2de2){if(_0x5a2de2){_0x32929b=_0x5a2de2[_0xcbdc('0x2f')];if(!_0xb25bdd[_0xcbdc('0x2a')]['hasOwnProperty'](_0xcbdc('0x31'))){_0x11afb8[_0xcbdc('0x32')]=qs[_0xcbdc('0x32')](_0xb25bdd[_0xcbdc('0x2a')][_0xcbdc('0x32')]);_0x11afb8[_0xcbdc('0x19')]=qs['offset'](_0xb25bdd[_0xcbdc('0x2a')]['offset']);}return _0x32410c[_0xcbdc('0x48')](_0x11afb8);}})[_0xcbdc('0x20')](function(_0x470452){if(_0x470452){return _0x470452?{'count':_0x32929b,'rows':_0x470452}:null;}})[_0xcbdc('0x20')](respondWithResult(_0x217644,null))[_0xcbdc('0x3d')](handleError(_0x217644,null));};exports[_0xcbdc('0x49')]=function(_0x2ac953,_0x55a8c3,_0x223911){var _0x1fed16={};var _0x3f101a={};var _0x325d66;var _0x29a1af;return db[_0xcbdc('0x24')][_0xcbdc('0x46')]({'where':{'id':_0x2ac953[_0xcbdc('0x3f')]['id']}})['then'](handleEntityNotFound(_0x55a8c3,null))[_0xcbdc('0x20')](function(_0x1e612f){if(_0x1e612f){_0x325d66=_0x1e612f;_0x3f101a['model']=_[_0xcbdc('0x40')](db['FreshdeskField'][_0xcbdc('0x25')]);_0x3f101a[_0xcbdc('0x2a')]=_[_0xcbdc('0x40')](_0x2ac953[_0xcbdc('0x2a')]);_0x3f101a[_0xcbdc('0x2b')]=_[_0xcbdc('0x2c')](_0x3f101a[_0xcbdc('0x29')],_0x3f101a['query']);_0x1fed16[_0xcbdc('0x2d')]=_[_0xcbdc('0x2c')](_0x3f101a[_0xcbdc('0x29')],qs[_0xcbdc('0x2e')](_0x2ac953[_0xcbdc('0x2a')]['fields']));_0x1fed16[_0xcbdc('0x2d')]=_0x1fed16[_0xcbdc('0x2d')][_0xcbdc('0x2f')]?_0x1fed16[_0xcbdc('0x2d')]:_0x3f101a[_0xcbdc('0x29')];_0x1fed16[_0xcbdc('0x33')]=qs[_0xcbdc('0x34')](_0x2ac953[_0xcbdc('0x2a')][_0xcbdc('0x34')]);_0x1fed16[_0xcbdc('0x35')]=qs[_0xcbdc('0x2b')](_[_0xcbdc('0x36')](_0x2ac953[_0xcbdc('0x2a')],_0x3f101a[_0xcbdc('0x2b')]));if(_0x2ac953[_0xcbdc('0x2a')][_0xcbdc('0x37')]){_0x1fed16[_0xcbdc('0x35')]=_[_0xcbdc('0x38')](_0x1fed16[_0xcbdc('0x35')],{'$or':_['map'](_0x1fed16[_0xcbdc('0x2d')],function(_0x537801){var _0x269494={};_0x269494[_0x537801]={'$like':'%'+_0x2ac953[_0xcbdc('0x2a')][_0xcbdc('0x37')]+'%'};return _0x269494;})});}_0x1fed16=_['merge']({},_0x1fed16,_0x2ac953[_0xcbdc('0x41')]);return _0x325d66[_0xcbdc('0x49')](_0x1fed16);}})[_0xcbdc('0x20')](function(_0x3d48eb){if(_0x3d48eb){_0x29a1af=_0x3d48eb[_0xcbdc('0x2f')];if(!_0x2ac953['query'][_0xcbdc('0x30')](_0xcbdc('0x31'))){_0x1fed16[_0xcbdc('0x32')]=qs[_0xcbdc('0x32')](_0x2ac953['query'][_0xcbdc('0x32')]);_0x1fed16[_0xcbdc('0x19')]=qs[_0xcbdc('0x19')](_0x2ac953['query'][_0xcbdc('0x19')]);}return _0x325d66[_0xcbdc('0x49')](_0x1fed16);}})[_0xcbdc('0x20')](function(_0xce3ada){if(_0xce3ada){return _0xce3ada?{'count':_0x29a1af,'rows':_0xce3ada}:null;}})[_0xcbdc('0x20')](respondWithResult(_0x55a8c3,null))[_0xcbdc('0x3d')](handleError(_0x55a8c3,null));};exports['getDescriptions']=function(_0x201db6,_0x3252a5,_0x22edc6){var _0x33589d={};var _0x47bb1f={};var _0x161a08;var _0x3868a4;return db[_0xcbdc('0x24')]['findOne']({'where':{'id':_0x201db6['params']['id']}})[_0xcbdc('0x20')](handleEntityNotFound(_0x3252a5,null))[_0xcbdc('0x20')](function(_0x3168e5){if(_0x3168e5){_0x161a08=_0x3168e5;_0x47bb1f['model']=_['keys'](db['FreshdeskField'][_0xcbdc('0x25')]);_0x47bb1f['query']=_[_0xcbdc('0x40')](_0x201db6[_0xcbdc('0x2a')]);_0x47bb1f[_0xcbdc('0x2b')]=_[_0xcbdc('0x2c')](_0x47bb1f[_0xcbdc('0x29')],_0x47bb1f[_0xcbdc('0x2a')]);_0x33589d[_0xcbdc('0x2d')]=_[_0xcbdc('0x2c')](_0x47bb1f[_0xcbdc('0x29')],qs[_0xcbdc('0x2e')](_0x201db6[_0xcbdc('0x2a')][_0xcbdc('0x2e')]));_0x33589d[_0xcbdc('0x2d')]=_0x33589d[_0xcbdc('0x2d')]['length']?_0x33589d[_0xcbdc('0x2d')]:_0x47bb1f[_0xcbdc('0x29')];_0x33589d[_0xcbdc('0x33')]=qs[_0xcbdc('0x34')](_0x201db6[_0xcbdc('0x2a')][_0xcbdc('0x34')]);_0x33589d[_0xcbdc('0x35')]=qs[_0xcbdc('0x2b')](_[_0xcbdc('0x36')](_0x201db6[_0xcbdc('0x2a')],_0x47bb1f[_0xcbdc('0x2b')]));if(_0x201db6[_0xcbdc('0x2a')][_0xcbdc('0x37')]){_0x33589d[_0xcbdc('0x35')]=_['merge'](_0x33589d['where'],{'$or':_[_0xcbdc('0x39')](_0x33589d[_0xcbdc('0x2d')],function(_0x2d8277){var _0x573dcd={};_0x573dcd[_0x2d8277]={'$like':'%'+_0x201db6[_0xcbdc('0x2a')][_0xcbdc('0x37')]+'%'};return _0x573dcd;})});}_0x33589d=_['merge']({},_0x33589d,_0x201db6[_0xcbdc('0x41')]);return _0x161a08['getDescriptions'](_0x33589d);}})[_0xcbdc('0x20')](function(_0x12e8b3){if(_0x12e8b3){_0x3868a4=_0x12e8b3[_0xcbdc('0x2f')];if(!_0x201db6[_0xcbdc('0x2a')]['hasOwnProperty'](_0xcbdc('0x31'))){_0x33589d[_0xcbdc('0x32')]=qs[_0xcbdc('0x32')](_0x201db6['query'][_0xcbdc('0x32')]);_0x33589d[_0xcbdc('0x19')]=qs[_0xcbdc('0x19')](_0x201db6['query'][_0xcbdc('0x19')]);}return _0x161a08['getDescriptions'](_0x33589d);}})[_0xcbdc('0x20')](function(_0x17ea51){if(_0x17ea51){return _0x17ea51?{'count':_0x3868a4,'rows':_0x17ea51}:null;}})['then'](respondWithResult(_0x3252a5,null))[_0xcbdc('0x3d')](handleError(_0x3252a5,null));};exports[_0xcbdc('0x4a')]=function(_0x521fc3,_0x268dfe,_0x28fab6){var _0x2a5314={};var _0x597601={};var _0x78b203;var _0x35f856;return db[_0xcbdc('0x24')][_0xcbdc('0x46')]({'where':{'id':_0x521fc3[_0xcbdc('0x3f')]['id']}})[_0xcbdc('0x20')](handleEntityNotFound(_0x268dfe,null))[_0xcbdc('0x20')](function(_0x441ce6){if(_0x441ce6){_0x78b203=_0x441ce6;_0x597601[_0xcbdc('0x29')]=_[_0xcbdc('0x40')](db[_0xcbdc('0x4b')][_0xcbdc('0x25')]);_0x597601[_0xcbdc('0x2a')]=_['keys'](_0x521fc3[_0xcbdc('0x2a')]);_0x597601[_0xcbdc('0x2b')]=_['intersection'](_0x597601[_0xcbdc('0x29')],_0x597601[_0xcbdc('0x2a')]);_0x2a5314['attributes']=_['intersection'](_0x597601['model'],qs[_0xcbdc('0x2e')](_0x521fc3[_0xcbdc('0x2a')]['fields']));_0x2a5314[_0xcbdc('0x2d')]=_0x2a5314['attributes']['length']?_0x2a5314[_0xcbdc('0x2d')]:_0x597601[_0xcbdc('0x29')];_0x2a5314[_0xcbdc('0x33')]=qs[_0xcbdc('0x34')](_0x521fc3[_0xcbdc('0x2a')][_0xcbdc('0x34')]);_0x2a5314[_0xcbdc('0x35')]=qs[_0xcbdc('0x2b')](_[_0xcbdc('0x36')](_0x521fc3[_0xcbdc('0x2a')],_0x597601[_0xcbdc('0x2b')]));if(_0x521fc3[_0xcbdc('0x2a')][_0xcbdc('0x37')]){_0x2a5314['where']=_['merge'](_0x2a5314[_0xcbdc('0x35')],{'$or':_[_0xcbdc('0x39')](_0x2a5314[_0xcbdc('0x2d')],function(_0x3553a9){var _0x46fa14={};_0x46fa14[_0x3553a9]={'$like':'%'+_0x521fc3[_0xcbdc('0x2a')][_0xcbdc('0x37')]+'%'};return _0x46fa14;})});}_0x2a5314=_[_0xcbdc('0x38')]({},_0x2a5314,_0x521fc3[_0xcbdc('0x41')]);return _0x78b203['getTags'](_0x2a5314);}})[_0xcbdc('0x20')](function(_0x19491a){if(_0x19491a){_0x35f856=_0x19491a[_0xcbdc('0x2f')];if(!_0x521fc3[_0xcbdc('0x2a')]['hasOwnProperty'](_0xcbdc('0x31'))){_0x2a5314['limit']=qs[_0xcbdc('0x32')](_0x521fc3[_0xcbdc('0x2a')][_0xcbdc('0x32')]);_0x2a5314[_0xcbdc('0x19')]=qs['offset'](_0x521fc3[_0xcbdc('0x2a')][_0xcbdc('0x19')]);}return _0x78b203[_0xcbdc('0x4a')](_0x2a5314);}})[_0xcbdc('0x20')](function(_0x5112f1){if(_0x5112f1){return _0x5112f1?{'count':_0x35f856,'rows':_0x5112f1}:null;}})['then'](respondWithResult(_0x268dfe,null))['catch'](handleError(_0x268dfe,null));};exports[_0xcbdc('0x4c')]=function(_0x30dae0,_0x1b6cbd,_0x57df9b){if(_0x30dae0['body']['id']){delete _0x30dae0[_0xcbdc('0x43')]['id'];}return db['FreshdeskConfiguration']['findOne']({'where':{'id':_0x30dae0[_0xcbdc('0x3f')]['id']}})['then'](handleEntityNotFound(_0x1b6cbd,null))[_0xcbdc('0x20')](function(_0x1a78c6){if(_0x1a78c6){return _0x1a78c6['setTags'](_0x30dae0[_0xcbdc('0x43')][_0xcbdc('0x4d')]||[]);}return null;})[_0xcbdc('0x20')](respondWithResult(_0x1b6cbd,null))[_0xcbdc('0x3d')](handleError(_0x1b6cbd,null));}; \ No newline at end of file +var _0x2148=['setTags','ids','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','reject','update','then','destroy','name','send','index','FreshdeskConfiguration','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','fields','attributes','length','hasOwnProperty','sort','filter','where','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','create','body','find','getFields','findOne','keys','FreshdeskField','pick','nolimit','order','getSubjects','getDescriptions','Tag','getTags'];(function(_0xe3e0af,_0x4564ed){var _0x4828e9=function(_0x55c7a7){while(--_0x55c7a7){_0xe3e0af['push'](_0xe3e0af['shift']());}};_0x4828e9(++_0x4564ed);}(_0x2148,0x162));var _0x8214=function(_0x3d78d7,_0x44acea){_0x3d78d7=_0x3d78d7-0x0;var _0x4b6784=_0x2148[_0x3d78d7];return _0x4b6784;};'use strict';var emlformat=require(_0x8214('0x0'));var rimraf=require(_0x8214('0x1'));var zipdir=require(_0x8214('0x2'));var jsonpatch=require(_0x8214('0x3'));var rp=require(_0x8214('0x4'));var moment=require(_0x8214('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x8214('0x6'));var util=require(_0x8214('0x7'));var path=require(_0x8214('0x8'));var sox=require(_0x8214('0x9'));var csv=require('to-csv');var ejs=require(_0x8214('0xa'));var fs=require('fs');var fs_extra=require(_0x8214('0xb'));var _=require(_0x8214('0xc'));var squel=require(_0x8214('0xd'));var crypto=require(_0x8214('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x8214('0xf'));var toCsv=require(_0x8214('0x10'));var querystring=require(_0x8214('0x11'));var Papa=require(_0x8214('0x12'));var Redis=require(_0x8214('0x13'));var authService=require(_0x8214('0x14'));var qs=require(_0x8214('0x15'));var as=require(_0x8214('0x16'));var hardwareService=require(_0x8214('0x17'));var logger=require('../../config/logger')('api');var utils=require(_0x8214('0x18'));var config=require(_0x8214('0x19'));var licenseUtil=require(_0x8214('0x1a'));var db=require(_0x8214('0x1b'))['db'];function respondWithStatusCode(_0x57cad0,_0x217a43){_0x217a43=_0x217a43||0xcc;return function(_0x3ab9df){if(_0x3ab9df){return _0x57cad0[_0x8214('0x1c')](_0x217a43);}return _0x57cad0[_0x8214('0x1d')](_0x217a43)[_0x8214('0x1e')]();};}function respondWithResult(_0x273c56,_0x5670cf){_0x5670cf=_0x5670cf||0xc8;return function(_0x39159f){if(_0x39159f){return _0x273c56[_0x8214('0x1d')](_0x5670cf)[_0x8214('0x1f')](_0x39159f);}};}function respondWithFilteredResult(_0x408ef2,_0x326fda){return function(_0xa4bc57){if(_0xa4bc57){var _0x35c1d6=typeof _0x326fda['offset']===_0x8214('0x20')&&typeof _0x326fda[_0x8214('0x21')]===_0x8214('0x20');var _0x3efb4b=_0xa4bc57[_0x8214('0x22')];var _0xb7c189=_0x35c1d6?0x0:_0x326fda[_0x8214('0x23')];var _0x5ce90d=_0x35c1d6?_0xa4bc57[_0x8214('0x22')]:_0x326fda[_0x8214('0x23')]+_0x326fda[_0x8214('0x21')];var _0x50b18e;if(_0x5ce90d>=_0x3efb4b){_0x5ce90d=_0x3efb4b;_0x50b18e=0xc8;}else{_0x50b18e=0xce;}_0x408ef2[_0x8214('0x1d')](_0x50b18e);return _0x408ef2[_0x8214('0x24')](_0x8214('0x25'),_0xb7c189+'-'+_0x5ce90d+'/'+_0x3efb4b)[_0x8214('0x1f')](_0xa4bc57);}return null;};}function patchUpdates(_0x1d3293){return function(_0x458f0d){try{jsonpatch['apply'](_0x458f0d,_0x1d3293,!![]);}catch(_0x39c88f){return BPromise[_0x8214('0x26')](_0x39c88f);}return _0x458f0d['save']();};}function saveUpdates(_0x540fc3,_0x29805d){return function(_0x1e2fc0){if(_0x1e2fc0){return _0x1e2fc0[_0x8214('0x27')](_0x540fc3)[_0x8214('0x28')](function(_0x44186e){return _0x44186e;});}return null;};}function removeEntity(_0x2f7c8b,_0x21c5db){return function(_0x15310f){if(_0x15310f){return _0x15310f[_0x8214('0x29')]()[_0x8214('0x28')](function(){_0x2f7c8b[_0x8214('0x1d')](0xcc)[_0x8214('0x1e')]();});}};}function handleEntityNotFound(_0x228dc7,_0x28d8fb){return function(_0x2acd31){if(!_0x2acd31){_0x228dc7[_0x8214('0x1c')](0x194);}return _0x2acd31;};}function handleError(_0x50cf93,_0x5e847a){_0x5e847a=_0x5e847a||0x1f4;return function(_0x33f7b0){logger['error'](_0x33f7b0['stack']);if(_0x33f7b0['name']){delete _0x33f7b0[_0x8214('0x2a')];}_0x50cf93[_0x8214('0x1d')](_0x5e847a)[_0x8214('0x2b')](_0x33f7b0);};}exports[_0x8214('0x2c')]=function(_0x3100a4,_0x1231fd){var _0x4ed886={},_0x4a9743={},_0x2f408d={'count':0x0,'rows':[]};var _0x510c5d=_['map'](db[_0x8214('0x2d')][_0x8214('0x2e')],function(_0x4e282b){return{'name':_0x4e282b[_0x8214('0x2f')],'type':_0x4e282b[_0x8214('0x30')][_0x8214('0x31')]};});_0x4a9743[_0x8214('0x32')]=_[_0x8214('0x33')](_0x510c5d,'name');_0x4a9743[_0x8214('0x34')]=_['keys'](_0x3100a4[_0x8214('0x34')]);_0x4a9743[_0x8214('0x35')]=_[_0x8214('0x36')](_0x4a9743['model'],_0x4a9743[_0x8214('0x34')]);_0x4ed886['attributes']=_['intersection'](_0x4a9743[_0x8214('0x32')],qs['fields'](_0x3100a4[_0x8214('0x34')][_0x8214('0x37')]));_0x4ed886[_0x8214('0x38')]=_0x4ed886[_0x8214('0x38')][_0x8214('0x39')]?_0x4ed886[_0x8214('0x38')]:_0x4a9743[_0x8214('0x32')];if(!_0x3100a4[_0x8214('0x34')][_0x8214('0x3a')]('nolimit')){_0x4ed886[_0x8214('0x21')]=qs[_0x8214('0x21')](_0x3100a4[_0x8214('0x34')][_0x8214('0x21')]);_0x4ed886[_0x8214('0x23')]=qs[_0x8214('0x23')](_0x3100a4['query'][_0x8214('0x23')]);}_0x4ed886['order']=qs[_0x8214('0x3b')](_0x3100a4[_0x8214('0x34')]['sort']);_0x4ed886['where']=qs[_0x8214('0x35')](_['pick'](_0x3100a4[_0x8214('0x34')],_0x4a9743[_0x8214('0x35')]),_0x510c5d);if(_0x3100a4[_0x8214('0x34')][_0x8214('0x3c')]){_0x4ed886[_0x8214('0x3d')]=_['merge'](_0x4ed886[_0x8214('0x3d')],{'$or':_[_0x8214('0x33')](_0x510c5d,function(_0x4569ca){if(_0x4569ca['type']!==_0x8214('0x3e')){var _0x3f7e2e={};_0x3f7e2e[_0x4569ca[_0x8214('0x2a')]]={'$like':'%'+_0x3100a4[_0x8214('0x34')][_0x8214('0x3c')]+'%'};return _0x3f7e2e;}})});}_0x4ed886=_[_0x8214('0x3f')]({},_0x4ed886,_0x3100a4[_0x8214('0x40')]);var _0x562f0e={'where':_0x4ed886[_0x8214('0x3d')]};return db['FreshdeskConfiguration']['count'](_0x562f0e)[_0x8214('0x28')](function(_0x39f26b){_0x2f408d[_0x8214('0x22')]=_0x39f26b;if(_0x3100a4[_0x8214('0x34')][_0x8214('0x41')]){_0x4ed886[_0x8214('0x42')]=[{'all':!![]}];}return db[_0x8214('0x2d')][_0x8214('0x43')](_0x4ed886);})[_0x8214('0x28')](function(_0x18f05f){_0x2f408d[_0x8214('0x44')]=_0x18f05f;return _0x2f408d;})[_0x8214('0x28')](respondWithFilteredResult(_0x1231fd,_0x4ed886))[_0x8214('0x45')](handleError(_0x1231fd,null));};exports[_0x8214('0x46')]=function(_0x2b829f,_0x3f1011){var _0x4228cb={'raw':![],'where':{'id':_0x2b829f[_0x8214('0x47')]['id']}},_0x19ca9b={};_0x19ca9b['model']=_['keys'](db[_0x8214('0x2d')]['rawAttributes']);_0x19ca9b[_0x8214('0x34')]=_['keys'](_0x2b829f[_0x8214('0x34')]);_0x19ca9b[_0x8214('0x35')]=_[_0x8214('0x36')](_0x19ca9b[_0x8214('0x32')],_0x19ca9b[_0x8214('0x34')]);_0x4228cb[_0x8214('0x38')]=_[_0x8214('0x36')](_0x19ca9b[_0x8214('0x32')],qs[_0x8214('0x37')](_0x2b829f[_0x8214('0x34')][_0x8214('0x37')]));_0x4228cb[_0x8214('0x38')]=_0x4228cb[_0x8214('0x38')]['length']?_0x4228cb[_0x8214('0x38')]:_0x19ca9b[_0x8214('0x32')];if(_0x2b829f[_0x8214('0x34')][_0x8214('0x41')]){_0x4228cb[_0x8214('0x42')]=[{'all':!![]}];}_0x4228cb=_['merge']({},_0x4228cb,_0x2b829f[_0x8214('0x40')]);return db[_0x8214('0x2d')]['find'](_0x4228cb)[_0x8214('0x28')](handleEntityNotFound(_0x3f1011,null))[_0x8214('0x28')](respondWithResult(_0x3f1011,null))[_0x8214('0x45')](handleError(_0x3f1011,null));};exports[_0x8214('0x48')]=function(_0x3a04b0,_0x15c46c){return db['FreshdeskConfiguration'][_0x8214('0x48')](_0x3a04b0[_0x8214('0x49')],{})[_0x8214('0x28')](respondWithResult(_0x15c46c,0xc9))[_0x8214('0x45')](handleError(_0x15c46c,null));};exports[_0x8214('0x27')]=function(_0x107356,_0x5115ab){if(_0x107356[_0x8214('0x49')]['id']){delete _0x107356[_0x8214('0x49')]['id'];}return db[_0x8214('0x2d')][_0x8214('0x4a')]({'where':{'id':_0x107356[_0x8214('0x47')]['id']}})['then'](handleEntityNotFound(_0x5115ab,null))[_0x8214('0x28')](saveUpdates(_0x107356[_0x8214('0x49')],null))[_0x8214('0x28')](respondWithResult(_0x5115ab,null))['catch'](handleError(_0x5115ab,null));};exports['destroy']=function(_0x4595ea,_0x2858ce){return db['FreshdeskConfiguration']['find']({'where':{'id':_0x4595ea[_0x8214('0x47')]['id']}})[_0x8214('0x28')](handleEntityNotFound(_0x2858ce,null))[_0x8214('0x28')](removeEntity(_0x2858ce,null))[_0x8214('0x45')](handleError(_0x2858ce,null));};exports[_0x8214('0x4b')]=function(_0x240e38,_0x460f38,_0x52ea20){var _0x2fc213={};var _0x12c276={};var _0x3c195e;var _0x2fa4fd;return db[_0x8214('0x2d')][_0x8214('0x4c')]({'where':{'id':_0x240e38['params']['id']}})[_0x8214('0x28')](handleEntityNotFound(_0x460f38,null))[_0x8214('0x28')](function(_0x33038c){if(_0x33038c){_0x3c195e=_0x33038c;_0x12c276[_0x8214('0x32')]=_[_0x8214('0x4d')](db[_0x8214('0x4e')][_0x8214('0x2e')]);_0x12c276['query']=_['keys'](_0x240e38[_0x8214('0x34')]);_0x12c276['filters']=_[_0x8214('0x36')](_0x12c276[_0x8214('0x32')],_0x12c276[_0x8214('0x34')]);_0x2fc213[_0x8214('0x38')]=_[_0x8214('0x36')](_0x12c276['model'],qs['fields'](_0x240e38[_0x8214('0x34')][_0x8214('0x37')]));_0x2fc213[_0x8214('0x38')]=_0x2fc213[_0x8214('0x38')][_0x8214('0x39')]?_0x2fc213[_0x8214('0x38')]:_0x12c276[_0x8214('0x32')];_0x2fc213['order']=qs[_0x8214('0x3b')](_0x240e38[_0x8214('0x34')]['sort']);_0x2fc213[_0x8214('0x3d')]=qs['filters'](_[_0x8214('0x4f')](_0x240e38[_0x8214('0x34')],_0x12c276[_0x8214('0x35')]));if(_0x240e38[_0x8214('0x34')][_0x8214('0x3c')]){_0x2fc213['where']=_[_0x8214('0x3f')](_0x2fc213[_0x8214('0x3d')],{'$or':_[_0x8214('0x33')](_0x2fc213[_0x8214('0x38')],function(_0x332e87){var _0x1bad78={};_0x1bad78[_0x332e87]={'$like':'%'+_0x240e38['query'][_0x8214('0x3c')]+'%'};return _0x1bad78;})});}_0x2fc213=_['merge']({},_0x2fc213,_0x240e38[_0x8214('0x40')]);return _0x3c195e[_0x8214('0x4b')](_0x2fc213);}})[_0x8214('0x28')](function(_0x539128){if(_0x539128){_0x2fa4fd=_0x539128['length'];if(!_0x240e38['query']['hasOwnProperty'](_0x8214('0x50'))){_0x2fc213[_0x8214('0x21')]=qs[_0x8214('0x21')](_0x240e38[_0x8214('0x34')]['limit']);_0x2fc213[_0x8214('0x23')]=qs['offset'](_0x240e38[_0x8214('0x34')][_0x8214('0x23')]);}return _0x3c195e[_0x8214('0x4b')](_0x2fc213);}})[_0x8214('0x28')](function(_0x4a0125){if(_0x4a0125){return _0x4a0125?{'count':_0x2fa4fd,'rows':_0x4a0125}:null;}})[_0x8214('0x28')](respondWithResult(_0x460f38,null))['catch'](handleError(_0x460f38,null));};exports['getSubjects']=function(_0x56449e,_0xff4831,_0x2d0688){var _0x666866={};var _0x2e2ba4={};var _0x342bf6;var _0x10becc;return db['FreshdeskConfiguration'][_0x8214('0x4c')]({'where':{'id':_0x56449e[_0x8214('0x47')]['id']}})['then'](handleEntityNotFound(_0xff4831,null))[_0x8214('0x28')](function(_0x2c89e7){if(_0x2c89e7){_0x342bf6=_0x2c89e7;_0x2e2ba4['model']=_[_0x8214('0x4d')](db[_0x8214('0x4e')]['rawAttributes']);_0x2e2ba4['query']=_['keys'](_0x56449e[_0x8214('0x34')]);_0x2e2ba4[_0x8214('0x35')]=_[_0x8214('0x36')](_0x2e2ba4[_0x8214('0x32')],_0x2e2ba4[_0x8214('0x34')]);_0x666866[_0x8214('0x38')]=_[_0x8214('0x36')](_0x2e2ba4['model'],qs[_0x8214('0x37')](_0x56449e[_0x8214('0x34')]['fields']));_0x666866[_0x8214('0x38')]=_0x666866[_0x8214('0x38')][_0x8214('0x39')]?_0x666866[_0x8214('0x38')]:_0x2e2ba4[_0x8214('0x32')];_0x666866[_0x8214('0x51')]=qs[_0x8214('0x3b')](_0x56449e[_0x8214('0x34')][_0x8214('0x3b')]);_0x666866[_0x8214('0x3d')]=qs[_0x8214('0x35')](_[_0x8214('0x4f')](_0x56449e[_0x8214('0x34')],_0x2e2ba4[_0x8214('0x35')]));if(_0x56449e['query'][_0x8214('0x3c')]){_0x666866[_0x8214('0x3d')]=_[_0x8214('0x3f')](_0x666866['where'],{'$or':_[_0x8214('0x33')](_0x666866['attributes'],function(_0x5a5363){var _0x3caf38={};_0x3caf38[_0x5a5363]={'$like':'%'+_0x56449e[_0x8214('0x34')][_0x8214('0x3c')]+'%'};return _0x3caf38;})});}_0x666866=_[_0x8214('0x3f')]({},_0x666866,_0x56449e[_0x8214('0x40')]);return _0x342bf6[_0x8214('0x52')](_0x666866);}})[_0x8214('0x28')](function(_0x5524d7){if(_0x5524d7){_0x10becc=_0x5524d7['length'];if(!_0x56449e['query']['hasOwnProperty'](_0x8214('0x50'))){_0x666866[_0x8214('0x21')]=qs[_0x8214('0x21')](_0x56449e['query'][_0x8214('0x21')]);_0x666866[_0x8214('0x23')]=qs[_0x8214('0x23')](_0x56449e['query'][_0x8214('0x23')]);}return _0x342bf6[_0x8214('0x52')](_0x666866);}})[_0x8214('0x28')](function(_0x22e291){if(_0x22e291){return _0x22e291?{'count':_0x10becc,'rows':_0x22e291}:null;}})[_0x8214('0x28')](respondWithResult(_0xff4831,null))['catch'](handleError(_0xff4831,null));};exports['getDescriptions']=function(_0x58c541,_0x1db282,_0xc550af){var _0x573dc1={};var _0x548407={};var _0x2290df;var _0x5e6280;return db[_0x8214('0x2d')][_0x8214('0x4c')]({'where':{'id':_0x58c541[_0x8214('0x47')]['id']}})[_0x8214('0x28')](handleEntityNotFound(_0x1db282,null))[_0x8214('0x28')](function(_0x5c3f87){if(_0x5c3f87){_0x2290df=_0x5c3f87;_0x548407[_0x8214('0x32')]=_['keys'](db[_0x8214('0x4e')][_0x8214('0x2e')]);_0x548407['query']=_[_0x8214('0x4d')](_0x58c541[_0x8214('0x34')]);_0x548407['filters']=_['intersection'](_0x548407[_0x8214('0x32')],_0x548407[_0x8214('0x34')]);_0x573dc1[_0x8214('0x38')]=_[_0x8214('0x36')](_0x548407['model'],qs[_0x8214('0x37')](_0x58c541[_0x8214('0x34')]['fields']));_0x573dc1[_0x8214('0x38')]=_0x573dc1[_0x8214('0x38')]['length']?_0x573dc1[_0x8214('0x38')]:_0x548407[_0x8214('0x32')];_0x573dc1[_0x8214('0x51')]=qs[_0x8214('0x3b')](_0x58c541[_0x8214('0x34')]['sort']);_0x573dc1[_0x8214('0x3d')]=qs['filters'](_['pick'](_0x58c541[_0x8214('0x34')],_0x548407['filters']));if(_0x58c541[_0x8214('0x34')]['filter']){_0x573dc1['where']=_['merge'](_0x573dc1[_0x8214('0x3d')],{'$or':_[_0x8214('0x33')](_0x573dc1[_0x8214('0x38')],function(_0x5ef47d){var _0x27c34a={};_0x27c34a[_0x5ef47d]={'$like':'%'+_0x58c541[_0x8214('0x34')][_0x8214('0x3c')]+'%'};return _0x27c34a;})});}_0x573dc1=_[_0x8214('0x3f')]({},_0x573dc1,_0x58c541[_0x8214('0x40')]);return _0x2290df['getDescriptions'](_0x573dc1);}})[_0x8214('0x28')](function(_0x5e2f6a){if(_0x5e2f6a){_0x5e6280=_0x5e2f6a[_0x8214('0x39')];if(!_0x58c541[_0x8214('0x34')][_0x8214('0x3a')](_0x8214('0x50'))){_0x573dc1[_0x8214('0x21')]=qs[_0x8214('0x21')](_0x58c541[_0x8214('0x34')]['limit']);_0x573dc1['offset']=qs[_0x8214('0x23')](_0x58c541[_0x8214('0x34')][_0x8214('0x23')]);}return _0x2290df[_0x8214('0x53')](_0x573dc1);}})[_0x8214('0x28')](function(_0x589e4b){if(_0x589e4b){return _0x589e4b?{'count':_0x5e6280,'rows':_0x589e4b}:null;}})[_0x8214('0x28')](respondWithResult(_0x1db282,null))['catch'](handleError(_0x1db282,null));};exports['getTags']=function(_0x4fea30,_0x4e0875,_0x5387d3){var _0x1b23ae={};var _0x1fe63c={};var _0x1606d8;var _0x4eac29;return db['FreshdeskConfiguration'][_0x8214('0x4c')]({'where':{'id':_0x4fea30[_0x8214('0x47')]['id']}})[_0x8214('0x28')](handleEntityNotFound(_0x4e0875,null))[_0x8214('0x28')](function(_0xa735cd){if(_0xa735cd){_0x1606d8=_0xa735cd;_0x1fe63c[_0x8214('0x32')]=_[_0x8214('0x4d')](db[_0x8214('0x54')][_0x8214('0x2e')]);_0x1fe63c['query']=_['keys'](_0x4fea30['query']);_0x1fe63c[_0x8214('0x35')]=_[_0x8214('0x36')](_0x1fe63c['model'],_0x1fe63c['query']);_0x1b23ae[_0x8214('0x38')]=_[_0x8214('0x36')](_0x1fe63c[_0x8214('0x32')],qs[_0x8214('0x37')](_0x4fea30['query']['fields']));_0x1b23ae[_0x8214('0x38')]=_0x1b23ae[_0x8214('0x38')][_0x8214('0x39')]?_0x1b23ae[_0x8214('0x38')]:_0x1fe63c['model'];_0x1b23ae[_0x8214('0x51')]=qs[_0x8214('0x3b')](_0x4fea30[_0x8214('0x34')][_0x8214('0x3b')]);_0x1b23ae['where']=qs[_0x8214('0x35')](_[_0x8214('0x4f')](_0x4fea30[_0x8214('0x34')],_0x1fe63c[_0x8214('0x35')]));if(_0x4fea30[_0x8214('0x34')][_0x8214('0x3c')]){_0x1b23ae['where']=_[_0x8214('0x3f')](_0x1b23ae[_0x8214('0x3d')],{'$or':_['map'](_0x1b23ae[_0x8214('0x38')],function(_0x4dc77c){var _0x1338dc={};_0x1338dc[_0x4dc77c]={'$like':'%'+_0x4fea30['query'][_0x8214('0x3c')]+'%'};return _0x1338dc;})});}_0x1b23ae=_[_0x8214('0x3f')]({},_0x1b23ae,_0x4fea30['options']);return _0x1606d8['getTags'](_0x1b23ae);}})[_0x8214('0x28')](function(_0x41a793){if(_0x41a793){_0x4eac29=_0x41a793['length'];if(!_0x4fea30['query'][_0x8214('0x3a')](_0x8214('0x50'))){_0x1b23ae[_0x8214('0x21')]=qs[_0x8214('0x21')](_0x4fea30[_0x8214('0x34')][_0x8214('0x21')]);_0x1b23ae[_0x8214('0x23')]=qs[_0x8214('0x23')](_0x4fea30[_0x8214('0x34')][_0x8214('0x23')]);}return _0x1606d8[_0x8214('0x55')](_0x1b23ae);}})[_0x8214('0x28')](function(_0x218de6){if(_0x218de6){return _0x218de6?{'count':_0x4eac29,'rows':_0x218de6}:null;}})[_0x8214('0x28')](respondWithResult(_0x4e0875,null))[_0x8214('0x45')](handleError(_0x4e0875,null));};exports[_0x8214('0x56')]=function(_0x27be18,_0x548215,_0x38ac82){if(_0x27be18['body']['id']){delete _0x27be18[_0x8214('0x49')]['id'];}return db[_0x8214('0x2d')]['findOne']({'where':{'id':_0x27be18[_0x8214('0x47')]['id']}})[_0x8214('0x28')](handleEntityNotFound(_0x548215,null))[_0x8214('0x28')](function(_0xb15733){if(_0xb15733){return _0xb15733[_0x8214('0x56')](_0x27be18['body'][_0x8214('0x57')]||[]);}return null;})[_0x8214('0x28')](respondWithResult(_0x548215,null))[_0x8214('0x45')](handleError(_0x548215,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js index b268704..f942734 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 _0xf1c0=['define','int_freshdesk_configurations','lodash','util','../../config/logger','api','moment','request-promise','rimraf','./intFreshdeskConfiguration.attributes','exports'];(function(_0xc5a279,_0x155360){var _0xc755d3=function(_0x15051c){while(--_0x15051c){_0xc5a279['push'](_0xc5a279['shift']());}};_0xc755d3(++_0x155360);}(_0xf1c0,0x183));var _0x0f1c=function(_0x45c1b5,_0x3de727){_0x45c1b5=_0x45c1b5-0x0;var _0x13e25b=_0xf1c0[_0x45c1b5];return _0x13e25b;};'use strict';var _=require(_0x0f1c('0x0'));var util=require(_0x0f1c('0x1'));var logger=require(_0x0f1c('0x2'))(_0x0f1c('0x3'));var moment=require(_0x0f1c('0x4'));var BPromise=require('bluebird');var rp=require(_0x0f1c('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0f1c('0x6'));var config=require('../../config/environment');var attributes=require(_0x0f1c('0x7'));module[_0x0f1c('0x8')]=function(_0x3efcf2,_0x544839){return _0x3efcf2[_0x0f1c('0x9')]('FreshdeskConfiguration',attributes,{'tableName':_0x0f1c('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5203=['bluebird','request-promise','rimraf','./intFreshdeskConfiguration.attributes','exports','define','int_freshdesk_configurations','lodash','util','../../config/logger','api'];(function(_0x2cde0a,_0x1f9695){var _0x260610=function(_0x179089){while(--_0x179089){_0x2cde0a['push'](_0x2cde0a['shift']());}};_0x260610(++_0x1f9695);}(_0x5203,0x1bf));var _0x3520=function(_0xca1c04,_0x3fc3ef){_0xca1c04=_0xca1c04-0x0;var _0x3e1c1d=_0x5203[_0xca1c04];return _0x3e1c1d;};'use strict';var _=require(_0x3520('0x0'));var util=require(_0x3520('0x1'));var logger=require(_0x3520('0x2'))(_0x3520('0x3'));var moment=require('moment');var BPromise=require(_0x3520('0x4'));var rp=require(_0x3520('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3520('0x6'));var config=require('../../config/environment');var attributes=require(_0x3520('0x7'));module[_0x3520('0x8')]=function(_0x5e7762,_0x3504db){return _0x5e7762[_0x3520('0x9')]('FreshdeskConfiguration',attributes,{'tableName':_0x3520('0xa'),'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 cea855b..a3c7326 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 _0x0a6b=['rpc','../../config/environment','client','http','request','then','request\x20sent','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','FreshdeskConfiguration,\x20%s,\x20%s','message','info','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x9729d7,_0x1b79a8){var _0x3c4ac6=function(_0x401ba6){while(--_0x401ba6){_0x9729d7['push'](_0x9729d7['shift']());}};_0x3c4ac6(++_0x1b79a8);}(_0x0a6b,0x1d8));var _0xb0a6=function(_0x5f2d0f,_0x39eac6){_0x5f2d0f=_0x5f2d0f-0x0;var _0xbd5efa=_0x0a6b[_0x5f2d0f];return _0xbd5efa;};'use strict';var _=require(_0xb0a6('0x0'));var util=require('util');var moment=require(_0xb0a6('0x1'));var BPromise=require(_0xb0a6('0x2'));var rs=require(_0xb0a6('0x3'));var fs=require('fs');var Redis=require(_0xb0a6('0x4'));var db=require(_0xb0a6('0x5'))['db'];var utils=require(_0xb0a6('0x6'));var logger=require(_0xb0a6('0x7'))(_0xb0a6('0x8'));var config=require(_0xb0a6('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xb0a6('0xa')][_0xb0a6('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x446ded,_0x10ad89,_0x2b02eb){return new BPromise(function(_0x723b9d,_0x5e2732){return client[_0xb0a6('0xc')](_0x446ded,_0x2b02eb)[_0xb0a6('0xd')](function(_0xc1a9af){logger['info']('FreshdeskConfiguration,\x20%s,\x20%s',_0x10ad89,_0xb0a6('0xe'));logger[_0xb0a6('0xf')](_0xb0a6('0x10'),_0x10ad89,_0xb0a6('0xe'),JSON[_0xb0a6('0x11')](_0xc1a9af));if(_0xc1a9af[_0xb0a6('0x12')]){if(_0xc1a9af[_0xb0a6('0x12')][_0xb0a6('0x13')]===0x1f4){logger[_0xb0a6('0x12')](_0xb0a6('0x14'),_0x10ad89,_0xc1a9af[_0xb0a6('0x12')][_0xb0a6('0x15')]);return _0x5e2732(_0xc1a9af[_0xb0a6('0x12')][_0xb0a6('0x15')]);}logger[_0xb0a6('0x12')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x10ad89,_0xc1a9af[_0xb0a6('0x12')][_0xb0a6('0x15')]);return _0x723b9d(_0xc1a9af[_0xb0a6('0x12')][_0xb0a6('0x15')]);}else{logger[_0xb0a6('0x16')](_0xb0a6('0x14'),_0x10ad89,_0xb0a6('0xe'));_0x723b9d(_0xc1a9af['result']['message']);}})[_0xb0a6('0x17')](function(_0x2db587){logger['error'](_0xb0a6('0x14'),_0x10ad89,_0x2db587);_0x5e2732(_0x2db587);});});} \ No newline at end of file +var _0xf0a9=['FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','info','catch','lodash','util','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then'];(function(_0x5d80de,_0x2cf15d){var _0x1c7556=function(_0x5bd806){while(--_0x5bd806){_0x5d80de['push'](_0x5d80de['shift']());}};_0x1c7556(++_0x2cf15d);}(_0xf0a9,0x12f));var _0x9f0a=function(_0x58a5a7,_0x14737c){_0x58a5a7=_0x58a5a7-0x0;var _0x192e57=_0xf0a9[_0x58a5a7];return _0x192e57;};'use strict';var _=require(_0x9f0a('0x0'));var util=require(_0x9f0a('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x9f0a('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9f0a('0x3'))['db'];var utils=require(_0x9f0a('0x4'));var logger=require(_0x9f0a('0x5'))(_0x9f0a('0x6'));var config=require(_0x9f0a('0x7'));var jayson=require(_0x9f0a('0x8'));var client=jayson['client'][_0x9f0a('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x439b3a,_0x5e33b7,_0x9af5aa){return new BPromise(function(_0x2fce4f,_0x158259){return client[_0x9f0a('0xa')](_0x439b3a,_0x9af5aa)[_0x9f0a('0xb')](function(_0x5f3a19){logger['info'](_0x9f0a('0xc'),_0x5e33b7,_0x9f0a('0xd'));logger[_0x9f0a('0xe')](_0x9f0a('0xf'),_0x5e33b7,_0x9f0a('0xd'),JSON['stringify'](_0x5f3a19));if(_0x5f3a19[_0x9f0a('0x10')]){if(_0x5f3a19[_0x9f0a('0x10')][_0x9f0a('0x11')]===0x1f4){logger[_0x9f0a('0x10')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x5e33b7,_0x5f3a19[_0x9f0a('0x10')][_0x9f0a('0x12')]);return _0x158259(_0x5f3a19[_0x9f0a('0x10')]['message']);}logger[_0x9f0a('0x10')](_0x9f0a('0xc'),_0x5e33b7,_0x5f3a19[_0x9f0a('0x10')]['message']);return _0x2fce4f(_0x5f3a19[_0x9f0a('0x10')][_0x9f0a('0x12')]);}else{logger[_0x9f0a('0x13')](_0x9f0a('0xc'),_0x5e33b7,_0x9f0a('0xd'));_0x2fce4f(_0x5f3a19['result']['message']);}})[_0x9f0a('0x14')](function(_0x3404ec){logger[_0x9f0a('0x10')](_0x9f0a('0xc'),_0x5e33b7,_0x3404ec);_0x158259(_0x3404ec);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskField/index.js b/server/api/intFreshdeskField/index.js index a81d89a..1b282d9 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 _0xead2=['update','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./intFreshdeskField.controller','isAuthenticated','index','show','post','create','/:id'];(function(_0x4fdacd,_0x56795d){var _0x16fe07=function(_0x7f316e){while(--_0x7f316e){_0x4fdacd['push'](_0x4fdacd['shift']());}};_0x16fe07(++_0x56795d);}(_0xead2,0xd4));var _0x2ead=function(_0x302d03,_0x1a8705){_0x302d03=_0x302d03-0x0;var _0x2fe15a=_0xead2[_0x302d03];return _0x2fe15a;};'use strict';var multer=require(_0x2ead('0x0'));var util=require(_0x2ead('0x1'));var path=require(_0x2ead('0x2'));var timeout=require(_0x2ead('0x3'));var express=require(_0x2ead('0x4'));var router=express[_0x2ead('0x5')]();var fs_extra=require(_0x2ead('0x6'));var auth=require(_0x2ead('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x2ead('0x8'));var controller=require(_0x2ead('0x9'));router['get']('/',auth[_0x2ead('0xa')](),controller[_0x2ead('0xb')]);router['get']('/:id',auth[_0x2ead('0xa')](),controller[_0x2ead('0xc')]);router[_0x2ead('0xd')]('/',auth[_0x2ead('0xa')](),controller[_0x2ead('0xe')]);router['put'](_0x2ead('0xf'),auth[_0x2ead('0xa')](),controller[_0x2ead('0x10')]);router[_0x2ead('0x11')](_0x2ead('0xf'),auth[_0x2ead('0xa')](),controller[_0x2ead('0x12')]);module['exports']=router; \ No newline at end of file +var _0x60a7=['connect-timeout','express','../../components/auth/service','./intFreshdeskField.controller','get','isAuthenticated','index','/:id','show','post','create','put','multer','util','path'];(function(_0x4cbbf2,_0x238937){var _0x4ddecd=function(_0x4a7350){while(--_0x4a7350){_0x4cbbf2['push'](_0x4cbbf2['shift']());}};_0x4ddecd(++_0x238937);}(_0x60a7,0x1b0));var _0x760a=function(_0x3e272d,_0x57ed80){_0x3e272d=_0x3e272d-0x0;var _0x34ad38=_0x60a7[_0x3e272d];return _0x34ad38;};'use strict';var multer=require(_0x760a('0x0'));var util=require(_0x760a('0x1'));var path=require(_0x760a('0x2'));var timeout=require(_0x760a('0x3'));var express=require(_0x760a('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x760a('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x760a('0x6'));router[_0x760a('0x7')]('/',auth[_0x760a('0x8')](),controller[_0x760a('0x9')]);router[_0x760a('0x7')](_0x760a('0xa'),auth[_0x760a('0x8')](),controller[_0x760a('0xb')]);router[_0x760a('0xc')]('/',auth[_0x760a('0x8')](),controller[_0x760a('0xd')]);router[_0x760a('0xe')](_0x760a('0xa'),auth[_0x760a('0x8')](),controller['update']);router['delete'](_0x760a('0xa'),auth[_0x760a('0x8')](),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 bf3a327..728d8b4 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 _0xaeac=['sequelize','exports','ENUM','string','customVariable','keyValue','picklist','STRING','variable','BOOLEAN'];(function(_0x504538,_0x4f4262){var _0x23d0fb=function(_0x38813f){while(--_0x38813f){_0x504538['push'](_0x504538['shift']());}};_0x23d0fb(++_0x4f4262);}(_0xaeac,0x1e0));var _0xcaea=function(_0x2e8a4c,_0x34f8a1){_0x2e8a4c=_0x2e8a4c-0x0;var _0xb9bc13=_0xaeac[_0x2e8a4c];return _0xb9bc13;};'use strict';var Sequelize=require(_0xcaea('0x0'));module[_0xcaea('0x1')]={'type':{'type':Sequelize[_0xcaea('0x2')](_0xcaea('0x3'),'variable',_0xcaea('0x4'),_0xcaea('0x5'),_0xcaea('0x6')),'defaultValue':_0xcaea('0x3')},'content':{'type':Sequelize[_0xcaea('0x7')]},'key':{'type':Sequelize[_0xcaea('0x7')]},'keyType':{'type':Sequelize[_0xcaea('0x2')]('string',_0xcaea('0x8'),_0xcaea('0x4'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0xcaea('0x7')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0xcaea('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xcaea('0x7')]}}; \ No newline at end of file +var _0xad12=['STRING','exports','ENUM','string','variable','customVariable','keyValue'];(function(_0x94f205,_0x519e2e){var _0x2755d7=function(_0x4e1a44){while(--_0x4e1a44){_0x94f205['push'](_0x94f205['shift']());}};_0x2755d7(++_0x519e2e);}(_0xad12,0x119));var _0x2ad1=function(_0x2c47b6,_0x550f52){_0x2c47b6=_0x2c47b6-0x0;var _0x40a5e3=_0xad12[_0x2c47b6];return _0x40a5e3;};'use strict';var Sequelize=require('sequelize');module[_0x2ad1('0x0')]={'type':{'type':Sequelize[_0x2ad1('0x1')](_0x2ad1('0x2'),_0x2ad1('0x3'),_0x2ad1('0x4'),_0x2ad1('0x5'),'picklist'),'defaultValue':_0x2ad1('0x2')},'content':{'type':Sequelize[_0x2ad1('0x6')]},'key':{'type':Sequelize[_0x2ad1('0x6')]},'keyType':{'type':Sequelize['ENUM'](_0x2ad1('0x2'),_0x2ad1('0x3'),_0x2ad1('0x4'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x2ad1('0x6')]},'nameField':{'type':Sequelize[_0x2ad1('0x6')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x2ad1('0x6')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.controller.js b/server/api/intFreshdeskField/intFreshdeskField.controller.js index 7bb099f..9909bdc 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 _0x22fb=['Content-Range','json','apply','save','update','then','destroy','error','stack','name','send','map','FreshdeskField','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','create','body','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/license/util','sendStatus','status','end','offset','undefined','limit','count'];(function(_0x5e9db0,_0x215ea2){var _0x39182e=function(_0x3f5a87){while(--_0x3f5a87){_0x5e9db0['push'](_0x5e9db0['shift']());}};_0x39182e(++_0x215ea2);}(_0x22fb,0x192));var _0xb22f=function(_0xdedb4d,_0x1e37ae){_0xdedb4d=_0xdedb4d-0x0;var _0x11fc44=_0x22fb[_0xdedb4d];return _0x11fc44;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xb22f('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb22f('0x1'));var moment=require(_0xb22f('0x2'));var BPromise=require(_0xb22f('0x3'));var Mustache=require(_0xb22f('0x4'));var util=require(_0xb22f('0x5'));var path=require('path');var sox=require(_0xb22f('0x6'));var csv=require(_0xb22f('0x7'));var ejs=require(_0xb22f('0x8'));var fs=require('fs');var fs_extra=require(_0xb22f('0x9'));var _=require(_0xb22f('0xa'));var squel=require(_0xb22f('0xb'));var crypto=require('crypto');var jsforce=require(_0xb22f('0xc'));var deskjs=require(_0xb22f('0xd'));var toCsv=require(_0xb22f('0x7'));var querystring=require(_0xb22f('0xe'));var Papa=require(_0xb22f('0xf'));var Redis=require(_0xb22f('0x10'));var authService=require(_0xb22f('0x11'));var qs=require(_0xb22f('0x12'));var as=require(_0xb22f('0x13'));var hardwareService=require(_0xb22f('0x14'));var logger=require(_0xb22f('0x15'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xb22f('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4bb02a,_0x5bf0b9){_0x5bf0b9=_0x5bf0b9||0xcc;return function(_0x45e426){if(_0x45e426){return _0x4bb02a[_0xb22f('0x17')](_0x5bf0b9);}return _0x4bb02a[_0xb22f('0x18')](_0x5bf0b9)[_0xb22f('0x19')]();};}function respondWithResult(_0x390c53,_0x32d796){_0x32d796=_0x32d796||0xc8;return function(_0x5c6ccf){if(_0x5c6ccf){return _0x390c53[_0xb22f('0x18')](_0x32d796)['json'](_0x5c6ccf);}};}function respondWithFilteredResult(_0x36e2a8,_0x4f9108){return function(_0x2187fc){if(_0x2187fc){var _0x514a8f=typeof _0x4f9108[_0xb22f('0x1a')]===_0xb22f('0x1b')&&typeof _0x4f9108[_0xb22f('0x1c')]==='undefined';var _0x1530f7=_0x2187fc['count'];var _0x252742=_0x514a8f?0x0:_0x4f9108[_0xb22f('0x1a')];var _0x2aaec4=_0x514a8f?_0x2187fc[_0xb22f('0x1d')]:_0x4f9108[_0xb22f('0x1a')]+_0x4f9108[_0xb22f('0x1c')];var _0x5c843b;if(_0x2aaec4>=_0x1530f7){_0x2aaec4=_0x1530f7;_0x5c843b=0xc8;}else{_0x5c843b=0xce;}_0x36e2a8[_0xb22f('0x18')](_0x5c843b);return _0x36e2a8['set'](_0xb22f('0x1e'),_0x252742+'-'+_0x2aaec4+'/'+_0x1530f7)[_0xb22f('0x1f')](_0x2187fc);}return null;};}function patchUpdates(_0x316f11){return function(_0x2239b8){try{jsonpatch[_0xb22f('0x20')](_0x2239b8,_0x316f11,!![]);}catch(_0x4bbb12){return BPromise['reject'](_0x4bbb12);}return _0x2239b8[_0xb22f('0x21')]();};}function saveUpdates(_0x19e480,_0xf34e0d){return function(_0x16e465){if(_0x16e465){return _0x16e465[_0xb22f('0x22')](_0x19e480)[_0xb22f('0x23')](function(_0x201764){return _0x201764;});}return null;};}function removeEntity(_0x286465,_0x583fbe){return function(_0x482b3a){if(_0x482b3a){return _0x482b3a[_0xb22f('0x24')]()[_0xb22f('0x23')](function(){_0x286465['status'](0xcc)[_0xb22f('0x19')]();});}};}function handleEntityNotFound(_0x4364f5,_0x4f2986){return function(_0x4687f2){if(!_0x4687f2){_0x4364f5[_0xb22f('0x17')](0x194);}return _0x4687f2;};}function handleError(_0x4dfb62,_0x3e471f){_0x3e471f=_0x3e471f||0x1f4;return function(_0x2c4a9e){logger[_0xb22f('0x25')](_0x2c4a9e[_0xb22f('0x26')]);if(_0x2c4a9e[_0xb22f('0x27')]){delete _0x2c4a9e[_0xb22f('0x27')];}_0x4dfb62[_0xb22f('0x18')](_0x3e471f)[_0xb22f('0x28')](_0x2c4a9e);};}exports['index']=function(_0x483cc3,_0x5d86a1){var _0x2f6b97={},_0x557d96={},_0x327200={'count':0x0,'rows':[]};var _0xc7f33b=_[_0xb22f('0x29')](db[_0xb22f('0x2a')][_0xb22f('0x2b')],function(_0x5b2a42){return{'name':_0x5b2a42['fieldName'],'type':_0x5b2a42[_0xb22f('0x2c')][_0xb22f('0x2d')]};});_0x557d96[_0xb22f('0x2e')]=_[_0xb22f('0x29')](_0xc7f33b,'name');_0x557d96[_0xb22f('0x2f')]=_[_0xb22f('0x30')](_0x483cc3['query']);_0x557d96[_0xb22f('0x31')]=_[_0xb22f('0x32')](_0x557d96[_0xb22f('0x2e')],_0x557d96[_0xb22f('0x2f')]);_0x2f6b97[_0xb22f('0x33')]=_['intersection'](_0x557d96['model'],qs[_0xb22f('0x34')](_0x483cc3[_0xb22f('0x2f')][_0xb22f('0x34')]));_0x2f6b97[_0xb22f('0x33')]=_0x2f6b97[_0xb22f('0x33')][_0xb22f('0x35')]?_0x2f6b97[_0xb22f('0x33')]:_0x557d96[_0xb22f('0x2e')];if(!_0x483cc3[_0xb22f('0x2f')]['hasOwnProperty'](_0xb22f('0x36'))){_0x2f6b97['limit']=qs['limit'](_0x483cc3[_0xb22f('0x2f')][_0xb22f('0x1c')]);_0x2f6b97[_0xb22f('0x1a')]=qs[_0xb22f('0x1a')](_0x483cc3[_0xb22f('0x2f')][_0xb22f('0x1a')]);}_0x2f6b97[_0xb22f('0x37')]=qs[_0xb22f('0x38')](_0x483cc3[_0xb22f('0x2f')][_0xb22f('0x38')]);_0x2f6b97[_0xb22f('0x39')]=qs[_0xb22f('0x31')](_[_0xb22f('0x3a')](_0x483cc3['query'],_0x557d96['filters']),_0xc7f33b);if(_0x483cc3[_0xb22f('0x2f')][_0xb22f('0x3b')]){_0x2f6b97[_0xb22f('0x39')]=_['merge'](_0x2f6b97[_0xb22f('0x39')],{'$or':_[_0xb22f('0x29')](_0xc7f33b,function(_0x4a142c){if(_0x4a142c['type']!==_0xb22f('0x3c')){var _0x5a5ee7={};_0x5a5ee7[_0x4a142c[_0xb22f('0x27')]]={'$like':'%'+_0x483cc3['query'][_0xb22f('0x3b')]+'%'};return _0x5a5ee7;}})});}_0x2f6b97=_[_0xb22f('0x3d')]({},_0x2f6b97,_0x483cc3[_0xb22f('0x3e')]);var _0x52a3c7={'where':_0x2f6b97[_0xb22f('0x39')]};return db[_0xb22f('0x2a')][_0xb22f('0x1d')](_0x52a3c7)['then'](function(_0x14cd91){_0x327200[_0xb22f('0x1d')]=_0x14cd91;if(_0x483cc3[_0xb22f('0x2f')][_0xb22f('0x3f')]){_0x2f6b97[_0xb22f('0x40')]=[{'all':!![]}];}return db[_0xb22f('0x2a')][_0xb22f('0x41')](_0x2f6b97);})[_0xb22f('0x23')](function(_0xcb55d3){_0x327200[_0xb22f('0x42')]=_0xcb55d3;return _0x327200;})['then'](respondWithFilteredResult(_0x5d86a1,_0x2f6b97))[_0xb22f('0x43')](handleError(_0x5d86a1,null));};exports[_0xb22f('0x44')]=function(_0x5846ed,_0x3e4c4a){var _0x4be0de={'raw':!![],'where':{'id':_0x5846ed[_0xb22f('0x45')]['id']}},_0x58ba40={};_0x58ba40[_0xb22f('0x2e')]=_[_0xb22f('0x30')](db[_0xb22f('0x2a')]['rawAttributes']);_0x58ba40[_0xb22f('0x2f')]=_['keys'](_0x5846ed[_0xb22f('0x2f')]);_0x58ba40[_0xb22f('0x31')]=_[_0xb22f('0x32')](_0x58ba40[_0xb22f('0x2e')],_0x58ba40[_0xb22f('0x2f')]);_0x4be0de[_0xb22f('0x33')]=_['intersection'](_0x58ba40[_0xb22f('0x2e')],qs['fields'](_0x5846ed[_0xb22f('0x2f')][_0xb22f('0x34')]));_0x4be0de['attributes']=_0x4be0de[_0xb22f('0x33')][_0xb22f('0x35')]?_0x4be0de['attributes']:_0x58ba40['model'];if(_0x5846ed[_0xb22f('0x2f')]['includeAll']){_0x4be0de[_0xb22f('0x40')]=[{'all':!![]}];}_0x4be0de=_[_0xb22f('0x3d')]({},_0x4be0de,_0x5846ed[_0xb22f('0x3e')]);return db[_0xb22f('0x2a')]['find'](_0x4be0de)[_0xb22f('0x23')](handleEntityNotFound(_0x3e4c4a,null))[_0xb22f('0x23')](respondWithResult(_0x3e4c4a,null))['catch'](handleError(_0x3e4c4a,null));};exports[_0xb22f('0x46')]=function(_0x72d501,_0x411723){return db[_0xb22f('0x2a')][_0xb22f('0x46')](_0x72d501['body'],{})[_0xb22f('0x23')](respondWithResult(_0x411723,0xc9))['catch'](handleError(_0x411723,null));};exports['update']=function(_0x3fb0ac,_0x90eef9){if(_0x3fb0ac[_0xb22f('0x47')]['id']){delete _0x3fb0ac[_0xb22f('0x47')]['id'];}return db[_0xb22f('0x2a')]['find']({'where':{'id':_0x3fb0ac[_0xb22f('0x45')]['id']}})['then'](handleEntityNotFound(_0x90eef9,null))[_0xb22f('0x23')](saveUpdates(_0x3fb0ac['body'],null))[_0xb22f('0x23')](respondWithResult(_0x90eef9,null))[_0xb22f('0x43')](handleError(_0x90eef9,null));};exports[_0xb22f('0x24')]=function(_0x58cd19,_0x299156){return db[_0xb22f('0x2a')]['find']({'where':{'id':_0x58cd19[_0xb22f('0x45')]['id']}})[_0xb22f('0x23')](handleEntityNotFound(_0x299156,null))['then'](removeEntity(_0x299156,null))['catch'](handleError(_0x299156,null));}; \ No newline at end of file +var _0x7d98=['pick','filter','merge','where','include','FreshdeskField','findAll','rows','show','rawAttributes','create','body','catch','find','params','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','lodash','squel','crypto','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','limit','count','offset','Content-Range','json','reject','save','update','then','destroy','error','name','send','fieldName','key','map','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort'];(function(_0x1151fa,_0x2784a7){var _0x49da2b=function(_0x2d33ca){while(--_0x2d33ca){_0x1151fa['push'](_0x1151fa['shift']());}};_0x49da2b(++_0x2784a7);}(_0x7d98,0xe7));var _0x87d9=function(_0x4179e2,_0xf2dbb){_0x4179e2=_0x4179e2-0x0;var _0x24cb50=_0x7d98[_0x4179e2];return _0x24cb50;};'use strict';var emlformat=require(_0x87d9('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x87d9('0x1'));var jsonpatch=require(_0x87d9('0x2'));var rp=require(_0x87d9('0x3'));var moment=require(_0x87d9('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x87d9('0x5'));var util=require(_0x87d9('0x6'));var path=require('path');var sox=require(_0x87d9('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x87d9('0x8'));var squel=require(_0x87d9('0x9'));var crypto=require(_0x87d9('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x87d9('0xb'));var toCsv=require(_0x87d9('0xc'));var querystring=require(_0x87d9('0xd'));var Papa=require('papaparse');var Redis=require(_0x87d9('0xe'));var authService=require(_0x87d9('0xf'));var qs=require(_0x87d9('0x10'));var as=require(_0x87d9('0x11'));var hardwareService=require(_0x87d9('0x12'));var logger=require(_0x87d9('0x13'))(_0x87d9('0x14'));var utils=require(_0x87d9('0x15'));var config=require(_0x87d9('0x16'));var licenseUtil=require(_0x87d9('0x17'));var db=require(_0x87d9('0x18'))['db'];function respondWithStatusCode(_0x22f32d,_0x38f33e){_0x38f33e=_0x38f33e||0xcc;return function(_0x22758){if(_0x22758){return _0x22f32d[_0x87d9('0x19')](_0x38f33e);}return _0x22f32d[_0x87d9('0x1a')](_0x38f33e)[_0x87d9('0x1b')]();};}function respondWithResult(_0x185401,_0x380836){_0x380836=_0x380836||0xc8;return function(_0x27d61d){if(_0x27d61d){return _0x185401['status'](_0x380836)['json'](_0x27d61d);}};}function respondWithFilteredResult(_0x9e9e53,_0xaa910c){return function(_0x3231e7){if(_0x3231e7){var _0x501d32=typeof _0xaa910c['offset']===_0x87d9('0x1c')&&typeof _0xaa910c[_0x87d9('0x1d')]===_0x87d9('0x1c');var _0x23ae47=_0x3231e7[_0x87d9('0x1e')];var _0xebc1eb=_0x501d32?0x0:_0xaa910c[_0x87d9('0x1f')];var _0x1f33a3=_0x501d32?_0x3231e7[_0x87d9('0x1e')]:_0xaa910c[_0x87d9('0x1f')]+_0xaa910c[_0x87d9('0x1d')];var _0x5d6da1;if(_0x1f33a3>=_0x23ae47){_0x1f33a3=_0x23ae47;_0x5d6da1=0xc8;}else{_0x5d6da1=0xce;}_0x9e9e53[_0x87d9('0x1a')](_0x5d6da1);return _0x9e9e53['set'](_0x87d9('0x20'),_0xebc1eb+'-'+_0x1f33a3+'/'+_0x23ae47)[_0x87d9('0x21')](_0x3231e7);}return null;};}function patchUpdates(_0x334d31){return function(_0x57bef6){try{jsonpatch['apply'](_0x57bef6,_0x334d31,!![]);}catch(_0x545241){return BPromise[_0x87d9('0x22')](_0x545241);}return _0x57bef6[_0x87d9('0x23')]();};}function saveUpdates(_0x28aaaa,_0x6ab839){return function(_0xc82b02){if(_0xc82b02){return _0xc82b02[_0x87d9('0x24')](_0x28aaaa)[_0x87d9('0x25')](function(_0x3b24e7){return _0x3b24e7;});}return null;};}function removeEntity(_0x1c550c,_0x4c0f7a){return function(_0x31e1b2){if(_0x31e1b2){return _0x31e1b2[_0x87d9('0x26')]()[_0x87d9('0x25')](function(){_0x1c550c[_0x87d9('0x1a')](0xcc)[_0x87d9('0x1b')]();});}};}function handleEntityNotFound(_0x340462,_0x3641c8){return function(_0x32b83f){if(!_0x32b83f){_0x340462['sendStatus'](0x194);}return _0x32b83f;};}function handleError(_0x8b1ab7,_0x600404){_0x600404=_0x600404||0x1f4;return function(_0x2f63fa){logger[_0x87d9('0x27')](_0x2f63fa['stack']);if(_0x2f63fa[_0x87d9('0x28')]){delete _0x2f63fa[_0x87d9('0x28')];}_0x8b1ab7[_0x87d9('0x1a')](_0x600404)[_0x87d9('0x29')](_0x2f63fa);};}exports['index']=function(_0x21916a,_0x3c0283){var _0x501c5={},_0x5e1b55={},_0x1d04a9={'count':0x0,'rows':[]};var _0x22a401=_['map'](db['FreshdeskField']['rawAttributes'],function(_0x31122b){return{'name':_0x31122b[_0x87d9('0x2a')],'type':_0x31122b['type'][_0x87d9('0x2b')]};});_0x5e1b55['model']=_[_0x87d9('0x2c')](_0x22a401,'name');_0x5e1b55[_0x87d9('0x2d')]=_[_0x87d9('0x2e')](_0x21916a['query']);_0x5e1b55[_0x87d9('0x2f')]=_['intersection'](_0x5e1b55[_0x87d9('0x30')],_0x5e1b55[_0x87d9('0x2d')]);_0x501c5[_0x87d9('0x31')]=_[_0x87d9('0x32')](_0x5e1b55[_0x87d9('0x30')],qs[_0x87d9('0x33')](_0x21916a['query'][_0x87d9('0x33')]));_0x501c5[_0x87d9('0x31')]=_0x501c5[_0x87d9('0x31')][_0x87d9('0x34')]?_0x501c5[_0x87d9('0x31')]:_0x5e1b55[_0x87d9('0x30')];if(!_0x21916a[_0x87d9('0x2d')][_0x87d9('0x35')](_0x87d9('0x36'))){_0x501c5['limit']=qs[_0x87d9('0x1d')](_0x21916a[_0x87d9('0x2d')][_0x87d9('0x1d')]);_0x501c5[_0x87d9('0x1f')]=qs[_0x87d9('0x1f')](_0x21916a['query'][_0x87d9('0x1f')]);}_0x501c5[_0x87d9('0x37')]=qs[_0x87d9('0x38')](_0x21916a['query'][_0x87d9('0x38')]);_0x501c5['where']=qs[_0x87d9('0x2f')](_[_0x87d9('0x39')](_0x21916a[_0x87d9('0x2d')],_0x5e1b55[_0x87d9('0x2f')]),_0x22a401);if(_0x21916a['query'][_0x87d9('0x3a')]){_0x501c5['where']=_[_0x87d9('0x3b')](_0x501c5[_0x87d9('0x3c')],{'$or':_[_0x87d9('0x2c')](_0x22a401,function(_0x1af8eb){if(_0x1af8eb['type']!=='VIRTUAL'){var _0x2063de={};_0x2063de[_0x1af8eb['name']]={'$like':'%'+_0x21916a[_0x87d9('0x2d')]['filter']+'%'};return _0x2063de;}})});}_0x501c5=_[_0x87d9('0x3b')]({},_0x501c5,_0x21916a['options']);var _0xdf56e8={'where':_0x501c5[_0x87d9('0x3c')]};return db['FreshdeskField'][_0x87d9('0x1e')](_0xdf56e8)['then'](function(_0x4bc1ba){_0x1d04a9['count']=_0x4bc1ba;if(_0x21916a[_0x87d9('0x2d')]['includeAll']){_0x501c5[_0x87d9('0x3d')]=[{'all':!![]}];}return db[_0x87d9('0x3e')][_0x87d9('0x3f')](_0x501c5);})['then'](function(_0x915f05){_0x1d04a9[_0x87d9('0x40')]=_0x915f05;return _0x1d04a9;})[_0x87d9('0x25')](respondWithFilteredResult(_0x3c0283,_0x501c5))['catch'](handleError(_0x3c0283,null));};exports[_0x87d9('0x41')]=function(_0x58ec85,_0x5c2db5){var _0x59338e={'raw':!![],'where':{'id':_0x58ec85['params']['id']}},_0x39e807={};_0x39e807['model']=_[_0x87d9('0x2e')](db[_0x87d9('0x3e')][_0x87d9('0x42')]);_0x39e807[_0x87d9('0x2d')]=_[_0x87d9('0x2e')](_0x58ec85['query']);_0x39e807[_0x87d9('0x2f')]=_[_0x87d9('0x32')](_0x39e807['model'],_0x39e807['query']);_0x59338e[_0x87d9('0x31')]=_[_0x87d9('0x32')](_0x39e807[_0x87d9('0x30')],qs[_0x87d9('0x33')](_0x58ec85[_0x87d9('0x2d')][_0x87d9('0x33')]));_0x59338e[_0x87d9('0x31')]=_0x59338e[_0x87d9('0x31')]['length']?_0x59338e[_0x87d9('0x31')]:_0x39e807[_0x87d9('0x30')];if(_0x58ec85['query']['includeAll']){_0x59338e[_0x87d9('0x3d')]=[{'all':!![]}];}_0x59338e=_[_0x87d9('0x3b')]({},_0x59338e,_0x58ec85['options']);return db[_0x87d9('0x3e')]['find'](_0x59338e)['then'](handleEntityNotFound(_0x5c2db5,null))['then'](respondWithResult(_0x5c2db5,null))['catch'](handleError(_0x5c2db5,null));};exports[_0x87d9('0x43')]=function(_0x101446,_0x533a74){return db[_0x87d9('0x3e')][_0x87d9('0x43')](_0x101446[_0x87d9('0x44')],{})['then'](respondWithResult(_0x533a74,0xc9))[_0x87d9('0x45')](handleError(_0x533a74,null));};exports[_0x87d9('0x24')]=function(_0x2d4766,_0x384273){if(_0x2d4766[_0x87d9('0x44')]['id']){delete _0x2d4766[_0x87d9('0x44')]['id'];}return db['FreshdeskField'][_0x87d9('0x46')]({'where':{'id':_0x2d4766['params']['id']}})['then'](handleEntityNotFound(_0x384273,null))[_0x87d9('0x25')](saveUpdates(_0x2d4766[_0x87d9('0x44')],null))[_0x87d9('0x25')](respondWithResult(_0x384273,null))[_0x87d9('0x45')](handleError(_0x384273,null));};exports[_0x87d9('0x26')]=function(_0x4fdfa9,_0x4558f5){return db[_0x87d9('0x3e')][_0x87d9('0x46')]({'where':{'id':_0x4fdfa9[_0x87d9('0x47')]['id']}})['then'](handleEntityNotFound(_0x4558f5,null))[_0x87d9('0x25')](removeEntity(_0x4558f5,null))[_0x87d9('0x45')](handleError(_0x4558f5,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.model.js b/server/api/intFreshdeskField/intFreshdeskField.model.js index 0e64cd7..2cbb610 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 _0xd3ee=['exports','define','FreshdeskField','freshdesk_unique_index','idField','lodash','util','api','moment','request-promise','path','../../config/environment','./intFreshdeskField.attributes'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0xd3ee,0x1b2));var _0xed3e=function(_0x5e2eb5,_0x3f4e6c){_0x5e2eb5=_0x5e2eb5-0x0;var _0x180baf=_0xd3ee[_0x5e2eb5];return _0x180baf;};'use strict';var _=require(_0xed3e('0x0'));var util=require(_0xed3e('0x1'));var logger=require('../../config/logger')(_0xed3e('0x2'));var moment=require(_0xed3e('0x3'));var BPromise=require('bluebird');var rp=require(_0xed3e('0x4'));var fs=require('fs');var path=require(_0xed3e('0x5'));var rimraf=require('rimraf');var config=require(_0xed3e('0x6'));var attributes=require(_0xed3e('0x7'));module[_0xed3e('0x8')]=function(_0xd7bf3e,_0x7348ef){return _0xd7bf3e[_0xed3e('0x9')](_0xed3e('0xa'),attributes,{'tableName':'int_freshdesk_fields','paranoid':![],'indexes':[{'name':_0xed3e('0xb'),'fields':[_0xed3e('0xc'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x1974=['moment','bluebird','path','rimraf','../../config/environment','./intFreshdeskField.attributes','exports','define','FreshdeskField','int_freshdesk_fields','FieldId','../../config/logger'];(function(_0x225b4e,_0x179ee4){var _0x24237a=function(_0x4ac970){while(--_0x4ac970){_0x225b4e['push'](_0x225b4e['shift']());}};_0x24237a(++_0x179ee4);}(_0x1974,0x1d3));var _0x4197=function(_0x1aa3a6,_0xe1c058){_0x1aa3a6=_0x1aa3a6-0x0;var _0x126d84=_0x1974[_0x1aa3a6];return _0x126d84;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x4197('0x0'))('api');var moment=require(_0x4197('0x1'));var BPromise=require(_0x4197('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4197('0x3'));var rimraf=require(_0x4197('0x4'));var config=require(_0x4197('0x5'));var attributes=require(_0x4197('0x6'));module[_0x4197('0x7')]=function(_0x43687d,_0x1b0404){return _0x43687d[_0x4197('0x8')](_0x4197('0x9'),attributes,{'tableName':_0x4197('0xa'),'paranoid':![],'indexes':[{'name':'freshdesk_unique_index','fields':['idField',_0x4197('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.rpc.js b/server/api/intFreshdeskField/intFreshdeskField.rpc.js index 0c18214..e8261ce 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 _0xb36d=['catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','debug','FreshdeskField,\x20%s,\x20%s,\x20%s','error','FreshdeskField,\x20%s,\x20%s','message','result'];(function(_0x13e06c,_0x17f993){var _0x424a0f=function(_0x2857b2){while(--_0x2857b2){_0x13e06c['push'](_0x13e06c['shift']());}};_0x424a0f(++_0x17f993);}(_0xb36d,0xa9));var _0xdb36=function(_0x37d3de,_0x54dcc1){_0x37d3de=_0x37d3de-0x0;var _0x548715=_0xb36d[_0x37d3de];return _0x548715;};'use strict';var _=require('lodash');var util=require(_0xdb36('0x0'));var moment=require('moment');var BPromise=require(_0xdb36('0x1'));var rs=require(_0xdb36('0x2'));var fs=require('fs');var Redis=require(_0xdb36('0x3'));var db=require(_0xdb36('0x4'))['db'];var utils=require(_0xdb36('0x5'));var logger=require(_0xdb36('0x6'))(_0xdb36('0x7'));var config=require(_0xdb36('0x8'));var jayson=require(_0xdb36('0x9'));var client=jayson[_0xdb36('0xa')][_0xdb36('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2f6486,_0x1dc234,_0x5c5025){return new BPromise(function(_0x19b964,_0x47eb8e){return client[_0xdb36('0xc')](_0x2f6486,_0x5c5025)['then'](function(_0x38b591){logger[_0xdb36('0xd')]('FreshdeskField,\x20%s,\x20%s',_0x1dc234,'request\x20sent');logger[_0xdb36('0xe')](_0xdb36('0xf'),_0x1dc234,'request\x20sent',JSON['stringify'](_0x38b591));if(_0x38b591[_0xdb36('0x10')]){if(_0x38b591[_0xdb36('0x10')]['code']===0x1f4){logger[_0xdb36('0x10')](_0xdb36('0x11'),_0x1dc234,_0x38b591[_0xdb36('0x10')]['message']);return _0x47eb8e(_0x38b591[_0xdb36('0x10')][_0xdb36('0x12')]);}logger['error'](_0xdb36('0x11'),_0x1dc234,_0x38b591['error'][_0xdb36('0x12')]);return _0x19b964(_0x38b591['error'][_0xdb36('0x12')]);}else{logger[_0xdb36('0xd')](_0xdb36('0x11'),_0x1dc234,'request\x20sent');_0x19b964(_0x38b591[_0xdb36('0x13')][_0xdb36('0x12')]);}})[_0xdb36('0x14')](function(_0x129024){logger[_0xdb36('0x10')](_0xdb36('0x11'),_0x1dc234,_0x129024);_0x47eb8e(_0x129024);});});} \ No newline at end of file +var _0xf8cf=['message','info','result','catch','util','bluebird','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','request\x20sent','debug','FreshdeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','FreshdeskField,\x20%s,\x20%s'];(function(_0x494aa6,_0x403818){var _0x4b1be6=function(_0x36ed7c){while(--_0x36ed7c){_0x494aa6['push'](_0x494aa6['shift']());}};_0x4b1be6(++_0x403818);}(_0xf8cf,0x17e));var _0xff8c=function(_0xbb24cf,_0x5042df){_0xbb24cf=_0xbb24cf-0x0;var _0x3187c0=_0xf8cf[_0xbb24cf];return _0x3187c0;};'use strict';var _=require('lodash');var util=require(_0xff8c('0x0'));var moment=require('moment');var BPromise=require(_0xff8c('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xff8c('0x2'));var logger=require(_0xff8c('0x3'))(_0xff8c('0x4'));var config=require(_0xff8c('0x5'));var jayson=require('jayson/promise');var client=jayson[_0xff8c('0x6')][_0xff8c('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x1d4585,_0x5217be,_0x1e74ef){return new BPromise(function(_0x58e13b,_0x24cb63){return client[_0xff8c('0x8')](_0x1d4585,_0x1e74ef)[_0xff8c('0x9')](function(_0x5b8b30){logger['info']('FreshdeskField,\x20%s,\x20%s',_0x5217be,_0xff8c('0xa'));logger[_0xff8c('0xb')](_0xff8c('0xc'),_0x5217be,_0xff8c('0xa'),JSON[_0xff8c('0xd')](_0x5b8b30));if(_0x5b8b30['error']){if(_0x5b8b30[_0xff8c('0xe')][_0xff8c('0xf')]===0x1f4){logger['error'](_0xff8c('0x10'),_0x5217be,_0x5b8b30['error'][_0xff8c('0x11')]);return _0x24cb63(_0x5b8b30[_0xff8c('0xe')][_0xff8c('0x11')]);}logger[_0xff8c('0xe')](_0xff8c('0x10'),_0x5217be,_0x5b8b30[_0xff8c('0xe')][_0xff8c('0x11')]);return _0x58e13b(_0x5b8b30[_0xff8c('0xe')][_0xff8c('0x11')]);}else{logger[_0xff8c('0x12')]('FreshdeskField,\x20%s,\x20%s',_0x5217be,'request\x20sent');_0x58e13b(_0x5b8b30[_0xff8c('0x13')][_0xff8c('0x11')]);}})[_0xff8c('0x14')](function(_0x2e92bc){logger['error'](_0xff8c('0x10'),_0x5217be,_0x2e92bc);_0x24cb63(_0x2e92bc);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/index.js b/server/api/intFreshsalesAccount/index.js index 136ea18..ed191f5 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 _0x7072=['put','update','destroy','exports','util','path','connect-timeout','express','Router','../../components/interaction/service','./intFreshsalesAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','/:id/fields','getFields','post','create','addConfiguration'];(function(_0x493621,_0x244aa6){var _0x328237=function(_0x5632dc){while(--_0x5632dc){_0x493621['push'](_0x493621['shift']());}};_0x328237(++_0x244aa6);}(_0x7072,0x138));var _0x2707=function(_0x2e4aa2,_0x11956a){_0x2e4aa2=_0x2e4aa2-0x0;var _0x5e6092=_0x7072[_0x2e4aa2];return _0x5e6092;};'use strict';var multer=require('multer');var util=require(_0x2707('0x0'));var path=require(_0x2707('0x1'));var timeout=require(_0x2707('0x2'));var express=require(_0x2707('0x3'));var router=express[_0x2707('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x2707('0x5'));var config=require('../../config/environment');var controller=require(_0x2707('0x6'));router[_0x2707('0x7')]('/',auth[_0x2707('0x8')](),controller[_0x2707('0x9')]);router[_0x2707('0x7')](_0x2707('0xa'),auth[_0x2707('0x8')](),controller[_0x2707('0xb')]);router[_0x2707('0x7')](_0x2707('0xc'),auth['isAuthenticated'](),controller['getConfigurations']);router[_0x2707('0x7')](_0x2707('0xd'),auth[_0x2707('0x8')](),controller[_0x2707('0xe')]);router[_0x2707('0xf')]('/',auth[_0x2707('0x8')](),controller[_0x2707('0x10')]);router[_0x2707('0xf')](_0x2707('0xc'),auth[_0x2707('0x8')](),controller[_0x2707('0x11')]);router[_0x2707('0x12')](_0x2707('0xa'),auth['isAuthenticated'](),controller[_0x2707('0x13')]);router['delete'](_0x2707('0xa'),auth[_0x2707('0x8')](),controller[_0x2707('0x14')]);module[_0x2707('0x15')]=router; \ No newline at end of file +var _0x6b20=['destroy','exports','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./intFreshsalesAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','post','addConfiguration','put','update','delete'];(function(_0x545fe3,_0x3b191f){var _0x480702=function(_0x21c970){while(--_0x21c970){_0x545fe3['push'](_0x545fe3['shift']());}};_0x480702(++_0x3b191f);}(_0x6b20,0xd1));var _0x06b2=function(_0x40a32d,_0x1a8012){_0x40a32d=_0x40a32d-0x0;var _0x39d2e6=_0x6b20[_0x40a32d];return _0x39d2e6;};'use strict';var multer=require(_0x06b2('0x0'));var util=require(_0x06b2('0x1'));var path=require('path');var timeout=require(_0x06b2('0x2'));var express=require('express');var router=express[_0x06b2('0x3')]();var fs_extra=require(_0x06b2('0x4'));var auth=require(_0x06b2('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x06b2('0x6'));var controller=require(_0x06b2('0x7'));router[_0x06b2('0x8')]('/',auth[_0x06b2('0x9')](),controller[_0x06b2('0xa')]);router[_0x06b2('0x8')](_0x06b2('0xb'),auth['isAuthenticated'](),controller[_0x06b2('0xc')]);router[_0x06b2('0x8')](_0x06b2('0xd'),auth['isAuthenticated'](),controller[_0x06b2('0xe')]);router['get'](_0x06b2('0xf'),auth['isAuthenticated'](),controller['getFields']);router[_0x06b2('0x10')]('/',auth[_0x06b2('0x9')](),controller['create']);router[_0x06b2('0x10')](_0x06b2('0xd'),auth[_0x06b2('0x9')](),controller[_0x06b2('0x11')]);router[_0x06b2('0x12')](_0x06b2('0xb'),auth[_0x06b2('0x9')](),controller[_0x06b2('0x13')]);router[_0x06b2('0x14')](_0x06b2('0xb'),auth[_0x06b2('0x9')](),controller[_0x06b2('0x15')]);module[_0x06b2('0x16')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js index 7327ebd..0560805 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 _0x4b17=['username','sequelize','STRING'];(function(_0x3a3f11,_0x63966){var _0x45ebc4=function(_0x301dba){while(--_0x301dba){_0x3a3f11['push'](_0x3a3f11['shift']());}};_0x45ebc4(++_0x63966);}(_0x4b17,0x10f));var _0x74b1=function(_0x20845e,_0x211e78){_0x20845e=_0x20845e-0x0;var _0x28cf2b=_0x4b17[_0x20845e];return _0x28cf2b;};'use strict';var Sequelize=require(_0x74b1('0x0'));module['exports']={'name':{'type':Sequelize[_0x74b1('0x1')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x74b1('0x1')],'unique':_0x74b1('0x2')},'apiKey':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x74b1('0x1')],'unique':'remoteUri'},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file +var _0xf2e3=['STRING','username','remoteUri','sequelize'];(function(_0x19d24c,_0x62bc50){var _0x2fae8d=function(_0x419856){while(--_0x419856){_0x19d24c['push'](_0x19d24c['shift']());}};_0x2fae8d(++_0x62bc50);}(_0xf2e3,0x9b));var _0x3f2e=function(_0x4a53d,_0x58a95e){_0x4a53d=_0x4a53d-0x0;var _0x27410e=_0xf2e3[_0x4a53d];return _0x27410e;};'use strict';var Sequelize=require(_0x3f2e('0x0'));module['exports']={'name':{'type':Sequelize[_0x3f2e('0x1')]},'description':{'type':Sequelize[_0x3f2e('0x1')]},'username':{'type':Sequelize[_0x3f2e('0x1')],'unique':_0x3f2e('0x2')},'apiKey':{'type':Sequelize[_0x3f2e('0x1')]},'remoteUri':{'type':Sequelize[_0x3f2e('0x1')],'unique':_0x3f2e('0x3')},'serverUrl':{'type':Sequelize[_0x3f2e('0x1')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js index ee44590..ec548d3 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 _0xdf58=['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','../../mysqldb','sendStatus','status','offset','undefined','limit','count','set','json','update','then','end','error','stack','name','map','rawAttributes','fieldName','key','model','keys','filters','intersection','query','fields','attributes','length','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','FreshsalesAccount','findAll','rows','catch','include','find','create','body','params','options','getConfigurations','hasOwnProperty','addConfiguration','AccountId','Subjects','getSubjects','Descriptions','getDescriptions','channel','apiKey','username','remoteUri','substring','lastIndexOf','GET','format','%s%s','/api/selector/owners','users','Requested\x20Resource\x20not\x20Found','getFields,\x20%s,\x20%s,\x20%s','stringify','send','test','statusCode','eml-format','fast-json-patch','moment','bluebird','mustache','util'];(function(_0x540388,_0x2cdc72){var _0x45bdd1=function(_0x4f3e78){while(--_0x4f3e78){_0x540388['push'](_0x540388['shift']());}};_0x45bdd1(++_0x2cdc72);}(_0xdf58,0x17a));var _0x8df5=function(_0x5e8538,_0x5b5b88){_0x5e8538=_0x5e8538-0x0;var _0x14b5ee=_0xdf58[_0x5e8538];return _0x14b5ee;};'use strict';var emlformat=require(_0x8df5('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x8df5('0x1'));var rp=require('request-promise');var moment=require(_0x8df5('0x2'));var BPromise=require(_0x8df5('0x3'));var Mustache=require(_0x8df5('0x4'));var util=require(_0x8df5('0x5'));var path=require(_0x8df5('0x6'));var sox=require(_0x8df5('0x7'));var csv=require(_0x8df5('0x8'));var ejs=require(_0x8df5('0x9'));var fs=require('fs');var fs_extra=require(_0x8df5('0xa'));var _=require(_0x8df5('0xb'));var squel=require(_0x8df5('0xc'));var crypto=require(_0x8df5('0xd'));var jsforce=require(_0x8df5('0xe'));var deskjs=require(_0x8df5('0xf'));var toCsv=require(_0x8df5('0x8'));var querystring=require(_0x8df5('0x10'));var Papa=require(_0x8df5('0x11'));var Redis=require(_0x8df5('0x12'));var authService=require(_0x8df5('0x13'));var qs=require(_0x8df5('0x14'));var as=require(_0x8df5('0x15'));var hardwareService=require(_0x8df5('0x16'));var logger=require(_0x8df5('0x17'))(_0x8df5('0x18'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x8df5('0x19'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x2c93a8,_0x57adf4){_0x57adf4=_0x57adf4||0xcc;return function(_0x2e09b2){if(_0x2e09b2){return _0x2c93a8[_0x8df5('0x1a')](_0x57adf4);}return _0x2c93a8[_0x8df5('0x1b')](_0x57adf4)['end']();};}function respondWithResult(_0x209805,_0x535892){_0x535892=_0x535892||0xc8;return function(_0x4b25b9){if(_0x4b25b9){return _0x209805[_0x8df5('0x1b')](_0x535892)['json'](_0x4b25b9);}};}function respondWithFilteredResult(_0x104926,_0x28b112){return function(_0x3fe5fe){if(_0x3fe5fe){var _0xd5317c=typeof _0x28b112[_0x8df5('0x1c')]===_0x8df5('0x1d')&&typeof _0x28b112[_0x8df5('0x1e')]==='undefined';var _0x1ac302=_0x3fe5fe[_0x8df5('0x1f')];var _0x12fa9a=_0xd5317c?0x0:_0x28b112[_0x8df5('0x1c')];var _0x92333f=_0xd5317c?_0x3fe5fe[_0x8df5('0x1f')]:_0x28b112['offset']+_0x28b112[_0x8df5('0x1e')];var _0x1a1dab;if(_0x92333f>=_0x1ac302){_0x92333f=_0x1ac302;_0x1a1dab=0xc8;}else{_0x1a1dab=0xce;}_0x104926[_0x8df5('0x1b')](_0x1a1dab);return _0x104926[_0x8df5('0x20')]('Content-Range',_0x12fa9a+'-'+_0x92333f+'/'+_0x1ac302)[_0x8df5('0x21')](_0x3fe5fe);}return null;};}function patchUpdates(_0x39e3c){return function(_0x4d8dcd){try{jsonpatch['apply'](_0x4d8dcd,_0x39e3c,!![]);}catch(_0x15c11a){return BPromise['reject'](_0x15c11a);}return _0x4d8dcd['save']();};}function saveUpdates(_0x27fbc3,_0x1a69f3){return function(_0x5a17c3){if(_0x5a17c3){return _0x5a17c3[_0x8df5('0x22')](_0x27fbc3)[_0x8df5('0x23')](function(_0x4d9a9d){return _0x4d9a9d;});}return null;};}function removeEntity(_0x487518,_0xddd647){return function(_0x5e5043){if(_0x5e5043){return _0x5e5043['destroy']()[_0x8df5('0x23')](function(){_0x487518[_0x8df5('0x1b')](0xcc)[_0x8df5('0x24')]();});}};}function handleEntityNotFound(_0x3454b1,_0x401882){return function(_0x5c01de){if(!_0x5c01de){_0x3454b1['sendStatus'](0x194);}return _0x5c01de;};}function handleError(_0x584072,_0x5d0706){_0x5d0706=_0x5d0706||0x1f4;return function(_0x401aaf){logger[_0x8df5('0x25')](_0x401aaf[_0x8df5('0x26')]);if(_0x401aaf[_0x8df5('0x27')]){delete _0x401aaf[_0x8df5('0x27')];}_0x584072['status'](_0x5d0706)['send'](_0x401aaf);};}exports['index']=function(_0x5bb727,_0x35756d){var _0x34b33f={},_0x5cdbc4={},_0xafbfc={'count':0x0,'rows':[]};var _0x504282=_[_0x8df5('0x28')](db['FreshsalesAccount'][_0x8df5('0x29')],function(_0xb5b704){return{'name':_0xb5b704[_0x8df5('0x2a')],'type':_0xb5b704['type'][_0x8df5('0x2b')]};});_0x5cdbc4[_0x8df5('0x2c')]=_['map'](_0x504282,_0x8df5('0x27'));_0x5cdbc4['query']=_[_0x8df5('0x2d')](_0x5bb727['query']);_0x5cdbc4[_0x8df5('0x2e')]=_[_0x8df5('0x2f')](_0x5cdbc4['model'],_0x5cdbc4[_0x8df5('0x30')]);_0x34b33f['attributes']=_[_0x8df5('0x2f')](_0x5cdbc4[_0x8df5('0x2c')],qs[_0x8df5('0x31')](_0x5bb727[_0x8df5('0x30')][_0x8df5('0x31')]));_0x34b33f[_0x8df5('0x32')]=_0x34b33f[_0x8df5('0x32')][_0x8df5('0x33')]?_0x34b33f[_0x8df5('0x32')]:_0x5cdbc4[_0x8df5('0x2c')];if(!_0x5bb727['query']['hasOwnProperty'](_0x8df5('0x34'))){_0x34b33f['limit']=qs[_0x8df5('0x1e')](_0x5bb727['query']['limit']);_0x34b33f[_0x8df5('0x1c')]=qs[_0x8df5('0x1c')](_0x5bb727['query'][_0x8df5('0x1c')]);}_0x34b33f[_0x8df5('0x35')]=qs[_0x8df5('0x36')](_0x5bb727[_0x8df5('0x30')][_0x8df5('0x36')]);_0x34b33f[_0x8df5('0x37')]=qs[_0x8df5('0x2e')](_[_0x8df5('0x38')](_0x5bb727['query'],_0x5cdbc4[_0x8df5('0x2e')]),_0x504282);if(_0x5bb727[_0x8df5('0x30')][_0x8df5('0x39')]){_0x34b33f[_0x8df5('0x37')]=_[_0x8df5('0x3a')](_0x34b33f['where'],{'$or':_[_0x8df5('0x28')](_0x504282,function(_0x57f2c7){if(_0x57f2c7[_0x8df5('0x3b')]!==_0x8df5('0x3c')){var _0x19d058={};_0x19d058[_0x57f2c7[_0x8df5('0x27')]]={'$like':'%'+_0x5bb727[_0x8df5('0x30')]['filter']+'%'};return _0x19d058;}})});}_0x34b33f=_[_0x8df5('0x3a')]({},_0x34b33f,_0x5bb727['options']);var _0x587f51={'where':_0x34b33f[_0x8df5('0x37')]};return db[_0x8df5('0x3d')][_0x8df5('0x1f')](_0x587f51)[_0x8df5('0x23')](function(_0x481c8b){_0xafbfc[_0x8df5('0x1f')]=_0x481c8b;if(_0x5bb727[_0x8df5('0x30')]['includeAll']){_0x34b33f['include']=[{'all':!![]}];}return db[_0x8df5('0x3d')][_0x8df5('0x3e')](_0x34b33f);})[_0x8df5('0x23')](function(_0x4b3c64){_0xafbfc[_0x8df5('0x3f')]=_0x4b3c64;return _0xafbfc;})[_0x8df5('0x23')](respondWithFilteredResult(_0x35756d,_0x34b33f))[_0x8df5('0x40')](handleError(_0x35756d,null));};exports['show']=function(_0x702d92,_0x16311b){var _0x494195={'raw':![],'where':{'id':_0x702d92['params']['id']}},_0xd6edb8={};_0xd6edb8[_0x8df5('0x2c')]=_[_0x8df5('0x2d')](db['FreshsalesAccount']['rawAttributes']);_0xd6edb8['query']=_[_0x8df5('0x2d')](_0x702d92[_0x8df5('0x30')]);_0xd6edb8[_0x8df5('0x2e')]=_['intersection'](_0xd6edb8[_0x8df5('0x2c')],_0xd6edb8[_0x8df5('0x30')]);_0x494195[_0x8df5('0x32')]=_[_0x8df5('0x2f')](_0xd6edb8[_0x8df5('0x2c')],qs['fields'](_0x702d92['query'][_0x8df5('0x31')]));_0x494195[_0x8df5('0x32')]=_0x494195['attributes'][_0x8df5('0x33')]?_0x494195['attributes']:_0xd6edb8[_0x8df5('0x2c')];if(_0x702d92[_0x8df5('0x30')]['includeAll']){_0x494195[_0x8df5('0x41')]=[{'all':!![]}];}_0x494195=_['merge']({},_0x494195,_0x702d92['options']);return db[_0x8df5('0x3d')][_0x8df5('0x42')](_0x494195)['then'](handleEntityNotFound(_0x16311b,null))[_0x8df5('0x23')](respondWithResult(_0x16311b,null))[_0x8df5('0x40')](handleError(_0x16311b,null));};exports[_0x8df5('0x43')]=function(_0x1292ef,_0x19a376){return db['FreshsalesAccount']['create'](_0x1292ef[_0x8df5('0x44')],{})[_0x8df5('0x23')](respondWithResult(_0x19a376,0xc9))[_0x8df5('0x40')](handleError(_0x19a376,null));};exports[_0x8df5('0x22')]=function(_0x289c9d,_0x584378){if(_0x289c9d['body']['id']){delete _0x289c9d['body']['id'];}return db['FreshsalesAccount'][_0x8df5('0x42')]({'where':{'id':_0x289c9d[_0x8df5('0x45')]['id']}})[_0x8df5('0x23')](handleEntityNotFound(_0x584378,null))[_0x8df5('0x23')](saveUpdates(_0x289c9d[_0x8df5('0x44')],null))[_0x8df5('0x23')](respondWithResult(_0x584378,null))[_0x8df5('0x40')](handleError(_0x584378,null));};exports['destroy']=function(_0x3d7774,_0x5d6d78){return db[_0x8df5('0x3d')][_0x8df5('0x42')]({'where':{'id':_0x3d7774[_0x8df5('0x45')]['id']}})[_0x8df5('0x23')](handleEntityNotFound(_0x5d6d78,null))[_0x8df5('0x23')](removeEntity(_0x5d6d78,null))[_0x8df5('0x40')](handleError(_0x5d6d78,null));};exports['getConfigurations']=function(_0x46bd77,_0x77f1c9,_0x275e29){var _0x1d1872={};var _0x5b4750={};var _0x5307d4;var _0x382220;return db[_0x8df5('0x3d')]['findOne']({'where':{'id':_0x46bd77[_0x8df5('0x45')]['id']}})['then'](handleEntityNotFound(_0x77f1c9,null))['then'](function(_0xda4534){if(_0xda4534){_0x5307d4=_0xda4534;_0x5b4750[_0x8df5('0x2c')]=_[_0x8df5('0x2d')](db['FreshsalesConfiguration'][_0x8df5('0x29')]);_0x5b4750[_0x8df5('0x30')]=_[_0x8df5('0x2d')](_0x46bd77['query']);_0x5b4750[_0x8df5('0x2e')]=_[_0x8df5('0x2f')](_0x5b4750[_0x8df5('0x2c')],_0x5b4750['query']);_0x1d1872[_0x8df5('0x32')]=_['intersection'](_0x5b4750[_0x8df5('0x2c')],qs['fields'](_0x46bd77[_0x8df5('0x30')][_0x8df5('0x31')]));_0x1d1872[_0x8df5('0x32')]=_0x1d1872[_0x8df5('0x32')][_0x8df5('0x33')]?_0x1d1872[_0x8df5('0x32')]:_0x5b4750[_0x8df5('0x2c')];_0x1d1872[_0x8df5('0x35')]=qs['sort'](_0x46bd77[_0x8df5('0x30')][_0x8df5('0x36')]);_0x1d1872[_0x8df5('0x37')]=qs['filters'](_[_0x8df5('0x38')](_0x46bd77['query'],_0x5b4750[_0x8df5('0x2e')]));if(_0x46bd77[_0x8df5('0x30')][_0x8df5('0x39')]){_0x1d1872[_0x8df5('0x37')]=_['merge'](_0x1d1872[_0x8df5('0x37')],{'$or':_['map'](_0x1d1872[_0x8df5('0x32')],function(_0x56d94d){var _0x11d35e={};_0x11d35e[_0x56d94d]={'$like':'%'+_0x46bd77['query'][_0x8df5('0x39')]+'%'};return _0x11d35e;})});}_0x1d1872=_['merge']({},_0x1d1872,_0x46bd77[_0x8df5('0x46')]);return _0x5307d4[_0x8df5('0x47')](_0x1d1872);}})[_0x8df5('0x23')](function(_0x2c6a6a){if(_0x2c6a6a){_0x382220=_0x2c6a6a[_0x8df5('0x33')];if(!_0x46bd77[_0x8df5('0x30')][_0x8df5('0x48')](_0x8df5('0x34'))){_0x1d1872[_0x8df5('0x1e')]=qs[_0x8df5('0x1e')](_0x46bd77[_0x8df5('0x30')][_0x8df5('0x1e')]);_0x1d1872[_0x8df5('0x1c')]=qs[_0x8df5('0x1c')](_0x46bd77[_0x8df5('0x30')][_0x8df5('0x1c')]);}return _0x5307d4[_0x8df5('0x47')](_0x1d1872);}})[_0x8df5('0x23')](function(_0x512918){if(_0x512918){return _0x512918?{'count':_0x382220,'rows':_0x512918}:null;}})[_0x8df5('0x23')](respondWithResult(_0x77f1c9,null))[_0x8df5('0x40')](handleError(_0x77f1c9,null));};exports[_0x8df5('0x49')]=function(_0x34fdd3,_0x39b591,_0x537cf1){if(_0x34fdd3[_0x8df5('0x44')]['id']){delete _0x34fdd3[_0x8df5('0x44')]['id'];}return db[_0x8df5('0x3d')]['findOne']({'where':{'id':_0x34fdd3[_0x8df5('0x45')]['id']}})[_0x8df5('0x23')](handleEntityNotFound(_0x39b591,null))['then'](function(_0x2cdd2b){if(_0x2cdd2b){_0x34fdd3['body'][_0x8df5('0x4a')]=_0x2cdd2b['id'];_0x34fdd3[_0x8df5('0x44')][_0x8df5('0x4b')]=integrations[_0x8df5('0x4c')](_0x34fdd3[_0x8df5('0x44')]['channel'],_0x34fdd3['body'][_0x8df5('0x3b')]);_0x34fdd3['body'][_0x8df5('0x4d')]=integrations[_0x8df5('0x4e')](_0x34fdd3[_0x8df5('0x44')][_0x8df5('0x4f')],_0x34fdd3[_0x8df5('0x44')][_0x8df5('0x3b')]);return db['FreshsalesConfiguration'][_0x8df5('0x43')](_0x34fdd3[_0x8df5('0x44')],{'include':[{'model':db['FreshsalesField'],'as':_0x8df5('0x4b')},{'model':db['FreshsalesField'],'as':_0x8df5('0x4d')}]});}return null;})[_0x8df5('0x23')](respondWithResult(_0x39b591,null))[_0x8df5('0x40')](handleError(_0x39b591,null));};exports['getFields']=function(_0x3ba083,_0x50b86e,_0x227c0e){var _0x44b2c3='';var _0x59ec79='';return db['FreshsalesAccount']['findOne']({'where':{'id':_0x3ba083[_0x8df5('0x45')]['id']},'attributes':['id','username','remoteUri',_0x8df5('0x50')]})[_0x8df5('0x23')](handleEntityNotFound(_0x50b86e,null))[_0x8df5('0x23')](function(_0x1cdc07){if(_0x1cdc07){_0x59ec79=_0x1cdc07[_0x8df5('0x51')];_0x44b2c3=_0x1cdc07[_0x8df5('0x52')];var _0x4f9973=_0x1cdc07['remoteUri']['slice'](-0x1);if(_0x4f9973==='/'){_0x44b2c3=_0x44b2c3[_0x8df5('0x53')](0x0,_0x44b2c3[_0x8df5('0x54')](_0x4f9973));}return rp({'method':_0x8df5('0x55'),'uri':util[_0x8df5('0x56')](_0x8df5('0x57'),_0x44b2c3,_0x8df5('0x58')),'headers':{'Authorization':'Token\x20token='+_0x1cdc07[_0x8df5('0x50')]},'json':!![]});}})[_0x8df5('0x23')](function(_0x505b69){if(_0x505b69){var _0x2ee167=_0x505b69[_0x8df5('0x59')];var _0x2aa468=![];var _0x252ee9=null;for(_0x252ee9=0x0;_0x252ee9<_0x2ee167[_0x8df5('0x33')];_0x252ee9++){if(_0x2ee167[_0x252ee9]['email']===_0x59ec79){_0x2aa468=!![];}}if(_0x2aa468){return!![];}else{throw new Error({'statusCode':0x194,'message':_0x8df5('0x5a')});}}})[_0x8df5('0x23')](respondWithResult(_0x50b86e,null))[_0x8df5('0x40')](function(_0x1839d1){var _0x316550=_0x3ba083[_0x8df5('0x30')]['test']?0x1f4:_0x1839d1['statusCode']||0x1f4;logger['error'](_0x8df5('0x5b'),'getFields',_0x316550,JSON[_0x8df5('0x5c')](_0x1839d1));delete _0x1839d1[_0x8df5('0x27')];if(_0x316550===0x191){_0x316550=0x190;}_0x50b86e['status'](_0x316550)[_0x8df5('0x5d')](_0x3ba083[_0x8df5('0x30')][_0x8df5('0x5e')]?{'message':'Wrong\x20credentials','statusCode':_0x1839d1[_0x8df5('0x5f')]}:_0x1839d1);});}; \ No newline at end of file +var _0xd302=['update','body','destroy','getConfigurations','findOne','FreshsalesConfiguration','order','nolimit','AccountId','getSubjects','channel','Descriptions','getDescriptions','Subjects','FreshsalesField','getFields','username','apiKey','remoteUri','slice','substring','lastIndexOf','GET','format','%s%s','/api/selector/owners','Token\x20token=','users','Requested\x20Resource\x20not\x20Found','statusCode','stringify','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','save','then','end','error','name','send','index','map','FreshsalesAccount','rawAttributes','fieldName','type','key','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','sort','where','filters','pick','filter','merge','options','includeAll','include','findAll','rows','catch','params','find','create'];(function(_0x24fa83,_0x4df1a8){var _0x520fd3=function(_0x7c12f1){while(--_0x7c12f1){_0x24fa83['push'](_0x24fa83['shift']());}};_0x520fd3(++_0x4df1a8);}(_0xd302,0x86));var _0x2d30=function(_0x201508,_0x41dc66){_0x201508=_0x201508-0x0;var _0x121f89=_0xd302[_0x201508];return _0x121f89;};'use strict';var emlformat=require(_0x2d30('0x0'));var rimraf=require(_0x2d30('0x1'));var zipdir=require(_0x2d30('0x2'));var jsonpatch=require(_0x2d30('0x3'));var rp=require(_0x2d30('0x4'));var moment=require(_0x2d30('0x5'));var BPromise=require(_0x2d30('0x6'));var Mustache=require(_0x2d30('0x7'));var util=require('util');var path=require('path');var sox=require(_0x2d30('0x8'));var csv=require('to-csv');var ejs=require(_0x2d30('0x9'));var fs=require('fs');var fs_extra=require(_0x2d30('0xa'));var _=require(_0x2d30('0xb'));var squel=require(_0x2d30('0xc'));var crypto=require(_0x2d30('0xd'));var jsforce=require(_0x2d30('0xe'));var deskjs=require(_0x2d30('0xf'));var toCsv=require(_0x2d30('0x10'));var querystring=require(_0x2d30('0x11'));var Papa=require(_0x2d30('0x12'));var Redis=require(_0x2d30('0x13'));var authService=require(_0x2d30('0x14'));var qs=require(_0x2d30('0x15'));var as=require(_0x2d30('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x2d30('0x17'));var config=require(_0x2d30('0x18'));var licenseUtil=require(_0x2d30('0x19'));var db=require(_0x2d30('0x1a'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x409375,_0x5a463b){_0x5a463b=_0x5a463b||0xcc;return function(_0x18daeb){if(_0x18daeb){return _0x409375[_0x2d30('0x1b')](_0x5a463b);}return _0x409375[_0x2d30('0x1c')](_0x5a463b)['end']();};}function respondWithResult(_0x4e20cc,_0x2378f3){_0x2378f3=_0x2378f3||0xc8;return function(_0x1db79f){if(_0x1db79f){return _0x4e20cc['status'](_0x2378f3)[_0x2d30('0x1d')](_0x1db79f);}};}function respondWithFilteredResult(_0x5da9c1,_0x5e7bbd){return function(_0x30583b){if(_0x30583b){var _0x31949e=typeof _0x5e7bbd[_0x2d30('0x1e')]===_0x2d30('0x1f')&&typeof _0x5e7bbd[_0x2d30('0x20')]===_0x2d30('0x1f');var _0x24467d=_0x30583b[_0x2d30('0x21')];var _0xeeac69=_0x31949e?0x0:_0x5e7bbd[_0x2d30('0x1e')];var _0x432273=_0x31949e?_0x30583b['count']:_0x5e7bbd['offset']+_0x5e7bbd['limit'];var _0x47e27a;if(_0x432273>=_0x24467d){_0x432273=_0x24467d;_0x47e27a=0xc8;}else{_0x47e27a=0xce;}_0x5da9c1[_0x2d30('0x1c')](_0x47e27a);return _0x5da9c1['set']('Content-Range',_0xeeac69+'-'+_0x432273+'/'+_0x24467d)[_0x2d30('0x1d')](_0x30583b);}return null;};}function patchUpdates(_0x45e7bc){return function(_0x5921aa){try{jsonpatch['apply'](_0x5921aa,_0x45e7bc,!![]);}catch(_0x3f66af){return BPromise['reject'](_0x3f66af);}return _0x5921aa[_0x2d30('0x22')]();};}function saveUpdates(_0xb54862,_0x3ce753){return function(_0x51f103){if(_0x51f103){return _0x51f103['update'](_0xb54862)[_0x2d30('0x23')](function(_0x17bcd5){return _0x17bcd5;});}return null;};}function removeEntity(_0x48c847,_0x1e61c7){return function(_0x1b269f){if(_0x1b269f){return _0x1b269f['destroy']()['then'](function(){_0x48c847[_0x2d30('0x1c')](0xcc)[_0x2d30('0x24')]();});}};}function handleEntityNotFound(_0x5e7103,_0x54caf3){return function(_0x2f8a3b){if(!_0x2f8a3b){_0x5e7103[_0x2d30('0x1b')](0x194);}return _0x2f8a3b;};}function handleError(_0x3725d1,_0x3cb765){_0x3cb765=_0x3cb765||0x1f4;return function(_0x519134){logger[_0x2d30('0x25')](_0x519134['stack']);if(_0x519134[_0x2d30('0x26')]){delete _0x519134[_0x2d30('0x26')];}_0x3725d1[_0x2d30('0x1c')](_0x3cb765)[_0x2d30('0x27')](_0x519134);};}exports[_0x2d30('0x28')]=function(_0x467da0,_0x4af477){var _0x10c58c={},_0x420d2f={},_0x571433={'count':0x0,'rows':[]};var _0x215205=_[_0x2d30('0x29')](db[_0x2d30('0x2a')][_0x2d30('0x2b')],function(_0x139945){return{'name':_0x139945[_0x2d30('0x2c')],'type':_0x139945[_0x2d30('0x2d')][_0x2d30('0x2e')]};});_0x420d2f[_0x2d30('0x2f')]=_['map'](_0x215205,'name');_0x420d2f[_0x2d30('0x30')]=_[_0x2d30('0x31')](_0x467da0[_0x2d30('0x30')]);_0x420d2f['filters']=_['intersection'](_0x420d2f[_0x2d30('0x2f')],_0x420d2f[_0x2d30('0x30')]);_0x10c58c[_0x2d30('0x32')]=_[_0x2d30('0x33')](_0x420d2f[_0x2d30('0x2f')],qs['fields'](_0x467da0[_0x2d30('0x30')][_0x2d30('0x34')]));_0x10c58c[_0x2d30('0x32')]=_0x10c58c[_0x2d30('0x32')][_0x2d30('0x35')]?_0x10c58c[_0x2d30('0x32')]:_0x420d2f['model'];if(!_0x467da0[_0x2d30('0x30')][_0x2d30('0x36')]('nolimit')){_0x10c58c[_0x2d30('0x20')]=qs[_0x2d30('0x20')](_0x467da0[_0x2d30('0x30')][_0x2d30('0x20')]);_0x10c58c[_0x2d30('0x1e')]=qs[_0x2d30('0x1e')](_0x467da0['query'][_0x2d30('0x1e')]);}_0x10c58c['order']=qs['sort'](_0x467da0[_0x2d30('0x30')][_0x2d30('0x37')]);_0x10c58c[_0x2d30('0x38')]=qs[_0x2d30('0x39')](_[_0x2d30('0x3a')](_0x467da0[_0x2d30('0x30')],_0x420d2f[_0x2d30('0x39')]),_0x215205);if(_0x467da0[_0x2d30('0x30')][_0x2d30('0x3b')]){_0x10c58c['where']=_[_0x2d30('0x3c')](_0x10c58c[_0x2d30('0x38')],{'$or':_[_0x2d30('0x29')](_0x215205,function(_0x52075a){if(_0x52075a[_0x2d30('0x2d')]!=='VIRTUAL'){var _0x1bd90f={};_0x1bd90f[_0x52075a[_0x2d30('0x26')]]={'$like':'%'+_0x467da0[_0x2d30('0x30')][_0x2d30('0x3b')]+'%'};return _0x1bd90f;}})});}_0x10c58c=_['merge']({},_0x10c58c,_0x467da0[_0x2d30('0x3d')]);var _0x4cd764={'where':_0x10c58c['where']};return db[_0x2d30('0x2a')][_0x2d30('0x21')](_0x4cd764)[_0x2d30('0x23')](function(_0x39e711){_0x571433[_0x2d30('0x21')]=_0x39e711;if(_0x467da0['query'][_0x2d30('0x3e')]){_0x10c58c[_0x2d30('0x3f')]=[{'all':!![]}];}return db[_0x2d30('0x2a')][_0x2d30('0x40')](_0x10c58c);})[_0x2d30('0x23')](function(_0x3d43a6){_0x571433[_0x2d30('0x41')]=_0x3d43a6;return _0x571433;})[_0x2d30('0x23')](respondWithFilteredResult(_0x4af477,_0x10c58c))[_0x2d30('0x42')](handleError(_0x4af477,null));};exports['show']=function(_0x1bbd3d,_0x179dba){var _0x3b7342={'raw':![],'where':{'id':_0x1bbd3d[_0x2d30('0x43')]['id']}},_0x5dfa66={};_0x5dfa66[_0x2d30('0x2f')]=_[_0x2d30('0x31')](db[_0x2d30('0x2a')][_0x2d30('0x2b')]);_0x5dfa66[_0x2d30('0x30')]=_[_0x2d30('0x31')](_0x1bbd3d[_0x2d30('0x30')]);_0x5dfa66[_0x2d30('0x39')]=_[_0x2d30('0x33')](_0x5dfa66[_0x2d30('0x2f')],_0x5dfa66[_0x2d30('0x30')]);_0x3b7342[_0x2d30('0x32')]=_[_0x2d30('0x33')](_0x5dfa66[_0x2d30('0x2f')],qs[_0x2d30('0x34')](_0x1bbd3d[_0x2d30('0x30')][_0x2d30('0x34')]));_0x3b7342[_0x2d30('0x32')]=_0x3b7342[_0x2d30('0x32')][_0x2d30('0x35')]?_0x3b7342[_0x2d30('0x32')]:_0x5dfa66[_0x2d30('0x2f')];if(_0x1bbd3d[_0x2d30('0x30')][_0x2d30('0x3e')]){_0x3b7342[_0x2d30('0x3f')]=[{'all':!![]}];}_0x3b7342=_[_0x2d30('0x3c')]({},_0x3b7342,_0x1bbd3d[_0x2d30('0x3d')]);return db[_0x2d30('0x2a')][_0x2d30('0x44')](_0x3b7342)[_0x2d30('0x23')](handleEntityNotFound(_0x179dba,null))['then'](respondWithResult(_0x179dba,null))['catch'](handleError(_0x179dba,null));};exports[_0x2d30('0x45')]=function(_0x3f153b,_0x481ec3){return db[_0x2d30('0x2a')][_0x2d30('0x45')](_0x3f153b['body'],{})[_0x2d30('0x23')](respondWithResult(_0x481ec3,0xc9))[_0x2d30('0x42')](handleError(_0x481ec3,null));};exports[_0x2d30('0x46')]=function(_0x20985f,_0x41c57d){if(_0x20985f[_0x2d30('0x47')]['id']){delete _0x20985f[_0x2d30('0x47')]['id'];}return db['FreshsalesAccount'][_0x2d30('0x44')]({'where':{'id':_0x20985f['params']['id']}})['then'](handleEntityNotFound(_0x41c57d,null))[_0x2d30('0x23')](saveUpdates(_0x20985f[_0x2d30('0x47')],null))[_0x2d30('0x23')](respondWithResult(_0x41c57d,null))['catch'](handleError(_0x41c57d,null));};exports[_0x2d30('0x48')]=function(_0x1f7b9a,_0x466dc2){return db['FreshsalesAccount']['find']({'where':{'id':_0x1f7b9a['params']['id']}})[_0x2d30('0x23')](handleEntityNotFound(_0x466dc2,null))[_0x2d30('0x23')](removeEntity(_0x466dc2,null))[_0x2d30('0x42')](handleError(_0x466dc2,null));};exports[_0x2d30('0x49')]=function(_0xfa819,_0x95ca7b,_0x4d684e){var _0x47c27b={};var _0x241bcf={};var _0x269b8e;var _0x3234c3;return db[_0x2d30('0x2a')][_0x2d30('0x4a')]({'where':{'id':_0xfa819['params']['id']}})[_0x2d30('0x23')](handleEntityNotFound(_0x95ca7b,null))['then'](function(_0x4dac90){if(_0x4dac90){_0x269b8e=_0x4dac90;_0x241bcf['model']=_[_0x2d30('0x31')](db[_0x2d30('0x4b')][_0x2d30('0x2b')]);_0x241bcf[_0x2d30('0x30')]=_[_0x2d30('0x31')](_0xfa819[_0x2d30('0x30')]);_0x241bcf[_0x2d30('0x39')]=_['intersection'](_0x241bcf['model'],_0x241bcf['query']);_0x47c27b[_0x2d30('0x32')]=_['intersection'](_0x241bcf[_0x2d30('0x2f')],qs['fields'](_0xfa819[_0x2d30('0x30')][_0x2d30('0x34')]));_0x47c27b[_0x2d30('0x32')]=_0x47c27b['attributes'][_0x2d30('0x35')]?_0x47c27b['attributes']:_0x241bcf[_0x2d30('0x2f')];_0x47c27b[_0x2d30('0x4c')]=qs[_0x2d30('0x37')](_0xfa819[_0x2d30('0x30')][_0x2d30('0x37')]);_0x47c27b['where']=qs[_0x2d30('0x39')](_['pick'](_0xfa819['query'],_0x241bcf[_0x2d30('0x39')]));if(_0xfa819[_0x2d30('0x30')]['filter']){_0x47c27b['where']=_[_0x2d30('0x3c')](_0x47c27b[_0x2d30('0x38')],{'$or':_[_0x2d30('0x29')](_0x47c27b['attributes'],function(_0x325a33){var _0x738b3d={};_0x738b3d[_0x325a33]={'$like':'%'+_0xfa819['query'][_0x2d30('0x3b')]+'%'};return _0x738b3d;})});}_0x47c27b=_[_0x2d30('0x3c')]({},_0x47c27b,_0xfa819['options']);return _0x269b8e[_0x2d30('0x49')](_0x47c27b);}})[_0x2d30('0x23')](function(_0x2c9a21){if(_0x2c9a21){_0x3234c3=_0x2c9a21[_0x2d30('0x35')];if(!_0xfa819[_0x2d30('0x30')][_0x2d30('0x36')](_0x2d30('0x4d'))){_0x47c27b[_0x2d30('0x20')]=qs[_0x2d30('0x20')](_0xfa819[_0x2d30('0x30')]['limit']);_0x47c27b[_0x2d30('0x1e')]=qs[_0x2d30('0x1e')](_0xfa819[_0x2d30('0x30')][_0x2d30('0x1e')]);}return _0x269b8e[_0x2d30('0x49')](_0x47c27b);}})[_0x2d30('0x23')](function(_0x38e457){if(_0x38e457){return _0x38e457?{'count':_0x3234c3,'rows':_0x38e457}:null;}})[_0x2d30('0x23')](respondWithResult(_0x95ca7b,null))[_0x2d30('0x42')](handleError(_0x95ca7b,null));};exports['addConfiguration']=function(_0x44cef5,_0x44caae,_0x1b7022){if(_0x44cef5['body']['id']){delete _0x44cef5[_0x2d30('0x47')]['id'];}return db[_0x2d30('0x2a')]['findOne']({'where':{'id':_0x44cef5[_0x2d30('0x43')]['id']}})[_0x2d30('0x23')](handleEntityNotFound(_0x44caae,null))[_0x2d30('0x23')](function(_0x45344b){if(_0x45344b){_0x44cef5[_0x2d30('0x47')][_0x2d30('0x4e')]=_0x45344b['id'];_0x44cef5['body']['Subjects']=integrations[_0x2d30('0x4f')](_0x44cef5[_0x2d30('0x47')][_0x2d30('0x50')],_0x44cef5[_0x2d30('0x47')][_0x2d30('0x2d')]);_0x44cef5['body'][_0x2d30('0x51')]=integrations[_0x2d30('0x52')](_0x44cef5[_0x2d30('0x47')][_0x2d30('0x50')],_0x44cef5['body'][_0x2d30('0x2d')]);return db[_0x2d30('0x4b')][_0x2d30('0x45')](_0x44cef5[_0x2d30('0x47')],{'include':[{'model':db['FreshsalesField'],'as':_0x2d30('0x53')},{'model':db[_0x2d30('0x54')],'as':'Descriptions'}]});}return null;})['then'](respondWithResult(_0x44caae,null))[_0x2d30('0x42')](handleError(_0x44caae,null));};exports[_0x2d30('0x55')]=function(_0x2cc5f1,_0x7db0c3,_0x5e0753){var _0x57edf6='';var _0x53b70a='';return db[_0x2d30('0x2a')]['findOne']({'where':{'id':_0x2cc5f1[_0x2d30('0x43')]['id']},'attributes':['id',_0x2d30('0x56'),'remoteUri',_0x2d30('0x57')]})[_0x2d30('0x23')](handleEntityNotFound(_0x7db0c3,null))[_0x2d30('0x23')](function(_0x3bbab5){if(_0x3bbab5){_0x53b70a=_0x3bbab5[_0x2d30('0x56')];_0x57edf6=_0x3bbab5['remoteUri'];var _0x4caba6=_0x3bbab5[_0x2d30('0x58')][_0x2d30('0x59')](-0x1);if(_0x4caba6==='/'){_0x57edf6=_0x57edf6[_0x2d30('0x5a')](0x0,_0x57edf6[_0x2d30('0x5b')](_0x4caba6));}return rp({'method':_0x2d30('0x5c'),'uri':util[_0x2d30('0x5d')](_0x2d30('0x5e'),_0x57edf6,_0x2d30('0x5f')),'headers':{'Authorization':_0x2d30('0x60')+_0x3bbab5[_0x2d30('0x57')]},'json':!![]});}})['then'](function(_0x86c622){if(_0x86c622){var _0xf415f0=_0x86c622[_0x2d30('0x61')];var _0x1e1ae0=![];var _0x5ad416=null;for(_0x5ad416=0x0;_0x5ad416<_0xf415f0['length'];_0x5ad416++){if(_0xf415f0[_0x5ad416]['email']===_0x53b70a){_0x1e1ae0=!![];}}if(_0x1e1ae0){return!![];}else{throw new Error({'statusCode':0x194,'message':_0x2d30('0x62')});}}})[_0x2d30('0x23')](respondWithResult(_0x7db0c3,null))[_0x2d30('0x42')](function(_0x4a7076){var _0x1822b7=_0x2cc5f1[_0x2d30('0x30')]['test']?0x1f4:_0x4a7076[_0x2d30('0x63')]||0x1f4;logger[_0x2d30('0x25')]('getFields,\x20%s,\x20%s,\x20%s',_0x2d30('0x55'),_0x1822b7,JSON[_0x2d30('0x64')](_0x4a7076));delete _0x4a7076[_0x2d30('0x26')];if(_0x1822b7===0x191){_0x1822b7=0x190;}_0x7db0c3[_0x2d30('0x1c')](_0x1822b7)[_0x2d30('0x27')](_0x2cc5f1['query']['test']?{'message':_0x2d30('0x65'),'statusCode':_0x4a7076[_0x2d30('0x63')]}:_0x4a7076);});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js index ac38b9a..5ed564d 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 _0xb145=['request-promise','path','rimraf','./intFreshsalesAccount.attributes','../../components/integrations/configuration','exports','define','FreshsalesAccount','int_freshsales_accounts','util','../../config/logger','api','moment','bluebird'];(function(_0x3bc328,_0x2374f7){var _0x57752e=function(_0x3750ae){while(--_0x3750ae){_0x3bc328['push'](_0x3bc328['shift']());}};_0x57752e(++_0x2374f7);}(_0xb145,0xa3));var _0x5b14=function(_0x8d62a4,_0x2d01e7){_0x8d62a4=_0x8d62a4-0x0;var _0x5767ce=_0xb145[_0x8d62a4];return _0x5767ce;};'use strict';var _=require('lodash');var util=require(_0x5b14('0x0'));var logger=require(_0x5b14('0x1'))(_0x5b14('0x2'));var moment=require(_0x5b14('0x3'));var BPromise=require(_0x5b14('0x4'));var rp=require(_0x5b14('0x5'));var fs=require('fs');var path=require(_0x5b14('0x6'));var rimraf=require(_0x5b14('0x7'));var config=require('../../config/environment');var attributes=require(_0x5b14('0x8'));var integrations=require(_0x5b14('0x9'));module[_0x5b14('0xa')]=function(_0x4d82ad,_0x50fd91){return _0x4d82ad[_0x5b14('0xb')](_0x5b14('0xc'),attributes,{'tableName':_0x5b14('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7bd0=['path','../../config/environment','./intFreshsalesAccount.attributes','../../components/integrations/configuration','exports','define','int_freshsales_accounts','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0xbf8ec1,_0x9169c8){var _0xc84567=function(_0x509094){while(--_0x509094){_0xbf8ec1['push'](_0xbf8ec1['shift']());}};_0xc84567(++_0x9169c8);}(_0x7bd0,0x111));var _0x07bd=function(_0x565fed,_0xb85768){_0x565fed=_0x565fed-0x0;var _0x3e018f=_0x7bd0[_0x565fed];return _0x3e018f;};'use strict';var _=require(_0x07bd('0x0'));var util=require(_0x07bd('0x1'));var logger=require(_0x07bd('0x2'))(_0x07bd('0x3'));var moment=require(_0x07bd('0x4'));var BPromise=require(_0x07bd('0x5'));var rp=require(_0x07bd('0x6'));var fs=require('fs');var path=require(_0x07bd('0x7'));var rimraf=require('rimraf');var config=require(_0x07bd('0x8'));var attributes=require(_0x07bd('0x9'));var integrations=require(_0x07bd('0xa'));module[_0x07bd('0xb')]=function(_0x3e8349,_0x422a22){return _0x3e8349[_0x07bd('0xc')]('FreshsalesAccount',attributes,{'tableName':_0x07bd('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.rpc.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.rpc.js index 629dd09..5501b63 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 _0xd943=['limit','include','map','model','attributes','debug','ShowFreshsalesAccount','find','stringify','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','then','info','request\x20sent','FreshsalesAccount,\x20%s,\x20%s,\x20%s','error','code','FreshsalesAccount,\x20%s,\x20%s','message','result','catch','GetFreshsalesAccount','FreshsalesAccount','options','raw','where'];(function(_0x509dad,_0x1f995f){var _0x21e122=function(_0x2a9b90){while(--_0x2a9b90){_0x509dad['push'](_0x509dad['shift']());}};_0x21e122(++_0x1f995f);}(_0xd943,0x15d));var _0x3d94=function(_0x99e169,_0x21821c){_0x99e169=_0x99e169-0x0;var _0x58bac5=_0xd943[_0x99e169];return _0x58bac5;};'use strict';var _=require(_0x3d94('0x0'));var util=require(_0x3d94('0x1'));var moment=require(_0x3d94('0x2'));var BPromise=require(_0x3d94('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3d94('0x4'));var db=require(_0x3d94('0x5'))['db'];var utils=require(_0x3d94('0x6'));var logger=require(_0x3d94('0x7'))(_0x3d94('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x3d94('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x54e81f,_0x4d29e7,_0x20f4d1){return new BPromise(function(_0x35d36a,_0x5244c3){return client['request'](_0x54e81f,_0x20f4d1)[_0x3d94('0xa')](function(_0x27e381){logger[_0x3d94('0xb')]('FreshsalesAccount,\x20%s,\x20%s',_0x4d29e7,_0x3d94('0xc'));logger['debug'](_0x3d94('0xd'),_0x4d29e7,_0x3d94('0xc'),JSON['stringify'](_0x27e381));if(_0x27e381[_0x3d94('0xe')]){if(_0x27e381[_0x3d94('0xe')][_0x3d94('0xf')]===0x1f4){logger[_0x3d94('0xe')](_0x3d94('0x10'),_0x4d29e7,_0x27e381['error'][_0x3d94('0x11')]);return _0x5244c3(_0x27e381[_0x3d94('0xe')][_0x3d94('0x11')]);}logger['error'](_0x3d94('0x10'),_0x4d29e7,_0x27e381[_0x3d94('0xe')][_0x3d94('0x11')]);return _0x35d36a(_0x27e381['error'][_0x3d94('0x11')]);}else{logger[_0x3d94('0xb')](_0x3d94('0x10'),_0x4d29e7,_0x3d94('0xc'));_0x35d36a(_0x27e381[_0x3d94('0x12')][_0x3d94('0x11')]);}})[_0x3d94('0x13')](function(_0x9893cb){logger['error'](_0x3d94('0x10'),_0x4d29e7,_0x9893cb);_0x5244c3(_0x9893cb);});});}exports[_0x3d94('0x14')]=function(_0x2acee3){var _0x1c35a8=this;return new Promise(function(_0x4afc92,_0x3ca0e3){return db[_0x3d94('0x15')]['findAll']({'raw':_0x2acee3[_0x3d94('0x16')]?_0x2acee3['options'][_0x3d94('0x17')]===undefined?!![]:![]:!![],'where':_0x2acee3[_0x3d94('0x16')]?_0x2acee3[_0x3d94('0x16')][_0x3d94('0x18')]||null:null,'attributes':_0x2acee3[_0x3d94('0x16')]?_0x2acee3['options']['attributes']||null:null,'limit':_0x2acee3[_0x3d94('0x16')]?_0x2acee3[_0x3d94('0x16')][_0x3d94('0x19')]||null:null,'include':_0x2acee3['options']?_0x2acee3[_0x3d94('0x16')][_0x3d94('0x1a')]?_[_0x3d94('0x1b')](_0x2acee3[_0x3d94('0x16')][_0x3d94('0x1a')],function(_0x4093a4){return{'model':db[_0x4093a4[_0x3d94('0x1c')]],'as':_0x4093a4['as'],'attributes':_0x4093a4[_0x3d94('0x1d')],'include':_0x4093a4[_0x3d94('0x1a')]?_[_0x3d94('0x1b')](_0x4093a4[_0x3d94('0x1a')],function(_0x192839){return{'model':db[_0x192839[_0x3d94('0x1c')]],'as':_0x192839['as'],'attributes':_0x192839[_0x3d94('0x1d')],'include':_0x192839[_0x3d94('0x1a')]?_['map'](_0x192839[_0x3d94('0x1a')],function(_0x558fd2){return{'model':db[_0x558fd2[_0x3d94('0x1c')]],'as':_0x558fd2['as'],'attributes':_0x558fd2[_0x3d94('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x3d94('0xa')](function(_0x439173){logger[_0x3d94('0xb')](_0x3d94('0x14'),_0x2acee3);logger[_0x3d94('0x1e')]('GetFreshsalesAccount',_0x2acee3,JSON['stringify'](_0x439173));_0x4afc92(_0x439173);})[_0x3d94('0x13')](function(_0x4813e1){logger['error'](_0x3d94('0x14'),_0x4813e1['message'],_0x2acee3);_0x3ca0e3(_0x1c35a8[_0x3d94('0xe')](0x1f4,_0x4813e1[_0x3d94('0x11')]));});});};exports[_0x3d94('0x1f')]=function(_0x4cef9c){var _0x2a07b4=this;return new Promise(function(_0x4c1237,_0x3d4994){return db['FreshsalesAccount'][_0x3d94('0x20')]({'raw':_0x4cef9c[_0x3d94('0x16')]?_0x4cef9c[_0x3d94('0x16')][_0x3d94('0x17')]===undefined?!![]:![]:!![],'where':_0x4cef9c['options']?_0x4cef9c[_0x3d94('0x16')]['where']||null:null,'attributes':_0x4cef9c[_0x3d94('0x16')]?_0x4cef9c[_0x3d94('0x16')]['attributes']||null:null,'include':_0x4cef9c['options']?_0x4cef9c[_0x3d94('0x16')][_0x3d94('0x1a')]?_[_0x3d94('0x1b')](_0x4cef9c['options'][_0x3d94('0x1a')],function(_0x3d29fd){return{'model':db[_0x3d29fd['model']],'as':_0x3d29fd['as'],'attributes':_0x3d29fd[_0x3d94('0x1d')],'include':_0x3d29fd[_0x3d94('0x1a')]?_[_0x3d94('0x1b')](_0x3d29fd[_0x3d94('0x1a')],function(_0x782c1){return{'model':db[_0x782c1['model']],'as':_0x782c1['as'],'attributes':_0x782c1[_0x3d94('0x1d')],'include':_0x782c1[_0x3d94('0x1a')]?_[_0x3d94('0x1b')](_0x782c1[_0x3d94('0x1a')],function(_0xb493f1){return{'model':db[_0xb493f1[_0x3d94('0x1c')]],'as':_0xb493f1['as'],'attributes':_0xb493f1['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0xfe58eb){logger[_0x3d94('0xb')](_0x3d94('0x1f'),_0x4cef9c);logger[_0x3d94('0x1e')](_0x3d94('0x1f'),_0x4cef9c,JSON[_0x3d94('0x21')](_0xfe58eb));_0x4c1237(_0xfe58eb);})[_0x3d94('0x13')](function(_0x12c01a){logger[_0x3d94('0xe')](_0x3d94('0x1f'),_0x12c01a['message'],_0x4cef9c);_0x3d4994(_0x2a07b4[_0x3d94('0xe')](0x1f4,_0x12c01a[_0x3d94('0x11')]));});});}; \ No newline at end of file +var _0x77e6=['result','catch','FreshsalesAccount','findAll','options','where','attributes','limit','include','model','map','GetFreshsalesAccount','ShowFreshsalesAccount','find','raw','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','request','then','info','request\x20sent','debug','FreshsalesAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','FreshsalesAccount,\x20%s,\x20%s','message'];(function(_0x22f67d,_0x319ca6){var _0x188842=function(_0x36c14a){while(--_0x36c14a){_0x22f67d['push'](_0x22f67d['shift']());}};_0x188842(++_0x319ca6);}(_0x77e6,0x1a6));var _0x677e=function(_0x5eedc2,_0xcb147f){_0x5eedc2=_0x5eedc2-0x0;var _0x50ec6a=_0x77e6[_0x5eedc2];return _0x50ec6a;};'use strict';var _=require(_0x677e('0x0'));var util=require(_0x677e('0x1'));var moment=require(_0x677e('0x2'));var BPromise=require(_0x677e('0x3'));var rs=require(_0x677e('0x4'));var fs=require('fs');var Redis=require(_0x677e('0x5'));var db=require(_0x677e('0x6'))['db'];var utils=require(_0x677e('0x7'));var logger=require('../../config/logger')(_0x677e('0x8'));var config=require(_0x677e('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x677e('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x40d314,_0x4d1a57,_0x5a5dd3){return new BPromise(function(_0x2eb40c,_0x4c519f){return client[_0x677e('0xb')](_0x40d314,_0x5a5dd3)[_0x677e('0xc')](function(_0x552931){logger[_0x677e('0xd')]('FreshsalesAccount,\x20%s,\x20%s',_0x4d1a57,_0x677e('0xe'));logger[_0x677e('0xf')](_0x677e('0x10'),_0x4d1a57,_0x677e('0xe'),JSON[_0x677e('0x11')](_0x552931));if(_0x552931[_0x677e('0x12')]){if(_0x552931[_0x677e('0x12')][_0x677e('0x13')]===0x1f4){logger[_0x677e('0x12')](_0x677e('0x14'),_0x4d1a57,_0x552931[_0x677e('0x12')][_0x677e('0x15')]);return _0x4c519f(_0x552931[_0x677e('0x12')][_0x677e('0x15')]);}logger['error']('FreshsalesAccount,\x20%s,\x20%s',_0x4d1a57,_0x552931['error'][_0x677e('0x15')]);return _0x2eb40c(_0x552931[_0x677e('0x12')][_0x677e('0x15')]);}else{logger[_0x677e('0xd')](_0x677e('0x14'),_0x4d1a57,_0x677e('0xe'));_0x2eb40c(_0x552931[_0x677e('0x16')][_0x677e('0x15')]);}})[_0x677e('0x17')](function(_0x32d306){logger[_0x677e('0x12')](_0x677e('0x14'),_0x4d1a57,_0x32d306);_0x4c519f(_0x32d306);});});}exports['GetFreshsalesAccount']=function(_0x1c5124){var _0x2ef2bf=this;return new Promise(function(_0x385b06,_0x221b6d){return db[_0x677e('0x18')][_0x677e('0x19')]({'raw':_0x1c5124['options']?_0x1c5124[_0x677e('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x1c5124[_0x677e('0x1a')]?_0x1c5124[_0x677e('0x1a')][_0x677e('0x1b')]||null:null,'attributes':_0x1c5124['options']?_0x1c5124[_0x677e('0x1a')][_0x677e('0x1c')]||null:null,'limit':_0x1c5124[_0x677e('0x1a')]?_0x1c5124[_0x677e('0x1a')][_0x677e('0x1d')]||null:null,'include':_0x1c5124[_0x677e('0x1a')]?_0x1c5124[_0x677e('0x1a')]['include']?_['map'](_0x1c5124['options'][_0x677e('0x1e')],function(_0x154fce){return{'model':db[_0x154fce[_0x677e('0x1f')]],'as':_0x154fce['as'],'attributes':_0x154fce[_0x677e('0x1c')],'include':_0x154fce[_0x677e('0x1e')]?_[_0x677e('0x20')](_0x154fce[_0x677e('0x1e')],function(_0x42f2b8){return{'model':db[_0x42f2b8[_0x677e('0x1f')]],'as':_0x42f2b8['as'],'attributes':_0x42f2b8[_0x677e('0x1c')],'include':_0x42f2b8['include']?_['map'](_0x42f2b8[_0x677e('0x1e')],function(_0x184f68){return{'model':db[_0x184f68['model']],'as':_0x184f68['as'],'attributes':_0x184f68[_0x677e('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x677e('0xc')](function(_0xf6b3ad){logger[_0x677e('0xd')](_0x677e('0x21'),_0x1c5124);logger[_0x677e('0xf')]('GetFreshsalesAccount',_0x1c5124,JSON[_0x677e('0x11')](_0xf6b3ad));_0x385b06(_0xf6b3ad);})[_0x677e('0x17')](function(_0xeca8e2){logger[_0x677e('0x12')](_0x677e('0x21'),_0xeca8e2[_0x677e('0x15')],_0x1c5124);_0x221b6d(_0x2ef2bf[_0x677e('0x12')](0x1f4,_0xeca8e2[_0x677e('0x15')]));});});};exports[_0x677e('0x22')]=function(_0x4c5113){var _0x22ccfb=this;return new Promise(function(_0x3cac19,_0x2fb815){return db[_0x677e('0x18')][_0x677e('0x23')]({'raw':_0x4c5113[_0x677e('0x1a')]?_0x4c5113[_0x677e('0x1a')][_0x677e('0x24')]===undefined?!![]:![]:!![],'where':_0x4c5113[_0x677e('0x1a')]?_0x4c5113[_0x677e('0x1a')]['where']||null:null,'attributes':_0x4c5113[_0x677e('0x1a')]?_0x4c5113[_0x677e('0x1a')][_0x677e('0x1c')]||null:null,'include':_0x4c5113[_0x677e('0x1a')]?_0x4c5113[_0x677e('0x1a')][_0x677e('0x1e')]?_['map'](_0x4c5113[_0x677e('0x1a')][_0x677e('0x1e')],function(_0x2d0bc0){return{'model':db[_0x2d0bc0['model']],'as':_0x2d0bc0['as'],'attributes':_0x2d0bc0[_0x677e('0x1c')],'include':_0x2d0bc0[_0x677e('0x1e')]?_[_0x677e('0x20')](_0x2d0bc0[_0x677e('0x1e')],function(_0x35c945){return{'model':db[_0x35c945['model']],'as':_0x35c945['as'],'attributes':_0x35c945[_0x677e('0x1c')],'include':_0x35c945[_0x677e('0x1e')]?_[_0x677e('0x20')](_0x35c945[_0x677e('0x1e')],function(_0x548b22){return{'model':db[_0x548b22[_0x677e('0x1f')]],'as':_0x548b22['as'],'attributes':_0x548b22[_0x677e('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x677e('0xc')](function(_0x576443){logger['info'](_0x677e('0x22'),_0x4c5113);logger[_0x677e('0xf')]('ShowFreshsalesAccount',_0x4c5113,JSON[_0x677e('0x11')](_0x576443));_0x3cac19(_0x576443);})[_0x677e('0x17')](function(_0x497dca){logger['error'](_0x677e('0x22'),_0x497dca[_0x677e('0x15')],_0x4c5113);_0x2fb815(_0x22ccfb['error'](0x1f4,_0x497dca['message']));});});}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/index.js b/server/api/intFreshsalesConfiguration/index.js index 8fb86be..cf3fbe4 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 _0x1963=['/:id/descriptions','getDescriptions','getFields','post','put','update','delete','destroy','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./intFreshsalesConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/subjects','getSubjects'];(function(_0xb99c65,_0x79996a){var _0x492951=function(_0x14d675){while(--_0x14d675){_0xb99c65['push'](_0xb99c65['shift']());}};_0x492951(++_0x79996a);}(_0x1963,0x1e8));var _0x3196=function(_0x5e3b64,_0x4d11a4){_0x5e3b64=_0x5e3b64-0x0;var _0x1823af=_0x1963[_0x5e3b64];return _0x1823af;};'use strict';var multer=require('multer');var util=require(_0x3196('0x0'));var path=require(_0x3196('0x1'));var timeout=require(_0x3196('0x2'));var express=require(_0x3196('0x3'));var router=express[_0x3196('0x4')]();var fs_extra=require(_0x3196('0x5'));var auth=require(_0x3196('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x3196('0x7'));var controller=require(_0x3196('0x8'));router[_0x3196('0x9')]('/',auth[_0x3196('0xa')](),controller[_0x3196('0xb')]);router[_0x3196('0x9')](_0x3196('0xc'),auth[_0x3196('0xa')](),controller[_0x3196('0xd')]);router[_0x3196('0x9')](_0x3196('0xe'),auth['isAuthenticated'](),controller[_0x3196('0xf')]);router[_0x3196('0x9')](_0x3196('0x10'),auth['isAuthenticated'](),controller[_0x3196('0x11')]);router[_0x3196('0x9')]('/:id/fields',auth[_0x3196('0xa')](),controller[_0x3196('0x12')]);router[_0x3196('0x13')]('/',auth[_0x3196('0xa')](),controller['create']);router[_0x3196('0x14')]('/:id',auth[_0x3196('0xa')](),controller[_0x3196('0x15')]);router[_0x3196('0x16')](_0x3196('0xc'),auth[_0x3196('0xa')](),controller[_0x3196('0x17')]);module['exports']=router; \ No newline at end of file +var _0xf870=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','show','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/fields','post','create','/:id','update','delete','destroy','exports','multer'];(function(_0x19caab,_0x1e1296){var _0x1f730c=function(_0x120541){while(--_0x120541){_0x19caab['push'](_0x19caab['shift']());}};_0x1f730c(++_0x1e1296);}(_0xf870,0x1da));var _0x0f87=function(_0x344fe8,_0xbc6928){_0x344fe8=_0x344fe8-0x0;var _0x5bfc11=_0xf870[_0x344fe8];return _0x5bfc11;};'use strict';var multer=require(_0x0f87('0x0'));var util=require(_0x0f87('0x1'));var path=require(_0x0f87('0x2'));var timeout=require(_0x0f87('0x3'));var express=require(_0x0f87('0x4'));var router=express[_0x0f87('0x5')]();var fs_extra=require(_0x0f87('0x6'));var auth=require(_0x0f87('0x7'));var interaction=require(_0x0f87('0x8'));var config=require(_0x0f87('0x9'));var controller=require('./intFreshsalesConfiguration.controller');router[_0x0f87('0xa')]('/',auth['isAuthenticated'](),controller['index']);router[_0x0f87('0xa')]('/:id',auth[_0x0f87('0xb')](),controller[_0x0f87('0xc')]);router[_0x0f87('0xa')](_0x0f87('0xd'),auth[_0x0f87('0xb')](),controller[_0x0f87('0xe')]);router[_0x0f87('0xa')](_0x0f87('0xf'),auth[_0x0f87('0xb')](),controller[_0x0f87('0x10')]);router['get'](_0x0f87('0x11'),auth[_0x0f87('0xb')](),controller['getFields']);router[_0x0f87('0x12')]('/',auth[_0x0f87('0xb')](),controller[_0x0f87('0x13')]);router['put'](_0x0f87('0x14'),auth[_0x0f87('0xb')](),controller[_0x0f87('0x15')]);router[_0x0f87('0x16')](_0x0f87('0x14'),auth[_0x0f87('0xb')](),controller[_0x0f87('0x17')]);module[_0x0f87('0x18')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js index 9ab0eca..b0cbcd4 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 _0x2e35=['STRING','sequelize','exports'];(function(_0x366920,_0x24185c){var _0x2fa9de=function(_0xe624bf){while(--_0xe624bf){_0x366920['push'](_0x366920['shift']());}};_0x2fa9de(++_0x24185c);}(_0x2e35,0x1f3));var _0x52e3=function(_0x4a8947,_0x36a72b){_0x4a8947=_0x4a8947-0x0;var _0x54663f=_0x2e35[_0x4a8947];return _0x54663f;};'use strict';var Sequelize=require(_0x52e3('0x0'));module[_0x52e3('0x1')]={'name':{'type':Sequelize[_0x52e3('0x2')]},'description':{'type':Sequelize[_0x52e3('0x2')]}}; \ No newline at end of file +var _0x1252=['sequelize','STRING'];(function(_0x53e6a8,_0x5839ab){var _0x2b6dcc=function(_0x2b4215){while(--_0x2b4215){_0x53e6a8['push'](_0x53e6a8['shift']());}};_0x2b6dcc(++_0x5839ab);}(_0x1252,0x1c0));var _0x2125=function(_0x1a45fd,_0x16dc45){_0x1a45fd=_0x1a45fd-0x0;var _0x380f2a=_0x1252[_0x1a45fd];return _0x380f2a;};'use strict';var Sequelize=require(_0x2125('0x0'));module['exports']={'name':{'type':Sequelize[_0x2125('0x1')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js index 57daf62..6c564e5 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 _0x20c0=['api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','limit','undefined','count','Content-Range','apply','reject','update','then','destroy','end','error','stack','name','index','FreshsalesConfiguration','rawAttributes','fieldName','type','key','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','order','sort','filters','pick','filter','merge','where','map','VIRTUAL','options','include','rows','catch','show','create','find','params','body','getSubjects','FreshsalesField','nolimit','getDescriptions','findOne','getFields','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger'];(function(_0x28782e,_0x2af6af){var _0x172af1=function(_0x145287){while(--_0x145287){_0x28782e['push'](_0x28782e['shift']());}};_0x172af1(++_0x2af6af);}(_0x20c0,0x8c));var _0x020c=function(_0x41e9e4,_0x4cf440){_0x41e9e4=_0x41e9e4-0x0;var _0x5c8c3e=_0x20c0[_0x41e9e4];return _0x5c8c3e;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x020c('0x0'));var rp=require(_0x020c('0x1'));var moment=require(_0x020c('0x2'));var BPromise=require(_0x020c('0x3'));var Mustache=require(_0x020c('0x4'));var util=require('util');var path=require(_0x020c('0x5'));var sox=require('sox');var csv=require(_0x020c('0x6'));var ejs=require(_0x020c('0x7'));var fs=require('fs');var fs_extra=require(_0x020c('0x8'));var _=require(_0x020c('0x9'));var squel=require(_0x020c('0xa'));var crypto=require(_0x020c('0xb'));var jsforce=require(_0x020c('0xc'));var deskjs=require(_0x020c('0xd'));var toCsv=require(_0x020c('0x6'));var querystring=require(_0x020c('0xe'));var Papa=require(_0x020c('0xf'));var Redis=require(_0x020c('0x10'));var authService=require(_0x020c('0x11'));var qs=require(_0x020c('0x12'));var as=require(_0x020c('0x13'));var hardwareService=require(_0x020c('0x14'));var logger=require(_0x020c('0x15'))(_0x020c('0x16'));var utils=require(_0x020c('0x17'));var config=require(_0x020c('0x18'));var licenseUtil=require(_0x020c('0x19'));var db=require(_0x020c('0x1a'))['db'];function respondWithStatusCode(_0x337a94,_0x6e48aa){_0x6e48aa=_0x6e48aa||0xcc;return function(_0x13b469){if(_0x13b469){return _0x337a94[_0x020c('0x1b')](_0x6e48aa);}return _0x337a94[_0x020c('0x1c')](_0x6e48aa)['end']();};}function respondWithResult(_0x127cc5,_0x41c007){_0x41c007=_0x41c007||0xc8;return function(_0x42a579){if(_0x42a579){return _0x127cc5[_0x020c('0x1c')](_0x41c007)['json'](_0x42a579);}};}function respondWithFilteredResult(_0x26d2ca,_0xa59b87){return function(_0x12caaf){if(_0x12caaf){var _0x9eb856=typeof _0xa59b87[_0x020c('0x1d')]==='undefined'&&typeof _0xa59b87[_0x020c('0x1e')]===_0x020c('0x1f');var _0xc4867e=_0x12caaf[_0x020c('0x20')];var _0x5b5c9d=_0x9eb856?0x0:_0xa59b87['offset'];var _0x30973e=_0x9eb856?_0x12caaf[_0x020c('0x20')]:_0xa59b87['offset']+_0xa59b87[_0x020c('0x1e')];var _0x320c11;if(_0x30973e>=_0xc4867e){_0x30973e=_0xc4867e;_0x320c11=0xc8;}else{_0x320c11=0xce;}_0x26d2ca[_0x020c('0x1c')](_0x320c11);return _0x26d2ca['set'](_0x020c('0x21'),_0x5b5c9d+'-'+_0x30973e+'/'+_0xc4867e)['json'](_0x12caaf);}return null;};}function patchUpdates(_0x1e8630){return function(_0x12cbff){try{jsonpatch[_0x020c('0x22')](_0x12cbff,_0x1e8630,!![]);}catch(_0x519c0c){return BPromise[_0x020c('0x23')](_0x519c0c);}return _0x12cbff['save']();};}function saveUpdates(_0x3ec069,_0x341299){return function(_0x281247){if(_0x281247){return _0x281247[_0x020c('0x24')](_0x3ec069)[_0x020c('0x25')](function(_0x5cf32d){return _0x5cf32d;});}return null;};}function removeEntity(_0x1d18ad,_0x120fca){return function(_0x47f69e){if(_0x47f69e){return _0x47f69e[_0x020c('0x26')]()['then'](function(){_0x1d18ad[_0x020c('0x1c')](0xcc)[_0x020c('0x27')]();});}};}function handleEntityNotFound(_0x155784,_0x19d281){return function(_0x218880){if(!_0x218880){_0x155784[_0x020c('0x1b')](0x194);}return _0x218880;};}function handleError(_0x3bf95a,_0x42f0e3){_0x42f0e3=_0x42f0e3||0x1f4;return function(_0x226754){logger[_0x020c('0x28')](_0x226754[_0x020c('0x29')]);if(_0x226754[_0x020c('0x2a')]){delete _0x226754['name'];}_0x3bf95a[_0x020c('0x1c')](_0x42f0e3)['send'](_0x226754);};}exports[_0x020c('0x2b')]=function(_0x1689c9,_0x4ca9eb){var _0x1b2fad={},_0x1cc48c={},_0x35f307={'count':0x0,'rows':[]};var _0x5befc4=_['map'](db[_0x020c('0x2c')][_0x020c('0x2d')],function(_0x5da622){return{'name':_0x5da622[_0x020c('0x2e')],'type':_0x5da622[_0x020c('0x2f')][_0x020c('0x30')]};});_0x1cc48c[_0x020c('0x31')]=_['map'](_0x5befc4,_0x020c('0x2a'));_0x1cc48c[_0x020c('0x32')]=_[_0x020c('0x33')](_0x1689c9[_0x020c('0x32')]);_0x1cc48c['filters']=_['intersection'](_0x1cc48c[_0x020c('0x31')],_0x1cc48c[_0x020c('0x32')]);_0x1b2fad[_0x020c('0x34')]=_[_0x020c('0x35')](_0x1cc48c['model'],qs['fields'](_0x1689c9[_0x020c('0x32')][_0x020c('0x36')]));_0x1b2fad[_0x020c('0x34')]=_0x1b2fad[_0x020c('0x34')][_0x020c('0x37')]?_0x1b2fad[_0x020c('0x34')]:_0x1cc48c[_0x020c('0x31')];if(!_0x1689c9[_0x020c('0x32')][_0x020c('0x38')]('nolimit')){_0x1b2fad[_0x020c('0x1e')]=qs[_0x020c('0x1e')](_0x1689c9[_0x020c('0x32')][_0x020c('0x1e')]);_0x1b2fad[_0x020c('0x1d')]=qs[_0x020c('0x1d')](_0x1689c9['query']['offset']);}_0x1b2fad[_0x020c('0x39')]=qs[_0x020c('0x3a')](_0x1689c9[_0x020c('0x32')][_0x020c('0x3a')]);_0x1b2fad['where']=qs[_0x020c('0x3b')](_[_0x020c('0x3c')](_0x1689c9[_0x020c('0x32')],_0x1cc48c[_0x020c('0x3b')]),_0x5befc4);if(_0x1689c9[_0x020c('0x32')][_0x020c('0x3d')]){_0x1b2fad['where']=_[_0x020c('0x3e')](_0x1b2fad[_0x020c('0x3f')],{'$or':_[_0x020c('0x40')](_0x5befc4,function(_0x4d092f){if(_0x4d092f[_0x020c('0x2f')]!==_0x020c('0x41')){var _0x1d6e37={};_0x1d6e37[_0x4d092f[_0x020c('0x2a')]]={'$like':'%'+_0x1689c9[_0x020c('0x32')][_0x020c('0x3d')]+'%'};return _0x1d6e37;}})});}_0x1b2fad=_[_0x020c('0x3e')]({},_0x1b2fad,_0x1689c9[_0x020c('0x42')]);var _0x3ba752={'where':_0x1b2fad[_0x020c('0x3f')]};return db[_0x020c('0x2c')][_0x020c('0x20')](_0x3ba752)[_0x020c('0x25')](function(_0x5d7671){_0x35f307['count']=_0x5d7671;if(_0x1689c9['query']['includeAll']){_0x1b2fad[_0x020c('0x43')]=[{'all':!![]}];}return db['FreshsalesConfiguration']['findAll'](_0x1b2fad);})[_0x020c('0x25')](function(_0x98499e){_0x35f307[_0x020c('0x44')]=_0x98499e;return _0x35f307;})[_0x020c('0x25')](respondWithFilteredResult(_0x4ca9eb,_0x1b2fad))[_0x020c('0x45')](handleError(_0x4ca9eb,null));};exports[_0x020c('0x46')]=function(_0x2d04ff,_0x51cd12){var _0x4e2183={'raw':![],'where':{'id':_0x2d04ff['params']['id']}},_0x1af079={};_0x1af079[_0x020c('0x31')]=_[_0x020c('0x33')](db[_0x020c('0x2c')][_0x020c('0x2d')]);_0x1af079[_0x020c('0x32')]=_[_0x020c('0x33')](_0x2d04ff[_0x020c('0x32')]);_0x1af079[_0x020c('0x3b')]=_[_0x020c('0x35')](_0x1af079[_0x020c('0x31')],_0x1af079[_0x020c('0x32')]);_0x4e2183['attributes']=_['intersection'](_0x1af079['model'],qs[_0x020c('0x36')](_0x2d04ff[_0x020c('0x32')][_0x020c('0x36')]));_0x4e2183[_0x020c('0x34')]=_0x4e2183[_0x020c('0x34')][_0x020c('0x37')]?_0x4e2183[_0x020c('0x34')]:_0x1af079[_0x020c('0x31')];if(_0x2d04ff['query']['includeAll']){_0x4e2183['include']=[{'all':!![]}];}_0x4e2183=_[_0x020c('0x3e')]({},_0x4e2183,_0x2d04ff[_0x020c('0x42')]);return db['FreshsalesConfiguration']['find'](_0x4e2183)['then'](handleEntityNotFound(_0x51cd12,null))['then'](respondWithResult(_0x51cd12,null))['catch'](handleError(_0x51cd12,null));};exports[_0x020c('0x47')]=function(_0x8805fa,_0x31990f){return db[_0x020c('0x2c')][_0x020c('0x47')](_0x8805fa['body'],{})[_0x020c('0x25')](respondWithResult(_0x31990f,0xc9))[_0x020c('0x45')](handleError(_0x31990f,null));};exports[_0x020c('0x24')]=function(_0x3382cb,_0x350c3c){if(_0x3382cb['body']['id']){delete _0x3382cb['body']['id'];}return db[_0x020c('0x2c')][_0x020c('0x48')]({'where':{'id':_0x3382cb[_0x020c('0x49')]['id']}})[_0x020c('0x25')](handleEntityNotFound(_0x350c3c,null))[_0x020c('0x25')](saveUpdates(_0x3382cb[_0x020c('0x4a')],null))[_0x020c('0x25')](respondWithResult(_0x350c3c,null))['catch'](handleError(_0x350c3c,null));};exports['destroy']=function(_0x1afec6,_0x1da945){return db[_0x020c('0x2c')][_0x020c('0x48')]({'where':{'id':_0x1afec6[_0x020c('0x49')]['id']}})[_0x020c('0x25')](handleEntityNotFound(_0x1da945,null))[_0x020c('0x25')](removeEntity(_0x1da945,null))[_0x020c('0x45')](handleError(_0x1da945,null));};exports[_0x020c('0x4b')]=function(_0x14de22,_0x7e1c10,_0xc7862c){var _0x229484={};var _0x50de57={};var _0x42d136;var _0x3e28ed;return db[_0x020c('0x2c')]['findOne']({'where':{'id':_0x14de22[_0x020c('0x49')]['id']}})[_0x020c('0x25')](handleEntityNotFound(_0x7e1c10,null))[_0x020c('0x25')](function(_0x3765e8){if(_0x3765e8){_0x42d136=_0x3765e8;_0x50de57[_0x020c('0x31')]=_['keys'](db[_0x020c('0x4c')][_0x020c('0x2d')]);_0x50de57[_0x020c('0x32')]=_[_0x020c('0x33')](_0x14de22[_0x020c('0x32')]);_0x50de57[_0x020c('0x3b')]=_[_0x020c('0x35')](_0x50de57[_0x020c('0x31')],_0x50de57['query']);_0x229484[_0x020c('0x34')]=_[_0x020c('0x35')](_0x50de57[_0x020c('0x31')],qs[_0x020c('0x36')](_0x14de22['query'][_0x020c('0x36')]));_0x229484[_0x020c('0x34')]=_0x229484['attributes'][_0x020c('0x37')]?_0x229484[_0x020c('0x34')]:_0x50de57['model'];_0x229484[_0x020c('0x39')]=qs['sort'](_0x14de22[_0x020c('0x32')]['sort']);_0x229484[_0x020c('0x3f')]=qs[_0x020c('0x3b')](_[_0x020c('0x3c')](_0x14de22[_0x020c('0x32')],_0x50de57[_0x020c('0x3b')]));if(_0x14de22[_0x020c('0x32')][_0x020c('0x3d')]){_0x229484[_0x020c('0x3f')]=_[_0x020c('0x3e')](_0x229484['where'],{'$or':_[_0x020c('0x40')](_0x229484[_0x020c('0x34')],function(_0x4188af){var _0x200d1a={};_0x200d1a[_0x4188af]={'$like':'%'+_0x14de22['query'][_0x020c('0x3d')]+'%'};return _0x200d1a;})});}_0x229484=_[_0x020c('0x3e')]({},_0x229484,_0x14de22['options']);return _0x42d136[_0x020c('0x4b')](_0x229484);}})[_0x020c('0x25')](function(_0xdc3854){if(_0xdc3854){_0x3e28ed=_0xdc3854[_0x020c('0x37')];if(!_0x14de22[_0x020c('0x32')]['hasOwnProperty'](_0x020c('0x4d'))){_0x229484[_0x020c('0x1e')]=qs[_0x020c('0x1e')](_0x14de22[_0x020c('0x32')]['limit']);_0x229484[_0x020c('0x1d')]=qs[_0x020c('0x1d')](_0x14de22[_0x020c('0x32')][_0x020c('0x1d')]);}return _0x42d136[_0x020c('0x4b')](_0x229484);}})[_0x020c('0x25')](function(_0x44d3fc){if(_0x44d3fc){return _0x44d3fc?{'count':_0x3e28ed,'rows':_0x44d3fc}:null;}})['then'](respondWithResult(_0x7e1c10,null))['catch'](handleError(_0x7e1c10,null));};exports[_0x020c('0x4e')]=function(_0x4af6c5,_0x159722,_0x3f0fb3){var _0x792303={};var _0x1cda4c={};var _0x570f01;var _0x351503;return db['FreshsalesConfiguration'][_0x020c('0x4f')]({'where':{'id':_0x4af6c5[_0x020c('0x49')]['id']}})[_0x020c('0x25')](handleEntityNotFound(_0x159722,null))[_0x020c('0x25')](function(_0x26ce74){if(_0x26ce74){_0x570f01=_0x26ce74;_0x1cda4c[_0x020c('0x31')]=_[_0x020c('0x33')](db[_0x020c('0x4c')][_0x020c('0x2d')]);_0x1cda4c[_0x020c('0x32')]=_[_0x020c('0x33')](_0x4af6c5[_0x020c('0x32')]);_0x1cda4c[_0x020c('0x3b')]=_[_0x020c('0x35')](_0x1cda4c['model'],_0x1cda4c[_0x020c('0x32')]);_0x792303['attributes']=_['intersection'](_0x1cda4c[_0x020c('0x31')],qs['fields'](_0x4af6c5[_0x020c('0x32')][_0x020c('0x36')]));_0x792303[_0x020c('0x34')]=_0x792303[_0x020c('0x34')][_0x020c('0x37')]?_0x792303[_0x020c('0x34')]:_0x1cda4c[_0x020c('0x31')];_0x792303[_0x020c('0x39')]=qs[_0x020c('0x3a')](_0x4af6c5[_0x020c('0x32')][_0x020c('0x3a')]);_0x792303[_0x020c('0x3f')]=qs[_0x020c('0x3b')](_['pick'](_0x4af6c5['query'],_0x1cda4c[_0x020c('0x3b')]));if(_0x4af6c5[_0x020c('0x32')][_0x020c('0x3d')]){_0x792303[_0x020c('0x3f')]=_[_0x020c('0x3e')](_0x792303[_0x020c('0x3f')],{'$or':_[_0x020c('0x40')](_0x792303[_0x020c('0x34')],function(_0x3250aa){var _0x532e71={};_0x532e71[_0x3250aa]={'$like':'%'+_0x4af6c5[_0x020c('0x32')][_0x020c('0x3d')]+'%'};return _0x532e71;})});}_0x792303=_['merge']({},_0x792303,_0x4af6c5[_0x020c('0x42')]);return _0x570f01['getDescriptions'](_0x792303);}})[_0x020c('0x25')](function(_0x4241c8){if(_0x4241c8){_0x351503=_0x4241c8[_0x020c('0x37')];if(!_0x4af6c5[_0x020c('0x32')][_0x020c('0x38')](_0x020c('0x4d'))){_0x792303[_0x020c('0x1e')]=qs['limit'](_0x4af6c5['query']['limit']);_0x792303['offset']=qs[_0x020c('0x1d')](_0x4af6c5[_0x020c('0x32')][_0x020c('0x1d')]);}return _0x570f01[_0x020c('0x4e')](_0x792303);}})[_0x020c('0x25')](function(_0x29a0ab){if(_0x29a0ab){return _0x29a0ab?{'count':_0x351503,'rows':_0x29a0ab}:null;}})[_0x020c('0x25')](respondWithResult(_0x159722,null))[_0x020c('0x45')](handleError(_0x159722,null));};exports[_0x020c('0x50')]=function(_0x124e17,_0x17b9c7,_0x486bfa){var _0x4b06be={};var _0x4912a6={};var _0x4a89bb;var _0x1d0fea;return db['FreshsalesConfiguration'][_0x020c('0x4f')]({'where':{'id':_0x124e17[_0x020c('0x49')]['id']}})['then'](handleEntityNotFound(_0x17b9c7,null))[_0x020c('0x25')](function(_0x3c9716){if(_0x3c9716){_0x4a89bb=_0x3c9716;_0x4912a6[_0x020c('0x31')]=_[_0x020c('0x33')](db[_0x020c('0x4c')][_0x020c('0x2d')]);_0x4912a6['query']=_[_0x020c('0x33')](_0x124e17['query']);_0x4912a6[_0x020c('0x3b')]=_[_0x020c('0x35')](_0x4912a6[_0x020c('0x31')],_0x4912a6[_0x020c('0x32')]);_0x4b06be[_0x020c('0x34')]=_['intersection'](_0x4912a6[_0x020c('0x31')],qs['fields'](_0x124e17[_0x020c('0x32')][_0x020c('0x36')]));_0x4b06be[_0x020c('0x34')]=_0x4b06be[_0x020c('0x34')][_0x020c('0x37')]?_0x4b06be[_0x020c('0x34')]:_0x4912a6[_0x020c('0x31')];_0x4b06be[_0x020c('0x39')]=qs[_0x020c('0x3a')](_0x124e17[_0x020c('0x32')][_0x020c('0x3a')]);_0x4b06be[_0x020c('0x3f')]=qs[_0x020c('0x3b')](_[_0x020c('0x3c')](_0x124e17['query'],_0x4912a6[_0x020c('0x3b')]));if(_0x124e17[_0x020c('0x32')][_0x020c('0x3d')]){_0x4b06be[_0x020c('0x3f')]=_[_0x020c('0x3e')](_0x4b06be[_0x020c('0x3f')],{'$or':_['map'](_0x4b06be[_0x020c('0x34')],function(_0x2786af){var _0x565def={};_0x565def[_0x2786af]={'$like':'%'+_0x124e17[_0x020c('0x32')][_0x020c('0x3d')]+'%'};return _0x565def;})});}_0x4b06be=_[_0x020c('0x3e')]({},_0x4b06be,_0x124e17[_0x020c('0x42')]);return _0x4a89bb[_0x020c('0x50')](_0x4b06be);}})[_0x020c('0x25')](function(_0x2d27f9){if(_0x2d27f9){_0x1d0fea=_0x2d27f9[_0x020c('0x37')];if(!_0x124e17[_0x020c('0x32')][_0x020c('0x38')](_0x020c('0x4d'))){_0x4b06be[_0x020c('0x1e')]=qs[_0x020c('0x1e')](_0x124e17[_0x020c('0x32')][_0x020c('0x1e')]);_0x4b06be['offset']=qs[_0x020c('0x1d')](_0x124e17[_0x020c('0x32')][_0x020c('0x1d')]);}return _0x4a89bb['getFields'](_0x4b06be);}})[_0x020c('0x25')](function(_0x168859){if(_0x168859){return _0x168859?{'count':_0x1d0fea,'rows':_0x168859}:null;}})[_0x020c('0x25')](respondWithResult(_0x17b9c7,null))['catch'](handleError(_0x17b9c7,null));}; \ No newline at end of file +var _0xad16=['save','update','then','destroy','end','error','stack','name','index','map','rawAttributes','fieldName','type','key','query','keys','filters','intersection','fields','attributes','length','model','hasOwnProperty','order','sort','filter','where','VIRTUAL','merge','options','FreshsalesConfiguration','rows','catch','show','params','includeAll','include','create','body','find','getSubjects','FreshsalesField','pick','nolimit','getDescriptions','findOne','getFields','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject'];(function(_0x181e74,_0x2b5f59){var _0x17cd3e=function(_0x515d04){while(--_0x515d04){_0x181e74['push'](_0x181e74['shift']());}};_0x17cd3e(++_0x2b5f59);}(_0xad16,0xcf));var _0x6ad1=function(_0x3e853c,_0x64d7b1){_0x3e853c=_0x3e853c-0x0;var _0xf71546=_0xad16[_0x3e853c];return _0xf71546;};'use strict';var emlformat=require(_0x6ad1('0x0'));var rimraf=require(_0x6ad1('0x1'));var zipdir=require(_0x6ad1('0x2'));var jsonpatch=require(_0x6ad1('0x3'));var rp=require(_0x6ad1('0x4'));var moment=require('moment');var BPromise=require(_0x6ad1('0x5'));var Mustache=require('mustache');var util=require(_0x6ad1('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x6ad1('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x6ad1('0x8'));var squel=require(_0x6ad1('0x9'));var crypto=require(_0x6ad1('0xa'));var jsforce=require(_0x6ad1('0xb'));var deskjs=require(_0x6ad1('0xc'));var toCsv=require(_0x6ad1('0x7'));var querystring=require(_0x6ad1('0xd'));var Papa=require('papaparse');var Redis=require(_0x6ad1('0xe'));var authService=require(_0x6ad1('0xf'));var qs=require(_0x6ad1('0x10'));var as=require(_0x6ad1('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x6ad1('0x12'))('api');var utils=require(_0x6ad1('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x6ad1('0x14'));var db=require(_0x6ad1('0x15'))['db'];function respondWithStatusCode(_0x2f7666,_0x5d50a3){_0x5d50a3=_0x5d50a3||0xcc;return function(_0x6da4c2){if(_0x6da4c2){return _0x2f7666[_0x6ad1('0x16')](_0x5d50a3);}return _0x2f7666[_0x6ad1('0x17')](_0x5d50a3)['end']();};}function respondWithResult(_0x5169b7,_0x1b04b9){_0x1b04b9=_0x1b04b9||0xc8;return function(_0x34114a){if(_0x34114a){return _0x5169b7[_0x6ad1('0x17')](_0x1b04b9)[_0x6ad1('0x18')](_0x34114a);}};}function respondWithFilteredResult(_0x1d84c7,_0x4d4aca){return function(_0x1ba716){if(_0x1ba716){var _0x6dd848=typeof _0x4d4aca[_0x6ad1('0x19')]===_0x6ad1('0x1a')&&typeof _0x4d4aca[_0x6ad1('0x1b')]===_0x6ad1('0x1a');var _0x591031=_0x1ba716['count'];var _0x5721bc=_0x6dd848?0x0:_0x4d4aca['offset'];var _0xfb3dd8=_0x6dd848?_0x1ba716[_0x6ad1('0x1c')]:_0x4d4aca['offset']+_0x4d4aca[_0x6ad1('0x1b')];var _0x4342ce;if(_0xfb3dd8>=_0x591031){_0xfb3dd8=_0x591031;_0x4342ce=0xc8;}else{_0x4342ce=0xce;}_0x1d84c7['status'](_0x4342ce);return _0x1d84c7[_0x6ad1('0x1d')](_0x6ad1('0x1e'),_0x5721bc+'-'+_0xfb3dd8+'/'+_0x591031)['json'](_0x1ba716);}return null;};}function patchUpdates(_0x2f22e3){return function(_0x182d41){try{jsonpatch[_0x6ad1('0x1f')](_0x182d41,_0x2f22e3,!![]);}catch(_0x833dbd){return BPromise[_0x6ad1('0x20')](_0x833dbd);}return _0x182d41[_0x6ad1('0x21')]();};}function saveUpdates(_0x598f42,_0x191be4){return function(_0x5ddfc3){if(_0x5ddfc3){return _0x5ddfc3[_0x6ad1('0x22')](_0x598f42)[_0x6ad1('0x23')](function(_0x461843){return _0x461843;});}return null;};}function removeEntity(_0xe81785,_0x4a4166){return function(_0x58b15d){if(_0x58b15d){return _0x58b15d[_0x6ad1('0x24')]()['then'](function(){_0xe81785[_0x6ad1('0x17')](0xcc)[_0x6ad1('0x25')]();});}};}function handleEntityNotFound(_0x38863a,_0x4084dc){return function(_0x35b649){if(!_0x35b649){_0x38863a[_0x6ad1('0x16')](0x194);}return _0x35b649;};}function handleError(_0x4af396,_0x468a8f){_0x468a8f=_0x468a8f||0x1f4;return function(_0x38ccb4){logger[_0x6ad1('0x26')](_0x38ccb4[_0x6ad1('0x27')]);if(_0x38ccb4[_0x6ad1('0x28')]){delete _0x38ccb4[_0x6ad1('0x28')];}_0x4af396[_0x6ad1('0x17')](_0x468a8f)['send'](_0x38ccb4);};}exports[_0x6ad1('0x29')]=function(_0x1449f1,_0x4e8cd8){var _0x1ba048={},_0x41ac52={},_0x12f555={'count':0x0,'rows':[]};var _0x58d499=_[_0x6ad1('0x2a')](db['FreshsalesConfiguration'][_0x6ad1('0x2b')],function(_0x1e2115){return{'name':_0x1e2115[_0x6ad1('0x2c')],'type':_0x1e2115[_0x6ad1('0x2d')][_0x6ad1('0x2e')]};});_0x41ac52['model']=_['map'](_0x58d499,_0x6ad1('0x28'));_0x41ac52[_0x6ad1('0x2f')]=_[_0x6ad1('0x30')](_0x1449f1['query']);_0x41ac52[_0x6ad1('0x31')]=_[_0x6ad1('0x32')](_0x41ac52['model'],_0x41ac52[_0x6ad1('0x2f')]);_0x1ba048['attributes']=_[_0x6ad1('0x32')](_0x41ac52['model'],qs[_0x6ad1('0x33')](_0x1449f1[_0x6ad1('0x2f')][_0x6ad1('0x33')]));_0x1ba048[_0x6ad1('0x34')]=_0x1ba048[_0x6ad1('0x34')][_0x6ad1('0x35')]?_0x1ba048[_0x6ad1('0x34')]:_0x41ac52[_0x6ad1('0x36')];if(!_0x1449f1['query'][_0x6ad1('0x37')]('nolimit')){_0x1ba048[_0x6ad1('0x1b')]=qs['limit'](_0x1449f1[_0x6ad1('0x2f')][_0x6ad1('0x1b')]);_0x1ba048[_0x6ad1('0x19')]=qs[_0x6ad1('0x19')](_0x1449f1[_0x6ad1('0x2f')]['offset']);}_0x1ba048[_0x6ad1('0x38')]=qs[_0x6ad1('0x39')](_0x1449f1[_0x6ad1('0x2f')][_0x6ad1('0x39')]);_0x1ba048['where']=qs[_0x6ad1('0x31')](_['pick'](_0x1449f1[_0x6ad1('0x2f')],_0x41ac52[_0x6ad1('0x31')]),_0x58d499);if(_0x1449f1[_0x6ad1('0x2f')][_0x6ad1('0x3a')]){_0x1ba048['where']=_['merge'](_0x1ba048[_0x6ad1('0x3b')],{'$or':_[_0x6ad1('0x2a')](_0x58d499,function(_0x25d4ef){if(_0x25d4ef[_0x6ad1('0x2d')]!==_0x6ad1('0x3c')){var _0x352842={};_0x352842[_0x25d4ef[_0x6ad1('0x28')]]={'$like':'%'+_0x1449f1[_0x6ad1('0x2f')][_0x6ad1('0x3a')]+'%'};return _0x352842;}})});}_0x1ba048=_[_0x6ad1('0x3d')]({},_0x1ba048,_0x1449f1[_0x6ad1('0x3e')]);var _0x3899d9={'where':_0x1ba048[_0x6ad1('0x3b')]};return db[_0x6ad1('0x3f')][_0x6ad1('0x1c')](_0x3899d9)[_0x6ad1('0x23')](function(_0xcf9d59){_0x12f555[_0x6ad1('0x1c')]=_0xcf9d59;if(_0x1449f1['query']['includeAll']){_0x1ba048['include']=[{'all':!![]}];}return db['FreshsalesConfiguration']['findAll'](_0x1ba048);})[_0x6ad1('0x23')](function(_0x3b24b3){_0x12f555[_0x6ad1('0x40')]=_0x3b24b3;return _0x12f555;})['then'](respondWithFilteredResult(_0x4e8cd8,_0x1ba048))[_0x6ad1('0x41')](handleError(_0x4e8cd8,null));};exports[_0x6ad1('0x42')]=function(_0x78c44d,_0x56717f){var _0xaa736e={'raw':![],'where':{'id':_0x78c44d[_0x6ad1('0x43')]['id']}},_0x43b222={};_0x43b222['model']=_[_0x6ad1('0x30')](db[_0x6ad1('0x3f')][_0x6ad1('0x2b')]);_0x43b222['query']=_[_0x6ad1('0x30')](_0x78c44d['query']);_0x43b222['filters']=_[_0x6ad1('0x32')](_0x43b222['model'],_0x43b222[_0x6ad1('0x2f')]);_0xaa736e[_0x6ad1('0x34')]=_[_0x6ad1('0x32')](_0x43b222[_0x6ad1('0x36')],qs[_0x6ad1('0x33')](_0x78c44d[_0x6ad1('0x2f')][_0x6ad1('0x33')]));_0xaa736e[_0x6ad1('0x34')]=_0xaa736e[_0x6ad1('0x34')][_0x6ad1('0x35')]?_0xaa736e[_0x6ad1('0x34')]:_0x43b222[_0x6ad1('0x36')];if(_0x78c44d[_0x6ad1('0x2f')][_0x6ad1('0x44')]){_0xaa736e[_0x6ad1('0x45')]=[{'all':!![]}];}_0xaa736e=_[_0x6ad1('0x3d')]({},_0xaa736e,_0x78c44d[_0x6ad1('0x3e')]);return db[_0x6ad1('0x3f')]['find'](_0xaa736e)[_0x6ad1('0x23')](handleEntityNotFound(_0x56717f,null))['then'](respondWithResult(_0x56717f,null))[_0x6ad1('0x41')](handleError(_0x56717f,null));};exports[_0x6ad1('0x46')]=function(_0x29d8ee,_0x335093){return db[_0x6ad1('0x3f')][_0x6ad1('0x46')](_0x29d8ee['body'],{})[_0x6ad1('0x23')](respondWithResult(_0x335093,0xc9))[_0x6ad1('0x41')](handleError(_0x335093,null));};exports['update']=function(_0x23d501,_0x8d6b25){if(_0x23d501[_0x6ad1('0x47')]['id']){delete _0x23d501[_0x6ad1('0x47')]['id'];}return db[_0x6ad1('0x3f')]['find']({'where':{'id':_0x23d501[_0x6ad1('0x43')]['id']}})['then'](handleEntityNotFound(_0x8d6b25,null))['then'](saveUpdates(_0x23d501[_0x6ad1('0x47')],null))[_0x6ad1('0x23')](respondWithResult(_0x8d6b25,null))[_0x6ad1('0x41')](handleError(_0x8d6b25,null));};exports[_0x6ad1('0x24')]=function(_0x10cab2,_0x2084e0){return db[_0x6ad1('0x3f')][_0x6ad1('0x48')]({'where':{'id':_0x10cab2['params']['id']}})[_0x6ad1('0x23')](handleEntityNotFound(_0x2084e0,null))[_0x6ad1('0x23')](removeEntity(_0x2084e0,null))[_0x6ad1('0x41')](handleError(_0x2084e0,null));};exports[_0x6ad1('0x49')]=function(_0x1c708f,_0x411503,_0x415337){var _0x2c3aa0={};var _0x57d843={};var _0x24951a;var _0x395083;return db[_0x6ad1('0x3f')]['findOne']({'where':{'id':_0x1c708f['params']['id']}})[_0x6ad1('0x23')](handleEntityNotFound(_0x411503,null))[_0x6ad1('0x23')](function(_0x302f4f){if(_0x302f4f){_0x24951a=_0x302f4f;_0x57d843[_0x6ad1('0x36')]=_['keys'](db[_0x6ad1('0x4a')][_0x6ad1('0x2b')]);_0x57d843[_0x6ad1('0x2f')]=_[_0x6ad1('0x30')](_0x1c708f[_0x6ad1('0x2f')]);_0x57d843[_0x6ad1('0x31')]=_['intersection'](_0x57d843['model'],_0x57d843['query']);_0x2c3aa0['attributes']=_[_0x6ad1('0x32')](_0x57d843[_0x6ad1('0x36')],qs[_0x6ad1('0x33')](_0x1c708f[_0x6ad1('0x2f')]['fields']));_0x2c3aa0[_0x6ad1('0x34')]=_0x2c3aa0[_0x6ad1('0x34')]['length']?_0x2c3aa0[_0x6ad1('0x34')]:_0x57d843['model'];_0x2c3aa0[_0x6ad1('0x38')]=qs[_0x6ad1('0x39')](_0x1c708f['query']['sort']);_0x2c3aa0[_0x6ad1('0x3b')]=qs['filters'](_[_0x6ad1('0x4b')](_0x1c708f[_0x6ad1('0x2f')],_0x57d843[_0x6ad1('0x31')]));if(_0x1c708f['query'][_0x6ad1('0x3a')]){_0x2c3aa0['where']=_[_0x6ad1('0x3d')](_0x2c3aa0['where'],{'$or':_[_0x6ad1('0x2a')](_0x2c3aa0[_0x6ad1('0x34')],function(_0x2c8653){var _0x3a7c09={};_0x3a7c09[_0x2c8653]={'$like':'%'+_0x1c708f[_0x6ad1('0x2f')][_0x6ad1('0x3a')]+'%'};return _0x3a7c09;})});}_0x2c3aa0=_[_0x6ad1('0x3d')]({},_0x2c3aa0,_0x1c708f[_0x6ad1('0x3e')]);return _0x24951a[_0x6ad1('0x49')](_0x2c3aa0);}})[_0x6ad1('0x23')](function(_0x2e79a6){if(_0x2e79a6){_0x395083=_0x2e79a6[_0x6ad1('0x35')];if(!_0x1c708f[_0x6ad1('0x2f')]['hasOwnProperty'](_0x6ad1('0x4c'))){_0x2c3aa0[_0x6ad1('0x1b')]=qs[_0x6ad1('0x1b')](_0x1c708f['query'][_0x6ad1('0x1b')]);_0x2c3aa0[_0x6ad1('0x19')]=qs['offset'](_0x1c708f[_0x6ad1('0x2f')][_0x6ad1('0x19')]);}return _0x24951a[_0x6ad1('0x49')](_0x2c3aa0);}})['then'](function(_0x2f74d8){if(_0x2f74d8){return _0x2f74d8?{'count':_0x395083,'rows':_0x2f74d8}:null;}})[_0x6ad1('0x23')](respondWithResult(_0x411503,null))['catch'](handleError(_0x411503,null));};exports[_0x6ad1('0x4d')]=function(_0x1b0d3e,_0x58fb71,_0x363023){var _0x3b73d6={};var _0x41426d={};var _0x551ee4;var _0x21d42f;return db[_0x6ad1('0x3f')][_0x6ad1('0x4e')]({'where':{'id':_0x1b0d3e[_0x6ad1('0x43')]['id']}})[_0x6ad1('0x23')](handleEntityNotFound(_0x58fb71,null))[_0x6ad1('0x23')](function(_0x160135){if(_0x160135){_0x551ee4=_0x160135;_0x41426d['model']=_[_0x6ad1('0x30')](db[_0x6ad1('0x4a')][_0x6ad1('0x2b')]);_0x41426d['query']=_[_0x6ad1('0x30')](_0x1b0d3e[_0x6ad1('0x2f')]);_0x41426d['filters']=_[_0x6ad1('0x32')](_0x41426d[_0x6ad1('0x36')],_0x41426d[_0x6ad1('0x2f')]);_0x3b73d6[_0x6ad1('0x34')]=_['intersection'](_0x41426d[_0x6ad1('0x36')],qs[_0x6ad1('0x33')](_0x1b0d3e[_0x6ad1('0x2f')][_0x6ad1('0x33')]));_0x3b73d6[_0x6ad1('0x34')]=_0x3b73d6[_0x6ad1('0x34')][_0x6ad1('0x35')]?_0x3b73d6[_0x6ad1('0x34')]:_0x41426d[_0x6ad1('0x36')];_0x3b73d6[_0x6ad1('0x38')]=qs[_0x6ad1('0x39')](_0x1b0d3e[_0x6ad1('0x2f')][_0x6ad1('0x39')]);_0x3b73d6[_0x6ad1('0x3b')]=qs[_0x6ad1('0x31')](_[_0x6ad1('0x4b')](_0x1b0d3e[_0x6ad1('0x2f')],_0x41426d[_0x6ad1('0x31')]));if(_0x1b0d3e[_0x6ad1('0x2f')][_0x6ad1('0x3a')]){_0x3b73d6[_0x6ad1('0x3b')]=_[_0x6ad1('0x3d')](_0x3b73d6[_0x6ad1('0x3b')],{'$or':_[_0x6ad1('0x2a')](_0x3b73d6[_0x6ad1('0x34')],function(_0x2cfcad){var _0x562283={};_0x562283[_0x2cfcad]={'$like':'%'+_0x1b0d3e[_0x6ad1('0x2f')][_0x6ad1('0x3a')]+'%'};return _0x562283;})});}_0x3b73d6=_[_0x6ad1('0x3d')]({},_0x3b73d6,_0x1b0d3e[_0x6ad1('0x3e')]);return _0x551ee4[_0x6ad1('0x4d')](_0x3b73d6);}})[_0x6ad1('0x23')](function(_0x54c374){if(_0x54c374){_0x21d42f=_0x54c374[_0x6ad1('0x35')];if(!_0x1b0d3e[_0x6ad1('0x2f')][_0x6ad1('0x37')](_0x6ad1('0x4c'))){_0x3b73d6[_0x6ad1('0x1b')]=qs[_0x6ad1('0x1b')](_0x1b0d3e[_0x6ad1('0x2f')][_0x6ad1('0x1b')]);_0x3b73d6[_0x6ad1('0x19')]=qs[_0x6ad1('0x19')](_0x1b0d3e[_0x6ad1('0x2f')][_0x6ad1('0x19')]);}return _0x551ee4['getDescriptions'](_0x3b73d6);}})[_0x6ad1('0x23')](function(_0x283f0c){if(_0x283f0c){return _0x283f0c?{'count':_0x21d42f,'rows':_0x283f0c}:null;}})[_0x6ad1('0x23')](respondWithResult(_0x58fb71,null))['catch'](handleError(_0x58fb71,null));};exports['getFields']=function(_0x196b1c,_0x796d33,_0x424f39){var _0x43078a={};var _0x588c0e={};var _0x261818;var _0x3d0562;return db[_0x6ad1('0x3f')]['findOne']({'where':{'id':_0x196b1c['params']['id']}})[_0x6ad1('0x23')](handleEntityNotFound(_0x796d33,null))[_0x6ad1('0x23')](function(_0x340aa2){if(_0x340aa2){_0x261818=_0x340aa2;_0x588c0e[_0x6ad1('0x36')]=_[_0x6ad1('0x30')](db[_0x6ad1('0x4a')]['rawAttributes']);_0x588c0e[_0x6ad1('0x2f')]=_[_0x6ad1('0x30')](_0x196b1c[_0x6ad1('0x2f')]);_0x588c0e['filters']=_[_0x6ad1('0x32')](_0x588c0e[_0x6ad1('0x36')],_0x588c0e[_0x6ad1('0x2f')]);_0x43078a[_0x6ad1('0x34')]=_['intersection'](_0x588c0e['model'],qs['fields'](_0x196b1c[_0x6ad1('0x2f')]['fields']));_0x43078a[_0x6ad1('0x34')]=_0x43078a[_0x6ad1('0x34')][_0x6ad1('0x35')]?_0x43078a[_0x6ad1('0x34')]:_0x588c0e[_0x6ad1('0x36')];_0x43078a[_0x6ad1('0x38')]=qs[_0x6ad1('0x39')](_0x196b1c[_0x6ad1('0x2f')][_0x6ad1('0x39')]);_0x43078a[_0x6ad1('0x3b')]=qs['filters'](_['pick'](_0x196b1c[_0x6ad1('0x2f')],_0x588c0e[_0x6ad1('0x31')]));if(_0x196b1c[_0x6ad1('0x2f')]['filter']){_0x43078a[_0x6ad1('0x3b')]=_['merge'](_0x43078a[_0x6ad1('0x3b')],{'$or':_['map'](_0x43078a[_0x6ad1('0x34')],function(_0xee4f9f){var _0x5d75e5={};_0x5d75e5[_0xee4f9f]={'$like':'%'+_0x196b1c[_0x6ad1('0x2f')][_0x6ad1('0x3a')]+'%'};return _0x5d75e5;})});}_0x43078a=_[_0x6ad1('0x3d')]({},_0x43078a,_0x196b1c[_0x6ad1('0x3e')]);return _0x261818['getFields'](_0x43078a);}})[_0x6ad1('0x23')](function(_0x5ac0d1){if(_0x5ac0d1){_0x3d0562=_0x5ac0d1['length'];if(!_0x196b1c[_0x6ad1('0x2f')][_0x6ad1('0x37')](_0x6ad1('0x4c'))){_0x43078a[_0x6ad1('0x1b')]=qs[_0x6ad1('0x1b')](_0x196b1c[_0x6ad1('0x2f')][_0x6ad1('0x1b')]);_0x43078a[_0x6ad1('0x19')]=qs[_0x6ad1('0x19')](_0x196b1c[_0x6ad1('0x2f')][_0x6ad1('0x19')]);}return _0x261818[_0x6ad1('0x4f')](_0x43078a);}})[_0x6ad1('0x23')](function(_0x452cc4){if(_0x452cc4){return _0x452cc4?{'count':_0x3d0562,'rows':_0x452cc4}:null;}})[_0x6ad1('0x23')](respondWithResult(_0x796d33,null))[_0x6ad1('0x41')](handleError(_0x796d33,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js index fa347b0..8f4c017 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 _0x4d61=['int_freshsales_configurations','lodash','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intFreshsalesConfiguration.attributes','exports','define','FreshsalesConfiguration'];(function(_0x2e87e9,_0xc68b2d){var _0x1a315f=function(_0x415978){while(--_0x415978){_0x2e87e9['push'](_0x2e87e9['shift']());}};_0x1a315f(++_0xc68b2d);}(_0x4d61,0xc1));var _0x14d6=function(_0xb598fd,_0x57515c){_0xb598fd=_0xb598fd-0x0;var _0x17bbb8=_0x4d61[_0xb598fd];return _0x17bbb8;};'use strict';var _=require(_0x14d6('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x14d6('0x1'));var BPromise=require(_0x14d6('0x2'));var rp=require(_0x14d6('0x3'));var fs=require('fs');var path=require(_0x14d6('0x4'));var rimraf=require(_0x14d6('0x5'));var config=require(_0x14d6('0x6'));var attributes=require(_0x14d6('0x7'));module[_0x14d6('0x8')]=function(_0x4b9177,_0x53da0f){return _0x4b9177[_0x14d6('0x9')](_0x14d6('0xa'),attributes,{'tableName':_0x14d6('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfbee=['FreshsalesConfiguration','int_freshsales_configurations','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./intFreshsalesConfiguration.attributes','exports'];(function(_0xf51c06,_0x388e5b){var _0x1d5420=function(_0x5e077b){while(--_0x5e077b){_0xf51c06['push'](_0xf51c06['shift']());}};_0x1d5420(++_0x388e5b);}(_0xfbee,0x16e));var _0xefbe=function(_0x3825f5,_0xf7f8b0){_0x3825f5=_0x3825f5-0x0;var _0x185be9=_0xfbee[_0x3825f5];return _0x185be9;};'use strict';var _=require(_0xefbe('0x0'));var util=require(_0xefbe('0x1'));var logger=require(_0xefbe('0x2'))(_0xefbe('0x3'));var moment=require(_0xefbe('0x4'));var BPromise=require(_0xefbe('0x5'));var rp=require(_0xefbe('0x6'));var fs=require('fs');var path=require(_0xefbe('0x7'));var rimraf=require(_0xefbe('0x8'));var config=require('../../config/environment');var attributes=require(_0xefbe('0x9'));module[_0xefbe('0xa')]=function(_0x4e3412,_0x5d1d0a){return _0x4e3412['define'](_0xefbe('0xb'),attributes,{'tableName':_0xefbe('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.rpc.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.rpc.js index 7f05028..8b5dd95 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 _0x7840=['moment','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','request','then','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','info','catch','lodash','util'];(function(_0x5733db,_0x15f421){var _0x239bc5=function(_0x1daae5){while(--_0x1daae5){_0x5733db['push'](_0x5733db['shift']());}};_0x239bc5(++_0x15f421);}(_0x7840,0xa9));var _0x0784=function(_0x29e3c3,_0x46e7e2){_0x29e3c3=_0x29e3c3-0x0;var _0x1f5530=_0x7840[_0x29e3c3];return _0x1f5530;};'use strict';var _=require(_0x0784('0x0'));var util=require(_0x0784('0x1'));var moment=require(_0x0784('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0784('0x3'))['db'];var utils=require(_0x0784('0x4'));var logger=require(_0x0784('0x5'))('rpc');var config=require(_0x0784('0x6'));var jayson=require(_0x0784('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x5b3486,_0x322880,_0x2f8b18){return new BPromise(function(_0x4d3137,_0x3d0747){return client[_0x0784('0x8')](_0x5b3486,_0x2f8b18)[_0x0784('0x9')](function(_0x56198f){logger['info'](_0x0784('0xa'),_0x322880,_0x0784('0xb'));logger[_0x0784('0xc')](_0x0784('0xd'),_0x322880,_0x0784('0xb'),JSON[_0x0784('0xe')](_0x56198f));if(_0x56198f['error']){if(_0x56198f['error']['code']===0x1f4){logger[_0x0784('0xf')](_0x0784('0xa'),_0x322880,_0x56198f[_0x0784('0xf')][_0x0784('0x10')]);return _0x3d0747(_0x56198f['error'][_0x0784('0x10')]);}logger[_0x0784('0xf')](_0x0784('0xa'),_0x322880,_0x56198f[_0x0784('0xf')][_0x0784('0x10')]);return _0x4d3137(_0x56198f[_0x0784('0xf')][_0x0784('0x10')]);}else{logger[_0x0784('0x11')](_0x0784('0xa'),_0x322880,_0x0784('0xb'));_0x4d3137(_0x56198f['result'][_0x0784('0x10')]);}})[_0x0784('0x12')](function(_0x426002){logger[_0x0784('0xf')](_0x0784('0xa'),_0x322880,_0x426002);_0x3d0747(_0x426002);});});} \ No newline at end of file +var _0xd14c=['rpc','../../config/environment','jayson/promise','request','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x5ad5f0,_0x484b49){var _0x2d8865=function(_0x1575ed){while(--_0x1575ed){_0x5ad5f0['push'](_0x5ad5f0['shift']());}};_0x2d8865(++_0x484b49);}(_0xd14c,0x1db));var _0xcd14=function(_0x5d0fcf,_0xa23aa1){_0x5d0fcf=_0x5d0fcf-0x0;var _0x40c760=_0xd14c[_0x5d0fcf];return _0x40c760;};'use strict';var _=require(_0xcd14('0x0'));var util=require(_0xcd14('0x1'));var moment=require(_0xcd14('0x2'));var BPromise=require(_0xcd14('0x3'));var rs=require(_0xcd14('0x4'));var fs=require('fs');var Redis=require(_0xcd14('0x5'));var db=require(_0xcd14('0x6'))['db'];var utils=require(_0xcd14('0x7'));var logger=require(_0xcd14('0x8'))(_0xcd14('0x9'));var config=require(_0xcd14('0xa'));var jayson=require(_0xcd14('0xb'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x46319c,_0x70da5c,_0x5839bb){return new BPromise(function(_0xcd3ab6,_0x301196){return client[_0xcd14('0xc')](_0x46319c,_0x5839bb)['then'](function(_0x4db9a5){logger['info'](_0xcd14('0xd'),_0x70da5c,_0xcd14('0xe'));logger[_0xcd14('0xf')]('FreshsalesConfiguration,\x20%s,\x20%s,\x20%s',_0x70da5c,'request\x20sent',JSON[_0xcd14('0x10')](_0x4db9a5));if(_0x4db9a5[_0xcd14('0x11')]){if(_0x4db9a5['error'][_0xcd14('0x12')]===0x1f4){logger[_0xcd14('0x11')](_0xcd14('0xd'),_0x70da5c,_0x4db9a5[_0xcd14('0x11')][_0xcd14('0x13')]);return _0x301196(_0x4db9a5[_0xcd14('0x11')][_0xcd14('0x13')]);}logger['error'](_0xcd14('0xd'),_0x70da5c,_0x4db9a5[_0xcd14('0x11')][_0xcd14('0x13')]);return _0xcd3ab6(_0x4db9a5[_0xcd14('0x11')][_0xcd14('0x13')]);}else{logger[_0xcd14('0x14')](_0xcd14('0xd'),_0x70da5c,_0xcd14('0xe'));_0xcd3ab6(_0x4db9a5[_0xcd14('0x15')][_0xcd14('0x13')]);}})['catch'](function(_0x2b972d){logger[_0xcd14('0x11')](_0xcd14('0xd'),_0x70da5c,_0x2b972d);_0x301196(_0x2b972d);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesField/index.js b/server/api/intFreshsalesField/index.js index b875f68..3d16904 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 _0x5178=['../../config/environment','get','index','/:id','isAuthenticated','show','delete','destroy','exports','util','path','connect-timeout','express','Router','../../components/interaction/service'];(function(_0x582aa2,_0x4d6ca3){var _0x4377cd=function(_0x56aa24){while(--_0x56aa24){_0x582aa2['push'](_0x582aa2['shift']());}};_0x4377cd(++_0x4d6ca3);}(_0x5178,0x171));var _0x8517=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x5178[_0x3bf83f];return _0x22c4a9;};'use strict';var multer=require('multer');var util=require(_0x8517('0x0'));var path=require(_0x8517('0x1'));var timeout=require(_0x8517('0x2'));var express=require(_0x8517('0x3'));var router=express[_0x8517('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x8517('0x5'));var config=require(_0x8517('0x6'));var controller=require('./intFreshsalesField.controller');router[_0x8517('0x7')]('/',auth['isAuthenticated'](),controller[_0x8517('0x8')]);router[_0x8517('0x7')](_0x8517('0x9'),auth[_0x8517('0xa')](),controller[_0x8517('0xb')]);router['post']('/',auth[_0x8517('0xa')](),controller['create']);router['put'](_0x8517('0x9'),auth[_0x8517('0xa')](),controller['update']);router[_0x8517('0xc')](_0x8517('0x9'),auth[_0x8517('0xa')](),controller[_0x8517('0xd')]);module[_0x8517('0xe')]=router; \ No newline at end of file +var _0xbe02=['update','delete','exports','util','path','connect-timeout','fs-extra','../../components/auth/service','../../config/environment','./intFreshsalesField.controller','get','isAuthenticated','index','/:id','show','post','put'];(function(_0x254a62,_0x44b04f){var _0x4f2f6a=function(_0x2cb4f){while(--_0x2cb4f){_0x254a62['push'](_0x254a62['shift']());}};_0x4f2f6a(++_0x44b04f);}(_0xbe02,0x124));var _0x2be0=function(_0x315063,_0x3d9206){_0x315063=_0x315063-0x0;var _0x4105bd=_0xbe02[_0x315063];return _0x4105bd;};'use strict';var multer=require('multer');var util=require(_0x2be0('0x0'));var path=require(_0x2be0('0x1'));var timeout=require(_0x2be0('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x2be0('0x3'));var auth=require(_0x2be0('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x2be0('0x5'));var controller=require(_0x2be0('0x6'));router[_0x2be0('0x7')]('/',auth[_0x2be0('0x8')](),controller[_0x2be0('0x9')]);router[_0x2be0('0x7')](_0x2be0('0xa'),auth['isAuthenticated'](),controller[_0x2be0('0xb')]);router[_0x2be0('0xc')]('/',auth['isAuthenticated'](),controller['create']);router[_0x2be0('0xd')]('/:id',auth[_0x2be0('0x8')](),controller[_0x2be0('0xe')]);router[_0x2be0('0xf')](_0x2be0('0xa'),auth[_0x2be0('0x8')](),controller['destroy']);module[_0x2be0('0x10')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.attributes.js b/server/api/intFreshsalesField/intFreshsalesField.attributes.js index 8732899..24c38c9 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 _0xafbe=['BOOLEAN','sequelize','string','variable','customVariable','keyValue','STRING','ENUM'];(function(_0x32a81f,_0x4eee66){var _0x5b67a2=function(_0x35d368){while(--_0x35d368){_0x32a81f['push'](_0x32a81f['shift']());}};_0x5b67a2(++_0x4eee66);}(_0xafbe,0x71));var _0xeafb=function(_0x352e09,_0x37a7da){_0x352e09=_0x352e09-0x0;var _0x1b7094=_0xafbe[_0x352e09];return _0x1b7094;};'use strict';var Sequelize=require(_0xeafb('0x0'));module['exports']={'type':{'type':Sequelize['ENUM'](_0xeafb('0x1'),_0xeafb('0x2'),_0xeafb('0x3'),_0xeafb('0x4'),'picklist'),'defaultValue':_0xeafb('0x1')},'content':{'type':Sequelize[_0xeafb('0x5')]},'key':{'type':Sequelize[_0xeafb('0x5')]},'keyType':{'type':Sequelize[_0xeafb('0x6')]('string',_0xeafb('0x2'),_0xeafb('0x3'))},'keyContent':{'type':Sequelize[_0xeafb('0x5')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0xeafb('0x5')]},'customField':{'type':Sequelize[_0xeafb('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xf3a9=['BOOLEAN','sequelize','exports','string','variable','keyValue','picklist','STRING','ENUM','customVariable'];(function(_0xadffc4,_0xb45497){var _0x1d63df=function(_0x1a5343){while(--_0x1a5343){_0xadffc4['push'](_0xadffc4['shift']());}};_0x1d63df(++_0xb45497);}(_0xf3a9,0xb5));var _0x9f3a=function(_0x4ef009,_0x19ade1){_0x4ef009=_0x4ef009-0x0;var _0x3c74b4=_0xf3a9[_0x4ef009];return _0x3c74b4;};'use strict';var Sequelize=require(_0x9f3a('0x0'));module[_0x9f3a('0x1')]={'type':{'type':Sequelize['ENUM'](_0x9f3a('0x2'),_0x9f3a('0x3'),'customVariable',_0x9f3a('0x4'),_0x9f3a('0x5')),'defaultValue':_0x9f3a('0x2')},'content':{'type':Sequelize[_0x9f3a('0x6')]},'key':{'type':Sequelize[_0x9f3a('0x6')]},'keyType':{'type':Sequelize[_0x9f3a('0x7')]('string',_0x9f3a('0x3'),_0x9f3a('0x8'))},'keyContent':{'type':Sequelize[_0x9f3a('0x6')]},'idField':{'type':Sequelize[_0x9f3a('0x6')]},'nameField':{'type':Sequelize[_0x9f3a('0x6')]},'customField':{'type':Sequelize[_0x9f3a('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x9f3a('0x6')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.controller.js b/server/api/intFreshsalesField/intFreshsalesField.controller.js index a066256..5bac04d 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 _0x5ccb=['then','destroy','error','stack','name','send','index','map','FreshsalesField','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','params','catch','create','body','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','update'];(function(_0x68e1fd,_0x20d810){var _0x3aba1f=function(_0x40f3d2){while(--_0x40f3d2){_0x68e1fd['push'](_0x68e1fd['shift']());}};_0x3aba1f(++_0x20d810);}(_0x5ccb,0x197));var _0xb5cc=function(_0x575783,_0x4f66f6){_0x575783=_0x575783-0x0;var _0x1aeae0=_0x5ccb[_0x575783];return _0x1aeae0;};'use strict';var emlformat=require(_0xb5cc('0x0'));var rimraf=require(_0xb5cc('0x1'));var zipdir=require(_0xb5cc('0x2'));var jsonpatch=require(_0xb5cc('0x3'));var rp=require(_0xb5cc('0x4'));var moment=require('moment');var BPromise=require(_0xb5cc('0x5'));var Mustache=require(_0xb5cc('0x6'));var util=require(_0xb5cc('0x7'));var path=require(_0xb5cc('0x8'));var sox=require(_0xb5cc('0x9'));var csv=require(_0xb5cc('0xa'));var ejs=require(_0xb5cc('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb5cc('0xc'));var squel=require(_0xb5cc('0xd'));var crypto=require('crypto');var jsforce=require(_0xb5cc('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xb5cc('0xf'));var Papa=require('papaparse');var Redis=require(_0xb5cc('0x10'));var authService=require(_0xb5cc('0x11'));var qs=require(_0xb5cc('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xb5cc('0x13'))(_0xb5cc('0x14'));var utils=require(_0xb5cc('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xb5cc('0x16'));var db=require(_0xb5cc('0x17'))['db'];function respondWithStatusCode(_0x285e5e,_0x48ac4b){_0x48ac4b=_0x48ac4b||0xcc;return function(_0x38b1d6){if(_0x38b1d6){return _0x285e5e[_0xb5cc('0x18')](_0x48ac4b);}return _0x285e5e['status'](_0x48ac4b)[_0xb5cc('0x19')]();};}function respondWithResult(_0x5abbbd,_0x2751fb){_0x2751fb=_0x2751fb||0xc8;return function(_0x1a56dc){if(_0x1a56dc){return _0x5abbbd[_0xb5cc('0x1a')](_0x2751fb)[_0xb5cc('0x1b')](_0x1a56dc);}};}function respondWithFilteredResult(_0x21e92f,_0x4cb0d6){return function(_0x37d457){if(_0x37d457){var _0x24a39b=typeof _0x4cb0d6[_0xb5cc('0x1c')]===_0xb5cc('0x1d')&&typeof _0x4cb0d6[_0xb5cc('0x1e')]===_0xb5cc('0x1d');var _0x487f61=_0x37d457['count'];var _0x59c604=_0x24a39b?0x0:_0x4cb0d6[_0xb5cc('0x1c')];var _0x552d8e=_0x24a39b?_0x37d457[_0xb5cc('0x1f')]:_0x4cb0d6[_0xb5cc('0x1c')]+_0x4cb0d6[_0xb5cc('0x1e')];var _0xd4c130;if(_0x552d8e>=_0x487f61){_0x552d8e=_0x487f61;_0xd4c130=0xc8;}else{_0xd4c130=0xce;}_0x21e92f['status'](_0xd4c130);return _0x21e92f[_0xb5cc('0x20')](_0xb5cc('0x21'),_0x59c604+'-'+_0x552d8e+'/'+_0x487f61)[_0xb5cc('0x1b')](_0x37d457);}return null;};}function patchUpdates(_0x45483c){return function(_0x2b8e00){try{jsonpatch[_0xb5cc('0x22')](_0x2b8e00,_0x45483c,!![]);}catch(_0x40c7e0){return BPromise['reject'](_0x40c7e0);}return _0x2b8e00[_0xb5cc('0x23')]();};}function saveUpdates(_0xd22ef9,_0x3e20d5){return function(_0x245056){if(_0x245056){return _0x245056[_0xb5cc('0x24')](_0xd22ef9)[_0xb5cc('0x25')](function(_0x58a966){return _0x58a966;});}return null;};}function removeEntity(_0x7b0db9,_0x57d55c){return function(_0x5e7bbc){if(_0x5e7bbc){return _0x5e7bbc[_0xb5cc('0x26')]()[_0xb5cc('0x25')](function(){_0x7b0db9[_0xb5cc('0x1a')](0xcc)[_0xb5cc('0x19')]();});}};}function handleEntityNotFound(_0x57f1d3,_0x2593a8){return function(_0x17f6de){if(!_0x17f6de){_0x57f1d3[_0xb5cc('0x18')](0x194);}return _0x17f6de;};}function handleError(_0x2e47ae,_0x1cb2f0){_0x1cb2f0=_0x1cb2f0||0x1f4;return function(_0xf96e14){logger[_0xb5cc('0x27')](_0xf96e14[_0xb5cc('0x28')]);if(_0xf96e14['name']){delete _0xf96e14[_0xb5cc('0x29')];}_0x2e47ae['status'](_0x1cb2f0)[_0xb5cc('0x2a')](_0xf96e14);};}exports[_0xb5cc('0x2b')]=function(_0x2e3f71,_0x58699c){var _0xdecaad={},_0x404fdb={},_0x500e55={'count':0x0,'rows':[]};var _0x438daa=_[_0xb5cc('0x2c')](db[_0xb5cc('0x2d')]['rawAttributes'],function(_0x37f187){return{'name':_0x37f187[_0xb5cc('0x2e')],'type':_0x37f187[_0xb5cc('0x2f')][_0xb5cc('0x30')]};});_0x404fdb[_0xb5cc('0x31')]=_['map'](_0x438daa,_0xb5cc('0x29'));_0x404fdb[_0xb5cc('0x32')]=_[_0xb5cc('0x33')](_0x2e3f71[_0xb5cc('0x32')]);_0x404fdb[_0xb5cc('0x34')]=_['intersection'](_0x404fdb['model'],_0x404fdb[_0xb5cc('0x32')]);_0xdecaad['attributes']=_[_0xb5cc('0x35')](_0x404fdb[_0xb5cc('0x31')],qs['fields'](_0x2e3f71['query'][_0xb5cc('0x36')]));_0xdecaad[_0xb5cc('0x37')]=_0xdecaad['attributes'][_0xb5cc('0x38')]?_0xdecaad[_0xb5cc('0x37')]:_0x404fdb['model'];if(!_0x2e3f71[_0xb5cc('0x32')]['hasOwnProperty'](_0xb5cc('0x39'))){_0xdecaad[_0xb5cc('0x1e')]=qs[_0xb5cc('0x1e')](_0x2e3f71[_0xb5cc('0x32')]['limit']);_0xdecaad[_0xb5cc('0x1c')]=qs[_0xb5cc('0x1c')](_0x2e3f71['query'][_0xb5cc('0x1c')]);}_0xdecaad[_0xb5cc('0x3a')]=qs[_0xb5cc('0x3b')](_0x2e3f71[_0xb5cc('0x32')][_0xb5cc('0x3b')]);_0xdecaad[_0xb5cc('0x3c')]=qs['filters'](_[_0xb5cc('0x3d')](_0x2e3f71[_0xb5cc('0x32')],_0x404fdb[_0xb5cc('0x34')]),_0x438daa);if(_0x2e3f71['query'][_0xb5cc('0x3e')]){_0xdecaad[_0xb5cc('0x3c')]=_[_0xb5cc('0x3f')](_0xdecaad[_0xb5cc('0x3c')],{'$or':_[_0xb5cc('0x2c')](_0x438daa,function(_0x2754bc){if(_0x2754bc[_0xb5cc('0x2f')]!==_0xb5cc('0x40')){var _0x306579={};_0x306579[_0x2754bc[_0xb5cc('0x29')]]={'$like':'%'+_0x2e3f71[_0xb5cc('0x32')][_0xb5cc('0x3e')]+'%'};return _0x306579;}})});}_0xdecaad=_[_0xb5cc('0x3f')]({},_0xdecaad,_0x2e3f71[_0xb5cc('0x41')]);var _0x44aa3e={'where':_0xdecaad[_0xb5cc('0x3c')]};return db['FreshsalesField']['count'](_0x44aa3e)[_0xb5cc('0x25')](function(_0x4dad9e){_0x500e55[_0xb5cc('0x1f')]=_0x4dad9e;if(_0x2e3f71[_0xb5cc('0x32')][_0xb5cc('0x42')]){_0xdecaad['include']=[{'all':!![]}];}return db[_0xb5cc('0x2d')][_0xb5cc('0x43')](_0xdecaad);})[_0xb5cc('0x25')](function(_0x1446dd){_0x500e55[_0xb5cc('0x44')]=_0x1446dd;return _0x500e55;})['then'](respondWithFilteredResult(_0x58699c,_0xdecaad))['catch'](handleError(_0x58699c,null));};exports['show']=function(_0x5f0dfa,_0x5b014e){var _0x1e61cc={'raw':!![],'where':{'id':_0x5f0dfa[_0xb5cc('0x45')]['id']}},_0x188c2b={};_0x188c2b[_0xb5cc('0x31')]=_[_0xb5cc('0x33')](db[_0xb5cc('0x2d')]['rawAttributes']);_0x188c2b[_0xb5cc('0x32')]=_['keys'](_0x5f0dfa[_0xb5cc('0x32')]);_0x188c2b[_0xb5cc('0x34')]=_[_0xb5cc('0x35')](_0x188c2b[_0xb5cc('0x31')],_0x188c2b[_0xb5cc('0x32')]);_0x1e61cc['attributes']=_['intersection'](_0x188c2b[_0xb5cc('0x31')],qs[_0xb5cc('0x36')](_0x5f0dfa[_0xb5cc('0x32')][_0xb5cc('0x36')]));_0x1e61cc['attributes']=_0x1e61cc[_0xb5cc('0x37')][_0xb5cc('0x38')]?_0x1e61cc[_0xb5cc('0x37')]:_0x188c2b[_0xb5cc('0x31')];if(_0x5f0dfa['query'][_0xb5cc('0x42')]){_0x1e61cc['include']=[{'all':!![]}];}_0x1e61cc=_['merge']({},_0x1e61cc,_0x5f0dfa[_0xb5cc('0x41')]);return db[_0xb5cc('0x2d')]['find'](_0x1e61cc)[_0xb5cc('0x25')](handleEntityNotFound(_0x5b014e,null))[_0xb5cc('0x25')](respondWithResult(_0x5b014e,null))[_0xb5cc('0x46')](handleError(_0x5b014e,null));};exports[_0xb5cc('0x47')]=function(_0x258ffb,_0x59f076){return db[_0xb5cc('0x2d')]['create'](_0x258ffb[_0xb5cc('0x48')],{})['then'](respondWithResult(_0x59f076,0xc9))[_0xb5cc('0x46')](handleError(_0x59f076,null));};exports[_0xb5cc('0x24')]=function(_0x2a00be,_0x5be7dd){if(_0x2a00be['body']['id']){delete _0x2a00be['body']['id'];}return db[_0xb5cc('0x2d')][_0xb5cc('0x49')]({'where':{'id':_0x2a00be[_0xb5cc('0x45')]['id']}})[_0xb5cc('0x25')](handleEntityNotFound(_0x5be7dd,null))['then'](saveUpdates(_0x2a00be[_0xb5cc('0x48')],null))[_0xb5cc('0x25')](respondWithResult(_0x5be7dd,null))[_0xb5cc('0x46')](handleError(_0x5be7dd,null));};exports[_0xb5cc('0x26')]=function(_0x144dbb,_0x18d4fe){return db[_0xb5cc('0x2d')][_0xb5cc('0x49')]({'where':{'id':_0x144dbb['params']['id']}})['then'](handleEntityNotFound(_0x18d4fe,null))[_0xb5cc('0x25')](removeEntity(_0x18d4fe,null))[_0xb5cc('0x46')](handleError(_0x18d4fe,null));}; \ No newline at end of file +var _0x6158=['../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','apply','reject','save','then','destroy','end','error','name','send','map','FreshsalesField','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','include','findAll','rows','catch','show','includeAll','find','create','body','update','params','rimraf','fast-json-patch','request-promise','moment','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis'];(function(_0x52c9f2,_0x202a11){var _0x535949=function(_0x2d77e2){while(--_0x2d77e2){_0x52c9f2['push'](_0x52c9f2['shift']());}};_0x535949(++_0x202a11);}(_0x6158,0x110));var _0x8615=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6158[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8615('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8615('0x1'));var rp=require(_0x8615('0x2'));var moment=require(_0x8615('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x8615('0x4'));var path=require(_0x8615('0x5'));var sox=require(_0x8615('0x6'));var csv=require(_0x8615('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8615('0x8'));var _=require(_0x8615('0x9'));var squel=require(_0x8615('0xa'));var crypto=require(_0x8615('0xb'));var jsforce=require(_0x8615('0xc'));var deskjs=require(_0x8615('0xd'));var toCsv=require('to-csv');var querystring=require(_0x8615('0xe'));var Papa=require('papaparse');var Redis=require(_0x8615('0xf'));var authService=require(_0x8615('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x8615('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8615('0x12'))('api');var utils=require(_0x8615('0x13'));var config=require(_0x8615('0x14'));var licenseUtil=require(_0x8615('0x15'));var db=require(_0x8615('0x16'))['db'];function respondWithStatusCode(_0x250493,_0xd40ff2){_0xd40ff2=_0xd40ff2||0xcc;return function(_0x43c92a){if(_0x43c92a){return _0x250493[_0x8615('0x17')](_0xd40ff2);}return _0x250493[_0x8615('0x18')](_0xd40ff2)['end']();};}function respondWithResult(_0x287405,_0xfd2e9e){_0xfd2e9e=_0xfd2e9e||0xc8;return function(_0x268035){if(_0x268035){return _0x287405[_0x8615('0x18')](_0xfd2e9e)[_0x8615('0x19')](_0x268035);}};}function respondWithFilteredResult(_0x5d5bf8,_0x2777c2){return function(_0x36a9c5){if(_0x36a9c5){var _0x34f8e7=typeof _0x2777c2[_0x8615('0x1a')]===_0x8615('0x1b')&&typeof _0x2777c2[_0x8615('0x1c')]===_0x8615('0x1b');var _0x863c60=_0x36a9c5[_0x8615('0x1d')];var _0x1abe43=_0x34f8e7?0x0:_0x2777c2[_0x8615('0x1a')];var _0xf25b9b=_0x34f8e7?_0x36a9c5[_0x8615('0x1d')]:_0x2777c2[_0x8615('0x1a')]+_0x2777c2[_0x8615('0x1c')];var _0x14c9fc;if(_0xf25b9b>=_0x863c60){_0xf25b9b=_0x863c60;_0x14c9fc=0xc8;}else{_0x14c9fc=0xce;}_0x5d5bf8[_0x8615('0x18')](_0x14c9fc);return _0x5d5bf8[_0x8615('0x1e')]('Content-Range',_0x1abe43+'-'+_0xf25b9b+'/'+_0x863c60)[_0x8615('0x19')](_0x36a9c5);}return null;};}function patchUpdates(_0x2612b1){return function(_0x3e4e6c){try{jsonpatch[_0x8615('0x1f')](_0x3e4e6c,_0x2612b1,!![]);}catch(_0x55d07f){return BPromise[_0x8615('0x20')](_0x55d07f);}return _0x3e4e6c[_0x8615('0x21')]();};}function saveUpdates(_0x2654da,_0x59d6c1){return function(_0x4d1db9){if(_0x4d1db9){return _0x4d1db9['update'](_0x2654da)[_0x8615('0x22')](function(_0x27295b){return _0x27295b;});}return null;};}function removeEntity(_0x4e45ec,_0x1c0fc6){return function(_0x105bb3){if(_0x105bb3){return _0x105bb3[_0x8615('0x23')]()[_0x8615('0x22')](function(){_0x4e45ec['status'](0xcc)[_0x8615('0x24')]();});}};}function handleEntityNotFound(_0x4d1811,_0x49f165){return function(_0x4e2ae8){if(!_0x4e2ae8){_0x4d1811[_0x8615('0x17')](0x194);}return _0x4e2ae8;};}function handleError(_0x2c7af5,_0x394b46){_0x394b46=_0x394b46||0x1f4;return function(_0x317464){logger[_0x8615('0x25')](_0x317464['stack']);if(_0x317464[_0x8615('0x26')]){delete _0x317464[_0x8615('0x26')];}_0x2c7af5['status'](_0x394b46)[_0x8615('0x27')](_0x317464);};}exports['index']=function(_0x310ab7,_0x5034c3){var _0x325ee6={},_0x1a6377={},_0x93844f={'count':0x0,'rows':[]};var _0x28c94b=_[_0x8615('0x28')](db[_0x8615('0x29')][_0x8615('0x2a')],function(_0x3ef5f6){return{'name':_0x3ef5f6[_0x8615('0x2b')],'type':_0x3ef5f6[_0x8615('0x2c')][_0x8615('0x2d')]};});_0x1a6377[_0x8615('0x2e')]=_[_0x8615('0x28')](_0x28c94b,_0x8615('0x26'));_0x1a6377['query']=_[_0x8615('0x2f')](_0x310ab7[_0x8615('0x30')]);_0x1a6377[_0x8615('0x31')]=_[_0x8615('0x32')](_0x1a6377['model'],_0x1a6377[_0x8615('0x30')]);_0x325ee6[_0x8615('0x33')]=_[_0x8615('0x32')](_0x1a6377['model'],qs[_0x8615('0x34')](_0x310ab7['query']['fields']));_0x325ee6[_0x8615('0x33')]=_0x325ee6['attributes'][_0x8615('0x35')]?_0x325ee6[_0x8615('0x33')]:_0x1a6377[_0x8615('0x2e')];if(!_0x310ab7[_0x8615('0x30')][_0x8615('0x36')](_0x8615('0x37'))){_0x325ee6[_0x8615('0x1c')]=qs[_0x8615('0x1c')](_0x310ab7['query'][_0x8615('0x1c')]);_0x325ee6[_0x8615('0x1a')]=qs[_0x8615('0x1a')](_0x310ab7[_0x8615('0x30')][_0x8615('0x1a')]);}_0x325ee6['order']=qs[_0x8615('0x38')](_0x310ab7[_0x8615('0x30')][_0x8615('0x38')]);_0x325ee6[_0x8615('0x39')]=qs['filters'](_[_0x8615('0x3a')](_0x310ab7[_0x8615('0x30')],_0x1a6377[_0x8615('0x31')]),_0x28c94b);if(_0x310ab7[_0x8615('0x30')][_0x8615('0x3b')]){_0x325ee6[_0x8615('0x39')]=_[_0x8615('0x3c')](_0x325ee6['where'],{'$or':_['map'](_0x28c94b,function(_0x1b6729){if(_0x1b6729['type']!=='VIRTUAL'){var _0x4e3897={};_0x4e3897[_0x1b6729[_0x8615('0x26')]]={'$like':'%'+_0x310ab7[_0x8615('0x30')][_0x8615('0x3b')]+'%'};return _0x4e3897;}})});}_0x325ee6=_['merge']({},_0x325ee6,_0x310ab7['options']);var _0x40a4d7={'where':_0x325ee6[_0x8615('0x39')]};return db[_0x8615('0x29')][_0x8615('0x1d')](_0x40a4d7)['then'](function(_0x43ae39){_0x93844f[_0x8615('0x1d')]=_0x43ae39;if(_0x310ab7[_0x8615('0x30')]['includeAll']){_0x325ee6[_0x8615('0x3d')]=[{'all':!![]}];}return db[_0x8615('0x29')][_0x8615('0x3e')](_0x325ee6);})[_0x8615('0x22')](function(_0x446c12){_0x93844f[_0x8615('0x3f')]=_0x446c12;return _0x93844f;})['then'](respondWithFilteredResult(_0x5034c3,_0x325ee6))[_0x8615('0x40')](handleError(_0x5034c3,null));};exports[_0x8615('0x41')]=function(_0x1ff92e,_0x42cee9){var _0xdf102c={'raw':!![],'where':{'id':_0x1ff92e['params']['id']}},_0x321685={};_0x321685[_0x8615('0x2e')]=_[_0x8615('0x2f')](db['FreshsalesField'][_0x8615('0x2a')]);_0x321685[_0x8615('0x30')]=_[_0x8615('0x2f')](_0x1ff92e['query']);_0x321685[_0x8615('0x31')]=_[_0x8615('0x32')](_0x321685['model'],_0x321685['query']);_0xdf102c[_0x8615('0x33')]=_[_0x8615('0x32')](_0x321685[_0x8615('0x2e')],qs[_0x8615('0x34')](_0x1ff92e['query']['fields']));_0xdf102c['attributes']=_0xdf102c[_0x8615('0x33')][_0x8615('0x35')]?_0xdf102c[_0x8615('0x33')]:_0x321685[_0x8615('0x2e')];if(_0x1ff92e['query'][_0x8615('0x42')]){_0xdf102c['include']=[{'all':!![]}];}_0xdf102c=_[_0x8615('0x3c')]({},_0xdf102c,_0x1ff92e['options']);return db[_0x8615('0x29')][_0x8615('0x43')](_0xdf102c)[_0x8615('0x22')](handleEntityNotFound(_0x42cee9,null))[_0x8615('0x22')](respondWithResult(_0x42cee9,null))[_0x8615('0x40')](handleError(_0x42cee9,null));};exports[_0x8615('0x44')]=function(_0x4ec9f0,_0x5c4e6c){return db['FreshsalesField']['create'](_0x4ec9f0[_0x8615('0x45')],{})[_0x8615('0x22')](respondWithResult(_0x5c4e6c,0xc9))['catch'](handleError(_0x5c4e6c,null));};exports[_0x8615('0x46')]=function(_0x166fbc,_0x1047e5){if(_0x166fbc[_0x8615('0x45')]['id']){delete _0x166fbc[_0x8615('0x45')]['id'];}return db[_0x8615('0x29')][_0x8615('0x43')]({'where':{'id':_0x166fbc[_0x8615('0x47')]['id']}})[_0x8615('0x22')](handleEntityNotFound(_0x1047e5,null))[_0x8615('0x22')](saveUpdates(_0x166fbc[_0x8615('0x45')],null))[_0x8615('0x22')](respondWithResult(_0x1047e5,null))[_0x8615('0x40')](handleError(_0x1047e5,null));};exports[_0x8615('0x23')]=function(_0x1fb10a,_0x5befde){return db[_0x8615('0x29')][_0x8615('0x43')]({'where':{'id':_0x1fb10a['params']['id']}})[_0x8615('0x22')](handleEntityNotFound(_0x5befde,null))[_0x8615('0x22')](removeEntity(_0x5befde,null))[_0x8615('0x40')](handleError(_0x5befde,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.model.js b/server/api/intFreshsalesField/intFreshsalesField.model.js index 2863371..faa709b 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 _0x7cdc=['bluebird','request-promise','rimraf','../../config/environment','exports','define','FreshsalesField','int_freshsales_fields','freshsales_unique_index','FieldId','util','../../config/logger','moment'];(function(_0x56bad1,_0x2fd451){var _0x50ec6b=function(_0x4d0864){while(--_0x4d0864){_0x56bad1['push'](_0x56bad1['shift']());}};_0x50ec6b(++_0x2fd451);}(_0x7cdc,0x190));var _0xc7cd=function(_0x5a7ab3,_0x3232a3){_0x5a7ab3=_0x5a7ab3-0x0;var _0x26891f=_0x7cdc[_0x5a7ab3];return _0x26891f;};'use strict';var _=require('lodash');var util=require(_0xc7cd('0x0'));var logger=require(_0xc7cd('0x1'))('api');var moment=require(_0xc7cd('0x2'));var BPromise=require(_0xc7cd('0x3'));var rp=require(_0xc7cd('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc7cd('0x5'));var config=require(_0xc7cd('0x6'));var attributes=require('./intFreshsalesField.attributes');module[_0xc7cd('0x7')]=function(_0x26603f,_0x18bb1b){return _0x26603f[_0xc7cd('0x8')](_0xc7cd('0x9'),attributes,{'tableName':_0xc7cd('0xa'),'paranoid':![],'indexes':[{'name':_0xc7cd('0xb'),'fields':['idField',_0xc7cd('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x2cf5=['../../config/environment','./intFreshsalesField.attributes','exports','define','FreshsalesField','int_freshsales_fields','freshsales_unique_index','idField','FieldId','lodash','util','api','bluebird','request-promise'];(function(_0x5aaf93,_0x5c0001){var _0x17d307=function(_0x21d77a){while(--_0x21d77a){_0x5aaf93['push'](_0x5aaf93['shift']());}};_0x17d307(++_0x5c0001);}(_0x2cf5,0x19f));var _0x52cf=function(_0x43120a,_0x283299){_0x43120a=_0x43120a-0x0;var _0x2f5ef1=_0x2cf5[_0x43120a];return _0x2f5ef1;};'use strict';var _=require(_0x52cf('0x0'));var util=require(_0x52cf('0x1'));var logger=require('../../config/logger')(_0x52cf('0x2'));var moment=require('moment');var BPromise=require(_0x52cf('0x3'));var rp=require(_0x52cf('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x52cf('0x5'));var attributes=require(_0x52cf('0x6'));module[_0x52cf('0x7')]=function(_0x1001bd,_0x31185d){return _0x1001bd[_0x52cf('0x8')](_0x52cf('0x9'),attributes,{'tableName':_0x52cf('0xa'),'paranoid':![],'indexes':[{'name':_0x52cf('0xb'),'fields':[_0x52cf('0xc'),_0x52cf('0xd')],'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 cd4a36b..b501f71 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 _0x1261=['then','info','FreshsalesField,\x20%s,\x20%s','request\x20sent','FreshsalesField,\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(_0x383c9f,_0x2b77d8){var _0x54f472=function(_0x3da1f2){while(--_0x3da1f2){_0x383c9f['push'](_0x383c9f['shift']());}};_0x54f472(++_0x2b77d8);}(_0x1261,0x144));var _0x1126=function(_0x56aac9,_0x197362){_0x56aac9=_0x56aac9-0x0;var _0x139b0d=_0x1261[_0x56aac9];return _0x139b0d;};'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')]('FreshsalesField,\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 _0x7c09=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','then','info','FreshsalesField,\x20%s,\x20%s','FreshsalesField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','util','moment'];(function(_0x547890,_0x593741){var _0x2c8daa=function(_0x1b100d){while(--_0x1b100d){_0x547890['push'](_0x547890['shift']());}};_0x2c8daa(++_0x593741);}(_0x7c09,0x102));var _0x97c0=function(_0xa2ed73,_0x4fc43d){_0xa2ed73=_0xa2ed73-0x0;var _0x3fbc8f=_0x7c09[_0xa2ed73];return _0x3fbc8f;};'use strict';var _=require('lodash');var util=require(_0x97c0('0x0'));var moment=require(_0x97c0('0x1'));var BPromise=require('bluebird');var rs=require(_0x97c0('0x2'));var fs=require('fs');var Redis=require(_0x97c0('0x3'));var db=require(_0x97c0('0x4'))['db'];var utils=require(_0x97c0('0x5'));var logger=require(_0x97c0('0x6'))(_0x97c0('0x7'));var config=require(_0x97c0('0x8'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x46fdd9,_0x42c6c7,_0x2c19fa){return new BPromise(function(_0x109bc8,_0x293785){return client['request'](_0x46fdd9,_0x2c19fa)[_0x97c0('0x9')](function(_0x4ac5f1){logger[_0x97c0('0xa')](_0x97c0('0xb'),_0x42c6c7,'request\x20sent');logger['debug'](_0x97c0('0xc'),_0x42c6c7,_0x97c0('0xd'),JSON[_0x97c0('0xe')](_0x4ac5f1));if(_0x4ac5f1[_0x97c0('0xf')]){if(_0x4ac5f1[_0x97c0('0xf')][_0x97c0('0x10')]===0x1f4){logger[_0x97c0('0xf')](_0x97c0('0xb'),_0x42c6c7,_0x4ac5f1[_0x97c0('0xf')][_0x97c0('0x11')]);return _0x293785(_0x4ac5f1[_0x97c0('0xf')][_0x97c0('0x11')]);}logger[_0x97c0('0xf')]('FreshsalesField,\x20%s,\x20%s',_0x42c6c7,_0x4ac5f1[_0x97c0('0xf')][_0x97c0('0x11')]);return _0x109bc8(_0x4ac5f1[_0x97c0('0xf')]['message']);}else{logger[_0x97c0('0xa')](_0x97c0('0xb'),_0x42c6c7,_0x97c0('0xd'));_0x109bc8(_0x4ac5f1[_0x97c0('0x12')][_0x97c0('0x11')]);}})[_0x97c0('0x13')](function(_0x49c0d9){logger[_0x97c0('0xf')](_0x97c0('0xb'),_0x42c6c7,_0x49c0d9);_0x293785(_0x49c0d9);});});} \ No newline at end of file diff --git a/server/api/intSalesforceAccount/index.js b/server/api/intSalesforceAccount/index.js index 75028d0..33d95f9 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(_0x52b650,_0x233668){var _0x8744ce=function(_0x4c7ea8){while(--_0x4c7ea8){_0x52b650['push'](_0x52b650['shift']());}};_0x8744ce(++_0x233668);}(_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'));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(_0x4615e7,_0x421e92){var _0x509d99=function(_0xc08171){while(--_0xc08171){_0x4615e7['push'](_0x4615e7['shift']());}};_0x509d99(++_0x421e92);}(_0x9957,0x93));var _0x7995=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x9957[_0x2f5ac5];return _0x37c9a8;};'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 7459057..cf87e38 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 _0x79d7=['sequelize','STRING','username','newTab'];(function(_0x563185,_0x260830){var _0x2e8c66=function(_0x1cde65){while(--_0x1cde65){_0x563185['push'](_0x563185['shift']());}};_0x2e8c66(++_0x260830);}(_0x79d7,0x9c));var _0x779d=function(_0x2064e5,_0x4f6fa2){_0x2064e5=_0x2064e5-0x0;var _0x21a233=_0x79d7[_0x2064e5];return _0x21a233;};'use strict';var Sequelize=require(_0x779d('0x0'));module['exports']={'name':{'type':Sequelize[_0x779d('0x1')]},'description':{'type':Sequelize[_0x779d('0x1')]},'username':{'type':Sequelize[_0x779d('0x1')],'unique':_0x779d('0x2')},'remoteUri':{'type':Sequelize[_0x779d('0x1')]},'password':{'type':Sequelize[_0x779d('0x1')]},'clientId':{'type':Sequelize['STRING']},'clientSecret':{'type':Sequelize[_0x779d('0x1')]},'securityToken':{'type':Sequelize[_0x779d('0x1')]},'serverUrl':{'type':Sequelize[_0x779d('0x1')],'allowNull':![]},'type':{'type':Sequelize['ENUM']('integrationTab',_0x779d('0x3')),'defaultValue':'integrationTab'}}; \ No newline at end of file +var _0xfe39=['ENUM','integrationTab','newTab','sequelize','exports','STRING'];(function(_0x66cb,_0x128463){var _0x5a603a=function(_0x35d50f){while(--_0x35d50f){_0x66cb['push'](_0x66cb['shift']());}};_0x5a603a(++_0x128463);}(_0xfe39,0x1b3));var _0x9fe3=function(_0x46698a,_0x8de1e4){_0x46698a=_0x46698a-0x0;var _0x356db0=_0xfe39[_0x46698a];return _0x356db0;};'use strict';var Sequelize=require(_0x9fe3('0x0'));module[_0x9fe3('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x9fe3('0x2')]},'username':{'type':Sequelize['STRING'],'unique':'username'},'remoteUri':{'type':Sequelize[_0x9fe3('0x2')]},'password':{'type':Sequelize[_0x9fe3('0x2')]},'clientId':{'type':Sequelize['STRING']},'clientSecret':{'type':Sequelize['STRING']},'securityToken':{'type':Sequelize[_0x9fe3('0x2')]},'serverUrl':{'type':Sequelize[_0x9fe3('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x9fe3('0x3')](_0x9fe3('0x4'),_0x9fe3('0x5')),'defaultValue':_0x9fe3('0x4')}}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.controller.js b/server/api/intSalesforceAccount/intSalesforceAccount.controller.js index 8e86330..d23e644 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 _0x4398=['fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','../../components/integrations/configuration','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','sendStatus','error','send','index','SalesforceAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','where','merge','map','name','includeAll','findAll','then','rows','catch','show','params','intersection','include','find','create','body','update','destroy','getConfigurations','findOne','filter','addConfiguration','AccountId','getSubjects','channel','Descriptions','getDescriptions','SalesforceConfiguration','SalesforceField','Subjects','getFields','remoteUri','clientId','clientSecret','username','password','securityToken','slice','substring','lastIndexOf','Connection','login','isNil','ticketType','sobject','OwnerId','ActivityDate','IsReminderSet','IsRecurrence','Subject','Description','string','int','picklist','boolean','email','phone','remove','includes','label','custom','value','True','true','False','false','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','eml-format','rimraf','zip-dir'];(function(_0x4b8f8b,_0x3dccdc){var _0xc7bfde=function(_0x39afeb){while(--_0x39afeb){_0x4b8f8b['push'](_0x4b8f8b['shift']());}};_0xc7bfde(++_0x3dccdc);}(_0x4398,0xf9));var _0x8439=function(_0x4a0a3f,_0x2db267){_0x4a0a3f=_0x4a0a3f-0x0;var _0x4a0000=_0x4398[_0x4a0a3f];return _0x4a0000;};'use strict';var emlformat=require(_0x8439('0x0'));var rimraf=require(_0x8439('0x1'));var zipdir=require(_0x8439('0x2'));var jsonpatch=require(_0x8439('0x3'));var rp=require(_0x8439('0x4'));var moment=require(_0x8439('0x5'));var BPromise=require(_0x8439('0x6'));var Mustache=require(_0x8439('0x7'));var util=require(_0x8439('0x8'));var path=require(_0x8439('0x9'));var sox=require(_0x8439('0xa'));var csv=require('to-csv');var ejs=require(_0x8439('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8439('0xc'));var squel=require('squel');var crypto=require(_0x8439('0xd'));var jsforce=require(_0x8439('0xe'));var deskjs=require(_0x8439('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x8439('0x10'));var Redis=require(_0x8439('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x8439('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8439('0x13'));var logger=require(_0x8439('0x14'))('api');var utils=require('../../config/utils');var config=require(_0x8439('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x8439('0x16'))['db'];var integrations=require(_0x8439('0x17'));function respondWithStatusCode(_0x320cbe,_0x56ae24){_0x56ae24=_0x56ae24||0xcc;return function(_0x18bfcc){if(_0x18bfcc){return _0x320cbe['sendStatus'](_0x56ae24);}return _0x320cbe[_0x8439('0x18')](_0x56ae24)[_0x8439('0x19')]();};}function respondWithResult(_0x5a2cf3,_0x5b051e){_0x5b051e=_0x5b051e||0xc8;return function(_0x5cca26){if(_0x5cca26){return _0x5a2cf3[_0x8439('0x18')](_0x5b051e)[_0x8439('0x1a')](_0x5cca26);}};}function respondWithFilteredResult(_0xde62ac,_0xf0e603){return function(_0x2c64f4){if(_0x2c64f4){var _0x5d154d=typeof _0xf0e603[_0x8439('0x1b')]===_0x8439('0x1c')&&typeof _0xf0e603[_0x8439('0x1d')]===_0x8439('0x1c');var _0x3ce9ee=_0x2c64f4['count'];var _0x508ac0=_0x5d154d?0x0:_0xf0e603[_0x8439('0x1b')];var _0x181e7d=_0x5d154d?_0x2c64f4[_0x8439('0x1e')]:_0xf0e603['offset']+_0xf0e603[_0x8439('0x1d')];var _0x2b21b1;if(_0x181e7d>=_0x3ce9ee){_0x181e7d=_0x3ce9ee;_0x2b21b1=0xc8;}else{_0x2b21b1=0xce;}_0xde62ac[_0x8439('0x18')](_0x2b21b1);return _0xde62ac['set'](_0x8439('0x1f'),_0x508ac0+'-'+_0x181e7d+'/'+_0x3ce9ee)[_0x8439('0x1a')](_0x2c64f4);}return null;};}function patchUpdates(_0x25766b){return function(_0x49e6a3){try{jsonpatch[_0x8439('0x20')](_0x49e6a3,_0x25766b,!![]);}catch(_0x3d7e56){return BPromise[_0x8439('0x21')](_0x3d7e56);}return _0x49e6a3[_0x8439('0x22')]();};}function saveUpdates(_0x5b8aeb,_0x123fd4){return function(_0x1bb2b){if(_0x1bb2b){return _0x1bb2b['update'](_0x5b8aeb)['then'](function(_0xa65553){return _0xa65553;});}return null;};}function removeEntity(_0x563417,_0x4676f3){return function(_0x525ffd){if(_0x525ffd){return _0x525ffd['destroy']()['then'](function(){_0x563417[_0x8439('0x18')](0xcc)[_0x8439('0x19')]();});}};}function handleEntityNotFound(_0x455b0d,_0x209f22){return function(_0x37911f){if(!_0x37911f){_0x455b0d[_0x8439('0x23')](0x194);}return _0x37911f;};}function handleError(_0x368490,_0x5f151f){_0x5f151f=_0x5f151f||0x1f4;return function(_0x487e3d){logger[_0x8439('0x24')](_0x487e3d['stack']);if(_0x487e3d['name']){delete _0x487e3d['name'];}_0x368490[_0x8439('0x18')](_0x5f151f)[_0x8439('0x25')](_0x487e3d);};}exports[_0x8439('0x26')]=function(_0x209182,_0x42b181){var _0x89d5ce={},_0x455cbb={},_0xaac6c6={'count':0x0,'rows':[]};var _0x30add0=_['map'](db[_0x8439('0x27')][_0x8439('0x28')],function(_0x6ae86b){return{'name':_0x6ae86b[_0x8439('0x29')],'type':_0x6ae86b[_0x8439('0x2a')][_0x8439('0x2b')]};});_0x455cbb[_0x8439('0x2c')]=_['map'](_0x30add0,'name');_0x455cbb[_0x8439('0x2d')]=_[_0x8439('0x2e')](_0x209182[_0x8439('0x2d')]);_0x455cbb[_0x8439('0x2f')]=_['intersection'](_0x455cbb['model'],_0x455cbb[_0x8439('0x2d')]);_0x89d5ce['attributes']=_['intersection'](_0x455cbb[_0x8439('0x2c')],qs[_0x8439('0x30')](_0x209182[_0x8439('0x2d')][_0x8439('0x30')]));_0x89d5ce[_0x8439('0x31')]=_0x89d5ce[_0x8439('0x31')][_0x8439('0x32')]?_0x89d5ce[_0x8439('0x31')]:_0x455cbb[_0x8439('0x2c')];if(!_0x209182[_0x8439('0x2d')][_0x8439('0x33')](_0x8439('0x34'))){_0x89d5ce[_0x8439('0x1d')]=qs[_0x8439('0x1d')](_0x209182[_0x8439('0x2d')][_0x8439('0x1d')]);_0x89d5ce[_0x8439('0x1b')]=qs[_0x8439('0x1b')](_0x209182[_0x8439('0x2d')]['offset']);}_0x89d5ce[_0x8439('0x35')]=qs['sort'](_0x209182[_0x8439('0x2d')][_0x8439('0x36')]);_0x89d5ce['where']=qs[_0x8439('0x2f')](_[_0x8439('0x37')](_0x209182[_0x8439('0x2d')],_0x455cbb[_0x8439('0x2f')]),_0x30add0);if(_0x209182[_0x8439('0x2d')]['filter']){_0x89d5ce[_0x8439('0x38')]=_[_0x8439('0x39')](_0x89d5ce['where'],{'$or':_[_0x8439('0x3a')](_0x30add0,function(_0x584c91){if(_0x584c91['type']!=='VIRTUAL'){var _0x274863={};_0x274863[_0x584c91[_0x8439('0x3b')]]={'$like':'%'+_0x209182['query']['filter']+'%'};return _0x274863;}})});}_0x89d5ce=_['merge']({},_0x89d5ce,_0x209182['options']);var _0xb3f58f={'where':_0x89d5ce[_0x8439('0x38')]};return db[_0x8439('0x27')][_0x8439('0x1e')](_0xb3f58f)['then'](function(_0x5d7451){_0xaac6c6[_0x8439('0x1e')]=_0x5d7451;if(_0x209182[_0x8439('0x2d')][_0x8439('0x3c')]){_0x89d5ce['include']=[{'all':!![]}];}return db[_0x8439('0x27')][_0x8439('0x3d')](_0x89d5ce);})[_0x8439('0x3e')](function(_0x593328){_0xaac6c6[_0x8439('0x3f')]=_0x593328;return _0xaac6c6;})[_0x8439('0x3e')](respondWithFilteredResult(_0x42b181,_0x89d5ce))[_0x8439('0x40')](handleError(_0x42b181,null));};exports[_0x8439('0x41')]=function(_0x57d3df,_0x33fd87){var _0x54d4a1={'raw':![],'where':{'id':_0x57d3df[_0x8439('0x42')]['id']}},_0x30f3a8={};_0x30f3a8[_0x8439('0x2c')]=_[_0x8439('0x2e')](db[_0x8439('0x27')][_0x8439('0x28')]);_0x30f3a8[_0x8439('0x2d')]=_[_0x8439('0x2e')](_0x57d3df[_0x8439('0x2d')]);_0x30f3a8[_0x8439('0x2f')]=_[_0x8439('0x43')](_0x30f3a8['model'],_0x30f3a8[_0x8439('0x2d')]);_0x54d4a1['attributes']=_['intersection'](_0x30f3a8[_0x8439('0x2c')],qs[_0x8439('0x30')](_0x57d3df[_0x8439('0x2d')][_0x8439('0x30')]));_0x54d4a1[_0x8439('0x31')]=_0x54d4a1[_0x8439('0x31')][_0x8439('0x32')]?_0x54d4a1['attributes']:_0x30f3a8['model'];if(_0x57d3df[_0x8439('0x2d')][_0x8439('0x3c')]){_0x54d4a1[_0x8439('0x44')]=[{'all':!![]}];}_0x54d4a1=_['merge']({},_0x54d4a1,_0x57d3df['options']);return db[_0x8439('0x27')][_0x8439('0x45')](_0x54d4a1)[_0x8439('0x3e')](handleEntityNotFound(_0x33fd87,null))[_0x8439('0x3e')](respondWithResult(_0x33fd87,null))[_0x8439('0x40')](handleError(_0x33fd87,null));};exports[_0x8439('0x46')]=function(_0x39b471,_0x4677c0){return db[_0x8439('0x27')]['create'](_0x39b471[_0x8439('0x47')],{})[_0x8439('0x3e')](respondWithResult(_0x4677c0,0xc9))[_0x8439('0x40')](handleError(_0x4677c0,null));};exports[_0x8439('0x48')]=function(_0x553191,_0x3f9754){if(_0x553191[_0x8439('0x47')]['id']){delete _0x553191['body']['id'];}return db['SalesforceAccount']['find']({'where':{'id':_0x553191[_0x8439('0x42')]['id']}})['then'](handleEntityNotFound(_0x3f9754,null))[_0x8439('0x3e')](saveUpdates(_0x553191[_0x8439('0x47')],null))[_0x8439('0x3e')](respondWithResult(_0x3f9754,null))[_0x8439('0x40')](handleError(_0x3f9754,null));};exports[_0x8439('0x49')]=function(_0x31060b,_0xe5f139){return db[_0x8439('0x27')][_0x8439('0x45')]({'where':{'id':_0x31060b['params']['id']}})[_0x8439('0x3e')](handleEntityNotFound(_0xe5f139,null))[_0x8439('0x3e')](removeEntity(_0xe5f139,null))[_0x8439('0x40')](handleError(_0xe5f139,null));};exports[_0x8439('0x4a')]=function(_0x589110,_0x1fb0d1,_0x5f5a7d){var _0x500b22={};var _0x40dcb2={};var _0x4cd4dd;var _0x15bbba;return db[_0x8439('0x27')][_0x8439('0x4b')]({'where':{'id':_0x589110[_0x8439('0x42')]['id']}})['then'](handleEntityNotFound(_0x1fb0d1,null))[_0x8439('0x3e')](function(_0x27887b){if(_0x27887b){_0x4cd4dd=_0x27887b;_0x40dcb2[_0x8439('0x2c')]=_[_0x8439('0x2e')](db['SalesforceConfiguration'][_0x8439('0x28')]);_0x40dcb2[_0x8439('0x2d')]=_['keys'](_0x589110[_0x8439('0x2d')]);_0x40dcb2[_0x8439('0x2f')]=_[_0x8439('0x43')](_0x40dcb2['model'],_0x40dcb2['query']);_0x500b22['attributes']=_[_0x8439('0x43')](_0x40dcb2['model'],qs[_0x8439('0x30')](_0x589110['query'][_0x8439('0x30')]));_0x500b22[_0x8439('0x31')]=_0x500b22[_0x8439('0x31')][_0x8439('0x32')]?_0x500b22[_0x8439('0x31')]:_0x40dcb2[_0x8439('0x2c')];_0x500b22[_0x8439('0x35')]=qs['sort'](_0x589110[_0x8439('0x2d')][_0x8439('0x36')]);_0x500b22['where']=qs['filters'](_[_0x8439('0x37')](_0x589110[_0x8439('0x2d')],_0x40dcb2['filters']));if(_0x589110[_0x8439('0x2d')]['filter']){_0x500b22['where']=_[_0x8439('0x39')](_0x500b22[_0x8439('0x38')],{'$or':_['map'](_0x500b22[_0x8439('0x31')],function(_0xb302ff){var _0x356c2f={};_0x356c2f[_0xb302ff]={'$like':'%'+_0x589110[_0x8439('0x2d')][_0x8439('0x4c')]+'%'};return _0x356c2f;})});}_0x500b22=_[_0x8439('0x39')]({},_0x500b22,_0x589110['options']);return _0x4cd4dd[_0x8439('0x4a')](_0x500b22);}})[_0x8439('0x3e')](function(_0x5a52b1){if(_0x5a52b1){_0x15bbba=_0x5a52b1[_0x8439('0x32')];if(!_0x589110[_0x8439('0x2d')]['hasOwnProperty']('nolimit')){_0x500b22[_0x8439('0x1d')]=qs[_0x8439('0x1d')](_0x589110['query'][_0x8439('0x1d')]);_0x500b22[_0x8439('0x1b')]=qs[_0x8439('0x1b')](_0x589110[_0x8439('0x2d')][_0x8439('0x1b')]);}return _0x4cd4dd[_0x8439('0x4a')](_0x500b22);}})[_0x8439('0x3e')](function(_0x5c66eb){if(_0x5c66eb){return _0x5c66eb?{'count':_0x15bbba,'rows':_0x5c66eb}:null;}})[_0x8439('0x3e')](respondWithResult(_0x1fb0d1,null))[_0x8439('0x40')](handleError(_0x1fb0d1,null));};exports[_0x8439('0x4d')]=function(_0x8fdb33,_0x4a7226,_0x185b5c){if(_0x8fdb33[_0x8439('0x47')]['id']){delete _0x8fdb33[_0x8439('0x47')]['id'];}return db['SalesforceAccount'][_0x8439('0x4b')]({'where':{'id':_0x8fdb33[_0x8439('0x42')]['id']}})[_0x8439('0x3e')](handleEntityNotFound(_0x4a7226,null))['then'](function(_0x2581f5){if(_0x2581f5){_0x8fdb33[_0x8439('0x47')][_0x8439('0x4e')]=_0x2581f5['id'];_0x8fdb33[_0x8439('0x47')]['Subjects']=integrations[_0x8439('0x4f')](_0x8fdb33['body'][_0x8439('0x50')],_0x8fdb33[_0x8439('0x47')][_0x8439('0x2a')]);_0x8fdb33[_0x8439('0x47')][_0x8439('0x51')]=integrations[_0x8439('0x52')](_0x8fdb33[_0x8439('0x47')][_0x8439('0x50')],_0x8fdb33[_0x8439('0x47')]['type']);return db[_0x8439('0x53')][_0x8439('0x46')](_0x8fdb33[_0x8439('0x47')],{'include':[{'model':db[_0x8439('0x54')],'as':_0x8439('0x55')},{'model':db[_0x8439('0x54')],'as':_0x8439('0x51')}]});}return null;})[_0x8439('0x3e')](respondWithResult(_0x4a7226,null))[_0x8439('0x40')](handleError(_0x4a7226,null));};exports[_0x8439('0x56')]=function(_0x989ecd,_0x1c9de9,_0xee7efe){var _0xdd5ba7;var _0x2439aa='';var _0x40bc03='Task';return db[_0x8439('0x27')][_0x8439('0x4b')]({'where':{'id':_0x989ecd[_0x8439('0x42')]['id']},'attributes':['id',_0x8439('0x57'),_0x8439('0x58'),_0x8439('0x59'),_0x8439('0x5a'),_0x8439('0x5b'),_0x8439('0x5c')]})[_0x8439('0x3e')](handleEntityNotFound(_0x1c9de9,null))['then'](function(_0x4d1fb8){if(_0x4d1fb8){_0x2439aa=_0x4d1fb8[_0x8439('0x57')];var _0x211432=_0x2439aa[_0x8439('0x5d')](-0x1);if(_0x211432==='/'){_0x2439aa=_0x2439aa[_0x8439('0x5e')](0x0,_0x2439aa[_0x8439('0x5f')](_0x211432));}_0xdd5ba7=new jsforce[(_0x8439('0x60'))]({'oauth2':{'loginUrl':_0x2439aa,'clientId':_0x4d1fb8[_0x8439('0x58')],'clientSecret':_0x4d1fb8[_0x8439('0x59')]}});return _0xdd5ba7[_0x8439('0x61')](_0x4d1fb8[_0x8439('0x5a')],_0x4d1fb8[_0x8439('0x5b')]['concat'](_0x4d1fb8[_0x8439('0x5c')]));}})['then'](function(_0x3eb1cf){if(_0x3eb1cf){if(!_[_0x8439('0x62')](_0x989ecd['query'][_0x8439('0x63')])){_0x40bc03=_0x989ecd[_0x8439('0x2d')][_0x8439('0x63')];}return _0xdd5ba7[_0x8439('0x64')](_0x40bc03)['describe']();}})[_0x8439('0x3e')](function(_0xb590e8){var _0x8cf5cf=[_0x8439('0x65'),_0x8439('0x66'),_0x8439('0x67'),_0x8439('0x68'),_0x8439('0x69'),_0x8439('0x6a')];var _0x3c6d94=[_0x8439('0x6b'),_0x8439('0x6c'),_0x8439('0x6d'),_0x8439('0x6e'),_0x8439('0x6f'),'textarea',_0x8439('0x70')];if(_0xb590e8){_[_0x8439('0x71')](_0xb590e8['fields'],function(_0x4bd1da){return _0x8cf5cf[_0x8439('0x72')](_0x4bd1da['name'])||!_0x3c6d94[_0x8439('0x72')](_0x4bd1da['type']);});return{'count':_0xb590e8[_0x8439('0x30')][_0x8439('0x32')],'rows':_[_0x8439('0x3a')](_0xb590e8[_0x8439('0x30')],function(_0x4a389a){return{'id':_0x4a389a['name'],'name':_0x4a389a[_0x8439('0x73')],'custom':_0x4a389a[_0x8439('0x74')],'options':_0x4a389a['picklistValues'][_0x8439('0x32')]>0x0?_[_0x8439('0x3a')](_0x4a389a['picklistValues'],function(_0x3aee14){return{'name':_0x3aee14[_0x8439('0x73')],'value':_0x3aee14[_0x8439('0x75')]};}):_0x4a389a[_0x8439('0x2a')]==_0x8439('0x6e')?[{'name':_0x8439('0x76'),'value':_0x8439('0x77')},{'name':_0x8439('0x78'),'value':_0x8439('0x79')}]:[]};})};}})['then'](respondWithResult(_0x1c9de9,null))['catch'](function(_0x425f1a){var _0x3cec8a=_0x989ecd[_0x8439('0x2d')][_0x8439('0x7a')]?0x1f4:_0x425f1a[_0x8439('0x7b')]||0x1f4;logger[_0x8439('0x24')](_0x8439('0x7c'),_0x8439('0x56'),_0x3cec8a,JSON[_0x8439('0x7d')](_0x425f1a));delete _0x425f1a['name'];if(_0x3cec8a===0x191){_0x3cec8a=0x190;}_0x1c9de9['status'](_0x3cec8a)['send'](_0x989ecd[_0x8439('0x2d')]['test']?{'message':'Wrong\x20credentials','statusCode':_0x425f1a[_0x8439('0x7b')]}:_0x425f1a);});}; \ No newline at end of file +var _0xfd8a=['bluebird','mustache','util','path','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','undefined','limit','count','offset','set','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','name','fieldName','type','query','keys','filters','intersection','model','attributes','length','hasOwnProperty','nolimit','sort','where','pick','merge','VIRTUAL','filter','includeAll','include','SalesforceAccount','findAll','rows','catch','params','rawAttributes','fields','options','find','create','body','getConfigurations','findOne','SalesforceConfiguration','order','addConfiguration','getSubjects','channel','Descriptions','getDescriptions','Subjects','SalesforceField','getFields','Task','remoteUri','clientId','clientSecret','username','password','securityToken','slice','substring','login','concat','ticketType','describe','OwnerId','IsReminderSet','IsRecurrence','Subject','Description','string','int','boolean','email','phone','remove','custom','label','value','True','true','false','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','send','Wrong\x20credentials','eml-format','rimraf','zip-dir','request-promise','moment'];(function(_0x2b28bb,_0x2b1ca7){var _0x1b4b59=function(_0x51b5de){while(--_0x51b5de){_0x2b28bb['push'](_0x2b28bb['shift']());}};_0x1b4b59(++_0x2b1ca7);}(_0xfd8a,0x16c));var _0xafd8=function(_0x3bfdde,_0x306be4){_0x3bfdde=_0x3bfdde-0x0;var _0x3f752a=_0xfd8a[_0x3bfdde];return _0x3f752a;};'use strict';var emlformat=require(_0xafd8('0x0'));var rimraf=require(_0xafd8('0x1'));var zipdir=require(_0xafd8('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xafd8('0x3'));var moment=require(_0xafd8('0x4'));var BPromise=require(_0xafd8('0x5'));var Mustache=require(_0xafd8('0x6'));var util=require(_0xafd8('0x7'));var path=require(_0xafd8('0x8'));var sox=require('sox');var csv=require(_0xafd8('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xafd8('0xa'));var _=require(_0xafd8('0xb'));var squel=require(_0xafd8('0xc'));var crypto=require(_0xafd8('0xd'));var jsforce=require(_0xafd8('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xafd8('0xf'));var Papa=require(_0xafd8('0x10'));var Redis=require(_0xafd8('0x11'));var authService=require(_0xafd8('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xafd8('0x13'));var hardwareService=require(_0xafd8('0x14'));var logger=require('../../config/logger')(_0xafd8('0x15'));var utils=require(_0xafd8('0x16'));var config=require(_0xafd8('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xafd8('0x18'))['db'];var integrations=require(_0xafd8('0x19'));function respondWithStatusCode(_0x2aed17,_0x1e1a7d){_0x1e1a7d=_0x1e1a7d||0xcc;return function(_0x24082f){if(_0x24082f){return _0x2aed17[_0xafd8('0x1a')](_0x1e1a7d);}return _0x2aed17[_0xafd8('0x1b')](_0x1e1a7d)[_0xafd8('0x1c')]();};}function respondWithResult(_0x72121a,_0xa5aecb){_0xa5aecb=_0xa5aecb||0xc8;return function(_0x2ad626){if(_0x2ad626){return _0x72121a['status'](_0xa5aecb)['json'](_0x2ad626);}};}function respondWithFilteredResult(_0x2ef23e,_0x50469b){return function(_0x16ac9e){if(_0x16ac9e){var _0x23fb3f=typeof _0x50469b['offset']===_0xafd8('0x1d')&&typeof _0x50469b[_0xafd8('0x1e')]===_0xafd8('0x1d');var _0x111a96=_0x16ac9e[_0xafd8('0x1f')];var _0x100ee8=_0x23fb3f?0x0:_0x50469b[_0xafd8('0x20')];var _0x2bc4e1=_0x23fb3f?_0x16ac9e[_0xafd8('0x1f')]:_0x50469b[_0xafd8('0x20')]+_0x50469b[_0xafd8('0x1e')];var _0x19303c;if(_0x2bc4e1>=_0x111a96){_0x2bc4e1=_0x111a96;_0x19303c=0xc8;}else{_0x19303c=0xce;}_0x2ef23e[_0xafd8('0x1b')](_0x19303c);return _0x2ef23e[_0xafd8('0x21')](_0xafd8('0x22'),_0x100ee8+'-'+_0x2bc4e1+'/'+_0x111a96)[_0xafd8('0x23')](_0x16ac9e);}return null;};}function patchUpdates(_0x49e93f){return function(_0x4176c9){try{jsonpatch[_0xafd8('0x24')](_0x4176c9,_0x49e93f,!![]);}catch(_0x936035){return BPromise[_0xafd8('0x25')](_0x936035);}return _0x4176c9[_0xafd8('0x26')]();};}function saveUpdates(_0x403261,_0x580691){return function(_0x2901eb){if(_0x2901eb){return _0x2901eb[_0xafd8('0x27')](_0x403261)[_0xafd8('0x28')](function(_0x43d8c0){return _0x43d8c0;});}return null;};}function removeEntity(_0xa659f8,_0x4c907a){return function(_0x4dd640){if(_0x4dd640){return _0x4dd640[_0xafd8('0x29')]()[_0xafd8('0x28')](function(){_0xa659f8[_0xafd8('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x31bb79,_0x4b31e3){return function(_0x353cdc){if(!_0x353cdc){_0x31bb79[_0xafd8('0x1a')](0x194);}return _0x353cdc;};}function handleError(_0x102efe,_0x3db0c1){_0x3db0c1=_0x3db0c1||0x1f4;return function(_0x5069b1){logger[_0xafd8('0x2a')](_0x5069b1[_0xafd8('0x2b')]);if(_0x5069b1[_0xafd8('0x2c')]){delete _0x5069b1[_0xafd8('0x2c')];}_0x102efe[_0xafd8('0x1b')](_0x3db0c1)['send'](_0x5069b1);};}exports['index']=function(_0x1e6de1,_0x190011){var _0xb3f6c6={},_0x3cb292={},_0x5a0c06={'count':0x0,'rows':[]};var _0xd223eb=_['map'](db['SalesforceAccount']['rawAttributes'],function(_0x26c9b7){return{'name':_0x26c9b7[_0xafd8('0x2d')],'type':_0x26c9b7[_0xafd8('0x2e')]['key']};});_0x3cb292['model']=_['map'](_0xd223eb,_0xafd8('0x2c'));_0x3cb292[_0xafd8('0x2f')]=_[_0xafd8('0x30')](_0x1e6de1[_0xafd8('0x2f')]);_0x3cb292[_0xafd8('0x31')]=_[_0xafd8('0x32')](_0x3cb292[_0xafd8('0x33')],_0x3cb292[_0xafd8('0x2f')]);_0xb3f6c6[_0xafd8('0x34')]=_['intersection'](_0x3cb292[_0xafd8('0x33')],qs['fields'](_0x1e6de1[_0xafd8('0x2f')]['fields']));_0xb3f6c6[_0xafd8('0x34')]=_0xb3f6c6[_0xafd8('0x34')][_0xafd8('0x35')]?_0xb3f6c6[_0xafd8('0x34')]:_0x3cb292[_0xafd8('0x33')];if(!_0x1e6de1['query'][_0xafd8('0x36')](_0xafd8('0x37'))){_0xb3f6c6[_0xafd8('0x1e')]=qs[_0xafd8('0x1e')](_0x1e6de1[_0xafd8('0x2f')][_0xafd8('0x1e')]);_0xb3f6c6[_0xafd8('0x20')]=qs[_0xafd8('0x20')](_0x1e6de1[_0xafd8('0x2f')][_0xafd8('0x20')]);}_0xb3f6c6['order']=qs['sort'](_0x1e6de1[_0xafd8('0x2f')][_0xafd8('0x38')]);_0xb3f6c6[_0xafd8('0x39')]=qs[_0xafd8('0x31')](_[_0xafd8('0x3a')](_0x1e6de1['query'],_0x3cb292[_0xafd8('0x31')]),_0xd223eb);if(_0x1e6de1[_0xafd8('0x2f')]['filter']){_0xb3f6c6[_0xafd8('0x39')]=_[_0xafd8('0x3b')](_0xb3f6c6[_0xafd8('0x39')],{'$or':_['map'](_0xd223eb,function(_0x466b6f){if(_0x466b6f['type']!==_0xafd8('0x3c')){var _0x34ce84={};_0x34ce84[_0x466b6f[_0xafd8('0x2c')]]={'$like':'%'+_0x1e6de1[_0xafd8('0x2f')][_0xafd8('0x3d')]+'%'};return _0x34ce84;}})});}_0xb3f6c6=_[_0xafd8('0x3b')]({},_0xb3f6c6,_0x1e6de1['options']);var _0x242df5={'where':_0xb3f6c6[_0xafd8('0x39')]};return db['SalesforceAccount'][_0xafd8('0x1f')](_0x242df5)['then'](function(_0x44aa81){_0x5a0c06[_0xafd8('0x1f')]=_0x44aa81;if(_0x1e6de1[_0xafd8('0x2f')][_0xafd8('0x3e')]){_0xb3f6c6[_0xafd8('0x3f')]=[{'all':!![]}];}return db[_0xafd8('0x40')][_0xafd8('0x41')](_0xb3f6c6);})[_0xafd8('0x28')](function(_0xbb7495){_0x5a0c06[_0xafd8('0x42')]=_0xbb7495;return _0x5a0c06;})[_0xafd8('0x28')](respondWithFilteredResult(_0x190011,_0xb3f6c6))[_0xafd8('0x43')](handleError(_0x190011,null));};exports['show']=function(_0x342ba1,_0x5a8c24){var _0x54a552={'raw':![],'where':{'id':_0x342ba1[_0xafd8('0x44')]['id']}},_0x19b648={};_0x19b648[_0xafd8('0x33')]=_[_0xafd8('0x30')](db['SalesforceAccount'][_0xafd8('0x45')]);_0x19b648[_0xafd8('0x2f')]=_['keys'](_0x342ba1[_0xafd8('0x2f')]);_0x19b648['filters']=_['intersection'](_0x19b648[_0xafd8('0x33')],_0x19b648[_0xafd8('0x2f')]);_0x54a552['attributes']=_[_0xafd8('0x32')](_0x19b648[_0xafd8('0x33')],qs[_0xafd8('0x46')](_0x342ba1['query'][_0xafd8('0x46')]));_0x54a552[_0xafd8('0x34')]=_0x54a552[_0xafd8('0x34')]['length']?_0x54a552[_0xafd8('0x34')]:_0x19b648[_0xafd8('0x33')];if(_0x342ba1[_0xafd8('0x2f')][_0xafd8('0x3e')]){_0x54a552['include']=[{'all':!![]}];}_0x54a552=_[_0xafd8('0x3b')]({},_0x54a552,_0x342ba1[_0xafd8('0x47')]);return db[_0xafd8('0x40')][_0xafd8('0x48')](_0x54a552)['then'](handleEntityNotFound(_0x5a8c24,null))[_0xafd8('0x28')](respondWithResult(_0x5a8c24,null))[_0xafd8('0x43')](handleError(_0x5a8c24,null));};exports[_0xafd8('0x49')]=function(_0x2ae3f6,_0x3c7423){return db[_0xafd8('0x40')]['create'](_0x2ae3f6[_0xafd8('0x4a')],{})[_0xafd8('0x28')](respondWithResult(_0x3c7423,0xc9))[_0xafd8('0x43')](handleError(_0x3c7423,null));};exports['update']=function(_0x1f95bb,_0x1b54d0){if(_0x1f95bb[_0xafd8('0x4a')]['id']){delete _0x1f95bb[_0xafd8('0x4a')]['id'];}return db[_0xafd8('0x40')]['find']({'where':{'id':_0x1f95bb[_0xafd8('0x44')]['id']}})[_0xafd8('0x28')](handleEntityNotFound(_0x1b54d0,null))[_0xafd8('0x28')](saveUpdates(_0x1f95bb[_0xafd8('0x4a')],null))[_0xafd8('0x28')](respondWithResult(_0x1b54d0,null))['catch'](handleError(_0x1b54d0,null));};exports[_0xafd8('0x29')]=function(_0x4a37bb,_0x46ab9c){return db['SalesforceAccount']['find']({'where':{'id':_0x4a37bb['params']['id']}})['then'](handleEntityNotFound(_0x46ab9c,null))[_0xafd8('0x28')](removeEntity(_0x46ab9c,null))['catch'](handleError(_0x46ab9c,null));};exports[_0xafd8('0x4b')]=function(_0x4f308f,_0xbef779,_0x49f8ae){var _0x409324={};var _0x5532f3={};var _0x178efe;var _0x40bc17;return db[_0xafd8('0x40')][_0xafd8('0x4c')]({'where':{'id':_0x4f308f['params']['id']}})[_0xafd8('0x28')](handleEntityNotFound(_0xbef779,null))[_0xafd8('0x28')](function(_0x119d5b){if(_0x119d5b){_0x178efe=_0x119d5b;_0x5532f3['model']=_[_0xafd8('0x30')](db[_0xafd8('0x4d')][_0xafd8('0x45')]);_0x5532f3[_0xafd8('0x2f')]=_[_0xafd8('0x30')](_0x4f308f[_0xafd8('0x2f')]);_0x5532f3['filters']=_[_0xafd8('0x32')](_0x5532f3[_0xafd8('0x33')],_0x5532f3[_0xafd8('0x2f')]);_0x409324[_0xafd8('0x34')]=_['intersection'](_0x5532f3[_0xafd8('0x33')],qs['fields'](_0x4f308f[_0xafd8('0x2f')]['fields']));_0x409324['attributes']=_0x409324['attributes'][_0xafd8('0x35')]?_0x409324[_0xafd8('0x34')]:_0x5532f3[_0xafd8('0x33')];_0x409324[_0xafd8('0x4e')]=qs[_0xafd8('0x38')](_0x4f308f[_0xafd8('0x2f')][_0xafd8('0x38')]);_0x409324[_0xafd8('0x39')]=qs[_0xafd8('0x31')](_[_0xafd8('0x3a')](_0x4f308f[_0xafd8('0x2f')],_0x5532f3[_0xafd8('0x31')]));if(_0x4f308f['query'][_0xafd8('0x3d')]){_0x409324[_0xafd8('0x39')]=_[_0xafd8('0x3b')](_0x409324['where'],{'$or':_['map'](_0x409324[_0xafd8('0x34')],function(_0x439d5a){var _0x5a2200={};_0x5a2200[_0x439d5a]={'$like':'%'+_0x4f308f['query'][_0xafd8('0x3d')]+'%'};return _0x5a2200;})});}_0x409324=_[_0xafd8('0x3b')]({},_0x409324,_0x4f308f[_0xafd8('0x47')]);return _0x178efe[_0xafd8('0x4b')](_0x409324);}})[_0xafd8('0x28')](function(_0x3a3211){if(_0x3a3211){_0x40bc17=_0x3a3211[_0xafd8('0x35')];if(!_0x4f308f[_0xafd8('0x2f')]['hasOwnProperty'](_0xafd8('0x37'))){_0x409324[_0xafd8('0x1e')]=qs[_0xafd8('0x1e')](_0x4f308f[_0xafd8('0x2f')][_0xafd8('0x1e')]);_0x409324[_0xafd8('0x20')]=qs[_0xafd8('0x20')](_0x4f308f['query'][_0xafd8('0x20')]);}return _0x178efe[_0xafd8('0x4b')](_0x409324);}})[_0xafd8('0x28')](function(_0x5081b5){if(_0x5081b5){return _0x5081b5?{'count':_0x40bc17,'rows':_0x5081b5}:null;}})[_0xafd8('0x28')](respondWithResult(_0xbef779,null))['catch'](handleError(_0xbef779,null));};exports[_0xafd8('0x4f')]=function(_0x2339ff,_0x2a11c0,_0x7564){if(_0x2339ff[_0xafd8('0x4a')]['id']){delete _0x2339ff['body']['id'];}return db[_0xafd8('0x40')][_0xafd8('0x4c')]({'where':{'id':_0x2339ff[_0xafd8('0x44')]['id']}})[_0xafd8('0x28')](handleEntityNotFound(_0x2a11c0,null))['then'](function(_0x4b5653){if(_0x4b5653){_0x2339ff[_0xafd8('0x4a')]['AccountId']=_0x4b5653['id'];_0x2339ff['body']['Subjects']=integrations[_0xafd8('0x50')](_0x2339ff[_0xafd8('0x4a')][_0xafd8('0x51')],_0x2339ff[_0xafd8('0x4a')][_0xafd8('0x2e')]);_0x2339ff[_0xafd8('0x4a')][_0xafd8('0x52')]=integrations[_0xafd8('0x53')](_0x2339ff[_0xafd8('0x4a')][_0xafd8('0x51')],_0x2339ff['body'][_0xafd8('0x2e')]);return db[_0xafd8('0x4d')][_0xafd8('0x49')](_0x2339ff[_0xafd8('0x4a')],{'include':[{'model':db['SalesforceField'],'as':_0xafd8('0x54')},{'model':db[_0xafd8('0x55')],'as':_0xafd8('0x52')}]});}return null;})[_0xafd8('0x28')](respondWithResult(_0x2a11c0,null))[_0xafd8('0x43')](handleError(_0x2a11c0,null));};exports[_0xafd8('0x56')]=function(_0x12907d,_0x5ccabb,_0x3669b0){var _0x1bf1b7;var _0x1d03d3='';var _0x5a449b=_0xafd8('0x57');return db[_0xafd8('0x40')][_0xafd8('0x4c')]({'where':{'id':_0x12907d['params']['id']},'attributes':['id',_0xafd8('0x58'),_0xafd8('0x59'),_0xafd8('0x5a'),_0xafd8('0x5b'),_0xafd8('0x5c'),_0xafd8('0x5d')]})['then'](handleEntityNotFound(_0x5ccabb,null))['then'](function(_0xfe0e72){if(_0xfe0e72){_0x1d03d3=_0xfe0e72['remoteUri'];var _0x42de50=_0x1d03d3[_0xafd8('0x5e')](-0x1);if(_0x42de50==='/'){_0x1d03d3=_0x1d03d3[_0xafd8('0x5f')](0x0,_0x1d03d3['lastIndexOf'](_0x42de50));}_0x1bf1b7=new jsforce['Connection']({'oauth2':{'loginUrl':_0x1d03d3,'clientId':_0xfe0e72[_0xafd8('0x59')],'clientSecret':_0xfe0e72[_0xafd8('0x5a')]}});return _0x1bf1b7[_0xafd8('0x60')](_0xfe0e72[_0xafd8('0x5b')],_0xfe0e72[_0xafd8('0x5c')][_0xafd8('0x61')](_0xfe0e72['securityToken']));}})[_0xafd8('0x28')](function(_0x40f483){if(_0x40f483){if(!_['isNil'](_0x12907d[_0xafd8('0x2f')][_0xafd8('0x62')])){_0x5a449b=_0x12907d[_0xafd8('0x2f')][_0xafd8('0x62')];}return _0x1bf1b7['sobject'](_0x5a449b)[_0xafd8('0x63')]();}})[_0xafd8('0x28')](function(_0x37eacc){var _0x2b5893=[_0xafd8('0x64'),'ActivityDate',_0xafd8('0x65'),_0xafd8('0x66'),_0xafd8('0x67'),_0xafd8('0x68')];var _0xb7c4ce=[_0xafd8('0x69'),_0xafd8('0x6a'),'picklist',_0xafd8('0x6b'),_0xafd8('0x6c'),'textarea',_0xafd8('0x6d')];if(_0x37eacc){_[_0xafd8('0x6e')](_0x37eacc[_0xafd8('0x46')],function(_0x16e7a8){return _0x2b5893['includes'](_0x16e7a8[_0xafd8('0x2c')])||!_0xb7c4ce['includes'](_0x16e7a8[_0xafd8('0x2e')]);});return{'count':_0x37eacc[_0xafd8('0x46')][_0xafd8('0x35')],'rows':_['map'](_0x37eacc[_0xafd8('0x46')],function(_0x49cfb5){return{'id':_0x49cfb5[_0xafd8('0x2c')],'name':_0x49cfb5['label'],'custom':_0x49cfb5[_0xafd8('0x6f')],'options':_0x49cfb5['picklistValues'][_0xafd8('0x35')]>0x0?_['map'](_0x49cfb5['picklistValues'],function(_0x46c508){return{'name':_0x46c508[_0xafd8('0x70')],'value':_0x46c508[_0xafd8('0x71')]};}):_0x49cfb5[_0xafd8('0x2e')]==_0xafd8('0x6b')?[{'name':_0xafd8('0x72'),'value':_0xafd8('0x73')},{'name':'False','value':_0xafd8('0x74')}]:[]};})};}})[_0xafd8('0x28')](respondWithResult(_0x5ccabb,null))[_0xafd8('0x43')](function(_0x3697a4){var _0x43fde9=_0x12907d['query'][_0xafd8('0x75')]?0x1f4:_0x3697a4[_0xafd8('0x76')]||0x1f4;logger[_0xafd8('0x2a')](_0xafd8('0x77'),_0xafd8('0x56'),_0x43fde9,JSON[_0xafd8('0x78')](_0x3697a4));delete _0x3697a4[_0xafd8('0x2c')];if(_0x43fde9===0x191){_0x43fde9=0x190;}_0x5ccabb[_0xafd8('0x1b')](_0x43fde9)[_0xafd8('0x79')](_0x12907d['query'][_0xafd8('0x75')]?{'message':_0xafd8('0x7a'),'statusCode':_0x3697a4[_0xafd8('0x76')]}:_0x3697a4);});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.model.js b/server/api/intSalesforceAccount/intSalesforceAccount.model.js index c5d6b5e..b3ef1d4 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 _0xf429=['define','SalesforceAccount','util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./intSalesforceAccount.attributes'];(function(_0x443fda,_0xb06d0a){var _0x58360d=function(_0xfb6e21){while(--_0xfb6e21){_0x443fda['push'](_0x443fda['shift']());}};_0x58360d(++_0xb06d0a);}(_0xf429,0xd4));var _0x9f42=function(_0x32e264,_0x41cee8){_0x32e264=_0x32e264-0x0;var _0x1d7175=_0xf429[_0x32e264];return _0x1d7175;};'use strict';var _=require('lodash');var util=require(_0x9f42('0x0'));var logger=require(_0x9f42('0x1'))(_0x9f42('0x2'));var moment=require('moment');var BPromise=require(_0x9f42('0x3'));var rp=require(_0x9f42('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9f42('0x5'));var config=require(_0x9f42('0x6'));var attributes=require(_0x9f42('0x7'));var integrations=require('../../components/integrations/configuration');module['exports']=function(_0x874a2b,_0x419791){return _0x874a2b[_0x9f42('0x8')](_0x9f42('0x9'),attributes,{'tableName':'int_salesforce_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2e14=['rimraf','../../config/environment','./intSalesforceAccount.attributes','exports','define','int_salesforce_accounts','lodash','util','api','bluebird','request-promise','path'];(function(_0x1beef3,_0x57c4b8){var _0x5af964=function(_0x36f463){while(--_0x36f463){_0x1beef3['push'](_0x1beef3['shift']());}};_0x5af964(++_0x57c4b8);}(_0x2e14,0xae));var _0x42e1=function(_0x4e0157,_0x147213){_0x4e0157=_0x4e0157-0x0;var _0x13a010=_0x2e14[_0x4e0157];return _0x13a010;};'use strict';var _=require(_0x42e1('0x0'));var util=require(_0x42e1('0x1'));var logger=require('../../config/logger')(_0x42e1('0x2'));var moment=require('moment');var BPromise=require(_0x42e1('0x3'));var rp=require(_0x42e1('0x4'));var fs=require('fs');var path=require(_0x42e1('0x5'));var rimraf=require(_0x42e1('0x6'));var config=require(_0x42e1('0x7'));var attributes=require(_0x42e1('0x8'));var integrations=require('../../components/integrations/configuration');module[_0x42e1('0x9')]=function(_0x42815d,_0x38ffe0){return _0x42815d[_0x42e1('0xa')]('SalesforceAccount',attributes,{'tableName':_0x42e1('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.rpc.js b/server/api/intSalesforceAccount/intSalesforceAccount.rpc.js index c5fcf91..6ba021d 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 _0xdbeb=['moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','SalesforceAccount,\x20%s,\x20%s','request\x20sent','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetSalesforceAccount','findAll','options','raw','attributes','limit','map','include','model','ShowSalesforceAccount','where'];(function(_0x3f5dca,_0x59472b){var _0x5b833a=function(_0x1cb84b){while(--_0x1cb84b){_0x3f5dca['push'](_0x3f5dca['shift']());}};_0x5b833a(++_0x59472b);}(_0xdbeb,0xa0));var _0xbdbe=function(_0x38733d,_0x430e97){_0x38733d=_0x38733d-0x0;var _0x20ad2b=_0xdbeb[_0x38733d];return _0x20ad2b;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xbdbe('0x0'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbdbe('0x1'));var db=require(_0xbdbe('0x2'))['db'];var utils=require(_0xbdbe('0x3'));var logger=require(_0xbdbe('0x4'))(_0xbdbe('0x5'));var config=require(_0xbdbe('0x6'));var jayson=require(_0xbdbe('0x7'));var client=jayson['client'][_0xbdbe('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xea48ee,_0x4eb6ba,_0x2da22d){return new BPromise(function(_0x8145e8,_0x361005){return client[_0xbdbe('0x9')](_0xea48ee,_0x2da22d)[_0xbdbe('0xa')](function(_0x5a0a63){logger[_0xbdbe('0xb')](_0xbdbe('0xc'),_0x4eb6ba,_0xbdbe('0xd'));logger[_0xbdbe('0xe')](_0xbdbe('0xf'),_0x4eb6ba,'request\x20sent',JSON[_0xbdbe('0x10')](_0x5a0a63));if(_0x5a0a63[_0xbdbe('0x11')]){if(_0x5a0a63['error'][_0xbdbe('0x12')]===0x1f4){logger['error'](_0xbdbe('0xc'),_0x4eb6ba,_0x5a0a63[_0xbdbe('0x11')]['message']);return _0x361005(_0x5a0a63[_0xbdbe('0x11')][_0xbdbe('0x13')]);}logger[_0xbdbe('0x11')]('SalesforceAccount,\x20%s,\x20%s',_0x4eb6ba,_0x5a0a63[_0xbdbe('0x11')][_0xbdbe('0x13')]);return _0x8145e8(_0x5a0a63[_0xbdbe('0x11')][_0xbdbe('0x13')]);}else{logger[_0xbdbe('0xb')](_0xbdbe('0xc'),_0x4eb6ba,_0xbdbe('0xd'));_0x8145e8(_0x5a0a63['result'][_0xbdbe('0x13')]);}})[_0xbdbe('0x14')](function(_0xb277b3){logger[_0xbdbe('0x11')]('SalesforceAccount,\x20%s,\x20%s',_0x4eb6ba,_0xb277b3);_0x361005(_0xb277b3);});});}exports[_0xbdbe('0x15')]=function(_0x468de9){var _0x19b6ea=this;return new Promise(function(_0x5aa844,_0x25e84a){return db['SalesforceAccount'][_0xbdbe('0x16')]({'raw':_0x468de9[_0xbdbe('0x17')]?_0x468de9[_0xbdbe('0x17')][_0xbdbe('0x18')]===undefined?!![]:![]:!![],'where':_0x468de9[_0xbdbe('0x17')]?_0x468de9[_0xbdbe('0x17')]['where']||null:null,'attributes':_0x468de9[_0xbdbe('0x17')]?_0x468de9[_0xbdbe('0x17')][_0xbdbe('0x19')]||null:null,'limit':_0x468de9[_0xbdbe('0x17')]?_0x468de9[_0xbdbe('0x17')][_0xbdbe('0x1a')]||null:null,'include':_0x468de9[_0xbdbe('0x17')]?_0x468de9[_0xbdbe('0x17')]['include']?_[_0xbdbe('0x1b')](_0x468de9[_0xbdbe('0x17')][_0xbdbe('0x1c')],function(_0x4be88e){return{'model':db[_0x4be88e[_0xbdbe('0x1d')]],'as':_0x4be88e['as'],'attributes':_0x4be88e[_0xbdbe('0x19')],'include':_0x4be88e[_0xbdbe('0x1c')]?_[_0xbdbe('0x1b')](_0x4be88e['include'],function(_0xc5fb02){return{'model':db[_0xc5fb02[_0xbdbe('0x1d')]],'as':_0xc5fb02['as'],'attributes':_0xc5fb02[_0xbdbe('0x19')],'include':_0xc5fb02[_0xbdbe('0x1c')]?_['map'](_0xc5fb02[_0xbdbe('0x1c')],function(_0x584bb6){return{'model':db[_0x584bb6[_0xbdbe('0x1d')]],'as':_0x584bb6['as'],'attributes':_0x584bb6[_0xbdbe('0x19')]};}):[]};}):[]};}):[]:[]})[_0xbdbe('0xa')](function(_0x36040f){logger[_0xbdbe('0xb')](_0xbdbe('0x15'),_0x468de9);logger[_0xbdbe('0xe')](_0xbdbe('0x15'),_0x468de9,JSON[_0xbdbe('0x10')](_0x36040f));_0x5aa844(_0x36040f);})[_0xbdbe('0x14')](function(_0x3f3845){logger['error'](_0xbdbe('0x15'),_0x3f3845[_0xbdbe('0x13')],_0x468de9);_0x25e84a(_0x19b6ea[_0xbdbe('0x11')](0x1f4,_0x3f3845[_0xbdbe('0x13')]));});});};exports[_0xbdbe('0x1e')]=function(_0x533497){var _0x18b635=this;return new Promise(function(_0x2931e1,_0x3c99ed){return db['SalesforceAccount']['find']({'raw':_0x533497[_0xbdbe('0x17')]?_0x533497[_0xbdbe('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x533497[_0xbdbe('0x17')]?_0x533497[_0xbdbe('0x17')][_0xbdbe('0x1f')]||null:null,'attributes':_0x533497[_0xbdbe('0x17')]?_0x533497[_0xbdbe('0x17')][_0xbdbe('0x19')]||null:null,'include':_0x533497[_0xbdbe('0x17')]?_0x533497[_0xbdbe('0x17')][_0xbdbe('0x1c')]?_[_0xbdbe('0x1b')](_0x533497[_0xbdbe('0x17')][_0xbdbe('0x1c')],function(_0x301898){return{'model':db[_0x301898[_0xbdbe('0x1d')]],'as':_0x301898['as'],'attributes':_0x301898[_0xbdbe('0x19')],'include':_0x301898[_0xbdbe('0x1c')]?_[_0xbdbe('0x1b')](_0x301898[_0xbdbe('0x1c')],function(_0x4c2941){return{'model':db[_0x4c2941[_0xbdbe('0x1d')]],'as':_0x4c2941['as'],'attributes':_0x4c2941[_0xbdbe('0x19')],'include':_0x4c2941[_0xbdbe('0x1c')]?_[_0xbdbe('0x1b')](_0x4c2941[_0xbdbe('0x1c')],function(_0x4c4ca7){return{'model':db[_0x4c4ca7[_0xbdbe('0x1d')]],'as':_0x4c4ca7['as'],'attributes':_0x4c4ca7['attributes']};}):[]};}):[]};}):[]:[]})[_0xbdbe('0xa')](function(_0x27e917){logger['info'](_0xbdbe('0x1e'),_0x533497);logger['debug'](_0xbdbe('0x1e'),_0x533497,JSON[_0xbdbe('0x10')](_0x27e917));_0x2931e1(_0x27e917);})[_0xbdbe('0x14')](function(_0x3c2101){logger[_0xbdbe('0x11')](_0xbdbe('0x1e'),_0x3c2101[_0xbdbe('0x13')],_0x533497);_0x3c99ed(_0x18b635[_0xbdbe('0x11')](0x1f4,_0x3c2101[_0xbdbe('0x13')]));});});}; \ No newline at end of file +var _0xa1f8=['SalesforceAccount,\x20%s,\x20%s','request\x20sent','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','code','error','message','result','GetSalesforceAccount','options','raw','where','limit','model','attributes','include','map','then','stringify','ShowSalesforceAccount','find','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','info'];(function(_0x523615,_0x210b6f){var _0x427d0f=function(_0x52b3d7){while(--_0x52b3d7){_0x523615['push'](_0x523615['shift']());}};_0x427d0f(++_0x210b6f);}(_0xa1f8,0x7f));var _0x8a1f=function(_0x3ed909,_0x3b9d4e){_0x3ed909=_0x3ed909-0x0;var _0x45dacb=_0xa1f8[_0x3ed909];return _0x45dacb;};'use strict';var _=require(_0x8a1f('0x0'));var util=require('util');var moment=require(_0x8a1f('0x1'));var BPromise=require('bluebird');var rs=require(_0x8a1f('0x2'));var fs=require('fs');var Redis=require(_0x8a1f('0x3'));var db=require(_0x8a1f('0x4'))['db'];var utils=require(_0x8a1f('0x5'));var logger=require('../../config/logger')(_0x8a1f('0x6'));var config=require(_0x8a1f('0x7'));var jayson=require(_0x8a1f('0x8'));var client=jayson[_0x8a1f('0x9')][_0x8a1f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x402404,_0x46d2d6,_0x75625b){return new BPromise(function(_0x15cfbc,_0x2c8c1c){return client[_0x8a1f('0xb')](_0x402404,_0x75625b)['then'](function(_0x1cce2a){logger[_0x8a1f('0xc')](_0x8a1f('0xd'),_0x46d2d6,_0x8a1f('0xe'));logger[_0x8a1f('0xf')](_0x8a1f('0x10'),_0x46d2d6,_0x8a1f('0xe'),JSON['stringify'](_0x1cce2a));if(_0x1cce2a['error']){if(_0x1cce2a['error'][_0x8a1f('0x11')]===0x1f4){logger[_0x8a1f('0x12')](_0x8a1f('0xd'),_0x46d2d6,_0x1cce2a[_0x8a1f('0x12')][_0x8a1f('0x13')]);return _0x2c8c1c(_0x1cce2a[_0x8a1f('0x12')][_0x8a1f('0x13')]);}logger[_0x8a1f('0x12')](_0x8a1f('0xd'),_0x46d2d6,_0x1cce2a[_0x8a1f('0x12')][_0x8a1f('0x13')]);return _0x15cfbc(_0x1cce2a[_0x8a1f('0x12')][_0x8a1f('0x13')]);}else{logger['info']('SalesforceAccount,\x20%s,\x20%s',_0x46d2d6,_0x8a1f('0xe'));_0x15cfbc(_0x1cce2a[_0x8a1f('0x14')]['message']);}})['catch'](function(_0x23846a){logger[_0x8a1f('0x12')](_0x8a1f('0xd'),_0x46d2d6,_0x23846a);_0x2c8c1c(_0x23846a);});});}exports[_0x8a1f('0x15')]=function(_0x396587){var _0x747aab=this;return new Promise(function(_0x119b91,_0x32c78d){return db['SalesforceAccount']['findAll']({'raw':_0x396587[_0x8a1f('0x16')]?_0x396587['options'][_0x8a1f('0x17')]===undefined?!![]:![]:!![],'where':_0x396587[_0x8a1f('0x16')]?_0x396587[_0x8a1f('0x16')][_0x8a1f('0x18')]||null:null,'attributes':_0x396587[_0x8a1f('0x16')]?_0x396587[_0x8a1f('0x16')]['attributes']||null:null,'limit':_0x396587[_0x8a1f('0x16')]?_0x396587[_0x8a1f('0x16')][_0x8a1f('0x19')]||null:null,'include':_0x396587[_0x8a1f('0x16')]?_0x396587[_0x8a1f('0x16')]['include']?_['map'](_0x396587['options']['include'],function(_0x8a8c7){return{'model':db[_0x8a8c7[_0x8a1f('0x1a')]],'as':_0x8a8c7['as'],'attributes':_0x8a8c7[_0x8a1f('0x1b')],'include':_0x8a8c7[_0x8a1f('0x1c')]?_[_0x8a1f('0x1d')](_0x8a8c7[_0x8a1f('0x1c')],function(_0x359430){return{'model':db[_0x359430[_0x8a1f('0x1a')]],'as':_0x359430['as'],'attributes':_0x359430['attributes'],'include':_0x359430['include']?_[_0x8a1f('0x1d')](_0x359430[_0x8a1f('0x1c')],function(_0x50f324){return{'model':db[_0x50f324[_0x8a1f('0x1a')]],'as':_0x50f324['as'],'attributes':_0x50f324['attributes']};}):[]};}):[]};}):[]:[]})[_0x8a1f('0x1e')](function(_0x57c1ba){logger[_0x8a1f('0xc')](_0x8a1f('0x15'),_0x396587);logger['debug'](_0x8a1f('0x15'),_0x396587,JSON[_0x8a1f('0x1f')](_0x57c1ba));_0x119b91(_0x57c1ba);})['catch'](function(_0x18fe5d){logger['error'](_0x8a1f('0x15'),_0x18fe5d[_0x8a1f('0x13')],_0x396587);_0x32c78d(_0x747aab[_0x8a1f('0x12')](0x1f4,_0x18fe5d[_0x8a1f('0x13')]));});});};exports[_0x8a1f('0x20')]=function(_0xb3cb68){var _0x361f1e=this;return new Promise(function(_0x52ecda,_0x238e83){return db['SalesforceAccount'][_0x8a1f('0x21')]({'raw':_0xb3cb68[_0x8a1f('0x16')]?_0xb3cb68['options'][_0x8a1f('0x17')]===undefined?!![]:![]:!![],'where':_0xb3cb68[_0x8a1f('0x16')]?_0xb3cb68[_0x8a1f('0x16')][_0x8a1f('0x18')]||null:null,'attributes':_0xb3cb68[_0x8a1f('0x16')]?_0xb3cb68['options'][_0x8a1f('0x1b')]||null:null,'include':_0xb3cb68[_0x8a1f('0x16')]?_0xb3cb68[_0x8a1f('0x16')][_0x8a1f('0x1c')]?_[_0x8a1f('0x1d')](_0xb3cb68[_0x8a1f('0x16')][_0x8a1f('0x1c')],function(_0x27b36c){return{'model':db[_0x27b36c['model']],'as':_0x27b36c['as'],'attributes':_0x27b36c[_0x8a1f('0x1b')],'include':_0x27b36c[_0x8a1f('0x1c')]?_[_0x8a1f('0x1d')](_0x27b36c[_0x8a1f('0x1c')],function(_0x290206){return{'model':db[_0x290206['model']],'as':_0x290206['as'],'attributes':_0x290206[_0x8a1f('0x1b')],'include':_0x290206[_0x8a1f('0x1c')]?_[_0x8a1f('0x1d')](_0x290206['include'],function(_0x24728f){return{'model':db[_0x24728f['model']],'as':_0x24728f['as'],'attributes':_0x24728f[_0x8a1f('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x39c4e1){logger[_0x8a1f('0xc')](_0x8a1f('0x20'),_0xb3cb68);logger['debug'](_0x8a1f('0x20'),_0xb3cb68,JSON['stringify'](_0x39c4e1));_0x52ecda(_0x39c4e1);})[_0x8a1f('0x22')](function(_0x53ade5){logger['error'](_0x8a1f('0x20'),_0x53ade5[_0x8a1f('0x13')],_0xb3cb68);_0x238e83(_0x361f1e[_0x8a1f('0x12')](0x1f4,_0x53ade5[_0x8a1f('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/index.js b/server/api/intSalesforceConfiguration/index.js index 3bec132..bab4622 100644 --- a/server/api/intSalesforceConfiguration/index.js +++ b/server/api/intSalesforceConfiguration/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5f2f=['Router','fs-extra','../../components/auth/service','./intSalesforceConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','getDescriptions','create','put','update','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x181f99,_0x3bf524){var _0x105df1=function(_0x200c88){while(--_0x200c88){_0x181f99['push'](_0x181f99['shift']());}};_0x105df1(++_0x3bf524);}(_0x5f2f,0x73));var _0xf5f2=function(_0x1a0d55,_0x5b74af){_0x1a0d55=_0x1a0d55-0x0;var _0x18e335=_0x5f2f[_0x1a0d55];return _0x18e335;};'use strict';var multer=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var path=require(_0xf5f2('0x2'));var timeout=require(_0xf5f2('0x3'));var express=require(_0xf5f2('0x4'));var router=express[_0xf5f2('0x5')]();var fs_extra=require(_0xf5f2('0x6'));var auth=require(_0xf5f2('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xf5f2('0x8'));router[_0xf5f2('0x9')]('/',auth[_0xf5f2('0xa')](),controller[_0xf5f2('0xb')]);router[_0xf5f2('0x9')](_0xf5f2('0xc'),auth['isAuthenticated'](),controller[_0xf5f2('0xd')]);router[_0xf5f2('0x9')](_0xf5f2('0xe'),auth['isAuthenticated'](),controller[_0xf5f2('0xf')]);router[_0xf5f2('0x9')](_0xf5f2('0x10'),auth['isAuthenticated'](),controller[_0xf5f2('0x11')]);router['get']('/:id/descriptions',auth[_0xf5f2('0xa')](),controller[_0xf5f2('0x12')]);router['post']('/',auth[_0xf5f2('0xa')](),controller[_0xf5f2('0x13')]);router[_0xf5f2('0x14')](_0xf5f2('0xc'),auth[_0xf5f2('0xa')](),controller[_0xf5f2('0x15')]);router['delete'](_0xf5f2('0xc'),auth[_0xf5f2('0xa')](),controller[_0xf5f2('0x16')]);module[_0xf5f2('0x17')]=router; \ No newline at end of file +var _0x5f2f=['Router','fs-extra','../../components/auth/service','./intSalesforceConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','getDescriptions','create','put','update','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x2fc1f0,_0x49f1ac){var _0x4074d9=function(_0x3ebcf3){while(--_0x3ebcf3){_0x2fc1f0['push'](_0x2fc1f0['shift']());}};_0x4074d9(++_0x49f1ac);}(_0x5f2f,0x73));var _0xf5f2=function(_0x5a5379,_0x58dee3){_0x5a5379=_0x5a5379-0x0;var _0x419fcc=_0x5f2f[_0x5a5379];return _0x419fcc;};'use strict';var multer=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var path=require(_0xf5f2('0x2'));var timeout=require(_0xf5f2('0x3'));var express=require(_0xf5f2('0x4'));var router=express[_0xf5f2('0x5')]();var fs_extra=require(_0xf5f2('0x6'));var auth=require(_0xf5f2('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xf5f2('0x8'));router[_0xf5f2('0x9')]('/',auth[_0xf5f2('0xa')](),controller[_0xf5f2('0xb')]);router[_0xf5f2('0x9')](_0xf5f2('0xc'),auth['isAuthenticated'](),controller[_0xf5f2('0xd')]);router[_0xf5f2('0x9')](_0xf5f2('0xe'),auth['isAuthenticated'](),controller[_0xf5f2('0xf')]);router[_0xf5f2('0x9')](_0xf5f2('0x10'),auth['isAuthenticated'](),controller[_0xf5f2('0x11')]);router['get']('/:id/descriptions',auth[_0xf5f2('0xa')](),controller[_0xf5f2('0x12')]);router['post']('/',auth[_0xf5f2('0xa')](),controller[_0xf5f2('0x13')]);router[_0xf5f2('0x14')](_0xf5f2('0xc'),auth[_0xf5f2('0xa')](),controller[_0xf5f2('0x15')]);router['delete'](_0xf5f2('0xc'),auth[_0xf5f2('0xa')](),controller[_0xf5f2('0x16')]);module[_0xf5f2('0x17')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js index 3aa268c..621e1fd 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 _0x5c27=['contact','lead','account_contact_lead','account','contact_lead','sequelize','STRING','ENUM','Task','Case'];(function(_0x7a84ce,_0x545f69){var _0xda3341=function(_0x22de0b){while(--_0x22de0b){_0x7a84ce['push'](_0x7a84ce['shift']());}};_0xda3341(++_0x545f69);}(_0x5c27,0x91));var _0x75c2=function(_0x2c32fb,_0x45b9a8){_0x2c32fb=_0x2c32fb-0x0;var _0x1f2836=_0x5c27[_0x2c32fb];return _0x1f2836;};'use strict';var Sequelize=require(_0x75c2('0x0'));module['exports']={'name':{'type':Sequelize[_0x75c2('0x1')]},'description':{'type':Sequelize[_0x75c2('0x1')]},'ticketType':{'type':Sequelize[_0x75c2('0x2')](_0x75c2('0x3'),_0x75c2('0x4')),'defaultValue':_0x75c2('0x3')},'moduleSearch':{'type':Sequelize[_0x75c2('0x2')]('contact_lead',_0x75c2('0x5'),_0x75c2('0x6'),_0x75c2('0x7'),_0x75c2('0x8')),'defaultValue':_0x75c2('0x9')},'moduleCreate':{'type':Sequelize[_0x75c2('0x2')]('nothing',_0x75c2('0x5'),'lead',_0x75c2('0x8')),'defaultValue':_0x75c2('0x6')},'leadId':{'type':Sequelize['STRING']},'additionalSearchAccount':{'type':Sequelize[_0x75c2('0x1')]},'additionalSearchContact':{'type':Sequelize['STRING']},'additionalSearchLead':{'type':Sequelize[_0x75c2('0x1')]}}; \ No newline at end of file +var _0x12f1=['account_contact_lead','account','lead','STRING','sequelize','ENUM','Task','Case','contact_lead','contact'];(function(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0x12f1,0x14e));var _0x112f=function(_0x5c2f7e,_0x428fe0){_0x5c2f7e=_0x5c2f7e-0x0;var _0x4cc408=_0x12f1[_0x5c2f7e];return _0x4cc408;};'use strict';var Sequelize=require(_0x112f('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'ticketType':{'type':Sequelize[_0x112f('0x1')](_0x112f('0x2'),_0x112f('0x3')),'defaultValue':_0x112f('0x2')},'moduleSearch':{'type':Sequelize[_0x112f('0x1')](_0x112f('0x4'),_0x112f('0x5'),'lead',_0x112f('0x6'),_0x112f('0x7')),'defaultValue':_0x112f('0x4')},'moduleCreate':{'type':Sequelize[_0x112f('0x1')]('nothing',_0x112f('0x5'),_0x112f('0x8'),_0x112f('0x7')),'defaultValue':_0x112f('0x8')},'leadId':{'type':Sequelize[_0x112f('0x9')]},'additionalSearchAccount':{'type':Sequelize[_0x112f('0x9')]},'additionalSearchContact':{'type':Sequelize['STRING']},'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 d6cb660..002a5fb 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 _0x674b=['stack','name','send','index','map','SalesforceConfiguration','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','includeAll','include','rows','catch','show','params','options','find','create','body','update','getFields','findOne','SalesforceField','pick','getSubjects','order','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','../../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','reject','save','then','destroy','error'];(function(_0x3d1f9e,_0x40a2e7){var _0x4f5ead=function(_0x5b36d1){while(--_0x5b36d1){_0x3d1f9e['push'](_0x3d1f9e['shift']());}};_0x4f5ead(++_0x40a2e7);}(_0x674b,0xcd));var _0xb674=function(_0x2b5947,_0x2383a6){_0x2b5947=_0x2b5947-0x0;var _0x3080a3=_0x674b[_0x2b5947];return _0x3080a3;};'use strict';var emlformat=require(_0xb674('0x0'));var rimraf=require(_0xb674('0x1'));var zipdir=require(_0xb674('0x2'));var jsonpatch=require(_0xb674('0x3'));var rp=require(_0xb674('0x4'));var moment=require(_0xb674('0x5'));var BPromise=require(_0xb674('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0xb674('0x7'));var sox=require('sox');var csv=require(_0xb674('0x8'));var ejs=require(_0xb674('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb674('0xa'));var squel=require(_0xb674('0xb'));var crypto=require(_0xb674('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xb674('0xd'));var toCsv=require(_0xb674('0x8'));var querystring=require(_0xb674('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xb674('0xf'));var hardwareService=require(_0xb674('0x10'));var logger=require('../../config/logger')(_0xb674('0x11'));var utils=require(_0xb674('0x12'));var config=require(_0xb674('0x13'));var licenseUtil=require(_0xb674('0x14'));var db=require(_0xb674('0x15'))['db'];function respondWithStatusCode(_0x26e21f,_0x1ea4a0){_0x1ea4a0=_0x1ea4a0||0xcc;return function(_0x457aaa){if(_0x457aaa){return _0x26e21f[_0xb674('0x16')](_0x1ea4a0);}return _0x26e21f[_0xb674('0x17')](_0x1ea4a0)[_0xb674('0x18')]();};}function respondWithResult(_0x746854,_0x22edbb){_0x22edbb=_0x22edbb||0xc8;return function(_0x3f1c58){if(_0x3f1c58){return _0x746854[_0xb674('0x17')](_0x22edbb)[_0xb674('0x19')](_0x3f1c58);}};}function respondWithFilteredResult(_0x10abce,_0x3db67f){return function(_0x46345a){if(_0x46345a){var _0x3c65d4=typeof _0x3db67f[_0xb674('0x1a')]===_0xb674('0x1b')&&typeof _0x3db67f[_0xb674('0x1c')]===_0xb674('0x1b');var _0x1d647f=_0x46345a['count'];var _0x16cd46=_0x3c65d4?0x0:_0x3db67f[_0xb674('0x1a')];var _0x43e8dd=_0x3c65d4?_0x46345a[_0xb674('0x1d')]:_0x3db67f['offset']+_0x3db67f[_0xb674('0x1c')];var _0x3b4fa0;if(_0x43e8dd>=_0x1d647f){_0x43e8dd=_0x1d647f;_0x3b4fa0=0xc8;}else{_0x3b4fa0=0xce;}_0x10abce['status'](_0x3b4fa0);return _0x10abce[_0xb674('0x1e')](_0xb674('0x1f'),_0x16cd46+'-'+_0x43e8dd+'/'+_0x1d647f)[_0xb674('0x19')](_0x46345a);}return null;};}function patchUpdates(_0x43419f){return function(_0x1c3164){try{jsonpatch[_0xb674('0x20')](_0x1c3164,_0x43419f,!![]);}catch(_0x574487){return BPromise[_0xb674('0x21')](_0x574487);}return _0x1c3164[_0xb674('0x22')]();};}function saveUpdates(_0x3cd950,_0x2c4f61){return function(_0x222d40){if(_0x222d40){return _0x222d40['update'](_0x3cd950)[_0xb674('0x23')](function(_0x13394a){return _0x13394a;});}return null;};}function removeEntity(_0x7245a3,_0x45dbea){return function(_0xa64c8f){if(_0xa64c8f){return _0xa64c8f[_0xb674('0x24')]()[_0xb674('0x23')](function(){_0x7245a3['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x384358,_0x42f9ab){return function(_0x30e96c){if(!_0x30e96c){_0x384358[_0xb674('0x16')](0x194);}return _0x30e96c;};}function handleError(_0x3e8b21,_0x2cd63b){_0x2cd63b=_0x2cd63b||0x1f4;return function(_0x17a1d4){logger[_0xb674('0x25')](_0x17a1d4[_0xb674('0x26')]);if(_0x17a1d4[_0xb674('0x27')]){delete _0x17a1d4[_0xb674('0x27')];}_0x3e8b21[_0xb674('0x17')](_0x2cd63b)[_0xb674('0x28')](_0x17a1d4);};}exports[_0xb674('0x29')]=function(_0x54cb0f,_0x1683c7){var _0x1a22be={},_0x3fb00b={},_0x594815={'count':0x0,'rows':[]};var _0x47ac32=_[_0xb674('0x2a')](db[_0xb674('0x2b')][_0xb674('0x2c')],function(_0x5629fb){return{'name':_0x5629fb[_0xb674('0x2d')],'type':_0x5629fb[_0xb674('0x2e')][_0xb674('0x2f')]};});_0x3fb00b[_0xb674('0x30')]=_[_0xb674('0x2a')](_0x47ac32,_0xb674('0x27'));_0x3fb00b[_0xb674('0x31')]=_[_0xb674('0x32')](_0x54cb0f[_0xb674('0x31')]);_0x3fb00b[_0xb674('0x33')]=_[_0xb674('0x34')](_0x3fb00b[_0xb674('0x30')],_0x3fb00b[_0xb674('0x31')]);_0x1a22be['attributes']=_['intersection'](_0x3fb00b['model'],qs['fields'](_0x54cb0f[_0xb674('0x31')][_0xb674('0x35')]));_0x1a22be[_0xb674('0x36')]=_0x1a22be[_0xb674('0x36')][_0xb674('0x37')]?_0x1a22be['attributes']:_0x3fb00b[_0xb674('0x30')];if(!_0x54cb0f[_0xb674('0x31')][_0xb674('0x38')](_0xb674('0x39'))){_0x1a22be['limit']=qs[_0xb674('0x1c')](_0x54cb0f[_0xb674('0x31')]['limit']);_0x1a22be[_0xb674('0x1a')]=qs[_0xb674('0x1a')](_0x54cb0f[_0xb674('0x31')][_0xb674('0x1a')]);}_0x1a22be['order']=qs[_0xb674('0x3a')](_0x54cb0f[_0xb674('0x31')]['sort']);_0x1a22be[_0xb674('0x3b')]=qs[_0xb674('0x33')](_['pick'](_0x54cb0f[_0xb674('0x31')],_0x3fb00b[_0xb674('0x33')]),_0x47ac32);if(_0x54cb0f[_0xb674('0x31')][_0xb674('0x3c')]){_0x1a22be['where']=_[_0xb674('0x3d')](_0x1a22be[_0xb674('0x3b')],{'$or':_[_0xb674('0x2a')](_0x47ac32,function(_0x385d5b){if(_0x385d5b[_0xb674('0x2e')]!==_0xb674('0x3e')){var _0xfedde8={};_0xfedde8[_0x385d5b['name']]={'$like':'%'+_0x54cb0f[_0xb674('0x31')][_0xb674('0x3c')]+'%'};return _0xfedde8;}})});}_0x1a22be=_[_0xb674('0x3d')]({},_0x1a22be,_0x54cb0f['options']);var _0x336495={'where':_0x1a22be['where']};return db['SalesforceConfiguration'][_0xb674('0x1d')](_0x336495)['then'](function(_0xc315e8){_0x594815[_0xb674('0x1d')]=_0xc315e8;if(_0x54cb0f[_0xb674('0x31')][_0xb674('0x3f')]){_0x1a22be[_0xb674('0x40')]=[{'all':!![]}];}return db[_0xb674('0x2b')]['findAll'](_0x1a22be);})['then'](function(_0x1c2128){_0x594815[_0xb674('0x41')]=_0x1c2128;return _0x594815;})[_0xb674('0x23')](respondWithFilteredResult(_0x1683c7,_0x1a22be))[_0xb674('0x42')](handleError(_0x1683c7,null));};exports[_0xb674('0x43')]=function(_0x2a1a9a,_0x531e0e){var _0x207669={'raw':![],'where':{'id':_0x2a1a9a[_0xb674('0x44')]['id']}},_0x3f24bb={};_0x3f24bb[_0xb674('0x30')]=_['keys'](db[_0xb674('0x2b')][_0xb674('0x2c')]);_0x3f24bb['query']=_['keys'](_0x2a1a9a['query']);_0x3f24bb['filters']=_[_0xb674('0x34')](_0x3f24bb[_0xb674('0x30')],_0x3f24bb[_0xb674('0x31')]);_0x207669[_0xb674('0x36')]=_[_0xb674('0x34')](_0x3f24bb[_0xb674('0x30')],qs['fields'](_0x2a1a9a[_0xb674('0x31')][_0xb674('0x35')]));_0x207669[_0xb674('0x36')]=_0x207669[_0xb674('0x36')]['length']?_0x207669[_0xb674('0x36')]:_0x3f24bb[_0xb674('0x30')];if(_0x2a1a9a['query'][_0xb674('0x3f')]){_0x207669[_0xb674('0x40')]=[{'all':!![]}];}_0x207669=_[_0xb674('0x3d')]({},_0x207669,_0x2a1a9a[_0xb674('0x45')]);return db[_0xb674('0x2b')][_0xb674('0x46')](_0x207669)['then'](handleEntityNotFound(_0x531e0e,null))[_0xb674('0x23')](respondWithResult(_0x531e0e,null))[_0xb674('0x42')](handleError(_0x531e0e,null));};exports[_0xb674('0x47')]=function(_0x46a836,_0x3567ba){return db[_0xb674('0x2b')][_0xb674('0x47')](_0x46a836[_0xb674('0x48')],{})[_0xb674('0x23')](respondWithResult(_0x3567ba,0xc9))[_0xb674('0x42')](handleError(_0x3567ba,null));};exports[_0xb674('0x49')]=function(_0x5beea4,_0x3ed65c){if(_0x5beea4[_0xb674('0x48')]['id']){delete _0x5beea4['body']['id'];}return db[_0xb674('0x2b')][_0xb674('0x46')]({'where':{'id':_0x5beea4[_0xb674('0x44')]['id']}})[_0xb674('0x23')](handleEntityNotFound(_0x3ed65c,null))[_0xb674('0x23')](saveUpdates(_0x5beea4[_0xb674('0x48')],null))[_0xb674('0x23')](respondWithResult(_0x3ed65c,null))[_0xb674('0x42')](handleError(_0x3ed65c,null));};exports['destroy']=function(_0x47dc8a,_0x51790d){return db['SalesforceConfiguration'][_0xb674('0x46')]({'where':{'id':_0x47dc8a[_0xb674('0x44')]['id']}})['then'](handleEntityNotFound(_0x51790d,null))[_0xb674('0x23')](removeEntity(_0x51790d,null))['catch'](handleError(_0x51790d,null));};exports[_0xb674('0x4a')]=function(_0x43305b,_0x2ffacd,_0x5e695c){var _0x6c9ffe={};var _0x293b79={};var _0x3df0d0;var _0x2f41ed;return db[_0xb674('0x2b')][_0xb674('0x4b')]({'where':{'id':_0x43305b['params']['id']}})['then'](handleEntityNotFound(_0x2ffacd,null))[_0xb674('0x23')](function(_0xe62821){if(_0xe62821){_0x3df0d0=_0xe62821;_0x293b79[_0xb674('0x30')]=_[_0xb674('0x32')](db[_0xb674('0x4c')][_0xb674('0x2c')]);_0x293b79[_0xb674('0x31')]=_['keys'](_0x43305b[_0xb674('0x31')]);_0x293b79[_0xb674('0x33')]=_[_0xb674('0x34')](_0x293b79[_0xb674('0x30')],_0x293b79[_0xb674('0x31')]);_0x6c9ffe[_0xb674('0x36')]=_['intersection'](_0x293b79[_0xb674('0x30')],qs[_0xb674('0x35')](_0x43305b[_0xb674('0x31')]['fields']));_0x6c9ffe[_0xb674('0x36')]=_0x6c9ffe[_0xb674('0x36')][_0xb674('0x37')]?_0x6c9ffe[_0xb674('0x36')]:_0x293b79['model'];_0x6c9ffe['order']=qs[_0xb674('0x3a')](_0x43305b['query'][_0xb674('0x3a')]);_0x6c9ffe[_0xb674('0x3b')]=qs['filters'](_[_0xb674('0x4d')](_0x43305b[_0xb674('0x31')],_0x293b79[_0xb674('0x33')]));if(_0x43305b[_0xb674('0x31')][_0xb674('0x3c')]){_0x6c9ffe[_0xb674('0x3b')]=_[_0xb674('0x3d')](_0x6c9ffe['where'],{'$or':_[_0xb674('0x2a')](_0x6c9ffe[_0xb674('0x36')],function(_0x286c35){var _0x1bb0b1={};_0x1bb0b1[_0x286c35]={'$like':'%'+_0x43305b[_0xb674('0x31')][_0xb674('0x3c')]+'%'};return _0x1bb0b1;})});}_0x6c9ffe=_[_0xb674('0x3d')]({},_0x6c9ffe,_0x43305b[_0xb674('0x45')]);return _0x3df0d0[_0xb674('0x4a')](_0x6c9ffe);}})[_0xb674('0x23')](function(_0x18f7e5){if(_0x18f7e5){_0x2f41ed=_0x18f7e5['length'];if(!_0x43305b[_0xb674('0x31')]['hasOwnProperty']('nolimit')){_0x6c9ffe[_0xb674('0x1c')]=qs['limit'](_0x43305b['query'][_0xb674('0x1c')]);_0x6c9ffe['offset']=qs[_0xb674('0x1a')](_0x43305b['query'][_0xb674('0x1a')]);}return _0x3df0d0[_0xb674('0x4a')](_0x6c9ffe);}})[_0xb674('0x23')](function(_0x24b85a){if(_0x24b85a){return _0x24b85a?{'count':_0x2f41ed,'rows':_0x24b85a}:null;}})['then'](respondWithResult(_0x2ffacd,null))[_0xb674('0x42')](handleError(_0x2ffacd,null));};exports[_0xb674('0x4e')]=function(_0x49f2d2,_0x1e3ebd,_0x250f19){var _0x4be374={};var _0x3e86cd={};var _0x2815d5;var _0x1de28d;return db['SalesforceConfiguration'][_0xb674('0x4b')]({'where':{'id':_0x49f2d2[_0xb674('0x44')]['id']}})['then'](handleEntityNotFound(_0x1e3ebd,null))[_0xb674('0x23')](function(_0x149167){if(_0x149167){_0x2815d5=_0x149167;_0x3e86cd['model']=_[_0xb674('0x32')](db[_0xb674('0x4c')][_0xb674('0x2c')]);_0x3e86cd[_0xb674('0x31')]=_['keys'](_0x49f2d2[_0xb674('0x31')]);_0x3e86cd[_0xb674('0x33')]=_[_0xb674('0x34')](_0x3e86cd['model'],_0x3e86cd[_0xb674('0x31')]);_0x4be374[_0xb674('0x36')]=_[_0xb674('0x34')](_0x3e86cd[_0xb674('0x30')],qs[_0xb674('0x35')](_0x49f2d2[_0xb674('0x31')][_0xb674('0x35')]));_0x4be374[_0xb674('0x36')]=_0x4be374[_0xb674('0x36')][_0xb674('0x37')]?_0x4be374[_0xb674('0x36')]:_0x3e86cd[_0xb674('0x30')];_0x4be374[_0xb674('0x4f')]=qs[_0xb674('0x3a')](_0x49f2d2['query'][_0xb674('0x3a')]);_0x4be374[_0xb674('0x3b')]=qs[_0xb674('0x33')](_['pick'](_0x49f2d2[_0xb674('0x31')],_0x3e86cd[_0xb674('0x33')]));if(_0x49f2d2[_0xb674('0x31')]['filter']){_0x4be374[_0xb674('0x3b')]=_[_0xb674('0x3d')](_0x4be374[_0xb674('0x3b')],{'$or':_[_0xb674('0x2a')](_0x4be374[_0xb674('0x36')],function(_0x88588){var _0x5970fe={};_0x5970fe[_0x88588]={'$like':'%'+_0x49f2d2[_0xb674('0x31')]['filter']+'%'};return _0x5970fe;})});}_0x4be374=_[_0xb674('0x3d')]({},_0x4be374,_0x49f2d2[_0xb674('0x45')]);return _0x2815d5[_0xb674('0x4e')](_0x4be374);}})[_0xb674('0x23')](function(_0x713c39){if(_0x713c39){_0x1de28d=_0x713c39[_0xb674('0x37')];if(!_0x49f2d2[_0xb674('0x31')][_0xb674('0x38')](_0xb674('0x39'))){_0x4be374[_0xb674('0x1c')]=qs['limit'](_0x49f2d2[_0xb674('0x31')][_0xb674('0x1c')]);_0x4be374['offset']=qs['offset'](_0x49f2d2['query'][_0xb674('0x1a')]);}return _0x2815d5[_0xb674('0x4e')](_0x4be374);}})[_0xb674('0x23')](function(_0x130642){if(_0x130642){return _0x130642?{'count':_0x1de28d,'rows':_0x130642}:null;}})[_0xb674('0x23')](respondWithResult(_0x1e3ebd,null))[_0xb674('0x42')](handleError(_0x1e3ebd,null));};exports[_0xb674('0x50')]=function(_0x4d8abe,_0xb09643,_0x47ed1d){var _0x2cf886={};var _0x4f037e={};var _0x417fb7;var _0x1bb639;return db['SalesforceConfiguration'][_0xb674('0x4b')]({'where':{'id':_0x4d8abe[_0xb674('0x44')]['id']}})[_0xb674('0x23')](handleEntityNotFound(_0xb09643,null))['then'](function(_0x8f46d1){if(_0x8f46d1){_0x417fb7=_0x8f46d1;_0x4f037e[_0xb674('0x30')]=_['keys'](db[_0xb674('0x4c')]['rawAttributes']);_0x4f037e[_0xb674('0x31')]=_[_0xb674('0x32')](_0x4d8abe[_0xb674('0x31')]);_0x4f037e[_0xb674('0x33')]=_[_0xb674('0x34')](_0x4f037e[_0xb674('0x30')],_0x4f037e[_0xb674('0x31')]);_0x2cf886['attributes']=_[_0xb674('0x34')](_0x4f037e[_0xb674('0x30')],qs[_0xb674('0x35')](_0x4d8abe[_0xb674('0x31')][_0xb674('0x35')]));_0x2cf886[_0xb674('0x36')]=_0x2cf886['attributes'][_0xb674('0x37')]?_0x2cf886[_0xb674('0x36')]:_0x4f037e[_0xb674('0x30')];_0x2cf886[_0xb674('0x4f')]=qs[_0xb674('0x3a')](_0x4d8abe[_0xb674('0x31')]['sort']);_0x2cf886[_0xb674('0x3b')]=qs[_0xb674('0x33')](_[_0xb674('0x4d')](_0x4d8abe['query'],_0x4f037e['filters']));if(_0x4d8abe['query']['filter']){_0x2cf886['where']=_[_0xb674('0x3d')](_0x2cf886[_0xb674('0x3b')],{'$or':_[_0xb674('0x2a')](_0x2cf886[_0xb674('0x36')],function(_0x2f6ed1){var _0x14fc50={};_0x14fc50[_0x2f6ed1]={'$like':'%'+_0x4d8abe[_0xb674('0x31')]['filter']+'%'};return _0x14fc50;})});}_0x2cf886=_[_0xb674('0x3d')]({},_0x2cf886,_0x4d8abe[_0xb674('0x45')]);return _0x417fb7[_0xb674('0x50')](_0x2cf886);}})['then'](function(_0x51f804){if(_0x51f804){_0x1bb639=_0x51f804[_0xb674('0x37')];if(!_0x4d8abe[_0xb674('0x31')]['hasOwnProperty'](_0xb674('0x39'))){_0x2cf886[_0xb674('0x1c')]=qs[_0xb674('0x1c')](_0x4d8abe[_0xb674('0x31')][_0xb674('0x1c')]);_0x2cf886[_0xb674('0x1a')]=qs[_0xb674('0x1a')](_0x4d8abe[_0xb674('0x31')]['offset']);}return _0x417fb7[_0xb674('0x50')](_0x2cf886);}})[_0xb674('0x23')](function(_0x59217f){if(_0x59217f){return _0x59217f?{'count':_0x1bb639,'rows':_0x59217f}:null;}})[_0xb674('0x23')](respondWithResult(_0xb09643,null))[_0xb674('0x42')](handleError(_0xb09643,null));}; \ No newline at end of file +var _0xee5c=['destroy','sendStatus','error','stack','name','send','index','map','type','key','model','query','keys','intersection','attributes','fields','length','nolimit','sort','filters','pick','where','merge','options','SalesforceConfiguration','includeAll','include','findAll','rows','show','params','rawAttributes','catch','create','body','getFields','findOne','SalesforceField','filter','hasOwnProperty','getSubjects','order','getDescriptions','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','save','update','then'];(function(_0x134c2e,_0x3573c4){var _0x2825db=function(_0x2a574d){while(--_0x2a574d){_0x134c2e['push'](_0x134c2e['shift']());}};_0x2825db(++_0x3573c4);}(_0xee5c,0xcd));var _0xcee5=function(_0x4c3ffe,_0x457374){_0x4c3ffe=_0x4c3ffe-0x0;var _0x28d3eb=_0xee5c[_0x4c3ffe];return _0x28d3eb;};'use strict';var emlformat=require(_0xcee5('0x0'));var rimraf=require(_0xcee5('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xcee5('0x2'));var rp=require(_0xcee5('0x3'));var moment=require('moment');var BPromise=require(_0xcee5('0x4'));var Mustache=require(_0xcee5('0x5'));var util=require(_0xcee5('0x6'));var path=require(_0xcee5('0x7'));var sox=require(_0xcee5('0x8'));var csv=require(_0xcee5('0x9'));var ejs=require(_0xcee5('0xa'));var fs=require('fs');var fs_extra=require(_0xcee5('0xb'));var _=require('lodash');var squel=require(_0xcee5('0xc'));var crypto=require('crypto');var jsforce=require(_0xcee5('0xd'));var deskjs=require(_0xcee5('0xe'));var toCsv=require(_0xcee5('0x9'));var querystring=require('querystring');var Papa=require(_0xcee5('0xf'));var Redis=require(_0xcee5('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xcee5('0x11'));var as=require(_0xcee5('0x12'));var hardwareService=require(_0xcee5('0x13'));var logger=require(_0xcee5('0x14'))(_0xcee5('0x15'));var utils=require(_0xcee5('0x16'));var config=require(_0xcee5('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xcee5('0x18'))['db'];function respondWithStatusCode(_0x4baf3c,_0xaf9da5){_0xaf9da5=_0xaf9da5||0xcc;return function(_0x1e6384){if(_0x1e6384){return _0x4baf3c['sendStatus'](_0xaf9da5);}return _0x4baf3c[_0xcee5('0x19')](_0xaf9da5)[_0xcee5('0x1a')]();};}function respondWithResult(_0x227a5a,_0x21c41c){_0x21c41c=_0x21c41c||0xc8;return function(_0x1b3877){if(_0x1b3877){return _0x227a5a[_0xcee5('0x19')](_0x21c41c)[_0xcee5('0x1b')](_0x1b3877);}};}function respondWithFilteredResult(_0x4f1777,_0x85e7aa){return function(_0x440df1){if(_0x440df1){var _0x39f159=typeof _0x85e7aa['offset']===_0xcee5('0x1c')&&typeof _0x85e7aa[_0xcee5('0x1d')]===_0xcee5('0x1c');var _0x442071=_0x440df1[_0xcee5('0x1e')];var _0x1c21d6=_0x39f159?0x0:_0x85e7aa['offset'];var _0x37285c=_0x39f159?_0x440df1[_0xcee5('0x1e')]:_0x85e7aa[_0xcee5('0x1f')]+_0x85e7aa[_0xcee5('0x1d')];var _0x5453d0;if(_0x37285c>=_0x442071){_0x37285c=_0x442071;_0x5453d0=0xc8;}else{_0x5453d0=0xce;}_0x4f1777[_0xcee5('0x19')](_0x5453d0);return _0x4f1777[_0xcee5('0x20')](_0xcee5('0x21'),_0x1c21d6+'-'+_0x37285c+'/'+_0x442071)[_0xcee5('0x1b')](_0x440df1);}return null;};}function patchUpdates(_0x5dd5de){return function(_0x97a01){try{jsonpatch[_0xcee5('0x22')](_0x97a01,_0x5dd5de,!![]);}catch(_0x47bd20){return BPromise['reject'](_0x47bd20);}return _0x97a01[_0xcee5('0x23')]();};}function saveUpdates(_0x19287a,_0x21b3c5){return function(_0xa138dc){if(_0xa138dc){return _0xa138dc[_0xcee5('0x24')](_0x19287a)[_0xcee5('0x25')](function(_0x24953b){return _0x24953b;});}return null;};}function removeEntity(_0x13ad26,_0x27ea1c){return function(_0x547fab){if(_0x547fab){return _0x547fab[_0xcee5('0x26')]()[_0xcee5('0x25')](function(){_0x13ad26[_0xcee5('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3625c3,_0x13c51a){return function(_0x4353b6){if(!_0x4353b6){_0x3625c3[_0xcee5('0x27')](0x194);}return _0x4353b6;};}function handleError(_0x19f694,_0x1909ab){_0x1909ab=_0x1909ab||0x1f4;return function(_0x31c944){logger[_0xcee5('0x28')](_0x31c944[_0xcee5('0x29')]);if(_0x31c944[_0xcee5('0x2a')]){delete _0x31c944[_0xcee5('0x2a')];}_0x19f694[_0xcee5('0x19')](_0x1909ab)[_0xcee5('0x2b')](_0x31c944);};}exports[_0xcee5('0x2c')]=function(_0x58b236,_0x303897){var _0x2e35d3={},_0x373378={},_0x1bcc2a={'count':0x0,'rows':[]};var _0x506390=_[_0xcee5('0x2d')](db['SalesforceConfiguration']['rawAttributes'],function(_0x14b9d5){return{'name':_0x14b9d5['fieldName'],'type':_0x14b9d5[_0xcee5('0x2e')][_0xcee5('0x2f')]};});_0x373378[_0xcee5('0x30')]=_[_0xcee5('0x2d')](_0x506390,'name');_0x373378[_0xcee5('0x31')]=_[_0xcee5('0x32')](_0x58b236['query']);_0x373378['filters']=_[_0xcee5('0x33')](_0x373378[_0xcee5('0x30')],_0x373378[_0xcee5('0x31')]);_0x2e35d3[_0xcee5('0x34')]=_[_0xcee5('0x33')](_0x373378[_0xcee5('0x30')],qs[_0xcee5('0x35')](_0x58b236['query']['fields']));_0x2e35d3[_0xcee5('0x34')]=_0x2e35d3['attributes'][_0xcee5('0x36')]?_0x2e35d3[_0xcee5('0x34')]:_0x373378[_0xcee5('0x30')];if(!_0x58b236['query']['hasOwnProperty'](_0xcee5('0x37'))){_0x2e35d3[_0xcee5('0x1d')]=qs[_0xcee5('0x1d')](_0x58b236['query'][_0xcee5('0x1d')]);_0x2e35d3['offset']=qs['offset'](_0x58b236[_0xcee5('0x31')][_0xcee5('0x1f')]);}_0x2e35d3['order']=qs[_0xcee5('0x38')](_0x58b236['query'][_0xcee5('0x38')]);_0x2e35d3['where']=qs[_0xcee5('0x39')](_[_0xcee5('0x3a')](_0x58b236[_0xcee5('0x31')],_0x373378[_0xcee5('0x39')]),_0x506390);if(_0x58b236[_0xcee5('0x31')]['filter']){_0x2e35d3['where']=_['merge'](_0x2e35d3[_0xcee5('0x3b')],{'$or':_[_0xcee5('0x2d')](_0x506390,function(_0x41fe72){if(_0x41fe72[_0xcee5('0x2e')]!=='VIRTUAL'){var _0x4a7d29={};_0x4a7d29[_0x41fe72['name']]={'$like':'%'+_0x58b236['query']['filter']+'%'};return _0x4a7d29;}})});}_0x2e35d3=_[_0xcee5('0x3c')]({},_0x2e35d3,_0x58b236[_0xcee5('0x3d')]);var _0x9271a5={'where':_0x2e35d3[_0xcee5('0x3b')]};return db[_0xcee5('0x3e')][_0xcee5('0x1e')](_0x9271a5)[_0xcee5('0x25')](function(_0x261593){_0x1bcc2a[_0xcee5('0x1e')]=_0x261593;if(_0x58b236[_0xcee5('0x31')][_0xcee5('0x3f')]){_0x2e35d3[_0xcee5('0x40')]=[{'all':!![]}];}return db[_0xcee5('0x3e')][_0xcee5('0x41')](_0x2e35d3);})[_0xcee5('0x25')](function(_0x5e1ed9){_0x1bcc2a[_0xcee5('0x42')]=_0x5e1ed9;return _0x1bcc2a;})[_0xcee5('0x25')](respondWithFilteredResult(_0x303897,_0x2e35d3))['catch'](handleError(_0x303897,null));};exports[_0xcee5('0x43')]=function(_0xc35baf,_0x3f42d6){var _0x3468af={'raw':![],'where':{'id':_0xc35baf[_0xcee5('0x44')]['id']}},_0x17f633={};_0x17f633['model']=_[_0xcee5('0x32')](db['SalesforceConfiguration'][_0xcee5('0x45')]);_0x17f633[_0xcee5('0x31')]=_[_0xcee5('0x32')](_0xc35baf[_0xcee5('0x31')]);_0x17f633[_0xcee5('0x39')]=_[_0xcee5('0x33')](_0x17f633[_0xcee5('0x30')],_0x17f633['query']);_0x3468af[_0xcee5('0x34')]=_[_0xcee5('0x33')](_0x17f633[_0xcee5('0x30')],qs[_0xcee5('0x35')](_0xc35baf[_0xcee5('0x31')][_0xcee5('0x35')]));_0x3468af[_0xcee5('0x34')]=_0x3468af[_0xcee5('0x34')][_0xcee5('0x36')]?_0x3468af[_0xcee5('0x34')]:_0x17f633[_0xcee5('0x30')];if(_0xc35baf[_0xcee5('0x31')][_0xcee5('0x3f')]){_0x3468af['include']=[{'all':!![]}];}_0x3468af=_[_0xcee5('0x3c')]({},_0x3468af,_0xc35baf[_0xcee5('0x3d')]);return db[_0xcee5('0x3e')]['find'](_0x3468af)[_0xcee5('0x25')](handleEntityNotFound(_0x3f42d6,null))[_0xcee5('0x25')](respondWithResult(_0x3f42d6,null))[_0xcee5('0x46')](handleError(_0x3f42d6,null));};exports[_0xcee5('0x47')]=function(_0x345a61,_0xf96545){return db[_0xcee5('0x3e')][_0xcee5('0x47')](_0x345a61[_0xcee5('0x48')],{})[_0xcee5('0x25')](respondWithResult(_0xf96545,0xc9))[_0xcee5('0x46')](handleError(_0xf96545,null));};exports[_0xcee5('0x24')]=function(_0x2cd757,_0x333e63){if(_0x2cd757[_0xcee5('0x48')]['id']){delete _0x2cd757['body']['id'];}return db[_0xcee5('0x3e')]['find']({'where':{'id':_0x2cd757[_0xcee5('0x44')]['id']}})[_0xcee5('0x25')](handleEntityNotFound(_0x333e63,null))[_0xcee5('0x25')](saveUpdates(_0x2cd757['body'],null))[_0xcee5('0x25')](respondWithResult(_0x333e63,null))[_0xcee5('0x46')](handleError(_0x333e63,null));};exports['destroy']=function(_0xf23cf6,_0x418a60){return db[_0xcee5('0x3e')]['find']({'where':{'id':_0xf23cf6[_0xcee5('0x44')]['id']}})[_0xcee5('0x25')](handleEntityNotFound(_0x418a60,null))['then'](removeEntity(_0x418a60,null))[_0xcee5('0x46')](handleError(_0x418a60,null));};exports[_0xcee5('0x49')]=function(_0x16d02d,_0x27798c,_0x38d0fa){var _0x2224a2={};var _0x16c5bd={};var _0x1fde85;var _0x587881;return db[_0xcee5('0x3e')][_0xcee5('0x4a')]({'where':{'id':_0x16d02d[_0xcee5('0x44')]['id']}})[_0xcee5('0x25')](handleEntityNotFound(_0x27798c,null))[_0xcee5('0x25')](function(_0x41feb6){if(_0x41feb6){_0x1fde85=_0x41feb6;_0x16c5bd['model']=_[_0xcee5('0x32')](db[_0xcee5('0x4b')][_0xcee5('0x45')]);_0x16c5bd[_0xcee5('0x31')]=_[_0xcee5('0x32')](_0x16d02d[_0xcee5('0x31')]);_0x16c5bd['filters']=_[_0xcee5('0x33')](_0x16c5bd['model'],_0x16c5bd[_0xcee5('0x31')]);_0x2224a2['attributes']=_['intersection'](_0x16c5bd[_0xcee5('0x30')],qs[_0xcee5('0x35')](_0x16d02d[_0xcee5('0x31')]['fields']));_0x2224a2[_0xcee5('0x34')]=_0x2224a2['attributes'][_0xcee5('0x36')]?_0x2224a2[_0xcee5('0x34')]:_0x16c5bd[_0xcee5('0x30')];_0x2224a2['order']=qs[_0xcee5('0x38')](_0x16d02d['query'][_0xcee5('0x38')]);_0x2224a2['where']=qs[_0xcee5('0x39')](_[_0xcee5('0x3a')](_0x16d02d[_0xcee5('0x31')],_0x16c5bd['filters']));if(_0x16d02d[_0xcee5('0x31')][_0xcee5('0x4c')]){_0x2224a2['where']=_[_0xcee5('0x3c')](_0x2224a2[_0xcee5('0x3b')],{'$or':_['map'](_0x2224a2[_0xcee5('0x34')],function(_0x1b6612){var _0x909b80={};_0x909b80[_0x1b6612]={'$like':'%'+_0x16d02d[_0xcee5('0x31')][_0xcee5('0x4c')]+'%'};return _0x909b80;})});}_0x2224a2=_[_0xcee5('0x3c')]({},_0x2224a2,_0x16d02d[_0xcee5('0x3d')]);return _0x1fde85[_0xcee5('0x49')](_0x2224a2);}})[_0xcee5('0x25')](function(_0x11e6f4){if(_0x11e6f4){_0x587881=_0x11e6f4['length'];if(!_0x16d02d['query'][_0xcee5('0x4d')](_0xcee5('0x37'))){_0x2224a2[_0xcee5('0x1d')]=qs['limit'](_0x16d02d[_0xcee5('0x31')][_0xcee5('0x1d')]);_0x2224a2[_0xcee5('0x1f')]=qs[_0xcee5('0x1f')](_0x16d02d[_0xcee5('0x31')][_0xcee5('0x1f')]);}return _0x1fde85[_0xcee5('0x49')](_0x2224a2);}})['then'](function(_0x36683d){if(_0x36683d){return _0x36683d?{'count':_0x587881,'rows':_0x36683d}:null;}})[_0xcee5('0x25')](respondWithResult(_0x27798c,null))[_0xcee5('0x46')](handleError(_0x27798c,null));};exports[_0xcee5('0x4e')]=function(_0x1d7041,_0x143b09,_0x16bd61){var _0x5b3085={};var _0x12ea53={};var _0x114a82;var _0x40ab30;return db[_0xcee5('0x3e')]['findOne']({'where':{'id':_0x1d7041[_0xcee5('0x44')]['id']}})[_0xcee5('0x25')](handleEntityNotFound(_0x143b09,null))[_0xcee5('0x25')](function(_0x3077ea){if(_0x3077ea){_0x114a82=_0x3077ea;_0x12ea53[_0xcee5('0x30')]=_[_0xcee5('0x32')](db['SalesforceField'][_0xcee5('0x45')]);_0x12ea53[_0xcee5('0x31')]=_[_0xcee5('0x32')](_0x1d7041[_0xcee5('0x31')]);_0x12ea53[_0xcee5('0x39')]=_[_0xcee5('0x33')](_0x12ea53[_0xcee5('0x30')],_0x12ea53[_0xcee5('0x31')]);_0x5b3085[_0xcee5('0x34')]=_[_0xcee5('0x33')](_0x12ea53[_0xcee5('0x30')],qs[_0xcee5('0x35')](_0x1d7041[_0xcee5('0x31')][_0xcee5('0x35')]));_0x5b3085['attributes']=_0x5b3085[_0xcee5('0x34')][_0xcee5('0x36')]?_0x5b3085['attributes']:_0x12ea53[_0xcee5('0x30')];_0x5b3085[_0xcee5('0x4f')]=qs['sort'](_0x1d7041[_0xcee5('0x31')]['sort']);_0x5b3085[_0xcee5('0x3b')]=qs[_0xcee5('0x39')](_[_0xcee5('0x3a')](_0x1d7041[_0xcee5('0x31')],_0x12ea53[_0xcee5('0x39')]));if(_0x1d7041[_0xcee5('0x31')][_0xcee5('0x4c')]){_0x5b3085[_0xcee5('0x3b')]=_[_0xcee5('0x3c')](_0x5b3085[_0xcee5('0x3b')],{'$or':_[_0xcee5('0x2d')](_0x5b3085[_0xcee5('0x34')],function(_0xa1b862){var _0x1de110={};_0x1de110[_0xa1b862]={'$like':'%'+_0x1d7041[_0xcee5('0x31')][_0xcee5('0x4c')]+'%'};return _0x1de110;})});}_0x5b3085=_['merge']({},_0x5b3085,_0x1d7041[_0xcee5('0x3d')]);return _0x114a82['getSubjects'](_0x5b3085);}})[_0xcee5('0x25')](function(_0x4df678){if(_0x4df678){_0x40ab30=_0x4df678[_0xcee5('0x36')];if(!_0x1d7041[_0xcee5('0x31')][_0xcee5('0x4d')](_0xcee5('0x37'))){_0x5b3085['limit']=qs[_0xcee5('0x1d')](_0x1d7041[_0xcee5('0x31')][_0xcee5('0x1d')]);_0x5b3085['offset']=qs['offset'](_0x1d7041['query'][_0xcee5('0x1f')]);}return _0x114a82[_0xcee5('0x4e')](_0x5b3085);}})[_0xcee5('0x25')](function(_0x1c8a24){if(_0x1c8a24){return _0x1c8a24?{'count':_0x40ab30,'rows':_0x1c8a24}:null;}})['then'](respondWithResult(_0x143b09,null))[_0xcee5('0x46')](handleError(_0x143b09,null));};exports[_0xcee5('0x50')]=function(_0x5d8d73,_0x5a725b,_0x3dab93){var _0x5818ea={};var _0x4239cd={};var _0x216d98;var _0x4485fc;return db[_0xcee5('0x3e')][_0xcee5('0x4a')]({'where':{'id':_0x5d8d73['params']['id']}})[_0xcee5('0x25')](handleEntityNotFound(_0x5a725b,null))[_0xcee5('0x25')](function(_0x154872){if(_0x154872){_0x216d98=_0x154872;_0x4239cd['model']=_[_0xcee5('0x32')](db[_0xcee5('0x4b')][_0xcee5('0x45')]);_0x4239cd[_0xcee5('0x31')]=_[_0xcee5('0x32')](_0x5d8d73[_0xcee5('0x31')]);_0x4239cd[_0xcee5('0x39')]=_[_0xcee5('0x33')](_0x4239cd['model'],_0x4239cd[_0xcee5('0x31')]);_0x5818ea[_0xcee5('0x34')]=_[_0xcee5('0x33')](_0x4239cd[_0xcee5('0x30')],qs[_0xcee5('0x35')](_0x5d8d73[_0xcee5('0x31')][_0xcee5('0x35')]));_0x5818ea['attributes']=_0x5818ea['attributes'][_0xcee5('0x36')]?_0x5818ea['attributes']:_0x4239cd['model'];_0x5818ea[_0xcee5('0x4f')]=qs['sort'](_0x5d8d73[_0xcee5('0x31')]['sort']);_0x5818ea[_0xcee5('0x3b')]=qs['filters'](_[_0xcee5('0x3a')](_0x5d8d73['query'],_0x4239cd[_0xcee5('0x39')]));if(_0x5d8d73['query'][_0xcee5('0x4c')]){_0x5818ea['where']=_[_0xcee5('0x3c')](_0x5818ea['where'],{'$or':_['map'](_0x5818ea['attributes'],function(_0x4ea7de){var _0x54f24a={};_0x54f24a[_0x4ea7de]={'$like':'%'+_0x5d8d73[_0xcee5('0x31')][_0xcee5('0x4c')]+'%'};return _0x54f24a;})});}_0x5818ea=_[_0xcee5('0x3c')]({},_0x5818ea,_0x5d8d73['options']);return _0x216d98[_0xcee5('0x50')](_0x5818ea);}})[_0xcee5('0x25')](function(_0x327e3b){if(_0x327e3b){_0x4485fc=_0x327e3b['length'];if(!_0x5d8d73['query'][_0xcee5('0x4d')]('nolimit')){_0x5818ea[_0xcee5('0x1d')]=qs[_0xcee5('0x1d')](_0x5d8d73[_0xcee5('0x31')][_0xcee5('0x1d')]);_0x5818ea['offset']=qs[_0xcee5('0x1f')](_0x5d8d73[_0xcee5('0x31')]['offset']);}return _0x216d98[_0xcee5('0x50')](_0x5818ea);}})[_0xcee5('0x25')](function(_0x384245){if(_0x384245){return _0x384245?{'count':_0x4485fc,'rows':_0x384245}:null;}})[_0xcee5('0x25')](respondWithResult(_0x5a725b,null))[_0xcee5('0x46')](handleError(_0x5a725b,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js index 7bddf77..3840bc8 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 _0x0399=['define','SalesforceConfiguration','int_salesforce_configurations','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./intSalesforceConfiguration.attributes'];(function(_0x33777a,_0x523e7a){var _0x472a7d=function(_0x7250ed){while(--_0x7250ed){_0x33777a['push'](_0x33777a['shift']());}};_0x472a7d(++_0x523e7a);}(_0x0399,0xf5));var _0x9039=function(_0x413feb,_0x10477f){_0x413feb=_0x413feb-0x0;var _0x40ee88=_0x0399[_0x413feb];return _0x40ee88;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x9039('0x0'))(_0x9039('0x1'));var moment=require(_0x9039('0x2'));var BPromise=require('bluebird');var rp=require(_0x9039('0x3'));var fs=require('fs');var path=require(_0x9039('0x4'));var rimraf=require(_0x9039('0x5'));var config=require(_0x9039('0x6'));var attributes=require(_0x9039('0x7'));module['exports']=function(_0x562ff6,_0x455382){return _0x562ff6[_0x9039('0x8')](_0x9039('0x9'),attributes,{'tableName':_0x9039('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb14f=['int_salesforce_configurations','lodash','util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./intSalesforceConfiguration.attributes','exports','SalesforceConfiguration'];(function(_0x50b1ae,_0x236097){var _0x27adce=function(_0x5cd9f){while(--_0x5cd9f){_0x50b1ae['push'](_0x50b1ae['shift']());}};_0x27adce(++_0x236097);}(_0xb14f,0x199));var _0xfb14=function(_0x373cc0,_0x5eb823){_0x373cc0=_0x373cc0-0x0;var _0x1bd33e=_0xb14f[_0x373cc0];return _0x1bd33e;};'use strict';var _=require(_0xfb14('0x0'));var util=require(_0xfb14('0x1'));var logger=require(_0xfb14('0x2'))(_0xfb14('0x3'));var moment=require('moment');var BPromise=require(_0xfb14('0x4'));var rp=require(_0xfb14('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xfb14('0x6'));var config=require(_0xfb14('0x7'));var attributes=require(_0xfb14('0x8'));module[_0xfb14('0x9')]=function(_0x38ce52,_0x245b4c){return _0x38ce52['define'](_0xfb14('0xa'),attributes,{'tableName':_0xfb14('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 8a619fb..61008f4 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 _0xd129=['rpc','../../config/environment','jayson/promise','request','then','info','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','code','error','message','result','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x34bc6c,_0x10d089){var _0x168820=function(_0xb058d9){while(--_0xb058d9){_0x34bc6c['push'](_0x34bc6c['shift']());}};_0x168820(++_0x10d089);}(_0xd129,0x1c7));var _0x9d12=function(_0x285af3,_0x46b948){_0x285af3=_0x285af3-0x0;var _0xffe75e=_0xd129[_0x285af3];return _0xffe75e;};'use strict';var _=require(_0x9d12('0x0'));var util=require('util');var moment=require(_0x9d12('0x1'));var BPromise=require(_0x9d12('0x2'));var rs=require(_0x9d12('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9d12('0x4'))['db'];var utils=require(_0x9d12('0x5'));var logger=require(_0x9d12('0x6'))(_0x9d12('0x7'));var config=require(_0x9d12('0x8'));var jayson=require(_0x9d12('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x8ae7b7,_0x5b9874,_0x28aac8){return new BPromise(function(_0x464876,_0x16737f){return client[_0x9d12('0xa')](_0x8ae7b7,_0x28aac8)[_0x9d12('0xb')](function(_0x901f67){logger[_0x9d12('0xc')](_0x9d12('0xd'),_0x5b9874,_0x9d12('0xe'));logger[_0x9d12('0xf')]('SalesforceConfiguration,\x20%s,\x20%s,\x20%s',_0x5b9874,_0x9d12('0xe'),JSON[_0x9d12('0x10')](_0x901f67));if(_0x901f67['error']){if(_0x901f67['error'][_0x9d12('0x11')]===0x1f4){logger[_0x9d12('0x12')]('SalesforceConfiguration,\x20%s,\x20%s',_0x5b9874,_0x901f67[_0x9d12('0x12')][_0x9d12('0x13')]);return _0x16737f(_0x901f67['error'][_0x9d12('0x13')]);}logger[_0x9d12('0x12')](_0x9d12('0xd'),_0x5b9874,_0x901f67[_0x9d12('0x12')][_0x9d12('0x13')]);return _0x464876(_0x901f67[_0x9d12('0x12')][_0x9d12('0x13')]);}else{logger[_0x9d12('0xc')](_0x9d12('0xd'),_0x5b9874,_0x9d12('0xe'));_0x464876(_0x901f67[_0x9d12('0x14')][_0x9d12('0x13')]);}})[_0x9d12('0x15')](function(_0x3a86d5){logger[_0x9d12('0x12')](_0x9d12('0xd'),_0x5b9874,_0x3a86d5);_0x16737f(_0x3a86d5);});});} \ No newline at end of file +var _0xdc6a=['http','request','info','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent','debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x3e9fab,_0x190588){var _0x1c5069=function(_0x273eb3){while(--_0x273eb3){_0x3e9fab['push'](_0x3e9fab['shift']());}};_0x1c5069(++_0x190588);}(_0xdc6a,0x121));var _0xadc6=function(_0x58a59d,_0x213d69){_0x58a59d=_0x58a59d-0x0;var _0x1d7df2=_0xdc6a[_0x58a59d];return _0x1d7df2;};'use strict';var _=require(_0xadc6('0x0'));var util=require(_0xadc6('0x1'));var moment=require(_0xadc6('0x2'));var BPromise=require('bluebird');var rs=require(_0xadc6('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xadc6('0x4'))['db'];var utils=require(_0xadc6('0x5'));var logger=require(_0xadc6('0x6'))(_0xadc6('0x7'));var config=require(_0xadc6('0x8'));var jayson=require(_0xadc6('0x9'));var client=jayson['client'][_0xadc6('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2ef896,_0xcc00b7,_0xa57a06){return new BPromise(function(_0x1edb17,_0x51b4af){return client[_0xadc6('0xb')](_0x2ef896,_0xa57a06)['then'](function(_0x322dbc){logger[_0xadc6('0xc')](_0xadc6('0xd'),_0xcc00b7,_0xadc6('0xe'));logger[_0xadc6('0xf')](_0xadc6('0x10'),_0xcc00b7,_0xadc6('0xe'),JSON[_0xadc6('0x11')](_0x322dbc));if(_0x322dbc[_0xadc6('0x12')]){if(_0x322dbc['error'][_0xadc6('0x13')]===0x1f4){logger[_0xadc6('0x12')]('SalesforceConfiguration,\x20%s,\x20%s',_0xcc00b7,_0x322dbc[_0xadc6('0x12')][_0xadc6('0x14')]);return _0x51b4af(_0x322dbc[_0xadc6('0x12')][_0xadc6('0x14')]);}logger[_0xadc6('0x12')]('SalesforceConfiguration,\x20%s,\x20%s',_0xcc00b7,_0x322dbc[_0xadc6('0x12')][_0xadc6('0x14')]);return _0x1edb17(_0x322dbc[_0xadc6('0x12')]['message']);}else{logger[_0xadc6('0xc')]('SalesforceConfiguration,\x20%s,\x20%s',_0xcc00b7,_0xadc6('0xe'));_0x1edb17(_0x322dbc[_0xadc6('0x15')][_0xadc6('0x14')]);}})[_0xadc6('0x16')](function(_0x56ef53){logger['error'](_0xadc6('0xd'),_0xcc00b7,_0x56ef53);_0x51b4af(_0x56ef53);});});} \ No newline at end of file diff --git a/server/api/intSalesforceField/index.js b/server/api/intSalesforceField/index.js index 4419f32..5043540 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 _0x54da=['get','isAuthenticated','index','/:id','post','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x2f1a6e,_0x3082cb){var _0x5865e5=function(_0x459f1a){while(--_0x459f1a){_0x2f1a6e['push'](_0x2f1a6e['shift']());}};_0x5865e5(++_0x3082cb);}(_0x54da,0x173));var _0xa54d=function(_0x151132,_0x32026a){_0x151132=_0x151132-0x0;var _0x13c2ad=_0x54da[_0x151132];return _0x13c2ad;};'use strict';var multer=require(_0xa54d('0x0'));var util=require(_0xa54d('0x1'));var path=require(_0xa54d('0x2'));var timeout=require(_0xa54d('0x3'));var express=require(_0xa54d('0x4'));var router=express['Router']();var fs_extra=require(_0xa54d('0x5'));var auth=require(_0xa54d('0x6'));var interaction=require(_0xa54d('0x7'));var config=require(_0xa54d('0x8'));var controller=require('./intSalesforceField.controller');router[_0xa54d('0x9')]('/',auth[_0xa54d('0xa')](),controller[_0xa54d('0xb')]);router[_0xa54d('0x9')](_0xa54d('0xc'),auth[_0xa54d('0xa')](),controller['show']);router[_0xa54d('0xd')]('/',auth[_0xa54d('0xa')](),controller['create']);router[_0xa54d('0xe')]('/:id',auth[_0xa54d('0xa')](),controller[_0xa54d('0xf')]);router[_0xa54d('0x10')](_0xa54d('0xc'),auth[_0xa54d('0xa')](),controller[_0xa54d('0x11')]);module[_0xa54d('0x12')]=router; \ No newline at end of file +var _0x6a39=['update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','./intSalesforceField.controller','isAuthenticated','index','/:id','post','create'];(function(_0x4df91d,_0x1f64e8){var _0x2dd4f5=function(_0x12f50e){while(--_0x12f50e){_0x4df91d['push'](_0x4df91d['shift']());}};_0x2dd4f5(++_0x1f64e8);}(_0x6a39,0x94));var _0x96a3=function(_0x49677a,_0x197e86){_0x49677a=_0x49677a-0x0;var _0x115408=_0x6a39[_0x49677a];return _0x115408;};'use strict';var multer=require(_0x96a3('0x0'));var util=require(_0x96a3('0x1'));var path=require(_0x96a3('0x2'));var timeout=require(_0x96a3('0x3'));var express=require(_0x96a3('0x4'));var router=express[_0x96a3('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x96a3('0x6'));router['get']('/',auth[_0x96a3('0x7')](),controller[_0x96a3('0x8')]);router['get'](_0x96a3('0x9'),auth['isAuthenticated'](),controller['show']);router[_0x96a3('0xa')]('/',auth['isAuthenticated'](),controller[_0x96a3('0xb')]);router['put']('/:id',auth[_0x96a3('0x7')](),controller[_0x96a3('0xc')]);router[_0x96a3('0xd')]('/:id',auth['isAuthenticated'](),controller[_0x96a3('0xe')]);module[_0x96a3('0xf')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.attributes.js b/server/api/intSalesforceField/intSalesforceField.attributes.js index c1c8661..e9bb167 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 _0x73ff=['ENUM','sequelize','string','variable','customVariable','keyValue','picklist','STRING'];(function(_0x36f1fa,_0x368e28){var _0x500800=function(_0x4983de){while(--_0x4983de){_0x36f1fa['push'](_0x36f1fa['shift']());}};_0x500800(++_0x368e28);}(_0x73ff,0xb1));var _0xf73f=function(_0x276433,_0x1f53fb){_0x276433=_0x276433-0x0;var _0xe61e37=_0x73ff[_0x276433];return _0xe61e37;};'use strict';var Sequelize=require(_0xf73f('0x0'));module['exports']={'type':{'type':Sequelize['ENUM'](_0xf73f('0x1'),_0xf73f('0x2'),_0xf73f('0x3'),_0xf73f('0x4'),_0xf73f('0x5')),'defaultValue':_0xf73f('0x1')},'content':{'type':Sequelize[_0xf73f('0x6')]},'key':{'type':Sequelize[_0xf73f('0x6')]},'keyType':{'type':Sequelize[_0xf73f('0x7')](_0xf73f('0x1'),_0xf73f('0x2'),_0xf73f('0x3'))},'keyContent':{'type':Sequelize[_0xf73f('0x6')]},'idField':{'type':Sequelize[_0xf73f('0x6')]},'variableName':{'type':Sequelize[_0xf73f('0x6')]}}; \ No newline at end of file +var _0x2c41=['keyValue','picklist','STRING','exports','ENUM','string','variable','customVariable'];(function(_0x1368fa,_0x48ea18){var _0x2debec=function(_0x1f5748){while(--_0x1f5748){_0x1368fa['push'](_0x1368fa['shift']());}};_0x2debec(++_0x48ea18);}(_0x2c41,0x173));var _0x12c4=function(_0x5a2299,_0x3e2922){_0x5a2299=_0x5a2299-0x0;var _0xedff0f=_0x2c41[_0x5a2299];return _0xedff0f;};'use strict';var Sequelize=require('sequelize');module[_0x12c4('0x0')]={'type':{'type':Sequelize[_0x12c4('0x1')](_0x12c4('0x2'),_0x12c4('0x3'),_0x12c4('0x4'),_0x12c4('0x5'),_0x12c4('0x6')),'defaultValue':_0x12c4('0x2')},'content':{'type':Sequelize[_0x12c4('0x7')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize['ENUM'](_0x12c4('0x2'),_0x12c4('0x3'),'customVariable')},'keyContent':{'type':Sequelize[_0x12c4('0x7')]},'idField':{'type':Sequelize[_0x12c4('0x7')]},'variableName':{'type':Sequelize[_0x12c4('0x7')]}}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.controller.js b/server/api/intSalesforceField/intSalesforceField.controller.js index 06cbc61..82613df 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 _0x9fb6=['request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','sendStatus','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','pick','filter','where','merge','SalesforceField','includeAll','include','findAll','rows','catch','show','params','options','find','create','body','rimraf','zip-dir','fast-json-patch'];(function(_0x3a392e,_0x55ffce){var _0x3863c6=function(_0x2c8259){while(--_0x2c8259){_0x3a392e['push'](_0x3a392e['shift']());}};_0x3863c6(++_0x55ffce);}(_0x9fb6,0x95));var _0x69fb=function(_0x4a3f9f,_0x51fb03){_0x4a3f9f=_0x4a3f9f-0x0;var _0x45785d=_0x9fb6[_0x4a3f9f];return _0x45785d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x69fb('0x0'));var zipdir=require(_0x69fb('0x1'));var jsonpatch=require(_0x69fb('0x2'));var rp=require(_0x69fb('0x3'));var moment=require(_0x69fb('0x4'));var BPromise=require(_0x69fb('0x5'));var Mustache=require('mustache');var util=require(_0x69fb('0x6'));var path=require(_0x69fb('0x7'));var sox=require(_0x69fb('0x8'));var csv=require(_0x69fb('0x9'));var ejs=require(_0x69fb('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x69fb('0xb'));var squel=require(_0x69fb('0xc'));var crypto=require(_0x69fb('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x69fb('0xe'));var toCsv=require(_0x69fb('0x9'));var querystring=require(_0x69fb('0xf'));var Papa=require('papaparse');var Redis=require(_0x69fb('0x10'));var authService=require(_0x69fb('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x69fb('0x12'));var hardwareService=require(_0x69fb('0x13'));var logger=require(_0x69fb('0x14'))(_0x69fb('0x15'));var utils=require(_0x69fb('0x16'));var config=require(_0x69fb('0x17'));var licenseUtil=require(_0x69fb('0x18'));var db=require(_0x69fb('0x19'))['db'];function respondWithStatusCode(_0x33f8c7,_0x7f41bc){_0x7f41bc=_0x7f41bc||0xcc;return function(_0xf47976){if(_0xf47976){return _0x33f8c7['sendStatus'](_0x7f41bc);}return _0x33f8c7[_0x69fb('0x1a')](_0x7f41bc)[_0x69fb('0x1b')]();};}function respondWithResult(_0x3f9d4b,_0x25e66c){_0x25e66c=_0x25e66c||0xc8;return function(_0x206371){if(_0x206371){return _0x3f9d4b[_0x69fb('0x1a')](_0x25e66c)[_0x69fb('0x1c')](_0x206371);}};}function respondWithFilteredResult(_0x225bd1,_0x2057ba){return function(_0x714d09){if(_0x714d09){var _0x5669bd=typeof _0x2057ba[_0x69fb('0x1d')]===_0x69fb('0x1e')&&typeof _0x2057ba[_0x69fb('0x1f')]==='undefined';var _0x1157ce=_0x714d09['count'];var _0x4df414=_0x5669bd?0x0:_0x2057ba['offset'];var _0x779472=_0x5669bd?_0x714d09[_0x69fb('0x20')]:_0x2057ba[_0x69fb('0x1d')]+_0x2057ba[_0x69fb('0x1f')];var _0x416ec4;if(_0x779472>=_0x1157ce){_0x779472=_0x1157ce;_0x416ec4=0xc8;}else{_0x416ec4=0xce;}_0x225bd1[_0x69fb('0x1a')](_0x416ec4);return _0x225bd1[_0x69fb('0x21')](_0x69fb('0x22'),_0x4df414+'-'+_0x779472+'/'+_0x1157ce)[_0x69fb('0x1c')](_0x714d09);}return null;};}function patchUpdates(_0x254b67){return function(_0x28058f){try{jsonpatch['apply'](_0x28058f,_0x254b67,!![]);}catch(_0x17fe84){return BPromise[_0x69fb('0x23')](_0x17fe84);}return _0x28058f[_0x69fb('0x24')]();};}function saveUpdates(_0x5d7f46,_0x845a32){return function(_0x19b5ef){if(_0x19b5ef){return _0x19b5ef[_0x69fb('0x25')](_0x5d7f46)[_0x69fb('0x26')](function(_0x489f1c){return _0x489f1c;});}return null;};}function removeEntity(_0x59f178,_0x55f3e5){return function(_0x2b8dde){if(_0x2b8dde){return _0x2b8dde['destroy']()['then'](function(){_0x59f178[_0x69fb('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1ea409,_0x534c19){return function(_0x38b93e){if(!_0x38b93e){_0x1ea409[_0x69fb('0x27')](0x194);}return _0x38b93e;};}function handleError(_0x20c969,_0x138f24){_0x138f24=_0x138f24||0x1f4;return function(_0x2e9a63){logger['error'](_0x2e9a63[_0x69fb('0x28')]);if(_0x2e9a63[_0x69fb('0x29')]){delete _0x2e9a63[_0x69fb('0x29')];}_0x20c969[_0x69fb('0x1a')](_0x138f24)[_0x69fb('0x2a')](_0x2e9a63);};}exports[_0x69fb('0x2b')]=function(_0x4d38a7,_0x177e1d){var _0x4dcfbe={},_0x4a1d5d={},_0x54137b={'count':0x0,'rows':[]};var _0x405452=_[_0x69fb('0x2c')](db['SalesforceField'][_0x69fb('0x2d')],function(_0x4ab2fa){return{'name':_0x4ab2fa[_0x69fb('0x2e')],'type':_0x4ab2fa[_0x69fb('0x2f')][_0x69fb('0x30')]};});_0x4a1d5d[_0x69fb('0x31')]=_[_0x69fb('0x2c')](_0x405452,_0x69fb('0x29'));_0x4a1d5d[_0x69fb('0x32')]=_[_0x69fb('0x33')](_0x4d38a7[_0x69fb('0x32')]);_0x4a1d5d[_0x69fb('0x34')]=_[_0x69fb('0x35')](_0x4a1d5d[_0x69fb('0x31')],_0x4a1d5d[_0x69fb('0x32')]);_0x4dcfbe[_0x69fb('0x36')]=_[_0x69fb('0x35')](_0x4a1d5d[_0x69fb('0x31')],qs[_0x69fb('0x37')](_0x4d38a7['query'][_0x69fb('0x37')]));_0x4dcfbe[_0x69fb('0x36')]=_0x4dcfbe[_0x69fb('0x36')][_0x69fb('0x38')]?_0x4dcfbe[_0x69fb('0x36')]:_0x4a1d5d[_0x69fb('0x31')];if(!_0x4d38a7['query']['hasOwnProperty'](_0x69fb('0x39'))){_0x4dcfbe[_0x69fb('0x1f')]=qs[_0x69fb('0x1f')](_0x4d38a7[_0x69fb('0x32')][_0x69fb('0x1f')]);_0x4dcfbe[_0x69fb('0x1d')]=qs['offset'](_0x4d38a7[_0x69fb('0x32')][_0x69fb('0x1d')]);}_0x4dcfbe[_0x69fb('0x3a')]=qs[_0x69fb('0x3b')](_0x4d38a7[_0x69fb('0x32')][_0x69fb('0x3b')]);_0x4dcfbe['where']=qs['filters'](_[_0x69fb('0x3c')](_0x4d38a7[_0x69fb('0x32')],_0x4a1d5d['filters']),_0x405452);if(_0x4d38a7['query'][_0x69fb('0x3d')]){_0x4dcfbe[_0x69fb('0x3e')]=_[_0x69fb('0x3f')](_0x4dcfbe['where'],{'$or':_[_0x69fb('0x2c')](_0x405452,function(_0x2cf0e8){if(_0x2cf0e8[_0x69fb('0x2f')]!=='VIRTUAL'){var _0x42badb={};_0x42badb[_0x2cf0e8[_0x69fb('0x29')]]={'$like':'%'+_0x4d38a7[_0x69fb('0x32')][_0x69fb('0x3d')]+'%'};return _0x42badb;}})});}_0x4dcfbe=_[_0x69fb('0x3f')]({},_0x4dcfbe,_0x4d38a7['options']);var _0x24caf0={'where':_0x4dcfbe[_0x69fb('0x3e')]};return db[_0x69fb('0x40')][_0x69fb('0x20')](_0x24caf0)[_0x69fb('0x26')](function(_0x3b216d){_0x54137b[_0x69fb('0x20')]=_0x3b216d;if(_0x4d38a7[_0x69fb('0x32')][_0x69fb('0x41')]){_0x4dcfbe[_0x69fb('0x42')]=[{'all':!![]}];}return db['SalesforceField'][_0x69fb('0x43')](_0x4dcfbe);})[_0x69fb('0x26')](function(_0x583f33){_0x54137b[_0x69fb('0x44')]=_0x583f33;return _0x54137b;})['then'](respondWithFilteredResult(_0x177e1d,_0x4dcfbe))[_0x69fb('0x45')](handleError(_0x177e1d,null));};exports[_0x69fb('0x46')]=function(_0x543415,_0x164c21){var _0x4f09eb={'raw':!![],'where':{'id':_0x543415[_0x69fb('0x47')]['id']}},_0x1e16a9={};_0x1e16a9[_0x69fb('0x31')]=_[_0x69fb('0x33')](db[_0x69fb('0x40')]['rawAttributes']);_0x1e16a9['query']=_[_0x69fb('0x33')](_0x543415[_0x69fb('0x32')]);_0x1e16a9[_0x69fb('0x34')]=_[_0x69fb('0x35')](_0x1e16a9['model'],_0x1e16a9[_0x69fb('0x32')]);_0x4f09eb[_0x69fb('0x36')]=_[_0x69fb('0x35')](_0x1e16a9[_0x69fb('0x31')],qs[_0x69fb('0x37')](_0x543415[_0x69fb('0x32')]['fields']));_0x4f09eb['attributes']=_0x4f09eb[_0x69fb('0x36')]['length']?_0x4f09eb['attributes']:_0x1e16a9[_0x69fb('0x31')];if(_0x543415[_0x69fb('0x32')][_0x69fb('0x41')]){_0x4f09eb[_0x69fb('0x42')]=[{'all':!![]}];}_0x4f09eb=_[_0x69fb('0x3f')]({},_0x4f09eb,_0x543415[_0x69fb('0x48')]);return db[_0x69fb('0x40')][_0x69fb('0x49')](_0x4f09eb)[_0x69fb('0x26')](handleEntityNotFound(_0x164c21,null))[_0x69fb('0x26')](respondWithResult(_0x164c21,null))[_0x69fb('0x45')](handleError(_0x164c21,null));};exports[_0x69fb('0x4a')]=function(_0x100b9a,_0x37acf1){return db['SalesforceField'][_0x69fb('0x4a')](_0x100b9a[_0x69fb('0x4b')],{})['then'](respondWithResult(_0x37acf1,0xc9))[_0x69fb('0x45')](handleError(_0x37acf1,null));};exports[_0x69fb('0x25')]=function(_0x4978aa,_0x30cf92){if(_0x4978aa[_0x69fb('0x4b')]['id']){delete _0x4978aa['body']['id'];}return db[_0x69fb('0x40')]['find']({'where':{'id':_0x4978aa['params']['id']}})[_0x69fb('0x26')](handleEntityNotFound(_0x30cf92,null))[_0x69fb('0x26')](saveUpdates(_0x4978aa['body'],null))[_0x69fb('0x26')](respondWithResult(_0x30cf92,null))['catch'](handleError(_0x30cf92,null));};exports['destroy']=function(_0x512e09,_0x22e8e3){return db[_0x69fb('0x40')]['find']({'where':{'id':_0x512e09[_0x69fb('0x47')]['id']}})['then'](handleEntityNotFound(_0x22e8e3,null))['then'](removeEntity(_0x22e8e3,null))[_0x69fb('0x45')](handleError(_0x22e8e3,null));}; \ No newline at end of file +var _0x46b6=['fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','sendStatus','end','status','json','offset','undefined','limit','set','Content-Range','reject','save','update','then','stack','name','send','map','SalesforceField','rawAttributes','fieldName','type','key','keys','query','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','length','catch','create','body','find','eml-format','rimraf','zip-dir'];(function(_0x370e07,_0x346ba0){var _0x2fff66=function(_0x2df14c){while(--_0x2df14c){_0x370e07['push'](_0x370e07['shift']());}};_0x2fff66(++_0x346ba0);}(_0x46b6,0xde));var _0x646b=function(_0xfc726c,_0xd8960f){_0xfc726c=_0xfc726c-0x0;var _0x1ee812=_0x46b6[_0xfc726c];return _0x1ee812;};'use strict';var emlformat=require(_0x646b('0x0'));var rimraf=require(_0x646b('0x1'));var zipdir=require(_0x646b('0x2'));var jsonpatch=require(_0x646b('0x3'));var rp=require(_0x646b('0x4'));var moment=require(_0x646b('0x5'));var BPromise=require(_0x646b('0x6'));var Mustache=require('mustache');var util=require(_0x646b('0x7'));var path=require(_0x646b('0x8'));var sox=require('sox');var csv=require(_0x646b('0x9'));var ejs=require(_0x646b('0xa'));var fs=require('fs');var fs_extra=require(_0x646b('0xb'));var _=require('lodash');var squel=require(_0x646b('0xc'));var crypto=require(_0x646b('0xd'));var jsforce=require(_0x646b('0xe'));var deskjs=require(_0x646b('0xf'));var toCsv=require('to-csv');var querystring=require(_0x646b('0x10'));var Papa=require('papaparse');var Redis=require(_0x646b('0x11'));var authService=require(_0x646b('0x12'));var qs=require(_0x646b('0x13'));var as=require(_0x646b('0x14'));var hardwareService=require(_0x646b('0x15'));var logger=require(_0x646b('0x16'))(_0x646b('0x17'));var utils=require(_0x646b('0x18'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xa6af80,_0x34fb19){_0x34fb19=_0x34fb19||0xcc;return function(_0x19409b){if(_0x19409b){return _0xa6af80[_0x646b('0x19')](_0x34fb19);}return _0xa6af80['status'](_0x34fb19)[_0x646b('0x1a')]();};}function respondWithResult(_0x1b7547,_0x5c6558){_0x5c6558=_0x5c6558||0xc8;return function(_0x4f4615){if(_0x4f4615){return _0x1b7547[_0x646b('0x1b')](_0x5c6558)[_0x646b('0x1c')](_0x4f4615);}};}function respondWithFilteredResult(_0x2e78e6,_0x21f7e4){return function(_0x26b316){if(_0x26b316){var _0x33bcdb=typeof _0x21f7e4[_0x646b('0x1d')]===_0x646b('0x1e')&&typeof _0x21f7e4[_0x646b('0x1f')]==='undefined';var _0x19b9cd=_0x26b316['count'];var _0x3d9b78=_0x33bcdb?0x0:_0x21f7e4[_0x646b('0x1d')];var _0x4b0d0c=_0x33bcdb?_0x26b316['count']:_0x21f7e4[_0x646b('0x1d')]+_0x21f7e4[_0x646b('0x1f')];var _0x97982;if(_0x4b0d0c>=_0x19b9cd){_0x4b0d0c=_0x19b9cd;_0x97982=0xc8;}else{_0x97982=0xce;}_0x2e78e6['status'](_0x97982);return _0x2e78e6[_0x646b('0x20')](_0x646b('0x21'),_0x3d9b78+'-'+_0x4b0d0c+'/'+_0x19b9cd)[_0x646b('0x1c')](_0x26b316);}return null;};}function patchUpdates(_0x29bbd0){return function(_0x1c65d6){try{jsonpatch['apply'](_0x1c65d6,_0x29bbd0,!![]);}catch(_0x15cb6d){return BPromise[_0x646b('0x22')](_0x15cb6d);}return _0x1c65d6[_0x646b('0x23')]();};}function saveUpdates(_0x49c164,_0x36cb35){return function(_0x4554bd){if(_0x4554bd){return _0x4554bd[_0x646b('0x24')](_0x49c164)['then'](function(_0xe90a58){return _0xe90a58;});}return null;};}function removeEntity(_0x127b25,_0x666f51){return function(_0x33e316){if(_0x33e316){return _0x33e316['destroy']()[_0x646b('0x25')](function(){_0x127b25[_0x646b('0x1b')](0xcc)[_0x646b('0x1a')]();});}};}function handleEntityNotFound(_0x1be9e5,_0xadcc0){return function(_0x2f080c){if(!_0x2f080c){_0x1be9e5[_0x646b('0x19')](0x194);}return _0x2f080c;};}function handleError(_0x542aba,_0x14a31c){_0x14a31c=_0x14a31c||0x1f4;return function(_0xf0cc4e){logger['error'](_0xf0cc4e[_0x646b('0x26')]);if(_0xf0cc4e[_0x646b('0x27')]){delete _0xf0cc4e['name'];}_0x542aba['status'](_0x14a31c)[_0x646b('0x28')](_0xf0cc4e);};}exports['index']=function(_0x281b24,_0x207a9e){var _0x19cbc4={},_0x5e9696={},_0x14f8dd={'count':0x0,'rows':[]};var _0x5ee6df=_[_0x646b('0x29')](db[_0x646b('0x2a')][_0x646b('0x2b')],function(_0x26aa63){return{'name':_0x26aa63[_0x646b('0x2c')],'type':_0x26aa63[_0x646b('0x2d')][_0x646b('0x2e')]};});_0x5e9696['model']=_['map'](_0x5ee6df,_0x646b('0x27'));_0x5e9696['query']=_[_0x646b('0x2f')](_0x281b24[_0x646b('0x30')]);_0x5e9696[_0x646b('0x31')]=_[_0x646b('0x32')](_0x5e9696[_0x646b('0x33')],_0x5e9696[_0x646b('0x30')]);_0x19cbc4[_0x646b('0x34')]=_[_0x646b('0x32')](_0x5e9696[_0x646b('0x33')],qs['fields'](_0x281b24[_0x646b('0x30')][_0x646b('0x35')]));_0x19cbc4[_0x646b('0x34')]=_0x19cbc4[_0x646b('0x34')]['length']?_0x19cbc4[_0x646b('0x34')]:_0x5e9696[_0x646b('0x33')];if(!_0x281b24[_0x646b('0x30')][_0x646b('0x36')](_0x646b('0x37'))){_0x19cbc4[_0x646b('0x1f')]=qs['limit'](_0x281b24[_0x646b('0x30')][_0x646b('0x1f')]);_0x19cbc4[_0x646b('0x1d')]=qs[_0x646b('0x1d')](_0x281b24['query'][_0x646b('0x1d')]);}_0x19cbc4[_0x646b('0x38')]=qs[_0x646b('0x39')](_0x281b24['query'][_0x646b('0x39')]);_0x19cbc4['where']=qs['filters'](_[_0x646b('0x3a')](_0x281b24[_0x646b('0x30')],_0x5e9696[_0x646b('0x31')]),_0x5ee6df);if(_0x281b24['query'][_0x646b('0x3b')]){_0x19cbc4[_0x646b('0x3c')]=_[_0x646b('0x3d')](_0x19cbc4['where'],{'$or':_['map'](_0x5ee6df,function(_0x114ed9){if(_0x114ed9[_0x646b('0x2d')]!==_0x646b('0x3e')){var _0x24a06c={};_0x24a06c[_0x114ed9[_0x646b('0x27')]]={'$like':'%'+_0x281b24[_0x646b('0x30')][_0x646b('0x3b')]+'%'};return _0x24a06c;}})});}_0x19cbc4=_['merge']({},_0x19cbc4,_0x281b24[_0x646b('0x3f')]);var _0x4e503a={'where':_0x19cbc4[_0x646b('0x3c')]};return db[_0x646b('0x2a')]['count'](_0x4e503a)[_0x646b('0x25')](function(_0x480841){_0x14f8dd['count']=_0x480841;if(_0x281b24[_0x646b('0x30')][_0x646b('0x40')]){_0x19cbc4[_0x646b('0x41')]=[{'all':!![]}];}return db[_0x646b('0x2a')][_0x646b('0x42')](_0x19cbc4);})['then'](function(_0x3d7e61){_0x14f8dd[_0x646b('0x43')]=_0x3d7e61;return _0x14f8dd;})[_0x646b('0x25')](respondWithFilteredResult(_0x207a9e,_0x19cbc4))['catch'](handleError(_0x207a9e,null));};exports[_0x646b('0x44')]=function(_0x112950,_0x24221b){var _0xf3b36e={'raw':!![],'where':{'id':_0x112950[_0x646b('0x45')]['id']}},_0x47bcae={};_0x47bcae['model']=_[_0x646b('0x2f')](db['SalesforceField']['rawAttributes']);_0x47bcae[_0x646b('0x30')]=_[_0x646b('0x2f')](_0x112950[_0x646b('0x30')]);_0x47bcae[_0x646b('0x31')]=_[_0x646b('0x32')](_0x47bcae['model'],_0x47bcae[_0x646b('0x30')]);_0xf3b36e[_0x646b('0x34')]=_[_0x646b('0x32')](_0x47bcae[_0x646b('0x33')],qs[_0x646b('0x35')](_0x112950[_0x646b('0x30')][_0x646b('0x35')]));_0xf3b36e[_0x646b('0x34')]=_0xf3b36e['attributes'][_0x646b('0x46')]?_0xf3b36e[_0x646b('0x34')]:_0x47bcae[_0x646b('0x33')];if(_0x112950[_0x646b('0x30')][_0x646b('0x40')]){_0xf3b36e[_0x646b('0x41')]=[{'all':!![]}];}_0xf3b36e=_[_0x646b('0x3d')]({},_0xf3b36e,_0x112950[_0x646b('0x3f')]);return db[_0x646b('0x2a')]['find'](_0xf3b36e)['then'](handleEntityNotFound(_0x24221b,null))[_0x646b('0x25')](respondWithResult(_0x24221b,null))[_0x646b('0x47')](handleError(_0x24221b,null));};exports['create']=function(_0x1babc6,_0x20271f){return db['SalesforceField'][_0x646b('0x48')](_0x1babc6[_0x646b('0x49')],{})['then'](respondWithResult(_0x20271f,0xc9))[_0x646b('0x47')](handleError(_0x20271f,null));};exports[_0x646b('0x24')]=function(_0xb68c5e,_0x1df8fc){if(_0xb68c5e['body']['id']){delete _0xb68c5e[_0x646b('0x49')]['id'];}return db[_0x646b('0x2a')][_0x646b('0x4a')]({'where':{'id':_0xb68c5e[_0x646b('0x45')]['id']}})[_0x646b('0x25')](handleEntityNotFound(_0x1df8fc,null))[_0x646b('0x25')](saveUpdates(_0xb68c5e[_0x646b('0x49')],null))[_0x646b('0x25')](respondWithResult(_0x1df8fc,null))[_0x646b('0x47')](handleError(_0x1df8fc,null));};exports['destroy']=function(_0x5217cb,_0x54d8f9){return db[_0x646b('0x2a')]['find']({'where':{'id':_0x5217cb['params']['id']}})[_0x646b('0x25')](handleEntityNotFound(_0x54d8f9,null))[_0x646b('0x25')](removeEntity(_0x54d8f9,null))['catch'](handleError(_0x54d8f9,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.model.js b/server/api/intSalesforceField/intSalesforceField.model.js index 9f1a472..e255d0e 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 _0x3f71=['../../config/environment','./intSalesforceField.attributes','exports','define','SalesforceField','salesforce_unique_index','idField','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf'];(function(_0x220af9,_0x1d536a){var _0x295551=function(_0x290673){while(--_0x290673){_0x220af9['push'](_0x220af9['shift']());}};_0x295551(++_0x1d536a);}(_0x3f71,0x133));var _0x13f7=function(_0x49d41c,_0x2bdc35){_0x49d41c=_0x49d41c-0x0;var _0xb64c5f=_0x3f71[_0x49d41c];return _0xb64c5f;};'use strict';var _=require(_0x13f7('0x0'));var util=require(_0x13f7('0x1'));var logger=require(_0x13f7('0x2'))(_0x13f7('0x3'));var moment=require('moment');var BPromise=require(_0x13f7('0x4'));var rp=require(_0x13f7('0x5'));var fs=require('fs');var path=require(_0x13f7('0x6'));var rimraf=require(_0x13f7('0x7'));var config=require(_0x13f7('0x8'));var attributes=require(_0x13f7('0x9'));module[_0x13f7('0xa')]=function(_0xd65542,_0x37e683){return _0xd65542[_0x13f7('0xb')](_0x13f7('0xc'),attributes,{'tableName':'int_salesforce_fields','paranoid':![],'indexes':[{'name':_0x13f7('0xd'),'fields':[_0x13f7('0xe'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x5cef=['bluebird','path','rimraf','../../config/environment','./intSalesforceField.attributes','exports','define','SalesforceField','int_salesforce_fields','salesforce_unique_index','idField','FieldId','api','moment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5cef,0x1e8));var _0xf5ce=function(_0x5d8fe1,_0xf8dad1){_0x5d8fe1=_0x5d8fe1-0x0;var _0x1c7c6c=_0x5cef[_0x5d8fe1];return _0x1c7c6c;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0xf5ce('0x0'));var moment=require(_0xf5ce('0x1'));var BPromise=require(_0xf5ce('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf5ce('0x3'));var rimraf=require(_0xf5ce('0x4'));var config=require(_0xf5ce('0x5'));var attributes=require(_0xf5ce('0x6'));module[_0xf5ce('0x7')]=function(_0x58696f,_0x37e2d8){return _0x58696f[_0xf5ce('0x8')](_0xf5ce('0x9'),attributes,{'tableName':_0xf5ce('0xa'),'paranoid':![],'indexes':[{'name':_0xf5ce('0xb'),'fields':[_0xf5ce('0xc'),_0xf5ce('0xd')],'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 159d0ba..01b618f 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 _0xaa6a=['../../config/utils','../../config/environment','jayson/promise','http','request','then','info','debug','SalesforceField,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','SalesforceField,\x20%s,\x20%s','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb'];(function(_0x2ccf87,_0x1a255b){var _0x3d4715=function(_0x28370c){while(--_0x28370c){_0x2ccf87['push'](_0x2ccf87['shift']());}};_0x3d4715(++_0x1a255b);}(_0xaa6a,0x8d));var _0xaaa6=function(_0x44f55a,_0x74fc4c){_0x44f55a=_0x44f55a-0x0;var _0x26144f=_0xaa6a[_0x44f55a];return _0x26144f;};'use strict';var _=require(_0xaaa6('0x0'));var util=require(_0xaaa6('0x1'));var moment=require(_0xaaa6('0x2'));var BPromise=require('bluebird');var rs=require(_0xaaa6('0x3'));var fs=require('fs');var Redis=require(_0xaaa6('0x4'));var db=require(_0xaaa6('0x5'))['db'];var utils=require(_0xaaa6('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0xaaa6('0x7'));var jayson=require(_0xaaa6('0x8'));var client=jayson['client'][_0xaaa6('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3e8919,_0x1d1ad9,_0x4753fd){return new BPromise(function(_0x173bf8,_0x2143d4){return client[_0xaaa6('0xa')](_0x3e8919,_0x4753fd)[_0xaaa6('0xb')](function(_0x580a83){logger[_0xaaa6('0xc')]('SalesforceField,\x20%s,\x20%s',_0x1d1ad9,'request\x20sent');logger[_0xaaa6('0xd')](_0xaaa6('0xe'),_0x1d1ad9,_0xaaa6('0xf'),JSON['stringify'](_0x580a83));if(_0x580a83[_0xaaa6('0x10')]){if(_0x580a83['error'][_0xaaa6('0x11')]===0x1f4){logger[_0xaaa6('0x10')]('SalesforceField,\x20%s,\x20%s',_0x1d1ad9,_0x580a83[_0xaaa6('0x10')][_0xaaa6('0x12')]);return _0x2143d4(_0x580a83[_0xaaa6('0x10')][_0xaaa6('0x12')]);}logger[_0xaaa6('0x10')](_0xaaa6('0x13'),_0x1d1ad9,_0x580a83[_0xaaa6('0x10')][_0xaaa6('0x12')]);return _0x173bf8(_0x580a83[_0xaaa6('0x10')][_0xaaa6('0x12')]);}else{logger[_0xaaa6('0xc')](_0xaaa6('0x13'),_0x1d1ad9,'request\x20sent');_0x173bf8(_0x580a83['result'][_0xaaa6('0x12')]);}})[_0xaaa6('0x14')](function(_0x1f9d2a){logger[_0xaaa6('0x10')](_0xaaa6('0x13'),_0x1d1ad9,_0x1f9d2a);_0x2143d4(_0x1f9d2a);});});} \ No newline at end of file +var _0x7330=['../../mysqldb','../../config/logger','rpc','../../config/environment','http','then','info','request\x20sent','SalesforceField,\x20%s,\x20%s,\x20%s','stringify','error','code','SalesforceField,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x45c981,_0x2ad2d4){var _0x4f62c8=function(_0x55209b){while(--_0x55209b){_0x45c981['push'](_0x45c981['shift']());}};_0x4f62c8(++_0x2ad2d4);}(_0x7330,0x94));var _0x0733=function(_0x2d8029,_0x16a1e8){_0x2d8029=_0x2d8029-0x0;var _0x3fb34d=_0x7330[_0x2d8029];return _0x3fb34d;};'use strict';var _=require(_0x0733('0x0'));var util=require(_0x0733('0x1'));var moment=require(_0x0733('0x2'));var BPromise=require(_0x0733('0x3'));var rs=require(_0x0733('0x4'));var fs=require('fs');var Redis=require(_0x0733('0x5'));var db=require(_0x0733('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x0733('0x7'))(_0x0733('0x8'));var config=require(_0x0733('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x0733('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5bb36e,_0x472316,_0x40776c){return new BPromise(function(_0x2b17de,_0x212a4b){return client['request'](_0x5bb36e,_0x40776c)[_0x0733('0xb')](function(_0x459790){logger[_0x0733('0xc')]('SalesforceField,\x20%s,\x20%s',_0x472316,_0x0733('0xd'));logger['debug'](_0x0733('0xe'),_0x472316,_0x0733('0xd'),JSON[_0x0733('0xf')](_0x459790));if(_0x459790[_0x0733('0x10')]){if(_0x459790[_0x0733('0x10')][_0x0733('0x11')]===0x1f4){logger[_0x0733('0x10')](_0x0733('0x12'),_0x472316,_0x459790[_0x0733('0x10')][_0x0733('0x13')]);return _0x212a4b(_0x459790[_0x0733('0x10')][_0x0733('0x13')]);}logger[_0x0733('0x10')](_0x0733('0x12'),_0x472316,_0x459790[_0x0733('0x10')][_0x0733('0x13')]);return _0x2b17de(_0x459790['error'][_0x0733('0x13')]);}else{logger['info'](_0x0733('0x12'),_0x472316,_0x0733('0xd'));_0x2b17de(_0x459790[_0x0733('0x14')][_0x0733('0x13')]);}})[_0x0733('0x15')](function(_0x201eb5){logger[_0x0733('0x10')]('SalesforceField,\x20%s,\x20%s',_0x472316,_0x201eb5);_0x212a4b(_0x201eb5);});});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/index.js b/server/api/intServicenowAccount/index.js index f8cfeca..866bc75 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 _0x33e5=['index','/:id','getConfigurations','getFields','create','post','/:id/configurations','delete','destroy','exports','multer','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated'];(function(_0x27a8d1,_0x205937){var _0xb33677=function(_0x3c2599){while(--_0x3c2599){_0x27a8d1['push'](_0x27a8d1['shift']());}};_0xb33677(++_0x205937);}(_0x33e5,0x13a));var _0x533e=function(_0x403af5,_0x2da9fe){_0x403af5=_0x403af5-0x0;var _0x118e1b=_0x33e5[_0x403af5];return _0x118e1b;};'use strict';var multer=require(_0x533e('0x0'));var util=require(_0x533e('0x1'));var path=require(_0x533e('0x2'));var timeout=require('connect-timeout');var express=require(_0x533e('0x3'));var router=express['Router']();var fs_extra=require(_0x533e('0x4'));var auth=require(_0x533e('0x5'));var interaction=require(_0x533e('0x6'));var config=require('../../config/environment');var controller=require('./intServicenowAccount.controller');router[_0x533e('0x7')]('/',auth[_0x533e('0x8')](),controller[_0x533e('0x9')]);router[_0x533e('0x7')](_0x533e('0xa'),auth[_0x533e('0x8')](),controller['show']);router[_0x533e('0x7')]('/:id/configurations',auth[_0x533e('0x8')](),controller[_0x533e('0xb')]);router[_0x533e('0x7')]('/:id/fields',auth[_0x533e('0x8')](),controller[_0x533e('0xc')]);router['post']('/',auth[_0x533e('0x8')](),controller[_0x533e('0xd')]);router[_0x533e('0xe')](_0x533e('0xf'),auth[_0x533e('0x8')](),controller['addConfiguration']);router['put'](_0x533e('0xa'),auth['isAuthenticated'](),controller['update']);router[_0x533e('0x10')](_0x533e('0xa'),auth[_0x533e('0x8')](),controller[_0x533e('0x11')]);module[_0x533e('0x12')]=router; \ No newline at end of file +var _0x684d=['get','isAuthenticated','index','/:id','/:id/configurations','getConfigurations','/:id/fields','getFields','post','addConfiguration','put','update','delete','destroy','exports','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowAccount.controller'];(function(_0x46e363,_0x45d7e2){var _0x3fb059=function(_0x5e6274){while(--_0x5e6274){_0x46e363['push'](_0x46e363['shift']());}};_0x3fb059(++_0x45d7e2);}(_0x684d,0xcf));var _0xd684=function(_0x53ad71,_0x39b873){_0x53ad71=_0x53ad71-0x0;var _0x4babcd=_0x684d[_0x53ad71];return _0x4babcd;};'use strict';var multer=require(_0xd684('0x0'));var util=require(_0xd684('0x1'));var path=require('path');var timeout=require(_0xd684('0x2'));var express=require(_0xd684('0x3'));var router=express['Router']();var fs_extra=require(_0xd684('0x4'));var auth=require(_0xd684('0x5'));var interaction=require(_0xd684('0x6'));var config=require(_0xd684('0x7'));var controller=require(_0xd684('0x8'));router[_0xd684('0x9')]('/',auth[_0xd684('0xa')](),controller[_0xd684('0xb')]);router[_0xd684('0x9')](_0xd684('0xc'),auth['isAuthenticated'](),controller['show']);router['get'](_0xd684('0xd'),auth[_0xd684('0xa')](),controller[_0xd684('0xe')]);router[_0xd684('0x9')](_0xd684('0xf'),auth[_0xd684('0xa')](),controller[_0xd684('0x10')]);router[_0xd684('0x11')]('/',auth[_0xd684('0xa')](),controller['create']);router[_0xd684('0x11')](_0xd684('0xd'),auth[_0xd684('0xa')](),controller[_0xd684('0x12')]);router[_0xd684('0x13')](_0xd684('0xc'),auth[_0xd684('0xa')](),controller[_0xd684('0x14')]);router[_0xd684('0x15')](_0xd684('0xc'),auth[_0xd684('0xa')](),controller[_0xd684('0x16')]);module[_0xd684('0x17')]=router; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.attributes.js b/server/api/intServicenowAccount/intServicenowAccount.attributes.js index c590c9c..4ea1ee5 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 _0x7a71=['remoteUri','sequelize','exports','STRING','username'];(function(_0x599dc0,_0x3c3234){var _0x30dd90=function(_0x33f9e2){while(--_0x33f9e2){_0x599dc0['push'](_0x599dc0['shift']());}};_0x30dd90(++_0x3c3234);}(_0x7a71,0x10a));var _0x17a7=function(_0x5768c8,_0x56f75d){_0x5768c8=_0x5768c8-0x0;var _0x58b8ba=_0x7a71[_0x5768c8];return _0x58b8ba;};'use strict';var Sequelize=require(_0x17a7('0x0'));module[_0x17a7('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x17a7('0x2')],'unique':_0x17a7('0x3')},'password':{'type':Sequelize['STRING']},'email':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x17a7('0x2')],'unique':_0x17a7('0x4')},'serverUrl':{'type':Sequelize[_0x17a7('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x74af=['username','remoteUri','sequelize','exports','STRING'];(function(_0x347453,_0x3286d8){var _0x522b6d=function(_0xef1bf5){while(--_0xef1bf5){_0x347453['push'](_0x347453['shift']());}};_0x522b6d(++_0x3286d8);}(_0x74af,0x12e));var _0xf74a=function(_0x1dd184,_0x5d37d7){_0x1dd184=_0x1dd184-0x0;var _0x3619a7=_0x74af[_0x1dd184];return _0x3619a7;};'use strict';var Sequelize=require(_0xf74a('0x0'));module[_0xf74a('0x1')]={'name':{'type':Sequelize[_0xf74a('0x2')]},'description':{'type':Sequelize[_0xf74a('0x2')]},'username':{'type':Sequelize['STRING'],'unique':_0xf74a('0x3')},'password':{'type':Sequelize[_0xf74a('0x2')]},'email':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0xf74a('0x2')],'unique':_0xf74a('0x4')},'serverUrl':{'type':Sequelize[_0xf74a('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.controller.js b/server/api/intServicenowAccount/intServicenowAccount.controller.js index fb2940f..e6b2cc4 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 _0xec85=['statusCode','Wrong\x20credentials','false','sys_choice?sysparm_query=name=incident^element=','forEach','inactive','value','rimraf','zip-dir','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','undefined','count','Content-Range','json','apply','reject','save','update','then','destroy','end','error','stack','name','send','index','ServicenowAccount','type','model','map','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','offset','sort','filters','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','catch','params','rawAttributes','find','create','body','getConfigurations','findOne','ServicenowConfiguration','order','pick','getSubjects','Descriptions','getDescriptions','channel','Subjects','getFields','made_sla','hold_reason','knowledge','subcategory','severity','category','caused_by','watch_list','upon_reject','sys_updated_on','child_incidents','approval_history','number','resolved_by','opened_by','user_input','sys_domain','state','sys_created_by','calendar_stc','closed_at','cmdb_ci','impact','work_notes_list','business_service','priority','sys_domain_path','rfc','expected_start','business_duration','group_list','work_end','reopened_time','caller_id','approval_set','work_notes','short_description','delivery_task','work_start','assignment_group','additional_assignee_list','description','calendar_duration','notify','closed_by','follow_up','parent_incident','sys_id','contact_type','reopened_by','incident_state','urgency','problem_id','company','reassignment_count','activity_due','assigned_to','comments','sla_due','approval','comments_and_work_notes','due_date','reopen_count','escalation','upon_approval','correlation_id','location','username','password','email','remoteUri','serverUrl','substring','format','%s/api/now/doc/table/schema/','%s/api/now/table/','incident?sysparm_display_value=all','result','log','incident\x20table\x20objects','assign','remove','includes','internalType','label','push','all','TCL:\x20_object','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','concat','ServiceNow\x20error:\x20','test'];(function(_0x38b3a8,_0x4f627c){var _0x10ab69=function(_0x1573a1){while(--_0x1573a1){_0x38b3a8['push'](_0x38b3a8['shift']());}};_0x10ab69(++_0x4f627c);}(_0xec85,0x175));var _0x5ec8=function(_0x57e5c8,_0x4c9aac){_0x57e5c8=_0x57e5c8-0x0;var _0x51fa55=_0xec85[_0x57e5c8];return _0x51fa55;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5ec8('0x0'));var zipdir=require(_0x5ec8('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x5ec8('0x2'));var BPromise=require(_0x5ec8('0x3'));var Mustache=require(_0x5ec8('0x4'));var util=require(_0x5ec8('0x5'));var path=require(_0x5ec8('0x6'));var sox=require(_0x5ec8('0x7'));var csv=require(_0x5ec8('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x5ec8('0x9'));var squel=require(_0x5ec8('0xa'));var crypto=require(_0x5ec8('0xb'));var jsforce=require(_0x5ec8('0xc'));var deskjs=require(_0x5ec8('0xd'));var toCsv=require(_0x5ec8('0x8'));var querystring=require('querystring');var Papa=require(_0x5ec8('0xe'));var Redis=require(_0x5ec8('0xf'));var authService=require(_0x5ec8('0x10'));var qs=require(_0x5ec8('0x11'));var as=require(_0x5ec8('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x5ec8('0x13'))(_0x5ec8('0x14'));var utils=require(_0x5ec8('0x15'));var config=require(_0x5ec8('0x16'));var licenseUtil=require(_0x5ec8('0x17'));var db=require(_0x5ec8('0x18'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x26fee8,_0x258aa8){_0x258aa8=_0x258aa8||0xcc;return function(_0x49c5b7){if(_0x49c5b7){return _0x26fee8[_0x5ec8('0x19')](_0x258aa8);}return _0x26fee8[_0x5ec8('0x1a')](_0x258aa8)['end']();};}function respondWithResult(_0x20271c,_0x4bfcca){_0x4bfcca=_0x4bfcca||0xc8;return function(_0x2a069e){if(_0x2a069e){return _0x20271c[_0x5ec8('0x1a')](_0x4bfcca)['json'](_0x2a069e);}};}function respondWithFilteredResult(_0x1cb652,_0x581397){return function(_0x2fbcf2){if(_0x2fbcf2){var _0x529189=typeof _0x581397['offset']===_0x5ec8('0x1b')&&typeof _0x581397['limit']===_0x5ec8('0x1b');var _0x53a6f1=_0x2fbcf2[_0x5ec8('0x1c')];var _0x3c132e=_0x529189?0x0:_0x581397['offset'];var _0x55fc85=_0x529189?_0x2fbcf2[_0x5ec8('0x1c')]:_0x581397['offset']+_0x581397['limit'];var _0x245736;if(_0x55fc85>=_0x53a6f1){_0x55fc85=_0x53a6f1;_0x245736=0xc8;}else{_0x245736=0xce;}_0x1cb652[_0x5ec8('0x1a')](_0x245736);return _0x1cb652['set'](_0x5ec8('0x1d'),_0x3c132e+'-'+_0x55fc85+'/'+_0x53a6f1)[_0x5ec8('0x1e')](_0x2fbcf2);}return null;};}function patchUpdates(_0x5ee7c2){return function(_0x16343d){try{jsonpatch[_0x5ec8('0x1f')](_0x16343d,_0x5ee7c2,!![]);}catch(_0x2d2ca4){return BPromise[_0x5ec8('0x20')](_0x2d2ca4);}return _0x16343d[_0x5ec8('0x21')]();};}function saveUpdates(_0x4823a7,_0xb75f28){return function(_0xf5a577){if(_0xf5a577){return _0xf5a577[_0x5ec8('0x22')](_0x4823a7)[_0x5ec8('0x23')](function(_0x4b369a){return _0x4b369a;});}return null;};}function removeEntity(_0x20c8c5,_0x1c5ae5){return function(_0x2e6bf3){if(_0x2e6bf3){return _0x2e6bf3[_0x5ec8('0x24')]()[_0x5ec8('0x23')](function(){_0x20c8c5[_0x5ec8('0x1a')](0xcc)[_0x5ec8('0x25')]();});}};}function handleEntityNotFound(_0x440eb0,_0x5a5ff7){return function(_0x273777){if(!_0x273777){_0x440eb0[_0x5ec8('0x19')](0x194);}return _0x273777;};}function handleError(_0x5742ee,_0x520aee){_0x520aee=_0x520aee||0x1f4;return function(_0x40ab60){logger[_0x5ec8('0x26')](_0x40ab60[_0x5ec8('0x27')]);if(_0x40ab60[_0x5ec8('0x28')]){delete _0x40ab60[_0x5ec8('0x28')];}_0x5742ee[_0x5ec8('0x1a')](_0x520aee)[_0x5ec8('0x29')](_0x40ab60);};}exports[_0x5ec8('0x2a')]=function(_0x205fe8,_0x16bde4){var _0x20d570={},_0x8907b={},_0x132ea0={'count':0x0,'rows':[]};var _0x37d2c5=_['map'](db[_0x5ec8('0x2b')]['rawAttributes'],function(_0xfb6e88){return{'name':_0xfb6e88['fieldName'],'type':_0xfb6e88[_0x5ec8('0x2c')]['key']};});_0x8907b[_0x5ec8('0x2d')]=_[_0x5ec8('0x2e')](_0x37d2c5,_0x5ec8('0x28'));_0x8907b[_0x5ec8('0x2f')]=_[_0x5ec8('0x30')](_0x205fe8[_0x5ec8('0x2f')]);_0x8907b['filters']=_[_0x5ec8('0x31')](_0x8907b[_0x5ec8('0x2d')],_0x8907b[_0x5ec8('0x2f')]);_0x20d570['attributes']=_[_0x5ec8('0x31')](_0x8907b['model'],qs[_0x5ec8('0x32')](_0x205fe8[_0x5ec8('0x2f')]['fields']));_0x20d570[_0x5ec8('0x33')]=_0x20d570[_0x5ec8('0x33')][_0x5ec8('0x34')]?_0x20d570[_0x5ec8('0x33')]:_0x8907b[_0x5ec8('0x2d')];if(!_0x205fe8[_0x5ec8('0x2f')][_0x5ec8('0x35')](_0x5ec8('0x36'))){_0x20d570[_0x5ec8('0x37')]=qs[_0x5ec8('0x37')](_0x205fe8[_0x5ec8('0x2f')]['limit']);_0x20d570[_0x5ec8('0x38')]=qs[_0x5ec8('0x38')](_0x205fe8[_0x5ec8('0x2f')][_0x5ec8('0x38')]);}_0x20d570['order']=qs[_0x5ec8('0x39')](_0x205fe8[_0x5ec8('0x2f')][_0x5ec8('0x39')]);_0x20d570['where']=qs[_0x5ec8('0x3a')](_['pick'](_0x205fe8[_0x5ec8('0x2f')],_0x8907b[_0x5ec8('0x3a')]),_0x37d2c5);if(_0x205fe8[_0x5ec8('0x2f')][_0x5ec8('0x3b')]){_0x20d570[_0x5ec8('0x3c')]=_[_0x5ec8('0x3d')](_0x20d570[_0x5ec8('0x3c')],{'$or':_[_0x5ec8('0x2e')](_0x37d2c5,function(_0xd899a5){if(_0xd899a5['type']!==_0x5ec8('0x3e')){var _0x24a6ab={};_0x24a6ab[_0xd899a5[_0x5ec8('0x28')]]={'$like':'%'+_0x205fe8[_0x5ec8('0x2f')]['filter']+'%'};return _0x24a6ab;}})});}_0x20d570=_[_0x5ec8('0x3d')]({},_0x20d570,_0x205fe8[_0x5ec8('0x3f')]);var _0x2f5e47={'where':_0x20d570['where']};return db[_0x5ec8('0x2b')][_0x5ec8('0x1c')](_0x2f5e47)['then'](function(_0x2bd3ec){_0x132ea0[_0x5ec8('0x1c')]=_0x2bd3ec;if(_0x205fe8[_0x5ec8('0x2f')][_0x5ec8('0x40')]){_0x20d570[_0x5ec8('0x41')]=[{'all':!![]}];}return db[_0x5ec8('0x2b')][_0x5ec8('0x42')](_0x20d570);})[_0x5ec8('0x23')](function(_0x6d43de){_0x132ea0['rows']=_0x6d43de;return _0x132ea0;})[_0x5ec8('0x23')](respondWithFilteredResult(_0x16bde4,_0x20d570))[_0x5ec8('0x43')](handleError(_0x16bde4,null));};exports['show']=function(_0x51d370,_0x44eff5){var _0x358a38={'raw':![],'where':{'id':_0x51d370[_0x5ec8('0x44')]['id']}},_0x1cdd97={};_0x1cdd97[_0x5ec8('0x2d')]=_['keys'](db[_0x5ec8('0x2b')][_0x5ec8('0x45')]);_0x1cdd97[_0x5ec8('0x2f')]=_[_0x5ec8('0x30')](_0x51d370['query']);_0x1cdd97[_0x5ec8('0x3a')]=_['intersection'](_0x1cdd97[_0x5ec8('0x2d')],_0x1cdd97[_0x5ec8('0x2f')]);_0x358a38[_0x5ec8('0x33')]=_[_0x5ec8('0x31')](_0x1cdd97[_0x5ec8('0x2d')],qs[_0x5ec8('0x32')](_0x51d370[_0x5ec8('0x2f')][_0x5ec8('0x32')]));_0x358a38['attributes']=_0x358a38[_0x5ec8('0x33')][_0x5ec8('0x34')]?_0x358a38[_0x5ec8('0x33')]:_0x1cdd97[_0x5ec8('0x2d')];if(_0x51d370[_0x5ec8('0x2f')][_0x5ec8('0x40')]){_0x358a38[_0x5ec8('0x41')]=[{'all':!![]}];}_0x358a38=_[_0x5ec8('0x3d')]({},_0x358a38,_0x51d370[_0x5ec8('0x3f')]);return db[_0x5ec8('0x2b')][_0x5ec8('0x46')](_0x358a38)[_0x5ec8('0x23')](handleEntityNotFound(_0x44eff5,null))['then'](respondWithResult(_0x44eff5,null))[_0x5ec8('0x43')](handleError(_0x44eff5,null));};exports['create']=function(_0x972e73,_0x14b068){return db[_0x5ec8('0x2b')][_0x5ec8('0x47')](_0x972e73[_0x5ec8('0x48')],{})[_0x5ec8('0x23')](respondWithResult(_0x14b068,0xc9))[_0x5ec8('0x43')](handleError(_0x14b068,null));};exports[_0x5ec8('0x22')]=function(_0x31f40d,_0x4a957d){if(_0x31f40d[_0x5ec8('0x48')]['id']){delete _0x31f40d[_0x5ec8('0x48')]['id'];}return db[_0x5ec8('0x2b')][_0x5ec8('0x46')]({'where':{'id':_0x31f40d[_0x5ec8('0x44')]['id']}})['then'](handleEntityNotFound(_0x4a957d,null))[_0x5ec8('0x23')](saveUpdates(_0x31f40d[_0x5ec8('0x48')],null))[_0x5ec8('0x23')](respondWithResult(_0x4a957d,null))[_0x5ec8('0x43')](handleError(_0x4a957d,null));};exports['destroy']=function(_0x19e6f9,_0x198320){return db[_0x5ec8('0x2b')][_0x5ec8('0x46')]({'where':{'id':_0x19e6f9[_0x5ec8('0x44')]['id']}})[_0x5ec8('0x23')](handleEntityNotFound(_0x198320,null))[_0x5ec8('0x23')](removeEntity(_0x198320,null))[_0x5ec8('0x43')](handleError(_0x198320,null));};exports[_0x5ec8('0x49')]=function(_0x153db1,_0x27c4e8,_0x42e6b2){var _0x255e4c={};var _0x26c1be={};var _0x27bd17;var _0x3853f6;return db[_0x5ec8('0x2b')][_0x5ec8('0x4a')]({'where':{'id':_0x153db1[_0x5ec8('0x44')]['id']}})['then'](handleEntityNotFound(_0x27c4e8,null))[_0x5ec8('0x23')](function(_0x5122e0){if(_0x5122e0){_0x27bd17=_0x5122e0;_0x26c1be['model']=_[_0x5ec8('0x30')](db[_0x5ec8('0x4b')][_0x5ec8('0x45')]);_0x26c1be[_0x5ec8('0x2f')]=_[_0x5ec8('0x30')](_0x153db1[_0x5ec8('0x2f')]);_0x26c1be['filters']=_[_0x5ec8('0x31')](_0x26c1be['model'],_0x26c1be[_0x5ec8('0x2f')]);_0x255e4c['attributes']=_[_0x5ec8('0x31')](_0x26c1be[_0x5ec8('0x2d')],qs['fields'](_0x153db1[_0x5ec8('0x2f')]['fields']));_0x255e4c[_0x5ec8('0x33')]=_0x255e4c[_0x5ec8('0x33')][_0x5ec8('0x34')]?_0x255e4c['attributes']:_0x26c1be[_0x5ec8('0x2d')];_0x255e4c[_0x5ec8('0x4c')]=qs[_0x5ec8('0x39')](_0x153db1['query']['sort']);_0x255e4c['where']=qs[_0x5ec8('0x3a')](_[_0x5ec8('0x4d')](_0x153db1[_0x5ec8('0x2f')],_0x26c1be[_0x5ec8('0x3a')]));if(_0x153db1[_0x5ec8('0x2f')][_0x5ec8('0x3b')]){_0x255e4c[_0x5ec8('0x3c')]=_[_0x5ec8('0x3d')](_0x255e4c['where'],{'$or':_[_0x5ec8('0x2e')](_0x255e4c['attributes'],function(_0x1cd74f){var _0x43fecc={};_0x43fecc[_0x1cd74f]={'$like':'%'+_0x153db1[_0x5ec8('0x2f')]['filter']+'%'};return _0x43fecc;})});}_0x255e4c=_[_0x5ec8('0x3d')]({},_0x255e4c,_0x153db1[_0x5ec8('0x3f')]);return _0x27bd17['getConfigurations'](_0x255e4c);}})[_0x5ec8('0x23')](function(_0x5174dd){if(_0x5174dd){_0x3853f6=_0x5174dd[_0x5ec8('0x34')];if(!_0x153db1[_0x5ec8('0x2f')]['hasOwnProperty'](_0x5ec8('0x36'))){_0x255e4c['limit']=qs[_0x5ec8('0x37')](_0x153db1['query'][_0x5ec8('0x37')]);_0x255e4c['offset']=qs[_0x5ec8('0x38')](_0x153db1[_0x5ec8('0x2f')]['offset']);}return _0x27bd17['getConfigurations'](_0x255e4c);}})[_0x5ec8('0x23')](function(_0x2f77a4){if(_0x2f77a4){return _0x2f77a4?{'count':_0x3853f6,'rows':_0x2f77a4}:null;}})['then'](respondWithResult(_0x27c4e8,null))[_0x5ec8('0x43')](handleError(_0x27c4e8,null));};exports['addConfiguration']=function(_0x5360b2,_0x4ec96f,_0x231e05){if(_0x5360b2['body']['id']){delete _0x5360b2[_0x5ec8('0x48')]['id'];}return db[_0x5ec8('0x2b')][_0x5ec8('0x4a')]({'where':{'id':_0x5360b2[_0x5ec8('0x44')]['id']}})['then'](handleEntityNotFound(_0x4ec96f,null))[_0x5ec8('0x23')](function(_0x502db9){if(_0x502db9){_0x5360b2[_0x5ec8('0x48')]['AccountId']=_0x502db9['id'];_0x5360b2[_0x5ec8('0x48')]['Subjects']=integrations[_0x5ec8('0x4e')](_0x5360b2[_0x5ec8('0x48')]['channel'],_0x5360b2['body'][_0x5ec8('0x2c')]);_0x5360b2[_0x5ec8('0x48')][_0x5ec8('0x4f')]=integrations[_0x5ec8('0x50')](_0x5360b2['body'][_0x5ec8('0x51')],_0x5360b2[_0x5ec8('0x48')][_0x5ec8('0x2c')]);return db[_0x5ec8('0x4b')][_0x5ec8('0x47')](_0x5360b2['body'],{'include':[{'model':db['ServicenowField'],'as':_0x5ec8('0x52')},{'model':db['ServicenowField'],'as':_0x5ec8('0x4f')}]});}return null;})['then'](respondWithResult(_0x4ec96f,null))[_0x5ec8('0x43')](handleError(_0x4ec96f,null));};exports[_0x5ec8('0x53')]=function(_0x5305e6,_0x264309,_0x47dd00){var _0x4b8080=[_0x5ec8('0x54'),_0x5ec8('0x55'),_0x5ec8('0x56'),_0x5ec8('0x57'),'close_code','notify','incident_state',_0x5ec8('0x58'),_0x5ec8('0x59')];var _0x2d1b73=['parent',_0x5ec8('0x54'),_0x5ec8('0x5a'),_0x5ec8('0x5b'),_0x5ec8('0x5c'),_0x5ec8('0x5d'),_0x5ec8('0x5e'),_0x5ec8('0x55'),_0x5ec8('0x5f'),_0x5ec8('0x60'),_0x5ec8('0x61'),'sys_updated_by',_0x5ec8('0x62'),_0x5ec8('0x63'),'sys_created_on',_0x5ec8('0x64'),_0x5ec8('0x65'),_0x5ec8('0x66'),_0x5ec8('0x56'),_0x5ec8('0x4c'),_0x5ec8('0x67'),_0x5ec8('0x68'),_0x5ec8('0x69'),'delivery_plan',_0x5ec8('0x6a'),'active',_0x5ec8('0x6b'),_0x5ec8('0x6c'),_0x5ec8('0x6d'),_0x5ec8('0x6e'),_0x5ec8('0x6f'),'time_worked',_0x5ec8('0x70'),'opened_at',_0x5ec8('0x71'),_0x5ec8('0x72'),_0x5ec8('0x73'),_0x5ec8('0x74'),'resolved_at',_0x5ec8('0x75'),_0x5ec8('0x76'),_0x5ec8('0x57'),_0x5ec8('0x77'),_0x5ec8('0x78'),'close_code','correlation_display',_0x5ec8('0x79'),_0x5ec8('0x7a'),_0x5ec8('0x7b'),'business_stc',_0x5ec8('0x7c'),_0x5ec8('0x7d'),_0x5ec8('0x7e'),_0x5ec8('0x7f'),'sys_class_name','close_notes',_0x5ec8('0x80'),_0x5ec8('0x81'),_0x5ec8('0x82'),_0x5ec8('0x83'),_0x5ec8('0x84'),_0x5ec8('0x85'),_0x5ec8('0x86'),_0x5ec8('0x87'),_0x5ec8('0x88'),_0x5ec8('0x89'),_0x5ec8('0x8a'),_0x5ec8('0x8b'),_0x5ec8('0x8c'),_0x5ec8('0x58'),_0x5ec8('0x8d'),_0x5ec8('0x8e'),_0x5ec8('0x8f'),_0x5ec8('0x90'),_0x5ec8('0x91'),'sys_mod_count',_0x5ec8('0x92'),'sys_tags',_0x5ec8('0x93'),_0x5ec8('0x94'),_0x5ec8('0x95'),_0x5ec8('0x96'),'category'];var _0x374f84='';var _0x95f92c='';var _0x4f8003=[];var _0x40a0f5='';var _0xb42734='';var _0x1dda6a=[];var _0x1d3f23='';var _0x368f88='';var _0x38fa80={};var _0x290f61='';return db[_0x5ec8('0x2b')][_0x5ec8('0x4a')]({'where':{'id':_0x5305e6['params']['id']},'attributes':['id',_0x5ec8('0x97'),_0x5ec8('0x98'),_0x5ec8('0x99'),_0x5ec8('0x9a'),_0x5ec8('0x9b')]})[_0x5ec8('0x23')](handleEntityNotFound(_0x264309,null))[_0x5ec8('0x23')](function(_0x5e54a6){if(_0x5e54a6){_0x290f61=_0x5e54a6[_0x5ec8('0x9a')];var _0x227537=_0x290f61['slice'](-0x1);if(_0x227537==='/'){_0x290f61=_0x290f61[_0x5ec8('0x9c')](0x0,_0x290f61['lastIndexOf'](_0x227537));}_0x368f88=util[_0x5ec8('0x9d')](_0x5ec8('0x9e'),_0x290f61);_0x1d3f23=util[_0x5ec8('0x9d')](_0x5ec8('0x9f'),_0x290f61);_0x38fa80={'user':_0x5e54a6['username'],'pass':_0x5e54a6[_0x5ec8('0x98')]};var _0x1614b3={'method':'GET','uri':_0x368f88+_0x5ec8('0xa0'),'auth':_0x38fa80,'json':!![]};return rp(_0x1614b3);}})[_0x5ec8('0x23')](function(_0x4b8f88){if(_0x4b8f88[_0x5ec8('0xa1')][_0x5ec8('0x34')]>0x0){_0x374f84=_0x4b8f88[_0x5ec8('0xa1')];}console[_0x5ec8('0xa2')](_0x5ec8('0xa3'),_0x374f84);_0x1dda6a=[];_0x95f92c=Object[_0x5ec8('0xa4')]([],_0x374f84);_[_0x5ec8('0xa5')](_0x95f92c,function(_0x49b15a){return!_0x4b8080[_0x5ec8('0xa6')](_0x49b15a[_0x5ec8('0x28')]);});_0x95f92c['forEach'](function(_0xed598){var _0x462e31=createFieldObject(_0x1d3f23,_0x38fa80,_0xed598[_0x5ec8('0xa7')],_0xed598[_0x5ec8('0x28')],_0xed598[_0x5ec8('0xa8')],![]);_0x1dda6a[_0x5ec8('0xa9')](_0x462e31);});return Promise[_0x5ec8('0xaa')](_0x1dda6a);})[_0x5ec8('0x23')](function(_0x98532){_0x4f8003=_0x98532;_0x40a0f5=Object[_0x5ec8('0xa4')]([],_0x374f84);console[_0x5ec8('0xa2')](_0x5ec8('0xab'),_0x374f84);_[_0x5ec8('0xa5')](_0x40a0f5,function(_0xced99e){return _0x2d1b73[_0x5ec8('0xa6')](_0xced99e['name']);});console['log'](_0x5ec8('0xac'),_0x40a0f5);_0x1dda6a=[];_0x40a0f5['forEach'](function(_0x3f0176){var _0x16dccf=createFieldObject(_0x1d3f23,_0x38fa80,_0x3f0176[_0x5ec8('0xa7')],_0x3f0176[_0x5ec8('0x28')],_0x3f0176[_0x5ec8('0xa8')],!![]);_0x1dda6a[_0x5ec8('0xa9')](_0x16dccf);});return Promise[_0x5ec8('0xaa')](_0x1dda6a);})[_0x5ec8('0x23')](function(_0x5a37f6){_0xb42734=_0x5a37f6;var _0x143f77=_0x4f8003[_0x5ec8('0xad')](_0xb42734);return{'count':_0x143f77['length'],'rows':_0x143f77};})['then'](respondWithResult(_0x264309,null))[_0x5ec8('0x43')](function(_0x4cfce0){console[_0x5ec8('0xa2')](_0x5ec8('0xae')+_0x4cfce0);var _0x9effb4=_0x5305e6['query'][_0x5ec8('0xaf')]?0x1f4:_0x4cfce0[_0x5ec8('0xb0')]||0x1f4;logger['error'](_0x4cfce0[_0x5ec8('0x27')]);delete _0x4cfce0[_0x5ec8('0x28')];if(_0x9effb4===0x191){_0x9effb4=0x190;}_0x264309['status'](_0x9effb4)[_0x5ec8('0x29')](_0x5305e6[_0x5ec8('0x2f')]['test']?{'message':_0x5ec8('0xb1'),'statusCode':_0x4cfce0[_0x5ec8('0xb0')]}:_0x4cfce0);});};function createFieldObject(_0x190f27,_0x1ba684,_0x39ea8f,_0x234de0,_0x654a3d,_0x46a315){return new Promise(function(_0x223850,_0x3f619a){var _0x3d8466={'id':_0x234de0,'name':_0x654a3d,'custom':_0x46a315};if(_0x39ea8f==='boolean'){_0x3d8466[_0x5ec8('0x3f')]=[{'name':'True','value':'true'},{'name':'False','value':_0x5ec8('0xb2')}];_0x223850(_0x3d8466);}else{var _0x184da7={'method':'GET','uri':_0x190f27+_0x5ec8('0xb3')+_0x234de0,'auth':_0x1ba684,'json':!![]};return rp(_0x184da7)[_0x5ec8('0x23')](function(_0x141f38){var _0x723184=[];if(_0x141f38[_0x5ec8('0xa1')][_0x5ec8('0x34')]>0x0){_0x141f38[_0x5ec8('0xa1')][_0x5ec8('0xb4')](function(_0x4a2db6){if(_0x4a2db6[_0x5ec8('0xb5')]===_0x5ec8('0xb2')){var _0x576ffb={'name':_0x4a2db6[_0x5ec8('0xa8')],'value':_0x4a2db6[_0x5ec8('0xb6')]};_0x723184[_0x5ec8('0xa9')](_0x576ffb);}});}_0x3d8466[_0x5ec8('0x3f')]=_0x723184;if(_0x3d8466['options']['length']>0x0){_0x223850(_0x3d8466);}else{if(_0x46a315==![]){_0x223850();}else{_0x223850(_0x3d8466);}}});}});} \ No newline at end of file +var _0x2eb4=['approval','comments_and_work_notes','reopen_count','sys_tags','correlation_id','location','username','password','email','serverUrl','remoteUri','substring','lastIndexOf','format','%s/api/now/doc/table/schema/','GET','incident?sysparm_display_value=all','result','log','incident\x20table\x20objects','assign','remove','includes','forEach','internalType','push','all','TCL:\x20_object','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','label','concat','test','error','send','statusCode','boolean','True','true','False','false','sys_choice?sysparm_query=name=incident^element=','eml-format','zip-dir','request-promise','moment','mustache','util','path','ejs','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','../../components/integrations/configuration','status','end','undefined','count','offset','limit','set','json','apply','reject','save','destroy','then','stack','name','map','ServicenowAccount','rawAttributes','type','key','query','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','merge','includeAll','include','findAll','rows','show','params','keys','options','catch','create','update','body','find','getConfigurations','findOne','ServicenowConfiguration','addConfiguration','AccountId','getSubjects','channel','getDescriptions','ServicenowField','Subjects','getFields','hold_reason','knowledge','notify','incident_state','severity','category','parent','made_sla','caused_by','upon_reject','approval_history','number','resolved_by','opened_by','user_input','sys_created_on','sys_domain','sys_created_by','calendar_stc','closed_at','cmdb_ci','delivery_plan','active','work_notes_list','business_service','priority','sys_domain_path','rfc','opened_at','group_list','work_end','reopened_time','resolved_at','subcategory','work_notes','close_code','correlation_display','delivery_task','additional_assignee_list','description','calendar_duration','sys_class_name','close_notes','closed_by','follow_up','parent_incident','sys_id','contact_type','reopened_by','urgency','reassignment_count','activity_due','assigned_to','sla_due'];(function(_0x20a50a,_0x5a8224){var _0x14b9f7=function(_0x288d78){while(--_0x288d78){_0x20a50a['push'](_0x20a50a['shift']());}};_0x14b9f7(++_0x5a8224);}(_0x2eb4,0xdc));var _0x42eb=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2eb4[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x42eb('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x42eb('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x42eb('0x2'));var moment=require(_0x42eb('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x42eb('0x4'));var util=require(_0x42eb('0x5'));var path=require(_0x42eb('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x42eb('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x42eb('0x8'));var squel=require(_0x42eb('0x9'));var crypto=require('crypto');var jsforce=require(_0x42eb('0xa'));var deskjs=require(_0x42eb('0xb'));var toCsv=require(_0x42eb('0xc'));var querystring=require(_0x42eb('0xd'));var Papa=require(_0x42eb('0xe'));var Redis=require(_0x42eb('0xf'));var authService=require(_0x42eb('0x10'));var qs=require(_0x42eb('0x11'));var as=require(_0x42eb('0x12'));var hardwareService=require(_0x42eb('0x13'));var logger=require(_0x42eb('0x14'))('api');var utils=require(_0x42eb('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x42eb('0x16'));var db=require(_0x42eb('0x17'))['db'];var integrations=require(_0x42eb('0x18'));function respondWithStatusCode(_0x7ab5c4,_0x47c5e7){_0x47c5e7=_0x47c5e7||0xcc;return function(_0x49015c){if(_0x49015c){return _0x7ab5c4['sendStatus'](_0x47c5e7);}return _0x7ab5c4[_0x42eb('0x19')](_0x47c5e7)[_0x42eb('0x1a')]();};}function respondWithResult(_0x3ffae5,_0x4a03ff){_0x4a03ff=_0x4a03ff||0xc8;return function(_0x497d13){if(_0x497d13){return _0x3ffae5[_0x42eb('0x19')](_0x4a03ff)['json'](_0x497d13);}};}function respondWithFilteredResult(_0x33c99d,_0x4b75bc){return function(_0x39e4f0){if(_0x39e4f0){var _0x2b425c=typeof _0x4b75bc['offset']===_0x42eb('0x1b')&&typeof _0x4b75bc['limit']===_0x42eb('0x1b');var _0x1c67d2=_0x39e4f0[_0x42eb('0x1c')];var _0x4e3cd5=_0x2b425c?0x0:_0x4b75bc[_0x42eb('0x1d')];var _0xb96240=_0x2b425c?_0x39e4f0['count']:_0x4b75bc[_0x42eb('0x1d')]+_0x4b75bc[_0x42eb('0x1e')];var _0x383d7c;if(_0xb96240>=_0x1c67d2){_0xb96240=_0x1c67d2;_0x383d7c=0xc8;}else{_0x383d7c=0xce;}_0x33c99d[_0x42eb('0x19')](_0x383d7c);return _0x33c99d[_0x42eb('0x1f')]('Content-Range',_0x4e3cd5+'-'+_0xb96240+'/'+_0x1c67d2)[_0x42eb('0x20')](_0x39e4f0);}return null;};}function patchUpdates(_0x45318d){return function(_0x442dfd){try{jsonpatch[_0x42eb('0x21')](_0x442dfd,_0x45318d,!![]);}catch(_0x1166f2){return BPromise[_0x42eb('0x22')](_0x1166f2);}return _0x442dfd[_0x42eb('0x23')]();};}function saveUpdates(_0x1be724,_0x3a4374){return function(_0x380cd9){if(_0x380cd9){return _0x380cd9['update'](_0x1be724)['then'](function(_0x3e7ed7){return _0x3e7ed7;});}return null;};}function removeEntity(_0x13eb03,_0x2d22e9){return function(_0x17fee5){if(_0x17fee5){return _0x17fee5[_0x42eb('0x24')]()[_0x42eb('0x25')](function(){_0x13eb03[_0x42eb('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x51fc47,_0x491ea0){return function(_0x3b4ee5){if(!_0x3b4ee5){_0x51fc47['sendStatus'](0x194);}return _0x3b4ee5;};}function handleError(_0x3d4dad,_0x566851){_0x566851=_0x566851||0x1f4;return function(_0x5e6e71){logger['error'](_0x5e6e71[_0x42eb('0x26')]);if(_0x5e6e71[_0x42eb('0x27')]){delete _0x5e6e71[_0x42eb('0x27')];}_0x3d4dad[_0x42eb('0x19')](_0x566851)['send'](_0x5e6e71);};}exports['index']=function(_0xd4e981,_0x17813e){var _0x59b40b={},_0x573e24={},_0x3f9c84={'count':0x0,'rows':[]};var _0x408b41=_[_0x42eb('0x28')](db[_0x42eb('0x29')][_0x42eb('0x2a')],function(_0x5bea01){return{'name':_0x5bea01['fieldName'],'type':_0x5bea01[_0x42eb('0x2b')][_0x42eb('0x2c')]};});_0x573e24['model']=_[_0x42eb('0x28')](_0x408b41,'name');_0x573e24[_0x42eb('0x2d')]=_['keys'](_0xd4e981[_0x42eb('0x2d')]);_0x573e24['filters']=_[_0x42eb('0x2e')](_0x573e24[_0x42eb('0x2f')],_0x573e24[_0x42eb('0x2d')]);_0x59b40b[_0x42eb('0x30')]=_[_0x42eb('0x2e')](_0x573e24['model'],qs[_0x42eb('0x31')](_0xd4e981[_0x42eb('0x2d')][_0x42eb('0x31')]));_0x59b40b[_0x42eb('0x30')]=_0x59b40b[_0x42eb('0x30')][_0x42eb('0x32')]?_0x59b40b[_0x42eb('0x30')]:_0x573e24[_0x42eb('0x2f')];if(!_0xd4e981[_0x42eb('0x2d')][_0x42eb('0x33')](_0x42eb('0x34'))){_0x59b40b[_0x42eb('0x1e')]=qs[_0x42eb('0x1e')](_0xd4e981[_0x42eb('0x2d')][_0x42eb('0x1e')]);_0x59b40b[_0x42eb('0x1d')]=qs['offset'](_0xd4e981['query'][_0x42eb('0x1d')]);}_0x59b40b[_0x42eb('0x35')]=qs['sort'](_0xd4e981[_0x42eb('0x2d')][_0x42eb('0x36')]);_0x59b40b['where']=qs[_0x42eb('0x37')](_[_0x42eb('0x38')](_0xd4e981[_0x42eb('0x2d')],_0x573e24['filters']),_0x408b41);if(_0xd4e981[_0x42eb('0x2d')][_0x42eb('0x39')]){_0x59b40b[_0x42eb('0x3a')]=_[_0x42eb('0x3b')](_0x59b40b[_0x42eb('0x3a')],{'$or':_['map'](_0x408b41,function(_0x4b95a5){if(_0x4b95a5[_0x42eb('0x2b')]!=='VIRTUAL'){var _0x53f1af={};_0x53f1af[_0x4b95a5[_0x42eb('0x27')]]={'$like':'%'+_0xd4e981[_0x42eb('0x2d')]['filter']+'%'};return _0x53f1af;}})});}_0x59b40b=_[_0x42eb('0x3b')]({},_0x59b40b,_0xd4e981['options']);var _0x5dc8ca={'where':_0x59b40b[_0x42eb('0x3a')]};return db[_0x42eb('0x29')][_0x42eb('0x1c')](_0x5dc8ca)[_0x42eb('0x25')](function(_0x3e2008){_0x3f9c84[_0x42eb('0x1c')]=_0x3e2008;if(_0xd4e981['query'][_0x42eb('0x3c')]){_0x59b40b[_0x42eb('0x3d')]=[{'all':!![]}];}return db[_0x42eb('0x29')][_0x42eb('0x3e')](_0x59b40b);})['then'](function(_0x5e1176){_0x3f9c84[_0x42eb('0x3f')]=_0x5e1176;return _0x3f9c84;})['then'](respondWithFilteredResult(_0x17813e,_0x59b40b))['catch'](handleError(_0x17813e,null));};exports[_0x42eb('0x40')]=function(_0xabf5ed,_0x206cb1){var _0x507208={'raw':![],'where':{'id':_0xabf5ed[_0x42eb('0x41')]['id']}},_0x287a91={};_0x287a91[_0x42eb('0x2f')]=_[_0x42eb('0x42')](db[_0x42eb('0x29')][_0x42eb('0x2a')]);_0x287a91[_0x42eb('0x2d')]=_[_0x42eb('0x42')](_0xabf5ed[_0x42eb('0x2d')]);_0x287a91[_0x42eb('0x37')]=_[_0x42eb('0x2e')](_0x287a91[_0x42eb('0x2f')],_0x287a91['query']);_0x507208[_0x42eb('0x30')]=_[_0x42eb('0x2e')](_0x287a91[_0x42eb('0x2f')],qs[_0x42eb('0x31')](_0xabf5ed[_0x42eb('0x2d')][_0x42eb('0x31')]));_0x507208[_0x42eb('0x30')]=_0x507208['attributes']['length']?_0x507208[_0x42eb('0x30')]:_0x287a91[_0x42eb('0x2f')];if(_0xabf5ed[_0x42eb('0x2d')][_0x42eb('0x3c')]){_0x507208[_0x42eb('0x3d')]=[{'all':!![]}];}_0x507208=_['merge']({},_0x507208,_0xabf5ed[_0x42eb('0x43')]);return db[_0x42eb('0x29')]['find'](_0x507208)[_0x42eb('0x25')](handleEntityNotFound(_0x206cb1,null))[_0x42eb('0x25')](respondWithResult(_0x206cb1,null))[_0x42eb('0x44')](handleError(_0x206cb1,null));};exports[_0x42eb('0x45')]=function(_0x45d05d,_0x4e5af9){return db['ServicenowAccount']['create'](_0x45d05d['body'],{})['then'](respondWithResult(_0x4e5af9,0xc9))['catch'](handleError(_0x4e5af9,null));};exports[_0x42eb('0x46')]=function(_0x31eac9,_0x15665e){if(_0x31eac9[_0x42eb('0x47')]['id']){delete _0x31eac9[_0x42eb('0x47')]['id'];}return db[_0x42eb('0x29')]['find']({'where':{'id':_0x31eac9[_0x42eb('0x41')]['id']}})[_0x42eb('0x25')](handleEntityNotFound(_0x15665e,null))['then'](saveUpdates(_0x31eac9[_0x42eb('0x47')],null))['then'](respondWithResult(_0x15665e,null))[_0x42eb('0x44')](handleError(_0x15665e,null));};exports[_0x42eb('0x24')]=function(_0xcaf811,_0x18db95){return db[_0x42eb('0x29')][_0x42eb('0x48')]({'where':{'id':_0xcaf811[_0x42eb('0x41')]['id']}})[_0x42eb('0x25')](handleEntityNotFound(_0x18db95,null))[_0x42eb('0x25')](removeEntity(_0x18db95,null))['catch'](handleError(_0x18db95,null));};exports[_0x42eb('0x49')]=function(_0x50fb2a,_0x368bd5,_0x472e5b){var _0x642d39={};var _0x201f9b={};var _0x344895;var _0x283b6e;return db['ServicenowAccount'][_0x42eb('0x4a')]({'where':{'id':_0x50fb2a[_0x42eb('0x41')]['id']}})[_0x42eb('0x25')](handleEntityNotFound(_0x368bd5,null))[_0x42eb('0x25')](function(_0x5c590b){if(_0x5c590b){_0x344895=_0x5c590b;_0x201f9b[_0x42eb('0x2f')]=_['keys'](db[_0x42eb('0x4b')]['rawAttributes']);_0x201f9b[_0x42eb('0x2d')]=_[_0x42eb('0x42')](_0x50fb2a[_0x42eb('0x2d')]);_0x201f9b[_0x42eb('0x37')]=_[_0x42eb('0x2e')](_0x201f9b[_0x42eb('0x2f')],_0x201f9b[_0x42eb('0x2d')]);_0x642d39[_0x42eb('0x30')]=_['intersection'](_0x201f9b[_0x42eb('0x2f')],qs[_0x42eb('0x31')](_0x50fb2a[_0x42eb('0x2d')][_0x42eb('0x31')]));_0x642d39[_0x42eb('0x30')]=_0x642d39['attributes'][_0x42eb('0x32')]?_0x642d39['attributes']:_0x201f9b[_0x42eb('0x2f')];_0x642d39['order']=qs[_0x42eb('0x36')](_0x50fb2a[_0x42eb('0x2d')][_0x42eb('0x36')]);_0x642d39[_0x42eb('0x3a')]=qs[_0x42eb('0x37')](_[_0x42eb('0x38')](_0x50fb2a[_0x42eb('0x2d')],_0x201f9b['filters']));if(_0x50fb2a['query']['filter']){_0x642d39[_0x42eb('0x3a')]=_[_0x42eb('0x3b')](_0x642d39['where'],{'$or':_['map'](_0x642d39[_0x42eb('0x30')],function(_0x5f105f){var _0x12bdba={};_0x12bdba[_0x5f105f]={'$like':'%'+_0x50fb2a[_0x42eb('0x2d')][_0x42eb('0x39')]+'%'};return _0x12bdba;})});}_0x642d39=_['merge']({},_0x642d39,_0x50fb2a[_0x42eb('0x43')]);return _0x344895[_0x42eb('0x49')](_0x642d39);}})[_0x42eb('0x25')](function(_0x56b93b){if(_0x56b93b){_0x283b6e=_0x56b93b[_0x42eb('0x32')];if(!_0x50fb2a[_0x42eb('0x2d')][_0x42eb('0x33')](_0x42eb('0x34'))){_0x642d39[_0x42eb('0x1e')]=qs['limit'](_0x50fb2a[_0x42eb('0x2d')][_0x42eb('0x1e')]);_0x642d39['offset']=qs[_0x42eb('0x1d')](_0x50fb2a[_0x42eb('0x2d')][_0x42eb('0x1d')]);}return _0x344895[_0x42eb('0x49')](_0x642d39);}})[_0x42eb('0x25')](function(_0x371f99){if(_0x371f99){return _0x371f99?{'count':_0x283b6e,'rows':_0x371f99}:null;}})[_0x42eb('0x25')](respondWithResult(_0x368bd5,null))[_0x42eb('0x44')](handleError(_0x368bd5,null));};exports[_0x42eb('0x4c')]=function(_0x1abab5,_0x392de3,_0x70b910){if(_0x1abab5[_0x42eb('0x47')]['id']){delete _0x1abab5['body']['id'];}return db[_0x42eb('0x29')][_0x42eb('0x4a')]({'where':{'id':_0x1abab5[_0x42eb('0x41')]['id']}})[_0x42eb('0x25')](handleEntityNotFound(_0x392de3,null))[_0x42eb('0x25')](function(_0x311c9c){if(_0x311c9c){_0x1abab5['body'][_0x42eb('0x4d')]=_0x311c9c['id'];_0x1abab5[_0x42eb('0x47')]['Subjects']=integrations[_0x42eb('0x4e')](_0x1abab5[_0x42eb('0x47')][_0x42eb('0x4f')],_0x1abab5['body'][_0x42eb('0x2b')]);_0x1abab5[_0x42eb('0x47')]['Descriptions']=integrations[_0x42eb('0x50')](_0x1abab5[_0x42eb('0x47')]['channel'],_0x1abab5[_0x42eb('0x47')][_0x42eb('0x2b')]);return db[_0x42eb('0x4b')][_0x42eb('0x45')](_0x1abab5[_0x42eb('0x47')],{'include':[{'model':db[_0x42eb('0x51')],'as':_0x42eb('0x52')},{'model':db[_0x42eb('0x51')],'as':'Descriptions'}]});}return null;})[_0x42eb('0x25')](respondWithResult(_0x392de3,null))[_0x42eb('0x44')](handleError(_0x392de3,null));};exports[_0x42eb('0x53')]=function(_0x8cf9af,_0x572293,_0x2c5083){var _0x466026=['made_sla',_0x42eb('0x54'),_0x42eb('0x55'),'subcategory','close_code',_0x42eb('0x56'),_0x42eb('0x57'),_0x42eb('0x58'),_0x42eb('0x59')];var _0x521e6a=[_0x42eb('0x5a'),_0x42eb('0x5b'),_0x42eb('0x5c'),'watch_list',_0x42eb('0x5d'),'sys_updated_on','child_incidents',_0x42eb('0x54'),_0x42eb('0x5e'),_0x42eb('0x5f'),_0x42eb('0x60'),'sys_updated_by',_0x42eb('0x61'),_0x42eb('0x62'),_0x42eb('0x63'),_0x42eb('0x64'),'state',_0x42eb('0x65'),_0x42eb('0x55'),_0x42eb('0x35'),_0x42eb('0x66'),_0x42eb('0x67'),_0x42eb('0x68'),_0x42eb('0x69'),'impact',_0x42eb('0x6a'),_0x42eb('0x6b'),_0x42eb('0x6c'),_0x42eb('0x6d'),_0x42eb('0x6e'),_0x42eb('0x6f'),'time_worked','expected_start',_0x42eb('0x70'),'business_duration',_0x42eb('0x71'),_0x42eb('0x72'),_0x42eb('0x73'),_0x42eb('0x74'),'caller_id','approval_set',_0x42eb('0x75'),_0x42eb('0x76'),'short_description',_0x42eb('0x77'),_0x42eb('0x78'),_0x42eb('0x79'),'work_start','assignment_group','business_stc',_0x42eb('0x7a'),_0x42eb('0x7b'),_0x42eb('0x7c'),_0x42eb('0x56'),_0x42eb('0x7d'),_0x42eb('0x7e'),_0x42eb('0x7f'),_0x42eb('0x80'),_0x42eb('0x81'),_0x42eb('0x82'),_0x42eb('0x83'),_0x42eb('0x84'),'incident_state',_0x42eb('0x85'),'problem_id','company',_0x42eb('0x86'),_0x42eb('0x87'),_0x42eb('0x88'),_0x42eb('0x58'),'comments',_0x42eb('0x89'),_0x42eb('0x8a'),_0x42eb('0x8b'),'due_date','sys_mod_count',_0x42eb('0x8c'),_0x42eb('0x8d'),'escalation','upon_approval',_0x42eb('0x8e'),_0x42eb('0x8f'),_0x42eb('0x59')];var _0x360d30='';var _0x339539='';var _0x523fb7=[];var _0x2d7245='';var _0x46ef73='';var _0x34be1a=[];var _0x256564='';var _0xf7253c='';var _0x310a55={};var _0x303728='';return db[_0x42eb('0x29')][_0x42eb('0x4a')]({'where':{'id':_0x8cf9af[_0x42eb('0x41')]['id']},'attributes':['id',_0x42eb('0x90'),_0x42eb('0x91'),_0x42eb('0x92'),'remoteUri',_0x42eb('0x93')]})[_0x42eb('0x25')](handleEntityNotFound(_0x572293,null))[_0x42eb('0x25')](function(_0x30c20c){if(_0x30c20c){_0x303728=_0x30c20c[_0x42eb('0x94')];var _0x4c06d6=_0x303728['slice'](-0x1);if(_0x4c06d6==='/'){_0x303728=_0x303728[_0x42eb('0x95')](0x0,_0x303728[_0x42eb('0x96')](_0x4c06d6));}_0xf7253c=util[_0x42eb('0x97')](_0x42eb('0x98'),_0x303728);_0x256564=util[_0x42eb('0x97')]('%s/api/now/table/',_0x303728);_0x310a55={'user':_0x30c20c[_0x42eb('0x90')],'pass':_0x30c20c[_0x42eb('0x91')]};var _0x371060={'method':_0x42eb('0x99'),'uri':_0xf7253c+_0x42eb('0x9a'),'auth':_0x310a55,'json':!![]};return rp(_0x371060);}})[_0x42eb('0x25')](function(_0x23b39e){if(_0x23b39e[_0x42eb('0x9b')][_0x42eb('0x32')]>0x0){_0x360d30=_0x23b39e[_0x42eb('0x9b')];}console[_0x42eb('0x9c')](_0x42eb('0x9d'),_0x360d30);_0x34be1a=[];_0x339539=Object[_0x42eb('0x9e')]([],_0x360d30);_[_0x42eb('0x9f')](_0x339539,function(_0x510ec6){return!_0x466026[_0x42eb('0xa0')](_0x510ec6[_0x42eb('0x27')]);});_0x339539[_0x42eb('0xa1')](function(_0x42a15e){var _0x197436=createFieldObject(_0x256564,_0x310a55,_0x42a15e[_0x42eb('0xa2')],_0x42a15e[_0x42eb('0x27')],_0x42a15e['label'],![]);_0x34be1a[_0x42eb('0xa3')](_0x197436);});return Promise[_0x42eb('0xa4')](_0x34be1a);})[_0x42eb('0x25')](function(_0x4b075a){_0x523fb7=_0x4b075a;_0x2d7245=Object['assign']([],_0x360d30);console[_0x42eb('0x9c')](_0x42eb('0xa5'),_0x360d30);_[_0x42eb('0x9f')](_0x2d7245,function(_0x57e6d7){return _0x521e6a[_0x42eb('0xa0')](_0x57e6d7['name']);});console['log'](_0x42eb('0xa6'),_0x2d7245);_0x34be1a=[];_0x2d7245[_0x42eb('0xa1')](function(_0x50f4b3){var _0x1bd97d=createFieldObject(_0x256564,_0x310a55,_0x50f4b3[_0x42eb('0xa2')],_0x50f4b3[_0x42eb('0x27')],_0x50f4b3[_0x42eb('0xa7')],!![]);_0x34be1a[_0x42eb('0xa3')](_0x1bd97d);});return Promise[_0x42eb('0xa4')](_0x34be1a);})['then'](function(_0x3a60c6){_0x46ef73=_0x3a60c6;var _0x2bf558=_0x523fb7[_0x42eb('0xa8')](_0x46ef73);return{'count':_0x2bf558[_0x42eb('0x32')],'rows':_0x2bf558};})[_0x42eb('0x25')](respondWithResult(_0x572293,null))[_0x42eb('0x44')](function(_0x5011e6){console['log']('ServiceNow\x20error:\x20'+_0x5011e6);var _0x2cab75=_0x8cf9af[_0x42eb('0x2d')][_0x42eb('0xa9')]?0x1f4:_0x5011e6['statusCode']||0x1f4;logger[_0x42eb('0xaa')](_0x5011e6[_0x42eb('0x26')]);delete _0x5011e6[_0x42eb('0x27')];if(_0x2cab75===0x191){_0x2cab75=0x190;}_0x572293['status'](_0x2cab75)[_0x42eb('0xab')](_0x8cf9af['query'][_0x42eb('0xa9')]?{'message':'Wrong\x20credentials','statusCode':_0x5011e6[_0x42eb('0xac')]}:_0x5011e6);});};function createFieldObject(_0x4a28b1,_0x43ab6a,_0x5a7674,_0x4f5939,_0x19042f,_0x2852c2){return new Promise(function(_0x419e7b,_0x351460){var _0x4ca070={'id':_0x4f5939,'name':_0x19042f,'custom':_0x2852c2};if(_0x5a7674===_0x42eb('0xad')){_0x4ca070[_0x42eb('0x43')]=[{'name':_0x42eb('0xae'),'value':_0x42eb('0xaf')},{'name':_0x42eb('0xb0'),'value':_0x42eb('0xb1')}];_0x419e7b(_0x4ca070);}else{var _0x481505={'method':'GET','uri':_0x4a28b1+_0x42eb('0xb2')+_0x4f5939,'auth':_0x43ab6a,'json':!![]};return rp(_0x481505)[_0x42eb('0x25')](function(_0x441d5a){var _0x126a95=[];if(_0x441d5a[_0x42eb('0x9b')][_0x42eb('0x32')]>0x0){_0x441d5a['result'][_0x42eb('0xa1')](function(_0x130231){if(_0x130231['inactive']==='false'){var _0x3576b7={'name':_0x130231['label'],'value':_0x130231['value']};_0x126a95['push'](_0x3576b7);}});}_0x4ca070['options']=_0x126a95;if(_0x4ca070[_0x42eb('0x43')]['length']>0x0){_0x419e7b(_0x4ca070);}else{if(_0x2852c2==![]){_0x419e7b();}else{_0x419e7b(_0x4ca070);}}});}});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.model.js b/server/api/intServicenowAccount/intServicenowAccount.model.js index bb8e7f8..629a0f9 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 _0xae24=['../../config/logger','moment','bluebird','rimraf','./intServicenowAccount.attributes','../../components/integrations/configuration','exports','define','lodash'];(function(_0x1a196d,_0x5c2806){var _0x538eaa=function(_0x27c1e4){while(--_0x27c1e4){_0x1a196d['push'](_0x1a196d['shift']());}};_0x538eaa(++_0x5c2806);}(_0xae24,0x182));var _0x4ae2=function(_0x59db37,_0x14464c){_0x59db37=_0x59db37-0x0;var _0x3a4d97=_0xae24[_0x59db37];return _0x3a4d97;};'use strict';var _=require(_0x4ae2('0x0'));var util=require('util');var logger=require(_0x4ae2('0x1'))('api');var moment=require(_0x4ae2('0x2'));var BPromise=require(_0x4ae2('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x4ae2('0x4'));var config=require('../../config/environment');var attributes=require(_0x4ae2('0x5'));var integrations=require(_0x4ae2('0x6'));module[_0x4ae2('0x7')]=function(_0x3e6055,_0x428054){return _0x3e6055[_0x4ae2('0x8')]('ServicenowAccount',attributes,{'tableName':'int_servicenow_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7dfd=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intServicenowAccount.attributes','../../components/integrations/configuration','exports','define','ServicenowAccount'];(function(_0x27de44,_0x27864c){var _0x23d632=function(_0x171997){while(--_0x171997){_0x27de44['push'](_0x27de44['shift']());}};_0x23d632(++_0x27864c);}(_0x7dfd,0x1c2));var _0xd7df=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7dfd[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xd7df('0x0'));var util=require(_0xd7df('0x1'));var logger=require(_0xd7df('0x2'))(_0xd7df('0x3'));var moment=require(_0xd7df('0x4'));var BPromise=require(_0xd7df('0x5'));var rp=require(_0xd7df('0x6'));var fs=require('fs');var path=require(_0xd7df('0x7'));var rimraf=require(_0xd7df('0x8'));var config=require(_0xd7df('0x9'));var attributes=require(_0xd7df('0xa'));var integrations=require(_0xd7df('0xb'));module[_0xd7df('0xc')]=function(_0x39ce98,_0x354ea7){return _0x39ce98[_0xd7df('0xd')](_0xd7df('0xe'),attributes,{'tableName':'int_servicenow_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.rpc.js b/server/api/intServicenowAccount/intServicenowAccount.rpc.js index 00892e8..42120e1 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 _0x66d2=['include','map','model','attributes','then','info','GetServicenowAccount','debug','ShowServicenowAccount','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','client','request','ServicenowAccount,\x20%s,\x20%s','request\x20sent','ServicenowAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','findAll','options','raw','where','limit'];(function(_0x3f994d,_0x249d72){var _0x5309b4=function(_0x545307){while(--_0x545307){_0x3f994d['push'](_0x3f994d['shift']());}};_0x5309b4(++_0x249d72);}(_0x66d2,0x1da));var _0x266d=function(_0x2d3c39,_0x1efc75){_0x2d3c39=_0x2d3c39-0x0;var _0x5cb406=_0x66d2[_0x2d3c39];return _0x5cb406;};'use strict';var _=require('lodash');var util=require(_0x266d('0x0'));var moment=require(_0x266d('0x1'));var BPromise=require('bluebird');var rs=require(_0x266d('0x2'));var fs=require('fs');var Redis=require(_0x266d('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x266d('0x4'));var logger=require(_0x266d('0x5'))('rpc');var config=require(_0x266d('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x266d('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x17d665,_0x5c3a90,_0x3f2724){return new BPromise(function(_0x456d8a,_0x2ca382){return client[_0x266d('0x8')](_0x17d665,_0x3f2724)['then'](function(_0x5f533c){logger['info'](_0x266d('0x9'),_0x5c3a90,_0x266d('0xa'));logger['debug'](_0x266d('0xb'),_0x5c3a90,_0x266d('0xa'),JSON[_0x266d('0xc')](_0x5f533c));if(_0x5f533c['error']){if(_0x5f533c[_0x266d('0xd')]['code']===0x1f4){logger['error'](_0x266d('0x9'),_0x5c3a90,_0x5f533c[_0x266d('0xd')]['message']);return _0x2ca382(_0x5f533c[_0x266d('0xd')][_0x266d('0xe')]);}logger[_0x266d('0xd')](_0x266d('0x9'),_0x5c3a90,_0x5f533c[_0x266d('0xd')][_0x266d('0xe')]);return _0x456d8a(_0x5f533c['error'][_0x266d('0xe')]);}else{logger['info'](_0x266d('0x9'),_0x5c3a90,_0x266d('0xa'));_0x456d8a(_0x5f533c[_0x266d('0xf')]['message']);}})[_0x266d('0x10')](function(_0x82f118){logger[_0x266d('0xd')]('ServicenowAccount,\x20%s,\x20%s',_0x5c3a90,_0x82f118);_0x2ca382(_0x82f118);});});}exports['GetServicenowAccount']=function(_0x5daab8){var _0x5bc3d6=this;return new Promise(function(_0x1373f8,_0x34d1c7){return db['ServicenowAccount'][_0x266d('0x11')]({'raw':_0x5daab8[_0x266d('0x12')]?_0x5daab8[_0x266d('0x12')][_0x266d('0x13')]===undefined?!![]:![]:!![],'where':_0x5daab8[_0x266d('0x12')]?_0x5daab8[_0x266d('0x12')][_0x266d('0x14')]||null:null,'attributes':_0x5daab8[_0x266d('0x12')]?_0x5daab8[_0x266d('0x12')]['attributes']||null:null,'limit':_0x5daab8[_0x266d('0x12')]?_0x5daab8[_0x266d('0x12')][_0x266d('0x15')]||null:null,'include':_0x5daab8['options']?_0x5daab8['options'][_0x266d('0x16')]?_[_0x266d('0x17')](_0x5daab8[_0x266d('0x12')]['include'],function(_0x4050f0){return{'model':db[_0x4050f0[_0x266d('0x18')]],'as':_0x4050f0['as'],'attributes':_0x4050f0[_0x266d('0x19')],'include':_0x4050f0[_0x266d('0x16')]?_[_0x266d('0x17')](_0x4050f0[_0x266d('0x16')],function(_0x10888f){return{'model':db[_0x10888f[_0x266d('0x18')]],'as':_0x10888f['as'],'attributes':_0x10888f['attributes'],'include':_0x10888f['include']?_[_0x266d('0x17')](_0x10888f[_0x266d('0x16')],function(_0x570b52){return{'model':db[_0x570b52[_0x266d('0x18')]],'as':_0x570b52['as'],'attributes':_0x570b52[_0x266d('0x19')]};}):[]};}):[]};}):[]:[]})[_0x266d('0x1a')](function(_0x5549e5){logger[_0x266d('0x1b')](_0x266d('0x1c'),_0x5daab8);logger[_0x266d('0x1d')](_0x266d('0x1c'),_0x5daab8,JSON['stringify'](_0x5549e5));_0x1373f8(_0x5549e5);})['catch'](function(_0x480e3c){logger[_0x266d('0xd')]('GetServicenowAccount',_0x480e3c['message'],_0x5daab8);_0x34d1c7(_0x5bc3d6[_0x266d('0xd')](0x1f4,_0x480e3c['message']));});});};exports[_0x266d('0x1e')]=function(_0x3feb7d){var _0x206a70=this;return new Promise(function(_0x4aced7,_0xe9aedc){return db['ServicenowAccount']['find']({'raw':_0x3feb7d[_0x266d('0x12')]?_0x3feb7d[_0x266d('0x12')][_0x266d('0x13')]===undefined?!![]:![]:!![],'where':_0x3feb7d[_0x266d('0x12')]?_0x3feb7d[_0x266d('0x12')][_0x266d('0x14')]||null:null,'attributes':_0x3feb7d[_0x266d('0x12')]?_0x3feb7d['options'][_0x266d('0x19')]||null:null,'include':_0x3feb7d['options']?_0x3feb7d[_0x266d('0x12')]['include']?_[_0x266d('0x17')](_0x3feb7d[_0x266d('0x12')][_0x266d('0x16')],function(_0xe7b402){return{'model':db[_0xe7b402['model']],'as':_0xe7b402['as'],'attributes':_0xe7b402[_0x266d('0x19')],'include':_0xe7b402[_0x266d('0x16')]?_[_0x266d('0x17')](_0xe7b402[_0x266d('0x16')],function(_0x484c1f){return{'model':db[_0x484c1f[_0x266d('0x18')]],'as':_0x484c1f['as'],'attributes':_0x484c1f[_0x266d('0x19')],'include':_0x484c1f[_0x266d('0x16')]?_[_0x266d('0x17')](_0x484c1f[_0x266d('0x16')],function(_0x22bb2a){return{'model':db[_0x22bb2a[_0x266d('0x18')]],'as':_0x22bb2a['as'],'attributes':_0x22bb2a[_0x266d('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4486e9){logger[_0x266d('0x1b')](_0x266d('0x1e'),_0x3feb7d);logger[_0x266d('0x1d')](_0x266d('0x1e'),_0x3feb7d,JSON['stringify'](_0x4486e9));_0x4aced7(_0x4486e9);})[_0x266d('0x10')](function(_0x324167){logger[_0x266d('0xd')]('ShowServicenowAccount',_0x324167[_0x266d('0xe')],_0x3feb7d);_0xe9aedc(_0x206a70[_0x266d('0xd')](0x1f4,_0x324167[_0x266d('0xe')]));});});}; \ No newline at end of file +var _0xa7cd=['attributes','then','ShowServicenowAccount','find','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','ServicenowAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','GetServicenowAccount','ServicenowAccount','findAll','options','raw','where','limit','map','include','model'];(function(_0x368fb9,_0x1a9895){var _0x4892fb=function(_0x28d735){while(--_0x28d735){_0x368fb9['push'](_0x368fb9['shift']());}};_0x4892fb(++_0x1a9895);}(_0xa7cd,0x12c));var _0xda7c=function(_0x33d270,_0x212bcf){_0x33d270=_0x33d270-0x0;var _0xee3770=_0xa7cd[_0x33d270];return _0xee3770;};'use strict';var _=require(_0xda7c('0x0'));var util=require(_0xda7c('0x1'));var moment=require(_0xda7c('0x2'));var BPromise=require(_0xda7c('0x3'));var rs=require(_0xda7c('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xda7c('0x5'));var logger=require(_0xda7c('0x6'))(_0xda7c('0x7'));var config=require(_0xda7c('0x8'));var jayson=require(_0xda7c('0x9'));var client=jayson[_0xda7c('0xa')][_0xda7c('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x318b39,_0x8d3b35,_0x547590){return new BPromise(function(_0x407f24,_0x326d6a){return client[_0xda7c('0xc')](_0x318b39,_0x547590)['then'](function(_0x3417bd){logger[_0xda7c('0xd')](_0xda7c('0xe'),_0x8d3b35,_0xda7c('0xf'));logger[_0xda7c('0x10')]('ServicenowAccount,\x20%s,\x20%s,\x20%s',_0x8d3b35,_0xda7c('0xf'),JSON[_0xda7c('0x11')](_0x3417bd));if(_0x3417bd[_0xda7c('0x12')]){if(_0x3417bd[_0xda7c('0x12')][_0xda7c('0x13')]===0x1f4){logger[_0xda7c('0x12')]('ServicenowAccount,\x20%s,\x20%s',_0x8d3b35,_0x3417bd['error'][_0xda7c('0x14')]);return _0x326d6a(_0x3417bd['error'][_0xda7c('0x14')]);}logger[_0xda7c('0x12')](_0xda7c('0xe'),_0x8d3b35,_0x3417bd[_0xda7c('0x12')][_0xda7c('0x14')]);return _0x407f24(_0x3417bd[_0xda7c('0x12')][_0xda7c('0x14')]);}else{logger[_0xda7c('0xd')]('ServicenowAccount,\x20%s,\x20%s',_0x8d3b35,_0xda7c('0xf'));_0x407f24(_0x3417bd[_0xda7c('0x15')][_0xda7c('0x14')]);}})[_0xda7c('0x16')](function(_0x5b54b7){logger['error'](_0xda7c('0xe'),_0x8d3b35,_0x5b54b7);_0x326d6a(_0x5b54b7);});});}exports[_0xda7c('0x17')]=function(_0x56aa75){var _0x1739fb=this;return new Promise(function(_0x4a01be,_0x53a6f1){return db[_0xda7c('0x18')][_0xda7c('0x19')]({'raw':_0x56aa75[_0xda7c('0x1a')]?_0x56aa75[_0xda7c('0x1a')][_0xda7c('0x1b')]===undefined?!![]:![]:!![],'where':_0x56aa75[_0xda7c('0x1a')]?_0x56aa75[_0xda7c('0x1a')][_0xda7c('0x1c')]||null:null,'attributes':_0x56aa75[_0xda7c('0x1a')]?_0x56aa75[_0xda7c('0x1a')]['attributes']||null:null,'limit':_0x56aa75[_0xda7c('0x1a')]?_0x56aa75[_0xda7c('0x1a')][_0xda7c('0x1d')]||null:null,'include':_0x56aa75[_0xda7c('0x1a')]?_0x56aa75[_0xda7c('0x1a')]['include']?_[_0xda7c('0x1e')](_0x56aa75[_0xda7c('0x1a')][_0xda7c('0x1f')],function(_0x560b3a){return{'model':db[_0x560b3a[_0xda7c('0x20')]],'as':_0x560b3a['as'],'attributes':_0x560b3a[_0xda7c('0x21')],'include':_0x560b3a[_0xda7c('0x1f')]?_[_0xda7c('0x1e')](_0x560b3a[_0xda7c('0x1f')],function(_0x27e749){return{'model':db[_0x27e749[_0xda7c('0x20')]],'as':_0x27e749['as'],'attributes':_0x27e749[_0xda7c('0x21')],'include':_0x27e749[_0xda7c('0x1f')]?_[_0xda7c('0x1e')](_0x27e749[_0xda7c('0x1f')],function(_0x4a33ba){return{'model':db[_0x4a33ba[_0xda7c('0x20')]],'as':_0x4a33ba['as'],'attributes':_0x4a33ba[_0xda7c('0x21')]};}):[]};}):[]};}):[]:[]})[_0xda7c('0x22')](function(_0x565a97){logger['info'](_0xda7c('0x17'),_0x56aa75);logger[_0xda7c('0x10')](_0xda7c('0x17'),_0x56aa75,JSON[_0xda7c('0x11')](_0x565a97));_0x4a01be(_0x565a97);})[_0xda7c('0x16')](function(_0x209d95){logger[_0xda7c('0x12')]('GetServicenowAccount',_0x209d95['message'],_0x56aa75);_0x53a6f1(_0x1739fb[_0xda7c('0x12')](0x1f4,_0x209d95[_0xda7c('0x14')]));});});};exports[_0xda7c('0x23')]=function(_0x27c52c){var _0x4c43ce=this;return new Promise(function(_0x16873d,_0x53ac92){return db[_0xda7c('0x18')][_0xda7c('0x24')]({'raw':_0x27c52c[_0xda7c('0x1a')]?_0x27c52c[_0xda7c('0x1a')][_0xda7c('0x1b')]===undefined?!![]:![]:!![],'where':_0x27c52c[_0xda7c('0x1a')]?_0x27c52c[_0xda7c('0x1a')][_0xda7c('0x1c')]||null:null,'attributes':_0x27c52c[_0xda7c('0x1a')]?_0x27c52c[_0xda7c('0x1a')][_0xda7c('0x21')]||null:null,'include':_0x27c52c[_0xda7c('0x1a')]?_0x27c52c[_0xda7c('0x1a')][_0xda7c('0x1f')]?_[_0xda7c('0x1e')](_0x27c52c[_0xda7c('0x1a')]['include'],function(_0xaa3c85){return{'model':db[_0xaa3c85[_0xda7c('0x20')]],'as':_0xaa3c85['as'],'attributes':_0xaa3c85[_0xda7c('0x21')],'include':_0xaa3c85['include']?_['map'](_0xaa3c85[_0xda7c('0x1f')],function(_0x32184c){return{'model':db[_0x32184c[_0xda7c('0x20')]],'as':_0x32184c['as'],'attributes':_0x32184c['attributes'],'include':_0x32184c[_0xda7c('0x1f')]?_[_0xda7c('0x1e')](_0x32184c['include'],function(_0xc8e850){return{'model':db[_0xc8e850[_0xda7c('0x20')]],'as':_0xc8e850['as'],'attributes':_0xc8e850[_0xda7c('0x21')]};}):[]};}):[]};}):[]:[]})[_0xda7c('0x22')](function(_0x2e38f7){logger['info'](_0xda7c('0x23'),_0x27c52c);logger['debug'](_0xda7c('0x23'),_0x27c52c,JSON[_0xda7c('0x11')](_0x2e38f7));_0x16873d(_0x2e38f7);})['catch'](function(_0x22e46c){logger['error'](_0xda7c('0x23'),_0x22e46c[_0xda7c('0x14')],_0x27c52c);_0x53ac92(_0x4c43ce[_0xda7c('0x12')](0x1f4,_0x22e46c[_0xda7c('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/index.js b/server/api/intServicenowConfiguration/index.js index 9c3a13d..0caf773 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 _0x579a=['put','delete','destroy','exports','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','/:id','show','getFields','/:id/subjects','/:id/descriptions','getDescriptions','post','create'];(function(_0x2fbc5f,_0x527174){var _0x59c389=function(_0x1a3100){while(--_0x1a3100){_0x2fbc5f['push'](_0x2fbc5f['shift']());}};_0x59c389(++_0x527174);}(_0x579a,0x1a8));var _0xa579=function(_0x4867ba,_0x104f06){_0x4867ba=_0x4867ba-0x0;var _0x1c34fe=_0x579a[_0x4867ba];return _0x1c34fe;};'use strict';var multer=require(_0xa579('0x0'));var util=require(_0xa579('0x1'));var path=require('path');var timeout=require(_0xa579('0x2'));var express=require('express');var router=express[_0xa579('0x3')]();var fs_extra=require(_0xa579('0x4'));var auth=require(_0xa579('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xa579('0x6'));var controller=require('./intServicenowConfiguration.controller');router[_0xa579('0x7')]('/',auth[_0xa579('0x8')](),controller['index']);router[_0xa579('0x7')](_0xa579('0x9'),auth['isAuthenticated'](),controller[_0xa579('0xa')]);router['get']('/:id/fields',auth['isAuthenticated'](),controller[_0xa579('0xb')]);router['get'](_0xa579('0xc'),auth[_0xa579('0x8')](),controller['getSubjects']);router[_0xa579('0x7')](_0xa579('0xd'),auth[_0xa579('0x8')](),controller[_0xa579('0xe')]);router[_0xa579('0xf')]('/',auth[_0xa579('0x8')](),controller[_0xa579('0x10')]);router[_0xa579('0x11')]('/:id',auth[_0xa579('0x8')](),controller['update']);router[_0xa579('0x12')](_0xa579('0x9'),auth[_0xa579('0x8')](),controller[_0xa579('0x13')]);module[_0xa579('0x14')]=router; \ No newline at end of file +var _0x922d=['getFields','/:id/subjects','getSubjects','/:id/descriptions','put','delete','multer','util','path','Router','fs-extra','../../components/auth/service','../../config/environment','./intServicenowConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x922d,0x1aa));var _0xd922=function(_0x22f303,_0x1d6034){_0x22f303=_0x22f303-0x0;var _0x295071=_0x922d[_0x22f303];return _0x295071;};'use strict';var multer=require(_0xd922('0x0'));var util=require(_0xd922('0x1'));var path=require(_0xd922('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xd922('0x3')]();var fs_extra=require(_0xd922('0x4'));var auth=require(_0xd922('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xd922('0x6'));var controller=require(_0xd922('0x7'));router[_0xd922('0x8')]('/',auth[_0xd922('0x9')](),controller[_0xd922('0xa')]);router[_0xd922('0x8')](_0xd922('0xb'),auth['isAuthenticated'](),controller[_0xd922('0xc')]);router[_0xd922('0x8')](_0xd922('0xd'),auth[_0xd922('0x9')](),controller[_0xd922('0xe')]);router[_0xd922('0x8')](_0xd922('0xf'),auth[_0xd922('0x9')](),controller[_0xd922('0x10')]);router[_0xd922('0x8')](_0xd922('0x11'),auth[_0xd922('0x9')](),controller['getDescriptions']);router['post']('/',auth[_0xd922('0x9')](),controller['create']);router[_0xd922('0x12')](_0xd922('0xb'),auth[_0xd922('0x9')](),controller['update']);router[_0xd922('0x13')](_0xd922('0xb'),auth[_0xd922('0x9')](),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 727a504..a62046f 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 _0x4864=['exports','STRING'];(function(_0x54fdcb,_0x3b2045){var _0x5f1208=function(_0x1670b3){while(--_0x1670b3){_0x54fdcb['push'](_0x54fdcb['shift']());}};_0x5f1208(++_0x3b2045);}(_0x4864,0x1b2));var _0x4486=function(_0x9be3f0,_0x628568){_0x9be3f0=_0x9be3f0-0x0;var _0x96930b=_0x4864[_0x9be3f0];return _0x96930b;};'use strict';var Sequelize=require('sequelize');module[_0x4486('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x4486('0x1')]}}; \ No newline at end of file +var _0x027a=['exports','STRING','sequelize'];(function(_0x4b4300,_0x12fb10){var _0x2ed7e7=function(_0x23173e){while(--_0x23173e){_0x4b4300['push'](_0x4b4300['shift']());}};_0x2ed7e7(++_0x12fb10);}(_0x027a,0x95));var _0xa027=function(_0x3305fa,_0x2e51c5){_0x3305fa=_0x3305fa-0x0;var _0x28d5e8=_0x027a[_0x3305fa];return _0x28d5e8;};'use strict';var Sequelize=require(_0xa027('0x0'));module[_0xa027('0x1')]={'name':{'type':Sequelize[_0xa027('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js index bed692f..34afdec 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 _0xac61=['rawAttributes','filters','find','create','body','getFields','findOne','ServicenowField','nolimit','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','crypto','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','count','limit','set','save','update','then','error','name','fieldName','type','key','model','keys','query','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','pick','merge','map','VIRTUAL','filter','options','ServicenowConfiguration','includeAll','include','rows','catch','show','params'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xac61,0x1c1));var _0x1ac6=function(_0x253975,_0x4dfcbb){_0x253975=_0x253975-0x0;var _0x25a35a=_0xac61[_0x253975];return _0x25a35a;};'use strict';var emlformat=require(_0x1ac6('0x0'));var rimraf=require(_0x1ac6('0x1'));var zipdir=require(_0x1ac6('0x2'));var jsonpatch=require(_0x1ac6('0x3'));var rp=require(_0x1ac6('0x4'));var moment=require('moment');var BPromise=require(_0x1ac6('0x5'));var Mustache=require(_0x1ac6('0x6'));var util=require('util');var path=require(_0x1ac6('0x7'));var sox=require(_0x1ac6('0x8'));var csv=require(_0x1ac6('0x9'));var ejs=require(_0x1ac6('0xa'));var fs=require('fs');var fs_extra=require(_0x1ac6('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x1ac6('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x1ac6('0xd'));var toCsv=require('to-csv');var querystring=require(_0x1ac6('0xe'));var Papa=require(_0x1ac6('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x1ac6('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1ac6('0x11'));var logger=require('../../config/logger')(_0x1ac6('0x12'));var utils=require('../../config/utils');var config=require(_0x1ac6('0x13'));var licenseUtil=require(_0x1ac6('0x14'));var db=require(_0x1ac6('0x15'))['db'];function respondWithStatusCode(_0x3aada8,_0x2208d0){_0x2208d0=_0x2208d0||0xcc;return function(_0x240f67){if(_0x240f67){return _0x3aada8['sendStatus'](_0x2208d0);}return _0x3aada8[_0x1ac6('0x16')](_0x2208d0)[_0x1ac6('0x17')]();};}function respondWithResult(_0x2b16a2,_0x39904b){_0x39904b=_0x39904b||0xc8;return function(_0x2e95c2){if(_0x2e95c2){return _0x2b16a2[_0x1ac6('0x16')](_0x39904b)[_0x1ac6('0x18')](_0x2e95c2);}};}function respondWithFilteredResult(_0x10d24e,_0xeb2376){return function(_0x1a0689){if(_0x1a0689){var _0xf7b627=typeof _0xeb2376[_0x1ac6('0x19')]===_0x1ac6('0x1a')&&typeof _0xeb2376['limit']===_0x1ac6('0x1a');var _0x4d4285=_0x1a0689[_0x1ac6('0x1b')];var _0x51a210=_0xf7b627?0x0:_0xeb2376['offset'];var _0x217c29=_0xf7b627?_0x1a0689['count']:_0xeb2376[_0x1ac6('0x19')]+_0xeb2376[_0x1ac6('0x1c')];var _0x3dd142;if(_0x217c29>=_0x4d4285){_0x217c29=_0x4d4285;_0x3dd142=0xc8;}else{_0x3dd142=0xce;}_0x10d24e['status'](_0x3dd142);return _0x10d24e[_0x1ac6('0x1d')]('Content-Range',_0x51a210+'-'+_0x217c29+'/'+_0x4d4285)[_0x1ac6('0x18')](_0x1a0689);}return null;};}function patchUpdates(_0x3e2e55){return function(_0x24ff5d){try{jsonpatch['apply'](_0x24ff5d,_0x3e2e55,!![]);}catch(_0x26ff49){return BPromise['reject'](_0x26ff49);}return _0x24ff5d[_0x1ac6('0x1e')]();};}function saveUpdates(_0x3e626f,_0x4797b6){return function(_0x23c55e){if(_0x23c55e){return _0x23c55e[_0x1ac6('0x1f')](_0x3e626f)[_0x1ac6('0x20')](function(_0x58e329){return _0x58e329;});}return null;};}function removeEntity(_0x4aa412,_0x29d94a){return function(_0x56cb36){if(_0x56cb36){return _0x56cb36['destroy']()['then'](function(){_0x4aa412[_0x1ac6('0x16')](0xcc)[_0x1ac6('0x17')]();});}};}function handleEntityNotFound(_0x5e5285,_0x3c035e){return function(_0xe9791b){if(!_0xe9791b){_0x5e5285['sendStatus'](0x194);}return _0xe9791b;};}function handleError(_0x22b05a,_0x3f2668){_0x3f2668=_0x3f2668||0x1f4;return function(_0xdaf00c){logger[_0x1ac6('0x21')](_0xdaf00c['stack']);if(_0xdaf00c[_0x1ac6('0x22')]){delete _0xdaf00c['name'];}_0x22b05a[_0x1ac6('0x16')](_0x3f2668)['send'](_0xdaf00c);};}exports['index']=function(_0x4eab84,_0x395044){var _0xdcfee9={},_0x455bd1={},_0x4d788c={'count':0x0,'rows':[]};var _0x252347=_['map'](db['ServicenowConfiguration']['rawAttributes'],function(_0x5c0901){return{'name':_0x5c0901[_0x1ac6('0x23')],'type':_0x5c0901[_0x1ac6('0x24')][_0x1ac6('0x25')]};});_0x455bd1[_0x1ac6('0x26')]=_['map'](_0x252347,_0x1ac6('0x22'));_0x455bd1['query']=_[_0x1ac6('0x27')](_0x4eab84[_0x1ac6('0x28')]);_0x455bd1['filters']=_['intersection'](_0x455bd1[_0x1ac6('0x26')],_0x455bd1[_0x1ac6('0x28')]);_0xdcfee9[_0x1ac6('0x29')]=_[_0x1ac6('0x2a')](_0x455bd1['model'],qs[_0x1ac6('0x2b')](_0x4eab84[_0x1ac6('0x28')][_0x1ac6('0x2b')]));_0xdcfee9[_0x1ac6('0x29')]=_0xdcfee9['attributes'][_0x1ac6('0x2c')]?_0xdcfee9['attributes']:_0x455bd1[_0x1ac6('0x26')];if(!_0x4eab84['query'][_0x1ac6('0x2d')]('nolimit')){_0xdcfee9[_0x1ac6('0x1c')]=qs['limit'](_0x4eab84['query'][_0x1ac6('0x1c')]);_0xdcfee9['offset']=qs[_0x1ac6('0x19')](_0x4eab84[_0x1ac6('0x28')][_0x1ac6('0x19')]);}_0xdcfee9[_0x1ac6('0x2e')]=qs[_0x1ac6('0x2f')](_0x4eab84[_0x1ac6('0x28')][_0x1ac6('0x2f')]);_0xdcfee9[_0x1ac6('0x30')]=qs['filters'](_[_0x1ac6('0x31')](_0x4eab84[_0x1ac6('0x28')],_0x455bd1['filters']),_0x252347);if(_0x4eab84['query']['filter']){_0xdcfee9[_0x1ac6('0x30')]=_[_0x1ac6('0x32')](_0xdcfee9[_0x1ac6('0x30')],{'$or':_[_0x1ac6('0x33')](_0x252347,function(_0xa4e45d){if(_0xa4e45d[_0x1ac6('0x24')]!==_0x1ac6('0x34')){var _0x58b9fe={};_0x58b9fe[_0xa4e45d[_0x1ac6('0x22')]]={'$like':'%'+_0x4eab84[_0x1ac6('0x28')][_0x1ac6('0x35')]+'%'};return _0x58b9fe;}})});}_0xdcfee9=_[_0x1ac6('0x32')]({},_0xdcfee9,_0x4eab84[_0x1ac6('0x36')]);var _0x931051={'where':_0xdcfee9[_0x1ac6('0x30')]};return db[_0x1ac6('0x37')]['count'](_0x931051)[_0x1ac6('0x20')](function(_0x5f36f1){_0x4d788c[_0x1ac6('0x1b')]=_0x5f36f1;if(_0x4eab84[_0x1ac6('0x28')][_0x1ac6('0x38')]){_0xdcfee9[_0x1ac6('0x39')]=[{'all':!![]}];}return db[_0x1ac6('0x37')]['findAll'](_0xdcfee9);})[_0x1ac6('0x20')](function(_0x3e89a7){_0x4d788c[_0x1ac6('0x3a')]=_0x3e89a7;return _0x4d788c;})[_0x1ac6('0x20')](respondWithFilteredResult(_0x395044,_0xdcfee9))[_0x1ac6('0x3b')](handleError(_0x395044,null));};exports[_0x1ac6('0x3c')]=function(_0x2ce593,_0x59f793){var _0x507887={'raw':![],'where':{'id':_0x2ce593[_0x1ac6('0x3d')]['id']}},_0x3f449b={};_0x3f449b['model']=_[_0x1ac6('0x27')](db[_0x1ac6('0x37')][_0x1ac6('0x3e')]);_0x3f449b[_0x1ac6('0x28')]=_[_0x1ac6('0x27')](_0x2ce593['query']);_0x3f449b[_0x1ac6('0x3f')]=_[_0x1ac6('0x2a')](_0x3f449b[_0x1ac6('0x26')],_0x3f449b[_0x1ac6('0x28')]);_0x507887[_0x1ac6('0x29')]=_[_0x1ac6('0x2a')](_0x3f449b[_0x1ac6('0x26')],qs['fields'](_0x2ce593['query'][_0x1ac6('0x2b')]));_0x507887[_0x1ac6('0x29')]=_0x507887[_0x1ac6('0x29')][_0x1ac6('0x2c')]?_0x507887[_0x1ac6('0x29')]:_0x3f449b[_0x1ac6('0x26')];if(_0x2ce593[_0x1ac6('0x28')][_0x1ac6('0x38')]){_0x507887[_0x1ac6('0x39')]=[{'all':!![]}];}_0x507887=_[_0x1ac6('0x32')]({},_0x507887,_0x2ce593[_0x1ac6('0x36')]);return db[_0x1ac6('0x37')][_0x1ac6('0x40')](_0x507887)[_0x1ac6('0x20')](handleEntityNotFound(_0x59f793,null))[_0x1ac6('0x20')](respondWithResult(_0x59f793,null))[_0x1ac6('0x3b')](handleError(_0x59f793,null));};exports['create']=function(_0x552e93,_0x132b2d){return db['ServicenowConfiguration'][_0x1ac6('0x41')](_0x552e93[_0x1ac6('0x42')],{})[_0x1ac6('0x20')](respondWithResult(_0x132b2d,0xc9))['catch'](handleError(_0x132b2d,null));};exports[_0x1ac6('0x1f')]=function(_0x269beb,_0x401112){if(_0x269beb[_0x1ac6('0x42')]['id']){delete _0x269beb[_0x1ac6('0x42')]['id'];}return db['ServicenowConfiguration'][_0x1ac6('0x40')]({'where':{'id':_0x269beb[_0x1ac6('0x3d')]['id']}})['then'](handleEntityNotFound(_0x401112,null))[_0x1ac6('0x20')](saveUpdates(_0x269beb[_0x1ac6('0x42')],null))[_0x1ac6('0x20')](respondWithResult(_0x401112,null))[_0x1ac6('0x3b')](handleError(_0x401112,null));};exports['destroy']=function(_0x4f81f7,_0x1605d6){return db[_0x1ac6('0x37')]['find']({'where':{'id':_0x4f81f7[_0x1ac6('0x3d')]['id']}})['then'](handleEntityNotFound(_0x1605d6,null))['then'](removeEntity(_0x1605d6,null))[_0x1ac6('0x3b')](handleError(_0x1605d6,null));};exports[_0x1ac6('0x43')]=function(_0xb8b981,_0x3d727c,_0x4d7c82){var _0xeb00e7={};var _0x3229c1={};var _0xd07fc;var _0x30cfde;return db[_0x1ac6('0x37')][_0x1ac6('0x44')]({'where':{'id':_0xb8b981['params']['id']}})[_0x1ac6('0x20')](handleEntityNotFound(_0x3d727c,null))[_0x1ac6('0x20')](function(_0x584b03){if(_0x584b03){_0xd07fc=_0x584b03;_0x3229c1[_0x1ac6('0x26')]=_[_0x1ac6('0x27')](db[_0x1ac6('0x45')]['rawAttributes']);_0x3229c1['query']=_['keys'](_0xb8b981[_0x1ac6('0x28')]);_0x3229c1['filters']=_[_0x1ac6('0x2a')](_0x3229c1['model'],_0x3229c1[_0x1ac6('0x28')]);_0xeb00e7[_0x1ac6('0x29')]=_['intersection'](_0x3229c1[_0x1ac6('0x26')],qs[_0x1ac6('0x2b')](_0xb8b981['query'][_0x1ac6('0x2b')]));_0xeb00e7[_0x1ac6('0x29')]=_0xeb00e7[_0x1ac6('0x29')]['length']?_0xeb00e7[_0x1ac6('0x29')]:_0x3229c1['model'];_0xeb00e7['order']=qs[_0x1ac6('0x2f')](_0xb8b981['query']['sort']);_0xeb00e7[_0x1ac6('0x30')]=qs[_0x1ac6('0x3f')](_['pick'](_0xb8b981[_0x1ac6('0x28')],_0x3229c1[_0x1ac6('0x3f')]));if(_0xb8b981[_0x1ac6('0x28')][_0x1ac6('0x35')]){_0xeb00e7[_0x1ac6('0x30')]=_[_0x1ac6('0x32')](_0xeb00e7['where'],{'$or':_[_0x1ac6('0x33')](_0xeb00e7[_0x1ac6('0x29')],function(_0x406bcd){var _0x4775e4={};_0x4775e4[_0x406bcd]={'$like':'%'+_0xb8b981[_0x1ac6('0x28')][_0x1ac6('0x35')]+'%'};return _0x4775e4;})});}_0xeb00e7=_['merge']({},_0xeb00e7,_0xb8b981[_0x1ac6('0x36')]);return _0xd07fc[_0x1ac6('0x43')](_0xeb00e7);}})[_0x1ac6('0x20')](function(_0xea0bb3){if(_0xea0bb3){_0x30cfde=_0xea0bb3['length'];if(!_0xb8b981['query'][_0x1ac6('0x2d')](_0x1ac6('0x46'))){_0xeb00e7['limit']=qs[_0x1ac6('0x1c')](_0xb8b981['query']['limit']);_0xeb00e7[_0x1ac6('0x19')]=qs[_0x1ac6('0x19')](_0xb8b981[_0x1ac6('0x28')]['offset']);}return _0xd07fc['getFields'](_0xeb00e7);}})[_0x1ac6('0x20')](function(_0xde8457){if(_0xde8457){return _0xde8457?{'count':_0x30cfde,'rows':_0xde8457}:null;}})[_0x1ac6('0x20')](respondWithResult(_0x3d727c,null))[_0x1ac6('0x3b')](handleError(_0x3d727c,null));};exports['getSubjects']=function(_0xe691c2,_0x460dca,_0x5947fc){var _0x30e55a={};var _0x104f43={};var _0x5e8ce6;var _0x3063cf;return db[_0x1ac6('0x37')]['findOne']({'where':{'id':_0xe691c2[_0x1ac6('0x3d')]['id']}})[_0x1ac6('0x20')](handleEntityNotFound(_0x460dca,null))[_0x1ac6('0x20')](function(_0x38e527){if(_0x38e527){_0x5e8ce6=_0x38e527;_0x104f43[_0x1ac6('0x26')]=_[_0x1ac6('0x27')](db['ServicenowField']['rawAttributes']);_0x104f43['query']=_[_0x1ac6('0x27')](_0xe691c2[_0x1ac6('0x28')]);_0x104f43['filters']=_[_0x1ac6('0x2a')](_0x104f43['model'],_0x104f43[_0x1ac6('0x28')]);_0x30e55a[_0x1ac6('0x29')]=_['intersection'](_0x104f43[_0x1ac6('0x26')],qs['fields'](_0xe691c2['query'][_0x1ac6('0x2b')]));_0x30e55a[_0x1ac6('0x29')]=_0x30e55a[_0x1ac6('0x29')][_0x1ac6('0x2c')]?_0x30e55a['attributes']:_0x104f43[_0x1ac6('0x26')];_0x30e55a[_0x1ac6('0x2e')]=qs[_0x1ac6('0x2f')](_0xe691c2[_0x1ac6('0x28')]['sort']);_0x30e55a[_0x1ac6('0x30')]=qs[_0x1ac6('0x3f')](_[_0x1ac6('0x31')](_0xe691c2[_0x1ac6('0x28')],_0x104f43[_0x1ac6('0x3f')]));if(_0xe691c2[_0x1ac6('0x28')][_0x1ac6('0x35')]){_0x30e55a[_0x1ac6('0x30')]=_['merge'](_0x30e55a[_0x1ac6('0x30')],{'$or':_[_0x1ac6('0x33')](_0x30e55a[_0x1ac6('0x29')],function(_0x1dc0b8){var _0xab00af={};_0xab00af[_0x1dc0b8]={'$like':'%'+_0xe691c2['query'][_0x1ac6('0x35')]+'%'};return _0xab00af;})});}_0x30e55a=_[_0x1ac6('0x32')]({},_0x30e55a,_0xe691c2[_0x1ac6('0x36')]);return _0x5e8ce6['getSubjects'](_0x30e55a);}})[_0x1ac6('0x20')](function(_0x12d466){if(_0x12d466){_0x3063cf=_0x12d466[_0x1ac6('0x2c')];if(!_0xe691c2[_0x1ac6('0x28')][_0x1ac6('0x2d')]('nolimit')){_0x30e55a['limit']=qs[_0x1ac6('0x1c')](_0xe691c2[_0x1ac6('0x28')][_0x1ac6('0x1c')]);_0x30e55a[_0x1ac6('0x19')]=qs[_0x1ac6('0x19')](_0xe691c2[_0x1ac6('0x28')][_0x1ac6('0x19')]);}return _0x5e8ce6[_0x1ac6('0x47')](_0x30e55a);}})[_0x1ac6('0x20')](function(_0x53ddd2){if(_0x53ddd2){return _0x53ddd2?{'count':_0x3063cf,'rows':_0x53ddd2}:null;}})[_0x1ac6('0x20')](respondWithResult(_0x460dca,null))[_0x1ac6('0x3b')](handleError(_0x460dca,null));};exports[_0x1ac6('0x48')]=function(_0x57f523,_0x418edc,_0x1280d3){var _0x457230={};var _0x3a41fa={};var _0x467e32;var _0x4c24c8;return db[_0x1ac6('0x37')]['findOne']({'where':{'id':_0x57f523['params']['id']}})[_0x1ac6('0x20')](handleEntityNotFound(_0x418edc,null))[_0x1ac6('0x20')](function(_0x22ab99){if(_0x22ab99){_0x467e32=_0x22ab99;_0x3a41fa[_0x1ac6('0x26')]=_[_0x1ac6('0x27')](db[_0x1ac6('0x45')][_0x1ac6('0x3e')]);_0x3a41fa[_0x1ac6('0x28')]=_[_0x1ac6('0x27')](_0x57f523[_0x1ac6('0x28')]);_0x3a41fa['filters']=_[_0x1ac6('0x2a')](_0x3a41fa[_0x1ac6('0x26')],_0x3a41fa[_0x1ac6('0x28')]);_0x457230[_0x1ac6('0x29')]=_[_0x1ac6('0x2a')](_0x3a41fa[_0x1ac6('0x26')],qs[_0x1ac6('0x2b')](_0x57f523['query'][_0x1ac6('0x2b')]));_0x457230[_0x1ac6('0x29')]=_0x457230[_0x1ac6('0x29')][_0x1ac6('0x2c')]?_0x457230['attributes']:_0x3a41fa[_0x1ac6('0x26')];_0x457230[_0x1ac6('0x2e')]=qs[_0x1ac6('0x2f')](_0x57f523['query'][_0x1ac6('0x2f')]);_0x457230[_0x1ac6('0x30')]=qs[_0x1ac6('0x3f')](_[_0x1ac6('0x31')](_0x57f523[_0x1ac6('0x28')],_0x3a41fa[_0x1ac6('0x3f')]));if(_0x57f523[_0x1ac6('0x28')]['filter']){_0x457230['where']=_[_0x1ac6('0x32')](_0x457230[_0x1ac6('0x30')],{'$or':_['map'](_0x457230['attributes'],function(_0x2c4110){var _0x398b8={};_0x398b8[_0x2c4110]={'$like':'%'+_0x57f523[_0x1ac6('0x28')][_0x1ac6('0x35')]+'%'};return _0x398b8;})});}_0x457230=_[_0x1ac6('0x32')]({},_0x457230,_0x57f523['options']);return _0x467e32['getDescriptions'](_0x457230);}})[_0x1ac6('0x20')](function(_0x44f484){if(_0x44f484){_0x4c24c8=_0x44f484[_0x1ac6('0x2c')];if(!_0x57f523[_0x1ac6('0x28')][_0x1ac6('0x2d')]('nolimit')){_0x457230[_0x1ac6('0x1c')]=qs[_0x1ac6('0x1c')](_0x57f523['query']['limit']);_0x457230['offset']=qs[_0x1ac6('0x19')](_0x57f523['query'][_0x1ac6('0x19')]);}return _0x467e32['getDescriptions'](_0x457230);}})[_0x1ac6('0x20')](function(_0x190aee){if(_0x190aee){return _0x190aee?{'count':_0x4c24c8,'rows':_0x190aee}:null;}})[_0x1ac6('0x20')](respondWithResult(_0x418edc,null))['catch'](handleError(_0x418edc,null));}; \ No newline at end of file +var _0x104f=['then','destroy','error','stack','name','ServicenowConfiguration','rawAttributes','fieldName','type','key','model','map','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','include','rows','catch','includeAll','find','create','body','params','getFields','findOne','ServicenowField','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','count','offset','limit','set','Content-Range','json','apply','reject','update'];(function(_0x205979,_0x584335){var _0x238519=function(_0x38b6a7){while(--_0x38b6a7){_0x205979['push'](_0x205979['shift']());}};_0x238519(++_0x584335);}(_0x104f,0x7c));var _0xf104=function(_0x4b966f,_0x16346f){_0x4b966f=_0x4b966f-0x0;var _0x5c5564=_0x104f[_0x4b966f];return _0x5c5564;};'use strict';var emlformat=require(_0xf104('0x0'));var rimraf=require(_0xf104('0x1'));var zipdir=require(_0xf104('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf104('0x3'));var moment=require(_0xf104('0x4'));var BPromise=require(_0xf104('0x5'));var Mustache=require(_0xf104('0x6'));var util=require('util');var path=require(_0xf104('0x7'));var sox=require(_0xf104('0x8'));var csv=require(_0xf104('0x9'));var ejs=require(_0xf104('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf104('0xb'));var squel=require(_0xf104('0xc'));var crypto=require(_0xf104('0xd'));var jsforce=require(_0xf104('0xe'));var deskjs=require(_0xf104('0xf'));var toCsv=require(_0xf104('0x9'));var querystring=require(_0xf104('0x10'));var Papa=require(_0xf104('0x11'));var Redis=require('ioredis');var authService=require(_0xf104('0x12'));var qs=require(_0xf104('0x13'));var as=require(_0xf104('0x14'));var hardwareService=require(_0xf104('0x15'));var logger=require(_0xf104('0x16'))(_0xf104('0x17'));var utils=require(_0xf104('0x18'));var config=require(_0xf104('0x19'));var licenseUtil=require(_0xf104('0x1a'));var db=require(_0xf104('0x1b'))['db'];function respondWithStatusCode(_0x319fb3,_0x19f5a4){_0x19f5a4=_0x19f5a4||0xcc;return function(_0x1657cc){if(_0x1657cc){return _0x319fb3[_0xf104('0x1c')](_0x19f5a4);}return _0x319fb3['status'](_0x19f5a4)[_0xf104('0x1d')]();};}function respondWithResult(_0x105bd9,_0x2e1b8b){_0x2e1b8b=_0x2e1b8b||0xc8;return function(_0xfa0b4a){if(_0xfa0b4a){return _0x105bd9[_0xf104('0x1e')](_0x2e1b8b)['json'](_0xfa0b4a);}};}function respondWithFilteredResult(_0x1bf167,_0x16f20b){return function(_0x23e004){if(_0x23e004){var _0x32d312=typeof _0x16f20b['offset']==='undefined'&&typeof _0x16f20b['limit']==='undefined';var _0x49d6aa=_0x23e004[_0xf104('0x1f')];var _0x303f10=_0x32d312?0x0:_0x16f20b[_0xf104('0x20')];var _0x595999=_0x32d312?_0x23e004['count']:_0x16f20b[_0xf104('0x20')]+_0x16f20b[_0xf104('0x21')];var _0x1f28db;if(_0x595999>=_0x49d6aa){_0x595999=_0x49d6aa;_0x1f28db=0xc8;}else{_0x1f28db=0xce;}_0x1bf167[_0xf104('0x1e')](_0x1f28db);return _0x1bf167[_0xf104('0x22')](_0xf104('0x23'),_0x303f10+'-'+_0x595999+'/'+_0x49d6aa)[_0xf104('0x24')](_0x23e004);}return null;};}function patchUpdates(_0x556b92){return function(_0x4114a8){try{jsonpatch[_0xf104('0x25')](_0x4114a8,_0x556b92,!![]);}catch(_0x47ca63){return BPromise[_0xf104('0x26')](_0x47ca63);}return _0x4114a8['save']();};}function saveUpdates(_0x205298,_0xdcb1c9){return function(_0x277697){if(_0x277697){return _0x277697[_0xf104('0x27')](_0x205298)[_0xf104('0x28')](function(_0x2654b4){return _0x2654b4;});}return null;};}function removeEntity(_0x2b87d3,_0x234d30){return function(_0x2ddea6){if(_0x2ddea6){return _0x2ddea6[_0xf104('0x29')]()[_0xf104('0x28')](function(){_0x2b87d3[_0xf104('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x8a6edc,_0x293998){return function(_0x4dd06a){if(!_0x4dd06a){_0x8a6edc['sendStatus'](0x194);}return _0x4dd06a;};}function handleError(_0x1b29c5,_0x4782d0){_0x4782d0=_0x4782d0||0x1f4;return function(_0x130f03){logger[_0xf104('0x2a')](_0x130f03[_0xf104('0x2b')]);if(_0x130f03[_0xf104('0x2c')]){delete _0x130f03['name'];}_0x1b29c5['status'](_0x4782d0)['send'](_0x130f03);};}exports['index']=function(_0x4e2b92,_0x1c4d69){var _0xffc3d1={},_0xa144f5={},_0xfbe999={'count':0x0,'rows':[]};var _0xa42f4c=_['map'](db[_0xf104('0x2d')][_0xf104('0x2e')],function(_0x419984){return{'name':_0x419984[_0xf104('0x2f')],'type':_0x419984[_0xf104('0x30')][_0xf104('0x31')]};});_0xa144f5[_0xf104('0x32')]=_[_0xf104('0x33')](_0xa42f4c,'name');_0xa144f5['query']=_[_0xf104('0x34')](_0x4e2b92[_0xf104('0x35')]);_0xa144f5['filters']=_[_0xf104('0x36')](_0xa144f5[_0xf104('0x32')],_0xa144f5[_0xf104('0x35')]);_0xffc3d1[_0xf104('0x37')]=_[_0xf104('0x36')](_0xa144f5[_0xf104('0x32')],qs[_0xf104('0x38')](_0x4e2b92[_0xf104('0x35')][_0xf104('0x38')]));_0xffc3d1[_0xf104('0x37')]=_0xffc3d1[_0xf104('0x37')][_0xf104('0x39')]?_0xffc3d1[_0xf104('0x37')]:_0xa144f5[_0xf104('0x32')];if(!_0x4e2b92[_0xf104('0x35')][_0xf104('0x3a')](_0xf104('0x3b'))){_0xffc3d1[_0xf104('0x21')]=qs[_0xf104('0x21')](_0x4e2b92[_0xf104('0x35')][_0xf104('0x21')]);_0xffc3d1['offset']=qs[_0xf104('0x20')](_0x4e2b92[_0xf104('0x35')][_0xf104('0x20')]);}_0xffc3d1[_0xf104('0x3c')]=qs[_0xf104('0x3d')](_0x4e2b92['query'][_0xf104('0x3d')]);_0xffc3d1[_0xf104('0x3e')]=qs[_0xf104('0x3f')](_[_0xf104('0x40')](_0x4e2b92[_0xf104('0x35')],_0xa144f5[_0xf104('0x3f')]),_0xa42f4c);if(_0x4e2b92[_0xf104('0x35')][_0xf104('0x41')]){_0xffc3d1[_0xf104('0x3e')]=_[_0xf104('0x42')](_0xffc3d1[_0xf104('0x3e')],{'$or':_[_0xf104('0x33')](_0xa42f4c,function(_0xc602d8){if(_0xc602d8['type']!==_0xf104('0x43')){var _0x3c065e={};_0x3c065e[_0xc602d8[_0xf104('0x2c')]]={'$like':'%'+_0x4e2b92['query'][_0xf104('0x41')]+'%'};return _0x3c065e;}})});}_0xffc3d1=_[_0xf104('0x42')]({},_0xffc3d1,_0x4e2b92[_0xf104('0x44')]);var _0x3395e4={'where':_0xffc3d1[_0xf104('0x3e')]};return db[_0xf104('0x2d')]['count'](_0x3395e4)[_0xf104('0x28')](function(_0x29eb8b){_0xfbe999[_0xf104('0x1f')]=_0x29eb8b;if(_0x4e2b92[_0xf104('0x35')]['includeAll']){_0xffc3d1[_0xf104('0x45')]=[{'all':!![]}];}return db['ServicenowConfiguration']['findAll'](_0xffc3d1);})[_0xf104('0x28')](function(_0x167c8b){_0xfbe999[_0xf104('0x46')]=_0x167c8b;return _0xfbe999;})[_0xf104('0x28')](respondWithFilteredResult(_0x1c4d69,_0xffc3d1))[_0xf104('0x47')](handleError(_0x1c4d69,null));};exports['show']=function(_0x6ca9cc,_0x1f815e){var _0xd27043={'raw':![],'where':{'id':_0x6ca9cc['params']['id']}},_0x5beb90={};_0x5beb90[_0xf104('0x32')]=_['keys'](db[_0xf104('0x2d')][_0xf104('0x2e')]);_0x5beb90[_0xf104('0x35')]=_[_0xf104('0x34')](_0x6ca9cc['query']);_0x5beb90[_0xf104('0x3f')]=_[_0xf104('0x36')](_0x5beb90['model'],_0x5beb90[_0xf104('0x35')]);_0xd27043[_0xf104('0x37')]=_[_0xf104('0x36')](_0x5beb90[_0xf104('0x32')],qs[_0xf104('0x38')](_0x6ca9cc[_0xf104('0x35')]['fields']));_0xd27043[_0xf104('0x37')]=_0xd27043['attributes'][_0xf104('0x39')]?_0xd27043['attributes']:_0x5beb90[_0xf104('0x32')];if(_0x6ca9cc['query'][_0xf104('0x48')]){_0xd27043[_0xf104('0x45')]=[{'all':!![]}];}_0xd27043=_[_0xf104('0x42')]({},_0xd27043,_0x6ca9cc[_0xf104('0x44')]);return db['ServicenowConfiguration'][_0xf104('0x49')](_0xd27043)[_0xf104('0x28')](handleEntityNotFound(_0x1f815e,null))[_0xf104('0x28')](respondWithResult(_0x1f815e,null))[_0xf104('0x47')](handleError(_0x1f815e,null));};exports[_0xf104('0x4a')]=function(_0x23dc39,_0x1eaaf7){return db[_0xf104('0x2d')][_0xf104('0x4a')](_0x23dc39[_0xf104('0x4b')],{})[_0xf104('0x28')](respondWithResult(_0x1eaaf7,0xc9))[_0xf104('0x47')](handleError(_0x1eaaf7,null));};exports[_0xf104('0x27')]=function(_0x16e1a7,_0x2f3c98){if(_0x16e1a7[_0xf104('0x4b')]['id']){delete _0x16e1a7[_0xf104('0x4b')]['id'];}return db[_0xf104('0x2d')][_0xf104('0x49')]({'where':{'id':_0x16e1a7[_0xf104('0x4c')]['id']}})['then'](handleEntityNotFound(_0x2f3c98,null))[_0xf104('0x28')](saveUpdates(_0x16e1a7[_0xf104('0x4b')],null))[_0xf104('0x28')](respondWithResult(_0x2f3c98,null))['catch'](handleError(_0x2f3c98,null));};exports[_0xf104('0x29')]=function(_0x488eb6,_0x66748a){return db[_0xf104('0x2d')][_0xf104('0x49')]({'where':{'id':_0x488eb6[_0xf104('0x4c')]['id']}})[_0xf104('0x28')](handleEntityNotFound(_0x66748a,null))[_0xf104('0x28')](removeEntity(_0x66748a,null))[_0xf104('0x47')](handleError(_0x66748a,null));};exports[_0xf104('0x4d')]=function(_0xa742ff,_0x369f67,_0x99e7c){var _0x5bea88={};var _0x199741={};var _0x50e863;var _0x43d85c;return db[_0xf104('0x2d')][_0xf104('0x4e')]({'where':{'id':_0xa742ff[_0xf104('0x4c')]['id']}})[_0xf104('0x28')](handleEntityNotFound(_0x369f67,null))[_0xf104('0x28')](function(_0x4a8b3a){if(_0x4a8b3a){_0x50e863=_0x4a8b3a;_0x199741[_0xf104('0x32')]=_[_0xf104('0x34')](db[_0xf104('0x4f')]['rawAttributes']);_0x199741[_0xf104('0x35')]=_['keys'](_0xa742ff[_0xf104('0x35')]);_0x199741['filters']=_[_0xf104('0x36')](_0x199741[_0xf104('0x32')],_0x199741['query']);_0x5bea88[_0xf104('0x37')]=_['intersection'](_0x199741[_0xf104('0x32')],qs['fields'](_0xa742ff[_0xf104('0x35')][_0xf104('0x38')]));_0x5bea88[_0xf104('0x37')]=_0x5bea88[_0xf104('0x37')][_0xf104('0x39')]?_0x5bea88[_0xf104('0x37')]:_0x199741['model'];_0x5bea88[_0xf104('0x3c')]=qs['sort'](_0xa742ff[_0xf104('0x35')][_0xf104('0x3d')]);_0x5bea88[_0xf104('0x3e')]=qs['filters'](_[_0xf104('0x40')](_0xa742ff[_0xf104('0x35')],_0x199741[_0xf104('0x3f')]));if(_0xa742ff[_0xf104('0x35')][_0xf104('0x41')]){_0x5bea88[_0xf104('0x3e')]=_[_0xf104('0x42')](_0x5bea88[_0xf104('0x3e')],{'$or':_[_0xf104('0x33')](_0x5bea88[_0xf104('0x37')],function(_0x8a21d7){var _0x3040d2={};_0x3040d2[_0x8a21d7]={'$like':'%'+_0xa742ff[_0xf104('0x35')][_0xf104('0x41')]+'%'};return _0x3040d2;})});}_0x5bea88=_[_0xf104('0x42')]({},_0x5bea88,_0xa742ff[_0xf104('0x44')]);return _0x50e863[_0xf104('0x4d')](_0x5bea88);}})[_0xf104('0x28')](function(_0x40cf47){if(_0x40cf47){_0x43d85c=_0x40cf47[_0xf104('0x39')];if(!_0xa742ff[_0xf104('0x35')][_0xf104('0x3a')](_0xf104('0x3b'))){_0x5bea88[_0xf104('0x21')]=qs[_0xf104('0x21')](_0xa742ff[_0xf104('0x35')][_0xf104('0x21')]);_0x5bea88[_0xf104('0x20')]=qs['offset'](_0xa742ff[_0xf104('0x35')][_0xf104('0x20')]);}return _0x50e863[_0xf104('0x4d')](_0x5bea88);}})[_0xf104('0x28')](function(_0x5ae4af){if(_0x5ae4af){return _0x5ae4af?{'count':_0x43d85c,'rows':_0x5ae4af}:null;}})['then'](respondWithResult(_0x369f67,null))[_0xf104('0x47')](handleError(_0x369f67,null));};exports[_0xf104('0x50')]=function(_0x35e519,_0x1260cf,_0x2ca69c){var _0x5082c2={};var _0x4a1cb4={};var _0x31bb73;var _0x48de20;return db[_0xf104('0x2d')][_0xf104('0x4e')]({'where':{'id':_0x35e519[_0xf104('0x4c')]['id']}})[_0xf104('0x28')](handleEntityNotFound(_0x1260cf,null))[_0xf104('0x28')](function(_0x1a374f){if(_0x1a374f){_0x31bb73=_0x1a374f;_0x4a1cb4['model']=_[_0xf104('0x34')](db[_0xf104('0x4f')][_0xf104('0x2e')]);_0x4a1cb4[_0xf104('0x35')]=_[_0xf104('0x34')](_0x35e519[_0xf104('0x35')]);_0x4a1cb4[_0xf104('0x3f')]=_['intersection'](_0x4a1cb4[_0xf104('0x32')],_0x4a1cb4[_0xf104('0x35')]);_0x5082c2[_0xf104('0x37')]=_[_0xf104('0x36')](_0x4a1cb4[_0xf104('0x32')],qs['fields'](_0x35e519[_0xf104('0x35')][_0xf104('0x38')]));_0x5082c2['attributes']=_0x5082c2['attributes'][_0xf104('0x39')]?_0x5082c2[_0xf104('0x37')]:_0x4a1cb4['model'];_0x5082c2[_0xf104('0x3c')]=qs[_0xf104('0x3d')](_0x35e519[_0xf104('0x35')][_0xf104('0x3d')]);_0x5082c2[_0xf104('0x3e')]=qs[_0xf104('0x3f')](_[_0xf104('0x40')](_0x35e519[_0xf104('0x35')],_0x4a1cb4['filters']));if(_0x35e519[_0xf104('0x35')][_0xf104('0x41')]){_0x5082c2[_0xf104('0x3e')]=_[_0xf104('0x42')](_0x5082c2[_0xf104('0x3e')],{'$or':_[_0xf104('0x33')](_0x5082c2['attributes'],function(_0x156c50){var _0x1df2e7={};_0x1df2e7[_0x156c50]={'$like':'%'+_0x35e519[_0xf104('0x35')][_0xf104('0x41')]+'%'};return _0x1df2e7;})});}_0x5082c2=_[_0xf104('0x42')]({},_0x5082c2,_0x35e519[_0xf104('0x44')]);return _0x31bb73[_0xf104('0x50')](_0x5082c2);}})['then'](function(_0x39fc36){if(_0x39fc36){_0x48de20=_0x39fc36['length'];if(!_0x35e519[_0xf104('0x35')][_0xf104('0x3a')](_0xf104('0x3b'))){_0x5082c2[_0xf104('0x21')]=qs[_0xf104('0x21')](_0x35e519[_0xf104('0x35')][_0xf104('0x21')]);_0x5082c2[_0xf104('0x20')]=qs['offset'](_0x35e519[_0xf104('0x35')][_0xf104('0x20')]);}return _0x31bb73[_0xf104('0x50')](_0x5082c2);}})[_0xf104('0x28')](function(_0x937637){if(_0x937637){return _0x937637?{'count':_0x48de20,'rows':_0x937637}:null;}})[_0xf104('0x28')](respondWithResult(_0x1260cf,null))[_0xf104('0x47')](handleError(_0x1260cf,null));};exports[_0xf104('0x51')]=function(_0x21dded,_0x59dbae,_0x576c8e){var _0x3e5596={};var _0x11a729={};var _0x3847e1;var _0x23c29b;return db[_0xf104('0x2d')][_0xf104('0x4e')]({'where':{'id':_0x21dded['params']['id']}})[_0xf104('0x28')](handleEntityNotFound(_0x59dbae,null))[_0xf104('0x28')](function(_0x8fb09b){if(_0x8fb09b){_0x3847e1=_0x8fb09b;_0x11a729['model']=_[_0xf104('0x34')](db[_0xf104('0x4f')][_0xf104('0x2e')]);_0x11a729['query']=_[_0xf104('0x34')](_0x21dded[_0xf104('0x35')]);_0x11a729[_0xf104('0x3f')]=_[_0xf104('0x36')](_0x11a729[_0xf104('0x32')],_0x11a729['query']);_0x3e5596[_0xf104('0x37')]=_['intersection'](_0x11a729[_0xf104('0x32')],qs[_0xf104('0x38')](_0x21dded[_0xf104('0x35')]['fields']));_0x3e5596['attributes']=_0x3e5596[_0xf104('0x37')]['length']?_0x3e5596[_0xf104('0x37')]:_0x11a729[_0xf104('0x32')];_0x3e5596['order']=qs[_0xf104('0x3d')](_0x21dded[_0xf104('0x35')]['sort']);_0x3e5596[_0xf104('0x3e')]=qs[_0xf104('0x3f')](_[_0xf104('0x40')](_0x21dded[_0xf104('0x35')],_0x11a729['filters']));if(_0x21dded[_0xf104('0x35')][_0xf104('0x41')]){_0x3e5596[_0xf104('0x3e')]=_[_0xf104('0x42')](_0x3e5596[_0xf104('0x3e')],{'$or':_[_0xf104('0x33')](_0x3e5596[_0xf104('0x37')],function(_0x3475cb){var _0x424770={};_0x424770[_0x3475cb]={'$like':'%'+_0x21dded[_0xf104('0x35')]['filter']+'%'};return _0x424770;})});}_0x3e5596=_[_0xf104('0x42')]({},_0x3e5596,_0x21dded['options']);return _0x3847e1[_0xf104('0x51')](_0x3e5596);}})[_0xf104('0x28')](function(_0x5d6c34){if(_0x5d6c34){_0x23c29b=_0x5d6c34['length'];if(!_0x21dded[_0xf104('0x35')][_0xf104('0x3a')]('nolimit')){_0x3e5596['limit']=qs[_0xf104('0x21')](_0x21dded[_0xf104('0x35')][_0xf104('0x21')]);_0x3e5596[_0xf104('0x20')]=qs[_0xf104('0x20')](_0x21dded[_0xf104('0x35')][_0xf104('0x20')]);}return _0x3847e1[_0xf104('0x51')](_0x3e5596);}})[_0xf104('0x28')](function(_0x2a7fcb){if(_0x2a7fcb){return _0x2a7fcb?{'count':_0x23c29b,'rows':_0x2a7fcb}:null;}})['then'](respondWithResult(_0x59dbae,null))['catch'](handleError(_0x59dbae,null));}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js index 7c2066f..25e7828 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 _0x83cd=['path','rimraf','../../config/environment','exports','ServicenowConfiguration','lodash','util','../../config/logger','api','moment','request-promise'];(function(_0x5891d7,_0x266a8a){var _0xbf2fb8=function(_0x3a1cb4){while(--_0x3a1cb4){_0x5891d7['push'](_0x5891d7['shift']());}};_0xbf2fb8(++_0x266a8a);}(_0x83cd,0x17b));var _0xd83c=function(_0x53c96,_0x1e1e11){_0x53c96=_0x53c96-0x0;var _0x3a22d2=_0x83cd[_0x53c96];return _0x3a22d2;};'use strict';var _=require(_0xd83c('0x0'));var util=require(_0xd83c('0x1'));var logger=require(_0xd83c('0x2'))(_0xd83c('0x3'));var moment=require(_0xd83c('0x4'));var BPromise=require('bluebird');var rp=require(_0xd83c('0x5'));var fs=require('fs');var path=require(_0xd83c('0x6'));var rimraf=require(_0xd83c('0x7'));var config=require(_0xd83c('0x8'));var attributes=require('./intServicenowConfiguration.attributes');module[_0xd83c('0x9')]=function(_0x1f1289,_0x154f67){return _0x1f1289['define'](_0xd83c('0xa'),attributes,{'tableName':'int_servicenow_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4e2e=['exports','define','ServicenowConfiguration','int_servicenow_configurations','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intServicenowConfiguration.attributes'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x4e2e,0x1f2));var _0xe4e2=function(_0x52e3b1,_0x19aad3){_0x52e3b1=_0x52e3b1-0x0;var _0x57afed=_0x4e2e[_0x52e3b1];return _0x57afed;};'use strict';var _=require('lodash');var util=require(_0xe4e2('0x0'));var logger=require(_0xe4e2('0x1'))(_0xe4e2('0x2'));var moment=require(_0xe4e2('0x3'));var BPromise=require(_0xe4e2('0x4'));var rp=require(_0xe4e2('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe4e2('0x6'));var config=require(_0xe4e2('0x7'));var attributes=require(_0xe4e2('0x8'));module[_0xe4e2('0x9')]=function(_0x48e83d,_0x322295){return _0x48e83d[_0xe4e2('0xa')](_0xe4e2('0xb'),attributes,{'tableName':_0xe4e2('0xc'),'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 f85a0e5..6caaa66 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 _0xefe2=['debug','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','ServicenowConfiguration,\x20%s,\x20%s','message','info','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','request\x20sent'];(function(_0x2e0baf,_0xa574e4){var _0x5cab63=function(_0x39f866){while(--_0x39f866){_0x2e0baf['push'](_0x2e0baf['shift']());}};_0x5cab63(++_0xa574e4);}(_0xefe2,0x178));var _0x2efe=function(_0x2a4a9b,_0x4600a8){_0x2a4a9b=_0x2a4a9b-0x0;var _0x175014=_0xefe2[_0x2a4a9b];return _0x175014;};'use strict';var _=require(_0x2efe('0x0'));var util=require(_0x2efe('0x1'));var moment=require('moment');var BPromise=require(_0x2efe('0x2'));var rs=require(_0x2efe('0x3'));var fs=require('fs');var Redis=require(_0x2efe('0x4'));var db=require(_0x2efe('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x2efe('0x6'))(_0x2efe('0x7'));var config=require(_0x2efe('0x8'));var jayson=require(_0x2efe('0x9'));var client=jayson[_0x2efe('0xa')][_0x2efe('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2cb899,_0x4afa51,_0x1447f1){return new BPromise(function(_0x3916c3,_0x5a1147){return client[_0x2efe('0xc')](_0x2cb899,_0x1447f1)[_0x2efe('0xd')](function(_0x1f12de){logger['info']('ServicenowConfiguration,\x20%s,\x20%s',_0x4afa51,_0x2efe('0xe'));logger[_0x2efe('0xf')](_0x2efe('0x10'),_0x4afa51,'request\x20sent',JSON[_0x2efe('0x11')](_0x1f12de));if(_0x1f12de[_0x2efe('0x12')]){if(_0x1f12de[_0x2efe('0x12')][_0x2efe('0x13')]===0x1f4){logger['error'](_0x2efe('0x14'),_0x4afa51,_0x1f12de[_0x2efe('0x12')]['message']);return _0x5a1147(_0x1f12de[_0x2efe('0x12')]['message']);}logger['error'](_0x2efe('0x14'),_0x4afa51,_0x1f12de['error'][_0x2efe('0x15')]);return _0x3916c3(_0x1f12de[_0x2efe('0x12')][_0x2efe('0x15')]);}else{logger[_0x2efe('0x16')]('ServicenowConfiguration,\x20%s,\x20%s',_0x4afa51,_0x2efe('0xe'));_0x3916c3(_0x1f12de['result'][_0x2efe('0x15')]);}})['catch'](function(_0x4950e5){logger[_0x2efe('0x12')](_0x2efe('0x14'),_0x4afa51,_0x4950e5);_0x5a1147(_0x4950e5);});});} \ No newline at end of file +var _0x3189=['result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','ServicenowConfiguration,\x20%s,\x20%s','request\x20sent','debug','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x587039,_0xff8312){var _0x4e5be5=function(_0x1b9cd5){while(--_0x1b9cd5){_0x587039['push'](_0x587039['shift']());}};_0x4e5be5(++_0xff8312);}(_0x3189,0x19a));var _0x9318=function(_0x3269e6,_0xa447d6){_0x3269e6=_0x3269e6-0x0;var _0x4c9bb2=_0x3189[_0x3269e6];return _0x4c9bb2;};'use strict';var _=require(_0x9318('0x0'));var util=require('util');var moment=require(_0x9318('0x1'));var BPromise=require(_0x9318('0x2'));var rs=require(_0x9318('0x3'));var fs=require('fs');var Redis=require(_0x9318('0x4'));var db=require(_0x9318('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x9318('0x6'))(_0x9318('0x7'));var config=require(_0x9318('0x8'));var jayson=require(_0x9318('0x9'));var client=jayson[_0x9318('0xa')][_0x9318('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x54504c,_0x406c79,_0x47cc66){return new BPromise(function(_0x582fe9,_0x2deb10){return client[_0x9318('0xc')](_0x54504c,_0x47cc66)['then'](function(_0x2b883e){logger[_0x9318('0xd')](_0x9318('0xe'),_0x406c79,_0x9318('0xf'));logger[_0x9318('0x10')](_0x9318('0x11'),_0x406c79,_0x9318('0xf'),JSON[_0x9318('0x12')](_0x2b883e));if(_0x2b883e['error']){if(_0x2b883e[_0x9318('0x13')][_0x9318('0x14')]===0x1f4){logger[_0x9318('0x13')](_0x9318('0xe'),_0x406c79,_0x2b883e[_0x9318('0x13')][_0x9318('0x15')]);return _0x2deb10(_0x2b883e[_0x9318('0x13')]['message']);}logger['error'](_0x9318('0xe'),_0x406c79,_0x2b883e[_0x9318('0x13')][_0x9318('0x15')]);return _0x582fe9(_0x2b883e[_0x9318('0x13')][_0x9318('0x15')]);}else{logger[_0x9318('0xd')](_0x9318('0xe'),_0x406c79,_0x9318('0xf'));_0x582fe9(_0x2b883e[_0x9318('0x16')][_0x9318('0x15')]);}})[_0x9318('0x17')](function(_0x101b16){logger['error'](_0x9318('0xe'),_0x406c79,_0x101b16);_0x2deb10(_0x101b16);});});} \ No newline at end of file diff --git a/server/api/intServicenowField/index.js b/server/api/intServicenowField/index.js index 169f325..f68af88 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 _0xe3fa=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowField.controller','get','isAuthenticated','/:id','show','post','put','delete','exports','multer','util','path','connect-timeout'];(function(_0x50fdbb,_0x3af8da){var _0x37eca0=function(_0x1b91b8){while(--_0x1b91b8){_0x50fdbb['push'](_0x50fdbb['shift']());}};_0x37eca0(++_0x3af8da);}(_0xe3fa,0xd4));var _0xae3f=function(_0x4d0d85,_0x3250d3){_0x4d0d85=_0x4d0d85-0x0;var _0x290a74=_0xe3fa[_0x4d0d85];return _0x290a74;};'use strict';var multer=require(_0xae3f('0x0'));var util=require(_0xae3f('0x1'));var path=require(_0xae3f('0x2'));var timeout=require(_0xae3f('0x3'));var express=require(_0xae3f('0x4'));var router=express[_0xae3f('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xae3f('0x6'));var interaction=require(_0xae3f('0x7'));var config=require(_0xae3f('0x8'));var controller=require(_0xae3f('0x9'));router[_0xae3f('0xa')]('/',auth[_0xae3f('0xb')](),controller['index']);router['get'](_0xae3f('0xc'),auth[_0xae3f('0xb')](),controller[_0xae3f('0xd')]);router[_0xae3f('0xe')]('/',auth[_0xae3f('0xb')](),controller['create']);router[_0xae3f('0xf')](_0xae3f('0xc'),auth[_0xae3f('0xb')](),controller['update']);router[_0xae3f('0x10')](_0xae3f('0xc'),auth['isAuthenticated'](),controller['destroy']);module[_0xae3f('0x11')]=router; \ No newline at end of file +var _0x7e3b=['isAuthenticated','show','post','create','put','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowField.controller','index','/:id'];(function(_0x2283dc,_0x2fcfc5){var _0x16db90=function(_0x376c35){while(--_0x376c35){_0x2283dc['push'](_0x2283dc['shift']());}};_0x16db90(++_0x2fcfc5);}(_0x7e3b,0x95));var _0xb7e3=function(_0x858618,_0x1ad2ea){_0x858618=_0x858618-0x0;var _0x2b22a0=_0x7e3b[_0x858618];return _0x2b22a0;};'use strict';var multer=require(_0xb7e3('0x0'));var util=require(_0xb7e3('0x1'));var path=require('path');var timeout=require(_0xb7e3('0x2'));var express=require(_0xb7e3('0x3'));var router=express[_0xb7e3('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xb7e3('0x5'));var interaction=require(_0xb7e3('0x6'));var config=require(_0xb7e3('0x7'));var controller=require(_0xb7e3('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0xb7e3('0x9')]);router['get'](_0xb7e3('0xa'),auth[_0xb7e3('0xb')](),controller[_0xb7e3('0xc')]);router[_0xb7e3('0xd')]('/',auth['isAuthenticated'](),controller[_0xb7e3('0xe')]);router[_0xb7e3('0xf')]('/:id',auth[_0xb7e3('0xb')](),controller[_0xb7e3('0x10')]);router[_0xb7e3('0x11')](_0xb7e3('0xa'),auth[_0xb7e3('0xb')](),controller[_0xb7e3('0x12')]);module[_0xb7e3('0x13')]=router; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.attributes.js b/server/api/intServicenowField/intServicenowField.attributes.js index 6e48841..5ab0e49 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 _0x3f61=['string','BOOLEAN','variable','customVariable','keyValue','picklist','STRING'];(function(_0x57d7f7,_0x335c81){var _0x1a6800=function(_0x251345){while(--_0x251345){_0x57d7f7['push'](_0x57d7f7['shift']());}};_0x1a6800(++_0x335c81);}(_0x3f61,0x11a));var _0x13f6=function(_0x30d537,_0x5c0963){_0x30d537=_0x30d537-0x0;var _0x2b938d=_0x3f61[_0x30d537];return _0x2b938d;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize['ENUM']('string',_0x13f6('0x0'),_0x13f6('0x1'),_0x13f6('0x2'),_0x13f6('0x3')),'defaultValue':'string'},'content':{'type':Sequelize[_0x13f6('0x4')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize['ENUM'](_0x13f6('0x5'),_0x13f6('0x0'),_0x13f6('0x1'))},'keyContent':{'type':Sequelize[_0x13f6('0x4')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x13f6('0x6')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xc239=['BOOLEAN','sequelize','exports','ENUM','string','variable','customVariable','picklist','STRING'];(function(_0xe51596,_0x314d5b){var _0x22c705=function(_0x4c6f94){while(--_0x4c6f94){_0xe51596['push'](_0xe51596['shift']());}};_0x22c705(++_0x314d5b);}(_0xc239,0xeb));var _0x9c23=function(_0x46e363,_0x45d7e2){_0x46e363=_0x46e363-0x0;var _0x3fb059=_0xc239[_0x46e363];return _0x3fb059;};'use strict';var Sequelize=require(_0x9c23('0x0'));module[_0x9c23('0x1')]={'type':{'type':Sequelize[_0x9c23('0x2')](_0x9c23('0x3'),_0x9c23('0x4'),_0x9c23('0x5'),'keyValue',_0x9c23('0x6')),'defaultValue':_0x9c23('0x3')},'content':{'type':Sequelize[_0x9c23('0x7')]},'key':{'type':Sequelize[_0x9c23('0x7')]},'keyType':{'type':Sequelize[_0x9c23('0x2')](_0x9c23('0x3'),_0x9c23('0x4'),'customVariable')},'keyContent':{'type':Sequelize[_0x9c23('0x7')]},'idField':{'type':Sequelize[_0x9c23('0x7')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x9c23('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x9c23('0x7')]}}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.controller.js b/server/api/intServicenowField/intServicenowField.controller.js index a7cea7d..804b936 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 _0x9be1=['undefined','limit','count','set','Content-Range','apply','reject','update','then','end','stack','name','send','index','ServicenowField','rawAttributes','fieldName','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','include','rows','catch','show','params','includeAll','options','find','create','body','destroy','eml-format','rimraf','request-promise','moment','mustache','util','path','sox','fs-extra','squel','crypto','jsforce','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/license/util','sendStatus','status','json','offset'];(function(_0x618414,_0x1a7a60){var _0x21c19a=function(_0x507b17){while(--_0x507b17){_0x618414['push'](_0x618414['shift']());}};_0x21c19a(++_0x1a7a60);}(_0x9be1,0x146));var _0x19be=function(_0x1fcc66,_0x47864e){_0x1fcc66=_0x1fcc66-0x0;var _0x211dcd=_0x9be1[_0x1fcc66];return _0x211dcd;};'use strict';var emlformat=require(_0x19be('0x0'));var rimraf=require(_0x19be('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x19be('0x2'));var moment=require(_0x19be('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x19be('0x4'));var util=require(_0x19be('0x5'));var path=require(_0x19be('0x6'));var sox=require(_0x19be('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x19be('0x8'));var _=require('lodash');var squel=require(_0x19be('0x9'));var crypto=require(_0x19be('0xa'));var jsforce=require(_0x19be('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x19be('0xc'));var querystring=require(_0x19be('0xd'));var Papa=require('papaparse');var Redis=require(_0x19be('0xe'));var authService=require(_0x19be('0xf'));var qs=require(_0x19be('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x19be('0x11'));var logger=require('../../config/logger')('api');var utils=require(_0x19be('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0x19be('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x90053e,_0x293d11){_0x293d11=_0x293d11||0xcc;return function(_0xcff309){if(_0xcff309){return _0x90053e[_0x19be('0x14')](_0x293d11);}return _0x90053e[_0x19be('0x15')](_0x293d11)['end']();};}function respondWithResult(_0x2e0385,_0x4fa1e9){_0x4fa1e9=_0x4fa1e9||0xc8;return function(_0x316572){if(_0x316572){return _0x2e0385[_0x19be('0x15')](_0x4fa1e9)[_0x19be('0x16')](_0x316572);}};}function respondWithFilteredResult(_0x1b136f,_0x128e86){return function(_0x3e4c97){if(_0x3e4c97){var _0x37cab5=typeof _0x128e86[_0x19be('0x17')]===_0x19be('0x18')&&typeof _0x128e86[_0x19be('0x19')]==='undefined';var _0x2e93fd=_0x3e4c97[_0x19be('0x1a')];var _0x2b4c38=_0x37cab5?0x0:_0x128e86[_0x19be('0x17')];var _0x19a248=_0x37cab5?_0x3e4c97[_0x19be('0x1a')]:_0x128e86[_0x19be('0x17')]+_0x128e86['limit'];var _0x47f9ec;if(_0x19a248>=_0x2e93fd){_0x19a248=_0x2e93fd;_0x47f9ec=0xc8;}else{_0x47f9ec=0xce;}_0x1b136f[_0x19be('0x15')](_0x47f9ec);return _0x1b136f[_0x19be('0x1b')](_0x19be('0x1c'),_0x2b4c38+'-'+_0x19a248+'/'+_0x2e93fd)[_0x19be('0x16')](_0x3e4c97);}return null;};}function patchUpdates(_0x3ab674){return function(_0x10116c){try{jsonpatch[_0x19be('0x1d')](_0x10116c,_0x3ab674,!![]);}catch(_0x380f00){return BPromise[_0x19be('0x1e')](_0x380f00);}return _0x10116c['save']();};}function saveUpdates(_0x308615,_0x40c8cf){return function(_0x55fc05){if(_0x55fc05){return _0x55fc05[_0x19be('0x1f')](_0x308615)[_0x19be('0x20')](function(_0x7197f5){return _0x7197f5;});}return null;};}function removeEntity(_0x5bd5d,_0x24e1ae){return function(_0x35a285){if(_0x35a285){return _0x35a285['destroy']()['then'](function(){_0x5bd5d['status'](0xcc)[_0x19be('0x21')]();});}};}function handleEntityNotFound(_0x2b2d14,_0x2f47fb){return function(_0x5ceed){if(!_0x5ceed){_0x2b2d14[_0x19be('0x14')](0x194);}return _0x5ceed;};}function handleError(_0xceec0b,_0x1f389f){_0x1f389f=_0x1f389f||0x1f4;return function(_0x4b71bc){logger['error'](_0x4b71bc[_0x19be('0x22')]);if(_0x4b71bc[_0x19be('0x23')]){delete _0x4b71bc[_0x19be('0x23')];}_0xceec0b[_0x19be('0x15')](_0x1f389f)[_0x19be('0x24')](_0x4b71bc);};}exports[_0x19be('0x25')]=function(_0x356fbf,_0x4e5a75){var _0x31a6ec={},_0x4e975c={},_0xf04d6b={'count':0x0,'rows':[]};var _0x55677a=_['map'](db[_0x19be('0x26')][_0x19be('0x27')],function(_0x5e04b9){return{'name':_0x5e04b9[_0x19be('0x28')],'type':_0x5e04b9['type'][_0x19be('0x29')]};});_0x4e975c[_0x19be('0x2a')]=_[_0x19be('0x2b')](_0x55677a,_0x19be('0x23'));_0x4e975c[_0x19be('0x2c')]=_[_0x19be('0x2d')](_0x356fbf[_0x19be('0x2c')]);_0x4e975c[_0x19be('0x2e')]=_[_0x19be('0x2f')](_0x4e975c[_0x19be('0x2a')],_0x4e975c['query']);_0x31a6ec[_0x19be('0x30')]=_[_0x19be('0x2f')](_0x4e975c[_0x19be('0x2a')],qs[_0x19be('0x31')](_0x356fbf['query'][_0x19be('0x31')]));_0x31a6ec[_0x19be('0x30')]=_0x31a6ec['attributes'][_0x19be('0x32')]?_0x31a6ec[_0x19be('0x30')]:_0x4e975c[_0x19be('0x2a')];if(!_0x356fbf[_0x19be('0x2c')][_0x19be('0x33')](_0x19be('0x34'))){_0x31a6ec[_0x19be('0x19')]=qs['limit'](_0x356fbf[_0x19be('0x2c')][_0x19be('0x19')]);_0x31a6ec[_0x19be('0x17')]=qs[_0x19be('0x17')](_0x356fbf[_0x19be('0x2c')][_0x19be('0x17')]);}_0x31a6ec[_0x19be('0x35')]=qs[_0x19be('0x36')](_0x356fbf[_0x19be('0x2c')][_0x19be('0x36')]);_0x31a6ec[_0x19be('0x37')]=qs['filters'](_['pick'](_0x356fbf['query'],_0x4e975c['filters']),_0x55677a);if(_0x356fbf['query'][_0x19be('0x38')]){_0x31a6ec['where']=_[_0x19be('0x39')](_0x31a6ec[_0x19be('0x37')],{'$or':_[_0x19be('0x2b')](_0x55677a,function(_0x490d2e){if(_0x490d2e['type']!==_0x19be('0x3a')){var _0x1b6fb9={};_0x1b6fb9[_0x490d2e[_0x19be('0x23')]]={'$like':'%'+_0x356fbf[_0x19be('0x2c')][_0x19be('0x38')]+'%'};return _0x1b6fb9;}})});}_0x31a6ec=_[_0x19be('0x39')]({},_0x31a6ec,_0x356fbf['options']);var _0xb75044={'where':_0x31a6ec[_0x19be('0x37')]};return db[_0x19be('0x26')]['count'](_0xb75044)[_0x19be('0x20')](function(_0x71498e){_0xf04d6b[_0x19be('0x1a')]=_0x71498e;if(_0x356fbf['query']['includeAll']){_0x31a6ec[_0x19be('0x3b')]=[{'all':!![]}];}return db['ServicenowField']['findAll'](_0x31a6ec);})['then'](function(_0x324396){_0xf04d6b[_0x19be('0x3c')]=_0x324396;return _0xf04d6b;})[_0x19be('0x20')](respondWithFilteredResult(_0x4e5a75,_0x31a6ec))[_0x19be('0x3d')](handleError(_0x4e5a75,null));};exports[_0x19be('0x3e')]=function(_0x57566f,_0x86f583){var _0x48a066={'raw':!![],'where':{'id':_0x57566f[_0x19be('0x3f')]['id']}},_0x4f1cb2={};_0x4f1cb2[_0x19be('0x2a')]=_[_0x19be('0x2d')](db[_0x19be('0x26')][_0x19be('0x27')]);_0x4f1cb2[_0x19be('0x2c')]=_[_0x19be('0x2d')](_0x57566f[_0x19be('0x2c')]);_0x4f1cb2['filters']=_['intersection'](_0x4f1cb2[_0x19be('0x2a')],_0x4f1cb2['query']);_0x48a066['attributes']=_['intersection'](_0x4f1cb2[_0x19be('0x2a')],qs[_0x19be('0x31')](_0x57566f[_0x19be('0x2c')][_0x19be('0x31')]));_0x48a066[_0x19be('0x30')]=_0x48a066[_0x19be('0x30')][_0x19be('0x32')]?_0x48a066[_0x19be('0x30')]:_0x4f1cb2[_0x19be('0x2a')];if(_0x57566f[_0x19be('0x2c')][_0x19be('0x40')]){_0x48a066['include']=[{'all':!![]}];}_0x48a066=_['merge']({},_0x48a066,_0x57566f[_0x19be('0x41')]);return db[_0x19be('0x26')][_0x19be('0x42')](_0x48a066)['then'](handleEntityNotFound(_0x86f583,null))[_0x19be('0x20')](respondWithResult(_0x86f583,null))['catch'](handleError(_0x86f583,null));};exports['create']=function(_0x5dfbd2,_0x16b77a){return db[_0x19be('0x26')][_0x19be('0x43')](_0x5dfbd2[_0x19be('0x44')],{})[_0x19be('0x20')](respondWithResult(_0x16b77a,0xc9))[_0x19be('0x3d')](handleError(_0x16b77a,null));};exports[_0x19be('0x1f')]=function(_0x1b21cd,_0x23f117){if(_0x1b21cd[_0x19be('0x44')]['id']){delete _0x1b21cd[_0x19be('0x44')]['id'];}return db[_0x19be('0x26')][_0x19be('0x42')]({'where':{'id':_0x1b21cd[_0x19be('0x3f')]['id']}})[_0x19be('0x20')](handleEntityNotFound(_0x23f117,null))[_0x19be('0x20')](saveUpdates(_0x1b21cd[_0x19be('0x44')],null))[_0x19be('0x20')](respondWithResult(_0x23f117,null))[_0x19be('0x3d')](handleError(_0x23f117,null));};exports[_0x19be('0x45')]=function(_0x3954af,_0x3f4613){return db[_0x19be('0x26')][_0x19be('0x42')]({'where':{'id':_0x3954af[_0x19be('0x3f')]['id']}})[_0x19be('0x20')](handleEntityNotFound(_0x3f4613,null))[_0x19be('0x20')](removeEntity(_0x3f4613,null))[_0x19be('0x3d')](handleError(_0x3f4613,null));}; \ No newline at end of file +var _0x326e=['reject','save','update','then','destroy','error','stack','name','send','index','map','ServicenowField','rawAttributes','fieldName','type','key','keys','query','filters','intersection','model','attributes','fields','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','length','find','create','body','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','ejs','fs-extra','crypto','desk.js','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','status','end','json','limit','undefined','count','offset','apply'];(function(_0x7ca028,_0x233586){var _0x2dd584=function(_0x284212){while(--_0x284212){_0x7ca028['push'](_0x7ca028['shift']());}};_0x2dd584(++_0x233586);}(_0x326e,0x14d));var _0xe326=function(_0xaec84,_0x411dc3){_0xaec84=_0xaec84-0x0;var _0xb2d31=_0x326e[_0xaec84];return _0xb2d31;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe326('0x0'));var zipdir=require(_0xe326('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe326('0x2'));var moment=require(_0xe326('0x3'));var BPromise=require(_0xe326('0x4'));var Mustache=require(_0xe326('0x5'));var util=require(_0xe326('0x6'));var path=require('path');var sox=require(_0xe326('0x7'));var csv=require('to-csv');var ejs=require(_0xe326('0x8'));var fs=require('fs');var fs_extra=require(_0xe326('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xe326('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xe326('0xb'));var toCsv=require(_0xe326('0xc'));var querystring=require(_0xe326('0xd'));var Papa=require(_0xe326('0xe'));var Redis=require(_0xe326('0xf'));var authService=require(_0xe326('0x10'));var qs=require(_0xe326('0x11'));var as=require(_0xe326('0x12'));var hardwareService=require(_0xe326('0x13'));var logger=require('../../config/logger')(_0xe326('0x14'));var utils=require(_0xe326('0x15'));var config=require(_0xe326('0x16'));var licenseUtil=require(_0xe326('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1b7ed8,_0x524fb0){_0x524fb0=_0x524fb0||0xcc;return function(_0x501838){if(_0x501838){return _0x1b7ed8['sendStatus'](_0x524fb0);}return _0x1b7ed8[_0xe326('0x18')](_0x524fb0)[_0xe326('0x19')]();};}function respondWithResult(_0x5f472e,_0x22d5e5){_0x22d5e5=_0x22d5e5||0xc8;return function(_0xb8b0a6){if(_0xb8b0a6){return _0x5f472e[_0xe326('0x18')](_0x22d5e5)[_0xe326('0x1a')](_0xb8b0a6);}};}function respondWithFilteredResult(_0x4dc651,_0x2e73ac){return function(_0xe8d834){if(_0xe8d834){var _0x39ee35=typeof _0x2e73ac['offset']==='undefined'&&typeof _0x2e73ac[_0xe326('0x1b')]===_0xe326('0x1c');var _0x3c8957=_0xe8d834[_0xe326('0x1d')];var _0x3344af=_0x39ee35?0x0:_0x2e73ac[_0xe326('0x1e')];var _0x3b822b=_0x39ee35?_0xe8d834['count']:_0x2e73ac[_0xe326('0x1e')]+_0x2e73ac[_0xe326('0x1b')];var _0xb5f5a7;if(_0x3b822b>=_0x3c8957){_0x3b822b=_0x3c8957;_0xb5f5a7=0xc8;}else{_0xb5f5a7=0xce;}_0x4dc651['status'](_0xb5f5a7);return _0x4dc651['set']('Content-Range',_0x3344af+'-'+_0x3b822b+'/'+_0x3c8957)[_0xe326('0x1a')](_0xe8d834);}return null;};}function patchUpdates(_0x4b62a1){return function(_0x312c33){try{jsonpatch[_0xe326('0x1f')](_0x312c33,_0x4b62a1,!![]);}catch(_0x32ea30){return BPromise[_0xe326('0x20')](_0x32ea30);}return _0x312c33[_0xe326('0x21')]();};}function saveUpdates(_0x52fa62,_0x201f68){return function(_0x3de516){if(_0x3de516){return _0x3de516[_0xe326('0x22')](_0x52fa62)[_0xe326('0x23')](function(_0x4c8136){return _0x4c8136;});}return null;};}function removeEntity(_0x332776,_0x3cdf93){return function(_0x3dfb63){if(_0x3dfb63){return _0x3dfb63[_0xe326('0x24')]()[_0xe326('0x23')](function(){_0x332776['status'](0xcc)[_0xe326('0x19')]();});}};}function handleEntityNotFound(_0x1fbdbd,_0x15b745){return function(_0x5107c2){if(!_0x5107c2){_0x1fbdbd['sendStatus'](0x194);}return _0x5107c2;};}function handleError(_0x247e8a,_0x16520d){_0x16520d=_0x16520d||0x1f4;return function(_0xd80e1d){logger[_0xe326('0x25')](_0xd80e1d[_0xe326('0x26')]);if(_0xd80e1d[_0xe326('0x27')]){delete _0xd80e1d[_0xe326('0x27')];}_0x247e8a[_0xe326('0x18')](_0x16520d)[_0xe326('0x28')](_0xd80e1d);};}exports[_0xe326('0x29')]=function(_0x38f639,_0xa0e5fe){var _0x60264e={},_0x170a09={},_0x37cc7b={'count':0x0,'rows':[]};var _0x70f8ee=_[_0xe326('0x2a')](db[_0xe326('0x2b')][_0xe326('0x2c')],function(_0x591af0){return{'name':_0x591af0[_0xe326('0x2d')],'type':_0x591af0[_0xe326('0x2e')][_0xe326('0x2f')]};});_0x170a09['model']=_['map'](_0x70f8ee,_0xe326('0x27'));_0x170a09['query']=_[_0xe326('0x30')](_0x38f639[_0xe326('0x31')]);_0x170a09[_0xe326('0x32')]=_[_0xe326('0x33')](_0x170a09[_0xe326('0x34')],_0x170a09[_0xe326('0x31')]);_0x60264e[_0xe326('0x35')]=_[_0xe326('0x33')](_0x170a09[_0xe326('0x34')],qs[_0xe326('0x36')](_0x38f639[_0xe326('0x31')][_0xe326('0x36')]));_0x60264e['attributes']=_0x60264e['attributes']['length']?_0x60264e[_0xe326('0x35')]:_0x170a09[_0xe326('0x34')];if(!_0x38f639[_0xe326('0x31')]['hasOwnProperty']('nolimit')){_0x60264e['limit']=qs[_0xe326('0x1b')](_0x38f639[_0xe326('0x31')][_0xe326('0x1b')]);_0x60264e['offset']=qs[_0xe326('0x1e')](_0x38f639['query'][_0xe326('0x1e')]);}_0x60264e[_0xe326('0x37')]=qs['sort'](_0x38f639['query'][_0xe326('0x38')]);_0x60264e[_0xe326('0x39')]=qs[_0xe326('0x32')](_[_0xe326('0x3a')](_0x38f639[_0xe326('0x31')],_0x170a09[_0xe326('0x32')]),_0x70f8ee);if(_0x38f639['query'][_0xe326('0x3b')]){_0x60264e[_0xe326('0x39')]=_['merge'](_0x60264e[_0xe326('0x39')],{'$or':_['map'](_0x70f8ee,function(_0x3e818d){if(_0x3e818d['type']!=='VIRTUAL'){var _0x6caac6={};_0x6caac6[_0x3e818d[_0xe326('0x27')]]={'$like':'%'+_0x38f639[_0xe326('0x31')]['filter']+'%'};return _0x6caac6;}})});}_0x60264e=_[_0xe326('0x3c')]({},_0x60264e,_0x38f639[_0xe326('0x3d')]);var _0x17b026={'where':_0x60264e[_0xe326('0x39')]};return db[_0xe326('0x2b')]['count'](_0x17b026)[_0xe326('0x23')](function(_0x231c55){_0x37cc7b['count']=_0x231c55;if(_0x38f639['query'][_0xe326('0x3e')]){_0x60264e[_0xe326('0x3f')]=[{'all':!![]}];}return db['ServicenowField'][_0xe326('0x40')](_0x60264e);})[_0xe326('0x23')](function(_0x42377d){_0x37cc7b[_0xe326('0x41')]=_0x42377d;return _0x37cc7b;})[_0xe326('0x23')](respondWithFilteredResult(_0xa0e5fe,_0x60264e))[_0xe326('0x42')](handleError(_0xa0e5fe,null));};exports[_0xe326('0x43')]=function(_0x5b3e55,_0x379dcf){var _0xcc782c={'raw':!![],'where':{'id':_0x5b3e55[_0xe326('0x44')]['id']}},_0x5614dd={};_0x5614dd['model']=_['keys'](db['ServicenowField']['rawAttributes']);_0x5614dd[_0xe326('0x31')]=_[_0xe326('0x30')](_0x5b3e55[_0xe326('0x31')]);_0x5614dd[_0xe326('0x32')]=_['intersection'](_0x5614dd['model'],_0x5614dd[_0xe326('0x31')]);_0xcc782c[_0xe326('0x35')]=_['intersection'](_0x5614dd[_0xe326('0x34')],qs['fields'](_0x5b3e55[_0xe326('0x31')][_0xe326('0x36')]));_0xcc782c['attributes']=_0xcc782c['attributes'][_0xe326('0x45')]?_0xcc782c[_0xe326('0x35')]:_0x5614dd[_0xe326('0x34')];if(_0x5b3e55[_0xe326('0x31')][_0xe326('0x3e')]){_0xcc782c[_0xe326('0x3f')]=[{'all':!![]}];}_0xcc782c=_[_0xe326('0x3c')]({},_0xcc782c,_0x5b3e55[_0xe326('0x3d')]);return db[_0xe326('0x2b')][_0xe326('0x46')](_0xcc782c)[_0xe326('0x23')](handleEntityNotFound(_0x379dcf,null))['then'](respondWithResult(_0x379dcf,null))[_0xe326('0x42')](handleError(_0x379dcf,null));};exports[_0xe326('0x47')]=function(_0x20a83d,_0xa0f9f0){return db[_0xe326('0x2b')][_0xe326('0x47')](_0x20a83d[_0xe326('0x48')],{})[_0xe326('0x23')](respondWithResult(_0xa0f9f0,0xc9))[_0xe326('0x42')](handleError(_0xa0f9f0,null));};exports[_0xe326('0x22')]=function(_0x25c2ce,_0x3bf067){if(_0x25c2ce[_0xe326('0x48')]['id']){delete _0x25c2ce[_0xe326('0x48')]['id'];}return db[_0xe326('0x2b')][_0xe326('0x46')]({'where':{'id':_0x25c2ce[_0xe326('0x44')]['id']}})[_0xe326('0x23')](handleEntityNotFound(_0x3bf067,null))[_0xe326('0x23')](saveUpdates(_0x25c2ce[_0xe326('0x48')],null))[_0xe326('0x23')](respondWithResult(_0x3bf067,null))[_0xe326('0x42')](handleError(_0x3bf067,null));};exports[_0xe326('0x24')]=function(_0x44aa11,_0x9fd5cf){return db[_0xe326('0x2b')][_0xe326('0x46')]({'where':{'id':_0x44aa11[_0xe326('0x44')]['id']}})[_0xe326('0x23')](handleEntityNotFound(_0x9fd5cf,null))[_0xe326('0x23')](removeEntity(_0x9fd5cf,null))[_0xe326('0x42')](handleError(_0x9fd5cf,null));}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.model.js b/server/api/intServicenowField/intServicenowField.model.js index b86f85d..969d2f2 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 _0xae5c=['moment','bluebird','path','rimraf','../../config/environment','./intServicenowField.attributes','exports','define','ServicenowField','int_servicenow_fields','servicenow_unique_index','lodash','util','../../config/logger','api'];(function(_0x592527,_0x2d4bb3){var _0x4335ba=function(_0x5f075f){while(--_0x5f075f){_0x592527['push'](_0x592527['shift']());}};_0x4335ba(++_0x2d4bb3);}(_0xae5c,0xce));var _0xcae5=function(_0x325052,_0x54d125){_0x325052=_0x325052-0x0;var _0x1add5b=_0xae5c[_0x325052];return _0x1add5b;};'use strict';var _=require(_0xcae5('0x0'));var util=require(_0xcae5('0x1'));var logger=require(_0xcae5('0x2'))(_0xcae5('0x3'));var moment=require(_0xcae5('0x4'));var BPromise=require(_0xcae5('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xcae5('0x6'));var rimraf=require(_0xcae5('0x7'));var config=require(_0xcae5('0x8'));var attributes=require(_0xcae5('0x9'));module[_0xcae5('0xa')]=function(_0x259056,_0x2dace6){return _0x259056[_0xcae5('0xb')](_0xcae5('0xc'),attributes,{'tableName':_0xcae5('0xd'),'paranoid':![],'indexes':[{'name':_0xcae5('0xe'),'fields':['idField','FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x18a6=['../../config/environment','./intServicenowField.attributes','exports','ServicenowField','servicenow_unique_index','FieldId','lodash','../../config/logger','api','moment','path','rimraf'];(function(_0x54f322,_0x24a660){var _0xb0a1d5=function(_0x523587){while(--_0x523587){_0x54f322['push'](_0x54f322['shift']());}};_0xb0a1d5(++_0x24a660);}(_0x18a6,0xba));var _0x618a=function(_0x2ea9b8,_0x5ee8af){_0x2ea9b8=_0x2ea9b8-0x0;var _0x425429=_0x18a6[_0x2ea9b8];return _0x425429;};'use strict';var _=require(_0x618a('0x0'));var util=require('util');var logger=require(_0x618a('0x1'))(_0x618a('0x2'));var moment=require(_0x618a('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x618a('0x4'));var rimraf=require(_0x618a('0x5'));var config=require(_0x618a('0x6'));var attributes=require(_0x618a('0x7'));module[_0x618a('0x8')]=function(_0x4fd983,_0x4aa9d6){return _0x4fd983['define'](_0x618a('0x9'),attributes,{'tableName':'int_servicenow_fields','paranoid':![],'indexes':[{'name':_0x618a('0xa'),'fields':['idField',_0x618a('0xb')],'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 1258281..d375c06 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 _0xb7e7=['ServicenowField,\x20%s,\x20%s','debug','ServicenowField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','moment','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','http','request','then','info'];(function(_0x5b222c,_0x1996ab){var _0x49c9e4=function(_0x8f27b8){while(--_0x8f27b8){_0x5b222c['push'](_0x5b222c['shift']());}};_0x49c9e4(++_0x1996ab);}(_0xb7e7,0x121));var _0x7b7e=function(_0x9fd887,_0x47f76c){_0x9fd887=_0x9fd887-0x0;var _0x1a54ab=_0xb7e7[_0x9fd887];return _0x1a54ab;};'use strict';var _=require(_0x7b7e('0x0'));var util=require('util');var moment=require(_0x7b7e('0x1'));var BPromise=require('bluebird');var rs=require(_0x7b7e('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7b7e('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x7b7e('0x4'))(_0x7b7e('0x5'));var config=require(_0x7b7e('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0x7b7e('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x372bde,_0x7f87e0,_0x55ce81){return new BPromise(function(_0x42b871,_0x223587){return client[_0x7b7e('0x8')](_0x372bde,_0x55ce81)[_0x7b7e('0x9')](function(_0x148964){logger[_0x7b7e('0xa')](_0x7b7e('0xb'),_0x7f87e0,'request\x20sent');logger[_0x7b7e('0xc')](_0x7b7e('0xd'),_0x7f87e0,_0x7b7e('0xe'),JSON[_0x7b7e('0xf')](_0x148964));if(_0x148964[_0x7b7e('0x10')]){if(_0x148964[_0x7b7e('0x10')][_0x7b7e('0x11')]===0x1f4){logger[_0x7b7e('0x10')](_0x7b7e('0xb'),_0x7f87e0,_0x148964['error'][_0x7b7e('0x12')]);return _0x223587(_0x148964[_0x7b7e('0x10')]['message']);}logger[_0x7b7e('0x10')]('ServicenowField,\x20%s,\x20%s',_0x7f87e0,_0x148964['error'][_0x7b7e('0x12')]);return _0x42b871(_0x148964[_0x7b7e('0x10')][_0x7b7e('0x12')]);}else{logger[_0x7b7e('0xa')](_0x7b7e('0xb'),_0x7f87e0,'request\x20sent');_0x42b871(_0x148964['result'][_0x7b7e('0x12')]);}})[_0x7b7e('0x13')](function(_0x27f999){logger[_0x7b7e('0x10')](_0x7b7e('0xb'),_0x7f87e0,_0x27f999);_0x223587(_0x27f999);});});} \ No newline at end of file +var _0xbdb7=['request\x20sent','debug','ServicenowField,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','info','ServicenowField,\x20%s,\x20%s'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xbdb7,0x12e));var _0x7bdb=function(_0x8a654b,_0x4be2f9){_0x8a654b=_0x8a654b-0x0;var _0x94bfbb=_0xbdb7[_0x8a654b];return _0x94bfbb;};'use strict';var _=require(_0x7bdb('0x0'));var util=require(_0x7bdb('0x1'));var moment=require(_0x7bdb('0x2'));var BPromise=require(_0x7bdb('0x3'));var rs=require(_0x7bdb('0x4'));var fs=require('fs');var Redis=require(_0x7bdb('0x5'));var db=require(_0x7bdb('0x6'))['db'];var utils=require(_0x7bdb('0x7'));var logger=require(_0x7bdb('0x8'))('rpc');var config=require(_0x7bdb('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x7bdb('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1e23a3,_0x493bde,_0x513cba){return new BPromise(function(_0x468041,_0x11a877){return client['request'](_0x1e23a3,_0x513cba)['then'](function(_0xdc2ffc){logger[_0x7bdb('0xb')](_0x7bdb('0xc'),_0x493bde,_0x7bdb('0xd'));logger[_0x7bdb('0xe')](_0x7bdb('0xf'),_0x493bde,_0x7bdb('0xd'),JSON[_0x7bdb('0x10')](_0xdc2ffc));if(_0xdc2ffc['error']){if(_0xdc2ffc['error']['code']===0x1f4){logger[_0x7bdb('0x11')](_0x7bdb('0xc'),_0x493bde,_0xdc2ffc['error'][_0x7bdb('0x12')]);return _0x11a877(_0xdc2ffc['error']['message']);}logger[_0x7bdb('0x11')](_0x7bdb('0xc'),_0x493bde,_0xdc2ffc['error']['message']);return _0x468041(_0xdc2ffc['error'][_0x7bdb('0x12')]);}else{logger[_0x7bdb('0xb')](_0x7bdb('0xc'),_0x493bde,_0x7bdb('0xd'));_0x468041(_0xdc2ffc[_0x7bdb('0x13')][_0x7bdb('0x12')]);}})[_0x7bdb('0x14')](function(_0x1b2d9b){logger['error'](_0x7bdb('0xc'),_0x493bde,_0x1b2d9b);_0x11a877(_0x1b2d9b);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/index.js b/server/api/intSugarcrmAccount/index.js index 87465d5..2a26c0c 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(_0x286e66,_0x9829b3){var _0xb5d8ce=function(_0x21636b){while(--_0x21636b){_0x286e66['push'](_0x286e66['shift']());}};_0xb5d8ce(++_0x9829b3);}(_0xa9e0,0x123));var _0x0a9e=function(_0x138f59,_0x1b53fb){_0x138f59=_0x138f59-0x0;var _0x3d114d=_0xa9e0[_0x138f59];return _0x3d114d;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['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(_0x5114dd,_0x5ac835){var _0x48f193=function(_0x169e85){while(--_0x169e85){_0x5114dd['push'](_0x5114dd['shift']());}};_0x48f193(++_0x5ac835);}(_0x9957,0x93));var _0x7995=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0x9957[_0x618414];return _0x21c19a;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x11')]('/',auth['isAuthenticated'](),controller[_0x7995('0x12')]);router[_0x7995('0x11')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router[_0x7995('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x7995('0x17')]);module[_0x7995('0x18')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js index f5936dc..3e17e00 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(_0x5d1300,_0x443329){var _0x1d8760=function(_0x4aec6c){while(--_0x4aec6c){_0x5d1300['push'](_0x5d1300['shift']());}};_0x1d8760(++_0x443329);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4b7b62,_0x4920a9){_0x4b7b62=_0x4b7b62-0x0;var _0x2280df=_0xa9e0[_0x4b7b62];return _0x2280df;};'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(_0xf65f98,_0x3e3383){var _0x58f81d=function(_0x12ea19){while(--_0x12ea19){_0xf65f98['push'](_0xf65f98['shift']());}};_0x58f81d(++_0x3e3383);}(_0xa9e0,0x123));var _0x0a9e=function(_0x29b609,_0x19d388){_0x29b609=_0x29b609-0x0;var _0x54c952=_0xa9e0[_0x29b609];return _0x54c952;};'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 ddb3842..10bd621 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 _0xaae1=['body','update','find','findOne','SugarcrmConfiguration','order','pick','getConfigurations','hasOwnProperty','addConfiguration','Subjects','type','Descriptions','channel','SugarcrmField','getFields','description','date_start','duration_hours','parent_id','parent_type','parent_name','direction','remoteUri','slice','lastIndexOf','POST','format','%s%s','login','JSON','stringify','password','PLAIN','Invalid\x20Login','Password\x20Expired','/service/v4_1/rest.php','get_module_fields','Calls','values','module_fields','remove','includes','label','endsWith','value','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','limit','undefined','count','set','apply','save','then','destroy','sendStatus','error','stack','name','send','index','map','rawAttributes','fieldName','model','keys','intersection','query','attributes','fields','nolimit','sort','where','filters','filter','merge','VIRTUAL','options','includeAll','include','rows','show','params','length','SugarcrmAccount','catch','create'];(function(_0x4fd904,_0x430836){var _0x32d7c9=function(_0x79f335){while(--_0x79f335){_0x4fd904['push'](_0x4fd904['shift']());}};_0x32d7c9(++_0x430836);}(_0xaae1,0xab));var _0x1aae=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xaae1[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x1aae('0x0'));var rimraf=require(_0x1aae('0x1'));var zipdir=require(_0x1aae('0x2'));var jsonpatch=require(_0x1aae('0x3'));var rp=require(_0x1aae('0x4'));var moment=require(_0x1aae('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x1aae('0x6'));var util=require(_0x1aae('0x7'));var path=require(_0x1aae('0x8'));var sox=require('sox');var csv=require(_0x1aae('0x9'));var ejs=require(_0x1aae('0xa'));var fs=require('fs');var fs_extra=require(_0x1aae('0xb'));var _=require('lodash');var squel=require(_0x1aae('0xc'));var crypto=require(_0x1aae('0xd'));var jsforce=require(_0x1aae('0xe'));var deskjs=require(_0x1aae('0xf'));var toCsv=require(_0x1aae('0x9'));var querystring=require('querystring');var Papa=require(_0x1aae('0x10'));var Redis=require(_0x1aae('0x11'));var authService=require(_0x1aae('0x12'));var qs=require(_0x1aae('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1aae('0x14'));var logger=require(_0x1aae('0x15'))(_0x1aae('0x16'));var utils=require(_0x1aae('0x17'));var config=require(_0x1aae('0x18'));var licenseUtil=require(_0x1aae('0x19'));var db=require(_0x1aae('0x1a'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x2a1e89,_0x5c211e){_0x5c211e=_0x5c211e||0xcc;return function(_0x5942ed){if(_0x5942ed){return _0x2a1e89['sendStatus'](_0x5c211e);}return _0x2a1e89[_0x1aae('0x1b')](_0x5c211e)[_0x1aae('0x1c')]();};}function respondWithResult(_0x5a9428,_0x27be03){_0x27be03=_0x27be03||0xc8;return function(_0x53afba){if(_0x53afba){return _0x5a9428['status'](_0x27be03)[_0x1aae('0x1d')](_0x53afba);}};}function respondWithFilteredResult(_0x387feb,_0x4c86f2){return function(_0x43f4db){if(_0x43f4db){var _0x4082e3=typeof _0x4c86f2[_0x1aae('0x1e')]==='undefined'&&typeof _0x4c86f2[_0x1aae('0x1f')]===_0x1aae('0x20');var _0x271ab7=_0x43f4db[_0x1aae('0x21')];var _0x2ce454=_0x4082e3?0x0:_0x4c86f2[_0x1aae('0x1e')];var _0x17d211=_0x4082e3?_0x43f4db[_0x1aae('0x21')]:_0x4c86f2[_0x1aae('0x1e')]+_0x4c86f2[_0x1aae('0x1f')];var _0x507902;if(_0x17d211>=_0x271ab7){_0x17d211=_0x271ab7;_0x507902=0xc8;}else{_0x507902=0xce;}_0x387feb[_0x1aae('0x1b')](_0x507902);return _0x387feb[_0x1aae('0x22')]('Content-Range',_0x2ce454+'-'+_0x17d211+'/'+_0x271ab7)[_0x1aae('0x1d')](_0x43f4db);}return null;};}function patchUpdates(_0x5e8099){return function(_0x31e6c5){try{jsonpatch[_0x1aae('0x23')](_0x31e6c5,_0x5e8099,!![]);}catch(_0x57b3bf){return BPromise['reject'](_0x57b3bf);}return _0x31e6c5[_0x1aae('0x24')]();};}function saveUpdates(_0x447588,_0x1af6f6){return function(_0x4228f9){if(_0x4228f9){return _0x4228f9['update'](_0x447588)[_0x1aae('0x25')](function(_0x39eff0){return _0x39eff0;});}return null;};}function removeEntity(_0x14066b,_0x37255b){return function(_0x44e6d6){if(_0x44e6d6){return _0x44e6d6[_0x1aae('0x26')]()[_0x1aae('0x25')](function(){_0x14066b['status'](0xcc)[_0x1aae('0x1c')]();});}};}function handleEntityNotFound(_0x5631e6,_0x1c4352){return function(_0x4ff407){if(!_0x4ff407){_0x5631e6[_0x1aae('0x27')](0x194);}return _0x4ff407;};}function handleError(_0x46bc4b,_0x53da9d){_0x53da9d=_0x53da9d||0x1f4;return function(_0x534b88){logger[_0x1aae('0x28')](_0x534b88[_0x1aae('0x29')]);if(_0x534b88[_0x1aae('0x2a')]){delete _0x534b88[_0x1aae('0x2a')];}_0x46bc4b['status'](_0x53da9d)[_0x1aae('0x2b')](_0x534b88);};}exports[_0x1aae('0x2c')]=function(_0x1688b1,_0x3ae5d7){var _0x1a5cd4={},_0x532190={},_0x410288={'count':0x0,'rows':[]};var _0x2b2c58=_[_0x1aae('0x2d')](db['SugarcrmAccount'][_0x1aae('0x2e')],function(_0x393da6){return{'name':_0x393da6[_0x1aae('0x2f')],'type':_0x393da6['type']['key']};});_0x532190[_0x1aae('0x30')]=_[_0x1aae('0x2d')](_0x2b2c58,_0x1aae('0x2a'));_0x532190['query']=_[_0x1aae('0x31')](_0x1688b1['query']);_0x532190['filters']=_[_0x1aae('0x32')](_0x532190[_0x1aae('0x30')],_0x532190[_0x1aae('0x33')]);_0x1a5cd4[_0x1aae('0x34')]=_[_0x1aae('0x32')](_0x532190['model'],qs[_0x1aae('0x35')](_0x1688b1[_0x1aae('0x33')][_0x1aae('0x35')]));_0x1a5cd4[_0x1aae('0x34')]=_0x1a5cd4[_0x1aae('0x34')]['length']?_0x1a5cd4[_0x1aae('0x34')]:_0x532190[_0x1aae('0x30')];if(!_0x1688b1['query']['hasOwnProperty'](_0x1aae('0x36'))){_0x1a5cd4[_0x1aae('0x1f')]=qs[_0x1aae('0x1f')](_0x1688b1['query']['limit']);_0x1a5cd4[_0x1aae('0x1e')]=qs[_0x1aae('0x1e')](_0x1688b1[_0x1aae('0x33')][_0x1aae('0x1e')]);}_0x1a5cd4['order']=qs[_0x1aae('0x37')](_0x1688b1[_0x1aae('0x33')][_0x1aae('0x37')]);_0x1a5cd4[_0x1aae('0x38')]=qs[_0x1aae('0x39')](_['pick'](_0x1688b1[_0x1aae('0x33')],_0x532190[_0x1aae('0x39')]),_0x2b2c58);if(_0x1688b1['query'][_0x1aae('0x3a')]){_0x1a5cd4[_0x1aae('0x38')]=_[_0x1aae('0x3b')](_0x1a5cd4[_0x1aae('0x38')],{'$or':_['map'](_0x2b2c58,function(_0x4dd745){if(_0x4dd745['type']!==_0x1aae('0x3c')){var _0x300733={};_0x300733[_0x4dd745['name']]={'$like':'%'+_0x1688b1[_0x1aae('0x33')]['filter']+'%'};return _0x300733;}})});}_0x1a5cd4=_[_0x1aae('0x3b')]({},_0x1a5cd4,_0x1688b1[_0x1aae('0x3d')]);var _0x33ab4d={'where':_0x1a5cd4[_0x1aae('0x38')]};return db['SugarcrmAccount'][_0x1aae('0x21')](_0x33ab4d)[_0x1aae('0x25')](function(_0x55eacd){_0x410288[_0x1aae('0x21')]=_0x55eacd;if(_0x1688b1['query'][_0x1aae('0x3e')]){_0x1a5cd4[_0x1aae('0x3f')]=[{'all':!![]}];}return db['SugarcrmAccount']['findAll'](_0x1a5cd4);})['then'](function(_0x14dfcc){_0x410288[_0x1aae('0x40')]=_0x14dfcc;return _0x410288;})[_0x1aae('0x25')](respondWithFilteredResult(_0x3ae5d7,_0x1a5cd4))['catch'](handleError(_0x3ae5d7,null));};exports[_0x1aae('0x41')]=function(_0xd14dd8,_0x1e891a){var _0x35fc35={'raw':![],'where':{'id':_0xd14dd8[_0x1aae('0x42')]['id']}},_0x2cb2ed={};_0x2cb2ed[_0x1aae('0x30')]=_[_0x1aae('0x31')](db['SugarcrmAccount'][_0x1aae('0x2e')]);_0x2cb2ed['query']=_[_0x1aae('0x31')](_0xd14dd8[_0x1aae('0x33')]);_0x2cb2ed['filters']=_[_0x1aae('0x32')](_0x2cb2ed[_0x1aae('0x30')],_0x2cb2ed[_0x1aae('0x33')]);_0x35fc35[_0x1aae('0x34')]=_[_0x1aae('0x32')](_0x2cb2ed[_0x1aae('0x30')],qs[_0x1aae('0x35')](_0xd14dd8[_0x1aae('0x33')]['fields']));_0x35fc35['attributes']=_0x35fc35['attributes'][_0x1aae('0x43')]?_0x35fc35[_0x1aae('0x34')]:_0x2cb2ed[_0x1aae('0x30')];if(_0xd14dd8['query'][_0x1aae('0x3e')]){_0x35fc35['include']=[{'all':!![]}];}_0x35fc35=_[_0x1aae('0x3b')]({},_0x35fc35,_0xd14dd8[_0x1aae('0x3d')]);return db[_0x1aae('0x44')]['find'](_0x35fc35)[_0x1aae('0x25')](handleEntityNotFound(_0x1e891a,null))[_0x1aae('0x25')](respondWithResult(_0x1e891a,null))[_0x1aae('0x45')](handleError(_0x1e891a,null));};exports['create']=function(_0x32927f,_0x5731a2){return db[_0x1aae('0x44')][_0x1aae('0x46')](_0x32927f[_0x1aae('0x47')],{})['then'](respondWithResult(_0x5731a2,0xc9))[_0x1aae('0x45')](handleError(_0x5731a2,null));};exports[_0x1aae('0x48')]=function(_0x3c2f90,_0x273f8b){if(_0x3c2f90[_0x1aae('0x47')]['id']){delete _0x3c2f90[_0x1aae('0x47')]['id'];}return db['SugarcrmAccount'][_0x1aae('0x49')]({'where':{'id':_0x3c2f90[_0x1aae('0x42')]['id']}})['then'](handleEntityNotFound(_0x273f8b,null))[_0x1aae('0x25')](saveUpdates(_0x3c2f90[_0x1aae('0x47')],null))['then'](respondWithResult(_0x273f8b,null))[_0x1aae('0x45')](handleError(_0x273f8b,null));};exports[_0x1aae('0x26')]=function(_0x4bbe7a,_0x351cd0){return db['SugarcrmAccount'][_0x1aae('0x49')]({'where':{'id':_0x4bbe7a[_0x1aae('0x42')]['id']}})['then'](handleEntityNotFound(_0x351cd0,null))[_0x1aae('0x25')](removeEntity(_0x351cd0,null))[_0x1aae('0x45')](handleError(_0x351cd0,null));};exports['getConfigurations']=function(_0xc18686,_0x55e54b,_0x496d3f){var _0x1f98e3={};var _0x4b98f7={};var _0x376090;var _0x1ceea6;return db[_0x1aae('0x44')][_0x1aae('0x4a')]({'where':{'id':_0xc18686[_0x1aae('0x42')]['id']}})[_0x1aae('0x25')](handleEntityNotFound(_0x55e54b,null))[_0x1aae('0x25')](function(_0x12ac39){if(_0x12ac39){_0x376090=_0x12ac39;_0x4b98f7[_0x1aae('0x30')]=_[_0x1aae('0x31')](db[_0x1aae('0x4b')]['rawAttributes']);_0x4b98f7[_0x1aae('0x33')]=_[_0x1aae('0x31')](_0xc18686[_0x1aae('0x33')]);_0x4b98f7[_0x1aae('0x39')]=_[_0x1aae('0x32')](_0x4b98f7['model'],_0x4b98f7['query']);_0x1f98e3[_0x1aae('0x34')]=_[_0x1aae('0x32')](_0x4b98f7[_0x1aae('0x30')],qs[_0x1aae('0x35')](_0xc18686[_0x1aae('0x33')][_0x1aae('0x35')]));_0x1f98e3[_0x1aae('0x34')]=_0x1f98e3[_0x1aae('0x34')][_0x1aae('0x43')]?_0x1f98e3['attributes']:_0x4b98f7[_0x1aae('0x30')];_0x1f98e3[_0x1aae('0x4c')]=qs[_0x1aae('0x37')](_0xc18686[_0x1aae('0x33')][_0x1aae('0x37')]);_0x1f98e3[_0x1aae('0x38')]=qs[_0x1aae('0x39')](_[_0x1aae('0x4d')](_0xc18686[_0x1aae('0x33')],_0x4b98f7['filters']));if(_0xc18686[_0x1aae('0x33')][_0x1aae('0x3a')]){_0x1f98e3[_0x1aae('0x38')]=_[_0x1aae('0x3b')](_0x1f98e3['where'],{'$or':_[_0x1aae('0x2d')](_0x1f98e3[_0x1aae('0x34')],function(_0x3ae30b){var _0x4b3bed={};_0x4b3bed[_0x3ae30b]={'$like':'%'+_0xc18686[_0x1aae('0x33')]['filter']+'%'};return _0x4b3bed;})});}_0x1f98e3=_[_0x1aae('0x3b')]({},_0x1f98e3,_0xc18686[_0x1aae('0x3d')]);return _0x376090[_0x1aae('0x4e')](_0x1f98e3);}})[_0x1aae('0x25')](function(_0x3e5861){if(_0x3e5861){_0x1ceea6=_0x3e5861[_0x1aae('0x43')];if(!_0xc18686[_0x1aae('0x33')][_0x1aae('0x4f')](_0x1aae('0x36'))){_0x1f98e3[_0x1aae('0x1f')]=qs[_0x1aae('0x1f')](_0xc18686[_0x1aae('0x33')]['limit']);_0x1f98e3['offset']=qs[_0x1aae('0x1e')](_0xc18686[_0x1aae('0x33')]['offset']);}return _0x376090[_0x1aae('0x4e')](_0x1f98e3);}})[_0x1aae('0x25')](function(_0x54bec1){if(_0x54bec1){return _0x54bec1?{'count':_0x1ceea6,'rows':_0x54bec1}:null;}})[_0x1aae('0x25')](respondWithResult(_0x55e54b,null))[_0x1aae('0x45')](handleError(_0x55e54b,null));};exports[_0x1aae('0x50')]=function(_0x17b618,_0xf86425,_0x588430){if(_0x17b618[_0x1aae('0x47')]['id']){delete _0x17b618[_0x1aae('0x47')]['id'];}return db[_0x1aae('0x44')][_0x1aae('0x4a')]({'where':{'id':_0x17b618[_0x1aae('0x42')]['id']}})[_0x1aae('0x25')](handleEntityNotFound(_0xf86425,null))[_0x1aae('0x25')](function(_0x17ce6c){if(_0x17ce6c){_0x17b618[_0x1aae('0x47')]['AccountId']=_0x17ce6c['id'];_0x17b618['body'][_0x1aae('0x51')]=integrations['getSubjects'](_0x17b618[_0x1aae('0x47')]['channel'],_0x17b618[_0x1aae('0x47')][_0x1aae('0x52')]);_0x17b618[_0x1aae('0x47')][_0x1aae('0x53')]=integrations['getDescriptions'](_0x17b618[_0x1aae('0x47')][_0x1aae('0x54')],_0x17b618[_0x1aae('0x47')]['type']);return db[_0x1aae('0x4b')]['create'](_0x17b618[_0x1aae('0x47')],{'include':[{'model':db[_0x1aae('0x55')],'as':_0x1aae('0x51')},{'model':db[_0x1aae('0x55')],'as':_0x1aae('0x53')}]});}return null;})[_0x1aae('0x25')](respondWithResult(_0xf86425,null))[_0x1aae('0x45')](handleError(_0xf86425,null));};exports[_0x1aae('0x56')]=function(_0x519ab2,_0x28aa81,_0x142a33){var _0x3729cd='';var _0xa42553=['id','name','assigned_user_id','created_by',_0x1aae('0x57'),_0x1aae('0x58'),_0x1aae('0x59'),'duration_minutes',_0x1aae('0x5a'),_0x1aae('0x5b'),_0x1aae('0x5c'),_0x1aae('0x5d')];return db[_0x1aae('0x44')][_0x1aae('0x4a')]({'where':{'id':_0x519ab2[_0x1aae('0x42')]['id']},'attributes':['id','username','password',_0x1aae('0x5e')]})['then'](handleEntityNotFound(_0x28aa81,null))[_0x1aae('0x25')](function(_0x324a85){if(_0x324a85){_0x3729cd=_0x324a85[_0x1aae('0x5e')];var _0x4cfed2=_0x3729cd[_0x1aae('0x5f')](-0x1);if(_0x4cfed2==='/'){_0x3729cd=_0x3729cd['substring'](0x0,_0x3729cd[_0x1aae('0x60')](_0x4cfed2));}return rp({'method':_0x1aae('0x61'),'uri':util[_0x1aae('0x62')](_0x1aae('0x63'),_0x3729cd,'/service/v4_1/rest.php'),'json':!![],'form':{'method':_0x1aae('0x64'),'input_type':'JSON','response_type':_0x1aae('0x65'),'rest_data':JSON[_0x1aae('0x66')]({'user_auth':{'user_name':_0x324a85['username'],'password':_0x324a85[_0x1aae('0x67')],'encryption':_0x1aae('0x68')},'application':'xCALLY\x20Motion\x20Integration'})}});}})['then'](function(_0x23a828){if(_0x23a828&&_0x23a828[_0x1aae('0x2a')]!==_0x1aae('0x69')&&_0x23a828[_0x1aae('0x2a')]!==_0x1aae('0x6a')){return rp({'method':_0x1aae('0x61'),'uri':util[_0x1aae('0x62')]('%s%s',_0x3729cd,_0x1aae('0x6b')),'json':!![],'form':{'method':_0x1aae('0x6c'),'input_type':_0x1aae('0x65'),'response_type':_0x1aae('0x65'),'rest_data':JSON[_0x1aae('0x66')]({'session':_0x23a828['id'],'module_name':_0x1aae('0x6d')})}})[_0x1aae('0x25')](function(_0x58dc42){if(_0x58dc42){var _0x33e2f6=_[_0x1aae('0x6e')](_0x58dc42[_0x1aae('0x6f')]);_[_0x1aae('0x70')](_0x33e2f6,function(_0x270663){return _0xa42553[_0x1aae('0x71')](_0x270663[_0x1aae('0x2a')]);});return{'count':_0x33e2f6[_0x1aae('0x43')],'rows':_[_0x1aae('0x2d')](_0x33e2f6,function(_0x4344aa){return{'id':_0x4344aa['name'],'name':_0x4344aa[_0x1aae('0x72')],'custom':_[_0x1aae('0x73')](_0x4344aa['name'],'_c')?!![]:![],'options':_0x4344aa[_0x1aae('0x3d')]?_[_0x1aae('0x2d')](_[_0x1aae('0x6e')](_0x4344aa['options']),function(_0x25f71d){return{'name':_0x25f71d[_0x1aae('0x74')],'value':_0x25f71d[_0x1aae('0x2a')]};}):[]};})};}})[_0x1aae('0x25')](respondWithResult(_0x28aa81,null))[_0x1aae('0x45')](function(_0x517dd4){var _0x4be488=_0x519ab2[_0x1aae('0x33')][_0x1aae('0x75')]?0x1f4:_0x517dd4[_0x1aae('0x76')]||0x1f4;logger[_0x1aae('0x28')](_0x1aae('0x77'),'getFields',_0x4be488,JSON['stringify'](_0x517dd4));delete _0x517dd4[_0x1aae('0x2a')];if(_0x4be488===0x191){_0x4be488=0x190;}_0x28aa81['status'](_0x4be488)[_0x1aae('0x2b')](_0x519ab2['query'][_0x1aae('0x75')]?{'message':_0x1aae('0x78'),'statusCode':_0x517dd4['statusCode']}:_0x517dd4);});}else{var _0x4cab14=0x1f4;_0x28aa81['status'](_0x4cab14)[_0x1aae('0x2b')]({'message':_0x1aae('0x78'),'statusCode':0x190});}});}; \ No newline at end of file +var _0x34eb=['value','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','moment','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','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','offset','undefined','count','limit','set','Content-Range','json','apply','reject','save','update','destroy','then','end','stack','name','send','index','map','type','keys','query','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','SugarcrmAccount','findAll','rows','catch','params','rawAttributes','find','create','body','getConfigurations','findOne','SugarcrmConfiguration','order','pick','addConfiguration','AccountId','getSubjects','channel','Descriptions','getDescriptions','Subjects','SugarcrmField','assigned_user_id','created_by','description','date_start','duration_minutes','parent_id','parent_type','direction','username','password','remoteUri','slice','substring','lastIndexOf','format','/service/v4_1/rest.php','login','JSON','stringify','PLAIN','xCALLY\x20Motion\x20Integration','Invalid\x20Login','Password\x20Expired','POST','%s%s','get_module_fields','Calls','values','module_fields','remove','includes','label','endsWith'];(function(_0x1df341,_0x19aa3c){var _0x210a6f=function(_0x353178){while(--_0x353178){_0x1df341['push'](_0x1df341['shift']());}};_0x210a6f(++_0x19aa3c);}(_0x34eb,0x180));var _0xb34e=function(_0x46f03f,_0x1430cf){_0x46f03f=_0x46f03f-0x0;var _0x4b7395=_0x34eb[_0x46f03f];return _0x4b7395;};'use strict';var emlformat=require(_0xb34e('0x0'));var rimraf=require(_0xb34e('0x1'));var zipdir=require(_0xb34e('0x2'));var jsonpatch=require(_0xb34e('0x3'));var rp=require('request-promise');var moment=require(_0xb34e('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xb34e('0x5'));var util=require(_0xb34e('0x6'));var path=require(_0xb34e('0x7'));var sox=require(_0xb34e('0x8'));var csv=require(_0xb34e('0x9'));var ejs=require(_0xb34e('0xa'));var fs=require('fs');var fs_extra=require(_0xb34e('0xb'));var _=require('lodash');var squel=require(_0xb34e('0xc'));var crypto=require(_0xb34e('0xd'));var jsforce=require(_0xb34e('0xe'));var deskjs=require(_0xb34e('0xf'));var toCsv=require(_0xb34e('0x9'));var querystring=require(_0xb34e('0x10'));var Papa=require(_0xb34e('0x11'));var Redis=require(_0xb34e('0x12'));var authService=require(_0xb34e('0x13'));var qs=require(_0xb34e('0x14'));var as=require(_0xb34e('0x15'));var hardwareService=require(_0xb34e('0x16'));var logger=require(_0xb34e('0x17'))('api');var utils=require(_0xb34e('0x18'));var config=require(_0xb34e('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0xb34e('0x1a'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x321a36,_0x2d18eb){_0x2d18eb=_0x2d18eb||0xcc;return function(_0x414c5c){if(_0x414c5c){return _0x321a36[_0xb34e('0x1b')](_0x2d18eb);}return _0x321a36[_0xb34e('0x1c')](_0x2d18eb)['end']();};}function respondWithResult(_0x58b58c,_0x1b1753){_0x1b1753=_0x1b1753||0xc8;return function(_0x43eacd){if(_0x43eacd){return _0x58b58c[_0xb34e('0x1c')](_0x1b1753)['json'](_0x43eacd);}};}function respondWithFilteredResult(_0x412edd,_0x5dd172){return function(_0x81967c){if(_0x81967c){var _0x2ea1f9=typeof _0x5dd172[_0xb34e('0x1d')]===_0xb34e('0x1e')&&typeof _0x5dd172['limit']===_0xb34e('0x1e');var _0x48fad6=_0x81967c[_0xb34e('0x1f')];var _0x11a0c2=_0x2ea1f9?0x0:_0x5dd172[_0xb34e('0x1d')];var _0x2d88e4=_0x2ea1f9?_0x81967c[_0xb34e('0x1f')]:_0x5dd172[_0xb34e('0x1d')]+_0x5dd172[_0xb34e('0x20')];var _0x2d29d0;if(_0x2d88e4>=_0x48fad6){_0x2d88e4=_0x48fad6;_0x2d29d0=0xc8;}else{_0x2d29d0=0xce;}_0x412edd[_0xb34e('0x1c')](_0x2d29d0);return _0x412edd[_0xb34e('0x21')](_0xb34e('0x22'),_0x11a0c2+'-'+_0x2d88e4+'/'+_0x48fad6)[_0xb34e('0x23')](_0x81967c);}return null;};}function patchUpdates(_0x1ec468){return function(_0x39f889){try{jsonpatch[_0xb34e('0x24')](_0x39f889,_0x1ec468,!![]);}catch(_0x129915){return BPromise[_0xb34e('0x25')](_0x129915);}return _0x39f889[_0xb34e('0x26')]();};}function saveUpdates(_0x3db1d4,_0x264c0f){return function(_0x328e23){if(_0x328e23){return _0x328e23[_0xb34e('0x27')](_0x3db1d4)['then'](function(_0x101de2){return _0x101de2;});}return null;};}function removeEntity(_0x1151c1,_0x130579){return function(_0x3219c4){if(_0x3219c4){return _0x3219c4[_0xb34e('0x28')]()[_0xb34e('0x29')](function(){_0x1151c1[_0xb34e('0x1c')](0xcc)[_0xb34e('0x2a')]();});}};}function handleEntityNotFound(_0x47ce49,_0x1b14c0){return function(_0x5c390e){if(!_0x5c390e){_0x47ce49['sendStatus'](0x194);}return _0x5c390e;};}function handleError(_0x1aee4f,_0x2d2615){_0x2d2615=_0x2d2615||0x1f4;return function(_0xdb89dc){logger['error'](_0xdb89dc[_0xb34e('0x2b')]);if(_0xdb89dc[_0xb34e('0x2c')]){delete _0xdb89dc['name'];}_0x1aee4f['status'](_0x2d2615)[_0xb34e('0x2d')](_0xdb89dc);};}exports[_0xb34e('0x2e')]=function(_0x4bab89,_0x3776c8){var _0x14e87a={},_0x40a5db={},_0xbb4e0a={'count':0x0,'rows':[]};var _0x2a21d9=_[_0xb34e('0x2f')](db['SugarcrmAccount']['rawAttributes'],function(_0x4a2868){return{'name':_0x4a2868['fieldName'],'type':_0x4a2868[_0xb34e('0x30')]['key']};});_0x40a5db['model']=_[_0xb34e('0x2f')](_0x2a21d9,_0xb34e('0x2c'));_0x40a5db['query']=_[_0xb34e('0x31')](_0x4bab89[_0xb34e('0x32')]);_0x40a5db[_0xb34e('0x33')]=_['intersection'](_0x40a5db[_0xb34e('0x34')],_0x40a5db[_0xb34e('0x32')]);_0x14e87a[_0xb34e('0x35')]=_[_0xb34e('0x36')](_0x40a5db[_0xb34e('0x34')],qs[_0xb34e('0x37')](_0x4bab89[_0xb34e('0x32')][_0xb34e('0x37')]));_0x14e87a[_0xb34e('0x35')]=_0x14e87a[_0xb34e('0x35')][_0xb34e('0x38')]?_0x14e87a[_0xb34e('0x35')]:_0x40a5db[_0xb34e('0x34')];if(!_0x4bab89[_0xb34e('0x32')][_0xb34e('0x39')](_0xb34e('0x3a'))){_0x14e87a[_0xb34e('0x20')]=qs['limit'](_0x4bab89['query'][_0xb34e('0x20')]);_0x14e87a[_0xb34e('0x1d')]=qs[_0xb34e('0x1d')](_0x4bab89['query'][_0xb34e('0x1d')]);}_0x14e87a['order']=qs['sort'](_0x4bab89[_0xb34e('0x32')][_0xb34e('0x3b')]);_0x14e87a[_0xb34e('0x3c')]=qs[_0xb34e('0x33')](_['pick'](_0x4bab89[_0xb34e('0x32')],_0x40a5db[_0xb34e('0x33')]),_0x2a21d9);if(_0x4bab89[_0xb34e('0x32')][_0xb34e('0x3d')]){_0x14e87a[_0xb34e('0x3c')]=_[_0xb34e('0x3e')](_0x14e87a['where'],{'$or':_['map'](_0x2a21d9,function(_0x5526bb){if(_0x5526bb['type']!==_0xb34e('0x3f')){var _0x537c10={};_0x537c10[_0x5526bb[_0xb34e('0x2c')]]={'$like':'%'+_0x4bab89[_0xb34e('0x32')][_0xb34e('0x3d')]+'%'};return _0x537c10;}})});}_0x14e87a=_[_0xb34e('0x3e')]({},_0x14e87a,_0x4bab89[_0xb34e('0x40')]);var _0x3a752c={'where':_0x14e87a[_0xb34e('0x3c')]};return db[_0xb34e('0x41')][_0xb34e('0x1f')](_0x3a752c)['then'](function(_0x1db8d3){_0xbb4e0a[_0xb34e('0x1f')]=_0x1db8d3;if(_0x4bab89['query']['includeAll']){_0x14e87a['include']=[{'all':!![]}];}return db[_0xb34e('0x41')][_0xb34e('0x42')](_0x14e87a);})[_0xb34e('0x29')](function(_0x3cceac){_0xbb4e0a[_0xb34e('0x43')]=_0x3cceac;return _0xbb4e0a;})['then'](respondWithFilteredResult(_0x3776c8,_0x14e87a))[_0xb34e('0x44')](handleError(_0x3776c8,null));};exports['show']=function(_0x4a5a56,_0x569133){var _0xd1b24e={'raw':![],'where':{'id':_0x4a5a56[_0xb34e('0x45')]['id']}},_0x323ae0={};_0x323ae0[_0xb34e('0x34')]=_['keys'](db[_0xb34e('0x41')][_0xb34e('0x46')]);_0x323ae0[_0xb34e('0x32')]=_[_0xb34e('0x31')](_0x4a5a56[_0xb34e('0x32')]);_0x323ae0['filters']=_['intersection'](_0x323ae0[_0xb34e('0x34')],_0x323ae0[_0xb34e('0x32')]);_0xd1b24e['attributes']=_[_0xb34e('0x36')](_0x323ae0[_0xb34e('0x34')],qs[_0xb34e('0x37')](_0x4a5a56['query'][_0xb34e('0x37')]));_0xd1b24e[_0xb34e('0x35')]=_0xd1b24e[_0xb34e('0x35')][_0xb34e('0x38')]?_0xd1b24e[_0xb34e('0x35')]:_0x323ae0[_0xb34e('0x34')];if(_0x4a5a56['query']['includeAll']){_0xd1b24e['include']=[{'all':!![]}];}_0xd1b24e=_[_0xb34e('0x3e')]({},_0xd1b24e,_0x4a5a56[_0xb34e('0x40')]);return db[_0xb34e('0x41')][_0xb34e('0x47')](_0xd1b24e)[_0xb34e('0x29')](handleEntityNotFound(_0x569133,null))[_0xb34e('0x29')](respondWithResult(_0x569133,null))['catch'](handleError(_0x569133,null));};exports['create']=function(_0x523373,_0x4a575f){return db[_0xb34e('0x41')][_0xb34e('0x48')](_0x523373[_0xb34e('0x49')],{})[_0xb34e('0x29')](respondWithResult(_0x4a575f,0xc9))[_0xb34e('0x44')](handleError(_0x4a575f,null));};exports['update']=function(_0x11b787,_0x3d016b){if(_0x11b787[_0xb34e('0x49')]['id']){delete _0x11b787[_0xb34e('0x49')]['id'];}return db[_0xb34e('0x41')][_0xb34e('0x47')]({'where':{'id':_0x11b787[_0xb34e('0x45')]['id']}})['then'](handleEntityNotFound(_0x3d016b,null))['then'](saveUpdates(_0x11b787[_0xb34e('0x49')],null))[_0xb34e('0x29')](respondWithResult(_0x3d016b,null))['catch'](handleError(_0x3d016b,null));};exports[_0xb34e('0x28')]=function(_0x5a6dda,_0x3bab11){return db[_0xb34e('0x41')]['find']({'where':{'id':_0x5a6dda[_0xb34e('0x45')]['id']}})[_0xb34e('0x29')](handleEntityNotFound(_0x3bab11,null))[_0xb34e('0x29')](removeEntity(_0x3bab11,null))[_0xb34e('0x44')](handleError(_0x3bab11,null));};exports[_0xb34e('0x4a')]=function(_0x17d0ea,_0x5627c9,_0x5368ea){var _0x54c0da={};var _0x1ac29f={};var _0x50ef12;var _0x2549a4;return db[_0xb34e('0x41')][_0xb34e('0x4b')]({'where':{'id':_0x17d0ea['params']['id']}})['then'](handleEntityNotFound(_0x5627c9,null))[_0xb34e('0x29')](function(_0x161509){if(_0x161509){_0x50ef12=_0x161509;_0x1ac29f[_0xb34e('0x34')]=_[_0xb34e('0x31')](db[_0xb34e('0x4c')][_0xb34e('0x46')]);_0x1ac29f[_0xb34e('0x32')]=_[_0xb34e('0x31')](_0x17d0ea[_0xb34e('0x32')]);_0x1ac29f[_0xb34e('0x33')]=_[_0xb34e('0x36')](_0x1ac29f[_0xb34e('0x34')],_0x1ac29f[_0xb34e('0x32')]);_0x54c0da[_0xb34e('0x35')]=_[_0xb34e('0x36')](_0x1ac29f[_0xb34e('0x34')],qs[_0xb34e('0x37')](_0x17d0ea[_0xb34e('0x32')][_0xb34e('0x37')]));_0x54c0da[_0xb34e('0x35')]=_0x54c0da[_0xb34e('0x35')]['length']?_0x54c0da[_0xb34e('0x35')]:_0x1ac29f[_0xb34e('0x34')];_0x54c0da[_0xb34e('0x4d')]=qs[_0xb34e('0x3b')](_0x17d0ea[_0xb34e('0x32')][_0xb34e('0x3b')]);_0x54c0da['where']=qs[_0xb34e('0x33')](_[_0xb34e('0x4e')](_0x17d0ea[_0xb34e('0x32')],_0x1ac29f[_0xb34e('0x33')]));if(_0x17d0ea[_0xb34e('0x32')][_0xb34e('0x3d')]){_0x54c0da[_0xb34e('0x3c')]=_[_0xb34e('0x3e')](_0x54c0da[_0xb34e('0x3c')],{'$or':_['map'](_0x54c0da[_0xb34e('0x35')],function(_0x4d1c80){var _0x4a0853={};_0x4a0853[_0x4d1c80]={'$like':'%'+_0x17d0ea[_0xb34e('0x32')][_0xb34e('0x3d')]+'%'};return _0x4a0853;})});}_0x54c0da=_[_0xb34e('0x3e')]({},_0x54c0da,_0x17d0ea[_0xb34e('0x40')]);return _0x50ef12['getConfigurations'](_0x54c0da);}})[_0xb34e('0x29')](function(_0x2b4f2b){if(_0x2b4f2b){_0x2549a4=_0x2b4f2b[_0xb34e('0x38')];if(!_0x17d0ea['query'][_0xb34e('0x39')]('nolimit')){_0x54c0da[_0xb34e('0x20')]=qs['limit'](_0x17d0ea[_0xb34e('0x32')][_0xb34e('0x20')]);_0x54c0da[_0xb34e('0x1d')]=qs[_0xb34e('0x1d')](_0x17d0ea[_0xb34e('0x32')]['offset']);}return _0x50ef12[_0xb34e('0x4a')](_0x54c0da);}})[_0xb34e('0x29')](function(_0x118bbf){if(_0x118bbf){return _0x118bbf?{'count':_0x2549a4,'rows':_0x118bbf}:null;}})['then'](respondWithResult(_0x5627c9,null))['catch'](handleError(_0x5627c9,null));};exports[_0xb34e('0x4f')]=function(_0x1aaa08,_0x3bb1f4,_0x2d7acf){if(_0x1aaa08[_0xb34e('0x49')]['id']){delete _0x1aaa08[_0xb34e('0x49')]['id'];}return db[_0xb34e('0x41')][_0xb34e('0x4b')]({'where':{'id':_0x1aaa08['params']['id']}})[_0xb34e('0x29')](handleEntityNotFound(_0x3bb1f4,null))[_0xb34e('0x29')](function(_0x40cb43){if(_0x40cb43){_0x1aaa08[_0xb34e('0x49')][_0xb34e('0x50')]=_0x40cb43['id'];_0x1aaa08[_0xb34e('0x49')]['Subjects']=integrations[_0xb34e('0x51')](_0x1aaa08[_0xb34e('0x49')][_0xb34e('0x52')],_0x1aaa08[_0xb34e('0x49')]['type']);_0x1aaa08['body'][_0xb34e('0x53')]=integrations[_0xb34e('0x54')](_0x1aaa08['body'][_0xb34e('0x52')],_0x1aaa08[_0xb34e('0x49')]['type']);return db[_0xb34e('0x4c')][_0xb34e('0x48')](_0x1aaa08[_0xb34e('0x49')],{'include':[{'model':db['SugarcrmField'],'as':_0xb34e('0x55')},{'model':db[_0xb34e('0x56')],'as':_0xb34e('0x53')}]});}return null;})[_0xb34e('0x29')](respondWithResult(_0x3bb1f4,null))['catch'](handleError(_0x3bb1f4,null));};exports['getFields']=function(_0x5e6a2f,_0x5495e8,_0xf19872){var _0x323072='';var _0x35a2fe=['id',_0xb34e('0x2c'),_0xb34e('0x57'),_0xb34e('0x58'),_0xb34e('0x59'),_0xb34e('0x5a'),'duration_hours',_0xb34e('0x5b'),_0xb34e('0x5c'),_0xb34e('0x5d'),'parent_name',_0xb34e('0x5e')];return db[_0xb34e('0x41')][_0xb34e('0x4b')]({'where':{'id':_0x5e6a2f[_0xb34e('0x45')]['id']},'attributes':['id',_0xb34e('0x5f'),_0xb34e('0x60'),_0xb34e('0x61')]})['then'](handleEntityNotFound(_0x5495e8,null))[_0xb34e('0x29')](function(_0x253bfd){if(_0x253bfd){_0x323072=_0x253bfd[_0xb34e('0x61')];var _0x3ca9e7=_0x323072[_0xb34e('0x62')](-0x1);if(_0x3ca9e7==='/'){_0x323072=_0x323072[_0xb34e('0x63')](0x0,_0x323072[_0xb34e('0x64')](_0x3ca9e7));}return rp({'method':'POST','uri':util[_0xb34e('0x65')]('%s%s',_0x323072,_0xb34e('0x66')),'json':!![],'form':{'method':_0xb34e('0x67'),'input_type':_0xb34e('0x68'),'response_type':'JSON','rest_data':JSON[_0xb34e('0x69')]({'user_auth':{'user_name':_0x253bfd[_0xb34e('0x5f')],'password':_0x253bfd[_0xb34e('0x60')],'encryption':_0xb34e('0x6a')},'application':_0xb34e('0x6b')})}});}})[_0xb34e('0x29')](function(_0x446c17){if(_0x446c17&&_0x446c17[_0xb34e('0x2c')]!==_0xb34e('0x6c')&&_0x446c17[_0xb34e('0x2c')]!==_0xb34e('0x6d')){return rp({'method':_0xb34e('0x6e'),'uri':util[_0xb34e('0x65')](_0xb34e('0x6f'),_0x323072,_0xb34e('0x66')),'json':!![],'form':{'method':_0xb34e('0x70'),'input_type':'JSON','response_type':_0xb34e('0x68'),'rest_data':JSON[_0xb34e('0x69')]({'session':_0x446c17['id'],'module_name':_0xb34e('0x71')})}})['then'](function(_0x361b84){if(_0x361b84){var _0x39ace4=_[_0xb34e('0x72')](_0x361b84[_0xb34e('0x73')]);_[_0xb34e('0x74')](_0x39ace4,function(_0x20f395){return _0x35a2fe[_0xb34e('0x75')](_0x20f395['name']);});return{'count':_0x39ace4['length'],'rows':_[_0xb34e('0x2f')](_0x39ace4,function(_0x21002f){return{'id':_0x21002f[_0xb34e('0x2c')],'name':_0x21002f[_0xb34e('0x76')],'custom':_[_0xb34e('0x77')](_0x21002f[_0xb34e('0x2c')],'_c')?!![]:![],'options':_0x21002f[_0xb34e('0x40')]?_[_0xb34e('0x2f')](_[_0xb34e('0x72')](_0x21002f[_0xb34e('0x40')]),function(_0x22b3ae){return{'name':_0x22b3ae[_0xb34e('0x78')],'value':_0x22b3ae['name']};}):[]};})};}})[_0xb34e('0x29')](respondWithResult(_0x5495e8,null))['catch'](function(_0x17728d){var _0x37df75=_0x5e6a2f['query'][_0xb34e('0x79')]?0x1f4:_0x17728d[_0xb34e('0x7a')]||0x1f4;logger['error'](_0xb34e('0x7b'),_0xb34e('0x7c'),_0x37df75,JSON[_0xb34e('0x69')](_0x17728d));delete _0x17728d[_0xb34e('0x2c')];if(_0x37df75===0x191){_0x37df75=0x190;}_0x5495e8['status'](_0x37df75)['send'](_0x5e6a2f[_0xb34e('0x32')][_0xb34e('0x79')]?{'message':_0xb34e('0x7d'),'statusCode':_0x17728d[_0xb34e('0x7a')]}:_0x17728d);});}else{var _0x45cb4a=0x1f4;_0x5495e8[_0xb34e('0x1c')](_0x45cb4a)['send']({'message':_0xb34e('0x7d'),'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 5f744c6..fdda514 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 _0x7162=['api','moment','bluebird','rimraf','exports','util','../../config/logger'];(function(_0xb9108a,_0xaa37f7){var _0x48e9c6=function(_0x3cbc7a){while(--_0x3cbc7a){_0xb9108a['push'](_0xb9108a['shift']());}};_0x48e9c6(++_0xaa37f7);}(_0x7162,0x11d));var _0x2716=function(_0x741b9a,_0x44c670){_0x741b9a=_0x741b9a-0x0;var _0x4bf212=_0x7162[_0x741b9a];return _0x4bf212;};'use strict';var _=require('lodash');var util=require(_0x2716('0x0'));var logger=require(_0x2716('0x1'))(_0x2716('0x2'));var moment=require(_0x2716('0x3'));var BPromise=require(_0x2716('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x2716('0x5'));var config=require('../../config/environment');var attributes=require('./intSugarcrmAccount.attributes');var integrations=require('../../components/integrations/configuration');module[_0x2716('0x6')]=function(_0x103f72,_0x3e1484){return _0x103f72['define']('SugarcrmAccount',attributes,{'tableName':'int_sugarcrm_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf759=['./intSugarcrmAccount.attributes','exports','SugarcrmAccount','int_sugarcrm_accounts','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xf759,0x154));var _0x9f75=function(_0x5391b,_0x455796){_0x5391b=_0x5391b-0x0;var _0x345cf8=_0xf759[_0x5391b];return _0x345cf8;};'use strict';var _=require(_0x9f75('0x0'));var util=require(_0x9f75('0x1'));var logger=require(_0x9f75('0x2'))(_0x9f75('0x3'));var moment=require(_0x9f75('0x4'));var BPromise=require(_0x9f75('0x5'));var rp=require(_0x9f75('0x6'));var fs=require('fs');var path=require(_0x9f75('0x7'));var rimraf=require(_0x9f75('0x8'));var config=require(_0x9f75('0x9'));var attributes=require(_0x9f75('0xa'));var integrations=require('../../components/integrations/configuration');module[_0x9f75('0xb')]=function(_0x58d750,_0x2b91b0){return _0x58d750['define'](_0x9f75('0xc'),attributes,{'tableName':_0x9f75('0xd'),'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 c1e7215..6cf9764 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 _0xa005=['../../config/utils','rpc','../../config/environment','jayson/promise','http','info','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','GetSugarcrmAccount','SugarcrmAccount','findAll','options','raw','where','attributes','limit','include','map','model','then','find','ShowSugarcrmAccount','util','moment','randomstring','ioredis'];(function(_0x1823e2,_0x28f922){var _0x2426a3=function(_0x2089a7){while(--_0x2089a7){_0x1823e2['push'](_0x1823e2['shift']());}};_0x2426a3(++_0x28f922);}(_0xa005,0x167));var _0x5a00=function(_0x31a37b,_0x826249){_0x31a37b=_0x31a37b-0x0;var _0x49ae16=_0xa005[_0x31a37b];return _0x49ae16;};'use strict';var _=require('lodash');var util=require(_0x5a00('0x0'));var moment=require(_0x5a00('0x1'));var BPromise=require('bluebird');var rs=require(_0x5a00('0x2'));var fs=require('fs');var Redis=require(_0x5a00('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x5a00('0x4'));var logger=require('../../config/logger')(_0x5a00('0x5'));var config=require(_0x5a00('0x6'));var jayson=require(_0x5a00('0x7'));var client=jayson['client'][_0x5a00('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x933e8c,_0x5247a9,_0x65556e){return new BPromise(function(_0x55fdbf,_0x149437){return client['request'](_0x933e8c,_0x65556e)['then'](function(_0x44f940){logger[_0x5a00('0x9')](_0x5a00('0xa'),_0x5247a9,_0x5a00('0xb'));logger[_0x5a00('0xc')]('SugarcrmAccount,\x20%s,\x20%s,\x20%s',_0x5247a9,_0x5a00('0xb'),JSON[_0x5a00('0xd')](_0x44f940));if(_0x44f940['error']){if(_0x44f940[_0x5a00('0xe')][_0x5a00('0xf')]===0x1f4){logger[_0x5a00('0xe')](_0x5a00('0xa'),_0x5247a9,_0x44f940[_0x5a00('0xe')][_0x5a00('0x10')]);return _0x149437(_0x44f940[_0x5a00('0xe')][_0x5a00('0x10')]);}logger[_0x5a00('0xe')](_0x5a00('0xa'),_0x5247a9,_0x44f940[_0x5a00('0xe')][_0x5a00('0x10')]);return _0x55fdbf(_0x44f940[_0x5a00('0xe')][_0x5a00('0x10')]);}else{logger[_0x5a00('0x9')]('SugarcrmAccount,\x20%s,\x20%s',_0x5247a9,_0x5a00('0xb'));_0x55fdbf(_0x44f940[_0x5a00('0x11')][_0x5a00('0x10')]);}})[_0x5a00('0x12')](function(_0x15718d){logger[_0x5a00('0xe')](_0x5a00('0xa'),_0x5247a9,_0x15718d);_0x149437(_0x15718d);});});}exports[_0x5a00('0x13')]=function(_0x58cde1){var _0xd498c3=this;return new Promise(function(_0x201d9e,_0x17f6ee){return db[_0x5a00('0x14')][_0x5a00('0x15')]({'raw':_0x58cde1[_0x5a00('0x16')]?_0x58cde1[_0x5a00('0x16')][_0x5a00('0x17')]===undefined?!![]:![]:!![],'where':_0x58cde1[_0x5a00('0x16')]?_0x58cde1[_0x5a00('0x16')][_0x5a00('0x18')]||null:null,'attributes':_0x58cde1[_0x5a00('0x16')]?_0x58cde1[_0x5a00('0x16')][_0x5a00('0x19')]||null:null,'limit':_0x58cde1[_0x5a00('0x16')]?_0x58cde1[_0x5a00('0x16')][_0x5a00('0x1a')]||null:null,'include':_0x58cde1[_0x5a00('0x16')]?_0x58cde1[_0x5a00('0x16')][_0x5a00('0x1b')]?_['map'](_0x58cde1['options']['include'],function(_0x41eba5){return{'model':db[_0x41eba5['model']],'as':_0x41eba5['as'],'attributes':_0x41eba5[_0x5a00('0x19')],'include':_0x41eba5[_0x5a00('0x1b')]?_[_0x5a00('0x1c')](_0x41eba5[_0x5a00('0x1b')],function(_0x4b9914){return{'model':db[_0x4b9914[_0x5a00('0x1d')]],'as':_0x4b9914['as'],'attributes':_0x4b9914[_0x5a00('0x19')],'include':_0x4b9914[_0x5a00('0x1b')]?_[_0x5a00('0x1c')](_0x4b9914['include'],function(_0x5d1cdd){return{'model':db[_0x5d1cdd[_0x5a00('0x1d')]],'as':_0x5d1cdd['as'],'attributes':_0x5d1cdd[_0x5a00('0x19')]};}):[]};}):[]};}):[]:[]})[_0x5a00('0x1e')](function(_0x2c648d){logger[_0x5a00('0x9')](_0x5a00('0x13'),_0x58cde1);logger[_0x5a00('0xc')](_0x5a00('0x13'),_0x58cde1,JSON[_0x5a00('0xd')](_0x2c648d));_0x201d9e(_0x2c648d);})[_0x5a00('0x12')](function(_0x30c849){logger[_0x5a00('0xe')]('GetSugarcrmAccount',_0x30c849['message'],_0x58cde1);_0x17f6ee(_0xd498c3[_0x5a00('0xe')](0x1f4,_0x30c849[_0x5a00('0x10')]));});});};exports['ShowSugarcrmAccount']=function(_0xd8df28){var _0x13c22a=this;return new Promise(function(_0x4458e2,_0x482615){return db[_0x5a00('0x14')][_0x5a00('0x1f')]({'raw':_0xd8df28[_0x5a00('0x16')]?_0xd8df28[_0x5a00('0x16')][_0x5a00('0x17')]===undefined?!![]:![]:!![],'where':_0xd8df28[_0x5a00('0x16')]?_0xd8df28[_0x5a00('0x16')][_0x5a00('0x18')]||null:null,'attributes':_0xd8df28[_0x5a00('0x16')]?_0xd8df28[_0x5a00('0x16')][_0x5a00('0x19')]||null:null,'include':_0xd8df28[_0x5a00('0x16')]?_0xd8df28[_0x5a00('0x16')][_0x5a00('0x1b')]?_[_0x5a00('0x1c')](_0xd8df28[_0x5a00('0x16')][_0x5a00('0x1b')],function(_0x29a7c0){return{'model':db[_0x29a7c0[_0x5a00('0x1d')]],'as':_0x29a7c0['as'],'attributes':_0x29a7c0[_0x5a00('0x19')],'include':_0x29a7c0['include']?_[_0x5a00('0x1c')](_0x29a7c0[_0x5a00('0x1b')],function(_0x375d5a){return{'model':db[_0x375d5a['model']],'as':_0x375d5a['as'],'attributes':_0x375d5a[_0x5a00('0x19')],'include':_0x375d5a['include']?_['map'](_0x375d5a['include'],function(_0x3ee098){return{'model':db[_0x3ee098[_0x5a00('0x1d')]],'as':_0x3ee098['as'],'attributes':_0x3ee098[_0x5a00('0x19')]};}):[]};}):[]};}):[]:[]})[_0x5a00('0x1e')](function(_0x3c1f14){logger[_0x5a00('0x9')](_0x5a00('0x20'),_0xd8df28);logger[_0x5a00('0xc')](_0x5a00('0x20'),_0xd8df28,JSON[_0x5a00('0xd')](_0x3c1f14));_0x4458e2(_0x3c1f14);})['catch'](function(_0x124864){logger[_0x5a00('0xe')](_0x5a00('0x20'),_0x124864['message'],_0xd8df28);_0x482615(_0x13c22a[_0x5a00('0xe')](0x1f4,_0x124864[_0x5a00('0x10')]));});});}; \ No newline at end of file +var _0x3bbd=['../../config/utils','../../config/logger','rpc','jayson/promise','request','then','info','SugarcrmAccount,\x20%s,\x20%s','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','SugarcrmAccount','findAll','raw','options','where','attributes','limit','include','map','model','GetSugarcrmAccount','stringify','ShowSugarcrmAccount','lodash','util','bluebird','ioredis','../../mysqldb'];(function(_0x237868,_0x267e95){var _0x3bc4f6=function(_0x4bed0d){while(--_0x4bed0d){_0x237868['push'](_0x237868['shift']());}};_0x3bc4f6(++_0x267e95);}(_0x3bbd,0xe9));var _0xd3bb=function(_0x507677,_0x162078){_0x507677=_0x507677-0x0;var _0x490d4b=_0x3bbd[_0x507677];return _0x490d4b;};'use strict';var _=require(_0xd3bb('0x0'));var util=require(_0xd3bb('0x1'));var moment=require('moment');var BPromise=require(_0xd3bb('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd3bb('0x3'));var db=require(_0xd3bb('0x4'))['db'];var utils=require(_0xd3bb('0x5'));var logger=require(_0xd3bb('0x6'))(_0xd3bb('0x7'));var config=require('../../config/environment');var jayson=require(_0xd3bb('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0xafd1f3,_0x12c25f,_0x385038){return new BPromise(function(_0x349428,_0x4e1ab5){return client[_0xd3bb('0x9')](_0xafd1f3,_0x385038)[_0xd3bb('0xa')](function(_0x26c25c){logger[_0xd3bb('0xb')](_0xd3bb('0xc'),_0x12c25f,'request\x20sent');logger[_0xd3bb('0xd')](_0xd3bb('0xe'),_0x12c25f,_0xd3bb('0xf'),JSON['stringify'](_0x26c25c));if(_0x26c25c[_0xd3bb('0x10')]){if(_0x26c25c[_0xd3bb('0x10')][_0xd3bb('0x11')]===0x1f4){logger[_0xd3bb('0x10')](_0xd3bb('0xc'),_0x12c25f,_0x26c25c[_0xd3bb('0x10')][_0xd3bb('0x12')]);return _0x4e1ab5(_0x26c25c[_0xd3bb('0x10')][_0xd3bb('0x12')]);}logger[_0xd3bb('0x10')](_0xd3bb('0xc'),_0x12c25f,_0x26c25c['error']['message']);return _0x349428(_0x26c25c[_0xd3bb('0x10')][_0xd3bb('0x12')]);}else{logger[_0xd3bb('0xb')](_0xd3bb('0xc'),_0x12c25f,_0xd3bb('0xf'));_0x349428(_0x26c25c[_0xd3bb('0x13')][_0xd3bb('0x12')]);}})[_0xd3bb('0x14')](function(_0xee549f){logger[_0xd3bb('0x10')](_0xd3bb('0xc'),_0x12c25f,_0xee549f);_0x4e1ab5(_0xee549f);});});}exports['GetSugarcrmAccount']=function(_0x20109e){var _0x49240b=this;return new Promise(function(_0x559eca,_0x377473){return db[_0xd3bb('0x15')][_0xd3bb('0x16')]({'raw':_0x20109e['options']?_0x20109e['options'][_0xd3bb('0x17')]===undefined?!![]:![]:!![],'where':_0x20109e['options']?_0x20109e[_0xd3bb('0x18')][_0xd3bb('0x19')]||null:null,'attributes':_0x20109e[_0xd3bb('0x18')]?_0x20109e[_0xd3bb('0x18')][_0xd3bb('0x1a')]||null:null,'limit':_0x20109e['options']?_0x20109e['options'][_0xd3bb('0x1b')]||null:null,'include':_0x20109e[_0xd3bb('0x18')]?_0x20109e['options'][_0xd3bb('0x1c')]?_[_0xd3bb('0x1d')](_0x20109e['options'][_0xd3bb('0x1c')],function(_0x2a7b0b){return{'model':db[_0x2a7b0b[_0xd3bb('0x1e')]],'as':_0x2a7b0b['as'],'attributes':_0x2a7b0b[_0xd3bb('0x1a')],'include':_0x2a7b0b[_0xd3bb('0x1c')]?_[_0xd3bb('0x1d')](_0x2a7b0b[_0xd3bb('0x1c')],function(_0x111a3d){return{'model':db[_0x111a3d[_0xd3bb('0x1e')]],'as':_0x111a3d['as'],'attributes':_0x111a3d[_0xd3bb('0x1a')],'include':_0x111a3d['include']?_[_0xd3bb('0x1d')](_0x111a3d[_0xd3bb('0x1c')],function(_0x3f91df){return{'model':db[_0x3f91df['model']],'as':_0x3f91df['as'],'attributes':_0x3f91df['attributes']};}):[]};}):[]};}):[]:[]})[_0xd3bb('0xa')](function(_0x19d00d){logger[_0xd3bb('0xb')](_0xd3bb('0x1f'),_0x20109e);logger[_0xd3bb('0xd')](_0xd3bb('0x1f'),_0x20109e,JSON[_0xd3bb('0x20')](_0x19d00d));_0x559eca(_0x19d00d);})[_0xd3bb('0x14')](function(_0x3476f6){logger['error'](_0xd3bb('0x1f'),_0x3476f6[_0xd3bb('0x12')],_0x20109e);_0x377473(_0x49240b['error'](0x1f4,_0x3476f6['message']));});});};exports[_0xd3bb('0x21')]=function(_0x24d1d8){var _0x55269b=this;return new Promise(function(_0x343862,_0xc31217){return db['SugarcrmAccount']['find']({'raw':_0x24d1d8[_0xd3bb('0x18')]?_0x24d1d8[_0xd3bb('0x18')][_0xd3bb('0x17')]===undefined?!![]:![]:!![],'where':_0x24d1d8[_0xd3bb('0x18')]?_0x24d1d8['options'][_0xd3bb('0x19')]||null:null,'attributes':_0x24d1d8[_0xd3bb('0x18')]?_0x24d1d8[_0xd3bb('0x18')]['attributes']||null:null,'include':_0x24d1d8[_0xd3bb('0x18')]?_0x24d1d8['options']['include']?_[_0xd3bb('0x1d')](_0x24d1d8[_0xd3bb('0x18')][_0xd3bb('0x1c')],function(_0x366631){return{'model':db[_0x366631[_0xd3bb('0x1e')]],'as':_0x366631['as'],'attributes':_0x366631[_0xd3bb('0x1a')],'include':_0x366631['include']?_[_0xd3bb('0x1d')](_0x366631['include'],function(_0x14280f){return{'model':db[_0x14280f[_0xd3bb('0x1e')]],'as':_0x14280f['as'],'attributes':_0x14280f[_0xd3bb('0x1a')],'include':_0x14280f[_0xd3bb('0x1c')]?_['map'](_0x14280f[_0xd3bb('0x1c')],function(_0x46ead0){return{'model':db[_0x46ead0[_0xd3bb('0x1e')]],'as':_0x46ead0['as'],'attributes':_0x46ead0[_0xd3bb('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xd3bb('0xa')](function(_0x368369){logger[_0xd3bb('0xb')]('ShowSugarcrmAccount',_0x24d1d8);logger['debug'](_0xd3bb('0x21'),_0x24d1d8,JSON[_0xd3bb('0x20')](_0x368369));_0x343862(_0x368369);})[_0xd3bb('0x14')](function(_0x5bd1ec){logger['error'](_0xd3bb('0x21'),_0x5bd1ec[_0xd3bb('0x12')],_0x24d1d8);_0xc31217(_0x55269b[_0xd3bb('0x10')](0x1f4,_0x5bd1ec['message']));});});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/index.js b/server/api/intSugarcrmConfiguration/index.js index 89b41ff..27eac0b 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 _0x6401=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmConfiguration.controller','get','index','/:id','isAuthenticated','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','update','delete','destroy','exports','multer','connect-timeout'];(function(_0x464b13,_0x41edfe){var _0x383b8f=function(_0x3716ad){while(--_0x3716ad){_0x464b13['push'](_0x464b13['shift']());}};_0x383b8f(++_0x41edfe);}(_0x6401,0xa6));var _0x1640=function(_0xb8ffa6,_0x205e3d){_0xb8ffa6=_0xb8ffa6-0x0;var _0x215b26=_0x6401[_0xb8ffa6];return _0x215b26;};'use strict';var multer=require(_0x1640('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x1640('0x1'));var express=require(_0x1640('0x2'));var router=express[_0x1640('0x3')]();var fs_extra=require(_0x1640('0x4'));var auth=require(_0x1640('0x5'));var interaction=require(_0x1640('0x6'));var config=require(_0x1640('0x7'));var controller=require(_0x1640('0x8'));router[_0x1640('0x9')]('/',auth['isAuthenticated'](),controller[_0x1640('0xa')]);router[_0x1640('0x9')](_0x1640('0xb'),auth[_0x1640('0xc')](),controller['show']);router[_0x1640('0x9')]('/:id/fields',auth['isAuthenticated'](),controller[_0x1640('0xd')]);router[_0x1640('0x9')](_0x1640('0xe'),auth['isAuthenticated'](),controller[_0x1640('0xf')]);router['get'](_0x1640('0x10'),auth[_0x1640('0xc')](),controller[_0x1640('0x11')]);router[_0x1640('0x12')]('/',auth[_0x1640('0xc')](),controller[_0x1640('0x13')]);router['put'](_0x1640('0xb'),auth['isAuthenticated'](),controller[_0x1640('0x14')]);router[_0x1640('0x15')](_0x1640('0xb'),auth['isAuthenticated'](),controller[_0x1640('0x16')]);module[_0x1640('0x17')]=router; \ No newline at end of file +var _0xd82d=['/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','put','update','delete','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show'];(function(_0x2984d0,_0x1a7211){var _0x2885f2=function(_0x42f3da){while(--_0x42f3da){_0x2984d0['push'](_0x2984d0['shift']());}};_0x2885f2(++_0x1a7211);}(_0xd82d,0x1bb));var _0xdd82=function(_0x409c75,_0x20d415){_0x409c75=_0x409c75-0x0;var _0x44d5dd=_0xd82d[_0x409c75];return _0x44d5dd;};'use strict';var multer=require(_0xdd82('0x0'));var util=require('util');var path=require(_0xdd82('0x1'));var timeout=require(_0xdd82('0x2'));var express=require(_0xdd82('0x3'));var router=express['Router']();var fs_extra=require(_0xdd82('0x4'));var auth=require(_0xdd82('0x5'));var interaction=require(_0xdd82('0x6'));var config=require(_0xdd82('0x7'));var controller=require('./intSugarcrmConfiguration.controller');router[_0xdd82('0x8')]('/',auth[_0xdd82('0x9')](),controller[_0xdd82('0xa')]);router['get'](_0xdd82('0xb'),auth[_0xdd82('0x9')](),controller[_0xdd82('0xc')]);router[_0xdd82('0x8')](_0xdd82('0xd'),auth[_0xdd82('0x9')](),controller[_0xdd82('0xe')]);router[_0xdd82('0x8')](_0xdd82('0xf'),auth['isAuthenticated'](),controller[_0xdd82('0x10')]);router[_0xdd82('0x8')](_0xdd82('0x11'),auth[_0xdd82('0x9')](),controller[_0xdd82('0x12')]);router[_0xdd82('0x13')]('/',auth[_0xdd82('0x9')](),controller[_0xdd82('0x14')]);router[_0xdd82('0x15')](_0xdd82('0xb'),auth['isAuthenticated'](),controller[_0xdd82('0x16')]);router[_0xdd82('0x17')](_0xdd82('0xb'),auth[_0xdd82('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js index 496d0e0..12658f0 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 _0x60de=['exports','STRING','sequelize'];(function(_0x11fc9f,_0x239744){var _0x2e5371=function(_0x586393){while(--_0x586393){_0x11fc9f['push'](_0x11fc9f['shift']());}};_0x2e5371(++_0x239744);}(_0x60de,0xf8));var _0xe60d=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x60de[_0x4a9fb1];return _0x348672;};'use strict';var Sequelize=require(_0xe60d('0x0'));module[_0xe60d('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xe60d('0x2')]}}; \ No newline at end of file +var _0x4824=['STRING','exports'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x4824,0xdd));var _0x4482=function(_0xaa026b,_0x197301){_0xaa026b=_0xaa026b-0x0;var _0x17808c=_0x4824[_0xaa026b];return _0x17808c;};'use strict';var Sequelize=require('sequelize');module[_0x4482('0x0')]={'name':{'type':Sequelize[_0x4482('0x1')]},'description':{'type':Sequelize[_0x4482('0x1')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js index ea06702..f0c0ef6 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 _0x61ed=['util','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','error','name','send','index','map','SugarcrmConfiguration','rawAttributes','fieldName','type','key','model','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','rows','create','body','catch','find','params','getFields','findOne','SugarcrmField','options','getSubjects','pick','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x61ed,0xee));var _0xd61e=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x61ed[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require(_0xd61e('0x0'));var rimraf=require(_0xd61e('0x1'));var zipdir=require(_0xd61e('0x2'));var jsonpatch=require(_0xd61e('0x3'));var rp=require(_0xd61e('0x4'));var moment=require(_0xd61e('0x5'));var BPromise=require(_0xd61e('0x6'));var Mustache=require(_0xd61e('0x7'));var util=require(_0xd61e('0x8'));var path=require('path');var sox=require(_0xd61e('0x9'));var csv=require(_0xd61e('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd61e('0xb'));var _=require(_0xd61e('0xc'));var squel=require(_0xd61e('0xd'));var crypto=require(_0xd61e('0xe'));var jsforce=require(_0xd61e('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xd61e('0xa'));var querystring=require('querystring');var Papa=require(_0xd61e('0x10'));var Redis=require(_0xd61e('0x11'));var authService=require(_0xd61e('0x12'));var qs=require(_0xd61e('0x13'));var as=require(_0xd61e('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd61e('0x15'))(_0xd61e('0x16'));var utils=require(_0xd61e('0x17'));var config=require(_0xd61e('0x18'));var licenseUtil=require(_0xd61e('0x19'));var db=require(_0xd61e('0x1a'))['db'];function respondWithStatusCode(_0x450e08,_0x1d23a6){_0x1d23a6=_0x1d23a6||0xcc;return function(_0x3f6821){if(_0x3f6821){return _0x450e08[_0xd61e('0x1b')](_0x1d23a6);}return _0x450e08[_0xd61e('0x1c')](_0x1d23a6)[_0xd61e('0x1d')]();};}function respondWithResult(_0x299119,_0x478288){_0x478288=_0x478288||0xc8;return function(_0x2e4058){if(_0x2e4058){return _0x299119[_0xd61e('0x1c')](_0x478288)[_0xd61e('0x1e')](_0x2e4058);}};}function respondWithFilteredResult(_0x2be147,_0x562a8b){return function(_0x41c79a){if(_0x41c79a){var _0x3ab885=typeof _0x562a8b['offset']===_0xd61e('0x1f')&&typeof _0x562a8b[_0xd61e('0x20')]==='undefined';var _0x205f1=_0x41c79a[_0xd61e('0x21')];var _0x2c60f4=_0x3ab885?0x0:_0x562a8b[_0xd61e('0x22')];var _0x3c3801=_0x3ab885?_0x41c79a['count']:_0x562a8b[_0xd61e('0x22')]+_0x562a8b['limit'];var _0x4a9c3a;if(_0x3c3801>=_0x205f1){_0x3c3801=_0x205f1;_0x4a9c3a=0xc8;}else{_0x4a9c3a=0xce;}_0x2be147[_0xd61e('0x1c')](_0x4a9c3a);return _0x2be147[_0xd61e('0x23')](_0xd61e('0x24'),_0x2c60f4+'-'+_0x3c3801+'/'+_0x205f1)['json'](_0x41c79a);}return null;};}function patchUpdates(_0x5b74ae){return function(_0x1ab62c){try{jsonpatch[_0xd61e('0x25')](_0x1ab62c,_0x5b74ae,!![]);}catch(_0x679acf){return BPromise[_0xd61e('0x26')](_0x679acf);}return _0x1ab62c[_0xd61e('0x27')]();};}function saveUpdates(_0x499e38,_0x2c790c){return function(_0x34fcd8){if(_0x34fcd8){return _0x34fcd8[_0xd61e('0x28')](_0x499e38)[_0xd61e('0x29')](function(_0x366b99){return _0x366b99;});}return null;};}function removeEntity(_0x867932,_0x4beee3){return function(_0x20fb5f){if(_0x20fb5f){return _0x20fb5f[_0xd61e('0x2a')]()[_0xd61e('0x29')](function(){_0x867932[_0xd61e('0x1c')](0xcc)[_0xd61e('0x1d')]();});}};}function handleEntityNotFound(_0x59700d,_0x4eee29){return function(_0x11281d){if(!_0x11281d){_0x59700d[_0xd61e('0x1b')](0x194);}return _0x11281d;};}function handleError(_0x20ad0f,_0x3dd789){_0x3dd789=_0x3dd789||0x1f4;return function(_0x26b7d){logger[_0xd61e('0x2b')](_0x26b7d['stack']);if(_0x26b7d[_0xd61e('0x2c')]){delete _0x26b7d[_0xd61e('0x2c')];}_0x20ad0f[_0xd61e('0x1c')](_0x3dd789)[_0xd61e('0x2d')](_0x26b7d);};}exports[_0xd61e('0x2e')]=function(_0x32f5bf,_0x635eb7){var _0x5fa4eb={},_0x44b06e={},_0x1865e9={'count':0x0,'rows':[]};var _0x1080e2=_[_0xd61e('0x2f')](db[_0xd61e('0x30')][_0xd61e('0x31')],function(_0x1a68c2){return{'name':_0x1a68c2[_0xd61e('0x32')],'type':_0x1a68c2[_0xd61e('0x33')][_0xd61e('0x34')]};});_0x44b06e[_0xd61e('0x35')]=_['map'](_0x1080e2,_0xd61e('0x2c'));_0x44b06e['query']=_[_0xd61e('0x36')](_0x32f5bf['query']);_0x44b06e[_0xd61e('0x37')]=_[_0xd61e('0x38')](_0x44b06e['model'],_0x44b06e[_0xd61e('0x39')]);_0x5fa4eb[_0xd61e('0x3a')]=_[_0xd61e('0x38')](_0x44b06e[_0xd61e('0x35')],qs[_0xd61e('0x3b')](_0x32f5bf[_0xd61e('0x39')][_0xd61e('0x3b')]));_0x5fa4eb[_0xd61e('0x3a')]=_0x5fa4eb[_0xd61e('0x3a')][_0xd61e('0x3c')]?_0x5fa4eb[_0xd61e('0x3a')]:_0x44b06e[_0xd61e('0x35')];if(!_0x32f5bf[_0xd61e('0x39')][_0xd61e('0x3d')](_0xd61e('0x3e'))){_0x5fa4eb[_0xd61e('0x20')]=qs[_0xd61e('0x20')](_0x32f5bf[_0xd61e('0x39')][_0xd61e('0x20')]);_0x5fa4eb[_0xd61e('0x22')]=qs[_0xd61e('0x22')](_0x32f5bf[_0xd61e('0x39')]['offset']);}_0x5fa4eb[_0xd61e('0x3f')]=qs[_0xd61e('0x40')](_0x32f5bf[_0xd61e('0x39')][_0xd61e('0x40')]);_0x5fa4eb[_0xd61e('0x41')]=qs[_0xd61e('0x37')](_['pick'](_0x32f5bf[_0xd61e('0x39')],_0x44b06e[_0xd61e('0x37')]),_0x1080e2);if(_0x32f5bf['query'][_0xd61e('0x42')]){_0x5fa4eb[_0xd61e('0x41')]=_[_0xd61e('0x43')](_0x5fa4eb[_0xd61e('0x41')],{'$or':_[_0xd61e('0x2f')](_0x1080e2,function(_0x36cb36){if(_0x36cb36[_0xd61e('0x33')]!==_0xd61e('0x44')){var _0xd99ff5={};_0xd99ff5[_0x36cb36[_0xd61e('0x2c')]]={'$like':'%'+_0x32f5bf[_0xd61e('0x39')][_0xd61e('0x42')]+'%'};return _0xd99ff5;}})});}_0x5fa4eb=_[_0xd61e('0x43')]({},_0x5fa4eb,_0x32f5bf['options']);var _0x3ca1f1={'where':_0x5fa4eb[_0xd61e('0x41')]};return db[_0xd61e('0x30')][_0xd61e('0x21')](_0x3ca1f1)['then'](function(_0x1a0933){_0x1865e9[_0xd61e('0x21')]=_0x1a0933;if(_0x32f5bf[_0xd61e('0x39')]['includeAll']){_0x5fa4eb['include']=[{'all':!![]}];}return db[_0xd61e('0x30')]['findAll'](_0x5fa4eb);})[_0xd61e('0x29')](function(_0x80540b){_0x1865e9[_0xd61e('0x45')]=_0x80540b;return _0x1865e9;})['then'](respondWithFilteredResult(_0x635eb7,_0x5fa4eb))['catch'](handleError(_0x635eb7,null));};exports['show']=function(_0x24d671,_0xad0b5d){var _0xfda51f={'raw':![],'where':{'id':_0x24d671['params']['id']}},_0x430db3={};_0x430db3[_0xd61e('0x35')]=_[_0xd61e('0x36')](db[_0xd61e('0x30')][_0xd61e('0x31')]);_0x430db3[_0xd61e('0x39')]=_[_0xd61e('0x36')](_0x24d671[_0xd61e('0x39')]);_0x430db3[_0xd61e('0x37')]=_[_0xd61e('0x38')](_0x430db3['model'],_0x430db3[_0xd61e('0x39')]);_0xfda51f[_0xd61e('0x3a')]=_[_0xd61e('0x38')](_0x430db3[_0xd61e('0x35')],qs['fields'](_0x24d671['query'][_0xd61e('0x3b')]));_0xfda51f[_0xd61e('0x3a')]=_0xfda51f[_0xd61e('0x3a')][_0xd61e('0x3c')]?_0xfda51f[_0xd61e('0x3a')]:_0x430db3[_0xd61e('0x35')];if(_0x24d671['query']['includeAll']){_0xfda51f['include']=[{'all':!![]}];}_0xfda51f=_['merge']({},_0xfda51f,_0x24d671['options']);return db['SugarcrmConfiguration']['find'](_0xfda51f)[_0xd61e('0x29')](handleEntityNotFound(_0xad0b5d,null))[_0xd61e('0x29')](respondWithResult(_0xad0b5d,null))['catch'](handleError(_0xad0b5d,null));};exports['create']=function(_0x5358d9,_0x5457d8){return db[_0xd61e('0x30')][_0xd61e('0x46')](_0x5358d9[_0xd61e('0x47')],{})[_0xd61e('0x29')](respondWithResult(_0x5457d8,0xc9))[_0xd61e('0x48')](handleError(_0x5457d8,null));};exports['update']=function(_0x4ea29f,_0x335238){if(_0x4ea29f[_0xd61e('0x47')]['id']){delete _0x4ea29f['body']['id'];}return db[_0xd61e('0x30')][_0xd61e('0x49')]({'where':{'id':_0x4ea29f[_0xd61e('0x4a')]['id']}})[_0xd61e('0x29')](handleEntityNotFound(_0x335238,null))[_0xd61e('0x29')](saveUpdates(_0x4ea29f['body'],null))[_0xd61e('0x29')](respondWithResult(_0x335238,null))[_0xd61e('0x48')](handleError(_0x335238,null));};exports['destroy']=function(_0x28b370,_0x1cf700){return db[_0xd61e('0x30')][_0xd61e('0x49')]({'where':{'id':_0x28b370[_0xd61e('0x4a')]['id']}})[_0xd61e('0x29')](handleEntityNotFound(_0x1cf700,null))[_0xd61e('0x29')](removeEntity(_0x1cf700,null))[_0xd61e('0x48')](handleError(_0x1cf700,null));};exports[_0xd61e('0x4b')]=function(_0x1ecb1d,_0xf7cdbf,_0xac8afd){var _0x594c44={};var _0x5bde1f={};var _0x45454a;var _0x2bf193;return db[_0xd61e('0x30')][_0xd61e('0x4c')]({'where':{'id':_0x1ecb1d[_0xd61e('0x4a')]['id']}})['then'](handleEntityNotFound(_0xf7cdbf,null))['then'](function(_0x1878fb){if(_0x1878fb){_0x45454a=_0x1878fb;_0x5bde1f[_0xd61e('0x35')]=_[_0xd61e('0x36')](db[_0xd61e('0x4d')]['rawAttributes']);_0x5bde1f[_0xd61e('0x39')]=_['keys'](_0x1ecb1d[_0xd61e('0x39')]);_0x5bde1f[_0xd61e('0x37')]=_[_0xd61e('0x38')](_0x5bde1f[_0xd61e('0x35')],_0x5bde1f[_0xd61e('0x39')]);_0x594c44[_0xd61e('0x3a')]=_[_0xd61e('0x38')](_0x5bde1f[_0xd61e('0x35')],qs['fields'](_0x1ecb1d[_0xd61e('0x39')][_0xd61e('0x3b')]));_0x594c44[_0xd61e('0x3a')]=_0x594c44[_0xd61e('0x3a')][_0xd61e('0x3c')]?_0x594c44[_0xd61e('0x3a')]:_0x5bde1f[_0xd61e('0x35')];_0x594c44[_0xd61e('0x3f')]=qs[_0xd61e('0x40')](_0x1ecb1d[_0xd61e('0x39')][_0xd61e('0x40')]);_0x594c44[_0xd61e('0x41')]=qs[_0xd61e('0x37')](_['pick'](_0x1ecb1d[_0xd61e('0x39')],_0x5bde1f[_0xd61e('0x37')]));if(_0x1ecb1d[_0xd61e('0x39')][_0xd61e('0x42')]){_0x594c44[_0xd61e('0x41')]=_[_0xd61e('0x43')](_0x594c44[_0xd61e('0x41')],{'$or':_['map'](_0x594c44[_0xd61e('0x3a')],function(_0x4c3ca4){var _0x5a9b03={};_0x5a9b03[_0x4c3ca4]={'$like':'%'+_0x1ecb1d['query'][_0xd61e('0x42')]+'%'};return _0x5a9b03;})});}_0x594c44=_['merge']({},_0x594c44,_0x1ecb1d[_0xd61e('0x4e')]);return _0x45454a['getFields'](_0x594c44);}})[_0xd61e('0x29')](function(_0x14ddf1){if(_0x14ddf1){_0x2bf193=_0x14ddf1[_0xd61e('0x3c')];if(!_0x1ecb1d['query'][_0xd61e('0x3d')](_0xd61e('0x3e'))){_0x594c44[_0xd61e('0x20')]=qs[_0xd61e('0x20')](_0x1ecb1d[_0xd61e('0x39')][_0xd61e('0x20')]);_0x594c44[_0xd61e('0x22')]=qs[_0xd61e('0x22')](_0x1ecb1d[_0xd61e('0x39')][_0xd61e('0x22')]);}return _0x45454a[_0xd61e('0x4b')](_0x594c44);}})[_0xd61e('0x29')](function(_0x533f08){if(_0x533f08){return _0x533f08?{'count':_0x2bf193,'rows':_0x533f08}:null;}})[_0xd61e('0x29')](respondWithResult(_0xf7cdbf,null))['catch'](handleError(_0xf7cdbf,null));};exports[_0xd61e('0x4f')]=function(_0x114033,_0x5390b9,_0x249bfe){var _0x12b3ee={};var _0x4529ca={};var _0x4ff49b;var _0x22cb8a;return db[_0xd61e('0x30')][_0xd61e('0x4c')]({'where':{'id':_0x114033['params']['id']}})[_0xd61e('0x29')](handleEntityNotFound(_0x5390b9,null))[_0xd61e('0x29')](function(_0xe46dd){if(_0xe46dd){_0x4ff49b=_0xe46dd;_0x4529ca[_0xd61e('0x35')]=_[_0xd61e('0x36')](db['SugarcrmField'][_0xd61e('0x31')]);_0x4529ca[_0xd61e('0x39')]=_[_0xd61e('0x36')](_0x114033[_0xd61e('0x39')]);_0x4529ca[_0xd61e('0x37')]=_['intersection'](_0x4529ca['model'],_0x4529ca[_0xd61e('0x39')]);_0x12b3ee['attributes']=_['intersection'](_0x4529ca[_0xd61e('0x35')],qs['fields'](_0x114033['query'][_0xd61e('0x3b')]));_0x12b3ee[_0xd61e('0x3a')]=_0x12b3ee[_0xd61e('0x3a')]['length']?_0x12b3ee[_0xd61e('0x3a')]:_0x4529ca[_0xd61e('0x35')];_0x12b3ee[_0xd61e('0x3f')]=qs[_0xd61e('0x40')](_0x114033[_0xd61e('0x39')][_0xd61e('0x40')]);_0x12b3ee[_0xd61e('0x41')]=qs[_0xd61e('0x37')](_[_0xd61e('0x50')](_0x114033[_0xd61e('0x39')],_0x4529ca['filters']));if(_0x114033[_0xd61e('0x39')][_0xd61e('0x42')]){_0x12b3ee['where']=_[_0xd61e('0x43')](_0x12b3ee[_0xd61e('0x41')],{'$or':_[_0xd61e('0x2f')](_0x12b3ee[_0xd61e('0x3a')],function(_0x30f418){var _0x54dba0={};_0x54dba0[_0x30f418]={'$like':'%'+_0x114033[_0xd61e('0x39')][_0xd61e('0x42')]+'%'};return _0x54dba0;})});}_0x12b3ee=_[_0xd61e('0x43')]({},_0x12b3ee,_0x114033[_0xd61e('0x4e')]);return _0x4ff49b[_0xd61e('0x4f')](_0x12b3ee);}})['then'](function(_0xaa0599){if(_0xaa0599){_0x22cb8a=_0xaa0599['length'];if(!_0x114033[_0xd61e('0x39')]['hasOwnProperty'](_0xd61e('0x3e'))){_0x12b3ee[_0xd61e('0x20')]=qs[_0xd61e('0x20')](_0x114033[_0xd61e('0x39')][_0xd61e('0x20')]);_0x12b3ee['offset']=qs['offset'](_0x114033[_0xd61e('0x39')]['offset']);}return _0x4ff49b[_0xd61e('0x4f')](_0x12b3ee);}})['then'](function(_0x1d7449){if(_0x1d7449){return _0x1d7449?{'count':_0x22cb8a,'rows':_0x1d7449}:null;}})[_0xd61e('0x29')](respondWithResult(_0x5390b9,null))['catch'](handleError(_0x5390b9,null));};exports[_0xd61e('0x51')]=function(_0x2e36cd,_0x21062d,_0x3e2362){var _0x28ff07={};var _0x2ecb4b={};var _0x17777e;var _0xaaa3b4;return db['SugarcrmConfiguration'][_0xd61e('0x4c')]({'where':{'id':_0x2e36cd[_0xd61e('0x4a')]['id']}})[_0xd61e('0x29')](handleEntityNotFound(_0x21062d,null))[_0xd61e('0x29')](function(_0x47c82c){if(_0x47c82c){_0x17777e=_0x47c82c;_0x2ecb4b[_0xd61e('0x35')]=_[_0xd61e('0x36')](db[_0xd61e('0x4d')]['rawAttributes']);_0x2ecb4b[_0xd61e('0x39')]=_[_0xd61e('0x36')](_0x2e36cd['query']);_0x2ecb4b[_0xd61e('0x37')]=_[_0xd61e('0x38')](_0x2ecb4b[_0xd61e('0x35')],_0x2ecb4b[_0xd61e('0x39')]);_0x28ff07[_0xd61e('0x3a')]=_[_0xd61e('0x38')](_0x2ecb4b[_0xd61e('0x35')],qs[_0xd61e('0x3b')](_0x2e36cd[_0xd61e('0x39')]['fields']));_0x28ff07[_0xd61e('0x3a')]=_0x28ff07[_0xd61e('0x3a')][_0xd61e('0x3c')]?_0x28ff07['attributes']:_0x2ecb4b[_0xd61e('0x35')];_0x28ff07[_0xd61e('0x3f')]=qs[_0xd61e('0x40')](_0x2e36cd[_0xd61e('0x39')][_0xd61e('0x40')]);_0x28ff07[_0xd61e('0x41')]=qs['filters'](_[_0xd61e('0x50')](_0x2e36cd[_0xd61e('0x39')],_0x2ecb4b[_0xd61e('0x37')]));if(_0x2e36cd[_0xd61e('0x39')][_0xd61e('0x42')]){_0x28ff07[_0xd61e('0x41')]=_[_0xd61e('0x43')](_0x28ff07[_0xd61e('0x41')],{'$or':_[_0xd61e('0x2f')](_0x28ff07[_0xd61e('0x3a')],function(_0x243a03){var _0x1a44d7={};_0x1a44d7[_0x243a03]={'$like':'%'+_0x2e36cd[_0xd61e('0x39')][_0xd61e('0x42')]+'%'};return _0x1a44d7;})});}_0x28ff07=_[_0xd61e('0x43')]({},_0x28ff07,_0x2e36cd[_0xd61e('0x4e')]);return _0x17777e[_0xd61e('0x51')](_0x28ff07);}})['then'](function(_0x5f4178){if(_0x5f4178){_0xaaa3b4=_0x5f4178[_0xd61e('0x3c')];if(!_0x2e36cd[_0xd61e('0x39')][_0xd61e('0x3d')](_0xd61e('0x3e'))){_0x28ff07[_0xd61e('0x20')]=qs[_0xd61e('0x20')](_0x2e36cd[_0xd61e('0x39')][_0xd61e('0x20')]);_0x28ff07[_0xd61e('0x22')]=qs[_0xd61e('0x22')](_0x2e36cd[_0xd61e('0x39')][_0xd61e('0x22')]);}return _0x17777e['getDescriptions'](_0x28ff07);}})[_0xd61e('0x29')](function(_0x49ad2f){if(_0x49ad2f){return _0x49ad2f?{'count':_0xaaa3b4,'rows':_0x49ad2f}:null;}})[_0xd61e('0x29')](respondWithResult(_0x21062d,null))[_0xd61e('0x48')](handleError(_0x21062d,null));}; \ No newline at end of file +var _0xec24=['sort','pick','filters','where','VIRTUAL','name','merge','options','SugarcrmConfiguration','includeAll','include','findAll','rows','params','rawAttributes','catch','create','body','find','findOne','filter','getFields','nolimit','getSubjects','SugarcrmField','getDescriptions','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','save','update','then','destroy','error','stack','send','index','map','fieldName','type','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','order'];(function(_0x2ad332,_0xa1fcee){var _0x567946=function(_0x29dab2){while(--_0x29dab2){_0x2ad332['push'](_0x2ad332['shift']());}};_0x567946(++_0xa1fcee);}(_0xec24,0x69));var _0x4ec2=function(_0x270020,_0x4e4f95){_0x270020=_0x270020-0x0;var _0x367a79=_0xec24[_0x270020];return _0x367a79;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x4ec2('0x0'));var zipdir=require(_0x4ec2('0x1'));var jsonpatch=require(_0x4ec2('0x2'));var rp=require(_0x4ec2('0x3'));var moment=require('moment');var BPromise=require(_0x4ec2('0x4'));var Mustache=require(_0x4ec2('0x5'));var util=require('util');var path=require(_0x4ec2('0x6'));var sox=require(_0x4ec2('0x7'));var csv=require('to-csv');var ejs=require(_0x4ec2('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4ec2('0x9'));var squel=require(_0x4ec2('0xa'));var crypto=require(_0x4ec2('0xb'));var jsforce=require(_0x4ec2('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x4ec2('0xd'));var Papa=require(_0x4ec2('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x4ec2('0xf'));var as=require(_0x4ec2('0x10'));var hardwareService=require(_0x4ec2('0x11'));var logger=require(_0x4ec2('0x12'))(_0x4ec2('0x13'));var utils=require(_0x4ec2('0x14'));var config=require(_0x4ec2('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x4ec2('0x16'))['db'];function respondWithStatusCode(_0x1f653b,_0x4a336a){_0x4a336a=_0x4a336a||0xcc;return function(_0x3c6035){if(_0x3c6035){return _0x1f653b[_0x4ec2('0x17')](_0x4a336a);}return _0x1f653b[_0x4ec2('0x18')](_0x4a336a)[_0x4ec2('0x19')]();};}function respondWithResult(_0x2fbbcb,_0x1a9f84){_0x1a9f84=_0x1a9f84||0xc8;return function(_0x4a33fe){if(_0x4a33fe){return _0x2fbbcb['status'](_0x1a9f84)[_0x4ec2('0x1a')](_0x4a33fe);}};}function respondWithFilteredResult(_0x37b578,_0x252923){return function(_0x19bf4f){if(_0x19bf4f){var _0x1f2d33=typeof _0x252923[_0x4ec2('0x1b')]===_0x4ec2('0x1c')&&typeof _0x252923[_0x4ec2('0x1d')]==='undefined';var _0x27f9f8=_0x19bf4f[_0x4ec2('0x1e')];var _0xd54019=_0x1f2d33?0x0:_0x252923[_0x4ec2('0x1b')];var _0x1367da=_0x1f2d33?_0x19bf4f[_0x4ec2('0x1e')]:_0x252923[_0x4ec2('0x1b')]+_0x252923[_0x4ec2('0x1d')];var _0x77f955;if(_0x1367da>=_0x27f9f8){_0x1367da=_0x27f9f8;_0x77f955=0xc8;}else{_0x77f955=0xce;}_0x37b578[_0x4ec2('0x18')](_0x77f955);return _0x37b578['set'](_0x4ec2('0x1f'),_0xd54019+'-'+_0x1367da+'/'+_0x27f9f8)[_0x4ec2('0x1a')](_0x19bf4f);}return null;};}function patchUpdates(_0x450109){return function(_0x4264aa){try{jsonpatch[_0x4ec2('0x20')](_0x4264aa,_0x450109,!![]);}catch(_0x2c558e){return BPromise['reject'](_0x2c558e);}return _0x4264aa[_0x4ec2('0x21')]();};}function saveUpdates(_0x107540,_0x59cefe){return function(_0x1765df){if(_0x1765df){return _0x1765df[_0x4ec2('0x22')](_0x107540)[_0x4ec2('0x23')](function(_0x9961ce){return _0x9961ce;});}return null;};}function removeEntity(_0x44f512,_0x164c66){return function(_0x55e9e4){if(_0x55e9e4){return _0x55e9e4[_0x4ec2('0x24')]()[_0x4ec2('0x23')](function(){_0x44f512[_0x4ec2('0x18')](0xcc)[_0x4ec2('0x19')]();});}};}function handleEntityNotFound(_0x42c816,_0x280aab){return function(_0x50620d){if(!_0x50620d){_0x42c816[_0x4ec2('0x17')](0x194);}return _0x50620d;};}function handleError(_0x542e7,_0x5c0111){_0x5c0111=_0x5c0111||0x1f4;return function(_0x3be655){logger[_0x4ec2('0x25')](_0x3be655[_0x4ec2('0x26')]);if(_0x3be655['name']){delete _0x3be655['name'];}_0x542e7['status'](_0x5c0111)[_0x4ec2('0x27')](_0x3be655);};}exports[_0x4ec2('0x28')]=function(_0xb49ca4,_0x178b9b){var _0x10050e={},_0x4a8ed9={},_0x2ee8d3={'count':0x0,'rows':[]};var _0x3acb93=_[_0x4ec2('0x29')](db['SugarcrmConfiguration']['rawAttributes'],function(_0x2a4c0d){return{'name':_0x2a4c0d[_0x4ec2('0x2a')],'type':_0x2a4c0d[_0x4ec2('0x2b')]['key']};});_0x4a8ed9[_0x4ec2('0x2c')]=_[_0x4ec2('0x29')](_0x3acb93,'name');_0x4a8ed9[_0x4ec2('0x2d')]=_[_0x4ec2('0x2e')](_0xb49ca4['query']);_0x4a8ed9['filters']=_[_0x4ec2('0x2f')](_0x4a8ed9[_0x4ec2('0x2c')],_0x4a8ed9[_0x4ec2('0x2d')]);_0x10050e[_0x4ec2('0x30')]=_[_0x4ec2('0x2f')](_0x4a8ed9[_0x4ec2('0x2c')],qs[_0x4ec2('0x31')](_0xb49ca4['query']['fields']));_0x10050e[_0x4ec2('0x30')]=_0x10050e['attributes'][_0x4ec2('0x32')]?_0x10050e['attributes']:_0x4a8ed9[_0x4ec2('0x2c')];if(!_0xb49ca4[_0x4ec2('0x2d')][_0x4ec2('0x33')]('nolimit')){_0x10050e[_0x4ec2('0x1d')]=qs['limit'](_0xb49ca4[_0x4ec2('0x2d')][_0x4ec2('0x1d')]);_0x10050e[_0x4ec2('0x1b')]=qs[_0x4ec2('0x1b')](_0xb49ca4[_0x4ec2('0x2d')][_0x4ec2('0x1b')]);}_0x10050e[_0x4ec2('0x34')]=qs[_0x4ec2('0x35')](_0xb49ca4[_0x4ec2('0x2d')]['sort']);_0x10050e['where']=qs['filters'](_[_0x4ec2('0x36')](_0xb49ca4['query'],_0x4a8ed9[_0x4ec2('0x37')]),_0x3acb93);if(_0xb49ca4['query']['filter']){_0x10050e[_0x4ec2('0x38')]=_['merge'](_0x10050e[_0x4ec2('0x38')],{'$or':_['map'](_0x3acb93,function(_0x4d0c44){if(_0x4d0c44[_0x4ec2('0x2b')]!==_0x4ec2('0x39')){var _0x6e4e53={};_0x6e4e53[_0x4d0c44[_0x4ec2('0x3a')]]={'$like':'%'+_0xb49ca4[_0x4ec2('0x2d')]['filter']+'%'};return _0x6e4e53;}})});}_0x10050e=_[_0x4ec2('0x3b')]({},_0x10050e,_0xb49ca4[_0x4ec2('0x3c')]);var _0x3becc4={'where':_0x10050e[_0x4ec2('0x38')]};return db[_0x4ec2('0x3d')][_0x4ec2('0x1e')](_0x3becc4)[_0x4ec2('0x23')](function(_0x3ae823){_0x2ee8d3[_0x4ec2('0x1e')]=_0x3ae823;if(_0xb49ca4[_0x4ec2('0x2d')][_0x4ec2('0x3e')]){_0x10050e[_0x4ec2('0x3f')]=[{'all':!![]}];}return db['SugarcrmConfiguration'][_0x4ec2('0x40')](_0x10050e);})[_0x4ec2('0x23')](function(_0x2e2be0){_0x2ee8d3[_0x4ec2('0x41')]=_0x2e2be0;return _0x2ee8d3;})[_0x4ec2('0x23')](respondWithFilteredResult(_0x178b9b,_0x10050e))['catch'](handleError(_0x178b9b,null));};exports['show']=function(_0x35dcb1,_0x176655){var _0x1d5418={'raw':![],'where':{'id':_0x35dcb1[_0x4ec2('0x42')]['id']}},_0xbd5b99={};_0xbd5b99['model']=_[_0x4ec2('0x2e')](db[_0x4ec2('0x3d')][_0x4ec2('0x43')]);_0xbd5b99[_0x4ec2('0x2d')]=_[_0x4ec2('0x2e')](_0x35dcb1[_0x4ec2('0x2d')]);_0xbd5b99[_0x4ec2('0x37')]=_[_0x4ec2('0x2f')](_0xbd5b99[_0x4ec2('0x2c')],_0xbd5b99['query']);_0x1d5418[_0x4ec2('0x30')]=_[_0x4ec2('0x2f')](_0xbd5b99[_0x4ec2('0x2c')],qs[_0x4ec2('0x31')](_0x35dcb1[_0x4ec2('0x2d')][_0x4ec2('0x31')]));_0x1d5418[_0x4ec2('0x30')]=_0x1d5418['attributes']['length']?_0x1d5418[_0x4ec2('0x30')]:_0xbd5b99[_0x4ec2('0x2c')];if(_0x35dcb1['query']['includeAll']){_0x1d5418['include']=[{'all':!![]}];}_0x1d5418=_['merge']({},_0x1d5418,_0x35dcb1[_0x4ec2('0x3c')]);return db[_0x4ec2('0x3d')]['find'](_0x1d5418)['then'](handleEntityNotFound(_0x176655,null))['then'](respondWithResult(_0x176655,null))[_0x4ec2('0x44')](handleError(_0x176655,null));};exports[_0x4ec2('0x45')]=function(_0x301bda,_0xf9abe7){return db[_0x4ec2('0x3d')][_0x4ec2('0x45')](_0x301bda[_0x4ec2('0x46')],{})[_0x4ec2('0x23')](respondWithResult(_0xf9abe7,0xc9))[_0x4ec2('0x44')](handleError(_0xf9abe7,null));};exports[_0x4ec2('0x22')]=function(_0x4552e7,_0x2f291a){if(_0x4552e7[_0x4ec2('0x46')]['id']){delete _0x4552e7[_0x4ec2('0x46')]['id'];}return db['SugarcrmConfiguration'][_0x4ec2('0x47')]({'where':{'id':_0x4552e7[_0x4ec2('0x42')]['id']}})[_0x4ec2('0x23')](handleEntityNotFound(_0x2f291a,null))[_0x4ec2('0x23')](saveUpdates(_0x4552e7[_0x4ec2('0x46')],null))['then'](respondWithResult(_0x2f291a,null))['catch'](handleError(_0x2f291a,null));};exports[_0x4ec2('0x24')]=function(_0x1c161c,_0x490cae){return db[_0x4ec2('0x3d')][_0x4ec2('0x47')]({'where':{'id':_0x1c161c[_0x4ec2('0x42')]['id']}})[_0x4ec2('0x23')](handleEntityNotFound(_0x490cae,null))[_0x4ec2('0x23')](removeEntity(_0x490cae,null))[_0x4ec2('0x44')](handleError(_0x490cae,null));};exports['getFields']=function(_0x3173a8,_0x579293,_0x22c9ee){var _0x2b4086={};var _0x2b27a0={};var _0x3879f2;var _0xb1680b;return db[_0x4ec2('0x3d')][_0x4ec2('0x48')]({'where':{'id':_0x3173a8[_0x4ec2('0x42')]['id']}})[_0x4ec2('0x23')](handleEntityNotFound(_0x579293,null))[_0x4ec2('0x23')](function(_0x243acc){if(_0x243acc){_0x3879f2=_0x243acc;_0x2b27a0[_0x4ec2('0x2c')]=_[_0x4ec2('0x2e')](db['SugarcrmField'][_0x4ec2('0x43')]);_0x2b27a0[_0x4ec2('0x2d')]=_[_0x4ec2('0x2e')](_0x3173a8[_0x4ec2('0x2d')]);_0x2b27a0[_0x4ec2('0x37')]=_[_0x4ec2('0x2f')](_0x2b27a0['model'],_0x2b27a0['query']);_0x2b4086[_0x4ec2('0x30')]=_[_0x4ec2('0x2f')](_0x2b27a0['model'],qs[_0x4ec2('0x31')](_0x3173a8['query'][_0x4ec2('0x31')]));_0x2b4086['attributes']=_0x2b4086['attributes'][_0x4ec2('0x32')]?_0x2b4086['attributes']:_0x2b27a0[_0x4ec2('0x2c')];_0x2b4086[_0x4ec2('0x34')]=qs[_0x4ec2('0x35')](_0x3173a8[_0x4ec2('0x2d')][_0x4ec2('0x35')]);_0x2b4086[_0x4ec2('0x38')]=qs[_0x4ec2('0x37')](_[_0x4ec2('0x36')](_0x3173a8[_0x4ec2('0x2d')],_0x2b27a0['filters']));if(_0x3173a8[_0x4ec2('0x2d')][_0x4ec2('0x49')]){_0x2b4086[_0x4ec2('0x38')]=_['merge'](_0x2b4086['where'],{'$or':_['map'](_0x2b4086[_0x4ec2('0x30')],function(_0x1cfed5){var _0x483cf6={};_0x483cf6[_0x1cfed5]={'$like':'%'+_0x3173a8[_0x4ec2('0x2d')]['filter']+'%'};return _0x483cf6;})});}_0x2b4086=_[_0x4ec2('0x3b')]({},_0x2b4086,_0x3173a8[_0x4ec2('0x3c')]);return _0x3879f2[_0x4ec2('0x4a')](_0x2b4086);}})[_0x4ec2('0x23')](function(_0xa316ec){if(_0xa316ec){_0xb1680b=_0xa316ec['length'];if(!_0x3173a8[_0x4ec2('0x2d')][_0x4ec2('0x33')](_0x4ec2('0x4b'))){_0x2b4086[_0x4ec2('0x1d')]=qs[_0x4ec2('0x1d')](_0x3173a8[_0x4ec2('0x2d')][_0x4ec2('0x1d')]);_0x2b4086[_0x4ec2('0x1b')]=qs[_0x4ec2('0x1b')](_0x3173a8[_0x4ec2('0x2d')]['offset']);}return _0x3879f2['getFields'](_0x2b4086);}})[_0x4ec2('0x23')](function(_0x5232ea){if(_0x5232ea){return _0x5232ea?{'count':_0xb1680b,'rows':_0x5232ea}:null;}})[_0x4ec2('0x23')](respondWithResult(_0x579293,null))['catch'](handleError(_0x579293,null));};exports[_0x4ec2('0x4c')]=function(_0x562c9f,_0x377fbc,_0x39f617){var _0x3e2178={};var _0x7485f2={};var _0x1b6939;var _0x469280;return db['SugarcrmConfiguration'][_0x4ec2('0x48')]({'where':{'id':_0x562c9f[_0x4ec2('0x42')]['id']}})[_0x4ec2('0x23')](handleEntityNotFound(_0x377fbc,null))[_0x4ec2('0x23')](function(_0x5d93b4){if(_0x5d93b4){_0x1b6939=_0x5d93b4;_0x7485f2[_0x4ec2('0x2c')]=_['keys'](db[_0x4ec2('0x4d')][_0x4ec2('0x43')]);_0x7485f2['query']=_[_0x4ec2('0x2e')](_0x562c9f[_0x4ec2('0x2d')]);_0x7485f2[_0x4ec2('0x37')]=_['intersection'](_0x7485f2[_0x4ec2('0x2c')],_0x7485f2['query']);_0x3e2178[_0x4ec2('0x30')]=_[_0x4ec2('0x2f')](_0x7485f2[_0x4ec2('0x2c')],qs[_0x4ec2('0x31')](_0x562c9f[_0x4ec2('0x2d')][_0x4ec2('0x31')]));_0x3e2178[_0x4ec2('0x30')]=_0x3e2178['attributes'][_0x4ec2('0x32')]?_0x3e2178['attributes']:_0x7485f2[_0x4ec2('0x2c')];_0x3e2178[_0x4ec2('0x34')]=qs[_0x4ec2('0x35')](_0x562c9f['query'][_0x4ec2('0x35')]);_0x3e2178[_0x4ec2('0x38')]=qs['filters'](_['pick'](_0x562c9f[_0x4ec2('0x2d')],_0x7485f2[_0x4ec2('0x37')]));if(_0x562c9f['query']['filter']){_0x3e2178[_0x4ec2('0x38')]=_['merge'](_0x3e2178[_0x4ec2('0x38')],{'$or':_[_0x4ec2('0x29')](_0x3e2178[_0x4ec2('0x30')],function(_0x2103a6){var _0x4cc6f1={};_0x4cc6f1[_0x2103a6]={'$like':'%'+_0x562c9f['query'][_0x4ec2('0x49')]+'%'};return _0x4cc6f1;})});}_0x3e2178=_['merge']({},_0x3e2178,_0x562c9f[_0x4ec2('0x3c')]);return _0x1b6939[_0x4ec2('0x4c')](_0x3e2178);}})['then'](function(_0x47548c){if(_0x47548c){_0x469280=_0x47548c[_0x4ec2('0x32')];if(!_0x562c9f[_0x4ec2('0x2d')]['hasOwnProperty']('nolimit')){_0x3e2178[_0x4ec2('0x1d')]=qs[_0x4ec2('0x1d')](_0x562c9f[_0x4ec2('0x2d')][_0x4ec2('0x1d')]);_0x3e2178[_0x4ec2('0x1b')]=qs['offset'](_0x562c9f['query'][_0x4ec2('0x1b')]);}return _0x1b6939[_0x4ec2('0x4c')](_0x3e2178);}})[_0x4ec2('0x23')](function(_0x167720){if(_0x167720){return _0x167720?{'count':_0x469280,'rows':_0x167720}:null;}})[_0x4ec2('0x23')](respondWithResult(_0x377fbc,null))[_0x4ec2('0x44')](handleError(_0x377fbc,null));};exports[_0x4ec2('0x4e')]=function(_0x1ce4fc,_0xfc7e87,_0x65d208){var _0x1f3b6a={};var _0x3e5e08={};var _0x5a1a7f;var _0x40ffe2;return db[_0x4ec2('0x3d')][_0x4ec2('0x48')]({'where':{'id':_0x1ce4fc[_0x4ec2('0x42')]['id']}})[_0x4ec2('0x23')](handleEntityNotFound(_0xfc7e87,null))[_0x4ec2('0x23')](function(_0x121e8a){if(_0x121e8a){_0x5a1a7f=_0x121e8a;_0x3e5e08[_0x4ec2('0x2c')]=_['keys'](db['SugarcrmField'][_0x4ec2('0x43')]);_0x3e5e08[_0x4ec2('0x2d')]=_[_0x4ec2('0x2e')](_0x1ce4fc['query']);_0x3e5e08[_0x4ec2('0x37')]=_[_0x4ec2('0x2f')](_0x3e5e08[_0x4ec2('0x2c')],_0x3e5e08['query']);_0x1f3b6a[_0x4ec2('0x30')]=_[_0x4ec2('0x2f')](_0x3e5e08[_0x4ec2('0x2c')],qs['fields'](_0x1ce4fc[_0x4ec2('0x2d')][_0x4ec2('0x31')]));_0x1f3b6a['attributes']=_0x1f3b6a['attributes'][_0x4ec2('0x32')]?_0x1f3b6a['attributes']:_0x3e5e08[_0x4ec2('0x2c')];_0x1f3b6a[_0x4ec2('0x34')]=qs[_0x4ec2('0x35')](_0x1ce4fc[_0x4ec2('0x2d')]['sort']);_0x1f3b6a[_0x4ec2('0x38')]=qs[_0x4ec2('0x37')](_[_0x4ec2('0x36')](_0x1ce4fc[_0x4ec2('0x2d')],_0x3e5e08[_0x4ec2('0x37')]));if(_0x1ce4fc[_0x4ec2('0x2d')]['filter']){_0x1f3b6a['where']=_[_0x4ec2('0x3b')](_0x1f3b6a['where'],{'$or':_[_0x4ec2('0x29')](_0x1f3b6a[_0x4ec2('0x30')],function(_0x23308a){var _0x4c4d9b={};_0x4c4d9b[_0x23308a]={'$like':'%'+_0x1ce4fc['query']['filter']+'%'};return _0x4c4d9b;})});}_0x1f3b6a=_[_0x4ec2('0x3b')]({},_0x1f3b6a,_0x1ce4fc[_0x4ec2('0x3c')]);return _0x5a1a7f[_0x4ec2('0x4e')](_0x1f3b6a);}})['then'](function(_0x5f4f63){if(_0x5f4f63){_0x40ffe2=_0x5f4f63[_0x4ec2('0x32')];if(!_0x1ce4fc[_0x4ec2('0x2d')][_0x4ec2('0x33')](_0x4ec2('0x4b'))){_0x1f3b6a[_0x4ec2('0x1d')]=qs[_0x4ec2('0x1d')](_0x1ce4fc[_0x4ec2('0x2d')][_0x4ec2('0x1d')]);_0x1f3b6a[_0x4ec2('0x1b')]=qs['offset'](_0x1ce4fc[_0x4ec2('0x2d')]['offset']);}return _0x5a1a7f[_0x4ec2('0x4e')](_0x1f3b6a);}})['then'](function(_0x349d17){if(_0x349d17){return _0x349d17?{'count':_0x40ffe2,'rows':_0x349d17}:null;}})[_0x4ec2('0x23')](respondWithResult(_0xfc7e87,null))[_0x4ec2('0x44')](handleError(_0xfc7e87,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js index 2b78c4b..fd78364 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 _0x9761=['moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','SugarcrmConfiguration','int_sugarcrm_configurations','lodash','api'];(function(_0x1aba25,_0x1faed1){var _0x47d997=function(_0x4f9e11){while(--_0x4f9e11){_0x1aba25['push'](_0x1aba25['shift']());}};_0x47d997(++_0x1faed1);}(_0x9761,0x18a));var _0x1976=function(_0x8a9c96,_0x1158ac){_0x8a9c96=_0x8a9c96-0x0;var _0x10fc33=_0x9761[_0x8a9c96];return _0x10fc33;};'use strict';var _=require(_0x1976('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x1976('0x1'));var moment=require(_0x1976('0x2'));var BPromise=require(_0x1976('0x3'));var rp=require(_0x1976('0x4'));var fs=require('fs');var path=require(_0x1976('0x5'));var rimraf=require(_0x1976('0x6'));var config=require(_0x1976('0x7'));var attributes=require('./intSugarcrmConfiguration.attributes');module[_0x1976('0x8')]=function(_0x59b68b,_0x27b8be){return _0x59b68b['define'](_0x1976('0x9'),attributes,{'tableName':_0x1976('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x152b=['exports','define','lodash','util','../../config/logger','moment','rimraf','../../config/environment','./intSugarcrmConfiguration.attributes'];(function(_0x25a851,_0x2849ba){var _0x24e658=function(_0x3e15a4){while(--_0x3e15a4){_0x25a851['push'](_0x25a851['shift']());}};_0x24e658(++_0x2849ba);}(_0x152b,0x92));var _0xb152=function(_0x25248b,_0x3c8491){_0x25248b=_0x25248b-0x0;var _0x509939=_0x152b[_0x25248b];return _0x509939;};'use strict';var _=require(_0xb152('0x0'));var util=require(_0xb152('0x1'));var logger=require(_0xb152('0x2'))('api');var moment=require(_0xb152('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xb152('0x4'));var config=require(_0xb152('0x5'));var attributes=require(_0xb152('0x6'));module[_0xb152('0x7')]=function(_0x1bd8bf,_0x4598e5){return _0x1bd8bf[_0xb152('0x8')]('SugarcrmConfiguration',attributes,{'tableName':'int_sugarcrm_configurations','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 b374e24..7d21c2c 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 _0x8a5b=['request','info','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x8a5b,0xd2));var _0xb8a5=function(_0x2c24b8,_0x168e0b){_0x2c24b8=_0x2c24b8-0x0;var _0x563ed6=_0x8a5b[_0x2c24b8];return _0x563ed6;};'use strict';var _=require(_0xb8a5('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xb8a5('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb8a5('0x2'))['db'];var utils=require(_0xb8a5('0x3'));var logger=require(_0xb8a5('0x4'))(_0xb8a5('0x5'));var config=require(_0xb8a5('0x6'));var jayson=require(_0xb8a5('0x7'));var client=jayson[_0xb8a5('0x8')][_0xb8a5('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2a85c9,_0x1edbec,_0x1a8ea8){return new BPromise(function(_0x44dd7d,_0x53c9a8){return client[_0xb8a5('0xa')](_0x2a85c9,_0x1a8ea8)['then'](function(_0x58c447){logger[_0xb8a5('0xb')](_0xb8a5('0xc'),_0x1edbec,_0xb8a5('0xd'));logger[_0xb8a5('0xe')](_0xb8a5('0xf'),_0x1edbec,_0xb8a5('0xd'),JSON[_0xb8a5('0x10')](_0x58c447));if(_0x58c447[_0xb8a5('0x11')]){if(_0x58c447[_0xb8a5('0x11')][_0xb8a5('0x12')]===0x1f4){logger[_0xb8a5('0x11')](_0xb8a5('0xc'),_0x1edbec,_0x58c447['error'][_0xb8a5('0x13')]);return _0x53c9a8(_0x58c447['error'][_0xb8a5('0x13')]);}logger[_0xb8a5('0x11')](_0xb8a5('0xc'),_0x1edbec,_0x58c447[_0xb8a5('0x11')][_0xb8a5('0x13')]);return _0x44dd7d(_0x58c447[_0xb8a5('0x11')][_0xb8a5('0x13')]);}else{logger[_0xb8a5('0xb')](_0xb8a5('0xc'),_0x1edbec,'request\x20sent');_0x44dd7d(_0x58c447[_0xb8a5('0x14')][_0xb8a5('0x13')]);}})[_0xb8a5('0x15')](function(_0x43e46b){logger['error'](_0xb8a5('0xc'),_0x1edbec,_0x43e46b);_0x53c9a8(_0x43e46b);});});} \ No newline at end of file +var _0xadd1=['then','info','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x5518b4,_0x504994){var _0x177744=function(_0x53aca2){while(--_0x53aca2){_0x5518b4['push'](_0x5518b4['shift']());}};_0x177744(++_0x504994);}(_0xadd1,0x16b));var _0x1add=function(_0x4ec189,_0x1a2f1c){_0x4ec189=_0x4ec189-0x0;var _0x2872e5=_0xadd1[_0x4ec189];return _0x2872e5;};'use strict';var _=require(_0x1add('0x0'));var util=require(_0x1add('0x1'));var moment=require(_0x1add('0x2'));var BPromise=require('bluebird');var rs=require(_0x1add('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1add('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x1add('0x5'))(_0x1add('0x6'));var config=require(_0x1add('0x7'));var jayson=require(_0x1add('0x8'));var client=jayson[_0x1add('0x9')][_0x1add('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3074eb,_0x3644d1,_0x375574){return new BPromise(function(_0x51d6df,_0x43c659){return client['request'](_0x3074eb,_0x375574)[_0x1add('0xb')](function(_0x1a53eb){logger[_0x1add('0xc')](_0x1add('0xd'),_0x3644d1,_0x1add('0xe'));logger[_0x1add('0xf')]('SugarcrmConfiguration,\x20%s,\x20%s,\x20%s',_0x3644d1,'request\x20sent',JSON[_0x1add('0x10')](_0x1a53eb));if(_0x1a53eb[_0x1add('0x11')]){if(_0x1a53eb[_0x1add('0x11')][_0x1add('0x12')]===0x1f4){logger[_0x1add('0x11')](_0x1add('0xd'),_0x3644d1,_0x1a53eb[_0x1add('0x11')][_0x1add('0x13')]);return _0x43c659(_0x1a53eb[_0x1add('0x11')][_0x1add('0x13')]);}logger[_0x1add('0x11')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x3644d1,_0x1a53eb['error'][_0x1add('0x13')]);return _0x51d6df(_0x1a53eb[_0x1add('0x11')]['message']);}else{logger['info']('SugarcrmConfiguration,\x20%s,\x20%s',_0x3644d1,_0x1add('0xe'));_0x51d6df(_0x1a53eb[_0x1add('0x14')][_0x1add('0x13')]);}})[_0x1add('0x15')](function(_0x5c375c){logger[_0x1add('0x11')](_0x1add('0xd'),_0x3644d1,_0x5c375c);_0x43c659(_0x5c375c);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmField/index.js b/server/api/intSugarcrmField/index.js index 77a8ae2..dfff6cc 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 _0xfcf6=['destroy','exports','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmField.controller','get','isAuthenticated','index','/:id','post','create','put','update','delete'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0xfcf6,0xa2));var _0x6fcf=function(_0x1076d0,_0x1d20fc){_0x1076d0=_0x1076d0-0x0;var _0x2d8fb9=_0xfcf6[_0x1076d0];return _0x2d8fb9;};'use strict';var multer=require('multer');var util=require(_0x6fcf('0x0'));var path=require(_0x6fcf('0x1'));var timeout=require(_0x6fcf('0x2'));var express=require('express');var router=express[_0x6fcf('0x3')]();var fs_extra=require(_0x6fcf('0x4'));var auth=require(_0x6fcf('0x5'));var interaction=require(_0x6fcf('0x6'));var config=require(_0x6fcf('0x7'));var controller=require(_0x6fcf('0x8'));router[_0x6fcf('0x9')]('/',auth[_0x6fcf('0xa')](),controller[_0x6fcf('0xb')]);router[_0x6fcf('0x9')](_0x6fcf('0xc'),auth[_0x6fcf('0xa')](),controller['show']);router[_0x6fcf('0xd')]('/',auth[_0x6fcf('0xa')](),controller[_0x6fcf('0xe')]);router[_0x6fcf('0xf')]('/:id',auth[_0x6fcf('0xa')](),controller[_0x6fcf('0x10')]);router[_0x6fcf('0x11')](_0x6fcf('0xc'),auth['isAuthenticated'](),controller[_0x6fcf('0x12')]);module[_0x6fcf('0x13')]=router; \ No newline at end of file +var _0x9233=['destroy','exports','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./intSugarcrmField.controller','get','isAuthenticated','/:id','show','post','create','delete'];(function(_0x107eda,_0x4dbe6e){var _0x5794f2=function(_0x558701){while(--_0x558701){_0x107eda['push'](_0x107eda['shift']());}};_0x5794f2(++_0x4dbe6e);}(_0x9233,0xf2));var _0x3923=function(_0x770f7,_0x3af003){_0x770f7=_0x770f7-0x0;var _0xe797c6=_0x9233[_0x770f7];return _0xe797c6;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3923('0x0'));var timeout=require(_0x3923('0x1'));var express=require(_0x3923('0x2'));var router=express[_0x3923('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x3923('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x3923('0x5'));var controller=require(_0x3923('0x6'));router[_0x3923('0x7')]('/',auth[_0x3923('0x8')](),controller['index']);router['get'](_0x3923('0x9'),auth[_0x3923('0x8')](),controller[_0x3923('0xa')]);router[_0x3923('0xb')]('/',auth[_0x3923('0x8')](),controller[_0x3923('0xc')]);router['put'](_0x3923('0x9'),auth[_0x3923('0x8')](),controller['update']);router[_0x3923('0xd')](_0x3923('0x9'),auth[_0x3923('0x8')](),controller[_0x3923('0xe')]);module[_0x3923('0xf')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.attributes.js b/server/api/intSugarcrmField/intSugarcrmField.attributes.js index 05d9b99..532c615 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 _0xb160=['exports','ENUM','variable','customVariable','picklist','string','STRING','BOOLEAN','sequelize'];(function(_0x44ead6,_0x3dad48){var _0x6b2bb8=function(_0x4de60c){while(--_0x4de60c){_0x44ead6['push'](_0x44ead6['shift']());}};_0x6b2bb8(++_0x3dad48);}(_0xb160,0x170));var _0x0b16=function(_0x12b233,_0x3b0d8b){_0x12b233=_0x12b233-0x0;var _0x33aa67=_0xb160[_0x12b233];return _0x33aa67;};'use strict';var Sequelize=require(_0x0b16('0x0'));module[_0x0b16('0x1')]={'type':{'type':Sequelize[_0x0b16('0x2')]('string',_0x0b16('0x3'),_0x0b16('0x4'),'keyValue',_0x0b16('0x5')),'defaultValue':_0x0b16('0x6')},'content':{'type':Sequelize[_0x0b16('0x7')]},'key':{'type':Sequelize[_0x0b16('0x7')]},'keyType':{'type':Sequelize[_0x0b16('0x2')](_0x0b16('0x6'),_0x0b16('0x3'),_0x0b16('0x4'))},'keyContent':{'type':Sequelize[_0x0b16('0x7')]},'idField':{'type':Sequelize[_0x0b16('0x7')]},'nameField':{'type':Sequelize[_0x0b16('0x7')]},'customField':{'type':Sequelize[_0x0b16('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x0b16('0x7')]}}; \ No newline at end of file +var _0x9023=['STRING','variable','BOOLEAN','exports','ENUM','string','customVariable','picklist'];(function(_0x58f6fd,_0x8e6c3d){var _0x44dce4=function(_0x451ea8){while(--_0x451ea8){_0x58f6fd['push'](_0x58f6fd['shift']());}};_0x44dce4(++_0x8e6c3d);}(_0x9023,0x103));var _0x3902=function(_0x285661,_0x2d7dad){_0x285661=_0x285661-0x0;var _0x5f4017=_0x9023[_0x285661];return _0x5f4017;};'use strict';var Sequelize=require('sequelize');module[_0x3902('0x0')]={'type':{'type':Sequelize[_0x3902('0x1')](_0x3902('0x2'),'variable',_0x3902('0x3'),'keyValue',_0x3902('0x4')),'defaultValue':'string'},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x3902('0x5')]},'keyType':{'type':Sequelize['ENUM'](_0x3902('0x2'),_0x3902('0x6'),_0x3902('0x3'))},'keyContent':{'type':Sequelize[_0x3902('0x5')]},'idField':{'type':Sequelize[_0x3902('0x5')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x3902('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x3902('0x5')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.controller.js b/server/api/intSugarcrmField/intSugarcrmField.controller.js index ae1c5c7..a5d9e29 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 _0x6540=['end','json','undefined','limit','count','offset','set','apply','reject','save','update','destroy','then','error','stack','name','send','map','SugarcrmField','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','filter','merge','options','includeAll','include','findAll','rows','show','params','find','catch','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x6540,0xc7));var _0x0654=function(_0x23fb7a,_0x3ef314){_0x23fb7a=_0x23fb7a-0x0;var _0xe594a5=_0x6540[_0x23fb7a];return _0xe594a5;};'use strict';var emlformat=require(_0x0654('0x0'));var rimraf=require(_0x0654('0x1'));var zipdir=require(_0x0654('0x2'));var jsonpatch=require(_0x0654('0x3'));var rp=require(_0x0654('0x4'));var moment=require(_0x0654('0x5'));var BPromise=require(_0x0654('0x6'));var Mustache=require('mustache');var util=require(_0x0654('0x7'));var path=require('path');var sox=require(_0x0654('0x8'));var csv=require(_0x0654('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0654('0xa'));var _=require(_0x0654('0xb'));var squel=require(_0x0654('0xc'));var crypto=require(_0x0654('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x0654('0xe'));var toCsv=require(_0x0654('0x9'));var querystring=require(_0x0654('0xf'));var Papa=require(_0x0654('0x10'));var Redis=require(_0x0654('0x11'));var authService=require(_0x0654('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x0654('0x13'));var hardwareService=require(_0x0654('0x14'));var logger=require(_0x0654('0x15'))(_0x0654('0x16'));var utils=require(_0x0654('0x17'));var config=require(_0x0654('0x18'));var licenseUtil=require(_0x0654('0x19'));var db=require(_0x0654('0x1a'))['db'];function respondWithStatusCode(_0x3ae013,_0x4d7967){_0x4d7967=_0x4d7967||0xcc;return function(_0x3b0568){if(_0x3b0568){return _0x3ae013[_0x0654('0x1b')](_0x4d7967);}return _0x3ae013[_0x0654('0x1c')](_0x4d7967)[_0x0654('0x1d')]();};}function respondWithResult(_0x5c4f85,_0x3b0233){_0x3b0233=_0x3b0233||0xc8;return function(_0x439ddb){if(_0x439ddb){return _0x5c4f85[_0x0654('0x1c')](_0x3b0233)[_0x0654('0x1e')](_0x439ddb);}};}function respondWithFilteredResult(_0x5a1e55,_0x2bcd46){return function(_0x4e1b91){if(_0x4e1b91){var _0x32d4d2=typeof _0x2bcd46['offset']===_0x0654('0x1f')&&typeof _0x2bcd46[_0x0654('0x20')]==='undefined';var _0x4c41b4=_0x4e1b91[_0x0654('0x21')];var _0x245431=_0x32d4d2?0x0:_0x2bcd46['offset'];var _0x2e7bcb=_0x32d4d2?_0x4e1b91[_0x0654('0x21')]:_0x2bcd46[_0x0654('0x22')]+_0x2bcd46[_0x0654('0x20')];var _0x59f851;if(_0x2e7bcb>=_0x4c41b4){_0x2e7bcb=_0x4c41b4;_0x59f851=0xc8;}else{_0x59f851=0xce;}_0x5a1e55[_0x0654('0x1c')](_0x59f851);return _0x5a1e55[_0x0654('0x23')]('Content-Range',_0x245431+'-'+_0x2e7bcb+'/'+_0x4c41b4)[_0x0654('0x1e')](_0x4e1b91);}return null;};}function patchUpdates(_0x18a9ff){return function(_0x29b92a){try{jsonpatch[_0x0654('0x24')](_0x29b92a,_0x18a9ff,!![]);}catch(_0x34a0b9){return BPromise[_0x0654('0x25')](_0x34a0b9);}return _0x29b92a[_0x0654('0x26')]();};}function saveUpdates(_0x529559,_0x4d8c4f){return function(_0x5e79c5){if(_0x5e79c5){return _0x5e79c5[_0x0654('0x27')](_0x529559)['then'](function(_0x2b853a){return _0x2b853a;});}return null;};}function removeEntity(_0x80b202,_0x1930cc){return function(_0x2c8341){if(_0x2c8341){return _0x2c8341[_0x0654('0x28')]()[_0x0654('0x29')](function(){_0x80b202[_0x0654('0x1c')](0xcc)[_0x0654('0x1d')]();});}};}function handleEntityNotFound(_0x132447,_0x51f37e){return function(_0x4e4905){if(!_0x4e4905){_0x132447[_0x0654('0x1b')](0x194);}return _0x4e4905;};}function handleError(_0x5af05c,_0x4e7e66){_0x4e7e66=_0x4e7e66||0x1f4;return function(_0x248b5e){logger[_0x0654('0x2a')](_0x248b5e[_0x0654('0x2b')]);if(_0x248b5e[_0x0654('0x2c')]){delete _0x248b5e[_0x0654('0x2c')];}_0x5af05c[_0x0654('0x1c')](_0x4e7e66)[_0x0654('0x2d')](_0x248b5e);};}exports['index']=function(_0x2b5e79,_0x2dcb38){var _0x36ecad={},_0x635e67={},_0x2c0155={'count':0x0,'rows':[]};var _0x1871c3=_[_0x0654('0x2e')](db[_0x0654('0x2f')]['rawAttributes'],function(_0x24f770){return{'name':_0x24f770[_0x0654('0x30')],'type':_0x24f770[_0x0654('0x31')][_0x0654('0x32')]};});_0x635e67[_0x0654('0x33')]=_[_0x0654('0x2e')](_0x1871c3,'name');_0x635e67[_0x0654('0x34')]=_[_0x0654('0x35')](_0x2b5e79['query']);_0x635e67['filters']=_[_0x0654('0x36')](_0x635e67['model'],_0x635e67[_0x0654('0x34')]);_0x36ecad[_0x0654('0x37')]=_['intersection'](_0x635e67[_0x0654('0x33')],qs[_0x0654('0x38')](_0x2b5e79[_0x0654('0x34')][_0x0654('0x38')]));_0x36ecad[_0x0654('0x37')]=_0x36ecad[_0x0654('0x37')][_0x0654('0x39')]?_0x36ecad[_0x0654('0x37')]:_0x635e67[_0x0654('0x33')];if(!_0x2b5e79[_0x0654('0x34')][_0x0654('0x3a')](_0x0654('0x3b'))){_0x36ecad[_0x0654('0x20')]=qs[_0x0654('0x20')](_0x2b5e79['query'][_0x0654('0x20')]);_0x36ecad['offset']=qs['offset'](_0x2b5e79[_0x0654('0x34')][_0x0654('0x22')]);}_0x36ecad['order']=qs[_0x0654('0x3c')](_0x2b5e79[_0x0654('0x34')][_0x0654('0x3c')]);_0x36ecad[_0x0654('0x3d')]=qs[_0x0654('0x3e')](_['pick'](_0x2b5e79[_0x0654('0x34')],_0x635e67['filters']),_0x1871c3);if(_0x2b5e79['query'][_0x0654('0x3f')]){_0x36ecad[_0x0654('0x3d')]=_[_0x0654('0x40')](_0x36ecad[_0x0654('0x3d')],{'$or':_[_0x0654('0x2e')](_0x1871c3,function(_0x4eb146){if(_0x4eb146[_0x0654('0x31')]!=='VIRTUAL'){var _0x3bd87f={};_0x3bd87f[_0x4eb146[_0x0654('0x2c')]]={'$like':'%'+_0x2b5e79['query'][_0x0654('0x3f')]+'%'};return _0x3bd87f;}})});}_0x36ecad=_[_0x0654('0x40')]({},_0x36ecad,_0x2b5e79[_0x0654('0x41')]);var _0x33962d={'where':_0x36ecad[_0x0654('0x3d')]};return db[_0x0654('0x2f')][_0x0654('0x21')](_0x33962d)[_0x0654('0x29')](function(_0x5209e3){_0x2c0155[_0x0654('0x21')]=_0x5209e3;if(_0x2b5e79['query'][_0x0654('0x42')]){_0x36ecad[_0x0654('0x43')]=[{'all':!![]}];}return db[_0x0654('0x2f')][_0x0654('0x44')](_0x36ecad);})[_0x0654('0x29')](function(_0x1b0b5b){_0x2c0155[_0x0654('0x45')]=_0x1b0b5b;return _0x2c0155;})[_0x0654('0x29')](respondWithFilteredResult(_0x2dcb38,_0x36ecad))['catch'](handleError(_0x2dcb38,null));};exports[_0x0654('0x46')]=function(_0xd2b2c,_0x486477){var _0x40edb4={'raw':!![],'where':{'id':_0xd2b2c[_0x0654('0x47')]['id']}},_0x37a7cc={};_0x37a7cc[_0x0654('0x33')]=_[_0x0654('0x35')](db[_0x0654('0x2f')]['rawAttributes']);_0x37a7cc[_0x0654('0x34')]=_['keys'](_0xd2b2c['query']);_0x37a7cc['filters']=_[_0x0654('0x36')](_0x37a7cc['model'],_0x37a7cc[_0x0654('0x34')]);_0x40edb4[_0x0654('0x37')]=_['intersection'](_0x37a7cc['model'],qs[_0x0654('0x38')](_0xd2b2c[_0x0654('0x34')][_0x0654('0x38')]));_0x40edb4['attributes']=_0x40edb4['attributes'][_0x0654('0x39')]?_0x40edb4[_0x0654('0x37')]:_0x37a7cc[_0x0654('0x33')];if(_0xd2b2c[_0x0654('0x34')]['includeAll']){_0x40edb4[_0x0654('0x43')]=[{'all':!![]}];}_0x40edb4=_[_0x0654('0x40')]({},_0x40edb4,_0xd2b2c['options']);return db['SugarcrmField'][_0x0654('0x48')](_0x40edb4)[_0x0654('0x29')](handleEntityNotFound(_0x486477,null))[_0x0654('0x29')](respondWithResult(_0x486477,null))[_0x0654('0x49')](handleError(_0x486477,null));};exports[_0x0654('0x4a')]=function(_0x4df830,_0x464631){return db[_0x0654('0x2f')]['create'](_0x4df830['body'],{})[_0x0654('0x29')](respondWithResult(_0x464631,0xc9))['catch'](handleError(_0x464631,null));};exports['update']=function(_0x1d7ca4,_0xc0cf20){if(_0x1d7ca4['body']['id']){delete _0x1d7ca4[_0x0654('0x4b')]['id'];}return db[_0x0654('0x2f')]['find']({'where':{'id':_0x1d7ca4[_0x0654('0x47')]['id']}})[_0x0654('0x29')](handleEntityNotFound(_0xc0cf20,null))['then'](saveUpdates(_0x1d7ca4[_0x0654('0x4b')],null))[_0x0654('0x29')](respondWithResult(_0xc0cf20,null))['catch'](handleError(_0xc0cf20,null));};exports[_0x0654('0x28')]=function(_0x2857ea,_0x221ade){return db[_0x0654('0x2f')]['find']({'where':{'id':_0x2857ea['params']['id']}})[_0x0654('0x29')](handleEntityNotFound(_0x221ade,null))[_0x0654('0x29')](removeEntity(_0x221ade,null))[_0x0654('0x49')](handleError(_0x221ade,null));}; \ No newline at end of file +var _0xb219=['then','sendStatus','error','name','send','index','map','SugarcrmField','fieldName','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','rows','rawAttributes','find','catch','create','body','params','rimraf','request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','status','offset','undefined','limit','count','set','Content-Range','reject','save','update'];(function(_0x3c92b4,_0x48c955){var _0x5bf5a5=function(_0xdc34e7){while(--_0xdc34e7){_0x3c92b4['push'](_0x3c92b4['shift']());}};_0x5bf5a5(++_0x48c955);}(_0xb219,0x6b));var _0x9b21=function(_0x1c3c35,_0x5c49a6){_0x1c3c35=_0x1c3c35-0x0;var _0x1cd8b6=_0xb219[_0x1c3c35];return _0x1cd8b6;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9b21('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x9b21('0x1'));var moment=require(_0x9b21('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x9b21('0x3'));var util=require(_0x9b21('0x4'));var path=require(_0x9b21('0x5'));var sox=require('sox');var csv=require(_0x9b21('0x6'));var ejs=require(_0x9b21('0x7'));var fs=require('fs');var fs_extra=require(_0x9b21('0x8'));var _=require('lodash');var squel=require(_0x9b21('0x9'));var crypto=require(_0x9b21('0xa'));var jsforce=require(_0x9b21('0xb'));var deskjs=require(_0x9b21('0xc'));var toCsv=require('to-csv');var querystring=require(_0x9b21('0xd'));var Papa=require(_0x9b21('0xe'));var Redis=require(_0x9b21('0xf'));var authService=require(_0x9b21('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x9b21('0x11'));var hardwareService=require(_0x9b21('0x12'));var logger=require('../../config/logger')(_0x9b21('0x13'));var utils=require(_0x9b21('0x14'));var config=require(_0x9b21('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x9b21('0x16'))['db'];function respondWithStatusCode(_0x46817a,_0x3f8561){_0x3f8561=_0x3f8561||0xcc;return function(_0x490111){if(_0x490111){return _0x46817a['sendStatus'](_0x3f8561);}return _0x46817a[_0x9b21('0x17')](_0x3f8561)['end']();};}function respondWithResult(_0x4c3305,_0x4c9f90){_0x4c9f90=_0x4c9f90||0xc8;return function(_0x594c48){if(_0x594c48){return _0x4c3305['status'](_0x4c9f90)['json'](_0x594c48);}};}function respondWithFilteredResult(_0x1ff202,_0x46cc62){return function(_0x5ab156){if(_0x5ab156){var _0x337bbc=typeof _0x46cc62[_0x9b21('0x18')]===_0x9b21('0x19')&&typeof _0x46cc62[_0x9b21('0x1a')]===_0x9b21('0x19');var _0x284135=_0x5ab156['count'];var _0x2c9346=_0x337bbc?0x0:_0x46cc62[_0x9b21('0x18')];var _0x235c56=_0x337bbc?_0x5ab156[_0x9b21('0x1b')]:_0x46cc62['offset']+_0x46cc62[_0x9b21('0x1a')];var _0xe16673;if(_0x235c56>=_0x284135){_0x235c56=_0x284135;_0xe16673=0xc8;}else{_0xe16673=0xce;}_0x1ff202[_0x9b21('0x17')](_0xe16673);return _0x1ff202[_0x9b21('0x1c')](_0x9b21('0x1d'),_0x2c9346+'-'+_0x235c56+'/'+_0x284135)['json'](_0x5ab156);}return null;};}function patchUpdates(_0x5ea1c3){return function(_0x393c2f){try{jsonpatch['apply'](_0x393c2f,_0x5ea1c3,!![]);}catch(_0xd20807){return BPromise[_0x9b21('0x1e')](_0xd20807);}return _0x393c2f[_0x9b21('0x1f')]();};}function saveUpdates(_0x23ea5e,_0x465696){return function(_0x259934){if(_0x259934){return _0x259934[_0x9b21('0x20')](_0x23ea5e)[_0x9b21('0x21')](function(_0x580237){return _0x580237;});}return null;};}function removeEntity(_0x42b732,_0x4ddb46){return function(_0x5ecdf0){if(_0x5ecdf0){return _0x5ecdf0['destroy']()[_0x9b21('0x21')](function(){_0x42b732['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2ca8c8,_0x3ef4ce){return function(_0x430ca0){if(!_0x430ca0){_0x2ca8c8[_0x9b21('0x22')](0x194);}return _0x430ca0;};}function handleError(_0x184dbd,_0xfde3ea){_0xfde3ea=_0xfde3ea||0x1f4;return function(_0x4aae69){logger[_0x9b21('0x23')](_0x4aae69['stack']);if(_0x4aae69[_0x9b21('0x24')]){delete _0x4aae69[_0x9b21('0x24')];}_0x184dbd[_0x9b21('0x17')](_0xfde3ea)[_0x9b21('0x25')](_0x4aae69);};}exports[_0x9b21('0x26')]=function(_0x2c8f0a,_0x4c3469){var _0xbd523={},_0x33b08c={},_0xb44363={'count':0x0,'rows':[]};var _0x8c5da=_[_0x9b21('0x27')](db[_0x9b21('0x28')]['rawAttributes'],function(_0x528212){return{'name':_0x528212[_0x9b21('0x29')],'type':_0x528212['type'][_0x9b21('0x2a')]};});_0x33b08c[_0x9b21('0x2b')]=_[_0x9b21('0x27')](_0x8c5da,'name');_0x33b08c['query']=_[_0x9b21('0x2c')](_0x2c8f0a[_0x9b21('0x2d')]);_0x33b08c[_0x9b21('0x2e')]=_[_0x9b21('0x2f')](_0x33b08c[_0x9b21('0x2b')],_0x33b08c[_0x9b21('0x2d')]);_0xbd523[_0x9b21('0x30')]=_['intersection'](_0x33b08c[_0x9b21('0x2b')],qs['fields'](_0x2c8f0a[_0x9b21('0x2d')][_0x9b21('0x31')]));_0xbd523[_0x9b21('0x30')]=_0xbd523['attributes'][_0x9b21('0x32')]?_0xbd523[_0x9b21('0x30')]:_0x33b08c[_0x9b21('0x2b')];if(!_0x2c8f0a[_0x9b21('0x2d')][_0x9b21('0x33')](_0x9b21('0x34'))){_0xbd523[_0x9b21('0x1a')]=qs['limit'](_0x2c8f0a[_0x9b21('0x2d')]['limit']);_0xbd523[_0x9b21('0x18')]=qs[_0x9b21('0x18')](_0x2c8f0a[_0x9b21('0x2d')][_0x9b21('0x18')]);}_0xbd523[_0x9b21('0x35')]=qs[_0x9b21('0x36')](_0x2c8f0a[_0x9b21('0x2d')]['sort']);_0xbd523[_0x9b21('0x37')]=qs[_0x9b21('0x2e')](_[_0x9b21('0x38')](_0x2c8f0a[_0x9b21('0x2d')],_0x33b08c[_0x9b21('0x2e')]),_0x8c5da);if(_0x2c8f0a[_0x9b21('0x2d')]['filter']){_0xbd523['where']=_[_0x9b21('0x39')](_0xbd523['where'],{'$or':_[_0x9b21('0x27')](_0x8c5da,function(_0x38b00a){if(_0x38b00a['type']!==_0x9b21('0x3a')){var _0x388081={};_0x388081[_0x38b00a[_0x9b21('0x24')]]={'$like':'%'+_0x2c8f0a[_0x9b21('0x2d')][_0x9b21('0x3b')]+'%'};return _0x388081;}})});}_0xbd523=_['merge']({},_0xbd523,_0x2c8f0a[_0x9b21('0x3c')]);var _0x8e3bf7={'where':_0xbd523['where']};return db[_0x9b21('0x28')]['count'](_0x8e3bf7)[_0x9b21('0x21')](function(_0x4a15e9){_0xb44363[_0x9b21('0x1b')]=_0x4a15e9;if(_0x2c8f0a[_0x9b21('0x2d')][_0x9b21('0x3d')]){_0xbd523[_0x9b21('0x3e')]=[{'all':!![]}];}return db[_0x9b21('0x28')]['findAll'](_0xbd523);})[_0x9b21('0x21')](function(_0x366bec){_0xb44363[_0x9b21('0x3f')]=_0x366bec;return _0xb44363;})['then'](respondWithFilteredResult(_0x4c3469,_0xbd523))['catch'](handleError(_0x4c3469,null));};exports['show']=function(_0x4c11fd,_0x4cc395){var _0x4b5023={'raw':!![],'where':{'id':_0x4c11fd['params']['id']}},_0x1e5088={};_0x1e5088['model']=_[_0x9b21('0x2c')](db['SugarcrmField'][_0x9b21('0x40')]);_0x1e5088['query']=_['keys'](_0x4c11fd[_0x9b21('0x2d')]);_0x1e5088[_0x9b21('0x2e')]=_[_0x9b21('0x2f')](_0x1e5088[_0x9b21('0x2b')],_0x1e5088[_0x9b21('0x2d')]);_0x4b5023[_0x9b21('0x30')]=_['intersection'](_0x1e5088['model'],qs[_0x9b21('0x31')](_0x4c11fd[_0x9b21('0x2d')][_0x9b21('0x31')]));_0x4b5023[_0x9b21('0x30')]=_0x4b5023[_0x9b21('0x30')][_0x9b21('0x32')]?_0x4b5023['attributes']:_0x1e5088[_0x9b21('0x2b')];if(_0x4c11fd[_0x9b21('0x2d')][_0x9b21('0x3d')]){_0x4b5023[_0x9b21('0x3e')]=[{'all':!![]}];}_0x4b5023=_[_0x9b21('0x39')]({},_0x4b5023,_0x4c11fd[_0x9b21('0x3c')]);return db[_0x9b21('0x28')][_0x9b21('0x41')](_0x4b5023)['then'](handleEntityNotFound(_0x4cc395,null))[_0x9b21('0x21')](respondWithResult(_0x4cc395,null))[_0x9b21('0x42')](handleError(_0x4cc395,null));};exports[_0x9b21('0x43')]=function(_0x19066f,_0x21a921){return db['SugarcrmField']['create'](_0x19066f[_0x9b21('0x44')],{})[_0x9b21('0x21')](respondWithResult(_0x21a921,0xc9))[_0x9b21('0x42')](handleError(_0x21a921,null));};exports[_0x9b21('0x20')]=function(_0x3eb088,_0x20ba8f){if(_0x3eb088[_0x9b21('0x44')]['id']){delete _0x3eb088[_0x9b21('0x44')]['id'];}return db[_0x9b21('0x28')][_0x9b21('0x41')]({'where':{'id':_0x3eb088['params']['id']}})[_0x9b21('0x21')](handleEntityNotFound(_0x20ba8f,null))['then'](saveUpdates(_0x3eb088[_0x9b21('0x44')],null))['then'](respondWithResult(_0x20ba8f,null))[_0x9b21('0x42')](handleError(_0x20ba8f,null));};exports['destroy']=function(_0x20b061,_0x282830){return db['SugarcrmField'][_0x9b21('0x41')]({'where':{'id':_0x20b061[_0x9b21('0x45')]['id']}})['then'](handleEntityNotFound(_0x282830,null))[_0x9b21('0x21')](removeEntity(_0x282830,null))['catch'](handleError(_0x282830,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.model.js b/server/api/intSugarcrmField/intSugarcrmField.model.js index 79af106..8ed8ba1 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 _0x7c38=['request-promise','../../config/environment','./intSugarcrmField.attributes','exports','define','SugarcrmField','int_sugarcrm_fields','idField','../../config/logger','api','moment'];(function(_0x2eec1f,_0x1b9987){var _0x543075=function(_0x5792d2){while(--_0x5792d2){_0x2eec1f['push'](_0x2eec1f['shift']());}};_0x543075(++_0x1b9987);}(_0x7c38,0x1e1));var _0x87c3=function(_0x210054,_0x356d25){_0x210054=_0x210054-0x0;var _0xb35dcb=_0x7c38[_0x210054];return _0xb35dcb;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x87c3('0x0'))(_0x87c3('0x1'));var moment=require(_0x87c3('0x2'));var BPromise=require('bluebird');var rp=require(_0x87c3('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x87c3('0x4'));var attributes=require(_0x87c3('0x5'));module[_0x87c3('0x6')]=function(_0x32ae2e,_0x58d9ed){return _0x32ae2e[_0x87c3('0x7')](_0x87c3('0x8'),attributes,{'tableName':_0x87c3('0x9'),'paranoid':![],'indexes':[{'name':'sugarcrm_unique_index','fields':[_0x87c3('0xa'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x9625=['bluebird','request-promise','path','../../config/environment','./intSugarcrmField.attributes','exports','define','SugarcrmField','sugarcrm_unique_index','FieldId','lodash','util','api','moment'];(function(_0x40e334,_0x35dba4){var _0x13c50f=function(_0xd43a89){while(--_0xd43a89){_0x40e334['push'](_0x40e334['shift']());}};_0x13c50f(++_0x35dba4);}(_0x9625,0xa4));var _0x5962=function(_0x3c942c,_0x271ac3){_0x3c942c=_0x3c942c-0x0;var _0x4a3a05=_0x9625[_0x3c942c];return _0x4a3a05;};'use strict';var _=require(_0x5962('0x0'));var util=require(_0x5962('0x1'));var logger=require('../../config/logger')(_0x5962('0x2'));var moment=require(_0x5962('0x3'));var BPromise=require(_0x5962('0x4'));var rp=require(_0x5962('0x5'));var fs=require('fs');var path=require(_0x5962('0x6'));var rimraf=require('rimraf');var config=require(_0x5962('0x7'));var attributes=require(_0x5962('0x8'));module[_0x5962('0x9')]=function(_0x2fb733,_0x1c0dd3){return _0x2fb733[_0x5962('0xa')](_0x5962('0xb'),attributes,{'tableName':'int_sugarcrm_fields','paranoid':![],'indexes':[{'name':_0x5962('0xc'),'fields':['idField',_0x5962('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.rpc.js b/server/api/intSugarcrmField/intSugarcrmField.rpc.js index 6a0e62d..8c75538 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 _0x157e=['client','request','then','info','SugarcrmField,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x175fb7,_0x154931){var _0x51db29=function(_0x5188d2){while(--_0x5188d2){_0x175fb7['push'](_0x175fb7['shift']());}};_0x51db29(++_0x154931);}(_0x157e,0x1bc));var _0xe157=function(_0x82a071,_0x252266){_0x82a071=_0x82a071-0x0;var _0x15dda9=_0x157e[_0x82a071];return _0x15dda9;};'use strict';var _=require(_0xe157('0x0'));var util=require(_0xe157('0x1'));var moment=require(_0xe157('0x2'));var BPromise=require(_0xe157('0x3'));var rs=require(_0xe157('0x4'));var fs=require('fs');var Redis=require(_0xe157('0x5'));var db=require(_0xe157('0x6'))['db'];var utils=require(_0xe157('0x7'));var logger=require(_0xe157('0x8'))(_0xe157('0x9'));var config=require(_0xe157('0xa'));var jayson=require(_0xe157('0xb'));var client=jayson[_0xe157('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0x199c63,_0x284393,_0x58edeb){return new BPromise(function(_0x20d6bb,_0x4d8049){return client[_0xe157('0xd')](_0x199c63,_0x58edeb)[_0xe157('0xe')](function(_0x487dfa){logger[_0xe157('0xf')](_0xe157('0x10'),_0x284393,_0xe157('0x11'));logger[_0xe157('0x12')]('SugarcrmField,\x20%s,\x20%s,\x20%s',_0x284393,'request\x20sent',JSON[_0xe157('0x13')](_0x487dfa));if(_0x487dfa[_0xe157('0x14')]){if(_0x487dfa[_0xe157('0x14')][_0xe157('0x15')]===0x1f4){logger['error']('SugarcrmField,\x20%s,\x20%s',_0x284393,_0x487dfa[_0xe157('0x14')][_0xe157('0x16')]);return _0x4d8049(_0x487dfa[_0xe157('0x14')][_0xe157('0x16')]);}logger[_0xe157('0x14')](_0xe157('0x10'),_0x284393,_0x487dfa['error']['message']);return _0x20d6bb(_0x487dfa[_0xe157('0x14')][_0xe157('0x16')]);}else{logger[_0xe157('0xf')](_0xe157('0x10'),_0x284393,'request\x20sent');_0x20d6bb(_0x487dfa[_0xe157('0x17')][_0xe157('0x16')]);}})['catch'](function(_0x5eeeed){logger[_0xe157('0x14')]('SugarcrmField,\x20%s,\x20%s',_0x284393,_0x5eeeed);_0x4d8049(_0x5eeeed);});});} \ No newline at end of file +var _0xeea1=['request\x20sent','error','message','result','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','request','info','SugarcrmField,\x20%s,\x20%s','debug','SugarcrmField,\x20%s,\x20%s,\x20%s'];(function(_0x3248d9,_0x1a7c23){var _0x132816=function(_0x25eff0){while(--_0x25eff0){_0x3248d9['push'](_0x3248d9['shift']());}};_0x132816(++_0x1a7c23);}(_0xeea1,0x1b9));var _0x1eea=function(_0x376627,_0x7cd7af){_0x376627=_0x376627-0x0;var _0xd9f568=_0xeea1[_0x376627];return _0xd9f568;};'use strict';var _=require(_0x1eea('0x0'));var util=require(_0x1eea('0x1'));var moment=require(_0x1eea('0x2'));var BPromise=require(_0x1eea('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1eea('0x4'));var db=require(_0x1eea('0x5'))['db'];var utils=require(_0x1eea('0x6'));var logger=require(_0x1eea('0x7'))(_0x1eea('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x1eea('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5b2ee3,_0x275378,_0x2eb4eb){return new BPromise(function(_0x3f3bc9,_0x2bbb2e){return client[_0x1eea('0xa')](_0x5b2ee3,_0x2eb4eb)['then'](function(_0x472a3f){logger[_0x1eea('0xb')](_0x1eea('0xc'),_0x275378,'request\x20sent');logger[_0x1eea('0xd')](_0x1eea('0xe'),_0x275378,_0x1eea('0xf'),JSON['stringify'](_0x472a3f));if(_0x472a3f[_0x1eea('0x10')]){if(_0x472a3f[_0x1eea('0x10')]['code']===0x1f4){logger[_0x1eea('0x10')]('SugarcrmField,\x20%s,\x20%s',_0x275378,_0x472a3f[_0x1eea('0x10')][_0x1eea('0x11')]);return _0x2bbb2e(_0x472a3f[_0x1eea('0x10')]['message']);}logger[_0x1eea('0x10')](_0x1eea('0xc'),_0x275378,_0x472a3f[_0x1eea('0x10')]['message']);return _0x3f3bc9(_0x472a3f[_0x1eea('0x10')][_0x1eea('0x11')]);}else{logger[_0x1eea('0xb')]('SugarcrmField,\x20%s,\x20%s',_0x275378,_0x1eea('0xf'));_0x3f3bc9(_0x472a3f[_0x1eea('0x12')][_0x1eea('0x11')]);}})['catch'](function(_0x27a98d){logger[_0x1eea('0x10')](_0x1eea('0xc'),_0x275378,_0x27a98d);_0x2bbb2e(_0x27a98d);});});} \ No newline at end of file diff --git a/server/api/intVtigerAccount/index.js b/server/api/intVtigerAccount/index.js index c3d97b9..bd879da 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 _0x54ef=['util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerAccount.controller','index','get','/:id','show','/:id/configurations','isAuthenticated','/:id/fields','getFields','create','post','addConfiguration','update','delete','destroy','exports','multer'];(function(_0x126558,_0x143c9a){var _0x1f6d14=function(_0x2b0eea){while(--_0x2b0eea){_0x126558['push'](_0x126558['shift']());}};_0x1f6d14(++_0x143c9a);}(_0x54ef,0x112));var _0xf54e=function(_0xd46242,_0x138fbc){_0xd46242=_0xd46242-0x0;var _0x1b0f74=_0x54ef[_0xd46242];return _0x1b0f74;};'use strict';var multer=require(_0xf54e('0x0'));var util=require(_0xf54e('0x1'));var path=require(_0xf54e('0x2'));var timeout=require('connect-timeout');var express=require(_0xf54e('0x3'));var router=express[_0xf54e('0x4')]();var fs_extra=require(_0xf54e('0x5'));var auth=require(_0xf54e('0x6'));var interaction=require(_0xf54e('0x7'));var config=require(_0xf54e('0x8'));var controller=require(_0xf54e('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0xf54e('0xa')]);router[_0xf54e('0xb')](_0xf54e('0xc'),auth['isAuthenticated'](),controller[_0xf54e('0xd')]);router['get'](_0xf54e('0xe'),auth[_0xf54e('0xf')](),controller['getConfigurations']);router[_0xf54e('0xb')](_0xf54e('0x10'),auth[_0xf54e('0xf')](),controller[_0xf54e('0x11')]);router['post']('/',auth[_0xf54e('0xf')](),controller[_0xf54e('0x12')]);router[_0xf54e('0x13')](_0xf54e('0xe'),auth['isAuthenticated'](),controller[_0xf54e('0x14')]);router['put']('/:id',auth[_0xf54e('0xf')](),controller[_0xf54e('0x15')]);router[_0xf54e('0x16')](_0xf54e('0xc'),auth['isAuthenticated'](),controller[_0xf54e('0x17')]);module[_0xf54e('0x18')]=router; \ No newline at end of file +var _0xd04b=['put','destroy','exports','multer','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerAccount.controller','get','isAuthenticated','index','/:id','/:id/configurations','getConfigurations','/:id/fields','getFields','create','post','addConfiguration'];(function(_0x42e675,_0x4f24ef){var _0x1e18b9=function(_0x115a6a){while(--_0x115a6a){_0x42e675['push'](_0x42e675['shift']());}};_0x1e18b9(++_0x4f24ef);}(_0xd04b,0x145));var _0xbd04=function(_0x32604f,_0x4226fc){_0x32604f=_0x32604f-0x0;var _0x5aaa8d=_0xd04b[_0x32604f];return _0x5aaa8d;};'use strict';var multer=require(_0xbd04('0x0'));var util=require(_0xbd04('0x1'));var path=require(_0xbd04('0x2'));var timeout=require('connect-timeout');var express=require(_0xbd04('0x3'));var router=express['Router']();var fs_extra=require(_0xbd04('0x4'));var auth=require(_0xbd04('0x5'));var interaction=require(_0xbd04('0x6'));var config=require(_0xbd04('0x7'));var controller=require(_0xbd04('0x8'));router[_0xbd04('0x9')]('/',auth[_0xbd04('0xa')](),controller[_0xbd04('0xb')]);router[_0xbd04('0x9')](_0xbd04('0xc'),auth[_0xbd04('0xa')](),controller['show']);router[_0xbd04('0x9')](_0xbd04('0xd'),auth[_0xbd04('0xa')](),controller[_0xbd04('0xe')]);router[_0xbd04('0x9')](_0xbd04('0xf'),auth[_0xbd04('0xa')](),controller[_0xbd04('0x10')]);router['post']('/',auth[_0xbd04('0xa')](),controller[_0xbd04('0x11')]);router[_0xbd04('0x12')](_0xbd04('0xd'),auth['isAuthenticated'](),controller[_0xbd04('0x13')]);router[_0xbd04('0x14')](_0xbd04('0xc'),auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth[_0xbd04('0xa')](),controller[_0xbd04('0x15')]);module[_0xbd04('0x16')]=router; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.attributes.js b/server/api/intVtigerAccount/intVtigerAccount.attributes.js index fdaaddf..1a00212 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 _0xb45d=['sequelize','exports','STRING','HelpDesk'];(function(_0x44f023,_0x325ee1){var _0x33ebb9=function(_0x1c5fae){while(--_0x1c5fae){_0x44f023['push'](_0x44f023['shift']());}};_0x33ebb9(++_0x325ee1);}(_0xb45d,0x104));var _0xdb45=function(_0x4e11d5,_0x1ce514){_0x4e11d5=_0x4e11d5-0x0;var _0x5e4e4c=_0xb45d[_0x4e11d5];return _0x5e4e4c;};'use strict';var Sequelize=require(_0xdb45('0x0'));module[_0xdb45('0x1')]={'name':{'type':Sequelize[_0xdb45('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xdb45('0x2')]},'username':{'type':Sequelize['STRING'],'allowNull':![]},'moduleName':{'type':Sequelize[_0xdb45('0x2')],'allowNull':![],'defaultValue':_0xdb45('0x3')},'remoteUri':{'type':Sequelize[_0xdb45('0x2')],'allowNull':![]},'serverUrl':{'type':Sequelize[_0xdb45('0x2')],'allowNull':![]},'accessKey':{'type':Sequelize[_0xdb45('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0xcfd2=['sequelize','exports','STRING'];(function(_0x415e93,_0x32cc5a){var _0x409208=function(_0x101079){while(--_0x101079){_0x415e93['push'](_0x415e93['shift']());}};_0x409208(++_0x32cc5a);}(_0xcfd2,0xbd));var _0x2cfd=function(_0x4cdac1,_0x43e48a){_0x4cdac1=_0x4cdac1-0x0;var _0x3a9a56=_0xcfd2[_0x4cdac1];return _0x3a9a56;};'use strict';var Sequelize=require(_0x2cfd('0x0'));module[_0x2cfd('0x1')]={'name':{'type':Sequelize[_0x2cfd('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x2cfd('0x2')]},'username':{'type':Sequelize[_0x2cfd('0x2')],'allowNull':![]},'moduleName':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'HelpDesk'},'remoteUri':{'type':Sequelize[_0x2cfd('0x2')],'allowNull':![]},'serverUrl':{'type':Sequelize[_0x2cfd('0x2')],'allowNull':![]},'accessKey':{'type':Sequelize[_0x2cfd('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 6613f05..ae0cf4e 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 _0x3dc3=['moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','update','then','destroy','name','send','index','map','VtigerAccount','rawAttributes','fieldName','type','key','query','keys','intersection','model','attributes','fields','length','nolimit','order','sort','filters','pick','merge','where','VIRTUAL','filter','includeAll','include','findAll','catch','show','params','options','create','body','find','VtigerConfiguration','getConfigurations','hasOwnProperty','addConfiguration','findOne','getSubjects','channel','Subjects','Descriptions','getFields','username','description','moduleName','remoteUri','serverUrl','accessKey','format','GET','getchallenge','success','result','describe','sessionName','autogenerated','reference','owner','remove','includes','editable','false','label','startsWith','cf_','picklist','picklistValues','value','log','vTiger\x20error:\x20','test','statusCode','error','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','rimraf','zip-dir','fast-json-patch','request-promise'];(function(_0x3734ca,_0x554044){var _0xc17aa2=function(_0x1c2793){while(--_0x1c2793){_0x3734ca['push'](_0x3734ca['shift']());}};_0xc17aa2(++_0x554044);}(_0x3dc3,0xf0));var _0x33dc=function(_0x576fe0,_0x29de93){_0x576fe0=_0x576fe0-0x0;var _0x524bf4=_0x3dc3[_0x576fe0];return _0x524bf4;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x33dc('0x0'));var zipdir=require(_0x33dc('0x1'));var jsonpatch=require(_0x33dc('0x2'));var rp=require(_0x33dc('0x3'));var moment=require(_0x33dc('0x4'));var BPromise=require(_0x33dc('0x5'));var Mustache=require(_0x33dc('0x6'));var util=require(_0x33dc('0x7'));var path=require(_0x33dc('0x8'));var sox=require(_0x33dc('0x9'));var csv=require(_0x33dc('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x33dc('0xb'));var _=require(_0x33dc('0xc'));var squel=require(_0x33dc('0xd'));var crypto=require(_0x33dc('0xe'));var jsforce=require(_0x33dc('0xf'));var deskjs=require(_0x33dc('0x10'));var toCsv=require('to-csv');var querystring=require(_0x33dc('0x11'));var Papa=require('papaparse');var Redis=require(_0x33dc('0x12'));var authService=require(_0x33dc('0x13'));var qs=require(_0x33dc('0x14'));var as=require(_0x33dc('0x15'));var hardwareService=require(_0x33dc('0x16'));var logger=require(_0x33dc('0x17'))(_0x33dc('0x18'));var utils=require(_0x33dc('0x19'));var config=require(_0x33dc('0x1a'));var licenseUtil=require(_0x33dc('0x1b'));var db=require(_0x33dc('0x1c'))['db'];var integrations=require(_0x33dc('0x1d'));function respondWithStatusCode(_0x4298a0,_0x33baf4){_0x33baf4=_0x33baf4||0xcc;return function(_0x18730e){if(_0x18730e){return _0x4298a0[_0x33dc('0x1e')](_0x33baf4);}return _0x4298a0[_0x33dc('0x1f')](_0x33baf4)[_0x33dc('0x20')]();};}function respondWithResult(_0x55cb1e,_0x14778c){_0x14778c=_0x14778c||0xc8;return function(_0x33797e){if(_0x33797e){return _0x55cb1e[_0x33dc('0x1f')](_0x14778c)[_0x33dc('0x21')](_0x33797e);}};}function respondWithFilteredResult(_0x5d3353,_0x42159d){return function(_0x2c2862){if(_0x2c2862){var _0x33c9df=typeof _0x42159d[_0x33dc('0x22')]===_0x33dc('0x23')&&typeof _0x42159d[_0x33dc('0x24')]===_0x33dc('0x23');var _0x537efc=_0x2c2862[_0x33dc('0x25')];var _0xdd56ac=_0x33c9df?0x0:_0x42159d[_0x33dc('0x22')];var _0x25e646=_0x33c9df?_0x2c2862['count']:_0x42159d['offset']+_0x42159d[_0x33dc('0x24')];var _0x426201;if(_0x25e646>=_0x537efc){_0x25e646=_0x537efc;_0x426201=0xc8;}else{_0x426201=0xce;}_0x5d3353['status'](_0x426201);return _0x5d3353['set'](_0x33dc('0x26'),_0xdd56ac+'-'+_0x25e646+'/'+_0x537efc)[_0x33dc('0x21')](_0x2c2862);}return null;};}function patchUpdates(_0x1955a5){return function(_0x45c250){try{jsonpatch[_0x33dc('0x27')](_0x45c250,_0x1955a5,!![]);}catch(_0x5d02fd){return BPromise[_0x33dc('0x28')](_0x5d02fd);}return _0x45c250['save']();};}function saveUpdates(_0xfabf58,_0x5204b6){return function(_0x482621){if(_0x482621){return _0x482621[_0x33dc('0x29')](_0xfabf58)[_0x33dc('0x2a')](function(_0x9fff3){return _0x9fff3;});}return null;};}function removeEntity(_0x58ec02,_0x212413){return function(_0x189869){if(_0x189869){return _0x189869[_0x33dc('0x2b')]()[_0x33dc('0x2a')](function(){_0x58ec02[_0x33dc('0x1f')](0xcc)[_0x33dc('0x20')]();});}};}function handleEntityNotFound(_0x1cc387,_0x4b88fc){return function(_0x37fbe6){if(!_0x37fbe6){_0x1cc387[_0x33dc('0x1e')](0x194);}return _0x37fbe6;};}function handleError(_0x589143,_0x1f419d){_0x1f419d=_0x1f419d||0x1f4;return function(_0x31193b){logger['error'](_0x31193b['stack']);if(_0x31193b[_0x33dc('0x2c')]){delete _0x31193b['name'];}_0x589143['status'](_0x1f419d)[_0x33dc('0x2d')](_0x31193b);};}exports[_0x33dc('0x2e')]=function(_0x4cb703,_0x22a1ab){var _0x510d2b={},_0x5f1030={},_0x516830={'count':0x0,'rows':[]};var _0x57189f=_[_0x33dc('0x2f')](db[_0x33dc('0x30')][_0x33dc('0x31')],function(_0x590def){return{'name':_0x590def[_0x33dc('0x32')],'type':_0x590def[_0x33dc('0x33')][_0x33dc('0x34')]};});_0x5f1030['model']=_[_0x33dc('0x2f')](_0x57189f,'name');_0x5f1030[_0x33dc('0x35')]=_[_0x33dc('0x36')](_0x4cb703[_0x33dc('0x35')]);_0x5f1030['filters']=_[_0x33dc('0x37')](_0x5f1030[_0x33dc('0x38')],_0x5f1030[_0x33dc('0x35')]);_0x510d2b[_0x33dc('0x39')]=_[_0x33dc('0x37')](_0x5f1030['model'],qs['fields'](_0x4cb703[_0x33dc('0x35')][_0x33dc('0x3a')]));_0x510d2b[_0x33dc('0x39')]=_0x510d2b[_0x33dc('0x39')][_0x33dc('0x3b')]?_0x510d2b[_0x33dc('0x39')]:_0x5f1030['model'];if(!_0x4cb703[_0x33dc('0x35')]['hasOwnProperty'](_0x33dc('0x3c'))){_0x510d2b['limit']=qs[_0x33dc('0x24')](_0x4cb703[_0x33dc('0x35')][_0x33dc('0x24')]);_0x510d2b[_0x33dc('0x22')]=qs[_0x33dc('0x22')](_0x4cb703['query'][_0x33dc('0x22')]);}_0x510d2b[_0x33dc('0x3d')]=qs[_0x33dc('0x3e')](_0x4cb703['query']['sort']);_0x510d2b['where']=qs[_0x33dc('0x3f')](_[_0x33dc('0x40')](_0x4cb703[_0x33dc('0x35')],_0x5f1030[_0x33dc('0x3f')]),_0x57189f);if(_0x4cb703['query']['filter']){_0x510d2b['where']=_[_0x33dc('0x41')](_0x510d2b[_0x33dc('0x42')],{'$or':_['map'](_0x57189f,function(_0x116212){if(_0x116212[_0x33dc('0x33')]!==_0x33dc('0x43')){var _0x357e4b={};_0x357e4b[_0x116212[_0x33dc('0x2c')]]={'$like':'%'+_0x4cb703[_0x33dc('0x35')][_0x33dc('0x44')]+'%'};return _0x357e4b;}})});}_0x510d2b=_[_0x33dc('0x41')]({},_0x510d2b,_0x4cb703['options']);var _0xf09a61={'where':_0x510d2b['where']};return db[_0x33dc('0x30')][_0x33dc('0x25')](_0xf09a61)[_0x33dc('0x2a')](function(_0x2dac9d){_0x516830[_0x33dc('0x25')]=_0x2dac9d;if(_0x4cb703[_0x33dc('0x35')][_0x33dc('0x45')]){_0x510d2b[_0x33dc('0x46')]=[{'all':!![]}];}return db[_0x33dc('0x30')][_0x33dc('0x47')](_0x510d2b);})[_0x33dc('0x2a')](function(_0x4f0055){_0x516830['rows']=_0x4f0055;return _0x516830;})[_0x33dc('0x2a')](respondWithFilteredResult(_0x22a1ab,_0x510d2b))[_0x33dc('0x48')](handleError(_0x22a1ab,null));};exports[_0x33dc('0x49')]=function(_0x2c0ae2,_0x20be44){var _0x35ee7f={'raw':![],'where':{'id':_0x2c0ae2[_0x33dc('0x4a')]['id']}},_0x3c7c36={};_0x3c7c36[_0x33dc('0x38')]=_[_0x33dc('0x36')](db['VtigerAccount'][_0x33dc('0x31')]);_0x3c7c36[_0x33dc('0x35')]=_[_0x33dc('0x36')](_0x2c0ae2[_0x33dc('0x35')]);_0x3c7c36[_0x33dc('0x3f')]=_[_0x33dc('0x37')](_0x3c7c36['model'],_0x3c7c36[_0x33dc('0x35')]);_0x35ee7f['attributes']=_[_0x33dc('0x37')](_0x3c7c36[_0x33dc('0x38')],qs[_0x33dc('0x3a')](_0x2c0ae2[_0x33dc('0x35')][_0x33dc('0x3a')]));_0x35ee7f[_0x33dc('0x39')]=_0x35ee7f[_0x33dc('0x39')][_0x33dc('0x3b')]?_0x35ee7f[_0x33dc('0x39')]:_0x3c7c36[_0x33dc('0x38')];if(_0x2c0ae2[_0x33dc('0x35')][_0x33dc('0x45')]){_0x35ee7f['include']=[{'all':!![]}];}_0x35ee7f=_[_0x33dc('0x41')]({},_0x35ee7f,_0x2c0ae2[_0x33dc('0x4b')]);return db[_0x33dc('0x30')]['find'](_0x35ee7f)[_0x33dc('0x2a')](handleEntityNotFound(_0x20be44,null))[_0x33dc('0x2a')](respondWithResult(_0x20be44,null))[_0x33dc('0x48')](handleError(_0x20be44,null));};exports[_0x33dc('0x4c')]=function(_0xc83700,_0x1a6de2){return db[_0x33dc('0x30')][_0x33dc('0x4c')](_0xc83700[_0x33dc('0x4d')],{})[_0x33dc('0x2a')](respondWithResult(_0x1a6de2,0xc9))['catch'](handleError(_0x1a6de2,null));};exports['update']=function(_0x485ef0,_0x72c93c){if(_0x485ef0['body']['id']){delete _0x485ef0[_0x33dc('0x4d')]['id'];}return db[_0x33dc('0x30')][_0x33dc('0x4e')]({'where':{'id':_0x485ef0[_0x33dc('0x4a')]['id']}})['then'](handleEntityNotFound(_0x72c93c,null))[_0x33dc('0x2a')](saveUpdates(_0x485ef0[_0x33dc('0x4d')],null))[_0x33dc('0x2a')](respondWithResult(_0x72c93c,null))['catch'](handleError(_0x72c93c,null));};exports['destroy']=function(_0x285f6c,_0x205a57){return db[_0x33dc('0x30')][_0x33dc('0x4e')]({'where':{'id':_0x285f6c[_0x33dc('0x4a')]['id']}})[_0x33dc('0x2a')](handleEntityNotFound(_0x205a57,null))[_0x33dc('0x2a')](removeEntity(_0x205a57,null))[_0x33dc('0x48')](handleError(_0x205a57,null));};exports['getConfigurations']=function(_0x25f6e1,_0x3f54a9,_0x1a01f2){var _0x4d3f8a={};var _0x1c14ae={};var _0x2f7a89;var _0x1834be;return db[_0x33dc('0x30')]['findOne']({'where':{'id':_0x25f6e1[_0x33dc('0x4a')]['id']}})['then'](handleEntityNotFound(_0x3f54a9,null))[_0x33dc('0x2a')](function(_0x58a3f7){if(_0x58a3f7){_0x2f7a89=_0x58a3f7;_0x1c14ae[_0x33dc('0x38')]=_['keys'](db[_0x33dc('0x4f')][_0x33dc('0x31')]);_0x1c14ae[_0x33dc('0x35')]=_[_0x33dc('0x36')](_0x25f6e1['query']);_0x1c14ae[_0x33dc('0x3f')]=_['intersection'](_0x1c14ae[_0x33dc('0x38')],_0x1c14ae[_0x33dc('0x35')]);_0x4d3f8a['attributes']=_[_0x33dc('0x37')](_0x1c14ae[_0x33dc('0x38')],qs['fields'](_0x25f6e1[_0x33dc('0x35')][_0x33dc('0x3a')]));_0x4d3f8a['attributes']=_0x4d3f8a['attributes']['length']?_0x4d3f8a['attributes']:_0x1c14ae[_0x33dc('0x38')];_0x4d3f8a[_0x33dc('0x3d')]=qs[_0x33dc('0x3e')](_0x25f6e1['query']['sort']);_0x4d3f8a[_0x33dc('0x42')]=qs[_0x33dc('0x3f')](_[_0x33dc('0x40')](_0x25f6e1[_0x33dc('0x35')],_0x1c14ae[_0x33dc('0x3f')]));if(_0x25f6e1['query']['filter']){_0x4d3f8a[_0x33dc('0x42')]=_[_0x33dc('0x41')](_0x4d3f8a[_0x33dc('0x42')],{'$or':_[_0x33dc('0x2f')](_0x4d3f8a[_0x33dc('0x39')],function(_0x357caf){var _0x2f6610={};_0x2f6610[_0x357caf]={'$like':'%'+_0x25f6e1[_0x33dc('0x35')][_0x33dc('0x44')]+'%'};return _0x2f6610;})});}_0x4d3f8a=_['merge']({},_0x4d3f8a,_0x25f6e1[_0x33dc('0x4b')]);return _0x2f7a89[_0x33dc('0x50')](_0x4d3f8a);}})[_0x33dc('0x2a')](function(_0x58d356){if(_0x58d356){_0x1834be=_0x58d356['length'];if(!_0x25f6e1[_0x33dc('0x35')][_0x33dc('0x51')]('nolimit')){_0x4d3f8a[_0x33dc('0x24')]=qs[_0x33dc('0x24')](_0x25f6e1[_0x33dc('0x35')][_0x33dc('0x24')]);_0x4d3f8a['offset']=qs[_0x33dc('0x22')](_0x25f6e1[_0x33dc('0x35')]['offset']);}return _0x2f7a89[_0x33dc('0x50')](_0x4d3f8a);}})['then'](function(_0x35dfb4){if(_0x35dfb4){return _0x35dfb4?{'count':_0x1834be,'rows':_0x35dfb4}:null;}})[_0x33dc('0x2a')](respondWithResult(_0x3f54a9,null))[_0x33dc('0x48')](handleError(_0x3f54a9,null));};exports[_0x33dc('0x52')]=function(_0x31a3f7,_0xaf28a,_0x3c8173){if(_0x31a3f7[_0x33dc('0x4d')]['id']){delete _0x31a3f7[_0x33dc('0x4d')]['id'];}return db[_0x33dc('0x30')][_0x33dc('0x53')]({'where':{'id':_0x31a3f7[_0x33dc('0x4a')]['id']}})['then'](handleEntityNotFound(_0xaf28a,null))[_0x33dc('0x2a')](function(_0x206dc8){if(_0x206dc8){_0x31a3f7[_0x33dc('0x4d')]['AccountId']=_0x206dc8['id'];_0x31a3f7[_0x33dc('0x4d')]['Subjects']=integrations[_0x33dc('0x54')](_0x31a3f7[_0x33dc('0x4d')][_0x33dc('0x55')],_0x31a3f7[_0x33dc('0x4d')][_0x33dc('0x33')]);_0x31a3f7[_0x33dc('0x4d')]['Descriptions']=integrations['getDescriptions'](_0x31a3f7[_0x33dc('0x4d')]['channel'],_0x31a3f7['body']['type']);return db[_0x33dc('0x4f')][_0x33dc('0x4c')](_0x31a3f7['body'],{'include':[{'model':db['VtigerField'],'as':_0x33dc('0x56')},{'model':db['VtigerField'],'as':_0x33dc('0x57')}]});}return null;})['then'](respondWithResult(_0xaf28a,null))['catch'](handleError(_0xaf28a,null));};var md5=require('md5');exports[_0x33dc('0x58')]=function(_0x8e292b,_0x877643,_0x36f677){var _0x468059=null;var _0x3c2c5b=null;var _0x5634ae=null;var _0x75d88b=null;var _0x228694='';return db[_0x33dc('0x30')][_0x33dc('0x53')]({'where':{'id':_0x8e292b[_0x33dc('0x4a')]['id']},'attributes':['id','name',_0x33dc('0x59'),_0x33dc('0x5a'),_0x33dc('0x5b'),_0x33dc('0x5c'),_0x33dc('0x5d'),_0x33dc('0x5e')]})[_0x33dc('0x2a')](handleEntityNotFound(_0x877643,null))['then'](function(_0x393a8a){if(_0x393a8a){_0x468059=_0x393a8a[_0x33dc('0x59')];_0x3c2c5b=_0x393a8a[_0x33dc('0x5e')];_0x5634ae=_0x393a8a[_0x33dc('0x5b')];_0x228694=_0x393a8a[_0x33dc('0x5c')];var _0x228f24=_0x228694['slice'](-0x1);if(_0x228f24==='/'){_0x228694=_0x228694['substring'](0x0,_0x228694['lastIndexOf'](_0x228f24));}_0x75d88b=util[_0x33dc('0x5f')]('%s/webservice.php',_0x228694);var _0x2157b6={'method':_0x33dc('0x60'),'uri':_0x75d88b,'qs':{'operation':_0x33dc('0x61'),'username':_0x393a8a[_0x33dc('0x59')]},'json':!![]};return rp(_0x2157b6);}})[_0x33dc('0x2a')](function(_0x50a0bf){if(_0x50a0bf[_0x33dc('0x62')]){var _0x350547={'method':'POST','uri':_0x75d88b,'form':{'operation':'login','username':_0x468059,'accessKey':md5(_0x50a0bf[_0x33dc('0x63')]['token']+_0x3c2c5b)},'json':!![]};return rp(_0x350547);}})[_0x33dc('0x2a')](function(_0x371783){if(_0x371783[_0x33dc('0x62')]){var _0x2d0fdc={'method':_0x33dc('0x60'),'uri':_0x75d88b,'qs':{'operation':_0x33dc('0x64'),'username':_0x468059,'sessionName':_0x371783[_0x33dc('0x63')][_0x33dc('0x65')],'elementType':_0x5634ae},'json':!![]};return rp(_0x2d0fdc);}})[_0x33dc('0x2a')](function(_0x1ebc95){if(_0x1ebc95[_0x33dc('0x62')]){var _0x56eb3a=[_0x33dc('0x66'),_0x33dc('0x67'),_0x33dc('0x68')];_[_0x33dc('0x69')](_0x1ebc95['result']['fields'],function(_0x252e60){return _0x56eb3a[_0x33dc('0x6a')](_0x252e60['type'][_0x33dc('0x2c')]);});_[_0x33dc('0x69')](_0x1ebc95[_0x33dc('0x63')]['fields'],function(_0x3a85fa){return _0x3a85fa[_0x33dc('0x6b')]===_0x33dc('0x6c');});return{'count':_0x1ebc95['result'][_0x33dc('0x3a')][_0x33dc('0x3b')],'rows':_[_0x33dc('0x2f')](_0x1ebc95[_0x33dc('0x63')][_0x33dc('0x3a')],function(_0x4ee0e1){return{'id':_0x4ee0e1[_0x33dc('0x2c')],'name':_0x4ee0e1[_0x33dc('0x6d')],'custom':_[_0x33dc('0x6e')](_0x4ee0e1[_0x33dc('0x2c')],_0x33dc('0x6f'))?!![]:![],'options':_0x4ee0e1[_0x33dc('0x33')][_0x33dc('0x2c')]===_0x33dc('0x70')&&_0x4ee0e1[_0x33dc('0x33')]['picklistValues'][_0x33dc('0x3b')]>0x0?_[_0x33dc('0x2f')](_0x4ee0e1[_0x33dc('0x33')][_0x33dc('0x71')],function(_0x3377c6){return{'name':_0x3377c6[_0x33dc('0x6d')],'value':_0x3377c6[_0x33dc('0x72')]};}):[]};})};}})[_0x33dc('0x2a')](respondWithResult(_0x877643,null))['catch'](function(_0xcb4022){console[_0x33dc('0x73')](_0x33dc('0x74')+_0xcb4022);var _0x3866da=_0x8e292b['query'][_0x33dc('0x75')]?0x1f4:_0xcb4022[_0x33dc('0x76')]||0x1f4;logger[_0x33dc('0x77')](_0x33dc('0x78'),_0x33dc('0x58'),_0x3866da,JSON['stringify'](_0xcb4022));delete _0xcb4022['name'];if(_0x3866da===0x191){_0x3866da=0x190;}_0x877643['status'](_0x3866da)['send'](_0x8e292b['query'][_0x33dc('0x75')]?{'message':_0x33dc('0x79'),'statusCode':_0xcb4022[_0x33dc('0x76')]}:_0xcb4022);});}; \ No newline at end of file +var _0xfbda=['map','VtigerAccount','fieldName','type','key','model','query','keys','attributes','fields','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','filters','intersection','length','find','create','body','getConfigurations','findOne','VtigerConfiguration','rawAttributes','nolimit','addConfiguration','Subjects','getSubjects','Descriptions','channel','VtigerField','username','description','moduleName','remoteUri','serverUrl','accessKey','substring','lastIndexOf','format','%s/webservice.php','GET','getchallenge','success','result','token','describe','reference','remove','includes','false','label','startsWith','picklistValues','value','log','vTiger\x20error:\x20','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','stringify','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','end','status','undefined','limit','count','offset','set','Content-Range','json','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xfbda,0x1a2));var _0xafbd=function(_0x5c9307,_0x5b97e4){_0x5c9307=_0x5c9307-0x0;var _0x373e29=_0xfbda[_0x5c9307];return _0x373e29;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xafbd('0x0'));var zipdir=require(_0xafbd('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xafbd('0x2'));var moment=require(_0xafbd('0x3'));var BPromise=require(_0xafbd('0x4'));var Mustache=require(_0xafbd('0x5'));var util=require(_0xafbd('0x6'));var path=require('path');var sox=require(_0xafbd('0x7'));var csv=require('to-csv');var ejs=require(_0xafbd('0x8'));var fs=require('fs');var fs_extra=require(_0xafbd('0x9'));var _=require(_0xafbd('0xa'));var squel=require('squel');var crypto=require(_0xafbd('0xb'));var jsforce=require(_0xafbd('0xc'));var deskjs=require(_0xafbd('0xd'));var toCsv=require(_0xafbd('0xe'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xafbd('0xf'));var as=require(_0xafbd('0x10'));var hardwareService=require(_0xafbd('0x11'));var logger=require(_0xafbd('0x12'))('api');var utils=require('../../config/utils');var config=require(_0xafbd('0x13'));var licenseUtil=require(_0xafbd('0x14'));var db=require(_0xafbd('0x15'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x2d2d4d,_0x428853){_0x428853=_0x428853||0xcc;return function(_0x475595){if(_0x475595){return _0x2d2d4d['sendStatus'](_0x428853);}return _0x2d2d4d['status'](_0x428853)[_0xafbd('0x16')]();};}function respondWithResult(_0x34f099,_0x20ff9b){_0x20ff9b=_0x20ff9b||0xc8;return function(_0x3136f0){if(_0x3136f0){return _0x34f099[_0xafbd('0x17')](_0x20ff9b)['json'](_0x3136f0);}};}function respondWithFilteredResult(_0x254977,_0x18ae28){return function(_0x1cc0e5){if(_0x1cc0e5){var _0x181b70=typeof _0x18ae28['offset']===_0xafbd('0x18')&&typeof _0x18ae28[_0xafbd('0x19')]==='undefined';var _0x3c637b=_0x1cc0e5[_0xafbd('0x1a')];var _0x5908ca=_0x181b70?0x0:_0x18ae28[_0xafbd('0x1b')];var _0x1cc4a3=_0x181b70?_0x1cc0e5[_0xafbd('0x1a')]:_0x18ae28['offset']+_0x18ae28['limit'];var _0x15376a;if(_0x1cc4a3>=_0x3c637b){_0x1cc4a3=_0x3c637b;_0x15376a=0xc8;}else{_0x15376a=0xce;}_0x254977[_0xafbd('0x17')](_0x15376a);return _0x254977[_0xafbd('0x1c')](_0xafbd('0x1d'),_0x5908ca+'-'+_0x1cc4a3+'/'+_0x3c637b)[_0xafbd('0x1e')](_0x1cc0e5);}return null;};}function patchUpdates(_0x59a712){return function(_0x329d06){try{jsonpatch['apply'](_0x329d06,_0x59a712,!![]);}catch(_0x292dfb){return BPromise[_0xafbd('0x1f')](_0x292dfb);}return _0x329d06[_0xafbd('0x20')]();};}function saveUpdates(_0xf20aca,_0x12ea89){return function(_0x373378){if(_0x373378){return _0x373378[_0xafbd('0x21')](_0xf20aca)[_0xafbd('0x22')](function(_0x3f8f8b){return _0x3f8f8b;});}return null;};}function removeEntity(_0x1ec662,_0x38198d){return function(_0x4ad052){if(_0x4ad052){return _0x4ad052[_0xafbd('0x23')]()['then'](function(){_0x1ec662[_0xafbd('0x17')](0xcc)[_0xafbd('0x16')]();});}};}function handleEntityNotFound(_0x2112a8,_0x289427){return function(_0xa82764){if(!_0xa82764){_0x2112a8[_0xafbd('0x24')](0x194);}return _0xa82764;};}function handleError(_0x21d63d,_0x5488ea){_0x5488ea=_0x5488ea||0x1f4;return function(_0x5b47d1){logger[_0xafbd('0x25')](_0x5b47d1[_0xafbd('0x26')]);if(_0x5b47d1[_0xafbd('0x27')]){delete _0x5b47d1[_0xafbd('0x27')];}_0x21d63d['status'](_0x5488ea)[_0xafbd('0x28')](_0x5b47d1);};}exports[_0xafbd('0x29')]=function(_0x4e7747,_0x1258ef){var _0x4a6107={},_0x37fb7b={},_0x16d034={'count':0x0,'rows':[]};var _0x21974f=_[_0xafbd('0x2a')](db[_0xafbd('0x2b')]['rawAttributes'],function(_0x37946e){return{'name':_0x37946e[_0xafbd('0x2c')],'type':_0x37946e[_0xafbd('0x2d')][_0xafbd('0x2e')]};});_0x37fb7b[_0xafbd('0x2f')]=_[_0xafbd('0x2a')](_0x21974f,_0xafbd('0x27'));_0x37fb7b[_0xafbd('0x30')]=_[_0xafbd('0x31')](_0x4e7747['query']);_0x37fb7b['filters']=_['intersection'](_0x37fb7b['model'],_0x37fb7b[_0xafbd('0x30')]);_0x4a6107[_0xafbd('0x32')]=_['intersection'](_0x37fb7b[_0xafbd('0x2f')],qs['fields'](_0x4e7747[_0xafbd('0x30')][_0xafbd('0x33')]));_0x4a6107['attributes']=_0x4a6107[_0xafbd('0x32')]['length']?_0x4a6107[_0xafbd('0x32')]:_0x37fb7b[_0xafbd('0x2f')];if(!_0x4e7747[_0xafbd('0x30')][_0xafbd('0x34')]('nolimit')){_0x4a6107[_0xafbd('0x19')]=qs[_0xafbd('0x19')](_0x4e7747['query'][_0xafbd('0x19')]);_0x4a6107[_0xafbd('0x1b')]=qs[_0xafbd('0x1b')](_0x4e7747[_0xafbd('0x30')][_0xafbd('0x1b')]);}_0x4a6107[_0xafbd('0x35')]=qs[_0xafbd('0x36')](_0x4e7747[_0xafbd('0x30')][_0xafbd('0x36')]);_0x4a6107[_0xafbd('0x37')]=qs['filters'](_[_0xafbd('0x38')](_0x4e7747[_0xafbd('0x30')],_0x37fb7b['filters']),_0x21974f);if(_0x4e7747[_0xafbd('0x30')][_0xafbd('0x39')]){_0x4a6107['where']=_[_0xafbd('0x3a')](_0x4a6107[_0xafbd('0x37')],{'$or':_[_0xafbd('0x2a')](_0x21974f,function(_0x6381b7){if(_0x6381b7[_0xafbd('0x2d')]!==_0xafbd('0x3b')){var _0x55dee8={};_0x55dee8[_0x6381b7[_0xafbd('0x27')]]={'$like':'%'+_0x4e7747[_0xafbd('0x30')][_0xafbd('0x39')]+'%'};return _0x55dee8;}})});}_0x4a6107=_[_0xafbd('0x3a')]({},_0x4a6107,_0x4e7747[_0xafbd('0x3c')]);var _0x5652c4={'where':_0x4a6107['where']};return db['VtigerAccount'][_0xafbd('0x1a')](_0x5652c4)[_0xafbd('0x22')](function(_0x283a23){_0x16d034[_0xafbd('0x1a')]=_0x283a23;if(_0x4e7747[_0xafbd('0x30')][_0xafbd('0x3d')]){_0x4a6107[_0xafbd('0x3e')]=[{'all':!![]}];}return db[_0xafbd('0x2b')][_0xafbd('0x3f')](_0x4a6107);})['then'](function(_0x5e9e26){_0x16d034[_0xafbd('0x40')]=_0x5e9e26;return _0x16d034;})[_0xafbd('0x22')](respondWithFilteredResult(_0x1258ef,_0x4a6107))[_0xafbd('0x41')](handleError(_0x1258ef,null));};exports['show']=function(_0x1294fc,_0x3b9031){var _0x4a3df3={'raw':![],'where':{'id':_0x1294fc[_0xafbd('0x42')]['id']}},_0x481605={};_0x481605[_0xafbd('0x2f')]=_[_0xafbd('0x31')](db['VtigerAccount']['rawAttributes']);_0x481605['query']=_[_0xafbd('0x31')](_0x1294fc['query']);_0x481605[_0xafbd('0x43')]=_[_0xafbd('0x44')](_0x481605[_0xafbd('0x2f')],_0x481605[_0xafbd('0x30')]);_0x4a3df3[_0xafbd('0x32')]=_['intersection'](_0x481605['model'],qs['fields'](_0x1294fc['query'][_0xafbd('0x33')]));_0x4a3df3['attributes']=_0x4a3df3[_0xafbd('0x32')][_0xafbd('0x45')]?_0x4a3df3[_0xafbd('0x32')]:_0x481605[_0xafbd('0x2f')];if(_0x1294fc[_0xafbd('0x30')][_0xafbd('0x3d')]){_0x4a3df3['include']=[{'all':!![]}];}_0x4a3df3=_[_0xafbd('0x3a')]({},_0x4a3df3,_0x1294fc[_0xafbd('0x3c')]);return db[_0xafbd('0x2b')][_0xafbd('0x46')](_0x4a3df3)[_0xafbd('0x22')](handleEntityNotFound(_0x3b9031,null))[_0xafbd('0x22')](respondWithResult(_0x3b9031,null))[_0xafbd('0x41')](handleError(_0x3b9031,null));};exports[_0xafbd('0x47')]=function(_0x11168c,_0x3c609b){return db[_0xafbd('0x2b')]['create'](_0x11168c['body'],{})['then'](respondWithResult(_0x3c609b,0xc9))['catch'](handleError(_0x3c609b,null));};exports[_0xafbd('0x21')]=function(_0x20f201,_0xded703){if(_0x20f201[_0xafbd('0x48')]['id']){delete _0x20f201[_0xafbd('0x48')]['id'];}return db['VtigerAccount'][_0xafbd('0x46')]({'where':{'id':_0x20f201['params']['id']}})[_0xafbd('0x22')](handleEntityNotFound(_0xded703,null))[_0xafbd('0x22')](saveUpdates(_0x20f201['body'],null))[_0xafbd('0x22')](respondWithResult(_0xded703,null))[_0xafbd('0x41')](handleError(_0xded703,null));};exports[_0xafbd('0x23')]=function(_0x4eda62,_0x366501){return db['VtigerAccount'][_0xafbd('0x46')]({'where':{'id':_0x4eda62[_0xafbd('0x42')]['id']}})[_0xafbd('0x22')](handleEntityNotFound(_0x366501,null))[_0xafbd('0x22')](removeEntity(_0x366501,null))['catch'](handleError(_0x366501,null));};exports[_0xafbd('0x49')]=function(_0x1c28e8,_0x40eeec,_0x1e627d){var _0xb2587c={};var _0x2e7743={};var _0x1b2da1;var _0x3a3efa;return db[_0xafbd('0x2b')][_0xafbd('0x4a')]({'where':{'id':_0x1c28e8[_0xafbd('0x42')]['id']}})['then'](handleEntityNotFound(_0x40eeec,null))['then'](function(_0x4e837b){if(_0x4e837b){_0x1b2da1=_0x4e837b;_0x2e7743['model']=_[_0xafbd('0x31')](db[_0xafbd('0x4b')][_0xafbd('0x4c')]);_0x2e7743[_0xafbd('0x30')]=_[_0xafbd('0x31')](_0x1c28e8[_0xafbd('0x30')]);_0x2e7743[_0xafbd('0x43')]=_['intersection'](_0x2e7743[_0xafbd('0x2f')],_0x2e7743[_0xafbd('0x30')]);_0xb2587c[_0xafbd('0x32')]=_[_0xafbd('0x44')](_0x2e7743['model'],qs['fields'](_0x1c28e8[_0xafbd('0x30')][_0xafbd('0x33')]));_0xb2587c[_0xafbd('0x32')]=_0xb2587c[_0xafbd('0x32')][_0xafbd('0x45')]?_0xb2587c[_0xafbd('0x32')]:_0x2e7743['model'];_0xb2587c[_0xafbd('0x35')]=qs[_0xafbd('0x36')](_0x1c28e8[_0xafbd('0x30')]['sort']);_0xb2587c[_0xafbd('0x37')]=qs['filters'](_[_0xafbd('0x38')](_0x1c28e8[_0xafbd('0x30')],_0x2e7743[_0xafbd('0x43')]));if(_0x1c28e8[_0xafbd('0x30')][_0xafbd('0x39')]){_0xb2587c[_0xafbd('0x37')]=_[_0xafbd('0x3a')](_0xb2587c[_0xafbd('0x37')],{'$or':_['map'](_0xb2587c['attributes'],function(_0x28cf1e){var _0x54acec={};_0x54acec[_0x28cf1e]={'$like':'%'+_0x1c28e8[_0xafbd('0x30')][_0xafbd('0x39')]+'%'};return _0x54acec;})});}_0xb2587c=_[_0xafbd('0x3a')]({},_0xb2587c,_0x1c28e8[_0xafbd('0x3c')]);return _0x1b2da1[_0xafbd('0x49')](_0xb2587c);}})[_0xafbd('0x22')](function(_0x21d35a){if(_0x21d35a){_0x3a3efa=_0x21d35a[_0xafbd('0x45')];if(!_0x1c28e8['query'][_0xafbd('0x34')](_0xafbd('0x4d'))){_0xb2587c[_0xafbd('0x19')]=qs[_0xafbd('0x19')](_0x1c28e8[_0xafbd('0x30')]['limit']);_0xb2587c[_0xafbd('0x1b')]=qs[_0xafbd('0x1b')](_0x1c28e8['query'][_0xafbd('0x1b')]);}return _0x1b2da1[_0xafbd('0x49')](_0xb2587c);}})[_0xafbd('0x22')](function(_0x1247ae){if(_0x1247ae){return _0x1247ae?{'count':_0x3a3efa,'rows':_0x1247ae}:null;}})[_0xafbd('0x22')](respondWithResult(_0x40eeec,null))['catch'](handleError(_0x40eeec,null));};exports[_0xafbd('0x4e')]=function(_0x4dd1d1,_0x496883,_0x471edf){if(_0x4dd1d1[_0xafbd('0x48')]['id']){delete _0x4dd1d1[_0xafbd('0x48')]['id'];}return db[_0xafbd('0x2b')]['findOne']({'where':{'id':_0x4dd1d1['params']['id']}})['then'](handleEntityNotFound(_0x496883,null))[_0xafbd('0x22')](function(_0x510fc8){if(_0x510fc8){_0x4dd1d1[_0xafbd('0x48')]['AccountId']=_0x510fc8['id'];_0x4dd1d1[_0xafbd('0x48')][_0xafbd('0x4f')]=integrations[_0xafbd('0x50')](_0x4dd1d1[_0xafbd('0x48')]['channel'],_0x4dd1d1[_0xafbd('0x48')][_0xafbd('0x2d')]);_0x4dd1d1[_0xafbd('0x48')][_0xafbd('0x51')]=integrations['getDescriptions'](_0x4dd1d1[_0xafbd('0x48')][_0xafbd('0x52')],_0x4dd1d1[_0xafbd('0x48')]['type']);return db['VtigerConfiguration'][_0xafbd('0x47')](_0x4dd1d1[_0xafbd('0x48')],{'include':[{'model':db[_0xafbd('0x53')],'as':'Subjects'},{'model':db[_0xafbd('0x53')],'as':_0xafbd('0x51')}]});}return null;})[_0xafbd('0x22')](respondWithResult(_0x496883,null))['catch'](handleError(_0x496883,null));};var md5=require('md5');exports['getFields']=function(_0x1ea2ae,_0xfc57a5,_0x2bc659){var _0x4f7bc1=null;var _0x3656d1=null;var _0x147ad6=null;var _0x2f6e76=null;var _0x13ab54='';return db[_0xafbd('0x2b')]['findOne']({'where':{'id':_0x1ea2ae[_0xafbd('0x42')]['id']},'attributes':['id','name',_0xafbd('0x54'),_0xafbd('0x55'),_0xafbd('0x56'),_0xafbd('0x57'),_0xafbd('0x58'),'accessKey']})[_0xafbd('0x22')](handleEntityNotFound(_0xfc57a5,null))[_0xafbd('0x22')](function(_0x41566f){if(_0x41566f){_0x4f7bc1=_0x41566f['username'];_0x3656d1=_0x41566f[_0xafbd('0x59')];_0x147ad6=_0x41566f['moduleName'];_0x13ab54=_0x41566f[_0xafbd('0x57')];var _0x5a1251=_0x13ab54['slice'](-0x1);if(_0x5a1251==='/'){_0x13ab54=_0x13ab54[_0xafbd('0x5a')](0x0,_0x13ab54[_0xafbd('0x5b')](_0x5a1251));}_0x2f6e76=util[_0xafbd('0x5c')](_0xafbd('0x5d'),_0x13ab54);var _0x1fac1b={'method':_0xafbd('0x5e'),'uri':_0x2f6e76,'qs':{'operation':_0xafbd('0x5f'),'username':_0x41566f[_0xafbd('0x54')]},'json':!![]};return rp(_0x1fac1b);}})[_0xafbd('0x22')](function(_0x53fc99){if(_0x53fc99[_0xafbd('0x60')]){var _0x225f75={'method':'POST','uri':_0x2f6e76,'form':{'operation':'login','username':_0x4f7bc1,'accessKey':md5(_0x53fc99[_0xafbd('0x61')][_0xafbd('0x62')]+_0x3656d1)},'json':!![]};return rp(_0x225f75);}})[_0xafbd('0x22')](function(_0x59a810){if(_0x59a810[_0xafbd('0x60')]){var _0x20bf00={'method':_0xafbd('0x5e'),'uri':_0x2f6e76,'qs':{'operation':_0xafbd('0x63'),'username':_0x4f7bc1,'sessionName':_0x59a810[_0xafbd('0x61')]['sessionName'],'elementType':_0x147ad6},'json':!![]};return rp(_0x20bf00);}})[_0xafbd('0x22')](function(_0x9e59ec){if(_0x9e59ec[_0xafbd('0x60')]){var _0x44850f=['autogenerated',_0xafbd('0x64'),'owner'];_[_0xafbd('0x65')](_0x9e59ec[_0xafbd('0x61')][_0xafbd('0x33')],function(_0x67f211){return _0x44850f[_0xafbd('0x66')](_0x67f211[_0xafbd('0x2d')][_0xafbd('0x27')]);});_['remove'](_0x9e59ec[_0xafbd('0x61')][_0xafbd('0x33')],function(_0x20bdb9){return _0x20bdb9['editable']===_0xafbd('0x67');});return{'count':_0x9e59ec[_0xafbd('0x61')][_0xafbd('0x33')][_0xafbd('0x45')],'rows':_[_0xafbd('0x2a')](_0x9e59ec['result'][_0xafbd('0x33')],function(_0x2976df){return{'id':_0x2976df[_0xafbd('0x27')],'name':_0x2976df[_0xafbd('0x68')],'custom':_[_0xafbd('0x69')](_0x2976df[_0xafbd('0x27')],'cf_')?!![]:![],'options':_0x2976df[_0xafbd('0x2d')]['name']==='picklist'&&_0x2976df[_0xafbd('0x2d')][_0xafbd('0x6a')]['length']>0x0?_[_0xafbd('0x2a')](_0x2976df[_0xafbd('0x2d')]['picklistValues'],function(_0x23199b){return{'name':_0x23199b[_0xafbd('0x68')],'value':_0x23199b[_0xafbd('0x6b')]};}):[]};})};}})[_0xafbd('0x22')](respondWithResult(_0xfc57a5,null))[_0xafbd('0x41')](function(_0x530bb2){console[_0xafbd('0x6c')](_0xafbd('0x6d')+_0x530bb2);var _0x58dc6a=_0x1ea2ae['query'][_0xafbd('0x6e')]?0x1f4:_0x530bb2[_0xafbd('0x6f')]||0x1f4;logger['error'](_0xafbd('0x70'),_0xafbd('0x71'),_0x58dc6a,JSON[_0xafbd('0x72')](_0x530bb2));delete _0x530bb2[_0xafbd('0x27')];if(_0x58dc6a===0x191){_0x58dc6a=0x190;}_0xfc57a5['status'](_0x58dc6a)[_0xafbd('0x28')](_0x1ea2ae['query']['test']?{'message':'Wrong\x20credentials','statusCode':_0x530bb2['statusCode']}:_0x530bb2);});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.model.js b/server/api/intVtigerAccount/intVtigerAccount.model.js index c92774b..4ebfdf1 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 _0x0e00=['path','rimraf','../../config/environment','./intVtigerAccount.attributes','../../components/integrations/configuration','exports','define','VtigerAccount','int_vtiger_accounts','../../config/logger','api','moment','bluebird'];(function(_0x345daa,_0x3e8a6a){var _0x193546=function(_0x559709){while(--_0x559709){_0x345daa['push'](_0x345daa['shift']());}};_0x193546(++_0x3e8a6a);}(_0x0e00,0x15b));var _0x00e0=function(_0x10eac8,_0x21124e){_0x10eac8=_0x10eac8-0x0;var _0x2cb931=_0x0e00[_0x10eac8];return _0x2cb931;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x00e0('0x0'))(_0x00e0('0x1'));var moment=require(_0x00e0('0x2'));var BPromise=require(_0x00e0('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x00e0('0x4'));var rimraf=require(_0x00e0('0x5'));var config=require(_0x00e0('0x6'));var attributes=require(_0x00e0('0x7'));var integrations=require(_0x00e0('0x8'));module[_0x00e0('0x9')]=function(_0xdd731f,_0x27f962){return _0xdd731f[_0x00e0('0xa')](_0x00e0('0xb'),attributes,{'tableName':_0x00e0('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4c0d=['exports','VtigerAccount','int_vtiger_accounts','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intVtigerAccount.attributes','../../components/integrations/configuration'];(function(_0x48cc31,_0x5aa6e9){var _0x2f45e8=function(_0x3f91a6){while(--_0x3f91a6){_0x48cc31['push'](_0x48cc31['shift']());}};_0x2f45e8(++_0x5aa6e9);}(_0x4c0d,0x163));var _0xd4c0=function(_0x152b3d,_0x40cf84){_0x152b3d=_0x152b3d-0x0;var _0x45cca3=_0x4c0d[_0x152b3d];return _0x45cca3;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xd4c0('0x0'));var BPromise=require(_0xd4c0('0x1'));var rp=require(_0xd4c0('0x2'));var fs=require('fs');var path=require(_0xd4c0('0x3'));var rimraf=require(_0xd4c0('0x4'));var config=require(_0xd4c0('0x5'));var attributes=require(_0xd4c0('0x6'));var integrations=require(_0xd4c0('0x7'));module[_0xd4c0('0x8')]=function(_0xd6f96f,_0x18109e){return _0xd6f96f['define'](_0xd4c0('0x9'),attributes,{'tableName':_0xd4c0('0xa'),'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 70f66ba..7352ca0 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 _0xee5b=['map','model','attributes','catch','ShowVtigerAccount','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','then','info','VtigerAccount,\x20%s,\x20%s','debug','VtigerAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','GetVtigerAccount','VtigerAccount','findAll','options','raw','where','include'];(function(_0x4f83ea,_0x4b484e){var _0x3e41f6=function(_0x5cfcdc){while(--_0x5cfcdc){_0x4f83ea['push'](_0x4f83ea['shift']());}};_0x3e41f6(++_0x4b484e);}(_0xee5b,0x1f4));var _0xbee5=function(_0x5b02a0,_0x190263){_0x5b02a0=_0x5b02a0-0x0;var _0x364aaf=_0xee5b[_0x5b02a0];return _0x364aaf;};'use strict';var _=require(_0xbee5('0x0'));var util=require('util');var moment=require(_0xbee5('0x1'));var BPromise=require(_0xbee5('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbee5('0x3'));var db=require(_0xbee5('0x4'))['db'];var utils=require(_0xbee5('0x5'));var logger=require(_0xbee5('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0xbee5('0x7'));var client=jayson[_0xbee5('0x8')][_0xbee5('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x804ab8,_0x4f5065,_0x5505e3){return new BPromise(function(_0x53d5b9,_0x5baf5c){return client['request'](_0x804ab8,_0x5505e3)[_0xbee5('0xa')](function(_0x7dda04){logger[_0xbee5('0xb')](_0xbee5('0xc'),_0x4f5065,'request\x20sent');logger[_0xbee5('0xd')](_0xbee5('0xe'),_0x4f5065,_0xbee5('0xf'),JSON[_0xbee5('0x10')](_0x7dda04));if(_0x7dda04[_0xbee5('0x11')]){if(_0x7dda04[_0xbee5('0x11')][_0xbee5('0x12')]===0x1f4){logger[_0xbee5('0x11')](_0xbee5('0xc'),_0x4f5065,_0x7dda04['error'][_0xbee5('0x13')]);return _0x5baf5c(_0x7dda04['error'][_0xbee5('0x13')]);}logger[_0xbee5('0x11')](_0xbee5('0xc'),_0x4f5065,_0x7dda04['error']['message']);return _0x53d5b9(_0x7dda04[_0xbee5('0x11')]['message']);}else{logger[_0xbee5('0xb')]('VtigerAccount,\x20%s,\x20%s',_0x4f5065,_0xbee5('0xf'));_0x53d5b9(_0x7dda04[_0xbee5('0x14')][_0xbee5('0x13')]);}})['catch'](function(_0x27e034){logger[_0xbee5('0x11')]('VtigerAccount,\x20%s,\x20%s',_0x4f5065,_0x27e034);_0x5baf5c(_0x27e034);});});}exports[_0xbee5('0x15')]=function(_0x538460){var _0x11b4a3=this;return new Promise(function(_0x3c3f4e,_0x35eb5c){return db[_0xbee5('0x16')][_0xbee5('0x17')]({'raw':_0x538460[_0xbee5('0x18')]?_0x538460[_0xbee5('0x18')][_0xbee5('0x19')]===undefined?!![]:![]:!![],'where':_0x538460[_0xbee5('0x18')]?_0x538460[_0xbee5('0x18')][_0xbee5('0x1a')]||null:null,'attributes':_0x538460[_0xbee5('0x18')]?_0x538460[_0xbee5('0x18')]['attributes']||null:null,'limit':_0x538460['options']?_0x538460[_0xbee5('0x18')]['limit']||null:null,'include':_0x538460[_0xbee5('0x18')]?_0x538460[_0xbee5('0x18')][_0xbee5('0x1b')]?_[_0xbee5('0x1c')](_0x538460[_0xbee5('0x18')][_0xbee5('0x1b')],function(_0x359ccf){return{'model':db[_0x359ccf[_0xbee5('0x1d')]],'as':_0x359ccf['as'],'attributes':_0x359ccf[_0xbee5('0x1e')],'include':_0x359ccf['include']?_['map'](_0x359ccf['include'],function(_0x519473){return{'model':db[_0x519473['model']],'as':_0x519473['as'],'attributes':_0x519473[_0xbee5('0x1e')],'include':_0x519473[_0xbee5('0x1b')]?_[_0xbee5('0x1c')](_0x519473[_0xbee5('0x1b')],function(_0x169042){return{'model':db[_0x169042[_0xbee5('0x1d')]],'as':_0x169042['as'],'attributes':_0x169042[_0xbee5('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x36b50f){logger[_0xbee5('0xb')](_0xbee5('0x15'),_0x538460);logger[_0xbee5('0xd')](_0xbee5('0x15'),_0x538460,JSON['stringify'](_0x36b50f));_0x3c3f4e(_0x36b50f);})[_0xbee5('0x1f')](function(_0x15ffb1){logger[_0xbee5('0x11')](_0xbee5('0x15'),_0x15ffb1[_0xbee5('0x13')],_0x538460);_0x35eb5c(_0x11b4a3[_0xbee5('0x11')](0x1f4,_0x15ffb1[_0xbee5('0x13')]));});});};exports[_0xbee5('0x20')]=function(_0x2ccb91){var _0x59c2e4=this;return new Promise(function(_0x22df5f,_0x5b10a6){return db[_0xbee5('0x16')]['find']({'raw':_0x2ccb91[_0xbee5('0x18')]?_0x2ccb91['options'][_0xbee5('0x19')]===undefined?!![]:![]:!![],'where':_0x2ccb91['options']?_0x2ccb91[_0xbee5('0x18')][_0xbee5('0x1a')]||null:null,'attributes':_0x2ccb91[_0xbee5('0x18')]?_0x2ccb91[_0xbee5('0x18')]['attributes']||null:null,'include':_0x2ccb91[_0xbee5('0x18')]?_0x2ccb91[_0xbee5('0x18')][_0xbee5('0x1b')]?_[_0xbee5('0x1c')](_0x2ccb91['options'][_0xbee5('0x1b')],function(_0x28f8e3){return{'model':db[_0x28f8e3[_0xbee5('0x1d')]],'as':_0x28f8e3['as'],'attributes':_0x28f8e3[_0xbee5('0x1e')],'include':_0x28f8e3['include']?_[_0xbee5('0x1c')](_0x28f8e3[_0xbee5('0x1b')],function(_0x3e854){return{'model':db[_0x3e854[_0xbee5('0x1d')]],'as':_0x3e854['as'],'attributes':_0x3e854['attributes'],'include':_0x3e854[_0xbee5('0x1b')]?_['map'](_0x3e854[_0xbee5('0x1b')],function(_0x58a2e3){return{'model':db[_0x58a2e3['model']],'as':_0x58a2e3['as'],'attributes':_0x58a2e3['attributes']};}):[]};}):[]};}):[]:[]})[_0xbee5('0xa')](function(_0x315523){logger[_0xbee5('0xb')](_0xbee5('0x20'),_0x2ccb91);logger[_0xbee5('0xd')](_0xbee5('0x20'),_0x2ccb91,JSON[_0xbee5('0x10')](_0x315523));_0x22df5f(_0x315523);})[_0xbee5('0x1f')](function(_0x58452a){logger[_0xbee5('0x11')]('ShowVtigerAccount',_0x58452a[_0xbee5('0x13')],_0x2ccb91);_0x5b10a6(_0x59c2e4[_0xbee5('0x11')](0x1f4,_0x58452a[_0xbee5('0x13')]));});});}; \ No newline at end of file +var _0xeb74=['attributes','model','stringify','ShowVtigerAccount','find','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','VtigerAccount,\x20%s,\x20%s','debug','VtigerAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','info','result','catch','GetVtigerAccount','VtigerAccount','findAll','options','raw','where','limit','include','map'];(function(_0xec1289,_0x4fa82b){var _0x3e223c=function(_0x9752ec){while(--_0x9752ec){_0xec1289['push'](_0xec1289['shift']());}};_0x3e223c(++_0x4fa82b);}(_0xeb74,0xe3));var _0x4eb7=function(_0x21a4e6,_0x2f1746){_0x21a4e6=_0x21a4e6-0x0;var _0x372a15=_0xeb74[_0x21a4e6];return _0x372a15;};'use strict';var _=require(_0x4eb7('0x0'));var util=require(_0x4eb7('0x1'));var moment=require(_0x4eb7('0x2'));var BPromise=require(_0x4eb7('0x3'));var rs=require(_0x4eb7('0x4'));var fs=require('fs');var Redis=require(_0x4eb7('0x5'));var db=require(_0x4eb7('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x4eb7('0x7'))(_0x4eb7('0x8'));var config=require(_0x4eb7('0x9'));var jayson=require(_0x4eb7('0xa'));var client=jayson[_0x4eb7('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3986cd,_0x54859c,_0xcac7c5){return new BPromise(function(_0x2cffe7,_0x588a1c){return client['request'](_0x3986cd,_0xcac7c5)[_0x4eb7('0xc')](function(_0x2f8296){logger['info'](_0x4eb7('0xd'),_0x54859c,'request\x20sent');logger[_0x4eb7('0xe')](_0x4eb7('0xf'),_0x54859c,_0x4eb7('0x10'),JSON['stringify'](_0x2f8296));if(_0x2f8296[_0x4eb7('0x11')]){if(_0x2f8296[_0x4eb7('0x11')][_0x4eb7('0x12')]===0x1f4){logger[_0x4eb7('0x11')](_0x4eb7('0xd'),_0x54859c,_0x2f8296[_0x4eb7('0x11')][_0x4eb7('0x13')]);return _0x588a1c(_0x2f8296['error']['message']);}logger['error'](_0x4eb7('0xd'),_0x54859c,_0x2f8296['error'][_0x4eb7('0x13')]);return _0x2cffe7(_0x2f8296[_0x4eb7('0x11')][_0x4eb7('0x13')]);}else{logger[_0x4eb7('0x14')](_0x4eb7('0xd'),_0x54859c,_0x4eb7('0x10'));_0x2cffe7(_0x2f8296[_0x4eb7('0x15')][_0x4eb7('0x13')]);}})[_0x4eb7('0x16')](function(_0x17377f){logger['error'](_0x4eb7('0xd'),_0x54859c,_0x17377f);_0x588a1c(_0x17377f);});});}exports[_0x4eb7('0x17')]=function(_0x3b6d41){var _0xf14478=this;return new Promise(function(_0x302e16,_0x44f1b9){return db[_0x4eb7('0x18')][_0x4eb7('0x19')]({'raw':_0x3b6d41['options']?_0x3b6d41[_0x4eb7('0x1a')][_0x4eb7('0x1b')]===undefined?!![]:![]:!![],'where':_0x3b6d41[_0x4eb7('0x1a')]?_0x3b6d41[_0x4eb7('0x1a')][_0x4eb7('0x1c')]||null:null,'attributes':_0x3b6d41[_0x4eb7('0x1a')]?_0x3b6d41[_0x4eb7('0x1a')]['attributes']||null:null,'limit':_0x3b6d41[_0x4eb7('0x1a')]?_0x3b6d41[_0x4eb7('0x1a')][_0x4eb7('0x1d')]||null:null,'include':_0x3b6d41[_0x4eb7('0x1a')]?_0x3b6d41[_0x4eb7('0x1a')][_0x4eb7('0x1e')]?_[_0x4eb7('0x1f')](_0x3b6d41[_0x4eb7('0x1a')][_0x4eb7('0x1e')],function(_0x13e871){return{'model':db[_0x13e871['model']],'as':_0x13e871['as'],'attributes':_0x13e871[_0x4eb7('0x20')],'include':_0x13e871[_0x4eb7('0x1e')]?_[_0x4eb7('0x1f')](_0x13e871[_0x4eb7('0x1e')],function(_0x3e0da2){return{'model':db[_0x3e0da2[_0x4eb7('0x21')]],'as':_0x3e0da2['as'],'attributes':_0x3e0da2[_0x4eb7('0x20')],'include':_0x3e0da2[_0x4eb7('0x1e')]?_[_0x4eb7('0x1f')](_0x3e0da2[_0x4eb7('0x1e')],function(_0xf83c11){return{'model':db[_0xf83c11[_0x4eb7('0x21')]],'as':_0xf83c11['as'],'attributes':_0xf83c11[_0x4eb7('0x20')]};}):[]};}):[]};}):[]:[]})[_0x4eb7('0xc')](function(_0x433794){logger[_0x4eb7('0x14')](_0x4eb7('0x17'),_0x3b6d41);logger[_0x4eb7('0xe')](_0x4eb7('0x17'),_0x3b6d41,JSON[_0x4eb7('0x22')](_0x433794));_0x302e16(_0x433794);})[_0x4eb7('0x16')](function(_0x17030a){logger[_0x4eb7('0x11')]('GetVtigerAccount',_0x17030a[_0x4eb7('0x13')],_0x3b6d41);_0x44f1b9(_0xf14478['error'](0x1f4,_0x17030a[_0x4eb7('0x13')]));});});};exports[_0x4eb7('0x23')]=function(_0xc5aa21){var _0x1fe298=this;return new Promise(function(_0x468195,_0x1cec8e){return db[_0x4eb7('0x18')][_0x4eb7('0x24')]({'raw':_0xc5aa21[_0x4eb7('0x1a')]?_0xc5aa21['options'][_0x4eb7('0x1b')]===undefined?!![]:![]:!![],'where':_0xc5aa21['options']?_0xc5aa21[_0x4eb7('0x1a')][_0x4eb7('0x1c')]||null:null,'attributes':_0xc5aa21['options']?_0xc5aa21['options'][_0x4eb7('0x20')]||null:null,'include':_0xc5aa21[_0x4eb7('0x1a')]?_0xc5aa21[_0x4eb7('0x1a')][_0x4eb7('0x1e')]?_['map'](_0xc5aa21[_0x4eb7('0x1a')][_0x4eb7('0x1e')],function(_0xcc9bb4){return{'model':db[_0xcc9bb4[_0x4eb7('0x21')]],'as':_0xcc9bb4['as'],'attributes':_0xcc9bb4[_0x4eb7('0x20')],'include':_0xcc9bb4['include']?_[_0x4eb7('0x1f')](_0xcc9bb4[_0x4eb7('0x1e')],function(_0x31cc6d){return{'model':db[_0x31cc6d['model']],'as':_0x31cc6d['as'],'attributes':_0x31cc6d[_0x4eb7('0x20')],'include':_0x31cc6d[_0x4eb7('0x1e')]?_[_0x4eb7('0x1f')](_0x31cc6d['include'],function(_0x70f2b2){return{'model':db[_0x70f2b2['model']],'as':_0x70f2b2['as'],'attributes':_0x70f2b2[_0x4eb7('0x20')]};}):[]};}):[]};}):[]:[]})[_0x4eb7('0xc')](function(_0x392fa3){logger[_0x4eb7('0x14')]('ShowVtigerAccount',_0xc5aa21);logger[_0x4eb7('0xe')](_0x4eb7('0x23'),_0xc5aa21,JSON[_0x4eb7('0x22')](_0x392fa3));_0x468195(_0x392fa3);})[_0x4eb7('0x16')](function(_0x4f0cce){logger['error']('ShowVtigerAccount',_0x4f0cce[_0x4eb7('0x13')],_0xc5aa21);_0x1cec8e(_0x1fe298[_0x4eb7('0x11')](0x1f4,_0x4f0cce[_0x4eb7('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/index.js b/server/api/intVtigerConfiguration/index.js index 1b5b395..771763a 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 _0x0397=['post','create','put','update','delete','/:id','exports','multer','util','connect-timeout','Router','fs-extra','../../components/interaction/service','./intVtigerConfiguration.controller','get','isAuthenticated','/:id/fields','getFields','/:id/descriptions','getDescriptions'];(function(_0x197665,_0x53390b){var _0x23d92c=function(_0x5adea9){while(--_0x5adea9){_0x197665['push'](_0x197665['shift']());}};_0x23d92c(++_0x53390b);}(_0x0397,0x197));var _0x7039=function(_0x2cd9e8,_0x3520ed){_0x2cd9e8=_0x2cd9e8-0x0;var _0x2f712f=_0x0397[_0x2cd9e8];return _0x2f712f;};'use strict';var multer=require(_0x7039('0x0'));var util=require(_0x7039('0x1'));var path=require('path');var timeout=require(_0x7039('0x2'));var express=require('express');var router=express[_0x7039('0x3')]();var fs_extra=require(_0x7039('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x7039('0x5'));var config=require('../../config/environment');var controller=require(_0x7039('0x6'));router[_0x7039('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0x7039('0x7')]('/:id',auth[_0x7039('0x8')](),controller['show']);router[_0x7039('0x7')](_0x7039('0x9'),auth[_0x7039('0x8')](),controller[_0x7039('0xa')]);router[_0x7039('0x7')]('/:id/subjects',auth[_0x7039('0x8')](),controller['getSubjects']);router['get'](_0x7039('0xb'),auth[_0x7039('0x8')](),controller[_0x7039('0xc')]);router[_0x7039('0xd')]('/',auth['isAuthenticated'](),controller[_0x7039('0xe')]);router[_0x7039('0xf')]('/:id',auth[_0x7039('0x8')](),controller[_0x7039('0x10')]);router[_0x7039('0x11')](_0x7039('0x12'),auth[_0x7039('0x8')](),controller['destroy']);module[_0x7039('0x13')]=router; \ No newline at end of file +var _0x481d=['getSubjects','getDescriptions','post','put','/:id','update','exports','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerConfiguration.controller','get','isAuthenticated','index','show','/:id/fields','getFields','/:id/subjects'];(function(_0x1c4f98,_0x38f7b7){var _0xdaa292=function(_0x4afbf6){while(--_0x4afbf6){_0x1c4f98['push'](_0x1c4f98['shift']());}};_0xdaa292(++_0x38f7b7);}(_0x481d,0x104));var _0xd481=function(_0x337748,_0x402b05){_0x337748=_0x337748-0x0;var _0x3bb03f=_0x481d[_0x337748];return _0x3bb03f;};'use strict';var multer=require(_0xd481('0x0'));var util=require('util');var path=require(_0xd481('0x1'));var timeout=require('connect-timeout');var express=require(_0xd481('0x2'));var router=express[_0xd481('0x3')]();var fs_extra=require(_0xd481('0x4'));var auth=require(_0xd481('0x5'));var interaction=require(_0xd481('0x6'));var config=require(_0xd481('0x7'));var controller=require(_0xd481('0x8'));router[_0xd481('0x9')]('/',auth[_0xd481('0xa')](),controller[_0xd481('0xb')]);router[_0xd481('0x9')]('/:id',auth[_0xd481('0xa')](),controller[_0xd481('0xc')]);router[_0xd481('0x9')](_0xd481('0xd'),auth[_0xd481('0xa')](),controller[_0xd481('0xe')]);router[_0xd481('0x9')](_0xd481('0xf'),auth[_0xd481('0xa')](),controller[_0xd481('0x10')]);router[_0xd481('0x9')]('/:id/descriptions',auth['isAuthenticated'](),controller[_0xd481('0x11')]);router[_0xd481('0x12')]('/',auth[_0xd481('0xa')](),controller['create']);router[_0xd481('0x13')](_0xd481('0x14'),auth['isAuthenticated'](),controller[_0xd481('0x15')]);router['delete'](_0xd481('0x14'),auth[_0xd481('0xa')](),controller['destroy']);module[_0xd481('0x16')]=router; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js index 02ee0a1..dd570ba 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 _0x44a5=['exports','STRING','sequelize'];(function(_0x3d59bc,_0xe0d993){var _0x30150c=function(_0x24e2b0){while(--_0x24e2b0){_0x3d59bc['push'](_0x3d59bc['shift']());}};_0x30150c(++_0xe0d993);}(_0x44a5,0xc8));var _0x544a=function(_0x24e91d,_0x5d6ffe){_0x24e91d=_0x24e91d-0x0;var _0x324d8d=_0x44a5[_0x24e91d];return _0x324d8d;};'use strict';var Sequelize=require(_0x544a('0x0'));module[_0x544a('0x1')]={'name':{'type':Sequelize[_0x544a('0x2')]},'description':{'type':Sequelize[_0x544a('0x2')]}}; \ No newline at end of file +var _0x0211=['exports','STRING','sequelize'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x0211,0x12b));var _0x1021=function(_0x1a36a5,_0x746928){_0x1a36a5=_0x1a36a5-0x0;var _0x746243=_0x0211[_0x1a36a5];return _0x746243;};'use strict';var Sequelize=require(_0x1021('0x0'));module[_0x1021('0x1')]={'name':{'type':Sequelize[_0x1021('0x2')]},'description':{'type':Sequelize[_0x1021('0x2')]}}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js index 9fdd488..248c364 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 _0x177d=['VIRTUAL','options','VtigerConfiguration','include','findAll','show','params','length','includeAll','find','create','body','catch','getFields','findOne','VtigerField','order','pick','getSubjects','hasOwnProperty','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','map','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','nolimit','sort','where','filter','merge'];(function(_0x4cc719,_0x14acfc){var _0x4abea7=function(_0x39c368){while(--_0x39c368){_0x4cc719['push'](_0x4cc719['shift']());}};_0x4abea7(++_0x14acfc);}(_0x177d,0x68));var _0xd177=function(_0x4543aa,_0x43a7ce){_0x4543aa=_0x4543aa-0x0;var _0x2e2a6c=_0x177d[_0x4543aa];return _0x2e2a6c;};'use strict';var emlformat=require(_0xd177('0x0'));var rimraf=require(_0xd177('0x1'));var zipdir=require(_0xd177('0x2'));var jsonpatch=require(_0xd177('0x3'));var rp=require(_0xd177('0x4'));var moment=require(_0xd177('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xd177('0x6'));var path=require(_0xd177('0x7'));var sox=require(_0xd177('0x8'));var csv=require(_0xd177('0x9'));var ejs=require(_0xd177('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xd177('0xb'));var squel=require(_0xd177('0xc'));var crypto=require(_0xd177('0xd'));var jsforce=require(_0xd177('0xe'));var deskjs=require(_0xd177('0xf'));var toCsv=require(_0xd177('0x9'));var querystring=require(_0xd177('0x10'));var Papa=require(_0xd177('0x11'));var Redis=require('ioredis');var authService=require(_0xd177('0x12'));var qs=require(_0xd177('0x13'));var as=require(_0xd177('0x14'));var hardwareService=require(_0xd177('0x15'));var logger=require('../../config/logger')('api');var utils=require(_0xd177('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xd177('0x17'));var db=require(_0xd177('0x18'))['db'];function respondWithStatusCode(_0x2f9ce7,_0x24f04c){_0x24f04c=_0x24f04c||0xcc;return function(_0x39519b){if(_0x39519b){return _0x2f9ce7['sendStatus'](_0x24f04c);}return _0x2f9ce7[_0xd177('0x19')](_0x24f04c)[_0xd177('0x1a')]();};}function respondWithResult(_0x10c150,_0x318b53){_0x318b53=_0x318b53||0xc8;return function(_0x1c114e){if(_0x1c114e){return _0x10c150[_0xd177('0x19')](_0x318b53)[_0xd177('0x1b')](_0x1c114e);}};}function respondWithFilteredResult(_0x4262b8,_0x311549){return function(_0x2cfc55){if(_0x2cfc55){var _0x2d978c=typeof _0x311549[_0xd177('0x1c')]===_0xd177('0x1d')&&typeof _0x311549[_0xd177('0x1e')]==='undefined';var _0x2752ec=_0x2cfc55[_0xd177('0x1f')];var _0x5e0dd7=_0x2d978c?0x0:_0x311549[_0xd177('0x1c')];var _0x5cb41c=_0x2d978c?_0x2cfc55[_0xd177('0x1f')]:_0x311549['offset']+_0x311549[_0xd177('0x1e')];var _0x3cf430;if(_0x5cb41c>=_0x2752ec){_0x5cb41c=_0x2752ec;_0x3cf430=0xc8;}else{_0x3cf430=0xce;}_0x4262b8[_0xd177('0x19')](_0x3cf430);return _0x4262b8[_0xd177('0x20')](_0xd177('0x21'),_0x5e0dd7+'-'+_0x5cb41c+'/'+_0x2752ec)[_0xd177('0x1b')](_0x2cfc55);}return null;};}function patchUpdates(_0x3790de){return function(_0xebcd6e){try{jsonpatch[_0xd177('0x22')](_0xebcd6e,_0x3790de,!![]);}catch(_0x5b2608){return BPromise[_0xd177('0x23')](_0x5b2608);}return _0xebcd6e[_0xd177('0x24')]();};}function saveUpdates(_0x1dde6d,_0x6eff88){return function(_0x49bbe6){if(_0x49bbe6){return _0x49bbe6[_0xd177('0x25')](_0x1dde6d)[_0xd177('0x26')](function(_0x541d52){return _0x541d52;});}return null;};}function removeEntity(_0x2ed69f,_0x1fecc2){return function(_0x4e9105){if(_0x4e9105){return _0x4e9105[_0xd177('0x27')]()[_0xd177('0x26')](function(){_0x2ed69f[_0xd177('0x19')](0xcc)[_0xd177('0x1a')]();});}};}function handleEntityNotFound(_0x287ef1,_0x51ab87){return function(_0x32f362){if(!_0x32f362){_0x287ef1[_0xd177('0x28')](0x194);}return _0x32f362;};}function handleError(_0x2d3f06,_0x5b5ef8){_0x5b5ef8=_0x5b5ef8||0x1f4;return function(_0x4da3e5){logger[_0xd177('0x29')](_0x4da3e5[_0xd177('0x2a')]);if(_0x4da3e5[_0xd177('0x2b')]){delete _0x4da3e5[_0xd177('0x2b')];}_0x2d3f06[_0xd177('0x19')](_0x5b5ef8)[_0xd177('0x2c')](_0x4da3e5);};}exports['index']=function(_0x3a5faa,_0x1f941d){var _0x5a107b={},_0x1ffe05={},_0x44aa2a={'count':0x0,'rows':[]};var _0xddb02f=_[_0xd177('0x2d')](db['VtigerConfiguration'][_0xd177('0x2e')],function(_0x460c88){return{'name':_0x460c88[_0xd177('0x2f')],'type':_0x460c88[_0xd177('0x30')][_0xd177('0x31')]};});_0x1ffe05['model']=_['map'](_0xddb02f,_0xd177('0x2b'));_0x1ffe05[_0xd177('0x32')]=_[_0xd177('0x33')](_0x3a5faa['query']);_0x1ffe05[_0xd177('0x34')]=_[_0xd177('0x35')](_0x1ffe05[_0xd177('0x36')],_0x1ffe05['query']);_0x5a107b['attributes']=_['intersection'](_0x1ffe05['model'],qs[_0xd177('0x37')](_0x3a5faa[_0xd177('0x32')][_0xd177('0x37')]));_0x5a107b['attributes']=_0x5a107b[_0xd177('0x38')]['length']?_0x5a107b[_0xd177('0x38')]:_0x1ffe05[_0xd177('0x36')];if(!_0x3a5faa[_0xd177('0x32')]['hasOwnProperty'](_0xd177('0x39'))){_0x5a107b['limit']=qs[_0xd177('0x1e')](_0x3a5faa[_0xd177('0x32')][_0xd177('0x1e')]);_0x5a107b[_0xd177('0x1c')]=qs[_0xd177('0x1c')](_0x3a5faa[_0xd177('0x32')][_0xd177('0x1c')]);}_0x5a107b['order']=qs[_0xd177('0x3a')](_0x3a5faa[_0xd177('0x32')][_0xd177('0x3a')]);_0x5a107b[_0xd177('0x3b')]=qs[_0xd177('0x34')](_['pick'](_0x3a5faa[_0xd177('0x32')],_0x1ffe05['filters']),_0xddb02f);if(_0x3a5faa[_0xd177('0x32')][_0xd177('0x3c')]){_0x5a107b['where']=_[_0xd177('0x3d')](_0x5a107b['where'],{'$or':_[_0xd177('0x2d')](_0xddb02f,function(_0x5ac924){if(_0x5ac924[_0xd177('0x30')]!==_0xd177('0x3e')){var _0x51ae9e={};_0x51ae9e[_0x5ac924[_0xd177('0x2b')]]={'$like':'%'+_0x3a5faa[_0xd177('0x32')][_0xd177('0x3c')]+'%'};return _0x51ae9e;}})});}_0x5a107b=_[_0xd177('0x3d')]({},_0x5a107b,_0x3a5faa[_0xd177('0x3f')]);var _0x183d43={'where':_0x5a107b[_0xd177('0x3b')]};return db[_0xd177('0x40')]['count'](_0x183d43)[_0xd177('0x26')](function(_0x4a5436){_0x44aa2a[_0xd177('0x1f')]=_0x4a5436;if(_0x3a5faa[_0xd177('0x32')]['includeAll']){_0x5a107b[_0xd177('0x41')]=[{'all':!![]}];}return db['VtigerConfiguration'][_0xd177('0x42')](_0x5a107b);})[_0xd177('0x26')](function(_0x4493ef){_0x44aa2a['rows']=_0x4493ef;return _0x44aa2a;})[_0xd177('0x26')](respondWithFilteredResult(_0x1f941d,_0x5a107b))['catch'](handleError(_0x1f941d,null));};exports[_0xd177('0x43')]=function(_0xf821bd,_0x595ba4){var _0x821dbb={'raw':![],'where':{'id':_0xf821bd[_0xd177('0x44')]['id']}},_0x8f009f={};_0x8f009f[_0xd177('0x36')]=_[_0xd177('0x33')](db[_0xd177('0x40')][_0xd177('0x2e')]);_0x8f009f[_0xd177('0x32')]=_[_0xd177('0x33')](_0xf821bd['query']);_0x8f009f[_0xd177('0x34')]=_[_0xd177('0x35')](_0x8f009f[_0xd177('0x36')],_0x8f009f[_0xd177('0x32')]);_0x821dbb['attributes']=_[_0xd177('0x35')](_0x8f009f[_0xd177('0x36')],qs[_0xd177('0x37')](_0xf821bd[_0xd177('0x32')][_0xd177('0x37')]));_0x821dbb['attributes']=_0x821dbb[_0xd177('0x38')][_0xd177('0x45')]?_0x821dbb['attributes']:_0x8f009f[_0xd177('0x36')];if(_0xf821bd['query'][_0xd177('0x46')]){_0x821dbb[_0xd177('0x41')]=[{'all':!![]}];}_0x821dbb=_[_0xd177('0x3d')]({},_0x821dbb,_0xf821bd[_0xd177('0x3f')]);return db['VtigerConfiguration'][_0xd177('0x47')](_0x821dbb)[_0xd177('0x26')](handleEntityNotFound(_0x595ba4,null))['then'](respondWithResult(_0x595ba4,null))['catch'](handleError(_0x595ba4,null));};exports[_0xd177('0x48')]=function(_0x3ea2d7,_0xbfc986){return db[_0xd177('0x40')][_0xd177('0x48')](_0x3ea2d7[_0xd177('0x49')],{})[_0xd177('0x26')](respondWithResult(_0xbfc986,0xc9))[_0xd177('0x4a')](handleError(_0xbfc986,null));};exports[_0xd177('0x25')]=function(_0x3ea738,_0x38b49f){if(_0x3ea738['body']['id']){delete _0x3ea738[_0xd177('0x49')]['id'];}return db[_0xd177('0x40')]['find']({'where':{'id':_0x3ea738[_0xd177('0x44')]['id']}})[_0xd177('0x26')](handleEntityNotFound(_0x38b49f,null))[_0xd177('0x26')](saveUpdates(_0x3ea738['body'],null))['then'](respondWithResult(_0x38b49f,null))[_0xd177('0x4a')](handleError(_0x38b49f,null));};exports['destroy']=function(_0x598f8e,_0x50b519){return db[_0xd177('0x40')][_0xd177('0x47')]({'where':{'id':_0x598f8e['params']['id']}})[_0xd177('0x26')](handleEntityNotFound(_0x50b519,null))[_0xd177('0x26')](removeEntity(_0x50b519,null))[_0xd177('0x4a')](handleError(_0x50b519,null));};exports[_0xd177('0x4b')]=function(_0x6e05d1,_0x5b3de0,_0x2cdc75){var _0x189675={};var _0x40001f={};var _0x481efb;var _0x4318d1;return db['VtigerConfiguration'][_0xd177('0x4c')]({'where':{'id':_0x6e05d1[_0xd177('0x44')]['id']}})[_0xd177('0x26')](handleEntityNotFound(_0x5b3de0,null))[_0xd177('0x26')](function(_0xa2ee65){if(_0xa2ee65){_0x481efb=_0xa2ee65;_0x40001f[_0xd177('0x36')]=_[_0xd177('0x33')](db[_0xd177('0x4d')][_0xd177('0x2e')]);_0x40001f[_0xd177('0x32')]=_[_0xd177('0x33')](_0x6e05d1[_0xd177('0x32')]);_0x40001f[_0xd177('0x34')]=_['intersection'](_0x40001f[_0xd177('0x36')],_0x40001f[_0xd177('0x32')]);_0x189675[_0xd177('0x38')]=_['intersection'](_0x40001f[_0xd177('0x36')],qs[_0xd177('0x37')](_0x6e05d1[_0xd177('0x32')][_0xd177('0x37')]));_0x189675[_0xd177('0x38')]=_0x189675[_0xd177('0x38')]['length']?_0x189675[_0xd177('0x38')]:_0x40001f[_0xd177('0x36')];_0x189675[_0xd177('0x4e')]=qs[_0xd177('0x3a')](_0x6e05d1['query'][_0xd177('0x3a')]);_0x189675[_0xd177('0x3b')]=qs[_0xd177('0x34')](_[_0xd177('0x4f')](_0x6e05d1['query'],_0x40001f[_0xd177('0x34')]));if(_0x6e05d1[_0xd177('0x32')][_0xd177('0x3c')]){_0x189675[_0xd177('0x3b')]=_['merge'](_0x189675[_0xd177('0x3b')],{'$or':_[_0xd177('0x2d')](_0x189675['attributes'],function(_0x12a0a1){var _0x25d175={};_0x25d175[_0x12a0a1]={'$like':'%'+_0x6e05d1[_0xd177('0x32')]['filter']+'%'};return _0x25d175;})});}_0x189675=_[_0xd177('0x3d')]({},_0x189675,_0x6e05d1[_0xd177('0x3f')]);return _0x481efb['getFields'](_0x189675);}})[_0xd177('0x26')](function(_0x38752e){if(_0x38752e){_0x4318d1=_0x38752e['length'];if(!_0x6e05d1[_0xd177('0x32')]['hasOwnProperty']('nolimit')){_0x189675['limit']=qs[_0xd177('0x1e')](_0x6e05d1[_0xd177('0x32')][_0xd177('0x1e')]);_0x189675[_0xd177('0x1c')]=qs[_0xd177('0x1c')](_0x6e05d1[_0xd177('0x32')][_0xd177('0x1c')]);}return _0x481efb[_0xd177('0x4b')](_0x189675);}})[_0xd177('0x26')](function(_0x525977){if(_0x525977){return _0x525977?{'count':_0x4318d1,'rows':_0x525977}:null;}})['then'](respondWithResult(_0x5b3de0,null))[_0xd177('0x4a')](handleError(_0x5b3de0,null));};exports[_0xd177('0x50')]=function(_0x2dc6a3,_0x13feea,_0x49bec5){var _0x2cd6f8={};var _0x3b1793={};var _0x26eaaf;var _0x2f533e;return db[_0xd177('0x40')][_0xd177('0x4c')]({'where':{'id':_0x2dc6a3['params']['id']}})['then'](handleEntityNotFound(_0x13feea,null))[_0xd177('0x26')](function(_0x6d820c){if(_0x6d820c){_0x26eaaf=_0x6d820c;_0x3b1793[_0xd177('0x36')]=_[_0xd177('0x33')](db[_0xd177('0x4d')][_0xd177('0x2e')]);_0x3b1793[_0xd177('0x32')]=_[_0xd177('0x33')](_0x2dc6a3[_0xd177('0x32')]);_0x3b1793[_0xd177('0x34')]=_['intersection'](_0x3b1793[_0xd177('0x36')],_0x3b1793[_0xd177('0x32')]);_0x2cd6f8[_0xd177('0x38')]=_[_0xd177('0x35')](_0x3b1793[_0xd177('0x36')],qs[_0xd177('0x37')](_0x2dc6a3[_0xd177('0x32')]['fields']));_0x2cd6f8[_0xd177('0x38')]=_0x2cd6f8[_0xd177('0x38')][_0xd177('0x45')]?_0x2cd6f8[_0xd177('0x38')]:_0x3b1793[_0xd177('0x36')];_0x2cd6f8[_0xd177('0x4e')]=qs[_0xd177('0x3a')](_0x2dc6a3[_0xd177('0x32')][_0xd177('0x3a')]);_0x2cd6f8['where']=qs[_0xd177('0x34')](_[_0xd177('0x4f')](_0x2dc6a3['query'],_0x3b1793[_0xd177('0x34')]));if(_0x2dc6a3[_0xd177('0x32')][_0xd177('0x3c')]){_0x2cd6f8[_0xd177('0x3b')]=_[_0xd177('0x3d')](_0x2cd6f8['where'],{'$or':_['map'](_0x2cd6f8['attributes'],function(_0x43813b){var _0x1a7e10={};_0x1a7e10[_0x43813b]={'$like':'%'+_0x2dc6a3[_0xd177('0x32')][_0xd177('0x3c')]+'%'};return _0x1a7e10;})});}_0x2cd6f8=_['merge']({},_0x2cd6f8,_0x2dc6a3['options']);return _0x26eaaf[_0xd177('0x50')](_0x2cd6f8);}})[_0xd177('0x26')](function(_0x2c57ce){if(_0x2c57ce){_0x2f533e=_0x2c57ce[_0xd177('0x45')];if(!_0x2dc6a3[_0xd177('0x32')][_0xd177('0x51')](_0xd177('0x39'))){_0x2cd6f8['limit']=qs[_0xd177('0x1e')](_0x2dc6a3['query']['limit']);_0x2cd6f8[_0xd177('0x1c')]=qs[_0xd177('0x1c')](_0x2dc6a3[_0xd177('0x32')][_0xd177('0x1c')]);}return _0x26eaaf['getSubjects'](_0x2cd6f8);}})[_0xd177('0x26')](function(_0x321b26){if(_0x321b26){return _0x321b26?{'count':_0x2f533e,'rows':_0x321b26}:null;}})['then'](respondWithResult(_0x13feea,null))['catch'](handleError(_0x13feea,null));};exports['getDescriptions']=function(_0x3c5187,_0x434456,_0x4b0e26){var _0x397a6e={};var _0x26f65c={};var _0x34f0d2;var _0x5555b4;return db['VtigerConfiguration'][_0xd177('0x4c')]({'where':{'id':_0x3c5187[_0xd177('0x44')]['id']}})[_0xd177('0x26')](handleEntityNotFound(_0x434456,null))[_0xd177('0x26')](function(_0x427dca){if(_0x427dca){_0x34f0d2=_0x427dca;_0x26f65c[_0xd177('0x36')]=_[_0xd177('0x33')](db[_0xd177('0x4d')][_0xd177('0x2e')]);_0x26f65c[_0xd177('0x32')]=_[_0xd177('0x33')](_0x3c5187[_0xd177('0x32')]);_0x26f65c[_0xd177('0x34')]=_['intersection'](_0x26f65c[_0xd177('0x36')],_0x26f65c['query']);_0x397a6e[_0xd177('0x38')]=_[_0xd177('0x35')](_0x26f65c[_0xd177('0x36')],qs[_0xd177('0x37')](_0x3c5187['query'][_0xd177('0x37')]));_0x397a6e[_0xd177('0x38')]=_0x397a6e['attributes'][_0xd177('0x45')]?_0x397a6e[_0xd177('0x38')]:_0x26f65c[_0xd177('0x36')];_0x397a6e[_0xd177('0x4e')]=qs['sort'](_0x3c5187[_0xd177('0x32')][_0xd177('0x3a')]);_0x397a6e[_0xd177('0x3b')]=qs['filters'](_['pick'](_0x3c5187['query'],_0x26f65c['filters']));if(_0x3c5187[_0xd177('0x32')][_0xd177('0x3c')]){_0x397a6e[_0xd177('0x3b')]=_[_0xd177('0x3d')](_0x397a6e[_0xd177('0x3b')],{'$or':_[_0xd177('0x2d')](_0x397a6e[_0xd177('0x38')],function(_0xdf922){var _0x4be2c3={};_0x4be2c3[_0xdf922]={'$like':'%'+_0x3c5187['query'][_0xd177('0x3c')]+'%'};return _0x4be2c3;})});}_0x397a6e=_[_0xd177('0x3d')]({},_0x397a6e,_0x3c5187[_0xd177('0x3f')]);return _0x34f0d2[_0xd177('0x52')](_0x397a6e);}})[_0xd177('0x26')](function(_0x1f8c34){if(_0x1f8c34){_0x5555b4=_0x1f8c34[_0xd177('0x45')];if(!_0x3c5187[_0xd177('0x32')]['hasOwnProperty'](_0xd177('0x39'))){_0x397a6e[_0xd177('0x1e')]=qs[_0xd177('0x1e')](_0x3c5187['query'][_0xd177('0x1e')]);_0x397a6e[_0xd177('0x1c')]=qs[_0xd177('0x1c')](_0x3c5187['query'][_0xd177('0x1c')]);}return _0x34f0d2['getDescriptions'](_0x397a6e);}})[_0xd177('0x26')](function(_0x2e2bcc){if(_0x2e2bcc){return _0x2e2bcc?{'count':_0x5555b4,'rows':_0x2e2bcc}:null;}})[_0xd177('0x26')](respondWithResult(_0x434456,null))[_0xd177('0x4a')](handleError(_0x434456,null));}; \ No newline at end of file +var _0x883e=['eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','status','json','offset','undefined','limit','count','set','apply','reject','save','update','then','end','stack','name','send','VtigerConfiguration','rawAttributes','fieldName','key','model','map','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','pick','filter','where','merge','type','VIRTUAL','options','includeAll','include','findAll','catch','create','body','find','params','destroy','getFields','findOne','VtigerField','order','getSubjects','getDescriptions'];(function(_0x165f04,_0xc44a0b){var _0x40d6c9=function(_0x34cec2){while(--_0x34cec2){_0x165f04['push'](_0x165f04['shift']());}};_0x40d6c9(++_0xc44a0b);}(_0x883e,0xf9));var _0xe883=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x883e[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xe883('0x0'));var rimraf=require(_0xe883('0x1'));var zipdir=require(_0xe883('0x2'));var jsonpatch=require(_0xe883('0x3'));var rp=require(_0xe883('0x4'));var moment=require(_0xe883('0x5'));var BPromise=require(_0xe883('0x6'));var Mustache=require(_0xe883('0x7'));var util=require(_0xe883('0x8'));var path=require(_0xe883('0x9'));var sox=require(_0xe883('0xa'));var csv=require(_0xe883('0xb'));var ejs=require(_0xe883('0xc'));var fs=require('fs');var fs_extra=require(_0xe883('0xd'));var _=require(_0xe883('0xe'));var squel=require(_0xe883('0xf'));var crypto=require(_0xe883('0x10'));var jsforce=require(_0xe883('0x11'));var deskjs=require('desk.js');var toCsv=require(_0xe883('0xb'));var querystring=require(_0xe883('0x12'));var Papa=require(_0xe883('0x13'));var Redis=require(_0xe883('0x14'));var authService=require(_0xe883('0x15'));var qs=require(_0xe883('0x16'));var as=require(_0xe883('0x17'));var hardwareService=require(_0xe883('0x18'));var logger=require('../../config/logger')(_0xe883('0x19'));var utils=require(_0xe883('0x1a'));var config=require(_0xe883('0x1b'));var licenseUtil=require(_0xe883('0x1c'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5d59ed,_0x1b1c0a){_0x1b1c0a=_0x1b1c0a||0xcc;return function(_0x2b3904){if(_0x2b3904){return _0x5d59ed['sendStatus'](_0x1b1c0a);}return _0x5d59ed[_0xe883('0x1d')](_0x1b1c0a)['end']();};}function respondWithResult(_0x403826,_0x2c2d25){_0x2c2d25=_0x2c2d25||0xc8;return function(_0x534880){if(_0x534880){return _0x403826[_0xe883('0x1d')](_0x2c2d25)[_0xe883('0x1e')](_0x534880);}};}function respondWithFilteredResult(_0x40cc3d,_0x1cd19d){return function(_0x545389){if(_0x545389){var _0x2c5753=typeof _0x1cd19d[_0xe883('0x1f')]===_0xe883('0x20')&&typeof _0x1cd19d[_0xe883('0x21')]===_0xe883('0x20');var _0x1e87d7=_0x545389[_0xe883('0x22')];var _0x3008b3=_0x2c5753?0x0:_0x1cd19d[_0xe883('0x1f')];var _0x46b56e=_0x2c5753?_0x545389['count']:_0x1cd19d['offset']+_0x1cd19d[_0xe883('0x21')];var _0x461e8b;if(_0x46b56e>=_0x1e87d7){_0x46b56e=_0x1e87d7;_0x461e8b=0xc8;}else{_0x461e8b=0xce;}_0x40cc3d[_0xe883('0x1d')](_0x461e8b);return _0x40cc3d[_0xe883('0x23')]('Content-Range',_0x3008b3+'-'+_0x46b56e+'/'+_0x1e87d7)['json'](_0x545389);}return null;};}function patchUpdates(_0x3a34fc){return function(_0x185d74){try{jsonpatch[_0xe883('0x24')](_0x185d74,_0x3a34fc,!![]);}catch(_0x36e77e){return BPromise[_0xe883('0x25')](_0x36e77e);}return _0x185d74[_0xe883('0x26')]();};}function saveUpdates(_0x42b02c,_0x5895ae){return function(_0x539cb5){if(_0x539cb5){return _0x539cb5[_0xe883('0x27')](_0x42b02c)[_0xe883('0x28')](function(_0x339986){return _0x339986;});}return null;};}function removeEntity(_0xbdce0c,_0x22c441){return function(_0x278bed){if(_0x278bed){return _0x278bed['destroy']()[_0xe883('0x28')](function(){_0xbdce0c[_0xe883('0x1d')](0xcc)[_0xe883('0x29')]();});}};}function handleEntityNotFound(_0x29ecb8,_0x1e9f8e){return function(_0x247e7c){if(!_0x247e7c){_0x29ecb8['sendStatus'](0x194);}return _0x247e7c;};}function handleError(_0x565753,_0x41a526){_0x41a526=_0x41a526||0x1f4;return function(_0x3fe22b){logger['error'](_0x3fe22b[_0xe883('0x2a')]);if(_0x3fe22b[_0xe883('0x2b')]){delete _0x3fe22b[_0xe883('0x2b')];}_0x565753[_0xe883('0x1d')](_0x41a526)[_0xe883('0x2c')](_0x3fe22b);};}exports['index']=function(_0x1e0213,_0xdbd4d6){var _0x51421e={},_0x3494b6={},_0x408d7e={'count':0x0,'rows':[]};var _0x545962=_['map'](db[_0xe883('0x2d')][_0xe883('0x2e')],function(_0x112e62){return{'name':_0x112e62[_0xe883('0x2f')],'type':_0x112e62['type'][_0xe883('0x30')]};});_0x3494b6[_0xe883('0x31')]=_[_0xe883('0x32')](_0x545962,_0xe883('0x2b'));_0x3494b6['query']=_[_0xe883('0x33')](_0x1e0213[_0xe883('0x34')]);_0x3494b6[_0xe883('0x35')]=_['intersection'](_0x3494b6[_0xe883('0x31')],_0x3494b6['query']);_0x51421e['attributes']=_[_0xe883('0x36')](_0x3494b6[_0xe883('0x31')],qs[_0xe883('0x37')](_0x1e0213[_0xe883('0x34')]['fields']));_0x51421e[_0xe883('0x38')]=_0x51421e[_0xe883('0x38')][_0xe883('0x39')]?_0x51421e['attributes']:_0x3494b6[_0xe883('0x31')];if(!_0x1e0213[_0xe883('0x34')][_0xe883('0x3a')](_0xe883('0x3b'))){_0x51421e['limit']=qs['limit'](_0x1e0213[_0xe883('0x34')][_0xe883('0x21')]);_0x51421e[_0xe883('0x1f')]=qs['offset'](_0x1e0213[_0xe883('0x34')][_0xe883('0x1f')]);}_0x51421e['order']=qs[_0xe883('0x3c')](_0x1e0213[_0xe883('0x34')][_0xe883('0x3c')]);_0x51421e['where']=qs['filters'](_[_0xe883('0x3d')](_0x1e0213['query'],_0x3494b6[_0xe883('0x35')]),_0x545962);if(_0x1e0213['query'][_0xe883('0x3e')]){_0x51421e[_0xe883('0x3f')]=_[_0xe883('0x40')](_0x51421e['where'],{'$or':_[_0xe883('0x32')](_0x545962,function(_0x578a90){if(_0x578a90[_0xe883('0x41')]!==_0xe883('0x42')){var _0x5aa557={};_0x5aa557[_0x578a90[_0xe883('0x2b')]]={'$like':'%'+_0x1e0213[_0xe883('0x34')][_0xe883('0x3e')]+'%'};return _0x5aa557;}})});}_0x51421e=_[_0xe883('0x40')]({},_0x51421e,_0x1e0213[_0xe883('0x43')]);var _0x4ebc4b={'where':_0x51421e[_0xe883('0x3f')]};return db[_0xe883('0x2d')][_0xe883('0x22')](_0x4ebc4b)['then'](function(_0x5c7837){_0x408d7e['count']=_0x5c7837;if(_0x1e0213[_0xe883('0x34')][_0xe883('0x44')]){_0x51421e[_0xe883('0x45')]=[{'all':!![]}];}return db[_0xe883('0x2d')][_0xe883('0x46')](_0x51421e);})[_0xe883('0x28')](function(_0x5aa846){_0x408d7e['rows']=_0x5aa846;return _0x408d7e;})[_0xe883('0x28')](respondWithFilteredResult(_0xdbd4d6,_0x51421e))[_0xe883('0x47')](handleError(_0xdbd4d6,null));};exports['show']=function(_0x12c278,_0x3a23a7){var _0x164e6a={'raw':![],'where':{'id':_0x12c278['params']['id']}},_0x3c47dc={};_0x3c47dc[_0xe883('0x31')]=_[_0xe883('0x33')](db[_0xe883('0x2d')][_0xe883('0x2e')]);_0x3c47dc['query']=_[_0xe883('0x33')](_0x12c278[_0xe883('0x34')]);_0x3c47dc['filters']=_[_0xe883('0x36')](_0x3c47dc['model'],_0x3c47dc[_0xe883('0x34')]);_0x164e6a['attributes']=_['intersection'](_0x3c47dc[_0xe883('0x31')],qs['fields'](_0x12c278[_0xe883('0x34')][_0xe883('0x37')]));_0x164e6a[_0xe883('0x38')]=_0x164e6a[_0xe883('0x38')][_0xe883('0x39')]?_0x164e6a['attributes']:_0x3c47dc['model'];if(_0x12c278['query']['includeAll']){_0x164e6a[_0xe883('0x45')]=[{'all':!![]}];}_0x164e6a=_[_0xe883('0x40')]({},_0x164e6a,_0x12c278[_0xe883('0x43')]);return db[_0xe883('0x2d')]['find'](_0x164e6a)['then'](handleEntityNotFound(_0x3a23a7,null))[_0xe883('0x28')](respondWithResult(_0x3a23a7,null))['catch'](handleError(_0x3a23a7,null));};exports[_0xe883('0x48')]=function(_0x212167,_0x1177ad){return db[_0xe883('0x2d')][_0xe883('0x48')](_0x212167[_0xe883('0x49')],{})[_0xe883('0x28')](respondWithResult(_0x1177ad,0xc9))[_0xe883('0x47')](handleError(_0x1177ad,null));};exports[_0xe883('0x27')]=function(_0x2d31ad,_0x296f33){if(_0x2d31ad[_0xe883('0x49')]['id']){delete _0x2d31ad[_0xe883('0x49')]['id'];}return db[_0xe883('0x2d')][_0xe883('0x4a')]({'where':{'id':_0x2d31ad[_0xe883('0x4b')]['id']}})[_0xe883('0x28')](handleEntityNotFound(_0x296f33,null))[_0xe883('0x28')](saveUpdates(_0x2d31ad[_0xe883('0x49')],null))[_0xe883('0x28')](respondWithResult(_0x296f33,null))[_0xe883('0x47')](handleError(_0x296f33,null));};exports[_0xe883('0x4c')]=function(_0x35f141,_0x4fceb5){return db[_0xe883('0x2d')][_0xe883('0x4a')]({'where':{'id':_0x35f141[_0xe883('0x4b')]['id']}})[_0xe883('0x28')](handleEntityNotFound(_0x4fceb5,null))['then'](removeEntity(_0x4fceb5,null))['catch'](handleError(_0x4fceb5,null));};exports[_0xe883('0x4d')]=function(_0x290bbf,_0x12512e,_0x1d96d2){var _0x428d81={};var _0x39b502={};var _0x2df918;var _0x34f08d;return db[_0xe883('0x2d')][_0xe883('0x4e')]({'where':{'id':_0x290bbf[_0xe883('0x4b')]['id']}})[_0xe883('0x28')](handleEntityNotFound(_0x12512e,null))[_0xe883('0x28')](function(_0x159b2e){if(_0x159b2e){_0x2df918=_0x159b2e;_0x39b502[_0xe883('0x31')]=_['keys'](db[_0xe883('0x4f')][_0xe883('0x2e')]);_0x39b502['query']=_['keys'](_0x290bbf[_0xe883('0x34')]);_0x39b502[_0xe883('0x35')]=_[_0xe883('0x36')](_0x39b502[_0xe883('0x31')],_0x39b502[_0xe883('0x34')]);_0x428d81['attributes']=_['intersection'](_0x39b502[_0xe883('0x31')],qs['fields'](_0x290bbf['query'][_0xe883('0x37')]));_0x428d81[_0xe883('0x38')]=_0x428d81['attributes'][_0xe883('0x39')]?_0x428d81[_0xe883('0x38')]:_0x39b502[_0xe883('0x31')];_0x428d81[_0xe883('0x50')]=qs[_0xe883('0x3c')](_0x290bbf['query'][_0xe883('0x3c')]);_0x428d81[_0xe883('0x3f')]=qs[_0xe883('0x35')](_[_0xe883('0x3d')](_0x290bbf[_0xe883('0x34')],_0x39b502[_0xe883('0x35')]));if(_0x290bbf['query'][_0xe883('0x3e')]){_0x428d81['where']=_[_0xe883('0x40')](_0x428d81[_0xe883('0x3f')],{'$or':_[_0xe883('0x32')](_0x428d81[_0xe883('0x38')],function(_0x1c7ad5){var _0x47e2e2={};_0x47e2e2[_0x1c7ad5]={'$like':'%'+_0x290bbf[_0xe883('0x34')][_0xe883('0x3e')]+'%'};return _0x47e2e2;})});}_0x428d81=_[_0xe883('0x40')]({},_0x428d81,_0x290bbf[_0xe883('0x43')]);return _0x2df918[_0xe883('0x4d')](_0x428d81);}})[_0xe883('0x28')](function(_0x5e76d8){if(_0x5e76d8){_0x34f08d=_0x5e76d8[_0xe883('0x39')];if(!_0x290bbf[_0xe883('0x34')][_0xe883('0x3a')](_0xe883('0x3b'))){_0x428d81[_0xe883('0x21')]=qs[_0xe883('0x21')](_0x290bbf[_0xe883('0x34')][_0xe883('0x21')]);_0x428d81['offset']=qs[_0xe883('0x1f')](_0x290bbf[_0xe883('0x34')][_0xe883('0x1f')]);}return _0x2df918[_0xe883('0x4d')](_0x428d81);}})['then'](function(_0x38b926){if(_0x38b926){return _0x38b926?{'count':_0x34f08d,'rows':_0x38b926}:null;}})[_0xe883('0x28')](respondWithResult(_0x12512e,null))[_0xe883('0x47')](handleError(_0x12512e,null));};exports[_0xe883('0x51')]=function(_0x36205b,_0x307b57,_0xbbab4b){var _0x3965a6={};var _0x343c80={};var _0x401420;var _0x296abd;return db[_0xe883('0x2d')][_0xe883('0x4e')]({'where':{'id':_0x36205b[_0xe883('0x4b')]['id']}})[_0xe883('0x28')](handleEntityNotFound(_0x307b57,null))[_0xe883('0x28')](function(_0xd69885){if(_0xd69885){_0x401420=_0xd69885;_0x343c80['model']=_[_0xe883('0x33')](db[_0xe883('0x4f')][_0xe883('0x2e')]);_0x343c80[_0xe883('0x34')]=_[_0xe883('0x33')](_0x36205b[_0xe883('0x34')]);_0x343c80[_0xe883('0x35')]=_[_0xe883('0x36')](_0x343c80[_0xe883('0x31')],_0x343c80[_0xe883('0x34')]);_0x3965a6[_0xe883('0x38')]=_[_0xe883('0x36')](_0x343c80[_0xe883('0x31')],qs[_0xe883('0x37')](_0x36205b[_0xe883('0x34')]['fields']));_0x3965a6[_0xe883('0x38')]=_0x3965a6[_0xe883('0x38')][_0xe883('0x39')]?_0x3965a6[_0xe883('0x38')]:_0x343c80[_0xe883('0x31')];_0x3965a6[_0xe883('0x50')]=qs[_0xe883('0x3c')](_0x36205b[_0xe883('0x34')][_0xe883('0x3c')]);_0x3965a6['where']=qs[_0xe883('0x35')](_[_0xe883('0x3d')](_0x36205b[_0xe883('0x34')],_0x343c80[_0xe883('0x35')]));if(_0x36205b[_0xe883('0x34')][_0xe883('0x3e')]){_0x3965a6['where']=_[_0xe883('0x40')](_0x3965a6['where'],{'$or':_[_0xe883('0x32')](_0x3965a6['attributes'],function(_0x46e01b){var _0x5a5930={};_0x5a5930[_0x46e01b]={'$like':'%'+_0x36205b[_0xe883('0x34')][_0xe883('0x3e')]+'%'};return _0x5a5930;})});}_0x3965a6=_[_0xe883('0x40')]({},_0x3965a6,_0x36205b[_0xe883('0x43')]);return _0x401420[_0xe883('0x51')](_0x3965a6);}})['then'](function(_0x416d18){if(_0x416d18){_0x296abd=_0x416d18[_0xe883('0x39')];if(!_0x36205b[_0xe883('0x34')][_0xe883('0x3a')](_0xe883('0x3b'))){_0x3965a6[_0xe883('0x21')]=qs['limit'](_0x36205b[_0xe883('0x34')]['limit']);_0x3965a6[_0xe883('0x1f')]=qs[_0xe883('0x1f')](_0x36205b[_0xe883('0x34')][_0xe883('0x1f')]);}return _0x401420[_0xe883('0x51')](_0x3965a6);}})[_0xe883('0x28')](function(_0x19ba11){if(_0x19ba11){return _0x19ba11?{'count':_0x296abd,'rows':_0x19ba11}:null;}})[_0xe883('0x28')](respondWithResult(_0x307b57,null))['catch'](handleError(_0x307b57,null));};exports['getDescriptions']=function(_0x560abf,_0x4f0b67,_0x4d5748){var _0x55c983={};var _0x1ae673={};var _0x4202dc;var _0x2e17bf;return db[_0xe883('0x2d')]['findOne']({'where':{'id':_0x560abf[_0xe883('0x4b')]['id']}})[_0xe883('0x28')](handleEntityNotFound(_0x4f0b67,null))['then'](function(_0x1d6273){if(_0x1d6273){_0x4202dc=_0x1d6273;_0x1ae673[_0xe883('0x31')]=_[_0xe883('0x33')](db[_0xe883('0x4f')][_0xe883('0x2e')]);_0x1ae673[_0xe883('0x34')]=_[_0xe883('0x33')](_0x560abf[_0xe883('0x34')]);_0x1ae673[_0xe883('0x35')]=_[_0xe883('0x36')](_0x1ae673[_0xe883('0x31')],_0x1ae673[_0xe883('0x34')]);_0x55c983['attributes']=_[_0xe883('0x36')](_0x1ae673[_0xe883('0x31')],qs['fields'](_0x560abf[_0xe883('0x34')][_0xe883('0x37')]));_0x55c983['attributes']=_0x55c983[_0xe883('0x38')][_0xe883('0x39')]?_0x55c983[_0xe883('0x38')]:_0x1ae673[_0xe883('0x31')];_0x55c983[_0xe883('0x50')]=qs[_0xe883('0x3c')](_0x560abf[_0xe883('0x34')][_0xe883('0x3c')]);_0x55c983['where']=qs[_0xe883('0x35')](_[_0xe883('0x3d')](_0x560abf[_0xe883('0x34')],_0x1ae673[_0xe883('0x35')]));if(_0x560abf[_0xe883('0x34')][_0xe883('0x3e')]){_0x55c983[_0xe883('0x3f')]=_[_0xe883('0x40')](_0x55c983[_0xe883('0x3f')],{'$or':_[_0xe883('0x32')](_0x55c983[_0xe883('0x38')],function(_0x3b123e){var _0x26c876={};_0x26c876[_0x3b123e]={'$like':'%'+_0x560abf[_0xe883('0x34')][_0xe883('0x3e')]+'%'};return _0x26c876;})});}_0x55c983=_[_0xe883('0x40')]({},_0x55c983,_0x560abf[_0xe883('0x43')]);return _0x4202dc[_0xe883('0x52')](_0x55c983);}})['then'](function(_0x5703f5){if(_0x5703f5){_0x2e17bf=_0x5703f5[_0xe883('0x39')];if(!_0x560abf['query']['hasOwnProperty'](_0xe883('0x3b'))){_0x55c983[_0xe883('0x21')]=qs['limit'](_0x560abf['query'][_0xe883('0x21')]);_0x55c983[_0xe883('0x1f')]=qs[_0xe883('0x1f')](_0x560abf[_0xe883('0x34')][_0xe883('0x1f')]);}return _0x4202dc['getDescriptions'](_0x55c983);}})[_0xe883('0x28')](function(_0x18a7f3){if(_0x18a7f3){return _0x18a7f3?{'count':_0x2e17bf,'rows':_0x18a7f3}:null;}})[_0xe883('0x28')](respondWithResult(_0x4f0b67,null))[_0xe883('0x47')](handleError(_0x4f0b67,null));}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js index fd1d28e..e457d86 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 _0x5171=['bluebird','path','rimraf','../../config/environment','./intVtigerConfiguration.attributes','exports','define','VtigerConfiguration','util','../../config/logger','api'];(function(_0x27fedb,_0x31c693){var _0x58ab78=function(_0x532732){while(--_0x532732){_0x27fedb['push'](_0x27fedb['shift']());}};_0x58ab78(++_0x31c693);}(_0x5171,0x105));var _0x1517=function(_0x5b5cde,_0x1f7c5f){_0x5b5cde=_0x5b5cde-0x0;var _0x364ad2=_0x5171[_0x5b5cde];return _0x364ad2;};'use strict';var _=require('lodash');var util=require(_0x1517('0x0'));var logger=require(_0x1517('0x1'))(_0x1517('0x2'));var moment=require('moment');var BPromise=require(_0x1517('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1517('0x4'));var rimraf=require(_0x1517('0x5'));var config=require(_0x1517('0x6'));var attributes=require(_0x1517('0x7'));module[_0x1517('0x8')]=function(_0x1c9d12,_0x282898){return _0x1c9d12[_0x1517('0x9')](_0x1517('0xa'),attributes,{'tableName':'int_vtiger_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x03c2=['exports','define','VtigerConfiguration','lodash','util','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intVtigerConfiguration.attributes'];(function(_0x2c2dff,_0x302e28){var _0x1177a4=function(_0x2fa930){while(--_0x2fa930){_0x2c2dff['push'](_0x2c2dff['shift']());}};_0x1177a4(++_0x302e28);}(_0x03c2,0x12f));var _0x203c=function(_0x19ac4a,_0x43798e){_0x19ac4a=_0x19ac4a-0x0;var _0xaa950=_0x03c2[_0x19ac4a];return _0xaa950;};'use strict';var _=require(_0x203c('0x0'));var util=require(_0x203c('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x203c('0x2'));var BPromise=require(_0x203c('0x3'));var rp=require(_0x203c('0x4'));var fs=require('fs');var path=require(_0x203c('0x5'));var rimraf=require(_0x203c('0x6'));var config=require(_0x203c('0x7'));var attributes=require(_0x203c('0x8'));module[_0x203c('0x9')]=function(_0x1dd36c,_0x456414){return _0x1dd36c[_0x203c('0xa')](_0x203c('0xb'),attributes,{'tableName':'int_vtiger_configurations','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 92ddff2..25658d4 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 _0xbbd3=['request\x20sent','debug','stringify','error','code','message','VtigerConfiguration,\x20%s,\x20%s','result','catch','lodash','moment','randomstring','ioredis','../../mysqldb','rpc','jayson/promise','client','http','request','then','info'];(function(_0x34021d,_0x753aa6){var _0x16597b=function(_0x2d040a){while(--_0x2d040a){_0x34021d['push'](_0x34021d['shift']());}};_0x16597b(++_0x753aa6);}(_0xbbd3,0x87));var _0x3bbd=function(_0x82129b,_0x484ae9){_0x82129b=_0x82129b-0x0;var _0x2ae5dc=_0xbbd3[_0x82129b];return _0x2ae5dc;};'use strict';var _=require(_0x3bbd('0x0'));var util=require('util');var moment=require(_0x3bbd('0x1'));var BPromise=require('bluebird');var rs=require(_0x3bbd('0x2'));var fs=require('fs');var Redis=require(_0x3bbd('0x3'));var db=require(_0x3bbd('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x3bbd('0x5'));var config=require('../../config/environment');var jayson=require(_0x3bbd('0x6'));var client=jayson[_0x3bbd('0x7')][_0x3bbd('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5a80a1,_0x321fa4,_0x9a3a15){return new BPromise(function(_0xef26f3,_0x5153da){return client[_0x3bbd('0x9')](_0x5a80a1,_0x9a3a15)[_0x3bbd('0xa')](function(_0x11daa8){logger[_0x3bbd('0xb')]('VtigerConfiguration,\x20%s,\x20%s',_0x321fa4,_0x3bbd('0xc'));logger[_0x3bbd('0xd')]('VtigerConfiguration,\x20%s,\x20%s,\x20%s',_0x321fa4,'request\x20sent',JSON[_0x3bbd('0xe')](_0x11daa8));if(_0x11daa8[_0x3bbd('0xf')]){if(_0x11daa8[_0x3bbd('0xf')][_0x3bbd('0x10')]===0x1f4){logger[_0x3bbd('0xf')]('VtigerConfiguration,\x20%s,\x20%s',_0x321fa4,_0x11daa8[_0x3bbd('0xf')][_0x3bbd('0x11')]);return _0x5153da(_0x11daa8[_0x3bbd('0xf')]['message']);}logger[_0x3bbd('0xf')](_0x3bbd('0x12'),_0x321fa4,_0x11daa8['error'][_0x3bbd('0x11')]);return _0xef26f3(_0x11daa8[_0x3bbd('0xf')]['message']);}else{logger['info'](_0x3bbd('0x12'),_0x321fa4,_0x3bbd('0xc'));_0xef26f3(_0x11daa8[_0x3bbd('0x13')][_0x3bbd('0x11')]);}})[_0x3bbd('0x14')](function(_0x1d8e90){logger['error']('VtigerConfiguration,\x20%s,\x20%s',_0x321fa4,_0x1d8e90);_0x5153da(_0x1d8e90);});});} \ No newline at end of file +var _0xca63=['client','http','request','then','info','VtigerConfiguration,\x20%s,\x20%s','request\x20sent','debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise'];(function(_0x47a254,_0xca2335){var _0x4c4f1b=function(_0xd79f34){while(--_0xd79f34){_0x47a254['push'](_0x47a254['shift']());}};_0x4c4f1b(++_0xca2335);}(_0xca63,0x16d));var _0x3ca6=function(_0x47a4e4,_0x5d6925){_0x47a4e4=_0x47a4e4-0x0;var _0x3a561c=_0xca63[_0x47a4e4];return _0x3a561c;};'use strict';var _=require(_0x3ca6('0x0'));var util=require(_0x3ca6('0x1'));var moment=require('moment');var BPromise=require(_0x3ca6('0x2'));var rs=require(_0x3ca6('0x3'));var fs=require('fs');var Redis=require(_0x3ca6('0x4'));var db=require(_0x3ca6('0x5'))['db'];var utils=require(_0x3ca6('0x6'));var logger=require(_0x3ca6('0x7'))(_0x3ca6('0x8'));var config=require('../../config/environment');var jayson=require(_0x3ca6('0x9'));var client=jayson[_0x3ca6('0xa')][_0x3ca6('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2c9351,_0x3ad13b,_0x4b9508){return new BPromise(function(_0x286a38,_0x49d699){return client[_0x3ca6('0xc')](_0x2c9351,_0x4b9508)[_0x3ca6('0xd')](function(_0x445c11){logger[_0x3ca6('0xe')](_0x3ca6('0xf'),_0x3ad13b,_0x3ca6('0x10'));logger[_0x3ca6('0x11')](_0x3ca6('0x12'),_0x3ad13b,_0x3ca6('0x10'),JSON[_0x3ca6('0x13')](_0x445c11));if(_0x445c11['error']){if(_0x445c11[_0x3ca6('0x14')][_0x3ca6('0x15')]===0x1f4){logger[_0x3ca6('0x14')](_0x3ca6('0xf'),_0x3ad13b,_0x445c11[_0x3ca6('0x14')]['message']);return _0x49d699(_0x445c11[_0x3ca6('0x14')][_0x3ca6('0x16')]);}logger[_0x3ca6('0x14')](_0x3ca6('0xf'),_0x3ad13b,_0x445c11[_0x3ca6('0x14')][_0x3ca6('0x16')]);return _0x286a38(_0x445c11['error'][_0x3ca6('0x16')]);}else{logger['info'](_0x3ca6('0xf'),_0x3ad13b,'request\x20sent');_0x286a38(_0x445c11[_0x3ca6('0x17')]['message']);}})[_0x3ca6('0x18')](function(_0x490c4d){logger[_0x3ca6('0x14')](_0x3ca6('0xf'),_0x3ad13b,_0x490c4d);_0x49d699(_0x490c4d);});});} \ No newline at end of file diff --git a/server/api/intVtigerField/index.js b/server/api/intVtigerField/index.js index 83e286c..f9089a8 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 _0xba9c=['../../config/environment','./intVtigerField.controller','isAuthenticated','get','/:id','show','post','put','update','delete','destroy','exports','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x270dba,_0x1817d2){var _0x36b83b=function(_0x15a276){while(--_0x15a276){_0x270dba['push'](_0x270dba['shift']());}};_0x36b83b(++_0x1817d2);}(_0xba9c,0x1bc));var _0xcba9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xba9c[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xcba9('0x0'));var timeout=require(_0xcba9('0x1'));var express=require('express');var router=express[_0xcba9('0x2')]();var fs_extra=require(_0xcba9('0x3'));var auth=require(_0xcba9('0x4'));var interaction=require(_0xcba9('0x5'));var config=require(_0xcba9('0x6'));var controller=require(_0xcba9('0x7'));router['get']('/',auth[_0xcba9('0x8')](),controller['index']);router[_0xcba9('0x9')](_0xcba9('0xa'),auth[_0xcba9('0x8')](),controller[_0xcba9('0xb')]);router[_0xcba9('0xc')]('/',auth[_0xcba9('0x8')](),controller['create']);router[_0xcba9('0xd')](_0xcba9('0xa'),auth[_0xcba9('0x8')](),controller[_0xcba9('0xe')]);router[_0xcba9('0xf')](_0xcba9('0xa'),auth[_0xcba9('0x8')](),controller[_0xcba9('0x10')]);module[_0xcba9('0x11')]=router; \ No newline at end of file +var _0x7fcd=['util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','./intVtigerField.controller','get','isAuthenticated','/:id','show','post','create','put','update','delete','destroy','exports','multer'];(function(_0x3edaa7,_0x366c56){var _0x123cdb=function(_0xc7d3b4){while(--_0xc7d3b4){_0x3edaa7['push'](_0x3edaa7['shift']());}};_0x123cdb(++_0x366c56);}(_0x7fcd,0xaa));var _0xd7fc=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x7fcd[_0x2641f9];return _0x585741;};'use strict';var multer=require(_0xd7fc('0x0'));var util=require(_0xd7fc('0x1'));var path=require(_0xd7fc('0x2'));var timeout=require('connect-timeout');var express=require(_0xd7fc('0x3'));var router=express['Router']();var fs_extra=require(_0xd7fc('0x4'));var auth=require(_0xd7fc('0x5'));var interaction=require(_0xd7fc('0x6'));var config=require('../../config/environment');var controller=require(_0xd7fc('0x7'));router[_0xd7fc('0x8')]('/',auth[_0xd7fc('0x9')](),controller['index']);router[_0xd7fc('0x8')](_0xd7fc('0xa'),auth[_0xd7fc('0x9')](),controller[_0xd7fc('0xb')]);router[_0xd7fc('0xc')]('/',auth[_0xd7fc('0x9')](),controller[_0xd7fc('0xd')]);router[_0xd7fc('0xe')](_0xd7fc('0xa'),auth['isAuthenticated'](),controller[_0xd7fc('0xf')]);router[_0xd7fc('0x10')](_0xd7fc('0xa'),auth[_0xd7fc('0x9')](),controller[_0xd7fc('0x11')]);module[_0xd7fc('0x12')]=router; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.attributes.js b/server/api/intVtigerField/intVtigerField.attributes.js index 63ebd28..2229b13 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 _0x4999=['exports','string','customVariable','STRING','ENUM','BOOLEAN','sequelize'];(function(_0x4f8d61,_0x29eff0){var _0x3bc078=function(_0x4c7203){while(--_0x4c7203){_0x4f8d61['push'](_0x4f8d61['shift']());}};_0x3bc078(++_0x29eff0);}(_0x4999,0x1db));var _0x9499=function(_0x34919b,_0x1e409a){_0x34919b=_0x34919b-0x0;var _0x505b56=_0x4999[_0x34919b];return _0x505b56;};'use strict';var Sequelize=require(_0x9499('0x0'));module[_0x9499('0x1')]={'type':{'type':Sequelize['ENUM'](_0x9499('0x2'),'variable',_0x9499('0x3'),'keyValue','picklist'),'defaultValue':_0x9499('0x2')},'content':{'type':Sequelize[_0x9499('0x4')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x9499('0x5')](_0x9499('0x2'),'variable',_0x9499('0x3'))},'keyContent':{'type':Sequelize[_0x9499('0x4')]},'idField':{'type':Sequelize[_0x9499('0x4')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x9499('0x6')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x9499('0x4')]}}; \ No newline at end of file +var _0xd322=['ENUM','string','variable','picklist','STRING','customVariable'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd322,0xa2));var _0x2d32=function(_0x3fe7e5,_0x60fe0){_0x3fe7e5=_0x3fe7e5-0x0;var _0x3e34a6=_0xd322[_0x3fe7e5];return _0x3e34a6;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize[_0x2d32('0x0')](_0x2d32('0x1'),_0x2d32('0x2'),'customVariable','keyValue',_0x2d32('0x3')),'defaultValue':_0x2d32('0x1')},'content':{'type':Sequelize[_0x2d32('0x4')]},'key':{'type':Sequelize[_0x2d32('0x4')]},'keyType':{'type':Sequelize[_0x2d32('0x0')](_0x2d32('0x1'),_0x2d32('0x2'),_0x2d32('0x5'))},'keyContent':{'type':Sequelize[_0x2d32('0x4')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x2d32('0x4')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x2d32('0x4')]}}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.controller.js b/server/api/intVtigerField/intVtigerField.controller.js index b142ff0..1997e85 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 _0x1bad=['reject','save','update','then','destroy','end','sendStatus','error','stack','name','index','map','VtigerField','rawAttributes','type','key','model','query','intersection','attributes','fields','nolimit','order','sort','where','pick','filters','filter','merge','VIRTUAL','options','includeAll','include','catch','show','params','keys','length','find','create','body','eml-format','rimraf','fast-json-patch','request-promise','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','api','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','limit','undefined','count','Content-Range'];(function(_0x508ab9,_0x7c0fb3){var _0x2afb14=function(_0x4dfe22){while(--_0x4dfe22){_0x508ab9['push'](_0x508ab9['shift']());}};_0x2afb14(++_0x7c0fb3);}(_0x1bad,0x187));var _0xd1ba=function(_0x2b7679,_0x49a54d){_0x2b7679=_0x2b7679-0x0;var _0x42c8d0=_0x1bad[_0x2b7679];return _0x42c8d0;};'use strict';var emlformat=require(_0xd1ba('0x0'));var rimraf=require(_0xd1ba('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd1ba('0x2'));var rp=require(_0xd1ba('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xd1ba('0x4'));var path=require('path');var sox=require(_0xd1ba('0x5'));var csv=require(_0xd1ba('0x6'));var ejs=require(_0xd1ba('0x7'));var fs=require('fs');var fs_extra=require(_0xd1ba('0x8'));var _=require(_0xd1ba('0x9'));var squel=require(_0xd1ba('0xa'));var crypto=require(_0xd1ba('0xb'));var jsforce=require(_0xd1ba('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xd1ba('0xd'));var Papa=require(_0xd1ba('0xe'));var Redis=require(_0xd1ba('0xf'));var authService=require(_0xd1ba('0x10'));var qs=require(_0xd1ba('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xd1ba('0x12'));var utils=require('../../config/utils');var config=require(_0xd1ba('0x13'));var licenseUtil=require(_0xd1ba('0x14'));var db=require(_0xd1ba('0x15'))['db'];function respondWithStatusCode(_0x256040,_0x2ad82f){_0x2ad82f=_0x2ad82f||0xcc;return function(_0x3cf053){if(_0x3cf053){return _0x256040['sendStatus'](_0x2ad82f);}return _0x256040[_0xd1ba('0x16')](_0x2ad82f)['end']();};}function respondWithResult(_0x2ebd9b,_0x2efff8){_0x2efff8=_0x2efff8||0xc8;return function(_0x50558e){if(_0x50558e){return _0x2ebd9b[_0xd1ba('0x16')](_0x2efff8)[_0xd1ba('0x17')](_0x50558e);}};}function respondWithFilteredResult(_0x512235,_0x137ba7){return function(_0x187aa2){if(_0x187aa2){var _0x2ef648=typeof _0x137ba7[_0xd1ba('0x18')]==='undefined'&&typeof _0x137ba7[_0xd1ba('0x19')]===_0xd1ba('0x1a');var _0x5690b2=_0x187aa2[_0xd1ba('0x1b')];var _0x12db18=_0x2ef648?0x0:_0x137ba7['offset'];var _0x168d2c=_0x2ef648?_0x187aa2['count']:_0x137ba7[_0xd1ba('0x18')]+_0x137ba7['limit'];var _0x13690e;if(_0x168d2c>=_0x5690b2){_0x168d2c=_0x5690b2;_0x13690e=0xc8;}else{_0x13690e=0xce;}_0x512235[_0xd1ba('0x16')](_0x13690e);return _0x512235['set'](_0xd1ba('0x1c'),_0x12db18+'-'+_0x168d2c+'/'+_0x5690b2)['json'](_0x187aa2);}return null;};}function patchUpdates(_0x4d58e1){return function(_0x31d042){try{jsonpatch['apply'](_0x31d042,_0x4d58e1,!![]);}catch(_0x17030c){return BPromise[_0xd1ba('0x1d')](_0x17030c);}return _0x31d042[_0xd1ba('0x1e')]();};}function saveUpdates(_0x296cf,_0xa6337a){return function(_0x362422){if(_0x362422){return _0x362422[_0xd1ba('0x1f')](_0x296cf)[_0xd1ba('0x20')](function(_0x13f9f5){return _0x13f9f5;});}return null;};}function removeEntity(_0x430c1a,_0x111849){return function(_0x27c4dd){if(_0x27c4dd){return _0x27c4dd[_0xd1ba('0x21')]()[_0xd1ba('0x20')](function(){_0x430c1a[_0xd1ba('0x16')](0xcc)[_0xd1ba('0x22')]();});}};}function handleEntityNotFound(_0x434aaf,_0x208b93){return function(_0x87ec18){if(!_0x87ec18){_0x434aaf[_0xd1ba('0x23')](0x194);}return _0x87ec18;};}function handleError(_0x17e54d,_0x30289a){_0x30289a=_0x30289a||0x1f4;return function(_0xd3d29e){logger[_0xd1ba('0x24')](_0xd3d29e[_0xd1ba('0x25')]);if(_0xd3d29e[_0xd1ba('0x26')]){delete _0xd3d29e[_0xd1ba('0x26')];}_0x17e54d['status'](_0x30289a)['send'](_0xd3d29e);};}exports[_0xd1ba('0x27')]=function(_0x13a8b9,_0x3d13cc){var _0x23242d={},_0x29ce00={},_0x419ab9={'count':0x0,'rows':[]};var _0x309893=_[_0xd1ba('0x28')](db[_0xd1ba('0x29')][_0xd1ba('0x2a')],function(_0xd42b5d){return{'name':_0xd42b5d['fieldName'],'type':_0xd42b5d[_0xd1ba('0x2b')][_0xd1ba('0x2c')]};});_0x29ce00[_0xd1ba('0x2d')]=_[_0xd1ba('0x28')](_0x309893,'name');_0x29ce00[_0xd1ba('0x2e')]=_['keys'](_0x13a8b9[_0xd1ba('0x2e')]);_0x29ce00['filters']=_[_0xd1ba('0x2f')](_0x29ce00[_0xd1ba('0x2d')],_0x29ce00[_0xd1ba('0x2e')]);_0x23242d[_0xd1ba('0x30')]=_[_0xd1ba('0x2f')](_0x29ce00['model'],qs[_0xd1ba('0x31')](_0x13a8b9[_0xd1ba('0x2e')]['fields']));_0x23242d[_0xd1ba('0x30')]=_0x23242d[_0xd1ba('0x30')]['length']?_0x23242d[_0xd1ba('0x30')]:_0x29ce00['model'];if(!_0x13a8b9[_0xd1ba('0x2e')]['hasOwnProperty'](_0xd1ba('0x32'))){_0x23242d[_0xd1ba('0x19')]=qs['limit'](_0x13a8b9[_0xd1ba('0x2e')][_0xd1ba('0x19')]);_0x23242d[_0xd1ba('0x18')]=qs['offset'](_0x13a8b9['query'][_0xd1ba('0x18')]);}_0x23242d[_0xd1ba('0x33')]=qs[_0xd1ba('0x34')](_0x13a8b9[_0xd1ba('0x2e')][_0xd1ba('0x34')]);_0x23242d[_0xd1ba('0x35')]=qs['filters'](_[_0xd1ba('0x36')](_0x13a8b9[_0xd1ba('0x2e')],_0x29ce00[_0xd1ba('0x37')]),_0x309893);if(_0x13a8b9[_0xd1ba('0x2e')][_0xd1ba('0x38')]){_0x23242d[_0xd1ba('0x35')]=_[_0xd1ba('0x39')](_0x23242d[_0xd1ba('0x35')],{'$or':_[_0xd1ba('0x28')](_0x309893,function(_0x290ed9){if(_0x290ed9[_0xd1ba('0x2b')]!==_0xd1ba('0x3a')){var _0x11b93c={};_0x11b93c[_0x290ed9[_0xd1ba('0x26')]]={'$like':'%'+_0x13a8b9['query'][_0xd1ba('0x38')]+'%'};return _0x11b93c;}})});}_0x23242d=_[_0xd1ba('0x39')]({},_0x23242d,_0x13a8b9[_0xd1ba('0x3b')]);var _0x708a2a={'where':_0x23242d['where']};return db['VtigerField'][_0xd1ba('0x1b')](_0x708a2a)[_0xd1ba('0x20')](function(_0x583775){_0x419ab9[_0xd1ba('0x1b')]=_0x583775;if(_0x13a8b9[_0xd1ba('0x2e')][_0xd1ba('0x3c')]){_0x23242d[_0xd1ba('0x3d')]=[{'all':!![]}];}return db['VtigerField']['findAll'](_0x23242d);})[_0xd1ba('0x20')](function(_0x56fbaf){_0x419ab9['rows']=_0x56fbaf;return _0x419ab9;})[_0xd1ba('0x20')](respondWithFilteredResult(_0x3d13cc,_0x23242d))[_0xd1ba('0x3e')](handleError(_0x3d13cc,null));};exports[_0xd1ba('0x3f')]=function(_0x33cec6,_0x2eb9f9){var _0x1afa58={'raw':!![],'where':{'id':_0x33cec6[_0xd1ba('0x40')]['id']}},_0x1eb5ef={};_0x1eb5ef[_0xd1ba('0x2d')]=_[_0xd1ba('0x41')](db['VtigerField'][_0xd1ba('0x2a')]);_0x1eb5ef['query']=_[_0xd1ba('0x41')](_0x33cec6[_0xd1ba('0x2e')]);_0x1eb5ef[_0xd1ba('0x37')]=_[_0xd1ba('0x2f')](_0x1eb5ef[_0xd1ba('0x2d')],_0x1eb5ef[_0xd1ba('0x2e')]);_0x1afa58[_0xd1ba('0x30')]=_[_0xd1ba('0x2f')](_0x1eb5ef[_0xd1ba('0x2d')],qs[_0xd1ba('0x31')](_0x33cec6['query']['fields']));_0x1afa58[_0xd1ba('0x30')]=_0x1afa58[_0xd1ba('0x30')][_0xd1ba('0x42')]?_0x1afa58['attributes']:_0x1eb5ef[_0xd1ba('0x2d')];if(_0x33cec6[_0xd1ba('0x2e')][_0xd1ba('0x3c')]){_0x1afa58[_0xd1ba('0x3d')]=[{'all':!![]}];}_0x1afa58=_[_0xd1ba('0x39')]({},_0x1afa58,_0x33cec6[_0xd1ba('0x3b')]);return db[_0xd1ba('0x29')][_0xd1ba('0x43')](_0x1afa58)[_0xd1ba('0x20')](handleEntityNotFound(_0x2eb9f9,null))[_0xd1ba('0x20')](respondWithResult(_0x2eb9f9,null))['catch'](handleError(_0x2eb9f9,null));};exports['create']=function(_0xe1f21d,_0x5c3439){return db[_0xd1ba('0x29')][_0xd1ba('0x44')](_0xe1f21d[_0xd1ba('0x45')],{})[_0xd1ba('0x20')](respondWithResult(_0x5c3439,0xc9))['catch'](handleError(_0x5c3439,null));};exports[_0xd1ba('0x1f')]=function(_0x4a5fb1,_0x29256e){if(_0x4a5fb1['body']['id']){delete _0x4a5fb1[_0xd1ba('0x45')]['id'];}return db[_0xd1ba('0x29')]['find']({'where':{'id':_0x4a5fb1[_0xd1ba('0x40')]['id']}})[_0xd1ba('0x20')](handleEntityNotFound(_0x29256e,null))['then'](saveUpdates(_0x4a5fb1[_0xd1ba('0x45')],null))[_0xd1ba('0x20')](respondWithResult(_0x29256e,null))[_0xd1ba('0x3e')](handleError(_0x29256e,null));};exports[_0xd1ba('0x21')]=function(_0x26268a,_0x455d3a){return db['VtigerField'][_0xd1ba('0x43')]({'where':{'id':_0x26268a[_0xd1ba('0x40')]['id']}})[_0xd1ba('0x20')](handleEntityNotFound(_0x455d3a,null))['then'](removeEntity(_0x455d3a,null))[_0xd1ba('0x3e')](handleError(_0x455d3a,null));}; \ No newline at end of file +var _0xb2ec=['lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','index','map','VtigerField','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','limit','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','show','find','catch','create','body','params','zip-dir','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra'];(function(_0x2a0cbf,_0x36ce74){var _0x1b694b=function(_0x58df6f){while(--_0x58df6f){_0x2a0cbf['push'](_0x2a0cbf['shift']());}};_0x1b694b(++_0x36ce74);}(_0xb2ec,0x16d));var _0xcb2e=function(_0x1d64bf,_0x280c40){_0x1d64bf=_0x1d64bf-0x0;var _0x4f4c04=_0xb2ec[_0x1d64bf];return _0x4f4c04;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xcb2e('0x0'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xcb2e('0x1'));var BPromise=require(_0xcb2e('0x2'));var Mustache=require(_0xcb2e('0x3'));var util=require(_0xcb2e('0x4'));var path=require(_0xcb2e('0x5'));var sox=require(_0xcb2e('0x6'));var csv=require(_0xcb2e('0x7'));var ejs=require(_0xcb2e('0x8'));var fs=require('fs');var fs_extra=require(_0xcb2e('0x9'));var _=require(_0xcb2e('0xa'));var squel=require('squel');var crypto=require(_0xcb2e('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xcb2e('0xc'));var toCsv=require(_0xcb2e('0x7'));var querystring=require(_0xcb2e('0xd'));var Papa=require(_0xcb2e('0xe'));var Redis=require(_0xcb2e('0xf'));var authService=require(_0xcb2e('0x10'));var qs=require(_0xcb2e('0x11'));var as=require(_0xcb2e('0x12'));var hardwareService=require(_0xcb2e('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0xcb2e('0x14'));var config=require(_0xcb2e('0x15'));var licenseUtil=require(_0xcb2e('0x16'));var db=require(_0xcb2e('0x17'))['db'];function respondWithStatusCode(_0x19c20d,_0x443e1e){_0x443e1e=_0x443e1e||0xcc;return function(_0x8cba44){if(_0x8cba44){return _0x19c20d[_0xcb2e('0x18')](_0x443e1e);}return _0x19c20d[_0xcb2e('0x19')](_0x443e1e)[_0xcb2e('0x1a')]();};}function respondWithResult(_0x5b8555,_0xf8bc76){_0xf8bc76=_0xf8bc76||0xc8;return function(_0x1a14a2){if(_0x1a14a2){return _0x5b8555[_0xcb2e('0x19')](_0xf8bc76)[_0xcb2e('0x1b')](_0x1a14a2);}};}function respondWithFilteredResult(_0x25870e,_0x5d834d){return function(_0x312340){if(_0x312340){var _0x3f592a=typeof _0x5d834d[_0xcb2e('0x1c')]===_0xcb2e('0x1d')&&typeof _0x5d834d['limit']===_0xcb2e('0x1d');var _0x243f4a=_0x312340[_0xcb2e('0x1e')];var _0x1254f8=_0x3f592a?0x0:_0x5d834d['offset'];var _0x3a2150=_0x3f592a?_0x312340[_0xcb2e('0x1e')]:_0x5d834d[_0xcb2e('0x1c')]+_0x5d834d['limit'];var _0x1ccf46;if(_0x3a2150>=_0x243f4a){_0x3a2150=_0x243f4a;_0x1ccf46=0xc8;}else{_0x1ccf46=0xce;}_0x25870e['status'](_0x1ccf46);return _0x25870e[_0xcb2e('0x1f')](_0xcb2e('0x20'),_0x1254f8+'-'+_0x3a2150+'/'+_0x243f4a)[_0xcb2e('0x1b')](_0x312340);}return null;};}function patchUpdates(_0x1c1aab){return function(_0x30b485){try{jsonpatch[_0xcb2e('0x21')](_0x30b485,_0x1c1aab,!![]);}catch(_0xb53a05){return BPromise[_0xcb2e('0x22')](_0xb53a05);}return _0x30b485[_0xcb2e('0x23')]();};}function saveUpdates(_0x386b37,_0x29574d){return function(_0x355a49){if(_0x355a49){return _0x355a49[_0xcb2e('0x24')](_0x386b37)[_0xcb2e('0x25')](function(_0x400855){return _0x400855;});}return null;};}function removeEntity(_0x199e09,_0x5bab62){return function(_0x8fd414){if(_0x8fd414){return _0x8fd414[_0xcb2e('0x26')]()[_0xcb2e('0x25')](function(){_0x199e09[_0xcb2e('0x19')](0xcc)[_0xcb2e('0x1a')]();});}};}function handleEntityNotFound(_0x59df8d,_0x5810bd){return function(_0x27ca7a){if(!_0x27ca7a){_0x59df8d['sendStatus'](0x194);}return _0x27ca7a;};}function handleError(_0x3829a9,_0x30dd7c){_0x30dd7c=_0x30dd7c||0x1f4;return function(_0x37ee71){logger['error'](_0x37ee71[_0xcb2e('0x27')]);if(_0x37ee71['name']){delete _0x37ee71[_0xcb2e('0x28')];}_0x3829a9['status'](_0x30dd7c)['send'](_0x37ee71);};}exports[_0xcb2e('0x29')]=function(_0x11003e,_0x4a703a){var _0x5e6ec1={},_0x5c5776={},_0x52f991={'count':0x0,'rows':[]};var _0x5b7aa3=_[_0xcb2e('0x2a')](db[_0xcb2e('0x2b')][_0xcb2e('0x2c')],function(_0x326c80){return{'name':_0x326c80[_0xcb2e('0x2d')],'type':_0x326c80[_0xcb2e('0x2e')][_0xcb2e('0x2f')]};});_0x5c5776[_0xcb2e('0x30')]=_['map'](_0x5b7aa3,'name');_0x5c5776[_0xcb2e('0x31')]=_[_0xcb2e('0x32')](_0x11003e[_0xcb2e('0x31')]);_0x5c5776[_0xcb2e('0x33')]=_[_0xcb2e('0x34')](_0x5c5776['model'],_0x5c5776[_0xcb2e('0x31')]);_0x5e6ec1[_0xcb2e('0x35')]=_['intersection'](_0x5c5776['model'],qs[_0xcb2e('0x36')](_0x11003e[_0xcb2e('0x31')][_0xcb2e('0x36')]));_0x5e6ec1[_0xcb2e('0x35')]=_0x5e6ec1[_0xcb2e('0x35')][_0xcb2e('0x37')]?_0x5e6ec1[_0xcb2e('0x35')]:_0x5c5776[_0xcb2e('0x30')];if(!_0x11003e[_0xcb2e('0x31')]['hasOwnProperty'](_0xcb2e('0x38'))){_0x5e6ec1['limit']=qs[_0xcb2e('0x39')](_0x11003e[_0xcb2e('0x31')]['limit']);_0x5e6ec1['offset']=qs[_0xcb2e('0x1c')](_0x11003e['query'][_0xcb2e('0x1c')]);}_0x5e6ec1['order']=qs[_0xcb2e('0x3a')](_0x11003e['query']['sort']);_0x5e6ec1[_0xcb2e('0x3b')]=qs[_0xcb2e('0x33')](_[_0xcb2e('0x3c')](_0x11003e['query'],_0x5c5776[_0xcb2e('0x33')]),_0x5b7aa3);if(_0x11003e['query'][_0xcb2e('0x3d')]){_0x5e6ec1[_0xcb2e('0x3b')]=_['merge'](_0x5e6ec1[_0xcb2e('0x3b')],{'$or':_[_0xcb2e('0x2a')](_0x5b7aa3,function(_0x401bd3){if(_0x401bd3[_0xcb2e('0x2e')]!==_0xcb2e('0x3e')){var _0x3ca042={};_0x3ca042[_0x401bd3['name']]={'$like':'%'+_0x11003e[_0xcb2e('0x31')][_0xcb2e('0x3d')]+'%'};return _0x3ca042;}})});}_0x5e6ec1=_[_0xcb2e('0x3f')]({},_0x5e6ec1,_0x11003e[_0xcb2e('0x40')]);var _0x26eda0={'where':_0x5e6ec1[_0xcb2e('0x3b')]};return db[_0xcb2e('0x2b')][_0xcb2e('0x1e')](_0x26eda0)[_0xcb2e('0x25')](function(_0x46d6e7){_0x52f991[_0xcb2e('0x1e')]=_0x46d6e7;if(_0x11003e[_0xcb2e('0x31')][_0xcb2e('0x41')]){_0x5e6ec1[_0xcb2e('0x42')]=[{'all':!![]}];}return db['VtigerField'][_0xcb2e('0x43')](_0x5e6ec1);})[_0xcb2e('0x25')](function(_0x266d68){_0x52f991[_0xcb2e('0x44')]=_0x266d68;return _0x52f991;})[_0xcb2e('0x25')](respondWithFilteredResult(_0x4a703a,_0x5e6ec1))['catch'](handleError(_0x4a703a,null));};exports[_0xcb2e('0x45')]=function(_0x4e0f11,_0x31c1ad){var _0x44459b={'raw':!![],'where':{'id':_0x4e0f11['params']['id']}},_0x23ba0e={};_0x23ba0e[_0xcb2e('0x30')]=_['keys'](db[_0xcb2e('0x2b')][_0xcb2e('0x2c')]);_0x23ba0e[_0xcb2e('0x31')]=_[_0xcb2e('0x32')](_0x4e0f11[_0xcb2e('0x31')]);_0x23ba0e['filters']=_[_0xcb2e('0x34')](_0x23ba0e[_0xcb2e('0x30')],_0x23ba0e[_0xcb2e('0x31')]);_0x44459b[_0xcb2e('0x35')]=_[_0xcb2e('0x34')](_0x23ba0e[_0xcb2e('0x30')],qs['fields'](_0x4e0f11[_0xcb2e('0x31')][_0xcb2e('0x36')]));_0x44459b[_0xcb2e('0x35')]=_0x44459b[_0xcb2e('0x35')][_0xcb2e('0x37')]?_0x44459b[_0xcb2e('0x35')]:_0x23ba0e[_0xcb2e('0x30')];if(_0x4e0f11['query'][_0xcb2e('0x41')]){_0x44459b[_0xcb2e('0x42')]=[{'all':!![]}];}_0x44459b=_[_0xcb2e('0x3f')]({},_0x44459b,_0x4e0f11[_0xcb2e('0x40')]);return db[_0xcb2e('0x2b')][_0xcb2e('0x46')](_0x44459b)[_0xcb2e('0x25')](handleEntityNotFound(_0x31c1ad,null))[_0xcb2e('0x25')](respondWithResult(_0x31c1ad,null))[_0xcb2e('0x47')](handleError(_0x31c1ad,null));};exports[_0xcb2e('0x48')]=function(_0xe2bbbd,_0x3b3d64){return db[_0xcb2e('0x2b')][_0xcb2e('0x48')](_0xe2bbbd[_0xcb2e('0x49')],{})['then'](respondWithResult(_0x3b3d64,0xc9))[_0xcb2e('0x47')](handleError(_0x3b3d64,null));};exports['update']=function(_0x84238c,_0xe541f1){if(_0x84238c[_0xcb2e('0x49')]['id']){delete _0x84238c['body']['id'];}return db[_0xcb2e('0x2b')][_0xcb2e('0x46')]({'where':{'id':_0x84238c[_0xcb2e('0x4a')]['id']}})[_0xcb2e('0x25')](handleEntityNotFound(_0xe541f1,null))['then'](saveUpdates(_0x84238c[_0xcb2e('0x49')],null))['then'](respondWithResult(_0xe541f1,null))['catch'](handleError(_0xe541f1,null));};exports[_0xcb2e('0x26')]=function(_0xf39e5a,_0x21adbb){return db['VtigerField'][_0xcb2e('0x46')]({'where':{'id':_0xf39e5a[_0xcb2e('0x4a')]['id']}})[_0xcb2e('0x25')](handleEntityNotFound(_0x21adbb,null))[_0xcb2e('0x25')](removeEntity(_0x21adbb,null))['catch'](handleError(_0x21adbb,null));}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.model.js b/server/api/intVtigerField/intVtigerField.model.js index 2535195..8872a8c 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 _0xa7b3=['path','./intVtigerField.attributes','exports','define','VtigerField','idField','FieldId','lodash','util','moment','bluebird','request-promise'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0xa7b3,0x67));var _0x3a7b=function(_0x4b99f1,_0x217c60){_0x4b99f1=_0x4b99f1-0x0;var _0x195bc2=_0xa7b3[_0x4b99f1];return _0x195bc2;};'use strict';var _=require(_0x3a7b('0x0'));var util=require(_0x3a7b('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x3a7b('0x2'));var BPromise=require(_0x3a7b('0x3'));var rp=require(_0x3a7b('0x4'));var fs=require('fs');var path=require(_0x3a7b('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x3a7b('0x6'));module[_0x3a7b('0x7')]=function(_0x5b3357,_0x4e4a87){return _0x5b3357[_0x3a7b('0x8')](_0x3a7b('0x9'),attributes,{'tableName':'int_vtiger_fields','paranoid':![],'indexes':[{'name':'vtiger_unique_index','fields':[_0x3a7b('0xa'),_0x3a7b('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x5a7e=['../../config/logger','api','moment','bluebird','request-promise','path','./intVtigerField.attributes','exports','define','VtigerField','int_vtiger_fields','vtiger_unique_index','idField','lodash','util'];(function(_0x47e035,_0x352672){var _0x197946=function(_0x7e267e){while(--_0x7e267e){_0x47e035['push'](_0x47e035['shift']());}};_0x197946(++_0x352672);}(_0x5a7e,0x11b));var _0xe5a7=function(_0x1756c5,_0x52cd2a){_0x1756c5=_0x1756c5-0x0;var _0xa896f8=_0x5a7e[_0x1756c5];return _0xa896f8;};'use strict';var _=require(_0xe5a7('0x0'));var util=require(_0xe5a7('0x1'));var logger=require(_0xe5a7('0x2'))(_0xe5a7('0x3'));var moment=require(_0xe5a7('0x4'));var BPromise=require(_0xe5a7('0x5'));var rp=require(_0xe5a7('0x6'));var fs=require('fs');var path=require(_0xe5a7('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xe5a7('0x8'));module[_0xe5a7('0x9')]=function(_0x1c82a3,_0x1723aa){return _0x1c82a3[_0xe5a7('0xa')](_0xe5a7('0xb'),attributes,{'tableName':_0xe5a7('0xc'),'paranoid':![],'indexes':[{'name':_0xe5a7('0xd'),'fields':[_0xe5a7('0xe'),'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 9c78d37..59b9563 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 _0xf4be=['request\x20sent','debug','VtigerField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','VtigerField,\x20%s,\x20%s'];(function(_0x2adf81,_0x451f3a){var _0x31a21a=function(_0x585ab5){while(--_0x585ab5){_0x2adf81['push'](_0x2adf81['shift']());}};_0x31a21a(++_0x451f3a);}(_0xf4be,0x105));var _0xef4b=function(_0x2f1627,_0x2c56bd){_0x2f1627=_0x2f1627-0x0;var _0x25d823=_0xf4be[_0x2f1627];return _0x25d823;};'use strict';var _=require(_0xef4b('0x0'));var util=require(_0xef4b('0x1'));var moment=require(_0xef4b('0x2'));var BPromise=require(_0xef4b('0x3'));var rs=require(_0xef4b('0x4'));var fs=require('fs');var Redis=require(_0xef4b('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xef4b('0x6'));var logger=require(_0xef4b('0x7'))(_0xef4b('0x8'));var config=require(_0xef4b('0x9'));var jayson=require(_0xef4b('0xa'));var client=jayson[_0xef4b('0xb')][_0xef4b('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2fd7b3,_0x4d309a,_0x20ad9f){return new BPromise(function(_0x4d500d,_0x3fd493){return client['request'](_0x2fd7b3,_0x20ad9f)['then'](function(_0x89b048){logger[_0xef4b('0xd')](_0xef4b('0xe'),_0x4d309a,_0xef4b('0xf'));logger[_0xef4b('0x10')](_0xef4b('0x11'),_0x4d309a,_0xef4b('0xf'),JSON[_0xef4b('0x12')](_0x89b048));if(_0x89b048[_0xef4b('0x13')]){if(_0x89b048['error'][_0xef4b('0x14')]===0x1f4){logger[_0xef4b('0x13')]('VtigerField,\x20%s,\x20%s',_0x4d309a,_0x89b048[_0xef4b('0x13')][_0xef4b('0x15')]);return _0x3fd493(_0x89b048[_0xef4b('0x13')][_0xef4b('0x15')]);}logger['error'](_0xef4b('0xe'),_0x4d309a,_0x89b048['error'][_0xef4b('0x15')]);return _0x4d500d(_0x89b048[_0xef4b('0x13')]['message']);}else{logger[_0xef4b('0xd')](_0xef4b('0xe'),_0x4d309a,'request\x20sent');_0x4d500d(_0x89b048['result']['message']);}})[_0xef4b('0x16')](function(_0x5151b2){logger[_0xef4b('0x13')](_0xef4b('0xe'),_0x4d309a,_0x5151b2);_0x3fd493(_0x5151b2);});});} \ No newline at end of file +var _0xe44e=['randomstring','ioredis','../../mysqldb','rpc','jayson/promise','http','then','info','VtigerField,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','lodash','util','moment','bluebird'];(function(_0x2b8577,_0x69da5f){var _0x1aa730=function(_0x1f6198){while(--_0x1f6198){_0x2b8577['push'](_0x2b8577['shift']());}};_0x1aa730(++_0x69da5f);}(_0xe44e,0xba));var _0xee44=function(_0x328693,_0x39513a){_0x328693=_0x328693-0x0;var _0x596e10=_0xe44e[_0x328693];return _0x596e10;};'use strict';var _=require(_0xee44('0x0'));var util=require(_0xee44('0x1'));var moment=require(_0xee44('0x2'));var BPromise=require(_0xee44('0x3'));var rs=require(_0xee44('0x4'));var fs=require('fs');var Redis=require(_0xee44('0x5'));var db=require(_0xee44('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xee44('0x7'));var config=require('../../config/environment');var jayson=require(_0xee44('0x8'));var client=jayson['client'][_0xee44('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x488067,_0x92b0ae,_0x49c88f){return new BPromise(function(_0x63def3,_0x4817d0){return client['request'](_0x488067,_0x49c88f)[_0xee44('0xa')](function(_0x2c22b1){logger[_0xee44('0xb')](_0xee44('0xc'),_0x92b0ae,_0xee44('0xd'));logger[_0xee44('0xe')]('VtigerField,\x20%s,\x20%s,\x20%s',_0x92b0ae,_0xee44('0xd'),JSON[_0xee44('0xf')](_0x2c22b1));if(_0x2c22b1[_0xee44('0x10')]){if(_0x2c22b1[_0xee44('0x10')]['code']===0x1f4){logger[_0xee44('0x10')](_0xee44('0xc'),_0x92b0ae,_0x2c22b1[_0xee44('0x10')][_0xee44('0x11')]);return _0x4817d0(_0x2c22b1['error'][_0xee44('0x11')]);}logger[_0xee44('0x10')](_0xee44('0xc'),_0x92b0ae,_0x2c22b1['error'][_0xee44('0x11')]);return _0x63def3(_0x2c22b1['error'][_0xee44('0x11')]);}else{logger[_0xee44('0xb')](_0xee44('0xc'),_0x92b0ae,_0xee44('0xd'));_0x63def3(_0x2c22b1[_0xee44('0x12')][_0xee44('0x11')]);}})['catch'](function(_0x19df39){logger[_0xee44('0x10')](_0xee44('0xc'),_0x92b0ae,_0x19df39);_0x4817d0(_0x19df39);});});} \ No newline at end of file diff --git a/server/api/intZendeskAccount/index.js b/server/api/intZendeskAccount/index.js index e9a3bae..e324145 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 _0xc191=['../../components/interaction/service','../../config/environment','/:id','isAuthenticated','show','get','/:id/configurations','getConfigurations','/:id/fields','getFields','create','addConfiguration','put','update','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x2b10d1,_0xfd516e){var _0x1f2b60=function(_0x20b3b1){while(--_0x20b3b1){_0x2b10d1['push'](_0x2b10d1['shift']());}};_0x1f2b60(++_0xfd516e);}(_0xc191,0xa0));var _0x1c19=function(_0x5627e1,_0x1b2dbf){_0x5627e1=_0x5627e1-0x0;var _0x2f013f=_0xc191[_0x5627e1];return _0x2f013f;};'use strict';var multer=require(_0x1c19('0x0'));var util=require(_0x1c19('0x1'));var path=require(_0x1c19('0x2'));var timeout=require(_0x1c19('0x3'));var express=require(_0x1c19('0x4'));var router=express[_0x1c19('0x5')]();var fs_extra=require(_0x1c19('0x6'));var auth=require(_0x1c19('0x7'));var interaction=require(_0x1c19('0x8'));var config=require(_0x1c19('0x9'));var controller=require('./intZendeskAccount.controller');router['get']('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x1c19('0xa'),auth[_0x1c19('0xb')](),controller[_0x1c19('0xc')]);router[_0x1c19('0xd')](_0x1c19('0xe'),auth['isAuthenticated'](),controller[_0x1c19('0xf')]);router['get'](_0x1c19('0x10'),auth[_0x1c19('0xb')](),controller[_0x1c19('0x11')]);router['post']('/',auth[_0x1c19('0xb')](),controller[_0x1c19('0x12')]);router['post'](_0x1c19('0xe'),auth[_0x1c19('0xb')](),controller[_0x1c19('0x13')]);router[_0x1c19('0x14')](_0x1c19('0xa'),auth['isAuthenticated'](),controller[_0x1c19('0x15')]);router[_0x1c19('0x16')](_0x1c19('0xa'),auth[_0x1c19('0xb')](),controller['destroy']);module[_0x1c19('0x17')]=router; \ No newline at end of file +var _0x6db0=['exports','util','path','connect-timeout','express','Router','../../components/auth/service','./intZendeskAccount.controller','get','isAuthenticated','/:id','show','/:id/configurations','getConfigurations','create','post','addConfiguration','put','update','delete','destroy'];(function(_0x4e0e02,_0x2dd614){var _0x4c32f5=function(_0x215403){while(--_0x215403){_0x4e0e02['push'](_0x4e0e02['shift']());}};_0x4c32f5(++_0x2dd614);}(_0x6db0,0x6a));var _0x06db=function(_0x9798ab,_0x49faaa){_0x9798ab=_0x9798ab-0x0;var _0x1983fd=_0x6db0[_0x9798ab];return _0x1983fd;};'use strict';var multer=require('multer');var util=require(_0x06db('0x0'));var path=require(_0x06db('0x1'));var timeout=require(_0x06db('0x2'));var express=require(_0x06db('0x3'));var router=express[_0x06db('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x06db('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x06db('0x6'));router[_0x06db('0x7')]('/',auth[_0x06db('0x8')](),controller['index']);router[_0x06db('0x7')](_0x06db('0x9'),auth[_0x06db('0x8')](),controller[_0x06db('0xa')]);router[_0x06db('0x7')](_0x06db('0xb'),auth['isAuthenticated'](),controller[_0x06db('0xc')]);router[_0x06db('0x7')]('/:id/fields',auth[_0x06db('0x8')](),controller['getFields']);router['post']('/',auth['isAuthenticated'](),controller[_0x06db('0xd')]);router[_0x06db('0xe')]('/:id/configurations',auth[_0x06db('0x8')](),controller[_0x06db('0xf')]);router[_0x06db('0x10')](_0x06db('0x9'),auth['isAuthenticated'](),controller[_0x06db('0x11')]);router[_0x06db('0x12')](_0x06db('0x9'),auth[_0x06db('0x8')](),controller[_0x06db('0x13')]);module[_0x06db('0x14')]=router; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.attributes.js b/server/api/intZendeskAccount/intZendeskAccount.attributes.js index dec9e30..a8b3cbc 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 _0x7eff=['integrationTab','newTab','exports','STRING','username','password','token','ENUM'];(function(_0x4b055c,_0x4b870b){var _0x4b62bb=function(_0x4884c2){while(--_0x4884c2){_0x4b055c['push'](_0x4b055c['shift']());}};_0x4b62bb(++_0x4b870b);}(_0x7eff,0x162));var _0xf7ef=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x7eff[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require('sequelize');module[_0xf7ef('0x0')]={'name':{'type':Sequelize[_0xf7ef('0x1')]},'description':{'type':Sequelize[_0xf7ef('0x1')]},'username':{'type':Sequelize['STRING'],'unique':_0xf7ef('0x2')},'password':{'type':Sequelize[_0xf7ef('0x1')]},'token':{'type':Sequelize[_0xf7ef('0x1')]},'remoteUri':{'type':Sequelize[_0xf7ef('0x1')],'unique':'remoteUri'},'authType':{'type':Sequelize['ENUM'](_0xf7ef('0x3'),_0xf7ef('0x4')),'defaultValue':_0xf7ef('0x3')},'serverUrl':{'type':Sequelize[_0xf7ef('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0xf7ef('0x5')](_0xf7ef('0x6'),_0xf7ef('0x7')),'defaultValue':_0xf7ef('0x6')}}; \ No newline at end of file +var _0x444e=['newTab','sequelize','STRING','remoteUri','ENUM','password','token'];(function(_0x47de9a,_0x40cf23){var _0x4b9d6c=function(_0x507054){while(--_0x507054){_0x47de9a['push'](_0x47de9a['shift']());}};_0x4b9d6c(++_0x40cf23);}(_0x444e,0xe8));var _0xe444=function(_0x3bbabb,_0x5205e2){_0x3bbabb=_0x3bbabb-0x0;var _0x4e04d5=_0x444e[_0x3bbabb];return _0x4e04d5;};'use strict';var Sequelize=require(_0xe444('0x0'));module['exports']={'name':{'type':Sequelize[_0xe444('0x1')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xe444('0x1')],'unique':'username'},'password':{'type':Sequelize[_0xe444('0x1')]},'token':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0xe444('0x1')],'unique':_0xe444('0x2')},'authType':{'type':Sequelize[_0xe444('0x3')](_0xe444('0x4'),_0xe444('0x5')),'defaultValue':_0xe444('0x4')},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xe444('0x3')]('integrationTab',_0xe444('0x6')),'defaultValue':'integrationTab'}}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.controller.js b/server/api/intZendeskAccount/intZendeskAccount.controller.js index 0edfcb9..a00983c 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 _0xb574=['slice','substring','lastIndexOf','GET','format','%s/%s','ticket_fields','authType','headers','Basic\x20%s','toString','base64','token','Sequelize','ValidationError','Unknown\x20authentication\x20type','subject','description','remove','includes','position','title','system_field_options','custom_field_options','statusCode','stringify','test','Wrong\x20credentials','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','fs-extra','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','destroy','then','error','stack','name','send','ZendeskAccount','rawAttributes','fieldName','key','model','query','keys','attributes','intersection','fields','nolimit','sort','where','filters','pick','filter','merge','map','type','VIRTUAL','includeAll','include','findAll','rows','show','find','catch','create','body','params','getConfigurations','ZendeskConfiguration','options','length','hasOwnProperty','addConfiguration','findOne','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','ZendeskField','getFields','password','remoteUri'];(function(_0x1e47d8,_0xd8d9f1){var _0x9510a3=function(_0x2b9173){while(--_0x2b9173){_0x1e47d8['push'](_0x1e47d8['shift']());}};_0x9510a3(++_0xd8d9f1);}(_0xb574,0x106));var _0x4b57=function(_0x218fee,_0x6879a9){_0x218fee=_0x218fee-0x0;var _0x279040=_0xb574[_0x218fee];return _0x279040;};'use strict';var emlformat=require(_0x4b57('0x0'));var rimraf=require(_0x4b57('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4b57('0x2'));var rp=require(_0x4b57('0x3'));var moment=require('moment');var BPromise=require(_0x4b57('0x4'));var Mustache=require(_0x4b57('0x5'));var util=require(_0x4b57('0x6'));var path=require(_0x4b57('0x7'));var sox=require(_0x4b57('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4b57('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x4b57('0xa'));var toCsv=require(_0x4b57('0xb'));var querystring=require(_0x4b57('0xc'));var Papa=require(_0x4b57('0xd'));var Redis=require(_0x4b57('0xe'));var authService=require(_0x4b57('0xf'));var qs=require(_0x4b57('0x10'));var as=require(_0x4b57('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x4b57('0x12'))(_0x4b57('0x13'));var utils=require(_0x4b57('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x4b57('0x15'))['db'];var integrations=require(_0x4b57('0x16'));function respondWithStatusCode(_0x43d066,_0xf8a6fc){_0xf8a6fc=_0xf8a6fc||0xcc;return function(_0x607276){if(_0x607276){return _0x43d066[_0x4b57('0x17')](_0xf8a6fc);}return _0x43d066[_0x4b57('0x18')](_0xf8a6fc)[_0x4b57('0x19')]();};}function respondWithResult(_0x31cced,_0x4e15be){_0x4e15be=_0x4e15be||0xc8;return function(_0x4a58dc){if(_0x4a58dc){return _0x31cced[_0x4b57('0x18')](_0x4e15be)[_0x4b57('0x1a')](_0x4a58dc);}};}function respondWithFilteredResult(_0x10b9ff,_0x58d6bd){return function(_0x284640){if(_0x284640){var _0x48bd13=typeof _0x58d6bd[_0x4b57('0x1b')]===_0x4b57('0x1c')&&typeof _0x58d6bd[_0x4b57('0x1d')]===_0x4b57('0x1c');var _0x20cf5e=_0x284640[_0x4b57('0x1e')];var _0x4ede42=_0x48bd13?0x0:_0x58d6bd[_0x4b57('0x1b')];var _0x1a0b72=_0x48bd13?_0x284640[_0x4b57('0x1e')]:_0x58d6bd[_0x4b57('0x1b')]+_0x58d6bd['limit'];var _0xb62450;if(_0x1a0b72>=_0x20cf5e){_0x1a0b72=_0x20cf5e;_0xb62450=0xc8;}else{_0xb62450=0xce;}_0x10b9ff[_0x4b57('0x18')](_0xb62450);return _0x10b9ff[_0x4b57('0x1f')](_0x4b57('0x20'),_0x4ede42+'-'+_0x1a0b72+'/'+_0x20cf5e)[_0x4b57('0x1a')](_0x284640);}return null;};}function patchUpdates(_0x4454c8){return function(_0x4f407d){try{jsonpatch[_0x4b57('0x21')](_0x4f407d,_0x4454c8,!![]);}catch(_0x131fed){return BPromise[_0x4b57('0x22')](_0x131fed);}return _0x4f407d['save']();};}function saveUpdates(_0x380554,_0x4a34b2){return function(_0x286c7d){if(_0x286c7d){return _0x286c7d[_0x4b57('0x23')](_0x380554)['then'](function(_0x271361){return _0x271361;});}return null;};}function removeEntity(_0x368c5f,_0x4d07c9){return function(_0x3e7b96){if(_0x3e7b96){return _0x3e7b96[_0x4b57('0x24')]()[_0x4b57('0x25')](function(){_0x368c5f[_0x4b57('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x156962,_0x51d0c3){return function(_0x131dab){if(!_0x131dab){_0x156962['sendStatus'](0x194);}return _0x131dab;};}function handleError(_0x36ceb1,_0x2dc9d8){_0x2dc9d8=_0x2dc9d8||0x1f4;return function(_0x4af2c8){logger[_0x4b57('0x26')](_0x4af2c8[_0x4b57('0x27')]);if(_0x4af2c8[_0x4b57('0x28')]){delete _0x4af2c8['name'];}_0x36ceb1['status'](_0x2dc9d8)[_0x4b57('0x29')](_0x4af2c8);};}exports['index']=function(_0x1ea0cb,_0x458f70){var _0x874cf7={},_0x3af22f={},_0x249461={'count':0x0,'rows':[]};var _0x2c20d2=_['map'](db[_0x4b57('0x2a')][_0x4b57('0x2b')],function(_0x68be27){return{'name':_0x68be27[_0x4b57('0x2c')],'type':_0x68be27['type'][_0x4b57('0x2d')]};});_0x3af22f[_0x4b57('0x2e')]=_['map'](_0x2c20d2,_0x4b57('0x28'));_0x3af22f[_0x4b57('0x2f')]=_[_0x4b57('0x30')](_0x1ea0cb[_0x4b57('0x2f')]);_0x3af22f['filters']=_['intersection'](_0x3af22f['model'],_0x3af22f[_0x4b57('0x2f')]);_0x874cf7[_0x4b57('0x31')]=_[_0x4b57('0x32')](_0x3af22f[_0x4b57('0x2e')],qs[_0x4b57('0x33')](_0x1ea0cb['query'][_0x4b57('0x33')]));_0x874cf7[_0x4b57('0x31')]=_0x874cf7[_0x4b57('0x31')]['length']?_0x874cf7[_0x4b57('0x31')]:_0x3af22f[_0x4b57('0x2e')];if(!_0x1ea0cb[_0x4b57('0x2f')]['hasOwnProperty'](_0x4b57('0x34'))){_0x874cf7[_0x4b57('0x1d')]=qs['limit'](_0x1ea0cb[_0x4b57('0x2f')][_0x4b57('0x1d')]);_0x874cf7[_0x4b57('0x1b')]=qs[_0x4b57('0x1b')](_0x1ea0cb[_0x4b57('0x2f')][_0x4b57('0x1b')]);}_0x874cf7['order']=qs[_0x4b57('0x35')](_0x1ea0cb[_0x4b57('0x2f')][_0x4b57('0x35')]);_0x874cf7[_0x4b57('0x36')]=qs[_0x4b57('0x37')](_[_0x4b57('0x38')](_0x1ea0cb[_0x4b57('0x2f')],_0x3af22f['filters']),_0x2c20d2);if(_0x1ea0cb['query'][_0x4b57('0x39')]){_0x874cf7[_0x4b57('0x36')]=_[_0x4b57('0x3a')](_0x874cf7['where'],{'$or':_[_0x4b57('0x3b')](_0x2c20d2,function(_0x1a3c3a){if(_0x1a3c3a[_0x4b57('0x3c')]!==_0x4b57('0x3d')){var _0x5487cc={};_0x5487cc[_0x1a3c3a[_0x4b57('0x28')]]={'$like':'%'+_0x1ea0cb[_0x4b57('0x2f')][_0x4b57('0x39')]+'%'};return _0x5487cc;}})});}_0x874cf7=_[_0x4b57('0x3a')]({},_0x874cf7,_0x1ea0cb['options']);var _0x5766a6={'where':_0x874cf7['where']};return db[_0x4b57('0x2a')][_0x4b57('0x1e')](_0x5766a6)[_0x4b57('0x25')](function(_0x2e23d3){_0x249461['count']=_0x2e23d3;if(_0x1ea0cb[_0x4b57('0x2f')][_0x4b57('0x3e')]){_0x874cf7[_0x4b57('0x3f')]=[{'all':!![]}];}return db[_0x4b57('0x2a')][_0x4b57('0x40')](_0x874cf7);})[_0x4b57('0x25')](function(_0x2d5a0c){_0x249461[_0x4b57('0x41')]=_0x2d5a0c;return _0x249461;})[_0x4b57('0x25')](respondWithFilteredResult(_0x458f70,_0x874cf7))['catch'](handleError(_0x458f70,null));};exports[_0x4b57('0x42')]=function(_0x3685fd,_0x3c5095){var _0x5b2f50={'raw':![],'where':{'id':_0x3685fd['params']['id']}},_0x44f988={};_0x44f988[_0x4b57('0x2e')]=_[_0x4b57('0x30')](db[_0x4b57('0x2a')][_0x4b57('0x2b')]);_0x44f988[_0x4b57('0x2f')]=_[_0x4b57('0x30')](_0x3685fd[_0x4b57('0x2f')]);_0x44f988[_0x4b57('0x37')]=_[_0x4b57('0x32')](_0x44f988[_0x4b57('0x2e')],_0x44f988[_0x4b57('0x2f')]);_0x5b2f50[_0x4b57('0x31')]=_[_0x4b57('0x32')](_0x44f988['model'],qs['fields'](_0x3685fd[_0x4b57('0x2f')][_0x4b57('0x33')]));_0x5b2f50[_0x4b57('0x31')]=_0x5b2f50[_0x4b57('0x31')]['length']?_0x5b2f50[_0x4b57('0x31')]:_0x44f988[_0x4b57('0x2e')];if(_0x3685fd['query'][_0x4b57('0x3e')]){_0x5b2f50['include']=[{'all':!![]}];}_0x5b2f50=_[_0x4b57('0x3a')]({},_0x5b2f50,_0x3685fd['options']);return db['ZendeskAccount'][_0x4b57('0x43')](_0x5b2f50)[_0x4b57('0x25')](handleEntityNotFound(_0x3c5095,null))['then'](respondWithResult(_0x3c5095,null))[_0x4b57('0x44')](handleError(_0x3c5095,null));};exports[_0x4b57('0x45')]=function(_0x2732ff,_0x1cf1f3){return db[_0x4b57('0x2a')][_0x4b57('0x45')](_0x2732ff['body'],{})[_0x4b57('0x25')](respondWithResult(_0x1cf1f3,0xc9))[_0x4b57('0x44')](handleError(_0x1cf1f3,null));};exports['update']=function(_0xd529fb,_0x23e852){if(_0xd529fb[_0x4b57('0x46')]['id']){delete _0xd529fb['body']['id'];}return db[_0x4b57('0x2a')]['find']({'where':{'id':_0xd529fb[_0x4b57('0x47')]['id']}})[_0x4b57('0x25')](handleEntityNotFound(_0x23e852,null))[_0x4b57('0x25')](saveUpdates(_0xd529fb[_0x4b57('0x46')],null))[_0x4b57('0x25')](respondWithResult(_0x23e852,null))[_0x4b57('0x44')](handleError(_0x23e852,null));};exports[_0x4b57('0x24')]=function(_0x3ec6ba,_0x5ab120){return db[_0x4b57('0x2a')][_0x4b57('0x43')]({'where':{'id':_0x3ec6ba[_0x4b57('0x47')]['id']}})['then'](handleEntityNotFound(_0x5ab120,null))[_0x4b57('0x25')](removeEntity(_0x5ab120,null))[_0x4b57('0x44')](handleError(_0x5ab120,null));};exports[_0x4b57('0x48')]=function(_0x488bea,_0x1579d1,_0x3d2336){var _0x343cec={};var _0xb56bf0={};var _0x44494f;var _0xb7c37c;return db[_0x4b57('0x2a')]['findOne']({'where':{'id':_0x488bea['params']['id']}})[_0x4b57('0x25')](handleEntityNotFound(_0x1579d1,null))[_0x4b57('0x25')](function(_0x3b4cbf){if(_0x3b4cbf){_0x44494f=_0x3b4cbf;_0xb56bf0[_0x4b57('0x2e')]=_['keys'](db[_0x4b57('0x49')][_0x4b57('0x2b')]);_0xb56bf0[_0x4b57('0x2f')]=_[_0x4b57('0x30')](_0x488bea['query']);_0xb56bf0['filters']=_[_0x4b57('0x32')](_0xb56bf0[_0x4b57('0x2e')],_0xb56bf0['query']);_0x343cec['attributes']=_[_0x4b57('0x32')](_0xb56bf0['model'],qs[_0x4b57('0x33')](_0x488bea[_0x4b57('0x2f')][_0x4b57('0x33')]));_0x343cec[_0x4b57('0x31')]=_0x343cec[_0x4b57('0x31')]['length']?_0x343cec['attributes']:_0xb56bf0['model'];_0x343cec['order']=qs[_0x4b57('0x35')](_0x488bea[_0x4b57('0x2f')]['sort']);_0x343cec[_0x4b57('0x36')]=qs[_0x4b57('0x37')](_[_0x4b57('0x38')](_0x488bea[_0x4b57('0x2f')],_0xb56bf0[_0x4b57('0x37')]));if(_0x488bea[_0x4b57('0x2f')][_0x4b57('0x39')]){_0x343cec[_0x4b57('0x36')]=_[_0x4b57('0x3a')](_0x343cec['where'],{'$or':_[_0x4b57('0x3b')](_0x343cec['attributes'],function(_0x10bd32){var _0x2f684b={};_0x2f684b[_0x10bd32]={'$like':'%'+_0x488bea['query'][_0x4b57('0x39')]+'%'};return _0x2f684b;})});}_0x343cec=_[_0x4b57('0x3a')]({},_0x343cec,_0x488bea[_0x4b57('0x4a')]);return _0x44494f[_0x4b57('0x48')](_0x343cec);}})[_0x4b57('0x25')](function(_0xc24706){if(_0xc24706){_0xb7c37c=_0xc24706[_0x4b57('0x4b')];if(!_0x488bea[_0x4b57('0x2f')][_0x4b57('0x4c')](_0x4b57('0x34'))){_0x343cec[_0x4b57('0x1d')]=qs[_0x4b57('0x1d')](_0x488bea['query'][_0x4b57('0x1d')]);_0x343cec[_0x4b57('0x1b')]=qs['offset'](_0x488bea[_0x4b57('0x2f')]['offset']);}return _0x44494f['getConfigurations'](_0x343cec);}})['then'](function(_0x1004ac){if(_0x1004ac){return _0x1004ac?{'count':_0xb7c37c,'rows':_0x1004ac}:null;}})['then'](respondWithResult(_0x1579d1,null))[_0x4b57('0x44')](handleError(_0x1579d1,null));};exports[_0x4b57('0x4d')]=function(_0x5e093a,_0x4cc278,_0x264c9f){if(_0x5e093a[_0x4b57('0x46')]['id']){delete _0x5e093a[_0x4b57('0x46')]['id'];}return db['ZendeskAccount'][_0x4b57('0x4e')]({'where':{'id':_0x5e093a[_0x4b57('0x47')]['id']}})['then'](handleEntityNotFound(_0x4cc278,null))[_0x4b57('0x25')](function(_0x119933){if(_0x119933){_0x5e093a['body'][_0x4b57('0x4f')]=_0x119933['id'];_0x5e093a[_0x4b57('0x46')][_0x4b57('0x50')]=integrations[_0x4b57('0x51')](_0x5e093a[_0x4b57('0x46')][_0x4b57('0x52')],_0x5e093a[_0x4b57('0x46')]['type']);_0x5e093a['body'][_0x4b57('0x53')]=integrations[_0x4b57('0x54')](_0x5e093a['body']['channel'],_0x5e093a[_0x4b57('0x46')][_0x4b57('0x3c')]);return db['ZendeskConfiguration']['create'](_0x5e093a['body'],{'include':[{'model':db[_0x4b57('0x55')],'as':_0x4b57('0x50')},{'model':db[_0x4b57('0x55')],'as':'Descriptions'}]});}return null;})['then'](respondWithResult(_0x4cc278,null))['catch'](handleError(_0x4cc278,null));};exports[_0x4b57('0x56')]=function(_0x59cd7c,_0x40cabe,_0x502313){var _0x13c680='';return db[_0x4b57('0x2a')][_0x4b57('0x4e')]({'where':{'id':_0x59cd7c[_0x4b57('0x47')]['id']},'attributes':['id','username',_0x4b57('0x57'),'token','authType',_0x4b57('0x58')]})[_0x4b57('0x25')](handleEntityNotFound(_0x40cabe,null))['then'](function(_0xf54f38){if(_0xf54f38){_0x13c680=_0xf54f38[_0x4b57('0x58')];var _0x355b5b=_0x13c680[_0x4b57('0x59')](-0x1);if(_0x355b5b==='/'){_0x13c680=_0x13c680[_0x4b57('0x5a')](0x0,_0x13c680[_0x4b57('0x5b')](_0x355b5b));}var _0x57e9eb={'method':_0x4b57('0x5c'),'uri':util[_0x4b57('0x5d')](_0x4b57('0x5e'),_0x13c680,_0x4b57('0x5f')),'json':!![]};switch(_0xf54f38[_0x4b57('0x60')]){case'password':_0x57e9eb[_0x4b57('0x61')]={'Authorization':util[_0x4b57('0x5d')](_0x4b57('0x62'),new Buffer(util[_0x4b57('0x5d')]('%s:%s',_0xf54f38['username'],_0xf54f38[_0x4b57('0x57')]))[_0x4b57('0x63')](_0x4b57('0x64')))};break;case'token':_0x57e9eb[_0x4b57('0x61')]={'Authorization':util['format'](_0x4b57('0x62'),new Buffer(util[_0x4b57('0x5d')]('%s/token:%s',_0xf54f38['username'],_0xf54f38[_0x4b57('0x65')]))['toString'](_0x4b57('0x64')))};break;default:throw new db[(_0x4b57('0x66'))][(_0x4b57('0x67'))](_0x4b57('0x68'));}return rp(_0x57e9eb);}})[_0x4b57('0x25')](function(_0x489f3c){if(_0x489f3c){var _0x137532=[_0x4b57('0x69'),_0x4b57('0x6a'),'group','assignee'];_[_0x4b57('0x6b')](_0x489f3c[_0x4b57('0x5f')],function(_0x540a0a){return _0x137532[_0x4b57('0x6c')](_0x540a0a[_0x4b57('0x3c')]);});return{'count':_0x489f3c['ticket_fields'][_0x4b57('0x4b')],'rows':_[_0x4b57('0x3b')](_0x489f3c['ticket_fields'],function(_0xdef470){return{'id':_0xdef470['id'],'name':_0xdef470[_0x4b57('0x6d')]>0x7?_0xdef470[_0x4b57('0x6e')]:_0xdef470['type'],'custom':_0xdef470[_0x4b57('0x6d')]>0x7?!![]:![],'options':_0xdef470[_0x4b57('0x6f')]?_0xdef470[_0x4b57('0x6f')]:_0xdef470[_0x4b57('0x70')]?_0xdef470[_0x4b57('0x70')]:[]};})};}})[_0x4b57('0x25')](respondWithResult(_0x40cabe,null))[_0x4b57('0x44')](function(_0x4e4bbd){var _0x183b8c=_0x59cd7c[_0x4b57('0x2f')]['test']?0x1f4:_0x4e4bbd[_0x4b57('0x71')]||0x1f4;logger[_0x4b57('0x26')]('getFields,\x20%s,\x20%s,\x20%s',_0x4b57('0x56'),_0x183b8c,JSON[_0x4b57('0x72')](_0x4e4bbd));delete _0x4e4bbd[_0x4b57('0x28')];if(_0x183b8c===0x191){_0x183b8c=0x190;}_0x40cabe[_0x4b57('0x18')](_0x183b8c)[_0x4b57('0x29')](_0x59cd7c[_0x4b57('0x2f')][_0x4b57('0x73')]?{'message':_0x4b57('0x74'),'statusCode':_0x4e4bbd[_0x4b57('0x71')]}:_0x4e4bbd);});}; \ No newline at end of file +var _0x4024=['token','authType','remoteUri','substring','lastIndexOf','format','ticket_fields','headers','Basic\x20%s','%s:%s','base64','%s/token:%s','toString','ValidationError','Unknown\x20authentication\x20type','subject','description','group','assignee','includes','position','system_field_options','custom_field_options','test','statusCode','error','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','eml-format','rimraf','fast-json-patch','request-promise','bluebird','util','path','ejs','fs-extra','lodash','crypto','to-csv','ioredis','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','update','then','destroy','stack','name','send','map','ZendeskAccount','rawAttributes','fieldName','type','key','model','query','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','filter','VIRTUAL','merge','includeAll','findAll','catch','params','keys','length','include','options','find','create','body','getConfigurations','findOne','ZendeskConfiguration','addConfiguration','Subjects','channel','getDescriptions','ZendeskField','getFields','username','password'];(function(_0x234a07,_0x1e46c9){var _0x51bb62=function(_0x1b93f7){while(--_0x1b93f7){_0x234a07['push'](_0x234a07['shift']());}};_0x51bb62(++_0x1e46c9);}(_0x4024,0x89));var _0x4402=function(_0x3a7e02,_0x3f5085){_0x3a7e02=_0x3a7e02-0x0;var _0x1956fc=_0x4024[_0x3a7e02];return _0x1956fc;};'use strict';var emlformat=require(_0x4402('0x0'));var rimraf=require(_0x4402('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4402('0x2'));var rp=require(_0x4402('0x3'));var moment=require('moment');var BPromise=require(_0x4402('0x4'));var Mustache=require('mustache');var util=require(_0x4402('0x5'));var path=require(_0x4402('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x4402('0x7'));var fs=require('fs');var fs_extra=require(_0x4402('0x8'));var _=require(_0x4402('0x9'));var squel=require('squel');var crypto=require(_0x4402('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x4402('0xb'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x4402('0xc'));var authService=require('../../components/auth/service');var qs=require(_0x4402('0xd'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4402('0xe'));var logger=require('../../config/logger')(_0x4402('0xf'));var utils=require(_0x4402('0x10'));var config=require('../../config/environment');var licenseUtil=require(_0x4402('0x11'));var db=require(_0x4402('0x12'))['db'];var integrations=require(_0x4402('0x13'));function respondWithStatusCode(_0x4c9032,_0x7e4475){_0x7e4475=_0x7e4475||0xcc;return function(_0x34d952){if(_0x34d952){return _0x4c9032[_0x4402('0x14')](_0x7e4475);}return _0x4c9032[_0x4402('0x15')](_0x7e4475)[_0x4402('0x16')]();};}function respondWithResult(_0x31710c,_0x18c7a8){_0x18c7a8=_0x18c7a8||0xc8;return function(_0x3c7dd2){if(_0x3c7dd2){return _0x31710c[_0x4402('0x15')](_0x18c7a8)[_0x4402('0x17')](_0x3c7dd2);}};}function respondWithFilteredResult(_0x375166,_0xc03f65){return function(_0x2a2ce8){if(_0x2a2ce8){var _0x19fe7b=typeof _0xc03f65[_0x4402('0x18')]===_0x4402('0x19')&&typeof _0xc03f65[_0x4402('0x1a')]===_0x4402('0x19');var _0x186c22=_0x2a2ce8[_0x4402('0x1b')];var _0x5b127f=_0x19fe7b?0x0:_0xc03f65['offset'];var _0x663ab7=_0x19fe7b?_0x2a2ce8[_0x4402('0x1b')]:_0xc03f65['offset']+_0xc03f65[_0x4402('0x1a')];var _0x192855;if(_0x663ab7>=_0x186c22){_0x663ab7=_0x186c22;_0x192855=0xc8;}else{_0x192855=0xce;}_0x375166['status'](_0x192855);return _0x375166[_0x4402('0x1c')]('Content-Range',_0x5b127f+'-'+_0x663ab7+'/'+_0x186c22)['json'](_0x2a2ce8);}return null;};}function patchUpdates(_0x1b9599){return function(_0x46a1ad){try{jsonpatch[_0x4402('0x1d')](_0x46a1ad,_0x1b9599,!![]);}catch(_0x49bc21){return BPromise[_0x4402('0x1e')](_0x49bc21);}return _0x46a1ad['save']();};}function saveUpdates(_0x47ab54,_0x6f1f72){return function(_0x275c70){if(_0x275c70){return _0x275c70[_0x4402('0x1f')](_0x47ab54)[_0x4402('0x20')](function(_0x258d10){return _0x258d10;});}return null;};}function removeEntity(_0x2e6fee,_0x289a3e){return function(_0x6b1fc5){if(_0x6b1fc5){return _0x6b1fc5[_0x4402('0x21')]()['then'](function(){_0x2e6fee[_0x4402('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3733cd,_0x5ab28d){return function(_0x29f56b){if(!_0x29f56b){_0x3733cd[_0x4402('0x14')](0x194);}return _0x29f56b;};}function handleError(_0x5a43d0,_0x15c19f){_0x15c19f=_0x15c19f||0x1f4;return function(_0x4e9cb5){logger['error'](_0x4e9cb5[_0x4402('0x22')]);if(_0x4e9cb5[_0x4402('0x23')]){delete _0x4e9cb5[_0x4402('0x23')];}_0x5a43d0[_0x4402('0x15')](_0x15c19f)[_0x4402('0x24')](_0x4e9cb5);};}exports['index']=function(_0x41de44,_0x52e625){var _0x71da2f={},_0x1e2340={},_0x42dd32={'count':0x0,'rows':[]};var _0x48d20d=_[_0x4402('0x25')](db[_0x4402('0x26')][_0x4402('0x27')],function(_0x3f4bcb){return{'name':_0x3f4bcb[_0x4402('0x28')],'type':_0x3f4bcb[_0x4402('0x29')][_0x4402('0x2a')]};});_0x1e2340[_0x4402('0x2b')]=_[_0x4402('0x25')](_0x48d20d,_0x4402('0x23'));_0x1e2340[_0x4402('0x2c')]=_['keys'](_0x41de44[_0x4402('0x2c')]);_0x1e2340['filters']=_[_0x4402('0x2d')](_0x1e2340['model'],_0x1e2340[_0x4402('0x2c')]);_0x71da2f[_0x4402('0x2e')]=_[_0x4402('0x2d')](_0x1e2340[_0x4402('0x2b')],qs[_0x4402('0x2f')](_0x41de44['query'][_0x4402('0x2f')]));_0x71da2f[_0x4402('0x2e')]=_0x71da2f[_0x4402('0x2e')]['length']?_0x71da2f[_0x4402('0x2e')]:_0x1e2340[_0x4402('0x2b')];if(!_0x41de44['query'][_0x4402('0x30')](_0x4402('0x31'))){_0x71da2f[_0x4402('0x1a')]=qs[_0x4402('0x1a')](_0x41de44[_0x4402('0x2c')][_0x4402('0x1a')]);_0x71da2f[_0x4402('0x18')]=qs[_0x4402('0x18')](_0x41de44[_0x4402('0x2c')]['offset']);}_0x71da2f[_0x4402('0x32')]=qs[_0x4402('0x33')](_0x41de44[_0x4402('0x2c')]['sort']);_0x71da2f[_0x4402('0x34')]=qs[_0x4402('0x35')](_['pick'](_0x41de44['query'],_0x1e2340[_0x4402('0x35')]),_0x48d20d);if(_0x41de44[_0x4402('0x2c')][_0x4402('0x36')]){_0x71da2f[_0x4402('0x34')]=_['merge'](_0x71da2f['where'],{'$or':_['map'](_0x48d20d,function(_0x3a5e62){if(_0x3a5e62[_0x4402('0x29')]!==_0x4402('0x37')){var _0x3fd8ce={};_0x3fd8ce[_0x3a5e62['name']]={'$like':'%'+_0x41de44[_0x4402('0x2c')][_0x4402('0x36')]+'%'};return _0x3fd8ce;}})});}_0x71da2f=_[_0x4402('0x38')]({},_0x71da2f,_0x41de44['options']);var _0x2b92b7={'where':_0x71da2f['where']};return db[_0x4402('0x26')][_0x4402('0x1b')](_0x2b92b7)['then'](function(_0x16ef2e){_0x42dd32['count']=_0x16ef2e;if(_0x41de44[_0x4402('0x2c')][_0x4402('0x39')]){_0x71da2f['include']=[{'all':!![]}];}return db[_0x4402('0x26')][_0x4402('0x3a')](_0x71da2f);})[_0x4402('0x20')](function(_0x23c43a){_0x42dd32['rows']=_0x23c43a;return _0x42dd32;})['then'](respondWithFilteredResult(_0x52e625,_0x71da2f))[_0x4402('0x3b')](handleError(_0x52e625,null));};exports['show']=function(_0x3a589b,_0x2a6d78){var _0xb9cf85={'raw':![],'where':{'id':_0x3a589b[_0x4402('0x3c')]['id']}},_0x2e2391={};_0x2e2391[_0x4402('0x2b')]=_[_0x4402('0x3d')](db[_0x4402('0x26')][_0x4402('0x27')]);_0x2e2391[_0x4402('0x2c')]=_['keys'](_0x3a589b[_0x4402('0x2c')]);_0x2e2391[_0x4402('0x35')]=_['intersection'](_0x2e2391[_0x4402('0x2b')],_0x2e2391[_0x4402('0x2c')]);_0xb9cf85['attributes']=_[_0x4402('0x2d')](_0x2e2391[_0x4402('0x2b')],qs[_0x4402('0x2f')](_0x3a589b[_0x4402('0x2c')][_0x4402('0x2f')]));_0xb9cf85['attributes']=_0xb9cf85[_0x4402('0x2e')][_0x4402('0x3e')]?_0xb9cf85[_0x4402('0x2e')]:_0x2e2391[_0x4402('0x2b')];if(_0x3a589b[_0x4402('0x2c')][_0x4402('0x39')]){_0xb9cf85[_0x4402('0x3f')]=[{'all':!![]}];}_0xb9cf85=_[_0x4402('0x38')]({},_0xb9cf85,_0x3a589b[_0x4402('0x40')]);return db[_0x4402('0x26')][_0x4402('0x41')](_0xb9cf85)['then'](handleEntityNotFound(_0x2a6d78,null))[_0x4402('0x20')](respondWithResult(_0x2a6d78,null))['catch'](handleError(_0x2a6d78,null));};exports[_0x4402('0x42')]=function(_0x34ce00,_0x54e67a){return db[_0x4402('0x26')][_0x4402('0x42')](_0x34ce00[_0x4402('0x43')],{})[_0x4402('0x20')](respondWithResult(_0x54e67a,0xc9))[_0x4402('0x3b')](handleError(_0x54e67a,null));};exports[_0x4402('0x1f')]=function(_0x5b094b,_0xd0c9a5){if(_0x5b094b[_0x4402('0x43')]['id']){delete _0x5b094b[_0x4402('0x43')]['id'];}return db[_0x4402('0x26')][_0x4402('0x41')]({'where':{'id':_0x5b094b[_0x4402('0x3c')]['id']}})[_0x4402('0x20')](handleEntityNotFound(_0xd0c9a5,null))[_0x4402('0x20')](saveUpdates(_0x5b094b[_0x4402('0x43')],null))['then'](respondWithResult(_0xd0c9a5,null))['catch'](handleError(_0xd0c9a5,null));};exports['destroy']=function(_0x4c2d2e,_0x257010){return db[_0x4402('0x26')][_0x4402('0x41')]({'where':{'id':_0x4c2d2e[_0x4402('0x3c')]['id']}})['then'](handleEntityNotFound(_0x257010,null))[_0x4402('0x20')](removeEntity(_0x257010,null))[_0x4402('0x3b')](handleError(_0x257010,null));};exports[_0x4402('0x44')]=function(_0x2a4ea7,_0x196b2f,_0x352898){var _0x12f1fa={};var _0x53d306={};var _0x325b20;var _0x2a8085;return db[_0x4402('0x26')][_0x4402('0x45')]({'where':{'id':_0x2a4ea7[_0x4402('0x3c')]['id']}})[_0x4402('0x20')](handleEntityNotFound(_0x196b2f,null))['then'](function(_0xe8a8e9){if(_0xe8a8e9){_0x325b20=_0xe8a8e9;_0x53d306[_0x4402('0x2b')]=_[_0x4402('0x3d')](db[_0x4402('0x46')][_0x4402('0x27')]);_0x53d306[_0x4402('0x2c')]=_[_0x4402('0x3d')](_0x2a4ea7['query']);_0x53d306['filters']=_[_0x4402('0x2d')](_0x53d306[_0x4402('0x2b')],_0x53d306[_0x4402('0x2c')]);_0x12f1fa['attributes']=_['intersection'](_0x53d306[_0x4402('0x2b')],qs[_0x4402('0x2f')](_0x2a4ea7[_0x4402('0x2c')][_0x4402('0x2f')]));_0x12f1fa[_0x4402('0x2e')]=_0x12f1fa[_0x4402('0x2e')][_0x4402('0x3e')]?_0x12f1fa[_0x4402('0x2e')]:_0x53d306[_0x4402('0x2b')];_0x12f1fa[_0x4402('0x32')]=qs[_0x4402('0x33')](_0x2a4ea7[_0x4402('0x2c')][_0x4402('0x33')]);_0x12f1fa['where']=qs[_0x4402('0x35')](_['pick'](_0x2a4ea7[_0x4402('0x2c')],_0x53d306['filters']));if(_0x2a4ea7[_0x4402('0x2c')][_0x4402('0x36')]){_0x12f1fa[_0x4402('0x34')]=_[_0x4402('0x38')](_0x12f1fa[_0x4402('0x34')],{'$or':_[_0x4402('0x25')](_0x12f1fa['attributes'],function(_0xe425d0){var _0x25c1fc={};_0x25c1fc[_0xe425d0]={'$like':'%'+_0x2a4ea7[_0x4402('0x2c')][_0x4402('0x36')]+'%'};return _0x25c1fc;})});}_0x12f1fa=_[_0x4402('0x38')]({},_0x12f1fa,_0x2a4ea7['options']);return _0x325b20[_0x4402('0x44')](_0x12f1fa);}})[_0x4402('0x20')](function(_0x474b04){if(_0x474b04){_0x2a8085=_0x474b04[_0x4402('0x3e')];if(!_0x2a4ea7[_0x4402('0x2c')][_0x4402('0x30')](_0x4402('0x31'))){_0x12f1fa[_0x4402('0x1a')]=qs['limit'](_0x2a4ea7[_0x4402('0x2c')][_0x4402('0x1a')]);_0x12f1fa['offset']=qs[_0x4402('0x18')](_0x2a4ea7[_0x4402('0x2c')]['offset']);}return _0x325b20['getConfigurations'](_0x12f1fa);}})[_0x4402('0x20')](function(_0x1746c6){if(_0x1746c6){return _0x1746c6?{'count':_0x2a8085,'rows':_0x1746c6}:null;}})[_0x4402('0x20')](respondWithResult(_0x196b2f,null))['catch'](handleError(_0x196b2f,null));};exports[_0x4402('0x47')]=function(_0x12f3ac,_0x30e49b,_0x55f261){if(_0x12f3ac[_0x4402('0x43')]['id']){delete _0x12f3ac[_0x4402('0x43')]['id'];}return db[_0x4402('0x26')]['findOne']({'where':{'id':_0x12f3ac[_0x4402('0x3c')]['id']}})[_0x4402('0x20')](handleEntityNotFound(_0x30e49b,null))['then'](function(_0x5cef56){if(_0x5cef56){_0x12f3ac[_0x4402('0x43')]['AccountId']=_0x5cef56['id'];_0x12f3ac[_0x4402('0x43')][_0x4402('0x48')]=integrations['getSubjects'](_0x12f3ac['body'][_0x4402('0x49')],_0x12f3ac[_0x4402('0x43')][_0x4402('0x29')]);_0x12f3ac[_0x4402('0x43')]['Descriptions']=integrations[_0x4402('0x4a')](_0x12f3ac[_0x4402('0x43')][_0x4402('0x49')],_0x12f3ac[_0x4402('0x43')][_0x4402('0x29')]);return db[_0x4402('0x46')][_0x4402('0x42')](_0x12f3ac['body'],{'include':[{'model':db[_0x4402('0x4b')],'as':_0x4402('0x48')},{'model':db['ZendeskField'],'as':'Descriptions'}]});}return null;})[_0x4402('0x20')](respondWithResult(_0x30e49b,null))['catch'](handleError(_0x30e49b,null));};exports[_0x4402('0x4c')]=function(_0x586689,_0xc2ac06,_0x10b89a){var _0x22260b='';return db[_0x4402('0x26')][_0x4402('0x45')]({'where':{'id':_0x586689[_0x4402('0x3c')]['id']},'attributes':['id',_0x4402('0x4d'),_0x4402('0x4e'),_0x4402('0x4f'),_0x4402('0x50'),_0x4402('0x51')]})[_0x4402('0x20')](handleEntityNotFound(_0xc2ac06,null))[_0x4402('0x20')](function(_0xcf5c20){if(_0xcf5c20){_0x22260b=_0xcf5c20[_0x4402('0x51')];var _0x1d6af2=_0x22260b['slice'](-0x1);if(_0x1d6af2==='/'){_0x22260b=_0x22260b[_0x4402('0x52')](0x0,_0x22260b[_0x4402('0x53')](_0x1d6af2));}var _0xccb64f={'method':'GET','uri':util[_0x4402('0x54')]('%s/%s',_0x22260b,_0x4402('0x55')),'json':!![]};switch(_0xcf5c20[_0x4402('0x50')]){case _0x4402('0x4e'):_0xccb64f[_0x4402('0x56')]={'Authorization':util['format'](_0x4402('0x57'),new Buffer(util['format'](_0x4402('0x58'),_0xcf5c20[_0x4402('0x4d')],_0xcf5c20[_0x4402('0x4e')]))['toString'](_0x4402('0x59')))};break;case'token':_0xccb64f[_0x4402('0x56')]={'Authorization':util[_0x4402('0x54')](_0x4402('0x57'),new Buffer(util[_0x4402('0x54')](_0x4402('0x5a'),_0xcf5c20[_0x4402('0x4d')],_0xcf5c20[_0x4402('0x4f')]))[_0x4402('0x5b')](_0x4402('0x59')))};break;default:throw new db['Sequelize'][(_0x4402('0x5c'))](_0x4402('0x5d'));}return rp(_0xccb64f);}})[_0x4402('0x20')](function(_0x221889){if(_0x221889){var _0x4734ef=[_0x4402('0x5e'),_0x4402('0x5f'),_0x4402('0x60'),_0x4402('0x61')];_['remove'](_0x221889[_0x4402('0x55')],function(_0x2a6dc1){return _0x4734ef[_0x4402('0x62')](_0x2a6dc1['type']);});return{'count':_0x221889[_0x4402('0x55')]['length'],'rows':_[_0x4402('0x25')](_0x221889['ticket_fields'],function(_0xc1d540){return{'id':_0xc1d540['id'],'name':_0xc1d540[_0x4402('0x63')]>0x7?_0xc1d540['title']:_0xc1d540[_0x4402('0x29')],'custom':_0xc1d540['position']>0x7?!![]:![],'options':_0xc1d540[_0x4402('0x64')]?_0xc1d540[_0x4402('0x64')]:_0xc1d540['custom_field_options']?_0xc1d540[_0x4402('0x65')]:[]};})};}})[_0x4402('0x20')](respondWithResult(_0xc2ac06,null))['catch'](function(_0x189259){var _0x13c47e=_0x586689['query'][_0x4402('0x66')]?0x1f4:_0x189259[_0x4402('0x67')]||0x1f4;logger[_0x4402('0x68')](_0x4402('0x69'),_0x4402('0x4c'),_0x13c47e,JSON[_0x4402('0x6a')](_0x189259));delete _0x189259[_0x4402('0x23')];if(_0x13c47e===0x191){_0x13c47e=0x190;}_0xc2ac06[_0x4402('0x15')](_0x13c47e)[_0x4402('0x24')](_0x586689[_0x4402('0x2c')][_0x4402('0x66')]?{'message':_0x4402('0x6b'),'statusCode':_0x189259[_0x4402('0x67')]}:_0x189259);});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.model.js b/server/api/intZendeskAccount/intZendeskAccount.model.js index c02b160..297fc8f 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 _0x5c51=['../../config/environment','./intZendeskAccount.attributes','../../components/integrations/configuration','exports','define','ZendeskAccount','int_zendesk_accounts','lodash','../../config/logger','api','moment','request-promise','rimraf'];(function(_0x1c0e1a,_0x361353){var _0x46840d=function(_0x460250){while(--_0x460250){_0x1c0e1a['push'](_0x1c0e1a['shift']());}};_0x46840d(++_0x361353);}(_0x5c51,0xfe));var _0x15c5=function(_0x374ccf,_0xa945c4){_0x374ccf=_0x374ccf-0x0;var _0x443cde=_0x5c51[_0x374ccf];return _0x443cde;};'use strict';var _=require(_0x15c5('0x0'));var util=require('util');var logger=require(_0x15c5('0x1'))(_0x15c5('0x2'));var moment=require(_0x15c5('0x3'));var BPromise=require('bluebird');var rp=require(_0x15c5('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x15c5('0x5'));var config=require(_0x15c5('0x6'));var attributes=require(_0x15c5('0x7'));var integrations=require(_0x15c5('0x8'));module[_0x15c5('0x9')]=function(_0x13e5e6,_0x3b9d27){return _0x13e5e6[_0x15c5('0xa')](_0x15c5('0xb'),attributes,{'tableName':_0x15c5('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5675=['path','rimraf','../../components/integrations/configuration','exports','ZendeskAccount','int_zendesk_accounts','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x3d0c8a,_0x3cba74){var _0x63fdfa=function(_0x5aae77){while(--_0x5aae77){_0x3d0c8a['push'](_0x3d0c8a['shift']());}};_0x63fdfa(++_0x3cba74);}(_0x5675,0x7b));var _0x5567=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x5675[_0x4b369d];return _0x571a98;};'use strict';var _=require(_0x5567('0x0'));var util=require(_0x5567('0x1'));var logger=require(_0x5567('0x2'))(_0x5567('0x3'));var moment=require(_0x5567('0x4'));var BPromise=require(_0x5567('0x5'));var rp=require(_0x5567('0x6'));var fs=require('fs');var path=require(_0x5567('0x7'));var rimraf=require(_0x5567('0x8'));var config=require('../../config/environment');var attributes=require('./intZendeskAccount.attributes');var integrations=require(_0x5567('0x9'));module[_0x5567('0xa')]=function(_0x336ee7,_0x4bf6fe){return _0x336ee7['define'](_0x5567('0xb'),attributes,{'tableName':_0x5567('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.rpc.js b/server/api/intZendeskAccount/intZendeskAccount.rpc.js index e02ad0c..68a4031 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 _0x1aaa=['catch','ShowZendeskAccount','find','raw','where','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','http','request','then','info','ZendeskAccount,\x20%s,\x20%s','debug','request\x20sent','stringify','code','error','message','result','ZendeskAccount','options','attributes','limit','include','map','model','GetZendeskAccount'];(function(_0x4ac3a1,_0x31e3d1){var _0x53dd42=function(_0x17ed8c){while(--_0x17ed8c){_0x4ac3a1['push'](_0x4ac3a1['shift']());}};_0x53dd42(++_0x31e3d1);}(_0x1aaa,0xe5));var _0xa1aa=function(_0x4409e7,_0x307f17){_0x4409e7=_0x4409e7-0x0;var _0x24c751=_0x1aaa[_0x4409e7];return _0x24c751;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0xa1aa('0x0'));var rs=require(_0xa1aa('0x1'));var fs=require('fs');var Redis=require(_0xa1aa('0x2'));var db=require(_0xa1aa('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xa1aa('0x4'))(_0xa1aa('0x5'));var config=require(_0xa1aa('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0xa1aa('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x4c2b63,_0x4d23aa,_0x19a158){return new BPromise(function(_0x3a9ca3,_0x464eb7){return client[_0xa1aa('0x8')](_0x4c2b63,_0x19a158)[_0xa1aa('0x9')](function(_0x22de93){logger[_0xa1aa('0xa')](_0xa1aa('0xb'),_0x4d23aa,'request\x20sent');logger[_0xa1aa('0xc')]('ZendeskAccount,\x20%s,\x20%s,\x20%s',_0x4d23aa,_0xa1aa('0xd'),JSON[_0xa1aa('0xe')](_0x22de93));if(_0x22de93['error']){if(_0x22de93['error'][_0xa1aa('0xf')]===0x1f4){logger[_0xa1aa('0x10')](_0xa1aa('0xb'),_0x4d23aa,_0x22de93[_0xa1aa('0x10')]['message']);return _0x464eb7(_0x22de93[_0xa1aa('0x10')][_0xa1aa('0x11')]);}logger[_0xa1aa('0x10')]('ZendeskAccount,\x20%s,\x20%s',_0x4d23aa,_0x22de93[_0xa1aa('0x10')]['message']);return _0x3a9ca3(_0x22de93[_0xa1aa('0x10')]['message']);}else{logger['info'](_0xa1aa('0xb'),_0x4d23aa,_0xa1aa('0xd'));_0x3a9ca3(_0x22de93[_0xa1aa('0x12')][_0xa1aa('0x11')]);}})['catch'](function(_0x1a9cb8){logger[_0xa1aa('0x10')](_0xa1aa('0xb'),_0x4d23aa,_0x1a9cb8);_0x464eb7(_0x1a9cb8);});});}exports['GetZendeskAccount']=function(_0x13b66b){var _0x2ed056=this;return new Promise(function(_0x2dfd13,_0x384909){return db[_0xa1aa('0x13')]['findAll']({'raw':_0x13b66b[_0xa1aa('0x14')]?_0x13b66b[_0xa1aa('0x14')]['raw']===undefined?!![]:![]:!![],'where':_0x13b66b['options']?_0x13b66b['options']['where']||null:null,'attributes':_0x13b66b[_0xa1aa('0x14')]?_0x13b66b['options'][_0xa1aa('0x15')]||null:null,'limit':_0x13b66b[_0xa1aa('0x14')]?_0x13b66b['options'][_0xa1aa('0x16')]||null:null,'include':_0x13b66b[_0xa1aa('0x14')]?_0x13b66b[_0xa1aa('0x14')][_0xa1aa('0x17')]?_['map'](_0x13b66b['options']['include'],function(_0x5ab683){return{'model':db[_0x5ab683['model']],'as':_0x5ab683['as'],'attributes':_0x5ab683[_0xa1aa('0x15')],'include':_0x5ab683[_0xa1aa('0x17')]?_[_0xa1aa('0x18')](_0x5ab683['include'],function(_0x50909f){return{'model':db[_0x50909f[_0xa1aa('0x19')]],'as':_0x50909f['as'],'attributes':_0x50909f[_0xa1aa('0x15')],'include':_0x50909f[_0xa1aa('0x17')]?_['map'](_0x50909f[_0xa1aa('0x17')],function(_0x19d54e){return{'model':db[_0x19d54e['model']],'as':_0x19d54e['as'],'attributes':_0x19d54e[_0xa1aa('0x15')]};}):[]};}):[]};}):[]:[]})[_0xa1aa('0x9')](function(_0x491fb7){logger['info'](_0xa1aa('0x1a'),_0x13b66b);logger['debug']('GetZendeskAccount',_0x13b66b,JSON[_0xa1aa('0xe')](_0x491fb7));_0x2dfd13(_0x491fb7);})[_0xa1aa('0x1b')](function(_0x2851a8){logger['error'](_0xa1aa('0x1a'),_0x2851a8[_0xa1aa('0x11')],_0x13b66b);_0x384909(_0x2ed056[_0xa1aa('0x10')](0x1f4,_0x2851a8[_0xa1aa('0x11')]));});});};exports[_0xa1aa('0x1c')]=function(_0xfee057){var _0x5c95e7=this;return new Promise(function(_0x39a390,_0x1a9237){return db[_0xa1aa('0x13')][_0xa1aa('0x1d')]({'raw':_0xfee057[_0xa1aa('0x14')]?_0xfee057[_0xa1aa('0x14')][_0xa1aa('0x1e')]===undefined?!![]:![]:!![],'where':_0xfee057[_0xa1aa('0x14')]?_0xfee057['options'][_0xa1aa('0x1f')]||null:null,'attributes':_0xfee057[_0xa1aa('0x14')]?_0xfee057[_0xa1aa('0x14')][_0xa1aa('0x15')]||null:null,'include':_0xfee057[_0xa1aa('0x14')]?_0xfee057[_0xa1aa('0x14')]['include']?_['map'](_0xfee057[_0xa1aa('0x14')][_0xa1aa('0x17')],function(_0x33bd25){return{'model':db[_0x33bd25[_0xa1aa('0x19')]],'as':_0x33bd25['as'],'attributes':_0x33bd25[_0xa1aa('0x15')],'include':_0x33bd25['include']?_[_0xa1aa('0x18')](_0x33bd25[_0xa1aa('0x17')],function(_0x2ea873){return{'model':db[_0x2ea873[_0xa1aa('0x19')]],'as':_0x2ea873['as'],'attributes':_0x2ea873[_0xa1aa('0x15')],'include':_0x2ea873['include']?_['map'](_0x2ea873[_0xa1aa('0x17')],function(_0x10d0c5){return{'model':db[_0x10d0c5['model']],'as':_0x10d0c5['as'],'attributes':_0x10d0c5[_0xa1aa('0x15')]};}):[]};}):[]};}):[]:[]})[_0xa1aa('0x9')](function(_0x456190){logger[_0xa1aa('0xa')](_0xa1aa('0x1c'),_0xfee057);logger[_0xa1aa('0xc')](_0xa1aa('0x1c'),_0xfee057,JSON[_0xa1aa('0xe')](_0x456190));_0x39a390(_0x456190);})[_0xa1aa('0x1b')](function(_0x5ee251){logger[_0xa1aa('0x10')](_0xa1aa('0x1c'),_0x5ee251[_0xa1aa('0x11')],_0xfee057);_0x1a9237(_0x5c95e7['error'](0x1f4,_0x5ee251['message']));});});}; \ No newline at end of file +var _0xa94b=['message','result','catch','GetZendeskAccount','ZendeskAccount','findAll','raw','options','where','attributes','limit','include','map','model','stringify','ShowZendeskAccount','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','info','ZendeskAccount,\x20%s,\x20%s','request\x20sent','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s','error','code'];(function(_0x31880d,_0x4f0ff3){var _0x423823=function(_0x57cc92){while(--_0x57cc92){_0x31880d['push'](_0x31880d['shift']());}};_0x423823(++_0x4f0ff3);}(_0xa94b,0x130));var _0xba94=function(_0x339acf,_0x55bb46){_0x339acf=_0x339acf-0x0;var _0x5d66f4=_0xa94b[_0x339acf];return _0x5d66f4;};'use strict';var _=require(_0xba94('0x0'));var util=require(_0xba94('0x1'));var moment=require(_0xba94('0x2'));var BPromise=require(_0xba94('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xba94('0x4'));var db=require(_0xba94('0x5'))['db'];var utils=require(_0xba94('0x6'));var logger=require(_0xba94('0x7'))(_0xba94('0x8'));var config=require('../../config/environment');var jayson=require(_0xba94('0x9'));var client=jayson[_0xba94('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x53b114,_0x1e7b3c,_0x533cb8){return new BPromise(function(_0x544600,_0x57cb15){return client[_0xba94('0xb')](_0x53b114,_0x533cb8)[_0xba94('0xc')](function(_0x1263b4){logger[_0xba94('0xd')](_0xba94('0xe'),_0x1e7b3c,_0xba94('0xf'));logger[_0xba94('0x10')](_0xba94('0x11'),_0x1e7b3c,_0xba94('0xf'),JSON['stringify'](_0x1263b4));if(_0x1263b4[_0xba94('0x12')]){if(_0x1263b4['error'][_0xba94('0x13')]===0x1f4){logger[_0xba94('0x12')](_0xba94('0xe'),_0x1e7b3c,_0x1263b4['error'][_0xba94('0x14')]);return _0x57cb15(_0x1263b4[_0xba94('0x12')][_0xba94('0x14')]);}logger['error'](_0xba94('0xe'),_0x1e7b3c,_0x1263b4[_0xba94('0x12')][_0xba94('0x14')]);return _0x544600(_0x1263b4[_0xba94('0x12')][_0xba94('0x14')]);}else{logger[_0xba94('0xd')](_0xba94('0xe'),_0x1e7b3c,_0xba94('0xf'));_0x544600(_0x1263b4[_0xba94('0x15')][_0xba94('0x14')]);}})[_0xba94('0x16')](function(_0x243c36){logger[_0xba94('0x12')](_0xba94('0xe'),_0x1e7b3c,_0x243c36);_0x57cb15(_0x243c36);});});}exports[_0xba94('0x17')]=function(_0x2b047d){var _0x224321=this;return new Promise(function(_0x11830c,_0x128651){return db[_0xba94('0x18')][_0xba94('0x19')]({'raw':_0x2b047d['options']?_0x2b047d['options'][_0xba94('0x1a')]===undefined?!![]:![]:!![],'where':_0x2b047d[_0xba94('0x1b')]?_0x2b047d[_0xba94('0x1b')][_0xba94('0x1c')]||null:null,'attributes':_0x2b047d[_0xba94('0x1b')]?_0x2b047d[_0xba94('0x1b')][_0xba94('0x1d')]||null:null,'limit':_0x2b047d['options']?_0x2b047d[_0xba94('0x1b')][_0xba94('0x1e')]||null:null,'include':_0x2b047d[_0xba94('0x1b')]?_0x2b047d[_0xba94('0x1b')][_0xba94('0x1f')]?_[_0xba94('0x20')](_0x2b047d['options'][_0xba94('0x1f')],function(_0x46aa41){return{'model':db[_0x46aa41['model']],'as':_0x46aa41['as'],'attributes':_0x46aa41[_0xba94('0x1d')],'include':_0x46aa41['include']?_[_0xba94('0x20')](_0x46aa41[_0xba94('0x1f')],function(_0x193c46){return{'model':db[_0x193c46[_0xba94('0x21')]],'as':_0x193c46['as'],'attributes':_0x193c46[_0xba94('0x1d')],'include':_0x193c46['include']?_[_0xba94('0x20')](_0x193c46['include'],function(_0x10bc64){return{'model':db[_0x10bc64[_0xba94('0x21')]],'as':_0x10bc64['as'],'attributes':_0x10bc64[_0xba94('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3095ad){logger[_0xba94('0xd')](_0xba94('0x17'),_0x2b047d);logger[_0xba94('0x10')](_0xba94('0x17'),_0x2b047d,JSON[_0xba94('0x22')](_0x3095ad));_0x11830c(_0x3095ad);})[_0xba94('0x16')](function(_0x49cff3){logger[_0xba94('0x12')]('GetZendeskAccount',_0x49cff3[_0xba94('0x14')],_0x2b047d);_0x128651(_0x224321[_0xba94('0x12')](0x1f4,_0x49cff3[_0xba94('0x14')]));});});};exports[_0xba94('0x23')]=function(_0x563614){var _0x4562ea=this;return new Promise(function(_0x5deec2,_0x117258){return db['ZendeskAccount']['find']({'raw':_0x563614[_0xba94('0x1b')]?_0x563614[_0xba94('0x1b')][_0xba94('0x1a')]===undefined?!![]:![]:!![],'where':_0x563614[_0xba94('0x1b')]?_0x563614[_0xba94('0x1b')]['where']||null:null,'attributes':_0x563614[_0xba94('0x1b')]?_0x563614[_0xba94('0x1b')][_0xba94('0x1d')]||null:null,'include':_0x563614[_0xba94('0x1b')]?_0x563614[_0xba94('0x1b')][_0xba94('0x1f')]?_['map'](_0x563614[_0xba94('0x1b')][_0xba94('0x1f')],function(_0x5538c1){return{'model':db[_0x5538c1['model']],'as':_0x5538c1['as'],'attributes':_0x5538c1[_0xba94('0x1d')],'include':_0x5538c1[_0xba94('0x1f')]?_['map'](_0x5538c1[_0xba94('0x1f')],function(_0x2785fb){return{'model':db[_0x2785fb['model']],'as':_0x2785fb['as'],'attributes':_0x2785fb[_0xba94('0x1d')],'include':_0x2785fb['include']?_[_0xba94('0x20')](_0x2785fb[_0xba94('0x1f')],function(_0x2f8d61){return{'model':db[_0x2f8d61[_0xba94('0x21')]],'as':_0x2f8d61['as'],'attributes':_0x2f8d61[_0xba94('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xba94('0xc')](function(_0x5a94f6){logger['info'](_0xba94('0x23'),_0x563614);logger[_0xba94('0x10')](_0xba94('0x23'),_0x563614,JSON[_0xba94('0x22')](_0x5a94f6));_0x5deec2(_0x5a94f6);})['catch'](function(_0x3964e0){logger['error'](_0xba94('0x23'),_0x3964e0[_0xba94('0x14')],_0x563614);_0x117258(_0x4562ea[_0xba94('0x12')](0x1f4,_0x3964e0[_0xba94('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/index.js b/server/api/intZendeskConfiguration/index.js index 7d04e2d..420f3f3 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(_0x255a66,_0x2a3b03){var _0x2d07fc=function(_0x22a2f5){while(--_0x22a2f5){_0x255a66['push'](_0x255a66['shift']());}};_0x2d07fc(++_0x2a3b03);}(_0x757a,0xde));var _0xa757=function(_0x4ea859,_0x4ffa0f){_0x4ea859=_0x4ea859-0x0;var _0x3dfa08=_0x757a[_0x4ea859];return _0x3dfa08;};'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 _0x4fc2=['get','/:id/fields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','post','create','put','update','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./intZendeskConfiguration.controller','isAuthenticated','index','/:id','show'];(function(_0x238824,_0x2bba29){var _0x3101fa=function(_0x4c799d){while(--_0x4c799d){_0x238824['push'](_0x238824['shift']());}};_0x3101fa(++_0x2bba29);}(_0x4fc2,0x111));var _0x24fc=function(_0x5ba38a,_0x132834){_0x5ba38a=_0x5ba38a-0x0;var _0x28eebe=_0x4fc2[_0x5ba38a];return _0x28eebe;};'use strict';var multer=require(_0x24fc('0x0'));var util=require(_0x24fc('0x1'));var path=require(_0x24fc('0x2'));var timeout=require(_0x24fc('0x3'));var express=require('express');var router=express[_0x24fc('0x4')]();var fs_extra=require(_0x24fc('0x5'));var auth=require(_0x24fc('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x24fc('0x7'));var controller=require(_0x24fc('0x8'));router['get']('/',auth[_0x24fc('0x9')](),controller[_0x24fc('0xa')]);router['get'](_0x24fc('0xb'),auth[_0x24fc('0x9')](),controller[_0x24fc('0xc')]);router[_0x24fc('0xd')](_0x24fc('0xe'),auth[_0x24fc('0x9')](),controller['getFields']);router[_0x24fc('0xd')](_0x24fc('0xf'),auth[_0x24fc('0x9')](),controller[_0x24fc('0x10')]);router[_0x24fc('0xd')](_0x24fc('0x11'),auth[_0x24fc('0x9')](),controller[_0x24fc('0x12')]);router['get'](_0x24fc('0x13'),auth[_0x24fc('0x9')](),controller['getTags']);router[_0x24fc('0x14')]('/',auth[_0x24fc('0x9')](),controller[_0x24fc('0x15')]);router[_0x24fc('0x14')](_0x24fc('0x13'),auth[_0x24fc('0x9')](),controller['setTags']);router[_0x24fc('0x16')](_0x24fc('0xb'),auth[_0x24fc('0x9')](),controller[_0x24fc('0x17')]);router['delete'](_0x24fc('0xb'),auth['isAuthenticated'](),controller[_0x24fc('0x18')]);module[_0x24fc('0x19')]=router; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js index 065e83c..512adb7 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 _0x274f=['STRING','sequelize'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x274f,0x163));var _0xf274=function(_0x3ae6a3,_0x509eb4){_0x3ae6a3=_0x3ae6a3-0x0;var _0x414586=_0x274f[_0x3ae6a3];return _0x414586;};'use strict';var Sequelize=require(_0xf274('0x0'));module['exports']={'name':{'type':Sequelize[_0xf274('0x1')]},'description':{'type':Sequelize[_0xf274('0x1')]}}; \ No newline at end of file +var _0x0ff8=['exports','STRING','sequelize'];(function(_0x3abc7f,_0x1aa149){var _0x2decb9=function(_0x4a9a17){while(--_0x4a9a17){_0x3abc7f['push'](_0x3abc7f['shift']());}};_0x2decb9(++_0x1aa149);}(_0x0ff8,0x173));var _0x80ff=function(_0x2c1873,_0x233885){_0x2c1873=_0x2c1873-0x0;var _0x10740a=_0x0ff8[_0x2c1873];return _0x10740a;};'use strict';var Sequelize=require(_0x80ff('0x0'));module[_0x80ff('0x1')]={'name':{'type':Sequelize[_0x80ff('0x2')]},'description':{'type':Sequelize[_0x80ff('0x2')]}}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js index a9f8ec4..4d08f27 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 _0x0c1c=['options','create','body','find','getFields','findOne','ZendeskField','hasOwnProperty','nolimit','getSubjects','getDescriptions','getTags','setTags','eml-format','rimraf','fast-json-patch','request-promise','moment','util','sox','to-csv','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','then','end','stack','name','send','index','map','fieldName','type','key','query','keys','filters','model','attributes','intersection','fields','length','order','sort','where','pick','filter','merge','VIRTUAL','ZendeskConfiguration','includeAll','include','findAll','rows','catch','show','params','rawAttributes'];(function(_0x206ca8,_0x34739a){var _0x508d10=function(_0x3a27a7){while(--_0x3a27a7){_0x206ca8['push'](_0x206ca8['shift']());}};_0x508d10(++_0x34739a);}(_0x0c1c,0x1ac));var _0xc0c1=function(_0x5bd4f6,_0xf4e45c){_0x5bd4f6=_0x5bd4f6-0x0;var _0x33a165=_0x0c1c[_0x5bd4f6];return _0x33a165;};'use strict';var emlformat=require(_0xc0c1('0x0'));var rimraf=require(_0xc0c1('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc0c1('0x2'));var rp=require(_0xc0c1('0x3'));var moment=require(_0xc0c1('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xc0c1('0x5'));var path=require('path');var sox=require(_0xc0c1('0x6'));var csv=require(_0xc0c1('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc0c1('0x8'));var _=require(_0xc0c1('0x9'));var squel=require(_0xc0c1('0xa'));var crypto=require(_0xc0c1('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xc0c1('0xc'));var toCsv=require(_0xc0c1('0x7'));var querystring=require(_0xc0c1('0xd'));var Papa=require(_0xc0c1('0xe'));var Redis=require('ioredis');var authService=require(_0xc0c1('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xc0c1('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xc0c1('0x11'));var utils=require(_0xc0c1('0x12'));var config=require(_0xc0c1('0x13'));var licenseUtil=require(_0xc0c1('0x14'));var db=require(_0xc0c1('0x15'))['db'];function respondWithStatusCode(_0xed477e,_0x236d30){_0x236d30=_0x236d30||0xcc;return function(_0x187bcf){if(_0x187bcf){return _0xed477e[_0xc0c1('0x16')](_0x236d30);}return _0xed477e[_0xc0c1('0x17')](_0x236d30)['end']();};}function respondWithResult(_0xf77b18,_0x37d217){_0x37d217=_0x37d217||0xc8;return function(_0x5bcb97){if(_0x5bcb97){return _0xf77b18[_0xc0c1('0x17')](_0x37d217)[_0xc0c1('0x18')](_0x5bcb97);}};}function respondWithFilteredResult(_0x4d9d25,_0x50470f){return function(_0x7b05ea){if(_0x7b05ea){var _0x18b311=typeof _0x50470f[_0xc0c1('0x19')]===_0xc0c1('0x1a')&&typeof _0x50470f[_0xc0c1('0x1b')]===_0xc0c1('0x1a');var _0x5677c8=_0x7b05ea['count'];var _0xca5132=_0x18b311?0x0:_0x50470f[_0xc0c1('0x19')];var _0x1e58d9=_0x18b311?_0x7b05ea[_0xc0c1('0x1c')]:_0x50470f['offset']+_0x50470f[_0xc0c1('0x1b')];var _0x57c1ad;if(_0x1e58d9>=_0x5677c8){_0x1e58d9=_0x5677c8;_0x57c1ad=0xc8;}else{_0x57c1ad=0xce;}_0x4d9d25[_0xc0c1('0x17')](_0x57c1ad);return _0x4d9d25[_0xc0c1('0x1d')](_0xc0c1('0x1e'),_0xca5132+'-'+_0x1e58d9+'/'+_0x5677c8)[_0xc0c1('0x18')](_0x7b05ea);}return null;};}function patchUpdates(_0x169bd5){return function(_0x451dc6){try{jsonpatch[_0xc0c1('0x1f')](_0x451dc6,_0x169bd5,!![]);}catch(_0x5ea91f){return BPromise[_0xc0c1('0x20')](_0x5ea91f);}return _0x451dc6[_0xc0c1('0x21')]();};}function saveUpdates(_0x1edfd6,_0x17399f){return function(_0x368339){if(_0x368339){return _0x368339[_0xc0c1('0x22')](_0x1edfd6)['then'](function(_0x3e2358){return _0x3e2358;});}return null;};}function removeEntity(_0x5336c3,_0x3e175a){return function(_0x5ad7ec){if(_0x5ad7ec){return _0x5ad7ec[_0xc0c1('0x23')]()[_0xc0c1('0x24')](function(){_0x5336c3[_0xc0c1('0x17')](0xcc)[_0xc0c1('0x25')]();});}};}function handleEntityNotFound(_0x1c0126,_0x5f0471){return function(_0x5ec48f){if(!_0x5ec48f){_0x1c0126['sendStatus'](0x194);}return _0x5ec48f;};}function handleError(_0x1b7437,_0x15f044){_0x15f044=_0x15f044||0x1f4;return function(_0x2ea3dd){logger['error'](_0x2ea3dd[_0xc0c1('0x26')]);if(_0x2ea3dd[_0xc0c1('0x27')]){delete _0x2ea3dd['name'];}_0x1b7437[_0xc0c1('0x17')](_0x15f044)[_0xc0c1('0x28')](_0x2ea3dd);};}exports[_0xc0c1('0x29')]=function(_0x1927fd,_0x3b10ed){var _0x2d2e01={},_0x4804d2={},_0x3a6011={'count':0x0,'rows':[]};var _0x21d757=_[_0xc0c1('0x2a')](db['ZendeskConfiguration']['rawAttributes'],function(_0x4e79e8){return{'name':_0x4e79e8[_0xc0c1('0x2b')],'type':_0x4e79e8[_0xc0c1('0x2c')][_0xc0c1('0x2d')]};});_0x4804d2['model']=_[_0xc0c1('0x2a')](_0x21d757,_0xc0c1('0x27'));_0x4804d2[_0xc0c1('0x2e')]=_[_0xc0c1('0x2f')](_0x1927fd[_0xc0c1('0x2e')]);_0x4804d2[_0xc0c1('0x30')]=_['intersection'](_0x4804d2[_0xc0c1('0x31')],_0x4804d2['query']);_0x2d2e01[_0xc0c1('0x32')]=_[_0xc0c1('0x33')](_0x4804d2[_0xc0c1('0x31')],qs[_0xc0c1('0x34')](_0x1927fd[_0xc0c1('0x2e')][_0xc0c1('0x34')]));_0x2d2e01[_0xc0c1('0x32')]=_0x2d2e01[_0xc0c1('0x32')][_0xc0c1('0x35')]?_0x2d2e01['attributes']:_0x4804d2['model'];if(!_0x1927fd['query']['hasOwnProperty']('nolimit')){_0x2d2e01[_0xc0c1('0x1b')]=qs['limit'](_0x1927fd[_0xc0c1('0x2e')][_0xc0c1('0x1b')]);_0x2d2e01[_0xc0c1('0x19')]=qs[_0xc0c1('0x19')](_0x1927fd[_0xc0c1('0x2e')][_0xc0c1('0x19')]);}_0x2d2e01[_0xc0c1('0x36')]=qs[_0xc0c1('0x37')](_0x1927fd[_0xc0c1('0x2e')][_0xc0c1('0x37')]);_0x2d2e01[_0xc0c1('0x38')]=qs['filters'](_[_0xc0c1('0x39')](_0x1927fd[_0xc0c1('0x2e')],_0x4804d2[_0xc0c1('0x30')]),_0x21d757);if(_0x1927fd['query'][_0xc0c1('0x3a')]){_0x2d2e01[_0xc0c1('0x38')]=_[_0xc0c1('0x3b')](_0x2d2e01['where'],{'$or':_[_0xc0c1('0x2a')](_0x21d757,function(_0x5c192f){if(_0x5c192f[_0xc0c1('0x2c')]!==_0xc0c1('0x3c')){var _0x3dde5e={};_0x3dde5e[_0x5c192f[_0xc0c1('0x27')]]={'$like':'%'+_0x1927fd[_0xc0c1('0x2e')]['filter']+'%'};return _0x3dde5e;}})});}_0x2d2e01=_['merge']({},_0x2d2e01,_0x1927fd['options']);var _0x40ca2d={'where':_0x2d2e01[_0xc0c1('0x38')]};return db[_0xc0c1('0x3d')]['count'](_0x40ca2d)['then'](function(_0x3ac960){_0x3a6011[_0xc0c1('0x1c')]=_0x3ac960;if(_0x1927fd[_0xc0c1('0x2e')][_0xc0c1('0x3e')]){_0x2d2e01[_0xc0c1('0x3f')]=[{'all':!![]}];}return db[_0xc0c1('0x3d')][_0xc0c1('0x40')](_0x2d2e01);})[_0xc0c1('0x24')](function(_0x2d6dc1){_0x3a6011[_0xc0c1('0x41')]=_0x2d6dc1;return _0x3a6011;})[_0xc0c1('0x24')](respondWithFilteredResult(_0x3b10ed,_0x2d2e01))[_0xc0c1('0x42')](handleError(_0x3b10ed,null));};exports[_0xc0c1('0x43')]=function(_0x5e2790,_0x51c554){var _0x26eb40={'raw':![],'where':{'id':_0x5e2790[_0xc0c1('0x44')]['id']}},_0x5c8a88={};_0x5c8a88[_0xc0c1('0x31')]=_[_0xc0c1('0x2f')](db[_0xc0c1('0x3d')][_0xc0c1('0x45')]);_0x5c8a88[_0xc0c1('0x2e')]=_[_0xc0c1('0x2f')](_0x5e2790[_0xc0c1('0x2e')]);_0x5c8a88['filters']=_[_0xc0c1('0x33')](_0x5c8a88['model'],_0x5c8a88['query']);_0x26eb40[_0xc0c1('0x32')]=_[_0xc0c1('0x33')](_0x5c8a88['model'],qs[_0xc0c1('0x34')](_0x5e2790[_0xc0c1('0x2e')][_0xc0c1('0x34')]));_0x26eb40['attributes']=_0x26eb40[_0xc0c1('0x32')]['length']?_0x26eb40['attributes']:_0x5c8a88[_0xc0c1('0x31')];if(_0x5e2790[_0xc0c1('0x2e')][_0xc0c1('0x3e')]){_0x26eb40[_0xc0c1('0x3f')]=[{'all':!![]}];}_0x26eb40=_[_0xc0c1('0x3b')]({},_0x26eb40,_0x5e2790[_0xc0c1('0x46')]);return db['ZendeskConfiguration']['find'](_0x26eb40)[_0xc0c1('0x24')](handleEntityNotFound(_0x51c554,null))[_0xc0c1('0x24')](respondWithResult(_0x51c554,null))[_0xc0c1('0x42')](handleError(_0x51c554,null));};exports[_0xc0c1('0x47')]=function(_0x10bc44,_0x5d7e64){return db[_0xc0c1('0x3d')][_0xc0c1('0x47')](_0x10bc44[_0xc0c1('0x48')],{})[_0xc0c1('0x24')](respondWithResult(_0x5d7e64,0xc9))[_0xc0c1('0x42')](handleError(_0x5d7e64,null));};exports[_0xc0c1('0x22')]=function(_0x398ed5,_0x31787c){if(_0x398ed5[_0xc0c1('0x48')]['id']){delete _0x398ed5[_0xc0c1('0x48')]['id'];}return db[_0xc0c1('0x3d')][_0xc0c1('0x49')]({'where':{'id':_0x398ed5[_0xc0c1('0x44')]['id']}})[_0xc0c1('0x24')](handleEntityNotFound(_0x31787c,null))[_0xc0c1('0x24')](saveUpdates(_0x398ed5[_0xc0c1('0x48')],null))[_0xc0c1('0x24')](respondWithResult(_0x31787c,null))['catch'](handleError(_0x31787c,null));};exports[_0xc0c1('0x23')]=function(_0x3d9662,_0x645deb){return db[_0xc0c1('0x3d')][_0xc0c1('0x49')]({'where':{'id':_0x3d9662[_0xc0c1('0x44')]['id']}})[_0xc0c1('0x24')](handleEntityNotFound(_0x645deb,null))[_0xc0c1('0x24')](removeEntity(_0x645deb,null))[_0xc0c1('0x42')](handleError(_0x645deb,null));};exports[_0xc0c1('0x4a')]=function(_0x32f76f,_0x142368,_0xcab3de){var _0x39559c={};var _0x4ddbaf={};var _0x3afba3;var _0x486fa2;return db[_0xc0c1('0x3d')][_0xc0c1('0x4b')]({'where':{'id':_0x32f76f[_0xc0c1('0x44')]['id']}})[_0xc0c1('0x24')](handleEntityNotFound(_0x142368,null))['then'](function(_0x5caad4){if(_0x5caad4){_0x3afba3=_0x5caad4;_0x4ddbaf[_0xc0c1('0x31')]=_[_0xc0c1('0x2f')](db[_0xc0c1('0x4c')][_0xc0c1('0x45')]);_0x4ddbaf[_0xc0c1('0x2e')]=_['keys'](_0x32f76f[_0xc0c1('0x2e')]);_0x4ddbaf[_0xc0c1('0x30')]=_[_0xc0c1('0x33')](_0x4ddbaf[_0xc0c1('0x31')],_0x4ddbaf[_0xc0c1('0x2e')]);_0x39559c[_0xc0c1('0x32')]=_[_0xc0c1('0x33')](_0x4ddbaf[_0xc0c1('0x31')],qs['fields'](_0x32f76f[_0xc0c1('0x2e')][_0xc0c1('0x34')]));_0x39559c['attributes']=_0x39559c[_0xc0c1('0x32')][_0xc0c1('0x35')]?_0x39559c[_0xc0c1('0x32')]:_0x4ddbaf[_0xc0c1('0x31')];_0x39559c[_0xc0c1('0x36')]=qs[_0xc0c1('0x37')](_0x32f76f[_0xc0c1('0x2e')][_0xc0c1('0x37')]);_0x39559c[_0xc0c1('0x38')]=qs[_0xc0c1('0x30')](_[_0xc0c1('0x39')](_0x32f76f[_0xc0c1('0x2e')],_0x4ddbaf['filters']));if(_0x32f76f[_0xc0c1('0x2e')]['filter']){_0x39559c[_0xc0c1('0x38')]=_[_0xc0c1('0x3b')](_0x39559c['where'],{'$or':_[_0xc0c1('0x2a')](_0x39559c[_0xc0c1('0x32')],function(_0x168a1d){var _0x33ebff={};_0x33ebff[_0x168a1d]={'$like':'%'+_0x32f76f[_0xc0c1('0x2e')][_0xc0c1('0x3a')]+'%'};return _0x33ebff;})});}_0x39559c=_[_0xc0c1('0x3b')]({},_0x39559c,_0x32f76f['options']);return _0x3afba3[_0xc0c1('0x4a')](_0x39559c);}})[_0xc0c1('0x24')](function(_0x4e879b){if(_0x4e879b){_0x486fa2=_0x4e879b[_0xc0c1('0x35')];if(!_0x32f76f['query'][_0xc0c1('0x4d')](_0xc0c1('0x4e'))){_0x39559c[_0xc0c1('0x1b')]=qs[_0xc0c1('0x1b')](_0x32f76f[_0xc0c1('0x2e')]['limit']);_0x39559c[_0xc0c1('0x19')]=qs[_0xc0c1('0x19')](_0x32f76f[_0xc0c1('0x2e')][_0xc0c1('0x19')]);}return _0x3afba3['getFields'](_0x39559c);}})['then'](function(_0x3291e7){if(_0x3291e7){return _0x3291e7?{'count':_0x486fa2,'rows':_0x3291e7}:null;}})['then'](respondWithResult(_0x142368,null))[_0xc0c1('0x42')](handleError(_0x142368,null));};exports[_0xc0c1('0x4f')]=function(_0x438bfe,_0x31a091,_0x31d63d){var _0x3b6541={};var _0x548dac={};var _0x5917a9;var _0x3fdfe4;return db['ZendeskConfiguration'][_0xc0c1('0x4b')]({'where':{'id':_0x438bfe[_0xc0c1('0x44')]['id']}})[_0xc0c1('0x24')](handleEntityNotFound(_0x31a091,null))[_0xc0c1('0x24')](function(_0x4d8775){if(_0x4d8775){_0x5917a9=_0x4d8775;_0x548dac['model']=_['keys'](db[_0xc0c1('0x4c')][_0xc0c1('0x45')]);_0x548dac['query']=_['keys'](_0x438bfe[_0xc0c1('0x2e')]);_0x548dac[_0xc0c1('0x30')]=_[_0xc0c1('0x33')](_0x548dac[_0xc0c1('0x31')],_0x548dac[_0xc0c1('0x2e')]);_0x3b6541[_0xc0c1('0x32')]=_['intersection'](_0x548dac[_0xc0c1('0x31')],qs['fields'](_0x438bfe['query'][_0xc0c1('0x34')]));_0x3b6541[_0xc0c1('0x32')]=_0x3b6541[_0xc0c1('0x32')][_0xc0c1('0x35')]?_0x3b6541[_0xc0c1('0x32')]:_0x548dac['model'];_0x3b6541[_0xc0c1('0x36')]=qs[_0xc0c1('0x37')](_0x438bfe[_0xc0c1('0x2e')]['sort']);_0x3b6541['where']=qs['filters'](_[_0xc0c1('0x39')](_0x438bfe[_0xc0c1('0x2e')],_0x548dac[_0xc0c1('0x30')]));if(_0x438bfe[_0xc0c1('0x2e')][_0xc0c1('0x3a')]){_0x3b6541[_0xc0c1('0x38')]=_['merge'](_0x3b6541[_0xc0c1('0x38')],{'$or':_[_0xc0c1('0x2a')](_0x3b6541[_0xc0c1('0x32')],function(_0x5e4474){var _0x587b7b={};_0x587b7b[_0x5e4474]={'$like':'%'+_0x438bfe[_0xc0c1('0x2e')][_0xc0c1('0x3a')]+'%'};return _0x587b7b;})});}_0x3b6541=_[_0xc0c1('0x3b')]({},_0x3b6541,_0x438bfe[_0xc0c1('0x46')]);return _0x5917a9['getSubjects'](_0x3b6541);}})[_0xc0c1('0x24')](function(_0x595d59){if(_0x595d59){_0x3fdfe4=_0x595d59[_0xc0c1('0x35')];if(!_0x438bfe[_0xc0c1('0x2e')][_0xc0c1('0x4d')]('nolimit')){_0x3b6541[_0xc0c1('0x1b')]=qs['limit'](_0x438bfe[_0xc0c1('0x2e')][_0xc0c1('0x1b')]);_0x3b6541[_0xc0c1('0x19')]=qs[_0xc0c1('0x19')](_0x438bfe[_0xc0c1('0x2e')]['offset']);}return _0x5917a9[_0xc0c1('0x4f')](_0x3b6541);}})[_0xc0c1('0x24')](function(_0x50d6d0){if(_0x50d6d0){return _0x50d6d0?{'count':_0x3fdfe4,'rows':_0x50d6d0}:null;}})[_0xc0c1('0x24')](respondWithResult(_0x31a091,null))[_0xc0c1('0x42')](handleError(_0x31a091,null));};exports['getDescriptions']=function(_0x492244,_0x3e0147,_0x18b2c3){var _0x23415f={};var _0x5a9b9a={};var _0x19b2a5;var _0x41a450;return db[_0xc0c1('0x3d')][_0xc0c1('0x4b')]({'where':{'id':_0x492244[_0xc0c1('0x44')]['id']}})[_0xc0c1('0x24')](handleEntityNotFound(_0x3e0147,null))['then'](function(_0x468976){if(_0x468976){_0x19b2a5=_0x468976;_0x5a9b9a['model']=_[_0xc0c1('0x2f')](db['ZendeskField'][_0xc0c1('0x45')]);_0x5a9b9a[_0xc0c1('0x2e')]=_[_0xc0c1('0x2f')](_0x492244['query']);_0x5a9b9a[_0xc0c1('0x30')]=_[_0xc0c1('0x33')](_0x5a9b9a[_0xc0c1('0x31')],_0x5a9b9a[_0xc0c1('0x2e')]);_0x23415f[_0xc0c1('0x32')]=_[_0xc0c1('0x33')](_0x5a9b9a[_0xc0c1('0x31')],qs[_0xc0c1('0x34')](_0x492244[_0xc0c1('0x2e')][_0xc0c1('0x34')]));_0x23415f['attributes']=_0x23415f[_0xc0c1('0x32')][_0xc0c1('0x35')]?_0x23415f[_0xc0c1('0x32')]:_0x5a9b9a[_0xc0c1('0x31')];_0x23415f[_0xc0c1('0x36')]=qs[_0xc0c1('0x37')](_0x492244[_0xc0c1('0x2e')][_0xc0c1('0x37')]);_0x23415f[_0xc0c1('0x38')]=qs['filters'](_[_0xc0c1('0x39')](_0x492244[_0xc0c1('0x2e')],_0x5a9b9a['filters']));if(_0x492244[_0xc0c1('0x2e')]['filter']){_0x23415f[_0xc0c1('0x38')]=_[_0xc0c1('0x3b')](_0x23415f[_0xc0c1('0x38')],{'$or':_[_0xc0c1('0x2a')](_0x23415f[_0xc0c1('0x32')],function(_0xb07471){var _0x2883d9={};_0x2883d9[_0xb07471]={'$like':'%'+_0x492244['query'][_0xc0c1('0x3a')]+'%'};return _0x2883d9;})});}_0x23415f=_[_0xc0c1('0x3b')]({},_0x23415f,_0x492244['options']);return _0x19b2a5[_0xc0c1('0x50')](_0x23415f);}})[_0xc0c1('0x24')](function(_0x900e62){if(_0x900e62){_0x41a450=_0x900e62[_0xc0c1('0x35')];if(!_0x492244[_0xc0c1('0x2e')][_0xc0c1('0x4d')]('nolimit')){_0x23415f[_0xc0c1('0x1b')]=qs[_0xc0c1('0x1b')](_0x492244[_0xc0c1('0x2e')]['limit']);_0x23415f[_0xc0c1('0x19')]=qs['offset'](_0x492244[_0xc0c1('0x2e')][_0xc0c1('0x19')]);}return _0x19b2a5[_0xc0c1('0x50')](_0x23415f);}})[_0xc0c1('0x24')](function(_0x26c78f){if(_0x26c78f){return _0x26c78f?{'count':_0x41a450,'rows':_0x26c78f}:null;}})[_0xc0c1('0x24')](respondWithResult(_0x3e0147,null))[_0xc0c1('0x42')](handleError(_0x3e0147,null));};exports['getTags']=function(_0x4786a1,_0x29edc2,_0x3f9ffa){var _0x21294f={};var _0x5cb8b0={};var _0x9ef0a7;var _0xaba72e;return db[_0xc0c1('0x3d')][_0xc0c1('0x4b')]({'where':{'id':_0x4786a1['params']['id']}})[_0xc0c1('0x24')](handleEntityNotFound(_0x29edc2,null))[_0xc0c1('0x24')](function(_0x10504f){if(_0x10504f){_0x9ef0a7=_0x10504f;_0x5cb8b0[_0xc0c1('0x31')]=_[_0xc0c1('0x2f')](db['Tag'][_0xc0c1('0x45')]);_0x5cb8b0[_0xc0c1('0x2e')]=_[_0xc0c1('0x2f')](_0x4786a1[_0xc0c1('0x2e')]);_0x5cb8b0['filters']=_['intersection'](_0x5cb8b0[_0xc0c1('0x31')],_0x5cb8b0[_0xc0c1('0x2e')]);_0x21294f[_0xc0c1('0x32')]=_[_0xc0c1('0x33')](_0x5cb8b0['model'],qs[_0xc0c1('0x34')](_0x4786a1['query'][_0xc0c1('0x34')]));_0x21294f[_0xc0c1('0x32')]=_0x21294f[_0xc0c1('0x32')][_0xc0c1('0x35')]?_0x21294f[_0xc0c1('0x32')]:_0x5cb8b0[_0xc0c1('0x31')];_0x21294f[_0xc0c1('0x36')]=qs[_0xc0c1('0x37')](_0x4786a1[_0xc0c1('0x2e')][_0xc0c1('0x37')]);_0x21294f[_0xc0c1('0x38')]=qs[_0xc0c1('0x30')](_[_0xc0c1('0x39')](_0x4786a1[_0xc0c1('0x2e')],_0x5cb8b0[_0xc0c1('0x30')]));if(_0x4786a1[_0xc0c1('0x2e')][_0xc0c1('0x3a')]){_0x21294f['where']=_[_0xc0c1('0x3b')](_0x21294f['where'],{'$or':_['map'](_0x21294f['attributes'],function(_0x4a3d4a){var _0x5dec0a={};_0x5dec0a[_0x4a3d4a]={'$like':'%'+_0x4786a1[_0xc0c1('0x2e')][_0xc0c1('0x3a')]+'%'};return _0x5dec0a;})});}_0x21294f=_[_0xc0c1('0x3b')]({},_0x21294f,_0x4786a1[_0xc0c1('0x46')]);return _0x9ef0a7[_0xc0c1('0x51')](_0x21294f);}})['then'](function(_0x1cdf30){if(_0x1cdf30){_0xaba72e=_0x1cdf30['length'];if(!_0x4786a1[_0xc0c1('0x2e')][_0xc0c1('0x4d')](_0xc0c1('0x4e'))){_0x21294f[_0xc0c1('0x1b')]=qs[_0xc0c1('0x1b')](_0x4786a1[_0xc0c1('0x2e')][_0xc0c1('0x1b')]);_0x21294f[_0xc0c1('0x19')]=qs['offset'](_0x4786a1['query']['offset']);}return _0x9ef0a7[_0xc0c1('0x51')](_0x21294f);}})['then'](function(_0x34fb27){if(_0x34fb27){return _0x34fb27?{'count':_0xaba72e,'rows':_0x34fb27}:null;}})['then'](respondWithResult(_0x29edc2,null))[_0xc0c1('0x42')](handleError(_0x29edc2,null));};exports[_0xc0c1('0x52')]=function(_0x4151a4,_0x197f1f,_0x21d83d){if(_0x4151a4[_0xc0c1('0x48')]['id']){delete _0x4151a4['body']['id'];}return db[_0xc0c1('0x3d')][_0xc0c1('0x4b')]({'where':{'id':_0x4151a4['params']['id']}})[_0xc0c1('0x24')](handleEntityNotFound(_0x197f1f,null))[_0xc0c1('0x24')](function(_0x26d39a){if(_0x26d39a){return _0x26d39a[_0xc0c1('0x52')](_0x4151a4[_0xc0c1('0x48')]['ids']||[]);}return null;})['then'](respondWithResult(_0x197f1f,null))[_0xc0c1('0x42')](handleError(_0x197f1f,null));}; \ No newline at end of file +var _0x3cc0=['reject','save','update','then','error','name','send','index','ZendeskConfiguration','rawAttributes','type','key','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','merge','includeAll','include','findAll','catch','show','params','options','find','create','body','destroy','getFields','findOne','ZendeskField','filter','getSubjects','getDescriptions','getTags','Tag','setTags','ids','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','offset','undefined','limit','count','set','Content-Range','json','apply'];(function(_0x53c0e8,_0xce2d6f){var _0x10efee=function(_0x2648e1){while(--_0x2648e1){_0x53c0e8['push'](_0x53c0e8['shift']());}};_0x10efee(++_0xce2d6f);}(_0x3cc0,0x182));var _0x03cc=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3cc0[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x03cc('0x0'));var zipdir=require(_0x03cc('0x1'));var jsonpatch=require(_0x03cc('0x2'));var rp=require(_0x03cc('0x3'));var moment=require(_0x03cc('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x03cc('0x5'));var util=require('util');var path=require(_0x03cc('0x6'));var sox=require('sox');var csv=require(_0x03cc('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x03cc('0x8'));var _=require(_0x03cc('0x9'));var squel=require(_0x03cc('0xa'));var crypto=require(_0x03cc('0xb'));var jsforce=require(_0x03cc('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x03cc('0x7'));var querystring=require(_0x03cc('0xd'));var Papa=require('papaparse');var Redis=require(_0x03cc('0xe'));var authService=require(_0x03cc('0xf'));var qs=require(_0x03cc('0x10'));var as=require(_0x03cc('0x11'));var hardwareService=require(_0x03cc('0x12'));var logger=require('../../config/logger')(_0x03cc('0x13'));var utils=require(_0x03cc('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x03cc('0x15'));var db=require(_0x03cc('0x16'))['db'];function respondWithStatusCode(_0x4d8b40,_0x1950a3){_0x1950a3=_0x1950a3||0xcc;return function(_0x814e0e){if(_0x814e0e){return _0x4d8b40[_0x03cc('0x17')](_0x1950a3);}return _0x4d8b40['status'](_0x1950a3)[_0x03cc('0x18')]();};}function respondWithResult(_0x5613cb,_0x243dc0){_0x243dc0=_0x243dc0||0xc8;return function(_0x502b68){if(_0x502b68){return _0x5613cb[_0x03cc('0x19')](_0x243dc0)['json'](_0x502b68);}};}function respondWithFilteredResult(_0x4eef7b,_0x5bfb23){return function(_0xd2bbdc){if(_0xd2bbdc){var _0x5d6ce9=typeof _0x5bfb23[_0x03cc('0x1a')]===_0x03cc('0x1b')&&typeof _0x5bfb23[_0x03cc('0x1c')]===_0x03cc('0x1b');var _0x5e0752=_0xd2bbdc[_0x03cc('0x1d')];var _0x219217=_0x5d6ce9?0x0:_0x5bfb23[_0x03cc('0x1a')];var _0x2b4a86=_0x5d6ce9?_0xd2bbdc['count']:_0x5bfb23['offset']+_0x5bfb23[_0x03cc('0x1c')];var _0x1db31e;if(_0x2b4a86>=_0x5e0752){_0x2b4a86=_0x5e0752;_0x1db31e=0xc8;}else{_0x1db31e=0xce;}_0x4eef7b[_0x03cc('0x19')](_0x1db31e);return _0x4eef7b[_0x03cc('0x1e')](_0x03cc('0x1f'),_0x219217+'-'+_0x2b4a86+'/'+_0x5e0752)[_0x03cc('0x20')](_0xd2bbdc);}return null;};}function patchUpdates(_0x1680c2){return function(_0x1dd501){try{jsonpatch[_0x03cc('0x21')](_0x1dd501,_0x1680c2,!![]);}catch(_0x4e0a01){return BPromise[_0x03cc('0x22')](_0x4e0a01);}return _0x1dd501[_0x03cc('0x23')]();};}function saveUpdates(_0xbf545e,_0x3445b0){return function(_0x1f2f70){if(_0x1f2f70){return _0x1f2f70[_0x03cc('0x24')](_0xbf545e)[_0x03cc('0x25')](function(_0x1b4c9c){return _0x1b4c9c;});}return null;};}function removeEntity(_0x2de491,_0x30ba89){return function(_0x488260){if(_0x488260){return _0x488260['destroy']()[_0x03cc('0x25')](function(){_0x2de491[_0x03cc('0x19')](0xcc)[_0x03cc('0x18')]();});}};}function handleEntityNotFound(_0x3bdd60,_0x5780dc){return function(_0x2f5105){if(!_0x2f5105){_0x3bdd60['sendStatus'](0x194);}return _0x2f5105;};}function handleError(_0x33dc34,_0x5884ef){_0x5884ef=_0x5884ef||0x1f4;return function(_0x271ae9){logger[_0x03cc('0x26')](_0x271ae9['stack']);if(_0x271ae9[_0x03cc('0x27')]){delete _0x271ae9[_0x03cc('0x27')];}_0x33dc34[_0x03cc('0x19')](_0x5884ef)[_0x03cc('0x28')](_0x271ae9);};}exports[_0x03cc('0x29')]=function(_0x557a17,_0x4307fd){var _0x1408e8={},_0x1c0b00={},_0x5a48b5={'count':0x0,'rows':[]};var _0x1de0e5=_['map'](db[_0x03cc('0x2a')][_0x03cc('0x2b')],function(_0x440544){return{'name':_0x440544['fieldName'],'type':_0x440544[_0x03cc('0x2c')][_0x03cc('0x2d')]};});_0x1c0b00[_0x03cc('0x2e')]=_[_0x03cc('0x2f')](_0x1de0e5,_0x03cc('0x27'));_0x1c0b00[_0x03cc('0x30')]=_[_0x03cc('0x31')](_0x557a17[_0x03cc('0x30')]);_0x1c0b00[_0x03cc('0x32')]=_[_0x03cc('0x33')](_0x1c0b00['model'],_0x1c0b00[_0x03cc('0x30')]);_0x1408e8['attributes']=_[_0x03cc('0x33')](_0x1c0b00[_0x03cc('0x2e')],qs[_0x03cc('0x34')](_0x557a17[_0x03cc('0x30')]['fields']));_0x1408e8[_0x03cc('0x35')]=_0x1408e8[_0x03cc('0x35')][_0x03cc('0x36')]?_0x1408e8['attributes']:_0x1c0b00[_0x03cc('0x2e')];if(!_0x557a17[_0x03cc('0x30')][_0x03cc('0x37')](_0x03cc('0x38'))){_0x1408e8[_0x03cc('0x1c')]=qs[_0x03cc('0x1c')](_0x557a17[_0x03cc('0x30')][_0x03cc('0x1c')]);_0x1408e8[_0x03cc('0x1a')]=qs['offset'](_0x557a17[_0x03cc('0x30')][_0x03cc('0x1a')]);}_0x1408e8[_0x03cc('0x39')]=qs[_0x03cc('0x3a')](_0x557a17['query'][_0x03cc('0x3a')]);_0x1408e8[_0x03cc('0x3b')]=qs[_0x03cc('0x32')](_[_0x03cc('0x3c')](_0x557a17[_0x03cc('0x30')],_0x1c0b00[_0x03cc('0x32')]),_0x1de0e5);if(_0x557a17[_0x03cc('0x30')]['filter']){_0x1408e8[_0x03cc('0x3b')]=_['merge'](_0x1408e8[_0x03cc('0x3b')],{'$or':_[_0x03cc('0x2f')](_0x1de0e5,function(_0x5be486){if(_0x5be486[_0x03cc('0x2c')]!==_0x03cc('0x3d')){var _0x5eaf65={};_0x5eaf65[_0x5be486[_0x03cc('0x27')]]={'$like':'%'+_0x557a17['query']['filter']+'%'};return _0x5eaf65;}})});}_0x1408e8=_[_0x03cc('0x3e')]({},_0x1408e8,_0x557a17['options']);var _0xd36e95={'where':_0x1408e8[_0x03cc('0x3b')]};return db[_0x03cc('0x2a')]['count'](_0xd36e95)['then'](function(_0xae52e){_0x5a48b5[_0x03cc('0x1d')]=_0xae52e;if(_0x557a17[_0x03cc('0x30')][_0x03cc('0x3f')]){_0x1408e8[_0x03cc('0x40')]=[{'all':!![]}];}return db[_0x03cc('0x2a')][_0x03cc('0x41')](_0x1408e8);})[_0x03cc('0x25')](function(_0x5e9e35){_0x5a48b5['rows']=_0x5e9e35;return _0x5a48b5;})[_0x03cc('0x25')](respondWithFilteredResult(_0x4307fd,_0x1408e8))[_0x03cc('0x42')](handleError(_0x4307fd,null));};exports[_0x03cc('0x43')]=function(_0x2e6485,_0x554c4e){var _0x686fae={'raw':![],'where':{'id':_0x2e6485[_0x03cc('0x44')]['id']}},_0x124755={};_0x124755[_0x03cc('0x2e')]=_[_0x03cc('0x31')](db[_0x03cc('0x2a')]['rawAttributes']);_0x124755[_0x03cc('0x30')]=_[_0x03cc('0x31')](_0x2e6485[_0x03cc('0x30')]);_0x124755['filters']=_[_0x03cc('0x33')](_0x124755['model'],_0x124755[_0x03cc('0x30')]);_0x686fae['attributes']=_[_0x03cc('0x33')](_0x124755['model'],qs[_0x03cc('0x34')](_0x2e6485[_0x03cc('0x30')]['fields']));_0x686fae[_0x03cc('0x35')]=_0x686fae[_0x03cc('0x35')][_0x03cc('0x36')]?_0x686fae[_0x03cc('0x35')]:_0x124755['model'];if(_0x2e6485['query']['includeAll']){_0x686fae[_0x03cc('0x40')]=[{'all':!![]}];}_0x686fae=_[_0x03cc('0x3e')]({},_0x686fae,_0x2e6485[_0x03cc('0x45')]);return db[_0x03cc('0x2a')][_0x03cc('0x46')](_0x686fae)[_0x03cc('0x25')](handleEntityNotFound(_0x554c4e,null))[_0x03cc('0x25')](respondWithResult(_0x554c4e,null))[_0x03cc('0x42')](handleError(_0x554c4e,null));};exports['create']=function(_0x1a96e3,_0x40ad5f){return db[_0x03cc('0x2a')][_0x03cc('0x47')](_0x1a96e3['body'],{})['then'](respondWithResult(_0x40ad5f,0xc9))[_0x03cc('0x42')](handleError(_0x40ad5f,null));};exports[_0x03cc('0x24')]=function(_0x3c1c2b,_0x5b443e){if(_0x3c1c2b[_0x03cc('0x48')]['id']){delete _0x3c1c2b[_0x03cc('0x48')]['id'];}return db[_0x03cc('0x2a')][_0x03cc('0x46')]({'where':{'id':_0x3c1c2b[_0x03cc('0x44')]['id']}})[_0x03cc('0x25')](handleEntityNotFound(_0x5b443e,null))[_0x03cc('0x25')](saveUpdates(_0x3c1c2b[_0x03cc('0x48')],null))['then'](respondWithResult(_0x5b443e,null))[_0x03cc('0x42')](handleError(_0x5b443e,null));};exports[_0x03cc('0x49')]=function(_0x4090e3,_0x1e21e3){return db['ZendeskConfiguration'][_0x03cc('0x46')]({'where':{'id':_0x4090e3['params']['id']}})[_0x03cc('0x25')](handleEntityNotFound(_0x1e21e3,null))['then'](removeEntity(_0x1e21e3,null))[_0x03cc('0x42')](handleError(_0x1e21e3,null));};exports[_0x03cc('0x4a')]=function(_0x117a71,_0x485a94,_0x1c6357){var _0x238d09={};var _0x58bb76={};var _0x3a5a4c;var _0x927c99;return db[_0x03cc('0x2a')][_0x03cc('0x4b')]({'where':{'id':_0x117a71['params']['id']}})[_0x03cc('0x25')](handleEntityNotFound(_0x485a94,null))[_0x03cc('0x25')](function(_0x282250){if(_0x282250){_0x3a5a4c=_0x282250;_0x58bb76['model']=_[_0x03cc('0x31')](db[_0x03cc('0x4c')]['rawAttributes']);_0x58bb76[_0x03cc('0x30')]=_['keys'](_0x117a71[_0x03cc('0x30')]);_0x58bb76['filters']=_[_0x03cc('0x33')](_0x58bb76['model'],_0x58bb76[_0x03cc('0x30')]);_0x238d09[_0x03cc('0x35')]=_['intersection'](_0x58bb76[_0x03cc('0x2e')],qs[_0x03cc('0x34')](_0x117a71['query']['fields']));_0x238d09[_0x03cc('0x35')]=_0x238d09[_0x03cc('0x35')][_0x03cc('0x36')]?_0x238d09[_0x03cc('0x35')]:_0x58bb76[_0x03cc('0x2e')];_0x238d09['order']=qs[_0x03cc('0x3a')](_0x117a71['query'][_0x03cc('0x3a')]);_0x238d09[_0x03cc('0x3b')]=qs['filters'](_[_0x03cc('0x3c')](_0x117a71[_0x03cc('0x30')],_0x58bb76[_0x03cc('0x32')]));if(_0x117a71[_0x03cc('0x30')]['filter']){_0x238d09[_0x03cc('0x3b')]=_['merge'](_0x238d09[_0x03cc('0x3b')],{'$or':_[_0x03cc('0x2f')](_0x238d09[_0x03cc('0x35')],function(_0x2a80dd){var _0x295f04={};_0x295f04[_0x2a80dd]={'$like':'%'+_0x117a71[_0x03cc('0x30')][_0x03cc('0x4d')]+'%'};return _0x295f04;})});}_0x238d09=_[_0x03cc('0x3e')]({},_0x238d09,_0x117a71[_0x03cc('0x45')]);return _0x3a5a4c['getFields'](_0x238d09);}})[_0x03cc('0x25')](function(_0x38cb1a){if(_0x38cb1a){_0x927c99=_0x38cb1a['length'];if(!_0x117a71[_0x03cc('0x30')][_0x03cc('0x37')]('nolimit')){_0x238d09[_0x03cc('0x1c')]=qs[_0x03cc('0x1c')](_0x117a71[_0x03cc('0x30')][_0x03cc('0x1c')]);_0x238d09['offset']=qs[_0x03cc('0x1a')](_0x117a71[_0x03cc('0x30')][_0x03cc('0x1a')]);}return _0x3a5a4c[_0x03cc('0x4a')](_0x238d09);}})['then'](function(_0x1e4553){if(_0x1e4553){return _0x1e4553?{'count':_0x927c99,'rows':_0x1e4553}:null;}})[_0x03cc('0x25')](respondWithResult(_0x485a94,null))[_0x03cc('0x42')](handleError(_0x485a94,null));};exports[_0x03cc('0x4e')]=function(_0x11af88,_0x38a7df,_0x18678e){var _0x3a487e={};var _0x2b39cb={};var _0x1873ac;var _0x6d161d;return db[_0x03cc('0x2a')][_0x03cc('0x4b')]({'where':{'id':_0x11af88[_0x03cc('0x44')]['id']}})[_0x03cc('0x25')](handleEntityNotFound(_0x38a7df,null))[_0x03cc('0x25')](function(_0x480663){if(_0x480663){_0x1873ac=_0x480663;_0x2b39cb[_0x03cc('0x2e')]=_[_0x03cc('0x31')](db['ZendeskField'][_0x03cc('0x2b')]);_0x2b39cb[_0x03cc('0x30')]=_[_0x03cc('0x31')](_0x11af88[_0x03cc('0x30')]);_0x2b39cb[_0x03cc('0x32')]=_[_0x03cc('0x33')](_0x2b39cb['model'],_0x2b39cb[_0x03cc('0x30')]);_0x3a487e[_0x03cc('0x35')]=_[_0x03cc('0x33')](_0x2b39cb[_0x03cc('0x2e')],qs[_0x03cc('0x34')](_0x11af88['query'][_0x03cc('0x34')]));_0x3a487e['attributes']=_0x3a487e[_0x03cc('0x35')][_0x03cc('0x36')]?_0x3a487e[_0x03cc('0x35')]:_0x2b39cb[_0x03cc('0x2e')];_0x3a487e[_0x03cc('0x39')]=qs[_0x03cc('0x3a')](_0x11af88[_0x03cc('0x30')][_0x03cc('0x3a')]);_0x3a487e[_0x03cc('0x3b')]=qs[_0x03cc('0x32')](_[_0x03cc('0x3c')](_0x11af88[_0x03cc('0x30')],_0x2b39cb[_0x03cc('0x32')]));if(_0x11af88[_0x03cc('0x30')][_0x03cc('0x4d')]){_0x3a487e[_0x03cc('0x3b')]=_[_0x03cc('0x3e')](_0x3a487e[_0x03cc('0x3b')],{'$or':_[_0x03cc('0x2f')](_0x3a487e[_0x03cc('0x35')],function(_0x1473d4){var _0x1579ec={};_0x1579ec[_0x1473d4]={'$like':'%'+_0x11af88[_0x03cc('0x30')]['filter']+'%'};return _0x1579ec;})});}_0x3a487e=_[_0x03cc('0x3e')]({},_0x3a487e,_0x11af88[_0x03cc('0x45')]);return _0x1873ac[_0x03cc('0x4e')](_0x3a487e);}})[_0x03cc('0x25')](function(_0x1c68c2){if(_0x1c68c2){_0x6d161d=_0x1c68c2[_0x03cc('0x36')];if(!_0x11af88['query'][_0x03cc('0x37')](_0x03cc('0x38'))){_0x3a487e['limit']=qs[_0x03cc('0x1c')](_0x11af88[_0x03cc('0x30')][_0x03cc('0x1c')]);_0x3a487e[_0x03cc('0x1a')]=qs[_0x03cc('0x1a')](_0x11af88['query'][_0x03cc('0x1a')]);}return _0x1873ac['getSubjects'](_0x3a487e);}})[_0x03cc('0x25')](function(_0x36b76e){if(_0x36b76e){return _0x36b76e?{'count':_0x6d161d,'rows':_0x36b76e}:null;}})[_0x03cc('0x25')](respondWithResult(_0x38a7df,null))[_0x03cc('0x42')](handleError(_0x38a7df,null));};exports[_0x03cc('0x4f')]=function(_0x35a5b5,_0x30a063,_0x25f64b){var _0x5d864b={};var _0x321904={};var _0x23a584;var _0x324403;return db[_0x03cc('0x2a')]['findOne']({'where':{'id':_0x35a5b5['params']['id']}})['then'](handleEntityNotFound(_0x30a063,null))['then'](function(_0x49844d){if(_0x49844d){_0x23a584=_0x49844d;_0x321904[_0x03cc('0x2e')]=_[_0x03cc('0x31')](db[_0x03cc('0x4c')][_0x03cc('0x2b')]);_0x321904[_0x03cc('0x30')]=_[_0x03cc('0x31')](_0x35a5b5[_0x03cc('0x30')]);_0x321904[_0x03cc('0x32')]=_['intersection'](_0x321904[_0x03cc('0x2e')],_0x321904['query']);_0x5d864b['attributes']=_['intersection'](_0x321904[_0x03cc('0x2e')],qs[_0x03cc('0x34')](_0x35a5b5[_0x03cc('0x30')][_0x03cc('0x34')]));_0x5d864b[_0x03cc('0x35')]=_0x5d864b[_0x03cc('0x35')]['length']?_0x5d864b[_0x03cc('0x35')]:_0x321904[_0x03cc('0x2e')];_0x5d864b[_0x03cc('0x39')]=qs[_0x03cc('0x3a')](_0x35a5b5[_0x03cc('0x30')][_0x03cc('0x3a')]);_0x5d864b['where']=qs[_0x03cc('0x32')](_[_0x03cc('0x3c')](_0x35a5b5[_0x03cc('0x30')],_0x321904['filters']));if(_0x35a5b5['query'][_0x03cc('0x4d')]){_0x5d864b['where']=_[_0x03cc('0x3e')](_0x5d864b[_0x03cc('0x3b')],{'$or':_[_0x03cc('0x2f')](_0x5d864b[_0x03cc('0x35')],function(_0x5207ba){var _0x4ebf61={};_0x4ebf61[_0x5207ba]={'$like':'%'+_0x35a5b5[_0x03cc('0x30')][_0x03cc('0x4d')]+'%'};return _0x4ebf61;})});}_0x5d864b=_['merge']({},_0x5d864b,_0x35a5b5[_0x03cc('0x45')]);return _0x23a584[_0x03cc('0x4f')](_0x5d864b);}})[_0x03cc('0x25')](function(_0xa2cf0a){if(_0xa2cf0a){_0x324403=_0xa2cf0a[_0x03cc('0x36')];if(!_0x35a5b5[_0x03cc('0x30')]['hasOwnProperty'](_0x03cc('0x38'))){_0x5d864b[_0x03cc('0x1c')]=qs[_0x03cc('0x1c')](_0x35a5b5['query']['limit']);_0x5d864b[_0x03cc('0x1a')]=qs['offset'](_0x35a5b5['query'][_0x03cc('0x1a')]);}return _0x23a584[_0x03cc('0x4f')](_0x5d864b);}})[_0x03cc('0x25')](function(_0x4417e2){if(_0x4417e2){return _0x4417e2?{'count':_0x324403,'rows':_0x4417e2}:null;}})['then'](respondWithResult(_0x30a063,null))[_0x03cc('0x42')](handleError(_0x30a063,null));};exports[_0x03cc('0x50')]=function(_0x1e5754,_0x51cfe0,_0x260d93){var _0x157805={};var _0x5440be={};var _0x2fe54c;var _0x9f9d1c;return db[_0x03cc('0x2a')][_0x03cc('0x4b')]({'where':{'id':_0x1e5754[_0x03cc('0x44')]['id']}})[_0x03cc('0x25')](handleEntityNotFound(_0x51cfe0,null))[_0x03cc('0x25')](function(_0x597553){if(_0x597553){_0x2fe54c=_0x597553;_0x5440be[_0x03cc('0x2e')]=_[_0x03cc('0x31')](db[_0x03cc('0x51')][_0x03cc('0x2b')]);_0x5440be[_0x03cc('0x30')]=_['keys'](_0x1e5754[_0x03cc('0x30')]);_0x5440be[_0x03cc('0x32')]=_['intersection'](_0x5440be[_0x03cc('0x2e')],_0x5440be[_0x03cc('0x30')]);_0x157805[_0x03cc('0x35')]=_['intersection'](_0x5440be[_0x03cc('0x2e')],qs[_0x03cc('0x34')](_0x1e5754[_0x03cc('0x30')]['fields']));_0x157805['attributes']=_0x157805[_0x03cc('0x35')][_0x03cc('0x36')]?_0x157805[_0x03cc('0x35')]:_0x5440be[_0x03cc('0x2e')];_0x157805['order']=qs[_0x03cc('0x3a')](_0x1e5754[_0x03cc('0x30')]['sort']);_0x157805['where']=qs[_0x03cc('0x32')](_[_0x03cc('0x3c')](_0x1e5754[_0x03cc('0x30')],_0x5440be[_0x03cc('0x32')]));if(_0x1e5754[_0x03cc('0x30')][_0x03cc('0x4d')]){_0x157805['where']=_[_0x03cc('0x3e')](_0x157805[_0x03cc('0x3b')],{'$or':_[_0x03cc('0x2f')](_0x157805[_0x03cc('0x35')],function(_0x377fdd){var _0xf4a12e={};_0xf4a12e[_0x377fdd]={'$like':'%'+_0x1e5754[_0x03cc('0x30')][_0x03cc('0x4d')]+'%'};return _0xf4a12e;})});}_0x157805=_['merge']({},_0x157805,_0x1e5754['options']);return _0x2fe54c[_0x03cc('0x50')](_0x157805);}})[_0x03cc('0x25')](function(_0x2b5690){if(_0x2b5690){_0x9f9d1c=_0x2b5690['length'];if(!_0x1e5754['query'][_0x03cc('0x37')](_0x03cc('0x38'))){_0x157805[_0x03cc('0x1c')]=qs[_0x03cc('0x1c')](_0x1e5754[_0x03cc('0x30')][_0x03cc('0x1c')]);_0x157805[_0x03cc('0x1a')]=qs[_0x03cc('0x1a')](_0x1e5754[_0x03cc('0x30')][_0x03cc('0x1a')]);}return _0x2fe54c[_0x03cc('0x50')](_0x157805);}})[_0x03cc('0x25')](function(_0x1cdb13){if(_0x1cdb13){return _0x1cdb13?{'count':_0x9f9d1c,'rows':_0x1cdb13}:null;}})['then'](respondWithResult(_0x51cfe0,null))['catch'](handleError(_0x51cfe0,null));};exports[_0x03cc('0x52')]=function(_0x2180a2,_0x1bfd01,_0x383d99){if(_0x2180a2[_0x03cc('0x48')]['id']){delete _0x2180a2[_0x03cc('0x48')]['id'];}return db[_0x03cc('0x2a')]['findOne']({'where':{'id':_0x2180a2['params']['id']}})[_0x03cc('0x25')](handleEntityNotFound(_0x1bfd01,null))[_0x03cc('0x25')](function(_0x172b51){if(_0x172b51){return _0x172b51['setTags'](_0x2180a2['body'][_0x03cc('0x53')]||[]);}return null;})[_0x03cc('0x25')](respondWithResult(_0x1bfd01,null))[_0x03cc('0x42')](handleError(_0x1bfd01,null));}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js index c43cdfb..cd7f743 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 _0x5ec6=['int_zendesk_configurations','lodash','util','../../config/logger','moment','request-promise','rimraf','./intZendeskConfiguration.attributes','ZendeskConfiguration'];(function(_0x9c2427,_0x17c865){var _0x51984f=function(_0x177af6){while(--_0x177af6){_0x9c2427['push'](_0x9c2427['shift']());}};_0x51984f(++_0x17c865);}(_0x5ec6,0x7f));var _0x65ec=function(_0x3553c2,_0xf04de){_0x3553c2=_0x3553c2-0x0;var _0x2cc4b7=_0x5ec6[_0x3553c2];return _0x2cc4b7;};'use strict';var _=require(_0x65ec('0x0'));var util=require(_0x65ec('0x1'));var logger=require(_0x65ec('0x2'))('api');var moment=require(_0x65ec('0x3'));var BPromise=require('bluebird');var rp=require(_0x65ec('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x65ec('0x5'));var config=require('../../config/environment');var attributes=require(_0x65ec('0x6'));module['exports']=function(_0x2fc973,_0xbb2e56){return _0x2fc973['define'](_0x65ec('0x7'),attributes,{'tableName':_0x65ec('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4cf8=['../../config/environment','./intZendeskConfiguration.attributes','exports','define','int_zendesk_configurations','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x57ac0d,_0x103212){var _0x2a61da=function(_0x3bc30d){while(--_0x3bc30d){_0x57ac0d['push'](_0x57ac0d['shift']());}};_0x2a61da(++_0x103212);}(_0x4cf8,0x1e1));var _0x84cf=function(_0x53ba51,_0x2f2321){_0x53ba51=_0x53ba51-0x0;var _0x2e776e=_0x4cf8[_0x53ba51];return _0x2e776e;};'use strict';var _=require(_0x84cf('0x0'));var util=require(_0x84cf('0x1'));var logger=require(_0x84cf('0x2'))(_0x84cf('0x3'));var moment=require(_0x84cf('0x4'));var BPromise=require(_0x84cf('0x5'));var rp=require(_0x84cf('0x6'));var fs=require('fs');var path=require(_0x84cf('0x7'));var rimraf=require(_0x84cf('0x8'));var config=require(_0x84cf('0x9'));var attributes=require(_0x84cf('0xa'));module[_0x84cf('0xb')]=function(_0x50ade2,_0x4af3f1){return _0x50ade2[_0x84cf('0xc')]('ZendeskConfiguration',attributes,{'tableName':_0x84cf('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.rpc.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.rpc.js index f5138a2..e6d2a1e 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 _0x0ee8=['../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request\x20sent','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','ZendeskConfiguration,\x20%s,\x20%s','message','info','catch','util','moment','randomstring','ioredis'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x0ee8,0xd8));var _0x80ee=function(_0x5d6456,_0x58ecc7){_0x5d6456=_0x5d6456-0x0;var _0x4d66c1=_0x0ee8[_0x5d6456];return _0x4d66c1;};'use strict';var _=require('lodash');var util=require(_0x80ee('0x0'));var moment=require(_0x80ee('0x1'));var BPromise=require('bluebird');var rs=require(_0x80ee('0x2'));var fs=require('fs');var Redis=require(_0x80ee('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x80ee('0x4'));var logger=require(_0x80ee('0x5'))(_0x80ee('0x6'));var config=require('../../config/environment');var jayson=require(_0x80ee('0x7'));var client=jayson[_0x80ee('0x8')][_0x80ee('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x456501,_0x210006,_0x3c572b){return new BPromise(function(_0x3ee7a5,_0x3bb495){return client['request'](_0x456501,_0x3c572b)['then'](function(_0x1b969e){logger['info']('ZendeskConfiguration,\x20%s,\x20%s',_0x210006,_0x80ee('0xa'));logger[_0x80ee('0xb')](_0x80ee('0xc'),_0x210006,'request\x20sent',JSON[_0x80ee('0xd')](_0x1b969e));if(_0x1b969e[_0x80ee('0xe')]){if(_0x1b969e[_0x80ee('0xe')][_0x80ee('0xf')]===0x1f4){logger[_0x80ee('0xe')](_0x80ee('0x10'),_0x210006,_0x1b969e[_0x80ee('0xe')][_0x80ee('0x11')]);return _0x3bb495(_0x1b969e[_0x80ee('0xe')][_0x80ee('0x11')]);}logger[_0x80ee('0xe')]('ZendeskConfiguration,\x20%s,\x20%s',_0x210006,_0x1b969e[_0x80ee('0xe')][_0x80ee('0x11')]);return _0x3ee7a5(_0x1b969e['error'][_0x80ee('0x11')]);}else{logger[_0x80ee('0x12')](_0x80ee('0x10'),_0x210006,_0x80ee('0xa'));_0x3ee7a5(_0x1b969e['result'][_0x80ee('0x11')]);}})[_0x80ee('0x13')](function(_0x1fb9e0){logger[_0x80ee('0xe')](_0x80ee('0x10'),_0x210006,_0x1fb9e0);_0x3bb495(_0x1fb9e0);});});} \ No newline at end of file +var _0x03dc=['catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x19c30f,_0x5c7e41){var _0x458137=function(_0x1a3228){while(--_0x1a3228){_0x19c30f['push'](_0x19c30f['shift']());}};_0x458137(++_0x5c7e41);}(_0x03dc,0x151));var _0xc03d=function(_0x30de4c,_0x4e03a3){_0x30de4c=_0x30de4c-0x0;var _0x2a4423=_0x03dc[_0x30de4c];return _0x2a4423;};'use strict';var _=require(_0xc03d('0x0'));var util=require(_0xc03d('0x1'));var moment=require(_0xc03d('0x2'));var BPromise=require(_0xc03d('0x3'));var rs=require(_0xc03d('0x4'));var fs=require('fs');var Redis=require(_0xc03d('0x5'));var db=require(_0xc03d('0x6'))['db'];var utils=require(_0xc03d('0x7'));var logger=require(_0xc03d('0x8'))(_0xc03d('0x9'));var config=require(_0xc03d('0xa'));var jayson=require(_0xc03d('0xb'));var client=jayson[_0xc03d('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0x49c14c,_0x2af446,_0xafb7b6){return new BPromise(function(_0x3201f7,_0x105f31){return client[_0xc03d('0xd')](_0x49c14c,_0xafb7b6)[_0xc03d('0xe')](function(_0x367ca9){logger[_0xc03d('0xf')](_0xc03d('0x10'),_0x2af446,_0xc03d('0x11'));logger['debug'](_0xc03d('0x12'),_0x2af446,'request\x20sent',JSON[_0xc03d('0x13')](_0x367ca9));if(_0x367ca9[_0xc03d('0x14')]){if(_0x367ca9[_0xc03d('0x14')][_0xc03d('0x15')]===0x1f4){logger[_0xc03d('0x14')](_0xc03d('0x10'),_0x2af446,_0x367ca9[_0xc03d('0x14')][_0xc03d('0x16')]);return _0x105f31(_0x367ca9[_0xc03d('0x14')][_0xc03d('0x16')]);}logger[_0xc03d('0x14')](_0xc03d('0x10'),_0x2af446,_0x367ca9[_0xc03d('0x14')][_0xc03d('0x16')]);return _0x3201f7(_0x367ca9[_0xc03d('0x14')][_0xc03d('0x16')]);}else{logger['info'](_0xc03d('0x10'),_0x2af446,'request\x20sent');_0x3201f7(_0x367ca9['result'][_0xc03d('0x16')]);}})[_0xc03d('0x17')](function(_0x53bdd9){logger[_0xc03d('0x14')](_0xc03d('0x10'),_0x2af446,_0x53bdd9);_0x105f31(_0x53bdd9);});});} \ No newline at end of file diff --git a/server/api/intZendeskField/index.js b/server/api/intZendeskField/index.js index f822869..421a8e2 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 _0x76cd=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskField.controller','isAuthenticated','get','/:id','show','post','create','put','update','multer','util','path'];(function(_0x18d364,_0x5d13a7){var _0x38c6c5=function(_0x4b85ac){while(--_0x4b85ac){_0x18d364['push'](_0x18d364['shift']());}};_0x38c6c5(++_0x5d13a7);}(_0x76cd,0x11a));var _0xd76c=function(_0xc2ed11,_0x19e7c6){_0xc2ed11=_0xc2ed11-0x0;var _0x5a70c2=_0x76cd[_0xc2ed11];return _0x5a70c2;};'use strict';var multer=require(_0xd76c('0x0'));var util=require(_0xd76c('0x1'));var path=require(_0xd76c('0x2'));var timeout=require(_0xd76c('0x3'));var express=require(_0xd76c('0x4'));var router=express[_0xd76c('0x5')]();var fs_extra=require(_0xd76c('0x6'));var auth=require(_0xd76c('0x7'));var interaction=require(_0xd76c('0x8'));var config=require(_0xd76c('0x9'));var controller=require(_0xd76c('0xa'));router['get']('/',auth[_0xd76c('0xb')](),controller['index']);router[_0xd76c('0xc')](_0xd76c('0xd'),auth[_0xd76c('0xb')](),controller[_0xd76c('0xe')]);router[_0xd76c('0xf')]('/',auth[_0xd76c('0xb')](),controller[_0xd76c('0x10')]);router[_0xd76c('0x11')](_0xd76c('0xd'),auth['isAuthenticated'](),controller[_0xd76c('0x12')]);router['delete']('/:id',auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xa8b3=['exports','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskField.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete'];(function(_0x2e44a7,_0x4a7483){var _0x4063a9=function(_0x556846){while(--_0x556846){_0x2e44a7['push'](_0x2e44a7['shift']());}};_0x4063a9(++_0x4a7483);}(_0xa8b3,0x1a3));var _0x3a8b=function(_0x4248e9,_0x19f4bc){_0x4248e9=_0x4248e9-0x0;var _0x4a26af=_0xa8b3[_0x4248e9];return _0x4a26af;};'use strict';var multer=require('multer');var util=require(_0x3a8b('0x0'));var path=require('path');var timeout=require(_0x3a8b('0x1'));var express=require(_0x3a8b('0x2'));var router=express['Router']();var fs_extra=require(_0x3a8b('0x3'));var auth=require(_0x3a8b('0x4'));var interaction=require(_0x3a8b('0x5'));var config=require(_0x3a8b('0x6'));var controller=require(_0x3a8b('0x7'));router[_0x3a8b('0x8')]('/',auth[_0x3a8b('0x9')](),controller[_0x3a8b('0xa')]);router[_0x3a8b('0x8')](_0x3a8b('0xb'),auth[_0x3a8b('0x9')](),controller[_0x3a8b('0xc')]);router[_0x3a8b('0xd')]('/',auth[_0x3a8b('0x9')](),controller[_0x3a8b('0xe')]);router[_0x3a8b('0xf')]('/:id',auth['isAuthenticated'](),controller[_0x3a8b('0x10')]);router[_0x3a8b('0x11')](_0x3a8b('0xb'),auth[_0x3a8b('0x9')](),controller['destroy']);module[_0x3a8b('0x12')]=router; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.attributes.js b/server/api/intZendeskField/intZendeskField.attributes.js index 4646e1c..cd55a28 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 _0xf187=['exports','string','variable','customVariable','keyValue','picklist','STRING','BOOLEAN','sequelize'];(function(_0x365e7a,_0x620a6e){var _0x317440=function(_0x111270){while(--_0x111270){_0x365e7a['push'](_0x365e7a['shift']());}};_0x317440(++_0x620a6e);}(_0xf187,0x1af));var _0x7f18=function(_0x50651e,_0x1cd57f){_0x50651e=_0x50651e-0x0;var _0x441371=_0xf187[_0x50651e];return _0x441371;};'use strict';var Sequelize=require(_0x7f18('0x0'));module[_0x7f18('0x1')]={'type':{'type':Sequelize['ENUM'](_0x7f18('0x2'),_0x7f18('0x3'),_0x7f18('0x4'),_0x7f18('0x5'),_0x7f18('0x6')),'defaultValue':_0x7f18('0x2')},'content':{'type':Sequelize[_0x7f18('0x7')]},'key':{'type':Sequelize[_0x7f18('0x7')]},'keyType':{'type':Sequelize['ENUM'](_0x7f18('0x2'),'variable',_0x7f18('0x4'))},'keyContent':{'type':Sequelize[_0x7f18('0x7')]},'idField':{'type':Sequelize[_0x7f18('0x7')]},'nameField':{'type':Sequelize[_0x7f18('0x7')]},'customField':{'type':Sequelize[_0x7f18('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x7f18('0x7')]}}; \ No newline at end of file +var _0x2acc=['exports','ENUM','variable','keyValue','STRING','BOOLEAN','sequelize'];(function(_0x19f466,_0x91a82b){var _0x88eef5=function(_0x2163ba){while(--_0x2163ba){_0x19f466['push'](_0x19f466['shift']());}};_0x88eef5(++_0x91a82b);}(_0x2acc,0x133));var _0xc2ac=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x2acc[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0xc2ac('0x0'));module[_0xc2ac('0x1')]={'type':{'type':Sequelize[_0xc2ac('0x2')]('string',_0xc2ac('0x3'),'customVariable',_0xc2ac('0x4'),'picklist'),'defaultValue':'string'},'content':{'type':Sequelize[_0xc2ac('0x5')]},'key':{'type':Sequelize[_0xc2ac('0x5')]},'keyType':{'type':Sequelize[_0xc2ac('0x2')]('string',_0xc2ac('0x3'),'customVariable')},'keyContent':{'type':Sequelize[_0xc2ac('0x5')]},'idField':{'type':Sequelize[_0xc2ac('0x5')]},'nameField':{'type':Sequelize[_0xc2ac('0x5')]},'customField':{'type':Sequelize[_0xc2ac('0x6')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xc2ac('0x5')]}}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.controller.js b/server/api/intZendeskField/intZendeskField.controller.js index 989a639..5945555 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 _0x7dc2=['include','findAll','rows','show','params','length','catch','create','body','find','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','ejs','fs-extra','lodash','squel','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','limit','undefined','offset','count','set','Content-Range','reject','save','update','destroy','then','sendStatus','name','send','ZendeskField','rawAttributes','fieldName','key','model','keys','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','merge','map','VIRTUAL','filter','options','includeAll'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x7dc2,0xeb));var _0x27dc=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x7dc2[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require(_0x27dc('0x0'));var rimraf=require(_0x27dc('0x1'));var zipdir=require(_0x27dc('0x2'));var jsonpatch=require(_0x27dc('0x3'));var rp=require('request-promise');var moment=require(_0x27dc('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x27dc('0x5'));var util=require(_0x27dc('0x6'));var path=require(_0x27dc('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x27dc('0x8'));var fs=require('fs');var fs_extra=require(_0x27dc('0x9'));var _=require(_0x27dc('0xa'));var squel=require(_0x27dc('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x27dc('0xc'));var toCsv=require(_0x27dc('0xd'));var querystring=require(_0x27dc('0xe'));var Papa=require(_0x27dc('0xf'));var Redis=require(_0x27dc('0x10'));var authService=require(_0x27dc('0x11'));var qs=require(_0x27dc('0x12'));var as=require(_0x27dc('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x27dc('0x14'));var utils=require(_0x27dc('0x15'));var config=require(_0x27dc('0x16'));var licenseUtil=require(_0x27dc('0x17'));var db=require(_0x27dc('0x18'))['db'];function respondWithStatusCode(_0x1009c8,_0x55dd87){_0x55dd87=_0x55dd87||0xcc;return function(_0x2f9675){if(_0x2f9675){return _0x1009c8['sendStatus'](_0x55dd87);}return _0x1009c8['status'](_0x55dd87)[_0x27dc('0x19')]();};}function respondWithResult(_0x3feeb4,_0x55cbf1){_0x55cbf1=_0x55cbf1||0xc8;return function(_0x132488){if(_0x132488){return _0x3feeb4[_0x27dc('0x1a')](_0x55cbf1)[_0x27dc('0x1b')](_0x132488);}};}function respondWithFilteredResult(_0x1caaac,_0x1aa970){return function(_0x5baf9d){if(_0x5baf9d){var _0xa2cebf=typeof _0x1aa970['offset']==='undefined'&&typeof _0x1aa970[_0x27dc('0x1c')]===_0x27dc('0x1d');var _0x187475=_0x5baf9d['count'];var _0x26b05c=_0xa2cebf?0x0:_0x1aa970[_0x27dc('0x1e')];var _0x4e897e=_0xa2cebf?_0x5baf9d[_0x27dc('0x1f')]:_0x1aa970[_0x27dc('0x1e')]+_0x1aa970[_0x27dc('0x1c')];var _0x37ded0;if(_0x4e897e>=_0x187475){_0x4e897e=_0x187475;_0x37ded0=0xc8;}else{_0x37ded0=0xce;}_0x1caaac[_0x27dc('0x1a')](_0x37ded0);return _0x1caaac[_0x27dc('0x20')](_0x27dc('0x21'),_0x26b05c+'-'+_0x4e897e+'/'+_0x187475)[_0x27dc('0x1b')](_0x5baf9d);}return null;};}function patchUpdates(_0x55d772){return function(_0x175822){try{jsonpatch['apply'](_0x175822,_0x55d772,!![]);}catch(_0x1b5a68){return BPromise[_0x27dc('0x22')](_0x1b5a68);}return _0x175822[_0x27dc('0x23')]();};}function saveUpdates(_0x739b,_0x55e205){return function(_0x347d55){if(_0x347d55){return _0x347d55[_0x27dc('0x24')](_0x739b)['then'](function(_0x2eecd0){return _0x2eecd0;});}return null;};}function removeEntity(_0x15b9d4,_0x2d468b){return function(_0x4913e7){if(_0x4913e7){return _0x4913e7[_0x27dc('0x25')]()[_0x27dc('0x26')](function(){_0x15b9d4[_0x27dc('0x1a')](0xcc)[_0x27dc('0x19')]();});}};}function handleEntityNotFound(_0x5b5dad,_0x3c5208){return function(_0x449f31){if(!_0x449f31){_0x5b5dad[_0x27dc('0x27')](0x194);}return _0x449f31;};}function handleError(_0x27411f,_0x2f547c){_0x2f547c=_0x2f547c||0x1f4;return function(_0x225901){logger['error'](_0x225901['stack']);if(_0x225901['name']){delete _0x225901[_0x27dc('0x28')];}_0x27411f[_0x27dc('0x1a')](_0x2f547c)[_0x27dc('0x29')](_0x225901);};}exports['index']=function(_0x2db4da,_0x3dc919){var _0x1d378d={},_0x18051c={},_0x3bdbb0={'count':0x0,'rows':[]};var _0x5ecab1=_['map'](db[_0x27dc('0x2a')][_0x27dc('0x2b')],function(_0x2b9f5a){return{'name':_0x2b9f5a[_0x27dc('0x2c')],'type':_0x2b9f5a['type'][_0x27dc('0x2d')]};});_0x18051c[_0x27dc('0x2e')]=_['map'](_0x5ecab1,'name');_0x18051c['query']=_[_0x27dc('0x2f')](_0x2db4da[_0x27dc('0x30')]);_0x18051c[_0x27dc('0x31')]=_[_0x27dc('0x32')](_0x18051c[_0x27dc('0x2e')],_0x18051c[_0x27dc('0x30')]);_0x1d378d['attributes']=_[_0x27dc('0x32')](_0x18051c[_0x27dc('0x2e')],qs[_0x27dc('0x33')](_0x2db4da[_0x27dc('0x30')][_0x27dc('0x33')]));_0x1d378d[_0x27dc('0x34')]=_0x1d378d[_0x27dc('0x34')]['length']?_0x1d378d[_0x27dc('0x34')]:_0x18051c[_0x27dc('0x2e')];if(!_0x2db4da['query'][_0x27dc('0x35')](_0x27dc('0x36'))){_0x1d378d[_0x27dc('0x1c')]=qs[_0x27dc('0x1c')](_0x2db4da[_0x27dc('0x30')][_0x27dc('0x1c')]);_0x1d378d[_0x27dc('0x1e')]=qs[_0x27dc('0x1e')](_0x2db4da[_0x27dc('0x30')][_0x27dc('0x1e')]);}_0x1d378d[_0x27dc('0x37')]=qs['sort'](_0x2db4da[_0x27dc('0x30')][_0x27dc('0x38')]);_0x1d378d[_0x27dc('0x39')]=qs[_0x27dc('0x31')](_[_0x27dc('0x3a')](_0x2db4da['query'],_0x18051c[_0x27dc('0x31')]),_0x5ecab1);if(_0x2db4da[_0x27dc('0x30')]['filter']){_0x1d378d['where']=_[_0x27dc('0x3b')](_0x1d378d[_0x27dc('0x39')],{'$or':_[_0x27dc('0x3c')](_0x5ecab1,function(_0x2c65e6){if(_0x2c65e6['type']!==_0x27dc('0x3d')){var _0x1dc4e2={};_0x1dc4e2[_0x2c65e6[_0x27dc('0x28')]]={'$like':'%'+_0x2db4da[_0x27dc('0x30')][_0x27dc('0x3e')]+'%'};return _0x1dc4e2;}})});}_0x1d378d=_[_0x27dc('0x3b')]({},_0x1d378d,_0x2db4da[_0x27dc('0x3f')]);var _0xe0b4e4={'where':_0x1d378d[_0x27dc('0x39')]};return db[_0x27dc('0x2a')][_0x27dc('0x1f')](_0xe0b4e4)[_0x27dc('0x26')](function(_0x3ecf1d){_0x3bdbb0['count']=_0x3ecf1d;if(_0x2db4da[_0x27dc('0x30')][_0x27dc('0x40')]){_0x1d378d[_0x27dc('0x41')]=[{'all':!![]}];}return db['ZendeskField'][_0x27dc('0x42')](_0x1d378d);})[_0x27dc('0x26')](function(_0x381263){_0x3bdbb0[_0x27dc('0x43')]=_0x381263;return _0x3bdbb0;})[_0x27dc('0x26')](respondWithFilteredResult(_0x3dc919,_0x1d378d))['catch'](handleError(_0x3dc919,null));};exports[_0x27dc('0x44')]=function(_0x4835f8,_0x5e3ecf){var _0x818bc2={'raw':!![],'where':{'id':_0x4835f8[_0x27dc('0x45')]['id']}},_0x226d8d={};_0x226d8d[_0x27dc('0x2e')]=_[_0x27dc('0x2f')](db[_0x27dc('0x2a')]['rawAttributes']);_0x226d8d[_0x27dc('0x30')]=_[_0x27dc('0x2f')](_0x4835f8[_0x27dc('0x30')]);_0x226d8d[_0x27dc('0x31')]=_['intersection'](_0x226d8d['model'],_0x226d8d[_0x27dc('0x30')]);_0x818bc2[_0x27dc('0x34')]=_['intersection'](_0x226d8d[_0x27dc('0x2e')],qs[_0x27dc('0x33')](_0x4835f8[_0x27dc('0x30')][_0x27dc('0x33')]));_0x818bc2[_0x27dc('0x34')]=_0x818bc2[_0x27dc('0x34')][_0x27dc('0x46')]?_0x818bc2[_0x27dc('0x34')]:_0x226d8d[_0x27dc('0x2e')];if(_0x4835f8[_0x27dc('0x30')][_0x27dc('0x40')]){_0x818bc2['include']=[{'all':!![]}];}_0x818bc2=_['merge']({},_0x818bc2,_0x4835f8[_0x27dc('0x3f')]);return db[_0x27dc('0x2a')]['find'](_0x818bc2)[_0x27dc('0x26')](handleEntityNotFound(_0x5e3ecf,null))['then'](respondWithResult(_0x5e3ecf,null))[_0x27dc('0x47')](handleError(_0x5e3ecf,null));};exports[_0x27dc('0x48')]=function(_0x5a2d5b,_0xfbaba5){return db[_0x27dc('0x2a')][_0x27dc('0x48')](_0x5a2d5b['body'],{})[_0x27dc('0x26')](respondWithResult(_0xfbaba5,0xc9))[_0x27dc('0x47')](handleError(_0xfbaba5,null));};exports['update']=function(_0x4dd57f,_0x2f18d7){if(_0x4dd57f[_0x27dc('0x49')]['id']){delete _0x4dd57f[_0x27dc('0x49')]['id'];}return db[_0x27dc('0x2a')][_0x27dc('0x4a')]({'where':{'id':_0x4dd57f[_0x27dc('0x45')]['id']}})[_0x27dc('0x26')](handleEntityNotFound(_0x2f18d7,null))['then'](saveUpdates(_0x4dd57f[_0x27dc('0x49')],null))[_0x27dc('0x26')](respondWithResult(_0x2f18d7,null))[_0x27dc('0x47')](handleError(_0x2f18d7,null));};exports['destroy']=function(_0x569a3f,_0x54c72e){return db['ZendeskField'][_0x27dc('0x4a')]({'where':{'id':_0x569a3f['params']['id']}})[_0x27dc('0x26')](handleEntityNotFound(_0x54c72e,null))[_0x27dc('0x26')](removeEntity(_0x54c72e,null))[_0x27dc('0x47')](handleError(_0x54c72e,null));}; \ No newline at end of file +var _0xb99d=['papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','then','error','name','index','map','ZendeskField','rawAttributes','fieldName','type','query','keys','filters','intersection','attributes','fields','length','model','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','includeAll','include','findAll','rows','catch','show','params','options','find','create','body','update','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','crypto','jsforce','querystring'];(function(_0x382b80,_0x4f503a){var _0x1296b=function(_0x448644){while(--_0x448644){_0x382b80['push'](_0x382b80['shift']());}};_0x1296b(++_0x4f503a);}(_0xb99d,0x87));var _0xdb99=function(_0xdd57f0,_0x2e23e1){_0xdd57f0=_0xdd57f0-0x0;var _0x4f4755=_0xb99d[_0xdd57f0];return _0x4f4755;};'use strict';var emlformat=require(_0xdb99('0x0'));var rimraf=require(_0xdb99('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xdb99('0x2'));var rp=require(_0xdb99('0x3'));var moment=require(_0xdb99('0x4'));var BPromise=require(_0xdb99('0x5'));var Mustache=require(_0xdb99('0x6'));var util=require(_0xdb99('0x7'));var path=require(_0xdb99('0x8'));var sox=require(_0xdb99('0x9'));var csv=require(_0xdb99('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xdb99('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xdb99('0xc'));var jsforce=require(_0xdb99('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xdb99('0xa'));var querystring=require(_0xdb99('0xe'));var Papa=require(_0xdb99('0xf'));var Redis=require(_0xdb99('0x10'));var authService=require(_0xdb99('0x11'));var qs=require(_0xdb99('0x12'));var as=require(_0xdb99('0x13'));var hardwareService=require(_0xdb99('0x14'));var logger=require(_0xdb99('0x15'))(_0xdb99('0x16'));var utils=require(_0xdb99('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xdb99('0x18'));var db=require(_0xdb99('0x19'))['db'];function respondWithStatusCode(_0x991bb9,_0x52fd81){_0x52fd81=_0x52fd81||0xcc;return function(_0x1c0932){if(_0x1c0932){return _0x991bb9[_0xdb99('0x1a')](_0x52fd81);}return _0x991bb9[_0xdb99('0x1b')](_0x52fd81)[_0xdb99('0x1c')]();};}function respondWithResult(_0x24352a,_0x3b3755){_0x3b3755=_0x3b3755||0xc8;return function(_0x4ae8d4){if(_0x4ae8d4){return _0x24352a['status'](_0x3b3755)[_0xdb99('0x1d')](_0x4ae8d4);}};}function respondWithFilteredResult(_0x2cdb06,_0x1db39c){return function(_0x5a061d){if(_0x5a061d){var _0x457575=typeof _0x1db39c[_0xdb99('0x1e')]===_0xdb99('0x1f')&&typeof _0x1db39c[_0xdb99('0x20')]===_0xdb99('0x1f');var _0x27442e=_0x5a061d[_0xdb99('0x21')];var _0xe8f984=_0x457575?0x0:_0x1db39c[_0xdb99('0x1e')];var _0x2722e5=_0x457575?_0x5a061d[_0xdb99('0x21')]:_0x1db39c[_0xdb99('0x1e')]+_0x1db39c[_0xdb99('0x20')];var _0x25d9a2;if(_0x2722e5>=_0x27442e){_0x2722e5=_0x27442e;_0x25d9a2=0xc8;}else{_0x25d9a2=0xce;}_0x2cdb06[_0xdb99('0x1b')](_0x25d9a2);return _0x2cdb06[_0xdb99('0x22')]('Content-Range',_0xe8f984+'-'+_0x2722e5+'/'+_0x27442e)['json'](_0x5a061d);}return null;};}function patchUpdates(_0x4383ac){return function(_0x5a554b){try{jsonpatch[_0xdb99('0x23')](_0x5a554b,_0x4383ac,!![]);}catch(_0x58804b){return BPromise[_0xdb99('0x24')](_0x58804b);}return _0x5a554b[_0xdb99('0x25')]();};}function saveUpdates(_0x5b9282,_0x517867){return function(_0x333654){if(_0x333654){return _0x333654['update'](_0x5b9282)[_0xdb99('0x26')](function(_0x1aad09){return _0x1aad09;});}return null;};}function removeEntity(_0x5e86f0,_0x51d828){return function(_0xa4020){if(_0xa4020){return _0xa4020['destroy']()[_0xdb99('0x26')](function(){_0x5e86f0[_0xdb99('0x1b')](0xcc)[_0xdb99('0x1c')]();});}};}function handleEntityNotFound(_0x4df099,_0x28d189){return function(_0x2bfa74){if(!_0x2bfa74){_0x4df099[_0xdb99('0x1a')](0x194);}return _0x2bfa74;};}function handleError(_0x23b40b,_0x287b95){_0x287b95=_0x287b95||0x1f4;return function(_0x17810b){logger[_0xdb99('0x27')](_0x17810b['stack']);if(_0x17810b[_0xdb99('0x28')]){delete _0x17810b[_0xdb99('0x28')];}_0x23b40b[_0xdb99('0x1b')](_0x287b95)['send'](_0x17810b);};}exports[_0xdb99('0x29')]=function(_0x56da68,_0x21ab3a){var _0x51e1cd={},_0xbfaf18={},_0x53c727={'count':0x0,'rows':[]};var _0x21bc17=_[_0xdb99('0x2a')](db[_0xdb99('0x2b')][_0xdb99('0x2c')],function(_0x644f72){return{'name':_0x644f72[_0xdb99('0x2d')],'type':_0x644f72[_0xdb99('0x2e')]['key']};});_0xbfaf18['model']=_[_0xdb99('0x2a')](_0x21bc17,_0xdb99('0x28'));_0xbfaf18[_0xdb99('0x2f')]=_[_0xdb99('0x30')](_0x56da68[_0xdb99('0x2f')]);_0xbfaf18[_0xdb99('0x31')]=_[_0xdb99('0x32')](_0xbfaf18['model'],_0xbfaf18[_0xdb99('0x2f')]);_0x51e1cd[_0xdb99('0x33')]=_[_0xdb99('0x32')](_0xbfaf18['model'],qs[_0xdb99('0x34')](_0x56da68[_0xdb99('0x2f')]['fields']));_0x51e1cd['attributes']=_0x51e1cd[_0xdb99('0x33')][_0xdb99('0x35')]?_0x51e1cd[_0xdb99('0x33')]:_0xbfaf18[_0xdb99('0x36')];if(!_0x56da68[_0xdb99('0x2f')]['hasOwnProperty'](_0xdb99('0x37'))){_0x51e1cd[_0xdb99('0x20')]=qs[_0xdb99('0x20')](_0x56da68[_0xdb99('0x2f')][_0xdb99('0x20')]);_0x51e1cd[_0xdb99('0x1e')]=qs[_0xdb99('0x1e')](_0x56da68['query'][_0xdb99('0x1e')]);}_0x51e1cd[_0xdb99('0x38')]=qs['sort'](_0x56da68[_0xdb99('0x2f')][_0xdb99('0x39')]);_0x51e1cd[_0xdb99('0x3a')]=qs[_0xdb99('0x31')](_[_0xdb99('0x3b')](_0x56da68['query'],_0xbfaf18[_0xdb99('0x31')]),_0x21bc17);if(_0x56da68['query']['filter']){_0x51e1cd[_0xdb99('0x3a')]=_[_0xdb99('0x3c')](_0x51e1cd[_0xdb99('0x3a')],{'$or':_[_0xdb99('0x2a')](_0x21bc17,function(_0x2b82bb){if(_0x2b82bb['type']!==_0xdb99('0x3d')){var _0x463091={};_0x463091[_0x2b82bb[_0xdb99('0x28')]]={'$like':'%'+_0x56da68[_0xdb99('0x2f')][_0xdb99('0x3e')]+'%'};return _0x463091;}})});}_0x51e1cd=_['merge']({},_0x51e1cd,_0x56da68['options']);var _0x1c4de1={'where':_0x51e1cd['where']};return db[_0xdb99('0x2b')][_0xdb99('0x21')](_0x1c4de1)[_0xdb99('0x26')](function(_0x536201){_0x53c727[_0xdb99('0x21')]=_0x536201;if(_0x56da68[_0xdb99('0x2f')][_0xdb99('0x3f')]){_0x51e1cd[_0xdb99('0x40')]=[{'all':!![]}];}return db[_0xdb99('0x2b')][_0xdb99('0x41')](_0x51e1cd);})[_0xdb99('0x26')](function(_0x1b0713){_0x53c727[_0xdb99('0x42')]=_0x1b0713;return _0x53c727;})[_0xdb99('0x26')](respondWithFilteredResult(_0x21ab3a,_0x51e1cd))[_0xdb99('0x43')](handleError(_0x21ab3a,null));};exports[_0xdb99('0x44')]=function(_0x551fd6,_0x548638){var _0x478f1f={'raw':!![],'where':{'id':_0x551fd6[_0xdb99('0x45')]['id']}},_0x307a56={};_0x307a56[_0xdb99('0x36')]=_['keys'](db[_0xdb99('0x2b')][_0xdb99('0x2c')]);_0x307a56['query']=_[_0xdb99('0x30')](_0x551fd6[_0xdb99('0x2f')]);_0x307a56[_0xdb99('0x31')]=_['intersection'](_0x307a56[_0xdb99('0x36')],_0x307a56[_0xdb99('0x2f')]);_0x478f1f[_0xdb99('0x33')]=_[_0xdb99('0x32')](_0x307a56[_0xdb99('0x36')],qs[_0xdb99('0x34')](_0x551fd6[_0xdb99('0x2f')][_0xdb99('0x34')]));_0x478f1f['attributes']=_0x478f1f[_0xdb99('0x33')][_0xdb99('0x35')]?_0x478f1f[_0xdb99('0x33')]:_0x307a56['model'];if(_0x551fd6[_0xdb99('0x2f')][_0xdb99('0x3f')]){_0x478f1f[_0xdb99('0x40')]=[{'all':!![]}];}_0x478f1f=_['merge']({},_0x478f1f,_0x551fd6[_0xdb99('0x46')]);return db['ZendeskField'][_0xdb99('0x47')](_0x478f1f)[_0xdb99('0x26')](handleEntityNotFound(_0x548638,null))[_0xdb99('0x26')](respondWithResult(_0x548638,null))['catch'](handleError(_0x548638,null));};exports['create']=function(_0x356987,_0x1ed62a){return db[_0xdb99('0x2b')][_0xdb99('0x48')](_0x356987[_0xdb99('0x49')],{})[_0xdb99('0x26')](respondWithResult(_0x1ed62a,0xc9))[_0xdb99('0x43')](handleError(_0x1ed62a,null));};exports[_0xdb99('0x4a')]=function(_0xb29917,_0x2f8baf){if(_0xb29917['body']['id']){delete _0xb29917[_0xdb99('0x49')]['id'];}return db['ZendeskField'][_0xdb99('0x47')]({'where':{'id':_0xb29917[_0xdb99('0x45')]['id']}})[_0xdb99('0x26')](handleEntityNotFound(_0x2f8baf,null))['then'](saveUpdates(_0xb29917['body'],null))['then'](respondWithResult(_0x2f8baf,null))[_0xdb99('0x43')](handleError(_0x2f8baf,null));};exports['destroy']=function(_0x4aa270,_0x53b2ab){return db[_0xdb99('0x2b')][_0xdb99('0x47')]({'where':{'id':_0x4aa270['params']['id']}})[_0xdb99('0x26')](handleEntityNotFound(_0x53b2ab,null))[_0xdb99('0x26')](removeEntity(_0x53b2ab,null))[_0xdb99('0x43')](handleError(_0x53b2ab,null));}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.model.js b/server/api/intZendeskField/intZendeskField.model.js index 07bf419..a64797a 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 _0xb0f3=['rimraf','../../config/environment','./intZendeskField.attributes','exports','ZendeskField','int_zendesk_fields','zendesk_unique_index','FieldId','lodash','util','api','moment','bluebird','request-promise','path'];(function(_0x26f482,_0x2f0852){var _0x1c94c7=function(_0x5897ec){while(--_0x5897ec){_0x26f482['push'](_0x26f482['shift']());}};_0x1c94c7(++_0x2f0852);}(_0xb0f3,0x152));var _0x3b0f=function(_0x127b15,_0x11a2a9){_0x127b15=_0x127b15-0x0;var _0x3fe772=_0xb0f3[_0x127b15];return _0x3fe772;};'use strict';var _=require(_0x3b0f('0x0'));var util=require(_0x3b0f('0x1'));var logger=require('../../config/logger')(_0x3b0f('0x2'));var moment=require(_0x3b0f('0x3'));var BPromise=require(_0x3b0f('0x4'));var rp=require(_0x3b0f('0x5'));var fs=require('fs');var path=require(_0x3b0f('0x6'));var rimraf=require(_0x3b0f('0x7'));var config=require(_0x3b0f('0x8'));var attributes=require(_0x3b0f('0x9'));module[_0x3b0f('0xa')]=function(_0xfb9f41,_0x55c5cd){return _0xfb9f41['define'](_0x3b0f('0xb'),attributes,{'tableName':_0x3b0f('0xc'),'paranoid':![],'indexes':[{'name':_0x3b0f('0xd'),'fields':['idField',_0x3b0f('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x5815=['exports','define','ZendeskField','int_zendesk_fields','zendesk_unique_index','FieldId','lodash','util','../../config/logger','api','request-promise','../../config/environment','./intZendeskField.attributes'];(function(_0x146b09,_0x345cd3){var _0x4e9e36=function(_0x1d9749){while(--_0x1d9749){_0x146b09['push'](_0x146b09['shift']());}};_0x4e9e36(++_0x345cd3);}(_0x5815,0x117));var _0x5581=function(_0x18c30b,_0x47dfcb){_0x18c30b=_0x18c30b-0x0;var _0x43de4f=_0x5815[_0x18c30b];return _0x43de4f;};'use strict';var _=require(_0x5581('0x0'));var util=require(_0x5581('0x1'));var logger=require(_0x5581('0x2'))(_0x5581('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x5581('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x5581('0x5'));var attributes=require(_0x5581('0x6'));module[_0x5581('0x7')]=function(_0x55654e,_0x2ed383){return _0x55654e[_0x5581('0x8')](_0x5581('0x9'),attributes,{'tableName':_0x5581('0xa'),'paranoid':![],'indexes':[{'name':_0x5581('0xb'),'fields':['idField',_0x5581('0xc')],'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 34e7c5e..ab32539 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 _0x66a7=['request\x20sent','ZendeskField,\x20%s,\x20%s,\x20%s','stringify','error','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','then','info','ZendeskField,\x20%s,\x20%s'];(function(_0x425483,_0x3a4ada){var _0x3a716f=function(_0x518bd9){while(--_0x518bd9){_0x425483['push'](_0x425483['shift']());}};_0x3a716f(++_0x3a4ada);}(_0x66a7,0xf8));var _0x766a=function(_0x148aa9,_0x421ae3){_0x148aa9=_0x148aa9-0x0;var _0x530a22=_0x66a7[_0x148aa9];return _0x530a22;};'use strict';var _=require(_0x766a('0x0'));var util=require(_0x766a('0x1'));var moment=require(_0x766a('0x2'));var BPromise=require(_0x766a('0x3'));var rs=require(_0x766a('0x4'));var fs=require('fs');var Redis=require(_0x766a('0x5'));var db=require(_0x766a('0x6'))['db'];var utils=require(_0x766a('0x7'));var logger=require('../../config/logger')(_0x766a('0x8'));var config=require('../../config/environment');var jayson=require(_0x766a('0x9'));var client=jayson[_0x766a('0xa')][_0x766a('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4aa3ec,_0x5de3f0,_0x52fc94){return new BPromise(function(_0x3ebb1b,_0x5a19fc){return client[_0x766a('0xc')](_0x4aa3ec,_0x52fc94)[_0x766a('0xd')](function(_0x155562){logger[_0x766a('0xe')](_0x766a('0xf'),_0x5de3f0,_0x766a('0x10'));logger['debug'](_0x766a('0x11'),_0x5de3f0,'request\x20sent',JSON[_0x766a('0x12')](_0x155562));if(_0x155562['error']){if(_0x155562[_0x766a('0x13')]['code']===0x1f4){logger[_0x766a('0x13')]('ZendeskField,\x20%s,\x20%s',_0x5de3f0,_0x155562[_0x766a('0x13')][_0x766a('0x14')]);return _0x5a19fc(_0x155562[_0x766a('0x13')]['message']);}logger[_0x766a('0x13')](_0x766a('0xf'),_0x5de3f0,_0x155562[_0x766a('0x13')][_0x766a('0x14')]);return _0x3ebb1b(_0x155562[_0x766a('0x13')][_0x766a('0x14')]);}else{logger[_0x766a('0xe')](_0x766a('0xf'),_0x5de3f0,_0x766a('0x10'));_0x3ebb1b(_0x155562[_0x766a('0x15')][_0x766a('0x14')]);}})['catch'](function(_0x54ccd9){logger[_0x766a('0x13')](_0x766a('0xf'),_0x5de3f0,_0x54ccd9);_0x5a19fc(_0x54ccd9);});});} \ No newline at end of file +var _0x7bee=['bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ZendeskField,\x20%s,\x20%s','request\x20sent','ZendeskField,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','moment'];(function(_0x586cb6,_0x2ac45e){var _0xddd6b0=function(_0x1882e1){while(--_0x1882e1){_0x586cb6['push'](_0x586cb6['shift']());}};_0xddd6b0(++_0x2ac45e);}(_0x7bee,0x107));var _0xe7be=function(_0x4b055c,_0x4b870b){_0x4b055c=_0x4b055c-0x0;var _0x4b62bb=_0x7bee[_0x4b055c];return _0x4b62bb;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xe7be('0x0'));var BPromise=require(_0xe7be('0x1'));var rs=require(_0xe7be('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe7be('0x3'))['db'];var utils=require(_0xe7be('0x4'));var logger=require(_0xe7be('0x5'))(_0xe7be('0x6'));var config=require(_0xe7be('0x7'));var jayson=require(_0xe7be('0x8'));var client=jayson[_0xe7be('0x9')][_0xe7be('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x433f06,_0x9511ba,_0x2a9075){return new BPromise(function(_0x5a04bb,_0x2f35a2){return client[_0xe7be('0xb')](_0x433f06,_0x2a9075)[_0xe7be('0xc')](function(_0x201183){logger[_0xe7be('0xd')](_0xe7be('0xe'),_0x9511ba,_0xe7be('0xf'));logger['debug'](_0xe7be('0x10'),_0x9511ba,_0xe7be('0xf'),JSON['stringify'](_0x201183));if(_0x201183[_0xe7be('0x11')]){if(_0x201183['error'][_0xe7be('0x12')]===0x1f4){logger[_0xe7be('0x11')](_0xe7be('0xe'),_0x9511ba,_0x201183[_0xe7be('0x11')][_0xe7be('0x13')]);return _0x2f35a2(_0x201183[_0xe7be('0x11')]['message']);}logger['error']('ZendeskField,\x20%s,\x20%s',_0x9511ba,_0x201183[_0xe7be('0x11')][_0xe7be('0x13')]);return _0x5a04bb(_0x201183[_0xe7be('0x11')]['message']);}else{logger[_0xe7be('0xd')](_0xe7be('0xe'),_0x9511ba,_0xe7be('0xf'));_0x5a04bb(_0x201183[_0xe7be('0x14')][_0xe7be('0x13')]);}})[_0xe7be('0x15')](function(_0x30a4b4){logger[_0xe7be('0x11')](_0xe7be('0xe'),_0x9511ba,_0x30a4b4);_0x2f35a2(_0x30a4b4);});});} \ No newline at end of file diff --git a/server/api/intZohoAccount/index.js b/server/api/intZohoAccount/index.js index f8634bc..73d3ddd 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 _0x8c5a=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoAccount.controller','get','isAuthenticated','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','delete','destroy','exports','multer','util','connect-timeout','express'];(function(_0x5ec453,_0x30b0ba){var _0x25548f=function(_0x387b62){while(--_0x387b62){_0x5ec453['push'](_0x5ec453['shift']());}};_0x25548f(++_0x30b0ba);}(_0x8c5a,0x10f));var _0xa8c5=function(_0xd32e48,_0x396a2a){_0xd32e48=_0xd32e48-0x0;var _0x3577c4=_0x8c5a[_0xd32e48];return _0x3577c4;};'use strict';var multer=require(_0xa8c5('0x0'));var util=require(_0xa8c5('0x1'));var path=require('path');var timeout=require(_0xa8c5('0x2'));var express=require(_0xa8c5('0x3'));var router=express[_0xa8c5('0x4')]();var fs_extra=require(_0xa8c5('0x5'));var auth=require(_0xa8c5('0x6'));var interaction=require(_0xa8c5('0x7'));var config=require(_0xa8c5('0x8'));var controller=require(_0xa8c5('0x9'));router[_0xa8c5('0xa')]('/',auth[_0xa8c5('0xb')](),controller['index']);router[_0xa8c5('0xa')](_0xa8c5('0xc'),auth['isAuthenticated'](),controller[_0xa8c5('0xd')]);router[_0xa8c5('0xa')](_0xa8c5('0xe'),auth['isAuthenticated'](),controller[_0xa8c5('0xf')]);router['get'](_0xa8c5('0x10'),auth[_0xa8c5('0xb')](),controller[_0xa8c5('0x11')]);router[_0xa8c5('0x12')]('/',auth[_0xa8c5('0xb')](),controller[_0xa8c5('0x13')]);router[_0xa8c5('0x12')](_0xa8c5('0xe'),auth[_0xa8c5('0xb')](),controller[_0xa8c5('0x14')]);router[_0xa8c5('0x15')](_0xa8c5('0xc'),auth[_0xa8c5('0xb')](),controller['update']);router[_0xa8c5('0x16')](_0xa8c5('0xc'),auth[_0xa8c5('0xb')](),controller[_0xa8c5('0x17')]);module[_0xa8c5('0x18')]=router; \ No newline at end of file +var _0xbd80=['connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./intZohoAccount.controller','isAuthenticated','index','get','show','/:id/configurations','getConfigurations','create','post','addConfiguration','/:id','update','delete','exports','multer','util'];(function(_0x39bf9d,_0x536f2b){var _0x1780e5=function(_0x1e2260){while(--_0x1e2260){_0x39bf9d['push'](_0x39bf9d['shift']());}};_0x1780e5(++_0x536f2b);}(_0xbd80,0x91));var _0x0bd8=function(_0x3c5049,_0x43e369){_0x3c5049=_0x3c5049-0x0;var _0x32c766=_0xbd80[_0x3c5049];return _0x32c766;};'use strict';var multer=require(_0x0bd8('0x0'));var util=require(_0x0bd8('0x1'));var path=require('path');var timeout=require(_0x0bd8('0x2'));var express=require(_0x0bd8('0x3'));var router=express[_0x0bd8('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x0bd8('0x5'));var config=require(_0x0bd8('0x6'));var controller=require(_0x0bd8('0x7'));router['get']('/',auth[_0x0bd8('0x8')](),controller[_0x0bd8('0x9')]);router[_0x0bd8('0xa')]('/:id',auth['isAuthenticated'](),controller[_0x0bd8('0xb')]);router[_0x0bd8('0xa')](_0x0bd8('0xc'),auth[_0x0bd8('0x8')](),controller[_0x0bd8('0xd')]);router[_0x0bd8('0xa')]('/:id/fields',auth[_0x0bd8('0x8')](),controller['getFields']);router['post']('/',auth[_0x0bd8('0x8')](),controller[_0x0bd8('0xe')]);router[_0x0bd8('0xf')](_0x0bd8('0xc'),auth['isAuthenticated'](),controller[_0x0bd8('0x10')]);router['put'](_0x0bd8('0x11'),auth[_0x0bd8('0x8')](),controller[_0x0bd8('0x12')]);router[_0x0bd8('0x13')](_0x0bd8('0x11'),auth[_0x0bd8('0x8')](),controller['destroy']);module[_0x0bd8('0x14')]=router; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.attributes.js b/server/api/intZohoAccount/intZohoAccount.attributes.js index 6527caf..0f0be2f 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 _0x41bb=['exports','STRING','sequelize'];(function(_0xab6a2b,_0x403a6b){var _0x33edba=function(_0x533c32){while(--_0x533c32){_0xab6a2b['push'](_0xab6a2b['shift']());}};_0x33edba(++_0x403a6b);}(_0x41bb,0xc5));var _0xb41b=function(_0x441e2a,_0x59a562){_0x441e2a=_0x441e2a-0x0;var _0x443fdb=_0x41bb[_0x441e2a];return _0x443fdb;};'use strict';var Sequelize=require(_0xb41b('0x0'));module[_0xb41b('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xb41b('0x2')]},'host':{'type':Sequelize['STRING']},'zone':{'type':Sequelize[_0xb41b('0x2')]},'clientId':{'type':Sequelize[_0xb41b('0x2')]},'clientSecret':{'type':Sequelize[_0xb41b('0x2')]},'serverUrl':{'type':Sequelize[_0xb41b('0x2')],'allowNull':![]},'code':{'type':Sequelize['STRING']},'refreshToken':{'type':Sequelize[_0xb41b('0x2')]}}; \ No newline at end of file +var _0x2dae=['STRING','sequelize'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x2dae,0xc3));var _0xe2da=function(_0x5bfb78,_0x22e3ff){_0x5bfb78=_0x5bfb78-0x0;var _0x4efd00=_0x2dae[_0x5bfb78];return _0x4efd00;};'use strict';var Sequelize=require(_0xe2da('0x0'));module['exports']={'name':{'type':Sequelize[_0xe2da('0x1')]},'description':{'type':Sequelize[_0xe2da('0x1')]},'host':{'type':Sequelize[_0xe2da('0x1')]},'zone':{'type':Sequelize[_0xe2da('0x1')]},'clientId':{'type':Sequelize[_0xe2da('0x1')]},'clientSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0xe2da('0x1')],'allowNull':![]},'code':{'type':Sequelize[_0xe2da('0x1')]},'refreshToken':{'type':Sequelize[_0xe2da('0x1')]}}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.controller.js b/server/api/intZohoAccount/intZohoAccount.controller.js index 01105a8..44025f6 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 _0xad24=['data_type','picklist','pick_list_values','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','sox','lodash','squel','crypto','jsforce','to-csv','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','ZohoAccount','rawAttributes','fieldName','type','model','map','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','where','VIRTUAL','filter','merge','count','includeAll','include','show','params','length','options','find','create','catch','body','getConfigurations','ZohoConfiguration','addConfiguration','findOne','AccountId','Subjects','getSubjects','getDescriptions','channel','ZohoField','Descriptions','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','refresh_token','access_token','Unable\x20to\x20retrieve\x20the\x20access\x20token','getFields','clientId','serverUrl','code','refreshToken','host','zoho.eu','com','slice','substring','lastIndexOf','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','format','https://www.zohoapis.%s/crm/v2/settings/fields','Zoho-oauthtoken\x20','response','message','Subject','Description','WhoId','Call_Result','Call_Type','remove','includes','api_name','display_label','custom_field'];(function(_0x50e0b4,_0x1057f7){var _0x2fa8b0=function(_0x3766bc){while(--_0x3766bc){_0x50e0b4['push'](_0x50e0b4['shift']());}};_0x2fa8b0(++_0x1057f7);}(_0xad24,0x81));var _0x4ad2=function(_0x16c858,_0x193fd5){_0x16c858=_0x16c858-0x0;var _0x39b345=_0xad24[_0x16c858];return _0x39b345;};'use strict';var emlformat=require(_0x4ad2('0x0'));var rimraf=require(_0x4ad2('0x1'));var zipdir=require(_0x4ad2('0x2'));var jsonpatch=require(_0x4ad2('0x3'));var rp=require('request-promise');var moment=require(_0x4ad2('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x4ad2('0x5'));var util=require(_0x4ad2('0x6'));var path=require('path');var sox=require(_0x4ad2('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4ad2('0x8'));var squel=require(_0x4ad2('0x9'));var crypto=require(_0x4ad2('0xa'));var jsforce=require(_0x4ad2('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x4ad2('0xc'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x4ad2('0xd'));var authService=require(_0x4ad2('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x4ad2('0xf'));var hardwareService=require(_0x4ad2('0x10'));var logger=require(_0x4ad2('0x11'))(_0x4ad2('0x12'));var utils=require(_0x4ad2('0x13'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x4ad2('0x14'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x26fefb,_0x3a1be9){_0x3a1be9=_0x3a1be9||0xcc;return function(_0x3dc470){if(_0x3dc470){return _0x26fefb[_0x4ad2('0x15')](_0x3a1be9);}return _0x26fefb[_0x4ad2('0x16')](_0x3a1be9)[_0x4ad2('0x17')]();};}function respondWithResult(_0x291f96,_0xa9ad88){_0xa9ad88=_0xa9ad88||0xc8;return function(_0x395670){if(_0x395670){return _0x291f96[_0x4ad2('0x16')](_0xa9ad88)[_0x4ad2('0x18')](_0x395670);}};}function respondWithFilteredResult(_0x3fa2c3,_0x139bed){return function(_0x2d5127){if(_0x2d5127){var _0x46b681=typeof _0x139bed[_0x4ad2('0x19')]===_0x4ad2('0x1a')&&typeof _0x139bed[_0x4ad2('0x1b')]===_0x4ad2('0x1a');var _0x1a73ff=_0x2d5127['count'];var _0x5bf991=_0x46b681?0x0:_0x139bed['offset'];var _0x1dc944=_0x46b681?_0x2d5127['count']:_0x139bed[_0x4ad2('0x19')]+_0x139bed['limit'];var _0x10b7da;if(_0x1dc944>=_0x1a73ff){_0x1dc944=_0x1a73ff;_0x10b7da=0xc8;}else{_0x10b7da=0xce;}_0x3fa2c3[_0x4ad2('0x16')](_0x10b7da);return _0x3fa2c3[_0x4ad2('0x1c')](_0x4ad2('0x1d'),_0x5bf991+'-'+_0x1dc944+'/'+_0x1a73ff)[_0x4ad2('0x18')](_0x2d5127);}return null;};}function patchUpdates(_0xea9a7e){return function(_0x22c36e){try{jsonpatch[_0x4ad2('0x1e')](_0x22c36e,_0xea9a7e,!![]);}catch(_0x1ee425){return BPromise[_0x4ad2('0x1f')](_0x1ee425);}return _0x22c36e[_0x4ad2('0x20')]();};}function saveUpdates(_0x34b16c,_0x4f00e4){return function(_0x150db1){if(_0x150db1){return _0x150db1[_0x4ad2('0x21')](_0x34b16c)[_0x4ad2('0x22')](function(_0x4636d8){return _0x4636d8;});}return null;};}function removeEntity(_0x5e1aff,_0x43d581){return function(_0x1c4bfe){if(_0x1c4bfe){return _0x1c4bfe[_0x4ad2('0x23')]()[_0x4ad2('0x22')](function(){_0x5e1aff[_0x4ad2('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x353c09,_0x20030a){return function(_0x83b354){if(!_0x83b354){_0x353c09['sendStatus'](0x194);}return _0x83b354;};}function handleError(_0x431f8b,_0x450016){_0x450016=_0x450016||0x1f4;return function(_0x268f76){logger[_0x4ad2('0x24')](_0x268f76[_0x4ad2('0x25')]);if(_0x268f76[_0x4ad2('0x26')]){delete _0x268f76[_0x4ad2('0x26')];}_0x431f8b['status'](_0x450016)[_0x4ad2('0x27')](_0x268f76);};}exports['index']=function(_0x14d97d,_0x3f63a4){var _0x416327={},_0x545b10={},_0x7808e={'count':0x0,'rows':[]};var _0x9c095=_['map'](db[_0x4ad2('0x28')][_0x4ad2('0x29')],function(_0x55902a){return{'name':_0x55902a[_0x4ad2('0x2a')],'type':_0x55902a[_0x4ad2('0x2b')]['key']};});_0x545b10[_0x4ad2('0x2c')]=_[_0x4ad2('0x2d')](_0x9c095,'name');_0x545b10['query']=_[_0x4ad2('0x2e')](_0x14d97d[_0x4ad2('0x2f')]);_0x545b10[_0x4ad2('0x30')]=_[_0x4ad2('0x31')](_0x545b10[_0x4ad2('0x2c')],_0x545b10[_0x4ad2('0x2f')]);_0x416327[_0x4ad2('0x32')]=_[_0x4ad2('0x31')](_0x545b10[_0x4ad2('0x2c')],qs['fields'](_0x14d97d['query'][_0x4ad2('0x33')]));_0x416327['attributes']=_0x416327[_0x4ad2('0x32')]['length']?_0x416327['attributes']:_0x545b10['model'];if(!_0x14d97d[_0x4ad2('0x2f')][_0x4ad2('0x34')](_0x4ad2('0x35'))){_0x416327[_0x4ad2('0x1b')]=qs[_0x4ad2('0x1b')](_0x14d97d['query'][_0x4ad2('0x1b')]);_0x416327[_0x4ad2('0x19')]=qs[_0x4ad2('0x19')](_0x14d97d[_0x4ad2('0x2f')][_0x4ad2('0x19')]);}_0x416327[_0x4ad2('0x36')]=qs[_0x4ad2('0x37')](_0x14d97d[_0x4ad2('0x2f')]['sort']);_0x416327['where']=qs[_0x4ad2('0x30')](_[_0x4ad2('0x38')](_0x14d97d[_0x4ad2('0x2f')],_0x545b10[_0x4ad2('0x30')]),_0x9c095);if(_0x14d97d[_0x4ad2('0x2f')]['filter']){_0x416327[_0x4ad2('0x39')]=_['merge'](_0x416327[_0x4ad2('0x39')],{'$or':_['map'](_0x9c095,function(_0x4ce9a4){if(_0x4ce9a4['type']!==_0x4ad2('0x3a')){var _0x415f33={};_0x415f33[_0x4ce9a4[_0x4ad2('0x26')]]={'$like':'%'+_0x14d97d[_0x4ad2('0x2f')][_0x4ad2('0x3b')]+'%'};return _0x415f33;}})});}_0x416327=_[_0x4ad2('0x3c')]({},_0x416327,_0x14d97d['options']);var _0x72c59d={'where':_0x416327[_0x4ad2('0x39')]};return db[_0x4ad2('0x28')][_0x4ad2('0x3d')](_0x72c59d)[_0x4ad2('0x22')](function(_0x3dcc77){_0x7808e[_0x4ad2('0x3d')]=_0x3dcc77;if(_0x14d97d[_0x4ad2('0x2f')][_0x4ad2('0x3e')]){_0x416327[_0x4ad2('0x3f')]=[{'all':!![]}];}return db[_0x4ad2('0x28')]['findAll'](_0x416327);})[_0x4ad2('0x22')](function(_0x1a1f43){_0x7808e['rows']=_0x1a1f43;return _0x7808e;})[_0x4ad2('0x22')](respondWithFilteredResult(_0x3f63a4,_0x416327))['catch'](handleError(_0x3f63a4,null));};exports[_0x4ad2('0x40')]=function(_0x4a8214,_0x401841){var _0x251b5f={'raw':![],'where':{'id':_0x4a8214[_0x4ad2('0x41')]['id']}},_0x4ece7e={};_0x4ece7e[_0x4ad2('0x2c')]=_[_0x4ad2('0x2e')](db[_0x4ad2('0x28')][_0x4ad2('0x29')]);_0x4ece7e['query']=_['keys'](_0x4a8214['query']);_0x4ece7e['filters']=_[_0x4ad2('0x31')](_0x4ece7e['model'],_0x4ece7e[_0x4ad2('0x2f')]);_0x251b5f[_0x4ad2('0x32')]=_['intersection'](_0x4ece7e[_0x4ad2('0x2c')],qs['fields'](_0x4a8214['query'][_0x4ad2('0x33')]));_0x251b5f['attributes']=_0x251b5f[_0x4ad2('0x32')][_0x4ad2('0x42')]?_0x251b5f['attributes']:_0x4ece7e[_0x4ad2('0x2c')];if(_0x4a8214[_0x4ad2('0x2f')][_0x4ad2('0x3e')]){_0x251b5f['include']=[{'all':!![]}];}_0x251b5f=_['merge']({},_0x251b5f,_0x4a8214[_0x4ad2('0x43')]);return db[_0x4ad2('0x28')][_0x4ad2('0x44')](_0x251b5f)['then'](handleEntityNotFound(_0x401841,null))[_0x4ad2('0x22')](respondWithResult(_0x401841,null))['catch'](handleError(_0x401841,null));};exports[_0x4ad2('0x45')]=function(_0x50a5a2,_0x330ede){return db[_0x4ad2('0x28')][_0x4ad2('0x45')](_0x50a5a2['body'],{})['then'](respondWithResult(_0x330ede,0xc9))[_0x4ad2('0x46')](handleError(_0x330ede,null));};exports[_0x4ad2('0x21')]=function(_0x140005,_0x29ea67){if(_0x140005[_0x4ad2('0x47')]['id']){delete _0x140005[_0x4ad2('0x47')]['id'];}return db[_0x4ad2('0x28')][_0x4ad2('0x44')]({'where':{'id':_0x140005[_0x4ad2('0x41')]['id']}})[_0x4ad2('0x22')](handleEntityNotFound(_0x29ea67,null))['then'](saveUpdates(_0x140005[_0x4ad2('0x47')],null))[_0x4ad2('0x22')](respondWithResult(_0x29ea67,null))['catch'](handleError(_0x29ea67,null));};exports[_0x4ad2('0x23')]=function(_0x5e7a44,_0x462938){return db['ZohoAccount'][_0x4ad2('0x44')]({'where':{'id':_0x5e7a44[_0x4ad2('0x41')]['id']}})[_0x4ad2('0x22')](handleEntityNotFound(_0x462938,null))[_0x4ad2('0x22')](removeEntity(_0x462938,null))[_0x4ad2('0x46')](handleError(_0x462938,null));};exports[_0x4ad2('0x48')]=function(_0x24b3dd,_0xf66279,_0x3fd3f5){var _0x5bff60={};var _0x4b6ac3={};var _0x4b0ea6;var _0x4e8142;return db[_0x4ad2('0x28')]['findOne']({'where':{'id':_0x24b3dd['params']['id']}})['then'](handleEntityNotFound(_0xf66279,null))[_0x4ad2('0x22')](function(_0x54add0){if(_0x54add0){_0x4b0ea6=_0x54add0;_0x4b6ac3[_0x4ad2('0x2c')]=_[_0x4ad2('0x2e')](db[_0x4ad2('0x49')][_0x4ad2('0x29')]);_0x4b6ac3[_0x4ad2('0x2f')]=_['keys'](_0x24b3dd[_0x4ad2('0x2f')]);_0x4b6ac3['filters']=_[_0x4ad2('0x31')](_0x4b6ac3['model'],_0x4b6ac3[_0x4ad2('0x2f')]);_0x5bff60[_0x4ad2('0x32')]=_[_0x4ad2('0x31')](_0x4b6ac3[_0x4ad2('0x2c')],qs['fields'](_0x24b3dd['query']['fields']));_0x5bff60[_0x4ad2('0x32')]=_0x5bff60[_0x4ad2('0x32')][_0x4ad2('0x42')]?_0x5bff60['attributes']:_0x4b6ac3[_0x4ad2('0x2c')];_0x5bff60[_0x4ad2('0x36')]=qs[_0x4ad2('0x37')](_0x24b3dd[_0x4ad2('0x2f')][_0x4ad2('0x37')]);_0x5bff60[_0x4ad2('0x39')]=qs[_0x4ad2('0x30')](_[_0x4ad2('0x38')](_0x24b3dd[_0x4ad2('0x2f')],_0x4b6ac3['filters']));if(_0x24b3dd[_0x4ad2('0x2f')][_0x4ad2('0x3b')]){_0x5bff60[_0x4ad2('0x39')]=_[_0x4ad2('0x3c')](_0x5bff60['where'],{'$or':_['map'](_0x5bff60['attributes'],function(_0x4bcfb0){var _0xd5d8e6={};_0xd5d8e6[_0x4bcfb0]={'$like':'%'+_0x24b3dd[_0x4ad2('0x2f')]['filter']+'%'};return _0xd5d8e6;})});}_0x5bff60=_['merge']({},_0x5bff60,_0x24b3dd['options']);return _0x4b0ea6['getConfigurations'](_0x5bff60);}})[_0x4ad2('0x22')](function(_0x2713dd){if(_0x2713dd){_0x4e8142=_0x2713dd['length'];if(!_0x24b3dd[_0x4ad2('0x2f')][_0x4ad2('0x34')](_0x4ad2('0x35'))){_0x5bff60[_0x4ad2('0x1b')]=qs[_0x4ad2('0x1b')](_0x24b3dd['query'][_0x4ad2('0x1b')]);_0x5bff60[_0x4ad2('0x19')]=qs[_0x4ad2('0x19')](_0x24b3dd[_0x4ad2('0x2f')]['offset']);}return _0x4b0ea6[_0x4ad2('0x48')](_0x5bff60);}})[_0x4ad2('0x22')](function(_0x3ae96d){if(_0x3ae96d){return _0x3ae96d?{'count':_0x4e8142,'rows':_0x3ae96d}:null;}})[_0x4ad2('0x22')](respondWithResult(_0xf66279,null))[_0x4ad2('0x46')](handleError(_0xf66279,null));};exports[_0x4ad2('0x4a')]=function(_0x582833,_0x4df042,_0x3918d7){if(_0x582833[_0x4ad2('0x47')]['id']){delete _0x582833[_0x4ad2('0x47')]['id'];}return db[_0x4ad2('0x28')][_0x4ad2('0x4b')]({'where':{'id':_0x582833['params']['id']}})[_0x4ad2('0x22')](handleEntityNotFound(_0x4df042,null))[_0x4ad2('0x22')](function(_0x1b5baf){if(_0x1b5baf){_0x582833[_0x4ad2('0x47')][_0x4ad2('0x4c')]=_0x1b5baf['id'];_0x582833['body'][_0x4ad2('0x4d')]=integrations[_0x4ad2('0x4e')](_0x582833[_0x4ad2('0x47')]['channel'],_0x582833[_0x4ad2('0x47')]['type']);_0x582833[_0x4ad2('0x47')]['Descriptions']=integrations[_0x4ad2('0x4f')](_0x582833[_0x4ad2('0x47')][_0x4ad2('0x50')],_0x582833[_0x4ad2('0x47')][_0x4ad2('0x2b')]);return db[_0x4ad2('0x49')][_0x4ad2('0x45')](_0x582833[_0x4ad2('0x47')],{'include':[{'model':db[_0x4ad2('0x51')],'as':_0x4ad2('0x4d')},{'model':db[_0x4ad2('0x51')],'as':_0x4ad2('0x52')}]});}return null;})[_0x4ad2('0x22')](respondWithResult(_0x4df042,null))['catch'](handleError(_0x4df042,null));};function getAccessToken(_0x1bea1b){return new Promise(function(_0x1c3a08,_0x5ad475){var _0x330054;switch(_0x1bea1b['zone']){case'US':_0x330054='https://accounts.zoho.com';break;case'AU':_0x330054=_0x4ad2('0x53');break;case'EU':_0x330054=_0x4ad2('0x54');break;case'IN':_0x330054=_0x4ad2('0x55');break;case'CN':_0x330054=_0x4ad2('0x56');break;default:_0x330054=_0x4ad2('0x54');break;}var _0x53c64d={'method':'POST','uri':_0x330054+'/oauth/v2/token','qs':{'refresh_token':_0x1bea1b['refreshToken'],'client_id':_0x1bea1b['clientId'],'client_secret':_0x1bea1b['clientSecret'],'grant_type':_0x4ad2('0x57')},'json':!![]};return rp(_0x53c64d)[_0x4ad2('0x22')](function(_0x2e419b){if(_0x2e419b[_0x4ad2('0x58')]){_0x1c3a08(_0x2e419b[_0x4ad2('0x58')]);}else{_0x5ad475(_0x4ad2('0x59'));}})[_0x4ad2('0x46')](function(_0x584226){_0x5ad475(_0x584226);});});}exports[_0x4ad2('0x5a')]=function(_0x1f6551,_0x5d6fba,_0x2440f3){var _0xdf4d0f,_0x44ce6d,_0x45db55,_0x2a84cb,_0xe7aae;return db[_0x4ad2('0x28')][_0x4ad2('0x4b')]({'where':{'id':_0x1f6551['params']['id']},'attributes':['id','host','zone',_0x4ad2('0x5b'),'clientSecret',_0x4ad2('0x5c'),_0x4ad2('0x5d'),_0x4ad2('0x5e')]})[_0x4ad2('0x22')](handleEntityNotFound(_0x5d6fba,null))[_0x4ad2('0x22')](function(_0x4580f5){_0xe7aae=_0x4580f5;_0xdf4d0f=_0xe7aae[_0x4ad2('0x5f')];_0x44ce6d=_0xdf4d0f===_0x4ad2('0x60')?'eu':_0x4ad2('0x61');_0x45db55=_0xe7aae[_0x4ad2('0x5c')];var _0x20b121=_0x45db55[_0x4ad2('0x62')](-0x1);if(_0x20b121==='/'||_0x20b121==='\x5c'||_0x20b121===':'){_0x45db55=_0x45db55[_0x4ad2('0x63')](0x0,_0x45db55[_0x4ad2('0x64')](_0x20b121));}if(!_0xe7aae[_0x4ad2('0x5e')]){throw new Error(_0x4ad2('0x65'));}return getAccessToken(_0xe7aae);})[_0x4ad2('0x22')](function(_0x3b436b){if(_0x3b436b){return rp({'method':'GET','uri':util[_0x4ad2('0x66')](_0x4ad2('0x67'),_0x44ce6d),'qs':{'module':'Calls'},'headers':{'Authorization':_0x4ad2('0x68')+_0x3b436b},'json':!![]});}})[_0x4ad2('0x22')](function(_0x565bdc){if(_0x565bdc){if(_0x565bdc[_0x4ad2('0x69')]&&_0x565bdc[_0x4ad2('0x69')][_0x4ad2('0x24')]){throw new Error(_0x565bdc[_0x4ad2('0x69')]['error'][_0x4ad2('0x6a')]);}var _0x1410b9=[];var _0x3d8b16=[];var _0x556cd7=['Owner',_0x4ad2('0x6b'),_0x4ad2('0x6c'),_0x4ad2('0x6d'),'Call_Duration',_0x4ad2('0x6e'),'Call_Start_Time',_0x4ad2('0x6f')];_0x3d8b16=_[_0x4ad2('0x70')](_0x565bdc[_0x4ad2('0x33')],function(_0x58cc67){return _0x556cd7[_0x4ad2('0x71')](_0x58cc67[_0x4ad2('0x72')]);});for(var _0x4ba9a4=0x0;_0x4ba9a4<_0x3d8b16[_0x4ad2('0x42')];_0x4ba9a4++){if(_0x3d8b16[_0x4ba9a4]['system_mandatory']===![]){_0x1410b9['push']({'id':_0x3d8b16[_0x4ba9a4]['id'],'name':_0x3d8b16[_0x4ba9a4][_0x4ad2('0x73')],'custom':_0x3d8b16[_0x4ba9a4][_0x4ad2('0x74')],'options':_0x3d8b16[_0x4ba9a4][_0x4ad2('0x75')]===_0x4ad2('0x76')&&_0x3d8b16[_0x4ba9a4]['pick_list_values'][_0x4ad2('0x42')]>-0x1?_[_0x4ad2('0x2d')](_0x3d8b16[_0x4ba9a4][_0x4ad2('0x77')],function(_0x2503a1){return{'name':_0x2503a1,'value':_0x2503a1};}):[]});}}return{'count':_0x1410b9['length'],'rows':_0x1410b9};}else{return{'count':0x0,'rows':[]};}})[_0x4ad2('0x22')](respondWithResult(_0x5d6fba,null))[_0x4ad2('0x46')](function(_0x5ded51){var _0x16bd06=_0x1f6551[_0x4ad2('0x2f')][_0x4ad2('0x78')]?0x1f4:_0x5ded51[_0x4ad2('0x79')]||0x1f4;logger[_0x4ad2('0x24')](_0x4ad2('0x7a'),'getFields',_0x16bd06,JSON['stringify'](_0x5ded51));delete _0x5ded51['name'];if(_0x16bd06===0x191){_0x16bd06=0x190;}_0x5d6fba[_0x4ad2('0x16')](_0x16bd06)['send'](_0x1f6551[_0x4ad2('0x2f')][_0x4ad2('0x78')]?{'message':'Wrong\x20credentials','statusCode':_0x5ded51[_0x4ad2('0x79')]}:_0x5ded51);});}; \ No newline at end of file +var _0x4e42=['lastIndexOf','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','GET','format','https://www.zohoapis.%s/crm/v2/settings/fields','Zoho-oauthtoken\x20','response','message','Owner','Subject','Call_Result','Call_Start_Time','remove','includes','api_name','display_label','custom_field','picklist','pick_list_values','test','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','statusCode','eml-format','zip-dir','fast-json-patch','request-promise','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/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','limit','undefined','count','apply','reject','save','update','then','error','stack','name','send','map','rawAttributes','fieldName','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','options','ZohoAccount','includeAll','include','catch','show','params','find','create','body','destroy','getConfigurations','findOne','ZohoConfiguration','addConfiguration','getSubjects','Descriptions','getDescriptions','channel','ZohoField','Subjects','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','POST','/oauth/v2/token','refreshToken','clientId','refresh_token','access_token','Unable\x20to\x20retrieve\x20the\x20access\x20token','getFields','clientSecret','serverUrl','code','host','zoho.eu','com','slice','substring'];(function(_0x2d41aa,_0x7455e8){var _0x37b420=function(_0x5e1be4){while(--_0x5e1be4){_0x2d41aa['push'](_0x2d41aa['shift']());}};_0x37b420(++_0x7455e8);}(_0x4e42,0x19b));var _0x24e4=function(_0xe36654,_0x7b16a4){_0xe36654=_0xe36654-0x0;var _0x56eb2f=_0x4e42[_0xe36654];return _0x56eb2f;};'use strict';var emlformat=require(_0x24e4('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x24e4('0x1'));var jsonpatch=require(_0x24e4('0x2'));var rp=require(_0x24e4('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x24e4('0x4'));var util=require(_0x24e4('0x5'));var path=require('path');var sox=require(_0x24e4('0x6'));var csv=require(_0x24e4('0x7'));var ejs=require(_0x24e4('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x24e4('0x9'));var squel=require(_0x24e4('0xa'));var crypto=require(_0x24e4('0xb'));var jsforce=require(_0x24e4('0xc'));var deskjs=require(_0x24e4('0xd'));var toCsv=require(_0x24e4('0x7'));var querystring=require(_0x24e4('0xe'));var Papa=require(_0x24e4('0xf'));var Redis=require('ioredis');var authService=require(_0x24e4('0x10'));var qs=require(_0x24e4('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x24e4('0x12'));var logger=require(_0x24e4('0x13'))(_0x24e4('0x14'));var utils=require(_0x24e4('0x15'));var config=require(_0x24e4('0x16'));var licenseUtil=require(_0x24e4('0x17'));var db=require(_0x24e4('0x18'))['db'];var integrations=require(_0x24e4('0x19'));function respondWithStatusCode(_0x2a2c5d,_0x35864c){_0x35864c=_0x35864c||0xcc;return function(_0x1452a2){if(_0x1452a2){return _0x2a2c5d[_0x24e4('0x1a')](_0x35864c);}return _0x2a2c5d[_0x24e4('0x1b')](_0x35864c)[_0x24e4('0x1c')]();};}function respondWithResult(_0x27c560,_0x23140e){_0x23140e=_0x23140e||0xc8;return function(_0x24be76){if(_0x24be76){return _0x27c560[_0x24e4('0x1b')](_0x23140e)[_0x24e4('0x1d')](_0x24be76);}};}function respondWithFilteredResult(_0x4e5ac6,_0x78d788){return function(_0x52de8c){if(_0x52de8c){var _0x2ea1db=typeof _0x78d788[_0x24e4('0x1e')]==='undefined'&&typeof _0x78d788[_0x24e4('0x1f')]===_0x24e4('0x20');var _0x166631=_0x52de8c[_0x24e4('0x21')];var _0x5a2352=_0x2ea1db?0x0:_0x78d788[_0x24e4('0x1e')];var _0x5e0856=_0x2ea1db?_0x52de8c['count']:_0x78d788[_0x24e4('0x1e')]+_0x78d788[_0x24e4('0x1f')];var _0x4c203e;if(_0x5e0856>=_0x166631){_0x5e0856=_0x166631;_0x4c203e=0xc8;}else{_0x4c203e=0xce;}_0x4e5ac6[_0x24e4('0x1b')](_0x4c203e);return _0x4e5ac6['set']('Content-Range',_0x5a2352+'-'+_0x5e0856+'/'+_0x166631)['json'](_0x52de8c);}return null;};}function patchUpdates(_0xe2bbb2){return function(_0x560d1e){try{jsonpatch[_0x24e4('0x22')](_0x560d1e,_0xe2bbb2,!![]);}catch(_0x4b1be2){return BPromise[_0x24e4('0x23')](_0x4b1be2);}return _0x560d1e[_0x24e4('0x24')]();};}function saveUpdates(_0x5b2b31,_0x2ce434){return function(_0x109ec5){if(_0x109ec5){return _0x109ec5[_0x24e4('0x25')](_0x5b2b31)['then'](function(_0x22c8b6){return _0x22c8b6;});}return null;};}function removeEntity(_0x4e131d,_0x562b3f){return function(_0x3dba5a){if(_0x3dba5a){return _0x3dba5a['destroy']()[_0x24e4('0x26')](function(){_0x4e131d[_0x24e4('0x1b')](0xcc)[_0x24e4('0x1c')]();});}};}function handleEntityNotFound(_0x43ffad,_0x27297e){return function(_0x7c6bdf){if(!_0x7c6bdf){_0x43ffad['sendStatus'](0x194);}return _0x7c6bdf;};}function handleError(_0x305432,_0x17a854){_0x17a854=_0x17a854||0x1f4;return function(_0x2c8371){logger[_0x24e4('0x27')](_0x2c8371[_0x24e4('0x28')]);if(_0x2c8371[_0x24e4('0x29')]){delete _0x2c8371[_0x24e4('0x29')];}_0x305432['status'](_0x17a854)[_0x24e4('0x2a')](_0x2c8371);};}exports['index']=function(_0x856bc2,_0x3980d7){var _0x41772a={},_0x1a92e2={},_0x3846c8={'count':0x0,'rows':[]};var _0x45ae77=_[_0x24e4('0x2b')](db['ZohoAccount'][_0x24e4('0x2c')],function(_0x5eae28){return{'name':_0x5eae28[_0x24e4('0x2d')],'type':_0x5eae28['type']['key']};});_0x1a92e2[_0x24e4('0x2e')]=_['map'](_0x45ae77,'name');_0x1a92e2['query']=_[_0x24e4('0x2f')](_0x856bc2[_0x24e4('0x30')]);_0x1a92e2[_0x24e4('0x31')]=_[_0x24e4('0x32')](_0x1a92e2[_0x24e4('0x2e')],_0x1a92e2[_0x24e4('0x30')]);_0x41772a[_0x24e4('0x33')]=_[_0x24e4('0x32')](_0x1a92e2[_0x24e4('0x2e')],qs[_0x24e4('0x34')](_0x856bc2['query'][_0x24e4('0x34')]));_0x41772a[_0x24e4('0x33')]=_0x41772a[_0x24e4('0x33')][_0x24e4('0x35')]?_0x41772a[_0x24e4('0x33')]:_0x1a92e2[_0x24e4('0x2e')];if(!_0x856bc2[_0x24e4('0x30')][_0x24e4('0x36')](_0x24e4('0x37'))){_0x41772a[_0x24e4('0x1f')]=qs[_0x24e4('0x1f')](_0x856bc2[_0x24e4('0x30')]['limit']);_0x41772a[_0x24e4('0x1e')]=qs['offset'](_0x856bc2[_0x24e4('0x30')][_0x24e4('0x1e')]);}_0x41772a[_0x24e4('0x38')]=qs[_0x24e4('0x39')](_0x856bc2[_0x24e4('0x30')][_0x24e4('0x39')]);_0x41772a[_0x24e4('0x3a')]=qs[_0x24e4('0x31')](_[_0x24e4('0x3b')](_0x856bc2[_0x24e4('0x30')],_0x1a92e2[_0x24e4('0x31')]),_0x45ae77);if(_0x856bc2['query'][_0x24e4('0x3c')]){_0x41772a[_0x24e4('0x3a')]=_[_0x24e4('0x3d')](_0x41772a[_0x24e4('0x3a')],{'$or':_[_0x24e4('0x2b')](_0x45ae77,function(_0x5a5bc4){if(_0x5a5bc4[_0x24e4('0x3e')]!=='VIRTUAL'){var _0x48abc6={};_0x48abc6[_0x5a5bc4[_0x24e4('0x29')]]={'$like':'%'+_0x856bc2[_0x24e4('0x30')]['filter']+'%'};return _0x48abc6;}})});}_0x41772a=_[_0x24e4('0x3d')]({},_0x41772a,_0x856bc2[_0x24e4('0x3f')]);var _0x4db772={'where':_0x41772a['where']};return db[_0x24e4('0x40')][_0x24e4('0x21')](_0x4db772)[_0x24e4('0x26')](function(_0x1eecdf){_0x3846c8['count']=_0x1eecdf;if(_0x856bc2['query'][_0x24e4('0x41')]){_0x41772a[_0x24e4('0x42')]=[{'all':!![]}];}return db[_0x24e4('0x40')]['findAll'](_0x41772a);})[_0x24e4('0x26')](function(_0x38ae3c){_0x3846c8['rows']=_0x38ae3c;return _0x3846c8;})[_0x24e4('0x26')](respondWithFilteredResult(_0x3980d7,_0x41772a))[_0x24e4('0x43')](handleError(_0x3980d7,null));};exports[_0x24e4('0x44')]=function(_0x181ae3,_0x568396){var _0x33b377={'raw':![],'where':{'id':_0x181ae3[_0x24e4('0x45')]['id']}},_0x27d5fb={};_0x27d5fb[_0x24e4('0x2e')]=_[_0x24e4('0x2f')](db[_0x24e4('0x40')][_0x24e4('0x2c')]);_0x27d5fb[_0x24e4('0x30')]=_['keys'](_0x181ae3[_0x24e4('0x30')]);_0x27d5fb[_0x24e4('0x31')]=_['intersection'](_0x27d5fb[_0x24e4('0x2e')],_0x27d5fb['query']);_0x33b377[_0x24e4('0x33')]=_['intersection'](_0x27d5fb['model'],qs['fields'](_0x181ae3[_0x24e4('0x30')][_0x24e4('0x34')]));_0x33b377[_0x24e4('0x33')]=_0x33b377[_0x24e4('0x33')][_0x24e4('0x35')]?_0x33b377['attributes']:_0x27d5fb[_0x24e4('0x2e')];if(_0x181ae3[_0x24e4('0x30')]['includeAll']){_0x33b377['include']=[{'all':!![]}];}_0x33b377=_[_0x24e4('0x3d')]({},_0x33b377,_0x181ae3[_0x24e4('0x3f')]);return db['ZohoAccount'][_0x24e4('0x46')](_0x33b377)[_0x24e4('0x26')](handleEntityNotFound(_0x568396,null))[_0x24e4('0x26')](respondWithResult(_0x568396,null))[_0x24e4('0x43')](handleError(_0x568396,null));};exports['create']=function(_0x117de7,_0x291fc0){return db[_0x24e4('0x40')][_0x24e4('0x47')](_0x117de7[_0x24e4('0x48')],{})[_0x24e4('0x26')](respondWithResult(_0x291fc0,0xc9))[_0x24e4('0x43')](handleError(_0x291fc0,null));};exports[_0x24e4('0x25')]=function(_0x2bc017,_0x4b9ec8){if(_0x2bc017[_0x24e4('0x48')]['id']){delete _0x2bc017[_0x24e4('0x48')]['id'];}return db[_0x24e4('0x40')]['find']({'where':{'id':_0x2bc017['params']['id']}})[_0x24e4('0x26')](handleEntityNotFound(_0x4b9ec8,null))['then'](saveUpdates(_0x2bc017[_0x24e4('0x48')],null))['then'](respondWithResult(_0x4b9ec8,null))['catch'](handleError(_0x4b9ec8,null));};exports[_0x24e4('0x49')]=function(_0x5a7539,_0x39fb4d){return db[_0x24e4('0x40')][_0x24e4('0x46')]({'where':{'id':_0x5a7539['params']['id']}})[_0x24e4('0x26')](handleEntityNotFound(_0x39fb4d,null))[_0x24e4('0x26')](removeEntity(_0x39fb4d,null))['catch'](handleError(_0x39fb4d,null));};exports[_0x24e4('0x4a')]=function(_0x2d8e0b,_0x10b179,_0x1f89dc){var _0x51c973={};var _0x34294a={};var _0x32e194;var _0x21ada8;return db[_0x24e4('0x40')][_0x24e4('0x4b')]({'where':{'id':_0x2d8e0b[_0x24e4('0x45')]['id']}})[_0x24e4('0x26')](handleEntityNotFound(_0x10b179,null))['then'](function(_0x5684c4){if(_0x5684c4){_0x32e194=_0x5684c4;_0x34294a[_0x24e4('0x2e')]=_['keys'](db[_0x24e4('0x4c')][_0x24e4('0x2c')]);_0x34294a[_0x24e4('0x30')]=_['keys'](_0x2d8e0b[_0x24e4('0x30')]);_0x34294a[_0x24e4('0x31')]=_[_0x24e4('0x32')](_0x34294a[_0x24e4('0x2e')],_0x34294a[_0x24e4('0x30')]);_0x51c973[_0x24e4('0x33')]=_[_0x24e4('0x32')](_0x34294a[_0x24e4('0x2e')],qs[_0x24e4('0x34')](_0x2d8e0b[_0x24e4('0x30')][_0x24e4('0x34')]));_0x51c973[_0x24e4('0x33')]=_0x51c973[_0x24e4('0x33')]['length']?_0x51c973[_0x24e4('0x33')]:_0x34294a[_0x24e4('0x2e')];_0x51c973[_0x24e4('0x38')]=qs[_0x24e4('0x39')](_0x2d8e0b[_0x24e4('0x30')][_0x24e4('0x39')]);_0x51c973['where']=qs[_0x24e4('0x31')](_[_0x24e4('0x3b')](_0x2d8e0b[_0x24e4('0x30')],_0x34294a['filters']));if(_0x2d8e0b[_0x24e4('0x30')][_0x24e4('0x3c')]){_0x51c973[_0x24e4('0x3a')]=_[_0x24e4('0x3d')](_0x51c973[_0x24e4('0x3a')],{'$or':_[_0x24e4('0x2b')](_0x51c973[_0x24e4('0x33')],function(_0x21295d){var _0x317ba7={};_0x317ba7[_0x21295d]={'$like':'%'+_0x2d8e0b['query'][_0x24e4('0x3c')]+'%'};return _0x317ba7;})});}_0x51c973=_['merge']({},_0x51c973,_0x2d8e0b[_0x24e4('0x3f')]);return _0x32e194[_0x24e4('0x4a')](_0x51c973);}})['then'](function(_0x47252f){if(_0x47252f){_0x21ada8=_0x47252f['length'];if(!_0x2d8e0b[_0x24e4('0x30')][_0x24e4('0x36')](_0x24e4('0x37'))){_0x51c973[_0x24e4('0x1f')]=qs[_0x24e4('0x1f')](_0x2d8e0b['query']['limit']);_0x51c973[_0x24e4('0x1e')]=qs[_0x24e4('0x1e')](_0x2d8e0b['query'][_0x24e4('0x1e')]);}return _0x32e194[_0x24e4('0x4a')](_0x51c973);}})['then'](function(_0x467106){if(_0x467106){return _0x467106?{'count':_0x21ada8,'rows':_0x467106}:null;}})[_0x24e4('0x26')](respondWithResult(_0x10b179,null))[_0x24e4('0x43')](handleError(_0x10b179,null));};exports[_0x24e4('0x4d')]=function(_0x35c05f,_0x5e0bbb,_0xf9d646){if(_0x35c05f[_0x24e4('0x48')]['id']){delete _0x35c05f[_0x24e4('0x48')]['id'];}return db[_0x24e4('0x40')]['findOne']({'where':{'id':_0x35c05f[_0x24e4('0x45')]['id']}})[_0x24e4('0x26')](handleEntityNotFound(_0x5e0bbb,null))[_0x24e4('0x26')](function(_0x2a88e2){if(_0x2a88e2){_0x35c05f['body']['AccountId']=_0x2a88e2['id'];_0x35c05f[_0x24e4('0x48')]['Subjects']=integrations[_0x24e4('0x4e')](_0x35c05f[_0x24e4('0x48')]['channel'],_0x35c05f[_0x24e4('0x48')][_0x24e4('0x3e')]);_0x35c05f['body'][_0x24e4('0x4f')]=integrations[_0x24e4('0x50')](_0x35c05f[_0x24e4('0x48')][_0x24e4('0x51')],_0x35c05f[_0x24e4('0x48')][_0x24e4('0x3e')]);return db[_0x24e4('0x4c')][_0x24e4('0x47')](_0x35c05f['body'],{'include':[{'model':db[_0x24e4('0x52')],'as':_0x24e4('0x53')},{'model':db[_0x24e4('0x52')],'as':'Descriptions'}]});}return null;})[_0x24e4('0x26')](respondWithResult(_0x5e0bbb,null))[_0x24e4('0x43')](handleError(_0x5e0bbb,null));};function getAccessToken(_0x4f03b1){return new Promise(function(_0x5d02cd,_0x3ae6c5){var _0x4ad44c;switch(_0x4f03b1[_0x24e4('0x54')]){case'US':_0x4ad44c=_0x24e4('0x55');break;case'AU':_0x4ad44c=_0x24e4('0x56');break;case'EU':_0x4ad44c=_0x24e4('0x57');break;case'IN':_0x4ad44c=_0x24e4('0x58');break;case'CN':_0x4ad44c='https://accounts.zoho.com.cn';break;default:_0x4ad44c=_0x24e4('0x57');break;}var _0x1d7acb={'method':_0x24e4('0x59'),'uri':_0x4ad44c+_0x24e4('0x5a'),'qs':{'refresh_token':_0x4f03b1[_0x24e4('0x5b')],'client_id':_0x4f03b1[_0x24e4('0x5c')],'client_secret':_0x4f03b1['clientSecret'],'grant_type':_0x24e4('0x5d')},'json':!![]};return rp(_0x1d7acb)[_0x24e4('0x26')](function(_0x190c4a){if(_0x190c4a[_0x24e4('0x5e')]){_0x5d02cd(_0x190c4a[_0x24e4('0x5e')]);}else{_0x3ae6c5(_0x24e4('0x5f'));}})[_0x24e4('0x43')](function(_0x132650){_0x3ae6c5(_0x132650);});});}exports[_0x24e4('0x60')]=function(_0x557ca0,_0xbc0036,_0x16be30){var _0x3fbfb7,_0x196162,_0x1ae0c0,_0x497608,_0x520857;return db[_0x24e4('0x40')][_0x24e4('0x4b')]({'where':{'id':_0x557ca0[_0x24e4('0x45')]['id']},'attributes':['id','host',_0x24e4('0x54'),_0x24e4('0x5c'),_0x24e4('0x61'),_0x24e4('0x62'),_0x24e4('0x63'),'refreshToken']})[_0x24e4('0x26')](handleEntityNotFound(_0xbc0036,null))[_0x24e4('0x26')](function(_0x55d955){_0x520857=_0x55d955;_0x3fbfb7=_0x520857[_0x24e4('0x64')];_0x196162=_0x3fbfb7===_0x24e4('0x65')?'eu':_0x24e4('0x66');_0x1ae0c0=_0x520857['serverUrl'];var _0x240852=_0x1ae0c0[_0x24e4('0x67')](-0x1);if(_0x240852==='/'||_0x240852==='\x5c'||_0x240852===':'){_0x1ae0c0=_0x1ae0c0[_0x24e4('0x68')](0x0,_0x1ae0c0[_0x24e4('0x69')](_0x240852));}if(!_0x520857[_0x24e4('0x5b')]){throw new Error(_0x24e4('0x6a'));}return getAccessToken(_0x520857);})['then'](function(_0x2d82e5){if(_0x2d82e5){return rp({'method':_0x24e4('0x6b'),'uri':util[_0x24e4('0x6c')](_0x24e4('0x6d'),_0x196162),'qs':{'module':'Calls'},'headers':{'Authorization':_0x24e4('0x6e')+_0x2d82e5},'json':!![]});}})[_0x24e4('0x26')](function(_0x3e8374){if(_0x3e8374){if(_0x3e8374[_0x24e4('0x6f')]&&_0x3e8374[_0x24e4('0x6f')][_0x24e4('0x27')]){throw new Error(_0x3e8374['response'][_0x24e4('0x27')][_0x24e4('0x70')]);}var _0x507bda=[];var _0x4d41ca=[];var _0x25af85=[_0x24e4('0x71'),_0x24e4('0x72'),'Description','WhoId','Call_Duration',_0x24e4('0x73'),_0x24e4('0x74'),'Call_Type'];_0x4d41ca=_[_0x24e4('0x75')](_0x3e8374[_0x24e4('0x34')],function(_0x6a5d08){return _0x25af85[_0x24e4('0x76')](_0x6a5d08[_0x24e4('0x77')]);});for(var _0x20af0f=0x0;_0x20af0f<_0x4d41ca[_0x24e4('0x35')];_0x20af0f++){if(_0x4d41ca[_0x20af0f]['system_mandatory']===![]){_0x507bda['push']({'id':_0x4d41ca[_0x20af0f]['id'],'name':_0x4d41ca[_0x20af0f][_0x24e4('0x78')],'custom':_0x4d41ca[_0x20af0f][_0x24e4('0x79')],'options':_0x4d41ca[_0x20af0f]['data_type']===_0x24e4('0x7a')&&_0x4d41ca[_0x20af0f][_0x24e4('0x7b')][_0x24e4('0x35')]>-0x1?_[_0x24e4('0x2b')](_0x4d41ca[_0x20af0f][_0x24e4('0x7b')],function(_0x2f5973){return{'name':_0x2f5973,'value':_0x2f5973};}):[]});}}return{'count':_0x507bda[_0x24e4('0x35')],'rows':_0x507bda};}else{return{'count':0x0,'rows':[]};}})[_0x24e4('0x26')](respondWithResult(_0xbc0036,null))['catch'](function(_0x3a7823){var _0x4f0d13=_0x557ca0[_0x24e4('0x30')][_0x24e4('0x7c')]?0x1f4:_0x3a7823['statusCode']||0x1f4;logger[_0x24e4('0x27')](_0x24e4('0x7d'),'getFields',_0x4f0d13,JSON[_0x24e4('0x7e')](_0x3a7823));delete _0x3a7823[_0x24e4('0x29')];if(_0x4f0d13===0x191){_0x4f0d13=0x190;}_0xbc0036['status'](_0x4f0d13)[_0x24e4('0x2a')](_0x557ca0[_0x24e4('0x30')][_0x24e4('0x7c')]?{'message':_0x24e4('0x7f'),'statusCode':_0x3a7823[_0x24e4('0x80')]}:_0x3a7823);});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.model.js b/server/api/intZohoAccount/intZohoAccount.model.js index d908ac3..00e7b29 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 _0x4ee2=['path','rimraf','../../config/environment','./intZohoAccount.attributes','exports','ZohoAccount','int_zoho_accounts','changed','serverUrl','clientSecret','code','slice','substring','lastIndexOf','zone','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.com.cn','https://accounts.zoho.eu','/oauth/v2/token','then','refresh_token','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','name','inspect','catch','clientId','host','https://accounts.zoho.com','POST','application/x-www-form-urlencoded','parse','lodash','util','../../config/logger','moment','bluebird'];(function(_0x49d1a8,_0x2fc719){var _0x439c88=function(_0x213265){while(--_0x213265){_0x49d1a8['push'](_0x49d1a8['shift']());}};_0x439c88(++_0x2fc719);}(_0x4ee2,0x1f3));var _0x24ee=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x4ee2[_0x21a9d9];return _0x46adce;};'use strict';var _=require(_0x24ee('0x0'));var util=require(_0x24ee('0x1'));var logger=require(_0x24ee('0x2'))('api');var moment=require(_0x24ee('0x3'));var BPromise=require(_0x24ee('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x24ee('0x5'));var rimraf=require(_0x24ee('0x6'));var config=require(_0x24ee('0x7'));var attributes=require(_0x24ee('0x8'));var integrations=require('../../components/integrations/configuration');module[_0x24ee('0x9')]=function(_0x23b6be,_0xfcc472){return _0x23b6be['define'](_0x24ee('0xa'),attributes,{'tableName':_0x24ee('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x2edf3e,_0x5075c2,_0xe07dc6){if(_0x2edf3e[_0x24ee('0xc')]('zone')||_0x2edf3e[_0x24ee('0xc')](_0x24ee('0xd'))||_0x2edf3e[_0x24ee('0xc')]('clientId')||_0x2edf3e[_0x24ee('0xc')](_0x24ee('0xe'))||_0x2edf3e['changed'](_0x24ee('0xf'))||_0x2edf3e[_0x24ee('0xc')]('host')){var _0x36bfca,_0xf9edf;_0x36bfca=_0x2edf3e['serverUrl'];var _0xd95b62=_0x36bfca[_0x24ee('0x10')](-0x1);if(_0xd95b62==='/'||_0xd95b62==='\x5c'||_0xd95b62===':'){_0x36bfca=_0x36bfca[_0x24ee('0x11')](0x0,_0x36bfca[_0x24ee('0x12')](_0xd95b62));}switch(_0x2edf3e[_0x24ee('0x13')]){case'US':_0xf9edf='https://accounts.zoho.com';break;case'AU':_0xf9edf=_0x24ee('0x14');break;case'IN':_0xf9edf=_0x24ee('0x15');break;case'CN':_0xf9edf=_0x24ee('0x16');break;default:_0xf9edf=_0x24ee('0x17');break;}var _0x3d252b={'method':'POST','uri':_0xf9edf+_0x24ee('0x18'),'form':{'grant_type':'authorization_code','client_id':_0x2edf3e['clientId'],'client_secret':_0x2edf3e[_0x24ee('0xe')],'redirect_uri':_0x2edf3e[_0x24ee('0xd')],'code':_0x2edf3e[_0x24ee('0xf')]},'headers':{'Content-Type':'application/x-www-form-urlencoded'}};return rp(_0x3d252b)[_0x24ee('0x19')](function(_0x426398){var _0x19e70a=JSON['parse'](_0x426398);if(_0x19e70a[_0x24ee('0x1a')]){_0x2edf3e[_0x24ee('0x1b')]=_0x19e70a['refresh_token'];logger[_0x24ee('0x1c')](util[_0x24ee('0x1d')](_0x24ee('0x1e'),_0x2edf3e['name'],_0x2edf3e['id']));}else{logger[_0x24ee('0x1f')](util[_0x24ee('0x1d')](_0x24ee('0x20'),_0x2edf3e[_0x24ee('0x21')],_0x2edf3e['id']),util[_0x24ee('0x22')](_0x19e70a,{'showHidden':![],'depth':null}));}return _0xe07dc6(null,_0x5075c2);})[_0x24ee('0x23')](function(_0x591d7b){logger[_0x24ee('0x1f')](util[_0x24ee('0x1d')](_0x24ee('0x20'),_0x2edf3e['name'],_0x2edf3e['id']),util['inspect'](parsedResult,{'showHidden':![],'depth':null}));return _0xe07dc6(_0x591d7b);});}else{return _0xe07dc6(null,_0x5075c2);}},'beforeUpdate':function(_0x5b8d05,_0x326150,_0x2ce604){if(_0x5b8d05[_0x24ee('0xc')](_0x24ee('0x13'))||_0x5b8d05['changed'](_0x24ee('0xd'))||_0x5b8d05[_0x24ee('0xc')](_0x24ee('0x24'))||_0x5b8d05[_0x24ee('0xc')]('clientSecret')||_0x5b8d05['changed'](_0x24ee('0xf'))||_0x5b8d05[_0x24ee('0xc')](_0x24ee('0x25'))){var _0x17cb65,_0x583ac5;_0x17cb65=_0x5b8d05[_0x24ee('0xd')];var _0x12c61c=_0x17cb65[_0x24ee('0x10')](-0x1);if(_0x12c61c==='/'||_0x12c61c==='\x5c'||_0x12c61c===':'){_0x17cb65=_0x17cb65[_0x24ee('0x11')](0x0,_0x17cb65['lastIndexOf'](_0x12c61c));}switch(_0x5b8d05[_0x24ee('0x13')]){case'US':_0x583ac5=_0x24ee('0x26');break;case'AU':_0x583ac5=_0x24ee('0x14');break;case'IN':_0x583ac5=_0x24ee('0x15');break;case'CN':_0x583ac5='https://accounts.zoho.com.cn';break;default:_0x583ac5='https://accounts.zoho.eu';break;}var _0x5a0c09={'method':_0x24ee('0x27'),'uri':_0x583ac5+_0x24ee('0x18'),'form':{'grant_type':'authorization_code','client_id':_0x5b8d05[_0x24ee('0x24')],'client_secret':_0x5b8d05[_0x24ee('0xe')],'redirect_uri':_0x5b8d05[_0x24ee('0xd')],'code':_0x5b8d05[_0x24ee('0xf')]},'headers':{'Content-Type':_0x24ee('0x28')}};return rp(_0x5a0c09)[_0x24ee('0x19')](function(_0x33702a){var _0x163113=JSON[_0x24ee('0x29')](_0x33702a);if(_0x163113[_0x24ee('0x1a')]){_0x5b8d05[_0x24ee('0x1b')]=_0x163113[_0x24ee('0x1a')];logger[_0x24ee('0x1c')](util[_0x24ee('0x1d')](_0x24ee('0x1e'),_0x5b8d05[_0x24ee('0x21')],_0x5b8d05['id']));}else{logger[_0x24ee('0x1f')](util[_0x24ee('0x1d')](_0x24ee('0x20'),_0x5b8d05[_0x24ee('0x21')],_0x5b8d05['id']),util[_0x24ee('0x22')](_0x163113,{'showHidden':![],'depth':null}));}return _0x2ce604(null,_0x326150);})[_0x24ee('0x23')](function(_0x2657f6){logger['error'](util[_0x24ee('0x1d')](_0x24ee('0x20'),_0x5b8d05[_0x24ee('0x21')],_0x5b8d05['id']),util['inspect'](parsedResult,{'showHidden':![],'depth':null}));return _0x2ce604(_0x2657f6);});}else{return _0x2ce604(null,_0x326150);}}}});}; \ No newline at end of file +var _0xdfcc=['host','serverUrl','slice','lastIndexOf','https://accounts.zoho.com','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','/oauth/v2/token','authorization_code','clientSecret','application/x-www-form-urlencoded','parse','refreshToken','info','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','error','format','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','name','inspect','substring','https://accounts.zoho.com.au','https://accounts.zoho.eu','then','refresh_token','catch','lodash','util','api','moment','bluebird','request-promise','path','rimraf','./intZohoAccount.attributes','../../components/integrations/configuration','exports','define','changed','zone','clientId','code'];(function(_0x248935,_0x1ef213){var _0x2edbd6=function(_0xe65e2c){while(--_0xe65e2c){_0x248935['push'](_0x248935['shift']());}};_0x2edbd6(++_0x1ef213);}(_0xdfcc,0x9c));var _0xcdfc=function(_0xaf29da,_0x117f5a){_0xaf29da=_0xaf29da-0x0;var _0x295c51=_0xdfcc[_0xaf29da];return _0x295c51;};'use strict';var _=require(_0xcdfc('0x0'));var util=require(_0xcdfc('0x1'));var logger=require('../../config/logger')(_0xcdfc('0x2'));var moment=require(_0xcdfc('0x3'));var BPromise=require(_0xcdfc('0x4'));var rp=require(_0xcdfc('0x5'));var fs=require('fs');var path=require(_0xcdfc('0x6'));var rimraf=require(_0xcdfc('0x7'));var config=require('../../config/environment');var attributes=require(_0xcdfc('0x8'));var integrations=require(_0xcdfc('0x9'));module[_0xcdfc('0xa')]=function(_0x1be107,_0xa752f3){return _0x1be107[_0xcdfc('0xb')]('ZohoAccount',attributes,{'tableName':'int_zoho_accounts','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x386437,_0x5d0ee1,_0x480fa1){if(_0x386437[_0xcdfc('0xc')](_0xcdfc('0xd'))||_0x386437[_0xcdfc('0xc')]('serverUrl')||_0x386437[_0xcdfc('0xc')](_0xcdfc('0xe'))||_0x386437[_0xcdfc('0xc')]('clientSecret')||_0x386437[_0xcdfc('0xc')](_0xcdfc('0xf'))||_0x386437[_0xcdfc('0xc')](_0xcdfc('0x10'))){var _0x1ecde7,_0x264fc3;_0x1ecde7=_0x386437[_0xcdfc('0x11')];var _0x499299=_0x1ecde7[_0xcdfc('0x12')](-0x1);if(_0x499299==='/'||_0x499299==='\x5c'||_0x499299===':'){_0x1ecde7=_0x1ecde7['substring'](0x0,_0x1ecde7[_0xcdfc('0x13')](_0x499299));}switch(_0x386437[_0xcdfc('0xd')]){case'US':_0x264fc3=_0xcdfc('0x14');break;case'AU':_0x264fc3='https://accounts.zoho.com.au';break;case'IN':_0x264fc3=_0xcdfc('0x15');break;case'CN':_0x264fc3=_0xcdfc('0x16');break;default:_0x264fc3='https://accounts.zoho.eu';break;}var _0x37f6bc={'method':_0xcdfc('0x17'),'uri':_0x264fc3+_0xcdfc('0x18'),'form':{'grant_type':_0xcdfc('0x19'),'client_id':_0x386437[_0xcdfc('0xe')],'client_secret':_0x386437[_0xcdfc('0x1a')],'redirect_uri':_0x386437[_0xcdfc('0x11')],'code':_0x386437[_0xcdfc('0xf')]},'headers':{'Content-Type':_0xcdfc('0x1b')}};return rp(_0x37f6bc)['then'](function(_0x596d39){var _0x4bd2e8=JSON[_0xcdfc('0x1c')](_0x596d39);if(_0x4bd2e8['refresh_token']){_0x386437[_0xcdfc('0x1d')]=_0x4bd2e8['refresh_token'];logger[_0xcdfc('0x1e')](util['format'](_0xcdfc('0x1f'),_0x386437['name'],_0x386437['id']));}else{logger[_0xcdfc('0x20')](util[_0xcdfc('0x21')](_0xcdfc('0x22'),_0x386437[_0xcdfc('0x23')],_0x386437['id']),util[_0xcdfc('0x24')](_0x4bd2e8,{'showHidden':![],'depth':null}));}return _0x480fa1(null,_0x5d0ee1);})['catch'](function(_0x5a5b55){logger[_0xcdfc('0x20')](util[_0xcdfc('0x21')](_0xcdfc('0x22'),_0x386437[_0xcdfc('0x23')],_0x386437['id']),util[_0xcdfc('0x24')](parsedResult,{'showHidden':![],'depth':null}));return _0x480fa1(_0x5a5b55);});}else{return _0x480fa1(null,_0x5d0ee1);}},'beforeUpdate':function(_0xaafd63,_0x4691b8,_0x50e03b){if(_0xaafd63[_0xcdfc('0xc')](_0xcdfc('0xd'))||_0xaafd63[_0xcdfc('0xc')](_0xcdfc('0x11'))||_0xaafd63[_0xcdfc('0xc')](_0xcdfc('0xe'))||_0xaafd63['changed']('clientSecret')||_0xaafd63['changed'](_0xcdfc('0xf'))||_0xaafd63[_0xcdfc('0xc')]('host')){var _0x253ab1,_0x5ad2ff;_0x253ab1=_0xaafd63[_0xcdfc('0x11')];var _0x4b9e9e=_0x253ab1[_0xcdfc('0x12')](-0x1);if(_0x4b9e9e==='/'||_0x4b9e9e==='\x5c'||_0x4b9e9e===':'){_0x253ab1=_0x253ab1[_0xcdfc('0x25')](0x0,_0x253ab1[_0xcdfc('0x13')](_0x4b9e9e));}switch(_0xaafd63['zone']){case'US':_0x5ad2ff=_0xcdfc('0x14');break;case'AU':_0x5ad2ff=_0xcdfc('0x26');break;case'IN':_0x5ad2ff=_0xcdfc('0x15');break;case'CN':_0x5ad2ff=_0xcdfc('0x16');break;default:_0x5ad2ff=_0xcdfc('0x27');break;}var _0x4fdc49={'method':_0xcdfc('0x17'),'uri':_0x5ad2ff+_0xcdfc('0x18'),'form':{'grant_type':'authorization_code','client_id':_0xaafd63[_0xcdfc('0xe')],'client_secret':_0xaafd63[_0xcdfc('0x1a')],'redirect_uri':_0xaafd63['serverUrl'],'code':_0xaafd63['code']},'headers':{'Content-Type':_0xcdfc('0x1b')}};return rp(_0x4fdc49)[_0xcdfc('0x28')](function(_0x31770c){var _0x326bb0=JSON[_0xcdfc('0x1c')](_0x31770c);if(_0x326bb0[_0xcdfc('0x29')]){_0xaafd63[_0xcdfc('0x1d')]=_0x326bb0[_0xcdfc('0x29')];logger[_0xcdfc('0x1e')](util[_0xcdfc('0x21')]('ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d',_0xaafd63[_0xcdfc('0x23')],_0xaafd63['id']));}else{logger['error'](util[_0xcdfc('0x21')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0xaafd63[_0xcdfc('0x23')],_0xaafd63['id']),util[_0xcdfc('0x24')](_0x326bb0,{'showHidden':![],'depth':null}));}return _0x50e03b(null,_0x4691b8);})[_0xcdfc('0x2a')](function(_0x1fec3d){logger[_0xcdfc('0x20')](util[_0xcdfc('0x21')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0xaafd63[_0xcdfc('0x23')],_0xaafd63['id']),util[_0xcdfc('0x24')](parsedResult,{'showHidden':![],'depth':null}));return _0x50e03b(_0x1fec3d);});}else{return _0x50e03b(null,_0x4691b8);}}}});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.rpc.js b/server/api/intZohoAccount/intZohoAccount.rpc.js index e59010e..870edd0 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 _0xeb3b=['model','include','stringify','ShowZohoAccount','find','raw','lodash','util','moment','bluebird','randomstring','../../config/utils','rpc','jayson/promise','client','http','request','then','info','ZohoAccount,\x20%s,\x20%s','request\x20sent','ZohoAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetZohoAccount','ZohoAccount','findAll','options','where','attributes','map'];(function(_0x40de90,_0x2cb1fc){var _0x58ffdc=function(_0x413b7e){while(--_0x413b7e){_0x40de90['push'](_0x40de90['shift']());}};_0x58ffdc(++_0x2cb1fc);}(_0xeb3b,0x19e));var _0xbeb3=function(_0x21cb7f,_0x48cd16){_0x21cb7f=_0x21cb7f-0x0;var _0x5a079a=_0xeb3b[_0x21cb7f];return _0x5a079a;};'use strict';var _=require(_0xbeb3('0x0'));var util=require(_0xbeb3('0x1'));var moment=require(_0xbeb3('0x2'));var BPromise=require(_0xbeb3('0x3'));var rs=require(_0xbeb3('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xbeb3('0x5'));var logger=require('../../config/logger')(_0xbeb3('0x6'));var config=require('../../config/environment');var jayson=require(_0xbeb3('0x7'));var client=jayson[_0xbeb3('0x8')][_0xbeb3('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x294cc9,_0x406927,_0x143255){return new BPromise(function(_0x5a6a06,_0x241dbb){return client[_0xbeb3('0xa')](_0x294cc9,_0x143255)[_0xbeb3('0xb')](function(_0x3b61ac){logger[_0xbeb3('0xc')](_0xbeb3('0xd'),_0x406927,_0xbeb3('0xe'));logger['debug'](_0xbeb3('0xf'),_0x406927,_0xbeb3('0xe'),JSON['stringify'](_0x3b61ac));if(_0x3b61ac[_0xbeb3('0x10')]){if(_0x3b61ac[_0xbeb3('0x10')][_0xbeb3('0x11')]===0x1f4){logger[_0xbeb3('0x10')](_0xbeb3('0xd'),_0x406927,_0x3b61ac[_0xbeb3('0x10')]['message']);return _0x241dbb(_0x3b61ac['error'][_0xbeb3('0x12')]);}logger[_0xbeb3('0x10')]('ZohoAccount,\x20%s,\x20%s',_0x406927,_0x3b61ac['error'][_0xbeb3('0x12')]);return _0x5a6a06(_0x3b61ac[_0xbeb3('0x10')][_0xbeb3('0x12')]);}else{logger[_0xbeb3('0xc')](_0xbeb3('0xd'),_0x406927,'request\x20sent');_0x5a6a06(_0x3b61ac[_0xbeb3('0x13')]['message']);}})[_0xbeb3('0x14')](function(_0x4e7d99){logger['error']('ZohoAccount,\x20%s,\x20%s',_0x406927,_0x4e7d99);_0x241dbb(_0x4e7d99);});});}exports[_0xbeb3('0x15')]=function(_0x44a4bb){var _0x32275b=this;return new Promise(function(_0x10b15d,_0x5d0689){return db[_0xbeb3('0x16')][_0xbeb3('0x17')]({'raw':_0x44a4bb[_0xbeb3('0x18')]?_0x44a4bb['options']['raw']===undefined?!![]:![]:!![],'where':_0x44a4bb[_0xbeb3('0x18')]?_0x44a4bb['options'][_0xbeb3('0x19')]||null:null,'attributes':_0x44a4bb['options']?_0x44a4bb['options'][_0xbeb3('0x1a')]||null:null,'limit':_0x44a4bb[_0xbeb3('0x18')]?_0x44a4bb[_0xbeb3('0x18')]['limit']||null:null,'include':_0x44a4bb[_0xbeb3('0x18')]?_0x44a4bb[_0xbeb3('0x18')]['include']?_[_0xbeb3('0x1b')](_0x44a4bb[_0xbeb3('0x18')]['include'],function(_0xfc384a){return{'model':db[_0xfc384a[_0xbeb3('0x1c')]],'as':_0xfc384a['as'],'attributes':_0xfc384a[_0xbeb3('0x1a')],'include':_0xfc384a[_0xbeb3('0x1d')]?_[_0xbeb3('0x1b')](_0xfc384a[_0xbeb3('0x1d')],function(_0x84921a){return{'model':db[_0x84921a[_0xbeb3('0x1c')]],'as':_0x84921a['as'],'attributes':_0x84921a[_0xbeb3('0x1a')],'include':_0x84921a['include']?_['map'](_0x84921a[_0xbeb3('0x1d')],function(_0x520116){return{'model':db[_0x520116[_0xbeb3('0x1c')]],'as':_0x520116['as'],'attributes':_0x520116[_0xbeb3('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xbeb3('0xb')](function(_0x400f65){logger['info'](_0xbeb3('0x15'),_0x44a4bb);logger['debug'](_0xbeb3('0x15'),_0x44a4bb,JSON[_0xbeb3('0x1e')](_0x400f65));_0x10b15d(_0x400f65);})['catch'](function(_0x483198){logger[_0xbeb3('0x10')]('GetZohoAccount',_0x483198['message'],_0x44a4bb);_0x5d0689(_0x32275b['error'](0x1f4,_0x483198['message']));});});};exports[_0xbeb3('0x1f')]=function(_0x4e9a04){var _0x3767cc=this;return new Promise(function(_0x3dff2d,_0x1b4c2e){return db[_0xbeb3('0x16')][_0xbeb3('0x20')]({'raw':_0x4e9a04[_0xbeb3('0x18')]?_0x4e9a04[_0xbeb3('0x18')][_0xbeb3('0x21')]===undefined?!![]:![]:!![],'where':_0x4e9a04[_0xbeb3('0x18')]?_0x4e9a04[_0xbeb3('0x18')]['where']||null:null,'attributes':_0x4e9a04[_0xbeb3('0x18')]?_0x4e9a04[_0xbeb3('0x18')]['attributes']||null:null,'include':_0x4e9a04[_0xbeb3('0x18')]?_0x4e9a04[_0xbeb3('0x18')][_0xbeb3('0x1d')]?_[_0xbeb3('0x1b')](_0x4e9a04['options'][_0xbeb3('0x1d')],function(_0x18f2be){return{'model':db[_0x18f2be[_0xbeb3('0x1c')]],'as':_0x18f2be['as'],'attributes':_0x18f2be[_0xbeb3('0x1a')],'include':_0x18f2be[_0xbeb3('0x1d')]?_[_0xbeb3('0x1b')](_0x18f2be[_0xbeb3('0x1d')],function(_0x3581b4){return{'model':db[_0x3581b4[_0xbeb3('0x1c')]],'as':_0x3581b4['as'],'attributes':_0x3581b4['attributes'],'include':_0x3581b4[_0xbeb3('0x1d')]?_['map'](_0x3581b4[_0xbeb3('0x1d')],function(_0x2f4600){return{'model':db[_0x2f4600[_0xbeb3('0x1c')]],'as':_0x2f4600['as'],'attributes':_0x2f4600[_0xbeb3('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xbeb3('0xb')](function(_0x280254){logger[_0xbeb3('0xc')](_0xbeb3('0x1f'),_0x4e9a04);logger['debug'](_0xbeb3('0x1f'),_0x4e9a04,JSON['stringify'](_0x280254));_0x3dff2d(_0x280254);})['catch'](function(_0x547275){logger[_0xbeb3('0x10')](_0xbeb3('0x1f'),_0x547275[_0xbeb3('0x12')],_0x4e9a04);_0x1b4c2e(_0x3767cc[_0xbeb3('0x10')](0x1f4,_0x547275[_0xbeb3('0x12')]));});});}; \ No newline at end of file +var _0x0120=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','info','ZohoAccount,\x20%s,\x20%s','request\x20sent','ZohoAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetZohoAccount','findAll','options','raw','where','attributes','limit','include','map','model','then','debug','catch','ZohoAccount','find','ShowZohoAccount','lodash','util','moment'];(function(_0x5ddb1c,_0x5ea4df){var _0x354adc=function(_0x2dfb1f){while(--_0x2dfb1f){_0x5ddb1c['push'](_0x5ddb1c['shift']());}};_0x354adc(++_0x5ea4df);}(_0x0120,0x6f));var _0x0012=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x0120[_0x4cf98e];return _0x1623ac;};'use strict';var _=require(_0x0012('0x0'));var util=require(_0x0012('0x1'));var moment=require(_0x0012('0x2'));var BPromise=require(_0x0012('0x3'));var rs=require(_0x0012('0x4'));var fs=require('fs');var Redis=require(_0x0012('0x5'));var db=require(_0x0012('0x6'))['db'];var utils=require(_0x0012('0x7'));var logger=require(_0x0012('0x8'))(_0x0012('0x9'));var config=require(_0x0012('0xa'));var jayson=require(_0x0012('0xb'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x59980a,_0x95d441,_0x436af8){return new BPromise(function(_0x3d4c64,_0x30176d){return client[_0x0012('0xc')](_0x59980a,_0x436af8)['then'](function(_0x14991f){logger[_0x0012('0xd')](_0x0012('0xe'),_0x95d441,_0x0012('0xf'));logger['debug'](_0x0012('0x10'),_0x95d441,'request\x20sent',JSON[_0x0012('0x11')](_0x14991f));if(_0x14991f[_0x0012('0x12')]){if(_0x14991f[_0x0012('0x12')][_0x0012('0x13')]===0x1f4){logger[_0x0012('0x12')]('ZohoAccount,\x20%s,\x20%s',_0x95d441,_0x14991f[_0x0012('0x12')]['message']);return _0x30176d(_0x14991f['error']['message']);}logger['error'](_0x0012('0xe'),_0x95d441,_0x14991f['error'][_0x0012('0x14')]);return _0x3d4c64(_0x14991f[_0x0012('0x12')]['message']);}else{logger[_0x0012('0xd')](_0x0012('0xe'),_0x95d441,_0x0012('0xf'));_0x3d4c64(_0x14991f[_0x0012('0x15')]['message']);}})['catch'](function(_0x1e7fbe){logger[_0x0012('0x12')](_0x0012('0xe'),_0x95d441,_0x1e7fbe);_0x30176d(_0x1e7fbe);});});}exports[_0x0012('0x16')]=function(_0x1d0423){var _0x22ded1=this;return new Promise(function(_0x1e78ee,_0x2eb3fa){return db['ZohoAccount'][_0x0012('0x17')]({'raw':_0x1d0423[_0x0012('0x18')]?_0x1d0423['options'][_0x0012('0x19')]===undefined?!![]:![]:!![],'where':_0x1d0423[_0x0012('0x18')]?_0x1d0423[_0x0012('0x18')][_0x0012('0x1a')]||null:null,'attributes':_0x1d0423['options']?_0x1d0423['options'][_0x0012('0x1b')]||null:null,'limit':_0x1d0423[_0x0012('0x18')]?_0x1d0423[_0x0012('0x18')][_0x0012('0x1c')]||null:null,'include':_0x1d0423[_0x0012('0x18')]?_0x1d0423[_0x0012('0x18')][_0x0012('0x1d')]?_[_0x0012('0x1e')](_0x1d0423['options'][_0x0012('0x1d')],function(_0x24a280){return{'model':db[_0x24a280['model']],'as':_0x24a280['as'],'attributes':_0x24a280[_0x0012('0x1b')],'include':_0x24a280[_0x0012('0x1d')]?_[_0x0012('0x1e')](_0x24a280[_0x0012('0x1d')],function(_0x42bcd7){return{'model':db[_0x42bcd7['model']],'as':_0x42bcd7['as'],'attributes':_0x42bcd7[_0x0012('0x1b')],'include':_0x42bcd7[_0x0012('0x1d')]?_[_0x0012('0x1e')](_0x42bcd7[_0x0012('0x1d')],function(_0x173cb3){return{'model':db[_0x173cb3[_0x0012('0x1f')]],'as':_0x173cb3['as'],'attributes':_0x173cb3[_0x0012('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x0012('0x20')](function(_0x300e13){logger[_0x0012('0xd')](_0x0012('0x16'),_0x1d0423);logger[_0x0012('0x21')](_0x0012('0x16'),_0x1d0423,JSON[_0x0012('0x11')](_0x300e13));_0x1e78ee(_0x300e13);})[_0x0012('0x22')](function(_0x276389){logger[_0x0012('0x12')](_0x0012('0x16'),_0x276389[_0x0012('0x14')],_0x1d0423);_0x2eb3fa(_0x22ded1[_0x0012('0x12')](0x1f4,_0x276389[_0x0012('0x14')]));});});};exports['ShowZohoAccount']=function(_0x283134){var _0x1bb49b=this;return new Promise(function(_0x4c2601,_0x2fa6a2){return db[_0x0012('0x23')][_0x0012('0x24')]({'raw':_0x283134[_0x0012('0x18')]?_0x283134[_0x0012('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x283134[_0x0012('0x18')]?_0x283134[_0x0012('0x18')][_0x0012('0x1a')]||null:null,'attributes':_0x283134['options']?_0x283134[_0x0012('0x18')][_0x0012('0x1b')]||null:null,'include':_0x283134[_0x0012('0x18')]?_0x283134[_0x0012('0x18')][_0x0012('0x1d')]?_[_0x0012('0x1e')](_0x283134['options'][_0x0012('0x1d')],function(_0x30dfd8){return{'model':db[_0x30dfd8[_0x0012('0x1f')]],'as':_0x30dfd8['as'],'attributes':_0x30dfd8[_0x0012('0x1b')],'include':_0x30dfd8['include']?_['map'](_0x30dfd8[_0x0012('0x1d')],function(_0x30f8a2){return{'model':db[_0x30f8a2[_0x0012('0x1f')]],'as':_0x30f8a2['as'],'attributes':_0x30f8a2[_0x0012('0x1b')],'include':_0x30f8a2[_0x0012('0x1d')]?_[_0x0012('0x1e')](_0x30f8a2[_0x0012('0x1d')],function(_0x4f13b9){return{'model':db[_0x4f13b9[_0x0012('0x1f')]],'as':_0x4f13b9['as'],'attributes':_0x4f13b9[_0x0012('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x196222){logger[_0x0012('0xd')](_0x0012('0x25'),_0x283134);logger[_0x0012('0x21')](_0x0012('0x25'),_0x283134,JSON[_0x0012('0x11')](_0x196222));_0x4c2601(_0x196222);})[_0x0012('0x22')](function(_0x4a4af8){logger[_0x0012('0x12')]('ShowZohoAccount',_0x4a4af8[_0x0012('0x14')],_0x283134);_0x2fa6a2(_0x1bb49b['error'](0x1f4,_0x4a4af8['message']));});});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/index.js b/server/api/intZohoConfiguration/index.js index 7c9c7ca..9529f7f 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 _0x41f9=['/:id','show','get','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','create','update','delete','destroy','exports','util','connect-timeout','express','../../components/auth/service','./intZohoConfiguration.controller','isAuthenticated','index'];(function(_0x427f6a,_0x2a5c59){var _0x5b161a=function(_0x2162aa){while(--_0x2162aa){_0x427f6a['push'](_0x427f6a['shift']());}};_0x5b161a(++_0x2a5c59);}(_0x41f9,0x8c));var _0x941f=function(_0x21549c,_0x6d64d1){_0x21549c=_0x21549c-0x0;var _0x426cbd=_0x41f9[_0x21549c];return _0x426cbd;};'use strict';var multer=require('multer');var util=require(_0x941f('0x0'));var path=require('path');var timeout=require(_0x941f('0x1'));var express=require(_0x941f('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x941f('0x3'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x941f('0x4'));router['get']('/',auth[_0x941f('0x5')](),controller[_0x941f('0x6')]);router['get'](_0x941f('0x7'),auth[_0x941f('0x5')](),controller[_0x941f('0x8')]);router[_0x941f('0x9')](_0x941f('0xa'),auth['isAuthenticated'](),controller[_0x941f('0xb')]);router['get'](_0x941f('0xc'),auth[_0x941f('0x5')](),controller[_0x941f('0xd')]);router['get'](_0x941f('0xe'),auth[_0x941f('0x5')](),controller[_0x941f('0xf')]);router['post']('/',auth[_0x941f('0x5')](),controller[_0x941f('0x10')]);router['put'](_0x941f('0x7'),auth['isAuthenticated'](),controller[_0x941f('0x11')]);router[_0x941f('0x12')](_0x941f('0x7'),auth[_0x941f('0x5')](),controller[_0x941f('0x13')]);module[_0x941f('0x14')]=router; \ No newline at end of file +var _0xf3cb=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','getSubjects','/:id/descriptions','post','create','put','update','destroy','exports','multer'];(function(_0x424900,_0x5565b8){var _0x32968d=function(_0x1255c9){while(--_0x1255c9){_0x424900['push'](_0x424900['shift']());}};_0x32968d(++_0x5565b8);}(_0xf3cb,0xe0));var _0xbf3c=function(_0x485920,_0x1e4094){_0x485920=_0x485920-0x0;var _0x432773=_0xf3cb[_0x485920];return _0x432773;};'use strict';var multer=require(_0xbf3c('0x0'));var util=require(_0xbf3c('0x1'));var path=require(_0xbf3c('0x2'));var timeout=require(_0xbf3c('0x3'));var express=require(_0xbf3c('0x4'));var router=express[_0xbf3c('0x5')]();var fs_extra=require(_0xbf3c('0x6'));var auth=require(_0xbf3c('0x7'));var interaction=require(_0xbf3c('0x8'));var config=require(_0xbf3c('0x9'));var controller=require('./intZohoConfiguration.controller');router[_0xbf3c('0xa')]('/',auth[_0xbf3c('0xb')](),controller[_0xbf3c('0xc')]);router['get'](_0xbf3c('0xd'),auth['isAuthenticated'](),controller[_0xbf3c('0xe')]);router['get'](_0xbf3c('0xf'),auth[_0xbf3c('0xb')](),controller[_0xbf3c('0x10')]);router[_0xbf3c('0xa')]('/:id/subjects',auth[_0xbf3c('0xb')](),controller[_0xbf3c('0x11')]);router[_0xbf3c('0xa')](_0xbf3c('0x12'),auth[_0xbf3c('0xb')](),controller['getDescriptions']);router[_0xbf3c('0x13')]('/',auth[_0xbf3c('0xb')](),controller[_0xbf3c('0x14')]);router[_0xbf3c('0x15')](_0xbf3c('0xd'),auth[_0xbf3c('0xb')](),controller[_0xbf3c('0x16')]);router['delete'](_0xbf3c('0xd'),auth['isAuthenticated'](),controller[_0xbf3c('0x17')]);module[_0xbf3c('0x18')]=router; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js b/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js index 893d4be..6db1d7e 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 _0xa9bb=['contact','nothing','contact_lead','exports','STRING','ENUM','lead'];(function(_0x2fa92d,_0x4707fb){var _0x5d83f5=function(_0x467fc2){while(--_0x467fc2){_0x2fa92d['push'](_0x2fa92d['shift']());}};_0x5d83f5(++_0x4707fb);}(_0xa9bb,0x1bc));var _0xba9b=function(_0x20a558,_0x160e0e){_0x20a558=_0x20a558-0x0;var _0x53d3f7=_0xa9bb[_0x20a558];return _0x53d3f7;};'use strict';var Sequelize=require('sequelize');module[_0xba9b('0x0')]={'name':{'type':Sequelize[_0xba9b('0x1')]},'moduleCreate':{'type':Sequelize[_0xba9b('0x2')](_0xba9b('0x3'),_0xba9b('0x4'),_0xba9b('0x5')),'defaultValue':'lead'},'moduleSearch':{'type':Sequelize[_0xba9b('0x2')](_0xba9b('0x6'),_0xba9b('0x4'),_0xba9b('0x3')),'defaultValue':_0xba9b('0x6')},'description':{'type':Sequelize[_0xba9b('0x1')]}}; \ No newline at end of file +var _0xed08=['ENUM','lead','contact','nothing','contact_lead','exports','STRING'];(function(_0x4ec382,_0x204f09){var _0x5d96ab=function(_0x3f7a5f){while(--_0x3f7a5f){_0x4ec382['push'](_0x4ec382['shift']());}};_0x5d96ab(++_0x204f09);}(_0xed08,0x67));var _0x8ed0=function(_0x373288,_0x43a647){_0x373288=_0x373288-0x0;var _0x4db270=_0xed08[_0x373288];return _0x4db270;};'use strict';var Sequelize=require('sequelize');module[_0x8ed0('0x0')]={'name':{'type':Sequelize[_0x8ed0('0x1')]},'moduleCreate':{'type':Sequelize[_0x8ed0('0x2')](_0x8ed0('0x3'),_0x8ed0('0x4'),_0x8ed0('0x5')),'defaultValue':_0x8ed0('0x3')},'moduleSearch':{'type':Sequelize[_0x8ed0('0x2')](_0x8ed0('0x6'),_0x8ed0('0x4'),_0x8ed0('0x3')),'defaultValue':_0x8ed0('0x6')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.controller.js b/server/api/intZohoConfiguration/intZohoConfiguration.controller.js index 7a956bd..7f51b2b 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 _0x3559=['includeAll','include','findAll','rows','catch','show','params','find','create','update','body','getFields','findOne','sort','options','ZohoField','pick','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','destroy','then','error','stack','send','index','ZohoConfiguration','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','where','filter','merge','name'];(function(_0x411437,_0x349e51){var _0x39057e=function(_0x449c9f){while(--_0x449c9f){_0x411437['push'](_0x411437['shift']());}};_0x39057e(++_0x349e51);}(_0x3559,0xbb));var _0x9355=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x3559[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require(_0x9355('0x0'));var rimraf=require(_0x9355('0x1'));var zipdir=require(_0x9355('0x2'));var jsonpatch=require(_0x9355('0x3'));var rp=require(_0x9355('0x4'));var moment=require(_0x9355('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x9355('0x6'));var util=require(_0x9355('0x7'));var path=require(_0x9355('0x8'));var sox=require(_0x9355('0x9'));var csv=require(_0x9355('0xa'));var ejs=require(_0x9355('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x9355('0xc'));var squel=require(_0x9355('0xd'));var crypto=require(_0x9355('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x9355('0xf'));var toCsv=require(_0x9355('0xa'));var querystring=require(_0x9355('0x10'));var Papa=require(_0x9355('0x11'));var Redis=require('ioredis');var authService=require(_0x9355('0x12'));var qs=require(_0x9355('0x13'));var as=require(_0x9355('0x14'));var hardwareService=require(_0x9355('0x15'));var logger=require('../../config/logger')(_0x9355('0x16'));var utils=require('../../config/utils');var config=require(_0x9355('0x17'));var licenseUtil=require(_0x9355('0x18'));var db=require(_0x9355('0x19'))['db'];function respondWithStatusCode(_0x153ed8,_0x1339a0){_0x1339a0=_0x1339a0||0xcc;return function(_0x4b516c){if(_0x4b516c){return _0x153ed8[_0x9355('0x1a')](_0x1339a0);}return _0x153ed8[_0x9355('0x1b')](_0x1339a0)[_0x9355('0x1c')]();};}function respondWithResult(_0x1dcf1f,_0x54ea4e){_0x54ea4e=_0x54ea4e||0xc8;return function(_0x509e07){if(_0x509e07){return _0x1dcf1f[_0x9355('0x1b')](_0x54ea4e)[_0x9355('0x1d')](_0x509e07);}};}function respondWithFilteredResult(_0x41ea53,_0x35421c){return function(_0x7ddd1e){if(_0x7ddd1e){var _0x28f3a8=typeof _0x35421c[_0x9355('0x1e')]===_0x9355('0x1f')&&typeof _0x35421c[_0x9355('0x20')]===_0x9355('0x1f');var _0x171a82=_0x7ddd1e['count'];var _0xb6004e=_0x28f3a8?0x0:_0x35421c[_0x9355('0x1e')];var _0x5aad22=_0x28f3a8?_0x7ddd1e[_0x9355('0x21')]:_0x35421c[_0x9355('0x1e')]+_0x35421c[_0x9355('0x20')];var _0x309d28;if(_0x5aad22>=_0x171a82){_0x5aad22=_0x171a82;_0x309d28=0xc8;}else{_0x309d28=0xce;}_0x41ea53[_0x9355('0x1b')](_0x309d28);return _0x41ea53[_0x9355('0x22')](_0x9355('0x23'),_0xb6004e+'-'+_0x5aad22+'/'+_0x171a82)[_0x9355('0x1d')](_0x7ddd1e);}return null;};}function patchUpdates(_0x3f2220){return function(_0x4ef23e){try{jsonpatch['apply'](_0x4ef23e,_0x3f2220,!![]);}catch(_0x537246){return BPromise[_0x9355('0x24')](_0x537246);}return _0x4ef23e[_0x9355('0x25')]();};}function saveUpdates(_0x59fcf0,_0x204aa9){return function(_0x513c9c){if(_0x513c9c){return _0x513c9c['update'](_0x59fcf0)['then'](function(_0x1cf484){return _0x1cf484;});}return null;};}function removeEntity(_0x1bdd8d,_0x209100){return function(_0x3baee7){if(_0x3baee7){return _0x3baee7[_0x9355('0x26')]()[_0x9355('0x27')](function(){_0x1bdd8d['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x25658f,_0x3a3262){return function(_0x5e2c72){if(!_0x5e2c72){_0x25658f[_0x9355('0x1a')](0x194);}return _0x5e2c72;};}function handleError(_0x39ed15,_0x39d556){_0x39d556=_0x39d556||0x1f4;return function(_0x2da186){logger[_0x9355('0x28')](_0x2da186[_0x9355('0x29')]);if(_0x2da186['name']){delete _0x2da186['name'];}_0x39ed15[_0x9355('0x1b')](_0x39d556)[_0x9355('0x2a')](_0x2da186);};}exports[_0x9355('0x2b')]=function(_0x1fb3dc,_0x5dd803){var _0x5c86a3={},_0x4836db={},_0x15e36a={'count':0x0,'rows':[]};var _0x4e6e60=_['map'](db[_0x9355('0x2c')][_0x9355('0x2d')],function(_0x50acd0){return{'name':_0x50acd0[_0x9355('0x2e')],'type':_0x50acd0[_0x9355('0x2f')][_0x9355('0x30')]};});_0x4836db[_0x9355('0x31')]=_[_0x9355('0x32')](_0x4e6e60,'name');_0x4836db[_0x9355('0x33')]=_[_0x9355('0x34')](_0x1fb3dc[_0x9355('0x33')]);_0x4836db[_0x9355('0x35')]=_[_0x9355('0x36')](_0x4836db['model'],_0x4836db[_0x9355('0x33')]);_0x5c86a3['attributes']=_[_0x9355('0x36')](_0x4836db[_0x9355('0x31')],qs['fields'](_0x1fb3dc['query'][_0x9355('0x37')]));_0x5c86a3[_0x9355('0x38')]=_0x5c86a3['attributes'][_0x9355('0x39')]?_0x5c86a3[_0x9355('0x38')]:_0x4836db[_0x9355('0x31')];if(!_0x1fb3dc[_0x9355('0x33')][_0x9355('0x3a')](_0x9355('0x3b'))){_0x5c86a3[_0x9355('0x20')]=qs[_0x9355('0x20')](_0x1fb3dc[_0x9355('0x33')]['limit']);_0x5c86a3[_0x9355('0x1e')]=qs[_0x9355('0x1e')](_0x1fb3dc[_0x9355('0x33')][_0x9355('0x1e')]);}_0x5c86a3[_0x9355('0x3c')]=qs['sort'](_0x1fb3dc[_0x9355('0x33')]['sort']);_0x5c86a3[_0x9355('0x3d')]=qs['filters'](_['pick'](_0x1fb3dc[_0x9355('0x33')],_0x4836db[_0x9355('0x35')]),_0x4e6e60);if(_0x1fb3dc['query'][_0x9355('0x3e')]){_0x5c86a3[_0x9355('0x3d')]=_[_0x9355('0x3f')](_0x5c86a3[_0x9355('0x3d')],{'$or':_['map'](_0x4e6e60,function(_0x1a02a8){if(_0x1a02a8['type']!=='VIRTUAL'){var _0x228855={};_0x228855[_0x1a02a8[_0x9355('0x40')]]={'$like':'%'+_0x1fb3dc[_0x9355('0x33')]['filter']+'%'};return _0x228855;}})});}_0x5c86a3=_[_0x9355('0x3f')]({},_0x5c86a3,_0x1fb3dc['options']);var _0x128f9a={'where':_0x5c86a3[_0x9355('0x3d')]};return db[_0x9355('0x2c')][_0x9355('0x21')](_0x128f9a)[_0x9355('0x27')](function(_0x1b98e6){_0x15e36a[_0x9355('0x21')]=_0x1b98e6;if(_0x1fb3dc[_0x9355('0x33')][_0x9355('0x41')]){_0x5c86a3[_0x9355('0x42')]=[{'all':!![]}];}return db[_0x9355('0x2c')][_0x9355('0x43')](_0x5c86a3);})[_0x9355('0x27')](function(_0x26dc38){_0x15e36a[_0x9355('0x44')]=_0x26dc38;return _0x15e36a;})[_0x9355('0x27')](respondWithFilteredResult(_0x5dd803,_0x5c86a3))[_0x9355('0x45')](handleError(_0x5dd803,null));};exports[_0x9355('0x46')]=function(_0x2f388a,_0x4aa0eb){var _0x53fad2={'raw':![],'where':{'id':_0x2f388a[_0x9355('0x47')]['id']}},_0x3a5da1={};_0x3a5da1[_0x9355('0x31')]=_[_0x9355('0x34')](db[_0x9355('0x2c')]['rawAttributes']);_0x3a5da1[_0x9355('0x33')]=_[_0x9355('0x34')](_0x2f388a[_0x9355('0x33')]);_0x3a5da1[_0x9355('0x35')]=_['intersection'](_0x3a5da1[_0x9355('0x31')],_0x3a5da1[_0x9355('0x33')]);_0x53fad2[_0x9355('0x38')]=_[_0x9355('0x36')](_0x3a5da1[_0x9355('0x31')],qs[_0x9355('0x37')](_0x2f388a[_0x9355('0x33')][_0x9355('0x37')]));_0x53fad2[_0x9355('0x38')]=_0x53fad2[_0x9355('0x38')][_0x9355('0x39')]?_0x53fad2[_0x9355('0x38')]:_0x3a5da1[_0x9355('0x31')];if(_0x2f388a['query'][_0x9355('0x41')]){_0x53fad2[_0x9355('0x42')]=[{'all':!![]}];}_0x53fad2=_[_0x9355('0x3f')]({},_0x53fad2,_0x2f388a['options']);return db[_0x9355('0x2c')][_0x9355('0x48')](_0x53fad2)['then'](handleEntityNotFound(_0x4aa0eb,null))[_0x9355('0x27')](respondWithResult(_0x4aa0eb,null))[_0x9355('0x45')](handleError(_0x4aa0eb,null));};exports[_0x9355('0x49')]=function(_0x11b0ac,_0x237b4d){return db['ZohoConfiguration'][_0x9355('0x49')](_0x11b0ac['body'],{})[_0x9355('0x27')](respondWithResult(_0x237b4d,0xc9))[_0x9355('0x45')](handleError(_0x237b4d,null));};exports[_0x9355('0x4a')]=function(_0xb5f0b,_0x2a6198){if(_0xb5f0b[_0x9355('0x4b')]['id']){delete _0xb5f0b['body']['id'];}return db['ZohoConfiguration'][_0x9355('0x48')]({'where':{'id':_0xb5f0b[_0x9355('0x47')]['id']}})['then'](handleEntityNotFound(_0x2a6198,null))['then'](saveUpdates(_0xb5f0b[_0x9355('0x4b')],null))[_0x9355('0x27')](respondWithResult(_0x2a6198,null))[_0x9355('0x45')](handleError(_0x2a6198,null));};exports[_0x9355('0x26')]=function(_0x246432,_0x1e0bd9){return db[_0x9355('0x2c')]['find']({'where':{'id':_0x246432[_0x9355('0x47')]['id']}})[_0x9355('0x27')](handleEntityNotFound(_0x1e0bd9,null))[_0x9355('0x27')](removeEntity(_0x1e0bd9,null))[_0x9355('0x45')](handleError(_0x1e0bd9,null));};exports[_0x9355('0x4c')]=function(_0x43c34d,_0x4773fe,_0x25958c){var _0x156821={};var _0x413917={};var _0x1622a4;var _0x3eccf0;return db[_0x9355('0x2c')][_0x9355('0x4d')]({'where':{'id':_0x43c34d['params']['id']}})[_0x9355('0x27')](handleEntityNotFound(_0x4773fe,null))[_0x9355('0x27')](function(_0xe838ed){if(_0xe838ed){_0x1622a4=_0xe838ed;_0x413917[_0x9355('0x31')]=_['keys'](db['ZohoField']['rawAttributes']);_0x413917[_0x9355('0x33')]=_[_0x9355('0x34')](_0x43c34d['query']);_0x413917[_0x9355('0x35')]=_['intersection'](_0x413917[_0x9355('0x31')],_0x413917[_0x9355('0x33')]);_0x156821[_0x9355('0x38')]=_['intersection'](_0x413917[_0x9355('0x31')],qs[_0x9355('0x37')](_0x43c34d[_0x9355('0x33')][_0x9355('0x37')]));_0x156821[_0x9355('0x38')]=_0x156821[_0x9355('0x38')]['length']?_0x156821[_0x9355('0x38')]:_0x413917[_0x9355('0x31')];_0x156821[_0x9355('0x3c')]=qs['sort'](_0x43c34d[_0x9355('0x33')][_0x9355('0x4e')]);_0x156821['where']=qs[_0x9355('0x35')](_['pick'](_0x43c34d[_0x9355('0x33')],_0x413917['filters']));if(_0x43c34d[_0x9355('0x33')][_0x9355('0x3e')]){_0x156821[_0x9355('0x3d')]=_[_0x9355('0x3f')](_0x156821['where'],{'$or':_[_0x9355('0x32')](_0x156821['attributes'],function(_0x232adc){var _0x25d44a={};_0x25d44a[_0x232adc]={'$like':'%'+_0x43c34d[_0x9355('0x33')]['filter']+'%'};return _0x25d44a;})});}_0x156821=_[_0x9355('0x3f')]({},_0x156821,_0x43c34d[_0x9355('0x4f')]);return _0x1622a4[_0x9355('0x4c')](_0x156821);}})[_0x9355('0x27')](function(_0x5ab3ae){if(_0x5ab3ae){_0x3eccf0=_0x5ab3ae[_0x9355('0x39')];if(!_0x43c34d[_0x9355('0x33')][_0x9355('0x3a')]('nolimit')){_0x156821[_0x9355('0x20')]=qs[_0x9355('0x20')](_0x43c34d['query'][_0x9355('0x20')]);_0x156821[_0x9355('0x1e')]=qs[_0x9355('0x1e')](_0x43c34d[_0x9355('0x33')][_0x9355('0x1e')]);}return _0x1622a4[_0x9355('0x4c')](_0x156821);}})[_0x9355('0x27')](function(_0x4c5bfd){if(_0x4c5bfd){return _0x4c5bfd?{'count':_0x3eccf0,'rows':_0x4c5bfd}:null;}})[_0x9355('0x27')](respondWithResult(_0x4773fe,null))[_0x9355('0x45')](handleError(_0x4773fe,null));};exports['getSubjects']=function(_0x27cb22,_0xf429e1,_0x3ab237){var _0x174298={};var _0x167788={};var _0x298725;var _0x204a67;return db[_0x9355('0x2c')][_0x9355('0x4d')]({'where':{'id':_0x27cb22[_0x9355('0x47')]['id']}})[_0x9355('0x27')](handleEntityNotFound(_0xf429e1,null))['then'](function(_0xab07af){if(_0xab07af){_0x298725=_0xab07af;_0x167788[_0x9355('0x31')]=_[_0x9355('0x34')](db[_0x9355('0x50')][_0x9355('0x2d')]);_0x167788[_0x9355('0x33')]=_[_0x9355('0x34')](_0x27cb22[_0x9355('0x33')]);_0x167788['filters']=_[_0x9355('0x36')](_0x167788[_0x9355('0x31')],_0x167788[_0x9355('0x33')]);_0x174298[_0x9355('0x38')]=_[_0x9355('0x36')](_0x167788['model'],qs['fields'](_0x27cb22[_0x9355('0x33')][_0x9355('0x37')]));_0x174298[_0x9355('0x38')]=_0x174298[_0x9355('0x38')]['length']?_0x174298[_0x9355('0x38')]:_0x167788[_0x9355('0x31')];_0x174298['order']=qs[_0x9355('0x4e')](_0x27cb22[_0x9355('0x33')][_0x9355('0x4e')]);_0x174298[_0x9355('0x3d')]=qs[_0x9355('0x35')](_[_0x9355('0x51')](_0x27cb22[_0x9355('0x33')],_0x167788[_0x9355('0x35')]));if(_0x27cb22[_0x9355('0x33')]['filter']){_0x174298['where']=_[_0x9355('0x3f')](_0x174298[_0x9355('0x3d')],{'$or':_[_0x9355('0x32')](_0x174298[_0x9355('0x38')],function(_0x4e739a){var _0x439f1c={};_0x439f1c[_0x4e739a]={'$like':'%'+_0x27cb22[_0x9355('0x33')][_0x9355('0x3e')]+'%'};return _0x439f1c;})});}_0x174298=_[_0x9355('0x3f')]({},_0x174298,_0x27cb22[_0x9355('0x4f')]);return _0x298725[_0x9355('0x52')](_0x174298);}})[_0x9355('0x27')](function(_0x479779){if(_0x479779){_0x204a67=_0x479779[_0x9355('0x39')];if(!_0x27cb22['query'][_0x9355('0x3a')](_0x9355('0x3b'))){_0x174298[_0x9355('0x20')]=qs[_0x9355('0x20')](_0x27cb22[_0x9355('0x33')][_0x9355('0x20')]);_0x174298[_0x9355('0x1e')]=qs[_0x9355('0x1e')](_0x27cb22['query']['offset']);}return _0x298725[_0x9355('0x52')](_0x174298);}})[_0x9355('0x27')](function(_0x18afce){if(_0x18afce){return _0x18afce?{'count':_0x204a67,'rows':_0x18afce}:null;}})[_0x9355('0x27')](respondWithResult(_0xf429e1,null))[_0x9355('0x45')](handleError(_0xf429e1,null));};exports[_0x9355('0x53')]=function(_0x17a33b,_0x1a1bd2,_0x46dab2){var _0x544e0b={};var _0x3137d9={};var _0x380001;var _0x29f9ad;return db[_0x9355('0x2c')][_0x9355('0x4d')]({'where':{'id':_0x17a33b['params']['id']}})['then'](handleEntityNotFound(_0x1a1bd2,null))['then'](function(_0x34f453){if(_0x34f453){_0x380001=_0x34f453;_0x3137d9[_0x9355('0x31')]=_[_0x9355('0x34')](db[_0x9355('0x50')][_0x9355('0x2d')]);_0x3137d9['query']=_[_0x9355('0x34')](_0x17a33b[_0x9355('0x33')]);_0x3137d9[_0x9355('0x35')]=_[_0x9355('0x36')](_0x3137d9[_0x9355('0x31')],_0x3137d9['query']);_0x544e0b[_0x9355('0x38')]=_[_0x9355('0x36')](_0x3137d9[_0x9355('0x31')],qs[_0x9355('0x37')](_0x17a33b[_0x9355('0x33')]['fields']));_0x544e0b[_0x9355('0x38')]=_0x544e0b['attributes'][_0x9355('0x39')]?_0x544e0b['attributes']:_0x3137d9[_0x9355('0x31')];_0x544e0b[_0x9355('0x3c')]=qs[_0x9355('0x4e')](_0x17a33b[_0x9355('0x33')][_0x9355('0x4e')]);_0x544e0b['where']=qs['filters'](_[_0x9355('0x51')](_0x17a33b[_0x9355('0x33')],_0x3137d9['filters']));if(_0x17a33b['query'][_0x9355('0x3e')]){_0x544e0b[_0x9355('0x3d')]=_[_0x9355('0x3f')](_0x544e0b[_0x9355('0x3d')],{'$or':_[_0x9355('0x32')](_0x544e0b['attributes'],function(_0x24746d){var _0x3d678d={};_0x3d678d[_0x24746d]={'$like':'%'+_0x17a33b[_0x9355('0x33')][_0x9355('0x3e')]+'%'};return _0x3d678d;})});}_0x544e0b=_['merge']({},_0x544e0b,_0x17a33b[_0x9355('0x4f')]);return _0x380001[_0x9355('0x53')](_0x544e0b);}})[_0x9355('0x27')](function(_0x2cc145){if(_0x2cc145){_0x29f9ad=_0x2cc145['length'];if(!_0x17a33b[_0x9355('0x33')][_0x9355('0x3a')](_0x9355('0x3b'))){_0x544e0b[_0x9355('0x20')]=qs[_0x9355('0x20')](_0x17a33b[_0x9355('0x33')][_0x9355('0x20')]);_0x544e0b[_0x9355('0x1e')]=qs['offset'](_0x17a33b[_0x9355('0x33')][_0x9355('0x1e')]);}return _0x380001[_0x9355('0x53')](_0x544e0b);}})[_0x9355('0x27')](function(_0x2d3287){if(_0x2d3287){return _0x2d3287?{'count':_0x29f9ad,'rows':_0x2d3287}:null;}})[_0x9355('0x27')](respondWithResult(_0x1a1bd2,null))[_0x9355('0x45')](handleError(_0x1a1bd2,null));}; \ No newline at end of file +var _0x9d15=['attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','include','findAll','rows','catch','show','includeAll','options','find','body','params','getFields','ZohoField','getSubjects','getDescriptions','findOne','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','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/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','ZohoConfiguration','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields'];(function(_0x544b3f,_0x4d8b66){var _0x15787f=function(_0x12467e){while(--_0x12467e){_0x544b3f['push'](_0x544b3f['shift']());}};_0x15787f(++_0x4d8b66);}(_0x9d15,0x1c8));var _0x59d1=function(_0x3ea361,_0x56d880){_0x3ea361=_0x3ea361-0x0;var _0x1a6434=_0x9d15[_0x3ea361];return _0x1a6434;};'use strict';var emlformat=require(_0x59d1('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x59d1('0x1'));var jsonpatch=require(_0x59d1('0x2'));var rp=require(_0x59d1('0x3'));var moment=require(_0x59d1('0x4'));var BPromise=require(_0x59d1('0x5'));var Mustache=require(_0x59d1('0x6'));var util=require(_0x59d1('0x7'));var path=require(_0x59d1('0x8'));var sox=require(_0x59d1('0x9'));var csv=require(_0x59d1('0xa'));var ejs=require(_0x59d1('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x59d1('0xc'));var squel=require(_0x59d1('0xd'));var crypto=require(_0x59d1('0xe'));var jsforce=require(_0x59d1('0xf'));var deskjs=require(_0x59d1('0x10'));var toCsv=require(_0x59d1('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x59d1('0x11'));var authService=require(_0x59d1('0x12'));var qs=require(_0x59d1('0x13'));var as=require(_0x59d1('0x14'));var hardwareService=require(_0x59d1('0x15'));var logger=require(_0x59d1('0x16'))(_0x59d1('0x17'));var utils=require(_0x59d1('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x59d1('0x19'));var db=require(_0x59d1('0x1a'))['db'];function respondWithStatusCode(_0x19e6d0,_0x3504cc){_0x3504cc=_0x3504cc||0xcc;return function(_0x2556df){if(_0x2556df){return _0x19e6d0[_0x59d1('0x1b')](_0x3504cc);}return _0x19e6d0[_0x59d1('0x1c')](_0x3504cc)[_0x59d1('0x1d')]();};}function respondWithResult(_0x3501a4,_0x36ba02){_0x36ba02=_0x36ba02||0xc8;return function(_0x255733){if(_0x255733){return _0x3501a4[_0x59d1('0x1c')](_0x36ba02)[_0x59d1('0x1e')](_0x255733);}};}function respondWithFilteredResult(_0x3868a6,_0x5a5439){return function(_0x48fd22){if(_0x48fd22){var _0x79d71a=typeof _0x5a5439[_0x59d1('0x1f')]==='undefined'&&typeof _0x5a5439[_0x59d1('0x20')]===_0x59d1('0x21');var _0x246c46=_0x48fd22['count'];var _0x452d79=_0x79d71a?0x0:_0x5a5439['offset'];var _0x1ce789=_0x79d71a?_0x48fd22[_0x59d1('0x22')]:_0x5a5439[_0x59d1('0x1f')]+_0x5a5439[_0x59d1('0x20')];var _0x1f1e6b;if(_0x1ce789>=_0x246c46){_0x1ce789=_0x246c46;_0x1f1e6b=0xc8;}else{_0x1f1e6b=0xce;}_0x3868a6[_0x59d1('0x1c')](_0x1f1e6b);return _0x3868a6[_0x59d1('0x23')](_0x59d1('0x24'),_0x452d79+'-'+_0x1ce789+'/'+_0x246c46)[_0x59d1('0x1e')](_0x48fd22);}return null;};}function patchUpdates(_0x548403){return function(_0x3c116c){try{jsonpatch[_0x59d1('0x25')](_0x3c116c,_0x548403,!![]);}catch(_0x42b851){return BPromise[_0x59d1('0x26')](_0x42b851);}return _0x3c116c[_0x59d1('0x27')]();};}function saveUpdates(_0x276a98,_0x214b05){return function(_0x27df3a){if(_0x27df3a){return _0x27df3a[_0x59d1('0x28')](_0x276a98)[_0x59d1('0x29')](function(_0x591866){return _0x591866;});}return null;};}function removeEntity(_0x5a587c,_0x3a400a){return function(_0x10836c){if(_0x10836c){return _0x10836c[_0x59d1('0x2a')]()[_0x59d1('0x29')](function(){_0x5a587c[_0x59d1('0x1c')](0xcc)[_0x59d1('0x1d')]();});}};}function handleEntityNotFound(_0x49ff9d,_0x1db2b3){return function(_0x3b43ff){if(!_0x3b43ff){_0x49ff9d['sendStatus'](0x194);}return _0x3b43ff;};}function handleError(_0x1226f1,_0x5051f4){_0x5051f4=_0x5051f4||0x1f4;return function(_0x410731){logger[_0x59d1('0x2b')](_0x410731[_0x59d1('0x2c')]);if(_0x410731[_0x59d1('0x2d')]){delete _0x410731['name'];}_0x1226f1[_0x59d1('0x1c')](_0x5051f4)[_0x59d1('0x2e')](_0x410731);};}exports[_0x59d1('0x2f')]=function(_0x61603f,_0x4f029b){var _0x5d9fdb={},_0x556586={},_0x513c68={'count':0x0,'rows':[]};var _0x469d66=_[_0x59d1('0x30')](db[_0x59d1('0x31')][_0x59d1('0x32')],function(_0x55f1a8){return{'name':_0x55f1a8[_0x59d1('0x33')],'type':_0x55f1a8[_0x59d1('0x34')][_0x59d1('0x35')]};});_0x556586[_0x59d1('0x36')]=_[_0x59d1('0x30')](_0x469d66,_0x59d1('0x2d'));_0x556586[_0x59d1('0x37')]=_[_0x59d1('0x38')](_0x61603f[_0x59d1('0x37')]);_0x556586[_0x59d1('0x39')]=_[_0x59d1('0x3a')](_0x556586[_0x59d1('0x36')],_0x556586[_0x59d1('0x37')]);_0x5d9fdb['attributes']=_[_0x59d1('0x3a')](_0x556586['model'],qs[_0x59d1('0x3b')](_0x61603f[_0x59d1('0x37')][_0x59d1('0x3b')]));_0x5d9fdb[_0x59d1('0x3c')]=_0x5d9fdb[_0x59d1('0x3c')][_0x59d1('0x3d')]?_0x5d9fdb['attributes']:_0x556586[_0x59d1('0x36')];if(!_0x61603f[_0x59d1('0x37')][_0x59d1('0x3e')](_0x59d1('0x3f'))){_0x5d9fdb[_0x59d1('0x20')]=qs[_0x59d1('0x20')](_0x61603f[_0x59d1('0x37')]['limit']);_0x5d9fdb[_0x59d1('0x1f')]=qs[_0x59d1('0x1f')](_0x61603f[_0x59d1('0x37')][_0x59d1('0x1f')]);}_0x5d9fdb[_0x59d1('0x40')]=qs['sort'](_0x61603f[_0x59d1('0x37')][_0x59d1('0x41')]);_0x5d9fdb['where']=qs['filters'](_[_0x59d1('0x42')](_0x61603f[_0x59d1('0x37')],_0x556586['filters']),_0x469d66);if(_0x61603f[_0x59d1('0x37')][_0x59d1('0x43')]){_0x5d9fdb[_0x59d1('0x44')]=_[_0x59d1('0x45')](_0x5d9fdb[_0x59d1('0x44')],{'$or':_[_0x59d1('0x30')](_0x469d66,function(_0x58df9f){if(_0x58df9f['type']!==_0x59d1('0x46')){var _0x14ec89={};_0x14ec89[_0x58df9f['name']]={'$like':'%'+_0x61603f[_0x59d1('0x37')][_0x59d1('0x43')]+'%'};return _0x14ec89;}})});}_0x5d9fdb=_['merge']({},_0x5d9fdb,_0x61603f['options']);var _0x4b759d={'where':_0x5d9fdb[_0x59d1('0x44')]};return db[_0x59d1('0x31')][_0x59d1('0x22')](_0x4b759d)[_0x59d1('0x29')](function(_0x2fc6d8){_0x513c68['count']=_0x2fc6d8;if(_0x61603f[_0x59d1('0x37')]['includeAll']){_0x5d9fdb[_0x59d1('0x47')]=[{'all':!![]}];}return db[_0x59d1('0x31')][_0x59d1('0x48')](_0x5d9fdb);})['then'](function(_0x5cc6ca){_0x513c68[_0x59d1('0x49')]=_0x5cc6ca;return _0x513c68;})[_0x59d1('0x29')](respondWithFilteredResult(_0x4f029b,_0x5d9fdb))[_0x59d1('0x4a')](handleError(_0x4f029b,null));};exports[_0x59d1('0x4b')]=function(_0x26c3c4,_0x5c5e10){var _0x516d57={'raw':![],'where':{'id':_0x26c3c4['params']['id']}},_0xafd751={};_0xafd751['model']=_[_0x59d1('0x38')](db['ZohoConfiguration'][_0x59d1('0x32')]);_0xafd751[_0x59d1('0x37')]=_['keys'](_0x26c3c4[_0x59d1('0x37')]);_0xafd751[_0x59d1('0x39')]=_['intersection'](_0xafd751['model'],_0xafd751['query']);_0x516d57['attributes']=_[_0x59d1('0x3a')](_0xafd751[_0x59d1('0x36')],qs[_0x59d1('0x3b')](_0x26c3c4[_0x59d1('0x37')][_0x59d1('0x3b')]));_0x516d57['attributes']=_0x516d57[_0x59d1('0x3c')][_0x59d1('0x3d')]?_0x516d57[_0x59d1('0x3c')]:_0xafd751['model'];if(_0x26c3c4[_0x59d1('0x37')][_0x59d1('0x4c')]){_0x516d57[_0x59d1('0x47')]=[{'all':!![]}];}_0x516d57=_[_0x59d1('0x45')]({},_0x516d57,_0x26c3c4[_0x59d1('0x4d')]);return db[_0x59d1('0x31')][_0x59d1('0x4e')](_0x516d57)[_0x59d1('0x29')](handleEntityNotFound(_0x5c5e10,null))['then'](respondWithResult(_0x5c5e10,null))[_0x59d1('0x4a')](handleError(_0x5c5e10,null));};exports['create']=function(_0x17d8e2,_0x3d61de){return db[_0x59d1('0x31')]['create'](_0x17d8e2[_0x59d1('0x4f')],{})[_0x59d1('0x29')](respondWithResult(_0x3d61de,0xc9))[_0x59d1('0x4a')](handleError(_0x3d61de,null));};exports[_0x59d1('0x28')]=function(_0x5bda7e,_0x5c36ba){if(_0x5bda7e[_0x59d1('0x4f')]['id']){delete _0x5bda7e[_0x59d1('0x4f')]['id'];}return db[_0x59d1('0x31')][_0x59d1('0x4e')]({'where':{'id':_0x5bda7e[_0x59d1('0x50')]['id']}})[_0x59d1('0x29')](handleEntityNotFound(_0x5c36ba,null))['then'](saveUpdates(_0x5bda7e[_0x59d1('0x4f')],null))[_0x59d1('0x29')](respondWithResult(_0x5c36ba,null))[_0x59d1('0x4a')](handleError(_0x5c36ba,null));};exports[_0x59d1('0x2a')]=function(_0x3b6310,_0x481c45){return db[_0x59d1('0x31')]['find']({'where':{'id':_0x3b6310['params']['id']}})['then'](handleEntityNotFound(_0x481c45,null))[_0x59d1('0x29')](removeEntity(_0x481c45,null))[_0x59d1('0x4a')](handleError(_0x481c45,null));};exports[_0x59d1('0x51')]=function(_0x1d6bfd,_0x2168ef,_0x39b3a8){var _0x4fcf0d={};var _0x10f55b={};var _0xc8b2f2;var _0x4bd75d;return db[_0x59d1('0x31')]['findOne']({'where':{'id':_0x1d6bfd[_0x59d1('0x50')]['id']}})[_0x59d1('0x29')](handleEntityNotFound(_0x2168ef,null))[_0x59d1('0x29')](function(_0x591948){if(_0x591948){_0xc8b2f2=_0x591948;_0x10f55b[_0x59d1('0x36')]=_['keys'](db[_0x59d1('0x52')][_0x59d1('0x32')]);_0x10f55b['query']=_[_0x59d1('0x38')](_0x1d6bfd['query']);_0x10f55b[_0x59d1('0x39')]=_[_0x59d1('0x3a')](_0x10f55b[_0x59d1('0x36')],_0x10f55b['query']);_0x4fcf0d[_0x59d1('0x3c')]=_['intersection'](_0x10f55b[_0x59d1('0x36')],qs[_0x59d1('0x3b')](_0x1d6bfd[_0x59d1('0x37')][_0x59d1('0x3b')]));_0x4fcf0d[_0x59d1('0x3c')]=_0x4fcf0d[_0x59d1('0x3c')][_0x59d1('0x3d')]?_0x4fcf0d['attributes']:_0x10f55b[_0x59d1('0x36')];_0x4fcf0d[_0x59d1('0x40')]=qs[_0x59d1('0x41')](_0x1d6bfd['query']['sort']);_0x4fcf0d[_0x59d1('0x44')]=qs[_0x59d1('0x39')](_[_0x59d1('0x42')](_0x1d6bfd[_0x59d1('0x37')],_0x10f55b[_0x59d1('0x39')]));if(_0x1d6bfd[_0x59d1('0x37')]['filter']){_0x4fcf0d[_0x59d1('0x44')]=_[_0x59d1('0x45')](_0x4fcf0d[_0x59d1('0x44')],{'$or':_[_0x59d1('0x30')](_0x4fcf0d[_0x59d1('0x3c')],function(_0x312567){var _0x2fe62d={};_0x2fe62d[_0x312567]={'$like':'%'+_0x1d6bfd[_0x59d1('0x37')][_0x59d1('0x43')]+'%'};return _0x2fe62d;})});}_0x4fcf0d=_[_0x59d1('0x45')]({},_0x4fcf0d,_0x1d6bfd[_0x59d1('0x4d')]);return _0xc8b2f2[_0x59d1('0x51')](_0x4fcf0d);}})[_0x59d1('0x29')](function(_0x2ad9ad){if(_0x2ad9ad){_0x4bd75d=_0x2ad9ad[_0x59d1('0x3d')];if(!_0x1d6bfd['query'][_0x59d1('0x3e')](_0x59d1('0x3f'))){_0x4fcf0d[_0x59d1('0x20')]=qs[_0x59d1('0x20')](_0x1d6bfd[_0x59d1('0x37')]['limit']);_0x4fcf0d[_0x59d1('0x1f')]=qs[_0x59d1('0x1f')](_0x1d6bfd[_0x59d1('0x37')][_0x59d1('0x1f')]);}return _0xc8b2f2[_0x59d1('0x51')](_0x4fcf0d);}})[_0x59d1('0x29')](function(_0x35e7dc){if(_0x35e7dc){return _0x35e7dc?{'count':_0x4bd75d,'rows':_0x35e7dc}:null;}})[_0x59d1('0x29')](respondWithResult(_0x2168ef,null))['catch'](handleError(_0x2168ef,null));};exports[_0x59d1('0x53')]=function(_0x11c64c,_0x16f4f7,_0x11d376){var _0x47208f={};var _0x364001={};var _0x263e9a;var _0x1c330f;return db[_0x59d1('0x31')]['findOne']({'where':{'id':_0x11c64c['params']['id']}})[_0x59d1('0x29')](handleEntityNotFound(_0x16f4f7,null))[_0x59d1('0x29')](function(_0x3a4a3c){if(_0x3a4a3c){_0x263e9a=_0x3a4a3c;_0x364001['model']=_['keys'](db['ZohoField'][_0x59d1('0x32')]);_0x364001['query']=_[_0x59d1('0x38')](_0x11c64c['query']);_0x364001['filters']=_[_0x59d1('0x3a')](_0x364001[_0x59d1('0x36')],_0x364001['query']);_0x47208f['attributes']=_[_0x59d1('0x3a')](_0x364001[_0x59d1('0x36')],qs[_0x59d1('0x3b')](_0x11c64c['query'][_0x59d1('0x3b')]));_0x47208f[_0x59d1('0x3c')]=_0x47208f[_0x59d1('0x3c')][_0x59d1('0x3d')]?_0x47208f[_0x59d1('0x3c')]:_0x364001[_0x59d1('0x36')];_0x47208f[_0x59d1('0x40')]=qs['sort'](_0x11c64c[_0x59d1('0x37')][_0x59d1('0x41')]);_0x47208f['where']=qs[_0x59d1('0x39')](_[_0x59d1('0x42')](_0x11c64c[_0x59d1('0x37')],_0x364001[_0x59d1('0x39')]));if(_0x11c64c[_0x59d1('0x37')][_0x59d1('0x43')]){_0x47208f[_0x59d1('0x44')]=_['merge'](_0x47208f[_0x59d1('0x44')],{'$or':_[_0x59d1('0x30')](_0x47208f['attributes'],function(_0x40cd42){var _0x44c2b5={};_0x44c2b5[_0x40cd42]={'$like':'%'+_0x11c64c[_0x59d1('0x37')]['filter']+'%'};return _0x44c2b5;})});}_0x47208f=_[_0x59d1('0x45')]({},_0x47208f,_0x11c64c[_0x59d1('0x4d')]);return _0x263e9a[_0x59d1('0x53')](_0x47208f);}})[_0x59d1('0x29')](function(_0x2227c0){if(_0x2227c0){_0x1c330f=_0x2227c0[_0x59d1('0x3d')];if(!_0x11c64c[_0x59d1('0x37')]['hasOwnProperty'](_0x59d1('0x3f'))){_0x47208f[_0x59d1('0x20')]=qs[_0x59d1('0x20')](_0x11c64c[_0x59d1('0x37')][_0x59d1('0x20')]);_0x47208f[_0x59d1('0x1f')]=qs['offset'](_0x11c64c[_0x59d1('0x37')][_0x59d1('0x1f')]);}return _0x263e9a[_0x59d1('0x53')](_0x47208f);}})[_0x59d1('0x29')](function(_0x4a56a5){if(_0x4a56a5){return _0x4a56a5?{'count':_0x1c330f,'rows':_0x4a56a5}:null;}})[_0x59d1('0x29')](respondWithResult(_0x16f4f7,null))[_0x59d1('0x4a')](handleError(_0x16f4f7,null));};exports[_0x59d1('0x54')]=function(_0x55f4dd,_0x78adfa,_0x430475){var _0x35acc4={};var _0x17b73e={};var _0x345147;var _0x54d4db;return db[_0x59d1('0x31')][_0x59d1('0x55')]({'where':{'id':_0x55f4dd[_0x59d1('0x50')]['id']}})[_0x59d1('0x29')](handleEntityNotFound(_0x78adfa,null))['then'](function(_0xf467ed){if(_0xf467ed){_0x345147=_0xf467ed;_0x17b73e[_0x59d1('0x36')]=_[_0x59d1('0x38')](db['ZohoField']['rawAttributes']);_0x17b73e[_0x59d1('0x37')]=_[_0x59d1('0x38')](_0x55f4dd[_0x59d1('0x37')]);_0x17b73e[_0x59d1('0x39')]=_[_0x59d1('0x3a')](_0x17b73e[_0x59d1('0x36')],_0x17b73e['query']);_0x35acc4[_0x59d1('0x3c')]=_[_0x59d1('0x3a')](_0x17b73e[_0x59d1('0x36')],qs['fields'](_0x55f4dd[_0x59d1('0x37')][_0x59d1('0x3b')]));_0x35acc4[_0x59d1('0x3c')]=_0x35acc4[_0x59d1('0x3c')][_0x59d1('0x3d')]?_0x35acc4['attributes']:_0x17b73e[_0x59d1('0x36')];_0x35acc4['order']=qs[_0x59d1('0x41')](_0x55f4dd[_0x59d1('0x37')][_0x59d1('0x41')]);_0x35acc4[_0x59d1('0x44')]=qs[_0x59d1('0x39')](_[_0x59d1('0x42')](_0x55f4dd['query'],_0x17b73e[_0x59d1('0x39')]));if(_0x55f4dd[_0x59d1('0x37')][_0x59d1('0x43')]){_0x35acc4[_0x59d1('0x44')]=_[_0x59d1('0x45')](_0x35acc4[_0x59d1('0x44')],{'$or':_['map'](_0x35acc4['attributes'],function(_0x4d818a){var _0xd4df1d={};_0xd4df1d[_0x4d818a]={'$like':'%'+_0x55f4dd[_0x59d1('0x37')][_0x59d1('0x43')]+'%'};return _0xd4df1d;})});}_0x35acc4=_[_0x59d1('0x45')]({},_0x35acc4,_0x55f4dd[_0x59d1('0x4d')]);return _0x345147['getDescriptions'](_0x35acc4);}})[_0x59d1('0x29')](function(_0x31fdc1){if(_0x31fdc1){_0x54d4db=_0x31fdc1[_0x59d1('0x3d')];if(!_0x55f4dd[_0x59d1('0x37')][_0x59d1('0x3e')](_0x59d1('0x3f'))){_0x35acc4[_0x59d1('0x20')]=qs[_0x59d1('0x20')](_0x55f4dd['query'][_0x59d1('0x20')]);_0x35acc4['offset']=qs[_0x59d1('0x1f')](_0x55f4dd[_0x59d1('0x37')][_0x59d1('0x1f')]);}return _0x345147[_0x59d1('0x54')](_0x35acc4);}})[_0x59d1('0x29')](function(_0x36cd24){if(_0x36cd24){return _0x36cd24?{'count':_0x54d4db,'rows':_0x36cd24}:null;}})['then'](respondWithResult(_0x78adfa,null))[_0x59d1('0x4a')](handleError(_0x78adfa,null));}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.model.js b/server/api/intZohoConfiguration/intZohoConfiguration.model.js index 8b1be0d..5b58bbd 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 _0x36c0=['util','api','moment','bluebird','request-promise','path','../../config/environment','./intZohoConfiguration.attributes','define','ZohoConfiguration','int_zoho_configurations','lodash'];(function(_0x57c690,_0x45727b){var _0xc8fc78=function(_0x178b7a){while(--_0x178b7a){_0x57c690['push'](_0x57c690['shift']());}};_0xc8fc78(++_0x45727b);}(_0x36c0,0x15b));var _0x036c=function(_0x38ed4b,_0x16fac2){_0x38ed4b=_0x38ed4b-0x0;var _0x58bf18=_0x36c0[_0x38ed4b];return _0x58bf18;};'use strict';var _=require(_0x036c('0x0'));var util=require(_0x036c('0x1'));var logger=require('../../config/logger')(_0x036c('0x2'));var moment=require(_0x036c('0x3'));var BPromise=require(_0x036c('0x4'));var rp=require(_0x036c('0x5'));var fs=require('fs');var path=require(_0x036c('0x6'));var rimraf=require('rimraf');var config=require(_0x036c('0x7'));var attributes=require(_0x036c('0x8'));module['exports']=function(_0x36a72e,_0x1132f0){return _0x36a72e[_0x036c('0x9')](_0x036c('0xa'),attributes,{'tableName':_0x036c('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x10f0=['api','moment','bluebird','request-promise','path','../../config/environment','exports','define','ZohoConfiguration','int_zoho_configurations','lodash','util','../../config/logger'];(function(_0x3051d6,_0xf8c7ea){var _0x390fbb=function(_0x4ecfc5){while(--_0x4ecfc5){_0x3051d6['push'](_0x3051d6['shift']());}};_0x390fbb(++_0xf8c7ea);}(_0x10f0,0xb3));var _0x010f=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x10f0[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x010f('0x0'));var util=require(_0x010f('0x1'));var logger=require(_0x010f('0x2'))(_0x010f('0x3'));var moment=require(_0x010f('0x4'));var BPromise=require(_0x010f('0x5'));var rp=require(_0x010f('0x6'));var fs=require('fs');var path=require(_0x010f('0x7'));var rimraf=require('rimraf');var config=require(_0x010f('0x8'));var attributes=require('./intZohoConfiguration.attributes');module[_0x010f('0x9')]=function(_0x2300fa,_0x32af53){return _0x2300fa[_0x010f('0xa')](_0x010f('0xb'),attributes,{'tableName':_0x010f('0xc'),'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 c26e008..d65bc94 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 _0x9dd4=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','request','then','ZohoConfiguration,\x20%s,\x20%s','request\x20sent','ZohoConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','bluebird'];(function(_0x74cd77,_0x4d3200){var _0x11c917=function(_0x30c2ed){while(--_0x30c2ed){_0x74cd77['push'](_0x74cd77['shift']());}};_0x11c917(++_0x4d3200);}(_0x9dd4,0x1cc));var _0x49dd=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9dd4[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x49dd('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x49dd('0x1'));var rs=require(_0x49dd('0x2'));var fs=require('fs');var Redis=require(_0x49dd('0x3'));var db=require(_0x49dd('0x4'))['db'];var utils=require(_0x49dd('0x5'));var logger=require(_0x49dd('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x49dd('0x7'));var client=jayson[_0x49dd('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3b4932,_0x2dc463,_0x4c8243){return new BPromise(function(_0x3bc599,_0xdddfad){return client[_0x49dd('0x9')](_0x3b4932,_0x4c8243)[_0x49dd('0xa')](function(_0x5db0fa){logger['info'](_0x49dd('0xb'),_0x2dc463,_0x49dd('0xc'));logger['debug'](_0x49dd('0xd'),_0x2dc463,_0x49dd('0xc'),JSON[_0x49dd('0xe')](_0x5db0fa));if(_0x5db0fa[_0x49dd('0xf')]){if(_0x5db0fa['error'][_0x49dd('0x10')]===0x1f4){logger[_0x49dd('0xf')]('ZohoConfiguration,\x20%s,\x20%s',_0x2dc463,_0x5db0fa[_0x49dd('0xf')][_0x49dd('0x11')]);return _0xdddfad(_0x5db0fa[_0x49dd('0xf')][_0x49dd('0x11')]);}logger[_0x49dd('0xf')](_0x49dd('0xb'),_0x2dc463,_0x5db0fa[_0x49dd('0xf')][_0x49dd('0x11')]);return _0x3bc599(_0x5db0fa[_0x49dd('0xf')][_0x49dd('0x11')]);}else{logger[_0x49dd('0x12')](_0x49dd('0xb'),_0x2dc463,_0x49dd('0xc'));_0x3bc599(_0x5db0fa[_0x49dd('0x13')][_0x49dd('0x11')]);}})[_0x49dd('0x14')](function(_0x29c7fd){logger[_0x49dd('0xf')]('ZohoConfiguration,\x20%s,\x20%s',_0x2dc463,_0x29c7fd);_0xdddfad(_0x29c7fd);});});} \ No newline at end of file +var _0x53ae=['result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','ZohoConfiguration,\x20%s,\x20%s','request\x20sent','ZohoConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x473b2c,_0x5972b0){var _0x358a77=function(_0x2ecd7f){while(--_0x2ecd7f){_0x473b2c['push'](_0x473b2c['shift']());}};_0x358a77(++_0x5972b0);}(_0x53ae,0x16a));var _0xe53a=function(_0x4e2557,_0x29c041){_0x4e2557=_0x4e2557-0x0;var _0x10a4c5=_0x53ae[_0x4e2557];return _0x10a4c5;};'use strict';var _=require(_0xe53a('0x0'));var util=require(_0xe53a('0x1'));var moment=require(_0xe53a('0x2'));var BPromise=require(_0xe53a('0x3'));var rs=require(_0xe53a('0x4'));var fs=require('fs');var Redis=require(_0xe53a('0x5'));var db=require(_0xe53a('0x6'))['db'];var utils=require(_0xe53a('0x7'));var logger=require(_0xe53a('0x8'))(_0xe53a('0x9'));var config=require(_0xe53a('0xa'));var jayson=require(_0xe53a('0xb'));var client=jayson[_0xe53a('0xc')][_0xe53a('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x23ed13,_0x3980c1,_0x403200){return new BPromise(function(_0x3b7eee,_0x5b43f0){return client['request'](_0x23ed13,_0x403200)[_0xe53a('0xe')](function(_0x1eafe0){logger['info'](_0xe53a('0xf'),_0x3980c1,_0xe53a('0x10'));logger['debug'](_0xe53a('0x11'),_0x3980c1,_0xe53a('0x10'),JSON[_0xe53a('0x12')](_0x1eafe0));if(_0x1eafe0['error']){if(_0x1eafe0[_0xe53a('0x13')][_0xe53a('0x14')]===0x1f4){logger[_0xe53a('0x13')](_0xe53a('0xf'),_0x3980c1,_0x1eafe0[_0xe53a('0x13')][_0xe53a('0x15')]);return _0x5b43f0(_0x1eafe0[_0xe53a('0x13')][_0xe53a('0x15')]);}logger[_0xe53a('0x13')](_0xe53a('0xf'),_0x3980c1,_0x1eafe0[_0xe53a('0x13')][_0xe53a('0x15')]);return _0x3b7eee(_0x1eafe0[_0xe53a('0x13')][_0xe53a('0x15')]);}else{logger['info'](_0xe53a('0xf'),_0x3980c1,_0xe53a('0x10'));_0x3b7eee(_0x1eafe0[_0xe53a('0x16')][_0xe53a('0x15')]);}})[_0xe53a('0x17')](function(_0x52f727){logger[_0xe53a('0x13')](_0xe53a('0xf'),_0x3980c1,_0x52f727);_0x5b43f0(_0x52f727);});});} \ No newline at end of file diff --git a/server/api/intZohoField/index.js b/server/api/intZohoField/index.js index b90de49..a7a1f72 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 _0x25d3=['./intZohoField.controller','get','isAuthenticated','/:id','show','create','update','delete','destroy','exports','express','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x33628a,_0x2df134){var _0x25d370=function(_0x5567fc){while(--_0x5567fc){_0x33628a['push'](_0x33628a['shift']());}};_0x25d370(++_0x2df134);}(_0x25d3,0xc0));var _0x325d=function(_0x74a94f,_0x20cd62){_0x74a94f=_0x74a94f-0x0;var _0x50b9e4=_0x25d3[_0x74a94f];return _0x50b9e4;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x325d('0x0'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x325d('0x1'));var interaction=require(_0x325d('0x2'));var config=require(_0x325d('0x3'));var controller=require(_0x325d('0x4'));router[_0x325d('0x5')]('/',auth[_0x325d('0x6')](),controller['index']);router[_0x325d('0x5')](_0x325d('0x7'),auth[_0x325d('0x6')](),controller[_0x325d('0x8')]);router['post']('/',auth['isAuthenticated'](),controller[_0x325d('0x9')]);router['put']('/:id',auth[_0x325d('0x6')](),controller[_0x325d('0xa')]);router[_0x325d('0xb')](_0x325d('0x7'),auth[_0x325d('0x6')](),controller[_0x325d('0xc')]);module[_0x325d('0xd')]=router; \ No newline at end of file +var _0x8589=['post','create','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./intZohoField.controller','get','isAuthenticated','index','/:id','show'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8589,0xc3));var _0x9858=function(_0x127f25,_0x35ca8c){_0x127f25=_0x127f25-0x0;var _0x1ff286=_0x8589[_0x127f25];return _0x1ff286;};'use strict';var multer=require(_0x9858('0x0'));var util=require(_0x9858('0x1'));var path=require(_0x9858('0x2'));var timeout=require('connect-timeout');var express=require(_0x9858('0x3'));var router=express[_0x9858('0x4')]();var fs_extra=require(_0x9858('0x5'));var auth=require(_0x9858('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x9858('0x7'));var controller=require(_0x9858('0x8'));router[_0x9858('0x9')]('/',auth[_0x9858('0xa')](),controller[_0x9858('0xb')]);router[_0x9858('0x9')](_0x9858('0xc'),auth['isAuthenticated'](),controller[_0x9858('0xd')]);router[_0x9858('0xe')]('/',auth[_0x9858('0xa')](),controller[_0x9858('0xf')]);router['put'](_0x9858('0xc'),auth[_0x9858('0xa')](),controller['update']);router[_0x9858('0x10')](_0x9858('0xc'),auth['isAuthenticated'](),controller[_0x9858('0x11')]);module[_0x9858('0x12')]=router; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.attributes.js b/server/api/intZohoField/intZohoField.attributes.js index b059a3a..e2c2670 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 _0xe595=['customVariable','picklist','string','STRING','BOOLEAN','sequelize','exports','ENUM','variable'];(function(_0x55685f,_0x4f6c0f){var _0x4711f6=function(_0x228eed){while(--_0x228eed){_0x55685f['push'](_0x55685f['shift']());}};_0x4711f6(++_0x4f6c0f);}(_0xe595,0xd4));var _0x5e59=function(_0x2e65dd,_0x32ad20){_0x2e65dd=_0x2e65dd-0x0;var _0x269938=_0xe595[_0x2e65dd];return _0x269938;};'use strict';var Sequelize=require(_0x5e59('0x0'));module[_0x5e59('0x1')]={'type':{'type':Sequelize[_0x5e59('0x2')]('string',_0x5e59('0x3'),_0x5e59('0x4'),'keyValue',_0x5e59('0x5')),'defaultValue':_0x5e59('0x6')},'content':{'type':Sequelize[_0x5e59('0x7')]},'key':{'type':Sequelize[_0x5e59('0x7')]},'keyType':{'type':Sequelize[_0x5e59('0x2')](_0x5e59('0x6'),_0x5e59('0x3'),_0x5e59('0x4'))},'keyContent':{'type':Sequelize[_0x5e59('0x7')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x5e59('0x7')]},'customField':{'type':Sequelize[_0x5e59('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x5e59('0x7')]}}; \ No newline at end of file +var _0xc741=['string','BOOLEAN','ENUM','variable','customVariable','STRING'];(function(_0x5c3a45,_0x132a82){var _0x164f37=function(_0x22c6e3){while(--_0x22c6e3){_0x5c3a45['push'](_0x5c3a45['shift']());}};_0x164f37(++_0x132a82);}(_0xc741,0x6e));var _0x1c74=function(_0x209941,_0x5c9988){_0x209941=_0x209941-0x0;var _0x1e8729=_0xc741[_0x209941];return _0x1e8729;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize[_0x1c74('0x0')]('string',_0x1c74('0x1'),_0x1c74('0x2'),'keyValue','picklist'),'defaultValue':'string'},'content':{'type':Sequelize[_0x1c74('0x3')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x1c74('0x0')](_0x1c74('0x4'),_0x1c74('0x1'),'customVariable')},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x1c74('0x3')]},'nameField':{'type':Sequelize[_0x1c74('0x3')]},'customField':{'type':Sequelize[_0x1c74('0x5')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x1c74('0x3')]}}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.controller.js b/server/api/intZohoField/intZohoField.controller.js index 0ca7211..c69d323 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 _0x8e1f=['order','sort','where','filter','merge','includeAll','include','params','keys','options','catch','body','find','eml-format','rimraf','fast-json-patch','moment','mustache','util','path','sox','lodash','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','stack','name','send','index','ZohoField','rawAttributes','fieldName','type','key','model','map','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit'];(function(_0x59bcb1,_0x5a4b6c){var _0x4a737f=function(_0x546a49){while(--_0x546a49){_0x59bcb1['push'](_0x59bcb1['shift']());}};_0x4a737f(++_0x5a4b6c);}(_0x8e1f,0x95));var _0xf8e1=function(_0x2f8d56,_0x376c64){_0x2f8d56=_0x2f8d56-0x0;var _0x36081d=_0x8e1f[_0x2f8d56];return _0x36081d;};'use strict';var emlformat=require(_0xf8e1('0x0'));var rimraf=require(_0xf8e1('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf8e1('0x2'));var rp=require('request-promise');var moment=require(_0xf8e1('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xf8e1('0x4'));var util=require(_0xf8e1('0x5'));var path=require(_0xf8e1('0x6'));var sox=require(_0xf8e1('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf8e1('0x8'));var squel=require('squel');var crypto=require(_0xf8e1('0x9'));var jsforce=require('jsforce');var deskjs=require(_0xf8e1('0xa'));var toCsv=require('to-csv');var querystring=require(_0xf8e1('0xb'));var Papa=require('papaparse');var Redis=require(_0xf8e1('0xc'));var authService=require(_0xf8e1('0xd'));var qs=require(_0xf8e1('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf8e1('0xf'));var logger=require(_0xf8e1('0x10'))(_0xf8e1('0x11'));var utils=require(_0xf8e1('0x12'));var config=require(_0xf8e1('0x13'));var licenseUtil=require(_0xf8e1('0x14'));var db=require(_0xf8e1('0x15'))['db'];function respondWithStatusCode(_0x49e9a7,_0x5639a7){_0x5639a7=_0x5639a7||0xcc;return function(_0x150ad0){if(_0x150ad0){return _0x49e9a7[_0xf8e1('0x16')](_0x5639a7);}return _0x49e9a7[_0xf8e1('0x17')](_0x5639a7)['end']();};}function respondWithResult(_0x4c366a,_0x137889){_0x137889=_0x137889||0xc8;return function(_0x5cef06){if(_0x5cef06){return _0x4c366a[_0xf8e1('0x17')](_0x137889)[_0xf8e1('0x18')](_0x5cef06);}};}function respondWithFilteredResult(_0x2948c3,_0x1cdffb){return function(_0x5ac63){if(_0x5ac63){var _0x1f5619=typeof _0x1cdffb[_0xf8e1('0x19')]===_0xf8e1('0x1a')&&typeof _0x1cdffb[_0xf8e1('0x1b')]===_0xf8e1('0x1a');var _0x2b5ec7=_0x5ac63[_0xf8e1('0x1c')];var _0x92e0c9=_0x1f5619?0x0:_0x1cdffb['offset'];var _0x4fe0a5=_0x1f5619?_0x5ac63[_0xf8e1('0x1c')]:_0x1cdffb[_0xf8e1('0x19')]+_0x1cdffb[_0xf8e1('0x1b')];var _0x512170;if(_0x4fe0a5>=_0x2b5ec7){_0x4fe0a5=_0x2b5ec7;_0x512170=0xc8;}else{_0x512170=0xce;}_0x2948c3['status'](_0x512170);return _0x2948c3[_0xf8e1('0x1d')](_0xf8e1('0x1e'),_0x92e0c9+'-'+_0x4fe0a5+'/'+_0x2b5ec7)[_0xf8e1('0x18')](_0x5ac63);}return null;};}function patchUpdates(_0xd7213d){return function(_0x8971a5){try{jsonpatch[_0xf8e1('0x1f')](_0x8971a5,_0xd7213d,!![]);}catch(_0x2a33a4){return BPromise[_0xf8e1('0x20')](_0x2a33a4);}return _0x8971a5['save']();};}function saveUpdates(_0x382687,_0xa4e161){return function(_0x448364){if(_0x448364){return _0x448364[_0xf8e1('0x21')](_0x382687)[_0xf8e1('0x22')](function(_0x30fa65){return _0x30fa65;});}return null;};}function removeEntity(_0x58301e,_0x187615){return function(_0x5c5d22){if(_0x5c5d22){return _0x5c5d22[_0xf8e1('0x23')]()[_0xf8e1('0x22')](function(){_0x58301e['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x38c313,_0x5665d3){return function(_0x1781fb){if(!_0x1781fb){_0x38c313[_0xf8e1('0x16')](0x194);}return _0x1781fb;};}function handleError(_0x267516,_0x1641b7){_0x1641b7=_0x1641b7||0x1f4;return function(_0x1916d0){logger['error'](_0x1916d0[_0xf8e1('0x24')]);if(_0x1916d0[_0xf8e1('0x25')]){delete _0x1916d0['name'];}_0x267516[_0xf8e1('0x17')](_0x1641b7)[_0xf8e1('0x26')](_0x1916d0);};}exports[_0xf8e1('0x27')]=function(_0x454dc1,_0x4852c3){var _0xf0262={},_0x35a21b={},_0x4313a5={'count':0x0,'rows':[]};var _0x4d6c0a=_['map'](db[_0xf8e1('0x28')][_0xf8e1('0x29')],function(_0x114f11){return{'name':_0x114f11[_0xf8e1('0x2a')],'type':_0x114f11[_0xf8e1('0x2b')][_0xf8e1('0x2c')]};});_0x35a21b[_0xf8e1('0x2d')]=_[_0xf8e1('0x2e')](_0x4d6c0a,'name');_0x35a21b['query']=_['keys'](_0x454dc1[_0xf8e1('0x2f')]);_0x35a21b[_0xf8e1('0x30')]=_['intersection'](_0x35a21b[_0xf8e1('0x2d')],_0x35a21b[_0xf8e1('0x2f')]);_0xf0262[_0xf8e1('0x31')]=_[_0xf8e1('0x32')](_0x35a21b['model'],qs[_0xf8e1('0x33')](_0x454dc1[_0xf8e1('0x2f')]['fields']));_0xf0262[_0xf8e1('0x31')]=_0xf0262[_0xf8e1('0x31')][_0xf8e1('0x34')]?_0xf0262[_0xf8e1('0x31')]:_0x35a21b[_0xf8e1('0x2d')];if(!_0x454dc1[_0xf8e1('0x2f')][_0xf8e1('0x35')](_0xf8e1('0x36'))){_0xf0262[_0xf8e1('0x1b')]=qs[_0xf8e1('0x1b')](_0x454dc1['query'][_0xf8e1('0x1b')]);_0xf0262['offset']=qs[_0xf8e1('0x19')](_0x454dc1[_0xf8e1('0x2f')][_0xf8e1('0x19')]);}_0xf0262[_0xf8e1('0x37')]=qs[_0xf8e1('0x38')](_0x454dc1['query'][_0xf8e1('0x38')]);_0xf0262[_0xf8e1('0x39')]=qs[_0xf8e1('0x30')](_['pick'](_0x454dc1[_0xf8e1('0x2f')],_0x35a21b['filters']),_0x4d6c0a);if(_0x454dc1[_0xf8e1('0x2f')][_0xf8e1('0x3a')]){_0xf0262[_0xf8e1('0x39')]=_[_0xf8e1('0x3b')](_0xf0262[_0xf8e1('0x39')],{'$or':_[_0xf8e1('0x2e')](_0x4d6c0a,function(_0x162b09){if(_0x162b09[_0xf8e1('0x2b')]!=='VIRTUAL'){var _0x399357={};_0x399357[_0x162b09['name']]={'$like':'%'+_0x454dc1[_0xf8e1('0x2f')][_0xf8e1('0x3a')]+'%'};return _0x399357;}})});}_0xf0262=_[_0xf8e1('0x3b')]({},_0xf0262,_0x454dc1['options']);var _0x1aa439={'where':_0xf0262[_0xf8e1('0x39')]};return db[_0xf8e1('0x28')][_0xf8e1('0x1c')](_0x1aa439)[_0xf8e1('0x22')](function(_0x2c7144){_0x4313a5[_0xf8e1('0x1c')]=_0x2c7144;if(_0x454dc1[_0xf8e1('0x2f')][_0xf8e1('0x3c')]){_0xf0262[_0xf8e1('0x3d')]=[{'all':!![]}];}return db[_0xf8e1('0x28')]['findAll'](_0xf0262);})['then'](function(_0x9aac31){_0x4313a5['rows']=_0x9aac31;return _0x4313a5;})['then'](respondWithFilteredResult(_0x4852c3,_0xf0262))['catch'](handleError(_0x4852c3,null));};exports['show']=function(_0x45cd77,_0x48845e){var _0x5d3d0d={'raw':!![],'where':{'id':_0x45cd77[_0xf8e1('0x3e')]['id']}},_0xe34f37={};_0xe34f37['model']=_[_0xf8e1('0x3f')](db[_0xf8e1('0x28')][_0xf8e1('0x29')]);_0xe34f37['query']=_['keys'](_0x45cd77[_0xf8e1('0x2f')]);_0xe34f37[_0xf8e1('0x30')]=_[_0xf8e1('0x32')](_0xe34f37['model'],_0xe34f37[_0xf8e1('0x2f')]);_0x5d3d0d[_0xf8e1('0x31')]=_['intersection'](_0xe34f37['model'],qs[_0xf8e1('0x33')](_0x45cd77['query'][_0xf8e1('0x33')]));_0x5d3d0d[_0xf8e1('0x31')]=_0x5d3d0d[_0xf8e1('0x31')]['length']?_0x5d3d0d['attributes']:_0xe34f37[_0xf8e1('0x2d')];if(_0x45cd77['query'][_0xf8e1('0x3c')]){_0x5d3d0d[_0xf8e1('0x3d')]=[{'all':!![]}];}_0x5d3d0d=_[_0xf8e1('0x3b')]({},_0x5d3d0d,_0x45cd77[_0xf8e1('0x40')]);return db[_0xf8e1('0x28')]['find'](_0x5d3d0d)[_0xf8e1('0x22')](handleEntityNotFound(_0x48845e,null))[_0xf8e1('0x22')](respondWithResult(_0x48845e,null))[_0xf8e1('0x41')](handleError(_0x48845e,null));};exports['create']=function(_0x28252b,_0x575865){return db[_0xf8e1('0x28')]['create'](_0x28252b['body'],{})[_0xf8e1('0x22')](respondWithResult(_0x575865,0xc9))['catch'](handleError(_0x575865,null));};exports[_0xf8e1('0x21')]=function(_0x29c659,_0x16652c){if(_0x29c659[_0xf8e1('0x42')]['id']){delete _0x29c659[_0xf8e1('0x42')]['id'];}return db[_0xf8e1('0x28')]['find']({'where':{'id':_0x29c659[_0xf8e1('0x3e')]['id']}})[_0xf8e1('0x22')](handleEntityNotFound(_0x16652c,null))[_0xf8e1('0x22')](saveUpdates(_0x29c659['body'],null))[_0xf8e1('0x22')](respondWithResult(_0x16652c,null))[_0xf8e1('0x41')](handleError(_0x16652c,null));};exports[_0xf8e1('0x23')]=function(_0x2a37d3,_0x319312){return db['ZohoField'][_0xf8e1('0x43')]({'where':{'id':_0x2a37d3[_0xf8e1('0x3e')]['id']}})['then'](handleEntityNotFound(_0x319312,null))[_0xf8e1('0x22')](removeEntity(_0x319312,null))[_0xf8e1('0x41')](handleError(_0x319312,null));}; \ No newline at end of file +var _0xd742=['desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','name','send','map','ZohoField','rawAttributes','fieldName','type','key','model','query','intersection','fields','attributes','hasOwnProperty','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','keys','length','find','create','catch','body','params','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce'];(function(_0x31dde9,_0x12e816){var _0x1fbf2d=function(_0x1d1bf6){while(--_0x1d1bf6){_0x31dde9['push'](_0x31dde9['shift']());}};_0x1fbf2d(++_0x12e816);}(_0xd742,0x1ca));var _0x2d74=function(_0x3bea91,_0x11882d){_0x3bea91=_0x3bea91-0x0;var _0x590fc6=_0xd742[_0x3bea91];return _0x590fc6;};'use strict';var emlformat=require(_0x2d74('0x0'));var rimraf=require(_0x2d74('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2d74('0x2'));var rp=require(_0x2d74('0x3'));var moment=require(_0x2d74('0x4'));var BPromise=require(_0x2d74('0x5'));var Mustache=require(_0x2d74('0x6'));var util=require(_0x2d74('0x7'));var path=require(_0x2d74('0x8'));var sox=require(_0x2d74('0x9'));var csv=require(_0x2d74('0xa'));var ejs=require(_0x2d74('0xb'));var fs=require('fs');var fs_extra=require(_0x2d74('0xc'));var _=require('lodash');var squel=require(_0x2d74('0xd'));var crypto=require(_0x2d74('0xe'));var jsforce=require(_0x2d74('0xf'));var deskjs=require(_0x2d74('0x10'));var toCsv=require(_0x2d74('0xa'));var querystring=require('querystring');var Papa=require(_0x2d74('0x11'));var Redis=require(_0x2d74('0x12'));var authService=require(_0x2d74('0x13'));var qs=require(_0x2d74('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2d74('0x15'));var logger=require(_0x2d74('0x16'))(_0x2d74('0x17'));var utils=require('../../config/utils');var config=require(_0x2d74('0x18'));var licenseUtil=require(_0x2d74('0x19'));var db=require(_0x2d74('0x1a'))['db'];function respondWithStatusCode(_0x3b6920,_0x4ee1a1){_0x4ee1a1=_0x4ee1a1||0xcc;return function(_0x211e8c){if(_0x211e8c){return _0x3b6920[_0x2d74('0x1b')](_0x4ee1a1);}return _0x3b6920[_0x2d74('0x1c')](_0x4ee1a1)[_0x2d74('0x1d')]();};}function respondWithResult(_0x2a8a37,_0xfeef40){_0xfeef40=_0xfeef40||0xc8;return function(_0x152701){if(_0x152701){return _0x2a8a37[_0x2d74('0x1c')](_0xfeef40)[_0x2d74('0x1e')](_0x152701);}};}function respondWithFilteredResult(_0x5cd808,_0x1b8b87){return function(_0x4e05a2){if(_0x4e05a2){var _0x3d99cd=typeof _0x1b8b87[_0x2d74('0x1f')]===_0x2d74('0x20')&&typeof _0x1b8b87[_0x2d74('0x21')]===_0x2d74('0x20');var _0x27052d=_0x4e05a2[_0x2d74('0x22')];var _0x366230=_0x3d99cd?0x0:_0x1b8b87[_0x2d74('0x1f')];var _0x2e040f=_0x3d99cd?_0x4e05a2[_0x2d74('0x22')]:_0x1b8b87[_0x2d74('0x1f')]+_0x1b8b87[_0x2d74('0x21')];var _0x16cb28;if(_0x2e040f>=_0x27052d){_0x2e040f=_0x27052d;_0x16cb28=0xc8;}else{_0x16cb28=0xce;}_0x5cd808[_0x2d74('0x1c')](_0x16cb28);return _0x5cd808[_0x2d74('0x23')](_0x2d74('0x24'),_0x366230+'-'+_0x2e040f+'/'+_0x27052d)[_0x2d74('0x1e')](_0x4e05a2);}return null;};}function patchUpdates(_0x56aea2){return function(_0x2b3b06){try{jsonpatch[_0x2d74('0x25')](_0x2b3b06,_0x56aea2,!![]);}catch(_0x39003f){return BPromise[_0x2d74('0x26')](_0x39003f);}return _0x2b3b06[_0x2d74('0x27')]();};}function saveUpdates(_0x24793c,_0x23d375){return function(_0x5645ea){if(_0x5645ea){return _0x5645ea[_0x2d74('0x28')](_0x24793c)[_0x2d74('0x29')](function(_0x35b9f5){return _0x35b9f5;});}return null;};}function removeEntity(_0x3745be,_0x14eedf){return function(_0x22d7b9){if(_0x22d7b9){return _0x22d7b9[_0x2d74('0x2a')]()[_0x2d74('0x29')](function(){_0x3745be['status'](0xcc)[_0x2d74('0x1d')]();});}};}function handleEntityNotFound(_0x2c4e7e,_0x6e2708){return function(_0x2b51a7){if(!_0x2b51a7){_0x2c4e7e[_0x2d74('0x1b')](0x194);}return _0x2b51a7;};}function handleError(_0x45a808,_0x5cf1aa){_0x5cf1aa=_0x5cf1aa||0x1f4;return function(_0x5f45a1){logger[_0x2d74('0x2b')](_0x5f45a1['stack']);if(_0x5f45a1[_0x2d74('0x2c')]){delete _0x5f45a1[_0x2d74('0x2c')];}_0x45a808[_0x2d74('0x1c')](_0x5cf1aa)[_0x2d74('0x2d')](_0x5f45a1);};}exports['index']=function(_0xfd6b77,_0x62ae71){var _0x5c9628={},_0x1c79c8={},_0x11b51e={'count':0x0,'rows':[]};var _0x492ae3=_[_0x2d74('0x2e')](db[_0x2d74('0x2f')][_0x2d74('0x30')],function(_0x88f49c){return{'name':_0x88f49c[_0x2d74('0x31')],'type':_0x88f49c[_0x2d74('0x32')][_0x2d74('0x33')]};});_0x1c79c8[_0x2d74('0x34')]=_['map'](_0x492ae3,'name');_0x1c79c8[_0x2d74('0x35')]=_['keys'](_0xfd6b77[_0x2d74('0x35')]);_0x1c79c8['filters']=_[_0x2d74('0x36')](_0x1c79c8[_0x2d74('0x34')],_0x1c79c8[_0x2d74('0x35')]);_0x5c9628['attributes']=_[_0x2d74('0x36')](_0x1c79c8[_0x2d74('0x34')],qs[_0x2d74('0x37')](_0xfd6b77[_0x2d74('0x35')]['fields']));_0x5c9628[_0x2d74('0x38')]=_0x5c9628[_0x2d74('0x38')]['length']?_0x5c9628[_0x2d74('0x38')]:_0x1c79c8['model'];if(!_0xfd6b77['query'][_0x2d74('0x39')]('nolimit')){_0x5c9628[_0x2d74('0x21')]=qs[_0x2d74('0x21')](_0xfd6b77[_0x2d74('0x35')][_0x2d74('0x21')]);_0x5c9628['offset']=qs[_0x2d74('0x1f')](_0xfd6b77[_0x2d74('0x35')]['offset']);}_0x5c9628[_0x2d74('0x3a')]=qs['sort'](_0xfd6b77[_0x2d74('0x35')][_0x2d74('0x3b')]);_0x5c9628[_0x2d74('0x3c')]=qs[_0x2d74('0x3d')](_[_0x2d74('0x3e')](_0xfd6b77[_0x2d74('0x35')],_0x1c79c8['filters']),_0x492ae3);if(_0xfd6b77['query'][_0x2d74('0x3f')]){_0x5c9628['where']=_[_0x2d74('0x40')](_0x5c9628[_0x2d74('0x3c')],{'$or':_[_0x2d74('0x2e')](_0x492ae3,function(_0x37aa94){if(_0x37aa94[_0x2d74('0x32')]!==_0x2d74('0x41')){var _0x1484ea={};_0x1484ea[_0x37aa94[_0x2d74('0x2c')]]={'$like':'%'+_0xfd6b77['query'][_0x2d74('0x3f')]+'%'};return _0x1484ea;}})});}_0x5c9628=_[_0x2d74('0x40')]({},_0x5c9628,_0xfd6b77[_0x2d74('0x42')]);var _0x1a38cf={'where':_0x5c9628[_0x2d74('0x3c')]};return db[_0x2d74('0x2f')][_0x2d74('0x22')](_0x1a38cf)['then'](function(_0xf4d716){_0x11b51e[_0x2d74('0x22')]=_0xf4d716;if(_0xfd6b77[_0x2d74('0x35')][_0x2d74('0x43')]){_0x5c9628[_0x2d74('0x44')]=[{'all':!![]}];}return db['ZohoField'][_0x2d74('0x45')](_0x5c9628);})[_0x2d74('0x29')](function(_0x4a3cc4){_0x11b51e[_0x2d74('0x46')]=_0x4a3cc4;return _0x11b51e;})[_0x2d74('0x29')](respondWithFilteredResult(_0x62ae71,_0x5c9628))['catch'](handleError(_0x62ae71,null));};exports[_0x2d74('0x47')]=function(_0x2b2eb2,_0x1b038e){var _0x577603={'raw':!![],'where':{'id':_0x2b2eb2['params']['id']}},_0x246073={};_0x246073[_0x2d74('0x34')]=_[_0x2d74('0x48')](db[_0x2d74('0x2f')]['rawAttributes']);_0x246073[_0x2d74('0x35')]=_['keys'](_0x2b2eb2[_0x2d74('0x35')]);_0x246073['filters']=_['intersection'](_0x246073[_0x2d74('0x34')],_0x246073[_0x2d74('0x35')]);_0x577603['attributes']=_[_0x2d74('0x36')](_0x246073[_0x2d74('0x34')],qs[_0x2d74('0x37')](_0x2b2eb2[_0x2d74('0x35')][_0x2d74('0x37')]));_0x577603[_0x2d74('0x38')]=_0x577603[_0x2d74('0x38')][_0x2d74('0x49')]?_0x577603[_0x2d74('0x38')]:_0x246073[_0x2d74('0x34')];if(_0x2b2eb2['query'][_0x2d74('0x43')]){_0x577603[_0x2d74('0x44')]=[{'all':!![]}];}_0x577603=_[_0x2d74('0x40')]({},_0x577603,_0x2b2eb2['options']);return db[_0x2d74('0x2f')][_0x2d74('0x4a')](_0x577603)[_0x2d74('0x29')](handleEntityNotFound(_0x1b038e,null))[_0x2d74('0x29')](respondWithResult(_0x1b038e,null))['catch'](handleError(_0x1b038e,null));};exports['create']=function(_0xf034c1,_0x48e494){return db[_0x2d74('0x2f')][_0x2d74('0x4b')](_0xf034c1['body'],{})['then'](respondWithResult(_0x48e494,0xc9))[_0x2d74('0x4c')](handleError(_0x48e494,null));};exports[_0x2d74('0x28')]=function(_0x1d7d8e,_0x1eb51b){if(_0x1d7d8e[_0x2d74('0x4d')]['id']){delete _0x1d7d8e[_0x2d74('0x4d')]['id'];}return db['ZohoField']['find']({'where':{'id':_0x1d7d8e[_0x2d74('0x4e')]['id']}})[_0x2d74('0x29')](handleEntityNotFound(_0x1eb51b,null))[_0x2d74('0x29')](saveUpdates(_0x1d7d8e['body'],null))[_0x2d74('0x29')](respondWithResult(_0x1eb51b,null))['catch'](handleError(_0x1eb51b,null));};exports[_0x2d74('0x2a')]=function(_0x1bd425,_0x4e3565){return db[_0x2d74('0x2f')]['find']({'where':{'id':_0x1bd425[_0x2d74('0x4e')]['id']}})['then'](handleEntityNotFound(_0x4e3565,null))[_0x2d74('0x29')](removeEntity(_0x4e3565,null))[_0x2d74('0x4c')](handleError(_0x4e3565,null));}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.model.js b/server/api/intZohoField/intZohoField.model.js index d2ff1ae..0720784 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 _0x3e24=['request-promise','path','../../config/environment','./intZohoField.attributes','exports','define','ZohoField','zoho_unique_index','idField','lodash','util','../../config/logger','api','moment'];(function(_0x329ebd,_0x473180){var _0x14ddc3=function(_0x59f110){while(--_0x59f110){_0x329ebd['push'](_0x329ebd['shift']());}};_0x14ddc3(++_0x473180);}(_0x3e24,0x167));var _0x43e2=function(_0x67754c,_0x4ee2c1){_0x67754c=_0x67754c-0x0;var _0x1f09ec=_0x3e24[_0x67754c];return _0x1f09ec;};'use strict';var _=require(_0x43e2('0x0'));var util=require(_0x43e2('0x1'));var logger=require(_0x43e2('0x2'))(_0x43e2('0x3'));var moment=require(_0x43e2('0x4'));var BPromise=require('bluebird');var rp=require(_0x43e2('0x5'));var fs=require('fs');var path=require(_0x43e2('0x6'));var rimraf=require('rimraf');var config=require(_0x43e2('0x7'));var attributes=require(_0x43e2('0x8'));module[_0x43e2('0x9')]=function(_0x28b144,_0x43b5a7){return _0x28b144[_0x43e2('0xa')](_0x43e2('0xb'),attributes,{'tableName':'int_zoho_fields','paranoid':![],'indexes':[{'name':_0x43e2('0xc'),'fields':[_0x43e2('0xd'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xa46e=['path','../../config/environment','exports','define','int_zoho_fields','zoho_unique_index','idField','FieldId','lodash','util','api','moment','bluebird'];(function(_0x22b219,_0x3357b5){var _0x52084e=function(_0x3ebf5b){while(--_0x3ebf5b){_0x22b219['push'](_0x22b219['shift']());}};_0x52084e(++_0x3357b5);}(_0xa46e,0x8a));var _0xea46=function(_0x5948dd,_0x1f6ac8){_0x5948dd=_0x5948dd-0x0;var _0xb1f8be=_0xa46e[_0x5948dd];return _0xb1f8be;};'use strict';var _=require(_0xea46('0x0'));var util=require(_0xea46('0x1'));var logger=require('../../config/logger')(_0xea46('0x2'));var moment=require(_0xea46('0x3'));var BPromise=require(_0xea46('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xea46('0x5'));var rimraf=require('rimraf');var config=require(_0xea46('0x6'));var attributes=require('./intZohoField.attributes');module[_0xea46('0x7')]=function(_0x528404,_0x10bee5){return _0x528404[_0xea46('0x8')]('ZohoField',attributes,{'tableName':_0xea46('0x9'),'paranoid':![],'indexes':[{'name':_0xea46('0xa'),'fields':[_0xea46('0xb'),_0xea46('0xc')],'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 2ca9f99..599e9ef 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 _0x881d=['message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/environment','jayson/promise','client','http','request','then','info','ZohoField,\x20%s,\x20%s','request\x20sent','debug','stringify','error'];(function(_0x355f24,_0x596711){var _0x13876b=function(_0x1b7120){while(--_0x1b7120){_0x355f24['push'](_0x355f24['shift']());}};_0x13876b(++_0x596711);}(_0x881d,0x1d1));var _0xd881=function(_0x4bfac3,_0x58324d){_0x4bfac3=_0x4bfac3-0x0;var _0x15f0f2=_0x881d[_0x4bfac3];return _0x15f0f2;};'use strict';var _=require(_0xd881('0x0'));var util=require(_0xd881('0x1'));var moment=require(_0xd881('0x2'));var BPromise=require(_0xd881('0x3'));var rs=require(_0xd881('0x4'));var fs=require('fs');var Redis=require(_0xd881('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0xd881('0x6'));var jayson=require(_0xd881('0x7'));var client=jayson[_0xd881('0x8')][_0xd881('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x23a7f5,_0x1a4018,_0x1e9d44){return new BPromise(function(_0x1a87a5,_0x3ea76f){return client[_0xd881('0xa')](_0x23a7f5,_0x1e9d44)[_0xd881('0xb')](function(_0xa45828){logger[_0xd881('0xc')](_0xd881('0xd'),_0x1a4018,_0xd881('0xe'));logger[_0xd881('0xf')]('ZohoField,\x20%s,\x20%s,\x20%s',_0x1a4018,_0xd881('0xe'),JSON[_0xd881('0x10')](_0xa45828));if(_0xa45828[_0xd881('0x11')]){if(_0xa45828[_0xd881('0x11')]['code']===0x1f4){logger[_0xd881('0x11')](_0xd881('0xd'),_0x1a4018,_0xa45828[_0xd881('0x11')]['message']);return _0x3ea76f(_0xa45828[_0xd881('0x11')][_0xd881('0x12')]);}logger[_0xd881('0x11')]('ZohoField,\x20%s,\x20%s',_0x1a4018,_0xa45828['error'][_0xd881('0x12')]);return _0x1a87a5(_0xa45828[_0xd881('0x11')]['message']);}else{logger[_0xd881('0xc')](_0xd881('0xd'),_0x1a4018,_0xd881('0xe'));_0x1a87a5(_0xa45828[_0xd881('0x13')]['message']);}})[_0xd881('0x14')](function(_0xda703e){logger[_0xd881('0x11')](_0xd881('0xd'),_0x1a4018,_0xda703e);_0x3ea76f(_0xda703e);});});} \ No newline at end of file +var _0x6e8e=['../../config/utils','rpc','jayson/promise','client','http','request','ZohoField,\x20%s,\x20%s','request\x20sent','ZohoField,\x20%s,\x20%s,\x20%s','error','message','info','result','lodash','util','moment','randomstring','ioredis','../../mysqldb'];(function(_0xe57d07,_0x126542){var _0x189a99=function(_0x47ae0f){while(--_0x47ae0f){_0xe57d07['push'](_0xe57d07['shift']());}};_0x189a99(++_0x126542);}(_0x6e8e,0xde));var _0xe6e8=function(_0x3fc0d0,_0x55a39a){_0x3fc0d0=_0x3fc0d0-0x0;var _0x449a31=_0x6e8e[_0x3fc0d0];return _0x449a31;};'use strict';var _=require(_0xe6e8('0x0'));var util=require(_0xe6e8('0x1'));var moment=require(_0xe6e8('0x2'));var BPromise=require('bluebird');var rs=require(_0xe6e8('0x3'));var fs=require('fs');var Redis=require(_0xe6e8('0x4'));var db=require(_0xe6e8('0x5'))['db'];var utils=require(_0xe6e8('0x6'));var logger=require('../../config/logger')(_0xe6e8('0x7'));var config=require('../../config/environment');var jayson=require(_0xe6e8('0x8'));var client=jayson[_0xe6e8('0x9')][_0xe6e8('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x25b6c2,_0x598103,_0x10bb4e){return new BPromise(function(_0x426385,_0x16618d){return client[_0xe6e8('0xb')](_0x25b6c2,_0x10bb4e)['then'](function(_0x1738f0){logger['info'](_0xe6e8('0xc'),_0x598103,_0xe6e8('0xd'));logger['debug'](_0xe6e8('0xe'),_0x598103,'request\x20sent',JSON['stringify'](_0x1738f0));if(_0x1738f0[_0xe6e8('0xf')]){if(_0x1738f0[_0xe6e8('0xf')]['code']===0x1f4){logger['error'](_0xe6e8('0xc'),_0x598103,_0x1738f0[_0xe6e8('0xf')][_0xe6e8('0x10')]);return _0x16618d(_0x1738f0[_0xe6e8('0xf')][_0xe6e8('0x10')]);}logger['error']('ZohoField,\x20%s,\x20%s',_0x598103,_0x1738f0[_0xe6e8('0xf')][_0xe6e8('0x10')]);return _0x426385(_0x1738f0[_0xe6e8('0xf')][_0xe6e8('0x10')]);}else{logger[_0xe6e8('0x11')](_0xe6e8('0xc'),_0x598103,_0xe6e8('0xd'));_0x426385(_0x1738f0[_0xe6e8('0x12')][_0xe6e8('0x10')]);}})['catch'](function(_0x434388){logger['error'](_0xe6e8('0xc'),_0x598103,_0x434388);_0x16618d(_0x434388);});});} \ No newline at end of file diff --git a/server/api/integration/index.js b/server/api/integration/index.js index cad9c93..5d68b60 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 _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x3b33a4,_0x5ae448){var _0x2e9389=function(_0xa01228){while(--_0xa01228){_0x3b33a4['push'](_0x3b33a4['shift']());}};_0x2e9389(++_0x5ae448);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2160a9,_0x3cbd9e){_0x2160a9=_0x2160a9-0x0;var _0xa88cf7=_0xa9e0[_0x2160a9];return _0xa88cf7;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('0x7')]=router; \ No newline at end of file +var _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x3ec753,_0x2dea7a){var _0x3ab921=function(_0x1698fc){while(--_0x1698fc){_0x3ec753['push'](_0x3ec753['shift']());}};_0x3ab921(++_0x2dea7a);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var fs_extra=require(_0x3071('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));module[_0x3071('0x7')]=router; \ No newline at end of file diff --git a/server/api/integration/integration.attributes.js b/server/api/integration/integration.attributes.js index 584c1f4..781056e 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 _0x8947=['unique_name_and_version','STRING','app.js','INTEGER','BOOLEAN','state','sequelize','exports'];(function(_0x23e0d3,_0x44cd2a){var _0x2f6e35=function(_0x1d23f2){while(--_0x1d23f2){_0x23e0d3['push'](_0x23e0d3['shift']());}};_0x2f6e35(++_0x44cd2a);}(_0x8947,0x1d6));var _0x7894=function(_0x35eea6,_0x195b2a){_0x35eea6=_0x35eea6-0x0;var _0x23c5c5=_0x8947[_0x35eea6];return _0x23c5c5;};'use strict';var Sequelize=require(_0x7894('0x0'));module[_0x7894('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x7894('0x2')},'version':{'type':Sequelize[_0x7894('0x3')],'allowNull':![],'unique':_0x7894('0x2')},'main':{'type':Sequelize[_0x7894('0x3')],'defaultValue':_0x7894('0x4')},'filename':{'type':Sequelize[_0x7894('0x3')]},'path':{'type':Sequelize['STRING']},'type':{'type':Sequelize['STRING']},'size':{'type':Sequelize[_0x7894('0x5')]},'active':{'type':Sequelize[_0x7894('0x6')],'defaultValue':![]},'author':{'type':Sequelize[_0x7894('0x3')]},'logo':{'type':Sequelize[_0x7894('0x3')]},'state':{'type':Sequelize[_0x7894('0x3')],'unique':_0x7894('0x7')},'description':{'type':Sequelize[_0x7894('0x3')]},'title':{'type':Sequelize[_0x7894('0x3')]},'remoteUri':{'type':Sequelize[_0x7894('0x3')]},'link':{'type':Sequelize[_0x7894('0x3')],'defaultValue':'#'}}; \ No newline at end of file +var _0xa64a=['BOOLEAN','state','sequelize','STRING','unique_name_and_version','app.js','INTEGER'];(function(_0x311c35,_0x534915){var _0x5cc50c=function(_0x3ad680){while(--_0x3ad680){_0x311c35['push'](_0x311c35['shift']());}};_0x5cc50c(++_0x534915);}(_0xa64a,0xc6));var _0xaa64=function(_0x4b352e,_0x1a5ebe){_0x4b352e=_0x4b352e-0x0;var _0x4b34a4=_0xa64a[_0x4b352e];return _0x4b34a4;};'use strict';var Sequelize=require(_0xaa64('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'unique_name_and_version'},'version':{'type':Sequelize[_0xaa64('0x1')],'allowNull':![],'unique':_0xaa64('0x2')},'main':{'type':Sequelize[_0xaa64('0x1')],'defaultValue':_0xaa64('0x3')},'filename':{'type':Sequelize['STRING']},'path':{'type':Sequelize[_0xaa64('0x1')]},'type':{'type':Sequelize[_0xaa64('0x1')]},'size':{'type':Sequelize[_0xaa64('0x4')]},'active':{'type':Sequelize[_0xaa64('0x5')],'defaultValue':![]},'author':{'type':Sequelize['STRING']},'logo':{'type':Sequelize[_0xaa64('0x1')]},'state':{'type':Sequelize[_0xaa64('0x1')],'unique':_0xaa64('0x6')},'description':{'type':Sequelize[_0xaa64('0x1')]},'title':{'type':Sequelize[_0xaa64('0x1')]},'remoteUri':{'type':Sequelize[_0xaa64('0x1')]},'link':{'type':Sequelize['STRING'],'defaultValue':'#'}}; \ No newline at end of file diff --git a/server/api/integration/integration.controller.js b/server/api/integration/integration.controller.js index 021131b..ea9eb33 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 _0x0295=['params','intersection','include','find','create','body','eml-format','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','end','status','json','offset','undefined','limit','count','set','apply','save','update','then','destroy','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','Integration','includeAll','rows','catch','show'];(function(_0x728a0d,_0x44ca89){var _0xc575ed=function(_0x418c03){while(--_0x418c03){_0x728a0d['push'](_0x728a0d['shift']());}};_0xc575ed(++_0x44ca89);}(_0x0295,0x1f0));var _0x5029=function(_0x2c492c,_0x50e279){_0x2c492c=_0x2c492c-0x0;var _0x51c7f6=_0x0295[_0x2c492c];return _0x51c7f6;};'use strict';var emlformat=require(_0x5029('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x5029('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x5029('0x2'));var Mustache=require(_0x5029('0x3'));var util=require(_0x5029('0x4'));var path=require(_0x5029('0x5'));var sox=require(_0x5029('0x6'));var csv=require(_0x5029('0x7'));var ejs=require(_0x5029('0x8'));var fs=require('fs');var fs_extra=require(_0x5029('0x9'));var _=require(_0x5029('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x5029('0xb'));var toCsv=require('to-csv');var querystring=require(_0x5029('0xc'));var Papa=require('papaparse');var Redis=require(_0x5029('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x5029('0xe'));var as=require(_0x5029('0xf'));var hardwareService=require(_0x5029('0x10'));var logger=require('../../config/logger')(_0x5029('0x11'));var utils=require(_0x5029('0x12'));var config=require(_0x5029('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x5029('0x14'))['db'];function respondWithStatusCode(_0x2442b2,_0x4cced9){_0x4cced9=_0x4cced9||0xcc;return function(_0x4fa22d){if(_0x4fa22d){return _0x2442b2['sendStatus'](_0x4cced9);}return _0x2442b2['status'](_0x4cced9)[_0x5029('0x15')]();};}function respondWithResult(_0x2e0369,_0x12c237){_0x12c237=_0x12c237||0xc8;return function(_0x434630){if(_0x434630){return _0x2e0369[_0x5029('0x16')](_0x12c237)[_0x5029('0x17')](_0x434630);}};}function respondWithFilteredResult(_0xe278b7,_0x317c20){return function(_0x10bf55){if(_0x10bf55){var _0x326923=typeof _0x317c20[_0x5029('0x18')]===_0x5029('0x19')&&typeof _0x317c20[_0x5029('0x1a')]===_0x5029('0x19');var _0x343918=_0x10bf55['count'];var _0x1ed567=_0x326923?0x0:_0x317c20[_0x5029('0x18')];var _0x35de81=_0x326923?_0x10bf55[_0x5029('0x1b')]:_0x317c20[_0x5029('0x18')]+_0x317c20[_0x5029('0x1a')];var _0xaba461;if(_0x35de81>=_0x343918){_0x35de81=_0x343918;_0xaba461=0xc8;}else{_0xaba461=0xce;}_0xe278b7['status'](_0xaba461);return _0xe278b7[_0x5029('0x1c')]('Content-Range',_0x1ed567+'-'+_0x35de81+'/'+_0x343918)[_0x5029('0x17')](_0x10bf55);}return null;};}function patchUpdates(_0x8a414c){return function(_0x2710aa){try{jsonpatch[_0x5029('0x1d')](_0x2710aa,_0x8a414c,!![]);}catch(_0x4b5854){return BPromise['reject'](_0x4b5854);}return _0x2710aa[_0x5029('0x1e')]();};}function saveUpdates(_0x4a49b6,_0x3f657d){return function(_0x853a34){if(_0x853a34){return _0x853a34[_0x5029('0x1f')](_0x4a49b6)[_0x5029('0x20')](function(_0x16bd22){return _0x16bd22;});}return null;};}function removeEntity(_0x3a3e52,_0x125c26){return function(_0x356dac){if(_0x356dac){return _0x356dac[_0x5029('0x21')]()['then'](function(){_0x3a3e52['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x588d90,_0x45666c){return function(_0x51093c){if(!_0x51093c){_0x588d90['sendStatus'](0x194);}return _0x51093c;};}function handleError(_0x181da0,_0x1e7e61){_0x1e7e61=_0x1e7e61||0x1f4;return function(_0x36d810){logger['error'](_0x36d810[_0x5029('0x22')]);if(_0x36d810[_0x5029('0x23')]){delete _0x36d810['name'];}_0x181da0[_0x5029('0x16')](_0x1e7e61)[_0x5029('0x24')](_0x36d810);};}exports[_0x5029('0x25')]=function(_0x4a24b9,_0x32da06){var _0x251f99={},_0xe5313e={},_0x4b6f92={'count':0x0,'rows':[]};var _0x2cedf6=_[_0x5029('0x26')](db['Integration'][_0x5029('0x27')],function(_0x25032b){return{'name':_0x25032b[_0x5029('0x28')],'type':_0x25032b[_0x5029('0x29')][_0x5029('0x2a')]};});_0xe5313e[_0x5029('0x2b')]=_[_0x5029('0x26')](_0x2cedf6,_0x5029('0x23'));_0xe5313e[_0x5029('0x2c')]=_[_0x5029('0x2d')](_0x4a24b9[_0x5029('0x2c')]);_0xe5313e[_0x5029('0x2e')]=_['intersection'](_0xe5313e[_0x5029('0x2b')],_0xe5313e['query']);_0x251f99[_0x5029('0x2f')]=_['intersection'](_0xe5313e['model'],qs[_0x5029('0x30')](_0x4a24b9[_0x5029('0x2c')][_0x5029('0x30')]));_0x251f99['attributes']=_0x251f99[_0x5029('0x2f')][_0x5029('0x31')]?_0x251f99[_0x5029('0x2f')]:_0xe5313e[_0x5029('0x2b')];if(!_0x4a24b9[_0x5029('0x2c')][_0x5029('0x32')](_0x5029('0x33'))){_0x251f99[_0x5029('0x1a')]=qs[_0x5029('0x1a')](_0x4a24b9['query'][_0x5029('0x1a')]);_0x251f99[_0x5029('0x18')]=qs[_0x5029('0x18')](_0x4a24b9[_0x5029('0x2c')]['offset']);}_0x251f99[_0x5029('0x34')]=qs[_0x5029('0x35')](_0x4a24b9[_0x5029('0x2c')]['sort']);_0x251f99['where']=qs[_0x5029('0x2e')](_[_0x5029('0x36')](_0x4a24b9['query'],_0xe5313e['filters']),_0x2cedf6);if(_0x4a24b9[_0x5029('0x2c')][_0x5029('0x37')]){_0x251f99[_0x5029('0x38')]=_[_0x5029('0x39')](_0x251f99[_0x5029('0x38')],{'$or':_[_0x5029('0x26')](_0x2cedf6,function(_0x3cb84e){if(_0x3cb84e[_0x5029('0x29')]!==_0x5029('0x3a')){var _0x3effa4={};_0x3effa4[_0x3cb84e[_0x5029('0x23')]]={'$like':'%'+_0x4a24b9[_0x5029('0x2c')][_0x5029('0x37')]+'%'};return _0x3effa4;}})});}_0x251f99=_[_0x5029('0x39')]({},_0x251f99,_0x4a24b9['options']);var _0x57c2b5={'where':_0x251f99[_0x5029('0x38')]};return db[_0x5029('0x3b')][_0x5029('0x1b')](_0x57c2b5)['then'](function(_0x32d8a3){_0x4b6f92[_0x5029('0x1b')]=_0x32d8a3;if(_0x4a24b9['query'][_0x5029('0x3c')]){_0x251f99['include']=[{'all':!![]}];}return db[_0x5029('0x3b')]['findAll'](_0x251f99);})[_0x5029('0x20')](function(_0x359838){_0x4b6f92[_0x5029('0x3d')]=_0x359838;return _0x4b6f92;})[_0x5029('0x20')](respondWithFilteredResult(_0x32da06,_0x251f99))[_0x5029('0x3e')](handleError(_0x32da06,null));};exports[_0x5029('0x3f')]=function(_0x4b2219,_0x1021ea){var _0x2ae047={'raw':![],'where':{'id':_0x4b2219[_0x5029('0x40')]['id']}},_0x5a3e4d={};_0x5a3e4d[_0x5029('0x2b')]=_[_0x5029('0x2d')](db[_0x5029('0x3b')][_0x5029('0x27')]);_0x5a3e4d[_0x5029('0x2c')]=_['keys'](_0x4b2219[_0x5029('0x2c')]);_0x5a3e4d[_0x5029('0x2e')]=_[_0x5029('0x41')](_0x5a3e4d[_0x5029('0x2b')],_0x5a3e4d[_0x5029('0x2c')]);_0x2ae047['attributes']=_[_0x5029('0x41')](_0x5a3e4d[_0x5029('0x2b')],qs[_0x5029('0x30')](_0x4b2219[_0x5029('0x2c')][_0x5029('0x30')]));_0x2ae047[_0x5029('0x2f')]=_0x2ae047[_0x5029('0x2f')][_0x5029('0x31')]?_0x2ae047[_0x5029('0x2f')]:_0x5a3e4d['model'];if(_0x4b2219[_0x5029('0x2c')][_0x5029('0x3c')]){_0x2ae047[_0x5029('0x42')]=[{'all':!![]}];}_0x2ae047=_[_0x5029('0x39')]({},_0x2ae047,_0x4b2219['options']);return db['Integration'][_0x5029('0x43')](_0x2ae047)[_0x5029('0x20')](handleEntityNotFound(_0x1021ea,null))[_0x5029('0x20')](respondWithResult(_0x1021ea,null))[_0x5029('0x3e')](handleError(_0x1021ea,null));};exports[_0x5029('0x44')]=function(_0x3dfc08,_0x2bb7fc){return db[_0x5029('0x3b')][_0x5029('0x44')](_0x3dfc08[_0x5029('0x45')],{})[_0x5029('0x20')](respondWithResult(_0x2bb7fc,0xc9))[_0x5029('0x3e')](handleError(_0x2bb7fc,null));};exports[_0x5029('0x1f')]=function(_0x18f1f5,_0x3168bd){if(_0x18f1f5[_0x5029('0x45')]['id']){delete _0x18f1f5[_0x5029('0x45')]['id'];}return db[_0x5029('0x3b')][_0x5029('0x43')]({'where':{'id':_0x18f1f5[_0x5029('0x40')]['id']}})[_0x5029('0x20')](handleEntityNotFound(_0x3168bd,null))['then'](saveUpdates(_0x18f1f5[_0x5029('0x45')],null))['then'](respondWithResult(_0x3168bd,null))[_0x5029('0x3e')](handleError(_0x3168bd,null));};exports[_0x5029('0x21')]=function(_0x4d788a,_0x5343c6){return db[_0x5029('0x3b')]['find']({'where':{'id':_0x4d788a['params']['id']}})[_0x5029('0x20')](handleEntityNotFound(_0x5343c6,null))[_0x5029('0x20')](removeEntity(_0x5343c6,null))[_0x5029('0x3e')](handleError(_0x5343c6,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(_0x348860,_0x4531f6){var _0x2fc2ad=function(_0x3b449f){while(--_0x3b449f){_0x348860['push'](_0x348860['shift']());}};_0x2fc2ad(++_0x4531f6);}(_0x5fab,0x177));var _0xb5fa=function(_0x17541e,_0x46df72){_0x17541e=_0x17541e-0x0;var _0x1c17eb=_0x5fab[_0x17541e];return _0x1c17eb;};'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 c8eb8f0..bb5e928 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 _0x6aca=['Integration','integrations','../../config/logger','moment','bluebird','request-promise','path','rimraf','./integration.attributes','exports'];(function(_0x10ffac,_0x324125){var _0xb0cf92=function(_0x1129a7){while(--_0x1129a7){_0x10ffac['push'](_0x10ffac['shift']());}};_0xb0cf92(++_0x324125);}(_0x6aca,0x1a6));var _0xa6ac=function(_0x114c53,_0x2249c6){_0x114c53=_0x114c53-0x0;var _0x4e0c14=_0x6aca[_0x114c53];return _0x4e0c14;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xa6ac('0x0'))('api');var moment=require(_0xa6ac('0x1'));var BPromise=require(_0xa6ac('0x2'));var rp=require(_0xa6ac('0x3'));var fs=require('fs');var path=require(_0xa6ac('0x4'));var rimraf=require(_0xa6ac('0x5'));var config=require('../../config/environment');var attributes=require(_0xa6ac('0x6'));module[_0xa6ac('0x7')]=function(_0x3c6825,_0x240908){return _0x3c6825['define'](_0xa6ac('0x8'),attributes,{'tableName':_0xa6ac('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x558b=['integrations','lodash','api','moment','bluebird','rimraf','../../config/environment','./integration.attributes','exports','Integration'];(function(_0x38c6e7,_0x387df2){var _0x37114b=function(_0x2aa963){while(--_0x2aa963){_0x38c6e7['push'](_0x38c6e7['shift']());}};_0x37114b(++_0x387df2);}(_0x558b,0x155));var _0xb558=function(_0x5ef23b,_0x5aad13){_0x5ef23b=_0x5ef23b-0x0;var _0x5ce885=_0x558b[_0x5ef23b];return _0x5ce885;};'use strict';var _=require(_0xb558('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xb558('0x1'));var moment=require(_0xb558('0x2'));var BPromise=require(_0xb558('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xb558('0x4'));var config=require(_0xb558('0x5'));var attributes=require(_0xb558('0x6'));module[_0xb558('0x7')]=function(_0x16378a,_0x3973a8){return _0x16378a['define'](_0xb558('0x8'),attributes,{'tableName':_0xb558('0x9'),'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 1d12d47..5eaf9f2 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 _0x9f0e=['../../config/environment','jayson/promise','request','then','info','Integration,\x20%s,\x20%s','request\x20sent','debug','Integration,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc'];(function(_0x3c33a8,_0x211e5d){var _0x155ba4=function(_0x2cf20b){while(--_0x2cf20b){_0x3c33a8['push'](_0x3c33a8['shift']());}};_0x155ba4(++_0x211e5d);}(_0x9f0e,0x116));var _0xe9f0=function(_0xd3ca41,_0x511a34){_0xd3ca41=_0xd3ca41-0x0;var _0x4e5f1d=_0x9f0e[_0xd3ca41];return _0x4e5f1d;};'use strict';var _=require(_0xe9f0('0x0'));var util=require(_0xe9f0('0x1'));var moment=require(_0xe9f0('0x2'));var BPromise=require(_0xe9f0('0x3'));var rs=require(_0xe9f0('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xe9f0('0x5'));var logger=require(_0xe9f0('0x6'))(_0xe9f0('0x7'));var config=require(_0xe9f0('0x8'));var jayson=require(_0xe9f0('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3a17b3,_0x167198,_0xe64a79){return new BPromise(function(_0x4be6a6,_0xf4a256){return client[_0xe9f0('0xa')](_0x3a17b3,_0xe64a79)[_0xe9f0('0xb')](function(_0x3386a8){logger[_0xe9f0('0xc')](_0xe9f0('0xd'),_0x167198,_0xe9f0('0xe'));logger[_0xe9f0('0xf')](_0xe9f0('0x10'),_0x167198,'request\x20sent',JSON[_0xe9f0('0x11')](_0x3386a8));if(_0x3386a8[_0xe9f0('0x12')]){if(_0x3386a8[_0xe9f0('0x12')]['code']===0x1f4){logger[_0xe9f0('0x12')]('Integration,\x20%s,\x20%s',_0x167198,_0x3386a8[_0xe9f0('0x12')][_0xe9f0('0x13')]);return _0xf4a256(_0x3386a8[_0xe9f0('0x12')][_0xe9f0('0x13')]);}logger['error'](_0xe9f0('0xd'),_0x167198,_0x3386a8['error'][_0xe9f0('0x13')]);return _0x4be6a6(_0x3386a8[_0xe9f0('0x12')][_0xe9f0('0x13')]);}else{logger['info'](_0xe9f0('0xd'),_0x167198,_0xe9f0('0xe'));_0x4be6a6(_0x3386a8[_0xe9f0('0x14')]['message']);}})[_0xe9f0('0x15')](function(_0x1e16e0){logger[_0xe9f0('0x12')](_0xe9f0('0xd'),_0x167198,_0x1e16e0);_0xf4a256(_0x1e16e0);});});} \ No newline at end of file +var _0x9f0e=['../../config/environment','jayson/promise','request','then','info','Integration,\x20%s,\x20%s','request\x20sent','debug','Integration,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc'];(function(_0x22a82b,_0x327c67){var _0x5b5582=function(_0x939782){while(--_0x939782){_0x22a82b['push'](_0x22a82b['shift']());}};_0x5b5582(++_0x327c67);}(_0x9f0e,0x116));var _0xe9f0=function(_0x1f6851,_0x45a745){_0x1f6851=_0x1f6851-0x0;var _0x42aed9=_0x9f0e[_0x1f6851];return _0x42aed9;};'use strict';var _=require(_0xe9f0('0x0'));var util=require(_0xe9f0('0x1'));var moment=require(_0xe9f0('0x2'));var BPromise=require(_0xe9f0('0x3'));var rs=require(_0xe9f0('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xe9f0('0x5'));var logger=require(_0xe9f0('0x6'))(_0xe9f0('0x7'));var config=require(_0xe9f0('0x8'));var jayson=require(_0xe9f0('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3a17b3,_0x167198,_0xe64a79){return new BPromise(function(_0x4be6a6,_0xf4a256){return client[_0xe9f0('0xa')](_0x3a17b3,_0xe64a79)[_0xe9f0('0xb')](function(_0x3386a8){logger[_0xe9f0('0xc')](_0xe9f0('0xd'),_0x167198,_0xe9f0('0xe'));logger[_0xe9f0('0xf')](_0xe9f0('0x10'),_0x167198,'request\x20sent',JSON[_0xe9f0('0x11')](_0x3386a8));if(_0x3386a8[_0xe9f0('0x12')]){if(_0x3386a8[_0xe9f0('0x12')]['code']===0x1f4){logger[_0xe9f0('0x12')]('Integration,\x20%s,\x20%s',_0x167198,_0x3386a8[_0xe9f0('0x12')][_0xe9f0('0x13')]);return _0xf4a256(_0x3386a8[_0xe9f0('0x12')][_0xe9f0('0x13')]);}logger['error'](_0xe9f0('0xd'),_0x167198,_0x3386a8['error'][_0xe9f0('0x13')]);return _0x4be6a6(_0x3386a8[_0xe9f0('0x12')][_0xe9f0('0x13')]);}else{logger['info'](_0xe9f0('0xd'),_0x167198,_0xe9f0('0xe'));_0x4be6a6(_0x3386a8[_0xe9f0('0x14')]['message']);}})[_0xe9f0('0x15')](function(_0x1e16e0){logger[_0xe9f0('0x12')](_0xe9f0('0xd'),_0x167198,_0x1e16e0);_0xf4a256(_0x1e16e0);});});} \ No newline at end of file diff --git a/server/api/integrationReport/index.js b/server/api/integrationReport/index.js index 5166a99..81aca84 100644 --- a/server/api/integrationReport/index.js +++ b/server/api/integrationReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7880=['Router','fs-extra','../../components/interaction/service','../../config/environment','./integrationReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','create','put','delete','destroy','exports','util','path','connect-timeout','express'];(function(_0x1b201b,_0x59d9b3){var _0x3fed56=function(_0x26329a){while(--_0x26329a){_0x1b201b['push'](_0x1b201b['shift']());}};_0x3fed56(++_0x59d9b3);}(_0x7880,0x1f4));var _0x0788=function(_0x380a3f,_0x202483){_0x380a3f=_0x380a3f-0x0;var _0x2b4eca=_0x7880[_0x380a3f];return _0x2b4eca;};'use strict';var multer=require('multer');var util=require(_0x0788('0x0'));var path=require(_0x0788('0x1'));var timeout=require(_0x0788('0x2'));var express=require(_0x0788('0x3'));var router=express[_0x0788('0x4')]();var fs_extra=require(_0x0788('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x0788('0x6'));var config=require(_0x0788('0x7'));var controller=require(_0x0788('0x8'));router[_0x0788('0x9')]('/',auth[_0x0788('0xa')](),controller[_0x0788('0xb')]);router[_0x0788('0x9')](_0x0788('0xc'),auth[_0x0788('0xa')](),controller[_0x0788('0xd')]);router['get'](_0x0788('0xe'),auth['isAuthenticated'](),controller[_0x0788('0xf')]);router['post']('/',auth[_0x0788('0xa')](),controller[_0x0788('0x10')]);router[_0x0788('0x11')](_0x0788('0xe'),auth[_0x0788('0xa')](),controller['update']);router[_0x0788('0x12')](_0x0788('0xe'),auth[_0x0788('0xa')](),controller[_0x0788('0x13')]);module[_0x0788('0x14')]=router; \ No newline at end of file +var _0xba34=['exports','multer','util','path','connect-timeout','express','../../components/interaction/service','../../config/environment','./integrationReport.controller','get','isAuthenticated','index','describe','/:id','show','post','create','put','update','delete'];(function(_0x500731,_0x18d0e4){var _0x24b1b3=function(_0x349ac1){while(--_0x349ac1){_0x500731['push'](_0x500731['shift']());}};_0x24b1b3(++_0x18d0e4);}(_0xba34,0x119));var _0x4ba3=function(_0x9d3e5e,_0x1336eb){_0x9d3e5e=_0x9d3e5e-0x0;var _0x23e350=_0xba34[_0x9d3e5e];return _0x23e350;};'use strict';var multer=require(_0x4ba3('0x0'));var util=require(_0x4ba3('0x1'));var path=require(_0x4ba3('0x2'));var timeout=require(_0x4ba3('0x3'));var express=require(_0x4ba3('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x4ba3('0x5'));var config=require(_0x4ba3('0x6'));var controller=require(_0x4ba3('0x7'));router[_0x4ba3('0x8')]('/',auth[_0x4ba3('0x9')](),controller[_0x4ba3('0xa')]);router[_0x4ba3('0x8')]('/describe',auth[_0x4ba3('0x9')](),controller[_0x4ba3('0xb')]);router[_0x4ba3('0x8')](_0x4ba3('0xc'),auth[_0x4ba3('0x9')](),controller[_0x4ba3('0xd')]);router[_0x4ba3('0xe')]('/',auth[_0x4ba3('0x9')](),controller[_0x4ba3('0xf')]);router[_0x4ba3('0x10')](_0x4ba3('0xc'),auth['isAuthenticated'](),controller[_0x4ba3('0x11')]);router[_0x4ba3('0x12')]('/:id',auth[_0x4ba3('0x9')](),controller['destroy']);module[_0x4ba3('0x13')]=router; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.attributes.js b/server/api/integrationReport/integrationReport.attributes.js index 30bc9a2..e4d73a9 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 _0x2332=['exports','STRING','INTEGER','DATE','BOOLEAN','TEXT','ENUM','SENT','RECEIVED','FAILED','sequelize'];(function(_0x3faae3,_0x2c7fde){var _0x46acdc=function(_0x541172){while(--_0x541172){_0x3faae3['push'](_0x3faae3['shift']());}};_0x46acdc(++_0x2c7fde);}(_0x2332,0x175));var _0x2233=function(_0x58755a,_0x151ce8){_0x58755a=_0x58755a-0x0;var _0x830a6f=_0x2332[_0x58755a];return _0x830a6f;};'use strict';var Sequelize=require(_0x2233('0x0'));module[_0x2233('0x1')]={'integration':{'type':Sequelize[_0x2233('0x2')]},'eventChannel':{'type':Sequelize['STRING']},'exitStatus':{'type':Sequelize['STRING']},'ticketId':{'type':Sequelize[_0x2233('0x2')]},'integrationId':{'type':Sequelize[_0x2233('0x3')]},'contacts':{'type':Sequelize[_0x2233('0x2')]},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize['STRING']},'interface':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x2233('0x2')]},'agentcalledAt':{'type':Sequelize[_0x2233('0x4')]},'agentconnectAt':{'type':Sequelize[_0x2233('0x4')]},'holdtime':{'type':Sequelize[_0x2233('0x3')]},'agentcomplete':{'type':Sequelize[_0x2233('0x5')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0x2233('0x4')]},'talktime':{'type':Sequelize[_0x2233('0x3')]},'agentacw':{'type':Sequelize[_0x2233('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x2233('0x3')]},'reason':{'type':Sequelize['STRING']},'agentringnoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0x2233('0x4')]},'agentdump':{'type':Sequelize[_0x2233('0x5')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0x2233('0x4')]},'lastevent':{'type':Sequelize[_0x2233('0x2')]},'channel':{'type':Sequelize[_0x2233('0x2')]},'channelstate':{'type':Sequelize[_0x2233('0x3')]},'channelstatedesc':{'type':Sequelize[_0x2233('0x2')]},'connectedlinenum':{'type':Sequelize[_0x2233('0x2')]},'connectedlinename':{'type':Sequelize[_0x2233('0x2')]},'language':{'type':Sequelize[_0x2233('0x2')]},'accountcode':{'type':Sequelize[_0x2233('0x2')]},'context':{'type':Sequelize[_0x2233('0x2')]},'exten':{'type':Sequelize[_0x2233('0x2')]},'priority':{'type':Sequelize[_0x2233('0x2')]},'destchannel':{'type':Sequelize[_0x2233('0x2')]},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize[_0x2233('0x2')]},'destcalleridname':{'type':Sequelize[_0x2233('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0x2233('0x2')]},'destconnectedlinename':{'type':Sequelize[_0x2233('0x2')]},'destlanguage':{'type':Sequelize[_0x2233('0x2')]},'destaccountcode':{'type':Sequelize[_0x2233('0x2')]},'destcontext':{'type':Sequelize[_0x2233('0x2')]},'destexten':{'type':Sequelize[_0x2233('0x2')]},'destpriority':{'type':Sequelize[_0x2233('0x2')]},'destuniqueid':{'type':Sequelize[_0x2233('0x2')]},'messageId':{'type':Sequelize['STRING']},'inReplyTo':{'type':Sequelize['STRING']},'subject':{'type':Sequelize[_0x2233('0x2')]},'from':{'type':Sequelize[_0x2233('0x2')]},'to':{'type':Sequelize['STRING']},'cc':{'type':Sequelize[_0x2233('0x2')]},'attachment':{'type':Sequelize[_0x2233('0x6')]},'html':{'type':Sequelize[_0x2233('0x6')]},'text':{'type':Sequelize[_0x2233('0x6')]},'status':{'type':Sequelize[_0x2233('0x7')](_0x2233('0x8'),'SENDING',_0x2233('0x9'),_0x2233('0xa'))},'url':{'type':Sequelize[_0x2233('0x2')]},'app':{'type':Sequelize['STRING']},'appdata':{'type':Sequelize[_0x2233('0x2')]},'projectId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x83af=['TEXT','ENUM','SENDING','FAILED','sequelize','STRING','DATE','INTEGER','BOOLEAN'];(function(_0x293c3d,_0xd89435){var _0x53cc1d=function(_0x46ecae){while(--_0x46ecae){_0x293c3d['push'](_0x293c3d['shift']());}};_0x53cc1d(++_0xd89435);}(_0x83af,0x1d8));var _0xf83a=function(_0x3ba2a3,_0x34d0ba){_0x3ba2a3=_0x3ba2a3-0x0;var _0x2d0e38=_0x83af[_0x3ba2a3];return _0x2d0e38;};'use strict';var Sequelize=require(_0xf83a('0x0'));module['exports']={'integration':{'type':Sequelize[_0xf83a('0x1')]},'eventChannel':{'type':Sequelize['STRING']},'exitStatus':{'type':Sequelize[_0xf83a('0x1')]},'ticketId':{'type':Sequelize[_0xf83a('0x1')]},'integrationId':{'type':Sequelize['INTEGER']},'contacts':{'type':Sequelize[_0xf83a('0x1')]},'uniqueid':{'type':Sequelize[_0xf83a('0x1')]},'calleridnum':{'type':Sequelize[_0xf83a('0x1')]},'calleridname':{'type':Sequelize[_0xf83a('0x1')]},'queue':{'type':Sequelize[_0xf83a('0x1')]},'interface':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0xf83a('0x1')]},'agentcalledAt':{'type':Sequelize[_0xf83a('0x2')]},'agentconnectAt':{'type':Sequelize[_0xf83a('0x2')]},'holdtime':{'type':Sequelize[_0xf83a('0x3')]},'agentcomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0xf83a('0x2')]},'talktime':{'type':Sequelize['INTEGER']},'agentacw':{'type':Sequelize[_0xf83a('0x4')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0xf83a('0x3')]},'reason':{'type':Sequelize[_0xf83a('0x1')]},'agentringnoanswer':{'type':Sequelize[_0xf83a('0x4')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0xf83a('0x2')]},'agentdump':{'type':Sequelize[_0xf83a('0x4')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0xf83a('0x2')]},'lastevent':{'type':Sequelize[_0xf83a('0x1')]},'channel':{'type':Sequelize[_0xf83a('0x1')]},'channelstate':{'type':Sequelize[_0xf83a('0x3')]},'channelstatedesc':{'type':Sequelize[_0xf83a('0x1')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0xf83a('0x1')]},'accountcode':{'type':Sequelize[_0xf83a('0x1')]},'context':{'type':Sequelize[_0xf83a('0x1')]},'exten':{'type':Sequelize[_0xf83a('0x1')]},'priority':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize[_0xf83a('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0xf83a('0x1')]},'destcalleridnum':{'type':Sequelize[_0xf83a('0x1')]},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0xf83a('0x1')]},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize[_0xf83a('0x1')]},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize[_0xf83a('0x1')]},'destpriority':{'type':Sequelize[_0xf83a('0x1')]},'destuniqueid':{'type':Sequelize[_0xf83a('0x1')]},'messageId':{'type':Sequelize[_0xf83a('0x1')]},'inReplyTo':{'type':Sequelize[_0xf83a('0x1')]},'subject':{'type':Sequelize[_0xf83a('0x1')]},'from':{'type':Sequelize[_0xf83a('0x1')]},'to':{'type':Sequelize[_0xf83a('0x1')]},'cc':{'type':Sequelize[_0xf83a('0x1')]},'attachment':{'type':Sequelize[_0xf83a('0x5')]},'html':{'type':Sequelize[_0xf83a('0x5')]},'text':{'type':Sequelize[_0xf83a('0x5')]},'status':{'type':Sequelize[_0xf83a('0x6')]('SENT',_0xf83a('0x7'),'RECEIVED',_0xf83a('0x8'))},'url':{'type':Sequelize[_0xf83a('0x1')]},'app':{'type':Sequelize[_0xf83a('0x1')]},'appdata':{'type':Sequelize[_0xf83a('0x1')]},'projectId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.controller.js b/server/api/integrationReport/integrationReport.controller.js index 08e8acd..44cfaad 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 _0x2068=['../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','update','then','destroy','name','send','index','map','IntegrationReport','rawAttributes','fieldName','type','key','keys','filters','intersection','model','query','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','find','create','body','describe','fast-json-patch','request-promise','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'];(function(_0x522520,_0x5c44d7){var _0x2e73ad=function(_0x572d82){while(--_0x572d82){_0x522520['push'](_0x522520['shift']());}};_0x2e73ad(++_0x5c44d7);}(_0x2068,0xca));var _0x8206=function(_0x2d95ee,_0x24d2e0){_0x2d95ee=_0x2d95ee-0x0;var _0x313935=_0x2068[_0x2d95ee];return _0x313935;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x8206('0x0'));var rp=require(_0x8206('0x1'));var moment=require(_0x8206('0x2'));var BPromise=require(_0x8206('0x3'));var Mustache=require(_0x8206('0x4'));var util=require(_0x8206('0x5'));var path=require(_0x8206('0x6'));var sox=require(_0x8206('0x7'));var csv=require(_0x8206('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8206('0x9'));var _=require(_0x8206('0xa'));var squel=require(_0x8206('0xb'));var crypto=require(_0x8206('0xc'));var jsforce=require(_0x8206('0xd'));var deskjs=require(_0x8206('0xe'));var toCsv=require(_0x8206('0x8'));var querystring=require(_0x8206('0xf'));var Papa=require(_0x8206('0x10'));var Redis=require(_0x8206('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x8206('0x12'));var hardwareService=require(_0x8206('0x13'));var logger=require(_0x8206('0x14'))(_0x8206('0x15'));var utils=require(_0x8206('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x8206('0x17'))['db'];function respondWithStatusCode(_0x210183,_0x36fa80){_0x36fa80=_0x36fa80||0xcc;return function(_0x4cb8ba){if(_0x4cb8ba){return _0x210183[_0x8206('0x18')](_0x36fa80);}return _0x210183[_0x8206('0x19')](_0x36fa80)[_0x8206('0x1a')]();};}function respondWithResult(_0x5601dd,_0x58f629){_0x58f629=_0x58f629||0xc8;return function(_0x4b93e6){if(_0x4b93e6){return _0x5601dd[_0x8206('0x19')](_0x58f629)[_0x8206('0x1b')](_0x4b93e6);}};}function respondWithFilteredResult(_0x322da1,_0x2931f2){return function(_0x55f0c4){if(_0x55f0c4){var _0x2b856c=typeof _0x2931f2[_0x8206('0x1c')]===_0x8206('0x1d')&&typeof _0x2931f2['limit']===_0x8206('0x1d');var _0x3e4813=_0x55f0c4[_0x8206('0x1e')];var _0x5b5963=_0x2b856c?0x0:_0x2931f2[_0x8206('0x1c')];var _0x4007ad=_0x2b856c?_0x55f0c4[_0x8206('0x1e')]:_0x2931f2[_0x8206('0x1c')]+_0x2931f2[_0x8206('0x1f')];var _0x241183;if(_0x4007ad>=_0x3e4813){_0x4007ad=_0x3e4813;_0x241183=0xc8;}else{_0x241183=0xce;}_0x322da1['status'](_0x241183);return _0x322da1[_0x8206('0x20')](_0x8206('0x21'),_0x5b5963+'-'+_0x4007ad+'/'+_0x3e4813)[_0x8206('0x1b')](_0x55f0c4);}return null;};}function patchUpdates(_0x125422){return function(_0x1974b4){try{jsonpatch[_0x8206('0x22')](_0x1974b4,_0x125422,!![]);}catch(_0x499232){return BPromise['reject'](_0x499232);}return _0x1974b4['save']();};}function saveUpdates(_0x538783,_0x59ff09){return function(_0x3c4e45){if(_0x3c4e45){return _0x3c4e45[_0x8206('0x23')](_0x538783)[_0x8206('0x24')](function(_0x2aee45){return _0x2aee45;});}return null;};}function removeEntity(_0x187be0,_0x52fba4){return function(_0x27b897){if(_0x27b897){return _0x27b897[_0x8206('0x25')]()['then'](function(){_0x187be0['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x9d0ed2,_0x284eff){return function(_0x5794f3){if(!_0x5794f3){_0x9d0ed2['sendStatus'](0x194);}return _0x5794f3;};}function handleError(_0x4f6633,_0x440262){_0x440262=_0x440262||0x1f4;return function(_0x472304){logger['error'](_0x472304['stack']);if(_0x472304[_0x8206('0x26')]){delete _0x472304[_0x8206('0x26')];}_0x4f6633['status'](_0x440262)[_0x8206('0x27')](_0x472304);};}exports[_0x8206('0x28')]=function(_0x35e50c,_0x52c5a1){var _0x4376fc={},_0xee0b67={},_0x29862f={'count':0x0,'rows':[]};var _0x477e2a=_[_0x8206('0x29')](db[_0x8206('0x2a')][_0x8206('0x2b')],function(_0x3916b8){return{'name':_0x3916b8[_0x8206('0x2c')],'type':_0x3916b8[_0x8206('0x2d')][_0x8206('0x2e')]};});_0xee0b67['model']=_[_0x8206('0x29')](_0x477e2a,_0x8206('0x26'));_0xee0b67['query']=_[_0x8206('0x2f')](_0x35e50c['query']);_0xee0b67[_0x8206('0x30')]=_[_0x8206('0x31')](_0xee0b67[_0x8206('0x32')],_0xee0b67[_0x8206('0x33')]);_0x4376fc['attributes']=_['intersection'](_0xee0b67[_0x8206('0x32')],qs[_0x8206('0x34')](_0x35e50c[_0x8206('0x33')][_0x8206('0x34')]));_0x4376fc[_0x8206('0x35')]=_0x4376fc['attributes'][_0x8206('0x36')]?_0x4376fc[_0x8206('0x35')]:_0xee0b67['model'];if(!_0x35e50c[_0x8206('0x33')][_0x8206('0x37')](_0x8206('0x38'))){_0x4376fc[_0x8206('0x1f')]=qs['limit'](_0x35e50c[_0x8206('0x33')][_0x8206('0x1f')]);_0x4376fc[_0x8206('0x1c')]=qs[_0x8206('0x1c')](_0x35e50c[_0x8206('0x33')][_0x8206('0x1c')]);}_0x4376fc['order']=qs[_0x8206('0x39')](_0x35e50c[_0x8206('0x33')][_0x8206('0x39')]);_0x4376fc[_0x8206('0x3a')]=qs[_0x8206('0x30')](_[_0x8206('0x3b')](_0x35e50c['query'],_0xee0b67[_0x8206('0x30')]),_0x477e2a);if(_0x35e50c[_0x8206('0x33')][_0x8206('0x3c')]){_0x4376fc[_0x8206('0x3a')]=_[_0x8206('0x3d')](_0x4376fc[_0x8206('0x3a')],{'$or':_['map'](_0x477e2a,function(_0x392c31){if(_0x392c31['type']!==_0x8206('0x3e')){var _0x27a0c5={};_0x27a0c5[_0x392c31[_0x8206('0x26')]]={'$like':'%'+_0x35e50c[_0x8206('0x33')][_0x8206('0x3c')]+'%'};return _0x27a0c5;}})});}_0x4376fc=_['merge']({},_0x4376fc,_0x35e50c[_0x8206('0x3f')]);var _0x94177b={'where':_0x4376fc[_0x8206('0x3a')]};return db[_0x8206('0x2a')][_0x8206('0x1e')](_0x94177b)['then'](function(_0x55e5fe){_0x29862f['count']=_0x55e5fe;if(_0x35e50c['query'][_0x8206('0x40')]){_0x4376fc[_0x8206('0x41')]=[{'all':!![]}];}return db[_0x8206('0x2a')]['findAll'](_0x4376fc);})[_0x8206('0x24')](function(_0x5d8cce){_0x29862f[_0x8206('0x42')]=_0x5d8cce;return _0x29862f;})[_0x8206('0x24')](respondWithFilteredResult(_0x52c5a1,_0x4376fc))[_0x8206('0x43')](handleError(_0x52c5a1,null));};exports[_0x8206('0x44')]=function(_0x753707,_0x132551){var _0x2a8046={'raw':![],'where':{'id':_0x753707[_0x8206('0x45')]['id']}},_0x23e65e={};_0x23e65e[_0x8206('0x32')]=_[_0x8206('0x2f')](db['IntegrationReport']['rawAttributes']);_0x23e65e[_0x8206('0x33')]=_[_0x8206('0x2f')](_0x753707[_0x8206('0x33')]);_0x23e65e['filters']=_[_0x8206('0x31')](_0x23e65e['model'],_0x23e65e['query']);_0x2a8046[_0x8206('0x35')]=_[_0x8206('0x31')](_0x23e65e[_0x8206('0x32')],qs[_0x8206('0x34')](_0x753707[_0x8206('0x33')][_0x8206('0x34')]));_0x2a8046['attributes']=_0x2a8046[_0x8206('0x35')][_0x8206('0x36')]?_0x2a8046['attributes']:_0x23e65e['model'];if(_0x753707['query'][_0x8206('0x40')]){_0x2a8046[_0x8206('0x41')]=[{'all':!![]}];}_0x2a8046=_[_0x8206('0x3d')]({},_0x2a8046,_0x753707[_0x8206('0x3f')]);return db[_0x8206('0x2a')][_0x8206('0x46')](_0x2a8046)['then'](handleEntityNotFound(_0x132551,null))[_0x8206('0x24')](respondWithResult(_0x132551,null))[_0x8206('0x43')](handleError(_0x132551,null));};exports[_0x8206('0x47')]=function(_0x3d6b71,_0x5186af){return db[_0x8206('0x2a')][_0x8206('0x47')](_0x3d6b71[_0x8206('0x48')],{})[_0x8206('0x24')](respondWithResult(_0x5186af,0xc9))[_0x8206('0x43')](handleError(_0x5186af,null));};exports['update']=function(_0x49778b,_0x5b6f03){if(_0x49778b['body']['id']){delete _0x49778b[_0x8206('0x48')]['id'];}return db[_0x8206('0x2a')][_0x8206('0x46')]({'where':{'id':_0x49778b[_0x8206('0x45')]['id']}})[_0x8206('0x24')](handleEntityNotFound(_0x5b6f03,null))[_0x8206('0x24')](saveUpdates(_0x49778b[_0x8206('0x48')],null))[_0x8206('0x24')](respondWithResult(_0x5b6f03,null))[_0x8206('0x43')](handleError(_0x5b6f03,null));};exports[_0x8206('0x25')]=function(_0x1074a8,_0x3e9e2c){return db[_0x8206('0x2a')]['find']({'where':{'id':_0x1074a8[_0x8206('0x45')]['id']}})['then'](handleEntityNotFound(_0x3e9e2c,null))[_0x8206('0x24')](removeEntity(_0x3e9e2c,null))[_0x8206('0x43')](handleError(_0x3e9e2c,null));};exports[_0x8206('0x49')]=function(_0x5b66c5,_0x559598){return db[_0x8206('0x2a')][_0x8206('0x49')]()[_0x8206('0x24')](respondWithResult(_0x559598,null))[_0x8206('0x43')](handleError(_0x559598,null));}; \ No newline at end of file +var _0xd043=['moment','bluebird','mustache','path','to-csv','ejs','fs-extra','squel','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','update','destroy','then','error','stack','name','send','index','map','IntegrationReport','rawAttributes','fieldName','type','key','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','merge','where','VIRTUAL','includeAll','include','findAll','show','params','options','find','catch','create','body','describe','rimraf','zip-dir','fast-json-patch'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0xd043,0x8d));var _0x3d04=function(_0x416ad,_0x3797e5){_0x416ad=_0x416ad-0x0;var _0x160983=_0xd043[_0x416ad];return _0x160983;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3d04('0x0'));var zipdir=require(_0x3d04('0x1'));var jsonpatch=require(_0x3d04('0x2'));var rp=require('request-promise');var moment=require(_0x3d04('0x3'));var BPromise=require(_0x3d04('0x4'));var Mustache=require(_0x3d04('0x5'));var util=require('util');var path=require(_0x3d04('0x6'));var sox=require('sox');var csv=require(_0x3d04('0x7'));var ejs=require(_0x3d04('0x8'));var fs=require('fs');var fs_extra=require(_0x3d04('0x9'));var _=require('lodash');var squel=require(_0x3d04('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x3d04('0x7'));var querystring=require(_0x3d04('0xb'));var Papa=require(_0x3d04('0xc'));var Redis=require(_0x3d04('0xd'));var authService=require(_0x3d04('0xe'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3d04('0xf'));var logger=require(_0x3d04('0x10'))(_0x3d04('0x11'));var utils=require(_0x3d04('0x12'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x3d04('0x13'))['db'];function respondWithStatusCode(_0x3e2aaf,_0x810e45){_0x810e45=_0x810e45||0xcc;return function(_0xf8bcce){if(_0xf8bcce){return _0x3e2aaf['sendStatus'](_0x810e45);}return _0x3e2aaf[_0x3d04('0x14')](_0x810e45)[_0x3d04('0x15')]();};}function respondWithResult(_0x4d682b,_0xa1028e){_0xa1028e=_0xa1028e||0xc8;return function(_0x2ef41d){if(_0x2ef41d){return _0x4d682b['status'](_0xa1028e)[_0x3d04('0x16')](_0x2ef41d);}};}function respondWithFilteredResult(_0x3a27f8,_0x7f5074){return function(_0x5c17c0){if(_0x5c17c0){var _0x1b5594=typeof _0x7f5074['offset']===_0x3d04('0x17')&&typeof _0x7f5074[_0x3d04('0x18')]===_0x3d04('0x17');var _0x56f7ed=_0x5c17c0[_0x3d04('0x19')];var _0x23d8d2=_0x1b5594?0x0:_0x7f5074[_0x3d04('0x1a')];var _0x2c3631=_0x1b5594?_0x5c17c0[_0x3d04('0x19')]:_0x7f5074[_0x3d04('0x1a')]+_0x7f5074[_0x3d04('0x18')];var _0x1b27a8;if(_0x2c3631>=_0x56f7ed){_0x2c3631=_0x56f7ed;_0x1b27a8=0xc8;}else{_0x1b27a8=0xce;}_0x3a27f8[_0x3d04('0x14')](_0x1b27a8);return _0x3a27f8[_0x3d04('0x1b')](_0x3d04('0x1c'),_0x23d8d2+'-'+_0x2c3631+'/'+_0x56f7ed)[_0x3d04('0x16')](_0x5c17c0);}return null;};}function patchUpdates(_0x3af112){return function(_0x4c6ea7){try{jsonpatch[_0x3d04('0x1d')](_0x4c6ea7,_0x3af112,!![]);}catch(_0x4a2ca2){return BPromise['reject'](_0x4a2ca2);}return _0x4c6ea7['save']();};}function saveUpdates(_0x4b3252,_0x13b680){return function(_0x59b9f8){if(_0x59b9f8){return _0x59b9f8[_0x3d04('0x1e')](_0x4b3252)['then'](function(_0x340a34){return _0x340a34;});}return null;};}function removeEntity(_0x4968c6,_0x1fe466){return function(_0x83d2b){if(_0x83d2b){return _0x83d2b[_0x3d04('0x1f')]()[_0x3d04('0x20')](function(){_0x4968c6[_0x3d04('0x14')](0xcc)[_0x3d04('0x15')]();});}};}function handleEntityNotFound(_0x136c94,_0x145e60){return function(_0x3a9514){if(!_0x3a9514){_0x136c94['sendStatus'](0x194);}return _0x3a9514;};}function handleError(_0x274232,_0x463412){_0x463412=_0x463412||0x1f4;return function(_0x1f46ae){logger[_0x3d04('0x21')](_0x1f46ae[_0x3d04('0x22')]);if(_0x1f46ae['name']){delete _0x1f46ae[_0x3d04('0x23')];}_0x274232[_0x3d04('0x14')](_0x463412)[_0x3d04('0x24')](_0x1f46ae);};}exports[_0x3d04('0x25')]=function(_0x4f5421,_0x2064b8){var _0x3de9b4={},_0x409c51={},_0x1f7e98={'count':0x0,'rows':[]};var _0x2e097e=_[_0x3d04('0x26')](db[_0x3d04('0x27')][_0x3d04('0x28')],function(_0x2ab384){return{'name':_0x2ab384[_0x3d04('0x29')],'type':_0x2ab384[_0x3d04('0x2a')][_0x3d04('0x2b')]};});_0x409c51[_0x3d04('0x2c')]=_[_0x3d04('0x26')](_0x2e097e,_0x3d04('0x23'));_0x409c51['query']=_[_0x3d04('0x2d')](_0x4f5421[_0x3d04('0x2e')]);_0x409c51['filters']=_[_0x3d04('0x2f')](_0x409c51['model'],_0x409c51[_0x3d04('0x2e')]);_0x3de9b4[_0x3d04('0x30')]=_[_0x3d04('0x2f')](_0x409c51[_0x3d04('0x2c')],qs[_0x3d04('0x31')](_0x4f5421[_0x3d04('0x2e')]['fields']));_0x3de9b4[_0x3d04('0x30')]=_0x3de9b4[_0x3d04('0x30')][_0x3d04('0x32')]?_0x3de9b4['attributes']:_0x409c51[_0x3d04('0x2c')];if(!_0x4f5421[_0x3d04('0x2e')][_0x3d04('0x33')](_0x3d04('0x34'))){_0x3de9b4[_0x3d04('0x18')]=qs[_0x3d04('0x18')](_0x4f5421[_0x3d04('0x2e')]['limit']);_0x3de9b4['offset']=qs['offset'](_0x4f5421['query']['offset']);}_0x3de9b4[_0x3d04('0x35')]=qs[_0x3d04('0x36')](_0x4f5421[_0x3d04('0x2e')][_0x3d04('0x36')]);_0x3de9b4['where']=qs[_0x3d04('0x37')](_[_0x3d04('0x38')](_0x4f5421[_0x3d04('0x2e')],_0x409c51[_0x3d04('0x37')]),_0x2e097e);if(_0x4f5421[_0x3d04('0x2e')][_0x3d04('0x39')]){_0x3de9b4['where']=_[_0x3d04('0x3a')](_0x3de9b4[_0x3d04('0x3b')],{'$or':_['map'](_0x2e097e,function(_0x59f150){if(_0x59f150[_0x3d04('0x2a')]!==_0x3d04('0x3c')){var _0x1a4307={};_0x1a4307[_0x59f150[_0x3d04('0x23')]]={'$like':'%'+_0x4f5421['query'][_0x3d04('0x39')]+'%'};return _0x1a4307;}})});}_0x3de9b4=_['merge']({},_0x3de9b4,_0x4f5421['options']);var _0x4ae0c5={'where':_0x3de9b4['where']};return db[_0x3d04('0x27')]['count'](_0x4ae0c5)[_0x3d04('0x20')](function(_0x99ca07){_0x1f7e98[_0x3d04('0x19')]=_0x99ca07;if(_0x4f5421[_0x3d04('0x2e')][_0x3d04('0x3d')]){_0x3de9b4[_0x3d04('0x3e')]=[{'all':!![]}];}return db[_0x3d04('0x27')][_0x3d04('0x3f')](_0x3de9b4);})[_0x3d04('0x20')](function(_0x126a2e){_0x1f7e98['rows']=_0x126a2e;return _0x1f7e98;})['then'](respondWithFilteredResult(_0x2064b8,_0x3de9b4))['catch'](handleError(_0x2064b8,null));};exports[_0x3d04('0x40')]=function(_0x5f16c4,_0x205acb){var _0x46bd36={'raw':![],'where':{'id':_0x5f16c4[_0x3d04('0x41')]['id']}},_0xb17ed2={};_0xb17ed2[_0x3d04('0x2c')]=_[_0x3d04('0x2d')](db['IntegrationReport'][_0x3d04('0x28')]);_0xb17ed2['query']=_[_0x3d04('0x2d')](_0x5f16c4[_0x3d04('0x2e')]);_0xb17ed2[_0x3d04('0x37')]=_[_0x3d04('0x2f')](_0xb17ed2[_0x3d04('0x2c')],_0xb17ed2[_0x3d04('0x2e')]);_0x46bd36[_0x3d04('0x30')]=_[_0x3d04('0x2f')](_0xb17ed2[_0x3d04('0x2c')],qs[_0x3d04('0x31')](_0x5f16c4[_0x3d04('0x2e')][_0x3d04('0x31')]));_0x46bd36['attributes']=_0x46bd36[_0x3d04('0x30')]['length']?_0x46bd36['attributes']:_0xb17ed2[_0x3d04('0x2c')];if(_0x5f16c4[_0x3d04('0x2e')]['includeAll']){_0x46bd36[_0x3d04('0x3e')]=[{'all':!![]}];}_0x46bd36=_['merge']({},_0x46bd36,_0x5f16c4[_0x3d04('0x42')]);return db['IntegrationReport'][_0x3d04('0x43')](_0x46bd36)[_0x3d04('0x20')](handleEntityNotFound(_0x205acb,null))[_0x3d04('0x20')](respondWithResult(_0x205acb,null))[_0x3d04('0x44')](handleError(_0x205acb,null));};exports[_0x3d04('0x45')]=function(_0x4abf5f,_0x44a486){return db[_0x3d04('0x27')][_0x3d04('0x45')](_0x4abf5f[_0x3d04('0x46')],{})[_0x3d04('0x20')](respondWithResult(_0x44a486,0xc9))['catch'](handleError(_0x44a486,null));};exports['update']=function(_0x4990a4,_0x17cc43){if(_0x4990a4[_0x3d04('0x46')]['id']){delete _0x4990a4['body']['id'];}return db['IntegrationReport'][_0x3d04('0x43')]({'where':{'id':_0x4990a4['params']['id']}})[_0x3d04('0x20')](handleEntityNotFound(_0x17cc43,null))[_0x3d04('0x20')](saveUpdates(_0x4990a4[_0x3d04('0x46')],null))[_0x3d04('0x20')](respondWithResult(_0x17cc43,null))['catch'](handleError(_0x17cc43,null));};exports[_0x3d04('0x1f')]=function(_0x5caf2e,_0x319cfc){return db[_0x3d04('0x27')][_0x3d04('0x43')]({'where':{'id':_0x5caf2e['params']['id']}})[_0x3d04('0x20')](handleEntityNotFound(_0x319cfc,null))[_0x3d04('0x20')](removeEntity(_0x319cfc,null))[_0x3d04('0x44')](handleError(_0x319cfc,null));};exports[_0x3d04('0x47')]=function(_0x479e18,_0x4ee44e){return db[_0x3d04('0x27')]['describe']()[_0x3d04('0x20')](respondWithResult(_0x4ee44e,null))[_0x3d04('0x44')](handleError(_0x4ee44e,null));}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.model.js b/server/api/integrationReport/integrationReport.model.js index 0f81fff..2ee9a03 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 _0x74ac=['define','IntegrationReport','report_integration','util','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x39c87e,_0x126c50){var _0x274746=function(_0x52221d){while(--_0x52221d){_0x39c87e['push'](_0x39c87e['shift']());}};_0x274746(++_0x126c50);}(_0x74ac,0x85));var _0xc74a=function(_0x2d0cb4,_0x563b99){_0x2d0cb4=_0x2d0cb4-0x0;var _0x418812=_0x74ac[_0x2d0cb4];return _0x418812;};'use strict';var _=require('lodash');var util=require(_0xc74a('0x0'));var logger=require('../../config/logger')(_0xc74a('0x1'));var moment=require(_0xc74a('0x2'));var BPromise=require(_0xc74a('0x3'));var rp=require(_0xc74a('0x4'));var fs=require('fs');var path=require(_0xc74a('0x5'));var rimraf=require(_0xc74a('0x6'));var config=require('../../config/environment');var attributes=require('./integrationReport.attributes');module['exports']=function(_0x221c14,_0x4ebf0e){return _0x221c14[_0xc74a('0x7')](_0xc74a('0x8'),attributes,{'tableName':_0xc74a('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0524=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./integrationReport.attributes','exports','define','IntegrationReport','report_integration'];(function(_0x4b0290,_0x188c34){var _0x4bd9f4=function(_0x357f3f){while(--_0x357f3f){_0x4b0290['push'](_0x4b0290['shift']());}};_0x4bd9f4(++_0x188c34);}(_0x0524,0x1b2));var _0x4052=function(_0x569fef,_0x49c37a){_0x569fef=_0x569fef-0x0;var _0x11f20b=_0x0524[_0x569fef];return _0x11f20b;};'use strict';var _=require(_0x4052('0x0'));var util=require(_0x4052('0x1'));var logger=require(_0x4052('0x2'))(_0x4052('0x3'));var moment=require(_0x4052('0x4'));var BPromise=require(_0x4052('0x5'));var rp=require(_0x4052('0x6'));var fs=require('fs');var path=require(_0x4052('0x7'));var rimraf=require(_0x4052('0x8'));var config=require('../../config/environment');var attributes=require(_0x4052('0x9'));module[_0x4052('0xa')]=function(_0x4600c1,_0x44a56c){return _0x4600c1[_0x4052('0xb')](_0x4052('0xc'),attributes,{'tableName':_0x4052('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 b0c8378..4adadfd 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(_0x6131cd,_0x4c26a1){var _0x47e916=function(_0x1f2bce){while(--_0x1f2bce){_0x6131cd['push'](_0x6131cd['shift']());}};_0x47e916(++_0x4c26a1);}(_0x814b,0x1a2));var _0xb814=function(_0x2d0d9f,_0x22c0d8){_0x2d0d9f=_0x2d0d9f-0x0;var _0x30243d=_0x814b[_0x2d0d9f];return _0x30243d;};'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 _0x3f8a=['catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','IntegrationReport,\x20%s,\x20%s','request\x20sent','debug','IntegrationReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x3f8a,0x1d5));var _0xa3f8=function(_0x6fa759,_0xf81f7d){_0x6fa759=_0x6fa759-0x0;var _0x19fd29=_0x3f8a[_0x6fa759];return _0x19fd29;};'use strict';var _=require(_0xa3f8('0x0'));var util=require(_0xa3f8('0x1'));var moment=require(_0xa3f8('0x2'));var BPromise=require(_0xa3f8('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa3f8('0x4'));var db=require(_0xa3f8('0x5'))['db'];var utils=require(_0xa3f8('0x6'));var logger=require(_0xa3f8('0x7'))(_0xa3f8('0x8'));var config=require(_0xa3f8('0x9'));var jayson=require(_0xa3f8('0xa'));var client=jayson[_0xa3f8('0xb')][_0xa3f8('0xc')]({'port':0x232a});function respondWithRpcPromise(_0xf895d9,_0xcfea5,_0x268332){return new BPromise(function(_0x2faf2e,_0x2448de){return client[_0xa3f8('0xd')](_0xf895d9,_0x268332)[_0xa3f8('0xe')](function(_0xcdb0d4){logger['info'](_0xa3f8('0xf'),_0xcfea5,_0xa3f8('0x10'));logger[_0xa3f8('0x11')](_0xa3f8('0x12'),_0xcfea5,'request\x20sent',JSON[_0xa3f8('0x13')](_0xcdb0d4));if(_0xcdb0d4[_0xa3f8('0x14')]){if(_0xcdb0d4[_0xa3f8('0x14')][_0xa3f8('0x15')]===0x1f4){logger[_0xa3f8('0x14')](_0xa3f8('0xf'),_0xcfea5,_0xcdb0d4[_0xa3f8('0x14')][_0xa3f8('0x16')]);return _0x2448de(_0xcdb0d4[_0xa3f8('0x14')][_0xa3f8('0x16')]);}logger[_0xa3f8('0x14')](_0xa3f8('0xf'),_0xcfea5,_0xcdb0d4['error'][_0xa3f8('0x16')]);return _0x2faf2e(_0xcdb0d4[_0xa3f8('0x14')][_0xa3f8('0x16')]);}else{logger[_0xa3f8('0x17')]('IntegrationReport,\x20%s,\x20%s',_0xcfea5,_0xa3f8('0x10'));_0x2faf2e(_0xcdb0d4[_0xa3f8('0x18')][_0xa3f8('0x16')]);}})[_0xa3f8('0x19')](function(_0x45ef64){logger[_0xa3f8('0x14')](_0xa3f8('0xf'),_0xcfea5,_0x45ef64);_0x2448de(_0x45ef64);});});} \ No newline at end of file diff --git a/server/api/interval/index.js b/server/api/interval/index.js index 915307b..ae56476 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 _0x37cc=['addIntervals','put','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./interval.controller','get','isAuthenticated','index','/:id','/:id/sub_intervals','getIntervals','post','create','addInterval','/:id/sub_intervals/create_many'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x37cc,0x185));var _0xc37c=function(_0x416c14,_0x8f64df){_0x416c14=_0x416c14-0x0;var _0x13a057=_0x37cc[_0x416c14];return _0x13a057;};'use strict';var multer=require(_0xc37c('0x0'));var util=require(_0xc37c('0x1'));var path=require(_0xc37c('0x2'));var timeout=require(_0xc37c('0x3'));var express=require(_0xc37c('0x4'));var router=express[_0xc37c('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xc37c('0x6'));var config=require(_0xc37c('0x7'));var controller=require(_0xc37c('0x8'));router[_0xc37c('0x9')]('/',auth[_0xc37c('0xa')](),controller[_0xc37c('0xb')]);router[_0xc37c('0x9')](_0xc37c('0xc'),auth[_0xc37c('0xa')](),controller['show']);router[_0xc37c('0x9')](_0xc37c('0xd'),auth[_0xc37c('0xa')](),controller[_0xc37c('0xe')]);router[_0xc37c('0xf')]('/',auth['isAuthenticated'](),controller[_0xc37c('0x10')]);router[_0xc37c('0xf')](_0xc37c('0xd'),auth[_0xc37c('0xa')](),controller[_0xc37c('0x11')]);router[_0xc37c('0xf')](_0xc37c('0x12'),auth[_0xc37c('0xa')](),controller[_0xc37c('0x13')]);router[_0xc37c('0x14')](_0xc37c('0xc'),auth['isAuthenticated'](),controller['update']);router[_0xc37c('0x15')](_0xc37c('0xc'),auth[_0xc37c('0xa')](),controller[_0xc37c('0x16')]);module[_0xc37c('0x17')]=router; \ No newline at end of file +var _0x3c34=['delete','destroy','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./interval.controller','get','isAuthenticated','/:id','show','/:id/sub_intervals','post','create','addInterval','/:id/sub_intervals/create_many','addIntervals','update'];(function(_0xaa7194,_0x3388c2){var _0x3d1955=function(_0x19fd62){while(--_0x19fd62){_0xaa7194['push'](_0xaa7194['shift']());}};_0x3d1955(++_0x3388c2);}(_0x3c34,0x14c));var _0x43c3=function(_0x56fe98,_0x43dc16){_0x56fe98=_0x56fe98-0x0;var _0x212f4f=_0x3c34[_0x56fe98];return _0x212f4f;};'use strict';var multer=require(_0x43c3('0x0'));var util=require(_0x43c3('0x1'));var path=require(_0x43c3('0x2'));var timeout=require(_0x43c3('0x3'));var express=require(_0x43c3('0x4'));var router=express[_0x43c3('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x43c3('0x6'));var config=require(_0x43c3('0x7'));var controller=require(_0x43c3('0x8'));router[_0x43c3('0x9')]('/',auth[_0x43c3('0xa')](),controller['index']);router['get'](_0x43c3('0xb'),auth[_0x43c3('0xa')](),controller[_0x43c3('0xc')]);router[_0x43c3('0x9')](_0x43c3('0xd'),auth[_0x43c3('0xa')](),controller['getIntervals']);router[_0x43c3('0xe')]('/',auth[_0x43c3('0xa')](),controller[_0x43c3('0xf')]);router['post'](_0x43c3('0xd'),auth[_0x43c3('0xa')](),controller[_0x43c3('0x10')]);router[_0x43c3('0xe')](_0x43c3('0x11'),auth['isAuthenticated'](),controller[_0x43c3('0x12')]);router['put'](_0x43c3('0xb'),auth[_0x43c3('0xa')](),controller[_0x43c3('0x13')]);router[_0x43c3('0x14')](_0x43c3('0xb'),auth['isAuthenticated'](),controller[_0x43c3('0x15')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/interval/interval.attributes.js b/server/api/interval/interval.attributes.js index 0d335f7..99d734d 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 _0x80dd=['sequelize','exports','STRING'];(function(_0x3d5351,_0x27bc80){var _0x1db4db=function(_0x3f572b){while(--_0x3f572b){_0x3d5351['push'](_0x3d5351['shift']());}};_0x1db4db(++_0x27bc80);}(_0x80dd,0x186));var _0xd80d=function(_0x543179,_0x5d8297){_0x543179=_0x543179-0x0;var _0x186a45=_0x80dd[_0x543179];return _0x186a45;};'use strict';var Sequelize=require(_0xd80d('0x0'));module[_0xd80d('0x1')]={'name':{'type':Sequelize[_0xd80d('0x2')]},'description':{'type':Sequelize[_0xd80d('0x2')]},'interval':{'type':Sequelize[_0xd80d('0x2')],'allowNull':!![]}}; \ No newline at end of file +var _0x0432=['exports','STRING','sequelize'];(function(_0x4d0e8b,_0x25837e){var _0x1163d3=function(_0x417a53){while(--_0x417a53){_0x4d0e8b['push'](_0x4d0e8b['shift']());}};_0x1163d3(++_0x25837e);}(_0x0432,0xa4));var _0x2043=function(_0x28e72b,_0x50928c){_0x28e72b=_0x28e72b-0x0;var _0x40b78=_0x0432[_0x28e72b];return _0x40b78;};'use strict';var Sequelize=require(_0x2043('0x0'));module[_0x2043('0x1')]={'name':{'type':Sequelize[_0x2043('0x2')]},'description':{'type':Sequelize[_0x2043('0x2')]},'interval':{'type':Sequelize[_0x2043('0x2')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/interval/interval.controller.js b/server/api/interval/interval.controller.js index 24f3b51..774bc6c 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 _0xb155=['sox','to-csv','ejs','fs-extra','squel','crypto','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/extensions/rewrite','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','get','Intervals','UserProfileResource','stack','name','send','map','Interval','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','type','VIRTUAL','includeAll','include','findAll','rows','catch','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','addInterval','IntervalId','getIntervals','findOne','addIntervals','sequelize','transaction','bulkCreate','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util'];(function(_0x477564,_0x34bd02){var _0x14dffc=function(_0x11b768){while(--_0x11b768){_0x477564['push'](_0x477564['shift']());}};_0x14dffc(++_0x34bd02);}(_0xb155,0x10a));var _0x5b15=function(_0x6dd5c,_0x4bfc19){_0x6dd5c=_0x6dd5c-0x0;var _0x5a87fa=_0xb155[_0x6dd5c];return _0x5a87fa;};'use strict';var emlformat=require(_0x5b15('0x0'));var rimraf=require(_0x5b15('0x1'));var zipdir=require(_0x5b15('0x2'));var jsonpatch=require(_0x5b15('0x3'));var rp=require('request-promise');var moment=require(_0x5b15('0x4'));var BPromise=require(_0x5b15('0x5'));var Mustache=require('mustache');var util=require(_0x5b15('0x6'));var path=require('path');var sox=require(_0x5b15('0x7'));var csv=require(_0x5b15('0x8'));var ejs=require(_0x5b15('0x9'));var fs=require('fs');var fs_extra=require(_0x5b15('0xa'));var _=require('lodash');var squel=require(_0x5b15('0xb'));var crypto=require(_0x5b15('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x5b15('0xd'));var toCsv=require(_0x5b15('0x8'));var querystring=require(_0x5b15('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x5b15('0xf'));var qs=require(_0x5b15('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x5b15('0x11'))('api');var utils=require(_0x5b15('0x12'));var config=require(_0x5b15('0x13'));var licenseUtil=require(_0x5b15('0x14'));var db=require(_0x5b15('0x15'))['db'];var extensions=require(_0x5b15('0x16'));function respondWithStatusCode(_0x3e3c1f,_0x23a44a){_0x23a44a=_0x23a44a||0xcc;return function(_0x5cd9a4){if(_0x5cd9a4){return _0x3e3c1f[_0x5b15('0x17')](_0x23a44a);}return _0x3e3c1f[_0x5b15('0x18')](_0x23a44a)[_0x5b15('0x19')]();};}function respondWithResult(_0x4e9399,_0x24507d){_0x24507d=_0x24507d||0xc8;return function(_0x6d294f){if(_0x6d294f){return _0x4e9399[_0x5b15('0x18')](_0x24507d)[_0x5b15('0x1a')](_0x6d294f);}};}function respondWithFilteredResult(_0x288599,_0x51d30f){return function(_0x40d66b){if(_0x40d66b){var _0x784cc6=typeof _0x51d30f[_0x5b15('0x1b')]===_0x5b15('0x1c')&&typeof _0x51d30f[_0x5b15('0x1d')]===_0x5b15('0x1c');var _0x1e5e8f=_0x40d66b['count'];var _0x54ff8d=_0x784cc6?0x0:_0x51d30f['offset'];var _0x2038e1=_0x784cc6?_0x40d66b[_0x5b15('0x1e')]:_0x51d30f[_0x5b15('0x1b')]+_0x51d30f[_0x5b15('0x1d')];var _0x359b90;if(_0x2038e1>=_0x1e5e8f){_0x2038e1=_0x1e5e8f;_0x359b90=0xc8;}else{_0x359b90=0xce;}_0x288599['status'](_0x359b90);return _0x288599[_0x5b15('0x1f')](_0x5b15('0x20'),_0x54ff8d+'-'+_0x2038e1+'/'+_0x1e5e8f)['json'](_0x40d66b);}return null;};}function patchUpdates(_0x1fea44){return function(_0x551151){try{jsonpatch[_0x5b15('0x21')](_0x551151,_0x1fea44,!![]);}catch(_0x513187){return BPromise['reject'](_0x513187);}return _0x551151[_0x5b15('0x22')]();};}function saveUpdates(_0x5af8b3,_0x2b1e36){return function(_0x13d131){if(_0x13d131){return _0x13d131[_0x5b15('0x23')](_0x5af8b3)[_0x5b15('0x24')](function(_0x26a08d){return _0x26a08d;});}return null;};}function removeEntity(_0x304400,_0x2a5778){return function(_0x3d63cf){if(_0x3d63cf){return _0x3d63cf[_0x5b15('0x25')]()[_0x5b15('0x24')](function(){var _0x2e43e0=_0x3d63cf[_0x5b15('0x26')]({'plain':!![]});var _0x400d94=_0x5b15('0x27');return db[_0x5b15('0x28')]['destroy']({'where':{'type':_0x400d94,'resourceId':_0x2e43e0['id']}})[_0x5b15('0x24')](function(){return _0x3d63cf;});})['then'](function(){_0x304400['status'](0xcc)[_0x5b15('0x19')]();});}};}function handleEntityNotFound(_0x227905,_0x404dc0){return function(_0x339cb5){if(!_0x339cb5){_0x227905[_0x5b15('0x17')](0x194);}return _0x339cb5;};}function handleError(_0x453e47,_0x2e5beb){_0x2e5beb=_0x2e5beb||0x1f4;return function(_0x1b2baa){logger['error'](_0x1b2baa[_0x5b15('0x29')]);if(_0x1b2baa[_0x5b15('0x2a')]){delete _0x1b2baa[_0x5b15('0x2a')];}_0x453e47[_0x5b15('0x18')](_0x2e5beb)[_0x5b15('0x2b')](_0x1b2baa);};}exports['index']=function(_0x54561a,_0x179f3d){var _0x2b9d4b={},_0x3b48e7={},_0x452761={'count':0x0,'rows':[]};var _0x3ff35e=_[_0x5b15('0x2c')](db[_0x5b15('0x2d')][_0x5b15('0x2e')],function(_0x497280){return{'name':_0x497280[_0x5b15('0x2f')],'type':_0x497280['type'][_0x5b15('0x30')]};});_0x3b48e7[_0x5b15('0x31')]=_['map'](_0x3ff35e,'name');_0x3b48e7[_0x5b15('0x32')]=_[_0x5b15('0x33')](_0x54561a[_0x5b15('0x32')]);_0x3b48e7[_0x5b15('0x34')]=_[_0x5b15('0x35')](_0x3b48e7[_0x5b15('0x31')],_0x3b48e7[_0x5b15('0x32')]);_0x2b9d4b[_0x5b15('0x36')]=_[_0x5b15('0x35')](_0x3b48e7[_0x5b15('0x31')],qs[_0x5b15('0x37')](_0x54561a['query'][_0x5b15('0x37')]));_0x2b9d4b[_0x5b15('0x36')]=_0x2b9d4b[_0x5b15('0x36')][_0x5b15('0x38')]?_0x2b9d4b[_0x5b15('0x36')]:_0x3b48e7[_0x5b15('0x31')];if(!_0x54561a[_0x5b15('0x32')][_0x5b15('0x39')]('nolimit')){_0x2b9d4b[_0x5b15('0x1d')]=qs[_0x5b15('0x1d')](_0x54561a[_0x5b15('0x32')][_0x5b15('0x1d')]);_0x2b9d4b[_0x5b15('0x1b')]=qs['offset'](_0x54561a[_0x5b15('0x32')][_0x5b15('0x1b')]);}_0x2b9d4b[_0x5b15('0x3a')]=qs[_0x5b15('0x3b')](_0x54561a[_0x5b15('0x32')][_0x5b15('0x3b')]);_0x2b9d4b[_0x5b15('0x3c')]=qs['filters'](_[_0x5b15('0x3d')](_0x54561a[_0x5b15('0x32')],_0x3b48e7[_0x5b15('0x34')]),_0x3ff35e);if(_0x54561a[_0x5b15('0x32')][_0x5b15('0x3e')]){_0x2b9d4b[_0x5b15('0x3c')]=_[_0x5b15('0x3f')](_0x2b9d4b[_0x5b15('0x3c')],{'$or':_[_0x5b15('0x2c')](_0x3ff35e,function(_0x2ced3b){if(_0x2ced3b[_0x5b15('0x40')]!==_0x5b15('0x41')){var _0x5d2d86={};_0x5d2d86[_0x2ced3b[_0x5b15('0x2a')]]={'$like':'%'+_0x54561a['query'][_0x5b15('0x3e')]+'%'};return _0x5d2d86;}})});}_0x2b9d4b=_[_0x5b15('0x3f')]({},_0x2b9d4b,_0x54561a['options']);var _0x31aa36={'where':_0x2b9d4b[_0x5b15('0x3c')]};return db[_0x5b15('0x2d')][_0x5b15('0x1e')](_0x31aa36)[_0x5b15('0x24')](function(_0xeb8a33){_0x452761[_0x5b15('0x1e')]=_0xeb8a33;if(_0x54561a['query'][_0x5b15('0x42')]){_0x2b9d4b[_0x5b15('0x43')]=[{'all':!![]}];}return db['Interval'][_0x5b15('0x44')](_0x2b9d4b);})[_0x5b15('0x24')](function(_0x95f383){_0x452761[_0x5b15('0x45')]=_0x95f383;return _0x452761;})[_0x5b15('0x24')](respondWithFilteredResult(_0x179f3d,_0x2b9d4b))[_0x5b15('0x46')](handleError(_0x179f3d,null));};exports['show']=function(_0x3aa9e8,_0x23d3ef){var _0x405ec6={'raw':!![],'where':{'id':_0x3aa9e8['params']['id']}},_0x54accb={};_0x54accb[_0x5b15('0x31')]=_['keys'](db[_0x5b15('0x2d')][_0x5b15('0x2e')]);_0x54accb['query']=_['keys'](_0x3aa9e8[_0x5b15('0x32')]);_0x54accb[_0x5b15('0x34')]=_[_0x5b15('0x35')](_0x54accb['model'],_0x54accb['query']);_0x405ec6[_0x5b15('0x36')]=_[_0x5b15('0x35')](_0x54accb['model'],qs['fields'](_0x3aa9e8[_0x5b15('0x32')]['fields']));_0x405ec6['attributes']=_0x405ec6['attributes']['length']?_0x405ec6[_0x5b15('0x36')]:_0x54accb[_0x5b15('0x31')];if(_0x3aa9e8['query'][_0x5b15('0x42')]){_0x405ec6['include']=[{'all':!![]}];}_0x405ec6=_['merge']({},_0x405ec6,_0x3aa9e8[_0x5b15('0x47')]);return db[_0x5b15('0x2d')][_0x5b15('0x48')](_0x405ec6)[_0x5b15('0x24')](handleEntityNotFound(_0x23d3ef,null))[_0x5b15('0x24')](respondWithResult(_0x23d3ef,null))[_0x5b15('0x46')](handleError(_0x23d3ef,null));};exports[_0x5b15('0x49')]=function(_0x830160,_0x507140){return db[_0x5b15('0x2d')][_0x5b15('0x49')](_0x830160[_0x5b15('0x4a')],{})[_0x5b15('0x24')](function(_0x30028b){var _0x5ea09e=_0x830160[_0x5b15('0x4b')][_0x5b15('0x26')]({'plain':!![]});if(!_0x5ea09e)throw new Error(_0x5b15('0x4c'));if(_0x5ea09e[_0x5b15('0x4d')]==='user'){var _0x217fbc=_0x30028b[_0x5b15('0x26')]({'plain':!![]});var _0x7a12d9='Intervals';return db[_0x5b15('0x4e')]['find']({'where':{'name':_0x7a12d9,'userProfileId':_0x5ea09e['userProfileId']},'raw':!![]})[_0x5b15('0x24')](function(_0xba6137){if(_0xba6137&&_0xba6137[_0x5b15('0x4f')]===0x0){return db['UserProfileResource']['create']({'name':_0x217fbc[_0x5b15('0x2a')],'resourceId':_0x217fbc['id'],'type':_0xba6137[_0x5b15('0x2a')],'sectionId':_0xba6137['id']},{})[_0x5b15('0x24')](function(){return _0x30028b;});}else{return _0x30028b;}})[_0x5b15('0x46')](function(_0x1977a1){logger[_0x5b15('0x50')](_0x5b15('0x51'),_0x1977a1);throw _0x1977a1;});}return _0x30028b;})[_0x5b15('0x24')](respondWithResult(_0x507140,0xc9))[_0x5b15('0x46')](handleError(_0x507140,null));};exports[_0x5b15('0x23')]=function(_0x14e4eb,_0x126c44){if(_0x14e4eb['body']['id']){delete _0x14e4eb[_0x5b15('0x4a')]['id'];}return db[_0x5b15('0x2d')][_0x5b15('0x48')]({'where':{'id':_0x14e4eb[_0x5b15('0x52')]['id']}})[_0x5b15('0x24')](handleEntityNotFound(_0x126c44,null))['then'](saveUpdates(_0x14e4eb[_0x5b15('0x4a')],null))[_0x5b15('0x24')](respondWithResult(_0x126c44,null))[_0x5b15('0x46')](handleError(_0x126c44,null));};exports[_0x5b15('0x25')]=function(_0x1a198e,_0x2b2326){return db[_0x5b15('0x2d')][_0x5b15('0x48')]({'where':{'id':_0x1a198e[_0x5b15('0x52')]['id']}})[_0x5b15('0x24')](handleEntityNotFound(_0x2b2326,null))[_0x5b15('0x24')](removeEntity(_0x2b2326,null))[_0x5b15('0x46')](handleError(_0x2b2326,null));};exports[_0x5b15('0x53')]=function(_0x5abd4d,_0x2cf1ec,_0x839b20){if(_0x5abd4d[_0x5b15('0x4a')]['id']){delete _0x5abd4d[_0x5b15('0x4a')]['id'];}return db[_0x5b15('0x2d')][_0x5b15('0x48')]({'where':{'id':_0x5abd4d[_0x5b15('0x52')]['id']}})['then'](handleEntityNotFound(_0x2cf1ec,null))[_0x5b15('0x24')](function(_0x3b0768){if(_0x3b0768){_0x5abd4d[_0x5b15('0x4a')][_0x5b15('0x54')]=_0x3b0768['id'];return db[_0x5b15('0x2d')][_0x5b15('0x49')](_0x5abd4d['body']);}})['then'](respondWithResult(_0x2cf1ec,null))[_0x5b15('0x46')](handleError(_0x2cf1ec,null));};exports[_0x5b15('0x55')]=function(_0x40e0b9,_0x3aeec8,_0x40d0d7){var _0x18ceab={};var _0x477056={};var _0x42df86;var _0x317f81;return db[_0x5b15('0x2d')][_0x5b15('0x56')]({'where':{'id':_0x40e0b9['params']['id']}})[_0x5b15('0x24')](handleEntityNotFound(_0x3aeec8,null))['then'](function(_0x2fac10){if(_0x2fac10){_0x42df86=_0x2fac10;_0x477056[_0x5b15('0x31')]=_['keys'](db[_0x5b15('0x2d')]['rawAttributes']);_0x477056[_0x5b15('0x32')]=_[_0x5b15('0x33')](_0x40e0b9[_0x5b15('0x32')]);_0x477056[_0x5b15('0x34')]=_['intersection'](_0x477056[_0x5b15('0x31')],_0x477056[_0x5b15('0x32')]);_0x18ceab[_0x5b15('0x36')]=_['intersection'](_0x477056[_0x5b15('0x31')],qs[_0x5b15('0x37')](_0x40e0b9['query'][_0x5b15('0x37')]));_0x18ceab[_0x5b15('0x36')]=_0x18ceab[_0x5b15('0x36')][_0x5b15('0x38')]?_0x18ceab[_0x5b15('0x36')]:_0x477056['model'];_0x18ceab[_0x5b15('0x3a')]=qs['sort'](_0x40e0b9[_0x5b15('0x32')][_0x5b15('0x3b')]);_0x18ceab[_0x5b15('0x3c')]=qs['filters'](_[_0x5b15('0x3d')](_0x40e0b9[_0x5b15('0x32')],_0x477056[_0x5b15('0x34')]));if(_0x40e0b9[_0x5b15('0x32')][_0x5b15('0x3e')]){_0x18ceab['where']=_[_0x5b15('0x3f')](_0x18ceab[_0x5b15('0x3c')],{'$or':_[_0x5b15('0x2c')](_0x18ceab[_0x5b15('0x36')],function(_0x13a35a){var _0x163a74={};_0x163a74[_0x13a35a]={'$like':'%'+_0x40e0b9[_0x5b15('0x32')][_0x5b15('0x3e')]+'%'};return _0x163a74;})});}_0x18ceab=_['merge']({},_0x18ceab,_0x40e0b9[_0x5b15('0x47')]);return _0x42df86[_0x5b15('0x55')](_0x18ceab);}})[_0x5b15('0x24')](function(_0x3d3e82){if(_0x3d3e82){_0x317f81=_0x3d3e82[_0x5b15('0x38')];if(!_0x40e0b9[_0x5b15('0x32')][_0x5b15('0x39')]('nolimit')){_0x18ceab[_0x5b15('0x1d')]=qs[_0x5b15('0x1d')](_0x40e0b9[_0x5b15('0x32')][_0x5b15('0x1d')]);_0x18ceab['offset']=qs[_0x5b15('0x1b')](_0x40e0b9['query'][_0x5b15('0x1b')]);}return _0x42df86[_0x5b15('0x55')](_0x18ceab);}})['then'](function(_0x46ebb4){if(_0x46ebb4){return _0x46ebb4?{'count':_0x317f81,'rows':_0x46ebb4}:null;}})[_0x5b15('0x24')](respondWithResult(_0x3aeec8,null))[_0x5b15('0x46')](handleError(_0x3aeec8,null));};exports[_0x5b15('0x57')]=function(_0xa4b058,_0x536f1c,_0x2c11a4){return db['Interval'][_0x5b15('0x56')]({'where':{'id':_0xa4b058['params']['id']}})[_0x5b15('0x24')](handleEntityNotFound(_0x536f1c,null))['then'](function(_0x22f22b){if(_0x22f22b){return db[_0x5b15('0x58')][_0x5b15('0x59')](function(_0xdd144f){return db['Interval']['destroy']({'where':{'IntervalId':_0xa4b058[_0x5b15('0x52')]['id']},'transaction':_0xdd144f})[_0x5b15('0x24')](function(_0x2d5e6c){var _0x475e5f=_[_0x5b15('0x2c')](_0xa4b058[_0x5b15('0x4a')],function(_0x274b6f){delete _0x274b6f['id'];_0x274b6f[_0x5b15('0x54')]=_0xa4b058[_0x5b15('0x52')]['id'];return _0x274b6f;});return db[_0x5b15('0x2d')][_0x5b15('0x5a')](_0x475e5f,{'transaction':_0xdd144f});});})[_0x5b15('0x24')](function(){return db[_0x5b15('0x2d')]['findAll']({'where':{'IntervalId':_0xa4b058[_0x5b15('0x52')]['id']}});});}})['then'](respondWithResult(_0x536f1c,null))[_0x5b15('0x46')](handleError(_0x536f1c,null));}; \ No newline at end of file +var _0x8488=['filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','user','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addInterval','IntervalId','getIntervals','pick','findOne','sequelize','transaction','bulkCreate','eml-format','zip-dir','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','get','Intervals','sendStatus','error','stack','name','index','Interval','rawAttributes','type','key','model','map','query','keys'];(function(_0x334fea,_0x1f1e18){var _0x3c5829=function(_0x4fd6ac){while(--_0x4fd6ac){_0x334fea['push'](_0x334fea['shift']());}};_0x3c5829(++_0x1f1e18);}(_0x8488,0xd2));var _0x8848=function(_0x3ecdbf,_0x3140e7){_0x3ecdbf=_0x3ecdbf-0x0;var _0x15c92f=_0x8488[_0x3ecdbf];return _0x15c92f;};'use strict';var emlformat=require(_0x8848('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x8848('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x8848('0x2'));var Mustache=require(_0x8848('0x3'));var util=require(_0x8848('0x4'));var path=require('path');var sox=require(_0x8848('0x5'));var csv=require(_0x8848('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8848('0x7'));var _=require(_0x8848('0x8'));var squel=require(_0x8848('0x9'));var crypto=require(_0x8848('0xa'));var jsforce=require(_0x8848('0xb'));var deskjs=require(_0x8848('0xc'));var toCsv=require(_0x8848('0x6'));var querystring=require('querystring');var Papa=require(_0x8848('0xd'));var Redis=require('ioredis');var authService=require(_0x8848('0xe'));var qs=require(_0x8848('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x8848('0x10'))(_0x8848('0x11'));var utils=require(_0x8848('0x12'));var config=require(_0x8848('0x13'));var licenseUtil=require(_0x8848('0x14'));var db=require(_0x8848('0x15'))['db'];var extensions=require('../../components/extensions/rewrite');function respondWithStatusCode(_0x1e08c3,_0x29c69e){_0x29c69e=_0x29c69e||0xcc;return function(_0x1e41f3){if(_0x1e41f3){return _0x1e08c3['sendStatus'](_0x29c69e);}return _0x1e08c3['status'](_0x29c69e)[_0x8848('0x16')]();};}function respondWithResult(_0x33e20d,_0x374596){_0x374596=_0x374596||0xc8;return function(_0x281ce2){if(_0x281ce2){return _0x33e20d[_0x8848('0x17')](_0x374596)[_0x8848('0x18')](_0x281ce2);}};}function respondWithFilteredResult(_0x5ae41f,_0x4703f9){return function(_0x4fd4a4){if(_0x4fd4a4){var _0x267109=typeof _0x4703f9[_0x8848('0x19')]===_0x8848('0x1a')&&typeof _0x4703f9[_0x8848('0x1b')]===_0x8848('0x1a');var _0x596675=_0x4fd4a4[_0x8848('0x1c')];var _0x9349c6=_0x267109?0x0:_0x4703f9[_0x8848('0x19')];var _0x2fe2f0=_0x267109?_0x4fd4a4['count']:_0x4703f9[_0x8848('0x19')]+_0x4703f9[_0x8848('0x1b')];var _0xb74567;if(_0x2fe2f0>=_0x596675){_0x2fe2f0=_0x596675;_0xb74567=0xc8;}else{_0xb74567=0xce;}_0x5ae41f['status'](_0xb74567);return _0x5ae41f[_0x8848('0x1d')](_0x8848('0x1e'),_0x9349c6+'-'+_0x2fe2f0+'/'+_0x596675)[_0x8848('0x18')](_0x4fd4a4);}return null;};}function patchUpdates(_0x4a63da){return function(_0x5583dd){try{jsonpatch[_0x8848('0x1f')](_0x5583dd,_0x4a63da,!![]);}catch(_0x16fc86){return BPromise[_0x8848('0x20')](_0x16fc86);}return _0x5583dd['save']();};}function saveUpdates(_0x589703,_0x4725ca){return function(_0x1bc765){if(_0x1bc765){return _0x1bc765[_0x8848('0x21')](_0x589703)[_0x8848('0x22')](function(_0x5482c0){return _0x5482c0;});}return null;};}function removeEntity(_0x38e70f,_0x4d9871){return function(_0xace55f){if(_0xace55f){return _0xace55f[_0x8848('0x23')]()['then'](function(){var _0x4a1d2d=_0xace55f[_0x8848('0x24')]({'plain':!![]});var _0xd6d6c6=_0x8848('0x25');return db['UserProfileResource'][_0x8848('0x23')]({'where':{'type':_0xd6d6c6,'resourceId':_0x4a1d2d['id']}})[_0x8848('0x22')](function(){return _0xace55f;});})[_0x8848('0x22')](function(){_0x38e70f[_0x8848('0x17')](0xcc)[_0x8848('0x16')]();});}};}function handleEntityNotFound(_0x5eaf03,_0x3eb9ae){return function(_0x4a3c52){if(!_0x4a3c52){_0x5eaf03[_0x8848('0x26')](0x194);}return _0x4a3c52;};}function handleError(_0x1fce87,_0x2cf151){_0x2cf151=_0x2cf151||0x1f4;return function(_0xf918a3){logger[_0x8848('0x27')](_0xf918a3[_0x8848('0x28')]);if(_0xf918a3[_0x8848('0x29')]){delete _0xf918a3[_0x8848('0x29')];}_0x1fce87[_0x8848('0x17')](_0x2cf151)['send'](_0xf918a3);};}exports[_0x8848('0x2a')]=function(_0x269d23,_0x4126ff){var _0x2666f2={},_0x5aa524={},_0x52c0ab={'count':0x0,'rows':[]};var _0x3fae61=_['map'](db[_0x8848('0x2b')][_0x8848('0x2c')],function(_0x4fdb52){return{'name':_0x4fdb52['fieldName'],'type':_0x4fdb52[_0x8848('0x2d')][_0x8848('0x2e')]};});_0x5aa524[_0x8848('0x2f')]=_[_0x8848('0x30')](_0x3fae61,_0x8848('0x29'));_0x5aa524[_0x8848('0x31')]=_[_0x8848('0x32')](_0x269d23[_0x8848('0x31')]);_0x5aa524[_0x8848('0x33')]=_['intersection'](_0x5aa524[_0x8848('0x2f')],_0x5aa524[_0x8848('0x31')]);_0x2666f2[_0x8848('0x34')]=_[_0x8848('0x35')](_0x5aa524['model'],qs[_0x8848('0x36')](_0x269d23[_0x8848('0x31')]['fields']));_0x2666f2['attributes']=_0x2666f2[_0x8848('0x34')][_0x8848('0x37')]?_0x2666f2[_0x8848('0x34')]:_0x5aa524[_0x8848('0x2f')];if(!_0x269d23['query'][_0x8848('0x38')](_0x8848('0x39'))){_0x2666f2[_0x8848('0x1b')]=qs[_0x8848('0x1b')](_0x269d23[_0x8848('0x31')][_0x8848('0x1b')]);_0x2666f2[_0x8848('0x19')]=qs[_0x8848('0x19')](_0x269d23['query']['offset']);}_0x2666f2[_0x8848('0x3a')]=qs['sort'](_0x269d23[_0x8848('0x31')][_0x8848('0x3b')]);_0x2666f2[_0x8848('0x3c')]=qs[_0x8848('0x33')](_['pick'](_0x269d23['query'],_0x5aa524[_0x8848('0x33')]),_0x3fae61);if(_0x269d23[_0x8848('0x31')][_0x8848('0x3d')]){_0x2666f2[_0x8848('0x3c')]=_[_0x8848('0x3e')](_0x2666f2[_0x8848('0x3c')],{'$or':_[_0x8848('0x30')](_0x3fae61,function(_0x36068f){if(_0x36068f[_0x8848('0x2d')]!==_0x8848('0x3f')){var _0x5b727c={};_0x5b727c[_0x36068f['name']]={'$like':'%'+_0x269d23[_0x8848('0x31')][_0x8848('0x3d')]+'%'};return _0x5b727c;}})});}_0x2666f2=_[_0x8848('0x3e')]({},_0x2666f2,_0x269d23[_0x8848('0x40')]);var _0x208a20={'where':_0x2666f2[_0x8848('0x3c')]};return db[_0x8848('0x2b')]['count'](_0x208a20)[_0x8848('0x22')](function(_0x4f698e){_0x52c0ab['count']=_0x4f698e;if(_0x269d23[_0x8848('0x31')][_0x8848('0x41')]){_0x2666f2[_0x8848('0x42')]=[{'all':!![]}];}return db[_0x8848('0x2b')][_0x8848('0x43')](_0x2666f2);})[_0x8848('0x22')](function(_0x1050b5){_0x52c0ab[_0x8848('0x44')]=_0x1050b5;return _0x52c0ab;})[_0x8848('0x22')](respondWithFilteredResult(_0x4126ff,_0x2666f2))[_0x8848('0x45')](handleError(_0x4126ff,null));};exports[_0x8848('0x46')]=function(_0x4c8ff7,_0x21ce91){var _0x3b2d40={'raw':!![],'where':{'id':_0x4c8ff7[_0x8848('0x47')]['id']}},_0x1a5643={};_0x1a5643[_0x8848('0x2f')]=_[_0x8848('0x32')](db[_0x8848('0x2b')][_0x8848('0x2c')]);_0x1a5643[_0x8848('0x31')]=_[_0x8848('0x32')](_0x4c8ff7['query']);_0x1a5643[_0x8848('0x33')]=_[_0x8848('0x35')](_0x1a5643[_0x8848('0x2f')],_0x1a5643[_0x8848('0x31')]);_0x3b2d40['attributes']=_[_0x8848('0x35')](_0x1a5643['model'],qs[_0x8848('0x36')](_0x4c8ff7[_0x8848('0x31')][_0x8848('0x36')]));_0x3b2d40['attributes']=_0x3b2d40[_0x8848('0x34')]['length']?_0x3b2d40['attributes']:_0x1a5643[_0x8848('0x2f')];if(_0x4c8ff7[_0x8848('0x31')][_0x8848('0x41')]){_0x3b2d40['include']=[{'all':!![]}];}_0x3b2d40=_[_0x8848('0x3e')]({},_0x3b2d40,_0x4c8ff7[_0x8848('0x40')]);return db[_0x8848('0x2b')][_0x8848('0x48')](_0x3b2d40)[_0x8848('0x22')](handleEntityNotFound(_0x21ce91,null))[_0x8848('0x22')](respondWithResult(_0x21ce91,null))[_0x8848('0x45')](handleError(_0x21ce91,null));};exports[_0x8848('0x49')]=function(_0x4b2165,_0x16f36d){return db[_0x8848('0x2b')][_0x8848('0x49')](_0x4b2165[_0x8848('0x4a')],{})[_0x8848('0x22')](function(_0x5f00af){var _0x147507=_0x4b2165[_0x8848('0x4b')][_0x8848('0x24')]({'plain':!![]});if(!_0x147507)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x147507['role']===_0x8848('0x4b')){var _0x89d562=_0x5f00af[_0x8848('0x24')]({'plain':!![]});var _0x2ab34b=_0x8848('0x25');return db['UserProfileSection'][_0x8848('0x48')]({'where':{'name':_0x2ab34b,'userProfileId':_0x147507['userProfileId']},'raw':!![]})[_0x8848('0x22')](function(_0x3a4cef){if(_0x3a4cef&&_0x3a4cef[_0x8848('0x4c')]===0x0){return db[_0x8848('0x4d')][_0x8848('0x49')]({'name':_0x89d562['name'],'resourceId':_0x89d562['id'],'type':_0x3a4cef[_0x8848('0x29')],'sectionId':_0x3a4cef['id']},{})['then'](function(){return _0x5f00af;});}else{return _0x5f00af;}})[_0x8848('0x45')](function(_0x275b05){logger['error'](_0x8848('0x4e'),_0x275b05);throw _0x275b05;});}return _0x5f00af;})['then'](respondWithResult(_0x16f36d,0xc9))[_0x8848('0x45')](handleError(_0x16f36d,null));};exports['update']=function(_0x35bb3c,_0x1ec761){if(_0x35bb3c[_0x8848('0x4a')]['id']){delete _0x35bb3c[_0x8848('0x4a')]['id'];}return db[_0x8848('0x2b')][_0x8848('0x48')]({'where':{'id':_0x35bb3c[_0x8848('0x47')]['id']}})[_0x8848('0x22')](handleEntityNotFound(_0x1ec761,null))[_0x8848('0x22')](saveUpdates(_0x35bb3c[_0x8848('0x4a')],null))[_0x8848('0x22')](respondWithResult(_0x1ec761,null))[_0x8848('0x45')](handleError(_0x1ec761,null));};exports[_0x8848('0x23')]=function(_0x428118,_0x3826b4){return db['Interval'][_0x8848('0x48')]({'where':{'id':_0x428118[_0x8848('0x47')]['id']}})[_0x8848('0x22')](handleEntityNotFound(_0x3826b4,null))[_0x8848('0x22')](removeEntity(_0x3826b4,null))[_0x8848('0x45')](handleError(_0x3826b4,null));};exports[_0x8848('0x4f')]=function(_0x245605,_0x106dc2,_0x56c80e){if(_0x245605[_0x8848('0x4a')]['id']){delete _0x245605[_0x8848('0x4a')]['id'];}return db[_0x8848('0x2b')][_0x8848('0x48')]({'where':{'id':_0x245605['params']['id']}})[_0x8848('0x22')](handleEntityNotFound(_0x106dc2,null))[_0x8848('0x22')](function(_0x1476c3){if(_0x1476c3){_0x245605[_0x8848('0x4a')][_0x8848('0x50')]=_0x1476c3['id'];return db[_0x8848('0x2b')][_0x8848('0x49')](_0x245605[_0x8848('0x4a')]);}})[_0x8848('0x22')](respondWithResult(_0x106dc2,null))[_0x8848('0x45')](handleError(_0x106dc2,null));};exports[_0x8848('0x51')]=function(_0x23fa65,_0x8f7798,_0x2fd9da){var _0x469eea={};var _0x317a31={};var _0x52fb03;var _0x573ac6;return db[_0x8848('0x2b')]['findOne']({'where':{'id':_0x23fa65[_0x8848('0x47')]['id']}})[_0x8848('0x22')](handleEntityNotFound(_0x8f7798,null))[_0x8848('0x22')](function(_0x1e3d0f){if(_0x1e3d0f){_0x52fb03=_0x1e3d0f;_0x317a31[_0x8848('0x2f')]=_[_0x8848('0x32')](db['Interval']['rawAttributes']);_0x317a31[_0x8848('0x31')]=_[_0x8848('0x32')](_0x23fa65[_0x8848('0x31')]);_0x317a31[_0x8848('0x33')]=_[_0x8848('0x35')](_0x317a31[_0x8848('0x2f')],_0x317a31['query']);_0x469eea[_0x8848('0x34')]=_[_0x8848('0x35')](_0x317a31[_0x8848('0x2f')],qs[_0x8848('0x36')](_0x23fa65['query'][_0x8848('0x36')]));_0x469eea[_0x8848('0x34')]=_0x469eea[_0x8848('0x34')][_0x8848('0x37')]?_0x469eea[_0x8848('0x34')]:_0x317a31['model'];_0x469eea['order']=qs[_0x8848('0x3b')](_0x23fa65[_0x8848('0x31')]['sort']);_0x469eea[_0x8848('0x3c')]=qs[_0x8848('0x33')](_[_0x8848('0x52')](_0x23fa65[_0x8848('0x31')],_0x317a31[_0x8848('0x33')]));if(_0x23fa65[_0x8848('0x31')][_0x8848('0x3d')]){_0x469eea['where']=_['merge'](_0x469eea[_0x8848('0x3c')],{'$or':_[_0x8848('0x30')](_0x469eea[_0x8848('0x34')],function(_0x5d332c){var _0x57f96b={};_0x57f96b[_0x5d332c]={'$like':'%'+_0x23fa65[_0x8848('0x31')]['filter']+'%'};return _0x57f96b;})});}_0x469eea=_[_0x8848('0x3e')]({},_0x469eea,_0x23fa65[_0x8848('0x40')]);return _0x52fb03[_0x8848('0x51')](_0x469eea);}})[_0x8848('0x22')](function(_0x2643ef){if(_0x2643ef){_0x573ac6=_0x2643ef[_0x8848('0x37')];if(!_0x23fa65['query']['hasOwnProperty'](_0x8848('0x39'))){_0x469eea[_0x8848('0x1b')]=qs[_0x8848('0x1b')](_0x23fa65['query'][_0x8848('0x1b')]);_0x469eea['offset']=qs[_0x8848('0x19')](_0x23fa65[_0x8848('0x31')][_0x8848('0x19')]);}return _0x52fb03[_0x8848('0x51')](_0x469eea);}})[_0x8848('0x22')](function(_0x5784f4){if(_0x5784f4){return _0x5784f4?{'count':_0x573ac6,'rows':_0x5784f4}:null;}})[_0x8848('0x22')](respondWithResult(_0x8f7798,null))[_0x8848('0x45')](handleError(_0x8f7798,null));};exports['addIntervals']=function(_0x741207,_0x5b6438,_0x497aae){return db['Interval'][_0x8848('0x53')]({'where':{'id':_0x741207[_0x8848('0x47')]['id']}})['then'](handleEntityNotFound(_0x5b6438,null))[_0x8848('0x22')](function(_0x11eb61){if(_0x11eb61){return db[_0x8848('0x54')][_0x8848('0x55')](function(_0x3bd0ff){return db[_0x8848('0x2b')][_0x8848('0x23')]({'where':{'IntervalId':_0x741207[_0x8848('0x47')]['id']},'transaction':_0x3bd0ff})[_0x8848('0x22')](function(_0x5bf372){var _0x5d7cd6=_[_0x8848('0x30')](_0x741207[_0x8848('0x4a')],function(_0x201073){delete _0x201073['id'];_0x201073[_0x8848('0x50')]=_0x741207[_0x8848('0x47')]['id'];return _0x201073;});return db[_0x8848('0x2b')][_0x8848('0x56')](_0x5d7cd6,{'transaction':_0x3bd0ff});});})[_0x8848('0x22')](function(){return db['Interval']['findAll']({'where':{'IntervalId':_0x741207[_0x8848('0x47')]['id']}});});}})[_0x8848('0x22')](respondWithResult(_0x5b6438,null))[_0x8848('0x45')](handleError(_0x5b6438,null));}; \ No newline at end of file diff --git a/server/api/interval/interval.model.js b/server/api/interval/interval.model.js index 591d0ae..263dbde 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 _0xaaee=['define','Interval','tools_intervals','rewrite','lodash','api','moment','bluebird','request-promise','path','../../config/environment','./interval.attributes','../../components/extensions/rewrite'];(function(_0x46364f,_0x28cc93){var _0x70c092=function(_0x1910d1){while(--_0x1910d1){_0x46364f['push'](_0x46364f['shift']());}};_0x70c092(++_0x28cc93);}(_0xaaee,0x1be));var _0xeaae=function(_0x397f42,_0x3785e8){_0x397f42=_0x397f42-0x0;var _0x75a709=_0xaaee[_0x397f42];return _0x75a709;};'use strict';var _=require(_0xeaae('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xeaae('0x1'));var moment=require(_0xeaae('0x2'));var BPromise=require(_0xeaae('0x3'));var rp=require(_0xeaae('0x4'));var fs=require('fs');var path=require(_0xeaae('0x5'));var rimraf=require('rimraf');var config=require(_0xeaae('0x6'));var attributes=require(_0xeaae('0x7'));var extensions=require(_0xeaae('0x8'));module['exports']=function(_0x5d3db9,_0x323346){return _0x5d3db9[_0xeaae('0x9')](_0xeaae('0xa'),attributes,{'tableName':_0xeaae('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x48c134,_0x240cdf){extensions[_0xeaae('0xc')](_0x5d3db9,_0x48c134);},'afterBulkCreate':function(_0x1cfa93,_0x15f469,_0x104f22){_0x104f22();extensions['rewrite'](_0x5d3db9,_0x1cfa93[0x0]);},'afterUpdate':function(_0x3d3579,_0x46ee28){extensions[_0xeaae('0xc')](_0x5d3db9,_0x3d3579);},'afterDestroy':function(_0x3fd4db,_0x10d7da){extensions[_0xeaae('0xc')](_0x5d3db9,_0x3fd4db);}}});}; \ No newline at end of file +var _0x4c35=['rimraf','./interval.attributes','../../components/extensions/rewrite','exports','Interval','tools_intervals','rewrite','lodash','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x5dd240,_0xb30f56){var _0x437d22=function(_0x142d8c){while(--_0x142d8c){_0x5dd240['push'](_0x5dd240['shift']());}};_0x437d22(++_0xb30f56);}(_0x4c35,0xd9));var _0x54c3=function(_0xbb9dbf,_0x5dafa4){_0xbb9dbf=_0xbb9dbf-0x0;var _0x30223c=_0x4c35[_0xbb9dbf];return _0x30223c;};'use strict';var _=require(_0x54c3('0x0'));var util=require('util');var logger=require(_0x54c3('0x1'))(_0x54c3('0x2'));var moment=require(_0x54c3('0x3'));var BPromise=require(_0x54c3('0x4'));var rp=require(_0x54c3('0x5'));var fs=require('fs');var path=require(_0x54c3('0x6'));var rimraf=require(_0x54c3('0x7'));var config=require('../../config/environment');var attributes=require(_0x54c3('0x8'));var extensions=require(_0x54c3('0x9'));module[_0x54c3('0xa')]=function(_0x10fcbf,_0x3bc7cf){return _0x10fcbf['define'](_0x54c3('0xb'),attributes,{'tableName':_0x54c3('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x1c951f,_0x4bbf10){extensions[_0x54c3('0xd')](_0x10fcbf,_0x1c951f);},'afterBulkCreate':function(_0x13be2c,_0x34346f,_0x8f091d){_0x8f091d();extensions[_0x54c3('0xd')](_0x10fcbf,_0x13be2c[0x0]);},'afterUpdate':function(_0x2c8571,_0x48dbe1){extensions[_0x54c3('0xd')](_0x10fcbf,_0x2c8571);},'afterDestroy':function(_0x19401e,_0x4cff46){extensions[_0x54c3('0xd')](_0x10fcbf,_0x19401e);}}});}; \ No newline at end of file diff --git a/server/api/interval/interval.rpc.js b/server/api/interval/interval.rpc.js index 7a74adf..b43ac11 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(_0x485abd,_0x32c7c1){var _0x3379f1=function(_0x36b528){while(--_0x36b528){_0x485abd['push'](_0x485abd['shift']());}};_0x3379f1(++_0x32c7c1);}(_0xa9e0,0x123));var _0x0a9e=function(_0x220dbb,_0x99328d){_0x220dbb=_0x220dbb-0x0;var _0x2b77de=_0xa9e0[_0x220dbb];return _0x2b77de;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});}exports['GetInterval']=function(_0x459eb1){var _0x478723=this;return new Promise(function(_0x106033,_0x205fd6){return db[_0x0a9e('0x14')][_0x0a9e('0x15')]({'raw':_0x459eb1[_0x0a9e('0x16')]?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x17')]===undefined?!![]:![]:!![],'where':_0x459eb1[_0x0a9e('0x16')]?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x18')]||null:null,'attributes':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x19')]||null:null,'limit':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')]['limit']||null:null,'include':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x459eb1[_0x0a9e('0x16')]['include'],function(_0xfb6e48){return{'model':db[_0xfb6e48[_0x0a9e('0x1c')]],'as':_0xfb6e48['as'],'attributes':_0xfb6e48[_0x0a9e('0x19')],'include':_0xfb6e48[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0xfb6e48[_0x0a9e('0x1a')],function(_0x16b1ca){return{'model':db[_0x16b1ca['model']],'as':_0x16b1ca['as'],'attributes':_0x16b1ca['attributes'],'include':_0x16b1ca[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x16b1ca[_0x0a9e('0x1a')],function(_0x33161b){return{'model':db[_0x33161b['model']],'as':_0x33161b['as'],'attributes':_0x33161b[_0x0a9e('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x45a1e7){logger['info'](_0x0a9e('0x1d'),_0x459eb1);logger[_0x0a9e('0xd')](_0x0a9e('0x1d'),_0x459eb1,JSON[_0x0a9e('0x1e')](_0x45a1e7));_0x106033(_0x45a1e7);})[_0x0a9e('0x13')](function(_0x1538a4){logger[_0x0a9e('0x10')](_0x0a9e('0x1d'),_0x1538a4['message'],_0x459eb1);_0x205fd6(_0x478723[_0x0a9e('0x10')](0x1f4,_0x1538a4[_0x0a9e('0x11')]));});});};exports[_0x0a9e('0x1f')]=function(_0x2ec755){var _0x5c877d=this;return new Promise(function(_0x15b200,_0x40e7a3){return db[_0x0a9e('0x14')][_0x0a9e('0x20')]({'raw':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755[_0x0a9e('0x16')][_0x0a9e('0x17')]===undefined?!![]:![]:!![],'where':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755[_0x0a9e('0x16')]['where']||null:null,'attributes':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755['options'][_0x0a9e('0x19')]||null:null,'include':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755[_0x0a9e('0x16')][_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x2ec755['options'][_0x0a9e('0x1a')],function(_0x46f0a5){return{'model':db[_0x46f0a5[_0x0a9e('0x1c')]],'as':_0x46f0a5['as'],'attributes':_0x46f0a5[_0x0a9e('0x19')],'include':_0x46f0a5[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x46f0a5[_0x0a9e('0x1a')],function(_0x39e565){return{'model':db[_0x39e565['model']],'as':_0x39e565['as'],'attributes':_0x39e565[_0x0a9e('0x19')],'include':_0x39e565['include']?_[_0x0a9e('0x1b')](_0x39e565[_0x0a9e('0x1a')],function(_0x2b7e7f){return{'model':db[_0x2b7e7f[_0x0a9e('0x1c')]],'as':_0x2b7e7f['as'],'attributes':_0x2b7e7f['attributes']};}):[]};}):[]};}):[]:[]})[_0x0a9e('0x21')](function(_0xd1836d){logger[_0x0a9e('0xa')](_0x0a9e('0x1f'),_0x2ec755);logger['debug']('ShowInterval',_0x2ec755,JSON[_0x0a9e('0x1e')](_0xd1836d));_0x15b200(_0xd1836d);})['catch'](function(_0x24936a){logger[_0x0a9e('0x10')](_0x0a9e('0x1f'),_0x24936a[_0x0a9e('0x11')],_0x2ec755);_0x40e7a3(_0x5c877d['error'](0x1f4,_0x24936a[_0x0a9e('0x11')]));});});}; \ No newline at end of file +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(_0x1f530d,_0x18a19e){var _0x22103f=function(_0x2664c5){while(--_0x2664c5){_0x1f530d['push'](_0x1f530d['shift']());}};_0x22103f(++_0x18a19e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x47b58b,_0x41a189){_0x47b58b=_0x47b58b-0x0;var _0x46bebe=_0xa9e0[_0x47b58b];return _0x46bebe;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});}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 18d0b69..2070ba6 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 _0xadb5=['post','isAuthenticated','exports','Router','./jira.controller'];(function(_0x335c97,_0x5c00b8){var _0x10633b=function(_0x317c88){while(--_0x317c88){_0x335c97['push'](_0x335c97['shift']());}};_0x10633b(++_0x5c00b8);}(_0xadb5,0xad));var _0x5adb=function(_0x15a8e6,_0x581e65){_0x15a8e6=_0x15a8e6-0x0;var _0x2b2b7a=_0xadb5[_0x15a8e6];return _0x2b2b7a;};'use strict';var express=require('express');var router=express[_0x5adb('0x0')]();var auth=require('../../components/auth/service');var controller=require(_0x5adb('0x1'));router[_0x5adb('0x2')]('/',auth[_0x5adb('0x3')](),controller['send']);module[_0x5adb('0x4')]=router; \ No newline at end of file +var _0x2032=['isAuthenticated','send','Router','../../components/auth/service','./jira.controller'];(function(_0x18af54,_0x5376cb){var _0x399a31=function(_0x4f43f6){while(--_0x4f43f6){_0x18af54['push'](_0x18af54['shift']());}};_0x399a31(++_0x5376cb);}(_0x2032,0xd9));var _0x2203=function(_0x58c2ff,_0x45b939){_0x58c2ff=_0x58c2ff-0x0;var _0x2fa3d4=_0x2032[_0x58c2ff];return _0x2fa3d4;};'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 68971ab..40e599c 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 _0xd697=['x-forwarded-for','remoteAddress','socket','connection','https','api','support','3eAmWpBVP0','key','MOTGUI','summary','Report','\x20from\x20','description','stringify','issuetype','Bug','customfield_11500','email','customfield_11501','oldToken','fields','customfield_11502','newToken','customfield_11503','name','customfield_11504','reason','customfield_10102','track.xcallymotion.com','/rest/api/2/issue','POST','application/json','Basic\x20','base64','request','setEncoding','utf8','data','status','statusCode','json','error','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','write','end','openIssue','send','body'];(function(_0x279d1c,_0x3c1d0c){var _0xb9b9b2=function(_0xa5cd6b){while(--_0xa5cd6b){_0x279d1c['push'](_0x279d1c['shift']());}};_0xb9b9b2(++_0x3c1d0c);}(_0xd697,0x15b));var _0x7d69=function(_0x10c00c,_0x413715){_0x10c00c=_0x10c00c-0x0;var _0x14b160=_0xd697[_0x10c00c];return _0x14b160;};'use strict';var BPromise=require('bluebird');var https=require(_0x7d69('0x0'));var logger=require('../../config/logger')(_0x7d69('0x1'));var USERNAME=_0x7d69('0x2');var PASSWORD=_0x7d69('0x3');function openIssue(_0x21a7d5,_0xeb3591){var _0x5f1e81={'fields':{'project':{'key':_0x21a7d5[_0x7d69('0x4')]||_0x7d69('0x5')},'summary':(_0x21a7d5[_0x7d69('0x6')]||_0x7d69('0x7'))+_0x7d69('0x8')+_0x21a7d5['ip'],'description':_0x21a7d5[_0x7d69('0x9')]||JSON[_0x7d69('0xa')](_0x21a7d5),'issuetype':{'name':_0x21a7d5[_0x7d69('0xb')]||_0x7d69('0xc')}}};_0x5f1e81['fields'][_0x7d69('0xd')]=_0x21a7d5[_0x7d69('0xe')];_0x5f1e81['fields'][_0x7d69('0xf')]=_0x21a7d5[_0x7d69('0x10')];_0x5f1e81[_0x7d69('0x11')][_0x7d69('0x12')]=_0x21a7d5[_0x7d69('0x13')];_0x5f1e81[_0x7d69('0x11')][_0x7d69('0x14')]=_0x21a7d5[_0x7d69('0x15')];_0x5f1e81[_0x7d69('0x11')][_0x7d69('0x16')]=_0x21a7d5[_0x7d69('0x17')];_0x5f1e81[_0x7d69('0x11')][_0x7d69('0x18')]=_0x21a7d5['ip'];var _0x59134c={'host':_0x7d69('0x19'),'port':0x1bb,'path':_0x7d69('0x1a'),'method':_0x7d69('0x1b'),'timeout':0x4e20,'headers':{'Content-Type':_0x7d69('0x1c'),'Authorization':_0x7d69('0x1d')+new Buffer(USERNAME+':'+PASSWORD)['toString'](_0x7d69('0x1e'))}};var _0x57cb8e=JSON['stringify'](_0x5f1e81);var _0x28d174=https[_0x7d69('0x1f')](_0x59134c,function(_0x2db3b2){_0x2db3b2[_0x7d69('0x20')](_0x7d69('0x21'));var _0x5432b7='';_0x2db3b2['on'](_0x7d69('0x22'),function(_0x5ce5d4){_0x5432b7+=_0x5ce5d4;});_0x2db3b2['on']('end',function(){if(_0xeb3591){return _0xeb3591[_0x7d69('0x23')](_0x2db3b2[_0x7d69('0x24')])[_0x7d69('0x25')](JSON['parse'](_0x5432b7));}});});_0x28d174['on'](_0x7d69('0x26'),function(_0x4f9a0f){if(_0xeb3591){return _0xeb3591[_0x7d69('0x23')](0x1f4)[_0x7d69('0x25')]({'errors':[{'message':_0x7d69('0x27'),'type':'api.jira'}]});}});_0x28d174[_0x7d69('0x28')](_0x57cb8e);_0x28d174[_0x7d69('0x29')]();}exports[_0x7d69('0x2a')]=openIssue;exports[_0x7d69('0x2b')]=function(_0x40ddb2,_0x5f5681){_0x40ddb2[_0x7d69('0x2c')]['ip']=_0x40ddb2['headers'][_0x7d69('0x2d')]||_0x40ddb2['connection'][_0x7d69('0x2e')]||_0x40ddb2[_0x7d69('0x2f')][_0x7d69('0x2e')]||_0x40ddb2[_0x7d69('0x30')]['socket'][_0x7d69('0x2e')];return openIssue(_0x40ddb2['body'],_0x5f5681);}; \ No newline at end of file +var _0x216d=['bluebird','https','../../config/logger','api','support','key','MOTGUI','summary','Report','\x20from\x20','description','stringify','Bug','customfield_11500','email','customfield_11501','fields','customfield_11502','newToken','customfield_11503','name','/rest/api/2/issue','POST','application/json','Basic\x20','base64','utf8','data','end','statusCode','parse','error','json','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','api.jira','write','openIssue','body','headers','connection','socket','remoteAddress'];(function(_0x37df6c,_0x2a9666){var _0x41f7aa=function(_0x2c9605){while(--_0x2c9605){_0x37df6c['push'](_0x37df6c['shift']());}};_0x41f7aa(++_0x2a9666);}(_0x216d,0xfc));var _0xd216=function(_0x3732c4,_0x331ff2){_0x3732c4=_0x3732c4-0x0;var _0x12ca48=_0x216d[_0x3732c4];return _0x12ca48;};'use strict';var BPromise=require(_0xd216('0x0'));var https=require(_0xd216('0x1'));var logger=require(_0xd216('0x2'))(_0xd216('0x3'));var USERNAME=_0xd216('0x4');var PASSWORD='3eAmWpBVP0';function openIssue(_0x1862bd,_0x10efa6){var _0x3703da={'fields':{'project':{'key':_0x1862bd[_0xd216('0x5')]||_0xd216('0x6')},'summary':(_0x1862bd[_0xd216('0x7')]||_0xd216('0x8'))+_0xd216('0x9')+_0x1862bd['ip'],'description':_0x1862bd[_0xd216('0xa')]||JSON[_0xd216('0xb')](_0x1862bd),'issuetype':{'name':_0x1862bd['issuetype']||_0xd216('0xc')}}};_0x3703da['fields'][_0xd216('0xd')]=_0x1862bd[_0xd216('0xe')];_0x3703da['fields'][_0xd216('0xf')]=_0x1862bd['oldToken'];_0x3703da[_0xd216('0x10')][_0xd216('0x11')]=_0x1862bd[_0xd216('0x12')];_0x3703da[_0xd216('0x10')][_0xd216('0x13')]=_0x1862bd[_0xd216('0x14')];_0x3703da[_0xd216('0x10')]['customfield_11504']=_0x1862bd['reason'];_0x3703da[_0xd216('0x10')]['customfield_10102']=_0x1862bd['ip'];var _0x64b95d={'host':'track.xcallymotion.com','port':0x1bb,'path':_0xd216('0x15'),'method':_0xd216('0x16'),'timeout':0x4e20,'headers':{'Content-Type':_0xd216('0x17'),'Authorization':_0xd216('0x18')+new Buffer(USERNAME+':'+PASSWORD)['toString'](_0xd216('0x19'))}};var _0x514f31=JSON[_0xd216('0xb')](_0x3703da);var _0xfca5ad=https['request'](_0x64b95d,function(_0x10361d){_0x10361d['setEncoding'](_0xd216('0x1a'));var _0x4c0540='';_0x10361d['on'](_0xd216('0x1b'),function(_0x210b2f){_0x4c0540+=_0x210b2f;});_0x10361d['on'](_0xd216('0x1c'),function(){if(_0x10efa6){return _0x10efa6['status'](_0x10361d[_0xd216('0x1d')])['json'](JSON[_0xd216('0x1e')](_0x4c0540));}});});_0xfca5ad['on'](_0xd216('0x1f'),function(_0x56bb90){if(_0x10efa6){return _0x10efa6['status'](0x1f4)[_0xd216('0x20')]({'errors':[{'message':_0xd216('0x21'),'type':_0xd216('0x22')}]});}});_0xfca5ad[_0xd216('0x23')](_0x514f31);_0xfca5ad[_0xd216('0x1c')]();}exports[_0xd216('0x24')]=openIssue;exports['send']=function(_0x5e6afe,_0x314a2a){_0x5e6afe[_0xd216('0x25')]['ip']=_0x5e6afe[_0xd216('0x26')]['x-forwarded-for']||_0x5e6afe[_0xd216('0x27')]['remoteAddress']||_0x5e6afe[_0xd216('0x28')][_0xd216('0x29')]||_0x5e6afe['connection'][_0xd216('0x28')][_0xd216('0x29')];return openIssue(_0x5e6afe[_0xd216('0x25')],_0x314a2a);}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/index.js b/server/api/jscriptyAnswerReport/index.js index bab4a1f..4c3c839 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 _0x702d=['connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/describe','describe','/:id','isAuthenticated','show','post','create','put','update','destroy','exports','multer','util','path'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x702d,0x147));var _0xd702=function(_0x5003fd,_0x462c9f){_0x5003fd=_0x5003fd-0x0;var _0x174483=_0x702d[_0x5003fd];return _0x174483;};'use strict';var multer=require(_0xd702('0x0'));var util=require(_0xd702('0x1'));var path=require(_0xd702('0x2'));var timeout=require(_0xd702('0x3'));var express=require(_0xd702('0x4'));var router=express['Router']();var fs_extra=require(_0xd702('0x5'));var auth=require(_0xd702('0x6'));var interaction=require(_0xd702('0x7'));var config=require(_0xd702('0x8'));var controller=require('./jscriptyAnswerReport.controller');router[_0xd702('0x9')]('/',auth['isAuthenticated'](),controller[_0xd702('0xa')]);router[_0xd702('0x9')](_0xd702('0xb'),auth['isAuthenticated'](),controller[_0xd702('0xc')]);router['get'](_0xd702('0xd'),auth[_0xd702('0xe')](),controller[_0xd702('0xf')]);router[_0xd702('0x10')]('/',auth[_0xd702('0xe')](),controller[_0xd702('0x11')]);router[_0xd702('0x12')](_0xd702('0xd'),auth[_0xd702('0xe')](),controller[_0xd702('0x13')]);router['delete']('/:id',auth[_0xd702('0xe')](),controller[_0xd702('0x14')]);module[_0xd702('0x15')]=router; \ No newline at end of file +var _0x99e9=['update','delete','destroy','exports','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./jscriptyAnswerReport.controller','isAuthenticated','index','get','/describe','describe','/:id','show','post','create','put'];(function(_0x57e544,_0x1bc420){var _0x455bef=function(_0x6baf8d){while(--_0x6baf8d){_0x57e544['push'](_0x57e544['shift']());}};_0x455bef(++_0x1bc420);}(_0x99e9,0xb4));var _0x999e=function(_0x4d21ff,_0x19d202){_0x4d21ff=_0x4d21ff-0x0;var _0x22b554=_0x99e9[_0x4d21ff];return _0x22b554;};'use strict';var multer=require('multer');var util=require(_0x999e('0x0'));var path=require(_0x999e('0x1'));var timeout=require(_0x999e('0x2'));var express=require(_0x999e('0x3'));var router=express['Router']();var fs_extra=require(_0x999e('0x4'));var auth=require(_0x999e('0x5'));var interaction=require(_0x999e('0x6'));var config=require('../../config/environment');var controller=require(_0x999e('0x7'));router['get']('/',auth[_0x999e('0x8')](),controller[_0x999e('0x9')]);router[_0x999e('0xa')](_0x999e('0xb'),auth['isAuthenticated'](),controller[_0x999e('0xc')]);router[_0x999e('0xa')](_0x999e('0xd'),auth[_0x999e('0x8')](),controller[_0x999e('0xe')]);router[_0x999e('0xf')]('/',auth[_0x999e('0x8')](),controller[_0x999e('0x10')]);router[_0x999e('0x11')](_0x999e('0xd'),auth[_0x999e('0x8')](),controller[_0x999e('0x12')]);router[_0x999e('0x13')](_0x999e('0xd'),auth[_0x999e('0x8')](),controller[_0x999e('0x14')]);module[_0x999e('0x15')]=router; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js index e955dc2..7cdbcdc 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(_0x88cd7b,_0x4c884c){var _0x56fcc8=function(_0x513b3d){while(--_0x513b3d){_0x88cd7b['push'](_0x88cd7b['shift']());}};_0x56fcc8(++_0x4c884c);}(_0x7a54,0x106));var _0x47a5=function(_0x1ee97a,_0x40b837){_0x1ee97a=_0x1ee97a-0x0;var _0x4c7a5c=_0x7a54[_0x1ee97a];return _0x4c7a5c;};'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(_0x4d613c,_0x55f220){var _0x301fe3=function(_0x5eec0b){while(--_0x5eec0b){_0x4d613c['push'](_0x4d613c['shift']());}};_0x301fe3(++_0x55f220);}(_0x7a54,0x106));var _0x47a5=function(_0x24ce8d,_0x449907){_0x24ce8d=_0x24ce8d-0x0;var _0x33a715=_0x7a54[_0x24ce8d];return _0x33a715;};'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 7d258b8..5e19c20 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 _0xbacd=['../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','count','limit','set','apply','reject','update','then','destroy','error','stack','name','send','index','map','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','VIRTUAL','options','JscriptyAnswerReport','includeAll','include','findAll','rows','catch','show','params','merge','find','create','body','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs'];(function(_0x3a4a1d,_0x338251){var _0x4c6e50=function(_0x38356c){while(--_0x38356c){_0x3a4a1d['push'](_0x3a4a1d['shift']());}};_0x4c6e50(++_0x338251);}(_0xbacd,0x1c5));var _0xdbac=function(_0x34ea1f,_0x63bf83){_0x34ea1f=_0x34ea1f-0x0;var _0x301e44=_0xbacd[_0x34ea1f];return _0x301e44;};'use strict';var emlformat=require(_0xdbac('0x0'));var rimraf=require(_0xdbac('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xdbac('0x2'));var rp=require(_0xdbac('0x3'));var moment=require(_0xdbac('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xdbac('0x5'));var util=require(_0xdbac('0x6'));var path=require(_0xdbac('0x7'));var sox=require(_0xdbac('0x8'));var csv=require(_0xdbac('0x9'));var ejs=require(_0xdbac('0xa'));var fs=require('fs');var fs_extra=require(_0xdbac('0xb'));var _=require(_0xdbac('0xc'));var squel=require(_0xdbac('0xd'));var crypto=require(_0xdbac('0xe'));var jsforce=require(_0xdbac('0xf'));var deskjs=require(_0xdbac('0x10'));var toCsv=require(_0xdbac('0x9'));var querystring=require(_0xdbac('0x11'));var Papa=require(_0xdbac('0x12'));var Redis=require('ioredis');var authService=require(_0xdbac('0x13'));var qs=require(_0xdbac('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xdbac('0x15'));var logger=require('../../config/logger')(_0xdbac('0x16'));var utils=require(_0xdbac('0x17'));var config=require(_0xdbac('0x18'));var licenseUtil=require(_0xdbac('0x19'));var db=require(_0xdbac('0x1a'))['db'];function respondWithStatusCode(_0x1ebee0,_0xd9ec70){_0xd9ec70=_0xd9ec70||0xcc;return function(_0x2c7f44){if(_0x2c7f44){return _0x1ebee0[_0xdbac('0x1b')](_0xd9ec70);}return _0x1ebee0['status'](_0xd9ec70)[_0xdbac('0x1c')]();};}function respondWithResult(_0x1793b9,_0x1eed36){_0x1eed36=_0x1eed36||0xc8;return function(_0x14ebaa){if(_0x14ebaa){return _0x1793b9[_0xdbac('0x1d')](_0x1eed36)[_0xdbac('0x1e')](_0x14ebaa);}};}function respondWithFilteredResult(_0x94a61,_0x176da6){return function(_0x574e58){if(_0x574e58){var _0x2694ef=typeof _0x176da6[_0xdbac('0x1f')]===_0xdbac('0x20')&&typeof _0x176da6['limit']===_0xdbac('0x20');var _0x36e0de=_0x574e58[_0xdbac('0x21')];var _0x252fc1=_0x2694ef?0x0:_0x176da6[_0xdbac('0x1f')];var _0x1a9690=_0x2694ef?_0x574e58[_0xdbac('0x21')]:_0x176da6[_0xdbac('0x1f')]+_0x176da6[_0xdbac('0x22')];var _0x1301d2;if(_0x1a9690>=_0x36e0de){_0x1a9690=_0x36e0de;_0x1301d2=0xc8;}else{_0x1301d2=0xce;}_0x94a61[_0xdbac('0x1d')](_0x1301d2);return _0x94a61[_0xdbac('0x23')]('Content-Range',_0x252fc1+'-'+_0x1a9690+'/'+_0x36e0de)[_0xdbac('0x1e')](_0x574e58);}return null;};}function patchUpdates(_0x323801){return function(_0x4e4af9){try{jsonpatch[_0xdbac('0x24')](_0x4e4af9,_0x323801,!![]);}catch(_0x582c0b){return BPromise[_0xdbac('0x25')](_0x582c0b);}return _0x4e4af9['save']();};}function saveUpdates(_0x1ead7b,_0x2bcf69){return function(_0x20642c){if(_0x20642c){return _0x20642c[_0xdbac('0x26')](_0x1ead7b)[_0xdbac('0x27')](function(_0x4148fc){return _0x4148fc;});}return null;};}function removeEntity(_0x28393a,_0x4e68b0){return function(_0x361930){if(_0x361930){return _0x361930[_0xdbac('0x28')]()[_0xdbac('0x27')](function(){_0x28393a[_0xdbac('0x1d')](0xcc)[_0xdbac('0x1c')]();});}};}function handleEntityNotFound(_0x2b4cda,_0x3a0f3f){return function(_0x15653d){if(!_0x15653d){_0x2b4cda[_0xdbac('0x1b')](0x194);}return _0x15653d;};}function handleError(_0x175ebc,_0x2cb8b4){_0x2cb8b4=_0x2cb8b4||0x1f4;return function(_0x1ea3c3){logger[_0xdbac('0x29')](_0x1ea3c3[_0xdbac('0x2a')]);if(_0x1ea3c3[_0xdbac('0x2b')]){delete _0x1ea3c3[_0xdbac('0x2b')];}_0x175ebc[_0xdbac('0x1d')](_0x2cb8b4)[_0xdbac('0x2c')](_0x1ea3c3);};}exports[_0xdbac('0x2d')]=function(_0xe744cc,_0x1caa18){var _0x4e7ef9={},_0x446a32={},_0x397f3d={'count':0x0,'rows':[]};var _0x43c0a3=_[_0xdbac('0x2e')](db['JscriptyAnswerReport']['rawAttributes'],function(_0x10c3c8){return{'name':_0x10c3c8[_0xdbac('0x2f')],'type':_0x10c3c8[_0xdbac('0x30')][_0xdbac('0x31')]};});_0x446a32['model']=_[_0xdbac('0x2e')](_0x43c0a3,_0xdbac('0x2b'));_0x446a32[_0xdbac('0x32')]=_[_0xdbac('0x33')](_0xe744cc[_0xdbac('0x32')]);_0x446a32[_0xdbac('0x34')]=_[_0xdbac('0x35')](_0x446a32[_0xdbac('0x36')],_0x446a32['query']);_0x4e7ef9['attributes']=_[_0xdbac('0x35')](_0x446a32[_0xdbac('0x36')],qs[_0xdbac('0x37')](_0xe744cc[_0xdbac('0x32')]['fields']));_0x4e7ef9['attributes']=_0x4e7ef9[_0xdbac('0x38')][_0xdbac('0x39')]?_0x4e7ef9[_0xdbac('0x38')]:_0x446a32[_0xdbac('0x36')];if(!_0xe744cc[_0xdbac('0x32')][_0xdbac('0x3a')](_0xdbac('0x3b'))){_0x4e7ef9[_0xdbac('0x22')]=qs[_0xdbac('0x22')](_0xe744cc[_0xdbac('0x32')][_0xdbac('0x22')]);_0x4e7ef9[_0xdbac('0x1f')]=qs[_0xdbac('0x1f')](_0xe744cc['query'][_0xdbac('0x1f')]);}_0x4e7ef9['order']=qs[_0xdbac('0x3c')](_0xe744cc[_0xdbac('0x32')][_0xdbac('0x3c')]);_0x4e7ef9[_0xdbac('0x3d')]=qs['filters'](_[_0xdbac('0x3e')](_0xe744cc[_0xdbac('0x32')],_0x446a32['filters']),_0x43c0a3);if(_0xe744cc['query'][_0xdbac('0x3f')]){_0x4e7ef9['where']=_['merge'](_0x4e7ef9[_0xdbac('0x3d')],{'$or':_[_0xdbac('0x2e')](_0x43c0a3,function(_0x6c5ecc){if(_0x6c5ecc['type']!==_0xdbac('0x40')){var _0x35f8b7={};_0x35f8b7[_0x6c5ecc[_0xdbac('0x2b')]]={'$like':'%'+_0xe744cc[_0xdbac('0x32')]['filter']+'%'};return _0x35f8b7;}})});}_0x4e7ef9=_['merge']({},_0x4e7ef9,_0xe744cc[_0xdbac('0x41')]);var _0x124904={'where':_0x4e7ef9[_0xdbac('0x3d')]};return db[_0xdbac('0x42')][_0xdbac('0x21')](_0x124904)['then'](function(_0x1a27a4){_0x397f3d[_0xdbac('0x21')]=_0x1a27a4;if(_0xe744cc['query'][_0xdbac('0x43')]){_0x4e7ef9[_0xdbac('0x44')]=[{'all':!![]}];}return db[_0xdbac('0x42')][_0xdbac('0x45')](_0x4e7ef9);})[_0xdbac('0x27')](function(_0x575b59){_0x397f3d[_0xdbac('0x46')]=_0x575b59;return _0x397f3d;})[_0xdbac('0x27')](respondWithFilteredResult(_0x1caa18,_0x4e7ef9))[_0xdbac('0x47')](handleError(_0x1caa18,null));};exports[_0xdbac('0x48')]=function(_0x726ba4,_0x25344a){var _0x2589e1={'raw':!![],'where':{'id':_0x726ba4[_0xdbac('0x49')]['id']}},_0x3c1894={};_0x3c1894[_0xdbac('0x36')]=_[_0xdbac('0x33')](db[_0xdbac('0x42')]['rawAttributes']);_0x3c1894['query']=_['keys'](_0x726ba4['query']);_0x3c1894[_0xdbac('0x34')]=_[_0xdbac('0x35')](_0x3c1894[_0xdbac('0x36')],_0x3c1894[_0xdbac('0x32')]);_0x2589e1[_0xdbac('0x38')]=_[_0xdbac('0x35')](_0x3c1894[_0xdbac('0x36')],qs[_0xdbac('0x37')](_0x726ba4[_0xdbac('0x32')]['fields']));_0x2589e1['attributes']=_0x2589e1['attributes'][_0xdbac('0x39')]?_0x2589e1[_0xdbac('0x38')]:_0x3c1894['model'];if(_0x726ba4['query']['includeAll']){_0x2589e1[_0xdbac('0x44')]=[{'all':!![]}];}_0x2589e1=_[_0xdbac('0x4a')]({},_0x2589e1,_0x726ba4[_0xdbac('0x41')]);return db['JscriptyAnswerReport'][_0xdbac('0x4b')](_0x2589e1)[_0xdbac('0x27')](handleEntityNotFound(_0x25344a,null))[_0xdbac('0x27')](respondWithResult(_0x25344a,null))[_0xdbac('0x47')](handleError(_0x25344a,null));};exports[_0xdbac('0x4c')]=function(_0x5b8aca,_0x35696f){return db[_0xdbac('0x42')][_0xdbac('0x4c')](_0x5b8aca[_0xdbac('0x4d')],{})['then'](respondWithResult(_0x35696f,0xc9))[_0xdbac('0x47')](handleError(_0x35696f,null));};exports[_0xdbac('0x26')]=function(_0x1463ca,_0x5d6e86){if(_0x1463ca[_0xdbac('0x4d')]['id']){delete _0x1463ca[_0xdbac('0x4d')]['id'];}return db[_0xdbac('0x42')][_0xdbac('0x4b')]({'where':{'id':_0x1463ca[_0xdbac('0x49')]['id']}})[_0xdbac('0x27')](handleEntityNotFound(_0x5d6e86,null))['then'](saveUpdates(_0x1463ca[_0xdbac('0x4d')],null))[_0xdbac('0x27')](respondWithResult(_0x5d6e86,null))['catch'](handleError(_0x5d6e86,null));};exports[_0xdbac('0x28')]=function(_0x12b600,_0x26ee2e){return db[_0xdbac('0x42')]['find']({'where':{'id':_0x12b600['params']['id']}})[_0xdbac('0x27')](handleEntityNotFound(_0x26ee2e,null))[_0xdbac('0x27')](removeEntity(_0x26ee2e,null))['catch'](handleError(_0x26ee2e,null));};exports['describe']=function(_0x3f0b35,_0x538747){return db[_0xdbac('0x42')][_0xdbac('0x4e')]()[_0xdbac('0x27')](respondWithResult(_0x538747,null))['catch'](handleError(_0x538747,null));}; \ No newline at end of file +var _0xd8fb=['catch','show','params','keys','include','options','find','create','body','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','mustache','util','sox','to-csv','fs-extra','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','Content-Range','apply','reject','save','update','then','error','name','send','index','map','JscriptyAnswerReport','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','limit','sort','where','pick','filter','merge','VIRTUAL','count','includeAll','findAll','rows'];(function(_0x2c7552,_0x22938c){var _0x4ced52=function(_0xffad9a){while(--_0xffad9a){_0x2c7552['push'](_0x2c7552['shift']());}};_0x4ced52(++_0x22938c);}(_0xd8fb,0x99));var _0xbd8f=function(_0x27a7d0,_0x130d81){_0x27a7d0=_0x27a7d0-0x0;var _0xd148cb=_0xd8fb[_0x27a7d0];return _0xd148cb;};'use strict';var emlformat=require(_0xbd8f('0x0'));var rimraf=require(_0xbd8f('0x1'));var zipdir=require(_0xbd8f('0x2'));var jsonpatch=require(_0xbd8f('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xbd8f('0x4'));var util=require(_0xbd8f('0x5'));var path=require('path');var sox=require(_0xbd8f('0x6'));var csv=require(_0xbd8f('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xbd8f('0x8'));var _=require('lodash');var squel=require(_0xbd8f('0x9'));var crypto=require('crypto');var jsforce=require(_0xbd8f('0xa'));var deskjs=require(_0xbd8f('0xb'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xbd8f('0xc'));var Redis=require(_0xbd8f('0xd'));var authService=require(_0xbd8f('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0xbd8f('0xf'));var hardwareService=require(_0xbd8f('0x10'));var logger=require('../../config/logger')('api');var utils=require(_0xbd8f('0x11'));var config=require(_0xbd8f('0x12'));var licenseUtil=require(_0xbd8f('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x230988,_0x159f09){_0x159f09=_0x159f09||0xcc;return function(_0x39be16){if(_0x39be16){return _0x230988[_0xbd8f('0x14')](_0x159f09);}return _0x230988[_0xbd8f('0x15')](_0x159f09)[_0xbd8f('0x16')]();};}function respondWithResult(_0x37d4d5,_0x29ffe8){_0x29ffe8=_0x29ffe8||0xc8;return function(_0x14606c){if(_0x14606c){return _0x37d4d5['status'](_0x29ffe8)[_0xbd8f('0x17')](_0x14606c);}};}function respondWithFilteredResult(_0x829fb2,_0xa57e91){return function(_0x10d72e){if(_0x10d72e){var _0x4da96f=typeof _0xa57e91[_0xbd8f('0x18')]===_0xbd8f('0x19')&&typeof _0xa57e91['limit']===_0xbd8f('0x19');var _0xf5e7a=_0x10d72e['count'];var _0x4435b9=_0x4da96f?0x0:_0xa57e91[_0xbd8f('0x18')];var _0x47d317=_0x4da96f?_0x10d72e['count']:_0xa57e91[_0xbd8f('0x18')]+_0xa57e91['limit'];var _0x5705c5;if(_0x47d317>=_0xf5e7a){_0x47d317=_0xf5e7a;_0x5705c5=0xc8;}else{_0x5705c5=0xce;}_0x829fb2[_0xbd8f('0x15')](_0x5705c5);return _0x829fb2['set'](_0xbd8f('0x1a'),_0x4435b9+'-'+_0x47d317+'/'+_0xf5e7a)[_0xbd8f('0x17')](_0x10d72e);}return null;};}function patchUpdates(_0xb47c8e){return function(_0x897f25){try{jsonpatch[_0xbd8f('0x1b')](_0x897f25,_0xb47c8e,!![]);}catch(_0x20cab7){return BPromise[_0xbd8f('0x1c')](_0x20cab7);}return _0x897f25[_0xbd8f('0x1d')]();};}function saveUpdates(_0x2fbe3b,_0x775acc){return function(_0xfe4048){if(_0xfe4048){return _0xfe4048[_0xbd8f('0x1e')](_0x2fbe3b)[_0xbd8f('0x1f')](function(_0x15c4a9){return _0x15c4a9;});}return null;};}function removeEntity(_0x320ede,_0xd11ae){return function(_0x395b1b){if(_0x395b1b){return _0x395b1b['destroy']()[_0xbd8f('0x1f')](function(){_0x320ede[_0xbd8f('0x15')](0xcc)[_0xbd8f('0x16')]();});}};}function handleEntityNotFound(_0x2f3df7,_0xa88414){return function(_0x2257fd){if(!_0x2257fd){_0x2f3df7[_0xbd8f('0x14')](0x194);}return _0x2257fd;};}function handleError(_0x264e62,_0x4ea554){_0x4ea554=_0x4ea554||0x1f4;return function(_0x40cb43){logger[_0xbd8f('0x20')](_0x40cb43['stack']);if(_0x40cb43[_0xbd8f('0x21')]){delete _0x40cb43['name'];}_0x264e62[_0xbd8f('0x15')](_0x4ea554)[_0xbd8f('0x22')](_0x40cb43);};}exports[_0xbd8f('0x23')]=function(_0x202126,_0x2aefa2){var _0x247b07={},_0x4c4431={},_0x166de7={'count':0x0,'rows':[]};var _0x14f3cb=_[_0xbd8f('0x24')](db[_0xbd8f('0x25')][_0xbd8f('0x26')],function(_0x2ac26f){return{'name':_0x2ac26f[_0xbd8f('0x27')],'type':_0x2ac26f['type'][_0xbd8f('0x28')]};});_0x4c4431[_0xbd8f('0x29')]=_[_0xbd8f('0x24')](_0x14f3cb,_0xbd8f('0x21'));_0x4c4431['query']=_['keys'](_0x202126[_0xbd8f('0x2a')]);_0x4c4431[_0xbd8f('0x2b')]=_[_0xbd8f('0x2c')](_0x4c4431[_0xbd8f('0x29')],_0x4c4431['query']);_0x247b07[_0xbd8f('0x2d')]=_[_0xbd8f('0x2c')](_0x4c4431[_0xbd8f('0x29')],qs[_0xbd8f('0x2e')](_0x202126[_0xbd8f('0x2a')]['fields']));_0x247b07[_0xbd8f('0x2d')]=_0x247b07[_0xbd8f('0x2d')][_0xbd8f('0x2f')]?_0x247b07[_0xbd8f('0x2d')]:_0x4c4431[_0xbd8f('0x29')];if(!_0x202126['query'][_0xbd8f('0x30')]('nolimit')){_0x247b07[_0xbd8f('0x31')]=qs[_0xbd8f('0x31')](_0x202126[_0xbd8f('0x2a')][_0xbd8f('0x31')]);_0x247b07[_0xbd8f('0x18')]=qs[_0xbd8f('0x18')](_0x202126['query']['offset']);}_0x247b07['order']=qs[_0xbd8f('0x32')](_0x202126[_0xbd8f('0x2a')][_0xbd8f('0x32')]);_0x247b07[_0xbd8f('0x33')]=qs[_0xbd8f('0x2b')](_[_0xbd8f('0x34')](_0x202126[_0xbd8f('0x2a')],_0x4c4431[_0xbd8f('0x2b')]),_0x14f3cb);if(_0x202126[_0xbd8f('0x2a')][_0xbd8f('0x35')]){_0x247b07[_0xbd8f('0x33')]=_[_0xbd8f('0x36')](_0x247b07[_0xbd8f('0x33')],{'$or':_[_0xbd8f('0x24')](_0x14f3cb,function(_0x391d45){if(_0x391d45['type']!==_0xbd8f('0x37')){var _0x4181e0={};_0x4181e0[_0x391d45['name']]={'$like':'%'+_0x202126[_0xbd8f('0x2a')][_0xbd8f('0x35')]+'%'};return _0x4181e0;}})});}_0x247b07=_[_0xbd8f('0x36')]({},_0x247b07,_0x202126['options']);var _0x21da54={'where':_0x247b07['where']};return db[_0xbd8f('0x25')][_0xbd8f('0x38')](_0x21da54)[_0xbd8f('0x1f')](function(_0x4f2ebc){_0x166de7[_0xbd8f('0x38')]=_0x4f2ebc;if(_0x202126[_0xbd8f('0x2a')][_0xbd8f('0x39')]){_0x247b07['include']=[{'all':!![]}];}return db[_0xbd8f('0x25')][_0xbd8f('0x3a')](_0x247b07);})[_0xbd8f('0x1f')](function(_0x351027){_0x166de7[_0xbd8f('0x3b')]=_0x351027;return _0x166de7;})[_0xbd8f('0x1f')](respondWithFilteredResult(_0x2aefa2,_0x247b07))[_0xbd8f('0x3c')](handleError(_0x2aefa2,null));};exports[_0xbd8f('0x3d')]=function(_0x14b768,_0x5e1e77){var _0x52c62b={'raw':!![],'where':{'id':_0x14b768[_0xbd8f('0x3e')]['id']}},_0x2907a3={};_0x2907a3[_0xbd8f('0x29')]=_[_0xbd8f('0x3f')](db['JscriptyAnswerReport'][_0xbd8f('0x26')]);_0x2907a3[_0xbd8f('0x2a')]=_[_0xbd8f('0x3f')](_0x14b768[_0xbd8f('0x2a')]);_0x2907a3[_0xbd8f('0x2b')]=_['intersection'](_0x2907a3['model'],_0x2907a3[_0xbd8f('0x2a')]);_0x52c62b['attributes']=_[_0xbd8f('0x2c')](_0x2907a3[_0xbd8f('0x29')],qs[_0xbd8f('0x2e')](_0x14b768[_0xbd8f('0x2a')][_0xbd8f('0x2e')]));_0x52c62b[_0xbd8f('0x2d')]=_0x52c62b[_0xbd8f('0x2d')][_0xbd8f('0x2f')]?_0x52c62b['attributes']:_0x2907a3[_0xbd8f('0x29')];if(_0x14b768[_0xbd8f('0x2a')][_0xbd8f('0x39')]){_0x52c62b[_0xbd8f('0x40')]=[{'all':!![]}];}_0x52c62b=_[_0xbd8f('0x36')]({},_0x52c62b,_0x14b768[_0xbd8f('0x41')]);return db[_0xbd8f('0x25')][_0xbd8f('0x42')](_0x52c62b)['then'](handleEntityNotFound(_0x5e1e77,null))[_0xbd8f('0x1f')](respondWithResult(_0x5e1e77,null))[_0xbd8f('0x3c')](handleError(_0x5e1e77,null));};exports[_0xbd8f('0x43')]=function(_0x1f12dd,_0x2fdbd0){return db[_0xbd8f('0x25')][_0xbd8f('0x43')](_0x1f12dd[_0xbd8f('0x44')],{})[_0xbd8f('0x1f')](respondWithResult(_0x2fdbd0,0xc9))[_0xbd8f('0x3c')](handleError(_0x2fdbd0,null));};exports[_0xbd8f('0x1e')]=function(_0x255c59,_0x3d0ffa){if(_0x255c59[_0xbd8f('0x44')]['id']){delete _0x255c59[_0xbd8f('0x44')]['id'];}return db[_0xbd8f('0x25')][_0xbd8f('0x42')]({'where':{'id':_0x255c59[_0xbd8f('0x3e')]['id']}})[_0xbd8f('0x1f')](handleEntityNotFound(_0x3d0ffa,null))['then'](saveUpdates(_0x255c59[_0xbd8f('0x44')],null))[_0xbd8f('0x1f')](respondWithResult(_0x3d0ffa,null))[_0xbd8f('0x3c')](handleError(_0x3d0ffa,null));};exports[_0xbd8f('0x45')]=function(_0x4ce6b0,_0x1b38ad){return db['JscriptyAnswerReport'][_0xbd8f('0x42')]({'where':{'id':_0x4ce6b0[_0xbd8f('0x3e')]['id']}})[_0xbd8f('0x1f')](handleEntityNotFound(_0x1b38ad,null))[_0xbd8f('0x1f')](removeEntity(_0x1b38ad,null))['catch'](handleError(_0x1b38ad,null));};exports[_0xbd8f('0x46')]=function(_0x35b814,_0x3b67ac){return db[_0xbd8f('0x25')][_0xbd8f('0x46')]()[_0xbd8f('0x1f')](respondWithResult(_0x3b67ac,null))['catch'](handleError(_0x3b67ac,null));}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js index 4642aaf..405f2ef 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 _0x263b=['../../config/environment','./jscriptyAnswerReport.attributes','exports','define','report_jscripty_answers','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf'];(function(_0x34da0f,_0x1b8c60){var _0x203145=function(_0x32fe5f){while(--_0x32fe5f){_0x34da0f['push'](_0x34da0f['shift']());}};_0x203145(++_0x1b8c60);}(_0x263b,0x87));var _0xb263=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x263b[_0x3947c9];return _0x2e7871;};'use strict';var _=require(_0xb263('0x0'));var util=require(_0xb263('0x1'));var logger=require(_0xb263('0x2'))(_0xb263('0x3'));var moment=require('moment');var BPromise=require(_0xb263('0x4'));var rp=require(_0xb263('0x5'));var fs=require('fs');var path=require(_0xb263('0x6'));var rimraf=require(_0xb263('0x7'));var config=require(_0xb263('0x8'));var attributes=require(_0xb263('0x9'));module[_0xb263('0xa')]=function(_0x171340,_0x3c547f){return _0x171340[_0xb263('0xb')]('JscriptyAnswerReport',attributes,{'tableName':_0xb263('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdd82=['request-promise','path','rimraf','./jscriptyAnswerReport.attributes','exports','define','report_jscripty_answers','lodash','util','../../config/logger','api','moment'];(function(_0x2cef86,_0xbae0a6){var _0x46dfd6=function(_0x52e464){while(--_0x52e464){_0x2cef86['push'](_0x2cef86['shift']());}};_0x46dfd6(++_0xbae0a6);}(_0xdd82,0xaf));var _0x2dd8=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xdd82[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x2dd8('0x0'));var util=require(_0x2dd8('0x1'));var logger=require(_0x2dd8('0x2'))(_0x2dd8('0x3'));var moment=require(_0x2dd8('0x4'));var BPromise=require('bluebird');var rp=require(_0x2dd8('0x5'));var fs=require('fs');var path=require(_0x2dd8('0x6'));var rimraf=require(_0x2dd8('0x7'));var config=require('../../config/environment');var attributes=require(_0x2dd8('0x8'));module[_0x2dd8('0x9')]=function(_0x86f06,_0x46a852){return _0x86f06[_0x2dd8('0xa')]('JscriptyAnswerReport',attributes,{'tableName':_0x2dd8('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.rpc.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.rpc.js index f33131f..d498fd6 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 _0x993b=['info','result','catch','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','JscriptyAnswerReport,\x20%s,\x20%s','request\x20sent','debug','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','stringify','error','message'];(function(_0x4f7588,_0x399e6b){var _0x535c70=function(_0x5c2bbb){while(--_0x5c2bbb){_0x4f7588['push'](_0x4f7588['shift']());}};_0x535c70(++_0x399e6b);}(_0x993b,0x1cf));var _0xb993=function(_0x1cb697,_0x2eb87e){_0x1cb697=_0x1cb697-0x0;var _0x32d161=_0x993b[_0x1cb697];return _0x32d161;};'use strict';var _=require(_0xb993('0x0'));var util=require(_0xb993('0x1'));var moment=require(_0xb993('0x2'));var BPromise=require(_0xb993('0x3'));var rs=require(_0xb993('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xb993('0x5'));var logger=require(_0xb993('0x6'))(_0xb993('0x7'));var config=require(_0xb993('0x8'));var jayson=require(_0xb993('0x9'));var client=jayson[_0xb993('0xa')][_0xb993('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4629b7,_0x1a8404,_0x36c032){return new BPromise(function(_0x4c55f6,_0x16f1a3){return client[_0xb993('0xc')](_0x4629b7,_0x36c032)['then'](function(_0x5759f8){logger['info'](_0xb993('0xd'),_0x1a8404,_0xb993('0xe'));logger[_0xb993('0xf')](_0xb993('0x10'),_0x1a8404,_0xb993('0xe'),JSON[_0xb993('0x11')](_0x5759f8));if(_0x5759f8['error']){if(_0x5759f8[_0xb993('0x12')]['code']===0x1f4){logger[_0xb993('0x12')](_0xb993('0xd'),_0x1a8404,_0x5759f8[_0xb993('0x12')][_0xb993('0x13')]);return _0x16f1a3(_0x5759f8[_0xb993('0x12')][_0xb993('0x13')]);}logger['error'](_0xb993('0xd'),_0x1a8404,_0x5759f8['error'][_0xb993('0x13')]);return _0x4c55f6(_0x5759f8[_0xb993('0x12')][_0xb993('0x13')]);}else{logger[_0xb993('0x14')](_0xb993('0xd'),_0x1a8404,_0xb993('0xe'));_0x4c55f6(_0x5759f8[_0xb993('0x15')][_0xb993('0x13')]);}})[_0xb993('0x16')](function(_0x15be2c){logger[_0xb993('0x12')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x1a8404,_0x15be2c);_0x16f1a3(_0x15be2c);});});} \ No newline at end of file +var _0xdf0f=['jayson/promise','client','http','request','then','info','JscriptyAnswerReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x1dac6e,_0x3a402e){var _0x16783a=function(_0x11d678){while(--_0x11d678){_0x1dac6e['push'](_0x1dac6e['shift']());}};_0x16783a(++_0x3a402e);}(_0xdf0f,0x199));var _0xfdf0=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0xdf0f[_0x432682];return _0x463d05;};'use strict';var _=require('lodash');var util=require(_0xfdf0('0x0'));var moment=require(_0xfdf0('0x1'));var BPromise=require(_0xfdf0('0x2'));var rs=require(_0xfdf0('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xfdf0('0x4'))['db'];var utils=require(_0xfdf0('0x5'));var logger=require(_0xfdf0('0x6'))(_0xfdf0('0x7'));var config=require(_0xfdf0('0x8'));var jayson=require(_0xfdf0('0x9'));var client=jayson[_0xfdf0('0xa')][_0xfdf0('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x139073,_0x1bb5fc,_0x20528f){return new BPromise(function(_0x637909,_0x5649ec){return client[_0xfdf0('0xc')](_0x139073,_0x20528f)[_0xfdf0('0xd')](function(_0x78afa5){logger[_0xfdf0('0xe')](_0xfdf0('0xf'),_0x1bb5fc,_0xfdf0('0x10'));logger[_0xfdf0('0x11')]('JscriptyAnswerReport,\x20%s,\x20%s,\x20%s',_0x1bb5fc,_0xfdf0('0x10'),JSON[_0xfdf0('0x12')](_0x78afa5));if(_0x78afa5['error']){if(_0x78afa5[_0xfdf0('0x13')]['code']===0x1f4){logger['error'](_0xfdf0('0xf'),_0x1bb5fc,_0x78afa5[_0xfdf0('0x13')][_0xfdf0('0x14')]);return _0x5649ec(_0x78afa5[_0xfdf0('0x13')][_0xfdf0('0x14')]);}logger['error'](_0xfdf0('0xf'),_0x1bb5fc,_0x78afa5[_0xfdf0('0x13')][_0xfdf0('0x14')]);return _0x637909(_0x78afa5['error']['message']);}else{logger[_0xfdf0('0xe')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x1bb5fc,_0xfdf0('0x10'));_0x637909(_0x78afa5['result'][_0xfdf0('0x14')]);}})[_0xfdf0('0x15')](function(_0x27674e){logger['error']('JscriptyAnswerReport,\x20%s,\x20%s',_0x1bb5fc,_0x27674e);_0x5649ec(_0x27674e);});});} \ No newline at end of file diff --git a/server/api/jscriptyProject/index.js b/server/api/jscriptyProject/index.js index ca54d23..081efdd 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 _0xfd3c=['Router','fs-extra','../../components/auth/service','../../config/environment','./jscriptyProject.controller','get','index','/:id','isAuthenticated','show','getSessions','getAnswers','/:id/summary','30s','getSummary','post','create','clone','put','update','delete','destroy','multer','util','connect-timeout','express'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xfd3c,0x19c));var _0xcfd3=function(_0x34b1e6,_0x288f50){_0x34b1e6=_0x34b1e6-0x0;var _0x284fcc=_0xfd3c[_0x34b1e6];return _0x284fcc;};'use strict';var multer=require(_0xcfd3('0x0'));var util=require(_0xcfd3('0x1'));var path=require('path');var timeout=require(_0xcfd3('0x2'));var express=require(_0xcfd3('0x3'));var router=express[_0xcfd3('0x4')]();var fs_extra=require(_0xcfd3('0x5'));var auth=require(_0xcfd3('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xcfd3('0x7'));var controller=require(_0xcfd3('0x8'));router[_0xcfd3('0x9')]('/',auth['isAuthenticated'](),controller[_0xcfd3('0xa')]);router[_0xcfd3('0x9')](_0xcfd3('0xb'),auth[_0xcfd3('0xc')](),controller[_0xcfd3('0xd')]);router[_0xcfd3('0x9')]('/:id/sessions',auth[_0xcfd3('0xc')](),controller[_0xcfd3('0xe')]);router[_0xcfd3('0x9')]('/:id/answers',auth['isAuthenticated'](),controller[_0xcfd3('0xf')]);router['get'](_0xcfd3('0x10'),auth[_0xcfd3('0xc')](),timeout(_0xcfd3('0x11')),controller[_0xcfd3('0x12')]);router[_0xcfd3('0x13')]('/',auth[_0xcfd3('0xc')](),controller[_0xcfd3('0x14')]);router[_0xcfd3('0x13')]('/:id/clone',auth[_0xcfd3('0xc')](),controller[_0xcfd3('0x15')]);router[_0xcfd3('0x16')](_0xcfd3('0xb'),auth['isAuthenticated'](),controller[_0xcfd3('0x17')]);router[_0xcfd3('0x18')]('/:id',auth[_0xcfd3('0xc')](),controller[_0xcfd3('0x19')]);module['exports']=router; \ No newline at end of file +var _0x848b=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','./jscriptyProject.controller','get','isAuthenticated','index','show','/:id/sessions','getSessions','/:id/answers','getAnswers','/:id/summary','30s','getSummary','create','post','/:id/clone','put','update','destroy','util','path','connect-timeout','express'];(function(_0x13ea00,_0x12f610){var _0x1f7347=function(_0x34ae63){while(--_0x34ae63){_0x13ea00['push'](_0x13ea00['shift']());}};_0x1f7347(++_0x12f610);}(_0x848b,0x11a));var _0xb848=function(_0x347d04,_0x1425ed){_0x347d04=_0x347d04-0x0;var _0x48d385=_0x848b[_0x347d04];return _0x48d385;};'use strict';var multer=require('multer');var util=require(_0xb848('0x0'));var path=require(_0xb848('0x1'));var timeout=require(_0xb848('0x2'));var express=require(_0xb848('0x3'));var router=express[_0xb848('0x4')]();var fs_extra=require(_0xb848('0x5'));var auth=require(_0xb848('0x6'));var interaction=require(_0xb848('0x7'));var config=require('../../config/environment');var controller=require(_0xb848('0x8'));router[_0xb848('0x9')]('/',auth[_0xb848('0xa')](),controller[_0xb848('0xb')]);router[_0xb848('0x9')]('/:id',auth[_0xb848('0xa')](),controller[_0xb848('0xc')]);router['get'](_0xb848('0xd'),auth['isAuthenticated'](),controller[_0xb848('0xe')]);router['get'](_0xb848('0xf'),auth[_0xb848('0xa')](),controller[_0xb848('0x10')]);router[_0xb848('0x9')](_0xb848('0x11'),auth[_0xb848('0xa')](),timeout(_0xb848('0x12')),controller[_0xb848('0x13')]);router['post']('/',auth['isAuthenticated'](),controller[_0xb848('0x14')]);router[_0xb848('0x15')](_0xb848('0x16'),auth[_0xb848('0xa')](),controller['clone']);router[_0xb848('0x17')]('/:id',auth[_0xb848('0xa')](),controller[_0xb848('0x18')]);router['delete']('/:id',auth[_0xb848('0xa')](),controller[_0xb848('0x19')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.attributes.js b/server/api/jscriptyProject/jscriptyProject.attributes.js index cc085e6..8a6e142 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 _0x8983=['long','isObjectLike','setDataValue','formData','isString','format','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','getDataValue','name','description','BOOLEAN','util','exports','STRING','TEXT'];(function(_0x16daee,_0xaf8850){var _0x436115=function(_0x2ba0d9){while(--_0x2ba0d9){_0x16daee['push'](_0x16daee['shift']());}};_0x436115(++_0xaf8850);}(_0x8983,0x164));var _0x3898=function(_0x3640e6,_0x3c9d69){_0x3640e6=_0x3640e6-0x0;var _0xe4959f=_0x8983[_0x3640e6];return _0xe4959f;};'use strict';var Sequelize=require('sequelize');var _=require('lodash');var util=require(_0x3898('0x0'));module[_0x3898('0x1')]={'name':{'type':Sequelize[_0x3898('0x2')],'unique':'name'},'description':{'type':Sequelize[_0x3898('0x2')]},'formData':{'type':Sequelize[_0x3898('0x3')](_0x3898('0x4')),'set':function(_0x569540){if(_[_0x3898('0x5')](_0x569540)){this[_0x3898('0x6')](_0x3898('0x7'),JSON['stringify'](_0x569540));}else if(_[_0x3898('0x8')](_0x569540)){this[_0x3898('0x6')](_0x3898('0x7'),_0x569540);}else{this[_0x3898('0x6')](_0x3898('0x7'),util[_0x3898('0x9')](_0x3898('0xa'),this[_0x3898('0xb')](_0x3898('0xc'))||'',this[_0x3898('0xb')](_0x3898('0xd'))||''));}}},'enableUncompleteSave':{'type':Sequelize[_0x3898('0xe')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0xa7f9=['format','getDataValue','description','BOOLEAN','sequelize','lodash','util','STRING','name','setDataValue','isString','formData'];(function(_0x1e40f8,_0x461032){var _0x116025=function(_0x268b5d){while(--_0x268b5d){_0x1e40f8['push'](_0x1e40f8['shift']());}};_0x116025(++_0x461032);}(_0xa7f9,0x1c0));var _0x9a7f=function(_0x324277,_0xa7681f){_0x324277=_0x324277-0x0;var _0x42965e=_0xa7f9[_0x324277];return _0x42965e;};'use strict';var Sequelize=require(_0x9a7f('0x0'));var _=require(_0x9a7f('0x1'));var util=require(_0x9a7f('0x2'));module['exports']={'name':{'type':Sequelize[_0x9a7f('0x3')],'unique':_0x9a7f('0x4')},'description':{'type':Sequelize[_0x9a7f('0x3')]},'formData':{'type':Sequelize['TEXT']('long'),'set':function(_0x13df9d){if(_['isObjectLike'](_0x13df9d)){this[_0x9a7f('0x5')]('formData',JSON['stringify'](_0x13df9d));}else if(_[_0x9a7f('0x6')](_0x13df9d)){this['setDataValue'](_0x9a7f('0x7'),_0x13df9d);}else{this[_0x9a7f('0x5')](_0x9a7f('0x7'),util[_0x9a7f('0x8')]('{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}',this[_0x9a7f('0x9')](_0x9a7f('0x4'))||'',this[_0x9a7f('0x9')](_0x9a7f('0xa'))||''));}}},'enableUncompleteSave':{'type':Sequelize[_0x9a7f('0xb')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0x9a7f('0xb')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.controller.js b/server/api/jscriptyProject/jscriptyProject.controller.js index 51c1d13..1954e29 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 _0x0bb4=['request-promise','moment','bluebird','util','sox','ejs','fs-extra','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','get','Projects','error','stack','name','index','map','rawAttributes','fieldName','key','model','query','keys','attributes','intersection','hasOwnProperty','nolimit','order','sort','filters','filter','where','merge','type','VIRTUAL','options','includeAll','JscriptyProject','findAll','catch','show','params','fields','include','find','create','user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','length','omit','updatedAt','body','createdAt','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','getSessions','JscriptySessionReport','pick','ProjectId','rows','getAnswers','findOne','JscriptyAnswerReport','number','fromCharCode','toString','indexOf','replace','getSummary','startTime','parse','JscriptyQuestionReport','-createdAt','questionId','question','starttime','format','YYYY-MM-DD\x20HH:mm:ss','SessionId','push','isEmpty','writeFileSync','/tmp/Jscripty_Project_%d_Summary_%s.csv','setHeader','Content-disposition','Jscripty_Project_%d_Summary_%s.csv','text/csv','eml-format','rimraf','fast-json-patch'];(function(_0x1934b0,_0x505b8a){var _0x24fd49=function(_0x1f1df1){while(--_0x1f1df1){_0x1934b0['push'](_0x1934b0['shift']());}};_0x24fd49(++_0x505b8a);}(_0x0bb4,0x77));var _0x40bb=function(_0x166dd3,_0x5bc63b){_0x166dd3=_0x166dd3-0x0;var _0x1e0c58=_0x0bb4[_0x166dd3];return _0x1e0c58;};'use strict';var emlformat=require(_0x40bb('0x0'));var rimraf=require(_0x40bb('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x40bb('0x2'));var rp=require(_0x40bb('0x3'));var moment=require(_0x40bb('0x4'));var BPromise=require(_0x40bb('0x5'));var Mustache=require('mustache');var util=require(_0x40bb('0x6'));var path=require('path');var sox=require(_0x40bb('0x7'));var csv=require('to-csv');var ejs=require(_0x40bb('0x8'));var fs=require('fs');var fs_extra=require(_0x40bb('0x9'));var _=require('lodash');var squel=require(_0x40bb('0xa'));var crypto=require(_0x40bb('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x40bb('0xc'));var toCsv=require('to-csv');var querystring=require(_0x40bb('0xd'));var Papa=require(_0x40bb('0xe'));var Redis=require(_0x40bb('0xf'));var authService=require(_0x40bb('0x10'));var qs=require(_0x40bb('0x11'));var as=require(_0x40bb('0x12'));var hardwareService=require(_0x40bb('0x13'));var logger=require(_0x40bb('0x14'))(_0x40bb('0x15'));var utils=require(_0x40bb('0x16'));var config=require(_0x40bb('0x17'));var licenseUtil=require(_0x40bb('0x18'));var db=require(_0x40bb('0x19'))['db'];function respondWithStatusCode(_0x344b09,_0x436966){_0x436966=_0x436966||0xcc;return function(_0x2a3ae5){if(_0x2a3ae5){return _0x344b09[_0x40bb('0x1a')](_0x436966);}return _0x344b09['status'](_0x436966)['end']();};}function respondWithResult(_0x3af6c1,_0x253932){_0x253932=_0x253932||0xc8;return function(_0x32e886){if(_0x32e886){return _0x3af6c1[_0x40bb('0x1b')](_0x253932)[_0x40bb('0x1c')](_0x32e886);}};}function respondWithFilteredResult(_0x99c52d,_0x207c7e){return function(_0x3c5751){if(_0x3c5751){var _0x4a177c=typeof _0x207c7e[_0x40bb('0x1d')]===_0x40bb('0x1e')&&typeof _0x207c7e[_0x40bb('0x1f')]===_0x40bb('0x1e');var _0x45be5d=_0x3c5751['count'];var _0x132e44=_0x4a177c?0x0:_0x207c7e[_0x40bb('0x1d')];var _0x310548=_0x4a177c?_0x3c5751[_0x40bb('0x20')]:_0x207c7e[_0x40bb('0x1d')]+_0x207c7e[_0x40bb('0x1f')];var _0x4450ae;if(_0x310548>=_0x45be5d){_0x310548=_0x45be5d;_0x4450ae=0xc8;}else{_0x4450ae=0xce;}_0x99c52d['status'](_0x4450ae);return _0x99c52d[_0x40bb('0x21')](_0x40bb('0x22'),_0x132e44+'-'+_0x310548+'/'+_0x45be5d)[_0x40bb('0x1c')](_0x3c5751);}return null;};}function patchUpdates(_0x229619){return function(_0x289338){try{jsonpatch[_0x40bb('0x23')](_0x289338,_0x229619,!![]);}catch(_0xc70185){return BPromise[_0x40bb('0x24')](_0xc70185);}return _0x289338[_0x40bb('0x25')]();};}function saveUpdates(_0x1f0ac7,_0x4699a3){return function(_0x2c372d){if(_0x2c372d){return _0x2c372d['update'](_0x1f0ac7)[_0x40bb('0x26')](function(_0x74a74c){return _0x74a74c;});}return null;};}function removeEntity(_0x3ef4cc,_0x3919c3){return function(_0x1c8cd2){if(_0x1c8cd2){return _0x1c8cd2[_0x40bb('0x27')]()[_0x40bb('0x26')](function(){var _0x2a0278=_0x1c8cd2[_0x40bb('0x28')]({'plain':!![]});var _0x22daf6=_0x40bb('0x29');return db['UserProfileResource']['destroy']({'where':{'type':_0x22daf6,'resourceId':_0x2a0278['id']}})[_0x40bb('0x26')](function(){return _0x1c8cd2;});})[_0x40bb('0x26')](function(){_0x3ef4cc[_0x40bb('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0xc1b76f,_0x362941){return function(_0x424a69){if(!_0x424a69){_0xc1b76f[_0x40bb('0x1a')](0x194);}return _0x424a69;};}function handleError(_0x28cd48,_0x1e8ac0){_0x1e8ac0=_0x1e8ac0||0x1f4;return function(_0x1b0ad6){logger[_0x40bb('0x2a')](_0x1b0ad6[_0x40bb('0x2b')]);if(_0x1b0ad6['name']){delete _0x1b0ad6[_0x40bb('0x2c')];}_0x28cd48[_0x40bb('0x1b')](_0x1e8ac0)['send'](_0x1b0ad6);};}exports[_0x40bb('0x2d')]=function(_0x5884ed,_0xf5b403){var _0x5a5fa1={},_0x5891c5={},_0x4538e5={'count':0x0,'rows':[]};var _0x420128=_[_0x40bb('0x2e')](db['JscriptyProject'][_0x40bb('0x2f')],function(_0x369252){return{'name':_0x369252[_0x40bb('0x30')],'type':_0x369252['type'][_0x40bb('0x31')]};});_0x5891c5[_0x40bb('0x32')]=_[_0x40bb('0x2e')](_0x420128,_0x40bb('0x2c'));_0x5891c5[_0x40bb('0x33')]=_[_0x40bb('0x34')](_0x5884ed[_0x40bb('0x33')]);_0x5891c5['filters']=_['intersection'](_0x5891c5[_0x40bb('0x32')],_0x5891c5['query']);_0x5a5fa1[_0x40bb('0x35')]=_[_0x40bb('0x36')](_0x5891c5[_0x40bb('0x32')],qs['fields'](_0x5884ed[_0x40bb('0x33')]['fields']));_0x5a5fa1[_0x40bb('0x35')]=_0x5a5fa1[_0x40bb('0x35')]['length']?_0x5a5fa1[_0x40bb('0x35')]:_0x5891c5[_0x40bb('0x32')];if(!_0x5884ed['query'][_0x40bb('0x37')](_0x40bb('0x38'))){_0x5a5fa1[_0x40bb('0x1f')]=qs['limit'](_0x5884ed[_0x40bb('0x33')][_0x40bb('0x1f')]);_0x5a5fa1['offset']=qs['offset'](_0x5884ed[_0x40bb('0x33')]['offset']);}_0x5a5fa1[_0x40bb('0x39')]=qs[_0x40bb('0x3a')](_0x5884ed[_0x40bb('0x33')][_0x40bb('0x3a')]);_0x5a5fa1['where']=qs['filters'](_['pick'](_0x5884ed[_0x40bb('0x33')],_0x5891c5[_0x40bb('0x3b')]),_0x420128);if(_0x5884ed['query'][_0x40bb('0x3c')]){_0x5a5fa1[_0x40bb('0x3d')]=_[_0x40bb('0x3e')](_0x5a5fa1[_0x40bb('0x3d')],{'$or':_['map'](_0x420128,function(_0xacc420){if(_0xacc420[_0x40bb('0x3f')]!==_0x40bb('0x40')){var _0x5e7a49={};_0x5e7a49[_0xacc420[_0x40bb('0x2c')]]={'$like':'%'+_0x5884ed['query']['filter']+'%'};return _0x5e7a49;}})});}_0x5a5fa1=_['merge']({},_0x5a5fa1,_0x5884ed[_0x40bb('0x41')]);var _0x1abe3b={'where':_0x5a5fa1['where']};return db['JscriptyProject'][_0x40bb('0x20')](_0x1abe3b)[_0x40bb('0x26')](function(_0x179541){_0x4538e5[_0x40bb('0x20')]=_0x179541;if(_0x5884ed[_0x40bb('0x33')][_0x40bb('0x42')]){_0x5a5fa1['include']=[{'all':!![]}];}return db[_0x40bb('0x43')][_0x40bb('0x44')](_0x5a5fa1);})['then'](function(_0x571d87){_0x4538e5['rows']=_0x571d87;return _0x4538e5;})['then'](respondWithFilteredResult(_0xf5b403,_0x5a5fa1))[_0x40bb('0x45')](handleError(_0xf5b403,null));};exports[_0x40bb('0x46')]=function(_0x57152f,_0x5daee9){var _0x39006d={'raw':![],'where':{'id':_0x57152f[_0x40bb('0x47')]['id']}},_0x1d5384={};_0x1d5384['model']=_['keys'](db[_0x40bb('0x43')][_0x40bb('0x2f')]);_0x1d5384[_0x40bb('0x33')]=_['keys'](_0x57152f[_0x40bb('0x33')]);_0x1d5384[_0x40bb('0x3b')]=_[_0x40bb('0x36')](_0x1d5384[_0x40bb('0x32')],_0x1d5384['query']);_0x39006d[_0x40bb('0x35')]=_[_0x40bb('0x36')](_0x1d5384[_0x40bb('0x32')],qs[_0x40bb('0x48')](_0x57152f['query'][_0x40bb('0x48')]));_0x39006d[_0x40bb('0x35')]=_0x39006d[_0x40bb('0x35')]['length']?_0x39006d[_0x40bb('0x35')]:_0x1d5384[_0x40bb('0x32')];if(_0x57152f[_0x40bb('0x33')][_0x40bb('0x42')]){_0x39006d[_0x40bb('0x49')]=[{'all':!![]}];}_0x39006d=_[_0x40bb('0x3e')]({},_0x39006d,_0x57152f['options']);return db['JscriptyProject'][_0x40bb('0x4a')](_0x39006d)[_0x40bb('0x26')](handleEntityNotFound(_0x5daee9,null))[_0x40bb('0x26')](respondWithResult(_0x5daee9,null))[_0x40bb('0x45')](handleError(_0x5daee9,null));};exports[_0x40bb('0x4b')]=function(_0x3302ea,_0x420105){return db[_0x40bb('0x43')]['create'](_0x3302ea['body'],{})['then'](function(_0x5e2e93){var _0x2457bb=_0x3302ea[_0x40bb('0x4c')][_0x40bb('0x28')]({'plain':!![]});if(!_0x2457bb)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2457bb['role']===_0x40bb('0x4c')){var _0x757421=_0x5e2e93[_0x40bb('0x28')]({'plain':!![]});var _0xf6a8b7=_0x40bb('0x29');return db[_0x40bb('0x4d')]['find']({'where':{'name':_0xf6a8b7,'userProfileId':_0x2457bb[_0x40bb('0x4e')]},'raw':!![]})[_0x40bb('0x26')](function(_0x56b1ae){if(_0x56b1ae&&_0x56b1ae[_0x40bb('0x4f')]===0x0){return db[_0x40bb('0x50')][_0x40bb('0x4b')]({'name':_0x757421[_0x40bb('0x2c')],'resourceId':_0x757421['id'],'type':_0x56b1ae[_0x40bb('0x2c')],'sectionId':_0x56b1ae['id']},{})[_0x40bb('0x26')](function(){return _0x5e2e93;});}else{return _0x5e2e93;}})['catch'](function(_0x42e8f7){logger[_0x40bb('0x2a')](_0x40bb('0x51'),_0x42e8f7);throw _0x42e8f7;});}return _0x5e2e93;})[_0x40bb('0x26')](respondWithResult(_0x420105,0xc9))['catch'](handleError(_0x420105,null));};exports[_0x40bb('0x52')]=function(_0x2f21e1,_0x13c722){var _0x46da88={'where':{'id':_0x2f21e1['params']['id']}},_0x5eca2d={};_0x5eca2d[_0x40bb('0x32')]=_[_0x40bb('0x34')](db[_0x40bb('0x43')][_0x40bb('0x2f')]);_0x46da88[_0x40bb('0x35')]=_[_0x40bb('0x36')](_0x5eca2d['model'],qs[_0x40bb('0x48')](_0x2f21e1[_0x40bb('0x33')][_0x40bb('0x48')]));_0x46da88[_0x40bb('0x35')]=_0x46da88[_0x40bb('0x35')][_0x40bb('0x53')]?_0x46da88['attributes']:_0x5eca2d[_0x40bb('0x32')];if(_0x2f21e1[_0x40bb('0x33')][_0x40bb('0x42')]){_0x46da88[_0x40bb('0x49')]=[{'all':!![]}];}_0x46da88=_[_0x40bb('0x3e')]({},_0x46da88,_0x2f21e1[_0x40bb('0x41')]);return db['JscriptyProject'][_0x40bb('0x4a')](_0x46da88)['then'](handleEntityNotFound(_0x13c722,null))[_0x40bb('0x26')](function(_0x1703c6){if(_0x1703c6){var _0x21e6c8=_0x1703c6[_0x40bb('0x28')]({'plain':!![]});_0x21e6c8=qs[_0x40bb('0x54')](_0x21e6c8,['id','createdAt',_0x40bb('0x55')]);_0x2f21e1[_0x40bb('0x56')]=_[_0x40bb('0x54')](_0x2f21e1[_0x40bb('0x56')],['id',_0x40bb('0x57'),'updatedAt']);return db[_0x40bb('0x43')]['create'](_['merge'](_0x21e6c8,_0x2f21e1[_0x40bb('0x56')]),{'include':_0x2f21e1[_0x40bb('0x33')][_0x40bb('0x42')]?[{'all':!![]}]:undefined})[_0x40bb('0x26')](function(_0xabf673){var _0x4617a9=_0x2f21e1['user']['get']({'plain':!![]});if(!_0x4617a9)throw new Error(_0x40bb('0x58'));if(_0x4617a9[_0x40bb('0x59')]===_0x40bb('0x4c')){var _0x3eef2d=_0xabf673[_0x40bb('0x28')]({'plain':!![]});var _0x490d33=_0x40bb('0x29');return db[_0x40bb('0x4d')][_0x40bb('0x4a')]({'where':{'name':_0x490d33,'userProfileId':_0x4617a9[_0x40bb('0x4e')]},'raw':!![]})[_0x40bb('0x26')](function(_0x397b2a){if(_0x397b2a&&_0x397b2a['autoAssociation']===0x0){return db[_0x40bb('0x50')][_0x40bb('0x4b')]({'name':_0x3eef2d[_0x40bb('0x2c')],'resourceId':_0x3eef2d['id'],'type':_0x397b2a[_0x40bb('0x2c')],'sectionId':_0x397b2a['id']},{})[_0x40bb('0x26')](function(){return _0xabf673;});}else{return _0xabf673;}})['catch'](function(_0x582192){logger[_0x40bb('0x2a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x582192);throw _0x582192;});}return _0xabf673;});}})[_0x40bb('0x26')](respondWithResult(_0x13c722,0xc9))[_0x40bb('0x45')](handleError(_0x13c722,null));};exports['update']=function(_0x65ee4c,_0x64737d){if(_0x65ee4c[_0x40bb('0x56')]['id']){delete _0x65ee4c[_0x40bb('0x56')]['id'];}return db['JscriptyProject'][_0x40bb('0x4a')]({'where':{'id':_0x65ee4c[_0x40bb('0x47')]['id']}})[_0x40bb('0x26')](handleEntityNotFound(_0x64737d,null))[_0x40bb('0x26')](saveUpdates(_0x65ee4c['body'],null))[_0x40bb('0x26')](respondWithResult(_0x64737d,null))[_0x40bb('0x45')](handleError(_0x64737d,null));};exports[_0x40bb('0x27')]=function(_0x3de31d,_0x5e85bd){return db[_0x40bb('0x43')][_0x40bb('0x4a')]({'where':{'id':_0x3de31d['params']['id']}})[_0x40bb('0x26')](handleEntityNotFound(_0x5e85bd,null))['then'](removeEntity(_0x5e85bd,null))[_0x40bb('0x45')](handleError(_0x5e85bd,null));};exports[_0x40bb('0x5a')]=function(_0x547afc,_0x37a359,_0x2e10b1){var _0x57fcc0={'raw':!![],'where':{}};var _0x245d92={};var _0xb236b5={'count':0x0,'rows':[]};return db[_0x40bb('0x43')]['findOne']({'where':{'id':_0x547afc[_0x40bb('0x47')]['id']}})[_0x40bb('0x26')](handleEntityNotFound(_0x37a359,null))[_0x40bb('0x26')](function(_0x512553){if(_0x512553){_0x245d92[_0x40bb('0x32')]=_[_0x40bb('0x34')](db[_0x40bb('0x5b')][_0x40bb('0x2f')]);_0x245d92['query']=_[_0x40bb('0x34')](_0x547afc[_0x40bb('0x33')]);_0x245d92['filters']=_[_0x40bb('0x36')](_0x245d92['model'],_0x245d92[_0x40bb('0x33')]);_0x57fcc0['attributes']=_[_0x40bb('0x36')](_0x245d92['model'],qs[_0x40bb('0x48')](_0x547afc[_0x40bb('0x33')][_0x40bb('0x48')]));_0x57fcc0[_0x40bb('0x35')]=_0x57fcc0[_0x40bb('0x35')]['length']?_0x57fcc0[_0x40bb('0x35')]:_0x245d92[_0x40bb('0x32')];if(!_0x547afc[_0x40bb('0x33')][_0x40bb('0x37')](_0x40bb('0x38'))){_0x57fcc0[_0x40bb('0x1f')]=qs[_0x40bb('0x1f')](_0x547afc[_0x40bb('0x33')][_0x40bb('0x1f')]);_0x57fcc0[_0x40bb('0x1d')]=qs['offset'](_0x547afc[_0x40bb('0x33')]['offset']);}_0x57fcc0[_0x40bb('0x39')]=qs[_0x40bb('0x3a')](_0x547afc[_0x40bb('0x33')][_0x40bb('0x3a')]);_0x57fcc0[_0x40bb('0x3d')]=qs[_0x40bb('0x3b')](_[_0x40bb('0x5c')](_0x547afc[_0x40bb('0x33')],_0x245d92[_0x40bb('0x3b')]));_0x57fcc0[_0x40bb('0x3d')][_0x40bb('0x5d')]=_0x512553['id'];if(_0x547afc[_0x40bb('0x33')][_0x40bb('0x3c')]){_0x57fcc0[_0x40bb('0x3d')]=_[_0x40bb('0x3e')](_0x57fcc0[_0x40bb('0x3d')],{'$or':_[_0x40bb('0x2e')](_0x57fcc0[_0x40bb('0x35')],function(_0x24b026){var _0x1f4fa4={};_0x1f4fa4[_0x24b026]={'$like':'%'+_0x547afc[_0x40bb('0x33')][_0x40bb('0x3c')]+'%'};return _0x1f4fa4;})});}_0x57fcc0=_[_0x40bb('0x3e')]({},_0x57fcc0,_0x547afc[_0x40bb('0x41')]);return db['JscriptySessionReport'][_0x40bb('0x20')]({'where':_0x57fcc0[_0x40bb('0x3d')]})[_0x40bb('0x26')](function(_0x20f4fd){_0xb236b5['count']=_0x20f4fd;if(_0x547afc[_0x40bb('0x33')][_0x40bb('0x42')]){_0x57fcc0[_0x40bb('0x49')]=[{'all':!![]}];}return db[_0x40bb('0x5b')][_0x40bb('0x44')](_0x57fcc0);})[_0x40bb('0x26')](function(_0x3b150d){_0xb236b5[_0x40bb('0x5e')]=_0x3b150d;return _0xb236b5;});}})[_0x40bb('0x26')](respondWithFilteredResult(_0x37a359,_0x57fcc0))[_0x40bb('0x45')](handleError(_0x37a359,null));};exports[_0x40bb('0x5f')]=function(_0xc781f3,_0x5a3799,_0x391624){var _0x525873={'raw':!![],'where':{}};var _0x594a0e={};var _0x16559a={'count':0x0,'rows':[]};return db['JscriptyProject'][_0x40bb('0x60')]({'where':{'id':_0xc781f3[_0x40bb('0x47')]['id']}})[_0x40bb('0x26')](handleEntityNotFound(_0x5a3799,null))[_0x40bb('0x26')](function(_0x389049){if(_0x389049){_0x594a0e[_0x40bb('0x32')]=_[_0x40bb('0x34')](db[_0x40bb('0x61')][_0x40bb('0x2f')]);_0x594a0e[_0x40bb('0x33')]=_[_0x40bb('0x34')](_0xc781f3[_0x40bb('0x33')]);_0x594a0e[_0x40bb('0x3b')]=_[_0x40bb('0x36')](_0x594a0e[_0x40bb('0x32')],_0x594a0e[_0x40bb('0x33')]);_0x525873[_0x40bb('0x35')]=_['intersection'](_0x594a0e[_0x40bb('0x32')],qs[_0x40bb('0x48')](_0xc781f3[_0x40bb('0x33')]['fields']));_0x525873[_0x40bb('0x35')]=_0x525873[_0x40bb('0x35')][_0x40bb('0x53')]?_0x525873[_0x40bb('0x35')]:_0x594a0e[_0x40bb('0x32')];if(!_0xc781f3[_0x40bb('0x33')][_0x40bb('0x37')](_0x40bb('0x38'))){_0x525873[_0x40bb('0x1f')]=qs[_0x40bb('0x1f')](_0xc781f3[_0x40bb('0x33')][_0x40bb('0x1f')]);_0x525873[_0x40bb('0x1d')]=qs[_0x40bb('0x1d')](_0xc781f3[_0x40bb('0x33')][_0x40bb('0x1d')]);}_0x525873['order']=qs[_0x40bb('0x3a')](_0xc781f3[_0x40bb('0x33')][_0x40bb('0x3a')]);_0x525873['where']=qs['filters'](_[_0x40bb('0x5c')](_0xc781f3['query'],_0x594a0e['filters']));_0x525873['where'][_0x40bb('0x5d')]=_0x389049['id'];if(_0xc781f3[_0x40bb('0x33')][_0x40bb('0x3c')]){_0x525873['where']=_['merge'](_0x525873['where'],{'$or':_[_0x40bb('0x2e')](_0x525873[_0x40bb('0x35')],function(_0x1054f1){var _0x50f423={};_0x50f423[_0x1054f1]={'$like':'%'+_0xc781f3[_0x40bb('0x33')]['filter']+'%'};return _0x50f423;})});}_0x525873=_[_0x40bb('0x3e')]({},_0x525873,_0xc781f3[_0x40bb('0x41')]);return db[_0x40bb('0x61')]['count']({'where':_0x525873[_0x40bb('0x3d')]})[_0x40bb('0x26')](function(_0x21ba09){_0x16559a['count']=_0x21ba09;if(_0xc781f3[_0x40bb('0x33')][_0x40bb('0x42')]){_0x525873[_0x40bb('0x49')]=[{'all':!![]}];}return db['JscriptyAnswerReport'][_0x40bb('0x44')](_0x525873);})['then'](function(_0x3901ab){_0x16559a[_0x40bb('0x5e')]=_0x3901ab;return _0x16559a;});}})['then'](respondWithFilteredResult(_0x5a3799,_0x525873))[_0x40bb('0x45')](handleError(_0x5a3799,null));};function char(_0x399ab0){return _0x40bb('0x62')===typeof _0x399ab0?String[_0x40bb('0x63')][_0x40bb('0x23')](null,arguments):_0x399ab0;}function needsEncapsulation(_0x27ab47){return!!_0x27ab47&&(_0x27ab47[_0x40bb('0x64')]()['indexOf'](char(0xd))>=0x0||_0x27ab47[_0x40bb('0x64')]()[_0x40bb('0x65')](char(0xa))>=0x0||_0x27ab47[_0x40bb('0x64')]()[_0x40bb('0x65')](char(0x2c))>=0x0||_0x27ab47[_0x40bb('0x64')]()['indexOf'](char(0x22))>=0x0);}function encapsulate(_0x7542a9){var _0x3dbf29=char(0x22),_0x15598e='\x5c'+char(0x22),_0x7fd5a4=_0x7542a9['toString']()[_0x40bb('0x66')](new RegExp(_0x3dbf29,'g'),_0x15598e);return _0x3dbf29+_0x7fd5a4+_0x3dbf29;}exports[_0x40bb('0x67')]=function(_0x14449f,_0x2e1ec9,_0x2301f1){var _0x3f8a5b,_0x4fd35b;var _0x446137={'where':{'ProjectId':_0x14449f[_0x40bb('0x47')]['id']}};if(_0x14449f[_0x40bb('0x33')][_0x40bb('0x68')]){_0x446137[_0x40bb('0x3d')]['starttime']=JSON[_0x40bb('0x69')](_0x14449f[_0x40bb('0x33')][_0x40bb('0x68')]);}return db[_0x40bb('0x5b')]['findAll'](_0x446137)[_0x40bb('0x26')](handleEntityNotFound(_0x2e1ec9,null))[_0x40bb('0x26')](function(_0x15d65d){if(_0x15d65d){_0x3f8a5b=_0x15d65d;return db[_0x40bb('0x6a')]['findAll']({'where':{'SessionId':{'$in':_['map'](_0x3f8a5b,'id')},'ProjectId':_0x14449f[_0x40bb('0x47')]['id']},'order':_0x40bb('0x6b')});}})[_0x40bb('0x26')](handleEntityNotFound(_0x2e1ec9,null))[_0x40bb('0x26')](function(_0x19d4c7){if(_0x19d4c7){_0x4fd35b=_0x19d4c7;var _0x1e5a3d={};for(var _0x202e9a=0x0,_0x10e814=_0x4fd35b[_0x40bb('0x53')];_0x202e9a<_0x10e814;_0x202e9a++){if(!_0x1e5a3d[_0x40bb('0x37')](_0x4fd35b[_0x202e9a][_0x40bb('0x6c')])){_0x1e5a3d[_0x4fd35b[_0x202e9a][_0x40bb('0x6c')]]=needsEncapsulation(_0x4fd35b[_0x202e9a]['question'])?encapsulate(_0x4fd35b[_0x202e9a]['question']):_0x4fd35b[_0x202e9a][_0x40bb('0x6d')];}}var _0x3cfd5a=[],_0x4684b4={};for(var _0x47b00e=0x0,_0x21e771=_0x3f8a5b[_0x40bb('0x53')];_0x47b00e<_0x21e771;_0x47b00e++){_0x4684b4={'ProjectId':_0x14449f[_0x40bb('0x47')]['id'],'SessionId':_0x3f8a5b[_0x47b00e]['id'],'StartTime':moment(_0x3f8a5b[_0x47b00e][_0x40bb('0x6e')])[_0x40bb('0x6f')](_0x40bb('0x70'))};for(var _0x33d094=0x0,_0x1fd22b=_0x4fd35b[_0x40bb('0x53')];_0x33d094<_0x1fd22b;_0x33d094++){if(_0x4fd35b[_0x33d094][_0x40bb('0x71')]==_0x3f8a5b[_0x47b00e]['id']&&_0x1e5a3d[_0x40bb('0x37')](_0x4fd35b[_0x33d094][_0x40bb('0x6c')])){_0x4684b4[_0x1e5a3d[_0x4fd35b[_0x33d094][_0x40bb('0x6c')]]]=_0x4fd35b[_0x33d094]['answer'];}}for(var _0x16cee5 in _0x1e5a3d){if(!_0x4684b4['hasOwnProperty'](_0x1e5a3d[_0x16cee5])){_0x4684b4[_0x1e5a3d[_0x16cee5]]=null;}}_0x3cfd5a[_0x40bb('0x72')](_0x4684b4);}return _0x3cfd5a;}})[_0x40bb('0x26')](function(_0x491791){if(!_[_0x40bb('0x73')](_0x491791)){var _0x40e125=toCsv(_0x491791);var _0x53a347=Date['now']();fs[_0x40bb('0x74')](util['format'](_0x40bb('0x75'),_0x14449f['params']['id'],_0x53a347),_0x40e125);_0x2e1ec9[_0x40bb('0x76')](_0x40bb('0x77'),'attachment;\x20filename='+util['format'](_0x40bb('0x78'),_0x14449f[_0x40bb('0x47')]['id'],_0x53a347));_0x2e1ec9['setHeader']('Content-type',_0x40bb('0x79'));return _0x2e1ec9['download'](util[_0x40bb('0x6f')]('/tmp/Jscripty_Project_%d_Summary_%s.csv',_0x14449f[_0x40bb('0x47')]['id'],_0x53a347));}else{return _0x2e1ec9[_0x40bb('0x1a')](0xcc);}})[_0x40bb('0x45')](handleError(_0x2e1ec9,null));}; \ No newline at end of file +var _0x4f08=['create','body','get','role','UserProfileSection','userProfileId','autoAssociation','clone','includeAll','options','omit','createdAt','updatedAt','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','findOne','JscriptySessionReport','hasOwnProperty','order','pick','getAnswers','JscriptyAnswerReport','findAll','number','fromCharCode','indexOf','toString','replace','startTime','starttime','parse','JscriptyQuestionReport','-createdAt','questionId','question','format','YYYY-MM-DD\x20HH:mm:ss','SessionId','answer','push','isEmpty','now','writeFileSync','/tmp/Jscripty_Project_%d_Summary_%s.csv','setHeader','attachment;\x20filename=','Jscripty_Project_%d_Summary_%s.csv','download','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','Content-Range','apply','save','then','Projects','UserProfileResource','destroy','error','name','send','map','JscriptyProject','rawAttributes','type','key','query','keys','filters','intersection','model','fields','attributes','length','sort','where','VIRTUAL','filter','merge','include','rows','catch','show','params','find'];(function(_0xe01fb8,_0x5d3a27){var _0x318cb3=function(_0x154999){while(--_0x154999){_0xe01fb8['push'](_0xe01fb8['shift']());}};_0x318cb3(++_0x5d3a27);}(_0x4f08,0x194));var _0x84f0=function(_0x39f115,_0x5bfc36){_0x39f115=_0x39f115-0x0;var _0x41067b=_0x4f08[_0x39f115];return _0x41067b;};'use strict';var emlformat=require(_0x84f0('0x0'));var rimraf=require(_0x84f0('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x84f0('0x2'));var rp=require(_0x84f0('0x3'));var moment=require('moment');var BPromise=require(_0x84f0('0x4'));var Mustache=require(_0x84f0('0x5'));var util=require(_0x84f0('0x6'));var path=require('path');var sox=require(_0x84f0('0x7'));var csv=require('to-csv');var ejs=require(_0x84f0('0x8'));var fs=require('fs');var fs_extra=require(_0x84f0('0x9'));var _=require(_0x84f0('0xa'));var squel=require('squel');var crypto=require(_0x84f0('0xb'));var jsforce=require(_0x84f0('0xc'));var deskjs=require(_0x84f0('0xd'));var toCsv=require(_0x84f0('0xe'));var querystring=require(_0x84f0('0xf'));var Papa=require(_0x84f0('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x84f0('0x11'));var as=require(_0x84f0('0x12'));var hardwareService=require(_0x84f0('0x13'));var logger=require(_0x84f0('0x14'))(_0x84f0('0x15'));var utils=require(_0x84f0('0x16'));var config=require(_0x84f0('0x17'));var licenseUtil=require(_0x84f0('0x18'));var db=require(_0x84f0('0x19'))['db'];function respondWithStatusCode(_0x532506,_0xfe9718){_0xfe9718=_0xfe9718||0xcc;return function(_0x50a03b){if(_0x50a03b){return _0x532506[_0x84f0('0x1a')](_0xfe9718);}return _0x532506['status'](_0xfe9718)[_0x84f0('0x1b')]();};}function respondWithResult(_0x32c3e8,_0x278f4e){_0x278f4e=_0x278f4e||0xc8;return function(_0xb077e1){if(_0xb077e1){return _0x32c3e8[_0x84f0('0x1c')](_0x278f4e)[_0x84f0('0x1d')](_0xb077e1);}};}function respondWithFilteredResult(_0x4167f3,_0x407db6){return function(_0x1b5d88){if(_0x1b5d88){var _0x58f208=typeof _0x407db6[_0x84f0('0x1e')]===_0x84f0('0x1f')&&typeof _0x407db6[_0x84f0('0x20')]==='undefined';var _0x4ac111=_0x1b5d88[_0x84f0('0x21')];var _0x295fe5=_0x58f208?0x0:_0x407db6[_0x84f0('0x1e')];var _0x40f536=_0x58f208?_0x1b5d88[_0x84f0('0x21')]:_0x407db6[_0x84f0('0x1e')]+_0x407db6['limit'];var _0x597519;if(_0x40f536>=_0x4ac111){_0x40f536=_0x4ac111;_0x597519=0xc8;}else{_0x597519=0xce;}_0x4167f3['status'](_0x597519);return _0x4167f3['set'](_0x84f0('0x22'),_0x295fe5+'-'+_0x40f536+'/'+_0x4ac111)['json'](_0x1b5d88);}return null;};}function patchUpdates(_0x3353f9){return function(_0x29f979){try{jsonpatch[_0x84f0('0x23')](_0x29f979,_0x3353f9,!![]);}catch(_0xe1bf11){return BPromise['reject'](_0xe1bf11);}return _0x29f979[_0x84f0('0x24')]();};}function saveUpdates(_0x451e55,_0x2611cd){return function(_0x501665){if(_0x501665){return _0x501665['update'](_0x451e55)[_0x84f0('0x25')](function(_0x6c7e4e){return _0x6c7e4e;});}return null;};}function removeEntity(_0x44492a,_0x10133c){return function(_0x3a5ac2){if(_0x3a5ac2){return _0x3a5ac2['destroy']()[_0x84f0('0x25')](function(){var _0x57a067=_0x3a5ac2['get']({'plain':!![]});var _0x1e4da9=_0x84f0('0x26');return db[_0x84f0('0x27')][_0x84f0('0x28')]({'where':{'type':_0x1e4da9,'resourceId':_0x57a067['id']}})['then'](function(){return _0x3a5ac2;});})[_0x84f0('0x25')](function(){_0x44492a[_0x84f0('0x1c')](0xcc)[_0x84f0('0x1b')]();});}};}function handleEntityNotFound(_0xe67cd1,_0x124a37){return function(_0xf60719){if(!_0xf60719){_0xe67cd1[_0x84f0('0x1a')](0x194);}return _0xf60719;};}function handleError(_0x4a71b3,_0x1bfc7a){_0x1bfc7a=_0x1bfc7a||0x1f4;return function(_0x4c1186){logger[_0x84f0('0x29')](_0x4c1186['stack']);if(_0x4c1186[_0x84f0('0x2a')]){delete _0x4c1186['name'];}_0x4a71b3['status'](_0x1bfc7a)[_0x84f0('0x2b')](_0x4c1186);};}exports['index']=function(_0x30e559,_0x3e98db){var _0x1294de={},_0x344721={},_0x9e766c={'count':0x0,'rows':[]};var _0x2f0164=_[_0x84f0('0x2c')](db[_0x84f0('0x2d')][_0x84f0('0x2e')],function(_0x3dbfec){return{'name':_0x3dbfec['fieldName'],'type':_0x3dbfec[_0x84f0('0x2f')][_0x84f0('0x30')]};});_0x344721['model']=_[_0x84f0('0x2c')](_0x2f0164,'name');_0x344721[_0x84f0('0x31')]=_[_0x84f0('0x32')](_0x30e559[_0x84f0('0x31')]);_0x344721[_0x84f0('0x33')]=_[_0x84f0('0x34')](_0x344721[_0x84f0('0x35')],_0x344721[_0x84f0('0x31')]);_0x1294de['attributes']=_['intersection'](_0x344721[_0x84f0('0x35')],qs[_0x84f0('0x36')](_0x30e559['query'][_0x84f0('0x36')]));_0x1294de[_0x84f0('0x37')]=_0x1294de[_0x84f0('0x37')][_0x84f0('0x38')]?_0x1294de[_0x84f0('0x37')]:_0x344721[_0x84f0('0x35')];if(!_0x30e559[_0x84f0('0x31')]['hasOwnProperty']('nolimit')){_0x1294de[_0x84f0('0x20')]=qs[_0x84f0('0x20')](_0x30e559['query'][_0x84f0('0x20')]);_0x1294de[_0x84f0('0x1e')]=qs[_0x84f0('0x1e')](_0x30e559[_0x84f0('0x31')][_0x84f0('0x1e')]);}_0x1294de['order']=qs[_0x84f0('0x39')](_0x30e559[_0x84f0('0x31')][_0x84f0('0x39')]);_0x1294de[_0x84f0('0x3a')]=qs[_0x84f0('0x33')](_['pick'](_0x30e559['query'],_0x344721[_0x84f0('0x33')]),_0x2f0164);if(_0x30e559[_0x84f0('0x31')]['filter']){_0x1294de[_0x84f0('0x3a')]=_['merge'](_0x1294de[_0x84f0('0x3a')],{'$or':_[_0x84f0('0x2c')](_0x2f0164,function(_0x553499){if(_0x553499[_0x84f0('0x2f')]!==_0x84f0('0x3b')){var _0xa98eb8={};_0xa98eb8[_0x553499[_0x84f0('0x2a')]]={'$like':'%'+_0x30e559['query'][_0x84f0('0x3c')]+'%'};return _0xa98eb8;}})});}_0x1294de=_[_0x84f0('0x3d')]({},_0x1294de,_0x30e559['options']);var _0x393c30={'where':_0x1294de['where']};return db['JscriptyProject'][_0x84f0('0x21')](_0x393c30)['then'](function(_0x3266d0){_0x9e766c[_0x84f0('0x21')]=_0x3266d0;if(_0x30e559['query']['includeAll']){_0x1294de[_0x84f0('0x3e')]=[{'all':!![]}];}return db[_0x84f0('0x2d')]['findAll'](_0x1294de);})[_0x84f0('0x25')](function(_0x20b87a){_0x9e766c[_0x84f0('0x3f')]=_0x20b87a;return _0x9e766c;})[_0x84f0('0x25')](respondWithFilteredResult(_0x3e98db,_0x1294de))[_0x84f0('0x40')](handleError(_0x3e98db,null));};exports[_0x84f0('0x41')]=function(_0xd030c9,_0x5eaef0){var _0x194e8d={'raw':![],'where':{'id':_0xd030c9[_0x84f0('0x42')]['id']}},_0x3aad10={};_0x3aad10[_0x84f0('0x35')]=_[_0x84f0('0x32')](db[_0x84f0('0x2d')][_0x84f0('0x2e')]);_0x3aad10['query']=_[_0x84f0('0x32')](_0xd030c9['query']);_0x3aad10[_0x84f0('0x33')]=_[_0x84f0('0x34')](_0x3aad10[_0x84f0('0x35')],_0x3aad10[_0x84f0('0x31')]);_0x194e8d[_0x84f0('0x37')]=_[_0x84f0('0x34')](_0x3aad10[_0x84f0('0x35')],qs[_0x84f0('0x36')](_0xd030c9[_0x84f0('0x31')][_0x84f0('0x36')]));_0x194e8d[_0x84f0('0x37')]=_0x194e8d[_0x84f0('0x37')]['length']?_0x194e8d['attributes']:_0x3aad10[_0x84f0('0x35')];if(_0xd030c9[_0x84f0('0x31')]['includeAll']){_0x194e8d['include']=[{'all':!![]}];}_0x194e8d=_[_0x84f0('0x3d')]({},_0x194e8d,_0xd030c9['options']);return db[_0x84f0('0x2d')][_0x84f0('0x43')](_0x194e8d)['then'](handleEntityNotFound(_0x5eaef0,null))[_0x84f0('0x25')](respondWithResult(_0x5eaef0,null))[_0x84f0('0x40')](handleError(_0x5eaef0,null));};exports[_0x84f0('0x44')]=function(_0x50a3a4,_0x39e092){return db[_0x84f0('0x2d')][_0x84f0('0x44')](_0x50a3a4[_0x84f0('0x45')],{})[_0x84f0('0x25')](function(_0x2c7fb2){var _0x342480=_0x50a3a4['user'][_0x84f0('0x46')]({'plain':!![]});if(!_0x342480)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x342480[_0x84f0('0x47')]==='user'){var _0x267c2b=_0x2c7fb2[_0x84f0('0x46')]({'plain':!![]});var _0x4cceaf='Projects';return db[_0x84f0('0x48')][_0x84f0('0x43')]({'where':{'name':_0x4cceaf,'userProfileId':_0x342480[_0x84f0('0x49')]},'raw':!![]})['then'](function(_0xbc1be0){if(_0xbc1be0&&_0xbc1be0[_0x84f0('0x4a')]===0x0){return db[_0x84f0('0x27')][_0x84f0('0x44')]({'name':_0x267c2b[_0x84f0('0x2a')],'resourceId':_0x267c2b['id'],'type':_0xbc1be0[_0x84f0('0x2a')],'sectionId':_0xbc1be0['id']},{})[_0x84f0('0x25')](function(){return _0x2c7fb2;});}else{return _0x2c7fb2;}})[_0x84f0('0x40')](function(_0x532ccd){logger[_0x84f0('0x29')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x532ccd);throw _0x532ccd;});}return _0x2c7fb2;})[_0x84f0('0x25')](respondWithResult(_0x39e092,0xc9))[_0x84f0('0x40')](handleError(_0x39e092,null));};exports[_0x84f0('0x4b')]=function(_0x2935f5,_0x208d36){var _0x109a3d={'where':{'id':_0x2935f5[_0x84f0('0x42')]['id']}},_0xe400aa={};_0xe400aa['model']=_[_0x84f0('0x32')](db['JscriptyProject']['rawAttributes']);_0x109a3d[_0x84f0('0x37')]=_[_0x84f0('0x34')](_0xe400aa['model'],qs[_0x84f0('0x36')](_0x2935f5[_0x84f0('0x31')]['fields']));_0x109a3d['attributes']=_0x109a3d[_0x84f0('0x37')][_0x84f0('0x38')]?_0x109a3d['attributes']:_0xe400aa['model'];if(_0x2935f5[_0x84f0('0x31')][_0x84f0('0x4c')]){_0x109a3d[_0x84f0('0x3e')]=[{'all':!![]}];}_0x109a3d=_['merge']({},_0x109a3d,_0x2935f5[_0x84f0('0x4d')]);return db[_0x84f0('0x2d')][_0x84f0('0x43')](_0x109a3d)[_0x84f0('0x25')](handleEntityNotFound(_0x208d36,null))[_0x84f0('0x25')](function(_0x3327f8){if(_0x3327f8){var _0x301d33=_0x3327f8['get']({'plain':!![]});_0x301d33=qs[_0x84f0('0x4e')](_0x301d33,['id',_0x84f0('0x4f'),_0x84f0('0x50')]);_0x2935f5[_0x84f0('0x45')]=_[_0x84f0('0x4e')](_0x2935f5[_0x84f0('0x45')],['id',_0x84f0('0x4f'),_0x84f0('0x50')]);return db['JscriptyProject'][_0x84f0('0x44')](_['merge'](_0x301d33,_0x2935f5[_0x84f0('0x45')]),{'include':_0x2935f5[_0x84f0('0x31')]['includeAll']?[{'all':!![]}]:undefined})['then'](function(_0x4d52b5){var _0xdf2c1e=_0x2935f5['user'][_0x84f0('0x46')]({'plain':!![]});if(!_0xdf2c1e)throw new Error(_0x84f0('0x51'));if(_0xdf2c1e[_0x84f0('0x47')]===_0x84f0('0x52')){var _0x56de0d=_0x4d52b5[_0x84f0('0x46')]({'plain':!![]});var _0x2cda13='Projects';return db[_0x84f0('0x48')][_0x84f0('0x43')]({'where':{'name':_0x2cda13,'userProfileId':_0xdf2c1e['userProfileId']},'raw':!![]})[_0x84f0('0x25')](function(_0x49329e){if(_0x49329e&&_0x49329e['autoAssociation']===0x0){return db['UserProfileResource'][_0x84f0('0x44')]({'name':_0x56de0d[_0x84f0('0x2a')],'resourceId':_0x56de0d['id'],'type':_0x49329e['name'],'sectionId':_0x49329e['id']},{})[_0x84f0('0x25')](function(){return _0x4d52b5;});}else{return _0x4d52b5;}})['catch'](function(_0x4dc086){logger[_0x84f0('0x29')](_0x84f0('0x53'),_0x4dc086);throw _0x4dc086;});}return _0x4d52b5;});}})['then'](respondWithResult(_0x208d36,0xc9))[_0x84f0('0x40')](handleError(_0x208d36,null));};exports[_0x84f0('0x54')]=function(_0x317552,_0x4931dc){if(_0x317552['body']['id']){delete _0x317552['body']['id'];}return db[_0x84f0('0x2d')]['find']({'where':{'id':_0x317552[_0x84f0('0x42')]['id']}})[_0x84f0('0x25')](handleEntityNotFound(_0x4931dc,null))[_0x84f0('0x25')](saveUpdates(_0x317552[_0x84f0('0x45')],null))[_0x84f0('0x25')](respondWithResult(_0x4931dc,null))[_0x84f0('0x40')](handleError(_0x4931dc,null));};exports[_0x84f0('0x28')]=function(_0xa946e5,_0x14e4c2){return db['JscriptyProject'][_0x84f0('0x43')]({'where':{'id':_0xa946e5[_0x84f0('0x42')]['id']}})['then'](handleEntityNotFound(_0x14e4c2,null))[_0x84f0('0x25')](removeEntity(_0x14e4c2,null))[_0x84f0('0x40')](handleError(_0x14e4c2,null));};exports['getSessions']=function(_0x3b54c7,_0x5111db,_0xddb5f){var _0x33f2ce={'raw':!![],'where':{}};var _0x224d92={};var _0x59d18d={'count':0x0,'rows':[]};return db[_0x84f0('0x2d')][_0x84f0('0x55')]({'where':{'id':_0x3b54c7[_0x84f0('0x42')]['id']}})[_0x84f0('0x25')](handleEntityNotFound(_0x5111db,null))[_0x84f0('0x25')](function(_0x43319b){if(_0x43319b){_0x224d92[_0x84f0('0x35')]=_[_0x84f0('0x32')](db[_0x84f0('0x56')][_0x84f0('0x2e')]);_0x224d92[_0x84f0('0x31')]=_[_0x84f0('0x32')](_0x3b54c7[_0x84f0('0x31')]);_0x224d92[_0x84f0('0x33')]=_[_0x84f0('0x34')](_0x224d92['model'],_0x224d92[_0x84f0('0x31')]);_0x33f2ce['attributes']=_[_0x84f0('0x34')](_0x224d92['model'],qs[_0x84f0('0x36')](_0x3b54c7['query'][_0x84f0('0x36')]));_0x33f2ce[_0x84f0('0x37')]=_0x33f2ce[_0x84f0('0x37')][_0x84f0('0x38')]?_0x33f2ce[_0x84f0('0x37')]:_0x224d92[_0x84f0('0x35')];if(!_0x3b54c7[_0x84f0('0x31')][_0x84f0('0x57')]('nolimit')){_0x33f2ce[_0x84f0('0x20')]=qs['limit'](_0x3b54c7[_0x84f0('0x31')][_0x84f0('0x20')]);_0x33f2ce[_0x84f0('0x1e')]=qs['offset'](_0x3b54c7['query'][_0x84f0('0x1e')]);}_0x33f2ce[_0x84f0('0x58')]=qs['sort'](_0x3b54c7[_0x84f0('0x31')][_0x84f0('0x39')]);_0x33f2ce[_0x84f0('0x3a')]=qs[_0x84f0('0x33')](_[_0x84f0('0x59')](_0x3b54c7[_0x84f0('0x31')],_0x224d92[_0x84f0('0x33')]));_0x33f2ce[_0x84f0('0x3a')]['ProjectId']=_0x43319b['id'];if(_0x3b54c7[_0x84f0('0x31')][_0x84f0('0x3c')]){_0x33f2ce[_0x84f0('0x3a')]=_[_0x84f0('0x3d')](_0x33f2ce[_0x84f0('0x3a')],{'$or':_[_0x84f0('0x2c')](_0x33f2ce[_0x84f0('0x37')],function(_0x5f497c){var _0x44cfb5={};_0x44cfb5[_0x5f497c]={'$like':'%'+_0x3b54c7[_0x84f0('0x31')][_0x84f0('0x3c')]+'%'};return _0x44cfb5;})});}_0x33f2ce=_[_0x84f0('0x3d')]({},_0x33f2ce,_0x3b54c7[_0x84f0('0x4d')]);return db[_0x84f0('0x56')][_0x84f0('0x21')]({'where':_0x33f2ce[_0x84f0('0x3a')]})['then'](function(_0x49ba97){_0x59d18d['count']=_0x49ba97;if(_0x3b54c7[_0x84f0('0x31')][_0x84f0('0x4c')]){_0x33f2ce[_0x84f0('0x3e')]=[{'all':!![]}];}return db['JscriptySessionReport']['findAll'](_0x33f2ce);})[_0x84f0('0x25')](function(_0x3c0459){_0x59d18d[_0x84f0('0x3f')]=_0x3c0459;return _0x59d18d;});}})[_0x84f0('0x25')](respondWithFilteredResult(_0x5111db,_0x33f2ce))[_0x84f0('0x40')](handleError(_0x5111db,null));};exports[_0x84f0('0x5a')]=function(_0x10b6bf,_0x55784d,_0x7bc26d){var _0x44a231={'raw':!![],'where':{}};var _0x22436f={};var _0x5df3d4={'count':0x0,'rows':[]};return db[_0x84f0('0x2d')][_0x84f0('0x55')]({'where':{'id':_0x10b6bf[_0x84f0('0x42')]['id']}})[_0x84f0('0x25')](handleEntityNotFound(_0x55784d,null))[_0x84f0('0x25')](function(_0x40b7dd){if(_0x40b7dd){_0x22436f[_0x84f0('0x35')]=_['keys'](db[_0x84f0('0x5b')][_0x84f0('0x2e')]);_0x22436f[_0x84f0('0x31')]=_['keys'](_0x10b6bf['query']);_0x22436f['filters']=_[_0x84f0('0x34')](_0x22436f[_0x84f0('0x35')],_0x22436f[_0x84f0('0x31')]);_0x44a231[_0x84f0('0x37')]=_['intersection'](_0x22436f[_0x84f0('0x35')],qs[_0x84f0('0x36')](_0x10b6bf[_0x84f0('0x31')]['fields']));_0x44a231['attributes']=_0x44a231[_0x84f0('0x37')][_0x84f0('0x38')]?_0x44a231[_0x84f0('0x37')]:_0x22436f[_0x84f0('0x35')];if(!_0x10b6bf[_0x84f0('0x31')][_0x84f0('0x57')]('nolimit')){_0x44a231[_0x84f0('0x20')]=qs[_0x84f0('0x20')](_0x10b6bf[_0x84f0('0x31')][_0x84f0('0x20')]);_0x44a231['offset']=qs[_0x84f0('0x1e')](_0x10b6bf[_0x84f0('0x31')]['offset']);}_0x44a231[_0x84f0('0x58')]=qs[_0x84f0('0x39')](_0x10b6bf[_0x84f0('0x31')][_0x84f0('0x39')]);_0x44a231[_0x84f0('0x3a')]=qs['filters'](_[_0x84f0('0x59')](_0x10b6bf[_0x84f0('0x31')],_0x22436f[_0x84f0('0x33')]));_0x44a231['where']['ProjectId']=_0x40b7dd['id'];if(_0x10b6bf[_0x84f0('0x31')]['filter']){_0x44a231[_0x84f0('0x3a')]=_[_0x84f0('0x3d')](_0x44a231[_0x84f0('0x3a')],{'$or':_[_0x84f0('0x2c')](_0x44a231['attributes'],function(_0x3de2db){var _0x3ff55c={};_0x3ff55c[_0x3de2db]={'$like':'%'+_0x10b6bf[_0x84f0('0x31')][_0x84f0('0x3c')]+'%'};return _0x3ff55c;})});}_0x44a231=_[_0x84f0('0x3d')]({},_0x44a231,_0x10b6bf['options']);return db['JscriptyAnswerReport'][_0x84f0('0x21')]({'where':_0x44a231[_0x84f0('0x3a')]})['then'](function(_0x1f47fa){_0x5df3d4['count']=_0x1f47fa;if(_0x10b6bf[_0x84f0('0x31')][_0x84f0('0x4c')]){_0x44a231['include']=[{'all':!![]}];}return db[_0x84f0('0x5b')][_0x84f0('0x5c')](_0x44a231);})[_0x84f0('0x25')](function(_0x55c943){_0x5df3d4[_0x84f0('0x3f')]=_0x55c943;return _0x5df3d4;});}})[_0x84f0('0x25')](respondWithFilteredResult(_0x55784d,_0x44a231))[_0x84f0('0x40')](handleError(_0x55784d,null));};function char(_0x3edb4b){return _0x84f0('0x5d')===typeof _0x3edb4b?String[_0x84f0('0x5e')]['apply'](null,arguments):_0x3edb4b;}function needsEncapsulation(_0x45fb19){return!!_0x45fb19&&(_0x45fb19['toString']()[_0x84f0('0x5f')](char(0xd))>=0x0||_0x45fb19['toString']()[_0x84f0('0x5f')](char(0xa))>=0x0||_0x45fb19[_0x84f0('0x60')]()['indexOf'](char(0x2c))>=0x0||_0x45fb19[_0x84f0('0x60')]()['indexOf'](char(0x22))>=0x0);}function encapsulate(_0x38516a){var _0x32d29b=char(0x22),_0x83d0aa='\x5c'+char(0x22),_0x1ae3bc=_0x38516a[_0x84f0('0x60')]()[_0x84f0('0x61')](new RegExp(_0x32d29b,'g'),_0x83d0aa);return _0x32d29b+_0x1ae3bc+_0x32d29b;}exports['getSummary']=function(_0x16a27b,_0x1f148d,_0x547a50){var _0x4503e0,_0x437011;var _0x36e3ac={'where':{'ProjectId':_0x16a27b[_0x84f0('0x42')]['id']}};if(_0x16a27b[_0x84f0('0x31')][_0x84f0('0x62')]){_0x36e3ac[_0x84f0('0x3a')][_0x84f0('0x63')]=JSON[_0x84f0('0x64')](_0x16a27b[_0x84f0('0x31')][_0x84f0('0x62')]);}return db['JscriptySessionReport']['findAll'](_0x36e3ac)[_0x84f0('0x25')](handleEntityNotFound(_0x1f148d,null))[_0x84f0('0x25')](function(_0x1b3d85){if(_0x1b3d85){_0x4503e0=_0x1b3d85;return db[_0x84f0('0x65')][_0x84f0('0x5c')]({'where':{'SessionId':{'$in':_[_0x84f0('0x2c')](_0x4503e0,'id')},'ProjectId':_0x16a27b[_0x84f0('0x42')]['id']},'order':_0x84f0('0x66')});}})[_0x84f0('0x25')](handleEntityNotFound(_0x1f148d,null))[_0x84f0('0x25')](function(_0x4a550a){if(_0x4a550a){_0x437011=_0x4a550a;var _0x3b9cc5={};for(var _0x6ef755=0x0,_0x5d5255=_0x437011[_0x84f0('0x38')];_0x6ef755<_0x5d5255;_0x6ef755++){if(!_0x3b9cc5[_0x84f0('0x57')](_0x437011[_0x6ef755]['questionId'])){_0x3b9cc5[_0x437011[_0x6ef755][_0x84f0('0x67')]]=needsEncapsulation(_0x437011[_0x6ef755][_0x84f0('0x68')])?encapsulate(_0x437011[_0x6ef755]['question']):_0x437011[_0x6ef755][_0x84f0('0x68')];}}var _0x2d617d=[],_0x48617d={};for(var _0x490cd3=0x0,_0x1fa2a0=_0x4503e0[_0x84f0('0x38')];_0x490cd3<_0x1fa2a0;_0x490cd3++){_0x48617d={'ProjectId':_0x16a27b[_0x84f0('0x42')]['id'],'SessionId':_0x4503e0[_0x490cd3]['id'],'StartTime':moment(_0x4503e0[_0x490cd3]['starttime'])[_0x84f0('0x69')](_0x84f0('0x6a'))};for(var _0x202ee0=0x0,_0x17dccc=_0x437011[_0x84f0('0x38')];_0x202ee0<_0x17dccc;_0x202ee0++){if(_0x437011[_0x202ee0][_0x84f0('0x6b')]==_0x4503e0[_0x490cd3]['id']&&_0x3b9cc5['hasOwnProperty'](_0x437011[_0x202ee0][_0x84f0('0x67')])){_0x48617d[_0x3b9cc5[_0x437011[_0x202ee0]['questionId']]]=_0x437011[_0x202ee0][_0x84f0('0x6c')];}}for(var _0x54dc6f in _0x3b9cc5){if(!_0x48617d[_0x84f0('0x57')](_0x3b9cc5[_0x54dc6f])){_0x48617d[_0x3b9cc5[_0x54dc6f]]=null;}}_0x2d617d[_0x84f0('0x6d')](_0x48617d);}return _0x2d617d;}})[_0x84f0('0x25')](function(_0x54631f){if(!_[_0x84f0('0x6e')](_0x54631f)){var _0x330765=toCsv(_0x54631f);var _0x40ac65=Date[_0x84f0('0x6f')]();fs[_0x84f0('0x70')](util[_0x84f0('0x69')](_0x84f0('0x71'),_0x16a27b[_0x84f0('0x42')]['id'],_0x40ac65),_0x330765);_0x1f148d[_0x84f0('0x72')]('Content-disposition',_0x84f0('0x73')+util['format'](_0x84f0('0x74'),_0x16a27b[_0x84f0('0x42')]['id'],_0x40ac65));_0x1f148d[_0x84f0('0x72')]('Content-type','text/csv');return _0x1f148d[_0x84f0('0x75')](util[_0x84f0('0x69')]('/tmp/Jscripty_Project_%d_Summary_%s.csv',_0x16a27b['params']['id'],_0x40ac65));}else{return _0x1f148d[_0x84f0('0x1a')](0xcc);}})[_0x84f0('0x40')](handleError(_0x1f148d,null));}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.model.js b/server/api/jscriptyProject/jscriptyProject.model.js index 17721e3..e514443 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 _0x0a52=['lodash','util','api','moment','bluebird','path','rimraf','../../config/environment','./jscriptyProject.attributes','exports','JscriptyProject','jscripty_projects'];(function(_0x5d393b,_0x3778a6){var _0x4ff54d=function(_0x421533){while(--_0x421533){_0x5d393b['push'](_0x5d393b['shift']());}};_0x4ff54d(++_0x3778a6);}(_0x0a52,0xe4));var _0x20a5=function(_0x214a25,_0x15071d){_0x214a25=_0x214a25-0x0;var _0x405988=_0x0a52[_0x214a25];return _0x405988;};'use strict';var _=require(_0x20a5('0x0'));var util=require(_0x20a5('0x1'));var logger=require('../../config/logger')(_0x20a5('0x2'));var moment=require(_0x20a5('0x3'));var BPromise=require(_0x20a5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x20a5('0x5'));var rimraf=require(_0x20a5('0x6'));var config=require(_0x20a5('0x7'));var attributes=require(_0x20a5('0x8'));module[_0x20a5('0x9')]=function(_0x1fcc72,_0x4acc66){return _0x1fcc72['define'](_0x20a5('0xa'),attributes,{'tableName':_0x20a5('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf569=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./jscriptyProject.attributes','JscriptyProject','jscripty_projects','util'];(function(_0x2cc60c,_0x35bac5){var _0x3acc8b=function(_0x32d239){while(--_0x32d239){_0x2cc60c['push'](_0x2cc60c['shift']());}};_0x3acc8b(++_0x35bac5);}(_0xf569,0xd0));var _0x9f56=function(_0x5d2803,_0xf375bd){_0x5d2803=_0x5d2803-0x0;var _0xdcad2c=_0xf569[_0x5d2803];return _0xdcad2c;};'use strict';var _=require('lodash');var util=require(_0x9f56('0x0'));var logger=require(_0x9f56('0x1'))(_0x9f56('0x2'));var moment=require(_0x9f56('0x3'));var BPromise=require(_0x9f56('0x4'));var rp=require(_0x9f56('0x5'));var fs=require('fs');var path=require(_0x9f56('0x6'));var rimraf=require(_0x9f56('0x7'));var config=require('../../config/environment');var attributes=require(_0x9f56('0x8'));module['exports']=function(_0x467a46,_0x3488f2){return _0x467a46['define'](_0x9f56('0x9'),attributes,{'tableName':_0x9f56('0xa'),'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 61dd5e4..540c73a 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 _0xd8b0=['../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then','info','JscriptyProject,\x20%s,\x20%s','request\x20sent','debug','JscriptyProject,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','ioredis'];(function(_0x1878db,_0x18d9f6){var _0x1ae242=function(_0x5a66d7){while(--_0x5a66d7){_0x1878db['push'](_0x1878db['shift']());}};_0x1ae242(++_0x18d9f6);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0d8b('0x2'));var db=require(_0x0d8b('0x3'))['db'];var utils=require(_0x0d8b('0x4'));var logger=require(_0x0d8b('0x5'))(_0x0d8b('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x0d8b('0x7')][_0x0d8b('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x39f43a,_0x4a4470,_0x413284){return new BPromise(function(_0x284169,_0x58e4e2){return client[_0x0d8b('0x9')](_0x39f43a,_0x413284)[_0x0d8b('0xa')](function(_0x3b027f){logger[_0x0d8b('0xb')](_0x0d8b('0xc'),_0x4a4470,_0x0d8b('0xd'));logger[_0x0d8b('0xe')](_0x0d8b('0xf'),_0x4a4470,'request\x20sent',JSON[_0x0d8b('0x10')](_0x3b027f));if(_0x3b027f['error']){if(_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x12')]===0x1f4){logger[_0x0d8b('0x11')](_0x0d8b('0xc'),_0x4a4470,_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);return _0x58e4e2(_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);}logger[_0x0d8b('0x11')](_0x0d8b('0xc'),_0x4a4470,_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);return _0x284169(_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);}else{logger['info'](_0x0d8b('0xc'),_0x4a4470,_0x0d8b('0xd'));_0x284169(_0x3b027f[_0x0d8b('0x14')][_0x0d8b('0x13')]);}})[_0x0d8b('0x15')](function(_0x5cd485){logger[_0x0d8b('0x11')](_0x0d8b('0xc'),_0x4a4470,_0x5cd485);_0x58e4e2(_0x5cd485);});});} \ No newline at end of file +var _0xbdb7=['request\x20sent','debug','JscriptyProject,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','info','JscriptyProject,\x20%s,\x20%s'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xbdb7,0x12e));var _0x7bdb=function(_0x5465e6,_0x2a8809){_0x5465e6=_0x5465e6-0x0;var _0x10044e=_0xbdb7[_0x5465e6];return _0x10044e;};'use strict';var _=require(_0x7bdb('0x0'));var util=require(_0x7bdb('0x1'));var moment=require(_0x7bdb('0x2'));var BPromise=require(_0x7bdb('0x3'));var rs=require(_0x7bdb('0x4'));var fs=require('fs');var Redis=require(_0x7bdb('0x5'));var db=require(_0x7bdb('0x6'))['db'];var utils=require(_0x7bdb('0x7'));var logger=require(_0x7bdb('0x8'))('rpc');var config=require(_0x7bdb('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x7bdb('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1e23a3,_0x493bde,_0x513cba){return new BPromise(function(_0x468041,_0x11a877){return client['request'](_0x1e23a3,_0x513cba)['then'](function(_0xdc2ffc){logger[_0x7bdb('0xb')](_0x7bdb('0xc'),_0x493bde,_0x7bdb('0xd'));logger[_0x7bdb('0xe')](_0x7bdb('0xf'),_0x493bde,_0x7bdb('0xd'),JSON[_0x7bdb('0x10')](_0xdc2ffc));if(_0xdc2ffc['error']){if(_0xdc2ffc['error']['code']===0x1f4){logger[_0x7bdb('0x11')](_0x7bdb('0xc'),_0x493bde,_0xdc2ffc['error'][_0x7bdb('0x12')]);return _0x11a877(_0xdc2ffc['error']['message']);}logger[_0x7bdb('0x11')](_0x7bdb('0xc'),_0x493bde,_0xdc2ffc['error']['message']);return _0x468041(_0xdc2ffc['error'][_0x7bdb('0x12')]);}else{logger[_0x7bdb('0xb')](_0x7bdb('0xc'),_0x493bde,_0x7bdb('0xd'));_0x468041(_0xdc2ffc[_0x7bdb('0x13')][_0x7bdb('0x12')]);}})[_0x7bdb('0x14')](function(_0x1b2d9b){logger['error'](_0x7bdb('0xc'),_0x493bde,_0x1b2d9b);_0x11a877(_0x1b2d9b);});});} \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/index.js b/server/api/jscriptyQuestionReport/index.js index c7cb063..7376227 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 _0x909c=['put','update','delete','destroy','exports','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyQuestionReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post'];(function(_0x34adb2,_0x29ea6b){var _0x1563b2=function(_0xee39c6){while(--_0xee39c6){_0x34adb2['push'](_0x34adb2['shift']());}};_0x1563b2(++_0x29ea6b);}(_0x909c,0xec));var _0xc909=function(_0x4da0d4,_0x52c83c){_0x4da0d4=_0x4da0d4-0x0;var _0x48927a=_0x909c[_0x4da0d4];return _0x48927a;};'use strict';var multer=require('multer');var util=require(_0xc909('0x0'));var path=require('path');var timeout=require(_0xc909('0x1'));var express=require(_0xc909('0x2'));var router=express[_0xc909('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xc909('0x4'));var interaction=require(_0xc909('0x5'));var config=require(_0xc909('0x6'));var controller=require(_0xc909('0x7'));router[_0xc909('0x8')]('/',auth[_0xc909('0x9')](),controller[_0xc909('0xa')]);router[_0xc909('0x8')](_0xc909('0xb'),auth[_0xc909('0x9')](),controller[_0xc909('0xc')]);router[_0xc909('0x8')](_0xc909('0xd'),auth[_0xc909('0x9')](),controller[_0xc909('0xe')]);router[_0xc909('0xf')]('/',auth[_0xc909('0x9')](),controller['create']);router[_0xc909('0x10')](_0xc909('0xd'),auth['isAuthenticated'](),controller[_0xc909('0x11')]);router[_0xc909('0x12')](_0xc909('0xd'),auth[_0xc909('0x9')](),controller[_0xc909('0x13')]);module[_0xc909('0x14')]=router; \ No newline at end of file +var _0x319f=['connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./jscriptyQuestionReport.controller','get','/describe','isAuthenticated','describe','/:id','show','post','put','delete','exports','multer','util','path'];(function(_0x3f468d,_0x21b70b){var _0x1834c1=function(_0x52e0ca){while(--_0x52e0ca){_0x3f468d['push'](_0x3f468d['shift']());}};_0x1834c1(++_0x21b70b);}(_0x319f,0x12d));var _0xf319=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x319f[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require(_0xf319('0x0'));var util=require(_0xf319('0x1'));var path=require(_0xf319('0x2'));var timeout=require(_0xf319('0x3'));var express=require('express');var router=express[_0xf319('0x4')]();var fs_extra=require(_0xf319('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xf319('0x6'));var config=require(_0xf319('0x7'));var controller=require(_0xf319('0x8'));router[_0xf319('0x9')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0xf319('0xa'),auth[_0xf319('0xb')](),controller[_0xf319('0xc')]);router[_0xf319('0x9')](_0xf319('0xd'),auth[_0xf319('0xb')](),controller[_0xf319('0xe')]);router[_0xf319('0xf')]('/',auth[_0xf319('0xb')](),controller['create']);router[_0xf319('0x10')](_0xf319('0xd'),auth[_0xf319('0xb')](),controller['update']);router[_0xf319('0x11')](_0xf319('0xd'),auth[_0xf319('0xb')](),controller['destroy']);module[_0xf319('0x12')]=router; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js index 22f5eec..824ba1a 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(_0x53ccf2,_0x13cb67){var _0x5a2964=function(_0x3b0514){while(--_0x3b0514){_0x53ccf2['push'](_0x53ccf2['shift']());}};_0x5a2964(++_0x13cb67);}(_0x7a54,0x106));var _0x47a5=function(_0x5c0a09,_0x5097ca){_0x5c0a09=_0x5c0a09-0x0;var _0x768ae=_0x7a54[_0x5c0a09];return _0x768ae;};'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(_0x45d55e,_0x2fede3){var _0x29812a=function(_0x3c6830){while(--_0x3c6830){_0x45d55e['push'](_0x45d55e['shift']());}};_0x29812a(++_0x2fede3);}(_0x7a54,0x106));var _0x47a5=function(_0x2d7581,_0x1c4fc3){_0x2d7581=_0x2d7581-0x0;var _0x57215b=_0x7a54[_0x2d7581];return _0x57215b;};'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 d461eb6..0bde60f 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 _0xca89=['include','options','find','catch','create','body','describe','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','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','api','../../config/utils','../../config/environment','../../config/license/util','status','json','undefined','limit','count','offset','Content-Range','apply','update','then','destroy','sendStatus','stack','name','send','index','map','JscriptyQuestionReport','fieldName','type','key','keys','intersection','model','query','attributes','length','order','sort','filters','pick','filter','where','merge','findAll','rows','show','params','fields','includeAll'];(function(_0x67d5ad,_0x5c218a){var _0x7af841=function(_0x1b21eb){while(--_0x1b21eb){_0x67d5ad['push'](_0x67d5ad['shift']());}};_0x7af841(++_0x5c218a);}(_0xca89,0x183));var _0x9ca8=function(_0x4ce910,_0x5ddd9c){_0x4ce910=_0x4ce910-0x0;var _0x18e1d2=_0xca89[_0x4ce910];return _0x18e1d2;};'use strict';var emlformat=require(_0x9ca8('0x0'));var rimraf=require(_0x9ca8('0x1'));var zipdir=require(_0x9ca8('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x9ca8('0x3'));var moment=require(_0x9ca8('0x4'));var BPromise=require(_0x9ca8('0x5'));var Mustache=require(_0x9ca8('0x6'));var util=require(_0x9ca8('0x7'));var path=require(_0x9ca8('0x8'));var sox=require(_0x9ca8('0x9'));var csv=require('to-csv');var ejs=require(_0x9ca8('0xa'));var fs=require('fs');var fs_extra=require(_0x9ca8('0xb'));var _=require(_0x9ca8('0xc'));var squel=require(_0x9ca8('0xd'));var crypto=require(_0x9ca8('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x9ca8('0xf'));var toCsv=require(_0x9ca8('0x10'));var querystring=require(_0x9ca8('0x11'));var Papa=require(_0x9ca8('0x12'));var Redis=require(_0x9ca8('0x13'));var authService=require(_0x9ca8('0x14'));var qs=require(_0x9ca8('0x15'));var as=require(_0x9ca8('0x16'));var hardwareService=require(_0x9ca8('0x17'));var logger=require(_0x9ca8('0x18'))(_0x9ca8('0x19'));var utils=require(_0x9ca8('0x1a'));var config=require(_0x9ca8('0x1b'));var licenseUtil=require(_0x9ca8('0x1c'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x39cdc8,_0x37dabe){_0x37dabe=_0x37dabe||0xcc;return function(_0x2cf3cc){if(_0x2cf3cc){return _0x39cdc8['sendStatus'](_0x37dabe);}return _0x39cdc8[_0x9ca8('0x1d')](_0x37dabe)['end']();};}function respondWithResult(_0x94bf97,_0x3c86bf){_0x3c86bf=_0x3c86bf||0xc8;return function(_0x5cca7e){if(_0x5cca7e){return _0x94bf97[_0x9ca8('0x1d')](_0x3c86bf)[_0x9ca8('0x1e')](_0x5cca7e);}};}function respondWithFilteredResult(_0x35c0a0,_0x5a59ee){return function(_0x3a55b6){if(_0x3a55b6){var _0x4553ee=typeof _0x5a59ee['offset']===_0x9ca8('0x1f')&&typeof _0x5a59ee[_0x9ca8('0x20')]===_0x9ca8('0x1f');var _0x9638d9=_0x3a55b6[_0x9ca8('0x21')];var _0x4acc3c=_0x4553ee?0x0:_0x5a59ee[_0x9ca8('0x22')];var _0x31be36=_0x4553ee?_0x3a55b6['count']:_0x5a59ee['offset']+_0x5a59ee[_0x9ca8('0x20')];var _0x3efb4b;if(_0x31be36>=_0x9638d9){_0x31be36=_0x9638d9;_0x3efb4b=0xc8;}else{_0x3efb4b=0xce;}_0x35c0a0[_0x9ca8('0x1d')](_0x3efb4b);return _0x35c0a0['set'](_0x9ca8('0x23'),_0x4acc3c+'-'+_0x31be36+'/'+_0x9638d9)['json'](_0x3a55b6);}return null;};}function patchUpdates(_0x1908a8){return function(_0x239474){try{jsonpatch[_0x9ca8('0x24')](_0x239474,_0x1908a8,!![]);}catch(_0x2369a5){return BPromise['reject'](_0x2369a5);}return _0x239474['save']();};}function saveUpdates(_0x16cf70,_0x3e0ad8){return function(_0x330492){if(_0x330492){return _0x330492[_0x9ca8('0x25')](_0x16cf70)[_0x9ca8('0x26')](function(_0x4da23f){return _0x4da23f;});}return null;};}function removeEntity(_0x147ada,_0x462802){return function(_0x88b3c){if(_0x88b3c){return _0x88b3c[_0x9ca8('0x27')]()[_0x9ca8('0x26')](function(){_0x147ada[_0x9ca8('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x512708,_0xfbd7c9){return function(_0xe22566){if(!_0xe22566){_0x512708[_0x9ca8('0x28')](0x194);}return _0xe22566;};}function handleError(_0x3a233e,_0x3ef5eb){_0x3ef5eb=_0x3ef5eb||0x1f4;return function(_0x310b74){logger['error'](_0x310b74[_0x9ca8('0x29')]);if(_0x310b74['name']){delete _0x310b74[_0x9ca8('0x2a')];}_0x3a233e[_0x9ca8('0x1d')](_0x3ef5eb)[_0x9ca8('0x2b')](_0x310b74);};}exports[_0x9ca8('0x2c')]=function(_0xe968b2,_0x181ed6){var _0x38776c={},_0x3bfa8b={},_0x2efa27={'count':0x0,'rows':[]};var _0x39f78b=_[_0x9ca8('0x2d')](db[_0x9ca8('0x2e')]['rawAttributes'],function(_0x34753a){return{'name':_0x34753a[_0x9ca8('0x2f')],'type':_0x34753a[_0x9ca8('0x30')][_0x9ca8('0x31')]};});_0x3bfa8b['model']=_[_0x9ca8('0x2d')](_0x39f78b,_0x9ca8('0x2a'));_0x3bfa8b['query']=_[_0x9ca8('0x32')](_0xe968b2['query']);_0x3bfa8b['filters']=_[_0x9ca8('0x33')](_0x3bfa8b[_0x9ca8('0x34')],_0x3bfa8b[_0x9ca8('0x35')]);_0x38776c['attributes']=_[_0x9ca8('0x33')](_0x3bfa8b[_0x9ca8('0x34')],qs['fields'](_0xe968b2[_0x9ca8('0x35')]['fields']));_0x38776c[_0x9ca8('0x36')]=_0x38776c[_0x9ca8('0x36')][_0x9ca8('0x37')]?_0x38776c['attributes']:_0x3bfa8b['model'];if(!_0xe968b2['query']['hasOwnProperty']('nolimit')){_0x38776c['limit']=qs[_0x9ca8('0x20')](_0xe968b2['query'][_0x9ca8('0x20')]);_0x38776c[_0x9ca8('0x22')]=qs[_0x9ca8('0x22')](_0xe968b2[_0x9ca8('0x35')]['offset']);}_0x38776c[_0x9ca8('0x38')]=qs[_0x9ca8('0x39')](_0xe968b2[_0x9ca8('0x35')][_0x9ca8('0x39')]);_0x38776c['where']=qs[_0x9ca8('0x3a')](_[_0x9ca8('0x3b')](_0xe968b2['query'],_0x3bfa8b[_0x9ca8('0x3a')]),_0x39f78b);if(_0xe968b2['query'][_0x9ca8('0x3c')]){_0x38776c[_0x9ca8('0x3d')]=_['merge'](_0x38776c[_0x9ca8('0x3d')],{'$or':_[_0x9ca8('0x2d')](_0x39f78b,function(_0x5b4b0b){if(_0x5b4b0b['type']!=='VIRTUAL'){var _0x337a6f={};_0x337a6f[_0x5b4b0b[_0x9ca8('0x2a')]]={'$like':'%'+_0xe968b2['query'][_0x9ca8('0x3c')]+'%'};return _0x337a6f;}})});}_0x38776c=_[_0x9ca8('0x3e')]({},_0x38776c,_0xe968b2['options']);var _0x1d6ffb={'where':_0x38776c[_0x9ca8('0x3d')]};return db['JscriptyQuestionReport'][_0x9ca8('0x21')](_0x1d6ffb)[_0x9ca8('0x26')](function(_0x263557){_0x2efa27[_0x9ca8('0x21')]=_0x263557;if(_0xe968b2['query']['includeAll']){_0x38776c['include']=[{'all':!![]}];}return db[_0x9ca8('0x2e')][_0x9ca8('0x3f')](_0x38776c);})['then'](function(_0x38cffa){_0x2efa27[_0x9ca8('0x40')]=_0x38cffa;return _0x2efa27;})['then'](respondWithFilteredResult(_0x181ed6,_0x38776c))['catch'](handleError(_0x181ed6,null));};exports[_0x9ca8('0x41')]=function(_0xe974a9,_0x31258a){var _0x588ac4={'raw':!![],'where':{'id':_0xe974a9[_0x9ca8('0x42')]['id']}},_0x2e8094={};_0x2e8094[_0x9ca8('0x34')]=_[_0x9ca8('0x32')](db['JscriptyQuestionReport']['rawAttributes']);_0x2e8094[_0x9ca8('0x35')]=_[_0x9ca8('0x32')](_0xe974a9[_0x9ca8('0x35')]);_0x2e8094['filters']=_['intersection'](_0x2e8094[_0x9ca8('0x34')],_0x2e8094['query']);_0x588ac4[_0x9ca8('0x36')]=_[_0x9ca8('0x33')](_0x2e8094[_0x9ca8('0x34')],qs['fields'](_0xe974a9[_0x9ca8('0x35')][_0x9ca8('0x43')]));_0x588ac4['attributes']=_0x588ac4[_0x9ca8('0x36')][_0x9ca8('0x37')]?_0x588ac4['attributes']:_0x2e8094[_0x9ca8('0x34')];if(_0xe974a9['query'][_0x9ca8('0x44')]){_0x588ac4[_0x9ca8('0x45')]=[{'all':!![]}];}_0x588ac4=_['merge']({},_0x588ac4,_0xe974a9[_0x9ca8('0x46')]);return db[_0x9ca8('0x2e')][_0x9ca8('0x47')](_0x588ac4)[_0x9ca8('0x26')](handleEntityNotFound(_0x31258a,null))[_0x9ca8('0x26')](respondWithResult(_0x31258a,null))[_0x9ca8('0x48')](handleError(_0x31258a,null));};exports[_0x9ca8('0x49')]=function(_0x3f456d,_0x53c718){return db['JscriptyQuestionReport'][_0x9ca8('0x49')](_0x3f456d[_0x9ca8('0x4a')],{})[_0x9ca8('0x26')](respondWithResult(_0x53c718,0xc9))['catch'](handleError(_0x53c718,null));};exports['update']=function(_0x1de207,_0x160b4d){if(_0x1de207['body']['id']){delete _0x1de207[_0x9ca8('0x4a')]['id'];}return db[_0x9ca8('0x2e')][_0x9ca8('0x47')]({'where':{'id':_0x1de207[_0x9ca8('0x42')]['id']}})[_0x9ca8('0x26')](handleEntityNotFound(_0x160b4d,null))[_0x9ca8('0x26')](saveUpdates(_0x1de207[_0x9ca8('0x4a')],null))['then'](respondWithResult(_0x160b4d,null))[_0x9ca8('0x48')](handleError(_0x160b4d,null));};exports['destroy']=function(_0x311edf,_0x457585){return db[_0x9ca8('0x2e')][_0x9ca8('0x47')]({'where':{'id':_0x311edf['params']['id']}})[_0x9ca8('0x26')](handleEntityNotFound(_0x457585,null))[_0x9ca8('0x26')](removeEntity(_0x457585,null))[_0x9ca8('0x48')](handleError(_0x457585,null));};exports[_0x9ca8('0x4b')]=function(_0x8b3720,_0x5f1fa5){return db['JscriptyQuestionReport'][_0x9ca8('0x4b')]()[_0x9ca8('0x26')](respondWithResult(_0x5f1fa5,null))[_0x9ca8('0x48')](handleError(_0x5f1fa5,null));}; \ No newline at end of file +var _0x06bc=['../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','reject','save','update','then','error','name','send','index','map','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','nolimit','order','sort','where','filter','merge','VIRTUAL','JscriptyQuestionReport','includeAll','include','rows','catch','show','params','keys','options','find','create','body','destroy','describe','eml-format','rimraf','request-promise','moment','mustache','util','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils'];(function(_0x38bcc9,_0x22aa31){var _0x3b0582=function(_0x3eb37c){while(--_0x3eb37c){_0x38bcc9['push'](_0x38bcc9['shift']());}};_0x3b0582(++_0x22aa31);}(_0x06bc,0xc6));var _0xc06b=function(_0x8cf7ac,_0x5123bc){_0x8cf7ac=_0x8cf7ac-0x0;var _0x2b6545=_0x06bc[_0x8cf7ac];return _0x2b6545;};'use strict';var emlformat=require(_0xc06b('0x0'));var rimraf=require(_0xc06b('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xc06b('0x2'));var moment=require(_0xc06b('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xc06b('0x4'));var util=require(_0xc06b('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0xc06b('0x6'));var ejs=require(_0xc06b('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc06b('0x8'));var squel=require(_0xc06b('0x9'));var crypto=require(_0xc06b('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xc06b('0xb'));var toCsv=require(_0xc06b('0x6'));var querystring=require(_0xc06b('0xc'));var Papa=require(_0xc06b('0xd'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xc06b('0xe'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc06b('0xf'))(_0xc06b('0x10'));var utils=require(_0xc06b('0x11'));var config=require(_0xc06b('0x12'));var licenseUtil=require(_0xc06b('0x13'));var db=require(_0xc06b('0x14'))['db'];function respondWithStatusCode(_0x24026f,_0xc568a4){_0xc568a4=_0xc568a4||0xcc;return function(_0x10cb22){if(_0x10cb22){return _0x24026f[_0xc06b('0x15')](_0xc568a4);}return _0x24026f[_0xc06b('0x16')](_0xc568a4)[_0xc06b('0x17')]();};}function respondWithResult(_0x42fceb,_0x1a06ae){_0x1a06ae=_0x1a06ae||0xc8;return function(_0x48ad7f){if(_0x48ad7f){return _0x42fceb[_0xc06b('0x16')](_0x1a06ae)['json'](_0x48ad7f);}};}function respondWithFilteredResult(_0x154436,_0x55d012){return function(_0x15d580){if(_0x15d580){var _0x34a049=typeof _0x55d012[_0xc06b('0x18')]===_0xc06b('0x19')&&typeof _0x55d012[_0xc06b('0x1a')]==='undefined';var _0x39b6d9=_0x15d580[_0xc06b('0x1b')];var _0x1839ba=_0x34a049?0x0:_0x55d012[_0xc06b('0x18')];var _0x4bdf5c=_0x34a049?_0x15d580[_0xc06b('0x1b')]:_0x55d012[_0xc06b('0x18')]+_0x55d012[_0xc06b('0x1a')];var _0x9fc620;if(_0x4bdf5c>=_0x39b6d9){_0x4bdf5c=_0x39b6d9;_0x9fc620=0xc8;}else{_0x9fc620=0xce;}_0x154436[_0xc06b('0x16')](_0x9fc620);return _0x154436[_0xc06b('0x1c')](_0xc06b('0x1d'),_0x1839ba+'-'+_0x4bdf5c+'/'+_0x39b6d9)[_0xc06b('0x1e')](_0x15d580);}return null;};}function patchUpdates(_0x85d351){return function(_0x25f45b){try{jsonpatch['apply'](_0x25f45b,_0x85d351,!![]);}catch(_0x2c46f4){return BPromise[_0xc06b('0x1f')](_0x2c46f4);}return _0x25f45b[_0xc06b('0x20')]();};}function saveUpdates(_0x33c3ce,_0xde8396){return function(_0x573ff3){if(_0x573ff3){return _0x573ff3[_0xc06b('0x21')](_0x33c3ce)[_0xc06b('0x22')](function(_0x2fcd98){return _0x2fcd98;});}return null;};}function removeEntity(_0x18b91d,_0xc61b6e){return function(_0x3adba8){if(_0x3adba8){return _0x3adba8['destroy']()[_0xc06b('0x22')](function(){_0x18b91d[_0xc06b('0x16')](0xcc)[_0xc06b('0x17')]();});}};}function handleEntityNotFound(_0x324f9e,_0x11868d){return function(_0x3b0e98){if(!_0x3b0e98){_0x324f9e[_0xc06b('0x15')](0x194);}return _0x3b0e98;};}function handleError(_0x1e7ab4,_0x4eafa3){_0x4eafa3=_0x4eafa3||0x1f4;return function(_0x21f526){logger[_0xc06b('0x23')](_0x21f526['stack']);if(_0x21f526['name']){delete _0x21f526[_0xc06b('0x24')];}_0x1e7ab4['status'](_0x4eafa3)[_0xc06b('0x25')](_0x21f526);};}exports[_0xc06b('0x26')]=function(_0x2545b7,_0x4e2ef2){var _0x4ab567={},_0x46c237={},_0x15c5b1={'count':0x0,'rows':[]};var _0x566c27=_[_0xc06b('0x27')](db['JscriptyQuestionReport'][_0xc06b('0x28')],function(_0xda7e9f){return{'name':_0xda7e9f[_0xc06b('0x29')],'type':_0xda7e9f[_0xc06b('0x2a')][_0xc06b('0x2b')]};});_0x46c237[_0xc06b('0x2c')]=_['map'](_0x566c27,_0xc06b('0x24'));_0x46c237[_0xc06b('0x2d')]=_['keys'](_0x2545b7[_0xc06b('0x2d')]);_0x46c237[_0xc06b('0x2e')]=_[_0xc06b('0x2f')](_0x46c237['model'],_0x46c237['query']);_0x4ab567['attributes']=_[_0xc06b('0x2f')](_0x46c237[_0xc06b('0x2c')],qs['fields'](_0x2545b7['query'][_0xc06b('0x30')]));_0x4ab567[_0xc06b('0x31')]=_0x4ab567[_0xc06b('0x31')][_0xc06b('0x32')]?_0x4ab567[_0xc06b('0x31')]:_0x46c237['model'];if(!_0x2545b7[_0xc06b('0x2d')]['hasOwnProperty'](_0xc06b('0x33'))){_0x4ab567[_0xc06b('0x1a')]=qs['limit'](_0x2545b7[_0xc06b('0x2d')]['limit']);_0x4ab567[_0xc06b('0x18')]=qs[_0xc06b('0x18')](_0x2545b7[_0xc06b('0x2d')][_0xc06b('0x18')]);}_0x4ab567[_0xc06b('0x34')]=qs['sort'](_0x2545b7[_0xc06b('0x2d')][_0xc06b('0x35')]);_0x4ab567[_0xc06b('0x36')]=qs['filters'](_['pick'](_0x2545b7[_0xc06b('0x2d')],_0x46c237['filters']),_0x566c27);if(_0x2545b7['query'][_0xc06b('0x37')]){_0x4ab567[_0xc06b('0x36')]=_[_0xc06b('0x38')](_0x4ab567[_0xc06b('0x36')],{'$or':_[_0xc06b('0x27')](_0x566c27,function(_0x3e4c98){if(_0x3e4c98['type']!==_0xc06b('0x39')){var _0x3e57a7={};_0x3e57a7[_0x3e4c98['name']]={'$like':'%'+_0x2545b7['query'][_0xc06b('0x37')]+'%'};return _0x3e57a7;}})});}_0x4ab567=_[_0xc06b('0x38')]({},_0x4ab567,_0x2545b7['options']);var _0x123517={'where':_0x4ab567['where']};return db[_0xc06b('0x3a')][_0xc06b('0x1b')](_0x123517)[_0xc06b('0x22')](function(_0x50f0b2){_0x15c5b1[_0xc06b('0x1b')]=_0x50f0b2;if(_0x2545b7['query'][_0xc06b('0x3b')]){_0x4ab567[_0xc06b('0x3c')]=[{'all':!![]}];}return db['JscriptyQuestionReport']['findAll'](_0x4ab567);})[_0xc06b('0x22')](function(_0x1e4ec7){_0x15c5b1[_0xc06b('0x3d')]=_0x1e4ec7;return _0x15c5b1;})['then'](respondWithFilteredResult(_0x4e2ef2,_0x4ab567))[_0xc06b('0x3e')](handleError(_0x4e2ef2,null));};exports[_0xc06b('0x3f')]=function(_0x4d4c2b,_0x2dcac9){var _0x11ff5e={'raw':!![],'where':{'id':_0x4d4c2b[_0xc06b('0x40')]['id']}},_0x10c997={};_0x10c997['model']=_[_0xc06b('0x41')](db[_0xc06b('0x3a')][_0xc06b('0x28')]);_0x10c997[_0xc06b('0x2d')]=_[_0xc06b('0x41')](_0x4d4c2b[_0xc06b('0x2d')]);_0x10c997[_0xc06b('0x2e')]=_[_0xc06b('0x2f')](_0x10c997[_0xc06b('0x2c')],_0x10c997[_0xc06b('0x2d')]);_0x11ff5e['attributes']=_[_0xc06b('0x2f')](_0x10c997[_0xc06b('0x2c')],qs[_0xc06b('0x30')](_0x4d4c2b[_0xc06b('0x2d')][_0xc06b('0x30')]));_0x11ff5e['attributes']=_0x11ff5e[_0xc06b('0x31')][_0xc06b('0x32')]?_0x11ff5e[_0xc06b('0x31')]:_0x10c997[_0xc06b('0x2c')];if(_0x4d4c2b[_0xc06b('0x2d')][_0xc06b('0x3b')]){_0x11ff5e[_0xc06b('0x3c')]=[{'all':!![]}];}_0x11ff5e=_[_0xc06b('0x38')]({},_0x11ff5e,_0x4d4c2b[_0xc06b('0x42')]);return db[_0xc06b('0x3a')][_0xc06b('0x43')](_0x11ff5e)[_0xc06b('0x22')](handleEntityNotFound(_0x2dcac9,null))[_0xc06b('0x22')](respondWithResult(_0x2dcac9,null))[_0xc06b('0x3e')](handleError(_0x2dcac9,null));};exports[_0xc06b('0x44')]=function(_0x28e58d,_0x1cb841){return db['JscriptyQuestionReport']['create'](_0x28e58d['body'],{})['then'](respondWithResult(_0x1cb841,0xc9))[_0xc06b('0x3e')](handleError(_0x1cb841,null));};exports['update']=function(_0x207e90,_0x323bac){if(_0x207e90[_0xc06b('0x45')]['id']){delete _0x207e90['body']['id'];}return db[_0xc06b('0x3a')][_0xc06b('0x43')]({'where':{'id':_0x207e90[_0xc06b('0x40')]['id']}})[_0xc06b('0x22')](handleEntityNotFound(_0x323bac,null))[_0xc06b('0x22')](saveUpdates(_0x207e90['body'],null))['then'](respondWithResult(_0x323bac,null))[_0xc06b('0x3e')](handleError(_0x323bac,null));};exports[_0xc06b('0x46')]=function(_0x19d8b4,_0xadba7b){return db['JscriptyQuestionReport'][_0xc06b('0x43')]({'where':{'id':_0x19d8b4[_0xc06b('0x40')]['id']}})[_0xc06b('0x22')](handleEntityNotFound(_0xadba7b,null))[_0xc06b('0x22')](removeEntity(_0xadba7b,null))[_0xc06b('0x3e')](handleError(_0xadba7b,null));};exports[_0xc06b('0x47')]=function(_0x2234e9,_0x307091){return db[_0xc06b('0x3a')][_0xc06b('0x47')]()[_0xc06b('0x22')](respondWithResult(_0x307091,null))[_0xc06b('0x3e')](handleError(_0x307091,null));}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js index 40582da..1d2f01e 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 _0x38e8=['bluebird','request-promise','path','rimraf','../../config/environment','exports','define','JscriptyQuestionReport','report_jscripty_questions','lodash','util','../../config/logger','api','moment'];(function(_0x3b5c18,_0x2ef1f2){var _0x3e396a=function(_0x3852d9){while(--_0x3852d9){_0x3b5c18['push'](_0x3b5c18['shift']());}};_0x3e396a(++_0x2ef1f2);}(_0x38e8,0x87));var _0x838e=function(_0x335f0e,_0x3146e5){_0x335f0e=_0x335f0e-0x0;var _0x198786=_0x38e8[_0x335f0e];return _0x198786;};'use strict';var _=require(_0x838e('0x0'));var util=require(_0x838e('0x1'));var logger=require(_0x838e('0x2'))(_0x838e('0x3'));var moment=require(_0x838e('0x4'));var BPromise=require(_0x838e('0x5'));var rp=require(_0x838e('0x6'));var fs=require('fs');var path=require(_0x838e('0x7'));var rimraf=require(_0x838e('0x8'));var config=require(_0x838e('0x9'));var attributes=require('./jscriptyQuestionReport.attributes');module[_0x838e('0xa')]=function(_0x18b922,_0x25fd7f){return _0x18b922[_0x838e('0xb')](_0x838e('0xc'),attributes,{'tableName':_0x838e('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xab70=['lodash','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./jscriptyQuestionReport.attributes','define','JscriptyQuestionReport','report_jscripty_questions'];(function(_0x421cf8,_0x23152c){var _0x145c48=function(_0x565862){while(--_0x565862){_0x421cf8['push'](_0x421cf8['shift']());}};_0x145c48(++_0x23152c);}(_0xab70,0x78));var _0x0ab7=function(_0x46c17e,_0x2c1903){_0x46c17e=_0x46c17e-0x0;var _0x1a3e9e=_0xab70[_0x46c17e];return _0x1a3e9e;};'use strict';var _=require(_0x0ab7('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x0ab7('0x1'));var moment=require(_0x0ab7('0x2'));var BPromise=require(_0x0ab7('0x3'));var rp=require(_0x0ab7('0x4'));var fs=require('fs');var path=require(_0x0ab7('0x5'));var rimraf=require(_0x0ab7('0x6'));var config=require(_0x0ab7('0x7'));var attributes=require(_0x0ab7('0x8'));module['exports']=function(_0x125ad1,_0x1b9874){return _0x125ad1[_0x0ab7('0x9')](_0x0ab7('0xa'),attributes,{'tableName':_0x0ab7('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 e36bb94..efbb9fc 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 _0xfe68=['code','message','result','catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/environment','http','request','info','JscriptyQuestionReport,\x20%s,\x20%s','debug','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x40bc5b,_0x434dcd){var _0x3faca9=function(_0x3fc084){while(--_0x3fc084){_0x40bc5b['push'](_0x40bc5b['shift']());}};_0x3faca9(++_0x434dcd);}(_0xfe68,0x158));var _0x8fe6=function(_0x471268,_0x5ce885){_0x471268=_0x471268-0x0;var _0x1298f3=_0xfe68[_0x471268];return _0x1298f3;};'use strict';var _=require('lodash');var util=require(_0x8fe6('0x0'));var moment=require(_0x8fe6('0x1'));var BPromise=require(_0x8fe6('0x2'));var rs=require(_0x8fe6('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8fe6('0x4'))['db'];var utils=require(_0x8fe6('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x8fe6('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0x8fe6('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x582e51,_0x207006,_0x4083cd){return new BPromise(function(_0x2c9c2d,_0x57c602){return client[_0x8fe6('0x8')](_0x582e51,_0x4083cd)['then'](function(_0x4b871b){logger[_0x8fe6('0x9')](_0x8fe6('0xa'),_0x207006,'request\x20sent');logger[_0x8fe6('0xb')](_0x8fe6('0xc'),_0x207006,_0x8fe6('0xd'),JSON[_0x8fe6('0xe')](_0x4b871b));if(_0x4b871b[_0x8fe6('0xf')]){if(_0x4b871b['error'][_0x8fe6('0x10')]===0x1f4){logger[_0x8fe6('0xf')](_0x8fe6('0xa'),_0x207006,_0x4b871b[_0x8fe6('0xf')]['message']);return _0x57c602(_0x4b871b[_0x8fe6('0xf')][_0x8fe6('0x11')]);}logger[_0x8fe6('0xf')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x207006,_0x4b871b[_0x8fe6('0xf')][_0x8fe6('0x11')]);return _0x2c9c2d(_0x4b871b['error'][_0x8fe6('0x11')]);}else{logger['info']('JscriptyQuestionReport,\x20%s,\x20%s',_0x207006,_0x8fe6('0xd'));_0x2c9c2d(_0x4b871b[_0x8fe6('0x12')][_0x8fe6('0x11')]);}})[_0x8fe6('0x13')](function(_0x5b8b10){logger[_0x8fe6('0xf')](_0x8fe6('0xa'),_0x207006,_0x5b8b10);_0x57c602(_0x5b8b10);});});} \ No newline at end of file +var _0x2658=['code','message','catch','lodash','moment','randomstring','ioredis','../../config/utils','client','http','request','then','info','JscriptyQuestionReport,\x20%s,\x20%s','request\x20sent','debug','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x1f6a77,_0x3fb516){var _0x3a8206=function(_0xee7b19){while(--_0xee7b19){_0x1f6a77['push'](_0x1f6a77['shift']());}};_0x3a8206(++_0x3fb516);}(_0x2658,0x120));var _0x8265=function(_0x24d91e,_0x5f0df4){_0x24d91e=_0x24d91e-0x0;var _0x34d6f6=_0x2658[_0x24d91e];return _0x34d6f6;};'use strict';var _=require(_0x8265('0x0'));var util=require('util');var moment=require(_0x8265('0x1'));var BPromise=require('bluebird');var rs=require(_0x8265('0x2'));var fs=require('fs');var Redis=require(_0x8265('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x8265('0x4'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x8265('0x5')][_0x8265('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x125dfc,_0x5855e1,_0x881573){return new BPromise(function(_0x28ec9c,_0x3f65dc){return client[_0x8265('0x7')](_0x125dfc,_0x881573)[_0x8265('0x8')](function(_0x23d5ec){logger[_0x8265('0x9')](_0x8265('0xa'),_0x5855e1,_0x8265('0xb'));logger[_0x8265('0xc')](_0x8265('0xd'),_0x5855e1,_0x8265('0xb'),JSON[_0x8265('0xe')](_0x23d5ec));if(_0x23d5ec[_0x8265('0xf')]){if(_0x23d5ec[_0x8265('0xf')][_0x8265('0x10')]===0x1f4){logger[_0x8265('0xf')](_0x8265('0xa'),_0x5855e1,_0x23d5ec[_0x8265('0xf')][_0x8265('0x11')]);return _0x3f65dc(_0x23d5ec[_0x8265('0xf')][_0x8265('0x11')]);}logger[_0x8265('0xf')](_0x8265('0xa'),_0x5855e1,_0x23d5ec[_0x8265('0xf')][_0x8265('0x11')]);return _0x28ec9c(_0x23d5ec[_0x8265('0xf')][_0x8265('0x11')]);}else{logger['info'](_0x8265('0xa'),_0x5855e1,_0x8265('0xb'));_0x28ec9c(_0x23d5ec['result']['message']);}})[_0x8265('0x12')](function(_0x4698d1){logger['error'](_0x8265('0xa'),_0x5855e1,_0x4698d1);_0x3f65dc(_0x4698d1);});});} \ No newline at end of file diff --git a/server/api/jscriptySessionReport/index.js b/server/api/jscriptySessionReport/index.js index 36bf5f4..6fefb21 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 _0x98f6=['Router','fs-extra','../../components/interaction/service','../../config/environment','./jscriptySessionReport.controller','index','get','/describe','isAuthenticated','describe','/:id','show','/:id/questions','getQuestions','post','create','put','update','delete','destroy','exports','util','path','connect-timeout','express'];(function(_0x128908,_0x28665d){var _0x16d320=function(_0x6c27b0){while(--_0x6c27b0){_0x128908['push'](_0x128908['shift']());}};_0x16d320(++_0x28665d);}(_0x98f6,0xc4));var _0x698f=function(_0x4d2ed7,_0x1999e5){_0x4d2ed7=_0x4d2ed7-0x0;var _0x12af27=_0x98f6[_0x4d2ed7];return _0x12af27;};'use strict';var multer=require('multer');var util=require(_0x698f('0x0'));var path=require(_0x698f('0x1'));var timeout=require(_0x698f('0x2'));var express=require(_0x698f('0x3'));var router=express[_0x698f('0x4')]();var fs_extra=require(_0x698f('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x698f('0x6'));var config=require(_0x698f('0x7'));var controller=require(_0x698f('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x698f('0x9')]);router[_0x698f('0xa')](_0x698f('0xb'),auth[_0x698f('0xc')](),controller[_0x698f('0xd')]);router[_0x698f('0xa')](_0x698f('0xe'),auth[_0x698f('0xc')](),controller[_0x698f('0xf')]);router[_0x698f('0xa')](_0x698f('0x10'),auth[_0x698f('0xc')](),controller[_0x698f('0x11')]);router[_0x698f('0x12')]('/',auth[_0x698f('0xc')](),controller[_0x698f('0x13')]);router[_0x698f('0x14')]('/:id',auth[_0x698f('0xc')](),controller[_0x698f('0x15')]);router[_0x698f('0x16')](_0x698f('0xe'),auth['isAuthenticated'](),controller[_0x698f('0x17')]);module[_0x698f('0x18')]=router; \ No newline at end of file +var _0xae55=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptySessionReport.controller','get','isAuthenticated','index','describe','/:id','show','/:id/questions','post','update','delete','destroy','exports','multer','util'];(function(_0x37b7b6,_0x165a5c){var _0x10c4c3=function(_0x16d71e){while(--_0x16d71e){_0x37b7b6['push'](_0x37b7b6['shift']());}};_0x10c4c3(++_0x165a5c);}(_0xae55,0xfa));var _0x5ae5=function(_0xec4c09,_0x57262f){_0xec4c09=_0xec4c09-0x0;var _0x1f9860=_0xae55[_0xec4c09];return _0x1f9860;};'use strict';var multer=require(_0x5ae5('0x0'));var util=require(_0x5ae5('0x1'));var path=require('path');var timeout=require(_0x5ae5('0x2'));var express=require(_0x5ae5('0x3'));var router=express[_0x5ae5('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x5ae5('0x5'));var interaction=require(_0x5ae5('0x6'));var config=require(_0x5ae5('0x7'));var controller=require(_0x5ae5('0x8'));router[_0x5ae5('0x9')]('/',auth[_0x5ae5('0xa')](),controller[_0x5ae5('0xb')]);router[_0x5ae5('0x9')]('/describe',auth['isAuthenticated'](),controller[_0x5ae5('0xc')]);router[_0x5ae5('0x9')](_0x5ae5('0xd'),auth[_0x5ae5('0xa')](),controller[_0x5ae5('0xe')]);router[_0x5ae5('0x9')](_0x5ae5('0xf'),auth[_0x5ae5('0xa')](),controller['getQuestions']);router[_0x5ae5('0x10')]('/',auth[_0x5ae5('0xa')](),controller['create']);router['put'](_0x5ae5('0xd'),auth[_0x5ae5('0xa')](),controller[_0x5ae5('0x11')]);router[_0x5ae5('0x12')](_0x5ae5('0xd'),auth[_0x5ae5('0xa')](),controller[_0x5ae5('0x13')]);module[_0x5ae5('0x14')]=router; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js b/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js index a4fb3c2..98843c7 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 _0x5a72=['DATE','STRING','BOOLEAN','moment','exports','setDataValue','endtime','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x2f9ac3,_0x4a4d0e){var _0x3e400f=function(_0x4689e9){while(--_0x4689e9){_0x2f9ac3['push'](_0x2f9ac3['shift']());}};_0x3e400f(++_0x4a4d0e);}(_0x5a72,0x1c5));var _0x25a7=function(_0x4d3bf6,_0x4ceab7){_0x4d3bf6=_0x4d3bf6-0x0;var _0x328645=_0x5a72[_0x4d3bf6];return _0x328645;};'use strict';var moment=require(_0x25a7('0x0'));var Sequelize=require('sequelize');module[_0x25a7('0x1')]={'starttime':{'type':Sequelize['DATE'],'set':function(_0x589523){this[_0x25a7('0x2')]('starttime',_0x589523);this[_0x25a7('0x2')](_0x25a7('0x3'),moment()[_0x25a7('0x4')](_0x25a7('0x5')));}},'endtime':{'type':Sequelize[_0x25a7('0x6')]},'membername':{'type':Sequelize[_0x25a7('0x7')]},'projectname':{'type':Sequelize[_0x25a7('0x7')]},'queue':{'type':Sequelize[_0x25a7('0x7')]},'uniqueid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x25a7('0x7')]},'calleridnum':{'type':Sequelize[_0x25a7('0x7')]},'completed':{'type':Sequelize[_0x25a7('0x8')],'defaultValue':![]}}; \ No newline at end of file +var _0xc9c3=['starttime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','STRING','BOOLEAN','exports','setDataValue'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0xc9c3,0x96));var _0x3c9c=function(_0x27093f,_0x2e3f22){_0x27093f=_0x27093f-0x0;var _0x2435e5=_0xc9c3[_0x27093f];return _0x2435e5;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x3c9c('0x0')]={'starttime':{'type':Sequelize['DATE'],'set':function(_0xf34a69){this[_0x3c9c('0x1')](_0x3c9c('0x2'),_0xf34a69);this[_0x3c9c('0x1')](_0x3c9c('0x3'),moment()[_0x3c9c('0x4')](_0x3c9c('0x5')));}},'endtime':{'type':Sequelize['DATE']},'membername':{'type':Sequelize['STRING']},'projectname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x3c9c('0x6')]},'uniqueid':{'type':Sequelize[_0x3c9c('0x6')]},'calleridname':{'type':Sequelize[_0x3c9c('0x6')]},'calleridnum':{'type':Sequelize[_0x3c9c('0x6')]},'completed':{'type':Sequelize[_0x3c9c('0x7')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.controller.js b/server/api/jscriptySessionReport/jscriptySessionReport.controller.js index 7912148..20aa2ee 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 _0x96c2=['index','map','JscriptySessionReport','fieldName','key','model','query','keys','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','type','VIRTUAL','options','includeAll','findAll','rows','show','rawAttributes','intersection','catch','create','body','params','find','describe','findOne','JscriptyQuestionReport','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','ejs','squel','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','name'];(function(_0x216b7e,_0x596e4a){var _0x40d3af=function(_0x5ddd48){while(--_0x5ddd48){_0x216b7e['push'](_0x216b7e['shift']());}};_0x40d3af(++_0x596e4a);}(_0x96c2,0x15d));var _0x296c=function(_0x5ecadc,_0x1cf9f1){_0x5ecadc=_0x5ecadc-0x0;var _0x565037=_0x96c2[_0x5ecadc];return _0x565037;};'use strict';var emlformat=require(_0x296c('0x0'));var rimraf=require(_0x296c('0x1'));var zipdir=require(_0x296c('0x2'));var jsonpatch=require(_0x296c('0x3'));var rp=require(_0x296c('0x4'));var moment=require('moment');var BPromise=require(_0x296c('0x5'));var Mustache=require(_0x296c('0x6'));var util=require(_0x296c('0x7'));var path=require('path');var sox=require(_0x296c('0x8'));var csv=require('to-csv');var ejs=require(_0x296c('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x296c('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x296c('0xb'));var toCsv=require(_0x296c('0xc'));var querystring=require(_0x296c('0xd'));var Papa=require(_0x296c('0xe'));var Redis=require(_0x296c('0xf'));var authService=require(_0x296c('0x10'));var qs=require(_0x296c('0x11'));var as=require(_0x296c('0x12'));var hardwareService=require(_0x296c('0x13'));var logger=require(_0x296c('0x14'))(_0x296c('0x15'));var utils=require(_0x296c('0x16'));var config=require(_0x296c('0x17'));var licenseUtil=require(_0x296c('0x18'));var db=require(_0x296c('0x19'))['db'];function respondWithStatusCode(_0x5fc777,_0x23482a){_0x23482a=_0x23482a||0xcc;return function(_0x35cdcc){if(_0x35cdcc){return _0x5fc777[_0x296c('0x1a')](_0x23482a);}return _0x5fc777[_0x296c('0x1b')](_0x23482a)[_0x296c('0x1c')]();};}function respondWithResult(_0x21bfec,_0x253a32){_0x253a32=_0x253a32||0xc8;return function(_0x36e005){if(_0x36e005){return _0x21bfec[_0x296c('0x1b')](_0x253a32)['json'](_0x36e005);}};}function respondWithFilteredResult(_0x476d9c,_0x35e65f){return function(_0xd88735){if(_0xd88735){var _0x3b98ea=typeof _0x35e65f[_0x296c('0x1d')]===_0x296c('0x1e')&&typeof _0x35e65f[_0x296c('0x1f')]===_0x296c('0x1e');var _0x100644=_0xd88735['count'];var _0x1e877f=_0x3b98ea?0x0:_0x35e65f[_0x296c('0x1d')];var _0x8be538=_0x3b98ea?_0xd88735[_0x296c('0x20')]:_0x35e65f[_0x296c('0x1d')]+_0x35e65f['limit'];var _0x57c071;if(_0x8be538>=_0x100644){_0x8be538=_0x100644;_0x57c071=0xc8;}else{_0x57c071=0xce;}_0x476d9c['status'](_0x57c071);return _0x476d9c['set'](_0x296c('0x21'),_0x1e877f+'-'+_0x8be538+'/'+_0x100644)['json'](_0xd88735);}return null;};}function patchUpdates(_0x25f2a4){return function(_0x3e20f5){try{jsonpatch[_0x296c('0x22')](_0x3e20f5,_0x25f2a4,!![]);}catch(_0x411a15){return BPromise[_0x296c('0x23')](_0x411a15);}return _0x3e20f5[_0x296c('0x24')]();};}function saveUpdates(_0x2dc06d,_0x420b39){return function(_0x2caf30){if(_0x2caf30){return _0x2caf30[_0x296c('0x25')](_0x2dc06d)[_0x296c('0x26')](function(_0x59acb8){return _0x59acb8;});}return null;};}function removeEntity(_0x51e39c,_0x3f246d){return function(_0x24b02f){if(_0x24b02f){return _0x24b02f[_0x296c('0x27')]()['then'](function(){_0x51e39c['status'](0xcc)[_0x296c('0x1c')]();});}};}function handleEntityNotFound(_0x23c517,_0x4f8f6a){return function(_0x536031){if(!_0x536031){_0x23c517[_0x296c('0x1a')](0x194);}return _0x536031;};}function handleError(_0x102387,_0x543d19){_0x543d19=_0x543d19||0x1f4;return function(_0x2da046){logger['error'](_0x2da046['stack']);if(_0x2da046[_0x296c('0x28')]){delete _0x2da046['name'];}_0x102387[_0x296c('0x1b')](_0x543d19)['send'](_0x2da046);};}exports[_0x296c('0x29')]=function(_0x2aafb1,_0x455472){var _0x30a642={},_0x2e31ba={},_0x2f925c={'count':0x0,'rows':[]};var _0x6baeb4=_[_0x296c('0x2a')](db[_0x296c('0x2b')]['rawAttributes'],function(_0x118e3a){return{'name':_0x118e3a[_0x296c('0x2c')],'type':_0x118e3a['type'][_0x296c('0x2d')]};});_0x2e31ba[_0x296c('0x2e')]=_[_0x296c('0x2a')](_0x6baeb4,_0x296c('0x28'));_0x2e31ba[_0x296c('0x2f')]=_[_0x296c('0x30')](_0x2aafb1[_0x296c('0x2f')]);_0x2e31ba['filters']=_['intersection'](_0x2e31ba[_0x296c('0x2e')],_0x2e31ba[_0x296c('0x2f')]);_0x30a642[_0x296c('0x31')]=_['intersection'](_0x2e31ba['model'],qs[_0x296c('0x32')](_0x2aafb1['query'][_0x296c('0x32')]));_0x30a642[_0x296c('0x31')]=_0x30a642[_0x296c('0x31')][_0x296c('0x33')]?_0x30a642[_0x296c('0x31')]:_0x2e31ba[_0x296c('0x2e')];if(!_0x2aafb1[_0x296c('0x2f')][_0x296c('0x34')](_0x296c('0x35'))){_0x30a642['limit']=qs[_0x296c('0x1f')](_0x2aafb1['query']['limit']);_0x30a642[_0x296c('0x1d')]=qs[_0x296c('0x1d')](_0x2aafb1['query'][_0x296c('0x1d')]);}_0x30a642[_0x296c('0x36')]=qs['sort'](_0x2aafb1[_0x296c('0x2f')][_0x296c('0x37')]);_0x30a642[_0x296c('0x38')]=qs[_0x296c('0x39')](_[_0x296c('0x3a')](_0x2aafb1[_0x296c('0x2f')],_0x2e31ba[_0x296c('0x39')]),_0x6baeb4);if(_0x2aafb1[_0x296c('0x2f')][_0x296c('0x3b')]){_0x30a642['where']=_[_0x296c('0x3c')](_0x30a642[_0x296c('0x38')],{'$or':_[_0x296c('0x2a')](_0x6baeb4,function(_0x47e713){if(_0x47e713[_0x296c('0x3d')]!==_0x296c('0x3e')){var _0x1f3d51={};_0x1f3d51[_0x47e713['name']]={'$like':'%'+_0x2aafb1[_0x296c('0x2f')][_0x296c('0x3b')]+'%'};return _0x1f3d51;}})});}_0x30a642=_[_0x296c('0x3c')]({},_0x30a642,_0x2aafb1[_0x296c('0x3f')]);var _0x62c6cf={'where':_0x30a642[_0x296c('0x38')]};return db['JscriptySessionReport']['count'](_0x62c6cf)[_0x296c('0x26')](function(_0xbe4619){_0x2f925c[_0x296c('0x20')]=_0xbe4619;if(_0x2aafb1['query'][_0x296c('0x40')]){_0x30a642['include']=[{'all':!![]}];}return db[_0x296c('0x2b')][_0x296c('0x41')](_0x30a642);})[_0x296c('0x26')](function(_0x1cb69c){_0x2f925c[_0x296c('0x42')]=_0x1cb69c;return _0x2f925c;})[_0x296c('0x26')](respondWithFilteredResult(_0x455472,_0x30a642))['catch'](handleError(_0x455472,null));};exports[_0x296c('0x43')]=function(_0x11c397,_0x4636cd){var _0x488d3a={'raw':!![],'where':{'id':_0x11c397['params']['id']}},_0x3b50ef={};_0x3b50ef['model']=_[_0x296c('0x30')](db[_0x296c('0x2b')][_0x296c('0x44')]);_0x3b50ef['query']=_[_0x296c('0x30')](_0x11c397[_0x296c('0x2f')]);_0x3b50ef['filters']=_[_0x296c('0x45')](_0x3b50ef[_0x296c('0x2e')],_0x3b50ef[_0x296c('0x2f')]);_0x488d3a['attributes']=_[_0x296c('0x45')](_0x3b50ef[_0x296c('0x2e')],qs[_0x296c('0x32')](_0x11c397[_0x296c('0x2f')]['fields']));_0x488d3a[_0x296c('0x31')]=_0x488d3a[_0x296c('0x31')][_0x296c('0x33')]?_0x488d3a[_0x296c('0x31')]:_0x3b50ef[_0x296c('0x2e')];if(_0x11c397['query'][_0x296c('0x40')]){_0x488d3a['include']=[{'all':!![]}];}_0x488d3a=_[_0x296c('0x3c')]({},_0x488d3a,_0x11c397[_0x296c('0x3f')]);return db[_0x296c('0x2b')]['find'](_0x488d3a)[_0x296c('0x26')](handleEntityNotFound(_0x4636cd,null))[_0x296c('0x26')](respondWithResult(_0x4636cd,null))[_0x296c('0x46')](handleError(_0x4636cd,null));};exports['create']=function(_0x35a336,_0x2b9233){return db['JscriptySessionReport'][_0x296c('0x47')](_0x35a336[_0x296c('0x48')],{})[_0x296c('0x26')](respondWithResult(_0x2b9233,0xc9))[_0x296c('0x46')](handleError(_0x2b9233,null));};exports['update']=function(_0x3ed62e,_0xed48fd){if(_0x3ed62e[_0x296c('0x48')]['id']){delete _0x3ed62e[_0x296c('0x48')]['id'];}return db[_0x296c('0x2b')]['find']({'where':{'id':_0x3ed62e[_0x296c('0x49')]['id']}})[_0x296c('0x26')](handleEntityNotFound(_0xed48fd,null))[_0x296c('0x26')](saveUpdates(_0x3ed62e[_0x296c('0x48')],null))[_0x296c('0x26')](respondWithResult(_0xed48fd,null))[_0x296c('0x46')](handleError(_0xed48fd,null));};exports['destroy']=function(_0x20f3b3,_0x2d7cfe){return db['JscriptySessionReport'][_0x296c('0x4a')]({'where':{'id':_0x20f3b3[_0x296c('0x49')]['id']}})['then'](handleEntityNotFound(_0x2d7cfe,null))[_0x296c('0x26')](removeEntity(_0x2d7cfe,null))['catch'](handleError(_0x2d7cfe,null));};exports[_0x296c('0x4b')]=function(_0x1a988c,_0x20f0bd){return db['JscriptySessionReport'][_0x296c('0x4b')]()[_0x296c('0x26')](respondWithResult(_0x20f0bd,null))[_0x296c('0x46')](handleError(_0x20f0bd,null));};exports['getQuestions']=function(_0x260b57,_0x59e7d7,_0x19a2e3){var _0x3acefa={'raw':!![],'where':{}};var _0x298731={};var _0x254340={'count':0x0,'rows':[]};return db[_0x296c('0x2b')][_0x296c('0x4c')]({'where':{'id':_0x260b57[_0x296c('0x49')]['id']}})[_0x296c('0x26')](handleEntityNotFound(_0x59e7d7,null))[_0x296c('0x26')](function(_0x536fab){if(_0x536fab){_0x298731[_0x296c('0x2e')]=_[_0x296c('0x30')](db['JscriptyQuestionReport'][_0x296c('0x44')]);_0x298731[_0x296c('0x2f')]=_['keys'](_0x260b57[_0x296c('0x2f')]);_0x298731[_0x296c('0x39')]=_[_0x296c('0x45')](_0x298731['model'],_0x298731['query']);_0x3acefa[_0x296c('0x31')]=_[_0x296c('0x45')](_0x298731[_0x296c('0x2e')],qs[_0x296c('0x32')](_0x260b57[_0x296c('0x2f')][_0x296c('0x32')]));_0x3acefa[_0x296c('0x31')]=_0x3acefa[_0x296c('0x31')][_0x296c('0x33')]?_0x3acefa[_0x296c('0x31')]:_0x298731[_0x296c('0x2e')];if(!_0x260b57[_0x296c('0x2f')]['hasOwnProperty'](_0x296c('0x35'))){_0x3acefa[_0x296c('0x1f')]=qs[_0x296c('0x1f')](_0x260b57[_0x296c('0x2f')]['limit']);_0x3acefa['offset']=qs[_0x296c('0x1d')](_0x260b57[_0x296c('0x2f')]['offset']);}_0x3acefa['order']=qs[_0x296c('0x37')](_0x260b57[_0x296c('0x2f')][_0x296c('0x37')]);_0x3acefa[_0x296c('0x38')]=qs[_0x296c('0x39')](_[_0x296c('0x3a')](_0x260b57[_0x296c('0x2f')],_0x298731['filters']));_0x3acefa['where']['SessionId']=_0x536fab['id'];if(_0x260b57[_0x296c('0x2f')]['filter']){_0x3acefa[_0x296c('0x38')]=_[_0x296c('0x3c')](_0x3acefa[_0x296c('0x38')],{'$or':_[_0x296c('0x2a')](_0x3acefa[_0x296c('0x31')],function(_0x1fb5e9){var _0x2ded7d={};_0x2ded7d[_0x1fb5e9]={'$like':'%'+_0x260b57[_0x296c('0x2f')][_0x296c('0x3b')]+'%'};return _0x2ded7d;})});}_0x3acefa=_[_0x296c('0x3c')]({},_0x3acefa,_0x260b57[_0x296c('0x3f')]);return db[_0x296c('0x4d')]['count']({'where':_0x3acefa['where']})[_0x296c('0x26')](function(_0x2e563f){_0x254340[_0x296c('0x20')]=_0x2e563f;if(_0x260b57[_0x296c('0x2f')][_0x296c('0x40')]){_0x3acefa['include']=[{'all':!![]}];}return db[_0x296c('0x4d')]['findAll'](_0x3acefa);})[_0x296c('0x26')](function(_0x49786b){_0x254340[_0x296c('0x42')]=_0x49786b;return _0x254340;});}})['then'](respondWithFilteredResult(_0x59e7d7,_0x3acefa))[_0x296c('0x46')](handleError(_0x59e7d7,null));}; \ No newline at end of file +var _0x8c2e=['request-promise','bluebird','mustache','util','to-csv','ejs','fs-extra','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','error','name','send','map','JscriptySessionReport','fieldName','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','destroy','getQuestions','findOne','rawAttributes','SessionId','JscriptyQuestionReport','eml-format','rimraf','zip-dir','fast-json-patch'];(function(_0x22cb5f,_0x2cdd63){var _0x274d36=function(_0x421472){while(--_0x421472){_0x22cb5f['push'](_0x22cb5f['shift']());}};_0x274d36(++_0x2cdd63);}(_0x8c2e,0xec));var _0xe8c2=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8c2e[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xe8c2('0x0'));var rimraf=require(_0xe8c2('0x1'));var zipdir=require(_0xe8c2('0x2'));var jsonpatch=require(_0xe8c2('0x3'));var rp=require(_0xe8c2('0x4'));var moment=require('moment');var BPromise=require(_0xe8c2('0x5'));var Mustache=require(_0xe8c2('0x6'));var util=require(_0xe8c2('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0xe8c2('0x8'));var ejs=require(_0xe8c2('0x9'));var fs=require('fs');var fs_extra=require(_0xe8c2('0xa'));var _=require('lodash');var squel=require(_0xe8c2('0xb'));var crypto=require('crypto');var jsforce=require(_0xe8c2('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xe8c2('0x8'));var querystring=require(_0xe8c2('0xd'));var Papa=require(_0xe8c2('0xe'));var Redis=require(_0xe8c2('0xf'));var authService=require(_0xe8c2('0x10'));var qs=require(_0xe8c2('0x11'));var as=require(_0xe8c2('0x12'));var hardwareService=require(_0xe8c2('0x13'));var logger=require(_0xe8c2('0x14'))('api');var utils=require(_0xe8c2('0x15'));var config=require(_0xe8c2('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xe8c2('0x17'))['db'];function respondWithStatusCode(_0x25c803,_0x5c6e62){_0x5c6e62=_0x5c6e62||0xcc;return function(_0x5321be){if(_0x5321be){return _0x25c803[_0xe8c2('0x18')](_0x5c6e62);}return _0x25c803['status'](_0x5c6e62)[_0xe8c2('0x19')]();};}function respondWithResult(_0x5439b3,_0x43e92d){_0x43e92d=_0x43e92d||0xc8;return function(_0x47d201){if(_0x47d201){return _0x5439b3[_0xe8c2('0x1a')](_0x43e92d)[_0xe8c2('0x1b')](_0x47d201);}};}function respondWithFilteredResult(_0x2c30f8,_0x5319ee){return function(_0x33fc2f){if(_0x33fc2f){var _0x307a4e=typeof _0x5319ee[_0xe8c2('0x1c')]===_0xe8c2('0x1d')&&typeof _0x5319ee['limit']===_0xe8c2('0x1d');var _0x2b308e=_0x33fc2f[_0xe8c2('0x1e')];var _0x362d74=_0x307a4e?0x0:_0x5319ee[_0xe8c2('0x1c')];var _0x36f268=_0x307a4e?_0x33fc2f[_0xe8c2('0x1e')]:_0x5319ee['offset']+_0x5319ee[_0xe8c2('0x1f')];var _0x3fcdb4;if(_0x36f268>=_0x2b308e){_0x36f268=_0x2b308e;_0x3fcdb4=0xc8;}else{_0x3fcdb4=0xce;}_0x2c30f8[_0xe8c2('0x1a')](_0x3fcdb4);return _0x2c30f8[_0xe8c2('0x20')](_0xe8c2('0x21'),_0x362d74+'-'+_0x36f268+'/'+_0x2b308e)[_0xe8c2('0x1b')](_0x33fc2f);}return null;};}function patchUpdates(_0x21aab9){return function(_0x11bd1f){try{jsonpatch[_0xe8c2('0x22')](_0x11bd1f,_0x21aab9,!![]);}catch(_0x87d07){return BPromise[_0xe8c2('0x23')](_0x87d07);}return _0x11bd1f[_0xe8c2('0x24')]();};}function saveUpdates(_0x171b2f,_0xf94310){return function(_0x43dbde){if(_0x43dbde){return _0x43dbde[_0xe8c2('0x25')](_0x171b2f)[_0xe8c2('0x26')](function(_0x1d865e){return _0x1d865e;});}return null;};}function removeEntity(_0x31000d,_0x1dd576){return function(_0x1aca1b){if(_0x1aca1b){return _0x1aca1b['destroy']()[_0xe8c2('0x26')](function(){_0x31000d[_0xe8c2('0x1a')](0xcc)[_0xe8c2('0x19')]();});}};}function handleEntityNotFound(_0x151f75,_0xd08c3){return function(_0x4763b2){if(!_0x4763b2){_0x151f75[_0xe8c2('0x18')](0x194);}return _0x4763b2;};}function handleError(_0xa1ae41,_0x3a8590){_0x3a8590=_0x3a8590||0x1f4;return function(_0x160e29){logger[_0xe8c2('0x27')](_0x160e29['stack']);if(_0x160e29[_0xe8c2('0x28')]){delete _0x160e29[_0xe8c2('0x28')];}_0xa1ae41[_0xe8c2('0x1a')](_0x3a8590)[_0xe8c2('0x29')](_0x160e29);};}exports['index']=function(_0x556f84,_0x378479){var _0x2b9dea={},_0x536c2c={},_0x1e7587={'count':0x0,'rows':[]};var _0x1203cb=_[_0xe8c2('0x2a')](db[_0xe8c2('0x2b')]['rawAttributes'],function(_0x5c99f6){return{'name':_0x5c99f6[_0xe8c2('0x2c')],'type':_0x5c99f6['type'][_0xe8c2('0x2d')]};});_0x536c2c[_0xe8c2('0x2e')]=_['map'](_0x1203cb,'name');_0x536c2c[_0xe8c2('0x2f')]=_[_0xe8c2('0x30')](_0x556f84['query']);_0x536c2c[_0xe8c2('0x31')]=_[_0xe8c2('0x32')](_0x536c2c[_0xe8c2('0x2e')],_0x536c2c[_0xe8c2('0x2f')]);_0x2b9dea['attributes']=_[_0xe8c2('0x32')](_0x536c2c[_0xe8c2('0x2e')],qs[_0xe8c2('0x33')](_0x556f84['query'][_0xe8c2('0x33')]));_0x2b9dea[_0xe8c2('0x34')]=_0x2b9dea[_0xe8c2('0x34')][_0xe8c2('0x35')]?_0x2b9dea[_0xe8c2('0x34')]:_0x536c2c[_0xe8c2('0x2e')];if(!_0x556f84[_0xe8c2('0x2f')][_0xe8c2('0x36')]('nolimit')){_0x2b9dea[_0xe8c2('0x1f')]=qs[_0xe8c2('0x1f')](_0x556f84[_0xe8c2('0x2f')]['limit']);_0x2b9dea[_0xe8c2('0x1c')]=qs[_0xe8c2('0x1c')](_0x556f84[_0xe8c2('0x2f')][_0xe8c2('0x1c')]);}_0x2b9dea[_0xe8c2('0x37')]=qs[_0xe8c2('0x38')](_0x556f84[_0xe8c2('0x2f')]['sort']);_0x2b9dea[_0xe8c2('0x39')]=qs[_0xe8c2('0x31')](_[_0xe8c2('0x3a')](_0x556f84['query'],_0x536c2c[_0xe8c2('0x31')]),_0x1203cb);if(_0x556f84[_0xe8c2('0x2f')][_0xe8c2('0x3b')]){_0x2b9dea['where']=_[_0xe8c2('0x3c')](_0x2b9dea['where'],{'$or':_[_0xe8c2('0x2a')](_0x1203cb,function(_0x4217ea){if(_0x4217ea[_0xe8c2('0x3d')]!==_0xe8c2('0x3e')){var _0x79ea34={};_0x79ea34[_0x4217ea['name']]={'$like':'%'+_0x556f84[_0xe8c2('0x2f')][_0xe8c2('0x3b')]+'%'};return _0x79ea34;}})});}_0x2b9dea=_[_0xe8c2('0x3c')]({},_0x2b9dea,_0x556f84[_0xe8c2('0x3f')]);var _0x377076={'where':_0x2b9dea[_0xe8c2('0x39')]};return db['JscriptySessionReport'][_0xe8c2('0x1e')](_0x377076)[_0xe8c2('0x26')](function(_0xaec800){_0x1e7587[_0xe8c2('0x1e')]=_0xaec800;if(_0x556f84['query'][_0xe8c2('0x40')]){_0x2b9dea[_0xe8c2('0x41')]=[{'all':!![]}];}return db[_0xe8c2('0x2b')][_0xe8c2('0x42')](_0x2b9dea);})[_0xe8c2('0x26')](function(_0x5f13df){_0x1e7587[_0xe8c2('0x43')]=_0x5f13df;return _0x1e7587;})[_0xe8c2('0x26')](respondWithFilteredResult(_0x378479,_0x2b9dea))[_0xe8c2('0x44')](handleError(_0x378479,null));};exports[_0xe8c2('0x45')]=function(_0x3b74e5,_0x39ddc1){var _0x4eccb1={'raw':!![],'where':{'id':_0x3b74e5[_0xe8c2('0x46')]['id']}},_0x10c228={};_0x10c228[_0xe8c2('0x2e')]=_[_0xe8c2('0x30')](db[_0xe8c2('0x2b')]['rawAttributes']);_0x10c228[_0xe8c2('0x2f')]=_[_0xe8c2('0x30')](_0x3b74e5[_0xe8c2('0x2f')]);_0x10c228[_0xe8c2('0x31')]=_['intersection'](_0x10c228[_0xe8c2('0x2e')],_0x10c228[_0xe8c2('0x2f')]);_0x4eccb1[_0xe8c2('0x34')]=_[_0xe8c2('0x32')](_0x10c228[_0xe8c2('0x2e')],qs[_0xe8c2('0x33')](_0x3b74e5[_0xe8c2('0x2f')][_0xe8c2('0x33')]));_0x4eccb1[_0xe8c2('0x34')]=_0x4eccb1[_0xe8c2('0x34')]['length']?_0x4eccb1[_0xe8c2('0x34')]:_0x10c228['model'];if(_0x3b74e5[_0xe8c2('0x2f')][_0xe8c2('0x40')]){_0x4eccb1['include']=[{'all':!![]}];}_0x4eccb1=_[_0xe8c2('0x3c')]({},_0x4eccb1,_0x3b74e5['options']);return db['JscriptySessionReport'][_0xe8c2('0x47')](_0x4eccb1)[_0xe8c2('0x26')](handleEntityNotFound(_0x39ddc1,null))[_0xe8c2('0x26')](respondWithResult(_0x39ddc1,null))['catch'](handleError(_0x39ddc1,null));};exports['create']=function(_0x442a5f,_0x2da42f){return db['JscriptySessionReport'][_0xe8c2('0x48')](_0x442a5f[_0xe8c2('0x49')],{})['then'](respondWithResult(_0x2da42f,0xc9))[_0xe8c2('0x44')](handleError(_0x2da42f,null));};exports[_0xe8c2('0x25')]=function(_0x107022,_0x20ecd9){if(_0x107022[_0xe8c2('0x49')]['id']){delete _0x107022[_0xe8c2('0x49')]['id'];}return db['JscriptySessionReport'][_0xe8c2('0x47')]({'where':{'id':_0x107022[_0xe8c2('0x46')]['id']}})[_0xe8c2('0x26')](handleEntityNotFound(_0x20ecd9,null))['then'](saveUpdates(_0x107022[_0xe8c2('0x49')],null))[_0xe8c2('0x26')](respondWithResult(_0x20ecd9,null))[_0xe8c2('0x44')](handleError(_0x20ecd9,null));};exports[_0xe8c2('0x4a')]=function(_0x1474e5,_0x1d3e3b){return db['JscriptySessionReport'][_0xe8c2('0x47')]({'where':{'id':_0x1474e5[_0xe8c2('0x46')]['id']}})[_0xe8c2('0x26')](handleEntityNotFound(_0x1d3e3b,null))['then'](removeEntity(_0x1d3e3b,null))[_0xe8c2('0x44')](handleError(_0x1d3e3b,null));};exports['describe']=function(_0x403e10,_0x4a3efd){return db['JscriptySessionReport']['describe']()[_0xe8c2('0x26')](respondWithResult(_0x4a3efd,null))[_0xe8c2('0x44')](handleError(_0x4a3efd,null));};exports[_0xe8c2('0x4b')]=function(_0x2511e3,_0x1942f8,_0x77a22c){var _0x35f8d9={'raw':!![],'where':{}};var _0x2ca248={};var _0x3351b1={'count':0x0,'rows':[]};return db[_0xe8c2('0x2b')][_0xe8c2('0x4c')]({'where':{'id':_0x2511e3[_0xe8c2('0x46')]['id']}})[_0xe8c2('0x26')](handleEntityNotFound(_0x1942f8,null))[_0xe8c2('0x26')](function(_0x4bc126){if(_0x4bc126){_0x2ca248[_0xe8c2('0x2e')]=_[_0xe8c2('0x30')](db['JscriptyQuestionReport'][_0xe8c2('0x4d')]);_0x2ca248[_0xe8c2('0x2f')]=_[_0xe8c2('0x30')](_0x2511e3[_0xe8c2('0x2f')]);_0x2ca248['filters']=_[_0xe8c2('0x32')](_0x2ca248[_0xe8c2('0x2e')],_0x2ca248[_0xe8c2('0x2f')]);_0x35f8d9[_0xe8c2('0x34')]=_[_0xe8c2('0x32')](_0x2ca248[_0xe8c2('0x2e')],qs['fields'](_0x2511e3['query'][_0xe8c2('0x33')]));_0x35f8d9[_0xe8c2('0x34')]=_0x35f8d9[_0xe8c2('0x34')][_0xe8c2('0x35')]?_0x35f8d9['attributes']:_0x2ca248[_0xe8c2('0x2e')];if(!_0x2511e3['query'][_0xe8c2('0x36')]('nolimit')){_0x35f8d9[_0xe8c2('0x1f')]=qs['limit'](_0x2511e3[_0xe8c2('0x2f')]['limit']);_0x35f8d9[_0xe8c2('0x1c')]=qs[_0xe8c2('0x1c')](_0x2511e3[_0xe8c2('0x2f')][_0xe8c2('0x1c')]);}_0x35f8d9[_0xe8c2('0x37')]=qs[_0xe8c2('0x38')](_0x2511e3[_0xe8c2('0x2f')][_0xe8c2('0x38')]);_0x35f8d9['where']=qs['filters'](_[_0xe8c2('0x3a')](_0x2511e3[_0xe8c2('0x2f')],_0x2ca248['filters']));_0x35f8d9['where'][_0xe8c2('0x4e')]=_0x4bc126['id'];if(_0x2511e3['query'][_0xe8c2('0x3b')]){_0x35f8d9[_0xe8c2('0x39')]=_[_0xe8c2('0x3c')](_0x35f8d9[_0xe8c2('0x39')],{'$or':_[_0xe8c2('0x2a')](_0x35f8d9[_0xe8c2('0x34')],function(_0x32879b){var _0x506974={};_0x506974[_0x32879b]={'$like':'%'+_0x2511e3[_0xe8c2('0x2f')]['filter']+'%'};return _0x506974;})});}_0x35f8d9=_[_0xe8c2('0x3c')]({},_0x35f8d9,_0x2511e3[_0xe8c2('0x3f')]);return db[_0xe8c2('0x4f')][_0xe8c2('0x1e')]({'where':_0x35f8d9[_0xe8c2('0x39')]})[_0xe8c2('0x26')](function(_0x440705){_0x3351b1['count']=_0x440705;if(_0x2511e3[_0xe8c2('0x2f')][_0xe8c2('0x40')]){_0x35f8d9[_0xe8c2('0x41')]=[{'all':!![]}];}return db[_0xe8c2('0x4f')][_0xe8c2('0x42')](_0x35f8d9);})[_0xe8c2('0x26')](function(_0x3ac0f7){_0x3351b1['rows']=_0x3ac0f7;return _0x3351b1;});}})['then'](respondWithFilteredResult(_0x1942f8,_0x35f8d9))[_0xe8c2('0x44')](handleError(_0x1942f8,null));}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.model.js b/server/api/jscriptySessionReport/jscriptySessionReport.model.js index 22db3af..65b94a2 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 _0xacf4=['define','JscriptySessionReport','report_jscripty_sessions','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./jscriptySessionReport.attributes','exports'];(function(_0x50eab9,_0x1a6d00){var _0x102a2f=function(_0x5af23c){while(--_0x5af23c){_0x50eab9['push'](_0x50eab9['shift']());}};_0x102a2f(++_0x1a6d00);}(_0xacf4,0xe7));var _0x4acf=function(_0x373ba5,_0x21e233){_0x373ba5=_0x373ba5-0x0;var _0xc538f8=_0xacf4[_0x373ba5];return _0xc538f8;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x4acf('0x0'))(_0x4acf('0x1'));var moment=require(_0x4acf('0x2'));var BPromise=require(_0x4acf('0x3'));var rp=require(_0x4acf('0x4'));var fs=require('fs');var path=require(_0x4acf('0x5'));var rimraf=require(_0x4acf('0x6'));var config=require('../../config/environment');var attributes=require(_0x4acf('0x7'));module[_0x4acf('0x8')]=function(_0x4e0c43,_0x24bf24){return _0x4e0c43[_0x4acf('0x9')](_0x4acf('0xa'),attributes,{'tableName':_0x4acf('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc6ac=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./jscriptySessionReport.attributes','exports','JscriptySessionReport','report_jscripty_sessions','lodash','util','../../config/logger'];(function(_0x16dbfd,_0x2f9431){var _0x382254=function(_0x19dade){while(--_0x19dade){_0x16dbfd['push'](_0x16dbfd['shift']());}};_0x382254(++_0x2f9431);}(_0xc6ac,0x15b));var _0xcc6a=function(_0x39b690,_0x27cdf5){_0x39b690=_0x39b690-0x0;var _0x1529a0=_0xc6ac[_0x39b690];return _0x1529a0;};'use strict';var _=require(_0xcc6a('0x0'));var util=require(_0xcc6a('0x1'));var logger=require(_0xcc6a('0x2'))(_0xcc6a('0x3'));var moment=require(_0xcc6a('0x4'));var BPromise=require(_0xcc6a('0x5'));var rp=require(_0xcc6a('0x6'));var fs=require('fs');var path=require(_0xcc6a('0x7'));var rimraf=require(_0xcc6a('0x8'));var config=require(_0xcc6a('0x9'));var attributes=require(_0xcc6a('0xa'));module[_0xcc6a('0xb')]=function(_0x12330e,_0x197bd7){return _0x12330e['define'](_0xcc6a('0xc'),attributes,{'tableName':_0xcc6a('0xd'),'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 4d5e135..327559b 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 _0x7278=['debug','JscriptySessionReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','info','JscriptySessionReport,\x20%s,\x20%s','request\x20sent'];(function(_0x4ab973,_0x3fcad8){var _0x227e1e=function(_0x1a16a1){while(--_0x1a16a1){_0x4ab973['push'](_0x4ab973['shift']());}};_0x227e1e(++_0x3fcad8);}(_0x7278,0x161));var _0x8727=function(_0x2867c5,_0x28d8e6){_0x2867c5=_0x2867c5-0x0;var _0x5c169a=_0x7278[_0x2867c5];return _0x5c169a;};'use strict';var _=require(_0x8727('0x0'));var util=require(_0x8727('0x1'));var moment=require(_0x8727('0x2'));var BPromise=require(_0x8727('0x3'));var rs=require(_0x8727('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8727('0x5'))['db'];var utils=require(_0x8727('0x6'));var logger=require(_0x8727('0x7'))(_0x8727('0x8'));var config=require(_0x8727('0x9'));var jayson=require(_0x8727('0xa'));var client=jayson[_0x8727('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0xfd1902,_0x2f491c,_0xffd783){return new BPromise(function(_0x435911,_0x4160c3){return client['request'](_0xfd1902,_0xffd783)['then'](function(_0x4df6f8){logger[_0x8727('0xc')](_0x8727('0xd'),_0x2f491c,_0x8727('0xe'));logger[_0x8727('0xf')](_0x8727('0x10'),_0x2f491c,_0x8727('0xe'),JSON[_0x8727('0x11')](_0x4df6f8));if(_0x4df6f8[_0x8727('0x12')]){if(_0x4df6f8['error'][_0x8727('0x13')]===0x1f4){logger[_0x8727('0x12')](_0x8727('0xd'),_0x2f491c,_0x4df6f8['error'][_0x8727('0x14')]);return _0x4160c3(_0x4df6f8[_0x8727('0x12')]['message']);}logger[_0x8727('0x12')](_0x8727('0xd'),_0x2f491c,_0x4df6f8[_0x8727('0x12')][_0x8727('0x14')]);return _0x435911(_0x4df6f8[_0x8727('0x12')][_0x8727('0x14')]);}else{logger[_0x8727('0xc')](_0x8727('0xd'),_0x2f491c,_0x8727('0xe'));_0x435911(_0x4df6f8[_0x8727('0x15')]['message']);}})[_0x8727('0x16')](function(_0x1f9538){logger[_0x8727('0x12')](_0x8727('0xd'),_0x2f491c,_0x1f9538);_0x4160c3(_0x1f9538);});});} \ No newline at end of file +var _0xa46e=['request','then','request\x20sent','debug','stringify','error','code','message','JscriptySessionReport,\x20%s,\x20%s','info','result','catch','lodash','util','bluebird','randomstring','ioredis','../../config/utils','rpc','jayson/promise','http'];(function(_0x3c8d6c,_0x51ae3a){var _0x146521=function(_0x4cd1ed){while(--_0x4cd1ed){_0x3c8d6c['push'](_0x3c8d6c['shift']());}};_0x146521(++_0x51ae3a);}(_0xa46e,0x8a));var _0xea46=function(_0x251d9c,_0x580977){_0x251d9c=_0x251d9c-0x0;var _0x16ae64=_0xa46e[_0x251d9c];return _0x16ae64;};'use strict';var _=require(_0xea46('0x0'));var util=require(_0xea46('0x1'));var moment=require('moment');var BPromise=require(_0xea46('0x2'));var rs=require(_0xea46('0x3'));var fs=require('fs');var Redis=require(_0xea46('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xea46('0x5'));var logger=require('../../config/logger')(_0xea46('0x6'));var config=require('../../config/environment');var jayson=require(_0xea46('0x7'));var client=jayson['client'][_0xea46('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3dc26f,_0x5f1cd1,_0x2d1b30){return new BPromise(function(_0x42771a,_0xe7d428){return client[_0xea46('0x9')](_0x3dc26f,_0x2d1b30)[_0xea46('0xa')](function(_0x4cf206){logger['info']('JscriptySessionReport,\x20%s,\x20%s',_0x5f1cd1,_0xea46('0xb'));logger[_0xea46('0xc')]('JscriptySessionReport,\x20%s,\x20%s,\x20%s',_0x5f1cd1,_0xea46('0xb'),JSON[_0xea46('0xd')](_0x4cf206));if(_0x4cf206[_0xea46('0xe')]){if(_0x4cf206['error'][_0xea46('0xf')]===0x1f4){logger[_0xea46('0xe')]('JscriptySessionReport,\x20%s,\x20%s',_0x5f1cd1,_0x4cf206[_0xea46('0xe')][_0xea46('0x10')]);return _0xe7d428(_0x4cf206['error'][_0xea46('0x10')]);}logger['error'](_0xea46('0x11'),_0x5f1cd1,_0x4cf206[_0xea46('0xe')][_0xea46('0x10')]);return _0x42771a(_0x4cf206[_0xea46('0xe')][_0xea46('0x10')]);}else{logger[_0xea46('0x12')](_0xea46('0x11'),_0x5f1cd1,_0xea46('0xb'));_0x42771a(_0x4cf206[_0xea46('0x13')]['message']);}})[_0xea46('0x14')](function(_0xbf225e){logger[_0xea46('0xe')]('JscriptySessionReport,\x20%s,\x20%s',_0x5f1cd1,_0xbf225e);_0xe7d428(_0xbf225e);});});} \ No newline at end of file diff --git a/server/api/license/index.js b/server/api/license/index.js index f53d289..695744c 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 _0x8123=['isAuthenticated','update','/download_log_file','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./license.controller','get','index','put','/:id'];(function(_0x255d5b,_0x4f6f35){var _0x3e141a=function(_0x249ee2){while(--_0x249ee2){_0x255d5b['push'](_0x255d5b['shift']());}};_0x3e141a(++_0x4f6f35);}(_0x8123,0xca));var _0x3812=function(_0x46ae5a,_0x2a38d0){_0x46ae5a=_0x46ae5a-0x0;var _0x434986=_0x8123[_0x46ae5a];return _0x434986;};'use strict';var multer=require(_0x3812('0x0'));var util=require(_0x3812('0x1'));var path=require(_0x3812('0x2'));var timeout=require(_0x3812('0x3'));var express=require(_0x3812('0x4'));var router=express[_0x3812('0x5')]();var fs_extra=require(_0x3812('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x3812('0x7'));var config=require(_0x3812('0x8'));var controller=require(_0x3812('0x9'));router[_0x3812('0xa')]('/',controller[_0x3812('0xb')]);router[_0x3812('0xc')](_0x3812('0xd'),auth[_0x3812('0xe')](),controller[_0x3812('0xf')]);router[_0x3812('0xa')](_0x3812('0x10'),auth[_0x3812('0xe')](),controller['downloadLogFile']);module[_0x3812('0x11')]=router; \ No newline at end of file +var _0x4f10=['./license.controller','get','index','put','/:id','update','/download_log_file','isAuthenticated','exports','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x9bd36c,_0x4d72ca){var _0x4f856b=function(_0x5818d8){while(--_0x5818d8){_0x9bd36c['push'](_0x9bd36c['shift']());}};_0x4f856b(++_0x4d72ca);}(_0x4f10,0x129));var _0x04f1=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x4f10[_0x20a584];return _0x4b41a8;};'use strict';var multer=require('multer');var util=require(_0x04f1('0x0'));var path=require(_0x04f1('0x1'));var timeout=require('connect-timeout');var express=require(_0x04f1('0x2'));var router=express['Router']();var fs_extra=require(_0x04f1('0x3'));var auth=require(_0x04f1('0x4'));var interaction=require(_0x04f1('0x5'));var config=require(_0x04f1('0x6'));var controller=require(_0x04f1('0x7'));router[_0x04f1('0x8')]('/',controller[_0x04f1('0x9')]);router[_0x04f1('0xa')](_0x04f1('0xb'),auth['isAuthenticated'](),controller[_0x04f1('0xc')]);router['get'](_0x04f1('0xd'),auth[_0x04f1('0xe')](),controller['downloadLogFile']);module[_0x04f1('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 71a3db9..0a946e9 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 _0x8faf=['sequelize','exports','TEXT','STRING'];(function(_0x45b413,_0x66d68e){var _0xfd3b91=function(_0x2bc134){while(--_0x2bc134){_0x45b413['push'](_0x45b413['shift']());}};_0xfd3b91(++_0x66d68e);}(_0x8faf,0x1a8));var _0xf8fa=function(_0x1beef3,_0x57c4b8){_0x1beef3=_0x1beef3-0x0;var _0x5af964=_0x8faf[_0x1beef3];return _0x5af964;};'use strict';var Sequelize=require(_0xf8fa('0x0'));module[_0xf8fa('0x1')]={'license':{'type':Sequelize[_0xf8fa('0x2')]},'data1':{'type':Sequelize['STRING']},'data2':{'type':Sequelize[_0xf8fa('0x3')]},'chatLicenseExceeded':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0xfe77=['STRING','INTEGER','sequelize','exports','TEXT'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xfe77,0x6b));var _0x7fe7=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xfe77[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x7fe7('0x0'));module[_0x7fe7('0x1')]={'license':{'type':Sequelize[_0x7fe7('0x2')]},'data1':{'type':Sequelize[_0x7fe7('0x3')]},'data2':{'type':Sequelize[_0x7fe7('0x3')]},'chatLicenseExceeded':{'type':Sequelize[_0x7fe7('0x4')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/license/license.controller.js b/server/api/license/license.controller.js index e0ec93c..8292bac 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 _0x071b=['desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','Content-Range','json','apply','reject','save','then','error','stack','name','index','keys','License','rawAttributes','query','filters','intersection','model','attributes','fields','length','merge','options','getLicense','catch','update','body','find','params','get','checkLicense','key','demo','downloadLogFile','license-info.log','join','/var','log','xcally','setHeader','Content-disposition','set','Content-Type','eml-format','rimraf','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce'];(function(_0x18d5e5,_0x3dbc92){var _0xf55f72=function(_0x58070b){while(--_0x58070b){_0x18d5e5['push'](_0x18d5e5['shift']());}};_0xf55f72(++_0x3dbc92);}(_0x071b,0xce));var _0xb071=function(_0x3ebadb,_0x5d76ba){_0x3ebadb=_0x3ebadb-0x0;var _0x2c034f=_0x071b[_0x3ebadb];return _0x2c034f;};'use strict';var emlformat=require(_0xb071('0x0'));var rimraf=require(_0xb071('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xb071('0x2'));var BPromise=require('bluebird');var Mustache=require(_0xb071('0x3'));var util=require(_0xb071('0x4'));var path=require(_0xb071('0x5'));var sox=require(_0xb071('0x6'));var csv=require(_0xb071('0x7'));var ejs=require(_0xb071('0x8'));var fs=require('fs');var fs_extra=require(_0xb071('0x9'));var _=require('lodash');var squel=require(_0xb071('0xa'));var crypto=require(_0xb071('0xb'));var jsforce=require(_0xb071('0xc'));var deskjs=require(_0xb071('0xd'));var toCsv=require(_0xb071('0x7'));var querystring=require(_0xb071('0xe'));var Papa=require(_0xb071('0xf'));var Redis=require(_0xb071('0x10'));var authService=require(_0xb071('0x11'));var qs=require(_0xb071('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xb071('0x13'))('api');var utils=require(_0xb071('0x14'));var config=require(_0xb071('0x15'));var licenseUtil=require(_0xb071('0x16'));var db=require(_0xb071('0x17'))['db'];function respondWithStatusCode(_0x1899fe,_0x5b26b4){_0x5b26b4=_0x5b26b4||0xcc;return function(_0x59885d){if(_0x59885d){return _0x1899fe[_0xb071('0x18')](_0x5b26b4);}return _0x1899fe[_0xb071('0x19')](_0x5b26b4)[_0xb071('0x1a')]();};}function respondWithResult(_0x103356,_0x304ebb){_0x304ebb=_0x304ebb||0xc8;return function(_0xf8a09){if(_0xf8a09){return _0x103356[_0xb071('0x19')](_0x304ebb)['json'](_0xf8a09);}};}function respondWithFilteredResult(_0xeb245d,_0x478151){return function(_0x4e8a2c){if(_0x4e8a2c){var _0x4b0dd7=typeof _0x478151[_0xb071('0x1b')]===_0xb071('0x1c')&&typeof _0x478151[_0xb071('0x1d')]===_0xb071('0x1c');var _0x599813=_0x4e8a2c[_0xb071('0x1e')];var _0x9e014d=_0x4b0dd7?0x0:_0x478151[_0xb071('0x1b')];var _0x454764=_0x4b0dd7?_0x4e8a2c[_0xb071('0x1e')]:_0x478151[_0xb071('0x1b')]+_0x478151[_0xb071('0x1d')];var _0x3ddb05;if(_0x454764>=_0x599813){_0x454764=_0x599813;_0x3ddb05=0xc8;}else{_0x3ddb05=0xce;}_0xeb245d[_0xb071('0x19')](_0x3ddb05);return _0xeb245d['set'](_0xb071('0x1f'),_0x9e014d+'-'+_0x454764+'/'+_0x599813)[_0xb071('0x20')](_0x4e8a2c);}return null;};}function patchUpdates(_0x34eda2){return function(_0x9a985f){try{jsonpatch[_0xb071('0x21')](_0x9a985f,_0x34eda2,!![]);}catch(_0x2bf12a){return BPromise[_0xb071('0x22')](_0x2bf12a);}return _0x9a985f[_0xb071('0x23')]();};}function saveUpdates(_0xba6006,_0x1cc160){return function(_0x5bc2b2){if(_0x5bc2b2){return _0x5bc2b2['update'](_0xba6006)[_0xb071('0x24')](function(_0x35bb50){return _0x35bb50;});}return null;};}function removeEntity(_0x475c59,_0x1d0795){return function(_0x385fe9){if(_0x385fe9){return _0x385fe9['destroy']()[_0xb071('0x24')](function(){_0x475c59[_0xb071('0x19')](0xcc)[_0xb071('0x1a')]();});}};}function handleEntityNotFound(_0x3a6ad7,_0x298d6d){return function(_0x2ad1dc){if(!_0x2ad1dc){_0x3a6ad7[_0xb071('0x18')](0x194);}return _0x2ad1dc;};}function handleError(_0x3df27c,_0x429b3c){_0x429b3c=_0x429b3c||0x1f4;return function(_0x4c8dcb){logger[_0xb071('0x25')](_0x4c8dcb[_0xb071('0x26')]);if(_0x4c8dcb[_0xb071('0x27')]){delete _0x4c8dcb[_0xb071('0x27')];}_0x3df27c[_0xb071('0x19')](_0x429b3c)['send'](_0x4c8dcb);};}var utilLicense=require('../../config/license/util');exports[_0xb071('0x28')]=function(_0x21fb7f,_0x82cb48){var _0x48c69d={'raw':!![],'where':{'id':0x1}},_0xbc6e5c={};_0xbc6e5c['model']=_[_0xb071('0x29')](db[_0xb071('0x2a')][_0xb071('0x2b')]);_0xbc6e5c[_0xb071('0x2c')]=_['keys'](_0x21fb7f[_0xb071('0x2c')]);_0xbc6e5c[_0xb071('0x2d')]=_[_0xb071('0x2e')](_0xbc6e5c[_0xb071('0x2f')],_0xbc6e5c[_0xb071('0x2c')]);_0x48c69d[_0xb071('0x30')]=_[_0xb071('0x2e')](_0xbc6e5c['model'],qs[_0xb071('0x31')](_0x21fb7f[_0xb071('0x2c')]['fields']));_0x48c69d[_0xb071('0x30')]=_0x48c69d[_0xb071('0x30')][_0xb071('0x32')]?_0x48c69d[_0xb071('0x30')]:_0xbc6e5c[_0xb071('0x2f')];_0x48c69d=_[_0xb071('0x33')]({},_0x48c69d,_0x21fb7f[_0xb071('0x34')]);return utilLicense[_0xb071('0x35')](_0x48c69d)[_0xb071('0x24')](respondWithResult(_0x82cb48,null))[_0xb071('0x36')](handleError(_0x82cb48,null));};exports[_0xb071('0x37')]=function(_0x303676,_0x3808a3){if(_0x303676[_0xb071('0x38')]['id']){delete _0x303676['body']['id'];}return db['License'][_0xb071('0x39')]({'where':{'id':_0x303676[_0xb071('0x3a')]['id']}})['then'](handleEntityNotFound(_0x3808a3,null))[_0xb071('0x24')](function(_0x2cd323){var _0x4bcc5b=_0x2cd323[_0xb071('0x3b')]({'plain':!![]});return utilLicense[_0xb071('0x3c')](_0x4bcc5b,_0x303676[_0xb071('0x38')][_0xb071('0x3d')]);})[_0xb071('0x24')](function(_0x541fc2){if(!_0x541fc2[_0xb071('0x3e')]){return saveUpdates(_0x303676[_0xb071('0x38')],null);}return _0x541fc2;})[_0xb071('0x24')](respondWithResult(_0x3808a3,null))[_0xb071('0x36')](handleError(_0x3808a3,null));};exports[_0xb071('0x3f')]=function(_0x599a66,_0x341580){var _0x4e3784=_0xb071('0x40');var _0x29b83c=path[_0xb071('0x41')](_0xb071('0x42'),_0xb071('0x43'),_0xb071('0x44'),_0x4e3784);_0x341580[_0xb071('0x45')](_0xb071('0x46'),'attachment;\x20filename='+_0x4e3784);_0x341580[_0xb071('0x47')](_0xb071('0x48'),'text/plain');_0x341580['download'](_0x29b83c);}; \ No newline at end of file +var _0xe554=['download','eml-format','zip-dir','moment','mustache','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/utils','../../config/environment','sendStatus','status','end','undefined','limit','count','offset','Content-Range','json','apply','reject','save','update','then','destroy','stack','name','../../config/license/util','index','model','keys','License','rawAttributes','query','filters','attributes','intersection','fields','merge','options','getLicense','catch','body','find','get','demo','downloadLogFile','license-info.log','log','xcally','Content-disposition','Content-Type','text/plain'];(function(_0x5dc1cb,_0x1dd487){var _0x5df13f=function(_0x20a271){while(--_0x20a271){_0x5dc1cb['push'](_0x5dc1cb['shift']());}};_0x5df13f(++_0x1dd487);}(_0xe554,0x150));var _0x4e55=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0xe554[_0x3bf83f];return _0x22c4a9;};'use strict';var emlformat=require(_0x4e55('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x4e55('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x4e55('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x4e55('0x3'));var util=require('util');var path=require('path');var sox=require(_0x4e55('0x4'));var csv=require(_0x4e55('0x5'));var ejs=require(_0x4e55('0x6'));var fs=require('fs');var fs_extra=require(_0x4e55('0x7'));var _=require(_0x4e55('0x8'));var squel=require(_0x4e55('0x9'));var crypto=require(_0x4e55('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x4e55('0xb'));var toCsv=require('to-csv');var querystring=require(_0x4e55('0xc'));var Papa=require(_0x4e55('0xd'));var Redis=require(_0x4e55('0xe'));var authService=require(_0x4e55('0xf'));var qs=require(_0x4e55('0x10'));var as=require(_0x4e55('0x11'));var hardwareService=require(_0x4e55('0x12'));var logger=require(_0x4e55('0x13'))(_0x4e55('0x14'));var utils=require(_0x4e55('0x15'));var config=require(_0x4e55('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x55d10c,_0x4d5c9a){_0x4d5c9a=_0x4d5c9a||0xcc;return function(_0x59d89b){if(_0x59d89b){return _0x55d10c[_0x4e55('0x17')](_0x4d5c9a);}return _0x55d10c[_0x4e55('0x18')](_0x4d5c9a)[_0x4e55('0x19')]();};}function respondWithResult(_0x379e2d,_0x28b1c8){_0x28b1c8=_0x28b1c8||0xc8;return function(_0x1159f1){if(_0x1159f1){return _0x379e2d['status'](_0x28b1c8)['json'](_0x1159f1);}};}function respondWithFilteredResult(_0x109728,_0x2e31b9){return function(_0x1aca01){if(_0x1aca01){var _0x432283=typeof _0x2e31b9['offset']===_0x4e55('0x1a')&&typeof _0x2e31b9[_0x4e55('0x1b')]===_0x4e55('0x1a');var _0x3201c2=_0x1aca01[_0x4e55('0x1c')];var _0x2fc5a3=_0x432283?0x0:_0x2e31b9[_0x4e55('0x1d')];var _0x1cf6ef=_0x432283?_0x1aca01[_0x4e55('0x1c')]:_0x2e31b9[_0x4e55('0x1d')]+_0x2e31b9['limit'];var _0x3e1403;if(_0x1cf6ef>=_0x3201c2){_0x1cf6ef=_0x3201c2;_0x3e1403=0xc8;}else{_0x3e1403=0xce;}_0x109728[_0x4e55('0x18')](_0x3e1403);return _0x109728['set'](_0x4e55('0x1e'),_0x2fc5a3+'-'+_0x1cf6ef+'/'+_0x3201c2)[_0x4e55('0x1f')](_0x1aca01);}return null;};}function patchUpdates(_0x21a9f2){return function(_0x2f74d7){try{jsonpatch[_0x4e55('0x20')](_0x2f74d7,_0x21a9f2,!![]);}catch(_0x18ff56){return BPromise[_0x4e55('0x21')](_0x18ff56);}return _0x2f74d7[_0x4e55('0x22')]();};}function saveUpdates(_0x5918ae,_0x12cefd){return function(_0xe8e473){if(_0xe8e473){return _0xe8e473[_0x4e55('0x23')](_0x5918ae)[_0x4e55('0x24')](function(_0x598515){return _0x598515;});}return null;};}function removeEntity(_0x523fdc,_0x4704e4){return function(_0x335e43){if(_0x335e43){return _0x335e43[_0x4e55('0x25')]()[_0x4e55('0x24')](function(){_0x523fdc['status'](0xcc)[_0x4e55('0x19')]();});}};}function handleEntityNotFound(_0x18ec85,_0x5e7c47){return function(_0x32d3ae){if(!_0x32d3ae){_0x18ec85[_0x4e55('0x17')](0x194);}return _0x32d3ae;};}function handleError(_0x3a19b0,_0xfafb26){_0xfafb26=_0xfafb26||0x1f4;return function(_0x29cbc){logger['error'](_0x29cbc[_0x4e55('0x26')]);if(_0x29cbc[_0x4e55('0x27')]){delete _0x29cbc[_0x4e55('0x27')];}_0x3a19b0[_0x4e55('0x18')](_0xfafb26)['send'](_0x29cbc);};}var utilLicense=require(_0x4e55('0x28'));exports[_0x4e55('0x29')]=function(_0xe34738,_0x1fcb98){var _0x7c931d={'raw':!![],'where':{'id':0x1}},_0x1f818f={};_0x1f818f[_0x4e55('0x2a')]=_[_0x4e55('0x2b')](db[_0x4e55('0x2c')][_0x4e55('0x2d')]);_0x1f818f[_0x4e55('0x2e')]=_[_0x4e55('0x2b')](_0xe34738[_0x4e55('0x2e')]);_0x1f818f[_0x4e55('0x2f')]=_['intersection'](_0x1f818f[_0x4e55('0x2a')],_0x1f818f[_0x4e55('0x2e')]);_0x7c931d[_0x4e55('0x30')]=_[_0x4e55('0x31')](_0x1f818f[_0x4e55('0x2a')],qs[_0x4e55('0x32')](_0xe34738[_0x4e55('0x2e')][_0x4e55('0x32')]));_0x7c931d[_0x4e55('0x30')]=_0x7c931d['attributes']['length']?_0x7c931d[_0x4e55('0x30')]:_0x1f818f[_0x4e55('0x2a')];_0x7c931d=_[_0x4e55('0x33')]({},_0x7c931d,_0xe34738[_0x4e55('0x34')]);return utilLicense[_0x4e55('0x35')](_0x7c931d)[_0x4e55('0x24')](respondWithResult(_0x1fcb98,null))[_0x4e55('0x36')](handleError(_0x1fcb98,null));};exports['update']=function(_0x4f2cc3,_0x24c442){if(_0x4f2cc3[_0x4e55('0x37')]['id']){delete _0x4f2cc3[_0x4e55('0x37')]['id'];}return db['License'][_0x4e55('0x38')]({'where':{'id':_0x4f2cc3['params']['id']}})[_0x4e55('0x24')](handleEntityNotFound(_0x24c442,null))[_0x4e55('0x24')](function(_0x40d0c9){var _0x4d85e0=_0x40d0c9[_0x4e55('0x39')]({'plain':!![]});return utilLicense['checkLicense'](_0x4d85e0,_0x4f2cc3['body']['key']);})['then'](function(_0x37cea4){if(!_0x37cea4[_0x4e55('0x3a')]){return saveUpdates(_0x4f2cc3[_0x4e55('0x37')],null);}return _0x37cea4;})[_0x4e55('0x24')](respondWithResult(_0x24c442,null))['catch'](handleError(_0x24c442,null));};exports[_0x4e55('0x3b')]=function(_0x11e8e9,_0x18df68){var _0x1fd677=_0x4e55('0x3c');var _0x16a907=path['join']('/var',_0x4e55('0x3d'),_0x4e55('0x3e'),_0x1fd677);_0x18df68['setHeader'](_0x4e55('0x3f'),'attachment;\x20filename='+_0x1fd677);_0x18df68['set'](_0x4e55('0x40'),_0x4e55('0x41'));_0x18df68[_0x4e55('0x42')](_0x16a907);}; \ No newline at end of file diff --git a/server/api/license/license.model.js b/server/api/license/license.model.js index 4f6f248..17f46ce 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 _0x5572=['../../config/environment','./license.attributes','define','License','license','lodash','util','api','moment','bluebird','path','rimraf'];(function(_0x534346,_0x5c791e){var _0x16eb9f=function(_0xf109f){while(--_0xf109f){_0x534346['push'](_0x534346['shift']());}};_0x16eb9f(++_0x5c791e);}(_0x5572,0x1c1));var _0x2557=function(_0x25bf53,_0x326183){_0x25bf53=_0x25bf53-0x0;var _0x288b2b=_0x5572[_0x25bf53];return _0x288b2b;};'use strict';var _=require(_0x2557('0x0'));var util=require(_0x2557('0x1'));var logger=require('../../config/logger')(_0x2557('0x2'));var moment=require(_0x2557('0x3'));var BPromise=require(_0x2557('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2557('0x5'));var rimraf=require(_0x2557('0x6'));var config=require(_0x2557('0x7'));var attributes=require(_0x2557('0x8'));module['exports']=function(_0xd92192,_0xddeb02){return _0xd92192[_0x2557('0x9')](_0x2557('0xa'),attributes,{'tableName':_0x2557('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3b79=['path','rimraf','../../config/environment','exports','define','License','license','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x33add6,_0x435ffe){var _0x1d96ec=function(_0xd9d641){while(--_0xd9d641){_0x33add6['push'](_0x33add6['shift']());}};_0x1d96ec(++_0x435ffe);}(_0x3b79,0x1db));var _0x93b7=function(_0x78490b,_0x2c236f){_0x78490b=_0x78490b-0x0;var _0xf4b53b=_0x3b79[_0x78490b];return _0xf4b53b;};'use strict';var _=require('lodash');var util=require(_0x93b7('0x0'));var logger=require(_0x93b7('0x1'))(_0x93b7('0x2'));var moment=require(_0x93b7('0x3'));var BPromise=require(_0x93b7('0x4'));var rp=require(_0x93b7('0x5'));var fs=require('fs');var path=require(_0x93b7('0x6'));var rimraf=require(_0x93b7('0x7'));var config=require(_0x93b7('0x8'));var attributes=require('./license.attributes');module[_0x93b7('0x9')]=function(_0x353d22,_0x79426c){return _0x353d22[_0x93b7('0xa')](_0x93b7('0xb'),attributes,{'tableName':_0x93b7('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/license/license.rpc.js b/server/api/license/license.rpc.js index 62ffa1d..52cd6eb 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 _0xaec6=['code','message','result','catch','lodash','util','moment','bluebird','../../mysqldb','client','request','info','License,\x20%s,\x20%s','request\x20sent','License,\x20%s,\x20%s,\x20%s','error'];(function(_0x178e0b,_0x1b8a7f){var _0x4bb85c=function(_0x178f0f){while(--_0x178f0f){_0x178e0b['push'](_0x178e0b['shift']());}};_0x4bb85c(++_0x1b8a7f);}(_0xaec6,0x1e4));var _0x6aec=function(_0x5ada68,_0x2480dd){_0x5ada68=_0x5ada68-0x0;var _0x2f5fbe=_0xaec6[_0x5ada68];return _0x2f5fbe;};'use strict';var _=require(_0x6aec('0x0'));var util=require(_0x6aec('0x1'));var moment=require(_0x6aec('0x2'));var BPromise=require(_0x6aec('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6aec('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x6aec('0x5')]['http']({'port':0x232a});function respondWithRpcPromise(_0x59e053,_0x2f37e8,_0x2b3c99){return new BPromise(function(_0x4dc6c9,_0x29b3f5){return client[_0x6aec('0x6')](_0x59e053,_0x2b3c99)['then'](function(_0x3516f6){logger[_0x6aec('0x7')](_0x6aec('0x8'),_0x2f37e8,_0x6aec('0x9'));logger['debug'](_0x6aec('0xa'),_0x2f37e8,_0x6aec('0x9'),JSON['stringify'](_0x3516f6));if(_0x3516f6['error']){if(_0x3516f6[_0x6aec('0xb')][_0x6aec('0xc')]===0x1f4){logger[_0x6aec('0xb')](_0x6aec('0x8'),_0x2f37e8,_0x3516f6[_0x6aec('0xb')][_0x6aec('0xd')]);return _0x29b3f5(_0x3516f6[_0x6aec('0xb')][_0x6aec('0xd')]);}logger[_0x6aec('0xb')](_0x6aec('0x8'),_0x2f37e8,_0x3516f6['error'][_0x6aec('0xd')]);return _0x4dc6c9(_0x3516f6[_0x6aec('0xb')][_0x6aec('0xd')]);}else{logger[_0x6aec('0x7')]('License,\x20%s,\x20%s',_0x2f37e8,'request\x20sent');_0x4dc6c9(_0x3516f6[_0x6aec('0xe')][_0x6aec('0xd')]);}})[_0x6aec('0xf')](function(_0x5d6e6b){logger[_0x6aec('0xb')](_0x6aec('0x8'),_0x2f37e8,_0x5d6e6b);_0x29b3f5(_0x5d6e6b);});});} \ No newline at end of file +var _0xb247=['request\x20sent','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','request','then','info','License,\x20%s,\x20%s','debug','License,\x20%s,\x20%s,\x20%s'];(function(_0x2aaba4,_0x55b81c){var _0x263e18=function(_0x2945c4){while(--_0x2945c4){_0x2aaba4['push'](_0x2aaba4['shift']());}};_0x263e18(++_0x55b81c);}(_0xb247,0x1a8));var _0x7b24=function(_0x2e6544,_0x168aef){_0x2e6544=_0x2e6544-0x0;var _0x8dceb5=_0xb247[_0x2e6544];return _0x8dceb5;};'use strict';var _=require(_0x7b24('0x0'));var util=require(_0x7b24('0x1'));var moment=require(_0x7b24('0x2'));var BPromise=require(_0x7b24('0x3'));var rs=require(_0x7b24('0x4'));var fs=require('fs');var Redis=require(_0x7b24('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x7b24('0x6'));var logger=require(_0x7b24('0x7'))(_0x7b24('0x8'));var config=require(_0x7b24('0x9'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x44ea42,_0x5a2f0d,_0x548aab){return new BPromise(function(_0x349a16,_0x313bdc){return client[_0x7b24('0xa')](_0x44ea42,_0x548aab)[_0x7b24('0xb')](function(_0x35a5b7){logger[_0x7b24('0xc')](_0x7b24('0xd'),_0x5a2f0d,'request\x20sent');logger[_0x7b24('0xe')](_0x7b24('0xf'),_0x5a2f0d,_0x7b24('0x10'),JSON[_0x7b24('0x11')](_0x35a5b7));if(_0x35a5b7[_0x7b24('0x12')]){if(_0x35a5b7[_0x7b24('0x12')]['code']===0x1f4){logger[_0x7b24('0x12')]('License,\x20%s,\x20%s',_0x5a2f0d,_0x35a5b7['error']['message']);return _0x313bdc(_0x35a5b7[_0x7b24('0x12')][_0x7b24('0x13')]);}logger[_0x7b24('0x12')]('License,\x20%s,\x20%s',_0x5a2f0d,_0x35a5b7[_0x7b24('0x12')]['message']);return _0x349a16(_0x35a5b7[_0x7b24('0x12')][_0x7b24('0x13')]);}else{logger[_0x7b24('0xc')](_0x7b24('0xd'),_0x5a2f0d,_0x7b24('0x10'));_0x349a16(_0x35a5b7[_0x7b24('0x14')][_0x7b24('0x13')]);}})[_0x7b24('0x15')](function(_0x218349){logger[_0x7b24('0x12')](_0x7b24('0xd'),_0x5a2f0d,_0x218349);_0x313bdc(_0x218349);});});} \ No newline at end of file diff --git a/server/api/mailAccount/index.js b/server/api/mailAccount/index.js index 546cf4b..481ece8 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 _0x1f15=['/:id','show','/:id/dispositions','getAnswers','/:id/in_servers','getImap','/:id/out_servers','/:id/interactions','getInteractions','/:id/applications','getApplications','/:id/messages','getMessages','/:id/verify','verifySmtp','/:id/users','getAgents','post','addDisposition','/:id/canned_answers','addAnswer','addSmtp','/:id/send','send','addAgents','put','removeDispositions','removeAnswers','delete','removeSmtp','destroy','removeAgents','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailAccount.controller','index','/describe','isAuthenticated','describe','get'];(function(_0x1b0f15,_0x271b0f){var _0x30f9dd=function(_0x47eba7){while(--_0x47eba7){_0x1b0f15['push'](_0x1b0f15['shift']());}};_0x30f9dd(++_0x271b0f);}(_0x1f15,0x81));var _0x51f1=function(_0x2391cf,_0x3589d5){_0x2391cf=_0x2391cf-0x0;var _0x1f0525=_0x1f15[_0x2391cf];return _0x1f0525;};'use strict';var multer=require(_0x51f1('0x0'));var util=require(_0x51f1('0x1'));var path=require('path');var timeout=require(_0x51f1('0x2'));var express=require(_0x51f1('0x3'));var router=express[_0x51f1('0x4')]();var fs_extra=require(_0x51f1('0x5'));var auth=require(_0x51f1('0x6'));var interaction=require(_0x51f1('0x7'));var config=require(_0x51f1('0x8'));var controller=require(_0x51f1('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0x51f1('0xa')]);router['get'](_0x51f1('0xb'),auth[_0x51f1('0xc')](),controller[_0x51f1('0xd')]);router[_0x51f1('0xe')](_0x51f1('0xf'),auth[_0x51f1('0xc')](),controller[_0x51f1('0x10')]);router['get'](_0x51f1('0x11'),auth[_0x51f1('0xc')](),controller['getDispositions']);router['get']('/:id/canned_answers',auth['isAuthenticated'](),controller[_0x51f1('0x12')]);router['get'](_0x51f1('0x13'),auth['isAuthenticated'](),controller[_0x51f1('0x14')]);router[_0x51f1('0xe')](_0x51f1('0x15'),auth[_0x51f1('0xc')](),controller['getSmtp']);router[_0x51f1('0xe')](_0x51f1('0x16'),auth[_0x51f1('0xc')](),controller[_0x51f1('0x17')]);router['get'](_0x51f1('0x18'),auth[_0x51f1('0xc')](),controller[_0x51f1('0x19')]);router[_0x51f1('0xe')](_0x51f1('0x1a'),auth[_0x51f1('0xc')](),controller[_0x51f1('0x1b')]);router['get'](_0x51f1('0x1c'),auth[_0x51f1('0xc')](),controller[_0x51f1('0x1d')]);router[_0x51f1('0xe')](_0x51f1('0x1e'),auth[_0x51f1('0xc')](),controller[_0x51f1('0x1f')]);router[_0x51f1('0x20')](_0x51f1('0x11'),auth[_0x51f1('0xc')](),controller[_0x51f1('0x21')]);router[_0x51f1('0x20')](_0x51f1('0x22'),auth[_0x51f1('0xc')](),controller[_0x51f1('0x23')]);router[_0x51f1('0x20')]('/',auth[_0x51f1('0xc')](),controller['create']);router[_0x51f1('0x20')](_0x51f1('0x13'),auth[_0x51f1('0xc')](),controller['addImap']);router['post'](_0x51f1('0x15'),auth[_0x51f1('0xc')](),controller[_0x51f1('0x24')]);router['post'](_0x51f1('0x16'),auth[_0x51f1('0xc')](),controller['addInteraction']);router[_0x51f1('0x20')](_0x51f1('0x18'),auth[_0x51f1('0xc')](),controller['addApplications']);router[_0x51f1('0x20')](_0x51f1('0x25'),auth[_0x51f1('0xc')](),controller[_0x51f1('0x26')]);router['post'](_0x51f1('0x1e'),auth[_0x51f1('0xc')](),controller[_0x51f1('0x27')]);router[_0x51f1('0x28')](_0x51f1('0xf'),auth[_0x51f1('0xc')](),controller['update']);router['delete']('/:id/dispositions',auth[_0x51f1('0xc')](),controller[_0x51f1('0x29')]);router['delete']('/:id/canned_answers',auth[_0x51f1('0xc')](),controller[_0x51f1('0x2a')]);router['delete'](_0x51f1('0x13'),auth[_0x51f1('0xc')](),controller['removeImap']);router[_0x51f1('0x2b')](_0x51f1('0x15'),auth[_0x51f1('0xc')](),controller[_0x51f1('0x2c')]);router['delete'](_0x51f1('0xf'),auth['isAuthenticated'](),controller[_0x51f1('0x2d')]);router[_0x51f1('0x2b')]('/:id/users',auth[_0x51f1('0xc')](),controller[_0x51f1('0x2e')]);module[_0x51f1('0x2f')]=router; \ No newline at end of file +var _0x7d79=['getAnswers','getImap','getSmtp','/:id/interactions','getInteractions','/:id/applications','/:id/verify','/:id/users','getAgents','post','addAnswer','create','addImap','/:id/out_servers','addInteraction','addApplications','/:id/send','addAgents','put','update','removeDispositions','delete','removeAnswers','/:id/in_servers','removeImap','removeSmtp','destroy','removeAgents','exports','multer','util','path','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','/describe','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers'];(function(_0x1a3c37,_0x36504a){var _0x285fd6=function(_0x26454f){while(--_0x26454f){_0x1a3c37['push'](_0x1a3c37['shift']());}};_0x285fd6(++_0x36504a);}(_0x7d79,0x75));var _0x97d7=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x7d79[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require(_0x97d7('0x0'));var util=require(_0x97d7('0x1'));var path=require(_0x97d7('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x97d7('0x3'));var auth=require(_0x97d7('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x97d7('0x5'));var controller=require('./mailAccount.controller');router[_0x97d7('0x6')]('/',auth[_0x97d7('0x7')](),controller['index']);router[_0x97d7('0x6')](_0x97d7('0x8'),auth[_0x97d7('0x7')](),controller[_0x97d7('0x9')]);router[_0x97d7('0x6')](_0x97d7('0xa'),auth['isAuthenticated'](),controller[_0x97d7('0xb')]);router['get'](_0x97d7('0xc'),auth[_0x97d7('0x7')](),controller[_0x97d7('0xd')]);router[_0x97d7('0x6')](_0x97d7('0xe'),auth[_0x97d7('0x7')](),controller[_0x97d7('0xf')]);router[_0x97d7('0x6')]('/:id/in_servers',auth[_0x97d7('0x7')](),controller[_0x97d7('0x10')]);router[_0x97d7('0x6')]('/:id/out_servers',auth[_0x97d7('0x7')](),controller[_0x97d7('0x11')]);router[_0x97d7('0x6')](_0x97d7('0x12'),auth[_0x97d7('0x7')](),controller[_0x97d7('0x13')]);router[_0x97d7('0x6')](_0x97d7('0x14'),auth[_0x97d7('0x7')](),controller['getApplications']);router[_0x97d7('0x6')]('/:id/messages',auth[_0x97d7('0x7')](),controller['getMessages']);router[_0x97d7('0x6')](_0x97d7('0x15'),auth[_0x97d7('0x7')](),controller['verifySmtp']);router[_0x97d7('0x6')](_0x97d7('0x16'),auth[_0x97d7('0x7')](),controller[_0x97d7('0x17')]);router[_0x97d7('0x18')](_0x97d7('0xc'),auth[_0x97d7('0x7')](),controller['addDisposition']);router['post'](_0x97d7('0xe'),auth[_0x97d7('0x7')](),controller[_0x97d7('0x19')]);router[_0x97d7('0x18')]('/',auth[_0x97d7('0x7')](),controller[_0x97d7('0x1a')]);router[_0x97d7('0x18')]('/:id/in_servers',auth[_0x97d7('0x7')](),controller[_0x97d7('0x1b')]);router[_0x97d7('0x18')](_0x97d7('0x1c'),auth[_0x97d7('0x7')](),controller['addSmtp']);router['post'](_0x97d7('0x12'),auth[_0x97d7('0x7')](),controller[_0x97d7('0x1d')]);router[_0x97d7('0x18')]('/:id/applications',auth[_0x97d7('0x7')](),controller[_0x97d7('0x1e')]);router[_0x97d7('0x18')](_0x97d7('0x1f'),auth[_0x97d7('0x7')](),controller['send']);router[_0x97d7('0x18')](_0x97d7('0x16'),auth['isAuthenticated'](),controller[_0x97d7('0x20')]);router[_0x97d7('0x21')](_0x97d7('0xa'),auth[_0x97d7('0x7')](),controller[_0x97d7('0x22')]);router['delete'](_0x97d7('0xc'),auth[_0x97d7('0x7')](),controller[_0x97d7('0x23')]);router[_0x97d7('0x24')](_0x97d7('0xe'),auth[_0x97d7('0x7')](),controller[_0x97d7('0x25')]);router[_0x97d7('0x24')](_0x97d7('0x26'),auth[_0x97d7('0x7')](),controller[_0x97d7('0x27')]);router[_0x97d7('0x24')]('/:id/out_servers',auth[_0x97d7('0x7')](),controller[_0x97d7('0x28')]);router[_0x97d7('0x24')]('/:id',auth[_0x97d7('0x7')](),controller[_0x97d7('0x29')]);router[_0x97d7('0x24')](_0x97d7('0x16'),auth[_0x97d7('0x7')](),controller[_0x97d7('0x2a')]);module[_0x97d7('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 37cc25d..1dfc4ed 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 _0xf45d=['getDataValue','provider','sequelize','STRING','BOOLEAN','TEXT','INTEGER','UNSIGNED','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','ENUM','gmail','yahoo'];(function(_0x3c496b,_0x3ad218){var _0x1490f6=function(_0x161d4e){while(--_0x161d4e){_0x3c496b['push'](_0x3c496b['shift']());}};_0x1490f6(++_0x3ad218);}(_0xf45d,0x19a));var _0xdf45=function(_0x1cadf8,_0x44039d){_0x1cadf8=_0x1cadf8-0x0;var _0x67b514=_0xf45d[_0x1cadf8];return _0x67b514;};'use strict';var Sequelize=require(_0xdf45('0x0'));module['exports']={'description':{'type':Sequelize[_0xdf45('0x1')]},'name':{'type':Sequelize[_0xdf45('0x1')],'allowNull':![]},'service':{'type':Sequelize[_0xdf45('0x2')],'defaultValue':![]},'email':{'type':Sequelize[_0xdf45('0x1')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0xdf45('0x2')],'defaultValue':!![]},'key':{'type':Sequelize[_0xdf45('0x1')],'allowNull':![]},'template':{'type':Sequelize[_0xdf45('0x3')]},'markAsUnread':{'type':Sequelize[_0xdf45('0x2')],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0xdf45('0x1')],'allowNull':![],'defaultValue':'Arial,Helvetica,sans-serif'},'fontSize':{'type':Sequelize[_0xdf45('0x4')](0x2)[_0xdf45('0x5')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0xdf45('0x3')],'defaultValue':function(){return _0xdf45('0x6');}},'notificationSound':{'type':Sequelize[_0xdf45('0x2')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xdf45('0x2')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xdf45('0x4')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xdf45('0x2')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xdf45('0x2')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xdf45('0x4')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xdf45('0x4')],'allowNull':!![],'defaultValue':null,'comment':_0xdf45('0x7')},'mandatoryDisposition':{'type':Sequelize[_0xdf45('0x2')],'defaultValue':![],'comment':_0xdf45('0x8'),'set':function(_0x51efe9){if(!_0x51efe9)this[_0xdf45('0x9')](_0xdf45('0xa'),null);this[_0xdf45('0x9')](_0xdf45('0xb'),_0x51efe9);}},'provider':{'type':Sequelize[_0xdf45('0xc')](_0xdf45('0xd'),'hotmail',_0xdf45('0xe'),'outlook365'),'defaultValue':null,'get':function(){if(!this[_0xdf45('0xf')](_0xdf45('0x10')))return'custom';return this[_0xdf45('0xf')](_0xdf45('0x10'));},'set':function(_0x12fd58){if(_0x12fd58==='custom')_0x12fd58=null;return this[_0xdf45('0x9')](_0xdf45('0x10'),_0x12fd58);}}}; \ No newline at end of file +var _0x1277=['provider','exports','STRING','BOOLEAN','TEXT','Arial,Helvetica,sans-serif','INTEGER','UNSIGNED','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','ENUM','gmail','hotmail','yahoo','getDataValue','custom'];(function(_0x2aae09,_0x1a0169){var _0x2e8d72=function(_0x25f7cd){while(--_0x25f7cd){_0x2aae09['push'](_0x2aae09['shift']());}};_0x2e8d72(++_0x1a0169);}(_0x1277,0x7f));var _0x7127=function(_0x35294e,_0x11a9e8){_0x35294e=_0x35294e-0x0;var _0x2de2ba=_0x1277[_0x35294e];return _0x2de2ba;};'use strict';var Sequelize=require('sequelize');module[_0x7127('0x0')]={'description':{'type':Sequelize[_0x7127('0x1')]},'name':{'type':Sequelize[_0x7127('0x1')],'allowNull':![]},'service':{'type':Sequelize[_0x7127('0x2')],'defaultValue':![]},'email':{'type':Sequelize[_0x7127('0x1')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0x7127('0x2')],'defaultValue':!![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'template':{'type':Sequelize[_0x7127('0x3')]},'markAsUnread':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0x7127('0x1')],'allowNull':![],'defaultValue':_0x7127('0x4')},'fontSize':{'type':Sequelize[_0x7127('0x5')](0x2)[_0x7127('0x6')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0x7127('0x3')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}';}},'notificationSound':{'type':Sequelize[_0x7127('0x2')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x7127('0x2')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x7127('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x7127('0x2')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x7127('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x7127('0x2')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x7127('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x7127('0x5')],'allowNull':!![],'defaultValue':null,'comment':_0x7127('0x7')},'mandatoryDisposition':{'type':Sequelize[_0x7127('0x2')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x3d439e){if(!_0x3d439e)this[_0x7127('0x8')](_0x7127('0x9'),null);this[_0x7127('0x8')](_0x7127('0xa'),_0x3d439e);}},'provider':{'type':Sequelize[_0x7127('0xb')](_0x7127('0xc'),_0x7127('0xd'),_0x7127('0xe'),'outlook365'),'defaultValue':null,'get':function(){if(!this[_0x7127('0xf')]('provider'))return _0x7127('0x10');return this[_0x7127('0xf')](_0x7127('0x11'));},'set':function(_0x2a69ac){if(_0x2a69ac===_0x7127('0x10'))_0x2a69ac=null;return this[_0x7127('0x8')](_0x7127('0x11'),_0x2a69ac);}}}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.controller.js b/server/api/mailAccount/mailAccount.controller.js index 35e9af5..73b92c7 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 _0x9736=['addAgents','omit','spread','userMailAccount:save','removeAgents','isArray','emit','userMailAccount:remove','getAgents','User','moment','bluebird','util','path','lodash','juice','../../components/parsers/qs','../../config/logger','api','../../config/environment','redis','defaults','localhost','socket.io-emitter','./mailAccount.socket','jayson/promise','client','http','request','info','MailAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','sendStatus','status','end','json','undefined','limit','count','offset','set','update','destroy','then','get','MailAccounts','UserProfileResource','stack','name','send','index','Imap','MailServerOut','mandatoryDispositionPause','map','rawAttributes','type','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','filters','filter','where','merge','VIRTUAL','MailAccount','include','findAll','rows','params','MailServerIn','Pause','options','body','modernAuthentication','CloudProviderId','Smtp','describe','addDisposition','find','create','getDispositions','Disposition','MailAccountId','includeAll','removeDispositions','ids','addAnswer','findOne','CannedAnswer','order','pick','removeAnswers','provider','custom','email','ListId','active','description','user','username','password','pass','service','host','port','authentication','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','addImap','setImap','getSmtp','addSmtp','removeSmtp','setSmtp','addInteraction','getInteractions','MailInteraction','CmContact','Contact','Owner','fullname','Tags','color','tag','addApplications','sequelize','transaction','READ_COMMITTED','MailApplication','bulkCreate','findAndCountAll','finally','getApplications','getMessages','MailMessage','$gte','split','YYYY-MM-DD\x20HH:mm:ss','inlineCss','true','CmList','List','updatedAt','DESC','isNil','from','format','attachments','join','root','secure','auth','sendMail','Contacts','List\x20not\x20found','messageId','out','Interaction','verifySmtp','CloudProvider','data5','VerifySmtp','Sequelize','ValidationError','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account'];(function(_0x5036b8,_0x5de6c2){var _0x31b34d=function(_0x47457b){while(--_0x47457b){_0x5036b8['push'](_0x5036b8['shift']());}};_0x31b34d(++_0x5de6c2);}(_0x9736,0xc3));var _0x6973=function(_0x39b3d8,_0x5548f5){_0x39b3d8=_0x39b3d8-0x0;var _0x5dfed7=_0x9736[_0x39b3d8];return _0x5dfed7;};'use strict';var moment=require(_0x6973('0x0'));var BPromise=require(_0x6973('0x1'));var util=require(_0x6973('0x2'));var path=require(_0x6973('0x3'));var _=require(_0x6973('0x4'));var juice=require(_0x6973('0x5'));var Redis=require('ioredis');var qs=require(_0x6973('0x6'));var logger=require(_0x6973('0x7'))(_0x6973('0x8'));var config=require(_0x6973('0x9'));var db=require('../../mysqldb')['db'];config[_0x6973('0xa')]=_[_0x6973('0xb')](config[_0x6973('0xa')],{'host':_0x6973('0xc'),'port':0x18eb});var socket=require(_0x6973('0xd'))(new Redis(config[_0x6973('0xa')]));require(_0x6973('0xe'))['register'](socket);var jayson=require(_0x6973('0xf'));var client=jayson[_0x6973('0x10')][_0x6973('0x11')]({'port':0x232b});function respondWithRpcPromise(_0xff1b51,_0x56e57f,_0xa4e9cd,_0x41ae4d){return new BPromise(function(_0x292d31,_0x3a858e){var _0x515650=_0x41ae4d||client;return _0x515650[_0x6973('0x12')](_0xff1b51,_0xa4e9cd)['then'](function(_0x10de0d){logger[_0x6973('0x13')](_0x6973('0x14'),_0x56e57f,_0x6973('0x15'));logger[_0x6973('0x16')]('MailAccount,\x20%s,\x20%s,\x20%s',_0x56e57f,_0x6973('0x15'),JSON[_0x6973('0x17')](_0x10de0d));if(_0x10de0d[_0x6973('0x18')]){if(_0x10de0d[_0x6973('0x18')][_0x6973('0x19')]===0x1f4){logger[_0x6973('0x18')]('MailAccount,\x20%s,\x20%s',_0x56e57f,_0x10de0d[_0x6973('0x18')][_0x6973('0x1a')]);return _0x3a858e(_0x10de0d[_0x6973('0x18')][_0x6973('0x1a')]);}logger[_0x6973('0x18')](_0x6973('0x14'),_0x56e57f,_0x10de0d['error'][_0x6973('0x1a')]);return _0x292d31(_0x10de0d[_0x6973('0x18')][_0x6973('0x1a')]);}else{logger[_0x6973('0x13')](_0x6973('0x14'),_0x56e57f,'request\x20sent');_0x292d31(_0x10de0d[_0x6973('0x1b')][_0x6973('0x1a')]);}})[_0x6973('0x1c')](function(_0x4f1f36){logger[_0x6973('0x18')](_0x6973('0x14'),_0x56e57f,_0x4f1f36);_0x3a858e(_0x4f1f36);});});}function respondWithStatusCode(_0x2d4365,_0x585714){_0x585714=_0x585714||0xcc;return function(_0x56444a){if(_0x56444a){return _0x2d4365[_0x6973('0x1d')](_0x585714);}return _0x2d4365[_0x6973('0x1e')](_0x585714)[_0x6973('0x1f')]();};}function respondWithResult(_0x23484e,_0x593fb2){_0x593fb2=_0x593fb2||0xc8;return function(_0x211f34){if(_0x211f34){return _0x23484e['status'](_0x593fb2)[_0x6973('0x20')](_0x211f34);}};}function respondWithFilteredResult(_0x3c558c,_0x5a307d){return function(_0xbc8fb){if(_0xbc8fb){var _0x22520f=typeof _0x5a307d['offset']===_0x6973('0x21')&&typeof _0x5a307d[_0x6973('0x22')]===_0x6973('0x21');var _0x38c793=_0xbc8fb[_0x6973('0x23')];var _0x30623b=_0x22520f?0x0:_0x5a307d[_0x6973('0x24')];var _0xaa5e12=_0x22520f?_0xbc8fb[_0x6973('0x23')]:_0x5a307d['offset']+_0x5a307d[_0x6973('0x22')];var _0x411acc;if(_0xaa5e12>=_0x38c793){_0xaa5e12=_0x38c793;_0x411acc=0xc8;}else{_0x411acc=0xce;}_0x3c558c['status'](_0x411acc);return _0x3c558c[_0x6973('0x25')]('Content-Range',_0x30623b+'-'+_0xaa5e12+'/'+_0x38c793)['json'](_0xbc8fb);}return null;};}function saveUpdates(_0x1774fe){return function(_0x18f211){if(_0x18f211){return _0x18f211[_0x6973('0x26')](_0x1774fe)['then'](function(_0xfaea61){return _0xfaea61;});}return null;};}function removeEntity(_0x71b63b){return function(_0xbba81e){if(_0xbba81e){return _0xbba81e[_0x6973('0x27')]()[_0x6973('0x28')](function(){var _0x51183c=_0xbba81e[_0x6973('0x29')]({'plain':!![]});var _0x1e71d2=_0x6973('0x2a');return db[_0x6973('0x2b')]['destroy']({'where':{'type':_0x1e71d2,'resourceId':_0x51183c['id']}})[_0x6973('0x28')](function(){return _0xbba81e;});})[_0x6973('0x28')](function(){_0x71b63b[_0x6973('0x1e')](0xcc)[_0x6973('0x1f')]();});}};}function handleEntityNotFound(_0x2579f9){return function(_0x50679e){if(!_0x50679e){_0x2579f9['sendStatus'](0x194);}return _0x50679e;};}function handleError(_0x2ab07c,_0xb6009d){_0xb6009d=_0xb6009d||0x1f4;return function(_0x1a3ffc){logger[_0x6973('0x18')](_0x1a3ffc[_0x6973('0x2c')]);if(_0x1a3ffc[_0x6973('0x2d')]){delete _0x1a3ffc[_0x6973('0x2d')];}_0x2ab07c[_0x6973('0x1e')](_0xb6009d)[_0x6973('0x2e')](_0x1a3ffc);};}exports[_0x6973('0x2f')]=function(_0xc6964c,_0x45bddb){var _0xb1c4ed={'include':[{'model':db['MailServerIn'],'as':_0x6973('0x30')},{'model':db[_0x6973('0x31')],'as':'Smtp'},{'model':db['Pause'],'as':_0x6973('0x32')}]},_0x21c836={},_0x219187={'count':0x0,'rows':[]};var _0x4f64ff=_[_0x6973('0x33')](db['MailAccount'][_0x6973('0x34')],function(_0x282222){return{'name':_0x282222['fieldName'],'type':_0x282222[_0x6973('0x35')][_0x6973('0x36')]};});_0x21c836[_0x6973('0x37')]=_[_0x6973('0x33')](_0x4f64ff,'name');_0x21c836[_0x6973('0x38')]=_[_0x6973('0x39')](_0xc6964c['query']);_0x21c836['filters']=_[_0x6973('0x3a')](_0x21c836['model'],_0x21c836['query']);_0xb1c4ed['attributes']=_['intersection'](_0x21c836[_0x6973('0x37')],qs['fields'](_0xc6964c[_0x6973('0x38')][_0x6973('0x3b')]));_0xb1c4ed[_0x6973('0x3c')]=_0xb1c4ed['attributes'][_0x6973('0x3d')]?_0xb1c4ed[_0x6973('0x3c')]:_0x21c836[_0x6973('0x37')];if(!_0xc6964c['query'][_0x6973('0x3e')](_0x6973('0x3f'))){_0xb1c4ed[_0x6973('0x22')]=qs[_0x6973('0x22')](_0xc6964c[_0x6973('0x38')][_0x6973('0x22')]);_0xb1c4ed[_0x6973('0x24')]=qs['offset'](_0xc6964c[_0x6973('0x38')][_0x6973('0x24')]);}_0xb1c4ed['order']=qs[_0x6973('0x40')](_0xc6964c[_0x6973('0x38')][_0x6973('0x40')]);_0xb1c4ed['where']=qs[_0x6973('0x41')](_['pick'](_0xc6964c[_0x6973('0x38')],_0x21c836[_0x6973('0x41')]),_0x4f64ff);if(_0xc6964c[_0x6973('0x38')][_0x6973('0x42')]){_0xb1c4ed[_0x6973('0x43')]=_[_0x6973('0x44')](_0xb1c4ed[_0x6973('0x43')],{'$or':_[_0x6973('0x33')](_0x4f64ff,function(_0x5e0e99){if(_0x5e0e99[_0x6973('0x35')]!==_0x6973('0x45')){var _0x2c6e3c={};_0x2c6e3c[_0x5e0e99[_0x6973('0x2d')]]={'$like':'%'+_0xc6964c[_0x6973('0x38')][_0x6973('0x42')]+'%'};return _0x2c6e3c;}})});}_0xb1c4ed=_[_0x6973('0x44')]({},_0xb1c4ed,_0xc6964c['options']);var _0x5113cd={'where':_0xb1c4ed[_0x6973('0x43')]};return db[_0x6973('0x46')][_0x6973('0x23')](_0x5113cd)[_0x6973('0x28')](function(_0x4da7d7){_0x219187['count']=_0x4da7d7;if(_0xc6964c[_0x6973('0x38')]['includeAll']){_0xb1c4ed[_0x6973('0x47')]=[{'all':!![]}];}return db[_0x6973('0x46')][_0x6973('0x48')](_0xb1c4ed);})[_0x6973('0x28')](function(_0x508265){_0x219187[_0x6973('0x49')]=_0x508265;return _0x219187;})[_0x6973('0x28')](respondWithFilteredResult(_0x45bddb,_0xb1c4ed))[_0x6973('0x1c')](handleError(_0x45bddb,null));};exports['show']=function(_0x370420,_0x304c2a){var _0x2935e1={'raw':![],'where':{'id':_0x370420[_0x6973('0x4a')]['id']},'include':[{'model':db[_0x6973('0x4b')],'as':'Imap'},{'model':db[_0x6973('0x31')],'as':'Smtp'},{'model':db[_0x6973('0x4c')],'as':'mandatoryDispositionPause'}]},_0xab162f={};_0xab162f['model']=_[_0x6973('0x39')](db[_0x6973('0x46')][_0x6973('0x34')]);_0xab162f['query']=_[_0x6973('0x39')](_0x370420[_0x6973('0x38')]);_0xab162f[_0x6973('0x41')]=_[_0x6973('0x3a')](_0xab162f['model'],_0xab162f['query']);_0x2935e1[_0x6973('0x3c')]=_[_0x6973('0x3a')](_0xab162f[_0x6973('0x37')],qs[_0x6973('0x3b')](_0x370420['query'][_0x6973('0x3b')]));_0x2935e1[_0x6973('0x3c')]=_0x2935e1[_0x6973('0x3c')][_0x6973('0x3d')]?_0x2935e1[_0x6973('0x3c')]:_0xab162f['model'];if(_0x370420[_0x6973('0x38')]['includeAll']){_0x2935e1[_0x6973('0x47')]=[{'all':!![]}];}_0x2935e1=_[_0x6973('0x44')]({},_0x2935e1,_0x370420[_0x6973('0x4d')]);return db['MailAccount']['find'](_0x2935e1)[_0x6973('0x28')](handleEntityNotFound(_0x304c2a,null))[_0x6973('0x28')](respondWithResult(_0x304c2a,null))[_0x6973('0x1c')](handleError(_0x304c2a,null));};exports[_0x6973('0x26')]=function(_0x4bbc9e,_0x3e39db){if(_0x4bbc9e[_0x6973('0x4e')]['id']){delete _0x4bbc9e[_0x6973('0x4e')]['id'];}if(_0x4bbc9e[_0x6973('0x4e')][_0x6973('0x30')]){if(!_0x4bbc9e[_0x6973('0x4e')][_0x6973('0x30')][_0x6973('0x4f')]){_0x4bbc9e['body'][_0x6973('0x30')][_0x6973('0x50')]=null;}}if(_0x4bbc9e[_0x6973('0x4e')]['Smtp']){if(!_0x4bbc9e[_0x6973('0x4e')]['Smtp'][_0x6973('0x4f')]){_0x4bbc9e[_0x6973('0x4e')][_0x6973('0x51')]['CloudProviderId']=null;}}return db[_0x6973('0x46')]['find']({'where':{'id':_0x4bbc9e['params']['id']},'include':[{'model':db[_0x6973('0x4b')],'as':'Imap'},{'model':db['MailServerOut'],'as':_0x6973('0x51')},{'model':db[_0x6973('0x4c')],'as':_0x6973('0x32')}]})[_0x6973('0x28')](handleEntityNotFound(_0x3e39db,null))['then'](saveUpdates(_0x4bbc9e[_0x6973('0x4e')],null))[_0x6973('0x28')](function(_0x565c74){if(_0x565c74&&_0x4bbc9e['body']['Imap']){return db['MailServerIn'][_0x6973('0x26')](_0x4bbc9e['body']['Imap'],{'where':{'MailAccountId':_0x565c74['id']}})[_0x6973('0x28')](function(){return _0x565c74;});}return _0x565c74;})[_0x6973('0x28')](function(_0x1aa99e){if(_0x1aa99e&&_0x4bbc9e['body']['Smtp']){return db[_0x6973('0x31')][_0x6973('0x26')](_0x4bbc9e[_0x6973('0x4e')][_0x6973('0x51')],{'where':{'MailAccountId':_0x1aa99e['id']}})[_0x6973('0x28')](function(){return _0x1aa99e;});}return _0x1aa99e;})[_0x6973('0x28')](respondWithResult(_0x3e39db,null))['catch'](handleError(_0x3e39db,null));};exports[_0x6973('0x52')]=function(_0x57634b,_0x229d4b){return db['MailAccount'][_0x6973('0x52')]()[_0x6973('0x28')](respondWithResult(_0x229d4b,null))[_0x6973('0x1c')](handleError(_0x229d4b,null));};exports[_0x6973('0x53')]=function(_0x47736e,_0x1dd659){if(_0x47736e[_0x6973('0x4e')]['id']){delete _0x47736e[_0x6973('0x4e')]['id'];}return db['MailAccount'][_0x6973('0x54')]({'where':{'id':_0x47736e['params']['id']}})['then'](handleEntityNotFound(_0x1dd659,null))['then'](function(_0x36a523){if(_0x36a523){_0x47736e[_0x6973('0x4e')]['MailAccountId']=_0x36a523['id'];return db['Disposition'][_0x6973('0x55')](_0x47736e['body']);}})['then'](respondWithResult(_0x1dd659,null))[_0x6973('0x1c')](handleError(_0x1dd659,null));};exports[_0x6973('0x56')]=function(_0x59facd,_0x777407){var _0x28d57b={'raw':![],'where':{}};var _0x288148={};var _0x38a175={'count':0x0,'rows':[]};return db[_0x6973('0x46')]['findOne']({'where':{'id':_0x59facd['params']['id']}})[_0x6973('0x28')](handleEntityNotFound(_0x777407,null))[_0x6973('0x28')](function(_0x5131eb){if(_0x5131eb){_0x288148[_0x6973('0x37')]=_[_0x6973('0x39')](db[_0x6973('0x57')]['rawAttributes']);_0x288148[_0x6973('0x38')]=_[_0x6973('0x39')](_0x59facd[_0x6973('0x38')]);_0x288148[_0x6973('0x41')]=_['intersection'](_0x288148['model'],_0x288148[_0x6973('0x38')]);_0x28d57b['attributes']=_[_0x6973('0x3a')](_0x288148[_0x6973('0x37')],qs[_0x6973('0x3b')](_0x59facd[_0x6973('0x38')][_0x6973('0x3b')]));_0x28d57b['attributes']=_0x28d57b[_0x6973('0x3c')]['length']?_0x28d57b[_0x6973('0x3c')]:_0x288148['model'];if(!_0x59facd[_0x6973('0x38')][_0x6973('0x3e')](_0x6973('0x3f'))){_0x28d57b[_0x6973('0x22')]=qs[_0x6973('0x22')](_0x59facd[_0x6973('0x38')][_0x6973('0x22')]);_0x28d57b['offset']=qs['offset'](_0x59facd[_0x6973('0x38')][_0x6973('0x24')]);}_0x28d57b['order']=qs[_0x6973('0x40')](_0x59facd[_0x6973('0x38')][_0x6973('0x40')]);_0x28d57b[_0x6973('0x43')]=qs[_0x6973('0x41')](_['pick'](_0x59facd[_0x6973('0x38')],_0x288148[_0x6973('0x41')]));_0x28d57b[_0x6973('0x43')][_0x6973('0x58')]=_0x5131eb['id'];if(_0x59facd[_0x6973('0x38')][_0x6973('0x42')]){_0x28d57b[_0x6973('0x43')]=_[_0x6973('0x44')](_0x28d57b[_0x6973('0x43')],{'$or':_[_0x6973('0x33')](_0x28d57b[_0x6973('0x3c')],function(_0x3034d7){var _0x422226={};_0x422226[_0x3034d7]={'$like':'%'+_0x59facd[_0x6973('0x38')][_0x6973('0x42')]+'%'};return _0x422226;})});}_0x28d57b=_['merge']({},_0x28d57b,_0x59facd[_0x6973('0x4d')]);return db['Disposition'][_0x6973('0x23')]({'where':_0x28d57b[_0x6973('0x43')]})[_0x6973('0x28')](function(_0x358057){_0x38a175[_0x6973('0x23')]=_0x358057;if(_0x59facd['query'][_0x6973('0x59')]){_0x28d57b['include']=[{'all':!![]}];}return db[_0x6973('0x57')][_0x6973('0x48')](_0x28d57b);})['then'](function(_0x58ea2c){_0x38a175[_0x6973('0x49')]=_0x58ea2c;return _0x38a175;});}})[_0x6973('0x28')](respondWithFilteredResult(_0x777407,_0x28d57b))[_0x6973('0x1c')](handleError(_0x777407,null));};exports[_0x6973('0x5a')]=function(_0x15d209,_0x281432){return db[_0x6973('0x46')][_0x6973('0x54')]({'where':{'id':_0x15d209[_0x6973('0x4a')]['id']}})[_0x6973('0x28')](handleEntityNotFound(_0x281432,null))[_0x6973('0x28')](function(_0x48edd9){if(_0x48edd9){return _0x48edd9[_0x6973('0x5a')](_0x15d209[_0x6973('0x38')][_0x6973('0x5b')]);}})[_0x6973('0x28')](respondWithStatusCode(_0x281432,null))[_0x6973('0x1c')](handleError(_0x281432,null));};exports[_0x6973('0x5c')]=function(_0x751848,_0x3671d5){if(_0x751848[_0x6973('0x4e')]['id']){delete _0x751848[_0x6973('0x4e')]['id'];}return db[_0x6973('0x46')][_0x6973('0x54')]({'where':{'id':_0x751848[_0x6973('0x4a')]['id']}})[_0x6973('0x28')](handleEntityNotFound(_0x3671d5,null))[_0x6973('0x28')](function(_0x55bc45){if(_0x55bc45){_0x751848[_0x6973('0x4e')][_0x6973('0x58')]=_0x55bc45['id'];return db['CannedAnswer'][_0x6973('0x55')](_0x751848['body']);}})[_0x6973('0x28')](respondWithResult(_0x3671d5,null))[_0x6973('0x1c')](handleError(_0x3671d5,null));};exports['getAnswers']=function(_0x84600e,_0x4984af){var _0xcb5de2={'raw':![],'where':{}};var _0x299c05={};var _0x5ab872={'count':0x0,'rows':[]};return db['MailAccount'][_0x6973('0x5d')]({'where':{'id':_0x84600e[_0x6973('0x4a')]['id']}})[_0x6973('0x28')](handleEntityNotFound(_0x4984af,null))[_0x6973('0x28')](function(_0x5e4764){if(_0x5e4764){_0x299c05[_0x6973('0x37')]=_[_0x6973('0x39')](db[_0x6973('0x5e')]['rawAttributes']);_0x299c05['query']=_['keys'](_0x84600e['query']);_0x299c05[_0x6973('0x41')]=_[_0x6973('0x3a')](_0x299c05[_0x6973('0x37')],_0x299c05[_0x6973('0x38')]);_0xcb5de2[_0x6973('0x3c')]=_[_0x6973('0x3a')](_0x299c05['model'],qs[_0x6973('0x3b')](_0x84600e[_0x6973('0x38')][_0x6973('0x3b')]));_0xcb5de2[_0x6973('0x3c')]=_0xcb5de2['attributes'][_0x6973('0x3d')]?_0xcb5de2[_0x6973('0x3c')]:_0x299c05[_0x6973('0x37')];if(!_0x84600e['query'][_0x6973('0x3e')](_0x6973('0x3f'))){_0xcb5de2[_0x6973('0x22')]=qs['limit'](_0x84600e[_0x6973('0x38')][_0x6973('0x22')]);_0xcb5de2[_0x6973('0x24')]=qs[_0x6973('0x24')](_0x84600e[_0x6973('0x38')][_0x6973('0x24')]);}_0xcb5de2[_0x6973('0x5f')]=qs['sort'](_0x84600e[_0x6973('0x38')]['sort']);_0xcb5de2['where']=qs[_0x6973('0x41')](_[_0x6973('0x60')](_0x84600e['query'],_0x299c05['filters']));_0xcb5de2[_0x6973('0x43')]['MailAccountId']=_0x5e4764['id'];if(_0x84600e[_0x6973('0x38')][_0x6973('0x42')]){_0xcb5de2[_0x6973('0x43')]=_[_0x6973('0x44')](_0xcb5de2[_0x6973('0x43')],{'$or':_[_0x6973('0x33')](_0xcb5de2['attributes'],function(_0x21c5d7){var _0x5836e2={};_0x5836e2[_0x21c5d7]={'$like':'%'+_0x84600e[_0x6973('0x38')]['filter']+'%'};return _0x5836e2;})});}_0xcb5de2=_[_0x6973('0x44')]({},_0xcb5de2,_0x84600e[_0x6973('0x4d')]);return db['CannedAnswer'][_0x6973('0x23')]({'where':_0xcb5de2[_0x6973('0x43')]})[_0x6973('0x28')](function(_0x4a90c3){_0x5ab872['count']=_0x4a90c3;if(_0x84600e['query'][_0x6973('0x59')]){_0xcb5de2[_0x6973('0x47')]=[{'all':!![]}];}return db['CannedAnswer']['findAll'](_0xcb5de2);})[_0x6973('0x28')](function(_0x572ebf){_0x5ab872['rows']=_0x572ebf;return _0x5ab872;});}})['then'](respondWithFilteredResult(_0x4984af,_0xcb5de2))[_0x6973('0x1c')](handleError(_0x4984af,null));};exports[_0x6973('0x61')]=function(_0x25b6f7,_0x18c3a4){return db[_0x6973('0x46')][_0x6973('0x54')]({'where':{'id':_0x25b6f7[_0x6973('0x4a')]['id']}})[_0x6973('0x28')](handleEntityNotFound(_0x18c3a4,null))[_0x6973('0x28')](function(_0x4c4f74){if(_0x4c4f74){return _0x4c4f74['removeAnswers'](_0x25b6f7[_0x6973('0x38')][_0x6973('0x5b')]);}})['then'](respondWithStatusCode(_0x18c3a4,null))[_0x6973('0x1c')](handleError(_0x18c3a4,null));};exports[_0x6973('0x55')]=function(_0x153b6d,_0x37f6fa){var _0x1f0964={'name':_0x153b6d[_0x6973('0x4e')][_0x6973('0x2d')],'key':_0x153b6d[_0x6973('0x4e')][_0x6973('0x36')],'provider':_0x153b6d[_0x6973('0x4e')][_0x6973('0x62')]===_0x6973('0x63')?null:_0x153b6d[_0x6973('0x4e')][_0x6973('0x62')],'email':_0x153b6d['body'][_0x6973('0x64')],'ListId':_0x153b6d['body'][_0x6973('0x65')],'active':!_['isNil'](_0x153b6d[_0x6973('0x4e')][_0x6973('0x66')])?_0x153b6d[_0x6973('0x4e')][_0x6973('0x66')]:!![],'description':_0x153b6d[_0x6973('0x4e')][_0x6973('0x67')]||null,'Imap':{},'Smtp':{}};if(_0x1f0964['provider']){_0x1f0964[_0x6973('0x30')][_0x6973('0x68')]=_0x1f0964['Smtp']['user']=_0x153b6d[_0x6973('0x4e')][_0x6973('0x69')];_0x1f0964[_0x6973('0x30')][_0x6973('0x6a')]=_0x1f0964[_0x6973('0x51')][_0x6973('0x6b')]=_0x153b6d['body']['password'];if(_0x153b6d['body'][_0x6973('0x4f')]){_0x1f0964[_0x6973('0x30')][_0x6973('0x4f')]=_0x1f0964['Smtp'][_0x6973('0x4f')]=!![];_0x1f0964[_0x6973('0x30')][_0x6973('0x50')]=_0x1f0964['Smtp'][_0x6973('0x50')]=_0x153b6d[_0x6973('0x4e')][_0x6973('0x50')];_0x1f0964[_0x6973('0x30')][_0x6973('0x6a')]=_0x1f0964[_0x6973('0x51')][_0x6973('0x6b')]=null;}else{_0x1f0964[_0x6973('0x30')][_0x6973('0x50')]=_0x1f0964[_0x6973('0x51')][_0x6973('0x50')]=null;}_0x1f0964['Imap'][_0x6973('0x6c')]=_0x1f0964[_0x6973('0x51')][_0x6973('0x6c')]=null;_0x1f0964[_0x6973('0x30')][_0x6973('0x6d')]=_0x1f0964[_0x6973('0x51')]['host']=null;_0x1f0964[_0x6973('0x30')][_0x6973('0x6e')]=_0x1f0964[_0x6973('0x51')]['port']=null;}else{if(_0x153b6d[_0x6973('0x4e')]['authentication']){_0x1f0964[_0x6973('0x30')][_0x6973('0x68')]=_0x1f0964[_0x6973('0x51')][_0x6973('0x68')]=_0x153b6d[_0x6973('0x4e')][_0x6973('0x69')];_0x1f0964['Imap'][_0x6973('0x6a')]=_0x1f0964[_0x6973('0x51')][_0x6973('0x6b')]=_0x153b6d['body'][_0x6973('0x6a')];}else{_0x1f0964[_0x6973('0x30')][_0x6973('0x6f')]=_0x1f0964[_0x6973('0x51')][_0x6973('0x6f')]=![];_0x1f0964[_0x6973('0x30')]['user']=_0x1f0964[_0x6973('0x51')][_0x6973('0x68')]=null;_0x1f0964[_0x6973('0x30')][_0x6973('0x6a')]=_0x1f0964[_0x6973('0x51')][_0x6973('0x6b')]=null;}_0x1f0964[_0x6973('0x30')][_0x6973('0x6d')]=_0x153b6d['body'][_0x6973('0x30')][_0x6973('0x6d')];_0x1f0964[_0x6973('0x30')][_0x6973('0x6e')]=_0x153b6d[_0x6973('0x4e')]['Imap']['port'];_0x1f0964[_0x6973('0x51')]['host']=_0x153b6d[_0x6973('0x4e')][_0x6973('0x51')]['host'];_0x1f0964[_0x6973('0x51')][_0x6973('0x6e')]=_0x153b6d[_0x6973('0x4e')][_0x6973('0x51')]['port'];}return db[_0x6973('0x46')][_0x6973('0x55')](_0x1f0964,{'include':[{'model':db['MailServerOut'],'as':'Smtp'},{'model':db[_0x6973('0x4b')],'as':_0x6973('0x30')}]})[_0x6973('0x28')](function(_0x4f5b2c){var _0x41730e=_0x153b6d['user'][_0x6973('0x29')]({'plain':!![]});if(!_0x41730e)throw new Error(_0x6973('0x70'));if(_0x41730e['role']===_0x6973('0x68')){var _0x4a61df=_0x4f5b2c[_0x6973('0x29')]({'plain':!![]});return db[_0x6973('0x71')][_0x6973('0x54')]({'where':{'name':_0x6973('0x2a'),'userProfileId':_0x41730e[_0x6973('0x72')]},'raw':!![]})[_0x6973('0x28')](function(_0x579be5){if(_0x579be5&&_0x579be5[_0x6973('0x73')]===0x0){return db['UserProfileResource'][_0x6973('0x55')]({'name':_0x4a61df['name'],'resourceId':_0x4a61df['id'],'type':_0x579be5['name'],'sectionId':_0x579be5['id']},{})[_0x6973('0x28')](function(){return _0x4f5b2c;});}else{return _0x4f5b2c;}})['catch'](function(_0x76d808){logger[_0x6973('0x18')](_0x6973('0x74'),_0x76d808);throw _0x76d808;});}return _0x4f5b2c;})[_0x6973('0x28')](respondWithResult(_0x37f6fa,0xc9))[_0x6973('0x1c')](handleError(_0x37f6fa,null));};exports[_0x6973('0x75')]=function(_0x2ddf2e,_0x46e69e){return db['MailAccount'][_0x6973('0x5d')]({'where':{'id':_0x2ddf2e['params']['id']}})[_0x6973('0x28')](handleEntityNotFound(_0x46e69e,null))[_0x6973('0x28')](function(_0x5e1400){if(_0x5e1400){return _0x5e1400['getImap']();}return null;})[_0x6973('0x28')](respondWithResult(_0x46e69e,null))[_0x6973('0x1c')](handleError(_0x46e69e,null));};exports[_0x6973('0x76')]=function(_0x244195,_0x4d327a){if(_0x244195[_0x6973('0x4e')]['id']){delete _0x244195['body']['id'];}return db[_0x6973('0x46')][_0x6973('0x54')]({'where':{'id':_0x244195[_0x6973('0x4a')]['id']}})[_0x6973('0x28')](handleEntityNotFound(_0x4d327a,null))[_0x6973('0x28')](function(_0x136c0c){if(_0x136c0c){_0x244195[_0x6973('0x4e')]['MailAccountId']=_0x136c0c['id'];return db['MailServerIn'][_0x6973('0x55')](_0x244195['body']);}})[_0x6973('0x28')](respondWithResult(_0x4d327a,null))[_0x6973('0x1c')](handleError(_0x4d327a,null));};exports['removeImap']=function(_0x522e14,_0x332b75){return db[_0x6973('0x46')][_0x6973('0x5d')]({'where':{'id':_0x522e14[_0x6973('0x4a')]['id']}})[_0x6973('0x28')](handleEntityNotFound(_0x332b75,null))[_0x6973('0x28')](function(_0x5854e3){if(_0x5854e3){return _0x5854e3[_0x6973('0x77')](null);}return null;})['then'](respondWithStatusCode(_0x332b75,null))['catch'](handleError(_0x332b75,null));};exports[_0x6973('0x78')]=function(_0x2b548c,_0x5410c4){return db['MailAccount'][_0x6973('0x5d')]({'where':{'id':_0x2b548c[_0x6973('0x4a')]['id']}})[_0x6973('0x28')](handleEntityNotFound(_0x5410c4,null))[_0x6973('0x28')](function(_0x4fbe60){if(_0x4fbe60){return _0x4fbe60[_0x6973('0x78')]();}return null;})[_0x6973('0x28')](respondWithResult(_0x5410c4,null))[_0x6973('0x1c')](handleError(_0x5410c4,null));};exports[_0x6973('0x79')]=function(_0x454902,_0x1ae6a8){if(_0x454902[_0x6973('0x4e')]['id']){delete _0x454902[_0x6973('0x4e')]['id'];}return db[_0x6973('0x46')]['find']({'where':{'id':_0x454902[_0x6973('0x4a')]['id']}})['then'](handleEntityNotFound(_0x1ae6a8,null))[_0x6973('0x28')](function(_0x3cbb1b){if(_0x3cbb1b){_0x454902[_0x6973('0x4e')][_0x6973('0x58')]=_0x3cbb1b['id'];return db[_0x6973('0x31')][_0x6973('0x55')](_0x454902['body']);}})['then'](respondWithResult(_0x1ae6a8,null))[_0x6973('0x1c')](handleError(_0x1ae6a8,null));};exports[_0x6973('0x7a')]=function(_0x5d975d,_0x58d41f){return db['MailAccount'][_0x6973('0x5d')]({'where':{'id':_0x5d975d[_0x6973('0x4a')]['id']}})['then'](handleEntityNotFound(_0x58d41f,null))['then'](function(_0x13e33b){if(_0x13e33b){return _0x13e33b[_0x6973('0x7b')](null);}return null;})['then'](respondWithStatusCode(_0x58d41f,null))[_0x6973('0x1c')](handleError(_0x58d41f,null));};exports[_0x6973('0x7c')]=function(_0x4b65d9,_0x52405){return db['MailInteraction']['find']({'where':{'id':_0x4b65d9[_0x6973('0x4a')]['id']}})['then'](handleEntityNotFound(_0x52405,null))[_0x6973('0x28')](function(_0x3cbb0d){if(_0x3cbb0d){return _0x3cbb0d['addInteraction'](_0x4b65d9[_0x6973('0x4e')][_0x6973('0x5b')],_['omit'](_0x4b65d9[_0x6973('0x4e')],[_0x6973('0x5b'),'id'])||{});}})[_0x6973('0x28')](respondWithResult(_0x52405,null))[_0x6973('0x1c')](handleError(_0x52405,null));};exports[_0x6973('0x7d')]=function(_0x1132c4,_0x57d8e5){var _0x5c9afd={'raw':![],'where':{}};var _0x33a506={};var _0x375643={'count':0x0,'rows':[]};return db[_0x6973('0x46')][_0x6973('0x5d')]({'where':{'id':_0x1132c4[_0x6973('0x4a')]['id']}})['then'](handleEntityNotFound(_0x57d8e5,null))[_0x6973('0x28')](function(_0x1df948){if(_0x1df948){_0x33a506[_0x6973('0x37')]=_[_0x6973('0x39')](db[_0x6973('0x7e')][_0x6973('0x34')]);_0x33a506[_0x6973('0x38')]=_['keys'](_0x1132c4[_0x6973('0x38')]);_0x33a506['filters']=_[_0x6973('0x3a')](_0x33a506[_0x6973('0x37')],_0x33a506['query']);_0x5c9afd[_0x6973('0x3c')]=_[_0x6973('0x3a')](_0x33a506[_0x6973('0x37')],qs[_0x6973('0x3b')](_0x1132c4[_0x6973('0x38')][_0x6973('0x3b')]));_0x5c9afd[_0x6973('0x3c')]=_0x5c9afd[_0x6973('0x3c')][_0x6973('0x3d')]?_0x5c9afd[_0x6973('0x3c')]:_0x33a506[_0x6973('0x37')];if(!_0x1132c4[_0x6973('0x38')][_0x6973('0x3e')]('nolimit')){_0x5c9afd[_0x6973('0x22')]=qs[_0x6973('0x22')](_0x1132c4[_0x6973('0x38')][_0x6973('0x22')]);_0x5c9afd[_0x6973('0x24')]=qs[_0x6973('0x24')](_0x1132c4[_0x6973('0x38')][_0x6973('0x24')]);}_0x5c9afd[_0x6973('0x5f')]=qs['sort'](_0x1132c4[_0x6973('0x38')][_0x6973('0x40')]);_0x5c9afd[_0x6973('0x43')]=qs['filters'](_[_0x6973('0x60')](_0x1132c4[_0x6973('0x38')],_0x33a506[_0x6973('0x41')]));_0x5c9afd[_0x6973('0x43')][_0x6973('0x58')]=_0x1df948['id'];if(_0x1132c4[_0x6973('0x38')]['filter']){_0x5c9afd['where']=_[_0x6973('0x44')](_0x5c9afd[_0x6973('0x43')],{'$or':_['map'](_0x5c9afd[_0x6973('0x3c')],function(_0x3c97ab){var _0x291339={};_0x291339[_0x3c97ab]={'$like':'%'+_0x1132c4['query'][_0x6973('0x42')]+'%'};return _0x291339;})});}_0x5c9afd=_[_0x6973('0x44')]({},_0x5c9afd,_0x1132c4[_0x6973('0x4d')]);return db[_0x6973('0x7e')][_0x6973('0x23')]({'where':_0x5c9afd[_0x6973('0x43')]})[_0x6973('0x28')](function(_0x57cf9d){_0x375643[_0x6973('0x23')]=_0x57cf9d;if(_0x1132c4['query'][_0x6973('0x59')]){_0x5c9afd[_0x6973('0x47')]=[{'model':db[_0x6973('0x7f')],'as':_0x6973('0x80'),'required':![]},{'model':db['User'],'as':_0x6973('0x81'),'attributes':['name',_0x6973('0x82'),'internal'],'required':![]},{'model':db['Tag'],'as':_0x6973('0x83'),'attributes':['id',_0x6973('0x2d'),_0x6973('0x84')],'where':_0x1132c4['query'][_0x6973('0x85')]?{'id':_0x1132c4[_0x6973('0x38')]['tag']}:undefined,'required':_0x1132c4[_0x6973('0x38')][_0x6973('0x85')]?!![]:![]}];}return db['MailInteraction']['findAll'](_0x5c9afd);})['then'](function(_0x5c2b75){_0x375643[_0x6973('0x49')]=_0x5c2b75;return _0x375643;});}})[_0x6973('0x28')](respondWithFilteredResult(_0x57d8e5,_0x5c9afd))[_0x6973('0x1c')](handleError(_0x57d8e5,null));};exports[_0x6973('0x86')]=function addApplications(_0x324937,_0x2b7cb5){var _0x56ff01=_0x324937[_0x6973('0x4a')]['id'];var _0xaccaa=_0x324937[_0x6973('0x4e')];var _0x3b7f42=0xc8;var _0x4fe721=null;return db[_0x6973('0x87')][_0x6973('0x88')]({'isolationLevel':db[_0x6973('0x87')]['Transaction']['ISOLATION_LEVELS'][_0x6973('0x89')]},function(_0x52b3b2){return db['MailAccount'][_0x6973('0x5d')]({'where':{'id':_0x56ff01},'transaction':_0x52b3b2})[_0x6973('0x28')](function(_0x49cfb2){if(_0x49cfb2){return db[_0x6973('0x8a')][_0x6973('0x27')]({'where':{'MailAccountId':_0x56ff01},'transaction':_0x52b3b2})[_0x6973('0x28')](function(){var _0x1441fb=_['map'](_0xaccaa,function(_0x3be0d8){_0x3be0d8['MailAccountId']=_0x56ff01;return _0x3be0d8;});return db[_0x6973('0x8a')][_0x6973('0x8b')](_0x1441fb,{'transaction':_0x52b3b2});});}else{_0x3b7f42=0x194;_0x4fe721=[];}});})['then'](function(){if(_0x3b7f42!==0x194){return db[_0x6973('0x8a')][_0x6973('0x8c')]({'where':{'MailAccountId':_0x56ff01},'order':'priority'})[_0x6973('0x28')](function(_0x466d76){_0x4fe721=_0x466d76;});}})[_0x6973('0x1c')](function(_0x27f011){_0x3b7f42=0x1f4;logger[_0x6973('0x18')](_0x27f011[_0x6973('0x2c')]);if(_0x27f011[_0x6973('0x2d')]){delete _0x27f011[_0x6973('0x2d')];}_0x4fe721=_0x27f011;})[_0x6973('0x8d')](function(){if(_0x4fe721===null){_0x2b7cb5[_0x6973('0x1d')](_0x3b7f42);}else{if(_0x3b7f42===0x1f4){_0x2b7cb5[_0x6973('0x1e')](_0x3b7f42)['send'](_0x4fe721);}else{_0x2b7cb5[_0x6973('0x1e')](_0x3b7f42)[_0x6973('0x20')](_0x4fe721);}}});};exports[_0x6973('0x8e')]=function(_0x10c214,_0x5287ee){var _0x3132ac={};var _0xdcf692={};var _0xa2ad33;var _0x20058e;return db[_0x6973('0x46')][_0x6973('0x5d')]({'where':{'id':_0x10c214[_0x6973('0x4a')]['id']}})[_0x6973('0x28')](handleEntityNotFound(_0x5287ee,null))[_0x6973('0x28')](function(_0x51dee4){if(_0x51dee4){_0xa2ad33=_0x51dee4;_0xdcf692[_0x6973('0x37')]=_[_0x6973('0x39')](db['MailApplication'][_0x6973('0x34')]);_0xdcf692[_0x6973('0x38')]=_[_0x6973('0x39')](_0x10c214[_0x6973('0x38')]);_0xdcf692['filters']=_[_0x6973('0x3a')](_0xdcf692[_0x6973('0x37')],_0xdcf692[_0x6973('0x38')]);_0x3132ac[_0x6973('0x3c')]=_['intersection'](_0xdcf692[_0x6973('0x37')],qs[_0x6973('0x3b')](_0x10c214['query'][_0x6973('0x3b')]));_0x3132ac[_0x6973('0x3c')]=_0x3132ac[_0x6973('0x3c')][_0x6973('0x3d')]?_0x3132ac[_0x6973('0x3c')]:_0xdcf692['model'];_0x3132ac[_0x6973('0x5f')]=qs[_0x6973('0x40')](_0x10c214[_0x6973('0x38')][_0x6973('0x40')]);_0x3132ac[_0x6973('0x43')]=qs[_0x6973('0x41')](_[_0x6973('0x60')](_0x10c214[_0x6973('0x38')],_0xdcf692[_0x6973('0x41')]));if(_0x10c214[_0x6973('0x38')][_0x6973('0x42')]){_0x3132ac[_0x6973('0x43')]=_[_0x6973('0x44')](_0x3132ac['where'],{'$or':_[_0x6973('0x33')](_0x3132ac['attributes'],function(_0x287339){var _0xcf7ff2={};_0xcf7ff2[_0x287339]={'$like':'%'+_0x10c214[_0x6973('0x38')][_0x6973('0x42')]+'%'};return _0xcf7ff2;})});}_0x3132ac=_[_0x6973('0x44')]({},_0x3132ac,_0x10c214[_0x6973('0x4d')]);return _0xa2ad33[_0x6973('0x8e')](_0x3132ac);}})['then'](function(_0x5df720){if(_0x5df720){_0x20058e=_0x5df720['length'];if(!_0x10c214[_0x6973('0x38')][_0x6973('0x3e')](_0x6973('0x3f'))){_0x3132ac[_0x6973('0x22')]=qs[_0x6973('0x22')](_0x10c214['query'][_0x6973('0x22')]);_0x3132ac[_0x6973('0x24')]=qs[_0x6973('0x24')](_0x10c214[_0x6973('0x38')][_0x6973('0x24')]);}return _0xa2ad33[_0x6973('0x8e')](_0x3132ac);}})[_0x6973('0x28')](function(_0x17048b){if(_0x17048b){return _0x17048b?{'count':_0x20058e,'rows':_0x17048b}:null;}})['then'](respondWithResult(_0x5287ee,null))['catch'](handleError(_0x5287ee,null));};exports[_0x6973('0x8f')]=function(_0x2b5346,_0x581d80){var _0x3dbee7={'raw':!![],'where':{}};var _0x3d339a={};var _0x56bfca={'count':0x0,'rows':[]};return db[_0x6973('0x46')][_0x6973('0x5d')]({'where':{'id':_0x2b5346[_0x6973('0x4a')]['id']}})[_0x6973('0x28')](handleEntityNotFound(_0x581d80,null))[_0x6973('0x28')](function(_0x25b7b2){if(_0x25b7b2){_0x3d339a[_0x6973('0x37')]=_[_0x6973('0x39')](db[_0x6973('0x90')][_0x6973('0x34')]);_0x3d339a['query']=_[_0x6973('0x39')](_0x2b5346[_0x6973('0x38')]);_0x3d339a[_0x6973('0x41')]=_['intersection'](_0x3d339a[_0x6973('0x37')],_0x3d339a[_0x6973('0x38')]);_0x3dbee7[_0x6973('0x3c')]=_[_0x6973('0x3a')](_0x3d339a[_0x6973('0x37')],qs[_0x6973('0x3b')](_0x2b5346['query'][_0x6973('0x3b')]));_0x3dbee7['attributes']=_0x3dbee7['attributes'][_0x6973('0x3d')]?_0x3dbee7['attributes']:_0x3d339a[_0x6973('0x37')];if(!_0x2b5346[_0x6973('0x38')][_0x6973('0x3e')]('nolimit')){_0x3dbee7[_0x6973('0x22')]=qs[_0x6973('0x22')](_0x2b5346[_0x6973('0x38')]['limit']);_0x3dbee7['offset']=qs[_0x6973('0x24')](_0x2b5346['query'][_0x6973('0x24')]);}_0x3dbee7[_0x6973('0x5f')]=qs['sort'](_0x2b5346[_0x6973('0x38')][_0x6973('0x40')]);_0x3dbee7[_0x6973('0x43')]=qs['filters'](_[_0x6973('0x60')](_0x2b5346[_0x6973('0x38')],_0x3d339a['filters']));_0x3dbee7[_0x6973('0x43')][_0x6973('0x58')]=_0x25b7b2['id'];if(_0x2b5346[_0x6973('0x38')]['filter']){_0x3dbee7[_0x6973('0x43')]=_['merge'](_0x3dbee7['where'],{'$or':_[_0x6973('0x33')](_0x3dbee7[_0x6973('0x3c')],function(_0x527948){var _0x1433a4={};_0x1433a4[_0x527948]={'$like':'%'+_0x2b5346[_0x6973('0x38')]['filter']+'%'};return _0x1433a4;})});}if(_0x2b5346[_0x6973('0x38')][_0x6973('0x91')]){var _0x28d99e=_0x2b5346['query'][_0x6973('0x91')][_0x6973('0x92')](',');var _0x4abf38={};_0x4abf38[_0x28d99e[0x0]]={'$gte':moment(_0x28d99e[0x1])['format'](_0x6973('0x93'))};_0x3dbee7[_0x6973('0x43')]=_['merge'](_0x3dbee7[_0x6973('0x43')],_0x4abf38);}_0x3dbee7=_[_0x6973('0x44')]({},_0x3dbee7,_0x2b5346[_0x6973('0x4d')]);return db[_0x6973('0x90')][_0x6973('0x23')]({'where':_0x3dbee7[_0x6973('0x43')]})[_0x6973('0x28')](function(_0xbfc52a){_0x56bfca[_0x6973('0x23')]=_0xbfc52a;if(_0x2b5346[_0x6973('0x38')][_0x6973('0x59')]){_0x3dbee7['include']=[{'all':!![]}];}return db[_0x6973('0x90')][_0x6973('0x48')](_0x3dbee7);})[_0x6973('0x28')](function(_0x271eaf){if(_0x2b5346['query'][_0x6973('0x94')]===_0x6973('0x95')){for(var _0x140abf=0x0;_0x140abf<_0x271eaf[_0x6973('0x3d')];_0x140abf++){_0x271eaf[_0x140abf]['body']=juice(_0x271eaf[_0x140abf]['body']);}}_0x56bfca[_0x6973('0x49')]=_0x271eaf;return _0x56bfca;});}})[_0x6973('0x28')](respondWithFilteredResult(_0x581d80,_0x3dbee7))[_0x6973('0x1c')](handleError(_0x581d80,null));};exports[_0x6973('0x2e')]=function(_0x354186,_0x4fdf11){var _0x16206c,_0x55146b={},_0x48e4b2;if(_0x354186[_0x6973('0x4e')]['to']){_0x48e4b2=_0x354186[_0x6973('0x4e')]['to'][_0x6973('0x92')](',')[0x0];}return db['MailAccount']['find']({'where':{'id':_0x354186['params']['id']},'include':[{'model':db[_0x6973('0x96')],'as':_0x6973('0x97'),'include':[{'model':db[_0x6973('0x7f')],'as':'Contacts','where':{'email':_0x48e4b2},'limit':0x1,'order':[[_0x6973('0x98'),_0x6973('0x99')]]}]},{'model':db['MailServerOut'],'as':'Smtp','raw':!![]}]})[_0x6973('0x28')](handleEntityNotFound(_0x4fdf11,null))['then'](function(_0x162a74){if(_0x162a74){_0x16206c=_0x162a74;if(_0x162a74[_0x6973('0x51')]){if(_[_0x6973('0x9a')](_0x354186['body'][_0x6973('0x9b')])){_0x354186[_0x6973('0x4e')][_0x6973('0x9b')]=util[_0x6973('0x9c')]('%s\x20<%s>',_0x162a74[_0x6973('0x2d')],_0x162a74[_0x6973('0x64')]||_0x162a74['Smtp'][_0x6973('0x68')]);}if(_0x354186[_0x6973('0x4e')][_0x6973('0x9d')]&&_0x354186[_0x6973('0x4e')]['attachments'][_0x6973('0x3d')]){for(var _0x188c98=0x0;_0x188c98<_0x354186[_0x6973('0x4e')][_0x6973('0x9d')]['length'];_0x188c98+=0x1){_0x354186[_0x6973('0x4e')][_0x6973('0x9d')][_0x188c98]={'filename':_0x354186['body'][_0x6973('0x9d')][_0x188c98]['name'],'path':path[_0x6973('0x9e')](config[_0x6973('0x9f')],'server/files/attachments',_0x354186['body'][_0x6973('0x9d')][_0x188c98]['basename'])};}}var _0x13f68f={'tls':{'rejectUnauthorized':![]}};if(_['isNil'](_0x162a74['Smtp'][_0x6973('0x6c')])){if(_0x162a74[_0x6973('0x51')]['authentication']){_0x13f68f['auth']={'user':_0x162a74[_0x6973('0x51')]['user'],'pass':_0x162a74['Smtp'][_0x6973('0x6b')]};}_0x13f68f['host']=_0x162a74[_0x6973('0x51')][_0x6973('0x6d')];_0x13f68f['port']=_0x162a74['Smtp']['port'];_0x13f68f['secure']=_0x162a74['Smtp'][_0x6973('0xa0')];}else{_0x13f68f[_0x6973('0x6c')]=_0x162a74[_0x6973('0x51')][_0x6973('0x6c')];_0x13f68f[_0x6973('0xa1')]={'user':_0x162a74[_0x6973('0x51')][_0x6973('0x68')],'pass':_0x162a74['Smtp'][_0x6973('0x6b')]};}return respondWithRpcPromise('SendMail',_0x6973('0xa2'),{'account':_0x13f68f,'message':_0x354186[_0x6973('0x4e')]});}else{throw new Error('List\x20not\x20found');}}})[_0x6973('0x28')](function(_0x5b4faf){if(_0x5b4faf){_0x55146b=_0x5b4faf;if(_0x16206c['List']){if(_0x16206c[_0x6973('0x97')]['Contacts'][_0x6973('0x3d')]){return _0x16206c['List'][_0x6973('0xa3')][0x0];}else{return db['CmContact'][_0x6973('0x55')](_['defaults'](_0x354186[_0x6973('0x4e')],{'firstName':_0x354186['body']['to'],'email':_0x354186['body']['to'],'phone':_0x354186[_0x6973('0x4e')]['to'],'ListId':_0x16206c[_0x6973('0x65')]}));}}else{throw new Error(_0x6973('0xa4'));}}})[_0x6973('0x28')](function(_0x4779b2){if(_0x4779b2){var _0x4a2019={'UserId':_0x354186[_0x6973('0x68')]['id'],'ContactId':_0x4779b2['id'],'MailAccountId':_0x16206c['id'],'inReplyTo':_0x55146b[_0x6973('0xa5')],'to':_0x354186[_0x6973('0x4e')][_0x6973('0x9b')],'cc':_0x354186[_0x6973('0x4e')]['cc'],'subject':_0x354186[_0x6973('0x4e')]['subject'],'attach':_0x354186[_0x6973('0x4e')]['attach'],'firstMsgDirection':'out','lastMsgAt':moment()[_0x6973('0x9c')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':_0x6973('0xa6'),'Messages':[_[_0x6973('0x44')](_0x354186['body'],{'messageId':_0x55146b[_0x6973('0xa5')],'sentAt':moment()['format'](_0x6973('0x93')),'read':!![],'MailAccountId':_0x16206c['id'],'UserId':_0x354186[_0x6973('0x68')]['id'],'ContactId':_0x4779b2['id']})]};if(_0x354186[_0x6973('0x4e')][_0x6973('0xa7')]){_0x4a2019=_[_0x6973('0x44')](_0x4a2019,_0x354186[_0x6973('0x4e')][_0x6973('0xa7')]);}return db['MailInteraction']['create'](_0x4a2019,{'include':[{'model':db[_0x6973('0x90')],'as':'Messages'}]});}})['then'](respondWithResult(_0x4fdf11,null))[_0x6973('0x1c')](handleError(_0x4fdf11,null));};exports[_0x6973('0xa8')]=function(_0x16abbb,_0x38828b){return db[_0x6973('0x46')][_0x6973('0x54')]({'where':{'id':_0x16abbb[_0x6973('0x4a')]['id']},'include':[{'model':db[_0x6973('0x31')],'as':_0x6973('0x51'),'raw':!![],'include':[{'model':db['CloudProvider'],'as':_0x6973('0xa9'),'raw':!![]}]}]})['then'](handleEntityNotFound(_0x38828b,null))[_0x6973('0x28')](function(_0x36aa31){if(!_0x36aa31[_0x6973('0x51')])return;var _0x3530d1={'id':_0x36aa31['id'],'tls':{'rejectUnauthorized':![]}};if(_0x36aa31['provider']!==_0x6973('0x63')){_0x3530d1[_0x6973('0x6c')]=_0x36aa31[_0x6973('0x62')];}else{_0x3530d1[_0x6973('0x6d')]=_0x36aa31[_0x6973('0x51')][_0x6973('0x6d')];_0x3530d1['port']=_0x36aa31[_0x6973('0x51')]['port'];_0x3530d1[_0x6973('0xa0')]=_0x36aa31[_0x6973('0x51')][_0x6973('0xa0')];}if(_0x36aa31['Smtp'][_0x6973('0x6f')]){if(_0x36aa31[_0x6973('0x51')][_0x6973('0x4f')]){_0x3530d1[_0x6973('0xa1')]={'type':'OAuth2','user':_0x36aa31[_0x6973('0x51')][_0x6973('0x68')],'accessToken':_0x36aa31[_0x6973('0x51')][_0x6973('0xa9')][_0x6973('0xaa')]};}else{_0x3530d1[_0x6973('0xa1')]={'user':_0x36aa31[_0x6973('0x51')][_0x6973('0x68')],'pass':_0x36aa31[_0x6973('0x51')][_0x6973('0x6b')]};}}return respondWithRpcPromise(_0x6973('0xab'),'verifySmtp',{'account':_0x3530d1});})[_0x6973('0x28')](respondWithResult(_0x38828b,null))[_0x6973('0x1c')](handleError(_0x38828b,null));};exports[_0x6973('0x27')]=function(_0x23900f,_0x48b13d){return db['MailAccount'][_0x6973('0x54')]({'where':{'id':_0x23900f[_0x6973('0x4a')]['id']}})['then'](handleEntityNotFound(_0x48b13d,null))[_0x6973('0x28')](function(_0x624266){if(_0x624266&&_0x624266[_0x6973('0x6c')]){throw new db[(_0x6973('0xac'))][(_0x6973('0xad'))](_0x6973('0xae'));}return _0x624266;})[_0x6973('0x28')](removeEntity(_0x48b13d,null))[_0x6973('0x1c')](handleError(_0x48b13d,null));};exports[_0x6973('0xaf')]=function(_0x351fc2,_0x34d4e0){return db['MailAccount'][_0x6973('0x54')]({'where':{'id':_0x351fc2['params']['id']}})[_0x6973('0x28')](handleEntityNotFound(_0x34d4e0,null))['then'](function(_0x4e94fa){if(_0x4e94fa){return _0x4e94fa['addAgents'](_0x351fc2[_0x6973('0x4e')][_0x6973('0x5b')],_[_0x6973('0xb0')](_0x351fc2['body'],[_0x6973('0x5b'),'id'])||{})[_0x6973('0xb1')](function(_0x45d91e){for(var _0x1593d3=0x0;_0x1593d3<_0x351fc2['body'][_0x6973('0x5b')][_0x6973('0x3d')];_0x1593d3+=0x1){socket['emit'](_0x6973('0xb2'),{'UserId':Number(_0x351fc2[_0x6973('0x4e')][_0x6973('0x5b')][_0x1593d3]),'MailAccountId':Number(_0x351fc2['params']['id'])});}return _0x45d91e;});}})[_0x6973('0x28')](respondWithResult(_0x34d4e0,null))['catch'](handleError(_0x34d4e0,null));};exports[_0x6973('0xb3')]=function(_0x9b814c,_0x2854dd){return db[_0x6973('0x46')][_0x6973('0x54')]({'where':{'id':_0x9b814c['params']['id']}})[_0x6973('0x28')](handleEntityNotFound(_0x2854dd,null))[_0x6973('0x28')](function(_0x5db816){if(_0x5db816){return _0x5db816['removeAgents'](_0x9b814c[_0x6973('0x38')][_0x6973('0x5b')])['then'](function(){if(_[_0x6973('0xb4')](_0x9b814c[_0x6973('0x38')][_0x6973('0x5b')])){for(var _0x38c5e9=0x0;_0x38c5e9<_0x9b814c[_0x6973('0x38')][_0x6973('0x5b')][_0x6973('0x3d')];_0x38c5e9+=0x1){socket[_0x6973('0xb5')](_0x6973('0xb6'),{'UserId':Number(_0x9b814c[_0x6973('0x38')]['ids'][_0x38c5e9]),'MailAccountId':Number(_0x9b814c[_0x6973('0x4a')]['id'])});}}else{socket['emit'](_0x6973('0xb6'),{'UserId':Number(_0x9b814c[_0x6973('0x38')][_0x6973('0x5b')]),'MailAccountId':Number(_0x9b814c[_0x6973('0x4a')]['id'])});}});}})['then'](respondWithStatusCode(_0x2854dd,null))[_0x6973('0x1c')](handleError(_0x2854dd,null));};exports[_0x6973('0xb7')]=function(_0x4a2fef,_0x5f48fb){var _0x5f339f={};var _0xc1901d={};var _0x34ad78;var _0x3cfff8;return db[_0x6973('0x46')]['findOne']({'where':{'id':_0x4a2fef[_0x6973('0x4a')]['id']}})['then'](handleEntityNotFound(_0x5f48fb,null))['then'](function(_0x25b39a){if(_0x25b39a){_0x34ad78=_0x25b39a;_0xc1901d['model']=_[_0x6973('0x39')](db[_0x6973('0xb8')]['rawAttributes']);_0xc1901d[_0x6973('0x38')]=_[_0x6973('0x39')](_0x4a2fef[_0x6973('0x38')]);_0xc1901d[_0x6973('0x41')]=_[_0x6973('0x3a')](_0xc1901d['model'],_0xc1901d['query']);_0x5f339f[_0x6973('0x3c')]=_[_0x6973('0x3a')](_0xc1901d['model'],qs[_0x6973('0x3b')](_0x4a2fef[_0x6973('0x38')][_0x6973('0x3b')]));_0x5f339f['attributes']=_0x5f339f[_0x6973('0x3c')]['length']?_0x5f339f[_0x6973('0x3c')]:_0xc1901d[_0x6973('0x37')];_0x5f339f[_0x6973('0x5f')]=qs[_0x6973('0x40')](_0x4a2fef[_0x6973('0x38')][_0x6973('0x40')]);_0x5f339f[_0x6973('0x43')]=qs['filters'](_[_0x6973('0x60')](_0x4a2fef['query'],_0xc1901d[_0x6973('0x41')]));if(_0x4a2fef['query']['filter']){_0x5f339f[_0x6973('0x43')]=_[_0x6973('0x44')](_0x5f339f[_0x6973('0x43')],{'$or':_[_0x6973('0x33')](_0x5f339f[_0x6973('0x3c')],function(_0x43007b){var _0xc7a87b={};_0xc7a87b[_0x43007b]={'$like':'%'+_0x4a2fef[_0x6973('0x38')][_0x6973('0x42')]+'%'};return _0xc7a87b;})});}_0x5f339f=_[_0x6973('0x44')]({},_0x5f339f,_0x4a2fef[_0x6973('0x4d')]);return _0x34ad78['getAgents'](_0x5f339f);}})[_0x6973('0x28')](function(_0x49638d){if(_0x49638d){_0x3cfff8=_0x49638d[_0x6973('0x3d')];if(!_0x4a2fef[_0x6973('0x38')]['hasOwnProperty'](_0x6973('0x3f'))){_0x5f339f[_0x6973('0x22')]=qs[_0x6973('0x22')](_0x4a2fef['query'][_0x6973('0x22')]);_0x5f339f[_0x6973('0x24')]=qs[_0x6973('0x24')](_0x4a2fef[_0x6973('0x38')]['offset']);}return _0x34ad78['getAgents'](_0x5f339f);}})[_0x6973('0x28')](function(_0x2ca859){if(_0x2ca859){return _0x2ca859?{'count':_0x3cfff8,'rows':_0x2ca859}:null;}})[_0x6973('0x28')](respondWithResult(_0x5f48fb,null))[_0x6973('0x1c')](handleError(_0x5f48fb,null));}; \ No newline at end of file +var _0x6d4c=['stringify','error','code','message','result','catch','status','end','offset','undefined','limit','count','set','Content-Range','json','then','destroy','MailAccounts','UserProfileResource','sendStatus','stack','name','send','Imap','MailServerOut','Smtp','mandatoryDispositionPause','MailAccount','rawAttributes','type','model','map','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','include','findAll','rows','show','params','MailServerIn','Pause','includeAll','find','update','body','modernAuthentication','CloudProviderId','describe','addDisposition','MailAccountId','create','findOne','options','Disposition','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','key','provider','custom','email','isNil','active','description','user','username','password','pass','service','host','port','authentication','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','addImap','removeImap','setImap','getSmtp','addSmtp','removeSmtp','MailInteraction','omit','getInteractions','Contact','Owner','fullname','internal','Tags','color','tag','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','MailApplication','bulkCreate','findAndCountAll','priority','finally','getApplications','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','MailMessage','true','CmList','List','CmContact','Contacts','DESC','from','%s\x20<%s>','attachments','join','root','server/files/attachments','basename','auth','secure','SendMail','sendMail','ListId','List\x20not\x20found','out','messageId','Interaction','verifySmtp','CloudProvider','OAuth2','data5','Sequelize','addAgents','spread','emit','userMailAccount:save','removeAgents','isArray','userMailAccount:remove','getAgents','User','bluebird','util','path','lodash','ioredis','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','./mailAccount.socket','register','http','info','MailAccount,\x20%s,\x20%s','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s'];(function(_0x166d58,_0x2aae3e){var _0x2f9424=function(_0x1d137f){while(--_0x1d137f){_0x166d58['push'](_0x166d58['shift']());}};_0x2f9424(++_0x2aae3e);}(_0x6d4c,0xa5));var _0xc6d4=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6d4c[_0x3dd15e];return _0x231fd0;};'use strict';var moment=require('moment');var BPromise=require(_0xc6d4('0x0'));var util=require(_0xc6d4('0x1'));var path=require(_0xc6d4('0x2'));var _=require(_0xc6d4('0x3'));var juice=require('juice');var Redis=require(_0xc6d4('0x4'));var qs=require('../../components/parsers/qs');var logger=require(_0xc6d4('0x5'))(_0xc6d4('0x6'));var config=require(_0xc6d4('0x7'));var db=require(_0xc6d4('0x8'))['db'];config[_0xc6d4('0x9')]=_[_0xc6d4('0xa')](config[_0xc6d4('0x9')],{'host':_0xc6d4('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xc6d4('0x9')]));require(_0xc6d4('0xc'))[_0xc6d4('0xd')](socket);var jayson=require('jayson/promise');var client=jayson['client'][_0xc6d4('0xe')]({'port':0x232b});function respondWithRpcPromise(_0x221255,_0xcf4d93,_0x20703c,_0x13d39b){return new BPromise(function(_0x39988f,_0x14d953){var _0x3a5e08=_0x13d39b||client;return _0x3a5e08['request'](_0x221255,_0x20703c)['then'](function(_0x3754b2){logger[_0xc6d4('0xf')](_0xc6d4('0x10'),_0xcf4d93,_0xc6d4('0x11'));logger[_0xc6d4('0x12')](_0xc6d4('0x13'),_0xcf4d93,_0xc6d4('0x11'),JSON[_0xc6d4('0x14')](_0x3754b2));if(_0x3754b2[_0xc6d4('0x15')]){if(_0x3754b2[_0xc6d4('0x15')][_0xc6d4('0x16')]===0x1f4){logger['error'](_0xc6d4('0x10'),_0xcf4d93,_0x3754b2['error'][_0xc6d4('0x17')]);return _0x14d953(_0x3754b2[_0xc6d4('0x15')]['message']);}logger[_0xc6d4('0x15')](_0xc6d4('0x10'),_0xcf4d93,_0x3754b2[_0xc6d4('0x15')][_0xc6d4('0x17')]);return _0x39988f(_0x3754b2[_0xc6d4('0x15')][_0xc6d4('0x17')]);}else{logger[_0xc6d4('0xf')](_0xc6d4('0x10'),_0xcf4d93,'request\x20sent');_0x39988f(_0x3754b2[_0xc6d4('0x18')]['message']);}})[_0xc6d4('0x19')](function(_0x13b7e7){logger[_0xc6d4('0x15')]('MailAccount,\x20%s,\x20%s',_0xcf4d93,_0x13b7e7);_0x14d953(_0x13b7e7);});});}function respondWithStatusCode(_0x32e10a,_0x303007){_0x303007=_0x303007||0xcc;return function(_0x40cdc7){if(_0x40cdc7){return _0x32e10a['sendStatus'](_0x303007);}return _0x32e10a[_0xc6d4('0x1a')](_0x303007)[_0xc6d4('0x1b')]();};}function respondWithResult(_0x52d92d,_0x1a7a97){_0x1a7a97=_0x1a7a97||0xc8;return function(_0x404e1c){if(_0x404e1c){return _0x52d92d[_0xc6d4('0x1a')](_0x1a7a97)['json'](_0x404e1c);}};}function respondWithFilteredResult(_0x436683,_0x5c9d84){return function(_0x1ff4a9){if(_0x1ff4a9){var _0x2eaa2e=typeof _0x5c9d84[_0xc6d4('0x1c')]===_0xc6d4('0x1d')&&typeof _0x5c9d84[_0xc6d4('0x1e')]===_0xc6d4('0x1d');var _0x59e360=_0x1ff4a9['count'];var _0xc21ceb=_0x2eaa2e?0x0:_0x5c9d84[_0xc6d4('0x1c')];var _0xb10c97=_0x2eaa2e?_0x1ff4a9[_0xc6d4('0x1f')]:_0x5c9d84['offset']+_0x5c9d84[_0xc6d4('0x1e')];var _0x38b4e1;if(_0xb10c97>=_0x59e360){_0xb10c97=_0x59e360;_0x38b4e1=0xc8;}else{_0x38b4e1=0xce;}_0x436683[_0xc6d4('0x1a')](_0x38b4e1);return _0x436683[_0xc6d4('0x20')](_0xc6d4('0x21'),_0xc21ceb+'-'+_0xb10c97+'/'+_0x59e360)[_0xc6d4('0x22')](_0x1ff4a9);}return null;};}function saveUpdates(_0x3ed95b){return function(_0x334013){if(_0x334013){return _0x334013['update'](_0x3ed95b)[_0xc6d4('0x23')](function(_0xf4204e){return _0xf4204e;});}return null;};}function removeEntity(_0x40f558){return function(_0x2d6cab){if(_0x2d6cab){return _0x2d6cab[_0xc6d4('0x24')]()[_0xc6d4('0x23')](function(){var _0x105c66=_0x2d6cab['get']({'plain':!![]});var _0x587bff=_0xc6d4('0x25');return db[_0xc6d4('0x26')][_0xc6d4('0x24')]({'where':{'type':_0x587bff,'resourceId':_0x105c66['id']}})[_0xc6d4('0x23')](function(){return _0x2d6cab;});})[_0xc6d4('0x23')](function(){_0x40f558[_0xc6d4('0x1a')](0xcc)[_0xc6d4('0x1b')]();});}};}function handleEntityNotFound(_0x1d6a6a){return function(_0x44897a){if(!_0x44897a){_0x1d6a6a[_0xc6d4('0x27')](0x194);}return _0x44897a;};}function handleError(_0x383b9c,_0x36c0b4){_0x36c0b4=_0x36c0b4||0x1f4;return function(_0x4a5b31){logger[_0xc6d4('0x15')](_0x4a5b31[_0xc6d4('0x28')]);if(_0x4a5b31['name']){delete _0x4a5b31[_0xc6d4('0x29')];}_0x383b9c[_0xc6d4('0x1a')](_0x36c0b4)[_0xc6d4('0x2a')](_0x4a5b31);};}exports['index']=function(_0x4e04f3,_0x20bbcf){var _0x53531e={'include':[{'model':db['MailServerIn'],'as':_0xc6d4('0x2b')},{'model':db[_0xc6d4('0x2c')],'as':_0xc6d4('0x2d')},{'model':db['Pause'],'as':_0xc6d4('0x2e')}]},_0x51eb34={},_0x9ee989={'count':0x0,'rows':[]};var _0x3ac106=_['map'](db[_0xc6d4('0x2f')][_0xc6d4('0x30')],function(_0x1bff08){return{'name':_0x1bff08['fieldName'],'type':_0x1bff08[_0xc6d4('0x31')]['key']};});_0x51eb34[_0xc6d4('0x32')]=_[_0xc6d4('0x33')](_0x3ac106,'name');_0x51eb34[_0xc6d4('0x34')]=_[_0xc6d4('0x35')](_0x4e04f3[_0xc6d4('0x34')]);_0x51eb34['filters']=_['intersection'](_0x51eb34[_0xc6d4('0x32')],_0x51eb34[_0xc6d4('0x34')]);_0x53531e['attributes']=_[_0xc6d4('0x36')](_0x51eb34[_0xc6d4('0x32')],qs[_0xc6d4('0x37')](_0x4e04f3[_0xc6d4('0x34')]['fields']));_0x53531e['attributes']=_0x53531e[_0xc6d4('0x38')][_0xc6d4('0x39')]?_0x53531e['attributes']:_0x51eb34[_0xc6d4('0x32')];if(!_0x4e04f3[_0xc6d4('0x34')][_0xc6d4('0x3a')](_0xc6d4('0x3b'))){_0x53531e[_0xc6d4('0x1e')]=qs[_0xc6d4('0x1e')](_0x4e04f3[_0xc6d4('0x34')][_0xc6d4('0x1e')]);_0x53531e[_0xc6d4('0x1c')]=qs[_0xc6d4('0x1c')](_0x4e04f3[_0xc6d4('0x34')][_0xc6d4('0x1c')]);}_0x53531e[_0xc6d4('0x3c')]=qs[_0xc6d4('0x3d')](_0x4e04f3[_0xc6d4('0x34')][_0xc6d4('0x3d')]);_0x53531e[_0xc6d4('0x3e')]=qs[_0xc6d4('0x3f')](_[_0xc6d4('0x40')](_0x4e04f3[_0xc6d4('0x34')],_0x51eb34[_0xc6d4('0x3f')]),_0x3ac106);if(_0x4e04f3[_0xc6d4('0x34')][_0xc6d4('0x41')]){_0x53531e[_0xc6d4('0x3e')]=_[_0xc6d4('0x42')](_0x53531e[_0xc6d4('0x3e')],{'$or':_['map'](_0x3ac106,function(_0x37fe98){if(_0x37fe98[_0xc6d4('0x31')]!==_0xc6d4('0x43')){var _0x5e2975={};_0x5e2975[_0x37fe98['name']]={'$like':'%'+_0x4e04f3[_0xc6d4('0x34')][_0xc6d4('0x41')]+'%'};return _0x5e2975;}})});}_0x53531e=_[_0xc6d4('0x42')]({},_0x53531e,_0x4e04f3['options']);var _0x1ff060={'where':_0x53531e[_0xc6d4('0x3e')]};return db['MailAccount'][_0xc6d4('0x1f')](_0x1ff060)['then'](function(_0x5a7e81){_0x9ee989['count']=_0x5a7e81;if(_0x4e04f3['query']['includeAll']){_0x53531e[_0xc6d4('0x44')]=[{'all':!![]}];}return db['MailAccount'][_0xc6d4('0x45')](_0x53531e);})[_0xc6d4('0x23')](function(_0x215369){_0x9ee989[_0xc6d4('0x46')]=_0x215369;return _0x9ee989;})[_0xc6d4('0x23')](respondWithFilteredResult(_0x20bbcf,_0x53531e))[_0xc6d4('0x19')](handleError(_0x20bbcf,null));};exports[_0xc6d4('0x47')]=function(_0x2e951f,_0x5f39e0){var _0x558640={'raw':![],'where':{'id':_0x2e951f[_0xc6d4('0x48')]['id']},'include':[{'model':db[_0xc6d4('0x49')],'as':_0xc6d4('0x2b')},{'model':db['MailServerOut'],'as':_0xc6d4('0x2d')},{'model':db[_0xc6d4('0x4a')],'as':_0xc6d4('0x2e')}]},_0x57aa20={};_0x57aa20[_0xc6d4('0x32')]=_[_0xc6d4('0x35')](db[_0xc6d4('0x2f')][_0xc6d4('0x30')]);_0x57aa20[_0xc6d4('0x34')]=_[_0xc6d4('0x35')](_0x2e951f['query']);_0x57aa20[_0xc6d4('0x3f')]=_[_0xc6d4('0x36')](_0x57aa20['model'],_0x57aa20['query']);_0x558640['attributes']=_['intersection'](_0x57aa20[_0xc6d4('0x32')],qs['fields'](_0x2e951f[_0xc6d4('0x34')][_0xc6d4('0x37')]));_0x558640['attributes']=_0x558640[_0xc6d4('0x38')][_0xc6d4('0x39')]?_0x558640['attributes']:_0x57aa20[_0xc6d4('0x32')];if(_0x2e951f[_0xc6d4('0x34')][_0xc6d4('0x4b')]){_0x558640[_0xc6d4('0x44')]=[{'all':!![]}];}_0x558640=_[_0xc6d4('0x42')]({},_0x558640,_0x2e951f['options']);return db['MailAccount'][_0xc6d4('0x4c')](_0x558640)[_0xc6d4('0x23')](handleEntityNotFound(_0x5f39e0,null))[_0xc6d4('0x23')](respondWithResult(_0x5f39e0,null))[_0xc6d4('0x19')](handleError(_0x5f39e0,null));};exports[_0xc6d4('0x4d')]=function(_0x5aa86f,_0x31857a){if(_0x5aa86f[_0xc6d4('0x4e')]['id']){delete _0x5aa86f[_0xc6d4('0x4e')]['id'];}if(_0x5aa86f[_0xc6d4('0x4e')][_0xc6d4('0x2b')]){if(!_0x5aa86f[_0xc6d4('0x4e')][_0xc6d4('0x2b')][_0xc6d4('0x4f')]){_0x5aa86f[_0xc6d4('0x4e')][_0xc6d4('0x2b')][_0xc6d4('0x50')]=null;}}if(_0x5aa86f[_0xc6d4('0x4e')][_0xc6d4('0x2d')]){if(!_0x5aa86f[_0xc6d4('0x4e')][_0xc6d4('0x2d')][_0xc6d4('0x4f')]){_0x5aa86f[_0xc6d4('0x4e')][_0xc6d4('0x2d')][_0xc6d4('0x50')]=null;}}return db['MailAccount'][_0xc6d4('0x4c')]({'where':{'id':_0x5aa86f[_0xc6d4('0x48')]['id']},'include':[{'model':db[_0xc6d4('0x49')],'as':_0xc6d4('0x2b')},{'model':db[_0xc6d4('0x2c')],'as':_0xc6d4('0x2d')},{'model':db['Pause'],'as':'mandatoryDispositionPause'}]})[_0xc6d4('0x23')](handleEntityNotFound(_0x31857a,null))[_0xc6d4('0x23')](saveUpdates(_0x5aa86f[_0xc6d4('0x4e')],null))[_0xc6d4('0x23')](function(_0x386505){if(_0x386505&&_0x5aa86f['body'][_0xc6d4('0x2b')]){return db[_0xc6d4('0x49')][_0xc6d4('0x4d')](_0x5aa86f[_0xc6d4('0x4e')]['Imap'],{'where':{'MailAccountId':_0x386505['id']}})[_0xc6d4('0x23')](function(){return _0x386505;});}return _0x386505;})[_0xc6d4('0x23')](function(_0x42cda7){if(_0x42cda7&&_0x5aa86f[_0xc6d4('0x4e')]['Smtp']){return db[_0xc6d4('0x2c')]['update'](_0x5aa86f['body'][_0xc6d4('0x2d')],{'where':{'MailAccountId':_0x42cda7['id']}})[_0xc6d4('0x23')](function(){return _0x42cda7;});}return _0x42cda7;})[_0xc6d4('0x23')](respondWithResult(_0x31857a,null))[_0xc6d4('0x19')](handleError(_0x31857a,null));};exports['describe']=function(_0x3b2493,_0x25e072){return db[_0xc6d4('0x2f')][_0xc6d4('0x51')]()[_0xc6d4('0x23')](respondWithResult(_0x25e072,null))['catch'](handleError(_0x25e072,null));};exports[_0xc6d4('0x52')]=function(_0xdecd89,_0x57cc8e){if(_0xdecd89[_0xc6d4('0x4e')]['id']){delete _0xdecd89[_0xc6d4('0x4e')]['id'];}return db['MailAccount'][_0xc6d4('0x4c')]({'where':{'id':_0xdecd89[_0xc6d4('0x48')]['id']}})[_0xc6d4('0x23')](handleEntityNotFound(_0x57cc8e,null))[_0xc6d4('0x23')](function(_0x3a04ad){if(_0x3a04ad){_0xdecd89[_0xc6d4('0x4e')][_0xc6d4('0x53')]=_0x3a04ad['id'];return db['Disposition'][_0xc6d4('0x54')](_0xdecd89[_0xc6d4('0x4e')]);}})[_0xc6d4('0x23')](respondWithResult(_0x57cc8e,null))['catch'](handleError(_0x57cc8e,null));};exports['getDispositions']=function(_0x3776c8,_0x896607){var _0x55836c={'raw':![],'where':{}};var _0x4a9ecb={};var _0x239dc1={'count':0x0,'rows':[]};return db[_0xc6d4('0x2f')][_0xc6d4('0x55')]({'where':{'id':_0x3776c8[_0xc6d4('0x48')]['id']}})[_0xc6d4('0x23')](handleEntityNotFound(_0x896607,null))['then'](function(_0x27a97a){if(_0x27a97a){_0x4a9ecb[_0xc6d4('0x32')]=_[_0xc6d4('0x35')](db['Disposition'][_0xc6d4('0x30')]);_0x4a9ecb['query']=_[_0xc6d4('0x35')](_0x3776c8[_0xc6d4('0x34')]);_0x4a9ecb[_0xc6d4('0x3f')]=_['intersection'](_0x4a9ecb['model'],_0x4a9ecb['query']);_0x55836c['attributes']=_[_0xc6d4('0x36')](_0x4a9ecb['model'],qs[_0xc6d4('0x37')](_0x3776c8[_0xc6d4('0x34')]['fields']));_0x55836c[_0xc6d4('0x38')]=_0x55836c[_0xc6d4('0x38')][_0xc6d4('0x39')]?_0x55836c['attributes']:_0x4a9ecb[_0xc6d4('0x32')];if(!_0x3776c8['query'][_0xc6d4('0x3a')]('nolimit')){_0x55836c['limit']=qs[_0xc6d4('0x1e')](_0x3776c8[_0xc6d4('0x34')]['limit']);_0x55836c['offset']=qs[_0xc6d4('0x1c')](_0x3776c8['query'][_0xc6d4('0x1c')]);}_0x55836c[_0xc6d4('0x3c')]=qs[_0xc6d4('0x3d')](_0x3776c8[_0xc6d4('0x34')][_0xc6d4('0x3d')]);_0x55836c[_0xc6d4('0x3e')]=qs[_0xc6d4('0x3f')](_[_0xc6d4('0x40')](_0x3776c8[_0xc6d4('0x34')],_0x4a9ecb[_0xc6d4('0x3f')]));_0x55836c[_0xc6d4('0x3e')]['MailAccountId']=_0x27a97a['id'];if(_0x3776c8[_0xc6d4('0x34')][_0xc6d4('0x41')]){_0x55836c[_0xc6d4('0x3e')]=_['merge'](_0x55836c[_0xc6d4('0x3e')],{'$or':_[_0xc6d4('0x33')](_0x55836c['attributes'],function(_0xca06c2){var _0xc76d4b={};_0xc76d4b[_0xca06c2]={'$like':'%'+_0x3776c8[_0xc6d4('0x34')][_0xc6d4('0x41')]+'%'};return _0xc76d4b;})});}_0x55836c=_[_0xc6d4('0x42')]({},_0x55836c,_0x3776c8[_0xc6d4('0x56')]);return db[_0xc6d4('0x57')][_0xc6d4('0x1f')]({'where':_0x55836c['where']})[_0xc6d4('0x23')](function(_0x47bb9d){_0x239dc1[_0xc6d4('0x1f')]=_0x47bb9d;if(_0x3776c8['query']['includeAll']){_0x55836c[_0xc6d4('0x44')]=[{'all':!![]}];}return db['Disposition'][_0xc6d4('0x45')](_0x55836c);})[_0xc6d4('0x23')](function(_0x48c246){_0x239dc1[_0xc6d4('0x46')]=_0x48c246;return _0x239dc1;});}})[_0xc6d4('0x23')](respondWithFilteredResult(_0x896607,_0x55836c))['catch'](handleError(_0x896607,null));};exports[_0xc6d4('0x58')]=function(_0x32a2b4,_0x3d5e4f){return db[_0xc6d4('0x2f')][_0xc6d4('0x4c')]({'where':{'id':_0x32a2b4[_0xc6d4('0x48')]['id']}})['then'](handleEntityNotFound(_0x3d5e4f,null))[_0xc6d4('0x23')](function(_0xb64184){if(_0xb64184){return _0xb64184[_0xc6d4('0x58')](_0x32a2b4[_0xc6d4('0x34')][_0xc6d4('0x59')]);}})[_0xc6d4('0x23')](respondWithStatusCode(_0x3d5e4f,null))[_0xc6d4('0x19')](handleError(_0x3d5e4f,null));};exports[_0xc6d4('0x5a')]=function(_0xf05df7,_0x97fef9){if(_0xf05df7[_0xc6d4('0x4e')]['id']){delete _0xf05df7[_0xc6d4('0x4e')]['id'];}return db['MailAccount'][_0xc6d4('0x4c')]({'where':{'id':_0xf05df7[_0xc6d4('0x48')]['id']}})['then'](handleEntityNotFound(_0x97fef9,null))[_0xc6d4('0x23')](function(_0x22f135){if(_0x22f135){_0xf05df7[_0xc6d4('0x4e')]['MailAccountId']=_0x22f135['id'];return db[_0xc6d4('0x5b')][_0xc6d4('0x54')](_0xf05df7[_0xc6d4('0x4e')]);}})[_0xc6d4('0x23')](respondWithResult(_0x97fef9,null))[_0xc6d4('0x19')](handleError(_0x97fef9,null));};exports[_0xc6d4('0x5c')]=function(_0x310636,_0x27ed97){var _0x59b471={'raw':![],'where':{}};var _0x27500f={};var _0x4fcae5={'count':0x0,'rows':[]};return db[_0xc6d4('0x2f')]['findOne']({'where':{'id':_0x310636[_0xc6d4('0x48')]['id']}})[_0xc6d4('0x23')](handleEntityNotFound(_0x27ed97,null))[_0xc6d4('0x23')](function(_0x3dfacc){if(_0x3dfacc){_0x27500f[_0xc6d4('0x32')]=_['keys'](db[_0xc6d4('0x5b')][_0xc6d4('0x30')]);_0x27500f[_0xc6d4('0x34')]=_['keys'](_0x310636[_0xc6d4('0x34')]);_0x27500f[_0xc6d4('0x3f')]=_[_0xc6d4('0x36')](_0x27500f[_0xc6d4('0x32')],_0x27500f[_0xc6d4('0x34')]);_0x59b471[_0xc6d4('0x38')]=_['intersection'](_0x27500f[_0xc6d4('0x32')],qs[_0xc6d4('0x37')](_0x310636[_0xc6d4('0x34')]['fields']));_0x59b471['attributes']=_0x59b471[_0xc6d4('0x38')][_0xc6d4('0x39')]?_0x59b471[_0xc6d4('0x38')]:_0x27500f[_0xc6d4('0x32')];if(!_0x310636[_0xc6d4('0x34')][_0xc6d4('0x3a')](_0xc6d4('0x3b'))){_0x59b471['limit']=qs[_0xc6d4('0x1e')](_0x310636[_0xc6d4('0x34')][_0xc6d4('0x1e')]);_0x59b471[_0xc6d4('0x1c')]=qs[_0xc6d4('0x1c')](_0x310636[_0xc6d4('0x34')][_0xc6d4('0x1c')]);}_0x59b471[_0xc6d4('0x3c')]=qs[_0xc6d4('0x3d')](_0x310636[_0xc6d4('0x34')]['sort']);_0x59b471[_0xc6d4('0x3e')]=qs[_0xc6d4('0x3f')](_[_0xc6d4('0x40')](_0x310636[_0xc6d4('0x34')],_0x27500f[_0xc6d4('0x3f')]));_0x59b471[_0xc6d4('0x3e')][_0xc6d4('0x53')]=_0x3dfacc['id'];if(_0x310636[_0xc6d4('0x34')][_0xc6d4('0x41')]){_0x59b471[_0xc6d4('0x3e')]=_[_0xc6d4('0x42')](_0x59b471[_0xc6d4('0x3e')],{'$or':_[_0xc6d4('0x33')](_0x59b471[_0xc6d4('0x38')],function(_0x3d1ba2){var _0x433618={};_0x433618[_0x3d1ba2]={'$like':'%'+_0x310636[_0xc6d4('0x34')][_0xc6d4('0x41')]+'%'};return _0x433618;})});}_0x59b471=_[_0xc6d4('0x42')]({},_0x59b471,_0x310636[_0xc6d4('0x56')]);return db[_0xc6d4('0x5b')][_0xc6d4('0x1f')]({'where':_0x59b471['where']})[_0xc6d4('0x23')](function(_0xb151ca){_0x4fcae5[_0xc6d4('0x1f')]=_0xb151ca;if(_0x310636[_0xc6d4('0x34')][_0xc6d4('0x4b')]){_0x59b471[_0xc6d4('0x44')]=[{'all':!![]}];}return db[_0xc6d4('0x5b')]['findAll'](_0x59b471);})[_0xc6d4('0x23')](function(_0x48e135){_0x4fcae5[_0xc6d4('0x46')]=_0x48e135;return _0x4fcae5;});}})[_0xc6d4('0x23')](respondWithFilteredResult(_0x27ed97,_0x59b471))['catch'](handleError(_0x27ed97,null));};exports[_0xc6d4('0x5d')]=function(_0x3c3fa5,_0x33e5e0){return db[_0xc6d4('0x2f')][_0xc6d4('0x4c')]({'where':{'id':_0x3c3fa5[_0xc6d4('0x48')]['id']}})[_0xc6d4('0x23')](handleEntityNotFound(_0x33e5e0,null))[_0xc6d4('0x23')](function(_0x312ca9){if(_0x312ca9){return _0x312ca9[_0xc6d4('0x5d')](_0x3c3fa5[_0xc6d4('0x34')][_0xc6d4('0x59')]);}})[_0xc6d4('0x23')](respondWithStatusCode(_0x33e5e0,null))[_0xc6d4('0x19')](handleError(_0x33e5e0,null));};exports['create']=function(_0xd12918,_0x2238c4){var _0x5a1620={'name':_0xd12918[_0xc6d4('0x4e')][_0xc6d4('0x29')],'key':_0xd12918[_0xc6d4('0x4e')][_0xc6d4('0x5e')],'provider':_0xd12918[_0xc6d4('0x4e')][_0xc6d4('0x5f')]===_0xc6d4('0x60')?null:_0xd12918[_0xc6d4('0x4e')][_0xc6d4('0x5f')],'email':_0xd12918['body'][_0xc6d4('0x61')],'ListId':_0xd12918['body']['ListId'],'active':!_[_0xc6d4('0x62')](_0xd12918[_0xc6d4('0x4e')][_0xc6d4('0x63')])?_0xd12918['body'][_0xc6d4('0x63')]:!![],'description':_0xd12918[_0xc6d4('0x4e')][_0xc6d4('0x64')]||null,'Imap':{},'Smtp':{}};if(_0x5a1620[_0xc6d4('0x5f')]){_0x5a1620['Imap'][_0xc6d4('0x65')]=_0x5a1620['Smtp']['user']=_0xd12918['body'][_0xc6d4('0x66')];_0x5a1620['Imap'][_0xc6d4('0x67')]=_0x5a1620[_0xc6d4('0x2d')][_0xc6d4('0x68')]=_0xd12918['body']['password'];if(_0xd12918[_0xc6d4('0x4e')][_0xc6d4('0x4f')]){_0x5a1620[_0xc6d4('0x2b')][_0xc6d4('0x4f')]=_0x5a1620['Smtp']['modernAuthentication']=!![];_0x5a1620[_0xc6d4('0x2b')][_0xc6d4('0x50')]=_0x5a1620['Smtp'][_0xc6d4('0x50')]=_0xd12918[_0xc6d4('0x4e')][_0xc6d4('0x50')];_0x5a1620['Imap'][_0xc6d4('0x67')]=_0x5a1620['Smtp'][_0xc6d4('0x68')]=null;}else{_0x5a1620[_0xc6d4('0x2b')][_0xc6d4('0x50')]=_0x5a1620['Smtp']['CloudProviderId']=null;}_0x5a1620[_0xc6d4('0x2b')]['service']=_0x5a1620[_0xc6d4('0x2d')][_0xc6d4('0x69')]=null;_0x5a1620[_0xc6d4('0x2b')][_0xc6d4('0x6a')]=_0x5a1620[_0xc6d4('0x2d')][_0xc6d4('0x6a')]=null;_0x5a1620[_0xc6d4('0x2b')][_0xc6d4('0x6b')]=_0x5a1620['Smtp']['port']=null;}else{if(_0xd12918[_0xc6d4('0x4e')][_0xc6d4('0x6c')]){_0x5a1620[_0xc6d4('0x2b')][_0xc6d4('0x65')]=_0x5a1620[_0xc6d4('0x2d')]['user']=_0xd12918[_0xc6d4('0x4e')][_0xc6d4('0x66')];_0x5a1620['Imap']['password']=_0x5a1620[_0xc6d4('0x2d')][_0xc6d4('0x68')]=_0xd12918[_0xc6d4('0x4e')][_0xc6d4('0x67')];}else{_0x5a1620[_0xc6d4('0x2b')]['authentication']=_0x5a1620[_0xc6d4('0x2d')][_0xc6d4('0x6c')]=![];_0x5a1620[_0xc6d4('0x2b')][_0xc6d4('0x65')]=_0x5a1620[_0xc6d4('0x2d')][_0xc6d4('0x65')]=null;_0x5a1620[_0xc6d4('0x2b')][_0xc6d4('0x67')]=_0x5a1620[_0xc6d4('0x2d')][_0xc6d4('0x68')]=null;}_0x5a1620[_0xc6d4('0x2b')][_0xc6d4('0x6a')]=_0xd12918[_0xc6d4('0x4e')][_0xc6d4('0x2b')]['host'];_0x5a1620[_0xc6d4('0x2b')]['port']=_0xd12918[_0xc6d4('0x4e')][_0xc6d4('0x2b')][_0xc6d4('0x6b')];_0x5a1620[_0xc6d4('0x2d')][_0xc6d4('0x6a')]=_0xd12918[_0xc6d4('0x4e')][_0xc6d4('0x2d')]['host'];_0x5a1620[_0xc6d4('0x2d')][_0xc6d4('0x6b')]=_0xd12918['body']['Smtp'][_0xc6d4('0x6b')];}return db[_0xc6d4('0x2f')][_0xc6d4('0x54')](_0x5a1620,{'include':[{'model':db['MailServerOut'],'as':_0xc6d4('0x2d')},{'model':db['MailServerIn'],'as':_0xc6d4('0x2b')}]})[_0xc6d4('0x23')](function(_0x20d940){var _0x3704c4=_0xd12918[_0xc6d4('0x65')]['get']({'plain':!![]});if(!_0x3704c4)throw new Error(_0xc6d4('0x6d'));if(_0x3704c4[_0xc6d4('0x6e')]===_0xc6d4('0x65')){var _0x2d5413=_0x20d940[_0xc6d4('0x6f')]({'plain':!![]});return db['UserProfileSection'][_0xc6d4('0x4c')]({'where':{'name':'MailAccounts','userProfileId':_0x3704c4[_0xc6d4('0x70')]},'raw':!![]})[_0xc6d4('0x23')](function(_0x2fc22c){if(_0x2fc22c&&_0x2fc22c[_0xc6d4('0x71')]===0x0){return db[_0xc6d4('0x26')][_0xc6d4('0x54')]({'name':_0x2d5413[_0xc6d4('0x29')],'resourceId':_0x2d5413['id'],'type':_0x2fc22c[_0xc6d4('0x29')],'sectionId':_0x2fc22c['id']},{})[_0xc6d4('0x23')](function(){return _0x20d940;});}else{return _0x20d940;}})[_0xc6d4('0x19')](function(_0x40411e){logger[_0xc6d4('0x15')](_0xc6d4('0x72'),_0x40411e);throw _0x40411e;});}return _0x20d940;})[_0xc6d4('0x23')](respondWithResult(_0x2238c4,0xc9))[_0xc6d4('0x19')](handleError(_0x2238c4,null));};exports[_0xc6d4('0x73')]=function(_0x25da4,_0x98dee8){return db[_0xc6d4('0x2f')][_0xc6d4('0x55')]({'where':{'id':_0x25da4[_0xc6d4('0x48')]['id']}})['then'](handleEntityNotFound(_0x98dee8,null))[_0xc6d4('0x23')](function(_0x591900){if(_0x591900){return _0x591900[_0xc6d4('0x73')]();}return null;})[_0xc6d4('0x23')](respondWithResult(_0x98dee8,null))[_0xc6d4('0x19')](handleError(_0x98dee8,null));};exports[_0xc6d4('0x74')]=function(_0xd128a2,_0x2e8a81){if(_0xd128a2[_0xc6d4('0x4e')]['id']){delete _0xd128a2[_0xc6d4('0x4e')]['id'];}return db[_0xc6d4('0x2f')]['find']({'where':{'id':_0xd128a2[_0xc6d4('0x48')]['id']}})[_0xc6d4('0x23')](handleEntityNotFound(_0x2e8a81,null))[_0xc6d4('0x23')](function(_0x126221){if(_0x126221){_0xd128a2[_0xc6d4('0x4e')]['MailAccountId']=_0x126221['id'];return db['MailServerIn']['create'](_0xd128a2[_0xc6d4('0x4e')]);}})['then'](respondWithResult(_0x2e8a81,null))['catch'](handleError(_0x2e8a81,null));};exports[_0xc6d4('0x75')]=function(_0x384d8e,_0x334eff){return db[_0xc6d4('0x2f')]['findOne']({'where':{'id':_0x384d8e[_0xc6d4('0x48')]['id']}})['then'](handleEntityNotFound(_0x334eff,null))[_0xc6d4('0x23')](function(_0x106daf){if(_0x106daf){return _0x106daf[_0xc6d4('0x76')](null);}return null;})['then'](respondWithStatusCode(_0x334eff,null))[_0xc6d4('0x19')](handleError(_0x334eff,null));};exports[_0xc6d4('0x77')]=function(_0x550a94,_0x3b6e75){return db[_0xc6d4('0x2f')][_0xc6d4('0x55')]({'where':{'id':_0x550a94[_0xc6d4('0x48')]['id']}})['then'](handleEntityNotFound(_0x3b6e75,null))[_0xc6d4('0x23')](function(_0x142ec5){if(_0x142ec5){return _0x142ec5[_0xc6d4('0x77')]();}return null;})[_0xc6d4('0x23')](respondWithResult(_0x3b6e75,null))[_0xc6d4('0x19')](handleError(_0x3b6e75,null));};exports[_0xc6d4('0x78')]=function(_0x21ed66,_0x5487b4){if(_0x21ed66[_0xc6d4('0x4e')]['id']){delete _0x21ed66[_0xc6d4('0x4e')]['id'];}return db['MailAccount'][_0xc6d4('0x4c')]({'where':{'id':_0x21ed66[_0xc6d4('0x48')]['id']}})[_0xc6d4('0x23')](handleEntityNotFound(_0x5487b4,null))[_0xc6d4('0x23')](function(_0xf4964c){if(_0xf4964c){_0x21ed66['body'][_0xc6d4('0x53')]=_0xf4964c['id'];return db[_0xc6d4('0x2c')][_0xc6d4('0x54')](_0x21ed66[_0xc6d4('0x4e')]);}})[_0xc6d4('0x23')](respondWithResult(_0x5487b4,null))[_0xc6d4('0x19')](handleError(_0x5487b4,null));};exports[_0xc6d4('0x79')]=function(_0x3b8ed9,_0x51808e){return db[_0xc6d4('0x2f')][_0xc6d4('0x55')]({'where':{'id':_0x3b8ed9['params']['id']}})['then'](handleEntityNotFound(_0x51808e,null))['then'](function(_0x51acb2){if(_0x51acb2){return _0x51acb2['setSmtp'](null);}return null;})[_0xc6d4('0x23')](respondWithStatusCode(_0x51808e,null))['catch'](handleError(_0x51808e,null));};exports['addInteraction']=function(_0x395119,_0x4e85b9){return db[_0xc6d4('0x7a')][_0xc6d4('0x4c')]({'where':{'id':_0x395119['params']['id']}})[_0xc6d4('0x23')](handleEntityNotFound(_0x4e85b9,null))['then'](function(_0xbbeadd){if(_0xbbeadd){return _0xbbeadd['addInteraction'](_0x395119[_0xc6d4('0x4e')][_0xc6d4('0x59')],_[_0xc6d4('0x7b')](_0x395119[_0xc6d4('0x4e')],[_0xc6d4('0x59'),'id'])||{});}})[_0xc6d4('0x23')](respondWithResult(_0x4e85b9,null))[_0xc6d4('0x19')](handleError(_0x4e85b9,null));};exports[_0xc6d4('0x7c')]=function(_0x80d5f,_0x421871){var _0x194b98={'raw':![],'where':{}};var _0x20731a={};var _0x402219={'count':0x0,'rows':[]};return db[_0xc6d4('0x2f')][_0xc6d4('0x55')]({'where':{'id':_0x80d5f[_0xc6d4('0x48')]['id']}})['then'](handleEntityNotFound(_0x421871,null))[_0xc6d4('0x23')](function(_0x2f3490){if(_0x2f3490){_0x20731a[_0xc6d4('0x32')]=_[_0xc6d4('0x35')](db[_0xc6d4('0x7a')][_0xc6d4('0x30')]);_0x20731a[_0xc6d4('0x34')]=_[_0xc6d4('0x35')](_0x80d5f[_0xc6d4('0x34')]);_0x20731a['filters']=_[_0xc6d4('0x36')](_0x20731a['model'],_0x20731a[_0xc6d4('0x34')]);_0x194b98['attributes']=_['intersection'](_0x20731a[_0xc6d4('0x32')],qs[_0xc6d4('0x37')](_0x80d5f[_0xc6d4('0x34')][_0xc6d4('0x37')]));_0x194b98['attributes']=_0x194b98[_0xc6d4('0x38')]['length']?_0x194b98['attributes']:_0x20731a[_0xc6d4('0x32')];if(!_0x80d5f[_0xc6d4('0x34')][_0xc6d4('0x3a')]('nolimit')){_0x194b98[_0xc6d4('0x1e')]=qs[_0xc6d4('0x1e')](_0x80d5f['query'][_0xc6d4('0x1e')]);_0x194b98[_0xc6d4('0x1c')]=qs['offset'](_0x80d5f[_0xc6d4('0x34')][_0xc6d4('0x1c')]);}_0x194b98[_0xc6d4('0x3c')]=qs[_0xc6d4('0x3d')](_0x80d5f['query'][_0xc6d4('0x3d')]);_0x194b98['where']=qs[_0xc6d4('0x3f')](_[_0xc6d4('0x40')](_0x80d5f[_0xc6d4('0x34')],_0x20731a[_0xc6d4('0x3f')]));_0x194b98['where'][_0xc6d4('0x53')]=_0x2f3490['id'];if(_0x80d5f['query'][_0xc6d4('0x41')]){_0x194b98[_0xc6d4('0x3e')]=_[_0xc6d4('0x42')](_0x194b98[_0xc6d4('0x3e')],{'$or':_['map'](_0x194b98[_0xc6d4('0x38')],function(_0x1ade6c){var _0x40e4be={};_0x40e4be[_0x1ade6c]={'$like':'%'+_0x80d5f['query'][_0xc6d4('0x41')]+'%'};return _0x40e4be;})});}_0x194b98=_['merge']({},_0x194b98,_0x80d5f['options']);return db[_0xc6d4('0x7a')][_0xc6d4('0x1f')]({'where':_0x194b98[_0xc6d4('0x3e')]})['then'](function(_0x38a5ac){_0x402219[_0xc6d4('0x1f')]=_0x38a5ac;if(_0x80d5f[_0xc6d4('0x34')][_0xc6d4('0x4b')]){_0x194b98[_0xc6d4('0x44')]=[{'model':db['CmContact'],'as':_0xc6d4('0x7d'),'required':![]},{'model':db['User'],'as':_0xc6d4('0x7e'),'attributes':[_0xc6d4('0x29'),_0xc6d4('0x7f'),_0xc6d4('0x80')],'required':![]},{'model':db['Tag'],'as':_0xc6d4('0x81'),'attributes':['id','name',_0xc6d4('0x82')],'where':_0x80d5f[_0xc6d4('0x34')][_0xc6d4('0x83')]?{'id':_0x80d5f['query'][_0xc6d4('0x83')]}:undefined,'required':_0x80d5f[_0xc6d4('0x34')][_0xc6d4('0x83')]?!![]:![]}];}return db[_0xc6d4('0x7a')][_0xc6d4('0x45')](_0x194b98);})[_0xc6d4('0x23')](function(_0x3e5e9d){_0x402219[_0xc6d4('0x46')]=_0x3e5e9d;return _0x402219;});}})[_0xc6d4('0x23')](respondWithFilteredResult(_0x421871,_0x194b98))['catch'](handleError(_0x421871,null));};exports[_0xc6d4('0x84')]=function addApplications(_0x30e31c,_0x6b5695){var _0x10a708=_0x30e31c[_0xc6d4('0x48')]['id'];var _0x29b720=_0x30e31c[_0xc6d4('0x4e')];var _0x1da9ac=0xc8;var _0x26dcbd=null;return db[_0xc6d4('0x85')][_0xc6d4('0x86')]({'isolationLevel':db[_0xc6d4('0x85')][_0xc6d4('0x87')][_0xc6d4('0x88')][_0xc6d4('0x89')]},function(_0x539807){return db['MailAccount'][_0xc6d4('0x55')]({'where':{'id':_0x10a708},'transaction':_0x539807})[_0xc6d4('0x23')](function(_0x5817e){if(_0x5817e){return db[_0xc6d4('0x8a')][_0xc6d4('0x24')]({'where':{'MailAccountId':_0x10a708},'transaction':_0x539807})[_0xc6d4('0x23')](function(){var _0x23c5ca=_[_0xc6d4('0x33')](_0x29b720,function(_0x3c6735){_0x3c6735['MailAccountId']=_0x10a708;return _0x3c6735;});return db[_0xc6d4('0x8a')][_0xc6d4('0x8b')](_0x23c5ca,{'transaction':_0x539807});});}else{_0x1da9ac=0x194;_0x26dcbd=[];}});})['then'](function(){if(_0x1da9ac!==0x194){return db[_0xc6d4('0x8a')][_0xc6d4('0x8c')]({'where':{'MailAccountId':_0x10a708},'order':_0xc6d4('0x8d')})[_0xc6d4('0x23')](function(_0x3eb330){_0x26dcbd=_0x3eb330;});}})[_0xc6d4('0x19')](function(_0x4e3023){_0x1da9ac=0x1f4;logger[_0xc6d4('0x15')](_0x4e3023[_0xc6d4('0x28')]);if(_0x4e3023[_0xc6d4('0x29')]){delete _0x4e3023[_0xc6d4('0x29')];}_0x26dcbd=_0x4e3023;})[_0xc6d4('0x8e')](function(){if(_0x26dcbd===null){_0x6b5695[_0xc6d4('0x27')](_0x1da9ac);}else{if(_0x1da9ac===0x1f4){_0x6b5695[_0xc6d4('0x1a')](_0x1da9ac)[_0xc6d4('0x2a')](_0x26dcbd);}else{_0x6b5695[_0xc6d4('0x1a')](_0x1da9ac)['json'](_0x26dcbd);}}});};exports['getApplications']=function(_0x134d95,_0x368dd9){var _0x133e97={};var _0xa3816b={};var _0x1541c5;var _0x1c87d0;return db[_0xc6d4('0x2f')][_0xc6d4('0x55')]({'where':{'id':_0x134d95[_0xc6d4('0x48')]['id']}})[_0xc6d4('0x23')](handleEntityNotFound(_0x368dd9,null))[_0xc6d4('0x23')](function(_0x17f6ec){if(_0x17f6ec){_0x1541c5=_0x17f6ec;_0xa3816b[_0xc6d4('0x32')]=_[_0xc6d4('0x35')](db[_0xc6d4('0x8a')][_0xc6d4('0x30')]);_0xa3816b[_0xc6d4('0x34')]=_[_0xc6d4('0x35')](_0x134d95[_0xc6d4('0x34')]);_0xa3816b[_0xc6d4('0x3f')]=_[_0xc6d4('0x36')](_0xa3816b[_0xc6d4('0x32')],_0xa3816b['query']);_0x133e97[_0xc6d4('0x38')]=_[_0xc6d4('0x36')](_0xa3816b[_0xc6d4('0x32')],qs['fields'](_0x134d95[_0xc6d4('0x34')][_0xc6d4('0x37')]));_0x133e97[_0xc6d4('0x38')]=_0x133e97[_0xc6d4('0x38')][_0xc6d4('0x39')]?_0x133e97[_0xc6d4('0x38')]:_0xa3816b[_0xc6d4('0x32')];_0x133e97[_0xc6d4('0x3c')]=qs[_0xc6d4('0x3d')](_0x134d95[_0xc6d4('0x34')][_0xc6d4('0x3d')]);_0x133e97[_0xc6d4('0x3e')]=qs[_0xc6d4('0x3f')](_[_0xc6d4('0x40')](_0x134d95[_0xc6d4('0x34')],_0xa3816b['filters']));if(_0x134d95[_0xc6d4('0x34')][_0xc6d4('0x41')]){_0x133e97[_0xc6d4('0x3e')]=_[_0xc6d4('0x42')](_0x133e97[_0xc6d4('0x3e')],{'$or':_[_0xc6d4('0x33')](_0x133e97[_0xc6d4('0x38')],function(_0x550864){var _0x2b9466={};_0x2b9466[_0x550864]={'$like':'%'+_0x134d95['query']['filter']+'%'};return _0x2b9466;})});}_0x133e97=_[_0xc6d4('0x42')]({},_0x133e97,_0x134d95['options']);return _0x1541c5[_0xc6d4('0x8f')](_0x133e97);}})[_0xc6d4('0x23')](function(_0x3daea2){if(_0x3daea2){_0x1c87d0=_0x3daea2['length'];if(!_0x134d95[_0xc6d4('0x34')][_0xc6d4('0x3a')](_0xc6d4('0x3b'))){_0x133e97['limit']=qs[_0xc6d4('0x1e')](_0x134d95[_0xc6d4('0x34')][_0xc6d4('0x1e')]);_0x133e97[_0xc6d4('0x1c')]=qs[_0xc6d4('0x1c')](_0x134d95[_0xc6d4('0x34')][_0xc6d4('0x1c')]);}return _0x1541c5[_0xc6d4('0x8f')](_0x133e97);}})[_0xc6d4('0x23')](function(_0x1a2130){if(_0x1a2130){return _0x1a2130?{'count':_0x1c87d0,'rows':_0x1a2130}:null;}})[_0xc6d4('0x23')](respondWithResult(_0x368dd9,null))['catch'](handleError(_0x368dd9,null));};exports['getMessages']=function(_0x5dd725,_0x1918b8){var _0x512321={'raw':!![],'where':{}};var _0x4ed38f={};var _0x2c6f69={'count':0x0,'rows':[]};return db[_0xc6d4('0x2f')][_0xc6d4('0x55')]({'where':{'id':_0x5dd725[_0xc6d4('0x48')]['id']}})['then'](handleEntityNotFound(_0x1918b8,null))['then'](function(_0x4f88d4){if(_0x4f88d4){_0x4ed38f[_0xc6d4('0x32')]=_[_0xc6d4('0x35')](db['MailMessage'][_0xc6d4('0x30')]);_0x4ed38f[_0xc6d4('0x34')]=_[_0xc6d4('0x35')](_0x5dd725[_0xc6d4('0x34')]);_0x4ed38f[_0xc6d4('0x3f')]=_[_0xc6d4('0x36')](_0x4ed38f[_0xc6d4('0x32')],_0x4ed38f[_0xc6d4('0x34')]);_0x512321[_0xc6d4('0x38')]=_[_0xc6d4('0x36')](_0x4ed38f[_0xc6d4('0x32')],qs[_0xc6d4('0x37')](_0x5dd725[_0xc6d4('0x34')][_0xc6d4('0x37')]));_0x512321['attributes']=_0x512321[_0xc6d4('0x38')][_0xc6d4('0x39')]?_0x512321['attributes']:_0x4ed38f['model'];if(!_0x5dd725[_0xc6d4('0x34')][_0xc6d4('0x3a')]('nolimit')){_0x512321[_0xc6d4('0x1e')]=qs[_0xc6d4('0x1e')](_0x5dd725[_0xc6d4('0x34')][_0xc6d4('0x1e')]);_0x512321[_0xc6d4('0x1c')]=qs[_0xc6d4('0x1c')](_0x5dd725[_0xc6d4('0x34')][_0xc6d4('0x1c')]);}_0x512321[_0xc6d4('0x3c')]=qs['sort'](_0x5dd725[_0xc6d4('0x34')]['sort']);_0x512321['where']=qs[_0xc6d4('0x3f')](_['pick'](_0x5dd725[_0xc6d4('0x34')],_0x4ed38f[_0xc6d4('0x3f')]));_0x512321[_0xc6d4('0x3e')]['MailAccountId']=_0x4f88d4['id'];if(_0x5dd725[_0xc6d4('0x34')]['filter']){_0x512321[_0xc6d4('0x3e')]=_['merge'](_0x512321[_0xc6d4('0x3e')],{'$or':_[_0xc6d4('0x33')](_0x512321[_0xc6d4('0x38')],function(_0x285d18){var _0x21a1cb={};_0x21a1cb[_0x285d18]={'$like':'%'+_0x5dd725[_0xc6d4('0x34')][_0xc6d4('0x41')]+'%'};return _0x21a1cb;})});}if(_0x5dd725['query'][_0xc6d4('0x90')]){var _0x207f94=_0x5dd725['query']['$gte'][_0xc6d4('0x91')](',');var _0x19f041={};_0x19f041[_0x207f94[0x0]]={'$gte':moment(_0x207f94[0x1])[_0xc6d4('0x92')](_0xc6d4('0x93'))};_0x512321[_0xc6d4('0x3e')]=_[_0xc6d4('0x42')](_0x512321['where'],_0x19f041);}_0x512321=_[_0xc6d4('0x42')]({},_0x512321,_0x5dd725['options']);return db[_0xc6d4('0x94')][_0xc6d4('0x1f')]({'where':_0x512321[_0xc6d4('0x3e')]})['then'](function(_0x3e7d6a){_0x2c6f69[_0xc6d4('0x1f')]=_0x3e7d6a;if(_0x5dd725['query'][_0xc6d4('0x4b')]){_0x512321[_0xc6d4('0x44')]=[{'all':!![]}];}return db[_0xc6d4('0x94')][_0xc6d4('0x45')](_0x512321);})['then'](function(_0x342caf){if(_0x5dd725[_0xc6d4('0x34')]['inlineCss']===_0xc6d4('0x95')){for(var _0x3375bb=0x0;_0x3375bb<_0x342caf[_0xc6d4('0x39')];_0x3375bb++){_0x342caf[_0x3375bb][_0xc6d4('0x4e')]=juice(_0x342caf[_0x3375bb]['body']);}}_0x2c6f69[_0xc6d4('0x46')]=_0x342caf;return _0x2c6f69;});}})[_0xc6d4('0x23')](respondWithFilteredResult(_0x1918b8,_0x512321))['catch'](handleError(_0x1918b8,null));};exports[_0xc6d4('0x2a')]=function(_0x13fd49,_0x245b11){var _0x28a272,_0xd88795={},_0x5a8eef;if(_0x13fd49[_0xc6d4('0x4e')]['to']){_0x5a8eef=_0x13fd49[_0xc6d4('0x4e')]['to']['split'](',')[0x0];}return db[_0xc6d4('0x2f')][_0xc6d4('0x4c')]({'where':{'id':_0x13fd49[_0xc6d4('0x48')]['id']},'include':[{'model':db[_0xc6d4('0x96')],'as':_0xc6d4('0x97'),'include':[{'model':db[_0xc6d4('0x98')],'as':_0xc6d4('0x99'),'where':{'email':_0x5a8eef},'limit':0x1,'order':[['updatedAt',_0xc6d4('0x9a')]]}]},{'model':db[_0xc6d4('0x2c')],'as':_0xc6d4('0x2d'),'raw':!![]}]})[_0xc6d4('0x23')](handleEntityNotFound(_0x245b11,null))['then'](function(_0xa9b280){if(_0xa9b280){_0x28a272=_0xa9b280;if(_0xa9b280[_0xc6d4('0x2d')]){if(_[_0xc6d4('0x62')](_0x13fd49[_0xc6d4('0x4e')][_0xc6d4('0x9b')])){_0x13fd49['body'][_0xc6d4('0x9b')]=util[_0xc6d4('0x92')](_0xc6d4('0x9c'),_0xa9b280[_0xc6d4('0x29')],_0xa9b280['email']||_0xa9b280['Smtp']['user']);}if(_0x13fd49[_0xc6d4('0x4e')]['attachments']&&_0x13fd49[_0xc6d4('0x4e')][_0xc6d4('0x9d')][_0xc6d4('0x39')]){for(var _0x3c6528=0x0;_0x3c6528<_0x13fd49[_0xc6d4('0x4e')][_0xc6d4('0x9d')][_0xc6d4('0x39')];_0x3c6528+=0x1){_0x13fd49[_0xc6d4('0x4e')][_0xc6d4('0x9d')][_0x3c6528]={'filename':_0x13fd49[_0xc6d4('0x4e')][_0xc6d4('0x9d')][_0x3c6528][_0xc6d4('0x29')],'path':path[_0xc6d4('0x9e')](config[_0xc6d4('0x9f')],_0xc6d4('0xa0'),_0x13fd49[_0xc6d4('0x4e')][_0xc6d4('0x9d')][_0x3c6528][_0xc6d4('0xa1')])};}}var _0x33172d={'tls':{'rejectUnauthorized':![]}};if(_[_0xc6d4('0x62')](_0xa9b280[_0xc6d4('0x2d')][_0xc6d4('0x69')])){if(_0xa9b280[_0xc6d4('0x2d')][_0xc6d4('0x6c')]){_0x33172d[_0xc6d4('0xa2')]={'user':_0xa9b280[_0xc6d4('0x2d')][_0xc6d4('0x65')],'pass':_0xa9b280['Smtp']['pass']};}_0x33172d[_0xc6d4('0x6a')]=_0xa9b280[_0xc6d4('0x2d')][_0xc6d4('0x6a')];_0x33172d['port']=_0xa9b280[_0xc6d4('0x2d')][_0xc6d4('0x6b')];_0x33172d['secure']=_0xa9b280[_0xc6d4('0x2d')][_0xc6d4('0xa3')];}else{_0x33172d[_0xc6d4('0x69')]=_0xa9b280['Smtp']['service'];_0x33172d[_0xc6d4('0xa2')]={'user':_0xa9b280[_0xc6d4('0x2d')]['user'],'pass':_0xa9b280[_0xc6d4('0x2d')][_0xc6d4('0x68')]};}return respondWithRpcPromise(_0xc6d4('0xa4'),_0xc6d4('0xa5'),{'account':_0x33172d,'message':_0x13fd49[_0xc6d4('0x4e')]});}else{throw new Error('List\x20not\x20found');}}})[_0xc6d4('0x23')](function(_0x83cb62){if(_0x83cb62){_0xd88795=_0x83cb62;if(_0x28a272[_0xc6d4('0x97')]){if(_0x28a272[_0xc6d4('0x97')]['Contacts'][_0xc6d4('0x39')]){return _0x28a272[_0xc6d4('0x97')][_0xc6d4('0x99')][0x0];}else{return db[_0xc6d4('0x98')]['create'](_['defaults'](_0x13fd49['body'],{'firstName':_0x13fd49[_0xc6d4('0x4e')]['to'],'email':_0x13fd49['body']['to'],'phone':_0x13fd49['body']['to'],'ListId':_0x28a272[_0xc6d4('0xa6')]}));}}else{throw new Error(_0xc6d4('0xa7'));}}})[_0xc6d4('0x23')](function(_0x4c30e7){if(_0x4c30e7){var _0x3b436b={'UserId':_0x13fd49[_0xc6d4('0x65')]['id'],'ContactId':_0x4c30e7['id'],'MailAccountId':_0x28a272['id'],'inReplyTo':_0xd88795['messageId'],'to':_0x13fd49['body'][_0xc6d4('0x9b')],'cc':_0x13fd49[_0xc6d4('0x4e')]['cc'],'subject':_0x13fd49[_0xc6d4('0x4e')]['subject'],'attach':_0x13fd49['body']['attach'],'firstMsgDirection':_0xc6d4('0xa8'),'lastMsgAt':moment()[_0xc6d4('0x92')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':_0xc6d4('0xa8'),'Messages':[_[_0xc6d4('0x42')](_0x13fd49[_0xc6d4('0x4e')],{'messageId':_0xd88795[_0xc6d4('0xa9')],'sentAt':moment()[_0xc6d4('0x92')]('YYYY-MM-DD\x20HH:mm:ss'),'read':!![],'MailAccountId':_0x28a272['id'],'UserId':_0x13fd49[_0xc6d4('0x65')]['id'],'ContactId':_0x4c30e7['id']})]};if(_0x13fd49[_0xc6d4('0x4e')][_0xc6d4('0xaa')]){_0x3b436b=_['merge'](_0x3b436b,_0x13fd49[_0xc6d4('0x4e')][_0xc6d4('0xaa')]);}return db[_0xc6d4('0x7a')]['create'](_0x3b436b,{'include':[{'model':db[_0xc6d4('0x94')],'as':'Messages'}]});}})['then'](respondWithResult(_0x245b11,null))[_0xc6d4('0x19')](handleError(_0x245b11,null));};exports[_0xc6d4('0xab')]=function(_0x1ef039,_0x4ff164){return db[_0xc6d4('0x2f')][_0xc6d4('0x4c')]({'where':{'id':_0x1ef039[_0xc6d4('0x48')]['id']},'include':[{'model':db[_0xc6d4('0x2c')],'as':_0xc6d4('0x2d'),'raw':!![],'include':[{'model':db[_0xc6d4('0xac')],'as':'CloudProvider','raw':!![]}]}]})[_0xc6d4('0x23')](handleEntityNotFound(_0x4ff164,null))[_0xc6d4('0x23')](function(_0x4fe419){if(!_0x4fe419[_0xc6d4('0x2d')])return;var _0x1e8034={'id':_0x4fe419['id'],'tls':{'rejectUnauthorized':![]}};if(_0x4fe419[_0xc6d4('0x5f')]!==_0xc6d4('0x60')){_0x1e8034[_0xc6d4('0x69')]=_0x4fe419[_0xc6d4('0x5f')];}else{_0x1e8034[_0xc6d4('0x6a')]=_0x4fe419[_0xc6d4('0x2d')][_0xc6d4('0x6a')];_0x1e8034['port']=_0x4fe419['Smtp'][_0xc6d4('0x6b')];_0x1e8034[_0xc6d4('0xa3')]=_0x4fe419[_0xc6d4('0x2d')][_0xc6d4('0xa3')];}if(_0x4fe419[_0xc6d4('0x2d')][_0xc6d4('0x6c')]){if(_0x4fe419['Smtp'][_0xc6d4('0x4f')]){_0x1e8034[_0xc6d4('0xa2')]={'type':_0xc6d4('0xad'),'user':_0x4fe419[_0xc6d4('0x2d')]['user'],'accessToken':_0x4fe419['Smtp'][_0xc6d4('0xac')][_0xc6d4('0xae')]};}else{_0x1e8034[_0xc6d4('0xa2')]={'user':_0x4fe419[_0xc6d4('0x2d')]['user'],'pass':_0x4fe419[_0xc6d4('0x2d')][_0xc6d4('0x68')]};}}return respondWithRpcPromise('VerifySmtp',_0xc6d4('0xab'),{'account':_0x1e8034});})[_0xc6d4('0x23')](respondWithResult(_0x4ff164,null))['catch'](handleError(_0x4ff164,null));};exports[_0xc6d4('0x24')]=function(_0x5e1e89,_0x462a37){return db[_0xc6d4('0x2f')][_0xc6d4('0x4c')]({'where':{'id':_0x5e1e89[_0xc6d4('0x48')]['id']}})[_0xc6d4('0x23')](handleEntityNotFound(_0x462a37,null))[_0xc6d4('0x23')](function(_0x5f54e2){if(_0x5f54e2&&_0x5f54e2[_0xc6d4('0x69')]){throw new db[(_0xc6d4('0xaf'))]['ValidationError']('You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account');}return _0x5f54e2;})[_0xc6d4('0x23')](removeEntity(_0x462a37,null))[_0xc6d4('0x19')](handleError(_0x462a37,null));};exports[_0xc6d4('0xb0')]=function(_0x2f5644,_0x47649c){return db[_0xc6d4('0x2f')][_0xc6d4('0x4c')]({'where':{'id':_0x2f5644[_0xc6d4('0x48')]['id']}})[_0xc6d4('0x23')](handleEntityNotFound(_0x47649c,null))[_0xc6d4('0x23')](function(_0x52a1c4){if(_0x52a1c4){return _0x52a1c4['addAgents'](_0x2f5644[_0xc6d4('0x4e')][_0xc6d4('0x59')],_[_0xc6d4('0x7b')](_0x2f5644[_0xc6d4('0x4e')],['ids','id'])||{})[_0xc6d4('0xb1')](function(_0x117f84){for(var _0x1f2982=0x0;_0x1f2982<_0x2f5644[_0xc6d4('0x4e')]['ids']['length'];_0x1f2982+=0x1){socket[_0xc6d4('0xb2')](_0xc6d4('0xb3'),{'UserId':Number(_0x2f5644[_0xc6d4('0x4e')]['ids'][_0x1f2982]),'MailAccountId':Number(_0x2f5644[_0xc6d4('0x48')]['id'])});}return _0x117f84;});}})['then'](respondWithResult(_0x47649c,null))['catch'](handleError(_0x47649c,null));};exports[_0xc6d4('0xb4')]=function(_0x21a37f,_0x13e3d4){return db['MailAccount'][_0xc6d4('0x4c')]({'where':{'id':_0x21a37f['params']['id']}})[_0xc6d4('0x23')](handleEntityNotFound(_0x13e3d4,null))[_0xc6d4('0x23')](function(_0x16a5d5){if(_0x16a5d5){return _0x16a5d5[_0xc6d4('0xb4')](_0x21a37f[_0xc6d4('0x34')][_0xc6d4('0x59')])[_0xc6d4('0x23')](function(){if(_[_0xc6d4('0xb5')](_0x21a37f[_0xc6d4('0x34')][_0xc6d4('0x59')])){for(var _0x5a893e=0x0;_0x5a893e<_0x21a37f[_0xc6d4('0x34')][_0xc6d4('0x59')][_0xc6d4('0x39')];_0x5a893e+=0x1){socket[_0xc6d4('0xb2')](_0xc6d4('0xb6'),{'UserId':Number(_0x21a37f[_0xc6d4('0x34')]['ids'][_0x5a893e]),'MailAccountId':Number(_0x21a37f[_0xc6d4('0x48')]['id'])});}}else{socket['emit'](_0xc6d4('0xb6'),{'UserId':Number(_0x21a37f[_0xc6d4('0x34')][_0xc6d4('0x59')]),'MailAccountId':Number(_0x21a37f[_0xc6d4('0x48')]['id'])});}});}})[_0xc6d4('0x23')](respondWithStatusCode(_0x13e3d4,null))['catch'](handleError(_0x13e3d4,null));};exports[_0xc6d4('0xb7')]=function(_0x40e6bd,_0x260893){var _0x1298e1={};var _0x3a4f3f={};var _0x423c48;var _0x3b73af;return db['MailAccount'][_0xc6d4('0x55')]({'where':{'id':_0x40e6bd[_0xc6d4('0x48')]['id']}})['then'](handleEntityNotFound(_0x260893,null))['then'](function(_0x165bdf){if(_0x165bdf){_0x423c48=_0x165bdf;_0x3a4f3f[_0xc6d4('0x32')]=_['keys'](db[_0xc6d4('0xb8')][_0xc6d4('0x30')]);_0x3a4f3f['query']=_[_0xc6d4('0x35')](_0x40e6bd[_0xc6d4('0x34')]);_0x3a4f3f[_0xc6d4('0x3f')]=_[_0xc6d4('0x36')](_0x3a4f3f['model'],_0x3a4f3f[_0xc6d4('0x34')]);_0x1298e1['attributes']=_[_0xc6d4('0x36')](_0x3a4f3f[_0xc6d4('0x32')],qs[_0xc6d4('0x37')](_0x40e6bd[_0xc6d4('0x34')][_0xc6d4('0x37')]));_0x1298e1['attributes']=_0x1298e1[_0xc6d4('0x38')][_0xc6d4('0x39')]?_0x1298e1[_0xc6d4('0x38')]:_0x3a4f3f[_0xc6d4('0x32')];_0x1298e1[_0xc6d4('0x3c')]=qs[_0xc6d4('0x3d')](_0x40e6bd[_0xc6d4('0x34')][_0xc6d4('0x3d')]);_0x1298e1['where']=qs[_0xc6d4('0x3f')](_[_0xc6d4('0x40')](_0x40e6bd[_0xc6d4('0x34')],_0x3a4f3f['filters']));if(_0x40e6bd[_0xc6d4('0x34')][_0xc6d4('0x41')]){_0x1298e1[_0xc6d4('0x3e')]=_[_0xc6d4('0x42')](_0x1298e1[_0xc6d4('0x3e')],{'$or':_[_0xc6d4('0x33')](_0x1298e1[_0xc6d4('0x38')],function(_0x14a58e){var _0x1171f5={};_0x1171f5[_0x14a58e]={'$like':'%'+_0x40e6bd[_0xc6d4('0x34')]['filter']+'%'};return _0x1171f5;})});}_0x1298e1=_[_0xc6d4('0x42')]({},_0x1298e1,_0x40e6bd[_0xc6d4('0x56')]);return _0x423c48[_0xc6d4('0xb7')](_0x1298e1);}})[_0xc6d4('0x23')](function(_0x435ea3){if(_0x435ea3){_0x3b73af=_0x435ea3[_0xc6d4('0x39')];if(!_0x40e6bd['query']['hasOwnProperty']('nolimit')){_0x1298e1[_0xc6d4('0x1e')]=qs[_0xc6d4('0x1e')](_0x40e6bd['query'][_0xc6d4('0x1e')]);_0x1298e1[_0xc6d4('0x1c')]=qs[_0xc6d4('0x1c')](_0x40e6bd[_0xc6d4('0x34')][_0xc6d4('0x1c')]);}return _0x423c48[_0xc6d4('0xb7')](_0x1298e1);}})['then'](function(_0x493558){if(_0x493558){return _0x493558?{'count':_0x3b73af,'rows':_0x493558}:null;}})['then'](respondWithResult(_0x260893,null))[_0xc6d4('0x19')](handleError(_0x260893,null));}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.events.js b/server/api/mailAccount/mailAccount.events.js index 75bd301..28808f9 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 _0x68fd=['exports','events','MailAccount','setMaxListeners','update','remove','emit','hasOwnProperty'];(function(_0x5d6456,_0x58ecc7){var _0x4d66c1=function(_0x4335e3){while(--_0x4335e3){_0x5d6456['push'](_0x5d6456['shift']());}};_0x4d66c1(++_0x58ecc7);}(_0x68fd,0x1e9));var _0xd68f=function(_0x23f0b7,_0x4b1449){_0x23f0b7=_0x23f0b7-0x0;var _0x588630=_0x68fd[_0x23f0b7];return _0x588630;};'use strict';var EventEmitter=require(_0xd68f('0x0'));var MailAccount=require('../../mysqldb')['db'][_0xd68f('0x1')];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0xd68f('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xd68f('0x3'),'afterDestroy':_0xd68f('0x4')};function emitEvent(_0x96d959){return function(_0x3e5e78,_0x37c481,_0x9814cb){MailAccountEvents[_0xd68f('0x5')](_0x96d959+':'+_0x3e5e78['id'],_0x3e5e78);MailAccountEvents[_0xd68f('0x5')](_0x96d959,_0x3e5e78);_0x9814cb(null);};}for(var e in events){if(events[_0xd68f('0x6')](e)){var event=events[e];MailAccount['hook'](e,emitEvent(event));}}module[_0xd68f('0x7')]=MailAccountEvents; \ No newline at end of file +var _0x22a7=['MailAccount','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','events','../../mysqldb'];(function(_0x563bfd,_0x5bc00b){var _0x27972f=function(_0x2814c9){while(--_0x2814c9){_0x563bfd['push'](_0x563bfd['shift']());}};_0x27972f(++_0x5bc00b);}(_0x22a7,0xe4));var _0x722a=function(_0x3c182f,_0x11141e){_0x3c182f=_0x3c182f-0x0;var _0x2c2e17=_0x22a7[_0x3c182f];return _0x2c2e17;};'use strict';var EventEmitter=require(_0x722a('0x0'));var MailAccount=require(_0x722a('0x1'))['db'][_0x722a('0x2')];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0x722a('0x3')](0x0);var events={'afterCreate':_0x722a('0x4'),'afterUpdate':_0x722a('0x5'),'afterDestroy':_0x722a('0x6')};function emitEvent(_0x43a0f5){return function(_0x464d07,_0x462040,_0x2b51f3){MailAccountEvents['emit'](_0x43a0f5+':'+_0x464d07['id'],_0x464d07);MailAccountEvents[_0x722a('0x7')](_0x43a0f5,_0x464d07);_0x2b51f3(null);};}for(var e in events){if(events[_0x722a('0x8')](e)){var event=events[e];MailAccount[_0x722a('0x9')](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 ee41469..d8abe30 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 _0x2c72=['moment','bluebird','path','rimraf','./mailAccount.attributes','exports','define','MailAccount','lodash','util','../../config/logger','api'];(function(_0x49bb5f,_0x734aeb){var _0x1c9d67=function(_0x22afab){while(--_0x22afab){_0x49bb5f['push'](_0x49bb5f['shift']());}};_0x1c9d67(++_0x734aeb);}(_0x2c72,0xe0));var _0x22c7=function(_0xd66d56,_0x39193d){_0xd66d56=_0xd66d56-0x0;var _0x4b6e14=_0x2c72[_0xd66d56];return _0x4b6e14;};'use strict';var _=require(_0x22c7('0x0'));var util=require(_0x22c7('0x1'));var logger=require(_0x22c7('0x2'))(_0x22c7('0x3'));var moment=require(_0x22c7('0x4'));var BPromise=require(_0x22c7('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x22c7('0x6'));var rimraf=require(_0x22c7('0x7'));var config=require('../../config/environment');var attributes=require(_0x22c7('0x8'));module[_0x22c7('0x9')]=function(_0x3ae884,_0xaaab89){return _0x3ae884[_0x22c7('0xa')](_0x22c7('0xb'),attributes,{'tableName':'mail_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8945=['exports','define','MailAccount','mail_accounts','lodash','util','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','./mailAccount.attributes'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x8945,0xa0));var _0x5894=function(_0x102b8f,_0x156488){_0x102b8f=_0x102b8f-0x0;var _0x24d5ec=_0x8945[_0x102b8f];return _0x24d5ec;};'use strict';var _=require(_0x5894('0x0'));var util=require(_0x5894('0x1'));var logger=require(_0x5894('0x2'))(_0x5894('0x3'));var moment=require(_0x5894('0x4'));var BPromise=require('bluebird');var rp=require(_0x5894('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5894('0x6'));var config=require(_0x5894('0x7'));var attributes=require(_0x5894('0x8'));module[_0x5894('0x9')]=function(_0x22f2ca,_0x149d33){return _0x22f2ca[_0x5894('0xa')](_0x5894('0xb'),attributes,{'tableName':_0x5894('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 5a751a2..358a556 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 _0x217c=['applications','orderBy','priority','asc','autoclose','push','length','close','*,*,*,*','create','List\x20not\x20found','messageId','generate','subject','format','YYYY-MM-DD\x20HH:mm:ss','MailInteraction','MailMessage','inReplyTo','update','attach','interaction','created','contact','attachments','originTo','originCc','originChannel','Email','ChatOfflineMessageId','Attachment','Attachments','User','name','unshift','waitForTheAssignedAgent','Start','startRouting','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','register','request','then','info','MailAccount,\x20%s,\x20%s','request\x20sent','error','message','result','catch','GetMailAccount','MailAccount','findAll','options','raw','where','limit','include','map','model','attributes','stringify','ShowMailAccount','find','debug','NotifyMailAccount','body','mail','difference','keys','CmContact','rawAttributes','createdAt','updatedAt','CompanyId','ListId','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','CmList','Contacts','DESC','MailApplication','Smtp','List','get','omit','Applications'];(function(_0x1096ad,_0x5c8f00){var _0x22baf6=function(_0x560001){while(--_0x560001){_0x1096ad['push'](_0x1096ad['shift']());}};_0x22baf6(++_0x5c8f00);}(_0x217c,0x8f));var _0xc217=function(_0x513d02,_0x31edcf){_0x513d02=_0x513d02-0x0;var _0x40e406=_0x217c[_0x513d02];return _0x40e406;};'use strict';var _=require(_0xc217('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xc217('0x1'));var rs=require(_0xc217('0x2'));var fs=require('fs');var Redis=require(_0xc217('0x3'));var db=require(_0xc217('0x4'))['db'];var utils=require(_0xc217('0x5'));var logger=require(_0xc217('0x6'))(_0xc217('0x7'));var config=require('../../config/environment');var jayson=require(_0xc217('0x8'));var client=jayson[_0xc217('0x9')][_0xc217('0xa')]({'port':0x232c});config[_0xc217('0xb')]=_[_0xc217('0xc')](config[_0xc217('0xb')],{'host':_0xc217('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xc217('0xb')]));require('./mailAccount.socket')[_0xc217('0xe')](socket);function respondWithRpcPromise(_0x3f3815,_0x1452ba,_0x132804){return new BPromise(function(_0x2c9f3f,_0x5a093b){return client[_0xc217('0xf')](_0x3f3815,_0x132804)[_0xc217('0x10')](function(_0x4acb2f){logger[_0xc217('0x11')](_0xc217('0x12'),_0x1452ba,'request\x20sent');logger['debug']('MailAccount,\x20%s,\x20%s,\x20%s',_0x1452ba,_0xc217('0x13'),JSON['stringify'](_0x4acb2f));if(_0x4acb2f['error']){if(_0x4acb2f[_0xc217('0x14')]['code']===0x1f4){logger[_0xc217('0x14')]('MailAccount,\x20%s,\x20%s',_0x1452ba,_0x4acb2f[_0xc217('0x14')][_0xc217('0x15')]);return _0x5a093b(_0x4acb2f[_0xc217('0x14')]['message']);}logger['error']('MailAccount,\x20%s,\x20%s',_0x1452ba,_0x4acb2f['error']['message']);return _0x2c9f3f(_0x4acb2f[_0xc217('0x14')][_0xc217('0x15')]);}else{logger[_0xc217('0x11')](_0xc217('0x12'),_0x1452ba,_0xc217('0x13'));_0x2c9f3f(_0x4acb2f[_0xc217('0x16')][_0xc217('0x15')]);}})[_0xc217('0x17')](function(_0x5b305a){logger[_0xc217('0x14')]('MailAccount,\x20%s,\x20%s',_0x1452ba,_0x5b305a);_0x5a093b(_0x5b305a);});});}exports[_0xc217('0x18')]=function(_0x1f4858){var _0x327d15=this;return new Promise(function(_0x22be11,_0x44fc2f){return db[_0xc217('0x19')][_0xc217('0x1a')]({'raw':_0x1f4858[_0xc217('0x1b')]?_0x1f4858[_0xc217('0x1b')][_0xc217('0x1c')]===undefined?!![]:![]:!![],'where':_0x1f4858[_0xc217('0x1b')]?_0x1f4858['options'][_0xc217('0x1d')]||null:null,'attributes':_0x1f4858[_0xc217('0x1b')]?_0x1f4858[_0xc217('0x1b')]['attributes']||null:null,'limit':_0x1f4858[_0xc217('0x1b')]?_0x1f4858[_0xc217('0x1b')][_0xc217('0x1e')]||null:null,'include':_0x1f4858[_0xc217('0x1b')]?_0x1f4858[_0xc217('0x1b')][_0xc217('0x1f')]?_[_0xc217('0x20')](_0x1f4858['options'][_0xc217('0x1f')],function(_0x4a6e7b){return{'model':db[_0x4a6e7b[_0xc217('0x21')]],'as':_0x4a6e7b['as'],'attributes':_0x4a6e7b['attributes'],'include':_0x4a6e7b['include']?_['map'](_0x4a6e7b[_0xc217('0x1f')],function(_0x1c89ab){return{'model':db[_0x1c89ab[_0xc217('0x21')]],'as':_0x1c89ab['as'],'attributes':_0x1c89ab[_0xc217('0x22')],'include':_0x1c89ab[_0xc217('0x1f')]?_['map'](_0x1c89ab[_0xc217('0x1f')],function(_0xa68292){return{'model':db[_0xa68292[_0xc217('0x21')]],'as':_0xa68292['as'],'attributes':_0xa68292[_0xc217('0x22')]};}):[]};}):[]};}):[]:[]})[_0xc217('0x10')](function(_0x59584e){logger[_0xc217('0x11')](_0xc217('0x18'),_0x1f4858);logger['debug']('GetMailAccount',_0x1f4858,JSON[_0xc217('0x23')](_0x59584e));_0x22be11(_0x59584e);})[_0xc217('0x17')](function(_0x2c16e9){logger[_0xc217('0x14')](_0xc217('0x18'),_0x2c16e9[_0xc217('0x15')],_0x1f4858);_0x44fc2f(_0x327d15[_0xc217('0x14')](0x1f4,_0x2c16e9[_0xc217('0x15')]));});});};exports[_0xc217('0x24')]=function(_0x46ae02){var _0x47da53=this;return new Promise(function(_0x5c92d0,_0x451f26){return db[_0xc217('0x19')][_0xc217('0x25')]({'raw':_0x46ae02['options']?_0x46ae02[_0xc217('0x1b')][_0xc217('0x1c')]===undefined?!![]:![]:!![],'where':_0x46ae02[_0xc217('0x1b')]?_0x46ae02[_0xc217('0x1b')]['where']||null:null,'attributes':_0x46ae02[_0xc217('0x1b')]?_0x46ae02[_0xc217('0x1b')][_0xc217('0x22')]||null:null,'include':_0x46ae02[_0xc217('0x1b')]?_0x46ae02[_0xc217('0x1b')][_0xc217('0x1f')]?_[_0xc217('0x20')](_0x46ae02['options'][_0xc217('0x1f')],function(_0x26a675){return{'model':db[_0x26a675[_0xc217('0x21')]],'as':_0x26a675['as'],'attributes':_0x26a675[_0xc217('0x22')],'include':_0x26a675['include']?_[_0xc217('0x20')](_0x26a675[_0xc217('0x1f')],function(_0x21d81e){return{'model':db[_0x21d81e[_0xc217('0x21')]],'as':_0x21d81e['as'],'attributes':_0x21d81e[_0xc217('0x22')],'include':_0x21d81e['include']?_[_0xc217('0x20')](_0x21d81e[_0xc217('0x1f')],function(_0x54dc03){return{'model':db[_0x54dc03[_0xc217('0x21')]],'as':_0x54dc03['as'],'attributes':_0x54dc03[_0xc217('0x22')]};}):[]};}):[]};}):[]:[]})[_0xc217('0x10')](function(_0x5c46c3){logger[_0xc217('0x11')](_0xc217('0x24'),_0x46ae02);logger[_0xc217('0x26')](_0xc217('0x24'),_0x46ae02,JSON[_0xc217('0x23')](_0x5c46c3));_0x5c92d0(_0x5c46c3);})[_0xc217('0x17')](function(_0xf04912){logger[_0xc217('0x14')]('ShowMailAccount',_0xf04912[_0xc217('0x15')],_0x46ae02);_0x451f26(_0x47da53[_0xc217('0x14')](0x1f4,_0xf04912[_0xc217('0x15')]));});});};exports[_0xc217('0x27')]=function(_0xf5eb68){var _0x598289=this;return new Promise(function(_0x2deeb8,_0xcdbf34){var _0x47c684={'body':_0xf5eb68[_0xc217('0x28')],'channel':_0xc217('0x29')};var _0xa573ca=_[_0xc217('0x2a')](_[_0xc217('0x2b')](db[_0xc217('0x2c')][_0xc217('0x2d')]),[_0xc217('0x2e'),_0xc217('0x2f'),_0xc217('0x30'),_0xc217('0x31')]);var _0x3d2d73=![];if(_0xf5eb68[_0xc217('0x28')]['id']){delete _0xf5eb68[_0xc217('0x28')]['id'];}if(_[_0xc217('0x32')](_0xf5eb68[_0xc217('0x28')][_0xc217('0x33')])){return _0xcdbf34(_0x598289['error'](0x1f4,'from\x20is\x20mandatory'));}if(_['isNil'](_0xf5eb68[_0xc217('0x28')][_0xc217('0x28')])||_0xf5eb68[_0xc217('0x28')][_0xc217('0x28')]===''){return _0xcdbf34(_0x598289[_0xc217('0x14')](0x1f4,_0xc217('0x34')));}if(_[_0xc217('0x32')](_0xf5eb68[_0xc217('0x28')][_0xc217('0x35')])){return _0xcdbf34(_0x598289[_0xc217('0x14')](0x1f4,_0xc217('0x36')+_0xa573ca));}if(!_[_0xc217('0x37')](_0xa573ca,_0xf5eb68['body'][_0xc217('0x35')])){return _0xcdbf34(_0x598289[_0xc217('0x14')](0x1f4,_0xc217('0x38')+_0xa573ca));}var _0x3f33d0={};_0x3f33d0[_0xf5eb68[_0xc217('0x28')][_0xc217('0x35')]]=_0xf5eb68['body'][_0xc217('0x33')];return db[_0xc217('0x19')][_0xc217('0x25')]({'where':{'id':_0xf5eb68[_0xc217('0x39')]['id']},'include':[{'model':db[_0xc217('0x3a')],'as':'List','include':[{'model':db[_0xc217('0x2c')],'as':_0xc217('0x3b'),'where':_0x3f33d0,'limit':0x1,'order':[[_0xc217('0x2f'),_0xc217('0x3c')]]}]},{'model':db[_0xc217('0x3d')],'as':'Applications'},{'model':db['MailServerOut'],'as':_0xc217('0x3e')}]})[_0xc217('0x10')](function(_0x5b28c5){if(_0x5b28c5&&_0x5b28c5[_0xc217('0x3f')]){var _0x358707=_0x5b28c5[_0xc217('0x40')]({'plain':!![]});_0x47c684[_0xc217('0x39')]=_[_0xc217('0x41')](_0x358707,[_0xc217('0x42'),'List']);_0x47c684[_0xc217('0x43')]=_0x358707[_0xc217('0x42')];_0x47c684['list']=_0x358707[_0xc217('0x3f')];_0x47c684[_0xc217('0x43')]=_[_0xc217('0x44')](_0x47c684[_0xc217('0x43')],[_0xc217('0x45')],[_0xc217('0x46')]);if(_0x47c684['account']&&_0x47c684[_0xc217('0x39')][_0xc217('0x47')]){_0x47c684[_0xc217('0x43')][_0xc217('0x48')]({'id':0x0,'priority':_0x47c684[_0xc217('0x43')][_0xc217('0x49')]+0x1,'app':_0xc217('0x4a'),'appdata':_0xc217('0x47'),'interval':_0xc217('0x4b')});}if(_0x47c684[_0xc217('0x39')][_0xc217('0x42')]){delete _0x47c684[_0xc217('0x39')]['Applications'];}if(_0x47c684[_0xc217('0x39')][_0xc217('0x3f')]){delete _0x47c684[_0xc217('0x39')][_0xc217('0x3f')];}if(_0x358707[_0xc217('0x3f')][_0xc217('0x3b')][_0xc217('0x49')]){return _0x358707[_0xc217('0x3f')][_0xc217('0x3b')][0x0];}var _0x175b43=_[_0xc217('0xc')](_0xf5eb68[_0xc217('0x28')],{'firstName':_0xf5eb68['body'][_0xc217('0x33')],'ListId':_0x358707['ListId']});_0x175b43[_0xf5eb68[_0xc217('0x28')][_0xc217('0x35')]]=_0xf5eb68['body'][_0xc217('0x33')];return db[_0xc217('0x2c')][_0xc217('0x4c')](_0x175b43);}else{throw new Error(_0xc217('0x4d'));}})[_0xc217('0x10')](function(_0x32f6f3){_0x47c684['contact']=_0x32f6f3;if(_0x32f6f3){if(!_0xf5eb68[_0xc217('0x28')]['message']['messageId']){_0xf5eb68[_0xc217('0x28')][_0xc217('0x15')][_0xc217('0x4e')]=rs[_0xc217('0x4f')]()+'\x20'+_0xf5eb68['body']['message'][_0xc217('0x33')];}var _0x7d3517={'ContactId':_0x32f6f3['id'],'MailAccountId':_0xf5eb68['account']['id'],'inReplyTo':_0xf5eb68[_0xc217('0x28')][_0xc217('0x15')]['messageId'],'to':_0xf5eb68['body']['message'][_0xc217('0x33')],'cc':_0xf5eb68['body'][_0xc217('0x15')]['cc'],'subject':_0xf5eb68[_0xc217('0x28')]['message'][_0xc217('0x50')],'attach':_0xf5eb68[_0xc217('0x28')][_0xc217('0x15')]['attach'],'lastMsgAt':moment()[_0xc217('0x51')](_0xc217('0x52')),'lastMsgDirection':'in'};return db[_0xc217('0x53')][_0xc217('0x25')]({'where':{'closed':![],'MailAccountId':_0xf5eb68[_0xc217('0x39')]['id']},'include':[{'model':db[_0xc217('0x54')],'as':'Messages','attributes':[_0xc217('0x4e')],'where':{'messageId':_0xf5eb68[_0xc217('0x28')][_0xc217('0x15')][_0xc217('0x55')]}}]})['then'](function(_0x1cfea9){if(_0x1cfea9){return[_0x1cfea9,![]];}return db[_0xc217('0x53')][_0xc217('0x4c')](_0x7d3517)['then'](function(_0x427716){return[_0x427716,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})['spread'](function(_0x185e33,_0x5c8b5a){if(_0x185e33){_0x3d2d73=_0x5c8b5a;if(!_0x5c8b5a){return _0x185e33[_0xc217('0x56')]({'inReplyTo':_0xf5eb68['body'][_0xc217('0x15')][_0xc217('0x4e')],'to':_0xf5eb68[_0xc217('0x28')][_0xc217('0x15')][_0xc217('0x33')],'cc':_0xf5eb68[_0xc217('0x28')][_0xc217('0x15')]['cc'],'subject':_0xf5eb68[_0xc217('0x28')][_0xc217('0x15')][_0xc217('0x50')],'attach':_0x185e33[_0xc217('0x57')]?_0x185e33['attach']:_0xf5eb68[_0xc217('0x28')][_0xc217('0x15')]['attach'],'substatus':null,'substatusAt':moment()[_0xc217('0x51')](_0xc217('0x52')),'lastMsgAt':moment()[_0xc217('0x51')](_0xc217('0x52')),'lastMsgDirection':'in'});}else{return _0x185e33;}}})[_0xc217('0x10')](function(_0x584a76){_0x47c684[_0xc217('0x58')]=_0x584a76['get']({'plain':!![]});_0x47c684[_0xc217('0x58')][_0xc217('0x59')]=_0x3d2d73;return db[_0xc217('0x54')][_0xc217('0x4c')]({'body':_0xf5eb68[_0xc217('0x28')][_0xc217('0x28')],'MailAccountId':_0xf5eb68[_0xc217('0x39')]['id'],'MailInteractionId':_0x584a76['id'],'direction':'in','ContactId':_0x47c684[_0xc217('0x5a')]['id'],'messageId':_0xf5eb68[_0xc217('0x28')][_0xc217('0x15')][_0xc217('0x4e')],'from':_0xf5eb68[_0xc217('0x28')]['message']['from'],'to':_0xf5eb68[_0xc217('0x28')][_0xc217('0x15')]['to'],'cc':_0xf5eb68['body'][_0xc217('0x15')]['cc'],'subject':_0xf5eb68['body'][_0xc217('0x15')]['subject'],'attach':_0xf5eb68[_0xc217('0x28')][_0xc217('0x15')][_0xc217('0x57')],'Attachments':_0xf5eb68['body'][_0xc217('0x15')][_0xc217('0x5b')],'originTo':_0xf5eb68[_0xc217('0x28')][_0xc217('0x15')][_0xc217('0x5c')],'originCc':_0xf5eb68[_0xc217('0x28')][_0xc217('0x15')][_0xc217('0x5d')],'bcc':_0xf5eb68[_0xc217('0x28')]['message']['bcc'],'ChatWebsiteId':_0xf5eb68[_0xc217('0x28')][_0xc217('0x15')]['ChatWebsiteId']||null,'originChannel':_0xf5eb68['body']['message'][_0xc217('0x5e')]||_0xc217('0x5f'),'ChatOfflineMessageId':_0xf5eb68['body'][_0xc217('0x15')][_0xc217('0x60')]||null},{'include':[{'model':db[_0xc217('0x61')],'as':_0xc217('0x62')}]});})[_0xc217('0x10')](function(_0x46b3a1){_0x47c684['message']=_0x46b3a1;if(_0x47c684[_0xc217('0x58')]['UserId']){return db[_0xc217('0x63')][_0xc217('0x25')]({'attributes':['id',_0xc217('0x64')],'where':{'id':_0x47c684[_0xc217('0x58')]['UserId']}})[_0xc217('0x10')](function(_0x41670e){if(_0x41670e){_0x47c684[_0xc217('0x43')][_0xc217('0x65')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x41670e[_0xc217('0x64')]+','+(_0x47c684[_0xc217('0x39')][_0xc217('0x66')]||0xa),'interval':_0xc217('0x4b')});}return respondWithRpcPromise(_0xc217('0x67'),'startRouting',_0x47c684);});}return respondWithRpcPromise(_0xc217('0x67'),_0xc217('0x68'),_0x47c684);})['then'](function(_0x25f7d8){_0x2deeb8(_0x25f7d8);})[_0xc217('0x17')](function(_0x20dc4b){_0xcdbf34(_0x598289[_0xc217('0x14')](0x1f4,_0x20dc4b[_0xc217('0x15')]));});});}; \ No newline at end of file +var _0x9473=['MailServerOut','Smtp','get','applications','priority','asc','autoclose','push','length','create','messageId','generate','subject','attach','format','MailInteraction','MailMessage','Messages','Contact\x20not\x20found','YYYY-MM-DD\x20HH:mm:ss','created','originTo','originCc','originChannel','Email','ChatOfflineMessageId','Attachments','interaction','UserId','unshift','agent','name','waitForTheAssignedAgent','Start','startRouting','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./mailAccount.socket','request','then','info','MailAccount,\x20%s,\x20%s','MailAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','MailAccount','findAll','options','raw','where','attributes','limit','include','map','model','GetMailAccount','find','ShowMailAccount','debug','NotifyMailAccount','mail','difference','keys','CmContact','rawAttributes','createdAt','updatedAt','CompanyId','ListId','body','from','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','account','CmList','List','Contacts','DESC','MailApplication','Applications'];(function(_0x4f01a9,_0x4a0d3a){var _0x5f5ade=function(_0xbd7ca6){while(--_0xbd7ca6){_0x4f01a9['push'](_0x4f01a9['shift']());}};_0x5f5ade(++_0x4a0d3a);}(_0x9473,0x14f));var _0x3947=function(_0xefb3a2,_0x3b3be2){_0xefb3a2=_0xefb3a2-0x0;var _0x15d903=_0x9473[_0xefb3a2];return _0x15d903;};'use strict';var _=require(_0x3947('0x0'));var util=require(_0x3947('0x1'));var moment=require(_0x3947('0x2'));var BPromise=require(_0x3947('0x3'));var rs=require(_0x3947('0x4'));var fs=require('fs');var Redis=require(_0x3947('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x3947('0x6'));var logger=require('../../config/logger')(_0x3947('0x7'));var config=require(_0x3947('0x8'));var jayson=require(_0x3947('0x9'));var client=jayson[_0x3947('0xa')][_0x3947('0xb')]({'port':0x232c});config[_0x3947('0xc')]=_[_0x3947('0xd')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x3947('0xe'))(new Redis(config[_0x3947('0xc')]));require(_0x3947('0xf'))['register'](socket);function respondWithRpcPromise(_0x416032,_0x1bd8e5,_0x3bf4c4){return new BPromise(function(_0x42c5d9,_0x197fec){return client[_0x3947('0x10')](_0x416032,_0x3bf4c4)[_0x3947('0x11')](function(_0x2d5ca7){logger[_0x3947('0x12')](_0x3947('0x13'),_0x1bd8e5,'request\x20sent');logger['debug'](_0x3947('0x14'),_0x1bd8e5,_0x3947('0x15'),JSON[_0x3947('0x16')](_0x2d5ca7));if(_0x2d5ca7[_0x3947('0x17')]){if(_0x2d5ca7['error']['code']===0x1f4){logger['error'](_0x3947('0x13'),_0x1bd8e5,_0x2d5ca7[_0x3947('0x17')][_0x3947('0x18')]);return _0x197fec(_0x2d5ca7[_0x3947('0x17')][_0x3947('0x18')]);}logger[_0x3947('0x17')](_0x3947('0x13'),_0x1bd8e5,_0x2d5ca7['error']['message']);return _0x42c5d9(_0x2d5ca7[_0x3947('0x17')]['message']);}else{logger['info'](_0x3947('0x13'),_0x1bd8e5,_0x3947('0x15'));_0x42c5d9(_0x2d5ca7[_0x3947('0x19')][_0x3947('0x18')]);}})[_0x3947('0x1a')](function(_0x500a81){logger['error'](_0x3947('0x13'),_0x1bd8e5,_0x500a81);_0x197fec(_0x500a81);});});}exports['GetMailAccount']=function(_0x4b07a9){var _0x2beb65=this;return new Promise(function(_0x198de9,_0x5cc379){return db[_0x3947('0x1b')][_0x3947('0x1c')]({'raw':_0x4b07a9[_0x3947('0x1d')]?_0x4b07a9[_0x3947('0x1d')][_0x3947('0x1e')]===undefined?!![]:![]:!![],'where':_0x4b07a9[_0x3947('0x1d')]?_0x4b07a9[_0x3947('0x1d')][_0x3947('0x1f')]||null:null,'attributes':_0x4b07a9[_0x3947('0x1d')]?_0x4b07a9[_0x3947('0x1d')][_0x3947('0x20')]||null:null,'limit':_0x4b07a9[_0x3947('0x1d')]?_0x4b07a9[_0x3947('0x1d')][_0x3947('0x21')]||null:null,'include':_0x4b07a9[_0x3947('0x1d')]?_0x4b07a9[_0x3947('0x1d')][_0x3947('0x22')]?_[_0x3947('0x23')](_0x4b07a9[_0x3947('0x1d')][_0x3947('0x22')],function(_0x4f2d68){return{'model':db[_0x4f2d68[_0x3947('0x24')]],'as':_0x4f2d68['as'],'attributes':_0x4f2d68[_0x3947('0x20')],'include':_0x4f2d68[_0x3947('0x22')]?_['map'](_0x4f2d68['include'],function(_0x317b44){return{'model':db[_0x317b44[_0x3947('0x24')]],'as':_0x317b44['as'],'attributes':_0x317b44[_0x3947('0x20')],'include':_0x317b44[_0x3947('0x22')]?_['map'](_0x317b44[_0x3947('0x22')],function(_0x4e8cfd){return{'model':db[_0x4e8cfd[_0x3947('0x24')]],'as':_0x4e8cfd['as'],'attributes':_0x4e8cfd['attributes']};}):[]};}):[]};}):[]:[]})[_0x3947('0x11')](function(_0xf9fbdf){logger[_0x3947('0x12')](_0x3947('0x25'),_0x4b07a9);logger['debug']('GetMailAccount',_0x4b07a9,JSON[_0x3947('0x16')](_0xf9fbdf));_0x198de9(_0xf9fbdf);})['catch'](function(_0x2554c9){logger[_0x3947('0x17')]('GetMailAccount',_0x2554c9['message'],_0x4b07a9);_0x5cc379(_0x2beb65[_0x3947('0x17')](0x1f4,_0x2554c9[_0x3947('0x18')]));});});};exports['ShowMailAccount']=function(_0x14c6d8){var _0x345798=this;return new Promise(function(_0x1bc8bb,_0x391c7d){return db['MailAccount'][_0x3947('0x26')]({'raw':_0x14c6d8[_0x3947('0x1d')]?_0x14c6d8['options'][_0x3947('0x1e')]===undefined?!![]:![]:!![],'where':_0x14c6d8['options']?_0x14c6d8[_0x3947('0x1d')][_0x3947('0x1f')]||null:null,'attributes':_0x14c6d8[_0x3947('0x1d')]?_0x14c6d8[_0x3947('0x1d')]['attributes']||null:null,'include':_0x14c6d8[_0x3947('0x1d')]?_0x14c6d8['options'][_0x3947('0x22')]?_[_0x3947('0x23')](_0x14c6d8[_0x3947('0x1d')][_0x3947('0x22')],function(_0x5bd74d){return{'model':db[_0x5bd74d[_0x3947('0x24')]],'as':_0x5bd74d['as'],'attributes':_0x5bd74d[_0x3947('0x20')],'include':_0x5bd74d[_0x3947('0x22')]?_['map'](_0x5bd74d['include'],function(_0x1a7c08){return{'model':db[_0x1a7c08[_0x3947('0x24')]],'as':_0x1a7c08['as'],'attributes':_0x1a7c08[_0x3947('0x20')],'include':_0x1a7c08[_0x3947('0x22')]?_[_0x3947('0x23')](_0x1a7c08[_0x3947('0x22')],function(_0x525492){return{'model':db[_0x525492[_0x3947('0x24')]],'as':_0x525492['as'],'attributes':_0x525492[_0x3947('0x20')]};}):[]};}):[]};}):[]:[]})[_0x3947('0x11')](function(_0x230da4){logger[_0x3947('0x12')](_0x3947('0x27'),_0x14c6d8);logger[_0x3947('0x28')]('ShowMailAccount',_0x14c6d8,JSON[_0x3947('0x16')](_0x230da4));_0x1bc8bb(_0x230da4);})['catch'](function(_0x192ca4){logger[_0x3947('0x17')](_0x3947('0x27'),_0x192ca4[_0x3947('0x18')],_0x14c6d8);_0x391c7d(_0x345798[_0x3947('0x17')](0x1f4,_0x192ca4[_0x3947('0x18')]));});});};exports[_0x3947('0x29')]=function(_0x1fc4a9){var _0x3c2c4d=this;return new Promise(function(_0x5397d1,_0x1ec29b){var _0x3bfb6c={'body':_0x1fc4a9['body'],'channel':_0x3947('0x2a')};var _0x23627f=_[_0x3947('0x2b')](_[_0x3947('0x2c')](db[_0x3947('0x2d')][_0x3947('0x2e')]),[_0x3947('0x2f'),_0x3947('0x30'),_0x3947('0x31'),_0x3947('0x32')]);var _0x390506=![];if(_0x1fc4a9[_0x3947('0x33')]['id']){delete _0x1fc4a9[_0x3947('0x33')]['id'];}if(_['isNil'](_0x1fc4a9['body'][_0x3947('0x34')])){return _0x1ec29b(_0x3c2c4d['error'](0x1f4,'from\x20is\x20mandatory'));}if(_[_0x3947('0x35')](_0x1fc4a9[_0x3947('0x33')]['body'])||_0x1fc4a9[_0x3947('0x33')]['body']===''){return _0x1ec29b(_0x3c2c4d['error'](0x1f4,_0x3947('0x36')));}if(_[_0x3947('0x35')](_0x1fc4a9[_0x3947('0x33')][_0x3947('0x37')])){return _0x1ec29b(_0x3c2c4d[_0x3947('0x17')](0x1f4,_0x3947('0x38')+_0x23627f));}if(!_['includes'](_0x23627f,_0x1fc4a9[_0x3947('0x33')][_0x3947('0x37')])){return _0x1ec29b(_0x3c2c4d['error'](0x1f4,_0x3947('0x39')+_0x23627f));}var _0x1507d9={};_0x1507d9[_0x1fc4a9['body'][_0x3947('0x37')]]=_0x1fc4a9[_0x3947('0x33')][_0x3947('0x34')];return db[_0x3947('0x1b')][_0x3947('0x26')]({'where':{'id':_0x1fc4a9[_0x3947('0x3a')]['id']},'include':[{'model':db[_0x3947('0x3b')],'as':_0x3947('0x3c'),'include':[{'model':db[_0x3947('0x2d')],'as':_0x3947('0x3d'),'where':_0x1507d9,'limit':0x1,'order':[[_0x3947('0x30'),_0x3947('0x3e')]]}]},{'model':db[_0x3947('0x3f')],'as':_0x3947('0x40')},{'model':db[_0x3947('0x41')],'as':_0x3947('0x42')}]})[_0x3947('0x11')](function(_0xa4c485){if(_0xa4c485&&_0xa4c485[_0x3947('0x3c')]){var _0x186411=_0xa4c485[_0x3947('0x43')]({'plain':!![]});_0x3bfb6c[_0x3947('0x3a')]=_['omit'](_0x186411,[_0x3947('0x40'),'List']);_0x3bfb6c[_0x3947('0x44')]=_0x186411[_0x3947('0x40')];_0x3bfb6c['list']=_0x186411[_0x3947('0x3c')];_0x3bfb6c[_0x3947('0x44')]=_['orderBy'](_0x3bfb6c[_0x3947('0x44')],[_0x3947('0x45')],[_0x3947('0x46')]);if(_0x3bfb6c[_0x3947('0x3a')]&&_0x3bfb6c[_0x3947('0x3a')][_0x3947('0x47')]){_0x3bfb6c['applications'][_0x3947('0x48')]({'id':0x0,'priority':_0x3bfb6c['applications'][_0x3947('0x49')]+0x1,'app':'close','appdata':_0x3947('0x47'),'interval':'*,*,*,*'});}if(_0x3bfb6c[_0x3947('0x3a')][_0x3947('0x40')]){delete _0x3bfb6c[_0x3947('0x3a')][_0x3947('0x40')];}if(_0x3bfb6c[_0x3947('0x3a')][_0x3947('0x3c')]){delete _0x3bfb6c[_0x3947('0x3a')]['List'];}if(_0x186411[_0x3947('0x3c')][_0x3947('0x3d')][_0x3947('0x49')]){return _0x186411[_0x3947('0x3c')][_0x3947('0x3d')][0x0];}var _0x1feb78=_[_0x3947('0xd')](_0x1fc4a9[_0x3947('0x33')],{'firstName':_0x1fc4a9[_0x3947('0x33')][_0x3947('0x34')],'ListId':_0x186411['ListId']});_0x1feb78[_0x1fc4a9[_0x3947('0x33')][_0x3947('0x37')]]=_0x1fc4a9[_0x3947('0x33')][_0x3947('0x34')];return db[_0x3947('0x2d')][_0x3947('0x4a')](_0x1feb78);}else{throw new Error('List\x20not\x20found');}})['then'](function(_0x5798a3){_0x3bfb6c['contact']=_0x5798a3;if(_0x5798a3){if(!_0x1fc4a9[_0x3947('0x33')][_0x3947('0x18')][_0x3947('0x4b')]){_0x1fc4a9['body']['message']['messageId']=rs[_0x3947('0x4c')]()+'\x20'+_0x1fc4a9[_0x3947('0x33')][_0x3947('0x18')][_0x3947('0x34')];}var _0x3982e4={'ContactId':_0x5798a3['id'],'MailAccountId':_0x1fc4a9['account']['id'],'inReplyTo':_0x1fc4a9[_0x3947('0x33')]['message']['messageId'],'to':_0x1fc4a9[_0x3947('0x33')][_0x3947('0x18')][_0x3947('0x34')],'cc':_0x1fc4a9[_0x3947('0x33')][_0x3947('0x18')]['cc'],'subject':_0x1fc4a9['body'][_0x3947('0x18')][_0x3947('0x4d')],'attach':_0x1fc4a9[_0x3947('0x33')][_0x3947('0x18')][_0x3947('0x4e')],'lastMsgAt':moment()[_0x3947('0x4f')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':'in'};return db[_0x3947('0x50')][_0x3947('0x26')]({'where':{'closed':![],'MailAccountId':_0x1fc4a9['account']['id']},'include':[{'model':db[_0x3947('0x51')],'as':_0x3947('0x52'),'attributes':['messageId'],'where':{'messageId':_0x1fc4a9[_0x3947('0x33')][_0x3947('0x18')]['inReplyTo']}}]})[_0x3947('0x11')](function(_0x30d3b4){if(_0x30d3b4){return[_0x30d3b4,![]];}return db[_0x3947('0x50')][_0x3947('0x4a')](_0x3982e4)['then'](function(_0xaae84b){return[_0xaae84b,!![]];});});}else{throw new Error(_0x3947('0x53'));}})['spread'](function(_0x16aba3,_0xa3ae10){if(_0x16aba3){_0x390506=_0xa3ae10;if(!_0xa3ae10){return _0x16aba3['update']({'inReplyTo':_0x1fc4a9[_0x3947('0x33')][_0x3947('0x18')][_0x3947('0x4b')],'to':_0x1fc4a9[_0x3947('0x33')]['message'][_0x3947('0x34')],'cc':_0x1fc4a9['body'][_0x3947('0x18')]['cc'],'subject':_0x1fc4a9[_0x3947('0x33')][_0x3947('0x18')][_0x3947('0x4d')],'attach':_0x16aba3[_0x3947('0x4e')]?_0x16aba3[_0x3947('0x4e')]:_0x1fc4a9[_0x3947('0x33')]['message'][_0x3947('0x4e')],'substatus':null,'substatusAt':moment()[_0x3947('0x4f')](_0x3947('0x54')),'lastMsgAt':moment()[_0x3947('0x4f')](_0x3947('0x54')),'lastMsgDirection':'in'});}else{return _0x16aba3;}}})[_0x3947('0x11')](function(_0x55146a){_0x3bfb6c['interaction']=_0x55146a[_0x3947('0x43')]({'plain':!![]});_0x3bfb6c['interaction'][_0x3947('0x55')]=_0x390506;return db['MailMessage'][_0x3947('0x4a')]({'body':_0x1fc4a9[_0x3947('0x33')][_0x3947('0x33')],'MailAccountId':_0x1fc4a9[_0x3947('0x3a')]['id'],'MailInteractionId':_0x55146a['id'],'direction':'in','ContactId':_0x3bfb6c['contact']['id'],'messageId':_0x1fc4a9[_0x3947('0x33')]['message'][_0x3947('0x4b')],'from':_0x1fc4a9[_0x3947('0x33')][_0x3947('0x18')][_0x3947('0x34')],'to':_0x1fc4a9[_0x3947('0x33')][_0x3947('0x18')]['to'],'cc':_0x1fc4a9[_0x3947('0x33')][_0x3947('0x18')]['cc'],'subject':_0x1fc4a9['body']['message'][_0x3947('0x4d')],'attach':_0x1fc4a9[_0x3947('0x33')][_0x3947('0x18')][_0x3947('0x4e')],'Attachments':_0x1fc4a9[_0x3947('0x33')]['message']['attachments'],'originTo':_0x1fc4a9[_0x3947('0x33')][_0x3947('0x18')][_0x3947('0x56')],'originCc':_0x1fc4a9[_0x3947('0x33')]['message'][_0x3947('0x57')],'bcc':_0x1fc4a9[_0x3947('0x33')][_0x3947('0x18')]['bcc'],'ChatWebsiteId':_0x1fc4a9[_0x3947('0x33')][_0x3947('0x18')]['ChatWebsiteId']||null,'originChannel':_0x1fc4a9[_0x3947('0x33')][_0x3947('0x18')][_0x3947('0x58')]||_0x3947('0x59'),'ChatOfflineMessageId':_0x1fc4a9[_0x3947('0x33')][_0x3947('0x18')][_0x3947('0x5a')]||null},{'include':[{'model':db['Attachment'],'as':_0x3947('0x5b')}]});})[_0x3947('0x11')](function(_0x344d8c){_0x3bfb6c['message']=_0x344d8c;if(_0x3bfb6c[_0x3947('0x5c')][_0x3947('0x5d')]){return db['User'][_0x3947('0x26')]({'attributes':['id','name'],'where':{'id':_0x3bfb6c[_0x3947('0x5c')][_0x3947('0x5d')]}})[_0x3947('0x11')](function(_0x3a18bb){if(_0x3a18bb){_0x3bfb6c['applications'][_0x3947('0x5e')]({'id':0x0,'priority':0x0,'app':_0x3947('0x5f'),'appdata':_0x3a18bb[_0x3947('0x60')]+','+(_0x3bfb6c['account'][_0x3947('0x61')]||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0x3947('0x62'),_0x3947('0x63'),_0x3bfb6c);});}return respondWithRpcPromise(_0x3947('0x62'),'startRouting',_0x3bfb6c);})[_0x3947('0x11')](function(_0x4e1556){_0x5397d1(_0x4e1556);})[_0x3947('0x1a')](function(_0x2336ae){_0x1ec29b(_0x3c2c4d[_0x3947('0x17')](0x1f4,_0x2336ae['message']));});});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.socket.js b/server/api/mailAccount/mailAccount.socket.js index a447c6d..ec16d41 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 _0xccde=['length','./mailAccount.events','remove','removeListener','register'];(function(_0x42ca58,_0x423bf9){var _0x1a3a40=function(_0x1d4a8a){while(--_0x1d4a8a){_0x42ca58['push'](_0x42ca58['shift']());}};_0x1a3a40(++_0x423bf9);}(_0xccde,0x1e1));var _0xeccd=function(_0x1e6e4e,_0x2b1b09){_0x1e6e4e=_0x1e6e4e-0x0;var _0x3d746b=_0xccde[_0x1e6e4e];return _0x3d746b;};'use strict';var MailAccountEvents=require(_0xeccd('0x0'));var events=['save',_0xeccd('0x1'),'update'];function createListener(_0x26e4bf,_0x12ec79){return function(_0x5ce195){_0x12ec79['emit'](_0x26e4bf,_0x5ce195);};}function removeListener(_0x2d21f3,_0x3eede4){return function(){MailAccountEvents[_0xeccd('0x2')](_0x2d21f3,_0x3eede4);};}exports[_0xeccd('0x3')]=function(_0x323c74){for(var _0x56972a=0x0,_0x338742=events[_0xeccd('0x4')];_0x56972a<_0x338742;_0x56972a++){var _0x1b622f=events[_0x56972a];var _0x1eebfb=createListener('mailAccount:'+_0x1b622f,_0x323c74);MailAccountEvents['on'](_0x1b622f,_0x1eebfb);}}; \ No newline at end of file +var _0x54b5=['remove','emit','removeListener','register','length','./mailAccount.events','save'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x54b5,0xad));var _0x554b=function(_0x13cb4f,_0x22d2fa){_0x13cb4f=_0x13cb4f-0x0;var _0x2d154f=_0x54b5[_0x13cb4f];return _0x2d154f;};'use strict';var MailAccountEvents=require(_0x554b('0x0'));var events=[_0x554b('0x1'),_0x554b('0x2'),'update'];function createListener(_0x2a1156,_0x51b10f){return function(_0x4c20d0){_0x51b10f[_0x554b('0x3')](_0x2a1156,_0x4c20d0);};}function removeListener(_0x360b8b,_0x21983b){return function(){MailAccountEvents[_0x554b('0x4')](_0x360b8b,_0x21983b);};}exports[_0x554b('0x5')]=function(_0x435ebb){for(var _0x298d6f=0x0,_0x1c4d03=events[_0x554b('0x6')];_0x298d6f<_0x1c4d03;_0x298d6f++){var _0x5a06a6=events[_0x298d6f];var _0x5d6dd7=createListener('mailAccount:'+_0x5a06a6,_0x435ebb);MailAccountEvents['on'](_0x5a06a6,_0x5d6dd7);}}; \ No newline at end of file diff --git a/server/api/mailApplication/index.js b/server/api/mailApplication/index.js index 7230452..e1f62e4 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 _0x9763=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailApplication.controller','get','/:id','show','put','update','isAuthenticated','destroy','multer','util','path','express'];(function(_0x4e948f,_0x34b6f3){var _0x18d69d=function(_0x1b64cf){while(--_0x1b64cf){_0x4e948f['push'](_0x4e948f['shift']());}};_0x18d69d(++_0x34b6f3);}(_0x9763,0x73));var _0x3976=function(_0x3d5d40,_0x143d30){_0x3d5d40=_0x3d5d40-0x0;var _0x5ddfa8=_0x9763[_0x3d5d40];return _0x5ddfa8;};'use strict';var multer=require(_0x3976('0x0'));var util=require(_0x3976('0x1'));var path=require(_0x3976('0x2'));var timeout=require('connect-timeout');var express=require(_0x3976('0x3'));var router=express[_0x3976('0x4')]();var fs_extra=require(_0x3976('0x5'));var auth=require(_0x3976('0x6'));var interaction=require(_0x3976('0x7'));var config=require(_0x3976('0x8'));var controller=require(_0x3976('0x9'));router[_0x3976('0xa')](_0x3976('0xb'),auth['isAuthenticated'](),controller[_0x3976('0xc')]);router[_0x3976('0xd')](_0x3976('0xb'),auth['isAuthenticated'](),controller[_0x3976('0xe')]);router['delete'](_0x3976('0xb'),auth[_0x3976('0xf')](),controller[_0x3976('0x10')]);module['exports']=router; \ No newline at end of file +var _0x192c=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','/:id','isAuthenticated','show','update','delete','destroy','exports','util','path','connect-timeout'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x192c,0x1ad));var _0xc192=function(_0x3776b4,_0x19a1e3){_0x3776b4=_0x3776b4-0x0;var _0x1636d9=_0x192c[_0x3776b4];return _0x1636d9;};'use strict';var multer=require('multer');var util=require(_0xc192('0x0'));var path=require(_0xc192('0x1'));var timeout=require(_0xc192('0x2'));var express=require('express');var router=express[_0xc192('0x3')]();var fs_extra=require(_0xc192('0x4'));var auth=require(_0xc192('0x5'));var interaction=require(_0xc192('0x6'));var config=require(_0xc192('0x7'));var controller=require('./mailApplication.controller');router[_0xc192('0x8')](_0xc192('0x9'),auth[_0xc192('0xa')](),controller[_0xc192('0xb')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0xc192('0xc')]);router[_0xc192('0xd')]('/:id',auth[_0xc192('0xa')](),controller[_0xc192('0xe')]);module[_0xc192('0xf')]=router; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.attributes.js b/server/api/mailApplication/mailApplication.attributes.js index 4ee09b5..c1b2673 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 _0xf1b0=['*,*,*,*','sequelize','exports','INTEGER','STRING','noop','TEXT'];(function(_0x424a9a,_0x2dd9af){var _0xa7831c=function(_0x512534){while(--_0x512534){_0x424a9a['push'](_0x424a9a['shift']());}};_0xa7831c(++_0x2dd9af);}(_0xf1b0,0x151));var _0x0f1b=function(_0x43b06b,_0x1929c7){_0x43b06b=_0x43b06b-0x0;var _0x2c555b=_0xf1b0[_0x43b06b];return _0x2c555b;};'use strict';var Sequelize=require(_0x0f1b('0x0'));module[_0x0f1b('0x1')]={'priority':{'type':Sequelize[_0x0f1b('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x0f1b('0x3')],'allowNull':![],'defaultValue':_0x0f1b('0x4')},'appdata':{'type':Sequelize[_0x0f1b('0x5')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize['STRING'],'defaultValue':_0x0f1b('0x6')}}; \ No newline at end of file +var _0xc4bd=['sequelize','exports','noop','STRING','*,*,*,*'];(function(_0xf8ebe,_0x4a8cba){var _0x11131f=function(_0x2a5d52){while(--_0x2a5d52){_0xf8ebe['push'](_0xf8ebe['shift']());}};_0x11131f(++_0x4a8cba);}(_0xc4bd,0xf5));var _0xdc4b=function(_0x5ad18c,_0x340ac2){_0x5ad18c=_0x5ad18c-0x0;var _0x23d3bb=_0xc4bd[_0x5ad18c];return _0x23d3bb;};'use strict';var Sequelize=require(_0xdc4b('0x0'));module[_0xdc4b('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xdc4b('0x2')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0xdc4b('0x3')],'defaultValue':_0xdc4b('0x4')}}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.controller.js b/server/api/mailApplication/mailApplication.controller.js index 783ef6f..bf7d797 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 _0xf4eb=['limit','count','Content-Range','json','apply','reject','save','then','destroy','error','name','send','params','keys','MailApplication','rawAttributes','query','filters','intersection','model','fields','attributes','includeAll','include','options','find','catch','body','eml-format','moment','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','../../config/license/util','sendStatus','status','end','offset','undefined'];(function(_0x25c69f,_0x54f4cb){var _0x36dbd0=function(_0x1a3e27){while(--_0x1a3e27){_0x25c69f['push'](_0x25c69f['shift']());}};_0x36dbd0(++_0x54f4cb);}(_0xf4eb,0xec));var _0xbf4e=function(_0x11d87b,_0x1f63e4){_0x11d87b=_0x11d87b-0x0;var _0x4d7aae=_0xf4eb[_0x11d87b];return _0x4d7aae;};'use strict';var emlformat=require(_0xbf4e('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xbf4e('0x1'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xbf4e('0x2'));var path=require(_0xbf4e('0x3'));var sox=require(_0xbf4e('0x4'));var csv=require(_0xbf4e('0x5'));var ejs=require(_0xbf4e('0x6'));var fs=require('fs');var fs_extra=require(_0xbf4e('0x7'));var _=require(_0xbf4e('0x8'));var squel=require('squel');var crypto=require(_0xbf4e('0x9'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xbf4e('0x5'));var querystring=require(_0xbf4e('0xa'));var Papa=require(_0xbf4e('0xb'));var Redis=require(_0xbf4e('0xc'));var authService=require(_0xbf4e('0xd'));var qs=require(_0xbf4e('0xe'));var as=require(_0xbf4e('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xbf4e('0x10'));var utils=require('../../config/utils');var config=require(_0xbf4e('0x11'));var licenseUtil=require(_0xbf4e('0x12'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x17fd01,_0x5a3035){_0x5a3035=_0x5a3035||0xcc;return function(_0x56d185){if(_0x56d185){return _0x17fd01[_0xbf4e('0x13')](_0x5a3035);}return _0x17fd01[_0xbf4e('0x14')](_0x5a3035)[_0xbf4e('0x15')]();};}function respondWithResult(_0x302841,_0x3b74bd){_0x3b74bd=_0x3b74bd||0xc8;return function(_0x61bd54){if(_0x61bd54){return _0x302841['status'](_0x3b74bd)['json'](_0x61bd54);}};}function respondWithFilteredResult(_0x180432,_0x1735ae){return function(_0x28fc6b){if(_0x28fc6b){var _0x542909=typeof _0x1735ae[_0xbf4e('0x16')]===_0xbf4e('0x17')&&typeof _0x1735ae[_0xbf4e('0x18')]===_0xbf4e('0x17');var _0x5a631e=_0x28fc6b[_0xbf4e('0x19')];var _0x577c27=_0x542909?0x0:_0x1735ae['offset'];var _0x566ec3=_0x542909?_0x28fc6b['count']:_0x1735ae[_0xbf4e('0x16')]+_0x1735ae[_0xbf4e('0x18')];var _0x1fc800;if(_0x566ec3>=_0x5a631e){_0x566ec3=_0x5a631e;_0x1fc800=0xc8;}else{_0x1fc800=0xce;}_0x180432['status'](_0x1fc800);return _0x180432['set'](_0xbf4e('0x1a'),_0x577c27+'-'+_0x566ec3+'/'+_0x5a631e)[_0xbf4e('0x1b')](_0x28fc6b);}return null;};}function patchUpdates(_0x3be138){return function(_0x3a875b){try{jsonpatch[_0xbf4e('0x1c')](_0x3a875b,_0x3be138,!![]);}catch(_0x1e2a68){return BPromise[_0xbf4e('0x1d')](_0x1e2a68);}return _0x3a875b[_0xbf4e('0x1e')]();};}function saveUpdates(_0xd09e12,_0x376832){return function(_0x30539b){if(_0x30539b){return _0x30539b['update'](_0xd09e12)[_0xbf4e('0x1f')](function(_0x2e7673){return _0x2e7673;});}return null;};}function removeEntity(_0x51648c,_0x31e3f5){return function(_0x30994d){if(_0x30994d){return _0x30994d[_0xbf4e('0x20')]()[_0xbf4e('0x1f')](function(){_0x51648c[_0xbf4e('0x14')](0xcc)['end']();});}};}function handleEntityNotFound(_0x90635e,_0x36688a){return function(_0x3d6863){if(!_0x3d6863){_0x90635e['sendStatus'](0x194);}return _0x3d6863;};}function handleError(_0x2fb490,_0x5e08b1){_0x5e08b1=_0x5e08b1||0x1f4;return function(_0x5bcf71){logger[_0xbf4e('0x21')](_0x5bcf71['stack']);if(_0x5bcf71[_0xbf4e('0x22')]){delete _0x5bcf71[_0xbf4e('0x22')];}_0x2fb490[_0xbf4e('0x14')](_0x5e08b1)[_0xbf4e('0x23')](_0x5bcf71);};}exports['show']=function(_0x2d4686,_0x8e0ab5){var _0x43879d={'raw':!![],'where':{'id':_0x2d4686[_0xbf4e('0x24')]['id']}},_0x4cd4a1={};_0x4cd4a1['model']=_[_0xbf4e('0x25')](db[_0xbf4e('0x26')][_0xbf4e('0x27')]);_0x4cd4a1['query']=_[_0xbf4e('0x25')](_0x2d4686[_0xbf4e('0x28')]);_0x4cd4a1[_0xbf4e('0x29')]=_[_0xbf4e('0x2a')](_0x4cd4a1[_0xbf4e('0x2b')],_0x4cd4a1[_0xbf4e('0x28')]);_0x43879d['attributes']=_[_0xbf4e('0x2a')](_0x4cd4a1[_0xbf4e('0x2b')],qs['fields'](_0x2d4686[_0xbf4e('0x28')][_0xbf4e('0x2c')]));_0x43879d['attributes']=_0x43879d[_0xbf4e('0x2d')]['length']?_0x43879d[_0xbf4e('0x2d')]:_0x4cd4a1['model'];if(_0x2d4686[_0xbf4e('0x28')][_0xbf4e('0x2e')]){_0x43879d[_0xbf4e('0x2f')]=[{'all':!![]}];}_0x43879d=_['merge']({},_0x43879d,_0x2d4686[_0xbf4e('0x30')]);return db[_0xbf4e('0x26')][_0xbf4e('0x31')](_0x43879d)[_0xbf4e('0x1f')](handleEntityNotFound(_0x8e0ab5,null))[_0xbf4e('0x1f')](respondWithResult(_0x8e0ab5,null))[_0xbf4e('0x32')](handleError(_0x8e0ab5,null));};exports['update']=function(_0x99b320,_0x3dbb2b){if(_0x99b320[_0xbf4e('0x33')]['id']){delete _0x99b320[_0xbf4e('0x33')]['id'];}return db[_0xbf4e('0x26')]['find']({'where':{'id':_0x99b320['params']['id']}})['then'](handleEntityNotFound(_0x3dbb2b,null))['then'](saveUpdates(_0x99b320[_0xbf4e('0x33')],null))[_0xbf4e('0x1f')](respondWithResult(_0x3dbb2b,null))[_0xbf4e('0x32')](handleError(_0x3dbb2b,null));};exports[_0xbf4e('0x20')]=function(_0x22ddde,_0x257b74){return db[_0xbf4e('0x26')][_0xbf4e('0x31')]({'where':{'id':_0x22ddde[_0xbf4e('0x24')]['id']}})['then'](handleEntityNotFound(_0x257b74,null))['then'](removeEntity(_0x257b74,null))[_0xbf4e('0x32')](handleError(_0x257b74,null));}; \ No newline at end of file +var _0x9c44=['Content-Range','apply','reject','save','update','destroy','sendStatus','stack','name','send','show','params','model','keys','MailApplication','rawAttributes','query','attributes','intersection','fields','length','includeAll','include','merge','options','find','then','body','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'];(function(_0xd10b43,_0x440ec1){var _0x369090=function(_0x5ae495){while(--_0x5ae495){_0xd10b43['push'](_0xd10b43['shift']());}};_0x369090(++_0x440ec1);}(_0x9c44,0x178));var _0x49c4=function(_0x13e741,_0x5d3c24){_0x13e741=_0x13e741-0x0;var _0x3f8bb3=_0x9c44[_0x13e741];return _0x3f8bb3;};'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={'raw':!![],'where':{'id':_0x5987ae[_0x49c4('0x29')]['id']}},_0x46e04d={};_0x46e04d[_0x49c4('0x2a')]=_[_0x49c4('0x2b')](db[_0x49c4('0x2c')][_0x49c4('0x2d')]);_0x46e04d[_0x49c4('0x2e')]=_[_0x49c4('0x2b')](_0x5987ae[_0x49c4('0x2e')]);_0x46e04d['filters']=_['intersection'](_0x46e04d['model'],_0x46e04d[_0x49c4('0x2e')]);_0x2b2793[_0x49c4('0x2f')]=_[_0x49c4('0x30')](_0x46e04d[_0x49c4('0x2a')],qs[_0x49c4('0x31')](_0x5987ae['query'][_0x49c4('0x31')]));_0x2b2793[_0x49c4('0x2f')]=_0x2b2793[_0x49c4('0x2f')][_0x49c4('0x32')]?_0x2b2793['attributes']:_0x46e04d['model'];if(_0x5987ae[_0x49c4('0x2e')][_0x49c4('0x33')]){_0x2b2793[_0x49c4('0x34')]=[{'all':!![]}];}_0x2b2793=_[_0x49c4('0x35')]({},_0x2b2793,_0x5987ae[_0x49c4('0x36')]);return db['MailApplication'][_0x49c4('0x37')](_0x2b2793)[_0x49c4('0x38')](handleEntityNotFound(_0x889909,null))[_0x49c4('0x38')](respondWithResult(_0x889909,null))['catch'](handleError(_0x889909,null));};exports['update']=function(_0x85dce2,_0x1991e9){if(_0x85dce2[_0x49c4('0x39')]['id']){delete _0x85dce2[_0x49c4('0x39')]['id'];}return db[_0x49c4('0x2c')][_0x49c4('0x37')]({'where':{'id':_0x85dce2[_0x49c4('0x29')]['id']}})[_0x49c4('0x38')](handleEntityNotFound(_0x1991e9,null))[_0x49c4('0x38')](saveUpdates(_0x85dce2['body'],null))[_0x49c4('0x38')](respondWithResult(_0x1991e9,null))['catch'](handleError(_0x1991e9,null));};exports[_0x49c4('0x23')]=function(_0x349791,_0x2625a6){return db[_0x49c4('0x2c')]['find']({'where':{'id':_0x349791[_0x49c4('0x29')]['id']}})[_0x49c4('0x38')](handleEntityNotFound(_0x2625a6,null))[_0x49c4('0x38')](removeEntity(_0x2625a6,null))['catch'](handleError(_0x2625a6,null));}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.model.js b/server/api/mailApplication/mailApplication.model.js index 62c6b1b..0642f8e 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 _0x65a7=['api','moment','bluebird','request-promise','../../config/environment','./mailApplication.attributes','exports','MailApplication','utf8mb4_unicode_ci','util'];(function(_0x286701,_0x4524a3){var _0x4b86c0=function(_0xce6acb){while(--_0xce6acb){_0x286701['push'](_0x286701['shift']());}};_0x4b86c0(++_0x4524a3);}(_0x65a7,0xb3));var _0x765a=function(_0x1a237e,_0xcb44bf){_0x1a237e=_0x1a237e-0x0;var _0x5658d0=_0x65a7[_0x1a237e];return _0x5658d0;};'use strict';var _=require('lodash');var util=require(_0x765a('0x0'));var logger=require('../../config/logger')(_0x765a('0x1'));var moment=require(_0x765a('0x2'));var BPromise=require(_0x765a('0x3'));var rp=require(_0x765a('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x765a('0x5'));var attributes=require(_0x765a('0x6'));module[_0x765a('0x7')]=function(_0x522325,_0x5d62c0){return _0x522325['define'](_0x765a('0x8'),attributes,{'tableName':'mail_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x765a('0x9')});}; \ No newline at end of file +var _0x2b70=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailApplication.attributes','exports','define','mail_applications','lodash'];(function(_0x236f12,_0x4c7faf){var _0x32969a=function(_0x3a3e1d){while(--_0x3a3e1d){_0x236f12['push'](_0x236f12['shift']());}};_0x32969a(++_0x4c7faf);}(_0x2b70,0xa7));var _0x02b7=function(_0x1ee34b,_0x1b3de4){_0x1ee34b=_0x1ee34b-0x0;var _0xae8565=_0x2b70[_0x1ee34b];return _0xae8565;};'use strict';var _=require(_0x02b7('0x0'));var util=require(_0x02b7('0x1'));var logger=require(_0x02b7('0x2'))(_0x02b7('0x3'));var moment=require(_0x02b7('0x4'));var BPromise=require(_0x02b7('0x5'));var rp=require(_0x02b7('0x6'));var fs=require('fs');var path=require(_0x02b7('0x7'));var rimraf=require(_0x02b7('0x8'));var config=require(_0x02b7('0x9'));var attributes=require(_0x02b7('0xa'));module[_0x02b7('0xb')]=function(_0x1dedc6,_0x12141e){return _0x1dedc6[_0x02b7('0xc')]('MailApplication',attributes,{'tableName':_0x02b7('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.rpc.js b/server/api/mailApplication/mailApplication.rpc.js index e3eb34b..1b36106 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 _0x5b7d=['raw','where','attributes','limit','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','MailApplication,\x20%s,\x20%s','request\x20sent','debug','MailApplication,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','UpdateMailApplication','MailApplication','update','options'];(function(_0x351f71,_0xcf5b25){var _0x2ee146=function(_0x53e1e9){while(--_0x53e1e9){_0x351f71['push'](_0x351f71['shift']());}};_0x2ee146(++_0xcf5b25);}(_0x5b7d,0x1f4));var _0xd5b7=function(_0x3bd572,_0x2d9e9c){_0x3bd572=_0x3bd572-0x0;var _0x120c2b=_0x5b7d[_0x3bd572];return _0x120c2b;};'use strict';var _=require(_0xd5b7('0x0'));var util=require(_0xd5b7('0x1'));var moment=require(_0xd5b7('0x2'));var BPromise=require(_0xd5b7('0x3'));var rs=require(_0xd5b7('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd5b7('0x5'))['db'];var utils=require(_0xd5b7('0x6'));var logger=require(_0xd5b7('0x7'))(_0xd5b7('0x8'));var config=require(_0xd5b7('0x9'));var jayson=require(_0xd5b7('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x142565,_0x440e9d,_0x3f3fbc){return new BPromise(function(_0x328854,_0xbdad29){return client[_0xd5b7('0xb')](_0x142565,_0x3f3fbc)[_0xd5b7('0xc')](function(_0x2e6da5){logger[_0xd5b7('0xd')](_0xd5b7('0xe'),_0x440e9d,_0xd5b7('0xf'));logger[_0xd5b7('0x10')](_0xd5b7('0x11'),_0x440e9d,_0xd5b7('0xf'),JSON['stringify'](_0x2e6da5));if(_0x2e6da5[_0xd5b7('0x12')]){if(_0x2e6da5[_0xd5b7('0x12')][_0xd5b7('0x13')]===0x1f4){logger[_0xd5b7('0x12')](_0xd5b7('0xe'),_0x440e9d,_0x2e6da5['error'][_0xd5b7('0x14')]);return _0xbdad29(_0x2e6da5[_0xd5b7('0x12')]['message']);}logger['error']('MailApplication,\x20%s,\x20%s',_0x440e9d,_0x2e6da5['error']['message']);return _0x328854(_0x2e6da5['error'][_0xd5b7('0x14')]);}else{logger[_0xd5b7('0xd')](_0xd5b7('0xe'),_0x440e9d,_0xd5b7('0xf'));_0x328854(_0x2e6da5[_0xd5b7('0x15')]['message']);}})[_0xd5b7('0x16')](function(_0x39f7c3){logger[_0xd5b7('0x12')](_0xd5b7('0xe'),_0x440e9d,_0x39f7c3);_0xbdad29(_0x39f7c3);});});}exports[_0xd5b7('0x17')]=function(_0x461b61){var _0x1a6641=this;return new Promise(function(_0x13ed17,_0x2d2a62){return db[_0xd5b7('0x18')][_0xd5b7('0x19')](_0x461b61['body'],{'raw':_0x461b61[_0xd5b7('0x1a')]?_0x461b61['options'][_0xd5b7('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x461b61[_0xd5b7('0x1a')]?_0x461b61[_0xd5b7('0x1a')][_0xd5b7('0x1c')]||null:null,'attributes':_0x461b61[_0xd5b7('0x1a')]?_0x461b61[_0xd5b7('0x1a')][_0xd5b7('0x1d')]||null:null,'limit':_0x461b61[_0xd5b7('0x1a')]?_0x461b61[_0xd5b7('0x1a')][_0xd5b7('0x1e')]||null:null})[_0xd5b7('0xc')](function(_0x3be978){logger[_0xd5b7('0xd')](_0xd5b7('0x17'),_0x461b61);logger[_0xd5b7('0x10')]('UpdateMailApplication',_0x461b61,JSON['stringify'](_0x3be978));_0x13ed17(_0x3be978);})[_0xd5b7('0x16')](function(_0x16b175){logger['error']('UpdateMailApplication',_0x16b175[_0xd5b7('0x14')],_0x461b61);_0x2d2a62(_0x1a6641[_0xd5b7('0x12')](0x1f4,_0x16b175[_0xd5b7('0x14')]));});});}; \ No newline at end of file +var _0x5f35=['randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','MailApplication,\x20%s,\x20%s','request\x20sent','debug','MailApplication,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','UpdateMailApplication','MailApplication','update','options','raw','where','attributes','limit','lodash','util','moment'];(function(_0x489b87,_0xd51c93){var _0x1823b6=function(_0x451c70){while(--_0x451c70){_0x489b87['push'](_0x489b87['shift']());}};_0x1823b6(++_0xd51c93);}(_0x5f35,0x165));var _0x55f3=function(_0x31b5b2,_0x5ab927){_0x31b5b2=_0x31b5b2-0x0;var _0x364f13=_0x5f35[_0x31b5b2];return _0x364f13;};'use strict';var _=require(_0x55f3('0x0'));var util=require(_0x55f3('0x1'));var moment=require(_0x55f3('0x2'));var BPromise=require('bluebird');var rs=require(_0x55f3('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x55f3('0x4'))['db'];var utils=require(_0x55f3('0x5'));var logger=require(_0x55f3('0x6'))('rpc');var config=require(_0x55f3('0x7'));var jayson=require(_0x55f3('0x8'));var client=jayson[_0x55f3('0x9')][_0x55f3('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x66867b,_0x34633e,_0x439eeb){return new BPromise(function(_0xc33e8c,_0x4edac0){return client['request'](_0x66867b,_0x439eeb)[_0x55f3('0xb')](function(_0x45a5f6){logger[_0x55f3('0xc')](_0x55f3('0xd'),_0x34633e,_0x55f3('0xe'));logger[_0x55f3('0xf')](_0x55f3('0x10'),_0x34633e,_0x55f3('0xe'),JSON['stringify'](_0x45a5f6));if(_0x45a5f6[_0x55f3('0x11')]){if(_0x45a5f6[_0x55f3('0x11')][_0x55f3('0x12')]===0x1f4){logger[_0x55f3('0x11')](_0x55f3('0xd'),_0x34633e,_0x45a5f6[_0x55f3('0x11')][_0x55f3('0x13')]);return _0x4edac0(_0x45a5f6[_0x55f3('0x11')][_0x55f3('0x13')]);}logger[_0x55f3('0x11')](_0x55f3('0xd'),_0x34633e,_0x45a5f6[_0x55f3('0x11')][_0x55f3('0x13')]);return _0xc33e8c(_0x45a5f6[_0x55f3('0x11')]['message']);}else{logger['info']('MailApplication,\x20%s,\x20%s',_0x34633e,_0x55f3('0xe'));_0xc33e8c(_0x45a5f6[_0x55f3('0x14')][_0x55f3('0x13')]);}})[_0x55f3('0x15')](function(_0x4a3a74){logger[_0x55f3('0x11')](_0x55f3('0xd'),_0x34633e,_0x4a3a74);_0x4edac0(_0x4a3a74);});});}exports[_0x55f3('0x16')]=function(_0x405417){var _0x2adedc=this;return new Promise(function(_0x1ef237,_0x43bec5){return db[_0x55f3('0x17')][_0x55f3('0x18')](_0x405417['body'],{'raw':_0x405417[_0x55f3('0x19')]?_0x405417[_0x55f3('0x19')][_0x55f3('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x405417[_0x55f3('0x19')]?_0x405417['options'][_0x55f3('0x1b')]||null:null,'attributes':_0x405417[_0x55f3('0x19')]?_0x405417[_0x55f3('0x19')][_0x55f3('0x1c')]||null:null,'limit':_0x405417[_0x55f3('0x19')]?_0x405417[_0x55f3('0x19')][_0x55f3('0x1d')]||null:null})[_0x55f3('0xb')](function(_0x498a09){logger['info'](_0x55f3('0x16'),_0x405417);logger[_0x55f3('0xf')](_0x55f3('0x16'),_0x405417,JSON['stringify'](_0x498a09));_0x1ef237(_0x498a09);})[_0x55f3('0x15')](function(_0x206089){logger[_0x55f3('0x11')]('UpdateMailApplication',_0x206089[_0x55f3('0x13')],_0x405417);_0x43bec5(_0x2adedc[_0x55f3('0x11')](0x1f4,_0x206089[_0x55f3('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/index.js b/server/api/mailInteraction/index.js index 86c3e5f..1167501 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 _0x7995=['update','delete','mailinteraction:destroy','removeTags','exports','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','/describe','describe','show','/:id/messages','/:id/download','download','post','create','addMessage','/:id/tags','mail','put','/:id','tracked','mailinteraction:update'];(function(_0x37b37f,_0x39aa03){var _0x44b326=function(_0x4874c4){while(--_0x4874c4){_0x37b37f['push'](_0x37b37f['shift']());}};_0x44b326(++_0x39aa03);}(_0x7995,0xff));var _0x5799=function(_0x412540,_0x1e8964){_0x412540=_0x412540-0x0;var _0x246377=_0x7995[_0x412540];return _0x246377;};'use strict';var express=require('express');var router=express[_0x5799('0x0')]();var auth=require(_0x5799('0x1'));var interaction=require(_0x5799('0x2'));var controller=require('./mailInteraction.controller');router[_0x5799('0x3')]('/',auth[_0x5799('0x4')](),controller['index']);router[_0x5799('0x3')](_0x5799('0x5'),auth['isAuthenticated'](),controller[_0x5799('0x6')]);router[_0x5799('0x3')]('/:id',auth['isAuthenticated'](),controller[_0x5799('0x7')]);router[_0x5799('0x3')](_0x5799('0x8'),auth[_0x5799('0x4')](),controller['getMessages']);router[_0x5799('0x3')](_0x5799('0x9'),auth[_0x5799('0x4')](),controller[_0x5799('0xa')]);router[_0x5799('0xb')]('/',auth[_0x5799('0x4')](),controller[_0x5799('0xc')]);router['post'](_0x5799('0x8'),auth[_0x5799('0x4')](),controller[_0x5799('0xd')]);router[_0x5799('0xb')](_0x5799('0xe'),auth['isAuthenticated'](),interaction['tracked'](_0x5799('0xf'),'mailinteraction:addtags'),controller['addTags']);router[_0x5799('0x10')](_0x5799('0x11'),auth[_0x5799('0x4')](),interaction[_0x5799('0x12')](_0x5799('0xf'),_0x5799('0x13')),controller[_0x5799('0x14')]);router[_0x5799('0x15')](_0x5799('0x11'),auth[_0x5799('0x4')](),interaction[_0x5799('0x12')]('mail',_0x5799('0x16')),controller['destroy']);router[_0x5799('0x15')](_0x5799('0xe'),auth[_0x5799('0x4')](),controller[_0x5799('0x17')]);module[_0x5799('0x18')]=router; \ No newline at end of file +var _0x9a95=['/:id/download','download','create','addMessage','post','/:id/tags','tracked','mail','mailinteraction:addtags','put','mailinteraction:update','mailinteraction:destroy','delete','exports','express','Router','../../components/auth/service','../../components/interaction/service','./mailInteraction.controller','isAuthenticated','get','/describe','describe','/:id','show','/:id/messages'];(function(_0x962fc5,_0x58f074){var _0x43667c=function(_0x5e6ec0){while(--_0x5e6ec0){_0x962fc5['push'](_0x962fc5['shift']());}};_0x43667c(++_0x58f074);}(_0x9a95,0x1e2));var _0x59a9=function(_0x2cae33,_0x5d2f7c){_0x2cae33=_0x2cae33-0x0;var _0x2cb03e=_0x9a95[_0x2cae33];return _0x2cb03e;};'use strict';var express=require(_0x59a9('0x0'));var router=express[_0x59a9('0x1')]();var auth=require(_0x59a9('0x2'));var interaction=require(_0x59a9('0x3'));var controller=require(_0x59a9('0x4'));router['get']('/',auth[_0x59a9('0x5')](),controller['index']);router[_0x59a9('0x6')](_0x59a9('0x7'),auth['isAuthenticated'](),controller[_0x59a9('0x8')]);router['get'](_0x59a9('0x9'),auth['isAuthenticated'](),controller[_0x59a9('0xa')]);router[_0x59a9('0x6')](_0x59a9('0xb'),auth[_0x59a9('0x5')](),controller['getMessages']);router[_0x59a9('0x6')](_0x59a9('0xc'),auth[_0x59a9('0x5')](),controller[_0x59a9('0xd')]);router['post']('/',auth['isAuthenticated'](),controller[_0x59a9('0xe')]);router['post'](_0x59a9('0xb'),auth[_0x59a9('0x5')](),controller[_0x59a9('0xf')]);router[_0x59a9('0x10')](_0x59a9('0x11'),auth[_0x59a9('0x5')](),interaction[_0x59a9('0x12')](_0x59a9('0x13'),_0x59a9('0x14')),controller['addTags']);router[_0x59a9('0x15')]('/:id',auth['isAuthenticated'](),interaction[_0x59a9('0x12')](_0x59a9('0x13'),_0x59a9('0x16')),controller['update']);router['delete'](_0x59a9('0x9'),auth[_0x59a9('0x5')](),interaction[_0x59a9('0x12')](_0x59a9('0x13'),_0x59a9('0x17')),controller['destroy']);router[_0x59a9('0x18')]('/:id/tags',auth[_0x59a9('0x5')](),controller['removeTags']);module[_0x59a9('0x19')]=router; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.attributes.js b/server/api/mailInteraction/mailInteraction.attributes.js index e2b16c3..ae580f7 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 _0xb480=['BOOLEAN','DATE','STRING','TEXT','ENUM','out','sequelize','exports'];(function(_0x3a60b8,_0x47caab){var _0x4eb583=function(_0x2251b5){while(--_0x2251b5){_0x3a60b8['push'](_0x3a60b8['shift']());}};_0x4eb583(++_0x47caab);}(_0xb480,0xae));var _0x0b48=function(_0x2ab251,_0x41f7bb){_0x2ab251=_0x2ab251-0x0;var _0x4461c4=_0xb480[_0x2ab251];return _0x4461c4;};'use strict';var Sequelize=require(_0x0b48('0x0'));var iconv=require('iconv');module[_0x0b48('0x1')]={'closed':{'type':Sequelize[_0x0b48('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x0b48('0x3')]},'disposition':{'type':Sequelize[_0x0b48('0x4')]},'secondDisposition':{'type':Sequelize[_0x0b48('0x4')]},'thirdDisposition':{'type':Sequelize[_0x0b48('0x4')]},'note':{'type':Sequelize[_0x0b48('0x4')]},'inReplyTo':{'type':Sequelize[_0x0b48('0x4')](0x1fe)},'to':{'type':Sequelize['STRING']},'cc':{'type':Sequelize[_0x0b48('0x5')]('long')},'subject':{'type':Sequelize[_0x0b48('0x5')]()},'attach':{'type':Sequelize[_0x0b48('0x2')],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0x0b48('0x3')]},'substatus':{'type':Sequelize[_0x0b48('0x4')](0x3c)},'substatusAt':{'type':Sequelize[_0x0b48('0x3')]},'firstMsgDirection':{'type':Sequelize[_0x0b48('0x6')]('in',_0x0b48('0x7')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x0b48('0x3')]},'lastMsgDirection':{'type':Sequelize[_0x0b48('0x6')]('in','out'),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x0b48('0x2')],'defaultValue':![]}}; \ No newline at end of file +var _0xe9fd=['out','sequelize','exports','BOOLEAN','DATE','STRING','long','TEXT','ENUM'];(function(_0x28470a,_0x37e9fe){var _0xcb3c52=function(_0x13208e){while(--_0x13208e){_0x28470a['push'](_0x28470a['shift']());}};_0xcb3c52(++_0x37e9fe);}(_0xe9fd,0x14e));var _0xde9f=function(_0x5e3fd4,_0x481b9e){_0x5e3fd4=_0x5e3fd4-0x0;var _0x5f59af=_0xe9fd[_0x5e3fd4];return _0x5f59af;};'use strict';var Sequelize=require(_0xde9f('0x0'));var iconv=require('iconv');module[_0xde9f('0x1')]={'closed':{'type':Sequelize[_0xde9f('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xde9f('0x3')]},'disposition':{'type':Sequelize[_0xde9f('0x4')]},'secondDisposition':{'type':Sequelize[_0xde9f('0x4')]},'thirdDisposition':{'type':Sequelize[_0xde9f('0x4')]},'note':{'type':Sequelize[_0xde9f('0x4')]},'inReplyTo':{'type':Sequelize[_0xde9f('0x4')](0x1fe)},'to':{'type':Sequelize[_0xde9f('0x4')]},'cc':{'type':Sequelize['TEXT'](_0xde9f('0x5'))},'subject':{'type':Sequelize[_0xde9f('0x6')]()},'attach':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0xde9f('0x3')]},'substatus':{'type':Sequelize[_0xde9f('0x4')](0x3c)},'substatusAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize[_0xde9f('0x7')]('in',_0xde9f('0x8')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xde9f('0x3')]},'lastMsgDirection':{'type':Sequelize[_0xde9f('0x7')]('in',_0xde9f('0x8')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0xde9f('0x2')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.controller.js b/server/api/mailInteraction/mailInteraction.controller.js index df136c2..88b2a79 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 _0x46e1=['filter','isNumeric','i.id\x20LIKE\x20?','isEmail','c.email\x20LIKE\x20?','MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','group','i.id','Sequelize','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages','contactName','order','DESC','t.id\x20IN\x20?','resolve','i.MailAccountId\x20IS\x20NOT\x20NULL','role','agent','getMailAccounts','i.MailAccountId\x20IS\x20NULL','i.MailAccountId\x20IN\x20?','user','sequelize','toString','Account.key','Account.mandatoryDisposition','i.createdAt','i.updatedAt','i.closed','i.attach','i.lastMsgDirection','i.subject','i.disposition','i.to','i.ContactId','i.MailAccountId','i.UserId','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','c.fax','Contact.fax','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.MailInteractionId\x20IN\x20?','groupBy','MailInteractionId','Setting','findOne','enableEmailPreview','all','show','params','includeAll','include','merge','options','create','body','update','describe','addMessage','ids','omit','findAll','inlineCss','rows','addTags','setTags','spread','mailInteractionTags:save','removeTags','unix','join','server','files','tmp','root','attachments','format','transcript-%d-%s.zip','Attachments','bcc','subject','Messages','get','mkdirSync','each','headers','Bcc','basename','existsSync','readFileSync','download','unlinkSync','eml-format','rimraf','zip-dir','moment','bluebird','util','path','lodash','squel','juice','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../mysqldb','html-entities','defaults','localhost','socket.io-emitter','redis','./mailInteraction.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','then','destroy','name','send','Users','TagIds','Tags','split','forEach','push','MailMessage','plainBody','lastMsgText','trimStart','catch','waiting','talking','answered','unmanaged','UserId','closed','map','MailInteraction','rawAttributes','type','key','model','keys','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','sort','where','pick','select','field','color','tools_tags','u.id','ui.MailInteractionId','from','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','mail_accounts','a.id\x20=\x20i.MailAccountId','mail_messages','me.MailInteractionId\x20=\x20i.id','mail_interaction_has_tags','it.MailInteractionId\x20=\x20i.id','expr','search','parseSearch','sqlOperator','conditions','length','having','`\x20=\x200','`\x20>\x200','operator','value','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','find','ContactId','buildExpression','Tag','union','User','$substring','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','text','some','compact','isEmpty','MailAccountId','concat','createdAt','parse','$gte','$lte','\x20IS\x20NULL','\x20=\x20?','read','tag','isArray'];(function(_0x3f8437,_0x1d79e8){var _0x35c822=function(_0x1a189d){while(--_0x1a189d){_0x3f8437['push'](_0x3f8437['shift']());}};_0x35c822(++_0x1d79e8);}(_0x46e1,0x155));var _0x146e=function(_0x5be3de,_0x54ee2f){_0x5be3de=_0x5be3de-0x0;var _0x2104c6=_0x46e1[_0x5be3de];return _0x2104c6;};'use strict';var emlformat=require(_0x146e('0x0'));var rimraf=require(_0x146e('0x1'));var zipdir=require(_0x146e('0x2'));var moment=require(_0x146e('0x3'));var BPromise=require(_0x146e('0x4'));var util=require(_0x146e('0x5'));var path=require(_0x146e('0x6'));var fs=require('fs');var _=require(_0x146e('0x7'));var squel=require(_0x146e('0x8'));var juice=require(_0x146e('0x9'));var Redis=require('ioredis');var qs=require(_0x146e('0xa'));var as=require(_0x146e('0xb'));var logger=require(_0x146e('0xc'))(_0x146e('0xd'));var config=require(_0x146e('0xe'));var db=require(_0x146e('0xf'))['db'];var htmlEntities=require(_0x146e('0x10'));config['redis']=_[_0x146e('0x11')](config['redis'],{'host':_0x146e('0x12'),'port':0x18eb});var socket=require(_0x146e('0x13'))(new Redis(config[_0x146e('0x14')]));require(_0x146e('0x15'))[_0x146e('0x16')](socket);function respondWithStatusCode(_0x335df8,_0x5d6766){_0x5d6766=_0x5d6766||0xcc;return function(_0x4caa5e){if(_0x4caa5e){return _0x335df8[_0x146e('0x17')](_0x5d6766);}return _0x335df8[_0x146e('0x18')](_0x5d6766)[_0x146e('0x19')]();};}function respondWithResult(_0x1a567a,_0x29400a){_0x29400a=_0x29400a||0xc8;return function(_0x1ab0aa){if(_0x1ab0aa){return _0x1a567a[_0x146e('0x18')](_0x29400a)[_0x146e('0x1a')](_0x1ab0aa);}};}function respondWithFilteredResult(_0x524209,_0x59c066){return function(_0x2b925a){if(_0x2b925a){var _0x3b2f06=typeof _0x59c066[_0x146e('0x1b')]===_0x146e('0x1c')&&typeof _0x59c066[_0x146e('0x1d')]===_0x146e('0x1c');var _0x469b94=_0x2b925a[_0x146e('0x1e')];var _0x44c82f=_0x3b2f06?0x0:_0x59c066[_0x146e('0x1b')];var _0x39e41f=_0x3b2f06?_0x2b925a['count']:_0x59c066[_0x146e('0x1b')]+_0x59c066[_0x146e('0x1d')];var _0x3f77d3;if(_0x39e41f>=_0x469b94){_0x39e41f=_0x469b94;_0x3f77d3=0xc8;}else{_0x3f77d3=0xce;}_0x524209[_0x146e('0x18')](_0x3f77d3);return _0x524209[_0x146e('0x1f')](_0x146e('0x20'),_0x44c82f+'-'+_0x39e41f+'/'+_0x469b94)[_0x146e('0x1a')](_0x2b925a);}return null;};}function saveUpdates(_0x4fc704){return function(_0x2a8dd2){if(_0x2a8dd2){return _0x2a8dd2['update'](_0x4fc704)[_0x146e('0x21')](function(_0x1779cc){return _0x1779cc;});}return null;};}function removeEntity(_0x387323){return function(_0x48596a){if(_0x48596a){return _0x48596a[_0x146e('0x22')]()['then'](function(){_0x387323[_0x146e('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3df09c){return function(_0x474475){if(!_0x474475){_0x3df09c['sendStatus'](0x194);}return _0x474475;};}function handleError(_0x47c6d1,_0x4eca1a){_0x4eca1a=_0x4eca1a||0x1f4;return function(_0x4b72e9){logger['error'](_0x4b72e9['stack']);if(_0x4b72e9[_0x146e('0x23')]){delete _0x4b72e9['name'];}_0x47c6d1[_0x146e('0x18')](_0x4eca1a)[_0x146e('0x24')](_0x4b72e9);};}function getInteractionUsers(_0xc39f4d,_0x37e774){return new BPromise(function(_0x44345a,_0xed7b99){try{if(_0x37e774[_0xc39f4d['id']]){_0xc39f4d[_0x146e('0x25')]=_['map'](_0x37e774[_0xc39f4d['id']],function(_0x96522c){return{'id':_0x96522c['id'],'fullname':_0x96522c['fullname']};});}}catch(_0x2a31b8){_0xed7b99(_0x2a31b8);}_0x44345a(_0xc39f4d);});}function getInteractionTags(_0x4afb82,_0x53250d){return new BPromise(function(_0x6442f3,_0x486c6a){try{if(_0x4afb82[_0x146e('0x26')]){_0x4afb82[_0x146e('0x27')]=[];_0x4afb82[_0x146e('0x26')][_0x146e('0x28')](',')[_0x146e('0x29')](function(_0x5bd280){_0x4afb82[_0x146e('0x27')][_0x146e('0x2a')](_0x53250d[_0x5bd280]);});}delete _0x4afb82[_0x146e('0x26')];}catch(_0x1f7362){_0x486c6a(_0x1f7362);}_0x6442f3(_0x4afb82);});}function getLastMessageText(_0x21194a){return new BPromise(function(_0x312fee,_0x2d95c6){return db[_0x146e('0x2b')]['findOne']({'where':{'$and':[{'MailInteractionId':_0x21194a['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':'out'},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':[_0x146e('0x2c')],'order':'-id','raw':!![]})[_0x146e('0x21')](function(_0x5345fb){if(_0x5345fb&&_0x5345fb['plainBody']){_0x21194a[_0x146e('0x2d')]=_[_0x146e('0x2e')](_0x5345fb[_0x146e('0x2c')]);}_0x312fee(_0x21194a);})[_0x146e('0x2f')](function(_0x1d4b9f){_0x2d95c6(_0x1d4b9f);});});}function updateMailInteraction(_0x2ea76e,_0x5bc977,_0x1630bd,_0x564b14){return new BPromise(function(_0x28ff20,_0x5ea880){return getInteractionUsers(_0x2ea76e,_0x1630bd)[_0x146e('0x21')](function(_0x2b9dd2){return getInteractionTags(_0x2b9dd2,_0x5bc977);})[_0x146e('0x21')](function(_0x56c6d6){return getStateInteraction(_0x56c6d6);})[_0x146e('0x21')](function(_0x8454fd){if(_0x564b14){_0x28ff20(getLastMessageText(_0x8454fd));}else{_0x28ff20(_0x8454fd);}})['catch'](function(_0x781123){_0x5ea880(_0x781123);});});}function getStateInteraction(_0x3271e1){return new BPromise(function(_0x2f438d){_0x3271e1[_0x146e('0x30')]=0x0;_0x3271e1[_0x146e('0x31')]=0x0;_0x3271e1[_0x146e('0x32')]=0x0;_0x3271e1[_0x146e('0x33')]=0x0;_0x3271e1['total']=0x0;if(!_0x3271e1['closed']&&!_0x3271e1[_0x146e('0x34')]){_0x3271e1[_0x146e('0x30')]+=0x1;}if(!_0x3271e1[_0x146e('0x35')]&&_0x3271e1[_0x146e('0x34')]){_0x3271e1[_0x146e('0x31')]+=0x1;if(_0x3271e1[_0x146e('0x30')]){_0x3271e1['waiting']-=0x1;}}if(_0x3271e1[_0x146e('0x35')]&&_0x3271e1['UserId']){_0x3271e1[_0x146e('0x32')]+=0x1;if(_0x3271e1[_0x146e('0x31')]){_0x3271e1[_0x146e('0x31')]-=0x1;}}if(_0x3271e1[_0x146e('0x35')]&&!_0x3271e1[_0x146e('0x34')]){_0x3271e1[_0x146e('0x33')]+=0x1;if(_0x3271e1['waiting']){_0x3271e1['waiting']-=0x1;}}_0x3271e1['total']+=0x1;_0x2f438d(_0x3271e1);});}exports['index']=function(_0x783b55,_0xa06a50){var _0x3c97eb={},_0x45be48={},_0xba1f7d={'count':0x0,'rows':[]};var _0xc33b27=_[_0x146e('0x36')](db[_0x146e('0x37')][_0x146e('0x38')],function(_0x3a1f0a){return{'name':_0x3a1f0a['fieldName'],'type':_0x3a1f0a[_0x146e('0x39')][_0x146e('0x3a')]};});_0x45be48[_0x146e('0x3b')]=_[_0x146e('0x36')](_0xc33b27,_0x146e('0x23'));_0x45be48['query']=_[_0x146e('0x3c')](_0x783b55[_0x146e('0x3d')]);_0x45be48[_0x146e('0x3e')]=_[_0x146e('0x3f')](_0x45be48[_0x146e('0x3b')],_0x45be48[_0x146e('0x3d')]);_0x3c97eb['attributes']=_[_0x146e('0x3f')](_0x45be48[_0x146e('0x3b')],qs[_0x146e('0x40')](_0x783b55['query'][_0x146e('0x40')]));_0x3c97eb[_0x146e('0x41')]=_0x3c97eb['attributes']['length']?_0x3c97eb['attributes']:_0x45be48[_0x146e('0x3b')];if(!_0x783b55[_0x146e('0x3d')][_0x146e('0x42')](_0x146e('0x43'))){_0x3c97eb['limit']=qs[_0x146e('0x1d')](_0x783b55[_0x146e('0x3d')][_0x146e('0x1d')]);_0x3c97eb[_0x146e('0x1b')]=qs[_0x146e('0x1b')](_0x783b55['query'][_0x146e('0x1b')]);}_0x3c97eb['order']=qs[_0x146e('0x44')](_0x783b55[_0x146e('0x3d')][_0x146e('0x44')]);_0x3c97eb[_0x146e('0x45')]=qs['filters'](_[_0x146e('0x46')](_0x783b55['query'],_0x45be48[_0x146e('0x3e')]),_0xc33b27);var _0x212058=[];var _0x18e7bc=squel[_0x146e('0x47')]()[_0x146e('0x48')]('id')[_0x146e('0x48')]('name')[_0x146e('0x48')](_0x146e('0x49'))['from'](_0x146e('0x4a'));var _0x11968c=squel[_0x146e('0x47')]()[_0x146e('0x48')](_0x146e('0x4b'))[_0x146e('0x48')]('u.fullname')[_0x146e('0x48')](_0x146e('0x4c'))[_0x146e('0x4d')](_0x146e('0x4e'),'ui')[_0x146e('0x4f')](_0x146e('0x50'),'u',_0x146e('0x51'));var _0x2e7041=squel['select']()[_0x146e('0x4d')](_0x146e('0x52'),'i')['left_join'](_0x146e('0x53'),'c',_0x146e('0x54'))[_0x146e('0x4f')](_0x146e('0x50'),'o','o.id\x20=\x20i.UserId')[_0x146e('0x4f')](_0x146e('0x55'),'a',_0x146e('0x56'))[_0x146e('0x4f')](_0x146e('0x57'),'me',_0x146e('0x58'))['left_join'](_0x146e('0x59'),'it',_0x146e('0x5a'))[_0x146e('0x4f')](_0x146e('0x4a'),'t','t.id\x20=\x20it.TagId');var _0x33a5b9=squel[_0x146e('0x5b')]();var _0x44044c=[];var _0x177d9a=squel[_0x146e('0x5b')]();var _0x4d87cb;if(_0x783b55[_0x146e('0x3d')][_0x146e('0x5c')]){_0x4d87cb=as[_0x146e('0x5d')](_0x783b55[_0x146e('0x3d')]['search']);var _0x2cedba=_0x4d87cb[_0x146e('0x5e')];for(var _0x561284=0x0;_0x561284<_0x4d87cb[_0x146e('0x5f')][_0x146e('0x60')];_0x561284++){var _0x348182=_0x4d87cb[_0x146e('0x5f')][_0x561284];var _0x5e3930='i';var _0x182dc0=_['find'](_0xc33b27,[_0x146e('0x23'),_0x348182[_0x146e('0x48')]]);if(!_0x182dc0){switch(_0x348182[_0x146e('0x48')]){case'unreadMessages':if(_0x348182['value']==0x1){_0x2e7041[_0x146e('0x61')]('`'+_0x348182[_0x146e('0x48')]+_0x146e('0x62'));}else{_0x2e7041[_0x146e('0x61')]('`'+_0x348182[_0x146e('0x48')]+_0x146e('0x63'));}break;case'Contact':if(_0x348182[_0x146e('0x64')]==='$substring'){if(_0x348182[_0x146e('0x65')]['split']('\x20')['length']>0x1){_0x33a5b9[_0x2cedba]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x146e('0x66')](_0x348182[_0x146e('0x65')]),null);}else{var _0x39ed01='%'+_0x348182[_0x146e('0x65')]+'%';_0x33a5b9[_0x2cedba](_0x146e('0x67'),_0x39ed01,_0x39ed01,_0x39ed01);}}else{_0x182dc0=_[_0x146e('0x68')](_0xc33b27,['name',_0x146e('0x69')]);_0x348182[_0x146e('0x48')]=_0x146e('0x69');_0xb37c7b=as[_0x146e('0x6a')](_0x5e3930,_0x182dc0[_0x146e('0x39')],_0x348182);_0x33a5b9[_0x2cedba](_0xb37c7b['text'],_0xb37c7b['value']['start'],_0xb37c7b[_0x146e('0x65')][_0x146e('0x19')]);}break;case _0x146e('0x6b'):var _0x1af583=_0x348182[_0x146e('0x65')][_0x146e('0x28')](',')[_0x146e('0x36')](function(_0x1a0edd){return Number(_0x1a0edd);});_0x1af583[_0x146e('0x29')](function(_0x19f50f){_0x177d9a['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x19f50f+',%');});_0x44044c=_[_0x146e('0x6c')](_0x44044c,_0x1af583);break;case _0x146e('0x6d'):if(_0x348182['operator']===_0x146e('0x6e')){_0x33a5b9[_0x2cedba](_0x146e('0x6f'),'%'+_0x348182[_0x146e('0x65')]+'%',null);}else{_0x182dc0=_['find'](_0xc33b27,[_0x146e('0x23'),_0x146e('0x34')]);_0x348182[_0x146e('0x48')]=_0x146e('0x34');_0xb37c7b=as[_0x146e('0x6a')](_0x5e3930,_0x182dc0[_0x146e('0x39')],_0x348182);_0x33a5b9[_0x2cedba](_0xb37c7b[_0x146e('0x70')],_0xb37c7b[_0x146e('0x65')]['start'],_0xb37c7b['value']['end']);}break;case _0x146e('0x2c'):_0xb37c7b=as[_0x146e('0x6a')]('me',null,_0x348182);_0x33a5b9[_0x2cedba](_0xb37c7b[_0x146e('0x70')],_0xb37c7b['value']['start'],_0xb37c7b[_0x146e('0x65')][_0x146e('0x19')]);break;}}else{var _0xb37c7b=as[_0x146e('0x6a')](_0x5e3930,_0x182dc0[_0x146e('0x39')],_0x348182);_0x33a5b9[_0x2cedba](_0xb37c7b[_0x146e('0x70')],_0xb37c7b['value']['start'],_0xb37c7b['value'][_0x146e('0x19')]);}}}else{var _0x30e9d9=_(_0x783b55[_0x146e('0x3d')])[_0x146e('0x3c')]()['map'](function(_0x274ed4){return _[_0x146e('0x71')](_0xc33b27,['name',_0x274ed4])?_0x274ed4:undefined;})[_0x146e('0x72')]()[_0x146e('0x65')]();if(!_[_0x146e('0x73')](_0x30e9d9)){_0x30e9d9['forEach'](function(_0x17b17c){if(_0x17b17c===_0x146e('0x74')){_0x2e7041[_0x146e('0x45')]('i.MailAccountId\x20IN\x20?',[][_0x146e('0x75')](_0x783b55[_0x146e('0x3d')][_0x17b17c]));}else if(_0x17b17c===_0x146e('0x76')){var _0x27e10a=JSON[_0x146e('0x77')](_0x783b55[_0x146e('0x3d')][_0x17b17c])[_0x146e('0x78')];var _0x10b737=JSON[_0x146e('0x77')](_0x783b55[_0x146e('0x3d')][_0x17b17c])[_0x146e('0x79')];_0x2e7041[_0x146e('0x45')]('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x27e10a,_0x10b737);}else{if(_0x783b55[_0x146e('0x3d')][_0x17b17c]==='null'){_0x2e7041[_0x146e('0x45')]('i.'+_0x17b17c+_0x146e('0x7a'));}else{_0x2e7041[_0x146e('0x45')]('i.'+_0x17b17c+_0x146e('0x7b'),_0x783b55[_0x146e('0x3d')][_0x17b17c]);}}});}if(_0x783b55[_0x146e('0x3d')][_0x146e('0x7c')]){if(_0x783b55[_0x146e('0x3d')][_0x146e('0x7c')]==0x1){_0x2e7041[_0x146e('0x61')]('`unreadMessages`\x20=\x200');}else{_0x2e7041[_0x146e('0x61')]('`unreadMessages`\x20>\x200');}}if(_0x783b55[_0x146e('0x3d')][_0x146e('0x7d')]){_0x44044c=_[_0x146e('0x7e')](_0x783b55[_0x146e('0x3d')]['tag'])?_0x783b55['query']['tag']:new Array(_0x783b55[_0x146e('0x3d')][_0x146e('0x7d')]);_0x44044c[_0x146e('0x29')](function(_0x37b3f8){_0x177d9a['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x37b3f8+',%');});}if(_0x783b55[_0x146e('0x3d')]['filter']){var _0x49e6f1=_0x783b55[_0x146e('0x3d')][_0x146e('0x7f')]['replace']('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs[_0x146e('0x80')](_0x49e6f1)){_0x33a5b9['or'](_0x146e('0x81'),_0x49e6f1+'%');}else if(qs[_0x146e('0x82')](_0x49e6f1)){_0x33a5b9['or'](_0x146e('0x83'),_0x49e6f1+'%');}else{_0x33a5b9['or'](_0x146e('0x84'),qs[_0x146e('0x66')](_0x49e6f1))['or'](_0x146e('0x85'),qs[_0x146e('0x66')](_0x49e6f1));}}}_0x2e7041['where'](_0x33a5b9);_0x2e7041[_0x146e('0x86')](_0x146e('0x87'));var _0x19e355={'type':db[_0x146e('0x88')]['QueryTypes'][_0x146e('0x89')],'raw':!![]};var _0x4dc914=_0x2e7041[_0x146e('0x8a')]();_0x4dc914[_0x146e('0x48')](_0x146e('0x87'));_0x4dc914[_0x146e('0x48')](_0x146e('0x8b'),_0x146e('0x8c'));if(_0x3c97eb['order']){_0x3c97eb['order'][_0x146e('0x29')](function(_0x54498b){var _0x2ac690=_0x54498b[0x0]===_0x146e('0x8d')?_0x54498b[0x0]:'i.'+_0x54498b[0x0];_0x2e7041[_0x146e('0x8e')](_0x2ac690,_0x54498b[0x1]===_0x146e('0x8f')?![]:!![]);});}if(!_['isEmpty'](_0x44044c)){_0x2e7041['having'](_0x177d9a);_0x4dc914[_0x146e('0x45')](_0x146e('0x90'),_0x44044c);}BPromise[_0x146e('0x91')]()[_0x146e('0x21')](function(){if(!_0x4d87cb){if(_0x783b55[_0x146e('0x3d')][_0x146e('0x74')])return;_0x4dc914['where'](_0x146e('0x92'));_0x2e7041[_0x146e('0x45')](_0x146e('0x92'));return;}if(_0x783b55['user'][_0x146e('0x93')]!==_0x146e('0x94'))return;return _0x783b55['user'][_0x146e('0x95')]({'attributes':['id'],'raw':!![]})[_0x146e('0x21')](function(_0x178315){if(_[_0x146e('0x73')](_0x178315)){_0x4dc914[_0x146e('0x45')](_0x146e('0x96'));_0x2e7041['where'](_0x146e('0x96'));}else{_0x4dc914[_0x146e('0x45')](_0x146e('0x97'),_[_0x146e('0x36')](_0x178315,'id'));_0x2e7041['where'](_0x146e('0x97'),_[_0x146e('0x36')](_0x178315,'id'));}});})[_0x146e('0x21')](function(){if(_0x783b55[_0x146e('0x98')][_0x146e('0x93')]===_0x146e('0x94')&&!_0x4d87cb&&!_0x783b55[_0x146e('0x3d')][_0x146e('0x74')])return[];return db[_0x146e('0x99')]['query'](_0x4dc914[_0x146e('0x9a')](),_0x19e355);})['then'](function(_0x3c385c){_0xba1f7d[_0x146e('0x1e')]=_0x3c385c[_0x146e('0x60')];if(_0xba1f7d[_0x146e('0x1e')]===0x0)return[];return db['sequelize'][_0x146e('0x3d')](_0x18e7bc[_0x146e('0x9a')](),_0x19e355)[_0x146e('0x21')](function(_0x45b9fa){_0x212058=_['keyBy'](_0x45b9fa,'id');_0x19e355=_['merge'](_0x19e355,{'model':db[_0x146e('0x37')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x783b55['query']['fields']){_0x3c97eb[_0x146e('0x41')][_0x146e('0x29')](function(_0x3e4ff1){_0x2e7041[_0x146e('0x48')]('i.'+_0x3e4ff1);});}else{_0x2e7041['field'](_0x146e('0x8b'),_0x146e('0x8c'));_0x2e7041[_0x146e('0x48')]('a.key',_0x146e('0x9b'));_0x2e7041[_0x146e('0x48')]('a.mandatoryDisposition',_0x146e('0x9c'));_0x2e7041['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',_0x146e('0x8d'));_0x2e7041['field'](_0x146e('0x87'));_0x2e7041['field'](_0x146e('0x9d'));_0x2e7041['field'](_0x146e('0x9e'));_0x2e7041[_0x146e('0x48')](_0x146e('0x9f'));_0x2e7041[_0x146e('0x48')]('i.closedAt');_0x2e7041[_0x146e('0x48')](_0x146e('0xa0'));_0x2e7041[_0x146e('0x48')]('i.lastMsgAt');_0x2e7041[_0x146e('0x48')](_0x146e('0xa1'));_0x2e7041[_0x146e('0x48')](_0x146e('0xa2'));_0x2e7041[_0x146e('0x48')](_0x146e('0xa3'));_0x2e7041[_0x146e('0x48')]('i.secondDisposition');_0x2e7041['field']('i.thirdDisposition');_0x2e7041[_0x146e('0x48')]('i.substatus');_0x2e7041['field'](_0x146e('0xa4'));_0x2e7041[_0x146e('0x48')](_0x146e('0xa5'));_0x2e7041[_0x146e('0x48')](_0x146e('0xa6'));_0x2e7041['field'](_0x146e('0xa7'));_0x2e7041[_0x146e('0x48')](_0x146e('0xa8'),_0x146e('0xa9'));_0x2e7041[_0x146e('0x48')](_0x146e('0xaa'),_0x146e('0xab'));_0x2e7041[_0x146e('0x48')](_0x146e('0xac'),_0x146e('0xad'));_0x2e7041[_0x146e('0x48')](_0x146e('0xae'),_0x146e('0xaf'));_0x2e7041[_0x146e('0x48')](_0x146e('0xb0'),'Contact.mobile');_0x2e7041['field'](_0x146e('0xb1'),_0x146e('0xb2'));_0x2e7041['field']('o.fullname',_0x146e('0xb3'));_0x2e7041[_0x146e('0x48')](_0x146e('0xb4'),_0x146e('0xb5'));_0x2e7041['field'](_0x146e('0xb6'),_0x146e('0x26'));}if(_0x3c97eb[_0x146e('0x1d')])_0x2e7041[_0x146e('0x1d')](_0x3c97eb['limit']);if(_0x3c97eb[_0x146e('0x1b')])_0x2e7041[_0x146e('0x1b')](_0x3c97eb[_0x146e('0x1b')]);return db[_0x146e('0x99')][_0x146e('0x3d')](_0x2e7041['toString'](),_0x19e355);})[_0x146e('0x21')](function(_0xa3c6d7){if(_0xa3c6d7['length']>0x0)_0x11968c[_0x146e('0x45')](_0x146e('0xb7'),_[_0x146e('0x36')](_0xa3c6d7,'id'));return db[_0x146e('0x99')][_0x146e('0x3d')](_0x11968c[_0x146e('0x9a')](),_0x19e355)[_0x146e('0x21')](function(_0x158134){var _0x1e8abc=_[_0x146e('0xb8')](_0x158134,_0x146e('0xb9'));var _0x116638=[];return db[_0x146e('0xba')][_0x146e('0xbb')]({'attributes':[_0x146e('0xbc')],'raw':!![]})[_0x146e('0x21')](function(_0xb35af8){var _0x5b42f5=_0xb35af8['enableEmailPreview'];_0xa3c6d7['forEach'](function(_0x259686){_0x116638[_0x146e('0x2a')](updateMailInteraction(_0x259686,_0x212058,_0x1e8abc,_0x5b42f5));});return BPromise[_0x146e('0xbd')](_0x116638);});});});})[_0x146e('0x21')](function(_0x375832){_0xba1f7d['rows']=_0x375832;return _0xba1f7d;})[_0x146e('0x21')](respondWithFilteredResult(_0xa06a50,_0x3c97eb))[_0x146e('0x2f')](handleError(_0xa06a50,null));};exports[_0x146e('0xbe')]=function(_0xfc2b3c,_0x12faee){var _0x46ad24={'raw':![],'where':{'id':_0xfc2b3c[_0x146e('0xbf')]['id']}},_0xe1c60a={};_0xe1c60a[_0x146e('0x3b')]=_[_0x146e('0x3c')](db[_0x146e('0x37')][_0x146e('0x38')]);_0xe1c60a['query']=_[_0x146e('0x3c')](_0xfc2b3c[_0x146e('0x3d')]);_0xe1c60a[_0x146e('0x3e')]=_['intersection'](_0xe1c60a['model'],_0xe1c60a[_0x146e('0x3d')]);_0x46ad24['attributes']=_['intersection'](_0xe1c60a[_0x146e('0x3b')],qs['fields'](_0xfc2b3c[_0x146e('0x3d')]['fields']));_0x46ad24[_0x146e('0x41')]=_0x46ad24[_0x146e('0x41')][_0x146e('0x60')]?_0x46ad24['attributes']:_0xe1c60a['model'];if(_0xfc2b3c['query'][_0x146e('0xc0')]){_0x46ad24[_0x146e('0xc1')]=[{'all':!![]}];}_0x46ad24=_[_0x146e('0xc2')]({},_0x46ad24,_0xfc2b3c[_0x146e('0xc3')]);return db[_0x146e('0x37')][_0x146e('0x68')](_0x46ad24)[_0x146e('0x21')](handleEntityNotFound(_0x12faee,null))['then'](respondWithResult(_0x12faee,null))[_0x146e('0x2f')](handleError(_0x12faee,null));};exports[_0x146e('0xc4')]=function(_0x17cea5,_0x1705b6){return db['MailInteraction'][_0x146e('0xc4')](_0x17cea5[_0x146e('0xc5')],{})[_0x146e('0x21')](respondWithResult(_0x1705b6,0xc9))['catch'](handleError(_0x1705b6,null));};exports[_0x146e('0xc6')]=function(_0x1f085b,_0x59226c){if(_0x1f085b[_0x146e('0xc5')]['id']){delete _0x1f085b['body']['id'];}return db['MailInteraction'][_0x146e('0x68')]({'where':{'id':_0x1f085b[_0x146e('0xbf')]['id']}})[_0x146e('0x21')](handleEntityNotFound(_0x59226c,null))[_0x146e('0x21')](saveUpdates(_0x1f085b[_0x146e('0xc5')],null))[_0x146e('0x21')](respondWithResult(_0x59226c,null))[_0x146e('0x2f')](handleError(_0x59226c,null));};exports[_0x146e('0x22')]=function(_0x209711,_0x4d3bfc){return db[_0x146e('0x37')]['find']({'where':{'id':_0x209711['params']['id']}})[_0x146e('0x21')](handleEntityNotFound(_0x4d3bfc,null))[_0x146e('0x21')](removeEntity(_0x4d3bfc,null))[_0x146e('0x2f')](handleError(_0x4d3bfc,null));};exports[_0x146e('0xc7')]=function(_0x5557cd,_0x25cb52){return db['MailInteraction'][_0x146e('0xc7')]()[_0x146e('0x21')](respondWithResult(_0x25cb52,null))['catch'](handleError(_0x25cb52,null));};exports[_0x146e('0xc8')]=function(_0x27f358,_0x431b23){return db[_0x146e('0x2b')][_0x146e('0x68')]({'where':{'id':_0x27f358[_0x146e('0xbf')]['id']}})['then'](handleEntityNotFound(_0x431b23,null))[_0x146e('0x21')](function(_0x4b72d6){if(_0x4b72d6){return _0x4b72d6[_0x146e('0xc8')](_0x27f358[_0x146e('0xc5')][_0x146e('0xc9')],_[_0x146e('0xca')](_0x27f358[_0x146e('0xc5')],[_0x146e('0xc9'),'id'])||{});}})['then'](respondWithResult(_0x431b23,null))['catch'](handleError(_0x431b23,null));};exports['getMessages']=function(_0x3512d5,_0x4f04e8){var _0x4a58e5={'raw':![],'where':{}};var _0x28154f={};var _0x31dfa8={'count':0x0,'rows':[]};return db['MailInteraction']['findOne']({'where':{'id':_0x3512d5[_0x146e('0xbf')]['id']}})[_0x146e('0x21')](handleEntityNotFound(_0x4f04e8,null))['then'](function(_0x45320c){if(_0x45320c){_0x28154f[_0x146e('0x3b')]=_[_0x146e('0x3c')](db[_0x146e('0x2b')][_0x146e('0x38')]);_0x28154f[_0x146e('0x3d')]=_[_0x146e('0x3c')](_0x3512d5['query']);_0x28154f[_0x146e('0x3e')]=_['intersection'](_0x28154f[_0x146e('0x3b')],_0x28154f['query']);_0x4a58e5[_0x146e('0x41')]=_[_0x146e('0x3f')](_0x28154f[_0x146e('0x3b')],qs[_0x146e('0x40')](_0x3512d5['query']['fields']));_0x4a58e5[_0x146e('0x41')]=_0x4a58e5[_0x146e('0x41')][_0x146e('0x60')]?_0x4a58e5[_0x146e('0x41')]:_0x28154f[_0x146e('0x3b')];if(!_0x3512d5[_0x146e('0x3d')]['hasOwnProperty']('nolimit')){_0x4a58e5[_0x146e('0x1d')]=qs[_0x146e('0x1d')](_0x3512d5[_0x146e('0x3d')][_0x146e('0x1d')]);_0x4a58e5['offset']=qs[_0x146e('0x1b')](_0x3512d5[_0x146e('0x3d')][_0x146e('0x1b')]);}_0x4a58e5[_0x146e('0x8e')]=qs[_0x146e('0x44')](_0x3512d5[_0x146e('0x3d')]['sort']);_0x4a58e5[_0x146e('0x45')]=qs[_0x146e('0x3e')](_[_0x146e('0x46')](_0x3512d5[_0x146e('0x3d')],_0x28154f['filters']));_0x4a58e5[_0x146e('0x45')]['MailInteractionId']=_0x45320c['id'];if(_0x3512d5[_0x146e('0x3d')][_0x146e('0x7f')]){_0x4a58e5[_0x146e('0x45')]=_[_0x146e('0xc2')](_0x4a58e5['where'],{'$or':_['map'](_0x4a58e5[_0x146e('0x41')],function(_0x35952d){var _0x75cb0a={};_0x75cb0a[_0x35952d]={'$like':'%'+_0x3512d5[_0x146e('0x3d')][_0x146e('0x7f')]+'%'};return _0x75cb0a;})});}if(_0x3512d5['query'][_0x146e('0x78')]){var _0x55a316=_0x3512d5[_0x146e('0x3d')][_0x146e('0x78')]['split'](',');var _0x4e7ee7={};_0x4e7ee7[_0x55a316[0x0]]={'$gte':moment(_0x55a316[0x1])['format']('YYYY-MM-DD\x20HH:mm:ss')};_0x4a58e5[_0x146e('0x45')]=_[_0x146e('0xc2')](_0x4a58e5['where'],_0x4e7ee7);}_0x4a58e5=_['merge']({},_0x4a58e5,_0x3512d5[_0x146e('0xc3')]);return db[_0x146e('0x2b')]['count']({'where':_0x4a58e5[_0x146e('0x45')]})[_0x146e('0x21')](function(_0x5ea8f0){_0x31dfa8[_0x146e('0x1e')]=_0x5ea8f0;if(_0x3512d5[_0x146e('0x3d')][_0x146e('0xc0')]){_0x4a58e5[_0x146e('0xc1')]=[{'all':!![]}];}return db['MailMessage'][_0x146e('0xcb')](_0x4a58e5);})['then'](function(_0x4405dd){if(_0x3512d5[_0x146e('0x3d')][_0x146e('0xcc')]==='true'){for(var _0x1f45b9=0x0;_0x1f45b9<_0x4405dd[_0x146e('0x60')];_0x1f45b9++){_0x4405dd[_0x1f45b9][_0x146e('0xc5')]=juice(_0x4405dd[_0x1f45b9][_0x146e('0xc5')]);}}_0x31dfa8[_0x146e('0xcd')]=_0x4405dd;return _0x31dfa8;});}})[_0x146e('0x21')](respondWithFilteredResult(_0x4f04e8,_0x4a58e5))[_0x146e('0x2f')](handleError(_0x4f04e8,null));};exports[_0x146e('0xce')]=function(_0x87d391,_0x37cc9e){return db[_0x146e('0x37')]['find']({'where':{'id':_0x87d391[_0x146e('0xbf')]['id']}})[_0x146e('0x21')](handleEntityNotFound(_0x37cc9e,null))[_0x146e('0x21')](function(_0x2fc26a){if(_0x2fc26a){return _0x2fc26a[_0x146e('0xcf')](_0x87d391['body']['ids'],_[_0x146e('0xca')](_0x87d391[_0x146e('0xc5')],[_0x146e('0xc9'),'id'])||{})[_0x146e('0xd0')](function(){return db[_0x146e('0x6b')][_0x146e('0xcb')]({'attributes':['id',_0x146e('0x23'),_0x146e('0x49')],'where':{'id':_0x87d391[_0x146e('0xc5')]['ids']}});})[_0x146e('0x21')](function(_0x8b6c9){socket['emit'](_0x146e('0xd1'),{'id':Number(_0x87d391[_0x146e('0xbf')]['id']),'tags':_0x8b6c9||[]});return{'id':Number(_0x87d391[_0x146e('0xbf')]['id']),'tags':_0x8b6c9||[]};});}})['then'](respondWithResult(_0x37cc9e,null))[_0x146e('0x2f')](handleError(_0x37cc9e,null));};exports[_0x146e('0xd2')]=function(_0x455daa,_0x206444){return db[_0x146e('0x37')][_0x146e('0x68')]({'where':{'id':_0x455daa[_0x146e('0xbf')]['id']}})['then'](handleEntityNotFound(_0x206444,null))[_0x146e('0x21')](function(_0x46c0a3){if(_0x46c0a3){return _0x46c0a3[_0x146e('0xd2')](_0x455daa[_0x146e('0x3d')]['ids']);}})[_0x146e('0x21')](respondWithStatusCode(_0x206444,null))[_0x146e('0x2f')](handleError(_0x206444,null));};exports['download']=function(_0x1c8657,_0x2d20dd){var _0x574f57=moment()[_0x146e('0xd3')]()['toString']();var _0x599b16=path[_0x146e('0xd4')](config['root'],_0x146e('0xd5'),_0x146e('0xd6'),_0x146e('0xd7'));var _0x38c557=path[_0x146e('0xd4')](config[_0x146e('0xd8')],'server','files',_0x146e('0xd9'));var _0x17bd64=path[_0x146e('0xd4')](_0x599b16,_0x574f57);var _0x502736=util[_0x146e('0xda')](_0x146e('0xdb'),_0x1c8657[_0x146e('0xbf')]['id'],_0x574f57);var _0x2ccce2=path[_0x146e('0xd4')](_0x599b16,_0x502736);var _0x373327=[];if(_0x1c8657[_0x146e('0x3d')][_0x146e('0xd9')]){_0x373327[_0x146e('0x2a')]({'model':db['Attachment'],'as':_0x146e('0xdc'),'raw':!![]});}var _0x5d766d=[{'model':db[_0x146e('0x2b')],'as':'Messages','attributes':['id',_0x146e('0xc5'),'from','to','cc',_0x146e('0xdd'),_0x146e('0xde'),_0x146e('0x76')],'where':{'secret':![]},'order':qs[_0x146e('0x44')]('id'),'include':_0x373327}];return db[_0x146e('0x37')][_0x146e('0x68')]({'where':{'id':_0x1c8657[_0x146e('0xbf')]['id']},'include':_0x5d766d})['then'](handleEntityNotFound(_0x2d20dd,null))[_0x146e('0x21')](function(_0x1e7a3d){if(_0x1e7a3d&&_0x1e7a3d[_0x146e('0xdf')]){var _0x5c15ee=_0x1e7a3d[_0x146e('0xe0')]({'plain':!![]});fs[_0x146e('0xe1')](_0x17bd64);return BPromise[_0x146e('0xe2')](_0x5c15ee[_0x146e('0xdf')],function(_0x5ecdd1,_0x3bd420){var _0x23381f={'from':_0x5ecdd1[_0x146e('0x4d')],'to':_0x5ecdd1['to'],'subject':_0x5ecdd1[_0x146e('0xde')],'html':htmlEntities['decode'](_0x5ecdd1['body']),'headers':{'Date':moment(_0x5ecdd1[_0x146e('0x76')])['format']('ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ')},'attachments':[]};if(_0x5ecdd1['cc']){_0x23381f[_0x146e('0xe3')]['Cc']=_0x5ecdd1['cc'];}if(_0x5ecdd1['bcc']){_0x23381f[_0x146e('0xe3')][_0x146e('0xe4')]=_0x5ecdd1['bcc'];}return new BPromise(function(_0x5e3f25,_0x1d7751){if(_0x5ecdd1['Attachments']){for(var _0xa1e03c=0x0;_0xa1e03c<_0x5ecdd1[_0x146e('0xdc')][_0x146e('0x60')];_0xa1e03c++){var _0x2b0598=_0x5ecdd1[_0x146e('0xdc')][_0xa1e03c];var _0x21a5fd=path[_0x146e('0xd4')](_0x38c557,_0x2b0598[_0x146e('0xe5')]);if(fs[_0x146e('0xe6')](_0x21a5fd)){_0x23381f[_0x146e('0xd9')][_0x146e('0x2a')]({'name':_0x2b0598[_0x146e('0x23')],'contentType':_0x2b0598['type'],'data':fs[_0x146e('0xe7')](_0x21a5fd)});}}}emlformat['build'](_0x23381f,function(_0x3ec60f,_0x3f6f11){if(_0x3ec60f)return _0x1d7751(_0x3ec60f);fs['writeFileSync'](path[_0x146e('0xd4')](_0x17bd64,util[_0x146e('0xda')]('message%d.eml',_0x3bd420)),_0x3f6f11);return _0x5e3f25(_0x3f6f11);});});})['then'](function(){return new BPromise(function(_0x41ca64,_0x4a4330){zipdir(_0x17bd64,{'saveTo':_0x2ccce2},function(_0x10c3c9,_0x341cbe){if(_0x10c3c9)return _0x4a4330(_0x10c3c9);return _0x41ca64(_0x341cbe);});})[_0x146e('0x21')](function(){return new BPromise(function(_0x2f534c,_0x12bcff){rimraf(_0x17bd64,function(_0x8cdde6){if(_0x8cdde6)_0x12bcff(_0x8cdde6);return _0x2f534c();});});})['then'](function(){return _0x2d20dd[_0x146e('0xe8')](_0x2ccce2,_0x502736,function(_0x5cbe15){if(!_0x5cbe15)fs[_0x146e('0xe9')](_0x2ccce2);});});});}else{return _0x2d20dd[_0x146e('0x17')](0xc8);}})[_0x146e('0x2f')](handleError(_0x2d20dd,null));}; \ No newline at end of file +var _0x3f96=['rimraf','zip-dir','moment','bluebird','path','lodash','squel','juice','ioredis','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','html-entities','redis','defaults','localhost','socket.io-emitter','./mailInteraction.socket','sendStatus','status','end','json','offset','limit','count','set','Content-Range','update','then','destroy','error','stack','send','Users','map','TagIds','split','forEach','Tags','push','MailMessage','findOne','out','plainBody','-id','lastMsgText','catch','waiting','unmanaged','total','closed','UserId','talking','answered','index','MailInteraction','rawAttributes','fieldName','type','key','keys','query','filters','intersection','model','attributes','length','hasOwnProperty','nolimit','order','sort','pick','select','field','name','color','from','ui.MailInteractionId','user_has_mail_interactions','u.id\x20=\x20ui.UserId','mail_interactions','left_join','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','users','o.id\x20=\x20i.UserId','mail_accounts','a.id\x20=\x20i.MailAccountId','mail_messages','mail_interaction_has_tags','it.MailInteractionId\x20=\x20i.id','tools_tags','t.id\x20=\x20it.TagId','expr','parseSearch','conditions','unreadMessages','value','`\x20=\x200','having','`\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','text','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','operator','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','buildExpression','start','some','compact','MailAccountId','where','i.MailAccountId\x20IN\x20?','concat','createdAt','parse','$gte','$lte','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','tag','filter','replace','isNumeric','i.id\x20LIKE\x20?','isEmail','MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','group','i.id','Sequelize','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','DESC','t.id\x20IN\x20?','resolve','i.MailAccountId\x20IS\x20NOT\x20NULL','user','role','agent','getMailAccounts','i.MailAccountId\x20IS\x20NULL','sequelize','toString','keyBy','merge','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','i.closed','i.closedAt','i.lastMsgAt','i.disposition','i.secondDisposition','i.to','i.MailAccountId','i.UserId','c.firstName','Contact.firstName','Contact.email','c.phone','Contact.phone','Contact.mobile','c.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.MailInteractionId\x20IN\x20?','groupBy','MailInteractionId','Setting','enableEmailPreview','all','rows','show','params','fields','includeAll','options','find','create','body','describe','addMessage','ids','omit','format','YYYY-MM-DD\x20HH:mm:ss','include','inlineCss','addTags','setTags','spread','findAll','mailInteractionTags:save','removeTags','download','unix','join','root','server','files','attachments','transcript-%d-%s.zip','Attachments','Messages','bcc','subject','each','decode','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','basename','existsSync','readFileSync','build','message%d.eml','eml-format'];(function(_0x4e4c2d,_0x262cbb){var _0x1298b5=function(_0x25eda1){while(--_0x25eda1){_0x4e4c2d['push'](_0x4e4c2d['shift']());}};_0x1298b5(++_0x262cbb);}(_0x3f96,0x1d3));var _0x63f9=function(_0x30ff94,_0x34d0be){_0x30ff94=_0x30ff94-0x0;var _0x8813bf=_0x3f96[_0x30ff94];return _0x8813bf;};'use strict';var emlformat=require(_0x63f9('0x0'));var rimraf=require(_0x63f9('0x1'));var zipdir=require(_0x63f9('0x2'));var moment=require(_0x63f9('0x3'));var BPromise=require(_0x63f9('0x4'));var util=require('util');var path=require(_0x63f9('0x5'));var fs=require('fs');var _=require(_0x63f9('0x6'));var squel=require(_0x63f9('0x7'));var juice=require(_0x63f9('0x8'));var Redis=require(_0x63f9('0x9'));var qs=require('../../components/parsers/qs');var as=require(_0x63f9('0xa'));var logger=require(_0x63f9('0xb'))(_0x63f9('0xc'));var config=require(_0x63f9('0xd'));var db=require('../../mysqldb')['db'];var htmlEntities=require(_0x63f9('0xe'));config[_0x63f9('0xf')]=_[_0x63f9('0x10')](config[_0x63f9('0xf')],{'host':_0x63f9('0x11'),'port':0x18eb});var socket=require(_0x63f9('0x12'))(new Redis(config[_0x63f9('0xf')]));require(_0x63f9('0x13'))['register'](socket);function respondWithStatusCode(_0x3e038d,_0x1216f3){_0x1216f3=_0x1216f3||0xcc;return function(_0x4d2b17){if(_0x4d2b17){return _0x3e038d[_0x63f9('0x14')](_0x1216f3);}return _0x3e038d[_0x63f9('0x15')](_0x1216f3)[_0x63f9('0x16')]();};}function respondWithResult(_0x4a8acc,_0x45881b){_0x45881b=_0x45881b||0xc8;return function(_0x376780){if(_0x376780){return _0x4a8acc[_0x63f9('0x15')](_0x45881b)[_0x63f9('0x17')](_0x376780);}};}function respondWithFilteredResult(_0x10be8f,_0x568e3d){return function(_0x31997c){if(_0x31997c){var _0x51ec79=typeof _0x568e3d[_0x63f9('0x18')]==='undefined'&&typeof _0x568e3d[_0x63f9('0x19')]==='undefined';var _0x47050b=_0x31997c[_0x63f9('0x1a')];var _0x37fc43=_0x51ec79?0x0:_0x568e3d[_0x63f9('0x18')];var _0x100d39=_0x51ec79?_0x31997c[_0x63f9('0x1a')]:_0x568e3d[_0x63f9('0x18')]+_0x568e3d['limit'];var _0xc302eb;if(_0x100d39>=_0x47050b){_0x100d39=_0x47050b;_0xc302eb=0xc8;}else{_0xc302eb=0xce;}_0x10be8f[_0x63f9('0x15')](_0xc302eb);return _0x10be8f[_0x63f9('0x1b')](_0x63f9('0x1c'),_0x37fc43+'-'+_0x100d39+'/'+_0x47050b)[_0x63f9('0x17')](_0x31997c);}return null;};}function saveUpdates(_0x4bf06f){return function(_0x1e309f){if(_0x1e309f){return _0x1e309f[_0x63f9('0x1d')](_0x4bf06f)[_0x63f9('0x1e')](function(_0x4877e1){return _0x4877e1;});}return null;};}function removeEntity(_0x3b85c0){return function(_0x235354){if(_0x235354){return _0x235354[_0x63f9('0x1f')]()[_0x63f9('0x1e')](function(){_0x3b85c0[_0x63f9('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x59f437){return function(_0xf74a50){if(!_0xf74a50){_0x59f437[_0x63f9('0x14')](0x194);}return _0xf74a50;};}function handleError(_0x3c0589,_0x39c2d4){_0x39c2d4=_0x39c2d4||0x1f4;return function(_0x390d7e){logger[_0x63f9('0x20')](_0x390d7e[_0x63f9('0x21')]);if(_0x390d7e['name']){delete _0x390d7e['name'];}_0x3c0589[_0x63f9('0x15')](_0x39c2d4)[_0x63f9('0x22')](_0x390d7e);};}function getInteractionUsers(_0x363468,_0x46f335){return new BPromise(function(_0x462fe9,_0x62c363){try{if(_0x46f335[_0x363468['id']]){_0x363468[_0x63f9('0x23')]=_[_0x63f9('0x24')](_0x46f335[_0x363468['id']],function(_0x5637c3){return{'id':_0x5637c3['id'],'fullname':_0x5637c3['fullname']};});}}catch(_0x5cf43d){_0x62c363(_0x5cf43d);}_0x462fe9(_0x363468);});}function getInteractionTags(_0x1fcb7c,_0x2361a9){return new BPromise(function(_0x14d708,_0x4bc6fd){try{if(_0x1fcb7c[_0x63f9('0x25')]){_0x1fcb7c['Tags']=[];_0x1fcb7c[_0x63f9('0x25')][_0x63f9('0x26')](',')[_0x63f9('0x27')](function(_0x51c84b){_0x1fcb7c[_0x63f9('0x28')][_0x63f9('0x29')](_0x2361a9[_0x51c84b]);});}delete _0x1fcb7c[_0x63f9('0x25')];}catch(_0x22a82a){_0x4bc6fd(_0x22a82a);}_0x14d708(_0x1fcb7c);});}function getLastMessageText(_0xbbcd99){return new BPromise(function(_0x921ebf,_0x4817bc){return db[_0x63f9('0x2a')][_0x63f9('0x2b')]({'where':{'$and':[{'MailInteractionId':_0xbbcd99['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':_0x63f9('0x2c')},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':[_0x63f9('0x2d')],'order':_0x63f9('0x2e'),'raw':!![]})[_0x63f9('0x1e')](function(_0x8a7a85){if(_0x8a7a85&&_0x8a7a85[_0x63f9('0x2d')]){_0xbbcd99[_0x63f9('0x2f')]=_['trimStart'](_0x8a7a85[_0x63f9('0x2d')]);}_0x921ebf(_0xbbcd99);})['catch'](function(_0x419ac8){_0x4817bc(_0x419ac8);});});}function updateMailInteraction(_0xc8819f,_0x522f77,_0x387beb,_0x3937de){return new BPromise(function(_0x5a7d46,_0xc7d23a){return getInteractionUsers(_0xc8819f,_0x387beb)['then'](function(_0x49b25d){return getInteractionTags(_0x49b25d,_0x522f77);})[_0x63f9('0x1e')](function(_0x3d7bd1){return getStateInteraction(_0x3d7bd1);})[_0x63f9('0x1e')](function(_0x5d90ea){if(_0x3937de){_0x5a7d46(getLastMessageText(_0x5d90ea));}else{_0x5a7d46(_0x5d90ea);}})[_0x63f9('0x30')](function(_0x5e5975){_0xc7d23a(_0x5e5975);});});}function getStateInteraction(_0x3841b5){return new BPromise(function(_0x1050d3){_0x3841b5[_0x63f9('0x31')]=0x0;_0x3841b5['talking']=0x0;_0x3841b5['answered']=0x0;_0x3841b5[_0x63f9('0x32')]=0x0;_0x3841b5[_0x63f9('0x33')]=0x0;if(!_0x3841b5[_0x63f9('0x34')]&&!_0x3841b5[_0x63f9('0x35')]){_0x3841b5['waiting']+=0x1;}if(!_0x3841b5[_0x63f9('0x34')]&&_0x3841b5[_0x63f9('0x35')]){_0x3841b5[_0x63f9('0x36')]+=0x1;if(_0x3841b5[_0x63f9('0x31')]){_0x3841b5['waiting']-=0x1;}}if(_0x3841b5[_0x63f9('0x34')]&&_0x3841b5[_0x63f9('0x35')]){_0x3841b5[_0x63f9('0x37')]+=0x1;if(_0x3841b5[_0x63f9('0x36')]){_0x3841b5[_0x63f9('0x36')]-=0x1;}}if(_0x3841b5[_0x63f9('0x34')]&&!_0x3841b5[_0x63f9('0x35')]){_0x3841b5[_0x63f9('0x32')]+=0x1;if(_0x3841b5[_0x63f9('0x31')]){_0x3841b5['waiting']-=0x1;}}_0x3841b5[_0x63f9('0x33')]+=0x1;_0x1050d3(_0x3841b5);});}exports[_0x63f9('0x38')]=function(_0x110aa1,_0x43ad05){var _0x39c6df={},_0x33d96a={},_0x5c78a8={'count':0x0,'rows':[]};var _0x32176a=_[_0x63f9('0x24')](db[_0x63f9('0x39')][_0x63f9('0x3a')],function(_0x35dec0){return{'name':_0x35dec0[_0x63f9('0x3b')],'type':_0x35dec0[_0x63f9('0x3c')][_0x63f9('0x3d')]};});_0x33d96a['model']=_['map'](_0x32176a,'name');_0x33d96a['query']=_[_0x63f9('0x3e')](_0x110aa1[_0x63f9('0x3f')]);_0x33d96a[_0x63f9('0x40')]=_[_0x63f9('0x41')](_0x33d96a[_0x63f9('0x42')],_0x33d96a[_0x63f9('0x3f')]);_0x39c6df[_0x63f9('0x43')]=_[_0x63f9('0x41')](_0x33d96a[_0x63f9('0x42')],qs['fields'](_0x110aa1[_0x63f9('0x3f')]['fields']));_0x39c6df[_0x63f9('0x43')]=_0x39c6df['attributes'][_0x63f9('0x44')]?_0x39c6df[_0x63f9('0x43')]:_0x33d96a[_0x63f9('0x42')];if(!_0x110aa1['query'][_0x63f9('0x45')](_0x63f9('0x46'))){_0x39c6df[_0x63f9('0x19')]=qs['limit'](_0x110aa1['query'][_0x63f9('0x19')]);_0x39c6df[_0x63f9('0x18')]=qs[_0x63f9('0x18')](_0x110aa1[_0x63f9('0x3f')][_0x63f9('0x18')]);}_0x39c6df[_0x63f9('0x47')]=qs['sort'](_0x110aa1[_0x63f9('0x3f')][_0x63f9('0x48')]);_0x39c6df['where']=qs[_0x63f9('0x40')](_[_0x63f9('0x49')](_0x110aa1[_0x63f9('0x3f')],_0x33d96a['filters']),_0x32176a);var _0x585202=[];var _0x2248b6=squel[_0x63f9('0x4a')]()['field']('id')[_0x63f9('0x4b')](_0x63f9('0x4c'))[_0x63f9('0x4b')](_0x63f9('0x4d'))[_0x63f9('0x4e')]('tools_tags');var _0x380ad0=squel[_0x63f9('0x4a')]()[_0x63f9('0x4b')]('u.id')['field']('u.fullname')['field'](_0x63f9('0x4f'))[_0x63f9('0x4e')](_0x63f9('0x50'),'ui')['left_join']('users','u',_0x63f9('0x51'));var _0x15c27b=squel[_0x63f9('0x4a')]()[_0x63f9('0x4e')](_0x63f9('0x52'),'i')[_0x63f9('0x53')](_0x63f9('0x54'),'c',_0x63f9('0x55'))['left_join'](_0x63f9('0x56'),'o',_0x63f9('0x57'))['left_join'](_0x63f9('0x58'),'a',_0x63f9('0x59'))['left_join'](_0x63f9('0x5a'),'me','me.MailInteractionId\x20=\x20i.id')[_0x63f9('0x53')](_0x63f9('0x5b'),'it',_0x63f9('0x5c'))[_0x63f9('0x53')](_0x63f9('0x5d'),'t',_0x63f9('0x5e'));var _0x5704b4=squel[_0x63f9('0x5f')]();var _0x5e859f=[];var _0x7e6f23=squel[_0x63f9('0x5f')]();var _0x4e18e4;if(_0x110aa1[_0x63f9('0x3f')]['search']){_0x4e18e4=as[_0x63f9('0x60')](_0x110aa1[_0x63f9('0x3f')]['search']);var _0x328ccc=_0x4e18e4['sqlOperator'];for(var _0x1cfed=0x0;_0x1cfed<_0x4e18e4[_0x63f9('0x61')]['length'];_0x1cfed++){var _0x2557ac=_0x4e18e4[_0x63f9('0x61')][_0x1cfed];var _0x1906c5='i';var _0x591c80=_['find'](_0x32176a,[_0x63f9('0x4c'),_0x2557ac[_0x63f9('0x4b')]]);if(!_0x591c80){switch(_0x2557ac['field']){case _0x63f9('0x62'):if(_0x2557ac[_0x63f9('0x63')]==0x1){_0x15c27b['having']('`'+_0x2557ac[_0x63f9('0x4b')]+_0x63f9('0x64'));}else{_0x15c27b[_0x63f9('0x65')]('`'+_0x2557ac['field']+_0x63f9('0x66'));}break;case _0x63f9('0x67'):if(_0x2557ac['operator']===_0x63f9('0x68')){if(_0x2557ac['value'][_0x63f9('0x26')]('\x20')['length']>0x1){_0x5704b4[_0x328ccc](_0x63f9('0x69'),qs[_0x63f9('0x6a')](_0x2557ac[_0x63f9('0x63')]),null);}else{var _0x25965d='%'+_0x2557ac[_0x63f9('0x63')]+'%';_0x5704b4[_0x328ccc]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x25965d,_0x25965d,_0x25965d);}}else{_0x591c80=_['find'](_0x32176a,[_0x63f9('0x4c'),_0x63f9('0x6b')]);_0x2557ac[_0x63f9('0x4b')]=_0x63f9('0x6b');_0x3f8f03=as['buildExpression'](_0x1906c5,_0x591c80[_0x63f9('0x3c')],_0x2557ac);_0x5704b4[_0x328ccc](_0x3f8f03[_0x63f9('0x6c')],_0x3f8f03['value']['start'],_0x3f8f03[_0x63f9('0x63')]['end']);}break;case _0x63f9('0x6d'):var _0x3726d0=_0x2557ac[_0x63f9('0x63')]['split'](',')[_0x63f9('0x24')](function(_0x59e104){return Number(_0x59e104);});_0x3726d0[_0x63f9('0x27')](function(_0x4579bf){_0x7e6f23['or'](_0x63f9('0x6e'),'%,'+_0x4579bf+',%');});_0x5e859f=_[_0x63f9('0x6f')](_0x5e859f,_0x3726d0);break;case _0x63f9('0x70'):if(_0x2557ac[_0x63f9('0x71')]===_0x63f9('0x68')){_0x5704b4[_0x328ccc](_0x63f9('0x72'),'%'+_0x2557ac[_0x63f9('0x63')]+'%',null);}else{_0x591c80=_['find'](_0x32176a,[_0x63f9('0x4c'),'UserId']);_0x2557ac[_0x63f9('0x4b')]=_0x63f9('0x35');_0x3f8f03=as[_0x63f9('0x73')](_0x1906c5,_0x591c80[_0x63f9('0x3c')],_0x2557ac);_0x5704b4[_0x328ccc](_0x3f8f03['text'],_0x3f8f03[_0x63f9('0x63')][_0x63f9('0x74')],_0x3f8f03['value'][_0x63f9('0x16')]);}break;case _0x63f9('0x2d'):_0x3f8f03=as[_0x63f9('0x73')]('me',null,_0x2557ac);_0x5704b4[_0x328ccc](_0x3f8f03['text'],_0x3f8f03[_0x63f9('0x63')][_0x63f9('0x74')],_0x3f8f03['value'][_0x63f9('0x16')]);break;}}else{var _0x3f8f03=as[_0x63f9('0x73')](_0x1906c5,_0x591c80[_0x63f9('0x3c')],_0x2557ac);_0x5704b4[_0x328ccc](_0x3f8f03[_0x63f9('0x6c')],_0x3f8f03[_0x63f9('0x63')]['start'],_0x3f8f03[_0x63f9('0x63')]['end']);}}}else{var _0x309c87=_(_0x110aa1[_0x63f9('0x3f')])[_0x63f9('0x3e')]()['map'](function(_0x59d31b){return _[_0x63f9('0x75')](_0x32176a,[_0x63f9('0x4c'),_0x59d31b])?_0x59d31b:undefined;})[_0x63f9('0x76')]()['value']();if(!_['isEmpty'](_0x309c87)){_0x309c87[_0x63f9('0x27')](function(_0x563400){if(_0x563400===_0x63f9('0x77')){_0x15c27b[_0x63f9('0x78')](_0x63f9('0x79'),[][_0x63f9('0x7a')](_0x110aa1[_0x63f9('0x3f')][_0x563400]));}else if(_0x563400===_0x63f9('0x7b')){var _0x43c615=JSON[_0x63f9('0x7c')](_0x110aa1['query'][_0x563400])[_0x63f9('0x7d')];var _0x21a516=JSON[_0x63f9('0x7c')](_0x110aa1[_0x63f9('0x3f')][_0x563400])[_0x63f9('0x7e')];_0x15c27b[_0x63f9('0x78')]('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x43c615,_0x21a516);}else{if(_0x110aa1[_0x63f9('0x3f')][_0x563400]===_0x63f9('0x7f')){_0x15c27b['where']('i.'+_0x563400+_0x63f9('0x80'));}else{_0x15c27b['where']('i.'+_0x563400+_0x63f9('0x81'),_0x110aa1[_0x63f9('0x3f')][_0x563400]);}}});}if(_0x110aa1[_0x63f9('0x3f')][_0x63f9('0x82')]){if(_0x110aa1[_0x63f9('0x3f')][_0x63f9('0x82')]==0x1){_0x15c27b[_0x63f9('0x65')](_0x63f9('0x83'));}else{_0x15c27b[_0x63f9('0x65')]('`unreadMessages`\x20>\x200');}}if(_0x110aa1[_0x63f9('0x3f')][_0x63f9('0x84')]){_0x5e859f=_['isArray'](_0x110aa1[_0x63f9('0x3f')][_0x63f9('0x84')])?_0x110aa1[_0x63f9('0x3f')][_0x63f9('0x84')]:new Array(_0x110aa1['query'][_0x63f9('0x84')]);_0x5e859f[_0x63f9('0x27')](function(_0x5ea558){_0x7e6f23['or'](_0x63f9('0x6e'),'%,'+_0x5ea558+',%');});}if(_0x110aa1[_0x63f9('0x3f')][_0x63f9('0x85')]){var _0x177b17=_0x110aa1[_0x63f9('0x3f')][_0x63f9('0x85')][_0x63f9('0x86')]('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs[_0x63f9('0x87')](_0x177b17)){_0x5704b4['or'](_0x63f9('0x88'),_0x177b17+'%');}else if(qs[_0x63f9('0x89')](_0x177b17)){_0x5704b4['or']('c.email\x20LIKE\x20?',_0x177b17+'%');}else{_0x5704b4['or'](_0x63f9('0x8a'),qs['getFullTextValue'](_0x177b17))['or'](_0x63f9('0x8b'),qs[_0x63f9('0x6a')](_0x177b17));}}}_0x15c27b[_0x63f9('0x78')](_0x5704b4);_0x15c27b[_0x63f9('0x8c')](_0x63f9('0x8d'));var _0x10362f={'type':db[_0x63f9('0x8e')][_0x63f9('0x8f')][_0x63f9('0x90')],'raw':!![]};var _0x1fde5f=_0x15c27b[_0x63f9('0x91')]();_0x1fde5f[_0x63f9('0x4b')](_0x63f9('0x8d'));_0x1fde5f[_0x63f9('0x4b')](_0x63f9('0x92'),_0x63f9('0x62'));if(_0x39c6df[_0x63f9('0x47')]){_0x39c6df[_0x63f9('0x47')][_0x63f9('0x27')](function(_0x334ff4){var _0x19ef69=_0x334ff4[0x0]==='contactName'?_0x334ff4[0x0]:'i.'+_0x334ff4[0x0];_0x15c27b['order'](_0x19ef69,_0x334ff4[0x1]===_0x63f9('0x93')?![]:!![]);});}if(!_['isEmpty'](_0x5e859f)){_0x15c27b['having'](_0x7e6f23);_0x1fde5f[_0x63f9('0x78')](_0x63f9('0x94'),_0x5e859f);}BPromise[_0x63f9('0x95')]()[_0x63f9('0x1e')](function(){if(!_0x4e18e4){if(_0x110aa1['query'][_0x63f9('0x77')])return;_0x1fde5f[_0x63f9('0x78')](_0x63f9('0x96'));_0x15c27b[_0x63f9('0x78')](_0x63f9('0x96'));return;}if(_0x110aa1[_0x63f9('0x97')][_0x63f9('0x98')]!==_0x63f9('0x99'))return;return _0x110aa1[_0x63f9('0x97')][_0x63f9('0x9a')]({'attributes':['id'],'raw':!![]})[_0x63f9('0x1e')](function(_0x220747){if(_['isEmpty'](_0x220747)){_0x1fde5f[_0x63f9('0x78')](_0x63f9('0x9b'));_0x15c27b[_0x63f9('0x78')](_0x63f9('0x9b'));}else{_0x1fde5f[_0x63f9('0x78')](_0x63f9('0x79'),_[_0x63f9('0x24')](_0x220747,'id'));_0x15c27b[_0x63f9('0x78')](_0x63f9('0x79'),_[_0x63f9('0x24')](_0x220747,'id'));}});})[_0x63f9('0x1e')](function(){if(_0x110aa1[_0x63f9('0x97')][_0x63f9('0x98')]===_0x63f9('0x99')&&!_0x4e18e4&&!_0x110aa1[_0x63f9('0x3f')][_0x63f9('0x77')])return[];return db[_0x63f9('0x9c')][_0x63f9('0x3f')](_0x1fde5f[_0x63f9('0x9d')](),_0x10362f);})[_0x63f9('0x1e')](function(_0x1993cf){_0x5c78a8[_0x63f9('0x1a')]=_0x1993cf[_0x63f9('0x44')];if(_0x5c78a8[_0x63f9('0x1a')]===0x0)return[];return db[_0x63f9('0x9c')][_0x63f9('0x3f')](_0x2248b6[_0x63f9('0x9d')](),_0x10362f)[_0x63f9('0x1e')](function(_0x24f445){_0x585202=_[_0x63f9('0x9e')](_0x24f445,'id');_0x10362f=_[_0x63f9('0x9f')](_0x10362f,{'model':db['MailInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x110aa1['query']['fields']){_0x39c6df[_0x63f9('0x43')][_0x63f9('0x27')](function(_0x7641b1){_0x15c27b['field']('i.'+_0x7641b1);});}else{_0x15c27b[_0x63f9('0x4b')](_0x63f9('0x92'),'unreadMessages');_0x15c27b[_0x63f9('0x4b')](_0x63f9('0xa0'),_0x63f9('0xa1'));_0x15c27b[_0x63f9('0x4b')]('a.mandatoryDisposition',_0x63f9('0xa2'));_0x15c27b[_0x63f9('0x4b')](_0x63f9('0xa3'),'contactName');_0x15c27b['field'](_0x63f9('0x8d'));_0x15c27b[_0x63f9('0x4b')]('i.createdAt');_0x15c27b[_0x63f9('0x4b')]('i.updatedAt');_0x15c27b[_0x63f9('0x4b')](_0x63f9('0xa4'));_0x15c27b[_0x63f9('0x4b')](_0x63f9('0xa5'));_0x15c27b[_0x63f9('0x4b')]('i.attach');_0x15c27b[_0x63f9('0x4b')](_0x63f9('0xa6'));_0x15c27b[_0x63f9('0x4b')]('i.lastMsgDirection');_0x15c27b[_0x63f9('0x4b')]('i.subject');_0x15c27b['field'](_0x63f9('0xa7'));_0x15c27b[_0x63f9('0x4b')](_0x63f9('0xa8'));_0x15c27b['field']('i.thirdDisposition');_0x15c27b[_0x63f9('0x4b')]('i.substatus');_0x15c27b[_0x63f9('0x4b')](_0x63f9('0xa9'));_0x15c27b[_0x63f9('0x4b')]('i.ContactId');_0x15c27b['field'](_0x63f9('0xaa'));_0x15c27b[_0x63f9('0x4b')](_0x63f9('0xab'));_0x15c27b['field'](_0x63f9('0xac'),_0x63f9('0xad'));_0x15c27b['field']('c.lastName','Contact.lastName');_0x15c27b['field']('c.email',_0x63f9('0xae'));_0x15c27b[_0x63f9('0x4b')](_0x63f9('0xaf'),_0x63f9('0xb0'));_0x15c27b[_0x63f9('0x4b')]('c.mobile',_0x63f9('0xb1'));_0x15c27b['field'](_0x63f9('0xb2'),'Contact.fax');_0x15c27b['field'](_0x63f9('0xb3'),_0x63f9('0xb4'));_0x15c27b['field'](_0x63f9('0xb5'),_0x63f9('0xb6'));_0x15c27b[_0x63f9('0x4b')](_0x63f9('0xb7'),_0x63f9('0x25'));}if(_0x39c6df[_0x63f9('0x19')])_0x15c27b[_0x63f9('0x19')](_0x39c6df[_0x63f9('0x19')]);if(_0x39c6df[_0x63f9('0x18')])_0x15c27b[_0x63f9('0x18')](_0x39c6df['offset']);return db[_0x63f9('0x9c')]['query'](_0x15c27b[_0x63f9('0x9d')](),_0x10362f);})['then'](function(_0x2f36e1){if(_0x2f36e1[_0x63f9('0x44')]>0x0)_0x380ad0['where'](_0x63f9('0xb8'),_['map'](_0x2f36e1,'id'));return db[_0x63f9('0x9c')]['query'](_0x380ad0[_0x63f9('0x9d')](),_0x10362f)['then'](function(_0x2d7e9c){var _0x5ee759=_[_0x63f9('0xb9')](_0x2d7e9c,_0x63f9('0xba'));var _0x37d73c=[];return db[_0x63f9('0xbb')][_0x63f9('0x2b')]({'attributes':['enableEmailPreview'],'raw':!![]})[_0x63f9('0x1e')](function(_0x45a7de){var _0x45e924=_0x45a7de[_0x63f9('0xbc')];_0x2f36e1[_0x63f9('0x27')](function(_0x244015){_0x37d73c[_0x63f9('0x29')](updateMailInteraction(_0x244015,_0x585202,_0x5ee759,_0x45e924));});return BPromise[_0x63f9('0xbd')](_0x37d73c);});});});})[_0x63f9('0x1e')](function(_0x5b67e0){_0x5c78a8[_0x63f9('0xbe')]=_0x5b67e0;return _0x5c78a8;})[_0x63f9('0x1e')](respondWithFilteredResult(_0x43ad05,_0x39c6df))[_0x63f9('0x30')](handleError(_0x43ad05,null));};exports[_0x63f9('0xbf')]=function(_0x3505ab,_0x1b209c){var _0x4a82e6={'raw':![],'where':{'id':_0x3505ab[_0x63f9('0xc0')]['id']}},_0x43972d={};_0x43972d[_0x63f9('0x42')]=_[_0x63f9('0x3e')](db[_0x63f9('0x39')][_0x63f9('0x3a')]);_0x43972d[_0x63f9('0x3f')]=_[_0x63f9('0x3e')](_0x3505ab[_0x63f9('0x3f')]);_0x43972d[_0x63f9('0x40')]=_['intersection'](_0x43972d[_0x63f9('0x42')],_0x43972d[_0x63f9('0x3f')]);_0x4a82e6['attributes']=_[_0x63f9('0x41')](_0x43972d[_0x63f9('0x42')],qs[_0x63f9('0xc1')](_0x3505ab['query'][_0x63f9('0xc1')]));_0x4a82e6[_0x63f9('0x43')]=_0x4a82e6[_0x63f9('0x43')][_0x63f9('0x44')]?_0x4a82e6[_0x63f9('0x43')]:_0x43972d[_0x63f9('0x42')];if(_0x3505ab[_0x63f9('0x3f')][_0x63f9('0xc2')]){_0x4a82e6['include']=[{'all':!![]}];}_0x4a82e6=_[_0x63f9('0x9f')]({},_0x4a82e6,_0x3505ab[_0x63f9('0xc3')]);return db[_0x63f9('0x39')][_0x63f9('0xc4')](_0x4a82e6)[_0x63f9('0x1e')](handleEntityNotFound(_0x1b209c,null))[_0x63f9('0x1e')](respondWithResult(_0x1b209c,null))['catch'](handleError(_0x1b209c,null));};exports['create']=function(_0x5adc02,_0x2030b4){return db[_0x63f9('0x39')][_0x63f9('0xc5')](_0x5adc02['body'],{})[_0x63f9('0x1e')](respondWithResult(_0x2030b4,0xc9))[_0x63f9('0x30')](handleError(_0x2030b4,null));};exports[_0x63f9('0x1d')]=function(_0x2a3bed,_0x118314){if(_0x2a3bed['body']['id']){delete _0x2a3bed[_0x63f9('0xc6')]['id'];}return db[_0x63f9('0x39')][_0x63f9('0xc4')]({'where':{'id':_0x2a3bed[_0x63f9('0xc0')]['id']}})[_0x63f9('0x1e')](handleEntityNotFound(_0x118314,null))[_0x63f9('0x1e')](saveUpdates(_0x2a3bed[_0x63f9('0xc6')],null))[_0x63f9('0x1e')](respondWithResult(_0x118314,null))[_0x63f9('0x30')](handleError(_0x118314,null));};exports['destroy']=function(_0x121cad,_0x4c158a){return db[_0x63f9('0x39')][_0x63f9('0xc4')]({'where':{'id':_0x121cad[_0x63f9('0xc0')]['id']}})[_0x63f9('0x1e')](handleEntityNotFound(_0x4c158a,null))[_0x63f9('0x1e')](removeEntity(_0x4c158a,null))[_0x63f9('0x30')](handleError(_0x4c158a,null));};exports[_0x63f9('0xc7')]=function(_0x594f14,_0x1c890b){return db['MailInteraction'][_0x63f9('0xc7')]()[_0x63f9('0x1e')](respondWithResult(_0x1c890b,null))['catch'](handleError(_0x1c890b,null));};exports[_0x63f9('0xc8')]=function(_0x2bf15e,_0x744329){return db['MailMessage'][_0x63f9('0xc4')]({'where':{'id':_0x2bf15e[_0x63f9('0xc0')]['id']}})[_0x63f9('0x1e')](handleEntityNotFound(_0x744329,null))[_0x63f9('0x1e')](function(_0x2ae25e){if(_0x2ae25e){return _0x2ae25e['addMessage'](_0x2bf15e['body'][_0x63f9('0xc9')],_[_0x63f9('0xca')](_0x2bf15e[_0x63f9('0xc6')],[_0x63f9('0xc9'),'id'])||{});}})[_0x63f9('0x1e')](respondWithResult(_0x744329,null))[_0x63f9('0x30')](handleError(_0x744329,null));};exports['getMessages']=function(_0x14b97d,_0x84f4a5){var _0x1c6167={'raw':![],'where':{}};var _0x165563={};var _0x5f3965={'count':0x0,'rows':[]};return db['MailInteraction'][_0x63f9('0x2b')]({'where':{'id':_0x14b97d['params']['id']}})[_0x63f9('0x1e')](handleEntityNotFound(_0x84f4a5,null))[_0x63f9('0x1e')](function(_0x179e3c){if(_0x179e3c){_0x165563[_0x63f9('0x42')]=_[_0x63f9('0x3e')](db[_0x63f9('0x2a')]['rawAttributes']);_0x165563[_0x63f9('0x3f')]=_[_0x63f9('0x3e')](_0x14b97d[_0x63f9('0x3f')]);_0x165563['filters']=_['intersection'](_0x165563[_0x63f9('0x42')],_0x165563['query']);_0x1c6167[_0x63f9('0x43')]=_[_0x63f9('0x41')](_0x165563['model'],qs[_0x63f9('0xc1')](_0x14b97d['query']['fields']));_0x1c6167[_0x63f9('0x43')]=_0x1c6167[_0x63f9('0x43')][_0x63f9('0x44')]?_0x1c6167[_0x63f9('0x43')]:_0x165563[_0x63f9('0x42')];if(!_0x14b97d[_0x63f9('0x3f')][_0x63f9('0x45')](_0x63f9('0x46'))){_0x1c6167[_0x63f9('0x19')]=qs[_0x63f9('0x19')](_0x14b97d[_0x63f9('0x3f')]['limit']);_0x1c6167[_0x63f9('0x18')]=qs[_0x63f9('0x18')](_0x14b97d[_0x63f9('0x3f')][_0x63f9('0x18')]);}_0x1c6167[_0x63f9('0x47')]=qs[_0x63f9('0x48')](_0x14b97d[_0x63f9('0x3f')][_0x63f9('0x48')]);_0x1c6167['where']=qs[_0x63f9('0x40')](_['pick'](_0x14b97d[_0x63f9('0x3f')],_0x165563[_0x63f9('0x40')]));_0x1c6167['where'][_0x63f9('0xba')]=_0x179e3c['id'];if(_0x14b97d[_0x63f9('0x3f')][_0x63f9('0x85')]){_0x1c6167[_0x63f9('0x78')]=_[_0x63f9('0x9f')](_0x1c6167[_0x63f9('0x78')],{'$or':_[_0x63f9('0x24')](_0x1c6167[_0x63f9('0x43')],function(_0x51d1a2){var _0x33a960={};_0x33a960[_0x51d1a2]={'$like':'%'+_0x14b97d[_0x63f9('0x3f')]['filter']+'%'};return _0x33a960;})});}if(_0x14b97d[_0x63f9('0x3f')]['$gte']){var _0x29e4a8=_0x14b97d[_0x63f9('0x3f')][_0x63f9('0x7d')]['split'](',');var _0x2992af={};_0x2992af[_0x29e4a8[0x0]]={'$gte':moment(_0x29e4a8[0x1])[_0x63f9('0xcb')](_0x63f9('0xcc'))};_0x1c6167[_0x63f9('0x78')]=_[_0x63f9('0x9f')](_0x1c6167[_0x63f9('0x78')],_0x2992af);}_0x1c6167=_[_0x63f9('0x9f')]({},_0x1c6167,_0x14b97d['options']);return db[_0x63f9('0x2a')]['count']({'where':_0x1c6167[_0x63f9('0x78')]})[_0x63f9('0x1e')](function(_0x11f33b){_0x5f3965[_0x63f9('0x1a')]=_0x11f33b;if(_0x14b97d[_0x63f9('0x3f')]['includeAll']){_0x1c6167[_0x63f9('0xcd')]=[{'all':!![]}];}return db[_0x63f9('0x2a')]['findAll'](_0x1c6167);})[_0x63f9('0x1e')](function(_0x98f877){if(_0x14b97d[_0x63f9('0x3f')][_0x63f9('0xce')]==='true'){for(var _0x2b9b2c=0x0;_0x2b9b2c<_0x98f877[_0x63f9('0x44')];_0x2b9b2c++){_0x98f877[_0x2b9b2c][_0x63f9('0xc6')]=juice(_0x98f877[_0x2b9b2c][_0x63f9('0xc6')]);}}_0x5f3965['rows']=_0x98f877;return _0x5f3965;});}})[_0x63f9('0x1e')](respondWithFilteredResult(_0x84f4a5,_0x1c6167))[_0x63f9('0x30')](handleError(_0x84f4a5,null));};exports[_0x63f9('0xcf')]=function(_0x41a189,_0x4f065c){return db[_0x63f9('0x39')][_0x63f9('0xc4')]({'where':{'id':_0x41a189[_0x63f9('0xc0')]['id']}})[_0x63f9('0x1e')](handleEntityNotFound(_0x4f065c,null))[_0x63f9('0x1e')](function(_0x298941){if(_0x298941){return _0x298941[_0x63f9('0xd0')](_0x41a189['body'][_0x63f9('0xc9')],_[_0x63f9('0xca')](_0x41a189[_0x63f9('0xc6')],[_0x63f9('0xc9'),'id'])||{})[_0x63f9('0xd1')](function(){return db[_0x63f9('0x6d')][_0x63f9('0xd2')]({'attributes':['id',_0x63f9('0x4c'),'color'],'where':{'id':_0x41a189['body'][_0x63f9('0xc9')]}});})[_0x63f9('0x1e')](function(_0x4b5fa1){socket['emit'](_0x63f9('0xd3'),{'id':Number(_0x41a189[_0x63f9('0xc0')]['id']),'tags':_0x4b5fa1||[]});return{'id':Number(_0x41a189[_0x63f9('0xc0')]['id']),'tags':_0x4b5fa1||[]};});}})['then'](respondWithResult(_0x4f065c,null))[_0x63f9('0x30')](handleError(_0x4f065c,null));};exports[_0x63f9('0xd4')]=function(_0x18fd60,_0xf0c96d){return db[_0x63f9('0x39')][_0x63f9('0xc4')]({'where':{'id':_0x18fd60[_0x63f9('0xc0')]['id']}})[_0x63f9('0x1e')](handleEntityNotFound(_0xf0c96d,null))[_0x63f9('0x1e')](function(_0x3309e1){if(_0x3309e1){return _0x3309e1[_0x63f9('0xd4')](_0x18fd60[_0x63f9('0x3f')][_0x63f9('0xc9')]);}})[_0x63f9('0x1e')](respondWithStatusCode(_0xf0c96d,null))['catch'](handleError(_0xf0c96d,null));};exports[_0x63f9('0xd5')]=function(_0x2ceabe,_0x42cada){var _0x2f98f7=moment()[_0x63f9('0xd6')]()[_0x63f9('0x9d')]();var _0x3193c2=path[_0x63f9('0xd7')](config[_0x63f9('0xd8')],_0x63f9('0xd9'),_0x63f9('0xda'),'tmp');var _0x565d2a=path['join'](config[_0x63f9('0xd8')],_0x63f9('0xd9'),_0x63f9('0xda'),_0x63f9('0xdb'));var _0x2f269a=path[_0x63f9('0xd7')](_0x3193c2,_0x2f98f7);var _0x5cab8d=util[_0x63f9('0xcb')](_0x63f9('0xdc'),_0x2ceabe[_0x63f9('0xc0')]['id'],_0x2f98f7);var _0x5725a4=path[_0x63f9('0xd7')](_0x3193c2,_0x5cab8d);var _0x50973c=[];if(_0x2ceabe['query']['attachments']){_0x50973c[_0x63f9('0x29')]({'model':db['Attachment'],'as':_0x63f9('0xdd'),'raw':!![]});}var _0x4a9c38=[{'model':db[_0x63f9('0x2a')],'as':_0x63f9('0xde'),'attributes':['id',_0x63f9('0xc6'),_0x63f9('0x4e'),'to','cc',_0x63f9('0xdf'),_0x63f9('0xe0'),'createdAt'],'where':{'secret':![]},'order':qs[_0x63f9('0x48')]('id'),'include':_0x50973c}];return db[_0x63f9('0x39')]['find']({'where':{'id':_0x2ceabe[_0x63f9('0xc0')]['id']},'include':_0x4a9c38})[_0x63f9('0x1e')](handleEntityNotFound(_0x42cada,null))['then'](function(_0x15e51b){if(_0x15e51b&&_0x15e51b[_0x63f9('0xde')]){var _0x2631ad=_0x15e51b['get']({'plain':!![]});fs['mkdirSync'](_0x2f269a);return BPromise[_0x63f9('0xe1')](_0x2631ad[_0x63f9('0xde')],function(_0x14a825,_0x5e63e8){var _0x22ea6d={'from':_0x14a825['from'],'to':_0x14a825['to'],'subject':_0x14a825[_0x63f9('0xe0')],'html':htmlEntities[_0x63f9('0xe2')](_0x14a825[_0x63f9('0xc6')]),'headers':{'Date':moment(_0x14a825[_0x63f9('0x7b')])[_0x63f9('0xcb')](_0x63f9('0xe3'))},'attachments':[]};if(_0x14a825['cc']){_0x22ea6d[_0x63f9('0xe4')]['Cc']=_0x14a825['cc'];}if(_0x14a825[_0x63f9('0xdf')]){_0x22ea6d[_0x63f9('0xe4')]['Bcc']=_0x14a825[_0x63f9('0xdf')];}return new BPromise(function(_0x21edd2,_0x30c92b){if(_0x14a825[_0x63f9('0xdd')]){for(var _0x4cd6a6=0x0;_0x4cd6a6<_0x14a825[_0x63f9('0xdd')][_0x63f9('0x44')];_0x4cd6a6++){var _0x556297=_0x14a825[_0x63f9('0xdd')][_0x4cd6a6];var _0x5d0951=path[_0x63f9('0xd7')](_0x565d2a,_0x556297[_0x63f9('0xe5')]);if(fs[_0x63f9('0xe6')](_0x5d0951)){_0x22ea6d['attachments'][_0x63f9('0x29')]({'name':_0x556297[_0x63f9('0x4c')],'contentType':_0x556297[_0x63f9('0x3c')],'data':fs[_0x63f9('0xe7')](_0x5d0951)});}}}emlformat[_0x63f9('0xe8')](_0x22ea6d,function(_0x3cef5b,_0x3f5ebd){if(_0x3cef5b)return _0x30c92b(_0x3cef5b);fs['writeFileSync'](path['join'](_0x2f269a,util[_0x63f9('0xcb')](_0x63f9('0xe9'),_0x5e63e8)),_0x3f5ebd);return _0x21edd2(_0x3f5ebd);});});})[_0x63f9('0x1e')](function(){return new BPromise(function(_0x386c2c,_0x499317){zipdir(_0x2f269a,{'saveTo':_0x5725a4},function(_0x47c65c,_0x4e63ad){if(_0x47c65c)return _0x499317(_0x47c65c);return _0x386c2c(_0x4e63ad);});})[_0x63f9('0x1e')](function(){return new BPromise(function(_0x5970c1,_0x54d20a){rimraf(_0x2f269a,function(_0x44cabb){if(_0x44cabb)_0x54d20a(_0x44cabb);return _0x5970c1();});});})[_0x63f9('0x1e')](function(){return _0x42cada[_0x63f9('0xd5')](_0x5725a4,_0x5cab8d,function(_0x14d403){if(!_0x14d403)fs['unlinkSync'](_0x5725a4);});});});}else{return _0x42cada[_0x63f9('0x14')](0xc8);}})[_0x63f9('0x30')](handleError(_0x42cada,null));}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.events.js b/server/api/mailInteraction/mailInteraction.events.js index 88e891a..29ca137 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 _0x085f=['emit','catch','hook','exports','events','MailInteraction','save','update','remove','getUsers','then','setDataValue','Users','map','findAll','unreadMessages'];(function(_0x595bd1,_0xb1e7a){var _0xd0344f=function(_0x5eb2fd){while(--_0x5eb2fd){_0x595bd1['push'](_0x595bd1['shift']());}};_0xd0344f(++_0xb1e7a);}(_0x085f,0x74));var _0xf085=function(_0x3a97f2,_0x2d1371){_0x3a97f2=_0x3a97f2-0x0;var _0x53d0bd=_0x085f[_0x3a97f2];return _0x53d0bd;};'use strict';var EventEmitter=require(_0xf085('0x0'));var MailInteraction=require('../../mysqldb')['db'][_0xf085('0x1')];var MailMessage=require('../../mysqldb')['db']['MailMessage'];var MailInteractionEvents=new EventEmitter();MailInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xf085('0x2'),'afterUpdate':_0xf085('0x3'),'afterDestroy':_0xf085('0x4')};function emitEvent(_0x1b6383){return function(_0xcfd224,_0x43b3b6,_0x3bcab2){_0xcfd224[_0xf085('0x5')]({'attributes':['id'],'raw':!![]})[_0xf085('0x6')](function(_0x75fecf){_0xcfd224[_0xf085('0x7')](_0xf085('0x8'),_0x75fecf[_0xf085('0x9')](function(_0x22e5da){return{'id':_0x22e5da['id']};}));return MailMessage[_0xf085('0xa')]({'where':{'MailInteractionId':_0xcfd224['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x448f2a){_0xcfd224['setDataValue'](_0xf085('0xb'),_0x448f2a['length']);MailInteractionEvents[_0xf085('0xc')](_0x1b6383+':'+_0xcfd224['id'],_0xcfd224);MailInteractionEvents[_0xf085('0xc')](_0x1b6383,_0xcfd224);_0x3bcab2(null);})[_0xf085('0xd')](_0x3bcab2(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailInteraction[_0xf085('0xe')](e,emitEvent(event));}}module[_0xf085('0xf')]=MailInteractionEvents; \ No newline at end of file +var _0x7319=['remove','getUsers','then','setDataValue','Users','map','findAll','length','emit','catch','hook','exports','MailInteraction','save','update'];(function(_0x297fd3,_0x115406){var _0x2af381=function(_0x1dd31b){while(--_0x1dd31b){_0x297fd3['push'](_0x297fd3['shift']());}};_0x2af381(++_0x115406);}(_0x7319,0x156));var _0x9731=function(_0xd21eab,_0x1471d3){_0xd21eab=_0xd21eab-0x0;var _0x409cb6=_0x7319[_0xd21eab];return _0x409cb6;};'use strict';var EventEmitter=require('events');var MailInteraction=require('../../mysqldb')['db'][_0x9731('0x0')];var MailMessage=require('../../mysqldb')['db']['MailMessage'];var MailInteractionEvents=new EventEmitter();MailInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x9731('0x1'),'afterUpdate':_0x9731('0x2'),'afterDestroy':_0x9731('0x3')};function emitEvent(_0x459712){return function(_0x43a426,_0x5199a5,_0x140982){_0x43a426[_0x9731('0x4')]({'attributes':['id'],'raw':!![]})[_0x9731('0x5')](function(_0x52954c){_0x43a426[_0x9731('0x6')](_0x9731('0x7'),_0x52954c[_0x9731('0x8')](function(_0x1126f8){return{'id':_0x1126f8['id']};}));return MailMessage[_0x9731('0x9')]({'where':{'MailInteractionId':_0x43a426['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x5c7e98){_0x43a426['setDataValue']('unreadMessages',_0x5c7e98[_0x9731('0xa')]);MailInteractionEvents[_0x9731('0xb')](_0x459712+':'+_0x43a426['id'],_0x43a426);MailInteractionEvents[_0x9731('0xb')](_0x459712,_0x43a426);_0x140982(null);})[_0x9731('0xc')](_0x140982(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailInteraction[_0x9731('0xd')](e,emitEvent(event));}}module[_0x9731('0xe')]=MailInteractionEvents; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.model.js b/server/api/mailInteraction/mailInteraction.model.js index e9ab49e..c335a73 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 _0x47de=['bluebird','request-promise','path','rimraf','../../config/environment','./mailInteraction.attributes','MailInteraction','mail_interactions','fti_mail_interactions','subject','FULLTEXT','substatus','substatusAt','YYYY-MM-DD\x20HH:mm:ss','closed','format','changed','closedAt','models','MailMessage','update','then','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api'];(function(_0x3f1d11,_0x5e3836){var _0x38755f=function(_0x2d3dfe){while(--_0x2d3dfe){_0x3f1d11['push'](_0x3f1d11['shift']());}};_0x38755f(++_0x5e3836);}(_0x47de,0xf8));var _0xe47d=function(_0x3a3a0e,_0x3579f6){_0x3a3a0e=_0x3a3a0e-0x0;var _0x1ec794=_0x47de[_0x3a3a0e];return _0x1ec794;};'use strict';var _=require(_0xe47d('0x0'));var util=require(_0xe47d('0x1'));var logger=require(_0xe47d('0x2'))(_0xe47d('0x3'));var moment=require('moment');var BPromise=require(_0xe47d('0x4'));var rp=require(_0xe47d('0x5'));var fs=require('fs');var path=require(_0xe47d('0x6'));var rimraf=require(_0xe47d('0x7'));var config=require(_0xe47d('0x8'));var attributes=require(_0xe47d('0x9'));module['exports']=function(_0x23fbf3,_0x2b4b31){return _0x23fbf3['define'](_0xe47d('0xa'),attributes,{'tableName':_0xe47d('0xb'),'paranoid':![],'indexes':[{'name':_0xe47d('0xc'),'fields':[_0xe47d('0xd'),'to'],'type':_0xe47d('0xe')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x25313a,_0x56cfc6,_0x18f4b9){if(_0x25313a[_0xe47d('0xf')]){_0x25313a[_0xe47d('0x10')]=moment()['format'](_0xe47d('0x11'));}if(_0x25313a[_0xe47d('0x12')]){_0x25313a['closedAt']=moment()[_0xe47d('0x13')](_0xe47d('0x11'));}_0x18f4b9(null,_0x56cfc6);},'beforeUpdate':function(_0x2c43dc,_0x190b7f,_0x49d867){if(_0x2c43dc[_0xe47d('0x14')](_0xe47d('0xf'))){_0x2c43dc['substatusAt']=_0x2c43dc[_0xe47d('0xf')]?moment()[_0xe47d('0x13')](_0xe47d('0x11')):null;}if(_0x2c43dc[_0xe47d('0x14')](_0xe47d('0x12'))){_0x2c43dc[_0xe47d('0x15')]=moment()[_0xe47d('0x13')](_0xe47d('0x11'));_0x2c43dc['substatus']=null;_0x2c43dc[_0xe47d('0x10')]=null;}_0x49d867(null,_0x2c43dc);},'afterUpdate':function(_0x1b4f2,_0x4783f5,_0x33306e){var _0x4fdb4d=_0x23fbf3[_0xe47d('0x16')];var _0x27c60c=_0x1b4f2['get']({'plain':!![]});if(_0x27c60c[_0xe47d('0x12')]){return _0x4fdb4d[_0xe47d('0x17')][_0xe47d('0x18')]({'read':!![]},{'where':{'MailInteractionId':_0x27c60c['id']}})[_0xe47d('0x19')](function(){_0x33306e();})['catch'](function(_0x1d6ae0){_0x33306e(_0x1d6ae0);});}else{_0x33306e();}}},'charset':_0xe47d('0x1a'),'collate':_0xe47d('0x1b')});}; \ No newline at end of file +var _0x0d1a=['substatusAt','format','YYYY-MM-DD\x20HH:mm:ss','closed','closedAt','changed','substatus','then','catch','utf8mb4','utf8mb4_unicode_ci','util','api','moment','request-promise','rimraf','../../config/environment','./mailInteraction.attributes','define','MailInteraction','fti_mail_interactions','subject','FULLTEXT'];(function(_0x41556e,_0x585c4e){var _0x3b587b=function(_0x11f57d){while(--_0x11f57d){_0x41556e['push'](_0x41556e['shift']());}};_0x3b587b(++_0x585c4e);}(_0x0d1a,0x1a9));var _0xa0d1=function(_0x19d41a,_0x39e703){_0x19d41a=_0x19d41a-0x0;var _0x2f0a19=_0x0d1a[_0x19d41a];return _0x2f0a19;};'use strict';var _=require('lodash');var util=require(_0xa0d1('0x0'));var logger=require('../../config/logger')(_0xa0d1('0x1'));var moment=require(_0xa0d1('0x2'));var BPromise=require('bluebird');var rp=require(_0xa0d1('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa0d1('0x4'));var config=require(_0xa0d1('0x5'));var attributes=require(_0xa0d1('0x6'));module['exports']=function(_0x394f20,_0x5a51cd){return _0x394f20[_0xa0d1('0x7')](_0xa0d1('0x8'),attributes,{'tableName':'mail_interactions','paranoid':![],'indexes':[{'name':_0xa0d1('0x9'),'fields':[_0xa0d1('0xa'),'to'],'type':_0xa0d1('0xb')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x4b444a,_0x24eb90,_0x512d0d){if(_0x4b444a['substatus']){_0x4b444a[_0xa0d1('0xc')]=moment()[_0xa0d1('0xd')](_0xa0d1('0xe'));}if(_0x4b444a[_0xa0d1('0xf')]){_0x4b444a[_0xa0d1('0x10')]=moment()[_0xa0d1('0xd')](_0xa0d1('0xe'));}_0x512d0d(null,_0x24eb90);},'beforeUpdate':function(_0x42a4f0,_0x35ab49,_0x5656cf){if(_0x42a4f0[_0xa0d1('0x11')](_0xa0d1('0x12'))){_0x42a4f0[_0xa0d1('0xc')]=_0x42a4f0[_0xa0d1('0x12')]?moment()[_0xa0d1('0xd')]('YYYY-MM-DD\x20HH:mm:ss'):null;}if(_0x42a4f0[_0xa0d1('0x11')](_0xa0d1('0xf'))){_0x42a4f0[_0xa0d1('0x10')]=moment()['format'](_0xa0d1('0xe'));_0x42a4f0[_0xa0d1('0x12')]=null;_0x42a4f0[_0xa0d1('0xc')]=null;}_0x5656cf(null,_0x42a4f0);},'afterUpdate':function(_0x4dbb2c,_0x710f0b,_0x3531f4){var _0x7e596e=_0x394f20['models'];var _0x1b76f3=_0x4dbb2c['get']({'plain':!![]});if(_0x1b76f3[_0xa0d1('0xf')]){return _0x7e596e['MailMessage']['update']({'read':!![]},{'where':{'MailInteractionId':_0x1b76f3['id']}})[_0xa0d1('0x13')](function(){_0x3531f4();})[_0xa0d1('0x14')](function(_0x535050){_0x3531f4(_0x535050);});}else{_0x3531f4();}}},'charset':_0xa0d1('0x15'),'collate':_0xa0d1('0x16')});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.rpc.js b/server/api/mailInteraction/mailInteraction.rpc.js index 71fd622..e5db860 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 _0x8f9d=['socket.io-emitter','register','request','then','info','request\x20sent','MailInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','MailInteraction,\x20%s,\x20%s','message','result','catch','UpdateMailInteraction','MailInteraction','update','body','options','raw','where','attributes','limit','debug','addTags','ids','AddTags','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults'];(function(_0x465028,_0x4570ac){var _0xb783d4=function(_0x5458c5){while(--_0x5458c5){_0x465028['push'](_0x465028['shift']());}};_0xb783d4(++_0x4570ac);}(_0x8f9d,0x93));var _0xd8f9=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x8f9d[_0x19950b];return _0x3c6b41;};'use strict';var _=require(_0xd8f9('0x0'));var util=require('util');var moment=require(_0xd8f9('0x1'));var BPromise=require('bluebird');var rs=require(_0xd8f9('0x2'));var fs=require('fs');var Redis=require(_0xd8f9('0x3'));var db=require(_0xd8f9('0x4'))['db'];var utils=require(_0xd8f9('0x5'));var logger=require(_0xd8f9('0x6'))(_0xd8f9('0x7'));var config=require(_0xd8f9('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xd8f9('0x9')][_0xd8f9('0xa')]({'port':0x232a});config[_0xd8f9('0xb')]=_[_0xd8f9('0xc')](config[_0xd8f9('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0xd8f9('0xd'))(new Redis(config[_0xd8f9('0xb')]));require('./mailInteraction.socket')[_0xd8f9('0xe')](socket);function respondWithRpcPromise(_0x4ac0ea,_0x5caee9,_0x421aca){return new BPromise(function(_0x3d0bea,_0x32b880){return client[_0xd8f9('0xf')](_0x4ac0ea,_0x421aca)[_0xd8f9('0x10')](function(_0x3a1db8){logger[_0xd8f9('0x11')]('MailInteraction,\x20%s,\x20%s',_0x5caee9,_0xd8f9('0x12'));logger['debug'](_0xd8f9('0x13'),_0x5caee9,_0xd8f9('0x12'),JSON[_0xd8f9('0x14')](_0x3a1db8));if(_0x3a1db8['error']){if(_0x3a1db8[_0xd8f9('0x15')][_0xd8f9('0x16')]===0x1f4){logger[_0xd8f9('0x15')](_0xd8f9('0x17'),_0x5caee9,_0x3a1db8['error'][_0xd8f9('0x18')]);return _0x32b880(_0x3a1db8[_0xd8f9('0x15')][_0xd8f9('0x18')]);}logger[_0xd8f9('0x15')](_0xd8f9('0x17'),_0x5caee9,_0x3a1db8[_0xd8f9('0x15')][_0xd8f9('0x18')]);return _0x3d0bea(_0x3a1db8['error']['message']);}else{logger[_0xd8f9('0x11')](_0xd8f9('0x17'),_0x5caee9,'request\x20sent');_0x3d0bea(_0x3a1db8[_0xd8f9('0x19')]['message']);}})[_0xd8f9('0x1a')](function(_0x49f2e7){logger['error']('MailInteraction,\x20%s,\x20%s',_0x5caee9,_0x49f2e7);_0x32b880(_0x49f2e7);});});}exports[_0xd8f9('0x1b')]=function(_0x5d094d){var _0x37a252=this;return new Promise(function(_0xef802d,_0x58ea35){return db[_0xd8f9('0x1c')][_0xd8f9('0x1d')](_0x5d094d[_0xd8f9('0x1e')],{'raw':_0x5d094d['options']?_0x5d094d[_0xd8f9('0x1f')][_0xd8f9('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5d094d[_0xd8f9('0x1f')]?_0x5d094d[_0xd8f9('0x1f')][_0xd8f9('0x21')]||null:null,'attributes':_0x5d094d[_0xd8f9('0x1f')]?_0x5d094d['options'][_0xd8f9('0x22')]||null:null,'limit':_0x5d094d[_0xd8f9('0x1f')]?_0x5d094d[_0xd8f9('0x1f')][_0xd8f9('0x23')]||null:null})[_0xd8f9('0x10')](function(_0x4c0002){logger[_0xd8f9('0x11')](_0xd8f9('0x1b'),_0x5d094d);logger[_0xd8f9('0x24')](_0xd8f9('0x1b'),_0x5d094d,JSON[_0xd8f9('0x14')](_0x4c0002));_0xef802d(_0x4c0002);})[_0xd8f9('0x1a')](function(_0x175123){logger[_0xd8f9('0x15')]('UpdateMailInteraction',_0x175123[_0xd8f9('0x18')],_0x5d094d);_0x58ea35(_0x37a252[_0xd8f9('0x15')](0x1f4,_0x175123[_0xd8f9('0x18')]));});});};exports['AddTagsToMailInteraction']=function(_0x5bd32e){return new Promise(function(_0x4c08b0,_0x3f85a2){return db[_0xd8f9('0x1c')]['find']({'where':_0x5bd32e[_0xd8f9('0x1f')]?_0x5bd32e[_0xd8f9('0x1f')]['where']||null:null})[_0xd8f9('0x10')](function(_0x13fa4b){if(_0x13fa4b){return _0x13fa4b[_0xd8f9('0x25')](_0x5bd32e['body'][_0xd8f9('0x26')],_['omit'](_0x5bd32e[_0xd8f9('0x1e')],[_0xd8f9('0x26'),'id'])||{});}})['spread'](function(_0x19d639){logger['info'](_0xd8f9('0x27'),_0x5bd32e);logger[_0xd8f9('0x24')](_0xd8f9('0x27'),_0x5bd32e,JSON[_0xd8f9('0x14')](_0x19d639));_0x4c08b0(_0x19d639);})[_0xd8f9('0x1a')](function(_0x105f00){logger[_0xd8f9('0x15')]('AddTags',_0x105f00[_0xd8f9('0x18')],_0x5bd32e);_0x3f85a2(_this['error'](0x1f4,_0x105f00['message']));});});}; \ No newline at end of file +var _0x1ed1=['UpdateMailInteraction','MailInteraction','body','options','raw','where','attributes','limit','catch','AddTagsToMailInteraction','addTags','ids','omit','AddTags','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./mailInteraction.socket','register','request','then','info','MailInteraction,\x20%s,\x20%s','request\x20sent','debug','MailInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x28d543,_0x5334f8){var _0x11dba5=function(_0x1a008a){while(--_0x1a008a){_0x28d543['push'](_0x28d543['shift']());}};_0x11dba5(++_0x5334f8);}(_0x1ed1,0x134));var _0x11ed=function(_0x41ae28,_0x5a9c4a){_0x41ae28=_0x41ae28-0x0;var _0x3cfee2=_0x1ed1[_0x41ae28];return _0x3cfee2;};'use strict';var _=require(_0x11ed('0x0'));var util=require('util');var moment=require(_0x11ed('0x1'));var BPromise=require('bluebird');var rs=require(_0x11ed('0x2'));var fs=require('fs');var Redis=require(_0x11ed('0x3'));var db=require(_0x11ed('0x4'))['db'];var utils=require(_0x11ed('0x5'));var logger=require(_0x11ed('0x6'))('rpc');var config=require(_0x11ed('0x7'));var jayson=require(_0x11ed('0x8'));var client=jayson[_0x11ed('0x9')][_0x11ed('0xa')]({'port':0x232a});config[_0x11ed('0xb')]=_['defaults'](config[_0x11ed('0xb')],{'host':_0x11ed('0xc'),'port':0x18eb});var socket=require(_0x11ed('0xd'))(new Redis(config['redis']));require(_0x11ed('0xe'))[_0x11ed('0xf')](socket);function respondWithRpcPromise(_0x52617c,_0x2c5a55,_0xae5b7f){return new BPromise(function(_0x5854ab,_0x304dd5){return client[_0x11ed('0x10')](_0x52617c,_0xae5b7f)[_0x11ed('0x11')](function(_0x2a1b86){logger[_0x11ed('0x12')](_0x11ed('0x13'),_0x2c5a55,_0x11ed('0x14'));logger[_0x11ed('0x15')](_0x11ed('0x16'),_0x2c5a55,_0x11ed('0x14'),JSON[_0x11ed('0x17')](_0x2a1b86));if(_0x2a1b86['error']){if(_0x2a1b86[_0x11ed('0x18')][_0x11ed('0x19')]===0x1f4){logger[_0x11ed('0x18')](_0x11ed('0x13'),_0x2c5a55,_0x2a1b86['error'][_0x11ed('0x1a')]);return _0x304dd5(_0x2a1b86[_0x11ed('0x18')][_0x11ed('0x1a')]);}logger['error'](_0x11ed('0x13'),_0x2c5a55,_0x2a1b86[_0x11ed('0x18')][_0x11ed('0x1a')]);return _0x5854ab(_0x2a1b86[_0x11ed('0x18')][_0x11ed('0x1a')]);}else{logger['info']('MailInteraction,\x20%s,\x20%s',_0x2c5a55,_0x11ed('0x14'));_0x5854ab(_0x2a1b86[_0x11ed('0x1b')]['message']);}})['catch'](function(_0x5bc0a7){logger[_0x11ed('0x18')](_0x11ed('0x13'),_0x2c5a55,_0x5bc0a7);_0x304dd5(_0x5bc0a7);});});}exports[_0x11ed('0x1c')]=function(_0x4e6f32){var _0x2b951b=this;return new Promise(function(_0x50727a,_0x2dea35){return db[_0x11ed('0x1d')]['update'](_0x4e6f32[_0x11ed('0x1e')],{'raw':_0x4e6f32['options']?_0x4e6f32[_0x11ed('0x1f')][_0x11ed('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4e6f32['options']?_0x4e6f32[_0x11ed('0x1f')][_0x11ed('0x21')]||null:null,'attributes':_0x4e6f32[_0x11ed('0x1f')]?_0x4e6f32[_0x11ed('0x1f')][_0x11ed('0x22')]||null:null,'limit':_0x4e6f32[_0x11ed('0x1f')]?_0x4e6f32[_0x11ed('0x1f')][_0x11ed('0x23')]||null:null})[_0x11ed('0x11')](function(_0x1beb3f){logger[_0x11ed('0x12')](_0x11ed('0x1c'),_0x4e6f32);logger['debug'](_0x11ed('0x1c'),_0x4e6f32,JSON[_0x11ed('0x17')](_0x1beb3f));_0x50727a(_0x1beb3f);})[_0x11ed('0x24')](function(_0x5a893e){logger['error'](_0x11ed('0x1c'),_0x5a893e[_0x11ed('0x1a')],_0x4e6f32);_0x2dea35(_0x2b951b[_0x11ed('0x18')](0x1f4,_0x5a893e['message']));});});};exports[_0x11ed('0x25')]=function(_0x590d46){return new Promise(function(_0x327ddc,_0xba0086){return db['MailInteraction']['find']({'where':_0x590d46[_0x11ed('0x1f')]?_0x590d46[_0x11ed('0x1f')][_0x11ed('0x21')]||null:null})['then'](function(_0x3c710c){if(_0x3c710c){return _0x3c710c[_0x11ed('0x26')](_0x590d46[_0x11ed('0x1e')][_0x11ed('0x27')],_[_0x11ed('0x28')](_0x590d46[_0x11ed('0x1e')],[_0x11ed('0x27'),'id'])||{});}})['spread'](function(_0x358f4f){logger[_0x11ed('0x12')]('AddTags',_0x590d46);logger[_0x11ed('0x15')](_0x11ed('0x29'),_0x590d46,JSON['stringify'](_0x358f4f));_0x327ddc(_0x358f4f);})[_0x11ed('0x24')](function(_0x466511){logger['error'](_0x11ed('0x29'),_0x466511[_0x11ed('0x1a')],_0x590d46);_0xba0086(_this[_0x11ed('0x18')](0x1f4,_0x466511[_0x11ed('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.socket.js b/server/api/mailInteraction/mailInteraction.socket.js index 073625a..498d629 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 _0xa338=['update','emit','removeListener','register','length','mailInteraction:','./mailInteraction.events','save','remove'];(function(_0x3afd01,_0x31bf06){var _0x35c8c4=function(_0xc07f88){while(--_0xc07f88){_0x3afd01['push'](_0x3afd01['shift']());}};_0x35c8c4(++_0x31bf06);}(_0xa338,0xa8));var _0x8a33=function(_0x58f0f0,_0x3ee71f){_0x58f0f0=_0x58f0f0-0x0;var _0x378165=_0xa338[_0x58f0f0];return _0x378165;};'use strict';var MailInteractionEvents=require(_0x8a33('0x0'));var events=[_0x8a33('0x1'),_0x8a33('0x2'),_0x8a33('0x3')];function createListener(_0xabac32,_0x5e3089){return function(_0xde1641){_0x5e3089[_0x8a33('0x4')](_0xabac32,_0xde1641);};}function removeListener(_0x409941,_0x1d6985){return function(){MailInteractionEvents[_0x8a33('0x5')](_0x409941,_0x1d6985);};}exports[_0x8a33('0x6')]=function(_0x662feb){for(var _0x22135b=0x0,_0x170bfd=events[_0x8a33('0x7')];_0x22135b<_0x170bfd;_0x22135b++){var _0x44c58f=events[_0x22135b];var _0x5ded8c=createListener(_0x8a33('0x8')+_0x44c58f,_0x662feb);MailInteractionEvents['on'](_0x44c58f,_0x5ded8c);}}; \ No newline at end of file +var _0xbe52=['emit','removeListener','register','length','mailInteraction:','./mailInteraction.events','save','remove'];(function(_0x2b8810,_0x55efdb){var _0x4c0f41=function(_0x3104cd){while(--_0x3104cd){_0x2b8810['push'](_0x2b8810['shift']());}};_0x4c0f41(++_0x55efdb);}(_0xbe52,0xed));var _0x2be5=function(_0x2fb096,_0x304e41){_0x2fb096=_0x2fb096-0x0;var _0xe8ad58=_0xbe52[_0x2fb096];return _0xe8ad58;};'use strict';var MailInteractionEvents=require(_0x2be5('0x0'));var events=[_0x2be5('0x1'),_0x2be5('0x2'),'update'];function createListener(_0x53eea2,_0x2f9d7b){return function(_0x1daf64){_0x2f9d7b[_0x2be5('0x3')](_0x53eea2,_0x1daf64);};}function removeListener(_0x35b082,_0x3c0e25){return function(){MailInteractionEvents[_0x2be5('0x4')](_0x35b082,_0x3c0e25);};}exports[_0x2be5('0x5')]=function(_0x2c37f3){for(var _0x1dcf41=0x0,_0x18f84c=events[_0x2be5('0x6')];_0x1dcf41<_0x18f84c;_0x1dcf41++){var _0x4b4aa4=events[_0x1dcf41];var _0x28281e=createListener(_0x2be5('0x7')+_0x4b4aa4,_0x2c37f3);MailInteractionEvents['on'](_0x4b4aa4,_0x28281e);}}; \ No newline at end of file diff --git a/server/api/mailMessage/index.js b/server/api/mailMessage/index.js index 4dd3665..1c4c136 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 _0x8d57=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailMessage.controller','isAuthenticated','index','get','/describe','describe','/:id','/:id/download','download','tracked','mail','mailmessage:create','put','update','/:id/accept','accept','/:id/reject','reject','delete','destroy','exports','util','path','connect-timeout','express','Router'];(function(_0x46e434,_0x1d5f1c){var _0x53b067=function(_0x99c6c2){while(--_0x99c6c2){_0x46e434['push'](_0x46e434['shift']());}};_0x53b067(++_0x1d5f1c);}(_0x8d57,0xaf));var _0x78d5=function(_0x513047,_0x2199c5){_0x513047=_0x513047-0x0;var _0x15b779=_0x8d57[_0x513047];return _0x15b779;};'use strict';var multer=require('multer');var util=require(_0x78d5('0x0'));var path=require(_0x78d5('0x1'));var timeout=require(_0x78d5('0x2'));var express=require(_0x78d5('0x3'));var router=express[_0x78d5('0x4')]();var fs_extra=require(_0x78d5('0x5'));var auth=require(_0x78d5('0x6'));var interaction=require(_0x78d5('0x7'));var config=require(_0x78d5('0x8'));var controller=require(_0x78d5('0x9'));router['get']('/',auth[_0x78d5('0xa')](),controller[_0x78d5('0xb')]);router[_0x78d5('0xc')](_0x78d5('0xd'),auth[_0x78d5('0xa')](),controller[_0x78d5('0xe')]);router[_0x78d5('0xc')](_0x78d5('0xf'),auth[_0x78d5('0xa')](),controller['show']);router[_0x78d5('0xc')](_0x78d5('0x10'),auth[_0x78d5('0xa')](),controller[_0x78d5('0x11')]);router['post']('/',auth[_0x78d5('0xa')](),interaction[_0x78d5('0x12')](_0x78d5('0x13'),_0x78d5('0x14')),controller['create']);router[_0x78d5('0x15')]('/:id',auth[_0x78d5('0xa')](),controller[_0x78d5('0x16')]);router['put'](_0x78d5('0x17'),auth[_0x78d5('0xa')](),controller[_0x78d5('0x18')]);router[_0x78d5('0x15')](_0x78d5('0x19'),auth['isAuthenticated'](),controller[_0x78d5('0x1a')]);router[_0x78d5('0x1b')]('/:id',auth['isAuthenticated'](),controller[_0x78d5('0x1c')]);module[_0x78d5('0x1d')]=router; \ No newline at end of file +var _0x3308=['destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','/:id/download','create','update','put','/:id/accept','accept','/:id/reject','reject','delete'];(function(_0x3d9557,_0x5d09d2){var _0x359ff8=function(_0x784fa){while(--_0x784fa){_0x3d9557['push'](_0x3d9557['shift']());}};_0x359ff8(++_0x5d09d2);}(_0x3308,0x160));var _0x8330=function(_0x29d776,_0x4852fd){_0x29d776=_0x29d776-0x0;var _0x3684f9=_0x3308[_0x29d776];return _0x3684f9;};'use strict';var multer=require(_0x8330('0x0'));var util=require(_0x8330('0x1'));var path=require(_0x8330('0x2'));var timeout=require(_0x8330('0x3'));var express=require(_0x8330('0x4'));var router=express[_0x8330('0x5')]();var fs_extra=require(_0x8330('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x8330('0x7'));var controller=require('./mailMessage.controller');router[_0x8330('0x8')]('/',auth[_0x8330('0x9')](),controller[_0x8330('0xa')]);router['get'](_0x8330('0xb'),auth[_0x8330('0x9')](),controller[_0x8330('0xc')]);router[_0x8330('0x8')](_0x8330('0xd'),auth[_0x8330('0x9')](),controller['show']);router[_0x8330('0x8')](_0x8330('0xe'),auth[_0x8330('0x9')](),controller['download']);router['post']('/',auth['isAuthenticated'](),interaction['tracked']('mail','mailmessage:create'),controller[_0x8330('0xf')]);router['put'](_0x8330('0xd'),auth[_0x8330('0x9')](),controller[_0x8330('0x10')]);router[_0x8330('0x11')](_0x8330('0x12'),auth['isAuthenticated'](),controller[_0x8330('0x13')]);router['put'](_0x8330('0x14'),auth[_0x8330('0x9')](),controller[_0x8330('0x15')]);router[_0x8330('0x16')](_0x8330('0xd'),auth[_0x8330('0x9')](),controller[_0x8330('0x17')]);module[_0x8330('0x18')]=router; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.attributes.js b/server/api/mailMessage/mailMessage.attributes.js index c6fc372..35ff504 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 _0x47f9=['ENUM','Email','Chat','sequelize','lodash','exports','TEXT','medium','BOOLEAN','out','STRING','long','DATE','INTEGER'];(function(_0x2bdfdc,_0x33156c){var _0x246da2=function(_0x4a7ca7){while(--_0x4a7ca7){_0x2bdfdc['push'](_0x2bdfdc['shift']());}};_0x246da2(++_0x33156c);}(_0x47f9,0x10d));var _0x947f=function(_0x2298f0,_0x3bbf4f){_0x2298f0=_0x2298f0-0x0;var _0x39b136=_0x47f9[_0x2298f0];return _0x39b136;};'use strict';var Sequelize=require(_0x947f('0x0'));var _=require(_0x947f('0x1'));module[_0x947f('0x2')]={'body':{'type':Sequelize['TEXT']('long'),'allowNull':![]},'plainBody':{'type':Sequelize[_0x947f('0x3')](_0x947f('0x4'))},'read':{'type':Sequelize[_0x947f('0x5')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0x947f('0x6')),'defaultValue':_0x947f('0x6'),'allowNull':![]},'messageId':{'type':Sequelize[_0x947f('0x7')](0x1fe)},'from':{'type':Sequelize[_0x947f('0x7')]},'to':{'type':Sequelize[_0x947f('0x3')](_0x947f('0x8'))},'cc':{'type':Sequelize[_0x947f('0x3')]('long')},'bcc':{'type':Sequelize[_0x947f('0x3')](_0x947f('0x8'))},'subject':{'type':Sequelize[_0x947f('0x3')]},'sentAt':{'type':Sequelize[_0x947f('0x9')]},'attach':{'type':Sequelize[_0x947f('0xa')],'defaultValue':0x0},'secret':{'type':Sequelize[_0x947f('0x5')],'defaultValue':![]},'readAt':{'type':Sequelize[_0x947f('0x9')]},'originTo':{'type':Sequelize[_0x947f('0x3')](_0x947f('0x8'))},'originCc':{'type':Sequelize[_0x947f('0x3')](_0x947f('0x8'))},'originChannel':{'type':Sequelize[_0x947f('0xb')](_0x947f('0xc'),_0x947f('0xd')),'defaultValue':'Email','allowNull':![]}}; \ No newline at end of file +var _0xf366=['TEXT','long','medium','BOOLEAN','ENUM','out','STRING','DATE','INTEGER','Chat','Email','lodash','exports'];(function(_0x22bdd3,_0x552e50){var _0x44d9d9=function(_0x2b4ab9){while(--_0x2b4ab9){_0x22bdd3['push'](_0x22bdd3['shift']());}};_0x44d9d9(++_0x552e50);}(_0xf366,0x129));var _0x6f36=function(_0x4863d9,_0x272d8f){_0x4863d9=_0x4863d9-0x0;var _0xa9e173=_0xf366[_0x4863d9];return _0xa9e173;};'use strict';var Sequelize=require('sequelize');var _=require(_0x6f36('0x0'));module[_0x6f36('0x1')]={'body':{'type':Sequelize[_0x6f36('0x2')](_0x6f36('0x3')),'allowNull':![]},'plainBody':{'type':Sequelize[_0x6f36('0x2')](_0x6f36('0x4'))},'read':{'type':Sequelize[_0x6f36('0x5')],'defaultValue':![]},'direction':{'type':Sequelize[_0x6f36('0x6')]('in',_0x6f36('0x7')),'defaultValue':_0x6f36('0x7'),'allowNull':![]},'messageId':{'type':Sequelize['STRING'](0x1fe)},'from':{'type':Sequelize[_0x6f36('0x8')]},'to':{'type':Sequelize[_0x6f36('0x2')](_0x6f36('0x3'))},'cc':{'type':Sequelize[_0x6f36('0x2')](_0x6f36('0x3'))},'bcc':{'type':Sequelize[_0x6f36('0x2')](_0x6f36('0x3'))},'subject':{'type':Sequelize[_0x6f36('0x2')]},'sentAt':{'type':Sequelize[_0x6f36('0x9')]},'attach':{'type':Sequelize[_0x6f36('0xa')],'defaultValue':0x0},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'readAt':{'type':Sequelize[_0x6f36('0x9')]},'originTo':{'type':Sequelize['TEXT'](_0x6f36('0x3'))},'originCc':{'type':Sequelize['TEXT'](_0x6f36('0x3'))},'originChannel':{'type':Sequelize[_0x6f36('0x6')]('Email',_0x6f36('0xb')),'defaultValue':_0x6f36('0xc'),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.controller.js b/server/api/mailMessage/mailMessage.controller.js index f2eb6b0..cbeb082 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 _0x7453=['EventManager','acceptmessage','reject','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','internal','motionChannel','download','unix','toString','server','files','tmp','from','subject','createdAt','Attachment','decode','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','bcc','Attachments','basename','existsSync','push','readFileSync','writeFileSync','unlinkSync','eml-format','moment','util','path','lodash','ioredis','../../config/logger','../../config/environment','redis','defaults','localhost','html-entities','./mailMessage.socket','register','jayson/promise','http','client','request','info','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','MailMessage,\x20%s,\x20%s','result','catch','status','offset','undefined','limit','count','set','Content-Range','json','update','then','destroy','sendStatus','stack','name','send','map','MailMessage','fieldName','type','model','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','include','rows','show','params','rawAttributes','intersection','includeAll','find','body','describe','create','direction','out','secret','split','findOne','MailAccountId','CmList','List','CmContact','updatedAt','DESC','MailServerOut','Smtp','isNil','host','port','secure','auth','user','service','pass','attachments','join','root','server/files/attachments','Contacts','ListId','List\x20not\x20found','SendMail','sendMail','messageId','format','YYYY-MM-DD\x20HH:mm:ss','accept','mail','read','agent','UserId','MailInteraction','MailInteractionId','read1stAt','interaction','get','[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','acceptMessage','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','User','fullname','email','interface','SIP/%s','channel'];(function(_0x1035c1,_0x2d8583){var _0x308d67=function(_0x58ddb6){while(--_0x58ddb6){_0x1035c1['push'](_0x1035c1['shift']());}};_0x308d67(++_0x2d8583);}(_0x7453,0x162));var _0x3745=function(_0x80ae04,_0x50d036){_0x80ae04=_0x80ae04-0x0;var _0x19ea59=_0x7453[_0x80ae04];return _0x19ea59;};'use strict';var emlformat=require(_0x3745('0x0'));var moment=require(_0x3745('0x1'));var BPromise=require('bluebird');var util=require(_0x3745('0x2'));var path=require(_0x3745('0x3'));var fs=require('fs');var _=require(_0x3745('0x4'));var Redis=require(_0x3745('0x5'));var htmlToText=require('html-to-text');var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')('api');var interaction_log=require(_0x3745('0x6'))('mail-interactions');var config=require(_0x3745('0x7'));var db=require('../../mysqldb')['db'];config[_0x3745('0x8')]=_[_0x3745('0x9')](config[_0x3745('0x8')],{'host':_0x3745('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));var htmlEntities=require(_0x3745('0xb'));require(_0x3745('0xc'))[_0x3745('0xd')](socket);var jayson=require(_0x3745('0xe'));var client=jayson['client'][_0x3745('0xf')]({'port':0x232c});var client9003=jayson[_0x3745('0x10')][_0x3745('0xf')]({'port':0x232b});var client9002=jayson[_0x3745('0x10')]['http']({'port':0x232a});function respondWithRpcPromise(_0x622feb,_0x53cb46,_0x1c7277,_0x10adbc){return new BPromise(function(_0xab3541,_0x32920a){var _0x39d46a=_0x10adbc||client;return _0x39d46a[_0x3745('0x11')](_0x622feb,_0x1c7277)['then'](function(_0x15dfc0){logger[_0x3745('0x12')]('MailMessage,\x20%s,\x20%s',_0x53cb46,_0x3745('0x13'));logger[_0x3745('0x14')](_0x3745('0x15'),_0x53cb46,_0x3745('0x13'),JSON[_0x3745('0x16')](_0x15dfc0));if(_0x15dfc0[_0x3745('0x17')]){if(_0x15dfc0[_0x3745('0x17')][_0x3745('0x18')]===0x1f4){logger['error']('MailMessage,\x20%s,\x20%s',_0x53cb46,_0x15dfc0[_0x3745('0x17')]['message']);return _0x32920a(_0x15dfc0[_0x3745('0x17')][_0x3745('0x19')]);}logger[_0x3745('0x17')]('MailMessage,\x20%s,\x20%s',_0x53cb46,_0x15dfc0[_0x3745('0x17')][_0x3745('0x19')]);return _0xab3541(_0x15dfc0[_0x3745('0x17')][_0x3745('0x19')]);}else{logger[_0x3745('0x12')](_0x3745('0x1a'),_0x53cb46,_0x3745('0x13'));_0xab3541(_0x15dfc0[_0x3745('0x1b')][_0x3745('0x19')]);}})[_0x3745('0x1c')](function(_0x58cc85){logger[_0x3745('0x17')](_0x3745('0x1a'),_0x53cb46,_0x58cc85);_0x32920a(_0x58cc85);});});}function respondWithResult(_0x56e6cc,_0x414148){_0x414148=_0x414148||0xc8;return function(_0x442f49){if(_0x442f49){return _0x56e6cc[_0x3745('0x1d')](_0x414148)['json'](_0x442f49);}};}function respondWithFilteredResult(_0x102327,_0x2e3158){return function(_0x48618c){if(_0x48618c){var _0x311f82=typeof _0x2e3158[_0x3745('0x1e')]===_0x3745('0x1f')&&typeof _0x2e3158[_0x3745('0x20')]==='undefined';var _0x25e9f5=_0x48618c[_0x3745('0x21')];var _0x4ad902=_0x311f82?0x0:_0x2e3158[_0x3745('0x1e')];var _0x38b408=_0x311f82?_0x48618c[_0x3745('0x21')]:_0x2e3158[_0x3745('0x1e')]+_0x2e3158[_0x3745('0x20')];var _0x4a1321;if(_0x38b408>=_0x25e9f5){_0x38b408=_0x25e9f5;_0x4a1321=0xc8;}else{_0x4a1321=0xce;}_0x102327[_0x3745('0x1d')](_0x4a1321);return _0x102327[_0x3745('0x22')](_0x3745('0x23'),_0x4ad902+'-'+_0x38b408+'/'+_0x25e9f5)[_0x3745('0x24')](_0x48618c);}return null;};}function saveUpdates(_0x3f6b9b){return function(_0x3581d5){if(_0x3581d5){return _0x3581d5[_0x3745('0x25')](_0x3f6b9b)[_0x3745('0x26')](function(_0x545f85){return _0x545f85;});}return null;};}function removeEntity(_0x3de130){return function(_0x211155){if(_0x211155){return _0x211155[_0x3745('0x27')]()[_0x3745('0x26')](function(){_0x3de130[_0x3745('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1f24b5){return function(_0x4a0a15){if(!_0x4a0a15){_0x1f24b5[_0x3745('0x28')](0x194);}return _0x4a0a15;};}function handleError(_0x480b58,_0x37038e){_0x37038e=_0x37038e||0x1f4;return function(_0x20d319){logger[_0x3745('0x17')](_0x20d319[_0x3745('0x29')]);if(_0x20d319[_0x3745('0x2a')]){delete _0x20d319['name'];}_0x480b58[_0x3745('0x1d')](_0x37038e)[_0x3745('0x2b')](_0x20d319);};}exports['index']=function(_0x4b2b2c,_0x3178e7){var _0x4a06e9={},_0x37a06c={},_0x14dd18={'count':0x0,'rows':[]};var _0x6cba43=_[_0x3745('0x2c')](db[_0x3745('0x2d')]['rawAttributes'],function(_0x47a5c6){return{'name':_0x47a5c6[_0x3745('0x2e')],'type':_0x47a5c6[_0x3745('0x2f')]['key']};});_0x37a06c[_0x3745('0x30')]=_[_0x3745('0x2c')](_0x6cba43,_0x3745('0x2a'));_0x37a06c[_0x3745('0x31')]=_[_0x3745('0x32')](_0x4b2b2c[_0x3745('0x31')]);_0x37a06c[_0x3745('0x33')]=_['intersection'](_0x37a06c[_0x3745('0x30')],_0x37a06c[_0x3745('0x31')]);_0x4a06e9[_0x3745('0x34')]=_['intersection'](_0x37a06c[_0x3745('0x30')],qs[_0x3745('0x35')](_0x4b2b2c['query'][_0x3745('0x35')]));_0x4a06e9['attributes']=_0x4a06e9[_0x3745('0x34')][_0x3745('0x36')]?_0x4a06e9['attributes']:_0x37a06c[_0x3745('0x30')];if(!_0x4b2b2c[_0x3745('0x31')][_0x3745('0x37')](_0x3745('0x38'))){_0x4a06e9[_0x3745('0x20')]=qs[_0x3745('0x20')](_0x4b2b2c[_0x3745('0x31')][_0x3745('0x20')]);_0x4a06e9['offset']=qs[_0x3745('0x1e')](_0x4b2b2c[_0x3745('0x31')]['offset']);}_0x4a06e9[_0x3745('0x39')]=qs[_0x3745('0x3a')](_0x4b2b2c[_0x3745('0x31')][_0x3745('0x3a')]);_0x4a06e9[_0x3745('0x3b')]=qs[_0x3745('0x33')](_[_0x3745('0x3c')](_0x4b2b2c[_0x3745('0x31')],_0x37a06c[_0x3745('0x33')]),_0x6cba43);if(_0x4b2b2c['query'][_0x3745('0x3d')]){_0x4a06e9['where']=_['merge'](_0x4a06e9[_0x3745('0x3b')],{'$or':_[_0x3745('0x2c')](_0x6cba43,function(_0x11877d){if(_0x11877d[_0x3745('0x2f')]!=='VIRTUAL'){var _0x37ef6e={};_0x37ef6e[_0x11877d[_0x3745('0x2a')]]={'$like':'%'+_0x4b2b2c[_0x3745('0x31')]['filter']+'%'};return _0x37ef6e;}})});}_0x4a06e9=_[_0x3745('0x3e')]({},_0x4a06e9,_0x4b2b2c[_0x3745('0x3f')]);var _0x49671b={'where':_0x4a06e9['where']};return db[_0x3745('0x2d')][_0x3745('0x21')](_0x49671b)[_0x3745('0x26')](function(_0xb9576d){_0x14dd18[_0x3745('0x21')]=_0xb9576d;if(_0x4b2b2c[_0x3745('0x31')]['includeAll']){_0x4a06e9[_0x3745('0x40')]=[{'all':!![]}];}return db[_0x3745('0x2d')]['findAll'](_0x4a06e9);})[_0x3745('0x26')](function(_0x164341){_0x14dd18[_0x3745('0x41')]=_0x164341;return _0x14dd18;})[_0x3745('0x26')](respondWithFilteredResult(_0x3178e7,_0x4a06e9))[_0x3745('0x1c')](handleError(_0x3178e7,null));};exports[_0x3745('0x42')]=function(_0x543ae6,_0x5b7153){var _0x9f2d0a={'raw':!![],'where':{'id':_0x543ae6[_0x3745('0x43')]['id']}},_0x43bed6={};_0x43bed6[_0x3745('0x30')]=_[_0x3745('0x32')](db[_0x3745('0x2d')][_0x3745('0x44')]);_0x43bed6['query']=_['keys'](_0x543ae6[_0x3745('0x31')]);_0x43bed6[_0x3745('0x33')]=_[_0x3745('0x45')](_0x43bed6[_0x3745('0x30')],_0x43bed6['query']);_0x9f2d0a[_0x3745('0x34')]=_[_0x3745('0x45')](_0x43bed6[_0x3745('0x30')],qs['fields'](_0x543ae6[_0x3745('0x31')][_0x3745('0x35')]));_0x9f2d0a[_0x3745('0x34')]=_0x9f2d0a['attributes'][_0x3745('0x36')]?_0x9f2d0a[_0x3745('0x34')]:_0x43bed6[_0x3745('0x30')];if(_0x543ae6[_0x3745('0x31')][_0x3745('0x46')]){_0x9f2d0a['include']=[{'all':!![]}];}_0x9f2d0a=_[_0x3745('0x3e')]({},_0x9f2d0a,_0x543ae6[_0x3745('0x3f')]);return db['MailMessage'][_0x3745('0x47')](_0x9f2d0a)[_0x3745('0x26')](handleEntityNotFound(_0x5b7153,null))[_0x3745('0x26')](respondWithResult(_0x5b7153,null))[_0x3745('0x1c')](handleError(_0x5b7153,null));};exports['update']=function(_0x467e6a,_0x1e01d5){if(_0x467e6a[_0x3745('0x48')]['id']){delete _0x467e6a[_0x3745('0x48')]['id'];}return db[_0x3745('0x2d')][_0x3745('0x47')]({'where':{'id':_0x467e6a['params']['id']}})[_0x3745('0x26')](handleEntityNotFound(_0x1e01d5,null))[_0x3745('0x26')](saveUpdates(_0x467e6a[_0x3745('0x48')],null))[_0x3745('0x26')](respondWithResult(_0x1e01d5,null))[_0x3745('0x1c')](handleError(_0x1e01d5,null));};exports[_0x3745('0x27')]=function(_0x135a7b,_0x2d7022){return db[_0x3745('0x2d')][_0x3745('0x47')]({'where':{'id':_0x135a7b[_0x3745('0x43')]['id']}})['then'](handleEntityNotFound(_0x2d7022,null))[_0x3745('0x26')](removeEntity(_0x2d7022,null))[_0x3745('0x1c')](handleError(_0x2d7022,null));};exports[_0x3745('0x49')]=function(_0x2dd0cc,_0x108d9f){return db['MailMessage'][_0x3745('0x49')]()[_0x3745('0x26')](respondWithResult(_0x108d9f,null))['catch'](handleError(_0x108d9f,null));};exports[_0x3745('0x4a')]=function(_0x5e17b3,_0x4e46c0){return db[_0x3745('0x2d')][_0x3745('0x4a')](_0x5e17b3[_0x3745('0x48')])[_0x3745('0x26')](function(_0x26e540){if(_0x26e540){if(_0x26e540[_0x3745('0x4b')]===_0x3745('0x4c')&&!_0x26e540[_0x3745('0x4d')]){var _0x265705,_0x45d336,_0x18ec92;if(_0x5e17b3[_0x3745('0x48')]['to']){_0x45d336=_0x5e17b3['body']['to'][_0x3745('0x4e')](',')[0x0];}return db['MailAccount'][_0x3745('0x4f')]({'where':{'id':_0x26e540[_0x3745('0x50')]},'include':[{'model':db[_0x3745('0x51')],'as':_0x3745('0x52'),'include':[{'model':db[_0x3745('0x53')],'as':'Contacts','where':{'email':_0x45d336},'limit':0x1,'order':[[_0x3745('0x54'),_0x3745('0x55')]]}]},{'model':db[_0x3745('0x56')],'as':_0x3745('0x57'),'raw':!![]}]})['then'](function(_0x5a4feb){_0x265705=_0x5a4feb;if(_0x265705&&_0x265705[_0x3745('0x57')]){var _0x543e05={'tls':{'rejectUnauthorized':![]}};if(_[_0x3745('0x58')](_0x265705[_0x3745('0x57')]['service'])){_0x543e05['host']=_0x265705[_0x3745('0x57')][_0x3745('0x59')];_0x543e05[_0x3745('0x5a')]=_0x265705[_0x3745('0x57')]['port'];_0x543e05[_0x3745('0x5b')]=_0x265705[_0x3745('0x57')][_0x3745('0x5b')];if(_0x265705[_0x3745('0x57')]['authentication']){_0x543e05[_0x3745('0x5c')]={'user':_0x265705[_0x3745('0x57')][_0x3745('0x5d')],'pass':_0x265705['Smtp']['pass']};}}else{_0x543e05[_0x3745('0x5e')]=_0x265705['Smtp']['service'];_0x543e05[_0x3745('0x5c')]={'user':_0x265705[_0x3745('0x57')][_0x3745('0x5d')],'pass':_0x265705[_0x3745('0x57')][_0x3745('0x5f')]};_0x543e05[_0x3745('0x5b')]=_0x265705[_0x3745('0x57')][_0x3745('0x5b')];}if(_0x5e17b3[_0x3745('0x48')]['attachments']&&_0x5e17b3[_0x3745('0x48')][_0x3745('0x60')][_0x3745('0x36')]){for(var _0x5623b1=0x0;_0x5623b1<_0x5e17b3[_0x3745('0x48')][_0x3745('0x60')][_0x3745('0x36')];_0x5623b1+=0x1){_0x5e17b3['body'][_0x3745('0x60')][_0x5623b1]={'filename':_0x5e17b3[_0x3745('0x48')][_0x3745('0x60')][_0x5623b1]['name'],'path':path[_0x3745('0x61')](config[_0x3745('0x62')],_0x3745('0x63'),_0x5e17b3[_0x3745('0x48')][_0x3745('0x60')][_0x5623b1]['basename'])};}}_0x18ec92={'account':_0x543e05,'message':_0x5e17b3[_0x3745('0x48')]};return;}})[_0x3745('0x26')](function(){if(_0x265705['List']){if(_0x265705['List'][_0x3745('0x64')][_0x3745('0x36')]){return _0x265705[_0x3745('0x52')]['Contacts'][0x0];}else{return db[_0x3745('0x53')][_0x3745('0x4a')](_[_0x3745('0x9')](_0x5e17b3[_0x3745('0x48')],{'firstName':_0x5e17b3['body']['to'],'email':_0x5e17b3[_0x3745('0x48')]['to'],'phone':_0x5e17b3['body']['to'],'ListId':_0x265705[_0x3745('0x65')]}));}}else{throw new Error(_0x3745('0x66'));}})[_0x3745('0x26')](function(){if(_0x18ec92){return respondWithRpcPromise(_0x3745('0x67'),_0x3745('0x68'),_0x18ec92,client9003)[_0x3745('0x26')](function(_0x4ee77c){return _0x26e540[_0x3745('0x25')]({'read':!![],'messageId':_0x4ee77c[_0x3745('0x69')],'sentAt':moment()[_0x3745('0x6a')](_0x3745('0x6b'))});})[_0x3745('0x1c')](function(_0x97f44d){logger[_0x3745('0x17')]('%s',JSON['stringify'](_0x97f44d));return _0x26e540;});}return _0x26e540;});}return _0x26e540;}})[_0x3745('0x26')](respondWithResult(_0x4e46c0,0xc9))[_0x3745('0x1c')](handleError(_0x4e46c0,null));};exports[_0x3745('0x6c')]=function(_0x174f1f,_0x4e6a5d){var _0x31d241={'agent':{},'channel':_0x3745('0x6d')};if(_0x174f1f[_0x3745('0x48')]['id']){delete _0x174f1f['body']['id'];}_0x174f1f[_0x3745('0x48')][_0x3745('0x6e')]=!![];_0x174f1f[_0x3745('0x48')]['readAt']=moment()[_0x3745('0x6a')]('YYYY-MM-DD\x20HH:mm:ss');_0x174f1f['body']['UserId']=_0x174f1f['body']['UserId']||_0x174f1f['user']['id'];_0x31d241[_0x3745('0x6f')]['id']=_0x174f1f[_0x3745('0x48')][_0x3745('0x70')];return db[_0x3745('0x2d')][_0x3745('0x47')]({'where':{'id':_0x174f1f[_0x3745('0x43')]['id'],'UserId':null}})[_0x3745('0x26')](handleEntityNotFound(_0x4e6a5d,null))[_0x3745('0x26')](saveUpdates(_0x174f1f['body'],null))[_0x3745('0x26')](function(_0x414c63){if(_0x414c63){_0x31d241[_0x3745('0x19')]=_0x414c63['get']({'plain':!![]});return db[_0x3745('0x71')][_0x3745('0x47')]({'where':{'id':_0x414c63[_0x3745('0x72')]}});}return null;})['then'](handleEntityNotFound(_0x4e6a5d,null))[_0x3745('0x26')](function(_0x61783d){if(_0x61783d){return _0x61783d[_0x3745('0x25')]({'UserId':_0x174f1f[_0x3745('0x48')][_0x3745('0x70')],'read1stAt':_[_0x3745('0x58')](_0x61783d[_0x3745('0x73')])?moment()[_0x3745('0x6a')](_0x3745('0x6b')):undefined});}return null;})[_0x3745('0x26')](function(_0x45c014){if(_0x45c014){_0x31d241[_0x3745('0x74')]=_0x45c014[_0x3745('0x75')]({'plain':!![]});interaction_log[_0x3745('0x12')](_0x3745('0x76'),_0x174f1f[_0x3745('0x5d')]['id'],_0x174f1f[_0x3745('0x5d')][_0x3745('0x2a')],_0x174f1f['user'][_0x3745('0x77')],_0x31d241[_0x3745('0x74')]['id'],_0x174f1f['body']?JSON[_0x3745('0x16')](_0x174f1f['body']):_0x3745('0x78'));return respondWithRpcPromise(_0x3745('0x79'),_0x3745('0x7a'),_0x31d241);}return null;})[_0x3745('0x26')](function(_0x1d2fdb){var _0x2582f5='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x1d2fdb[_0x3745('0x19')][_0x3745('0x7b')];return db[_0x3745('0x7c')]['query'](_0x2582f5,{'type':db[_0x3745('0x7d')][_0x3745('0x7e')][_0x3745('0x7f')],'raw':!![]})['then'](function(_0x1bb674){return _0x1bb674;});})['then'](function(_0x4149cc){if(_0x4149cc){_0x31d241[_0x3745('0x19')][_0x3745('0x80')]=_0x4149cc[0x0];if(!_0x174f1f[_0x3745('0x48')][_0x3745('0x70')])return;return db[_0x3745('0x81')]['find']({'where':{'id':_0x174f1f[_0x3745('0x48')][_0x3745('0x70')],'role':'agent'},'attributes':['id',_0x3745('0x2a'),_0x3745('0x82'),_0x3745('0x83'),'internal'],'raw':!![]});}return null;})['then'](function(_0x41373a){if(!_0x41373a)return null;_0x31d241[_0x3745('0x19')][_0x3745('0x6f')]=_0x41373a;return _0x31d241;})['then'](function(_0x469cb4){if(_0x469cb4){if(_0x174f1f[_0x3745('0x48')]['manual']){_0x31d241['message'][_0x3745('0x84')]=util[_0x3745('0x6a')](_0x3745('0x85'),_0x174f1f['user'][_0x3745('0x2a')]);_0x31d241['message']['channel']=_0x31d241[_0x3745('0x86')];_0x31d241[_0x3745('0x19')]['motionChannel']=_0x31d241[_0x3745('0x86')];_0x31d241[_0x3745('0x19')]['event']=_0x3745('0x6c');_0x31d241[_0x3745('0x19')][_0x3745('0x48')]=htmlToText['fromString'](_0x31d241[_0x3745('0x19')][_0x3745('0x48')]);return respondWithRpcPromise(_0x3745('0x87'),_0x3745('0x87'),{'event':_0x3745('0x88'),'message':_0x31d241[_0x3745('0x19')]},client9002)['then'](function(){return _0x31d241;});}return _0x31d241;}return null;})[_0x3745('0x26')](respondWithResult(_0x4e6a5d,null))[_0x3745('0x1c')](handleError(_0x4e6a5d,null));};exports[_0x3745('0x89')]=function(_0x326f16,_0x2e0f4a){var _0x1fbf92={'agent':{},'channel':_0x3745('0x6d')};if(_0x326f16['body']['id']){delete _0x326f16[_0x3745('0x48')]['id'];}_0x326f16['body'][_0x3745('0x70')]=_0x326f16['body'][_0x3745('0x70')]||_0x326f16[_0x3745('0x5d')]['id'];_0x1fbf92[_0x3745('0x6f')]['id']=_0x326f16['body']['UserId'];return db['MailMessage']['find']({'where':{'id':_0x326f16['params']['id'],'UserId':null}})['then'](handleEntityNotFound(_0x2e0f4a,null))['then'](function(_0x4b43ff){if(_0x4b43ff){_0x1fbf92['message']=_0x4b43ff[_0x3745('0x75')]({'plain':!![]});return db[_0x3745('0x71')][_0x3745('0x47')]({'where':{'id':_0x4b43ff[_0x3745('0x72')]}});}return null;})[_0x3745('0x26')](handleEntityNotFound(_0x2e0f4a,null))[_0x3745('0x26')](function(_0x141c71){if(_0x141c71){_0x1fbf92[_0x3745('0x74')]=_0x141c71['get']({'plain':!![]});interaction_log[_0x3745('0x12')](_0x3745('0x8a'),_0x326f16[_0x3745('0x5d')]['id'],_0x326f16['user']['name'],_0x326f16[_0x3745('0x5d')][_0x3745('0x77')],_0x1fbf92[_0x3745('0x74')]['id'],_0x326f16[_0x3745('0x48')]?JSON[_0x3745('0x16')](_0x326f16[_0x3745('0x48')]):'null');return respondWithRpcPromise(_0x3745('0x8b'),'rejectMessage',_0x1fbf92);}return null;})[_0x3745('0x26')](function(_0x3bd9c3){var _0x4a6868=_0x3745('0x8c')+_0x3bd9c3[_0x3745('0x19')][_0x3745('0x7b')];return db[_0x3745('0x7c')][_0x3745('0x31')](_0x4a6868,{'type':db[_0x3745('0x7d')][_0x3745('0x7e')][_0x3745('0x7f')],'raw':!![]})[_0x3745('0x26')](function(_0x4c8173){return _0x4c8173;});})[_0x3745('0x26')](function(_0x42acaf){if(_0x42acaf){_0x1fbf92[_0x3745('0x19')][_0x3745('0x80')]=_0x42acaf[0x0];if(!_0x326f16[_0x3745('0x48')]['UserId'])return;return db[_0x3745('0x81')][_0x3745('0x47')]({'where':{'id':_0x326f16[_0x3745('0x48')][_0x3745('0x70')],'role':_0x3745('0x6f')},'attributes':['id',_0x3745('0x2a'),_0x3745('0x82'),_0x3745('0x83'),_0x3745('0x8d')],'raw':!![]});}return null;})['then'](function(_0x2086fc){if(!_0x2086fc)return null;_0x1fbf92[_0x3745('0x19')][_0x3745('0x6f')]=_0x2086fc;return _0x1fbf92;})[_0x3745('0x26')](function(_0x28538c){if(_0x28538c){_0x28538c['message'][_0x3745('0x84')]=util[_0x3745('0x6a')]('SIP/%s',_0x326f16[_0x3745('0x5d')][_0x3745('0x2a')]);_0x28538c[_0x3745('0x19')][_0x3745('0x86')]=_0x1fbf92[_0x3745('0x86')];_0x28538c[_0x3745('0x19')][_0x3745('0x8e')]=_0x1fbf92[_0x3745('0x86')];_0x28538c[_0x3745('0x19')]['event']='reject';_0x28538c[_0x3745('0x19')][_0x3745('0x48')]=htmlToText['fromString'](_0x1fbf92[_0x3745('0x19')][_0x3745('0x48')]);respondWithRpcPromise('EventManager','EventManager',{'event':'rejectmessage','message':_0x28538c[_0x3745('0x19')]},client9002);return _0x1fbf92;}return null;})[_0x3745('0x26')](respondWithResult(_0x2e0f4a,null))[_0x3745('0x1c')](handleError(_0x2e0f4a,null));};exports[_0x3745('0x8f')]=function(_0x22958f,_0x538e58){var _0x1e78bc=moment()[_0x3745('0x90')]()[_0x3745('0x91')]();var _0x2db896=path['join'](config[_0x3745('0x62')],_0x3745('0x92'),_0x3745('0x93'),_0x3745('0x94'));var _0x35eac6=path[_0x3745('0x61')](config[_0x3745('0x62')],_0x3745('0x92'),'files','attachments');var _0x4acd98=util[_0x3745('0x6a')]('message-%s.eml',_0x1e78bc);return db[_0x3745('0x2d')][_0x3745('0x47')]({'where':{'id':_0x22958f[_0x3745('0x43')]['id']},'attributes':['id',_0x3745('0x48'),_0x3745('0x95'),'to','cc','bcc',_0x3745('0x96'),_0x3745('0x97')],'include':_0x22958f[_0x3745('0x31')][_0x3745('0x60')]?[{'model':db[_0x3745('0x98')],'as':'Attachments'}]:undefined})[_0x3745('0x26')](handleEntityNotFound(_0x538e58,null))[_0x3745('0x26')](function(_0xdfbcb3){if(_0xdfbcb3){var _0x3fd133=_0xdfbcb3;var _0x5df9bb={'from':_0x3fd133[_0x3745('0x95')],'to':_0x3fd133['to'],'subject':_0x3fd133[_0x3745('0x96')],'html':htmlEntities[_0x3745('0x99')](_0x3fd133[_0x3745('0x48')]),'headers':{'Date':moment(_0x3fd133[_0x3745('0x97')])['format'](_0x3745('0x9a'))},'attachments':[]};if(_0xdfbcb3['cc']){_0x5df9bb['headers']['Cc']=_0xdfbcb3['cc'];}if(_0xdfbcb3['bcc']){_0x5df9bb['headers']['Bcc']=_0xdfbcb3[_0x3745('0x9b')];}return new BPromise(function(_0x1a64c1,_0x559fa2){if(_0xdfbcb3['Attachments']){for(var _0x295618=0x0;_0x295618<_0xdfbcb3[_0x3745('0x9c')][_0x3745('0x36')];_0x295618++){var _0x2c69dd=_0xdfbcb3[_0x3745('0x9c')][_0x295618];var _0x1c4781=path[_0x3745('0x61')](_0x35eac6,_0x2c69dd[_0x3745('0x9d')]);if(fs[_0x3745('0x9e')](_0x1c4781)){_0x5df9bb[_0x3745('0x60')][_0x3745('0x9f')]({'name':_0x2c69dd[_0x3745('0x2a')],'contentType':_0x2c69dd[_0x3745('0x2f')],'data':fs[_0x3745('0xa0')](_0x1c4781)});}}}emlformat['build'](_0x5df9bb,function(_0x1f992f,_0x94440a){if(_0x1f992f)return _0x559fa2(_0x1f992f);fs[_0x3745('0xa1')](path[_0x3745('0x61')](_0x2db896,_0x4acd98),_0x94440a);return _0x1a64c1(_0x94440a);});});}})[_0x3745('0x26')](function(_0x2c171f){if(_0x2c171f){return _0x538e58['download'](path[_0x3745('0x61')](_0x2db896,_0x4acd98),_0x4acd98,function(_0x5c7b03){if(!_0x5c7b03)fs[_0x3745('0xa2')](path[_0x3745('0x61')](_0x2db896,_0x4acd98));});}})[_0x3745('0x1c')](handleError(_0x538e58,null));}; \ No newline at end of file +var _0x5eef=['error','code','message','info','result','catch','status','json','offset','undefined','limit','count','set','Content-Range','update','destroy','end','sendStatus','stack','name','send','index','map','type','key','model','query','keys','filters','attributes','intersection','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','MailMessage','include','findAll','rows','show','params','rawAttributes','fields','includeAll','find','body','describe','create','direction','out','secret','split','MailAccount','findOne','MailAccountId','CmList','List','CmContact','Contacts','updatedAt','DESC','Smtp','isNil','service','host','port','secure','auth','user','pass','attachments','root','server/files/attachments','ListId','SendMail','sendMail','messageId','YYYY-MM-DD\x20HH:mm:ss','mail','read','readAt','format','UserId','agent','get','MailInteraction','MailInteractionId','read1stAt','interaction','[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','SELECT','contact','User','email','internal','manual','interface','SIP/%s','channel','motionChannel','event','accept','fromString','reject','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','RejectMessage','rejectMessage','QueryTypes','fullname','EventManager','unix','toString','join','files','tmp','message-%s.eml','from','bcc','subject','createdAt','Attachment','Attachments','decode','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','basename','existsSync','push','readFileSync','build','writeFileSync','download','unlinkSync','eml-format','moment','bluebird','util','lodash','ioredis','html-to-text','../../components/parsers/qs','../../config/logger','api','mail-interactions','../../config/environment','../../mysqldb','defaults','localhost','socket.io-emitter','redis','html-entities','./mailMessage.socket','register','jayson/promise','http','request','then','MailMessage,\x20%s,\x20%s','request\x20sent','debug','stringify'];(function(_0x6cf19c,_0x2f3f02){var _0xce14f3=function(_0x474587){while(--_0x474587){_0x6cf19c['push'](_0x6cf19c['shift']());}};_0xce14f3(++_0x2f3f02);}(_0x5eef,0x144));var _0xf5ee=function(_0x4bf551,_0x2a8b39){_0x4bf551=_0x4bf551-0x0;var _0x31da5f=_0x5eef[_0x4bf551];return _0x31da5f;};'use strict';var emlformat=require(_0xf5ee('0x0'));var moment=require(_0xf5ee('0x1'));var BPromise=require(_0xf5ee('0x2'));var util=require(_0xf5ee('0x3'));var path=require('path');var fs=require('fs');var _=require(_0xf5ee('0x4'));var Redis=require(_0xf5ee('0x5'));var htmlToText=require(_0xf5ee('0x6'));var qs=require(_0xf5ee('0x7'));var logger=require(_0xf5ee('0x8'))(_0xf5ee('0x9'));var interaction_log=require(_0xf5ee('0x8'))(_0xf5ee('0xa'));var config=require(_0xf5ee('0xb'));var db=require(_0xf5ee('0xc'))['db'];config['redis']=_[_0xf5ee('0xd')](config['redis'],{'host':_0xf5ee('0xe'),'port':0x18eb});var socket=require(_0xf5ee('0xf'))(new Redis(config[_0xf5ee('0x10')]));var htmlEntities=require(_0xf5ee('0x11'));require(_0xf5ee('0x12'))[_0xf5ee('0x13')](socket);var jayson=require(_0xf5ee('0x14'));var client=jayson['client'][_0xf5ee('0x15')]({'port':0x232c});var client9003=jayson['client'][_0xf5ee('0x15')]({'port':0x232b});var client9002=jayson['client'][_0xf5ee('0x15')]({'port':0x232a});function respondWithRpcPromise(_0x1abd20,_0x203e5a,_0x335707,_0x407393){return new BPromise(function(_0xb48c49,_0x34de97){var _0x5a95f8=_0x407393||client;return _0x5a95f8[_0xf5ee('0x16')](_0x1abd20,_0x335707)[_0xf5ee('0x17')](function(_0x3df0f6){logger['info'](_0xf5ee('0x18'),_0x203e5a,_0xf5ee('0x19'));logger[_0xf5ee('0x1a')]('MailMessage,\x20%s,\x20%s,\x20%s',_0x203e5a,'request\x20sent',JSON[_0xf5ee('0x1b')](_0x3df0f6));if(_0x3df0f6[_0xf5ee('0x1c')]){if(_0x3df0f6[_0xf5ee('0x1c')][_0xf5ee('0x1d')]===0x1f4){logger[_0xf5ee('0x1c')](_0xf5ee('0x18'),_0x203e5a,_0x3df0f6[_0xf5ee('0x1c')]['message']);return _0x34de97(_0x3df0f6[_0xf5ee('0x1c')][_0xf5ee('0x1e')]);}logger['error'](_0xf5ee('0x18'),_0x203e5a,_0x3df0f6[_0xf5ee('0x1c')]['message']);return _0xb48c49(_0x3df0f6['error'][_0xf5ee('0x1e')]);}else{logger[_0xf5ee('0x1f')](_0xf5ee('0x18'),_0x203e5a,_0xf5ee('0x19'));_0xb48c49(_0x3df0f6[_0xf5ee('0x20')][_0xf5ee('0x1e')]);}})[_0xf5ee('0x21')](function(_0x99718f){logger[_0xf5ee('0x1c')](_0xf5ee('0x18'),_0x203e5a,_0x99718f);_0x34de97(_0x99718f);});});}function respondWithResult(_0x1b0a65,_0x524c5e){_0x524c5e=_0x524c5e||0xc8;return function(_0x4cfaf1){if(_0x4cfaf1){return _0x1b0a65[_0xf5ee('0x22')](_0x524c5e)[_0xf5ee('0x23')](_0x4cfaf1);}};}function respondWithFilteredResult(_0xe6c3b,_0x1c8c88){return function(_0x22d017){if(_0x22d017){var _0x543351=typeof _0x1c8c88[_0xf5ee('0x24')]===_0xf5ee('0x25')&&typeof _0x1c8c88[_0xf5ee('0x26')]===_0xf5ee('0x25');var _0x530132=_0x22d017[_0xf5ee('0x27')];var _0x3eefc0=_0x543351?0x0:_0x1c8c88[_0xf5ee('0x24')];var _0xe5fa78=_0x543351?_0x22d017[_0xf5ee('0x27')]:_0x1c8c88[_0xf5ee('0x24')]+_0x1c8c88[_0xf5ee('0x26')];var _0x400d02;if(_0xe5fa78>=_0x530132){_0xe5fa78=_0x530132;_0x400d02=0xc8;}else{_0x400d02=0xce;}_0xe6c3b[_0xf5ee('0x22')](_0x400d02);return _0xe6c3b[_0xf5ee('0x28')](_0xf5ee('0x29'),_0x3eefc0+'-'+_0xe5fa78+'/'+_0x530132)[_0xf5ee('0x23')](_0x22d017);}return null;};}function saveUpdates(_0x308c61){return function(_0x31affd){if(_0x31affd){return _0x31affd[_0xf5ee('0x2a')](_0x308c61)[_0xf5ee('0x17')](function(_0x49311d){return _0x49311d;});}return null;};}function removeEntity(_0x3b50de){return function(_0x425bf2){if(_0x425bf2){return _0x425bf2[_0xf5ee('0x2b')]()[_0xf5ee('0x17')](function(){_0x3b50de[_0xf5ee('0x22')](0xcc)[_0xf5ee('0x2c')]();});}};}function handleEntityNotFound(_0xf77ef6){return function(_0x5344cb){if(!_0x5344cb){_0xf77ef6[_0xf5ee('0x2d')](0x194);}return _0x5344cb;};}function handleError(_0x583fd8,_0x4a24ed){_0x4a24ed=_0x4a24ed||0x1f4;return function(_0x5e1fad){logger[_0xf5ee('0x1c')](_0x5e1fad[_0xf5ee('0x2e')]);if(_0x5e1fad[_0xf5ee('0x2f')]){delete _0x5e1fad['name'];}_0x583fd8[_0xf5ee('0x22')](_0x4a24ed)[_0xf5ee('0x30')](_0x5e1fad);};}exports[_0xf5ee('0x31')]=function(_0x3e84c1,_0x8855d5){var _0x49d24b={},_0x1da516={},_0xe85d59={'count':0x0,'rows':[]};var _0x5da3bc=_[_0xf5ee('0x32')](db['MailMessage']['rawAttributes'],function(_0x14d3a0){return{'name':_0x14d3a0['fieldName'],'type':_0x14d3a0[_0xf5ee('0x33')][_0xf5ee('0x34')]};});_0x1da516[_0xf5ee('0x35')]=_[_0xf5ee('0x32')](_0x5da3bc,_0xf5ee('0x2f'));_0x1da516[_0xf5ee('0x36')]=_[_0xf5ee('0x37')](_0x3e84c1[_0xf5ee('0x36')]);_0x1da516[_0xf5ee('0x38')]=_['intersection'](_0x1da516[_0xf5ee('0x35')],_0x1da516[_0xf5ee('0x36')]);_0x49d24b[_0xf5ee('0x39')]=_[_0xf5ee('0x3a')](_0x1da516[_0xf5ee('0x35')],qs['fields'](_0x3e84c1[_0xf5ee('0x36')]['fields']));_0x49d24b[_0xf5ee('0x39')]=_0x49d24b['attributes'][_0xf5ee('0x3b')]?_0x49d24b[_0xf5ee('0x39')]:_0x1da516[_0xf5ee('0x35')];if(!_0x3e84c1[_0xf5ee('0x36')][_0xf5ee('0x3c')](_0xf5ee('0x3d'))){_0x49d24b['limit']=qs[_0xf5ee('0x26')](_0x3e84c1[_0xf5ee('0x36')]['limit']);_0x49d24b['offset']=qs[_0xf5ee('0x24')](_0x3e84c1[_0xf5ee('0x36')][_0xf5ee('0x24')]);}_0x49d24b[_0xf5ee('0x3e')]=qs[_0xf5ee('0x3f')](_0x3e84c1[_0xf5ee('0x36')][_0xf5ee('0x3f')]);_0x49d24b['where']=qs[_0xf5ee('0x38')](_[_0xf5ee('0x40')](_0x3e84c1['query'],_0x1da516['filters']),_0x5da3bc);if(_0x3e84c1[_0xf5ee('0x36')][_0xf5ee('0x41')]){_0x49d24b[_0xf5ee('0x42')]=_[_0xf5ee('0x43')](_0x49d24b[_0xf5ee('0x42')],{'$or':_[_0xf5ee('0x32')](_0x5da3bc,function(_0x42f030){if(_0x42f030[_0xf5ee('0x33')]!==_0xf5ee('0x44')){var _0x7d199a={};_0x7d199a[_0x42f030[_0xf5ee('0x2f')]]={'$like':'%'+_0x3e84c1[_0xf5ee('0x36')][_0xf5ee('0x41')]+'%'};return _0x7d199a;}})});}_0x49d24b=_['merge']({},_0x49d24b,_0x3e84c1['options']);var _0x2f5f81={'where':_0x49d24b[_0xf5ee('0x42')]};return db[_0xf5ee('0x45')][_0xf5ee('0x27')](_0x2f5f81)[_0xf5ee('0x17')](function(_0x1bef60){_0xe85d59[_0xf5ee('0x27')]=_0x1bef60;if(_0x3e84c1[_0xf5ee('0x36')]['includeAll']){_0x49d24b[_0xf5ee('0x46')]=[{'all':!![]}];}return db['MailMessage'][_0xf5ee('0x47')](_0x49d24b);})[_0xf5ee('0x17')](function(_0x1d6400){_0xe85d59[_0xf5ee('0x48')]=_0x1d6400;return _0xe85d59;})['then'](respondWithFilteredResult(_0x8855d5,_0x49d24b))[_0xf5ee('0x21')](handleError(_0x8855d5,null));};exports[_0xf5ee('0x49')]=function(_0x4099ab,_0x5e0df5){var _0x5dff82={'raw':!![],'where':{'id':_0x4099ab[_0xf5ee('0x4a')]['id']}},_0x4610ab={};_0x4610ab[_0xf5ee('0x35')]=_['keys'](db[_0xf5ee('0x45')][_0xf5ee('0x4b')]);_0x4610ab['query']=_['keys'](_0x4099ab[_0xf5ee('0x36')]);_0x4610ab['filters']=_['intersection'](_0x4610ab[_0xf5ee('0x35')],_0x4610ab['query']);_0x5dff82['attributes']=_['intersection'](_0x4610ab['model'],qs[_0xf5ee('0x4c')](_0x4099ab[_0xf5ee('0x36')][_0xf5ee('0x4c')]));_0x5dff82[_0xf5ee('0x39')]=_0x5dff82[_0xf5ee('0x39')]['length']?_0x5dff82[_0xf5ee('0x39')]:_0x4610ab[_0xf5ee('0x35')];if(_0x4099ab['query'][_0xf5ee('0x4d')]){_0x5dff82[_0xf5ee('0x46')]=[{'all':!![]}];}_0x5dff82=_[_0xf5ee('0x43')]({},_0x5dff82,_0x4099ab['options']);return db['MailMessage'][_0xf5ee('0x4e')](_0x5dff82)['then'](handleEntityNotFound(_0x5e0df5,null))[_0xf5ee('0x17')](respondWithResult(_0x5e0df5,null))[_0xf5ee('0x21')](handleError(_0x5e0df5,null));};exports['update']=function(_0x21536d,_0x2b397a){if(_0x21536d[_0xf5ee('0x4f')]['id']){delete _0x21536d[_0xf5ee('0x4f')]['id'];}return db['MailMessage'][_0xf5ee('0x4e')]({'where':{'id':_0x21536d[_0xf5ee('0x4a')]['id']}})[_0xf5ee('0x17')](handleEntityNotFound(_0x2b397a,null))[_0xf5ee('0x17')](saveUpdates(_0x21536d[_0xf5ee('0x4f')],null))[_0xf5ee('0x17')](respondWithResult(_0x2b397a,null))['catch'](handleError(_0x2b397a,null));};exports[_0xf5ee('0x2b')]=function(_0x1d46d0,_0x51bc1a){return db['MailMessage']['find']({'where':{'id':_0x1d46d0[_0xf5ee('0x4a')]['id']}})['then'](handleEntityNotFound(_0x51bc1a,null))[_0xf5ee('0x17')](removeEntity(_0x51bc1a,null))['catch'](handleError(_0x51bc1a,null));};exports[_0xf5ee('0x50')]=function(_0x4f3e29,_0x1d2bfe){return db[_0xf5ee('0x45')]['describe']()['then'](respondWithResult(_0x1d2bfe,null))[_0xf5ee('0x21')](handleError(_0x1d2bfe,null));};exports['create']=function(_0x10a56d,_0x54cda2){return db['MailMessage'][_0xf5ee('0x51')](_0x10a56d[_0xf5ee('0x4f')])['then'](function(_0x10e3e2){if(_0x10e3e2){if(_0x10e3e2[_0xf5ee('0x52')]===_0xf5ee('0x53')&&!_0x10e3e2[_0xf5ee('0x54')]){var _0x2fed9a,_0xe78596,_0x20da75;if(_0x10a56d[_0xf5ee('0x4f')]['to']){_0xe78596=_0x10a56d['body']['to'][_0xf5ee('0x55')](',')[0x0];}return db[_0xf5ee('0x56')][_0xf5ee('0x57')]({'where':{'id':_0x10e3e2[_0xf5ee('0x58')]},'include':[{'model':db[_0xf5ee('0x59')],'as':_0xf5ee('0x5a'),'include':[{'model':db[_0xf5ee('0x5b')],'as':_0xf5ee('0x5c'),'where':{'email':_0xe78596},'limit':0x1,'order':[[_0xf5ee('0x5d'),_0xf5ee('0x5e')]]}]},{'model':db['MailServerOut'],'as':_0xf5ee('0x5f'),'raw':!![]}]})[_0xf5ee('0x17')](function(_0x34ae14){_0x2fed9a=_0x34ae14;if(_0x2fed9a&&_0x2fed9a[_0xf5ee('0x5f')]){var _0x2c2b5b={'tls':{'rejectUnauthorized':![]}};if(_[_0xf5ee('0x60')](_0x2fed9a[_0xf5ee('0x5f')][_0xf5ee('0x61')])){_0x2c2b5b['host']=_0x2fed9a[_0xf5ee('0x5f')][_0xf5ee('0x62')];_0x2c2b5b[_0xf5ee('0x63')]=_0x2fed9a[_0xf5ee('0x5f')][_0xf5ee('0x63')];_0x2c2b5b[_0xf5ee('0x64')]=_0x2fed9a[_0xf5ee('0x5f')]['secure'];if(_0x2fed9a[_0xf5ee('0x5f')]['authentication']){_0x2c2b5b[_0xf5ee('0x65')]={'user':_0x2fed9a[_0xf5ee('0x5f')][_0xf5ee('0x66')],'pass':_0x2fed9a['Smtp'][_0xf5ee('0x67')]};}}else{_0x2c2b5b['service']=_0x2fed9a['Smtp'][_0xf5ee('0x61')];_0x2c2b5b['auth']={'user':_0x2fed9a[_0xf5ee('0x5f')][_0xf5ee('0x66')],'pass':_0x2fed9a[_0xf5ee('0x5f')][_0xf5ee('0x67')]};_0x2c2b5b['secure']=_0x2fed9a[_0xf5ee('0x5f')][_0xf5ee('0x64')];}if(_0x10a56d[_0xf5ee('0x4f')][_0xf5ee('0x68')]&&_0x10a56d['body']['attachments']['length']){for(var _0x18990c=0x0;_0x18990c<_0x10a56d[_0xf5ee('0x4f')]['attachments'][_0xf5ee('0x3b')];_0x18990c+=0x1){_0x10a56d[_0xf5ee('0x4f')]['attachments'][_0x18990c]={'filename':_0x10a56d[_0xf5ee('0x4f')][_0xf5ee('0x68')][_0x18990c]['name'],'path':path['join'](config[_0xf5ee('0x69')],_0xf5ee('0x6a'),_0x10a56d['body'][_0xf5ee('0x68')][_0x18990c]['basename'])};}}_0x20da75={'account':_0x2c2b5b,'message':_0x10a56d['body']};return;}})[_0xf5ee('0x17')](function(){if(_0x2fed9a[_0xf5ee('0x5a')]){if(_0x2fed9a[_0xf5ee('0x5a')][_0xf5ee('0x5c')][_0xf5ee('0x3b')]){return _0x2fed9a['List']['Contacts'][0x0];}else{return db[_0xf5ee('0x5b')][_0xf5ee('0x51')](_[_0xf5ee('0xd')](_0x10a56d[_0xf5ee('0x4f')],{'firstName':_0x10a56d[_0xf5ee('0x4f')]['to'],'email':_0x10a56d[_0xf5ee('0x4f')]['to'],'phone':_0x10a56d['body']['to'],'ListId':_0x2fed9a[_0xf5ee('0x6b')]}));}}else{throw new Error('List\x20not\x20found');}})[_0xf5ee('0x17')](function(){if(_0x20da75){return respondWithRpcPromise(_0xf5ee('0x6c'),_0xf5ee('0x6d'),_0x20da75,client9003)[_0xf5ee('0x17')](function(_0x3ea305){return _0x10e3e2[_0xf5ee('0x2a')]({'read':!![],'messageId':_0x3ea305[_0xf5ee('0x6e')],'sentAt':moment()['format'](_0xf5ee('0x6f'))});})[_0xf5ee('0x21')](function(_0x5e91aa){logger[_0xf5ee('0x1c')]('%s',JSON[_0xf5ee('0x1b')](_0x5e91aa));return _0x10e3e2;});}return _0x10e3e2;});}return _0x10e3e2;}})[_0xf5ee('0x17')](respondWithResult(_0x54cda2,0xc9))['catch'](handleError(_0x54cda2,null));};exports['accept']=function(_0x5bcb4f,_0x453433){var _0xcf5ec4={'agent':{},'channel':_0xf5ee('0x70')};if(_0x5bcb4f[_0xf5ee('0x4f')]['id']){delete _0x5bcb4f[_0xf5ee('0x4f')]['id'];}_0x5bcb4f[_0xf5ee('0x4f')][_0xf5ee('0x71')]=!![];_0x5bcb4f[_0xf5ee('0x4f')][_0xf5ee('0x72')]=moment()[_0xf5ee('0x73')](_0xf5ee('0x6f'));_0x5bcb4f[_0xf5ee('0x4f')][_0xf5ee('0x74')]=_0x5bcb4f[_0xf5ee('0x4f')]['UserId']||_0x5bcb4f[_0xf5ee('0x66')]['id'];_0xcf5ec4[_0xf5ee('0x75')]['id']=_0x5bcb4f[_0xf5ee('0x4f')]['UserId'];return db[_0xf5ee('0x45')][_0xf5ee('0x4e')]({'where':{'id':_0x5bcb4f[_0xf5ee('0x4a')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x453433,null))[_0xf5ee('0x17')](saveUpdates(_0x5bcb4f[_0xf5ee('0x4f')],null))['then'](function(_0x26a7d9){if(_0x26a7d9){_0xcf5ec4[_0xf5ee('0x1e')]=_0x26a7d9[_0xf5ee('0x76')]({'plain':!![]});return db[_0xf5ee('0x77')][_0xf5ee('0x4e')]({'where':{'id':_0x26a7d9[_0xf5ee('0x78')]}});}return null;})[_0xf5ee('0x17')](handleEntityNotFound(_0x453433,null))[_0xf5ee('0x17')](function(_0x4a7cc7){if(_0x4a7cc7){return _0x4a7cc7[_0xf5ee('0x2a')]({'UserId':_0x5bcb4f[_0xf5ee('0x4f')][_0xf5ee('0x74')],'read1stAt':_[_0xf5ee('0x60')](_0x4a7cc7[_0xf5ee('0x79')])?moment()[_0xf5ee('0x73')](_0xf5ee('0x6f')):undefined});}return null;})[_0xf5ee('0x17')](function(_0x3385fd){if(_0x3385fd){_0xcf5ec4[_0xf5ee('0x7a')]=_0x3385fd[_0xf5ee('0x76')]({'plain':!![]});interaction_log[_0xf5ee('0x1f')](_0xf5ee('0x7b'),_0x5bcb4f['user']['id'],_0x5bcb4f[_0xf5ee('0x66')][_0xf5ee('0x2f')],_0x5bcb4f[_0xf5ee('0x66')][_0xf5ee('0x7c')],_0xcf5ec4[_0xf5ee('0x7a')]['id'],_0x5bcb4f[_0xf5ee('0x4f')]?JSON[_0xf5ee('0x1b')](_0x5bcb4f[_0xf5ee('0x4f')]):'null');return respondWithRpcPromise(_0xf5ee('0x7d'),_0xf5ee('0x7e'),_0xcf5ec4);}return null;})[_0xf5ee('0x17')](function(_0xe9d7eb){var _0x51bc5f=_0xf5ee('0x7f')+_0xe9d7eb[_0xf5ee('0x1e')][_0xf5ee('0x80')];return db[_0xf5ee('0x81')][_0xf5ee('0x36')](_0x51bc5f,{'type':db[_0xf5ee('0x82')]['QueryTypes'][_0xf5ee('0x83')],'raw':!![]})[_0xf5ee('0x17')](function(_0x56ca9b){return _0x56ca9b;});})['then'](function(_0x2acb6f){if(_0x2acb6f){_0xcf5ec4['message'][_0xf5ee('0x84')]=_0x2acb6f[0x0];if(!_0x5bcb4f['body'][_0xf5ee('0x74')])return;return db[_0xf5ee('0x85')][_0xf5ee('0x4e')]({'where':{'id':_0x5bcb4f[_0xf5ee('0x4f')][_0xf5ee('0x74')],'role':_0xf5ee('0x75')},'attributes':['id','name','fullname',_0xf5ee('0x86'),_0xf5ee('0x87')],'raw':!![]});}return null;})['then'](function(_0x440167){if(!_0x440167)return null;_0xcf5ec4['message'][_0xf5ee('0x75')]=_0x440167;return _0xcf5ec4;})[_0xf5ee('0x17')](function(_0x258ec7){if(_0x258ec7){if(_0x5bcb4f[_0xf5ee('0x4f')][_0xf5ee('0x88')]){_0xcf5ec4[_0xf5ee('0x1e')][_0xf5ee('0x89')]=util[_0xf5ee('0x73')](_0xf5ee('0x8a'),_0x5bcb4f['user'][_0xf5ee('0x2f')]);_0xcf5ec4['message'][_0xf5ee('0x8b')]=_0xcf5ec4[_0xf5ee('0x8b')];_0xcf5ec4['message'][_0xf5ee('0x8c')]=_0xcf5ec4['channel'];_0xcf5ec4['message'][_0xf5ee('0x8d')]=_0xf5ee('0x8e');_0xcf5ec4[_0xf5ee('0x1e')][_0xf5ee('0x4f')]=htmlToText[_0xf5ee('0x8f')](_0xcf5ec4['message'][_0xf5ee('0x4f')]);return respondWithRpcPromise('EventManager','EventManager',{'event':'acceptmessage','message':_0xcf5ec4[_0xf5ee('0x1e')]},client9002)['then'](function(){return _0xcf5ec4;});}return _0xcf5ec4;}return null;})[_0xf5ee('0x17')](respondWithResult(_0x453433,null))[_0xf5ee('0x21')](handleError(_0x453433,null));};exports[_0xf5ee('0x90')]=function(_0x596e24,_0x2afc3c){var _0x44db57={'agent':{},'channel':_0xf5ee('0x70')};if(_0x596e24[_0xf5ee('0x4f')]['id']){delete _0x596e24['body']['id'];}_0x596e24[_0xf5ee('0x4f')][_0xf5ee('0x74')]=_0x596e24['body'][_0xf5ee('0x74')]||_0x596e24[_0xf5ee('0x66')]['id'];_0x44db57[_0xf5ee('0x75')]['id']=_0x596e24['body'][_0xf5ee('0x74')];return db[_0xf5ee('0x45')][_0xf5ee('0x4e')]({'where':{'id':_0x596e24[_0xf5ee('0x4a')]['id'],'UserId':null}})[_0xf5ee('0x17')](handleEntityNotFound(_0x2afc3c,null))['then'](function(_0x287bee){if(_0x287bee){_0x44db57[_0xf5ee('0x1e')]=_0x287bee[_0xf5ee('0x76')]({'plain':!![]});return db[_0xf5ee('0x77')][_0xf5ee('0x4e')]({'where':{'id':_0x287bee['MailInteractionId']}});}return null;})[_0xf5ee('0x17')](handleEntityNotFound(_0x2afc3c,null))['then'](function(_0x30fe18){if(_0x30fe18){_0x44db57[_0xf5ee('0x7a')]=_0x30fe18[_0xf5ee('0x76')]({'plain':!![]});interaction_log[_0xf5ee('0x1f')](_0xf5ee('0x91'),_0x596e24[_0xf5ee('0x66')]['id'],_0x596e24[_0xf5ee('0x66')]['name'],_0x596e24[_0xf5ee('0x66')][_0xf5ee('0x7c')],_0x44db57[_0xf5ee('0x7a')]['id'],_0x596e24['body']?JSON['stringify'](_0x596e24['body']):_0xf5ee('0x92'));return respondWithRpcPromise(_0xf5ee('0x93'),_0xf5ee('0x94'),_0x44db57);}return null;})[_0xf5ee('0x17')](function(_0x28765c){var _0x412479=_0xf5ee('0x7f')+_0x28765c[_0xf5ee('0x1e')][_0xf5ee('0x80')];return db[_0xf5ee('0x81')]['query'](_0x412479,{'type':db[_0xf5ee('0x82')][_0xf5ee('0x95')]['SELECT'],'raw':!![]})[_0xf5ee('0x17')](function(_0x141cf1){return _0x141cf1;});})['then'](function(_0x13b01b){if(_0x13b01b){_0x44db57[_0xf5ee('0x1e')][_0xf5ee('0x84')]=_0x13b01b[0x0];if(!_0x596e24[_0xf5ee('0x4f')][_0xf5ee('0x74')])return;return db[_0xf5ee('0x85')][_0xf5ee('0x4e')]({'where':{'id':_0x596e24['body'][_0xf5ee('0x74')],'role':_0xf5ee('0x75')},'attributes':['id','name',_0xf5ee('0x96'),_0xf5ee('0x86'),_0xf5ee('0x87')],'raw':!![]});}return null;})[_0xf5ee('0x17')](function(_0x262ded){if(!_0x262ded)return null;_0x44db57[_0xf5ee('0x1e')][_0xf5ee('0x75')]=_0x262ded;return _0x44db57;})[_0xf5ee('0x17')](function(_0x3dfac8){if(_0x3dfac8){_0x3dfac8[_0xf5ee('0x1e')][_0xf5ee('0x89')]=util[_0xf5ee('0x73')](_0xf5ee('0x8a'),_0x596e24[_0xf5ee('0x66')][_0xf5ee('0x2f')]);_0x3dfac8[_0xf5ee('0x1e')][_0xf5ee('0x8b')]=_0x44db57[_0xf5ee('0x8b')];_0x3dfac8[_0xf5ee('0x1e')][_0xf5ee('0x8c')]=_0x44db57[_0xf5ee('0x8b')];_0x3dfac8[_0xf5ee('0x1e')][_0xf5ee('0x8d')]=_0xf5ee('0x90');_0x3dfac8[_0xf5ee('0x1e')]['body']=htmlToText[_0xf5ee('0x8f')](_0x44db57[_0xf5ee('0x1e')][_0xf5ee('0x4f')]);respondWithRpcPromise(_0xf5ee('0x97'),'EventManager',{'event':'rejectmessage','message':_0x3dfac8['message']},client9002);return _0x44db57;}return null;})[_0xf5ee('0x17')](respondWithResult(_0x2afc3c,null))['catch'](handleError(_0x2afc3c,null));};exports['download']=function(_0x42530,_0x43e562){var _0x4bfe6a=moment()[_0xf5ee('0x98')]()[_0xf5ee('0x99')]();var _0x53835c=path[_0xf5ee('0x9a')](config[_0xf5ee('0x69')],'server',_0xf5ee('0x9b'),_0xf5ee('0x9c'));var _0x2d3e5b=path[_0xf5ee('0x9a')](config[_0xf5ee('0x69')],'server',_0xf5ee('0x9b'),_0xf5ee('0x68'));var _0x486118=util[_0xf5ee('0x73')](_0xf5ee('0x9d'),_0x4bfe6a);return db[_0xf5ee('0x45')]['find']({'where':{'id':_0x42530[_0xf5ee('0x4a')]['id']},'attributes':['id','body',_0xf5ee('0x9e'),'to','cc',_0xf5ee('0x9f'),_0xf5ee('0xa0'),_0xf5ee('0xa1')],'include':_0x42530[_0xf5ee('0x36')][_0xf5ee('0x68')]?[{'model':db[_0xf5ee('0xa2')],'as':_0xf5ee('0xa3')}]:undefined})[_0xf5ee('0x17')](handleEntityNotFound(_0x43e562,null))[_0xf5ee('0x17')](function(_0x3f68e8){if(_0x3f68e8){var _0xfc7c13=_0x3f68e8;var _0x34fb9d={'from':_0xfc7c13['from'],'to':_0xfc7c13['to'],'subject':_0xfc7c13[_0xf5ee('0xa0')],'html':htmlEntities[_0xf5ee('0xa4')](_0xfc7c13[_0xf5ee('0x4f')]),'headers':{'Date':moment(_0xfc7c13['createdAt'])['format'](_0xf5ee('0xa5'))},'attachments':[]};if(_0x3f68e8['cc']){_0x34fb9d['headers']['Cc']=_0x3f68e8['cc'];}if(_0x3f68e8[_0xf5ee('0x9f')]){_0x34fb9d[_0xf5ee('0xa6')][_0xf5ee('0xa7')]=_0x3f68e8[_0xf5ee('0x9f')];}return new BPromise(function(_0x590086,_0x20e6a0){if(_0x3f68e8[_0xf5ee('0xa3')]){for(var _0x21fd0d=0x0;_0x21fd0d<_0x3f68e8[_0xf5ee('0xa3')][_0xf5ee('0x3b')];_0x21fd0d++){var _0x291ee7=_0x3f68e8[_0xf5ee('0xa3')][_0x21fd0d];var _0x216308=path[_0xf5ee('0x9a')](_0x2d3e5b,_0x291ee7[_0xf5ee('0xa8')]);if(fs[_0xf5ee('0xa9')](_0x216308)){_0x34fb9d[_0xf5ee('0x68')][_0xf5ee('0xaa')]({'name':_0x291ee7['name'],'contentType':_0x291ee7[_0xf5ee('0x33')],'data':fs[_0xf5ee('0xab')](_0x216308)});}}}emlformat[_0xf5ee('0xac')](_0x34fb9d,function(_0x2286df,_0x5b28a5){if(_0x2286df)return _0x20e6a0(_0x2286df);fs[_0xf5ee('0xad')](path[_0xf5ee('0x9a')](_0x53835c,_0x486118),_0x5b28a5);return _0x590086(_0x5b28a5);});});}})[_0xf5ee('0x17')](function(_0x44682e){if(_0x44682e){return _0x43e562[_0xf5ee('0xae')](path[_0xf5ee('0x9a')](_0x53835c,_0x486118),_0x486118,function(_0x5ec47c){if(!_0x5ec47c)fs[_0xf5ee('0xaf')](path['join'](_0x53835c,_0x486118));});}})['catch'](handleError(_0x43e562,null));}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.events.js b/server/api/mailMessage/mailMessage.events.js index 5ba6bb3..34f802c 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 _0x59a1=['setMaxListeners','save','update','remove','emit','hook','events','../../mysqldb','MailMessage'];(function(_0x1ff38b,_0x3c7306){var _0x4d19dd=function(_0xaef1ae){while(--_0xaef1ae){_0x1ff38b['push'](_0x1ff38b['shift']());}};_0x4d19dd(++_0x3c7306);}(_0x59a1,0x84));var _0x159a=function(_0x43591b,_0x2a6dee){_0x43591b=_0x43591b-0x0;var _0x2c6b68=_0x59a1[_0x43591b];return _0x2c6b68;};'use strict';var EventEmitter=require(_0x159a('0x0'));var MailMessage=require(_0x159a('0x1'))['db'][_0x159a('0x2')];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0x159a('0x3')](0x0);var events={'afterCreate':_0x159a('0x4'),'afterUpdate':_0x159a('0x5'),'afterDestroy':_0x159a('0x6')};function emitEvent(_0x1505ac){return function(_0x193dad,_0x292c07,_0x28b68d){MailMessageEvents[_0x159a('0x7')](_0x1505ac+':'+_0x193dad['id'],_0x193dad);MailMessageEvents[_0x159a('0x7')](_0x1505ac,_0x193dad);_0x28b68d(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailMessage[_0x159a('0x8')](e,emitEvent(event));}}module['exports']=MailMessageEvents; \ No newline at end of file +var _0x32dc=['MailMessage','setMaxListeners','update','remove','emit','hasOwnProperty','hook','events'];(function(_0x3e748d,_0x271178){var _0x3e87b5=function(_0x46dc23){while(--_0x46dc23){_0x3e748d['push'](_0x3e748d['shift']());}};_0x3e87b5(++_0x271178);}(_0x32dc,0x1b7));var _0xc32d=function(_0x1035c1,_0x2d8583){_0x1035c1=_0x1035c1-0x0;var _0x308d67=_0x32dc[_0x1035c1];return _0x308d67;};'use strict';var EventEmitter=require(_0xc32d('0x0'));var MailMessage=require('../../mysqldb')['db'][_0xc32d('0x1')];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0xc32d('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xc32d('0x3'),'afterDestroy':_0xc32d('0x4')};function emitEvent(_0x24dec0){return function(_0x1ec592,_0x290d00,_0x2208cc){MailMessageEvents[_0xc32d('0x5')](_0x24dec0+':'+_0x1ec592['id'],_0x1ec592);MailMessageEvents[_0xc32d('0x5')](_0x24dec0,_0x1ec592);_0x2208cc(null);};}for(var e in events){if(events[_0xc32d('0x6')](e)){var event=events[e];MailMessage[_0xc32d('0x7')](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 fda073a..4229c4f 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 _0xa382=['update','createdAt','catch','error','utf8mb4','utf8mb4_unicode_ci','../../config/logger','api','request-promise','path','rimraf','./mailMessage.attributes','exports','define','MailMessage','mail_messages','messageId','plainBody','FULLTEXT','body','get','direction','toLowerCase','out','isNil','UserId','MailInteraction','MailInteractionId','then'];(function(_0x183dbb,_0x250e41){var _0xff465=function(_0x550a62){while(--_0x550a62){_0x183dbb['push'](_0x183dbb['shift']());}};_0xff465(++_0x250e41);}(_0xa382,0xb4));var _0x2a38=function(_0x12fc8d,_0x19ee33){_0x12fc8d=_0x12fc8d-0x0;var _0x3f9d04=_0xa382[_0x12fc8d];return _0x3f9d04;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x2a38('0x0'))(_0x2a38('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x2a38('0x2'));var htmlToText=require('html-to-text');var fs=require('fs');var path=require(_0x2a38('0x3'));var rimraf=require(_0x2a38('0x4'));var config=require('../../config/environment');var attributes=require(_0x2a38('0x5'));module[_0x2a38('0x6')]=function(_0x4b1e2b,_0x124249){return _0x4b1e2b[_0x2a38('0x7')](_0x2a38('0x8'),attributes,{'tableName':_0x2a38('0x9'),'paranoid':![],'indexes':[{'name':_0x2a38('0xa'),'fields':[_0x2a38('0xa')]},{'name':'fti_mail_messages','fields':[_0x2a38('0xb'),'subject'],'type':_0x2a38('0xc')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x129458,_0x2fa3f1,_0x492768){if(_0x129458[_0x2a38('0xd')]){_0x129458[_0x2a38('0xb')]=htmlToText['fromString'](_0x129458['body'],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x492768(null,_0x2fa3f1);},'afterCreate':function(_0x5473f6,_0x5eec46,_0x376b65){var _0x24e6b2=_0x4b1e2b['models'];var _0x23da61=_0x5473f6[_0x2a38('0xe')]({'plain':!![]});if(_0x23da61[_0x2a38('0xf')]['toLowerCase']()==='in'||_0x23da61[_0x2a38('0xf')][_0x2a38('0x10')]()===_0x2a38('0x11')&&!_0x23da61['secret']&&!_[_0x2a38('0x12')](_0x23da61[_0x2a38('0x13')])){_0x24e6b2[_0x2a38('0x14')]['findOne']({'where':{'id':_0x23da61[_0x2a38('0x15')]}})[_0x2a38('0x16')](function(_0x4cfbbd){if(_0x4cfbbd){_0x4cfbbd[_0x2a38('0x17')]({'lastMsgAt':_0x23da61[_0x2a38('0x18')],'lastMsgDirection':_0x23da61[_0x2a38('0xf')]['toLowerCase']()});}})[_0x2a38('0x19')](function(_0x29204f){console[_0x2a38('0x1a')](_0x29204f);});}_0x376b65();}},'charset':_0x2a38('0x1b'),'collate':_0x2a38('0x1c')});}; \ No newline at end of file +var _0xe26e=['rimraf','../../config/environment','./mailMessage.attributes','exports','define','MailMessage','messageId','fti_mail_messages','plainBody','subject','FULLTEXT','body','fromString','get','direction','toLowerCase','UserId','MailInteraction','findOne','then','update','catch','error','utf8mb4','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x17781b,_0x1a2fa8){var _0x324137=function(_0x376b85){while(--_0x376b85){_0x17781b['push'](_0x17781b['shift']());}};_0x324137(++_0x1a2fa8);}(_0xe26e,0xb3));var _0xee26=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0xe26e[_0x57b54c];return _0x59cc19;};'use strict';var _=require('lodash');var util=require(_0xee26('0x0'));var logger=require(_0xee26('0x1'))(_0xee26('0x2'));var moment=require(_0xee26('0x3'));var BPromise=require(_0xee26('0x4'));var rp=require(_0xee26('0x5'));var htmlToText=require('html-to-text');var fs=require('fs');var path=require(_0xee26('0x6'));var rimraf=require(_0xee26('0x7'));var config=require(_0xee26('0x8'));var attributes=require(_0xee26('0x9'));module[_0xee26('0xa')]=function(_0x1a8646,_0x10676b){return _0x1a8646[_0xee26('0xb')](_0xee26('0xc'),attributes,{'tableName':'mail_messages','paranoid':![],'indexes':[{'name':_0xee26('0xd'),'fields':[_0xee26('0xd')]},{'name':_0xee26('0xe'),'fields':[_0xee26('0xf'),_0xee26('0x10')],'type':_0xee26('0x11')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x4a8328,_0x142c93,_0x2236a7){if(_0x4a8328[_0xee26('0x12')]){_0x4a8328[_0xee26('0xf')]=htmlToText[_0xee26('0x13')](_0x4a8328['body'],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x2236a7(null,_0x142c93);},'afterCreate':function(_0x2a3fd6,_0x1e908c,_0x5ab449){var _0x7e28d2=_0x1a8646['models'];var _0x21e932=_0x2a3fd6[_0xee26('0x14')]({'plain':!![]});if(_0x21e932[_0xee26('0x15')][_0xee26('0x16')]()==='in'||_0x21e932[_0xee26('0x15')][_0xee26('0x16')]()==='out'&&!_0x21e932['secret']&&!_['isNil'](_0x21e932[_0xee26('0x17')])){_0x7e28d2[_0xee26('0x18')][_0xee26('0x19')]({'where':{'id':_0x21e932['MailInteractionId']}})[_0xee26('0x1a')](function(_0x1a48f5){if(_0x1a48f5){_0x1a48f5[_0xee26('0x1b')]({'lastMsgAt':_0x21e932['createdAt'],'lastMsgDirection':_0x21e932[_0xee26('0x15')]['toLowerCase']()});}})[_0xee26('0x1c')](function(_0x10db2c){console[_0xee26('0x1d')](_0x10db2c);});}_0x5ab449();}},'charset':_0xee26('0x1e'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.rpc.js b/server/api/mailMessage/mailMessage.rpc.js index 2cb51cb..6028a28 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 _0x8f4c=['body','options','raw','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','defaults','localhost','socket.io-emitter','redis','./mailMessage.socket','register','then','info','MailMessage,\x20%s,\x20%s','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateMailMessage','MailMessage','create'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x8f4c,0x113));var _0xc8f4=function(_0x4f4fb9,_0x3798bc){_0x4f4fb9=_0x4f4fb9-0x0;var _0x1d9828=_0x8f4c[_0x4f4fb9];return _0x1d9828;};'use strict';var _=require(_0xc8f4('0x0'));var util=require(_0xc8f4('0x1'));var moment=require(_0xc8f4('0x2'));var BPromise=require(_0xc8f4('0x3'));var rs=require(_0xc8f4('0x4'));var fs=require('fs');var Redis=require(_0xc8f4('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xc8f4('0x6'));var logger=require(_0xc8f4('0x7'))(_0xc8f4('0x8'));var config=require('../../config/environment');var jayson=require(_0xc8f4('0x9'));var client=jayson['client']['http']({'port':0x232a});config['redis']=_[_0xc8f4('0xa')](config['redis'],{'host':_0xc8f4('0xb'),'port':0x18eb});var socket=require(_0xc8f4('0xc'))(new Redis(config[_0xc8f4('0xd')]));require(_0xc8f4('0xe'))[_0xc8f4('0xf')](socket);function respondWithRpcPromise(_0x599de3,_0x38c41b,_0x191b92){return new BPromise(function(_0x2fba62,_0x3a2f8a){return client['request'](_0x599de3,_0x191b92)[_0xc8f4('0x10')](function(_0x52c699){logger[_0xc8f4('0x11')](_0xc8f4('0x12'),_0x38c41b,_0xc8f4('0x13'));logger[_0xc8f4('0x14')](_0xc8f4('0x15'),_0x38c41b,'request\x20sent',JSON[_0xc8f4('0x16')](_0x52c699));if(_0x52c699[_0xc8f4('0x17')]){if(_0x52c699[_0xc8f4('0x17')][_0xc8f4('0x18')]===0x1f4){logger[_0xc8f4('0x17')](_0xc8f4('0x12'),_0x38c41b,_0x52c699['error'][_0xc8f4('0x19')]);return _0x3a2f8a(_0x52c699[_0xc8f4('0x17')][_0xc8f4('0x19')]);}logger[_0xc8f4('0x17')](_0xc8f4('0x12'),_0x38c41b,_0x52c699['error'][_0xc8f4('0x19')]);return _0x2fba62(_0x52c699['error']['message']);}else{logger[_0xc8f4('0x11')](_0xc8f4('0x12'),_0x38c41b,_0xc8f4('0x13'));_0x2fba62(_0x52c699[_0xc8f4('0x1a')][_0xc8f4('0x19')]);}})[_0xc8f4('0x1b')](function(_0x2459ac){logger[_0xc8f4('0x17')](_0xc8f4('0x12'),_0x38c41b,_0x2459ac);_0x3a2f8a(_0x2459ac);});});}exports[_0xc8f4('0x1c')]=function(_0x3cd90c){var _0x3126e5=this;return new Promise(function(_0x22236c,_0x5f3264){return db[_0xc8f4('0x1d')][_0xc8f4('0x1e')](_0x3cd90c[_0xc8f4('0x1f')],{'raw':_0x3cd90c[_0xc8f4('0x20')]?_0x3cd90c[_0xc8f4('0x20')][_0xc8f4('0x21')]===undefined?!![]:![]:!![]})[_0xc8f4('0x10')](function(_0x43eb57){logger['info'](_0xc8f4('0x1c'),_0x3cd90c);logger[_0xc8f4('0x14')](_0xc8f4('0x1c'),_0x3cd90c,JSON[_0xc8f4('0x16')](_0x43eb57));_0x22236c(_0x43eb57);})['catch'](function(_0x39174f){logger['error'](_0xc8f4('0x1c'),_0x39174f['message'],_0x3cd90c);_0x5f3264(_0x3126e5[_0xc8f4('0x17')](0x1f4,_0x39174f[_0xc8f4('0x19')]));});});}; \ No newline at end of file +var _0xd4a2=['bluebird','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./mailMessage.socket','register','MailMessage,\x20%s,\x20%s','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','CreateMailMessage','create','body','options','raw','then','catch','lodash'];(function(_0x503b3b,_0x4d6f5d){var _0x12651b=function(_0x312e74){while(--_0x312e74){_0x503b3b['push'](_0x503b3b['shift']());}};_0x12651b(++_0x4d6f5d);}(_0xd4a2,0x173));var _0x2d4a=function(_0x284ea8,_0x1f0fe9){_0x284ea8=_0x284ea8-0x0;var _0x223297=_0xd4a2[_0x284ea8];return _0x223297;};'use strict';var _=require(_0x2d4a('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x2d4a('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2d4a('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x2d4a('0x3'));var logger=require('../../config/logger')(_0x2d4a('0x4'));var config=require(_0x2d4a('0x5'));var jayson=require(_0x2d4a('0x6'));var client=jayson[_0x2d4a('0x7')][_0x2d4a('0x8')]({'port':0x232a});config['redis']=_[_0x2d4a('0x9')](config[_0x2d4a('0xa')],{'host':_0x2d4a('0xb'),'port':0x18eb});var socket=require(_0x2d4a('0xc'))(new Redis(config[_0x2d4a('0xa')]));require(_0x2d4a('0xd'))[_0x2d4a('0xe')](socket);function respondWithRpcPromise(_0x113839,_0x33b786,_0x4738dc){return new BPromise(function(_0x3abbbd,_0xce6af6){return client['request'](_0x113839,_0x4738dc)['then'](function(_0x4002de){logger['info'](_0x2d4a('0xf'),_0x33b786,_0x2d4a('0x10'));logger[_0x2d4a('0x11')](_0x2d4a('0x12'),_0x33b786,_0x2d4a('0x10'),JSON[_0x2d4a('0x13')](_0x4002de));if(_0x4002de[_0x2d4a('0x14')]){if(_0x4002de[_0x2d4a('0x14')]['code']===0x1f4){logger['error'](_0x2d4a('0xf'),_0x33b786,_0x4002de['error'][_0x2d4a('0x15')]);return _0xce6af6(_0x4002de[_0x2d4a('0x14')][_0x2d4a('0x15')]);}logger[_0x2d4a('0x14')]('MailMessage,\x20%s,\x20%s',_0x33b786,_0x4002de[_0x2d4a('0x14')]['message']);return _0x3abbbd(_0x4002de[_0x2d4a('0x14')]['message']);}else{logger[_0x2d4a('0x16')](_0x2d4a('0xf'),_0x33b786,_0x2d4a('0x10'));_0x3abbbd(_0x4002de[_0x2d4a('0x17')]['message']);}})['catch'](function(_0x5ac74b){logger[_0x2d4a('0x14')](_0x2d4a('0xf'),_0x33b786,_0x5ac74b);_0xce6af6(_0x5ac74b);});});}exports[_0x2d4a('0x18')]=function(_0x419df5){var _0x46c331=this;return new Promise(function(_0x2e4069,_0x56445a){return db['MailMessage'][_0x2d4a('0x19')](_0x419df5[_0x2d4a('0x1a')],{'raw':_0x419df5[_0x2d4a('0x1b')]?_0x419df5[_0x2d4a('0x1b')][_0x2d4a('0x1c')]===undefined?!![]:![]:!![]})[_0x2d4a('0x1d')](function(_0x22dd0b){logger[_0x2d4a('0x16')]('CreateMailMessage',_0x419df5);logger[_0x2d4a('0x11')](_0x2d4a('0x18'),_0x419df5,JSON[_0x2d4a('0x13')](_0x22dd0b));_0x2e4069(_0x22dd0b);})[_0x2d4a('0x1e')](function(_0x2c845c){logger[_0x2d4a('0x14')](_0x2d4a('0x18'),_0x2c845c[_0x2d4a('0x15')],_0x419df5);_0x56445a(_0x46c331['error'](0x1f4,_0x2c845c['message']));});});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.socket.js b/server/api/mailMessage/mailMessage.socket.js index f69978e..bc35e56 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 _0xa39b=['length','save','remove','update','removeListener','register'];(function(_0x329738,_0x3c3d7e){var _0xe2ce46=function(_0x55548c){while(--_0x55548c){_0x329738['push'](_0x329738['shift']());}};_0xe2ce46(++_0x3c3d7e);}(_0xa39b,0x199));var _0xba39=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0xa39b[_0x4565bf];return _0x5610ba;};'use strict';var MailMessageEvents=require('./mailMessage.events');var events=[_0xba39('0x0'),_0xba39('0x1'),_0xba39('0x2')];function createListener(_0x5f50fa,_0x5a6c9c){return function(_0x54f8df){_0x5a6c9c['emit'](_0x5f50fa,_0x54f8df);};}function removeListener(_0x46c458,_0x25d3dd){return function(){MailMessageEvents[_0xba39('0x3')](_0x46c458,_0x25d3dd);};}exports[_0xba39('0x4')]=function(_0x19b11d){for(var _0x4dd750=0x0,_0x4721d5=events[_0xba39('0x5')];_0x4dd750<_0x4721d5;_0x4dd750++){var _0x3169a0=events[_0x4dd750];var _0xd4fb3e=createListener('mailMessage:'+_0x3169a0,_0x19b11d);MailMessageEvents['on'](_0x3169a0,_0xd4fb3e);}}; \ No newline at end of file +var _0xd859=['register','length','./mailMessage.events','save','remove','update','emit','removeListener'];(function(_0x1a309d,_0x201f52){var _0x1f7f0f=function(_0x425840){while(--_0x425840){_0x1a309d['push'](_0x1a309d['shift']());}};_0x1f7f0f(++_0x201f52);}(_0xd859,0x16a));var _0x9d85=function(_0x3bc158,_0x436e3a){_0x3bc158=_0x3bc158-0x0;var _0x977671=_0xd859[_0x3bc158];return _0x977671;};'use strict';var MailMessageEvents=require(_0x9d85('0x0'));var events=[_0x9d85('0x1'),_0x9d85('0x2'),_0x9d85('0x3')];function createListener(_0x448969,_0x33c831){return function(_0x1e3f09){_0x33c831[_0x9d85('0x4')](_0x448969,_0x1e3f09);};}function removeListener(_0x3f7ca9,_0x2adfd4){return function(){MailMessageEvents[_0x9d85('0x5')](_0x3f7ca9,_0x2adfd4);};}exports[_0x9d85('0x6')]=function(_0x2c0cc5){for(var _0xff7243=0x0,_0x5e3283=events[_0x9d85('0x7')];_0xff7243<_0x5e3283;_0xff7243++){var _0x18c657=events[_0xff7243];var _0x25e4c6=createListener('mailMessage:'+_0x18c657,_0x2c0cc5);MailMessageEvents['on'](_0x18c657,_0x25e4c6);}}; \ No newline at end of file diff --git a/server/api/mailQueue/index.js b/server/api/mailQueue/index.js index 9122fef..1b1a724 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 _0xedab=['getAgents','post','create','addTeams','addAgents','put','update','destroy','delete','removeTeams','exports','util','path','connect-timeout','express','fs-extra','../../components/auth/service','./mailQueue.controller','get','isAuthenticated','index','/describe','/:id','show','/:id/members','getMembers','/:id/teams','/:id/users'];(function(_0xaaba6a,_0x3d26d1){var _0x27f8bf=function(_0x3ad7d2){while(--_0x3ad7d2){_0xaaba6a['push'](_0xaaba6a['shift']());}};_0x27f8bf(++_0x3d26d1);}(_0xedab,0xcf));var _0xbeda=function(_0x212bf5,_0x165cbd){_0x212bf5=_0x212bf5-0x0;var _0xfcad21=_0xedab[_0x212bf5];return _0xfcad21;};'use strict';var multer=require('multer');var util=require(_0xbeda('0x0'));var path=require(_0xbeda('0x1'));var timeout=require(_0xbeda('0x2'));var express=require(_0xbeda('0x3'));var router=express['Router']();var fs_extra=require(_0xbeda('0x4'));var auth=require(_0xbeda('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xbeda('0x6'));router[_0xbeda('0x7')]('/',auth[_0xbeda('0x8')](),controller[_0xbeda('0x9')]);router[_0xbeda('0x7')](_0xbeda('0xa'),auth[_0xbeda('0x8')](),controller['describe']);router['get'](_0xbeda('0xb'),auth['isAuthenticated'](),controller[_0xbeda('0xc')]);router[_0xbeda('0x7')](_0xbeda('0xd'),auth['isAuthenticated'](),controller[_0xbeda('0xe')]);router[_0xbeda('0x7')](_0xbeda('0xf'),auth['isAuthenticated'](),controller['getTeams']);router[_0xbeda('0x7')](_0xbeda('0x10'),auth[_0xbeda('0x8')](),controller[_0xbeda('0x11')]);router[_0xbeda('0x12')]('/',auth[_0xbeda('0x8')](),controller[_0xbeda('0x13')]);router[_0xbeda('0x12')](_0xbeda('0xf'),auth[_0xbeda('0x8')](),controller[_0xbeda('0x14')]);router[_0xbeda('0x12')]('/:id/users',auth[_0xbeda('0x8')](),controller[_0xbeda('0x15')]);router[_0xbeda('0x16')](_0xbeda('0xb'),auth['isAuthenticated'](),controller[_0xbeda('0x17')]);router['delete'](_0xbeda('0xb'),auth[_0xbeda('0x8')](),controller[_0xbeda('0x18')]);router[_0xbeda('0x19')](_0xbeda('0xf'),auth[_0xbeda('0x8')](),controller[_0xbeda('0x1a')]);router[_0xbeda('0x19')](_0xbeda('0x10'),auth[_0xbeda('0x8')](),controller['removeAgents']);module[_0xbeda('0x1b')]=router; \ No newline at end of file +var _0x8f68=['/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','create','addAgents','put','delete','removeTeams','removeAgents','exports','multer','path','connect-timeout','fs-extra','../../components/auth/service','../../config/environment','./mailQueue.controller','isAuthenticated','/describe','describe','get','/:id','show'];(function(_0x2b0a86,_0x2ecebd){var _0x955940=function(_0x1988f8){while(--_0x1988f8){_0x2b0a86['push'](_0x2b0a86['shift']());}};_0x955940(++_0x2ecebd);}(_0x8f68,0x16d));var _0x88f6=function(_0x476809,_0x30476c){_0x476809=_0x476809-0x0;var _0x2b4dc6=_0x8f68[_0x476809];return _0x2b4dc6;};'use strict';var multer=require(_0x88f6('0x0'));var util=require('util');var path=require(_0x88f6('0x1'));var timeout=require(_0x88f6('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x88f6('0x3'));var auth=require(_0x88f6('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x88f6('0x5'));var controller=require(_0x88f6('0x6'));router['get']('/',auth[_0x88f6('0x7')](),controller['index']);router['get'](_0x88f6('0x8'),auth[_0x88f6('0x7')](),controller[_0x88f6('0x9')]);router[_0x88f6('0xa')](_0x88f6('0xb'),auth[_0x88f6('0x7')](),controller[_0x88f6('0xc')]);router[_0x88f6('0xa')](_0x88f6('0xd'),auth[_0x88f6('0x7')](),controller[_0x88f6('0xe')]);router[_0x88f6('0xa')](_0x88f6('0xf'),auth[_0x88f6('0x7')](),controller[_0x88f6('0x10')]);router[_0x88f6('0xa')](_0x88f6('0x11'),auth[_0x88f6('0x7')](),controller[_0x88f6('0x12')]);router[_0x88f6('0x13')]('/',auth[_0x88f6('0x7')](),controller[_0x88f6('0x14')]);router[_0x88f6('0x13')](_0x88f6('0xf'),auth[_0x88f6('0x7')](),controller['addTeams']);router[_0x88f6('0x13')](_0x88f6('0x11'),auth[_0x88f6('0x7')](),controller[_0x88f6('0x15')]);router[_0x88f6('0x16')](_0x88f6('0xb'),auth[_0x88f6('0x7')](),controller['update']);router[_0x88f6('0x17')](_0x88f6('0xb'),auth[_0x88f6('0x7')](),controller['destroy']);router['delete'](_0x88f6('0xf'),auth['isAuthenticated'](),controller[_0x88f6('0x18')]);router[_0x88f6('0x17')]('/:id/users',auth['isAuthenticated'](),controller[_0x88f6('0x19')]);module[_0x88f6('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 c791692..2f0849a 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 _0x68f1=['STRING','name','INTEGER','ENUM','roundrobin','exports'];(function(_0x12939d,_0x24971d){var _0x38f9ab=function(_0x23a8d5){while(--_0x23a8d5){_0x12939d['push'](_0x12939d['shift']());}};_0x38f9ab(++_0x24971d);}(_0x68f1,0x1f1));var _0x168f=function(_0x55035b,_0x3fa853){_0x55035b=_0x55035b-0x0;var _0x249da4=_0x68f1[_0x55035b];return _0x249da4;};'use strict';var Sequelize=require('sequelize');module[_0x168f('0x0')]={'name':{'type':Sequelize[_0x168f('0x1')],'unique':_0x168f('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x168f('0x1')]},'timeout':{'type':Sequelize[_0x168f('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x168f('0x4')]('rrmemory','beepall',_0x168f('0x5'))}}; \ No newline at end of file +var _0xb5ea=['sequelize','exports','STRING','INTEGER','ENUM','rrmemory','beepall','roundrobin'];(function(_0x510b21,_0x48ce75){var _0x157417=function(_0x4492ca){while(--_0x4492ca){_0x510b21['push'](_0x510b21['shift']());}};_0x157417(++_0x48ce75);}(_0xb5ea,0x80));var _0xab5e=function(_0x1ce575,_0xc8d9ae){_0x1ce575=_0x1ce575-0x0;var _0x9f2ffb=_0xb5ea[_0x1ce575];return _0x9f2ffb;};'use strict';var Sequelize=require(_0xab5e('0x0'));module[_0xab5e('0x1')]={'name':{'type':Sequelize['STRING'],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xab5e('0x2')]},'timeout':{'type':Sequelize[_0xab5e('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xab5e('0x4')](_0xab5e('0x5'),_0xab5e('0x6'),_0xab5e('0x7'))}}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.controller.js b/server/api/mailQueue/mailQueue.controller.js index 4b7ad84..ac0e25a 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 _0xef4c=['VIRTUAL','merge','count','includeAll','include','findAll','catch','show','params','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','MailQueues','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','findOne','UserMailQueue','pick','filter','User','UserId','agent','mailPause','updatedAt','createdAt','rows','format','%s/%s','Team','getTeams','addTeams','Agents','online','voicePause','interface','flatMap','transaction','each','emit','userMailQueue:save','removeTeams','ids','select','field','tq.TeamId','team_has_mail_queues','user_has_teams','MailQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','sequelize','SELECT','every','TeamId','includes','all','compact','value','isEmpty','removeAgents','forEach','userMailQueue:remove','addAgents','omit','spread','isArray','getAgents','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','fs-extra','squel','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','sendStatus','status','end','json','offset','undefined','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','UserProfileResource','error','stack','name','map','MailQueue','rawAttributes','fieldName','type','key','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','where'];(function(_0x4a3a62,_0x3cb88a){var _0x4fd23f=function(_0x11dec9){while(--_0x11dec9){_0x4a3a62['push'](_0x4a3a62['shift']());}};_0x4fd23f(++_0x3cb88a);}(_0xef4c,0xd5));var _0xcef4=function(_0x562022,_0x1a354f){_0x562022=_0x562022-0x0;var _0x22cb6b=_0xef4c[_0x562022];return _0x22cb6b;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xcef4('0x0'));var zipdir=require(_0xcef4('0x1'));var jsonpatch=require(_0xcef4('0x2'));var rp=require(_0xcef4('0x3'));var moment=require(_0xcef4('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xcef4('0x5'));var util=require(_0xcef4('0x6'));var path=require(_0xcef4('0x7'));var sox=require(_0xcef4('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xcef4('0x9'));var _=require('lodash');var squel=require(_0xcef4('0xa'));var crypto=require('crypto');var jsforce=require(_0xcef4('0xb'));var deskjs=require(_0xcef4('0xc'));var toCsv=require(_0xcef4('0xd'));var querystring=require('querystring');var Papa=require(_0xcef4('0xe'));var Redis=require(_0xcef4('0xf'));var authService=require(_0xcef4('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xcef4('0x11'));var hardwareService=require(_0xcef4('0x12'));var logger=require(_0xcef4('0x13'))(_0xcef4('0x14'));var utils=require(_0xcef4('0x15'));var config=require(_0xcef4('0x16'));var licenseUtil=require(_0xcef4('0x17'));var db=require(_0xcef4('0x18'))['db'];config[_0xcef4('0x19')]=_[_0xcef4('0x1a')](config[_0xcef4('0x19')],{'host':'localhost','port':0x18eb});var socket=require(_0xcef4('0x1b'))(new Redis(config[_0xcef4('0x19')]));require('./mailQueue.socket')['register'](socket);function respondWithStatusCode(_0x5efa16,_0x4cf4bb){_0x4cf4bb=_0x4cf4bb||0xcc;return function(_0x196ce5){if(_0x196ce5){return _0x5efa16[_0xcef4('0x1c')](_0x4cf4bb);}return _0x5efa16[_0xcef4('0x1d')](_0x4cf4bb)[_0xcef4('0x1e')]();};}function respondWithResult(_0x36b413,_0x309258){_0x309258=_0x309258||0xc8;return function(_0x514d0c){if(_0x514d0c){return _0x36b413[_0xcef4('0x1d')](_0x309258)[_0xcef4('0x1f')](_0x514d0c);}};}function respondWithFilteredResult(_0x16ad5f,_0x5814f1){return function(_0x554222){if(_0x554222){var _0x503b88=typeof _0x5814f1[_0xcef4('0x20')]===_0xcef4('0x21')&&typeof _0x5814f1[_0xcef4('0x22')]==='undefined';var _0x55bd55=_0x554222['count'];var _0x56fde6=_0x503b88?0x0:_0x5814f1[_0xcef4('0x20')];var _0x43d1b9=_0x503b88?_0x554222['count']:_0x5814f1[_0xcef4('0x20')]+_0x5814f1[_0xcef4('0x22')];var _0x4d3004;if(_0x43d1b9>=_0x55bd55){_0x43d1b9=_0x55bd55;_0x4d3004=0xc8;}else{_0x4d3004=0xce;}_0x16ad5f[_0xcef4('0x1d')](_0x4d3004);return _0x16ad5f[_0xcef4('0x23')](_0xcef4('0x24'),_0x56fde6+'-'+_0x43d1b9+'/'+_0x55bd55)[_0xcef4('0x1f')](_0x554222);}return null;};}function patchUpdates(_0x51181c){return function(_0x231f5e){try{jsonpatch[_0xcef4('0x25')](_0x231f5e,_0x51181c,!![]);}catch(_0x5228d7){return BPromise[_0xcef4('0x26')](_0x5228d7);}return _0x231f5e[_0xcef4('0x27')]();};}function saveUpdates(_0x59ea81,_0x2e5f3f){return function(_0x4cc841){if(_0x4cc841){return _0x4cc841[_0xcef4('0x28')](_0x59ea81)[_0xcef4('0x29')](function(_0x54e1cb){return _0x54e1cb;});}return null;};}function removeEntity(_0x748d65,_0x366c12){return function(_0x4073bd){if(_0x4073bd){return _0x4073bd[_0xcef4('0x2a')]()[_0xcef4('0x29')](function(){var _0x193001=_0x4073bd[_0xcef4('0x2b')]({'plain':!![]});var _0x100791='MailQueues';return db[_0xcef4('0x2c')][_0xcef4('0x2a')]({'where':{'type':_0x100791,'resourceId':_0x193001['id']}})[_0xcef4('0x29')](function(){return _0x4073bd;});})[_0xcef4('0x29')](function(){_0x748d65[_0xcef4('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3d24ea,_0x3e4fdc){return function(_0x3ea50c){if(!_0x3ea50c){_0x3d24ea[_0xcef4('0x1c')](0x194);}return _0x3ea50c;};}function handleError(_0x4382f5,_0x44c2fa){_0x44c2fa=_0x44c2fa||0x1f4;return function(_0x4f19f6){logger[_0xcef4('0x2d')](_0x4f19f6[_0xcef4('0x2e')]);if(_0x4f19f6[_0xcef4('0x2f')]){delete _0x4f19f6['name'];}_0x4382f5[_0xcef4('0x1d')](_0x44c2fa)['send'](_0x4f19f6);};}exports['index']=function(_0x268e42,_0x3da28f){var _0xfa72e1={},_0x11c6a9={},_0x297c92={'count':0x0,'rows':[]};var _0x42f1c0=_[_0xcef4('0x30')](db[_0xcef4('0x31')][_0xcef4('0x32')],function(_0x3fc4c2){return{'name':_0x3fc4c2[_0xcef4('0x33')],'type':_0x3fc4c2[_0xcef4('0x34')][_0xcef4('0x35')]};});_0x11c6a9[_0xcef4('0x36')]=_[_0xcef4('0x30')](_0x42f1c0,_0xcef4('0x2f'));_0x11c6a9['query']=_[_0xcef4('0x37')](_0x268e42[_0xcef4('0x38')]);_0x11c6a9['filters']=_[_0xcef4('0x39')](_0x11c6a9[_0xcef4('0x36')],_0x11c6a9[_0xcef4('0x38')]);_0xfa72e1[_0xcef4('0x3a')]=_[_0xcef4('0x39')](_0x11c6a9[_0xcef4('0x36')],qs[_0xcef4('0x3b')](_0x268e42[_0xcef4('0x38')]['fields']));_0xfa72e1['attributes']=_0xfa72e1[_0xcef4('0x3a')][_0xcef4('0x3c')]?_0xfa72e1[_0xcef4('0x3a')]:_0x11c6a9['model'];if(!_0x268e42[_0xcef4('0x38')][_0xcef4('0x3d')](_0xcef4('0x3e'))){_0xfa72e1[_0xcef4('0x22')]=qs[_0xcef4('0x22')](_0x268e42[_0xcef4('0x38')][_0xcef4('0x22')]);_0xfa72e1[_0xcef4('0x20')]=qs[_0xcef4('0x20')](_0x268e42[_0xcef4('0x38')][_0xcef4('0x20')]);}_0xfa72e1[_0xcef4('0x3f')]=qs[_0xcef4('0x40')](_0x268e42[_0xcef4('0x38')]['sort']);_0xfa72e1['where']=qs[_0xcef4('0x41')](_['pick'](_0x268e42['query'],_0x11c6a9[_0xcef4('0x41')]),_0x42f1c0);if(_0x268e42[_0xcef4('0x38')]['filter']){_0xfa72e1['where']=_['merge'](_0xfa72e1[_0xcef4('0x42')],{'$or':_[_0xcef4('0x30')](_0x42f1c0,function(_0x8d5c92){if(_0x8d5c92[_0xcef4('0x34')]!==_0xcef4('0x43')){var _0x295930={};_0x295930[_0x8d5c92[_0xcef4('0x2f')]]={'$like':'%'+_0x268e42['query']['filter']+'%'};return _0x295930;}})});}_0xfa72e1=_[_0xcef4('0x44')]({},_0xfa72e1,_0x268e42['options']);var _0x4d465f={'where':_0xfa72e1['where']};return db[_0xcef4('0x31')][_0xcef4('0x45')](_0x4d465f)[_0xcef4('0x29')](function(_0x16a281){_0x297c92[_0xcef4('0x45')]=_0x16a281;if(_0x268e42[_0xcef4('0x38')][_0xcef4('0x46')]){_0xfa72e1[_0xcef4('0x47')]=[{'all':!![]}];}return db[_0xcef4('0x31')][_0xcef4('0x48')](_0xfa72e1);})[_0xcef4('0x29')](function(_0x418a06){_0x297c92['rows']=_0x418a06;return _0x297c92;})[_0xcef4('0x29')](respondWithFilteredResult(_0x3da28f,_0xfa72e1))[_0xcef4('0x49')](handleError(_0x3da28f,null));};exports[_0xcef4('0x4a')]=function(_0x35fbea,_0x211610){var _0x334b37={'raw':!![],'where':{'id':_0x35fbea[_0xcef4('0x4b')]['id']}},_0x4677d5={};_0x4677d5[_0xcef4('0x36')]=_[_0xcef4('0x37')](db[_0xcef4('0x31')][_0xcef4('0x32')]);_0x4677d5[_0xcef4('0x38')]=_[_0xcef4('0x37')](_0x35fbea['query']);_0x4677d5['filters']=_[_0xcef4('0x39')](_0x4677d5[_0xcef4('0x36')],_0x4677d5[_0xcef4('0x38')]);_0x334b37['attributes']=_['intersection'](_0x4677d5[_0xcef4('0x36')],qs[_0xcef4('0x3b')](_0x35fbea[_0xcef4('0x38')][_0xcef4('0x3b')]));_0x334b37[_0xcef4('0x3a')]=_0x334b37['attributes'][_0xcef4('0x3c')]?_0x334b37[_0xcef4('0x3a')]:_0x4677d5[_0xcef4('0x36')];if(_0x35fbea[_0xcef4('0x38')][_0xcef4('0x46')]){_0x334b37[_0xcef4('0x47')]=[{'all':!![]}];}_0x334b37=_[_0xcef4('0x44')]({},_0x334b37,_0x35fbea[_0xcef4('0x4c')]);return db[_0xcef4('0x31')][_0xcef4('0x4d')](_0x334b37)[_0xcef4('0x29')](handleEntityNotFound(_0x211610,null))['then'](respondWithResult(_0x211610,null))[_0xcef4('0x49')](handleError(_0x211610,null));};exports[_0xcef4('0x4e')]=function(_0x36ae6d,_0x212b45){return db[_0xcef4('0x31')][_0xcef4('0x4e')](_0x36ae6d[_0xcef4('0x4f')],{})[_0xcef4('0x29')](function(_0x49a94e){var _0x54bb0e=_0x36ae6d[_0xcef4('0x50')][_0xcef4('0x2b')]({'plain':!![]});if(!_0x54bb0e)throw new Error(_0xcef4('0x51'));if(_0x54bb0e[_0xcef4('0x52')]===_0xcef4('0x50')){var _0x5133c3=_0x49a94e[_0xcef4('0x2b')]({'plain':!![]});var _0x556bc6=_0xcef4('0x53');return db['UserProfileSection'][_0xcef4('0x4d')]({'where':{'name':_0x556bc6,'userProfileId':_0x54bb0e[_0xcef4('0x54')]},'raw':!![]})['then'](function(_0x557cbd){if(_0x557cbd&&_0x557cbd[_0xcef4('0x55')]===0x0){return db['UserProfileResource']['create']({'name':_0x5133c3[_0xcef4('0x2f')],'resourceId':_0x5133c3['id'],'type':_0x557cbd[_0xcef4('0x2f')],'sectionId':_0x557cbd['id']},{})['then'](function(){return _0x49a94e;});}else{return _0x49a94e;}})[_0xcef4('0x49')](function(_0x325517){logger['error'](_0xcef4('0x56'),_0x325517);throw _0x325517;});}return _0x49a94e;})['then'](respondWithResult(_0x212b45,0xc9))['catch'](handleError(_0x212b45,null));};exports[_0xcef4('0x28')]=function(_0x82106,_0x5bcf16){if(_0x82106['body']['id']){delete _0x82106[_0xcef4('0x4f')]['id'];}return db[_0xcef4('0x31')][_0xcef4('0x4d')]({'where':{'id':_0x82106[_0xcef4('0x4b')]['id']}})[_0xcef4('0x29')](handleEntityNotFound(_0x5bcf16,null))['then'](saveUpdates(_0x82106[_0xcef4('0x4f')],null))[_0xcef4('0x29')](respondWithResult(_0x5bcf16,null))[_0xcef4('0x49')](handleError(_0x5bcf16,null));};exports[_0xcef4('0x2a')]=function(_0xd21ba6,_0x1a127f){return db[_0xcef4('0x31')][_0xcef4('0x4d')]({'where':{'id':_0xd21ba6[_0xcef4('0x4b')]['id']}})[_0xcef4('0x29')](handleEntityNotFound(_0x1a127f,null))[_0xcef4('0x29')](removeEntity(_0x1a127f,null))[_0xcef4('0x49')](handleError(_0x1a127f,null));};exports['describe']=function(_0x55adbb,_0xb7b3f6){return db[_0xcef4('0x31')]['describe']()[_0xcef4('0x29')](respondWithResult(_0xb7b3f6,null))[_0xcef4('0x49')](handleError(_0xb7b3f6,null));};exports['getMembers']=function(_0xa22e11,_0x2a8303,_0x1b647f){var _0x5a3379={'raw':!![],'where':{}},_0x22e3a9={},_0x3b74d3;return db['MailQueue'][_0xcef4('0x57')]({'where':{'id':_0xa22e11[_0xcef4('0x4b')]['id']}})[_0xcef4('0x29')](handleEntityNotFound(_0x2a8303,null))[_0xcef4('0x29')](function(_0x41d1ee){if(_0x41d1ee){_0x3b74d3=_0x41d1ee['get']({'plain':!![]});_0x22e3a9[_0xcef4('0x36')]=_[_0xcef4('0x37')](db[_0xcef4('0x58')][_0xcef4('0x32')]);_0x22e3a9[_0xcef4('0x38')]=_[_0xcef4('0x37')](_0xa22e11['query']);_0x22e3a9[_0xcef4('0x41')]=_['intersection'](_0x22e3a9[_0xcef4('0x36')],_0x22e3a9[_0xcef4('0x38')]);_0x5a3379[_0xcef4('0x3a')]=_['intersection'](_0x22e3a9['model'],qs['fields'](_0xa22e11[_0xcef4('0x38')]['fields']));_0x5a3379[_0xcef4('0x3a')]=_0x5a3379[_0xcef4('0x3a')]['length']?_0x5a3379['attributes']:_0x22e3a9['model'];if(!_0xa22e11[_0xcef4('0x38')][_0xcef4('0x3d')](_0xcef4('0x3e'))){_0x5a3379['limit']=qs[_0xcef4('0x22')](_0xa22e11[_0xcef4('0x38')][_0xcef4('0x22')]);_0x5a3379[_0xcef4('0x20')]=qs['offset'](_0xa22e11[_0xcef4('0x38')][_0xcef4('0x20')]);}_0x5a3379[_0xcef4('0x3f')]=qs[_0xcef4('0x40')](_0xa22e11[_0xcef4('0x38')][_0xcef4('0x40')]);_0x5a3379[_0xcef4('0x42')]=qs['filters'](_[_0xcef4('0x59')](_0xa22e11[_0xcef4('0x38')],_0x22e3a9[_0xcef4('0x41')]));_0x5a3379[_0xcef4('0x42')]['MailQueueId']=_0x41d1ee['id'];if(_0xa22e11[_0xcef4('0x38')][_0xcef4('0x5a')]){_0x5a3379[_0xcef4('0x42')]=_[_0xcef4('0x44')](_0x5a3379[_0xcef4('0x42')],{'$or':_[_0xcef4('0x30')](_0x5a3379[_0xcef4('0x3a')],function(_0x457bd8){var _0x1f1937={};_0x1f1937[_0x457bd8]={'$like':'%'+_0xa22e11[_0xcef4('0x38')]['filter']+'%'};return _0x1f1937;})});}_0x5a3379=_[_0xcef4('0x44')]({},_0x5a3379,_0xa22e11[_0xcef4('0x4c')]);return db[_0xcef4('0x58')][_0xcef4('0x48')](_0x5a3379);}})[_0xcef4('0x29')](function(_0x52896d){if(_0x52896d){return db[_0xcef4('0x5b')]['findAndCountAll']({'where':{'id':_[_0xcef4('0x30')](_0x52896d,_0xcef4('0x5c')),'role':_0xcef4('0x5d')},'attributes':['id',_0xcef4('0x2f'),_0xcef4('0x5e'),_0xcef4('0x5f'),_0xcef4('0x60')]});}})[_0xcef4('0x29')](function(_0x2568f8){if(_0x2568f8){return{'count':_0x2568f8[_0xcef4('0x45')],'rows':_[_0xcef4('0x30')](_0x2568f8[_0xcef4('0x61')],function(_0x260b94){return{'membername':_0x260b94[_0xcef4('0x2f')],'UserId':_0x260b94['id'],'queue_name':_0x3b74d3[_0xcef4('0x2f')],'MailQueueId':_0x3b74d3['id'],'interface':util[_0xcef4('0x62')](_0xcef4('0x63'),'SIP',_0x260b94[_0xcef4('0x2f')]),'penalty':0x0,'paused':_0x260b94['mailPause'],'createdAt':_0x260b94['createdAt'],'updatedAt':_0x260b94[_0xcef4('0x5f')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xcef4('0x29')](respondWithFilteredResult(_0x2a8303,_0x5a3379))[_0xcef4('0x49')](handleError(_0x2a8303,null));};exports['getTeams']=function(_0x330b05,_0x536f5a,_0x1eb644){var _0x573dc7={};var _0x36a89b={};var _0x232089;var _0x2003be;return db['MailQueue']['findOne']({'where':{'id':_0x330b05[_0xcef4('0x4b')]['id']}})[_0xcef4('0x29')](handleEntityNotFound(_0x536f5a,null))[_0xcef4('0x29')](function(_0x4efc45){if(_0x4efc45){_0x232089=_0x4efc45;_0x36a89b['model']=_[_0xcef4('0x37')](db[_0xcef4('0x64')][_0xcef4('0x32')]);_0x36a89b[_0xcef4('0x38')]=_['keys'](_0x330b05['query']);_0x36a89b['filters']=_['intersection'](_0x36a89b[_0xcef4('0x36')],_0x36a89b[_0xcef4('0x38')]);_0x573dc7[_0xcef4('0x3a')]=_['intersection'](_0x36a89b[_0xcef4('0x36')],qs[_0xcef4('0x3b')](_0x330b05[_0xcef4('0x38')]['fields']));_0x573dc7['attributes']=_0x573dc7['attributes']['length']?_0x573dc7[_0xcef4('0x3a')]:_0x36a89b['model'];_0x573dc7[_0xcef4('0x3f')]=qs[_0xcef4('0x40')](_0x330b05[_0xcef4('0x38')]['sort']);_0x573dc7[_0xcef4('0x42')]=qs[_0xcef4('0x41')](_[_0xcef4('0x59')](_0x330b05[_0xcef4('0x38')],_0x36a89b[_0xcef4('0x41')]));if(_0x330b05[_0xcef4('0x38')][_0xcef4('0x5a')]){_0x573dc7[_0xcef4('0x42')]=_[_0xcef4('0x44')](_0x573dc7[_0xcef4('0x42')],{'$or':_[_0xcef4('0x30')](_0x573dc7[_0xcef4('0x3a')],function(_0x5a2771){var _0x3b1161={};_0x3b1161[_0x5a2771]={'$like':'%'+_0x330b05[_0xcef4('0x38')][_0xcef4('0x5a')]+'%'};return _0x3b1161;})});}_0x573dc7=_[_0xcef4('0x44')]({},_0x573dc7,_0x330b05['options']);return _0x232089[_0xcef4('0x65')](_0x573dc7);}})['then'](function(_0xda2912){if(_0xda2912){_0x2003be=_0xda2912[_0xcef4('0x3c')];if(!_0x330b05[_0xcef4('0x38')][_0xcef4('0x3d')](_0xcef4('0x3e'))){_0x573dc7['limit']=qs[_0xcef4('0x22')](_0x330b05[_0xcef4('0x38')][_0xcef4('0x22')]);_0x573dc7[_0xcef4('0x20')]=qs[_0xcef4('0x20')](_0x330b05[_0xcef4('0x38')]['offset']);}return _0x232089['getTeams'](_0x573dc7);}})['then'](function(_0x3b8a4c){if(_0x3b8a4c){return _0x3b8a4c?{'count':_0x2003be,'rows':_0x3b8a4c}:null;}})['then'](respondWithResult(_0x536f5a,null))[_0xcef4('0x49')](handleError(_0x536f5a,null));};exports[_0xcef4('0x66')]=function(_0x976a72,_0x173b1e,_0x3129d3){var _0xba9c40=_0x976a72[_0xcef4('0x4f')]['ids'];return db[_0xcef4('0x64')][_0xcef4('0x48')]({'where':{'id':_0xba9c40},'attributes':['id'],'include':[{'model':db[_0xcef4('0x5b')],'as':_0xcef4('0x67'),'attributes':['id',_0xcef4('0x2f'),_0xcef4('0x68'),_0xcef4('0x69'),_0xcef4('0x6a')],'raw':!![]}]})['then'](function(_0x50b746){if(_0x50b746){var _0x22cf9b=_[_0xcef4('0x6b')](_0x50b746,function(_0x1a5592){var _0x403e81=_0x1a5592[_0xcef4('0x2b')]({'plain':!![]});return _0x403e81[_0xcef4('0x67')];});return db[_0xcef4('0x31')][_0xcef4('0x4d')]({'where':{'id':_0x976a72[_0xcef4('0x4b')]['id']}})['then'](function(_0x50b7ce){return db['sequelize'][_0xcef4('0x6c')](function(_0x379333){return _0x50b7ce[_0xcef4('0x66')](_0xba9c40,{'transaction':_0x379333})[_0xcef4('0x29')](function(){return BPromise[_0xcef4('0x6d')](_0x22cf9b,function(_0x4ca020){return db[_0xcef4('0x58')]['findOrCreate']({'where':{'UserId':_0x4ca020['id'],'MailQueueId':_0x976a72['params']['id']},'transaction':_0x379333});});})['then'](function(){_0x22cf9b['forEach'](function(_0x485548){socket[_0xcef4('0x6e')](_0xcef4('0x6f'),{'UserId':_0x485548['id'],'MailQueueId':_0x50b7ce['id']});});});});});}})[_0xcef4('0x29')](respondWithStatusCode(_0x173b1e,null))[_0xcef4('0x49')](handleError(_0x173b1e,null));};exports[_0xcef4('0x70')]=function(_0x2435f9,_0x41c14e,_0x112e30){return db['Team'][_0xcef4('0x48')]({'where':{'id':_0x2435f9[_0xcef4('0x38')][_0xcef4('0x71')]},'attributes':['id'],'include':[{'model':db[_0xcef4('0x5b')],'as':_0xcef4('0x67'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x41c14e,null))['then'](function(_0x263c98){var _0x598e95=_['map'](_0x263c98,'id');var _0x551794=[];var _0x118ba8=[];var _0x3fe39e=squel[_0xcef4('0x72')]();_0x3fe39e[_0xcef4('0x73')](_0xcef4('0x74'))['from'](_0xcef4('0x75'),'tq')['join'](_0xcef4('0x76'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0xcef4('0x42')](_0xcef4('0x77'),_0x2435f9[_0xcef4('0x4b')]['id']);for(var _0x49c7b8=0x0;_0x49c7b8<_0x263c98[_0xcef4('0x3c')];_0x49c7b8+=0x1){let _0x31aa45=_0x263c98[_0x49c7b8];for(var _0x5c2e59=0x0;_0x5c2e59<_0x31aa45[_0xcef4('0x67')][_0xcef4('0x3c')];_0x5c2e59+=0x1){let _0x41be3a=_0x31aa45['Agents'][_0x5c2e59];var _0x135939=_0x3fe39e[_0xcef4('0x78')]();_0x135939[_0xcef4('0x42')](_0xcef4('0x79'),_0x41be3a['id']);_0x118ba8[_0xcef4('0x7a')](db[_0xcef4('0x7b')]['query'](_0x135939['toString'](),{'type':db[_0xcef4('0x7b')]['QueryTypes'][_0xcef4('0x7c')]})['then'](function(_0x531984){if(_0x531984['length']===0x1){return _0x41be3a['id'];}else{var _0x463ef3=_[_0xcef4('0x7d')](_['map'](_0x531984,_0xcef4('0x7e')),function(_0x52d317){return _[_0xcef4('0x7f')](_0x598e95,_0x52d317);});if(_0x463ef3){return _0x41be3a['id'];}}}));}}return BPromise[_0xcef4('0x80')](_0x118ba8)[_0xcef4('0x29')](function(_0x59fe95){_0x551794=_(_0x551794)['union'](_0x59fe95)[_0xcef4('0x81')]()[_0xcef4('0x82')]();return db[_0xcef4('0x31')]['find']({'where':{'id':_0x2435f9[_0xcef4('0x4b')]['id']}})[_0xcef4('0x29')](function(_0x710434){return db[_0xcef4('0x7b')][_0xcef4('0x6c')](function(_0x392572){return _0x710434[_0xcef4('0x70')](_0x2435f9[_0xcef4('0x38')][_0xcef4('0x71')],{'transaction':_0x392572})['then'](function(){if(!_[_0xcef4('0x83')](_0x551794)){return _0x710434[_0xcef4('0x84')](_0x551794,{'transaction':_0x392572});}})['then'](function(){_0x551794[_0xcef4('0x85')](function(_0x59fbf5){socket[_0xcef4('0x6e')](_0xcef4('0x86'),{'UserId':_0x59fbf5,'MailQueueId':_0x710434['id']});});});});});});})[_0xcef4('0x29')](respondWithStatusCode(_0x41c14e,null))[_0xcef4('0x49')](handleError(_0x41c14e,null));};exports[_0xcef4('0x87')]=function(_0x31091c,_0x33994b,_0x5dbc71){return db[_0xcef4('0x31')][_0xcef4('0x4d')]({'where':{'id':_0x31091c[_0xcef4('0x4b')]['id']}})[_0xcef4('0x29')](handleEntityNotFound(_0x33994b,null))[_0xcef4('0x29')](function(_0x345777){if(_0x345777){return _0x345777['addAgents'](_0x31091c[_0xcef4('0x4f')]['ids'],_[_0xcef4('0x88')](_0x31091c['body'],['ids','id'])||{})[_0xcef4('0x89')](function(_0x3aabc3){for(var _0x2a1d42=0x0;_0x2a1d42<_0x31091c[_0xcef4('0x4f')][_0xcef4('0x71')][_0xcef4('0x3c')];_0x2a1d42+=0x1){socket['emit'](_0xcef4('0x6f'),{'UserId':Number(_0x31091c[_0xcef4('0x4f')][_0xcef4('0x71')][_0x2a1d42]),'MailQueueId':Number(_0x31091c[_0xcef4('0x4b')]['id'])});}return _0x3aabc3;});}})[_0xcef4('0x29')](respondWithResult(_0x33994b,null))[_0xcef4('0x49')](handleError(_0x33994b,null));};exports[_0xcef4('0x84')]=function(_0x1cefc9,_0x1f8f61,_0x1c7c16){return db[_0xcef4('0x31')][_0xcef4('0x4d')]({'where':{'id':_0x1cefc9[_0xcef4('0x4b')]['id']}})[_0xcef4('0x29')](handleEntityNotFound(_0x1f8f61,null))[_0xcef4('0x29')](function(_0x5e6a0a){if(_0x5e6a0a){return _0x5e6a0a[_0xcef4('0x84')](_0x1cefc9[_0xcef4('0x38')][_0xcef4('0x71')])[_0xcef4('0x29')](function(){if(_[_0xcef4('0x8a')](_0x1cefc9[_0xcef4('0x38')][_0xcef4('0x71')])){for(var _0x3c29a5=0x0;_0x3c29a5<_0x1cefc9['query'][_0xcef4('0x71')][_0xcef4('0x3c')];_0x3c29a5+=0x1){socket[_0xcef4('0x6e')](_0xcef4('0x86'),{'UserId':Number(_0x1cefc9[_0xcef4('0x38')][_0xcef4('0x71')][_0x3c29a5]),'MailQueueId':Number(_0x1cefc9[_0xcef4('0x4b')]['id'])});}}else{socket[_0xcef4('0x6e')]('userMailQueue:remove',{'UserId':Number(_0x1cefc9[_0xcef4('0x38')]['ids']),'MailQueueId':Number(_0x1cefc9[_0xcef4('0x4b')]['id'])});}});}})[_0xcef4('0x29')](respondWithStatusCode(_0x1f8f61,null))['catch'](handleError(_0x1f8f61,null));};exports[_0xcef4('0x8b')]=function(_0x41e4bf,_0x193e4e,_0x42d913){var _0x43ec25={};var _0x10ce34={};var _0xc15625;var _0x224c20;return db[_0xcef4('0x31')][_0xcef4('0x57')]({'where':{'id':_0x41e4bf[_0xcef4('0x4b')]['id']}})['then'](handleEntityNotFound(_0x193e4e,null))[_0xcef4('0x29')](function(_0x2b3a5d){if(_0x2b3a5d){_0xc15625=_0x2b3a5d;_0x10ce34[_0xcef4('0x36')]=_[_0xcef4('0x37')](db[_0xcef4('0x5b')][_0xcef4('0x32')]);_0x10ce34[_0xcef4('0x38')]=_['keys'](_0x41e4bf[_0xcef4('0x38')]);_0x10ce34[_0xcef4('0x41')]=_[_0xcef4('0x39')](_0x10ce34[_0xcef4('0x36')],_0x10ce34['query']);_0x43ec25[_0xcef4('0x3a')]=_[_0xcef4('0x39')](_0x10ce34[_0xcef4('0x36')],qs[_0xcef4('0x3b')](_0x41e4bf[_0xcef4('0x38')]['fields']));_0x43ec25[_0xcef4('0x3a')]=_0x43ec25[_0xcef4('0x3a')][_0xcef4('0x3c')]?_0x43ec25[_0xcef4('0x3a')]:_0x10ce34['model'];_0x43ec25['order']=qs[_0xcef4('0x40')](_0x41e4bf['query'][_0xcef4('0x40')]);_0x43ec25[_0xcef4('0x42')]=qs[_0xcef4('0x41')](_[_0xcef4('0x59')](_0x41e4bf[_0xcef4('0x38')],_0x10ce34[_0xcef4('0x41')]));if(_0x41e4bf[_0xcef4('0x38')][_0xcef4('0x5a')]){_0x43ec25['where']=_[_0xcef4('0x44')](_0x43ec25[_0xcef4('0x42')],{'$or':_[_0xcef4('0x30')](_0x43ec25[_0xcef4('0x3a')],function(_0x33695d){var _0x3fb207={};_0x3fb207[_0x33695d]={'$like':'%'+_0x41e4bf['query']['filter']+'%'};return _0x3fb207;})});}_0x43ec25=_[_0xcef4('0x44')]({},_0x43ec25,_0x41e4bf[_0xcef4('0x4c')]);return _0xc15625['getAgents'](_0x43ec25);}})['then'](function(_0x444ae9){if(_0x444ae9){_0x224c20=_0x444ae9[_0xcef4('0x3c')];if(!_0x41e4bf[_0xcef4('0x38')][_0xcef4('0x3d')]('nolimit')){_0x43ec25[_0xcef4('0x22')]=qs[_0xcef4('0x22')](_0x41e4bf[_0xcef4('0x38')][_0xcef4('0x22')]);_0x43ec25[_0xcef4('0x20')]=qs['offset'](_0x41e4bf[_0xcef4('0x38')]['offset']);}return _0xc15625[_0xcef4('0x8b')](_0x43ec25);}})['then'](function(_0x576dca){if(_0x576dca){return _0x576dca?{'count':_0x224c20,'rows':_0x576dca}:null;}})[_0xcef4('0x29')](respondWithResult(_0x193e4e,null))[_0xcef4('0x49')](handleError(_0x193e4e,null));}; \ No newline at end of file +var _0x6037=['fieldName','type','key','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','MailQueue','includeAll','include','findAll','rows','params','options','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','update','find','destroy','describe','getMembers','findOne','UserMailQueue','MailQueueId','User','findAndCountAll','UserId','mailPause','updatedAt','%s/%s','SIP','createdAt','getTeams','Team','addTeams','ids','Agents','voicePause','flatMap','transaction','findOrCreate','forEach','emit','userMailQueue:save','removeTeams','field','from','team_has_mail_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','MailQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','sequelize','QueryTypes','SELECT','TeamId','includes','all','union','value','isEmpty','userMailQueue:remove','addAgents','spread','removeAgents','getAgents','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../mysqldb','redis','defaults','localhost','./mailQueue.socket','register','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','then','get','MailQueues','UserProfileResource','sendStatus','error','stack','name','rawAttributes'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x6037,0xe2));var _0x7603=function(_0x5db687,_0x1cfa57){_0x5db687=_0x5db687-0x0;var _0x4096a0=_0x6037[_0x5db687];return _0x4096a0;};'use strict';var emlformat=require(_0x7603('0x0'));var rimraf=require(_0x7603('0x1'));var zipdir=require(_0x7603('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7603('0x3'));var moment=require('moment');var BPromise=require(_0x7603('0x4'));var Mustache=require(_0x7603('0x5'));var util=require('util');var path=require(_0x7603('0x6'));var sox=require(_0x7603('0x7'));var csv=require('to-csv');var ejs=require(_0x7603('0x8'));var fs=require('fs');var fs_extra=require(_0x7603('0x9'));var _=require(_0x7603('0xa'));var squel=require(_0x7603('0xb'));var crypto=require(_0x7603('0xc'));var jsforce=require(_0x7603('0xd'));var deskjs=require(_0x7603('0xe'));var toCsv=require('to-csv');var querystring=require(_0x7603('0xf'));var Papa=require('papaparse');var Redis=require(_0x7603('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x7603('0x11'));var hardwareService=require(_0x7603('0x12'));var logger=require('../../config/logger')('api');var utils=require(_0x7603('0x13'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x7603('0x14'))['db'];config[_0x7603('0x15')]=_[_0x7603('0x16')](config[_0x7603('0x15')],{'host':_0x7603('0x17'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x7603('0x15')]));require(_0x7603('0x18'))[_0x7603('0x19')](socket);function respondWithStatusCode(_0x3494d9,_0x5e93d2){_0x5e93d2=_0x5e93d2||0xcc;return function(_0x207c50){if(_0x207c50){return _0x3494d9['sendStatus'](_0x5e93d2);}return _0x3494d9[_0x7603('0x1a')](_0x5e93d2)[_0x7603('0x1b')]();};}function respondWithResult(_0x40d8d5,_0x35cb05){_0x35cb05=_0x35cb05||0xc8;return function(_0x16f940){if(_0x16f940){return _0x40d8d5['status'](_0x35cb05)[_0x7603('0x1c')](_0x16f940);}};}function respondWithFilteredResult(_0x5ab631,_0x57cef2){return function(_0x392589){if(_0x392589){var _0x14c7fb=typeof _0x57cef2[_0x7603('0x1d')]===_0x7603('0x1e')&&typeof _0x57cef2[_0x7603('0x1f')]==='undefined';var _0x372653=_0x392589[_0x7603('0x20')];var _0x7cc870=_0x14c7fb?0x0:_0x57cef2[_0x7603('0x1d')];var _0x58d32b=_0x14c7fb?_0x392589['count']:_0x57cef2['offset']+_0x57cef2[_0x7603('0x1f')];var _0x1c9746;if(_0x58d32b>=_0x372653){_0x58d32b=_0x372653;_0x1c9746=0xc8;}else{_0x1c9746=0xce;}_0x5ab631[_0x7603('0x1a')](_0x1c9746);return _0x5ab631[_0x7603('0x21')](_0x7603('0x22'),_0x7cc870+'-'+_0x58d32b+'/'+_0x372653)[_0x7603('0x1c')](_0x392589);}return null;};}function patchUpdates(_0x346623){return function(_0x3e24da){try{jsonpatch[_0x7603('0x23')](_0x3e24da,_0x346623,!![]);}catch(_0x398950){return BPromise['reject'](_0x398950);}return _0x3e24da[_0x7603('0x24')]();};}function saveUpdates(_0x2a440a,_0x7726dd){return function(_0x97c5ac){if(_0x97c5ac){return _0x97c5ac['update'](_0x2a440a)[_0x7603('0x25')](function(_0x27771f){return _0x27771f;});}return null;};}function removeEntity(_0x453ca4,_0x394f22){return function(_0x27fdc5){if(_0x27fdc5){return _0x27fdc5['destroy']()[_0x7603('0x25')](function(){var _0x59935c=_0x27fdc5[_0x7603('0x26')]({'plain':!![]});var _0x4e8797=_0x7603('0x27');return db[_0x7603('0x28')]['destroy']({'where':{'type':_0x4e8797,'resourceId':_0x59935c['id']}})['then'](function(){return _0x27fdc5;});})[_0x7603('0x25')](function(){_0x453ca4[_0x7603('0x1a')](0xcc)[_0x7603('0x1b')]();});}};}function handleEntityNotFound(_0x5ac9e4,_0x5ade9b){return function(_0x24872e){if(!_0x24872e){_0x5ac9e4[_0x7603('0x29')](0x194);}return _0x24872e;};}function handleError(_0x23a373,_0x310b59){_0x310b59=_0x310b59||0x1f4;return function(_0x20a190){logger[_0x7603('0x2a')](_0x20a190[_0x7603('0x2b')]);if(_0x20a190[_0x7603('0x2c')]){delete _0x20a190[_0x7603('0x2c')];}_0x23a373[_0x7603('0x1a')](_0x310b59)['send'](_0x20a190);};}exports['index']=function(_0x1a61a5,_0x2ab5d0){var _0x11132f={},_0x3d9da1={},_0x449098={'count':0x0,'rows':[]};var _0x67b479=_['map'](db['MailQueue'][_0x7603('0x2d')],function(_0x767bc7){return{'name':_0x767bc7[_0x7603('0x2e')],'type':_0x767bc7[_0x7603('0x2f')][_0x7603('0x30')]};});_0x3d9da1[_0x7603('0x31')]=_[_0x7603('0x32')](_0x67b479,_0x7603('0x2c'));_0x3d9da1[_0x7603('0x33')]=_[_0x7603('0x34')](_0x1a61a5['query']);_0x3d9da1[_0x7603('0x35')]=_[_0x7603('0x36')](_0x3d9da1[_0x7603('0x31')],_0x3d9da1[_0x7603('0x33')]);_0x11132f['attributes']=_[_0x7603('0x36')](_0x3d9da1['model'],qs[_0x7603('0x37')](_0x1a61a5[_0x7603('0x33')]['fields']));_0x11132f[_0x7603('0x38')]=_0x11132f[_0x7603('0x38')][_0x7603('0x39')]?_0x11132f['attributes']:_0x3d9da1['model'];if(!_0x1a61a5[_0x7603('0x33')][_0x7603('0x3a')](_0x7603('0x3b'))){_0x11132f[_0x7603('0x1f')]=qs[_0x7603('0x1f')](_0x1a61a5[_0x7603('0x33')]['limit']);_0x11132f[_0x7603('0x1d')]=qs['offset'](_0x1a61a5[_0x7603('0x33')]['offset']);}_0x11132f[_0x7603('0x3c')]=qs['sort'](_0x1a61a5[_0x7603('0x33')][_0x7603('0x3d')]);_0x11132f['where']=qs['filters'](_[_0x7603('0x3e')](_0x1a61a5[_0x7603('0x33')],_0x3d9da1['filters']),_0x67b479);if(_0x1a61a5[_0x7603('0x33')][_0x7603('0x3f')]){_0x11132f[_0x7603('0x40')]=_[_0x7603('0x41')](_0x11132f[_0x7603('0x40')],{'$or':_[_0x7603('0x32')](_0x67b479,function(_0x56a6ba){if(_0x56a6ba[_0x7603('0x2f')]!==_0x7603('0x42')){var _0x1736a1={};_0x1736a1[_0x56a6ba[_0x7603('0x2c')]]={'$like':'%'+_0x1a61a5[_0x7603('0x33')][_0x7603('0x3f')]+'%'};return _0x1736a1;}})});}_0x11132f=_[_0x7603('0x41')]({},_0x11132f,_0x1a61a5['options']);var _0x2b5f3d={'where':_0x11132f['where']};return db[_0x7603('0x43')][_0x7603('0x20')](_0x2b5f3d)[_0x7603('0x25')](function(_0xd49c15){_0x449098[_0x7603('0x20')]=_0xd49c15;if(_0x1a61a5[_0x7603('0x33')][_0x7603('0x44')]){_0x11132f[_0x7603('0x45')]=[{'all':!![]}];}return db[_0x7603('0x43')][_0x7603('0x46')](_0x11132f);})[_0x7603('0x25')](function(_0x319fdc){_0x449098[_0x7603('0x47')]=_0x319fdc;return _0x449098;})[_0x7603('0x25')](respondWithFilteredResult(_0x2ab5d0,_0x11132f))['catch'](handleError(_0x2ab5d0,null));};exports['show']=function(_0x186334,_0x392717){var _0x4a5da9={'raw':!![],'where':{'id':_0x186334[_0x7603('0x48')]['id']}},_0x213760={};_0x213760[_0x7603('0x31')]=_[_0x7603('0x34')](db[_0x7603('0x43')][_0x7603('0x2d')]);_0x213760[_0x7603('0x33')]=_['keys'](_0x186334['query']);_0x213760['filters']=_['intersection'](_0x213760[_0x7603('0x31')],_0x213760['query']);_0x4a5da9[_0x7603('0x38')]=_[_0x7603('0x36')](_0x213760[_0x7603('0x31')],qs['fields'](_0x186334[_0x7603('0x33')]['fields']));_0x4a5da9[_0x7603('0x38')]=_0x4a5da9[_0x7603('0x38')][_0x7603('0x39')]?_0x4a5da9[_0x7603('0x38')]:_0x213760[_0x7603('0x31')];if(_0x186334['query'][_0x7603('0x44')]){_0x4a5da9[_0x7603('0x45')]=[{'all':!![]}];}_0x4a5da9=_[_0x7603('0x41')]({},_0x4a5da9,_0x186334[_0x7603('0x49')]);return db[_0x7603('0x43')]['find'](_0x4a5da9)[_0x7603('0x25')](handleEntityNotFound(_0x392717,null))[_0x7603('0x25')](respondWithResult(_0x392717,null))[_0x7603('0x4a')](handleError(_0x392717,null));};exports['create']=function(_0x10a30f,_0x25f8dc){return db[_0x7603('0x43')][_0x7603('0x4b')](_0x10a30f[_0x7603('0x4c')],{})[_0x7603('0x25')](function(_0x848d60){var _0x1bc7cc=_0x10a30f[_0x7603('0x4d')][_0x7603('0x26')]({'plain':!![]});if(!_0x1bc7cc)throw new Error(_0x7603('0x4e'));if(_0x1bc7cc[_0x7603('0x4f')]===_0x7603('0x4d')){var _0x325b91=_0x848d60['get']({'plain':!![]});var _0x24fb21=_0x7603('0x27');return db[_0x7603('0x50')]['find']({'where':{'name':_0x24fb21,'userProfileId':_0x1bc7cc[_0x7603('0x51')]},'raw':!![]})[_0x7603('0x25')](function(_0x5619e8){if(_0x5619e8&&_0x5619e8[_0x7603('0x52')]===0x0){return db[_0x7603('0x28')]['create']({'name':_0x325b91['name'],'resourceId':_0x325b91['id'],'type':_0x5619e8[_0x7603('0x2c')],'sectionId':_0x5619e8['id']},{})[_0x7603('0x25')](function(){return _0x848d60;});}else{return _0x848d60;}})['catch'](function(_0x36394b){logger[_0x7603('0x2a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x36394b);throw _0x36394b;});}return _0x848d60;})[_0x7603('0x25')](respondWithResult(_0x25f8dc,0xc9))['catch'](handleError(_0x25f8dc,null));};exports[_0x7603('0x53')]=function(_0xdcdca0,_0x488ebe){if(_0xdcdca0[_0x7603('0x4c')]['id']){delete _0xdcdca0[_0x7603('0x4c')]['id'];}return db['MailQueue'][_0x7603('0x54')]({'where':{'id':_0xdcdca0[_0x7603('0x48')]['id']}})[_0x7603('0x25')](handleEntityNotFound(_0x488ebe,null))[_0x7603('0x25')](saveUpdates(_0xdcdca0[_0x7603('0x4c')],null))['then'](respondWithResult(_0x488ebe,null))[_0x7603('0x4a')](handleError(_0x488ebe,null));};exports[_0x7603('0x55')]=function(_0x1aa868,_0x3431f7){return db['MailQueue']['find']({'where':{'id':_0x1aa868[_0x7603('0x48')]['id']}})[_0x7603('0x25')](handleEntityNotFound(_0x3431f7,null))[_0x7603('0x25')](removeEntity(_0x3431f7,null))[_0x7603('0x4a')](handleError(_0x3431f7,null));};exports[_0x7603('0x56')]=function(_0x75c916,_0x12ac6e){return db[_0x7603('0x43')][_0x7603('0x56')]()['then'](respondWithResult(_0x12ac6e,null))['catch'](handleError(_0x12ac6e,null));};exports[_0x7603('0x57')]=function(_0x34c0fb,_0x3853a8,_0x563cf0){var _0x3c7428={'raw':!![],'where':{}},_0x5a55bc={},_0x455002;return db['MailQueue'][_0x7603('0x58')]({'where':{'id':_0x34c0fb[_0x7603('0x48')]['id']}})['then'](handleEntityNotFound(_0x3853a8,null))[_0x7603('0x25')](function(_0x292e28){if(_0x292e28){_0x455002=_0x292e28[_0x7603('0x26')]({'plain':!![]});_0x5a55bc['model']=_[_0x7603('0x34')](db[_0x7603('0x59')][_0x7603('0x2d')]);_0x5a55bc['query']=_[_0x7603('0x34')](_0x34c0fb[_0x7603('0x33')]);_0x5a55bc[_0x7603('0x35')]=_['intersection'](_0x5a55bc[_0x7603('0x31')],_0x5a55bc['query']);_0x3c7428[_0x7603('0x38')]=_['intersection'](_0x5a55bc[_0x7603('0x31')],qs[_0x7603('0x37')](_0x34c0fb[_0x7603('0x33')][_0x7603('0x37')]));_0x3c7428[_0x7603('0x38')]=_0x3c7428[_0x7603('0x38')][_0x7603('0x39')]?_0x3c7428[_0x7603('0x38')]:_0x5a55bc[_0x7603('0x31')];if(!_0x34c0fb['query'][_0x7603('0x3a')](_0x7603('0x3b'))){_0x3c7428[_0x7603('0x1f')]=qs['limit'](_0x34c0fb[_0x7603('0x33')][_0x7603('0x1f')]);_0x3c7428[_0x7603('0x1d')]=qs['offset'](_0x34c0fb[_0x7603('0x33')]['offset']);}_0x3c7428['order']=qs[_0x7603('0x3d')](_0x34c0fb[_0x7603('0x33')][_0x7603('0x3d')]);_0x3c7428['where']=qs[_0x7603('0x35')](_[_0x7603('0x3e')](_0x34c0fb[_0x7603('0x33')],_0x5a55bc[_0x7603('0x35')]));_0x3c7428[_0x7603('0x40')][_0x7603('0x5a')]=_0x292e28['id'];if(_0x34c0fb[_0x7603('0x33')][_0x7603('0x3f')]){_0x3c7428['where']=_[_0x7603('0x41')](_0x3c7428['where'],{'$or':_['map'](_0x3c7428[_0x7603('0x38')],function(_0x290d4e){var _0x533450={};_0x533450[_0x290d4e]={'$like':'%'+_0x34c0fb[_0x7603('0x33')]['filter']+'%'};return _0x533450;})});}_0x3c7428=_['merge']({},_0x3c7428,_0x34c0fb[_0x7603('0x49')]);return db[_0x7603('0x59')][_0x7603('0x46')](_0x3c7428);}})[_0x7603('0x25')](function(_0x1b30f6){if(_0x1b30f6){return db[_0x7603('0x5b')][_0x7603('0x5c')]({'where':{'id':_['map'](_0x1b30f6,_0x7603('0x5d')),'role':'agent'},'attributes':['id','name',_0x7603('0x5e'),_0x7603('0x5f'),'createdAt']});}})[_0x7603('0x25')](function(_0x4c260a){if(_0x4c260a){return{'count':_0x4c260a[_0x7603('0x20')],'rows':_['map'](_0x4c260a[_0x7603('0x47')],function(_0x24b8e5){return{'membername':_0x24b8e5[_0x7603('0x2c')],'UserId':_0x24b8e5['id'],'queue_name':_0x455002[_0x7603('0x2c')],'MailQueueId':_0x455002['id'],'interface':util['format'](_0x7603('0x60'),_0x7603('0x61'),_0x24b8e5[_0x7603('0x2c')]),'penalty':0x0,'paused':_0x24b8e5[_0x7603('0x5e')],'createdAt':_0x24b8e5[_0x7603('0x62')],'updatedAt':_0x24b8e5['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x7603('0x25')](respondWithFilteredResult(_0x3853a8,_0x3c7428))[_0x7603('0x4a')](handleError(_0x3853a8,null));};exports[_0x7603('0x63')]=function(_0x5c6dbe,_0x5228a7,_0x30d2a4){var _0x1d440f={};var _0x12e500={};var _0x3da537;var _0x35129a;return db[_0x7603('0x43')][_0x7603('0x58')]({'where':{'id':_0x5c6dbe[_0x7603('0x48')]['id']}})[_0x7603('0x25')](handleEntityNotFound(_0x5228a7,null))[_0x7603('0x25')](function(_0x47b0c5){if(_0x47b0c5){_0x3da537=_0x47b0c5;_0x12e500[_0x7603('0x31')]=_[_0x7603('0x34')](db[_0x7603('0x64')][_0x7603('0x2d')]);_0x12e500[_0x7603('0x33')]=_[_0x7603('0x34')](_0x5c6dbe[_0x7603('0x33')]);_0x12e500[_0x7603('0x35')]=_[_0x7603('0x36')](_0x12e500[_0x7603('0x31')],_0x12e500[_0x7603('0x33')]);_0x1d440f[_0x7603('0x38')]=_[_0x7603('0x36')](_0x12e500[_0x7603('0x31')],qs[_0x7603('0x37')](_0x5c6dbe['query'][_0x7603('0x37')]));_0x1d440f[_0x7603('0x38')]=_0x1d440f['attributes'][_0x7603('0x39')]?_0x1d440f[_0x7603('0x38')]:_0x12e500['model'];_0x1d440f[_0x7603('0x3c')]=qs['sort'](_0x5c6dbe['query'][_0x7603('0x3d')]);_0x1d440f[_0x7603('0x40')]=qs['filters'](_[_0x7603('0x3e')](_0x5c6dbe['query'],_0x12e500[_0x7603('0x35')]));if(_0x5c6dbe[_0x7603('0x33')][_0x7603('0x3f')]){_0x1d440f[_0x7603('0x40')]=_[_0x7603('0x41')](_0x1d440f['where'],{'$or':_[_0x7603('0x32')](_0x1d440f['attributes'],function(_0x520893){var _0x11a1b9={};_0x11a1b9[_0x520893]={'$like':'%'+_0x5c6dbe[_0x7603('0x33')][_0x7603('0x3f')]+'%'};return _0x11a1b9;})});}_0x1d440f=_[_0x7603('0x41')]({},_0x1d440f,_0x5c6dbe['options']);return _0x3da537[_0x7603('0x63')](_0x1d440f);}})[_0x7603('0x25')](function(_0x299ff6){if(_0x299ff6){_0x35129a=_0x299ff6['length'];if(!_0x5c6dbe[_0x7603('0x33')]['hasOwnProperty'](_0x7603('0x3b'))){_0x1d440f['limit']=qs['limit'](_0x5c6dbe[_0x7603('0x33')][_0x7603('0x1f')]);_0x1d440f['offset']=qs[_0x7603('0x1d')](_0x5c6dbe[_0x7603('0x33')][_0x7603('0x1d')]);}return _0x3da537[_0x7603('0x63')](_0x1d440f);}})[_0x7603('0x25')](function(_0x2a6132){if(_0x2a6132){return _0x2a6132?{'count':_0x35129a,'rows':_0x2a6132}:null;}})[_0x7603('0x25')](respondWithResult(_0x5228a7,null))[_0x7603('0x4a')](handleError(_0x5228a7,null));};exports[_0x7603('0x65')]=function(_0x4efdfb,_0x215df0,_0x4fbd44){var _0x4d576f=_0x4efdfb[_0x7603('0x4c')][_0x7603('0x66')];return db['Team'][_0x7603('0x46')]({'where':{'id':_0x4d576f},'attributes':['id'],'include':[{'model':db[_0x7603('0x5b')],'as':_0x7603('0x67'),'attributes':['id','name','online',_0x7603('0x68'),'interface'],'raw':!![]}]})[_0x7603('0x25')](function(_0x3b7839){if(_0x3b7839){var _0x5d56e1=_[_0x7603('0x69')](_0x3b7839,function(_0xdac58b){var _0x42592d=_0xdac58b[_0x7603('0x26')]({'plain':!![]});return _0x42592d[_0x7603('0x67')];});return db['MailQueue'][_0x7603('0x54')]({'where':{'id':_0x4efdfb[_0x7603('0x48')]['id']}})['then'](function(_0xddb815){return db['sequelize'][_0x7603('0x6a')](function(_0xe369cb){return _0xddb815[_0x7603('0x65')](_0x4d576f,{'transaction':_0xe369cb})[_0x7603('0x25')](function(){return BPromise['each'](_0x5d56e1,function(_0x38057){return db[_0x7603('0x59')][_0x7603('0x6b')]({'where':{'UserId':_0x38057['id'],'MailQueueId':_0x4efdfb[_0x7603('0x48')]['id']},'transaction':_0xe369cb});});})[_0x7603('0x25')](function(){_0x5d56e1[_0x7603('0x6c')](function(_0x569a1d){socket[_0x7603('0x6d')](_0x7603('0x6e'),{'UserId':_0x569a1d['id'],'MailQueueId':_0xddb815['id']});});});});});}})[_0x7603('0x25')](respondWithStatusCode(_0x215df0,null))[_0x7603('0x4a')](handleError(_0x215df0,null));};exports[_0x7603('0x6f')]=function(_0x238108,_0x59637f,_0x55e129){return db[_0x7603('0x64')][_0x7603('0x46')]({'where':{'id':_0x238108[_0x7603('0x33')][_0x7603('0x66')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x7603('0x67'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x59637f,null))[_0x7603('0x25')](function(_0x79eb4a){var _0xca392f=_[_0x7603('0x32')](_0x79eb4a,'id');var _0x2d884b=[];var _0x580b1e=[];var _0x32e8fb=squel['select']();_0x32e8fb[_0x7603('0x70')]('tq.TeamId')[_0x7603('0x71')](_0x7603('0x72'),'tq')[_0x7603('0x73')](_0x7603('0x74'),'ut',_0x7603('0x75'))[_0x7603('0x40')](_0x7603('0x76'),_0x238108['params']['id']);for(var _0x1e08c3=0x0;_0x1e08c3<_0x79eb4a['length'];_0x1e08c3+=0x1){let _0x57cd92=_0x79eb4a[_0x1e08c3];for(var _0x3d1d2c=0x0;_0x3d1d2c<_0x57cd92[_0x7603('0x67')][_0x7603('0x39')];_0x3d1d2c+=0x1){let _0x2bc08a=_0x57cd92[_0x7603('0x67')][_0x3d1d2c];var _0x6a437a=_0x32e8fb[_0x7603('0x77')]();_0x6a437a['where'](_0x7603('0x78'),_0x2bc08a['id']);_0x580b1e[_0x7603('0x79')](db[_0x7603('0x7a')][_0x7603('0x33')](_0x6a437a['toString'](),{'type':db[_0x7603('0x7a')][_0x7603('0x7b')][_0x7603('0x7c')]})[_0x7603('0x25')](function(_0x6bae35){if(_0x6bae35['length']===0x1){return _0x2bc08a['id'];}else{var _0x58c9c3=_['every'](_[_0x7603('0x32')](_0x6bae35,_0x7603('0x7d')),function(_0x498c4f){return _[_0x7603('0x7e')](_0xca392f,_0x498c4f);});if(_0x58c9c3){return _0x2bc08a['id'];}}}));}}return BPromise[_0x7603('0x7f')](_0x580b1e)[_0x7603('0x25')](function(_0x39ed4a){_0x2d884b=_(_0x2d884b)[_0x7603('0x80')](_0x39ed4a)['compact']()[_0x7603('0x81')]();return db[_0x7603('0x43')][_0x7603('0x54')]({'where':{'id':_0x238108[_0x7603('0x48')]['id']}})[_0x7603('0x25')](function(_0x4c08f1){return db[_0x7603('0x7a')][_0x7603('0x6a')](function(_0x2a7d00){return _0x4c08f1[_0x7603('0x6f')](_0x238108['query'][_0x7603('0x66')],{'transaction':_0x2a7d00})[_0x7603('0x25')](function(){if(!_[_0x7603('0x82')](_0x2d884b)){return _0x4c08f1['removeAgents'](_0x2d884b,{'transaction':_0x2a7d00});}})[_0x7603('0x25')](function(){_0x2d884b[_0x7603('0x6c')](function(_0x2a4866){socket['emit'](_0x7603('0x83'),{'UserId':_0x2a4866,'MailQueueId':_0x4c08f1['id']});});});});});});})[_0x7603('0x25')](respondWithStatusCode(_0x59637f,null))[_0x7603('0x4a')](handleError(_0x59637f,null));};exports[_0x7603('0x84')]=function(_0x3b8551,_0x5b1a69,_0x121594){return db[_0x7603('0x43')]['find']({'where':{'id':_0x3b8551[_0x7603('0x48')]['id']}})[_0x7603('0x25')](handleEntityNotFound(_0x5b1a69,null))[_0x7603('0x25')](function(_0x49736c){if(_0x49736c){return _0x49736c[_0x7603('0x84')](_0x3b8551['body']['ids'],_['omit'](_0x3b8551[_0x7603('0x4c')],['ids','id'])||{})[_0x7603('0x85')](function(_0x4e9a56){for(var _0x21dc6f=0x0;_0x21dc6f<_0x3b8551[_0x7603('0x4c')][_0x7603('0x66')][_0x7603('0x39')];_0x21dc6f+=0x1){socket['emit'](_0x7603('0x6e'),{'UserId':Number(_0x3b8551[_0x7603('0x4c')][_0x7603('0x66')][_0x21dc6f]),'MailQueueId':Number(_0x3b8551[_0x7603('0x48')]['id'])});}return _0x4e9a56;});}})[_0x7603('0x25')](respondWithResult(_0x5b1a69,null))[_0x7603('0x4a')](handleError(_0x5b1a69,null));};exports[_0x7603('0x86')]=function(_0x43159d,_0x531784,_0xfea60e){return db[_0x7603('0x43')][_0x7603('0x54')]({'where':{'id':_0x43159d[_0x7603('0x48')]['id']}})[_0x7603('0x25')](handleEntityNotFound(_0x531784,null))[_0x7603('0x25')](function(_0x32e6e6){if(_0x32e6e6){return _0x32e6e6[_0x7603('0x86')](_0x43159d[_0x7603('0x33')][_0x7603('0x66')])['then'](function(){if(_['isArray'](_0x43159d['query'][_0x7603('0x66')])){for(var _0x2b4cc9=0x0;_0x2b4cc9<_0x43159d[_0x7603('0x33')][_0x7603('0x66')][_0x7603('0x39')];_0x2b4cc9+=0x1){socket[_0x7603('0x6d')](_0x7603('0x83'),{'UserId':Number(_0x43159d[_0x7603('0x33')][_0x7603('0x66')][_0x2b4cc9]),'MailQueueId':Number(_0x43159d['params']['id'])});}}else{socket[_0x7603('0x6d')](_0x7603('0x83'),{'UserId':Number(_0x43159d[_0x7603('0x33')][_0x7603('0x66')]),'MailQueueId':Number(_0x43159d[_0x7603('0x48')]['id'])});}});}})['then'](respondWithStatusCode(_0x531784,null))[_0x7603('0x4a')](handleError(_0x531784,null));};exports['getAgents']=function(_0x2ef341,_0x394952,_0xd25dc9){var _0x345c8d={};var _0xcf956c={};var _0x5c0d14;var _0x4961ce;return db[_0x7603('0x43')][_0x7603('0x58')]({'where':{'id':_0x2ef341[_0x7603('0x48')]['id']}})[_0x7603('0x25')](handleEntityNotFound(_0x394952,null))[_0x7603('0x25')](function(_0x3e33e3){if(_0x3e33e3){_0x5c0d14=_0x3e33e3;_0xcf956c['model']=_[_0x7603('0x34')](db[_0x7603('0x5b')][_0x7603('0x2d')]);_0xcf956c[_0x7603('0x33')]=_[_0x7603('0x34')](_0x2ef341[_0x7603('0x33')]);_0xcf956c[_0x7603('0x35')]=_[_0x7603('0x36')](_0xcf956c[_0x7603('0x31')],_0xcf956c[_0x7603('0x33')]);_0x345c8d['attributes']=_[_0x7603('0x36')](_0xcf956c[_0x7603('0x31')],qs[_0x7603('0x37')](_0x2ef341[_0x7603('0x33')][_0x7603('0x37')]));_0x345c8d[_0x7603('0x38')]=_0x345c8d[_0x7603('0x38')][_0x7603('0x39')]?_0x345c8d[_0x7603('0x38')]:_0xcf956c[_0x7603('0x31')];_0x345c8d[_0x7603('0x3c')]=qs[_0x7603('0x3d')](_0x2ef341[_0x7603('0x33')]['sort']);_0x345c8d[_0x7603('0x40')]=qs['filters'](_['pick'](_0x2ef341[_0x7603('0x33')],_0xcf956c[_0x7603('0x35')]));if(_0x2ef341[_0x7603('0x33')][_0x7603('0x3f')]){_0x345c8d[_0x7603('0x40')]=_[_0x7603('0x41')](_0x345c8d['where'],{'$or':_[_0x7603('0x32')](_0x345c8d[_0x7603('0x38')],function(_0xf43b7f){var _0xfd7b9a={};_0xfd7b9a[_0xf43b7f]={'$like':'%'+_0x2ef341[_0x7603('0x33')][_0x7603('0x3f')]+'%'};return _0xfd7b9a;})});}_0x345c8d=_['merge']({},_0x345c8d,_0x2ef341[_0x7603('0x49')]);return _0x5c0d14[_0x7603('0x87')](_0x345c8d);}})[_0x7603('0x25')](function(_0x65d1a7){if(_0x65d1a7){_0x4961ce=_0x65d1a7[_0x7603('0x39')];if(!_0x2ef341[_0x7603('0x33')][_0x7603('0x3a')](_0x7603('0x3b'))){_0x345c8d[_0x7603('0x1f')]=qs[_0x7603('0x1f')](_0x2ef341[_0x7603('0x33')][_0x7603('0x1f')]);_0x345c8d['offset']=qs[_0x7603('0x1d')](_0x2ef341[_0x7603('0x33')][_0x7603('0x1d')]);}return _0x5c0d14[_0x7603('0x87')](_0x345c8d);}})[_0x7603('0x25')](function(_0x345685){if(_0x345685){return _0x345685?{'count':_0x4961ce,'rows':_0x345685}:null;}})[_0x7603('0x25')](respondWithResult(_0x394952,null))[_0x7603('0x4a')](handleError(_0x394952,null));}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.events.js b/server/api/mailQueue/mailQueue.events.js index c52e771..345a549 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 _0x8c86=['save','remove','emit','hasOwnProperty','hook','events','../../mysqldb','MailQueue','setMaxListeners'];(function(_0x4333be,_0x5276a7){var _0x2489a0=function(_0x1736fb){while(--_0x1736fb){_0x4333be['push'](_0x4333be['shift']());}};_0x2489a0(++_0x5276a7);}(_0x8c86,0x191));var _0x68c8=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0x8c86[_0x618414];return _0x21c19a;};'use strict';var EventEmitter=require(_0x68c8('0x0'));var MailQueue=require(_0x68c8('0x1'))['db'][_0x68c8('0x2')];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0x68c8('0x3')](0x0);var events={'afterCreate':_0x68c8('0x4'),'afterUpdate':'update','afterDestroy':_0x68c8('0x5')};function emitEvent(_0x2500fd){return function(_0xda403a,_0x59e534,_0x46ec56){MailQueueEvents['emit'](_0x2500fd+':'+_0xda403a['id'],_0xda403a);MailQueueEvents[_0x68c8('0x6')](_0x2500fd,_0xda403a);_0x46ec56(null);};}for(var e in events){if(events[_0x68c8('0x7')](e)){var event=events[e];MailQueue[_0x68c8('0x8')](e,emitEvent(event));}}module['exports']=MailQueueEvents; \ No newline at end of file +var _0x1e31=['hasOwnProperty','hook','exports','../../mysqldb','MailQueue','setMaxListeners','save','update','emit'];(function(_0x3e7e96,_0x5683ca){var _0x13f6f0=function(_0x320767){while(--_0x320767){_0x3e7e96['push'](_0x3e7e96['shift']());}};_0x13f6f0(++_0x5683ca);}(_0x1e31,0xd2));var _0x11e3=function(_0x4b1d31,_0x3bcf71){_0x4b1d31=_0x4b1d31-0x0;var _0x4b33ea=_0x1e31[_0x4b1d31];return _0x4b33ea;};'use strict';var EventEmitter=require('events');var MailQueue=require(_0x11e3('0x0'))['db'][_0x11e3('0x1')];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0x11e3('0x2')](0x0);var events={'afterCreate':_0x11e3('0x3'),'afterUpdate':_0x11e3('0x4'),'afterDestroy':'remove'};function emitEvent(_0x3a8f9d){return function(_0x1ff7b8,_0x42167a,_0x37b065){MailQueueEvents[_0x11e3('0x5')](_0x3a8f9d+':'+_0x1ff7b8['id'],_0x1ff7b8);MailQueueEvents[_0x11e3('0x5')](_0x3a8f9d,_0x1ff7b8);_0x37b065(null);};}for(var e in events){if(events[_0x11e3('0x6')](e)){var event=events[e];MailQueue[_0x11e3('0x7')](e,emitEvent(event));}}module[_0x11e3('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 3e2155a..13c306c 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 _0x9080=['define','lodash','util','api','moment','bluebird','rimraf','exports'];(function(_0x4ff108,_0x44a7dc){var _0x453ec3=function(_0x3a2c72){while(--_0x3a2c72){_0x4ff108['push'](_0x4ff108['shift']());}};_0x453ec3(++_0x44a7dc);}(_0x9080,0x81));var _0x0908=function(_0x45122a,_0x55cfdb){_0x45122a=_0x45122a-0x0;var _0x377507=_0x9080[_0x45122a];return _0x377507;};'use strict';var _=require(_0x0908('0x0'));var util=require(_0x0908('0x1'));var logger=require('../../config/logger')(_0x0908('0x2'));var moment=require(_0x0908('0x3'));var BPromise=require(_0x0908('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x0908('0x5'));var config=require('../../config/environment');var attributes=require('./mailQueue.attributes');module[_0x0908('0x6')]=function(_0x2a7d82,_0x5992ae){return _0x2a7d82[_0x0908('0x7')]('MailQueue',attributes,{'tableName':'mail_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd614=['util','../../config/logger','api','moment','bluebird','request-promise','../../config/environment','./mailQueue.attributes','exports','define','mail_queues','lodash'];(function(_0x15bd7b,_0x467199){var _0x1a9989=function(_0xc4bf29){while(--_0xc4bf29){_0x15bd7b['push'](_0x15bd7b['shift']());}};_0x1a9989(++_0x467199);}(_0xd614,0xd7));var _0x4d61=function(_0x1035c1,_0x2d8583){_0x1035c1=_0x1035c1-0x0;var _0x308d67=_0xd614[_0x1035c1];return _0x308d67;};'use strict';var _=require(_0x4d61('0x0'));var util=require(_0x4d61('0x1'));var logger=require(_0x4d61('0x2'))(_0x4d61('0x3'));var moment=require(_0x4d61('0x4'));var BPromise=require(_0x4d61('0x5'));var rp=require(_0x4d61('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x4d61('0x7'));var attributes=require(_0x4d61('0x8'));module[_0x4d61('0x9')]=function(_0x522777,_0x33f28e){return _0x522777[_0x4d61('0xa')]('MailQueue',attributes,{'tableName':_0x4d61('0xb'),'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 27e15fc..930b474 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 _0x6812=['stringify','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','redis','defaults','localhost','socket.io-emitter','./mailQueue.socket','request','then','info','request\x20sent','MailQueue,\x20%s,\x20%s,\x20%s','error','code','message','MailQueue,\x20%s,\x20%s','result','catch','GetMailQueue','MailQueue','options','raw','attributes','limit','include','map','model','debug','find','ShowMailQueue'];(function(_0x8c89f9,_0x3d9c1b){var _0x1a481c=function(_0x150bff){while(--_0x150bff){_0x8c89f9['push'](_0x8c89f9['shift']());}};_0x1a481c(++_0x3d9c1b);}(_0x6812,0x121));var _0x2681=function(_0x5ef8be,_0x50e178){_0x5ef8be=_0x5ef8be-0x0;var _0x3b965e=_0x6812[_0x5ef8be];return _0x3b965e;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x2681('0x0'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2681('0x1'));var db=require(_0x2681('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0x2681('0x3'))(_0x2681('0x4'));var config=require(_0x2681('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x2681('0x6')]['http']({'port':0x232a});config[_0x2681('0x7')]=_[_0x2681('0x8')](config[_0x2681('0x7')],{'host':_0x2681('0x9'),'port':0x18eb});var socket=require(_0x2681('0xa'))(new Redis(config[_0x2681('0x7')]));require(_0x2681('0xb'))['register'](socket);function respondWithRpcPromise(_0xf94dec,_0x5164ab,_0x310b6a){return new BPromise(function(_0x5c0b5d,_0x4d7537){return client[_0x2681('0xc')](_0xf94dec,_0x310b6a)[_0x2681('0xd')](function(_0x13faca){logger[_0x2681('0xe')]('MailQueue,\x20%s,\x20%s',_0x5164ab,_0x2681('0xf'));logger['debug'](_0x2681('0x10'),_0x5164ab,_0x2681('0xf'),JSON['stringify'](_0x13faca));if(_0x13faca[_0x2681('0x11')]){if(_0x13faca[_0x2681('0x11')][_0x2681('0x12')]===0x1f4){logger['error']('MailQueue,\x20%s,\x20%s',_0x5164ab,_0x13faca[_0x2681('0x11')][_0x2681('0x13')]);return _0x4d7537(_0x13faca[_0x2681('0x11')][_0x2681('0x13')]);}logger['error']('MailQueue,\x20%s,\x20%s',_0x5164ab,_0x13faca[_0x2681('0x11')]['message']);return _0x5c0b5d(_0x13faca[_0x2681('0x11')]['message']);}else{logger[_0x2681('0xe')](_0x2681('0x14'),_0x5164ab,_0x2681('0xf'));_0x5c0b5d(_0x13faca[_0x2681('0x15')]['message']);}})[_0x2681('0x16')](function(_0x5b26dc){logger['error'](_0x2681('0x14'),_0x5164ab,_0x5b26dc);_0x4d7537(_0x5b26dc);});});}exports[_0x2681('0x17')]=function(_0x3f2cc1){var _0x1bcc90=this;return new Promise(function(_0x2c2130,_0x551bc8){return db[_0x2681('0x18')]['findAll']({'raw':_0x3f2cc1[_0x2681('0x19')]?_0x3f2cc1[_0x2681('0x19')][_0x2681('0x1a')]===undefined?!![]:![]:!![],'where':_0x3f2cc1['options']?_0x3f2cc1['options']['where']||null:null,'attributes':_0x3f2cc1[_0x2681('0x19')]?_0x3f2cc1[_0x2681('0x19')][_0x2681('0x1b')]||null:null,'limit':_0x3f2cc1[_0x2681('0x19')]?_0x3f2cc1[_0x2681('0x19')][_0x2681('0x1c')]||null:null,'include':_0x3f2cc1[_0x2681('0x19')]?_0x3f2cc1[_0x2681('0x19')][_0x2681('0x1d')]?_[_0x2681('0x1e')](_0x3f2cc1['options']['include'],function(_0x3a67e9){return{'model':db[_0x3a67e9[_0x2681('0x1f')]],'as':_0x3a67e9['as'],'attributes':_0x3a67e9[_0x2681('0x1b')],'include':_0x3a67e9[_0x2681('0x1d')]?_[_0x2681('0x1e')](_0x3a67e9['include'],function(_0x371edc){return{'model':db[_0x371edc['model']],'as':_0x371edc['as'],'attributes':_0x371edc[_0x2681('0x1b')],'include':_0x371edc[_0x2681('0x1d')]?_[_0x2681('0x1e')](_0x371edc[_0x2681('0x1d')],function(_0x132c66){return{'model':db[_0x132c66['model']],'as':_0x132c66['as'],'attributes':_0x132c66[_0x2681('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x44588d){logger[_0x2681('0xe')]('GetMailQueue',_0x3f2cc1);logger[_0x2681('0x20')](_0x2681('0x17'),_0x3f2cc1,JSON['stringify'](_0x44588d));_0x2c2130(_0x44588d);})[_0x2681('0x16')](function(_0x32b23a){logger[_0x2681('0x11')](_0x2681('0x17'),_0x32b23a[_0x2681('0x13')],_0x3f2cc1);_0x551bc8(_0x1bcc90['error'](0x1f4,_0x32b23a['message']));});});};exports['ShowMailQueue']=function(_0x17f6ff){var _0x150a19=this;return new Promise(function(_0x3dadbd,_0x2fc5d1){return db['MailQueue'][_0x2681('0x21')]({'raw':_0x17f6ff[_0x2681('0x19')]?_0x17f6ff[_0x2681('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x17f6ff[_0x2681('0x19')]?_0x17f6ff[_0x2681('0x19')]['where']||null:null,'attributes':_0x17f6ff[_0x2681('0x19')]?_0x17f6ff[_0x2681('0x19')][_0x2681('0x1b')]||null:null,'include':_0x17f6ff[_0x2681('0x19')]?_0x17f6ff[_0x2681('0x19')][_0x2681('0x1d')]?_['map'](_0x17f6ff[_0x2681('0x19')][_0x2681('0x1d')],function(_0x19a5f9){return{'model':db[_0x19a5f9[_0x2681('0x1f')]],'as':_0x19a5f9['as'],'attributes':_0x19a5f9[_0x2681('0x1b')],'include':_0x19a5f9['include']?_['map'](_0x19a5f9['include'],function(_0x2442fc){return{'model':db[_0x2442fc['model']],'as':_0x2442fc['as'],'attributes':_0x2442fc[_0x2681('0x1b')],'include':_0x2442fc[_0x2681('0x1d')]?_['map'](_0x2442fc[_0x2681('0x1d')],function(_0x557acf){return{'model':db[_0x557acf[_0x2681('0x1f')]],'as':_0x557acf['as'],'attributes':_0x557acf[_0x2681('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x2681('0xd')](function(_0x38605c){logger[_0x2681('0xe')](_0x2681('0x22'),_0x17f6ff);logger[_0x2681('0x20')](_0x2681('0x22'),_0x17f6ff,JSON[_0x2681('0x23')](_0x38605c));_0x3dadbd(_0x38605c);})[_0x2681('0x16')](function(_0x2d2da1){logger[_0x2681('0x11')](_0x2681('0x22'),_0x2d2da1['message'],_0x17f6ff);_0x2fc5d1(_0x150a19[_0x2681('0x11')](0x1f4,_0x2d2da1[_0x2681('0x13')]));});});}; \ No newline at end of file +var _0xc474=['MailQueue','findAll','options','where','attributes','limit','include','model','map','debug','find','ShowMailQueue','lodash','util','randomstring','ioredis','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','then','info','request\x20sent','stringify','error','MailQueue,\x20%s,\x20%s','message','result','catch','GetMailQueue'];(function(_0x50a1f6,_0x238fd8){var _0x84f8d4=function(_0x2d9586){while(--_0x2d9586){_0x50a1f6['push'](_0x50a1f6['shift']());}};_0x84f8d4(++_0x238fd8);}(_0xc474,0x174));var _0x4c47=function(_0x2aec52,_0x59d962){_0x2aec52=_0x2aec52-0x0;var _0x3b8835=_0xc474[_0x2aec52];return _0x3b8835;};'use strict';var _=require(_0x4c47('0x0'));var util=require(_0x4c47('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x4c47('0x2'));var fs=require('fs');var Redis=require(_0x4c47('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x4c47('0x4'))(_0x4c47('0x5'));var config=require('../../config/environment');var jayson=require(_0x4c47('0x6'));var client=jayson[_0x4c47('0x7')][_0x4c47('0x8')]({'port':0x232a});config[_0x4c47('0x9')]=_[_0x4c47('0xa')](config[_0x4c47('0x9')],{'host':_0x4c47('0xb'),'port':0x18eb});var socket=require(_0x4c47('0xc'))(new Redis(config['redis']));require('./mailQueue.socket')[_0x4c47('0xd')](socket);function respondWithRpcPromise(_0x5ec90f,_0x5ab709,_0x97e60){return new BPromise(function(_0x40583b,_0x44cbb6){return client['request'](_0x5ec90f,_0x97e60)[_0x4c47('0xe')](function(_0x1a2973){logger[_0x4c47('0xf')]('MailQueue,\x20%s,\x20%s',_0x5ab709,'request\x20sent');logger['debug']('MailQueue,\x20%s,\x20%s,\x20%s',_0x5ab709,_0x4c47('0x10'),JSON[_0x4c47('0x11')](_0x1a2973));if(_0x1a2973[_0x4c47('0x12')]){if(_0x1a2973[_0x4c47('0x12')]['code']===0x1f4){logger[_0x4c47('0x12')](_0x4c47('0x13'),_0x5ab709,_0x1a2973[_0x4c47('0x12')][_0x4c47('0x14')]);return _0x44cbb6(_0x1a2973[_0x4c47('0x12')][_0x4c47('0x14')]);}logger['error'](_0x4c47('0x13'),_0x5ab709,_0x1a2973[_0x4c47('0x12')][_0x4c47('0x14')]);return _0x40583b(_0x1a2973['error'][_0x4c47('0x14')]);}else{logger['info'](_0x4c47('0x13'),_0x5ab709,_0x4c47('0x10'));_0x40583b(_0x1a2973[_0x4c47('0x15')]['message']);}})[_0x4c47('0x16')](function(_0x24e4f4){logger['error'](_0x4c47('0x13'),_0x5ab709,_0x24e4f4);_0x44cbb6(_0x24e4f4);});});}exports[_0x4c47('0x17')]=function(_0x40d70b){var _0x41bfff=this;return new Promise(function(_0x1713ce,_0x342453){return db[_0x4c47('0x18')][_0x4c47('0x19')]({'raw':_0x40d70b[_0x4c47('0x1a')]?_0x40d70b['options']['raw']===undefined?!![]:![]:!![],'where':_0x40d70b['options']?_0x40d70b[_0x4c47('0x1a')][_0x4c47('0x1b')]||null:null,'attributes':_0x40d70b[_0x4c47('0x1a')]?_0x40d70b[_0x4c47('0x1a')][_0x4c47('0x1c')]||null:null,'limit':_0x40d70b[_0x4c47('0x1a')]?_0x40d70b[_0x4c47('0x1a')][_0x4c47('0x1d')]||null:null,'include':_0x40d70b[_0x4c47('0x1a')]?_0x40d70b['options']['include']?_['map'](_0x40d70b[_0x4c47('0x1a')][_0x4c47('0x1e')],function(_0x1cf25a){return{'model':db[_0x1cf25a[_0x4c47('0x1f')]],'as':_0x1cf25a['as'],'attributes':_0x1cf25a[_0x4c47('0x1c')],'include':_0x1cf25a['include']?_[_0x4c47('0x20')](_0x1cf25a['include'],function(_0x58ae1a){return{'model':db[_0x58ae1a[_0x4c47('0x1f')]],'as':_0x58ae1a['as'],'attributes':_0x58ae1a[_0x4c47('0x1c')],'include':_0x58ae1a['include']?_['map'](_0x58ae1a[_0x4c47('0x1e')],function(_0x18f71a){return{'model':db[_0x18f71a[_0x4c47('0x1f')]],'as':_0x18f71a['as'],'attributes':_0x18f71a[_0x4c47('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x4c47('0xe')](function(_0x1904f8){logger[_0x4c47('0xf')](_0x4c47('0x17'),_0x40d70b);logger[_0x4c47('0x21')]('GetMailQueue',_0x40d70b,JSON[_0x4c47('0x11')](_0x1904f8));_0x1713ce(_0x1904f8);})[_0x4c47('0x16')](function(_0x99033e){logger[_0x4c47('0x12')]('GetMailQueue',_0x99033e[_0x4c47('0x14')],_0x40d70b);_0x342453(_0x41bfff['error'](0x1f4,_0x99033e['message']));});});};exports['ShowMailQueue']=function(_0x2655f5){var _0x6db13d=this;return new Promise(function(_0x11b096,_0x367e0d){return db['MailQueue'][_0x4c47('0x22')]({'raw':_0x2655f5[_0x4c47('0x1a')]?_0x2655f5[_0x4c47('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x2655f5[_0x4c47('0x1a')]?_0x2655f5[_0x4c47('0x1a')][_0x4c47('0x1b')]||null:null,'attributes':_0x2655f5[_0x4c47('0x1a')]?_0x2655f5[_0x4c47('0x1a')][_0x4c47('0x1c')]||null:null,'include':_0x2655f5[_0x4c47('0x1a')]?_0x2655f5[_0x4c47('0x1a')][_0x4c47('0x1e')]?_[_0x4c47('0x20')](_0x2655f5[_0x4c47('0x1a')][_0x4c47('0x1e')],function(_0x19775e){return{'model':db[_0x19775e[_0x4c47('0x1f')]],'as':_0x19775e['as'],'attributes':_0x19775e[_0x4c47('0x1c')],'include':_0x19775e['include']?_[_0x4c47('0x20')](_0x19775e[_0x4c47('0x1e')],function(_0x57229e){return{'model':db[_0x57229e[_0x4c47('0x1f')]],'as':_0x57229e['as'],'attributes':_0x57229e[_0x4c47('0x1c')],'include':_0x57229e['include']?_[_0x4c47('0x20')](_0x57229e['include'],function(_0x2a4b7f){return{'model':db[_0x2a4b7f[_0x4c47('0x1f')]],'as':_0x2a4b7f['as'],'attributes':_0x2a4b7f['attributes']};}):[]};}):[]};}):[]:[]})[_0x4c47('0xe')](function(_0x5c9a23){logger[_0x4c47('0xf')](_0x4c47('0x23'),_0x2655f5);logger[_0x4c47('0x21')](_0x4c47('0x23'),_0x2655f5,JSON[_0x4c47('0x11')](_0x5c9a23));_0x11b096(_0x5c9a23);})[_0x4c47('0x16')](function(_0x20aae7){logger[_0x4c47('0x12')]('ShowMailQueue',_0x20aae7[_0x4c47('0x14')],_0x2655f5);_0x367e0d(_0x6db13d[_0x4c47('0x12')](0x1f4,_0x20aae7[_0x4c47('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.socket.js b/server/api/mailQueue/mailQueue.socket.js index 7cc6c1c..565cf4d 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 _0x26c6=['save','emit','removeListener','register','length','mailQueue:','./mailQueue.events'];(function(_0x39bd35,_0x48376a){var _0x1537c1=function(_0x4941a4){while(--_0x4941a4){_0x39bd35['push'](_0x39bd35['shift']());}};_0x1537c1(++_0x48376a);}(_0x26c6,0x84));var _0x626c=function(_0x2bf881,_0x33da36){_0x2bf881=_0x2bf881-0x0;var _0x1f4d6e=_0x26c6[_0x2bf881];return _0x1f4d6e;};'use strict';var MailQueueEvents=require(_0x626c('0x0'));var events=[_0x626c('0x1'),'remove','update'];function createListener(_0x725655,_0x4b26da){return function(_0x567e25){_0x4b26da[_0x626c('0x2')](_0x725655,_0x567e25);};}function removeListener(_0x591eb2,_0x4e51ce){return function(){MailQueueEvents[_0x626c('0x3')](_0x591eb2,_0x4e51ce);};}exports[_0x626c('0x4')]=function(_0x1396bd){for(var _0x407c84=0x0,_0x47d941=events[_0x626c('0x5')];_0x407c84<_0x47d941;_0x407c84++){var _0x161cac=events[_0x407c84];var _0x2e8d70=createListener(_0x626c('0x6')+_0x161cac,_0x1396bd);MailQueueEvents['on'](_0x161cac,_0x2e8d70);}}; \ No newline at end of file +var _0xfcc8=['remove','update','removeListener','length','mailQueue:','./mailQueue.events','save'];(function(_0x275168,_0xe33f88){var _0x4a6013=function(_0x1babcd){while(--_0x1babcd){_0x275168['push'](_0x275168['shift']());}};_0x4a6013(++_0xe33f88);}(_0xfcc8,0xb4));var _0x8fcc=function(_0x19b5f1,_0x28c33b){_0x19b5f1=_0x19b5f1-0x0;var _0x31a5dc=_0xfcc8[_0x19b5f1];return _0x31a5dc;};'use strict';var MailQueueEvents=require(_0x8fcc('0x0'));var events=[_0x8fcc('0x1'),_0x8fcc('0x2'),_0x8fcc('0x3')];function createListener(_0x5e3eb2,_0x39681c){return function(_0x5bed54){_0x39681c['emit'](_0x5e3eb2,_0x5bed54);};}function removeListener(_0x464bda,_0x5915c5){return function(){MailQueueEvents[_0x8fcc('0x4')](_0x464bda,_0x5915c5);};}exports['register']=function(_0x423ef8){for(var _0x22dec9=0x0,_0xd44c17=events[_0x8fcc('0x5')];_0x22dec9<_0xd44c17;_0x22dec9++){var _0x310cad=events[_0x22dec9];var _0x1c8b19=createListener(_0x8fcc('0x6')+_0x310cad,_0x423ef8);MailQueueEvents['on'](_0x310cad,_0x1c8b19);}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/index.js b/server/api/mailQueueReport/index.js index 11cc221..061d38f 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 _0x4e24=['../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','post','put','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x474acf,_0x4582ea){var _0x3f4236=function(_0x4d6f70){while(--_0x4d6f70){_0x474acf['push'](_0x474acf['shift']());}};_0x3f4236(++_0x4582ea);}(_0x4e24,0x141));var _0x44e2=function(_0x3cf137,_0x53afd6){_0x3cf137=_0x3cf137-0x0;var _0x99e579=_0x4e24[_0x3cf137];return _0x99e579;};'use strict';var multer=require(_0x44e2('0x0'));var util=require(_0x44e2('0x1'));var path=require(_0x44e2('0x2'));var timeout=require(_0x44e2('0x3'));var express=require(_0x44e2('0x4'));var router=express[_0x44e2('0x5')]();var fs_extra=require(_0x44e2('0x6'));var auth=require(_0x44e2('0x7'));var interaction=require(_0x44e2('0x8'));var config=require(_0x44e2('0x9'));var controller=require('./mailQueueReport.controller');router[_0x44e2('0xa')]('/',auth[_0x44e2('0xb')](),controller[_0x44e2('0xc')]);router[_0x44e2('0xa')](_0x44e2('0xd'),auth[_0x44e2('0xb')](),controller[_0x44e2('0xe')]);router[_0x44e2('0xa')](_0x44e2('0xf'),auth[_0x44e2('0xb')](),controller[_0x44e2('0x10')]);router[_0x44e2('0x11')]('/',auth[_0x44e2('0xb')](),controller['create']);router[_0x44e2('0x12')](_0x44e2('0xf'),auth[_0x44e2('0xb')](),controller['update']);router[_0x44e2('0x13')](_0x44e2('0xf'),auth[_0x44e2('0xb')](),controller[_0x44e2('0x14')]);module[_0x44e2('0x15')]=router; \ No newline at end of file +var _0xc570=['../../config/environment','./mailQueueReport.controller','index','get','/describe','isAuthenticated','/:id','show','create','update','delete','destroy','multer','path','connect-timeout','express','fs-extra','../../components/interaction/service'];(function(_0x81f727,_0x281765){var _0x1aff90=function(_0x1a8c2d){while(--_0x1a8c2d){_0x81f727['push'](_0x81f727['shift']());}};_0x1aff90(++_0x281765);}(_0xc570,0x12c));var _0x0c57=function(_0x5783f4,_0x4a9e0a){_0x5783f4=_0x5783f4-0x0;var _0x28e380=_0xc570[_0x5783f4];return _0x28e380;};'use strict';var multer=require(_0x0c57('0x0'));var util=require('util');var path=require(_0x0c57('0x1'));var timeout=require(_0x0c57('0x2'));var express=require(_0x0c57('0x3'));var router=express['Router']();var fs_extra=require(_0x0c57('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x0c57('0x5'));var config=require(_0x0c57('0x6'));var controller=require(_0x0c57('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x0c57('0x8')]);router[_0x0c57('0x9')](_0x0c57('0xa'),auth[_0x0c57('0xb')](),controller['describe']);router['get'](_0x0c57('0xc'),auth['isAuthenticated'](),controller[_0x0c57('0xd')]);router['post']('/',auth[_0x0c57('0xb')](),controller[_0x0c57('0xe')]);router['put'](_0x0c57('0xc'),auth[_0x0c57('0xb')](),controller[_0x0c57('0xf')]);router[_0x0c57('0x10')](_0x0c57('0xc'),auth['isAuthenticated'](),controller[_0x0c57('0x11')]);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 3f610e9..5cbdfac 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 _0xea1c=['exports','STRING','DATE','moment'];(function(_0x1b108f,_0x3bb10a){var _0x5d3693=function(_0x402b70){while(--_0x402b70){_0x1b108f['push'](_0x1b108f['shift']());}};_0x5d3693(++_0x3bb10a);}(_0xea1c,0xdb));var _0xcea1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xea1c[_0x3dd15e];return _0x231fd0;};'use strict';var moment=require(_0xcea1('0x0'));var Sequelize=require('sequelize');module[_0xcea1('0x1')]={'uniqueid':{'type':Sequelize[_0xcea1('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0xcea1('0x2')]},'joinAt':{'type':Sequelize[_0xcea1('0x3')]},'leaveAt':{'type':Sequelize[_0xcea1('0x3')]},'acceptAt':{'type':Sequelize[_0xcea1('0x3')]},'exitAt':{'type':Sequelize[_0xcea1('0x3')]},'reason':{'type':Sequelize[_0xcea1('0x2')]}}; \ No newline at end of file +var _0x2cbd=['moment','sequelize','exports','STRING','DATE'];(function(_0x5a776b,_0x46f785){var _0xbbef59=function(_0x38313e){while(--_0x38313e){_0x5a776b['push'](_0x5a776b['shift']());}};_0xbbef59(++_0x46f785);}(_0x2cbd,0x1ea));var _0xd2cb=function(_0x4953da,_0x5adaca){_0x4953da=_0x4953da-0x0;var _0x2d3780=_0x2cbd[_0x4953da];return _0x2d3780;};'use strict';var moment=require(_0xd2cb('0x0'));var Sequelize=require(_0xd2cb('0x1'));module[_0xd2cb('0x2')]={'uniqueid':{'type':Sequelize[_0xd2cb('0x3')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0xd2cb('0x4')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0xd2cb('0x4')]},'reason':{'type':Sequelize[_0xd2cb('0x3')]}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.controller.js b/server/api/mailQueueReport/mailQueueReport.controller.js index 6030021..5dce24d 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 _0x66fa=['end','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','rawAttributes','type','key','map','query','keys','intersection','attributes','fields','length','model','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','VIRTUAL','includeAll','include','MailQueueReport','findAll','rows','catch','merge','options','find','create','body','params','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','ioredis','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util'];(function(_0xb0f7c3,_0x4eae95){var _0x28ea68=function(_0x4395a7){while(--_0x4395a7){_0xb0f7c3['push'](_0xb0f7c3['shift']());}};_0x28ea68(++_0x4eae95);}(_0x66fa,0x117));var _0xa66f=function(_0x175076,_0x4626c2){_0x175076=_0x175076-0x0;var _0x3b8091=_0x66fa[_0x175076];return _0x3b8091;};'use strict';var emlformat=require(_0xa66f('0x0'));var rimraf=require(_0xa66f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa66f('0x2'));var rp=require(_0xa66f('0x3'));var moment=require(_0xa66f('0x4'));var BPromise=require(_0xa66f('0x5'));var Mustache=require(_0xa66f('0x6'));var util=require(_0xa66f('0x7'));var path=require(_0xa66f('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xa66f('0x9'));var fs=require('fs');var fs_extra=require(_0xa66f('0xa'));var _=require(_0xa66f('0xb'));var squel=require(_0xa66f('0xc'));var crypto=require(_0xa66f('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xa66f('0xe'));var toCsv=require('to-csv');var querystring=require(_0xa66f('0xf'));var Papa=require('papaparse');var Redis=require(_0xa66f('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa66f('0x11'));var logger=require(_0xa66f('0x12'))('api');var utils=require(_0xa66f('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0xa66f('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x251189,_0x14af70){_0x14af70=_0x14af70||0xcc;return function(_0xca12f8){if(_0xca12f8){return _0x251189['sendStatus'](_0x14af70);}return _0x251189['status'](_0x14af70)[_0xa66f('0x15')]();};}function respondWithResult(_0x4e09cf,_0x528427){_0x528427=_0x528427||0xc8;return function(_0x5a7b16){if(_0x5a7b16){return _0x4e09cf[_0xa66f('0x16')](_0x528427)[_0xa66f('0x17')](_0x5a7b16);}};}function respondWithFilteredResult(_0x267129,_0x236d64){return function(_0xd348f9){if(_0xd348f9){var _0x567d4f=typeof _0x236d64['offset']===_0xa66f('0x18')&&typeof _0x236d64[_0xa66f('0x19')]===_0xa66f('0x18');var _0x403f4d=_0xd348f9['count'];var _0x1cbe64=_0x567d4f?0x0:_0x236d64['offset'];var _0x4a28d4=_0x567d4f?_0xd348f9[_0xa66f('0x1a')]:_0x236d64[_0xa66f('0x1b')]+_0x236d64[_0xa66f('0x19')];var _0x355ddc;if(_0x4a28d4>=_0x403f4d){_0x4a28d4=_0x403f4d;_0x355ddc=0xc8;}else{_0x355ddc=0xce;}_0x267129[_0xa66f('0x16')](_0x355ddc);return _0x267129[_0xa66f('0x1c')](_0xa66f('0x1d'),_0x1cbe64+'-'+_0x4a28d4+'/'+_0x403f4d)[_0xa66f('0x17')](_0xd348f9);}return null;};}function patchUpdates(_0x2033a4){return function(_0x2d9602){try{jsonpatch[_0xa66f('0x1e')](_0x2d9602,_0x2033a4,!![]);}catch(_0xbba376){return BPromise[_0xa66f('0x1f')](_0xbba376);}return _0x2d9602[_0xa66f('0x20')]();};}function saveUpdates(_0x82924d,_0x5cd613){return function(_0x27f570){if(_0x27f570){return _0x27f570[_0xa66f('0x21')](_0x82924d)[_0xa66f('0x22')](function(_0x37ee13){return _0x37ee13;});}return null;};}function removeEntity(_0x5cbd82,_0x337602){return function(_0x473822){if(_0x473822){return _0x473822[_0xa66f('0x23')]()[_0xa66f('0x22')](function(){_0x5cbd82['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0xed98b9,_0x598942){return function(_0x3a3e4f){if(!_0x3a3e4f){_0xed98b9[_0xa66f('0x24')](0x194);}return _0x3a3e4f;};}function handleError(_0x384164,_0x57da7f){_0x57da7f=_0x57da7f||0x1f4;return function(_0x4683c7){logger[_0xa66f('0x25')](_0x4683c7[_0xa66f('0x26')]);if(_0x4683c7[_0xa66f('0x27')]){delete _0x4683c7[_0xa66f('0x27')];}_0x384164[_0xa66f('0x16')](_0x57da7f)[_0xa66f('0x28')](_0x4683c7);};}exports[_0xa66f('0x29')]=function(_0x20ee67,_0x117d03){var _0x45f71c={},_0x63650b={},_0x42b966={'count':0x0,'rows':[]};var _0xeeb22e=_['map'](db['MailQueueReport'][_0xa66f('0x2a')],function(_0x27ceae){return{'name':_0x27ceae['fieldName'],'type':_0x27ceae[_0xa66f('0x2b')][_0xa66f('0x2c')]};});_0x63650b['model']=_[_0xa66f('0x2d')](_0xeeb22e,_0xa66f('0x27'));_0x63650b[_0xa66f('0x2e')]=_[_0xa66f('0x2f')](_0x20ee67[_0xa66f('0x2e')]);_0x63650b['filters']=_[_0xa66f('0x30')](_0x63650b['model'],_0x63650b[_0xa66f('0x2e')]);_0x45f71c[_0xa66f('0x31')]=_[_0xa66f('0x30')](_0x63650b['model'],qs[_0xa66f('0x32')](_0x20ee67[_0xa66f('0x2e')]['fields']));_0x45f71c[_0xa66f('0x31')]=_0x45f71c[_0xa66f('0x31')][_0xa66f('0x33')]?_0x45f71c[_0xa66f('0x31')]:_0x63650b[_0xa66f('0x34')];if(!_0x20ee67[_0xa66f('0x2e')][_0xa66f('0x35')](_0xa66f('0x36'))){_0x45f71c[_0xa66f('0x19')]=qs[_0xa66f('0x19')](_0x20ee67['query'][_0xa66f('0x19')]);_0x45f71c['offset']=qs[_0xa66f('0x1b')](_0x20ee67[_0xa66f('0x2e')][_0xa66f('0x1b')]);}_0x45f71c[_0xa66f('0x37')]=qs[_0xa66f('0x38')](_0x20ee67[_0xa66f('0x2e')][_0xa66f('0x38')]);_0x45f71c[_0xa66f('0x39')]=qs['filters'](_[_0xa66f('0x3a')](_0x20ee67['query'],_0x63650b[_0xa66f('0x3b')]),_0xeeb22e);if(_0x20ee67[_0xa66f('0x2e')][_0xa66f('0x3c')]){_0x45f71c['where']=_['merge'](_0x45f71c[_0xa66f('0x39')],{'$or':_[_0xa66f('0x2d')](_0xeeb22e,function(_0x20b07e){if(_0x20b07e[_0xa66f('0x2b')]!==_0xa66f('0x3d')){var _0x581dca={};_0x581dca[_0x20b07e['name']]={'$like':'%'+_0x20ee67['query'][_0xa66f('0x3c')]+'%'};return _0x581dca;}})});}_0x45f71c=_['merge']({},_0x45f71c,_0x20ee67['options']);var _0x5bf856={'where':_0x45f71c[_0xa66f('0x39')]};return db['MailQueueReport'][_0xa66f('0x1a')](_0x5bf856)[_0xa66f('0x22')](function(_0x23a546){_0x42b966[_0xa66f('0x1a')]=_0x23a546;if(_0x20ee67[_0xa66f('0x2e')][_0xa66f('0x3e')]){_0x45f71c[_0xa66f('0x3f')]=[{'all':!![]}];}return db[_0xa66f('0x40')][_0xa66f('0x41')](_0x45f71c);})[_0xa66f('0x22')](function(_0x3a7929){_0x42b966[_0xa66f('0x42')]=_0x3a7929;return _0x42b966;})[_0xa66f('0x22')](respondWithFilteredResult(_0x117d03,_0x45f71c))[_0xa66f('0x43')](handleError(_0x117d03,null));};exports['show']=function(_0x36037c,_0x25c2cb){var _0x58c1f2={'raw':!![],'where':{'id':_0x36037c['params']['id']}},_0x248587={};_0x248587[_0xa66f('0x34')]=_[_0xa66f('0x2f')](db['MailQueueReport'][_0xa66f('0x2a')]);_0x248587[_0xa66f('0x2e')]=_[_0xa66f('0x2f')](_0x36037c['query']);_0x248587[_0xa66f('0x3b')]=_['intersection'](_0x248587[_0xa66f('0x34')],_0x248587[_0xa66f('0x2e')]);_0x58c1f2[_0xa66f('0x31')]=_[_0xa66f('0x30')](_0x248587[_0xa66f('0x34')],qs[_0xa66f('0x32')](_0x36037c[_0xa66f('0x2e')]['fields']));_0x58c1f2[_0xa66f('0x31')]=_0x58c1f2[_0xa66f('0x31')][_0xa66f('0x33')]?_0x58c1f2[_0xa66f('0x31')]:_0x248587[_0xa66f('0x34')];if(_0x36037c['query']['includeAll']){_0x58c1f2[_0xa66f('0x3f')]=[{'all':!![]}];}_0x58c1f2=_[_0xa66f('0x44')]({},_0x58c1f2,_0x36037c[_0xa66f('0x45')]);return db[_0xa66f('0x40')][_0xa66f('0x46')](_0x58c1f2)[_0xa66f('0x22')](handleEntityNotFound(_0x25c2cb,null))['then'](respondWithResult(_0x25c2cb,null))[_0xa66f('0x43')](handleError(_0x25c2cb,null));};exports[_0xa66f('0x47')]=function(_0x3f9cdd,_0x5651e9){return db['MailQueueReport'][_0xa66f('0x47')](_0x3f9cdd[_0xa66f('0x48')],{})[_0xa66f('0x22')](respondWithResult(_0x5651e9,0xc9))['catch'](handleError(_0x5651e9,null));};exports['update']=function(_0x52054e,_0x19e7ce){if(_0x52054e[_0xa66f('0x48')]['id']){delete _0x52054e[_0xa66f('0x48')]['id'];}return db[_0xa66f('0x40')][_0xa66f('0x46')]({'where':{'id':_0x52054e[_0xa66f('0x49')]['id']}})[_0xa66f('0x22')](handleEntityNotFound(_0x19e7ce,null))[_0xa66f('0x22')](saveUpdates(_0x52054e['body'],null))[_0xa66f('0x22')](respondWithResult(_0x19e7ce,null))[_0xa66f('0x43')](handleError(_0x19e7ce,null));};exports[_0xa66f('0x23')]=function(_0x393755,_0x11597b){return db[_0xa66f('0x40')]['find']({'where':{'id':_0x393755[_0xa66f('0x49')]['id']}})[_0xa66f('0x22')](handleEntityNotFound(_0x11597b,null))[_0xa66f('0x22')](removeEntity(_0x11597b,null))[_0xa66f('0x43')](handleError(_0x11597b,null));};exports[_0xa66f('0x4a')]=function(_0x5d77d1,_0x389b9a){return db['MailQueueReport'][_0xa66f('0x4a')]()['then'](respondWithResult(_0x389b9a,null))['catch'](handleError(_0x389b9a,null));}; \ No newline at end of file +var _0xa46e=['body','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','path','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','json','undefined','limit','offset','set','Content-Range','reject','update','then','destroy','stack','name','send','index','map','MailQueueReport','fieldName','type','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','where','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','rawAttributes','find','create'];(function(_0x18492c,_0x358be0){var _0x2f18b3=function(_0x358d94){while(--_0x358d94){_0x18492c['push'](_0x18492c['shift']());}};_0x2f18b3(++_0x358be0);}(_0xa46e,0x8a));var _0xea46=function(_0x4f0c2b,_0x2c9d14){_0x4f0c2b=_0x4f0c2b-0x0;var _0x526436=_0xa46e[_0x4f0c2b];return _0x526436;};'use strict';var emlformat=require(_0xea46('0x0'));var rimraf=require(_0xea46('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xea46('0x2'));var rp=require(_0xea46('0x3'));var moment=require(_0xea46('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xea46('0x5'));var util=require('util');var path=require(_0xea46('0x6'));var sox=require('sox');var csv=require(_0xea46('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xea46('0x8'));var _=require(_0xea46('0x9'));var squel=require('squel');var crypto=require(_0xea46('0xa'));var jsforce=require(_0xea46('0xb'));var deskjs=require(_0xea46('0xc'));var toCsv=require(_0xea46('0x7'));var querystring=require(_0xea46('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xea46('0xe'));var as=require(_0xea46('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xea46('0x10'))(_0xea46('0x11'));var utils=require(_0xea46('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0xea46('0x13'));var db=require(_0xea46('0x14'))['db'];function respondWithStatusCode(_0x4e10f3,_0x13390c){_0x13390c=_0x13390c||0xcc;return function(_0x1a4fe2){if(_0x1a4fe2){return _0x4e10f3['sendStatus'](_0x13390c);}return _0x4e10f3[_0xea46('0x15')](_0x13390c)['end']();};}function respondWithResult(_0x3024af,_0x42c328){_0x42c328=_0x42c328||0xc8;return function(_0x6c4bc4){if(_0x6c4bc4){return _0x3024af[_0xea46('0x15')](_0x42c328)[_0xea46('0x16')](_0x6c4bc4);}};}function respondWithFilteredResult(_0x2ef436,_0x81ee45){return function(_0x20a79c){if(_0x20a79c){var _0x176ad2=typeof _0x81ee45['offset']===_0xea46('0x17')&&typeof _0x81ee45[_0xea46('0x18')]===_0xea46('0x17');var _0x59f28e=_0x20a79c['count'];var _0x19d5c1=_0x176ad2?0x0:_0x81ee45[_0xea46('0x19')];var _0x5cf5dd=_0x176ad2?_0x20a79c['count']:_0x81ee45[_0xea46('0x19')]+_0x81ee45[_0xea46('0x18')];var _0x4ff93d;if(_0x5cf5dd>=_0x59f28e){_0x5cf5dd=_0x59f28e;_0x4ff93d=0xc8;}else{_0x4ff93d=0xce;}_0x2ef436[_0xea46('0x15')](_0x4ff93d);return _0x2ef436[_0xea46('0x1a')](_0xea46('0x1b'),_0x19d5c1+'-'+_0x5cf5dd+'/'+_0x59f28e)[_0xea46('0x16')](_0x20a79c);}return null;};}function patchUpdates(_0x53b8db){return function(_0x2b6491){try{jsonpatch['apply'](_0x2b6491,_0x53b8db,!![]);}catch(_0x515e32){return BPromise[_0xea46('0x1c')](_0x515e32);}return _0x2b6491['save']();};}function saveUpdates(_0x4cc673,_0x5064d8){return function(_0x3b25fe){if(_0x3b25fe){return _0x3b25fe[_0xea46('0x1d')](_0x4cc673)[_0xea46('0x1e')](function(_0x5beb44){return _0x5beb44;});}return null;};}function removeEntity(_0x16f8fa,_0x59b10d){return function(_0x12e688){if(_0x12e688){return _0x12e688[_0xea46('0x1f')]()['then'](function(){_0x16f8fa[_0xea46('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2b3a8f,_0x114bf9){return function(_0xd4cf78){if(!_0xd4cf78){_0x2b3a8f['sendStatus'](0x194);}return _0xd4cf78;};}function handleError(_0x5d2de1,_0x44e797){_0x44e797=_0x44e797||0x1f4;return function(_0x38ac07){logger['error'](_0x38ac07[_0xea46('0x20')]);if(_0x38ac07['name']){delete _0x38ac07[_0xea46('0x21')];}_0x5d2de1['status'](_0x44e797)[_0xea46('0x22')](_0x38ac07);};}exports[_0xea46('0x23')]=function(_0x6710ae,_0x44517d){var _0x146995={},_0x174345={},_0x4a5149={'count':0x0,'rows':[]};var _0x382bbc=_[_0xea46('0x24')](db[_0xea46('0x25')]['rawAttributes'],function(_0x3e7856){return{'name':_0x3e7856[_0xea46('0x26')],'type':_0x3e7856[_0xea46('0x27')]['key']};});_0x174345['model']=_['map'](_0x382bbc,_0xea46('0x21'));_0x174345[_0xea46('0x28')]=_[_0xea46('0x29')](_0x6710ae[_0xea46('0x28')]);_0x174345[_0xea46('0x2a')]=_[_0xea46('0x2b')](_0x174345[_0xea46('0x2c')],_0x174345[_0xea46('0x28')]);_0x146995[_0xea46('0x2d')]=_[_0xea46('0x2b')](_0x174345[_0xea46('0x2c')],qs['fields'](_0x6710ae[_0xea46('0x28')][_0xea46('0x2e')]));_0x146995[_0xea46('0x2d')]=_0x146995[_0xea46('0x2d')][_0xea46('0x2f')]?_0x146995[_0xea46('0x2d')]:_0x174345[_0xea46('0x2c')];if(!_0x6710ae['query'][_0xea46('0x30')](_0xea46('0x31'))){_0x146995[_0xea46('0x18')]=qs[_0xea46('0x18')](_0x6710ae[_0xea46('0x28')]['limit']);_0x146995['offset']=qs[_0xea46('0x19')](_0x6710ae[_0xea46('0x28')]['offset']);}_0x146995[_0xea46('0x32')]=qs[_0xea46('0x33')](_0x6710ae[_0xea46('0x28')][_0xea46('0x33')]);_0x146995['where']=qs['filters'](_[_0xea46('0x34')](_0x6710ae['query'],_0x174345[_0xea46('0x2a')]),_0x382bbc);if(_0x6710ae[_0xea46('0x28')]['filter']){_0x146995[_0xea46('0x35')]=_[_0xea46('0x36')](_0x146995['where'],{'$or':_[_0xea46('0x24')](_0x382bbc,function(_0xefad3e){if(_0xefad3e['type']!==_0xea46('0x37')){var _0x41e9e8={};_0x41e9e8[_0xefad3e[_0xea46('0x21')]]={'$like':'%'+_0x6710ae[_0xea46('0x28')]['filter']+'%'};return _0x41e9e8;}})});}_0x146995=_[_0xea46('0x36')]({},_0x146995,_0x6710ae[_0xea46('0x38')]);var _0x338c2d={'where':_0x146995[_0xea46('0x35')]};return db[_0xea46('0x25')]['count'](_0x338c2d)[_0xea46('0x1e')](function(_0xdb2e11){_0x4a5149['count']=_0xdb2e11;if(_0x6710ae[_0xea46('0x28')][_0xea46('0x39')]){_0x146995[_0xea46('0x3a')]=[{'all':!![]}];}return db[_0xea46('0x25')]['findAll'](_0x146995);})[_0xea46('0x1e')](function(_0x1cc8f8){_0x4a5149[_0xea46('0x3b')]=_0x1cc8f8;return _0x4a5149;})['then'](respondWithFilteredResult(_0x44517d,_0x146995))[_0xea46('0x3c')](handleError(_0x44517d,null));};exports[_0xea46('0x3d')]=function(_0x2c9491,_0x32c81c){var _0x3164c5={'raw':!![],'where':{'id':_0x2c9491[_0xea46('0x3e')]['id']}},_0xc45d74={};_0xc45d74[_0xea46('0x2c')]=_[_0xea46('0x29')](db[_0xea46('0x25')][_0xea46('0x3f')]);_0xc45d74[_0xea46('0x28')]=_[_0xea46('0x29')](_0x2c9491[_0xea46('0x28')]);_0xc45d74[_0xea46('0x2a')]=_['intersection'](_0xc45d74['model'],_0xc45d74[_0xea46('0x28')]);_0x3164c5[_0xea46('0x2d')]=_[_0xea46('0x2b')](_0xc45d74[_0xea46('0x2c')],qs['fields'](_0x2c9491['query']['fields']));_0x3164c5[_0xea46('0x2d')]=_0x3164c5[_0xea46('0x2d')]['length']?_0x3164c5[_0xea46('0x2d')]:_0xc45d74[_0xea46('0x2c')];if(_0x2c9491[_0xea46('0x28')][_0xea46('0x39')]){_0x3164c5[_0xea46('0x3a')]=[{'all':!![]}];}_0x3164c5=_['merge']({},_0x3164c5,_0x2c9491[_0xea46('0x38')]);return db['MailQueueReport'][_0xea46('0x40')](_0x3164c5)[_0xea46('0x1e')](handleEntityNotFound(_0x32c81c,null))[_0xea46('0x1e')](respondWithResult(_0x32c81c,null))[_0xea46('0x3c')](handleError(_0x32c81c,null));};exports[_0xea46('0x41')]=function(_0x1260d1,_0x36f697){return db['MailQueueReport'][_0xea46('0x41')](_0x1260d1[_0xea46('0x42')],{})['then'](respondWithResult(_0x36f697,0xc9))[_0xea46('0x3c')](handleError(_0x36f697,null));};exports[_0xea46('0x1d')]=function(_0x24d929,_0x548572){if(_0x24d929['body']['id']){delete _0x24d929[_0xea46('0x42')]['id'];}return db[_0xea46('0x25')][_0xea46('0x40')]({'where':{'id':_0x24d929[_0xea46('0x3e')]['id']}})[_0xea46('0x1e')](handleEntityNotFound(_0x548572,null))[_0xea46('0x1e')](saveUpdates(_0x24d929[_0xea46('0x42')],null))[_0xea46('0x1e')](respondWithResult(_0x548572,null))[_0xea46('0x3c')](handleError(_0x548572,null));};exports[_0xea46('0x1f')]=function(_0x48ad1c,_0x2144a0){return db['MailQueueReport'][_0xea46('0x40')]({'where':{'id':_0x48ad1c[_0xea46('0x3e')]['id']}})[_0xea46('0x1e')](handleEntityNotFound(_0x2144a0,null))['then'](removeEntity(_0x2144a0,null))[_0xea46('0x3c')](handleError(_0x2144a0,null));};exports[_0xea46('0x43')]=function(_0x334937,_0x2f49c8){return db['MailQueueReport']['describe']()[_0xea46('0x1e')](respondWithResult(_0x2f49c8,null))[_0xea46('0x3c')](handleError(_0x2f49c8,null));}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.model.js b/server/api/mailQueueReport/mailQueueReport.model.js index 2acec8b..50ba9fb 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 _0x4b33=['MailQueueReport','report_mail_queue','uniqueid','lodash','../../config/logger','moment','bluebird','path','rimraf','./mailQueueReport.attributes','define'];(function(_0x3bb358,_0x2cc123){var _0x3d6604=function(_0x2face9){while(--_0x2face9){_0x3bb358['push'](_0x3bb358['shift']());}};_0x3d6604(++_0x2cc123);}(_0x4b33,0x142));var _0x34b3=function(_0x18056c,_0x3f44af){_0x18056c=_0x18056c-0x0;var _0x55eb61=_0x4b33[_0x18056c];return _0x55eb61;};'use strict';var _=require(_0x34b3('0x0'));var util=require('util');var logger=require(_0x34b3('0x1'))('api');var moment=require(_0x34b3('0x2'));var BPromise=require(_0x34b3('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x34b3('0x4'));var rimraf=require(_0x34b3('0x5'));var config=require('../../config/environment');var attributes=require(_0x34b3('0x6'));module['exports']=function(_0xda485d,_0x54d086){return _0xda485d[_0x34b3('0x7')](_0x34b3('0x8'),attributes,{'tableName':_0x34b3('0x9'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x34b3('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x5f01=['request-promise','path','rimraf','./mailQueueReport.attributes','define','MailQueueReport','uniqueid','api','moment'];(function(_0x3d8638,_0xe27864){var _0xa63e4a=function(_0x210dc0){while(--_0x210dc0){_0x3d8638['push'](_0x3d8638['shift']());}};_0xa63e4a(++_0xe27864);}(_0x5f01,0x1a5));var _0x15f0=function(_0xed3292,_0x464f95){_0xed3292=_0xed3292-0x0;var _0x1d765e=_0x5f01[_0xed3292];return _0x1d765e;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x15f0('0x0'));var moment=require(_0x15f0('0x1'));var BPromise=require('bluebird');var rp=require(_0x15f0('0x2'));var fs=require('fs');var path=require(_0x15f0('0x3'));var rimraf=require(_0x15f0('0x4'));var config=require('../../config/environment');var attributes=require(_0x15f0('0x5'));module['exports']=function(_0x3e82c8,_0x5c23b4){return _0x3e82c8[_0x15f0('0x6')](_0x15f0('0x7'),attributes,{'tableName':'report_mail_queue','paranoid':![],'indexes':[{'name':_0x15f0('0x8'),'fields':[_0x15f0('0x8')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.rpc.js b/server/api/mailQueueReport/mailQueueReport.rpc.js index 1e072da..84134dd 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 _0xdb28=['UpdateMailQueueReport','MailQueueReport','update','raw','where','limit','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','MailQueueReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','catch','CreateMailQueueReport','create','body','options'];(function(_0x283802,_0x29807b){var _0x3104b3=function(_0x22c0a8){while(--_0x22c0a8){_0x283802['push'](_0x283802['shift']());}};_0x3104b3(++_0x29807b);}(_0xdb28,0x106));var _0x8db2=function(_0x2d267c,_0x305642){_0x2d267c=_0x2d267c-0x0;var _0x33305d=_0xdb28[_0x2d267c];return _0x33305d;};'use strict';var _=require(_0x8db2('0x0'));var util=require(_0x8db2('0x1'));var moment=require(_0x8db2('0x2'));var BPromise=require(_0x8db2('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8db2('0x4'));var db=require(_0x8db2('0x5'))['db'];var utils=require(_0x8db2('0x6'));var logger=require(_0x8db2('0x7'))(_0x8db2('0x8'));var config=require('../../config/environment');var jayson=require(_0x8db2('0x9'));var client=jayson[_0x8db2('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x494b40,_0x477f50,_0x46932f){return new BPromise(function(_0x131537,_0x29f698){return client[_0x8db2('0xb')](_0x494b40,_0x46932f)[_0x8db2('0xc')](function(_0x126c78){logger['info'](_0x8db2('0xd'),_0x477f50,_0x8db2('0xe'));logger[_0x8db2('0xf')]('MailQueueReport,\x20%s,\x20%s,\x20%s',_0x477f50,_0x8db2('0xe'),JSON[_0x8db2('0x10')](_0x126c78));if(_0x126c78['error']){if(_0x126c78[_0x8db2('0x11')][_0x8db2('0x12')]===0x1f4){logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x126c78[_0x8db2('0x11')]['message']);return _0x29f698(_0x126c78['error'][_0x8db2('0x13')]);}logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x126c78[_0x8db2('0x11')][_0x8db2('0x13')]);return _0x131537(_0x126c78[_0x8db2('0x11')][_0x8db2('0x13')]);}else{logger[_0x8db2('0x14')](_0x8db2('0xd'),_0x477f50,_0x8db2('0xe'));_0x131537(_0x126c78['result'][_0x8db2('0x13')]);}})[_0x8db2('0x15')](function(_0x48101e){logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x48101e);_0x29f698(_0x48101e);});});}exports[_0x8db2('0x16')]=function(_0x3fddc2){var _0x2efd06=this;return new Promise(function(_0x46ce14,_0x51d60d){return db['MailQueueReport'][_0x8db2('0x17')](_0x3fddc2[_0x8db2('0x18')],{'raw':_0x3fddc2[_0x8db2('0x19')]?_0x3fddc2[_0x8db2('0x19')]['raw']===undefined?!![]:![]:!![]})[_0x8db2('0xc')](function(_0x36a9ff){logger[_0x8db2('0x14')](_0x8db2('0x16'),_0x3fddc2);logger[_0x8db2('0xf')]('CreateMailQueueReport',_0x3fddc2,JSON[_0x8db2('0x10')](_0x36a9ff));_0x46ce14(_0x36a9ff);})[_0x8db2('0x15')](function(_0x18f69c){logger[_0x8db2('0x11')](_0x8db2('0x16'),_0x18f69c[_0x8db2('0x13')],_0x3fddc2);_0x51d60d(_0x2efd06[_0x8db2('0x11')](0x1f4,_0x18f69c['message']));});});};exports[_0x8db2('0x1a')]=function(_0x4f6516){var _0x5725f0=this;return new Promise(function(_0x52a9ca,_0x4d923c){return db[_0x8db2('0x1b')][_0x8db2('0x1c')](_0x4f6516[_0x8db2('0x18')],{'raw':_0x4f6516[_0x8db2('0x19')]?_0x4f6516[_0x8db2('0x19')][_0x8db2('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4f6516['options']?_0x4f6516[_0x8db2('0x19')][_0x8db2('0x1e')]||null:null,'attributes':_0x4f6516[_0x8db2('0x19')]?_0x4f6516[_0x8db2('0x19')]['attributes']||null:null,'limit':_0x4f6516[_0x8db2('0x19')]?_0x4f6516[_0x8db2('0x19')][_0x8db2('0x1f')]||null:null})[_0x8db2('0xc')](function(_0xbe5ece){logger[_0x8db2('0x14')](_0x8db2('0x1a'),_0x4f6516);logger[_0x8db2('0xf')](_0x8db2('0x1a'),_0x4f6516,JSON['stringify'](_0xbe5ece));_0x52a9ca(_0xbe5ece);})[_0x8db2('0x15')](function(_0x50b28d){logger['error'](_0x8db2('0x1a'),_0x50b28d[_0x8db2('0x13')],_0x4f6516);_0x4d923c(_0x5725f0[_0x8db2('0x11')](0x1f4,_0x50b28d['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(_0x33e141,_0x291c1b){var _0x2a9296=function(_0x14b842){while(--_0x14b842){_0x33e141['push'](_0x33e141['shift']());}};_0x2a9296(++_0x291c1b);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x2d2c16,_0x4e88b6){_0x2d2c16=_0x2d2c16-0x0;var _0x53f2fb=_0xc4aa[_0x2d2c16];return _0x53f2fb;};'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 8f62e2d..5e0d099 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 _0xedd9=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','exports'];(function(_0x5e94f0,_0xef876c){var _0x3d489b=function(_0x5cab4c){while(--_0x5cab4c){_0x5e94f0['push'](_0x5e94f0['shift']());}};_0x3d489b(++_0xef876c);}(_0xedd9,0xfc));var _0x9edd=function(_0x64a811,_0x4887b7){_0x64a811=_0x64a811-0x0;var _0x3d8099=_0xedd9[_0x64a811];return _0x3d8099;};'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 _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x2bdecd,_0x21805f){var _0x56116e=function(_0x297d20){while(--_0x297d20){_0x2bdecd['push'](_0x2bdecd['shift']());}};_0x56116e(++_0x21805f);}(_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/mailServerIn/mailServerIn.attributes.js b/server/api/mailServerIn/mailServerIn.attributes.js index f3f4467..6504efe 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 _0x3cbd=['exports','STRING','BOOLEAN','INTEGER','INBOX','sequelize'];(function(_0x2cddc0,_0x5bdde7){var _0x3b341b=function(_0x5b34bd){while(--_0x5b34bd){_0x2cddc0['push'](_0x2cddc0['shift']());}};_0x3b341b(++_0x5bdde7);}(_0x3cbd,0xf5));var _0xd3cb=function(_0x4a8fea,_0x4603f4){_0x4a8fea=_0x4a8fea-0x0;var _0x5e23a4=_0x3cbd[_0x4a8fea];return _0x5e23a4;};'use strict';var Sequelize=require(_0xd3cb('0x0'));module[_0xd3cb('0x1')]={'description':{'type':Sequelize[_0xd3cb('0x2')]},'host':{'type':Sequelize[_0xd3cb('0x2')]},'authentication':{'type':Sequelize[_0xd3cb('0x3')],'defaultValue':!![]},'user':{'type':Sequelize[_0xd3cb('0x2')]},'password':{'type':Sequelize[_0xd3cb('0x2')]},'port':{'type':Sequelize[_0xd3cb('0x4')]},'tls':{'type':Sequelize[_0xd3cb('0x3')],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0xd3cb('0x2')],'defaultValue':_0xd3cb('0x5')},'connTimeout':{'type':Sequelize[_0xd3cb('0x4')],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0xd3cb('0x4')],'defaultValue':0x5},'service':{'type':Sequelize[_0xd3cb('0x2')]},'modernAuthentication':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x1281=['INTEGER','INBOX','sequelize','exports','STRING','BOOLEAN'];(function(_0x15ec4e,_0x40b7e0){var _0xb5e5dd=function(_0x42bdd7){while(--_0x42bdd7){_0x15ec4e['push'](_0x15ec4e['shift']());}};_0xb5e5dd(++_0x40b7e0);}(_0x1281,0x1f4));var _0x1128=function(_0x123b88,_0x209ac8){_0x123b88=_0x123b88-0x0;var _0x23dfd2=_0x1281[_0x123b88];return _0x23dfd2;};'use strict';var Sequelize=require(_0x1128('0x0'));module[_0x1128('0x1')]={'description':{'type':Sequelize[_0x1128('0x2')]},'host':{'type':Sequelize[_0x1128('0x2')]},'authentication':{'type':Sequelize[_0x1128('0x3')],'defaultValue':!![]},'user':{'type':Sequelize[_0x1128('0x2')]},'password':{'type':Sequelize[_0x1128('0x2')]},'port':{'type':Sequelize[_0x1128('0x4')]},'tls':{'type':Sequelize[_0x1128('0x3')],'defaultValue':!![]},'mailbox':{'type':Sequelize['STRING'],'defaultValue':_0x1128('0x5')},'connTimeout':{'type':Sequelize[_0x1128('0x4')],'defaultValue':0xa},'authTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'service':{'type':Sequelize[_0x1128('0x2')]},'modernAuthentication':{'type':Sequelize[_0x1128('0x3')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.model.js b/server/api/mailServerIn/mailServerIn.model.js index 55c4e77..e39364a 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 _0x7063=['../../config/environment','exports','define','MailServerIn','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x3a09f1,_0xc289f0){var _0x34d4cc=function(_0x2aa8a2){while(--_0x2aa8a2){_0x3a09f1['push'](_0x3a09f1['shift']());}};_0x34d4cc(++_0xc289f0);}(_0x7063,0x18a));var _0x3706=function(_0x4e122a,_0x3d800b){_0x4e122a=_0x4e122a-0x0;var _0x2b54e5=_0x7063[_0x4e122a];return _0x2b54e5;};'use strict';var _=require(_0x3706('0x0'));var util=require(_0x3706('0x1'));var logger=require(_0x3706('0x2'))(_0x3706('0x3'));var moment=require(_0x3706('0x4'));var BPromise=require(_0x3706('0x5'));var rp=require(_0x3706('0x6'));var fs=require('fs');var path=require(_0x3706('0x7'));var rimraf=require(_0x3706('0x8'));var config=require(_0x3706('0x9'));var attributes=require('./mailServerIn.attributes');module[_0x3706('0xa')]=function(_0x4b22b8,_0x2ef8be){return _0x4b22b8[_0x3706('0xb')](_0x3706('0xc'),attributes,{'tableName':'mail_servers_in','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x34dd=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailServerIn.attributes','exports','define','MailServerIn','mail_servers_in','lodash','util'];(function(_0x1ddedd,_0x485606){var _0xa3e1ac=function(_0x580444){while(--_0x580444){_0x1ddedd['push'](_0x1ddedd['shift']());}};_0xa3e1ac(++_0x485606);}(_0x34dd,0x1c0));var _0xd34d=function(_0x4dcf71,_0x4155fb){_0x4dcf71=_0x4dcf71-0x0;var _0x589fdb=_0x34dd[_0x4dcf71];return _0x589fdb;};'use strict';var _=require(_0xd34d('0x0'));var util=require(_0xd34d('0x1'));var logger=require(_0xd34d('0x2'))(_0xd34d('0x3'));var moment=require(_0xd34d('0x4'));var BPromise=require(_0xd34d('0x5'));var rp=require(_0xd34d('0x6'));var fs=require('fs');var path=require(_0xd34d('0x7'));var rimraf=require(_0xd34d('0x8'));var config=require(_0xd34d('0x9'));var attributes=require(_0xd34d('0xa'));module[_0xd34d('0xb')]=function(_0x1aff5b,_0x3c2e77){return _0x1aff5b[_0xd34d('0xc')](_0xd34d('0xd'),attributes,{'tableName':_0xd34d('0xe'),'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 708cd96..f239e6e 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 _0x9bc3=['error','message','info','result','catch','GetMailServerIn','findAll','options','raw','attributes','limit','include','map','model','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then','MailServerIn,\x20%s,\x20%s','request\x20sent','debug','MailServerIn,\x20%s,\x20%s,\x20%s','stringify','code'];(function(_0x2dadb9,_0x42cfe6){var _0x2f0097=function(_0x21163f){while(--_0x21163f){_0x2dadb9['push'](_0x2dadb9['shift']());}};_0x2f0097(++_0x42cfe6);}(_0x9bc3,0x137));var _0x39bc=function(_0x395817,_0x2aed53){_0x395817=_0x395817-0x0;var _0x463332=_0x9bc3[_0x395817];return _0x463332;};'use strict';var _=require(_0x39bc('0x0'));var util=require(_0x39bc('0x1'));var moment=require(_0x39bc('0x2'));var BPromise=require('bluebird');var rs=require(_0x39bc('0x3'));var fs=require('fs');var Redis=require(_0x39bc('0x4'));var db=require(_0x39bc('0x5'))['db'];var utils=require(_0x39bc('0x6'));var logger=require('../../config/logger')(_0x39bc('0x7'));var config=require(_0x39bc('0x8'));var jayson=require(_0x39bc('0x9'));var client=jayson[_0x39bc('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x38d6ce,_0x1367c6,_0x86cff3){return new BPromise(function(_0x10be27,_0x3fa4bd){return client[_0x39bc('0xb')](_0x38d6ce,_0x86cff3)[_0x39bc('0xc')](function(_0x2533c1){logger['info'](_0x39bc('0xd'),_0x1367c6,_0x39bc('0xe'));logger[_0x39bc('0xf')](_0x39bc('0x10'),_0x1367c6,_0x39bc('0xe'),JSON[_0x39bc('0x11')](_0x2533c1));if(_0x2533c1['error']){if(_0x2533c1['error'][_0x39bc('0x12')]===0x1f4){logger[_0x39bc('0x13')]('MailServerIn,\x20%s,\x20%s',_0x1367c6,_0x2533c1[_0x39bc('0x13')][_0x39bc('0x14')]);return _0x3fa4bd(_0x2533c1[_0x39bc('0x13')]['message']);}logger['error']('MailServerIn,\x20%s,\x20%s',_0x1367c6,_0x2533c1[_0x39bc('0x13')]['message']);return _0x10be27(_0x2533c1['error'][_0x39bc('0x14')]);}else{logger[_0x39bc('0x15')]('MailServerIn,\x20%s,\x20%s',_0x1367c6,'request\x20sent');_0x10be27(_0x2533c1[_0x39bc('0x16')][_0x39bc('0x14')]);}})[_0x39bc('0x17')](function(_0x5d6b18){logger[_0x39bc('0x13')](_0x39bc('0xd'),_0x1367c6,_0x5d6b18);_0x3fa4bd(_0x5d6b18);});});}exports[_0x39bc('0x18')]=function(_0x1e121f){var _0x3064c1=this;return new Promise(function(_0x3f13c8,_0x311923){return db['MailServerIn'][_0x39bc('0x19')]({'raw':_0x1e121f[_0x39bc('0x1a')]?_0x1e121f[_0x39bc('0x1a')][_0x39bc('0x1b')]===undefined?!![]:![]:!![],'where':_0x1e121f['options']?_0x1e121f[_0x39bc('0x1a')]['where']||null:null,'attributes':_0x1e121f[_0x39bc('0x1a')]?_0x1e121f['options'][_0x39bc('0x1c')]||null:null,'limit':_0x1e121f[_0x39bc('0x1a')]?_0x1e121f[_0x39bc('0x1a')][_0x39bc('0x1d')]||null:null,'include':_0x1e121f[_0x39bc('0x1a')]?_0x1e121f['options'][_0x39bc('0x1e')]?_[_0x39bc('0x1f')](_0x1e121f['options'][_0x39bc('0x1e')],function(_0x147923){return{'model':db[_0x147923['model']],'as':_0x147923['as'],'attributes':_0x147923['attributes'],'include':_0x147923[_0x39bc('0x1e')]?_[_0x39bc('0x1f')](_0x147923['include'],function(_0x8ff9f){return{'model':db[_0x8ff9f[_0x39bc('0x20')]],'as':_0x8ff9f['as'],'attributes':_0x8ff9f['attributes'],'include':_0x8ff9f['include']?_['map'](_0x8ff9f[_0x39bc('0x1e')],function(_0x21d5cf){return{'model':db[_0x21d5cf[_0x39bc('0x20')]],'as':_0x21d5cf['as'],'attributes':_0x21d5cf[_0x39bc('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x39bc('0xc')](function(_0x581148){logger[_0x39bc('0x15')](_0x39bc('0x18'),_0x1e121f);logger[_0x39bc('0xf')](_0x39bc('0x18'),_0x1e121f,JSON[_0x39bc('0x11')](_0x581148));_0x3f13c8(_0x581148);})[_0x39bc('0x17')](function(_0x2a13bc){logger[_0x39bc('0x13')](_0x39bc('0x18'),_0x2a13bc[_0x39bc('0x14')],_0x1e121f);_0x311923(_0x3064c1[_0x39bc('0x13')](0x1f4,_0x2a13bc[_0x39bc('0x14')]));});});}; \ No newline at end of file +var _0x4092=['http','request','then','request\x20sent','debug','stringify','error','code','message','MailServerIn,\x20%s,\x20%s','info','result','catch','GetMailServerIn','MailServerIn','options','raw','where','limit','include','map','attributes','model','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client'];(function(_0x2b7764,_0x2606f1){var _0x848dcb=function(_0x1ae85b){while(--_0x1ae85b){_0x2b7764['push'](_0x2b7764['shift']());}};_0x848dcb(++_0x2606f1);}(_0x4092,0x1af));var _0x2409=function(_0x3b2be3,_0x3e602d){_0x3b2be3=_0x3b2be3-0x0;var _0x511b35=_0x4092[_0x3b2be3];return _0x511b35;};'use strict';var _=require('lodash');var util=require(_0x2409('0x0'));var moment=require(_0x2409('0x1'));var BPromise=require(_0x2409('0x2'));var rs=require(_0x2409('0x3'));var fs=require('fs');var Redis=require(_0x2409('0x4'));var db=require(_0x2409('0x5'))['db'];var utils=require(_0x2409('0x6'));var logger=require(_0x2409('0x7'))(_0x2409('0x8'));var config=require('../../config/environment');var jayson=require(_0x2409('0x9'));var client=jayson[_0x2409('0xa')][_0x2409('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x483922,_0x35743c,_0x433df1){return new BPromise(function(_0xc0665c,_0x207784){return client[_0x2409('0xc')](_0x483922,_0x433df1)[_0x2409('0xd')](function(_0x326c5f){logger['info']('MailServerIn,\x20%s,\x20%s',_0x35743c,_0x2409('0xe'));logger[_0x2409('0xf')]('MailServerIn,\x20%s,\x20%s,\x20%s',_0x35743c,'request\x20sent',JSON[_0x2409('0x10')](_0x326c5f));if(_0x326c5f['error']){if(_0x326c5f[_0x2409('0x11')][_0x2409('0x12')]===0x1f4){logger[_0x2409('0x11')]('MailServerIn,\x20%s,\x20%s',_0x35743c,_0x326c5f['error'][_0x2409('0x13')]);return _0x207784(_0x326c5f[_0x2409('0x11')]['message']);}logger['error'](_0x2409('0x14'),_0x35743c,_0x326c5f[_0x2409('0x11')]['message']);return _0xc0665c(_0x326c5f['error']['message']);}else{logger[_0x2409('0x15')](_0x2409('0x14'),_0x35743c,_0x2409('0xe'));_0xc0665c(_0x326c5f[_0x2409('0x16')][_0x2409('0x13')]);}})[_0x2409('0x17')](function(_0x542b8f){logger['error']('MailServerIn,\x20%s,\x20%s',_0x35743c,_0x542b8f);_0x207784(_0x542b8f);});});}exports[_0x2409('0x18')]=function(_0x38bffc){var _0x3feaec=this;return new Promise(function(_0x30955b,_0x1e7763){return db[_0x2409('0x19')]['findAll']({'raw':_0x38bffc['options']?_0x38bffc[_0x2409('0x1a')][_0x2409('0x1b')]===undefined?!![]:![]:!![],'where':_0x38bffc['options']?_0x38bffc['options'][_0x2409('0x1c')]||null:null,'attributes':_0x38bffc[_0x2409('0x1a')]?_0x38bffc['options']['attributes']||null:null,'limit':_0x38bffc[_0x2409('0x1a')]?_0x38bffc[_0x2409('0x1a')][_0x2409('0x1d')]||null:null,'include':_0x38bffc[_0x2409('0x1a')]?_0x38bffc[_0x2409('0x1a')][_0x2409('0x1e')]?_[_0x2409('0x1f')](_0x38bffc['options']['include'],function(_0x17809d){return{'model':db[_0x17809d['model']],'as':_0x17809d['as'],'attributes':_0x17809d[_0x2409('0x20')],'include':_0x17809d[_0x2409('0x1e')]?_['map'](_0x17809d[_0x2409('0x1e')],function(_0x2be26d){return{'model':db[_0x2be26d['model']],'as':_0x2be26d['as'],'attributes':_0x2be26d[_0x2409('0x20')],'include':_0x2be26d[_0x2409('0x1e')]?_[_0x2409('0x1f')](_0x2be26d[_0x2409('0x1e')],function(_0x4a0b91){return{'model':db[_0x4a0b91[_0x2409('0x21')]],'as':_0x4a0b91['as'],'attributes':_0x4a0b91[_0x2409('0x20')]};}):[]};}):[]};}):[]:[]})[_0x2409('0xd')](function(_0x592c5d){logger[_0x2409('0x15')](_0x2409('0x18'),_0x38bffc);logger['debug'](_0x2409('0x18'),_0x38bffc,JSON[_0x2409('0x10')](_0x592c5d));_0x30955b(_0x592c5d);})[_0x2409('0x17')](function(_0x59bce9){logger[_0x2409('0x11')](_0x2409('0x18'),_0x59bce9['message'],_0x38bffc);_0x1e7763(_0x3feaec[_0x2409('0x11')](0x1f4,_0x59bce9[_0x2409('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/mailServerOut/index.js b/server/api/mailServerOut/index.js index ffdadf4..f62fb97 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(_0x92c450,_0x41f1e3){var _0x2a9599=function(_0x4f27df){while(--_0x4f27df){_0x92c450['push'](_0x92c450['shift']());}};_0x2a9599(++_0x41f1e3);}(_0x9957,0x93));var _0x7995=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x9957[_0x1facfa];return _0x9ec701;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('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(_0x13ea00,_0x12f610){var _0x1f7347=function(_0x34ae63){while(--_0x34ae63){_0x13ea00['push'](_0x13ea00['shift']());}};_0x1f7347(++_0x12f610);}(_0x7a54,0x106));var _0x47a5=function(_0x1eada9,_0xaf081c){_0x1eada9=_0x1eada9-0x0;var _0xa4dea7=_0x7a54[_0x1eada9];return _0xa4dea7;};'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 27ad52c..266cd2b 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 _0x0713=['BOOLEAN','STRING','INTEGER'];(function(_0x226196,_0x2ebd25){var _0x3bd132=function(_0x1ea76c){while(--_0x1ea76c){_0x226196['push'](_0x226196['shift']());}};_0x3bd132(++_0x2ebd25);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module['exports']={'description':{'type':Sequelize[_0x3071('0x0')]},'host':{'type':Sequelize[_0x3071('0x0')]},'user':{'type':Sequelize[_0x3071('0x0')]},'pass':{'type':Sequelize[_0x3071('0x0')]},'port':{'type':Sequelize[_0x3071('0x1')]},'secure':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'service':{'type':Sequelize[_0x3071('0x0')]},'authentication':{'type':Sequelize[_0x3071('0x2')],'defaultValue':!![]},'modernAuthentication':{'type':Sequelize[_0x3071('0x2')],'defaultValue':![]}}; \ No newline at end of file +var _0xa74f=['BOOLEAN','STRING','INTEGER'];(function(_0x173441,_0x26b0d9){var _0x2423a8=function(_0x4d96c2){while(--_0x4d96c2){_0x173441['push'](_0x173441['shift']());}};_0x2423a8(++_0x26b0d9);}(_0xa74f,0x9a));var _0xfa74=function(_0x288f5e,_0x205edd){_0x288f5e=_0x288f5e-0x0;var _0x476cc9=_0xa74f[_0x288f5e];return _0x476cc9;};'use strict';var Sequelize=require('sequelize');module['exports']={'description':{'type':Sequelize[_0xfa74('0x0')]},'host':{'type':Sequelize['STRING']},'user':{'type':Sequelize['STRING']},'pass':{'type':Sequelize[_0xfa74('0x0')]},'port':{'type':Sequelize[_0xfa74('0x1')]},'secure':{'type':Sequelize[_0xfa74('0x2')],'defaultValue':![]},'service':{'type':Sequelize[_0xfa74('0x0')]},'authentication':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'modernAuthentication':{'type':Sequelize[_0xfa74('0x2')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.controller.js b/server/api/mailServerOut/mailServerOut.controller.js index 49ed243..fc169aa 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 _0xc0f5=['ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','limit','count','set','apply','reject','save','then','destroy','error','stack','name','send','index','map','MailServerOut','rawAttributes','fieldName','type','model','keys','query','intersection','fields','attributes','nolimit','order','sort','where','filters','pick','filter','merge','options','includeAll','include','findAll','rows','catch','show','find','create','body','update','params','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','squel','desk.js'];(function(_0x16eb77,_0x1ab9aa){var _0x2a9f4b=function(_0x494e06){while(--_0x494e06){_0x16eb77['push'](_0x16eb77['shift']());}};_0x2a9f4b(++_0x1ab9aa);}(_0xc0f5,0x1a8));var _0x5c0f=function(_0xbb60d8,_0x20b274){_0xbb60d8=_0xbb60d8-0x0;var _0x19e7bf=_0xc0f5[_0xbb60d8];return _0x19e7bf;};'use strict';var emlformat=require(_0x5c0f('0x0'));var rimraf=require(_0x5c0f('0x1'));var zipdir=require(_0x5c0f('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x5c0f('0x3'));var moment=require(_0x5c0f('0x4'));var BPromise=require(_0x5c0f('0x5'));var Mustache=require(_0x5c0f('0x6'));var util=require(_0x5c0f('0x7'));var path=require(_0x5c0f('0x8'));var sox=require(_0x5c0f('0x9'));var csv=require(_0x5c0f('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5c0f('0xb'));var _=require('lodash');var squel=require(_0x5c0f('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x5c0f('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x5c0f('0xe'));var authService=require(_0x5c0f('0xf'));var qs=require(_0x5c0f('0x10'));var as=require(_0x5c0f('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x5c0f('0x12'))(_0x5c0f('0x13'));var utils=require(_0x5c0f('0x14'));var config=require(_0x5c0f('0x15'));var licenseUtil=require(_0x5c0f('0x16'));var db=require(_0x5c0f('0x17'))['db'];function respondWithStatusCode(_0x2c7558,_0x3fa211){_0x3fa211=_0x3fa211||0xcc;return function(_0x2ebaab){if(_0x2ebaab){return _0x2c7558[_0x5c0f('0x18')](_0x3fa211);}return _0x2c7558['status'](_0x3fa211)[_0x5c0f('0x19')]();};}function respondWithResult(_0x206b97,_0x451de3){_0x451de3=_0x451de3||0xc8;return function(_0x19f79c){if(_0x19f79c){return _0x206b97[_0x5c0f('0x1a')](_0x451de3)[_0x5c0f('0x1b')](_0x19f79c);}};}function respondWithFilteredResult(_0x4757f5,_0x2eb055){return function(_0x563b4b){if(_0x563b4b){var _0x29f3b9=typeof _0x2eb055[_0x5c0f('0x1c')]==='undefined'&&typeof _0x2eb055[_0x5c0f('0x1d')]==='undefined';var _0x167c49=_0x563b4b[_0x5c0f('0x1e')];var _0x5b4a29=_0x29f3b9?0x0:_0x2eb055[_0x5c0f('0x1c')];var _0x130a97=_0x29f3b9?_0x563b4b[_0x5c0f('0x1e')]:_0x2eb055[_0x5c0f('0x1c')]+_0x2eb055['limit'];var _0x55ea1b;if(_0x130a97>=_0x167c49){_0x130a97=_0x167c49;_0x55ea1b=0xc8;}else{_0x55ea1b=0xce;}_0x4757f5[_0x5c0f('0x1a')](_0x55ea1b);return _0x4757f5[_0x5c0f('0x1f')]('Content-Range',_0x5b4a29+'-'+_0x130a97+'/'+_0x167c49)[_0x5c0f('0x1b')](_0x563b4b);}return null;};}function patchUpdates(_0x56a9e0){return function(_0x5bf5d2){try{jsonpatch[_0x5c0f('0x20')](_0x5bf5d2,_0x56a9e0,!![]);}catch(_0x5b6e2a){return BPromise[_0x5c0f('0x21')](_0x5b6e2a);}return _0x5bf5d2[_0x5c0f('0x22')]();};}function saveUpdates(_0x8eb143,_0x543c4b){return function(_0x33250b){if(_0x33250b){return _0x33250b['update'](_0x8eb143)[_0x5c0f('0x23')](function(_0xf83e5f){return _0xf83e5f;});}return null;};}function removeEntity(_0x475fec,_0x2adc7e){return function(_0x47a9e9){if(_0x47a9e9){return _0x47a9e9[_0x5c0f('0x24')]()[_0x5c0f('0x23')](function(){_0x475fec['status'](0xcc)[_0x5c0f('0x19')]();});}};}function handleEntityNotFound(_0x4df7fa,_0x28c839){return function(_0x1b366b){if(!_0x1b366b){_0x4df7fa['sendStatus'](0x194);}return _0x1b366b;};}function handleError(_0x21b875,_0x3c8ab5){_0x3c8ab5=_0x3c8ab5||0x1f4;return function(_0x2d3a1d){logger[_0x5c0f('0x25')](_0x2d3a1d[_0x5c0f('0x26')]);if(_0x2d3a1d[_0x5c0f('0x27')]){delete _0x2d3a1d[_0x5c0f('0x27')];}_0x21b875[_0x5c0f('0x1a')](_0x3c8ab5)[_0x5c0f('0x28')](_0x2d3a1d);};}exports[_0x5c0f('0x29')]=function(_0x20beb5,_0x1f5519){var _0x554309={},_0x4d59c0={},_0x19d448={'count':0x0,'rows':[]};var _0x3c07a6=_[_0x5c0f('0x2a')](db[_0x5c0f('0x2b')][_0x5c0f('0x2c')],function(_0x5c9b78){return{'name':_0x5c9b78[_0x5c0f('0x2d')],'type':_0x5c9b78[_0x5c0f('0x2e')]['key']};});_0x4d59c0[_0x5c0f('0x2f')]=_[_0x5c0f('0x2a')](_0x3c07a6,_0x5c0f('0x27'));_0x4d59c0['query']=_[_0x5c0f('0x30')](_0x20beb5[_0x5c0f('0x31')]);_0x4d59c0['filters']=_[_0x5c0f('0x32')](_0x4d59c0[_0x5c0f('0x2f')],_0x4d59c0[_0x5c0f('0x31')]);_0x554309['attributes']=_[_0x5c0f('0x32')](_0x4d59c0[_0x5c0f('0x2f')],qs[_0x5c0f('0x33')](_0x20beb5[_0x5c0f('0x31')][_0x5c0f('0x33')]));_0x554309[_0x5c0f('0x34')]=_0x554309[_0x5c0f('0x34')]['length']?_0x554309[_0x5c0f('0x34')]:_0x4d59c0[_0x5c0f('0x2f')];if(!_0x20beb5[_0x5c0f('0x31')]['hasOwnProperty'](_0x5c0f('0x35'))){_0x554309[_0x5c0f('0x1d')]=qs[_0x5c0f('0x1d')](_0x20beb5[_0x5c0f('0x31')][_0x5c0f('0x1d')]);_0x554309[_0x5c0f('0x1c')]=qs[_0x5c0f('0x1c')](_0x20beb5[_0x5c0f('0x31')]['offset']);}_0x554309[_0x5c0f('0x36')]=qs[_0x5c0f('0x37')](_0x20beb5[_0x5c0f('0x31')][_0x5c0f('0x37')]);_0x554309[_0x5c0f('0x38')]=qs[_0x5c0f('0x39')](_[_0x5c0f('0x3a')](_0x20beb5['query'],_0x4d59c0['filters']),_0x3c07a6);if(_0x20beb5[_0x5c0f('0x31')][_0x5c0f('0x3b')]){_0x554309[_0x5c0f('0x38')]=_[_0x5c0f('0x3c')](_0x554309[_0x5c0f('0x38')],{'$or':_['map'](_0x3c07a6,function(_0x1209d3){if(_0x1209d3[_0x5c0f('0x2e')]!=='VIRTUAL'){var _0x18a730={};_0x18a730[_0x1209d3[_0x5c0f('0x27')]]={'$like':'%'+_0x20beb5[_0x5c0f('0x31')][_0x5c0f('0x3b')]+'%'};return _0x18a730;}})});}_0x554309=_[_0x5c0f('0x3c')]({},_0x554309,_0x20beb5[_0x5c0f('0x3d')]);var _0x471ec5={'where':_0x554309[_0x5c0f('0x38')]};return db[_0x5c0f('0x2b')][_0x5c0f('0x1e')](_0x471ec5)['then'](function(_0x4dfcf2){_0x19d448['count']=_0x4dfcf2;if(_0x20beb5[_0x5c0f('0x31')][_0x5c0f('0x3e')]){_0x554309[_0x5c0f('0x3f')]=[{'all':!![]}];}return db['MailServerOut'][_0x5c0f('0x40')](_0x554309);})['then'](function(_0x4e21bf){_0x19d448[_0x5c0f('0x41')]=_0x4e21bf;return _0x19d448;})[_0x5c0f('0x23')](respondWithFilteredResult(_0x1f5519,_0x554309))[_0x5c0f('0x42')](handleError(_0x1f5519,null));};exports[_0x5c0f('0x43')]=function(_0x18cfc4,_0x4dcbde){var _0x645e46={'raw':!![],'where':{'id':_0x18cfc4['params']['id']}},_0x4a55f0={};_0x4a55f0[_0x5c0f('0x2f')]=_['keys'](db[_0x5c0f('0x2b')][_0x5c0f('0x2c')]);_0x4a55f0['query']=_[_0x5c0f('0x30')](_0x18cfc4[_0x5c0f('0x31')]);_0x4a55f0['filters']=_['intersection'](_0x4a55f0['model'],_0x4a55f0[_0x5c0f('0x31')]);_0x645e46[_0x5c0f('0x34')]=_['intersection'](_0x4a55f0['model'],qs[_0x5c0f('0x33')](_0x18cfc4[_0x5c0f('0x31')]['fields']));_0x645e46[_0x5c0f('0x34')]=_0x645e46[_0x5c0f('0x34')]['length']?_0x645e46['attributes']:_0x4a55f0[_0x5c0f('0x2f')];if(_0x18cfc4[_0x5c0f('0x31')][_0x5c0f('0x3e')]){_0x645e46['include']=[{'all':!![]}];}_0x645e46=_[_0x5c0f('0x3c')]({},_0x645e46,_0x18cfc4[_0x5c0f('0x3d')]);return db['MailServerOut'][_0x5c0f('0x44')](_0x645e46)[_0x5c0f('0x23')](handleEntityNotFound(_0x4dcbde,null))['then'](respondWithResult(_0x4dcbde,null))[_0x5c0f('0x42')](handleError(_0x4dcbde,null));};exports['create']=function(_0xdd09e5,_0x2efecd){return db['MailServerOut'][_0x5c0f('0x45')](_0xdd09e5[_0x5c0f('0x46')],{})['then'](respondWithResult(_0x2efecd,0xc9))[_0x5c0f('0x42')](handleError(_0x2efecd,null));};exports[_0x5c0f('0x47')]=function(_0x2c9e35,_0x5026b1){if(_0x2c9e35[_0x5c0f('0x46')]['id']){delete _0x2c9e35['body']['id'];}return db[_0x5c0f('0x2b')][_0x5c0f('0x44')]({'where':{'id':_0x2c9e35[_0x5c0f('0x48')]['id']}})['then'](handleEntityNotFound(_0x5026b1,null))[_0x5c0f('0x23')](saveUpdates(_0x2c9e35[_0x5c0f('0x46')],null))[_0x5c0f('0x23')](respondWithResult(_0x5026b1,null))[_0x5c0f('0x42')](handleError(_0x5026b1,null));};exports[_0x5c0f('0x24')]=function(_0x1fbd60,_0x1a1010){return db[_0x5c0f('0x2b')][_0x5c0f('0x44')]({'where':{'id':_0x1fbd60['params']['id']}})[_0x5c0f('0x23')](handleEntityNotFound(_0x1a1010,null))[_0x5c0f('0x23')](removeEntity(_0x1a1010,null))[_0x5c0f('0x42')](handleError(_0x1a1010,null));}; \ No newline at end of file +var _0x58eb=['pick','filter','merge','VIRTUAL','includeAll','findAll','rows','catch','show','params','options','find','create','body','destroy','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','set','Content-Range','reject','update','then','error','name','send','index','map','MailServerOut','rawAttributes','type','key','model','keys','query','intersection','attributes','fields','length','nolimit','sort','where','filters'];(function(_0x3f25db,_0x1d3686){var _0x54f29d=function(_0x2963bb){while(--_0x2963bb){_0x3f25db['push'](_0x3f25db['shift']());}};_0x54f29d(++_0x1d3686);}(_0x58eb,0x99));var _0xb58e=function(_0x2f1762,_0xab43df){_0x2f1762=_0x2f1762-0x0;var _0x8ab21=_0x58eb[_0x2f1762];return _0x8ab21;};'use strict';var emlformat=require(_0xb58e('0x0'));var rimraf=require(_0xb58e('0x1'));var zipdir=require(_0xb58e('0x2'));var jsonpatch=require(_0xb58e('0x3'));var rp=require('request-promise');var moment=require(_0xb58e('0x4'));var BPromise=require(_0xb58e('0x5'));var Mustache=require(_0xb58e('0x6'));var util=require('util');var path=require(_0xb58e('0x7'));var sox=require(_0xb58e('0x8'));var csv=require(_0xb58e('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xb58e('0xa'));var crypto=require(_0xb58e('0xb'));var jsforce=require(_0xb58e('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xb58e('0x9'));var querystring=require(_0xb58e('0xd'));var Papa=require('papaparse');var Redis=require(_0xb58e('0xe'));var authService=require(_0xb58e('0xf'));var qs=require(_0xb58e('0x10'));var as=require(_0xb58e('0x11'));var hardwareService=require(_0xb58e('0x12'));var logger=require(_0xb58e('0x13'))('api');var utils=require(_0xb58e('0x14'));var config=require(_0xb58e('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xb58e('0x16'))['db'];function respondWithStatusCode(_0x4d7ee7,_0x3eafdd){_0x3eafdd=_0x3eafdd||0xcc;return function(_0x93dcd9){if(_0x93dcd9){return _0x4d7ee7[_0xb58e('0x17')](_0x3eafdd);}return _0x4d7ee7[_0xb58e('0x18')](_0x3eafdd)[_0xb58e('0x19')]();};}function respondWithResult(_0x4b2a64,_0x5cf3be){_0x5cf3be=_0x5cf3be||0xc8;return function(_0x4b7110){if(_0x4b7110){return _0x4b2a64[_0xb58e('0x18')](_0x5cf3be)[_0xb58e('0x1a')](_0x4b7110);}};}function respondWithFilteredResult(_0x4e8aec,_0x515289){return function(_0x13dd08){if(_0x13dd08){var _0x469e27=typeof _0x515289[_0xb58e('0x1b')]==='undefined'&&typeof _0x515289[_0xb58e('0x1c')]==='undefined';var _0xb32d5b=_0x13dd08['count'];var _0x2fe33f=_0x469e27?0x0:_0x515289[_0xb58e('0x1b')];var _0x4ffed1=_0x469e27?_0x13dd08['count']:_0x515289['offset']+_0x515289[_0xb58e('0x1c')];var _0xe0e478;if(_0x4ffed1>=_0xb32d5b){_0x4ffed1=_0xb32d5b;_0xe0e478=0xc8;}else{_0xe0e478=0xce;}_0x4e8aec[_0xb58e('0x18')](_0xe0e478);return _0x4e8aec[_0xb58e('0x1d')](_0xb58e('0x1e'),_0x2fe33f+'-'+_0x4ffed1+'/'+_0xb32d5b)[_0xb58e('0x1a')](_0x13dd08);}return null;};}function patchUpdates(_0x43a805){return function(_0x2c124a){try{jsonpatch['apply'](_0x2c124a,_0x43a805,!![]);}catch(_0x10501f){return BPromise[_0xb58e('0x1f')](_0x10501f);}return _0x2c124a['save']();};}function saveUpdates(_0x1cc2ae,_0x31b9ef){return function(_0x1d8148){if(_0x1d8148){return _0x1d8148[_0xb58e('0x20')](_0x1cc2ae)[_0xb58e('0x21')](function(_0x4b014f){return _0x4b014f;});}return null;};}function removeEntity(_0x8e0ff4,_0xc7b4ab){return function(_0x21afc9){if(_0x21afc9){return _0x21afc9['destroy']()[_0xb58e('0x21')](function(){_0x8e0ff4[_0xb58e('0x18')](0xcc)[_0xb58e('0x19')]();});}};}function handleEntityNotFound(_0x4ac62d,_0x40a6da){return function(_0x4a2ced){if(!_0x4a2ced){_0x4ac62d[_0xb58e('0x17')](0x194);}return _0x4a2ced;};}function handleError(_0x4af944,_0xfc97f2){_0xfc97f2=_0xfc97f2||0x1f4;return function(_0x445922){logger[_0xb58e('0x22')](_0x445922['stack']);if(_0x445922[_0xb58e('0x23')]){delete _0x445922[_0xb58e('0x23')];}_0x4af944[_0xb58e('0x18')](_0xfc97f2)[_0xb58e('0x24')](_0x445922);};}exports[_0xb58e('0x25')]=function(_0x3f1f68,_0x1468a6){var _0x14c0c4={},_0x5b92d0={},_0x449587={'count':0x0,'rows':[]};var _0x3b3c96=_[_0xb58e('0x26')](db[_0xb58e('0x27')][_0xb58e('0x28')],function(_0x1c466f){return{'name':_0x1c466f['fieldName'],'type':_0x1c466f[_0xb58e('0x29')][_0xb58e('0x2a')]};});_0x5b92d0[_0xb58e('0x2b')]=_[_0xb58e('0x26')](_0x3b3c96,_0xb58e('0x23'));_0x5b92d0['query']=_[_0xb58e('0x2c')](_0x3f1f68[_0xb58e('0x2d')]);_0x5b92d0['filters']=_[_0xb58e('0x2e')](_0x5b92d0['model'],_0x5b92d0[_0xb58e('0x2d')]);_0x14c0c4[_0xb58e('0x2f')]=_['intersection'](_0x5b92d0[_0xb58e('0x2b')],qs[_0xb58e('0x30')](_0x3f1f68[_0xb58e('0x2d')][_0xb58e('0x30')]));_0x14c0c4[_0xb58e('0x2f')]=_0x14c0c4[_0xb58e('0x2f')][_0xb58e('0x31')]?_0x14c0c4[_0xb58e('0x2f')]:_0x5b92d0[_0xb58e('0x2b')];if(!_0x3f1f68['query']['hasOwnProperty'](_0xb58e('0x32'))){_0x14c0c4[_0xb58e('0x1c')]=qs[_0xb58e('0x1c')](_0x3f1f68[_0xb58e('0x2d')][_0xb58e('0x1c')]);_0x14c0c4['offset']=qs[_0xb58e('0x1b')](_0x3f1f68[_0xb58e('0x2d')][_0xb58e('0x1b')]);}_0x14c0c4['order']=qs['sort'](_0x3f1f68['query'][_0xb58e('0x33')]);_0x14c0c4[_0xb58e('0x34')]=qs[_0xb58e('0x35')](_[_0xb58e('0x36')](_0x3f1f68['query'],_0x5b92d0[_0xb58e('0x35')]),_0x3b3c96);if(_0x3f1f68['query'][_0xb58e('0x37')]){_0x14c0c4[_0xb58e('0x34')]=_[_0xb58e('0x38')](_0x14c0c4[_0xb58e('0x34')],{'$or':_['map'](_0x3b3c96,function(_0x42e89a){if(_0x42e89a[_0xb58e('0x29')]!==_0xb58e('0x39')){var _0x59ffaa={};_0x59ffaa[_0x42e89a[_0xb58e('0x23')]]={'$like':'%'+_0x3f1f68[_0xb58e('0x2d')]['filter']+'%'};return _0x59ffaa;}})});}_0x14c0c4=_[_0xb58e('0x38')]({},_0x14c0c4,_0x3f1f68['options']);var _0x4944aa={'where':_0x14c0c4[_0xb58e('0x34')]};return db[_0xb58e('0x27')]['count'](_0x4944aa)[_0xb58e('0x21')](function(_0x254e3c){_0x449587['count']=_0x254e3c;if(_0x3f1f68['query'][_0xb58e('0x3a')]){_0x14c0c4['include']=[{'all':!![]}];}return db[_0xb58e('0x27')][_0xb58e('0x3b')](_0x14c0c4);})[_0xb58e('0x21')](function(_0x440c1c){_0x449587[_0xb58e('0x3c')]=_0x440c1c;return _0x449587;})['then'](respondWithFilteredResult(_0x1468a6,_0x14c0c4))[_0xb58e('0x3d')](handleError(_0x1468a6,null));};exports[_0xb58e('0x3e')]=function(_0xf27286,_0x4eafc3){var _0x515195={'raw':!![],'where':{'id':_0xf27286[_0xb58e('0x3f')]['id']}},_0x2f6724={};_0x2f6724[_0xb58e('0x2b')]=_[_0xb58e('0x2c')](db[_0xb58e('0x27')][_0xb58e('0x28')]);_0x2f6724[_0xb58e('0x2d')]=_[_0xb58e('0x2c')](_0xf27286['query']);_0x2f6724[_0xb58e('0x35')]=_['intersection'](_0x2f6724[_0xb58e('0x2b')],_0x2f6724['query']);_0x515195['attributes']=_[_0xb58e('0x2e')](_0x2f6724[_0xb58e('0x2b')],qs[_0xb58e('0x30')](_0xf27286['query'][_0xb58e('0x30')]));_0x515195[_0xb58e('0x2f')]=_0x515195[_0xb58e('0x2f')][_0xb58e('0x31')]?_0x515195[_0xb58e('0x2f')]:_0x2f6724[_0xb58e('0x2b')];if(_0xf27286[_0xb58e('0x2d')]['includeAll']){_0x515195['include']=[{'all':!![]}];}_0x515195=_[_0xb58e('0x38')]({},_0x515195,_0xf27286[_0xb58e('0x40')]);return db[_0xb58e('0x27')][_0xb58e('0x41')](_0x515195)['then'](handleEntityNotFound(_0x4eafc3,null))['then'](respondWithResult(_0x4eafc3,null))[_0xb58e('0x3d')](handleError(_0x4eafc3,null));};exports[_0xb58e('0x42')]=function(_0x34abc3,_0x52fe1a){return db[_0xb58e('0x27')][_0xb58e('0x42')](_0x34abc3[_0xb58e('0x43')],{})[_0xb58e('0x21')](respondWithResult(_0x52fe1a,0xc9))[_0xb58e('0x3d')](handleError(_0x52fe1a,null));};exports[_0xb58e('0x20')]=function(_0x3613d2,_0x13fe06){if(_0x3613d2[_0xb58e('0x43')]['id']){delete _0x3613d2[_0xb58e('0x43')]['id'];}return db[_0xb58e('0x27')][_0xb58e('0x41')]({'where':{'id':_0x3613d2[_0xb58e('0x3f')]['id']}})['then'](handleEntityNotFound(_0x13fe06,null))[_0xb58e('0x21')](saveUpdates(_0x3613d2['body'],null))[_0xb58e('0x21')](respondWithResult(_0x13fe06,null))[_0xb58e('0x3d')](handleError(_0x13fe06,null));};exports[_0xb58e('0x44')]=function(_0xe864ca,_0x11af3b){return db['MailServerOut'][_0xb58e('0x41')]({'where':{'id':_0xe864ca[_0xb58e('0x3f')]['id']}})[_0xb58e('0x21')](handleEntityNotFound(_0x11af3b,null))[_0xb58e('0x21')](removeEntity(_0x11af3b,null))['catch'](handleError(_0x11af3b,null));}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.model.js b/server/api/mailServerOut/mailServerOut.model.js index 4f8ce92..26fbf32 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 _0x9b9c=['mail_servers_out','lodash','util','../../config/logger','api','moment','path','rimraf','./mailServerOut.attributes','exports','define','MailServerOut'];(function(_0x5732b9,_0x1931e0){var _0x12326a=function(_0x55a5b1){while(--_0x55a5b1){_0x5732b9['push'](_0x5732b9['shift']());}};_0x12326a(++_0x1931e0);}(_0x9b9c,0x1a5));var _0xc9b9=function(_0x1eac39,_0x22eddd){_0x1eac39=_0x1eac39-0x0;var _0x27e439=_0x9b9c[_0x1eac39];return _0x27e439;};'use strict';var _=require(_0xc9b9('0x0'));var util=require(_0xc9b9('0x1'));var logger=require(_0xc9b9('0x2'))(_0xc9b9('0x3'));var moment=require(_0xc9b9('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xc9b9('0x5'));var rimraf=require(_0xc9b9('0x6'));var config=require('../../config/environment');var attributes=require(_0xc9b9('0x7'));module[_0xc9b9('0x8')]=function(_0x1227c3,_0x194e6e){return _0x1227c3[_0xc9b9('0x9')](_0xc9b9('0xa'),attributes,{'tableName':_0xc9b9('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x363d=['path','rimraf','../../config/environment','./mailServerOut.attributes','exports','define','MailServerOut','mail_servers_out','lodash','util','../../config/logger','api','bluebird','request-promise'];(function(_0x124b74,_0x4d5bab){var _0x3cac56=function(_0x40f9ae){while(--_0x40f9ae){_0x124b74['push'](_0x124b74['shift']());}};_0x3cac56(++_0x4d5bab);}(_0x363d,0x14a));var _0xd363=function(_0x1558ab,_0x39d1de){_0x1558ab=_0x1558ab-0x0;var _0x53b64a=_0x363d[_0x1558ab];return _0x53b64a;};'use strict';var _=require(_0xd363('0x0'));var util=require(_0xd363('0x1'));var logger=require(_0xd363('0x2'))(_0xd363('0x3'));var moment=require('moment');var BPromise=require(_0xd363('0x4'));var rp=require(_0xd363('0x5'));var fs=require('fs');var path=require(_0xd363('0x6'));var rimraf=require(_0xd363('0x7'));var config=require(_0xd363('0x8'));var attributes=require(_0xd363('0x9'));module[_0xd363('0xa')]=function(_0x48c0dc,_0x2dc947){return _0x48c0dc[_0xd363('0xb')](_0xd363('0xc'),attributes,{'tableName':_0xd363('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.rpc.js b/server/api/mailServerOut/mailServerOut.rpc.js index fd6fc95..d930483 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(_0x11551e,_0x2d62f2){var _0x3a24e8=function(_0x2460ed){while(--_0x2460ed){_0x11551e['push'](_0x11551e['shift']());}};_0x3a24e8(++_0x2d62f2);}(_0x1261,0x144));var _0x1126=function(_0x256c49,_0x53f00a){_0x256c49=_0x256c49-0x0;var _0x280282=_0x1261[_0x256c49];return _0x280282;};'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 _0x5f2f=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','info','MailServerOut,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch'];(function(_0x2bb2e2,_0x3be0a6){var _0x569034=function(_0x549cad){while(--_0x549cad){_0x2bb2e2['push'](_0x2bb2e2['shift']());}};_0x569034(++_0x3be0a6);}(_0x5f2f,0x73));var _0xf5f2=function(_0x28a744,_0x13f9fe){_0x28a744=_0x28a744-0x0;var _0x303542=_0x5f2f[_0x28a744];return _0x303542;};'use strict';var _=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var moment=require(_0xf5f2('0x2'));var BPromise=require(_0xf5f2('0x3'));var rs=require(_0xf5f2('0x4'));var fs=require('fs');var Redis=require(_0xf5f2('0x5'));var db=require(_0xf5f2('0x6'))['db'];var utils=require(_0xf5f2('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0xf5f2('0x8'));var jayson=require(_0xf5f2('0x9'));var client=jayson[_0xf5f2('0xa')][_0xf5f2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3133bc,_0x473100,_0x5907aa){return new BPromise(function(_0x466882,_0x46cd9c){return client[_0xf5f2('0xc')](_0x3133bc,_0x5907aa)['then'](function(_0x375da4){logger[_0xf5f2('0xd')](_0xf5f2('0xe'),_0x473100,'request\x20sent');logger[_0xf5f2('0xf')]('MailServerOut,\x20%s,\x20%s,\x20%s',_0x473100,'request\x20sent',JSON[_0xf5f2('0x10')](_0x375da4));if(_0x375da4[_0xf5f2('0x11')]){if(_0x375da4['error'][_0xf5f2('0x12')]===0x1f4){logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0x375da4[_0xf5f2('0x11')][_0xf5f2('0x13')]);return _0x46cd9c(_0x375da4[_0xf5f2('0x11')]['message']);}logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0x375da4[_0xf5f2('0x11')][_0xf5f2('0x13')]);return _0x466882(_0x375da4[_0xf5f2('0x11')]['message']);}else{logger[_0xf5f2('0xd')](_0xf5f2('0xe'),_0x473100,_0xf5f2('0x14'));_0x466882(_0x375da4[_0xf5f2('0x15')][_0xf5f2('0x13')]);}})[_0xf5f2('0x16')](function(_0xdb61b3){logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0xdb61b3);_0x46cd9c(_0xdb61b3);});});} \ No newline at end of file diff --git a/server/api/mailSubstatus/index.js b/server/api/mailSubstatus/index.js index 0751c83..2548359 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 _0xde59=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','isAuthenticated','index','describe','get','/:id','show','post','create','put','update','delete','destroy','exports','multer','path'];(function(_0x33a499,_0x3a2e5a){var _0x2dc9ba=function(_0xe5cbbf){while(--_0xe5cbbf){_0x33a499['push'](_0x33a499['shift']());}};_0x2dc9ba(++_0x3a2e5a);}(_0xde59,0x1e1));var _0x9de5=function(_0x4a24f7,_0x3d1a97){_0x4a24f7=_0x4a24f7-0x0;var _0x30307b=_0xde59[_0x4a24f7];return _0x30307b;};'use strict';var multer=require(_0x9de5('0x0'));var util=require('util');var path=require(_0x9de5('0x1'));var timeout=require(_0x9de5('0x2'));var express=require(_0x9de5('0x3'));var router=express[_0x9de5('0x4')]();var fs_extra=require(_0x9de5('0x5'));var auth=require(_0x9de5('0x6'));var interaction=require(_0x9de5('0x7'));var config=require('../../config/environment');var controller=require('./mailSubstatus.controller');router['get']('/',auth[_0x9de5('0x8')](),controller[_0x9de5('0x9')]);router['get']('/describe',auth[_0x9de5('0x8')](),controller[_0x9de5('0xa')]);router[_0x9de5('0xb')](_0x9de5('0xc'),auth[_0x9de5('0x8')](),controller[_0x9de5('0xd')]);router[_0x9de5('0xe')]('/',auth['isAuthenticated'](),controller[_0x9de5('0xf')]);router[_0x9de5('0x10')](_0x9de5('0xc'),auth[_0x9de5('0x8')](),controller[_0x9de5('0x11')]);router[_0x9de5('0x12')](_0x9de5('0xc'),auth['isAuthenticated'](),controller[_0x9de5('0x13')]);module[_0x9de5('0x14')]=router; \ No newline at end of file +var _0xea5c=['isAuthenticated','index','get','describe','/:id','show','create','update','delete','exports','multer','util','path','express','Router','fs-extra','./mailSubstatus.controller'];(function(_0x5e38a4,_0x333514){var _0x401332=function(_0x18cd85){while(--_0x18cd85){_0x5e38a4['push'](_0x5e38a4['shift']());}};_0x401332(++_0x333514);}(_0xea5c,0x15e));var _0xcea5=function(_0x78cfdd,_0x55ac18){_0x78cfdd=_0x78cfdd-0x0;var _0x2139d8=_0xea5c[_0x78cfdd];return _0x2139d8;};'use strict';var multer=require(_0xcea5('0x0'));var util=require(_0xcea5('0x1'));var path=require(_0xcea5('0x2'));var timeout=require('connect-timeout');var express=require(_0xcea5('0x3'));var router=express[_0xcea5('0x4')]();var fs_extra=require(_0xcea5('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xcea5('0x6'));router['get']('/',auth[_0xcea5('0x7')](),controller[_0xcea5('0x8')]);router[_0xcea5('0x9')]('/describe',auth['isAuthenticated'](),controller[_0xcea5('0xa')]);router[_0xcea5('0x9')](_0xcea5('0xb'),auth[_0xcea5('0x7')](),controller[_0xcea5('0xc')]);router['post']('/',auth['isAuthenticated'](),controller[_0xcea5('0xd')]);router['put'](_0xcea5('0xb'),auth['isAuthenticated'](),controller[_0xcea5('0xe')]);router[_0xcea5('0xf')](_0xcea5('0xb'),auth[_0xcea5('0x7')](),controller['destroy']);module[_0xcea5('0x10')]=router; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.attributes.js b/server/api/mailSubstatus/mailSubstatus.attributes.js index a8a05d9..bc9a546 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 _0x5f6f=['exports','STRING','name','sequelize'];(function(_0x283ca8,_0x165337){var _0x34b5c4=function(_0xaccf7){while(--_0xaccf7){_0x283ca8['push'](_0x283ca8['shift']());}};_0x34b5c4(++_0x165337);}(_0x5f6f,0x1ef));var _0xf5f6=function(_0x31d040,_0x46742e){_0x31d040=_0x31d040-0x0;var _0xf4812a=_0x5f6f[_0x31d040];return _0xf4812a;};'use strict';var Sequelize=require(_0xf5f6('0x0'));module[_0xf5f6('0x1')]={'name':{'type':Sequelize[_0xf5f6('0x2')],'unique':_0xf5f6('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xf5f6('0x2')]}}; \ No newline at end of file +var _0x90b5=['name','sequelize','STRING'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x90b5,0x139));var _0x590b=function(_0x1e8522,_0x1e1d95){_0x1e8522=_0x1e8522-0x0;var _0x228450=_0x90b5[_0x1e8522];return _0x228450;};'use strict';var Sequelize=require(_0x590b('0x0'));module['exports']={'name':{'type':Sequelize[_0x590b('0x1')],'unique':_0x590b('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x590b('0x1')]}}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.controller.js b/server/api/mailSubstatus/mailSubstatus.controller.js index f59abd8..196f97c 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 _0x481a=['show','params','create','catch','body','find','describe','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','status','sendStatus','stack','name','send','index','map','rawAttributes','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','where','filter','merge','options','includeAll','MailSubstatus','findAll','rows'];(function(_0x458928,_0x18abb0){var _0x2d584f=function(_0x4b232d){while(--_0x4b232d){_0x458928['push'](_0x458928['shift']());}};_0x2d584f(++_0x18abb0);}(_0x481a,0x9b));var _0xa481=function(_0x399cce,_0x387c33){_0x399cce=_0x399cce-0x0;var _0x27abfa=_0x481a[_0x399cce];return _0x27abfa;};'use strict';var emlformat=require(_0xa481('0x0'));var rimraf=require(_0xa481('0x1'));var zipdir=require(_0xa481('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa481('0x3'));var moment=require(_0xa481('0x4'));var BPromise=require(_0xa481('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0xa481('0x6'));var sox=require(_0xa481('0x7'));var csv=require(_0xa481('0x8'));var ejs=require(_0xa481('0x9'));var fs=require('fs');var fs_extra=require(_0xa481('0xa'));var _=require(_0xa481('0xb'));var squel=require('squel');var crypto=require(_0xa481('0xc'));var jsforce=require(_0xa481('0xd'));var deskjs=require(_0xa481('0xe'));var toCsv=require(_0xa481('0x8'));var querystring=require('querystring');var Papa=require(_0xa481('0xf'));var Redis=require(_0xa481('0x10'));var authService=require(_0xa481('0x11'));var qs=require(_0xa481('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa481('0x13'));var logger=require(_0xa481('0x14'))(_0xa481('0x15'));var utils=require(_0xa481('0x16'));var config=require(_0xa481('0x17'));var licenseUtil=require(_0xa481('0x18'));var db=require(_0xa481('0x19'))['db'];function respondWithStatusCode(_0x5a0177,_0x22274f){_0x22274f=_0x22274f||0xcc;return function(_0x2e8b7f){if(_0x2e8b7f){return _0x5a0177['sendStatus'](_0x22274f);}return _0x5a0177['status'](_0x22274f)[_0xa481('0x1a')]();};}function respondWithResult(_0x32af74,_0x4d42fe){_0x4d42fe=_0x4d42fe||0xc8;return function(_0x146276){if(_0x146276){return _0x32af74['status'](_0x4d42fe)[_0xa481('0x1b')](_0x146276);}};}function respondWithFilteredResult(_0x486b82,_0x1d7474){return function(_0x775c87){if(_0x775c87){var _0x5ba128=typeof _0x1d7474[_0xa481('0x1c')]===_0xa481('0x1d')&&typeof _0x1d7474[_0xa481('0x1e')]===_0xa481('0x1d');var _0x2a6673=_0x775c87[_0xa481('0x1f')];var _0x14ce7f=_0x5ba128?0x0:_0x1d7474['offset'];var _0x267711=_0x5ba128?_0x775c87[_0xa481('0x1f')]:_0x1d7474[_0xa481('0x1c')]+_0x1d7474[_0xa481('0x1e')];var _0x36e5f5;if(_0x267711>=_0x2a6673){_0x267711=_0x2a6673;_0x36e5f5=0xc8;}else{_0x36e5f5=0xce;}_0x486b82['status'](_0x36e5f5);return _0x486b82[_0xa481('0x20')](_0xa481('0x21'),_0x14ce7f+'-'+_0x267711+'/'+_0x2a6673)[_0xa481('0x1b')](_0x775c87);}return null;};}function patchUpdates(_0x196670){return function(_0x25d258){try{jsonpatch['apply'](_0x25d258,_0x196670,!![]);}catch(_0x5549e6){return BPromise[_0xa481('0x22')](_0x5549e6);}return _0x25d258[_0xa481('0x23')]();};}function saveUpdates(_0x2f7dfe,_0xd15622){return function(_0x5379de){if(_0x5379de){return _0x5379de[_0xa481('0x24')](_0x2f7dfe)[_0xa481('0x25')](function(_0x502f0c){return _0x502f0c;});}return null;};}function removeEntity(_0x1b214b,_0x5f07b3){return function(_0x556d33){if(_0x556d33){return _0x556d33[_0xa481('0x26')]()[_0xa481('0x25')](function(){_0x1b214b[_0xa481('0x27')](0xcc)[_0xa481('0x1a')]();});}};}function handleEntityNotFound(_0x2065f3,_0x101455){return function(_0x189e7f){if(!_0x189e7f){_0x2065f3[_0xa481('0x28')](0x194);}return _0x189e7f;};}function handleError(_0x23aa3b,_0x12360a){_0x12360a=_0x12360a||0x1f4;return function(_0x6eada5){logger['error'](_0x6eada5[_0xa481('0x29')]);if(_0x6eada5[_0xa481('0x2a')]){delete _0x6eada5[_0xa481('0x2a')];}_0x23aa3b[_0xa481('0x27')](_0x12360a)[_0xa481('0x2b')](_0x6eada5);};}exports[_0xa481('0x2c')]=function(_0x4d3a03,_0x244391){var _0x2e03c1={},_0x52a186={},_0x39cbd4={'count':0x0,'rows':[]};var _0xf7776e=_[_0xa481('0x2d')](db['MailSubstatus'][_0xa481('0x2e')],function(_0x429372){return{'name':_0x429372['fieldName'],'type':_0x429372['type'][_0xa481('0x2f')]};});_0x52a186[_0xa481('0x30')]=_[_0xa481('0x2d')](_0xf7776e,_0xa481('0x2a'));_0x52a186[_0xa481('0x31')]=_[_0xa481('0x32')](_0x4d3a03[_0xa481('0x31')]);_0x52a186[_0xa481('0x33')]=_[_0xa481('0x34')](_0x52a186[_0xa481('0x30')],_0x52a186[_0xa481('0x31')]);_0x2e03c1[_0xa481('0x35')]=_[_0xa481('0x34')](_0x52a186[_0xa481('0x30')],qs['fields'](_0x4d3a03[_0xa481('0x31')][_0xa481('0x36')]));_0x2e03c1[_0xa481('0x35')]=_0x2e03c1[_0xa481('0x35')][_0xa481('0x37')]?_0x2e03c1[_0xa481('0x35')]:_0x52a186[_0xa481('0x30')];if(!_0x4d3a03[_0xa481('0x31')][_0xa481('0x38')](_0xa481('0x39'))){_0x2e03c1[_0xa481('0x1e')]=qs[_0xa481('0x1e')](_0x4d3a03['query'][_0xa481('0x1e')]);_0x2e03c1[_0xa481('0x1c')]=qs[_0xa481('0x1c')](_0x4d3a03['query'][_0xa481('0x1c')]);}_0x2e03c1[_0xa481('0x3a')]=qs['sort'](_0x4d3a03['query']['sort']);_0x2e03c1[_0xa481('0x3b')]=qs[_0xa481('0x33')](_['pick'](_0x4d3a03['query'],_0x52a186[_0xa481('0x33')]),_0xf7776e);if(_0x4d3a03['query'][_0xa481('0x3c')]){_0x2e03c1[_0xa481('0x3b')]=_[_0xa481('0x3d')](_0x2e03c1[_0xa481('0x3b')],{'$or':_[_0xa481('0x2d')](_0xf7776e,function(_0x337902){if(_0x337902['type']!=='VIRTUAL'){var _0x465a13={};_0x465a13[_0x337902[_0xa481('0x2a')]]={'$like':'%'+_0x4d3a03[_0xa481('0x31')][_0xa481('0x3c')]+'%'};return _0x465a13;}})});}_0x2e03c1=_['merge']({},_0x2e03c1,_0x4d3a03[_0xa481('0x3e')]);var _0x1ba98e={'where':_0x2e03c1[_0xa481('0x3b')]};return db['MailSubstatus'][_0xa481('0x1f')](_0x1ba98e)[_0xa481('0x25')](function(_0x3a4f9f){_0x39cbd4[_0xa481('0x1f')]=_0x3a4f9f;if(_0x4d3a03['query'][_0xa481('0x3f')]){_0x2e03c1['include']=[{'all':!![]}];}return db[_0xa481('0x40')][_0xa481('0x41')](_0x2e03c1);})[_0xa481('0x25')](function(_0x5ab953){_0x39cbd4[_0xa481('0x42')]=_0x5ab953;return _0x39cbd4;})[_0xa481('0x25')](respondWithFilteredResult(_0x244391,_0x2e03c1))['catch'](handleError(_0x244391,null));};exports[_0xa481('0x43')]=function(_0x2df098,_0x5c6025){var _0x32c4fe={'raw':!![],'where':{'id':_0x2df098[_0xa481('0x44')]['id']}},_0x4d8e52={};_0x4d8e52[_0xa481('0x30')]=_[_0xa481('0x32')](db[_0xa481('0x40')]['rawAttributes']);_0x4d8e52[_0xa481('0x31')]=_[_0xa481('0x32')](_0x2df098[_0xa481('0x31')]);_0x4d8e52[_0xa481('0x33')]=_['intersection'](_0x4d8e52['model'],_0x4d8e52['query']);_0x32c4fe[_0xa481('0x35')]=_[_0xa481('0x34')](_0x4d8e52[_0xa481('0x30')],qs[_0xa481('0x36')](_0x2df098[_0xa481('0x31')][_0xa481('0x36')]));_0x32c4fe['attributes']=_0x32c4fe[_0xa481('0x35')][_0xa481('0x37')]?_0x32c4fe['attributes']:_0x4d8e52[_0xa481('0x30')];if(_0x2df098[_0xa481('0x31')]['includeAll']){_0x32c4fe['include']=[{'all':!![]}];}_0x32c4fe=_[_0xa481('0x3d')]({},_0x32c4fe,_0x2df098[_0xa481('0x3e')]);return db[_0xa481('0x40')]['find'](_0x32c4fe)['then'](handleEntityNotFound(_0x5c6025,null))['then'](respondWithResult(_0x5c6025,null))['catch'](handleError(_0x5c6025,null));};exports[_0xa481('0x45')]=function(_0x82a302,_0x3785e8){return db[_0xa481('0x40')][_0xa481('0x45')](_0x82a302['body'],{})[_0xa481('0x25')](respondWithResult(_0x3785e8,0xc9))[_0xa481('0x46')](handleError(_0x3785e8,null));};exports[_0xa481('0x24')]=function(_0x1c9a17,_0x35c336){if(_0x1c9a17['body']['id']){delete _0x1c9a17[_0xa481('0x47')]['id'];}return db[_0xa481('0x40')][_0xa481('0x48')]({'where':{'id':_0x1c9a17[_0xa481('0x44')]['id']}})[_0xa481('0x25')](handleEntityNotFound(_0x35c336,null))[_0xa481('0x25')](saveUpdates(_0x1c9a17[_0xa481('0x47')],null))[_0xa481('0x25')](respondWithResult(_0x35c336,null))[_0xa481('0x46')](handleError(_0x35c336,null));};exports[_0xa481('0x26')]=function(_0x515747,_0x316eef){return db[_0xa481('0x40')][_0xa481('0x48')]({'where':{'id':_0x515747[_0xa481('0x44')]['id']}})[_0xa481('0x25')](handleEntityNotFound(_0x316eef,null))[_0xa481('0x25')](removeEntity(_0x316eef,null))[_0xa481('0x46')](handleError(_0x316eef,null));};exports[_0xa481('0x49')]=function(_0x482bde,_0xc69af3){return db[_0xa481('0x40')][_0xa481('0x49')]()['then'](respondWithResult(_0xc69af3,null))[_0xa481('0x46')](handleError(_0xc69af3,null));}; \ No newline at end of file +var _0x2f8e=['show','params','rawAttributes','find','create','body','update','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','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','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','reject','save','destroy','then','end','error','stack','name','index','map','fieldName','key','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','type','VIRTUAL','options','MailSubstatus','includeAll','include','findAll','rows','catch'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x2f8e,0x14c));var _0xe2f8=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x2f8e[_0x1facfa];return _0x9ec701;};'use strict';var emlformat=require(_0xe2f8('0x0'));var rimraf=require(_0xe2f8('0x1'));var zipdir=require(_0xe2f8('0x2'));var jsonpatch=require(_0xe2f8('0x3'));var rp=require(_0xe2f8('0x4'));var moment=require('moment');var BPromise=require(_0xe2f8('0x5'));var Mustache=require(_0xe2f8('0x6'));var util=require(_0xe2f8('0x7'));var path=require(_0xe2f8('0x8'));var sox=require(_0xe2f8('0x9'));var csv=require('to-csv');var ejs=require(_0xe2f8('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xe2f8('0xb'));var squel=require(_0xe2f8('0xc'));var crypto=require(_0xe2f8('0xd'));var jsforce=require(_0xe2f8('0xe'));var deskjs=require(_0xe2f8('0xf'));var toCsv=require(_0xe2f8('0x10'));var querystring=require(_0xe2f8('0x11'));var Papa=require(_0xe2f8('0x12'));var Redis=require(_0xe2f8('0x13'));var authService=require(_0xe2f8('0x14'));var qs=require(_0xe2f8('0x15'));var as=require(_0xe2f8('0x16'));var hardwareService=require(_0xe2f8('0x17'));var logger=require(_0xe2f8('0x18'))('api');var utils=require(_0xe2f8('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0xe2f8('0x1a'));var db=require(_0xe2f8('0x1b'))['db'];function respondWithStatusCode(_0x39f533,_0x3fd2ba){_0x3fd2ba=_0x3fd2ba||0xcc;return function(_0x2683b3){if(_0x2683b3){return _0x39f533[_0xe2f8('0x1c')](_0x3fd2ba);}return _0x39f533[_0xe2f8('0x1d')](_0x3fd2ba)['end']();};}function respondWithResult(_0x5196c0,_0x3c13e9){_0x3c13e9=_0x3c13e9||0xc8;return function(_0x513abc){if(_0x513abc){return _0x5196c0['status'](_0x3c13e9)[_0xe2f8('0x1e')](_0x513abc);}};}function respondWithFilteredResult(_0x23d0d1,_0x48bfe1){return function(_0x3f29ce){if(_0x3f29ce){var _0x2f7e21=typeof _0x48bfe1[_0xe2f8('0x1f')]==='undefined'&&typeof _0x48bfe1['limit']===_0xe2f8('0x20');var _0x59feef=_0x3f29ce[_0xe2f8('0x21')];var _0x36318c=_0x2f7e21?0x0:_0x48bfe1[_0xe2f8('0x1f')];var _0x362cae=_0x2f7e21?_0x3f29ce['count']:_0x48bfe1[_0xe2f8('0x1f')]+_0x48bfe1[_0xe2f8('0x22')];var _0x23672c;if(_0x362cae>=_0x59feef){_0x362cae=_0x59feef;_0x23672c=0xc8;}else{_0x23672c=0xce;}_0x23d0d1[_0xe2f8('0x1d')](_0x23672c);return _0x23d0d1[_0xe2f8('0x23')](_0xe2f8('0x24'),_0x36318c+'-'+_0x362cae+'/'+_0x59feef)[_0xe2f8('0x1e')](_0x3f29ce);}return null;};}function patchUpdates(_0x2ab81c){return function(_0x31f848){try{jsonpatch['apply'](_0x31f848,_0x2ab81c,!![]);}catch(_0x471994){return BPromise[_0xe2f8('0x25')](_0x471994);}return _0x31f848[_0xe2f8('0x26')]();};}function saveUpdates(_0x37c01e,_0x175de0){return function(_0x5b82f5){if(_0x5b82f5){return _0x5b82f5['update'](_0x37c01e)['then'](function(_0x12824e){return _0x12824e;});}return null;};}function removeEntity(_0x5b400e,_0x13daee){return function(_0x57f030){if(_0x57f030){return _0x57f030[_0xe2f8('0x27')]()[_0xe2f8('0x28')](function(){_0x5b400e[_0xe2f8('0x1d')](0xcc)[_0xe2f8('0x29')]();});}};}function handleEntityNotFound(_0x55df85,_0x3ccdcf){return function(_0x35da8e){if(!_0x35da8e){_0x55df85[_0xe2f8('0x1c')](0x194);}return _0x35da8e;};}function handleError(_0x5b6346,_0x314214){_0x314214=_0x314214||0x1f4;return function(_0x307a81){logger[_0xe2f8('0x2a')](_0x307a81[_0xe2f8('0x2b')]);if(_0x307a81[_0xe2f8('0x2c')]){delete _0x307a81[_0xe2f8('0x2c')];}_0x5b6346[_0xe2f8('0x1d')](_0x314214)['send'](_0x307a81);};}exports[_0xe2f8('0x2d')]=function(_0xbcf1ed,_0x52a7d4){var _0x134f1f={},_0x1acdb2={},_0x375c3f={'count':0x0,'rows':[]};var _0x29319b=_[_0xe2f8('0x2e')](db['MailSubstatus']['rawAttributes'],function(_0x4d453e){return{'name':_0x4d453e[_0xe2f8('0x2f')],'type':_0x4d453e['type'][_0xe2f8('0x30')]};});_0x1acdb2[_0xe2f8('0x31')]=_['map'](_0x29319b,'name');_0x1acdb2['query']=_[_0xe2f8('0x32')](_0xbcf1ed[_0xe2f8('0x33')]);_0x1acdb2[_0xe2f8('0x34')]=_['intersection'](_0x1acdb2['model'],_0x1acdb2['query']);_0x134f1f['attributes']=_[_0xe2f8('0x35')](_0x1acdb2[_0xe2f8('0x31')],qs[_0xe2f8('0x36')](_0xbcf1ed[_0xe2f8('0x33')][_0xe2f8('0x36')]));_0x134f1f[_0xe2f8('0x37')]=_0x134f1f[_0xe2f8('0x37')][_0xe2f8('0x38')]?_0x134f1f[_0xe2f8('0x37')]:_0x1acdb2[_0xe2f8('0x31')];if(!_0xbcf1ed[_0xe2f8('0x33')][_0xe2f8('0x39')](_0xe2f8('0x3a'))){_0x134f1f[_0xe2f8('0x22')]=qs[_0xe2f8('0x22')](_0xbcf1ed['query'][_0xe2f8('0x22')]);_0x134f1f['offset']=qs['offset'](_0xbcf1ed[_0xe2f8('0x33')][_0xe2f8('0x1f')]);}_0x134f1f[_0xe2f8('0x3b')]=qs[_0xe2f8('0x3c')](_0xbcf1ed[_0xe2f8('0x33')]['sort']);_0x134f1f[_0xe2f8('0x3d')]=qs['filters'](_['pick'](_0xbcf1ed[_0xe2f8('0x33')],_0x1acdb2[_0xe2f8('0x34')]),_0x29319b);if(_0xbcf1ed[_0xe2f8('0x33')][_0xe2f8('0x3e')]){_0x134f1f['where']=_[_0xe2f8('0x3f')](_0x134f1f['where'],{'$or':_[_0xe2f8('0x2e')](_0x29319b,function(_0x4bec2e){if(_0x4bec2e[_0xe2f8('0x40')]!==_0xe2f8('0x41')){var _0x193da0={};_0x193da0[_0x4bec2e['name']]={'$like':'%'+_0xbcf1ed[_0xe2f8('0x33')][_0xe2f8('0x3e')]+'%'};return _0x193da0;}})});}_0x134f1f=_['merge']({},_0x134f1f,_0xbcf1ed[_0xe2f8('0x42')]);var _0x26166b={'where':_0x134f1f[_0xe2f8('0x3d')]};return db[_0xe2f8('0x43')][_0xe2f8('0x21')](_0x26166b)[_0xe2f8('0x28')](function(_0x314799){_0x375c3f[_0xe2f8('0x21')]=_0x314799;if(_0xbcf1ed[_0xe2f8('0x33')][_0xe2f8('0x44')]){_0x134f1f[_0xe2f8('0x45')]=[{'all':!![]}];}return db['MailSubstatus'][_0xe2f8('0x46')](_0x134f1f);})[_0xe2f8('0x28')](function(_0x26bc6b){_0x375c3f[_0xe2f8('0x47')]=_0x26bc6b;return _0x375c3f;})[_0xe2f8('0x28')](respondWithFilteredResult(_0x52a7d4,_0x134f1f))[_0xe2f8('0x48')](handleError(_0x52a7d4,null));};exports[_0xe2f8('0x49')]=function(_0x1718ed,_0x53d10e){var _0x2883a4={'raw':!![],'where':{'id':_0x1718ed[_0xe2f8('0x4a')]['id']}},_0x40020c={};_0x40020c['model']=_[_0xe2f8('0x32')](db[_0xe2f8('0x43')][_0xe2f8('0x4b')]);_0x40020c['query']=_['keys'](_0x1718ed[_0xe2f8('0x33')]);_0x40020c[_0xe2f8('0x34')]=_[_0xe2f8('0x35')](_0x40020c[_0xe2f8('0x31')],_0x40020c['query']);_0x2883a4[_0xe2f8('0x37')]=_[_0xe2f8('0x35')](_0x40020c['model'],qs[_0xe2f8('0x36')](_0x1718ed[_0xe2f8('0x33')][_0xe2f8('0x36')]));_0x2883a4[_0xe2f8('0x37')]=_0x2883a4[_0xe2f8('0x37')]['length']?_0x2883a4[_0xe2f8('0x37')]:_0x40020c[_0xe2f8('0x31')];if(_0x1718ed[_0xe2f8('0x33')][_0xe2f8('0x44')]){_0x2883a4[_0xe2f8('0x45')]=[{'all':!![]}];}_0x2883a4=_[_0xe2f8('0x3f')]({},_0x2883a4,_0x1718ed[_0xe2f8('0x42')]);return db[_0xe2f8('0x43')][_0xe2f8('0x4c')](_0x2883a4)['then'](handleEntityNotFound(_0x53d10e,null))[_0xe2f8('0x28')](respondWithResult(_0x53d10e,null))[_0xe2f8('0x48')](handleError(_0x53d10e,null));};exports[_0xe2f8('0x4d')]=function(_0x55c1f2,_0x32fe49){return db[_0xe2f8('0x43')][_0xe2f8('0x4d')](_0x55c1f2[_0xe2f8('0x4e')],{})[_0xe2f8('0x28')](respondWithResult(_0x32fe49,0xc9))[_0xe2f8('0x48')](handleError(_0x32fe49,null));};exports[_0xe2f8('0x4f')]=function(_0x1aa95e,_0x7664f5){if(_0x1aa95e[_0xe2f8('0x4e')]['id']){delete _0x1aa95e['body']['id'];}return db['MailSubstatus'][_0xe2f8('0x4c')]({'where':{'id':_0x1aa95e[_0xe2f8('0x4a')]['id']}})[_0xe2f8('0x28')](handleEntityNotFound(_0x7664f5,null))[_0xe2f8('0x28')](saveUpdates(_0x1aa95e[_0xe2f8('0x4e')],null))[_0xe2f8('0x28')](respondWithResult(_0x7664f5,null))[_0xe2f8('0x48')](handleError(_0x7664f5,null));};exports['destroy']=function(_0x544ff4,_0x882159){return db[_0xe2f8('0x43')][_0xe2f8('0x4c')]({'where':{'id':_0x544ff4[_0xe2f8('0x4a')]['id']}})[_0xe2f8('0x28')](handleEntityNotFound(_0x882159,null))[_0xe2f8('0x28')](removeEntity(_0x882159,null))[_0xe2f8('0x48')](handleError(_0x882159,null));};exports[_0xe2f8('0x50')]=function(_0x5b7f66,_0x2e39de){return db[_0xe2f8('0x43')]['describe']()['then'](respondWithResult(_0x2e39de,null))[_0xe2f8('0x48')](handleError(_0x2e39de,null));}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.events.js b/server/api/mailSubstatus/mailSubstatus.events.js index 456ddd0..0408852 100644 --- a/server/api/mailSubstatus/mailSubstatus.events.js +++ b/server/api/mailSubstatus/mailSubstatus.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4d40=['setMaxListeners','update','emit','hasOwnProperty','hook','exports','../../mysqldb','MailSubstatus'];(function(_0x3a70e4,_0x3cf370){var _0x29de9a=function(_0xa6e3a1){while(--_0xa6e3a1){_0x3a70e4['push'](_0x3a70e4['shift']());}};_0x29de9a(++_0x3cf370);}(_0x4d40,0x166));var _0x04d4=function(_0x461e0f,_0x372b1a){_0x461e0f=_0x461e0f-0x0;var _0x290778=_0x4d40[_0x461e0f];return _0x290778;};'use strict';var EventEmitter=require('events');var MailSubstatus=require(_0x04d4('0x0'))['db'][_0x04d4('0x1')];var MailSubstatusEvents=new EventEmitter();MailSubstatusEvents[_0x04d4('0x2')](0x0);var events={'afterUpdate':_0x04d4('0x3')};function emitEvent(_0x273ac8){return function(_0x1c5ca0,_0x591947,_0x3d809d){MailSubstatusEvents['emit'](_0x273ac8+':'+_0x1c5ca0['id'],_0x1c5ca0);MailSubstatusEvents[_0x04d4('0x4')](_0x273ac8,_0x1c5ca0);_0x3d809d(null);};}for(var e in events){if(events[_0x04d4('0x5')](e)){var event=events[e];MailSubstatus[_0x04d4('0x6')](e,emitEvent(event));}}module[_0x04d4('0x7')]=MailSubstatusEvents; \ No newline at end of file +var _0xd3c8=['exports','events','setMaxListeners','update','emit','hasOwnProperty','hook'];(function(_0xbe15ce,_0x4c3f35){var _0x2797bb=function(_0x37f618){while(--_0x37f618){_0xbe15ce['push'](_0xbe15ce['shift']());}};_0x2797bb(++_0x4c3f35);}(_0xd3c8,0xa9));var _0x8d3c=function(_0x421037,_0x124f6c){_0x421037=_0x421037-0x0;var _0x43c973=_0xd3c8[_0x421037];return _0x43c973;};'use strict';var EventEmitter=require(_0x8d3c('0x0'));var MailSubstatus=require('../../mysqldb')['db']['MailSubstatus'];var MailSubstatusEvents=new EventEmitter();MailSubstatusEvents[_0x8d3c('0x1')](0x0);var events={'afterUpdate':_0x8d3c('0x2')};function emitEvent(_0x2e3b35){return function(_0x46df2e,_0x371c26,_0x31e45d){MailSubstatusEvents[_0x8d3c('0x3')](_0x2e3b35+':'+_0x46df2e['id'],_0x46df2e);MailSubstatusEvents[_0x8d3c('0x3')](_0x2e3b35,_0x46df2e);_0x31e45d(null);};}for(var e in events){if(events[_0x8d3c('0x4')](e)){var event=events[e];MailSubstatus[_0x8d3c('0x5')](e,emitEvent(event));}}module[_0x8d3c('0x6')]=MailSubstatusEvents; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.model.js b/server/api/mailSubstatus/mailSubstatus.model.js index 29deb71..44a7aea 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 _0xf963=['name','mailSubstatus','_previousDataValues','catch','./mailSubstatus.attributes','exports','models','MailSubstatus','Condition','update'];(function(_0x44e201,_0x2477f9){var _0xb720a9=function(_0x52c73f){while(--_0x52c73f){_0x44e201['push'](_0x44e201['shift']());}};_0xb720a9(++_0x2477f9);}(_0xf963,0x13a));var _0x3f96=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0xf963[_0x397e5f];return _0x5302b8;};'use strict';var attributes=require(_0x3f96('0x0'));module[_0x3f96('0x1')]=function(_0x481e72){var _0x3cc217=_0x481e72[_0x3f96('0x2')];return _0x481e72['define'](_0x3f96('0x3'),attributes,{'tableName':'mail_substatuses','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterUpdate':function(_0x17670c,_0x4e1e75,_0x4282a6){return _0x3cc217[_0x3f96('0x4')][_0x3f96('0x5')]({'value':_0x17670c[_0x3f96('0x6')]},{'where':{'field':_0x3f96('0x7'),'value':_0x17670c[_0x3f96('0x8')][_0x3f96('0x6')]}})['then'](function(){_0x4282a6();})[_0x3f96('0x9')](function(_0x4901ed){_0x4282a6(_0x4901ed);});}}});}; \ No newline at end of file +var _0x31b6=['then','catch','./mailSubstatus.attributes','exports','models','define','MailSubstatus','mail_substatuses','Condition','mailSubstatus','_previousDataValues','name'];(function(_0x3a4ca2,_0x3cd319){var _0x292877=function(_0x50e467){while(--_0x50e467){_0x3a4ca2['push'](_0x3a4ca2['shift']());}};_0x292877(++_0x3cd319);}(_0x31b6,0x7a));var _0x631b=function(_0x403be8,_0x2eccc5){_0x403be8=_0x403be8-0x0;var _0x467f57=_0x31b6[_0x403be8];return _0x467f57;};'use strict';var attributes=require(_0x631b('0x0'));module[_0x631b('0x1')]=function(_0x3e2da9){var _0x27fcbd=_0x3e2da9[_0x631b('0x2')];return _0x3e2da9[_0x631b('0x3')](_0x631b('0x4'),attributes,{'tableName':_0x631b('0x5'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterUpdate':function(_0x33c00c,_0x33460f,_0x109899){return _0x27fcbd[_0x631b('0x6')]['update']({'value':_0x33c00c['name']},{'where':{'field':_0x631b('0x7'),'value':_0x33c00c[_0x631b('0x8')][_0x631b('0x9')]}})[_0x631b('0xa')](function(){_0x109899();})[_0x631b('0xb')](function(_0x264b35){_0x109899(_0x264b35);});}}});}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.rpc.js b/server/api/mailSubstatus/mailSubstatus.rpc.js index 4322659..1ba5457 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 _0xa02c=['info','MailSubstatus,\x20%s,\x20%s','request\x20sent','debug','MailSubstatus,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request'];(function(_0x5a5025,_0x2d99f9){var _0x1e144a=function(_0x1847b4){while(--_0x1847b4){_0x5a5025['push'](_0x5a5025['shift']());}};_0x1e144a(++_0x2d99f9);}(_0xa02c,0xd1));var _0xca02=function(_0x57372d,_0x32646b){_0x57372d=_0x57372d-0x0;var _0x39fec5=_0xa02c[_0x57372d];return _0x39fec5;};'use strict';var _=require(_0xca02('0x0'));var util=require(_0xca02('0x1'));var moment=require(_0xca02('0x2'));var BPromise=require('bluebird');var rs=require(_0xca02('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xca02('0x4'))['db'];var utils=require(_0xca02('0x5'));var logger=require('../../config/logger')(_0xca02('0x6'));var config=require(_0xca02('0x7'));var jayson=require(_0xca02('0x8'));var client=jayson[_0xca02('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2d288d,_0x427b5f,_0x1abf37){return new BPromise(function(_0x20480c,_0xa8b75b){return client[_0xca02('0xa')](_0x2d288d,_0x1abf37)['then'](function(_0x91ae49){logger[_0xca02('0xb')](_0xca02('0xc'),_0x427b5f,_0xca02('0xd'));logger[_0xca02('0xe')](_0xca02('0xf'),_0x427b5f,_0xca02('0xd'),JSON[_0xca02('0x10')](_0x91ae49));if(_0x91ae49[_0xca02('0x11')]){if(_0x91ae49[_0xca02('0x11')][_0xca02('0x12')]===0x1f4){logger[_0xca02('0x11')](_0xca02('0xc'),_0x427b5f,_0x91ae49[_0xca02('0x11')][_0xca02('0x13')]);return _0xa8b75b(_0x91ae49[_0xca02('0x11')]['message']);}logger[_0xca02('0x11')](_0xca02('0xc'),_0x427b5f,_0x91ae49['error'][_0xca02('0x13')]);return _0x20480c(_0x91ae49[_0xca02('0x11')][_0xca02('0x13')]);}else{logger[_0xca02('0xb')](_0xca02('0xc'),_0x427b5f,_0xca02('0xd'));_0x20480c(_0x91ae49[_0xca02('0x14')][_0xca02('0x13')]);}})[_0xca02('0x15')](function(_0x349b6e){logger[_0xca02('0x11')](_0xca02('0xc'),_0x427b5f,_0x349b6e);_0xa8b75b(_0x349b6e);});});} \ No newline at end of file +var _0x0350=['stringify','error','code','message','result','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','MailSubstatus,\x20%s,\x20%s','request\x20sent','MailSubstatus,\x20%s,\x20%s,\x20%s'];(function(_0x441ae2,_0x23e71b){var _0x21be62=function(_0x147455){while(--_0x147455){_0x441ae2['push'](_0x441ae2['shift']());}};_0x21be62(++_0x23e71b);}(_0x0350,0x84));var _0x0035=function(_0x1ea3d6,_0x51bea2){_0x1ea3d6=_0x1ea3d6-0x0;var _0x4fdf5e=_0x0350[_0x1ea3d6];return _0x4fdf5e;};'use strict';var _=require(_0x0035('0x0'));var util=require(_0x0035('0x1'));var moment=require(_0x0035('0x2'));var BPromise=require(_0x0035('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0035('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x0035('0x5'))(_0x0035('0x6'));var config=require(_0x0035('0x7'));var jayson=require(_0x0035('0x8'));var client=jayson['client'][_0x0035('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xe7acd0,_0x274619,_0x1dc5ce){return new BPromise(function(_0x4738d8,_0x409469){return client[_0x0035('0xa')](_0xe7acd0,_0x1dc5ce)['then'](function(_0x4539fc){logger[_0x0035('0xb')](_0x0035('0xc'),_0x274619,_0x0035('0xd'));logger['debug'](_0x0035('0xe'),_0x274619,_0x0035('0xd'),JSON[_0x0035('0xf')](_0x4539fc));if(_0x4539fc[_0x0035('0x10')]){if(_0x4539fc[_0x0035('0x10')][_0x0035('0x11')]===0x1f4){logger[_0x0035('0x10')]('MailSubstatus,\x20%s,\x20%s',_0x274619,_0x4539fc[_0x0035('0x10')][_0x0035('0x12')]);return _0x409469(_0x4539fc[_0x0035('0x10')][_0x0035('0x12')]);}logger[_0x0035('0x10')]('MailSubstatus,\x20%s,\x20%s',_0x274619,_0x4539fc[_0x0035('0x10')]['message']);return _0x4738d8(_0x4539fc[_0x0035('0x10')][_0x0035('0x12')]);}else{logger[_0x0035('0xb')]('MailSubstatus,\x20%s,\x20%s',_0x274619,'request\x20sent');_0x4738d8(_0x4539fc[_0x0035('0x13')][_0x0035('0x12')]);}})[_0x0035('0x14')](function(_0x1bd243){logger[_0x0035('0x10')](_0x0035('0xc'),_0x274619,_0x1bd243);_0x409469(_0x1bd243);});});} \ No newline at end of file diff --git a/server/api/mailTransferReport/index.js b/server/api/mailTransferReport/index.js index 374dd01..ddda7e7 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 _0x043e=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailTransferReport.controller','get','index','/describe','isAuthenticated','describe','/:id','show','post','create','put','update','delete','multer','path','connect-timeout'];(function(_0x20cbfc,_0x43434b){var _0x4380b5=function(_0x4bb623){while(--_0x4bb623){_0x20cbfc['push'](_0x20cbfc['shift']());}};_0x4380b5(++_0x43434b);}(_0x043e,0x6b));var _0xe043=function(_0x40a8c3,_0x579008){_0x40a8c3=_0x40a8c3-0x0;var _0x209f91=_0x043e[_0x40a8c3];return _0x209f91;};'use strict';var multer=require(_0xe043('0x0'));var util=require('util');var path=require(_0xe043('0x1'));var timeout=require(_0xe043('0x2'));var express=require(_0xe043('0x3'));var router=express[_0xe043('0x4')]();var fs_extra=require(_0xe043('0x5'));var auth=require(_0xe043('0x6'));var interaction=require(_0xe043('0x7'));var config=require(_0xe043('0x8'));var controller=require(_0xe043('0x9'));router[_0xe043('0xa')]('/',auth['isAuthenticated'](),controller[_0xe043('0xb')]);router[_0xe043('0xa')](_0xe043('0xc'),auth[_0xe043('0xd')](),controller[_0xe043('0xe')]);router[_0xe043('0xa')](_0xe043('0xf'),auth[_0xe043('0xd')](),controller[_0xe043('0x10')]);router[_0xe043('0x11')]('/',auth[_0xe043('0xd')](),controller[_0xe043('0x12')]);router[_0xe043('0x13')]('/:id',auth[_0xe043('0xd')](),controller[_0xe043('0x14')]);router[_0xe043('0x15')](_0xe043('0xf'),auth[_0xe043('0xd')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x3dcb=['/describe','/:id','show','post','create','put','destroy','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index'];(function(_0x476cda,_0x3328ac){var _0x3ebd06=function(_0x26a2ac){while(--_0x26a2ac){_0x476cda['push'](_0x476cda['shift']());}};_0x3ebd06(++_0x3328ac);}(_0x3dcb,0x128));var _0xb3dc=function(_0x817a06,_0x2a1577){_0x817a06=_0x817a06-0x0;var _0x2115b9=_0x3dcb[_0x817a06];return _0x2115b9;};'use strict';var multer=require('multer');var util=require(_0xb3dc('0x0'));var path=require(_0xb3dc('0x1'));var timeout=require(_0xb3dc('0x2'));var express=require('express');var router=express[_0xb3dc('0x3')]();var fs_extra=require(_0xb3dc('0x4'));var auth=require(_0xb3dc('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xb3dc('0x6'));var controller=require('./mailTransferReport.controller');router[_0xb3dc('0x7')]('/',auth[_0xb3dc('0x8')](),controller[_0xb3dc('0x9')]);router[_0xb3dc('0x7')](_0xb3dc('0xa'),auth[_0xb3dc('0x8')](),controller['describe']);router['get'](_0xb3dc('0xb'),auth[_0xb3dc('0x8')](),controller[_0xb3dc('0xc')]);router[_0xb3dc('0xd')]('/',auth['isAuthenticated'](),controller[_0xb3dc('0xe')]);router[_0xb3dc('0xf')](_0xb3dc('0xb'),auth[_0xb3dc('0x8')](),controller['update']);router['delete'](_0xb3dc('0xb'),auth[_0xb3dc('0x8')](),controller[_0xb3dc('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.attributes.js b/server/api/mailTransferReport/mailTransferReport.attributes.js index 5232647..b3d03c0 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 _0x70e0=['NOW','moment','sequelize','exports','account','agent','queue'];(function(_0x3da04d,_0x542eb0){var _0x4c83b0=function(_0x5b679f){while(--_0x5b679f){_0x3da04d['push'](_0x3da04d['shift']());}};_0x4c83b0(++_0x542eb0);}(_0x70e0,0x17b));var _0x070e=function(_0x3d8b15,_0x382056){_0x3d8b15=_0x3d8b15-0x0;var _0x27828a=_0x70e0[_0x3d8b15];return _0x27828a;};'use strict';var moment=require(_0x070e('0x0'));var Sequelize=require(_0x070e('0x1'));module[_0x070e('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x070e('0x3'),_0x070e('0x4'),_0x070e('0x5')),'allowNull':![],'defaultValue':_0x070e('0x5')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x070e('0x6')]}}; \ No newline at end of file +var _0xf4eb=['NOW','moment','account','queue','DATE'];(function(_0x36617a,_0x48348b){var _0xf55cfb=function(_0x4ac25c){while(--_0x4ac25c){_0x36617a['push'](_0x36617a['shift']());}};_0xf55cfb(++_0x48348b);}(_0xf4eb,0xec));var _0xbf4e=function(_0x30896f,_0x3240ee){_0x30896f=_0x30896f-0x0;var _0x39259b=_0xf4eb[_0x30896f];return _0x39259b;};'use strict';var moment=require(_0xbf4e('0x0'));var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xbf4e('0x1'),'agent','queue'),'allowNull':![],'defaultValue':_0xbf4e('0x2')},'transferredAt':{'type':Sequelize[_0xbf4e('0x3')],'allowNull':![],'defaultValue':Sequelize[_0xbf4e('0x4')]}}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.controller.js b/server/api/mailTransferReport/mailTransferReport.controller.js index f85f8cb..5cf097b 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 _0xbfc0=['sendStatus','end','json','undefined','count','offset','status','Content-Range','apply','then','destroy','error','stack','name','send','map','MailTransferReport','fieldName','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','findAll','rows','catch','show','params','rawAttributes','include','options','find','create','update','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment'];(function(_0x4b2436,_0x452299){var _0x4f5ab2=function(_0x5c6679){while(--_0x5c6679){_0x4b2436['push'](_0x4b2436['shift']());}};_0x4f5ab2(++_0x452299);}(_0xbfc0,0x1aa));var _0x0bfc=function(_0xe84805,_0x2702d9){_0xe84805=_0xe84805-0x0;var _0x398efd=_0xbfc0[_0xe84805];return _0x398efd;};'use strict';var emlformat=require(_0x0bfc('0x0'));var rimraf=require(_0x0bfc('0x1'));var zipdir=require(_0x0bfc('0x2'));var jsonpatch=require(_0x0bfc('0x3'));var rp=require('request-promise');var moment=require(_0x0bfc('0x4'));var BPromise=require(_0x0bfc('0x5'));var Mustache=require(_0x0bfc('0x6'));var util=require('util');var path=require('path');var sox=require(_0x0bfc('0x7'));var csv=require(_0x0bfc('0x8'));var ejs=require(_0x0bfc('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0bfc('0xa'));var squel=require(_0x0bfc('0xb'));var crypto=require(_0x0bfc('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x0bfc('0xd'));var toCsv=require(_0x0bfc('0x8'));var querystring=require(_0x0bfc('0xe'));var Papa=require(_0x0bfc('0xf'));var Redis=require(_0x0bfc('0x10'));var authService=require(_0x0bfc('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x0bfc('0x12'));var hardwareService=require(_0x0bfc('0x13'));var logger=require(_0x0bfc('0x14'))(_0x0bfc('0x15'));var utils=require(_0x0bfc('0x16'));var config=require(_0x0bfc('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2ca614,_0x177937){_0x177937=_0x177937||0xcc;return function(_0x58d02e){if(_0x58d02e){return _0x2ca614[_0x0bfc('0x18')](_0x177937);}return _0x2ca614['status'](_0x177937)[_0x0bfc('0x19')]();};}function respondWithResult(_0x579c11,_0x482458){_0x482458=_0x482458||0xc8;return function(_0x63b8f5){if(_0x63b8f5){return _0x579c11['status'](_0x482458)[_0x0bfc('0x1a')](_0x63b8f5);}};}function respondWithFilteredResult(_0x35ad1b,_0x4e428e){return function(_0x50a331){if(_0x50a331){var _0xd29226=typeof _0x4e428e['offset']===_0x0bfc('0x1b')&&typeof _0x4e428e['limit']==='undefined';var _0x158b1e=_0x50a331['count'];var _0x5d8230=_0xd29226?0x0:_0x4e428e['offset'];var _0x1de500=_0xd29226?_0x50a331[_0x0bfc('0x1c')]:_0x4e428e[_0x0bfc('0x1d')]+_0x4e428e['limit'];var _0x1777b9;if(_0x1de500>=_0x158b1e){_0x1de500=_0x158b1e;_0x1777b9=0xc8;}else{_0x1777b9=0xce;}_0x35ad1b[_0x0bfc('0x1e')](_0x1777b9);return _0x35ad1b['set'](_0x0bfc('0x1f'),_0x5d8230+'-'+_0x1de500+'/'+_0x158b1e)['json'](_0x50a331);}return null;};}function patchUpdates(_0x2736d0){return function(_0x982bdd){try{jsonpatch[_0x0bfc('0x20')](_0x982bdd,_0x2736d0,!![]);}catch(_0x3ad451){return BPromise['reject'](_0x3ad451);}return _0x982bdd['save']();};}function saveUpdates(_0x68e069,_0x1a0c92){return function(_0x49e2a3){if(_0x49e2a3){return _0x49e2a3['update'](_0x68e069)[_0x0bfc('0x21')](function(_0x4b5def){return _0x4b5def;});}return null;};}function removeEntity(_0x3664c6,_0x1e4131){return function(_0x185166){if(_0x185166){return _0x185166[_0x0bfc('0x22')]()['then'](function(){_0x3664c6[_0x0bfc('0x1e')](0xcc)[_0x0bfc('0x19')]();});}};}function handleEntityNotFound(_0x4f77e7,_0x3db58b){return function(_0x1ac057){if(!_0x1ac057){_0x4f77e7[_0x0bfc('0x18')](0x194);}return _0x1ac057;};}function handleError(_0x53afdb,_0x430f6c){_0x430f6c=_0x430f6c||0x1f4;return function(_0x485d23){logger[_0x0bfc('0x23')](_0x485d23[_0x0bfc('0x24')]);if(_0x485d23[_0x0bfc('0x25')]){delete _0x485d23[_0x0bfc('0x25')];}_0x53afdb[_0x0bfc('0x1e')](_0x430f6c)[_0x0bfc('0x26')](_0x485d23);};}exports['index']=function(_0x531426,_0x17e752){var _0xd76bb7={},_0x547afc={},_0x5cf944={'count':0x0,'rows':[]};var _0x1ce901=_[_0x0bfc('0x27')](db[_0x0bfc('0x28')]['rawAttributes'],function(_0x451088){return{'name':_0x451088[_0x0bfc('0x29')],'type':_0x451088['type'][_0x0bfc('0x2a')]};});_0x547afc[_0x0bfc('0x2b')]=_[_0x0bfc('0x27')](_0x1ce901,_0x0bfc('0x25'));_0x547afc[_0x0bfc('0x2c')]=_[_0x0bfc('0x2d')](_0x531426['query']);_0x547afc[_0x0bfc('0x2e')]=_[_0x0bfc('0x2f')](_0x547afc[_0x0bfc('0x2b')],_0x547afc[_0x0bfc('0x2c')]);_0xd76bb7['attributes']=_[_0x0bfc('0x2f')](_0x547afc[_0x0bfc('0x2b')],qs[_0x0bfc('0x30')](_0x531426[_0x0bfc('0x2c')]['fields']));_0xd76bb7[_0x0bfc('0x31')]=_0xd76bb7[_0x0bfc('0x31')][_0x0bfc('0x32')]?_0xd76bb7[_0x0bfc('0x31')]:_0x547afc[_0x0bfc('0x2b')];if(!_0x531426[_0x0bfc('0x2c')][_0x0bfc('0x33')](_0x0bfc('0x34'))){_0xd76bb7[_0x0bfc('0x35')]=qs[_0x0bfc('0x35')](_0x531426[_0x0bfc('0x2c')][_0x0bfc('0x35')]);_0xd76bb7[_0x0bfc('0x1d')]=qs[_0x0bfc('0x1d')](_0x531426[_0x0bfc('0x2c')][_0x0bfc('0x1d')]);}_0xd76bb7[_0x0bfc('0x36')]=qs[_0x0bfc('0x37')](_0x531426[_0x0bfc('0x2c')][_0x0bfc('0x37')]);_0xd76bb7[_0x0bfc('0x38')]=qs[_0x0bfc('0x2e')](_[_0x0bfc('0x39')](_0x531426['query'],_0x547afc[_0x0bfc('0x2e')]),_0x1ce901);if(_0x531426[_0x0bfc('0x2c')][_0x0bfc('0x3a')]){_0xd76bb7[_0x0bfc('0x38')]=_[_0x0bfc('0x3b')](_0xd76bb7[_0x0bfc('0x38')],{'$or':_[_0x0bfc('0x27')](_0x1ce901,function(_0x1d951f){if(_0x1d951f['type']!==_0x0bfc('0x3c')){var _0x5f99b1={};_0x5f99b1[_0x1d951f['name']]={'$like':'%'+_0x531426[_0x0bfc('0x2c')][_0x0bfc('0x3a')]+'%'};return _0x5f99b1;}})});}_0xd76bb7=_['merge']({},_0xd76bb7,_0x531426['options']);var _0x1f18ab={'where':_0xd76bb7[_0x0bfc('0x38')]};return db['MailTransferReport']['count'](_0x1f18ab)['then'](function(_0x7df60a){_0x5cf944[_0x0bfc('0x1c')]=_0x7df60a;if(_0x531426[_0x0bfc('0x2c')][_0x0bfc('0x3d')]){_0xd76bb7['include']=[{'all':!![]}];}return db[_0x0bfc('0x28')][_0x0bfc('0x3e')](_0xd76bb7);})[_0x0bfc('0x21')](function(_0xd6f0d4){_0x5cf944[_0x0bfc('0x3f')]=_0xd6f0d4;return _0x5cf944;})[_0x0bfc('0x21')](respondWithFilteredResult(_0x17e752,_0xd76bb7))[_0x0bfc('0x40')](handleError(_0x17e752,null));};exports[_0x0bfc('0x41')]=function(_0x35a0e4,_0x4881b1){var _0xfd9b59={'raw':!![],'where':{'id':_0x35a0e4[_0x0bfc('0x42')]['id']}},_0x3805e1={};_0x3805e1[_0x0bfc('0x2b')]=_[_0x0bfc('0x2d')](db[_0x0bfc('0x28')][_0x0bfc('0x43')]);_0x3805e1[_0x0bfc('0x2c')]=_['keys'](_0x35a0e4['query']);_0x3805e1['filters']=_['intersection'](_0x3805e1[_0x0bfc('0x2b')],_0x3805e1[_0x0bfc('0x2c')]);_0xfd9b59[_0x0bfc('0x31')]=_[_0x0bfc('0x2f')](_0x3805e1[_0x0bfc('0x2b')],qs[_0x0bfc('0x30')](_0x35a0e4[_0x0bfc('0x2c')][_0x0bfc('0x30')]));_0xfd9b59['attributes']=_0xfd9b59[_0x0bfc('0x31')]['length']?_0xfd9b59['attributes']:_0x3805e1[_0x0bfc('0x2b')];if(_0x35a0e4[_0x0bfc('0x2c')]['includeAll']){_0xfd9b59[_0x0bfc('0x44')]=[{'all':!![]}];}_0xfd9b59=_[_0x0bfc('0x3b')]({},_0xfd9b59,_0x35a0e4[_0x0bfc('0x45')]);return db[_0x0bfc('0x28')][_0x0bfc('0x46')](_0xfd9b59)[_0x0bfc('0x21')](handleEntityNotFound(_0x4881b1,null))['then'](respondWithResult(_0x4881b1,null))[_0x0bfc('0x40')](handleError(_0x4881b1,null));};exports['create']=function(_0xe72e36,_0x146cba){return db[_0x0bfc('0x28')][_0x0bfc('0x47')](_0xe72e36['body'],{})['then'](respondWithResult(_0x146cba,0xc9))[_0x0bfc('0x40')](handleError(_0x146cba,null));};exports[_0x0bfc('0x48')]=function(_0x4dbc23,_0x35e5c2){if(_0x4dbc23['body']['id']){delete _0x4dbc23['body']['id'];}return db[_0x0bfc('0x28')][_0x0bfc('0x46')]({'where':{'id':_0x4dbc23[_0x0bfc('0x42')]['id']}})[_0x0bfc('0x21')](handleEntityNotFound(_0x35e5c2,null))[_0x0bfc('0x21')](saveUpdates(_0x4dbc23[_0x0bfc('0x49')],null))[_0x0bfc('0x21')](respondWithResult(_0x35e5c2,null))[_0x0bfc('0x40')](handleError(_0x35e5c2,null));};exports[_0x0bfc('0x22')]=function(_0x2f2821,_0x5be551){return db[_0x0bfc('0x28')][_0x0bfc('0x46')]({'where':{'id':_0x2f2821['params']['id']}})['then'](handleEntityNotFound(_0x5be551,null))[_0x0bfc('0x21')](removeEntity(_0x5be551,null))[_0x0bfc('0x40')](handleError(_0x5be551,null));};exports[_0x0bfc('0x4a')]=function(_0x4d7267,_0x5809ca){return db[_0x0bfc('0x28')][_0x0bfc('0x4a')]()[_0x0bfc('0x21')](respondWithResult(_0x5809ca,null))[_0x0bfc('0x40')](handleError(_0x5809ca,null));}; \ No newline at end of file +var _0x2171=['count','includeAll','include','findAll','rows','catch','params','options','find','create','body','destroy','describe','eml-format','rimraf','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','set','apply','reject','save','update','then','error','stack','name','index','map','MailTransferReport','rawAttributes','fieldName','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filter','where','merge','type','VIRTUAL'];(function(_0x3227c1,_0x4318c5){var _0x31fd48=function(_0x5c5850){while(--_0x5c5850){_0x3227c1['push'](_0x3227c1['shift']());}};_0x31fd48(++_0x4318c5);}(_0x2171,0x1ab));var _0x1217=function(_0x668670,_0x557968){_0x668670=_0x668670-0x0;var _0x24c71e=_0x2171[_0x668670];return _0x24c71e;};'use strict';var emlformat=require(_0x1217('0x0'));var rimraf=require(_0x1217('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x1217('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x1217('0x3'));var util=require(_0x1217('0x4'));var path=require(_0x1217('0x5'));var sox=require(_0x1217('0x6'));var csv=require(_0x1217('0x7'));var ejs=require(_0x1217('0x8'));var fs=require('fs');var fs_extra=require(_0x1217('0x9'));var _=require(_0x1217('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x1217('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x1217('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x1217('0xc'));var authService=require(_0x1217('0xd'));var qs=require(_0x1217('0xe'));var as=require(_0x1217('0xf'));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(_0x1217('0x10'));var db=require(_0x1217('0x11'))['db'];function respondWithStatusCode(_0x1debbe,_0x28e3a4){_0x28e3a4=_0x28e3a4||0xcc;return function(_0x295212){if(_0x295212){return _0x1debbe[_0x1217('0x12')](_0x28e3a4);}return _0x1debbe[_0x1217('0x13')](_0x28e3a4)[_0x1217('0x14')]();};}function respondWithResult(_0x45d041,_0x4beb24){_0x4beb24=_0x4beb24||0xc8;return function(_0x2fb715){if(_0x2fb715){return _0x45d041[_0x1217('0x13')](_0x4beb24)[_0x1217('0x15')](_0x2fb715);}};}function respondWithFilteredResult(_0x25873d,_0x10fd1b){return function(_0x36a65c){if(_0x36a65c){var _0x214c12=typeof _0x10fd1b[_0x1217('0x16')]===_0x1217('0x17')&&typeof _0x10fd1b[_0x1217('0x18')]===_0x1217('0x17');var _0x3113d8=_0x36a65c['count'];var _0xa41f8f=_0x214c12?0x0:_0x10fd1b[_0x1217('0x16')];var _0x1628bf=_0x214c12?_0x36a65c['count']:_0x10fd1b[_0x1217('0x16')]+_0x10fd1b[_0x1217('0x18')];var _0x521d14;if(_0x1628bf>=_0x3113d8){_0x1628bf=_0x3113d8;_0x521d14=0xc8;}else{_0x521d14=0xce;}_0x25873d[_0x1217('0x13')](_0x521d14);return _0x25873d[_0x1217('0x19')]('Content-Range',_0xa41f8f+'-'+_0x1628bf+'/'+_0x3113d8)[_0x1217('0x15')](_0x36a65c);}return null;};}function patchUpdates(_0x4026db){return function(_0x364fc4){try{jsonpatch[_0x1217('0x1a')](_0x364fc4,_0x4026db,!![]);}catch(_0x380649){return BPromise[_0x1217('0x1b')](_0x380649);}return _0x364fc4[_0x1217('0x1c')]();};}function saveUpdates(_0x1b62f3,_0x11e5c8){return function(_0x2efc6f){if(_0x2efc6f){return _0x2efc6f[_0x1217('0x1d')](_0x1b62f3)['then'](function(_0x29d40b){return _0x29d40b;});}return null;};}function removeEntity(_0x1212e0,_0x3d1840){return function(_0x55518e){if(_0x55518e){return _0x55518e['destroy']()[_0x1217('0x1e')](function(){_0x1212e0[_0x1217('0x13')](0xcc)[_0x1217('0x14')]();});}};}function handleEntityNotFound(_0x43e3a2,_0x3f0208){return function(_0x5a8ad7){if(!_0x5a8ad7){_0x43e3a2['sendStatus'](0x194);}return _0x5a8ad7;};}function handleError(_0x5a327a,_0x58e1aa){_0x58e1aa=_0x58e1aa||0x1f4;return function(_0x9d561a){logger[_0x1217('0x1f')](_0x9d561a[_0x1217('0x20')]);if(_0x9d561a[_0x1217('0x21')]){delete _0x9d561a[_0x1217('0x21')];}_0x5a327a[_0x1217('0x13')](_0x58e1aa)['send'](_0x9d561a);};}exports[_0x1217('0x22')]=function(_0x25be29,_0x4f9cfd){var _0x5de416={},_0x31862c={},_0x2c6527={'count':0x0,'rows':[]};var _0x56668e=_[_0x1217('0x23')](db[_0x1217('0x24')][_0x1217('0x25')],function(_0xa7cf24){return{'name':_0xa7cf24[_0x1217('0x26')],'type':_0xa7cf24['type']['key']};});_0x31862c[_0x1217('0x27')]=_[_0x1217('0x23')](_0x56668e,_0x1217('0x21'));_0x31862c[_0x1217('0x28')]=_[_0x1217('0x29')](_0x25be29[_0x1217('0x28')]);_0x31862c[_0x1217('0x2a')]=_[_0x1217('0x2b')](_0x31862c[_0x1217('0x27')],_0x31862c['query']);_0x5de416[_0x1217('0x2c')]=_[_0x1217('0x2b')](_0x31862c[_0x1217('0x27')],qs[_0x1217('0x2d')](_0x25be29[_0x1217('0x28')]['fields']));_0x5de416[_0x1217('0x2c')]=_0x5de416[_0x1217('0x2c')][_0x1217('0x2e')]?_0x5de416[_0x1217('0x2c')]:_0x31862c[_0x1217('0x27')];if(!_0x25be29[_0x1217('0x28')][_0x1217('0x2f')](_0x1217('0x30'))){_0x5de416[_0x1217('0x18')]=qs['limit'](_0x25be29[_0x1217('0x28')][_0x1217('0x18')]);_0x5de416[_0x1217('0x16')]=qs[_0x1217('0x16')](_0x25be29[_0x1217('0x28')]['offset']);}_0x5de416[_0x1217('0x31')]=qs[_0x1217('0x32')](_0x25be29['query'][_0x1217('0x32')]);_0x5de416['where']=qs[_0x1217('0x2a')](_['pick'](_0x25be29['query'],_0x31862c[_0x1217('0x2a')]),_0x56668e);if(_0x25be29[_0x1217('0x28')][_0x1217('0x33')]){_0x5de416[_0x1217('0x34')]=_[_0x1217('0x35')](_0x5de416[_0x1217('0x34')],{'$or':_[_0x1217('0x23')](_0x56668e,function(_0x1330e9){if(_0x1330e9[_0x1217('0x36')]!==_0x1217('0x37')){var _0x2c383a={};_0x2c383a[_0x1330e9[_0x1217('0x21')]]={'$like':'%'+_0x25be29[_0x1217('0x28')][_0x1217('0x33')]+'%'};return _0x2c383a;}})});}_0x5de416=_[_0x1217('0x35')]({},_0x5de416,_0x25be29['options']);var _0x51935b={'where':_0x5de416[_0x1217('0x34')]};return db[_0x1217('0x24')][_0x1217('0x38')](_0x51935b)[_0x1217('0x1e')](function(_0x314065){_0x2c6527[_0x1217('0x38')]=_0x314065;if(_0x25be29[_0x1217('0x28')][_0x1217('0x39')]){_0x5de416[_0x1217('0x3a')]=[{'all':!![]}];}return db['MailTransferReport'][_0x1217('0x3b')](_0x5de416);})['then'](function(_0x261b22){_0x2c6527[_0x1217('0x3c')]=_0x261b22;return _0x2c6527;})[_0x1217('0x1e')](respondWithFilteredResult(_0x4f9cfd,_0x5de416))[_0x1217('0x3d')](handleError(_0x4f9cfd,null));};exports['show']=function(_0x5ebbfc,_0x3ecc12){var _0xa5f900={'raw':!![],'where':{'id':_0x5ebbfc[_0x1217('0x3e')]['id']}},_0x45d1c2={};_0x45d1c2[_0x1217('0x27')]=_[_0x1217('0x29')](db['MailTransferReport'][_0x1217('0x25')]);_0x45d1c2[_0x1217('0x28')]=_[_0x1217('0x29')](_0x5ebbfc[_0x1217('0x28')]);_0x45d1c2[_0x1217('0x2a')]=_[_0x1217('0x2b')](_0x45d1c2[_0x1217('0x27')],_0x45d1c2['query']);_0xa5f900[_0x1217('0x2c')]=_[_0x1217('0x2b')](_0x45d1c2[_0x1217('0x27')],qs[_0x1217('0x2d')](_0x5ebbfc[_0x1217('0x28')]['fields']));_0xa5f900[_0x1217('0x2c')]=_0xa5f900[_0x1217('0x2c')][_0x1217('0x2e')]?_0xa5f900[_0x1217('0x2c')]:_0x45d1c2[_0x1217('0x27')];if(_0x5ebbfc[_0x1217('0x28')][_0x1217('0x39')]){_0xa5f900[_0x1217('0x3a')]=[{'all':!![]}];}_0xa5f900=_[_0x1217('0x35')]({},_0xa5f900,_0x5ebbfc[_0x1217('0x3f')]);return db[_0x1217('0x24')][_0x1217('0x40')](_0xa5f900)[_0x1217('0x1e')](handleEntityNotFound(_0x3ecc12,null))['then'](respondWithResult(_0x3ecc12,null))[_0x1217('0x3d')](handleError(_0x3ecc12,null));};exports[_0x1217('0x41')]=function(_0x5b2966,_0x53f4ae){return db['MailTransferReport'][_0x1217('0x41')](_0x5b2966[_0x1217('0x42')],{})[_0x1217('0x1e')](respondWithResult(_0x53f4ae,0xc9))[_0x1217('0x3d')](handleError(_0x53f4ae,null));};exports[_0x1217('0x1d')]=function(_0x1d8348,_0x2adf24){if(_0x1d8348[_0x1217('0x42')]['id']){delete _0x1d8348[_0x1217('0x42')]['id'];}return db['MailTransferReport'][_0x1217('0x40')]({'where':{'id':_0x1d8348['params']['id']}})['then'](handleEntityNotFound(_0x2adf24,null))['then'](saveUpdates(_0x1d8348[_0x1217('0x42')],null))[_0x1217('0x1e')](respondWithResult(_0x2adf24,null))['catch'](handleError(_0x2adf24,null));};exports[_0x1217('0x43')]=function(_0x12b000,_0x1cc4ff){return db['MailTransferReport'][_0x1217('0x40')]({'where':{'id':_0x12b000['params']['id']}})[_0x1217('0x1e')](handleEntityNotFound(_0x1cc4ff,null))[_0x1217('0x1e')](removeEntity(_0x1cc4ff,null))[_0x1217('0x3d')](handleError(_0x1cc4ff,null));};exports['describe']=function(_0x1b4abc,_0x82a318){return db[_0x1217('0x24')][_0x1217('0x44')]()[_0x1217('0x1e')](respondWithResult(_0x82a318,null))[_0x1217('0x3d')](handleError(_0x82a318,null));}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.model.js b/server/api/mailTransferReport/mailTransferReport.model.js index d0ff6ab..3099f9e 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 _0xeddd=['uniqueid','lodash','util','../../config/logger','api','bluebird','path','rimraf','./mailTransferReport.attributes','exports','define','MailTransferReport','report_mail_transfer'];(function(_0x528fb7,_0x13f6a5){var _0x57e420=function(_0x3d1036){while(--_0x3d1036){_0x528fb7['push'](_0x528fb7['shift']());}};_0x57e420(++_0x13f6a5);}(_0xeddd,0x69));var _0xdedd=function(_0x26462c,_0xd20a35){_0x26462c=_0x26462c-0x0;var _0x509a42=_0xeddd[_0x26462c];return _0x509a42;};'use strict';var _=require(_0xdedd('0x0'));var util=require(_0xdedd('0x1'));var logger=require(_0xdedd('0x2'))(_0xdedd('0x3'));var moment=require('moment');var BPromise=require(_0xdedd('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xdedd('0x5'));var rimraf=require(_0xdedd('0x6'));var config=require('../../config/environment');var attributes=require(_0xdedd('0x7'));module[_0xdedd('0x8')]=function(_0x16801a,_0x3e6b5a){return _0x16801a[_0xdedd('0x9')](_0xdedd('0xa'),attributes,{'tableName':_0xdedd('0xb'),'paranoid':![],'indexes':[{'name':_0xdedd('0xc'),'fields':[_0xdedd('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x27bf=['request-promise','path','rimraf','../../config/environment','./mailTransferReport.attributes','define','MailTransferReport','report_mail_transfer','uniqueid','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x3c6b0e,_0x4b9994){var _0x40b5ec=function(_0x5a1154){while(--_0x5a1154){_0x3c6b0e['push'](_0x3c6b0e['shift']());}};_0x40b5ec(++_0x4b9994);}(_0x27bf,0x117));var _0xf27b=function(_0xa22583,_0x3534cc){_0xa22583=_0xa22583-0x0;var _0x298926=_0x27bf[_0xa22583];return _0x298926;};'use strict';var _=require(_0xf27b('0x0'));var util=require(_0xf27b('0x1'));var logger=require(_0xf27b('0x2'))(_0xf27b('0x3'));var moment=require(_0xf27b('0x4'));var BPromise=require(_0xf27b('0x5'));var rp=require(_0xf27b('0x6'));var fs=require('fs');var path=require(_0xf27b('0x7'));var rimraf=require(_0xf27b('0x8'));var config=require(_0xf27b('0x9'));var attributes=require(_0xf27b('0xa'));module['exports']=function(_0x1a18b4,_0x39bf1b){return _0x1a18b4[_0xf27b('0xb')](_0xf27b('0xc'),attributes,{'tableName':_0xf27b('0xd'),'paranoid':![],'indexes':[{'name':_0xf27b('0xe'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.rpc.js b/server/api/mailTransferReport/mailTransferReport.rpc.js index f0b155d..1ec0a00 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 _0x17fa=['lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','MailTransferReport,\x20%s,\x20%s','MailTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch'];(function(_0x4c6243,_0x3bf04e){var _0x398330=function(_0xf9dc79){while(--_0xf9dc79){_0x4c6243['push'](_0x4c6243['shift']());}};_0x398330(++_0x3bf04e);}(_0x17fa,0x93));var _0xa17f=function(_0xcd2e6f,_0x27eabf){_0xcd2e6f=_0xcd2e6f-0x0;var _0x5c77e8=_0x17fa[_0xcd2e6f];return _0x5c77e8;};'use strict';var _=require(_0xa17f('0x0'));var util=require(_0xa17f('0x1'));var moment=require(_0xa17f('0x2'));var BPromise=require('bluebird');var rs=require(_0xa17f('0x3'));var fs=require('fs');var Redis=require(_0xa17f('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xa17f('0x5'));var logger=require(_0xa17f('0x6'))(_0xa17f('0x7'));var config=require(_0xa17f('0x8'));var jayson=require(_0xa17f('0x9'));var client=jayson[_0xa17f('0xa')][_0xa17f('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x57ecc7,_0x1eb75d,_0x1ab83c){return new BPromise(function(_0x1cafe6,_0x5f2548){return client[_0xa17f('0xc')](_0x57ecc7,_0x1ab83c)['then'](function(_0x4f27fc){logger['info'](_0xa17f('0xd'),_0x1eb75d,'request\x20sent');logger['debug'](_0xa17f('0xe'),_0x1eb75d,'request\x20sent',JSON[_0xa17f('0xf')](_0x4f27fc));if(_0x4f27fc[_0xa17f('0x10')]){if(_0x4f27fc[_0xa17f('0x10')][_0xa17f('0x11')]===0x1f4){logger[_0xa17f('0x10')](_0xa17f('0xd'),_0x1eb75d,_0x4f27fc[_0xa17f('0x10')]['message']);return _0x5f2548(_0x4f27fc[_0xa17f('0x10')][_0xa17f('0x12')]);}logger[_0xa17f('0x10')]('MailTransferReport,\x20%s,\x20%s',_0x1eb75d,_0x4f27fc['error'][_0xa17f('0x12')]);return _0x1cafe6(_0x4f27fc[_0xa17f('0x10')][_0xa17f('0x12')]);}else{logger[_0xa17f('0x13')](_0xa17f('0xd'),_0x1eb75d,'request\x20sent');_0x1cafe6(_0x4f27fc['result'][_0xa17f('0x12')]);}})[_0xa17f('0x14')](function(_0x329e3a){logger[_0xa17f('0x10')]('MailTransferReport,\x20%s,\x20%s',_0x1eb75d,_0x329e3a);_0x5f2548(_0x329e3a);});});} \ No newline at end of file +var _0xd90d=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','MailTransferReport,\x20%s,\x20%s','debug','MailTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','catch','lodash','util','moment','ioredis'];(function(_0x827d61,_0x127d23){var _0x3d2398=function(_0x57aaf6){while(--_0x57aaf6){_0x827d61['push'](_0x827d61['shift']());}};_0x3d2398(++_0x127d23);}(_0xd90d,0x96));var _0xdd90=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0xd90d[_0x167cc1];return _0x10bc4b;};'use strict';var _=require(_0xdd90('0x0'));var util=require(_0xdd90('0x1'));var moment=require(_0xdd90('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xdd90('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xdd90('0x4'));var logger=require(_0xdd90('0x5'))(_0xdd90('0x6'));var config=require(_0xdd90('0x7'));var jayson=require(_0xdd90('0x8'));var client=jayson[_0xdd90('0x9')][_0xdd90('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1b99a1,_0x10ac64,_0x5b3e86){return new BPromise(function(_0x1df7d,_0x260e2f){return client[_0xdd90('0xb')](_0x1b99a1,_0x5b3e86)['then'](function(_0x4b18f8){logger[_0xdd90('0xc')](_0xdd90('0xd'),_0x10ac64,'request\x20sent');logger[_0xdd90('0xe')](_0xdd90('0xf'),_0x10ac64,'request\x20sent',JSON[_0xdd90('0x10')](_0x4b18f8));if(_0x4b18f8[_0xdd90('0x11')]){if(_0x4b18f8['error'][_0xdd90('0x12')]===0x1f4){logger['error'](_0xdd90('0xd'),_0x10ac64,_0x4b18f8[_0xdd90('0x11')][_0xdd90('0x13')]);return _0x260e2f(_0x4b18f8['error'][_0xdd90('0x13')]);}logger[_0xdd90('0x11')](_0xdd90('0xd'),_0x10ac64,_0x4b18f8[_0xdd90('0x11')][_0xdd90('0x13')]);return _0x1df7d(_0x4b18f8[_0xdd90('0x11')]['message']);}else{logger[_0xdd90('0xc')](_0xdd90('0xd'),_0x10ac64,_0xdd90('0x14'));_0x1df7d(_0x4b18f8['result'][_0xdd90('0x13')]);}})[_0xdd90('0x15')](function(_0x2be405){logger[_0xdd90('0x11')](_0xdd90('0xd'),_0x10ac64,_0x2be405);_0x260e2f(_0x2be405);});});} \ No newline at end of file diff --git a/server/api/memberReport/index.js b/server/api/memberReport/index.js index a784a2d..f02b85b 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 _0x4523=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./memberReport.controller','get','isAuthenticated','/describe','describe','/:id','show','post','create','put','delete','destroy','multer','util','path','connect-timeout'];(function(_0x5c2e3e,_0x26ecd3){var _0x53f64a=function(_0x2b5df8){while(--_0x2b5df8){_0x5c2e3e['push'](_0x5c2e3e['shift']());}};_0x53f64a(++_0x26ecd3);}(_0x4523,0x122));var _0x3452=function(_0x2148d4,_0x52f68f){_0x2148d4=_0x2148d4-0x0;var _0x2fe7a4=_0x4523[_0x2148d4];return _0x2fe7a4;};'use strict';var multer=require(_0x3452('0x0'));var util=require(_0x3452('0x1'));var path=require(_0x3452('0x2'));var timeout=require(_0x3452('0x3'));var express=require(_0x3452('0x4'));var router=express[_0x3452('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x3452('0x6'));var interaction=require(_0x3452('0x7'));var config=require(_0x3452('0x8'));var controller=require(_0x3452('0x9'));router[_0x3452('0xa')]('/',auth[_0x3452('0xb')](),controller['index']);router[_0x3452('0xa')](_0x3452('0xc'),auth[_0x3452('0xb')](),controller[_0x3452('0xd')]);router['get'](_0x3452('0xe'),auth[_0x3452('0xb')](),controller[_0x3452('0xf')]);router[_0x3452('0x10')]('/',auth[_0x3452('0xb')](),controller[_0x3452('0x11')]);router[_0x3452('0x12')](_0x3452('0xe'),auth['isAuthenticated'](),controller['update']);router[_0x3452('0x13')](_0x3452('0xe'),auth[_0x3452('0xb')](),controller[_0x3452('0x14')]);module['exports']=router; \ No newline at end of file +var _0xaa69=['exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./memberReport.controller','get','isAuthenticated','index','describe','/:id','show','post','put','update','destroy'];(function(_0x5d18b3,_0xbded66){var _0x55c5e4=function(_0x12a401){while(--_0x12a401){_0x5d18b3['push'](_0x5d18b3['shift']());}};_0x55c5e4(++_0xbded66);}(_0xaa69,0x105));var _0x9aa6=function(_0x23b980,_0x57697f){_0x23b980=_0x23b980-0x0;var _0x475354=_0xaa69[_0x23b980];return _0x475354;};'use strict';var multer=require('multer');var util=require(_0x9aa6('0x0'));var path=require(_0x9aa6('0x1'));var timeout=require(_0x9aa6('0x2'));var express=require(_0x9aa6('0x3'));var router=express[_0x9aa6('0x4')]();var fs_extra=require(_0x9aa6('0x5'));var auth=require(_0x9aa6('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x9aa6('0x7'));var controller=require(_0x9aa6('0x8'));router[_0x9aa6('0x9')]('/',auth[_0x9aa6('0xa')](),controller[_0x9aa6('0xb')]);router[_0x9aa6('0x9')]('/describe',auth[_0x9aa6('0xa')](),controller[_0x9aa6('0xc')]);router[_0x9aa6('0x9')](_0x9aa6('0xd'),auth[_0x9aa6('0xa')](),controller[_0x9aa6('0xe')]);router[_0x9aa6('0xf')]('/',auth[_0x9aa6('0xa')](),controller['create']);router[_0x9aa6('0x10')](_0x9aa6('0xd'),auth[_0x9aa6('0xa')](),controller[_0x9aa6('0x11')]);router['delete'](_0x9aa6('0xd'),auth['isAuthenticated'](),controller[_0x9aa6('0x12')]);module[_0x9aa6('0x13')]=router; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.attributes.js b/server/api/memberReport/memberReport.attributes.js index dce676d..779d189 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 _0x66b8=['talk:[queue]','sequelize','moment','STRING','LOGIN,\x20PAUSE,\x20TALKING','INTEGER','DATE','getDataValue','diff','seconds','duration','talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[destination]','talk:[dial\x20string]'];(function(_0x100120,_0x5d16f5){var _0x436681=function(_0x154c0f){while(--_0x154c0f){_0x100120['push'](_0x100120['shift']());}};_0x436681(++_0x5d16f5);}(_0x66b8,0xe1));var _0x866b=function(_0x1cc8fe,_0x105328){_0x1cc8fe=_0x1cc8fe-0x0;var _0x230054=_0x66b8[_0x1cc8fe];return _0x230054;};'use strict';var Sequelize=require(_0x866b('0x0'));var moment=require(_0x866b('0x1'));module['exports']={'channel':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x866b('0x2')]},'interface':{'type':Sequelize[_0x866b('0x2')]},'type':{'type':Sequelize[_0x866b('0x2')],'defaultValue':'DEFAULT\x20PAUSE','comment':_0x866b('0x3')},'duration':{'type':Sequelize[_0x866b('0x4')]},'enterAt':{'type':Sequelize[_0x866b('0x5')]},'exitAt':{'type':Sequelize[_0x866b('0x5')],'set':function(_0xf21c85){var _0x4129e7=moment(_0xf21c85);var _0x20b40a=moment(this[_0x866b('0x6')]('enterAt'));var _0x659cb4=_0x4129e7[_0x866b('0x7')](_0x20b40a,_0x866b('0x8'));this['setDataValue']('exitAt',_0xf21c85);this['setDataValue'](_0x866b('0x9'),_0x659cb4>=0x0?_0x659cb4:null);}},'data1':{'type':Sequelize['STRING'],'comment':_0x866b('0xa')},'data2':{'type':Sequelize[_0x866b('0x2')],'comment':'talk:[start]'},'data3':{'type':Sequelize[_0x866b('0x2')],'comment':_0x866b('0xb')},'data4':{'type':Sequelize[_0x866b('0x2')],'comment':_0x866b('0xc')},'data5':{'type':Sequelize['STRING'],'comment':_0x866b('0xd')},'role':{'type':Sequelize[_0x866b('0x2')]},'internal':{'type':Sequelize[_0x866b('0x4')]},'uniqueid':{'type':Sequelize[_0x866b('0x2')]}}; \ No newline at end of file +var _0x9f14=['talk:[start]','talk:[destination]','talk:[dial\x20string]','talk:[queue]','INTEGER','sequelize','moment','STRING','DEFAULT\x20PAUSE','DATE','getDataValue','diff','setDataValue'];(function(_0x10c37b,_0x180dc4){var _0x10cdf7=function(_0x3e7605){while(--_0x3e7605){_0x10c37b['push'](_0x10c37b['shift']());}};_0x10cdf7(++_0x180dc4);}(_0x9f14,0x109));var _0x49f1=function(_0x3e5086,_0x48f4a2){_0x3e5086=_0x3e5086-0x0;var _0xfeb102=_0x9f14[_0x3e5086];return _0xfeb102;};'use strict';var Sequelize=require(_0x49f1('0x0'));var moment=require(_0x49f1('0x1'));module['exports']={'channel':{'type':Sequelize[_0x49f1('0x2')]},'membername':{'type':Sequelize[_0x49f1('0x2')]},'interface':{'type':Sequelize[_0x49f1('0x2')]},'type':{'type':Sequelize[_0x49f1('0x2')],'defaultValue':_0x49f1('0x3'),'comment':'LOGIN,\x20PAUSE,\x20TALKING'},'duration':{'type':Sequelize['INTEGER']},'enterAt':{'type':Sequelize[_0x49f1('0x4')]},'exitAt':{'type':Sequelize['DATE'],'set':function(_0x24a3d1){var _0x1ca10a=moment(_0x24a3d1);var _0x408bd6=moment(this[_0x49f1('0x5')]('enterAt'));var _0x84ebe2=_0x1ca10a[_0x49f1('0x6')](_0x408bd6,'seconds');this[_0x49f1('0x7')]('exitAt',_0x24a3d1);this[_0x49f1('0x7')]('duration',_0x84ebe2>=0x0?_0x84ebe2:null);}},'data1':{'type':Sequelize[_0x49f1('0x2')],'comment':'talk:[inbound,\x20outbound],\x20pause:[reason]'},'data2':{'type':Sequelize[_0x49f1('0x2')],'comment':_0x49f1('0x8')},'data3':{'type':Sequelize[_0x49f1('0x2')],'comment':_0x49f1('0x9')},'data4':{'type':Sequelize['STRING'],'comment':_0x49f1('0xa')},'data5':{'type':Sequelize['STRING'],'comment':_0x49f1('0xb')},'role':{'type':Sequelize['STRING']},'internal':{'type':Sequelize[_0x49f1('0xc')]},'uniqueid':{'type':Sequelize[_0x49f1('0x2')]}}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.controller.js b/server/api/memberReport/memberReport.controller.js index 0037c54..4eaac2c 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 _0x3e74=['show','params','options','find','catch','create','body','describe','eml-format','zip-dir','fast-json-patch','request-promise','mustache','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','end','json','undefined','limit','offset','count','status','set','Content-Range','apply','save','update','then','destroy','sendStatus','name','send','index','map','MemberReport','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows'];(function(_0x1b4a14,_0x5e589b){var _0x29ca8e=function(_0x3bea76){while(--_0x3bea76){_0x1b4a14['push'](_0x1b4a14['shift']());}};_0x29ca8e(++_0x5e589b);}(_0x3e74,0x175));var _0x43e7=function(_0x5f505d,_0x1109e2){_0x5f505d=_0x5f505d-0x0;var _0x4ee8a3=_0x3e74[_0x5f505d];return _0x4ee8a3;};'use strict';var emlformat=require(_0x43e7('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x43e7('0x1'));var jsonpatch=require(_0x43e7('0x2'));var rp=require(_0x43e7('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x43e7('0x4'));var util=require('util');var path=require(_0x43e7('0x5'));var sox=require(_0x43e7('0x6'));var csv=require(_0x43e7('0x7'));var ejs=require(_0x43e7('0x8'));var fs=require('fs');var fs_extra=require(_0x43e7('0x9'));var _=require('lodash');var squel=require(_0x43e7('0xa'));var crypto=require(_0x43e7('0xb'));var jsforce=require(_0x43e7('0xc'));var deskjs=require(_0x43e7('0xd'));var toCsv=require(_0x43e7('0x7'));var querystring=require('querystring');var Papa=require(_0x43e7('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x43e7('0xf'));var as=require(_0x43e7('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x43e7('0x11'))('api');var utils=require(_0x43e7('0x12'));var config=require(_0x43e7('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x43e7('0x14'))['db'];function respondWithStatusCode(_0xc960ea,_0x2718d3){_0x2718d3=_0x2718d3||0xcc;return function(_0x3bb83f){if(_0x3bb83f){return _0xc960ea['sendStatus'](_0x2718d3);}return _0xc960ea['status'](_0x2718d3)[_0x43e7('0x15')]();};}function respondWithResult(_0x21fdd3,_0x44b0bd){_0x44b0bd=_0x44b0bd||0xc8;return function(_0x51b974){if(_0x51b974){return _0x21fdd3['status'](_0x44b0bd)[_0x43e7('0x16')](_0x51b974);}};}function respondWithFilteredResult(_0x14c146,_0x203378){return function(_0x328445){if(_0x328445){var _0x4de324=typeof _0x203378['offset']===_0x43e7('0x17')&&typeof _0x203378[_0x43e7('0x18')]===_0x43e7('0x17');var _0x5d346f=_0x328445['count'];var _0x446986=_0x4de324?0x0:_0x203378[_0x43e7('0x19')];var _0x9037d3=_0x4de324?_0x328445[_0x43e7('0x1a')]:_0x203378[_0x43e7('0x19')]+_0x203378[_0x43e7('0x18')];var _0x619236;if(_0x9037d3>=_0x5d346f){_0x9037d3=_0x5d346f;_0x619236=0xc8;}else{_0x619236=0xce;}_0x14c146[_0x43e7('0x1b')](_0x619236);return _0x14c146[_0x43e7('0x1c')](_0x43e7('0x1d'),_0x446986+'-'+_0x9037d3+'/'+_0x5d346f)[_0x43e7('0x16')](_0x328445);}return null;};}function patchUpdates(_0x177ee1){return function(_0x4b5d64){try{jsonpatch[_0x43e7('0x1e')](_0x4b5d64,_0x177ee1,!![]);}catch(_0x3c6625){return BPromise['reject'](_0x3c6625);}return _0x4b5d64[_0x43e7('0x1f')]();};}function saveUpdates(_0x3e281e,_0x3945bb){return function(_0x28aacc){if(_0x28aacc){return _0x28aacc[_0x43e7('0x20')](_0x3e281e)[_0x43e7('0x21')](function(_0x54a9e7){return _0x54a9e7;});}return null;};}function removeEntity(_0x454359,_0x4eea52){return function(_0x4c9df3){if(_0x4c9df3){return _0x4c9df3[_0x43e7('0x22')]()[_0x43e7('0x21')](function(){_0x454359['status'](0xcc)[_0x43e7('0x15')]();});}};}function handleEntityNotFound(_0x4ca5cf,_0x326dab){return function(_0x5c5e67){if(!_0x5c5e67){_0x4ca5cf[_0x43e7('0x23')](0x194);}return _0x5c5e67;};}function handleError(_0x1b5f50,_0x20888b){_0x20888b=_0x20888b||0x1f4;return function(_0x405f85){logger['error'](_0x405f85['stack']);if(_0x405f85[_0x43e7('0x24')]){delete _0x405f85['name'];}_0x1b5f50[_0x43e7('0x1b')](_0x20888b)[_0x43e7('0x25')](_0x405f85);};}exports[_0x43e7('0x26')]=function(_0xb1fc63,_0x5087d7){var _0x33a1a5={},_0x4690a6={},_0x45b675={'count':0x0,'rows':[]};var _0x50f9f5=_[_0x43e7('0x27')](db[_0x43e7('0x28')][_0x43e7('0x29')],function(_0x31b2a6){return{'name':_0x31b2a6[_0x43e7('0x2a')],'type':_0x31b2a6[_0x43e7('0x2b')][_0x43e7('0x2c')]};});_0x4690a6[_0x43e7('0x2d')]=_[_0x43e7('0x27')](_0x50f9f5,_0x43e7('0x24'));_0x4690a6['query']=_[_0x43e7('0x2e')](_0xb1fc63[_0x43e7('0x2f')]);_0x4690a6[_0x43e7('0x30')]=_[_0x43e7('0x31')](_0x4690a6[_0x43e7('0x2d')],_0x4690a6['query']);_0x33a1a5[_0x43e7('0x32')]=_[_0x43e7('0x31')](_0x4690a6[_0x43e7('0x2d')],qs[_0x43e7('0x33')](_0xb1fc63['query']['fields']));_0x33a1a5['attributes']=_0x33a1a5[_0x43e7('0x32')][_0x43e7('0x34')]?_0x33a1a5[_0x43e7('0x32')]:_0x4690a6[_0x43e7('0x2d')];if(!_0xb1fc63[_0x43e7('0x2f')][_0x43e7('0x35')]('nolimit')){_0x33a1a5['limit']=qs['limit'](_0xb1fc63['query']['limit']);_0x33a1a5['offset']=qs['offset'](_0xb1fc63[_0x43e7('0x2f')]['offset']);}_0x33a1a5[_0x43e7('0x36')]=qs[_0x43e7('0x37')](_0xb1fc63[_0x43e7('0x2f')][_0x43e7('0x37')]);_0x33a1a5[_0x43e7('0x38')]=qs[_0x43e7('0x30')](_[_0x43e7('0x39')](_0xb1fc63['query'],_0x4690a6['filters']),_0x50f9f5);if(_0xb1fc63['query'][_0x43e7('0x3a')]){_0x33a1a5[_0x43e7('0x38')]=_[_0x43e7('0x3b')](_0x33a1a5[_0x43e7('0x38')],{'$or':_[_0x43e7('0x27')](_0x50f9f5,function(_0x1ed538){if(_0x1ed538[_0x43e7('0x2b')]!==_0x43e7('0x3c')){var _0x55c798={};_0x55c798[_0x1ed538[_0x43e7('0x24')]]={'$like':'%'+_0xb1fc63[_0x43e7('0x2f')]['filter']+'%'};return _0x55c798;}})});}_0x33a1a5=_[_0x43e7('0x3b')]({},_0x33a1a5,_0xb1fc63['options']);var _0x44d8e4={'where':_0x33a1a5[_0x43e7('0x38')]};return db[_0x43e7('0x28')][_0x43e7('0x1a')](_0x44d8e4)[_0x43e7('0x21')](function(_0x234d8f){_0x45b675['count']=_0x234d8f;if(_0xb1fc63['query'][_0x43e7('0x3d')]){_0x33a1a5[_0x43e7('0x3e')]=[{'all':!![]}];}return db[_0x43e7('0x28')][_0x43e7('0x3f')](_0x33a1a5);})[_0x43e7('0x21')](function(_0x4a4a85){_0x45b675[_0x43e7('0x40')]=_0x4a4a85;return _0x45b675;})[_0x43e7('0x21')](respondWithFilteredResult(_0x5087d7,_0x33a1a5))['catch'](handleError(_0x5087d7,null));};exports[_0x43e7('0x41')]=function(_0x51a69c,_0x2ad8ef){var _0x504101={'raw':!![],'where':{'id':_0x51a69c[_0x43e7('0x42')]['id']}},_0x3d81ae={};_0x3d81ae[_0x43e7('0x2d')]=_[_0x43e7('0x2e')](db['MemberReport']['rawAttributes']);_0x3d81ae[_0x43e7('0x2f')]=_[_0x43e7('0x2e')](_0x51a69c[_0x43e7('0x2f')]);_0x3d81ae[_0x43e7('0x30')]=_['intersection'](_0x3d81ae['model'],_0x3d81ae['query']);_0x504101[_0x43e7('0x32')]=_['intersection'](_0x3d81ae[_0x43e7('0x2d')],qs['fields'](_0x51a69c['query'][_0x43e7('0x33')]));_0x504101['attributes']=_0x504101[_0x43e7('0x32')][_0x43e7('0x34')]?_0x504101[_0x43e7('0x32')]:_0x3d81ae[_0x43e7('0x2d')];if(_0x51a69c['query'][_0x43e7('0x3d')]){_0x504101[_0x43e7('0x3e')]=[{'all':!![]}];}_0x504101=_[_0x43e7('0x3b')]({},_0x504101,_0x51a69c[_0x43e7('0x43')]);return db[_0x43e7('0x28')][_0x43e7('0x44')](_0x504101)['then'](handleEntityNotFound(_0x2ad8ef,null))['then'](respondWithResult(_0x2ad8ef,null))[_0x43e7('0x45')](handleError(_0x2ad8ef,null));};exports[_0x43e7('0x46')]=function(_0x212841,_0x4c00a8){return db['MemberReport']['create'](_0x212841[_0x43e7('0x47')],{})[_0x43e7('0x21')](respondWithResult(_0x4c00a8,0xc9))['catch'](handleError(_0x4c00a8,null));};exports[_0x43e7('0x20')]=function(_0x47686e,_0x3c96fe){if(_0x47686e['body']['id']){delete _0x47686e['body']['id'];}return db['MemberReport']['find']({'where':{'id':_0x47686e[_0x43e7('0x42')]['id']}})[_0x43e7('0x21')](handleEntityNotFound(_0x3c96fe,null))['then'](saveUpdates(_0x47686e[_0x43e7('0x47')],null))[_0x43e7('0x21')](respondWithResult(_0x3c96fe,null))[_0x43e7('0x45')](handleError(_0x3c96fe,null));};exports[_0x43e7('0x22')]=function(_0x4a0ce5,_0x2718d5){return db['MemberReport']['find']({'where':{'id':_0x4a0ce5[_0x43e7('0x42')]['id']}})[_0x43e7('0x21')](handleEntityNotFound(_0x2718d5,null))[_0x43e7('0x21')](removeEntity(_0x2718d5,null))[_0x43e7('0x45')](handleError(_0x2718d5,null));};exports[_0x43e7('0x48')]=function(_0x2351cf,_0x1cd87c){return db[_0x43e7('0x28')][_0x43e7('0x48')]()[_0x43e7('0x21')](respondWithResult(_0x1cd87c,null))['catch'](handleError(_0x1cd87c,null));}; \ No newline at end of file +var _0x55ca=['merge','filter','includeAll','include','findAll','rawAttributes','options','create','body','find','params','catch','destroy','describe','eml-format','rimraf','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','reject','update','then','end','sendStatus','error','stack','name','send','index','map','MemberReport','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where'];(function(_0x4e676e,_0x2a7c6d){var _0x336a3c=function(_0x4767c4){while(--_0x4767c4){_0x4e676e['push'](_0x4e676e['shift']());}};_0x336a3c(++_0x2a7c6d);}(_0x55ca,0x126));var _0xa55c=function(_0xabbd2f,_0x44d05a){_0xabbd2f=_0xabbd2f-0x0;var _0x34a040=_0x55ca[_0xabbd2f];return _0x34a040;};'use strict';var emlformat=require(_0xa55c('0x0'));var rimraf=require(_0xa55c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xa55c('0x2'));var BPromise=require(_0xa55c('0x3'));var Mustache=require('mustache');var util=require(_0xa55c('0x4'));var path=require(_0xa55c('0x5'));var sox=require(_0xa55c('0x6'));var csv=require(_0xa55c('0x7'));var ejs=require(_0xa55c('0x8'));var fs=require('fs');var fs_extra=require(_0xa55c('0x9'));var _=require(_0xa55c('0xa'));var squel=require('squel');var crypto=require(_0xa55c('0xb'));var jsforce=require(_0xa55c('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xa55c('0x7'));var querystring=require(_0xa55c('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xa55c('0xe'));var qs=require(_0xa55c('0xf'));var as=require(_0xa55c('0x10'));var hardwareService=require(_0xa55c('0x11'));var logger=require(_0xa55c('0x12'))(_0xa55c('0x13'));var utils=require(_0xa55c('0x14'));var config=require(_0xa55c('0x15'));var licenseUtil=require(_0xa55c('0x16'));var db=require(_0xa55c('0x17'))['db'];function respondWithStatusCode(_0x5d47ff,_0x59d84a){_0x59d84a=_0x59d84a||0xcc;return function(_0x2a35be){if(_0x2a35be){return _0x5d47ff['sendStatus'](_0x59d84a);}return _0x5d47ff['status'](_0x59d84a)['end']();};}function respondWithResult(_0x18ee85,_0x3930e4){_0x3930e4=_0x3930e4||0xc8;return function(_0x462cd6){if(_0x462cd6){return _0x18ee85[_0xa55c('0x18')](_0x3930e4)[_0xa55c('0x19')](_0x462cd6);}};}function respondWithFilteredResult(_0x247e77,_0x4e0b2f){return function(_0x3ccf65){if(_0x3ccf65){var _0x3dcf4f=typeof _0x4e0b2f[_0xa55c('0x1a')]===_0xa55c('0x1b')&&typeof _0x4e0b2f[_0xa55c('0x1c')]===_0xa55c('0x1b');var _0x51590e=_0x3ccf65[_0xa55c('0x1d')];var _0x24783b=_0x3dcf4f?0x0:_0x4e0b2f['offset'];var _0x3d4c9e=_0x3dcf4f?_0x3ccf65[_0xa55c('0x1d')]:_0x4e0b2f[_0xa55c('0x1a')]+_0x4e0b2f[_0xa55c('0x1c')];var _0x23a1ae;if(_0x3d4c9e>=_0x51590e){_0x3d4c9e=_0x51590e;_0x23a1ae=0xc8;}else{_0x23a1ae=0xce;}_0x247e77[_0xa55c('0x18')](_0x23a1ae);return _0x247e77['set']('Content-Range',_0x24783b+'-'+_0x3d4c9e+'/'+_0x51590e)[_0xa55c('0x19')](_0x3ccf65);}return null;};}function patchUpdates(_0x3776ac){return function(_0xade4c4){try{jsonpatch['apply'](_0xade4c4,_0x3776ac,!![]);}catch(_0x383d92){return BPromise[_0xa55c('0x1e')](_0x383d92);}return _0xade4c4['save']();};}function saveUpdates(_0x187a87,_0x133096){return function(_0x940f28){if(_0x940f28){return _0x940f28[_0xa55c('0x1f')](_0x187a87)[_0xa55c('0x20')](function(_0x49ed04){return _0x49ed04;});}return null;};}function removeEntity(_0x1fc828,_0x504c24){return function(_0x5ba836){if(_0x5ba836){return _0x5ba836['destroy']()[_0xa55c('0x20')](function(){_0x1fc828['status'](0xcc)[_0xa55c('0x21')]();});}};}function handleEntityNotFound(_0x190757,_0x3f64de){return function(_0xf0e574){if(!_0xf0e574){_0x190757[_0xa55c('0x22')](0x194);}return _0xf0e574;};}function handleError(_0x170ba4,_0x1da633){_0x1da633=_0x1da633||0x1f4;return function(_0x11e7f7){logger[_0xa55c('0x23')](_0x11e7f7[_0xa55c('0x24')]);if(_0x11e7f7[_0xa55c('0x25')]){delete _0x11e7f7['name'];}_0x170ba4[_0xa55c('0x18')](_0x1da633)[_0xa55c('0x26')](_0x11e7f7);};}exports[_0xa55c('0x27')]=function(_0x906caa,_0x5d940d){var _0x1377b0={},_0x22f6b6={},_0x1b8388={'count':0x0,'rows':[]};var _0x201941=_[_0xa55c('0x28')](db[_0xa55c('0x29')]['rawAttributes'],function(_0x23e698){return{'name':_0x23e698['fieldName'],'type':_0x23e698[_0xa55c('0x2a')][_0xa55c('0x2b')]};});_0x22f6b6[_0xa55c('0x2c')]=_[_0xa55c('0x28')](_0x201941,'name');_0x22f6b6[_0xa55c('0x2d')]=_[_0xa55c('0x2e')](_0x906caa[_0xa55c('0x2d')]);_0x22f6b6[_0xa55c('0x2f')]=_[_0xa55c('0x30')](_0x22f6b6[_0xa55c('0x2c')],_0x22f6b6[_0xa55c('0x2d')]);_0x1377b0[_0xa55c('0x31')]=_[_0xa55c('0x30')](_0x22f6b6[_0xa55c('0x2c')],qs[_0xa55c('0x32')](_0x906caa['query']['fields']));_0x1377b0[_0xa55c('0x31')]=_0x1377b0[_0xa55c('0x31')]['length']?_0x1377b0[_0xa55c('0x31')]:_0x22f6b6[_0xa55c('0x2c')];if(!_0x906caa[_0xa55c('0x2d')][_0xa55c('0x33')](_0xa55c('0x34'))){_0x1377b0[_0xa55c('0x1c')]=qs[_0xa55c('0x1c')](_0x906caa[_0xa55c('0x2d')][_0xa55c('0x1c')]);_0x1377b0['offset']=qs['offset'](_0x906caa['query'][_0xa55c('0x1a')]);}_0x1377b0[_0xa55c('0x35')]=qs[_0xa55c('0x36')](_0x906caa['query'][_0xa55c('0x36')]);_0x1377b0['where']=qs[_0xa55c('0x2f')](_['pick'](_0x906caa[_0xa55c('0x2d')],_0x22f6b6[_0xa55c('0x2f')]),_0x201941);if(_0x906caa[_0xa55c('0x2d')]['filter']){_0x1377b0[_0xa55c('0x37')]=_[_0xa55c('0x38')](_0x1377b0['where'],{'$or':_[_0xa55c('0x28')](_0x201941,function(_0x194e78){if(_0x194e78['type']!=='VIRTUAL'){var _0x235f6b={};_0x235f6b[_0x194e78['name']]={'$like':'%'+_0x906caa[_0xa55c('0x2d')][_0xa55c('0x39')]+'%'};return _0x235f6b;}})});}_0x1377b0=_['merge']({},_0x1377b0,_0x906caa['options']);var _0x5e50b6={'where':_0x1377b0['where']};return db[_0xa55c('0x29')][_0xa55c('0x1d')](_0x5e50b6)[_0xa55c('0x20')](function(_0x99c4f8){_0x1b8388[_0xa55c('0x1d')]=_0x99c4f8;if(_0x906caa['query'][_0xa55c('0x3a')]){_0x1377b0[_0xa55c('0x3b')]=[{'all':!![]}];}return db[_0xa55c('0x29')][_0xa55c('0x3c')](_0x1377b0);})[_0xa55c('0x20')](function(_0x23cef5){_0x1b8388['rows']=_0x23cef5;return _0x1b8388;})[_0xa55c('0x20')](respondWithFilteredResult(_0x5d940d,_0x1377b0))['catch'](handleError(_0x5d940d,null));};exports['show']=function(_0x404e7f,_0x1f63d8){var _0x496920={'raw':!![],'where':{'id':_0x404e7f['params']['id']}},_0x2bd98b={};_0x2bd98b['model']=_[_0xa55c('0x2e')](db[_0xa55c('0x29')][_0xa55c('0x3d')]);_0x2bd98b['query']=_[_0xa55c('0x2e')](_0x404e7f[_0xa55c('0x2d')]);_0x2bd98b['filters']=_[_0xa55c('0x30')](_0x2bd98b['model'],_0x2bd98b[_0xa55c('0x2d')]);_0x496920[_0xa55c('0x31')]=_['intersection'](_0x2bd98b[_0xa55c('0x2c')],qs[_0xa55c('0x32')](_0x404e7f['query'][_0xa55c('0x32')]));_0x496920[_0xa55c('0x31')]=_0x496920[_0xa55c('0x31')]['length']?_0x496920[_0xa55c('0x31')]:_0x2bd98b['model'];if(_0x404e7f[_0xa55c('0x2d')][_0xa55c('0x3a')]){_0x496920[_0xa55c('0x3b')]=[{'all':!![]}];}_0x496920=_['merge']({},_0x496920,_0x404e7f[_0xa55c('0x3e')]);return db[_0xa55c('0x29')]['find'](_0x496920)[_0xa55c('0x20')](handleEntityNotFound(_0x1f63d8,null))[_0xa55c('0x20')](respondWithResult(_0x1f63d8,null))['catch'](handleError(_0x1f63d8,null));};exports[_0xa55c('0x3f')]=function(_0xd3fe78,_0x52f9a7){return db[_0xa55c('0x29')][_0xa55c('0x3f')](_0xd3fe78[_0xa55c('0x40')],{})[_0xa55c('0x20')](respondWithResult(_0x52f9a7,0xc9))['catch'](handleError(_0x52f9a7,null));};exports[_0xa55c('0x1f')]=function(_0x58a7ea,_0x2157d6){if(_0x58a7ea[_0xa55c('0x40')]['id']){delete _0x58a7ea[_0xa55c('0x40')]['id'];}return db['MemberReport'][_0xa55c('0x41')]({'where':{'id':_0x58a7ea[_0xa55c('0x42')]['id']}})['then'](handleEntityNotFound(_0x2157d6,null))[_0xa55c('0x20')](saveUpdates(_0x58a7ea[_0xa55c('0x40')],null))[_0xa55c('0x20')](respondWithResult(_0x2157d6,null))[_0xa55c('0x43')](handleError(_0x2157d6,null));};exports[_0xa55c('0x44')]=function(_0x1c84d9,_0x1e1293){return db[_0xa55c('0x29')][_0xa55c('0x41')]({'where':{'id':_0x1c84d9[_0xa55c('0x42')]['id']}})['then'](handleEntityNotFound(_0x1e1293,null))[_0xa55c('0x20')](removeEntity(_0x1e1293,null))[_0xa55c('0x43')](handleError(_0x1e1293,null));};exports[_0xa55c('0x45')]=function(_0x4f73b6,_0x4c3095){return db[_0xa55c('0x29')]['describe']()[_0xa55c('0x20')](respondWithResult(_0x4c3095,null))['catch'](handleError(_0x4c3095,null));}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.model.js b/server/api/memberReport/memberReport.model.js index a10ebc0..9ea0fe5 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 _0xbcfe=['util','api','request-promise','../../config/environment','./memberReport.attributes','exports','report_member','membername_interface','membername','lodash'];(function(_0x1d3d5e,_0x1d8598){var _0x244664=function(_0x5cfce3){while(--_0x5cfce3){_0x1d3d5e['push'](_0x1d3d5e['shift']());}};_0x244664(++_0x1d8598);}(_0xbcfe,0x1cb));var _0xebcf=function(_0x1e143c,_0x18891b){_0x1e143c=_0x1e143c-0x0;var _0x2610aa=_0xbcfe[_0x1e143c];return _0x2610aa;};'use strict';var _=require(_0xebcf('0x0'));var util=require(_0xebcf('0x1'));var logger=require('../../config/logger')(_0xebcf('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xebcf('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xebcf('0x4'));var attributes=require(_0xebcf('0x5'));module[_0xebcf('0x6')]=function(_0x20b398,_0xa049b0){return _0x20b398['define']('MemberReport',attributes,{'tableName':_0xebcf('0x7'),'paranoid':![],'indexes':[{'name':_0xebcf('0x8'),'fields':[_0xebcf('0x9'),'interface']}],'timestamps':!![]});}; \ No newline at end of file +var _0x2873=['rimraf','../../config/environment','exports','define','report_member','membername_interface','membername','interface','lodash','util','../../config/logger','api','bluebird','request-promise'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x2873,0x1f2));var _0x3287=function(_0xbc7ae2,_0x2fa4de){_0xbc7ae2=_0xbc7ae2-0x0;var _0x15334d=_0x2873[_0xbc7ae2];return _0x15334d;};'use strict';var _=require(_0x3287('0x0'));var util=require(_0x3287('0x1'));var logger=require(_0x3287('0x2'))(_0x3287('0x3'));var moment=require('moment');var BPromise=require(_0x3287('0x4'));var rp=require(_0x3287('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3287('0x6'));var config=require(_0x3287('0x7'));var attributes=require('./memberReport.attributes');module[_0x3287('0x8')]=function(_0x795e58,_0x5b30c4){return _0x795e58[_0x3287('0x9')]('MemberReport',attributes,{'tableName':_0x3287('0xa'),'paranoid':![],'indexes':[{'name':_0x3287('0xb'),'fields':[_0x3287('0xc'),_0x3287('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.rpc.js b/server/api/memberReport/memberReport.rpc.js index 1f4f3a1..5ef9cfb 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 _0xc1db=['options','where','limit','include','map','model','attributes','then','CreateMemberReport','create','body','raw','debug','UpdateMemberReport','update','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','http','request','MemberReport,\x20%s,\x20%s','request\x20sent','MemberReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','GetMemberReport','MemberReport','findAll'];(function(_0x264e1e,_0x3af804){var _0x4b1840=function(_0x4ad24e){while(--_0x4ad24e){_0x264e1e['push'](_0x264e1e['shift']());}};_0x4b1840(++_0x3af804);}(_0xc1db,0x120));var _0xbc1d=function(_0x443937,_0x420777){_0x443937=_0x443937-0x0;var _0x410f91=_0xc1db[_0x443937];return _0x410f91;};'use strict';var _=require(_0xbc1d('0x0'));var util=require('util');var moment=require(_0xbc1d('0x1'));var BPromise=require(_0xbc1d('0x2'));var rs=require(_0xbc1d('0x3'));var fs=require('fs');var Redis=require(_0xbc1d('0x4'));var db=require(_0xbc1d('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xbc1d('0x6'))(_0xbc1d('0x7'));var config=require(_0xbc1d('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0xbc1d('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5dbeec,_0x58e1fb,_0x1bec7a){return new BPromise(function(_0x562549,_0x268200){return client[_0xbc1d('0xa')](_0x5dbeec,_0x1bec7a)['then'](function(_0x45468e){logger['info'](_0xbc1d('0xb'),_0x58e1fb,_0xbc1d('0xc'));logger['debug'](_0xbc1d('0xd'),_0x58e1fb,_0xbc1d('0xc'),JSON[_0xbc1d('0xe')](_0x45468e));if(_0x45468e[_0xbc1d('0xf')]){if(_0x45468e['error'][_0xbc1d('0x10')]===0x1f4){logger['error'](_0xbc1d('0xb'),_0x58e1fb,_0x45468e[_0xbc1d('0xf')]['message']);return _0x268200(_0x45468e[_0xbc1d('0xf')][_0xbc1d('0x11')]);}logger['error'](_0xbc1d('0xb'),_0x58e1fb,_0x45468e[_0xbc1d('0xf')]['message']);return _0x562549(_0x45468e[_0xbc1d('0xf')]['message']);}else{logger[_0xbc1d('0x12')](_0xbc1d('0xb'),_0x58e1fb,_0xbc1d('0xc'));_0x562549(_0x45468e[_0xbc1d('0x13')][_0xbc1d('0x11')]);}})[_0xbc1d('0x14')](function(_0x5bddda){logger[_0xbc1d('0xf')]('MemberReport,\x20%s,\x20%s',_0x58e1fb,_0x5bddda);_0x268200(_0x5bddda);});});}exports[_0xbc1d('0x15')]=function(_0x225310){var _0x57de11=this;return new Promise(function(_0x58c56e,_0x51abd6){return db[_0xbc1d('0x16')][_0xbc1d('0x17')]({'raw':_0x225310[_0xbc1d('0x18')]?_0x225310[_0xbc1d('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x225310[_0xbc1d('0x18')]?_0x225310[_0xbc1d('0x18')][_0xbc1d('0x19')]||null:null,'attributes':_0x225310[_0xbc1d('0x18')]?_0x225310['options']['attributes']||null:null,'limit':_0x225310[_0xbc1d('0x18')]?_0x225310['options'][_0xbc1d('0x1a')]||null:null,'include':_0x225310['options']?_0x225310[_0xbc1d('0x18')][_0xbc1d('0x1b')]?_['map'](_0x225310[_0xbc1d('0x18')][_0xbc1d('0x1b')],function(_0x3955ab){return{'model':db[_0x3955ab['model']],'as':_0x3955ab['as'],'attributes':_0x3955ab['attributes'],'include':_0x3955ab[_0xbc1d('0x1b')]?_['map'](_0x3955ab[_0xbc1d('0x1b')],function(_0x13ce62){return{'model':db[_0x13ce62['model']],'as':_0x13ce62['as'],'attributes':_0x13ce62['attributes'],'include':_0x13ce62[_0xbc1d('0x1b')]?_[_0xbc1d('0x1c')](_0x13ce62['include'],function(_0x7b37c3){return{'model':db[_0x7b37c3[_0xbc1d('0x1d')]],'as':_0x7b37c3['as'],'attributes':_0x7b37c3[_0xbc1d('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xbc1d('0x1f')](function(_0x155c90){logger[_0xbc1d('0x12')](_0xbc1d('0x15'),_0x225310);logger['debug'](_0xbc1d('0x15'),_0x225310,JSON['stringify'](_0x155c90));_0x58c56e(_0x155c90);})['catch'](function(_0x40d1e2){logger[_0xbc1d('0xf')](_0xbc1d('0x15'),_0x40d1e2[_0xbc1d('0x11')],_0x225310);_0x51abd6(_0x57de11['error'](0x1f4,_0x40d1e2[_0xbc1d('0x11')]));});});};exports[_0xbc1d('0x20')]=function(_0x586007){var _0x24b534=this;return new Promise(function(_0x47cd85,_0x12a96c){return db[_0xbc1d('0x16')][_0xbc1d('0x21')](_0x586007[_0xbc1d('0x22')],{'raw':_0x586007[_0xbc1d('0x18')]?_0x586007[_0xbc1d('0x18')][_0xbc1d('0x23')]===undefined?!![]:![]:!![]})[_0xbc1d('0x1f')](function(_0x4fd85a){logger[_0xbc1d('0x12')](_0xbc1d('0x20'),_0x586007);logger[_0xbc1d('0x24')](_0xbc1d('0x20'),_0x586007,JSON[_0xbc1d('0xe')](_0x4fd85a));_0x47cd85(_0x4fd85a);})[_0xbc1d('0x14')](function(_0x5442ed){logger[_0xbc1d('0xf')](_0xbc1d('0x20'),_0x5442ed[_0xbc1d('0x11')],_0x586007);_0x12a96c(_0x24b534['error'](0x1f4,_0x5442ed[_0xbc1d('0x11')]));});});};exports[_0xbc1d('0x25')]=function(_0x16cb6e){var _0x563d7e=this;return new Promise(function(_0x452924,_0x1ed448){return db[_0xbc1d('0x16')][_0xbc1d('0x26')](_0x16cb6e['body'],{'raw':_0x16cb6e['options']?_0x16cb6e[_0xbc1d('0x18')][_0xbc1d('0x23')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x16cb6e[_0xbc1d('0x18')]?_0x16cb6e['options']['where']||null:null,'attributes':_0x16cb6e['options']?_0x16cb6e['options'][_0xbc1d('0x1e')]||null:null,'limit':_0x16cb6e[_0xbc1d('0x18')]?_0x16cb6e[_0xbc1d('0x18')][_0xbc1d('0x1a')]||null:null})[_0xbc1d('0x1f')](function(_0x271e40){logger['info'](_0xbc1d('0x25'),_0x16cb6e);logger['debug'](_0xbc1d('0x25'),_0x16cb6e,JSON['stringify'](_0x271e40));_0x452924(_0x271e40);})[_0xbc1d('0x14')](function(_0x3fdfc5){logger[_0xbc1d('0xf')]('UpdateMemberReport',_0x3fdfc5[_0xbc1d('0x11')],_0x16cb6e);_0x1ed448(_0x563d7e[_0xbc1d('0xf')](0x1f4,_0x3fdfc5[_0xbc1d('0x11')]));});});}; \ No newline at end of file +var _0xc1c6=['UpdateMemberReport','update','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','http','then','MemberReport,\x20%s,\x20%s','request\x20sent','debug','MemberReport,\x20%s,\x20%s,\x20%s','stringify','error','message','info','catch','findAll','options','raw','where','attributes','limit','include','map','model','GetMemberReport','MemberReport','create','body','CreateMemberReport'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc1c6,0xf7));var _0x6c1c=function(_0x15e106,_0xd8ec3e){_0x15e106=_0x15e106-0x0;var _0x1c8952=_0xc1c6[_0x15e106];return _0x1c8952;};'use strict';var _=require(_0x6c1c('0x0'));var util=require(_0x6c1c('0x1'));var moment=require(_0x6c1c('0x2'));var BPromise=require('bluebird');var rs=require(_0x6c1c('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6c1c('0x4'))['db'];var utils=require(_0x6c1c('0x5'));var logger=require(_0x6c1c('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x6c1c('0x7'));var client=jayson['client'][_0x6c1c('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x582bec,_0xe510ca,_0x2eb1ba){return new BPromise(function(_0x38369d,_0x2cec58){return client['request'](_0x582bec,_0x2eb1ba)[_0x6c1c('0x9')](function(_0x3ca985){logger['info'](_0x6c1c('0xa'),_0xe510ca,_0x6c1c('0xb'));logger[_0x6c1c('0xc')](_0x6c1c('0xd'),_0xe510ca,'request\x20sent',JSON[_0x6c1c('0xe')](_0x3ca985));if(_0x3ca985[_0x6c1c('0xf')]){if(_0x3ca985[_0x6c1c('0xf')]['code']===0x1f4){logger[_0x6c1c('0xf')](_0x6c1c('0xa'),_0xe510ca,_0x3ca985[_0x6c1c('0xf')]['message']);return _0x2cec58(_0x3ca985[_0x6c1c('0xf')]['message']);}logger[_0x6c1c('0xf')](_0x6c1c('0xa'),_0xe510ca,_0x3ca985[_0x6c1c('0xf')][_0x6c1c('0x10')]);return _0x38369d(_0x3ca985[_0x6c1c('0xf')][_0x6c1c('0x10')]);}else{logger[_0x6c1c('0x11')](_0x6c1c('0xa'),_0xe510ca,_0x6c1c('0xb'));_0x38369d(_0x3ca985['result'][_0x6c1c('0x10')]);}})[_0x6c1c('0x12')](function(_0x5214ee){logger[_0x6c1c('0xf')](_0x6c1c('0xa'),_0xe510ca,_0x5214ee);_0x2cec58(_0x5214ee);});});}exports['GetMemberReport']=function(_0x137770){var _0x4ede06=this;return new Promise(function(_0x338dc2,_0x1a0ab9){return db['MemberReport'][_0x6c1c('0x13')]({'raw':_0x137770['options']?_0x137770[_0x6c1c('0x14')][_0x6c1c('0x15')]===undefined?!![]:![]:!![],'where':_0x137770[_0x6c1c('0x14')]?_0x137770[_0x6c1c('0x14')][_0x6c1c('0x16')]||null:null,'attributes':_0x137770[_0x6c1c('0x14')]?_0x137770[_0x6c1c('0x14')][_0x6c1c('0x17')]||null:null,'limit':_0x137770[_0x6c1c('0x14')]?_0x137770[_0x6c1c('0x14')][_0x6c1c('0x18')]||null:null,'include':_0x137770[_0x6c1c('0x14')]?_0x137770[_0x6c1c('0x14')][_0x6c1c('0x19')]?_[_0x6c1c('0x1a')](_0x137770[_0x6c1c('0x14')][_0x6c1c('0x19')],function(_0x12c638){return{'model':db[_0x12c638[_0x6c1c('0x1b')]],'as':_0x12c638['as'],'attributes':_0x12c638[_0x6c1c('0x17')],'include':_0x12c638[_0x6c1c('0x19')]?_[_0x6c1c('0x1a')](_0x12c638[_0x6c1c('0x19')],function(_0x7ff10d){return{'model':db[_0x7ff10d[_0x6c1c('0x1b')]],'as':_0x7ff10d['as'],'attributes':_0x7ff10d[_0x6c1c('0x17')],'include':_0x7ff10d[_0x6c1c('0x19')]?_[_0x6c1c('0x1a')](_0x7ff10d[_0x6c1c('0x19')],function(_0x5f4568){return{'model':db[_0x5f4568[_0x6c1c('0x1b')]],'as':_0x5f4568['as'],'attributes':_0x5f4568['attributes']};}):[]};}):[]};}):[]:[]})[_0x6c1c('0x9')](function(_0x4c23f8){logger[_0x6c1c('0x11')]('GetMemberReport',_0x137770);logger[_0x6c1c('0xc')](_0x6c1c('0x1c'),_0x137770,JSON['stringify'](_0x4c23f8));_0x338dc2(_0x4c23f8);})[_0x6c1c('0x12')](function(_0x24da4c){logger['error'](_0x6c1c('0x1c'),_0x24da4c[_0x6c1c('0x10')],_0x137770);_0x1a0ab9(_0x4ede06[_0x6c1c('0xf')](0x1f4,_0x24da4c[_0x6c1c('0x10')]));});});};exports['CreateMemberReport']=function(_0x52c036){var _0x3cba17=this;return new Promise(function(_0x45128c,_0x21acef){return db[_0x6c1c('0x1d')][_0x6c1c('0x1e')](_0x52c036[_0x6c1c('0x1f')],{'raw':_0x52c036['options']?_0x52c036[_0x6c1c('0x14')][_0x6c1c('0x15')]===undefined?!![]:![]:!![]})['then'](function(_0x1b371d){logger[_0x6c1c('0x11')](_0x6c1c('0x20'),_0x52c036);logger[_0x6c1c('0xc')]('CreateMemberReport',_0x52c036,JSON[_0x6c1c('0xe')](_0x1b371d));_0x45128c(_0x1b371d);})[_0x6c1c('0x12')](function(_0x245433){logger['error'](_0x6c1c('0x20'),_0x245433['message'],_0x52c036);_0x21acef(_0x3cba17[_0x6c1c('0xf')](0x1f4,_0x245433['message']));});});};exports[_0x6c1c('0x21')]=function(_0x24d3e1){var _0x32916f=this;return new Promise(function(_0x54b8d3,_0x4f557a){return db[_0x6c1c('0x1d')][_0x6c1c('0x22')](_0x24d3e1[_0x6c1c('0x1f')],{'raw':_0x24d3e1['options']?_0x24d3e1[_0x6c1c('0x14')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x24d3e1['options']?_0x24d3e1[_0x6c1c('0x14')][_0x6c1c('0x16')]||null:null,'attributes':_0x24d3e1[_0x6c1c('0x14')]?_0x24d3e1[_0x6c1c('0x14')]['attributes']||null:null,'limit':_0x24d3e1[_0x6c1c('0x14')]?_0x24d3e1[_0x6c1c('0x14')][_0x6c1c('0x18')]||null:null})[_0x6c1c('0x9')](function(_0x173a54){logger[_0x6c1c('0x11')](_0x6c1c('0x21'),_0x24d3e1);logger[_0x6c1c('0xc')](_0x6c1c('0x21'),_0x24d3e1,JSON[_0x6c1c('0xe')](_0x173a54));_0x54b8d3(_0x173a54);})['catch'](function(_0xb05b38){logger[_0x6c1c('0xf')](_0x6c1c('0x21'),_0xb05b38[_0x6c1c('0x10')],_0x24d3e1);_0x4f557a(_0x32916f[_0x6c1c('0xf')](0x1f4,_0xb05b38['message']));});});}; \ No newline at end of file diff --git a/server/api/migration/index.js b/server/api/migration/index.js index f77fede..e96ab80 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 _0x1258=['fs-extra','../../components/auth/service','../../config/environment','./migration.controller','get','index','exports','multer','path','connect-timeout','express'];(function(_0x5c7ccb,_0x1b85f5){var _0x317b51=function(_0x2f1c14){while(--_0x2f1c14){_0x5c7ccb['push'](_0x5c7ccb['shift']());}};_0x317b51(++_0x1b85f5);}(_0x1258,0x1ca));var _0x8125=function(_0x528e4f,_0x3e3718){_0x528e4f=_0x528e4f-0x0;var _0x443b43=_0x1258[_0x528e4f];return _0x443b43;};'use strict';var multer=require(_0x8125('0x0'));var util=require('util');var path=require(_0x8125('0x1'));var timeout=require(_0x8125('0x2'));var express=require(_0x8125('0x3'));var router=express['Router']();var fs_extra=require(_0x8125('0x4'));var auth=require(_0x8125('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x8125('0x6'));var controller=require(_0x8125('0x7'));router[_0x8125('0x8')]('/',controller[_0x8125('0x9')]);module[_0x8125('0xa')]=router; \ No newline at end of file +var _0xff7b=['multer','util','connect-timeout','express','fs-extra','../../components/auth/service','index','exports'];(function(_0x1af418,_0x578f1a){var _0x5d304b=function(_0x40bf4f){while(--_0x40bf4f){_0x1af418['push'](_0x1af418['shift']());}};_0x5d304b(++_0x578f1a);}(_0xff7b,0xe8));var _0xbff7=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xff7b[_0x2641f9];return _0x585741;};'use strict';var multer=require(_0xbff7('0x0'));var util=require(_0xbff7('0x1'));var path=require('path');var timeout=require(_0xbff7('0x2'));var express=require(_0xbff7('0x3'));var router=express['Router']();var fs_extra=require(_0xbff7('0x4'));var auth=require(_0xbff7('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./migration.controller');router['get']('/',controller[_0xbff7('0x6')]);module[_0xbff7('0x7')]=router; \ No newline at end of file diff --git a/server/api/migration/migration.attributes.js b/server/api/migration/migration.attributes.js index afe9077..884036c 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 _0x6fe3=['exports','STRING','version','sequelize'];(function(_0x21aa5b,_0x2c808f){var _0x2ca4c8=function(_0x5819e5){while(--_0x5819e5){_0x21aa5b['push'](_0x21aa5b['shift']());}};_0x2ca4c8(++_0x2c808f);}(_0x6fe3,0x9f));var _0x36fe=function(_0x15ea09,_0x2f30ab){_0x15ea09=_0x15ea09-0x0;var _0x3e9c78=_0x6fe3[_0x15ea09];return _0x3e9c78;};'use strict';var Sequelize=require(_0x36fe('0x0'));module[_0x36fe('0x1')]={'version':{'type':Sequelize[_0x36fe('0x2')],'unique':_0x36fe('0x3')}}; \ No newline at end of file +var _0x97e7=['sequelize','exports','STRING','version'];(function(_0x265468,_0xcf7439){var _0x37d555=function(_0x47c742){while(--_0x47c742){_0x265468['push'](_0x265468['shift']());}};_0x37d555(++_0xcf7439);}(_0x97e7,0x100));var _0x797e=function(_0x1d475b,_0x14ba95){_0x1d475b=_0x1d475b-0x0;var _0x48edf2=_0x97e7[_0x1d475b];return _0x48edf2;};'use strict';var Sequelize=require(_0x797e('0x0'));module[_0x797e('0x1')]={'version':{'type':Sequelize[_0x797e('0x2')],'unique':_0x797e('0x3')}}; \ No newline at end of file diff --git a/server/api/migration/migration.controller.js b/server/api/migration/migration.controller.js index 170dbf9..3e6516b 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 _0x5dd6=['attributes','length','nolimit','order','where','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','limit','undefined','offset','count','set','Content-Range','apply','reject','save','update','destroy','then','stack','send','map','Migration','fieldName','model','name','query','filters','intersection','fields'];(function(_0x576266,_0x4002b0){var _0x18234f=function(_0x4e9ad5){while(--_0x4e9ad5){_0x576266['push'](_0x576266['shift']());}};_0x18234f(++_0x4002b0);}(_0x5dd6,0x11b));var _0x65dd=function(_0x381379,_0x3f3b86){_0x381379=_0x381379-0x0;var _0x3e1063=_0x5dd6[_0x381379];return _0x3e1063;};'use strict';var emlformat=require(_0x65dd('0x0'));var rimraf=require(_0x65dd('0x1'));var zipdir=require(_0x65dd('0x2'));var jsonpatch=require(_0x65dd('0x3'));var rp=require(_0x65dd('0x4'));var moment=require('moment');var BPromise=require(_0x65dd('0x5'));var Mustache=require(_0x65dd('0x6'));var util=require('util');var path=require(_0x65dd('0x7'));var sox=require('sox');var csv=require(_0x65dd('0x8'));var ejs=require(_0x65dd('0x9'));var fs=require('fs');var fs_extra=require(_0x65dd('0xa'));var _=require(_0x65dd('0xb'));var squel=require(_0x65dd('0xc'));var crypto=require(_0x65dd('0xd'));var jsforce=require(_0x65dd('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x65dd('0x8'));var querystring=require(_0x65dd('0xf'));var Papa=require(_0x65dd('0x10'));var Redis=require(_0x65dd('0x11'));var authService=require(_0x65dd('0x12'));var qs=require(_0x65dd('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x65dd('0x14'))(_0x65dd('0x15'));var utils=require('../../config/utils');var config=require(_0x65dd('0x16'));var licenseUtil=require(_0x65dd('0x17'));var db=require(_0x65dd('0x18'))['db'];function respondWithStatusCode(_0x53777e,_0x56ab94){_0x56ab94=_0x56ab94||0xcc;return function(_0x47b7d3){if(_0x47b7d3){return _0x53777e[_0x65dd('0x19')](_0x56ab94);}return _0x53777e[_0x65dd('0x1a')](_0x56ab94)[_0x65dd('0x1b')]();};}function respondWithResult(_0x46629b,_0x2cd656){_0x2cd656=_0x2cd656||0xc8;return function(_0x3d3fa2){if(_0x3d3fa2){return _0x46629b['status'](_0x2cd656)[_0x65dd('0x1c')](_0x3d3fa2);}};}function respondWithFilteredResult(_0x312161,_0x59020c){return function(_0x19d281){if(_0x19d281){var _0x49d9c0=typeof _0x59020c['offset']==='undefined'&&typeof _0x59020c[_0x65dd('0x1d')]===_0x65dd('0x1e');var _0x53c2d0=_0x19d281['count'];var _0x1f7193=_0x49d9c0?0x0:_0x59020c[_0x65dd('0x1f')];var _0x245c86=_0x49d9c0?_0x19d281[_0x65dd('0x20')]:_0x59020c[_0x65dd('0x1f')]+_0x59020c[_0x65dd('0x1d')];var _0x1c14b2;if(_0x245c86>=_0x53c2d0){_0x245c86=_0x53c2d0;_0x1c14b2=0xc8;}else{_0x1c14b2=0xce;}_0x312161[_0x65dd('0x1a')](_0x1c14b2);return _0x312161[_0x65dd('0x21')](_0x65dd('0x22'),_0x1f7193+'-'+_0x245c86+'/'+_0x53c2d0)[_0x65dd('0x1c')](_0x19d281);}return null;};}function patchUpdates(_0x56702f){return function(_0x85d01){try{jsonpatch[_0x65dd('0x23')](_0x85d01,_0x56702f,!![]);}catch(_0x18725a){return BPromise[_0x65dd('0x24')](_0x18725a);}return _0x85d01[_0x65dd('0x25')]();};}function saveUpdates(_0x33c4a7,_0xdeaa3c){return function(_0x558e35){if(_0x558e35){return _0x558e35[_0x65dd('0x26')](_0x33c4a7)['then'](function(_0x558020){return _0x558020;});}return null;};}function removeEntity(_0x264e9a,_0x4406af){return function(_0x520f23){if(_0x520f23){return _0x520f23[_0x65dd('0x27')]()[_0x65dd('0x28')](function(){_0x264e9a[_0x65dd('0x1a')](0xcc)[_0x65dd('0x1b')]();});}};}function handleEntityNotFound(_0x526cb6,_0x1cb8eb){return function(_0x569468){if(!_0x569468){_0x526cb6[_0x65dd('0x19')](0x194);}return _0x569468;};}function handleError(_0x164a1e,_0x5597d7){_0x5597d7=_0x5597d7||0x1f4;return function(_0x54ceb3){logger['error'](_0x54ceb3[_0x65dd('0x29')]);if(_0x54ceb3['name']){delete _0x54ceb3['name'];}_0x164a1e['status'](_0x5597d7)[_0x65dd('0x2a')](_0x54ceb3);};}exports['index']=function(_0x228d61,_0x200d24){var _0x5819ab={},_0x125587={},_0x449893={'count':0x0,'rows':[]};var _0x2bce25=_[_0x65dd('0x2b')](db[_0x65dd('0x2c')]['rawAttributes'],function(_0x42c3e8){return{'name':_0x42c3e8[_0x65dd('0x2d')],'type':_0x42c3e8['type']['key']};});_0x125587[_0x65dd('0x2e')]=_[_0x65dd('0x2b')](_0x2bce25,_0x65dd('0x2f'));_0x125587[_0x65dd('0x30')]=_['keys'](_0x228d61['query']);_0x125587[_0x65dd('0x31')]=_[_0x65dd('0x32')](_0x125587['model'],_0x125587[_0x65dd('0x30')]);_0x5819ab['attributes']=_[_0x65dd('0x32')](_0x125587[_0x65dd('0x2e')],qs[_0x65dd('0x33')](_0x228d61['query'][_0x65dd('0x33')]));_0x5819ab[_0x65dd('0x34')]=_0x5819ab[_0x65dd('0x34')][_0x65dd('0x35')]?_0x5819ab[_0x65dd('0x34')]:_0x125587['model'];if(!_0x228d61['query']['hasOwnProperty'](_0x65dd('0x36'))){_0x5819ab[_0x65dd('0x1d')]=qs['limit'](_0x228d61['query'][_0x65dd('0x1d')]);_0x5819ab['offset']=qs['offset'](_0x228d61[_0x65dd('0x30')][_0x65dd('0x1f')]);}_0x5819ab[_0x65dd('0x37')]=qs['sort'](_0x228d61['query']['sort']);_0x5819ab[_0x65dd('0x38')]=qs[_0x65dd('0x31')](_['pick'](_0x228d61[_0x65dd('0x30')],_0x125587[_0x65dd('0x31')]),_0x2bce25);if(_0x228d61[_0x65dd('0x30')][_0x65dd('0x39')]){_0x5819ab['where']=_[_0x65dd('0x3a')](_0x5819ab[_0x65dd('0x38')],{'$or':_[_0x65dd('0x2b')](_0x2bce25,function(_0x1cee37){if(_0x1cee37[_0x65dd('0x3b')]!==_0x65dd('0x3c')){var _0x241284={};_0x241284[_0x1cee37[_0x65dd('0x2f')]]={'$like':'%'+_0x228d61[_0x65dd('0x30')]['filter']+'%'};return _0x241284;}})});}_0x5819ab=_[_0x65dd('0x3a')]({},_0x5819ab,_0x228d61[_0x65dd('0x3d')]);var _0x8b20cd={'where':_0x5819ab[_0x65dd('0x38')]};return db[_0x65dd('0x2c')][_0x65dd('0x20')](_0x8b20cd)[_0x65dd('0x28')](function(_0x3a5420){_0x449893['count']=_0x3a5420;if(_0x228d61[_0x65dd('0x30')][_0x65dd('0x3e')]){_0x5819ab[_0x65dd('0x3f')]=[{'all':!![]}];}return db['Migration'][_0x65dd('0x40')](_0x5819ab);})[_0x65dd('0x28')](function(_0x2ab190){_0x449893[_0x65dd('0x41')]=_0x2ab190;return _0x449893;})[_0x65dd('0x28')](respondWithFilteredResult(_0x200d24,_0x5819ab))[_0x65dd('0x42')](handleError(_0x200d24,null));}; \ No newline at end of file +var _0x907d=['name','map','Migration','rawAttributes','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','pick','merge','where','VIRTUAL','filter','options','includeAll','findAll','then','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','fs-extra','lodash','crypto','jsforce','to-csv','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','save','update','destroy','error','stack'];(function(_0xaa0309,_0x1c8008){var _0x5de7ce=function(_0x3aa6ae){while(--_0x3aa6ae){_0xaa0309['push'](_0xaa0309['shift']());}};_0x5de7ce(++_0x1c8008);}(_0x907d,0x14b));var _0xd907=function(_0x22dac7,_0x45d32a){_0x22dac7=_0x22dac7-0x0;var _0x3e6cfa=_0x907d[_0x22dac7];return _0x3e6cfa;};'use strict';var emlformat=require(_0xd907('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd907('0x1'));var jsonpatch=require(_0xd907('0x2'));var rp=require(_0xd907('0x3'));var moment=require(_0xd907('0x4'));var BPromise=require(_0xd907('0x5'));var Mustache=require(_0xd907('0x6'));var util=require(_0xd907('0x7'));var path=require(_0xd907('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xd907('0x9'));var fs=require('fs');var fs_extra=require(_0xd907('0xa'));var _=require(_0xd907('0xb'));var squel=require('squel');var crypto=require(_0xd907('0xc'));var jsforce=require(_0xd907('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xd907('0xe'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xd907('0xf'));var qs=require(_0xd907('0x10'));var as=require(_0xd907('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd907('0x12'))('api');var utils=require(_0xd907('0x13'));var config=require(_0xd907('0x14'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4a4c95,_0x3c86ca){_0x3c86ca=_0x3c86ca||0xcc;return function(_0x12277a){if(_0x12277a){return _0x4a4c95[_0xd907('0x15')](_0x3c86ca);}return _0x4a4c95[_0xd907('0x16')](_0x3c86ca)['end']();};}function respondWithResult(_0x5b5610,_0xb78a8d){_0xb78a8d=_0xb78a8d||0xc8;return function(_0x37a6b2){if(_0x37a6b2){return _0x5b5610[_0xd907('0x16')](_0xb78a8d)[_0xd907('0x17')](_0x37a6b2);}};}function respondWithFilteredResult(_0x50f075,_0x3aecf4){return function(_0x2aca53){if(_0x2aca53){var _0x55288c=typeof _0x3aecf4[_0xd907('0x18')]===_0xd907('0x19')&&typeof _0x3aecf4[_0xd907('0x1a')]===_0xd907('0x19');var _0x21ac51=_0x2aca53['count'];var _0x4e3e58=_0x55288c?0x0:_0x3aecf4[_0xd907('0x18')];var _0x3c3af3=_0x55288c?_0x2aca53[_0xd907('0x1b')]:_0x3aecf4[_0xd907('0x18')]+_0x3aecf4[_0xd907('0x1a')];var _0x3e91f6;if(_0x3c3af3>=_0x21ac51){_0x3c3af3=_0x21ac51;_0x3e91f6=0xc8;}else{_0x3e91f6=0xce;}_0x50f075[_0xd907('0x16')](_0x3e91f6);return _0x50f075[_0xd907('0x1c')](_0xd907('0x1d'),_0x4e3e58+'-'+_0x3c3af3+'/'+_0x21ac51)['json'](_0x2aca53);}return null;};}function patchUpdates(_0x1cc409){return function(_0xcb8361){try{jsonpatch['apply'](_0xcb8361,_0x1cc409,!![]);}catch(_0x567723){return BPromise['reject'](_0x567723);}return _0xcb8361[_0xd907('0x1e')]();};}function saveUpdates(_0x369f48,_0x33b48d){return function(_0x33a9b5){if(_0x33a9b5){return _0x33a9b5[_0xd907('0x1f')](_0x369f48)['then'](function(_0x231d12){return _0x231d12;});}return null;};}function removeEntity(_0x2b2911,_0x196acc){return function(_0x1e2704){if(_0x1e2704){return _0x1e2704[_0xd907('0x20')]()['then'](function(){_0x2b2911[_0xd907('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x9f6af,_0x209cf5){return function(_0x4948eb){if(!_0x4948eb){_0x9f6af['sendStatus'](0x194);}return _0x4948eb;};}function handleError(_0x1eeff3,_0x45da48){_0x45da48=_0x45da48||0x1f4;return function(_0x35095b){logger[_0xd907('0x21')](_0x35095b[_0xd907('0x22')]);if(_0x35095b[_0xd907('0x23')]){delete _0x35095b[_0xd907('0x23')];}_0x1eeff3['status'](_0x45da48)['send'](_0x35095b);};}exports['index']=function(_0x4f05d5,_0x45b87c){var _0x264379={},_0x56e46f={},_0x22bc90={'count':0x0,'rows':[]};var _0x28023d=_[_0xd907('0x24')](db[_0xd907('0x25')][_0xd907('0x26')],function(_0x5ca4aa){return{'name':_0x5ca4aa['fieldName'],'type':_0x5ca4aa[_0xd907('0x27')][_0xd907('0x28')]};});_0x56e46f[_0xd907('0x29')]=_[_0xd907('0x24')](_0x28023d,_0xd907('0x23'));_0x56e46f[_0xd907('0x2a')]=_[_0xd907('0x2b')](_0x4f05d5[_0xd907('0x2a')]);_0x56e46f[_0xd907('0x2c')]=_[_0xd907('0x2d')](_0x56e46f[_0xd907('0x29')],_0x56e46f['query']);_0x264379['attributes']=_[_0xd907('0x2d')](_0x56e46f[_0xd907('0x29')],qs[_0xd907('0x2e')](_0x4f05d5['query'][_0xd907('0x2e')]));_0x264379[_0xd907('0x2f')]=_0x264379[_0xd907('0x2f')]['length']?_0x264379[_0xd907('0x2f')]:_0x56e46f[_0xd907('0x29')];if(!_0x4f05d5[_0xd907('0x2a')][_0xd907('0x30')](_0xd907('0x31'))){_0x264379['limit']=qs[_0xd907('0x1a')](_0x4f05d5[_0xd907('0x2a')]['limit']);_0x264379['offset']=qs['offset'](_0x4f05d5[_0xd907('0x2a')][_0xd907('0x18')]);}_0x264379[_0xd907('0x32')]=qs['sort'](_0x4f05d5[_0xd907('0x2a')][_0xd907('0x33')]);_0x264379['where']=qs[_0xd907('0x2c')](_[_0xd907('0x34')](_0x4f05d5[_0xd907('0x2a')],_0x56e46f[_0xd907('0x2c')]),_0x28023d);if(_0x4f05d5['query']['filter']){_0x264379['where']=_[_0xd907('0x35')](_0x264379[_0xd907('0x36')],{'$or':_['map'](_0x28023d,function(_0x90e37a){if(_0x90e37a['type']!==_0xd907('0x37')){var _0x47fa43={};_0x47fa43[_0x90e37a[_0xd907('0x23')]]={'$like':'%'+_0x4f05d5[_0xd907('0x2a')][_0xd907('0x38')]+'%'};return _0x47fa43;}})});}_0x264379=_[_0xd907('0x35')]({},_0x264379,_0x4f05d5[_0xd907('0x39')]);var _0x306b17={'where':_0x264379[_0xd907('0x36')]};return db['Migration']['count'](_0x306b17)['then'](function(_0x517fa0){_0x22bc90['count']=_0x517fa0;if(_0x4f05d5['query'][_0xd907('0x3a')]){_0x264379['include']=[{'all':!![]}];}return db[_0xd907('0x25')][_0xd907('0x3b')](_0x264379);})['then'](function(_0xb7893c){_0x22bc90['rows']=_0xb7893c;return _0x22bc90;})[_0xd907('0x3c')](respondWithFilteredResult(_0x45b87c,_0x264379))['catch'](handleError(_0x45b87c,null));}; \ No newline at end of file diff --git a/server/api/migration/migration.model.js b/server/api/migration/migration.model.js index 5ea5f5f..94abade 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 _0xbc84=['exports','define','Migration','migrations','lodash','util','../../config/logger','api','moment','path','../../config/environment','./migration.attributes'];(function(_0x57b7cd,_0x6493db){var _0x4aa9d1=function(_0x54ade5){while(--_0x54ade5){_0x57b7cd['push'](_0x57b7cd['shift']());}};_0x4aa9d1(++_0x6493db);}(_0xbc84,0x1a8));var _0x4bc8=function(_0x57faea,_0x2cf4d2){_0x57faea=_0x57faea-0x0;var _0xc8c299=_0xbc84[_0x57faea];return _0xc8c299;};'use strict';var _=require(_0x4bc8('0x0'));var util=require(_0x4bc8('0x1'));var logger=require(_0x4bc8('0x2'))(_0x4bc8('0x3'));var moment=require(_0x4bc8('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x4bc8('0x5'));var rimraf=require('rimraf');var config=require(_0x4bc8('0x6'));var attributes=require(_0x4bc8('0x7'));module[_0x4bc8('0x8')]=function(_0x880e2a,_0x282845){return _0x880e2a[_0x4bc8('0x9')](_0x4bc8('0xa'),attributes,{'tableName':_0x4bc8('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1790=['lodash','../../config/logger','api','moment','rimraf','../../config/environment','./migration.attributes','exports','define','migrations'];(function(_0x50bf36,_0x1edc8c){var _0x15bac6=function(_0x15e7b7){while(--_0x15e7b7){_0x50bf36['push'](_0x50bf36['shift']());}};_0x15bac6(++_0x1edc8c);}(_0x1790,0x19a));var _0x0179=function(_0x5a4da7,_0x1ad425){_0x5a4da7=_0x5a4da7-0x0;var _0x39d9c9=_0x1790[_0x5a4da7];return _0x39d9c9;};'use strict';var _=require(_0x0179('0x0'));var util=require('util');var logger=require(_0x0179('0x1'))(_0x0179('0x2'));var moment=require(_0x0179('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x0179('0x4'));var config=require(_0x0179('0x5'));var attributes=require(_0x0179('0x6'));module[_0x0179('0x7')]=function(_0x4e0de8,_0x5ffb92){return _0x4e0de8[_0x0179('0x8')]('Migration',attributes,{'tableName':_0x0179('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/migration/migration.rpc.js b/server/api/migration/migration.rpc.js index 7805d82..388e828 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 _0x6822=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','Migration,\x20%s,\x20%s,\x20%s','request\x20sent','error','Migration,\x20%s,\x20%s','message','catch','util','moment','bluebird','randomstring'];(function(_0x4f9522,_0x399e9f){var _0x5a89a7=function(_0x853a9a){while(--_0x853a9a){_0x4f9522['push'](_0x4f9522['shift']());}};_0x5a89a7(++_0x399e9f);}(_0x6822,0x18c));var _0x2682=function(_0x5dc610,_0x435786){_0x5dc610=_0x5dc610-0x0;var _0x2b6b79=_0x6822[_0x5dc610];return _0x2b6b79;};'use strict';var _=require('lodash');var util=require(_0x2682('0x0'));var moment=require(_0x2682('0x1'));var BPromise=require(_0x2682('0x2'));var rs=require(_0x2682('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2682('0x4'))['db'];var utils=require(_0x2682('0x5'));var logger=require(_0x2682('0x6'))(_0x2682('0x7'));var config=require(_0x2682('0x8'));var jayson=require(_0x2682('0x9'));var client=jayson[_0x2682('0xa')][_0x2682('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x35f55b,_0x3f706c,_0x4242c5){return new BPromise(function(_0x1a1307,_0x303fe4){return client[_0x2682('0xc')](_0x35f55b,_0x4242c5)['then'](function(_0x3e72bc){logger[_0x2682('0xd')]('Migration,\x20%s,\x20%s',_0x3f706c,'request\x20sent');logger['debug'](_0x2682('0xe'),_0x3f706c,_0x2682('0xf'),JSON['stringify'](_0x3e72bc));if(_0x3e72bc[_0x2682('0x10')]){if(_0x3e72bc[_0x2682('0x10')]['code']===0x1f4){logger[_0x2682('0x10')](_0x2682('0x11'),_0x3f706c,_0x3e72bc[_0x2682('0x10')][_0x2682('0x12')]);return _0x303fe4(_0x3e72bc[_0x2682('0x10')][_0x2682('0x12')]);}logger[_0x2682('0x10')](_0x2682('0x11'),_0x3f706c,_0x3e72bc[_0x2682('0x10')][_0x2682('0x12')]);return _0x1a1307(_0x3e72bc[_0x2682('0x10')][_0x2682('0x12')]);}else{logger[_0x2682('0xd')](_0x2682('0x11'),_0x3f706c,_0x2682('0xf'));_0x1a1307(_0x3e72bc['result']['message']);}})[_0x2682('0x13')](function(_0x2b1ed2){logger[_0x2682('0x10')]('Migration,\x20%s,\x20%s',_0x3f706c,_0x2b1ed2);_0x303fe4(_0x2b1ed2);});});} \ No newline at end of file +var _0xbe31=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','info','request\x20sent','debug','Migration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','Migration,\x20%s,\x20%s','util'];(function(_0x344252,_0xed61ee){var _0x586b80=function(_0x59ca9c){while(--_0x59ca9c){_0x344252['push'](_0x344252['shift']());}};_0x586b80(++_0xed61ee);}(_0xbe31,0x83));var _0x1be3=function(_0x545b1b,_0x5600f2){_0x545b1b=_0x545b1b-0x0;var _0x276f35=_0xbe31[_0x545b1b];return _0x276f35;};'use strict';var _=require('lodash');var util=require(_0x1be3('0x0'));var moment=require(_0x1be3('0x1'));var BPromise=require(_0x1be3('0x2'));var rs=require(_0x1be3('0x3'));var fs=require('fs');var Redis=require(_0x1be3('0x4'));var db=require(_0x1be3('0x5'))['db'];var utils=require(_0x1be3('0x6'));var logger=require(_0x1be3('0x7'))(_0x1be3('0x8'));var config=require('../../config/environment');var jayson=require(_0x1be3('0x9'));var client=jayson['client'][_0x1be3('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xa757b9,_0x3c925a,_0x2c3965){return new BPromise(function(_0x2bb749,_0x2e4488){return client[_0x1be3('0xb')](_0xa757b9,_0x2c3965)[_0x1be3('0xc')](function(_0x359742){logger[_0x1be3('0xd')]('Migration,\x20%s,\x20%s',_0x3c925a,_0x1be3('0xe'));logger[_0x1be3('0xf')](_0x1be3('0x10'),_0x3c925a,_0x1be3('0xe'),JSON[_0x1be3('0x11')](_0x359742));if(_0x359742[_0x1be3('0x12')]){if(_0x359742[_0x1be3('0x12')][_0x1be3('0x13')]===0x1f4){logger[_0x1be3('0x12')]('Migration,\x20%s,\x20%s',_0x3c925a,_0x359742[_0x1be3('0x12')]['message']);return _0x2e4488(_0x359742[_0x1be3('0x12')][_0x1be3('0x14')]);}logger['error'](_0x1be3('0x15'),_0x3c925a,_0x359742['error'][_0x1be3('0x14')]);return _0x2bb749(_0x359742[_0x1be3('0x12')][_0x1be3('0x14')]);}else{logger[_0x1be3('0xd')](_0x1be3('0x15'),_0x3c925a,_0x1be3('0xe'));_0x2bb749(_0x359742['result']['message']);}})['catch'](function(_0x52d2f2){logger[_0x1be3('0x12')]('Migration,\x20%s,\x20%s',_0x3c925a,_0x52d2f2);_0x2e4488(_0x52d2f2);});});} \ No newline at end of file diff --git a/server/api/network/index.js b/server/api/network/index.js index d4fab1c..b7edba4 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 _0x56fd=['isAuthenticated','/:id','show','create','put','update','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./network.controller','get'];(function(_0x593752,_0xfc3827){var _0x4612be=function(_0x2d64c6){while(--_0x2d64c6){_0x593752['push'](_0x593752['shift']());}};_0x4612be(++_0xfc3827);}(_0x56fd,0x15f));var _0xd56f=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x56fd[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0xd56f('0x0'));var util=require(_0xd56f('0x1'));var path=require(_0xd56f('0x2'));var timeout=require('connect-timeout');var express=require(_0xd56f('0x3'));var router=express[_0xd56f('0x4')]();var fs_extra=require(_0xd56f('0x5'));var auth=require(_0xd56f('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xd56f('0x7'));var controller=require(_0xd56f('0x8'));router[_0xd56f('0x9')]('/',auth[_0xd56f('0xa')](),controller['index']);router['get'](_0xd56f('0xb'),auth[_0xd56f('0xa')](),controller[_0xd56f('0xc')]);router['post']('/',auth[_0xd56f('0xa')](),controller[_0xd56f('0xd')]);router[_0xd56f('0xe')]('/:id',auth[_0xd56f('0xa')](),controller[_0xd56f('0xf')]);router[_0xd56f('0x10')]('/:id',auth[_0xd56f('0xa')](),controller[_0xd56f('0x11')]);module[_0xd56f('0x12')]=router; \ No newline at end of file +var _0x6c1a=['update','destroy','exports','multer','util','connect-timeout','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','show','post','put','/:id'];(function(_0x13582d,_0x5548c2){var _0x486843=function(_0x1def5b){while(--_0x1def5b){_0x13582d['push'](_0x13582d['shift']());}};_0x486843(++_0x5548c2);}(_0x6c1a,0xf3));var _0xa6c1=function(_0x31324a,_0x275295){_0x31324a=_0x31324a-0x0;var _0x3a36de=_0x6c1a[_0x31324a];return _0x3a36de;};'use strict';var multer=require(_0xa6c1('0x0'));var util=require(_0xa6c1('0x1'));var path=require('path');var timeout=require(_0xa6c1('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xa6c1('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xa6c1('0x4'));var config=require(_0xa6c1('0x5'));var controller=require('./network.controller');router[_0xa6c1('0x6')]('/',auth[_0xa6c1('0x7')](),controller[_0xa6c1('0x8')]);router[_0xa6c1('0x6')]('/:id',auth[_0xa6c1('0x7')](),controller[_0xa6c1('0x9')]);router[_0xa6c1('0xa')]('/',auth[_0xa6c1('0x7')](),controller['create']);router[_0xa6c1('0xb')](_0xa6c1('0xc'),auth[_0xa6c1('0x7')](),controller[_0xa6c1('0xd')]);router['delete']('/:id',auth[_0xa6c1('0x7')](),controller[_0xa6c1('0xe')]);module[_0xa6c1('0xf')]=router; \ No newline at end of file diff --git a/server/api/network/network.attributes.js b/server/api/network/network.attributes.js index 31efb93..994715c 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 _0xb238=['localnet','externip','stun','turn','STRING','exports','ENUM'];(function(_0x4108f7,_0x51d271){var _0x4c394c=function(_0x2725ef){while(--_0x2725ef){_0x4108f7['push'](_0x4108f7['shift']());}};_0x4c394c(++_0x51d271);}(_0xb238,0x171));var _0x8b23=function(_0xe5195c,_0x2503a0){_0xe5195c=_0xe5195c-0x0;var _0x3572f6=_0xb238[_0xe5195c];return _0x3572f6;};'use strict';var Sequelize=require('sequelize');module[_0x8b23('0x0')]={'type':{'type':Sequelize[_0x8b23('0x1')](_0x8b23('0x2'),_0x8b23('0x3'),_0x8b23('0x4'),_0x8b23('0x5'))},'value':{'type':Sequelize[_0x8b23('0x6')]},'username':{'type':Sequelize[_0x8b23('0x6')]},'password':{'type':Sequelize[_0x8b23('0x6')]}}; \ No newline at end of file +var _0xcb29=['STRING','sequelize','exports','localnet','externip','stun'];(function(_0x10ad23,_0x23fecc){var _0x326910=function(_0x17eb02){while(--_0x17eb02){_0x10ad23['push'](_0x10ad23['shift']());}};_0x326910(++_0x23fecc);}(_0xcb29,0x169));var _0x9cb2=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0xcb29[_0x21a9d9];return _0x46adce;};'use strict';var Sequelize=require(_0x9cb2('0x0'));module[_0x9cb2('0x1')]={'type':{'type':Sequelize['ENUM'](_0x9cb2('0x2'),_0x9cb2('0x3'),_0x9cb2('0x4'),'turn')},'value':{'type':Sequelize[_0x9cb2('0x5')]},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/network/network.controller.js b/server/api/network/network.controller.js index 348413a..f0209a3 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 _0xfff6=['fields','hasOwnProperty','sort','pick','merge','where','VIRTUAL','filter','options','count','includeAll','include','findAll','rows','catch','show','rawAttributes','length','create','sequelize','transaction','body','type','toUpperCase','STUN','root','utf8','render','writeFileSync','/etc/asterisk/stun_xcally.conf','Reload','res_stun_monitor.so','TURN','readFileSync','join','server/files/templates/network.ejs','format','/etc/asterisk/sip_xcally_%s.conf','toLowerCase','chan_sip.so','params','server/files/templates/stun_multiple.ejs','server/files/templates/turn_multiple.ejs','/etc/asterisk/turn_xcally.conf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','api','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','then','info','Network,\x20%s,\x20%s','request\x20sent','Network,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','status','json','undefined','limit','offset','set','Content-Range','apply','reject','save','update','destroy','end','stack','name','index','map','Network','fieldName','key','keys','query','filters','intersection','model','attributes'];(function(_0x158fcf,_0x22fcd0){var _0x49ee23=function(_0x415808){while(--_0x415808){_0x158fcf['push'](_0x158fcf['shift']());}};_0x49ee23(++_0x22fcd0);}(_0xfff6,0x97));var _0x6fff=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0xfff6[_0x502c7d];return _0x30b7ed;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x6fff('0x0'));var jsonpatch=require(_0x6fff('0x1'));var rp=require(_0x6fff('0x2'));var moment=require(_0x6fff('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x6fff('0x4'));var util=require(_0x6fff('0x5'));var path=require(_0x6fff('0x6'));var sox=require(_0x6fff('0x7'));var csv=require(_0x6fff('0x8'));var ejs=require(_0x6fff('0x9'));var fs=require('fs');var fs_extra=require(_0x6fff('0xa'));var _=require(_0x6fff('0xb'));var squel=require(_0x6fff('0xc'));var crypto=require(_0x6fff('0xd'));var jsforce=require(_0x6fff('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x6fff('0x8'));var querystring=require(_0x6fff('0xf'));var Papa=require(_0x6fff('0x10'));var Redis=require(_0x6fff('0x11'));var authService=require(_0x6fff('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x6fff('0x13'));var utils=require('../../config/utils');var config=require(_0x6fff('0x14'));var licenseUtil=require(_0x6fff('0x15'));var db=require(_0x6fff('0x16'))['db'];var jayson=require(_0x6fff('0x17'));var client=jayson[_0x6fff('0x18')][_0x6fff('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x3a7558,_0x5b4825,_0x11f123,_0x26de65){return new BPromise(function(_0x4622a2,_0x3145e1){var _0x371c41=_0x26de65||client;return _0x371c41[_0x6fff('0x1a')](_0x3a7558,_0x11f123)[_0x6fff('0x1b')](function(_0x23ebe7){logger[_0x6fff('0x1c')](_0x6fff('0x1d'),_0x5b4825,_0x6fff('0x1e'));logger['debug'](_0x6fff('0x1f'),_0x5b4825,'request\x20sent',JSON[_0x6fff('0x20')](_0x23ebe7));if(_0x23ebe7[_0x6fff('0x21')]){if(_0x23ebe7['error'][_0x6fff('0x22')]===0x1f4){logger[_0x6fff('0x21')]('Network,\x20%s,\x20%s',_0x5b4825,_0x23ebe7[_0x6fff('0x21')][_0x6fff('0x23')]);return _0x3145e1(_0x23ebe7['error'][_0x6fff('0x23')]);}logger['error']('Network,\x20%s,\x20%s',_0x5b4825,_0x23ebe7[_0x6fff('0x21')][_0x6fff('0x23')]);return _0x4622a2(_0x23ebe7['error'][_0x6fff('0x23')]);}else{logger[_0x6fff('0x1c')](_0x6fff('0x1d'),_0x5b4825,_0x6fff('0x1e'));_0x4622a2(_0x23ebe7[_0x6fff('0x24')][_0x6fff('0x23')]);}})['catch'](function(_0x50bd4d){logger[_0x6fff('0x21')](_0x6fff('0x1d'),_0x5b4825,_0x50bd4d);_0x3145e1(_0x50bd4d);});});}function respondWithStatusCode(_0x25fb5b,_0x5cf0c3){_0x5cf0c3=_0x5cf0c3||0xcc;return function(_0xdd3b70){if(_0xdd3b70){return _0x25fb5b['sendStatus'](_0x5cf0c3);}return _0x25fb5b[_0x6fff('0x25')](_0x5cf0c3)['end']();};}function respondWithResult(_0x6f7bed,_0x232a2d){_0x232a2d=_0x232a2d||0xc8;return function(_0xd8bb78){if(_0xd8bb78){return _0x6f7bed[_0x6fff('0x25')](_0x232a2d)[_0x6fff('0x26')](_0xd8bb78);}};}function respondWithFilteredResult(_0x14f115,_0x3bc94f){return function(_0x133160){if(_0x133160){var _0x37c39d=typeof _0x3bc94f['offset']===_0x6fff('0x27')&&typeof _0x3bc94f[_0x6fff('0x28')]===_0x6fff('0x27');var _0x2e18da=_0x133160['count'];var _0x44e099=_0x37c39d?0x0:_0x3bc94f[_0x6fff('0x29')];var _0x58d2db=_0x37c39d?_0x133160['count']:_0x3bc94f[_0x6fff('0x29')]+_0x3bc94f[_0x6fff('0x28')];var _0x2df412;if(_0x58d2db>=_0x2e18da){_0x58d2db=_0x2e18da;_0x2df412=0xc8;}else{_0x2df412=0xce;}_0x14f115[_0x6fff('0x25')](_0x2df412);return _0x14f115[_0x6fff('0x2a')](_0x6fff('0x2b'),_0x44e099+'-'+_0x58d2db+'/'+_0x2e18da)[_0x6fff('0x26')](_0x133160);}return null;};}function patchUpdates(_0x1b3b23){return function(_0x8bc843){try{jsonpatch[_0x6fff('0x2c')](_0x8bc843,_0x1b3b23,!![]);}catch(_0x57fc71){return BPromise[_0x6fff('0x2d')](_0x57fc71);}return _0x8bc843[_0x6fff('0x2e')]();};}function saveUpdates(_0x324dea,_0x491ed8){return function(_0x2a7a29){if(_0x2a7a29){return _0x2a7a29[_0x6fff('0x2f')](_0x324dea)['then'](function(_0x4825db){return _0x4825db;});}return null;};}function removeEntity(_0x4ce255,_0x10f388){return function(_0x20ad5c){if(_0x20ad5c){return _0x20ad5c[_0x6fff('0x30')]()[_0x6fff('0x1b')](function(){_0x4ce255['status'](0xcc)[_0x6fff('0x31')]();});}};}function handleEntityNotFound(_0x353971,_0x1522ac){return function(_0x385ec8){if(!_0x385ec8){_0x353971['sendStatus'](0x194);}return _0x385ec8;};}function handleError(_0x51b729,_0x3708d6){_0x3708d6=_0x3708d6||0x1f4;return function(_0x404572){logger[_0x6fff('0x21')](_0x404572[_0x6fff('0x32')]);if(_0x404572[_0x6fff('0x33')]){delete _0x404572[_0x6fff('0x33')];}_0x51b729[_0x6fff('0x25')](_0x3708d6)['send'](_0x404572);};}exports[_0x6fff('0x34')]=function(_0x104e63,_0x369f77){var _0x3fea8c={},_0x52d8c5={},_0x1a1633={'count':0x0,'rows':[]};var _0x101662=_[_0x6fff('0x35')](db[_0x6fff('0x36')]['rawAttributes'],function(_0x5e5150){return{'name':_0x5e5150[_0x6fff('0x37')],'type':_0x5e5150['type'][_0x6fff('0x38')]};});_0x52d8c5['model']=_['map'](_0x101662,_0x6fff('0x33'));_0x52d8c5['query']=_[_0x6fff('0x39')](_0x104e63[_0x6fff('0x3a')]);_0x52d8c5[_0x6fff('0x3b')]=_[_0x6fff('0x3c')](_0x52d8c5[_0x6fff('0x3d')],_0x52d8c5[_0x6fff('0x3a')]);_0x3fea8c[_0x6fff('0x3e')]=_[_0x6fff('0x3c')](_0x52d8c5[_0x6fff('0x3d')],qs['fields'](_0x104e63[_0x6fff('0x3a')][_0x6fff('0x3f')]));_0x3fea8c[_0x6fff('0x3e')]=_0x3fea8c[_0x6fff('0x3e')]['length']?_0x3fea8c[_0x6fff('0x3e')]:_0x52d8c5['model'];if(!_0x104e63[_0x6fff('0x3a')][_0x6fff('0x40')]('nolimit')){_0x3fea8c[_0x6fff('0x28')]=qs[_0x6fff('0x28')](_0x104e63['query']['limit']);_0x3fea8c['offset']=qs[_0x6fff('0x29')](_0x104e63[_0x6fff('0x3a')][_0x6fff('0x29')]);}_0x3fea8c['order']=qs[_0x6fff('0x41')](_0x104e63[_0x6fff('0x3a')][_0x6fff('0x41')]);_0x3fea8c['where']=qs[_0x6fff('0x3b')](_[_0x6fff('0x42')](_0x104e63[_0x6fff('0x3a')],_0x52d8c5[_0x6fff('0x3b')]),_0x101662);if(_0x104e63['query']['filter']){_0x3fea8c['where']=_[_0x6fff('0x43')](_0x3fea8c[_0x6fff('0x44')],{'$or':_['map'](_0x101662,function(_0x4e4107){if(_0x4e4107['type']!==_0x6fff('0x45')){var _0xb276b9={};_0xb276b9[_0x4e4107['name']]={'$like':'%'+_0x104e63[_0x6fff('0x3a')][_0x6fff('0x46')]+'%'};return _0xb276b9;}})});}_0x3fea8c=_[_0x6fff('0x43')]({},_0x3fea8c,_0x104e63[_0x6fff('0x47')]);var _0x3563e5={'where':_0x3fea8c[_0x6fff('0x44')]};return db['Network'][_0x6fff('0x48')](_0x3563e5)[_0x6fff('0x1b')](function(_0x39371f){_0x1a1633['count']=_0x39371f;if(_0x104e63[_0x6fff('0x3a')][_0x6fff('0x49')]){_0x3fea8c[_0x6fff('0x4a')]=[{'all':!![]}];}return db[_0x6fff('0x36')][_0x6fff('0x4b')](_0x3fea8c);})[_0x6fff('0x1b')](function(_0x2ba36b){_0x1a1633[_0x6fff('0x4c')]=_0x2ba36b;return _0x1a1633;})[_0x6fff('0x1b')](respondWithFilteredResult(_0x369f77,_0x3fea8c))[_0x6fff('0x4d')](handleError(_0x369f77,null));};exports[_0x6fff('0x4e')]=function(_0x193bc6,_0x18ffec){var _0x24a008={'raw':!![],'where':{'id':_0x193bc6['params']['id']}},_0x572f95={};_0x572f95[_0x6fff('0x3d')]=_[_0x6fff('0x39')](db[_0x6fff('0x36')][_0x6fff('0x4f')]);_0x572f95[_0x6fff('0x3a')]=_[_0x6fff('0x39')](_0x193bc6[_0x6fff('0x3a')]);_0x572f95[_0x6fff('0x3b')]=_[_0x6fff('0x3c')](_0x572f95['model'],_0x572f95[_0x6fff('0x3a')]);_0x24a008[_0x6fff('0x3e')]=_[_0x6fff('0x3c')](_0x572f95[_0x6fff('0x3d')],qs['fields'](_0x193bc6[_0x6fff('0x3a')][_0x6fff('0x3f')]));_0x24a008[_0x6fff('0x3e')]=_0x24a008[_0x6fff('0x3e')][_0x6fff('0x50')]?_0x24a008[_0x6fff('0x3e')]:_0x572f95[_0x6fff('0x3d')];if(_0x193bc6[_0x6fff('0x3a')]['includeAll']){_0x24a008[_0x6fff('0x4a')]=[{'all':!![]}];}_0x24a008=_[_0x6fff('0x43')]({},_0x24a008,_0x193bc6[_0x6fff('0x47')]);return db[_0x6fff('0x36')]['find'](_0x24a008)[_0x6fff('0x1b')](handleEntityNotFound(_0x18ffec,null))[_0x6fff('0x1b')](respondWithResult(_0x18ffec,null))[_0x6fff('0x4d')](handleError(_0x18ffec,null));};exports[_0x6fff('0x51')]=function(_0x3a4b71,_0x5ef03b,_0x5b13ff){var _0x4df2c1;return db[_0x6fff('0x52')][_0x6fff('0x53')](function(_0x43d757){return db[_0x6fff('0x36')][_0x6fff('0x51')](_0x3a4b71[_0x6fff('0x54')],{'raw':!![]})[_0x6fff('0x1b')](function(_0x3e58f4){_0x4df2c1=_0x3e58f4;return db[_0x6fff('0x36')][_0x6fff('0x4b')]({'where':{'type':_0x3a4b71[_0x6fff('0x54')][_0x6fff('0x55')]},'raw':!![]});})['then'](function(_0x78bcb){if(_0x4df2c1[_0x6fff('0x55')][_0x6fff('0x56')]()==_0x6fff('0x57')){var _0x3e830f=fs['readFileSync'](path['join'](config[_0x6fff('0x58')],'server/files/templates/stun_multiple.ejs'),_0x6fff('0x59'));var _0x317a40=ejs[_0x6fff('0x5a')](_0x3e830f,{'networks':_0x78bcb||[]});fs[_0x6fff('0x5b')](_0x6fff('0x5c'),_0x317a40);return respondWithRpcPromise(_0x6fff('0x5d'),_0x6fff('0x51'),{'module':_0x6fff('0x5e')});}else if(_0x4df2c1[_0x6fff('0x55')][_0x6fff('0x56')]()==_0x6fff('0x5f')){var _0x5f0961=fs[_0x6fff('0x60')](path[_0x6fff('0x61')](config[_0x6fff('0x58')],'server/files/templates/turn_multiple.ejs'),_0x6fff('0x59'));var _0x17eb0a=ejs[_0x6fff('0x5a')](_0x5f0961,{'networks':_0x78bcb||[]});fs[_0x6fff('0x5b')]('/etc/asterisk/turn_xcally.conf',_0x17eb0a);return respondWithRpcPromise('Reload',_0x6fff('0x51'),{'module':_0x6fff('0x5e')});}else{var _0x490fe5=fs[_0x6fff('0x60')](path['join'](config[_0x6fff('0x58')],_0x6fff('0x62')),_0x6fff('0x59'));var _0x1bc19b=ejs[_0x6fff('0x5a')](_0x490fe5,{'networks':_0x78bcb||[]});fs[_0x6fff('0x5b')](util[_0x6fff('0x63')](_0x6fff('0x64'),_0x3a4b71[_0x6fff('0x54')][_0x6fff('0x55')][_0x6fff('0x65')]()),_0x1bc19b);return respondWithRpcPromise(_0x6fff('0x5d'),_0x6fff('0x51'),{'module':_0x6fff('0x66')});}return null;})[_0x6fff('0x1b')](function(){return _0x4df2c1;});})[_0x6fff('0x1b')](respondWithResult(_0x5ef03b,0xc9))['catch'](handleError(_0x5ef03b,null));};exports[_0x6fff('0x2f')]=function(_0x9811b2,_0x388b8f,_0x320e23){var _0x145576;return db['sequelize'][_0x6fff('0x53')](function(_0x42b870){return db['Network']['find']({'where':{'id':_0x9811b2[_0x6fff('0x67')]['id']}})['then'](handleEntityNotFound(_0x388b8f,null))[_0x6fff('0x1b')](saveUpdates(_0x9811b2['body'],null))[_0x6fff('0x1b')](function(_0x2c379b){if(_0x2c379b){_0x145576=_0x2c379b;return db['Network'][_0x6fff('0x4b')]({'where':{'type':_0x145576['type']},'raw':!![]});}return null;})[_0x6fff('0x1b')](function(_0x2d93ca){if(_0x145576['type'][_0x6fff('0x56')]()==_0x6fff('0x57')){var _0x36b32e=fs[_0x6fff('0x60')](path[_0x6fff('0x61')](config['root'],_0x6fff('0x68')),_0x6fff('0x59'));var _0x44ee0f=ejs['render'](_0x36b32e,{'networks':_0x2d93ca||[]});fs[_0x6fff('0x5b')](_0x6fff('0x5c'),_0x44ee0f);return respondWithRpcPromise(_0x6fff('0x5d'),_0x6fff('0x2f'),{'module':_0x6fff('0x5e')});}else if(_0x145576['type']['toUpperCase']()==_0x6fff('0x5f')){var _0x5578e0=fs[_0x6fff('0x60')](path['join'](config['root'],_0x6fff('0x69')),_0x6fff('0x59'));var _0x48d3c8=ejs['render'](_0x5578e0,{'networks':_0x2d93ca||[]});fs[_0x6fff('0x5b')](_0x6fff('0x6a'),_0x48d3c8);return respondWithRpcPromise(_0x6fff('0x5d'),_0x6fff('0x2f'),{'module':'res_stun_monitor.so'});}else{var _0x8b1546=fs['readFileSync'](path[_0x6fff('0x61')](config[_0x6fff('0x58')],'server/files/templates/network.ejs'),_0x6fff('0x59'));var _0x298b00=ejs[_0x6fff('0x5a')](_0x8b1546,{'networks':_0x2d93ca||[]});fs['writeFileSync'](util[_0x6fff('0x63')](_0x6fff('0x64'),_0x9811b2['body'][_0x6fff('0x55')][_0x6fff('0x65')]()),_0x298b00);return respondWithRpcPromise(_0x6fff('0x5d'),_0x6fff('0x2f'),{'module':_0x6fff('0x66')});}return null;})['then'](function(_0x4c7160){if(_0x4c7160){return _0x145576;}return null;});})[_0x6fff('0x1b')](respondWithResult(_0x388b8f,null))[_0x6fff('0x4d')](handleError(_0x388b8f,null));};exports[_0x6fff('0x30')]=function(_0x28afd3,_0x1fbe33,_0x155882){var _0x224714;return db[_0x6fff('0x36')]['find']({'where':{'id':_0x28afd3[_0x6fff('0x67')]['id']}})['then'](function(_0x45341e){_0x224714=_0x45341e;return _0x45341e;})[_0x6fff('0x1b')](handleEntityNotFound(_0x1fbe33,null))['then'](removeEntity(_0x1fbe33,null))[_0x6fff('0x1b')](function(){if(_0x224714){return db[_0x6fff('0x36')]['findAll']({'where':{'type':_0x224714['type']},'raw':!![]});}})[_0x6fff('0x1b')](function(_0xbacae9){if(_0x224714[_0x6fff('0x55')][_0x6fff('0x56')]()==_0x6fff('0x57')){var _0x50a906=fs[_0x6fff('0x60')](path[_0x6fff('0x61')](config[_0x6fff('0x58')],_0x6fff('0x68')),_0x6fff('0x59'));var _0x4f2854=ejs[_0x6fff('0x5a')](_0x50a906,{'networks':_0xbacae9||[]});fs[_0x6fff('0x5b')]('/etc/asterisk/stun_xcally.conf',_0x4f2854);return respondWithRpcPromise(_0x6fff('0x5d'),_0x6fff('0x30'),{'module':'res_stun_monitor.so'});}else if(_0x224714[_0x6fff('0x55')][_0x6fff('0x56')]()==_0x6fff('0x5f')){var _0x4fbbb5=fs[_0x6fff('0x60')](path['join'](config[_0x6fff('0x58')],_0x6fff('0x69')),_0x6fff('0x59'));var _0x2eff0c=ejs[_0x6fff('0x5a')](_0x4fbbb5,{'networks':_0xbacae9||[]});fs[_0x6fff('0x5b')](_0x6fff('0x6a'),_0x2eff0c);return respondWithRpcPromise('Reload',_0x6fff('0x30'),{'module':_0x6fff('0x5e')});}else{var _0x54b011=fs[_0x6fff('0x60')](path[_0x6fff('0x61')](config['root'],_0x6fff('0x62')),'utf8');var _0x51d438=ejs[_0x6fff('0x5a')](_0x54b011,{'networks':_0xbacae9||[]});fs[_0x6fff('0x5b')](util[_0x6fff('0x63')]('/etc/asterisk/sip_xcally_%s.conf',_0x28afd3[_0x6fff('0x54')][_0x6fff('0x55')]['toLowerCase']()),_0x51d438);return respondWithRpcPromise('Reload',_0x6fff('0x30'),{'module':_0x6fff('0x66')});}return null;})[_0x6fff('0x4d')](handleError(_0x1fbe33,null));}; \ No newline at end of file +var _0xc770=['body','update','transaction','toUpperCase','/etc/asterisk/sip_xcally_%s.conf','toLowerCase','chan_sip.so','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','jayson/promise','client','request','then','info','Network,\x20%s,\x20%s','Network,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','destroy','stack','name','send','index','map','Network','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','merge','VIRTUAL','options','includeAll','include','findAll','show','params','find','create','sequelize','STUN','readFileSync','join','root','server/files/templates/stun_multiple.ejs','utf8','writeFileSync','/etc/asterisk/stun_xcally.conf','Reload','res_stun_monitor.so','TURN','server/files/templates/turn_multiple.ejs','/etc/asterisk/turn_xcally.conf','server/files/templates/network.ejs','render','format'];(function(_0x15b4f9,_0x118471){var _0x567026=function(_0xb8ee8){while(--_0xb8ee8){_0x15b4f9['push'](_0x15b4f9['shift']());}};_0x567026(++_0x118471);}(_0xc770,0xd3));var _0x0c77=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc770[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x0c77('0x0'));var rimraf=require(_0x0c77('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0c77('0x2'));var moment=require(_0x0c77('0x3'));var BPromise=require(_0x0c77('0x4'));var Mustache=require(_0x0c77('0x5'));var util=require(_0x0c77('0x6'));var path=require(_0x0c77('0x7'));var sox=require(_0x0c77('0x8'));var csv=require(_0x0c77('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0c77('0xa'));var _=require(_0x0c77('0xb'));var squel=require('squel');var crypto=require(_0x0c77('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x0c77('0xd'));var toCsv=require(_0x0c77('0x9'));var querystring=require(_0x0c77('0xe'));var Papa=require('papaparse');var Redis=require(_0x0c77('0xf'));var authService=require(_0x0c77('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0c77('0x11'));var logger=require('../../config/logger')(_0x0c77('0x12'));var utils=require(_0x0c77('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x0c77('0x14'));var db=require(_0x0c77('0x15'))['db'];var jayson=require(_0x0c77('0x16'));var client=jayson[_0x0c77('0x17')]['http']({'port':0x232a});function respondWithRpcPromise(_0x52eec1,_0x525e76,_0x466ac8,_0x8f7538){return new BPromise(function(_0x11a7ad,_0x29b1d0){var _0x4f38ec=_0x8f7538||client;return _0x4f38ec[_0x0c77('0x18')](_0x52eec1,_0x466ac8)[_0x0c77('0x19')](function(_0x4f7b5c){logger[_0x0c77('0x1a')](_0x0c77('0x1b'),_0x525e76,'request\x20sent');logger['debug'](_0x0c77('0x1c'),_0x525e76,_0x0c77('0x1d'),JSON['stringify'](_0x4f7b5c));if(_0x4f7b5c['error']){if(_0x4f7b5c[_0x0c77('0x1e')][_0x0c77('0x1f')]===0x1f4){logger[_0x0c77('0x1e')](_0x0c77('0x1b'),_0x525e76,_0x4f7b5c['error'][_0x0c77('0x20')]);return _0x29b1d0(_0x4f7b5c[_0x0c77('0x1e')][_0x0c77('0x20')]);}logger['error'](_0x0c77('0x1b'),_0x525e76,_0x4f7b5c[_0x0c77('0x1e')]['message']);return _0x11a7ad(_0x4f7b5c['error']['message']);}else{logger[_0x0c77('0x1a')](_0x0c77('0x1b'),_0x525e76,_0x0c77('0x1d'));_0x11a7ad(_0x4f7b5c[_0x0c77('0x21')][_0x0c77('0x20')]);}})[_0x0c77('0x22')](function(_0x30b77c){logger['error'](_0x0c77('0x1b'),_0x525e76,_0x30b77c);_0x29b1d0(_0x30b77c);});});}function respondWithStatusCode(_0x51097c,_0x2efe50){_0x2efe50=_0x2efe50||0xcc;return function(_0x5a6ae4){if(_0x5a6ae4){return _0x51097c[_0x0c77('0x23')](_0x2efe50);}return _0x51097c[_0x0c77('0x24')](_0x2efe50)[_0x0c77('0x25')]();};}function respondWithResult(_0x2802d1,_0x10768c){_0x10768c=_0x10768c||0xc8;return function(_0x4e787a){if(_0x4e787a){return _0x2802d1[_0x0c77('0x24')](_0x10768c)[_0x0c77('0x26')](_0x4e787a);}};}function respondWithFilteredResult(_0xec97c,_0x3c9b87){return function(_0x334353){if(_0x334353){var _0x4495cc=typeof _0x3c9b87[_0x0c77('0x27')]===_0x0c77('0x28')&&typeof _0x3c9b87[_0x0c77('0x29')]==='undefined';var _0x4b0edf=_0x334353[_0x0c77('0x2a')];var _0x549c06=_0x4495cc?0x0:_0x3c9b87[_0x0c77('0x27')];var _0xe4bf97=_0x4495cc?_0x334353[_0x0c77('0x2a')]:_0x3c9b87[_0x0c77('0x27')]+_0x3c9b87['limit'];var _0x33b6d0;if(_0xe4bf97>=_0x4b0edf){_0xe4bf97=_0x4b0edf;_0x33b6d0=0xc8;}else{_0x33b6d0=0xce;}_0xec97c['status'](_0x33b6d0);return _0xec97c[_0x0c77('0x2b')]('Content-Range',_0x549c06+'-'+_0xe4bf97+'/'+_0x4b0edf)['json'](_0x334353);}return null;};}function patchUpdates(_0x4029bb){return function(_0x184f73){try{jsonpatch[_0x0c77('0x2c')](_0x184f73,_0x4029bb,!![]);}catch(_0x2d55d4){return BPromise[_0x0c77('0x2d')](_0x2d55d4);}return _0x184f73['save']();};}function saveUpdates(_0x53a034,_0x57295e){return function(_0x3b2c86){if(_0x3b2c86){return _0x3b2c86['update'](_0x53a034)[_0x0c77('0x19')](function(_0x27e658){return _0x27e658;});}return null;};}function removeEntity(_0x3f6319,_0x4e3b52){return function(_0x362b01){if(_0x362b01){return _0x362b01[_0x0c77('0x2e')]()[_0x0c77('0x19')](function(){_0x3f6319['status'](0xcc)[_0x0c77('0x25')]();});}};}function handleEntityNotFound(_0x4e1b6c,_0x58e5be){return function(_0x57bc73){if(!_0x57bc73){_0x4e1b6c[_0x0c77('0x23')](0x194);}return _0x57bc73;};}function handleError(_0x190226,_0x4cc088){_0x4cc088=_0x4cc088||0x1f4;return function(_0x577866){logger['error'](_0x577866[_0x0c77('0x2f')]);if(_0x577866['name']){delete _0x577866[_0x0c77('0x30')];}_0x190226[_0x0c77('0x24')](_0x4cc088)[_0x0c77('0x31')](_0x577866);};}exports[_0x0c77('0x32')]=function(_0x8b5bf0,_0x4ad9d5){var _0x14b501={},_0x3a13e8={},_0x501455={'count':0x0,'rows':[]};var _0x1fec4c=_[_0x0c77('0x33')](db[_0x0c77('0x34')][_0x0c77('0x35')],function(_0x407a21){return{'name':_0x407a21['fieldName'],'type':_0x407a21[_0x0c77('0x36')][_0x0c77('0x37')]};});_0x3a13e8[_0x0c77('0x38')]=_[_0x0c77('0x33')](_0x1fec4c,_0x0c77('0x30'));_0x3a13e8[_0x0c77('0x39')]=_[_0x0c77('0x3a')](_0x8b5bf0['query']);_0x3a13e8[_0x0c77('0x3b')]=_[_0x0c77('0x3c')](_0x3a13e8[_0x0c77('0x38')],_0x3a13e8[_0x0c77('0x39')]);_0x14b501[_0x0c77('0x3d')]=_['intersection'](_0x3a13e8[_0x0c77('0x38')],qs[_0x0c77('0x3e')](_0x8b5bf0[_0x0c77('0x39')]['fields']));_0x14b501[_0x0c77('0x3d')]=_0x14b501['attributes'][_0x0c77('0x3f')]?_0x14b501[_0x0c77('0x3d')]:_0x3a13e8['model'];if(!_0x8b5bf0['query'][_0x0c77('0x40')]('nolimit')){_0x14b501[_0x0c77('0x29')]=qs[_0x0c77('0x29')](_0x8b5bf0[_0x0c77('0x39')]['limit']);_0x14b501[_0x0c77('0x27')]=qs['offset'](_0x8b5bf0[_0x0c77('0x39')][_0x0c77('0x27')]);}_0x14b501['order']=qs[_0x0c77('0x41')](_0x8b5bf0[_0x0c77('0x39')][_0x0c77('0x41')]);_0x14b501[_0x0c77('0x42')]=qs[_0x0c77('0x3b')](_[_0x0c77('0x43')](_0x8b5bf0[_0x0c77('0x39')],_0x3a13e8[_0x0c77('0x3b')]),_0x1fec4c);if(_0x8b5bf0[_0x0c77('0x39')]['filter']){_0x14b501['where']=_[_0x0c77('0x44')](_0x14b501[_0x0c77('0x42')],{'$or':_[_0x0c77('0x33')](_0x1fec4c,function(_0x556ab4){if(_0x556ab4[_0x0c77('0x36')]!==_0x0c77('0x45')){var _0xb08baa={};_0xb08baa[_0x556ab4[_0x0c77('0x30')]]={'$like':'%'+_0x8b5bf0[_0x0c77('0x39')]['filter']+'%'};return _0xb08baa;}})});}_0x14b501=_['merge']({},_0x14b501,_0x8b5bf0[_0x0c77('0x46')]);var _0x12db07={'where':_0x14b501[_0x0c77('0x42')]};return db[_0x0c77('0x34')][_0x0c77('0x2a')](_0x12db07)[_0x0c77('0x19')](function(_0x2de6c1){_0x501455[_0x0c77('0x2a')]=_0x2de6c1;if(_0x8b5bf0[_0x0c77('0x39')][_0x0c77('0x47')]){_0x14b501[_0x0c77('0x48')]=[{'all':!![]}];}return db[_0x0c77('0x34')][_0x0c77('0x49')](_0x14b501);})[_0x0c77('0x19')](function(_0x3ac417){_0x501455['rows']=_0x3ac417;return _0x501455;})[_0x0c77('0x19')](respondWithFilteredResult(_0x4ad9d5,_0x14b501))[_0x0c77('0x22')](handleError(_0x4ad9d5,null));};exports[_0x0c77('0x4a')]=function(_0xa9d2b0,_0xd43381){var _0x36e361={'raw':!![],'where':{'id':_0xa9d2b0[_0x0c77('0x4b')]['id']}},_0x4c1c8f={};_0x4c1c8f[_0x0c77('0x38')]=_[_0x0c77('0x3a')](db['Network'][_0x0c77('0x35')]);_0x4c1c8f[_0x0c77('0x39')]=_[_0x0c77('0x3a')](_0xa9d2b0[_0x0c77('0x39')]);_0x4c1c8f['filters']=_[_0x0c77('0x3c')](_0x4c1c8f[_0x0c77('0x38')],_0x4c1c8f['query']);_0x36e361[_0x0c77('0x3d')]=_[_0x0c77('0x3c')](_0x4c1c8f[_0x0c77('0x38')],qs[_0x0c77('0x3e')](_0xa9d2b0[_0x0c77('0x39')]['fields']));_0x36e361[_0x0c77('0x3d')]=_0x36e361[_0x0c77('0x3d')]['length']?_0x36e361[_0x0c77('0x3d')]:_0x4c1c8f['model'];if(_0xa9d2b0[_0x0c77('0x39')]['includeAll']){_0x36e361['include']=[{'all':!![]}];}_0x36e361=_[_0x0c77('0x44')]({},_0x36e361,_0xa9d2b0['options']);return db[_0x0c77('0x34')][_0x0c77('0x4c')](_0x36e361)[_0x0c77('0x19')](handleEntityNotFound(_0xd43381,null))[_0x0c77('0x19')](respondWithResult(_0xd43381,null))['catch'](handleError(_0xd43381,null));};exports[_0x0c77('0x4d')]=function(_0x1d3e81,_0x3da0cd,_0x26ddea){var _0xbb11c1;return db[_0x0c77('0x4e')]['transaction'](function(_0x22f3dd){return db[_0x0c77('0x34')][_0x0c77('0x4d')](_0x1d3e81['body'],{'raw':!![]})[_0x0c77('0x19')](function(_0x45f78c){_0xbb11c1=_0x45f78c;return db[_0x0c77('0x34')][_0x0c77('0x49')]({'where':{'type':_0x1d3e81['body'][_0x0c77('0x36')]},'raw':!![]});})[_0x0c77('0x19')](function(_0x381cde){if(_0xbb11c1[_0x0c77('0x36')]['toUpperCase']()==_0x0c77('0x4f')){var _0x11484f=fs[_0x0c77('0x50')](path[_0x0c77('0x51')](config[_0x0c77('0x52')],_0x0c77('0x53')),_0x0c77('0x54'));var _0x12de46=ejs['render'](_0x11484f,{'networks':_0x381cde||[]});fs[_0x0c77('0x55')](_0x0c77('0x56'),_0x12de46);return respondWithRpcPromise(_0x0c77('0x57'),_0x0c77('0x4d'),{'module':_0x0c77('0x58')});}else if(_0xbb11c1[_0x0c77('0x36')]['toUpperCase']()==_0x0c77('0x59')){var _0x167282=fs[_0x0c77('0x50')](path['join'](config[_0x0c77('0x52')],_0x0c77('0x5a')),_0x0c77('0x54'));var _0x1852d7=ejs['render'](_0x167282,{'networks':_0x381cde||[]});fs[_0x0c77('0x55')](_0x0c77('0x5b'),_0x1852d7);return respondWithRpcPromise(_0x0c77('0x57'),'create',{'module':'res_stun_monitor.so'});}else{var _0xef431f=fs[_0x0c77('0x50')](path['join'](config[_0x0c77('0x52')],_0x0c77('0x5c')),_0x0c77('0x54'));var _0x1ec8c7=ejs[_0x0c77('0x5d')](_0xef431f,{'networks':_0x381cde||[]});fs[_0x0c77('0x55')](util[_0x0c77('0x5e')]('/etc/asterisk/sip_xcally_%s.conf',_0x1d3e81[_0x0c77('0x5f')][_0x0c77('0x36')]['toLowerCase']()),_0x1ec8c7);return respondWithRpcPromise(_0x0c77('0x57'),_0x0c77('0x4d'),{'module':'chan_sip.so'});}return null;})[_0x0c77('0x19')](function(){return _0xbb11c1;});})['then'](respondWithResult(_0x3da0cd,0xc9))[_0x0c77('0x22')](handleError(_0x3da0cd,null));};exports[_0x0c77('0x60')]=function(_0x26483e,_0xa1cae8,_0x5363ff){var _0x1975d1;return db[_0x0c77('0x4e')][_0x0c77('0x61')](function(_0x1fdbcf){return db[_0x0c77('0x34')]['find']({'where':{'id':_0x26483e[_0x0c77('0x4b')]['id']}})[_0x0c77('0x19')](handleEntityNotFound(_0xa1cae8,null))[_0x0c77('0x19')](saveUpdates(_0x26483e['body'],null))[_0x0c77('0x19')](function(_0x2883cd){if(_0x2883cd){_0x1975d1=_0x2883cd;return db[_0x0c77('0x34')][_0x0c77('0x49')]({'where':{'type':_0x1975d1[_0x0c77('0x36')]},'raw':!![]});}return null;})[_0x0c77('0x19')](function(_0x3be819){if(_0x1975d1['type'][_0x0c77('0x62')]()==_0x0c77('0x4f')){var _0x1272cb=fs[_0x0c77('0x50')](path[_0x0c77('0x51')](config[_0x0c77('0x52')],_0x0c77('0x53')),_0x0c77('0x54'));var _0x5d00e1=ejs[_0x0c77('0x5d')](_0x1272cb,{'networks':_0x3be819||[]});fs[_0x0c77('0x55')]('/etc/asterisk/stun_xcally.conf',_0x5d00e1);return respondWithRpcPromise(_0x0c77('0x57'),_0x0c77('0x60'),{'module':_0x0c77('0x58')});}else if(_0x1975d1['type'][_0x0c77('0x62')]()==_0x0c77('0x59')){var _0x22f3a9=fs[_0x0c77('0x50')](path[_0x0c77('0x51')](config[_0x0c77('0x52')],_0x0c77('0x5a')),_0x0c77('0x54'));var _0x1adcbc=ejs[_0x0c77('0x5d')](_0x22f3a9,{'networks':_0x3be819||[]});fs[_0x0c77('0x55')]('/etc/asterisk/turn_xcally.conf',_0x1adcbc);return respondWithRpcPromise(_0x0c77('0x57'),'update',{'module':_0x0c77('0x58')});}else{var _0x58dce3=fs['readFileSync'](path['join'](config['root'],'server/files/templates/network.ejs'),_0x0c77('0x54'));var _0x520694=ejs[_0x0c77('0x5d')](_0x58dce3,{'networks':_0x3be819||[]});fs[_0x0c77('0x55')](util[_0x0c77('0x5e')](_0x0c77('0x63'),_0x26483e[_0x0c77('0x5f')][_0x0c77('0x36')][_0x0c77('0x64')]()),_0x520694);return respondWithRpcPromise('Reload',_0x0c77('0x60'),{'module':_0x0c77('0x65')});}return null;})[_0x0c77('0x19')](function(_0x3cbde3){if(_0x3cbde3){return _0x1975d1;}return null;});})[_0x0c77('0x19')](respondWithResult(_0xa1cae8,null))[_0x0c77('0x22')](handleError(_0xa1cae8,null));};exports[_0x0c77('0x2e')]=function(_0x3c7a1a,_0x32122c,_0x3cfa94){var _0x1e6b1e;return db[_0x0c77('0x34')]['find']({'where':{'id':_0x3c7a1a[_0x0c77('0x4b')]['id']}})['then'](function(_0x1f5f1b){_0x1e6b1e=_0x1f5f1b;return _0x1f5f1b;})[_0x0c77('0x19')](handleEntityNotFound(_0x32122c,null))[_0x0c77('0x19')](removeEntity(_0x32122c,null))[_0x0c77('0x19')](function(){if(_0x1e6b1e){return db[_0x0c77('0x34')][_0x0c77('0x49')]({'where':{'type':_0x1e6b1e[_0x0c77('0x36')]},'raw':!![]});}})[_0x0c77('0x19')](function(_0x371c05){if(_0x1e6b1e[_0x0c77('0x36')][_0x0c77('0x62')]()==_0x0c77('0x4f')){var _0x29999e=fs['readFileSync'](path[_0x0c77('0x51')](config[_0x0c77('0x52')],'server/files/templates/stun_multiple.ejs'),_0x0c77('0x54'));var _0xe5f350=ejs[_0x0c77('0x5d')](_0x29999e,{'networks':_0x371c05||[]});fs[_0x0c77('0x55')](_0x0c77('0x56'),_0xe5f350);return respondWithRpcPromise('Reload',_0x0c77('0x2e'),{'module':_0x0c77('0x58')});}else if(_0x1e6b1e[_0x0c77('0x36')][_0x0c77('0x62')]()=='TURN'){var _0x3f70bd=fs[_0x0c77('0x50')](path[_0x0c77('0x51')](config[_0x0c77('0x52')],_0x0c77('0x5a')),_0x0c77('0x54'));var _0x30644c=ejs[_0x0c77('0x5d')](_0x3f70bd,{'networks':_0x371c05||[]});fs[_0x0c77('0x55')](_0x0c77('0x5b'),_0x30644c);return respondWithRpcPromise(_0x0c77('0x57'),_0x0c77('0x2e'),{'module':_0x0c77('0x58')});}else{var _0x428830=fs['readFileSync'](path[_0x0c77('0x51')](config[_0x0c77('0x52')],_0x0c77('0x5c')),_0x0c77('0x54'));var _0x33a100=ejs[_0x0c77('0x5d')](_0x428830,{'networks':_0x371c05||[]});fs['writeFileSync'](util['format']('/etc/asterisk/sip_xcally_%s.conf',_0x3c7a1a[_0x0c77('0x5f')]['type'][_0x0c77('0x64')]()),_0x33a100);return respondWithRpcPromise(_0x0c77('0x57'),_0x0c77('0x2e'),{'module':_0x0c77('0x65')});}return null;})['catch'](handleError(_0x32122c,null));}; \ No newline at end of file diff --git a/server/api/network/network.model.js b/server/api/network/network.model.js index b8a1aa1..8282dda 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 _0xa902=['../../config/logger','api','moment','request-promise','../../config/environment','./network.attributes','exports','define','network','lodash','util'];(function(_0x36ed48,_0x1ee0d4){var _0x51c63a=function(_0x2d0a40){while(--_0x2d0a40){_0x36ed48['push'](_0x36ed48['shift']());}};_0x51c63a(++_0x1ee0d4);}(_0xa902,0x8d));var _0x2a90=function(_0x493f77,_0x570eba){_0x493f77=_0x493f77-0x0;var _0x5e7f1d=_0xa902[_0x493f77];return _0x5e7f1d;};'use strict';var _=require(_0x2a90('0x0'));var util=require(_0x2a90('0x1'));var logger=require(_0x2a90('0x2'))(_0x2a90('0x3'));var moment=require(_0x2a90('0x4'));var BPromise=require('bluebird');var rp=require(_0x2a90('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x2a90('0x6'));var attributes=require(_0x2a90('0x7'));module[_0x2a90('0x8')]=function(_0x21e1d2,_0x4a32c7){return _0x21e1d2[_0x2a90('0x9')]('Network',attributes,{'tableName':_0x2a90('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb9a7=['exports','define','Network','network','util','bluebird','path','rimraf','../../config/environment','./network.attributes'];(function(_0x218d57,_0x2a2f1f){var _0x241e9b=function(_0x24dc14){while(--_0x24dc14){_0x218d57['push'](_0x218d57['shift']());}};_0x241e9b(++_0x2a2f1f);}(_0xb9a7,0x112));var _0x7b9a=function(_0x88cd7b,_0x4c884c){_0x88cd7b=_0x88cd7b-0x0;var _0x56fcc8=_0xb9a7[_0x88cd7b];return _0x56fcc8;};'use strict';var _=require('lodash');var util=require(_0x7b9a('0x0'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x7b9a('0x1'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7b9a('0x2'));var rimraf=require(_0x7b9a('0x3'));var config=require(_0x7b9a('0x4'));var attributes=require(_0x7b9a('0x5'));module[_0x7b9a('0x6')]=function(_0xf6dae2,_0x22764f){return _0xf6dae2[_0x7b9a('0x7')](_0x7b9a('0x8'),attributes,{'tableName':_0x7b9a('0x9'),'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 6b01f17..f09ecaa 100644 --- a/server/api/network/network.rpc.js +++ b/server/api/network/network.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['info','Network,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x7a54,0x106));var _0x47a5=function(_0x4dfb9f,_0x1c1372){_0x4dfb9f=_0x4dfb9f-0x0;var _0x526733=_0x7a54[_0x4dfb9f];return _0x526733;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('Network,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});} \ No newline at end of file +var _0x9957=['message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','Network,\x20%s,\x20%s','request\x20sent','debug','Network,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x139276,_0xfcdf80){var _0x18ba65=function(_0x449092){while(--_0x449092){_0x139276['push'](_0x139276['shift']());}};_0x18ba65(++_0xfcdf80);}(_0x9957,0x93));var _0x7995=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x9957[_0x5ddb1c];return _0x354adc;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var moment=require(_0x7995('0x2'));var BPromise=require(_0x7995('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7995('0x4'));var db=require(_0x7995('0x5'))['db'];var utils=require(_0x7995('0x6'));var logger=require(_0x7995('0x7'))('rpc');var config=require(_0x7995('0x8'));var jayson=require(_0x7995('0x9'));var client=jayson[_0x7995('0xa')][_0x7995('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xbda126,_0x326741,_0x4996ca){return new BPromise(function(_0x465276,_0x1cad37){return client['request'](_0xbda126,_0x4996ca)[_0x7995('0xc')](function(_0x3116fb){logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));logger[_0x7995('0x10')](_0x7995('0x11'),_0x326741,'request\x20sent',JSON[_0x7995('0x12')](_0x3116fb));if(_0x3116fb[_0x7995('0x13')]){if(_0x3116fb['error'][_0x7995('0x14')]===0x1f4){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x1cad37(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}logger['error']('Network,\x20%s,\x20%s',_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x465276(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}else{logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));_0x465276(_0x3116fb[_0x7995('0x16')]['message']);}})[_0x7995('0x17')](function(_0x565d97){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x565d97);_0x1cad37(_0x565d97);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/index.js b/server/api/openchannelAccount/index.js index 0540522..514b2d1 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 _0x4122=['addApplications','addAgents','send','put','/:id','update','delete','destroy','removeDispositions','removeAnswers','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/applications','/:id/interactions','/:id/users','getAgents','post','addDisposition','/:id/notify','notify'];(function(_0x3d4c49,_0x3bb9d5){var _0x3deaba=function(_0xd6804f){while(--_0xd6804f){_0x3d4c49['push'](_0x3d4c49['shift']());}};_0x3deaba(++_0x3bb9d5);}(_0x4122,0x168));var _0x2412=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x4122[_0x59ee6f];return _0x4c0979;};'use strict';var multer=require(_0x2412('0x0'));var util=require(_0x2412('0x1'));var path=require('path');var timeout=require(_0x2412('0x2'));var express=require(_0x2412('0x3'));var router=express[_0x2412('0x4')]();var fs_extra=require(_0x2412('0x5'));var auth=require(_0x2412('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x2412('0x7'));var controller=require('./openchannelAccount.controller');router[_0x2412('0x8')]('/',auth[_0x2412('0x9')](),controller[_0x2412('0xa')]);router[_0x2412('0x8')](_0x2412('0xb'),auth[_0x2412('0x9')](),controller[_0x2412('0xc')]);router[_0x2412('0x8')]('/:id',auth[_0x2412('0x9')](),controller['show']);router[_0x2412('0x8')](_0x2412('0xd'),auth['isAuthenticated'](),controller[_0x2412('0xe')]);router[_0x2412('0x8')](_0x2412('0xf'),auth[_0x2412('0x9')](),controller[_0x2412('0x10')]);router['get'](_0x2412('0x11'),auth[_0x2412('0x9')](),controller['getApplications']);router['get'](_0x2412('0x12'),auth[_0x2412('0x9')](),controller['getInteractions']);router['get'](_0x2412('0x13'),auth['isAuthenticated'](),controller[_0x2412('0x14')]);router[_0x2412('0x15')]('/',auth[_0x2412('0x9')](),controller['create']);router[_0x2412('0x15')](_0x2412('0xd'),auth[_0x2412('0x9')](),controller[_0x2412('0x16')]);router[_0x2412('0x15')]('/:id/canned_answers',auth[_0x2412('0x9')](),controller['addAnswer']);router[_0x2412('0x15')](_0x2412('0x17'),controller[_0x2412('0x18')]);router[_0x2412('0x15')]('/:id/applications',auth[_0x2412('0x9')](),controller[_0x2412('0x19')]);router[_0x2412('0x15')](_0x2412('0x13'),auth[_0x2412('0x9')](),controller[_0x2412('0x1a')]);router[_0x2412('0x15')]('/:id/send',auth[_0x2412('0x9')](),controller[_0x2412('0x1b')]);router[_0x2412('0x1c')](_0x2412('0x1d'),auth[_0x2412('0x9')](),controller[_0x2412('0x1e')]);router[_0x2412('0x1f')]('/:id',auth[_0x2412('0x9')](),controller[_0x2412('0x20')]);router[_0x2412('0x1f')](_0x2412('0xd'),auth[_0x2412('0x9')](),controller[_0x2412('0x21')]);router['delete'](_0x2412('0xf'),auth[_0x2412('0x9')](),controller[_0x2412('0x22')]);router[_0x2412('0x1f')](_0x2412('0x13'),auth[_0x2412('0x9')](),controller['removeAgents']);module['exports']=router; \ No newline at end of file +var _0x398b=['delete','removeAnswers','removeAgents','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','./openchannelAccount.controller','get','isAuthenticated','index','/describe','/:id','getDispositions','/:id/canned_answers','getAnswers','/:id/applications','/:id/interactions','getInteractions','/:id/users','post','create','/:id/dispositions','addDisposition','addAnswer','/:id/notify','addApplications','put','destroy'];(function(_0x135ee2,_0xe82bbe){var _0x3f3cff=function(_0x2e8812){while(--_0x2e8812){_0x135ee2['push'](_0x135ee2['shift']());}};_0x3f3cff(++_0xe82bbe);}(_0x398b,0x88));var _0xb398=function(_0xbfbef0,_0x218b21){_0xbfbef0=_0xbfbef0-0x0;var _0x3fdf6f=_0x398b[_0xbfbef0];return _0x3fdf6f;};'use strict';var multer=require(_0xb398('0x0'));var util=require(_0xb398('0x1'));var path=require(_0xb398('0x2'));var timeout=require('connect-timeout');var express=require(_0xb398('0x3'));var router=express[_0xb398('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xb398('0x5'));var interaction=require(_0xb398('0x6'));var config=require('../../config/environment');var controller=require(_0xb398('0x7'));router[_0xb398('0x8')]('/',auth[_0xb398('0x9')](),controller[_0xb398('0xa')]);router['get'](_0xb398('0xb'),auth[_0xb398('0x9')](),controller['describe']);router['get'](_0xb398('0xc'),auth['isAuthenticated'](),controller['show']);router[_0xb398('0x8')]('/:id/dispositions',auth['isAuthenticated'](),controller[_0xb398('0xd')]);router[_0xb398('0x8')](_0xb398('0xe'),auth[_0xb398('0x9')](),controller[_0xb398('0xf')]);router[_0xb398('0x8')](_0xb398('0x10'),auth[_0xb398('0x9')](),controller['getApplications']);router[_0xb398('0x8')](_0xb398('0x11'),auth['isAuthenticated'](),controller[_0xb398('0x12')]);router[_0xb398('0x8')](_0xb398('0x13'),auth[_0xb398('0x9')](),controller['getAgents']);router[_0xb398('0x14')]('/',auth[_0xb398('0x9')](),controller[_0xb398('0x15')]);router[_0xb398('0x14')](_0xb398('0x16'),auth[_0xb398('0x9')](),controller[_0xb398('0x17')]);router[_0xb398('0x14')]('/:id/canned_answers',auth[_0xb398('0x9')](),controller[_0xb398('0x18')]);router[_0xb398('0x14')](_0xb398('0x19'),controller['notify']);router['post']('/:id/applications',auth[_0xb398('0x9')](),controller[_0xb398('0x1a')]);router[_0xb398('0x14')](_0xb398('0x13'),auth[_0xb398('0x9')](),controller['addAgents']);router[_0xb398('0x14')]('/:id/send',auth['isAuthenticated'](),controller['send']);router[_0xb398('0x1b')]('/:id',auth[_0xb398('0x9')](),controller['update']);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xb398('0x1c')]);router[_0xb398('0x1d')](_0xb398('0x16'),auth['isAuthenticated'](),controller['removeDispositions']);router[_0xb398('0x1d')](_0xb398('0xe'),auth[_0xb398('0x9')](),controller[_0xb398('0x1e')]);router['delete'](_0xb398('0x13'),auth['isAuthenticated'](),controller[_0xb398('0x1f')]);module[_0xb398('0x20')]=router; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.attributes.js b/server/api/openchannelAccount/openchannelAccount.attributes.js index 16bbd7f..0f8cd5c 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 _0x29de=['BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDisposition','sequelize','randomstring','exports','STRING','name','generate','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x29de,0xbc));var _0xe29d=function(_0xc9771c,_0x464a0a){_0xc9771c=_0xc9771c-0x0;var _0x5666a3=_0x29de[_0xc9771c];return _0x5666a3;};'use strict';var Sequelize=require(_0xe29d('0x0'));var rs=require(_0xe29d('0x1'));module[_0xe29d('0x2')]={'name':{'type':Sequelize[_0xe29d('0x3')],'unique':_0xe29d('0x4'),'allowNull':![]},'description':{'type':Sequelize[_0xe29d('0x3')]},'token':{'type':Sequelize[_0xe29d('0x3')],'defaultValue':function(){return rs[_0xe29d('0x5')]();}},'replyUri':{'type':Sequelize[_0xe29d('0x3')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize['STRING'],'allowNull':![]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0xe29d('0x6');}},'notificationSound':{'type':Sequelize[_0xe29d('0x7')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xe29d('0x7')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xe29d('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize['STRING']},'queueTransfer':{'type':Sequelize[_0xe29d('0x7')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xe29d('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xe29d('0x7')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xe29d('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':_0xe29d('0x9')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0xe29d('0xa'),'set':function(_0x3f16b6){if(!_0x3f16b6)this[_0xe29d('0xb')]('mandatoryDispositionPauseId',null);this[_0xe29d('0xb')](_0xe29d('0xc'),_0x3f16b6);}}}; \ No newline at end of file +var _0x9bda=['Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports','STRING','name','generate'];(function(_0x49ca18,_0x5e6d05){var _0x145d54=function(_0x30b9be){while(--_0x30b9be){_0x49ca18['push'](_0x49ca18['shift']());}};_0x145d54(++_0x5e6d05);}(_0x9bda,0x133));var _0xa9bd=function(_0x147497,_0x43e433){_0x147497=_0x147497-0x0;var _0x35f45=_0x9bda[_0x147497];return _0x35f45;};'use strict';var Sequelize=require(_0xa9bd('0x0'));var rs=require('randomstring');module[_0xa9bd('0x1')]={'name':{'type':Sequelize[_0xa9bd('0x2')],'unique':_0xa9bd('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0xa9bd('0x2')]},'token':{'type':Sequelize[_0xa9bd('0x2')],'defaultValue':function(){return rs[_0xa9bd('0x4')]();}},'replyUri':{'type':Sequelize[_0xa9bd('0x2')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize['STRING'],'allowNull':![]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0xa9bd('0x5');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xa9bd('0x6')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xa9bd('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0xa9bd('0x2')]},'queueTransfer':{'type':Sequelize[_0xa9bd('0x6')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xa9bd('0x6')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xa9bd('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xa9bd('0x7')],'allowNull':!![],'defaultValue':null,'comment':_0xa9bd('0x8')},'mandatoryDisposition':{'type':Sequelize[_0xa9bd('0x6')],'defaultValue':![],'comment':_0xa9bd('0x9'),'set':function(_0xaa35fe){if(!_0xaa35fe)this[_0xa9bd('0xa')](_0xa9bd('0xb'),null);this[_0xa9bd('0xa')](_0xa9bd('0xc'),_0xaa35fe);}}}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.controller.js b/server/api/openchannelAccount/openchannelAccount.controller.js index d3c8305..c454d22 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 _0x860a=['messageId','created','autoclose','close','unmanaged','OpenchannelMessage','AttachmentId','interaction','UserId','User','unshift','agent','waitForTheAssignedAgent','forcedOwnership','Start','startRouting','EventManager','addApplications','sequelize','Transaction','bulkCreate','priority','finally','getApplications','getInteractions','nolimit','Contact','Owner','fullname','internal','Tag','color','tag','addAgents','omit','emit','userOpenchannelAccount:save','removeAgents','isArray','userOpenchannelAccount:remove','getAgents','out','Messages','dataValues','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','socket.io-emitter','./openchannelAccount.socket','jayson/promise','client','http','request','then','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','OpenchannelAccount,\x20%s,\x20%s','message','result','catch','sendStatus','end','status','offset','undefined','limit','count','Content-Range','json','reject','save','update','get','OpenchannelAccounts','UserProfileResource','destroy','name','send','Pause','mandatoryDispositionPause','map','OpenchannelAccount','rawAttributes','fieldName','type','key','query','keys','intersection','model','attributes','fields','hasOwnProperty','order','sort','filters','pick','filter','where','merge','VIRTUAL','options','includeAll','findAll','rows','show','params','include','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','addDisposition','OpenchannelAccountId','Disposition','getDispositions','findOne','length','ids','addAnswer','CannedAnswer','notify','openchannel','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','ListId','from','body\x20is\x20mandatory\x20and\x20not\x20empty','isNil','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','CmList','List','Contacts','DESC','OpenchannelApplication','Applications','account','applications','list','orderBy','defaults','contact','lastName','threadId','externalUrl','OpenchannelInteraction','ContactId','spread','firstName'];(function(_0x5bfee6,_0x3e9443){var _0x4aad05=function(_0x5ab2da){while(--_0x5ab2da){_0x5bfee6['push'](_0x5bfee6['shift']());}};_0x4aad05(++_0x3e9443);}(_0x860a,0x1ac));var _0xa860=function(_0x14684a,_0x44fe18){_0x14684a=_0x14684a-0x0;var _0x1f0c8e=_0x860a[_0x14684a];return _0x1f0c8e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa860('0x0'));var zipdir=require(_0xa860('0x1'));var jsonpatch=require(_0xa860('0x2'));var rp=require(_0xa860('0x3'));var moment=require(_0xa860('0x4'));var BPromise=require(_0xa860('0x5'));var Mustache=require(_0xa860('0x6'));var util=require(_0xa860('0x7'));var path=require(_0xa860('0x8'));var sox=require(_0xa860('0x9'));var csv=require(_0xa860('0xa'));var ejs=require(_0xa860('0xb'));var fs=require('fs');var fs_extra=require(_0xa860('0xc'));var _=require(_0xa860('0xd'));var squel=require('squel');var crypto=require(_0xa860('0xe'));var jsforce=require(_0xa860('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xa860('0xa'));var querystring=require(_0xa860('0x10'));var Papa=require('papaparse');var Redis=require(_0xa860('0x11'));var authService=require(_0xa860('0x12'));var qs=require(_0xa860('0x13'));var as=require(_0xa860('0x14'));var hardwareService=require(_0xa860('0x15'));var logger=require(_0xa860('0x16'))(_0xa860('0x17'));var utils=require(_0xa860('0x18'));var config=require(_0xa860('0x19'));var licenseUtil=require(_0xa860('0x1a'));var db=require(_0xa860('0x1b'))['db'];config[_0xa860('0x1c')]=_['defaults'](config[_0xa860('0x1c')],{'host':'localhost','port':0x18eb});var socket=require(_0xa860('0x1d'))(new Redis(config[_0xa860('0x1c')]));require(_0xa860('0x1e'))['register'](socket);var jayson=require(_0xa860('0x1f'));var client=jayson[_0xa860('0x20')][_0xa860('0x21')]({'port':0x232c});var client9002=jayson[_0xa860('0x20')][_0xa860('0x21')]({'port':0x232a});function respondWithRpcPromise(_0x2ecadd,_0x4f1f18,_0x258064,_0x3986b1){return new BPromise(function(_0x34368c,_0x72922c){var _0x1aff26=_0x3986b1||client;return _0x1aff26[_0xa860('0x22')](_0x2ecadd,_0x258064)[_0xa860('0x23')](function(_0x3a45b9){logger['info']('OpenchannelAccount,\x20%s,\x20%s',_0x4f1f18,_0xa860('0x24'));logger[_0xa860('0x25')](_0xa860('0x26'),_0x4f1f18,'request\x20sent',JSON[_0xa860('0x27')](_0x3a45b9));if(_0x3a45b9[_0xa860('0x28')]){if(_0x3a45b9[_0xa860('0x28')][_0xa860('0x29')]===0x1f4){logger['error'](_0xa860('0x2a'),_0x4f1f18,_0x3a45b9[_0xa860('0x28')][_0xa860('0x2b')]);return _0x72922c(_0x3a45b9[_0xa860('0x28')][_0xa860('0x2b')]);}logger[_0xa860('0x28')](_0xa860('0x2a'),_0x4f1f18,_0x3a45b9[_0xa860('0x28')][_0xa860('0x2b')]);return _0x34368c(_0x3a45b9[_0xa860('0x28')]['message']);}else{logger['info'](_0xa860('0x2a'),_0x4f1f18,_0xa860('0x24'));_0x34368c(_0x3a45b9[_0xa860('0x2c')]['message']);}})[_0xa860('0x2d')](function(_0xb7d116){logger[_0xa860('0x28')](_0xa860('0x2a'),_0x4f1f18,_0xb7d116);_0x72922c(_0xb7d116);});});}function respondWithStatusCode(_0x518982,_0x50bb7f){_0x50bb7f=_0x50bb7f||0xcc;return function(_0x287079){if(_0x287079){return _0x518982[_0xa860('0x2e')](_0x50bb7f);}return _0x518982['status'](_0x50bb7f)[_0xa860('0x2f')]();};}function respondWithResult(_0x3f5758,_0x56f1dd){_0x56f1dd=_0x56f1dd||0xc8;return function(_0x4c576d){if(_0x4c576d){return _0x3f5758[_0xa860('0x30')](_0x56f1dd)['json'](_0x4c576d);}};}function respondWithFilteredResult(_0x36a27d,_0x5a6570){return function(_0x4c6d5e){if(_0x4c6d5e){var _0x39957=typeof _0x5a6570[_0xa860('0x31')]===_0xa860('0x32')&&typeof _0x5a6570[_0xa860('0x33')]===_0xa860('0x32');var _0x3798ce=_0x4c6d5e[_0xa860('0x34')];var _0x52b90f=_0x39957?0x0:_0x5a6570['offset'];var _0x17034e=_0x39957?_0x4c6d5e[_0xa860('0x34')]:_0x5a6570[_0xa860('0x31')]+_0x5a6570[_0xa860('0x33')];var _0x4eceba;if(_0x17034e>=_0x3798ce){_0x17034e=_0x3798ce;_0x4eceba=0xc8;}else{_0x4eceba=0xce;}_0x36a27d[_0xa860('0x30')](_0x4eceba);return _0x36a27d['set'](_0xa860('0x35'),_0x52b90f+'-'+_0x17034e+'/'+_0x3798ce)[_0xa860('0x36')](_0x4c6d5e);}return null;};}function patchUpdates(_0x14b96f){return function(_0x4c5187){try{jsonpatch['apply'](_0x4c5187,_0x14b96f,!![]);}catch(_0x3622a2){return BPromise[_0xa860('0x37')](_0x3622a2);}return _0x4c5187[_0xa860('0x38')]();};}function saveUpdates(_0x530dfe,_0x1a9900){return function(_0x26d8f3){if(_0x26d8f3){return _0x26d8f3[_0xa860('0x39')](_0x530dfe)[_0xa860('0x23')](function(_0x3c2f02){return _0x3c2f02;});}return null;};}function removeEntity(_0x2bd5aa,_0x857d5a){return function(_0x532bd6){if(_0x532bd6){return _0x532bd6['destroy']()['then'](function(){var _0x32499b=_0x532bd6[_0xa860('0x3a')]({'plain':!![]});var _0x2bbe38=_0xa860('0x3b');return db[_0xa860('0x3c')][_0xa860('0x3d')]({'where':{'type':_0x2bbe38,'resourceId':_0x32499b['id']}})[_0xa860('0x23')](function(){return _0x532bd6;});})[_0xa860('0x23')](function(){_0x2bd5aa[_0xa860('0x30')](0xcc)[_0xa860('0x2f')]();});}};}function handleEntityNotFound(_0x34e96e,_0x9dc426){return function(_0x51bf12){if(!_0x51bf12){_0x34e96e[_0xa860('0x2e')](0x194);}return _0x51bf12;};}function handleError(_0x823c57,_0x3b7b49){_0x3b7b49=_0x3b7b49||0x1f4;return function(_0x4c7033){logger[_0xa860('0x28')](_0x4c7033['stack']);if(_0x4c7033['name']){delete _0x4c7033[_0xa860('0x3e')];}_0x823c57[_0xa860('0x30')](_0x3b7b49)[_0xa860('0x3f')](_0x4c7033);};}exports['index']=function(_0x1366de,_0x458491){var _0x122408={'include':[{'model':db[_0xa860('0x40')],'as':_0xa860('0x41')}]},_0x3a5d50={},_0xdc66e2={'count':0x0,'rows':[]};var _0x2ff549=_[_0xa860('0x42')](db[_0xa860('0x43')][_0xa860('0x44')],function(_0xbea974){return{'name':_0xbea974[_0xa860('0x45')],'type':_0xbea974[_0xa860('0x46')][_0xa860('0x47')]};});_0x3a5d50['model']=_['map'](_0x2ff549,'name');_0x3a5d50[_0xa860('0x48')]=_[_0xa860('0x49')](_0x1366de[_0xa860('0x48')]);_0x3a5d50['filters']=_[_0xa860('0x4a')](_0x3a5d50[_0xa860('0x4b')],_0x3a5d50[_0xa860('0x48')]);_0x122408[_0xa860('0x4c')]=_['intersection'](_0x3a5d50[_0xa860('0x4b')],qs['fields'](_0x1366de[_0xa860('0x48')][_0xa860('0x4d')]));_0x122408[_0xa860('0x4c')]=_0x122408[_0xa860('0x4c')]['length']?_0x122408[_0xa860('0x4c')]:_0x3a5d50['model'];if(!_0x1366de[_0xa860('0x48')][_0xa860('0x4e')]('nolimit')){_0x122408[_0xa860('0x33')]=qs[_0xa860('0x33')](_0x1366de[_0xa860('0x48')][_0xa860('0x33')]);_0x122408['offset']=qs[_0xa860('0x31')](_0x1366de[_0xa860('0x48')][_0xa860('0x31')]);}_0x122408[_0xa860('0x4f')]=qs[_0xa860('0x50')](_0x1366de['query'][_0xa860('0x50')]);_0x122408['where']=qs[_0xa860('0x51')](_[_0xa860('0x52')](_0x1366de[_0xa860('0x48')],_0x3a5d50['filters']),_0x2ff549);if(_0x1366de[_0xa860('0x48')][_0xa860('0x53')]){_0x122408[_0xa860('0x54')]=_[_0xa860('0x55')](_0x122408['where'],{'$or':_[_0xa860('0x42')](_0x2ff549,function(_0x281287){if(_0x281287[_0xa860('0x46')]!==_0xa860('0x56')){var _0x16a99d={};_0x16a99d[_0x281287[_0xa860('0x3e')]]={'$like':'%'+_0x1366de[_0xa860('0x48')][_0xa860('0x53')]+'%'};return _0x16a99d;}})});}_0x122408=_[_0xa860('0x55')]({},_0x122408,_0x1366de[_0xa860('0x57')]);var _0xed8d80={'where':_0x122408[_0xa860('0x54')]};return db['OpenchannelAccount']['count'](_0xed8d80)[_0xa860('0x23')](function(_0x3111c2){_0xdc66e2[_0xa860('0x34')]=_0x3111c2;if(_0x1366de[_0xa860('0x48')][_0xa860('0x58')]){_0x122408['include']=[{'all':!![]}];}return db[_0xa860('0x43')][_0xa860('0x59')](_0x122408);})[_0xa860('0x23')](function(_0x2ac1fa){_0xdc66e2[_0xa860('0x5a')]=_0x2ac1fa;return _0xdc66e2;})[_0xa860('0x23')](respondWithFilteredResult(_0x458491,_0x122408))[_0xa860('0x2d')](handleError(_0x458491,null));};exports[_0xa860('0x5b')]=function(_0x1fb86a,_0x4fa40d){var _0x591757={'raw':![],'where':{'id':_0x1fb86a[_0xa860('0x5c')]['id']},'include':[{'model':db[_0xa860('0x40')],'as':_0xa860('0x41')}]},_0x52753b={};_0x52753b['model']=_[_0xa860('0x49')](db[_0xa860('0x43')]['rawAttributes']);_0x52753b['query']=_[_0xa860('0x49')](_0x1fb86a[_0xa860('0x48')]);_0x52753b[_0xa860('0x51')]=_[_0xa860('0x4a')](_0x52753b[_0xa860('0x4b')],_0x52753b[_0xa860('0x48')]);_0x591757[_0xa860('0x4c')]=_[_0xa860('0x4a')](_0x52753b[_0xa860('0x4b')],qs[_0xa860('0x4d')](_0x1fb86a[_0xa860('0x48')][_0xa860('0x4d')]));_0x591757[_0xa860('0x4c')]=_0x591757[_0xa860('0x4c')]['length']?_0x591757[_0xa860('0x4c')]:_0x52753b[_0xa860('0x4b')];if(_0x1fb86a[_0xa860('0x48')][_0xa860('0x58')]){_0x591757[_0xa860('0x5d')]=[{'all':!![]}];}_0x591757=_[_0xa860('0x55')]({},_0x591757,_0x1fb86a[_0xa860('0x57')]);return db[_0xa860('0x43')][_0xa860('0x5e')](_0x591757)[_0xa860('0x23')](handleEntityNotFound(_0x4fa40d,null))[_0xa860('0x23')](respondWithResult(_0x4fa40d,null))[_0xa860('0x2d')](handleError(_0x4fa40d,null));};exports['create']=function(_0x41b5a3,_0x1a309f){return db[_0xa860('0x43')][_0xa860('0x5f')](_0x41b5a3['body'],{})[_0xa860('0x23')](function(_0x204790){var _0x64c9ff=_0x41b5a3[_0xa860('0x60')][_0xa860('0x3a')]({'plain':!![]});if(!_0x64c9ff)throw new Error(_0xa860('0x61'));if(_0x64c9ff[_0xa860('0x62')]===_0xa860('0x60')){var _0x46d12c=_0x204790[_0xa860('0x3a')]({'plain':!![]});var _0xa4f684=_0xa860('0x3b');return db[_0xa860('0x63')][_0xa860('0x5e')]({'where':{'name':_0xa4f684,'userProfileId':_0x64c9ff['userProfileId']},'raw':!![]})[_0xa860('0x23')](function(_0x1a2413){if(_0x1a2413&&_0x1a2413[_0xa860('0x64')]===0x0){return db[_0xa860('0x3c')][_0xa860('0x5f')]({'name':_0x46d12c[_0xa860('0x3e')],'resourceId':_0x46d12c['id'],'type':_0x1a2413['name'],'sectionId':_0x1a2413['id']},{})[_0xa860('0x23')](function(){return _0x204790;});}else{return _0x204790;}})[_0xa860('0x2d')](function(_0x2e7996){logger[_0xa860('0x28')](_0xa860('0x65'),_0x2e7996);throw _0x2e7996;});}return _0x204790;})[_0xa860('0x23')](respondWithResult(_0x1a309f,0xc9))[_0xa860('0x2d')](handleError(_0x1a309f,null));};exports[_0xa860('0x39')]=function(_0x28fc2f,_0x9426c9){if(_0x28fc2f[_0xa860('0x66')]['id']){delete _0x28fc2f[_0xa860('0x66')]['id'];}return db[_0xa860('0x43')]['find']({'where':{'id':_0x28fc2f[_0xa860('0x5c')]['id']},'include':[{'model':db[_0xa860('0x40')],'as':'mandatoryDispositionPause'}]})[_0xa860('0x23')](handleEntityNotFound(_0x9426c9,null))[_0xa860('0x23')](saveUpdates(_0x28fc2f[_0xa860('0x66')],null))[_0xa860('0x23')](respondWithResult(_0x9426c9,null))['catch'](handleError(_0x9426c9,null));};exports[_0xa860('0x3d')]=function(_0x102005,_0x31b45d){return db[_0xa860('0x43')][_0xa860('0x5e')]({'where':{'id':_0x102005[_0xa860('0x5c')]['id']}})[_0xa860('0x23')](handleEntityNotFound(_0x31b45d,null))[_0xa860('0x23')](removeEntity(_0x31b45d,null))['catch'](handleError(_0x31b45d,null));};exports[_0xa860('0x67')]=function(_0x2bb5be,_0xd2a475){return db[_0xa860('0x43')][_0xa860('0x67')]()[_0xa860('0x23')](respondWithResult(_0xd2a475,null))['catch'](handleError(_0xd2a475,null));};exports[_0xa860('0x68')]=function(_0x4b5c14,_0x27f641,_0x45ba35){if(_0x4b5c14['body']['id']){delete _0x4b5c14['body']['id'];}return db['OpenchannelAccount']['find']({'where':{'id':_0x4b5c14[_0xa860('0x5c')]['id']}})[_0xa860('0x23')](handleEntityNotFound(_0x27f641,null))[_0xa860('0x23')](function(_0x2e2e72){if(_0x2e2e72){_0x4b5c14['body'][_0xa860('0x69')]=_0x2e2e72['id'];return db[_0xa860('0x6a')][_0xa860('0x5f')](_0x4b5c14[_0xa860('0x66')]);}})[_0xa860('0x23')](respondWithResult(_0x27f641,null))[_0xa860('0x2d')](handleError(_0x27f641,null));};exports[_0xa860('0x6b')]=function(_0x4cfb57,_0x2e4759,_0x497f7f){var _0x55843a={'raw':![],'where':{}};var _0x18c138={};var _0x2ba31e={'count':0x0,'rows':[]};return db[_0xa860('0x43')][_0xa860('0x6c')]({'where':{'id':_0x4cfb57['params']['id']}})[_0xa860('0x23')](handleEntityNotFound(_0x2e4759,null))[_0xa860('0x23')](function(_0x1642c4){if(_0x1642c4){_0x18c138[_0xa860('0x4b')]=_[_0xa860('0x49')](db['Disposition'][_0xa860('0x44')]);_0x18c138[_0xa860('0x48')]=_[_0xa860('0x49')](_0x4cfb57[_0xa860('0x48')]);_0x18c138[_0xa860('0x51')]=_[_0xa860('0x4a')](_0x18c138[_0xa860('0x4b')],_0x18c138[_0xa860('0x48')]);_0x55843a[_0xa860('0x4c')]=_['intersection'](_0x18c138[_0xa860('0x4b')],qs[_0xa860('0x4d')](_0x4cfb57[_0xa860('0x48')][_0xa860('0x4d')]));_0x55843a[_0xa860('0x4c')]=_0x55843a[_0xa860('0x4c')][_0xa860('0x6d')]?_0x55843a[_0xa860('0x4c')]:_0x18c138[_0xa860('0x4b')];if(!_0x4cfb57[_0xa860('0x48')][_0xa860('0x4e')]('nolimit')){_0x55843a['limit']=qs[_0xa860('0x33')](_0x4cfb57[_0xa860('0x48')][_0xa860('0x33')]);_0x55843a[_0xa860('0x31')]=qs[_0xa860('0x31')](_0x4cfb57[_0xa860('0x48')]['offset']);}_0x55843a[_0xa860('0x4f')]=qs[_0xa860('0x50')](_0x4cfb57[_0xa860('0x48')]['sort']);_0x55843a[_0xa860('0x54')]=qs[_0xa860('0x51')](_[_0xa860('0x52')](_0x4cfb57[_0xa860('0x48')],_0x18c138[_0xa860('0x51')]));_0x55843a[_0xa860('0x54')][_0xa860('0x69')]=_0x1642c4['id'];if(_0x4cfb57[_0xa860('0x48')][_0xa860('0x53')]){_0x55843a['where']=_[_0xa860('0x55')](_0x55843a[_0xa860('0x54')],{'$or':_[_0xa860('0x42')](_0x55843a[_0xa860('0x4c')],function(_0x2a5a90){var _0x15361d={};_0x15361d[_0x2a5a90]={'$like':'%'+_0x4cfb57['query'][_0xa860('0x53')]+'%'};return _0x15361d;})});}_0x55843a=_[_0xa860('0x55')]({},_0x55843a,_0x4cfb57['options']);return db['Disposition'][_0xa860('0x34')]({'where':_0x55843a[_0xa860('0x54')]})[_0xa860('0x23')](function(_0x37a075){_0x2ba31e['count']=_0x37a075;if(_0x4cfb57[_0xa860('0x48')][_0xa860('0x58')]){_0x55843a[_0xa860('0x5d')]=[{'all':!![]}];}return db[_0xa860('0x6a')][_0xa860('0x59')](_0x55843a);})[_0xa860('0x23')](function(_0x7de601){_0x2ba31e[_0xa860('0x5a')]=_0x7de601;return _0x2ba31e;});}})[_0xa860('0x23')](respondWithFilteredResult(_0x2e4759,_0x55843a))[_0xa860('0x2d')](handleError(_0x2e4759,null));};exports['removeDispositions']=function(_0x29a06e,_0x2e8e52,_0x113506){return db['OpenchannelAccount'][_0xa860('0x5e')]({'where':{'id':_0x29a06e[_0xa860('0x5c')]['id']}})[_0xa860('0x23')](handleEntityNotFound(_0x2e8e52,null))[_0xa860('0x23')](function(_0x5169a8){if(_0x5169a8){return _0x5169a8['removeDispositions'](_0x29a06e['query'][_0xa860('0x6e')]);}})[_0xa860('0x23')](respondWithStatusCode(_0x2e8e52,null))[_0xa860('0x2d')](handleError(_0x2e8e52,null));};exports[_0xa860('0x6f')]=function(_0x2b7ff5,_0x488dea,_0xe779d0){if(_0x2b7ff5[_0xa860('0x66')]['id']){delete _0x2b7ff5[_0xa860('0x66')]['id'];}return db['OpenchannelAccount'][_0xa860('0x5e')]({'where':{'id':_0x2b7ff5[_0xa860('0x5c')]['id']}})[_0xa860('0x23')](handleEntityNotFound(_0x488dea,null))[_0xa860('0x23')](function(_0x3f0ea2){if(_0x3f0ea2){_0x2b7ff5[_0xa860('0x66')]['OpenchannelAccountId']=_0x3f0ea2['id'];return db['CannedAnswer'][_0xa860('0x5f')](_0x2b7ff5[_0xa860('0x66')]);}})[_0xa860('0x23')](respondWithResult(_0x488dea,null))['catch'](handleError(_0x488dea,null));};exports['getAnswers']=function(_0x42b619,_0x3cdbb4,_0x21ef6f){var _0x30c42f={'raw':![],'where':{}};var _0x4962d5={};var _0x1b248d={'count':0x0,'rows':[]};return db[_0xa860('0x43')][_0xa860('0x6c')]({'where':{'id':_0x42b619['params']['id']}})[_0xa860('0x23')](handleEntityNotFound(_0x3cdbb4,null))[_0xa860('0x23')](function(_0xbdf4d7){if(_0xbdf4d7){_0x4962d5[_0xa860('0x4b')]=_[_0xa860('0x49')](db[_0xa860('0x70')][_0xa860('0x44')]);_0x4962d5[_0xa860('0x48')]=_['keys'](_0x42b619[_0xa860('0x48')]);_0x4962d5[_0xa860('0x51')]=_[_0xa860('0x4a')](_0x4962d5['model'],_0x4962d5[_0xa860('0x48')]);_0x30c42f['attributes']=_[_0xa860('0x4a')](_0x4962d5['model'],qs[_0xa860('0x4d')](_0x42b619['query'][_0xa860('0x4d')]));_0x30c42f[_0xa860('0x4c')]=_0x30c42f[_0xa860('0x4c')][_0xa860('0x6d')]?_0x30c42f[_0xa860('0x4c')]:_0x4962d5[_0xa860('0x4b')];if(!_0x42b619[_0xa860('0x48')][_0xa860('0x4e')]('nolimit')){_0x30c42f[_0xa860('0x33')]=qs[_0xa860('0x33')](_0x42b619[_0xa860('0x48')][_0xa860('0x33')]);_0x30c42f[_0xa860('0x31')]=qs[_0xa860('0x31')](_0x42b619[_0xa860('0x48')][_0xa860('0x31')]);}_0x30c42f[_0xa860('0x4f')]=qs[_0xa860('0x50')](_0x42b619[_0xa860('0x48')][_0xa860('0x50')]);_0x30c42f['where']=qs[_0xa860('0x51')](_[_0xa860('0x52')](_0x42b619['query'],_0x4962d5[_0xa860('0x51')]));_0x30c42f[_0xa860('0x54')][_0xa860('0x69')]=_0xbdf4d7['id'];if(_0x42b619[_0xa860('0x48')][_0xa860('0x53')]){_0x30c42f[_0xa860('0x54')]=_['merge'](_0x30c42f[_0xa860('0x54')],{'$or':_['map'](_0x30c42f[_0xa860('0x4c')],function(_0x766917){var _0x47802a={};_0x47802a[_0x766917]={'$like':'%'+_0x42b619[_0xa860('0x48')][_0xa860('0x53')]+'%'};return _0x47802a;})});}_0x30c42f=_['merge']({},_0x30c42f,_0x42b619[_0xa860('0x57')]);return db[_0xa860('0x70')][_0xa860('0x34')]({'where':_0x30c42f[_0xa860('0x54')]})[_0xa860('0x23')](function(_0x23f80a){_0x1b248d[_0xa860('0x34')]=_0x23f80a;if(_0x42b619['query'][_0xa860('0x58')]){_0x30c42f[_0xa860('0x5d')]=[{'all':!![]}];}return db['CannedAnswer'][_0xa860('0x59')](_0x30c42f);})[_0xa860('0x23')](function(_0x304f7c){_0x1b248d['rows']=_0x304f7c;return _0x1b248d;});}})['then'](respondWithFilteredResult(_0x3cdbb4,_0x30c42f))['catch'](handleError(_0x3cdbb4,null));};exports['removeAnswers']=function(_0x5d15a6,_0x14f694,_0x3667c7){return db[_0xa860('0x43')][_0xa860('0x5e')]({'where':{'id':_0x5d15a6['params']['id']}})[_0xa860('0x23')](handleEntityNotFound(_0x14f694,null))[_0xa860('0x23')](function(_0x444588){if(_0x444588){return _0x444588['removeAnswers'](_0x5d15a6[_0xa860('0x48')][_0xa860('0x6e')]);}})[_0xa860('0x23')](respondWithStatusCode(_0x14f694,null))[_0xa860('0x2d')](handleError(_0x14f694,null));};exports[_0xa860('0x71')]=function(_0x1df4e9,_0x51ba0e,_0x2e6f85){var _0x58003b={'body':_0x1df4e9[_0xa860('0x66')],'channel':_0xa860('0x72')};var _0x97ef00=[];var _0x130fc8=[];var _0xfe597e={};var _0x3a32c1=![];return db[_0xa860('0x73')][_0xa860('0x67')]()[_0xa860('0x23')](function(_0x4a0e71){if(!_0x4a0e71){throw new db[(_0xa860('0x74'))][(_0xa860('0x75'))](_0xa860('0x76'));}_0x97ef00=_[_0xa860('0x77')](_[_0xa860('0x49')](_0x4a0e71),[_0xa860('0x78'),'updatedAt']);_0x130fc8=_[_0xa860('0x77')](_[_0xa860('0x49')](_0x4a0e71),[_0xa860('0x78'),_0xa860('0x79'),'CompanyId',_0xa860('0x7a')]);if(_0x1df4e9[_0xa860('0x66')]['id']){delete _0x1df4e9['body']['id'];}if(_['isNil'](_0x1df4e9[_0xa860('0x66')][_0xa860('0x7b')])){throw new db[(_0xa860('0x74'))][(_0xa860('0x75'))]('from\x20is\x20mandatory');}if(_['isNil'](_0x1df4e9[_0xa860('0x66')][_0xa860('0x66')])||_0x1df4e9[_0xa860('0x66')][_0xa860('0x66')]===''){throw new db['Sequelize'][(_0xa860('0x75'))](_0xa860('0x7c'));}if(_[_0xa860('0x7d')](_0x1df4e9['body'][_0xa860('0x7e')])){throw new db[(_0xa860('0x74'))][(_0xa860('0x75'))](_0xa860('0x7f')+_0x130fc8);}if(!_[_0xa860('0x80')](_0x130fc8,_0x1df4e9[_0xa860('0x66')]['mapKey'])){throw new db[(_0xa860('0x74'))][(_0xa860('0x75'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x130fc8);}_0xfe597e[_0x1df4e9['body'][_0xa860('0x7e')]]=_0x1df4e9[_0xa860('0x66')]['from'];})[_0xa860('0x23')](function(){return db[_0xa860('0x43')]['find']({'where':{'id':_0x1df4e9[_0xa860('0x5c')]['id']},'include':[{'model':db[_0xa860('0x81')],'as':_0xa860('0x82'),'include':[{'model':db[_0xa860('0x73')],'as':_0xa860('0x83'),'where':_0xfe597e,'limit':0x1,'order':[[_0xa860('0x79'),_0xa860('0x84')]]}]},{'model':db[_0xa860('0x85')],'as':_0xa860('0x86')}]});})[_0xa860('0x23')](handleEntityNotFound(_0x51ba0e,null))[_0xa860('0x23')](function(_0x11903a){if(_0x11903a&&_0x11903a[_0xa860('0x82')]){_0x58003b[_0xa860('0x87')]=_0x11903a;_0x58003b[_0xa860('0x88')]=_0x11903a[_0xa860('0x86')];_0x58003b[_0xa860('0x89')]=_0x11903a[_0xa860('0x82')];_0x58003b[_0xa860('0x88')]=_[_0xa860('0x8a')](_0x58003b[_0xa860('0x88')],['priority'],['asc']);if(_0x58003b[_0xa860('0x87')][_0xa860('0x86')]){delete _0x58003b[_0xa860('0x87')]['Applications'];}if(_0x58003b[_0xa860('0x87')][_0xa860('0x82')]&&_0x58003b[_0xa860('0x87')][_0xa860('0x82')][_0xa860('0x83')][_0xa860('0x6d')]){return _0x58003b[_0xa860('0x87')][_0xa860('0x82')][_0xa860('0x83')][0x0];}var _0x34f863=_[_0xa860('0x8b')](_0x1df4e9[_0xa860('0x66')],{'firstName':_0x1df4e9[_0xa860('0x66')]['from'],'ListId':_0x11903a[_0xa860('0x7a')]});_0x34f863[_0x1df4e9[_0xa860('0x66')][_0xa860('0x7e')]]=_0x1df4e9[_0xa860('0x66')][_0xa860('0x7b')];return db[_0xa860('0x73')]['create'](_0x34f863,{'fields':_0x97ef00,'raw':!![]});}})[_0xa860('0x23')](handleEntityNotFound(_0x51ba0e,null))[_0xa860('0x23')](function(_0x4d646e){_0x58003b[_0xa860('0x8c')]=_0x4d646e;if(_0x4d646e){var _0x54df0d={'ContactId':_0x4d646e['id'],'OpenchannelAccountId':_0x1df4e9[_0xa860('0x5c')]['id'],'from':(_0x4d646e['firstName']||'')+'\x20'+(_0x4d646e[_0xa860('0x8d')]||'')};var _0x248f48={'OpenchannelAccountId':_0x1df4e9[_0xa860('0x5c')]['id'],'closed':![]};if(_0x1df4e9['body'][_0xa860('0x8e')]){_0x248f48['threadId']=_0x1df4e9['body']['threadId'];return db['OpenchannelInteraction'][_0xa860('0x5e')]({'where':_0x248f48})[_0xa860('0x23')](function(_0x3103d8){if(_0x3103d8){return[_0x3103d8,![]];}_0x54df0d[_0xa860('0x8e')]=_0x1df4e9[_0xa860('0x66')][_0xa860('0x8e')];_0x54df0d[_0xa860('0x8f')]=_0x1df4e9[_0xa860('0x66')][_0xa860('0x8f')];return db[_0xa860('0x90')]['create'](_0x54df0d)[_0xa860('0x23')](function(_0x3c731e){return[_0x3c731e,!![]];});});}else{_0x248f48[_0xa860('0x8e')]=null;}_0x248f48[_0xa860('0x91')]=_0x4d646e['id'];return db[_0xa860('0x90')][_0xa860('0x5e')]({'where':_0x248f48})[_0xa860('0x23')](function(_0x48c186){if(_0x48c186){return[_0x48c186,![]];}return db['OpenchannelInteraction'][_0xa860('0x5f')](_0x54df0d)[_0xa860('0x23')](function(_0xd58928){return[_0xd58928,!![]];});});}})[_0xa860('0x92')](function(_0x5a6378,_0x467d33){if(_0x5a6378){_0x3a32c1=_0x467d33;if(!_0x467d33){var _0x1eb7d9={'from':(_0x58003b[_0xa860('0x8c')][_0xa860('0x93')]||'')+'\x20'+(_0x58003b[_0xa860('0x8c')]['lastName']||'')};if(_0x1df4e9[_0xa860('0x66')][_0xa860('0x8e')]&&_0x1df4e9[_0xa860('0x66')]['messageId']&&_0x1df4e9[_0xa860('0x66')][_0xa860('0x8e')]!=_0x1df4e9[_0xa860('0x66')][_0xa860('0x94')]){_0x1eb7d9[_0xa860('0x8e')]=_0x1df4e9[_0xa860('0x66')][_0xa860('0x94')];}return _0x5a6378[_0xa860('0x39')](_0x1eb7d9);}else{return _0x5a6378;}}})['then'](function(_0x4d6c9b){_0x58003b['interaction']=_0x4d6c9b[_0xa860('0x3a')]({'plain':!![]});_0x58003b['interaction'][_0xa860('0x95')]=_0x3a32c1;if(_0x58003b['interaction']['created']){if(_0x58003b[_0xa860('0x87')][_0xa860('0x96')]){_0x58003b[_0xa860('0x88')]['push']({'id':0x0,'priority':_0x58003b[_0xa860('0x88')][_0xa860('0x6d')]+0x1,'app':_0xa860('0x97'),'appdata':_0xa860('0x98'),'interval':'*,*,*,*'});}}return db[_0xa860('0x99')][_0xa860('0x5f')]({'body':_0x1df4e9[_0xa860('0x66')][_0xa860('0x66')],'OpenchannelAccountId':_0x1df4e9[_0xa860('0x5c')]['id'],'OpenchannelInteractionId':_0x4d6c9b['id'],'direction':'in','ContactId':_0x58003b[_0xa860('0x8c')]['id'],'AttachmentId':_0x1df4e9[_0xa860('0x66')][_0xa860('0x9a')]});})[_0xa860('0x23')](function(_0x1236c9){_0x58003b[_0xa860('0x2b')]=_0x1236c9;if(_0x58003b[_0xa860('0x9b')][_0xa860('0x9c')]){return db[_0xa860('0x9d')][_0xa860('0x5e')]({'attributes':['id',_0xa860('0x3e')],'where':{'id':_0x58003b[_0xa860('0x9b')]['UserId']}})[_0xa860('0x23')](function(_0x101505){if(_0x101505){_0x58003b[_0xa860('0x88')][_0xa860('0x9e')]({'id':0x0,'priority':0x0,'app':_0xa860('0x9f'),'appdata':_0x101505['name']+','+(_0x58003b[_0xa860('0x87')][_0xa860('0xa0')]||0xa),'interval':'*,*,*,*'});_0x58003b[_0xa860('0xa1')]=![];}return respondWithRpcPromise(_0xa860('0xa2'),'startRouting',_0x58003b);});}return respondWithRpcPromise(_0xa860('0xa2'),_0xa860('0xa3'),_0x58003b);})[_0xa860('0x23')](function(_0x5cb072){respondWithRpcPromise('EventManager',_0xa860('0xa4'),{'event':'notify','message':_0x5cb072},client9002);return _0x5cb072;})[_0xa860('0x23')](respondWithResult(_0x51ba0e,null))[_0xa860('0x2d')](handleError(_0x51ba0e,null));};exports[_0xa860('0xa5')]=function(_0x2666bc,_0x13296d){var _0x26c6b5=_0x2666bc[_0xa860('0x5c')]['id'];var _0xee379b=_0x2666bc['body'];var _0x44021e=0xc8;var _0x23aa21=null;return db[_0xa860('0xa6')]['transaction']({'isolationLevel':db['sequelize'][_0xa860('0xa7')]['ISOLATION_LEVELS']['READ_COMMITTED']},function(_0x4c3433){return db[_0xa860('0x43')][_0xa860('0x6c')]({'where':{'id':_0x26c6b5},'transaction':_0x4c3433})[_0xa860('0x23')](function(_0x34a904){if(_0x34a904){return db[_0xa860('0x85')]['destroy']({'where':{'OpenchannelAccountId':_0x26c6b5},'transaction':_0x4c3433})[_0xa860('0x23')](function(){var _0x587e08=_['map'](_0xee379b,function(_0x3b4b69){_0x3b4b69['OpenchannelAccountId']=_0x26c6b5;return _0x3b4b69;});return db[_0xa860('0x85')][_0xa860('0xa8')](_0x587e08,{'transaction':_0x4c3433});});}else{_0x44021e=0x194;_0x23aa21=[];}});})['then'](function(){if(_0x44021e!==0x194){return db[_0xa860('0x85')]['findAndCountAll']({'where':{'OpenchannelAccountId':_0x26c6b5},'order':_0xa860('0xa9')})[_0xa860('0x23')](function(_0x2c5e7f){_0x23aa21=_0x2c5e7f;});}})[_0xa860('0x2d')](function(_0x487356){_0x44021e=0x1f4;logger[_0xa860('0x28')](_0x487356['stack']);if(_0x487356[_0xa860('0x3e')]){delete _0x487356[_0xa860('0x3e')];}_0x23aa21=_0x487356;})[_0xa860('0xaa')](function(){if(_0x23aa21===null){_0x13296d[_0xa860('0x2e')](_0x44021e);}else{if(_0x44021e===0x1f4){_0x13296d[_0xa860('0x30')](_0x44021e)['send'](_0x23aa21);}else{_0x13296d['status'](_0x44021e)[_0xa860('0x36')](_0x23aa21);}}});};exports[_0xa860('0xab')]=function(_0x421006,_0x45df4f,_0x26f282){var _0x538777={};var _0x3caf30={};var _0x128db1;var _0x2293e9;return db[_0xa860('0x43')][_0xa860('0x6c')]({'where':{'id':_0x421006['params']['id']}})[_0xa860('0x23')](handleEntityNotFound(_0x45df4f,null))[_0xa860('0x23')](function(_0xf9a8b1){if(_0xf9a8b1){_0x128db1=_0xf9a8b1;_0x3caf30[_0xa860('0x4b')]=_[_0xa860('0x49')](db[_0xa860('0x85')]['rawAttributes']);_0x3caf30[_0xa860('0x48')]=_[_0xa860('0x49')](_0x421006[_0xa860('0x48')]);_0x3caf30[_0xa860('0x51')]=_['intersection'](_0x3caf30[_0xa860('0x4b')],_0x3caf30[_0xa860('0x48')]);_0x538777[_0xa860('0x4c')]=_[_0xa860('0x4a')](_0x3caf30[_0xa860('0x4b')],qs['fields'](_0x421006['query'][_0xa860('0x4d')]));_0x538777[_0xa860('0x4c')]=_0x538777[_0xa860('0x4c')][_0xa860('0x6d')]?_0x538777['attributes']:_0x3caf30[_0xa860('0x4b')];_0x538777[_0xa860('0x4f')]=qs[_0xa860('0x50')](_0x421006[_0xa860('0x48')][_0xa860('0x50')]);_0x538777[_0xa860('0x54')]=qs[_0xa860('0x51')](_['pick'](_0x421006['query'],_0x3caf30['filters']));if(_0x421006['query'][_0xa860('0x53')]){_0x538777[_0xa860('0x54')]=_[_0xa860('0x55')](_0x538777[_0xa860('0x54')],{'$or':_[_0xa860('0x42')](_0x538777[_0xa860('0x4c')],function(_0x3f2e1a){var _0x1487dd={};_0x1487dd[_0x3f2e1a]={'$like':'%'+_0x421006[_0xa860('0x48')][_0xa860('0x53')]+'%'};return _0x1487dd;})});}_0x538777=_[_0xa860('0x55')]({},_0x538777,_0x421006[_0xa860('0x57')]);return _0x128db1['getApplications'](_0x538777);}})['then'](function(_0x3b710e){if(_0x3b710e){_0x2293e9=_0x3b710e[_0xa860('0x6d')];if(!_0x421006['query'][_0xa860('0x4e')]('nolimit')){_0x538777[_0xa860('0x33')]=qs[_0xa860('0x33')](_0x421006[_0xa860('0x48')][_0xa860('0x33')]);_0x538777[_0xa860('0x31')]=qs['offset'](_0x421006[_0xa860('0x48')][_0xa860('0x31')]);}return _0x128db1[_0xa860('0xab')](_0x538777);}})[_0xa860('0x23')](function(_0x196cf8){if(_0x196cf8){return _0x196cf8?{'count':_0x2293e9,'rows':_0x196cf8}:null;}})[_0xa860('0x23')](respondWithResult(_0x45df4f,null))[_0xa860('0x2d')](handleError(_0x45df4f,null));};exports[_0xa860('0xac')]=function(_0x24922e,_0x1b3ba5,_0x59d8ac){var _0x5d8448={'raw':![],'where':{}};var _0x102ed5={};var _0xf0712c={'count':0x0,'rows':[]};return db[_0xa860('0x43')][_0xa860('0x6c')]({'where':{'id':_0x24922e[_0xa860('0x5c')]['id']}})['then'](handleEntityNotFound(_0x1b3ba5,null))[_0xa860('0x23')](function(_0x3677fc){if(_0x3677fc){_0x102ed5[_0xa860('0x4b')]=_[_0xa860('0x49')](db[_0xa860('0x90')][_0xa860('0x44')]);_0x102ed5[_0xa860('0x48')]=_[_0xa860('0x49')](_0x24922e[_0xa860('0x48')]);_0x102ed5[_0xa860('0x51')]=_[_0xa860('0x4a')](_0x102ed5['model'],_0x102ed5[_0xa860('0x48')]);_0x5d8448[_0xa860('0x4c')]=_['intersection'](_0x102ed5[_0xa860('0x4b')],qs[_0xa860('0x4d')](_0x24922e['query'][_0xa860('0x4d')]));_0x5d8448[_0xa860('0x4c')]=_0x5d8448[_0xa860('0x4c')]['length']?_0x5d8448['attributes']:_0x102ed5['model'];if(!_0x24922e['query'][_0xa860('0x4e')](_0xa860('0xad'))){_0x5d8448['limit']=qs[_0xa860('0x33')](_0x24922e[_0xa860('0x48')][_0xa860('0x33')]);_0x5d8448[_0xa860('0x31')]=qs[_0xa860('0x31')](_0x24922e['query'][_0xa860('0x31')]);}_0x5d8448['order']=qs[_0xa860('0x50')](_0x24922e[_0xa860('0x48')][_0xa860('0x50')]);_0x5d8448[_0xa860('0x54')]=qs[_0xa860('0x51')](_[_0xa860('0x52')](_0x24922e[_0xa860('0x48')],_0x102ed5[_0xa860('0x51')]));_0x5d8448[_0xa860('0x54')][_0xa860('0x69')]=_0x3677fc['id'];if(_0x24922e[_0xa860('0x48')][_0xa860('0x53')]){_0x5d8448[_0xa860('0x54')]=_[_0xa860('0x55')](_0x5d8448[_0xa860('0x54')],{'$or':_['map'](_0x5d8448[_0xa860('0x4c')],function(_0x76febf){var _0x3667fc={};_0x3667fc[_0x76febf]={'$like':'%'+_0x24922e[_0xa860('0x48')]['filter']+'%'};return _0x3667fc;})});}_0x5d8448=_['merge']({},_0x5d8448,_0x24922e[_0xa860('0x57')]);return db[_0xa860('0x90')]['count']({'where':_0x5d8448[_0xa860('0x54')]})['then'](function(_0x248014){_0xf0712c[_0xa860('0x34')]=_0x248014;if(_0x24922e['query']['includeAll']){_0x5d8448[_0xa860('0x5d')]=[{'model':db[_0xa860('0x73')],'as':_0xa860('0xae'),'required':![]},{'model':db[_0xa860('0x9d')],'as':_0xa860('0xaf'),'attributes':[_0xa860('0x3e'),_0xa860('0xb0'),_0xa860('0xb1')],'required':![]},{'model':db[_0xa860('0xb2')],'as':'Tags','attributes':['id',_0xa860('0x3e'),_0xa860('0xb3')],'where':_0x24922e[_0xa860('0x48')][_0xa860('0xb4')]?{'id':_0x24922e['query'][_0xa860('0xb4')]}:undefined,'required':_0x24922e[_0xa860('0x48')][_0xa860('0xb4')]?!![]:![]}];}return db[_0xa860('0x90')][_0xa860('0x59')](_0x5d8448);})[_0xa860('0x23')](function(_0x4736e2){_0xf0712c[_0xa860('0x5a')]=_0x4736e2;return _0xf0712c;});}})[_0xa860('0x23')](respondWithFilteredResult(_0x1b3ba5,_0x5d8448))[_0xa860('0x2d')](handleError(_0x1b3ba5,null));};exports[_0xa860('0xb5')]=function(_0x4ad383,_0x190b83,_0x5e1de0){return db['OpenchannelAccount'][_0xa860('0x5e')]({'where':{'id':_0x4ad383['params']['id']}})['then'](handleEntityNotFound(_0x190b83,null))[_0xa860('0x23')](function(_0x50134d){if(_0x50134d){return _0x50134d['addAgents'](_0x4ad383[_0xa860('0x66')][_0xa860('0x6e')],_[_0xa860('0xb6')](_0x4ad383[_0xa860('0x66')],[_0xa860('0x6e'),'id'])||{})[_0xa860('0x92')](function(_0x46a692){for(var _0xdd716a=0x0;_0xdd716a<_0x4ad383[_0xa860('0x66')][_0xa860('0x6e')][_0xa860('0x6d')];_0xdd716a+=0x1){socket[_0xa860('0xb7')](_0xa860('0xb8'),{'UserId':Number(_0x4ad383[_0xa860('0x66')][_0xa860('0x6e')][_0xdd716a]),'OpenchannelAccountId':Number(_0x4ad383['params']['id'])});}return _0x46a692;});}})[_0xa860('0x23')](respondWithResult(_0x190b83,null))[_0xa860('0x2d')](handleError(_0x190b83,null));};exports[_0xa860('0xb9')]=function(_0x2eb78a,_0x35f87e,_0x312eae){return db[_0xa860('0x43')][_0xa860('0x5e')]({'where':{'id':_0x2eb78a['params']['id']}})[_0xa860('0x23')](handleEntityNotFound(_0x35f87e,null))[_0xa860('0x23')](function(_0x19d1c6){if(_0x19d1c6){return _0x19d1c6[_0xa860('0xb9')](_0x2eb78a[_0xa860('0x48')]['ids'])[_0xa860('0x23')](function(){if(_[_0xa860('0xba')](_0x2eb78a[_0xa860('0x48')][_0xa860('0x6e')])){for(var _0x445fad=0x0;_0x445fad<_0x2eb78a[_0xa860('0x48')]['ids'][_0xa860('0x6d')];_0x445fad+=0x1){socket[_0xa860('0xb7')]('userOpenchannelAccount:remove',{'UserId':Number(_0x2eb78a[_0xa860('0x48')][_0xa860('0x6e')][_0x445fad]),'OpenchannelAccountId':Number(_0x2eb78a[_0xa860('0x5c')]['id'])});}}else{socket[_0xa860('0xb7')](_0xa860('0xbb'),{'UserId':Number(_0x2eb78a[_0xa860('0x48')][_0xa860('0x6e')]),'OpenchannelAccountId':Number(_0x2eb78a[_0xa860('0x5c')]['id'])});}});}})[_0xa860('0x23')](respondWithStatusCode(_0x35f87e,null))[_0xa860('0x2d')](handleError(_0x35f87e,null));};exports[_0xa860('0xbc')]=function(_0x3d86bd,_0x37bf79,_0x538a2b){var _0x374d93={};var _0x4ab6e7={};var _0x8217a2;var _0x2d06a4;return db['OpenchannelAccount'][_0xa860('0x6c')]({'where':{'id':_0x3d86bd['params']['id']}})['then'](handleEntityNotFound(_0x37bf79,null))[_0xa860('0x23')](function(_0x37d86b){if(_0x37d86b){_0x8217a2=_0x37d86b;_0x4ab6e7['model']=_[_0xa860('0x49')](db[_0xa860('0x9d')][_0xa860('0x44')]);_0x4ab6e7['query']=_[_0xa860('0x49')](_0x3d86bd['query']);_0x4ab6e7[_0xa860('0x51')]=_[_0xa860('0x4a')](_0x4ab6e7[_0xa860('0x4b')],_0x4ab6e7[_0xa860('0x48')]);_0x374d93[_0xa860('0x4c')]=_[_0xa860('0x4a')](_0x4ab6e7[_0xa860('0x4b')],qs[_0xa860('0x4d')](_0x3d86bd[_0xa860('0x48')][_0xa860('0x4d')]));_0x374d93['attributes']=_0x374d93[_0xa860('0x4c')][_0xa860('0x6d')]?_0x374d93[_0xa860('0x4c')]:_0x4ab6e7[_0xa860('0x4b')];_0x374d93[_0xa860('0x4f')]=qs['sort'](_0x3d86bd[_0xa860('0x48')][_0xa860('0x50')]);_0x374d93['where']=qs['filters'](_[_0xa860('0x52')](_0x3d86bd[_0xa860('0x48')],_0x4ab6e7['filters']));if(_0x3d86bd[_0xa860('0x48')]['filter']){_0x374d93[_0xa860('0x54')]=_[_0xa860('0x55')](_0x374d93[_0xa860('0x54')],{'$or':_[_0xa860('0x42')](_0x374d93[_0xa860('0x4c')],function(_0x239f80){var _0x331e70={};_0x331e70[_0x239f80]={'$like':'%'+_0x3d86bd['query'][_0xa860('0x53')]+'%'};return _0x331e70;})});}_0x374d93=_['merge']({},_0x374d93,_0x3d86bd[_0xa860('0x57')]);return _0x8217a2[_0xa860('0xbc')](_0x374d93);}})[_0xa860('0x23')](function(_0x37933b){if(_0x37933b){_0x2d06a4=_0x37933b['length'];if(!_0x3d86bd[_0xa860('0x48')][_0xa860('0x4e')](_0xa860('0xad'))){_0x374d93['limit']=qs[_0xa860('0x33')](_0x3d86bd[_0xa860('0x48')][_0xa860('0x33')]);_0x374d93[_0xa860('0x31')]=qs['offset'](_0x3d86bd[_0xa860('0x48')]['offset']);}return _0x8217a2[_0xa860('0xbc')](_0x374d93);}})['then'](function(_0x567d66){if(_0x567d66){return _0x567d66?{'count':_0x2d06a4,'rows':_0x567d66}:null;}})[_0xa860('0x23')](respondWithResult(_0x37bf79,null))[_0xa860('0x2d')](handleError(_0x37bf79,null));};exports[_0xa860('0x3f')]=function(_0x155e14,_0x205399,_0x5e3a34){var _0x154783,_0x2dbb72,_0x17682e;if(_['isNil'](_0x155e14[_0xa860('0x66')][_0xa860('0x66')])||_0x155e14[_0xa860('0x66')][_0xa860('0x66')]===''){throw new db[(_0xa860('0x74'))][(_0xa860('0x75'))](_0xa860('0x7c'));}if(_['isNil'](_0x155e14[_0xa860('0x66')]['to'])){}_0x154783=_0x155e14[_0xa860('0x66')]['to'];return db['OpenchannelAccount'][_0xa860('0x6c')]({'where':{'id':_0x155e14[_0xa860('0x5c')]['id']}})[_0xa860('0x23')](handleEntityNotFound(_0x205399,null))[_0xa860('0x23')](function(_0xff6782){if(_0xff6782){return db['OpenchannelAccount'][_0xa860('0x5e')]({'where':{'id':_0xff6782['id']},'include':[{'model':db[_0xa860('0x81')],'as':_0xa860('0x82'),'include':[{'model':db[_0xa860('0x73')],'as':_0xa860('0x83'),'where':{[_0xff6782['mapKey']]:_0x154783},'limit':0x1,'order':[['updatedAt',_0xa860('0x84')]]}]}]})['then'](handleEntityNotFound(_0x205399,null))[_0xa860('0x23')](function(_0x16e535){if(_0x16e535&&_0x16e535[_0xa860('0x82')]){_0x2dbb72=_0x16e535[_0xa860('0x3a')]({'plain':!![]});if(_0x2dbb72[_0xa860('0x82')]&&_0x2dbb72['List']['Contacts'][_0xa860('0x6d')]){return _0x2dbb72[_0xa860('0x82')][_0xa860('0x83')][0x0];}return db['CmContact']['create'](_[_0xa860('0x8b')](_0x155e14['body'],{'firstName':_0x154783,[_0x16e535[_0xa860('0x7e')]]:_0x154783,'phone':_0x154783,'ListId':_0x2dbb72[_0xa860('0x7a')]}));}})[_0xa860('0x23')](handleEntityNotFound(_0x205399,null))['then'](function(_0x395811){if(_0x395811){_0x17682e=_0x395811;return db['OpenchannelInteraction'][_0xa860('0x5e')]({'where':{'ContactId':_0x17682e['id'],'closed':![],'OpenchannelAccountId':_0x2dbb72['id']}})['then'](function(_0x244357){if(_0x244357){return[_0x244357,![]];}return db[_0xa860('0x90')][_0xa860('0x5f')]({'UserId':_0x155e14['user']['id'],'ContactId':_0x17682e['id'],'OpenchannelAccountId':_0x2dbb72['id'],'lastMsgDirection':_0xa860('0xbd'),'Messages':[_[_0xa860('0x55')](_0x155e14[_0xa860('0x66')],{'read':![],'body':_0x155e14[_0xa860('0x66')][_0xa860('0x66')],'OpenchannelAccountId':_0x2dbb72['id'],'UserId':_0x155e14[_0xa860('0x60')]['id'],'ContactId':_0x17682e['id']})]},{'include':[{'model':db['OpenchannelMessage'],'as':_0xa860('0xbe')}]})[_0xa860('0x23')](function(_0x465883){return[_0x465883,!![]];});});}})[_0xa860('0x92')](function(_0x424f9d,_0x59725a){if(_0x59725a){return _0x424f9d;}return db[_0xa860('0x99')][_0xa860('0x5f')](_[_0xa860('0x55')](_0x155e14[_0xa860('0x66')],{'read':![],'body':_0x155e14['body'][_0xa860('0x66')],'OpenchannelAccountId':_0x2dbb72['id'],'OpenchannelInteractionId':_0x424f9d['id'],'UserId':_0x155e14[_0xa860('0x60')]['id'],'ContactId':_0x17682e['id']}))[_0xa860('0x23')](function(_0x5af6f9){_0x424f9d[_0xa860('0xbf')]['Messages']=[];_0x424f9d['dataValues'][_0xa860('0xbe')]['push'](_0x5af6f9[_0xa860('0xbf')]);return _0x424f9d;});});}})[_0xa860('0x23')](respondWithResult(_0x205399,null))[_0xa860('0x2d')](handleError(_0x205399,null));}; \ No newline at end of file +var _0xfa90=['mandatoryDispositionPause','map','OpenchannelAccount','type','key','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','filter','where','includeAll','findAll','rows','show','params','rawAttributes','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','OpenchannelAccountId','Disposition','nolimit','options','include','removeDispositions','ids','addAnswer','CannedAnswer','findOne','pick','merge','removeAnswers','openchannel','ValidationError','difference','createdAt','updatedAt','CompanyId','Sequelize','from\x20is\x20mandatory','isNil','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey','from','CmList','List','OpenchannelApplication','Applications','applications','list','orderBy','priority','account','Contacts','ListId','CmContact','firstName','threadId','OpenchannelInteraction','externalUrl','ContactId','spread','contact','lastName','messageId','update','interaction','created','autoclose','push','close','*,*,*,*','UserId','User','unshift','agent','waitForTheAssignedAgent','forcedOwnership','Start','startRouting','EventManager','notify','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','findAndCountAll','stack','finally','getApplications','getInteractions','Contact','Owner','internal','Tag','tag','addAgents','omit','userOpenchannelAccount:save','removeAgents','isArray','userOpenchannelAccount:remove','getAgents','body\x20is\x20mandatory\x20and\x20not\x20empty','DESC','out','OpenchannelMessage','Messages','dataValues','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./openchannelAccount.socket','register','jayson/promise','http','client','then','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','OpenchannelAccount,\x20%s,\x20%s','message','info','catch','sendStatus','json','offset','undefined','limit','count','status','Content-Range','reject','save','destroy','get','OpenchannelAccounts','UserProfileResource','end','name','send','Pause'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xfa90,0x140));var _0x0fa9=function(_0x1ed7e5,_0xc20b04){_0x1ed7e5=_0x1ed7e5-0x0;var _0x10113a=_0xfa90[_0x1ed7e5];return _0x10113a;};'use strict';var emlformat=require(_0x0fa9('0x0'));var rimraf=require(_0x0fa9('0x1'));var zipdir=require(_0x0fa9('0x2'));var jsonpatch=require(_0x0fa9('0x3'));var rp=require(_0x0fa9('0x4'));var moment=require('moment');var BPromise=require(_0x0fa9('0x5'));var Mustache=require(_0x0fa9('0x6'));var util=require(_0x0fa9('0x7'));var path=require(_0x0fa9('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0fa9('0x9'));var squel=require(_0x0fa9('0xa'));var crypto=require(_0x0fa9('0xb'));var jsforce=require(_0x0fa9('0xc'));var deskjs=require(_0x0fa9('0xd'));var toCsv=require(_0x0fa9('0xe'));var querystring=require(_0x0fa9('0xf'));var Papa=require(_0x0fa9('0x10'));var Redis=require(_0x0fa9('0x11'));var authService=require(_0x0fa9('0x12'));var qs=require(_0x0fa9('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x0fa9('0x14'))('api');var utils=require(_0x0fa9('0x15'));var config=require(_0x0fa9('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x0fa9('0x17'))['db'];config[_0x0fa9('0x18')]=_[_0x0fa9('0x19')](config[_0x0fa9('0x18')],{'host':_0x0fa9('0x1a'),'port':0x18eb});var socket=require(_0x0fa9('0x1b'))(new Redis(config['redis']));require(_0x0fa9('0x1c'))[_0x0fa9('0x1d')](socket);var jayson=require(_0x0fa9('0x1e'));var client=jayson['client'][_0x0fa9('0x1f')]({'port':0x232c});var client9002=jayson[_0x0fa9('0x20')][_0x0fa9('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x5dc1c3,_0x2e3b92,_0x40b153,_0x4ae6e3){return new BPromise(function(_0x50d8f0,_0x4f11a6){var _0x2cb136=_0x4ae6e3||client;return _0x2cb136['request'](_0x5dc1c3,_0x40b153)[_0x0fa9('0x21')](function(_0x52e817){logger['info']('OpenchannelAccount,\x20%s,\x20%s',_0x2e3b92,_0x0fa9('0x22'));logger[_0x0fa9('0x23')](_0x0fa9('0x24'),_0x2e3b92,_0x0fa9('0x22'),JSON[_0x0fa9('0x25')](_0x52e817));if(_0x52e817[_0x0fa9('0x26')]){if(_0x52e817[_0x0fa9('0x26')][_0x0fa9('0x27')]===0x1f4){logger['error'](_0x0fa9('0x28'),_0x2e3b92,_0x52e817[_0x0fa9('0x26')][_0x0fa9('0x29')]);return _0x4f11a6(_0x52e817[_0x0fa9('0x26')][_0x0fa9('0x29')]);}logger['error'](_0x0fa9('0x28'),_0x2e3b92,_0x52e817[_0x0fa9('0x26')][_0x0fa9('0x29')]);return _0x50d8f0(_0x52e817[_0x0fa9('0x26')][_0x0fa9('0x29')]);}else{logger[_0x0fa9('0x2a')](_0x0fa9('0x28'),_0x2e3b92,'request\x20sent');_0x50d8f0(_0x52e817['result']['message']);}})[_0x0fa9('0x2b')](function(_0x28aaf7){logger[_0x0fa9('0x26')](_0x0fa9('0x28'),_0x2e3b92,_0x28aaf7);_0x4f11a6(_0x28aaf7);});});}function respondWithStatusCode(_0x10160b,_0x5bfe05){_0x5bfe05=_0x5bfe05||0xcc;return function(_0x2ce960){if(_0x2ce960){return _0x10160b[_0x0fa9('0x2c')](_0x5bfe05);}return _0x10160b['status'](_0x5bfe05)['end']();};}function respondWithResult(_0x3adae3,_0x472ba7){_0x472ba7=_0x472ba7||0xc8;return function(_0x3c4ec8){if(_0x3c4ec8){return _0x3adae3['status'](_0x472ba7)[_0x0fa9('0x2d')](_0x3c4ec8);}};}function respondWithFilteredResult(_0x39247c,_0x16e65c){return function(_0x3d25e7){if(_0x3d25e7){var _0x2945c4=typeof _0x16e65c[_0x0fa9('0x2e')]===_0x0fa9('0x2f')&&typeof _0x16e65c[_0x0fa9('0x30')]===_0x0fa9('0x2f');var _0x17a587=_0x3d25e7[_0x0fa9('0x31')];var _0x3d7552=_0x2945c4?0x0:_0x16e65c[_0x0fa9('0x2e')];var _0x51095e=_0x2945c4?_0x3d25e7[_0x0fa9('0x31')]:_0x16e65c[_0x0fa9('0x2e')]+_0x16e65c['limit'];var _0x3db8e0;if(_0x51095e>=_0x17a587){_0x51095e=_0x17a587;_0x3db8e0=0xc8;}else{_0x3db8e0=0xce;}_0x39247c[_0x0fa9('0x32')](_0x3db8e0);return _0x39247c['set'](_0x0fa9('0x33'),_0x3d7552+'-'+_0x51095e+'/'+_0x17a587)['json'](_0x3d25e7);}return null;};}function patchUpdates(_0x5ca84c){return function(_0x5833b8){try{jsonpatch['apply'](_0x5833b8,_0x5ca84c,!![]);}catch(_0x1e7369){return BPromise[_0x0fa9('0x34')](_0x1e7369);}return _0x5833b8[_0x0fa9('0x35')]();};}function saveUpdates(_0x3ab8be,_0x4b0cee){return function(_0x97a2a9){if(_0x97a2a9){return _0x97a2a9['update'](_0x3ab8be)['then'](function(_0x426c6e){return _0x426c6e;});}return null;};}function removeEntity(_0x5ec90c,_0x5ce792){return function(_0x8ba041){if(_0x8ba041){return _0x8ba041[_0x0fa9('0x36')]()[_0x0fa9('0x21')](function(){var _0x5eace1=_0x8ba041[_0x0fa9('0x37')]({'plain':!![]});var _0x539f6b=_0x0fa9('0x38');return db[_0x0fa9('0x39')][_0x0fa9('0x36')]({'where':{'type':_0x539f6b,'resourceId':_0x5eace1['id']}})[_0x0fa9('0x21')](function(){return _0x8ba041;});})[_0x0fa9('0x21')](function(){_0x5ec90c[_0x0fa9('0x32')](0xcc)[_0x0fa9('0x3a')]();});}};}function handleEntityNotFound(_0x8ab8ac,_0x165e56){return function(_0x800d7c){if(!_0x800d7c){_0x8ab8ac[_0x0fa9('0x2c')](0x194);}return _0x800d7c;};}function handleError(_0x191e4d,_0x183087){_0x183087=_0x183087||0x1f4;return function(_0x2bcd1c){logger[_0x0fa9('0x26')](_0x2bcd1c['stack']);if(_0x2bcd1c[_0x0fa9('0x3b')]){delete _0x2bcd1c[_0x0fa9('0x3b')];}_0x191e4d[_0x0fa9('0x32')](_0x183087)[_0x0fa9('0x3c')](_0x2bcd1c);};}exports['index']=function(_0x534b40,_0x5d8454){var _0x5d5c9b={'include':[{'model':db[_0x0fa9('0x3d')],'as':_0x0fa9('0x3e')}]},_0x169a34={},_0x204f19={'count':0x0,'rows':[]};var _0x4054d3=_[_0x0fa9('0x3f')](db[_0x0fa9('0x40')]['rawAttributes'],function(_0x5218de){return{'name':_0x5218de['fieldName'],'type':_0x5218de[_0x0fa9('0x41')][_0x0fa9('0x42')]};});_0x169a34[_0x0fa9('0x43')]=_[_0x0fa9('0x3f')](_0x4054d3,_0x0fa9('0x3b'));_0x169a34['query']=_[_0x0fa9('0x44')](_0x534b40[_0x0fa9('0x45')]);_0x169a34[_0x0fa9('0x46')]=_[_0x0fa9('0x47')](_0x169a34['model'],_0x169a34[_0x0fa9('0x45')]);_0x5d5c9b['attributes']=_[_0x0fa9('0x47')](_0x169a34[_0x0fa9('0x43')],qs[_0x0fa9('0x48')](_0x534b40[_0x0fa9('0x45')]['fields']));_0x5d5c9b['attributes']=_0x5d5c9b[_0x0fa9('0x49')][_0x0fa9('0x4a')]?_0x5d5c9b[_0x0fa9('0x49')]:_0x169a34['model'];if(!_0x534b40['query'][_0x0fa9('0x4b')]('nolimit')){_0x5d5c9b[_0x0fa9('0x30')]=qs[_0x0fa9('0x30')](_0x534b40[_0x0fa9('0x45')][_0x0fa9('0x30')]);_0x5d5c9b[_0x0fa9('0x2e')]=qs[_0x0fa9('0x2e')](_0x534b40['query'][_0x0fa9('0x2e')]);}_0x5d5c9b[_0x0fa9('0x4c')]=qs[_0x0fa9('0x4d')](_0x534b40[_0x0fa9('0x45')][_0x0fa9('0x4d')]);_0x5d5c9b['where']=qs[_0x0fa9('0x46')](_['pick'](_0x534b40[_0x0fa9('0x45')],_0x169a34['filters']),_0x4054d3);if(_0x534b40[_0x0fa9('0x45')][_0x0fa9('0x4e')]){_0x5d5c9b['where']=_['merge'](_0x5d5c9b['where'],{'$or':_[_0x0fa9('0x3f')](_0x4054d3,function(_0x973d9b){if(_0x973d9b[_0x0fa9('0x41')]!=='VIRTUAL'){var _0x3143d0={};_0x3143d0[_0x973d9b[_0x0fa9('0x3b')]]={'$like':'%'+_0x534b40['query'][_0x0fa9('0x4e')]+'%'};return _0x3143d0;}})});}_0x5d5c9b=_['merge']({},_0x5d5c9b,_0x534b40['options']);var _0x281852={'where':_0x5d5c9b[_0x0fa9('0x4f')]};return db[_0x0fa9('0x40')][_0x0fa9('0x31')](_0x281852)[_0x0fa9('0x21')](function(_0x3f58c7){_0x204f19[_0x0fa9('0x31')]=_0x3f58c7;if(_0x534b40[_0x0fa9('0x45')][_0x0fa9('0x50')]){_0x5d5c9b['include']=[{'all':!![]}];}return db[_0x0fa9('0x40')][_0x0fa9('0x51')](_0x5d5c9b);})['then'](function(_0x1f29ce){_0x204f19[_0x0fa9('0x52')]=_0x1f29ce;return _0x204f19;})[_0x0fa9('0x21')](respondWithFilteredResult(_0x5d8454,_0x5d5c9b))[_0x0fa9('0x2b')](handleError(_0x5d8454,null));};exports[_0x0fa9('0x53')]=function(_0x2018f0,_0x25f8f7){var _0x549c13={'raw':![],'where':{'id':_0x2018f0[_0x0fa9('0x54')]['id']},'include':[{'model':db[_0x0fa9('0x3d')],'as':_0x0fa9('0x3e')}]},_0x5a3b5f={};_0x5a3b5f[_0x0fa9('0x43')]=_[_0x0fa9('0x44')](db[_0x0fa9('0x40')][_0x0fa9('0x55')]);_0x5a3b5f['query']=_[_0x0fa9('0x44')](_0x2018f0['query']);_0x5a3b5f[_0x0fa9('0x46')]=_['intersection'](_0x5a3b5f['model'],_0x5a3b5f[_0x0fa9('0x45')]);_0x549c13[_0x0fa9('0x49')]=_['intersection'](_0x5a3b5f[_0x0fa9('0x43')],qs[_0x0fa9('0x48')](_0x2018f0['query'][_0x0fa9('0x48')]));_0x549c13[_0x0fa9('0x49')]=_0x549c13[_0x0fa9('0x49')][_0x0fa9('0x4a')]?_0x549c13[_0x0fa9('0x49')]:_0x5a3b5f['model'];if(_0x2018f0[_0x0fa9('0x45')][_0x0fa9('0x50')]){_0x549c13['include']=[{'all':!![]}];}_0x549c13=_['merge']({},_0x549c13,_0x2018f0['options']);return db[_0x0fa9('0x40')][_0x0fa9('0x56')](_0x549c13)[_0x0fa9('0x21')](handleEntityNotFound(_0x25f8f7,null))['then'](respondWithResult(_0x25f8f7,null))[_0x0fa9('0x2b')](handleError(_0x25f8f7,null));};exports['create']=function(_0x350c4f,_0xfae1cb){return db['OpenchannelAccount'][_0x0fa9('0x57')](_0x350c4f[_0x0fa9('0x58')],{})[_0x0fa9('0x21')](function(_0x4944f8){var _0x1ad3a1=_0x350c4f[_0x0fa9('0x59')][_0x0fa9('0x37')]({'plain':!![]});if(!_0x1ad3a1)throw new Error(_0x0fa9('0x5a'));if(_0x1ad3a1[_0x0fa9('0x5b')]==='user'){var _0x4cad7b=_0x4944f8[_0x0fa9('0x37')]({'plain':!![]});var _0x47522e=_0x0fa9('0x38');return db[_0x0fa9('0x5c')][_0x0fa9('0x56')]({'where':{'name':_0x47522e,'userProfileId':_0x1ad3a1[_0x0fa9('0x5d')]},'raw':!![]})[_0x0fa9('0x21')](function(_0x56ac60){if(_0x56ac60&&_0x56ac60['autoAssociation']===0x0){return db[_0x0fa9('0x39')][_0x0fa9('0x57')]({'name':_0x4cad7b[_0x0fa9('0x3b')],'resourceId':_0x4cad7b['id'],'type':_0x56ac60['name'],'sectionId':_0x56ac60['id']},{})['then'](function(){return _0x4944f8;});}else{return _0x4944f8;}})[_0x0fa9('0x2b')](function(_0x224c69){logger[_0x0fa9('0x26')](_0x0fa9('0x5e'),_0x224c69);throw _0x224c69;});}return _0x4944f8;})[_0x0fa9('0x21')](respondWithResult(_0xfae1cb,0xc9))[_0x0fa9('0x2b')](handleError(_0xfae1cb,null));};exports['update']=function(_0x14e0a6,_0x13a6a4){if(_0x14e0a6[_0x0fa9('0x58')]['id']){delete _0x14e0a6[_0x0fa9('0x58')]['id'];}return db['OpenchannelAccount'][_0x0fa9('0x56')]({'where':{'id':_0x14e0a6[_0x0fa9('0x54')]['id']},'include':[{'model':db[_0x0fa9('0x3d')],'as':_0x0fa9('0x3e')}]})[_0x0fa9('0x21')](handleEntityNotFound(_0x13a6a4,null))['then'](saveUpdates(_0x14e0a6[_0x0fa9('0x58')],null))[_0x0fa9('0x21')](respondWithResult(_0x13a6a4,null))[_0x0fa9('0x2b')](handleError(_0x13a6a4,null));};exports[_0x0fa9('0x36')]=function(_0x4a96a8,_0x13d590){return db[_0x0fa9('0x40')][_0x0fa9('0x56')]({'where':{'id':_0x4a96a8[_0x0fa9('0x54')]['id']}})['then'](handleEntityNotFound(_0x13d590,null))[_0x0fa9('0x21')](removeEntity(_0x13d590,null))['catch'](handleError(_0x13d590,null));};exports[_0x0fa9('0x5f')]=function(_0x4e7986,_0x74509d){return db['OpenchannelAccount'][_0x0fa9('0x5f')]()[_0x0fa9('0x21')](respondWithResult(_0x74509d,null))[_0x0fa9('0x2b')](handleError(_0x74509d,null));};exports[_0x0fa9('0x60')]=function(_0x333085,_0x538457,_0x14f3aa){if(_0x333085[_0x0fa9('0x58')]['id']){delete _0x333085[_0x0fa9('0x58')]['id'];}return db['OpenchannelAccount']['find']({'where':{'id':_0x333085[_0x0fa9('0x54')]['id']}})[_0x0fa9('0x21')](handleEntityNotFound(_0x538457,null))['then'](function(_0x2d238f){if(_0x2d238f){_0x333085[_0x0fa9('0x58')][_0x0fa9('0x61')]=_0x2d238f['id'];return db[_0x0fa9('0x62')][_0x0fa9('0x57')](_0x333085[_0x0fa9('0x58')]);}})['then'](respondWithResult(_0x538457,null))[_0x0fa9('0x2b')](handleError(_0x538457,null));};exports['getDispositions']=function(_0x26b921,_0x3f258a,_0x3fe211){var _0x3d9eec={'raw':![],'where':{}};var _0x18f560={};var _0x444c39={'count':0x0,'rows':[]};return db['OpenchannelAccount']['findOne']({'where':{'id':_0x26b921[_0x0fa9('0x54')]['id']}})[_0x0fa9('0x21')](handleEntityNotFound(_0x3f258a,null))[_0x0fa9('0x21')](function(_0x593948){if(_0x593948){_0x18f560[_0x0fa9('0x43')]=_[_0x0fa9('0x44')](db[_0x0fa9('0x62')][_0x0fa9('0x55')]);_0x18f560[_0x0fa9('0x45')]=_[_0x0fa9('0x44')](_0x26b921[_0x0fa9('0x45')]);_0x18f560['filters']=_[_0x0fa9('0x47')](_0x18f560[_0x0fa9('0x43')],_0x18f560[_0x0fa9('0x45')]);_0x3d9eec[_0x0fa9('0x49')]=_[_0x0fa9('0x47')](_0x18f560['model'],qs[_0x0fa9('0x48')](_0x26b921['query'][_0x0fa9('0x48')]));_0x3d9eec[_0x0fa9('0x49')]=_0x3d9eec['attributes'][_0x0fa9('0x4a')]?_0x3d9eec[_0x0fa9('0x49')]:_0x18f560[_0x0fa9('0x43')];if(!_0x26b921[_0x0fa9('0x45')][_0x0fa9('0x4b')](_0x0fa9('0x63'))){_0x3d9eec['limit']=qs[_0x0fa9('0x30')](_0x26b921[_0x0fa9('0x45')][_0x0fa9('0x30')]);_0x3d9eec[_0x0fa9('0x2e')]=qs['offset'](_0x26b921[_0x0fa9('0x45')][_0x0fa9('0x2e')]);}_0x3d9eec[_0x0fa9('0x4c')]=qs[_0x0fa9('0x4d')](_0x26b921['query'][_0x0fa9('0x4d')]);_0x3d9eec[_0x0fa9('0x4f')]=qs[_0x0fa9('0x46')](_['pick'](_0x26b921[_0x0fa9('0x45')],_0x18f560[_0x0fa9('0x46')]));_0x3d9eec[_0x0fa9('0x4f')][_0x0fa9('0x61')]=_0x593948['id'];if(_0x26b921[_0x0fa9('0x45')][_0x0fa9('0x4e')]){_0x3d9eec[_0x0fa9('0x4f')]=_['merge'](_0x3d9eec['where'],{'$or':_[_0x0fa9('0x3f')](_0x3d9eec[_0x0fa9('0x49')],function(_0x2ffda1){var _0x3ba4d6={};_0x3ba4d6[_0x2ffda1]={'$like':'%'+_0x26b921['query']['filter']+'%'};return _0x3ba4d6;})});}_0x3d9eec=_['merge']({},_0x3d9eec,_0x26b921[_0x0fa9('0x64')]);return db[_0x0fa9('0x62')][_0x0fa9('0x31')]({'where':_0x3d9eec['where']})[_0x0fa9('0x21')](function(_0x3a5e73){_0x444c39[_0x0fa9('0x31')]=_0x3a5e73;if(_0x26b921[_0x0fa9('0x45')][_0x0fa9('0x50')]){_0x3d9eec[_0x0fa9('0x65')]=[{'all':!![]}];}return db[_0x0fa9('0x62')][_0x0fa9('0x51')](_0x3d9eec);})[_0x0fa9('0x21')](function(_0x4298ed){_0x444c39[_0x0fa9('0x52')]=_0x4298ed;return _0x444c39;});}})['then'](respondWithFilteredResult(_0x3f258a,_0x3d9eec))[_0x0fa9('0x2b')](handleError(_0x3f258a,null));};exports[_0x0fa9('0x66')]=function(_0x4a637c,_0x348a1e,_0x2bb94e){return db[_0x0fa9('0x40')][_0x0fa9('0x56')]({'where':{'id':_0x4a637c[_0x0fa9('0x54')]['id']}})[_0x0fa9('0x21')](handleEntityNotFound(_0x348a1e,null))['then'](function(_0x1a68ff){if(_0x1a68ff){return _0x1a68ff[_0x0fa9('0x66')](_0x4a637c[_0x0fa9('0x45')][_0x0fa9('0x67')]);}})[_0x0fa9('0x21')](respondWithStatusCode(_0x348a1e,null))[_0x0fa9('0x2b')](handleError(_0x348a1e,null));};exports[_0x0fa9('0x68')]=function(_0x243a2f,_0x15661a,_0x215909){if(_0x243a2f['body']['id']){delete _0x243a2f['body']['id'];}return db[_0x0fa9('0x40')][_0x0fa9('0x56')]({'where':{'id':_0x243a2f[_0x0fa9('0x54')]['id']}})['then'](handleEntityNotFound(_0x15661a,null))[_0x0fa9('0x21')](function(_0x2e925e){if(_0x2e925e){_0x243a2f['body']['OpenchannelAccountId']=_0x2e925e['id'];return db[_0x0fa9('0x69')][_0x0fa9('0x57')](_0x243a2f[_0x0fa9('0x58')]);}})['then'](respondWithResult(_0x15661a,null))['catch'](handleError(_0x15661a,null));};exports['getAnswers']=function(_0x24c10a,_0x3aa72c,_0x29a900){var _0x2e4e62={'raw':![],'where':{}};var _0x4f4399={};var _0x2898ae={'count':0x0,'rows':[]};return db[_0x0fa9('0x40')][_0x0fa9('0x6a')]({'where':{'id':_0x24c10a[_0x0fa9('0x54')]['id']}})[_0x0fa9('0x21')](handleEntityNotFound(_0x3aa72c,null))[_0x0fa9('0x21')](function(_0x13872c){if(_0x13872c){_0x4f4399[_0x0fa9('0x43')]=_[_0x0fa9('0x44')](db[_0x0fa9('0x69')]['rawAttributes']);_0x4f4399[_0x0fa9('0x45')]=_[_0x0fa9('0x44')](_0x24c10a['query']);_0x4f4399['filters']=_[_0x0fa9('0x47')](_0x4f4399['model'],_0x4f4399[_0x0fa9('0x45')]);_0x2e4e62[_0x0fa9('0x49')]=_['intersection'](_0x4f4399[_0x0fa9('0x43')],qs['fields'](_0x24c10a['query']['fields']));_0x2e4e62[_0x0fa9('0x49')]=_0x2e4e62['attributes'][_0x0fa9('0x4a')]?_0x2e4e62[_0x0fa9('0x49')]:_0x4f4399[_0x0fa9('0x43')];if(!_0x24c10a[_0x0fa9('0x45')]['hasOwnProperty'](_0x0fa9('0x63'))){_0x2e4e62[_0x0fa9('0x30')]=qs[_0x0fa9('0x30')](_0x24c10a[_0x0fa9('0x45')]['limit']);_0x2e4e62[_0x0fa9('0x2e')]=qs['offset'](_0x24c10a[_0x0fa9('0x45')][_0x0fa9('0x2e')]);}_0x2e4e62[_0x0fa9('0x4c')]=qs[_0x0fa9('0x4d')](_0x24c10a[_0x0fa9('0x45')][_0x0fa9('0x4d')]);_0x2e4e62[_0x0fa9('0x4f')]=qs['filters'](_[_0x0fa9('0x6b')](_0x24c10a[_0x0fa9('0x45')],_0x4f4399['filters']));_0x2e4e62[_0x0fa9('0x4f')][_0x0fa9('0x61')]=_0x13872c['id'];if(_0x24c10a[_0x0fa9('0x45')][_0x0fa9('0x4e')]){_0x2e4e62['where']=_[_0x0fa9('0x6c')](_0x2e4e62[_0x0fa9('0x4f')],{'$or':_[_0x0fa9('0x3f')](_0x2e4e62[_0x0fa9('0x49')],function(_0x12a8bd){var _0x162f4c={};_0x162f4c[_0x12a8bd]={'$like':'%'+_0x24c10a[_0x0fa9('0x45')][_0x0fa9('0x4e')]+'%'};return _0x162f4c;})});}_0x2e4e62=_['merge']({},_0x2e4e62,_0x24c10a[_0x0fa9('0x64')]);return db[_0x0fa9('0x69')][_0x0fa9('0x31')]({'where':_0x2e4e62[_0x0fa9('0x4f')]})[_0x0fa9('0x21')](function(_0x541dd9){_0x2898ae[_0x0fa9('0x31')]=_0x541dd9;if(_0x24c10a[_0x0fa9('0x45')][_0x0fa9('0x50')]){_0x2e4e62['include']=[{'all':!![]}];}return db[_0x0fa9('0x69')][_0x0fa9('0x51')](_0x2e4e62);})[_0x0fa9('0x21')](function(_0x5009e3){_0x2898ae[_0x0fa9('0x52')]=_0x5009e3;return _0x2898ae;});}})['then'](respondWithFilteredResult(_0x3aa72c,_0x2e4e62))[_0x0fa9('0x2b')](handleError(_0x3aa72c,null));};exports['removeAnswers']=function(_0x15b21f,_0xa2f0cc,_0xfcee8c){return db[_0x0fa9('0x40')][_0x0fa9('0x56')]({'where':{'id':_0x15b21f[_0x0fa9('0x54')]['id']}})['then'](handleEntityNotFound(_0xa2f0cc,null))['then'](function(_0x49d1d1){if(_0x49d1d1){return _0x49d1d1[_0x0fa9('0x6d')](_0x15b21f[_0x0fa9('0x45')]['ids']);}})[_0x0fa9('0x21')](respondWithStatusCode(_0xa2f0cc,null))[_0x0fa9('0x2b')](handleError(_0xa2f0cc,null));};exports['notify']=function(_0x507fa4,_0x4f7e80,_0x3ccda5){var _0x14e555={'body':_0x507fa4[_0x0fa9('0x58')],'channel':_0x0fa9('0x6e')};var _0x1c26e0=[];var _0x149cad=[];var _0x3b6f8b={};var _0x3c4a67=![];return db['CmContact'][_0x0fa9('0x5f')]()['then'](function(_0x558d2f){if(!_0x558d2f){throw new db['Sequelize'][(_0x0fa9('0x6f'))]('no\x20available\x20attributes');}_0x1c26e0=_[_0x0fa9('0x70')](_[_0x0fa9('0x44')](_0x558d2f),[_0x0fa9('0x71'),_0x0fa9('0x72')]);_0x149cad=_['difference'](_[_0x0fa9('0x44')](_0x558d2f),['createdAt',_0x0fa9('0x72'),_0x0fa9('0x73'),'ListId']);if(_0x507fa4['body']['id']){delete _0x507fa4[_0x0fa9('0x58')]['id'];}if(_['isNil'](_0x507fa4['body']['from'])){throw new db[(_0x0fa9('0x74'))][(_0x0fa9('0x6f'))](_0x0fa9('0x75'));}if(_[_0x0fa9('0x76')](_0x507fa4[_0x0fa9('0x58')][_0x0fa9('0x58')])||_0x507fa4['body']['body']===''){throw new db[(_0x0fa9('0x74'))][(_0x0fa9('0x6f'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x0fa9('0x76')](_0x507fa4[_0x0fa9('0x58')]['mapKey'])){throw new db['Sequelize'][(_0x0fa9('0x6f'))](_0x0fa9('0x77')+_0x149cad);}if(!_[_0x0fa9('0x78')](_0x149cad,_0x507fa4['body']['mapKey'])){throw new db[(_0x0fa9('0x74'))][(_0x0fa9('0x6f'))](_0x0fa9('0x79')+_0x149cad);}_0x3b6f8b[_0x507fa4[_0x0fa9('0x58')][_0x0fa9('0x7a')]]=_0x507fa4[_0x0fa9('0x58')][_0x0fa9('0x7b')];})['then'](function(){return db[_0x0fa9('0x40')]['find']({'where':{'id':_0x507fa4[_0x0fa9('0x54')]['id']},'include':[{'model':db[_0x0fa9('0x7c')],'as':_0x0fa9('0x7d'),'include':[{'model':db['CmContact'],'as':'Contacts','where':_0x3b6f8b,'limit':0x1,'order':[[_0x0fa9('0x72'),'DESC']]}]},{'model':db[_0x0fa9('0x7e')],'as':_0x0fa9('0x7f')}]});})[_0x0fa9('0x21')](handleEntityNotFound(_0x4f7e80,null))[_0x0fa9('0x21')](function(_0x3fdf1a){if(_0x3fdf1a&&_0x3fdf1a['List']){_0x14e555['account']=_0x3fdf1a;_0x14e555[_0x0fa9('0x80')]=_0x3fdf1a['Applications'];_0x14e555[_0x0fa9('0x81')]=_0x3fdf1a[_0x0fa9('0x7d')];_0x14e555[_0x0fa9('0x80')]=_[_0x0fa9('0x82')](_0x14e555[_0x0fa9('0x80')],[_0x0fa9('0x83')],['asc']);if(_0x14e555[_0x0fa9('0x84')][_0x0fa9('0x7f')]){delete _0x14e555[_0x0fa9('0x84')][_0x0fa9('0x7f')];}if(_0x14e555['account'][_0x0fa9('0x7d')]&&_0x14e555['account'][_0x0fa9('0x7d')][_0x0fa9('0x85')][_0x0fa9('0x4a')]){return _0x14e555['account']['List'][_0x0fa9('0x85')][0x0];}var _0x396f2f=_[_0x0fa9('0x19')](_0x507fa4[_0x0fa9('0x58')],{'firstName':_0x507fa4[_0x0fa9('0x58')][_0x0fa9('0x7b')],'ListId':_0x3fdf1a[_0x0fa9('0x86')]});_0x396f2f[_0x507fa4[_0x0fa9('0x58')][_0x0fa9('0x7a')]]=_0x507fa4[_0x0fa9('0x58')][_0x0fa9('0x7b')];return db[_0x0fa9('0x87')][_0x0fa9('0x57')](_0x396f2f,{'fields':_0x1c26e0,'raw':!![]});}})[_0x0fa9('0x21')](handleEntityNotFound(_0x4f7e80,null))['then'](function(_0x2cdd13){_0x14e555['contact']=_0x2cdd13;if(_0x2cdd13){var _0x172c06={'ContactId':_0x2cdd13['id'],'OpenchannelAccountId':_0x507fa4['params']['id'],'from':(_0x2cdd13[_0x0fa9('0x88')]||'')+'\x20'+(_0x2cdd13['lastName']||'')};var _0x3ed0a9={'OpenchannelAccountId':_0x507fa4[_0x0fa9('0x54')]['id'],'closed':![]};if(_0x507fa4[_0x0fa9('0x58')][_0x0fa9('0x89')]){_0x3ed0a9[_0x0fa9('0x89')]=_0x507fa4[_0x0fa9('0x58')][_0x0fa9('0x89')];return db[_0x0fa9('0x8a')]['find']({'where':_0x3ed0a9})[_0x0fa9('0x21')](function(_0x59d91e){if(_0x59d91e){return[_0x59d91e,![]];}_0x172c06[_0x0fa9('0x89')]=_0x507fa4[_0x0fa9('0x58')][_0x0fa9('0x89')];_0x172c06[_0x0fa9('0x8b')]=_0x507fa4[_0x0fa9('0x58')][_0x0fa9('0x8b')];return db[_0x0fa9('0x8a')]['create'](_0x172c06)['then'](function(_0x3f92f1){return[_0x3f92f1,!![]];});});}else{_0x3ed0a9['threadId']=null;}_0x3ed0a9[_0x0fa9('0x8c')]=_0x2cdd13['id'];return db[_0x0fa9('0x8a')][_0x0fa9('0x56')]({'where':_0x3ed0a9})[_0x0fa9('0x21')](function(_0x5bf758){if(_0x5bf758){return[_0x5bf758,![]];}return db['OpenchannelInteraction'][_0x0fa9('0x57')](_0x172c06)[_0x0fa9('0x21')](function(_0x2fb898){return[_0x2fb898,!![]];});});}})[_0x0fa9('0x8d')](function(_0x49bdea,_0x24c076){if(_0x49bdea){_0x3c4a67=_0x24c076;if(!_0x24c076){var _0x306ce2={'from':(_0x14e555[_0x0fa9('0x8e')]['firstName']||'')+'\x20'+(_0x14e555[_0x0fa9('0x8e')][_0x0fa9('0x8f')]||'')};if(_0x507fa4['body'][_0x0fa9('0x89')]&&_0x507fa4[_0x0fa9('0x58')]['messageId']&&_0x507fa4[_0x0fa9('0x58')]['threadId']!=_0x507fa4[_0x0fa9('0x58')]['messageId']){_0x306ce2[_0x0fa9('0x89')]=_0x507fa4[_0x0fa9('0x58')][_0x0fa9('0x90')];}return _0x49bdea[_0x0fa9('0x91')](_0x306ce2);}else{return _0x49bdea;}}})['then'](function(_0x479e8c){_0x14e555[_0x0fa9('0x92')]=_0x479e8c['get']({'plain':!![]});_0x14e555[_0x0fa9('0x92')][_0x0fa9('0x93')]=_0x3c4a67;if(_0x14e555[_0x0fa9('0x92')]['created']){if(_0x14e555[_0x0fa9('0x84')][_0x0fa9('0x94')]){_0x14e555[_0x0fa9('0x80')][_0x0fa9('0x95')]({'id':0x0,'priority':_0x14e555[_0x0fa9('0x80')][_0x0fa9('0x4a')]+0x1,'app':_0x0fa9('0x96'),'appdata':'unmanaged','interval':_0x0fa9('0x97')});}}return db['OpenchannelMessage'][_0x0fa9('0x57')]({'body':_0x507fa4[_0x0fa9('0x58')][_0x0fa9('0x58')],'OpenchannelAccountId':_0x507fa4[_0x0fa9('0x54')]['id'],'OpenchannelInteractionId':_0x479e8c['id'],'direction':'in','ContactId':_0x14e555[_0x0fa9('0x8e')]['id'],'AttachmentId':_0x507fa4[_0x0fa9('0x58')]['AttachmentId']});})[_0x0fa9('0x21')](function(_0x557dae){_0x14e555[_0x0fa9('0x29')]=_0x557dae;if(_0x14e555[_0x0fa9('0x92')][_0x0fa9('0x98')]){return db[_0x0fa9('0x99')][_0x0fa9('0x56')]({'attributes':['id','name'],'where':{'id':_0x14e555[_0x0fa9('0x92')][_0x0fa9('0x98')]}})[_0x0fa9('0x21')](function(_0x1cf9c0){if(_0x1cf9c0){_0x14e555[_0x0fa9('0x80')][_0x0fa9('0x9a')]({'id':0x0,'priority':0x0,'app':_0x0fa9('0x9b'),'appdata':_0x1cf9c0[_0x0fa9('0x3b')]+','+(_0x14e555[_0x0fa9('0x84')][_0x0fa9('0x9c')]||0xa),'interval':'*,*,*,*'});_0x14e555[_0x0fa9('0x9d')]=![];}return respondWithRpcPromise(_0x0fa9('0x9e'),_0x0fa9('0x9f'),_0x14e555);});}return respondWithRpcPromise(_0x0fa9('0x9e'),'startRouting',_0x14e555);})['then'](function(_0x19e95a){respondWithRpcPromise(_0x0fa9('0xa0'),_0x0fa9('0xa0'),{'event':_0x0fa9('0xa1'),'message':_0x19e95a},client9002);return _0x19e95a;})[_0x0fa9('0x21')](respondWithResult(_0x4f7e80,null))[_0x0fa9('0x2b')](handleError(_0x4f7e80,null));};exports[_0x0fa9('0xa2')]=function(_0x5dde4b,_0x2db369){var _0x59db65=_0x5dde4b[_0x0fa9('0x54')]['id'];var _0x5cd78c=_0x5dde4b[_0x0fa9('0x58')];var _0xd9da97=0xc8;var _0x232e8a=null;return db[_0x0fa9('0xa3')][_0x0fa9('0xa4')]({'isolationLevel':db[_0x0fa9('0xa3')][_0x0fa9('0xa5')][_0x0fa9('0xa6')][_0x0fa9('0xa7')]},function(_0x1ebb8a){return db['OpenchannelAccount'][_0x0fa9('0x6a')]({'where':{'id':_0x59db65},'transaction':_0x1ebb8a})[_0x0fa9('0x21')](function(_0x49f083){if(_0x49f083){return db[_0x0fa9('0x7e')]['destroy']({'where':{'OpenchannelAccountId':_0x59db65},'transaction':_0x1ebb8a})[_0x0fa9('0x21')](function(){var _0x95794b=_[_0x0fa9('0x3f')](_0x5cd78c,function(_0x578a2a){_0x578a2a[_0x0fa9('0x61')]=_0x59db65;return _0x578a2a;});return db['OpenchannelApplication']['bulkCreate'](_0x95794b,{'transaction':_0x1ebb8a});});}else{_0xd9da97=0x194;_0x232e8a=[];}});})[_0x0fa9('0x21')](function(){if(_0xd9da97!==0x194){return db[_0x0fa9('0x7e')][_0x0fa9('0xa8')]({'where':{'OpenchannelAccountId':_0x59db65},'order':_0x0fa9('0x83')})['then'](function(_0x30a4d7){_0x232e8a=_0x30a4d7;});}})[_0x0fa9('0x2b')](function(_0x330611){_0xd9da97=0x1f4;logger[_0x0fa9('0x26')](_0x330611[_0x0fa9('0xa9')]);if(_0x330611[_0x0fa9('0x3b')]){delete _0x330611[_0x0fa9('0x3b')];}_0x232e8a=_0x330611;})[_0x0fa9('0xaa')](function(){if(_0x232e8a===null){_0x2db369[_0x0fa9('0x2c')](_0xd9da97);}else{if(_0xd9da97===0x1f4){_0x2db369[_0x0fa9('0x32')](_0xd9da97)[_0x0fa9('0x3c')](_0x232e8a);}else{_0x2db369[_0x0fa9('0x32')](_0xd9da97)['json'](_0x232e8a);}}});};exports[_0x0fa9('0xab')]=function(_0x1e387f,_0x2b3033,_0x1a59d4){var _0x19e75d={};var _0x189eba={};var _0x2923ee;var _0x22c764;return db['OpenchannelAccount'][_0x0fa9('0x6a')]({'where':{'id':_0x1e387f[_0x0fa9('0x54')]['id']}})[_0x0fa9('0x21')](handleEntityNotFound(_0x2b3033,null))[_0x0fa9('0x21')](function(_0x32c0b3){if(_0x32c0b3){_0x2923ee=_0x32c0b3;_0x189eba[_0x0fa9('0x43')]=_[_0x0fa9('0x44')](db[_0x0fa9('0x7e')][_0x0fa9('0x55')]);_0x189eba[_0x0fa9('0x45')]=_['keys'](_0x1e387f[_0x0fa9('0x45')]);_0x189eba[_0x0fa9('0x46')]=_['intersection'](_0x189eba[_0x0fa9('0x43')],_0x189eba[_0x0fa9('0x45')]);_0x19e75d[_0x0fa9('0x49')]=_[_0x0fa9('0x47')](_0x189eba[_0x0fa9('0x43')],qs[_0x0fa9('0x48')](_0x1e387f[_0x0fa9('0x45')][_0x0fa9('0x48')]));_0x19e75d['attributes']=_0x19e75d['attributes'][_0x0fa9('0x4a')]?_0x19e75d[_0x0fa9('0x49')]:_0x189eba[_0x0fa9('0x43')];_0x19e75d[_0x0fa9('0x4c')]=qs['sort'](_0x1e387f[_0x0fa9('0x45')][_0x0fa9('0x4d')]);_0x19e75d['where']=qs[_0x0fa9('0x46')](_[_0x0fa9('0x6b')](_0x1e387f[_0x0fa9('0x45')],_0x189eba[_0x0fa9('0x46')]));if(_0x1e387f['query'][_0x0fa9('0x4e')]){_0x19e75d['where']=_['merge'](_0x19e75d[_0x0fa9('0x4f')],{'$or':_['map'](_0x19e75d[_0x0fa9('0x49')],function(_0x4f71b2){var _0x23a485={};_0x23a485[_0x4f71b2]={'$like':'%'+_0x1e387f['query'][_0x0fa9('0x4e')]+'%'};return _0x23a485;})});}_0x19e75d=_['merge']({},_0x19e75d,_0x1e387f[_0x0fa9('0x64')]);return _0x2923ee[_0x0fa9('0xab')](_0x19e75d);}})[_0x0fa9('0x21')](function(_0x3864a5){if(_0x3864a5){_0x22c764=_0x3864a5[_0x0fa9('0x4a')];if(!_0x1e387f[_0x0fa9('0x45')][_0x0fa9('0x4b')](_0x0fa9('0x63'))){_0x19e75d[_0x0fa9('0x30')]=qs[_0x0fa9('0x30')](_0x1e387f[_0x0fa9('0x45')]['limit']);_0x19e75d['offset']=qs[_0x0fa9('0x2e')](_0x1e387f[_0x0fa9('0x45')]['offset']);}return _0x2923ee[_0x0fa9('0xab')](_0x19e75d);}})[_0x0fa9('0x21')](function(_0x37d0d4){if(_0x37d0d4){return _0x37d0d4?{'count':_0x22c764,'rows':_0x37d0d4}:null;}})[_0x0fa9('0x21')](respondWithResult(_0x2b3033,null))[_0x0fa9('0x2b')](handleError(_0x2b3033,null));};exports[_0x0fa9('0xac')]=function(_0x269117,_0x5b4b4f,_0x2d9f1f){var _0x230645={'raw':![],'where':{}};var _0x2b1bd0={};var _0x4c6012={'count':0x0,'rows':[]};return db[_0x0fa9('0x40')][_0x0fa9('0x6a')]({'where':{'id':_0x269117[_0x0fa9('0x54')]['id']}})[_0x0fa9('0x21')](handleEntityNotFound(_0x5b4b4f,null))[_0x0fa9('0x21')](function(_0xbbb77d){if(_0xbbb77d){_0x2b1bd0[_0x0fa9('0x43')]=_[_0x0fa9('0x44')](db[_0x0fa9('0x8a')]['rawAttributes']);_0x2b1bd0[_0x0fa9('0x45')]=_['keys'](_0x269117[_0x0fa9('0x45')]);_0x2b1bd0[_0x0fa9('0x46')]=_[_0x0fa9('0x47')](_0x2b1bd0['model'],_0x2b1bd0[_0x0fa9('0x45')]);_0x230645[_0x0fa9('0x49')]=_[_0x0fa9('0x47')](_0x2b1bd0['model'],qs[_0x0fa9('0x48')](_0x269117[_0x0fa9('0x45')][_0x0fa9('0x48')]));_0x230645[_0x0fa9('0x49')]=_0x230645[_0x0fa9('0x49')][_0x0fa9('0x4a')]?_0x230645['attributes']:_0x2b1bd0[_0x0fa9('0x43')];if(!_0x269117[_0x0fa9('0x45')][_0x0fa9('0x4b')](_0x0fa9('0x63'))){_0x230645[_0x0fa9('0x30')]=qs[_0x0fa9('0x30')](_0x269117['query'][_0x0fa9('0x30')]);_0x230645[_0x0fa9('0x2e')]=qs[_0x0fa9('0x2e')](_0x269117['query']['offset']);}_0x230645[_0x0fa9('0x4c')]=qs[_0x0fa9('0x4d')](_0x269117['query'][_0x0fa9('0x4d')]);_0x230645[_0x0fa9('0x4f')]=qs[_0x0fa9('0x46')](_[_0x0fa9('0x6b')](_0x269117['query'],_0x2b1bd0['filters']));_0x230645[_0x0fa9('0x4f')][_0x0fa9('0x61')]=_0xbbb77d['id'];if(_0x269117[_0x0fa9('0x45')]['filter']){_0x230645[_0x0fa9('0x4f')]=_[_0x0fa9('0x6c')](_0x230645[_0x0fa9('0x4f')],{'$or':_[_0x0fa9('0x3f')](_0x230645['attributes'],function(_0x3d9cd6){var _0x36f422={};_0x36f422[_0x3d9cd6]={'$like':'%'+_0x269117['query'][_0x0fa9('0x4e')]+'%'};return _0x36f422;})});}_0x230645=_['merge']({},_0x230645,_0x269117[_0x0fa9('0x64')]);return db['OpenchannelInteraction'][_0x0fa9('0x31')]({'where':_0x230645[_0x0fa9('0x4f')]})[_0x0fa9('0x21')](function(_0xe8c65b){_0x4c6012[_0x0fa9('0x31')]=_0xe8c65b;if(_0x269117['query'][_0x0fa9('0x50')]){_0x230645[_0x0fa9('0x65')]=[{'model':db[_0x0fa9('0x87')],'as':_0x0fa9('0xad'),'required':![]},{'model':db['User'],'as':_0x0fa9('0xae'),'attributes':[_0x0fa9('0x3b'),'fullname',_0x0fa9('0xaf')],'required':![]},{'model':db[_0x0fa9('0xb0')],'as':'Tags','attributes':['id',_0x0fa9('0x3b'),'color'],'where':_0x269117[_0x0fa9('0x45')]['tag']?{'id':_0x269117[_0x0fa9('0x45')][_0x0fa9('0xb1')]}:undefined,'required':_0x269117[_0x0fa9('0x45')][_0x0fa9('0xb1')]?!![]:![]}];}return db['OpenchannelInteraction'][_0x0fa9('0x51')](_0x230645);})[_0x0fa9('0x21')](function(_0xac6beb){_0x4c6012[_0x0fa9('0x52')]=_0xac6beb;return _0x4c6012;});}})['then'](respondWithFilteredResult(_0x5b4b4f,_0x230645))[_0x0fa9('0x2b')](handleError(_0x5b4b4f,null));};exports['addAgents']=function(_0x1913b1,_0x21b8a2,_0x485781){return db[_0x0fa9('0x40')][_0x0fa9('0x56')]({'where':{'id':_0x1913b1[_0x0fa9('0x54')]['id']}})[_0x0fa9('0x21')](handleEntityNotFound(_0x21b8a2,null))[_0x0fa9('0x21')](function(_0x41efc2){if(_0x41efc2){return _0x41efc2[_0x0fa9('0xb2')](_0x1913b1['body'][_0x0fa9('0x67')],_[_0x0fa9('0xb3')](_0x1913b1[_0x0fa9('0x58')],[_0x0fa9('0x67'),'id'])||{})['spread'](function(_0x1fbd80){for(var _0x34e55b=0x0;_0x34e55b<_0x1913b1['body'][_0x0fa9('0x67')][_0x0fa9('0x4a')];_0x34e55b+=0x1){socket['emit'](_0x0fa9('0xb4'),{'UserId':Number(_0x1913b1['body']['ids'][_0x34e55b]),'OpenchannelAccountId':Number(_0x1913b1['params']['id'])});}return _0x1fbd80;});}})[_0x0fa9('0x21')](respondWithResult(_0x21b8a2,null))['catch'](handleError(_0x21b8a2,null));};exports[_0x0fa9('0xb5')]=function(_0x343680,_0x4f5fae,_0x546f00){return db['OpenchannelAccount']['find']({'where':{'id':_0x343680[_0x0fa9('0x54')]['id']}})[_0x0fa9('0x21')](handleEntityNotFound(_0x4f5fae,null))['then'](function(_0x7b6934){if(_0x7b6934){return _0x7b6934['removeAgents'](_0x343680[_0x0fa9('0x45')][_0x0fa9('0x67')])[_0x0fa9('0x21')](function(){if(_[_0x0fa9('0xb6')](_0x343680[_0x0fa9('0x45')][_0x0fa9('0x67')])){for(var _0x4a4d8e=0x0;_0x4a4d8e<_0x343680['query'][_0x0fa9('0x67')]['length'];_0x4a4d8e+=0x1){socket['emit']('userOpenchannelAccount:remove',{'UserId':Number(_0x343680['query'][_0x0fa9('0x67')][_0x4a4d8e]),'OpenchannelAccountId':Number(_0x343680[_0x0fa9('0x54')]['id'])});}}else{socket['emit'](_0x0fa9('0xb7'),{'UserId':Number(_0x343680[_0x0fa9('0x45')][_0x0fa9('0x67')]),'OpenchannelAccountId':Number(_0x343680[_0x0fa9('0x54')]['id'])});}});}})[_0x0fa9('0x21')](respondWithStatusCode(_0x4f5fae,null))[_0x0fa9('0x2b')](handleError(_0x4f5fae,null));};exports[_0x0fa9('0xb8')]=function(_0x2dd04d,_0x47d8e6,_0xe45e30){var _0x737c1f={};var _0x5571d5={};var _0x2d370e;var _0x37f6c7;return db[_0x0fa9('0x40')]['findOne']({'where':{'id':_0x2dd04d[_0x0fa9('0x54')]['id']}})['then'](handleEntityNotFound(_0x47d8e6,null))[_0x0fa9('0x21')](function(_0x335661){if(_0x335661){_0x2d370e=_0x335661;_0x5571d5[_0x0fa9('0x43')]=_[_0x0fa9('0x44')](db[_0x0fa9('0x99')][_0x0fa9('0x55')]);_0x5571d5[_0x0fa9('0x45')]=_[_0x0fa9('0x44')](_0x2dd04d[_0x0fa9('0x45')]);_0x5571d5['filters']=_['intersection'](_0x5571d5['model'],_0x5571d5['query']);_0x737c1f[_0x0fa9('0x49')]=_['intersection'](_0x5571d5[_0x0fa9('0x43')],qs[_0x0fa9('0x48')](_0x2dd04d['query'][_0x0fa9('0x48')]));_0x737c1f[_0x0fa9('0x49')]=_0x737c1f[_0x0fa9('0x49')][_0x0fa9('0x4a')]?_0x737c1f[_0x0fa9('0x49')]:_0x5571d5[_0x0fa9('0x43')];_0x737c1f['order']=qs['sort'](_0x2dd04d[_0x0fa9('0x45')][_0x0fa9('0x4d')]);_0x737c1f[_0x0fa9('0x4f')]=qs['filters'](_[_0x0fa9('0x6b')](_0x2dd04d[_0x0fa9('0x45')],_0x5571d5[_0x0fa9('0x46')]));if(_0x2dd04d[_0x0fa9('0x45')][_0x0fa9('0x4e')]){_0x737c1f[_0x0fa9('0x4f')]=_['merge'](_0x737c1f[_0x0fa9('0x4f')],{'$or':_[_0x0fa9('0x3f')](_0x737c1f[_0x0fa9('0x49')],function(_0x2fd90f){var _0x237b76={};_0x237b76[_0x2fd90f]={'$like':'%'+_0x2dd04d[_0x0fa9('0x45')][_0x0fa9('0x4e')]+'%'};return _0x237b76;})});}_0x737c1f=_[_0x0fa9('0x6c')]({},_0x737c1f,_0x2dd04d['options']);return _0x2d370e[_0x0fa9('0xb8')](_0x737c1f);}})['then'](function(_0x461136){if(_0x461136){_0x37f6c7=_0x461136['length'];if(!_0x2dd04d[_0x0fa9('0x45')][_0x0fa9('0x4b')](_0x0fa9('0x63'))){_0x737c1f[_0x0fa9('0x30')]=qs[_0x0fa9('0x30')](_0x2dd04d[_0x0fa9('0x45')]['limit']);_0x737c1f['offset']=qs['offset'](_0x2dd04d['query'][_0x0fa9('0x2e')]);}return _0x2d370e['getAgents'](_0x737c1f);}})['then'](function(_0x24f28f){if(_0x24f28f){return _0x24f28f?{'count':_0x37f6c7,'rows':_0x24f28f}:null;}})[_0x0fa9('0x21')](respondWithResult(_0x47d8e6,null))[_0x0fa9('0x2b')](handleError(_0x47d8e6,null));};exports[_0x0fa9('0x3c')]=function(_0x5ddfb5,_0x6f7797,_0x417b29){var _0x292306,_0xeac819,_0x212eac;if(_['isNil'](_0x5ddfb5['body']['body'])||_0x5ddfb5[_0x0fa9('0x58')][_0x0fa9('0x58')]===''){throw new db[(_0x0fa9('0x74'))][(_0x0fa9('0x6f'))](_0x0fa9('0xb9'));}if(_['isNil'](_0x5ddfb5[_0x0fa9('0x58')]['to'])){}_0x292306=_0x5ddfb5['body']['to'];return db[_0x0fa9('0x40')]['findOne']({'where':{'id':_0x5ddfb5[_0x0fa9('0x54')]['id']}})['then'](handleEntityNotFound(_0x6f7797,null))[_0x0fa9('0x21')](function(_0x139214){if(_0x139214){return db['OpenchannelAccount'][_0x0fa9('0x56')]({'where':{'id':_0x139214['id']},'include':[{'model':db[_0x0fa9('0x7c')],'as':_0x0fa9('0x7d'),'include':[{'model':db[_0x0fa9('0x87')],'as':_0x0fa9('0x85'),'where':{[_0x139214[_0x0fa9('0x7a')]]:_0x292306},'limit':0x1,'order':[['updatedAt',_0x0fa9('0xba')]]}]}]})[_0x0fa9('0x21')](handleEntityNotFound(_0x6f7797,null))[_0x0fa9('0x21')](function(_0x352202){if(_0x352202&&_0x352202[_0x0fa9('0x7d')]){_0xeac819=_0x352202[_0x0fa9('0x37')]({'plain':!![]});if(_0xeac819[_0x0fa9('0x7d')]&&_0xeac819[_0x0fa9('0x7d')][_0x0fa9('0x85')]['length']){return _0xeac819['List']['Contacts'][0x0];}return db[_0x0fa9('0x87')]['create'](_[_0x0fa9('0x19')](_0x5ddfb5['body'],{'firstName':_0x292306,[_0x352202[_0x0fa9('0x7a')]]:_0x292306,'phone':_0x292306,'ListId':_0xeac819[_0x0fa9('0x86')]}));}})[_0x0fa9('0x21')](handleEntityNotFound(_0x6f7797,null))[_0x0fa9('0x21')](function(_0xc8ad1f){if(_0xc8ad1f){_0x212eac=_0xc8ad1f;return db['OpenchannelInteraction'][_0x0fa9('0x56')]({'where':{'ContactId':_0x212eac['id'],'closed':![],'OpenchannelAccountId':_0xeac819['id']}})[_0x0fa9('0x21')](function(_0x141807){if(_0x141807){return[_0x141807,![]];}return db['OpenchannelInteraction'][_0x0fa9('0x57')]({'UserId':_0x5ddfb5[_0x0fa9('0x59')]['id'],'ContactId':_0x212eac['id'],'OpenchannelAccountId':_0xeac819['id'],'lastMsgDirection':_0x0fa9('0xbb'),'Messages':[_[_0x0fa9('0x6c')](_0x5ddfb5['body'],{'read':![],'body':_0x5ddfb5[_0x0fa9('0x58')][_0x0fa9('0x58')],'OpenchannelAccountId':_0xeac819['id'],'UserId':_0x5ddfb5[_0x0fa9('0x59')]['id'],'ContactId':_0x212eac['id']})]},{'include':[{'model':db[_0x0fa9('0xbc')],'as':_0x0fa9('0xbd')}]})['then'](function(_0x912fac){return[_0x912fac,!![]];});});}})['spread'](function(_0x497415,_0x49ca21){if(_0x49ca21){return _0x497415;}return db[_0x0fa9('0xbc')][_0x0fa9('0x57')](_[_0x0fa9('0x6c')](_0x5ddfb5[_0x0fa9('0x58')],{'read':![],'body':_0x5ddfb5[_0x0fa9('0x58')][_0x0fa9('0x58')],'OpenchannelAccountId':_0xeac819['id'],'OpenchannelInteractionId':_0x497415['id'],'UserId':_0x5ddfb5[_0x0fa9('0x59')]['id'],'ContactId':_0x212eac['id']}))[_0x0fa9('0x21')](function(_0x369143){_0x497415[_0x0fa9('0xbe')][_0x0fa9('0xbd')]=[];_0x497415[_0x0fa9('0xbe')]['Messages'][_0x0fa9('0x95')](_0x369143[_0x0fa9('0xbe')]);return _0x497415;});});}})[_0x0fa9('0x21')](respondWithResult(_0x6f7797,null))[_0x0fa9('0x2b')](handleError(_0x6f7797,null));}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.events.js b/server/api/openchannelAccount/openchannelAccount.events.js index 08e312c..64a36a6 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 _0xa571=['hasOwnProperty','hook','exports','events','../../mysqldb','OpenchannelAccount','setMaxListeners','update','remove','emit'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0xa571,0x107));var _0x1a57=function(_0x176d6e,_0x5a2d05){_0x176d6e=_0x176d6e-0x0;var _0x650fe6=_0xa571[_0x176d6e];return _0x650fe6;};'use strict';var EventEmitter=require(_0x1a57('0x0'));var OpenchannelAccount=require(_0x1a57('0x1'))['db'][_0x1a57('0x2')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0x1a57('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x1a57('0x4'),'afterDestroy':_0x1a57('0x5')};function emitEvent(_0x4d5f7a){return function(_0x5ec815,_0x1f2c44,_0x5067fa){OpenchannelAccountEvents[_0x1a57('0x6')](_0x4d5f7a+':'+_0x5ec815['id'],_0x5ec815);OpenchannelAccountEvents[_0x1a57('0x6')](_0x4d5f7a,_0x5ec815);_0x5067fa(null);};}for(var e in events){if(events[_0x1a57('0x7')](e)){var event=events[e];OpenchannelAccount[_0x1a57('0x8')](e,emitEvent(event));}}module[_0x1a57('0x9')]=OpenchannelAccountEvents; \ No newline at end of file +var _0xa75b=['setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x589722,_0xcea6fc){var _0x31eb3f=function(_0x24913b){while(--_0x24913b){_0x589722['push'](_0x589722['shift']());}};_0x31eb3f(++_0xcea6fc);}(_0xa75b,0x170));var _0xba75=function(_0x28d7e5,_0x4eacda){_0x28d7e5=_0x28d7e5-0x0;var _0xfcb0a0=_0xa75b[_0x28d7e5];return _0xfcb0a0;};'use strict';var EventEmitter=require(_0xba75('0x0'));var OpenchannelAccount=require('../../mysqldb')['db']['OpenchannelAccount'];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0xba75('0x1')](0x0);var events={'afterCreate':_0xba75('0x2'),'afterUpdate':_0xba75('0x3'),'afterDestroy':_0xba75('0x4')};function emitEvent(_0x1760c0){return function(_0x336606,_0x152269,_0x398bd5){OpenchannelAccountEvents[_0xba75('0x5')](_0x1760c0+':'+_0x336606['id'],_0x336606);OpenchannelAccountEvents[_0xba75('0x5')](_0x1760c0,_0x336606);_0x398bd5(null);};}for(var e in events){if(events[_0xba75('0x6')](e)){var event=events[e];OpenchannelAccount[_0xba75('0x7')](e,emitEvent(event));}}module[_0xba75('0x8')]=OpenchannelAccountEvents; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.model.js b/server/api/openchannelAccount/openchannelAccount.model.js index b0c5fc7..7750b00 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(_0x1ce6e0,_0x32d79b){var _0x20d74c=function(_0x1ddfc6){while(--_0x1ddfc6){_0x1ce6e0['push'](_0x1ce6e0['shift']());}};_0x20d74c(++_0x32d79b);}(_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 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(_0x4c42dc,_0x576416){var _0x41bec7=function(_0xde5141){while(--_0xde5141){_0x4c42dc['push'](_0x4c42dc['shift']());}};_0x41bec7(++_0x576416);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0xa9e0[_0x2f5ac5];return _0x37c9a8;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var 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 b74b14c..1a9795f 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 _0x087b=['then','info','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','OpenchannelAccount,\x20%s,\x20%s','message','result','catch','lodash','util','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./openchannelAccount.socket','register','request'];(function(_0x8612ce,_0x535229){var _0x2d68c2=function(_0xdc0ce9){while(--_0xdc0ce9){_0x8612ce['push'](_0x8612ce['shift']());}};_0x2d68c2(++_0x535229);}(_0x087b,0x11a));var _0xb087=function(_0x220f3f,_0x11c540){_0x220f3f=_0x220f3f-0x0;var _0x1f170e=_0x087b[_0x220f3f];return _0x1f170e;};'use strict';var _=require(_0xb087('0x0'));var util=require(_0xb087('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xb087('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb087('0x3'))['db'];var utils=require(_0xb087('0x4'));var logger=require(_0xb087('0x5'))(_0xb087('0x6'));var config=require(_0xb087('0x7'));var jayson=require(_0xb087('0x8'));var client=jayson[_0xb087('0x9')][_0xb087('0xa')]({'port':0x232a});config[_0xb087('0xb')]=_[_0xb087('0xc')](config[_0xb087('0xb')],{'host':_0xb087('0xd'),'port':0x18eb});var socket=require(_0xb087('0xe'))(new Redis(config[_0xb087('0xb')]));require(_0xb087('0xf'))[_0xb087('0x10')](socket);function respondWithRpcPromise(_0x379041,_0x583d25,_0x244abc){return new BPromise(function(_0x108451,_0x903a16){return client[_0xb087('0x11')](_0x379041,_0x244abc)[_0xb087('0x12')](function(_0x2f43e9){logger[_0xb087('0x13')]('OpenchannelAccount,\x20%s,\x20%s',_0x583d25,_0xb087('0x14'));logger[_0xb087('0x15')](_0xb087('0x16'),_0x583d25,'request\x20sent',JSON[_0xb087('0x17')](_0x2f43e9));if(_0x2f43e9[_0xb087('0x18')]){if(_0x2f43e9[_0xb087('0x18')][_0xb087('0x19')]===0x1f4){logger[_0xb087('0x18')](_0xb087('0x1a'),_0x583d25,_0x2f43e9[_0xb087('0x18')][_0xb087('0x1b')]);return _0x903a16(_0x2f43e9[_0xb087('0x18')][_0xb087('0x1b')]);}logger['error'](_0xb087('0x1a'),_0x583d25,_0x2f43e9[_0xb087('0x18')]['message']);return _0x108451(_0x2f43e9[_0xb087('0x18')][_0xb087('0x1b')]);}else{logger[_0xb087('0x13')]('OpenchannelAccount,\x20%s,\x20%s',_0x583d25,_0xb087('0x14'));_0x108451(_0x2f43e9[_0xb087('0x1c')][_0xb087('0x1b')]);}})[_0xb087('0x1d')](function(_0x4e333b){logger[_0xb087('0x18')](_0xb087('0x1a'),_0x583d25,_0x4e333b);_0x903a16(_0x4e333b);});});} \ No newline at end of file +var _0x4746=['bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','register','request','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','lodash','util'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x4746,0xc6));var _0x6474=function(_0x5442e7,_0x1a4021){_0x5442e7=_0x5442e7-0x0;var _0x583552=_0x4746[_0x5442e7];return _0x583552;};'use strict';var _=require(_0x6474('0x0'));var util=require(_0x6474('0x1'));var moment=require('moment');var BPromise=require(_0x6474('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6474('0x3'));var db=require(_0x6474('0x4'))['db'];var utils=require(_0x6474('0x5'));var logger=require(_0x6474('0x6'))(_0x6474('0x7'));var config=require('../../config/environment');var jayson=require(_0x6474('0x8'));var client=jayson[_0x6474('0x9')]['http']({'port':0x232a});config[_0x6474('0xa')]=_[_0x6474('0xb')](config[_0x6474('0xa')],{'host':_0x6474('0xc'),'port':0x18eb});var socket=require(_0x6474('0xd'))(new Redis(config[_0x6474('0xa')]));require('./openchannelAccount.socket')[_0x6474('0xe')](socket);function respondWithRpcPromise(_0x5bbee1,_0x5335ac,_0x347697){return new BPromise(function(_0x1a202c,_0x4c970d){return client[_0x6474('0xf')](_0x5bbee1,_0x347697)['then'](function(_0x212cda){logger['info'](_0x6474('0x10'),_0x5335ac,_0x6474('0x11'));logger['debug']('OpenchannelAccount,\x20%s,\x20%s,\x20%s',_0x5335ac,'request\x20sent',JSON[_0x6474('0x12')](_0x212cda));if(_0x212cda[_0x6474('0x13')]){if(_0x212cda[_0x6474('0x13')][_0x6474('0x14')]===0x1f4){logger[_0x6474('0x13')](_0x6474('0x10'),_0x5335ac,_0x212cda[_0x6474('0x13')][_0x6474('0x15')]);return _0x4c970d(_0x212cda[_0x6474('0x13')]['message']);}logger['error']('OpenchannelAccount,\x20%s,\x20%s',_0x5335ac,_0x212cda[_0x6474('0x13')][_0x6474('0x15')]);return _0x1a202c(_0x212cda[_0x6474('0x13')][_0x6474('0x15')]);}else{logger[_0x6474('0x16')]('OpenchannelAccount,\x20%s,\x20%s',_0x5335ac,_0x6474('0x11'));_0x1a202c(_0x212cda[_0x6474('0x17')][_0x6474('0x15')]);}})[_0x6474('0x18')](function(_0x17a086){logger[_0x6474('0x13')](_0x6474('0x10'),_0x5335ac,_0x17a086);_0x4c970d(_0x17a086);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.socket.js b/server/api/openchannelAccount/openchannelAccount.socket.js index 6d6e090..042771c 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 _0x2e54=['register','length','./openchannelAccount.events','update','emit'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x2e54,0x1dd));var _0x42e5=function(_0x52c00f,_0xf16df0){_0x52c00f=_0x52c00f-0x0;var _0x3cb833=_0x2e54[_0x52c00f];return _0x3cb833;};'use strict';var OpenchannelAccountEvents=require(_0x42e5('0x0'));var events=['save','remove',_0x42e5('0x1')];function createListener(_0x23f008,_0x3cf9bd){return function(_0x1c62bb){_0x3cf9bd[_0x42e5('0x2')](_0x23f008,_0x1c62bb);};}function removeListener(_0x153440,_0x42736b){return function(){OpenchannelAccountEvents['removeListener'](_0x153440,_0x42736b);};}exports[_0x42e5('0x3')]=function(_0x455f48){for(var _0x38cb1b=0x0,_0x4bed10=events[_0x42e5('0x4')];_0x38cb1b<_0x4bed10;_0x38cb1b++){var _0x56be20=events[_0x38cb1b];var _0x335b92=createListener('openchannelAccount:'+_0x56be20,_0x455f48);OpenchannelAccountEvents['on'](_0x56be20,_0x335b92);}}; \ No newline at end of file +var _0x1020=['./openchannelAccount.events','remove','update','emit','removeListener','register','length'];(function(_0x389a61,_0x20216c){var _0x1acde9=function(_0x3c72d3){while(--_0x3c72d3){_0x389a61['push'](_0x389a61['shift']());}};_0x1acde9(++_0x20216c);}(_0x1020,0x1a4));var _0x0102=function(_0x33155c,_0x3fdde1){_0x33155c=_0x33155c-0x0;var _0x5becf7=_0x1020[_0x33155c];return _0x5becf7;};'use strict';var OpenchannelAccountEvents=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(){OpenchannelAccountEvents[_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('openchannelAccount:'+_0x1aa60e,_0x27dd86);OpenchannelAccountEvents['on'](_0x1aa60e,_0x43df9f);}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/index.js b/server/api/openchannelApplication/index.js index 9862ed8..9f3f8d7 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 _0x7a38=['delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelApplication.controller','get','isAuthenticated','index','/:id','show','post','create','put','update'];(function(_0x20ef64,_0x4a8fe9){var _0x3707d8=function(_0x5b9a88){while(--_0x5b9a88){_0x20ef64['push'](_0x20ef64['shift']());}};_0x3707d8(++_0x4a8fe9);}(_0x7a38,0xb3));var _0x87a3=function(_0x364718,_0x25acc7){_0x364718=_0x364718-0x0;var _0x4d88a6=_0x7a38[_0x364718];return _0x4d88a6;};'use strict';var multer=require(_0x87a3('0x0'));var util=require('util');var path=require(_0x87a3('0x1'));var timeout=require(_0x87a3('0x2'));var express=require(_0x87a3('0x3'));var router=express[_0x87a3('0x4')]();var fs_extra=require(_0x87a3('0x5'));var auth=require(_0x87a3('0x6'));var interaction=require(_0x87a3('0x7'));var config=require(_0x87a3('0x8'));var controller=require(_0x87a3('0x9'));router[_0x87a3('0xa')]('/',auth[_0x87a3('0xb')](),controller[_0x87a3('0xc')]);router['get'](_0x87a3('0xd'),auth[_0x87a3('0xb')](),controller[_0x87a3('0xe')]);router[_0x87a3('0xf')]('/',auth[_0x87a3('0xb')](),controller[_0x87a3('0x10')]);router[_0x87a3('0x11')]('/:id',auth[_0x87a3('0xb')](),controller[_0x87a3('0x12')]);router[_0x87a3('0x13')]('/:id',auth[_0x87a3('0xb')](),controller[_0x87a3('0x14')]);module[_0x87a3('0x15')]=router; \ No newline at end of file +var _0x05a8=['get','isAuthenticated','index','/:id','show','post','create','put','update','delete','exports','util','path','connect-timeout','Router','../../components/interaction/service'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x05a8,0xeb));var _0x805a=function(_0x7fe765,_0x2fc59e){_0x7fe765=_0x7fe765-0x0;var _0x52262a=_0x05a8[_0x7fe765];return _0x52262a;};'use strict';var multer=require('multer');var util=require(_0x805a('0x0'));var path=require(_0x805a('0x1'));var timeout=require(_0x805a('0x2'));var express=require('express');var router=express[_0x805a('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x805a('0x4'));var config=require('../../config/environment');var controller=require('./openchannelApplication.controller');router[_0x805a('0x5')]('/',auth[_0x805a('0x6')](),controller[_0x805a('0x7')]);router[_0x805a('0x5')](_0x805a('0x8'),auth[_0x805a('0x6')](),controller[_0x805a('0x9')]);router[_0x805a('0xa')]('/',auth[_0x805a('0x6')](),controller[_0x805a('0xb')]);router[_0x805a('0xc')]('/:id',auth[_0x805a('0x6')](),controller[_0x805a('0xd')]);router[_0x805a('0xe')](_0x805a('0x8'),auth['isAuthenticated'](),controller['destroy']);module[_0x805a('0xf')]=router; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.attributes.js b/server/api/openchannelApplication/openchannelApplication.attributes.js index 4ecca96..994705b 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 _0x1de9=['*,*,*,*','exports','STRING','noop','TEXT'];(function(_0x205a4d,_0x4a521a){var _0x312a0f=function(_0x161242){while(--_0x161242){_0x205a4d['push'](_0x205a4d['shift']());}};_0x312a0f(++_0x4a521a);}(_0x1de9,0x11e));var _0x91de=function(_0xbf15d3,_0x27015a){_0xbf15d3=_0xbf15d3-0x0;var _0x2afc1f=_0x1de9[_0xbf15d3];return _0x2afc1f;};'use strict';var Sequelize=require('sequelize');module[_0x91de('0x0')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x91de('0x1')],'allowNull':![],'defaultValue':_0x91de('0x2')},'appdata':{'type':Sequelize[_0x91de('0x3')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x91de('0x1')],'defaultValue':_0x91de('0x4')}}; \ No newline at end of file +var _0x5946=['noop','TEXT','sequelize','exports','INTEGER','STRING'];(function(_0x235289,_0x212c5a){var _0x185f9f=function(_0x184ba1){while(--_0x184ba1){_0x235289['push'](_0x235289['shift']());}};_0x185f9f(++_0x212c5a);}(_0x5946,0xec));var _0x6594=function(_0x496333,_0x1c47d6){_0x496333=_0x496333-0x0;var _0x44256e=_0x5946[_0x496333];return _0x44256e;};'use strict';var Sequelize=require(_0x6594('0x0'));module[_0x6594('0x1')]={'priority':{'type':Sequelize[_0x6594('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x6594('0x3')],'allowNull':![],'defaultValue':_0x6594('0x4')},'appdata':{'type':Sequelize[_0x6594('0x5')]()},'description':{'type':Sequelize[_0x6594('0x3')]},'interval':{'type':Sequelize[_0x6594('0x3')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.controller.js b/server/api/openchannelApplication/openchannelApplication.controller.js index d56efa7..02dbb0a 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 _0xd519=['moment','bluebird','path','sox','fs-extra','squel','jsforce','to-csv','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','offset','undefined','limit','status','set','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','name','index','map','OpenchannelApplication','key','model','keys','query','filters','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','findAll','catch','show','params','intersection','include','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise'];(function(_0xfc9862,_0x1b6465){var _0x5583ee=function(_0x4a893c){while(--_0x4a893c){_0xfc9862['push'](_0xfc9862['shift']());}};_0x5583ee(++_0x1b6465);}(_0xd519,0xd0));var _0x9d51=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd519[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x9d51('0x0'));var rimraf=require(_0x9d51('0x1'));var zipdir=require(_0x9d51('0x2'));var jsonpatch=require(_0x9d51('0x3'));var rp=require(_0x9d51('0x4'));var moment=require(_0x9d51('0x5'));var BPromise=require(_0x9d51('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0x9d51('0x7'));var sox=require(_0x9d51('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9d51('0x9'));var _=require('lodash');var squel=require(_0x9d51('0xa'));var crypto=require('crypto');var jsforce=require(_0x9d51('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x9d51('0xc'));var querystring=require('querystring');var Papa=require(_0x9d51('0xd'));var Redis=require(_0x9d51('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x9d51('0xf'));var as=require(_0x9d51('0x10'));var hardwareService=require(_0x9d51('0x11'));var logger=require('../../config/logger')('api');var utils=require(_0x9d51('0x12'));var config=require(_0x9d51('0x13'));var licenseUtil=require(_0x9d51('0x14'));var db=require(_0x9d51('0x15'))['db'];function respondWithStatusCode(_0x16904a,_0x5c4489){_0x5c4489=_0x5c4489||0xcc;return function(_0x2c44f3){if(_0x2c44f3){return _0x16904a[_0x9d51('0x16')](_0x5c4489);}return _0x16904a['status'](_0x5c4489)[_0x9d51('0x17')]();};}function respondWithResult(_0x5dc040,_0x43d097){_0x43d097=_0x43d097||0xc8;return function(_0x2d4063){if(_0x2d4063){return _0x5dc040['status'](_0x43d097)['json'](_0x2d4063);}};}function respondWithFilteredResult(_0x480737,_0x25b60d){return function(_0x1bbaf6){if(_0x1bbaf6){var _0x2ba90b=typeof _0x25b60d[_0x9d51('0x18')]===_0x9d51('0x19')&&typeof _0x25b60d[_0x9d51('0x1a')]==='undefined';var _0x4cc3d7=_0x1bbaf6['count'];var _0x2c1d7c=_0x2ba90b?0x0:_0x25b60d[_0x9d51('0x18')];var _0x1671a2=_0x2ba90b?_0x1bbaf6['count']:_0x25b60d[_0x9d51('0x18')]+_0x25b60d[_0x9d51('0x1a')];var _0x4e825f;if(_0x1671a2>=_0x4cc3d7){_0x1671a2=_0x4cc3d7;_0x4e825f=0xc8;}else{_0x4e825f=0xce;}_0x480737[_0x9d51('0x1b')](_0x4e825f);return _0x480737[_0x9d51('0x1c')](_0x9d51('0x1d'),_0x2c1d7c+'-'+_0x1671a2+'/'+_0x4cc3d7)[_0x9d51('0x1e')](_0x1bbaf6);}return null;};}function patchUpdates(_0x160b80){return function(_0x41553e){try{jsonpatch[_0x9d51('0x1f')](_0x41553e,_0x160b80,!![]);}catch(_0x43a0de){return BPromise[_0x9d51('0x20')](_0x43a0de);}return _0x41553e[_0x9d51('0x21')]();};}function saveUpdates(_0x5f3fbe,_0x4a0574){return function(_0x3d2a5a){if(_0x3d2a5a){return _0x3d2a5a[_0x9d51('0x22')](_0x5f3fbe)[_0x9d51('0x23')](function(_0x4560d4){return _0x4560d4;});}return null;};}function removeEntity(_0x5da047,_0x5b48e0){return function(_0x4be650){if(_0x4be650){return _0x4be650[_0x9d51('0x24')]()[_0x9d51('0x23')](function(){_0x5da047['status'](0xcc)[_0x9d51('0x17')]();});}};}function handleEntityNotFound(_0x213dea,_0x215e0e){return function(_0x322e28){if(!_0x322e28){_0x213dea[_0x9d51('0x16')](0x194);}return _0x322e28;};}function handleError(_0x5e42ba,_0x2c01d1){_0x2c01d1=_0x2c01d1||0x1f4;return function(_0x3917b2){logger[_0x9d51('0x25')](_0x3917b2[_0x9d51('0x26')]);if(_0x3917b2[_0x9d51('0x27')]){delete _0x3917b2[_0x9d51('0x27')];}_0x5e42ba[_0x9d51('0x1b')](_0x2c01d1)['send'](_0x3917b2);};}exports[_0x9d51('0x28')]=function(_0x2692a8,_0x4e0342){var _0x1dcfdf={},_0xa4083={},_0x33ed49={'count':0x0,'rows':[]};var _0xfffa77=_[_0x9d51('0x29')](db[_0x9d51('0x2a')]['rawAttributes'],function(_0x44495d){return{'name':_0x44495d['fieldName'],'type':_0x44495d['type'][_0x9d51('0x2b')]};});_0xa4083[_0x9d51('0x2c')]=_[_0x9d51('0x29')](_0xfffa77,_0x9d51('0x27'));_0xa4083['query']=_[_0x9d51('0x2d')](_0x2692a8[_0x9d51('0x2e')]);_0xa4083[_0x9d51('0x2f')]=_['intersection'](_0xa4083[_0x9d51('0x2c')],_0xa4083[_0x9d51('0x2e')]);_0x1dcfdf[_0x9d51('0x30')]=_['intersection'](_0xa4083[_0x9d51('0x2c')],qs['fields'](_0x2692a8['query'][_0x9d51('0x31')]));_0x1dcfdf[_0x9d51('0x30')]=_0x1dcfdf[_0x9d51('0x30')][_0x9d51('0x32')]?_0x1dcfdf[_0x9d51('0x30')]:_0xa4083['model'];if(!_0x2692a8[_0x9d51('0x2e')][_0x9d51('0x33')]('nolimit')){_0x1dcfdf['limit']=qs[_0x9d51('0x1a')](_0x2692a8[_0x9d51('0x2e')]['limit']);_0x1dcfdf[_0x9d51('0x18')]=qs[_0x9d51('0x18')](_0x2692a8[_0x9d51('0x2e')][_0x9d51('0x18')]);}_0x1dcfdf[_0x9d51('0x34')]=qs[_0x9d51('0x35')](_0x2692a8[_0x9d51('0x2e')]['sort']);_0x1dcfdf[_0x9d51('0x36')]=qs[_0x9d51('0x2f')](_[_0x9d51('0x37')](_0x2692a8['query'],_0xa4083[_0x9d51('0x2f')]),_0xfffa77);if(_0x2692a8[_0x9d51('0x2e')][_0x9d51('0x38')]){_0x1dcfdf[_0x9d51('0x36')]=_[_0x9d51('0x39')](_0x1dcfdf[_0x9d51('0x36')],{'$or':_['map'](_0xfffa77,function(_0x51e5bc){if(_0x51e5bc['type']!==_0x9d51('0x3a')){var _0x3b28c0={};_0x3b28c0[_0x51e5bc[_0x9d51('0x27')]]={'$like':'%'+_0x2692a8['query'][_0x9d51('0x38')]+'%'};return _0x3b28c0;}})});}_0x1dcfdf=_[_0x9d51('0x39')]({},_0x1dcfdf,_0x2692a8[_0x9d51('0x3b')]);var _0x527ca1={'where':_0x1dcfdf[_0x9d51('0x36')]};return db[_0x9d51('0x2a')][_0x9d51('0x3c')](_0x527ca1)[_0x9d51('0x23')](function(_0x2c3542){_0x33ed49[_0x9d51('0x3c')]=_0x2c3542;if(_0x2692a8['query'][_0x9d51('0x3d')]){_0x1dcfdf['include']=[{'all':!![]}];}return db[_0x9d51('0x2a')][_0x9d51('0x3e')](_0x1dcfdf);})[_0x9d51('0x23')](function(_0x3c80d6){_0x33ed49['rows']=_0x3c80d6;return _0x33ed49;})[_0x9d51('0x23')](respondWithFilteredResult(_0x4e0342,_0x1dcfdf))[_0x9d51('0x3f')](handleError(_0x4e0342,null));};exports[_0x9d51('0x40')]=function(_0x419b27,_0x575408){var _0x37e724={'raw':!![],'where':{'id':_0x419b27[_0x9d51('0x41')]['id']}},_0x5ad803={};_0x5ad803[_0x9d51('0x2c')]=_[_0x9d51('0x2d')](db[_0x9d51('0x2a')]['rawAttributes']);_0x5ad803[_0x9d51('0x2e')]=_['keys'](_0x419b27[_0x9d51('0x2e')]);_0x5ad803['filters']=_[_0x9d51('0x42')](_0x5ad803[_0x9d51('0x2c')],_0x5ad803['query']);_0x37e724[_0x9d51('0x30')]=_[_0x9d51('0x42')](_0x5ad803[_0x9d51('0x2c')],qs[_0x9d51('0x31')](_0x419b27['query']['fields']));_0x37e724[_0x9d51('0x30')]=_0x37e724[_0x9d51('0x30')]['length']?_0x37e724[_0x9d51('0x30')]:_0x5ad803[_0x9d51('0x2c')];if(_0x419b27[_0x9d51('0x2e')][_0x9d51('0x3d')]){_0x37e724[_0x9d51('0x43')]=[{'all':!![]}];}_0x37e724=_['merge']({},_0x37e724,_0x419b27[_0x9d51('0x3b')]);return db['OpenchannelApplication'][_0x9d51('0x44')](_0x37e724)['then'](handleEntityNotFound(_0x575408,null))['then'](respondWithResult(_0x575408,null))['catch'](handleError(_0x575408,null));};exports[_0x9d51('0x45')]=function(_0x9cccf4,_0x99b28a){return db[_0x9d51('0x2a')][_0x9d51('0x45')](_0x9cccf4[_0x9d51('0x46')],{})[_0x9d51('0x23')](respondWithResult(_0x99b28a,0xc9))['catch'](handleError(_0x99b28a,null));};exports[_0x9d51('0x22')]=function(_0x58b0d8,_0x258ad2){if(_0x58b0d8['body']['id']){delete _0x58b0d8['body']['id'];}return db[_0x9d51('0x2a')]['find']({'where':{'id':_0x58b0d8[_0x9d51('0x41')]['id']}})[_0x9d51('0x23')](handleEntityNotFound(_0x258ad2,null))[_0x9d51('0x23')](saveUpdates(_0x58b0d8[_0x9d51('0x46')],null))[_0x9d51('0x23')](respondWithResult(_0x258ad2,null))[_0x9d51('0x3f')](handleError(_0x258ad2,null));};exports[_0x9d51('0x24')]=function(_0x79ac14,_0x16ffd1){return db[_0x9d51('0x2a')][_0x9d51('0x44')]({'where':{'id':_0x79ac14[_0x9d51('0x41')]['id']}})[_0x9d51('0x23')](handleEntityNotFound(_0x16ffd1,null))[_0x9d51('0x23')](removeEntity(_0x16ffd1,null))['catch'](handleError(_0x16ffd1,null));}; \ No newline at end of file +var _0x823d=['destroy','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','VIRTUAL','filter','options','includeAll','include','OpenchannelApplication','findAll','rows','params','intersection','find','catch','create','update','body','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','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','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','then'];(function(_0x3c62ab,_0x33f23d){var _0x536970=function(_0x3a4759){while(--_0x3a4759){_0x3c62ab['push'](_0x3c62ab['shift']());}};_0x536970(++_0x33f23d);}(_0x823d,0x78));var _0xd823=function(_0x259e77,_0x52f430){_0x259e77=_0x259e77-0x0;var _0x1f93bd=_0x823d[_0x259e77];return _0x1f93bd;};'use strict';var emlformat=require(_0xd823('0x0'));var rimraf=require(_0xd823('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd823('0x2'));var rp=require(_0xd823('0x3'));var moment=require(_0xd823('0x4'));var BPromise=require(_0xd823('0x5'));var Mustache=require(_0xd823('0x6'));var util=require(_0xd823('0x7'));var path=require('path');var sox=require(_0xd823('0x8'));var csv=require(_0xd823('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd823('0xa'));var _=require(_0xd823('0xb'));var squel=require(_0xd823('0xc'));var crypto=require(_0xd823('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xd823('0xe'));var toCsv=require(_0xd823('0x9'));var querystring=require(_0xd823('0xf'));var Papa=require(_0xd823('0x10'));var Redis=require(_0xd823('0x11'));var authService=require(_0xd823('0x12'));var qs=require(_0xd823('0x13'));var as=require(_0xd823('0x14'));var hardwareService=require(_0xd823('0x15'));var logger=require(_0xd823('0x16'))(_0xd823('0x17'));var utils=require(_0xd823('0x18'));var config=require(_0xd823('0x19'));var licenseUtil=require(_0xd823('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1b2527,_0x14417e){_0x14417e=_0x14417e||0xcc;return function(_0x1e0319){if(_0x1e0319){return _0x1b2527[_0xd823('0x1b')](_0x14417e);}return _0x1b2527[_0xd823('0x1c')](_0x14417e)[_0xd823('0x1d')]();};}function respondWithResult(_0x9b67ea,_0x5ce6aa){_0x5ce6aa=_0x5ce6aa||0xc8;return function(_0x1e04d4){if(_0x1e04d4){return _0x9b67ea['status'](_0x5ce6aa)[_0xd823('0x1e')](_0x1e04d4);}};}function respondWithFilteredResult(_0x478489,_0x1ccd69){return function(_0xee9a52){if(_0xee9a52){var _0x15f997=typeof _0x1ccd69[_0xd823('0x1f')]===_0xd823('0x20')&&typeof _0x1ccd69[_0xd823('0x21')]===_0xd823('0x20');var _0x13c071=_0xee9a52[_0xd823('0x22')];var _0x39a1df=_0x15f997?0x0:_0x1ccd69['offset'];var _0x3ddfca=_0x15f997?_0xee9a52['count']:_0x1ccd69[_0xd823('0x1f')]+_0x1ccd69[_0xd823('0x21')];var _0x558e34;if(_0x3ddfca>=_0x13c071){_0x3ddfca=_0x13c071;_0x558e34=0xc8;}else{_0x558e34=0xce;}_0x478489[_0xd823('0x1c')](_0x558e34);return _0x478489[_0xd823('0x23')](_0xd823('0x24'),_0x39a1df+'-'+_0x3ddfca+'/'+_0x13c071)['json'](_0xee9a52);}return null;};}function patchUpdates(_0x1a8808){return function(_0x2d2fd6){try{jsonpatch['apply'](_0x2d2fd6,_0x1a8808,!![]);}catch(_0x40fc45){return BPromise[_0xd823('0x25')](_0x40fc45);}return _0x2d2fd6[_0xd823('0x26')]();};}function saveUpdates(_0x22f120,_0x4f2f4e){return function(_0x49b67a){if(_0x49b67a){return _0x49b67a['update'](_0x22f120)[_0xd823('0x27')](function(_0x2eff0a){return _0x2eff0a;});}return null;};}function removeEntity(_0x484945,_0x32dd7f){return function(_0x2b0eb4){if(_0x2b0eb4){return _0x2b0eb4[_0xd823('0x28')]()['then'](function(){_0x484945['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1c1380,_0x37f6c3){return function(_0x30a8b7){if(!_0x30a8b7){_0x1c1380[_0xd823('0x1b')](0x194);}return _0x30a8b7;};}function handleError(_0xf3e9b8,_0x3ca6ad){_0x3ca6ad=_0x3ca6ad||0x1f4;return function(_0x37cbf7){logger[_0xd823('0x29')](_0x37cbf7[_0xd823('0x2a')]);if(_0x37cbf7['name']){delete _0x37cbf7[_0xd823('0x2b')];}_0xf3e9b8[_0xd823('0x1c')](_0x3ca6ad)[_0xd823('0x2c')](_0x37cbf7);};}exports[_0xd823('0x2d')]=function(_0x2e1b00,_0x182d8d){var _0x5aef8b={},_0x4cd19c={},_0x5b955a={'count':0x0,'rows':[]};var _0x3c54da=_[_0xd823('0x2e')](db['OpenchannelApplication'][_0xd823('0x2f')],function(_0x497d25){return{'name':_0x497d25[_0xd823('0x30')],'type':_0x497d25[_0xd823('0x31')][_0xd823('0x32')]};});_0x4cd19c[_0xd823('0x33')]=_[_0xd823('0x2e')](_0x3c54da,_0xd823('0x2b'));_0x4cd19c[_0xd823('0x34')]=_[_0xd823('0x35')](_0x2e1b00[_0xd823('0x34')]);_0x4cd19c['filters']=_['intersection'](_0x4cd19c[_0xd823('0x33')],_0x4cd19c[_0xd823('0x34')]);_0x5aef8b[_0xd823('0x36')]=_['intersection'](_0x4cd19c['model'],qs[_0xd823('0x37')](_0x2e1b00[_0xd823('0x34')][_0xd823('0x37')]));_0x5aef8b['attributes']=_0x5aef8b[_0xd823('0x36')][_0xd823('0x38')]?_0x5aef8b[_0xd823('0x36')]:_0x4cd19c['model'];if(!_0x2e1b00[_0xd823('0x34')][_0xd823('0x39')](_0xd823('0x3a'))){_0x5aef8b[_0xd823('0x21')]=qs[_0xd823('0x21')](_0x2e1b00['query']['limit']);_0x5aef8b[_0xd823('0x1f')]=qs[_0xd823('0x1f')](_0x2e1b00[_0xd823('0x34')][_0xd823('0x1f')]);}_0x5aef8b[_0xd823('0x3b')]=qs[_0xd823('0x3c')](_0x2e1b00[_0xd823('0x34')]['sort']);_0x5aef8b[_0xd823('0x3d')]=qs[_0xd823('0x3e')](_[_0xd823('0x3f')](_0x2e1b00[_0xd823('0x34')],_0x4cd19c[_0xd823('0x3e')]),_0x3c54da);if(_0x2e1b00['query']['filter']){_0x5aef8b[_0xd823('0x3d')]=_[_0xd823('0x40')](_0x5aef8b[_0xd823('0x3d')],{'$or':_[_0xd823('0x2e')](_0x3c54da,function(_0x6a1da3){if(_0x6a1da3[_0xd823('0x31')]!==_0xd823('0x41')){var _0x3454a4={};_0x3454a4[_0x6a1da3[_0xd823('0x2b')]]={'$like':'%'+_0x2e1b00['query'][_0xd823('0x42')]+'%'};return _0x3454a4;}})});}_0x5aef8b=_['merge']({},_0x5aef8b,_0x2e1b00[_0xd823('0x43')]);var _0x4ebacd={'where':_0x5aef8b[_0xd823('0x3d')]};return db['OpenchannelApplication'][_0xd823('0x22')](_0x4ebacd)[_0xd823('0x27')](function(_0x4f087e){_0x5b955a['count']=_0x4f087e;if(_0x2e1b00[_0xd823('0x34')][_0xd823('0x44')]){_0x5aef8b[_0xd823('0x45')]=[{'all':!![]}];}return db[_0xd823('0x46')][_0xd823('0x47')](_0x5aef8b);})[_0xd823('0x27')](function(_0x2ad3c1){_0x5b955a[_0xd823('0x48')]=_0x2ad3c1;return _0x5b955a;})['then'](respondWithFilteredResult(_0x182d8d,_0x5aef8b))['catch'](handleError(_0x182d8d,null));};exports['show']=function(_0x1e5f10,_0x2cf71a){var _0x38db9b={'raw':!![],'where':{'id':_0x1e5f10[_0xd823('0x49')]['id']}},_0x56ec21={};_0x56ec21[_0xd823('0x33')]=_[_0xd823('0x35')](db[_0xd823('0x46')][_0xd823('0x2f')]);_0x56ec21[_0xd823('0x34')]=_['keys'](_0x1e5f10[_0xd823('0x34')]);_0x56ec21['filters']=_[_0xd823('0x4a')](_0x56ec21['model'],_0x56ec21[_0xd823('0x34')]);_0x38db9b['attributes']=_['intersection'](_0x56ec21['model'],qs['fields'](_0x1e5f10[_0xd823('0x34')][_0xd823('0x37')]));_0x38db9b[_0xd823('0x36')]=_0x38db9b['attributes'][_0xd823('0x38')]?_0x38db9b['attributes']:_0x56ec21[_0xd823('0x33')];if(_0x1e5f10['query']['includeAll']){_0x38db9b['include']=[{'all':!![]}];}_0x38db9b=_['merge']({},_0x38db9b,_0x1e5f10['options']);return db[_0xd823('0x46')][_0xd823('0x4b')](_0x38db9b)[_0xd823('0x27')](handleEntityNotFound(_0x2cf71a,null))[_0xd823('0x27')](respondWithResult(_0x2cf71a,null))[_0xd823('0x4c')](handleError(_0x2cf71a,null));};exports[_0xd823('0x4d')]=function(_0x53780d,_0x3c1544){return db[_0xd823('0x46')][_0xd823('0x4d')](_0x53780d['body'],{})[_0xd823('0x27')](respondWithResult(_0x3c1544,0xc9))[_0xd823('0x4c')](handleError(_0x3c1544,null));};exports[_0xd823('0x4e')]=function(_0x28bcdb,_0x1f6050){if(_0x28bcdb[_0xd823('0x4f')]['id']){delete _0x28bcdb[_0xd823('0x4f')]['id'];}return db['OpenchannelApplication']['find']({'where':{'id':_0x28bcdb['params']['id']}})[_0xd823('0x27')](handleEntityNotFound(_0x1f6050,null))[_0xd823('0x27')](saveUpdates(_0x28bcdb[_0xd823('0x4f')],null))[_0xd823('0x27')](respondWithResult(_0x1f6050,null))[_0xd823('0x4c')](handleError(_0x1f6050,null));};exports[_0xd823('0x28')]=function(_0xb2a15c,_0x102b6f){return db['OpenchannelApplication'][_0xd823('0x4b')]({'where':{'id':_0xb2a15c['params']['id']}})[_0xd823('0x27')](handleEntityNotFound(_0x102b6f,null))['then'](removeEntity(_0x102b6f,null))[_0xd823('0x4c')](handleError(_0x102b6f,null));}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.model.js b/server/api/openchannelApplication/openchannelApplication.model.js index 54a242b..a8faf32 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 _0x41f2=['api','moment','bluebird','../../config/environment','exports','define','OpenchannelApplication','openchannel_applications','lodash','util','../../config/logger'];(function(_0xc41594,_0x3ff4a4){var _0x2b803b=function(_0x20d8cc){while(--_0x20d8cc){_0xc41594['push'](_0xc41594['shift']());}};_0x2b803b(++_0x3ff4a4);}(_0x41f2,0x168));var _0x241f=function(_0x51c243,_0xfddeb1){_0x51c243=_0x51c243-0x0;var _0x13efa1=_0x41f2[_0x51c243];return _0x13efa1;};'use strict';var _=require(_0x241f('0x0'));var util=require(_0x241f('0x1'));var logger=require(_0x241f('0x2'))(_0x241f('0x3'));var moment=require(_0x241f('0x4'));var BPromise=require(_0x241f('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x241f('0x6'));var attributes=require('./openchannelApplication.attributes');module[_0x241f('0x7')]=function(_0x20328e,_0x32f98d){return _0x20328e[_0x241f('0x8')](_0x241f('0x9'),attributes,{'tableName':_0x241f('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x8e04=['moment','bluebird','rimraf','define','OpenchannelApplication','utf8mb4','lodash','util','../../config/logger','api'];(function(_0x282685,_0x1650b5){var _0x37dc35=function(_0x58a165){while(--_0x58a165){_0x282685['push'](_0x282685['shift']());}};_0x37dc35(++_0x1650b5);}(_0x8e04,0x10a));var _0x48e0=function(_0x5bb9ac,_0x417c09){_0x5bb9ac=_0x5bb9ac-0x0;var _0x38fd65=_0x8e04[_0x5bb9ac];return _0x38fd65;};'use strict';var _=require(_0x48e0('0x0'));var util=require(_0x48e0('0x1'));var logger=require(_0x48e0('0x2'))(_0x48e0('0x3'));var moment=require(_0x48e0('0x4'));var BPromise=require(_0x48e0('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x48e0('0x6'));var config=require('../../config/environment');var attributes=require('./openchannelApplication.attributes');module['exports']=function(_0x57c169,_0x319d31){return _0x57c169[_0x48e0('0x7')](_0x48e0('0x8'),attributes,{'tableName':'openchannel_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x48e0('0x9'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.rpc.js b/server/api/openchannelApplication/openchannelApplication.rpc.js index 2db5dc4..f672491 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 _0xaed9=['OpenchannelApplication','update','options','where','limit','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','http','request','then','info','request\x20sent','debug','OpenchannelApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','OpenchannelApplication,\x20%s,\x20%s','message','result','catch','UpdateOpenchannelApplication'];(function(_0x4c6baa,_0x300cf7){var _0x2b1935=function(_0x44e6c5){while(--_0x44e6c5){_0x4c6baa['push'](_0x4c6baa['shift']());}};_0x2b1935(++_0x300cf7);}(_0xaed9,0x19b));var _0x9aed=function(_0x4350c0,_0x3a127d){_0x4350c0=_0x4350c0-0x0;var _0x2e2d41=_0xaed9[_0x4350c0];return _0x2e2d41;};'use strict';var _=require(_0x9aed('0x0'));var util=require(_0x9aed('0x1'));var moment=require(_0x9aed('0x2'));var BPromise=require(_0x9aed('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9aed('0x4'));var db=require(_0x9aed('0x5'))['db'];var utils=require(_0x9aed('0x6'));var logger=require('../../config/logger')(_0x9aed('0x7'));var config=require('../../config/environment');var jayson=require(_0x9aed('0x8'));var client=jayson['client'][_0x9aed('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x320147,_0x2342e3,_0x3a8523){return new BPromise(function(_0x31ca7e,_0x10e5bd){return client[_0x9aed('0xa')](_0x320147,_0x3a8523)[_0x9aed('0xb')](function(_0xb1aef6){logger[_0x9aed('0xc')]('OpenchannelApplication,\x20%s,\x20%s',_0x2342e3,_0x9aed('0xd'));logger[_0x9aed('0xe')](_0x9aed('0xf'),_0x2342e3,_0x9aed('0xd'),JSON[_0x9aed('0x10')](_0xb1aef6));if(_0xb1aef6[_0x9aed('0x11')]){if(_0xb1aef6[_0x9aed('0x11')][_0x9aed('0x12')]===0x1f4){logger['error'](_0x9aed('0x13'),_0x2342e3,_0xb1aef6[_0x9aed('0x11')][_0x9aed('0x14')]);return _0x10e5bd(_0xb1aef6[_0x9aed('0x11')][_0x9aed('0x14')]);}logger[_0x9aed('0x11')](_0x9aed('0x13'),_0x2342e3,_0xb1aef6[_0x9aed('0x11')][_0x9aed('0x14')]);return _0x31ca7e(_0xb1aef6[_0x9aed('0x11')][_0x9aed('0x14')]);}else{logger[_0x9aed('0xc')](_0x9aed('0x13'),_0x2342e3,'request\x20sent');_0x31ca7e(_0xb1aef6[_0x9aed('0x15')][_0x9aed('0x14')]);}})[_0x9aed('0x16')](function(_0x286903){logger[_0x9aed('0x11')](_0x9aed('0x13'),_0x2342e3,_0x286903);_0x10e5bd(_0x286903);});});}exports[_0x9aed('0x17')]=function(_0x2b64d1){var _0x39c6bb=this;return new Promise(function(_0x153283,_0x41dc33){return db[_0x9aed('0x18')][_0x9aed('0x19')](_0x2b64d1['body'],{'raw':_0x2b64d1[_0x9aed('0x1a')]?_0x2b64d1[_0x9aed('0x1a')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2b64d1[_0x9aed('0x1a')]?_0x2b64d1['options'][_0x9aed('0x1b')]||null:null,'attributes':_0x2b64d1['options']?_0x2b64d1[_0x9aed('0x1a')]['attributes']||null:null,'limit':_0x2b64d1['options']?_0x2b64d1['options'][_0x9aed('0x1c')]||null:null})[_0x9aed('0xb')](function(_0x113c5d){logger[_0x9aed('0xc')](_0x9aed('0x17'),_0x2b64d1);logger[_0x9aed('0xe')](_0x9aed('0x17'),_0x2b64d1,JSON[_0x9aed('0x10')](_0x113c5d));_0x153283(_0x113c5d);})[_0x9aed('0x16')](function(_0x39a010){logger[_0x9aed('0x11')](_0x9aed('0x17'),_0x39a010[_0x9aed('0x14')],_0x2b64d1);_0x41dc33(_0x39c6bb['error'](0x1f4,_0x39a010[_0x9aed('0x14')]));});});}; \ No newline at end of file +var _0x7619=['where','attributes','limit','then','info','lodash','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','OpenchannelApplication,\x20%s,\x20%s','debug','OpenchannelApplication,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','UpdateOpenchannelApplication','update','body','options'];(function(_0x55d673,_0x57901c){var _0x3fde68=function(_0x5e8597){while(--_0x5e8597){_0x55d673['push'](_0x55d673['shift']());}};_0x3fde68(++_0x57901c);}(_0x7619,0x101));var _0x9761=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7619[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x9761('0x0'));var util=require('util');var moment=require(_0x9761('0x1'));var BPromise=require(_0x9761('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9761('0x3'))['db'];var utils=require(_0x9761('0x4'));var logger=require(_0x9761('0x5'))('rpc');var config=require(_0x9761('0x6'));var jayson=require(_0x9761('0x7'));var client=jayson[_0x9761('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x11ae66,_0x1b24d6,_0x31f99b){return new BPromise(function(_0x1f0573,_0x5c30df){return client[_0x9761('0x9')](_0x11ae66,_0x31f99b)['then'](function(_0x5ea104){logger['info'](_0x9761('0xa'),_0x1b24d6,'request\x20sent');logger[_0x9761('0xb')](_0x9761('0xc'),_0x1b24d6,_0x9761('0xd'),JSON[_0x9761('0xe')](_0x5ea104));if(_0x5ea104[_0x9761('0xf')]){if(_0x5ea104['error']['code']===0x1f4){logger[_0x9761('0xf')]('OpenchannelApplication,\x20%s,\x20%s',_0x1b24d6,_0x5ea104[_0x9761('0xf')][_0x9761('0x10')]);return _0x5c30df(_0x5ea104[_0x9761('0xf')][_0x9761('0x10')]);}logger[_0x9761('0xf')](_0x9761('0xa'),_0x1b24d6,_0x5ea104['error'][_0x9761('0x10')]);return _0x1f0573(_0x5ea104['error'][_0x9761('0x10')]);}else{logger['info'](_0x9761('0xa'),_0x1b24d6,_0x9761('0xd'));_0x1f0573(_0x5ea104[_0x9761('0x11')]['message']);}})[_0x9761('0x12')](function(_0x13a818){logger[_0x9761('0xf')]('OpenchannelApplication,\x20%s,\x20%s',_0x1b24d6,_0x13a818);_0x5c30df(_0x13a818);});});}exports[_0x9761('0x13')]=function(_0x1b3f1e){var _0x360062=this;return new Promise(function(_0x501d08,_0x2ade6e){return db['OpenchannelApplication'][_0x9761('0x14')](_0x1b3f1e[_0x9761('0x15')],{'raw':_0x1b3f1e[_0x9761('0x16')]?_0x1b3f1e['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1b3f1e['options']?_0x1b3f1e[_0x9761('0x16')][_0x9761('0x17')]||null:null,'attributes':_0x1b3f1e[_0x9761('0x16')]?_0x1b3f1e['options'][_0x9761('0x18')]||null:null,'limit':_0x1b3f1e[_0x9761('0x16')]?_0x1b3f1e[_0x9761('0x16')][_0x9761('0x19')]||null:null})[_0x9761('0x1a')](function(_0x5c5ebd){logger[_0x9761('0x1b')](_0x9761('0x13'),_0x1b3f1e);logger['debug'](_0x9761('0x13'),_0x1b3f1e,JSON[_0x9761('0xe')](_0x5c5ebd));_0x501d08(_0x5c5ebd);})[_0x9761('0x12')](function(_0x3adaae){logger[_0x9761('0xf')](_0x9761('0x13'),_0x3adaae[_0x9761('0x10')],_0x1b3f1e);_0x2ade6e(_0x360062[_0x9761('0xf')](0x1f4,_0x3adaae[_0x9761('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/index.js b/server/api/openchannelInteraction/index.js index 0047c93..9ff5136 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 _0x2880=['addMessage','/:id/tags','tracked','addTags','put','openchannel','update','delete','openchannelinteraction:destroy','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./openchannelInteraction.controller','get','isAuthenticated','index','describe','show','/:id/messages','getMessages','download','post','create'];(function(_0x4e9025,_0x245c31){var _0x257f51=function(_0x1bbb3b){while(--_0x1bbb3b){_0x4e9025['push'](_0x4e9025['shift']());}};_0x257f51(++_0x245c31);}(_0x2880,0x68));var _0x0288=function(_0x545913,_0x353f9b){_0x545913=_0x545913-0x0;var _0x13d315=_0x2880[_0x545913];return _0x13d315;};'use strict';var multer=require(_0x0288('0x0'));var util=require(_0x0288('0x1'));var path=require(_0x0288('0x2'));var timeout=require(_0x0288('0x3'));var express=require(_0x0288('0x4'));var router=express[_0x0288('0x5')]();var fs_extra=require(_0x0288('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x0288('0x7'));var config=require(_0x0288('0x8'));var controller=require(_0x0288('0x9'));router[_0x0288('0xa')]('/',auth[_0x0288('0xb')](),controller[_0x0288('0xc')]);router[_0x0288('0xa')]('/describe',auth[_0x0288('0xb')](),controller[_0x0288('0xd')]);router[_0x0288('0xa')]('/:id',auth['isAuthenticated'](),controller[_0x0288('0xe')]);router[_0x0288('0xa')](_0x0288('0xf'),auth[_0x0288('0xb')](),controller[_0x0288('0x10')]);router['get']('/:id/download',auth['isAuthenticated'](),controller[_0x0288('0x11')]);router[_0x0288('0x12')]('/',auth[_0x0288('0xb')](),controller[_0x0288('0x13')]);router['post'](_0x0288('0xf'),auth['isAuthenticated'](),controller[_0x0288('0x14')]);router[_0x0288('0x12')](_0x0288('0x15'),auth[_0x0288('0xb')](),interaction[_0x0288('0x16')]('openchannel','openchannelinteraction:addtags'),controller[_0x0288('0x17')]);router[_0x0288('0x18')]('/:id',auth['isAuthenticated'](),interaction[_0x0288('0x16')](_0x0288('0x19'),'openchannelinteraction:update'),controller[_0x0288('0x1a')]);router[_0x0288('0x1b')]('/:id',auth['isAuthenticated'](),interaction[_0x0288('0x16')](_0x0288('0x19'),_0x0288('0x1c')),controller[_0x0288('0x1d')]);router[_0x0288('0x1b')]('/:id/tags',auth['isAuthenticated'](),controller['removeTags']);module[_0x0288('0x1e')]=router; \ No newline at end of file +var _0x2c88=['isAuthenticated','index','describe','show','getMessages','/:id/download','download','post','create','/:id/messages','tracked','addTags','put','openchannel','openchannelinteraction:update','update','delete','/:id','/:id/tags','removeTags','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelInteraction.controller','get'];(function(_0x3a607e,_0x54d530){var _0x37b106=function(_0x1becae){while(--_0x1becae){_0x3a607e['push'](_0x3a607e['shift']());}};_0x37b106(++_0x54d530);}(_0x2c88,0x1b8));var _0x82c8=function(_0x2721db,_0x4daedb){_0x2721db=_0x2721db-0x0;var _0x8b5675=_0x2c88[_0x2721db];return _0x8b5675;};'use strict';var multer=require('multer');var util=require(_0x82c8('0x0'));var path=require('path');var timeout=require(_0x82c8('0x1'));var express=require(_0x82c8('0x2'));var router=express[_0x82c8('0x3')]();var fs_extra=require(_0x82c8('0x4'));var auth=require(_0x82c8('0x5'));var interaction=require(_0x82c8('0x6'));var config=require(_0x82c8('0x7'));var controller=require(_0x82c8('0x8'));router[_0x82c8('0x9')]('/',auth[_0x82c8('0xa')](),controller[_0x82c8('0xb')]);router['get']('/describe',auth[_0x82c8('0xa')](),controller[_0x82c8('0xc')]);router[_0x82c8('0x9')]('/:id',auth['isAuthenticated'](),controller[_0x82c8('0xd')]);router[_0x82c8('0x9')]('/:id/messages',auth[_0x82c8('0xa')](),controller[_0x82c8('0xe')]);router[_0x82c8('0x9')](_0x82c8('0xf'),auth[_0x82c8('0xa')](),controller[_0x82c8('0x10')]);router[_0x82c8('0x11')]('/',auth['isAuthenticated'](),controller[_0x82c8('0x12')]);router['post'](_0x82c8('0x13'),auth['isAuthenticated'](),controller['addMessage']);router['post']('/:id/tags',auth[_0x82c8('0xa')](),interaction[_0x82c8('0x14')]('openchannel','openchannelinteraction:addtags'),controller[_0x82c8('0x15')]);router[_0x82c8('0x16')]('/:id',auth[_0x82c8('0xa')](),interaction['tracked'](_0x82c8('0x17'),_0x82c8('0x18')),controller[_0x82c8('0x19')]);router[_0x82c8('0x1a')](_0x82c8('0x1b'),auth[_0x82c8('0xa')](),interaction[_0x82c8('0x14')](_0x82c8('0x17'),'openchannelinteraction:destroy'),controller['destroy']);router[_0x82c8('0x1a')](_0x82c8('0x1c'),auth['isAuthenticated'](),controller[_0x82c8('0x1d')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.attributes.js b/server/api/openchannelInteraction/openchannelInteraction.attributes.js index 86aeba8..27621ec 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 _0x649b=['STRING','ENUM','out','BOOLEAN','DATE'];(function(_0x11aecc,_0x322712){var _0x1f454c=function(_0x6bafaf){while(--_0x6bafaf){_0x11aecc['push'](_0x11aecc['shift']());}};_0x1f454c(++_0x322712);}(_0x649b,0x166));var _0xb649=function(_0x4d7c72,_0x143794){_0x4d7c72=_0x4d7c72-0x0;var _0x49539d=_0x649b[_0x4d7c72];return _0x49539d;};'use strict';var Sequelize=require('sequelize');module['exports']={'closed':{'type':Sequelize[_0xb649('0x0')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xb649('0x1')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0xb649('0x2')]},'note':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0xb649('0x1')]},'threadId':{'type':Sequelize[_0xb649('0x2')]},'externalUrl':{'type':Sequelize[_0xb649('0x2')]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0xb649('0x3')]('in',_0xb649('0x4')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0xb649('0x2')]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0xf675=['DATE','ENUM','out','sequelize','exports','BOOLEAN','STRING'];(function(_0x12da78,_0x5f07c0){var _0x32ba3e=function(_0x43b95f){while(--_0x43b95f){_0x12da78['push'](_0x12da78['shift']());}};_0x32ba3e(++_0x5f07c0);}(_0xf675,0x199));var _0x5f67=function(_0xe4c712,_0x1e26d5){_0xe4c712=_0xe4c712-0x0;var _0x101962=_0xf675[_0xe4c712];return _0x101962;};'use strict';var Sequelize=require(_0x5f67('0x0'));module[_0x5f67('0x1')]={'closed':{'type':Sequelize[_0x5f67('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x5f67('0x3')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x5f67('0x3')]},'note':{'type':Sequelize[_0x5f67('0x3')]},'read1stAt':{'type':Sequelize[_0x5f67('0x4')]},'threadId':{'type':Sequelize['STRING']},'externalUrl':{'type':Sequelize[_0x5f67('0x3')]},'lastMsgAt':{'type':Sequelize[_0x5f67('0x4')]},'lastMsgDirection':{'type':Sequelize[_0x5f67('0x5')]('in',_0x5f67('0x6')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize['STRING']},'autoreplyExecuted':{'type':Sequelize[_0x5f67('0x2')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.controller.js b/server/api/openchannelInteraction/openchannelInteraction.controller.js index f04fcab..2ea12bb 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 _0x95b9=['select','u.id','u.fullname','ui.OpenchannelInteractionId','from','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','a.id\x20=\x20i.OpenchannelAccountId','me.OpenchannelInteractionId\x20=\x20i.id','openchannel_interaction_has_tags','it.OpenchannelInteractionId\x20=\x20i.id','tools_tags','t.id\x20=\x20it.TagId','expr','conditions','unreadMessages','value','having','`\x20=\x200','`\x20>\x200','Contact','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','text','Tag','union','User','operator','$substring','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','find','body','start','keys','some','compact','isEmpty','forEach','i.OpenchannelAccountId\x20IN\x20?','createdAt','parse','$gte','$lte','null','\x20IS\x20NULL','\x20=\x20?','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','isArray','tag','replace','isNumeric','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','i.from\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','Sequelize','QueryTypes','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','order','DESC','t.id\x20IN\x20?','resolve','OpenchannelAccountId','i.OpenchannelAccountId\x20IS\x20NOT\x20NULL','user','role','agent','getOpenchannelAccounts','i.OpenchannelAccountId\x20IS\x20NULL','sequelize','toString','keyBy','merge','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20i.from\x20IS\x20NOT\x20NULL\x20AND\x20i.from\x20<>\x20\x27\x27\x20THEN\x20i.from\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','c.firstName','c.lastName','Contact.lastName','c.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','GROUP_CONCAT(DISTINCT\x20t.id)','ui.OpenchannelInteractionId\x20IN\x20?','groupBy','all','rows','params','includeAll','include','options','create','addMessage','ids','getMessages','findOne','hasOwnProperty','filter','format','YYYY-MM-DD\x20HH:mm:ss','OpenchannelMessage','findAll','addTags','setTags','spread','emit','openchannelInteractionTags:save','removeTags','download','unix','join','root','server','files','tmp','attachments','transcript-%d-%s.zip','CmContact','firstName','Attachment','Messages','direction','read','OpenchannelAccount','Account','get','Openchannel','Owner','N.A.','closedAt','disposition','threadId','Public','Private','basename','existsSync','createReadStream','pipe','out','lastName','secret','renderFile','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','err','unlinkSync','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','fs-extra','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','./openchannelInteraction.socket','register','sendStatus','status','end','json','offset','undefined','count','limit','set','apply','reject','save','update','then','destroy','error','stack','name','send','Users','map','fullname','Tags','TagIds','split','push','catch','waiting','talking','answered','unmanaged','total','UserId','closed','index','OpenchannelInteraction','rawAttributes','fieldName','type','key','model','filters','intersection','query','attributes','fields','length','nolimit','sort','where','pick','field','color'];(function(_0x577991,_0x4af074){var _0x112e6b=function(_0x2e1e1e){while(--_0x2e1e1e){_0x577991['push'](_0x577991['shift']());}};_0x112e6b(++_0x4af074);}(_0x95b9,0xa7));var _0x995b=function(_0xd79fd5,_0x314f90){_0xd79fd5=_0xd79fd5-0x0;var _0x31ec10=_0x95b9[_0xd79fd5];return _0x31ec10;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x995b('0x0'));var zipdir=require(_0x995b('0x1'));var jsonpatch=require(_0x995b('0x2'));var rp=require(_0x995b('0x3'));var moment=require('moment');var BPromise=require(_0x995b('0x4'));var Mustache=require('mustache');var util=require(_0x995b('0x5'));var path=require(_0x995b('0x6'));var sox=require(_0x995b('0x7'));var csv=require(_0x995b('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x995b('0x9'));var _=require(_0x995b('0xa'));var squel=require(_0x995b('0xb'));var crypto=require('crypto');var jsforce=require(_0x995b('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x995b('0x8'));var querystring=require(_0x995b('0xd'));var Papa=require(_0x995b('0xe'));var Redis=require(_0x995b('0xf'));var authService=require(_0x995b('0x10'));var qs=require(_0x995b('0x11'));var as=require(_0x995b('0x12'));var pdf=require('../../components/export/pdf');var hardwareService=require(_0x995b('0x13'));var logger=require(_0x995b('0x14'))(_0x995b('0x15'));var utils=require(_0x995b('0x16'));var config=require(_0x995b('0x17'));var licenseUtil=require(_0x995b('0x18'));var db=require('../../mysqldb')['db'];config[_0x995b('0x19')]=_[_0x995b('0x1a')](config[_0x995b('0x19')],{'host':_0x995b('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x995b('0x19')]));require(_0x995b('0x1c'))[_0x995b('0x1d')](socket);function respondWithStatusCode(_0x595df9,_0x427487){_0x427487=_0x427487||0xcc;return function(_0x4f1b9e){if(_0x4f1b9e){return _0x595df9[_0x995b('0x1e')](_0x427487);}return _0x595df9[_0x995b('0x1f')](_0x427487)[_0x995b('0x20')]();};}function respondWithResult(_0x1f0cca,_0x2374aa){_0x2374aa=_0x2374aa||0xc8;return function(_0x567d33){if(_0x567d33){return _0x1f0cca[_0x995b('0x1f')](_0x2374aa)[_0x995b('0x21')](_0x567d33);}};}function respondWithFilteredResult(_0x5bb2c2,_0x425d68){return function(_0x3a79af){if(_0x3a79af){var _0xcfc923=typeof _0x425d68[_0x995b('0x22')]===_0x995b('0x23')&&typeof _0x425d68['limit']===_0x995b('0x23');var _0x2048b0=_0x3a79af['count'];var _0x5460d6=_0xcfc923?0x0:_0x425d68[_0x995b('0x22')];var _0x4fcb65=_0xcfc923?_0x3a79af[_0x995b('0x24')]:_0x425d68[_0x995b('0x22')]+_0x425d68[_0x995b('0x25')];var _0x55d3b9;if(_0x4fcb65>=_0x2048b0){_0x4fcb65=_0x2048b0;_0x55d3b9=0xc8;}else{_0x55d3b9=0xce;}_0x5bb2c2[_0x995b('0x1f')](_0x55d3b9);return _0x5bb2c2[_0x995b('0x26')]('Content-Range',_0x5460d6+'-'+_0x4fcb65+'/'+_0x2048b0)[_0x995b('0x21')](_0x3a79af);}return null;};}function patchUpdates(_0x18be10){return function(_0x1c7874){try{jsonpatch[_0x995b('0x27')](_0x1c7874,_0x18be10,!![]);}catch(_0x2e839b){return BPromise[_0x995b('0x28')](_0x2e839b);}return _0x1c7874[_0x995b('0x29')]();};}function saveUpdates(_0x588244,_0x2f0f9){return function(_0x24aadd){if(_0x24aadd){return _0x24aadd[_0x995b('0x2a')](_0x588244)[_0x995b('0x2b')](function(_0x23f80e){return _0x23f80e;});}return null;};}function removeEntity(_0x34b601,_0x40336d){return function(_0x5ad07e){if(_0x5ad07e){return _0x5ad07e[_0x995b('0x2c')]()[_0x995b('0x2b')](function(){_0x34b601[_0x995b('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1d3ffb,_0x5b7cfd){return function(_0x4b9045){if(!_0x4b9045){_0x1d3ffb[_0x995b('0x1e')](0x194);}return _0x4b9045;};}function handleError(_0xcb60ed,_0x1b30b7){_0x1b30b7=_0x1b30b7||0x1f4;return function(_0x22072e){logger[_0x995b('0x2d')](_0x22072e[_0x995b('0x2e')]);if(_0x22072e[_0x995b('0x2f')]){delete _0x22072e['name'];}_0xcb60ed[_0x995b('0x1f')](_0x1b30b7)[_0x995b('0x30')](_0x22072e);};}function getInteractionUsers(_0x475c90,_0x5a2e7c){return new BPromise(function(_0x24c017,_0xe5d942){try{if(_0x5a2e7c[_0x475c90['id']]){_0x475c90[_0x995b('0x31')]=_[_0x995b('0x32')](_0x5a2e7c[_0x475c90['id']],function(_0x4f0404){return{'id':_0x4f0404['id'],'fullname':_0x4f0404[_0x995b('0x33')]};});}}catch(_0x55d0bf){_0xe5d942(_0x55d0bf);}_0x24c017(_0x475c90);});}function getInteractionTags(_0x384830,_0xc1512b){return new BPromise(function(_0x35d6ed,_0xd6516){try{if(_0x384830['TagIds']){_0x384830[_0x995b('0x34')]=[];_0x384830[_0x995b('0x35')][_0x995b('0x36')](',')['forEach'](function(_0xff69f){_0x384830[_0x995b('0x34')][_0x995b('0x37')](_0xc1512b[_0xff69f]);});}delete _0x384830['TagIds'];}catch(_0x169bea){_0xd6516(_0x169bea);}_0x35d6ed(_0x384830);});}function updateOpenchannelInteraction(_0x35fdfd,_0x1594c7,_0x4e6456){return new BPromise(function(_0x237922,_0x9a8863){return getInteractionUsers(_0x35fdfd,_0x4e6456)[_0x995b('0x2b')](function(_0x44f5a1){return getInteractionTags(_0x44f5a1,_0x1594c7);})[_0x995b('0x2b')](function(_0x2870a8){return getStateInteraction(_0x2870a8);})[_0x995b('0x2b')](function(_0x1b4b19){_0x237922(_0x1b4b19);})[_0x995b('0x38')](function(_0x46d7d9){_0x9a8863(_0x46d7d9);});});}function getStateInteraction(_0x4ca0f1){return new BPromise(function(_0xd3b03c){_0x4ca0f1[_0x995b('0x39')]=0x0;_0x4ca0f1[_0x995b('0x3a')]=0x0;_0x4ca0f1[_0x995b('0x3b')]=0x0;_0x4ca0f1[_0x995b('0x3c')]=0x0;_0x4ca0f1[_0x995b('0x3d')]=0x0;if(!_0x4ca0f1['closed']&&!_0x4ca0f1[_0x995b('0x3e')]){_0x4ca0f1[_0x995b('0x39')]+=0x1;}if(!_0x4ca0f1['closed']&&_0x4ca0f1['UserId']){_0x4ca0f1['talking']+=0x1;if(_0x4ca0f1[_0x995b('0x39')]){_0x4ca0f1[_0x995b('0x39')]-=0x1;}}if(_0x4ca0f1[_0x995b('0x3f')]&&_0x4ca0f1[_0x995b('0x3e')]){_0x4ca0f1[_0x995b('0x3b')]+=0x1;if(_0x4ca0f1[_0x995b('0x3a')]){_0x4ca0f1[_0x995b('0x3a')]-=0x1;}}if(_0x4ca0f1[_0x995b('0x3f')]&&!_0x4ca0f1['UserId']){_0x4ca0f1['unmanaged']+=0x1;if(_0x4ca0f1[_0x995b('0x39')]){_0x4ca0f1[_0x995b('0x39')]-=0x1;}}_0x4ca0f1['total']+=0x1;_0xd3b03c(_0x4ca0f1);});}exports[_0x995b('0x40')]=function(_0x15d460,_0x46c573){var _0x48cf3b={},_0x2420eb={},_0x3eaef6={'count':0x0,'rows':[]};var _0x2052ed=_[_0x995b('0x32')](db[_0x995b('0x41')][_0x995b('0x42')],function(_0xc9d0ed){return{'name':_0xc9d0ed[_0x995b('0x43')],'type':_0xc9d0ed[_0x995b('0x44')][_0x995b('0x45')]};});_0x2420eb[_0x995b('0x46')]=_[_0x995b('0x32')](_0x2052ed,_0x995b('0x2f'));_0x2420eb['query']=_['keys'](_0x15d460['query']);_0x2420eb[_0x995b('0x47')]=_[_0x995b('0x48')](_0x2420eb['model'],_0x2420eb[_0x995b('0x49')]);_0x48cf3b[_0x995b('0x4a')]=_[_0x995b('0x48')](_0x2420eb[_0x995b('0x46')],qs[_0x995b('0x4b')](_0x15d460[_0x995b('0x49')][_0x995b('0x4b')]));_0x48cf3b[_0x995b('0x4a')]=_0x48cf3b['attributes'][_0x995b('0x4c')]?_0x48cf3b['attributes']:_0x2420eb['model'];if(!_0x15d460['query']['hasOwnProperty'](_0x995b('0x4d'))){_0x48cf3b[_0x995b('0x25')]=qs[_0x995b('0x25')](_0x15d460['query'][_0x995b('0x25')]);_0x48cf3b[_0x995b('0x22')]=qs[_0x995b('0x22')](_0x15d460['query'][_0x995b('0x22')]);}_0x48cf3b['order']=qs[_0x995b('0x4e')](_0x15d460[_0x995b('0x49')][_0x995b('0x4e')]);_0x48cf3b[_0x995b('0x4f')]=qs[_0x995b('0x47')](_[_0x995b('0x50')](_0x15d460[_0x995b('0x49')],_0x2420eb[_0x995b('0x47')]),_0x2052ed);var _0x100768=[];var _0x2c3b0f=squel['select']()[_0x995b('0x51')]('id')[_0x995b('0x51')](_0x995b('0x2f'))['field'](_0x995b('0x52'))['from']('tools_tags');var _0x4ecd04=squel[_0x995b('0x53')]()['field'](_0x995b('0x54'))[_0x995b('0x51')](_0x995b('0x55'))['field'](_0x995b('0x56'))[_0x995b('0x57')]('user_has_openchannel_interactions','ui')[_0x995b('0x58')](_0x995b('0x59'),'u',_0x995b('0x5a'));var _0x58d03d=squel[_0x995b('0x53')]()[_0x995b('0x57')](_0x995b('0x5b'),'i')[_0x995b('0x58')](_0x995b('0x5c'),'c',_0x995b('0x5d'))[_0x995b('0x58')](_0x995b('0x59'),'o',_0x995b('0x5e'))[_0x995b('0x58')](_0x995b('0x5f'),'a',_0x995b('0x60'))['left_join']('openchannel_messages','me',_0x995b('0x61'))[_0x995b('0x58')](_0x995b('0x62'),'it',_0x995b('0x63'))[_0x995b('0x58')](_0x995b('0x64'),'t',_0x995b('0x65'));var _0x265c18=squel['expr']();var _0x4dc7ec=[];var _0x2e7fda=squel[_0x995b('0x66')]();var _0x1218cf;if(_0x15d460[_0x995b('0x49')]['search']){_0x1218cf=as['parseSearch'](_0x15d460[_0x995b('0x49')]['search']);var _0x4cb67c=_0x1218cf['sqlOperator'];for(var _0x18d073=0x0;_0x18d073<_0x1218cf[_0x995b('0x67')][_0x995b('0x4c')];_0x18d073++){var _0x5c5353=_0x1218cf['conditions'][_0x18d073];var _0x1383dc='i';var _0x404b10=_['find'](_0x2052ed,[_0x995b('0x2f'),_0x5c5353[_0x995b('0x51')]]);if(!_0x404b10){switch(_0x5c5353[_0x995b('0x51')]){case _0x995b('0x68'):if(_0x5c5353[_0x995b('0x69')]==0x1){_0x58d03d[_0x995b('0x6a')]('`'+_0x5c5353[_0x995b('0x51')]+_0x995b('0x6b'));}else{_0x58d03d[_0x995b('0x6a')]('`'+_0x5c5353[_0x995b('0x51')]+_0x995b('0x6c'));}break;case _0x995b('0x6d'):if(_0x5c5353['operator']==='$substring'){if(_0x5c5353[_0x995b('0x69')]['split']('\x20')[_0x995b('0x4c')]>0x1){_0x265c18[_0x4cb67c]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x995b('0x6e')](_0x5c5353[_0x995b('0x69')]),null);}else{var _0x332d5f='%'+_0x5c5353['value']+'%';_0x265c18[_0x4cb67c](_0x995b('0x6f'),_0x332d5f,_0x332d5f,_0x332d5f);}}else{_0x404b10=_['find'](_0x2052ed,[_0x995b('0x2f'),_0x995b('0x70')]);_0x5c5353[_0x995b('0x51')]=_0x995b('0x70');_0x7a7dcf=as[_0x995b('0x71')](_0x1383dc,_0x404b10['type'],_0x5c5353);_0x265c18[_0x4cb67c](_0x7a7dcf[_0x995b('0x72')],_0x7a7dcf['value']['start'],_0x7a7dcf[_0x995b('0x69')][_0x995b('0x20')]);}break;case _0x995b('0x73'):var _0x4d4e49=_0x5c5353['value'][_0x995b('0x36')](',')['map'](function(_0x27f91a){return Number(_0x27f91a);});_0x4d4e49['forEach'](function(_0x4b38d7){_0x2e7fda['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x4b38d7+',%');});_0x4dc7ec=_[_0x995b('0x74')](_0x4dc7ec,_0x4d4e49);break;case _0x995b('0x75'):if(_0x5c5353[_0x995b('0x76')]===_0x995b('0x77')){_0x265c18[_0x4cb67c](_0x995b('0x78'),'%'+_0x5c5353['value']+'%',null);}else{_0x404b10=_[_0x995b('0x79')](_0x2052ed,[_0x995b('0x2f'),_0x995b('0x3e')]);_0x5c5353[_0x995b('0x51')]=_0x995b('0x3e');_0x7a7dcf=as['buildExpression'](_0x1383dc,_0x404b10[_0x995b('0x44')],_0x5c5353);_0x265c18[_0x4cb67c](_0x7a7dcf[_0x995b('0x72')],_0x7a7dcf[_0x995b('0x69')]['start'],_0x7a7dcf[_0x995b('0x69')][_0x995b('0x20')]);}break;case _0x995b('0x7a'):_0x7a7dcf=as[_0x995b('0x71')]('me',null,_0x5c5353);_0x265c18[_0x4cb67c](_0x7a7dcf[_0x995b('0x72')],_0x7a7dcf['value'][_0x995b('0x7b')],_0x7a7dcf[_0x995b('0x69')][_0x995b('0x20')]);break;}}else{var _0x7a7dcf=as[_0x995b('0x71')](_0x1383dc,_0x404b10[_0x995b('0x44')],_0x5c5353);_0x265c18[_0x4cb67c](_0x7a7dcf[_0x995b('0x72')],_0x7a7dcf[_0x995b('0x69')]['start'],_0x7a7dcf[_0x995b('0x69')][_0x995b('0x20')]);}}}else{var _0x5b1831=_(_0x15d460[_0x995b('0x49')])[_0x995b('0x7c')]()[_0x995b('0x32')](function(_0x54dbc0){return _[_0x995b('0x7d')](_0x2052ed,[_0x995b('0x2f'),_0x54dbc0])?_0x54dbc0:undefined;})[_0x995b('0x7e')]()[_0x995b('0x69')]();if(!_[_0x995b('0x7f')](_0x5b1831)){_0x5b1831[_0x995b('0x80')](function(_0x13b163){if(_0x13b163==='OpenchannelAccountId'){_0x58d03d[_0x995b('0x4f')](_0x995b('0x81'),[]['concat'](_0x15d460[_0x995b('0x49')][_0x13b163]));}else if(_0x13b163===_0x995b('0x82')){var _0xf1e218=JSON[_0x995b('0x83')](_0x15d460['query'][_0x13b163])[_0x995b('0x84')];var _0x156fd1=JSON[_0x995b('0x83')](_0x15d460['query'][_0x13b163])[_0x995b('0x85')];_0x58d03d['where']('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0xf1e218,_0x156fd1);}else{if(_0x15d460[_0x995b('0x49')][_0x13b163]===_0x995b('0x86')){_0x58d03d[_0x995b('0x4f')]('i.'+_0x13b163+_0x995b('0x87'));}else{_0x58d03d[_0x995b('0x4f')]('i.'+_0x13b163+_0x995b('0x88'),_0x15d460['query'][_0x13b163]);}}});}if(_0x15d460[_0x995b('0x49')]['read']){if(_0x15d460['query']['read']==0x1){_0x58d03d[_0x995b('0x6a')](_0x995b('0x89'));}else{_0x58d03d['having'](_0x995b('0x8a'));}}if(_0x15d460[_0x995b('0x49')]['tag']){_0x4dc7ec=_[_0x995b('0x8b')](_0x15d460['query'][_0x995b('0x8c')])?_0x15d460[_0x995b('0x49')][_0x995b('0x8c')]:new Array(_0x15d460[_0x995b('0x49')][_0x995b('0x8c')]);_0x4dc7ec['forEach'](function(_0x4caef9){_0x2e7fda['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x4caef9+',%');});}if(_0x15d460['query']['filter']){var _0x58e2e9=_0x15d460[_0x995b('0x49')]['filter']['replace']('\x5c','\x5c\x5c')[_0x995b('0x8d')](/'/g,'\x27\x27');if(qs[_0x995b('0x8e')](_0x58e2e9)){_0x265c18['or']('i.id\x20LIKE\x20?',_0x58e2e9+'%');}else{_0x265c18['or'](_0x995b('0x8f'),qs['getFullTextValue'](_0x58e2e9))['or'](_0x995b('0x90'),_0x58e2e9+'%')['or'](_0x995b('0x91'),_0x58e2e9+'%');}}}_0x58d03d[_0x995b('0x4f')](_0x265c18);_0x58d03d[_0x995b('0x92')](_0x995b('0x93'));var _0x14e3d0={'type':db[_0x995b('0x94')][_0x995b('0x95')]['SELECT'],'raw':!![]};var _0x8d6b55=_0x58d03d[_0x995b('0x96')]();_0x8d6b55['field']('i.id');_0x8d6b55[_0x995b('0x51')](_0x995b('0x97'),_0x995b('0x68'));if(_0x48cf3b['order']){_0x48cf3b['order'][_0x995b('0x80')](function(_0x5a3c40){var _0x1ca57c=_0x5a3c40[0x0]===_0x995b('0x98')?_0x5a3c40[0x0]:'i.'+_0x5a3c40[0x0];_0x58d03d[_0x995b('0x99')](_0x1ca57c,_0x5a3c40[0x1]===_0x995b('0x9a')?![]:!![]);});}if(!_[_0x995b('0x7f')](_0x4dc7ec)){_0x58d03d[_0x995b('0x6a')](_0x2e7fda);_0x8d6b55[_0x995b('0x4f')](_0x995b('0x9b'),_0x4dc7ec);}BPromise[_0x995b('0x9c')]()[_0x995b('0x2b')](function(){if(!_0x1218cf){if(_0x15d460[_0x995b('0x49')][_0x995b('0x9d')])return;_0x8d6b55['where'](_0x995b('0x9e'));_0x58d03d['where'](_0x995b('0x9e'));return;}if(_0x15d460[_0x995b('0x9f')][_0x995b('0xa0')]!==_0x995b('0xa1'))return;return _0x15d460[_0x995b('0x9f')][_0x995b('0xa2')]({'attributes':['id'],'raw':!![]})['then'](function(_0x5c482d){if(_[_0x995b('0x7f')](_0x5c482d)){_0x8d6b55['where'](_0x995b('0xa3'));_0x58d03d['where'](_0x995b('0xa3'));}else{_0x8d6b55[_0x995b('0x4f')](_0x995b('0x81'),_[_0x995b('0x32')](_0x5c482d,'id'));_0x58d03d['where'](_0x995b('0x81'),_['map'](_0x5c482d,'id'));}});})[_0x995b('0x2b')](function(){if(_0x15d460[_0x995b('0x9f')][_0x995b('0xa0')]==='agent'&&!_0x1218cf&&!_0x15d460[_0x995b('0x49')][_0x995b('0x9d')])return[];return db[_0x995b('0xa4')]['query'](_0x8d6b55[_0x995b('0xa5')](),_0x14e3d0);})[_0x995b('0x2b')](function(_0xdf4a23){_0x3eaef6[_0x995b('0x24')]=_0xdf4a23['length'];if(_0x3eaef6[_0x995b('0x24')]===0x0)return[];return db[_0x995b('0xa4')][_0x995b('0x49')](_0x2c3b0f[_0x995b('0xa5')](),_0x14e3d0)['then'](function(_0xa37b34){_0x100768=_[_0x995b('0xa6')](_0xa37b34,'id');_0x14e3d0=_[_0x995b('0xa7')](_0x14e3d0,{'model':db['OpenchannelInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x15d460['query']['fields']){_0x48cf3b[_0x995b('0x4a')]['forEach'](function(_0x1c34cf){_0x58d03d[_0x995b('0x51')]('i.'+_0x1c34cf);});}else{_0x58d03d[_0x995b('0x51')](_0x995b('0x97'),_0x995b('0x68'));_0x58d03d[_0x995b('0x51')]('a.key',_0x995b('0xa8'));_0x58d03d['field'](_0x995b('0xa9'),_0x995b('0xaa'));_0x58d03d['field'](_0x995b('0xab'),_0x995b('0x98'));_0x58d03d[_0x995b('0x51')]('i.*');_0x58d03d['field'](_0x995b('0xac'),'Contact.firstName');_0x58d03d[_0x995b('0x51')](_0x995b('0xad'),_0x995b('0xae'));_0x58d03d[_0x995b('0x51')](_0x995b('0xaf'),'Contact.email');_0x58d03d[_0x995b('0x51')](_0x995b('0xb0'),_0x995b('0xb1'));_0x58d03d[_0x995b('0x51')](_0x995b('0xb2'),_0x995b('0xb3'));_0x58d03d[_0x995b('0x51')](_0x995b('0xb4'),_0x995b('0xb5'));_0x58d03d[_0x995b('0x51')](_0x995b('0xb6'),_0x995b('0xb7'));_0x58d03d['field']('o.internal','Owner.internal');_0x58d03d[_0x995b('0x51')](_0x995b('0xb8'),_0x995b('0x35'));}if(_0x48cf3b['limit'])_0x58d03d[_0x995b('0x25')](_0x48cf3b[_0x995b('0x25')]);if(_0x48cf3b[_0x995b('0x22')])_0x58d03d[_0x995b('0x22')](_0x48cf3b[_0x995b('0x22')]);return db[_0x995b('0xa4')][_0x995b('0x49')](_0x58d03d[_0x995b('0xa5')](),_0x14e3d0);})['then'](function(_0x3cc875){if(_0x3cc875[_0x995b('0x4c')]>0x0)_0x4ecd04[_0x995b('0x4f')](_0x995b('0xb9'),_['map'](_0x3cc875,'id'));return db[_0x995b('0xa4')]['query'](_0x4ecd04[_0x995b('0xa5')](),_0x14e3d0)[_0x995b('0x2b')](function(_0x4ce5f2){var _0x429607=_[_0x995b('0xba')](_0x4ce5f2,'OpenchannelInteractionId');var _0x57fa2e=[];_0x3cc875['forEach'](function(_0x5426d9){_0x57fa2e[_0x995b('0x37')](updateOpenchannelInteraction(_0x5426d9,_0x100768,_0x429607));});return BPromise[_0x995b('0xbb')](_0x57fa2e);});});})[_0x995b('0x2b')](function(_0x415a6f){_0x3eaef6[_0x995b('0xbc')]=_0x415a6f;return _0x3eaef6;})[_0x995b('0x2b')](respondWithFilteredResult(_0x46c573,_0x48cf3b))[_0x995b('0x38')](handleError(_0x46c573,null));};exports['show']=function(_0x19f747,_0x1baef5){var _0x12f078={};if(_0x19f747[_0x995b('0x49')][_0x995b('0x44')]&&_0x19f747[_0x995b('0x49')][_0x995b('0x44')]==='from'){_0x12f078['from']=_0x19f747[_0x995b('0xbd')]['id'];}else{_0x12f078['id']=_0x19f747['params']['id'];}var _0x2aa53e={'raw':![],'where':_0x12f078},_0x237c4d={};_0x237c4d[_0x995b('0x46')]=_[_0x995b('0x7c')](db[_0x995b('0x41')][_0x995b('0x42')]);_0x237c4d[_0x995b('0x49')]=_[_0x995b('0x7c')](_0x19f747[_0x995b('0x49')]);_0x237c4d[_0x995b('0x47')]=_[_0x995b('0x48')](_0x237c4d[_0x995b('0x46')],_0x237c4d[_0x995b('0x49')]);_0x2aa53e['attributes']=_[_0x995b('0x48')](_0x237c4d[_0x995b('0x46')],qs[_0x995b('0x4b')](_0x19f747[_0x995b('0x49')][_0x995b('0x4b')]));_0x2aa53e['attributes']=_0x2aa53e[_0x995b('0x4a')]['length']?_0x2aa53e[_0x995b('0x4a')]:_0x237c4d[_0x995b('0x46')];if(_0x19f747[_0x995b('0x49')][_0x995b('0xbe')]){_0x2aa53e[_0x995b('0xbf')]=[{'all':!![]}];}_0x2aa53e=_['merge']({},_0x2aa53e,_0x19f747[_0x995b('0xc0')]);return db[_0x995b('0x41')]['find'](_0x2aa53e)['then'](handleEntityNotFound(_0x1baef5,null))[_0x995b('0x2b')](respondWithResult(_0x1baef5,null))[_0x995b('0x38')](handleError(_0x1baef5,null));};exports[_0x995b('0xc1')]=function(_0x1770ba,_0x1c505c){return db[_0x995b('0x41')]['create'](_0x1770ba[_0x995b('0x7a')],{})[_0x995b('0x2b')](respondWithResult(_0x1c505c,0xc9))[_0x995b('0x38')](handleError(_0x1c505c,null));};exports[_0x995b('0x2a')]=function(_0x494571,_0x3dcb4c){if(_0x494571['body']['id']){delete _0x494571[_0x995b('0x7a')]['id'];}return db[_0x995b('0x41')][_0x995b('0x79')]({'where':{'id':_0x494571[_0x995b('0xbd')]['id']}})[_0x995b('0x2b')](handleEntityNotFound(_0x3dcb4c,null))[_0x995b('0x2b')](saveUpdates(_0x494571[_0x995b('0x7a')],null))['then'](respondWithResult(_0x3dcb4c,null))['catch'](handleError(_0x3dcb4c,null));};exports[_0x995b('0x2c')]=function(_0x2f8243,_0x5dafab){return db[_0x995b('0x41')]['find']({'where':{'id':_0x2f8243['params']['id']}})[_0x995b('0x2b')](handleEntityNotFound(_0x5dafab,null))[_0x995b('0x2b')](removeEntity(_0x5dafab,null))[_0x995b('0x38')](handleError(_0x5dafab,null));};exports['describe']=function(_0x2f48dc,_0x2de21a){return db[_0x995b('0x41')]['describe']()['then'](respondWithResult(_0x2de21a,null))[_0x995b('0x38')](handleError(_0x2de21a,null));};exports['addMessage']=function(_0x2162ea,_0x2d2c11,_0x3d253e){return db['OpenchannelMessage'][_0x995b('0x79')]({'where':{'id':_0x2162ea[_0x995b('0xbd')]['id']}})[_0x995b('0x2b')](handleEntityNotFound(_0x2d2c11,null))[_0x995b('0x2b')](function(_0x3a9a4f){if(_0x3a9a4f){return _0x3a9a4f[_0x995b('0xc2')](_0x2162ea[_0x995b('0x7a')]['ids'],_['omit'](_0x2162ea[_0x995b('0x7a')],[_0x995b('0xc3'),'id'])||{});}})[_0x995b('0x2b')](respondWithResult(_0x2d2c11,null))[_0x995b('0x38')](handleError(_0x2d2c11,null));};exports[_0x995b('0xc4')]=function(_0x5b44e2,_0x17dd91,_0x3378d5){var _0x3f90d7={'raw':![],'where':{}};var _0x1bd1fd={};var _0x2ffe27={'count':0x0,'rows':[]};return db['OpenchannelInteraction'][_0x995b('0xc5')]({'where':{'id':_0x5b44e2[_0x995b('0xbd')]['id']}})[_0x995b('0x2b')](handleEntityNotFound(_0x17dd91,null))[_0x995b('0x2b')](function(_0x5475c6){if(_0x5475c6){_0x1bd1fd[_0x995b('0x46')]=_[_0x995b('0x7c')](db['OpenchannelMessage'][_0x995b('0x42')]);_0x1bd1fd[_0x995b('0x49')]=_['keys'](_0x5b44e2[_0x995b('0x49')]);_0x1bd1fd[_0x995b('0x47')]=_['intersection'](_0x1bd1fd['model'],_0x1bd1fd['query']);_0x3f90d7[_0x995b('0x4a')]=_[_0x995b('0x48')](_0x1bd1fd[_0x995b('0x46')],qs['fields'](_0x5b44e2[_0x995b('0x49')][_0x995b('0x4b')]));_0x3f90d7[_0x995b('0x4a')]=_0x3f90d7[_0x995b('0x4a')]['length']?_0x3f90d7[_0x995b('0x4a')]:_0x1bd1fd['model'];if(!_0x5b44e2[_0x995b('0x49')][_0x995b('0xc6')](_0x995b('0x4d'))){_0x3f90d7['limit']=qs[_0x995b('0x25')](_0x5b44e2['query'][_0x995b('0x25')]);_0x3f90d7[_0x995b('0x22')]=qs[_0x995b('0x22')](_0x5b44e2[_0x995b('0x49')]['offset']);}_0x3f90d7[_0x995b('0x99')]=qs[_0x995b('0x4e')](_0x5b44e2['query']['sort']);_0x3f90d7[_0x995b('0x4f')]=qs[_0x995b('0x47')](_[_0x995b('0x50')](_0x5b44e2[_0x995b('0x49')],_0x1bd1fd[_0x995b('0x47')]));_0x3f90d7[_0x995b('0x4f')]['OpenchannelInteractionId']=_0x5475c6['id'];if(_0x5b44e2[_0x995b('0x49')][_0x995b('0xc7')]){_0x3f90d7[_0x995b('0x4f')]=_[_0x995b('0xa7')](_0x3f90d7[_0x995b('0x4f')],{'$or':_[_0x995b('0x32')](_0x3f90d7['attributes'],function(_0x17e3d2){var _0x5ec891={};_0x5ec891[_0x17e3d2]={'$like':'%'+_0x5b44e2[_0x995b('0x49')][_0x995b('0xc7')]+'%'};return _0x5ec891;})});}if(_0x5b44e2['query']['$gte']){var _0x1d16e9=_0x5b44e2[_0x995b('0x49')]['$gte']['split'](',');var _0x1fe4e1={};_0x1fe4e1[_0x1d16e9[0x0]]={'$gte':moment(_0x1d16e9[0x1])[_0x995b('0xc8')](_0x995b('0xc9'))};_0x3f90d7[_0x995b('0x4f')]=_[_0x995b('0xa7')](_0x3f90d7['where'],_0x1fe4e1);}_0x3f90d7=_['merge']({},_0x3f90d7,_0x5b44e2[_0x995b('0xc0')]);return db[_0x995b('0xca')][_0x995b('0x24')]({'where':_0x3f90d7[_0x995b('0x4f')]})[_0x995b('0x2b')](function(_0xb3817f){_0x2ffe27[_0x995b('0x24')]=_0xb3817f;if(_0x5b44e2[_0x995b('0x49')]['includeAll']){_0x3f90d7['include']=[{'all':!![]}];}return db[_0x995b('0xca')][_0x995b('0xcb')](_0x3f90d7);})[_0x995b('0x2b')](function(_0x24769d){_0x2ffe27[_0x995b('0xbc')]=_0x24769d;return _0x2ffe27;});}})[_0x995b('0x2b')](respondWithFilteredResult(_0x17dd91,_0x3f90d7))[_0x995b('0x38')](handleError(_0x17dd91,null));};exports[_0x995b('0xcc')]=function(_0x441d3f,_0x15b634,_0x4507d0){return db[_0x995b('0x41')][_0x995b('0x79')]({'where':{'id':_0x441d3f[_0x995b('0xbd')]['id']}})[_0x995b('0x2b')](handleEntityNotFound(_0x15b634,null))[_0x995b('0x2b')](function(_0x308892){if(_0x308892){return _0x308892[_0x995b('0xcd')](_0x441d3f[_0x995b('0x7a')]['ids'],_['omit'](_0x441d3f['body'],[_0x995b('0xc3'),'id'])||{})[_0x995b('0xce')](function(){return db[_0x995b('0x73')]['findAll']({'attributes':['id',_0x995b('0x2f'),'color'],'where':{'id':_0x441d3f[_0x995b('0x7a')][_0x995b('0xc3')]}});})[_0x995b('0x2b')](function(_0x1d03f){socket[_0x995b('0xcf')](_0x995b('0xd0'),{'id':Number(_0x441d3f[_0x995b('0xbd')]['id']),'tags':_0x1d03f||[]});return{'id':Number(_0x441d3f[_0x995b('0xbd')]['id']),'tags':_0x1d03f||[]};});}})[_0x995b('0x2b')](respondWithResult(_0x15b634,null))[_0x995b('0x38')](handleError(_0x15b634,null));};exports[_0x995b('0xd1')]=function(_0x31bb9e,_0x5e6907,_0x729dba){return db[_0x995b('0x41')][_0x995b('0x79')]({'where':{'id':_0x31bb9e['params']['id']}})[_0x995b('0x2b')](handleEntityNotFound(_0x5e6907,null))[_0x995b('0x2b')](function(_0x463b4f){if(_0x463b4f){return _0x463b4f[_0x995b('0xd1')](_0x31bb9e['query'][_0x995b('0xc3')]);}})[_0x995b('0x2b')](respondWithStatusCode(_0x5e6907,null))[_0x995b('0x38')](handleError(_0x5e6907,null));};exports[_0x995b('0xd2')]=function(_0x5caa56,_0x1428fa){var _0x246780=moment()[_0x995b('0xd3')]()[_0x995b('0xa5')]();var _0x54dcc5=path[_0x995b('0xd4')](config[_0x995b('0xd5')],_0x995b('0xd6'),_0x995b('0xd7'),_0x995b('0xd8'));var _0x4c43bd=path['join'](config[_0x995b('0xd5')],_0x995b('0xd6'),_0x995b('0xd7'),_0x995b('0xd9'));var _0x536e51=path[_0x995b('0xd4')](_0x54dcc5,_0x246780);var _0x24904f=util[_0x995b('0xc8')](_0x995b('0xda'),_0x5caa56[_0x995b('0xbd')]['id'],_0x246780);var _0x358a5c=path['join'](_0x54dcc5,_0x24904f);var _0x129956=[];_0x129956['push']({'model':db[_0x995b('0x75')],'as':_0x995b('0x75'),'attributes':['id',_0x995b('0x33')],'raw':!![]});_0x129956[_0x995b('0x37')]({'model':db[_0x995b('0xdb')],'as':_0x995b('0x6d'),'attributes':['id',_0x995b('0xdc'),'lastName'],'raw':!![]});if(_0x5caa56[_0x995b('0x49')][_0x995b('0xd9')]){_0x129956[_0x995b('0x37')]({'model':db['Attachment'],'as':_0x995b('0xdd'),'raw':!![]});}var _0x53b004=[{'model':db[_0x995b('0xca')],'as':_0x995b('0xde'),'attributes':['id',_0x995b('0x7a'),_0x995b('0x82'),_0x995b('0xdf'),'secret',_0x995b('0xe0')],'include':_0x129956}];_0x53b004[_0x995b('0x37')]({'model':db[_0x995b('0xe1')],'as':_0x995b('0xe2'),'attributes':['id',_0x995b('0x2f')]});_0x53b004['push']({'model':db[_0x995b('0x75')],'as':'Owner','attributes':['id','fullname']});return db[_0x995b('0x41')][_0x995b('0x79')]({'where':{'id':_0x5caa56[_0x995b('0xbd')]['id']},'include':_0x53b004})['then'](handleEntityNotFound(_0x1428fa,null))[_0x995b('0x2b')](function(_0x5a7528){if(_0x5a7528){var _0x2b1151=_0x5a7528[_0x995b('0xe3')]({'plain':!![]});fs['mkdirSync'](_0x536e51);var _0x2571c4={'channel':_0x995b('0xe4'),'account':_0x2b1151[_0x995b('0xe2')][_0x995b('0x2f')],'agent':_0x2b1151[_0x995b('0xe5')]?_0x2b1151[_0x995b('0xe5')]['fullname']:_0x995b('0xe6'),'createdAt':moment(_0x2b1151['createdAt'])[_0x995b('0xc8')](_0x995b('0xc9'))[_0x995b('0xa5')](),'closedAt':_0x2b1151[_0x995b('0x3f')]?moment(_0x2b1151[_0x995b('0xe7')])[_0x995b('0xc8')]('YYYY-MM-DD\x20HH:mm:ss')[_0x995b('0xa5')]():'','disposition':_0x2b1151[_0x995b('0xe8')],'visibility':_0x2b1151[_0x995b('0xe9')]?_0x995b('0xea'):_0x995b('0xeb'),'messages':_(_0x2b1151[_0x995b('0xde')])[_0x995b('0xc7')]({'secret':![]})[_0x995b('0x32')](function(_0x4ddad9){if(_0x4ddad9[_0x995b('0xdd')]){var _0x5237d4=path[_0x995b('0xd4')](_0x4c43bd,_0x4ddad9['Attachment'][_0x995b('0xec')]);if(fs[_0x995b('0xed')](_0x5237d4)){fs[_0x995b('0xee')](_0x5237d4)[_0x995b('0xef')](fs['createWriteStream'](path['join'](_0x536e51,_0x4ddad9[_0x995b('0xdd')][_0x995b('0xec')])));}}return{'date':moment(_0x4ddad9['createdAt'])[_0x995b('0xc8')]('YYYY-MM-DD\x20HH:mm:ss')['toString'](),'sender':_0x4ddad9[_0x995b('0xdf')]===_0x995b('0xf0')?_0x4ddad9[_0x995b('0x75')]?_0x4ddad9[_0x995b('0x75')]['fullname']:'System':_0x4ddad9[_0x995b('0x6d')][_0x995b('0xdc')]+(_0x4ddad9[_0x995b('0x6d')][_0x995b('0xf1')]?'\x20'+_0x4ddad9['Contact'][_0x995b('0xf1')]:''),'body':_0x4ddad9[_0x995b('0xdd')]?_0x4ddad9['Attachment']['basename']:_0x4ddad9[_0x995b('0x7a')],'direction':_0x4ddad9[_0x995b('0xdf')]===_0x995b('0xf0')?'A':'C','secret':_0x4ddad9[_0x995b('0xf2')],'read':_0x4ddad9[_0x995b('0xe0')],'attachment':_0x4ddad9[_0x995b('0xdd')]};})[_0x995b('0x69')]()};return ejs[_0x995b('0xf3')](path[_0x995b('0xd4')](config[_0x995b('0xd5')],_0x995b('0xd6'),'views',_0x995b('0xf4')),{'interaction':_0x2571c4})['then'](function(_0x2882a7){var _0x2e3b2a=path[_0x995b('0xd4')](_0x536e51,_0x995b('0xf5')+_0x2b1151['id']+'-'+_0x246780+_0x995b('0xf6'));var _0x59df13={'path':_0x2e3b2a,'channel':_0x995b('0xe4'),'interactionId':_0x2b1151['id']};return pdf[_0x995b('0xf7')](_0x2882a7,_0x59df13);})[_0x995b('0x2b')](function(){return new BPromise(function(_0x40696e,_0x429433){zipdir(_0x536e51,{'saveTo':_0x358a5c},function(_0xa5ddc3,_0x198ca9){if(_0xa5ddc3)return _0x429433(_0xa5ddc3);return _0x40696e(_0x198ca9);});})[_0x995b('0x2b')](function(){return new BPromise(function(_0x7e14b3,_0x341175){rimraf(_0x536e51,function(_0x1e1668){if(_0x1e1668)_0x341175(_0x1e1668);return _0x7e14b3();});});})[_0x995b('0x2b')](function(){return _0x1428fa['download'](_0x358a5c,_0x24904f,function(_0x449129){if(_0x449129){console['log'](_0x995b('0xf8'),_0x449129);}else{fs[_0x995b('0xf9')](_0x358a5c);}});});});}else{return _0x1428fa[_0x995b('0x1e')](0xc8);}})[_0x995b('0x38')](handleError(_0x1428fa,null));}; \ No newline at end of file +var _0x883f=['spread','emit','openchannelInteractionTags:save','removeTags','download','unix','join','root','server','files','attachments','firstName','lastName','Attachment','Messages','secret','OpenchannelAccount','Account','Owner','get','mkdirSync','Openchannel','N.A.','createdAt','closedAt','disposition','threadId','Public','Private','existsSync','createReadStream','pipe','direction','System','basename','views','downloadInteraction.ejs','transcript-','.pdf','log','err','unlinkSync','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../components/export/pdf','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','redis','localhost','socket.io-emitter','./openchannelInteraction.socket','register','sendStatus','end','status','offset','limit','count','set','Content-Range','json','apply','update','then','destroy','error','name','send','Users','fullname','TagIds','split','Tags','unmanaged','total','UserId','waiting','closed','talking','answered','index','map','OpenchannelInteraction','fieldName','key','model','query','keys','intersection','attributes','fields','length','nolimit','order','sort','filters','select','field','color','from','tools_tags','u.fullname','openchannel_interactions','cm_contacts','left_join','o.id\x20=\x20i.UserId','openchannel_accounts','a.id\x20=\x20i.OpenchannelAccountId','openchannel_interaction_has_tags','it.OpenchannelInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','conditions','unreadMessages','value','`\x20=\x200','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?','find','ContactId','buildExpression','type','text','Tag','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','body','some','compact','isEmpty','concat','parse','$gte','where','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','\x20IS\x20NULL','read','`unreadMessages`\x20>\x200','tag','isArray','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','QueryTypes','SELECT','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','DESC','t.id\x20IN\x20?','OpenchannelAccountId','i.OpenchannelAccountId\x20IS\x20NOT\x20NULL','role','user','getOpenchannelAccounts','i.OpenchannelAccountId\x20IS\x20NULL','i.OpenchannelAccountId\x20IN\x20?','agent','toString','sequelize','keyBy','merge','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20i.from\x20IS\x20NOT\x20NULL\x20AND\x20i.from\x20<>\x20\x27\x27\x20THEN\x20i.from\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.firstName','c.lastName','Contact.lastName','c.email','Contact.email','Contact.phone','Owner.fullname','GROUP_CONCAT(DISTINCT\x20t.id)','push','all','rows','catch','params','rawAttributes','include','options','describe','addMessage','OpenchannelMessage','ids','omit','findOne','hasOwnProperty','pick','OpenchannelInteractionId','format','YYYY-MM-DD\x20HH:mm:ss','findAll','addTags','setTags'];(function(_0x1ac120,_0x3e7e45){var _0x19b703=function(_0x5f32cb){while(--_0x5f32cb){_0x1ac120['push'](_0x1ac120['shift']());}};_0x19b703(++_0x3e7e45);}(_0x883f,0x113));var _0xf883=function(_0x401234,_0xfd4275){_0x401234=_0x401234-0x0;var _0x12842c=_0x883f[_0x401234];return _0x12842c;};'use strict';var emlformat=require(_0xf883('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xf883('0x1'));var jsonpatch=require(_0xf883('0x2'));var rp=require(_0xf883('0x3'));var moment=require(_0xf883('0x4'));var BPromise=require(_0xf883('0x5'));var Mustache=require(_0xf883('0x6'));var util=require(_0xf883('0x7'));var path=require(_0xf883('0x8'));var sox=require(_0xf883('0x9'));var csv=require(_0xf883('0xa'));var ejs=require(_0xf883('0xb'));var fs=require('fs');var fs_extra=require(_0xf883('0xc'));var _=require(_0xf883('0xd'));var squel=require('squel');var crypto=require(_0xf883('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xf883('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xf883('0x10'));var Redis=require('ioredis');var authService=require(_0xf883('0x11'));var qs=require(_0xf883('0x12'));var as=require(_0xf883('0x13'));var pdf=require(_0xf883('0x14'));var hardwareService=require(_0xf883('0x15'));var logger=require(_0xf883('0x16'))(_0xf883('0x17'));var utils=require(_0xf883('0x18'));var config=require(_0xf883('0x19'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0xf883('0x1a')]=_['defaults'](config[_0xf883('0x1a')],{'host':_0xf883('0x1b'),'port':0x18eb});var socket=require(_0xf883('0x1c'))(new Redis(config['redis']));require(_0xf883('0x1d'))[_0xf883('0x1e')](socket);function respondWithStatusCode(_0x2aca73,_0x4cb6f9){_0x4cb6f9=_0x4cb6f9||0xcc;return function(_0xc7a548){if(_0xc7a548){return _0x2aca73[_0xf883('0x1f')](_0x4cb6f9);}return _0x2aca73['status'](_0x4cb6f9)[_0xf883('0x20')]();};}function respondWithResult(_0x4674e8,_0x4350c5){_0x4350c5=_0x4350c5||0xc8;return function(_0x5b3d03){if(_0x5b3d03){return _0x4674e8[_0xf883('0x21')](_0x4350c5)['json'](_0x5b3d03);}};}function respondWithFilteredResult(_0x3cdac6,_0x240e67){return function(_0x4284c2){if(_0x4284c2){var _0x185dfe=typeof _0x240e67[_0xf883('0x22')]==='undefined'&&typeof _0x240e67[_0xf883('0x23')]==='undefined';var _0x3a955c=_0x4284c2[_0xf883('0x24')];var _0x558468=_0x185dfe?0x0:_0x240e67[_0xf883('0x22')];var _0x1d154a=_0x185dfe?_0x4284c2['count']:_0x240e67[_0xf883('0x22')]+_0x240e67['limit'];var _0x1efaeb;if(_0x1d154a>=_0x3a955c){_0x1d154a=_0x3a955c;_0x1efaeb=0xc8;}else{_0x1efaeb=0xce;}_0x3cdac6[_0xf883('0x21')](_0x1efaeb);return _0x3cdac6[_0xf883('0x25')](_0xf883('0x26'),_0x558468+'-'+_0x1d154a+'/'+_0x3a955c)[_0xf883('0x27')](_0x4284c2);}return null;};}function patchUpdates(_0x1ceb5f){return function(_0x2720a5){try{jsonpatch[_0xf883('0x28')](_0x2720a5,_0x1ceb5f,!![]);}catch(_0x1b8141){return BPromise['reject'](_0x1b8141);}return _0x2720a5['save']();};}function saveUpdates(_0x5f40a9,_0x19c008){return function(_0x2dbc01){if(_0x2dbc01){return _0x2dbc01[_0xf883('0x29')](_0x5f40a9)[_0xf883('0x2a')](function(_0x31ea6d){return _0x31ea6d;});}return null;};}function removeEntity(_0x37ebcb,_0x85c845){return function(_0x5bba07){if(_0x5bba07){return _0x5bba07[_0xf883('0x2b')]()[_0xf883('0x2a')](function(){_0x37ebcb[_0xf883('0x21')](0xcc)[_0xf883('0x20')]();});}};}function handleEntityNotFound(_0x5cbead,_0x55acae){return function(_0x11a6db){if(!_0x11a6db){_0x5cbead[_0xf883('0x1f')](0x194);}return _0x11a6db;};}function handleError(_0x11d37a,_0x16a4b2){_0x16a4b2=_0x16a4b2||0x1f4;return function(_0x192400){logger[_0xf883('0x2c')](_0x192400['stack']);if(_0x192400[_0xf883('0x2d')]){delete _0x192400[_0xf883('0x2d')];}_0x11d37a[_0xf883('0x21')](_0x16a4b2)[_0xf883('0x2e')](_0x192400);};}function getInteractionUsers(_0x28e2e1,_0x4537d8){return new BPromise(function(_0x58c8d9,_0x2f4abd){try{if(_0x4537d8[_0x28e2e1['id']]){_0x28e2e1[_0xf883('0x2f')]=_['map'](_0x4537d8[_0x28e2e1['id']],function(_0x2d9a44){return{'id':_0x2d9a44['id'],'fullname':_0x2d9a44[_0xf883('0x30')]};});}}catch(_0x522ef0){_0x2f4abd(_0x522ef0);}_0x58c8d9(_0x28e2e1);});}function getInteractionTags(_0x17e26f,_0x3fbb11){return new BPromise(function(_0x2514bc,_0x5317aa){try{if(_0x17e26f[_0xf883('0x31')]){_0x17e26f['Tags']=[];_0x17e26f[_0xf883('0x31')][_0xf883('0x32')](',')['forEach'](function(_0xfb48fc){_0x17e26f[_0xf883('0x33')]['push'](_0x3fbb11[_0xfb48fc]);});}delete _0x17e26f[_0xf883('0x31')];}catch(_0x674bea){_0x5317aa(_0x674bea);}_0x2514bc(_0x17e26f);});}function updateOpenchannelInteraction(_0x5bd75f,_0x5386fb,_0x5dfe27){return new BPromise(function(_0x472110,_0x106df9){return getInteractionUsers(_0x5bd75f,_0x5dfe27)[_0xf883('0x2a')](function(_0x760319){return getInteractionTags(_0x760319,_0x5386fb);})[_0xf883('0x2a')](function(_0x59e343){return getStateInteraction(_0x59e343);})[_0xf883('0x2a')](function(_0x10f812){_0x472110(_0x10f812);})['catch'](function(_0x587c7c){_0x106df9(_0x587c7c);});});}function getStateInteraction(_0x40acb4){return new BPromise(function(_0x2f0803){_0x40acb4['waiting']=0x0;_0x40acb4['talking']=0x0;_0x40acb4['answered']=0x0;_0x40acb4[_0xf883('0x34')]=0x0;_0x40acb4[_0xf883('0x35')]=0x0;if(!_0x40acb4['closed']&&!_0x40acb4[_0xf883('0x36')]){_0x40acb4[_0xf883('0x37')]+=0x1;}if(!_0x40acb4[_0xf883('0x38')]&&_0x40acb4[_0xf883('0x36')]){_0x40acb4[_0xf883('0x39')]+=0x1;if(_0x40acb4[_0xf883('0x37')]){_0x40acb4[_0xf883('0x37')]-=0x1;}}if(_0x40acb4[_0xf883('0x38')]&&_0x40acb4[_0xf883('0x36')]){_0x40acb4[_0xf883('0x3a')]+=0x1;if(_0x40acb4[_0xf883('0x39')]){_0x40acb4[_0xf883('0x39')]-=0x1;}}if(_0x40acb4[_0xf883('0x38')]&&!_0x40acb4[_0xf883('0x36')]){_0x40acb4['unmanaged']+=0x1;if(_0x40acb4[_0xf883('0x37')]){_0x40acb4['waiting']-=0x1;}}_0x40acb4[_0xf883('0x35')]+=0x1;_0x2f0803(_0x40acb4);});}exports[_0xf883('0x3b')]=function(_0x25434d,_0x24cecc){var _0x26cdcb={},_0x528385={},_0xf3da49={'count':0x0,'rows':[]};var _0x52a88b=_[_0xf883('0x3c')](db[_0xf883('0x3d')]['rawAttributes'],function(_0x4f7556){return{'name':_0x4f7556[_0xf883('0x3e')],'type':_0x4f7556['type'][_0xf883('0x3f')]};});_0x528385[_0xf883('0x40')]=_[_0xf883('0x3c')](_0x52a88b,_0xf883('0x2d'));_0x528385[_0xf883('0x41')]=_[_0xf883('0x42')](_0x25434d[_0xf883('0x41')]);_0x528385['filters']=_[_0xf883('0x43')](_0x528385['model'],_0x528385[_0xf883('0x41')]);_0x26cdcb[_0xf883('0x44')]=_['intersection'](_0x528385[_0xf883('0x40')],qs[_0xf883('0x45')](_0x25434d[_0xf883('0x41')][_0xf883('0x45')]));_0x26cdcb[_0xf883('0x44')]=_0x26cdcb[_0xf883('0x44')][_0xf883('0x46')]?_0x26cdcb[_0xf883('0x44')]:_0x528385[_0xf883('0x40')];if(!_0x25434d[_0xf883('0x41')]['hasOwnProperty'](_0xf883('0x47'))){_0x26cdcb[_0xf883('0x23')]=qs['limit'](_0x25434d[_0xf883('0x41')]['limit']);_0x26cdcb[_0xf883('0x22')]=qs[_0xf883('0x22')](_0x25434d['query']['offset']);}_0x26cdcb[_0xf883('0x48')]=qs[_0xf883('0x49')](_0x25434d[_0xf883('0x41')]['sort']);_0x26cdcb['where']=qs[_0xf883('0x4a')](_['pick'](_0x25434d[_0xf883('0x41')],_0x528385[_0xf883('0x4a')]),_0x52a88b);var _0x146305=[];var _0x4cc12a=squel[_0xf883('0x4b')]()['field']('id')[_0xf883('0x4c')](_0xf883('0x2d'))[_0xf883('0x4c')](_0xf883('0x4d'))[_0xf883('0x4e')](_0xf883('0x4f'));var _0x2c7429=squel[_0xf883('0x4b')]()[_0xf883('0x4c')]('u.id')['field'](_0xf883('0x50'))[_0xf883('0x4c')]('ui.OpenchannelInteractionId')[_0xf883('0x4e')]('user_has_openchannel_interactions','ui')['left_join']('users','u','u.id\x20=\x20ui.UserId');var _0x4dc7da=squel[_0xf883('0x4b')]()[_0xf883('0x4e')](_0xf883('0x51'),'i')['left_join'](_0xf883('0x52'),'c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')[_0xf883('0x53')]('users','o',_0xf883('0x54'))[_0xf883('0x53')](_0xf883('0x55'),'a',_0xf883('0x56'))[_0xf883('0x53')]('openchannel_messages','me','me.OpenchannelInteractionId\x20=\x20i.id')[_0xf883('0x53')](_0xf883('0x57'),'it',_0xf883('0x58'))[_0xf883('0x53')](_0xf883('0x4f'),'t',_0xf883('0x59'));var _0x3796ee=squel[_0xf883('0x5a')]();var _0x3ae923=[];var _0x311319=squel[_0xf883('0x5a')]();var _0x49101a;if(_0x25434d[_0xf883('0x41')]['search']){_0x49101a=as['parseSearch'](_0x25434d[_0xf883('0x41')][_0xf883('0x5b')]);var _0x24412e=_0x49101a['sqlOperator'];for(var _0x523486=0x0;_0x523486<_0x49101a[_0xf883('0x5c')][_0xf883('0x46')];_0x523486++){var _0x53fabe=_0x49101a[_0xf883('0x5c')][_0x523486];var _0x1185f0='i';var _0x81bf3d=_['find'](_0x52a88b,[_0xf883('0x2d'),_0x53fabe[_0xf883('0x4c')]]);if(!_0x81bf3d){switch(_0x53fabe[_0xf883('0x4c')]){case _0xf883('0x5d'):if(_0x53fabe[_0xf883('0x5e')]==0x1){_0x4dc7da['having']('`'+_0x53fabe['field']+_0xf883('0x5f'));}else{_0x4dc7da[_0xf883('0x60')]('`'+_0x53fabe[_0xf883('0x4c')]+_0xf883('0x61'));}break;case _0xf883('0x62'):if(_0x53fabe[_0xf883('0x63')]===_0xf883('0x64')){if(_0x53fabe[_0xf883('0x5e')][_0xf883('0x32')]('\x20')['length']>0x1){_0x3796ee[_0x24412e](_0xf883('0x65'),qs[_0xf883('0x66')](_0x53fabe['value']),null);}else{var _0x1fee71='%'+_0x53fabe[_0xf883('0x5e')]+'%';_0x3796ee[_0x24412e](_0xf883('0x67'),_0x1fee71,_0x1fee71,_0x1fee71);}}else{_0x81bf3d=_[_0xf883('0x68')](_0x52a88b,['name','ContactId']);_0x53fabe['field']=_0xf883('0x69');_0x7158e=as[_0xf883('0x6a')](_0x1185f0,_0x81bf3d[_0xf883('0x6b')],_0x53fabe);_0x3796ee[_0x24412e](_0x7158e[_0xf883('0x6c')],_0x7158e[_0xf883('0x5e')]['start'],_0x7158e[_0xf883('0x5e')][_0xf883('0x20')]);}break;case _0xf883('0x6d'):var _0x535022=_0x53fabe[_0xf883('0x5e')][_0xf883('0x32')](',')[_0xf883('0x3c')](function(_0x11c0a){return Number(_0x11c0a);});_0x535022[_0xf883('0x6e')](function(_0x3c1cae){_0x311319['or'](_0xf883('0x6f'),'%,'+_0x3c1cae+',%');});_0x3ae923=_[_0xf883('0x70')](_0x3ae923,_0x535022);break;case _0xf883('0x71'):if(_0x53fabe[_0xf883('0x63')]===_0xf883('0x64')){_0x3796ee[_0x24412e](_0xf883('0x72'),'%'+_0x53fabe[_0xf883('0x5e')]+'%',null);}else{_0x81bf3d=_['find'](_0x52a88b,[_0xf883('0x2d'),_0xf883('0x36')]);_0x53fabe[_0xf883('0x4c')]=_0xf883('0x36');_0x7158e=as[_0xf883('0x6a')](_0x1185f0,_0x81bf3d[_0xf883('0x6b')],_0x53fabe);_0x3796ee[_0x24412e](_0x7158e['text'],_0x7158e[_0xf883('0x5e')]['start'],_0x7158e[_0xf883('0x5e')][_0xf883('0x20')]);}break;case _0xf883('0x73'):_0x7158e=as[_0xf883('0x6a')]('me',null,_0x53fabe);_0x3796ee[_0x24412e](_0x7158e[_0xf883('0x6c')],_0x7158e['value']['start'],_0x7158e[_0xf883('0x5e')][_0xf883('0x20')]);break;}}else{var _0x7158e=as['buildExpression'](_0x1185f0,_0x81bf3d['type'],_0x53fabe);_0x3796ee[_0x24412e](_0x7158e['text'],_0x7158e['value']['start'],_0x7158e[_0xf883('0x5e')]['end']);}}}else{var _0x5d494c=_(_0x25434d['query'])[_0xf883('0x42')]()[_0xf883('0x3c')](function(_0x32b588){return _[_0xf883('0x74')](_0x52a88b,[_0xf883('0x2d'),_0x32b588])?_0x32b588:undefined;})[_0xf883('0x75')]()[_0xf883('0x5e')]();if(!_[_0xf883('0x76')](_0x5d494c)){_0x5d494c[_0xf883('0x6e')](function(_0x150c7b){if(_0x150c7b==='OpenchannelAccountId'){_0x4dc7da['where']('i.OpenchannelAccountId\x20IN\x20?',[][_0xf883('0x77')](_0x25434d[_0xf883('0x41')][_0x150c7b]));}else if(_0x150c7b==='createdAt'){var _0x1d3afc=JSON[_0xf883('0x78')](_0x25434d[_0xf883('0x41')][_0x150c7b])[_0xf883('0x79')];var _0x59f1cb=JSON[_0xf883('0x78')](_0x25434d[_0xf883('0x41')][_0x150c7b])['$lte'];_0x4dc7da[_0xf883('0x7a')](_0xf883('0x7b'),_0x1d3afc,_0x59f1cb);}else{if(_0x25434d[_0xf883('0x41')][_0x150c7b]==='null'){_0x4dc7da[_0xf883('0x7a')]('i.'+_0x150c7b+_0xf883('0x7c'));}else{_0x4dc7da[_0xf883('0x7a')]('i.'+_0x150c7b+'\x20=\x20?',_0x25434d[_0xf883('0x41')][_0x150c7b]);}}});}if(_0x25434d['query'][_0xf883('0x7d')]){if(_0x25434d[_0xf883('0x41')][_0xf883('0x7d')]==0x1){_0x4dc7da[_0xf883('0x60')]('`unreadMessages`\x20=\x200');}else{_0x4dc7da[_0xf883('0x60')](_0xf883('0x7e'));}}if(_0x25434d[_0xf883('0x41')][_0xf883('0x7f')]){_0x3ae923=_[_0xf883('0x80')](_0x25434d[_0xf883('0x41')][_0xf883('0x7f')])?_0x25434d[_0xf883('0x41')]['tag']:new Array(_0x25434d[_0xf883('0x41')]['tag']);_0x3ae923[_0xf883('0x6e')](function(_0x16c8ec){_0x311319['or'](_0xf883('0x6f'),'%,'+_0x16c8ec+',%');});}if(_0x25434d[_0xf883('0x41')]['filter']){var _0x485c0e=_0x25434d[_0xf883('0x41')][_0xf883('0x81')][_0xf883('0x82')]('\x5c','\x5c\x5c')[_0xf883('0x82')](/'/g,'\x27\x27');if(qs[_0xf883('0x83')](_0x485c0e)){_0x3796ee['or'](_0xf883('0x84'),_0x485c0e+'%');}else{_0x3796ee['or']('MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs['getFullTextValue'](_0x485c0e))['or'](_0xf883('0x85'),_0x485c0e+'%')['or'](_0xf883('0x86'),_0x485c0e+'%');}}}_0x4dc7da[_0xf883('0x7a')](_0x3796ee);_0x4dc7da[_0xf883('0x87')](_0xf883('0x88'));var _0x6f1004={'type':db['Sequelize'][_0xf883('0x89')][_0xf883('0x8a')],'raw':!![]};var _0x35f11c=_0x4dc7da['clone']();_0x35f11c[_0xf883('0x4c')](_0xf883('0x88'));_0x35f11c[_0xf883('0x4c')](_0xf883('0x8b'),'unreadMessages');if(_0x26cdcb[_0xf883('0x48')]){_0x26cdcb[_0xf883('0x48')][_0xf883('0x6e')](function(_0x19c6f8){var _0xcbfa97=_0x19c6f8[0x0]===_0xf883('0x8c')?_0x19c6f8[0x0]:'i.'+_0x19c6f8[0x0];_0x4dc7da[_0xf883('0x48')](_0xcbfa97,_0x19c6f8[0x1]===_0xf883('0x8d')?![]:!![]);});}if(!_[_0xf883('0x76')](_0x3ae923)){_0x4dc7da[_0xf883('0x60')](_0x311319);_0x35f11c[_0xf883('0x7a')](_0xf883('0x8e'),_0x3ae923);}BPromise['resolve']()[_0xf883('0x2a')](function(){if(!_0x49101a){if(_0x25434d['query'][_0xf883('0x8f')])return;_0x35f11c[_0xf883('0x7a')](_0xf883('0x90'));_0x4dc7da['where'](_0xf883('0x90'));return;}if(_0x25434d['user'][_0xf883('0x91')]!=='agent')return;return _0x25434d[_0xf883('0x92')][_0xf883('0x93')]({'attributes':['id'],'raw':!![]})[_0xf883('0x2a')](function(_0x2bb93a){if(_[_0xf883('0x76')](_0x2bb93a)){_0x35f11c[_0xf883('0x7a')](_0xf883('0x94'));_0x4dc7da['where'](_0xf883('0x94'));}else{_0x35f11c[_0xf883('0x7a')](_0xf883('0x95'),_['map'](_0x2bb93a,'id'));_0x4dc7da[_0xf883('0x7a')](_0xf883('0x95'),_[_0xf883('0x3c')](_0x2bb93a,'id'));}});})[_0xf883('0x2a')](function(){if(_0x25434d['user'][_0xf883('0x91')]===_0xf883('0x96')&&!_0x49101a&&!_0x25434d[_0xf883('0x41')][_0xf883('0x8f')])return[];return db['sequelize'][_0xf883('0x41')](_0x35f11c[_0xf883('0x97')](),_0x6f1004);})[_0xf883('0x2a')](function(_0xfd12cd){_0xf3da49['count']=_0xfd12cd[_0xf883('0x46')];if(_0xf3da49[_0xf883('0x24')]===0x0)return[];return db[_0xf883('0x98')][_0xf883('0x41')](_0x4cc12a[_0xf883('0x97')](),_0x6f1004)['then'](function(_0x191bea){_0x146305=_[_0xf883('0x99')](_0x191bea,'id');_0x6f1004=_[_0xf883('0x9a')](_0x6f1004,{'model':db[_0xf883('0x3d')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x25434d['query'][_0xf883('0x45')]){_0x26cdcb[_0xf883('0x44')][_0xf883('0x6e')](function(_0x236b47){_0x4dc7da[_0xf883('0x4c')]('i.'+_0x236b47);});}else{_0x4dc7da[_0xf883('0x4c')](_0xf883('0x8b'),_0xf883('0x5d'));_0x4dc7da[_0xf883('0x4c')](_0xf883('0x9b'),_0xf883('0x9c'));_0x4dc7da[_0xf883('0x4c')](_0xf883('0x9d'),_0xf883('0x9e'));_0x4dc7da['field'](_0xf883('0x9f'),_0xf883('0x8c'));_0x4dc7da[_0xf883('0x4c')](_0xf883('0xa0'));_0x4dc7da[_0xf883('0x4c')](_0xf883('0xa1'),'Contact.firstName');_0x4dc7da[_0xf883('0x4c')](_0xf883('0xa2'),_0xf883('0xa3'));_0x4dc7da['field'](_0xf883('0xa4'),_0xf883('0xa5'));_0x4dc7da['field']('c.phone',_0xf883('0xa6'));_0x4dc7da['field']('c.mobile','Contact.mobile');_0x4dc7da[_0xf883('0x4c')]('c.fax','Contact.fax');_0x4dc7da[_0xf883('0x4c')]('o.fullname',_0xf883('0xa7'));_0x4dc7da['field']('o.internal','Owner.internal');_0x4dc7da[_0xf883('0x4c')](_0xf883('0xa8'),_0xf883('0x31'));}if(_0x26cdcb[_0xf883('0x23')])_0x4dc7da[_0xf883('0x23')](_0x26cdcb[_0xf883('0x23')]);if(_0x26cdcb[_0xf883('0x22')])_0x4dc7da[_0xf883('0x22')](_0x26cdcb[_0xf883('0x22')]);return db[_0xf883('0x98')][_0xf883('0x41')](_0x4dc7da[_0xf883('0x97')](),_0x6f1004);})['then'](function(_0x22bb39){if(_0x22bb39['length']>0x0)_0x2c7429[_0xf883('0x7a')]('ui.OpenchannelInteractionId\x20IN\x20?',_[_0xf883('0x3c')](_0x22bb39,'id'));return db[_0xf883('0x98')][_0xf883('0x41')](_0x2c7429[_0xf883('0x97')](),_0x6f1004)['then'](function(_0x45d1ce){var _0x2496aa=_['groupBy'](_0x45d1ce,'OpenchannelInteractionId');var _0x2db9bb=[];_0x22bb39[_0xf883('0x6e')](function(_0x58a4b0){_0x2db9bb[_0xf883('0xa9')](updateOpenchannelInteraction(_0x58a4b0,_0x146305,_0x2496aa));});return BPromise[_0xf883('0xaa')](_0x2db9bb);});});})[_0xf883('0x2a')](function(_0xff0367){_0xf3da49[_0xf883('0xab')]=_0xff0367;return _0xf3da49;})[_0xf883('0x2a')](respondWithFilteredResult(_0x24cecc,_0x26cdcb))[_0xf883('0xac')](handleError(_0x24cecc,null));};exports['show']=function(_0x354f6c,_0xac80d8){var _0x422dd8={};if(_0x354f6c['query'][_0xf883('0x6b')]&&_0x354f6c[_0xf883('0x41')][_0xf883('0x6b')]===_0xf883('0x4e')){_0x422dd8[_0xf883('0x4e')]=_0x354f6c[_0xf883('0xad')]['id'];}else{_0x422dd8['id']=_0x354f6c[_0xf883('0xad')]['id'];}var _0x4b46ef={'raw':![],'where':_0x422dd8},_0x36b027={};_0x36b027[_0xf883('0x40')]=_['keys'](db[_0xf883('0x3d')][_0xf883('0xae')]);_0x36b027[_0xf883('0x41')]=_['keys'](_0x354f6c[_0xf883('0x41')]);_0x36b027[_0xf883('0x4a')]=_['intersection'](_0x36b027[_0xf883('0x40')],_0x36b027['query']);_0x4b46ef['attributes']=_[_0xf883('0x43')](_0x36b027[_0xf883('0x40')],qs[_0xf883('0x45')](_0x354f6c[_0xf883('0x41')][_0xf883('0x45')]));_0x4b46ef['attributes']=_0x4b46ef[_0xf883('0x44')]['length']?_0x4b46ef[_0xf883('0x44')]:_0x36b027[_0xf883('0x40')];if(_0x354f6c['query']['includeAll']){_0x4b46ef[_0xf883('0xaf')]=[{'all':!![]}];}_0x4b46ef=_[_0xf883('0x9a')]({},_0x4b46ef,_0x354f6c[_0xf883('0xb0')]);return db[_0xf883('0x3d')][_0xf883('0x68')](_0x4b46ef)[_0xf883('0x2a')](handleEntityNotFound(_0xac80d8,null))[_0xf883('0x2a')](respondWithResult(_0xac80d8,null))[_0xf883('0xac')](handleError(_0xac80d8,null));};exports['create']=function(_0x157669,_0x30408b){return db['OpenchannelInteraction']['create'](_0x157669[_0xf883('0x73')],{})[_0xf883('0x2a')](respondWithResult(_0x30408b,0xc9))['catch'](handleError(_0x30408b,null));};exports['update']=function(_0x154b2d,_0x44beac){if(_0x154b2d[_0xf883('0x73')]['id']){delete _0x154b2d[_0xf883('0x73')]['id'];}return db[_0xf883('0x3d')][_0xf883('0x68')]({'where':{'id':_0x154b2d[_0xf883('0xad')]['id']}})[_0xf883('0x2a')](handleEntityNotFound(_0x44beac,null))['then'](saveUpdates(_0x154b2d['body'],null))[_0xf883('0x2a')](respondWithResult(_0x44beac,null))[_0xf883('0xac')](handleError(_0x44beac,null));};exports[_0xf883('0x2b')]=function(_0x50cbca,_0x45d417){return db[_0xf883('0x3d')][_0xf883('0x68')]({'where':{'id':_0x50cbca[_0xf883('0xad')]['id']}})[_0xf883('0x2a')](handleEntityNotFound(_0x45d417,null))[_0xf883('0x2a')](removeEntity(_0x45d417,null))[_0xf883('0xac')](handleError(_0x45d417,null));};exports[_0xf883('0xb1')]=function(_0x3b8bec,_0x14bb6e){return db[_0xf883('0x3d')][_0xf883('0xb1')]()[_0xf883('0x2a')](respondWithResult(_0x14bb6e,null))[_0xf883('0xac')](handleError(_0x14bb6e,null));};exports[_0xf883('0xb2')]=function(_0xf8b0e2,_0x4ca7ac,_0x54a52f){return db[_0xf883('0xb3')][_0xf883('0x68')]({'where':{'id':_0xf8b0e2['params']['id']}})[_0xf883('0x2a')](handleEntityNotFound(_0x4ca7ac,null))[_0xf883('0x2a')](function(_0x51f9ff){if(_0x51f9ff){return _0x51f9ff['addMessage'](_0xf8b0e2[_0xf883('0x73')][_0xf883('0xb4')],_[_0xf883('0xb5')](_0xf8b0e2[_0xf883('0x73')],[_0xf883('0xb4'),'id'])||{});}})[_0xf883('0x2a')](respondWithResult(_0x4ca7ac,null))['catch'](handleError(_0x4ca7ac,null));};exports['getMessages']=function(_0xfe9f63,_0x9832a8,_0x2ec7bd){var _0x54b9b4={'raw':![],'where':{}};var _0x32205b={};var _0x194a5d={'count':0x0,'rows':[]};return db[_0xf883('0x3d')][_0xf883('0xb6')]({'where':{'id':_0xfe9f63[_0xf883('0xad')]['id']}})[_0xf883('0x2a')](handleEntityNotFound(_0x9832a8,null))[_0xf883('0x2a')](function(_0x3aad07){if(_0x3aad07){_0x32205b[_0xf883('0x40')]=_[_0xf883('0x42')](db[_0xf883('0xb3')][_0xf883('0xae')]);_0x32205b['query']=_[_0xf883('0x42')](_0xfe9f63[_0xf883('0x41')]);_0x32205b[_0xf883('0x4a')]=_['intersection'](_0x32205b[_0xf883('0x40')],_0x32205b[_0xf883('0x41')]);_0x54b9b4[_0xf883('0x44')]=_['intersection'](_0x32205b[_0xf883('0x40')],qs[_0xf883('0x45')](_0xfe9f63[_0xf883('0x41')][_0xf883('0x45')]));_0x54b9b4[_0xf883('0x44')]=_0x54b9b4[_0xf883('0x44')][_0xf883('0x46')]?_0x54b9b4[_0xf883('0x44')]:_0x32205b[_0xf883('0x40')];if(!_0xfe9f63[_0xf883('0x41')][_0xf883('0xb7')](_0xf883('0x47'))){_0x54b9b4['limit']=qs['limit'](_0xfe9f63[_0xf883('0x41')]['limit']);_0x54b9b4[_0xf883('0x22')]=qs['offset'](_0xfe9f63[_0xf883('0x41')][_0xf883('0x22')]);}_0x54b9b4[_0xf883('0x48')]=qs[_0xf883('0x49')](_0xfe9f63[_0xf883('0x41')][_0xf883('0x49')]);_0x54b9b4[_0xf883('0x7a')]=qs[_0xf883('0x4a')](_[_0xf883('0xb8')](_0xfe9f63[_0xf883('0x41')],_0x32205b[_0xf883('0x4a')]));_0x54b9b4[_0xf883('0x7a')][_0xf883('0xb9')]=_0x3aad07['id'];if(_0xfe9f63[_0xf883('0x41')][_0xf883('0x81')]){_0x54b9b4['where']=_[_0xf883('0x9a')](_0x54b9b4['where'],{'$or':_[_0xf883('0x3c')](_0x54b9b4[_0xf883('0x44')],function(_0x526f97){var _0x547387={};_0x547387[_0x526f97]={'$like':'%'+_0xfe9f63[_0xf883('0x41')][_0xf883('0x81')]+'%'};return _0x547387;})});}if(_0xfe9f63['query']['$gte']){var _0xc3539d=_0xfe9f63[_0xf883('0x41')][_0xf883('0x79')][_0xf883('0x32')](',');var _0x432b99={};_0x432b99[_0xc3539d[0x0]]={'$gte':moment(_0xc3539d[0x1])[_0xf883('0xba')](_0xf883('0xbb'))};_0x54b9b4['where']=_['merge'](_0x54b9b4[_0xf883('0x7a')],_0x432b99);}_0x54b9b4=_['merge']({},_0x54b9b4,_0xfe9f63['options']);return db[_0xf883('0xb3')][_0xf883('0x24')]({'where':_0x54b9b4[_0xf883('0x7a')]})[_0xf883('0x2a')](function(_0x454641){_0x194a5d[_0xf883('0x24')]=_0x454641;if(_0xfe9f63['query']['includeAll']){_0x54b9b4[_0xf883('0xaf')]=[{'all':!![]}];}return db[_0xf883('0xb3')][_0xf883('0xbc')](_0x54b9b4);})['then'](function(_0x456cee){_0x194a5d[_0xf883('0xab')]=_0x456cee;return _0x194a5d;});}})['then'](respondWithFilteredResult(_0x9832a8,_0x54b9b4))['catch'](handleError(_0x9832a8,null));};exports[_0xf883('0xbd')]=function(_0x2fd8f0,_0x22fd9b,_0x1e3b12){return db['OpenchannelInteraction'][_0xf883('0x68')]({'where':{'id':_0x2fd8f0[_0xf883('0xad')]['id']}})[_0xf883('0x2a')](handleEntityNotFound(_0x22fd9b,null))['then'](function(_0x71b9bb){if(_0x71b9bb){return _0x71b9bb[_0xf883('0xbe')](_0x2fd8f0['body'][_0xf883('0xb4')],_['omit'](_0x2fd8f0[_0xf883('0x73')],[_0xf883('0xb4'),'id'])||{})[_0xf883('0xbf')](function(){return db[_0xf883('0x6d')][_0xf883('0xbc')]({'attributes':['id',_0xf883('0x2d'),_0xf883('0x4d')],'where':{'id':_0x2fd8f0['body'][_0xf883('0xb4')]}});})[_0xf883('0x2a')](function(_0x1a24b7){socket[_0xf883('0xc0')](_0xf883('0xc1'),{'id':Number(_0x2fd8f0['params']['id']),'tags':_0x1a24b7||[]});return{'id':Number(_0x2fd8f0[_0xf883('0xad')]['id']),'tags':_0x1a24b7||[]};});}})[_0xf883('0x2a')](respondWithResult(_0x22fd9b,null))['catch'](handleError(_0x22fd9b,null));};exports[_0xf883('0xc2')]=function(_0x116ab0,_0x4ebb35,_0x2b981a){return db[_0xf883('0x3d')][_0xf883('0x68')]({'where':{'id':_0x116ab0[_0xf883('0xad')]['id']}})[_0xf883('0x2a')](handleEntityNotFound(_0x4ebb35,null))[_0xf883('0x2a')](function(_0x1e4b0e){if(_0x1e4b0e){return _0x1e4b0e[_0xf883('0xc2')](_0x116ab0[_0xf883('0x41')]['ids']);}})[_0xf883('0x2a')](respondWithStatusCode(_0x4ebb35,null))['catch'](handleError(_0x4ebb35,null));};exports[_0xf883('0xc3')]=function(_0x27a684,_0x55fbd2){var _0x52b8a0=moment()[_0xf883('0xc4')]()[_0xf883('0x97')]();var _0x229906=path[_0xf883('0xc5')](config[_0xf883('0xc6')],_0xf883('0xc7'),_0xf883('0xc8'),'tmp');var _0x26a4a4=path[_0xf883('0xc5')](config[_0xf883('0xc6')],_0xf883('0xc7'),'files',_0xf883('0xc9'));var _0x3defc0=path[_0xf883('0xc5')](_0x229906,_0x52b8a0);var _0x541370=util['format']('transcript-%d-%s.zip',_0x27a684[_0xf883('0xad')]['id'],_0x52b8a0);var _0x2fcf28=path['join'](_0x229906,_0x541370);var _0x581778=[];_0x581778[_0xf883('0xa9')]({'model':db[_0xf883('0x71')],'as':'User','attributes':['id',_0xf883('0x30')],'raw':!![]});_0x581778[_0xf883('0xa9')]({'model':db['CmContact'],'as':_0xf883('0x62'),'attributes':['id',_0xf883('0xca'),_0xf883('0xcb')],'raw':!![]});if(_0x27a684[_0xf883('0x41')][_0xf883('0xc9')]){_0x581778[_0xf883('0xa9')]({'model':db['Attachment'],'as':_0xf883('0xcc'),'raw':!![]});}var _0x315fc1=[{'model':db[_0xf883('0xb3')],'as':_0xf883('0xcd'),'attributes':['id','body','createdAt','direction',_0xf883('0xce'),'read'],'include':_0x581778}];_0x315fc1['push']({'model':db[_0xf883('0xcf')],'as':_0xf883('0xd0'),'attributes':['id',_0xf883('0x2d')]});_0x315fc1[_0xf883('0xa9')]({'model':db['User'],'as':_0xf883('0xd1'),'attributes':['id',_0xf883('0x30')]});return db['OpenchannelInteraction'][_0xf883('0x68')]({'where':{'id':_0x27a684[_0xf883('0xad')]['id']},'include':_0x315fc1})[_0xf883('0x2a')](handleEntityNotFound(_0x55fbd2,null))['then'](function(_0x311c85){if(_0x311c85){var _0xc6f2e8=_0x311c85[_0xf883('0xd2')]({'plain':!![]});fs[_0xf883('0xd3')](_0x3defc0);var _0x43a11e={'channel':_0xf883('0xd4'),'account':_0xc6f2e8[_0xf883('0xd0')][_0xf883('0x2d')],'agent':_0xc6f2e8['Owner']?_0xc6f2e8['Owner'][_0xf883('0x30')]:_0xf883('0xd5'),'createdAt':moment(_0xc6f2e8[_0xf883('0xd6')])['format']('YYYY-MM-DD\x20HH:mm:ss')[_0xf883('0x97')](),'closedAt':_0xc6f2e8[_0xf883('0x38')]?moment(_0xc6f2e8[_0xf883('0xd7')])[_0xf883('0xba')]('YYYY-MM-DD\x20HH:mm:ss')[_0xf883('0x97')]():'','disposition':_0xc6f2e8[_0xf883('0xd8')],'visibility':_0xc6f2e8[_0xf883('0xd9')]?_0xf883('0xda'):_0xf883('0xdb'),'messages':_(_0xc6f2e8[_0xf883('0xcd')])['filter']({'secret':![]})[_0xf883('0x3c')](function(_0x39857e){if(_0x39857e[_0xf883('0xcc')]){var _0x2c096a=path['join'](_0x26a4a4,_0x39857e[_0xf883('0xcc')]['basename']);if(fs[_0xf883('0xdc')](_0x2c096a)){fs[_0xf883('0xdd')](_0x2c096a)[_0xf883('0xde')](fs['createWriteStream'](path[_0xf883('0xc5')](_0x3defc0,_0x39857e[_0xf883('0xcc')]['basename'])));}}return{'date':moment(_0x39857e[_0xf883('0xd6')])[_0xf883('0xba')](_0xf883('0xbb'))[_0xf883('0x97')](),'sender':_0x39857e[_0xf883('0xdf')]==='out'?_0x39857e[_0xf883('0x71')]?_0x39857e[_0xf883('0x71')][_0xf883('0x30')]:_0xf883('0xe0'):_0x39857e[_0xf883('0x62')][_0xf883('0xca')]+(_0x39857e['Contact']['lastName']?'\x20'+_0x39857e[_0xf883('0x62')][_0xf883('0xcb')]:''),'body':_0x39857e[_0xf883('0xcc')]?_0x39857e['Attachment'][_0xf883('0xe1')]:_0x39857e[_0xf883('0x73')],'direction':_0x39857e[_0xf883('0xdf')]==='out'?'A':'C','secret':_0x39857e['secret'],'read':_0x39857e[_0xf883('0x7d')],'attachment':_0x39857e[_0xf883('0xcc')]};})['value']()};return ejs['renderFile'](path[_0xf883('0xc5')](config[_0xf883('0xc6')],_0xf883('0xc7'),_0xf883('0xe2'),_0xf883('0xe3')),{'interaction':_0x43a11e})[_0xf883('0x2a')](function(_0x510ea4){var _0x496bca=path[_0xf883('0xc5')](_0x3defc0,_0xf883('0xe4')+_0xc6f2e8['id']+'-'+_0x52b8a0+_0xf883('0xe5'));var _0x814a8f={'path':_0x496bca,'channel':'Openchannel','interactionId':_0xc6f2e8['id']};return pdf['createPdfFromHTML'](_0x510ea4,_0x814a8f);})[_0xf883('0x2a')](function(){return new BPromise(function(_0xf824f3,_0x51a93a){zipdir(_0x3defc0,{'saveTo':_0x2fcf28},function(_0x358e83,_0x127dc0){if(_0x358e83)return _0x51a93a(_0x358e83);return _0xf824f3(_0x127dc0);});})['then'](function(){return new BPromise(function(_0x44e213,_0x484d8b){rimraf(_0x3defc0,function(_0x4ca9c4){if(_0x4ca9c4)_0x484d8b(_0x4ca9c4);return _0x44e213();});});})['then'](function(){return _0x55fbd2[_0xf883('0xc3')](_0x2fcf28,_0x541370,function(_0x3fd3da){if(_0x3fd3da){console[_0xf883('0xe6')](_0xf883('0xe7'),_0x3fd3da);}else{fs[_0xf883('0xe8')](_0x2fcf28);}});});});}else{return _0x55fbd2[_0xf883('0x1f')](0xc8);}})['catch'](handleError(_0x55fbd2,null));}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.events.js b/server/api/openchannelInteraction/openchannelInteraction.events.js index 5f8cbed..5a4d21c 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 _0xa229=['setDataValue','map','findAll','unreadMessages','emit','hasOwnProperty','hook','exports','events','../../mysqldb','OpenchannelInteraction','OpenchannelMessage','save','update','then'];(function(_0x59b8d3,_0x1ecb66){var _0x298fa0=function(_0x3fb54a){while(--_0x3fb54a){_0x59b8d3['push'](_0x59b8d3['shift']());}};_0x298fa0(++_0x1ecb66);}(_0xa229,0x134));var _0x9a22=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa229[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0x9a22('0x0'));var OpenchannelInteraction=require(_0x9a22('0x1'))['db'][_0x9a22('0x2')];var OpenchannelMessage=require(_0x9a22('0x1'))['db'][_0x9a22('0x3')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x9a22('0x4'),'afterUpdate':_0x9a22('0x5'),'afterDestroy':'remove'};function emitEvent(_0x38ab07){return function(_0x4d9118,_0x50aa9e,_0x31994b){_0x4d9118['getUsers']({'attributes':['id'],'raw':!![]})[_0x9a22('0x6')](function(_0x485a1d){_0x4d9118[_0x9a22('0x7')]('Users',_0x485a1d[_0x9a22('0x8')](function(_0x55c184){return{'id':_0x55c184['id']};}));return OpenchannelMessage[_0x9a22('0x9')]({'where':{'OpenchannelInteractionId':_0x4d9118['id'],'direction':'in','read':![]},'raw':!![]});})[_0x9a22('0x6')](function(_0x34367e){_0x4d9118[_0x9a22('0x7')](_0x9a22('0xa'),_0x34367e['length']);OpenchannelInteractionEvents[_0x9a22('0xb')](_0x38ab07+':'+_0x4d9118['id'],_0x4d9118);OpenchannelInteractionEvents[_0x9a22('0xb')](_0x38ab07,_0x4d9118);_0x31994b(null);})['catch'](_0x31994b(null));};}for(var e in events){if(events[_0x9a22('0xc')](e)){var event=events[e];OpenchannelInteraction[_0x9a22('0xd')](e,emitEvent(event));}}module[_0x9a22('0xe')]=OpenchannelInteractionEvents; \ No newline at end of file +var _0xf5ef=['setMaxListeners','save','update','remove','getUsers','then','setDataValue','Users','map','findAll','unreadMessages','emit','catch','hasOwnProperty','hook','exports','events','OpenchannelInteraction','../../mysqldb'];(function(_0x17ab90,_0x5b71a9){var _0x2ab4c3=function(_0x6eda61){while(--_0x6eda61){_0x17ab90['push'](_0x17ab90['shift']());}};_0x2ab4c3(++_0x5b71a9);}(_0xf5ef,0x12d));var _0xff5e=function(_0x28c5ed,_0x1d47d3){_0x28c5ed=_0x28c5ed-0x0;var _0x412eea=_0xf5ef[_0x28c5ed];return _0x412eea;};'use strict';var EventEmitter=require(_0xff5e('0x0'));var OpenchannelInteraction=require('../../mysqldb')['db'][_0xff5e('0x1')];var OpenchannelMessage=require(_0xff5e('0x2'))['db']['OpenchannelMessage'];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0xff5e('0x3')](0x0);var events={'afterCreate':_0xff5e('0x4'),'afterUpdate':_0xff5e('0x5'),'afterDestroy':_0xff5e('0x6')};function emitEvent(_0x326b6b){return function(_0x967483,_0x1e46e4,_0x1d03df){_0x967483[_0xff5e('0x7')]({'attributes':['id'],'raw':!![]})[_0xff5e('0x8')](function(_0x1328cb){_0x967483[_0xff5e('0x9')](_0xff5e('0xa'),_0x1328cb[_0xff5e('0xb')](function(_0xa1bba8){return{'id':_0xa1bba8['id']};}));return OpenchannelMessage[_0xff5e('0xc')]({'where':{'OpenchannelInteractionId':_0x967483['id'],'direction':'in','read':![]},'raw':!![]});})[_0xff5e('0x8')](function(_0x5ba7b5){_0x967483['setDataValue'](_0xff5e('0xd'),_0x5ba7b5['length']);OpenchannelInteractionEvents[_0xff5e('0xe')](_0x326b6b+':'+_0x967483['id'],_0x967483);OpenchannelInteractionEvents['emit'](_0x326b6b,_0x967483);_0x1d03df(null);})[_0xff5e('0xf')](_0x1d03df(null));};}for(var e in events){if(events[_0xff5e('0x10')](e)){var event=events[e];OpenchannelInteraction[_0xff5e('0x11')](e,emitEvent(event));}}module[_0xff5e('0x12')]=OpenchannelInteractionEvents; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.model.js b/server/api/openchannelInteraction/openchannelInteraction.model.js index 3f0f32c..f48ec6e 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 _0x90c0=['api','moment','bluebird','request-promise','./openchannelInteraction.attributes','exports','define','openchannel_interactions','utf8mb4','utf8mb4_unicode_ci','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','../../config/logger'];(function(_0x461388,_0x2a8688){var _0x594dc4=function(_0x3426ab){while(--_0x3426ab){_0x461388['push'](_0x461388['shift']());}};_0x594dc4(++_0x2a8688);}(_0x90c0,0xec));var _0x090c=function(_0x7feb90,_0x28e700){_0x7feb90=_0x7feb90-0x0;var _0x3c5b33=_0x90c0[_0x7feb90];return _0x3c5b33;};'use strict';var _=require(_0x090c('0x0'));var util=require('util');var logger=require(_0x090c('0x1'))(_0x090c('0x2'));var moment=require(_0x090c('0x3'));var BPromise=require(_0x090c('0x4'));var rp=require(_0x090c('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x090c('0x6'));module[_0x090c('0x7')]=function(_0x509746,_0x239202){return _0x509746[_0x090c('0x8')]('OpenchannelInteraction',attributes,{'tableName':_0x090c('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x090c('0xa'),'collate':_0x090c('0xb'),'hooks':{'beforeUpdate':function(_0x1b2cd7,_0x4389f5,_0x3aba14){if(_0x1b2cd7[_0x090c('0xc')](_0x090c('0xd'))){_0x1b2cd7[_0x090c('0xe')]=moment()[_0x090c('0xf')](_0x090c('0x10'));}_0x3aba14(null,_0x1b2cd7);}}});}; \ No newline at end of file +var _0x8ec6=['YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./openchannelInteraction.attributes','OpenchannelInteraction','openchannel_interactions','utf8mb4','utf8mb4_unicode_ci','closed','closedAt','format'];(function(_0x5a3cf0,_0x160a68){var _0x5a64ee=function(_0x34cd1d){while(--_0x34cd1d){_0x5a3cf0['push'](_0x5a3cf0['shift']());}};_0x5a64ee(++_0x160a68);}(_0x8ec6,0x157));var _0x68ec=function(_0x4f1dfd,_0x1b44aa){_0x4f1dfd=_0x4f1dfd-0x0;var _0x3edc55=_0x8ec6[_0x4f1dfd];return _0x3edc55;};'use strict';var _=require(_0x68ec('0x0'));var util=require(_0x68ec('0x1'));var logger=require(_0x68ec('0x2'))(_0x68ec('0x3'));var moment=require(_0x68ec('0x4'));var BPromise=require(_0x68ec('0x5'));var rp=require(_0x68ec('0x6'));var fs=require('fs');var path=require(_0x68ec('0x7'));var rimraf=require(_0x68ec('0x8'));var config=require('../../config/environment');var attributes=require(_0x68ec('0x9'));module['exports']=function(_0x40371c,_0x59cad2){return _0x40371c['define'](_0x68ec('0xa'),attributes,{'tableName':_0x68ec('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x68ec('0xc'),'collate':_0x68ec('0xd'),'hooks':{'beforeUpdate':function(_0x2a987c,_0xbcf645,_0x5c6963){if(_0x2a987c['changed'](_0x68ec('0xe'))){_0x2a987c[_0x68ec('0xf')]=moment()[_0x68ec('0x10')](_0x68ec('0x11'));}_0x5c6963(null,_0x2a987c);}}});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.rpc.js b/server/api/openchannelInteraction/openchannelInteraction.rpc.js index 1f6dbe5..d8d5338 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 _0x234e=['register','request','then','info','OpenchannelInteraction,\x20%s,\x20%s','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','UpdateOpenchannelInteraction','OpenchannelInteraction','options','where','attributes','limit','AddTagsToOpenchannelInteraction','find','addTags','body','ids','omit','spread','AddTags','debug','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','defaults','localhost','socket.io-emitter','./openchannelInteraction.socket'];(function(_0x1c36e9,_0x1ce64b){var _0x1ee81b=function(_0x5d9aab){while(--_0x5d9aab){_0x1c36e9['push'](_0x1c36e9['shift']());}};_0x1ee81b(++_0x1ce64b);}(_0x234e,0xc8));var _0xe234=function(_0x4f339f,_0x64d3a7){_0x4f339f=_0x4f339f-0x0;var _0x4fb288=_0x234e[_0x4f339f];return _0x4fb288;};'use strict';var _=require(_0xe234('0x0'));var util=require('util');var moment=require(_0xe234('0x1'));var BPromise=require(_0xe234('0x2'));var rs=require(_0xe234('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe234('0x4'))['db'];var utils=require(_0xe234('0x5'));var logger=require(_0xe234('0x6'))(_0xe234('0x7'));var config=require(_0xe234('0x8'));var jayson=require(_0xe234('0x9'));var client=jayson[_0xe234('0xa')]['http']({'port':0x232a});config['redis']=_[_0xe234('0xb')](config['redis'],{'host':_0xe234('0xc'),'port':0x18eb});var socket=require(_0xe234('0xd'))(new Redis(config['redis']));require(_0xe234('0xe'))[_0xe234('0xf')](socket);function respondWithRpcPromise(_0x47604d,_0x42aafb,_0x49add6){return new BPromise(function(_0x24862c,_0x20932c){return client[_0xe234('0x10')](_0x47604d,_0x49add6)[_0xe234('0x11')](function(_0xc5595){logger[_0xe234('0x12')](_0xe234('0x13'),_0x42aafb,'request\x20sent');logger['debug'](_0xe234('0x14'),_0x42aafb,'request\x20sent',JSON[_0xe234('0x15')](_0xc5595));if(_0xc5595[_0xe234('0x16')]){if(_0xc5595[_0xe234('0x16')][_0xe234('0x17')]===0x1f4){logger['error']('OpenchannelInteraction,\x20%s,\x20%s',_0x42aafb,_0xc5595[_0xe234('0x16')]['message']);return _0x20932c(_0xc5595['error'][_0xe234('0x18')]);}logger['error'](_0xe234('0x13'),_0x42aafb,_0xc5595[_0xe234('0x16')][_0xe234('0x18')]);return _0x24862c(_0xc5595[_0xe234('0x16')][_0xe234('0x18')]);}else{logger[_0xe234('0x12')](_0xe234('0x13'),_0x42aafb,_0xe234('0x19'));_0x24862c(_0xc5595[_0xe234('0x1a')]['message']);}})['catch'](function(_0x271baa){logger['error']('OpenchannelInteraction,\x20%s,\x20%s',_0x42aafb,_0x271baa);_0x20932c(_0x271baa);});});}exports[_0xe234('0x1b')]=function(_0xb1d802){var _0x20034b=this;return new Promise(function(_0x119e28,_0x436b1f){return db[_0xe234('0x1c')]['update'](_0xb1d802['body'],{'raw':_0xb1d802[_0xe234('0x1d')]?_0xb1d802[_0xe234('0x1d')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xb1d802[_0xe234('0x1d')]?_0xb1d802['options'][_0xe234('0x1e')]||null:null,'attributes':_0xb1d802[_0xe234('0x1d')]?_0xb1d802[_0xe234('0x1d')][_0xe234('0x1f')]||null:null,'limit':_0xb1d802[_0xe234('0x1d')]?_0xb1d802[_0xe234('0x1d')][_0xe234('0x20')]||null:null})['then'](function(_0x2e23c4){logger[_0xe234('0x12')](_0xe234('0x1b'),_0xb1d802);logger['debug']('UpdateOpenchannelInteraction',_0xb1d802,JSON[_0xe234('0x15')](_0x2e23c4));_0x119e28(_0x2e23c4);})['catch'](function(_0x548278){logger[_0xe234('0x16')]('UpdateOpenchannelInteraction',_0x548278[_0xe234('0x18')],_0xb1d802);_0x436b1f(_0x20034b['error'](0x1f4,_0x548278[_0xe234('0x18')]));});});};exports[_0xe234('0x21')]=function(_0x52595c){return new Promise(function(_0x3fa29a,_0x1d414f){return db[_0xe234('0x1c')][_0xe234('0x22')]({'where':_0x52595c['options']?_0x52595c['options'][_0xe234('0x1e')]||null:null})['then'](function(_0x5ccbc9){if(_0x5ccbc9){return _0x5ccbc9[_0xe234('0x23')](_0x52595c[_0xe234('0x24')][_0xe234('0x25')],_[_0xe234('0x26')](_0x52595c[_0xe234('0x24')],[_0xe234('0x25'),'id'])||{});}})[_0xe234('0x27')](function(_0xc2b268){logger[_0xe234('0x12')](_0xe234('0x28'),_0x52595c);logger[_0xe234('0x29')](_0xe234('0x28'),_0x52595c,JSON[_0xe234('0x15')](_0xc2b268));_0x3fa29a(_0xc2b268);})[_0xe234('0x2a')](function(_0x365b6a){logger[_0xe234('0x16')](_0xe234('0x28'),_0x365b6a[_0xe234('0x18')],_0x52595c);_0x1d414f(_this['error'](0x1f4,_0x365b6a[_0xe234('0x18')]));});});}; \ No newline at end of file +var _0x1429=['stringify','AddTagsToOpenchannelInteraction','find','addTags','ids','omit','spread','AddTags','util','moment','bluebird','randomstring','ioredis','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./openchannelInteraction.socket','request','then','info','request\x20sent','debug','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','error','code','OpenchannelInteraction,\x20%s,\x20%s','message','catch','UpdateOpenchannelInteraction','OpenchannelInteraction','update','body','options','raw','where','attributes','limit'];(function(_0x510b98,_0x4c4cbb){var _0x45e775=function(_0x29ec11){while(--_0x29ec11){_0x510b98['push'](_0x510b98['shift']());}};_0x45e775(++_0x4c4cbb);}(_0x1429,0x1a2));var _0x9142=function(_0x32bda5,_0x1a809b){_0x32bda5=_0x32bda5-0x0;var _0x383d68=_0x1429[_0x32bda5];return _0x383d68;};'use strict';var _=require('lodash');var util=require(_0x9142('0x0'));var moment=require(_0x9142('0x1'));var BPromise=require(_0x9142('0x2'));var rs=require(_0x9142('0x3'));var fs=require('fs');var Redis=require(_0x9142('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x9142('0x5'));var jayson=require(_0x9142('0x6'));var client=jayson[_0x9142('0x7')][_0x9142('0x8')]({'port':0x232a});config[_0x9142('0x9')]=_[_0x9142('0xa')](config[_0x9142('0x9')],{'host':_0x9142('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x9142('0x9')]));require(_0x9142('0xc'))['register'](socket);function respondWithRpcPromise(_0x2a401f,_0x48f3f9,_0x3a1338){return new BPromise(function(_0x21ca1a,_0x2dd69a){return client[_0x9142('0xd')](_0x2a401f,_0x3a1338)[_0x9142('0xe')](function(_0x312b19){logger[_0x9142('0xf')]('OpenchannelInteraction,\x20%s,\x20%s',_0x48f3f9,_0x9142('0x10'));logger[_0x9142('0x11')](_0x9142('0x12'),_0x48f3f9,_0x9142('0x10'),JSON['stringify'](_0x312b19));if(_0x312b19[_0x9142('0x13')]){if(_0x312b19[_0x9142('0x13')][_0x9142('0x14')]===0x1f4){logger[_0x9142('0x13')](_0x9142('0x15'),_0x48f3f9,_0x312b19[_0x9142('0x13')][_0x9142('0x16')]);return _0x2dd69a(_0x312b19[_0x9142('0x13')][_0x9142('0x16')]);}logger['error'](_0x9142('0x15'),_0x48f3f9,_0x312b19[_0x9142('0x13')][_0x9142('0x16')]);return _0x21ca1a(_0x312b19[_0x9142('0x13')]['message']);}else{logger[_0x9142('0xf')]('OpenchannelInteraction,\x20%s,\x20%s',_0x48f3f9,_0x9142('0x10'));_0x21ca1a(_0x312b19['result']['message']);}})[_0x9142('0x17')](function(_0x554969){logger['error']('OpenchannelInteraction,\x20%s,\x20%s',_0x48f3f9,_0x554969);_0x2dd69a(_0x554969);});});}exports[_0x9142('0x18')]=function(_0x596473){var _0x509e24=this;return new Promise(function(_0x39d364,_0x200d62){return db[_0x9142('0x19')][_0x9142('0x1a')](_0x596473[_0x9142('0x1b')],{'raw':_0x596473[_0x9142('0x1c')]?_0x596473['options'][_0x9142('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x596473[_0x9142('0x1c')]?_0x596473['options'][_0x9142('0x1e')]||null:null,'attributes':_0x596473['options']?_0x596473['options'][_0x9142('0x1f')]||null:null,'limit':_0x596473[_0x9142('0x1c')]?_0x596473[_0x9142('0x1c')][_0x9142('0x20')]||null:null})[_0x9142('0xe')](function(_0x1321fa){logger[_0x9142('0xf')]('UpdateOpenchannelInteraction',_0x596473);logger[_0x9142('0x11')]('UpdateOpenchannelInteraction',_0x596473,JSON[_0x9142('0x21')](_0x1321fa));_0x39d364(_0x1321fa);})[_0x9142('0x17')](function(_0x437691){logger[_0x9142('0x13')](_0x9142('0x18'),_0x437691[_0x9142('0x16')],_0x596473);_0x200d62(_0x509e24[_0x9142('0x13')](0x1f4,_0x437691[_0x9142('0x16')]));});});};exports[_0x9142('0x22')]=function(_0x3a1dba){return new Promise(function(_0x462f2d,_0x3343e2){return db[_0x9142('0x19')][_0x9142('0x23')]({'where':_0x3a1dba[_0x9142('0x1c')]?_0x3a1dba['options']['where']||null:null})[_0x9142('0xe')](function(_0x4fbc77){if(_0x4fbc77){return _0x4fbc77[_0x9142('0x24')](_0x3a1dba[_0x9142('0x1b')][_0x9142('0x25')],_[_0x9142('0x26')](_0x3a1dba['body'],[_0x9142('0x25'),'id'])||{});}})[_0x9142('0x27')](function(_0x474821){logger[_0x9142('0xf')](_0x9142('0x28'),_0x3a1dba);logger[_0x9142('0x11')](_0x9142('0x28'),_0x3a1dba,JSON[_0x9142('0x21')](_0x474821));_0x462f2d(_0x474821);})[_0x9142('0x17')](function(_0x3cb7c6){logger[_0x9142('0x13')](_0x9142('0x28'),_0x3cb7c6[_0x9142('0x16')],_0x3a1dba);_0x3343e2(_this[_0x9142('0x13')](0x1f4,_0x3cb7c6['message']));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.socket.js b/server/api/openchannelInteraction/openchannelInteraction.socket.js index bd5506a..fe0b37c 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 _0xc412=['removeListener','register','./openchannelInteraction.events','save','remove','update','emit'];(function(_0x13ee83,_0x456ca6){var _0x43c870=function(_0x50d6aa){while(--_0x50d6aa){_0x13ee83['push'](_0x13ee83['shift']());}};_0x43c870(++_0x456ca6);}(_0xc412,0xb1));var _0x2c41=function(_0x3b779b,_0x43e637){_0x3b779b=_0x3b779b-0x0;var _0x2534e6=_0xc412[_0x3b779b];return _0x2534e6;};'use strict';var OpenchannelInteractionEvents=require(_0x2c41('0x0'));var events=[_0x2c41('0x1'),_0x2c41('0x2'),_0x2c41('0x3')];function createListener(_0x917a5e,_0x253839){return function(_0x4d7140){_0x253839[_0x2c41('0x4')](_0x917a5e,_0x4d7140);};}function removeListener(_0x2e278f,_0x31f2cb){return function(){OpenchannelInteractionEvents[_0x2c41('0x5')](_0x2e278f,_0x31f2cb);};}exports[_0x2c41('0x6')]=function(_0x501ee7){for(var _0x18d9e1=0x0,_0x1937ba=events['length'];_0x18d9e1<_0x1937ba;_0x18d9e1++){var _0x57320d=events[_0x18d9e1];var _0x137427=createListener('openchannelInteraction:'+_0x57320d,_0x501ee7);OpenchannelInteractionEvents['on'](_0x57320d,_0x137427);}}; \ No newline at end of file +var _0xf15f=['save','remove','update','emit','removeListener','register','length','openchannelInteraction:','./openchannelInteraction.events'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf15f,0x7d));var _0xff15=function(_0x4c12ec,_0x2e9103){_0x4c12ec=_0x4c12ec-0x0;var _0x3ae42c=_0xf15f[_0x4c12ec];return _0x3ae42c;};'use strict';var OpenchannelInteractionEvents=require(_0xff15('0x0'));var events=[_0xff15('0x1'),_0xff15('0x2'),_0xff15('0x3')];function createListener(_0x1a4951,_0x37b908){return function(_0x2f689a){_0x37b908[_0xff15('0x4')](_0x1a4951,_0x2f689a);};}function removeListener(_0x1510e2,_0x46dac3){return function(){OpenchannelInteractionEvents[_0xff15('0x5')](_0x1510e2,_0x46dac3);};}exports[_0xff15('0x6')]=function(_0x24672a){for(var _0x2b22c4=0x0,_0x59e887=events[_0xff15('0x7')];_0x2b22c4<_0x59e887;_0x2b22c4++){var _0x3233d9=events[_0x2b22c4];var _0x257c92=createListener(_0xff15('0x8')+_0x3233d9,_0x24672a);OpenchannelInteractionEvents['on'](_0x3233d9,_0x257c92);}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/index.js b/server/api/openchannelMessage/index.js index f88e55a..cc9f1ef 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 _0x0713=['get','isAuthenticated','index','/describe','describe','/:id','post','tracked','openchannel','openchannelmessage:create','put','update','accept','/:id/reject','delete','destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./openchannelMessage.controller'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_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'));var controller=require(_0x3071('0x7'));router[_0x3071('0x8')]('/',auth[_0x3071('0x9')](),controller[_0x3071('0xa')]);router[_0x3071('0x8')](_0x3071('0xb'),auth[_0x3071('0x9')](),controller[_0x3071('0xc')]);router[_0x3071('0x8')](_0x3071('0xd'),auth[_0x3071('0x9')](),controller['show']);router[_0x3071('0xe')]('/',auth[_0x3071('0x9')](),interaction[_0x3071('0xf')](_0x3071('0x10'),_0x3071('0x11')),controller['create']);router[_0x3071('0x12')](_0x3071('0xd'),auth[_0x3071('0x9')](),controller[_0x3071('0x13')]);router[_0x3071('0x12')]('/:id/accept',auth['isAuthenticated'](),controller[_0x3071('0x14')]);router['put'](_0x3071('0x15'),auth[_0x3071('0x9')](),controller['reject']);router[_0x3071('0x16')]('/:id',auth[_0x3071('0x9')](),controller[_0x3071('0x17')]);module[_0x3071('0x18')]=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(_0x33f0d0,_0x2da676){var _0xdfb647=function(_0x1a33a0){while(--_0x1a33a0){_0x33f0d0['push'](_0x33f0d0['shift']());}};_0xdfb647(++_0x2da676);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1ddedd,_0x485606){_0x1ddedd=_0x1ddedd-0x0;var _0xa3e1ac=_0xa9e0[_0x1ddedd];return _0xa3e1ac;};'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 15d8330..dea4fff 100644 --- a/server/api/openchannelMessage/openchannelMessage.attributes.js +++ b/server/api/openchannelMessage/openchannelMessage.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x97db=['TEXT','BOOLEAN','ENUM','out','sequelize','exports'];(function(_0x53752e,_0x4e1fc8){var _0x1b15d1=function(_0x102b88){while(--_0x102b88){_0x53752e['push'](_0x53752e['shift']());}};_0x1b15d1(++_0x4e1fc8);}(_0x97db,0x1b4));var _0xb97d=function(_0x560822,_0x3ecbf8){_0x560822=_0x560822-0x0;var _0x3302ca=_0x97db[_0x560822];return _0x3302ca;};'use strict';var Sequelize=require(_0xb97d('0x0'));module[_0xb97d('0x1')]={'body':{'type':Sequelize[_0xb97d('0x2')]('medium'),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'secret':{'type':Sequelize[_0xb97d('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0xb97d('0x4')]('in',_0xb97d('0x5')),'defaultValue':_0xb97d('0x5'),'allowNull':![]},'readAt':{'type':Sequelize['DATE']},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0xb97d('0x2')]}}; \ No newline at end of file +var _0x69d4=['DATE','STRING','TEXT','sequelize','exports','medium','BOOLEAN','out'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x69d4,0x83));var _0x469d=function(_0x547ff4,_0x416fa1){_0x547ff4=_0x547ff4-0x0;var _0xe41057=_0x69d4[_0x547ff4];return _0xe41057;};'use strict';var Sequelize=require(_0x469d('0x0'));module[_0x469d('0x1')]={'body':{'type':Sequelize['TEXT'](_0x469d('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x469d('0x3')],'defaultValue':![]},'secret':{'type':Sequelize[_0x469d('0x3')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0x469d('0x4')),'defaultValue':'out','allowNull':![]},'readAt':{'type':Sequelize[_0x469d('0x5')]},'providerName':{'type':Sequelize[_0x469d('0x6')]},'providerResponse':{'type':Sequelize[_0x469d('0x7')]}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.controller.js b/server/api/openchannelMessage/openchannelMessage.controller.js index 03aa8b9..3e1f734 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 _0xf64f=['rows','show','params','keys','create','body','update','find','describe','openchannel-interactions','accept','openchannel','read','format','UserId','user','get','OpenchannelInteraction','isNil','read1stAt','YYYY-MM-DD\x20HH:mm:ss','interaction','[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','stringify','null','AcceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','agent','manual','interface','channel','motionChannel','event','EventManager','acceptmessage','../../config/logger','reject','OpenchannelInteractionId','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','User','SIP/%s','rejectmessage','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./openchannelMessage.socket','register','client','http','info','OpenchannelMessage,\x20%s,\x20%s','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','result','catch','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','apply','save','then','destroy','name','index','map','OpenchannelMessage','rawAttributes','fieldName','type','key','model','query','intersection','fields','attributes','length','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll'];(function(_0x28518c,_0x5dabb0){var _0x8e3945=function(_0x5eb25f){while(--_0x5eb25f){_0x28518c['push'](_0x28518c['shift']());}};_0x8e3945(++_0x5dabb0);}(_0xf64f,0xb4));var _0xff64=function(_0x10c3b7,_0x3d78a9){_0x10c3b7=_0x10c3b7-0x0;var _0x491957=_0xf64f[_0x10c3b7];return _0x491957;};'use strict';var emlformat=require(_0xff64('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xff64('0x1'));var jsonpatch=require(_0xff64('0x2'));var rp=require(_0xff64('0x3'));var moment=require(_0xff64('0x4'));var BPromise=require(_0xff64('0x5'));var Mustache=require(_0xff64('0x6'));var util=require('util');var path=require(_0xff64('0x7'));var sox=require(_0xff64('0x8'));var csv=require(_0xff64('0x9'));var ejs=require(_0xff64('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xff64('0xb'));var squel=require(_0xff64('0xc'));var crypto=require('crypto');var jsforce=require(_0xff64('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xff64('0x9'));var querystring=require(_0xff64('0xe'));var Papa=require(_0xff64('0xf'));var Redis=require('ioredis');var authService=require(_0xff64('0x10'));var qs=require(_0xff64('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xff64('0x12'));var utils=require(_0xff64('0x13'));var config=require(_0xff64('0x14'));var licenseUtil=require(_0xff64('0x15'));var db=require(_0xff64('0x16'))['db'];config['redis']=_[_0xff64('0x17')](config[_0xff64('0x18')],{'host':_0xff64('0x19'),'port':0x18eb});var socket=require(_0xff64('0x1a'))(new Redis(config[_0xff64('0x18')]));require(_0xff64('0x1b'))[_0xff64('0x1c')](socket);var jayson=require('jayson/promise');var client=jayson[_0xff64('0x1d')][_0xff64('0x1e')]({'port':0x232c});var client9002=jayson[_0xff64('0x1d')][_0xff64('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x1ec793,_0x58ad08,_0x1a43c2,_0xe30c27){return new BPromise(function(_0x552e9a,_0x4c8c2e){var _0x31fa39=_0xe30c27||client;return _0x31fa39['request'](_0x1ec793,_0x1a43c2)['then'](function(_0x5d5be4){logger[_0xff64('0x1f')](_0xff64('0x20'),_0x58ad08,'request\x20sent');logger[_0xff64('0x21')](_0xff64('0x22'),_0x58ad08,_0xff64('0x23'),JSON['stringify'](_0x5d5be4));if(_0x5d5be4[_0xff64('0x24')]){if(_0x5d5be4[_0xff64('0x24')]['code']===0x1f4){logger[_0xff64('0x24')](_0xff64('0x20'),_0x58ad08,_0x5d5be4[_0xff64('0x24')][_0xff64('0x25')]);return _0x4c8c2e(_0x5d5be4[_0xff64('0x24')][_0xff64('0x25')]);}logger[_0xff64('0x24')](_0xff64('0x20'),_0x58ad08,_0x5d5be4['error'][_0xff64('0x25')]);return _0x552e9a(_0x5d5be4[_0xff64('0x24')][_0xff64('0x25')]);}else{logger[_0xff64('0x1f')](_0xff64('0x20'),_0x58ad08,_0xff64('0x23'));_0x552e9a(_0x5d5be4[_0xff64('0x26')]['message']);}})[_0xff64('0x27')](function(_0x590318){logger[_0xff64('0x24')](_0xff64('0x20'),_0x58ad08,_0x590318);_0x4c8c2e(_0x590318);});});}function respondWithStatusCode(_0x4de160,_0x1753e5){_0x1753e5=_0x1753e5||0xcc;return function(_0x389ca5){if(_0x389ca5){return _0x4de160[_0xff64('0x28')](_0x1753e5);}return _0x4de160[_0xff64('0x29')](_0x1753e5)[_0xff64('0x2a')]();};}function respondWithResult(_0x4462ff,_0x42f711){_0x42f711=_0x42f711||0xc8;return function(_0x17f97d){if(_0x17f97d){return _0x4462ff[_0xff64('0x29')](_0x42f711)[_0xff64('0x2b')](_0x17f97d);}};}function respondWithFilteredResult(_0x56ad6b,_0x1b0df2){return function(_0x17b52c){if(_0x17b52c){var _0x8f32c8=typeof _0x1b0df2[_0xff64('0x2c')]==='undefined'&&typeof _0x1b0df2[_0xff64('0x2d')]===_0xff64('0x2e');var _0xbc61bd=_0x17b52c['count'];var _0x206103=_0x8f32c8?0x0:_0x1b0df2[_0xff64('0x2c')];var _0x20e245=_0x8f32c8?_0x17b52c[_0xff64('0x2f')]:_0x1b0df2[_0xff64('0x2c')]+_0x1b0df2[_0xff64('0x2d')];var _0xe4cfd0;if(_0x20e245>=_0xbc61bd){_0x20e245=_0xbc61bd;_0xe4cfd0=0xc8;}else{_0xe4cfd0=0xce;}_0x56ad6b['status'](_0xe4cfd0);return _0x56ad6b['set'](_0xff64('0x30'),_0x206103+'-'+_0x20e245+'/'+_0xbc61bd)[_0xff64('0x2b')](_0x17b52c);}return null;};}function patchUpdates(_0x2ecebc){return function(_0x312fbe){try{jsonpatch[_0xff64('0x31')](_0x312fbe,_0x2ecebc,!![]);}catch(_0x55a828){return BPromise['reject'](_0x55a828);}return _0x312fbe[_0xff64('0x32')]();};}function saveUpdates(_0x1ecd34,_0xfc91e1){return function(_0x51a0de){if(_0x51a0de){return _0x51a0de['update'](_0x1ecd34)[_0xff64('0x33')](function(_0x3452d9){return _0x3452d9;});}return null;};}function removeEntity(_0x13765f,_0x467b8f){return function(_0x306ae2){if(_0x306ae2){return _0x306ae2[_0xff64('0x34')]()[_0xff64('0x33')](function(){_0x13765f[_0xff64('0x29')](0xcc)['end']();});}};}function handleEntityNotFound(_0x511ea0,_0x143421){return function(_0x373cbe){if(!_0x373cbe){_0x511ea0[_0xff64('0x28')](0x194);}return _0x373cbe;};}function handleError(_0x4a8353,_0x1c499a){_0x1c499a=_0x1c499a||0x1f4;return function(_0x17b2a6){logger[_0xff64('0x24')](_0x17b2a6['stack']);if(_0x17b2a6[_0xff64('0x35')]){delete _0x17b2a6['name'];}_0x4a8353[_0xff64('0x29')](_0x1c499a)['send'](_0x17b2a6);};}exports[_0xff64('0x36')]=function(_0x178d16,_0x1f79f6){var _0x1082c6={},_0x19a49a={},_0x45136f={'count':0x0,'rows':[]};var _0x3aeeaa=_[_0xff64('0x37')](db[_0xff64('0x38')][_0xff64('0x39')],function(_0x167d0a){return{'name':_0x167d0a[_0xff64('0x3a')],'type':_0x167d0a[_0xff64('0x3b')][_0xff64('0x3c')]};});_0x19a49a[_0xff64('0x3d')]=_[_0xff64('0x37')](_0x3aeeaa,_0xff64('0x35'));_0x19a49a[_0xff64('0x3e')]=_['keys'](_0x178d16[_0xff64('0x3e')]);_0x19a49a['filters']=_[_0xff64('0x3f')](_0x19a49a[_0xff64('0x3d')],_0x19a49a[_0xff64('0x3e')]);_0x1082c6['attributes']=_['intersection'](_0x19a49a['model'],qs[_0xff64('0x40')](_0x178d16['query'][_0xff64('0x40')]));_0x1082c6[_0xff64('0x41')]=_0x1082c6['attributes'][_0xff64('0x42')]?_0x1082c6[_0xff64('0x41')]:_0x19a49a[_0xff64('0x3d')];if(!_0x178d16[_0xff64('0x3e')]['hasOwnProperty'](_0xff64('0x43'))){_0x1082c6[_0xff64('0x2d')]=qs[_0xff64('0x2d')](_0x178d16[_0xff64('0x3e')]['limit']);_0x1082c6[_0xff64('0x2c')]=qs[_0xff64('0x2c')](_0x178d16[_0xff64('0x3e')][_0xff64('0x2c')]);}_0x1082c6[_0xff64('0x44')]=qs[_0xff64('0x45')](_0x178d16[_0xff64('0x3e')][_0xff64('0x45')]);_0x1082c6[_0xff64('0x46')]=qs[_0xff64('0x47')](_[_0xff64('0x48')](_0x178d16[_0xff64('0x3e')],_0x19a49a[_0xff64('0x47')]),_0x3aeeaa);if(_0x178d16[_0xff64('0x3e')][_0xff64('0x49')]){_0x1082c6[_0xff64('0x46')]=_[_0xff64('0x4a')](_0x1082c6[_0xff64('0x46')],{'$or':_[_0xff64('0x37')](_0x3aeeaa,function(_0x15442a){if(_0x15442a['type']!==_0xff64('0x4b')){var _0x11e7b0={};_0x11e7b0[_0x15442a[_0xff64('0x35')]]={'$like':'%'+_0x178d16['query'][_0xff64('0x49')]+'%'};return _0x11e7b0;}})});}_0x1082c6=_['merge']({},_0x1082c6,_0x178d16[_0xff64('0x4c')]);var _0x3c9c4f={'where':_0x1082c6[_0xff64('0x46')]};return db[_0xff64('0x38')][_0xff64('0x2f')](_0x3c9c4f)[_0xff64('0x33')](function(_0xa5a755){_0x45136f['count']=_0xa5a755;if(_0x178d16[_0xff64('0x3e')][_0xff64('0x4d')]){_0x1082c6[_0xff64('0x4e')]=[{'all':!![]}];}return db[_0xff64('0x38')][_0xff64('0x4f')](_0x1082c6);})[_0xff64('0x33')](function(_0x1b08a7){_0x45136f[_0xff64('0x50')]=_0x1b08a7;return _0x45136f;})['then'](respondWithFilteredResult(_0x1f79f6,_0x1082c6))[_0xff64('0x27')](handleError(_0x1f79f6,null));};exports[_0xff64('0x51')]=function(_0x1aac21,_0x434cb9){var _0x59d774={'raw':!![],'where':{'id':_0x1aac21[_0xff64('0x52')]['id']}},_0x5bc399={};_0x5bc399[_0xff64('0x3d')]=_[_0xff64('0x53')](db[_0xff64('0x38')][_0xff64('0x39')]);_0x5bc399[_0xff64('0x3e')]=_[_0xff64('0x53')](_0x1aac21[_0xff64('0x3e')]);_0x5bc399[_0xff64('0x47')]=_['intersection'](_0x5bc399[_0xff64('0x3d')],_0x5bc399[_0xff64('0x3e')]);_0x59d774[_0xff64('0x41')]=_[_0xff64('0x3f')](_0x5bc399[_0xff64('0x3d')],qs['fields'](_0x1aac21[_0xff64('0x3e')][_0xff64('0x40')]));_0x59d774['attributes']=_0x59d774['attributes'][_0xff64('0x42')]?_0x59d774[_0xff64('0x41')]:_0x5bc399[_0xff64('0x3d')];if(_0x1aac21[_0xff64('0x3e')][_0xff64('0x4d')]){_0x59d774['include']=[{'all':!![]}];}_0x59d774=_[_0xff64('0x4a')]({},_0x59d774,_0x1aac21[_0xff64('0x4c')]);return db[_0xff64('0x38')]['find'](_0x59d774)['then'](handleEntityNotFound(_0x434cb9,null))[_0xff64('0x33')](respondWithResult(_0x434cb9,null))[_0xff64('0x27')](handleError(_0x434cb9,null));};exports[_0xff64('0x54')]=function(_0x3e42ed,_0x5a18b0){return db[_0xff64('0x38')][_0xff64('0x54')](_0x3e42ed[_0xff64('0x55')],{})[_0xff64('0x33')](respondWithResult(_0x5a18b0,0xc9))[_0xff64('0x27')](handleError(_0x5a18b0,null));};exports[_0xff64('0x56')]=function(_0x3c8722,_0x3332d6){if(_0x3c8722[_0xff64('0x55')]['id']){delete _0x3c8722[_0xff64('0x55')]['id'];}return db[_0xff64('0x38')][_0xff64('0x57')]({'where':{'id':_0x3c8722[_0xff64('0x52')]['id']}})[_0xff64('0x33')](handleEntityNotFound(_0x3332d6,null))[_0xff64('0x33')](saveUpdates(_0x3c8722[_0xff64('0x55')],null))['then'](respondWithResult(_0x3332d6,null))[_0xff64('0x27')](handleError(_0x3332d6,null));};exports[_0xff64('0x34')]=function(_0x4195e0,_0x4a01ae){return db['OpenchannelMessage'][_0xff64('0x57')]({'where':{'id':_0x4195e0[_0xff64('0x52')]['id']}})[_0xff64('0x33')](handleEntityNotFound(_0x4a01ae,null))[_0xff64('0x33')](removeEntity(_0x4a01ae,null))[_0xff64('0x27')](handleError(_0x4a01ae,null));};exports[_0xff64('0x58')]=function(_0x23c3c5,_0x1f649d){return db[_0xff64('0x38')][_0xff64('0x58')]()[_0xff64('0x33')](respondWithResult(_0x1f649d,null))[_0xff64('0x27')](handleError(_0x1f649d,null));};var interaction_log=require('../../config/logger')(_0xff64('0x59'));exports[_0xff64('0x5a')]=function(_0x4df3a7,_0x360194,_0x3c4442){var _0x1ae1bb={'agent':{},'channel':_0xff64('0x5b')};if(_0x4df3a7[_0xff64('0x55')]['id']){delete _0x4df3a7[_0xff64('0x55')]['id'];}_0x4df3a7[_0xff64('0x55')][_0xff64('0x5c')]=!![];_0x4df3a7[_0xff64('0x55')]['readAt']=moment()[_0xff64('0x5d')]('YYYY-MM-DD\x20HH:mm:ss');_0x4df3a7[_0xff64('0x55')][_0xff64('0x5e')]=_0x4df3a7[_0xff64('0x55')][_0xff64('0x5e')]||_0x4df3a7[_0xff64('0x5f')]['id'];_0x1ae1bb['agent']['id']=_0x4df3a7['body'][_0xff64('0x5e')];return db['OpenchannelMessage']['find']({'where':{'id':_0x4df3a7[_0xff64('0x52')]['id'],'UserId':null}})[_0xff64('0x33')](handleEntityNotFound(_0x360194,null))[_0xff64('0x33')](saveUpdates(_0x4df3a7[_0xff64('0x55')],null))[_0xff64('0x33')](function(_0x3f6f3a){if(_0x3f6f3a){_0x1ae1bb[_0xff64('0x25')]=_0x3f6f3a[_0xff64('0x60')]({'plain':!![]});return db[_0xff64('0x61')][_0xff64('0x57')]({'where':{'id':_0x3f6f3a['OpenchannelInteractionId']}});}return null;})[_0xff64('0x33')](handleEntityNotFound(_0x360194,null))[_0xff64('0x33')](function(_0x4098a1){if(_0x4098a1){return _0x4098a1[_0xff64('0x56')]({'UserId':_0x4df3a7[_0xff64('0x55')]['UserId'],'read1stAt':_[_0xff64('0x62')](_0x4098a1[_0xff64('0x63')])?moment()[_0xff64('0x5d')](_0xff64('0x64')):undefined});}return null;})[_0xff64('0x33')](function(_0x20ec82){if(_0x20ec82){_0x1ae1bb[_0xff64('0x65')]=_0x20ec82[_0xff64('0x60')]({'plain':!![]});interaction_log[_0xff64('0x1f')](_0xff64('0x66'),_0x4df3a7[_0xff64('0x5f')]['id'],_0x4df3a7[_0xff64('0x5f')][_0xff64('0x35')],_0x4df3a7['user']['role'],_0x1ae1bb[_0xff64('0x65')]['id'],_0x4df3a7[_0xff64('0x55')]?JSON[_0xff64('0x67')](_0x4df3a7[_0xff64('0x55')]):_0xff64('0x68'));return respondWithRpcPromise(_0xff64('0x69'),'acceptMessage',_0x1ae1bb);}return null;})['then'](function(_0x3af2ec){var _0x5e32c0=_0xff64('0x6a')+_0x3af2ec['message'][_0xff64('0x6b')];return db[_0xff64('0x6c')][_0xff64('0x3e')](_0x5e32c0,{'type':db[_0xff64('0x6d')][_0xff64('0x6e')][_0xff64('0x6f')],'raw':!![]})[_0xff64('0x33')](function(_0x32f540){return _0x32f540;});})[_0xff64('0x33')](function(_0x5805fb){if(_0x5805fb){_0x1ae1bb[_0xff64('0x25')][_0xff64('0x70')]=_0x5805fb[0x0];if(!_0x4df3a7[_0xff64('0x55')][_0xff64('0x5e')])return;return db['User'][_0xff64('0x57')]({'where':{'id':_0x4df3a7[_0xff64('0x55')][_0xff64('0x5e')],'role':_0xff64('0x71')},'attributes':['id','name','fullname','email','internal'],'raw':!![]});}return null;})[_0xff64('0x33')](function(_0x303083){if(!_0x303083)return null;_0x1ae1bb[_0xff64('0x25')]['agent']=_0x303083;return _0x1ae1bb;})[_0xff64('0x33')](function(_0x33c5ca){if(_0x33c5ca){if(_0x4df3a7[_0xff64('0x55')][_0xff64('0x72')]){_0x1ae1bb[_0xff64('0x25')][_0xff64('0x73')]=util[_0xff64('0x5d')]('SIP/%s',_0x4df3a7[_0xff64('0x5f')][_0xff64('0x35')]);_0x1ae1bb[_0xff64('0x25')][_0xff64('0x74')]=_0x1ae1bb[_0xff64('0x74')];_0x1ae1bb['message'][_0xff64('0x75')]=_0x1ae1bb[_0xff64('0x74')];_0x1ae1bb[_0xff64('0x25')][_0xff64('0x76')]=_0xff64('0x5a');return respondWithRpcPromise('EventManager',_0xff64('0x77'),{'event':_0xff64('0x78'),'message':_0x1ae1bb[_0xff64('0x25')]},client9002)[_0xff64('0x33')](function(){return _0x1ae1bb;});}return _0x1ae1bb;}return null;})[_0xff64('0x33')](respondWithResult(_0x360194,null))[_0xff64('0x27')](handleError(_0x360194,null));};var interaction_log=require(_0xff64('0x79'))(_0xff64('0x59'));exports[_0xff64('0x7a')]=function(_0x4d08f5,_0xaeafbd,_0x950fdd){var _0x27b090={'agent':{},'channel':'openchannel'};if(_0x4d08f5[_0xff64('0x55')]['id']){delete _0x4d08f5[_0xff64('0x55')]['id'];}_0x4d08f5['body']['UserId']=_0x4d08f5[_0xff64('0x55')][_0xff64('0x5e')]||_0x4d08f5[_0xff64('0x5f')]['id'];_0x27b090[_0xff64('0x71')]['id']=_0x4d08f5[_0xff64('0x55')][_0xff64('0x5e')];return db[_0xff64('0x38')][_0xff64('0x57')]({'where':{'id':_0x4d08f5[_0xff64('0x52')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0xaeafbd,null))[_0xff64('0x33')](function(_0x4fc748){if(_0x4fc748){_0x27b090[_0xff64('0x25')]=_0x4fc748['get']({'plain':!![]});return db['OpenchannelInteraction'][_0xff64('0x57')]({'where':{'id':_0x4fc748[_0xff64('0x7b')]}});}return null;})[_0xff64('0x33')](handleEntityNotFound(_0xaeafbd,null))[_0xff64('0x33')](function(_0x590463){if(_0x590463){_0x27b090[_0xff64('0x65')]=_0x590463[_0xff64('0x60')]({'plain':!![]});interaction_log[_0xff64('0x1f')](_0xff64('0x7c'),_0x4d08f5[_0xff64('0x5f')]['id'],_0x4d08f5[_0xff64('0x5f')][_0xff64('0x35')],_0x4d08f5['user']['role'],_0x27b090[_0xff64('0x65')]['id'],_0x4d08f5[_0xff64('0x55')]?JSON['stringify'](_0x4d08f5[_0xff64('0x55')]):_0xff64('0x68'));return respondWithRpcPromise(_0xff64('0x7d'),_0xff64('0x7e'),_0x27b090);}return null;})['then'](function(_0x3cb94c){var _0x4a5a89=_0xff64('0x6a')+_0x3cb94c['message'][_0xff64('0x6b')];return db[_0xff64('0x6c')][_0xff64('0x3e')](_0x4a5a89,{'type':db[_0xff64('0x6d')][_0xff64('0x6e')][_0xff64('0x6f')],'raw':!![]})[_0xff64('0x33')](function(_0x583f2b){return _0x583f2b;});})['then'](function(_0x55680){if(_0x55680){_0x27b090[_0xff64('0x25')]['contact']=_0x55680[0x0];if(!_0x4d08f5[_0xff64('0x55')][_0xff64('0x5e')])return;return db[_0xff64('0x7f')][_0xff64('0x57')]({'where':{'id':_0x4d08f5[_0xff64('0x55')][_0xff64('0x5e')],'role':_0xff64('0x71')},'attributes':['id','name','fullname','email','internal'],'raw':!![]});}return null;})[_0xff64('0x33')](function(_0x11e31d){if(!_0x11e31d)return null;_0x27b090['message'][_0xff64('0x71')]=_0x11e31d;return _0x27b090;})['then'](function(_0x1bef81){if(_0x1bef81){_0x1bef81[_0xff64('0x25')][_0xff64('0x73')]=util[_0xff64('0x5d')](_0xff64('0x80'),_0x4d08f5[_0xff64('0x5f')][_0xff64('0x35')]);_0x1bef81[_0xff64('0x25')][_0xff64('0x74')]=_0x27b090[_0xff64('0x74')];_0x1bef81['message']['motionChannel']=_0x27b090[_0xff64('0x74')];_0x1bef81[_0xff64('0x25')][_0xff64('0x76')]=_0xff64('0x7a');respondWithRpcPromise(_0xff64('0x77'),_0xff64('0x77'),{'event':_0xff64('0x81'),'message':_0x1bef81[_0xff64('0x25')]},client9002);return _0x27b090;}return null;})[_0xff64('0x33')](respondWithResult(_0xaeafbd,null))['catch'](handleError(_0xaeafbd,null));}; \ No newline at end of file +var _0xbb57=['catch','show','params','find','create','body','describe','openchannel-interactions','accept','openchannel','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','OpenchannelInteractionId','update','read1stAt','interaction','[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','SELECT','User','email','manual','interface','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','OpenchannelInteraction','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','stringify','RejectMessage','contact','fullname','internal','rejectmessage','eml-format','zip-dir','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../mysqldb','defaults','localhost','redis','./openchannelMessage.socket','register','client','http','then','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','error','code','OpenchannelMessage,\x20%s,\x20%s','message','info','result','sendStatus','end','status','json','offset','limit','count','set','Content-Range','apply','reject','save','destroy','stack','name','index','map','OpenchannelMessage','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','nolimit','order','sort','pick','filter','merge','VIRTUAL','options','where','includeAll','include','findAll','rows'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0xbb57,0x136));var _0x7bb5=function(_0x37d1e8,_0x5b878c){_0x37d1e8=_0x37d1e8-0x0;var _0x1efa61=_0xbb57[_0x37d1e8];return _0x1efa61;};'use strict';var emlformat=require(_0x7bb5('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x7bb5('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x7bb5('0x2'));var Mustache=require(_0x7bb5('0x3'));var util=require(_0x7bb5('0x4'));var path=require(_0x7bb5('0x5'));var sox=require(_0x7bb5('0x6'));var csv=require(_0x7bb5('0x7'));var ejs=require(_0x7bb5('0x8'));var fs=require('fs');var fs_extra=require(_0x7bb5('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x7bb5('0xa'));var toCsv=require(_0x7bb5('0x7'));var querystring=require(_0x7bb5('0xb'));var Papa=require(_0x7bb5('0xc'));var Redis=require('ioredis');var authService=require(_0x7bb5('0xd'));var qs=require(_0x7bb5('0xe'));var as=require(_0x7bb5('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7bb5('0x10'))(_0x7bb5('0x11'));var utils=require('../../config/utils');var config=require(_0x7bb5('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0x7bb5('0x13'))['db'];config['redis']=_[_0x7bb5('0x14')](config['redis'],{'host':_0x7bb5('0x15'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x7bb5('0x16')]));require(_0x7bb5('0x17'))[_0x7bb5('0x18')](socket);var jayson=require('jayson/promise');var client=jayson[_0x7bb5('0x19')][_0x7bb5('0x1a')]({'port':0x232c});var client9002=jayson['client'][_0x7bb5('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x38f366,_0x4d4029,_0x267aca,_0x1e2e01){return new BPromise(function(_0x4ece59,_0x2ed7dd){var _0x25f197=_0x1e2e01||client;return _0x25f197['request'](_0x38f366,_0x267aca)[_0x7bb5('0x1b')](function(_0x13cda7){logger['info']('OpenchannelMessage,\x20%s,\x20%s',_0x4d4029,_0x7bb5('0x1c'));logger[_0x7bb5('0x1d')](_0x7bb5('0x1e'),_0x4d4029,_0x7bb5('0x1c'),JSON['stringify'](_0x13cda7));if(_0x13cda7[_0x7bb5('0x1f')]){if(_0x13cda7[_0x7bb5('0x1f')][_0x7bb5('0x20')]===0x1f4){logger['error'](_0x7bb5('0x21'),_0x4d4029,_0x13cda7[_0x7bb5('0x1f')]['message']);return _0x2ed7dd(_0x13cda7['error'][_0x7bb5('0x22')]);}logger[_0x7bb5('0x1f')](_0x7bb5('0x21'),_0x4d4029,_0x13cda7['error'][_0x7bb5('0x22')]);return _0x4ece59(_0x13cda7[_0x7bb5('0x1f')][_0x7bb5('0x22')]);}else{logger[_0x7bb5('0x23')](_0x7bb5('0x21'),_0x4d4029,_0x7bb5('0x1c'));_0x4ece59(_0x13cda7[_0x7bb5('0x24')][_0x7bb5('0x22')]);}})['catch'](function(_0x51bf3e){logger[_0x7bb5('0x1f')]('OpenchannelMessage,\x20%s,\x20%s',_0x4d4029,_0x51bf3e);_0x2ed7dd(_0x51bf3e);});});}function respondWithStatusCode(_0x2de211,_0x406228){_0x406228=_0x406228||0xcc;return function(_0x16550b){if(_0x16550b){return _0x2de211[_0x7bb5('0x25')](_0x406228);}return _0x2de211['status'](_0x406228)[_0x7bb5('0x26')]();};}function respondWithResult(_0x3fa08a,_0x20f846){_0x20f846=_0x20f846||0xc8;return function(_0x20b975){if(_0x20b975){return _0x3fa08a[_0x7bb5('0x27')](_0x20f846)[_0x7bb5('0x28')](_0x20b975);}};}function respondWithFilteredResult(_0xc363b5,_0x190ec3){return function(_0x214087){if(_0x214087){var _0xef946=typeof _0x190ec3[_0x7bb5('0x29')]==='undefined'&&typeof _0x190ec3[_0x7bb5('0x2a')]==='undefined';var _0x3c93d0=_0x214087[_0x7bb5('0x2b')];var _0x4ed58d=_0xef946?0x0:_0x190ec3[_0x7bb5('0x29')];var _0x5c61bb=_0xef946?_0x214087[_0x7bb5('0x2b')]:_0x190ec3[_0x7bb5('0x29')]+_0x190ec3[_0x7bb5('0x2a')];var _0x29a135;if(_0x5c61bb>=_0x3c93d0){_0x5c61bb=_0x3c93d0;_0x29a135=0xc8;}else{_0x29a135=0xce;}_0xc363b5[_0x7bb5('0x27')](_0x29a135);return _0xc363b5[_0x7bb5('0x2c')](_0x7bb5('0x2d'),_0x4ed58d+'-'+_0x5c61bb+'/'+_0x3c93d0)[_0x7bb5('0x28')](_0x214087);}return null;};}function patchUpdates(_0x4ac1ce){return function(_0x424ac0){try{jsonpatch[_0x7bb5('0x2e')](_0x424ac0,_0x4ac1ce,!![]);}catch(_0x5d1acf){return BPromise[_0x7bb5('0x2f')](_0x5d1acf);}return _0x424ac0[_0x7bb5('0x30')]();};}function saveUpdates(_0x3002e0,_0x58abe8){return function(_0x177c52){if(_0x177c52){return _0x177c52['update'](_0x3002e0)[_0x7bb5('0x1b')](function(_0x629d36){return _0x629d36;});}return null;};}function removeEntity(_0x50e43c,_0x44b607){return function(_0xb5a337){if(_0xb5a337){return _0xb5a337[_0x7bb5('0x31')]()[_0x7bb5('0x1b')](function(){_0x50e43c[_0x7bb5('0x27')](0xcc)[_0x7bb5('0x26')]();});}};}function handleEntityNotFound(_0x59014d,_0x35e8bd){return function(_0x1e986e){if(!_0x1e986e){_0x59014d['sendStatus'](0x194);}return _0x1e986e;};}function handleError(_0x11d9f5,_0x37c620){_0x37c620=_0x37c620||0x1f4;return function(_0x1626c4){logger[_0x7bb5('0x1f')](_0x1626c4[_0x7bb5('0x32')]);if(_0x1626c4[_0x7bb5('0x33')]){delete _0x1626c4['name'];}_0x11d9f5[_0x7bb5('0x27')](_0x37c620)['send'](_0x1626c4);};}exports[_0x7bb5('0x34')]=function(_0xcb6f79,_0xfd2161){var _0x53016b={},_0x24e438={},_0x577303={'count':0x0,'rows':[]};var _0x45cad3=_[_0x7bb5('0x35')](db[_0x7bb5('0x36')][_0x7bb5('0x37')],function(_0x2735ab){return{'name':_0x2735ab[_0x7bb5('0x38')],'type':_0x2735ab[_0x7bb5('0x39')][_0x7bb5('0x3a')]};});_0x24e438[_0x7bb5('0x3b')]=_[_0x7bb5('0x35')](_0x45cad3,_0x7bb5('0x33'));_0x24e438['query']=_[_0x7bb5('0x3c')](_0xcb6f79[_0x7bb5('0x3d')]);_0x24e438[_0x7bb5('0x3e')]=_[_0x7bb5('0x3f')](_0x24e438['model'],_0x24e438[_0x7bb5('0x3d')]);_0x53016b[_0x7bb5('0x40')]=_[_0x7bb5('0x3f')](_0x24e438[_0x7bb5('0x3b')],qs[_0x7bb5('0x41')](_0xcb6f79[_0x7bb5('0x3d')]['fields']));_0x53016b[_0x7bb5('0x40')]=_0x53016b[_0x7bb5('0x40')][_0x7bb5('0x42')]?_0x53016b[_0x7bb5('0x40')]:_0x24e438[_0x7bb5('0x3b')];if(!_0xcb6f79[_0x7bb5('0x3d')]['hasOwnProperty'](_0x7bb5('0x43'))){_0x53016b[_0x7bb5('0x2a')]=qs[_0x7bb5('0x2a')](_0xcb6f79[_0x7bb5('0x3d')][_0x7bb5('0x2a')]);_0x53016b[_0x7bb5('0x29')]=qs[_0x7bb5('0x29')](_0xcb6f79['query'][_0x7bb5('0x29')]);}_0x53016b[_0x7bb5('0x44')]=qs[_0x7bb5('0x45')](_0xcb6f79[_0x7bb5('0x3d')][_0x7bb5('0x45')]);_0x53016b['where']=qs[_0x7bb5('0x3e')](_[_0x7bb5('0x46')](_0xcb6f79[_0x7bb5('0x3d')],_0x24e438[_0x7bb5('0x3e')]),_0x45cad3);if(_0xcb6f79[_0x7bb5('0x3d')][_0x7bb5('0x47')]){_0x53016b['where']=_[_0x7bb5('0x48')](_0x53016b['where'],{'$or':_[_0x7bb5('0x35')](_0x45cad3,function(_0x55d2fe){if(_0x55d2fe[_0x7bb5('0x39')]!==_0x7bb5('0x49')){var _0x346410={};_0x346410[_0x55d2fe[_0x7bb5('0x33')]]={'$like':'%'+_0xcb6f79[_0x7bb5('0x3d')]['filter']+'%'};return _0x346410;}})});}_0x53016b=_['merge']({},_0x53016b,_0xcb6f79[_0x7bb5('0x4a')]);var _0x37d194={'where':_0x53016b[_0x7bb5('0x4b')]};return db[_0x7bb5('0x36')]['count'](_0x37d194)['then'](function(_0x427516){_0x577303[_0x7bb5('0x2b')]=_0x427516;if(_0xcb6f79[_0x7bb5('0x3d')][_0x7bb5('0x4c')]){_0x53016b[_0x7bb5('0x4d')]=[{'all':!![]}];}return db[_0x7bb5('0x36')][_0x7bb5('0x4e')](_0x53016b);})[_0x7bb5('0x1b')](function(_0x49af2c){_0x577303[_0x7bb5('0x4f')]=_0x49af2c;return _0x577303;})[_0x7bb5('0x1b')](respondWithFilteredResult(_0xfd2161,_0x53016b))[_0x7bb5('0x50')](handleError(_0xfd2161,null));};exports[_0x7bb5('0x51')]=function(_0x81e590,_0x3da5ed){var _0x21e026={'raw':!![],'where':{'id':_0x81e590[_0x7bb5('0x52')]['id']}},_0x16f75c={};_0x16f75c[_0x7bb5('0x3b')]=_[_0x7bb5('0x3c')](db[_0x7bb5('0x36')][_0x7bb5('0x37')]);_0x16f75c[_0x7bb5('0x3d')]=_[_0x7bb5('0x3c')](_0x81e590[_0x7bb5('0x3d')]);_0x16f75c['filters']=_[_0x7bb5('0x3f')](_0x16f75c[_0x7bb5('0x3b')],_0x16f75c['query']);_0x21e026['attributes']=_['intersection'](_0x16f75c['model'],qs[_0x7bb5('0x41')](_0x81e590[_0x7bb5('0x3d')]['fields']));_0x21e026[_0x7bb5('0x40')]=_0x21e026['attributes']['length']?_0x21e026[_0x7bb5('0x40')]:_0x16f75c['model'];if(_0x81e590[_0x7bb5('0x3d')][_0x7bb5('0x4c')]){_0x21e026[_0x7bb5('0x4d')]=[{'all':!![]}];}_0x21e026=_['merge']({},_0x21e026,_0x81e590[_0x7bb5('0x4a')]);return db[_0x7bb5('0x36')][_0x7bb5('0x53')](_0x21e026)[_0x7bb5('0x1b')](handleEntityNotFound(_0x3da5ed,null))[_0x7bb5('0x1b')](respondWithResult(_0x3da5ed,null))[_0x7bb5('0x50')](handleError(_0x3da5ed,null));};exports['create']=function(_0x3b2cf5,_0x15dc03){return db[_0x7bb5('0x36')][_0x7bb5('0x54')](_0x3b2cf5[_0x7bb5('0x55')],{})[_0x7bb5('0x1b')](respondWithResult(_0x15dc03,0xc9))[_0x7bb5('0x50')](handleError(_0x15dc03,null));};exports['update']=function(_0x579320,_0x5dd008){if(_0x579320[_0x7bb5('0x55')]['id']){delete _0x579320[_0x7bb5('0x55')]['id'];}return db[_0x7bb5('0x36')][_0x7bb5('0x53')]({'where':{'id':_0x579320[_0x7bb5('0x52')]['id']}})[_0x7bb5('0x1b')](handleEntityNotFound(_0x5dd008,null))['then'](saveUpdates(_0x579320[_0x7bb5('0x55')],null))[_0x7bb5('0x1b')](respondWithResult(_0x5dd008,null))[_0x7bb5('0x50')](handleError(_0x5dd008,null));};exports[_0x7bb5('0x31')]=function(_0x2682a4,_0x4cee92){return db[_0x7bb5('0x36')][_0x7bb5('0x53')]({'where':{'id':_0x2682a4['params']['id']}})[_0x7bb5('0x1b')](handleEntityNotFound(_0x4cee92,null))[_0x7bb5('0x1b')](removeEntity(_0x4cee92,null))[_0x7bb5('0x50')](handleError(_0x4cee92,null));};exports[_0x7bb5('0x56')]=function(_0x197a67,_0x1e98eb){return db[_0x7bb5('0x36')][_0x7bb5('0x56')]()['then'](respondWithResult(_0x1e98eb,null))['catch'](handleError(_0x1e98eb,null));};var interaction_log=require(_0x7bb5('0x10'))(_0x7bb5('0x57'));exports[_0x7bb5('0x58')]=function(_0x173953,_0x93bdf4,_0x2da918){var _0x1f9816={'agent':{},'channel':_0x7bb5('0x59')};if(_0x173953[_0x7bb5('0x55')]['id']){delete _0x173953[_0x7bb5('0x55')]['id'];}_0x173953[_0x7bb5('0x55')][_0x7bb5('0x5a')]=!![];_0x173953[_0x7bb5('0x55')][_0x7bb5('0x5b')]=moment()[_0x7bb5('0x5c')](_0x7bb5('0x5d'));_0x173953['body'][_0x7bb5('0x5e')]=_0x173953['body'][_0x7bb5('0x5e')]||_0x173953[_0x7bb5('0x5f')]['id'];_0x1f9816[_0x7bb5('0x60')]['id']=_0x173953[_0x7bb5('0x55')][_0x7bb5('0x5e')];return db['OpenchannelMessage']['find']({'where':{'id':_0x173953[_0x7bb5('0x52')]['id'],'UserId':null}})[_0x7bb5('0x1b')](handleEntityNotFound(_0x93bdf4,null))[_0x7bb5('0x1b')](saveUpdates(_0x173953[_0x7bb5('0x55')],null))[_0x7bb5('0x1b')](function(_0xe1472d){if(_0xe1472d){_0x1f9816[_0x7bb5('0x22')]=_0xe1472d[_0x7bb5('0x61')]({'plain':!![]});return db['OpenchannelInteraction']['find']({'where':{'id':_0xe1472d[_0x7bb5('0x62')]}});}return null;})[_0x7bb5('0x1b')](handleEntityNotFound(_0x93bdf4,null))[_0x7bb5('0x1b')](function(_0x84d88c){if(_0x84d88c){return _0x84d88c[_0x7bb5('0x63')]({'UserId':_0x173953[_0x7bb5('0x55')][_0x7bb5('0x5e')],'read1stAt':_['isNil'](_0x84d88c[_0x7bb5('0x64')])?moment()[_0x7bb5('0x5c')](_0x7bb5('0x5d')):undefined});}return null;})['then'](function(_0x1fc6b1){if(_0x1fc6b1){_0x1f9816[_0x7bb5('0x65')]=_0x1fc6b1[_0x7bb5('0x61')]({'plain':!![]});interaction_log[_0x7bb5('0x23')](_0x7bb5('0x66'),_0x173953['user']['id'],_0x173953['user'][_0x7bb5('0x33')],_0x173953['user']['role'],_0x1f9816[_0x7bb5('0x65')]['id'],_0x173953[_0x7bb5('0x55')]?JSON['stringify'](_0x173953[_0x7bb5('0x55')]):_0x7bb5('0x67'));return respondWithRpcPromise(_0x7bb5('0x68'),_0x7bb5('0x69'),_0x1f9816);}return null;})['then'](function(_0x1c25ae){var _0x932f80=_0x7bb5('0x6a')+_0x1c25ae[_0x7bb5('0x22')][_0x7bb5('0x6b')];return db[_0x7bb5('0x6c')]['query'](_0x932f80,{'type':db[_0x7bb5('0x6d')]['QueryTypes'][_0x7bb5('0x6e')],'raw':!![]})[_0x7bb5('0x1b')](function(_0x4b1cdc){return _0x4b1cdc;});})[_0x7bb5('0x1b')](function(_0x1e434e){if(_0x1e434e){_0x1f9816[_0x7bb5('0x22')]['contact']=_0x1e434e[0x0];if(!_0x173953[_0x7bb5('0x55')][_0x7bb5('0x5e')])return;return db[_0x7bb5('0x6f')][_0x7bb5('0x53')]({'where':{'id':_0x173953[_0x7bb5('0x55')]['UserId'],'role':'agent'},'attributes':['id',_0x7bb5('0x33'),'fullname',_0x7bb5('0x70'),'internal'],'raw':!![]});}return null;})[_0x7bb5('0x1b')](function(_0x56974b){if(!_0x56974b)return null;_0x1f9816['message']['agent']=_0x56974b;return _0x1f9816;})[_0x7bb5('0x1b')](function(_0x5951eb){if(_0x5951eb){if(_0x173953['body'][_0x7bb5('0x71')]){_0x1f9816[_0x7bb5('0x22')][_0x7bb5('0x72')]=util[_0x7bb5('0x5c')](_0x7bb5('0x73'),_0x173953['user'][_0x7bb5('0x33')]);_0x1f9816['message'][_0x7bb5('0x74')]=_0x1f9816['channel'];_0x1f9816['message'][_0x7bb5('0x75')]=_0x1f9816[_0x7bb5('0x74')];_0x1f9816[_0x7bb5('0x22')][_0x7bb5('0x76')]=_0x7bb5('0x58');return respondWithRpcPromise('EventManager',_0x7bb5('0x77'),{'event':_0x7bb5('0x78'),'message':_0x1f9816[_0x7bb5('0x22')]},client9002)['then'](function(){return _0x1f9816;});}return _0x1f9816;}return null;})['then'](respondWithResult(_0x93bdf4,null))['catch'](handleError(_0x93bdf4,null));};var interaction_log=require(_0x7bb5('0x10'))('openchannel-interactions');exports[_0x7bb5('0x2f')]=function(_0x3b098,_0x318d02,_0xbaa821){var _0x57f7c8={'agent':{},'channel':_0x7bb5('0x59')};if(_0x3b098[_0x7bb5('0x55')]['id']){delete _0x3b098[_0x7bb5('0x55')]['id'];}_0x3b098[_0x7bb5('0x55')][_0x7bb5('0x5e')]=_0x3b098[_0x7bb5('0x55')][_0x7bb5('0x5e')]||_0x3b098[_0x7bb5('0x5f')]['id'];_0x57f7c8['agent']['id']=_0x3b098[_0x7bb5('0x55')][_0x7bb5('0x5e')];return db[_0x7bb5('0x36')]['find']({'where':{'id':_0x3b098[_0x7bb5('0x52')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x318d02,null))[_0x7bb5('0x1b')](function(_0x1260b2){if(_0x1260b2){_0x57f7c8[_0x7bb5('0x22')]=_0x1260b2[_0x7bb5('0x61')]({'plain':!![]});return db[_0x7bb5('0x79')][_0x7bb5('0x53')]({'where':{'id':_0x1260b2['OpenchannelInteractionId']}});}return null;})['then'](handleEntityNotFound(_0x318d02,null))[_0x7bb5('0x1b')](function(_0x204ffa){if(_0x204ffa){_0x57f7c8['interaction']=_0x204ffa['get']({'plain':!![]});interaction_log[_0x7bb5('0x23')](_0x7bb5('0x7a'),_0x3b098[_0x7bb5('0x5f')]['id'],_0x3b098['user'][_0x7bb5('0x33')],_0x3b098[_0x7bb5('0x5f')][_0x7bb5('0x7b')],_0x57f7c8[_0x7bb5('0x65')]['id'],_0x3b098[_0x7bb5('0x55')]?JSON[_0x7bb5('0x7c')](_0x3b098[_0x7bb5('0x55')]):_0x7bb5('0x67'));return respondWithRpcPromise(_0x7bb5('0x7d'),'rejectMessage',_0x57f7c8);}return null;})['then'](function(_0x2ad397){var _0xabc66e=_0x7bb5('0x6a')+_0x2ad397['message'][_0x7bb5('0x6b')];return db[_0x7bb5('0x6c')][_0x7bb5('0x3d')](_0xabc66e,{'type':db['Sequelize']['QueryTypes']['SELECT'],'raw':!![]})[_0x7bb5('0x1b')](function(_0x3fd424){return _0x3fd424;});})[_0x7bb5('0x1b')](function(_0x2a9fe3){if(_0x2a9fe3){_0x57f7c8[_0x7bb5('0x22')][_0x7bb5('0x7e')]=_0x2a9fe3[0x0];if(!_0x3b098[_0x7bb5('0x55')][_0x7bb5('0x5e')])return;return db[_0x7bb5('0x6f')]['find']({'where':{'id':_0x3b098[_0x7bb5('0x55')][_0x7bb5('0x5e')],'role':_0x7bb5('0x60')},'attributes':['id',_0x7bb5('0x33'),_0x7bb5('0x7f'),_0x7bb5('0x70'),_0x7bb5('0x80')],'raw':!![]});}return null;})['then'](function(_0x9ed2ab){if(!_0x9ed2ab)return null;_0x57f7c8[_0x7bb5('0x22')][_0x7bb5('0x60')]=_0x9ed2ab;return _0x57f7c8;})[_0x7bb5('0x1b')](function(_0x1576fa){if(_0x1576fa){_0x1576fa[_0x7bb5('0x22')][_0x7bb5('0x72')]=util[_0x7bb5('0x5c')](_0x7bb5('0x73'),_0x3b098[_0x7bb5('0x5f')]['name']);_0x1576fa[_0x7bb5('0x22')][_0x7bb5('0x74')]=_0x57f7c8[_0x7bb5('0x74')];_0x1576fa['message'][_0x7bb5('0x75')]=_0x57f7c8[_0x7bb5('0x74')];_0x1576fa['message']['event']=_0x7bb5('0x2f');respondWithRpcPromise(_0x7bb5('0x77'),'EventManager',{'event':_0x7bb5('0x81'),'message':_0x1576fa[_0x7bb5('0x22')]},client9002);return _0x57f7c8;}return null;})[_0x7bb5('0x1b')](respondWithResult(_0x318d02,null))[_0x7bb5('0x50')](handleError(_0x318d02,null));}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.events.js b/server/api/openchannelMessage/openchannelMessage.events.js index 7056772..6512f42 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 _0xf001=['setMaxListeners','save','update','remove','emit','hook','exports','../../mysqldb'];(function(_0x19eb64,_0x46e96c){var _0x67e6b3=function(_0xf8f57d){while(--_0xf8f57d){_0x19eb64['push'](_0x19eb64['shift']());}};_0x67e6b3(++_0x46e96c);}(_0xf001,0xff));var _0x1f00=function(_0x443e72,_0x50737f){_0x443e72=_0x443e72-0x0;var _0x87c5e2=_0xf001[_0x443e72];return _0x87c5e2;};'use strict';var EventEmitter=require('events');var OpenchannelMessage=require(_0x1f00('0x0'))['db']['OpenchannelMessage'];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0x1f00('0x1')](0x0);var events={'afterCreate':_0x1f00('0x2'),'afterUpdate':_0x1f00('0x3'),'afterDestroy':_0x1f00('0x4')};function emitEvent(_0x50cb29){return function(_0x43e375,_0x4d9549,_0x3021c4){OpenchannelMessageEvents[_0x1f00('0x5')](_0x50cb29+':'+_0x43e375['id'],_0x43e375);OpenchannelMessageEvents[_0x1f00('0x5')](_0x50cb29,_0x43e375);_0x3021c4(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelMessage[_0x1f00('0x6')](e,emitEvent(event));}}module[_0x1f00('0x7')]=OpenchannelMessageEvents; \ No newline at end of file +var _0x9384=['hasOwnProperty','exports','../../mysqldb','OpenchannelMessage','save','update','remove','emit'];(function(_0x5cc3d4,_0x2a352a){var _0x1a7344=function(_0x5e81f3){while(--_0x5e81f3){_0x5cc3d4['push'](_0x5cc3d4['shift']());}};_0x1a7344(++_0x2a352a);}(_0x9384,0xea));var _0x4938=function(_0x7e2eb0,_0x17cd58){_0x7e2eb0=_0x7e2eb0-0x0;var _0xd92de4=_0x9384[_0x7e2eb0];return _0xd92de4;};'use strict';var EventEmitter=require('events');var OpenchannelMessage=require(_0x4938('0x0'))['db'][_0x4938('0x1')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x4938('0x2'),'afterUpdate':_0x4938('0x3'),'afterDestroy':_0x4938('0x4')};function emitEvent(_0x37716b){return function(_0x3c9635,_0x40644f,_0x3b5ca4){OpenchannelMessageEvents[_0x4938('0x5')](_0x37716b+':'+_0x3c9635['id'],_0x3c9635);OpenchannelMessageEvents[_0x4938('0x5')](_0x37716b,_0x3c9635);_0x3b5ca4(null);};}for(var e in events){if(events[_0x4938('0x6')](e)){var event=events[e];OpenchannelMessage['hook'](e,emitEvent(event));}}module[_0x4938('0x7')]=OpenchannelMessageEvents; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.model.js b/server/api/openchannelMessage/openchannelMessage.model.js index 7ef61f9..f9db9ff 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 _0x5c00=['afterCreate','format','Forwarding\x20message\x20%d\x20to\x20%s','replyUri','length','omit','POST','GET','info','OpenchannelMessage,\x20%s,\x20%s','Message\x20%d\x20forwarded\x20to\x20%s','threadId','Interaction','OpenchannelInteraction','catch','inspect','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','request-promise','path','rimraf','../../config/environment','exports','define','openchannel_messages','fti_openchannel_messages','body','models','toLowerCase','out','secret','UserId','findOne','OpenchannelInteractionId','then','update','createdAt','direction','error','CmContact','describe','OpenchannelAccount','find','OpenchannelAccountId','Interactions','Contact','keys','get'];(function(_0x4a0086,_0x5b2ad3){var _0x3857f6=function(_0x50186c){while(--_0x50186c){_0x4a0086['push'](_0x4a0086['shift']());}};_0x3857f6(++_0x5b2ad3);}(_0x5c00,0x17e));var _0x05c0=function(_0x500d35,_0x3f5d69){_0x500d35=_0x500d35-0x0;var _0x383af4=_0x5c00[_0x500d35];return _0x383af4;};'use strict';var _=require(_0x05c0('0x0'));var util=require(_0x05c0('0x1'));var logger=require(_0x05c0('0x2'))('api');var moment=require(_0x05c0('0x3'));var BPromise=require('bluebird');var rp=require(_0x05c0('0x4'));var fs=require('fs');var path=require(_0x05c0('0x5'));var rimraf=require(_0x05c0('0x6'));var config=require(_0x05c0('0x7'));var attributes=require('./openchannelMessage.attributes');module[_0x05c0('0x8')]=function(_0x3521fe,_0x261624){return _0x3521fe[_0x05c0('0x9')]('OpenchannelMessage',attributes,{'tableName':_0x05c0('0xa'),'paranoid':![],'indexes':[{'name':_0x05c0('0xb'),'fields':[_0x05c0('0xc')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x32a795,_0x32cdfa,_0x996d6b){var _0x321c09=_0x3521fe[_0x05c0('0xd')];var _0x1edbb=_0x32a795['get']({'plain':!![]});if(_0x1edbb['direction'][_0x05c0('0xe')]()==='in'||_0x1edbb['direction'][_0x05c0('0xe')]()===_0x05c0('0xf')&&!_0x1edbb[_0x05c0('0x10')]&&!_['isNil'](_0x1edbb[_0x05c0('0x11')])){_0x321c09['OpenchannelInteraction'][_0x05c0('0x12')]({'where':{'id':_0x1edbb[_0x05c0('0x13')]}})[_0x05c0('0x14')](function(_0x12deeb){if(_0x12deeb){_0x12deeb[_0x05c0('0x15')]({'lastMsgAt':_0x1edbb[_0x05c0('0x16')],'lastMsgDirection':_0x1edbb[_0x05c0('0x17')][_0x05c0('0xe')]()});}})['catch'](function(_0x238e25){console[_0x05c0('0x18')](_0x238e25);});}if(_0x1edbb[_0x05c0('0x17')]===_0x05c0('0xf')&&!_0x1edbb[_0x05c0('0x10')]){var _0x40153e;_0x321c09[_0x05c0('0x19')][_0x05c0('0x1a')]()[_0x05c0('0x14')](function(_0x521cbd){return _0x321c09[_0x05c0('0x1b')][_0x05c0('0x1c')]({'where':{'id':_0x1edbb[_0x05c0('0x1d')]},'include':[{'model':_0x321c09['OpenchannelInteraction'],'as':_0x05c0('0x1e'),'where':{'id':_0x1edbb[_0x05c0('0x13')]},'limit':0x1,'include':[{'model':_0x321c09[_0x05c0('0x19')],'as':_0x05c0('0x1f'),'attributes':_[_0x05c0('0x20')](_0x521cbd)}]}]});})['then'](function(_0x407c1f){_0x40153e=_0x407c1f[_0x05c0('0x21')]({'plain':!![]});if(_0x40153e&&_0x40153e['replyUri']){logger['info']('OpenchannelMessage,\x20%s,\x20%s',_0x05c0('0x22'),util[_0x05c0('0x23')](_0x05c0('0x24'),_0x1edbb['id'],_0x40153e[_0x05c0('0x25')]));if(_0x40153e[_0x05c0('0x1e')]&&_0x40153e[_0x05c0('0x1e')][_0x05c0('0x26')]){_0x1edbb['Interaction']=_[_0x05c0('0x27')](_0x40153e[_0x05c0('0x1e')][0x0],'Contact');_0x1edbb['Contact']=_0x40153e['Interactions'][0x0]['Contact'];}var _0x32cdfa={'method':_0x05c0('0x28'),'uri':encodeURI(_0x40153e[_0x05c0('0x25')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x32cdfa['method']){case _0x05c0('0x29'):_0x32cdfa['qs']=_0x1edbb;break;case _0x05c0('0x28'):_0x32cdfa[_0x05c0('0xc')]=_0x1edbb;break;}return rp(_0x32cdfa)[_0x05c0('0x14')](function(_0x58769a){logger[_0x05c0('0x2a')](_0x05c0('0x2b'),_0x05c0('0x22'),util[_0x05c0('0x23')](_0x05c0('0x2c'),_0x1edbb['id'],_0x40153e[_0x05c0('0x25')]));if(_0x58769a['body']['threadId']&&_0x58769a[_0x05c0('0xc')][_0x05c0('0x2d')]!=_0x1edbb[_0x05c0('0x2e')][_0x05c0('0x2d')]){return _0x321c09[_0x05c0('0x2f')][_0x05c0('0x15')]({'threadId':_0x58769a[_0x05c0('0xc')][_0x05c0('0x2d')]},{'logging':!![],'where':{'id':_0x1edbb[_0x05c0('0x2e')]['id']}});}else{return;}})[_0x05c0('0x14')](function(){return _0x32a795[_0x05c0('0x15')]({'read':!![]});})[_0x05c0('0x30')](function(_0x50f03d){logger['error'](_0x05c0('0x2b'),_0x05c0('0x22'),util[_0x05c0('0x31')](_0x50f03d,{'showHidden':![],'depth':null}));_0x996d6b();});}else{_0x996d6b();}})['finally'](function(){_0x996d6b();});}else{_0x996d6b();}}},'charset':_0x05c0('0x32'),'collate':_0x05c0('0x33')});}; \ No newline at end of file +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(_0x46e363,_0x45d7e2){var _0x3fb059=function(_0x5e6274){while(--_0x5e6274){_0x46e363['push'](_0x46e363['shift']());}};_0x3fb059(++_0x45d7e2);}(_0x0972,0x64));var _0x2097=function(_0x5ad3b1,_0x10a697){_0x5ad3b1=_0x5ad3b1-0x0;var _0x42065d=_0x0972[_0x5ad3b1];return _0x42065d;};'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 diff --git a/server/api/openchannelMessage/openchannelMessage.rpc.js b/server/api/openchannelMessage/openchannelMessage.rpc.js index 5d90bfd..d6acf52 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(_0x1823b2,_0x30d23a){var _0x3ae323=function(_0x5d6784){while(--_0x5d6784){_0x1823b2['push'](_0x1823b2['shift']());}};_0x3ae323(++_0x30d23a);}(_0x5f2f,0x73));var _0xf5f2=function(_0x4a07b4,_0xadef73){_0x4a07b4=_0x4a07b4-0x0;var _0x3ed0ed=_0x5f2f[_0x4a07b4];return _0x3ed0ed;};'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 _0x5f66=['stringify','error','code','message','info','result','OpenchannelMessage','create','body','options','raw','CreateOpenchannelMessage','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','defaults','redis','localhost','socket.io-emitter','./openchannelMessage.socket','then','OpenchannelMessage,\x20%s,\x20%s','debug','request\x20sent'];(function(_0x5fef56,_0x384034){var _0xe49065=function(_0x1949dc){while(--_0x1949dc){_0x5fef56['push'](_0x5fef56['shift']());}};_0xe49065(++_0x384034);}(_0x5f66,0x1a0));var _0x65f6=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x5f66[_0x502c7d];return _0x30b7ed;};'use strict';var _=require('lodash');var util=require(_0x65f6('0x0'));var moment=require('moment');var BPromise=require(_0x65f6('0x1'));var rs=require(_0x65f6('0x2'));var fs=require('fs');var Redis=require(_0x65f6('0x3'));var db=require(_0x65f6('0x4'))['db'];var utils=require(_0x65f6('0x5'));var logger=require('../../config/logger')(_0x65f6('0x6'));var config=require('../../config/environment');var jayson=require(_0x65f6('0x7'));var client=jayson[_0x65f6('0x8')]['http']({'port':0x232a});config['redis']=_[_0x65f6('0x9')](config[_0x65f6('0xa')],{'host':_0x65f6('0xb'),'port':0x18eb});var socket=require(_0x65f6('0xc'))(new Redis(config[_0x65f6('0xa')]));require(_0x65f6('0xd'))['register'](socket);function respondWithRpcPromise(_0x5123ee,_0x18fea1,_0x2f6d5b){return new BPromise(function(_0x264647,_0x25c416){return client['request'](_0x5123ee,_0x2f6d5b)[_0x65f6('0xe')](function(_0x571436){logger['info'](_0x65f6('0xf'),_0x18fea1,'request\x20sent');logger[_0x65f6('0x10')]('OpenchannelMessage,\x20%s,\x20%s,\x20%s',_0x18fea1,_0x65f6('0x11'),JSON[_0x65f6('0x12')](_0x571436));if(_0x571436[_0x65f6('0x13')]){if(_0x571436[_0x65f6('0x13')][_0x65f6('0x14')]===0x1f4){logger[_0x65f6('0x13')](_0x65f6('0xf'),_0x18fea1,_0x571436[_0x65f6('0x13')][_0x65f6('0x15')]);return _0x25c416(_0x571436[_0x65f6('0x13')]['message']);}logger[_0x65f6('0x13')]('OpenchannelMessage,\x20%s,\x20%s',_0x18fea1,_0x571436['error'][_0x65f6('0x15')]);return _0x264647(_0x571436[_0x65f6('0x13')][_0x65f6('0x15')]);}else{logger[_0x65f6('0x16')](_0x65f6('0xf'),_0x18fea1,_0x65f6('0x11'));_0x264647(_0x571436[_0x65f6('0x17')][_0x65f6('0x15')]);}})['catch'](function(_0x4d79a1){logger[_0x65f6('0x13')]('OpenchannelMessage,\x20%s,\x20%s',_0x18fea1,_0x4d79a1);_0x25c416(_0x4d79a1);});});}exports['CreateOpenchannelMessage']=function(_0x5c5b91){var _0x365159=this;return new Promise(function(_0x21ea88,_0x5114a4){return db[_0x65f6('0x18')][_0x65f6('0x19')](_0x5c5b91[_0x65f6('0x1a')],{'raw':_0x5c5b91[_0x65f6('0x1b')]?_0x5c5b91[_0x65f6('0x1b')][_0x65f6('0x1c')]===undefined?!![]:![]:!![]})['then'](function(_0x197a49){logger['info']('CreateOpenchannelMessage',_0x5c5b91);logger[_0x65f6('0x10')](_0x65f6('0x1d'),_0x5c5b91,JSON['stringify'](_0x197a49));_0x21ea88(_0x197a49);})[_0x65f6('0x1e')](function(_0x471a33){logger[_0x65f6('0x13')](_0x65f6('0x1d'),_0x471a33['message'],_0x5c5b91);_0x5114a4(_0x365159[_0x65f6('0x13')](0x1f4,_0x471a33[_0x65f6('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.socket.js b/server/api/openchannelMessage/openchannelMessage.socket.js index ed52fc8..3db9054 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 _0xbff5=['register','length','openchannelMessage:','./openchannelMessage.events','save','remove','update'];(function(_0x88cd7b,_0x4c884c){var _0x56fcc8=function(_0x513b3d){while(--_0x513b3d){_0x88cd7b['push'](_0x88cd7b['shift']());}};_0x56fcc8(++_0x4c884c);}(_0xbff5,0x1bc));var _0x5bff=function(_0x5c95bd,_0x2bb6d3){_0x5c95bd=_0x5c95bd-0x0;var _0x155b12=_0xbff5[_0x5c95bd];return _0x155b12;};'use strict';var OpenchannelMessageEvents=require(_0x5bff('0x0'));var events=[_0x5bff('0x1'),_0x5bff('0x2'),_0x5bff('0x3')];function createListener(_0x41c38b,_0x43a41b){return function(_0x3bd90c){_0x43a41b['emit'](_0x41c38b,_0x3bd90c);};}function removeListener(_0x3868ae,_0x486083){return function(){OpenchannelMessageEvents['removeListener'](_0x3868ae,_0x486083);};}exports[_0x5bff('0x4')]=function(_0x1d8650){for(var _0x151add=0x0,_0xa54c57=events[_0x5bff('0x5')];_0x151add<_0xa54c57;_0x151add++){var _0xd4b9dc=events[_0x151add];var _0x1acb49=createListener(_0x5bff('0x6')+_0xd4b9dc,_0x1d8650);OpenchannelMessageEvents['on'](_0xd4b9dc,_0x1acb49);}}; \ No newline at end of file +var _0x8c46=['emit','removeListener','register','length','openchannelMessage:','./openchannelMessage.events','update'];(function(_0x46e363,_0x45d7e2){var _0x3fb059=function(_0x5e6274){while(--_0x5e6274){_0x46e363['push'](_0x46e363['shift']());}};_0x3fb059(++_0x45d7e2);}(_0x8c46,0x171));var _0x68c4=function(_0x4d5c11,_0x482ae0){_0x4d5c11=_0x4d5c11-0x0;var _0x1ce899=_0x8c46[_0x4d5c11];return _0x1ce899;};'use strict';var OpenchannelMessageEvents=require(_0x68c4('0x0'));var events=['save','remove',_0x68c4('0x1')];function createListener(_0x56779a,_0x5c3af6){return function(_0x667c59){_0x5c3af6[_0x68c4('0x2')](_0x56779a,_0x667c59);};}function removeListener(_0x1837ee,_0x1e3662){return function(){OpenchannelMessageEvents[_0x68c4('0x3')](_0x1837ee,_0x1e3662);};}exports[_0x68c4('0x4')]=function(_0x40ce21){for(var _0x1516cf=0x0,_0x3da9c3=events[_0x68c4('0x5')];_0x1516cf<_0x3da9c3;_0x1516cf++){var _0x5e57ce=events[_0x1516cf];var _0x1754d7=createListener(_0x68c4('0x6')+_0x5e57ce,_0x40ce21);OpenchannelMessageEvents['on'](_0x5e57ce,_0x1754d7);}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/index.js b/server/api/openchannelQueue/index.js index a471fe4..edd4ac4 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 _0xe771=['path','express','fs-extra','../../components/interaction/service','../../config/environment','./openchannelQueue.controller','get','index','/describe','isAuthenticated','describe','/:id','show','getTeams','/:id/users','getAgents','post','/:id/teams','addTeams','addAgents','put','update','delete','destroy','removeTeams','exports','multer','util'];(function(_0x4baae2,_0x487ab6){var _0x1a2285=function(_0x1cea47){while(--_0x1cea47){_0x4baae2['push'](_0x4baae2['shift']());}};_0x1a2285(++_0x487ab6);}(_0xe771,0x132));var _0x1e77=function(_0x4d8ed9,_0x2ae284){_0x4d8ed9=_0x4d8ed9-0x0;var _0x1e2140=_0xe771[_0x4d8ed9];return _0x1e2140;};'use strict';var multer=require(_0x1e77('0x0'));var util=require(_0x1e77('0x1'));var path=require(_0x1e77('0x2'));var timeout=require('connect-timeout');var express=require(_0x1e77('0x3'));var router=express['Router']();var fs_extra=require(_0x1e77('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x1e77('0x5'));var config=require(_0x1e77('0x6'));var controller=require(_0x1e77('0x7'));router[_0x1e77('0x8')]('/',auth['isAuthenticated'](),controller[_0x1e77('0x9')]);router['get'](_0x1e77('0xa'),auth[_0x1e77('0xb')](),controller[_0x1e77('0xc')]);router[_0x1e77('0x8')](_0x1e77('0xd'),auth[_0x1e77('0xb')](),controller[_0x1e77('0xe')]);router['get']('/:id/members',auth['isAuthenticated'](),controller['getMembers']);router[_0x1e77('0x8')]('/:id/teams',auth[_0x1e77('0xb')](),controller[_0x1e77('0xf')]);router[_0x1e77('0x8')](_0x1e77('0x10'),auth[_0x1e77('0xb')](),controller[_0x1e77('0x11')]);router[_0x1e77('0x12')]('/',auth['isAuthenticated'](),controller['create']);router[_0x1e77('0x12')](_0x1e77('0x13'),auth['isAuthenticated'](),controller[_0x1e77('0x14')]);router['post'](_0x1e77('0x10'),auth[_0x1e77('0xb')](),controller[_0x1e77('0x15')]);router[_0x1e77('0x16')](_0x1e77('0xd'),auth[_0x1e77('0xb')](),controller[_0x1e77('0x17')]);router[_0x1e77('0x18')]('/:id',auth['isAuthenticated'](),controller[_0x1e77('0x19')]);router[_0x1e77('0x18')](_0x1e77('0x13'),auth[_0x1e77('0xb')](),controller[_0x1e77('0x1a')]);router[_0x1e77('0x18')](_0x1e77('0x10'),auth[_0x1e77('0xb')](),controller['removeAgents']);module[_0x1e77('0x1b')]=router; \ No newline at end of file +var _0xfeab=['/describe','describe','/:id','/:id/members','getMembers','getAgents','post','create','/:id/teams','/:id/users','addAgents','put','update','delete','destroy','removeTeams','removeAgents','exports','multer','util','path','connect-timeout','express','fs-extra','../../config/environment','./openchannelQueue.controller','isAuthenticated','get'];(function(_0x23607f,_0x51db51){var _0x5a5be0=function(_0x22223e){while(--_0x22223e){_0x23607f['push'](_0x23607f['shift']());}};_0x5a5be0(++_0x51db51);}(_0xfeab,0x9e));var _0xbfea=function(_0x143f29,_0x16c93d){_0x143f29=_0x143f29-0x0;var _0x59b164=_0xfeab[_0x143f29];return _0x59b164;};'use strict';var multer=require(_0xbfea('0x0'));var util=require(_0xbfea('0x1'));var path=require(_0xbfea('0x2'));var timeout=require(_0xbfea('0x3'));var express=require(_0xbfea('0x4'));var router=express['Router']();var fs_extra=require(_0xbfea('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xbfea('0x6'));var controller=require(_0xbfea('0x7'));router['get']('/',auth[_0xbfea('0x8')](),controller['index']);router[_0xbfea('0x9')](_0xbfea('0xa'),auth[_0xbfea('0x8')](),controller[_0xbfea('0xb')]);router[_0xbfea('0x9')](_0xbfea('0xc'),auth['isAuthenticated'](),controller['show']);router[_0xbfea('0x9')](_0xbfea('0xd'),auth[_0xbfea('0x8')](),controller[_0xbfea('0xe')]);router['get']('/:id/teams',auth[_0xbfea('0x8')](),controller['getTeams']);router[_0xbfea('0x9')]('/:id/users',auth[_0xbfea('0x8')](),controller[_0xbfea('0xf')]);router[_0xbfea('0x10')]('/',auth[_0xbfea('0x8')](),controller[_0xbfea('0x11')]);router[_0xbfea('0x10')](_0xbfea('0x12'),auth[_0xbfea('0x8')](),controller['addTeams']);router[_0xbfea('0x10')](_0xbfea('0x13'),auth[_0xbfea('0x8')](),controller[_0xbfea('0x14')]);router[_0xbfea('0x15')](_0xbfea('0xc'),auth[_0xbfea('0x8')](),controller[_0xbfea('0x16')]);router[_0xbfea('0x17')](_0xbfea('0xc'),auth[_0xbfea('0x8')](),controller[_0xbfea('0x18')]);router[_0xbfea('0x17')]('/:id/teams',auth[_0xbfea('0x8')](),controller[_0xbfea('0x19')]);router[_0xbfea('0x17')](_0xbfea('0x13'),auth[_0xbfea('0x8')](),controller[_0xbfea('0x1a')]);module[_0xbfea('0x1b')]=router; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.attributes.js b/server/api/openchannelQueue/openchannelQueue.attributes.js index 096fb8f..1e30edf 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 _0x6f51=['STRING','ENUM','rrmemory','beepall','sequelize'];(function(_0x18c3ee,_0x333862){var _0x4ef8b1=function(_0x6f405d){while(--_0x6f405d){_0x18c3ee['push'](_0x18c3ee['shift']());}};_0x4ef8b1(++_0x333862);}(_0x6f51,0x13f));var _0x16f5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6f51[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x16f5('0x0'));module['exports']={'name':{'type':Sequelize[_0x16f5('0x1')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x16f5('0x1')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x16f5('0x2')](_0x16f5('0x3'),_0x16f5('0x4'),'roundrobin')}}; \ No newline at end of file +var _0xe272=['ENUM','rrmemory','roundrobin','sequelize','exports','STRING','name'];(function(_0x9aada2,_0xd2d349){var _0x196dff=function(_0x5ad061){while(--_0x5ad061){_0x9aada2['push'](_0x9aada2['shift']());}};_0x196dff(++_0xd2d349);}(_0xe272,0x1d8));var _0x2e27=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0xe272[_0x2b4411];return _0x8e41ef;};'use strict';var Sequelize=require(_0x2e27('0x0'));module[_0x2e27('0x1')]={'name':{'type':Sequelize[_0x2e27('0x2')],'unique':_0x2e27('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x2e27('0x2')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x2e27('0x4')](_0x2e27('0x5'),'beepall',_0x2e27('0x6'))}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.controller.js b/server/api/openchannelQueue/openchannelQueue.controller.js index b3a0548..ce6866b 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 _0xead9=['findOrCreate','forEach','emit','removeTeams','User','select','from','team_has_openchannel_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','OpenchannelQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','QueryTypes','SELECT','includes','all','union','compact','value','transaction','isEmpty','removeAgents','addAgents','omit','spread','userOpenchannelQueue:save','isArray','userOpenchannelQueue:remove','getAgents','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./openchannelQueue.socket','register','sendStatus','end','status','offset','limit','undefined','count','set','json','apply','reject','update','then','OpenchannelQueues','destroy','error','stack','send','index','map','OpenchannelQueue','rawAttributes','fieldName','type','key','name','query','keys','filters','intersection','model','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','rows','catch','show','params','length','find','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','findOne','UserOpenchannelQueue','findAndCountAll','UserId','openchannelPause','updatedAt','createdAt','format','SIP','getTeams','Team','options','addTeams','ids','findAll','Agents','online','voicePause','flatMap','sequelize','each'];(function(_0x2f5ac5,_0x1ee939){var _0x37c9a8=function(_0x15031f){while(--_0x15031f){_0x2f5ac5['push'](_0x2f5ac5['shift']());}};_0x37c9a8(++_0x1ee939);}(_0xead9,0x142));var _0x9ead=function(_0x1c2cb1,_0x4d3bbb){_0x1c2cb1=_0x1c2cb1-0x0;var _0x41d465=_0xead9[_0x1c2cb1];return _0x41d465;};'use strict';var emlformat=require(_0x9ead('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x9ead('0x1'));var jsonpatch=require(_0x9ead('0x2'));var rp=require(_0x9ead('0x3'));var moment=require(_0x9ead('0x4'));var BPromise=require(_0x9ead('0x5'));var Mustache=require(_0x9ead('0x6'));var util=require(_0x9ead('0x7'));var path=require(_0x9ead('0x8'));var sox=require(_0x9ead('0x9'));var csv=require(_0x9ead('0xa'));var ejs=require(_0x9ead('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x9ead('0xc'));var squel=require(_0x9ead('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x9ead('0xe'));var toCsv=require(_0x9ead('0xa'));var querystring=require(_0x9ead('0xf'));var Papa=require(_0x9ead('0x10'));var Redis=require(_0x9ead('0x11'));var authService=require(_0x9ead('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x9ead('0x13'));var hardwareService=require(_0x9ead('0x14'));var logger=require(_0x9ead('0x15'))(_0x9ead('0x16'));var utils=require('../../config/utils');var config=require(_0x9ead('0x17'));var licenseUtil=require(_0x9ead('0x18'));var db=require('../../mysqldb')['db'];config[_0x9ead('0x19')]=_[_0x9ead('0x1a')](config[_0x9ead('0x19')],{'host':_0x9ead('0x1b'),'port':0x18eb});var socket=require(_0x9ead('0x1c'))(new Redis(config[_0x9ead('0x19')]));require(_0x9ead('0x1d'))[_0x9ead('0x1e')](socket);function respondWithStatusCode(_0x51623c,_0x249e8e){_0x249e8e=_0x249e8e||0xcc;return function(_0x42c658){if(_0x42c658){return _0x51623c[_0x9ead('0x1f')](_0x249e8e);}return _0x51623c['status'](_0x249e8e)[_0x9ead('0x20')]();};}function respondWithResult(_0x118708,_0x21db3e){_0x21db3e=_0x21db3e||0xc8;return function(_0x58f64d){if(_0x58f64d){return _0x118708[_0x9ead('0x21')](_0x21db3e)['json'](_0x58f64d);}};}function respondWithFilteredResult(_0x2adcc6,_0x3f5500){return function(_0x2ed98f){if(_0x2ed98f){var _0x2cd987=typeof _0x3f5500[_0x9ead('0x22')]==='undefined'&&typeof _0x3f5500[_0x9ead('0x23')]===_0x9ead('0x24');var _0x44c5e9=_0x2ed98f[_0x9ead('0x25')];var _0x2b664b=_0x2cd987?0x0:_0x3f5500['offset'];var _0x247332=_0x2cd987?_0x2ed98f[_0x9ead('0x25')]:_0x3f5500[_0x9ead('0x22')]+_0x3f5500['limit'];var _0x5bc147;if(_0x247332>=_0x44c5e9){_0x247332=_0x44c5e9;_0x5bc147=0xc8;}else{_0x5bc147=0xce;}_0x2adcc6[_0x9ead('0x21')](_0x5bc147);return _0x2adcc6[_0x9ead('0x26')]('Content-Range',_0x2b664b+'-'+_0x247332+'/'+_0x44c5e9)[_0x9ead('0x27')](_0x2ed98f);}return null;};}function patchUpdates(_0x37f13d){return function(_0x2479d5){try{jsonpatch[_0x9ead('0x28')](_0x2479d5,_0x37f13d,!![]);}catch(_0x3d83b3){return BPromise[_0x9ead('0x29')](_0x3d83b3);}return _0x2479d5['save']();};}function saveUpdates(_0x5b8970,_0x14be8d){return function(_0x3df001){if(_0x3df001){return _0x3df001[_0x9ead('0x2a')](_0x5b8970)['then'](function(_0x49beb9){return _0x49beb9;});}return null;};}function removeEntity(_0x41b070,_0x2c43e5){return function(_0xc16f41){if(_0xc16f41){return _0xc16f41['destroy']()[_0x9ead('0x2b')](function(){var _0x1568f5=_0xc16f41['get']({'plain':!![]});var _0x137ed6=_0x9ead('0x2c');return db['UserProfileResource'][_0x9ead('0x2d')]({'where':{'type':_0x137ed6,'resourceId':_0x1568f5['id']}})[_0x9ead('0x2b')](function(){return _0xc16f41;});})[_0x9ead('0x2b')](function(){_0x41b070['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x205844,_0x7ae2ef){return function(_0xf1573e){if(!_0xf1573e){_0x205844[_0x9ead('0x1f')](0x194);}return _0xf1573e;};}function handleError(_0x338ef5,_0x13e2f5){_0x13e2f5=_0x13e2f5||0x1f4;return function(_0x5a1025){logger[_0x9ead('0x2e')](_0x5a1025[_0x9ead('0x2f')]);if(_0x5a1025['name']){delete _0x5a1025['name'];}_0x338ef5['status'](_0x13e2f5)[_0x9ead('0x30')](_0x5a1025);};}exports[_0x9ead('0x31')]=function(_0x39e434,_0x494ec7){var _0x17f5a1={},_0x18057f={},_0x22a736={'count':0x0,'rows':[]};var _0x5204db=_[_0x9ead('0x32')](db[_0x9ead('0x33')][_0x9ead('0x34')],function(_0x183f89){return{'name':_0x183f89[_0x9ead('0x35')],'type':_0x183f89[_0x9ead('0x36')][_0x9ead('0x37')]};});_0x18057f['model']=_[_0x9ead('0x32')](_0x5204db,_0x9ead('0x38'));_0x18057f[_0x9ead('0x39')]=_[_0x9ead('0x3a')](_0x39e434['query']);_0x18057f[_0x9ead('0x3b')]=_[_0x9ead('0x3c')](_0x18057f[_0x9ead('0x3d')],_0x18057f[_0x9ead('0x39')]);_0x17f5a1['attributes']=_[_0x9ead('0x3c')](_0x18057f[_0x9ead('0x3d')],qs['fields'](_0x39e434[_0x9ead('0x39')][_0x9ead('0x3e')]));_0x17f5a1[_0x9ead('0x3f')]=_0x17f5a1[_0x9ead('0x3f')]['length']?_0x17f5a1[_0x9ead('0x3f')]:_0x18057f['model'];if(!_0x39e434[_0x9ead('0x39')][_0x9ead('0x40')](_0x9ead('0x41'))){_0x17f5a1[_0x9ead('0x23')]=qs[_0x9ead('0x23')](_0x39e434['query']['limit']);_0x17f5a1[_0x9ead('0x22')]=qs['offset'](_0x39e434['query'][_0x9ead('0x22')]);}_0x17f5a1[_0x9ead('0x42')]=qs[_0x9ead('0x43')](_0x39e434[_0x9ead('0x39')][_0x9ead('0x43')]);_0x17f5a1[_0x9ead('0x44')]=qs[_0x9ead('0x3b')](_[_0x9ead('0x45')](_0x39e434['query'],_0x18057f[_0x9ead('0x3b')]),_0x5204db);if(_0x39e434[_0x9ead('0x39')][_0x9ead('0x46')]){_0x17f5a1[_0x9ead('0x44')]=_[_0x9ead('0x47')](_0x17f5a1[_0x9ead('0x44')],{'$or':_[_0x9ead('0x32')](_0x5204db,function(_0x55f9e6){if(_0x55f9e6[_0x9ead('0x36')]!==_0x9ead('0x48')){var _0x4f20fa={};_0x4f20fa[_0x55f9e6[_0x9ead('0x38')]]={'$like':'%'+_0x39e434[_0x9ead('0x39')][_0x9ead('0x46')]+'%'};return _0x4f20fa;}})});}_0x17f5a1=_[_0x9ead('0x47')]({},_0x17f5a1,_0x39e434['options']);var _0x1316ca={'where':_0x17f5a1['where']};return db['OpenchannelQueue']['count'](_0x1316ca)[_0x9ead('0x2b')](function(_0x215812){_0x22a736[_0x9ead('0x25')]=_0x215812;if(_0x39e434['query'][_0x9ead('0x49')]){_0x17f5a1[_0x9ead('0x4a')]=[{'all':!![]}];}return db[_0x9ead('0x33')]['findAll'](_0x17f5a1);})[_0x9ead('0x2b')](function(_0x3a6292){_0x22a736[_0x9ead('0x4b')]=_0x3a6292;return _0x22a736;})[_0x9ead('0x2b')](respondWithFilteredResult(_0x494ec7,_0x17f5a1))[_0x9ead('0x4c')](handleError(_0x494ec7,null));};exports[_0x9ead('0x4d')]=function(_0x55940f,_0x4e57cb){var _0x2db078={'raw':!![],'where':{'id':_0x55940f[_0x9ead('0x4e')]['id']}},_0x508dbf={};_0x508dbf[_0x9ead('0x3d')]=_['keys'](db[_0x9ead('0x33')]['rawAttributes']);_0x508dbf[_0x9ead('0x39')]=_[_0x9ead('0x3a')](_0x55940f[_0x9ead('0x39')]);_0x508dbf['filters']=_[_0x9ead('0x3c')](_0x508dbf['model'],_0x508dbf[_0x9ead('0x39')]);_0x2db078['attributes']=_[_0x9ead('0x3c')](_0x508dbf[_0x9ead('0x3d')],qs[_0x9ead('0x3e')](_0x55940f[_0x9ead('0x39')][_0x9ead('0x3e')]));_0x2db078[_0x9ead('0x3f')]=_0x2db078[_0x9ead('0x3f')][_0x9ead('0x4f')]?_0x2db078['attributes']:_0x508dbf[_0x9ead('0x3d')];if(_0x55940f['query'][_0x9ead('0x49')]){_0x2db078[_0x9ead('0x4a')]=[{'all':!![]}];}_0x2db078=_[_0x9ead('0x47')]({},_0x2db078,_0x55940f['options']);return db['OpenchannelQueue'][_0x9ead('0x50')](_0x2db078)['then'](handleEntityNotFound(_0x4e57cb,null))[_0x9ead('0x2b')](respondWithResult(_0x4e57cb,null))[_0x9ead('0x4c')](handleError(_0x4e57cb,null));};exports['create']=function(_0x4b08ee,_0x47702f){return db[_0x9ead('0x33')][_0x9ead('0x51')](_0x4b08ee['body'],{})[_0x9ead('0x2b')](function(_0x350da0){var _0x4a9bc5=_0x4b08ee[_0x9ead('0x52')][_0x9ead('0x53')]({'plain':!![]});if(!_0x4a9bc5)throw new Error(_0x9ead('0x54'));if(_0x4a9bc5['role']===_0x9ead('0x52')){var _0x32bf4e=_0x350da0['get']({'plain':!![]});var _0x37f7df=_0x9ead('0x2c');return db[_0x9ead('0x55')][_0x9ead('0x50')]({'where':{'name':_0x37f7df,'userProfileId':_0x4a9bc5[_0x9ead('0x56')]},'raw':!![]})['then'](function(_0x3bb709){if(_0x3bb709&&_0x3bb709[_0x9ead('0x57')]===0x0){return db[_0x9ead('0x58')][_0x9ead('0x51')]({'name':_0x32bf4e[_0x9ead('0x38')],'resourceId':_0x32bf4e['id'],'type':_0x3bb709[_0x9ead('0x38')],'sectionId':_0x3bb709['id']},{})['then'](function(){return _0x350da0;});}else{return _0x350da0;}})[_0x9ead('0x4c')](function(_0x5f28c4){logger[_0x9ead('0x2e')](_0x9ead('0x59'),_0x5f28c4);throw _0x5f28c4;});}return _0x350da0;})[_0x9ead('0x2b')](respondWithResult(_0x47702f,0xc9))[_0x9ead('0x4c')](handleError(_0x47702f,null));};exports[_0x9ead('0x2a')]=function(_0x1e853e,_0x49cef6){if(_0x1e853e[_0x9ead('0x5a')]['id']){delete _0x1e853e['body']['id'];}return db[_0x9ead('0x33')]['find']({'where':{'id':_0x1e853e['params']['id']}})[_0x9ead('0x2b')](handleEntityNotFound(_0x49cef6,null))[_0x9ead('0x2b')](saveUpdates(_0x1e853e[_0x9ead('0x5a')],null))[_0x9ead('0x2b')](respondWithResult(_0x49cef6,null))['catch'](handleError(_0x49cef6,null));};exports[_0x9ead('0x2d')]=function(_0x1e1daf,_0x4ece17){return db[_0x9ead('0x33')][_0x9ead('0x50')]({'where':{'id':_0x1e1daf['params']['id']}})[_0x9ead('0x2b')](handleEntityNotFound(_0x4ece17,null))[_0x9ead('0x2b')](removeEntity(_0x4ece17,null))[_0x9ead('0x4c')](handleError(_0x4ece17,null));};exports['describe']=function(_0x1959ab,_0x30a726){return db['OpenchannelQueue'][_0x9ead('0x5b')]()[_0x9ead('0x2b')](respondWithResult(_0x30a726,null))[_0x9ead('0x4c')](handleError(_0x30a726,null));};exports['getMembers']=function(_0x3e4514,_0x37b365,_0x4cb577){var _0x8296bb={'raw':!![],'where':{}},_0x11884b={},_0x5156ee;return db['OpenchannelQueue'][_0x9ead('0x5c')]({'where':{'id':_0x3e4514[_0x9ead('0x4e')]['id']}})[_0x9ead('0x2b')](handleEntityNotFound(_0x37b365,null))[_0x9ead('0x2b')](function(_0x12de22){if(_0x12de22){_0x5156ee=_0x12de22[_0x9ead('0x53')]({'plain':!![]});_0x11884b[_0x9ead('0x3d')]=_[_0x9ead('0x3a')](db[_0x9ead('0x5d')][_0x9ead('0x34')]);_0x11884b[_0x9ead('0x39')]=_['keys'](_0x3e4514[_0x9ead('0x39')]);_0x11884b[_0x9ead('0x3b')]=_['intersection'](_0x11884b[_0x9ead('0x3d')],_0x11884b['query']);_0x8296bb['attributes']=_[_0x9ead('0x3c')](_0x11884b[_0x9ead('0x3d')],qs['fields'](_0x3e4514[_0x9ead('0x39')][_0x9ead('0x3e')]));_0x8296bb[_0x9ead('0x3f')]=_0x8296bb[_0x9ead('0x3f')][_0x9ead('0x4f')]?_0x8296bb[_0x9ead('0x3f')]:_0x11884b[_0x9ead('0x3d')];if(!_0x3e4514['query'][_0x9ead('0x40')](_0x9ead('0x41'))){_0x8296bb['limit']=qs['limit'](_0x3e4514[_0x9ead('0x39')][_0x9ead('0x23')]);_0x8296bb[_0x9ead('0x22')]=qs[_0x9ead('0x22')](_0x3e4514[_0x9ead('0x39')]['offset']);}_0x8296bb[_0x9ead('0x42')]=qs[_0x9ead('0x43')](_0x3e4514[_0x9ead('0x39')][_0x9ead('0x43')]);_0x8296bb[_0x9ead('0x44')]=qs['filters'](_['pick'](_0x3e4514[_0x9ead('0x39')],_0x11884b[_0x9ead('0x3b')]));_0x8296bb[_0x9ead('0x44')]['OpenchannelQueueId']=_0x12de22['id'];if(_0x3e4514[_0x9ead('0x39')][_0x9ead('0x46')]){_0x8296bb[_0x9ead('0x44')]=_[_0x9ead('0x47')](_0x8296bb[_0x9ead('0x44')],{'$or':_[_0x9ead('0x32')](_0x8296bb[_0x9ead('0x3f')],function(_0x25a39d){var _0x46e9f0={};_0x46e9f0[_0x25a39d]={'$like':'%'+_0x3e4514['query'][_0x9ead('0x46')]+'%'};return _0x46e9f0;})});}_0x8296bb=_[_0x9ead('0x47')]({},_0x8296bb,_0x3e4514['options']);return db[_0x9ead('0x5d')]['findAll'](_0x8296bb);}})[_0x9ead('0x2b')](function(_0x221d5e){if(_0x221d5e){return db['User'][_0x9ead('0x5e')]({'where':{'id':_[_0x9ead('0x32')](_0x221d5e,_0x9ead('0x5f')),'role':'agent'},'attributes':['id',_0x9ead('0x38'),_0x9ead('0x60'),_0x9ead('0x61'),_0x9ead('0x62')]});}})[_0x9ead('0x2b')](function(_0x1e104e){if(_0x1e104e){return{'count':_0x1e104e[_0x9ead('0x25')],'rows':_[_0x9ead('0x32')](_0x1e104e['rows'],function(_0x17dee8){return{'membername':_0x17dee8[_0x9ead('0x38')],'UserId':_0x17dee8['id'],'queue_name':_0x5156ee[_0x9ead('0x38')],'OpenchannelQueueId':_0x5156ee['id'],'interface':util[_0x9ead('0x63')]('%s/%s',_0x9ead('0x64'),_0x17dee8['name']),'penalty':0x0,'paused':_0x17dee8[_0x9ead('0x60')],'createdAt':_0x17dee8[_0x9ead('0x62')],'updatedAt':_0x17dee8[_0x9ead('0x61')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x9ead('0x2b')](respondWithFilteredResult(_0x37b365,_0x8296bb))[_0x9ead('0x4c')](handleError(_0x37b365,null));};exports[_0x9ead('0x65')]=function(_0x318a5b,_0x214aeb,_0xc4869e){var _0x2ba6cd={};var _0x1de014={};var _0x9000a1;var _0xc2fccb;return db[_0x9ead('0x33')][_0x9ead('0x5c')]({'where':{'id':_0x318a5b[_0x9ead('0x4e')]['id']}})[_0x9ead('0x2b')](handleEntityNotFound(_0x214aeb,null))['then'](function(_0x19df74){if(_0x19df74){_0x9000a1=_0x19df74;_0x1de014['model']=_[_0x9ead('0x3a')](db[_0x9ead('0x66')][_0x9ead('0x34')]);_0x1de014[_0x9ead('0x39')]=_[_0x9ead('0x3a')](_0x318a5b['query']);_0x1de014[_0x9ead('0x3b')]=_[_0x9ead('0x3c')](_0x1de014[_0x9ead('0x3d')],_0x1de014[_0x9ead('0x39')]);_0x2ba6cd[_0x9ead('0x3f')]=_[_0x9ead('0x3c')](_0x1de014[_0x9ead('0x3d')],qs[_0x9ead('0x3e')](_0x318a5b['query'][_0x9ead('0x3e')]));_0x2ba6cd[_0x9ead('0x3f')]=_0x2ba6cd[_0x9ead('0x3f')][_0x9ead('0x4f')]?_0x2ba6cd[_0x9ead('0x3f')]:_0x1de014['model'];_0x2ba6cd['order']=qs[_0x9ead('0x43')](_0x318a5b[_0x9ead('0x39')][_0x9ead('0x43')]);_0x2ba6cd[_0x9ead('0x44')]=qs[_0x9ead('0x3b')](_[_0x9ead('0x45')](_0x318a5b[_0x9ead('0x39')],_0x1de014[_0x9ead('0x3b')]));if(_0x318a5b[_0x9ead('0x39')][_0x9ead('0x46')]){_0x2ba6cd[_0x9ead('0x44')]=_[_0x9ead('0x47')](_0x2ba6cd[_0x9ead('0x44')],{'$or':_[_0x9ead('0x32')](_0x2ba6cd[_0x9ead('0x3f')],function(_0x52dd6d){var _0x55190a={};_0x55190a[_0x52dd6d]={'$like':'%'+_0x318a5b['query'][_0x9ead('0x46')]+'%'};return _0x55190a;})});}_0x2ba6cd=_[_0x9ead('0x47')]({},_0x2ba6cd,_0x318a5b[_0x9ead('0x67')]);return _0x9000a1[_0x9ead('0x65')](_0x2ba6cd);}})[_0x9ead('0x2b')](function(_0xb54493){if(_0xb54493){_0xc2fccb=_0xb54493[_0x9ead('0x4f')];if(!_0x318a5b[_0x9ead('0x39')]['hasOwnProperty'](_0x9ead('0x41'))){_0x2ba6cd[_0x9ead('0x23')]=qs['limit'](_0x318a5b[_0x9ead('0x39')][_0x9ead('0x23')]);_0x2ba6cd[_0x9ead('0x22')]=qs[_0x9ead('0x22')](_0x318a5b[_0x9ead('0x39')][_0x9ead('0x22')]);}return _0x9000a1[_0x9ead('0x65')](_0x2ba6cd);}})[_0x9ead('0x2b')](function(_0x291412){if(_0x291412){return _0x291412?{'count':_0xc2fccb,'rows':_0x291412}:null;}})['then'](respondWithResult(_0x214aeb,null))[_0x9ead('0x4c')](handleError(_0x214aeb,null));};exports[_0x9ead('0x68')]=function(_0x3299e7,_0x1961b4,_0x2fd355){var _0x5c26ec=_0x3299e7[_0x9ead('0x5a')][_0x9ead('0x69')];return db[_0x9ead('0x66')][_0x9ead('0x6a')]({'where':{'id':_0x5c26ec},'attributes':['id'],'include':[{'model':db['User'],'as':_0x9ead('0x6b'),'attributes':['id','name',_0x9ead('0x6c'),_0x9ead('0x6d'),'interface'],'raw':!![]}]})[_0x9ead('0x2b')](function(_0x4fabba){if(_0x4fabba){var _0x45ce37=_[_0x9ead('0x6e')](_0x4fabba,function(_0x16652a){var _0x2f85f6=_0x16652a[_0x9ead('0x53')]({'plain':!![]});return _0x2f85f6[_0x9ead('0x6b')];});return db[_0x9ead('0x33')][_0x9ead('0x50')]({'where':{'id':_0x3299e7[_0x9ead('0x4e')]['id']}})['then'](function(_0x55e3dd){return db[_0x9ead('0x6f')]['transaction'](function(_0x419905){return _0x55e3dd[_0x9ead('0x68')](_0x5c26ec,{'transaction':_0x419905})[_0x9ead('0x2b')](function(){return BPromise[_0x9ead('0x70')](_0x45ce37,function(_0x19d29f){return db['UserOpenchannelQueue'][_0x9ead('0x71')]({'where':{'UserId':_0x19d29f['id'],'OpenchannelQueueId':_0x3299e7[_0x9ead('0x4e')]['id']},'transaction':_0x419905});});})[_0x9ead('0x2b')](function(){_0x45ce37[_0x9ead('0x72')](function(_0x1992a1){socket[_0x9ead('0x73')]('userOpenchannelQueue:save',{'UserId':_0x1992a1['id'],'OpenchannelQueueId':_0x55e3dd['id']});});});});});}})['then'](respondWithStatusCode(_0x1961b4,null))[_0x9ead('0x4c')](handleError(_0x1961b4,null));};exports[_0x9ead('0x74')]=function(_0x4176cd,_0x15a141,_0xbbbac5){return db[_0x9ead('0x66')]['findAll']({'where':{'id':_0x4176cd['query'][_0x9ead('0x69')]},'attributes':['id'],'include':[{'model':db[_0x9ead('0x75')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x9ead('0x2b')](handleEntityNotFound(_0x15a141,null))[_0x9ead('0x2b')](function(_0xf38e01){var _0xf5b153=_[_0x9ead('0x32')](_0xf38e01,'id');var _0x44e400=[];var _0x2b80ee=[];var _0x5e847f=squel[_0x9ead('0x76')]();_0x5e847f['field']('tq.TeamId')[_0x9ead('0x77')](_0x9ead('0x78'),'tq')[_0x9ead('0x79')](_0x9ead('0x7a'),'ut',_0x9ead('0x7b'))[_0x9ead('0x44')](_0x9ead('0x7c'),_0x4176cd[_0x9ead('0x4e')]['id']);for(var _0x528917=0x0;_0x528917<_0xf38e01[_0x9ead('0x4f')];_0x528917+=0x1){let _0x5906d9=_0xf38e01[_0x528917];for(var _0x3fea3a=0x0;_0x3fea3a<_0x5906d9[_0x9ead('0x6b')]['length'];_0x3fea3a+=0x1){let _0x35fdf3=_0x5906d9[_0x9ead('0x6b')][_0x3fea3a];var _0x16086a=_0x5e847f[_0x9ead('0x7d')]();_0x16086a[_0x9ead('0x44')](_0x9ead('0x7e'),_0x35fdf3['id']);_0x2b80ee[_0x9ead('0x7f')](db[_0x9ead('0x6f')][_0x9ead('0x39')](_0x16086a['toString'](),{'type':db['sequelize'][_0x9ead('0x80')][_0x9ead('0x81')]})[_0x9ead('0x2b')](function(_0x1f4922){if(_0x1f4922['length']===0x1){return _0x35fdf3['id'];}else{var _0x57d832=_['every'](_[_0x9ead('0x32')](_0x1f4922,'TeamId'),function(_0x5a0c7a){return _[_0x9ead('0x82')](_0xf5b153,_0x5a0c7a);});if(_0x57d832){return _0x35fdf3['id'];}}}));}}return BPromise[_0x9ead('0x83')](_0x2b80ee)[_0x9ead('0x2b')](function(_0x34e22d){_0x44e400=_(_0x44e400)[_0x9ead('0x84')](_0x34e22d)[_0x9ead('0x85')]()[_0x9ead('0x86')]();return db[_0x9ead('0x33')]['find']({'where':{'id':_0x4176cd[_0x9ead('0x4e')]['id']}})[_0x9ead('0x2b')](function(_0x19f763){return db[_0x9ead('0x6f')][_0x9ead('0x87')](function(_0x422831){return _0x19f763[_0x9ead('0x74')](_0x4176cd[_0x9ead('0x39')][_0x9ead('0x69')],{'transaction':_0x422831})[_0x9ead('0x2b')](function(){if(!_[_0x9ead('0x88')](_0x44e400)){return _0x19f763[_0x9ead('0x89')](_0x44e400,{'transaction':_0x422831});}})[_0x9ead('0x2b')](function(){_0x44e400['forEach'](function(_0x4dce88){socket[_0x9ead('0x73')]('userOpenchannelQueue:remove',{'UserId':_0x4dce88,'OpenchannelQueueId':_0x19f763['id']});});});});});});})['then'](respondWithStatusCode(_0x15a141,null))[_0x9ead('0x4c')](handleError(_0x15a141,null));};exports[_0x9ead('0x8a')]=function(_0x4ebe15,_0x3db75e,_0x47ff7d){return db[_0x9ead('0x33')][_0x9ead('0x50')]({'where':{'id':_0x4ebe15['params']['id']}})[_0x9ead('0x2b')](handleEntityNotFound(_0x3db75e,null))[_0x9ead('0x2b')](function(_0x466a69){if(_0x466a69){return _0x466a69[_0x9ead('0x8a')](_0x4ebe15[_0x9ead('0x5a')]['ids'],_[_0x9ead('0x8b')](_0x4ebe15[_0x9ead('0x5a')],[_0x9ead('0x69'),'id'])||{})[_0x9ead('0x8c')](function(_0xab5636){for(var _0x1fac35=0x0;_0x1fac35<_0x4ebe15[_0x9ead('0x5a')]['ids'][_0x9ead('0x4f')];_0x1fac35+=0x1){socket[_0x9ead('0x73')](_0x9ead('0x8d'),{'UserId':Number(_0x4ebe15[_0x9ead('0x5a')][_0x9ead('0x69')][_0x1fac35]),'OpenchannelQueueId':Number(_0x4ebe15['params']['id'])});}return _0xab5636;});}})[_0x9ead('0x2b')](respondWithResult(_0x3db75e,null))[_0x9ead('0x4c')](handleError(_0x3db75e,null));};exports[_0x9ead('0x89')]=function(_0x57210e,_0x4ca88e,_0x51e342){return db[_0x9ead('0x33')][_0x9ead('0x50')]({'where':{'id':_0x57210e['params']['id']}})['then'](handleEntityNotFound(_0x4ca88e,null))[_0x9ead('0x2b')](function(_0x2c842a){if(_0x2c842a){return _0x2c842a['removeAgents'](_0x57210e[_0x9ead('0x39')][_0x9ead('0x69')])[_0x9ead('0x2b')](function(){if(_[_0x9ead('0x8e')](_0x57210e[_0x9ead('0x39')]['ids'])){for(var _0x59a3f5=0x0;_0x59a3f5<_0x57210e[_0x9ead('0x39')][_0x9ead('0x69')][_0x9ead('0x4f')];_0x59a3f5+=0x1){socket[_0x9ead('0x73')](_0x9ead('0x8f'),{'UserId':Number(_0x57210e[_0x9ead('0x39')][_0x9ead('0x69')][_0x59a3f5]),'OpenchannelQueueId':Number(_0x57210e[_0x9ead('0x4e')]['id'])});}}else{socket[_0x9ead('0x73')](_0x9ead('0x8f'),{'UserId':Number(_0x57210e['query']['ids']),'OpenchannelQueueId':Number(_0x57210e['params']['id'])});}});}})['then'](respondWithStatusCode(_0x4ca88e,null))[_0x9ead('0x4c')](handleError(_0x4ca88e,null));};exports[_0x9ead('0x90')]=function(_0x572d44,_0xb95bdf,_0x23efc8){var _0x5521a1={};var _0x429d4d={};var _0x2dbe31;var _0x5287ab;return db[_0x9ead('0x33')][_0x9ead('0x5c')]({'where':{'id':_0x572d44['params']['id']}})[_0x9ead('0x2b')](handleEntityNotFound(_0xb95bdf,null))[_0x9ead('0x2b')](function(_0x5bda1d){if(_0x5bda1d){_0x2dbe31=_0x5bda1d;_0x429d4d['model']=_[_0x9ead('0x3a')](db[_0x9ead('0x75')][_0x9ead('0x34')]);_0x429d4d[_0x9ead('0x39')]=_[_0x9ead('0x3a')](_0x572d44[_0x9ead('0x39')]);_0x429d4d[_0x9ead('0x3b')]=_['intersection'](_0x429d4d[_0x9ead('0x3d')],_0x429d4d['query']);_0x5521a1[_0x9ead('0x3f')]=_['intersection'](_0x429d4d[_0x9ead('0x3d')],qs[_0x9ead('0x3e')](_0x572d44[_0x9ead('0x39')][_0x9ead('0x3e')]));_0x5521a1[_0x9ead('0x3f')]=_0x5521a1[_0x9ead('0x3f')][_0x9ead('0x4f')]?_0x5521a1[_0x9ead('0x3f')]:_0x429d4d[_0x9ead('0x3d')];_0x5521a1[_0x9ead('0x42')]=qs[_0x9ead('0x43')](_0x572d44[_0x9ead('0x39')][_0x9ead('0x43')]);_0x5521a1[_0x9ead('0x44')]=qs['filters'](_[_0x9ead('0x45')](_0x572d44[_0x9ead('0x39')],_0x429d4d[_0x9ead('0x3b')]));if(_0x572d44[_0x9ead('0x39')]['filter']){_0x5521a1['where']=_[_0x9ead('0x47')](_0x5521a1[_0x9ead('0x44')],{'$or':_[_0x9ead('0x32')](_0x5521a1[_0x9ead('0x3f')],function(_0x27f2f0){var _0x7b0a3a={};_0x7b0a3a[_0x27f2f0]={'$like':'%'+_0x572d44['query'][_0x9ead('0x46')]+'%'};return _0x7b0a3a;})});}_0x5521a1=_[_0x9ead('0x47')]({},_0x5521a1,_0x572d44[_0x9ead('0x67')]);return _0x2dbe31[_0x9ead('0x90')](_0x5521a1);}})[_0x9ead('0x2b')](function(_0x5a1b3d){if(_0x5a1b3d){_0x5287ab=_0x5a1b3d['length'];if(!_0x572d44['query'][_0x9ead('0x40')](_0x9ead('0x41'))){_0x5521a1[_0x9ead('0x23')]=qs['limit'](_0x572d44[_0x9ead('0x39')][_0x9ead('0x23')]);_0x5521a1['offset']=qs[_0x9ead('0x22')](_0x572d44[_0x9ead('0x39')]['offset']);}return _0x2dbe31['getAgents'](_0x5521a1);}})[_0x9ead('0x2b')](function(_0x4de611){if(_0x4de611){return _0x4de611?{'count':_0x5287ab,'rows':_0x4de611}:null;}})[_0x9ead('0x2b')](respondWithResult(_0xb95bdf,null))[_0x9ead('0x4c')](handleError(_0xb95bdf,null));}; \ No newline at end of file +var _0xeba2=['findAndCountAll','UserId','agent','openchannelPause','updatedAt','createdAt','format','getTeams','Team','addTeams','ids','User','Agents','online','voicePause','interface','flatMap','transaction','each','findOrCreate','forEach','emit','userOpenchannelQueue:save','removeTeams','select','field','tq.TeamId','from','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','ut.UserId\x20=\x20?','QueryTypes','SELECT','TeamId','union','compact','value','isEmpty','removeAgents','userOpenchannelQueue:remove','addAgents','omit','spread','getAgents','findOne','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./openchannelQueue.socket','register','sendStatus','status','end','offset','count','limit','Content-Range','reject','save','update','then','destroy','OpenchannelQueues','stack','name','send','index','map','OpenchannelQueue','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','merge','where','VIRTUAL','options','includeAll','include','rows','show','params','find','catch','create','body','user','get','role','userProfileId','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getMembers','UserOpenchannelQueue','findAll'];(function(_0x5e5358,_0x480a72){var _0x4922ae=function(_0x152e3e){while(--_0x152e3e){_0x5e5358['push'](_0x5e5358['shift']());}};_0x4922ae(++_0x480a72);}(_0xeba2,0x143));var _0x2eba=function(_0xf2628e,_0x521bf7){_0xf2628e=_0xf2628e-0x0;var _0x13863a=_0xeba2[_0xf2628e];return _0x13863a;};'use strict';var emlformat=require(_0x2eba('0x0'));var rimraf=require(_0x2eba('0x1'));var zipdir=require(_0x2eba('0x2'));var jsonpatch=require(_0x2eba('0x3'));var rp=require(_0x2eba('0x4'));var moment=require('moment');var BPromise=require(_0x2eba('0x5'));var Mustache=require(_0x2eba('0x6'));var util=require('util');var path=require(_0x2eba('0x7'));var sox=require(_0x2eba('0x8'));var csv=require('to-csv');var ejs=require(_0x2eba('0x9'));var fs=require('fs');var fs_extra=require(_0x2eba('0xa'));var _=require(_0x2eba('0xb'));var squel=require(_0x2eba('0xc'));var crypto=require(_0x2eba('0xd'));var jsforce=require(_0x2eba('0xe'));var deskjs=require(_0x2eba('0xf'));var toCsv=require('to-csv');var querystring=require(_0x2eba('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x2eba('0x11'));var qs=require(_0x2eba('0x12'));var as=require(_0x2eba('0x13'));var hardwareService=require(_0x2eba('0x14'));var logger=require(_0x2eba('0x15'))(_0x2eba('0x16'));var utils=require(_0x2eba('0x17'));var config=require(_0x2eba('0x18'));var licenseUtil=require(_0x2eba('0x19'));var db=require('../../mysqldb')['db'];config[_0x2eba('0x1a')]=_[_0x2eba('0x1b')](config[_0x2eba('0x1a')],{'host':_0x2eba('0x1c'),'port':0x18eb});var socket=require(_0x2eba('0x1d'))(new Redis(config[_0x2eba('0x1a')]));require(_0x2eba('0x1e'))[_0x2eba('0x1f')](socket);function respondWithStatusCode(_0x161909,_0xef190f){_0xef190f=_0xef190f||0xcc;return function(_0x6a2bd5){if(_0x6a2bd5){return _0x161909[_0x2eba('0x20')](_0xef190f);}return _0x161909[_0x2eba('0x21')](_0xef190f)[_0x2eba('0x22')]();};}function respondWithResult(_0x41bae9,_0x12ab45){_0x12ab45=_0x12ab45||0xc8;return function(_0x188c46){if(_0x188c46){return _0x41bae9[_0x2eba('0x21')](_0x12ab45)['json'](_0x188c46);}};}function respondWithFilteredResult(_0x14c284,_0x5269e7){return function(_0x117099){if(_0x117099){var _0x12d28e=typeof _0x5269e7[_0x2eba('0x23')]==='undefined'&&typeof _0x5269e7['limit']==='undefined';var _0x148f3e=_0x117099[_0x2eba('0x24')];var _0x22aabc=_0x12d28e?0x0:_0x5269e7[_0x2eba('0x23')];var _0x59d7d2=_0x12d28e?_0x117099['count']:_0x5269e7['offset']+_0x5269e7[_0x2eba('0x25')];var _0x214cb2;if(_0x59d7d2>=_0x148f3e){_0x59d7d2=_0x148f3e;_0x214cb2=0xc8;}else{_0x214cb2=0xce;}_0x14c284['status'](_0x214cb2);return _0x14c284['set'](_0x2eba('0x26'),_0x22aabc+'-'+_0x59d7d2+'/'+_0x148f3e)['json'](_0x117099);}return null;};}function patchUpdates(_0x4b9331){return function(_0xecd45){try{jsonpatch['apply'](_0xecd45,_0x4b9331,!![]);}catch(_0x22d998){return BPromise[_0x2eba('0x27')](_0x22d998);}return _0xecd45[_0x2eba('0x28')]();};}function saveUpdates(_0x5c54b2,_0x125893){return function(_0x54bdd3){if(_0x54bdd3){return _0x54bdd3[_0x2eba('0x29')](_0x5c54b2)[_0x2eba('0x2a')](function(_0x5052c2){return _0x5052c2;});}return null;};}function removeEntity(_0x188042,_0x1966bf){return function(_0x1c4d28){if(_0x1c4d28){return _0x1c4d28[_0x2eba('0x2b')]()[_0x2eba('0x2a')](function(){var _0xf32b25=_0x1c4d28['get']({'plain':!![]});var _0xf519ff=_0x2eba('0x2c');return db['UserProfileResource']['destroy']({'where':{'type':_0xf519ff,'resourceId':_0xf32b25['id']}})['then'](function(){return _0x1c4d28;});})[_0x2eba('0x2a')](function(){_0x188042[_0x2eba('0x21')](0xcc)[_0x2eba('0x22')]();});}};}function handleEntityNotFound(_0x454b8f,_0x34b1d1){return function(_0x3e7342){if(!_0x3e7342){_0x454b8f['sendStatus'](0x194);}return _0x3e7342;};}function handleError(_0x4fdfa1,_0x2077a0){_0x2077a0=_0x2077a0||0x1f4;return function(_0x2e79e0){logger['error'](_0x2e79e0[_0x2eba('0x2d')]);if(_0x2e79e0[_0x2eba('0x2e')]){delete _0x2e79e0[_0x2eba('0x2e')];}_0x4fdfa1[_0x2eba('0x21')](_0x2077a0)[_0x2eba('0x2f')](_0x2e79e0);};}exports[_0x2eba('0x30')]=function(_0x8d3531,_0x156319){var _0x1526f7={},_0xa359a9={},_0x28eabe={'count':0x0,'rows':[]};var _0x22a65a=_[_0x2eba('0x31')](db[_0x2eba('0x32')][_0x2eba('0x33')],function(_0x5cf5eb){return{'name':_0x5cf5eb[_0x2eba('0x34')],'type':_0x5cf5eb[_0x2eba('0x35')][_0x2eba('0x36')]};});_0xa359a9[_0x2eba('0x37')]=_[_0x2eba('0x31')](_0x22a65a,'name');_0xa359a9[_0x2eba('0x38')]=_[_0x2eba('0x39')](_0x8d3531[_0x2eba('0x38')]);_0xa359a9[_0x2eba('0x3a')]=_[_0x2eba('0x3b')](_0xa359a9['model'],_0xa359a9[_0x2eba('0x38')]);_0x1526f7['attributes']=_[_0x2eba('0x3b')](_0xa359a9[_0x2eba('0x37')],qs[_0x2eba('0x3c')](_0x8d3531[_0x2eba('0x38')][_0x2eba('0x3c')]));_0x1526f7[_0x2eba('0x3d')]=_0x1526f7[_0x2eba('0x3d')][_0x2eba('0x3e')]?_0x1526f7[_0x2eba('0x3d')]:_0xa359a9[_0x2eba('0x37')];if(!_0x8d3531[_0x2eba('0x38')][_0x2eba('0x3f')](_0x2eba('0x40'))){_0x1526f7[_0x2eba('0x25')]=qs[_0x2eba('0x25')](_0x8d3531['query'][_0x2eba('0x25')]);_0x1526f7['offset']=qs[_0x2eba('0x23')](_0x8d3531[_0x2eba('0x38')]['offset']);}_0x1526f7[_0x2eba('0x41')]=qs[_0x2eba('0x42')](_0x8d3531[_0x2eba('0x38')]['sort']);_0x1526f7['where']=qs[_0x2eba('0x3a')](_[_0x2eba('0x43')](_0x8d3531[_0x2eba('0x38')],_0xa359a9[_0x2eba('0x3a')]),_0x22a65a);if(_0x8d3531[_0x2eba('0x38')][_0x2eba('0x44')]){_0x1526f7['where']=_[_0x2eba('0x45')](_0x1526f7[_0x2eba('0x46')],{'$or':_[_0x2eba('0x31')](_0x22a65a,function(_0x51c2c9){if(_0x51c2c9[_0x2eba('0x35')]!==_0x2eba('0x47')){var _0x1ba9c4={};_0x1ba9c4[_0x51c2c9[_0x2eba('0x2e')]]={'$like':'%'+_0x8d3531['query'][_0x2eba('0x44')]+'%'};return _0x1ba9c4;}})});}_0x1526f7=_[_0x2eba('0x45')]({},_0x1526f7,_0x8d3531[_0x2eba('0x48')]);var _0x59e3f1={'where':_0x1526f7['where']};return db[_0x2eba('0x32')]['count'](_0x59e3f1)['then'](function(_0x5bdce7){_0x28eabe[_0x2eba('0x24')]=_0x5bdce7;if(_0x8d3531['query'][_0x2eba('0x49')]){_0x1526f7[_0x2eba('0x4a')]=[{'all':!![]}];}return db[_0x2eba('0x32')]['findAll'](_0x1526f7);})[_0x2eba('0x2a')](function(_0x39b59d){_0x28eabe[_0x2eba('0x4b')]=_0x39b59d;return _0x28eabe;})[_0x2eba('0x2a')](respondWithFilteredResult(_0x156319,_0x1526f7))['catch'](handleError(_0x156319,null));};exports[_0x2eba('0x4c')]=function(_0x128a8e,_0xcc7ddf){var _0x547ab2={'raw':!![],'where':{'id':_0x128a8e[_0x2eba('0x4d')]['id']}},_0x1176bd={};_0x1176bd[_0x2eba('0x37')]=_['keys'](db[_0x2eba('0x32')][_0x2eba('0x33')]);_0x1176bd[_0x2eba('0x38')]=_[_0x2eba('0x39')](_0x128a8e[_0x2eba('0x38')]);_0x1176bd[_0x2eba('0x3a')]=_[_0x2eba('0x3b')](_0x1176bd['model'],_0x1176bd[_0x2eba('0x38')]);_0x547ab2[_0x2eba('0x3d')]=_[_0x2eba('0x3b')](_0x1176bd[_0x2eba('0x37')],qs[_0x2eba('0x3c')](_0x128a8e[_0x2eba('0x38')]['fields']));_0x547ab2[_0x2eba('0x3d')]=_0x547ab2[_0x2eba('0x3d')]['length']?_0x547ab2[_0x2eba('0x3d')]:_0x1176bd[_0x2eba('0x37')];if(_0x128a8e[_0x2eba('0x38')][_0x2eba('0x49')]){_0x547ab2['include']=[{'all':!![]}];}_0x547ab2=_[_0x2eba('0x45')]({},_0x547ab2,_0x128a8e[_0x2eba('0x48')]);return db['OpenchannelQueue'][_0x2eba('0x4e')](_0x547ab2)[_0x2eba('0x2a')](handleEntityNotFound(_0xcc7ddf,null))[_0x2eba('0x2a')](respondWithResult(_0xcc7ddf,null))[_0x2eba('0x4f')](handleError(_0xcc7ddf,null));};exports[_0x2eba('0x50')]=function(_0x235793,_0xf87441){return db['OpenchannelQueue'][_0x2eba('0x50')](_0x235793[_0x2eba('0x51')],{})['then'](function(_0x27bd6b){var _0x4078f7=_0x235793[_0x2eba('0x52')][_0x2eba('0x53')]({'plain':!![]});if(!_0x4078f7)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4078f7[_0x2eba('0x54')]===_0x2eba('0x52')){var _0x55ad73=_0x27bd6b['get']({'plain':!![]});var _0x4c10ab=_0x2eba('0x2c');return db['UserProfileSection'][_0x2eba('0x4e')]({'where':{'name':_0x4c10ab,'userProfileId':_0x4078f7[_0x2eba('0x55')]},'raw':!![]})[_0x2eba('0x2a')](function(_0x29b7df){if(_0x29b7df&&_0x29b7df['autoAssociation']===0x0){return db['UserProfileResource'][_0x2eba('0x50')]({'name':_0x55ad73['name'],'resourceId':_0x55ad73['id'],'type':_0x29b7df[_0x2eba('0x2e')],'sectionId':_0x29b7df['id']},{})[_0x2eba('0x2a')](function(){return _0x27bd6b;});}else{return _0x27bd6b;}})[_0x2eba('0x4f')](function(_0x374e5c){logger[_0x2eba('0x56')](_0x2eba('0x57'),_0x374e5c);throw _0x374e5c;});}return _0x27bd6b;})[_0x2eba('0x2a')](respondWithResult(_0xf87441,0xc9))[_0x2eba('0x4f')](handleError(_0xf87441,null));};exports[_0x2eba('0x29')]=function(_0x299b0f,_0x1117fa){if(_0x299b0f[_0x2eba('0x51')]['id']){delete _0x299b0f['body']['id'];}return db[_0x2eba('0x32')][_0x2eba('0x4e')]({'where':{'id':_0x299b0f['params']['id']}})[_0x2eba('0x2a')](handleEntityNotFound(_0x1117fa,null))[_0x2eba('0x2a')](saveUpdates(_0x299b0f[_0x2eba('0x51')],null))[_0x2eba('0x2a')](respondWithResult(_0x1117fa,null))[_0x2eba('0x4f')](handleError(_0x1117fa,null));};exports[_0x2eba('0x2b')]=function(_0x4ad02d,_0x18ace8){return db['OpenchannelQueue']['find']({'where':{'id':_0x4ad02d[_0x2eba('0x4d')]['id']}})['then'](handleEntityNotFound(_0x18ace8,null))[_0x2eba('0x2a')](removeEntity(_0x18ace8,null))[_0x2eba('0x4f')](handleError(_0x18ace8,null));};exports['describe']=function(_0x1b2c2b,_0x3e187f){return db['OpenchannelQueue']['describe']()['then'](respondWithResult(_0x3e187f,null))[_0x2eba('0x4f')](handleError(_0x3e187f,null));};exports[_0x2eba('0x58')]=function(_0x48dcf7,_0x59d7f8,_0x4f551f){var _0x4730b4={'raw':!![],'where':{}},_0x2570e1={},_0x2dfeb8;return db[_0x2eba('0x32')]['findOne']({'where':{'id':_0x48dcf7[_0x2eba('0x4d')]['id']}})['then'](handleEntityNotFound(_0x59d7f8,null))[_0x2eba('0x2a')](function(_0x33a2a3){if(_0x33a2a3){_0x2dfeb8=_0x33a2a3[_0x2eba('0x53')]({'plain':!![]});_0x2570e1[_0x2eba('0x37')]=_[_0x2eba('0x39')](db[_0x2eba('0x59')]['rawAttributes']);_0x2570e1[_0x2eba('0x38')]=_['keys'](_0x48dcf7[_0x2eba('0x38')]);_0x2570e1[_0x2eba('0x3a')]=_[_0x2eba('0x3b')](_0x2570e1[_0x2eba('0x37')],_0x2570e1[_0x2eba('0x38')]);_0x4730b4[_0x2eba('0x3d')]=_[_0x2eba('0x3b')](_0x2570e1[_0x2eba('0x37')],qs['fields'](_0x48dcf7[_0x2eba('0x38')][_0x2eba('0x3c')]));_0x4730b4[_0x2eba('0x3d')]=_0x4730b4[_0x2eba('0x3d')]['length']?_0x4730b4['attributes']:_0x2570e1['model'];if(!_0x48dcf7[_0x2eba('0x38')][_0x2eba('0x3f')](_0x2eba('0x40'))){_0x4730b4['limit']=qs[_0x2eba('0x25')](_0x48dcf7[_0x2eba('0x38')]['limit']);_0x4730b4[_0x2eba('0x23')]=qs['offset'](_0x48dcf7['query']['offset']);}_0x4730b4['order']=qs[_0x2eba('0x42')](_0x48dcf7['query'][_0x2eba('0x42')]);_0x4730b4[_0x2eba('0x46')]=qs[_0x2eba('0x3a')](_['pick'](_0x48dcf7[_0x2eba('0x38')],_0x2570e1[_0x2eba('0x3a')]));_0x4730b4[_0x2eba('0x46')]['OpenchannelQueueId']=_0x33a2a3['id'];if(_0x48dcf7['query'][_0x2eba('0x44')]){_0x4730b4[_0x2eba('0x46')]=_[_0x2eba('0x45')](_0x4730b4[_0x2eba('0x46')],{'$or':_[_0x2eba('0x31')](_0x4730b4[_0x2eba('0x3d')],function(_0x271323){var _0x6fc130={};_0x6fc130[_0x271323]={'$like':'%'+_0x48dcf7[_0x2eba('0x38')][_0x2eba('0x44')]+'%'};return _0x6fc130;})});}_0x4730b4=_[_0x2eba('0x45')]({},_0x4730b4,_0x48dcf7['options']);return db[_0x2eba('0x59')][_0x2eba('0x5a')](_0x4730b4);}})['then'](function(_0x4dbb42){if(_0x4dbb42){return db['User'][_0x2eba('0x5b')]({'where':{'id':_[_0x2eba('0x31')](_0x4dbb42,_0x2eba('0x5c')),'role':_0x2eba('0x5d')},'attributes':['id',_0x2eba('0x2e'),_0x2eba('0x5e'),_0x2eba('0x5f'),_0x2eba('0x60')]});}})[_0x2eba('0x2a')](function(_0x1a4677){if(_0x1a4677){return{'count':_0x1a4677[_0x2eba('0x24')],'rows':_[_0x2eba('0x31')](_0x1a4677[_0x2eba('0x4b')],function(_0x45eb68){return{'membername':_0x45eb68[_0x2eba('0x2e')],'UserId':_0x45eb68['id'],'queue_name':_0x2dfeb8['name'],'OpenchannelQueueId':_0x2dfeb8['id'],'interface':util[_0x2eba('0x61')]('%s/%s','SIP',_0x45eb68[_0x2eba('0x2e')]),'penalty':0x0,'paused':_0x45eb68[_0x2eba('0x5e')],'createdAt':_0x45eb68['createdAt'],'updatedAt':_0x45eb68[_0x2eba('0x5f')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x2eba('0x2a')](respondWithFilteredResult(_0x59d7f8,_0x4730b4))[_0x2eba('0x4f')](handleError(_0x59d7f8,null));};exports[_0x2eba('0x62')]=function(_0x59f742,_0x4d4a0c,_0x4ade92){var _0x3dcbf8={};var _0x3c4874={};var _0x511a14;var _0x48ee86;return db[_0x2eba('0x32')]['findOne']({'where':{'id':_0x59f742[_0x2eba('0x4d')]['id']}})[_0x2eba('0x2a')](handleEntityNotFound(_0x4d4a0c,null))[_0x2eba('0x2a')](function(_0x437564){if(_0x437564){_0x511a14=_0x437564;_0x3c4874[_0x2eba('0x37')]=_[_0x2eba('0x39')](db[_0x2eba('0x63')][_0x2eba('0x33')]);_0x3c4874['query']=_['keys'](_0x59f742[_0x2eba('0x38')]);_0x3c4874[_0x2eba('0x3a')]=_['intersection'](_0x3c4874['model'],_0x3c4874[_0x2eba('0x38')]);_0x3dcbf8[_0x2eba('0x3d')]=_[_0x2eba('0x3b')](_0x3c4874['model'],qs[_0x2eba('0x3c')](_0x59f742[_0x2eba('0x38')][_0x2eba('0x3c')]));_0x3dcbf8['attributes']=_0x3dcbf8[_0x2eba('0x3d')]['length']?_0x3dcbf8['attributes']:_0x3c4874[_0x2eba('0x37')];_0x3dcbf8[_0x2eba('0x41')]=qs['sort'](_0x59f742['query'][_0x2eba('0x42')]);_0x3dcbf8['where']=qs[_0x2eba('0x3a')](_[_0x2eba('0x43')](_0x59f742[_0x2eba('0x38')],_0x3c4874[_0x2eba('0x3a')]));if(_0x59f742[_0x2eba('0x38')][_0x2eba('0x44')]){_0x3dcbf8[_0x2eba('0x46')]=_[_0x2eba('0x45')](_0x3dcbf8[_0x2eba('0x46')],{'$or':_['map'](_0x3dcbf8[_0x2eba('0x3d')],function(_0x52d52d){var _0xb77b89={};_0xb77b89[_0x52d52d]={'$like':'%'+_0x59f742[_0x2eba('0x38')][_0x2eba('0x44')]+'%'};return _0xb77b89;})});}_0x3dcbf8=_[_0x2eba('0x45')]({},_0x3dcbf8,_0x59f742[_0x2eba('0x48')]);return _0x511a14[_0x2eba('0x62')](_0x3dcbf8);}})[_0x2eba('0x2a')](function(_0x114acb){if(_0x114acb){_0x48ee86=_0x114acb[_0x2eba('0x3e')];if(!_0x59f742['query'][_0x2eba('0x3f')]('nolimit')){_0x3dcbf8[_0x2eba('0x25')]=qs[_0x2eba('0x25')](_0x59f742[_0x2eba('0x38')]['limit']);_0x3dcbf8[_0x2eba('0x23')]=qs['offset'](_0x59f742['query']['offset']);}return _0x511a14[_0x2eba('0x62')](_0x3dcbf8);}})[_0x2eba('0x2a')](function(_0x40b5ad){if(_0x40b5ad){return _0x40b5ad?{'count':_0x48ee86,'rows':_0x40b5ad}:null;}})[_0x2eba('0x2a')](respondWithResult(_0x4d4a0c,null))[_0x2eba('0x4f')](handleError(_0x4d4a0c,null));};exports[_0x2eba('0x64')]=function(_0x1d85bc,_0x21e4bb,_0x100e42){var _0x23e71e=_0x1d85bc[_0x2eba('0x51')][_0x2eba('0x65')];return db[_0x2eba('0x63')][_0x2eba('0x5a')]({'where':{'id':_0x23e71e},'attributes':['id'],'include':[{'model':db[_0x2eba('0x66')],'as':_0x2eba('0x67'),'attributes':['id',_0x2eba('0x2e'),_0x2eba('0x68'),_0x2eba('0x69'),_0x2eba('0x6a')],'raw':!![]}]})[_0x2eba('0x2a')](function(_0x56f877){if(_0x56f877){var _0x476025=_[_0x2eba('0x6b')](_0x56f877,function(_0x115290){var _0x5dfcc0=_0x115290[_0x2eba('0x53')]({'plain':!![]});return _0x5dfcc0['Agents'];});return db[_0x2eba('0x32')][_0x2eba('0x4e')]({'where':{'id':_0x1d85bc[_0x2eba('0x4d')]['id']}})[_0x2eba('0x2a')](function(_0x4ba9df){return db['sequelize'][_0x2eba('0x6c')](function(_0x5e1d36){return _0x4ba9df[_0x2eba('0x64')](_0x23e71e,{'transaction':_0x5e1d36})[_0x2eba('0x2a')](function(){return BPromise[_0x2eba('0x6d')](_0x476025,function(_0x555c5b){return db[_0x2eba('0x59')][_0x2eba('0x6e')]({'where':{'UserId':_0x555c5b['id'],'OpenchannelQueueId':_0x1d85bc['params']['id']},'transaction':_0x5e1d36});});})[_0x2eba('0x2a')](function(){_0x476025[_0x2eba('0x6f')](function(_0x6dfed1){socket[_0x2eba('0x70')](_0x2eba('0x71'),{'UserId':_0x6dfed1['id'],'OpenchannelQueueId':_0x4ba9df['id']});});});});});}})['then'](respondWithStatusCode(_0x21e4bb,null))['catch'](handleError(_0x21e4bb,null));};exports[_0x2eba('0x72')]=function(_0x121b5b,_0x51edcb,_0x114ead){return db[_0x2eba('0x63')]['findAll']({'where':{'id':_0x121b5b[_0x2eba('0x38')]['ids']},'attributes':['id'],'include':[{'model':db[_0x2eba('0x66')],'as':_0x2eba('0x67'),'attributes':['id'],'raw':!![]}]})[_0x2eba('0x2a')](handleEntityNotFound(_0x51edcb,null))[_0x2eba('0x2a')](function(_0x4c7ab2){var _0x2b5799=_[_0x2eba('0x31')](_0x4c7ab2,'id');var _0x501e99=[];var _0x1e04a4=[];var _0x2655d5=squel[_0x2eba('0x73')]();_0x2655d5[_0x2eba('0x74')](_0x2eba('0x75'))[_0x2eba('0x76')]('team_has_openchannel_queues','tq')[_0x2eba('0x77')](_0x2eba('0x78'),'ut',_0x2eba('0x79'))[_0x2eba('0x46')]('OpenchannelQueueId\x20=\x20?',_0x121b5b['params']['id']);for(var _0x9c6e8=0x0;_0x9c6e8<_0x4c7ab2[_0x2eba('0x3e')];_0x9c6e8+=0x1){let _0x4fda30=_0x4c7ab2[_0x9c6e8];for(var _0x462b85=0x0;_0x462b85<_0x4fda30['Agents'][_0x2eba('0x3e')];_0x462b85+=0x1){let _0x577782=_0x4fda30[_0x2eba('0x67')][_0x462b85];var _0x3cd7f7=_0x2655d5[_0x2eba('0x7a')]();_0x3cd7f7[_0x2eba('0x46')](_0x2eba('0x7b'),_0x577782['id']);_0x1e04a4['push'](db['sequelize'][_0x2eba('0x38')](_0x3cd7f7['toString'](),{'type':db['sequelize'][_0x2eba('0x7c')][_0x2eba('0x7d')]})[_0x2eba('0x2a')](function(_0x23f6ac){if(_0x23f6ac[_0x2eba('0x3e')]===0x1){return _0x577782['id'];}else{var _0x2f4b2a=_['every'](_['map'](_0x23f6ac,_0x2eba('0x7e')),function(_0x5a713a){return _['includes'](_0x2b5799,_0x5a713a);});if(_0x2f4b2a){return _0x577782['id'];}}}));}}return BPromise['all'](_0x1e04a4)[_0x2eba('0x2a')](function(_0x20beb4){_0x501e99=_(_0x501e99)[_0x2eba('0x7f')](_0x20beb4)[_0x2eba('0x80')]()[_0x2eba('0x81')]();return db[_0x2eba('0x32')][_0x2eba('0x4e')]({'where':{'id':_0x121b5b[_0x2eba('0x4d')]['id']}})['then'](function(_0x2f3c63){return db['sequelize'][_0x2eba('0x6c')](function(_0x73bb90){return _0x2f3c63[_0x2eba('0x72')](_0x121b5b[_0x2eba('0x38')][_0x2eba('0x65')],{'transaction':_0x73bb90})[_0x2eba('0x2a')](function(){if(!_[_0x2eba('0x82')](_0x501e99)){return _0x2f3c63[_0x2eba('0x83')](_0x501e99,{'transaction':_0x73bb90});}})['then'](function(){_0x501e99[_0x2eba('0x6f')](function(_0x11d833){socket[_0x2eba('0x70')](_0x2eba('0x84'),{'UserId':_0x11d833,'OpenchannelQueueId':_0x2f3c63['id']});});});});});});})[_0x2eba('0x2a')](respondWithStatusCode(_0x51edcb,null))[_0x2eba('0x4f')](handleError(_0x51edcb,null));};exports[_0x2eba('0x85')]=function(_0xf833d1,_0x3f7a44,_0x40de8d){return db['OpenchannelQueue'][_0x2eba('0x4e')]({'where':{'id':_0xf833d1[_0x2eba('0x4d')]['id']}})[_0x2eba('0x2a')](handleEntityNotFound(_0x3f7a44,null))['then'](function(_0x478ada){if(_0x478ada){return _0x478ada[_0x2eba('0x85')](_0xf833d1[_0x2eba('0x51')][_0x2eba('0x65')],_[_0x2eba('0x86')](_0xf833d1['body'],[_0x2eba('0x65'),'id'])||{})[_0x2eba('0x87')](function(_0x3ff5a1){for(var _0xfd70a5=0x0;_0xfd70a5<_0xf833d1[_0x2eba('0x51')][_0x2eba('0x65')][_0x2eba('0x3e')];_0xfd70a5+=0x1){socket[_0x2eba('0x70')](_0x2eba('0x71'),{'UserId':Number(_0xf833d1[_0x2eba('0x51')][_0x2eba('0x65')][_0xfd70a5]),'OpenchannelQueueId':Number(_0xf833d1[_0x2eba('0x4d')]['id'])});}return _0x3ff5a1;});}})[_0x2eba('0x2a')](respondWithResult(_0x3f7a44,null))['catch'](handleError(_0x3f7a44,null));};exports['removeAgents']=function(_0x474f26,_0x21ba41,_0x3b3a19){return db['OpenchannelQueue'][_0x2eba('0x4e')]({'where':{'id':_0x474f26[_0x2eba('0x4d')]['id']}})[_0x2eba('0x2a')](handleEntityNotFound(_0x21ba41,null))['then'](function(_0x3acdbd){if(_0x3acdbd){return _0x3acdbd[_0x2eba('0x83')](_0x474f26[_0x2eba('0x38')][_0x2eba('0x65')])[_0x2eba('0x2a')](function(){if(_['isArray'](_0x474f26[_0x2eba('0x38')][_0x2eba('0x65')])){for(var _0x5079cd=0x0;_0x5079cd<_0x474f26[_0x2eba('0x38')]['ids'][_0x2eba('0x3e')];_0x5079cd+=0x1){socket[_0x2eba('0x70')]('userOpenchannelQueue:remove',{'UserId':Number(_0x474f26[_0x2eba('0x38')][_0x2eba('0x65')][_0x5079cd]),'OpenchannelQueueId':Number(_0x474f26['params']['id'])});}}else{socket[_0x2eba('0x70')](_0x2eba('0x84'),{'UserId':Number(_0x474f26[_0x2eba('0x38')][_0x2eba('0x65')]),'OpenchannelQueueId':Number(_0x474f26[_0x2eba('0x4d')]['id'])});}});}})[_0x2eba('0x2a')](respondWithStatusCode(_0x21ba41,null))[_0x2eba('0x4f')](handleError(_0x21ba41,null));};exports[_0x2eba('0x88')]=function(_0x2005a1,_0x140657,_0xbc4053){var _0x5cc035={};var _0xc28f9e={};var _0x30df93;var _0x5921a9;return db[_0x2eba('0x32')][_0x2eba('0x89')]({'where':{'id':_0x2005a1[_0x2eba('0x4d')]['id']}})[_0x2eba('0x2a')](handleEntityNotFound(_0x140657,null))[_0x2eba('0x2a')](function(_0xae500){if(_0xae500){_0x30df93=_0xae500;_0xc28f9e[_0x2eba('0x37')]=_[_0x2eba('0x39')](db[_0x2eba('0x66')]['rawAttributes']);_0xc28f9e['query']=_['keys'](_0x2005a1['query']);_0xc28f9e['filters']=_[_0x2eba('0x3b')](_0xc28f9e['model'],_0xc28f9e[_0x2eba('0x38')]);_0x5cc035[_0x2eba('0x3d')]=_['intersection'](_0xc28f9e[_0x2eba('0x37')],qs[_0x2eba('0x3c')](_0x2005a1[_0x2eba('0x38')][_0x2eba('0x3c')]));_0x5cc035[_0x2eba('0x3d')]=_0x5cc035[_0x2eba('0x3d')][_0x2eba('0x3e')]?_0x5cc035[_0x2eba('0x3d')]:_0xc28f9e[_0x2eba('0x37')];_0x5cc035[_0x2eba('0x41')]=qs[_0x2eba('0x42')](_0x2005a1[_0x2eba('0x38')][_0x2eba('0x42')]);_0x5cc035[_0x2eba('0x46')]=qs[_0x2eba('0x3a')](_['pick'](_0x2005a1[_0x2eba('0x38')],_0xc28f9e['filters']));if(_0x2005a1['query'][_0x2eba('0x44')]){_0x5cc035[_0x2eba('0x46')]=_[_0x2eba('0x45')](_0x5cc035['where'],{'$or':_[_0x2eba('0x31')](_0x5cc035[_0x2eba('0x3d')],function(_0xf77bec){var _0xd16b7b={};_0xd16b7b[_0xf77bec]={'$like':'%'+_0x2005a1[_0x2eba('0x38')][_0x2eba('0x44')]+'%'};return _0xd16b7b;})});}_0x5cc035=_[_0x2eba('0x45')]({},_0x5cc035,_0x2005a1[_0x2eba('0x48')]);return _0x30df93['getAgents'](_0x5cc035);}})[_0x2eba('0x2a')](function(_0x5501e1){if(_0x5501e1){_0x5921a9=_0x5501e1[_0x2eba('0x3e')];if(!_0x2005a1['query'][_0x2eba('0x3f')](_0x2eba('0x40'))){_0x5cc035[_0x2eba('0x25')]=qs[_0x2eba('0x25')](_0x2005a1[_0x2eba('0x38')][_0x2eba('0x25')]);_0x5cc035[_0x2eba('0x23')]=qs[_0x2eba('0x23')](_0x2005a1[_0x2eba('0x38')][_0x2eba('0x23')]);}return _0x30df93['getAgents'](_0x5cc035);}})['then'](function(_0x67a442){if(_0x67a442){return _0x67a442?{'count':_0x5921a9,'rows':_0x67a442}:null;}})['then'](respondWithResult(_0x140657,null))['catch'](handleError(_0x140657,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.events.js b/server/api/openchannelQueue/openchannelQueue.events.js index c4b4158..52649df 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 _0xdc40=['events','../../mysqldb','OpenchannelQueue','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook'];(function(_0xdd69a0,_0x417c58){var _0x3f7e06=function(_0x7a3f48){while(--_0x7a3f48){_0xdd69a0['push'](_0xdd69a0['shift']());}};_0x3f7e06(++_0x417c58);}(_0xdc40,0x118));var _0x0dc4=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xdc40[_0x20a584];return _0x4b41a8;};'use strict';var EventEmitter=require(_0x0dc4('0x0'));var OpenchannelQueue=require(_0x0dc4('0x1'))['db'][_0x0dc4('0x2')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0x0dc4('0x3')](0x0);var events={'afterCreate':_0x0dc4('0x4'),'afterUpdate':_0x0dc4('0x5'),'afterDestroy':_0x0dc4('0x6')};function emitEvent(_0x1b30b6){return function(_0x2c1576,_0x5409e9,_0x4482d6){OpenchannelQueueEvents[_0x0dc4('0x7')](_0x1b30b6+':'+_0x2c1576['id'],_0x2c1576);OpenchannelQueueEvents[_0x0dc4('0x7')](_0x1b30b6,_0x2c1576);_0x4482d6(null);};}for(var e in events){if(events[_0x0dc4('0x8')](e)){var event=events[e];OpenchannelQueue[_0x0dc4('0x9')](e,emitEvent(event));}}module['exports']=OpenchannelQueueEvents; \ No newline at end of file +var _0xe8c1=['update','remove','emit','hasOwnProperty','hook','exports','../../mysqldb','OpenchannelQueue'];(function(_0x54276,_0x1a4ffa){var _0x3d741d=function(_0x4f7cbd){while(--_0x4f7cbd){_0x54276['push'](_0x54276['shift']());}};_0x3d741d(++_0x1a4ffa);}(_0xe8c1,0xbe));var _0x1e8c=function(_0x35fb56,_0x5dadff){_0x35fb56=_0x35fb56-0x0;var _0x2fd52c=_0xe8c1[_0x35fb56];return _0x2fd52c;};'use strict';var EventEmitter=require('events');var OpenchannelQueue=require(_0x1e8c('0x0'))['db'][_0x1e8c('0x1')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x1e8c('0x2'),'afterDestroy':_0x1e8c('0x3')};function emitEvent(_0x2e8810){return function(_0x593578,_0x4bd5cc,_0x32b787){OpenchannelQueueEvents[_0x1e8c('0x4')](_0x2e8810+':'+_0x593578['id'],_0x593578);OpenchannelQueueEvents[_0x1e8c('0x4')](_0x2e8810,_0x593578);_0x32b787(null);};}for(var e in events){if(events[_0x1e8c('0x5')](e)){var event=events[e];OpenchannelQueue[_0x1e8c('0x6')](e,emitEvent(event));}}module[_0x1e8c('0x7')]=OpenchannelQueueEvents; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.model.js b/server/api/openchannelQueue/openchannelQueue.model.js index aa63c2d..012e73d 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 _0xbb5d=['bluebird','request-promise','path','rimraf','../../config/environment','define','../../config/logger'];(function(_0x9f1088,_0xe9b0af){var _0x723207=function(_0x3b292b){while(--_0x3b292b){_0x9f1088['push'](_0x9f1088['shift']());}};_0x723207(++_0xe9b0af);}(_0xbb5d,0x180));var _0xdbb5=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xbb5d[_0x20a584];return _0x4b41a8;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xdbb5('0x0'))('api');var moment=require('moment');var BPromise=require(_0xdbb5('0x1'));var rp=require(_0xdbb5('0x2'));var fs=require('fs');var path=require(_0xdbb5('0x3'));var rimraf=require(_0xdbb5('0x4'));var config=require(_0xdbb5('0x5'));var attributes=require('./openchannelQueue.attributes');module['exports']=function(_0x9dda08,_0x4de202){return _0x9dda08[_0xdbb5('0x6')]('OpenchannelQueue',attributes,{'tableName':'openchannel_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe62e=['lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelQueue.attributes','exports','define','OpenchannelQueue','openchannel_queues'];(function(_0x3ad70f,_0x20063e){var _0x32fb64=function(_0x1473b4){while(--_0x1473b4){_0x3ad70f['push'](_0x3ad70f['shift']());}};_0x32fb64(++_0x20063e);}(_0xe62e,0x118));var _0xee62=function(_0x16fc99,_0x23589d){_0x16fc99=_0x16fc99-0x0;var _0x8ed00a=_0xe62e[_0x16fc99];return _0x8ed00a;};'use strict';var _=require(_0xee62('0x0'));var util=require(_0xee62('0x1'));var logger=require(_0xee62('0x2'))(_0xee62('0x3'));var moment=require('moment');var BPromise=require(_0xee62('0x4'));var rp=require(_0xee62('0x5'));var fs=require('fs');var path=require(_0xee62('0x6'));var rimraf=require(_0xee62('0x7'));var config=require(_0xee62('0x8'));var attributes=require(_0xee62('0x9'));module[_0xee62('0xa')]=function(_0x13e563,_0x116966){return _0x13e563[_0xee62('0xb')](_0xee62('0xc'),attributes,{'tableName':_0xee62('0xd'),'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 2231d73..6e1d47d 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 _0x9f40=['http','redis','defaults','localhost','./openchannelQueue.socket','request','then','info','OpenchannelQueue,\x20%s,\x20%s','debug','OpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetOpenchannelQueue','OpenchannelQueue','findAll','options','raw','where','attributes','limit','include','map','model','ShowOpenchannelQueue','find','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x10f5d3,_0x27e0cb){var _0x350c50=function(_0xd5fb05){while(--_0xd5fb05){_0x10f5d3['push'](_0x10f5d3['shift']());}};_0x350c50(++_0x27e0cb);}(_0x9f40,0x8d));var _0x09f4=function(_0x332395,_0x23d4ae){_0x332395=_0x332395-0x0;var _0x549f9f=_0x9f40[_0x332395];return _0x549f9f;};'use strict';var _=require(_0x09f4('0x0'));var util=require(_0x09f4('0x1'));var moment=require(_0x09f4('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x09f4('0x3'));var db=require(_0x09f4('0x4'))['db'];var utils=require(_0x09f4('0x5'));var logger=require(_0x09f4('0x6'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x09f4('0x7')]({'port':0x232a});config[_0x09f4('0x8')]=_[_0x09f4('0x9')](config['redis'],{'host':_0x09f4('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x09f4('0x8')]));require(_0x09f4('0xb'))['register'](socket);function respondWithRpcPromise(_0x467fb8,_0x4785f5,_0x14963a){return new BPromise(function(_0x3a8375,_0xa823a2){return client[_0x09f4('0xc')](_0x467fb8,_0x14963a)[_0x09f4('0xd')](function(_0x3033ab){logger[_0x09f4('0xe')](_0x09f4('0xf'),_0x4785f5,'request\x20sent');logger[_0x09f4('0x10')](_0x09f4('0x11'),_0x4785f5,'request\x20sent',JSON[_0x09f4('0x12')](_0x3033ab));if(_0x3033ab[_0x09f4('0x13')]){if(_0x3033ab['error'][_0x09f4('0x14')]===0x1f4){logger['error'](_0x09f4('0xf'),_0x4785f5,_0x3033ab[_0x09f4('0x13')][_0x09f4('0x15')]);return _0xa823a2(_0x3033ab[_0x09f4('0x13')]['message']);}logger[_0x09f4('0x13')]('OpenchannelQueue,\x20%s,\x20%s',_0x4785f5,_0x3033ab[_0x09f4('0x13')][_0x09f4('0x15')]);return _0x3a8375(_0x3033ab[_0x09f4('0x13')][_0x09f4('0x15')]);}else{logger[_0x09f4('0xe')]('OpenchannelQueue,\x20%s,\x20%s',_0x4785f5,'request\x20sent');_0x3a8375(_0x3033ab[_0x09f4('0x16')]['message']);}})[_0x09f4('0x17')](function(_0x3f6082){logger[_0x09f4('0x13')](_0x09f4('0xf'),_0x4785f5,_0x3f6082);_0xa823a2(_0x3f6082);});});}exports[_0x09f4('0x18')]=function(_0x16440f){var _0x4e27ee=this;return new Promise(function(_0xef3c34,_0x5b99ae){return db[_0x09f4('0x19')][_0x09f4('0x1a')]({'raw':_0x16440f[_0x09f4('0x1b')]?_0x16440f[_0x09f4('0x1b')][_0x09f4('0x1c')]===undefined?!![]:![]:!![],'where':_0x16440f[_0x09f4('0x1b')]?_0x16440f['options'][_0x09f4('0x1d')]||null:null,'attributes':_0x16440f[_0x09f4('0x1b')]?_0x16440f[_0x09f4('0x1b')][_0x09f4('0x1e')]||null:null,'limit':_0x16440f['options']?_0x16440f[_0x09f4('0x1b')][_0x09f4('0x1f')]||null:null,'include':_0x16440f[_0x09f4('0x1b')]?_0x16440f[_0x09f4('0x1b')][_0x09f4('0x20')]?_[_0x09f4('0x21')](_0x16440f[_0x09f4('0x1b')][_0x09f4('0x20')],function(_0x482fb3){return{'model':db[_0x482fb3[_0x09f4('0x22')]],'as':_0x482fb3['as'],'attributes':_0x482fb3[_0x09f4('0x1e')],'include':_0x482fb3[_0x09f4('0x20')]?_[_0x09f4('0x21')](_0x482fb3[_0x09f4('0x20')],function(_0x5b2cad){return{'model':db[_0x5b2cad[_0x09f4('0x22')]],'as':_0x5b2cad['as'],'attributes':_0x5b2cad[_0x09f4('0x1e')],'include':_0x5b2cad[_0x09f4('0x20')]?_['map'](_0x5b2cad[_0x09f4('0x20')],function(_0x4e00df){return{'model':db[_0x4e00df[_0x09f4('0x22')]],'as':_0x4e00df['as'],'attributes':_0x4e00df[_0x09f4('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x09f4('0xd')](function(_0x526f45){logger[_0x09f4('0xe')](_0x09f4('0x18'),_0x16440f);logger['debug'](_0x09f4('0x18'),_0x16440f,JSON[_0x09f4('0x12')](_0x526f45));_0xef3c34(_0x526f45);})[_0x09f4('0x17')](function(_0x31399e){logger['error'](_0x09f4('0x18'),_0x31399e['message'],_0x16440f);_0x5b99ae(_0x4e27ee['error'](0x1f4,_0x31399e[_0x09f4('0x15')]));});});};exports[_0x09f4('0x23')]=function(_0x1eb554){var _0x457e69=this;return new Promise(function(_0x5b0b08,_0x355220){return db[_0x09f4('0x19')][_0x09f4('0x24')]({'raw':_0x1eb554[_0x09f4('0x1b')]?_0x1eb554[_0x09f4('0x1b')][_0x09f4('0x1c')]===undefined?!![]:![]:!![],'where':_0x1eb554[_0x09f4('0x1b')]?_0x1eb554[_0x09f4('0x1b')]['where']||null:null,'attributes':_0x1eb554['options']?_0x1eb554[_0x09f4('0x1b')][_0x09f4('0x1e')]||null:null,'include':_0x1eb554[_0x09f4('0x1b')]?_0x1eb554[_0x09f4('0x1b')][_0x09f4('0x20')]?_['map'](_0x1eb554[_0x09f4('0x1b')]['include'],function(_0x39a8b9){return{'model':db[_0x39a8b9['model']],'as':_0x39a8b9['as'],'attributes':_0x39a8b9[_0x09f4('0x1e')],'include':_0x39a8b9['include']?_[_0x09f4('0x21')](_0x39a8b9['include'],function(_0x28452f){return{'model':db[_0x28452f[_0x09f4('0x22')]],'as':_0x28452f['as'],'attributes':_0x28452f[_0x09f4('0x1e')],'include':_0x28452f[_0x09f4('0x20')]?_[_0x09f4('0x21')](_0x28452f['include'],function(_0x58e4ca){return{'model':db[_0x58e4ca['model']],'as':_0x58e4ca['as'],'attributes':_0x58e4ca[_0x09f4('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x09f4('0xd')](function(_0x39d176){logger[_0x09f4('0xe')](_0x09f4('0x23'),_0x1eb554);logger[_0x09f4('0x10')](_0x09f4('0x23'),_0x1eb554,JSON[_0x09f4('0x12')](_0x39d176));_0x5b0b08(_0x39d176);})[_0x09f4('0x17')](function(_0xe64f57){logger[_0x09f4('0x13')]('ShowOpenchannelQueue',_0xe64f57['message'],_0x1eb554);_0x355220(_0x457e69[_0x09f4('0x13')](0x1f4,_0xe64f57[_0x09f4('0x15')]));});});}; \ No newline at end of file +var _0xb56e=['model','debug','GetOpenchannelQueue','catch','find','ShowOpenchannelQueue','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','register','then','info','OpenchannelQueue,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','OpenchannelQueue','findAll','options','raw','where','attributes','limit','map','include'];(function(_0x23f8d2,_0x301fec){var _0x5d174b=function(_0x2c3c9e){while(--_0x2c3c9e){_0x23f8d2['push'](_0x23f8d2['shift']());}};_0x5d174b(++_0x301fec);}(_0xb56e,0x18c));var _0xeb56=function(_0x37b136,_0x46b3e8){_0x37b136=_0x37b136-0x0;var _0x4a7a95=_0xb56e[_0x37b136];return _0x4a7a95;};'use strict';var _=require(_0xeb56('0x0'));var util=require(_0xeb56('0x1'));var moment=require(_0xeb56('0x2'));var BPromise=require(_0xeb56('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xeb56('0x4'));var db=require(_0xeb56('0x5'))['db'];var utils=require(_0xeb56('0x6'));var logger=require('../../config/logger')(_0xeb56('0x7'));var config=require(_0xeb56('0x8'));var jayson=require(_0xeb56('0x9'));var client=jayson[_0xeb56('0xa')][_0xeb56('0xb')]({'port':0x232a});config['redis']=_['defaults'](config[_0xeb56('0xc')],{'host':_0xeb56('0xd'),'port':0x18eb});var socket=require(_0xeb56('0xe'))(new Redis(config[_0xeb56('0xc')]));require('./openchannelQueue.socket')[_0xeb56('0xf')](socket);function respondWithRpcPromise(_0x3cbb6d,_0x517d1a,_0x5b7a17){return new BPromise(function(_0x30e208,_0x15fd22){return client['request'](_0x3cbb6d,_0x5b7a17)[_0xeb56('0x10')](function(_0x5347e6){logger[_0xeb56('0x11')](_0xeb56('0x12'),_0x517d1a,_0xeb56('0x13'));logger['debug']('OpenchannelQueue,\x20%s,\x20%s,\x20%s',_0x517d1a,'request\x20sent',JSON[_0xeb56('0x14')](_0x5347e6));if(_0x5347e6[_0xeb56('0x15')]){if(_0x5347e6[_0xeb56('0x15')][_0xeb56('0x16')]===0x1f4){logger[_0xeb56('0x15')](_0xeb56('0x12'),_0x517d1a,_0x5347e6[_0xeb56('0x15')][_0xeb56('0x17')]);return _0x15fd22(_0x5347e6[_0xeb56('0x15')][_0xeb56('0x17')]);}logger[_0xeb56('0x15')](_0xeb56('0x12'),_0x517d1a,_0x5347e6[_0xeb56('0x15')][_0xeb56('0x17')]);return _0x30e208(_0x5347e6[_0xeb56('0x15')][_0xeb56('0x17')]);}else{logger[_0xeb56('0x11')]('OpenchannelQueue,\x20%s,\x20%s',_0x517d1a,'request\x20sent');_0x30e208(_0x5347e6['result'][_0xeb56('0x17')]);}})['catch'](function(_0x467278){logger[_0xeb56('0x15')](_0xeb56('0x12'),_0x517d1a,_0x467278);_0x15fd22(_0x467278);});});}exports['GetOpenchannelQueue']=function(_0x328a50){var _0x5caa41=this;return new Promise(function(_0x3b9cb7,_0x14d580){return db[_0xeb56('0x18')][_0xeb56('0x19')]({'raw':_0x328a50[_0xeb56('0x1a')]?_0x328a50['options'][_0xeb56('0x1b')]===undefined?!![]:![]:!![],'where':_0x328a50['options']?_0x328a50[_0xeb56('0x1a')][_0xeb56('0x1c')]||null:null,'attributes':_0x328a50['options']?_0x328a50[_0xeb56('0x1a')][_0xeb56('0x1d')]||null:null,'limit':_0x328a50['options']?_0x328a50['options'][_0xeb56('0x1e')]||null:null,'include':_0x328a50[_0xeb56('0x1a')]?_0x328a50[_0xeb56('0x1a')]['include']?_[_0xeb56('0x1f')](_0x328a50['options'][_0xeb56('0x20')],function(_0x4d202c){return{'model':db[_0x4d202c[_0xeb56('0x21')]],'as':_0x4d202c['as'],'attributes':_0x4d202c[_0xeb56('0x1d')],'include':_0x4d202c[_0xeb56('0x20')]?_['map'](_0x4d202c[_0xeb56('0x20')],function(_0x2a9557){return{'model':db[_0x2a9557[_0xeb56('0x21')]],'as':_0x2a9557['as'],'attributes':_0x2a9557[_0xeb56('0x1d')],'include':_0x2a9557[_0xeb56('0x20')]?_[_0xeb56('0x1f')](_0x2a9557['include'],function(_0x3dd1ed){return{'model':db[_0x3dd1ed[_0xeb56('0x21')]],'as':_0x3dd1ed['as'],'attributes':_0x3dd1ed[_0xeb56('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xeb56('0x10')](function(_0x2de284){logger[_0xeb56('0x11')]('GetOpenchannelQueue',_0x328a50);logger[_0xeb56('0x22')](_0xeb56('0x23'),_0x328a50,JSON[_0xeb56('0x14')](_0x2de284));_0x3b9cb7(_0x2de284);})[_0xeb56('0x24')](function(_0x493f50){logger[_0xeb56('0x15')](_0xeb56('0x23'),_0x493f50['message'],_0x328a50);_0x14d580(_0x5caa41['error'](0x1f4,_0x493f50[_0xeb56('0x17')]));});});};exports['ShowOpenchannelQueue']=function(_0x1630b4){var _0x291ff9=this;return new Promise(function(_0x22a1de,_0x347bc5){return db[_0xeb56('0x18')][_0xeb56('0x25')]({'raw':_0x1630b4[_0xeb56('0x1a')]?_0x1630b4[_0xeb56('0x1a')][_0xeb56('0x1b')]===undefined?!![]:![]:!![],'where':_0x1630b4[_0xeb56('0x1a')]?_0x1630b4[_0xeb56('0x1a')]['where']||null:null,'attributes':_0x1630b4[_0xeb56('0x1a')]?_0x1630b4[_0xeb56('0x1a')][_0xeb56('0x1d')]||null:null,'include':_0x1630b4[_0xeb56('0x1a')]?_0x1630b4[_0xeb56('0x1a')][_0xeb56('0x20')]?_['map'](_0x1630b4[_0xeb56('0x1a')][_0xeb56('0x20')],function(_0x593c0f){return{'model':db[_0x593c0f[_0xeb56('0x21')]],'as':_0x593c0f['as'],'attributes':_0x593c0f[_0xeb56('0x1d')],'include':_0x593c0f[_0xeb56('0x20')]?_[_0xeb56('0x1f')](_0x593c0f['include'],function(_0x48fc40){return{'model':db[_0x48fc40[_0xeb56('0x21')]],'as':_0x48fc40['as'],'attributes':_0x48fc40[_0xeb56('0x1d')],'include':_0x48fc40[_0xeb56('0x20')]?_['map'](_0x48fc40[_0xeb56('0x20')],function(_0x27d45a){return{'model':db[_0x27d45a[_0xeb56('0x21')]],'as':_0x27d45a['as'],'attributes':_0x27d45a[_0xeb56('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xeb56('0x10')](function(_0x28bed1){logger[_0xeb56('0x11')](_0xeb56('0x26'),_0x1630b4);logger[_0xeb56('0x22')](_0xeb56('0x26'),_0x1630b4,JSON[_0xeb56('0x14')](_0x28bed1));_0x22a1de(_0x28bed1);})[_0xeb56('0x24')](function(_0xc9d5af){logger[_0xeb56('0x15')](_0xeb56('0x26'),_0xc9d5af['message'],_0x1630b4);_0x347bc5(_0x291ff9[_0xeb56('0x15')](0x1f4,_0xc9d5af[_0xeb56('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.socket.js b/server/api/openchannelQueue/openchannelQueue.socket.js index d7f733b..affb4d9 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 _0x8676=['removeListener','save','remove','emit'];(function(_0x2a7ab2,_0x3dbad9){var _0x5198ab=function(_0x30cb47){while(--_0x30cb47){_0x2a7ab2['push'](_0x2a7ab2['shift']());}};_0x5198ab(++_0x3dbad9);}(_0x8676,0xfd));var _0x6867=function(_0x374b0c,_0x5c264c){_0x374b0c=_0x374b0c-0x0;var _0x108080=_0x8676[_0x374b0c];return _0x108080;};'use strict';var OpenchannelQueueEvents=require('./openchannelQueue.events');var events=[_0x6867('0x0'),_0x6867('0x1'),'update'];function createListener(_0x3519bd,_0x3ed896){return function(_0x17213f){_0x3ed896[_0x6867('0x2')](_0x3519bd,_0x17213f);};}function removeListener(_0x3274df,_0x19757f){return function(){OpenchannelQueueEvents[_0x6867('0x3')](_0x3274df,_0x19757f);};}exports['register']=function(_0x23de5d){for(var _0xc297a6=0x0,_0x320a6b=events['length'];_0xc297a6<_0x320a6b;_0xc297a6++){var _0x160408=events[_0xc297a6];var _0x177216=createListener('openchannelQueue:'+_0x160408,_0x23de5d);OpenchannelQueueEvents['on'](_0x160408,_0x177216);}}; \ No newline at end of file +var _0xa273=['openchannelQueue:','./openchannelQueue.events','remove','emit','removeListener','register','length'];(function(_0x4e84a8,_0x1e04d3){var _0x17c24f=function(_0x3f97d7){while(--_0x3f97d7){_0x4e84a8['push'](_0x4e84a8['shift']());}};_0x17c24f(++_0x1e04d3);}(_0xa273,0xf6));var _0x3a27=function(_0x46faaa,_0x10d92c){_0x46faaa=_0x46faaa-0x0;var _0x2d10e4=_0xa273[_0x46faaa];return _0x2d10e4;};'use strict';var OpenchannelQueueEvents=require(_0x3a27('0x0'));var events=['save',_0x3a27('0x1'),'update'];function createListener(_0x1d3b92,_0x5a7cd2){return function(_0x44fb89){_0x5a7cd2[_0x3a27('0x2')](_0x1d3b92,_0x44fb89);};}function removeListener(_0x226758,_0x1614e9){return function(){OpenchannelQueueEvents[_0x3a27('0x3')](_0x226758,_0x1614e9);};}exports[_0x3a27('0x4')]=function(_0x25a070){for(var _0x68e7b1=0x0,_0x17a675=events[_0x3a27('0x5')];_0x68e7b1<_0x17a675;_0x68e7b1++){var _0x1864b1=events[_0x68e7b1];var _0x6d2329=createListener(_0x3a27('0x6')+_0x1864b1,_0x25a070);OpenchannelQueueEvents['on'](_0x1864b1,_0x6d2329);}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/index.js b/server/api/openchannelQueueReport/index.js index ad49d5d..1dba74d 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 _0x3ded=['exports','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','describe','/:id','show','post','create','put','update','delete'];(function(_0x4da9cb,_0x42b033){var _0x4bf976=function(_0x3af2d6){while(--_0x3af2d6){_0x4da9cb['push'](_0x4da9cb['shift']());}};_0x4bf976(++_0x42b033);}(_0x3ded,0x169));var _0xd3de=function(_0x139a3c,_0x4fc883){_0x139a3c=_0x139a3c-0x0;var _0x2b375b=_0x3ded[_0x139a3c];return _0x2b375b;};'use strict';var multer=require('multer');var util=require(_0xd3de('0x0'));var path=require(_0xd3de('0x1'));var timeout=require('connect-timeout');var express=require(_0xd3de('0x2'));var router=express[_0xd3de('0x3')]();var fs_extra=require(_0xd3de('0x4'));var auth=require(_0xd3de('0x5'));var interaction=require(_0xd3de('0x6'));var config=require(_0xd3de('0x7'));var controller=require('./openchannelQueueReport.controller');router[_0xd3de('0x8')]('/',auth[_0xd3de('0x9')](),controller[_0xd3de('0xa')]);router[_0xd3de('0x8')]('/describe',auth[_0xd3de('0x9')](),controller[_0xd3de('0xb')]);router[_0xd3de('0x8')](_0xd3de('0xc'),auth[_0xd3de('0x9')](),controller[_0xd3de('0xd')]);router[_0xd3de('0xe')]('/',auth[_0xd3de('0x9')](),controller[_0xd3de('0xf')]);router[_0xd3de('0x10')](_0xd3de('0xc'),auth[_0xd3de('0x9')](),controller[_0xd3de('0x11')]);router[_0xd3de('0x12')]('/:id',auth[_0xd3de('0x9')](),controller['destroy']);module[_0xd3de('0x13')]=router; \ No newline at end of file +var _0x6a37=['describe','show','create','put','update','delete','/:id','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelQueueReport.controller','get','isAuthenticated'];(function(_0x255e63,_0x19f0c1){var _0x2f70ae=function(_0x483910){while(--_0x483910){_0x255e63['push'](_0x255e63['shift']());}};_0x2f70ae(++_0x19f0c1);}(_0x6a37,0xbc));var _0x76a3=function(_0x4e676e,_0x2a7c6d){_0x4e676e=_0x4e676e-0x0;var _0x336a3c=_0x6a37[_0x4e676e];return _0x336a3c;};'use strict';var multer=require(_0x76a3('0x0'));var util=require(_0x76a3('0x1'));var path=require('path');var timeout=require(_0x76a3('0x2'));var express=require(_0x76a3('0x3'));var router=express[_0x76a3('0x4')]();var fs_extra=require(_0x76a3('0x5'));var auth=require(_0x76a3('0x6'));var interaction=require(_0x76a3('0x7'));var config=require(_0x76a3('0x8'));var controller=require(_0x76a3('0x9'));router[_0x76a3('0xa')]('/',auth[_0x76a3('0xb')](),controller['index']);router['get']('/describe',auth['isAuthenticated'](),controller[_0x76a3('0xc')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x76a3('0xd')]);router['post']('/',auth[_0x76a3('0xb')](),controller[_0x76a3('0xe')]);router[_0x76a3('0xf')]('/:id',auth[_0x76a3('0xb')](),controller[_0x76a3('0x10')]);router[_0x76a3('0x11')](_0x76a3('0x12'),auth[_0x76a3('0xb')](),controller['destroy']);module[_0x76a3('0x13')]=router; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js b/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js index b90b501..4b7f3b6 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 _0x54ac=['sequelize','STRING','DATE','moment'];(function(_0xffda80,_0x5f17f0){var _0x38391c=function(_0xcb52e1){while(--_0xcb52e1){_0xffda80['push'](_0xffda80['shift']());}};_0x38391c(++_0x5f17f0);}(_0x54ac,0x133));var _0xc54a=function(_0x1f75e8,_0x7fa97f){_0x1f75e8=_0x1f75e8-0x0;var _0x120699=_0x54ac[_0x1f75e8];return _0x120699;};'use strict';var moment=require(_0xc54a('0x0'));var Sequelize=require(_0xc54a('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0xc54a('0x2')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0xc54a('0x3')]},'leaveAt':{'type':Sequelize[_0xc54a('0x3')]},'acceptAt':{'type':Sequelize[_0xc54a('0x3')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0xc54a('0x2')]}}; \ No newline at end of file +var _0x5a81=['STRING','DATE','sequelize','exports'];(function(_0xab3e6a,_0xa3278b){var _0x47fa47=function(_0x129195){while(--_0x129195){_0xab3e6a['push'](_0xab3e6a['shift']());}};_0x47fa47(++_0xa3278b);}(_0x5a81,0x92));var _0x15a8=function(_0x3f4553,_0x5ed68e){_0x3f4553=_0x3f4553-0x0;var _0x130b63=_0x5a81[_0x3f4553];return _0x130b63;};'use strict';var moment=require('moment');var Sequelize=require(_0x15a8('0x0'));module[_0x15a8('0x1')]={'uniqueid':{'type':Sequelize[_0x15a8('0x2')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0x15a8('0x3')]},'exitAt':{'type':Sequelize[_0x15a8('0x3')]},'reason':{'type':Sequelize[_0x15a8('0x2')]}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.controller.js b/server/api/openchannelQueueReport/openchannelQueueReport.controller.js index e3f1696..5674eba 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 _0xbd23=['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/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','update','then','error','stack','name','send','index','map','OpenchannelQueueReport','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','filter','options','includeAll','include','findAll','rows','params','keys','find','catch','create','body','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path'];(function(_0x5f3ef9,_0x4c8a49){var _0x4d978b=function(_0x4ca0a0){while(--_0x4ca0a0){_0x5f3ef9['push'](_0x5f3ef9['shift']());}};_0x4d978b(++_0x4c8a49);}(_0xbd23,0xe5));var _0x3bd2=function(_0x2517c1,_0x2fc46b){_0x2517c1=_0x2517c1-0x0;var _0x4a7c2f=_0xbd23[_0x2517c1];return _0x4a7c2f;};'use strict';var emlformat=require(_0x3bd2('0x0'));var rimraf=require(_0x3bd2('0x1'));var zipdir=require(_0x3bd2('0x2'));var jsonpatch=require(_0x3bd2('0x3'));var rp=require(_0x3bd2('0x4'));var moment=require('moment');var BPromise=require(_0x3bd2('0x5'));var Mustache=require(_0x3bd2('0x6'));var util=require('util');var path=require(_0x3bd2('0x7'));var sox=require(_0x3bd2('0x8'));var csv=require(_0x3bd2('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3bd2('0xa'));var _=require(_0x3bd2('0xb'));var squel=require(_0x3bd2('0xc'));var crypto=require(_0x3bd2('0xd'));var jsforce=require(_0x3bd2('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x3bd2('0x9'));var querystring=require(_0x3bd2('0xf'));var Papa=require(_0x3bd2('0x10'));var Redis=require('ioredis');var authService=require(_0x3bd2('0x11'));var qs=require(_0x3bd2('0x12'));var as=require(_0x3bd2('0x13'));var hardwareService=require(_0x3bd2('0x14'));var logger=require(_0x3bd2('0x15'))(_0x3bd2('0x16'));var utils=require(_0x3bd2('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x3bd2('0x18'));var db=require(_0x3bd2('0x19'))['db'];function respondWithStatusCode(_0x18fadf,_0x4bfae5){_0x4bfae5=_0x4bfae5||0xcc;return function(_0x5a2ed6){if(_0x5a2ed6){return _0x18fadf[_0x3bd2('0x1a')](_0x4bfae5);}return _0x18fadf['status'](_0x4bfae5)[_0x3bd2('0x1b')]();};}function respondWithResult(_0x2d2b55,_0x4d72e5){_0x4d72e5=_0x4d72e5||0xc8;return function(_0x368fcb){if(_0x368fcb){return _0x2d2b55[_0x3bd2('0x1c')](_0x4d72e5)[_0x3bd2('0x1d')](_0x368fcb);}};}function respondWithFilteredResult(_0x37fcf4,_0x4060a4){return function(_0x3e7bb8){if(_0x3e7bb8){var _0x4fcca9=typeof _0x4060a4[_0x3bd2('0x1e')]===_0x3bd2('0x1f')&&typeof _0x4060a4['limit']===_0x3bd2('0x1f');var _0x2fad17=_0x3e7bb8[_0x3bd2('0x20')];var _0x1f5cb0=_0x4fcca9?0x0:_0x4060a4[_0x3bd2('0x1e')];var _0x248a59=_0x4fcca9?_0x3e7bb8[_0x3bd2('0x20')]:_0x4060a4[_0x3bd2('0x1e')]+_0x4060a4[_0x3bd2('0x21')];var _0x485b34;if(_0x248a59>=_0x2fad17){_0x248a59=_0x2fad17;_0x485b34=0xc8;}else{_0x485b34=0xce;}_0x37fcf4[_0x3bd2('0x1c')](_0x485b34);return _0x37fcf4[_0x3bd2('0x22')](_0x3bd2('0x23'),_0x1f5cb0+'-'+_0x248a59+'/'+_0x2fad17)[_0x3bd2('0x1d')](_0x3e7bb8);}return null;};}function patchUpdates(_0x3922aa){return function(_0x11e988){try{jsonpatch[_0x3bd2('0x24')](_0x11e988,_0x3922aa,!![]);}catch(_0x42a704){return BPromise[_0x3bd2('0x25')](_0x42a704);}return _0x11e988['save']();};}function saveUpdates(_0x28b6ec,_0xd9be96){return function(_0x1a6c3e){if(_0x1a6c3e){return _0x1a6c3e[_0x3bd2('0x26')](_0x28b6ec)[_0x3bd2('0x27')](function(_0x573144){return _0x573144;});}return null;};}function removeEntity(_0x15cf3d,_0x4baeb1){return function(_0x3eae14){if(_0x3eae14){return _0x3eae14['destroy']()['then'](function(){_0x15cf3d[_0x3bd2('0x1c')](0xcc)[_0x3bd2('0x1b')]();});}};}function handleEntityNotFound(_0x5c0a0d,_0x1070b1){return function(_0x491772){if(!_0x491772){_0x5c0a0d[_0x3bd2('0x1a')](0x194);}return _0x491772;};}function handleError(_0x1474c3,_0x39c310){_0x39c310=_0x39c310||0x1f4;return function(_0x1541d3){logger[_0x3bd2('0x28')](_0x1541d3[_0x3bd2('0x29')]);if(_0x1541d3[_0x3bd2('0x2a')]){delete _0x1541d3[_0x3bd2('0x2a')];}_0x1474c3['status'](_0x39c310)[_0x3bd2('0x2b')](_0x1541d3);};}exports[_0x3bd2('0x2c')]=function(_0x2806d2,_0x3d2cac){var _0x4ec858={},_0x2ddbb9={},_0x8dc202={'count':0x0,'rows':[]};var _0x245261=_[_0x3bd2('0x2d')](db[_0x3bd2('0x2e')][_0x3bd2('0x2f')],function(_0x219dad){return{'name':_0x219dad[_0x3bd2('0x30')],'type':_0x219dad[_0x3bd2('0x31')][_0x3bd2('0x32')]};});_0x2ddbb9[_0x3bd2('0x33')]=_[_0x3bd2('0x2d')](_0x245261,'name');_0x2ddbb9[_0x3bd2('0x34')]=_['keys'](_0x2806d2[_0x3bd2('0x34')]);_0x2ddbb9[_0x3bd2('0x35')]=_[_0x3bd2('0x36')](_0x2ddbb9[_0x3bd2('0x33')],_0x2ddbb9['query']);_0x4ec858[_0x3bd2('0x37')]=_['intersection'](_0x2ddbb9['model'],qs['fields'](_0x2806d2[_0x3bd2('0x34')][_0x3bd2('0x38')]));_0x4ec858[_0x3bd2('0x37')]=_0x4ec858[_0x3bd2('0x37')][_0x3bd2('0x39')]?_0x4ec858[_0x3bd2('0x37')]:_0x2ddbb9[_0x3bd2('0x33')];if(!_0x2806d2['query'][_0x3bd2('0x3a')](_0x3bd2('0x3b'))){_0x4ec858[_0x3bd2('0x21')]=qs[_0x3bd2('0x21')](_0x2806d2[_0x3bd2('0x34')][_0x3bd2('0x21')]);_0x4ec858['offset']=qs[_0x3bd2('0x1e')](_0x2806d2[_0x3bd2('0x34')][_0x3bd2('0x1e')]);}_0x4ec858[_0x3bd2('0x3c')]=qs[_0x3bd2('0x3d')](_0x2806d2[_0x3bd2('0x34')][_0x3bd2('0x3d')]);_0x4ec858[_0x3bd2('0x3e')]=qs[_0x3bd2('0x35')](_[_0x3bd2('0x3f')](_0x2806d2[_0x3bd2('0x34')],_0x2ddbb9[_0x3bd2('0x35')]),_0x245261);if(_0x2806d2['query']['filter']){_0x4ec858[_0x3bd2('0x3e')]=_[_0x3bd2('0x40')](_0x4ec858[_0x3bd2('0x3e')],{'$or':_[_0x3bd2('0x2d')](_0x245261,function(_0x3cb9fe){if(_0x3cb9fe[_0x3bd2('0x31')]!=='VIRTUAL'){var _0x13fd4f={};_0x13fd4f[_0x3cb9fe['name']]={'$like':'%'+_0x2806d2[_0x3bd2('0x34')][_0x3bd2('0x41')]+'%'};return _0x13fd4f;}})});}_0x4ec858=_[_0x3bd2('0x40')]({},_0x4ec858,_0x2806d2[_0x3bd2('0x42')]);var _0x1b7a4e={'where':_0x4ec858[_0x3bd2('0x3e')]};return db['OpenchannelQueueReport'][_0x3bd2('0x20')](_0x1b7a4e)[_0x3bd2('0x27')](function(_0x4d8b27){_0x8dc202['count']=_0x4d8b27;if(_0x2806d2[_0x3bd2('0x34')][_0x3bd2('0x43')]){_0x4ec858[_0x3bd2('0x44')]=[{'all':!![]}];}return db['OpenchannelQueueReport'][_0x3bd2('0x45')](_0x4ec858);})[_0x3bd2('0x27')](function(_0x3b0570){_0x8dc202[_0x3bd2('0x46')]=_0x3b0570;return _0x8dc202;})['then'](respondWithFilteredResult(_0x3d2cac,_0x4ec858))['catch'](handleError(_0x3d2cac,null));};exports['show']=function(_0x418a82,_0x4e5095){var _0x1776af={'raw':!![],'where':{'id':_0x418a82[_0x3bd2('0x47')]['id']}},_0x4caa1e={};_0x4caa1e[_0x3bd2('0x33')]=_[_0x3bd2('0x48')](db[_0x3bd2('0x2e')]['rawAttributes']);_0x4caa1e[_0x3bd2('0x34')]=_[_0x3bd2('0x48')](_0x418a82['query']);_0x4caa1e[_0x3bd2('0x35')]=_[_0x3bd2('0x36')](_0x4caa1e[_0x3bd2('0x33')],_0x4caa1e[_0x3bd2('0x34')]);_0x1776af[_0x3bd2('0x37')]=_[_0x3bd2('0x36')](_0x4caa1e[_0x3bd2('0x33')],qs[_0x3bd2('0x38')](_0x418a82[_0x3bd2('0x34')][_0x3bd2('0x38')]));_0x1776af[_0x3bd2('0x37')]=_0x1776af[_0x3bd2('0x37')]['length']?_0x1776af[_0x3bd2('0x37')]:_0x4caa1e[_0x3bd2('0x33')];if(_0x418a82[_0x3bd2('0x34')][_0x3bd2('0x43')]){_0x1776af[_0x3bd2('0x44')]=[{'all':!![]}];}_0x1776af=_[_0x3bd2('0x40')]({},_0x1776af,_0x418a82['options']);return db[_0x3bd2('0x2e')][_0x3bd2('0x49')](_0x1776af)[_0x3bd2('0x27')](handleEntityNotFound(_0x4e5095,null))[_0x3bd2('0x27')](respondWithResult(_0x4e5095,null))[_0x3bd2('0x4a')](handleError(_0x4e5095,null));};exports[_0x3bd2('0x4b')]=function(_0x5ee43b,_0x41620a){return db[_0x3bd2('0x2e')][_0x3bd2('0x4b')](_0x5ee43b[_0x3bd2('0x4c')],{})[_0x3bd2('0x27')](respondWithResult(_0x41620a,0xc9))['catch'](handleError(_0x41620a,null));};exports[_0x3bd2('0x26')]=function(_0x10a2ef,_0x4360ba){if(_0x10a2ef['body']['id']){delete _0x10a2ef['body']['id'];}return db[_0x3bd2('0x2e')][_0x3bd2('0x49')]({'where':{'id':_0x10a2ef['params']['id']}})[_0x3bd2('0x27')](handleEntityNotFound(_0x4360ba,null))[_0x3bd2('0x27')](saveUpdates(_0x10a2ef['body'],null))[_0x3bd2('0x27')](respondWithResult(_0x4360ba,null))[_0x3bd2('0x4a')](handleError(_0x4360ba,null));};exports[_0x3bd2('0x4d')]=function(_0x13426a,_0x39bdde){return db[_0x3bd2('0x2e')][_0x3bd2('0x49')]({'where':{'id':_0x13426a[_0x3bd2('0x47')]['id']}})['then'](handleEntityNotFound(_0x39bdde,null))['then'](removeEntity(_0x39bdde,null))[_0x3bd2('0x4a')](handleError(_0x39bdde,null));};exports['describe']=function(_0x1b4557,_0x2816b5){return db[_0x3bd2('0x2e')][_0x3bd2('0x4e')]()['then'](respondWithResult(_0x2816b5,null))[_0x3bd2('0x4a')](handleError(_0x2816b5,null));}; \ No newline at end of file +var _0xa660=['error','name','index','map','OpenchannelQueueReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','hasOwnProperty','nolimit','limit','sort','where','merge','VIRTUAL','filter','options','includeAll','include','rows','catch','show','fields','length','find','create','body','params','destroy','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','count','offset','set','Content-Range','apply','reject','save','update','then'];(function(_0x24a398,_0x68e471){var _0x5e2566=function(_0x1bfb70){while(--_0x1bfb70){_0x24a398['push'](_0x24a398['shift']());}};_0x5e2566(++_0x68e471);}(_0xa660,0x159));var _0x0a66=function(_0x4d1a63,_0x3e1504){_0x4d1a63=_0x4d1a63-0x0;var _0x1f574c=_0xa660[_0x4d1a63];return _0x1f574c;};'use strict';var emlformat=require(_0x0a66('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x0a66('0x1'));var jsonpatch=require(_0x0a66('0x2'));var rp=require(_0x0a66('0x3'));var moment=require(_0x0a66('0x4'));var BPromise=require(_0x0a66('0x5'));var Mustache=require(_0x0a66('0x6'));var util=require(_0x0a66('0x7'));var path=require(_0x0a66('0x8'));var sox=require(_0x0a66('0x9'));var csv=require(_0x0a66('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0a66('0xb'));var _=require(_0x0a66('0xc'));var squel=require(_0x0a66('0xd'));var crypto=require(_0x0a66('0xe'));var jsforce=require(_0x0a66('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x0a66('0xa'));var querystring=require(_0x0a66('0x10'));var Papa=require(_0x0a66('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x0a66('0x12'));var as=require(_0x0a66('0x13'));var hardwareService=require(_0x0a66('0x14'));var logger=require('../../config/logger')(_0x0a66('0x15'));var utils=require(_0x0a66('0x16'));var config=require(_0x0a66('0x17'));var licenseUtil=require(_0x0a66('0x18'));var db=require(_0x0a66('0x19'))['db'];function respondWithStatusCode(_0x27041a,_0xe9961d){_0xe9961d=_0xe9961d||0xcc;return function(_0x545a06){if(_0x545a06){return _0x27041a[_0x0a66('0x1a')](_0xe9961d);}return _0x27041a[_0x0a66('0x1b')](_0xe9961d)[_0x0a66('0x1c')]();};}function respondWithResult(_0x276df0,_0x8b690){_0x8b690=_0x8b690||0xc8;return function(_0x13d791){if(_0x13d791){return _0x276df0[_0x0a66('0x1b')](_0x8b690)[_0x0a66('0x1d')](_0x13d791);}};}function respondWithFilteredResult(_0x13e7b5,_0x46b39c){return function(_0x563127){if(_0x563127){var _0x4fc382=typeof _0x46b39c['offset']===_0x0a66('0x1e')&&typeof _0x46b39c['limit']==='undefined';var _0x28cc36=_0x563127[_0x0a66('0x1f')];var _0x59747b=_0x4fc382?0x0:_0x46b39c['offset'];var _0x1d29f7=_0x4fc382?_0x563127[_0x0a66('0x1f')]:_0x46b39c[_0x0a66('0x20')]+_0x46b39c['limit'];var _0x2d9a40;if(_0x1d29f7>=_0x28cc36){_0x1d29f7=_0x28cc36;_0x2d9a40=0xc8;}else{_0x2d9a40=0xce;}_0x13e7b5[_0x0a66('0x1b')](_0x2d9a40);return _0x13e7b5[_0x0a66('0x21')](_0x0a66('0x22'),_0x59747b+'-'+_0x1d29f7+'/'+_0x28cc36)[_0x0a66('0x1d')](_0x563127);}return null;};}function patchUpdates(_0xfb59e9){return function(_0x5c6c63){try{jsonpatch[_0x0a66('0x23')](_0x5c6c63,_0xfb59e9,!![]);}catch(_0x2f0eab){return BPromise[_0x0a66('0x24')](_0x2f0eab);}return _0x5c6c63[_0x0a66('0x25')]();};}function saveUpdates(_0x24851c,_0x40cabd){return function(_0x383a5f){if(_0x383a5f){return _0x383a5f[_0x0a66('0x26')](_0x24851c)[_0x0a66('0x27')](function(_0x2cdc8e){return _0x2cdc8e;});}return null;};}function removeEntity(_0x369fd5,_0x15c1f0){return function(_0xb04b0){if(_0xb04b0){return _0xb04b0['destroy']()[_0x0a66('0x27')](function(){_0x369fd5['status'](0xcc)[_0x0a66('0x1c')]();});}};}function handleEntityNotFound(_0x410750,_0xf231a1){return function(_0x3df420){if(!_0x3df420){_0x410750[_0x0a66('0x1a')](0x194);}return _0x3df420;};}function handleError(_0xb2ec07,_0x32d6dd){_0x32d6dd=_0x32d6dd||0x1f4;return function(_0x255411){logger[_0x0a66('0x28')](_0x255411['stack']);if(_0x255411['name']){delete _0x255411[_0x0a66('0x29')];}_0xb2ec07[_0x0a66('0x1b')](_0x32d6dd)['send'](_0x255411);};}exports[_0x0a66('0x2a')]=function(_0x18ed7b,_0x1855ce){var _0x18a067={},_0x3e828d={},_0xbf0307={'count':0x0,'rows':[]};var _0x230fce=_[_0x0a66('0x2b')](db[_0x0a66('0x2c')][_0x0a66('0x2d')],function(_0x4e0ab5){return{'name':_0x4e0ab5[_0x0a66('0x2e')],'type':_0x4e0ab5[_0x0a66('0x2f')][_0x0a66('0x30')]};});_0x3e828d[_0x0a66('0x31')]=_['map'](_0x230fce,'name');_0x3e828d[_0x0a66('0x32')]=_[_0x0a66('0x33')](_0x18ed7b['query']);_0x3e828d[_0x0a66('0x34')]=_[_0x0a66('0x35')](_0x3e828d[_0x0a66('0x31')],_0x3e828d[_0x0a66('0x32')]);_0x18a067['attributes']=_[_0x0a66('0x35')](_0x3e828d[_0x0a66('0x31')],qs['fields'](_0x18ed7b['query']['fields']));_0x18a067['attributes']=_0x18a067[_0x0a66('0x36')]['length']?_0x18a067[_0x0a66('0x36')]:_0x3e828d['model'];if(!_0x18ed7b['query'][_0x0a66('0x37')](_0x0a66('0x38'))){_0x18a067['limit']=qs[_0x0a66('0x39')](_0x18ed7b['query']['limit']);_0x18a067[_0x0a66('0x20')]=qs[_0x0a66('0x20')](_0x18ed7b[_0x0a66('0x32')][_0x0a66('0x20')]);}_0x18a067['order']=qs[_0x0a66('0x3a')](_0x18ed7b[_0x0a66('0x32')]['sort']);_0x18a067['where']=qs[_0x0a66('0x34')](_['pick'](_0x18ed7b[_0x0a66('0x32')],_0x3e828d[_0x0a66('0x34')]),_0x230fce);if(_0x18ed7b[_0x0a66('0x32')]['filter']){_0x18a067[_0x0a66('0x3b')]=_[_0x0a66('0x3c')](_0x18a067[_0x0a66('0x3b')],{'$or':_[_0x0a66('0x2b')](_0x230fce,function(_0x587640){if(_0x587640[_0x0a66('0x2f')]!==_0x0a66('0x3d')){var _0x468f7d={};_0x468f7d[_0x587640[_0x0a66('0x29')]]={'$like':'%'+_0x18ed7b[_0x0a66('0x32')][_0x0a66('0x3e')]+'%'};return _0x468f7d;}})});}_0x18a067=_['merge']({},_0x18a067,_0x18ed7b[_0x0a66('0x3f')]);var _0x240360={'where':_0x18a067['where']};return db[_0x0a66('0x2c')][_0x0a66('0x1f')](_0x240360)[_0x0a66('0x27')](function(_0x745ec5){_0xbf0307['count']=_0x745ec5;if(_0x18ed7b[_0x0a66('0x32')][_0x0a66('0x40')]){_0x18a067[_0x0a66('0x41')]=[{'all':!![]}];}return db[_0x0a66('0x2c')]['findAll'](_0x18a067);})[_0x0a66('0x27')](function(_0x3a3749){_0xbf0307[_0x0a66('0x42')]=_0x3a3749;return _0xbf0307;})[_0x0a66('0x27')](respondWithFilteredResult(_0x1855ce,_0x18a067))[_0x0a66('0x43')](handleError(_0x1855ce,null));};exports[_0x0a66('0x44')]=function(_0x4712dc,_0x3ffd73){var _0x590b47={'raw':!![],'where':{'id':_0x4712dc['params']['id']}},_0x41040b={};_0x41040b['model']=_[_0x0a66('0x33')](db['OpenchannelQueueReport']['rawAttributes']);_0x41040b[_0x0a66('0x32')]=_[_0x0a66('0x33')](_0x4712dc['query']);_0x41040b[_0x0a66('0x34')]=_[_0x0a66('0x35')](_0x41040b['model'],_0x41040b[_0x0a66('0x32')]);_0x590b47[_0x0a66('0x36')]=_[_0x0a66('0x35')](_0x41040b[_0x0a66('0x31')],qs[_0x0a66('0x45')](_0x4712dc[_0x0a66('0x32')][_0x0a66('0x45')]));_0x590b47[_0x0a66('0x36')]=_0x590b47[_0x0a66('0x36')][_0x0a66('0x46')]?_0x590b47[_0x0a66('0x36')]:_0x41040b[_0x0a66('0x31')];if(_0x4712dc[_0x0a66('0x32')][_0x0a66('0x40')]){_0x590b47[_0x0a66('0x41')]=[{'all':!![]}];}_0x590b47=_[_0x0a66('0x3c')]({},_0x590b47,_0x4712dc[_0x0a66('0x3f')]);return db['OpenchannelQueueReport'][_0x0a66('0x47')](_0x590b47)[_0x0a66('0x27')](handleEntityNotFound(_0x3ffd73,null))[_0x0a66('0x27')](respondWithResult(_0x3ffd73,null))['catch'](handleError(_0x3ffd73,null));};exports[_0x0a66('0x48')]=function(_0x27a286,_0x5b1532){return db['OpenchannelQueueReport'][_0x0a66('0x48')](_0x27a286[_0x0a66('0x49')],{})[_0x0a66('0x27')](respondWithResult(_0x5b1532,0xc9))[_0x0a66('0x43')](handleError(_0x5b1532,null));};exports['update']=function(_0x56db31,_0x13c06f){if(_0x56db31[_0x0a66('0x49')]['id']){delete _0x56db31[_0x0a66('0x49')]['id'];}return db['OpenchannelQueueReport'][_0x0a66('0x47')]({'where':{'id':_0x56db31[_0x0a66('0x4a')]['id']}})[_0x0a66('0x27')](handleEntityNotFound(_0x13c06f,null))['then'](saveUpdates(_0x56db31['body'],null))[_0x0a66('0x27')](respondWithResult(_0x13c06f,null))[_0x0a66('0x43')](handleError(_0x13c06f,null));};exports[_0x0a66('0x4b')]=function(_0x479586,_0x36b0d6){return db[_0x0a66('0x2c')][_0x0a66('0x47')]({'where':{'id':_0x479586[_0x0a66('0x4a')]['id']}})[_0x0a66('0x27')](handleEntityNotFound(_0x36b0d6,null))['then'](removeEntity(_0x36b0d6,null))[_0x0a66('0x43')](handleError(_0x36b0d6,null));};exports[_0x0a66('0x4c')]=function(_0x142be0,_0x416314){return db[_0x0a66('0x2c')][_0x0a66('0x4c')]()[_0x0a66('0x27')](respondWithResult(_0x416314,null))['catch'](handleError(_0x416314,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.model.js b/server/api/openchannelQueueReport/openchannelQueueReport.model.js index 27e5339..ec0e92b 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 _0x326f=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelQueueReport.attributes','exports','define','OpenchannelQueueReport','report_openchannel_queue','uniqueid','lodash'];(function(_0xc32883,_0x1aa16a){var _0x5c006b=function(_0x58d71b){while(--_0x58d71b){_0xc32883['push'](_0xc32883['shift']());}};_0x5c006b(++_0x1aa16a);}(_0x326f,0xd1));var _0xf326=function(_0x6e27b2,_0x33233e){_0x6e27b2=_0x6e27b2-0x0;var _0x47f319=_0x326f[_0x6e27b2];return _0x47f319;};'use strict';var _=require(_0xf326('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xf326('0x1'));var moment=require(_0xf326('0x2'));var BPromise=require(_0xf326('0x3'));var rp=require(_0xf326('0x4'));var fs=require('fs');var path=require(_0xf326('0x5'));var rimraf=require(_0xf326('0x6'));var config=require(_0xf326('0x7'));var attributes=require(_0xf326('0x8'));module[_0xf326('0x9')]=function(_0x3ace29,_0x4c2249){return _0x3ace29[_0xf326('0xa')](_0xf326('0xb'),attributes,{'tableName':_0xf326('0xc'),'paranoid':![],'indexes':[{'name':_0xf326('0xd'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x5fc3=['util','api','moment','bluebird','request-promise','path','../../config/environment','./openchannelQueueReport.attributes','exports','define','report_openchannel_queue','uniqueid','lodash'];(function(_0x3f4100,_0x54582e){var _0x48fff1=function(_0x1b1d8d){while(--_0x1b1d8d){_0x3f4100['push'](_0x3f4100['shift']());}};_0x48fff1(++_0x54582e);}(_0x5fc3,0xa8));var _0x35fc=function(_0x269ee8,_0x477226){_0x269ee8=_0x269ee8-0x0;var _0x4d98bd=_0x5fc3[_0x269ee8];return _0x4d98bd;};'use strict';var _=require(_0x35fc('0x0'));var util=require(_0x35fc('0x1'));var logger=require('../../config/logger')(_0x35fc('0x2'));var moment=require(_0x35fc('0x3'));var BPromise=require(_0x35fc('0x4'));var rp=require(_0x35fc('0x5'));var fs=require('fs');var path=require(_0x35fc('0x6'));var rimraf=require('rimraf');var config=require(_0x35fc('0x7'));var attributes=require(_0x35fc('0x8'));module[_0x35fc('0x9')]=function(_0x5b85ad,_0x5754be){return _0x5b85ad[_0x35fc('0xa')]('OpenchannelQueueReport',attributes,{'tableName':_0x35fc('0xb'),'paranoid':![],'indexes':[{'name':_0x35fc('0xc'),'fields':[_0x35fc('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js b/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js index 253d932..e4bad29 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 _0xcae2=['where','attributes','UpdateOpenchannelQueueReport','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','OpenchannelQueueReport,\x20%s,\x20%s','request\x20sent','debug','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','error','code','message','catch','CreateOpenchannelQueueReport','OpenchannelQueueReport','options','raw','then','stringify','update','body'];(function(_0x197b37,_0x4d6a86){var _0x5af868=function(_0x1327a6){while(--_0x1327a6){_0x197b37['push'](_0x197b37['shift']());}};_0x5af868(++_0x4d6a86);}(_0xcae2,0x143));var _0x2cae=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xcae2[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x2cae('0x0'));var util=require(_0x2cae('0x1'));var moment=require(_0x2cae('0x2'));var BPromise=require(_0x2cae('0x3'));var rs=require(_0x2cae('0x4'));var fs=require('fs');var Redis=require(_0x2cae('0x5'));var db=require(_0x2cae('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x2cae('0x7'))(_0x2cae('0x8'));var config=require(_0x2cae('0x9'));var jayson=require(_0x2cae('0xa'));var client=jayson['client'][_0x2cae('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1feff6,_0x1e1a3d,_0x25b6a2){return new BPromise(function(_0x2e7498,_0x49e1d1){return client['request'](_0x1feff6,_0x25b6a2)['then'](function(_0x49f0d3){logger[_0x2cae('0xc')](_0x2cae('0xd'),_0x1e1a3d,_0x2cae('0xe'));logger[_0x2cae('0xf')](_0x2cae('0x10'),_0x1e1a3d,_0x2cae('0xe'),JSON['stringify'](_0x49f0d3));if(_0x49f0d3[_0x2cae('0x11')]){if(_0x49f0d3['error'][_0x2cae('0x12')]===0x1f4){logger[_0x2cae('0x11')](_0x2cae('0xd'),_0x1e1a3d,_0x49f0d3[_0x2cae('0x11')][_0x2cae('0x13')]);return _0x49e1d1(_0x49f0d3[_0x2cae('0x11')]['message']);}logger[_0x2cae('0x11')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x1e1a3d,_0x49f0d3[_0x2cae('0x11')][_0x2cae('0x13')]);return _0x2e7498(_0x49f0d3['error'][_0x2cae('0x13')]);}else{logger[_0x2cae('0xc')](_0x2cae('0xd'),_0x1e1a3d,_0x2cae('0xe'));_0x2e7498(_0x49f0d3['result'][_0x2cae('0x13')]);}})[_0x2cae('0x14')](function(_0x4a89e1){logger[_0x2cae('0x11')](_0x2cae('0xd'),_0x1e1a3d,_0x4a89e1);_0x49e1d1(_0x4a89e1);});});}exports[_0x2cae('0x15')]=function(_0xe6314f){var _0x2813b1=this;return new Promise(function(_0x164aee,_0x398290){return db[_0x2cae('0x16')]['create'](_0xe6314f['body'],{'raw':_0xe6314f[_0x2cae('0x17')]?_0xe6314f[_0x2cae('0x17')][_0x2cae('0x18')]===undefined?!![]:![]:!![]})[_0x2cae('0x19')](function(_0x2f4f5c){logger[_0x2cae('0xc')](_0x2cae('0x15'),_0xe6314f);logger['debug']('CreateOpenchannelQueueReport',_0xe6314f,JSON[_0x2cae('0x1a')](_0x2f4f5c));_0x164aee(_0x2f4f5c);})[_0x2cae('0x14')](function(_0x5d800e){logger['error']('CreateOpenchannelQueueReport',_0x5d800e[_0x2cae('0x13')],_0xe6314f);_0x398290(_0x2813b1[_0x2cae('0x11')](0x1f4,_0x5d800e['message']));});});};exports['UpdateOpenchannelQueueReport']=function(_0x309ae3){var _0x1c8063=this;return new Promise(function(_0x407324,_0x2fdc92){return db[_0x2cae('0x16')][_0x2cae('0x1b')](_0x309ae3[_0x2cae('0x1c')],{'raw':_0x309ae3[_0x2cae('0x17')]?_0x309ae3[_0x2cae('0x17')][_0x2cae('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x309ae3[_0x2cae('0x17')]?_0x309ae3[_0x2cae('0x17')][_0x2cae('0x1d')]||null:null,'attributes':_0x309ae3[_0x2cae('0x17')]?_0x309ae3[_0x2cae('0x17')][_0x2cae('0x1e')]||null:null,'limit':_0x309ae3['options']?_0x309ae3['options']['limit']||null:null})['then'](function(_0x7d5421){logger[_0x2cae('0xc')](_0x2cae('0x1f'),_0x309ae3);logger[_0x2cae('0xf')]('UpdateOpenchannelQueueReport',_0x309ae3,JSON[_0x2cae('0x1a')](_0x7d5421));_0x407324(_0x7d5421);})[_0x2cae('0x14')](function(_0xd53da6){logger['error'](_0x2cae('0x1f'),_0xd53da6['message'],_0x309ae3);_0x2fdc92(_0x1c8063[_0x2cae('0x11')](0x1f4,_0xd53da6['message']));});});}; \ No newline at end of file +var _0xefda=['lodash','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','request\x20sent','debug','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','OpenchannelQueueReport,\x20%s,\x20%s','message','info','result','catch','CreateOpenchannelQueueReport','create','body','options','raw','UpdateOpenchannelQueueReport','update'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xefda,0x96));var _0xaefd=function(_0x4794a2,_0x5d31a8){_0x4794a2=_0x4794a2-0x0;var _0x3f146c=_0xefda[_0x4794a2];return _0x3f146c;};'use strict';var _=require(_0xaefd('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xaefd('0x1'));var rs=require(_0xaefd('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xaefd('0x3'))['db'];var utils=require(_0xaefd('0x4'));var logger=require(_0xaefd('0x5'))(_0xaefd('0x6'));var config=require(_0xaefd('0x7'));var jayson=require(_0xaefd('0x8'));var client=jayson['client'][_0xaefd('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3b9736,_0x24d10c,_0x1d76f3){return new BPromise(function(_0x4ce248,_0x15193c){return client[_0xaefd('0xa')](_0x3b9736,_0x1d76f3)[_0xaefd('0xb')](function(_0x4d44ed){logger['info']('OpenchannelQueueReport,\x20%s,\x20%s',_0x24d10c,_0xaefd('0xc'));logger[_0xaefd('0xd')](_0xaefd('0xe'),_0x24d10c,_0xaefd('0xc'),JSON[_0xaefd('0xf')](_0x4d44ed));if(_0x4d44ed[_0xaefd('0x10')]){if(_0x4d44ed[_0xaefd('0x10')][_0xaefd('0x11')]===0x1f4){logger[_0xaefd('0x10')](_0xaefd('0x12'),_0x24d10c,_0x4d44ed[_0xaefd('0x10')]['message']);return _0x15193c(_0x4d44ed[_0xaefd('0x10')]['message']);}logger[_0xaefd('0x10')](_0xaefd('0x12'),_0x24d10c,_0x4d44ed[_0xaefd('0x10')][_0xaefd('0x13')]);return _0x4ce248(_0x4d44ed['error'][_0xaefd('0x13')]);}else{logger[_0xaefd('0x14')](_0xaefd('0x12'),_0x24d10c,_0xaefd('0xc'));_0x4ce248(_0x4d44ed[_0xaefd('0x15')][_0xaefd('0x13')]);}})[_0xaefd('0x16')](function(_0x23d736){logger['error'](_0xaefd('0x12'),_0x24d10c,_0x23d736);_0x15193c(_0x23d736);});});}exports[_0xaefd('0x17')]=function(_0x9748f4){var _0x1737a1=this;return new Promise(function(_0x2db61b,_0x244956){return db['OpenchannelQueueReport'][_0xaefd('0x18')](_0x9748f4[_0xaefd('0x19')],{'raw':_0x9748f4[_0xaefd('0x1a')]?_0x9748f4[_0xaefd('0x1a')][_0xaefd('0x1b')]===undefined?!![]:![]:!![]})[_0xaefd('0xb')](function(_0x5282ed){logger[_0xaefd('0x14')](_0xaefd('0x17'),_0x9748f4);logger[_0xaefd('0xd')](_0xaefd('0x17'),_0x9748f4,JSON[_0xaefd('0xf')](_0x5282ed));_0x2db61b(_0x5282ed);})['catch'](function(_0x479486){logger['error'](_0xaefd('0x17'),_0x479486[_0xaefd('0x13')],_0x9748f4);_0x244956(_0x1737a1[_0xaefd('0x10')](0x1f4,_0x479486['message']));});});};exports[_0xaefd('0x1c')]=function(_0x4cd9b2){var _0x3deec8=this;return new Promise(function(_0x3caa99,_0x1a05eb){return db['OpenchannelQueueReport'][_0xaefd('0x1d')](_0x4cd9b2[_0xaefd('0x19')],{'raw':_0x4cd9b2[_0xaefd('0x1a')]?_0x4cd9b2[_0xaefd('0x1a')][_0xaefd('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4cd9b2['options']?_0x4cd9b2[_0xaefd('0x1a')]['where']||null:null,'attributes':_0x4cd9b2[_0xaefd('0x1a')]?_0x4cd9b2[_0xaefd('0x1a')]['attributes']||null:null,'limit':_0x4cd9b2[_0xaefd('0x1a')]?_0x4cd9b2[_0xaefd('0x1a')]['limit']||null:null})[_0xaefd('0xb')](function(_0x114ec0){logger[_0xaefd('0x14')]('UpdateOpenchannelQueueReport',_0x4cd9b2);logger[_0xaefd('0xd')]('UpdateOpenchannelQueueReport',_0x4cd9b2,JSON[_0xaefd('0xf')](_0x114ec0));_0x3caa99(_0x114ec0);})['catch'](function(_0x4a1acb){logger[_0xaefd('0x10')](_0xaefd('0x1c'),_0x4a1acb['message'],_0x4cd9b2);_0x1a05eb(_0x3deec8['error'](0x1f4,_0x4a1acb['message']));});});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/index.js b/server/api/openchannelTransferReport/index.js index 949aca2..6714e9b 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 _0xaaea=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelTransferReport.controller','get','/describe','isAuthenticated','describe','/:id','post','create','put','update','delete','exports','util','path','connect-timeout','express'];(function(_0x2b7694,_0x4afaa6){var _0x57ff70=function(_0x115f4b){while(--_0x115f4b){_0x2b7694['push'](_0x2b7694['shift']());}};_0x57ff70(++_0x4afaa6);}(_0xaaea,0x1dc));var _0xaaae=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0xaaea[_0x13d07a];return _0x5ee0ee;};'use strict';var multer=require('multer');var util=require(_0xaaae('0x0'));var path=require(_0xaaae('0x1'));var timeout=require(_0xaaae('0x2'));var express=require(_0xaaae('0x3'));var router=express['Router']();var fs_extra=require(_0xaaae('0x4'));var auth=require(_0xaaae('0x5'));var interaction=require(_0xaaae('0x6'));var config=require(_0xaaae('0x7'));var controller=require(_0xaaae('0x8'));router[_0xaaae('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0xaaae('0x9')](_0xaaae('0xa'),auth[_0xaaae('0xb')](),controller[_0xaaae('0xc')]);router['get'](_0xaaae('0xd'),auth[_0xaaae('0xb')](),controller['show']);router[_0xaaae('0xe')]('/',auth[_0xaaae('0xb')](),controller[_0xaaae('0xf')]);router[_0xaaae('0x10')]('/:id',auth[_0xaaae('0xb')](),controller[_0xaaae('0x11')]);router[_0xaaae('0x12')](_0xaaae('0xd'),auth['isAuthenticated'](),controller['destroy']);module[_0xaaae('0x13')]=router; \ No newline at end of file +var _0x7393=['get','/describe','isAuthenticated','show','post','create','put','/:id','update','delete','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x5f7bbe,_0x395d8c){var _0x5a5000=function(_0x334f07){while(--_0x334f07){_0x5f7bbe['push'](_0x5f7bbe['shift']());}};_0x5a5000(++_0x395d8c);}(_0x7393,0x1d8));var _0x3739=function(_0x3a97f6,_0x452367){_0x3a97f6=_0x3a97f6-0x0;var _0x4986ed=_0x7393[_0x3a97f6];return _0x4986ed;};'use strict';var multer=require('multer');var util=require(_0x3739('0x0'));var path=require(_0x3739('0x1'));var timeout=require(_0x3739('0x2'));var express=require(_0x3739('0x3'));var router=express[_0x3739('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x3739('0x5'));var interaction=require(_0x3739('0x6'));var config=require(_0x3739('0x7'));var controller=require('./openchannelTransferReport.controller');router[_0x3739('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x3739('0x8')](_0x3739('0x9'),auth[_0x3739('0xa')](),controller['describe']);router['get']('/:id',auth['isAuthenticated'](),controller[_0x3739('0xb')]);router[_0x3739('0xc')]('/',auth['isAuthenticated'](),controller[_0x3739('0xd')]);router[_0x3739('0xe')](_0x3739('0xf'),auth[_0x3739('0xa')](),controller[_0x3739('0x10')]);router[_0x3739('0x11')](_0x3739('0xf'),auth[_0x3739('0xa')](),controller[_0x3739('0x12')]);module[_0x3739('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 34a9a16..c0dac6d 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 _0x9bde=['NOW','sequelize','STRING','account','agent','queue','DATE'];(function(_0xcfc44,_0x179bc1){var _0x307a25=function(_0x2b64de){while(--_0x2b64de){_0xcfc44['push'](_0xcfc44['shift']());}};_0x307a25(++_0x179bc1);}(_0x9bde,0xe1));var _0xe9bd=function(_0x4d4684,_0x474e56){_0x4d4684=_0x4d4684-0x0;var _0x54cdea=_0x9bde[_0x4d4684];return _0x54cdea;};'use strict';var moment=require('moment');var Sequelize=require(_0xe9bd('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0xe9bd('0x1')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xe9bd('0x2'),_0xe9bd('0x3'),_0xe9bd('0x4')),'allowNull':![],'defaultValue':_0xe9bd('0x4')},'transferredAt':{'type':Sequelize[_0xe9bd('0x5')],'allowNull':![],'defaultValue':Sequelize[_0xe9bd('0x6')]}}; \ No newline at end of file +var _0xf3cd=['exports','STRING','ENUM','account','queue','DATE','moment','sequelize'];(function(_0x1a0073,_0x2c3af7){var _0x50a1a0=function(_0xde4165){while(--_0xde4165){_0x1a0073['push'](_0x1a0073['shift']());}};_0x50a1a0(++_0x2c3af7);}(_0xf3cd,0xfe));var _0xdf3c=function(_0xcb0eb2,_0x3906bf){_0xcb0eb2=_0xcb0eb2-0x0;var _0xbab9b8=_0xf3cd[_0xcb0eb2];return _0xbab9b8;};'use strict';var moment=require(_0xdf3c('0x0'));var Sequelize=require(_0xdf3c('0x1'));module[_0xdf3c('0x2')]={'uniqueid':{'type':Sequelize[_0xdf3c('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0xdf3c('0x4')](_0xdf3c('0x5'),'agent',_0xdf3c('0x6')),'allowNull':![],'defaultValue':_0xdf3c('0x6')},'transferredAt':{'type':Sequelize[_0xdf3c('0x7')],'allowNull':![],'defaultValue':Sequelize['NOW']}}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.controller.js b/server/api/openchannelTransferReport/openchannelTransferReport.controller.js index 675fc1c..3c9a70d 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 _0x37da=['index','map','OpenchannelTransferReport','rawAttributes','fieldName','type','key','model','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','VIRTUAL','options','include','rows','catch','show','params','keys','includeAll','merge','find','create','body','update','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','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','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','save','then','stack','name'];(function(_0x3d563e,_0x33442f){var _0x5b6111=function(_0x4703d9){while(--_0x4703d9){_0x3d563e['push'](_0x3d563e['shift']());}};_0x5b6111(++_0x33442f);}(_0x37da,0xc1));var _0xa37d=function(_0x4bb9c3,_0x59a50c){_0x4bb9c3=_0x4bb9c3-0x0;var _0x464cc4=_0x37da[_0x4bb9c3];return _0x464cc4;};'use strict';var emlformat=require(_0xa37d('0x0'));var rimraf=require(_0xa37d('0x1'));var zipdir=require(_0xa37d('0x2'));var jsonpatch=require(_0xa37d('0x3'));var rp=require(_0xa37d('0x4'));var moment=require(_0xa37d('0x5'));var BPromise=require(_0xa37d('0x6'));var Mustache=require(_0xa37d('0x7'));var util=require('util');var path=require('path');var sox=require(_0xa37d('0x8'));var csv=require(_0xa37d('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xa37d('0xa'));var squel=require(_0xa37d('0xb'));var crypto=require(_0xa37d('0xc'));var jsforce=require(_0xa37d('0xd'));var deskjs=require(_0xa37d('0xe'));var toCsv=require(_0xa37d('0x9'));var querystring=require(_0xa37d('0xf'));var Papa=require(_0xa37d('0x10'));var Redis=require(_0xa37d('0x11'));var authService=require(_0xa37d('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xa37d('0x13'));var hardwareService=require(_0xa37d('0x14'));var logger=require(_0xa37d('0x15'))(_0xa37d('0x16'));var utils=require(_0xa37d('0x17'));var config=require(_0xa37d('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xa37d('0x19'))['db'];function respondWithStatusCode(_0xcec497,_0x8234a8){_0x8234a8=_0x8234a8||0xcc;return function(_0x215705){if(_0x215705){return _0xcec497[_0xa37d('0x1a')](_0x8234a8);}return _0xcec497[_0xa37d('0x1b')](_0x8234a8)[_0xa37d('0x1c')]();};}function respondWithResult(_0x15b0d2,_0xc53119){_0xc53119=_0xc53119||0xc8;return function(_0x4feaeb){if(_0x4feaeb){return _0x15b0d2[_0xa37d('0x1b')](_0xc53119)[_0xa37d('0x1d')](_0x4feaeb);}};}function respondWithFilteredResult(_0x42773c,_0x55cd89){return function(_0x2dab34){if(_0x2dab34){var _0x425c8e=typeof _0x55cd89[_0xa37d('0x1e')]==='undefined'&&typeof _0x55cd89[_0xa37d('0x1f')]===_0xa37d('0x20');var _0xe3e1c6=_0x2dab34[_0xa37d('0x21')];var _0x251bf3=_0x425c8e?0x0:_0x55cd89[_0xa37d('0x1e')];var _0x80df08=_0x425c8e?_0x2dab34[_0xa37d('0x21')]:_0x55cd89[_0xa37d('0x1e')]+_0x55cd89['limit'];var _0x1757f8;if(_0x80df08>=_0xe3e1c6){_0x80df08=_0xe3e1c6;_0x1757f8=0xc8;}else{_0x1757f8=0xce;}_0x42773c[_0xa37d('0x1b')](_0x1757f8);return _0x42773c[_0xa37d('0x22')](_0xa37d('0x23'),_0x251bf3+'-'+_0x80df08+'/'+_0xe3e1c6)[_0xa37d('0x1d')](_0x2dab34);}return null;};}function patchUpdates(_0x30c78){return function(_0x53083f){try{jsonpatch[_0xa37d('0x24')](_0x53083f,_0x30c78,!![]);}catch(_0x497e94){return BPromise['reject'](_0x497e94);}return _0x53083f[_0xa37d('0x25')]();};}function saveUpdates(_0x3cbd63,_0x1e0cb0){return function(_0x2464b3){if(_0x2464b3){return _0x2464b3['update'](_0x3cbd63)[_0xa37d('0x26')](function(_0x223d81){return _0x223d81;});}return null;};}function removeEntity(_0x423c3a,_0x4c25bc){return function(_0xfbf9bd){if(_0xfbf9bd){return _0xfbf9bd['destroy']()['then'](function(){_0x423c3a[_0xa37d('0x1b')](0xcc)[_0xa37d('0x1c')]();});}};}function handleEntityNotFound(_0x17b1b1,_0x4dad1f){return function(_0x5edc7d){if(!_0x5edc7d){_0x17b1b1['sendStatus'](0x194);}return _0x5edc7d;};}function handleError(_0x31709d,_0xf42db2){_0xf42db2=_0xf42db2||0x1f4;return function(_0x483dba){logger['error'](_0x483dba[_0xa37d('0x27')]);if(_0x483dba[_0xa37d('0x28')]){delete _0x483dba['name'];}_0x31709d['status'](_0xf42db2)['send'](_0x483dba);};}exports[_0xa37d('0x29')]=function(_0x2ec041,_0x3b4f40){var _0x480368={},_0x3dad27={},_0x3b6d35={'count':0x0,'rows':[]};var _0x17d25f=_[_0xa37d('0x2a')](db[_0xa37d('0x2b')][_0xa37d('0x2c')],function(_0x166d03){return{'name':_0x166d03[_0xa37d('0x2d')],'type':_0x166d03[_0xa37d('0x2e')][_0xa37d('0x2f')]};});_0x3dad27[_0xa37d('0x30')]=_['map'](_0x17d25f,'name');_0x3dad27[_0xa37d('0x31')]=_['keys'](_0x2ec041['query']);_0x3dad27['filters']=_[_0xa37d('0x32')](_0x3dad27[_0xa37d('0x30')],_0x3dad27['query']);_0x480368['attributes']=_[_0xa37d('0x32')](_0x3dad27['model'],qs[_0xa37d('0x33')](_0x2ec041[_0xa37d('0x31')]['fields']));_0x480368['attributes']=_0x480368[_0xa37d('0x34')][_0xa37d('0x35')]?_0x480368[_0xa37d('0x34')]:_0x3dad27[_0xa37d('0x30')];if(!_0x2ec041[_0xa37d('0x31')][_0xa37d('0x36')](_0xa37d('0x37'))){_0x480368[_0xa37d('0x1f')]=qs[_0xa37d('0x1f')](_0x2ec041['query'][_0xa37d('0x1f')]);_0x480368[_0xa37d('0x1e')]=qs[_0xa37d('0x1e')](_0x2ec041[_0xa37d('0x31')]['offset']);}_0x480368[_0xa37d('0x38')]=qs[_0xa37d('0x39')](_0x2ec041[_0xa37d('0x31')]['sort']);_0x480368[_0xa37d('0x3a')]=qs[_0xa37d('0x3b')](_[_0xa37d('0x3c')](_0x2ec041['query'],_0x3dad27[_0xa37d('0x3b')]),_0x17d25f);if(_0x2ec041['query'][_0xa37d('0x3d')]){_0x480368['where']=_['merge'](_0x480368[_0xa37d('0x3a')],{'$or':_['map'](_0x17d25f,function(_0x13805b){if(_0x13805b[_0xa37d('0x2e')]!==_0xa37d('0x3e')){var _0x397e39={};_0x397e39[_0x13805b[_0xa37d('0x28')]]={'$like':'%'+_0x2ec041[_0xa37d('0x31')][_0xa37d('0x3d')]+'%'};return _0x397e39;}})});}_0x480368=_['merge']({},_0x480368,_0x2ec041[_0xa37d('0x3f')]);var _0x4c7a13={'where':_0x480368[_0xa37d('0x3a')]};return db[_0xa37d('0x2b')][_0xa37d('0x21')](_0x4c7a13)[_0xa37d('0x26')](function(_0x3b2735){_0x3b6d35['count']=_0x3b2735;if(_0x2ec041[_0xa37d('0x31')]['includeAll']){_0x480368[_0xa37d('0x40')]=[{'all':!![]}];}return db[_0xa37d('0x2b')]['findAll'](_0x480368);})[_0xa37d('0x26')](function(_0x189541){_0x3b6d35[_0xa37d('0x41')]=_0x189541;return _0x3b6d35;})[_0xa37d('0x26')](respondWithFilteredResult(_0x3b4f40,_0x480368))[_0xa37d('0x42')](handleError(_0x3b4f40,null));};exports[_0xa37d('0x43')]=function(_0x57c827,_0x34ec68){var _0x101e78={'raw':!![],'where':{'id':_0x57c827[_0xa37d('0x44')]['id']}},_0x5ef753={};_0x5ef753[_0xa37d('0x30')]=_[_0xa37d('0x45')](db[_0xa37d('0x2b')][_0xa37d('0x2c')]);_0x5ef753[_0xa37d('0x31')]=_[_0xa37d('0x45')](_0x57c827[_0xa37d('0x31')]);_0x5ef753[_0xa37d('0x3b')]=_[_0xa37d('0x32')](_0x5ef753[_0xa37d('0x30')],_0x5ef753[_0xa37d('0x31')]);_0x101e78['attributes']=_[_0xa37d('0x32')](_0x5ef753['model'],qs['fields'](_0x57c827[_0xa37d('0x31')]['fields']));_0x101e78[_0xa37d('0x34')]=_0x101e78['attributes']['length']?_0x101e78[_0xa37d('0x34')]:_0x5ef753[_0xa37d('0x30')];if(_0x57c827[_0xa37d('0x31')][_0xa37d('0x46')]){_0x101e78['include']=[{'all':!![]}];}_0x101e78=_[_0xa37d('0x47')]({},_0x101e78,_0x57c827['options']);return db['OpenchannelTransferReport'][_0xa37d('0x48')](_0x101e78)['then'](handleEntityNotFound(_0x34ec68,null))[_0xa37d('0x26')](respondWithResult(_0x34ec68,null))[_0xa37d('0x42')](handleError(_0x34ec68,null));};exports[_0xa37d('0x49')]=function(_0x3e97bd,_0xc19e9){return db[_0xa37d('0x2b')][_0xa37d('0x49')](_0x3e97bd[_0xa37d('0x4a')],{})[_0xa37d('0x26')](respondWithResult(_0xc19e9,0xc9))[_0xa37d('0x42')](handleError(_0xc19e9,null));};exports[_0xa37d('0x4b')]=function(_0x3dfe42,_0x1595c5){if(_0x3dfe42['body']['id']){delete _0x3dfe42['body']['id'];}return db[_0xa37d('0x2b')]['find']({'where':{'id':_0x3dfe42[_0xa37d('0x44')]['id']}})[_0xa37d('0x26')](handleEntityNotFound(_0x1595c5,null))[_0xa37d('0x26')](saveUpdates(_0x3dfe42[_0xa37d('0x4a')],null))[_0xa37d('0x26')](respondWithResult(_0x1595c5,null))[_0xa37d('0x42')](handleError(_0x1595c5,null));};exports[_0xa37d('0x4c')]=function(_0x588500,_0x3c3bc0){return db[_0xa37d('0x2b')][_0xa37d('0x48')]({'where':{'id':_0x588500[_0xa37d('0x44')]['id']}})[_0xa37d('0x26')](handleEntityNotFound(_0x3c3bc0,null))[_0xa37d('0x26')](removeEntity(_0x3c3bc0,null))[_0xa37d('0x42')](handleError(_0x3c3bc0,null));};exports[_0xa37d('0x4d')]=function(_0xa001dc,_0x17f6ae){return db[_0xa37d('0x2b')][_0xa37d('0x4d')]()[_0xa37d('0x26')](respondWithResult(_0x17f6ae,null))[_0xa37d('0x42')](handleError(_0x17f6ae,null));}; \ No newline at end of file +var _0x33c8=['rawAttributes','fieldName','type','key','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','includeAll','include','findAll','rows','catch','show','params','options','create','update','body','find','describe','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','undefined','count','offset','limit','set','Content-Range','reject','save','destroy','then','sendStatus','name','index','map','OpenchannelTransferReport'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x33c8,0xb7));var _0x833c=function(_0x4ee5aa,_0x4f2d01){_0x4ee5aa=_0x4ee5aa-0x0;var _0x171eb1=_0x33c8[_0x4ee5aa];return _0x171eb1;};'use strict';var emlformat=require(_0x833c('0x0'));var rimraf=require(_0x833c('0x1'));var zipdir=require(_0x833c('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x833c('0x3'));var moment=require(_0x833c('0x4'));var BPromise=require(_0x833c('0x5'));var Mustache=require(_0x833c('0x6'));var util=require(_0x833c('0x7'));var path=require(_0x833c('0x8'));var sox=require('sox');var csv=require(_0x833c('0x9'));var ejs=require(_0x833c('0xa'));var fs=require('fs');var fs_extra=require(_0x833c('0xb'));var _=require(_0x833c('0xc'));var squel=require('squel');var crypto=require(_0x833c('0xd'));var jsforce=require(_0x833c('0xe'));var deskjs=require(_0x833c('0xf'));var toCsv=require(_0x833c('0x9'));var querystring=require(_0x833c('0x10'));var Papa=require(_0x833c('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x833c('0x12'));var as=require(_0x833c('0x13'));var hardwareService=require(_0x833c('0x14'));var logger=require(_0x833c('0x15'))(_0x833c('0x16'));var utils=require(_0x833c('0x17'));var config=require(_0x833c('0x18'));var licenseUtil=require(_0x833c('0x19'));var db=require(_0x833c('0x1a'))['db'];function respondWithStatusCode(_0x5a3b35,_0x2a6669){_0x2a6669=_0x2a6669||0xcc;return function(_0x12eb6b){if(_0x12eb6b){return _0x5a3b35['sendStatus'](_0x2a6669);}return _0x5a3b35[_0x833c('0x1b')](_0x2a6669)[_0x833c('0x1c')]();};}function respondWithResult(_0x55f7ae,_0x4cc31f){_0x4cc31f=_0x4cc31f||0xc8;return function(_0x251455){if(_0x251455){return _0x55f7ae[_0x833c('0x1b')](_0x4cc31f)[_0x833c('0x1d')](_0x251455);}};}function respondWithFilteredResult(_0x22e729,_0x342bf4){return function(_0x1962d3){if(_0x1962d3){var _0x5d181b=typeof _0x342bf4['offset']===_0x833c('0x1e')&&typeof _0x342bf4['limit']===_0x833c('0x1e');var _0x2b2e81=_0x1962d3[_0x833c('0x1f')];var _0x361c61=_0x5d181b?0x0:_0x342bf4[_0x833c('0x20')];var _0x203019=_0x5d181b?_0x1962d3[_0x833c('0x1f')]:_0x342bf4[_0x833c('0x20')]+_0x342bf4[_0x833c('0x21')];var _0xb29fbc;if(_0x203019>=_0x2b2e81){_0x203019=_0x2b2e81;_0xb29fbc=0xc8;}else{_0xb29fbc=0xce;}_0x22e729[_0x833c('0x1b')](_0xb29fbc);return _0x22e729[_0x833c('0x22')](_0x833c('0x23'),_0x361c61+'-'+_0x203019+'/'+_0x2b2e81)[_0x833c('0x1d')](_0x1962d3);}return null;};}function patchUpdates(_0x3b4089){return function(_0x99e836){try{jsonpatch['apply'](_0x99e836,_0x3b4089,!![]);}catch(_0x4fa6ce){return BPromise[_0x833c('0x24')](_0x4fa6ce);}return _0x99e836[_0x833c('0x25')]();};}function saveUpdates(_0x43964d,_0x1fd037){return function(_0x189632){if(_0x189632){return _0x189632['update'](_0x43964d)['then'](function(_0x5c73e7){return _0x5c73e7;});}return null;};}function removeEntity(_0x5c503c,_0x125b97){return function(_0xb11a88){if(_0xb11a88){return _0xb11a88[_0x833c('0x26')]()[_0x833c('0x27')](function(){_0x5c503c[_0x833c('0x1b')](0xcc)[_0x833c('0x1c')]();});}};}function handleEntityNotFound(_0x45920f,_0x1dd4cf){return function(_0x41dbd9){if(!_0x41dbd9){_0x45920f[_0x833c('0x28')](0x194);}return _0x41dbd9;};}function handleError(_0x58aaa3,_0x25fd3c){_0x25fd3c=_0x25fd3c||0x1f4;return function(_0x2e2715){logger['error'](_0x2e2715['stack']);if(_0x2e2715[_0x833c('0x29')]){delete _0x2e2715[_0x833c('0x29')];}_0x58aaa3['status'](_0x25fd3c)['send'](_0x2e2715);};}exports[_0x833c('0x2a')]=function(_0x157141,_0x396e37){var _0x5b4a3c={},_0x349c87={},_0x50616c={'count':0x0,'rows':[]};var _0x3a07fa=_[_0x833c('0x2b')](db[_0x833c('0x2c')][_0x833c('0x2d')],function(_0x42481e){return{'name':_0x42481e[_0x833c('0x2e')],'type':_0x42481e[_0x833c('0x2f')][_0x833c('0x30')]};});_0x349c87[_0x833c('0x31')]=_[_0x833c('0x2b')](_0x3a07fa,_0x833c('0x29'));_0x349c87[_0x833c('0x32')]=_[_0x833c('0x33')](_0x157141[_0x833c('0x32')]);_0x349c87['filters']=_['intersection'](_0x349c87[_0x833c('0x31')],_0x349c87['query']);_0x5b4a3c[_0x833c('0x34')]=_[_0x833c('0x35')](_0x349c87['model'],qs[_0x833c('0x36')](_0x157141['query']['fields']));_0x5b4a3c['attributes']=_0x5b4a3c['attributes'][_0x833c('0x37')]?_0x5b4a3c[_0x833c('0x34')]:_0x349c87[_0x833c('0x31')];if(!_0x157141[_0x833c('0x32')][_0x833c('0x38')]('nolimit')){_0x5b4a3c[_0x833c('0x21')]=qs[_0x833c('0x21')](_0x157141['query'][_0x833c('0x21')]);_0x5b4a3c['offset']=qs[_0x833c('0x20')](_0x157141[_0x833c('0x32')][_0x833c('0x20')]);}_0x5b4a3c[_0x833c('0x39')]=qs['sort'](_0x157141[_0x833c('0x32')][_0x833c('0x3a')]);_0x5b4a3c[_0x833c('0x3b')]=qs['filters'](_[_0x833c('0x3c')](_0x157141['query'],_0x349c87['filters']),_0x3a07fa);if(_0x157141[_0x833c('0x32')][_0x833c('0x3d')]){_0x5b4a3c[_0x833c('0x3b')]=_[_0x833c('0x3e')](_0x5b4a3c[_0x833c('0x3b')],{'$or':_['map'](_0x3a07fa,function(_0x238089){if(_0x238089[_0x833c('0x2f')]!=='VIRTUAL'){var _0x20f646={};_0x20f646[_0x238089[_0x833c('0x29')]]={'$like':'%'+_0x157141[_0x833c('0x32')][_0x833c('0x3d')]+'%'};return _0x20f646;}})});}_0x5b4a3c=_[_0x833c('0x3e')]({},_0x5b4a3c,_0x157141['options']);var _0x184efd={'where':_0x5b4a3c[_0x833c('0x3b')]};return db[_0x833c('0x2c')]['count'](_0x184efd)[_0x833c('0x27')](function(_0x45b096){_0x50616c[_0x833c('0x1f')]=_0x45b096;if(_0x157141[_0x833c('0x32')][_0x833c('0x3f')]){_0x5b4a3c[_0x833c('0x40')]=[{'all':!![]}];}return db[_0x833c('0x2c')][_0x833c('0x41')](_0x5b4a3c);})['then'](function(_0x5db04d){_0x50616c[_0x833c('0x42')]=_0x5db04d;return _0x50616c;})['then'](respondWithFilteredResult(_0x396e37,_0x5b4a3c))[_0x833c('0x43')](handleError(_0x396e37,null));};exports[_0x833c('0x44')]=function(_0x109a2f,_0x41bc8e){var _0x382d64={'raw':!![],'where':{'id':_0x109a2f[_0x833c('0x45')]['id']}},_0x14d37a={};_0x14d37a[_0x833c('0x31')]=_[_0x833c('0x33')](db[_0x833c('0x2c')][_0x833c('0x2d')]);_0x14d37a[_0x833c('0x32')]=_[_0x833c('0x33')](_0x109a2f[_0x833c('0x32')]);_0x14d37a['filters']=_[_0x833c('0x35')](_0x14d37a['model'],_0x14d37a[_0x833c('0x32')]);_0x382d64['attributes']=_[_0x833c('0x35')](_0x14d37a[_0x833c('0x31')],qs[_0x833c('0x36')](_0x109a2f[_0x833c('0x32')]['fields']));_0x382d64[_0x833c('0x34')]=_0x382d64[_0x833c('0x34')][_0x833c('0x37')]?_0x382d64['attributes']:_0x14d37a['model'];if(_0x109a2f[_0x833c('0x32')][_0x833c('0x3f')]){_0x382d64[_0x833c('0x40')]=[{'all':!![]}];}_0x382d64=_['merge']({},_0x382d64,_0x109a2f[_0x833c('0x46')]);return db[_0x833c('0x2c')]['find'](_0x382d64)['then'](handleEntityNotFound(_0x41bc8e,null))['then'](respondWithResult(_0x41bc8e,null))['catch'](handleError(_0x41bc8e,null));};exports['create']=function(_0xd38974,_0x509890){return db[_0x833c('0x2c')][_0x833c('0x47')](_0xd38974['body'],{})[_0x833c('0x27')](respondWithResult(_0x509890,0xc9))['catch'](handleError(_0x509890,null));};exports[_0x833c('0x48')]=function(_0x3c1e4b,_0x1de6b6){if(_0x3c1e4b['body']['id']){delete _0x3c1e4b[_0x833c('0x49')]['id'];}return db['OpenchannelTransferReport'][_0x833c('0x4a')]({'where':{'id':_0x3c1e4b[_0x833c('0x45')]['id']}})[_0x833c('0x27')](handleEntityNotFound(_0x1de6b6,null))['then'](saveUpdates(_0x3c1e4b[_0x833c('0x49')],null))[_0x833c('0x27')](respondWithResult(_0x1de6b6,null))['catch'](handleError(_0x1de6b6,null));};exports['destroy']=function(_0x5b9e29,_0x2052a9){return db[_0x833c('0x2c')][_0x833c('0x4a')]({'where':{'id':_0x5b9e29[_0x833c('0x45')]['id']}})[_0x833c('0x27')](handleEntityNotFound(_0x2052a9,null))[_0x833c('0x27')](removeEntity(_0x2052a9,null))[_0x833c('0x43')](handleError(_0x2052a9,null));};exports[_0x833c('0x4b')]=function(_0x1d1eec,_0x2bb6d6){return db[_0x833c('0x2c')][_0x833c('0x4b')]()['then'](respondWithResult(_0x2bb6d6,null))[_0x833c('0x43')](handleError(_0x2bb6d6,null));}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.model.js b/server/api/openchannelTransferReport/openchannelTransferReport.model.js index 37d0cf0..d039c71 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 _0x130e=['../../config/environment','exports','define','report_openchannel_transfer','uniqueid','lodash','util','api','bluebird','request-promise','path','rimraf'];(function(_0x259ca4,_0x300574){var _0x4fc9f2=function(_0x474e1c){while(--_0x474e1c){_0x259ca4['push'](_0x259ca4['shift']());}};_0x4fc9f2(++_0x300574);}(_0x130e,0x10d));var _0xe130=function(_0x53efe4,_0x58b196){_0x53efe4=_0x53efe4-0x0;var _0xf94431=_0x130e[_0x53efe4];return _0xf94431;};'use strict';var _=require(_0xe130('0x0'));var util=require(_0xe130('0x1'));var logger=require('../../config/logger')(_0xe130('0x2'));var moment=require('moment');var BPromise=require(_0xe130('0x3'));var rp=require(_0xe130('0x4'));var fs=require('fs');var path=require(_0xe130('0x5'));var rimraf=require(_0xe130('0x6'));var config=require(_0xe130('0x7'));var attributes=require('./openchannelTransferReport.attributes');module[_0xe130('0x8')]=function(_0x354ffc,_0x17ae8a){return _0x354ffc[_0xe130('0x9')]('OpenchannelTransferReport',attributes,{'tableName':_0xe130('0xa'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0xe130('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x4324=['api','moment','bluebird','request-promise','rimraf','../../config/environment','exports','define','OpenchannelTransferReport','report_openchannel_transfer','uniqueid','lodash','util','../../config/logger'];(function(_0x1ee477,_0xe2f0a2){var _0x33ce18=function(_0x154e48){while(--_0x154e48){_0x1ee477['push'](_0x1ee477['shift']());}};_0x33ce18(++_0xe2f0a2);}(_0x4324,0xcf));var _0x4432=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x4324[_0x3b380d];return _0x54502b;};'use strict';var _=require(_0x4432('0x0'));var util=require(_0x4432('0x1'));var logger=require(_0x4432('0x2'))(_0x4432('0x3'));var moment=require(_0x4432('0x4'));var BPromise=require(_0x4432('0x5'));var rp=require(_0x4432('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4432('0x7'));var config=require(_0x4432('0x8'));var attributes=require('./openchannelTransferReport.attributes');module[_0x4432('0x9')]=function(_0x40ca4e,_0x215b63){return _0x40ca4e[_0x4432('0xa')](_0x4432('0xb'),attributes,{'tableName':_0x4432('0xc'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x4432('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js b/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js index ac8b1a7..cbdc70c 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 _0x689c=['then','info','OpenchannelTransferReport,\x20%s,\x20%s','request\x20sent','debug','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','client','http','request'];(function(_0xfc307a,_0x3deaec){var _0x27585d=function(_0x20c393){while(--_0x20c393){_0xfc307a['push'](_0xfc307a['shift']());}};_0x27585d(++_0x3deaec);}(_0x689c,0x9e));var _0xc689=function(_0x63e650,_0x5a61c1){_0x63e650=_0x63e650-0x0;var _0x2d27fc=_0x689c[_0x63e650];return _0x2d27fc;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xc689('0x0'));var BPromise=require(_0xc689('0x1'));var rs=require(_0xc689('0x2'));var fs=require('fs');var Redis=require(_0xc689('0x3'));var db=require(_0xc689('0x4'))['db'];var utils=require(_0xc689('0x5'));var logger=require('../../config/logger')(_0xc689('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xc689('0x7')][_0xc689('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2b9f8a,_0xedb406,_0x2e7400){return new BPromise(function(_0x57f82f,_0x17ff9c){return client[_0xc689('0x9')](_0x2b9f8a,_0x2e7400)[_0xc689('0xa')](function(_0x4a6c06){logger[_0xc689('0xb')](_0xc689('0xc'),_0xedb406,_0xc689('0xd'));logger[_0xc689('0xe')](_0xc689('0xf'),_0xedb406,_0xc689('0xd'),JSON[_0xc689('0x10')](_0x4a6c06));if(_0x4a6c06[_0xc689('0x11')]){if(_0x4a6c06[_0xc689('0x11')][_0xc689('0x12')]===0x1f4){logger[_0xc689('0x11')]('OpenchannelTransferReport,\x20%s,\x20%s',_0xedb406,_0x4a6c06[_0xc689('0x11')]['message']);return _0x17ff9c(_0x4a6c06[_0xc689('0x11')][_0xc689('0x13')]);}logger[_0xc689('0x11')]('OpenchannelTransferReport,\x20%s,\x20%s',_0xedb406,_0x4a6c06[_0xc689('0x11')][_0xc689('0x13')]);return _0x57f82f(_0x4a6c06['error'][_0xc689('0x13')]);}else{logger[_0xc689('0xb')](_0xc689('0xc'),_0xedb406,_0xc689('0xd'));_0x57f82f(_0x4a6c06['result']['message']);}})[_0xc689('0x14')](function(_0x214ca0){logger[_0xc689('0x11')]('OpenchannelTransferReport,\x20%s,\x20%s',_0xedb406,_0x214ca0);_0x17ff9c(_0x214ca0);});});} \ No newline at end of file +var _0xeff8=['util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','OpenchannelTransferReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','lodash'];(function(_0x1b7b25,_0x14f673){var _0x2dcd50=function(_0x5483a8){while(--_0x5483a8){_0x1b7b25['push'](_0x1b7b25['shift']());}};_0x2dcd50(++_0x14f673);}(_0xeff8,0x186));var _0x8eff=function(_0x4953da,_0x5adaca){_0x4953da=_0x4953da-0x0;var _0x2d3780=_0xeff8[_0x4953da];return _0x2d3780;};'use strict';var _=require(_0x8eff('0x0'));var util=require(_0x8eff('0x1'));var moment=require('moment');var BPromise=require(_0x8eff('0x2'));var rs=require(_0x8eff('0x3'));var fs=require('fs');var Redis=require(_0x8eff('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x8eff('0x5'));var logger=require(_0x8eff('0x6'))(_0x8eff('0x7'));var config=require(_0x8eff('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x8eff('0x9')][_0x8eff('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3409bc,_0x323b2,_0x491f01){return new BPromise(function(_0x3fb9ee,_0x19557f){return client[_0x8eff('0xb')](_0x3409bc,_0x491f01)[_0x8eff('0xc')](function(_0x5bd403){logger['info'](_0x8eff('0xd'),_0x323b2,_0x8eff('0xe'));logger[_0x8eff('0xf')]('OpenchannelTransferReport,\x20%s,\x20%s,\x20%s',_0x323b2,_0x8eff('0xe'),JSON[_0x8eff('0x10')](_0x5bd403));if(_0x5bd403['error']){if(_0x5bd403[_0x8eff('0x11')][_0x8eff('0x12')]===0x1f4){logger['error']('OpenchannelTransferReport,\x20%s,\x20%s',_0x323b2,_0x5bd403[_0x8eff('0x11')][_0x8eff('0x13')]);return _0x19557f(_0x5bd403[_0x8eff('0x11')][_0x8eff('0x13')]);}logger[_0x8eff('0x11')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x323b2,_0x5bd403[_0x8eff('0x11')][_0x8eff('0x13')]);return _0x3fb9ee(_0x5bd403[_0x8eff('0x11')][_0x8eff('0x13')]);}else{logger[_0x8eff('0x14')](_0x8eff('0xd'),_0x323b2,_0x8eff('0xe'));_0x3fb9ee(_0x5bd403[_0x8eff('0x15')][_0x8eff('0x13')]);}})[_0x8eff('0x16')](function(_0x137344){logger['error'](_0x8eff('0xd'),_0x323b2,_0x137344);_0x19557f(_0x137344);});});} \ No newline at end of file diff --git a/server/api/pause/index.js b/server/api/pause/index.js index 3a5e968..a99ffef 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 _0xac8d=['create','put','update','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./pause.controller','get','isAuthenticated','index','/:id','post'];(function(_0x8de54f,_0x271987){var _0x14cba4=function(_0x58ed41){while(--_0x58ed41){_0x8de54f['push'](_0x8de54f['shift']());}};_0x14cba4(++_0x271987);}(_0xac8d,0x1d8));var _0xdac8=function(_0x186ed3,_0x3ac342){_0x186ed3=_0x186ed3-0x0;var _0x31c314=_0xac8d[_0x186ed3];return _0x31c314;};'use strict';var multer=require(_0xdac8('0x0'));var util=require(_0xdac8('0x1'));var path=require(_0xdac8('0x2'));var timeout=require(_0xdac8('0x3'));var express=require(_0xdac8('0x4'));var router=express['Router']();var fs_extra=require(_0xdac8('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xdac8('0x6'));var config=require(_0xdac8('0x7'));var controller=require(_0xdac8('0x8'));router[_0xdac8('0x9')]('/',auth[_0xdac8('0xa')](),controller[_0xdac8('0xb')]);router[_0xdac8('0x9')](_0xdac8('0xc'),auth[_0xdac8('0xa')](),controller['show']);router[_0xdac8('0xd')]('/',auth['isAuthenticated'](),controller[_0xdac8('0xe')]);router[_0xdac8('0xf')]('/:id',auth[_0xdac8('0xa')](),controller[_0xdac8('0x10')]);router['delete'](_0xdac8('0xc'),auth[_0xdac8('0xa')](),controller['destroy']);module[_0xdac8('0x11')]=router; \ No newline at end of file +var _0xbed3=['get','index','/:id','isAuthenticated','post','create','put','update','exports','multer','connect-timeout','express','Router','../../components/auth/service','./pause.controller'];(function(_0x35559f,_0x1b5309){var _0x1d5da0=function(_0x591856){while(--_0x591856){_0x35559f['push'](_0x35559f['shift']());}};_0x1d5da0(++_0x1b5309);}(_0xbed3,0x81));var _0x3bed=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xbed3[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x3bed('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x3bed('0x1'));var express=require(_0x3bed('0x2'));var router=express[_0x3bed('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x3bed('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x3bed('0x5'));router[_0x3bed('0x6')]('/',auth['isAuthenticated'](),controller[_0x3bed('0x7')]);router[_0x3bed('0x6')](_0x3bed('0x8'),auth[_0x3bed('0x9')](),controller['show']);router[_0x3bed('0xa')]('/',auth['isAuthenticated'](),controller[_0x3bed('0xb')]);router[_0x3bed('0xc')](_0x3bed('0x8'),auth[_0x3bed('0x9')](),controller[_0x3bed('0xd')]);router['delete'](_0x3bed('0x8'),auth[_0x3bed('0x9')](),controller['destroy']);module[_0x3bed('0xe')]=router; \ No newline at end of file diff --git a/server/api/pause/pause.attributes.js b/server/api/pause/pause.attributes.js index ae8fa97..a8eaf3b 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 _0xa9f1=['sequelize','exports','STRING'];(function(_0x1a2e2a,_0x5d44d7){var _0x37dc88=function(_0x18e8e9){while(--_0x18e8e9){_0x1a2e2a['push'](_0x1a2e2a['shift']());}};_0x37dc88(++_0x5d44d7);}(_0xa9f1,0xb7));var _0x1a9f=function(_0x39e263,_0x3c8793){_0x39e263=_0x39e263-0x0;var _0xda072d=_0xa9f1[_0x39e263];return _0xda072d;};'use strict';var Sequelize=require(_0x1a9f('0x0'));module[_0x1a9f('0x1')]={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![]},'description':{'type':Sequelize[_0x1a9f('0x2')]}}; \ No newline at end of file +var _0x1664=['STRING','name','sequelize','exports'];(function(_0x461eaa,_0x5b9604){var _0x3f2756=function(_0xddf81a){while(--_0xddf81a){_0x461eaa['push'](_0x461eaa['shift']());}};_0x3f2756(++_0x5b9604);}(_0x1664,0xd2));var _0x4166=function(_0x29d915,_0x54a040){_0x29d915=_0x29d915-0x0;var _0x160f86=_0x1664[_0x29d915];return _0x160f86;};'use strict';var Sequelize=require(_0x4166('0x0'));module[_0x4166('0x1')]={'name':{'type':Sequelize[_0x4166('0x2')],'unique':_0x4166('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 c72a119..f46d00a 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 _0xa05d=['../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','save','update','then','destroy','UserProfileResource','error','stack','name','send','index','Pause','rawAttributes','type','key','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','show','keys','options','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','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment'];(function(_0x3ce3c,_0x319337){var _0x55a2c9=function(_0x1568d0){while(--_0x1568d0){_0x3ce3c['push'](_0x3ce3c['shift']());}};_0x55a2c9(++_0x319337);}(_0xa05d,0x193));var _0xda05=function(_0x42c7ed,_0x25d73d){_0x42c7ed=_0x42c7ed-0x0;var _0x478d3b=_0xa05d[_0x42c7ed];return _0x478d3b;};'use strict';var emlformat=require(_0xda05('0x0'));var rimraf=require(_0xda05('0x1'));var zipdir=require(_0xda05('0x2'));var jsonpatch=require(_0xda05('0x3'));var rp=require(_0xda05('0x4'));var moment=require('moment');var BPromise=require(_0xda05('0x5'));var Mustache=require(_0xda05('0x6'));var util=require(_0xda05('0x7'));var path=require(_0xda05('0x8'));var sox=require(_0xda05('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xda05('0xa'));var _=require(_0xda05('0xb'));var squel=require(_0xda05('0xc'));var crypto=require(_0xda05('0xd'));var jsforce=require(_0xda05('0xe'));var deskjs=require(_0xda05('0xf'));var toCsv=require(_0xda05('0x10'));var querystring=require('querystring');var Papa=require(_0xda05('0x11'));var Redis=require(_0xda05('0x12'));var authService=require(_0xda05('0x13'));var qs=require(_0xda05('0x14'));var as=require(_0xda05('0x15'));var hardwareService=require(_0xda05('0x16'));var logger=require(_0xda05('0x17'))(_0xda05('0x18'));var utils=require(_0xda05('0x19'));var config=require(_0xda05('0x1a'));var licenseUtil=require(_0xda05('0x1b'));var db=require(_0xda05('0x1c'))['db'];function respondWithStatusCode(_0x1cbb9f,_0x1cff91){_0x1cff91=_0x1cff91||0xcc;return function(_0x424444){if(_0x424444){return _0x1cbb9f[_0xda05('0x1d')](_0x1cff91);}return _0x1cbb9f[_0xda05('0x1e')](_0x1cff91)[_0xda05('0x1f')]();};}function respondWithResult(_0x23d4df,_0x439524){_0x439524=_0x439524||0xc8;return function(_0x587531){if(_0x587531){return _0x23d4df[_0xda05('0x1e')](_0x439524)[_0xda05('0x20')](_0x587531);}};}function respondWithFilteredResult(_0x520cde,_0x3b8fb1){return function(_0x292a8a){if(_0x292a8a){var _0x5ce215=typeof _0x3b8fb1[_0xda05('0x21')]===_0xda05('0x22')&&typeof _0x3b8fb1[_0xda05('0x23')]==='undefined';var _0xbe9ecf=_0x292a8a[_0xda05('0x24')];var _0x5af062=_0x5ce215?0x0:_0x3b8fb1[_0xda05('0x21')];var _0x23a36f=_0x5ce215?_0x292a8a[_0xda05('0x24')]:_0x3b8fb1['offset']+_0x3b8fb1[_0xda05('0x23')];var _0x4bc372;if(_0x23a36f>=_0xbe9ecf){_0x23a36f=_0xbe9ecf;_0x4bc372=0xc8;}else{_0x4bc372=0xce;}_0x520cde['status'](_0x4bc372);return _0x520cde[_0xda05('0x25')]('Content-Range',_0x5af062+'-'+_0x23a36f+'/'+_0xbe9ecf)[_0xda05('0x20')](_0x292a8a);}return null;};}function patchUpdates(_0x1778b3){return function(_0x7da4ee){try{jsonpatch['apply'](_0x7da4ee,_0x1778b3,!![]);}catch(_0x5c198d){return BPromise['reject'](_0x5c198d);}return _0x7da4ee[_0xda05('0x26')]();};}function saveUpdates(_0x3e98ae,_0x1478ed){return function(_0x1a8e4c){if(_0x1a8e4c){return _0x1a8e4c[_0xda05('0x27')](_0x3e98ae)[_0xda05('0x28')](function(_0x4b95d6){return _0x4b95d6;});}return null;};}function removeEntity(_0x3f0d54,_0x5ca561){return function(_0x1c8dda){if(_0x1c8dda){return _0x1c8dda[_0xda05('0x29')]()[_0xda05('0x28')](function(){var _0x228c98=_0x1c8dda['get']({'plain':!![]});var _0x7fd60d='Pauses';return db[_0xda05('0x2a')][_0xda05('0x29')]({'where':{'type':_0x7fd60d,'resourceId':_0x228c98['id']}})[_0xda05('0x28')](function(){return _0x1c8dda;});})[_0xda05('0x28')](function(){_0x3f0d54[_0xda05('0x1e')](0xcc)[_0xda05('0x1f')]();});}};}function handleEntityNotFound(_0xc2ff9,_0x492edb){return function(_0x5aa603){if(!_0x5aa603){_0xc2ff9['sendStatus'](0x194);}return _0x5aa603;};}function handleError(_0x36ed20,_0xbed8a4){_0xbed8a4=_0xbed8a4||0x1f4;return function(_0x168e23){logger[_0xda05('0x2b')](_0x168e23[_0xda05('0x2c')]);if(_0x168e23[_0xda05('0x2d')]){delete _0x168e23[_0xda05('0x2d')];}_0x36ed20[_0xda05('0x1e')](_0xbed8a4)[_0xda05('0x2e')](_0x168e23);};}exports[_0xda05('0x2f')]=function(_0x1aa4c3,_0x2b900e){var _0x322aea={},_0x59f694={},_0x4897cb={'count':0x0,'rows':[]};var _0x591194=_['map'](db[_0xda05('0x30')][_0xda05('0x31')],function(_0x42e3dc){return{'name':_0x42e3dc['fieldName'],'type':_0x42e3dc[_0xda05('0x32')][_0xda05('0x33')]};});_0x59f694[_0xda05('0x34')]=_[_0xda05('0x35')](_0x591194,_0xda05('0x2d'));_0x59f694['query']=_['keys'](_0x1aa4c3[_0xda05('0x36')]);_0x59f694[_0xda05('0x37')]=_[_0xda05('0x38')](_0x59f694[_0xda05('0x34')],_0x59f694[_0xda05('0x36')]);_0x322aea[_0xda05('0x39')]=_[_0xda05('0x38')](_0x59f694[_0xda05('0x34')],qs[_0xda05('0x3a')](_0x1aa4c3[_0xda05('0x36')][_0xda05('0x3a')]));_0x322aea[_0xda05('0x39')]=_0x322aea[_0xda05('0x39')][_0xda05('0x3b')]?_0x322aea[_0xda05('0x39')]:_0x59f694[_0xda05('0x34')];if(!_0x1aa4c3[_0xda05('0x36')][_0xda05('0x3c')](_0xda05('0x3d'))){_0x322aea[_0xda05('0x23')]=qs[_0xda05('0x23')](_0x1aa4c3[_0xda05('0x36')][_0xda05('0x23')]);_0x322aea[_0xda05('0x21')]=qs[_0xda05('0x21')](_0x1aa4c3[_0xda05('0x36')]['offset']);}_0x322aea['order']=qs[_0xda05('0x3e')](_0x1aa4c3[_0xda05('0x36')]['sort']);_0x322aea[_0xda05('0x3f')]=qs[_0xda05('0x37')](_[_0xda05('0x40')](_0x1aa4c3[_0xda05('0x36')],_0x59f694[_0xda05('0x37')]),_0x591194);if(_0x1aa4c3[_0xda05('0x36')][_0xda05('0x41')]){_0x322aea['where']=_[_0xda05('0x42')](_0x322aea[_0xda05('0x3f')],{'$or':_[_0xda05('0x35')](_0x591194,function(_0x4afa18){if(_0x4afa18[_0xda05('0x32')]!==_0xda05('0x43')){var _0x31ff89={};_0x31ff89[_0x4afa18[_0xda05('0x2d')]]={'$like':'%'+_0x1aa4c3[_0xda05('0x36')][_0xda05('0x41')]+'%'};return _0x31ff89;}})});}_0x322aea=_[_0xda05('0x42')]({},_0x322aea,_0x1aa4c3['options']);var _0x3bb423={'where':_0x322aea[_0xda05('0x3f')]};return db['Pause'][_0xda05('0x24')](_0x3bb423)[_0xda05('0x28')](function(_0x39b203){_0x4897cb[_0xda05('0x24')]=_0x39b203;if(_0x1aa4c3[_0xda05('0x36')][_0xda05('0x44')]){_0x322aea[_0xda05('0x45')]=[{'all':!![]}];}return db[_0xda05('0x30')][_0xda05('0x46')](_0x322aea);})[_0xda05('0x28')](function(_0x5dc2a6){_0x4897cb[_0xda05('0x47')]=_0x5dc2a6;return _0x4897cb;})[_0xda05('0x28')](respondWithFilteredResult(_0x2b900e,_0x322aea))['catch'](handleError(_0x2b900e,null));};exports[_0xda05('0x48')]=function(_0x4d2d01,_0x53447b){var _0x47e28c={'raw':!![],'where':{'id':_0x4d2d01['params']['id']}},_0x1316e1={};_0x1316e1['model']=_[_0xda05('0x49')](db[_0xda05('0x30')][_0xda05('0x31')]);_0x1316e1['query']=_[_0xda05('0x49')](_0x4d2d01['query']);_0x1316e1[_0xda05('0x37')]=_[_0xda05('0x38')](_0x1316e1['model'],_0x1316e1[_0xda05('0x36')]);_0x47e28c['attributes']=_[_0xda05('0x38')](_0x1316e1['model'],qs[_0xda05('0x3a')](_0x4d2d01['query'][_0xda05('0x3a')]));_0x47e28c['attributes']=_0x47e28c[_0xda05('0x39')][_0xda05('0x3b')]?_0x47e28c[_0xda05('0x39')]:_0x1316e1['model'];if(_0x4d2d01[_0xda05('0x36')][_0xda05('0x44')]){_0x47e28c[_0xda05('0x45')]=[{'all':!![]}];}_0x47e28c=_[_0xda05('0x42')]({},_0x47e28c,_0x4d2d01[_0xda05('0x4a')]);return db[_0xda05('0x30')][_0xda05('0x4b')](_0x47e28c)[_0xda05('0x28')](handleEntityNotFound(_0x53447b,null))['then'](respondWithResult(_0x53447b,null))[_0xda05('0x4c')](handleError(_0x53447b,null));};exports[_0xda05('0x4d')]=function(_0x45f3e0,_0x3ed3f6){return db[_0xda05('0x30')][_0xda05('0x4d')](_0x45f3e0[_0xda05('0x4e')],{})[_0xda05('0x28')](function(_0xc3ad7e){var _0x957dad=_0x45f3e0[_0xda05('0x4f')][_0xda05('0x50')]({'plain':!![]});if(!_0x957dad)throw new Error(_0xda05('0x51'));if(_0x957dad[_0xda05('0x52')]===_0xda05('0x4f')){var _0x389ddb=_0xc3ad7e[_0xda05('0x50')]({'plain':!![]});var _0x2ada7a='Pauses';return db[_0xda05('0x53')][_0xda05('0x4b')]({'where':{'name':_0x2ada7a,'userProfileId':_0x957dad['userProfileId']},'raw':!![]})[_0xda05('0x28')](function(_0x170e84){if(_0x170e84&&_0x170e84['autoAssociation']===0x0){return db[_0xda05('0x2a')]['create']({'name':_0x389ddb[_0xda05('0x2d')],'resourceId':_0x389ddb['id'],'type':_0x170e84[_0xda05('0x2d')],'sectionId':_0x170e84['id']},{})[_0xda05('0x28')](function(){return _0xc3ad7e;});}else{return _0xc3ad7e;}})['catch'](function(_0x5eea54){logger[_0xda05('0x2b')](_0xda05('0x54'),_0x5eea54);throw _0x5eea54;});}return _0xc3ad7e;})[_0xda05('0x28')](respondWithResult(_0x3ed3f6,0xc9))[_0xda05('0x4c')](handleError(_0x3ed3f6,null));};exports[_0xda05('0x27')]=function(_0x167574,_0x33fd3d){if(_0x167574[_0xda05('0x4e')]['id']){delete _0x167574[_0xda05('0x4e')]['id'];}return db['Pause'][_0xda05('0x4b')]({'where':{'id':_0x167574[_0xda05('0x55')]['id']}})[_0xda05('0x28')](handleEntityNotFound(_0x33fd3d,null))[_0xda05('0x28')](saveUpdates(_0x167574[_0xda05('0x4e')],null))[_0xda05('0x28')](respondWithResult(_0x33fd3d,null))[_0xda05('0x4c')](handleError(_0x33fd3d,null));};exports['destroy']=function(_0x185a59,_0x2928e9){return db[_0xda05('0x30')][_0xda05('0x4b')]({'where':{'id':_0x185a59[_0xda05('0x55')]['id']}})['then'](handleEntityNotFound(_0x2928e9,null))[_0xda05('0x28')](removeEntity(_0x2928e9,null))['catch'](handleError(_0x2928e9,null));}; \ No newline at end of file +var _0x2ffa=['autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','squel','crypto','../../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','count','Content-Range','apply','reject','save','update','then','destroy','Pauses','UserProfileResource','error','stack','name','send','index','map','Pause','rawAttributes','type','key','model','query','intersection','attributes','fields','length','nolimit','order','sort','filters','pick','filter','where','VIRTUAL','merge','options','includeAll','include','findAll','rows','show','find','catch','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection'];(function(_0x234d16,_0x43302d){var _0x333f22=function(_0x42482a){while(--_0x42482a){_0x234d16['push'](_0x234d16['shift']());}};_0x333f22(++_0x43302d);}(_0x2ffa,0x13f));var _0xa2ff=function(_0x3e1332,_0xbdbdd6){_0x3e1332=_0x3e1332-0x0;var _0x2a967b=_0x2ffa[_0x3e1332];return _0x2a967b;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa2ff('0x0'));var zipdir=require(_0xa2ff('0x1'));var jsonpatch=require(_0xa2ff('0x2'));var rp=require('request-promise');var moment=require(_0xa2ff('0x3'));var BPromise=require(_0xa2ff('0x4'));var Mustache=require(_0xa2ff('0x5'));var util=require(_0xa2ff('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0xa2ff('0x7'));var ejs=require(_0xa2ff('0x8'));var fs=require('fs');var fs_extra=require(_0xa2ff('0x9'));var _=require('lodash');var squel=require(_0xa2ff('0xa'));var crypto=require(_0xa2ff('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xa2ff('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xa2ff('0xc'));var qs=require(_0xa2ff('0xd'));var as=require(_0xa2ff('0xe'));var hardwareService=require(_0xa2ff('0xf'));var logger=require('../../config/logger')(_0xa2ff('0x10'));var utils=require('../../config/utils');var config=require(_0xa2ff('0x11'));var licenseUtil=require(_0xa2ff('0x12'));var db=require(_0xa2ff('0x13'))['db'];function respondWithStatusCode(_0x10f9d2,_0x13ef6d){_0x13ef6d=_0x13ef6d||0xcc;return function(_0x541371){if(_0x541371){return _0x10f9d2[_0xa2ff('0x14')](_0x13ef6d);}return _0x10f9d2[_0xa2ff('0x15')](_0x13ef6d)[_0xa2ff('0x16')]();};}function respondWithResult(_0x4a764e,_0x41de4b){_0x41de4b=_0x41de4b||0xc8;return function(_0x567a3a){if(_0x567a3a){return _0x4a764e[_0xa2ff('0x15')](_0x41de4b)[_0xa2ff('0x17')](_0x567a3a);}};}function respondWithFilteredResult(_0x654d84,_0x183bba){return function(_0x516b4d){if(_0x516b4d){var _0x5263f8=typeof _0x183bba[_0xa2ff('0x18')]==='undefined'&&typeof _0x183bba[_0xa2ff('0x19')]===_0xa2ff('0x1a');var _0x1df7d=_0x516b4d[_0xa2ff('0x1b')];var _0x59184f=_0x5263f8?0x0:_0x183bba[_0xa2ff('0x18')];var _0x2cf47d=_0x5263f8?_0x516b4d[_0xa2ff('0x1b')]:_0x183bba['offset']+_0x183bba[_0xa2ff('0x19')];var _0x24f155;if(_0x2cf47d>=_0x1df7d){_0x2cf47d=_0x1df7d;_0x24f155=0xc8;}else{_0x24f155=0xce;}_0x654d84['status'](_0x24f155);return _0x654d84['set'](_0xa2ff('0x1c'),_0x59184f+'-'+_0x2cf47d+'/'+_0x1df7d)[_0xa2ff('0x17')](_0x516b4d);}return null;};}function patchUpdates(_0x445061){return function(_0x42a02f){try{jsonpatch[_0xa2ff('0x1d')](_0x42a02f,_0x445061,!![]);}catch(_0x31f008){return BPromise[_0xa2ff('0x1e')](_0x31f008);}return _0x42a02f[_0xa2ff('0x1f')]();};}function saveUpdates(_0x5b02e3,_0x192816){return function(_0x303259){if(_0x303259){return _0x303259[_0xa2ff('0x20')](_0x5b02e3)[_0xa2ff('0x21')](function(_0x1b782f){return _0x1b782f;});}return null;};}function removeEntity(_0x3025f2,_0x252598){return function(_0x4bafd7){if(_0x4bafd7){return _0x4bafd7[_0xa2ff('0x22')]()[_0xa2ff('0x21')](function(){var _0x4a3790=_0x4bafd7['get']({'plain':!![]});var _0x393633=_0xa2ff('0x23');return db[_0xa2ff('0x24')][_0xa2ff('0x22')]({'where':{'type':_0x393633,'resourceId':_0x4a3790['id']}})[_0xa2ff('0x21')](function(){return _0x4bafd7;});})[_0xa2ff('0x21')](function(){_0x3025f2['status'](0xcc)[_0xa2ff('0x16')]();});}};}function handleEntityNotFound(_0x202d36,_0xa9e981){return function(_0x2e967e){if(!_0x2e967e){_0x202d36[_0xa2ff('0x14')](0x194);}return _0x2e967e;};}function handleError(_0x2d3538,_0x27d581){_0x27d581=_0x27d581||0x1f4;return function(_0x443a65){logger[_0xa2ff('0x25')](_0x443a65[_0xa2ff('0x26')]);if(_0x443a65['name']){delete _0x443a65[_0xa2ff('0x27')];}_0x2d3538['status'](_0x27d581)[_0xa2ff('0x28')](_0x443a65);};}exports[_0xa2ff('0x29')]=function(_0x4906ec,_0x4a5ef7){var _0x39d52b={},_0x341188={},_0x5fb955={'count':0x0,'rows':[]};var _0x141b16=_[_0xa2ff('0x2a')](db[_0xa2ff('0x2b')][_0xa2ff('0x2c')],function(_0xd6d247){return{'name':_0xd6d247['fieldName'],'type':_0xd6d247[_0xa2ff('0x2d')][_0xa2ff('0x2e')]};});_0x341188[_0xa2ff('0x2f')]=_[_0xa2ff('0x2a')](_0x141b16,_0xa2ff('0x27'));_0x341188[_0xa2ff('0x30')]=_['keys'](_0x4906ec[_0xa2ff('0x30')]);_0x341188['filters']=_[_0xa2ff('0x31')](_0x341188[_0xa2ff('0x2f')],_0x341188['query']);_0x39d52b[_0xa2ff('0x32')]=_['intersection'](_0x341188[_0xa2ff('0x2f')],qs[_0xa2ff('0x33')](_0x4906ec['query']['fields']));_0x39d52b['attributes']=_0x39d52b[_0xa2ff('0x32')][_0xa2ff('0x34')]?_0x39d52b[_0xa2ff('0x32')]:_0x341188[_0xa2ff('0x2f')];if(!_0x4906ec['query']['hasOwnProperty'](_0xa2ff('0x35'))){_0x39d52b[_0xa2ff('0x19')]=qs['limit'](_0x4906ec['query']['limit']);_0x39d52b[_0xa2ff('0x18')]=qs[_0xa2ff('0x18')](_0x4906ec[_0xa2ff('0x30')][_0xa2ff('0x18')]);}_0x39d52b[_0xa2ff('0x36')]=qs['sort'](_0x4906ec[_0xa2ff('0x30')][_0xa2ff('0x37')]);_0x39d52b['where']=qs[_0xa2ff('0x38')](_[_0xa2ff('0x39')](_0x4906ec['query'],_0x341188['filters']),_0x141b16);if(_0x4906ec[_0xa2ff('0x30')][_0xa2ff('0x3a')]){_0x39d52b[_0xa2ff('0x3b')]=_['merge'](_0x39d52b[_0xa2ff('0x3b')],{'$or':_[_0xa2ff('0x2a')](_0x141b16,function(_0x2ee583){if(_0x2ee583[_0xa2ff('0x2d')]!==_0xa2ff('0x3c')){var _0x15931a={};_0x15931a[_0x2ee583['name']]={'$like':'%'+_0x4906ec[_0xa2ff('0x30')]['filter']+'%'};return _0x15931a;}})});}_0x39d52b=_[_0xa2ff('0x3d')]({},_0x39d52b,_0x4906ec[_0xa2ff('0x3e')]);var _0x2ae319={'where':_0x39d52b[_0xa2ff('0x3b')]};return db[_0xa2ff('0x2b')][_0xa2ff('0x1b')](_0x2ae319)['then'](function(_0x5dabe7){_0x5fb955['count']=_0x5dabe7;if(_0x4906ec[_0xa2ff('0x30')][_0xa2ff('0x3f')]){_0x39d52b[_0xa2ff('0x40')]=[{'all':!![]}];}return db[_0xa2ff('0x2b')][_0xa2ff('0x41')](_0x39d52b);})[_0xa2ff('0x21')](function(_0x4ea21f){_0x5fb955[_0xa2ff('0x42')]=_0x4ea21f;return _0x5fb955;})[_0xa2ff('0x21')](respondWithFilteredResult(_0x4a5ef7,_0x39d52b))['catch'](handleError(_0x4a5ef7,null));};exports[_0xa2ff('0x43')]=function(_0xb49d06,_0x2e1333){var _0x58f475={'raw':!![],'where':{'id':_0xb49d06['params']['id']}},_0x4333eb={};_0x4333eb[_0xa2ff('0x2f')]=_['keys'](db[_0xa2ff('0x2b')]['rawAttributes']);_0x4333eb[_0xa2ff('0x30')]=_['keys'](_0xb49d06[_0xa2ff('0x30')]);_0x4333eb[_0xa2ff('0x38')]=_[_0xa2ff('0x31')](_0x4333eb['model'],_0x4333eb[_0xa2ff('0x30')]);_0x58f475[_0xa2ff('0x32')]=_[_0xa2ff('0x31')](_0x4333eb[_0xa2ff('0x2f')],qs[_0xa2ff('0x33')](_0xb49d06[_0xa2ff('0x30')]['fields']));_0x58f475['attributes']=_0x58f475['attributes']['length']?_0x58f475['attributes']:_0x4333eb['model'];if(_0xb49d06[_0xa2ff('0x30')][_0xa2ff('0x3f')]){_0x58f475['include']=[{'all':!![]}];}_0x58f475=_[_0xa2ff('0x3d')]({},_0x58f475,_0xb49d06['options']);return db[_0xa2ff('0x2b')][_0xa2ff('0x44')](_0x58f475)[_0xa2ff('0x21')](handleEntityNotFound(_0x2e1333,null))[_0xa2ff('0x21')](respondWithResult(_0x2e1333,null))[_0xa2ff('0x45')](handleError(_0x2e1333,null));};exports[_0xa2ff('0x46')]=function(_0x3310db,_0x2d3eba){return db[_0xa2ff('0x2b')][_0xa2ff('0x46')](_0x3310db[_0xa2ff('0x47')],{})[_0xa2ff('0x21')](function(_0xb06161){var _0x34bbed=_0x3310db['user']['get']({'plain':!![]});if(!_0x34bbed)throw new Error(_0xa2ff('0x48'));if(_0x34bbed[_0xa2ff('0x49')]===_0xa2ff('0x4a')){var _0x2a1ea3=_0xb06161['get']({'plain':!![]});var _0x3d4c8e='Pauses';return db[_0xa2ff('0x4b')][_0xa2ff('0x44')]({'where':{'name':_0x3d4c8e,'userProfileId':_0x34bbed['userProfileId']},'raw':!![]})['then'](function(_0x4bdd59){if(_0x4bdd59&&_0x4bdd59[_0xa2ff('0x4c')]===0x0){return db[_0xa2ff('0x24')][_0xa2ff('0x46')]({'name':_0x2a1ea3[_0xa2ff('0x27')],'resourceId':_0x2a1ea3['id'],'type':_0x4bdd59['name'],'sectionId':_0x4bdd59['id']},{})[_0xa2ff('0x21')](function(){return _0xb06161;});}else{return _0xb06161;}})[_0xa2ff('0x45')](function(_0x302bcb){logger['error'](_0xa2ff('0x4d'),_0x302bcb);throw _0x302bcb;});}return _0xb06161;})[_0xa2ff('0x21')](respondWithResult(_0x2d3eba,0xc9))['catch'](handleError(_0x2d3eba,null));};exports[_0xa2ff('0x20')]=function(_0x1292c6,_0x111dd3){if(_0x1292c6['body']['id']){delete _0x1292c6[_0xa2ff('0x47')]['id'];}return db[_0xa2ff('0x2b')][_0xa2ff('0x44')]({'where':{'id':_0x1292c6[_0xa2ff('0x4e')]['id']}})[_0xa2ff('0x21')](handleEntityNotFound(_0x111dd3,null))[_0xa2ff('0x21')](saveUpdates(_0x1292c6[_0xa2ff('0x47')],null))[_0xa2ff('0x21')](respondWithResult(_0x111dd3,null))[_0xa2ff('0x45')](handleError(_0x111dd3,null));};exports['destroy']=function(_0x5d3404,_0x6ff2a4){return db[_0xa2ff('0x2b')][_0xa2ff('0x44')]({'where':{'id':_0x5d3404[_0xa2ff('0x4e')]['id']}})[_0xa2ff('0x21')](handleEntityNotFound(_0x6ff2a4,null))[_0xa2ff('0x21')](removeEntity(_0x6ff2a4,null))[_0xa2ff('0x45')](handleError(_0x6ff2a4,null));}; \ No newline at end of file diff --git a/server/api/pause/pause.model.js b/server/api/pause/pause.model.js index 61ea119..b8b211e 100644 --- a/server/api/pause/pause.model.js +++ b/server/api/pause/pause.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6aa7=['Pause','tools_pauses','lodash','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','define'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x6aa7,0x178));var _0x76aa=function(_0x198e7b,_0x1217dc){_0x198e7b=_0x198e7b-0x0;var _0x4d923d=_0x6aa7[_0x198e7b];return _0x4d923d;};'use strict';var _=require(_0x76aa('0x0'));var util=require('util');var logger=require(_0x76aa('0x1'))(_0x76aa('0x2'));var moment=require(_0x76aa('0x3'));var BPromise=require(_0x76aa('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x76aa('0x5'));var rimraf=require(_0x76aa('0x6'));var config=require(_0x76aa('0x7'));var attributes=require('./pause.attributes');module['exports']=function(_0x1aceaa,_0x4d53f6){return _0x1aceaa[_0x76aa('0x8')](_0x76aa('0x9'),attributes,{'tableName':_0x76aa('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe14b=['bluebird','path','./pause.attributes','exports','define','Pause','tools_pauses','lodash','util','moment'];(function(_0x4aeaed,_0x20506f){var _0x584c3c=function(_0x2d2e54){while(--_0x2d2e54){_0x4aeaed['push'](_0x4aeaed['shift']());}};_0x584c3c(++_0x20506f);}(_0xe14b,0x93));var _0xbe14=function(_0x211e5a,_0x316ab4){_0x211e5a=_0x211e5a-0x0;var _0x3eb1aa=_0xe14b[_0x211e5a];return _0x3eb1aa;};'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 diff --git a/server/api/pause/pause.rpc.js b/server/api/pause/pause.rpc.js index c0e5098..695ee9b 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(_0x5c8c22,_0x62b8a7){var _0x3debde=function(_0x26380f){while(--_0x26380f){_0x5c8c22['push'](_0x5c8c22['shift']());}};_0x3debde(++_0x62b8a7);}(_0x7a54,0x106));var _0x47a5=function(_0x5c7631,_0x223a57){_0x5c7631=_0x5c7631-0x0;var _0x4f0ab5=_0x7a54[_0x5c7631];return _0x4f0ab5;};'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 _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(_0x2010da,_0x27c595){var _0x203164=function(_0x5029fd){while(--_0x5029fd){_0x2010da['push'](_0x2010da['shift']());}};_0x203164(++_0x27c595);}(_0x7a54,0x106));var _0x47a5=function(_0x823dab,_0x1694f3){_0x823dab=_0x823dab-0x0;var _0xe52970=_0x7a54[_0x823dab];return _0xe52970;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('Pause,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});}exports['ShowPause']=function(_0x5247fd){var _0x423a81=this;return new Promise(function(_0xaf70a6,_0x2ce454){return db[_0x47a5('0x15')][_0x47a5('0x16')]({'raw':_0x5247fd[_0x47a5('0x17')]?_0x5247fd[_0x47a5('0x17')][_0x47a5('0x18')]===undefined?!![]:![]:!![],'where':_0x5247fd[_0x47a5('0x17')]?_0x5247fd['options'][_0x47a5('0x19')]||null:null,'attributes':_0x5247fd[_0x47a5('0x17')]?_0x5247fd['options'][_0x47a5('0x1a')]||null:null,'include':_0x5247fd[_0x47a5('0x17')]?_0x5247fd[_0x47a5('0x17')]['include']?_[_0x47a5('0x1b')](_0x5247fd[_0x47a5('0x17')][_0x47a5('0x1c')],function(_0x7a9f9e){return{'model':db[_0x7a9f9e['model']],'as':_0x7a9f9e['as'],'attributes':_0x7a9f9e[_0x47a5('0x1a')],'include':_0x7a9f9e[_0x47a5('0x1c')]?_['map'](_0x7a9f9e[_0x47a5('0x1c')],function(_0xc4cd63){return{'model':db[_0xc4cd63[_0x47a5('0x1d')]],'as':_0xc4cd63['as'],'attributes':_0xc4cd63[_0x47a5('0x1a')],'include':_0xc4cd63[_0x47a5('0x1c')]?_['map'](_0xc4cd63['include'],function(_0x136745){return{'model':db[_0x136745['model']],'as':_0x136745['as'],'attributes':_0x136745[_0x47a5('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x23cb77){logger[_0x47a5('0xb')](_0x47a5('0x1e'),_0x5247fd);logger[_0x47a5('0xd')](_0x47a5('0x1e'),_0x5247fd,JSON[_0x47a5('0xe')](_0x23cb77));_0xaf70a6(_0x23cb77);})[_0x47a5('0x14')](function(_0x136b14){logger[_0x47a5('0xf')](_0x47a5('0x1e'),_0x136b14[_0x47a5('0x11')],_0x5247fd);_0x2ce454(_0x423a81[_0x47a5('0xf')](0x1f4,_0x136b14[_0x47a5('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/plugin/index.js b/server/api/plugin/index.js index 0eda55b..034534c 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 _0xbd50=['extname','post','single','upload','webhookPost','put','/:id','update','delete','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','isAuthenticated','index','get','/webhook','webhookGet','show','download','join','root','server/files/plugins','originalname','replace','format','%s-%s%s','basename'];(function(_0x2ef515,_0x2bccd9){var _0x1a4bff=function(_0x1db1b8){while(--_0x1db1b8){_0x2ef515['push'](_0x2ef515['shift']());}};_0x1a4bff(++_0x2bccd9);}(_0xbd50,0x196));var _0x0bd5=function(_0x2efe12,_0x42b68d){_0x2efe12=_0x2efe12-0x0;var _0x330f7a=_0xbd50[_0x2efe12];return _0x330f7a;};'use strict';var multer=require(_0x0bd5('0x0'));var util=require(_0x0bd5('0x1'));var path=require(_0x0bd5('0x2'));var timeout=require('connect-timeout');var express=require(_0x0bd5('0x3'));var router=express[_0x0bd5('0x4')]();var fs_extra=require(_0x0bd5('0x5'));var auth=require(_0x0bd5('0x6'));var interaction=require(_0x0bd5('0x7'));var config=require('../../config/environment');var controller=require('./plugin.controller');router['get']('/',auth[_0x0bd5('0x8')](),controller[_0x0bd5('0x9')]);router[_0x0bd5('0xa')](_0x0bd5('0xb'),controller[_0x0bd5('0xc')]);router['get']('/:id',auth[_0x0bd5('0x8')](),controller[_0x0bd5('0xd')]);router[_0x0bd5('0xa')]('/:id/download',auth[_0x0bd5('0x8')](),controller[_0x0bd5('0xe')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x210f45,_0x7db86e,_0x4d7d17){_0x4d7d17(null,path[_0x0bd5('0xf')](config[_0x0bd5('0x10')],_0x0bd5('0x11')));},'filename':function(_0x5f49ee,_0x2f7a0c,_0x23982f){_0x2f7a0c[_0x0bd5('0x12')]=_0x2f7a0c[_0x0bd5('0x12')][_0x0bd5('0x13')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x23982f(null,util[_0x0bd5('0x14')](_0x0bd5('0x15'),path[_0x0bd5('0x16')](_0x2f7a0c['originalname'],path[_0x0bd5('0x17')](_0x2f7a0c[_0x0bd5('0x12')])),Date['now'](),path[_0x0bd5('0x17')](_0x2f7a0c[_0x0bd5('0x12')])));}})});router[_0x0bd5('0x18')]('/',upload[_0x0bd5('0x19')]('file'),controller[_0x0bd5('0x1a')]);router[_0x0bd5('0x18')](_0x0bd5('0xb'),controller[_0x0bd5('0x1b')]);router[_0x0bd5('0x1c')](_0x0bd5('0x1d'),auth[_0x0bd5('0x8')](),controller[_0x0bd5('0x1e')]);router[_0x0bd5('0x1f')](_0x0bd5('0x1d'),auth[_0x0bd5('0x8')](),controller[_0x0bd5('0x1f')]);module[_0x0bd5('0x20')]=router; \ No newline at end of file +var _0x0faf=['extname','now','post','single','file','webhookPost','put','delete','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./plugin.controller','isAuthenticated','index','get','/webhook','webhookGet','/:id','/:id/download','download','diskStorage','join','server/files/plugins','originalname','replace','basename'];(function(_0x3cd91d,_0x163516){var _0x3b4fab=function(_0x1b3319){while(--_0x1b3319){_0x3cd91d['push'](_0x3cd91d['shift']());}};_0x3b4fab(++_0x163516);}(_0x0faf,0x132));var _0xf0fa=function(_0x5f382f,_0x3f1432){_0x5f382f=_0x5f382f-0x0;var _0x3bb11b=_0x0faf[_0x5f382f];return _0x3bb11b;};'use strict';var multer=require(_0xf0fa('0x0'));var util=require('util');var path=require(_0xf0fa('0x1'));var timeout=require(_0xf0fa('0x2'));var express=require(_0xf0fa('0x3'));var router=express[_0xf0fa('0x4')]();var fs_extra=require(_0xf0fa('0x5'));var auth=require(_0xf0fa('0x6'));var interaction=require(_0xf0fa('0x7'));var config=require(_0xf0fa('0x8'));var controller=require(_0xf0fa('0x9'));router['get']('/',auth[_0xf0fa('0xa')](),controller[_0xf0fa('0xb')]);router[_0xf0fa('0xc')](_0xf0fa('0xd'),controller[_0xf0fa('0xe')]);router['get'](_0xf0fa('0xf'),auth[_0xf0fa('0xa')](),controller['show']);router['get'](_0xf0fa('0x10'),auth[_0xf0fa('0xa')](),controller[_0xf0fa('0x11')]);var upload=multer({'storage':multer[_0xf0fa('0x12')]({'destination':function(_0x2bd807,_0x1151ea,_0x379ff6){_0x379ff6(null,path[_0xf0fa('0x13')](config['root'],_0xf0fa('0x14')));},'filename':function(_0x5b38fa,_0x2f46ff,_0x521034){_0x2f46ff[_0xf0fa('0x15')]=_0x2f46ff[_0xf0fa('0x15')][_0xf0fa('0x16')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x521034(null,util['format']('%s-%s%s',path[_0xf0fa('0x17')](_0x2f46ff['originalname'],path[_0xf0fa('0x18')](_0x2f46ff[_0xf0fa('0x15')])),Date[_0xf0fa('0x19')](),path[_0xf0fa('0x18')](_0x2f46ff[_0xf0fa('0x15')])));}})});router[_0xf0fa('0x1a')]('/',upload[_0xf0fa('0x1b')](_0xf0fa('0x1c')),controller['upload']);router[_0xf0fa('0x1a')](_0xf0fa('0xd'),controller[_0xf0fa('0x1d')]);router[_0xf0fa('0x1e')](_0xf0fa('0xf'),auth[_0xf0fa('0xa')](),controller['update']);router['delete'](_0xf0fa('0xf'),auth[_0xf0fa('0xa')](),controller[_0xf0fa('0x1f')]);module[_0xf0fa('0x20')]=router; \ No newline at end of file diff --git a/server/api/plugin/plugin.attributes.js b/server/api/plugin/plugin.attributes.js index 88eb8e6..aa60a2a 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 _0x52a6=['agentOnly','always','never','Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.','sequelize','exports','STRING','ENUM','html','script','TEXT','The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.','BOOLEAN','adminOnly'];(function(_0x2c1fee,_0x85cba4){var _0xe71c25=function(_0x4ec4de){while(--_0x4ec4de){_0x2c1fee['push'](_0x2c1fee['shift']());}};_0xe71c25(++_0x85cba4);}(_0x52a6,0x1e0));var _0x652a=function(_0xa3a518,_0x20c7c7){_0xa3a518=_0xa3a518-0x0;var _0x32e155=_0x52a6[_0xa3a518];return _0x32e155;};'use strict';var Sequelize=require(_0x652a('0x0'));module[_0x652a('0x1')]={'name':{'type':Sequelize[_0x652a('0x2')]},'type':{'type':Sequelize[_0x652a('0x3')](_0x652a('0x4'),_0x652a('0x5'))},'description':{'type':Sequelize[_0x652a('0x6')]},'version':{'type':Sequelize[_0x652a('0x6')]},'path':{'type':Sequelize[_0x652a('0x2')],'comment':_0x652a('0x7')},'active':{'type':Sequelize[_0x652a('0x8')],'defaultValue':0x0,'comment':'Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.'},'sidebar':{'type':Sequelize[_0x652a('0x3')](_0x652a('0x9'),_0x652a('0xa'),_0x652a('0xb'),_0x652a('0xc')),'defaultValue':_0x652a('0xb'),'comment':_0x652a('0xd')},'icon':{'type':Sequelize[_0x652a('0x2')]},'adminUrl':{'type':Sequelize[_0x652a('0x2')]},'agentUrl':{'type':Sequelize[_0x652a('0x2')]},'scriptName':{'type':Sequelize[_0x652a('0x2')]},'scriptPath':{'type':Sequelize[_0x652a('0x2')]}}; \ No newline at end of file +var _0x238d=['sequelize','exports','STRING','ENUM','script','TEXT','Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.','adminOnly','agentOnly','always','never','Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.'];(function(_0x315a04,_0x36e566){var _0x176926=function(_0x4db34d){while(--_0x4db34d){_0x315a04['push'](_0x315a04['shift']());}};_0x176926(++_0x36e566);}(_0x238d,0x1bc));var _0xd238=function(_0x487f86,_0x32d35b){_0x487f86=_0x487f86-0x0;var _0x49cf32=_0x238d[_0x487f86];return _0x49cf32;};'use strict';var Sequelize=require(_0xd238('0x0'));module[_0xd238('0x1')]={'name':{'type':Sequelize[_0xd238('0x2')]},'type':{'type':Sequelize[_0xd238('0x3')]('html',_0xd238('0x4'))},'description':{'type':Sequelize[_0xd238('0x5')]},'version':{'type':Sequelize[_0xd238('0x5')]},'path':{'type':Sequelize[_0xd238('0x2')],'comment':'The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.'},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0xd238('0x6')},'sidebar':{'type':Sequelize[_0xd238('0x3')](_0xd238('0x7'),_0xd238('0x8'),_0xd238('0x9'),_0xd238('0xa')),'defaultValue':_0xd238('0x9'),'comment':_0xd238('0xb')},'icon':{'type':Sequelize['STRING']},'adminUrl':{'type':Sequelize[_0xd238('0x2')]},'agentUrl':{'type':Sequelize[_0xd238('0x2')]},'scriptName':{'type':Sequelize[_0xd238('0x2')]},'scriptPath':{'type':Sequelize[_0xd238('0x2')]}}; \ No newline at end of file diff --git a/server/api/plugin/plugin.controller.js b/server/api/plugin/plugin.controller.js index 3d3743f..eca3670 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 _0x3d8e=['sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','then','destroy','get','end','error','name','send','index','map','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','Plugin','include','findAll','params','find','download','root','format','%s.zip','createWriteStream','zip','warning','code','ENOENT','Sequelize','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','pipe','join','server/files/plugins','dirname','node_modules/**/*','basename','finalize','close','existsSync','Plugin\x20not\x20found','Error\x20while\x20downloading\x20the\x20plugin','unlinkSync','info','Temporary\x20file\x20removed','catch','upload','filename','extname','file','Plugin\x20upload\x20destination:\x20%s','chmodSync','0777','readdirSync','length','Invalid\x20plugin\x20structure','lstatSync','isFile','isDirectory','some','manifest.json','readFileSync','parse','Invalid\x20manifest:\x20type\x20missing','version','Invalid\x20manifest:\x20version\x20not\x20specified','parameters','Invalid\x20manifest:\x20parameters\x20missing','html','views','Invalid\x20manifest:\x20views\x20missing','admin','agent','Invalid\x20manifest:\x20no\x20view\x20specified','script','scriptName','Invalid\x20manifest:\x20script\x20name\x20missing','scriptPath','Invalid\x20manifest:\x20script\x20path\x20missing','Invalid\x20manifest:\x20invalid\x20type','sidebar','always','icon','icon-apps','plugins','Warning:\x20admin\x20view\x20not\x20specified','test','create','body','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','autoAssociation','Zip\x20archive\x20removed','delete','webhookGet','resolve','\x27PATH\x27\x20parameter\x20not\x20specified','port','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','http://localhost:','encoding','headers','content-length','content-type','endsWith','statusCode','webhookPost','%s%s','eml-format','rimraf','zip-dir','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','extract-zip','archiver','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','redis','defaults','localhost','socket.io-emitter','register'];(function(_0xc2fc17,_0x2b78be){var _0x5b4fe0=function(_0x5f1e00){while(--_0x5f1e00){_0xc2fc17['push'](_0xc2fc17['shift']());}};_0x5b4fe0(++_0x2b78be);}(_0x3d8e,0x12f));var _0xe3d8=function(_0x38b100,_0x177901){_0x38b100=_0x38b100-0x0;var _0x2bece2=_0x3d8e[_0x38b100];return _0x2bece2;};'use strict';var emlformat=require(_0xe3d8('0x0'));var rimraf=require(_0xe3d8('0x1'));var zipdir=require(_0xe3d8('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xe3d8('0x3'));var Mustache=require(_0xe3d8('0x4'));var util=require(_0xe3d8('0x5'));var path=require(_0xe3d8('0x6'));var sox=require(_0xe3d8('0x7'));var csv=require(_0xe3d8('0x8'));var ejs=require(_0xe3d8('0x9'));var fs=require('fs');var fs_extra=require(_0xe3d8('0xa'));var _=require('lodash');var squel=require(_0xe3d8('0xb'));var crypto=require(_0xe3d8('0xc'));var jsforce=require(_0xe3d8('0xd'));var deskjs=require(_0xe3d8('0xe'));var toCsv=require('to-csv');var querystring=require(_0xe3d8('0xf'));var Papa=require(_0xe3d8('0x10'));var extract=require(_0xe3d8('0x11'));var rimraf=require('rimraf');var archiver=require(_0xe3d8('0x12'));var Redis=require(_0xe3d8('0x13'));var authService=require('../../components/auth/service');var qs=require(_0xe3d8('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe3d8('0x15'));var logger=require(_0xe3d8('0x16'))(_0xe3d8('0x17'));var utils=require(_0xe3d8('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0xe3d8('0x19'));var db=require('../../mysqldb')['db'];config[_0xe3d8('0x1a')]=_[_0xe3d8('0x1b')](config['redis'],{'host':_0xe3d8('0x1c'),'port':0x18eb});var socket=require(_0xe3d8('0x1d'))(new Redis(config[_0xe3d8('0x1a')]));require('./plugin.socket')[_0xe3d8('0x1e')](socket);function respondWithStatusCode(_0x44361c,_0x34ce31){_0x34ce31=_0x34ce31||0xcc;return function(_0x4460e3){if(_0x4460e3){return _0x44361c[_0xe3d8('0x1f')](_0x34ce31);}return _0x44361c['status'](_0x34ce31)['end']();};}function respondWithResult(_0x24f639,_0x5541c0){_0x5541c0=_0x5541c0||0xc8;return function(_0x10ae5f){if(_0x10ae5f){return _0x24f639[_0xe3d8('0x20')](_0x5541c0)[_0xe3d8('0x21')](_0x10ae5f);}};}function respondWithFilteredResult(_0x34c4f2,_0x4b4bb0){return function(_0x5cf896){if(_0x5cf896){var _0x48ec1b=typeof _0x4b4bb0[_0xe3d8('0x22')]===_0xe3d8('0x23')&&typeof _0x4b4bb0[_0xe3d8('0x24')]===_0xe3d8('0x23');var _0xdb1c0c=_0x5cf896['count'];var _0x251951=_0x48ec1b?0x0:_0x4b4bb0[_0xe3d8('0x22')];var _0xded23b=_0x48ec1b?_0x5cf896[_0xe3d8('0x25')]:_0x4b4bb0['offset']+_0x4b4bb0[_0xe3d8('0x24')];var _0x5177d7;if(_0xded23b>=_0xdb1c0c){_0xded23b=_0xdb1c0c;_0x5177d7=0xc8;}else{_0x5177d7=0xce;}_0x34c4f2[_0xe3d8('0x20')](_0x5177d7);return _0x34c4f2[_0xe3d8('0x26')](_0xe3d8('0x27'),_0x251951+'-'+_0xded23b+'/'+_0xdb1c0c)[_0xe3d8('0x21')](_0x5cf896);}return null;};}function patchUpdates(_0x91183e){return function(_0x5da0f1){try{jsonpatch['apply'](_0x5da0f1,_0x91183e,!![]);}catch(_0x3875e2){return BPromise[_0xe3d8('0x28')](_0x3875e2);}return _0x5da0f1[_0xe3d8('0x29')]();};}function saveUpdates(_0x84d9,_0x2b0b6a){return function(_0x5f4935){if(_0x5f4935){return _0x5f4935['update'](_0x84d9)[_0xe3d8('0x2a')](function(_0x33e321){return _0x33e321;});}return null;};}function removeEntity(_0x5c4eac,_0x52c6fb){return function(_0x5ec03f){if(_0x5ec03f){return _0x5ec03f[_0xe3d8('0x2b')]()[_0xe3d8('0x2a')](function(){var _0x17b794=_0x5ec03f[_0xe3d8('0x2c')]({'plain':!![]});var _0x1ea882='Plugins';return db['UserProfileResource'][_0xe3d8('0x2b')]({'where':{'type':_0x1ea882,'resourceId':_0x17b794['id']}})[_0xe3d8('0x2a')](function(){return _0x5ec03f;});})['then'](function(){_0x5c4eac['status'](0xcc)[_0xe3d8('0x2d')]();});}};}function handleEntityNotFound(_0x31287d,_0x59197f){return function(_0x270dc9){if(!_0x270dc9){_0x31287d[_0xe3d8('0x1f')](0x194);}return _0x270dc9;};}function handleError(_0x3ec66f,_0x456158){_0x456158=_0x456158||0x1f4;return function(_0x5ba303){logger[_0xe3d8('0x2e')](_0x5ba303['stack']);if(_0x5ba303[_0xe3d8('0x2f')]){delete _0x5ba303[_0xe3d8('0x2f')];}_0x3ec66f['status'](_0x456158)[_0xe3d8('0x30')](_0x5ba303);};}exports[_0xe3d8('0x31')]=function(_0x36a9b7,_0x58434f){var _0x1e017f={},_0x364ef2={},_0xd1a6e5={'count':0x0,'rows':[]};var _0x25ba8d=_[_0xe3d8('0x32')](db['Plugin'][_0xe3d8('0x33')],function(_0x1655f1){return{'name':_0x1655f1[_0xe3d8('0x34')],'type':_0x1655f1[_0xe3d8('0x35')]['key']};});_0x364ef2[_0xe3d8('0x36')]=_[_0xe3d8('0x32')](_0x25ba8d,_0xe3d8('0x2f'));_0x364ef2[_0xe3d8('0x37')]=_[_0xe3d8('0x38')](_0x36a9b7['query']);_0x364ef2[_0xe3d8('0x39')]=_[_0xe3d8('0x3a')](_0x364ef2[_0xe3d8('0x36')],_0x364ef2[_0xe3d8('0x37')]);_0x1e017f[_0xe3d8('0x3b')]=_[_0xe3d8('0x3a')](_0x364ef2['model'],qs[_0xe3d8('0x3c')](_0x36a9b7['query']['fields']));_0x1e017f[_0xe3d8('0x3b')]=_0x1e017f[_0xe3d8('0x3b')]['length']?_0x1e017f['attributes']:_0x364ef2[_0xe3d8('0x36')];if(!_0x36a9b7[_0xe3d8('0x37')][_0xe3d8('0x3d')](_0xe3d8('0x3e'))){_0x1e017f[_0xe3d8('0x24')]=qs[_0xe3d8('0x24')](_0x36a9b7[_0xe3d8('0x37')][_0xe3d8('0x24')]);_0x1e017f[_0xe3d8('0x22')]=qs['offset'](_0x36a9b7[_0xe3d8('0x37')][_0xe3d8('0x22')]);}_0x1e017f[_0xe3d8('0x3f')]=qs[_0xe3d8('0x40')](_0x36a9b7[_0xe3d8('0x37')]['sort']);_0x1e017f[_0xe3d8('0x41')]=qs[_0xe3d8('0x39')](_['pick'](_0x36a9b7['query'],_0x364ef2[_0xe3d8('0x39')]),_0x25ba8d);if(_0x36a9b7[_0xe3d8('0x37')][_0xe3d8('0x42')]){_0x1e017f[_0xe3d8('0x41')]=_[_0xe3d8('0x43')](_0x1e017f[_0xe3d8('0x41')],{'$or':_['map'](_0x25ba8d,function(_0x302e6e){if(_0x302e6e[_0xe3d8('0x35')]!==_0xe3d8('0x44')){var _0x2f4014={};_0x2f4014[_0x302e6e['name']]={'$like':'%'+_0x36a9b7['query']['filter']+'%'};return _0x2f4014;}})});}_0x1e017f=_['merge']({},_0x1e017f,_0x36a9b7[_0xe3d8('0x45')]);var _0x44a2e5={'where':_0x1e017f[_0xe3d8('0x41')]};return db[_0xe3d8('0x46')][_0xe3d8('0x25')](_0x44a2e5)[_0xe3d8('0x2a')](function(_0x4d9ab7){_0xd1a6e5[_0xe3d8('0x25')]=_0x4d9ab7;if(_0x36a9b7[_0xe3d8('0x37')]['includeAll']){_0x1e017f[_0xe3d8('0x47')]=[{'all':!![]}];}return db[_0xe3d8('0x46')][_0xe3d8('0x48')](_0x1e017f);})[_0xe3d8('0x2a')](function(_0x403eaa){_0xd1a6e5['rows']=_0x403eaa;return _0xd1a6e5;})[_0xe3d8('0x2a')](respondWithFilteredResult(_0x58434f,_0x1e017f))['catch'](handleError(_0x58434f,null));};exports['show']=function(_0x466daa,_0x1383c7){var _0x441b46={'raw':!![],'where':{'id':_0x466daa[_0xe3d8('0x49')]['id']}},_0x16a48d={};_0x16a48d[_0xe3d8('0x36')]=_['keys'](db[_0xe3d8('0x46')][_0xe3d8('0x33')]);_0x16a48d[_0xe3d8('0x37')]=_[_0xe3d8('0x38')](_0x466daa[_0xe3d8('0x37')]);_0x16a48d[_0xe3d8('0x39')]=_[_0xe3d8('0x3a')](_0x16a48d[_0xe3d8('0x36')],_0x16a48d[_0xe3d8('0x37')]);_0x441b46[_0xe3d8('0x3b')]=_[_0xe3d8('0x3a')](_0x16a48d[_0xe3d8('0x36')],qs[_0xe3d8('0x3c')](_0x466daa[_0xe3d8('0x37')][_0xe3d8('0x3c')]));_0x441b46[_0xe3d8('0x3b')]=_0x441b46[_0xe3d8('0x3b')]['length']?_0x441b46[_0xe3d8('0x3b')]:_0x16a48d[_0xe3d8('0x36')];if(_0x466daa[_0xe3d8('0x37')]['includeAll']){_0x441b46['include']=[{'all':!![]}];}_0x441b46=_[_0xe3d8('0x43')]({},_0x441b46,_0x466daa[_0xe3d8('0x45')]);return db['Plugin'][_0xe3d8('0x4a')](_0x441b46)[_0xe3d8('0x2a')](handleEntityNotFound(_0x1383c7,null))[_0xe3d8('0x2a')](respondWithResult(_0x1383c7,null))['catch'](handleError(_0x1383c7,null));};exports[_0xe3d8('0x4b')]=function(_0x4cd9fa,_0x14efb0,_0x339791){return db[_0xe3d8('0x46')][_0xe3d8('0x4a')]({'where':{'id':_0x4cd9fa[_0xe3d8('0x49')]['id']},'attributes':[_0xe3d8('0x2f'),_0xe3d8('0x6')],'raw':!![]})['then'](handleEntityNotFound(_0x14efb0,null))['then'](function(_0x1de3e7){if(_0x1de3e7){var _0x2fa461=path['join'](config[_0xe3d8('0x4c')],'server/files/plugins',util[_0xe3d8('0x4d')](_0xe3d8('0x4e'),path['basename'](_0x1de3e7[_0xe3d8('0x6')])));var _0x51b33d=fs[_0xe3d8('0x4f')](_0x2fa461);var _0x5e2ef2=archiver(_0xe3d8('0x50'),{'zlib':{'level':0x9}});_0x5e2ef2['on'](_0xe3d8('0x51'),function(_0x4a5c95){if(_0x4a5c95[_0xe3d8('0x52')]===_0xe3d8('0x53')){logger[_0xe3d8('0x2e')](_0x4a5c95);}else{throw new db[(_0xe3d8('0x54'))][(_0xe3d8('0x55'))](_0xe3d8('0x56'));}});_0x5e2ef2['on'](_0xe3d8('0x2e'),function(_0x19957f){throw new db[(_0xe3d8('0x54'))][(_0xe3d8('0x55'))](_0xe3d8('0x56'));});_0x5e2ef2[_0xe3d8('0x57')](_0x51b33d);_0x5e2ef2['glob']('**/*',{'cwd':path[_0xe3d8('0x58')](config['root'],_0xe3d8('0x59'),path[_0xe3d8('0x5a')](_0x1de3e7['path'])),'ignore':[path[_0xe3d8('0x58')](path['basename'](_0x1de3e7['path']),_0xe3d8('0x5b')),path[_0xe3d8('0x58')](path[_0xe3d8('0x5c')](_0x1de3e7[_0xe3d8('0x6')]),'attachments/**/*')],'nodir':!![]})[_0xe3d8('0x5d')]();_0x51b33d['on'](_0xe3d8('0x5e'),function(){if(!fs[_0xe3d8('0x5f')](_0x2fa461)){throw new db[(_0xe3d8('0x54'))]['Error'](_0xe3d8('0x60'));}return _0x14efb0[_0xe3d8('0x4b')](_0x2fa461,util['format'](_0xe3d8('0x4e'),path[_0xe3d8('0x5c')](_0x1de3e7[_0xe3d8('0x6')])),function(_0x5866e5){if(_0x5866e5){throw new db['Sequelize'][(_0xe3d8('0x55'))](_0xe3d8('0x61'));}fs[_0xe3d8('0x62')](_0x2fa461);logger[_0xe3d8('0x63')]('Download\x20completed');logger[_0xe3d8('0x63')](_0xe3d8('0x64'));});});}return null;})[_0xe3d8('0x65')](handleError(_0x14efb0,null));};exports[_0xe3d8('0x66')]=function(_0x97a3e6,_0x180d2d,_0x5a92cc){var _0x7f3c74=path[_0xe3d8('0x5c')](_0x97a3e6['file'][_0xe3d8('0x67')],path[_0xe3d8('0x68')](_0x97a3e6['file'][_0xe3d8('0x67')]));var _0x3038b6=path[_0xe3d8('0x58')](config[_0xe3d8('0x4c')],_0xe3d8('0x59'),_0x97a3e6[_0xe3d8('0x69')][_0xe3d8('0x67')]);var _0x757161=path[_0xe3d8('0x58')](config[_0xe3d8('0x4c')],_0xe3d8('0x59'),_0x7f3c74);logger[_0xe3d8('0x63')]('Plugin\x20upload\x20filepath:\x20%s',_0x3038b6);logger[_0xe3d8('0x63')](_0xe3d8('0x6a'),_0x757161);try{fs[_0xe3d8('0x6b')](_0x3038b6,parseInt(_0xe3d8('0x6c'),0x8));extract(_0x3038b6,{'dir':_0x757161},function(_0x307b83){if(_0x307b83){logger[_0xe3d8('0x2e')](_0x307b83);handleError(_0x307b83,!![]);};var _0x473423=fs[_0xe3d8('0x6d')](_0x757161);if(_0x473423[_0xe3d8('0x6e')]>0x1){removeReferences(_0x3038b6,_0x757161);logger[_0xe3d8('0x2e')]('Invalid\x20plugin\x20structure');return _0x5a92cc(new Error(_0xe3d8('0x6f')));}var _0x309f1c=fs[_0xe3d8('0x70')](path[_0xe3d8('0x58')](_0x757161,_0x473423[0x0]));if(_0x309f1c[_0xe3d8('0x71')]()){removeReferences(_0x3038b6,_0x757161);logger[_0xe3d8('0x2e')](_0xe3d8('0x6f'));return _0x5a92cc(new Error(_0xe3d8('0x6f')));}if(_0x309f1c[_0xe3d8('0x72')]()){var _0x3eb12f=fs[_0xe3d8('0x6d')](path['join'](_0x757161,_0x473423[0x0]));if(_0x3eb12f['length']===0x0){removeReferences(_0x3038b6,_0x757161);logger[_0xe3d8('0x2e')](_0xe3d8('0x6f'));return _0x5a92cc(new Error('Invalid\x20plugin\x20structure'));}var _0xb37063=_0x3eb12f[_0xe3d8('0x73')](function(_0xed9f44){return _0xed9f44===_0xe3d8('0x74');});if(!_0xb37063){return _0x5a92cc(new Error('Plugin\x20manifest\x20missing'));}var _0x2b54a7=fs[_0xe3d8('0x75')](path[_0xe3d8('0x58')](_0x757161,_0x473423[0x0],_0xe3d8('0x74')));var _0x30c1da=JSON[_0xe3d8('0x76')](_0x2b54a7);if(_0xe3d8('0x23')==typeof _0x30c1da[_0xe3d8('0x2f')]){return _0x5a92cc(new Error('Invalid\x20manifest:\x20name\x20missing'));}if('undefined'==typeof _0x30c1da[_0xe3d8('0x35')]){return _0x5a92cc(new Error(_0xe3d8('0x77')));}if(_0xe3d8('0x23')==typeof _0x30c1da[_0xe3d8('0x78')]){return _0x5a92cc(new Error(_0xe3d8('0x79')));}if('undefined'==typeof _0x30c1da[_0xe3d8('0x7a')]){return _0x5a92cc(new Error(_0xe3d8('0x7b')));}if(_0x30c1da[_0xe3d8('0x35')]===_0xe3d8('0x7c')){if(_0xe3d8('0x23')==typeof _0x30c1da[_0xe3d8('0x7a')][_0xe3d8('0x7d')]){return _0x5a92cc(new Error(_0xe3d8('0x7e')));}if(_0xe3d8('0x23')==typeof _0x30c1da[_0xe3d8('0x7a')]['views'][_0xe3d8('0x7f')]&&'undefined'==typeof _0x30c1da['parameters'][_0xe3d8('0x7d')][_0xe3d8('0x80')]){return _0x5a92cc(new Error(_0xe3d8('0x81')));}}else if(_0x30c1da[_0xe3d8('0x35')]===_0xe3d8('0x82')){if(_0xe3d8('0x23')==typeof _0x30c1da[_0xe3d8('0x7a')][_0xe3d8('0x83')]){return _0x5a92cc(new Error(_0xe3d8('0x84')));}if('undefined'==typeof _0x30c1da[_0xe3d8('0x7a')][_0xe3d8('0x85')]){return _0x5a92cc(new Error(_0xe3d8('0x86')));}}else{return _0x5a92cc(new Error(_0xe3d8('0x87')));}var _0x2f5de0=_0x30c1da[_0xe3d8('0x2f')];var _0x9ccf44=_0x30c1da['description'];var _0x4b4d69=_0x30c1da[_0xe3d8('0x35')];var _0x1b8a67=_0x30c1da[_0xe3d8('0x88')]?_0x30c1da['sidebar']:_0xe3d8('0x89');var _0x39fa10=_0x30c1da[_0xe3d8('0x8a')]?_0x30c1da[_0xe3d8('0x8a')]:_0xe3d8('0x8b');var _0x1053d5='';var _0x156eca='';var _0xf476d8='';var _0x36690a='';var _0x51ef8c=_0x30c1da[_0xe3d8('0x78')];if(_0x4b4d69===_0xe3d8('0x7c')){if(_0xe3d8('0x23')!=typeof _0x30c1da[_0xe3d8('0x7a')][_0xe3d8('0x7d')]['admin']){var _0x17c2a1=_0x30c1da[_0xe3d8('0x7a')][_0xe3d8('0x7d')]['admin'];if(!/^(f|ht)tps?:\/\//i['test'](_0x17c2a1)){_0x1053d5=path['join'](_0xe3d8('0x8c'),_0x7f3c74,_0x473423[0x0],_0x17c2a1);}else{_0x1053d5=_0x17c2a1;}}else{logger[_0xe3d8('0x63')](_0xe3d8('0x8d'));}if(_0xe3d8('0x23')!=typeof _0x30c1da[_0xe3d8('0x7a')][_0xe3d8('0x7d')][_0xe3d8('0x80')]){var _0xe1ec27=_0x30c1da[_0xe3d8('0x7a')]['views'][_0xe3d8('0x80')];if(!/^(f|ht)tps?:\/\//i[_0xe3d8('0x8e')](_0xe1ec27)){_0x156eca=path['join']('plugins',_0x7f3c74,_0x473423[0x0],_0xe1ec27);}else{_0x156eca=_0xe1ec27;}}else{logger['info']('Warning:\x20agent\x20view\x20not\x20specified');}}else if(_0x4b4d69===_0xe3d8('0x82')){_0xf476d8=_0x30c1da[_0xe3d8('0x7a')][_0xe3d8('0x83')];_0x36690a=_0x30c1da[_0xe3d8('0x7a')][_0xe3d8('0x85')];if(_0xe3d8('0x23')!=typeof _0x30c1da[_0xe3d8('0x7a')][_0xe3d8('0x7d')]){if('undefined'!=typeof _0x30c1da['parameters'][_0xe3d8('0x7d')]['admin']){var _0x17c2a1=_0x30c1da[_0xe3d8('0x7a')][_0xe3d8('0x7d')][_0xe3d8('0x7f')];if(!/^(f|ht)tps?:\/\//i[_0xe3d8('0x8e')](_0x17c2a1)){_0x1053d5=path[_0xe3d8('0x58')](_0xe3d8('0x8c'),_0x7f3c74,_0x473423[0x0],_0x17c2a1);}else{_0x1053d5=_0x17c2a1;}}if(_0xe3d8('0x23')!=typeof _0x30c1da[_0xe3d8('0x7a')][_0xe3d8('0x7d')][_0xe3d8('0x80')]){var _0xe1ec27=_0x30c1da['parameters'][_0xe3d8('0x7d')][_0xe3d8('0x80')];if(!/^(f|ht)tps?:\/\//i[_0xe3d8('0x8e')](_0xe1ec27)){_0x156eca=path[_0xe3d8('0x58')](_0xe3d8('0x8c'),_0x7f3c74,_0x473423[0x0],_0xe1ec27);}else{_0x156eca=_0xe1ec27;}}}}var _0x121b28={'name':_0x2f5de0,'description':_0x9ccf44,'path':path[_0xe3d8('0x58')](_0x7f3c74,_0x473423[0x0]),'type':_0x4b4d69,'sidebar':_0x1b8a67,'icon':_0x39fa10,'adminUrl':_0x1053d5,'agentUrl':_0x156eca,'scriptName':_0xf476d8,'scriptPath':_0x36690a,'version':_0x51ef8c};removeReferences(_0x3038b6,null);return db[_0xe3d8('0x46')][_0xe3d8('0x8f')](_0x121b28)[_0xe3d8('0x2a')](function(_0x6f38c){var _0x1b35cd={'role':_0x97a3e6[_0xe3d8('0x90')]['role'],'userProfileId':_0x97a3e6[_0xe3d8('0x90')][_0xe3d8('0x91')]};if(!_0x1b35cd)throw new Error(_0xe3d8('0x92'));if(_0x1b35cd[_0xe3d8('0x93')]===_0xe3d8('0x94')){var _0xaf2b7=_0x6f38c[_0xe3d8('0x2c')]({'plain':!![]});return db['UserProfileSection'][_0xe3d8('0x4a')]({'where':{'name':'Plugins','userProfileId':_0x1b35cd[_0xe3d8('0x91')]},'raw':!![]})[_0xe3d8('0x2a')](function(_0x46c2d9){if(_0x46c2d9&&_0x46c2d9[_0xe3d8('0x95')]===0x0){return db['UserProfileResource'][_0xe3d8('0x8f')]({'name':_0xaf2b7[_0xe3d8('0x2f')],'resourceId':_0xaf2b7['id'],'type':_0x46c2d9[_0xe3d8('0x2f')],'sectionId':_0x46c2d9['id']},{})[_0xe3d8('0x2a')](function(){return _0x6f38c;});}else{return _0x6f38c;}})[_0xe3d8('0x65')](function(_0x14c69e){logger[_0xe3d8('0x2e')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x14c69e);throw _0x14c69e;});}return _0x6f38c;})[_0xe3d8('0x2a')](respondWithResult(_0x180d2d,null))[_0xe3d8('0x65')](handleError(_0x180d2d,null));}});}catch(_0x4c319d){_0x180d2d[_0xe3d8('0x20')](0x1f4)[_0xe3d8('0x30')](_0x4c319d);}};function removeReferences(_0x1d0284,_0x2731fe){try{if(_0x1d0284){fs[_0xe3d8('0x62')](_0x1d0284);logger[_0xe3d8('0x63')](_0xe3d8('0x96'));}if(_0x2731fe){rimraf(_0x2731fe,function(){});logger[_0xe3d8('0x63')]('Extracted\x20folder\x20removed');}}catch(_0x1793cb){logger[_0xe3d8('0x2e')](_0x1793cb);}}exports['update']=function(_0x1deed7,_0x31a98c,_0x340a55){return db[_0xe3d8('0x46')][_0xe3d8('0x4a')]({'where':{'id':_0x1deed7[_0xe3d8('0x49')]['id']}})[_0xe3d8('0x2a')](handleEntityNotFound(_0x31a98c,null))[_0xe3d8('0x2a')](saveUpdates(_0x1deed7[_0xe3d8('0x90')],null))[_0xe3d8('0x2a')](respondWithResult(_0x31a98c,null))[_0xe3d8('0x65')](handleError(_0x31a98c,null));};exports[_0xe3d8('0x97')]=function(_0x571c1b,_0x343fc0,_0x13d23f){return db['Plugin'][_0xe3d8('0x4a')]({'where':{'id':_0x571c1b[_0xe3d8('0x49')]['id']}})[_0xe3d8('0x2a')](function(_0x5253e7){if(_0x5253e7){return _0x5253e7[_0xe3d8('0x2b')]();}})[_0xe3d8('0x2a')](function(_0x52e2bc){rimraf(path[_0xe3d8('0x58')](config[_0xe3d8('0x4c')],_0xe3d8('0x59'),path['dirname'](_0x52e2bc['path'])),function(){});return _0x52e2bc;})[_0xe3d8('0x2a')](handleEntityNotFound(_0x343fc0,null))['then'](respondWithStatusCode(_0x343fc0,null))[_0xe3d8('0x65')](handleError(_0x343fc0,null));};exports[_0xe3d8('0x98')]=function(_0x27c59c,_0x1a8957,_0x436a94){return BPromise[_0xe3d8('0x99')]()['then'](function(){if(!_0x27c59c[_0xe3d8('0x37')][_0xe3d8('0x6')]){throw new Error(_0xe3d8('0x9a'));}if(!_0x27c59c[_0xe3d8('0x37')][_0xe3d8('0x9b')]){throw new Error(_0xe3d8('0x9c'));}var _0x4a0510=_0x27c59c[_0xe3d8('0x37')]['hostname']?_0x27c59c[_0xe3d8('0x37')][_0xe3d8('0x9d')]+':'+_0x27c59c[_0xe3d8('0x37')][_0xe3d8('0x9b')]:_0xe3d8('0x9e')+_0x27c59c['query'][_0xe3d8('0x9b')];var _0x3ed38e=_0x27c59c[_0xe3d8('0x37')][_0xe3d8('0x21')]?_0x27c59c[_0xe3d8('0x37')][_0xe3d8('0x21')]:!![];var _0x3f8a6f=_0x27c59c[_0xe3d8('0x37')][_0xe3d8('0x9f')]?_0x27c59c['query'][_0xe3d8('0x9f')]:null;var _0x6a6225={'method':_0x27c59c['method'],'uri':util['format']('%s%s',_0x4a0510,_0x27c59c[_0xe3d8('0x37')][_0xe3d8('0x6')]),'json':_0x3ed38e,'resolveWithFullResponse':!![],'encoding':_0x3f8a6f,'qs':_0x27c59c[_0xe3d8('0x37')]};if(_0x27c59c[_0xe3d8('0xa0')]){_0x6a6225[_0xe3d8('0xa0')]=_0x27c59c[_0xe3d8('0xa0')];if(_0x6a6225[_0xe3d8('0xa0')][_0xe3d8('0xa1')]){delete _0x6a6225[_0xe3d8('0xa0')][_0xe3d8('0xa1')];}}if(_0x6a6225[_0xe3d8('0xa0')][_0xe3d8('0xa2')]){delete _0x6a6225[_0xe3d8('0xa0')][_0xe3d8('0xa2')];}return rp(_0x6a6225);})[_0xe3d8('0x2a')](function(_0x25682c){if(_0x25682c){_0x1a8957['set'](_0x25682c[_0xe3d8('0xa0')]);logger[_0xe3d8('0x63')](_0x25682c['body']);if(_[_0xe3d8('0xa3')](_0x27c59c[_0xe3d8('0x37')][_0xe3d8('0x6')],_0xe3d8('0x4b'))&&_0x25682c[_0xe3d8('0xa4')]==0x1f4){return _0x1a8957[_0xe3d8('0x1f')](_0x25682c['statusCode']);}else{return _0x1a8957[_0xe3d8('0x20')](_0x25682c[_0xe3d8('0xa4')])[_0xe3d8('0x30')](_0x25682c[_0xe3d8('0x90')]);}}else{return _0x1a8957[_0xe3d8('0x1f')](0xc8);}})['catch'](handleError(_0x1a8957,null));};exports[_0xe3d8('0xa5')]=function(_0x5e785f,_0x364d14,_0x223481){return BPromise['resolve']()[_0xe3d8('0x2a')](function(){if(!_0x5e785f[_0xe3d8('0x37')][_0xe3d8('0x6')]){throw new Error(_0xe3d8('0x9a'));}if(!_0x5e785f[_0xe3d8('0x37')]['port']){throw new Error(_0xe3d8('0x9c'));}var _0x3d5720=_0x5e785f[_0xe3d8('0x37')][_0xe3d8('0x9d')]?_0x5e785f['query'][_0xe3d8('0x9d')]+':'+_0x5e785f[_0xe3d8('0x37')][_0xe3d8('0x9b')]:_0xe3d8('0x9e')+_0x5e785f[_0xe3d8('0x37')][_0xe3d8('0x9b')];var _0x42c471=_0x5e785f[_0xe3d8('0x37')]['json']?_0x5e785f[_0xe3d8('0x37')][_0xe3d8('0x21')]:!![];var _0x1ffe34=_0x5e785f[_0xe3d8('0x37')][_0xe3d8('0x9f')]?_0x5e785f['query'][_0xe3d8('0x9f')]:null;var _0x4bf20b={'method':_0x5e785f['method'],'uri':util[_0xe3d8('0x4d')](_0xe3d8('0xa6'),_0x3d5720,_0x5e785f[_0xe3d8('0x37')][_0xe3d8('0x6')]),'json':_0x42c471,'resolveWithFullResponse':!![],'encoding':_0x1ffe34,'body':_0x5e785f[_0xe3d8('0x90')]};if(_0x5e785f[_0xe3d8('0xa0')]){_0x4bf20b[_0xe3d8('0xa0')]=_0x5e785f[_0xe3d8('0xa0')];if(_0x4bf20b[_0xe3d8('0xa0')]['content-length']){delete _0x4bf20b[_0xe3d8('0xa0')][_0xe3d8('0xa1')];}}if(_0x4bf20b['headers']['content-type']){delete _0x4bf20b[_0xe3d8('0xa0')]['content-type'];}return rp(_0x4bf20b);})['then'](function(_0x7cff22){if(_0x7cff22){_0x364d14['set'](_0x7cff22[_0xe3d8('0xa0')]);logger[_0xe3d8('0x63')](_0x7cff22['body']);return _0x364d14[_0xe3d8('0x20')](_0x7cff22['statusCode'])['send'](_0x7cff22[_0xe3d8('0x90')]);}else{return _0x364d14[_0xe3d8('0x1f')](0xc8);}})[_0xe3d8('0x65')](handleError(_0x364d14,null));}; \ No newline at end of file +var _0x46f9=['count','includeAll','include','findAll','rows','catch','show','params','find','download','join','root','server/files/plugins','format','%s.zip','basename','createWriteStream','zip','warning','code','ENOENT','Sequelize','Error\x20while\x20generating\x20the\x20zip\x20archive','Error','pipe','glob','dirname','attachments/**/*','finalize','close','existsSync','Plugin\x20not\x20found','Error\x20while\x20downloading\x20the\x20plugin','Download\x20completed','upload','filename','extname','file','info','Plugin\x20upload\x20filepath:\x20%s','Plugin\x20upload\x20destination:\x20%s','readdirSync','Invalid\x20plugin\x20structure','lstatSync','isFile','some','manifest.json','Plugin\x20manifest\x20missing','readFileSync','parse','Invalid\x20manifest:\x20name\x20missing','Invalid\x20manifest:\x20type\x20missing','version','Invalid\x20manifest:\x20version\x20not\x20specified','Invalid\x20manifest:\x20parameters\x20missing','parameters','views','Invalid\x20manifest:\x20views\x20missing','admin','agent','Invalid\x20manifest:\x20no\x20view\x20specified','script','scriptName','Invalid\x20manifest:\x20script\x20name\x20missing','scriptPath','Invalid\x20manifest:\x20script\x20path\x20missing','description','sidebar','icon','html','test','plugins','Warning:\x20admin\x20view\x20not\x20specified','Warning:\x20agent\x20view\x20not\x20specified','create','body','role','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','unlinkSync','Zip\x20archive\x20removed','Extracted\x20folder\x20removed','delete','webhookGet','resolve','\x27PATH\x27\x20parameter\x20not\x20specified','port','\x27PORT\x27\x20parameter\x20not\x20specified','http://localhost:','encoding','%s%s','headers','content-length','content-type','endsWith','statusCode','hostname','method','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./plugin.socket','sendStatus','status','json','offset','undefined','limit','set','Content-Range','apply','save','update','then','destroy','get','UserProfileResource','end','error','stack','name','send','index','map','Plugin','rawAttributes','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','where','pick','filter','merge','VIRTUAL','options'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x46f9,0x1c5));var _0x946f=function(_0x313f90,_0xa58897){_0x313f90=_0x313f90-0x0;var _0x3e0fb6=_0x46f9[_0x313f90];return _0x3e0fb6;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x946f('0x0'));var zipdir=require(_0x946f('0x1'));var jsonpatch=require(_0x946f('0x2'));var rp=require('request-promise');var moment=require(_0x946f('0x3'));var BPromise=require(_0x946f('0x4'));var Mustache=require(_0x946f('0x5'));var util=require(_0x946f('0x6'));var path=require(_0x946f('0x7'));var sox=require(_0x946f('0x8'));var csv=require('to-csv');var ejs=require(_0x946f('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x946f('0xa'));var squel=require(_0x946f('0xb'));var crypto=require(_0x946f('0xc'));var jsforce=require(_0x946f('0xd'));var deskjs=require(_0x946f('0xe'));var toCsv=require(_0x946f('0xf'));var querystring=require(_0x946f('0x10'));var Papa=require(_0x946f('0x11'));var extract=require('extract-zip');var rimraf=require(_0x946f('0x0'));var archiver=require('archiver');var Redis=require(_0x946f('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x946f('0x13'));var as=require(_0x946f('0x14'));var hardwareService=require(_0x946f('0x15'));var logger=require(_0x946f('0x16'))(_0x946f('0x17'));var utils=require(_0x946f('0x18'));var config=require(_0x946f('0x19'));var licenseUtil=require(_0x946f('0x1a'));var db=require(_0x946f('0x1b'))['db'];config[_0x946f('0x1c')]=_[_0x946f('0x1d')](config[_0x946f('0x1c')],{'host':_0x946f('0x1e'),'port':0x18eb});var socket=require(_0x946f('0x1f'))(new Redis(config[_0x946f('0x1c')]));require(_0x946f('0x20'))['register'](socket);function respondWithStatusCode(_0x48a710,_0x182dbc){_0x182dbc=_0x182dbc||0xcc;return function(_0xa016ae){if(_0xa016ae){return _0x48a710[_0x946f('0x21')](_0x182dbc);}return _0x48a710[_0x946f('0x22')](_0x182dbc)['end']();};}function respondWithResult(_0x5c2358,_0x16a7b3){_0x16a7b3=_0x16a7b3||0xc8;return function(_0x3cf46f){if(_0x3cf46f){return _0x5c2358[_0x946f('0x22')](_0x16a7b3)[_0x946f('0x23')](_0x3cf46f);}};}function respondWithFilteredResult(_0x421ff9,_0x2b33ca){return function(_0x32ec33){if(_0x32ec33){var _0x1ceb14=typeof _0x2b33ca[_0x946f('0x24')]===_0x946f('0x25')&&typeof _0x2b33ca['limit']===_0x946f('0x25');var _0x20556b=_0x32ec33['count'];var _0x3dc226=_0x1ceb14?0x0:_0x2b33ca[_0x946f('0x24')];var _0x7f615d=_0x1ceb14?_0x32ec33['count']:_0x2b33ca[_0x946f('0x24')]+_0x2b33ca[_0x946f('0x26')];var _0x3512e6;if(_0x7f615d>=_0x20556b){_0x7f615d=_0x20556b;_0x3512e6=0xc8;}else{_0x3512e6=0xce;}_0x421ff9['status'](_0x3512e6);return _0x421ff9[_0x946f('0x27')](_0x946f('0x28'),_0x3dc226+'-'+_0x7f615d+'/'+_0x20556b)[_0x946f('0x23')](_0x32ec33);}return null;};}function patchUpdates(_0x282cdb){return function(_0x13efc8){try{jsonpatch[_0x946f('0x29')](_0x13efc8,_0x282cdb,!![]);}catch(_0xa28d13){return BPromise['reject'](_0xa28d13);}return _0x13efc8[_0x946f('0x2a')]();};}function saveUpdates(_0x1d6fa0,_0x413069){return function(_0x59cb09){if(_0x59cb09){return _0x59cb09[_0x946f('0x2b')](_0x1d6fa0)[_0x946f('0x2c')](function(_0x1e6895){return _0x1e6895;});}return null;};}function removeEntity(_0x542063,_0x5a33e9){return function(_0xb91f4f){if(_0xb91f4f){return _0xb91f4f[_0x946f('0x2d')]()[_0x946f('0x2c')](function(){var _0x3fa0f2=_0xb91f4f[_0x946f('0x2e')]({'plain':!![]});var _0x6f4e8='Plugins';return db[_0x946f('0x2f')][_0x946f('0x2d')]({'where':{'type':_0x6f4e8,'resourceId':_0x3fa0f2['id']}})[_0x946f('0x2c')](function(){return _0xb91f4f;});})[_0x946f('0x2c')](function(){_0x542063[_0x946f('0x22')](0xcc)[_0x946f('0x30')]();});}};}function handleEntityNotFound(_0x2b50aa,_0x42b3cf){return function(_0x592720){if(!_0x592720){_0x2b50aa[_0x946f('0x21')](0x194);}return _0x592720;};}function handleError(_0x2f6c0c,_0x2146b1){_0x2146b1=_0x2146b1||0x1f4;return function(_0x561f90){logger[_0x946f('0x31')](_0x561f90[_0x946f('0x32')]);if(_0x561f90[_0x946f('0x33')]){delete _0x561f90[_0x946f('0x33')];}_0x2f6c0c[_0x946f('0x22')](_0x2146b1)[_0x946f('0x34')](_0x561f90);};}exports[_0x946f('0x35')]=function(_0x595724,_0x4f18be){var _0x5a2774={},_0x449e86={},_0x4fab34={'count':0x0,'rows':[]};var _0x4d7833=_[_0x946f('0x36')](db[_0x946f('0x37')][_0x946f('0x38')],function(_0x38508d){return{'name':_0x38508d['fieldName'],'type':_0x38508d[_0x946f('0x39')][_0x946f('0x3a')]};});_0x449e86['model']=_[_0x946f('0x36')](_0x4d7833,'name');_0x449e86[_0x946f('0x3b')]=_[_0x946f('0x3c')](_0x595724['query']);_0x449e86[_0x946f('0x3d')]=_[_0x946f('0x3e')](_0x449e86[_0x946f('0x3f')],_0x449e86[_0x946f('0x3b')]);_0x5a2774[_0x946f('0x40')]=_[_0x946f('0x3e')](_0x449e86[_0x946f('0x3f')],qs[_0x946f('0x41')](_0x595724[_0x946f('0x3b')][_0x946f('0x41')]));_0x5a2774[_0x946f('0x40')]=_0x5a2774[_0x946f('0x40')][_0x946f('0x42')]?_0x5a2774['attributes']:_0x449e86[_0x946f('0x3f')];if(!_0x595724['query'][_0x946f('0x43')]('nolimit')){_0x5a2774[_0x946f('0x26')]=qs['limit'](_0x595724[_0x946f('0x3b')][_0x946f('0x26')]);_0x5a2774['offset']=qs['offset'](_0x595724[_0x946f('0x3b')][_0x946f('0x24')]);}_0x5a2774[_0x946f('0x44')]=qs['sort'](_0x595724[_0x946f('0x3b')]['sort']);_0x5a2774[_0x946f('0x45')]=qs[_0x946f('0x3d')](_[_0x946f('0x46')](_0x595724[_0x946f('0x3b')],_0x449e86[_0x946f('0x3d')]),_0x4d7833);if(_0x595724[_0x946f('0x3b')][_0x946f('0x47')]){_0x5a2774[_0x946f('0x45')]=_[_0x946f('0x48')](_0x5a2774[_0x946f('0x45')],{'$or':_[_0x946f('0x36')](_0x4d7833,function(_0x4ceb5b){if(_0x4ceb5b['type']!==_0x946f('0x49')){var _0x4d7666={};_0x4d7666[_0x4ceb5b[_0x946f('0x33')]]={'$like':'%'+_0x595724['query'][_0x946f('0x47')]+'%'};return _0x4d7666;}})});}_0x5a2774=_[_0x946f('0x48')]({},_0x5a2774,_0x595724[_0x946f('0x4a')]);var _0x433b73={'where':_0x5a2774[_0x946f('0x45')]};return db[_0x946f('0x37')][_0x946f('0x4b')](_0x433b73)[_0x946f('0x2c')](function(_0x445206){_0x4fab34[_0x946f('0x4b')]=_0x445206;if(_0x595724[_0x946f('0x3b')][_0x946f('0x4c')]){_0x5a2774[_0x946f('0x4d')]=[{'all':!![]}];}return db[_0x946f('0x37')][_0x946f('0x4e')](_0x5a2774);})['then'](function(_0x5063ac){_0x4fab34[_0x946f('0x4f')]=_0x5063ac;return _0x4fab34;})[_0x946f('0x2c')](respondWithFilteredResult(_0x4f18be,_0x5a2774))[_0x946f('0x50')](handleError(_0x4f18be,null));};exports[_0x946f('0x51')]=function(_0x42e73b,_0x714eeb){var _0x3f4022={'raw':!![],'where':{'id':_0x42e73b[_0x946f('0x52')]['id']}},_0x1177a1={};_0x1177a1[_0x946f('0x3f')]=_[_0x946f('0x3c')](db[_0x946f('0x37')][_0x946f('0x38')]);_0x1177a1[_0x946f('0x3b')]=_[_0x946f('0x3c')](_0x42e73b[_0x946f('0x3b')]);_0x1177a1[_0x946f('0x3d')]=_['intersection'](_0x1177a1[_0x946f('0x3f')],_0x1177a1[_0x946f('0x3b')]);_0x3f4022[_0x946f('0x40')]=_[_0x946f('0x3e')](_0x1177a1[_0x946f('0x3f')],qs['fields'](_0x42e73b[_0x946f('0x3b')][_0x946f('0x41')]));_0x3f4022['attributes']=_0x3f4022[_0x946f('0x40')][_0x946f('0x42')]?_0x3f4022[_0x946f('0x40')]:_0x1177a1['model'];if(_0x42e73b[_0x946f('0x3b')][_0x946f('0x4c')]){_0x3f4022[_0x946f('0x4d')]=[{'all':!![]}];}_0x3f4022=_[_0x946f('0x48')]({},_0x3f4022,_0x42e73b['options']);return db['Plugin'][_0x946f('0x53')](_0x3f4022)[_0x946f('0x2c')](handleEntityNotFound(_0x714eeb,null))[_0x946f('0x2c')](respondWithResult(_0x714eeb,null))['catch'](handleError(_0x714eeb,null));};exports[_0x946f('0x54')]=function(_0x1d0134,_0x3e2955,_0x17e02e){return db[_0x946f('0x37')][_0x946f('0x53')]({'where':{'id':_0x1d0134[_0x946f('0x52')]['id']},'attributes':[_0x946f('0x33'),'path'],'raw':!![]})[_0x946f('0x2c')](handleEntityNotFound(_0x3e2955,null))['then'](function(_0x76bfa1){if(_0x76bfa1){var _0x10677d=path[_0x946f('0x55')](config[_0x946f('0x56')],_0x946f('0x57'),util[_0x946f('0x58')](_0x946f('0x59'),path[_0x946f('0x5a')](_0x76bfa1[_0x946f('0x7')])));var _0x3ba652=fs[_0x946f('0x5b')](_0x10677d);var _0x326850=archiver(_0x946f('0x5c'),{'zlib':{'level':0x9}});_0x326850['on'](_0x946f('0x5d'),function(_0x428821){if(_0x428821[_0x946f('0x5e')]===_0x946f('0x5f')){logger[_0x946f('0x31')](_0x428821);}else{throw new db[(_0x946f('0x60'))]['Error'](_0x946f('0x61'));}});_0x326850['on'](_0x946f('0x31'),function(_0x3191b2){throw new db[(_0x946f('0x60'))][(_0x946f('0x62'))](_0x946f('0x61'));});_0x326850[_0x946f('0x63')](_0x3ba652);_0x326850[_0x946f('0x64')]('**/*',{'cwd':path[_0x946f('0x55')](config[_0x946f('0x56')],'server/files/plugins',path[_0x946f('0x65')](_0x76bfa1['path'])),'ignore':[path[_0x946f('0x55')](path[_0x946f('0x5a')](_0x76bfa1[_0x946f('0x7')]),'node_modules/**/*'),path[_0x946f('0x55')](path['basename'](_0x76bfa1[_0x946f('0x7')]),_0x946f('0x66'))],'nodir':!![]})[_0x946f('0x67')]();_0x3ba652['on'](_0x946f('0x68'),function(){if(!fs[_0x946f('0x69')](_0x10677d)){throw new db['Sequelize'][(_0x946f('0x62'))](_0x946f('0x6a'));}return _0x3e2955[_0x946f('0x54')](_0x10677d,util[_0x946f('0x58')](_0x946f('0x59'),path[_0x946f('0x5a')](_0x76bfa1[_0x946f('0x7')])),function(_0x4b3ebc){if(_0x4b3ebc){throw new db[(_0x946f('0x60'))]['Error'](_0x946f('0x6b'));}fs['unlinkSync'](_0x10677d);logger['info'](_0x946f('0x6c'));logger['info']('Temporary\x20file\x20removed');});});}return null;})[_0x946f('0x50')](handleError(_0x3e2955,null));};exports[_0x946f('0x6d')]=function(_0x10f6bf,_0x3adfee,_0x1512a2){var _0xfff0aa=path[_0x946f('0x5a')](_0x10f6bf['file'][_0x946f('0x6e')],path[_0x946f('0x6f')](_0x10f6bf[_0x946f('0x70')][_0x946f('0x6e')]));var _0x440930=path[_0x946f('0x55')](config[_0x946f('0x56')],_0x946f('0x57'),_0x10f6bf[_0x946f('0x70')][_0x946f('0x6e')]);var _0x5cf45e=path['join'](config[_0x946f('0x56')],_0x946f('0x57'),_0xfff0aa);logger[_0x946f('0x71')](_0x946f('0x72'),_0x440930);logger['info'](_0x946f('0x73'),_0x5cf45e);try{fs['chmodSync'](_0x440930,parseInt('0777',0x8));extract(_0x440930,{'dir':_0x5cf45e},function(_0x3eba4f){if(_0x3eba4f){logger[_0x946f('0x31')](_0x3eba4f);handleError(_0x3eba4f,!![]);};var _0x168881=fs[_0x946f('0x74')](_0x5cf45e);if(_0x168881[_0x946f('0x42')]>0x1){removeReferences(_0x440930,_0x5cf45e);logger[_0x946f('0x31')](_0x946f('0x75'));return _0x1512a2(new Error(_0x946f('0x75')));}var _0x5011dd=fs[_0x946f('0x76')](path[_0x946f('0x55')](_0x5cf45e,_0x168881[0x0]));if(_0x5011dd[_0x946f('0x77')]()){removeReferences(_0x440930,_0x5cf45e);logger[_0x946f('0x31')]('Invalid\x20plugin\x20structure');return _0x1512a2(new Error(_0x946f('0x75')));}if(_0x5011dd['isDirectory']()){var _0x1b17e9=fs['readdirSync'](path[_0x946f('0x55')](_0x5cf45e,_0x168881[0x0]));if(_0x1b17e9[_0x946f('0x42')]===0x0){removeReferences(_0x440930,_0x5cf45e);logger[_0x946f('0x31')](_0x946f('0x75'));return _0x1512a2(new Error(_0x946f('0x75')));}var _0x46deed=_0x1b17e9[_0x946f('0x78')](function(_0x73f10d){return _0x73f10d===_0x946f('0x79');});if(!_0x46deed){return _0x1512a2(new Error(_0x946f('0x7a')));}var _0x385b6c=fs[_0x946f('0x7b')](path[_0x946f('0x55')](_0x5cf45e,_0x168881[0x0],_0x946f('0x79')));var _0x4503cd=JSON[_0x946f('0x7c')](_0x385b6c);if(_0x946f('0x25')==typeof _0x4503cd[_0x946f('0x33')]){return _0x1512a2(new Error(_0x946f('0x7d')));}if(_0x946f('0x25')==typeof _0x4503cd[_0x946f('0x39')]){return _0x1512a2(new Error(_0x946f('0x7e')));}if(_0x946f('0x25')==typeof _0x4503cd[_0x946f('0x7f')]){return _0x1512a2(new Error(_0x946f('0x80')));}if(_0x946f('0x25')==typeof _0x4503cd['parameters']){return _0x1512a2(new Error(_0x946f('0x81')));}if(_0x4503cd[_0x946f('0x39')]==='html'){if(_0x946f('0x25')==typeof _0x4503cd[_0x946f('0x82')][_0x946f('0x83')]){return _0x1512a2(new Error(_0x946f('0x84')));}if('undefined'==typeof _0x4503cd[_0x946f('0x82')][_0x946f('0x83')][_0x946f('0x85')]&&_0x946f('0x25')==typeof _0x4503cd[_0x946f('0x82')][_0x946f('0x83')][_0x946f('0x86')]){return _0x1512a2(new Error(_0x946f('0x87')));}}else if(_0x4503cd[_0x946f('0x39')]===_0x946f('0x88')){if('undefined'==typeof _0x4503cd[_0x946f('0x82')][_0x946f('0x89')]){return _0x1512a2(new Error(_0x946f('0x8a')));}if('undefined'==typeof _0x4503cd[_0x946f('0x82')][_0x946f('0x8b')]){return _0x1512a2(new Error(_0x946f('0x8c')));}}else{return _0x1512a2(new Error('Invalid\x20manifest:\x20invalid\x20type'));}var _0x24f72c=_0x4503cd['name'];var _0x23a07b=_0x4503cd[_0x946f('0x8d')];var _0x32c61d=_0x4503cd['type'];var _0x417a95=_0x4503cd['sidebar']?_0x4503cd[_0x946f('0x8e')]:'always';var _0x324db4=_0x4503cd['icon']?_0x4503cd[_0x946f('0x8f')]:'icon-apps';var _0x1814d6='';var _0x3bc2dd='';var _0x1ce3dc='';var _0x4077b5='';var _0x6d30c1=_0x4503cd['version'];if(_0x32c61d===_0x946f('0x90')){if(_0x946f('0x25')!=typeof _0x4503cd[_0x946f('0x82')][_0x946f('0x83')]['admin']){var _0xfbef48=_0x4503cd[_0x946f('0x82')][_0x946f('0x83')][_0x946f('0x85')];if(!/^(f|ht)tps?:\/\//i[_0x946f('0x91')](_0xfbef48)){_0x1814d6=path[_0x946f('0x55')](_0x946f('0x92'),_0xfff0aa,_0x168881[0x0],_0xfbef48);}else{_0x1814d6=_0xfbef48;}}else{logger['info'](_0x946f('0x93'));}if(_0x946f('0x25')!=typeof _0x4503cd[_0x946f('0x82')]['views'][_0x946f('0x86')]){var _0x3b9289=_0x4503cd[_0x946f('0x82')][_0x946f('0x83')][_0x946f('0x86')];if(!/^(f|ht)tps?:\/\//i[_0x946f('0x91')](_0x3b9289)){_0x3bc2dd=path['join'](_0x946f('0x92'),_0xfff0aa,_0x168881[0x0],_0x3b9289);}else{_0x3bc2dd=_0x3b9289;}}else{logger[_0x946f('0x71')](_0x946f('0x94'));}}else if(_0x32c61d===_0x946f('0x88')){_0x1ce3dc=_0x4503cd[_0x946f('0x82')][_0x946f('0x89')];_0x4077b5=_0x4503cd['parameters'][_0x946f('0x8b')];if(_0x946f('0x25')!=typeof _0x4503cd['parameters'][_0x946f('0x83')]){if(_0x946f('0x25')!=typeof _0x4503cd[_0x946f('0x82')][_0x946f('0x83')][_0x946f('0x85')]){var _0xfbef48=_0x4503cd[_0x946f('0x82')][_0x946f('0x83')]['admin'];if(!/^(f|ht)tps?:\/\//i[_0x946f('0x91')](_0xfbef48)){_0x1814d6=path['join'](_0x946f('0x92'),_0xfff0aa,_0x168881[0x0],_0xfbef48);}else{_0x1814d6=_0xfbef48;}}if('undefined'!=typeof _0x4503cd[_0x946f('0x82')][_0x946f('0x83')][_0x946f('0x86')]){var _0x3b9289=_0x4503cd[_0x946f('0x82')][_0x946f('0x83')][_0x946f('0x86')];if(!/^(f|ht)tps?:\/\//i[_0x946f('0x91')](_0x3b9289)){_0x3bc2dd=path['join']('plugins',_0xfff0aa,_0x168881[0x0],_0x3b9289);}else{_0x3bc2dd=_0x3b9289;}}}}var _0x3134d5={'name':_0x24f72c,'description':_0x23a07b,'path':path[_0x946f('0x55')](_0xfff0aa,_0x168881[0x0]),'type':_0x32c61d,'sidebar':_0x417a95,'icon':_0x324db4,'adminUrl':_0x1814d6,'agentUrl':_0x3bc2dd,'scriptName':_0x1ce3dc,'scriptPath':_0x4077b5,'version':_0x6d30c1};removeReferences(_0x440930,null);return db[_0x946f('0x37')][_0x946f('0x95')](_0x3134d5)[_0x946f('0x2c')](function(_0x3bb7ff){var _0x3cddcd={'role':_0x10f6bf[_0x946f('0x96')][_0x946f('0x97')],'userProfileId':_0x10f6bf[_0x946f('0x96')]['userProfileId']};if(!_0x3cddcd)throw new Error(_0x946f('0x98'));if(_0x3cddcd[_0x946f('0x97')]===_0x946f('0x99')){var _0x55e66d=_0x3bb7ff[_0x946f('0x2e')]({'plain':!![]});return db[_0x946f('0x9a')]['find']({'where':{'name':'Plugins','userProfileId':_0x3cddcd['userProfileId']},'raw':!![]})[_0x946f('0x2c')](function(_0x866aee){if(_0x866aee&&_0x866aee[_0x946f('0x9b')]===0x0){return db[_0x946f('0x2f')][_0x946f('0x95')]({'name':_0x55e66d[_0x946f('0x33')],'resourceId':_0x55e66d['id'],'type':_0x866aee[_0x946f('0x33')],'sectionId':_0x866aee['id']},{})[_0x946f('0x2c')](function(){return _0x3bb7ff;});}else{return _0x3bb7ff;}})['catch'](function(_0x422de8){logger[_0x946f('0x31')](_0x946f('0x9c'),_0x422de8);throw _0x422de8;});}return _0x3bb7ff;})[_0x946f('0x2c')](respondWithResult(_0x3adfee,null))['catch'](handleError(_0x3adfee,null));}});}catch(_0xcebc81){_0x3adfee[_0x946f('0x22')](0x1f4)[_0x946f('0x34')](_0xcebc81);}};function removeReferences(_0x273baa,_0x3edb80){try{if(_0x273baa){fs[_0x946f('0x9d')](_0x273baa);logger['info'](_0x946f('0x9e'));}if(_0x3edb80){rimraf(_0x3edb80,function(){});logger[_0x946f('0x71')](_0x946f('0x9f'));}}catch(_0xc8db67){logger['error'](_0xc8db67);}}exports[_0x946f('0x2b')]=function(_0x301d2f,_0x355513,_0x21b1bd){return db[_0x946f('0x37')][_0x946f('0x53')]({'where':{'id':_0x301d2f[_0x946f('0x52')]['id']}})[_0x946f('0x2c')](handleEntityNotFound(_0x355513,null))['then'](saveUpdates(_0x301d2f['body'],null))[_0x946f('0x2c')](respondWithResult(_0x355513,null))[_0x946f('0x50')](handleError(_0x355513,null));};exports[_0x946f('0xa0')]=function(_0x3768af,_0x44e139,_0x4b844f){return db[_0x946f('0x37')]['find']({'where':{'id':_0x3768af[_0x946f('0x52')]['id']}})[_0x946f('0x2c')](function(_0x329c8d){if(_0x329c8d){return _0x329c8d[_0x946f('0x2d')]();}})[_0x946f('0x2c')](function(_0x5d1458){rimraf(path[_0x946f('0x55')](config[_0x946f('0x56')],_0x946f('0x57'),path[_0x946f('0x65')](_0x5d1458[_0x946f('0x7')])),function(){});return _0x5d1458;})[_0x946f('0x2c')](handleEntityNotFound(_0x44e139,null))[_0x946f('0x2c')](respondWithStatusCode(_0x44e139,null))[_0x946f('0x50')](handleError(_0x44e139,null));};exports[_0x946f('0xa1')]=function(_0x2a7040,_0x2949a1,_0x5ed7b7){return BPromise[_0x946f('0xa2')]()[_0x946f('0x2c')](function(){if(!_0x2a7040[_0x946f('0x3b')][_0x946f('0x7')]){throw new Error(_0x946f('0xa3'));}if(!_0x2a7040[_0x946f('0x3b')][_0x946f('0xa4')]){throw new Error(_0x946f('0xa5'));}var _0x2421e2=_0x2a7040[_0x946f('0x3b')]['hostname']?_0x2a7040[_0x946f('0x3b')]['hostname']+':'+_0x2a7040[_0x946f('0x3b')][_0x946f('0xa4')]:_0x946f('0xa6')+_0x2a7040[_0x946f('0x3b')][_0x946f('0xa4')];var _0x460dc0=_0x2a7040[_0x946f('0x3b')]['json']?_0x2a7040[_0x946f('0x3b')][_0x946f('0x23')]:!![];var _0x410ac3=_0x2a7040['query'][_0x946f('0xa7')]?_0x2a7040['query'][_0x946f('0xa7')]:null;var _0x296ac0={'method':_0x2a7040['method'],'uri':util[_0x946f('0x58')](_0x946f('0xa8'),_0x2421e2,_0x2a7040['query'][_0x946f('0x7')]),'json':_0x460dc0,'resolveWithFullResponse':!![],'encoding':_0x410ac3,'qs':_0x2a7040['query']};if(_0x2a7040['headers']){_0x296ac0[_0x946f('0xa9')]=_0x2a7040[_0x946f('0xa9')];if(_0x296ac0['headers'][_0x946f('0xaa')]){delete _0x296ac0[_0x946f('0xa9')][_0x946f('0xaa')];}}if(_0x296ac0['headers'][_0x946f('0xab')]){delete _0x296ac0[_0x946f('0xa9')][_0x946f('0xab')];}return rp(_0x296ac0);})[_0x946f('0x2c')](function(_0x403c5e){if(_0x403c5e){_0x2949a1[_0x946f('0x27')](_0x403c5e[_0x946f('0xa9')]);logger[_0x946f('0x71')](_0x403c5e[_0x946f('0x96')]);if(_[_0x946f('0xac')](_0x2a7040[_0x946f('0x3b')][_0x946f('0x7')],'download')&&_0x403c5e[_0x946f('0xad')]==0x1f4){return _0x2949a1['sendStatus'](_0x403c5e['statusCode']);}else{return _0x2949a1[_0x946f('0x22')](_0x403c5e[_0x946f('0xad')])[_0x946f('0x34')](_0x403c5e['body']);}}else{return _0x2949a1[_0x946f('0x21')](0xc8);}})[_0x946f('0x50')](handleError(_0x2949a1,null));};exports['webhookPost']=function(_0x15e0b1,_0x38fd42,_0x31f8e7){return BPromise['resolve']()[_0x946f('0x2c')](function(){if(!_0x15e0b1[_0x946f('0x3b')][_0x946f('0x7')]){throw new Error(_0x946f('0xa3'));}if(!_0x15e0b1[_0x946f('0x3b')][_0x946f('0xa4')]){throw new Error(_0x946f('0xa5'));}var _0x5796d1=_0x15e0b1['query'][_0x946f('0xae')]?_0x15e0b1['query'][_0x946f('0xae')]+':'+_0x15e0b1[_0x946f('0x3b')]['port']:_0x946f('0xa6')+_0x15e0b1[_0x946f('0x3b')][_0x946f('0xa4')];var _0x19ec15=_0x15e0b1[_0x946f('0x3b')][_0x946f('0x23')]?_0x15e0b1[_0x946f('0x3b')]['json']:!![];var _0x2b6345=_0x15e0b1[_0x946f('0x3b')]['encoding']?_0x15e0b1[_0x946f('0x3b')]['encoding']:null;var _0xe0e3a8={'method':_0x15e0b1[_0x946f('0xaf')],'uri':util[_0x946f('0x58')](_0x946f('0xa8'),_0x5796d1,_0x15e0b1[_0x946f('0x3b')]['path']),'json':_0x19ec15,'resolveWithFullResponse':!![],'encoding':_0x2b6345,'body':_0x15e0b1[_0x946f('0x96')]};if(_0x15e0b1[_0x946f('0xa9')]){_0xe0e3a8[_0x946f('0xa9')]=_0x15e0b1['headers'];if(_0xe0e3a8[_0x946f('0xa9')][_0x946f('0xaa')]){delete _0xe0e3a8['headers'][_0x946f('0xaa')];}}if(_0xe0e3a8[_0x946f('0xa9')][_0x946f('0xab')]){delete _0xe0e3a8[_0x946f('0xa9')][_0x946f('0xab')];}return rp(_0xe0e3a8);})[_0x946f('0x2c')](function(_0x25cf59){if(_0x25cf59){_0x38fd42[_0x946f('0x27')](_0x25cf59[_0x946f('0xa9')]);logger[_0x946f('0x71')](_0x25cf59[_0x946f('0x96')]);return _0x38fd42[_0x946f('0x22')](_0x25cf59[_0x946f('0xad')])[_0x946f('0x34')](_0x25cf59[_0x946f('0x96')]);}else{return _0x38fd42[_0x946f('0x21')](0xc8);}})[_0x946f('0x50')](handleError(_0x38fd42,null));}; \ No newline at end of file diff --git a/server/api/plugin/plugin.events.js b/server/api/plugin/plugin.events.js index 6a088cb..db88234 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 _0xfdb3=['hook','exports','events','../../mysqldb','setMaxListeners','remove','emit'];(function(_0x104112,_0x342eb6){var _0x394ab4=function(_0x48db18){while(--_0x48db18){_0x104112['push'](_0x104112['shift']());}};_0x394ab4(++_0x342eb6);}(_0xfdb3,0x10c));var _0x3fdb=function(_0x14052c,_0xfe2e06){_0x14052c=_0x14052c-0x0;var _0x995d20=_0xfdb3[_0x14052c];return _0x995d20;};'use strict';var EventEmitter=require(_0x3fdb('0x0'));var Plugin=require(_0x3fdb('0x1'))['db']['Plugin'];var PluginEvents=new EventEmitter();PluginEvents[_0x3fdb('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x3fdb('0x3')};function emitEvent(_0x4bc75d){return function(_0x15c956,_0x8e594f,_0x40f934){PluginEvents[_0x3fdb('0x4')](_0x4bc75d+':'+_0x15c956['id'],_0x15c956);PluginEvents[_0x3fdb('0x4')](_0x4bc75d,_0x15c956);_0x40f934(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Plugin[_0x3fdb('0x5')](e,emitEvent(event));}}module[_0x3fdb('0x6')]=PluginEvents; \ No newline at end of file +var _0xabce=['events','../../mysqldb','Plugin','setMaxListeners','save','emit','hook'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xabce,0x103));var _0xeabc=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0xabce[_0x3b380d];return _0x54502b;};'use strict';var EventEmitter=require(_0xeabc('0x0'));var Plugin=require(_0xeabc('0x1'))['db'][_0xeabc('0x2')];var PluginEvents=new EventEmitter();PluginEvents[_0xeabc('0x3')](0x0);var events={'afterCreate':_0xeabc('0x4'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x2e01eb){return function(_0x1d9f37,_0x1a88a7,_0x5e9e2d){PluginEvents['emit'](_0x2e01eb+':'+_0x1d9f37['id'],_0x1d9f37);PluginEvents[_0xeabc('0x5')](_0x2e01eb,_0x1d9f37);_0x5e9e2d(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Plugin[_0xeabc('0x6')](e,emitEvent(event));}}module['exports']=PluginEvents; \ No newline at end of file diff --git a/server/api/plugin/plugin.model.js b/server/api/plugin/plugin.model.js index 5956446..ec02fe5 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 _0x4efd=['request-promise','path','rimraf','../../config/environment','./plugin.attributes','exports','Plugin','plugins','lodash','../../config/logger','api','moment','bluebird'];(function(_0x5df60c,_0x560ea7){var _0x492e03=function(_0x4eb77b){while(--_0x4eb77b){_0x5df60c['push'](_0x5df60c['shift']());}};_0x492e03(++_0x560ea7);}(_0x4efd,0xd8));var _0xd4ef=function(_0x220dbb,_0x99328d){_0x220dbb=_0x220dbb-0x0;var _0x2b77de=_0x4efd[_0x220dbb];return _0x2b77de;};'use strict';var _=require(_0xd4ef('0x0'));var util=require('util');var logger=require(_0xd4ef('0x1'))(_0xd4ef('0x2'));var moment=require(_0xd4ef('0x3'));var BPromise=require(_0xd4ef('0x4'));var rp=require(_0xd4ef('0x5'));var fs=require('fs');var path=require(_0xd4ef('0x6'));var rimraf=require(_0xd4ef('0x7'));var config=require(_0xd4ef('0x8'));var attributes=require(_0xd4ef('0x9'));module[_0xd4ef('0xa')]=function(_0x162495,_0x485ce9){return _0x162495['define'](_0xd4ef('0xb'),attributes,{'tableName':_0xd4ef('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7fad=['rimraf','../../config/environment','./plugin.attributes','exports','define','Plugin','plugins','util','api','moment','bluebird','request-promise','path'];(function(_0x210e6f,_0x1f28b4){var _0x27eeb6=function(_0x25e9df){while(--_0x25e9df){_0x210e6f['push'](_0x210e6f['shift']());}};_0x27eeb6(++_0x1f28b4);}(_0x7fad,0x1db));var _0xd7fa=function(_0xc82d1a,_0x145c50){_0xc82d1a=_0xc82d1a-0x0;var _0x32fad2=_0x7fad[_0xc82d1a];return _0x32fad2;};'use strict';var _=require('lodash');var util=require(_0xd7fa('0x0'));var logger=require('../../config/logger')(_0xd7fa('0x1'));var moment=require(_0xd7fa('0x2'));var BPromise=require(_0xd7fa('0x3'));var rp=require(_0xd7fa('0x4'));var fs=require('fs');var path=require(_0xd7fa('0x5'));var rimraf=require(_0xd7fa('0x6'));var config=require(_0xd7fa('0x7'));var attributes=require(_0xd7fa('0x8'));module[_0xd7fa('0x9')]=function(_0x16884a,_0x574766){return _0x16884a[_0xd7fa('0xa')](_0xd7fa('0xb'),attributes,{'tableName':_0xd7fa('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.rpc.js b/server/api/plugin/plugin.rpc.js index d59acc9..227631f 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 _0x7096=['../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','socket.io-emitter','./plugin.socket','then','info','Plugin,\x20%s,\x20%s','debug','error','code','message','result','catch','CreatePlugin','Plugin','create','stringify','lodash','util','moment','ioredis','../../mysqldb'];(function(_0x3c6ae2,_0x5c52d8){var _0x4edda=function(_0x5593eb){while(--_0x5593eb){_0x3c6ae2['push'](_0x3c6ae2['shift']());}};_0x4edda(++_0x5c52d8);}(_0x7096,0x1f3));var _0x6709=function(_0x1e7b16,_0x4607a1){_0x1e7b16=_0x1e7b16-0x0;var _0x37fadc=_0x7096[_0x1e7b16];return _0x37fadc;};'use strict';var _=require(_0x6709('0x0'));var util=require(_0x6709('0x1'));var moment=require(_0x6709('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6709('0x3'));var db=require(_0x6709('0x4'))['db'];var utils=require(_0x6709('0x5'));var logger=require(_0x6709('0x6'))(_0x6709('0x7'));var config=require('../../config/environment');var jayson=require(_0x6709('0x8'));var client=jayson[_0x6709('0x9')][_0x6709('0xa')]({'port':0x232a});config[_0x6709('0xb')]=_[_0x6709('0xc')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x6709('0xd'))(new Redis(config[_0x6709('0xb')]));require(_0x6709('0xe'))['register'](socket);function respondWithRpcPromise(_0x2bf1d8,_0x5d8492,_0x9ca161){return new BPromise(function(_0x28021e,_0x285ac8){return client['request'](_0x2bf1d8,_0x9ca161)[_0x6709('0xf')](function(_0xd40efc){logger[_0x6709('0x10')](_0x6709('0x11'),_0x5d8492,'request\x20sent');logger[_0x6709('0x12')]('Plugin,\x20%s,\x20%s,\x20%s',_0x5d8492,'request\x20sent',JSON['stringify'](_0xd40efc));if(_0xd40efc[_0x6709('0x13')]){if(_0xd40efc[_0x6709('0x13')][_0x6709('0x14')]===0x1f4){logger[_0x6709('0x13')](_0x6709('0x11'),_0x5d8492,_0xd40efc[_0x6709('0x13')][_0x6709('0x15')]);return _0x285ac8(_0xd40efc['error'][_0x6709('0x15')]);}logger['error'](_0x6709('0x11'),_0x5d8492,_0xd40efc[_0x6709('0x13')]['message']);return _0x28021e(_0xd40efc[_0x6709('0x13')]['message']);}else{logger[_0x6709('0x10')](_0x6709('0x11'),_0x5d8492,'request\x20sent');_0x28021e(_0xd40efc[_0x6709('0x16')][_0x6709('0x15')]);}})[_0x6709('0x17')](function(_0x370e15){logger[_0x6709('0x13')](_0x6709('0x11'),_0x5d8492,_0x370e15);_0x285ac8(_0x370e15);});});}exports[_0x6709('0x18')]=function(_0x1155c7){var _0x5577bf=this;return new Promise(function(_0x521548,_0x573421){return db[_0x6709('0x19')][_0x6709('0x1a')](_0x1155c7['body'],{'raw':_0x1155c7['options']?_0x1155c7['options']['raw']===undefined?!![]:![]:!![]})['then'](function(_0x5589a4){logger[_0x6709('0x10')](_0x6709('0x18'),_0x1155c7);logger[_0x6709('0x12')](_0x6709('0x18'),_0x1155c7,JSON[_0x6709('0x1b')](_0x5589a4));_0x521548(_0x5589a4);})[_0x6709('0x17')](function(_0x316358){logger[_0x6709('0x13')]('CreatePlugin',_0x316358[_0x6709('0x15')],_0x1155c7);_0x573421(_0x5577bf[_0x6709('0x13')](0x1f4,_0x316358[_0x6709('0x15')]));});});}; \ No newline at end of file +var _0xfec8=['options','raw','lodash','util','bluebird','ioredis','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./plugin.socket','request','then','info','Plugin,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','CreatePlugin','create'];(function(_0x5280eb,_0x293fb6){var _0x4da89f=function(_0x243d65){while(--_0x243d65){_0x5280eb['push'](_0x5280eb['shift']());}};_0x4da89f(++_0x293fb6);}(_0xfec8,0x107));var _0x8fec=function(_0x56b138,_0x2396d6){_0x56b138=_0x56b138-0x0;var _0x3df878=_0xfec8[_0x56b138];return _0x3df878;};'use strict';var _=require(_0x8fec('0x0'));var util=require(_0x8fec('0x1'));var moment=require('moment');var BPromise=require(_0x8fec('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8fec('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x8fec('0x4'))(_0x8fec('0x5'));var config=require(_0x8fec('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x8fec('0x7')][_0x8fec('0x8')]({'port':0x232a});config[_0x8fec('0x9')]=_[_0x8fec('0xa')](config[_0x8fec('0x9')],{'host':_0x8fec('0xb'),'port':0x18eb});var socket=require(_0x8fec('0xc'))(new Redis(config['redis']));require(_0x8fec('0xd'))['register'](socket);function respondWithRpcPromise(_0x754d4a,_0x3ff0f6,_0x2cfe12){return new BPromise(function(_0x1fc540,_0xf1fa02){return client[_0x8fec('0xe')](_0x754d4a,_0x2cfe12)[_0x8fec('0xf')](function(_0x6b010d){logger[_0x8fec('0x10')](_0x8fec('0x11'),_0x3ff0f6,_0x8fec('0x12'));logger[_0x8fec('0x13')]('Plugin,\x20%s,\x20%s,\x20%s',_0x3ff0f6,_0x8fec('0x12'),JSON[_0x8fec('0x14')](_0x6b010d));if(_0x6b010d[_0x8fec('0x15')]){if(_0x6b010d[_0x8fec('0x15')][_0x8fec('0x16')]===0x1f4){logger[_0x8fec('0x15')](_0x8fec('0x11'),_0x3ff0f6,_0x6b010d['error']['message']);return _0xf1fa02(_0x6b010d['error']['message']);}logger[_0x8fec('0x15')](_0x8fec('0x11'),_0x3ff0f6,_0x6b010d[_0x8fec('0x15')][_0x8fec('0x17')]);return _0x1fc540(_0x6b010d[_0x8fec('0x15')][_0x8fec('0x17')]);}else{logger[_0x8fec('0x10')](_0x8fec('0x11'),_0x3ff0f6,'request\x20sent');_0x1fc540(_0x6b010d['result'][_0x8fec('0x17')]);}})[_0x8fec('0x18')](function(_0x2e6d29){logger[_0x8fec('0x15')](_0x8fec('0x11'),_0x3ff0f6,_0x2e6d29);_0xf1fa02(_0x2e6d29);});});}exports[_0x8fec('0x19')]=function(_0x1c9354){var _0x2b08f5=this;return new Promise(function(_0x36ad60,_0xabc321){return db['Plugin'][_0x8fec('0x1a')](_0x1c9354['body'],{'raw':_0x1c9354[_0x8fec('0x1b')]?_0x1c9354[_0x8fec('0x1b')][_0x8fec('0x1c')]===undefined?!![]:![]:!![]})[_0x8fec('0xf')](function(_0x32ce0a){logger[_0x8fec('0x10')](_0x8fec('0x19'),_0x1c9354);logger[_0x8fec('0x13')](_0x8fec('0x19'),_0x1c9354,JSON[_0x8fec('0x14')](_0x32ce0a));_0x36ad60(_0x32ce0a);})[_0x8fec('0x18')](function(_0xee42a3){logger['error'](_0x8fec('0x19'),_0xee42a3[_0x8fec('0x17')],_0x1c9354);_0xabc321(_0x2b08f5[_0x8fec('0x15')](0x1f4,_0xee42a3['message']));});});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.socket.js b/server/api/plugin/plugin.socket.js index e2954d3..e037dc3 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 _0x7da4=['length','plugin:','./plugin.events','save','remove','emit','removeListener','register'];(function(_0x5545f7,_0x570414){var _0x52a979=function(_0x28eb97){while(--_0x28eb97){_0x5545f7['push'](_0x5545f7['shift']());}};_0x52a979(++_0x570414);}(_0x7da4,0x14a));var _0x47da=function(_0x31538c,_0x1f58d2){_0x31538c=_0x31538c-0x0;var _0x197cfd=_0x7da4[_0x31538c];return _0x197cfd;};'use strict';var PluginEvents=require(_0x47da('0x0'));var events=[_0x47da('0x1'),_0x47da('0x2'),'update'];function createListener(_0x3e856d,_0x343c4d){return function(_0x4664be){_0x343c4d[_0x47da('0x3')](_0x3e856d,_0x4664be);};}function removeListener(_0x490c98,_0x408b21){return function(){PluginEvents[_0x47da('0x4')](_0x490c98,_0x408b21);};}exports[_0x47da('0x5')]=function(_0x2a996b){for(var _0x1b6a22=0x0,_0x2c6f19=events[_0x47da('0x6')];_0x1b6a22<_0x2c6f19;_0x1b6a22++){var _0x536e38=events[_0x1b6a22];var _0x2d6bfb=createListener(_0x47da('0x7')+_0x536e38,_0x2a996b);PluginEvents['on'](_0x536e38,_0x2d6bfb);}}; \ No newline at end of file +var _0x17f0=['plugin:','./plugin.events','remove','emit','removeListener','length'];(function(_0xcbf12b,_0x4fbc71){var _0x65b619=function(_0x5a0e72){while(--_0x5a0e72){_0xcbf12b['push'](_0xcbf12b['shift']());}};_0x65b619(++_0x4fbc71);}(_0x17f0,0x67));var _0x017f=function(_0x36ed48,_0x1ee0d4){_0x36ed48=_0x36ed48-0x0;var _0x51c63a=_0x17f0[_0x36ed48];return _0x51c63a;};'use strict';var PluginEvents=require(_0x017f('0x0'));var events=['save',_0x017f('0x1'),'update'];function createListener(_0xed91df,_0x2895ac){return function(_0xe7a90){_0x2895ac[_0x017f('0x2')](_0xed91df,_0xe7a90);};}function removeListener(_0x152bc5,_0x2a1cca){return function(){PluginEvents[_0x017f('0x3')](_0x152bc5,_0x2a1cca);};}exports['register']=function(_0x552250){for(var _0x11f872=0x0,_0x5f0a14=events[_0x017f('0x4')];_0x11f872<_0x5f0a14;_0x11f872++){var _0x291a81=events[_0x11f872];var _0x4f5871=createListener(_0x017f('0x5')+_0x291a81,_0x552250);PluginEvents['on'](_0x291a81,_0x4f5871);}}; \ No newline at end of file diff --git a/server/api/pm2/index.js b/server/api/pm2/index.js index 034039f..2f74bb7 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(_0x84716b,_0x190ee6){var _0x32c503=function(_0x5196b0){while(--_0x5196b0){_0x84716b['push'](_0x84716b['shift']());}};_0x32c503(++_0x190ee6);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4bfac3,_0x58324d){_0x4bfac3=_0x4bfac3-0x0;var _0x15f0f2=_0xa9e0[_0x4bfac3];return _0x15f0f2;};'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(_0x1f4b18,_0x24e49d){var _0x5636d3=function(_0x46eee0){while(--_0x46eee0){_0x1f4b18['push'](_0x1f4b18['shift']());}};_0x5636d3(++_0x24e49d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x31e29a,_0x349c9b){_0x31e29a=_0x31e29a-0x0;var _0x32d892=_0xa9e0[_0x31e29a];return _0x32d892;};'use strict';var express=require(_0x0a9e('0x0'));var router=express[_0x0a9e('0x1')]();var auth=require(_0x0a9e('0x2'));var controller=require('./pm2.controller');router['get']('/',auth[_0x0a9e('0x3')](),controller['index']);router[_0x0a9e('0x4')](_0x0a9e('0x5'),auth[_0x0a9e('0x3')](),controller[_0x0a9e('0x6')]);router[_0x0a9e('0x7')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x8')]);router[_0x0a9e('0x9')](_0x0a9e('0x5'),auth['isAuthenticated'](),controller['update']);router[_0x0a9e('0xa')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);module[_0x0a9e('0xc')]=router; \ No newline at end of file diff --git a/server/api/pm2/pm2.controller.js b/server/api/pm2/pm2.controller.js index 4f13c37..39ed063 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 _0xac4a=['child_process','json','error','name','send','npm\x20install','info','then','reject','express','motion2','length','catch','show','params','create','body','script','join','cwd','chdir','dirname','start','update','restart','stop','hasOwnProperty','status','Unknown\x20status','dump','Unknown\x20id','lodash','../../config/pm2','../../config/logger','api','path'];(function(_0x2e48b8,_0x27f444){var _0x290880=function(_0x5e5193){while(--_0x5e5193){_0x2e48b8['push'](_0x2e48b8['shift']());}};_0x290880(++_0x27f444);}(_0xac4a,0x13f));var _0xaac4=function(_0x362719,_0x58aa5a){_0x362719=_0x362719-0x0;var _0x236baf=_0xac4a[_0x362719];return _0x236baf;};'use strict';var _=require(_0xaac4('0x0'));var pm2=require(_0xaac4('0x1'));var logger=require(_0xaac4('0x2'))(_0xaac4('0x3'));var path=require(_0xaac4('0x4'));var exec=require(_0xaac4('0x5'))['exec'];var BPromise=require('bluebird');function handleEntityNotFound(_0x2af0f6,_0x2a5762){return function(_0x32d34c){if(!_0x32d34c){_0x2af0f6['sendStatus'](0x194);;}return _0x32d34c;};}function respondWithResult(_0x1283a5,_0x53d03a){_0x53d03a=_0x53d03a||0xc8;return function(_0x1cdfc5){if(_0x1cdfc5){return _0x1283a5['status'](_0x53d03a)[_0xaac4('0x6')](_0x1cdfc5);}return null;};}function handleError(_0x27354c,_0x567295){_0x567295=_0x567295||0x1f4;return function(_0x5cfc1b){logger[_0xaac4('0x7')](_0x5cfc1b['stack']);if(_0x5cfc1b[_0xaac4('0x8')]){delete _0x5cfc1b['name'];}_0x27354c['status'](_0x567295)[_0xaac4('0x9')](_0x5cfc1b);};}function execChildProcess(){return new BPromise(function(_0x22cea4,_0x38d1d0){exec(_0xaac4('0xa'),function(_0x3a983c,_0x4e0f72,_0x508e14){logger[_0xaac4('0xb')](_0x4e0f72);logger[_0xaac4('0xb')](_0x508e14);if(_0x3a983c){logger[_0xaac4('0x7')](_0x3a983c);return _0x38d1d0(_0x3a983c);}return _0x22cea4(_0x4e0f72);});});}exports['index']=function(_0x6a808d,_0x45c129){return pm2['list']()[_0xaac4('0xc')](function(_0x2b20d0){if(_0x2b20d0){var _0x46698d=_[_0xaac4('0xd')](_0x2b20d0,function(_0x187624){return _0x187624[_0xaac4('0x8')]===_0xaac4('0xe')||_0x187624[_0xaac4('0x8')]===_0xaac4('0xf');});return{'rows':_0x46698d,'count':_0x46698d[_0xaac4('0x10')]};}return null;})[_0xaac4('0xc')](respondWithResult(_0x45c129,null))[_0xaac4('0x11')](handleError(_0x45c129,null));};exports[_0xaac4('0x12')]=function(_0x52686a,_0x33bc73){return pm2['describe'](_0x52686a[_0xaac4('0x13')]['id'])['then'](respondWithResult(_0x33bc73,null))[_0xaac4('0xc')](handleEntityNotFound(_0x33bc73,null))[_0xaac4('0x11')](handleError(_0x33bc73,null));};exports[_0xaac4('0x14')]=function(_0x271bcb,_0x3cbcb1){if(_0x271bcb[_0xaac4('0x15')][_0xaac4('0x8')]&&_0x271bcb[_0xaac4('0x15')][_0xaac4('0x16')]){var _0x480fb0=path[_0xaac4('0x17')](__dirname,'../../files/plugins',_0x271bcb[_0xaac4('0x15')][_0xaac4('0x16')]);var _0x43625c=process[_0xaac4('0x18')]();process[_0xaac4('0x19')](path[_0xaac4('0x1a')](_0x480fb0));return execChildProcess()['then'](function(_0x43ccdc){process[_0xaac4('0x19')](_0x43625c);return pm2[_0xaac4('0x1b')]({'name':_0x271bcb[_0xaac4('0x15')][_0xaac4('0x8')],'script':_0x480fb0});})[_0xaac4('0xc')](function(_0xb2577b){pm2['dump']();return _0xb2577b[0x0];})[_0xaac4('0xc')](respondWithResult(_0x3cbcb1,0xc9))['catch'](handleError(_0x3cbcb1,null));}else{return _0x3cbcb1['status'](0x1f4)['send']({'message':'Missing\x20name\x20and/or\x20path'});}};exports[_0xaac4('0x1c')]=function(_0x17d25f,_0x22cda2){if(_0x17d25f[_0xaac4('0x15')]['id']){delete _0x17d25f[_0xaac4('0x15')]['id'];}var _0x249a5d={'online':_0xaac4('0x1d'),'stopped':_0xaac4('0x1e')};if(_0x249a5d[_0xaac4('0x1f')](_0x17d25f[_0xaac4('0x15')]['status'])){return pm2[_0x249a5d[_0x17d25f[_0xaac4('0x15')][_0xaac4('0x20')]]](_0x17d25f[_0xaac4('0x13')]['id'])[_0xaac4('0xc')](respondWithResult(_0x22cda2,0xc8))[_0xaac4('0x11')](handleError(_0x22cda2,null));}else{return _0x22cda2[_0xaac4('0x20')](0x1f4)['send']({'message':_0xaac4('0x21')});}};exports['destroy']=function(_0x2df7e3,_0xab5d04){if(_0x2df7e3[_0xaac4('0x15')]['id']){delete _0x2df7e3[_0xaac4('0x15')]['id'];}if(_0x2df7e3['params']['id']){return pm2['delete'](_0x2df7e3['params']['id'])[_0xaac4('0xc')](function(_0xee6aa9){pm2[_0xaac4('0x22')]();return _0xee6aa9[0x0];})[_0xaac4('0xc')](respondWithResult(_0xab5d04,null))[_0xaac4('0x11')](handleError(_0xab5d04,null));}else{return _0xab5d04[_0xaac4('0x20')](0x1f4)[_0xaac4('0x9')]({'message':_0xaac4('0x23')});}}; \ No newline at end of file +var _0x878f=['dirname','start','dump','restart','stop','hasOwnProperty','params','send','destroy','delete','Unknown\x20id','../../config/pm2','../../config/logger','api','path','child_process','exec','bluebird','sendStatus','status','name','info','index','then','express','motion2','length','catch','show','describe','create','body','script','../../files/plugins','cwd','chdir'];(function(_0x5e66a8,_0x4bb854){var _0x51dd31=function(_0x363cc7){while(--_0x363cc7){_0x5e66a8['push'](_0x5e66a8['shift']());}};_0x51dd31(++_0x4bb854);}(_0x878f,0x173));var _0xf878=function(_0x5363e0,_0x29693b){_0x5363e0=_0x5363e0-0x0;var _0x273cee=_0x878f[_0x5363e0];return _0x273cee;};'use strict';var _=require('lodash');var pm2=require(_0xf878('0x0'));var logger=require(_0xf878('0x1'))(_0xf878('0x2'));var path=require(_0xf878('0x3'));var exec=require(_0xf878('0x4'))[_0xf878('0x5')];var BPromise=require(_0xf878('0x6'));function handleEntityNotFound(_0x45a37b,_0x240b48){return function(_0xcf1927){if(!_0xcf1927){_0x45a37b[_0xf878('0x7')](0x194);;}return _0xcf1927;};}function respondWithResult(_0x4bc9aa,_0x4ac8d8){_0x4ac8d8=_0x4ac8d8||0xc8;return function(_0x3c5f5c){if(_0x3c5f5c){return _0x4bc9aa[_0xf878('0x8')](_0x4ac8d8)['json'](_0x3c5f5c);}return null;};}function handleError(_0x52851e,_0x530767){_0x530767=_0x530767||0x1f4;return function(_0x3329df){logger['error'](_0x3329df['stack']);if(_0x3329df[_0xf878('0x9')]){delete _0x3329df[_0xf878('0x9')];}_0x52851e[_0xf878('0x8')](_0x530767)['send'](_0x3329df);};}function execChildProcess(){return new BPromise(function(_0xb2863e,_0x1399a3){exec('npm\x20install',function(_0xdf76,_0x4f7e7f,_0x31d3d2){logger[_0xf878('0xa')](_0x4f7e7f);logger[_0xf878('0xa')](_0x31d3d2);if(_0xdf76){logger['error'](_0xdf76);return _0x1399a3(_0xdf76);}return _0xb2863e(_0x4f7e7f);});});}exports[_0xf878('0xb')]=function(_0x38eddf,_0x39b1bb){return pm2['list']()[_0xf878('0xc')](function(_0x3902f7){if(_0x3902f7){var _0x119e9e=_['reject'](_0x3902f7,function(_0x568a3a){return _0x568a3a[_0xf878('0x9')]===_0xf878('0xd')||_0x568a3a[_0xf878('0x9')]===_0xf878('0xe');});return{'rows':_0x119e9e,'count':_0x119e9e[_0xf878('0xf')]};}return null;})[_0xf878('0xc')](respondWithResult(_0x39b1bb,null))[_0xf878('0x10')](handleError(_0x39b1bb,null));};exports[_0xf878('0x11')]=function(_0x3c5dee,_0x3a55f3){return pm2[_0xf878('0x12')](_0x3c5dee['params']['id'])[_0xf878('0xc')](respondWithResult(_0x3a55f3,null))[_0xf878('0xc')](handleEntityNotFound(_0x3a55f3,null))[_0xf878('0x10')](handleError(_0x3a55f3,null));};exports[_0xf878('0x13')]=function(_0x3714f6,_0x237d15){if(_0x3714f6[_0xf878('0x14')]['name']&&_0x3714f6[_0xf878('0x14')][_0xf878('0x15')]){var _0x250f85=path['join'](__dirname,_0xf878('0x16'),_0x3714f6[_0xf878('0x14')][_0xf878('0x15')]);var _0x392822=process[_0xf878('0x17')]();process[_0xf878('0x18')](path[_0xf878('0x19')](_0x250f85));return execChildProcess()[_0xf878('0xc')](function(_0x212436){process[_0xf878('0x18')](_0x392822);return pm2[_0xf878('0x1a')]({'name':_0x3714f6['body'][_0xf878('0x9')],'script':_0x250f85});})['then'](function(_0xa3d3d3){pm2[_0xf878('0x1b')]();return _0xa3d3d3[0x0];})[_0xf878('0xc')](respondWithResult(_0x237d15,0xc9))[_0xf878('0x10')](handleError(_0x237d15,null));}else{return _0x237d15[_0xf878('0x8')](0x1f4)['send']({'message':'Missing\x20name\x20and/or\x20path'});}};exports['update']=function(_0x242926,_0x3baba4){if(_0x242926[_0xf878('0x14')]['id']){delete _0x242926['body']['id'];}var _0xfa3e11={'online':_0xf878('0x1c'),'stopped':_0xf878('0x1d')};if(_0xfa3e11[_0xf878('0x1e')](_0x242926[_0xf878('0x14')]['status'])){return pm2[_0xfa3e11[_0x242926['body'][_0xf878('0x8')]]](_0x242926[_0xf878('0x1f')]['id'])['then'](respondWithResult(_0x3baba4,0xc8))[_0xf878('0x10')](handleError(_0x3baba4,null));}else{return _0x3baba4['status'](0x1f4)[_0xf878('0x20')]({'message':'Unknown\x20status'});}};exports[_0xf878('0x21')]=function(_0x49e66a,_0x2630fb){if(_0x49e66a['body']['id']){delete _0x49e66a[_0xf878('0x14')]['id'];}if(_0x49e66a[_0xf878('0x1f')]['id']){return pm2[_0xf878('0x22')](_0x49e66a[_0xf878('0x1f')]['id'])[_0xf878('0xc')](function(_0x716782){pm2['dump']();return _0x716782[0x0];})[_0xf878('0xc')](respondWithResult(_0x2630fb,null))[_0xf878('0x10')](handleError(_0x2630fb,null));}else{return _0x2630fb[_0xf878('0x8')](0x1f4)[_0xf878('0x20')]({'message':_0xf878('0x23')});}}; \ No newline at end of file diff --git a/server/api/realtime/index.js b/server/api/realtime/index.js index f438b4c..0f3c919 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 _0x9df5=['Router','../../components/auth/service','get','getAgents','/queues','express'];(function(_0x5a0a35,_0x33159c){var _0x2b63ae=function(_0x12d660){while(--_0x12d660){_0x5a0a35['push'](_0x5a0a35['shift']());}};_0x2b63ae(++_0x33159c);}(_0x9df5,0x71));var _0x59df=function(_0x235221,_0x398085){_0x235221=_0x235221-0x0;var _0x444d43=_0x9df5[_0x235221];return _0x444d43;};'use strict';var express=require(_0x59df('0x0'));var router=express[_0x59df('0x1')]();var auth=require(_0x59df('0x2'));var controller=require('./realtime.controller');router[_0x59df('0x3')]('/agents',auth['isAuthenticated'](),controller[_0x59df('0x4')]);router[_0x59df('0x3')](_0x59df('0x5'),auth['isAuthenticated'](),controller['getQueues']);module['exports']=router; \ No newline at end of file +var _0x6620=['Router','../../components/auth/service','./realtime.controller','get','/agents','isAuthenticated','getAgents','getQueues','express'];(function(_0x457344,_0xa0753e){var _0x29af78=function(_0x4ff13a){while(--_0x4ff13a){_0x457344['push'](_0x457344['shift']());}};_0x29af78(++_0xa0753e);}(_0x6620,0x1ee));var _0x0662=function(_0x457e0b,_0x2e87d1){_0x457e0b=_0x457e0b-0x0;var _0x5d7ddf=_0x6620[_0x457e0b];return _0x5d7ddf;};'use strict';var express=require(_0x0662('0x0'));var router=express[_0x0662('0x1')]();var auth=require(_0x0662('0x2'));var controller=require(_0x0662('0x3'));router[_0x0662('0x4')](_0x0662('0x5'),auth[_0x0662('0x6')](),controller[_0x0662('0x7')]);router[_0x0662('0x4')]('/queues',auth[_0x0662('0x6')](),controller[_0x0662('0x8')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/realtime/realtime.controller.js b/server/api/realtime/realtime.controller.js index 7e9fe7e..061ec73 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 _0xfcf0=['QueueCampaigns','Queues','findAndCountAll','all','util','lodash','../../components/parsers/qs','../../config/logger','api','../../mysqldb','http','client','offset','limit','undefined','status','set','error','stack','name','request','then','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)','result','Agents','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)','merge','catch','voice','startCase','format','Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues','VoiceQueuesChannels','Unable\x20to\x20retrieve\x20voice\x20queues\x20channels','available','waiting','talking','paused','pTalking','message','dialActive','Trunk','startPredictive','startProgressive','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','dialPredictiveInterval','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','predictiveIntervalAvailable','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','map','get','agents','loggedInDb','loggedIn','outbound','find','queue','length','internal','toString','busy','getMembers','UserId','accountcode','online','voiceStatus','User','Queue','Pause','findAll','QueueId','push','idle','unknown','unavailable','ringing','isNil','chatPause','faxPause','mailPause','openchannelPause','smsPause','whatsappPause','every','filter','voicePause','pause','chatStatus','faxStatus','mailStatus','openchannelStatus','smsStatus','whatsappStatus','*pause','getAgents','userpic','lastLoginAt','lastPauseAt','pauseType','chatCapacity','openchannelCapacity','mailCapacity','whatsappCapacity','chatCurrentCapacity','openchannelCurrentCapacity','mailCurrentCapacity','whatsappCurrentCapacity','faxCurrentCapacity','chatStatusTime','openchannelStatusTime','smsStatusTime','whatsappStatusTime','faxStatusTime','voiceStatusTime','destconnectedlinenum','screenrecording','routealias','resolve','fieldName','type','key','query','getOptions','raw','user','role','userProfileId','agent','nolimit','sort','UserProfile','getResources','count','rows','pick','globalStatus','globalStatusFilter','pauseTypeFilter','getQueues','mail','chat','sms','whatsapp','channel','includes','Invalid\x20channel','toLowerCase'];(function(_0x46132c,_0x2f8a8a){var _0x52dc7d=function(_0x4d6bc6){while(--_0x4d6bc6){_0x46132c['push'](_0x46132c['shift']());}};_0x52dc7d(++_0x2f8a8a);}(_0xfcf0,0x138));var _0x0fcf=function(_0x39c734,_0x2f3e06){_0x39c734=_0x39c734-0x0;var _0xb2a2f9=_0xfcf0[_0x39c734];return _0xb2a2f9;};'use strict';var util=require(_0x0fcf('0x0'));var _=require(_0x0fcf('0x1'));var jayson=require('jayson/promise');var qs=require(_0x0fcf('0x2'));var logger=require(_0x0fcf('0x3'))(_0x0fcf('0x4'));var db=require(_0x0fcf('0x5'))['db'];var amiClient=jayson['client'][_0x0fcf('0x6')]({'port':0x232a});var routingClient=jayson[_0x0fcf('0x7')][_0x0fcf('0x6')]({'port':0x232c});function respondWithFilteredResult(_0x3af316,_0x1bace8){return function(_0x1a7b03){if(_0x1a7b03){var _0x61bbb9=typeof _0x1bace8[_0x0fcf('0x8')]==='undefined'&&typeof _0x1bace8[_0x0fcf('0x9')]===_0x0fcf('0xa');var _0xa9e007=_0x1a7b03['count'];var _0x69a840=_0x61bbb9?0x0:_0x1bace8[_0x0fcf('0x8')];var _0x239e5d=_0x61bbb9?_0x1a7b03['count']:_0x1bace8[_0x0fcf('0x8')]+_0x1bace8['limit'];var _0x1be284;if(_0x239e5d>=_0xa9e007){_0x239e5d=_0xa9e007;_0x1be284=0xc8;}else{_0x1be284=0xce;}_0x3af316[_0x0fcf('0xb')](_0x1be284);return _0x3af316[_0x0fcf('0xc')]('Content-Range',_0x69a840+'-'+_0x239e5d+'/'+_0xa9e007)['json'](_0x1a7b03);}return null;};}function handleError(_0x29336a,_0x3c999e){_0x3c999e=_0x3c999e||0x1f4;return function(_0x4b4904){logger[_0x0fcf('0xd')](_0x4b4904[_0x0fcf('0xe')]);if(_0x4b4904[_0x0fcf('0xf')]){delete _0x4b4904[_0x0fcf('0xf')];}_0x29336a[_0x0fcf('0xb')](_0x3c999e)['send'](_0x4b4904);};}function getRealtimeAgents(){return new Promise(function(_0xa32692,_0x3701c9){return amiClient[_0x0fcf('0x10')]('Agents',{})[_0x0fcf('0x11')](function(_0x610106){if(_0x610106[_0x0fcf('0xd')])throw new Error(_0x0fcf('0x12'));var _0x48dd53=_0x610106[_0x0fcf('0x13')];return routingClient[_0x0fcf('0x10')](_0x0fcf('0x14'),{})[_0x0fcf('0x11')](function(_0x19cfbd){if(_0x19cfbd['error'])throw new Error(_0x0fcf('0x15'));var _0x1a8f58=_0x19cfbd['result'];return _0xa32692(_[_0x0fcf('0x16')]({},_0x48dd53,_0x1a8f58));});})[_0x0fcf('0x17')](function(_0x4da7e3){_0x3701c9(_0x4da7e3);});});}function getRealtimeQueues(_0x2022e1,_0x50ac4a){return new Promise(function(_0x3fc9e6,_0x13454e){var _0x5c8279=_0x50ac4a===_0x0fcf('0x18')?amiClient:routingClient;return _0x5c8279[_0x0fcf('0x10')](_[_0x0fcf('0x19')](_0x50ac4a)+'Queues',_0x2022e1)[_0x0fcf('0x11')](function(_0x1dafc8){if(_0x1dafc8[_0x0fcf('0xd')])throw new Error(util[_0x0fcf('0x1a')](_0x0fcf('0x1b'),_0x50ac4a));return _0x3fc9e6(_0x1dafc8[_0x0fcf('0x13')]);})['catch'](function(_0x2eef74){_0x13454e(_0x2eef74);});});}function getRealtimeVoiceQueueChannels(){return new Promise(function(_0x253641,_0x6021b4){return amiClient[_0x0fcf('0x10')](_0x0fcf('0x1c'),{})[_0x0fcf('0x11')](function(_0x2ce990){if(_0x2ce990[_0x0fcf('0xd')])throw new Error(_0x0fcf('0x1d'));return _0x253641(_0x2ce990['result']);})[_0x0fcf('0x17')](function(_0xc107a){_0x6021b4(_0xc107a);});});}function initializeQueues(_0x41b7a2,_0x2f198b,_0x3876ed,_0x38fe0e){var _0x2730b0=['loggedIn',_0x0fcf('0x1e'),_0x0fcf('0x1f'),_0x0fcf('0x20'),_0x0fcf('0x21')];if(_0x3876ed==='voice'&&_0x38fe0e==='outbound'){_0x2730b0['push'](_0x0fcf('0x22'),'originated',_0x0fcf('0x23'),_0x0fcf('0x24'),'dialMethod',_0x0fcf('0x25'),_0x0fcf('0x26'),_0x0fcf('0x27'),_0x0fcf('0x28'),_0x0fcf('0x29'),_0x0fcf('0x2a'),'erlangBusyFactor',_0x0fcf('0x2b'),_0x0fcf('0x2c'),_0x0fcf('0x2d'),_0x0fcf('0x2e'),_0x0fcf('0x2f'),_0x0fcf('0x30'),'predictiveIntervalDroppedCallsTimeout',_0x0fcf('0x31'),_0x0fcf('0x32'),_0x0fcf('0x33'));}return _0x41b7a2[_0x0fcf('0x34')](function(_0x1656c8){var _0x477c71=_0x1656c8[_0x0fcf('0x35')]({'plain':!![]});_0x477c71[_0x0fcf('0x36')]=[];_0x477c71[_0x0fcf('0x21')]=0x0;_0x477c71[_0x0fcf('0x37')]=0x0;_0x477c71[_0x0fcf('0x38')]=0x0;_0x477c71[_0x0fcf('0x1e')]=0x0;_0x477c71[_0x0fcf('0x1f')]=0x0;if(_0x3876ed===_0x0fcf('0x18')){_0x477c71['talking']=0x0;_0x477c71['busy']=0x0;if(_0x38fe0e===_0x0fcf('0x39')){_0x477c71['pTalking']=0x0;_0x477c71['originated']=0x0;}}var _0x1a1e07=_[_0x0fcf('0x3a')](_0x2f198b,['id',_0x477c71['id']]);if(_0x1a1e07)_[_0x0fcf('0x16')](_0x477c71,_['pick'](_0x1a1e07,_0x2730b0));return _0x477c71;});}function updateAgentVoiceStatus(_0x57e635,_0x1417ac,_0x15db0d){var _0x148e09=_['filter'](_0x15db0d,[_0x0fcf('0x3b'),_0x1417ac[_0x0fcf('0xf')]]);if(_0x148e09[_0x0fcf('0x3c')]===0x0)return _0x57e635['busy']=!![];if(_['some'](_0x148e09,['connectedlinenum',_0x57e635[_0x0fcf('0x3d')][_0x0fcf('0x3e')]()]))return _0x57e635[_0x0fcf('0x20')]=!![];if(!_0x57e635[_0x0fcf('0x20')])return _0x57e635[_0x0fcf('0x3f')]=!![];}function getVoiceQueueAgents(_0x4be8eb,_0x394cdf,_0x22c1c8,_0xb4087){var _0x4cbc84=_['find'](_0x394cdf,['id',_0x4be8eb['id']]);if(!_0x4cbc84)return _0x4be8eb;return _0x4cbc84[_0x0fcf('0x40')]({'raw':!![]})[_0x0fcf('0x11')](function(_0x187b15){for(var _0x3699fc=0x0;_0x3699fc<_0x187b15[_0x0fcf('0x3c')];_0x3699fc++){var _0x4c6669=_[_0x0fcf('0x3a')](_0x22c1c8,['id',_0x187b15[_0x3699fc][_0x0fcf('0x41')]]);if(!_0x4c6669){_0x4c6669={'id':_0x187b15[_0x3699fc][_0x0fcf('0x41')],'name':_0x187b15[_0x3699fc][_0x0fcf('0x41')],'accountcode':'','online':![]};}var _0x4830a6={'id':_0x4c6669['id'],'name':_0x4c6669['name'],'internal':_0x4c6669[_0x0fcf('0x42')],'online':Boolean(_0x4c6669[_0x0fcf('0x43')]),'paused':Boolean(_0x187b15[_0x3699fc]['paused'])};if(_0x4c6669[_0x0fcf('0x44')]===_0x0fcf('0x20'))updateAgentVoiceStatus(_0x4830a6,_0x4be8eb,_0xb4087);if(_0x4830a6['online'])_0x4be8eb[_0x0fcf('0x37')]++;if(_0x4830a6[_0x0fcf('0x3f')])_0x4be8eb[_0x0fcf('0x3f')]++;if(_0x4830a6[_0x0fcf('0x21')]&&!_0x4830a6[_0x0fcf('0x3f')]&&!_0x4830a6['talking'])_0x4be8eb[_0x0fcf('0x21')]++;_0x4be8eb[_0x0fcf('0x36')]['push'](_0x4830a6);}return _0x4be8eb;});}function getQueueAgents(_0x48b3f1,_0x3bed65,_0x4cc328){var _0x522148=_0x0fcf('0x45')+_[_0x0fcf('0x19')](_0x4cc328)+_0x0fcf('0x46');var _0xb9b6ff=_0x4cc328+_0x0fcf('0x47');return db[_0x522148][_0x0fcf('0x48')]({'where':{[_[_0x0fcf('0x19')](_0x4cc328)+_0x0fcf('0x49')]:_0x48b3f1['id']},'raw':!![]})[_0x0fcf('0x11')](function(_0x3a2db0){for(var _0x5a651f=0x0;_0x5a651f<_0x3a2db0[_0x0fcf('0x3c')];_0x5a651f++){var _0x227dd5=_[_0x0fcf('0x3a')](_0x3bed65,['id',_0x3a2db0[_0x5a651f]['UserId']]);if(!_0x227dd5){_0x227dd5={'id':_0x3a2db0[_0x5a651f]['UserId'],'name':_0x3a2db0[_0x5a651f][_0x0fcf('0x41')],'online':![],['pauseField']:![]};}var _0x7f7d70={'id':_0x227dd5['id'],'name':_0x227dd5[_0x0fcf('0xf')],'online':Boolean(_0x227dd5[_0x0fcf('0x43')]),'paused':Boolean(_0x227dd5[_0xb9b6ff])};if(_0x7f7d70['online'])_0x48b3f1['loggedInDb']++;_0x48b3f1[_0x0fcf('0x36')][_0x0fcf('0x4a')](_0x7f7d70);}return _0x48b3f1;});}function isIdle(_0x46e707){return _0x46e707===_0x0fcf('0x4b')||_0x46e707===_0x0fcf('0x4c')||_0x46e707===_0x0fcf('0x4d')||_0x46e707===_0x0fcf('0x4e')||_[_0x0fcf('0x4f')](_0x46e707);}function isAgentPaused(_0x4c4f56,_0x5a0ced){var _0x259c91=[_0x4c4f56[_0x0fcf('0x50')],_0x4c4f56[_0x0fcf('0x51')],_0x4c4f56[_0x0fcf('0x52')],_0x4c4f56[_0x0fcf('0x53')],_0x4c4f56[_0x0fcf('0x54')],_0x4c4f56['voicePause'],_0x4c4f56[_0x0fcf('0x55')]];if(!_0x5a0ced)return _[_0x0fcf('0x56')](_0x259c91);var _0x491453=_[_0x0fcf('0x57')](_0x259c91);return _0x491453[_0x0fcf('0x3c')]>0x0&&_0x491453[_0x0fcf('0x3c')]<_0x259c91[_0x0fcf('0x3c')]?!![]:![];}function isAgentIdle(_0x5435c0){if(_0x5435c0[_0x0fcf('0x44')]!==_0x0fcf('0x4b')&&_0x5435c0[_0x0fcf('0x58')]){_0x5435c0[_0x0fcf('0x44')]=_0x0fcf('0x59');return![];}return _[_0x0fcf('0x56')]([_0x5435c0[_0x0fcf('0x5a')],_0x5435c0[_0x0fcf('0x5b')],_0x5435c0[_0x0fcf('0x5c')],_0x5435c0[_0x0fcf('0x5d')],_0x5435c0[_0x0fcf('0x5e')],_0x5435c0[_0x0fcf('0x44')],_0x5435c0[_0x0fcf('0x5f')]],isIdle);}function getAgentStatus(_0x727fe7){var _0x5c001e=_0x0fcf('0x4c');if(isAgentPaused(_0x727fe7))_0x5c001e='pause';else if(isAgentPaused(_0x727fe7,!![]))_0x5c001e=_0x0fcf('0x60');else if(isAgentIdle(_0x727fe7))_0x5c001e=_0x0fcf('0x4b');else _0x5c001e=_0x0fcf('0x3f');return _0x5c001e;}exports[_0x0fcf('0x61')]=function(_0x27b8ae,_0x5d2576){var _0x12b8d2={'count':0x0,'rows':[]},_0x5a6c00={},_0x48b60a,_0x2de3ef,_0x55c2c1=[_0x0fcf('0x62'),'online',_0x0fcf('0x63'),_0x0fcf('0x64'),_0x0fcf('0x65'),_0x0fcf('0x64'),_0x0fcf('0x3d'),'address','chatPause',_0x0fcf('0x53'),'mailPause',_0x0fcf('0x54'),_0x0fcf('0x55'),'faxPause','voicePause',_0x0fcf('0x66'),_0x0fcf('0x67'),_0x0fcf('0x68'),'smsCapacity',_0x0fcf('0x69'),'faxCapacity',_0x0fcf('0x6a'),_0x0fcf('0x6b'),_0x0fcf('0x6c'),'smsCurrentCapacity',_0x0fcf('0x6d'),_0x0fcf('0x6e'),_0x0fcf('0x5a'),_0x0fcf('0x5d'),_0x0fcf('0x5c'),_0x0fcf('0x5e'),_0x0fcf('0x5f'),_0x0fcf('0x5b'),_0x0fcf('0x44'),_0x0fcf('0x6f'),_0x0fcf('0x70'),'mailStatusTime',_0x0fcf('0x71'),_0x0fcf('0x72'),_0x0fcf('0x73'),_0x0fcf('0x74'),_0x0fcf('0x3b'),_0x0fcf('0x75'),_0x0fcf('0x76'),'phoneBarEnableScreenRecordingByAgent','phoneBarEnableAutomaticScreenRecording',_0x0fcf('0x77')],_0x25c8ad=[_0x0fcf('0x50'),'openchannelPause',_0x0fcf('0x52'),_0x0fcf('0x54'),_0x0fcf('0x55'),_0x0fcf('0x51'),'voicePause',_0x0fcf('0x43')];Promise[_0x0fcf('0x78')]()[_0x0fcf('0x11')](function(){var _0x1e2dd7=_[_0x0fcf('0x34')](db[_0x0fcf('0x45')]['rawAttributes'],function(_0x14ee56){return{'name':_0x14ee56[_0x0fcf('0x79')],'type':_0x14ee56[_0x0fcf('0x7a')][_0x0fcf('0x7b')]};});_0x27b8ae[_0x0fcf('0x7c')]['role']='agent';_0x27b8ae[_0x0fcf('0x7c')][_0x0fcf('0x43')]=!![];_0x5a6c00=qs[_0x0fcf('0x7d')](_0x1e2dd7,_0x27b8ae);_0x5a6c00[_0x0fcf('0x7e')]=!![];if(_0x27b8ae[_0x0fcf('0x7f')][_0x0fcf('0x80')]===_0x0fcf('0x7f')){var _0x109a77={'params':{'id':_0x27b8ae[_0x0fcf('0x7f')][_0x0fcf('0x81')]},'query':{'section':'Agents','role':_0x0fcf('0x82'),'online':!![],'nolimit':_0x27b8ae[_0x0fcf('0x7c')][_0x0fcf('0x83')],'sort':_0x27b8ae[_0x0fcf('0x7c')][_0x0fcf('0x84')],'filter':_0x27b8ae[_0x0fcf('0x7c')][_0x0fcf('0x57')],'raw':!![]}};return db[_0x0fcf('0x85')][_0x0fcf('0x86')](_0x109a77);}return db['User']['findAndCountAll'](_0x5a6c00);})['then'](function(_0x4e5f14){_0x12b8d2[_0x0fcf('0x87')]=_0x4e5f14['count'];_0x48b60a=_0x4e5f14[_0x0fcf('0x88')];return getRealtimeAgents();})[_0x0fcf('0x11')](function(_0x3da414){_0x2de3ef=_0x3da414['rows'];return _0x48b60a['map'](function(_0x44eaac){var _0x239c9c=_['find'](_0x2de3ef,['id',_0x44eaac['id']]);if(_0x239c9c)_[_0x0fcf('0x16')](_0x44eaac,_[_0x0fcf('0x89')](_['omit'](_0x239c9c,_0x25c8ad),_0x55c2c1));_0x44eaac[_0x0fcf('0x8a')]=getAgentStatus(_0x44eaac);return _0x44eaac;});})[_0x0fcf('0x11')](function(_0x47438d){if(_0x27b8ae[_0x0fcf('0x7c')][_0x0fcf('0x8b')]){var _0x79e33f=_[_0x0fcf('0x57')](_0x47438d,['globalStatus',_0x27b8ae[_0x0fcf('0x7c')][_0x0fcf('0x8b')]]);if(_0x27b8ae[_0x0fcf('0x7c')][_0x0fcf('0x8c')]){_0x79e33f=_[_0x0fcf('0x57')](_0x79e33f,[_0x0fcf('0x65'),_0x27b8ae['query']['pauseTypeFilter']]);}}_0x12b8d2[_0x0fcf('0x88')]=_0x79e33f||_0x47438d;return _0x12b8d2;})[_0x0fcf('0x11')](respondWithFilteredResult(_0x5d2576,_0x5a6c00))[_0x0fcf('0x17')](handleError(_0x5d2576,null));};exports[_0x0fcf('0x8d')]=function(_0x4e2c00,_0x2ed370){var _0x1cfb5d=[_0x0fcf('0x8e'),_0x0fcf('0x8f'),_0x0fcf('0x90'),'openchannel','fax',_0x0fcf('0x91'),'voice'];var _0x18a675={'count':0x0,'rows':[]},_0x47e8f2={},_0x4ebc2f,_0x21abc5,_0x3bd23e,_0x9ede45,_0x2bde0e;Promise['resolve']()[_0x0fcf('0x11')](function(){if(_0x4e2c00[_0x0fcf('0x7c')][_0x0fcf('0x92')]){if(!_[_0x0fcf('0x93')](_0x1cfb5d,_0x4e2c00['query'][_0x0fcf('0x92')]['toLowerCase']()))throw new Error(_0x0fcf('0x94'));_0x4ebc2f=_0x4e2c00['query'][_0x0fcf('0x92')][_0x0fcf('0x95')]();}var _0x4d76e0=_[_0x0fcf('0x19')](_0x4ebc2f)+_0x0fcf('0x46');var _0x58d730=_['map'](db[_0x4d76e0]['rawAttributes'],function(_0x5875f1){return{'name':_0x5875f1[_0x0fcf('0x79')],'type':_0x5875f1['type'][_0x0fcf('0x7b')]};});_0x47e8f2=qs[_0x0fcf('0x7d')](_0x58d730,_0x4e2c00);if(_0x4e2c00[_0x0fcf('0x7f')][_0x0fcf('0x80')]===_0x0fcf('0x7f')){var _0x17662e={'params':{'id':_0x4e2c00[_0x0fcf('0x7f')][_0x0fcf('0x81')]},'query':{'section':_0x4ebc2f===_0x0fcf('0x18')&&_0x4e2c00['query'][_0x0fcf('0x7a')]===_0x0fcf('0x39')?_0x0fcf('0x96'):_[_0x0fcf('0x19')](_0x4ebc2f)+_0x0fcf('0x97'),'type':_0x4e2c00[_0x0fcf('0x7c')][_0x0fcf('0x7a')],'nolimit':!![],'sort':_0x0fcf('0xf'),'filter':_0x4e2c00['query'][_0x0fcf('0x57')]}};return db[_0x0fcf('0x85')][_0x0fcf('0x86')](_0x17662e);}return db[_0x4d76e0][_0x0fcf('0x98')](_0x47e8f2);})[_0x0fcf('0x11')](function(_0x147457){_0x18a675[_0x0fcf('0x87')]=_0x147457['count'];_0x21abc5=_0x147457[_0x0fcf('0x88')];return getRealtimeQueues(_0x4e2c00,_0x4ebc2f);})['then'](function(_0x18645d){_0x9ede45=_0x18645d[_0x0fcf('0x88')];return getRealtimeAgents();})[_0x0fcf('0x11')](function(_0x4fe0a8){_0x3bd23e=_0x4fe0a8['rows'];if(_0x4ebc2f!='voice')return;return getRealtimeVoiceQueueChannels();})['then'](function(_0x301991){_0x2bde0e=_0x301991?_0x301991[_0x0fcf('0x88')]:[];return initializeQueues(_0x21abc5,_0x9ede45,_0x4ebc2f,_0x4e2c00[_0x0fcf('0x7c')][_0x0fcf('0x7a')]);})[_0x0fcf('0x11')](function(_0x3259e4){var _0x19d23e=_0x3259e4[_0x0fcf('0x34')](function(_0x146075){if(_0x4ebc2f===_0x0fcf('0x18'))return getVoiceQueueAgents(_0x146075,_0x21abc5,_0x3bd23e,_0x2bde0e);else return getQueueAgents(_0x146075,_0x3bd23e,_0x4ebc2f);});return Promise[_0x0fcf('0x99')](_0x19d23e);})['then'](function(_0x1af57f){_0x18a675[_0x0fcf('0x88')]=_0x1af57f;return _0x18a675;})['then'](respondWithFilteredResult(_0x2ed370,_0x47e8f2))[_0x0fcf('0x17')](handleError(_0x2ed370,null));}; \ No newline at end of file +var _0x4c60=['smsCurrentCapacity','whatsappCurrentCapacity','faxCurrentCapacity','chatStatusTime','openchannelStatusTime','mailStatusTime','smsStatusTime','whatsappStatusTime','faxStatusTime','voiceStatusTime','destconnectedlinenum','phoneBarEnableScreenRecordingByAgent','phoneBarEnableAutomaticScreenRecording','resolve','User','rawAttributes','fieldName','type','query','role','agent','getOptions','raw','user','userProfileId','sort','getResources','findAndCountAll','rows','pick','omit','globalStatus','globalStatusFilter','pauseType','pauseTypeFilter','getQueues','mail','chat','openchannel','fax','channel','includes','toLowerCase','Invalid\x20channel','key','Queues','UserProfile','all','util','lodash','jayson/promise','../../components/parsers/qs','api','http','offset','undefined','count','status','Content-Range','json','error','stack','name','send','request','Agents','then','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)','result','merge','voice','startCase','Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues','VoiceQueuesChannels','catch','loggedIn','waiting','talking','outbound','push','pTalking','originated','message','dialActive','startProgressive','erlangCallToSecond','erlangAbandonmentRate','dialPredictiveInterval','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','predictiveIntervalAvailable','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','map','get','agents','paused','loggedInDb','available','busy','find','filter','length','some','toString','UserId','online','voiceStatus','Queue','Pause','findAll','QueueId','idle','unavailable','ringing','chatPause','mailPause','openchannelPause','smsPause','voicePause','every','pause','chatStatus','faxStatus','mailStatus','openchannelStatus','smsStatus','whatsappStatus','*pause','getAgents','userpic','lastLoginAt','address','whatsappPause','chatCapacity','openchannelCapacity','mailCapacity','smsCapacity','faxCapacity','chatCurrentCapacity','openchannelCurrentCapacity','mailCurrentCapacity'];(function(_0x195c04,_0x23e0b3){var _0x2e5a59=function(_0x395a92){while(--_0x395a92){_0x195c04['push'](_0x195c04['shift']());}};_0x2e5a59(++_0x23e0b3);}(_0x4c60,0xc1));var _0x04c6=function(_0x45ade2,_0x4dba24){_0x45ade2=_0x45ade2-0x0;var _0x5c79e1=_0x4c60[_0x45ade2];return _0x5c79e1;};'use strict';var util=require(_0x04c6('0x0'));var _=require(_0x04c6('0x1'));var jayson=require(_0x04c6('0x2'));var qs=require(_0x04c6('0x3'));var logger=require('../../config/logger')(_0x04c6('0x4'));var db=require('../../mysqldb')['db'];var amiClient=jayson['client']['http']({'port':0x232a});var routingClient=jayson['client'][_0x04c6('0x5')]({'port':0x232c});function respondWithFilteredResult(_0xc6e772,_0x2054da){return function(_0x12bd5d){if(_0x12bd5d){var _0x2b9041=typeof _0x2054da[_0x04c6('0x6')]===_0x04c6('0x7')&&typeof _0x2054da['limit']===_0x04c6('0x7');var _0x43a27e=_0x12bd5d[_0x04c6('0x8')];var _0x30b901=_0x2b9041?0x0:_0x2054da['offset'];var _0x59a98c=_0x2b9041?_0x12bd5d['count']:_0x2054da[_0x04c6('0x6')]+_0x2054da['limit'];var _0x15d31a;if(_0x59a98c>=_0x43a27e){_0x59a98c=_0x43a27e;_0x15d31a=0xc8;}else{_0x15d31a=0xce;}_0xc6e772[_0x04c6('0x9')](_0x15d31a);return _0xc6e772['set'](_0x04c6('0xa'),_0x30b901+'-'+_0x59a98c+'/'+_0x43a27e)[_0x04c6('0xb')](_0x12bd5d);}return null;};}function handleError(_0x119187,_0x4e5e6){_0x4e5e6=_0x4e5e6||0x1f4;return function(_0x52cdcf){logger[_0x04c6('0xc')](_0x52cdcf[_0x04c6('0xd')]);if(_0x52cdcf[_0x04c6('0xe')]){delete _0x52cdcf['name'];}_0x119187[_0x04c6('0x9')](_0x4e5e6)[_0x04c6('0xf')](_0x52cdcf);};}function getRealtimeAgents(){return new Promise(function(_0x28632e,_0x3e80a6){return amiClient[_0x04c6('0x10')](_0x04c6('0x11'),{})[_0x04c6('0x12')](function(_0x3d46a9){if(_0x3d46a9['error'])throw new Error(_0x04c6('0x13'));var _0xa2bc92=_0x3d46a9[_0x04c6('0x14')];return routingClient[_0x04c6('0x10')](_0x04c6('0x11'),{})[_0x04c6('0x12')](function(_0x21674a){if(_0x21674a[_0x04c6('0xc')])throw new Error('Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)');var _0x142065=_0x21674a[_0x04c6('0x14')];return _0x28632e(_[_0x04c6('0x15')]({},_0xa2bc92,_0x142065));});})['catch'](function(_0x4cef4e){_0x3e80a6(_0x4cef4e);});});}function getRealtimeQueues(_0x53ac86,_0x41ad4f){return new Promise(function(_0xb997e0,_0x50dd61){var _0x5a5e9e=_0x41ad4f===_0x04c6('0x16')?amiClient:routingClient;return _0x5a5e9e[_0x04c6('0x10')](_[_0x04c6('0x17')](_0x41ad4f)+'Queues',_0x53ac86)[_0x04c6('0x12')](function(_0x13f2dc){if(_0x13f2dc[_0x04c6('0xc')])throw new Error(util['format'](_0x04c6('0x18'),_0x41ad4f));return _0xb997e0(_0x13f2dc[_0x04c6('0x14')]);})['catch'](function(_0x54a8b0){_0x50dd61(_0x54a8b0);});});}function getRealtimeVoiceQueueChannels(){return new Promise(function(_0x4c8d72,_0x348ea3){return amiClient[_0x04c6('0x10')](_0x04c6('0x19'),{})[_0x04c6('0x12')](function(_0x3e1328){if(_0x3e1328['error'])throw new Error('Unable\x20to\x20retrieve\x20voice\x20queues\x20channels');return _0x4c8d72(_0x3e1328[_0x04c6('0x14')]);})[_0x04c6('0x1a')](function(_0x9acfa){_0x348ea3(_0x9acfa);});});}function initializeQueues(_0x3233d7,_0x4f256f,_0x1f5aaf,_0x47c69a){var _0x1d0d3f=[_0x04c6('0x1b'),'available',_0x04c6('0x1c'),_0x04c6('0x1d'),'paused'];if(_0x1f5aaf==='voice'&&_0x47c69a===_0x04c6('0x1e')){_0x1d0d3f[_0x04c6('0x1f')](_0x04c6('0x20'),_0x04c6('0x21'),_0x04c6('0x22'),_0x04c6('0x23'),'dialMethod','Trunk','startPredictive',_0x04c6('0x24'),'erlangCalls',_0x04c6('0x25'),_0x04c6('0x26'),'erlangBusyFactor',_0x04c6('0x27'),_0x04c6('0x28'),_0x04c6('0x29'),_0x04c6('0x2a'),'predictiveIntervalTotalCalls',_0x04c6('0x2b'),_0x04c6('0x2c'),_0x04c6('0x2d'),_0x04c6('0x2e'),_0x04c6('0x2f'));}return _0x3233d7[_0x04c6('0x30')](function(_0x3e59b2){var _0x46380e=_0x3e59b2[_0x04c6('0x31')]({'plain':!![]});_0x46380e[_0x04c6('0x32')]=[];_0x46380e[_0x04c6('0x33')]=0x0;_0x46380e[_0x04c6('0x34')]=0x0;_0x46380e[_0x04c6('0x1b')]=0x0;_0x46380e[_0x04c6('0x35')]=0x0;_0x46380e[_0x04c6('0x1c')]=0x0;if(_0x1f5aaf==='voice'){_0x46380e[_0x04c6('0x1d')]=0x0;_0x46380e[_0x04c6('0x36')]=0x0;if(_0x47c69a===_0x04c6('0x1e')){_0x46380e[_0x04c6('0x20')]=0x0;_0x46380e['originated']=0x0;}}var _0x181736=_[_0x04c6('0x37')](_0x4f256f,['id',_0x46380e['id']]);if(_0x181736)_['merge'](_0x46380e,_['pick'](_0x181736,_0x1d0d3f));return _0x46380e;});}function updateAgentVoiceStatus(_0x4aac49,_0x4f0600,_0x2382ff){var _0x4f9a6c=_[_0x04c6('0x38')](_0x2382ff,['queue',_0x4f0600[_0x04c6('0xe')]]);if(_0x4f9a6c[_0x04c6('0x39')]===0x0)return _0x4aac49[_0x04c6('0x36')]=!![];if(_[_0x04c6('0x3a')](_0x4f9a6c,['connectedlinenum',_0x4aac49['internal'][_0x04c6('0x3b')]()]))return _0x4aac49[_0x04c6('0x1d')]=!![];if(!_0x4aac49['talking'])return _0x4aac49[_0x04c6('0x36')]=!![];}function getVoiceQueueAgents(_0x5ce4b0,_0x501d7d,_0x317350,_0x5aede6){var _0x181d3f=_[_0x04c6('0x37')](_0x501d7d,['id',_0x5ce4b0['id']]);if(!_0x181d3f)return _0x5ce4b0;return _0x181d3f['getMembers']({'raw':!![]})[_0x04c6('0x12')](function(_0x5cc157){for(var _0x1dafa5=0x0;_0x1dafa5<_0x5cc157[_0x04c6('0x39')];_0x1dafa5++){var _0x2d83eb=_[_0x04c6('0x37')](_0x317350,['id',_0x5cc157[_0x1dafa5][_0x04c6('0x3c')]]);if(!_0x2d83eb){_0x2d83eb={'id':_0x5cc157[_0x1dafa5]['UserId'],'name':_0x5cc157[_0x1dafa5][_0x04c6('0x3c')],'accountcode':'','online':![]};}var _0x51aacb={'id':_0x2d83eb['id'],'name':_0x2d83eb[_0x04c6('0xe')],'internal':_0x2d83eb['accountcode'],'online':Boolean(_0x2d83eb[_0x04c6('0x3d')]),'paused':Boolean(_0x5cc157[_0x1dafa5][_0x04c6('0x33')])};if(_0x2d83eb[_0x04c6('0x3e')]===_0x04c6('0x1d'))updateAgentVoiceStatus(_0x51aacb,_0x5ce4b0,_0x5aede6);if(_0x51aacb[_0x04c6('0x3d')])_0x5ce4b0[_0x04c6('0x34')]++;if(_0x51aacb[_0x04c6('0x36')])_0x5ce4b0['busy']++;if(_0x51aacb[_0x04c6('0x33')]&&!_0x51aacb['busy']&&!_0x51aacb[_0x04c6('0x1d')])_0x5ce4b0['paused']++;_0x5ce4b0['agents'][_0x04c6('0x1f')](_0x51aacb);}return _0x5ce4b0;});}function getQueueAgents(_0x58a9ad,_0x4584ae,_0x445f6c){var _0x15995b='User'+_[_0x04c6('0x17')](_0x445f6c)+_0x04c6('0x3f');var _0x121093=_0x445f6c+_0x04c6('0x40');return db[_0x15995b][_0x04c6('0x41')]({'where':{[_[_0x04c6('0x17')](_0x445f6c)+_0x04c6('0x42')]:_0x58a9ad['id']},'raw':!![]})['then'](function(_0x547082){for(var _0x56820=0x0;_0x56820<_0x547082[_0x04c6('0x39')];_0x56820++){var _0x417cb7=_['find'](_0x4584ae,['id',_0x547082[_0x56820][_0x04c6('0x3c')]]);if(!_0x417cb7){_0x417cb7={'id':_0x547082[_0x56820][_0x04c6('0x3c')],'name':_0x547082[_0x56820][_0x04c6('0x3c')],'online':![],['pauseField']:![]};}var _0x549911={'id':_0x417cb7['id'],'name':_0x417cb7['name'],'online':Boolean(_0x417cb7['online']),'paused':Boolean(_0x417cb7[_0x121093])};if(_0x549911[_0x04c6('0x3d')])_0x58a9ad[_0x04c6('0x34')]++;_0x58a9ad['agents'][_0x04c6('0x1f')](_0x549911);}return _0x58a9ad;});}function isIdle(_0x3de8a9){return _0x3de8a9===_0x04c6('0x43')||_0x3de8a9==='unknown'||_0x3de8a9===_0x04c6('0x44')||_0x3de8a9===_0x04c6('0x45')||_['isNil'](_0x3de8a9);}function isAgentPaused(_0x25a6fc,_0x203943){var _0x2472ed=[_0x25a6fc[_0x04c6('0x46')],_0x25a6fc['faxPause'],_0x25a6fc[_0x04c6('0x47')],_0x25a6fc[_0x04c6('0x48')],_0x25a6fc[_0x04c6('0x49')],_0x25a6fc[_0x04c6('0x4a')],_0x25a6fc['whatsappPause']];if(!_0x203943)return _[_0x04c6('0x4b')](_0x2472ed);var _0x17824f=_[_0x04c6('0x38')](_0x2472ed);return _0x17824f[_0x04c6('0x39')]>0x0&&_0x17824f['length']<_0x2472ed[_0x04c6('0x39')]?!![]:![];}function isAgentIdle(_0x42273e){if(_0x42273e[_0x04c6('0x3e')]!=='idle'&&_0x42273e[_0x04c6('0x4a')]){_0x42273e[_0x04c6('0x3e')]=_0x04c6('0x4c');return![];}return _[_0x04c6('0x4b')]([_0x42273e[_0x04c6('0x4d')],_0x42273e[_0x04c6('0x4e')],_0x42273e[_0x04c6('0x4f')],_0x42273e[_0x04c6('0x50')],_0x42273e[_0x04c6('0x51')],_0x42273e[_0x04c6('0x3e')],_0x42273e[_0x04c6('0x52')]],isIdle);}function getAgentStatus(_0x3ab244){var _0x3a0b12='unknown';if(isAgentPaused(_0x3ab244))_0x3a0b12=_0x04c6('0x4c');else if(isAgentPaused(_0x3ab244,!![]))_0x3a0b12=_0x04c6('0x53');else if(isAgentIdle(_0x3ab244))_0x3a0b12=_0x04c6('0x43');else _0x3a0b12=_0x04c6('0x36');return _0x3a0b12;}exports[_0x04c6('0x54')]=function(_0x48124f,_0x3bac84){var _0x17778b={'count':0x0,'rows':[]},_0xc29082={},_0x32d5e8,_0x28dfd0,_0x45fbd5=[_0x04c6('0x55'),_0x04c6('0x3d'),_0x04c6('0x56'),'lastPauseAt','pauseType','lastPauseAt','internal',_0x04c6('0x57'),'chatPause',_0x04c6('0x48'),'mailPause',_0x04c6('0x49'),_0x04c6('0x58'),'faxPause','voicePause',_0x04c6('0x59'),_0x04c6('0x5a'),_0x04c6('0x5b'),_0x04c6('0x5c'),'whatsappCapacity',_0x04c6('0x5d'),_0x04c6('0x5e'),_0x04c6('0x5f'),_0x04c6('0x60'),_0x04c6('0x61'),_0x04c6('0x62'),_0x04c6('0x63'),'chatStatus',_0x04c6('0x50'),'mailStatus',_0x04c6('0x51'),_0x04c6('0x52'),'faxStatus',_0x04c6('0x3e'),_0x04c6('0x64'),_0x04c6('0x65'),_0x04c6('0x66'),_0x04c6('0x67'),_0x04c6('0x68'),_0x04c6('0x69'),_0x04c6('0x6a'),'queue',_0x04c6('0x6b'),'screenrecording',_0x04c6('0x6c'),_0x04c6('0x6d'),'routealias'],_0x111364=['chatPause',_0x04c6('0x48'),'mailPause',_0x04c6('0x49'),_0x04c6('0x58'),'faxPause',_0x04c6('0x4a'),_0x04c6('0x3d')];Promise[_0x04c6('0x6e')]()[_0x04c6('0x12')](function(){var _0x2be139=_[_0x04c6('0x30')](db[_0x04c6('0x6f')][_0x04c6('0x70')],function(_0x243bc4){return{'name':_0x243bc4[_0x04c6('0x71')],'type':_0x243bc4[_0x04c6('0x72')]['key']};});_0x48124f[_0x04c6('0x73')][_0x04c6('0x74')]=_0x04c6('0x75');_0x48124f[_0x04c6('0x73')]['online']=!![];_0xc29082=qs[_0x04c6('0x76')](_0x2be139,_0x48124f);_0xc29082[_0x04c6('0x77')]=!![];if(_0x48124f[_0x04c6('0x78')]['role']==='user'){var _0x1655af={'params':{'id':_0x48124f[_0x04c6('0x78')][_0x04c6('0x79')]},'query':{'section':_0x04c6('0x11'),'role':_0x04c6('0x75'),'online':!![],'nolimit':_0x48124f[_0x04c6('0x73')]['nolimit'],'sort':_0x48124f[_0x04c6('0x73')][_0x04c6('0x7a')],'filter':_0x48124f[_0x04c6('0x73')]['filter'],'raw':!![]}};return db['UserProfile'][_0x04c6('0x7b')](_0x1655af);}return db[_0x04c6('0x6f')][_0x04c6('0x7c')](_0xc29082);})[_0x04c6('0x12')](function(_0x54d615){_0x17778b[_0x04c6('0x8')]=_0x54d615['count'];_0x32d5e8=_0x54d615['rows'];return getRealtimeAgents();})[_0x04c6('0x12')](function(_0xe178dd){_0x28dfd0=_0xe178dd[_0x04c6('0x7d')];return _0x32d5e8[_0x04c6('0x30')](function(_0x43260e){var _0x281c2b=_[_0x04c6('0x37')](_0x28dfd0,['id',_0x43260e['id']]);if(_0x281c2b)_['merge'](_0x43260e,_[_0x04c6('0x7e')](_[_0x04c6('0x7f')](_0x281c2b,_0x111364),_0x45fbd5));_0x43260e[_0x04c6('0x80')]=getAgentStatus(_0x43260e);return _0x43260e;});})[_0x04c6('0x12')](function(_0x1c2e79){if(_0x48124f['query']['globalStatusFilter']){var _0x271c8b=_[_0x04c6('0x38')](_0x1c2e79,[_0x04c6('0x80'),_0x48124f['query'][_0x04c6('0x81')]]);if(_0x48124f[_0x04c6('0x73')]['pauseTypeFilter']){_0x271c8b=_[_0x04c6('0x38')](_0x271c8b,[_0x04c6('0x82'),_0x48124f[_0x04c6('0x73')][_0x04c6('0x83')]]);}}_0x17778b[_0x04c6('0x7d')]=_0x271c8b||_0x1c2e79;return _0x17778b;})[_0x04c6('0x12')](respondWithFilteredResult(_0x3bac84,_0xc29082))[_0x04c6('0x1a')](handleError(_0x3bac84,null));};exports[_0x04c6('0x84')]=function(_0x22ae65,_0x3552cd){var _0x2d7ecc=[_0x04c6('0x85'),_0x04c6('0x86'),'sms',_0x04c6('0x87'),_0x04c6('0x88'),'whatsapp',_0x04c6('0x16')];var _0x285dd1={'count':0x0,'rows':[]},_0xd57626={},_0x465d96,_0x172787,_0x4e8d22,_0x25b712,_0x4dc248;Promise[_0x04c6('0x6e')]()['then'](function(){if(_0x22ae65[_0x04c6('0x73')][_0x04c6('0x89')]){if(!_[_0x04c6('0x8a')](_0x2d7ecc,_0x22ae65[_0x04c6('0x73')][_0x04c6('0x89')][_0x04c6('0x8b')]()))throw new Error(_0x04c6('0x8c'));_0x465d96=_0x22ae65[_0x04c6('0x73')][_0x04c6('0x89')]['toLowerCase']();}var _0x2aa93b=_[_0x04c6('0x17')](_0x465d96)+'Queue';var _0x9825cf=_['map'](db[_0x2aa93b][_0x04c6('0x70')],function(_0x111382){return{'name':_0x111382['fieldName'],'type':_0x111382[_0x04c6('0x72')][_0x04c6('0x8d')]};});_0xd57626=qs['getOptions'](_0x9825cf,_0x22ae65);if(_0x22ae65[_0x04c6('0x78')][_0x04c6('0x74')]==='user'){var _0x7b9132={'params':{'id':_0x22ae65[_0x04c6('0x78')]['userProfileId']},'query':{'section':_0x465d96===_0x04c6('0x16')&&_0x22ae65[_0x04c6('0x73')]['type']==='outbound'?'QueueCampaigns':_[_0x04c6('0x17')](_0x465d96)+_0x04c6('0x8e'),'type':_0x22ae65[_0x04c6('0x73')][_0x04c6('0x72')],'nolimit':!![],'sort':_0x04c6('0xe'),'filter':_0x22ae65['query'][_0x04c6('0x38')]}};return db[_0x04c6('0x8f')][_0x04c6('0x7b')](_0x7b9132);}return db[_0x2aa93b][_0x04c6('0x7c')](_0xd57626);})[_0x04c6('0x12')](function(_0x57e90a){_0x285dd1[_0x04c6('0x8')]=_0x57e90a['count'];_0x172787=_0x57e90a[_0x04c6('0x7d')];return getRealtimeQueues(_0x22ae65,_0x465d96);})['then'](function(_0x202761){_0x25b712=_0x202761['rows'];return getRealtimeAgents();})['then'](function(_0x289469){_0x4e8d22=_0x289469['rows'];if(_0x465d96!=_0x04c6('0x16'))return;return getRealtimeVoiceQueueChannels();})[_0x04c6('0x12')](function(_0x174de6){_0x4dc248=_0x174de6?_0x174de6[_0x04c6('0x7d')]:[];return initializeQueues(_0x172787,_0x25b712,_0x465d96,_0x22ae65[_0x04c6('0x73')]['type']);})['then'](function(_0x45b648){var _0x14be40=_0x45b648[_0x04c6('0x30')](function(_0x14072a){if(_0x465d96===_0x04c6('0x16'))return getVoiceQueueAgents(_0x14072a,_0x172787,_0x4e8d22,_0x4dc248);else return getQueueAgents(_0x14072a,_0x4e8d22,_0x465d96);});return Promise[_0x04c6('0x90')](_0x14be40);})['then'](function(_0x1a9a95){_0x285dd1['rows']=_0x1a9a95;return _0x285dd1;})['then'](respondWithFilteredResult(_0x3552cd,_0xd57626))[_0x04c6('0x1a')](handleError(_0x3552cd,null));}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/index.js b/server/api/reportAgentPreview/index.js index a10defd..2afdb9b 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 _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x16de57,_0x30c05e){var _0x348b6d=function(_0x1068a6){while(--_0x1068a6){_0x16de57['push'](_0x16de57['shift']());}};_0x348b6d(++_0x30c05e);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var fs_extra=require(_0x3071('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));module[_0x3071('0x7')]=router; \ No newline at end of file +var _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0xd04611,_0x6f7365){var _0x72e2db=function(_0x349948){while(--_0x349948){_0xd04611['push'](_0xd04611['shift']());}};_0x72e2db(++_0x6f7365);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3635ce,_0x33a6f9){_0x3635ce=_0x3635ce-0x0;var _0x97ecd0=_0xa9e0[_0x3635ce];return _0x97ecd0;};'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 e814679..365432d 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 _0xaf11=['INTEGER','STRING','DATE','sequelize','exports'];(function(_0x444a20,_0x39d689){var _0x1a29cb=function(_0x3f91a9){while(--_0x3f91a9){_0x444a20['push'](_0x444a20['shift']());}};_0x1a29cb(++_0x39d689);}(_0xaf11,0x12f));var _0x1af1=function(_0x358cd6,_0x1320d3){_0x358cd6=_0x358cd6-0x0;var _0x1fbf96=_0xaf11[_0x358cd6];return _0x1fbf96;};'use strict';var Sequelize=require(_0x1af1('0x0'));module[_0x1af1('0x1')]={'state':{'type':Sequelize[_0x1af1('0x2')](0x2)},'statedesc':{'type':Sequelize[_0x1af1('0x3')]},'scheduledat':{'type':Sequelize['DATE']},'uniqueid':{'type':Sequelize[_0x1af1('0x3')]},'starttime':{'type':Sequelize[_0x1af1('0x4')]},'responsetime':{'type':Sequelize[_0x1af1('0x4')]},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'campaign':{'type':Sequelize[_0x1af1('0x3')]},'campaigntype':{'type':Sequelize[_0x1af1('0x3')]},'membername':{'type':Sequelize[_0x1af1('0x3')]}}; \ No newline at end of file +var _0x1c88=['DATE','sequelize','INTEGER','STRING'];(function(_0x20a558,_0x160e0e){var _0x53d3f7=function(_0x259bd8){while(--_0x259bd8){_0x20a558['push'](_0x20a558['shift']());}};_0x53d3f7(++_0x160e0e);}(_0x1c88,0x1a9));var _0x81c8=function(_0x26659f,_0x32f426){_0x26659f=_0x26659f-0x0;var _0x42667f=_0x1c88[_0x26659f];return _0x42667f;};'use strict';var Sequelize=require(_0x81c8('0x0'));module['exports']={'state':{'type':Sequelize[_0x81c8('0x1')](0x2)},'statedesc':{'type':Sequelize[_0x81c8('0x2')]},'scheduledat':{'type':Sequelize[_0x81c8('0x3')]},'uniqueid':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize[_0x81c8('0x3')]},'ringtime':{'type':Sequelize[_0x81c8('0x1')],'defaultValue':0x0},'campaign':{'type':Sequelize[_0x81c8('0x2')]},'campaigntype':{'type':Sequelize[_0x81c8('0x2')]},'membername':{'type':Sequelize[_0x81c8('0x2')]}}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.model.js b/server/api/reportAgentPreview/reportAgentPreview.model.js index 91fe429..0f24a99 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 _0xdd4e=['exports','define','ReportAgentPreview','report_agent_preview','lodash','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./reportAgentPreview.attributes'];(function(_0x42c85c,_0x551dd5){var _0x476c75=function(_0x3c0eb1){while(--_0x3c0eb1){_0x42c85c['push'](_0x42c85c['shift']());}};_0x476c75(++_0x551dd5);}(_0xdd4e,0x122));var _0xedd4=function(_0x54d4fe,_0x55e869){_0x54d4fe=_0x54d4fe-0x0;var _0x1ab5bb=_0xdd4e[_0x54d4fe];return _0x1ab5bb;};'use strict';var _=require(_0xedd4('0x0'));var util=require('util');var logger=require(_0xedd4('0x1'))(_0xedd4('0x2'));var moment=require(_0xedd4('0x3'));var BPromise=require(_0xedd4('0x4'));var rp=require(_0xedd4('0x5'));var fs=require('fs');var path=require(_0xedd4('0x6'));var rimraf=require('rimraf');var config=require(_0xedd4('0x7'));var attributes=require(_0xedd4('0x8'));module[_0xedd4('0x9')]=function(_0x3c3423,_0x5450c1){return _0x3c3423[_0xedd4('0xa')](_0xedd4('0xb'),attributes,{'tableName':_0xedd4('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2a05=['../../config/environment','./reportAgentPreview.attributes','exports','ReportAgentPreview','report_agent_preview','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf'];(function(_0x49b207,_0x408ade){var _0x2dc8fa=function(_0x150975){while(--_0x150975){_0x49b207['push'](_0x49b207['shift']());}};_0x2dc8fa(++_0x408ade);}(_0x2a05,0x1bf));var _0x52a0=function(_0x87b481,_0x261d8f){_0x87b481=_0x87b481-0x0;var _0x377b2a=_0x2a05[_0x87b481];return _0x377b2a;};'use strict';var _=require(_0x52a0('0x0'));var util=require(_0x52a0('0x1'));var logger=require(_0x52a0('0x2'))(_0x52a0('0x3'));var moment=require('moment');var BPromise=require(_0x52a0('0x4'));var rp=require(_0x52a0('0x5'));var fs=require('fs');var path=require(_0x52a0('0x6'));var rimraf=require(_0x52a0('0x7'));var config=require(_0x52a0('0x8'));var attributes=require(_0x52a0('0x9'));module[_0x52a0('0xa')]=function(_0x254228,_0x209d99){return _0x254228['define'](_0x52a0('0xb'),attributes,{'tableName':_0x52a0('0xc'),'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 daecadb..eb6c94f 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 _0xcc69=['bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','ReportAgentPreview,\x20%s,\x20%s','request\x20sent','ReportAgentPreview,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateReportAgentPreview','create','body','raw','debug','lodash','util','moment'];(function(_0x136dbb,_0x2b0666){var _0x6a5309=function(_0x2635af){while(--_0x2635af){_0x136dbb['push'](_0x136dbb['shift']());}};_0x6a5309(++_0x2b0666);}(_0xcc69,0x131));var _0x9cc6=function(_0x3f5f08,_0x1ccd7f){_0x3f5f08=_0x3f5f08-0x0;var _0x566dd9=_0xcc69[_0x3f5f08];return _0x566dd9;};'use strict';var _=require(_0x9cc6('0x0'));var util=require(_0x9cc6('0x1'));var moment=require(_0x9cc6('0x2'));var BPromise=require(_0x9cc6('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9cc6('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x9cc6('0x5'));var logger=require(_0x9cc6('0x6'))(_0x9cc6('0x7'));var config=require(_0x9cc6('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x9cc6('0x9')][_0x9cc6('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x53aa4a,_0x562a9b,_0x24e7d3){return new BPromise(function(_0x186321,_0x386133){return client[_0x9cc6('0xb')](_0x53aa4a,_0x24e7d3)[_0x9cc6('0xc')](function(_0x2cc258){logger[_0x9cc6('0xd')](_0x9cc6('0xe'),_0x562a9b,_0x9cc6('0xf'));logger['debug'](_0x9cc6('0x10'),_0x562a9b,'request\x20sent',JSON[_0x9cc6('0x11')](_0x2cc258));if(_0x2cc258[_0x9cc6('0x12')]){if(_0x2cc258['error'][_0x9cc6('0x13')]===0x1f4){logger[_0x9cc6('0x12')](_0x9cc6('0xe'),_0x562a9b,_0x2cc258['error'][_0x9cc6('0x14')]);return _0x386133(_0x2cc258['error'][_0x9cc6('0x14')]);}logger[_0x9cc6('0x12')](_0x9cc6('0xe'),_0x562a9b,_0x2cc258[_0x9cc6('0x12')]['message']);return _0x186321(_0x2cc258['error']['message']);}else{logger[_0x9cc6('0xd')](_0x9cc6('0xe'),_0x562a9b,_0x9cc6('0xf'));_0x186321(_0x2cc258[_0x9cc6('0x15')][_0x9cc6('0x14')]);}})[_0x9cc6('0x16')](function(_0x3e93ef){logger[_0x9cc6('0x12')](_0x9cc6('0xe'),_0x562a9b,_0x3e93ef);_0x386133(_0x3e93ef);});});}exports[_0x9cc6('0x17')]=function(_0x2c8c99){var _0x46a435=this;return new Promise(function(_0x5ba73f,_0x1363af){return db['ReportAgentPreview'][_0x9cc6('0x18')](_0x2c8c99[_0x9cc6('0x19')],{'raw':_0x2c8c99['options']?_0x2c8c99['options'][_0x9cc6('0x1a')]===undefined?!![]:![]:!![]})[_0x9cc6('0xc')](function(_0x369684){logger[_0x9cc6('0xd')](_0x9cc6('0x17'),_0x2c8c99);logger[_0x9cc6('0x1b')](_0x9cc6('0x17'),_0x2c8c99,JSON[_0x9cc6('0x11')](_0x369684));_0x5ba73f(_0x369684);})[_0x9cc6('0x16')](function(_0x5cbfd3){logger[_0x9cc6('0x12')](_0x9cc6('0x17'),_0x5cbfd3[_0x9cc6('0x14')],_0x2c8c99);_0x1363af(_0x46a435[_0x9cc6('0x12')](0x1f4,_0x5cbfd3['message']));});});}; \ No newline at end of file +var _0xf6f0=['catch','CreateReportAgentPreview','body','options','raw','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','ReportAgentPreview,\x20%s,\x20%s,\x20%s','stringify','error','code','ReportAgentPreview,\x20%s,\x20%s','message'];(function(_0x36f60c,_0x249ad8){var _0x361095=function(_0x535bb2){while(--_0x535bb2){_0x36f60c['push'](_0x36f60c['shift']());}};_0x361095(++_0x249ad8);}(_0xf6f0,0x157));var _0x0f6f=function(_0x219143,_0x451ca3){_0x219143=_0x219143-0x0;var _0x501e6b=_0xf6f0[_0x219143];return _0x501e6b;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x0f6f('0x0'));var rs=require(_0x0f6f('0x1'));var fs=require('fs');var Redis=require(_0x0f6f('0x2'));var db=require(_0x0f6f('0x3'))['db'];var utils=require(_0x0f6f('0x4'));var logger=require(_0x0f6f('0x5'))(_0x0f6f('0x6'));var config=require(_0x0f6f('0x7'));var jayson=require(_0x0f6f('0x8'));var client=jayson[_0x0f6f('0x9')][_0x0f6f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xb0ca5c,_0xc44c63,_0x256f8e){return new BPromise(function(_0x5b2901,_0x73535c){return client[_0x0f6f('0xb')](_0xb0ca5c,_0x256f8e)[_0x0f6f('0xc')](function(_0x8c542d){logger[_0x0f6f('0xd')]('ReportAgentPreview,\x20%s,\x20%s',_0xc44c63,_0x0f6f('0xe'));logger['debug'](_0x0f6f('0xf'),_0xc44c63,'request\x20sent',JSON[_0x0f6f('0x10')](_0x8c542d));if(_0x8c542d[_0x0f6f('0x11')]){if(_0x8c542d['error'][_0x0f6f('0x12')]===0x1f4){logger[_0x0f6f('0x11')](_0x0f6f('0x13'),_0xc44c63,_0x8c542d['error'][_0x0f6f('0x14')]);return _0x73535c(_0x8c542d[_0x0f6f('0x11')][_0x0f6f('0x14')]);}logger['error'](_0x0f6f('0x13'),_0xc44c63,_0x8c542d[_0x0f6f('0x11')][_0x0f6f('0x14')]);return _0x5b2901(_0x8c542d[_0x0f6f('0x11')][_0x0f6f('0x14')]);}else{logger[_0x0f6f('0xd')](_0x0f6f('0x13'),_0xc44c63,_0x0f6f('0xe'));_0x5b2901(_0x8c542d['result'][_0x0f6f('0x14')]);}})[_0x0f6f('0x15')](function(_0x30962c){logger[_0x0f6f('0x11')]('ReportAgentPreview,\x20%s,\x20%s',_0xc44c63,_0x30962c);_0x73535c(_0x30962c);});});}exports[_0x0f6f('0x16')]=function(_0x156a5e){var _0x444c61=this;return new Promise(function(_0x22adcc,_0x383087){return db['ReportAgentPreview']['create'](_0x156a5e[_0x0f6f('0x17')],{'raw':_0x156a5e[_0x0f6f('0x18')]?_0x156a5e['options'][_0x0f6f('0x19')]===undefined?!![]:![]:!![]})[_0x0f6f('0xc')](function(_0x4c801b){logger[_0x0f6f('0xd')](_0x0f6f('0x16'),_0x156a5e);logger['debug']('CreateReportAgentPreview',_0x156a5e,JSON['stringify'](_0x4c801b));_0x22adcc(_0x4c801b);})[_0x0f6f('0x15')](function(_0x304707){logger['error']('CreateReportAgentPreview',_0x304707['message'],_0x156a5e);_0x383087(_0x444c61[_0x0f6f('0x11')](0x1f4,_0x304707[_0x0f6f('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/rpc/index.js b/server/api/rpc/index.js index 7af78e5..af4aad5 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 _0xf887=['voiceChannelStopMixMonitor','/voice/queues','chatQueues','mailQueues','/mail/accounts','mailAccounts','/openchannel/queues','openchannelQueues','/sms/queues','/whatsapp/queues','whatsappQueues','faxQueues','/voice/queues/preview/:id','voiceQueuesPreview','/voice/queues/channels','voiceQueuesChannels','/voice/queues/channels/:uniqueid','voiceQueuesChannelHangup','/voice/queues/channels/:uniqueid/redirect/:exten','voiceQueuesChannelRedirect','/voice/queues/:id','put','updateVoiceQueue','/outbound','outbound','outboundChannels','/agents','agents','/agents/:id/capacity','agentCapacity','/telephones','/trunks','trunks','/campaigns','campaigns','faxAccounts','/mail/queues/waitinginteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','openchannelQueuesIdWaitingInteractions','/sms/queues/waitinginteractions','smsQueuesWaitingInteractions','/whatsapp/queues/waitinginteractions','whatsappQueuesWaitingInteractions','/fax/queues/waitinginteractions','faxQueuesWaitingInteractions','post','/mail/queues/:id/notify','queueNotify','/mail/queues/:id','showMailQueues','/chat/queues/:id/notify','chat','/chat/queues/:id','showChatQueues','fax','/fax/queues/:id','/openchannel/queues/:id/notify','openchannel','/whatsapp/queues/:id/notify','whatsapp','/sms/queues/:id','/whatsapp/queues/:id','showWhatsappQueues','/agents/:id/notify','agentNotify','multer','util','path','express','Router','../../components/auth/service','./rpc.controller','get','/voice/channels','isAuthenticated','voiceChannels','/voice/channels/:uniqueid/mixmonitor','/voice/channels/:uniqueid/stopmixmonitor'];(function(_0x23c966,_0x373ac1){var _0x314f2b=function(_0xad60df){while(--_0xad60df){_0x23c966['push'](_0x23c966['shift']());}};_0x314f2b(++_0x373ac1);}(_0xf887,0x12f));var _0x7f88=function(_0x4e6085,_0xcc5a2d){_0x4e6085=_0x4e6085-0x0;var _0x262cd2=_0xf887[_0x4e6085];return _0x262cd2;};'use strict';var multer=require(_0x7f88('0x0'));var util=require(_0x7f88('0x1'));var path=require(_0x7f88('0x2'));var express=require(_0x7f88('0x3'));var router=express[_0x7f88('0x4')]();var auth=require(_0x7f88('0x5'));var controller=require(_0x7f88('0x6'));router[_0x7f88('0x7')](_0x7f88('0x8'),auth[_0x7f88('0x9')](),controller[_0x7f88('0xa')]);router[_0x7f88('0x7')](_0x7f88('0xb'),auth[_0x7f88('0x9')](),controller['voiceChannelMixMonitor']);router[_0x7f88('0x7')](_0x7f88('0xc'),auth[_0x7f88('0x9')](),controller[_0x7f88('0xd')]);router[_0x7f88('0x7')](_0x7f88('0xe'),auth[_0x7f88('0x9')](),controller['voiceQueues']);router[_0x7f88('0x7')]('/chat/queues',auth[_0x7f88('0x9')](),controller[_0x7f88('0xf')]);router[_0x7f88('0x7')]('/mail/queues',auth[_0x7f88('0x9')](),controller[_0x7f88('0x10')]);router[_0x7f88('0x7')](_0x7f88('0x11'),auth[_0x7f88('0x9')](),controller[_0x7f88('0x12')]);router[_0x7f88('0x7')](_0x7f88('0x13'),auth[_0x7f88('0x9')](),controller[_0x7f88('0x14')]);router['get'](_0x7f88('0x15'),auth[_0x7f88('0x9')](),controller['smsQueues']);router[_0x7f88('0x7')](_0x7f88('0x16'),auth[_0x7f88('0x9')](),controller[_0x7f88('0x17')]);router[_0x7f88('0x7')]('/fax/queues',auth[_0x7f88('0x9')](),controller[_0x7f88('0x18')]);router['get'](_0x7f88('0x19'),auth['isAuthenticated'](),controller[_0x7f88('0x1a')]);router[_0x7f88('0x7')](_0x7f88('0x1b'),auth[_0x7f88('0x9')](),controller[_0x7f88('0x1c')]);router[_0x7f88('0x7')](_0x7f88('0x1d'),auth[_0x7f88('0x9')](),controller['voiceQueuesChannel']);router['get']('/voice/queues/channels/:uniqueid/hangup',auth['isAuthenticated'](),controller[_0x7f88('0x1e')]);router[_0x7f88('0x7')](_0x7f88('0x1f'),auth[_0x7f88('0x9')](),controller[_0x7f88('0x20')]);router[_0x7f88('0x7')](_0x7f88('0x21'),auth['isAuthenticated'](),controller['showVoiceQueues']);router[_0x7f88('0x22')](_0x7f88('0x21'),auth[_0x7f88('0x9')](),controller[_0x7f88('0x23')]);router[_0x7f88('0x7')](_0x7f88('0x24'),auth[_0x7f88('0x9')](),controller[_0x7f88('0x25')]);router['get']('/outbound/channels',auth[_0x7f88('0x9')](),controller[_0x7f88('0x26')]);router['get'](_0x7f88('0x27'),auth[_0x7f88('0x9')](),controller[_0x7f88('0x28')]);router[_0x7f88('0x22')](_0x7f88('0x29'),auth[_0x7f88('0x9')](),controller[_0x7f88('0x2a')]);router[_0x7f88('0x7')](_0x7f88('0x2b'),auth[_0x7f88('0x9')](),controller['telephones']);router[_0x7f88('0x7')](_0x7f88('0x2c'),auth[_0x7f88('0x9')](),controller[_0x7f88('0x2d')]);router['get'](_0x7f88('0x2e'),auth['isAuthenticated'](),controller[_0x7f88('0x2f')]);router[_0x7f88('0x7')]('/fax/accounts',auth[_0x7f88('0x9')](),controller[_0x7f88('0x30')]);router[_0x7f88('0x7')]('/chat/queues/waitinginteractions',auth[_0x7f88('0x9')](),controller['chatQueuesWaitingInteractions']);router['get'](_0x7f88('0x31'),auth[_0x7f88('0x9')](),controller[_0x7f88('0x32')]);router[_0x7f88('0x7')]('/openchannel/queues/waitinginteractions',auth[_0x7f88('0x9')](),controller[_0x7f88('0x33')]);router['get']('/openchannel/queues/:id/waitinginteractions',auth[_0x7f88('0x9')](),controller[_0x7f88('0x34')]);router['get'](_0x7f88('0x35'),auth[_0x7f88('0x9')](),controller[_0x7f88('0x36')]);router['get'](_0x7f88('0x37'),auth[_0x7f88('0x9')](),controller[_0x7f88('0x38')]);router[_0x7f88('0x7')](_0x7f88('0x39'),auth['isAuthenticated'](),controller[_0x7f88('0x3a')]);router[_0x7f88('0x3b')](_0x7f88('0x3c'),auth['isAuthenticated'](),controller[_0x7f88('0x3d')]('mail'));router[_0x7f88('0x7')](_0x7f88('0x3e'),auth['isAuthenticated'](),controller[_0x7f88('0x3f')]);router[_0x7f88('0x3b')](_0x7f88('0x40'),auth[_0x7f88('0x9')](),controller['queueNotify'](_0x7f88('0x41')));router[_0x7f88('0x7')](_0x7f88('0x42'),auth[_0x7f88('0x9')](),controller[_0x7f88('0x43')]);router[_0x7f88('0x3b')]('/fax/queues/:id/notify',auth['isAuthenticated'](),controller[_0x7f88('0x3d')](_0x7f88('0x44')));router[_0x7f88('0x7')](_0x7f88('0x45'),auth[_0x7f88('0x9')](),controller['showFaxQueues']);router[_0x7f88('0x3b')](_0x7f88('0x46'),auth[_0x7f88('0x9')](),controller[_0x7f88('0x3d')](_0x7f88('0x47')));router[_0x7f88('0x7')]('/openchannel/queues/:id',auth[_0x7f88('0x9')](),controller['showOpenchannelQueues']);router[_0x7f88('0x3b')]('/sms/queues/:id/notify',auth[_0x7f88('0x9')](),controller['queueNotify']('sms'));router['post'](_0x7f88('0x48'),auth[_0x7f88('0x9')](),controller[_0x7f88('0x3d')](_0x7f88('0x49')));router[_0x7f88('0x7')](_0x7f88('0x4a'),auth[_0x7f88('0x9')](),controller['showSmsQueues']);router[_0x7f88('0x7')](_0x7f88('0x4b'),auth[_0x7f88('0x9')](),controller[_0x7f88('0x4c')]);router[_0x7f88('0x3b')](_0x7f88('0x4d'),auth[_0x7f88('0x9')](),controller[_0x7f88('0x4e')]);module['exports']=router; \ No newline at end of file +var _0x2ad8=['/whatsapp/queues/:id','/agents/:id/notify','agentNotify','exports','multer','util','express','Router','../../components/auth/service','./rpc.controller','/voice/channels','isAuthenticated','voiceChannels','voiceChannelMixMonitor','get','/voice/channels/:uniqueid/stopmixmonitor','voiceChannelStopMixMonitor','/voice/queues','voiceQueues','/chat/queues','chatQueues','/mail/queues','mailQueues','/mail/accounts','mailAccounts','/openchannel/queues','openchannelQueues','/whatsapp/queues','whatsappQueues','/fax/queues','faxQueues','/voice/queues/preview/:id','voiceQueuesPreview','/voice/queues/channels','voiceQueuesChannels','voiceQueuesChannel','/voice/queues/channels/:uniqueid/hangup','voiceQueuesChannelRedirect','showVoiceQueues','put','/voice/queues/:id','updateVoiceQueue','/outbound','outbound','/outbound/channels','outboundChannels','/agents','agents','/agents/:id/capacity','agentCapacity','telephones','campaigns','/fax/accounts','faxAccounts','/chat/queues/waitinginteractions','chatQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','/openchannel/queues/:id/waitinginteractions','openchannelQueuesIdWaitingInteractions','/sms/queues/waitinginteractions','smsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','/fax/queues/waitinginteractions','faxQueuesWaitingInteractions','post','/mail/queues/:id/notify','mail','/mail/queues/:id','showMailQueues','queueNotify','chat','/chat/queues/:id','fax','/fax/queues/:id','showFaxQueues','/openchannel/queues/:id/notify','/openchannel/queues/:id','showOpenchannelQueues','/sms/queues/:id/notify','sms','/whatsapp/queues/:id/notify','/sms/queues/:id','showSmsQueues'];(function(_0x3166c2,_0x54ae94){var _0x4419bf=function(_0x1f7c3a){while(--_0x1f7c3a){_0x3166c2['push'](_0x3166c2['shift']());}};_0x4419bf(++_0x54ae94);}(_0x2ad8,0x1a3));var _0x82ad=function(_0x1363e7,_0x1e578b){_0x1363e7=_0x1363e7-0x0;var _0x1498c6=_0x2ad8[_0x1363e7];return _0x1498c6;};'use strict';var multer=require(_0x82ad('0x0'));var util=require(_0x82ad('0x1'));var path=require('path');var express=require(_0x82ad('0x2'));var router=express[_0x82ad('0x3')]();var auth=require(_0x82ad('0x4'));var controller=require(_0x82ad('0x5'));router['get'](_0x82ad('0x6'),auth[_0x82ad('0x7')](),controller[_0x82ad('0x8')]);router['get']('/voice/channels/:uniqueid/mixmonitor',auth[_0x82ad('0x7')](),controller[_0x82ad('0x9')]);router[_0x82ad('0xa')](_0x82ad('0xb'),auth[_0x82ad('0x7')](),controller[_0x82ad('0xc')]);router[_0x82ad('0xa')](_0x82ad('0xd'),auth[_0x82ad('0x7')](),controller[_0x82ad('0xe')]);router['get'](_0x82ad('0xf'),auth['isAuthenticated'](),controller[_0x82ad('0x10')]);router['get'](_0x82ad('0x11'),auth[_0x82ad('0x7')](),controller[_0x82ad('0x12')]);router[_0x82ad('0xa')](_0x82ad('0x13'),auth['isAuthenticated'](),controller[_0x82ad('0x14')]);router['get'](_0x82ad('0x15'),auth[_0x82ad('0x7')](),controller[_0x82ad('0x16')]);router[_0x82ad('0xa')]('/sms/queues',auth['isAuthenticated'](),controller['smsQueues']);router['get'](_0x82ad('0x17'),auth[_0x82ad('0x7')](),controller[_0x82ad('0x18')]);router[_0x82ad('0xa')](_0x82ad('0x19'),auth[_0x82ad('0x7')](),controller[_0x82ad('0x1a')]);router[_0x82ad('0xa')](_0x82ad('0x1b'),auth['isAuthenticated'](),controller[_0x82ad('0x1c')]);router[_0x82ad('0xa')](_0x82ad('0x1d'),auth[_0x82ad('0x7')](),controller[_0x82ad('0x1e')]);router[_0x82ad('0xa')]('/voice/queues/channels/:uniqueid',auth['isAuthenticated'](),controller[_0x82ad('0x1f')]);router[_0x82ad('0xa')](_0x82ad('0x20'),auth['isAuthenticated'](),controller['voiceQueuesChannelHangup']);router[_0x82ad('0xa')]('/voice/queues/channels/:uniqueid/redirect/:exten',auth[_0x82ad('0x7')](),controller[_0x82ad('0x21')]);router[_0x82ad('0xa')]('/voice/queues/:id',auth[_0x82ad('0x7')](),controller[_0x82ad('0x22')]);router[_0x82ad('0x23')](_0x82ad('0x24'),auth[_0x82ad('0x7')](),controller[_0x82ad('0x25')]);router['get'](_0x82ad('0x26'),auth['isAuthenticated'](),controller[_0x82ad('0x27')]);router[_0x82ad('0xa')](_0x82ad('0x28'),auth[_0x82ad('0x7')](),controller[_0x82ad('0x29')]);router[_0x82ad('0xa')](_0x82ad('0x2a'),auth['isAuthenticated'](),controller[_0x82ad('0x2b')]);router[_0x82ad('0x23')](_0x82ad('0x2c'),auth[_0x82ad('0x7')](),controller[_0x82ad('0x2d')]);router[_0x82ad('0xa')]('/telephones',auth['isAuthenticated'](),controller[_0x82ad('0x2e')]);router[_0x82ad('0xa')]('/trunks',auth[_0x82ad('0x7')](),controller['trunks']);router[_0x82ad('0xa')]('/campaigns',auth[_0x82ad('0x7')](),controller[_0x82ad('0x2f')]);router[_0x82ad('0xa')](_0x82ad('0x30'),auth['isAuthenticated'](),controller[_0x82ad('0x31')]);router['get'](_0x82ad('0x32'),auth[_0x82ad('0x7')](),controller[_0x82ad('0x33')]);router['get']('/mail/queues/waitinginteractions',auth[_0x82ad('0x7')](),controller['mailQueuesWaitingInteractions']);router[_0x82ad('0xa')]('/openchannel/queues/waitinginteractions',auth[_0x82ad('0x7')](),controller[_0x82ad('0x34')]);router[_0x82ad('0xa')](_0x82ad('0x35'),auth[_0x82ad('0x7')](),controller[_0x82ad('0x36')]);router[_0x82ad('0xa')](_0x82ad('0x37'),auth[_0x82ad('0x7')](),controller[_0x82ad('0x38')]);router['get']('/whatsapp/queues/waitinginteractions',auth['isAuthenticated'](),controller[_0x82ad('0x39')]);router[_0x82ad('0xa')](_0x82ad('0x3a'),auth['isAuthenticated'](),controller[_0x82ad('0x3b')]);router[_0x82ad('0x3c')](_0x82ad('0x3d'),auth[_0x82ad('0x7')](),controller['queueNotify'](_0x82ad('0x3e')));router['get'](_0x82ad('0x3f'),auth[_0x82ad('0x7')](),controller[_0x82ad('0x40')]);router[_0x82ad('0x3c')]('/chat/queues/:id/notify',auth['isAuthenticated'](),controller[_0x82ad('0x41')](_0x82ad('0x42')));router[_0x82ad('0xa')](_0x82ad('0x43'),auth[_0x82ad('0x7')](),controller['showChatQueues']);router[_0x82ad('0x3c')]('/fax/queues/:id/notify',auth[_0x82ad('0x7')](),controller['queueNotify'](_0x82ad('0x44')));router[_0x82ad('0xa')](_0x82ad('0x45'),auth['isAuthenticated'](),controller[_0x82ad('0x46')]);router[_0x82ad('0x3c')](_0x82ad('0x47'),auth['isAuthenticated'](),controller['queueNotify']('openchannel'));router[_0x82ad('0xa')](_0x82ad('0x48'),auth[_0x82ad('0x7')](),controller[_0x82ad('0x49')]);router['post'](_0x82ad('0x4a'),auth['isAuthenticated'](),controller[_0x82ad('0x41')](_0x82ad('0x4b')));router[_0x82ad('0x3c')](_0x82ad('0x4c'),auth[_0x82ad('0x7')](),controller[_0x82ad('0x41')]('whatsapp'));router[_0x82ad('0xa')](_0x82ad('0x4d'),auth[_0x82ad('0x7')](),controller[_0x82ad('0x4e')]);router[_0x82ad('0xa')](_0x82ad('0x4f'),auth['isAuthenticated'](),controller['showWhatsappQueues']);router[_0x82ad('0x3c')](_0x82ad('0x50'),auth[_0x82ad('0x7')](),controller[_0x82ad('0x51')]);module[_0x82ad('0x52')]=router; \ No newline at end of file diff --git a/server/api/rpc/rpc.controller.js b/server/api/rpc/rpc.controller.js index b48681e..ee413ae 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 _0x425d=['http','request','then','error','code','message','result','catch','status','sendStatus','stack','name','isNil','rows','find','query','merge','params','voiceChannelStopMixMonitor','VoiceChannelStopMixMonitor','voiceQueues','VoiceQueues','showVoiceQueues','updateVoiceQueue','UpdateVoiceQueue','voiceQueuesPreview','VoiceQueuesPreview','voiceQueuesChannels','VoiceQueuesChannels','voiceQueuesChannel','voiceQueuesChannelHangup','VoiceQueuesChannelHangup','VoiceQueuesChannelRedirect','outboundChannels','agents','Agents','agentCapacity','body','interaction','user','MemberReport','length','format','updateAttributes','findOrCreate','INTERACTION','interface','YYYY-MM-DD\x20HH:mm:ss','agent','internal','AgentCapacity','capacity','Telephones','trunks','campaigns','Campaigns','ChatQueues','showMailQueues','mailAccounts','MailAccounts','openchannelQueues','showOpenchannelQueues','OpenchannelQueues','smsQueues','SmsQueues','whatsappQueues','WhatsappQueues','showWhatsappQueues','faxQueues','FaxQueues','showFaxQueues','faxAccounts','FaxAccounts','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','MailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','openchannelQueuesIdWaitingInteractions','OpenchannelQueuesWaitingInteractions','filter','map','queue_id','uniq','indexOf','smsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','queueNotify','capitalize','chat','Website','Account','Queue','findOne','Message','messageId','Interaction','\x20Message\x20not\x20found','MessageId','InteractionId','From','QueueId','TransferReport','Start','queue','queueTransferTimeout','*,*,*,*','agentNotify','Channel\x20field\x20is\x20mandatory','channel','User','update','agentTransferTimeout','bluebird','lodash','util','../../mysqldb','../../config/logger','api','jayson/promise','client'];(function(_0x381aa2,_0xe97f72){var _0x179cc0=function(_0x406447){while(--_0x406447){_0x381aa2['push'](_0x381aa2['shift']());}};_0x179cc0(++_0xe97f72);}(_0x425d,0x1e0));var _0xd425=function(_0x1652b7,_0xcd7dd5){_0x1652b7=_0x1652b7-0x0;var _0x54632e=_0x425d[_0x1652b7];return _0x54632e;};'use strict';var BPromise=require(_0xd425('0x0'));var moment=require('moment');var _=require(_0xd425('0x1'));var util=require(_0xd425('0x2'));var db=require(_0xd425('0x3'))['db'];var logger=require(_0xd425('0x4'))(_0xd425('0x5'));var jayson=require(_0xd425('0x6'));var amiClient=jayson[_0xd425('0x7')]['http']({'port':0x232a});var mailClient=jayson[_0xd425('0x7')][_0xd425('0x8')]({'port':0x232b});var routingClient=jayson[_0xd425('0x7')][_0xd425('0x8')]({'port':0x232c});function respondWithRpcPromise(_0x1d97d9,_0x1d2ed0,_0x50b061){return new BPromise(function(_0xb6ba8e,_0x374c3d){var _0x262b02=_0x50b061?_0x50b061:amiClient;return _0x262b02[_0xd425('0x9')](_0x1d97d9,_0x1d2ed0)[_0xd425('0xa')](function(_0x2beb20){if(_0x2beb20[_0xd425('0xb')]){if(_0x2beb20[_0xd425('0xb')][_0xd425('0xc')]===0x1f4){return _0x374c3d(_0x2beb20[_0xd425('0xb')][_0xd425('0xd')]);}return _0xb6ba8e(_0x2beb20[_0xd425('0xb')][_0xd425('0xd')]);}else{_0xb6ba8e(_0x2beb20[_0xd425('0xe')]);}})[_0xd425('0xf')](function(_0x2385a5){_0x374c3d(_0x2385a5);});});}function respondWithResult(_0x9bb611,_0x3cacf7){_0x3cacf7=_0x3cacf7||0xc8;return function(_0x3b5de8){if(_0x3b5de8){return _0x9bb611[_0xd425('0x10')](_0x3cacf7)['json'](_0x3b5de8);}return _0x9bb611[_0xd425('0x11')](0x194);};}function handleError(_0x17a498,_0x336dc3){_0x336dc3=_0x336dc3||0x1f4;return function(_0x5d3d60){logger[_0xd425('0xb')](_0x5d3d60[_0xd425('0x12')]);if(_0x5d3d60[_0xd425('0x13')]){delete _0x5d3d60[_0xd425('0x13')];}_0x17a498[_0xd425('0x10')](_0x336dc3)['send'](_0x5d3d60);};}function findById(_0x278626){return function(_0x471267){if(!_[_0xd425('0x14')](_0x278626)&&!_[_0xd425('0x14')](_0x471267)&&!_['isNil'](_0x471267[_0xd425('0x15')])){return _[_0xd425('0x16')](_0x471267[_0xd425('0x15')],function(_0x1155bc){return _0x1155bc['id']==_0x278626;});}return null;};}exports['voiceChannels']=function(_0x58a0c1,_0x5debc3){return respondWithRpcPromise('VoiceChannels',_0x58a0c1[_0xd425('0x17')])[_0xd425('0xa')](respondWithResult(_0x5debc3,null))[_0xd425('0xf')](handleError(_0x5debc3,null));};exports['voiceChannelMixMonitor']=function(_0x355af0,_0x7e982e){return respondWithRpcPromise('VoiceChannelMixMonitor',_[_0xd425('0x18')](_0x355af0[_0xd425('0x17')],_0x355af0[_0xd425('0x19')]))[_0xd425('0xa')](respondWithResult(_0x7e982e,null))[_0xd425('0xf')](handleError(_0x7e982e,null));};exports[_0xd425('0x1a')]=function(_0x2480a0,_0x3500bb){return respondWithRpcPromise(_0xd425('0x1b'),_[_0xd425('0x18')](_0x2480a0[_0xd425('0x17')],_0x2480a0[_0xd425('0x19')]))['then'](respondWithResult(_0x3500bb,null))[_0xd425('0xf')](handleError(_0x3500bb,null));};exports[_0xd425('0x1c')]=function(_0x398985,_0x1908a5){return respondWithRpcPromise(_0xd425('0x1d'),_0x398985[_0xd425('0x17')])[_0xd425('0xa')](respondWithResult(_0x1908a5,null))['catch'](handleError(_0x1908a5,null));};exports[_0xd425('0x1e')]=function(_0x177de2,_0x1d8861){return respondWithRpcPromise('VoiceQueues',_0x177de2[_0xd425('0x17')])[_0xd425('0xa')](findById(_0x177de2[_0xd425('0x19')]['id']))[_0xd425('0xa')](respondWithResult(_0x1d8861,null))[_0xd425('0xf')](handleError(_0x1d8861,null));};exports[_0xd425('0x1f')]=function(_0x2fd17a,_0x37b63c){return respondWithRpcPromise(_0xd425('0x20'),_[_0xd425('0x18')](_0x2fd17a['body'],_0x2fd17a[_0xd425('0x19')]))[_0xd425('0xa')](respondWithResult(_0x37b63c,null))[_0xd425('0xf')](handleError(_0x37b63c,null));};exports[_0xd425('0x21')]=function(_0x3275b1,_0x1abf33){return respondWithRpcPromise(_0xd425('0x22'),_[_0xd425('0x18')](_0x3275b1[_0xd425('0x17')],_0x3275b1[_0xd425('0x19')]))[_0xd425('0xa')](respondWithResult(_0x1abf33,null))['catch'](handleError(_0x1abf33,null));};exports[_0xd425('0x23')]=function(_0x2a2a9b,_0x3120a4){return respondWithRpcPromise(_0xd425('0x24'),_0x2a2a9b[_0xd425('0x17')])['then'](respondWithResult(_0x3120a4,null))[_0xd425('0xf')](handleError(_0x3120a4,null));};exports[_0xd425('0x25')]=function(_0x4cfcd1,_0x574962){return respondWithRpcPromise('VoiceQueuesChannel',_[_0xd425('0x18')](_0x4cfcd1[_0xd425('0x17')],_0x4cfcd1[_0xd425('0x19')]))[_0xd425('0xa')](respondWithResult(_0x574962,null))['catch'](handleError(_0x574962,null));};exports[_0xd425('0x26')]=function(_0x1d4414,_0x30a9dc){return respondWithRpcPromise(_0xd425('0x27'),_[_0xd425('0x18')](_0x1d4414[_0xd425('0x17')],_0x1d4414[_0xd425('0x19')]))['then'](respondWithResult(_0x30a9dc,null))[_0xd425('0xf')](handleError(_0x30a9dc,null));};exports['voiceQueuesChannelRedirect']=function(_0x22df81,_0x29cca9){return respondWithRpcPromise(_0xd425('0x28'),_['merge'](_0x22df81[_0xd425('0x17')],_0x22df81[_0xd425('0x19')]))[_0xd425('0xa')](respondWithResult(_0x29cca9,null))[_0xd425('0xf')](handleError(_0x29cca9,null));};exports['outbound']=function(_0x1d38fa,_0x3cf540){return respondWithRpcPromise('Outbound',_0x1d38fa['query'])['then'](respondWithResult(_0x3cf540,null))[_0xd425('0xf')](handleError(_0x3cf540,null));};exports[_0xd425('0x29')]=function(_0x1f30c1,_0x588688){return respondWithRpcPromise('OutboundChannels',_0x1f30c1['query'])[_0xd425('0xa')](respondWithResult(_0x588688,null))[_0xd425('0xf')](handleError(_0x588688,null));};exports[_0xd425('0x2a')]=function(_0x1d5017,_0xa9fd7c){var _0x14f3be;return respondWithRpcPromise(_0xd425('0x2b'),_0x1d5017['query'])[_0xd425('0xa')](function(_0x3c88a8){_0x14f3be=_0x3c88a8;return respondWithRpcPromise(_0xd425('0x2b'),_0x1d5017['query'],routingClient);})[_0xd425('0xa')](function(_0x2dffc7){return _[_0xd425('0x18')]({},_0x2dffc7,_0x14f3be);})['then'](respondWithResult(_0xa9fd7c,null))[_0xd425('0xf')](handleError(_0xa9fd7c,null));};exports[_0xd425('0x2c')]=function(_0x1c5ba6,_0x2d7a2f){if(_0x1c5ba6['body']&&_0x1c5ba6[_0xd425('0x2d')][_0xd425('0x2e')]&&_0x1c5ba6[_0xd425('0x2f')]&&_0x1c5ba6[_0xd425('0x2f')][_0xd425('0x13')]){for(var _0x2f6bf7 in _0x1c5ba6[_0xd425('0x2d')]['interaction']){if(_0x1c5ba6[_0xd425('0x2d')][_0xd425('0x2e')]['hasOwnProperty'](_0x2f6bf7)){db[_0xd425('0x30')]['findAll']({'where':{'channel':_0x2f6bf7,'membername':_0x1c5ba6['user'][_0xd425('0x13')],'type':'INTERACTION','exitAt':null,'uniqueid':_0x1c5ba6[_0xd425('0x2d')]['interaction'][_0x2f6bf7]&&_0x1c5ba6[_0xd425('0x2d')][_0xd425('0x2e')][_0x2f6bf7][_0xd425('0x31')]?{'$notIn':_0x1c5ba6[_0xd425('0x2d')][_0xd425('0x2e')][_0x2f6bf7]}:{'$ne':null}}})['then'](function(_0x2e4b21){var _0x5f3cfd=moment()[_0xd425('0x32')]('YYYY-MM-DD\x20HH:mm:ss');for(var _0x78ed9b=0x0,_0x16f61c=_0x2e4b21[_0xd425('0x31')];_0x78ed9b<_0x16f61c;_0x78ed9b+=0x1){_0x2e4b21[_0x78ed9b][_0xd425('0x33')]({'exitAt':_0x5f3cfd});}});for(var _0x624543=0x0;_0x624543<_0x1c5ba6['body'][_0xd425('0x2e')][_0x2f6bf7][_0xd425('0x31')];_0x624543+=0x1){db[_0xd425('0x30')][_0xd425('0x34')]({'where':{'channel':_0x2f6bf7,'membername':_0x1c5ba6[_0xd425('0x2f')]['name'],'type':_0xd425('0x35'),'uniqueid':_0x1c5ba6[_0xd425('0x2d')][_0xd425('0x2e')][_0x2f6bf7][_0x624543],'exitAt':null},'defaults':{'channel':_0x2f6bf7,'membername':_0x1c5ba6[_0xd425('0x2f')][_0xd425('0x13')],'interface':_[_0xd425('0x14')](_0x1c5ba6['user'][_0xd425('0x36')])?util[_0xd425('0x32')]('SIP/%s',_0x1c5ba6[_0xd425('0x2f')][_0xd425('0x13')]):_0x1c5ba6[_0xd425('0x2f')][_0xd425('0x36')],'type':'INTERACTION','enterAt':moment()[_0xd425('0x32')](_0xd425('0x37')),'role':_0xd425('0x38'),'internal':_0x1c5ba6[_0xd425('0x2f')][_0xd425('0x39')],'uniqueid':_0x1c5ba6['body']['interaction'][_0x2f6bf7][_0x624543]}});}}}}return respondWithRpcPromise(_0xd425('0x3a'),{'id':_0x1c5ba6['params']['id'],'capacity':_0x1c5ba6[_0xd425('0x2d')][_0xd425('0x3b')]},routingClient)['then'](respondWithResult(_0x2d7a2f,null))[_0xd425('0xf')](handleError(_0x2d7a2f,null));};exports['telephones']=function(_0x48d5b8,_0x39f588){return respondWithRpcPromise(_0xd425('0x3c'),_0x48d5b8[_0xd425('0x17')])[_0xd425('0xa')](respondWithResult(_0x39f588,null))[_0xd425('0xf')](handleError(_0x39f588,null));};exports[_0xd425('0x3d')]=function(_0xeb3586,_0x4118fe){return respondWithRpcPromise('Trunks',_0xeb3586[_0xd425('0x17')])[_0xd425('0xa')](respondWithResult(_0x4118fe,null))[_0xd425('0xf')](handleError(_0x4118fe,null));};exports[_0xd425('0x3e')]=function(_0x7b1080,_0x1c80c2){return respondWithRpcPromise(_0xd425('0x3f'),_0x7b1080[_0xd425('0x17')])['then'](respondWithResult(_0x1c80c2,null))['catch'](handleError(_0x1c80c2,null));};exports['chatQueues']=function(_0x145e76,_0x2c5d01){return respondWithRpcPromise(_0xd425('0x40'),_0x145e76[_0xd425('0x17')],routingClient)['then'](respondWithResult(_0x2c5d01,null))['catch'](handleError(_0x2c5d01,null));};exports['showChatQueues']=function(_0x5e1294,_0x254b8b){return respondWithRpcPromise(_0xd425('0x40'),_0x5e1294['query'],routingClient)[_0xd425('0xa')](findById(_0x5e1294[_0xd425('0x19')]['id']))[_0xd425('0xa')](respondWithResult(_0x254b8b,null))['catch'](handleError(_0x254b8b,null));};exports['mailQueues']=function(_0x599cb5,_0x49d75e){return respondWithRpcPromise('MailQueues',_0x599cb5['query'],routingClient)[_0xd425('0xa')](respondWithResult(_0x49d75e,null))[_0xd425('0xf')](handleError(_0x49d75e,null));};exports[_0xd425('0x41')]=function(_0x5b2323,_0x3395d8){return respondWithRpcPromise('MailQueues',_0x5b2323[_0xd425('0x17')],routingClient)[_0xd425('0xa')](findById(_0x5b2323[_0xd425('0x19')]['id']))[_0xd425('0xa')](respondWithResult(_0x3395d8,null))[_0xd425('0xf')](handleError(_0x3395d8,null));};exports[_0xd425('0x42')]=function(_0xa21f7c,_0x3ca6a6){return respondWithRpcPromise(_0xd425('0x43'),_0xa21f7c['query'],mailClient)[_0xd425('0xa')](respondWithResult(_0x3ca6a6,null))[_0xd425('0xf')](handleError(_0x3ca6a6,null));};exports[_0xd425('0x44')]=function(_0xf22906,_0x5c4df8){return respondWithRpcPromise('OpenchannelQueues',_0xf22906[_0xd425('0x17')],routingClient)[_0xd425('0xa')](respondWithResult(_0x5c4df8,null))[_0xd425('0xf')](handleError(_0x5c4df8,null));};exports[_0xd425('0x45')]=function(_0x464ed1,_0x2e0f00){return respondWithRpcPromise(_0xd425('0x46'),_0x464ed1[_0xd425('0x17')],routingClient)[_0xd425('0xa')](findById(_0x464ed1[_0xd425('0x19')]['id']))[_0xd425('0xa')](respondWithResult(_0x2e0f00,null))[_0xd425('0xf')](handleError(_0x2e0f00,null));};exports[_0xd425('0x47')]=function(_0x28979e,_0x5e72db){return respondWithRpcPromise(_0xd425('0x48'),_0x28979e[_0xd425('0x17')],routingClient)[_0xd425('0xa')](respondWithResult(_0x5e72db,null))['catch'](handleError(_0x5e72db,null));};exports['showSmsQueues']=function(_0x5ade1a,_0x403cb3){return respondWithRpcPromise(_0xd425('0x48'),_0x5ade1a[_0xd425('0x17')],routingClient)['then'](findById(_0x5ade1a[_0xd425('0x19')]['id']))['then'](respondWithResult(_0x403cb3,null))[_0xd425('0xf')](handleError(_0x403cb3,null));};exports[_0xd425('0x49')]=function(_0x21d26e,_0x5113fc){return respondWithRpcPromise(_0xd425('0x4a'),_0x21d26e[_0xd425('0x17')],routingClient)[_0xd425('0xa')](respondWithResult(_0x5113fc,null))[_0xd425('0xf')](handleError(_0x5113fc,null));};exports[_0xd425('0x4b')]=function(_0x43b1a9,_0x38a762){return respondWithRpcPromise(_0xd425('0x4a'),_0x43b1a9[_0xd425('0x17')],routingClient)[_0xd425('0xa')](findById(_0x43b1a9[_0xd425('0x19')]['id']))[_0xd425('0xa')](respondWithResult(_0x38a762,null))[_0xd425('0xf')](handleError(_0x38a762,null));};exports[_0xd425('0x4c')]=function(_0x445f98,_0x443126){return respondWithRpcPromise(_0xd425('0x4d'),_0x445f98[_0xd425('0x17')],routingClient)['then'](respondWithResult(_0x443126,null))['catch'](handleError(_0x443126,null));};exports[_0xd425('0x4e')]=function(_0x5c333a,_0x135048){return respondWithRpcPromise(_0xd425('0x4d'),_0x5c333a[_0xd425('0x17')],routingClient)[_0xd425('0xa')](findById(_0x5c333a['params']['id']))[_0xd425('0xa')](respondWithResult(_0x135048,null))[_0xd425('0xf')](handleError(_0x135048,null));};exports[_0xd425('0x4f')]=function(_0x689332,_0x2536bd){return respondWithRpcPromise(_0xd425('0x50'),_0x689332['query'])['then'](respondWithResult(_0x2536bd,null))[_0xd425('0xf')](handleError(_0x2536bd,null));};exports[_0xd425('0x51')]=function(_0x5e76f5,_0x174081){return respondWithRpcPromise('ChatQueuesWaitingInteractions',_0x5e76f5[_0xd425('0x17')],routingClient)[_0xd425('0xa')](respondWithResult(_0x174081,null))[_0xd425('0xf')](handleError(_0x174081,null));};exports[_0xd425('0x52')]=function(_0x376134,_0x2514fa){return respondWithRpcPromise(_0xd425('0x53'),_0x376134['query'],routingClient)[_0xd425('0xa')](respondWithResult(_0x2514fa,null))[_0xd425('0xf')](handleError(_0x2514fa,null));};exports[_0xd425('0x54')]=function(_0x233efa,_0xfcba08){return respondWithRpcPromise('OpenchannelQueuesWaitingInteractions',_0x233efa[_0xd425('0x17')],routingClient)[_0xd425('0xa')](respondWithResult(_0xfcba08,null))['catch'](handleError(_0xfcba08,null));};exports[_0xd425('0x55')]=function(_0x4599b0,_0x48bed3){return respondWithRpcPromise(_0xd425('0x56'),_0x4599b0[_0xd425('0x17')],routingClient)[_0xd425('0xa')](function(_0xd923bb){if(_0x4599b0[_0xd425('0x17')]['type']!==undefined){var _0x454cce=_(_0xd923bb['rows'])[_0xd425('0x57')]([_0x4599b0[_0xd425('0x17')]['type'],_0x4599b0[_0xd425('0x19')]['id']])[_0xd425('0x58')](_0xd425('0x59'))[_0xd425('0x5a')]()['value']();return _0xd923bb['rows'][_0xd425('0x57')](function(_0x2312c1){return _0x454cce[_0xd425('0x5b')](_0x2312c1['queue_id'])>-0x1;});}else{return _0xd923bb[_0xd425('0x15')][_0xd425('0x57')](function(_0x5b932c){return _0x5b932c[_0xd425('0x59')]===parseInt(_0x4599b0['params']['id']);});}})[_0xd425('0xa')](respondWithResult(_0x48bed3,null))[_0xd425('0xf')](handleError(_0x48bed3,null));};exports[_0xd425('0x5c')]=function(_0x2493e7,_0x5750dc){return respondWithRpcPromise('SmsQueuesWaitingInteractions',_0x2493e7[_0xd425('0x17')],routingClient)[_0xd425('0xa')](respondWithResult(_0x5750dc,null))['catch'](handleError(_0x5750dc,null));};exports[_0xd425('0x5d')]=function(_0x389099,_0x51c9ad){return respondWithRpcPromise(_0xd425('0x5e'),_0x389099[_0xd425('0x17')],routingClient)[_0xd425('0xa')](respondWithResult(_0x51c9ad,null))[_0xd425('0xf')](handleError(_0x51c9ad,null));};exports[_0xd425('0x5f')]=function(_0xf251e6,_0x302066){return respondWithRpcPromise('FaxQueuesWaitingInteractions',_0xf251e6['query'],routingClient)[_0xd425('0xa')](respondWithResult(_0x302066,null))['catch'](handleError(_0x302066,null));};exports[_0xd425('0x60')]=function(_0x236030){return function(_0x58cad5,_0x244789){var _0x1c1c77,_0x5dac05;var _0x592c40=_[_0xd425('0x61')](_0x236030);var _0x242ed8=_0x236030===_0xd425('0x62')?_0xd425('0x63'):_0xd425('0x64');return db[_0x592c40+_0xd425('0x65')][_0xd425('0x66')]({'raw':!![],'where':{'id':_0x58cad5[_0xd425('0x19')]['id']}})['then'](function(_0x2cff42){if(_[_0xd425('0x14')](_0x2cff42)){throw new Error(_0x592c40+'\x20Queue\x20not\x20found');}_0x1c1c77=_0x2cff42;return db[_0x592c40+_0xd425('0x67')][_0xd425('0x66')]({'where':{'id':_0x58cad5[_0xd425('0x2d')][_0xd425('0x68')]},'include':[{'model':db[_0x592c40+_0xd425('0x69')],'as':_0xd425('0x69')},{'model':db[_0x592c40+_0x242ed8],'as':_0xd425('0x64')}]});})[_0xd425('0xa')](function(_0x334062){if(_[_0xd425('0x14')](_0x334062)){throw new Error(_0x592c40+_0xd425('0x6a'));}_0x5dac05=_0x334062;return _0x334062['update']({'read':0x0,'readAt':null,'UserId':null});})[_0xd425('0xa')](function(){var _0x498e81={'uniqueid':_0x236030+'.'+_0x5dac05['id']+'.'+_0x5dac05['Interaction']['id'],'FromUserId':_0x58cad5[_0xd425('0x2f')]['id'],'type':'queue'};_0x498e81[_0x592c40+_0xd425('0x6b')]=_0x5dac05['id'];_0x498e81[_0x592c40+_0xd425('0x6c')]=_0x5dac05[_0xd425('0x69')]['id'];_0x498e81[_0xd425('0x6d')+_0x592c40+_0x242ed8+'Id']=_0x5dac05[_0xd425('0x64')]['id'];_0x498e81['To'+_0x592c40+_0xd425('0x6e')]=_0x1c1c77['id'];return db[_0x592c40+_0xd425('0x6f')]['create'](_0x498e81);})[_0xd425('0xa')](function(){return respondWithRpcPromise(_0xd425('0x70'),{'channel':_0x236030,'interaction':_0x5dac05[_0xd425('0x69')],'message':_0x5dac05,'account':_0x5dac05[_0xd425('0x64')],'applications':[{'id':0x0,'priority':0x1,'app':_0xd425('0x71'),'appdata':_0x1c1c77['name']+','+(_0x5dac05[_0xd425('0x64')][_0xd425('0x72')]||0x12c),'interval':_0xd425('0x73')}]},routingClient);})[_0xd425('0xa')](respondWithResult(_0x244789,null))[_0xd425('0xf')](handleError(_0x244789,null));};};exports[_0xd425('0x74')]=function(_0x409612,_0x4147eb){var _0x433e5d,_0x334226;if(_[_0xd425('0x14')](_0x409612[_0xd425('0x2d')]['channel'])){throw new Error(_0xd425('0x75'));}var _0x5d8a47=_0x409612[_0xd425('0x2d')][_0xd425('0x76')];var _0x1c03d6=_[_0xd425('0x61')](_0x5d8a47);var _0xf06395=_0x5d8a47==='chat'?_0xd425('0x63'):_0xd425('0x64');return db[_0xd425('0x77')][_0xd425('0x66')]({'raw':!![],'where':{'id':_0x409612[_0xd425('0x19')]['id'],'role':_0xd425('0x38')}})[_0xd425('0xa')](function(_0x568a83){if(_[_0xd425('0x14')](_0x568a83)){throw new Error('Agent\x20not\x20found');}_0x433e5d=_0x568a83;return db[_0x1c03d6+_0xd425('0x67')][_0xd425('0x66')]({'where':{'id':_0x409612['body'][_0xd425('0x68')]},'include':[{'model':db[_0x1c03d6+_0xd425('0x69')],'as':'Interaction'},{'model':db[_0x1c03d6+_0xf06395],'as':_0xd425('0x64')}]});})[_0xd425('0xa')](function(_0xca2955){if(_[_0xd425('0x14')](_0xca2955)){throw new Error(_0x1c03d6+_0xd425('0x6a'));}_0x334226=_0xca2955;return _0xca2955[_0xd425('0x78')]({'read':0x0,'readAt':null,'UserId':null});})['then'](function(){var _0x3f1a48={'uniqueid':_0x5d8a47+'.'+_0x334226['id']+'.'+_0x334226['Interaction']['id'],'FromUserId':_0x409612[_0xd425('0x2f')]['id'],'type':'queue','ToUserId':_0x433e5d['id']};_0x3f1a48[_0x1c03d6+_0xd425('0x6b')]=_0x334226['id'];_0x3f1a48[_0x1c03d6+_0xd425('0x6c')]=_0x334226[_0xd425('0x69')]['id'];_0x3f1a48[_0xd425('0x6d')+_0x1c03d6+_0xf06395+'Id']=_0x334226['Account']['id'];return db[_0x1c03d6+'TransferReport']['create'](_0x3f1a48);})['then'](function(){return respondWithRpcPromise(_0xd425('0x70'),{'channel':_0x5d8a47,'interaction':_0x334226['Interaction'],'message':_0x334226,'account':_0x334226[_0xd425('0x64')],'applications':[{'id':0x0,'priority':0x1,'app':_0xd425('0x38'),'appdata':_0x433e5d[_0xd425('0x13')]+','+(_0x334226[_0xd425('0x64')][_0xd425('0x79')]||0x12c),'interval':_0xd425('0x73')}]},routingClient);})['then'](respondWithResult(_0x4147eb,null))[_0xd425('0xf')](handleError(_0x4147eb,null));}; \ No newline at end of file +var _0x7fbe=['VoiceQueuesPreview','voiceQueuesChannels','voiceQueuesChannel','VoiceQueuesChannel','voiceQueuesChannelHangup','voiceQueuesChannelRedirect','VoiceQueuesChannelRedirect','outbound','Outbound','outboundChannels','OutboundChannels','Agents','agentCapacity','interaction','MemberReport','findAll','INTERACTION','length','format','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','findOrCreate','SIP/%s','user','interface','agent','internal','AgentCapacity','telephones','Telephones','trunks','Campaigns','ChatQueues','showChatQueues','mailQueues','MailQueues','showMailQueues','mailAccounts','MailAccounts','openchannelQueues','showOpenchannelQueues','OpenchannelQueues','smsQueues','showSmsQueues','SmsQueues','whatsappQueues','WhatsappQueues','showWhatsappQueues','faxQueues','showFaxQueues','FaxQueues','faxAccounts','FaxAccounts','ChatQueuesWaitingInteractions','MailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','openchannelQueuesIdWaitingInteractions','OpenchannelQueuesWaitingInteractions','type','rows','filter','map','queue_id','uniq','value','indexOf','SmsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','FaxQueuesWaitingInteractions','queueNotify','chat','Account','Queue','findOne','\x20Queue\x20not\x20found','Message','messageId','Interaction','\x20Message\x20not\x20found','update','queue','MessageId','InteractionId','QueueId','create','queueTransferTimeout','agentNotify','channel','Channel\x20field\x20is\x20mandatory','capitalize','Website','User','Agent\x20not\x20found','From','TransferReport','Start','agentTransferTimeout','*,*,*,*','lodash','util','../../mysqldb','../../config/logger','api','jayson/promise','client','http','request','error','code','message','result','catch','status','json','stack','name','send','isNil','find','voiceChannels','query','VoiceChannelMixMonitor','merge','params','then','voiceQueues','showVoiceQueues','VoiceQueues','UpdateVoiceQueue','body'];(function(_0x49f1b4,_0x4dbe76){var _0xf341d9=function(_0x1af0d6){while(--_0x1af0d6){_0x49f1b4['push'](_0x49f1b4['shift']());}};_0xf341d9(++_0x4dbe76);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0x4d3329,_0x53e55b){_0x4d3329=_0x4d3329-0x0;var _0x3abb35=_0x7fbe[_0x4d3329];return _0x3abb35;};'use strict';var BPromise=require('bluebird');var moment=require('moment');var _=require(_0xe7fb('0x0'));var util=require(_0xe7fb('0x1'));var db=require(_0xe7fb('0x2'))['db'];var logger=require(_0xe7fb('0x3'))(_0xe7fb('0x4'));var jayson=require(_0xe7fb('0x5'));var amiClient=jayson[_0xe7fb('0x6')][_0xe7fb('0x7')]({'port':0x232a});var mailClient=jayson[_0xe7fb('0x6')][_0xe7fb('0x7')]({'port':0x232b});var routingClient=jayson[_0xe7fb('0x6')][_0xe7fb('0x7')]({'port':0x232c});function respondWithRpcPromise(_0x24cd67,_0x1f943f,_0x5ad75b){return new BPromise(function(_0x213ebc,_0x228f6b){var _0x1d0741=_0x5ad75b?_0x5ad75b:amiClient;return _0x1d0741[_0xe7fb('0x8')](_0x24cd67,_0x1f943f)['then'](function(_0x558857){if(_0x558857[_0xe7fb('0x9')]){if(_0x558857[_0xe7fb('0x9')][_0xe7fb('0xa')]===0x1f4){return _0x228f6b(_0x558857[_0xe7fb('0x9')][_0xe7fb('0xb')]);}return _0x213ebc(_0x558857[_0xe7fb('0x9')][_0xe7fb('0xb')]);}else{_0x213ebc(_0x558857[_0xe7fb('0xc')]);}})[_0xe7fb('0xd')](function(_0x2fe8ab){_0x228f6b(_0x2fe8ab);});});}function respondWithResult(_0x2437d4,_0x188e1d){_0x188e1d=_0x188e1d||0xc8;return function(_0xdf9760){if(_0xdf9760){return _0x2437d4[_0xe7fb('0xe')](_0x188e1d)[_0xe7fb('0xf')](_0xdf9760);}return _0x2437d4['sendStatus'](0x194);};}function handleError(_0x278b75,_0x2225e5){_0x2225e5=_0x2225e5||0x1f4;return function(_0x5573ab){logger[_0xe7fb('0x9')](_0x5573ab[_0xe7fb('0x10')]);if(_0x5573ab['name']){delete _0x5573ab[_0xe7fb('0x11')];}_0x278b75['status'](_0x2225e5)[_0xe7fb('0x12')](_0x5573ab);};}function findById(_0x18d23c){return function(_0x12603d){if(!_[_0xe7fb('0x13')](_0x18d23c)&&!_['isNil'](_0x12603d)&&!_[_0xe7fb('0x13')](_0x12603d['rows'])){return _[_0xe7fb('0x14')](_0x12603d['rows'],function(_0x1e77fd){return _0x1e77fd['id']==_0x18d23c;});}return null;};}exports[_0xe7fb('0x15')]=function(_0x3f96a7,_0x182269){return respondWithRpcPromise('VoiceChannels',_0x3f96a7[_0xe7fb('0x16')])['then'](respondWithResult(_0x182269,null))[_0xe7fb('0xd')](handleError(_0x182269,null));};exports['voiceChannelMixMonitor']=function(_0x15f7a4,_0x4ea664){return respondWithRpcPromise(_0xe7fb('0x17'),_[_0xe7fb('0x18')](_0x15f7a4['query'],_0x15f7a4[_0xe7fb('0x19')]))[_0xe7fb('0x1a')](respondWithResult(_0x4ea664,null))[_0xe7fb('0xd')](handleError(_0x4ea664,null));};exports['voiceChannelStopMixMonitor']=function(_0x469d50,_0x469ead){return respondWithRpcPromise('VoiceChannelStopMixMonitor',_['merge'](_0x469d50['query'],_0x469d50[_0xe7fb('0x19')]))['then'](respondWithResult(_0x469ead,null))['catch'](handleError(_0x469ead,null));};exports[_0xe7fb('0x1b')]=function(_0x32e8b2,_0x2996ae){return respondWithRpcPromise('VoiceQueues',_0x32e8b2[_0xe7fb('0x16')])[_0xe7fb('0x1a')](respondWithResult(_0x2996ae,null))[_0xe7fb('0xd')](handleError(_0x2996ae,null));};exports[_0xe7fb('0x1c')]=function(_0x392d75,_0x16237a){return respondWithRpcPromise(_0xe7fb('0x1d'),_0x392d75['query'])['then'](findById(_0x392d75[_0xe7fb('0x19')]['id']))[_0xe7fb('0x1a')](respondWithResult(_0x16237a,null))[_0xe7fb('0xd')](handleError(_0x16237a,null));};exports['updateVoiceQueue']=function(_0xb1f2f4,_0x251807){return respondWithRpcPromise(_0xe7fb('0x1e'),_[_0xe7fb('0x18')](_0xb1f2f4[_0xe7fb('0x1f')],_0xb1f2f4[_0xe7fb('0x19')]))[_0xe7fb('0x1a')](respondWithResult(_0x251807,null))[_0xe7fb('0xd')](handleError(_0x251807,null));};exports['voiceQueuesPreview']=function(_0x3d1fb5,_0x1742f3){return respondWithRpcPromise(_0xe7fb('0x20'),_['merge'](_0x3d1fb5['query'],_0x3d1fb5[_0xe7fb('0x19')]))['then'](respondWithResult(_0x1742f3,null))[_0xe7fb('0xd')](handleError(_0x1742f3,null));};exports[_0xe7fb('0x21')]=function(_0xe49053,_0x2a4745){return respondWithRpcPromise('VoiceQueuesChannels',_0xe49053[_0xe7fb('0x16')])[_0xe7fb('0x1a')](respondWithResult(_0x2a4745,null))[_0xe7fb('0xd')](handleError(_0x2a4745,null));};exports[_0xe7fb('0x22')]=function(_0x2d650d,_0x480819){return respondWithRpcPromise(_0xe7fb('0x23'),_[_0xe7fb('0x18')](_0x2d650d[_0xe7fb('0x16')],_0x2d650d[_0xe7fb('0x19')]))[_0xe7fb('0x1a')](respondWithResult(_0x480819,null))[_0xe7fb('0xd')](handleError(_0x480819,null));};exports[_0xe7fb('0x24')]=function(_0x147eb1,_0x389903){return respondWithRpcPromise('VoiceQueuesChannelHangup',_[_0xe7fb('0x18')](_0x147eb1[_0xe7fb('0x16')],_0x147eb1[_0xe7fb('0x19')]))['then'](respondWithResult(_0x389903,null))[_0xe7fb('0xd')](handleError(_0x389903,null));};exports[_0xe7fb('0x25')]=function(_0x4218bc,_0x1530b1){return respondWithRpcPromise(_0xe7fb('0x26'),_[_0xe7fb('0x18')](_0x4218bc[_0xe7fb('0x16')],_0x4218bc[_0xe7fb('0x19')]))[_0xe7fb('0x1a')](respondWithResult(_0x1530b1,null))[_0xe7fb('0xd')](handleError(_0x1530b1,null));};exports[_0xe7fb('0x27')]=function(_0x3c4f4b,_0x1544f2){return respondWithRpcPromise(_0xe7fb('0x28'),_0x3c4f4b[_0xe7fb('0x16')])[_0xe7fb('0x1a')](respondWithResult(_0x1544f2,null))[_0xe7fb('0xd')](handleError(_0x1544f2,null));};exports[_0xe7fb('0x29')]=function(_0x21e35c,_0x4d6fe6){return respondWithRpcPromise(_0xe7fb('0x2a'),_0x21e35c[_0xe7fb('0x16')])[_0xe7fb('0x1a')](respondWithResult(_0x4d6fe6,null))[_0xe7fb('0xd')](handleError(_0x4d6fe6,null));};exports['agents']=function(_0x3426a9,_0x186418){var _0xd472d;return respondWithRpcPromise(_0xe7fb('0x2b'),_0x3426a9['query'])[_0xe7fb('0x1a')](function(_0x451a6c){_0xd472d=_0x451a6c;return respondWithRpcPromise(_0xe7fb('0x2b'),_0x3426a9[_0xe7fb('0x16')],routingClient);})[_0xe7fb('0x1a')](function(_0xb729fc){return _['merge']({},_0xb729fc,_0xd472d);})[_0xe7fb('0x1a')](respondWithResult(_0x186418,null))[_0xe7fb('0xd')](handleError(_0x186418,null));};exports[_0xe7fb('0x2c')]=function(_0x4b263d,_0x36a341){if(_0x4b263d[_0xe7fb('0x1f')]&&_0x4b263d['body']['interaction']&&_0x4b263d['user']&&_0x4b263d['user']['name']){for(var _0x900d67 in _0x4b263d[_0xe7fb('0x1f')][_0xe7fb('0x2d')]){if(_0x4b263d['body'][_0xe7fb('0x2d')]['hasOwnProperty'](_0x900d67)){db[_0xe7fb('0x2e')][_0xe7fb('0x2f')]({'where':{'channel':_0x900d67,'membername':_0x4b263d['user'][_0xe7fb('0x11')],'type':_0xe7fb('0x30'),'exitAt':null,'uniqueid':_0x4b263d[_0xe7fb('0x1f')][_0xe7fb('0x2d')][_0x900d67]&&_0x4b263d['body'][_0xe7fb('0x2d')][_0x900d67][_0xe7fb('0x31')]?{'$notIn':_0x4b263d[_0xe7fb('0x1f')]['interaction'][_0x900d67]}:{'$ne':null}}})[_0xe7fb('0x1a')](function(_0x6eb1ab){var _0x13b17f=moment()[_0xe7fb('0x32')](_0xe7fb('0x33'));for(var _0x5a1ce1=0x0,_0x2eb999=_0x6eb1ab['length'];_0x5a1ce1<_0x2eb999;_0x5a1ce1+=0x1){_0x6eb1ab[_0x5a1ce1][_0xe7fb('0x34')]({'exitAt':_0x13b17f});}});for(var _0x468c62=0x0;_0x468c62<_0x4b263d[_0xe7fb('0x1f')][_0xe7fb('0x2d')][_0x900d67][_0xe7fb('0x31')];_0x468c62+=0x1){db['MemberReport'][_0xe7fb('0x35')]({'where':{'channel':_0x900d67,'membername':_0x4b263d['user']['name'],'type':_0xe7fb('0x30'),'uniqueid':_0x4b263d[_0xe7fb('0x1f')][_0xe7fb('0x2d')][_0x900d67][_0x468c62],'exitAt':null},'defaults':{'channel':_0x900d67,'membername':_0x4b263d['user'][_0xe7fb('0x11')],'interface':_[_0xe7fb('0x13')](_0x4b263d['user']['interface'])?util[_0xe7fb('0x32')](_0xe7fb('0x36'),_0x4b263d[_0xe7fb('0x37')][_0xe7fb('0x11')]):_0x4b263d[_0xe7fb('0x37')][_0xe7fb('0x38')],'type':_0xe7fb('0x30'),'enterAt':moment()[_0xe7fb('0x32')]('YYYY-MM-DD\x20HH:mm:ss'),'role':_0xe7fb('0x39'),'internal':_0x4b263d['user'][_0xe7fb('0x3a')],'uniqueid':_0x4b263d[_0xe7fb('0x1f')]['interaction'][_0x900d67][_0x468c62]}});}}}}return respondWithRpcPromise(_0xe7fb('0x3b'),{'id':_0x4b263d['params']['id'],'capacity':_0x4b263d[_0xe7fb('0x1f')]['capacity']},routingClient)[_0xe7fb('0x1a')](respondWithResult(_0x36a341,null))['catch'](handleError(_0x36a341,null));};exports[_0xe7fb('0x3c')]=function(_0x59158c,_0x1fff6c){return respondWithRpcPromise(_0xe7fb('0x3d'),_0x59158c[_0xe7fb('0x16')])[_0xe7fb('0x1a')](respondWithResult(_0x1fff6c,null))[_0xe7fb('0xd')](handleError(_0x1fff6c,null));};exports[_0xe7fb('0x3e')]=function(_0x2f4760,_0x582a4a){return respondWithRpcPromise('Trunks',_0x2f4760[_0xe7fb('0x16')])['then'](respondWithResult(_0x582a4a,null))['catch'](handleError(_0x582a4a,null));};exports['campaigns']=function(_0x50b8df,_0x539252){return respondWithRpcPromise(_0xe7fb('0x3f'),_0x50b8df[_0xe7fb('0x16')])[_0xe7fb('0x1a')](respondWithResult(_0x539252,null))[_0xe7fb('0xd')](handleError(_0x539252,null));};exports['chatQueues']=function(_0x37af37,_0x236b35){return respondWithRpcPromise(_0xe7fb('0x40'),_0x37af37['query'],routingClient)['then'](respondWithResult(_0x236b35,null))[_0xe7fb('0xd')](handleError(_0x236b35,null));};exports[_0xe7fb('0x41')]=function(_0x300b8e,_0x4f4ba3){return respondWithRpcPromise(_0xe7fb('0x40'),_0x300b8e[_0xe7fb('0x16')],routingClient)[_0xe7fb('0x1a')](findById(_0x300b8e[_0xe7fb('0x19')]['id']))['then'](respondWithResult(_0x4f4ba3,null))['catch'](handleError(_0x4f4ba3,null));};exports[_0xe7fb('0x42')]=function(_0x3104c2,_0x1f16b2){return respondWithRpcPromise(_0xe7fb('0x43'),_0x3104c2[_0xe7fb('0x16')],routingClient)['then'](respondWithResult(_0x1f16b2,null))[_0xe7fb('0xd')](handleError(_0x1f16b2,null));};exports[_0xe7fb('0x44')]=function(_0x23755b,_0x590d7a){return respondWithRpcPromise('MailQueues',_0x23755b[_0xe7fb('0x16')],routingClient)[_0xe7fb('0x1a')](findById(_0x23755b[_0xe7fb('0x19')]['id']))[_0xe7fb('0x1a')](respondWithResult(_0x590d7a,null))[_0xe7fb('0xd')](handleError(_0x590d7a,null));};exports[_0xe7fb('0x45')]=function(_0x585b7c,_0x1e21e4){return respondWithRpcPromise(_0xe7fb('0x46'),_0x585b7c[_0xe7fb('0x16')],mailClient)[_0xe7fb('0x1a')](respondWithResult(_0x1e21e4,null))[_0xe7fb('0xd')](handleError(_0x1e21e4,null));};exports[_0xe7fb('0x47')]=function(_0x554092,_0x2e457c){return respondWithRpcPromise('OpenchannelQueues',_0x554092[_0xe7fb('0x16')],routingClient)[_0xe7fb('0x1a')](respondWithResult(_0x2e457c,null))[_0xe7fb('0xd')](handleError(_0x2e457c,null));};exports[_0xe7fb('0x48')]=function(_0x5925e6,_0x47ac92){return respondWithRpcPromise(_0xe7fb('0x49'),_0x5925e6[_0xe7fb('0x16')],routingClient)[_0xe7fb('0x1a')](findById(_0x5925e6[_0xe7fb('0x19')]['id']))[_0xe7fb('0x1a')](respondWithResult(_0x47ac92,null))['catch'](handleError(_0x47ac92,null));};exports[_0xe7fb('0x4a')]=function(_0x58d4ec,_0x127b0e){return respondWithRpcPromise('SmsQueues',_0x58d4ec['query'],routingClient)[_0xe7fb('0x1a')](respondWithResult(_0x127b0e,null))[_0xe7fb('0xd')](handleError(_0x127b0e,null));};exports[_0xe7fb('0x4b')]=function(_0x5da884,_0x475716){return respondWithRpcPromise(_0xe7fb('0x4c'),_0x5da884[_0xe7fb('0x16')],routingClient)[_0xe7fb('0x1a')](findById(_0x5da884[_0xe7fb('0x19')]['id']))['then'](respondWithResult(_0x475716,null))[_0xe7fb('0xd')](handleError(_0x475716,null));};exports[_0xe7fb('0x4d')]=function(_0x5151ec,_0x4136ae){return respondWithRpcPromise(_0xe7fb('0x4e'),_0x5151ec['query'],routingClient)[_0xe7fb('0x1a')](respondWithResult(_0x4136ae,null))['catch'](handleError(_0x4136ae,null));};exports[_0xe7fb('0x4f')]=function(_0x1dc9c1,_0xa93f35){return respondWithRpcPromise('WhatsappQueues',_0x1dc9c1[_0xe7fb('0x16')],routingClient)[_0xe7fb('0x1a')](findById(_0x1dc9c1[_0xe7fb('0x19')]['id']))[_0xe7fb('0x1a')](respondWithResult(_0xa93f35,null))[_0xe7fb('0xd')](handleError(_0xa93f35,null));};exports[_0xe7fb('0x50')]=function(_0xcdc72e,_0x187040){return respondWithRpcPromise('FaxQueues',_0xcdc72e['query'],routingClient)[_0xe7fb('0x1a')](respondWithResult(_0x187040,null))[_0xe7fb('0xd')](handleError(_0x187040,null));};exports[_0xe7fb('0x51')]=function(_0x50c705,_0x519c5f){return respondWithRpcPromise(_0xe7fb('0x52'),_0x50c705[_0xe7fb('0x16')],routingClient)[_0xe7fb('0x1a')](findById(_0x50c705[_0xe7fb('0x19')]['id']))[_0xe7fb('0x1a')](respondWithResult(_0x519c5f,null))[_0xe7fb('0xd')](handleError(_0x519c5f,null));};exports[_0xe7fb('0x53')]=function(_0x3f11f1,_0xb06693){return respondWithRpcPromise(_0xe7fb('0x54'),_0x3f11f1[_0xe7fb('0x16')])[_0xe7fb('0x1a')](respondWithResult(_0xb06693,null))[_0xe7fb('0xd')](handleError(_0xb06693,null));};exports['chatQueuesWaitingInteractions']=function(_0x4fa142,_0x125427){return respondWithRpcPromise(_0xe7fb('0x55'),_0x4fa142[_0xe7fb('0x16')],routingClient)[_0xe7fb('0x1a')](respondWithResult(_0x125427,null))[_0xe7fb('0xd')](handleError(_0x125427,null));};exports['mailQueuesWaitingInteractions']=function(_0x43f14b,_0x1beb13){return respondWithRpcPromise(_0xe7fb('0x56'),_0x43f14b[_0xe7fb('0x16')],routingClient)[_0xe7fb('0x1a')](respondWithResult(_0x1beb13,null))[_0xe7fb('0xd')](handleError(_0x1beb13,null));};exports[_0xe7fb('0x57')]=function(_0x1e6256,_0xa7fa61){return respondWithRpcPromise('OpenchannelQueuesWaitingInteractions',_0x1e6256[_0xe7fb('0x16')],routingClient)['then'](respondWithResult(_0xa7fa61,null))[_0xe7fb('0xd')](handleError(_0xa7fa61,null));};exports[_0xe7fb('0x58')]=function(_0x2a2079,_0x31c159){return respondWithRpcPromise(_0xe7fb('0x59'),_0x2a2079['query'],routingClient)[_0xe7fb('0x1a')](function(_0x38e66a){if(_0x2a2079[_0xe7fb('0x16')][_0xe7fb('0x5a')]!==undefined){var _0x15d881=_(_0x38e66a[_0xe7fb('0x5b')])[_0xe7fb('0x5c')]([_0x2a2079[_0xe7fb('0x16')][_0xe7fb('0x5a')],_0x2a2079[_0xe7fb('0x19')]['id']])[_0xe7fb('0x5d')](_0xe7fb('0x5e'))[_0xe7fb('0x5f')]()[_0xe7fb('0x60')]();return _0x38e66a['rows']['filter'](function(_0x48a015){return _0x15d881[_0xe7fb('0x61')](_0x48a015[_0xe7fb('0x5e')])>-0x1;});}else{return _0x38e66a[_0xe7fb('0x5b')][_0xe7fb('0x5c')](function(_0x535e8b){return _0x535e8b[_0xe7fb('0x5e')]===parseInt(_0x2a2079[_0xe7fb('0x19')]['id']);});}})[_0xe7fb('0x1a')](respondWithResult(_0x31c159,null))[_0xe7fb('0xd')](handleError(_0x31c159,null));};exports['smsQueuesWaitingInteractions']=function(_0x2f7fa6,_0x5650c6){return respondWithRpcPromise(_0xe7fb('0x62'),_0x2f7fa6[_0xe7fb('0x16')],routingClient)[_0xe7fb('0x1a')](respondWithResult(_0x5650c6,null))[_0xe7fb('0xd')](handleError(_0x5650c6,null));};exports[_0xe7fb('0x63')]=function(_0x4ab541,_0x3ffd6c){return respondWithRpcPromise('WhatsappQueuesWaitingInteractions',_0x4ab541[_0xe7fb('0x16')],routingClient)['then'](respondWithResult(_0x3ffd6c,null))[_0xe7fb('0xd')](handleError(_0x3ffd6c,null));};exports[_0xe7fb('0x64')]=function(_0x4c37cd,_0x2b6d69){return respondWithRpcPromise(_0xe7fb('0x65'),_0x4c37cd[_0xe7fb('0x16')],routingClient)[_0xe7fb('0x1a')](respondWithResult(_0x2b6d69,null))['catch'](handleError(_0x2b6d69,null));};exports[_0xe7fb('0x66')]=function(_0x277335){return function(_0x1412e2,_0x4d0eed){var _0x11d5b6,_0x4b2cc4;var _0x5b1e28=_['capitalize'](_0x277335);var _0x3c99e7=_0x277335===_0xe7fb('0x67')?'Website':_0xe7fb('0x68');return db[_0x5b1e28+_0xe7fb('0x69')][_0xe7fb('0x6a')]({'raw':!![],'where':{'id':_0x1412e2[_0xe7fb('0x19')]['id']}})[_0xe7fb('0x1a')](function(_0x1cc21d){if(_[_0xe7fb('0x13')](_0x1cc21d)){throw new Error(_0x5b1e28+_0xe7fb('0x6b'));}_0x11d5b6=_0x1cc21d;return db[_0x5b1e28+_0xe7fb('0x6c')][_0xe7fb('0x6a')]({'where':{'id':_0x1412e2[_0xe7fb('0x1f')][_0xe7fb('0x6d')]},'include':[{'model':db[_0x5b1e28+_0xe7fb('0x6e')],'as':_0xe7fb('0x6e')},{'model':db[_0x5b1e28+_0x3c99e7],'as':_0xe7fb('0x68')}]});})[_0xe7fb('0x1a')](function(_0x3c5bd9){if(_[_0xe7fb('0x13')](_0x3c5bd9)){throw new Error(_0x5b1e28+_0xe7fb('0x6f'));}_0x4b2cc4=_0x3c5bd9;return _0x3c5bd9[_0xe7fb('0x70')]({'read':0x0,'readAt':null,'UserId':null});})['then'](function(){var _0x47568c={'uniqueid':_0x277335+'.'+_0x4b2cc4['id']+'.'+_0x4b2cc4[_0xe7fb('0x6e')]['id'],'FromUserId':_0x1412e2[_0xe7fb('0x37')]['id'],'type':_0xe7fb('0x71')};_0x47568c[_0x5b1e28+_0xe7fb('0x72')]=_0x4b2cc4['id'];_0x47568c[_0x5b1e28+_0xe7fb('0x73')]=_0x4b2cc4[_0xe7fb('0x6e')]['id'];_0x47568c['From'+_0x5b1e28+_0x3c99e7+'Id']=_0x4b2cc4['Account']['id'];_0x47568c['To'+_0x5b1e28+_0xe7fb('0x74')]=_0x11d5b6['id'];return db[_0x5b1e28+'TransferReport'][_0xe7fb('0x75')](_0x47568c);})[_0xe7fb('0x1a')](function(){return respondWithRpcPromise('Start',{'channel':_0x277335,'interaction':_0x4b2cc4[_0xe7fb('0x6e')],'message':_0x4b2cc4,'account':_0x4b2cc4[_0xe7fb('0x68')],'applications':[{'id':0x0,'priority':0x1,'app':_0xe7fb('0x71'),'appdata':_0x11d5b6[_0xe7fb('0x11')]+','+(_0x4b2cc4[_0xe7fb('0x68')][_0xe7fb('0x76')]||0x12c),'interval':'*,*,*,*'}]},routingClient);})[_0xe7fb('0x1a')](respondWithResult(_0x4d0eed,null))[_0xe7fb('0xd')](handleError(_0x4d0eed,null));};};exports[_0xe7fb('0x77')]=function(_0xae9441,_0x276c28){var _0xd5a417,_0x48de0c;if(_['isNil'](_0xae9441['body'][_0xe7fb('0x78')])){throw new Error(_0xe7fb('0x79'));}var _0x2b0600=_0xae9441['body'][_0xe7fb('0x78')];var _0x57ee3b=_[_0xe7fb('0x7a')](_0x2b0600);var _0x278a6c=_0x2b0600===_0xe7fb('0x67')?_0xe7fb('0x7b'):'Account';return db[_0xe7fb('0x7c')][_0xe7fb('0x6a')]({'raw':!![],'where':{'id':_0xae9441[_0xe7fb('0x19')]['id'],'role':_0xe7fb('0x39')}})[_0xe7fb('0x1a')](function(_0x33262f){if(_[_0xe7fb('0x13')](_0x33262f)){throw new Error(_0xe7fb('0x7d'));}_0xd5a417=_0x33262f;return db[_0x57ee3b+'Message']['findOne']({'where':{'id':_0xae9441[_0xe7fb('0x1f')]['messageId']},'include':[{'model':db[_0x57ee3b+_0xe7fb('0x6e')],'as':_0xe7fb('0x6e')},{'model':db[_0x57ee3b+_0x278a6c],'as':_0xe7fb('0x68')}]});})[_0xe7fb('0x1a')](function(_0x58352d){if(_['isNil'](_0x58352d)){throw new Error(_0x57ee3b+_0xe7fb('0x6f'));}_0x48de0c=_0x58352d;return _0x58352d[_0xe7fb('0x70')]({'read':0x0,'readAt':null,'UserId':null});})['then'](function(){var _0x21cb12={'uniqueid':_0x2b0600+'.'+_0x48de0c['id']+'.'+_0x48de0c[_0xe7fb('0x6e')]['id'],'FromUserId':_0xae9441[_0xe7fb('0x37')]['id'],'type':_0xe7fb('0x71'),'ToUserId':_0xd5a417['id']};_0x21cb12[_0x57ee3b+_0xe7fb('0x72')]=_0x48de0c['id'];_0x21cb12[_0x57ee3b+_0xe7fb('0x73')]=_0x48de0c['Interaction']['id'];_0x21cb12[_0xe7fb('0x7e')+_0x57ee3b+_0x278a6c+'Id']=_0x48de0c[_0xe7fb('0x68')]['id'];return db[_0x57ee3b+_0xe7fb('0x7f')][_0xe7fb('0x75')](_0x21cb12);})[_0xe7fb('0x1a')](function(){return respondWithRpcPromise(_0xe7fb('0x80'),{'channel':_0x2b0600,'interaction':_0x48de0c[_0xe7fb('0x6e')],'message':_0x48de0c,'account':_0x48de0c[_0xe7fb('0x68')],'applications':[{'id':0x0,'priority':0x1,'app':_0xe7fb('0x39'),'appdata':_0xd5a417[_0xe7fb('0x11')]+','+(_0x48de0c[_0xe7fb('0x68')][_0xe7fb('0x81')]||0x12c),'interval':_0xe7fb('0x82')}]},routingClient);})[_0xe7fb('0x1a')](respondWithResult(_0x276c28,null))[_0xe7fb('0xd')](handleError(_0x276c28,null));}; \ No newline at end of file diff --git a/server/api/schedule/index.js b/server/api/schedule/index.js index 3e4c65c..198299c 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 _0x3df6=['multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./schedule.controller','get','isAuthenticated','index','show','/:id/run','run','create','put','/:id','update','delete','exports'];(function(_0x590a38,_0x2bc65c){var _0xf36626=function(_0x551cd1){while(--_0x551cd1){_0x590a38['push'](_0x590a38['shift']());}};_0xf36626(++_0x2bc65c);}(_0x3df6,0x176));var _0x63df=function(_0x3fb6b9,_0xb7995d){_0x3fb6b9=_0x3fb6b9-0x0;var _0x1bd394=_0x3df6[_0x3fb6b9];return _0x1bd394;};'use strict';var multer=require(_0x63df('0x0'));var util=require('util');var path=require(_0x63df('0x1'));var timeout=require(_0x63df('0x2'));var express=require(_0x63df('0x3'));var router=express[_0x63df('0x4')]();var fs_extra=require(_0x63df('0x5'));var auth=require(_0x63df('0x6'));var interaction=require(_0x63df('0x7'));var config=require(_0x63df('0x8'));var controller=require(_0x63df('0x9'));router[_0x63df('0xa')]('/',auth[_0x63df('0xb')](),controller[_0x63df('0xc')]);router[_0x63df('0xa')]('/:id',auth[_0x63df('0xb')](),controller[_0x63df('0xd')]);router[_0x63df('0xa')](_0x63df('0xe'),auth[_0x63df('0xb')](),controller[_0x63df('0xf')]);router['post']('/',auth['isAuthenticated'](),controller[_0x63df('0x10')]);router[_0x63df('0x11')](_0x63df('0x12'),auth[_0x63df('0xb')](),controller[_0x63df('0x13')]);router[_0x63df('0x14')](_0x63df('0x12'),auth[_0x63df('0xb')](),controller['destroy']);module[_0x63df('0x15')]=router; \ No newline at end of file +var _0x0457=['fs-extra','../../components/auth/service','../../components/interaction/service','get','index','/:id','show','/:id/run','isAuthenticated','run','post','create','delete','destroy','multer','path','connect-timeout'];(function(_0x310a1b,_0x4c9129){var _0xdea206=function(_0x1f1e8d){while(--_0x1f1e8d){_0x310a1b['push'](_0x310a1b['shift']());}};_0xdea206(++_0x4c9129);}(_0x0457,0x195));var _0x7045=function(_0x4ed32d,_0x327695){_0x4ed32d=_0x4ed32d-0x0;var _0xf624df=_0x0457[_0x4ed32d];return _0xf624df;};'use strict';var multer=require(_0x7045('0x0'));var util=require('util');var path=require(_0x7045('0x1'));var timeout=require(_0x7045('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x7045('0x3'));var auth=require(_0x7045('0x4'));var interaction=require(_0x7045('0x5'));var config=require('../../config/environment');var controller=require('./schedule.controller');router[_0x7045('0x6')]('/',auth['isAuthenticated'](),controller[_0x7045('0x7')]);router['get'](_0x7045('0x8'),auth['isAuthenticated'](),controller[_0x7045('0x9')]);router[_0x7045('0x6')](_0x7045('0xa'),auth[_0x7045('0xb')](),controller[_0x7045('0xc')]);router[_0x7045('0xd')]('/',auth[_0x7045('0xb')](),controller[_0x7045('0xe')]);router['put'](_0x7045('0x8'),auth[_0x7045('0xb')](),controller['update']);router[_0x7045('0xf')](_0x7045('0x8'),auth[_0x7045('0xb')](),controller[_0x7045('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/schedule/schedule.attributes.js b/server/api/schedule/schedule.attributes.js index 04953be..d6a8af0 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 _0x396d=['BOOLEAN','0\x200\x20*\x20*\x20*','DATE','INTEGER','ENUM','years','quarters','months','days','minutes','xlsx','csv','custom','default','TEXT','sequelize','exports','STRING'];(function(_0x1a5a4e,_0x456230){var _0xf27d0f=function(_0x3f46a6){while(--_0x3f46a6){_0x1a5a4e['push'](_0x1a5a4e['shift']());}};_0xf27d0f(++_0x456230);}(_0x396d,0x10b));var _0xd396=function(_0x59b710,_0x52fc1e){_0x59b710=_0x59b710-0x0;var _0x28ffd7=_0x396d[_0x59b710];return _0x28ffd7;};'use strict';var Sequelize=require(_0xd396('0x0'));module[_0xd396('0x1')]={'name':{'type':Sequelize[_0xd396('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xd396('0x2')]},'active':{'type':Sequelize[_0xd396('0x3')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0xd396('0x2')],'allowNull':![],'defaultValue':_0xd396('0x4')},'startAt':{'type':Sequelize['DATE'],'allowNull':![]},'endAt':{'type':Sequelize[_0xd396('0x5')],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0xd396('0x6')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0xd396('0x7')](_0xd396('0x8'),_0xd396('0x9'),_0xd396('0xa'),'weeks',_0xd396('0xb'),'hours',_0xd396('0xc')),'allowNull':![],'defaultValue':_0xd396('0xb')},'output':{'type':Sequelize[_0xd396('0x7')]('csv','pdf',_0xd396('0xd')),'allowNull':![],'defaultValue':_0xd396('0xe')},'type':{'type':Sequelize[_0xd396('0x7')](_0xd396('0xf'),_0xd396('0x10')),'allowNull':![],'defaultValue':'custom'},'sendMail':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'email':{'type':Sequelize[_0xd396('0x2')]},'cc':{'type':Sequelize[_0xd396('0x11')]},'bcc':{'type':Sequelize[_0xd396('0x11')]},'sendIfEmpty':{'type':Sequelize[_0xd396('0x3')],'defaultValue':!![]}}; \ No newline at end of file +var _0xfc79=['years','months','weeks','hours','minutes','days','csv','pdf','xlsx','default','custom','TEXT','STRING','BOOLEAN','0\x200\x20*\x20*\x20*','DATE','INTEGER','ENUM'];(function(_0x48c7fe,_0xf9fd9d){var _0x11b768=function(_0x7cf575){while(--_0x7cf575){_0x48c7fe['push'](_0x48c7fe['shift']());}};_0x11b768(++_0xf9fd9d);}(_0xfc79,0x150));var _0x9fc7=function(_0x43811d,_0x4243d3){_0x43811d=_0x43811d-0x0;var _0x31b6e5=_0xfc79[_0x43811d];return _0x31b6e5;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x9fc7('0x0')],'allowNull':![]},'description':{'type':Sequelize[_0x9fc7('0x0')]},'active':{'type':Sequelize[_0x9fc7('0x1')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0x9fc7('0x0')],'allowNull':![],'defaultValue':_0x9fc7('0x2')},'startAt':{'type':Sequelize[_0x9fc7('0x3')],'allowNull':![]},'endAt':{'type':Sequelize[_0x9fc7('0x3')],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0x9fc7('0x4')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0x9fc7('0x5')](_0x9fc7('0x6'),'quarters',_0x9fc7('0x7'),_0x9fc7('0x8'),'days',_0x9fc7('0x9'),_0x9fc7('0xa')),'allowNull':![],'defaultValue':_0x9fc7('0xb')},'output':{'type':Sequelize[_0x9fc7('0x5')](_0x9fc7('0xc'),_0x9fc7('0xd'),_0x9fc7('0xe')),'allowNull':![],'defaultValue':_0x9fc7('0xc')},'type':{'type':Sequelize[_0x9fc7('0x5')]('custom',_0x9fc7('0xf')),'allowNull':![],'defaultValue':_0x9fc7('0x10')},'sendMail':{'type':Sequelize[_0x9fc7('0x1')],'defaultValue':![]},'email':{'type':Sequelize[_0x9fc7('0x0')]},'cc':{'type':Sequelize['TEXT']},'bcc':{'type':Sequelize[_0x9fc7('0x11')]},'sendIfEmpty':{'type':Sequelize[_0x9fc7('0x1')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/schedule/schedule.controller.js b/server/api/schedule/schedule.controller.js index 9d77727..07963f5 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 _0xe15c=['include','rows','catch','show','params','length','options','find','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','run','../../config/schedule','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','status','end','offset','undefined','limit','set','Content-Range','apply','reject','save','update','destroy','then','Scheduler','sendStatus','error','stack','index','map','Schedule','rawAttributes','type','key','model','name','query','keys','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','count','includeAll'];(function(_0x344f68,_0x2eedff){var _0x2a1094=function(_0x2403a9){while(--_0x2403a9){_0x344f68['push'](_0x344f68['shift']());}};_0x2a1094(++_0x2eedff);}(_0xe15c,0x1c7));var _0xce15=function(_0x431e8f,_0x41ef1c){_0x431e8f=_0x431e8f-0x0;var _0x4f738a=_0xe15c[_0x431e8f];return _0x4f738a;};'use strict';var emlformat=require(_0xce15('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xce15('0x1'));var jsonpatch=require(_0xce15('0x2'));var rp=require(_0xce15('0x3'));var moment=require(_0xce15('0x4'));var BPromise=require(_0xce15('0x5'));var Mustache=require(_0xce15('0x6'));var util=require(_0xce15('0x7'));var path=require(_0xce15('0x8'));var sox=require(_0xce15('0x9'));var csv=require(_0xce15('0xa'));var ejs=require(_0xce15('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xce15('0xc'));var squel=require(_0xce15('0xd'));var crypto=require(_0xce15('0xe'));var jsforce=require(_0xce15('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xce15('0xa'));var querystring=require(_0xce15('0x10'));var Papa=require(_0xce15('0x11'));var Redis=require(_0xce15('0x12'));var authService=require(_0xce15('0x13'));var qs=require(_0xce15('0x14'));var as=require(_0xce15('0x15'));var hardwareService=require(_0xce15('0x16'));var logger=require(_0xce15('0x17'))('api');var utils=require('../../config/utils');var config=require(_0xce15('0x18'));var licenseUtil=require(_0xce15('0x19'));var db=require(_0xce15('0x1a'))['db'];function respondWithStatusCode(_0x3850da,_0x5f431c){_0x5f431c=_0x5f431c||0xcc;return function(_0x464e26){if(_0x464e26){return _0x3850da['sendStatus'](_0x5f431c);}return _0x3850da[_0xce15('0x1b')](_0x5f431c)[_0xce15('0x1c')]();};}function respondWithResult(_0x4bd566,_0x5e6cb2){_0x5e6cb2=_0x5e6cb2||0xc8;return function(_0x4e0485){if(_0x4e0485){return _0x4bd566[_0xce15('0x1b')](_0x5e6cb2)['json'](_0x4e0485);}};}function respondWithFilteredResult(_0x300aa4,_0x28bb66){return function(_0xb46dcd){if(_0xb46dcd){var _0xf00433=typeof _0x28bb66[_0xce15('0x1d')]===_0xce15('0x1e')&&typeof _0x28bb66['limit']==='undefined';var _0x5807bf=_0xb46dcd['count'];var _0x58d0c0=_0xf00433?0x0:_0x28bb66[_0xce15('0x1d')];var _0x2320c5=_0xf00433?_0xb46dcd['count']:_0x28bb66[_0xce15('0x1d')]+_0x28bb66[_0xce15('0x1f')];var _0x3a4798;if(_0x2320c5>=_0x5807bf){_0x2320c5=_0x5807bf;_0x3a4798=0xc8;}else{_0x3a4798=0xce;}_0x300aa4['status'](_0x3a4798);return _0x300aa4[_0xce15('0x20')](_0xce15('0x21'),_0x58d0c0+'-'+_0x2320c5+'/'+_0x5807bf)['json'](_0xb46dcd);}return null;};}function patchUpdates(_0x3e422e){return function(_0x5f3528){try{jsonpatch[_0xce15('0x22')](_0x5f3528,_0x3e422e,!![]);}catch(_0x3bd61b){return BPromise[_0xce15('0x23')](_0x3bd61b);}return _0x5f3528[_0xce15('0x24')]();};}function saveUpdates(_0x579638,_0x141f29){return function(_0x10e63e){if(_0x10e63e){return _0x10e63e[_0xce15('0x25')](_0x579638)['then'](function(_0x5021e0){return _0x5021e0;});}return null;};}function removeEntity(_0x40af91,_0x31b9ea){return function(_0x2fa497){if(_0x2fa497){return _0x2fa497[_0xce15('0x26')]()[_0xce15('0x27')](function(){var _0x1b2707=_0x2fa497['get']({'plain':!![]});var _0x899eaa=_0xce15('0x28');return db['UserProfileResource'][_0xce15('0x26')]({'where':{'type':_0x899eaa,'resourceId':_0x1b2707['id']}})[_0xce15('0x27')](function(){return _0x2fa497;});})[_0xce15('0x27')](function(){_0x40af91['status'](0xcc)[_0xce15('0x1c')]();});}};}function handleEntityNotFound(_0x39ca46,_0x39e0eb){return function(_0x2225f4){if(!_0x2225f4){_0x39ca46[_0xce15('0x29')](0x194);}return _0x2225f4;};}function handleError(_0x53a2b7,_0x80fd30){_0x80fd30=_0x80fd30||0x1f4;return function(_0x23af0c){logger[_0xce15('0x2a')](_0x23af0c[_0xce15('0x2b')]);if(_0x23af0c['name']){delete _0x23af0c['name'];}_0x53a2b7[_0xce15('0x1b')](_0x80fd30)['send'](_0x23af0c);};}exports[_0xce15('0x2c')]=function(_0x3be0f9,_0x3da79a){var _0x4ce242={},_0x10ef99={},_0x479450={'count':0x0,'rows':[]};var _0x38251c=_[_0xce15('0x2d')](db[_0xce15('0x2e')][_0xce15('0x2f')],function(_0xca46e1){return{'name':_0xca46e1['fieldName'],'type':_0xca46e1[_0xce15('0x30')][_0xce15('0x31')]};});_0x10ef99[_0xce15('0x32')]=_['map'](_0x38251c,_0xce15('0x33'));_0x10ef99[_0xce15('0x34')]=_[_0xce15('0x35')](_0x3be0f9[_0xce15('0x34')]);_0x10ef99['filters']=_['intersection'](_0x10ef99[_0xce15('0x32')],_0x10ef99['query']);_0x4ce242['attributes']=_[_0xce15('0x36')](_0x10ef99['model'],qs[_0xce15('0x37')](_0x3be0f9[_0xce15('0x34')][_0xce15('0x37')]));_0x4ce242[_0xce15('0x38')]=_0x4ce242[_0xce15('0x38')]['length']?_0x4ce242[_0xce15('0x38')]:_0x10ef99['model'];if(!_0x3be0f9[_0xce15('0x34')][_0xce15('0x39')](_0xce15('0x3a'))){_0x4ce242[_0xce15('0x1f')]=qs[_0xce15('0x1f')](_0x3be0f9[_0xce15('0x34')][_0xce15('0x1f')]);_0x4ce242['offset']=qs[_0xce15('0x1d')](_0x3be0f9[_0xce15('0x34')][_0xce15('0x1d')]);}_0x4ce242[_0xce15('0x3b')]=qs[_0xce15('0x3c')](_0x3be0f9['query'][_0xce15('0x3c')]);_0x4ce242[_0xce15('0x3d')]=qs[_0xce15('0x3e')](_['pick'](_0x3be0f9[_0xce15('0x34')],_0x10ef99[_0xce15('0x3e')]),_0x38251c);if(_0x3be0f9[_0xce15('0x34')][_0xce15('0x3f')]){_0x4ce242[_0xce15('0x3d')]=_[_0xce15('0x40')](_0x4ce242['where'],{'$or':_['map'](_0x38251c,function(_0x34adc9){if(_0x34adc9['type']!=='VIRTUAL'){var _0x22d22a={};_0x22d22a[_0x34adc9[_0xce15('0x33')]]={'$like':'%'+_0x3be0f9[_0xce15('0x34')][_0xce15('0x3f')]+'%'};return _0x22d22a;}})});}_0x4ce242=_[_0xce15('0x40')]({},_0x4ce242,_0x3be0f9['options']);var _0x59f249={'where':_0x4ce242['where']};return db['Schedule']['count'](_0x59f249)[_0xce15('0x27')](function(_0x4c4717){_0x479450[_0xce15('0x41')]=_0x4c4717;if(_0x3be0f9['query'][_0xce15('0x42')]){_0x4ce242[_0xce15('0x43')]=[{'all':!![]}];}return db[_0xce15('0x2e')]['findAll'](_0x4ce242);})[_0xce15('0x27')](function(_0x2d0179){_0x479450[_0xce15('0x44')]=_0x2d0179;return _0x479450;})[_0xce15('0x27')](respondWithFilteredResult(_0x3da79a,_0x4ce242))[_0xce15('0x45')](handleError(_0x3da79a,null));};exports[_0xce15('0x46')]=function(_0x35ddd3,_0x597614){var _0x417198={'raw':![],'where':{'id':_0x35ddd3[_0xce15('0x47')]['id']}},_0x541fb1={};_0x541fb1[_0xce15('0x32')]=_[_0xce15('0x35')](db[_0xce15('0x2e')][_0xce15('0x2f')]);_0x541fb1[_0xce15('0x34')]=_['keys'](_0x35ddd3[_0xce15('0x34')]);_0x541fb1[_0xce15('0x3e')]=_['intersection'](_0x541fb1['model'],_0x541fb1[_0xce15('0x34')]);_0x417198['attributes']=_[_0xce15('0x36')](_0x541fb1['model'],qs['fields'](_0x35ddd3['query'][_0xce15('0x37')]));_0x417198[_0xce15('0x38')]=_0x417198[_0xce15('0x38')][_0xce15('0x48')]?_0x417198[_0xce15('0x38')]:_0x541fb1[_0xce15('0x32')];if(_0x35ddd3['query']['includeAll']){_0x417198['include']=[{'all':!![]}];}_0x417198=_[_0xce15('0x40')]({},_0x417198,_0x35ddd3[_0xce15('0x49')]);return db[_0xce15('0x2e')][_0xce15('0x4a')](_0x417198)['then'](handleEntityNotFound(_0x597614,null))[_0xce15('0x27')](respondWithResult(_0x597614,null))['catch'](handleError(_0x597614,null));};exports[_0xce15('0x4b')]=function(_0x47922e,_0x1b69db){return db['Schedule']['create'](_0x47922e['body'],{})['then'](function(_0x36ea41){var _0x530849=_0x47922e[_0xce15('0x4c')][_0xce15('0x4d')]({'plain':!![]});if(!_0x530849)throw new Error(_0xce15('0x4e'));if(_0x530849[_0xce15('0x4f')]==='user'){var _0x407858=_0x36ea41[_0xce15('0x4d')]({'plain':!![]});var _0x31ead0=_0xce15('0x28');return db[_0xce15('0x50')][_0xce15('0x4a')]({'where':{'name':_0x31ead0,'userProfileId':_0x530849[_0xce15('0x51')]},'raw':!![]})[_0xce15('0x27')](function(_0x8eb96e){if(_0x8eb96e&&_0x8eb96e['autoAssociation']===0x0){return db[_0xce15('0x52')][_0xce15('0x4b')]({'name':_0x407858[_0xce15('0x33')],'resourceId':_0x407858['id'],'type':_0x8eb96e[_0xce15('0x33')],'sectionId':_0x8eb96e['id']},{})[_0xce15('0x27')](function(){return _0x36ea41;});}else{return _0x36ea41;}})[_0xce15('0x45')](function(_0x37119d){logger['error'](_0xce15('0x53'),_0x37119d);throw _0x37119d;});}return _0x36ea41;})[_0xce15('0x27')](respondWithResult(_0x1b69db,0xc9))[_0xce15('0x45')](handleError(_0x1b69db,null));};exports[_0xce15('0x25')]=function(_0x4fe634,_0x676f17){if(_0x4fe634[_0xce15('0x54')]['id']){delete _0x4fe634[_0xce15('0x54')]['id'];}return db[_0xce15('0x2e')]['find']({'where':{'id':_0x4fe634[_0xce15('0x47')]['id']}})[_0xce15('0x27')](handleEntityNotFound(_0x676f17,null))[_0xce15('0x27')](saveUpdates(_0x4fe634[_0xce15('0x54')],null))[_0xce15('0x27')](respondWithResult(_0x676f17,null))['catch'](handleError(_0x676f17,null));};exports[_0xce15('0x26')]=function(_0x3aee7b,_0x146bc4){return db[_0xce15('0x2e')][_0xce15('0x4a')]({'where':{'id':_0x3aee7b['params']['id']}})[_0xce15('0x27')](handleEntityNotFound(_0x146bc4,null))['then'](removeEntity(_0x146bc4,null))['catch'](handleError(_0x146bc4,null));};exports[_0xce15('0x55')]=function(_0x4cdf39,_0x29feda,_0x367b80){var _0x43be69=require(_0xce15('0x56'));return db[_0xce15('0x2e')][_0xce15('0x4a')]({'where':{'id':_0x4cdf39[_0xce15('0x47')]['id']},'raw':!![]})['then'](handleEntityNotFound(_0x29feda,null))['then'](function(){_0x43be69['run'](_0x4cdf39['params']['id']);})[_0xce15('0x27')](respondWithStatusCode(_0x29feda,null))[_0xce15('0x45')](handleError(_0x29feda,null));}; \ No newline at end of file +var _0x2fa0=['limit','count','set','Content-Range','apply','save','update','then','destroy','get','Scheduler','UserProfileResource','end','stack','name','send','Schedule','rawAttributes','fieldName','key','model','map','keys','query','filters','attributes','intersection','fields','hasOwnProperty','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','rows','catch','show','params','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','run','../../config/schedule','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','desk.js','querystring','ioredis','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','undefined'];(function(_0x5df8eb,_0x580d4d){var _0xe1de05=function(_0x3735ef){while(--_0x3735ef){_0x5df8eb['push'](_0x5df8eb['shift']());}};_0xe1de05(++_0x580d4d);}(_0x2fa0,0x17f));var _0x02fa=function(_0x433298,_0x118456){_0x433298=_0x433298-0x0;var _0x5d0c18=_0x2fa0[_0x433298];return _0x5d0c18;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x02fa('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x02fa('0x1'));var moment=require(_0x02fa('0x2'));var BPromise=require(_0x02fa('0x3'));var Mustache=require(_0x02fa('0x4'));var util=require(_0x02fa('0x5'));var path=require(_0x02fa('0x6'));var sox=require(_0x02fa('0x7'));var csv=require(_0x02fa('0x8'));var ejs=require(_0x02fa('0x9'));var fs=require('fs');var fs_extra=require(_0x02fa('0xa'));var _=require('lodash');var squel=require(_0x02fa('0xb'));var crypto=require(_0x02fa('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x02fa('0xd'));var toCsv=require(_0x02fa('0x8'));var querystring=require(_0x02fa('0xe'));var Papa=require('papaparse');var Redis=require(_0x02fa('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x02fa('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x02fa('0x11'));var logger=require('../../config/logger')(_0x02fa('0x12'));var utils=require(_0x02fa('0x13'));var config=require(_0x02fa('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x02fa('0x15'))['db'];function respondWithStatusCode(_0x356c4c,_0x55a0fc){_0x55a0fc=_0x55a0fc||0xcc;return function(_0x4e8ac5){if(_0x4e8ac5){return _0x356c4c[_0x02fa('0x16')](_0x55a0fc);}return _0x356c4c[_0x02fa('0x17')](_0x55a0fc)['end']();};}function respondWithResult(_0x4abcf5,_0x3a1a1e){_0x3a1a1e=_0x3a1a1e||0xc8;return function(_0x2ce8c8){if(_0x2ce8c8){return _0x4abcf5[_0x02fa('0x17')](_0x3a1a1e)[_0x02fa('0x18')](_0x2ce8c8);}};}function respondWithFilteredResult(_0xba8c41,_0x3868ab){return function(_0x4ba54b){if(_0x4ba54b){var _0x1c43b9=typeof _0x3868ab[_0x02fa('0x19')]===_0x02fa('0x1a')&&typeof _0x3868ab[_0x02fa('0x1b')]===_0x02fa('0x1a');var _0x53ce57=_0x4ba54b[_0x02fa('0x1c')];var _0x3f3562=_0x1c43b9?0x0:_0x3868ab[_0x02fa('0x19')];var _0x3fc34c=_0x1c43b9?_0x4ba54b[_0x02fa('0x1c')]:_0x3868ab[_0x02fa('0x19')]+_0x3868ab[_0x02fa('0x1b')];var _0x486867;if(_0x3fc34c>=_0x53ce57){_0x3fc34c=_0x53ce57;_0x486867=0xc8;}else{_0x486867=0xce;}_0xba8c41[_0x02fa('0x17')](_0x486867);return _0xba8c41[_0x02fa('0x1d')](_0x02fa('0x1e'),_0x3f3562+'-'+_0x3fc34c+'/'+_0x53ce57)[_0x02fa('0x18')](_0x4ba54b);}return null;};}function patchUpdates(_0x1f24fb){return function(_0x20a85b){try{jsonpatch[_0x02fa('0x1f')](_0x20a85b,_0x1f24fb,!![]);}catch(_0x3d413e){return BPromise['reject'](_0x3d413e);}return _0x20a85b[_0x02fa('0x20')]();};}function saveUpdates(_0x485463,_0x33bc36){return function(_0xfdf8e7){if(_0xfdf8e7){return _0xfdf8e7[_0x02fa('0x21')](_0x485463)[_0x02fa('0x22')](function(_0x55a6cc){return _0x55a6cc;});}return null;};}function removeEntity(_0x4087a1,_0x38007a){return function(_0x7c8817){if(_0x7c8817){return _0x7c8817[_0x02fa('0x23')]()[_0x02fa('0x22')](function(){var _0x42bce2=_0x7c8817[_0x02fa('0x24')]({'plain':!![]});var _0xd6414e=_0x02fa('0x25');return db[_0x02fa('0x26')][_0x02fa('0x23')]({'where':{'type':_0xd6414e,'resourceId':_0x42bce2['id']}})[_0x02fa('0x22')](function(){return _0x7c8817;});})['then'](function(){_0x4087a1[_0x02fa('0x17')](0xcc)[_0x02fa('0x27')]();});}};}function handleEntityNotFound(_0x5f199c,_0x1cf625){return function(_0x4d40b6){if(!_0x4d40b6){_0x5f199c[_0x02fa('0x16')](0x194);}return _0x4d40b6;};}function handleError(_0x51bf49,_0x19d4bc){_0x19d4bc=_0x19d4bc||0x1f4;return function(_0x490eda){logger['error'](_0x490eda[_0x02fa('0x28')]);if(_0x490eda[_0x02fa('0x29')]){delete _0x490eda[_0x02fa('0x29')];}_0x51bf49[_0x02fa('0x17')](_0x19d4bc)[_0x02fa('0x2a')](_0x490eda);};}exports['index']=function(_0x1275d7,_0x5604b2){var _0x303d19={},_0x83f380={},_0x31d7c6={'count':0x0,'rows':[]};var _0x195990=_['map'](db[_0x02fa('0x2b')][_0x02fa('0x2c')],function(_0x504d31){return{'name':_0x504d31[_0x02fa('0x2d')],'type':_0x504d31['type'][_0x02fa('0x2e')]};});_0x83f380[_0x02fa('0x2f')]=_[_0x02fa('0x30')](_0x195990,'name');_0x83f380['query']=_[_0x02fa('0x31')](_0x1275d7[_0x02fa('0x32')]);_0x83f380[_0x02fa('0x33')]=_['intersection'](_0x83f380[_0x02fa('0x2f')],_0x83f380[_0x02fa('0x32')]);_0x303d19[_0x02fa('0x34')]=_[_0x02fa('0x35')](_0x83f380[_0x02fa('0x2f')],qs['fields'](_0x1275d7[_0x02fa('0x32')][_0x02fa('0x36')]));_0x303d19['attributes']=_0x303d19[_0x02fa('0x34')]['length']?_0x303d19[_0x02fa('0x34')]:_0x83f380[_0x02fa('0x2f')];if(!_0x1275d7[_0x02fa('0x32')][_0x02fa('0x37')]('nolimit')){_0x303d19[_0x02fa('0x1b')]=qs[_0x02fa('0x1b')](_0x1275d7[_0x02fa('0x32')]['limit']);_0x303d19[_0x02fa('0x19')]=qs['offset'](_0x1275d7[_0x02fa('0x32')]['offset']);}_0x303d19[_0x02fa('0x38')]=qs[_0x02fa('0x39')](_0x1275d7['query'][_0x02fa('0x39')]);_0x303d19[_0x02fa('0x3a')]=qs['filters'](_[_0x02fa('0x3b')](_0x1275d7[_0x02fa('0x32')],_0x83f380[_0x02fa('0x33')]),_0x195990);if(_0x1275d7[_0x02fa('0x32')][_0x02fa('0x3c')]){_0x303d19[_0x02fa('0x3a')]=_[_0x02fa('0x3d')](_0x303d19['where'],{'$or':_[_0x02fa('0x30')](_0x195990,function(_0x3c5c0b){if(_0x3c5c0b[_0x02fa('0x3e')]!==_0x02fa('0x3f')){var _0x507d4e={};_0x507d4e[_0x3c5c0b[_0x02fa('0x29')]]={'$like':'%'+_0x1275d7[_0x02fa('0x32')]['filter']+'%'};return _0x507d4e;}})});}_0x303d19=_['merge']({},_0x303d19,_0x1275d7[_0x02fa('0x40')]);var _0x217d11={'where':_0x303d19[_0x02fa('0x3a')]};return db[_0x02fa('0x2b')]['count'](_0x217d11)['then'](function(_0x429538){_0x31d7c6[_0x02fa('0x1c')]=_0x429538;if(_0x1275d7['query'][_0x02fa('0x41')]){_0x303d19[_0x02fa('0x42')]=[{'all':!![]}];}return db[_0x02fa('0x2b')]['findAll'](_0x303d19);})[_0x02fa('0x22')](function(_0x36946a){_0x31d7c6[_0x02fa('0x43')]=_0x36946a;return _0x31d7c6;})[_0x02fa('0x22')](respondWithFilteredResult(_0x5604b2,_0x303d19))[_0x02fa('0x44')](handleError(_0x5604b2,null));};exports[_0x02fa('0x45')]=function(_0x55f724,_0x439936){var _0x4e0dc3={'raw':![],'where':{'id':_0x55f724[_0x02fa('0x46')]['id']}},_0xf7f2c1={};_0xf7f2c1[_0x02fa('0x2f')]=_[_0x02fa('0x31')](db[_0x02fa('0x2b')][_0x02fa('0x2c')]);_0xf7f2c1['query']=_['keys'](_0x55f724[_0x02fa('0x32')]);_0xf7f2c1[_0x02fa('0x33')]=_[_0x02fa('0x35')](_0xf7f2c1[_0x02fa('0x2f')],_0xf7f2c1[_0x02fa('0x32')]);_0x4e0dc3[_0x02fa('0x34')]=_['intersection'](_0xf7f2c1['model'],qs[_0x02fa('0x36')](_0x55f724[_0x02fa('0x32')][_0x02fa('0x36')]));_0x4e0dc3[_0x02fa('0x34')]=_0x4e0dc3[_0x02fa('0x34')]['length']?_0x4e0dc3['attributes']:_0xf7f2c1[_0x02fa('0x2f')];if(_0x55f724[_0x02fa('0x32')][_0x02fa('0x41')]){_0x4e0dc3[_0x02fa('0x42')]=[{'all':!![]}];}_0x4e0dc3=_[_0x02fa('0x3d')]({},_0x4e0dc3,_0x55f724['options']);return db[_0x02fa('0x2b')][_0x02fa('0x47')](_0x4e0dc3)['then'](handleEntityNotFound(_0x439936,null))[_0x02fa('0x22')](respondWithResult(_0x439936,null))[_0x02fa('0x44')](handleError(_0x439936,null));};exports[_0x02fa('0x48')]=function(_0x51de2a,_0x56c74a){return db[_0x02fa('0x2b')][_0x02fa('0x48')](_0x51de2a[_0x02fa('0x49')],{})[_0x02fa('0x22')](function(_0x230a8b){var _0x3c2b6b=_0x51de2a['user']['get']({'plain':!![]});if(!_0x3c2b6b)throw new Error(_0x02fa('0x4a'));if(_0x3c2b6b[_0x02fa('0x4b')]===_0x02fa('0x4c')){var _0x3caeef=_0x230a8b[_0x02fa('0x24')]({'plain':!![]});var _0xd15ecd='Scheduler';return db['UserProfileSection'][_0x02fa('0x47')]({'where':{'name':_0xd15ecd,'userProfileId':_0x3c2b6b[_0x02fa('0x4d')]},'raw':!![]})[_0x02fa('0x22')](function(_0xc613c9){if(_0xc613c9&&_0xc613c9[_0x02fa('0x4e')]===0x0){return db[_0x02fa('0x26')][_0x02fa('0x48')]({'name':_0x3caeef[_0x02fa('0x29')],'resourceId':_0x3caeef['id'],'type':_0xc613c9[_0x02fa('0x29')],'sectionId':_0xc613c9['id']},{})[_0x02fa('0x22')](function(){return _0x230a8b;});}else{return _0x230a8b;}})[_0x02fa('0x44')](function(_0x4e7bb1){logger['error'](_0x02fa('0x4f'),_0x4e7bb1);throw _0x4e7bb1;});}return _0x230a8b;})[_0x02fa('0x22')](respondWithResult(_0x56c74a,0xc9))[_0x02fa('0x44')](handleError(_0x56c74a,null));};exports['update']=function(_0x475132,_0x26ea01){if(_0x475132[_0x02fa('0x49')]['id']){delete _0x475132[_0x02fa('0x49')]['id'];}return db[_0x02fa('0x2b')][_0x02fa('0x47')]({'where':{'id':_0x475132['params']['id']}})['then'](handleEntityNotFound(_0x26ea01,null))[_0x02fa('0x22')](saveUpdates(_0x475132[_0x02fa('0x49')],null))[_0x02fa('0x22')](respondWithResult(_0x26ea01,null))[_0x02fa('0x44')](handleError(_0x26ea01,null));};exports[_0x02fa('0x23')]=function(_0x3167a4,_0x2ba59e){return db[_0x02fa('0x2b')][_0x02fa('0x47')]({'where':{'id':_0x3167a4[_0x02fa('0x46')]['id']}})[_0x02fa('0x22')](handleEntityNotFound(_0x2ba59e,null))[_0x02fa('0x22')](removeEntity(_0x2ba59e,null))['catch'](handleError(_0x2ba59e,null));};exports[_0x02fa('0x50')]=function(_0x344032,_0x5805f4,_0x401603){var _0xa47b8=require(_0x02fa('0x51'));return db['Schedule']['find']({'where':{'id':_0x344032['params']['id']},'raw':!![]})[_0x02fa('0x22')](handleEntityNotFound(_0x5805f4,null))[_0x02fa('0x22')](function(){_0xa47b8[_0x02fa('0x50')](_0x344032[_0x02fa('0x46')]['id']);})['then'](respondWithStatusCode(_0x5805f4,null))['catch'](handleError(_0x5805f4,null));}; \ No newline at end of file diff --git a/server/api/schedule/schedule.model.js b/server/api/schedule/schedule.model.js index b9653b6..c2300e1 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 _0xb5c8=['path','../../config/environment','exports','define','Schedule','tools_schedules','lodash','util','../../config/logger','moment','bluebird','request-promise'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xb5c8,0x8a));var _0x8b5c=function(_0xa82131,_0x5c57a9){_0xa82131=_0xa82131-0x0;var _0xaf0d12=_0xb5c8[_0xa82131];return _0xaf0d12;};'use strict';var _=require(_0x8b5c('0x0'));var util=require(_0x8b5c('0x1'));var logger=require(_0x8b5c('0x2'))('api');var moment=require(_0x8b5c('0x3'));var BPromise=require(_0x8b5c('0x4'));var rp=require(_0x8b5c('0x5'));var fs=require('fs');var path=require(_0x8b5c('0x6'));var rimraf=require('rimraf');var config=require(_0x8b5c('0x7'));var attributes=require('./schedule.attributes');module[_0x8b5c('0x8')]=function(_0x3fc29e,_0x14e12f){return _0x3fc29e[_0x8b5c('0x9')](_0x8b5c('0xa'),attributes,{'tableName':_0x8b5c('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2070=['lodash','../../config/logger','api','bluebird','request-promise','path','rimraf','./schedule.attributes','define','tools_schedules'];(function(_0x30056a,_0x4b6322){var _0x2f0799=function(_0x1da9eb){while(--_0x1da9eb){_0x30056a['push'](_0x30056a['shift']());}};_0x2f0799(++_0x4b6322);}(_0x2070,0x14a));var _0x0207=function(_0x4042f2,_0x2ac76f){_0x4042f2=_0x4042f2-0x0;var _0x53919d=_0x2070[_0x4042f2];return _0x53919d;};'use strict';var _=require(_0x0207('0x0'));var util=require('util');var logger=require(_0x0207('0x1'))(_0x0207('0x2'));var moment=require('moment');var BPromise=require(_0x0207('0x3'));var rp=require(_0x0207('0x4'));var fs=require('fs');var path=require(_0x0207('0x5'));var rimraf=require(_0x0207('0x6'));var config=require('../../config/environment');var attributes=require(_0x0207('0x7'));module['exports']=function(_0x27cdfd,_0xe69362){return _0x27cdfd[_0x0207('0x8')]('Schedule',attributes,{'tableName':_0x0207('0x9'),'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 f75dc77..b49fe4e 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 _0x0501=['../../config/logger','jayson/promise','client','http','then','Schedule,\x20%s,\x20%s','request\x20sent','Schedule,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','util','moment','bluebird','randomstring','ioredis','../../config/utils'];(function(_0x3238bd,_0x4ea3ef){var _0xdc7a7e=function(_0x275fbc){while(--_0x275fbc){_0x3238bd['push'](_0x3238bd['shift']());}};_0xdc7a7e(++_0x4ea3ef);}(_0x0501,0x1f2));var _0x1050=function(_0x2c0e1c,_0x53e967){_0x2c0e1c=_0x2c0e1c-0x0;var _0x422719=_0x0501[_0x2c0e1c];return _0x422719;};'use strict';var _=require('lodash');var util=require(_0x1050('0x0'));var moment=require(_0x1050('0x1'));var BPromise=require(_0x1050('0x2'));var rs=require(_0x1050('0x3'));var fs=require('fs');var Redis=require(_0x1050('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x1050('0x5'));var logger=require(_0x1050('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x1050('0x7'));var client=jayson[_0x1050('0x8')][_0x1050('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1d6e5d,_0x2bd92e,_0x581fe6){return new BPromise(function(_0x3bcb6a,_0x1fdba7){return client['request'](_0x1d6e5d,_0x581fe6)[_0x1050('0xa')](function(_0x3626aa){logger['info'](_0x1050('0xb'),_0x2bd92e,_0x1050('0xc'));logger['debug'](_0x1050('0xd'),_0x2bd92e,'request\x20sent',JSON[_0x1050('0xe')](_0x3626aa));if(_0x3626aa[_0x1050('0xf')]){if(_0x3626aa[_0x1050('0xf')][_0x1050('0x10')]===0x1f4){logger[_0x1050('0xf')](_0x1050('0xb'),_0x2bd92e,_0x3626aa[_0x1050('0xf')][_0x1050('0x11')]);return _0x1fdba7(_0x3626aa['error'][_0x1050('0x11')]);}logger[_0x1050('0xf')]('Schedule,\x20%s,\x20%s',_0x2bd92e,_0x3626aa[_0x1050('0xf')]['message']);return _0x3bcb6a(_0x3626aa[_0x1050('0xf')][_0x1050('0x11')]);}else{logger[_0x1050('0x12')](_0x1050('0xb'),_0x2bd92e,_0x1050('0xc'));_0x3bcb6a(_0x3626aa[_0x1050('0x13')]['message']);}})[_0x1050('0x14')](function(_0x4edcf5){logger['error'](_0x1050('0xb'),_0x2bd92e,_0x4edcf5);_0x1fdba7(_0x4edcf5);});});} \ No newline at end of file +var _0x8ac3=['Schedule,\x20%s,\x20%s','request\x20sent','debug','Schedule,\x20%s,\x20%s,\x20%s','code','error','message','result','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x44e58d,_0x3e282f){var _0x232137=function(_0x193e9f){while(--_0x193e9f){_0x44e58d['push'](_0x44e58d['shift']());}};_0x232137(++_0x3e282f);}(_0x8ac3,0xee));var _0x38ac=function(_0x5b49d2,_0x217a26){_0x5b49d2=_0x5b49d2-0x0;var _0xc4b634=_0x8ac3[_0x5b49d2];return _0xc4b634;};'use strict';var _=require(_0x38ac('0x0'));var util=require(_0x38ac('0x1'));var moment=require('moment');var BPromise=require(_0x38ac('0x2'));var rs=require(_0x38ac('0x3'));var fs=require('fs');var Redis=require(_0x38ac('0x4'));var db=require(_0x38ac('0x5'))['db'];var utils=require(_0x38ac('0x6'));var logger=require(_0x38ac('0x7'))('rpc');var config=require(_0x38ac('0x8'));var jayson=require(_0x38ac('0x9'));var client=jayson[_0x38ac('0xa')][_0x38ac('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x14b9a5,_0xa97391,_0x1d1cc0){return new BPromise(function(_0x389083,_0xe588a6){return client[_0x38ac('0xc')](_0x14b9a5,_0x1d1cc0)[_0x38ac('0xd')](function(_0x536270){logger[_0x38ac('0xe')](_0x38ac('0xf'),_0xa97391,_0x38ac('0x10'));logger[_0x38ac('0x11')](_0x38ac('0x12'),_0xa97391,_0x38ac('0x10'),JSON['stringify'](_0x536270));if(_0x536270['error']){if(_0x536270['error'][_0x38ac('0x13')]===0x1f4){logger['error'](_0x38ac('0xf'),_0xa97391,_0x536270[_0x38ac('0x14')]['message']);return _0xe588a6(_0x536270[_0x38ac('0x14')][_0x38ac('0x15')]);}logger[_0x38ac('0x14')](_0x38ac('0xf'),_0xa97391,_0x536270[_0x38ac('0x14')][_0x38ac('0x15')]);return _0x389083(_0x536270[_0x38ac('0x14')][_0x38ac('0x15')]);}else{logger[_0x38ac('0xe')]('Schedule,\x20%s,\x20%s',_0xa97391,_0x38ac('0x10'));_0x389083(_0x536270[_0x38ac('0x16')][_0x38ac('0x15')]);}})['catch'](function(_0x19c6ea){logger['error']('Schedule,\x20%s,\x20%s',_0xa97391,_0x19c6ea);_0xe588a6(_0x19c6ea);});});} \ No newline at end of file diff --git a/server/api/screenRecording/index.js b/server/api/screenRecording/index.js index 0abe701..47f65f9 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 _0xfd4c=['exports','multer','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./screenRecording.controller','get','isAuthenticated','index','/describe','describe','show','/:id/download','post','put','update','delete'];(function(_0x11b844,_0x51f5b3){var _0x20091e=function(_0x47f4ee){while(--_0x47f4ee){_0x11b844['push'](_0x11b844['shift']());}};_0x20091e(++_0x51f5b3);}(_0xfd4c,0x13c));var _0xcfd4=function(_0x438b5e,_0x1f4942){_0x438b5e=_0x438b5e-0x0;var _0x3262b2=_0xfd4c[_0x438b5e];return _0x3262b2;};'use strict';var multer=require(_0xcfd4('0x0'));var util=require(_0xcfd4('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xcfd4('0x2'));var router=express[_0xcfd4('0x3')]();var fs_extra=require(_0xcfd4('0x4'));var auth=require(_0xcfd4('0x5'));var interaction=require(_0xcfd4('0x6'));var config=require(_0xcfd4('0x7'));var controller=require(_0xcfd4('0x8'));router[_0xcfd4('0x9')]('/',auth[_0xcfd4('0xa')](),controller[_0xcfd4('0xb')]);router[_0xcfd4('0x9')](_0xcfd4('0xc'),auth[_0xcfd4('0xa')](),controller[_0xcfd4('0xd')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0xcfd4('0xe')]);router[_0xcfd4('0x9')](_0xcfd4('0xf'),auth[_0xcfd4('0xa')](),controller['download']);router[_0xcfd4('0x10')]('/',auth['isAuthenticated'](),controller['create']);router[_0xcfd4('0x11')]('/:id',auth[_0xcfd4('0xa')](),controller[_0xcfd4('0x12')]);router[_0xcfd4('0x13')]('/:id',auth[_0xcfd4('0xa')](),controller['destroy']);module[_0xcfd4('0x14')]=router; \ No newline at end of file +var _0xa84e=['get','index','/describe','isAuthenticated','describe','/:id','show','/:id/download','download','post','create','put','update','delete','destroy','multer','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','./screenRecording.controller'];(function(_0x20410e,_0x2796a6){var _0x4426ee=function(_0x2b6e4f){while(--_0x2b6e4f){_0x20410e['push'](_0x20410e['shift']());}};_0x4426ee(++_0x2796a6);}(_0xa84e,0x151));var _0xea84=function(_0x27470d,_0x20ad27){_0x27470d=_0x27470d-0x0;var _0x2cab2b=_0xa84e[_0x27470d];return _0x2cab2b;};'use strict';var multer=require(_0xea84('0x0'));var util=require(_0xea84('0x1'));var path=require(_0xea84('0x2'));var timeout=require(_0xea84('0x3'));var express=require(_0xea84('0x4'));var router=express['Router']();var fs_extra=require(_0xea84('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xea84('0x6'));var config=require('../../config/environment');var controller=require(_0xea84('0x7'));router[_0xea84('0x8')]('/',auth['isAuthenticated'](),controller[_0xea84('0x9')]);router[_0xea84('0x8')](_0xea84('0xa'),auth[_0xea84('0xb')](),controller[_0xea84('0xc')]);router['get'](_0xea84('0xd'),auth[_0xea84('0xb')](),controller[_0xea84('0xe')]);router[_0xea84('0x8')](_0xea84('0xf'),auth['isAuthenticated'](),controller[_0xea84('0x10')]);router[_0xea84('0x11')]('/',auth[_0xea84('0xb')](),controller[_0xea84('0x12')]);router[_0xea84('0x13')](_0xea84('0xd'),auth[_0xea84('0xb')](),controller[_0xea84('0x14')]);router[_0xea84('0x15')](_0xea84('0xd'),auth[_0xea84('0xb')](),controller[_0xea84('0x16')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.attributes.js b/server/api/screenRecording/screenRecording.attributes.js index b3f412a..7941ab2 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 _0x5d4e=['exports','VIRTUAL','value','extname','getDataValue','STRING','replace','setDataValue','INTEGER','startedAt','subtract','duration','DATE','format','MM-DD-YYYY\x20HH:mm','toString','createdAt','updatedAt','moment','path','../../config/environment'];(function(_0x2cd9c7,_0x5196bb){var _0x1530cd=function(_0x841019){while(--_0x841019){_0x2cd9c7['push'](_0x2cd9c7['shift']());}};_0x1530cd(++_0x5196bb);}(_0x5d4e,0x138));var _0xe5d4=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x5d4e[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xe5d4('0x0'));var path=require(_0xe5d4('0x1'));var config=require(_0xe5d4('0x2'));module[_0xe5d4('0x3')]={'format':{'type':Sequelize[_0xe5d4('0x4')],'get':function(){return this['getDataValue'](_0xe5d4('0x5'))?path[_0xe5d4('0x6')](this[_0xe5d4('0x7')]('value')):undefined;}},'interactionid':{'type':Sequelize[_0xe5d4('0x8')]},'channel':{'type':Sequelize['STRING']},'value':{'type':Sequelize['STRING'],'set':function(_0x5ecca3){var _0x304a0b=_0x5ecca3[_0xe5d4('0x9')](/\\/g,'/');this[_0xe5d4('0xa')](_0xe5d4('0x5'),_0x304a0b);}},'rating':{'type':Sequelize[_0xe5d4('0xb')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0xe5d4('0xb')],'set':function(_0xf7fa11){this[_0xe5d4('0xa')](_0xe5d4('0xc'),moment()[_0xe5d4('0xd')](_0xf7fa11,'ms'));this[_0xe5d4('0xa')]('closedAt',moment());this['setDataValue'](_0xe5d4('0xe'),_0xf7fa11);}},'startedAt':{'type':Sequelize[_0xe5d4('0xf')],'get':function(){return moment(this[_0xe5d4('0x7')](_0xe5d4('0xc')))[_0xe5d4('0x10')](_0xe5d4('0x11'))[_0xe5d4('0x12')]();}},'closedAt':{'type':Sequelize[_0xe5d4('0xf')],'get':function(){return moment(this[_0xe5d4('0x7')]('closedAt'))['format'](_0xe5d4('0x11'))[_0xe5d4('0x12')]();}},'createdAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0xe5d4('0x7')](_0xe5d4('0x13')))[_0xe5d4('0x10')](_0xe5d4('0x11'))[_0xe5d4('0x12')]();}},'updatedAt':{'type':Sequelize[_0xe5d4('0xf')],'get':function(){return moment(this[_0xe5d4('0x7')](_0xe5d4('0x14')))[_0xe5d4('0x10')](_0xe5d4('0x11'))[_0xe5d4('0x12')]();}}}; \ No newline at end of file +var _0x4732=['createdAt','MM-DD-YYYY\x20HH:mm','updatedAt','sequelize','path','exports','VIRTUAL','getDataValue','value','extname','STRING','setDataValue','INTEGER','startedAt','closedAt','DATE','format','toString'];(function(_0x70be4c,_0x237521){var _0x33e829=function(_0x4516bc){while(--_0x4516bc){_0x70be4c['push'](_0x70be4c['shift']());}};_0x33e829(++_0x237521);}(_0x4732,0x17d));var _0x2473=function(_0x14a0a0,_0x45d0cf){_0x14a0a0=_0x14a0a0-0x0;var _0x56b651=_0x4732[_0x14a0a0];return _0x56b651;};'use strict';var Sequelize=require(_0x2473('0x0'));var moment=require('moment');var path=require(_0x2473('0x1'));var config=require('../../config/environment');module[_0x2473('0x2')]={'format':{'type':Sequelize[_0x2473('0x3')],'get':function(){return this[_0x2473('0x4')](_0x2473('0x5'))?path[_0x2473('0x6')](this[_0x2473('0x4')](_0x2473('0x5'))):undefined;}},'interactionid':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x2473('0x7')]},'value':{'type':Sequelize[_0x2473('0x7')],'set':function(_0x50e340){var _0x4be81c=_0x50e340['replace'](/\\/g,'/');this[_0x2473('0x8')](_0x2473('0x5'),_0x4be81c);}},'rating':{'type':Sequelize[_0x2473('0x9')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0x2473('0x9')],'set':function(_0x52fffe){this['setDataValue'](_0x2473('0xa'),moment()['subtract'](_0x52fffe,'ms'));this[_0x2473('0x8')](_0x2473('0xb'),moment());this['setDataValue']('duration',_0x52fffe);}},'startedAt':{'type':Sequelize[_0x2473('0xc')],'get':function(){return moment(this[_0x2473('0x4')](_0x2473('0xa')))[_0x2473('0xd')]('MM-DD-YYYY\x20HH:mm')[_0x2473('0xe')]();}},'closedAt':{'type':Sequelize[_0x2473('0xc')],'get':function(){return moment(this[_0x2473('0x4')](_0x2473('0xb')))['format']('MM-DD-YYYY\x20HH:mm')['toString']();}},'createdAt':{'type':Sequelize[_0x2473('0xc')],'get':function(){return moment(this[_0x2473('0x4')](_0x2473('0xf')))[_0x2473('0xd')](_0x2473('0x10'))[_0x2473('0xe')]();}},'updatedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0x2473('0x4')](_0x2473('0x11')))[_0x2473('0xd')](_0x2473('0x10'))[_0x2473('0xe')]();}}}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.controller.js b/server/api/screenRecording/screenRecording.controller.js index 199a4b9..f103e99 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 _0x9c5a=['ScreenRecording','includeAll','findAll','rows','catch','params','include','find','create','body','duration','createdAt','closedAt','value','describe','download','uniqueid','join','root','server/files/screen_recordings','%s.cypher','decryptFile','recording','existsSync','Sequelize','ScreenRecording\x20not\x20found','filename','unlink','message','Not\x20found','destroy','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','isNil','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','limit','count','offset','set','Content-Range','apply','save','update','then','stack','name','send','map','rawAttributes','fieldName','key','model','format','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','type','VIRTUAL','options'];(function(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0x9c5a,0x1c3));var _0xa9c5=function(_0x430309,_0x2a6aab){_0x430309=_0x430309-0x0;var _0x37adad=_0x9c5a[_0x430309];return _0x37adad;};'use strict';var emlformat=require(_0xa9c5('0x0'));var rimraf=require(_0xa9c5('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa9c5('0x2'));var rp=require(_0xa9c5('0x3'));var moment=require(_0xa9c5('0x4'));var BPromise=require(_0xa9c5('0x5'));var Mustache=require('mustache');var util=require(_0xa9c5('0x6'));var path=require(_0xa9c5('0x7'));var sox=require('sox');var csv=require(_0xa9c5('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa9c5('0x9'));var _=require(_0xa9c5('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xa9c5('0xb'));var deskjs=require(_0xa9c5('0xc'));var toCsv=require('to-csv');var querystring=require(_0xa9c5('0xd'));var Papa=require(_0xa9c5('0xe'));var Redis=require('ioredis');var authService=require(_0xa9c5('0xf'));var qs=require(_0xa9c5('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xa9c5('0x11'))(_0xa9c5('0x12'));var utils=require(_0xa9c5('0x13'));var config=require(_0xa9c5('0x14'));var licenseUtil=require(_0xa9c5('0x15'));var db=require(_0xa9c5('0x16'))['db'];function respondWithStatusCode(_0x51c8d,_0x42d5cf){_0x42d5cf=_0x42d5cf||0xcc;return function(_0x3c5ac7){if(_0x3c5ac7){return _0x51c8d[_0xa9c5('0x17')](_0x42d5cf);}return _0x51c8d['status'](_0x42d5cf)[_0xa9c5('0x18')]();};}function respondWithResult(_0x1276d2,_0x7df76d){_0x7df76d=_0x7df76d||0xc8;return function(_0x3806c4){if(_0x3806c4){return _0x1276d2[_0xa9c5('0x19')](_0x7df76d)[_0xa9c5('0x1a')](_0x3806c4);}};}function respondWithFilteredResult(_0x251099,_0x40b001){return function(_0x19a43e){if(_0x19a43e){var _0xcf13f2=typeof _0x40b001['offset']===_0xa9c5('0x1b')&&typeof _0x40b001[_0xa9c5('0x1c')]===_0xa9c5('0x1b');var _0x55cce5=_0x19a43e[_0xa9c5('0x1d')];var _0x1142d9=_0xcf13f2?0x0:_0x40b001[_0xa9c5('0x1e')];var _0x3b8cf7=_0xcf13f2?_0x19a43e[_0xa9c5('0x1d')]:_0x40b001[_0xa9c5('0x1e')]+_0x40b001[_0xa9c5('0x1c')];var _0x1e5ce6;if(_0x3b8cf7>=_0x55cce5){_0x3b8cf7=_0x55cce5;_0x1e5ce6=0xc8;}else{_0x1e5ce6=0xce;}_0x251099[_0xa9c5('0x19')](_0x1e5ce6);return _0x251099[_0xa9c5('0x1f')](_0xa9c5('0x20'),_0x1142d9+'-'+_0x3b8cf7+'/'+_0x55cce5)[_0xa9c5('0x1a')](_0x19a43e);}return null;};}function patchUpdates(_0x54f8b9){return function(_0x1115ad){try{jsonpatch[_0xa9c5('0x21')](_0x1115ad,_0x54f8b9,!![]);}catch(_0x541c77){return BPromise['reject'](_0x541c77);}return _0x1115ad[_0xa9c5('0x22')]();};}function saveUpdates(_0x366f5c,_0x10b208){return function(_0x3b497a){if(_0x3b497a){return _0x3b497a[_0xa9c5('0x23')](_0x366f5c)[_0xa9c5('0x24')](function(_0x48e2cb){return _0x48e2cb;});}return null;};}function removeEntity(_0x4fa280,_0x3d4e1b){return function(_0x11d395){if(_0x11d395){return _0x11d395['destroy']()[_0xa9c5('0x24')](function(){_0x4fa280[_0xa9c5('0x19')](0xcc)[_0xa9c5('0x18')]();});}};}function handleEntityNotFound(_0x32fc7d,_0x4cbba1){return function(_0x40f08b){if(!_0x40f08b){_0x32fc7d[_0xa9c5('0x17')](0x194);}return _0x40f08b;};}function handleError(_0x51b64a,_0x4e8a7f){_0x4e8a7f=_0x4e8a7f||0x1f4;return function(_0x242771){logger['error'](_0x242771[_0xa9c5('0x25')]);if(_0x242771[_0xa9c5('0x26')]){delete _0x242771['name'];}_0x51b64a[_0xa9c5('0x19')](_0x4e8a7f)[_0xa9c5('0x27')](_0x242771);};}exports['index']=function(_0x413edf,_0x32baf9){var _0x198cdf={},_0x185eb8={},_0x325c65={'count':0x0,'rows':[]};var _0x4f6e70=_[_0xa9c5('0x28')](db['ScreenRecording'][_0xa9c5('0x29')],function(_0x1ef388){return{'name':_0x1ef388[_0xa9c5('0x2a')],'type':_0x1ef388['type'][_0xa9c5('0x2b')]};});_0x185eb8[_0xa9c5('0x2c')]=_['differenceBy'](_[_0xa9c5('0x28')](_0x4f6e70,_0xa9c5('0x26')),[_0xa9c5('0x2d')]);_0x185eb8[_0xa9c5('0x2e')]=_[_0xa9c5('0x2f')](_0x413edf[_0xa9c5('0x2e')]);_0x185eb8[_0xa9c5('0x30')]=_['intersection'](_0x185eb8[_0xa9c5('0x2c')],_0x185eb8[_0xa9c5('0x2e')]);_0x198cdf[_0xa9c5('0x31')]=_[_0xa9c5('0x32')](_0x185eb8[_0xa9c5('0x2c')],qs[_0xa9c5('0x33')](_0x413edf[_0xa9c5('0x2e')][_0xa9c5('0x33')]));_0x198cdf['attributes']=_0x198cdf['attributes'][_0xa9c5('0x34')]?_0x198cdf[_0xa9c5('0x31')]:_0x185eb8[_0xa9c5('0x2c')];if(!_0x413edf[_0xa9c5('0x2e')][_0xa9c5('0x35')](_0xa9c5('0x36'))){_0x198cdf['limit']=qs['limit'](_0x413edf['query'][_0xa9c5('0x1c')]);_0x198cdf[_0xa9c5('0x1e')]=qs['offset'](_0x413edf[_0xa9c5('0x2e')]['offset']);}_0x198cdf[_0xa9c5('0x37')]=qs[_0xa9c5('0x38')](_0x413edf[_0xa9c5('0x2e')][_0xa9c5('0x38')]);_0x198cdf['where']=qs[_0xa9c5('0x30')](_[_0xa9c5('0x39')](_0x413edf[_0xa9c5('0x2e')],_0x185eb8[_0xa9c5('0x30')]),_0x4f6e70);if(_0x413edf[_0xa9c5('0x2e')][_0xa9c5('0x3a')]){_0x198cdf[_0xa9c5('0x3b')]=_[_0xa9c5('0x3c')](_0x198cdf['where'],{'$or':_[_0xa9c5('0x28')](_0x4f6e70,function(_0x46e5d2){if(_0x46e5d2[_0xa9c5('0x3d')]!==_0xa9c5('0x3e')){var _0x1132e0={};_0x1132e0[_0x46e5d2[_0xa9c5('0x26')]]={'$like':'%'+_0x413edf['query'][_0xa9c5('0x3a')]+'%'};return _0x1132e0;}})});}_0x198cdf=_['merge']({},_0x198cdf,_0x413edf[_0xa9c5('0x3f')]);var _0x5c89e7={'where':_0x198cdf[_0xa9c5('0x3b')]};return db[_0xa9c5('0x40')][_0xa9c5('0x1d')](_0x5c89e7)['then'](function(_0x12e19c){_0x325c65[_0xa9c5('0x1d')]=_0x12e19c;if(_0x413edf[_0xa9c5('0x2e')][_0xa9c5('0x41')]){_0x198cdf['include']=[{'all':!![]}];}return db[_0xa9c5('0x40')][_0xa9c5('0x42')](_0x198cdf);})[_0xa9c5('0x24')](function(_0x45668e){_0x325c65[_0xa9c5('0x43')]=_0x45668e;return _0x325c65;})['then'](respondWithFilteredResult(_0x32baf9,_0x198cdf))[_0xa9c5('0x44')](handleError(_0x32baf9,null));};exports['show']=function(_0x1de605,_0x397614){var _0x2998ad={'raw':![],'where':{'id':_0x1de605[_0xa9c5('0x45')]['id']}},_0xc8fca4={};_0xc8fca4[_0xa9c5('0x2c')]=_[_0xa9c5('0x2f')](db[_0xa9c5('0x40')][_0xa9c5('0x29')]);_0xc8fca4[_0xa9c5('0x2e')]=_['keys'](_0x1de605[_0xa9c5('0x2e')]);_0xc8fca4[_0xa9c5('0x30')]=_[_0xa9c5('0x32')](_0xc8fca4[_0xa9c5('0x2c')],_0xc8fca4[_0xa9c5('0x2e')]);_0x2998ad[_0xa9c5('0x31')]=_['intersection'](_0xc8fca4[_0xa9c5('0x2c')],qs[_0xa9c5('0x33')](_0x1de605['query']['fields']));_0x2998ad['attributes']=_0x2998ad['attributes']['length']?_0x2998ad[_0xa9c5('0x31')]:_0xc8fca4[_0xa9c5('0x2c')];if(_0x1de605[_0xa9c5('0x2e')][_0xa9c5('0x41')]){_0x2998ad[_0xa9c5('0x46')]=[{'all':!![]}];}_0x2998ad=_[_0xa9c5('0x3c')]({},_0x2998ad,_0x1de605[_0xa9c5('0x3f')]);return db[_0xa9c5('0x40')][_0xa9c5('0x47')](_0x2998ad)[_0xa9c5('0x24')](handleEntityNotFound(_0x397614,null))[_0xa9c5('0x24')](respondWithResult(_0x397614,null))[_0xa9c5('0x44')](handleError(_0x397614,null));};exports[_0xa9c5('0x48')]=function(_0x4bf8b4,_0x1108f0){return db['ScreenRecording'][_0xa9c5('0x48')](_0x4bf8b4[_0xa9c5('0x49')],{})['then'](respondWithResult(_0x1108f0,0xc9))['catch'](handleError(_0x1108f0,null));};exports[_0xa9c5('0x23')]=function(_0x32e64a,_0xeb0720){if(_0x32e64a['body']['id']){delete _0x32e64a['body']['id'];}delete _0x32e64a[_0xa9c5('0x49')][_0xa9c5('0x4a')];delete _0x32e64a['body'][_0xa9c5('0x4b')];delete _0x32e64a[_0xa9c5('0x49')][_0xa9c5('0x4c')];delete _0x32e64a[_0xa9c5('0x49')][_0xa9c5('0x4d')];return db[_0xa9c5('0x40')]['find']({'where':{'id':_0x32e64a['params']['id']}})['then'](handleEntityNotFound(_0xeb0720,null))[_0xa9c5('0x24')](saveUpdates(_0x32e64a[_0xa9c5('0x49')],null))[_0xa9c5('0x24')](respondWithResult(_0xeb0720,null))[_0xa9c5('0x44')](handleError(_0xeb0720,null));};exports[_0xa9c5('0x4e')]=function(_0x15d044,_0x56bc1d){return db[_0xa9c5('0x40')][_0xa9c5('0x4e')]()[_0xa9c5('0x24')](respondWithResult(_0x56bc1d,null))[_0xa9c5('0x44')](handleError(_0x56bc1d,null));};exports[_0xa9c5('0x4f')]=function(_0x242e8a,_0x547654,_0x4fcc44){var _0x10ff6b=require('../../components/encryptor');var _0x1b158f=![];var _0x5ea9b0={};if(_0x242e8a[_0xa9c5('0x2e')][_0xa9c5('0x3d')]&&_0x242e8a[_0xa9c5('0x2e')]['type']===_0xa9c5('0x50')){_0x5ea9b0[_0xa9c5('0x50')]=_0x242e8a[_0xa9c5('0x45')]['id'];}else{_0x5ea9b0['id']=_0x242e8a[_0xa9c5('0x45')]['id'];}return db['ScreenRecording']['find']({'where':_0x5ea9b0,'attributes':['id',_0xa9c5('0x4d')],'raw':!![]})[_0xa9c5('0x24')](handleEntityNotFound(_0x547654,null))[_0xa9c5('0x24')](function(_0x5b4323){if(_0x5b4323){var _0x31e12e=path[_0xa9c5('0x51')](config[_0xa9c5('0x52')],_0xa9c5('0x53'),_0x5b4323[_0xa9c5('0x4d')]);var _0x29b198=util[_0xa9c5('0x2d')](_0xa9c5('0x54'),_0x31e12e);if(fs['existsSync'](_0x29b198)){_0x1b158f=!![];return _0x10ff6b[_0xa9c5('0x55')](_0x29b198,_0x31e12e,config['secrets'][_0xa9c5('0x56')])[_0xa9c5('0x24')](function(){return _0x5b4323;});}return _0x5b4323;}})[_0xa9c5('0x24')](function(_0x4dfe3a){if(_0x4dfe3a){var _0x4d475a=path[_0xa9c5('0x51')](config['root'],_0xa9c5('0x53'),_0x4dfe3a[_0xa9c5('0x4d')]);if(!fs[_0xa9c5('0x57')](_0x4d475a)){throw new db[(_0xa9c5('0x58'))]['ValidationError'](_0xa9c5('0x59'));}if(_0x4dfe3a[_0xa9c5('0x5a')]){return _0x547654[_0xa9c5('0x4f')](_0x4d475a,_0x4dfe3a[_0xa9c5('0x5a')]+path['extname'](_0x4d475a),function(){if(_0x1b158f){fs['unlink'](_0x4d475a);}});}else{return _0x547654[_0xa9c5('0x4f')](_0x4d475a,function(_0x3deb64){if(_0x1b158f){fs[_0xa9c5('0x5b')](_0x4d475a);}});}}})[_0xa9c5('0x44')](function(_0x279a26){if(_0x279a26[_0xa9c5('0x5c')]==='ScreenRecording\x20not\x20found'){_0x547654[_0xa9c5('0x19')](0x194)[_0xa9c5('0x27')](_0xa9c5('0x5d'));}else{return handleError(_0x547654,null);}});};exports[_0xa9c5('0x5e')]=function(_0x2b8575,_0x372ab9){return db[_0xa9c5('0x40')][_0xa9c5('0x47')]({'where':{'id':_0x2b8575[_0xa9c5('0x45')]['id']}})[_0xa9c5('0x24')](function(_0x50d438){if(_['isNil'](_0x50d438)){throw new ReferenceError(_0xa9c5('0x5f'));}return _0x50d438;})[_0xa9c5('0x24')](function(_0x3322cc){var _0x47afaa=path['join'](config[_0xa9c5('0x52')],'server/files/screen_recordings',_0x3322cc[_0xa9c5('0x4d')]);logger[_0xa9c5('0x60')](_0xa9c5('0x61'),_0x47afaa);if(!_[_0xa9c5('0x62')](_0x3322cc[_0xa9c5('0x4d')])&&fs[_0xa9c5('0x57')](_0x47afaa)){logger[_0xa9c5('0x60')](_0xa9c5('0x63')+_0x47afaa+_0xa9c5('0x64'));fs[_0xa9c5('0x65')](_0x47afaa);}_0x47afaa=_0x47afaa+_0xa9c5('0x66');if(!_[_0xa9c5('0x62')](_0x3322cc['value'])&&fs[_0xa9c5('0x57')](_0x47afaa)){logger[_0xa9c5('0x60')](_0xa9c5('0x63')+_0x47afaa+_0xa9c5('0x64'));fs[_0xa9c5('0x65')](_0x47afaa);}return _0x3322cc;})[_0xa9c5('0x24')](function(_0x28ba54){if(!_0x28ba54)throw new InternalError();return _0x28ba54['destroy']();})['then'](function(){_0x372ab9[_0xa9c5('0x19')](0xcc)['end']();})[_0xa9c5('0x44')](handleError(_0x372ab9,null));}; \ No newline at end of file +var _0xae24=['status','end','offset','undefined','limit','count','Content-Range','json','apply','reject','update','then','destroy','stack','name','send','index','map','ScreenRecording','fieldName','type','key','model','differenceBy','format','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','create','body','duration','createdAt','closedAt','find','describe','download','../../components/encryptor','uniqueid','value','join','server/files/screen_recordings','%s.cypher','existsSync','decryptFile','secrets','recording','root','Sequelize','ValidationError','ScreenRecording\x20not\x20found','filename','unlink','isNil','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','unlinkSync','.cypher','eml-format','zip-dir','request-promise','moment','util','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus'];(function(_0x2dadb9,_0x42cfe6){var _0x2f0097=function(_0x21163f){while(--_0x21163f){_0x2dadb9['push'](_0x2dadb9['shift']());}};_0x2f0097(++_0x42cfe6);}(_0xae24,0x182));var _0x4ae2=function(_0x130fae,_0x5a7e2f){_0x130fae=_0x130fae-0x0;var _0x3a4546=_0xae24[_0x130fae];return _0x3a4546;};'use strict';var emlformat=require(_0x4ae2('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x4ae2('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4ae2('0x2'));var moment=require(_0x4ae2('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x4ae2('0x4'));var path=require('path');var sox=require(_0x4ae2('0x5'));var csv=require(_0x4ae2('0x6'));var ejs=require(_0x4ae2('0x7'));var fs=require('fs');var fs_extra=require(_0x4ae2('0x8'));var _=require(_0x4ae2('0x9'));var squel=require(_0x4ae2('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x4ae2('0xb'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x4ae2('0xc'));var Redis=require(_0x4ae2('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x4ae2('0xe'));var as=require(_0x4ae2('0xf'));var hardwareService=require(_0x4ae2('0x10'));var logger=require(_0x4ae2('0x11'))('api');var utils=require(_0x4ae2('0x12'));var config=require(_0x4ae2('0x13'));var licenseUtil=require(_0x4ae2('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x25d2b4,_0x22ac1e){_0x22ac1e=_0x22ac1e||0xcc;return function(_0x30d6c4){if(_0x30d6c4){return _0x25d2b4[_0x4ae2('0x15')](_0x22ac1e);}return _0x25d2b4[_0x4ae2('0x16')](_0x22ac1e)[_0x4ae2('0x17')]();};}function respondWithResult(_0x145287,_0x3cabc9){_0x3cabc9=_0x3cabc9||0xc8;return function(_0xd527a0){if(_0xd527a0){return _0x145287['status'](_0x3cabc9)['json'](_0xd527a0);}};}function respondWithFilteredResult(_0x4d5cab,_0x2f3936){return function(_0xf834a1){if(_0xf834a1){var _0x5f447a=typeof _0x2f3936[_0x4ae2('0x18')]===_0x4ae2('0x19')&&typeof _0x2f3936[_0x4ae2('0x1a')]===_0x4ae2('0x19');var _0x428d24=_0xf834a1[_0x4ae2('0x1b')];var _0x3d4259=_0x5f447a?0x0:_0x2f3936[_0x4ae2('0x18')];var _0x41b672=_0x5f447a?_0xf834a1[_0x4ae2('0x1b')]:_0x2f3936['offset']+_0x2f3936['limit'];var _0x44a2d3;if(_0x41b672>=_0x428d24){_0x41b672=_0x428d24;_0x44a2d3=0xc8;}else{_0x44a2d3=0xce;}_0x4d5cab[_0x4ae2('0x16')](_0x44a2d3);return _0x4d5cab['set'](_0x4ae2('0x1c'),_0x3d4259+'-'+_0x41b672+'/'+_0x428d24)[_0x4ae2('0x1d')](_0xf834a1);}return null;};}function patchUpdates(_0xccb3b){return function(_0x2ad222){try{jsonpatch[_0x4ae2('0x1e')](_0x2ad222,_0xccb3b,!![]);}catch(_0x497218){return BPromise[_0x4ae2('0x1f')](_0x497218);}return _0x2ad222['save']();};}function saveUpdates(_0x522165,_0x2ceec4){return function(_0x151b70){if(_0x151b70){return _0x151b70[_0x4ae2('0x20')](_0x522165)[_0x4ae2('0x21')](function(_0xca16bf){return _0xca16bf;});}return null;};}function removeEntity(_0x526768,_0x1005e0){return function(_0x4a0ddb){if(_0x4a0ddb){return _0x4a0ddb[_0x4ae2('0x22')]()[_0x4ae2('0x21')](function(){_0x526768[_0x4ae2('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x43f112,_0x6f0cc6){return function(_0x2454b3){if(!_0x2454b3){_0x43f112[_0x4ae2('0x15')](0x194);}return _0x2454b3;};}function handleError(_0x1c2934,_0x255772){_0x255772=_0x255772||0x1f4;return function(_0x5b2e65){logger['error'](_0x5b2e65[_0x4ae2('0x23')]);if(_0x5b2e65[_0x4ae2('0x24')]){delete _0x5b2e65[_0x4ae2('0x24')];}_0x1c2934[_0x4ae2('0x16')](_0x255772)[_0x4ae2('0x25')](_0x5b2e65);};}exports[_0x4ae2('0x26')]=function(_0x57a377,_0x5ec1fd){var _0x3e2666={},_0x4e7741={},_0x554cff={'count':0x0,'rows':[]};var _0x5e9f03=_[_0x4ae2('0x27')](db[_0x4ae2('0x28')]['rawAttributes'],function(_0x883fd5){return{'name':_0x883fd5[_0x4ae2('0x29')],'type':_0x883fd5[_0x4ae2('0x2a')][_0x4ae2('0x2b')]};});_0x4e7741[_0x4ae2('0x2c')]=_[_0x4ae2('0x2d')](_[_0x4ae2('0x27')](_0x5e9f03,_0x4ae2('0x24')),[_0x4ae2('0x2e')]);_0x4e7741[_0x4ae2('0x2f')]=_[_0x4ae2('0x30')](_0x57a377[_0x4ae2('0x2f')]);_0x4e7741[_0x4ae2('0x31')]=_[_0x4ae2('0x32')](_0x4e7741[_0x4ae2('0x2c')],_0x4e7741[_0x4ae2('0x2f')]);_0x3e2666[_0x4ae2('0x33')]=_['intersection'](_0x4e7741[_0x4ae2('0x2c')],qs['fields'](_0x57a377[_0x4ae2('0x2f')][_0x4ae2('0x34')]));_0x3e2666['attributes']=_0x3e2666[_0x4ae2('0x33')][_0x4ae2('0x35')]?_0x3e2666[_0x4ae2('0x33')]:_0x4e7741[_0x4ae2('0x2c')];if(!_0x57a377['query'][_0x4ae2('0x36')](_0x4ae2('0x37'))){_0x3e2666[_0x4ae2('0x1a')]=qs[_0x4ae2('0x1a')](_0x57a377[_0x4ae2('0x2f')][_0x4ae2('0x1a')]);_0x3e2666[_0x4ae2('0x18')]=qs[_0x4ae2('0x18')](_0x57a377[_0x4ae2('0x2f')]['offset']);}_0x3e2666[_0x4ae2('0x38')]=qs['sort'](_0x57a377[_0x4ae2('0x2f')][_0x4ae2('0x39')]);_0x3e2666[_0x4ae2('0x3a')]=qs[_0x4ae2('0x31')](_[_0x4ae2('0x3b')](_0x57a377[_0x4ae2('0x2f')],_0x4e7741['filters']),_0x5e9f03);if(_0x57a377[_0x4ae2('0x2f')][_0x4ae2('0x3c')]){_0x3e2666[_0x4ae2('0x3a')]=_[_0x4ae2('0x3d')](_0x3e2666['where'],{'$or':_[_0x4ae2('0x27')](_0x5e9f03,function(_0x34a784){if(_0x34a784[_0x4ae2('0x2a')]!==_0x4ae2('0x3e')){var _0x232243={};_0x232243[_0x34a784[_0x4ae2('0x24')]]={'$like':'%'+_0x57a377[_0x4ae2('0x2f')][_0x4ae2('0x3c')]+'%'};return _0x232243;}})});}_0x3e2666=_[_0x4ae2('0x3d')]({},_0x3e2666,_0x57a377[_0x4ae2('0x3f')]);var _0x2aaef1={'where':_0x3e2666['where']};return db[_0x4ae2('0x28')][_0x4ae2('0x1b')](_0x2aaef1)[_0x4ae2('0x21')](function(_0x1473e6){_0x554cff['count']=_0x1473e6;if(_0x57a377['query'][_0x4ae2('0x40')]){_0x3e2666[_0x4ae2('0x41')]=[{'all':!![]}];}return db[_0x4ae2('0x28')][_0x4ae2('0x42')](_0x3e2666);})['then'](function(_0x3c0a56){_0x554cff[_0x4ae2('0x43')]=_0x3c0a56;return _0x554cff;})['then'](respondWithFilteredResult(_0x5ec1fd,_0x3e2666))[_0x4ae2('0x44')](handleError(_0x5ec1fd,null));};exports[_0x4ae2('0x45')]=function(_0x11a5d9,_0x5a9126){var _0x2f6431={'raw':![],'where':{'id':_0x11a5d9[_0x4ae2('0x46')]['id']}},_0x29e12c={};_0x29e12c[_0x4ae2('0x2c')]=_[_0x4ae2('0x30')](db[_0x4ae2('0x28')][_0x4ae2('0x47')]);_0x29e12c[_0x4ae2('0x2f')]=_['keys'](_0x11a5d9[_0x4ae2('0x2f')]);_0x29e12c[_0x4ae2('0x31')]=_['intersection'](_0x29e12c[_0x4ae2('0x2c')],_0x29e12c[_0x4ae2('0x2f')]);_0x2f6431['attributes']=_[_0x4ae2('0x32')](_0x29e12c[_0x4ae2('0x2c')],qs['fields'](_0x11a5d9[_0x4ae2('0x2f')][_0x4ae2('0x34')]));_0x2f6431[_0x4ae2('0x33')]=_0x2f6431['attributes']['length']?_0x2f6431[_0x4ae2('0x33')]:_0x29e12c[_0x4ae2('0x2c')];if(_0x11a5d9[_0x4ae2('0x2f')][_0x4ae2('0x40')]){_0x2f6431['include']=[{'all':!![]}];}_0x2f6431=_[_0x4ae2('0x3d')]({},_0x2f6431,_0x11a5d9[_0x4ae2('0x3f')]);return db[_0x4ae2('0x28')]['find'](_0x2f6431)[_0x4ae2('0x21')](handleEntityNotFound(_0x5a9126,null))[_0x4ae2('0x21')](respondWithResult(_0x5a9126,null))[_0x4ae2('0x44')](handleError(_0x5a9126,null));};exports['create']=function(_0x16bf0b,_0x24ec08){return db[_0x4ae2('0x28')][_0x4ae2('0x48')](_0x16bf0b[_0x4ae2('0x49')],{})[_0x4ae2('0x21')](respondWithResult(_0x24ec08,0xc9))[_0x4ae2('0x44')](handleError(_0x24ec08,null));};exports[_0x4ae2('0x20')]=function(_0x3a6110,_0xf6d12a){if(_0x3a6110['body']['id']){delete _0x3a6110[_0x4ae2('0x49')]['id'];}delete _0x3a6110[_0x4ae2('0x49')][_0x4ae2('0x4a')];delete _0x3a6110[_0x4ae2('0x49')][_0x4ae2('0x4b')];delete _0x3a6110[_0x4ae2('0x49')][_0x4ae2('0x4c')];delete _0x3a6110[_0x4ae2('0x49')]['value'];return db[_0x4ae2('0x28')][_0x4ae2('0x4d')]({'where':{'id':_0x3a6110['params']['id']}})[_0x4ae2('0x21')](handleEntityNotFound(_0xf6d12a,null))[_0x4ae2('0x21')](saveUpdates(_0x3a6110['body'],null))[_0x4ae2('0x21')](respondWithResult(_0xf6d12a,null))['catch'](handleError(_0xf6d12a,null));};exports[_0x4ae2('0x4e')]=function(_0x5e1c80,_0x1ae8bb){return db[_0x4ae2('0x28')][_0x4ae2('0x4e')]()[_0x4ae2('0x21')](respondWithResult(_0x1ae8bb,null))[_0x4ae2('0x44')](handleError(_0x1ae8bb,null));};exports[_0x4ae2('0x4f')]=function(_0x201260,_0xf77b17,_0x28de70){var _0x529355=require(_0x4ae2('0x50'));var _0x4284b4=![];var _0x825c3a={};if(_0x201260[_0x4ae2('0x2f')]['type']&&_0x201260[_0x4ae2('0x2f')][_0x4ae2('0x2a')]===_0x4ae2('0x51')){_0x825c3a['uniqueid']=_0x201260['params']['id'];}else{_0x825c3a['id']=_0x201260[_0x4ae2('0x46')]['id'];}return db[_0x4ae2('0x28')][_0x4ae2('0x4d')]({'where':_0x825c3a,'attributes':['id',_0x4ae2('0x52')],'raw':!![]})[_0x4ae2('0x21')](handleEntityNotFound(_0xf77b17,null))[_0x4ae2('0x21')](function(_0x18a8e6){if(_0x18a8e6){var _0x390c1f=path[_0x4ae2('0x53')](config['root'],_0x4ae2('0x54'),_0x18a8e6['value']);var _0x11f028=util[_0x4ae2('0x2e')](_0x4ae2('0x55'),_0x390c1f);if(fs[_0x4ae2('0x56')](_0x11f028)){_0x4284b4=!![];return _0x529355[_0x4ae2('0x57')](_0x11f028,_0x390c1f,config[_0x4ae2('0x58')][_0x4ae2('0x59')])[_0x4ae2('0x21')](function(){return _0x18a8e6;});}return _0x18a8e6;}})['then'](function(_0x496f98){if(_0x496f98){var _0x33fb77=path[_0x4ae2('0x53')](config[_0x4ae2('0x5a')],'server/files/screen_recordings',_0x496f98['value']);if(!fs[_0x4ae2('0x56')](_0x33fb77)){throw new db[(_0x4ae2('0x5b'))][(_0x4ae2('0x5c'))](_0x4ae2('0x5d'));}if(_0x496f98[_0x4ae2('0x5e')]){return _0xf77b17['download'](_0x33fb77,_0x496f98['filename']+path['extname'](_0x33fb77),function(){if(_0x4284b4){fs[_0x4ae2('0x5f')](_0x33fb77);}});}else{return _0xf77b17['download'](_0x33fb77,function(_0x4e54d1){if(_0x4284b4){fs[_0x4ae2('0x5f')](_0x33fb77);}});}}})['catch'](function(_0x3efbaf){if(_0x3efbaf['message']===_0x4ae2('0x5d')){_0xf77b17['status'](0x194)[_0x4ae2('0x25')]('Not\x20found');}else{return handleError(_0xf77b17,null);}});};exports[_0x4ae2('0x22')]=function(_0x981338,_0x3f46f3){return db[_0x4ae2('0x28')][_0x4ae2('0x4d')]({'where':{'id':_0x981338['params']['id']}})['then'](function(_0x344963){if(_[_0x4ae2('0x60')](_0x344963)){throw new ReferenceError('Entity\x20not\x20found');}return _0x344963;})[_0x4ae2('0x21')](function(_0x29183d){var _0x517800=path[_0x4ae2('0x53')](config[_0x4ae2('0x5a')],'server/files/screen_recordings',_0x29183d['value']);logger[_0x4ae2('0x61')](_0x4ae2('0x62'),_0x517800);if(!_['isNil'](_0x29183d[_0x4ae2('0x52')])&&fs[_0x4ae2('0x56')](_0x517800)){logger[_0x4ae2('0x61')](_0x4ae2('0x63')+_0x517800+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0x4ae2('0x64')](_0x517800);}_0x517800=_0x517800+_0x4ae2('0x65');if(!_['isNil'](_0x29183d[_0x4ae2('0x52')])&&fs[_0x4ae2('0x56')](_0x517800)){logger[_0x4ae2('0x61')]('File:\x20\x22'+_0x517800+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0x4ae2('0x64')](_0x517800);}return _0x29183d;})['then'](function(_0x3f24bb){if(!_0x3f24bb)throw new InternalError();return _0x3f24bb['destroy']();})[_0x4ae2('0x21')](function(){_0x3f46f3['status'](0xcc)[_0x4ae2('0x17')]();})['catch'](handleError(_0x3f46f3,null));}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.model.js b/server/api/screenRecording/screenRecording.model.js index a76bd7e..89afc1b 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 _0xdd6e=['../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./screenRecording.attributes','exports','define','ScreenRecording','screen_recordings','interactionid','util'];(function(_0x2b4411,_0x2625ed){var _0x8e41ef=function(_0x2aa8c1){while(--_0x2aa8c1){_0x2b4411['push'](_0x2b4411['shift']());}};_0x8e41ef(++_0x2625ed);}(_0xdd6e,0x1e9));var _0xedd6=function(_0xbf8202,_0x2ecb88){_0xbf8202=_0xbf8202-0x0;var _0x44d913=_0xdd6e[_0xbf8202];return _0x44d913;};'use strict';var _=require('lodash');var util=require(_0xedd6('0x0'));var logger=require(_0xedd6('0x1'))(_0xedd6('0x2'));var moment=require(_0xedd6('0x3'));var BPromise=require(_0xedd6('0x4'));var rp=require(_0xedd6('0x5'));var fs=require('fs');var path=require(_0xedd6('0x6'));var rimraf=require('rimraf');var config=require(_0xedd6('0x7'));var attributes=require(_0xedd6('0x8'));module[_0xedd6('0x9')]=function(_0x2e70c1,_0x3d4a5e){return _0x2e70c1[_0xedd6('0xa')](_0xedd6('0xb'),attributes,{'tableName':_0xedd6('0xc'),'paranoid':![],'indexes':[{'name':_0xedd6('0xd'),'fields':[_0xedd6('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xe8a3=['request-promise','path','../../config/environment','./screenRecording.attributes','exports','define','screen_recordings','util','../../config/logger','api','moment','bluebird'];(function(_0x4b4cea,_0x13a17a){var _0x3aa234=function(_0x36cf44){while(--_0x36cf44){_0x4b4cea['push'](_0x4b4cea['shift']());}};_0x3aa234(++_0x13a17a);}(_0xe8a3,0x67));var _0x3e8a=function(_0x23fcad,_0x2b4c2e){_0x23fcad=_0x23fcad-0x0;var _0x3e4d60=_0xe8a3[_0x23fcad];return _0x3e4d60;};'use strict';var _=require('lodash');var util=require(_0x3e8a('0x0'));var logger=require(_0x3e8a('0x1'))(_0x3e8a('0x2'));var moment=require(_0x3e8a('0x3'));var BPromise=require(_0x3e8a('0x4'));var rp=require(_0x3e8a('0x5'));var fs=require('fs');var path=require(_0x3e8a('0x6'));var rimraf=require('rimraf');var config=require(_0x3e8a('0x7'));var attributes=require(_0x3e8a('0x8'));module[_0x3e8a('0x9')]=function(_0x43af29,_0x1b922b){return _0x43af29[_0x3e8a('0xa')]('ScreenRecording',attributes,{'tableName':_0x3e8a('0xb'),'paranoid':![],'indexes':[{'name':'interactionid','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 beaccf5..4d42372 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 _0x26ca=['request\x20sent','error','code','message','info','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','ScreenRecording,\x20%s,\x20%s','debug','ScreenRecording,\x20%s,\x20%s,\x20%s'];(function(_0x48db81,_0x5b820a){var _0x31379a=function(_0x402cce){while(--_0x402cce){_0x48db81['push'](_0x48db81['shift']());}};_0x31379a(++_0x5b820a);}(_0x26ca,0x12c));var _0xa26c=function(_0x2c7dc6,_0x3c4ce0){_0x2c7dc6=_0x2c7dc6-0x0;var _0x10002b=_0x26ca[_0x2c7dc6];return _0x10002b;};'use strict';var _=require(_0xa26c('0x0'));var util=require('util');var moment=require(_0xa26c('0x1'));var BPromise=require('bluebird');var rs=require(_0xa26c('0x2'));var fs=require('fs');var Redis=require(_0xa26c('0x3'));var db=require(_0xa26c('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xa26c('0x5'))(_0xa26c('0x6'));var config=require(_0xa26c('0x7'));var jayson=require(_0xa26c('0x8'));var client=jayson[_0xa26c('0x9')][_0xa26c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5ec712,_0x4bc53f,_0x398778){return new BPromise(function(_0x2e85a5,_0x509f66){return client['request'](_0x5ec712,_0x398778)[_0xa26c('0xb')](function(_0x15b77a){logger['info'](_0xa26c('0xc'),_0x4bc53f,'request\x20sent');logger[_0xa26c('0xd')](_0xa26c('0xe'),_0x4bc53f,_0xa26c('0xf'),JSON['stringify'](_0x15b77a));if(_0x15b77a[_0xa26c('0x10')]){if(_0x15b77a['error'][_0xa26c('0x11')]===0x1f4){logger[_0xa26c('0x10')](_0xa26c('0xc'),_0x4bc53f,_0x15b77a[_0xa26c('0x10')]['message']);return _0x509f66(_0x15b77a[_0xa26c('0x10')][_0xa26c('0x12')]);}logger[_0xa26c('0x10')]('ScreenRecording,\x20%s,\x20%s',_0x4bc53f,_0x15b77a[_0xa26c('0x10')][_0xa26c('0x12')]);return _0x2e85a5(_0x15b77a[_0xa26c('0x10')][_0xa26c('0x12')]);}else{logger[_0xa26c('0x13')](_0xa26c('0xc'),_0x4bc53f,_0xa26c('0xf'));_0x2e85a5(_0x15b77a['result'][_0xa26c('0x12')]);}})[_0xa26c('0x14')](function(_0xd62dbf){logger[_0xa26c('0x10')](_0xa26c('0xc'),_0x4bc53f,_0xd62dbf);_0x509f66(_0xd62dbf);});});} \ No newline at end of file +var _0xa45a=['result','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ScreenRecording,\x20%s,\x20%s','request\x20sent','debug','ScreenRecording,\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);}(_0xa45a,0x1c9));var _0xaa45=function(_0xbc82fb,_0x313c22){_0xbc82fb=_0xbc82fb-0x0;var _0x5d293e=_0xa45a[_0xbc82fb];return _0x5d293e;};'use strict';var _=require(_0xaa45('0x0'));var util=require(_0xaa45('0x1'));var moment=require(_0xaa45('0x2'));var BPromise=require(_0xaa45('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xaa45('0x4'));var db=require(_0xaa45('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xaa45('0x6'))(_0xaa45('0x7'));var config=require(_0xaa45('0x8'));var jayson=require(_0xaa45('0x9'));var client=jayson[_0xaa45('0xa')][_0xaa45('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5d34d6,_0x3bbbba,_0x542a9b){return new BPromise(function(_0x143315,_0xfeac0c){return client[_0xaa45('0xc')](_0x5d34d6,_0x542a9b)[_0xaa45('0xd')](function(_0xa2aad8){logger[_0xaa45('0xe')](_0xaa45('0xf'),_0x3bbbba,_0xaa45('0x10'));logger[_0xaa45('0x11')](_0xaa45('0x12'),_0x3bbbba,'request\x20sent',JSON[_0xaa45('0x13')](_0xa2aad8));if(_0xa2aad8['error']){if(_0xa2aad8[_0xaa45('0x14')][_0xaa45('0x15')]===0x1f4){logger[_0xaa45('0x14')]('ScreenRecording,\x20%s,\x20%s',_0x3bbbba,_0xa2aad8[_0xaa45('0x14')][_0xaa45('0x16')]);return _0xfeac0c(_0xa2aad8[_0xaa45('0x14')][_0xaa45('0x16')]);}logger[_0xaa45('0x14')](_0xaa45('0xf'),_0x3bbbba,_0xa2aad8['error']['message']);return _0x143315(_0xa2aad8[_0xaa45('0x14')][_0xaa45('0x16')]);}else{logger['info'](_0xaa45('0xf'),_0x3bbbba,_0xaa45('0x10'));_0x143315(_0xa2aad8[_0xaa45('0x17')][_0xaa45('0x16')]);}})['catch'](function(_0x3af433){logger[_0xaa45('0x14')](_0xaa45('0xf'),_0x3bbbba,_0x3af433);_0xfeac0c(_0x3af433);});});} \ No newline at end of file diff --git a/server/api/setting/index.js b/server/api/setting/index.js index 99c8aa5..f2c5154 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 _0x4f81=['originalname','post','addLogo','join','%s%s','logologin','single','file','addLogoLogin','addPreferred','favicon','/:id/favicon','addFavicon','put','isAuthenticated','exports','multer','util','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./setting.controller','get','index','/now','getDate','show','/:id/logo','getLogo','/:id/logo_login','getLogoLogin','/:id/gdpr','gdpr','/:id/preferred','getPreferred','getFavicon','diskStorage','root','server/files/images/logos/','format','extname'];(function(_0x3e30b9,_0x2432f6){var _0x1af0a=function(_0x5e6698){while(--_0x5e6698){_0x3e30b9['push'](_0x3e30b9['shift']());}};_0x1af0a(++_0x2432f6);}(_0x4f81,0x118));var _0x14f8=function(_0x380fd3,_0x4207a1){_0x380fd3=_0x380fd3-0x0;var _0x287b9d=_0x4f81[_0x380fd3];return _0x287b9d;};'use strict';var multer=require(_0x14f8('0x0'));var util=require(_0x14f8('0x1'));var path=require(_0x14f8('0x2'));var timeout=require('connect-timeout');var express=require(_0x14f8('0x3'));var router=express[_0x14f8('0x4')]();var fs_extra=require(_0x14f8('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x14f8('0x6'));var config=require(_0x14f8('0x7'));var controller=require(_0x14f8('0x8'));router[_0x14f8('0x9')]('/',auth['isAuthenticated'](),controller[_0x14f8('0xa')]);router[_0x14f8('0x9')](_0x14f8('0xb'),controller[_0x14f8('0xc')]);router[_0x14f8('0x9')]('/:id',controller[_0x14f8('0xd')]);router[_0x14f8('0x9')](_0x14f8('0xe'),controller[_0x14f8('0xf')]);router[_0x14f8('0x9')](_0x14f8('0x10'),controller[_0x14f8('0x11')]);router[_0x14f8('0x9')](_0x14f8('0x12'),controller[_0x14f8('0x13')]);router['get'](_0x14f8('0x14'),controller[_0x14f8('0x15')]);router[_0x14f8('0x9')]('/:id/favicon',controller[_0x14f8('0x16')]);var upload=multer({'storage':multer[_0x14f8('0x17')]({'destination':function(_0x24e6f9,_0x3e78af,_0x1d71ce){_0x1d71ce(null,path['join'](config[_0x14f8('0x18')],_0x14f8('0x19')));},'filename':function(_0x2adeef,_0x2b23d1,_0x342009){_0x342009(null,util[_0x14f8('0x1a')]('%s%s','logo',path[_0x14f8('0x1b')](_0x2b23d1[_0x14f8('0x1c')])));}})});router[_0x14f8('0x1d')](_0x14f8('0xe'),upload['single']('file'),controller[_0x14f8('0x1e')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0xca090d,_0x57471c,_0xe49a88){_0xe49a88(null,path[_0x14f8('0x1f')](config[_0x14f8('0x18')],_0x14f8('0x19')));},'filename':function(_0x122e19,_0x5d611d,_0x587464){_0x587464(null,util[_0x14f8('0x1a')](_0x14f8('0x20'),_0x14f8('0x21'),path[_0x14f8('0x1b')](_0x5d611d[_0x14f8('0x1c')])));}})});router[_0x14f8('0x1d')](_0x14f8('0x10'),upload[_0x14f8('0x22')](_0x14f8('0x23')),controller[_0x14f8('0x24')]);var upload=multer({'storage':multer[_0x14f8('0x17')]({'destination':function(_0x4499b0,_0x50789f,_0x34d532){_0x34d532(null,path['join'](config[_0x14f8('0x18')],_0x14f8('0x19')));},'filename':function(_0x9c7ec3,_0x372935,_0x5ecb74){_0x5ecb74(null,util['format'](_0x14f8('0x20'),'preferred',path['extname'](_0x372935['originalname'])));}})});router[_0x14f8('0x1d')](_0x14f8('0x14'),upload['single'](_0x14f8('0x23')),controller[_0x14f8('0x25')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x1a32bc,_0x525f3b,_0x572566){_0x572566(null,path['join'](config[_0x14f8('0x18')],_0x14f8('0x19')));},'filename':function(_0x8e58ba,_0x5ce179,_0x528a96){_0x528a96(null,util['format'](_0x14f8('0x20'),_0x14f8('0x26'),path['extname'](_0x5ce179[_0x14f8('0x1c')])));}})});router['post'](_0x14f8('0x27'),upload[_0x14f8('0x22')](_0x14f8('0x23')),controller[_0x14f8('0x28')]);router[_0x14f8('0x29')]('/:id',auth[_0x14f8('0x2a')](),controller['update']);module[_0x14f8('0x2b')]=router; \ No newline at end of file +var _0xdbf0=['logo','extname','originalname','post','/:id/logo','single','file','addLogo','format','logologin','/:id/logo_login','addLogoLogin','addPreferred','favicon','/:id/favicon','addFavicon','put','multer','util','connect-timeout','Router','../../components/auth/service','../../config/environment','./setting.controller','get','isAuthenticated','getDate','/:id','getLogo','getLogoLogin','gdpr','/:id/preferred','getFavicon','diskStorage','join','root','server/files/images/logos/','%s%s'];(function(_0x1574c5,_0x107f22){var _0x3cf252=function(_0x3547dc){while(--_0x3547dc){_0x1574c5['push'](_0x1574c5['shift']());}};_0x3cf252(++_0x107f22);}(_0xdbf0,0x1b3));var _0x0dbf=function(_0x3e5086,_0x48f4a2){_0x3e5086=_0x3e5086-0x0;var _0xfeb102=_0xdbf0[_0x3e5086];return _0xfeb102;};'use strict';var multer=require(_0x0dbf('0x0'));var util=require(_0x0dbf('0x1'));var path=require('path');var timeout=require(_0x0dbf('0x2'));var express=require('express');var router=express[_0x0dbf('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0dbf('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x0dbf('0x5'));var controller=require(_0x0dbf('0x6'));router[_0x0dbf('0x7')]('/',auth[_0x0dbf('0x8')](),controller['index']);router[_0x0dbf('0x7')]('/now',controller[_0x0dbf('0x9')]);router[_0x0dbf('0x7')](_0x0dbf('0xa'),controller['show']);router[_0x0dbf('0x7')]('/:id/logo',controller[_0x0dbf('0xb')]);router['get']('/:id/logo_login',controller[_0x0dbf('0xc')]);router[_0x0dbf('0x7')]('/:id/gdpr',controller[_0x0dbf('0xd')]);router[_0x0dbf('0x7')](_0x0dbf('0xe'),controller['getPreferred']);router[_0x0dbf('0x7')]('/:id/favicon',controller[_0x0dbf('0xf')]);var upload=multer({'storage':multer[_0x0dbf('0x10')]({'destination':function(_0x3f792a,_0x17a793,_0x401ea0){_0x401ea0(null,path[_0x0dbf('0x11')](config[_0x0dbf('0x12')],_0x0dbf('0x13')));},'filename':function(_0x3122f5,_0x1e2ce4,_0x81f1b6){_0x81f1b6(null,util['format'](_0x0dbf('0x14'),_0x0dbf('0x15'),path[_0x0dbf('0x16')](_0x1e2ce4[_0x0dbf('0x17')])));}})});router[_0x0dbf('0x18')](_0x0dbf('0x19'),upload[_0x0dbf('0x1a')](_0x0dbf('0x1b')),controller[_0x0dbf('0x1c')]);var upload=multer({'storage':multer[_0x0dbf('0x10')]({'destination':function(_0x13d1c1,_0x28a13d,_0x4d711a){_0x4d711a(null,path['join'](config[_0x0dbf('0x12')],'server/files/images/logos/'));},'filename':function(_0x46d201,_0x344ebb,_0xbcac83){_0xbcac83(null,util[_0x0dbf('0x1d')](_0x0dbf('0x14'),_0x0dbf('0x1e'),path[_0x0dbf('0x16')](_0x344ebb[_0x0dbf('0x17')])));}})});router[_0x0dbf('0x18')](_0x0dbf('0x1f'),upload[_0x0dbf('0x1a')](_0x0dbf('0x1b')),controller[_0x0dbf('0x20')]);var upload=multer({'storage':multer[_0x0dbf('0x10')]({'destination':function(_0x2981e8,_0x2d250e,_0x1e98e9){_0x1e98e9(null,path[_0x0dbf('0x11')](config['root'],'server/files/images/logos/'));},'filename':function(_0x3ffb87,_0x36427c,_0x2e4aa6){_0x2e4aa6(null,util['format'](_0x0dbf('0x14'),'preferred',path['extname'](_0x36427c[_0x0dbf('0x17')])));}})});router[_0x0dbf('0x18')]('/:id/preferred',upload[_0x0dbf('0x1a')](_0x0dbf('0x1b')),controller[_0x0dbf('0x21')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x2b1713,_0x6d9e49,_0x19413a){_0x19413a(null,path[_0x0dbf('0x11')](config[_0x0dbf('0x12')],'server/files/images/logos/'));},'filename':function(_0x2e5963,_0x47d44d,_0x36d689){_0x36d689(null,util[_0x0dbf('0x1d')]('%s%s',_0x0dbf('0x22'),path[_0x0dbf('0x16')](_0x47d44d['originalname'])));}})});router[_0x0dbf('0x18')](_0x0dbf('0x23'),upload[_0x0dbf('0x1a')](_0x0dbf('0x1b')),controller[_0x0dbf('0x24')]);router[_0x0dbf('0x25')](_0x0dbf('0xa'),auth['isAuthenticated'](),controller['update']);module['exports']=router; \ No newline at end of file diff --git a/server/api/setting/setting.attributes.js b/server/api/setting/setting.attributes.js index e7f1142..fdf455a 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 _0xa2cb=['exports','min_internal','INTEGER','min_mailbox','STRING','BOOLEAN','alternate','UNSIGNED','sequelize'];(function(_0x30b10a,_0x506695){var _0x160fd3=function(_0x479d54){while(--_0x479d54){_0x30b10a['push'](_0x30b10a['shift']());}};_0x160fd3(++_0x506695);}(_0xa2cb,0x7d));var _0xba2c=function(_0x13885f,_0x4ba84e){_0x13885f=_0x13885f-0x0;var _0x192362=_0xa2cb[_0x13885f];return _0x192362;};'use strict';var Sequelize=require(_0xba2c('0x0'));module[_0xba2c('0x1')]={'min_internal':{'type':Sequelize['INTEGER'](0xb),'unique':_0xba2c('0x2'),'defaultValue':0x3e8},'min_mailbox':{'type':Sequelize[_0xba2c('0x3')](0xb),'unique':_0xba2c('0x4'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize[_0xba2c('0x3')](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0xba2c('0x5')],'defaultValue':'/var/opt/motion2/server/files/sounds/converted'},'logo':{'type':Sequelize['STRING']},'defaultLogo':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'loginLogo':{'type':Sequelize['STRING']},'defaultLoginLogo':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0xba2c('0x5')]},'defaultHeaderWhiteLabel':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0xba2c('0x6')],'defaultValue':!![]},'firstSetup':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'stunaddr':{'type':Sequelize[_0xba2c('0x5')]},'turnaddr':{'type':Sequelize[_0xba2c('0x5')]},'turnusername':{'type':Sequelize['STRING']},'turnpassword':{'type':Sequelize[_0xba2c('0x5')]},'pageTitle':{'type':Sequelize[_0xba2c('0x5')]},'defaultPageTitle':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0xba2c('0x6')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0xba2c('0x3')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0xba2c('0x6')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0xba2c('0x5')],'defaultValue':'https://www.xcally.com/bar/phonebar/autoupdater.xml'},'enableEmailPreview':{'type':Sequelize[_0xba2c('0x6')],'defaultValue':![]},'split':{'type':Sequelize[_0xba2c('0x6')],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize[_0xba2c('0x3')],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0xba2c('0x3')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0xba2c('0x3')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0xba2c('0x5')],'defaultValue':_0xba2c('0x7')},'chatTimeout':{'type':Sequelize[_0xba2c('0x3')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0xba2c('0x6')],'defaultValue':!![]},'preferred':{'type':Sequelize[_0xba2c('0x5')]},'defaultPreferred':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0xba2c('0x6')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0xba2c('0x5')]},'allowedLoginAttempts':{'type':Sequelize[_0xba2c('0x3')],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0xba2c('0x3')],'defaultValue':0xa},'favicon':{'type':Sequelize[_0xba2c('0x5')]},'defaultFavicon':{'type':Sequelize[_0xba2c('0x6')],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize[_0xba2c('0x3')],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize[_0xba2c('0x6')],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize[_0xba2c('0x6')],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize['INTEGER']},'transcribeRegion':{'type':Sequelize[_0xba2c('0x5')]},'sentiment':{'type':Sequelize[_0xba2c('0x6')],'defaultValue':![]},'automaticSentiment':{'type':Sequelize[_0xba2c('0x6')],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0xba2c('0x3')]},'sentimentRegion':{'type':Sequelize[_0xba2c('0x5')]},'language':{'type':Sequelize['STRING']},'bucket':{'type':Sequelize[_0xba2c('0x5')]},'googleSsoEnabled':{'type':Sequelize[_0xba2c('0x6')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize['INTEGER'](0x2)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'privacyPolicyEmail':{'type':Sequelize[_0xba2c('0x3')](0x2)[_0xba2c('0x8')],'defaultValue':0x0},'privacyPolicyName':{'type':Sequelize[_0xba2c('0x3')](0x2)[_0xba2c('0x8')],'defaultValue':0x0},'privacyPolicyNumber':{'type':Sequelize[_0xba2c('0x3')](0x2)[_0xba2c('0x8')],'defaultValue':0x0},'searchOnEnterKey':{'type':Sequelize[_0xba2c('0x6')],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize[_0xba2c('0x3')],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize[_0xba2c('0x3')],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize[_0xba2c('0x3')],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize[_0xba2c('0x3')],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize[_0xba2c('0x3')],'defaultValue':0x0},'stopRecordingOnTransfer':{'type':Sequelize[_0xba2c('0x6')],'defaultValue':![]},'secureCookieEnabled':{'type':Sequelize[_0xba2c('0x6')],'defaultValue':!![]},'viewHelpSection':{'type':Sequelize[_0xba2c('0x6')],'defaultValue':!![]},'previewRecallmeReminderInterval':{'type':Sequelize[_0xba2c('0x3')],'defaultValue':0x5},'disabledCookie':{'type':Sequelize[_0xba2c('0x6')],'defaultValue':![]},'limitTabs':{'type':Sequelize[_0xba2c('0x3')],'defaultValue':0x14}}; \ No newline at end of file +var _0x1724=['BOOLEAN','https://www.xcally.com/bar/phonebar/autoupdater.xml','alternate','UNSIGNED','sequelize','INTEGER','min_internal','/var/opt/motion2/server/files/sounds/converted','STRING'];(function(_0x3f2303,_0x34167b){var _0x1d916e=function(_0x5a5b96){while(--_0x5a5b96){_0x3f2303['push'](_0x3f2303['shift']());}};_0x1d916e(++_0x34167b);}(_0x1724,0xca));var _0x4172=function(_0x3899d1,_0x4aa04c){_0x3899d1=_0x3899d1-0x0;var _0xeb4a7d=_0x1724[_0x3899d1];return _0xeb4a7d;};'use strict';var Sequelize=require(_0x4172('0x0'));module['exports']={'min_internal':{'type':Sequelize[_0x4172('0x1')](0xb),'unique':_0x4172('0x2'),'defaultValue':0x3e8},'min_mailbox':{'type':Sequelize[_0x4172('0x1')](0xb),'unique':'min_mailbox','defaultValue':0x3e8},'agi_port':{'type':Sequelize[_0x4172('0x1')](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize['STRING'],'defaultValue':_0x4172('0x3')},'logo':{'type':Sequelize[_0x4172('0x4')]},'defaultLogo':{'type':Sequelize[_0x4172('0x5')],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0x4172('0x4')]},'defaultLoginLogo':{'type':Sequelize[_0x4172('0x5')],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize['STRING']},'defaultHeaderWhiteLabel':{'type':Sequelize[_0x4172('0x5')],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0x4172('0x5')],'defaultValue':!![]},'firstSetup':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'stunaddr':{'type':Sequelize[_0x4172('0x4')]},'turnaddr':{'type':Sequelize[_0x4172('0x4')]},'turnusername':{'type':Sequelize[_0x4172('0x4')]},'turnpassword':{'type':Sequelize[_0x4172('0x4')]},'pageTitle':{'type':Sequelize[_0x4172('0x4')]},'defaultPageTitle':{'type':Sequelize[_0x4172('0x5')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0x4172('0x1')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0x4172('0x5')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0x4172('0x4')],'defaultValue':_0x4172('0x6')},'enableEmailPreview':{'type':Sequelize[_0x4172('0x5')],'defaultValue':![]},'split':{'type':Sequelize[_0x4172('0x5')],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize[_0x4172('0x1')],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0x4172('0x1')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0x4172('0x1')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0x4172('0x4')],'defaultValue':_0x4172('0x7')},'chatTimeout':{'type':Sequelize[_0x4172('0x1')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0x4172('0x5')],'defaultValue':!![]},'preferred':{'type':Sequelize['STRING']},'defaultPreferred':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0x4172('0x5')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0x4172('0x4')]},'allowedLoginAttempts':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0x4172('0x1')],'defaultValue':0xa},'favicon':{'type':Sequelize[_0x4172('0x4')]},'defaultFavicon':{'type':Sequelize[_0x4172('0x5')],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize[_0x4172('0x1')],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize[_0x4172('0x5')],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize[_0x4172('0x1')]},'transcribeRegion':{'type':Sequelize[_0x4172('0x4')]},'sentiment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'automaticSentiment':{'type':Sequelize[_0x4172('0x5')],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0x4172('0x1')]},'sentimentRegion':{'type':Sequelize[_0x4172('0x4')]},'language':{'type':Sequelize['STRING']},'bucket':{'type':Sequelize['STRING']},'googleSsoEnabled':{'type':Sequelize[_0x4172('0x5')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize[_0x4172('0x5')],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize[_0x4172('0x1')](0x2)[_0x4172('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'privacyPolicyEmail':{'type':Sequelize[_0x4172('0x1')](0x2)[_0x4172('0x8')],'defaultValue':0x0},'privacyPolicyName':{'type':Sequelize[_0x4172('0x1')](0x2)['UNSIGNED'],'defaultValue':0x0},'privacyPolicyNumber':{'type':Sequelize['INTEGER'](0x2)['UNSIGNED'],'defaultValue':0x0},'searchOnEnterKey':{'type':Sequelize[_0x4172('0x5')],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize[_0x4172('0x1')],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize[_0x4172('0x1')],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize[_0x4172('0x1')],'defaultValue':0x0},'stopRecordingOnTransfer':{'type':Sequelize[_0x4172('0x5')],'defaultValue':![]},'secureCookieEnabled':{'type':Sequelize[_0x4172('0x5')],'defaultValue':!![]},'viewHelpSection':{'type':Sequelize[_0x4172('0x5')],'defaultValue':!![]},'previewRecallmeReminderInterval':{'type':Sequelize[_0x4172('0x1')],'defaultValue':0x5},'disabledCookie':{'type':Sequelize[_0x4172('0x5')],'defaultValue':![]},'limitTabs':{'type':Sequelize[_0x4172('0x1')],'defaultValue':0x14}}; \ No newline at end of file diff --git a/server/api/setting/setting.controller.js b/server/api/setting/setting.controller.js index 616f8a1..56413be 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 _0x746f=['default_logo.svg','default','custom','Sequelize','ValidationError','upperFirst','\x20not\x20found','getLogoLogin','defaultFavicon','default_loginLogo.svg','gdpr','securePassword','addPreferred','getPreferred','server/files/images/logos','getLicense','default_preferred.png','download','addFavicon','getFavicon','default_favicon.ico','getDate','now','format','YYYY-MM-DD\x20HH:mm:ss:SSS','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','jayson/promise','client','http','request','then','info','Setting,\x20%s,\x20%s','request\x20sent','Setting,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','destroy','sendStatus','name','index','Setting','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','catch','show','options','body','find','params','addLogo','file','filename','loginLogo','../../config/license/util','getLogo','preferred','favicon','defaultLogo','defaultLoginLogo','defaultPreferred','existsSync','root','toLower','join','logo'];(function(_0x1e8f93,_0x26caef){var _0x4b7b8d=function(_0x27bb5d){while(--_0x27bb5d){_0x1e8f93['push'](_0x1e8f93['shift']());}};_0x4b7b8d(++_0x26caef);}(_0x746f,0x9c));var _0xf746=function(_0x31a1d5,_0x3b5742){_0x31a1d5=_0x31a1d5-0x0;var _0x45fd4c=_0x746f[_0x31a1d5];return _0x45fd4c;};'use strict';var emlformat=require(_0xf746('0x0'));var rimraf=require(_0xf746('0x1'));var zipdir=require(_0xf746('0x2'));var jsonpatch=require(_0xf746('0x3'));var rp=require(_0xf746('0x4'));var moment=require(_0xf746('0x5'));var BPromise=require(_0xf746('0x6'));var Mustache=require(_0xf746('0x7'));var util=require(_0xf746('0x8'));var path=require(_0xf746('0x9'));var sox=require(_0xf746('0xa'));var csv=require(_0xf746('0xb'));var ejs=require(_0xf746('0xc'));var fs=require('fs');var fs_extra=require(_0xf746('0xd'));var _=require(_0xf746('0xe'));var squel=require(_0xf746('0xf'));var crypto=require(_0xf746('0x10'));var jsforce=require(_0xf746('0x11'));var deskjs=require(_0xf746('0x12'));var toCsv=require(_0xf746('0xb'));var querystring=require(_0xf746('0x13'));var Papa=require(_0xf746('0x14'));var Redis=require(_0xf746('0x15'));var authService=require(_0xf746('0x16'));var qs=require(_0xf746('0x17'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf746('0x18'));var logger=require(_0xf746('0x19'))(_0xf746('0x1a'));var utils=require('../../config/utils');var config=require(_0xf746('0x1b'));var licenseUtil=require('../../config/license/util');var db=require(_0xf746('0x1c'))['db'];var jayson=require(_0xf746('0x1d'));var client=jayson[_0xf746('0x1e')][_0xf746('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x985ba5,_0xc58e64,_0x4d30cc,_0x255ecb){return new BPromise(function(_0x3e4ebd,_0x206b05){var _0x5027d2=_0x255ecb||client;return _0x5027d2[_0xf746('0x20')](_0x985ba5,_0x4d30cc)[_0xf746('0x21')](function(_0x217bcb){logger[_0xf746('0x22')](_0xf746('0x23'),_0xc58e64,_0xf746('0x24'));logger['debug'](_0xf746('0x25'),_0xc58e64,'request\x20sent',JSON[_0xf746('0x26')](_0x217bcb));if(_0x217bcb[_0xf746('0x27')]){if(_0x217bcb['error'][_0xf746('0x28')]===0x1f4){logger[_0xf746('0x27')](_0xf746('0x23'),_0xc58e64,_0x217bcb[_0xf746('0x27')][_0xf746('0x29')]);return _0x206b05(_0x217bcb[_0xf746('0x27')]['message']);}logger[_0xf746('0x27')]('Setting,\x20%s,\x20%s',_0xc58e64,_0x217bcb[_0xf746('0x27')][_0xf746('0x29')]);return _0x3e4ebd(_0x217bcb[_0xf746('0x27')][_0xf746('0x29')]);}else{logger[_0xf746('0x22')](_0xf746('0x23'),_0xc58e64,'request\x20sent');_0x3e4ebd(_0x217bcb[_0xf746('0x2a')]['message']);}})['catch'](function(_0x3aa1ac){logger[_0xf746('0x27')](_0xf746('0x23'),_0xc58e64,_0x3aa1ac);_0x206b05(_0x3aa1ac);});});}function respondWithStatusCode(_0x19c81a,_0x2c10f4){_0x2c10f4=_0x2c10f4||0xcc;return function(_0x281631){if(_0x281631){return _0x19c81a['sendStatus'](_0x2c10f4);}return _0x19c81a[_0xf746('0x2b')](_0x2c10f4)[_0xf746('0x2c')]();};}function respondWithResult(_0xe5fe0,_0x614a62){_0x614a62=_0x614a62||0xc8;return function(_0x542256){if(_0x542256){return _0xe5fe0['status'](_0x614a62)[_0xf746('0x2d')](_0x542256);}};}function respondWithFilteredResult(_0x486098,_0x350032){return function(_0x137904){if(_0x137904){var _0x118cf3=typeof _0x350032[_0xf746('0x2e')]===_0xf746('0x2f')&&typeof _0x350032['limit']==='undefined';var _0x34f13c=_0x137904[_0xf746('0x30')];var _0x2c76a2=_0x118cf3?0x0:_0x350032[_0xf746('0x2e')];var _0x5dd2d6=_0x118cf3?_0x137904[_0xf746('0x30')]:_0x350032['offset']+_0x350032[_0xf746('0x31')];var _0x4e52c5;if(_0x5dd2d6>=_0x34f13c){_0x5dd2d6=_0x34f13c;_0x4e52c5=0xc8;}else{_0x4e52c5=0xce;}_0x486098[_0xf746('0x2b')](_0x4e52c5);return _0x486098[_0xf746('0x32')](_0xf746('0x33'),_0x2c76a2+'-'+_0x5dd2d6+'/'+_0x34f13c)[_0xf746('0x2d')](_0x137904);}return null;};}function patchUpdates(_0x3eb10c){return function(_0x316607){try{jsonpatch['apply'](_0x316607,_0x3eb10c,!![]);}catch(_0x237f9c){return BPromise[_0xf746('0x34')](_0x237f9c);}return _0x316607[_0xf746('0x35')]();};}function saveUpdates(_0x5648b8,_0x51b4c6){return function(_0x5a0fae){if(_0x5a0fae){return _0x5a0fae[_0xf746('0x36')](_0x5648b8)['then'](function(_0x17b31b){return _0x17b31b;});}return null;};}function removeEntity(_0x47475e,_0x5aca7e){return function(_0x3f1d24){if(_0x3f1d24){return _0x3f1d24[_0xf746('0x37')]()['then'](function(){_0x47475e[_0xf746('0x2b')](0xcc)[_0xf746('0x2c')]();});}};}function handleEntityNotFound(_0x24d494,_0xa4c119){return function(_0x3e3323){if(!_0x3e3323){_0x24d494[_0xf746('0x38')](0x194);}return _0x3e3323;};}function handleError(_0x473865,_0x518719){_0x518719=_0x518719||0x1f4;return function(_0x5c7fc7){logger[_0xf746('0x27')](_0x5c7fc7['stack']);if(_0x5c7fc7['name']){delete _0x5c7fc7[_0xf746('0x39')];}_0x473865[_0xf746('0x2b')](_0x518719)['send'](_0x5c7fc7);};}exports[_0xf746('0x3a')]=function(_0x597375,_0x181ca1){var _0xc700fb={},_0x55b381={},_0x4f654e={'count':0x0,'rows':[]};var _0x26bd52=_['map'](db[_0xf746('0x3b')][_0xf746('0x3c')],function(_0x3d145f){return{'name':_0x3d145f[_0xf746('0x3d')],'type':_0x3d145f[_0xf746('0x3e')][_0xf746('0x3f')]};});_0x55b381[_0xf746('0x40')]=_[_0xf746('0x41')](_0x26bd52,'name');_0x55b381[_0xf746('0x42')]=_[_0xf746('0x43')](_0x597375[_0xf746('0x42')]);_0x55b381[_0xf746('0x44')]=_['intersection'](_0x55b381[_0xf746('0x40')],_0x55b381[_0xf746('0x42')]);_0xc700fb['attributes']=_[_0xf746('0x45')](_0x55b381[_0xf746('0x40')],qs[_0xf746('0x46')](_0x597375['query']['fields']));_0xc700fb[_0xf746('0x47')]=_0xc700fb[_0xf746('0x47')][_0xf746('0x48')]?_0xc700fb[_0xf746('0x47')]:_0x55b381[_0xf746('0x40')];if(!_0x597375['query'][_0xf746('0x49')]('nolimit')){_0xc700fb[_0xf746('0x31')]=qs['limit'](_0x597375[_0xf746('0x42')][_0xf746('0x31')]);_0xc700fb[_0xf746('0x2e')]=qs[_0xf746('0x2e')](_0x597375[_0xf746('0x42')]['offset']);}_0xc700fb[_0xf746('0x4a')]=qs['sort'](_0x597375[_0xf746('0x42')][_0xf746('0x4b')]);_0xc700fb[_0xf746('0x4c')]=qs[_0xf746('0x44')](_[_0xf746('0x4d')](_0x597375[_0xf746('0x42')],_0x55b381[_0xf746('0x44')]),_0x26bd52);if(_0x597375[_0xf746('0x42')][_0xf746('0x4e')]){_0xc700fb[_0xf746('0x4c')]=_[_0xf746('0x4f')](_0xc700fb['where'],{'$or':_[_0xf746('0x41')](_0x26bd52,function(_0x20fa30){if(_0x20fa30[_0xf746('0x3e')]!==_0xf746('0x50')){var _0x5f4a74={};_0x5f4a74[_0x20fa30[_0xf746('0x39')]]={'$like':'%'+_0x597375[_0xf746('0x42')]['filter']+'%'};return _0x5f4a74;}})});}_0xc700fb=_[_0xf746('0x4f')]({},_0xc700fb,_0x597375['options']);var _0x30a92d={'where':_0xc700fb['where']};return db[_0xf746('0x3b')]['count'](_0x30a92d)[_0xf746('0x21')](function(_0x32fc17){_0x4f654e[_0xf746('0x30')]=_0x32fc17;if(_0x597375[_0xf746('0x42')][_0xf746('0x51')]){_0xc700fb[_0xf746('0x52')]=[{'all':!![]}];}return db[_0xf746('0x3b')][_0xf746('0x53')](_0xc700fb);})[_0xf746('0x21')](function(_0x282052){_0x4f654e['rows']=_0x282052;return _0x4f654e;})['then'](respondWithFilteredResult(_0x181ca1,_0xc700fb))[_0xf746('0x54')](handleError(_0x181ca1,null));};exports[_0xf746('0x55')]=function(_0x115107,_0x140829){var _0x19c0a0={'raw':![],'where':{'id':_0x115107['params']['id']}},_0x38c8e0={};_0x38c8e0['model']=_[_0xf746('0x43')](db[_0xf746('0x3b')][_0xf746('0x3c')]);_0x38c8e0['query']=_[_0xf746('0x43')](_0x115107['query']);_0x38c8e0[_0xf746('0x44')]=_[_0xf746('0x45')](_0x38c8e0[_0xf746('0x40')],_0x38c8e0[_0xf746('0x42')]);_0x19c0a0[_0xf746('0x47')]=_['intersection'](_0x38c8e0[_0xf746('0x40')],qs[_0xf746('0x46')](_0x115107[_0xf746('0x42')][_0xf746('0x46')]));_0x19c0a0[_0xf746('0x47')]=_0x19c0a0[_0xf746('0x47')][_0xf746('0x48')]?_0x19c0a0[_0xf746('0x47')]:_0x38c8e0[_0xf746('0x40')];if(_0x115107[_0xf746('0x42')]['includeAll']){_0x19c0a0[_0xf746('0x52')]=[{'all':!![]}];}_0x19c0a0=_[_0xf746('0x4f')]({},_0x19c0a0,_0x115107[_0xf746('0x56')]);return db[_0xf746('0x3b')]['find'](_0x19c0a0)[_0xf746('0x21')](handleEntityNotFound(_0x140829,null))['then'](respondWithResult(_0x140829,null))[_0xf746('0x54')](handleError(_0x140829,null));};exports['update']=function(_0x4e69ea,_0x74299c){if(_0x4e69ea[_0xf746('0x57')]['id']){delete _0x4e69ea[_0xf746('0x57')]['id'];}return db[_0xf746('0x3b')][_0xf746('0x58')]({'where':{'id':_0x4e69ea[_0xf746('0x59')]['id']}})[_0xf746('0x21')](handleEntityNotFound(_0x74299c,null))['then'](saveUpdates(_0x4e69ea[_0xf746('0x57')],null))['then'](respondWithResult(_0x74299c,null))['catch'](handleError(_0x74299c,null));};exports[_0xf746('0x5a')]=function(_0x174a75,_0x28eb5f,_0x552299){if(_0x174a75[_0xf746('0x5b')]&&_0x174a75[_0xf746('0x5b')][_0xf746('0x5c')]){_0x174a75['body']['logo']=_0x174a75[_0xf746('0x5b')][_0xf746('0x5c')];}return db[_0xf746('0x3b')][_0xf746('0x58')]({'where':{'id':_0x174a75['params']['id']}})[_0xf746('0x21')](handleEntityNotFound(_0x28eb5f,null))[_0xf746('0x21')](saveUpdates(_0x174a75[_0xf746('0x57')],null))['then'](respondWithResult(_0x28eb5f,null))[_0xf746('0x54')](handleError(_0x28eb5f,null));};exports['addLogoLogin']=function(_0x1d9a77,_0x1e6cb0,_0x10a394){if(_0x1d9a77[_0xf746('0x5b')]&&_0x1d9a77['file']['filename']){_0x1d9a77[_0xf746('0x57')][_0xf746('0x5d')]=_0x1d9a77[_0xf746('0x5b')]['filename'];}return db[_0xf746('0x3b')][_0xf746('0x58')]({'where':{'id':_0x1d9a77[_0xf746('0x59')]['id']}})[_0xf746('0x21')](handleEntityNotFound(_0x1e6cb0,null))[_0xf746('0x21')](saveUpdates(_0x1d9a77[_0xf746('0x57')],null))[_0xf746('0x21')](respondWithResult(_0x1e6cb0,null))[_0xf746('0x54')](handleError(_0x1e6cb0,null));};var utilLicense=require(_0xf746('0x5e'));exports[_0xf746('0x5f')]=function(_0x5c10ff,_0x52bec4,_0x3e7fa8){var _0x43c0dc='server/files/images/logos';var _0x3957fb={'custom':![]};return utilLicense['getLicense']()[_0xf746('0x21')](function(_0x23fae2){if(_0x23fae2){_0x3957fb=_0x23fae2;}return db[_0xf746('0x3b')]['find']({'where':{'id':_0x5c10ff[_0xf746('0x59')]['id']},'attributes':['logo','loginLogo',_0xf746('0x60'),_0xf746('0x61'),_0xf746('0x62'),_0xf746('0x63'),_0xf746('0x64'),'defaultFavicon'],'raw':!![]});})['then'](handleEntityNotFound(_0x52bec4,null))[_0xf746('0x21')](function(_0x5e45b9){if(_0x5e45b9){var _0x4659b1=_0x5e45b9['logo']&&fs[_0xf746('0x65')](path['join'](config[_0xf746('0x66')],_0x43c0dc,_[_0xf746('0x67')](_0x5e45b9['logo'])))?path[_0xf746('0x68')](config[_0xf746('0x66')],_0x43c0dc,_['toLower'](_0x5e45b9[_0xf746('0x69')])):path[_0xf746('0x68')](config['root'],_0x43c0dc,_['toLower'](_0xf746('0x6a')));var _0x4871d8=_0xf746('0x6b')+_['upperFirst'](_0xf746('0x69'));if(_0x5e45b9[_0x4871d8]||!_0x3957fb[_0xf746('0x6c')]){_0x4659b1=path['join'](config[_0xf746('0x66')],_0x43c0dc,_['toLower'](_0xf746('0x6a')));}if(!fs[_0xf746('0x65')](_0x4659b1)){throw new db[(_0xf746('0x6d'))][(_0xf746('0x6e'))](_[_0xf746('0x6f')](_0xf746('0x69'))+_0xf746('0x70'));}return _0x52bec4['download'](_0x4659b1);}})[_0xf746('0x54')](handleError(_0x52bec4,null));};var utilLicense=require(_0xf746('0x5e'));exports[_0xf746('0x71')]=function(_0x54f5d4,_0x24a82d,_0x36dae5){var _0x5651d5='server/files/images/logos';var _0x34fffb={'custom':![]};return utilLicense['getLicense']()[_0xf746('0x21')](function(_0x321ba8){if(_0x321ba8){_0x34fffb=_0x321ba8;}return db[_0xf746('0x3b')][_0xf746('0x58')]({'where':{'id':_0x54f5d4[_0xf746('0x59')]['id']},'attributes':['logo',_0xf746('0x5d'),_0xf746('0x60'),'favicon',_0xf746('0x62'),_0xf746('0x63'),_0xf746('0x64'),_0xf746('0x72')],'raw':!![]});})[_0xf746('0x21')](handleEntityNotFound(_0x24a82d,null))[_0xf746('0x21')](function(_0x2ee5c9){if(_0x2ee5c9){var _0x509f1a=_0x2ee5c9[_0xf746('0x5d')]&&fs[_0xf746('0x65')](path[_0xf746('0x68')](config['root'],_0x5651d5,_[_0xf746('0x67')](_0x2ee5c9[_0xf746('0x5d')])))?path[_0xf746('0x68')](config[_0xf746('0x66')],_0x5651d5,_[_0xf746('0x67')](_0x2ee5c9['loginLogo'])):path['join'](config[_0xf746('0x66')],_0x5651d5,_['toLower'](_0xf746('0x73')));var _0x1da275=_0xf746('0x6b')+_[_0xf746('0x6f')](_0xf746('0x5d'));if(_0x2ee5c9[_0x1da275]||!_0x34fffb[_0xf746('0x6c')]){_0x509f1a=path['join'](config[_0xf746('0x66')],_0x5651d5,_['toLower'](_0xf746('0x73')));}if(!fs[_0xf746('0x65')](_0x509f1a)){throw new db[(_0xf746('0x6d'))]['ValidationError'](_[_0xf746('0x6f')]('loginLogo')+'\x20not\x20found');}return _0x24a82d['download'](_0x509f1a);}})['catch'](handleError(_0x24a82d,null));};exports[_0xf746('0x74')]=function(_0x283c6b,_0x51abfd){return db['Setting'][_0xf746('0x58')]({'where':{'id':_0x283c6b[_0xf746('0x59')]['id']},'attributes':[_0xf746('0x75')]})['then'](respondWithResult(_0x51abfd,null))[_0xf746('0x54')](handleError(_0x51abfd,null));};exports[_0xf746('0x76')]=function(_0x2a6eff,_0x5e2699,_0x4aa9cf){if(_0x2a6eff[_0xf746('0x5b')]&&_0x2a6eff['file'][_0xf746('0x5c')]){_0x2a6eff[_0xf746('0x57')]['preferred']=_0x2a6eff['file'][_0xf746('0x5c')];}return db[_0xf746('0x3b')][_0xf746('0x58')]({'where':{'id':_0x2a6eff['params']['id']}})['then'](handleEntityNotFound(_0x5e2699,null))[_0xf746('0x21')](saveUpdates(_0x2a6eff[_0xf746('0x57')],null))[_0xf746('0x21')](respondWithResult(_0x5e2699,null))[_0xf746('0x54')](handleError(_0x5e2699,null));};var utilLicense=require(_0xf746('0x5e'));exports[_0xf746('0x77')]=function(_0x57ef67,_0x597899,_0x35d287){var _0x3ab726=_0xf746('0x78');var _0x2deedc={'custom':![]};return utilLicense[_0xf746('0x79')]()[_0xf746('0x21')](function(_0x1787d8){if(_0x1787d8){_0x2deedc=_0x1787d8;}return db[_0xf746('0x3b')][_0xf746('0x58')]({'where':{'id':_0x57ef67['params']['id']},'attributes':[_0xf746('0x69'),'loginLogo',_0xf746('0x60'),'favicon',_0xf746('0x62'),_0xf746('0x63'),'defaultPreferred',_0xf746('0x72')],'raw':!![]});})[_0xf746('0x21')](handleEntityNotFound(_0x597899,null))[_0xf746('0x21')](function(_0x37a528){if(_0x37a528){var _0x2b212c=_0x37a528[_0xf746('0x60')]&&fs[_0xf746('0x65')](path['join'](config[_0xf746('0x66')],_0x3ab726,_[_0xf746('0x67')](_0x37a528['preferred'])))?path['join'](config['root'],_0x3ab726,_[_0xf746('0x67')](_0x37a528[_0xf746('0x60')])):path[_0xf746('0x68')](config[_0xf746('0x66')],_0x3ab726,_['toLower'](_0xf746('0x7a')));var _0x3285a1=_0xf746('0x6b')+_[_0xf746('0x6f')](_0xf746('0x60'));if(_0x37a528[_0x3285a1]||!_0x2deedc[_0xf746('0x6c')]||!_0x2deedc[_0xf746('0x60')]){_0x2b212c=path['join'](config[_0xf746('0x66')],_0x3ab726,_[_0xf746('0x67')](_0xf746('0x7a')));}if(!fs['existsSync'](_0x2b212c)){throw new db[(_0xf746('0x6d'))]['ValidationError'](_[_0xf746('0x6f')](_0xf746('0x60'))+_0xf746('0x70'));}return _0x597899[_0xf746('0x7b')](_0x2b212c);}})[_0xf746('0x54')](handleError(_0x597899,null));};exports[_0xf746('0x7c')]=function(_0x5649a8,_0x5f4ef3,_0x9a6fb0){if(_0x5649a8['file']&&_0x5649a8[_0xf746('0x5b')]['filename']){_0x5649a8[_0xf746('0x57')][_0xf746('0x61')]=_0x5649a8['file'][_0xf746('0x5c')];}return db[_0xf746('0x3b')]['find']({'where':{'id':_0x5649a8[_0xf746('0x59')]['id']}})['then'](handleEntityNotFound(_0x5f4ef3,null))[_0xf746('0x21')](saveUpdates(_0x5649a8[_0xf746('0x57')],null))[_0xf746('0x21')](respondWithResult(_0x5f4ef3,null))['catch'](handleError(_0x5f4ef3,null));};var utilLicense=require(_0xf746('0x5e'));exports[_0xf746('0x7d')]=function(_0x965c4b,_0x5659ab,_0x1ea29d){var _0x391989='server/files/images/logos';var _0x1c29c3={'custom':![]};return utilLicense['getLicense']()[_0xf746('0x21')](function(_0x2d0398){if(_0x2d0398){_0x1c29c3=_0x2d0398;}return db[_0xf746('0x3b')]['find']({'where':{'id':_0x965c4b[_0xf746('0x59')]['id']},'attributes':['logo','loginLogo','preferred',_0xf746('0x61'),_0xf746('0x62'),'defaultLoginLogo',_0xf746('0x64'),_0xf746('0x72')],'raw':!![]});})[_0xf746('0x21')](handleEntityNotFound(_0x5659ab,null))[_0xf746('0x21')](function(_0x5ce2c9){if(_0x5ce2c9){var _0x20a995=_0x5ce2c9[_0xf746('0x61')]&&fs['existsSync'](path[_0xf746('0x68')](config[_0xf746('0x66')],_0x391989,_['toLower'](_0x5ce2c9['favicon'])))?path[_0xf746('0x68')](config[_0xf746('0x66')],_0x391989,_['toLower'](_0x5ce2c9[_0xf746('0x61')])):path['join'](config['root'],_0x391989,_[_0xf746('0x67')](_0xf746('0x7e')));var _0x197bed=_0xf746('0x6b')+_[_0xf746('0x6f')](_0xf746('0x61'));if(_0x5ce2c9[_0x197bed]||!_0x1c29c3[_0xf746('0x6c')]){_0x20a995=path['join'](config[_0xf746('0x66')],_0x391989,_[_0xf746('0x67')](_0xf746('0x7e')));}if(!fs[_0xf746('0x65')](_0x20a995)){throw new db[(_0xf746('0x6d'))]['ValidationError'](_[_0xf746('0x6f')](_0xf746('0x61'))+_0xf746('0x70'));}return _0x5659ab['download'](_0x20a995);}})['catch'](handleError(_0x5659ab,null));};exports[_0xf746('0x7f')]=function(_0x169f50,_0x60ab20){var _0x2287d0={'offset':moment()['utcOffset']()};_0x2287d0[_0xf746('0x80')]=moment()['utcOffset'](_0x2287d0[_0xf746('0x2e')])[_0xf746('0x81')](_0xf746('0x82'));return _0x60ab20['status'](0xc8)['send'](_0x2287d0);}; \ No newline at end of file +var _0xc3d6=['../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','then','info','Setting,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','update','destroy','end','name','index','map','Setting','rawAttributes','key','model','query','keys','intersection','fields','attributes','nolimit','order','sort','where','filter','merge','options','includeAll','include','rows','show','params','filters','find','body','addLogo','file','logo','filename','addLogoLogin','loginLogo','getLogo','server/files/images/logos','getLicense','preferred','favicon','defaultLoginLogo','defaultPreferred','defaultFavicon','join','root','toLower','default_logo.svg','upperFirst','custom','existsSync','Sequelize','ValidationError','\x20not\x20found','download','defaultLogo','default_loginLogo.svg','default','gdpr','securePassword','getPreferred','default_preferred.png','addFavicon','getFavicon','getDate','utcOffset','format','YYYY-MM-DD\x20HH:mm:ss:SSS','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch'];(function(_0x7ac6d3,_0x5511bd){var _0xa1e3df=function(_0x308660){while(--_0x308660){_0x7ac6d3['push'](_0x7ac6d3['shift']());}};_0xa1e3df(++_0x5511bd);}(_0xc3d6,0x153));var _0x6c3d=function(_0x526cda,_0x30e4e0){_0x526cda=_0x526cda-0x0;var _0xc8cb9f=_0xc3d6[_0x526cda];return _0xc8cb9f;};'use strict';var emlformat=require(_0x6c3d('0x0'));var rimraf=require(_0x6c3d('0x1'));var zipdir=require(_0x6c3d('0x2'));var jsonpatch=require(_0x6c3d('0x3'));var rp=require(_0x6c3d('0x4'));var moment=require(_0x6c3d('0x5'));var BPromise=require(_0x6c3d('0x6'));var Mustache=require(_0x6c3d('0x7'));var util=require(_0x6c3d('0x8'));var path=require(_0x6c3d('0x9'));var sox=require('sox');var csv=require(_0x6c3d('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6c3d('0xb'));var _=require('lodash');var squel=require(_0x6c3d('0xc'));var crypto=require(_0x6c3d('0xd'));var jsforce=require(_0x6c3d('0xe'));var deskjs=require(_0x6c3d('0xf'));var toCsv=require(_0x6c3d('0xa'));var querystring=require(_0x6c3d('0x10'));var Papa=require(_0x6c3d('0x11'));var Redis=require(_0x6c3d('0x12'));var authService=require(_0x6c3d('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x6c3d('0x14'));var hardwareService=require(_0x6c3d('0x15'));var logger=require('../../config/logger')(_0x6c3d('0x16'));var utils=require(_0x6c3d('0x17'));var config=require(_0x6c3d('0x18'));var licenseUtil=require(_0x6c3d('0x19'));var db=require(_0x6c3d('0x1a'))['db'];var jayson=require(_0x6c3d('0x1b'));var client=jayson[_0x6c3d('0x1c')][_0x6c3d('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x3e31d9,_0x43a9a6,_0x57f277,_0x2b0ec3){return new BPromise(function(_0x306341,_0x373519){var _0xddee73=_0x2b0ec3||client;return _0xddee73[_0x6c3d('0x1e')](_0x3e31d9,_0x57f277)[_0x6c3d('0x1f')](function(_0x4454c8){logger[_0x6c3d('0x20')](_0x6c3d('0x21'),_0x43a9a6,_0x6c3d('0x22'));logger[_0x6c3d('0x23')]('Setting,\x20%s,\x20%s,\x20%s',_0x43a9a6,_0x6c3d('0x22'),JSON[_0x6c3d('0x24')](_0x4454c8));if(_0x4454c8[_0x6c3d('0x25')]){if(_0x4454c8[_0x6c3d('0x25')]['code']===0x1f4){logger[_0x6c3d('0x25')](_0x6c3d('0x21'),_0x43a9a6,_0x4454c8['error'][_0x6c3d('0x26')]);return _0x373519(_0x4454c8[_0x6c3d('0x25')][_0x6c3d('0x26')]);}logger[_0x6c3d('0x25')](_0x6c3d('0x21'),_0x43a9a6,_0x4454c8[_0x6c3d('0x25')]['message']);return _0x306341(_0x4454c8[_0x6c3d('0x25')][_0x6c3d('0x26')]);}else{logger[_0x6c3d('0x20')]('Setting,\x20%s,\x20%s',_0x43a9a6,'request\x20sent');_0x306341(_0x4454c8[_0x6c3d('0x27')][_0x6c3d('0x26')]);}})[_0x6c3d('0x28')](function(_0x28c203){logger['error'](_0x6c3d('0x21'),_0x43a9a6,_0x28c203);_0x373519(_0x28c203);});});}function respondWithStatusCode(_0xb1b565,_0x546433){_0x546433=_0x546433||0xcc;return function(_0x4c94be){if(_0x4c94be){return _0xb1b565[_0x6c3d('0x29')](_0x546433);}return _0xb1b565['status'](_0x546433)['end']();};}function respondWithResult(_0x422fcf,_0x28aeb3){_0x28aeb3=_0x28aeb3||0xc8;return function(_0x40b4c4){if(_0x40b4c4){return _0x422fcf[_0x6c3d('0x2a')](_0x28aeb3)[_0x6c3d('0x2b')](_0x40b4c4);}};}function respondWithFilteredResult(_0x27ba54,_0x9ae845){return function(_0x1f4846){if(_0x1f4846){var _0x4e9eda=typeof _0x9ae845[_0x6c3d('0x2c')]==='undefined'&&typeof _0x9ae845[_0x6c3d('0x2d')]===_0x6c3d('0x2e');var _0x2f3897=_0x1f4846[_0x6c3d('0x2f')];var _0x2a4557=_0x4e9eda?0x0:_0x9ae845[_0x6c3d('0x2c')];var _0x3253df=_0x4e9eda?_0x1f4846['count']:_0x9ae845['offset']+_0x9ae845[_0x6c3d('0x2d')];var _0x469c65;if(_0x3253df>=_0x2f3897){_0x3253df=_0x2f3897;_0x469c65=0xc8;}else{_0x469c65=0xce;}_0x27ba54[_0x6c3d('0x2a')](_0x469c65);return _0x27ba54[_0x6c3d('0x30')](_0x6c3d('0x31'),_0x2a4557+'-'+_0x3253df+'/'+_0x2f3897)[_0x6c3d('0x2b')](_0x1f4846);}return null;};}function patchUpdates(_0x160d6d){return function(_0x8dfdda){try{jsonpatch[_0x6c3d('0x32')](_0x8dfdda,_0x160d6d,!![]);}catch(_0x29b8e1){return BPromise[_0x6c3d('0x33')](_0x29b8e1);}return _0x8dfdda['save']();};}function saveUpdates(_0x5c6ff1,_0x116b8e){return function(_0x114918){if(_0x114918){return _0x114918[_0x6c3d('0x34')](_0x5c6ff1)['then'](function(_0x4a1513){return _0x4a1513;});}return null;};}function removeEntity(_0x48320a,_0x571201){return function(_0x46942d){if(_0x46942d){return _0x46942d[_0x6c3d('0x35')]()[_0x6c3d('0x1f')](function(){_0x48320a['status'](0xcc)[_0x6c3d('0x36')]();});}};}function handleEntityNotFound(_0xd96415,_0x261022){return function(_0x5247a4){if(!_0x5247a4){_0xd96415[_0x6c3d('0x29')](0x194);}return _0x5247a4;};}function handleError(_0x20f1cc,_0x9142ab){_0x9142ab=_0x9142ab||0x1f4;return function(_0x159f59){logger[_0x6c3d('0x25')](_0x159f59['stack']);if(_0x159f59[_0x6c3d('0x37')]){delete _0x159f59[_0x6c3d('0x37')];}_0x20f1cc[_0x6c3d('0x2a')](_0x9142ab)['send'](_0x159f59);};}exports[_0x6c3d('0x38')]=function(_0x405db3,_0x3b6776){var _0x4dc7d7={},_0x4b8b34={},_0x441ea5={'count':0x0,'rows':[]};var _0x460395=_[_0x6c3d('0x39')](db[_0x6c3d('0x3a')][_0x6c3d('0x3b')],function(_0x36c343){return{'name':_0x36c343['fieldName'],'type':_0x36c343['type'][_0x6c3d('0x3c')]};});_0x4b8b34[_0x6c3d('0x3d')]=_[_0x6c3d('0x39')](_0x460395,_0x6c3d('0x37'));_0x4b8b34[_0x6c3d('0x3e')]=_[_0x6c3d('0x3f')](_0x405db3['query']);_0x4b8b34['filters']=_[_0x6c3d('0x40')](_0x4b8b34[_0x6c3d('0x3d')],_0x4b8b34['query']);_0x4dc7d7['attributes']=_['intersection'](_0x4b8b34[_0x6c3d('0x3d')],qs[_0x6c3d('0x41')](_0x405db3[_0x6c3d('0x3e')][_0x6c3d('0x41')]));_0x4dc7d7[_0x6c3d('0x42')]=_0x4dc7d7['attributes']['length']?_0x4dc7d7['attributes']:_0x4b8b34[_0x6c3d('0x3d')];if(!_0x405db3[_0x6c3d('0x3e')]['hasOwnProperty'](_0x6c3d('0x43'))){_0x4dc7d7[_0x6c3d('0x2d')]=qs[_0x6c3d('0x2d')](_0x405db3['query']['limit']);_0x4dc7d7['offset']=qs[_0x6c3d('0x2c')](_0x405db3[_0x6c3d('0x3e')][_0x6c3d('0x2c')]);}_0x4dc7d7[_0x6c3d('0x44')]=qs[_0x6c3d('0x45')](_0x405db3['query'][_0x6c3d('0x45')]);_0x4dc7d7[_0x6c3d('0x46')]=qs['filters'](_['pick'](_0x405db3[_0x6c3d('0x3e')],_0x4b8b34['filters']),_0x460395);if(_0x405db3[_0x6c3d('0x3e')][_0x6c3d('0x47')]){_0x4dc7d7[_0x6c3d('0x46')]=_[_0x6c3d('0x48')](_0x4dc7d7[_0x6c3d('0x46')],{'$or':_[_0x6c3d('0x39')](_0x460395,function(_0x4fa1c3){if(_0x4fa1c3['type']!=='VIRTUAL'){var _0x6bb42a={};_0x6bb42a[_0x4fa1c3[_0x6c3d('0x37')]]={'$like':'%'+_0x405db3[_0x6c3d('0x3e')]['filter']+'%'};return _0x6bb42a;}})});}_0x4dc7d7=_['merge']({},_0x4dc7d7,_0x405db3[_0x6c3d('0x49')]);var _0x57f8db={'where':_0x4dc7d7[_0x6c3d('0x46')]};return db[_0x6c3d('0x3a')][_0x6c3d('0x2f')](_0x57f8db)[_0x6c3d('0x1f')](function(_0x18c0b5){_0x441ea5['count']=_0x18c0b5;if(_0x405db3[_0x6c3d('0x3e')][_0x6c3d('0x4a')]){_0x4dc7d7[_0x6c3d('0x4b')]=[{'all':!![]}];}return db[_0x6c3d('0x3a')]['findAll'](_0x4dc7d7);})[_0x6c3d('0x1f')](function(_0x2377bb){_0x441ea5[_0x6c3d('0x4c')]=_0x2377bb;return _0x441ea5;})[_0x6c3d('0x1f')](respondWithFilteredResult(_0x3b6776,_0x4dc7d7))[_0x6c3d('0x28')](handleError(_0x3b6776,null));};exports[_0x6c3d('0x4d')]=function(_0x554b90,_0x399bcd){var _0x1ad558={'raw':![],'where':{'id':_0x554b90[_0x6c3d('0x4e')]['id']}},_0x3c50b2={};_0x3c50b2[_0x6c3d('0x3d')]=_[_0x6c3d('0x3f')](db[_0x6c3d('0x3a')][_0x6c3d('0x3b')]);_0x3c50b2[_0x6c3d('0x3e')]=_['keys'](_0x554b90['query']);_0x3c50b2[_0x6c3d('0x4f')]=_[_0x6c3d('0x40')](_0x3c50b2[_0x6c3d('0x3d')],_0x3c50b2[_0x6c3d('0x3e')]);_0x1ad558[_0x6c3d('0x42')]=_['intersection'](_0x3c50b2[_0x6c3d('0x3d')],qs[_0x6c3d('0x41')](_0x554b90[_0x6c3d('0x3e')][_0x6c3d('0x41')]));_0x1ad558[_0x6c3d('0x42')]=_0x1ad558[_0x6c3d('0x42')]['length']?_0x1ad558[_0x6c3d('0x42')]:_0x3c50b2['model'];if(_0x554b90[_0x6c3d('0x3e')][_0x6c3d('0x4a')]){_0x1ad558['include']=[{'all':!![]}];}_0x1ad558=_['merge']({},_0x1ad558,_0x554b90['options']);return db[_0x6c3d('0x3a')][_0x6c3d('0x50')](_0x1ad558)[_0x6c3d('0x1f')](handleEntityNotFound(_0x399bcd,null))['then'](respondWithResult(_0x399bcd,null))[_0x6c3d('0x28')](handleError(_0x399bcd,null));};exports[_0x6c3d('0x34')]=function(_0x724d1d,_0x50a8c2){if(_0x724d1d[_0x6c3d('0x51')]['id']){delete _0x724d1d[_0x6c3d('0x51')]['id'];}return db[_0x6c3d('0x3a')]['find']({'where':{'id':_0x724d1d['params']['id']}})[_0x6c3d('0x1f')](handleEntityNotFound(_0x50a8c2,null))[_0x6c3d('0x1f')](saveUpdates(_0x724d1d[_0x6c3d('0x51')],null))[_0x6c3d('0x1f')](respondWithResult(_0x50a8c2,null))[_0x6c3d('0x28')](handleError(_0x50a8c2,null));};exports[_0x6c3d('0x52')]=function(_0x543cb0,_0x3cae11,_0x104277){if(_0x543cb0[_0x6c3d('0x53')]&&_0x543cb0[_0x6c3d('0x53')]['filename']){_0x543cb0['body'][_0x6c3d('0x54')]=_0x543cb0[_0x6c3d('0x53')][_0x6c3d('0x55')];}return db[_0x6c3d('0x3a')][_0x6c3d('0x50')]({'where':{'id':_0x543cb0[_0x6c3d('0x4e')]['id']}})[_0x6c3d('0x1f')](handleEntityNotFound(_0x3cae11,null))[_0x6c3d('0x1f')](saveUpdates(_0x543cb0[_0x6c3d('0x51')],null))[_0x6c3d('0x1f')](respondWithResult(_0x3cae11,null))['catch'](handleError(_0x3cae11,null));};exports[_0x6c3d('0x56')]=function(_0x49c4cf,_0xa27c65,_0x19c682){if(_0x49c4cf[_0x6c3d('0x53')]&&_0x49c4cf[_0x6c3d('0x53')][_0x6c3d('0x55')]){_0x49c4cf['body'][_0x6c3d('0x57')]=_0x49c4cf[_0x6c3d('0x53')][_0x6c3d('0x55')];}return db[_0x6c3d('0x3a')][_0x6c3d('0x50')]({'where':{'id':_0x49c4cf['params']['id']}})['then'](handleEntityNotFound(_0xa27c65,null))[_0x6c3d('0x1f')](saveUpdates(_0x49c4cf[_0x6c3d('0x51')],null))['then'](respondWithResult(_0xa27c65,null))[_0x6c3d('0x28')](handleError(_0xa27c65,null));};var utilLicense=require(_0x6c3d('0x19'));exports[_0x6c3d('0x58')]=function(_0x9eef00,_0x1a2489,_0x228bc7){var _0x56874a=_0x6c3d('0x59');var _0x2ae7c4={'custom':![]};return utilLicense[_0x6c3d('0x5a')]()[_0x6c3d('0x1f')](function(_0x1ef826){if(_0x1ef826){_0x2ae7c4=_0x1ef826;}return db[_0x6c3d('0x3a')][_0x6c3d('0x50')]({'where':{'id':_0x9eef00[_0x6c3d('0x4e')]['id']},'attributes':['logo',_0x6c3d('0x57'),_0x6c3d('0x5b'),_0x6c3d('0x5c'),'defaultLogo',_0x6c3d('0x5d'),_0x6c3d('0x5e'),_0x6c3d('0x5f')],'raw':!![]});})[_0x6c3d('0x1f')](handleEntityNotFound(_0x1a2489,null))['then'](function(_0x26db86){if(_0x26db86){var _0x199fde=_0x26db86[_0x6c3d('0x54')]&&fs['existsSync'](path[_0x6c3d('0x60')](config[_0x6c3d('0x61')],_0x56874a,_['toLower'](_0x26db86[_0x6c3d('0x54')])))?path['join'](config[_0x6c3d('0x61')],_0x56874a,_['toLower'](_0x26db86[_0x6c3d('0x54')])):path['join'](config['root'],_0x56874a,_[_0x6c3d('0x62')](_0x6c3d('0x63')));var _0x3eb38a='default'+_[_0x6c3d('0x64')](_0x6c3d('0x54'));if(_0x26db86[_0x3eb38a]||!_0x2ae7c4[_0x6c3d('0x65')]){_0x199fde=path[_0x6c3d('0x60')](config[_0x6c3d('0x61')],_0x56874a,_[_0x6c3d('0x62')](_0x6c3d('0x63')));}if(!fs[_0x6c3d('0x66')](_0x199fde)){throw new db[(_0x6c3d('0x67'))][(_0x6c3d('0x68'))](_['upperFirst'](_0x6c3d('0x54'))+_0x6c3d('0x69'));}return _0x1a2489[_0x6c3d('0x6a')](_0x199fde);}})['catch'](handleError(_0x1a2489,null));};var utilLicense=require(_0x6c3d('0x19'));exports['getLogoLogin']=function(_0x1622af,_0x1da333,_0x6e8109){var _0x939cfc=_0x6c3d('0x59');var _0x3eb992={'custom':![]};return utilLicense[_0x6c3d('0x5a')]()[_0x6c3d('0x1f')](function(_0x55126a){if(_0x55126a){_0x3eb992=_0x55126a;}return db[_0x6c3d('0x3a')]['find']({'where':{'id':_0x1622af[_0x6c3d('0x4e')]['id']},'attributes':[_0x6c3d('0x54'),'loginLogo',_0x6c3d('0x5b'),_0x6c3d('0x5c'),_0x6c3d('0x6b'),_0x6c3d('0x5d'),_0x6c3d('0x5e'),'defaultFavicon'],'raw':!![]});})[_0x6c3d('0x1f')](handleEntityNotFound(_0x1da333,null))['then'](function(_0x203be8){if(_0x203be8){var _0x38fbcb=_0x203be8[_0x6c3d('0x57')]&&fs[_0x6c3d('0x66')](path[_0x6c3d('0x60')](config[_0x6c3d('0x61')],_0x939cfc,_['toLower'](_0x203be8[_0x6c3d('0x57')])))?path[_0x6c3d('0x60')](config[_0x6c3d('0x61')],_0x939cfc,_[_0x6c3d('0x62')](_0x203be8[_0x6c3d('0x57')])):path['join'](config['root'],_0x939cfc,_['toLower'](_0x6c3d('0x6c')));var _0x2740b7=_0x6c3d('0x6d')+_['upperFirst'](_0x6c3d('0x57'));if(_0x203be8[_0x2740b7]||!_0x3eb992['custom']){_0x38fbcb=path[_0x6c3d('0x60')](config[_0x6c3d('0x61')],_0x939cfc,_[_0x6c3d('0x62')]('default_loginLogo.svg'));}if(!fs[_0x6c3d('0x66')](_0x38fbcb)){throw new db[(_0x6c3d('0x67'))][(_0x6c3d('0x68'))](_['upperFirst'](_0x6c3d('0x57'))+_0x6c3d('0x69'));}return _0x1da333['download'](_0x38fbcb);}})[_0x6c3d('0x28')](handleError(_0x1da333,null));};exports[_0x6c3d('0x6e')]=function(_0x2af916,_0x39efcc){return db[_0x6c3d('0x3a')]['find']({'where':{'id':_0x2af916['params']['id']},'attributes':[_0x6c3d('0x6f')]})[_0x6c3d('0x1f')](respondWithResult(_0x39efcc,null))['catch'](handleError(_0x39efcc,null));};exports['addPreferred']=function(_0x439542,_0x44ee2a,_0x32c8ed){if(_0x439542[_0x6c3d('0x53')]&&_0x439542[_0x6c3d('0x53')]['filename']){_0x439542[_0x6c3d('0x51')][_0x6c3d('0x5b')]=_0x439542[_0x6c3d('0x53')][_0x6c3d('0x55')];}return db[_0x6c3d('0x3a')][_0x6c3d('0x50')]({'where':{'id':_0x439542['params']['id']}})[_0x6c3d('0x1f')](handleEntityNotFound(_0x44ee2a,null))[_0x6c3d('0x1f')](saveUpdates(_0x439542['body'],null))[_0x6c3d('0x1f')](respondWithResult(_0x44ee2a,null))[_0x6c3d('0x28')](handleError(_0x44ee2a,null));};var utilLicense=require(_0x6c3d('0x19'));exports[_0x6c3d('0x70')]=function(_0x536ecc,_0x355df3,_0x587345){var _0x1cbe7b=_0x6c3d('0x59');var _0x406e6d={'custom':![]};return utilLicense['getLicense']()[_0x6c3d('0x1f')](function(_0x29bc1d){if(_0x29bc1d){_0x406e6d=_0x29bc1d;}return db[_0x6c3d('0x3a')][_0x6c3d('0x50')]({'where':{'id':_0x536ecc[_0x6c3d('0x4e')]['id']},'attributes':['logo',_0x6c3d('0x57'),_0x6c3d('0x5b'),'favicon','defaultLogo',_0x6c3d('0x5d'),_0x6c3d('0x5e'),'defaultFavicon'],'raw':!![]});})['then'](handleEntityNotFound(_0x355df3,null))['then'](function(_0x47098e){if(_0x47098e){var _0xa8c94e=_0x47098e[_0x6c3d('0x5b')]&&fs[_0x6c3d('0x66')](path[_0x6c3d('0x60')](config[_0x6c3d('0x61')],_0x1cbe7b,_['toLower'](_0x47098e[_0x6c3d('0x5b')])))?path[_0x6c3d('0x60')](config[_0x6c3d('0x61')],_0x1cbe7b,_[_0x6c3d('0x62')](_0x47098e[_0x6c3d('0x5b')])):path[_0x6c3d('0x60')](config[_0x6c3d('0x61')],_0x1cbe7b,_[_0x6c3d('0x62')](_0x6c3d('0x71')));var _0x2977b4='default'+_[_0x6c3d('0x64')](_0x6c3d('0x5b'));if(_0x47098e[_0x2977b4]||!_0x406e6d[_0x6c3d('0x65')]||!_0x406e6d[_0x6c3d('0x5b')]){_0xa8c94e=path[_0x6c3d('0x60')](config['root'],_0x1cbe7b,_[_0x6c3d('0x62')](_0x6c3d('0x71')));}if(!fs[_0x6c3d('0x66')](_0xa8c94e)){throw new db['Sequelize'][(_0x6c3d('0x68'))](_['upperFirst']('preferred')+_0x6c3d('0x69'));}return _0x355df3[_0x6c3d('0x6a')](_0xa8c94e);}})[_0x6c3d('0x28')](handleError(_0x355df3,null));};exports[_0x6c3d('0x72')]=function(_0x2a014d,_0x3935b6,_0x122d17){if(_0x2a014d['file']&&_0x2a014d[_0x6c3d('0x53')][_0x6c3d('0x55')]){_0x2a014d[_0x6c3d('0x51')][_0x6c3d('0x5c')]=_0x2a014d[_0x6c3d('0x53')][_0x6c3d('0x55')];}return db[_0x6c3d('0x3a')][_0x6c3d('0x50')]({'where':{'id':_0x2a014d[_0x6c3d('0x4e')]['id']}})[_0x6c3d('0x1f')](handleEntityNotFound(_0x3935b6,null))[_0x6c3d('0x1f')](saveUpdates(_0x2a014d[_0x6c3d('0x51')],null))[_0x6c3d('0x1f')](respondWithResult(_0x3935b6,null))[_0x6c3d('0x28')](handleError(_0x3935b6,null));};var utilLicense=require(_0x6c3d('0x19'));exports[_0x6c3d('0x73')]=function(_0x18133f,_0x2f0df6,_0x551c8b){var _0xd3c420=_0x6c3d('0x59');var _0x2a010a={'custom':![]};return utilLicense[_0x6c3d('0x5a')]()['then'](function(_0x3e005e){if(_0x3e005e){_0x2a010a=_0x3e005e;}return db[_0x6c3d('0x3a')]['find']({'where':{'id':_0x18133f[_0x6c3d('0x4e')]['id']},'attributes':[_0x6c3d('0x54'),'loginLogo',_0x6c3d('0x5b'),_0x6c3d('0x5c'),'defaultLogo',_0x6c3d('0x5d'),_0x6c3d('0x5e'),_0x6c3d('0x5f')],'raw':!![]});})[_0x6c3d('0x1f')](handleEntityNotFound(_0x2f0df6,null))[_0x6c3d('0x1f')](function(_0x122c07){if(_0x122c07){var _0x58c565=_0x122c07[_0x6c3d('0x5c')]&&fs[_0x6c3d('0x66')](path[_0x6c3d('0x60')](config[_0x6c3d('0x61')],_0xd3c420,_[_0x6c3d('0x62')](_0x122c07[_0x6c3d('0x5c')])))?path[_0x6c3d('0x60')](config[_0x6c3d('0x61')],_0xd3c420,_['toLower'](_0x122c07[_0x6c3d('0x5c')])):path[_0x6c3d('0x60')](config[_0x6c3d('0x61')],_0xd3c420,_[_0x6c3d('0x62')]('default_favicon.ico'));var _0x107c8c='default'+_['upperFirst'](_0x6c3d('0x5c'));if(_0x122c07[_0x107c8c]||!_0x2a010a[_0x6c3d('0x65')]){_0x58c565=path[_0x6c3d('0x60')](config[_0x6c3d('0x61')],_0xd3c420,_[_0x6c3d('0x62')]('default_favicon.ico'));}if(!fs[_0x6c3d('0x66')](_0x58c565)){throw new db[(_0x6c3d('0x67'))][(_0x6c3d('0x68'))](_[_0x6c3d('0x64')](_0x6c3d('0x5c'))+_0x6c3d('0x69'));}return _0x2f0df6[_0x6c3d('0x6a')](_0x58c565);}})[_0x6c3d('0x28')](handleError(_0x2f0df6,null));};exports[_0x6c3d('0x74')]=function(_0x14c947,_0x2511d9){var _0x3d4530={'offset':moment()[_0x6c3d('0x75')]()};_0x3d4530['now']=moment()[_0x6c3d('0x75')](_0x3d4530[_0x6c3d('0x2c')])[_0x6c3d('0x76')](_0x6c3d('0x77'));return _0x2511d9['status'](0xc8)['send'](_0x3d4530);}; \ No newline at end of file diff --git a/server/api/setting/setting.model.js b/server/api/setting/setting.model.js index 80f5f40..d445d3b 100644 --- a/server/api/setting/setting.model.js +++ b/server/api/setting/setting.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3e74=['exports','Setting','settings','lodash','../../config/logger','api','moment','path','../../config/environment','./setting.attributes'];(function(_0x222688,_0x46c5eb){var _0x437433=function(_0x29958c){while(--_0x29958c){_0x222688['push'](_0x222688['shift']());}};_0x437433(++_0x46c5eb);}(_0x3e74,0x175));var _0x43e7=function(_0x2557f8,_0x379bd4){_0x2557f8=_0x2557f8-0x0;var _0x181929=_0x3e74[_0x2557f8];return _0x181929;};'use strict';var _=require(_0x43e7('0x0'));var util=require('util');var logger=require(_0x43e7('0x1'))(_0x43e7('0x2'));var moment=require(_0x43e7('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x43e7('0x4'));var rimraf=require('rimraf');var config=require(_0x43e7('0x5'));var attributes=require(_0x43e7('0x6'));module[_0x43e7('0x7')]=function(_0x1c503b,_0xc98b9c){return _0x1c503b['define'](_0x43e7('0x8'),attributes,{'tableName':_0x43e7('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3e74=['exports','Setting','settings','lodash','../../config/logger','api','moment','path','../../config/environment','./setting.attributes'];(function(_0x40ea21,_0xe55b66){var _0x555e46=function(_0x5e73fc){while(--_0x5e73fc){_0x40ea21['push'](_0x40ea21['shift']());}};_0x555e46(++_0xe55b66);}(_0x3e74,0x175));var _0x43e7=function(_0x151641,_0x4f1190){_0x151641=_0x151641-0x0;var _0x1ba3b0=_0x3e74[_0x151641];return _0x1ba3b0;};'use strict';var _=require(_0x43e7('0x0'));var util=require('util');var logger=require(_0x43e7('0x1'))(_0x43e7('0x2'));var moment=require(_0x43e7('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x43e7('0x4'));var rimraf=require('rimraf');var config=require(_0x43e7('0x5'));var attributes=require(_0x43e7('0x6'));module[_0x43e7('0x7')]=function(_0x1c503b,_0xc98b9c){return _0x1c503b['define'](_0x43e7('0x8'),attributes,{'tableName':_0x43e7('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/setting/setting.rpc.js b/server/api/setting/setting.rpc.js index 566a83c..35eda46 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 _0x48c4=['../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','then','request\x20sent','debug','stringify','code','error','Setting,\x20%s,\x20%s','message','result','catch','find','options','raw','where','attributes','map','include','model','ShowSetting','lodash','util','moment','ioredis','../../mysqldb'];(function(_0x56f7e2,_0x145392){var _0x36240b=function(_0x216ff7){while(--_0x216ff7){_0x56f7e2['push'](_0x56f7e2['shift']());}};_0x36240b(++_0x145392);}(_0x48c4,0x109));var _0x448c=function(_0x2037fe,_0x3a594c){_0x2037fe=_0x2037fe-0x0;var _0x396103=_0x48c4[_0x2037fe];return _0x396103;};'use strict';var _=require(_0x448c('0x0'));var util=require(_0x448c('0x1'));var moment=require(_0x448c('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x448c('0x3'));var db=require(_0x448c('0x4'))['db'];var utils=require(_0x448c('0x5'));var logger=require(_0x448c('0x6'))('rpc');var config=require(_0x448c('0x7'));var jayson=require(_0x448c('0x8'));var client=jayson[_0x448c('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x318095,_0x56a36a,_0x3423a9){return new BPromise(function(_0x183939,_0x886f0d){return client[_0x448c('0xa')](_0x318095,_0x3423a9)[_0x448c('0xb')](function(_0x2fee46){logger['info']('Setting,\x20%s,\x20%s',_0x56a36a,_0x448c('0xc'));logger[_0x448c('0xd')]('Setting,\x20%s,\x20%s,\x20%s',_0x56a36a,_0x448c('0xc'),JSON[_0x448c('0xe')](_0x2fee46));if(_0x2fee46['error']){if(_0x2fee46['error'][_0x448c('0xf')]===0x1f4){logger[_0x448c('0x10')](_0x448c('0x11'),_0x56a36a,_0x2fee46[_0x448c('0x10')][_0x448c('0x12')]);return _0x886f0d(_0x2fee46[_0x448c('0x10')]['message']);}logger[_0x448c('0x10')]('Setting,\x20%s,\x20%s',_0x56a36a,_0x2fee46[_0x448c('0x10')][_0x448c('0x12')]);return _0x183939(_0x2fee46[_0x448c('0x10')][_0x448c('0x12')]);}else{logger['info']('Setting,\x20%s,\x20%s',_0x56a36a,_0x448c('0xc'));_0x183939(_0x2fee46[_0x448c('0x13')][_0x448c('0x12')]);}})[_0x448c('0x14')](function(_0x31c39e){logger[_0x448c('0x10')]('Setting,\x20%s,\x20%s',_0x56a36a,_0x31c39e);_0x886f0d(_0x31c39e);});});}exports['ShowSetting']=function(_0x2d36da){var _0x2f4fa1=this;return new Promise(function(_0x4fa77a,_0x2df2b8){return db['Setting'][_0x448c('0x15')]({'raw':_0x2d36da[_0x448c('0x16')]?_0x2d36da['options'][_0x448c('0x17')]===undefined?!![]:![]:!![],'where':_0x2d36da[_0x448c('0x16')]?_0x2d36da['options'][_0x448c('0x18')]||null:null,'attributes':_0x2d36da[_0x448c('0x16')]?_0x2d36da[_0x448c('0x16')][_0x448c('0x19')]||null:null,'include':_0x2d36da['options']?_0x2d36da[_0x448c('0x16')]['include']?_[_0x448c('0x1a')](_0x2d36da['options'][_0x448c('0x1b')],function(_0x217441){return{'model':db[_0x217441['model']],'as':_0x217441['as'],'attributes':_0x217441[_0x448c('0x19')],'include':_0x217441[_0x448c('0x1b')]?_[_0x448c('0x1a')](_0x217441[_0x448c('0x1b')],function(_0x1ef4b4){return{'model':db[_0x1ef4b4[_0x448c('0x1c')]],'as':_0x1ef4b4['as'],'attributes':_0x1ef4b4[_0x448c('0x19')],'include':_0x1ef4b4[_0x448c('0x1b')]?_['map'](_0x1ef4b4[_0x448c('0x1b')],function(_0x2d1bed){return{'model':db[_0x2d1bed[_0x448c('0x1c')]],'as':_0x2d1bed['as'],'attributes':_0x2d1bed[_0x448c('0x19')]};}):[]};}):[]};}):[]:[]})[_0x448c('0xb')](function(_0x42aeda){logger['info'](_0x448c('0x1d'),_0x2d36da);logger[_0x448c('0xd')](_0x448c('0x1d'),_0x2d36da,JSON[_0x448c('0xe')](_0x42aeda));_0x4fa77a(_0x42aeda);})[_0x448c('0x14')](function(_0xfdf676){logger[_0x448c('0x10')](_0x448c('0x1d'),_0xfdf676[_0x448c('0x12')],_0x2d36da);_0x2df2b8(_0x2f4fa1[_0x448c('0x10')](0x1f4,_0xfdf676[_0x448c('0x12')]));});});}; \ No newline at end of file +var _0xf047=['bluebird','randomstring','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','info','request\x20sent','Setting,\x20%s,\x20%s,\x20%s','error','code','Setting,\x20%s,\x20%s','message','result','ShowSetting','options','raw','where','attributes','include','map','model','then','stringify','catch','lodash','moment'];(function(_0x2c0114,_0x51af30){var _0x376d10=function(_0xee0dff){while(--_0xee0dff){_0x2c0114['push'](_0x2c0114['shift']());}};_0x376d10(++_0x51af30);}(_0xf047,0x72));var _0x7f04=function(_0x43f638,_0x45397c){_0x43f638=_0x43f638-0x0;var _0x30d91f=_0xf047[_0x43f638];return _0x30d91f;};'use strict';var _=require(_0x7f04('0x0'));var util=require('util');var moment=require(_0x7f04('0x1'));var BPromise=require(_0x7f04('0x2'));var rs=require(_0x7f04('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7f04('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x7f04('0x5'))(_0x7f04('0x6'));var config=require('../../config/environment');var jayson=require(_0x7f04('0x7'));var client=jayson[_0x7f04('0x8')][_0x7f04('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2539d9,_0x5e563d,_0x4d6618){return new BPromise(function(_0x5bd50f,_0x56a550){return client['request'](_0x2539d9,_0x4d6618)['then'](function(_0x2f6d56){logger[_0x7f04('0xa')]('Setting,\x20%s,\x20%s',_0x5e563d,_0x7f04('0xb'));logger['debug'](_0x7f04('0xc'),_0x5e563d,_0x7f04('0xb'),JSON['stringify'](_0x2f6d56));if(_0x2f6d56[_0x7f04('0xd')]){if(_0x2f6d56[_0x7f04('0xd')][_0x7f04('0xe')]===0x1f4){logger[_0x7f04('0xd')](_0x7f04('0xf'),_0x5e563d,_0x2f6d56[_0x7f04('0xd')][_0x7f04('0x10')]);return _0x56a550(_0x2f6d56[_0x7f04('0xd')][_0x7f04('0x10')]);}logger[_0x7f04('0xd')](_0x7f04('0xf'),_0x5e563d,_0x2f6d56[_0x7f04('0xd')][_0x7f04('0x10')]);return _0x5bd50f(_0x2f6d56[_0x7f04('0xd')]['message']);}else{logger[_0x7f04('0xa')](_0x7f04('0xf'),_0x5e563d,_0x7f04('0xb'));_0x5bd50f(_0x2f6d56[_0x7f04('0x11')][_0x7f04('0x10')]);}})['catch'](function(_0x3f8d28){logger['error'](_0x7f04('0xf'),_0x5e563d,_0x3f8d28);_0x56a550(_0x3f8d28);});});}exports[_0x7f04('0x12')]=function(_0x59839e){var _0x2a7d12=this;return new Promise(function(_0x3ecf48,_0x530e24){return db['Setting']['find']({'raw':_0x59839e[_0x7f04('0x13')]?_0x59839e[_0x7f04('0x13')][_0x7f04('0x14')]===undefined?!![]:![]:!![],'where':_0x59839e[_0x7f04('0x13')]?_0x59839e[_0x7f04('0x13')][_0x7f04('0x15')]||null:null,'attributes':_0x59839e[_0x7f04('0x13')]?_0x59839e[_0x7f04('0x13')][_0x7f04('0x16')]||null:null,'include':_0x59839e[_0x7f04('0x13')]?_0x59839e[_0x7f04('0x13')][_0x7f04('0x17')]?_[_0x7f04('0x18')](_0x59839e[_0x7f04('0x13')][_0x7f04('0x17')],function(_0x2e407a){return{'model':db[_0x2e407a['model']],'as':_0x2e407a['as'],'attributes':_0x2e407a[_0x7f04('0x16')],'include':_0x2e407a[_0x7f04('0x17')]?_[_0x7f04('0x18')](_0x2e407a[_0x7f04('0x17')],function(_0x553ebb){return{'model':db[_0x553ebb[_0x7f04('0x19')]],'as':_0x553ebb['as'],'attributes':_0x553ebb[_0x7f04('0x16')],'include':_0x553ebb[_0x7f04('0x17')]?_[_0x7f04('0x18')](_0x553ebb[_0x7f04('0x17')],function(_0xaf7f04){return{'model':db[_0xaf7f04[_0x7f04('0x19')]],'as':_0xaf7f04['as'],'attributes':_0xaf7f04[_0x7f04('0x16')]};}):[]};}):[]};}):[]:[]})[_0x7f04('0x1a')](function(_0x11ef88){logger[_0x7f04('0xa')]('ShowSetting',_0x59839e);logger['debug'](_0x7f04('0x12'),_0x59839e,JSON[_0x7f04('0x1b')](_0x11ef88));_0x3ecf48(_0x11ef88);})[_0x7f04('0x1c')](function(_0x538f61){logger[_0x7f04('0xd')]('ShowSetting',_0x538f61[_0x7f04('0x10')],_0x59839e);_0x530e24(_0x2a7d12[_0x7f04('0xd')](0x1f4,_0x538f61[_0x7f04('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/index.js b/server/api/smsAccount/index.js index 19b40e7..89511ef 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 _0x9957=['getInteractions','statusGet','/:id/users','getAgents','post','create','addDisposition','/:id/canned_answers','addAnswer','addApplications','/:id/status','status','addAgents','/:id','update','delete','destroy','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./smsAccount.controller','get','isAuthenticated','index','/describe','describe','show','/:id/dispositions','getDispositions','getAnswers','/:id/applications','getApplications','/:id/interactions'];(function(_0x54724f,_0x443abb){var _0x2402e8=function(_0x28e80c){while(--_0x28e80c){_0x54724f['push'](_0x54724f['shift']());}};_0x2402e8(++_0x443abb);}(_0x9957,0x93));var _0x7995=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x9957[_0x19e35c];return _0x3e1fe8;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x9')]('/:id/canned_answers',auth[_0x7995('0xa')](),controller[_0x7995('0x11')]);router['get'](_0x7995('0x12'),auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x9')](_0x7995('0x14'),auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router['get']('/:id/status',controller[_0x7995('0x16')]);router[_0x7995('0x9')](_0x7995('0x17'),auth[_0x7995('0xa')](),controller[_0x7995('0x18')]);router[_0x7995('0x19')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0x1a')]);router['post'](_0x7995('0xf'),auth['isAuthenticated'](),controller[_0x7995('0x1b')]);router[_0x7995('0x19')](_0x7995('0x1c'),auth[_0x7995('0xa')](),controller[_0x7995('0x1d')]);router[_0x7995('0x19')]('/:id/notify',controller['notify']);router[_0x7995('0x19')]('/:id/applications',auth['isAuthenticated'](),controller[_0x7995('0x1e')]);router[_0x7995('0x19')]('/:id/send',auth[_0x7995('0xa')](),controller['send']);router['post'](_0x7995('0x1f'),controller[_0x7995('0x20')]);router[_0x7995('0x19')](_0x7995('0x17'),auth[_0x7995('0xa')](),controller[_0x7995('0x21')]);router['put'](_0x7995('0x22'),auth[_0x7995('0xa')](),controller[_0x7995('0x23')]);router[_0x7995('0x24')](_0x7995('0x22'),auth[_0x7995('0xa')](),controller[_0x7995('0x25')]);router[_0x7995('0x24')]('/:id/dispositions',auth[_0x7995('0xa')](),controller[_0x7995('0x26')]);router[_0x7995('0x24')](_0x7995('0x1c'),auth[_0x7995('0xa')](),controller[_0x7995('0x27')]);router['delete'](_0x7995('0x17'),auth['isAuthenticated'](),controller[_0x7995('0x28')]);module[_0x7995('0x29')]=router; \ No newline at end of file +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(_0x45598f,_0x1649ec){var _0x517e2b=function(_0xd0990e){while(--_0xd0990e){_0x45598f['push'](_0x45598f['shift']());}};_0x517e2b(++_0x1649ec);}(_0xe14b,0x93));var _0xbe14=function(_0xd5c108,_0xe48ebc){_0xd5c108=_0xd5c108-0x0;var _0x517a0b=_0xe14b[_0xd5c108];return _0x517a0b;};'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 e0b0620..6b99d13 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 _0x116f=['mandatoryDisposition','exports','STRING','name','generate','ENUM','twilio','skebby','connectel','plivo','bandwidth','csc','infobip','BOOLEAN','TEXT','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue'];(function(_0x7791d5,_0xdab65f){var _0x5ce288=function(_0x2b818d){while(--_0x2b818d){_0x7791d5['push'](_0x7791d5['shift']());}};_0x5ce288(++_0xdab65f);}(_0x116f,0x190));var _0xf116=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x116f[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require('sequelize');var rs=require('randomstring');module[_0xf116('0x0')]={'name':{'type':Sequelize[_0xf116('0x1')],'unique':_0xf116('0x2'),'allowNull':![]},'key':{'type':Sequelize[_0xf116('0x1')],'allowNull':![]},'remote':{'type':Sequelize[_0xf116('0x1')],'allowNull':![]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0xf116('0x3')]();}},'phone':{'type':Sequelize[_0xf116('0x1')]},'type':{'type':Sequelize[_0xf116('0x4')](_0xf116('0x5'),_0xf116('0x6'),_0xf116('0x7'),'clicksend',_0xf116('0x8'),'clickatell',_0xf116('0x9'),_0xf116('0xa'),_0xf116('0xb'),'intelepeer')},'accountSid':{'type':Sequelize[_0xf116('0x1')]},'authId':{'type':Sequelize['STRING']},'authToken':{'type':Sequelize[_0xf116('0x1')]},'smsMethod':{'type':Sequelize[_0xf116('0x4')]('SI','TI','GP')},'username':{'type':Sequelize[_0xf116('0x1')]},'password':{'type':Sequelize[_0xf116('0x1')]},'apiKey':{'type':Sequelize[_0xf116('0x1')]},'applicationId':{'type':Sequelize[_0xf116('0x1')]},'accountId':{'type':Sequelize[_0xf116('0x1')]},'senderString':{'type':Sequelize[_0xf116('0x1')]},'deliveryReport':{'type':Sequelize[_0xf116('0xc')],'defaultValue':![]},'description':{'type':Sequelize[_0xf116('0x1')]},'notificationTemplate':{'type':Sequelize[_0xf116('0xd')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xf116('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xf116('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xf116('0xc')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize['STRING']},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':_0xf116('0xf')},'mandatoryDisposition':{'type':Sequelize[_0xf116('0xc')],'defaultValue':![],'comment':_0xf116('0x10'),'set':function(_0x2056f8){if(!_0x2056f8)this['setDataValue']('mandatoryDispositionPauseId',null);this[_0xf116('0x11')](_0xf116('0x12'),_0x2056f8);}}}; \ No newline at end of file +var _0xc159=['clicksend','plivo','clickatell','bandwidth','csc','infobip','intelepeer','BOOLEAN','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','INTEGER','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','sequelize','randomstring','exports','STRING','generate','ENUM','twilio','skebby'];(function(_0x4592dc,_0x12b7f1){var _0x2a39c2=function(_0x31e208){while(--_0x31e208){_0x4592dc['push'](_0x4592dc['shift']());}};_0x2a39c2(++_0x12b7f1);}(_0xc159,0x116));var _0x9c15=function(_0x7275e9,_0x321fa5){_0x7275e9=_0x7275e9-0x0;var _0x17b99d=_0xc159[_0x7275e9];return _0x17b99d;};'use strict';var Sequelize=require(_0x9c15('0x0'));var rs=require(_0x9c15('0x1'));module[_0x9c15('0x2')]={'name':{'type':Sequelize[_0x9c15('0x3')],'unique':'name','allowNull':![]},'key':{'type':Sequelize[_0x9c15('0x3')],'allowNull':![]},'remote':{'type':Sequelize[_0x9c15('0x3')],'allowNull':![]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0x9c15('0x4')]();}},'phone':{'type':Sequelize[_0x9c15('0x3')]},'type':{'type':Sequelize[_0x9c15('0x5')](_0x9c15('0x6'),_0x9c15('0x7'),'connectel',_0x9c15('0x8'),_0x9c15('0x9'),_0x9c15('0xa'),_0x9c15('0xb'),_0x9c15('0xc'),_0x9c15('0xd'),_0x9c15('0xe'))},'accountSid':{'type':Sequelize['STRING']},'authId':{'type':Sequelize['STRING']},'authToken':{'type':Sequelize[_0x9c15('0x3')]},'smsMethod':{'type':Sequelize[_0x9c15('0x5')]('SI','TI','GP')},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0x9c15('0x3')]},'apiKey':{'type':Sequelize[_0x9c15('0x3')]},'applicationId':{'type':Sequelize[_0x9c15('0x3')]},'accountId':{'type':Sequelize['STRING']},'senderString':{'type':Sequelize[_0x9c15('0x3')]},'deliveryReport':{'type':Sequelize[_0x9c15('0xf')],'defaultValue':![]},'description':{'type':Sequelize[_0x9c15('0x3')]},'notificationTemplate':{'type':Sequelize[_0x9c15('0x10')],'defaultValue':function(){return _0x9c15('0x11');}},'notificationSound':{'type':Sequelize[_0x9c15('0xf')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x9c15('0x12')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x9c15('0xf')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x9c15('0x12')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x9c15('0xf')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x9c15('0x12')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0x9c15('0x3')]},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x9c15('0xf')],'defaultValue':![],'comment':_0x9c15('0x13'),'set':function(_0x59ab29){if(!_0x59ab29)this[_0x9c15('0x14')](_0x9c15('0x15'),null);this['setDataValue']('mandatoryDisposition',_0x59ab29);}}}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.controller.js b/server/api/smsAccount/smsAccount.controller.js index 11edb87..a0ad08f 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 _0x23f5=['intersection','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','includeAll','findAll','rows','show','keys','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','addDisposition','Disposition','findOne','pick','SmsAccountId','removeDispositions','ids','addAnswer','CannedAnswer','order','removeAnswers','notify','SmsApplication','Applications','applications','asc','account','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','twilio','from','Body','messageId','skebby','sender','text','connectel','clicksend','message_id','From','Text','MessageUUID','results','csc','originatingAddress','clickatell','fromNumber','replyMessageId','bandwidth','intelepeer','refid','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','Contacts','spread','interaction','created','autoclose','close','unmanaged','SmsMessage','ContactId','AttachmentId','UserId','unshift','agent','waitForTheAssignedAgent','*,*,*,*','Start','startRouting','receiveMessage','text/xml','send','\x0a','addApplications','sequelize','Transaction','ISOLATION_LEVELS','READ_COMMITTED','bulkCreate','priority','finally','getApplications','getInteractions','SmsInteraction','Contact','User','Owner','internal','Tag','Tags','color','tag','CmList','List','out','Messages','dataValues','push','received\x20delivery\x20report\x20from','inspect','skebby_dispatch_id','requestid','statusInt','status_code','infobip','groupName','redif','DELIVERED','error_code','DELIVERED_TO_GATEWAY','RECEIVED_BY_RECIPIENT','message-delivered','DELIVRD','statusGet','message-id','state','addAgents','omit','emit','userSmsAccount:save','removeAgents','isArray','userSmsAccount:remove','getAgents','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','defaults','redis','localhost','socket.io-emitter','register','jayson/promise','client','request','then','info','SmsAccount,\x20%s,\x20%s','debug','SmsAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','status','end','json','undefined','limit','count','offset','set','apply','reject','save','update','destroy','get','SmsAccounts','sendStatus','stack','name','index','Pause','mandatoryDispositionPause','map','SmsAccount','rawAttributes','fieldName','type','key','query','filters','model','attributes'];(function(_0x413feb,_0x10477f){var _0x40ee88=function(_0x32a3f6){while(--_0x32a3f6){_0x413feb['push'](_0x413feb['shift']());}};_0x40ee88(++_0x10477f);}(_0x23f5,0x183));var _0x523f=function(_0x174a72,_0x46034c){_0x174a72=_0x174a72-0x0;var _0x32cecd=_0x23f5[_0x174a72];return _0x32cecd;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x523f('0x0'));var zipdir=require(_0x523f('0x1'));var jsonpatch=require(_0x523f('0x2'));var rp=require(_0x523f('0x3'));var moment=require(_0x523f('0x4'));var BPromise=require(_0x523f('0x5'));var Mustache=require(_0x523f('0x6'));var util=require(_0x523f('0x7'));var path=require(_0x523f('0x8'));var sox=require(_0x523f('0x9'));var csv=require(_0x523f('0xa'));var ejs=require(_0x523f('0xb'));var fs=require('fs');var fs_extra=require(_0x523f('0xc'));var _=require(_0x523f('0xd'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x523f('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x523f('0xa'));var querystring=require(_0x523f('0xf'));var Papa=require(_0x523f('0x10'));var Redis=require(_0x523f('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x523f('0x12'));var as=require(_0x523f('0x13'));var hardwareService=require(_0x523f('0x14'));var logger=require(_0x523f('0x15'))('api');var utils=require(_0x523f('0x16'));var config=require(_0x523f('0x17'));var licenseUtil=require(_0x523f('0x18'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x523f('0x19')](config[_0x523f('0x1a')],{'host':_0x523f('0x1b'),'port':0x18eb});var socket=require(_0x523f('0x1c'))(new Redis(config['redis']));require('./smsAccount.socket')[_0x523f('0x1d')](socket);var jayson=require(_0x523f('0x1e'));var client=jayson[_0x523f('0x1f')]['http']({'port':0x232c});function respondWithRpcPromise(_0x5b9e63,_0x4ed49c,_0x26bf05,_0x2dd2e8){return new BPromise(function(_0x2e8e34,_0x48cc02){var _0x47368f=_0x2dd2e8||client;return _0x47368f[_0x523f('0x20')](_0x5b9e63,_0x26bf05)[_0x523f('0x21')](function(_0x348833){logger[_0x523f('0x22')](_0x523f('0x23'),_0x4ed49c,'request\x20sent');logger[_0x523f('0x24')](_0x523f('0x25'),_0x4ed49c,_0x523f('0x26'),JSON[_0x523f('0x27')](_0x348833));if(_0x348833[_0x523f('0x28')]){if(_0x348833[_0x523f('0x28')][_0x523f('0x29')]===0x1f4){logger['error'](_0x523f('0x23'),_0x4ed49c,_0x348833[_0x523f('0x28')][_0x523f('0x2a')]);return _0x48cc02(_0x348833['error'][_0x523f('0x2a')]);}logger[_0x523f('0x28')](_0x523f('0x23'),_0x4ed49c,_0x348833['error'][_0x523f('0x2a')]);return _0x2e8e34(_0x348833[_0x523f('0x28')]['message']);}else{logger[_0x523f('0x22')](_0x523f('0x23'),_0x4ed49c,_0x523f('0x26'));_0x2e8e34(_0x348833['result'][_0x523f('0x2a')]);}})[_0x523f('0x2b')](function(_0xe48fdb){logger[_0x523f('0x28')](_0x523f('0x23'),_0x4ed49c,_0xe48fdb);_0x48cc02(_0xe48fdb);});});}function respondWithStatusCode(_0x41b818,_0x532521){_0x532521=_0x532521||0xcc;return function(_0x283c5c){if(_0x283c5c){return _0x41b818['sendStatus'](_0x532521);}return _0x41b818[_0x523f('0x2c')](_0x532521)[_0x523f('0x2d')]();};}function respondWithResult(_0x174dfd,_0x496696){_0x496696=_0x496696||0xc8;return function(_0x49ac77){if(_0x49ac77){return _0x174dfd['status'](_0x496696)[_0x523f('0x2e')](_0x49ac77);}};}function respondWithFilteredResult(_0x2bfc2b,_0x35626e){return function(_0x4d0b87){if(_0x4d0b87){var _0x4e5c98=typeof _0x35626e['offset']===_0x523f('0x2f')&&typeof _0x35626e[_0x523f('0x30')]===_0x523f('0x2f');var _0x4bba72=_0x4d0b87[_0x523f('0x31')];var _0x198277=_0x4e5c98?0x0:_0x35626e['offset'];var _0x334d29=_0x4e5c98?_0x4d0b87[_0x523f('0x31')]:_0x35626e[_0x523f('0x32')]+_0x35626e[_0x523f('0x30')];var _0x5144d1;if(_0x334d29>=_0x4bba72){_0x334d29=_0x4bba72;_0x5144d1=0xc8;}else{_0x5144d1=0xce;}_0x2bfc2b['status'](_0x5144d1);return _0x2bfc2b[_0x523f('0x33')]('Content-Range',_0x198277+'-'+_0x334d29+'/'+_0x4bba72)[_0x523f('0x2e')](_0x4d0b87);}return null;};}function patchUpdates(_0x3faf04){return function(_0x1daf75){try{jsonpatch[_0x523f('0x34')](_0x1daf75,_0x3faf04,!![]);}catch(_0x3ec40f){return BPromise[_0x523f('0x35')](_0x3ec40f);}return _0x1daf75[_0x523f('0x36')]();};}function saveUpdates(_0x2d8c81,_0x53d53a){return function(_0x4eb36f){if(_0x4eb36f){return _0x4eb36f[_0x523f('0x37')](_0x2d8c81)[_0x523f('0x21')](function(_0x281ca4){return _0x281ca4;});}return null;};}function removeEntity(_0x4391ef,_0x54bcca){return function(_0x253eba){if(_0x253eba){return _0x253eba[_0x523f('0x38')]()[_0x523f('0x21')](function(){var _0xa89c54=_0x253eba[_0x523f('0x39')]({'plain':!![]});var _0x2f3d5a=_0x523f('0x3a');return db['UserProfileResource'][_0x523f('0x38')]({'where':{'type':_0x2f3d5a,'resourceId':_0xa89c54['id']}})['then'](function(){return _0x253eba;});})[_0x523f('0x21')](function(){_0x4391ef['status'](0xcc)[_0x523f('0x2d')]();});}};}function handleEntityNotFound(_0x54a1ea,_0x5369f7){return function(_0x554ee4){if(!_0x554ee4){_0x54a1ea[_0x523f('0x3b')](0x194);}return _0x554ee4;};}function handleError(_0x956700,_0x3dc9bc){_0x3dc9bc=_0x3dc9bc||0x1f4;return function(_0x430671){logger[_0x523f('0x28')](_0x430671[_0x523f('0x3c')]);if(_0x430671[_0x523f('0x3d')]){delete _0x430671[_0x523f('0x3d')];}_0x956700[_0x523f('0x2c')](_0x3dc9bc)['send'](_0x430671);};}exports[_0x523f('0x3e')]=function(_0x358f2c,_0x5b27d9){var _0x4534a3={'include':[{'model':db[_0x523f('0x3f')],'as':_0x523f('0x40')}]},_0x50b02c={},_0x5148f8={'count':0x0,'rows':[]};var _0x4612df=_[_0x523f('0x41')](db[_0x523f('0x42')][_0x523f('0x43')],function(_0x1d2158){return{'name':_0x1d2158[_0x523f('0x44')],'type':_0x1d2158[_0x523f('0x45')][_0x523f('0x46')]};});_0x50b02c['model']=_[_0x523f('0x41')](_0x4612df,_0x523f('0x3d'));_0x50b02c['query']=_['keys'](_0x358f2c[_0x523f('0x47')]);_0x50b02c[_0x523f('0x48')]=_['intersection'](_0x50b02c[_0x523f('0x49')],_0x50b02c['query']);_0x4534a3[_0x523f('0x4a')]=_[_0x523f('0x4b')](_0x50b02c['model'],qs[_0x523f('0x4c')](_0x358f2c[_0x523f('0x47')]['fields']));_0x4534a3['attributes']=_0x4534a3[_0x523f('0x4a')][_0x523f('0x4d')]?_0x4534a3[_0x523f('0x4a')]:_0x50b02c[_0x523f('0x49')];if(!_0x358f2c['query'][_0x523f('0x4e')](_0x523f('0x4f'))){_0x4534a3[_0x523f('0x30')]=qs[_0x523f('0x30')](_0x358f2c[_0x523f('0x47')][_0x523f('0x30')]);_0x4534a3[_0x523f('0x32')]=qs[_0x523f('0x32')](_0x358f2c[_0x523f('0x47')][_0x523f('0x32')]);}_0x4534a3['order']=qs[_0x523f('0x50')](_0x358f2c[_0x523f('0x47')][_0x523f('0x50')]);_0x4534a3[_0x523f('0x51')]=qs[_0x523f('0x48')](_['pick'](_0x358f2c['query'],_0x50b02c[_0x523f('0x48')]),_0x4612df);if(_0x358f2c[_0x523f('0x47')][_0x523f('0x52')]){_0x4534a3[_0x523f('0x51')]=_[_0x523f('0x53')](_0x4534a3[_0x523f('0x51')],{'$or':_[_0x523f('0x41')](_0x4612df,function(_0x538657){if(_0x538657[_0x523f('0x45')]!==_0x523f('0x54')){var _0x279f8a={};_0x279f8a[_0x538657[_0x523f('0x3d')]]={'$like':'%'+_0x358f2c[_0x523f('0x47')][_0x523f('0x52')]+'%'};return _0x279f8a;}})});}_0x4534a3=_['merge']({},_0x4534a3,_0x358f2c[_0x523f('0x55')]);var _0x189ac1={'where':_0x4534a3[_0x523f('0x51')]};return db[_0x523f('0x42')]['count'](_0x189ac1)[_0x523f('0x21')](function(_0x32980f){_0x5148f8[_0x523f('0x31')]=_0x32980f;if(_0x358f2c['query'][_0x523f('0x56')]){_0x4534a3['include']=[{'all':!![]}];}return db[_0x523f('0x42')][_0x523f('0x57')](_0x4534a3);})[_0x523f('0x21')](function(_0x14e8bd){_0x5148f8[_0x523f('0x58')]=_0x14e8bd;return _0x5148f8;})[_0x523f('0x21')](respondWithFilteredResult(_0x5b27d9,_0x4534a3))[_0x523f('0x2b')](handleError(_0x5b27d9,null));};exports[_0x523f('0x59')]=function(_0x22b7be,_0x39224a){var _0x396b1f={'raw':![],'where':{'id':_0x22b7be['params']['id']},'include':[{'model':db['Pause'],'as':_0x523f('0x40')}]},_0x48bf05={};_0x48bf05['model']=_[_0x523f('0x5a')](db['SmsAccount'][_0x523f('0x43')]);_0x48bf05[_0x523f('0x47')]=_['keys'](_0x22b7be[_0x523f('0x47')]);_0x48bf05[_0x523f('0x48')]=_[_0x523f('0x4b')](_0x48bf05[_0x523f('0x49')],_0x48bf05[_0x523f('0x47')]);_0x396b1f[_0x523f('0x4a')]=_['intersection'](_0x48bf05[_0x523f('0x49')],qs[_0x523f('0x4c')](_0x22b7be[_0x523f('0x47')]['fields']));_0x396b1f['attributes']=_0x396b1f[_0x523f('0x4a')]['length']?_0x396b1f[_0x523f('0x4a')]:_0x48bf05['model'];if(_0x22b7be[_0x523f('0x47')][_0x523f('0x56')]){_0x396b1f[_0x523f('0x5b')]=[{'all':!![]}];}_0x396b1f=_[_0x523f('0x53')]({},_0x396b1f,_0x22b7be[_0x523f('0x55')]);return db[_0x523f('0x42')][_0x523f('0x5c')](_0x396b1f)[_0x523f('0x21')](handleEntityNotFound(_0x39224a,null))[_0x523f('0x21')](respondWithResult(_0x39224a,null))[_0x523f('0x2b')](handleError(_0x39224a,null));};exports['create']=function(_0x2dde09,_0x604e7a){return db[_0x523f('0x42')][_0x523f('0x5d')](_0x2dde09[_0x523f('0x5e')],{})['then'](function(_0x55885e){var _0x43adb8=_0x2dde09[_0x523f('0x5f')][_0x523f('0x39')]({'plain':!![]});if(!_0x43adb8)throw new Error(_0x523f('0x60'));if(_0x43adb8[_0x523f('0x61')]===_0x523f('0x5f')){var _0x5f322a=_0x55885e['get']({'plain':!![]});var _0x33f7c1=_0x523f('0x3a');return db[_0x523f('0x62')]['find']({'where':{'name':_0x33f7c1,'userProfileId':_0x43adb8[_0x523f('0x63')]},'raw':!![]})['then'](function(_0x4af3b3){if(_0x4af3b3&&_0x4af3b3[_0x523f('0x64')]===0x0){return db[_0x523f('0x65')][_0x523f('0x5d')]({'name':_0x5f322a[_0x523f('0x3d')],'resourceId':_0x5f322a['id'],'type':_0x4af3b3[_0x523f('0x3d')],'sectionId':_0x4af3b3['id']},{})[_0x523f('0x21')](function(){return _0x55885e;});}else{return _0x55885e;}})['catch'](function(_0x59a0d5){logger[_0x523f('0x28')](_0x523f('0x66'),_0x59a0d5);throw _0x59a0d5;});}return _0x55885e;})[_0x523f('0x21')](respondWithResult(_0x604e7a,0xc9))[_0x523f('0x2b')](handleError(_0x604e7a,null));};exports[_0x523f('0x37')]=function(_0x3a0edd,_0x27548a){if(_0x3a0edd['body']['id']){delete _0x3a0edd[_0x523f('0x5e')]['id'];}return db[_0x523f('0x42')][_0x523f('0x5c')]({'where':{'id':_0x3a0edd[_0x523f('0x67')]['id']},'include':[{'model':db[_0x523f('0x3f')],'as':_0x523f('0x40')}]})[_0x523f('0x21')](handleEntityNotFound(_0x27548a,null))[_0x523f('0x21')](saveUpdates(_0x3a0edd['body'],null))[_0x523f('0x21')](respondWithResult(_0x27548a,null))['catch'](handleError(_0x27548a,null));};exports[_0x523f('0x38')]=function(_0x2e1519,_0x406ec3){return db[_0x523f('0x42')]['find']({'where':{'id':_0x2e1519[_0x523f('0x67')]['id']}})['then'](handleEntityNotFound(_0x406ec3,null))[_0x523f('0x21')](removeEntity(_0x406ec3,null))[_0x523f('0x2b')](handleError(_0x406ec3,null));};exports[_0x523f('0x68')]=function(_0x2c12c7,_0xeb0fd0){return db[_0x523f('0x42')][_0x523f('0x68')]()[_0x523f('0x21')](respondWithResult(_0xeb0fd0,null))[_0x523f('0x2b')](handleError(_0xeb0fd0,null));};exports[_0x523f('0x69')]=function(_0x5c3a4a,_0x563b5f,_0x2ad302){if(_0x5c3a4a[_0x523f('0x5e')]['id']){delete _0x5c3a4a['body']['id'];}return db['SmsAccount'][_0x523f('0x5c')]({'where':{'id':_0x5c3a4a[_0x523f('0x67')]['id']}})[_0x523f('0x21')](handleEntityNotFound(_0x563b5f,null))[_0x523f('0x21')](function(_0x5b92f3){if(_0x5b92f3){_0x5c3a4a[_0x523f('0x5e')]['SmsAccountId']=_0x5b92f3['id'];return db[_0x523f('0x6a')][_0x523f('0x5d')](_0x5c3a4a[_0x523f('0x5e')]);}})['then'](respondWithResult(_0x563b5f,null))[_0x523f('0x2b')](handleError(_0x563b5f,null));};exports['getDispositions']=function(_0x4e9766,_0x3dcecd,_0x4e0e1d){var _0x4d1e9b={'raw':![],'where':{}};var _0xc8108b={};var _0x25f32c={'count':0x0,'rows':[]};return db[_0x523f('0x42')][_0x523f('0x6b')]({'where':{'id':_0x4e9766[_0x523f('0x67')]['id']}})[_0x523f('0x21')](handleEntityNotFound(_0x3dcecd,null))[_0x523f('0x21')](function(_0x481dd1){if(_0x481dd1){_0xc8108b[_0x523f('0x49')]=_[_0x523f('0x5a')](db[_0x523f('0x6a')]['rawAttributes']);_0xc8108b[_0x523f('0x47')]=_['keys'](_0x4e9766[_0x523f('0x47')]);_0xc8108b[_0x523f('0x48')]=_[_0x523f('0x4b')](_0xc8108b['model'],_0xc8108b['query']);_0x4d1e9b[_0x523f('0x4a')]=_[_0x523f('0x4b')](_0xc8108b[_0x523f('0x49')],qs['fields'](_0x4e9766[_0x523f('0x47')][_0x523f('0x4c')]));_0x4d1e9b[_0x523f('0x4a')]=_0x4d1e9b['attributes']['length']?_0x4d1e9b['attributes']:_0xc8108b['model'];if(!_0x4e9766['query'][_0x523f('0x4e')]('nolimit')){_0x4d1e9b[_0x523f('0x30')]=qs[_0x523f('0x30')](_0x4e9766[_0x523f('0x47')][_0x523f('0x30')]);_0x4d1e9b[_0x523f('0x32')]=qs[_0x523f('0x32')](_0x4e9766['query'][_0x523f('0x32')]);}_0x4d1e9b['order']=qs[_0x523f('0x50')](_0x4e9766[_0x523f('0x47')][_0x523f('0x50')]);_0x4d1e9b['where']=qs[_0x523f('0x48')](_[_0x523f('0x6c')](_0x4e9766['query'],_0xc8108b['filters']));_0x4d1e9b[_0x523f('0x51')][_0x523f('0x6d')]=_0x481dd1['id'];if(_0x4e9766[_0x523f('0x47')][_0x523f('0x52')]){_0x4d1e9b[_0x523f('0x51')]=_['merge'](_0x4d1e9b[_0x523f('0x51')],{'$or':_[_0x523f('0x41')](_0x4d1e9b[_0x523f('0x4a')],function(_0x2d8ea2){var _0x16e5b2={};_0x16e5b2[_0x2d8ea2]={'$like':'%'+_0x4e9766[_0x523f('0x47')][_0x523f('0x52')]+'%'};return _0x16e5b2;})});}_0x4d1e9b=_['merge']({},_0x4d1e9b,_0x4e9766[_0x523f('0x55')]);return db[_0x523f('0x6a')]['count']({'where':_0x4d1e9b[_0x523f('0x51')]})[_0x523f('0x21')](function(_0x488c07){_0x25f32c[_0x523f('0x31')]=_0x488c07;if(_0x4e9766[_0x523f('0x47')]['includeAll']){_0x4d1e9b[_0x523f('0x5b')]=[{'all':!![]}];}return db[_0x523f('0x6a')][_0x523f('0x57')](_0x4d1e9b);})[_0x523f('0x21')](function(_0xc90a4e){_0x25f32c[_0x523f('0x58')]=_0xc90a4e;return _0x25f32c;});}})[_0x523f('0x21')](respondWithFilteredResult(_0x3dcecd,_0x4d1e9b))[_0x523f('0x2b')](handleError(_0x3dcecd,null));};exports[_0x523f('0x6e')]=function(_0x33a512,_0x37537c,_0x4b0da5){return db['SmsAccount'][_0x523f('0x5c')]({'where':{'id':_0x33a512['params']['id']}})[_0x523f('0x21')](handleEntityNotFound(_0x37537c,null))[_0x523f('0x21')](function(_0x542141){if(_0x542141){return _0x542141['removeDispositions'](_0x33a512[_0x523f('0x47')][_0x523f('0x6f')]);}})[_0x523f('0x21')](respondWithStatusCode(_0x37537c,null))[_0x523f('0x2b')](handleError(_0x37537c,null));};exports[_0x523f('0x70')]=function(_0x349c09,_0x14890e,_0x52a17c){if(_0x349c09[_0x523f('0x5e')]['id']){delete _0x349c09[_0x523f('0x5e')]['id'];}return db['SmsAccount'][_0x523f('0x5c')]({'where':{'id':_0x349c09[_0x523f('0x67')]['id']}})['then'](handleEntityNotFound(_0x14890e,null))[_0x523f('0x21')](function(_0x437e32){if(_0x437e32){_0x349c09[_0x523f('0x5e')][_0x523f('0x6d')]=_0x437e32['id'];return db[_0x523f('0x71')]['create'](_0x349c09[_0x523f('0x5e')]);}})['then'](respondWithResult(_0x14890e,null))[_0x523f('0x2b')](handleError(_0x14890e,null));};exports['getAnswers']=function(_0x436c01,_0x6dcfec,_0x3e227b){var _0x4609ef={'raw':![],'where':{}};var _0xb17039={};var _0x2c4085={'count':0x0,'rows':[]};return db[_0x523f('0x42')]['findOne']({'where':{'id':_0x436c01[_0x523f('0x67')]['id']}})['then'](handleEntityNotFound(_0x6dcfec,null))['then'](function(_0x1acccb){if(_0x1acccb){_0xb17039[_0x523f('0x49')]=_[_0x523f('0x5a')](db[_0x523f('0x71')][_0x523f('0x43')]);_0xb17039[_0x523f('0x47')]=_[_0x523f('0x5a')](_0x436c01[_0x523f('0x47')]);_0xb17039['filters']=_[_0x523f('0x4b')](_0xb17039['model'],_0xb17039['query']);_0x4609ef[_0x523f('0x4a')]=_[_0x523f('0x4b')](_0xb17039[_0x523f('0x49')],qs[_0x523f('0x4c')](_0x436c01[_0x523f('0x47')][_0x523f('0x4c')]));_0x4609ef[_0x523f('0x4a')]=_0x4609ef['attributes']['length']?_0x4609ef[_0x523f('0x4a')]:_0xb17039[_0x523f('0x49')];if(!_0x436c01['query']['hasOwnProperty'](_0x523f('0x4f'))){_0x4609ef[_0x523f('0x30')]=qs['limit'](_0x436c01[_0x523f('0x47')]['limit']);_0x4609ef[_0x523f('0x32')]=qs[_0x523f('0x32')](_0x436c01['query'][_0x523f('0x32')]);}_0x4609ef[_0x523f('0x72')]=qs[_0x523f('0x50')](_0x436c01[_0x523f('0x47')][_0x523f('0x50')]);_0x4609ef[_0x523f('0x51')]=qs[_0x523f('0x48')](_[_0x523f('0x6c')](_0x436c01[_0x523f('0x47')],_0xb17039[_0x523f('0x48')]));_0x4609ef[_0x523f('0x51')][_0x523f('0x6d')]=_0x1acccb['id'];if(_0x436c01['query'][_0x523f('0x52')]){_0x4609ef[_0x523f('0x51')]=_[_0x523f('0x53')](_0x4609ef[_0x523f('0x51')],{'$or':_[_0x523f('0x41')](_0x4609ef[_0x523f('0x4a')],function(_0x3ad662){var _0x50948c={};_0x50948c[_0x3ad662]={'$like':'%'+_0x436c01['query'][_0x523f('0x52')]+'%'};return _0x50948c;})});}_0x4609ef=_[_0x523f('0x53')]({},_0x4609ef,_0x436c01[_0x523f('0x55')]);return db[_0x523f('0x71')]['count']({'where':_0x4609ef[_0x523f('0x51')]})[_0x523f('0x21')](function(_0x45d140){_0x2c4085[_0x523f('0x31')]=_0x45d140;if(_0x436c01[_0x523f('0x47')]['includeAll']){_0x4609ef[_0x523f('0x5b')]=[{'all':!![]}];}return db[_0x523f('0x71')][_0x523f('0x57')](_0x4609ef);})[_0x523f('0x21')](function(_0xa075b5){_0x2c4085[_0x523f('0x58')]=_0xa075b5;return _0x2c4085;});}})['then'](respondWithFilteredResult(_0x6dcfec,_0x4609ef))[_0x523f('0x2b')](handleError(_0x6dcfec,null));};exports[_0x523f('0x73')]=function(_0x1c2d07,_0x331564,_0x21513e){return db[_0x523f('0x42')]['find']({'where':{'id':_0x1c2d07[_0x523f('0x67')]['id']}})[_0x523f('0x21')](handleEntityNotFound(_0x331564,null))[_0x523f('0x21')](function(_0x32be2e){if(_0x32be2e){return _0x32be2e['removeAnswers'](_0x1c2d07['query']['ids']);}})[_0x523f('0x21')](respondWithStatusCode(_0x331564,null))[_0x523f('0x2b')](handleError(_0x331564,null));};exports[_0x523f('0x74')]=function(_0x1ce42f,_0x2bfdc1,_0x4eaeb1){var _0x2b588d={'channel':'sms'};var _0x416c60=[];var _0x5648a5=[];var _0x5c2c00={};return db[_0x523f('0x42')][_0x523f('0x5c')]({'where':{'id':_0x1ce42f['params']['id']},'include':[{'model':db[_0x523f('0x75')],'as':_0x523f('0x76')}]})[_0x523f('0x21')](handleEntityNotFound(_0x2bfdc1,null))[_0x523f('0x21')](function(_0x59ea65){_0x2b588d['account']=_0x59ea65;_0x2b588d[_0x523f('0x77')]=_['orderBy'](_0x59ea65[_0x523f('0x76')],['priority'],[_0x523f('0x78')]);if(_0x2b588d[_0x523f('0x79')][_0x523f('0x76')]){delete _0x2b588d[_0x523f('0x79')][_0x523f('0x76')];}return db[_0x523f('0x7a')][_0x523f('0x68')]();})[_0x523f('0x21')](function(_0x1e8def){if(!_0x1e8def){throw new db[(_0x523f('0x7b'))][(_0x523f('0x7c'))](_0x523f('0x7d'));}_0x416c60=_[_0x523f('0x7e')](_[_0x523f('0x5a')](_0x1e8def),[_0x523f('0x7f'),_0x523f('0x80')]);_0x5648a5=_[_0x523f('0x7e')](_['keys'](_0x1e8def),['createdAt','updatedAt',_0x523f('0x81'),_0x523f('0x82')]);_0x2b588d[_0x523f('0x5e')]={'mapKey':'mobile'};if(_0x2b588d['account'][_0x523f('0x45')]){switch(_0x2b588d[_0x523f('0x79')][_0x523f('0x45')]){case _0x523f('0x83'):_0x2b588d['body'][_0x523f('0x84')]=_0x1ce42f[_0x523f('0x5e')]['From'];_0x2b588d[_0x523f('0x5e')][_0x523f('0x5e')]=_0x1ce42f[_0x523f('0x5e')][_0x523f('0x85')];_0x2b588d['body'][_0x523f('0x86')]=_0x1ce42f[_0x523f('0x5e')]['MessageSid'];break;case _0x523f('0x87'):_0x2b588d[_0x523f('0x5e')]['from']='+'+_0x1ce42f['body'][_0x523f('0x88')];_0x2b588d[_0x523f('0x5e')][_0x523f('0x5e')]=_0x1ce42f[_0x523f('0x5e')][_0x523f('0x89')];break;case _0x523f('0x8a'):_0x2b588d[_0x523f('0x5e')][_0x523f('0x84')]=_0x1ce42f[_0x523f('0x5e')][_0x523f('0x84')];_0x2b588d['body']['body']=_0x1ce42f[_0x523f('0x5e')][_0x523f('0x2a')];break;case _0x523f('0x8b'):_0x2b588d[_0x523f('0x5e')][_0x523f('0x84')]=_0x1ce42f[_0x523f('0x5e')][_0x523f('0x84')];_0x2b588d[_0x523f('0x5e')][_0x523f('0x5e')]=_0x1ce42f[_0x523f('0x5e')][_0x523f('0x5e')];_0x2b588d['body'][_0x523f('0x86')]=_0x1ce42f['body'][_0x523f('0x8c')];break;case'plivo':_0x2b588d['body'][_0x523f('0x84')]=_0x1ce42f[_0x523f('0x5e')][_0x523f('0x8d')];_0x2b588d[_0x523f('0x5e')][_0x523f('0x5e')]=_0x1ce42f[_0x523f('0x5e')][_0x523f('0x8e')];_0x2b588d[_0x523f('0x5e')]['messageId']=_0x1ce42f[_0x523f('0x5e')][_0x523f('0x8f')];break;case'infobip':_0x2b588d[_0x523f('0x5e')]['from']='+'+_0x1ce42f[_0x523f('0x5e')][_0x523f('0x90')][0x0][_0x523f('0x84')];_0x2b588d[_0x523f('0x5e')][_0x523f('0x5e')]=_0x1ce42f[_0x523f('0x5e')][_0x523f('0x90')][0x0][_0x523f('0x89')];_0x2b588d[_0x523f('0x5e')][_0x523f('0x86')]=_0x1ce42f[_0x523f('0x5e')][_0x523f('0x90')][0x0][_0x523f('0x86')];break;case _0x523f('0x91'):_0x2b588d[_0x523f('0x5e')]['from']=_0x1ce42f['body'][_0x523f('0x92')];_0x2b588d[_0x523f('0x5e')][_0x523f('0x5e')]=_0x1ce42f['body']['segmentedMessage'][_0x523f('0x2a')];break;case _0x523f('0x93'):_0x2b588d[_0x523f('0x5e')][_0x523f('0x84')]=_0x1ce42f[_0x523f('0x5e')][_0x523f('0x94')];_0x2b588d[_0x523f('0x5e')][_0x523f('0x5e')]=_0x1ce42f[_0x523f('0x5e')][_0x523f('0x89')];_0x2b588d[_0x523f('0x5e')][_0x523f('0x86')]=_0x1ce42f[_0x523f('0x5e')][_0x523f('0x95')];break;case _0x523f('0x96'):_0x2b588d['body'][_0x523f('0x86')]=_0x1ce42f[_0x523f('0x5e')][0x0]['message']['id'];_0x2b588d[_0x523f('0x5e')]['from']=_0x1ce42f[_0x523f('0x5e')][0x0]['message'][_0x523f('0x84')];_0x2b588d[_0x523f('0x5e')][_0x523f('0x5e')]=_0x1ce42f[_0x523f('0x5e')][0x0]['message'][_0x523f('0x89')];break;case _0x523f('0x97'):_0x2b588d[_0x523f('0x5e')][_0x523f('0x84')]=_0x1ce42f['body'][_0x523f('0x84')];_0x2b588d[_0x523f('0x5e')][_0x523f('0x5e')]=_0x1ce42f[_0x523f('0x5e')][_0x523f('0x2a')];_0x2b588d['body'][_0x523f('0x86')]=_0x1ce42f[_0x523f('0x5e')][_0x523f('0x98')];break;}}if(_0x2b588d[_0x523f('0x5e')]['id']){delete _0x2b588d[_0x523f('0x5e')]['id'];}if(_[_0x523f('0x99')](_0x2b588d[_0x523f('0x5e')][_0x523f('0x84')])){throw new db[(_0x523f('0x7b'))]['ValidationError'](_0x523f('0x9a'));}if(_['isNil'](_0x2b588d[_0x523f('0x5e')][_0x523f('0x5e')])||_0x2b588d[_0x523f('0x5e')][_0x523f('0x5e')]===''){throw new db[(_0x523f('0x7b'))][(_0x523f('0x7c'))](_0x523f('0x9b'));}if(_[_0x523f('0x99')](_0x2b588d[_0x523f('0x5e')][_0x523f('0x9c')])){throw new db[(_0x523f('0x7b'))][(_0x523f('0x7c'))](_0x523f('0x9d')+_0x5648a5);}if(!_['includes'](_0x5648a5,_0x2b588d[_0x523f('0x5e')][_0x523f('0x9c')])){throw new db[(_0x523f('0x7b'))][(_0x523f('0x7c'))](_0x523f('0x9e')+_0x5648a5);}_0x5c2c00[_0x2b588d[_0x523f('0x5e')]['mapKey']]=_0x2b588d[_0x523f('0x5e')]['from'];return db['CmList'][_0x523f('0x5c')]({'where':{'id':_0x2b588d['account']['ListId']},'include':[{'model':db[_0x523f('0x7a')],'as':'Contacts','where':_0x5c2c00,'limit':0x1,'order':[[_0x523f('0x80'),'DESC']]}]});})[_0x523f('0x21')](handleEntityNotFound(_0x2bfdc1,null))[_0x523f('0x21')](function(_0x5a9909){if(_0x5a9909){_0x2b588d['list']=_['omit'](_0x5a9909,[_0x523f('0x9f')]);if(_0x5a9909[_0x523f('0x9f')]['length']){return _0x5a9909[_0x523f('0x9f')][0x0];}var _0x19c34a=_[_0x523f('0x19')](_0x2b588d[_0x523f('0x5e')],{'firstName':_0x2b588d['body'][_0x523f('0x84')],'ListId':_0x5a9909['id']});_0x19c34a[_0x2b588d[_0x523f('0x5e')][_0x523f('0x9c')]]=_0x2b588d['body'][_0x523f('0x84')];return db[_0x523f('0x7a')][_0x523f('0x5d')](_0x19c34a,{'fields':_0x416c60,'raw':!![]});}})[_0x523f('0x21')](handleEntityNotFound(_0x2bfdc1,null))[_0x523f('0x21')](function(_0x137b09){if(_0x137b09){_0x2b588d['contact']=_0x137b09;var _0x2b9ead={'ContactId':_0x137b09['id'],'phone':_0x2b588d[_0x523f('0x5e')][_0x523f('0x84')],'SmsAccountId':_0x1ce42f[_0x523f('0x67')]['id']};var _0x14655d={'ContactId':_0x137b09['id'],'SmsAccountId':_0x1ce42f[_0x523f('0x67')]['id'],'closed':![]};return db['SmsInteraction'][_0x523f('0x5c')]({'where':_0x14655d})[_0x523f('0x21')](function(_0x4601bb){if(_0x4601bb){return[_0x4601bb,![]];}return db['SmsInteraction'][_0x523f('0x5d')](_0x2b9ead)[_0x523f('0x21')](function(_0x75b617){return[_0x75b617,!![]];});});}})[_0x523f('0xa0')](function(_0x5f2e5b,_0x1f9e12){_0x2b588d[_0x523f('0xa1')]=_0x5f2e5b[_0x523f('0x39')]({'plain':!![]});_0x2b588d['interaction'][_0x523f('0xa2')]=![];if(_0x1f9e12){if(_0x2b588d['account'][_0x523f('0xa3')]){_0x2b588d[_0x523f('0x77')]['push']({'id':0x0,'priority':_0x2b588d['applications'][_0x523f('0x4d')]+0x1,'app':_0x523f('0xa4'),'appdata':_0x523f('0xa5'),'interval':'*,*,*,*'});}_0x2b588d[_0x523f('0xa1')][_0x523f('0xa2')]=!![];}return db[_0x523f('0xa6')][_0x523f('0x5d')]({'phone':_0x2b588d['body']['from'],'messageId':_0x2b588d[_0x523f('0x5e')][_0x523f('0x86')],'body':_0x2b588d[_0x523f('0x5e')][_0x523f('0x5e')],'SmsAccountId':_0x1ce42f['params']['id'],'SmsInteractionId':_0x5f2e5b['id'],'direction':'in','ContactId':_0x5f2e5b[_0x523f('0xa7')],'AttachmentId':_0x2b588d[_0x523f('0x5e')][_0x523f('0xa8')]});})['then'](function(_0x179fd7){_0x2b588d['message']=_0x179fd7;if(_0x2b588d['interaction'][_0x523f('0xa9')]){return db['User'][_0x523f('0x5c')]({'attributes':['id',_0x523f('0x3d')],'where':{'id':_0x2b588d[_0x523f('0xa1')]['UserId']}})[_0x523f('0x21')](function(_0x129b63){if(_0x129b63){_0x2b588d[_0x523f('0x77')][_0x523f('0xaa')]({'id':0x0,'priority':0x0,'app':_0x523f('0xab'),'appdata':_0x129b63[_0x523f('0x3d')]+','+(_0x2b588d[_0x523f('0x79')][_0x523f('0xac')]||0xa),'interval':_0x523f('0xad')});}return respondWithRpcPromise(_0x523f('0xae'),'startRouting',_0x2b588d);});}return respondWithRpcPromise(_0x523f('0xae'),_0x523f('0xaf'),_0x2b588d);})['then'](function(_0x118830){if(_0x118830){var _0x38c9c9=0xc8;var _0x2b994b=_0x523f('0xb0');logger[_0x523f('0x22')](_0x523f('0x25'),_0x2b994b,_0x38c9c9,'entity\x20found');logger[_0x523f('0x24')]('SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s',_0x2b994b,_0x38c9c9,'entity\x20found',JSON[_0x523f('0x27')](_0x118830));if(_0x2b588d[_0x523f('0x79')][_0x523f('0x45')]===_0x523f('0x83')){return _0x2bfdc1[_0x523f('0x2c')](_0x38c9c9)['set']('Content-Type',_0x523f('0xb1'))[_0x523f('0xb2')](_0x523f('0xb3'));}else{return _0x2bfdc1[_0x523f('0x2c')](_0x38c9c9)[_0x523f('0x2e')](_0x118830);}}})[_0x523f('0x2b')](handleError(_0x2bfdc1,null));};exports[_0x523f('0xb4')]=function(_0x4bbb02,_0x54eef0){var _0x1eb034=_0x4bbb02[_0x523f('0x67')]['id'];var _0x4924b4=_0x4bbb02[_0x523f('0x5e')];var _0x3fc81e=0xc8;var _0x4bf19b=null;return db[_0x523f('0xb5')]['transaction']({'isolationLevel':db[_0x523f('0xb5')][_0x523f('0xb6')][_0x523f('0xb7')][_0x523f('0xb8')]},function(_0x8c0d28){return db['SmsAccount'][_0x523f('0x6b')]({'where':{'id':_0x1eb034},'transaction':_0x8c0d28})['then'](function(_0x17f6a4){if(_0x17f6a4){return db['SmsApplication']['destroy']({'where':{'SmsAccountId':_0x1eb034},'transaction':_0x8c0d28})[_0x523f('0x21')](function(){var _0x51e60f=_['map'](_0x4924b4,function(_0x415dd8){_0x415dd8[_0x523f('0x6d')]=_0x1eb034;return _0x415dd8;});return db[_0x523f('0x75')][_0x523f('0xb9')](_0x51e60f,{'transaction':_0x8c0d28});});}else{_0x3fc81e=0x194;_0x4bf19b=[];}});})[_0x523f('0x21')](function(){if(_0x3fc81e!==0x194){return db[_0x523f('0x75')]['findAndCountAll']({'where':{'SmsAccountId':_0x1eb034},'order':_0x523f('0xba')})[_0x523f('0x21')](function(_0xbd17b5){_0x4bf19b=_0xbd17b5;});}})[_0x523f('0x2b')](function(_0x51294e){_0x3fc81e=0x1f4;logger[_0x523f('0x28')](_0x51294e[_0x523f('0x3c')]);if(_0x51294e[_0x523f('0x3d')]){delete _0x51294e[_0x523f('0x3d')];}_0x4bf19b=_0x51294e;})[_0x523f('0xbb')](function(){if(_0x4bf19b===null){_0x54eef0[_0x523f('0x3b')](_0x3fc81e);}else{if(_0x3fc81e===0x1f4){_0x54eef0[_0x523f('0x2c')](_0x3fc81e)[_0x523f('0xb2')](_0x4bf19b);}else{_0x54eef0['status'](_0x3fc81e)['json'](_0x4bf19b);}}});};exports[_0x523f('0xbc')]=function(_0x49e0a2,_0x2e6fd0,_0xc5e8dc){var _0x15dbbf={};var _0x2333c7={};var _0x372fdf;var _0x4a2ef4;return db[_0x523f('0x42')]['findOne']({'where':{'id':_0x49e0a2[_0x523f('0x67')]['id']}})['then'](handleEntityNotFound(_0x2e6fd0,null))['then'](function(_0xc949b1){if(_0xc949b1){_0x372fdf=_0xc949b1;_0x2333c7['model']=_['keys'](db[_0x523f('0x75')][_0x523f('0x43')]);_0x2333c7['query']=_[_0x523f('0x5a')](_0x49e0a2[_0x523f('0x47')]);_0x2333c7[_0x523f('0x48')]=_[_0x523f('0x4b')](_0x2333c7[_0x523f('0x49')],_0x2333c7[_0x523f('0x47')]);_0x15dbbf[_0x523f('0x4a')]=_[_0x523f('0x4b')](_0x2333c7[_0x523f('0x49')],qs[_0x523f('0x4c')](_0x49e0a2['query'][_0x523f('0x4c')]));_0x15dbbf['attributes']=_0x15dbbf[_0x523f('0x4a')]['length']?_0x15dbbf[_0x523f('0x4a')]:_0x2333c7[_0x523f('0x49')];_0x15dbbf[_0x523f('0x72')]=qs[_0x523f('0x50')](_0x49e0a2[_0x523f('0x47')]['sort']);_0x15dbbf[_0x523f('0x51')]=qs[_0x523f('0x48')](_[_0x523f('0x6c')](_0x49e0a2[_0x523f('0x47')],_0x2333c7[_0x523f('0x48')]));if(_0x49e0a2[_0x523f('0x47')][_0x523f('0x52')]){_0x15dbbf[_0x523f('0x51')]=_[_0x523f('0x53')](_0x15dbbf['where'],{'$or':_[_0x523f('0x41')](_0x15dbbf['attributes'],function(_0x44624f){var _0x38090d={};_0x38090d[_0x44624f]={'$like':'%'+_0x49e0a2[_0x523f('0x47')][_0x523f('0x52')]+'%'};return _0x38090d;})});}_0x15dbbf=_['merge']({},_0x15dbbf,_0x49e0a2[_0x523f('0x55')]);return _0x372fdf['getApplications'](_0x15dbbf);}})[_0x523f('0x21')](function(_0x2f365d){if(_0x2f365d){_0x4a2ef4=_0x2f365d[_0x523f('0x4d')];if(!_0x49e0a2['query'][_0x523f('0x4e')](_0x523f('0x4f'))){_0x15dbbf[_0x523f('0x30')]=qs['limit'](_0x49e0a2[_0x523f('0x47')][_0x523f('0x30')]);_0x15dbbf['offset']=qs['offset'](_0x49e0a2[_0x523f('0x47')]['offset']);}return _0x372fdf[_0x523f('0xbc')](_0x15dbbf);}})[_0x523f('0x21')](function(_0x436930){if(_0x436930){return _0x436930?{'count':_0x4a2ef4,'rows':_0x436930}:null;}})[_0x523f('0x21')](respondWithResult(_0x2e6fd0,null))[_0x523f('0x2b')](handleError(_0x2e6fd0,null));};exports[_0x523f('0xbd')]=function(_0x31867b,_0x27f6fd,_0x21d696){var _0x4b9628={'raw':![],'where':{}};var _0x330c44={};var _0x531be5={'count':0x0,'rows':[]};return db[_0x523f('0x42')]['findOne']({'where':{'id':_0x31867b[_0x523f('0x67')]['id']}})[_0x523f('0x21')](handleEntityNotFound(_0x27f6fd,null))[_0x523f('0x21')](function(_0x4560b4){if(_0x4560b4){_0x330c44['model']=_[_0x523f('0x5a')](db[_0x523f('0xbe')][_0x523f('0x43')]);_0x330c44[_0x523f('0x47')]=_['keys'](_0x31867b[_0x523f('0x47')]);_0x330c44[_0x523f('0x48')]=_[_0x523f('0x4b')](_0x330c44['model'],_0x330c44[_0x523f('0x47')]);_0x4b9628[_0x523f('0x4a')]=_[_0x523f('0x4b')](_0x330c44['model'],qs[_0x523f('0x4c')](_0x31867b[_0x523f('0x47')][_0x523f('0x4c')]));_0x4b9628[_0x523f('0x4a')]=_0x4b9628[_0x523f('0x4a')][_0x523f('0x4d')]?_0x4b9628[_0x523f('0x4a')]:_0x330c44['model'];if(!_0x31867b['query'][_0x523f('0x4e')]('nolimit')){_0x4b9628[_0x523f('0x30')]=qs[_0x523f('0x30')](_0x31867b[_0x523f('0x47')][_0x523f('0x30')]);_0x4b9628[_0x523f('0x32')]=qs['offset'](_0x31867b[_0x523f('0x47')][_0x523f('0x32')]);}_0x4b9628['order']=qs[_0x523f('0x50')](_0x31867b[_0x523f('0x47')][_0x523f('0x50')]);_0x4b9628[_0x523f('0x51')]=qs[_0x523f('0x48')](_[_0x523f('0x6c')](_0x31867b[_0x523f('0x47')],_0x330c44[_0x523f('0x48')]));_0x4b9628[_0x523f('0x51')][_0x523f('0x6d')]=_0x4560b4['id'];if(_0x31867b[_0x523f('0x47')][_0x523f('0x52')]){_0x4b9628[_0x523f('0x51')]=_['merge'](_0x4b9628[_0x523f('0x51')],{'$or':_['map'](_0x4b9628['attributes'],function(_0x4bedff){var _0x4ce61c={};_0x4ce61c[_0x4bedff]={'$like':'%'+_0x31867b['query'][_0x523f('0x52')]+'%'};return _0x4ce61c;})});}_0x4b9628=_['merge']({},_0x4b9628,_0x31867b[_0x523f('0x55')]);return db[_0x523f('0xbe')][_0x523f('0x31')]({'where':_0x4b9628['where']})[_0x523f('0x21')](function(_0x27cdd6){_0x531be5[_0x523f('0x31')]=_0x27cdd6;if(_0x31867b['query']['includeAll']){_0x4b9628[_0x523f('0x5b')]=[{'model':db[_0x523f('0x7a')],'as':_0x523f('0xbf'),'required':![]},{'model':db[_0x523f('0xc0')],'as':_0x523f('0xc1'),'attributes':[_0x523f('0x3d'),'fullname',_0x523f('0xc2')],'required':![]},{'model':db[_0x523f('0xc3')],'as':_0x523f('0xc4'),'attributes':['id',_0x523f('0x3d'),_0x523f('0xc5')],'where':_0x31867b[_0x523f('0x47')][_0x523f('0xc6')]?{'id':_0x31867b[_0x523f('0x47')][_0x523f('0xc6')]}:undefined,'required':_0x31867b[_0x523f('0x47')]['tag']?!![]:![]}];}return db[_0x523f('0xbe')][_0x523f('0x57')](_0x4b9628);})[_0x523f('0x21')](function(_0x17894b){_0x531be5[_0x523f('0x58')]=_0x17894b;return _0x531be5;});}})[_0x523f('0x21')](respondWithFilteredResult(_0x27f6fd,_0x4b9628))['catch'](handleError(_0x27f6fd,null));};exports['send']=function(_0x416682,_0x2ac0c7,_0xa5ed1d){var _0x32d61b,_0x184353,_0xb45f95;if(_['isNil'](_0x416682[_0x523f('0x5e')][_0x523f('0x5e')])||_0x416682[_0x523f('0x5e')][_0x523f('0x5e')]===''){throw new db[(_0x523f('0x7b'))][(_0x523f('0x7c'))](_0x523f('0x9b'));}if(_[_0x523f('0x99')](_0x416682[_0x523f('0x5e')]['to'])){throw new db[(_0x523f('0x7b'))]['ValidationError']('to\x20is\x20mandatory');}_0x32d61b=_0x416682[_0x523f('0x5e')]['to'];return db[_0x523f('0x42')][_0x523f('0x5c')]({'where':{'id':_0x416682['params']['id']},'include':[{'model':db[_0x523f('0xc7')],'as':_0x523f('0xc8'),'include':[{'model':db[_0x523f('0x7a')],'as':_0x523f('0x9f'),'where':{'mobile':_0x32d61b},'limit':0x1,'order':[[_0x523f('0x80'),'DESC']]}]}]})[_0x523f('0x21')](handleEntityNotFound(_0x2ac0c7,null))[_0x523f('0x21')](function(_0x1001a0){if(_0x1001a0&&_0x1001a0[_0x523f('0xc8')]){_0x184353=_0x1001a0[_0x523f('0x39')]({'plain':!![]});if(_0x184353[_0x523f('0xc8')]&&_0x184353[_0x523f('0xc8')][_0x523f('0x9f')][_0x523f('0x4d')]){return _0x184353[_0x523f('0xc8')]['Contacts'][0x0];}return db[_0x523f('0x7a')]['create'](_['defaults'](_0x416682[_0x523f('0x5e')],{'firstName':_0x32d61b,'mobile':_0x32d61b,'phone':_0x32d61b,'ListId':_0x184353[_0x523f('0x82')]}));}})['then'](handleEntityNotFound(_0x2ac0c7,null))[_0x523f('0x21')](function(_0x2253d1){if(_0x2253d1){_0xb45f95=_0x2253d1;return db[_0x523f('0xbe')][_0x523f('0x5c')]({'where':{'ContactId':_0xb45f95['id'],'closed':![],'SmsAccountId':_0x184353['id']}})[_0x523f('0x21')](function(_0x55c9f5){if(_0x55c9f5){return[_0x55c9f5,![]];}return db['SmsInteraction'][_0x523f('0x5d')]({'UserId':_0x416682['user']['id'],'ContactId':_0xb45f95['id'],'SmsAccountId':_0x184353['id'],'phone':_0x32d61b,'firstMsgDirection':_0x523f('0xc9'),'Messages':[_[_0x523f('0x53')](_0x416682[_0x523f('0x5e')],{'read':![],'body':_0x416682[_0x523f('0x5e')][_0x523f('0x5e')],'phone':_0x32d61b,'SmsAccountId':_0x184353['id'],'UserId':_0x416682[_0x523f('0x5f')]['id'],'ContactId':_0xb45f95['id']})]},{'include':[{'model':db[_0x523f('0xa6')],'as':_0x523f('0xca')}]})['then'](function(_0x5642cc){return[_0x5642cc,!![]];});});}})[_0x523f('0xa0')](function(_0x51f1aa,_0x3e03a6){if(_0x3e03a6){return _0x51f1aa;}return db[_0x523f('0xa6')][_0x523f('0x5d')](_[_0x523f('0x53')](_0x416682['body'],{'read':![],'body':_0x416682[_0x523f('0x5e')][_0x523f('0x5e')],'phone':_0x32d61b,'SmsAccountId':_0x184353['id'],'SmsInteractionId':_0x51f1aa['id'],'UserId':_0x416682[_0x523f('0x5f')]['id'],'ContactId':_0xb45f95['id']}))[_0x523f('0x21')](function(_0x4ab44a){_0x51f1aa[_0x523f('0xcb')][_0x523f('0xca')]=[];_0x51f1aa['dataValues'][_0x523f('0xca')][_0x523f('0xcc')](_0x4ab44a[_0x523f('0xcb')]);return _0x51f1aa;});})[_0x523f('0x21')](respondWithResult(_0x2ac0c7,null))[_0x523f('0x2b')](handleError(_0x2ac0c7,null));};exports[_0x523f('0x2c')]=function(_0x31e8e4,_0x46c0ab,_0x15814b){if(_0x31e8e4[_0x523f('0x5e')]['id']){delete _0x31e8e4['body']['id'];}var _0x432a84,_0x57f7d4,_0x12ece4;return db[_0x523f('0x42')]['find']({'where':{'id':_0x31e8e4[_0x523f('0x67')]['id']}})[_0x523f('0x21')](handleEntityNotFound(_0x46c0ab,null))[_0x523f('0x21')](function(_0x4deb52){if(_0x4deb52){_0x12ece4=_0x4deb52;logger['debug']('SmsAccount,\x20%s,\x20%s,\x20%s',_0x523f('0x2c'),_0x523f('0xcd'),_0x4deb52[_0x523f('0x45')],util[_0x523f('0xce')](_0x31e8e4[_0x523f('0x5e')],{'showHidden':![],'depth':null}));switch(_0x4deb52[_0x523f('0x45')]){case _0x523f('0x87'):if(_0x31e8e4[_0x523f('0x5e')][_0x523f('0xcf')]&&_0x31e8e4[_0x523f('0x5e')]['status']){_0x57f7d4=_0x31e8e4[_0x523f('0x5e')]['status'];return db[_0x523f('0xa6')][_0x523f('0x5c')]({'where':{'messageId':_0x31e8e4['body'][_0x523f('0xcf')]}});}break;case _0x523f('0x8a'):if(_0x31e8e4['body'][_0x523f('0xd0')]&&_0x31e8e4['body']['statusInt']){_0x57f7d4=_0x31e8e4['body'][_0x523f('0xd1')];return db[_0x523f('0xa6')][_0x523f('0x5c')]({'where':{'messageId':_0x31e8e4[_0x523f('0x5e')][_0x523f('0xd0')]}});}break;case _0x523f('0x8b'):if(_0x31e8e4['body'][_0x523f('0x8c')]&&_0x31e8e4[_0x523f('0x5e')][_0x523f('0xd2')]){_0x57f7d4=_0x31e8e4[_0x523f('0x5e')]['status_code'];return db[_0x523f('0xa6')][_0x523f('0x5c')]({'where':{'messageId':_0x31e8e4['body'][_0x523f('0x8c')]}});}break;case _0x523f('0xd3'):var _0x39a3b1=_0x31e8e4[_0x523f('0x5e')][_0x523f('0x90')][0x0];if(_0x39a3b1[_0x523f('0x86')]&&_0x39a3b1[_0x523f('0x2c')][_0x523f('0xd4')]==='DELIVERED'){_0x57f7d4=_0x39a3b1[_0x523f('0x2c')][_0x523f('0xd4')];return db[_0x523f('0xa6')][_0x523f('0x5c')]({'where':{'messageId':_0x39a3b1[_0x523f('0x86')]}});}break;case _0x523f('0x93'):if(_0x31e8e4['body']['messageId']&&_0x31e8e4[_0x523f('0x5e')]['status']){_0x57f7d4=_0x31e8e4['body'][_0x523f('0x2c')];return db['SmsMessage']['find']({'where':{'messageId':_0x31e8e4[_0x523f('0x5e')][_0x523f('0x86')]}});}break;case'bandwidth':if(_0x31e8e4[_0x523f('0x5e')][0x0][_0x523f('0x2a')]['id']){_0x57f7d4=_0x31e8e4['body'][0x0][_0x523f('0x45')];return db[_0x523f('0xa6')][_0x523f('0x5c')]({'where':{'messageId':_0x31e8e4[_0x523f('0x5e')][0x0]['message']['id']}});}break;case'intelepeer':if(_0x31e8e4[_0x523f('0x5e')][_0x523f('0xd5')]&&_0x31e8e4[_0x523f('0x5e')][_0x523f('0x2c')]){_0x57f7d4=_0x31e8e4[_0x523f('0x5e')][_0x523f('0x2c')];return db['SmsMessage']['find']({'where':{'messageId':_0x31e8e4['body'][_0x523f('0xd5')]}});}break;}}})['then'](handleEntityNotFound(_0x46c0ab,null))[_0x523f('0x21')](function(_0x2591ae){if(_0x2591ae){_0x432a84=_0x2591ae;switch(_0x12ece4['type']){case _0x523f('0x87'):if(_0x57f7d4===_0x523f('0xd6')){return _0x432a84[_0x523f('0x37')]({'read':!![]});}else{logger[_0x523f('0x28')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x523f('0x2c'),_0x523f('0x87'),util[_0x523f('0xce')](_0x31e8e4['body'],{'showHidden':![],'depth':null}));}break;case'connectel':if(_0x57f7d4==='1'){return _0x432a84[_0x523f('0x37')]({'read':!![]});}else{logger[_0x523f('0x28')](_0x523f('0x25'),_0x523f('0x2c'),_0x523f('0x87'),util['inspect'](_0x31e8e4[_0x523f('0x5e')],{'showHidden':![],'depth':null}));}break;case _0x523f('0x8b'):if(!_0x31e8e4[_0x523f('0x5e')][_0x523f('0xd7')]&&_0x57f7d4>=0xc8&&_0x57f7d4<=0xce){return _0x432a84[_0x523f('0x37')]({'read':!![]});}else{logger['error'](_0x523f('0x25'),_0x523f('0x2c'),_0x523f('0x8b'),util[_0x523f('0xce')](_0x31e8e4[_0x523f('0x5e')],{'showHidden':![],'depth':null}));}break;case _0x523f('0xd3'):var _0x247b64=_0x31e8e4['body'][_0x523f('0x90')][0x0];if(_0x247b64[_0x523f('0x2c')][_0x523f('0xd4')]===_0x523f('0xd6')){return _0x432a84[_0x523f('0x37')]({'read':!![]});}else{logger[_0x523f('0x28')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x523f('0x2c'),_0x523f('0xd3'),util[_0x523f('0xce')](_0x31e8e4[_0x523f('0x5e')],{'showHidden':![],'depth':null}));}break;case _0x523f('0x93'):if(_0x57f7d4==_0x523f('0xd8')||_0x57f7d4==_0x523f('0xd9')){return _0x432a84['update']({'read':!![]});}else{logger['error'](_0x523f('0x25'),_0x523f('0x2c'),'clickatell',util[_0x523f('0xce')](_0x31e8e4['body'],{'showHidden':![],'depth':null}));}break;case _0x523f('0x96'):if(_0x57f7d4==_0x523f('0xda')){return _0x432a84[_0x523f('0x37')]({'read':!![]});}else{logger[_0x523f('0x28')](_0x523f('0x25'),_0x523f('0x2c'),_0x523f('0x96'),util[_0x523f('0xce')](_0x31e8e4[_0x523f('0x5e')],{'showHidden':![],'depth':null}));}break;case _0x523f('0x97'):if(_0x57f7d4===_0x523f('0xdb')||_0x57f7d4==='ACCEPTD'){return _0x432a84['update']({'read':!![]});}else{logger[_0x523f('0x28')](_0x523f('0x25'),_0x523f('0x2c'),_0x523f('0x97'),util[_0x523f('0xce')](_0x31e8e4[_0x523f('0x5e')],{'showHidden':![],'depth':null}));}break;}return _0x432a84;}})['then'](respondWithResult(_0x46c0ab,null))['catch'](handleError(_0x46c0ab,null));};exports[_0x523f('0xdc')]=function(_0x29a43e,_0x478d4a,_0x5a3d12){var _0x4ef5c3,_0x3f3c62,_0x6937af;return db[_0x523f('0x42')][_0x523f('0x5c')]({'where':{'id':_0x29a43e['params']['id']}})[_0x523f('0x21')](handleEntityNotFound(_0x478d4a,null))[_0x523f('0x21')](function(_0xe5b38a){if(_0xe5b38a){_0x6937af=_0xe5b38a;logger['debug']('SmsAccount,\x20%s,\x20%s,\x20%s',_0x523f('0x2c'),_0x523f('0xcd'),_0xe5b38a[_0x523f('0x45')],util[_0x523f('0xce')](_0x29a43e['query'],{'showHidden':![],'depth':null}));switch(_0xe5b38a['type']){case'csc':if(_0x29a43e[_0x523f('0x47')][_0x523f('0xdd')]&&_0x29a43e[_0x523f('0x47')][_0x523f('0xde')]){_0x3f3c62=_0x29a43e['query'][_0x523f('0xde')];return db[_0x523f('0xa6')][_0x523f('0x5c')]({'where':{'messageId':_0x29a43e['query']['message-id']}});}break;}}})[_0x523f('0x21')](handleEntityNotFound(_0x478d4a,null))[_0x523f('0x21')](function(_0x215687){if(_0x215687){_0x4ef5c3=_0x215687;switch(_0x6937af['type']){case _0x523f('0x91'):if(_0x3f3c62==='2'||_0x3f3c62==='6'){return _0x4ef5c3[_0x523f('0x37')]({'read':!![]});}else{logger['error'](_0x523f('0x25'),_0x523f('0x2c'),_0x523f('0x91'),util[_0x523f('0xce')](_0x29a43e[_0x523f('0x47')],{'showHidden':![],'depth':null}));};break;}return _0x4ef5c3;}})[_0x523f('0x21')](respondWithResult(_0x478d4a,null))[_0x523f('0x2b')](handleError(_0x478d4a,null));};exports['addAgents']=function(_0x2e314a,_0x4b160d,_0x2aef60){return db[_0x523f('0x42')]['find']({'where':{'id':_0x2e314a['params']['id']}})['then'](handleEntityNotFound(_0x4b160d,null))[_0x523f('0x21')](function(_0x1ecc72){if(_0x1ecc72){return _0x1ecc72[_0x523f('0xdf')](_0x2e314a[_0x523f('0x5e')][_0x523f('0x6f')],_[_0x523f('0xe0')](_0x2e314a[_0x523f('0x5e')],[_0x523f('0x6f'),'id'])||{})['spread'](function(_0x54debf){for(var _0x319095=0x0;_0x319095<_0x2e314a[_0x523f('0x5e')][_0x523f('0x6f')][_0x523f('0x4d')];_0x319095+=0x1){socket[_0x523f('0xe1')](_0x523f('0xe2'),{'UserId':Number(_0x2e314a[_0x523f('0x5e')][_0x523f('0x6f')][_0x319095]),'SmsAccountId':Number(_0x2e314a[_0x523f('0x67')]['id'])});}return _0x54debf;});}})[_0x523f('0x21')](respondWithResult(_0x4b160d,null))[_0x523f('0x2b')](handleError(_0x4b160d,null));};exports[_0x523f('0xe3')]=function(_0x120e77,_0x50587,_0x25d8ff){return db['SmsAccount']['find']({'where':{'id':_0x120e77[_0x523f('0x67')]['id']}})[_0x523f('0x21')](handleEntityNotFound(_0x50587,null))[_0x523f('0x21')](function(_0x46bf32){if(_0x46bf32){return _0x46bf32[_0x523f('0xe3')](_0x120e77[_0x523f('0x47')]['ids'])[_0x523f('0x21')](function(){if(_[_0x523f('0xe4')](_0x120e77['query'][_0x523f('0x6f')])){for(var _0x3dabc3=0x0;_0x3dabc3<_0x120e77[_0x523f('0x47')][_0x523f('0x6f')]['length'];_0x3dabc3+=0x1){socket[_0x523f('0xe1')]('userSmsAccount:remove',{'UserId':Number(_0x120e77[_0x523f('0x47')]['ids'][_0x3dabc3]),'SmsAccountId':Number(_0x120e77[_0x523f('0x67')]['id'])});}}else{socket[_0x523f('0xe1')](_0x523f('0xe5'),{'UserId':Number(_0x120e77[_0x523f('0x47')][_0x523f('0x6f')]),'SmsAccountId':Number(_0x120e77['params']['id'])});}});}})[_0x523f('0x21')](respondWithStatusCode(_0x50587,null))[_0x523f('0x2b')](handleError(_0x50587,null));};exports[_0x523f('0xe6')]=function(_0x30490d,_0x211eb8,_0x1cbf73){var _0x351202={};var _0x56939f={};var _0x3b1e1;var _0x565caa;return db['SmsAccount'][_0x523f('0x6b')]({'where':{'id':_0x30490d[_0x523f('0x67')]['id']}})[_0x523f('0x21')](handleEntityNotFound(_0x211eb8,null))['then'](function(_0x208ade){if(_0x208ade){_0x3b1e1=_0x208ade;_0x56939f[_0x523f('0x49')]=_[_0x523f('0x5a')](db['User'][_0x523f('0x43')]);_0x56939f[_0x523f('0x47')]=_[_0x523f('0x5a')](_0x30490d['query']);_0x56939f['filters']=_[_0x523f('0x4b')](_0x56939f[_0x523f('0x49')],_0x56939f[_0x523f('0x47')]);_0x351202[_0x523f('0x4a')]=_[_0x523f('0x4b')](_0x56939f[_0x523f('0x49')],qs[_0x523f('0x4c')](_0x30490d[_0x523f('0x47')][_0x523f('0x4c')]));_0x351202[_0x523f('0x4a')]=_0x351202[_0x523f('0x4a')][_0x523f('0x4d')]?_0x351202[_0x523f('0x4a')]:_0x56939f[_0x523f('0x49')];_0x351202[_0x523f('0x72')]=qs['sort'](_0x30490d['query'][_0x523f('0x50')]);_0x351202['where']=qs[_0x523f('0x48')](_[_0x523f('0x6c')](_0x30490d['query'],_0x56939f[_0x523f('0x48')]));if(_0x30490d['query']['filter']){_0x351202['where']=_['merge'](_0x351202[_0x523f('0x51')],{'$or':_[_0x523f('0x41')](_0x351202[_0x523f('0x4a')],function(_0x3f89e2){var _0x1f3529={};_0x1f3529[_0x3f89e2]={'$like':'%'+_0x30490d[_0x523f('0x47')][_0x523f('0x52')]+'%'};return _0x1f3529;})});}_0x351202=_[_0x523f('0x53')]({},_0x351202,_0x30490d[_0x523f('0x55')]);return _0x3b1e1[_0x523f('0xe6')](_0x351202);}})['then'](function(_0x4e42f2){if(_0x4e42f2){_0x565caa=_0x4e42f2[_0x523f('0x4d')];if(!_0x30490d[_0x523f('0x47')]['hasOwnProperty']('nolimit')){_0x351202[_0x523f('0x30')]=qs[_0x523f('0x30')](_0x30490d[_0x523f('0x47')][_0x523f('0x30')]);_0x351202['offset']=qs[_0x523f('0x32')](_0x30490d[_0x523f('0x47')][_0x523f('0x32')]);}return _0x3b1e1[_0x523f('0xe6')](_0x351202);}})['then'](function(_0x4963b2){if(_0x4963b2){return _0x4963b2?{'count':_0x565caa,'rows':_0x4963b2}:null;}})[_0x523f('0x21')](respondWithResult(_0x211eb8,null))[_0x523f('0x2b')](handleError(_0x211eb8,null));}; \ No newline at end of file +var _0xa6ba=['reject','save','update','destroy','get','UserProfileResource','name','mandatoryDispositionPause','SmsAccount','rawAttributes','fieldName','query','intersection','model','attributes','fields','length','nolimit','order','sort','where','pick','filters','filter','merge','type','VIRTUAL','options','includeAll','findAll','show','Pause','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','SmsAccounts','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','addDisposition','SmsAccountId','Disposition','findOne','keys','hasOwnProperty','rows','removeDispositions','ids','addAnswer','CannedAnswer','removeAnswers','SmsApplication','Applications','account','applications','orderBy','priority','asc','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','createdAt','updatedAt','CompanyId','mobile','twilio','from','Body','MessageSid','skebby','sender','connectel','clicksend','messageId','From','Text','results','csc','originatingAddress','segmentedMessage','clickatell','fromNumber','text','replyMessageId','bandwidth','intelepeer','refid','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','CmList','ListId','Contacts','DESC','list','omit','defaults','contact','SmsInteraction','spread','interaction','autoclose','push','close','unmanaged','*,*,*,*','created','ContactId','AttachmentId','UserId','User','unshift','startRouting','entity\x20found','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','text/xml','send','transaction','sequelize','Transaction','ISOLATION_LEVELS','READ_COMMITTED','map','findAndCountAll','stack','finally','getApplications','getInteractions','Contact','fullname','internal','Tag','Tags','color','tag','to\x20is\x20mandatory','List','Messages','SmsMessage','dataValues','received\x20delivery\x20report\x20from','skebby_dispatch_id','requestid','status_code','message_id','infobip','groupName','DELIVERED','redif','inspect','error_code','DELIVERED_TO_GATEWAY','RECEIVED_BY_RECIPIENT','message-delivered','DELIVRD','ACCEPTD','statusGet','message-id','state','addAgents','userSmsAccount:save','removeAgents','isArray','emit','userSmsAccount:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./smsAccount.socket','register','jayson/promise','http','request','then','info','debug','SmsAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','SmsAccount,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range'];(function(_0x3c2d29,_0x50344c){var _0x38685f=function(_0x39d8fc){while(--_0x39d8fc){_0x3c2d29['push'](_0x3c2d29['shift']());}};_0x38685f(++_0x50344c);}(_0xa6ba,0xad));var _0xaa6b=function(_0x543084,_0x4337f5){_0x543084=_0x543084-0x0;var _0x306a57=_0xa6ba[_0x543084];return _0x306a57;};'use strict';var emlformat=require(_0xaa6b('0x0'));var rimraf=require(_0xaa6b('0x1'));var zipdir=require(_0xaa6b('0x2'));var jsonpatch=require(_0xaa6b('0x3'));var rp=require(_0xaa6b('0x4'));var moment=require(_0xaa6b('0x5'));var BPromise=require(_0xaa6b('0x6'));var Mustache=require(_0xaa6b('0x7'));var util=require(_0xaa6b('0x8'));var path=require(_0xaa6b('0x9'));var sox=require(_0xaa6b('0xa'));var csv=require('to-csv');var ejs=require(_0xaa6b('0xb'));var fs=require('fs');var fs_extra=require(_0xaa6b('0xc'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xaa6b('0xd'));var toCsv=require(_0xaa6b('0xe'));var querystring=require(_0xaa6b('0xf'));var Papa=require(_0xaa6b('0x10'));var Redis=require('ioredis');var authService=require(_0xaa6b('0x11'));var qs=require(_0xaa6b('0x12'));var as=require(_0xaa6b('0x13'));var hardwareService=require(_0xaa6b('0x14'));var logger=require('../../config/logger')(_0xaa6b('0x15'));var utils=require(_0xaa6b('0x16'));var config=require(_0xaa6b('0x17'));var licenseUtil=require(_0xaa6b('0x18'));var db=require(_0xaa6b('0x19'))['db'];config['redis']=_['defaults'](config[_0xaa6b('0x1a')],{'host':_0xaa6b('0x1b'),'port':0x18eb});var socket=require(_0xaa6b('0x1c'))(new Redis(config[_0xaa6b('0x1a')]));require(_0xaa6b('0x1d'))[_0xaa6b('0x1e')](socket);var jayson=require(_0xaa6b('0x1f'));var client=jayson['client'][_0xaa6b('0x20')]({'port':0x232c});function respondWithRpcPromise(_0xf7746b,_0x6f97a8,_0x32c226,_0x4e63dc){return new BPromise(function(_0x2cfa9f,_0x3a462c){var _0x5135a5=_0x4e63dc||client;return _0x5135a5[_0xaa6b('0x21')](_0xf7746b,_0x32c226)[_0xaa6b('0x22')](function(_0x316369){logger[_0xaa6b('0x23')]('SmsAccount,\x20%s,\x20%s',_0x6f97a8,'request\x20sent');logger[_0xaa6b('0x24')](_0xaa6b('0x25'),_0x6f97a8,_0xaa6b('0x26'),JSON[_0xaa6b('0x27')](_0x316369));if(_0x316369[_0xaa6b('0x28')]){if(_0x316369['error'][_0xaa6b('0x29')]===0x1f4){logger[_0xaa6b('0x28')](_0xaa6b('0x2a'),_0x6f97a8,_0x316369[_0xaa6b('0x28')][_0xaa6b('0x2b')]);return _0x3a462c(_0x316369[_0xaa6b('0x28')][_0xaa6b('0x2b')]);}logger[_0xaa6b('0x28')](_0xaa6b('0x2a'),_0x6f97a8,_0x316369[_0xaa6b('0x28')][_0xaa6b('0x2b')]);return _0x2cfa9f(_0x316369[_0xaa6b('0x28')]['message']);}else{logger['info'](_0xaa6b('0x2a'),_0x6f97a8,_0xaa6b('0x26'));_0x2cfa9f(_0x316369[_0xaa6b('0x2c')]['message']);}})[_0xaa6b('0x2d')](function(_0x2f9182){logger[_0xaa6b('0x28')](_0xaa6b('0x2a'),_0x6f97a8,_0x2f9182);_0x3a462c(_0x2f9182);});});}function respondWithStatusCode(_0x312b94,_0x15beed){_0x15beed=_0x15beed||0xcc;return function(_0x2171ce){if(_0x2171ce){return _0x312b94[_0xaa6b('0x2e')](_0x15beed);}return _0x312b94[_0xaa6b('0x2f')](_0x15beed)[_0xaa6b('0x30')]();};}function respondWithResult(_0x5cca84,_0x3580e4){_0x3580e4=_0x3580e4||0xc8;return function(_0x6540cf){if(_0x6540cf){return _0x5cca84[_0xaa6b('0x2f')](_0x3580e4)[_0xaa6b('0x31')](_0x6540cf);}};}function respondWithFilteredResult(_0x2fcf76,_0x56eeb0){return function(_0x5a2f73){if(_0x5a2f73){var _0x137c08=typeof _0x56eeb0[_0xaa6b('0x32')]===_0xaa6b('0x33')&&typeof _0x56eeb0[_0xaa6b('0x34')]===_0xaa6b('0x33');var _0x9e95d7=_0x5a2f73[_0xaa6b('0x35')];var _0x4e07bb=_0x137c08?0x0:_0x56eeb0[_0xaa6b('0x32')];var _0x1f5ca0=_0x137c08?_0x5a2f73[_0xaa6b('0x35')]:_0x56eeb0[_0xaa6b('0x32')]+_0x56eeb0[_0xaa6b('0x34')];var _0x37ae74;if(_0x1f5ca0>=_0x9e95d7){_0x1f5ca0=_0x9e95d7;_0x37ae74=0xc8;}else{_0x37ae74=0xce;}_0x2fcf76[_0xaa6b('0x2f')](_0x37ae74);return _0x2fcf76[_0xaa6b('0x36')](_0xaa6b('0x37'),_0x4e07bb+'-'+_0x1f5ca0+'/'+_0x9e95d7)['json'](_0x5a2f73);}return null;};}function patchUpdates(_0x16cfbe){return function(_0x3833df){try{jsonpatch['apply'](_0x3833df,_0x16cfbe,!![]);}catch(_0x30bb79){return BPromise[_0xaa6b('0x38')](_0x30bb79);}return _0x3833df[_0xaa6b('0x39')]();};}function saveUpdates(_0x3f7ade,_0x2b2fb2){return function(_0x1ad3ba){if(_0x1ad3ba){return _0x1ad3ba[_0xaa6b('0x3a')](_0x3f7ade)[_0xaa6b('0x22')](function(_0x3f55a8){return _0x3f55a8;});}return null;};}function removeEntity(_0x5bdf0e,_0x416900){return function(_0x12c39e){if(_0x12c39e){return _0x12c39e[_0xaa6b('0x3b')]()[_0xaa6b('0x22')](function(){var _0xab7033=_0x12c39e[_0xaa6b('0x3c')]({'plain':!![]});var _0x46a531='SmsAccounts';return db[_0xaa6b('0x3d')][_0xaa6b('0x3b')]({'where':{'type':_0x46a531,'resourceId':_0xab7033['id']}})[_0xaa6b('0x22')](function(){return _0x12c39e;});})['then'](function(){_0x5bdf0e[_0xaa6b('0x2f')](0xcc)[_0xaa6b('0x30')]();});}};}function handleEntityNotFound(_0x54a95e,_0x287ed2){return function(_0x42099e){if(!_0x42099e){_0x54a95e['sendStatus'](0x194);}return _0x42099e;};}function handleError(_0x58b13a,_0x193fa2){_0x193fa2=_0x193fa2||0x1f4;return function(_0x32d877){logger[_0xaa6b('0x28')](_0x32d877['stack']);if(_0x32d877[_0xaa6b('0x3e')]){delete _0x32d877['name'];}_0x58b13a[_0xaa6b('0x2f')](_0x193fa2)['send'](_0x32d877);};}exports['index']=function(_0x3279a8,_0x2bc961){var _0x2c80fb={'include':[{'model':db['Pause'],'as':_0xaa6b('0x3f')}]},_0x4a557e={},_0x26de51={'count':0x0,'rows':[]};var _0x29d185=_['map'](db[_0xaa6b('0x40')][_0xaa6b('0x41')],function(_0x510235){return{'name':_0x510235[_0xaa6b('0x42')],'type':_0x510235['type']['key']};});_0x4a557e['model']=_['map'](_0x29d185,_0xaa6b('0x3e'));_0x4a557e['query']=_['keys'](_0x3279a8[_0xaa6b('0x43')]);_0x4a557e['filters']=_[_0xaa6b('0x44')](_0x4a557e[_0xaa6b('0x45')],_0x4a557e[_0xaa6b('0x43')]);_0x2c80fb[_0xaa6b('0x46')]=_[_0xaa6b('0x44')](_0x4a557e[_0xaa6b('0x45')],qs[_0xaa6b('0x47')](_0x3279a8[_0xaa6b('0x43')][_0xaa6b('0x47')]));_0x2c80fb['attributes']=_0x2c80fb[_0xaa6b('0x46')][_0xaa6b('0x48')]?_0x2c80fb[_0xaa6b('0x46')]:_0x4a557e[_0xaa6b('0x45')];if(!_0x3279a8[_0xaa6b('0x43')]['hasOwnProperty'](_0xaa6b('0x49'))){_0x2c80fb[_0xaa6b('0x34')]=qs[_0xaa6b('0x34')](_0x3279a8[_0xaa6b('0x43')]['limit']);_0x2c80fb[_0xaa6b('0x32')]=qs[_0xaa6b('0x32')](_0x3279a8['query'][_0xaa6b('0x32')]);}_0x2c80fb[_0xaa6b('0x4a')]=qs[_0xaa6b('0x4b')](_0x3279a8[_0xaa6b('0x43')][_0xaa6b('0x4b')]);_0x2c80fb[_0xaa6b('0x4c')]=qs['filters'](_[_0xaa6b('0x4d')](_0x3279a8[_0xaa6b('0x43')],_0x4a557e[_0xaa6b('0x4e')]),_0x29d185);if(_0x3279a8[_0xaa6b('0x43')][_0xaa6b('0x4f')]){_0x2c80fb[_0xaa6b('0x4c')]=_[_0xaa6b('0x50')](_0x2c80fb[_0xaa6b('0x4c')],{'$or':_['map'](_0x29d185,function(_0x5b1c02){if(_0x5b1c02[_0xaa6b('0x51')]!==_0xaa6b('0x52')){var _0x28f58d={};_0x28f58d[_0x5b1c02[_0xaa6b('0x3e')]]={'$like':'%'+_0x3279a8[_0xaa6b('0x43')][_0xaa6b('0x4f')]+'%'};return _0x28f58d;}})});}_0x2c80fb=_[_0xaa6b('0x50')]({},_0x2c80fb,_0x3279a8[_0xaa6b('0x53')]);var _0x1678c4={'where':_0x2c80fb['where']};return db[_0xaa6b('0x40')][_0xaa6b('0x35')](_0x1678c4)[_0xaa6b('0x22')](function(_0x5f5c88){_0x26de51['count']=_0x5f5c88;if(_0x3279a8['query'][_0xaa6b('0x54')]){_0x2c80fb['include']=[{'all':!![]}];}return db['SmsAccount'][_0xaa6b('0x55')](_0x2c80fb);})[_0xaa6b('0x22')](function(_0x39fe53){_0x26de51['rows']=_0x39fe53;return _0x26de51;})[_0xaa6b('0x22')](respondWithFilteredResult(_0x2bc961,_0x2c80fb))[_0xaa6b('0x2d')](handleError(_0x2bc961,null));};exports[_0xaa6b('0x56')]=function(_0x588c9d,_0x4e6a25){var _0x30e760={'raw':![],'where':{'id':_0x588c9d['params']['id']},'include':[{'model':db[_0xaa6b('0x57')],'as':'mandatoryDispositionPause'}]},_0x5c87f3={};_0x5c87f3['model']=_['keys'](db[_0xaa6b('0x40')][_0xaa6b('0x41')]);_0x5c87f3['query']=_['keys'](_0x588c9d[_0xaa6b('0x43')]);_0x5c87f3[_0xaa6b('0x4e')]=_['intersection'](_0x5c87f3[_0xaa6b('0x45')],_0x5c87f3[_0xaa6b('0x43')]);_0x30e760[_0xaa6b('0x46')]=_[_0xaa6b('0x44')](_0x5c87f3[_0xaa6b('0x45')],qs[_0xaa6b('0x47')](_0x588c9d[_0xaa6b('0x43')]['fields']));_0x30e760[_0xaa6b('0x46')]=_0x30e760[_0xaa6b('0x46')]['length']?_0x30e760[_0xaa6b('0x46')]:_0x5c87f3['model'];if(_0x588c9d[_0xaa6b('0x43')][_0xaa6b('0x54')]){_0x30e760[_0xaa6b('0x58')]=[{'all':!![]}];}_0x30e760=_[_0xaa6b('0x50')]({},_0x30e760,_0x588c9d[_0xaa6b('0x53')]);return db[_0xaa6b('0x40')][_0xaa6b('0x59')](_0x30e760)[_0xaa6b('0x22')](handleEntityNotFound(_0x4e6a25,null))['then'](respondWithResult(_0x4e6a25,null))['catch'](handleError(_0x4e6a25,null));};exports[_0xaa6b('0x5a')]=function(_0x379f05,_0x41379c){return db[_0xaa6b('0x40')][_0xaa6b('0x5a')](_0x379f05[_0xaa6b('0x5b')],{})[_0xaa6b('0x22')](function(_0x3ef03e){var _0x47e02d=_0x379f05[_0xaa6b('0x5c')][_0xaa6b('0x3c')]({'plain':!![]});if(!_0x47e02d)throw new Error(_0xaa6b('0x5d'));if(_0x47e02d[_0xaa6b('0x5e')]===_0xaa6b('0x5c')){var _0x40a50b=_0x3ef03e[_0xaa6b('0x3c')]({'plain':!![]});var _0x35c9ec=_0xaa6b('0x5f');return db['UserProfileSection'][_0xaa6b('0x59')]({'where':{'name':_0x35c9ec,'userProfileId':_0x47e02d[_0xaa6b('0x60')]},'raw':!![]})[_0xaa6b('0x22')](function(_0x1f094b){if(_0x1f094b&&_0x1f094b[_0xaa6b('0x61')]===0x0){return db[_0xaa6b('0x3d')][_0xaa6b('0x5a')]({'name':_0x40a50b[_0xaa6b('0x3e')],'resourceId':_0x40a50b['id'],'type':_0x1f094b[_0xaa6b('0x3e')],'sectionId':_0x1f094b['id']},{})[_0xaa6b('0x22')](function(){return _0x3ef03e;});}else{return _0x3ef03e;}})[_0xaa6b('0x2d')](function(_0x194449){logger[_0xaa6b('0x28')](_0xaa6b('0x62'),_0x194449);throw _0x194449;});}return _0x3ef03e;})['then'](respondWithResult(_0x41379c,0xc9))[_0xaa6b('0x2d')](handleError(_0x41379c,null));};exports[_0xaa6b('0x3a')]=function(_0x235af1,_0x886007){if(_0x235af1[_0xaa6b('0x5b')]['id']){delete _0x235af1['body']['id'];}return db['SmsAccount']['find']({'where':{'id':_0x235af1[_0xaa6b('0x63')]['id']},'include':[{'model':db[_0xaa6b('0x57')],'as':_0xaa6b('0x3f')}]})['then'](handleEntityNotFound(_0x886007,null))[_0xaa6b('0x22')](saveUpdates(_0x235af1[_0xaa6b('0x5b')],null))[_0xaa6b('0x22')](respondWithResult(_0x886007,null))[_0xaa6b('0x2d')](handleError(_0x886007,null));};exports[_0xaa6b('0x3b')]=function(_0x4a1a2f,_0x1ee4d1){return db[_0xaa6b('0x40')][_0xaa6b('0x59')]({'where':{'id':_0x4a1a2f[_0xaa6b('0x63')]['id']}})['then'](handleEntityNotFound(_0x1ee4d1,null))['then'](removeEntity(_0x1ee4d1,null))[_0xaa6b('0x2d')](handleError(_0x1ee4d1,null));};exports[_0xaa6b('0x64')]=function(_0x4c8a99,_0x31591a){return db['SmsAccount']['describe']()[_0xaa6b('0x22')](respondWithResult(_0x31591a,null))[_0xaa6b('0x2d')](handleError(_0x31591a,null));};exports[_0xaa6b('0x65')]=function(_0x3b6ce8,_0x46a328,_0x1b25ee){if(_0x3b6ce8[_0xaa6b('0x5b')]['id']){delete _0x3b6ce8[_0xaa6b('0x5b')]['id'];}return db[_0xaa6b('0x40')]['find']({'where':{'id':_0x3b6ce8[_0xaa6b('0x63')]['id']}})[_0xaa6b('0x22')](handleEntityNotFound(_0x46a328,null))[_0xaa6b('0x22')](function(_0x105bc0){if(_0x105bc0){_0x3b6ce8[_0xaa6b('0x5b')][_0xaa6b('0x66')]=_0x105bc0['id'];return db[_0xaa6b('0x67')][_0xaa6b('0x5a')](_0x3b6ce8[_0xaa6b('0x5b')]);}})[_0xaa6b('0x22')](respondWithResult(_0x46a328,null))['catch'](handleError(_0x46a328,null));};exports['getDispositions']=function(_0x5186e5,_0x36e32b,_0x31d539){var _0x4775f4={'raw':![],'where':{}};var _0x179853={};var _0x3aceda={'count':0x0,'rows':[]};return db[_0xaa6b('0x40')][_0xaa6b('0x68')]({'where':{'id':_0x5186e5[_0xaa6b('0x63')]['id']}})[_0xaa6b('0x22')](handleEntityNotFound(_0x36e32b,null))[_0xaa6b('0x22')](function(_0xda713d){if(_0xda713d){_0x179853['model']=_[_0xaa6b('0x69')](db['Disposition'][_0xaa6b('0x41')]);_0x179853[_0xaa6b('0x43')]=_[_0xaa6b('0x69')](_0x5186e5[_0xaa6b('0x43')]);_0x179853['filters']=_['intersection'](_0x179853[_0xaa6b('0x45')],_0x179853[_0xaa6b('0x43')]);_0x4775f4[_0xaa6b('0x46')]=_['intersection'](_0x179853['model'],qs[_0xaa6b('0x47')](_0x5186e5[_0xaa6b('0x43')][_0xaa6b('0x47')]));_0x4775f4[_0xaa6b('0x46')]=_0x4775f4[_0xaa6b('0x46')][_0xaa6b('0x48')]?_0x4775f4[_0xaa6b('0x46')]:_0x179853[_0xaa6b('0x45')];if(!_0x5186e5[_0xaa6b('0x43')][_0xaa6b('0x6a')](_0xaa6b('0x49'))){_0x4775f4[_0xaa6b('0x34')]=qs[_0xaa6b('0x34')](_0x5186e5['query'][_0xaa6b('0x34')]);_0x4775f4[_0xaa6b('0x32')]=qs[_0xaa6b('0x32')](_0x5186e5['query'][_0xaa6b('0x32')]);}_0x4775f4[_0xaa6b('0x4a')]=qs['sort'](_0x5186e5[_0xaa6b('0x43')][_0xaa6b('0x4b')]);_0x4775f4[_0xaa6b('0x4c')]=qs['filters'](_[_0xaa6b('0x4d')](_0x5186e5[_0xaa6b('0x43')],_0x179853['filters']));_0x4775f4[_0xaa6b('0x4c')][_0xaa6b('0x66')]=_0xda713d['id'];if(_0x5186e5['query']['filter']){_0x4775f4[_0xaa6b('0x4c')]=_['merge'](_0x4775f4[_0xaa6b('0x4c')],{'$or':_['map'](_0x4775f4[_0xaa6b('0x46')],function(_0x4f8e9a){var _0x3f5966={};_0x3f5966[_0x4f8e9a]={'$like':'%'+_0x5186e5[_0xaa6b('0x43')][_0xaa6b('0x4f')]+'%'};return _0x3f5966;})});}_0x4775f4=_['merge']({},_0x4775f4,_0x5186e5[_0xaa6b('0x53')]);return db[_0xaa6b('0x67')][_0xaa6b('0x35')]({'where':_0x4775f4['where']})[_0xaa6b('0x22')](function(_0x31e753){_0x3aceda[_0xaa6b('0x35')]=_0x31e753;if(_0x5186e5[_0xaa6b('0x43')][_0xaa6b('0x54')]){_0x4775f4['include']=[{'all':!![]}];}return db[_0xaa6b('0x67')][_0xaa6b('0x55')](_0x4775f4);})[_0xaa6b('0x22')](function(_0x3e2fed){_0x3aceda[_0xaa6b('0x6b')]=_0x3e2fed;return _0x3aceda;});}})[_0xaa6b('0x22')](respondWithFilteredResult(_0x36e32b,_0x4775f4))[_0xaa6b('0x2d')](handleError(_0x36e32b,null));};exports[_0xaa6b('0x6c')]=function(_0x5f552c,_0x562b78,_0x598f15){return db[_0xaa6b('0x40')]['find']({'where':{'id':_0x5f552c[_0xaa6b('0x63')]['id']}})['then'](handleEntityNotFound(_0x562b78,null))['then'](function(_0xa6b34c){if(_0xa6b34c){return _0xa6b34c[_0xaa6b('0x6c')](_0x5f552c[_0xaa6b('0x43')][_0xaa6b('0x6d')]);}})['then'](respondWithStatusCode(_0x562b78,null))['catch'](handleError(_0x562b78,null));};exports[_0xaa6b('0x6e')]=function(_0x5d1c94,_0x66f13e,_0x2c005d){if(_0x5d1c94[_0xaa6b('0x5b')]['id']){delete _0x5d1c94[_0xaa6b('0x5b')]['id'];}return db[_0xaa6b('0x40')]['find']({'where':{'id':_0x5d1c94[_0xaa6b('0x63')]['id']}})['then'](handleEntityNotFound(_0x66f13e,null))['then'](function(_0x5f2e0b){if(_0x5f2e0b){_0x5d1c94[_0xaa6b('0x5b')][_0xaa6b('0x66')]=_0x5f2e0b['id'];return db[_0xaa6b('0x6f')][_0xaa6b('0x5a')](_0x5d1c94[_0xaa6b('0x5b')]);}})['then'](respondWithResult(_0x66f13e,null))[_0xaa6b('0x2d')](handleError(_0x66f13e,null));};exports['getAnswers']=function(_0x4ac2fa,_0x483149,_0x28c2ed){var _0x2e8f4e={'raw':![],'where':{}};var _0x421a54={};var _0x3c6bb7={'count':0x0,'rows':[]};return db[_0xaa6b('0x40')][_0xaa6b('0x68')]({'where':{'id':_0x4ac2fa['params']['id']}})['then'](handleEntityNotFound(_0x483149,null))[_0xaa6b('0x22')](function(_0x2fd676){if(_0x2fd676){_0x421a54[_0xaa6b('0x45')]=_[_0xaa6b('0x69')](db[_0xaa6b('0x6f')][_0xaa6b('0x41')]);_0x421a54[_0xaa6b('0x43')]=_[_0xaa6b('0x69')](_0x4ac2fa[_0xaa6b('0x43')]);_0x421a54[_0xaa6b('0x4e')]=_[_0xaa6b('0x44')](_0x421a54[_0xaa6b('0x45')],_0x421a54[_0xaa6b('0x43')]);_0x2e8f4e[_0xaa6b('0x46')]=_['intersection'](_0x421a54[_0xaa6b('0x45')],qs[_0xaa6b('0x47')](_0x4ac2fa[_0xaa6b('0x43')][_0xaa6b('0x47')]));_0x2e8f4e[_0xaa6b('0x46')]=_0x2e8f4e['attributes']['length']?_0x2e8f4e['attributes']:_0x421a54['model'];if(!_0x4ac2fa[_0xaa6b('0x43')][_0xaa6b('0x6a')](_0xaa6b('0x49'))){_0x2e8f4e[_0xaa6b('0x34')]=qs[_0xaa6b('0x34')](_0x4ac2fa[_0xaa6b('0x43')][_0xaa6b('0x34')]);_0x2e8f4e[_0xaa6b('0x32')]=qs[_0xaa6b('0x32')](_0x4ac2fa[_0xaa6b('0x43')][_0xaa6b('0x32')]);}_0x2e8f4e[_0xaa6b('0x4a')]=qs['sort'](_0x4ac2fa['query']['sort']);_0x2e8f4e['where']=qs[_0xaa6b('0x4e')](_[_0xaa6b('0x4d')](_0x4ac2fa[_0xaa6b('0x43')],_0x421a54[_0xaa6b('0x4e')]));_0x2e8f4e['where'][_0xaa6b('0x66')]=_0x2fd676['id'];if(_0x4ac2fa['query'][_0xaa6b('0x4f')]){_0x2e8f4e['where']=_[_0xaa6b('0x50')](_0x2e8f4e[_0xaa6b('0x4c')],{'$or':_['map'](_0x2e8f4e['attributes'],function(_0x4b91bc){var _0x91dd48={};_0x91dd48[_0x4b91bc]={'$like':'%'+_0x4ac2fa[_0xaa6b('0x43')]['filter']+'%'};return _0x91dd48;})});}_0x2e8f4e=_[_0xaa6b('0x50')]({},_0x2e8f4e,_0x4ac2fa[_0xaa6b('0x53')]);return db[_0xaa6b('0x6f')][_0xaa6b('0x35')]({'where':_0x2e8f4e['where']})[_0xaa6b('0x22')](function(_0x1917a0){_0x3c6bb7[_0xaa6b('0x35')]=_0x1917a0;if(_0x4ac2fa[_0xaa6b('0x43')][_0xaa6b('0x54')]){_0x2e8f4e[_0xaa6b('0x58')]=[{'all':!![]}];}return db[_0xaa6b('0x6f')][_0xaa6b('0x55')](_0x2e8f4e);})['then'](function(_0x2d2115){_0x3c6bb7[_0xaa6b('0x6b')]=_0x2d2115;return _0x3c6bb7;});}})['then'](respondWithFilteredResult(_0x483149,_0x2e8f4e))['catch'](handleError(_0x483149,null));};exports[_0xaa6b('0x70')]=function(_0x5b5892,_0x25eefd,_0x412176){return db[_0xaa6b('0x40')][_0xaa6b('0x59')]({'where':{'id':_0x5b5892[_0xaa6b('0x63')]['id']}})[_0xaa6b('0x22')](handleEntityNotFound(_0x25eefd,null))[_0xaa6b('0x22')](function(_0x3948a8){if(_0x3948a8){return _0x3948a8['removeAnswers'](_0x5b5892['query'][_0xaa6b('0x6d')]);}})[_0xaa6b('0x22')](respondWithStatusCode(_0x25eefd,null))[_0xaa6b('0x2d')](handleError(_0x25eefd,null));};exports['notify']=function(_0x4952fc,_0xefd8e0,_0x46cba1){var _0x966ed7={'channel':'sms'};var _0x86892c=[];var _0x3dc999=[];var _0x36dc98={};return db[_0xaa6b('0x40')]['find']({'where':{'id':_0x4952fc[_0xaa6b('0x63')]['id']},'include':[{'model':db[_0xaa6b('0x71')],'as':_0xaa6b('0x72')}]})[_0xaa6b('0x22')](handleEntityNotFound(_0xefd8e0,null))[_0xaa6b('0x22')](function(_0x446c2e){_0x966ed7[_0xaa6b('0x73')]=_0x446c2e;_0x966ed7[_0xaa6b('0x74')]=_[_0xaa6b('0x75')](_0x446c2e[_0xaa6b('0x72')],[_0xaa6b('0x76')],[_0xaa6b('0x77')]);if(_0x966ed7[_0xaa6b('0x73')][_0xaa6b('0x72')]){delete _0x966ed7[_0xaa6b('0x73')]['Applications'];}return db[_0xaa6b('0x78')]['describe']();})['then'](function(_0x41b15d){if(!_0x41b15d){throw new db[(_0xaa6b('0x79'))][(_0xaa6b('0x7a'))](_0xaa6b('0x7b'));}_0x86892c=_['difference'](_['keys'](_0x41b15d),[_0xaa6b('0x7c'),_0xaa6b('0x7d')]);_0x3dc999=_['difference'](_['keys'](_0x41b15d),[_0xaa6b('0x7c'),'updatedAt',_0xaa6b('0x7e'),'ListId']);_0x966ed7[_0xaa6b('0x5b')]={'mapKey':_0xaa6b('0x7f')};if(_0x966ed7['account']['type']){switch(_0x966ed7[_0xaa6b('0x73')]['type']){case _0xaa6b('0x80'):_0x966ed7[_0xaa6b('0x5b')][_0xaa6b('0x81')]=_0x4952fc[_0xaa6b('0x5b')]['From'];_0x966ed7[_0xaa6b('0x5b')][_0xaa6b('0x5b')]=_0x4952fc[_0xaa6b('0x5b')][_0xaa6b('0x82')];_0x966ed7[_0xaa6b('0x5b')]['messageId']=_0x4952fc[_0xaa6b('0x5b')][_0xaa6b('0x83')];break;case _0xaa6b('0x84'):_0x966ed7[_0xaa6b('0x5b')][_0xaa6b('0x81')]='+'+_0x4952fc[_0xaa6b('0x5b')][_0xaa6b('0x85')];_0x966ed7[_0xaa6b('0x5b')][_0xaa6b('0x5b')]=_0x4952fc[_0xaa6b('0x5b')]['text'];break;case _0xaa6b('0x86'):_0x966ed7[_0xaa6b('0x5b')][_0xaa6b('0x81')]=_0x4952fc[_0xaa6b('0x5b')]['from'];_0x966ed7[_0xaa6b('0x5b')][_0xaa6b('0x5b')]=_0x4952fc[_0xaa6b('0x5b')][_0xaa6b('0x2b')];break;case _0xaa6b('0x87'):_0x966ed7[_0xaa6b('0x5b')][_0xaa6b('0x81')]=_0x4952fc['body'][_0xaa6b('0x81')];_0x966ed7[_0xaa6b('0x5b')][_0xaa6b('0x5b')]=_0x4952fc[_0xaa6b('0x5b')][_0xaa6b('0x5b')];_0x966ed7['body'][_0xaa6b('0x88')]=_0x4952fc[_0xaa6b('0x5b')]['message_id'];break;case'plivo':_0x966ed7['body'][_0xaa6b('0x81')]=_0x4952fc['body'][_0xaa6b('0x89')];_0x966ed7['body']['body']=_0x4952fc[_0xaa6b('0x5b')][_0xaa6b('0x8a')];_0x966ed7[_0xaa6b('0x5b')][_0xaa6b('0x88')]=_0x4952fc[_0xaa6b('0x5b')]['MessageUUID'];break;case'infobip':_0x966ed7['body']['from']='+'+_0x4952fc[_0xaa6b('0x5b')][_0xaa6b('0x8b')][0x0][_0xaa6b('0x81')];_0x966ed7[_0xaa6b('0x5b')]['body']=_0x4952fc[_0xaa6b('0x5b')][_0xaa6b('0x8b')][0x0]['text'];_0x966ed7[_0xaa6b('0x5b')][_0xaa6b('0x88')]=_0x4952fc[_0xaa6b('0x5b')][_0xaa6b('0x8b')][0x0][_0xaa6b('0x88')];break;case _0xaa6b('0x8c'):_0x966ed7[_0xaa6b('0x5b')][_0xaa6b('0x81')]=_0x4952fc['body'][_0xaa6b('0x8d')];_0x966ed7['body'][_0xaa6b('0x5b')]=_0x4952fc[_0xaa6b('0x5b')][_0xaa6b('0x8e')][_0xaa6b('0x2b')];break;case _0xaa6b('0x8f'):_0x966ed7[_0xaa6b('0x5b')][_0xaa6b('0x81')]=_0x4952fc[_0xaa6b('0x5b')][_0xaa6b('0x90')];_0x966ed7['body'][_0xaa6b('0x5b')]=_0x4952fc[_0xaa6b('0x5b')][_0xaa6b('0x91')];_0x966ed7[_0xaa6b('0x5b')][_0xaa6b('0x88')]=_0x4952fc['body'][_0xaa6b('0x92')];break;case _0xaa6b('0x93'):_0x966ed7[_0xaa6b('0x5b')][_0xaa6b('0x88')]=_0x4952fc[_0xaa6b('0x5b')][0x0][_0xaa6b('0x2b')]['id'];_0x966ed7[_0xaa6b('0x5b')]['from']=_0x4952fc[_0xaa6b('0x5b')][0x0][_0xaa6b('0x2b')]['from'];_0x966ed7['body']['body']=_0x4952fc[_0xaa6b('0x5b')][0x0][_0xaa6b('0x2b')][_0xaa6b('0x91')];break;case _0xaa6b('0x94'):_0x966ed7[_0xaa6b('0x5b')][_0xaa6b('0x81')]=_0x4952fc[_0xaa6b('0x5b')]['from'];_0x966ed7[_0xaa6b('0x5b')][_0xaa6b('0x5b')]=_0x4952fc[_0xaa6b('0x5b')][_0xaa6b('0x2b')];_0x966ed7[_0xaa6b('0x5b')][_0xaa6b('0x88')]=_0x4952fc['body'][_0xaa6b('0x95')];break;}}if(_0x966ed7[_0xaa6b('0x5b')]['id']){delete _0x966ed7['body']['id'];}if(_[_0xaa6b('0x96')](_0x966ed7['body']['from'])){throw new db[(_0xaa6b('0x79'))][(_0xaa6b('0x7a'))]('from\x20is\x20mandatory');}if(_[_0xaa6b('0x96')](_0x966ed7['body']['body'])||_0x966ed7['body'][_0xaa6b('0x5b')]===''){throw new db[(_0xaa6b('0x79'))][(_0xaa6b('0x7a'))](_0xaa6b('0x97'));}if(_[_0xaa6b('0x96')](_0x966ed7[_0xaa6b('0x5b')]['mapKey'])){throw new db['Sequelize'][(_0xaa6b('0x7a'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x3dc999);}if(!_['includes'](_0x3dc999,_0x966ed7[_0xaa6b('0x5b')][_0xaa6b('0x98')])){throw new db[(_0xaa6b('0x79'))][(_0xaa6b('0x7a'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x3dc999);}_0x36dc98[_0x966ed7['body'][_0xaa6b('0x98')]]=_0x966ed7[_0xaa6b('0x5b')]['from'];return db[_0xaa6b('0x99')][_0xaa6b('0x59')]({'where':{'id':_0x966ed7[_0xaa6b('0x73')][_0xaa6b('0x9a')]},'include':[{'model':db['CmContact'],'as':_0xaa6b('0x9b'),'where':_0x36dc98,'limit':0x1,'order':[[_0xaa6b('0x7d'),_0xaa6b('0x9c')]]}]});})[_0xaa6b('0x22')](handleEntityNotFound(_0xefd8e0,null))[_0xaa6b('0x22')](function(_0x371f78){if(_0x371f78){_0x966ed7[_0xaa6b('0x9d')]=_[_0xaa6b('0x9e')](_0x371f78,['Contacts']);if(_0x371f78[_0xaa6b('0x9b')][_0xaa6b('0x48')]){return _0x371f78[_0xaa6b('0x9b')][0x0];}var _0x4f85a5=_[_0xaa6b('0x9f')](_0x966ed7[_0xaa6b('0x5b')],{'firstName':_0x966ed7[_0xaa6b('0x5b')]['from'],'ListId':_0x371f78['id']});_0x4f85a5[_0x966ed7[_0xaa6b('0x5b')][_0xaa6b('0x98')]]=_0x966ed7[_0xaa6b('0x5b')]['from'];return db[_0xaa6b('0x78')][_0xaa6b('0x5a')](_0x4f85a5,{'fields':_0x86892c,'raw':!![]});}})[_0xaa6b('0x22')](handleEntityNotFound(_0xefd8e0,null))[_0xaa6b('0x22')](function(_0x32f50e){if(_0x32f50e){_0x966ed7[_0xaa6b('0xa0')]=_0x32f50e;var _0x1cc996={'ContactId':_0x32f50e['id'],'phone':_0x966ed7[_0xaa6b('0x5b')]['from'],'SmsAccountId':_0x4952fc[_0xaa6b('0x63')]['id']};var _0x551ded={'ContactId':_0x32f50e['id'],'SmsAccountId':_0x4952fc[_0xaa6b('0x63')]['id'],'closed':![]};return db[_0xaa6b('0xa1')][_0xaa6b('0x59')]({'where':_0x551ded})[_0xaa6b('0x22')](function(_0x405307){if(_0x405307){return[_0x405307,![]];}return db[_0xaa6b('0xa1')][_0xaa6b('0x5a')](_0x1cc996)[_0xaa6b('0x22')](function(_0x4bfa61){return[_0x4bfa61,!![]];});});}})[_0xaa6b('0xa2')](function(_0x267dc4,_0x1a2552){_0x966ed7[_0xaa6b('0xa3')]=_0x267dc4[_0xaa6b('0x3c')]({'plain':!![]});_0x966ed7[_0xaa6b('0xa3')]['created']=![];if(_0x1a2552){if(_0x966ed7[_0xaa6b('0x73')][_0xaa6b('0xa4')]){_0x966ed7[_0xaa6b('0x74')][_0xaa6b('0xa5')]({'id':0x0,'priority':_0x966ed7[_0xaa6b('0x74')][_0xaa6b('0x48')]+0x1,'app':_0xaa6b('0xa6'),'appdata':_0xaa6b('0xa7'),'interval':_0xaa6b('0xa8')});}_0x966ed7['interaction'][_0xaa6b('0xa9')]=!![];}return db['SmsMessage'][_0xaa6b('0x5a')]({'phone':_0x966ed7[_0xaa6b('0x5b')]['from'],'messageId':_0x966ed7[_0xaa6b('0x5b')]['messageId'],'body':_0x966ed7[_0xaa6b('0x5b')][_0xaa6b('0x5b')],'SmsAccountId':_0x4952fc['params']['id'],'SmsInteractionId':_0x267dc4['id'],'direction':'in','ContactId':_0x267dc4[_0xaa6b('0xaa')],'AttachmentId':_0x966ed7[_0xaa6b('0x5b')][_0xaa6b('0xab')]});})[_0xaa6b('0x22')](function(_0x36ed7b){_0x966ed7['message']=_0x36ed7b;if(_0x966ed7['interaction'][_0xaa6b('0xac')]){return db[_0xaa6b('0xad')][_0xaa6b('0x59')]({'attributes':['id','name'],'where':{'id':_0x966ed7[_0xaa6b('0xa3')][_0xaa6b('0xac')]}})[_0xaa6b('0x22')](function(_0x233592){if(_0x233592){_0x966ed7[_0xaa6b('0x74')][_0xaa6b('0xae')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x233592['name']+','+(_0x966ed7[_0xaa6b('0x73')]['waitForTheAssignedAgent']||0xa),'interval':_0xaa6b('0xa8')});}return respondWithRpcPromise('Start',_0xaa6b('0xaf'),_0x966ed7);});}return respondWithRpcPromise('Start',_0xaa6b('0xaf'),_0x966ed7);})[_0xaa6b('0x22')](function(_0x406095){if(_0x406095){var _0x5662ff=0xc8;var _0x2d5178='receiveMessage';logger['info'](_0xaa6b('0x25'),_0x2d5178,_0x5662ff,_0xaa6b('0xb0'));logger['debug'](_0xaa6b('0xb1'),_0x2d5178,_0x5662ff,'entity\x20found',JSON[_0xaa6b('0x27')](_0x406095));if(_0x966ed7['account']['type']==='twilio'){return _0xefd8e0[_0xaa6b('0x2f')](_0x5662ff)[_0xaa6b('0x36')]('Content-Type',_0xaa6b('0xb2'))[_0xaa6b('0xb3')]('\x0a');}else{return _0xefd8e0[_0xaa6b('0x2f')](_0x5662ff)[_0xaa6b('0x31')](_0x406095);}}})[_0xaa6b('0x2d')](handleError(_0xefd8e0,null));};exports['addApplications']=function(_0x4f4f1b,_0x65b264){var _0x43b242=_0x4f4f1b[_0xaa6b('0x63')]['id'];var _0x13147f=_0x4f4f1b[_0xaa6b('0x5b')];var _0x532497=0xc8;var _0x3b0bd5=null;return db['sequelize'][_0xaa6b('0xb4')]({'isolationLevel':db[_0xaa6b('0xb5')][_0xaa6b('0xb6')][_0xaa6b('0xb7')][_0xaa6b('0xb8')]},function(_0x39c550){return db[_0xaa6b('0x40')]['findOne']({'where':{'id':_0x43b242},'transaction':_0x39c550})[_0xaa6b('0x22')](function(_0xa1bcdf){if(_0xa1bcdf){return db['SmsApplication']['destroy']({'where':{'SmsAccountId':_0x43b242},'transaction':_0x39c550})[_0xaa6b('0x22')](function(){var _0x48e858=_[_0xaa6b('0xb9')](_0x13147f,function(_0x43735d){_0x43735d[_0xaa6b('0x66')]=_0x43b242;return _0x43735d;});return db['SmsApplication']['bulkCreate'](_0x48e858,{'transaction':_0x39c550});});}else{_0x532497=0x194;_0x3b0bd5=[];}});})[_0xaa6b('0x22')](function(){if(_0x532497!==0x194){return db[_0xaa6b('0x71')][_0xaa6b('0xba')]({'where':{'SmsAccountId':_0x43b242},'order':_0xaa6b('0x76')})[_0xaa6b('0x22')](function(_0x19c521){_0x3b0bd5=_0x19c521;});}})[_0xaa6b('0x2d')](function(_0x208aad){_0x532497=0x1f4;logger[_0xaa6b('0x28')](_0x208aad[_0xaa6b('0xbb')]);if(_0x208aad[_0xaa6b('0x3e')]){delete _0x208aad[_0xaa6b('0x3e')];}_0x3b0bd5=_0x208aad;})[_0xaa6b('0xbc')](function(){if(_0x3b0bd5===null){_0x65b264[_0xaa6b('0x2e')](_0x532497);}else{if(_0x532497===0x1f4){_0x65b264[_0xaa6b('0x2f')](_0x532497)[_0xaa6b('0xb3')](_0x3b0bd5);}else{_0x65b264[_0xaa6b('0x2f')](_0x532497)[_0xaa6b('0x31')](_0x3b0bd5);}}});};exports[_0xaa6b('0xbd')]=function(_0x593f63,_0xc27ff1,_0x16aae9){var _0x576532={};var _0x34efdb={};var _0xb37ea3;var _0x47f4c6;return db['SmsAccount'][_0xaa6b('0x68')]({'where':{'id':_0x593f63[_0xaa6b('0x63')]['id']}})[_0xaa6b('0x22')](handleEntityNotFound(_0xc27ff1,null))[_0xaa6b('0x22')](function(_0x13b876){if(_0x13b876){_0xb37ea3=_0x13b876;_0x34efdb[_0xaa6b('0x45')]=_[_0xaa6b('0x69')](db[_0xaa6b('0x71')][_0xaa6b('0x41')]);_0x34efdb['query']=_[_0xaa6b('0x69')](_0x593f63[_0xaa6b('0x43')]);_0x34efdb[_0xaa6b('0x4e')]=_[_0xaa6b('0x44')](_0x34efdb[_0xaa6b('0x45')],_0x34efdb['query']);_0x576532[_0xaa6b('0x46')]=_[_0xaa6b('0x44')](_0x34efdb[_0xaa6b('0x45')],qs[_0xaa6b('0x47')](_0x593f63[_0xaa6b('0x43')]['fields']));_0x576532[_0xaa6b('0x46')]=_0x576532[_0xaa6b('0x46')][_0xaa6b('0x48')]?_0x576532[_0xaa6b('0x46')]:_0x34efdb['model'];_0x576532[_0xaa6b('0x4a')]=qs['sort'](_0x593f63[_0xaa6b('0x43')]['sort']);_0x576532['where']=qs['filters'](_[_0xaa6b('0x4d')](_0x593f63[_0xaa6b('0x43')],_0x34efdb['filters']));if(_0x593f63[_0xaa6b('0x43')][_0xaa6b('0x4f')]){_0x576532['where']=_[_0xaa6b('0x50')](_0x576532[_0xaa6b('0x4c')],{'$or':_[_0xaa6b('0xb9')](_0x576532[_0xaa6b('0x46')],function(_0x35230f){var _0xb73c0f={};_0xb73c0f[_0x35230f]={'$like':'%'+_0x593f63['query'][_0xaa6b('0x4f')]+'%'};return _0xb73c0f;})});}_0x576532=_[_0xaa6b('0x50')]({},_0x576532,_0x593f63[_0xaa6b('0x53')]);return _0xb37ea3[_0xaa6b('0xbd')](_0x576532);}})[_0xaa6b('0x22')](function(_0xe186d7){if(_0xe186d7){_0x47f4c6=_0xe186d7['length'];if(!_0x593f63[_0xaa6b('0x43')][_0xaa6b('0x6a')](_0xaa6b('0x49'))){_0x576532['limit']=qs['limit'](_0x593f63['query'][_0xaa6b('0x34')]);_0x576532[_0xaa6b('0x32')]=qs[_0xaa6b('0x32')](_0x593f63[_0xaa6b('0x43')][_0xaa6b('0x32')]);}return _0xb37ea3['getApplications'](_0x576532);}})[_0xaa6b('0x22')](function(_0x4598e7){if(_0x4598e7){return _0x4598e7?{'count':_0x47f4c6,'rows':_0x4598e7}:null;}})[_0xaa6b('0x22')](respondWithResult(_0xc27ff1,null))['catch'](handleError(_0xc27ff1,null));};exports[_0xaa6b('0xbe')]=function(_0x4bf4a6,_0x412e57,_0x501247){var _0x54bb15={'raw':![],'where':{}};var _0x1a81f2={};var _0x5103c1={'count':0x0,'rows':[]};return db[_0xaa6b('0x40')][_0xaa6b('0x68')]({'where':{'id':_0x4bf4a6[_0xaa6b('0x63')]['id']}})[_0xaa6b('0x22')](handleEntityNotFound(_0x412e57,null))[_0xaa6b('0x22')](function(_0x4bfa92){if(_0x4bfa92){_0x1a81f2[_0xaa6b('0x45')]=_[_0xaa6b('0x69')](db['SmsInteraction'][_0xaa6b('0x41')]);_0x1a81f2[_0xaa6b('0x43')]=_['keys'](_0x4bf4a6[_0xaa6b('0x43')]);_0x1a81f2[_0xaa6b('0x4e')]=_['intersection'](_0x1a81f2[_0xaa6b('0x45')],_0x1a81f2[_0xaa6b('0x43')]);_0x54bb15['attributes']=_[_0xaa6b('0x44')](_0x1a81f2['model'],qs[_0xaa6b('0x47')](_0x4bf4a6[_0xaa6b('0x43')][_0xaa6b('0x47')]));_0x54bb15[_0xaa6b('0x46')]=_0x54bb15[_0xaa6b('0x46')][_0xaa6b('0x48')]?_0x54bb15['attributes']:_0x1a81f2[_0xaa6b('0x45')];if(!_0x4bf4a6[_0xaa6b('0x43')][_0xaa6b('0x6a')](_0xaa6b('0x49'))){_0x54bb15[_0xaa6b('0x34')]=qs[_0xaa6b('0x34')](_0x4bf4a6[_0xaa6b('0x43')][_0xaa6b('0x34')]);_0x54bb15[_0xaa6b('0x32')]=qs[_0xaa6b('0x32')](_0x4bf4a6['query'][_0xaa6b('0x32')]);}_0x54bb15[_0xaa6b('0x4a')]=qs['sort'](_0x4bf4a6[_0xaa6b('0x43')][_0xaa6b('0x4b')]);_0x54bb15[_0xaa6b('0x4c')]=qs[_0xaa6b('0x4e')](_[_0xaa6b('0x4d')](_0x4bf4a6[_0xaa6b('0x43')],_0x1a81f2['filters']));_0x54bb15[_0xaa6b('0x4c')][_0xaa6b('0x66')]=_0x4bfa92['id'];if(_0x4bf4a6[_0xaa6b('0x43')]['filter']){_0x54bb15['where']=_[_0xaa6b('0x50')](_0x54bb15[_0xaa6b('0x4c')],{'$or':_['map'](_0x54bb15['attributes'],function(_0x396276){var _0x4366a0={};_0x4366a0[_0x396276]={'$like':'%'+_0x4bf4a6['query']['filter']+'%'};return _0x4366a0;})});}_0x54bb15=_[_0xaa6b('0x50')]({},_0x54bb15,_0x4bf4a6[_0xaa6b('0x53')]);return db[_0xaa6b('0xa1')][_0xaa6b('0x35')]({'where':_0x54bb15[_0xaa6b('0x4c')]})[_0xaa6b('0x22')](function(_0x51f17a){_0x5103c1[_0xaa6b('0x35')]=_0x51f17a;if(_0x4bf4a6[_0xaa6b('0x43')]['includeAll']){_0x54bb15['include']=[{'model':db[_0xaa6b('0x78')],'as':_0xaa6b('0xbf'),'required':![]},{'model':db[_0xaa6b('0xad')],'as':'Owner','attributes':[_0xaa6b('0x3e'),_0xaa6b('0xc0'),_0xaa6b('0xc1')],'required':![]},{'model':db[_0xaa6b('0xc2')],'as':_0xaa6b('0xc3'),'attributes':['id',_0xaa6b('0x3e'),_0xaa6b('0xc4')],'where':_0x4bf4a6['query'][_0xaa6b('0xc5')]?{'id':_0x4bf4a6['query'][_0xaa6b('0xc5')]}:undefined,'required':_0x4bf4a6[_0xaa6b('0x43')]['tag']?!![]:![]}];}return db[_0xaa6b('0xa1')]['findAll'](_0x54bb15);})[_0xaa6b('0x22')](function(_0x289c5b){_0x5103c1[_0xaa6b('0x6b')]=_0x289c5b;return _0x5103c1;});}})[_0xaa6b('0x22')](respondWithFilteredResult(_0x412e57,_0x54bb15))['catch'](handleError(_0x412e57,null));};exports[_0xaa6b('0xb3')]=function(_0x47073c,_0x45e433,_0x480563){var _0x234b0d,_0x17967e,_0x3eab74;if(_[_0xaa6b('0x96')](_0x47073c[_0xaa6b('0x5b')][_0xaa6b('0x5b')])||_0x47073c[_0xaa6b('0x5b')][_0xaa6b('0x5b')]===''){throw new db[(_0xaa6b('0x79'))]['ValidationError'](_0xaa6b('0x97'));}if(_['isNil'](_0x47073c[_0xaa6b('0x5b')]['to'])){throw new db[(_0xaa6b('0x79'))]['ValidationError'](_0xaa6b('0xc6'));}_0x234b0d=_0x47073c[_0xaa6b('0x5b')]['to'];return db[_0xaa6b('0x40')][_0xaa6b('0x59')]({'where':{'id':_0x47073c[_0xaa6b('0x63')]['id']},'include':[{'model':db[_0xaa6b('0x99')],'as':'List','include':[{'model':db[_0xaa6b('0x78')],'as':_0xaa6b('0x9b'),'where':{'mobile':_0x234b0d},'limit':0x1,'order':[[_0xaa6b('0x7d'),_0xaa6b('0x9c')]]}]}]})[_0xaa6b('0x22')](handleEntityNotFound(_0x45e433,null))[_0xaa6b('0x22')](function(_0x2bb14c){if(_0x2bb14c&&_0x2bb14c[_0xaa6b('0xc7')]){_0x17967e=_0x2bb14c['get']({'plain':!![]});if(_0x17967e['List']&&_0x17967e[_0xaa6b('0xc7')]['Contacts'][_0xaa6b('0x48')]){return _0x17967e[_0xaa6b('0xc7')][_0xaa6b('0x9b')][0x0];}return db[_0xaa6b('0x78')][_0xaa6b('0x5a')](_[_0xaa6b('0x9f')](_0x47073c[_0xaa6b('0x5b')],{'firstName':_0x234b0d,'mobile':_0x234b0d,'phone':_0x234b0d,'ListId':_0x17967e[_0xaa6b('0x9a')]}));}})[_0xaa6b('0x22')](handleEntityNotFound(_0x45e433,null))[_0xaa6b('0x22')](function(_0x487df5){if(_0x487df5){_0x3eab74=_0x487df5;return db[_0xaa6b('0xa1')][_0xaa6b('0x59')]({'where':{'ContactId':_0x3eab74['id'],'closed':![],'SmsAccountId':_0x17967e['id']}})['then'](function(_0x8573a6){if(_0x8573a6){return[_0x8573a6,![]];}return db[_0xaa6b('0xa1')]['create']({'UserId':_0x47073c[_0xaa6b('0x5c')]['id'],'ContactId':_0x3eab74['id'],'SmsAccountId':_0x17967e['id'],'phone':_0x234b0d,'firstMsgDirection':'out','Messages':[_[_0xaa6b('0x50')](_0x47073c[_0xaa6b('0x5b')],{'read':![],'body':_0x47073c[_0xaa6b('0x5b')][_0xaa6b('0x5b')],'phone':_0x234b0d,'SmsAccountId':_0x17967e['id'],'UserId':_0x47073c[_0xaa6b('0x5c')]['id'],'ContactId':_0x3eab74['id']})]},{'include':[{'model':db['SmsMessage'],'as':_0xaa6b('0xc8')}]})[_0xaa6b('0x22')](function(_0x5f0c73){return[_0x5f0c73,!![]];});});}})[_0xaa6b('0xa2')](function(_0x57fa65,_0x5a5e36){if(_0x5a5e36){return _0x57fa65;}return db[_0xaa6b('0xc9')][_0xaa6b('0x5a')](_[_0xaa6b('0x50')](_0x47073c[_0xaa6b('0x5b')],{'read':![],'body':_0x47073c['body']['body'],'phone':_0x234b0d,'SmsAccountId':_0x17967e['id'],'SmsInteractionId':_0x57fa65['id'],'UserId':_0x47073c[_0xaa6b('0x5c')]['id'],'ContactId':_0x3eab74['id']}))['then'](function(_0x4e5b0d){_0x57fa65[_0xaa6b('0xca')][_0xaa6b('0xc8')]=[];_0x57fa65['dataValues']['Messages'][_0xaa6b('0xa5')](_0x4e5b0d[_0xaa6b('0xca')]);return _0x57fa65;});})[_0xaa6b('0x22')](respondWithResult(_0x45e433,null))[_0xaa6b('0x2d')](handleError(_0x45e433,null));};exports[_0xaa6b('0x2f')]=function(_0x5ceb43,_0x35f63b,_0x3a1589){if(_0x5ceb43[_0xaa6b('0x5b')]['id']){delete _0x5ceb43[_0xaa6b('0x5b')]['id'];}var _0x58427f,_0x448980,_0x217984;return db[_0xaa6b('0x40')][_0xaa6b('0x59')]({'where':{'id':_0x5ceb43[_0xaa6b('0x63')]['id']}})[_0xaa6b('0x22')](handleEntityNotFound(_0x35f63b,null))[_0xaa6b('0x22')](function(_0x233be2){if(_0x233be2){_0x217984=_0x233be2;logger[_0xaa6b('0x24')](_0xaa6b('0x25'),'status',_0xaa6b('0xcb'),_0x233be2['type'],util['inspect'](_0x5ceb43[_0xaa6b('0x5b')],{'showHidden':![],'depth':null}));switch(_0x233be2[_0xaa6b('0x51')]){case _0xaa6b('0x84'):if(_0x5ceb43[_0xaa6b('0x5b')][_0xaa6b('0xcc')]&&_0x5ceb43['body'][_0xaa6b('0x2f')]){_0x448980=_0x5ceb43['body'][_0xaa6b('0x2f')];return db[_0xaa6b('0xc9')][_0xaa6b('0x59')]({'where':{'messageId':_0x5ceb43[_0xaa6b('0x5b')][_0xaa6b('0xcc')]}});}break;case _0xaa6b('0x86'):if(_0x5ceb43[_0xaa6b('0x5b')][_0xaa6b('0xcd')]&&_0x5ceb43[_0xaa6b('0x5b')]['statusInt']){_0x448980=_0x5ceb43[_0xaa6b('0x5b')]['statusInt'];return db[_0xaa6b('0xc9')][_0xaa6b('0x59')]({'where':{'messageId':_0x5ceb43[_0xaa6b('0x5b')]['requestid']}});}break;case _0xaa6b('0x87'):if(_0x5ceb43[_0xaa6b('0x5b')]['message_id']&&_0x5ceb43['body'][_0xaa6b('0xce')]){_0x448980=_0x5ceb43[_0xaa6b('0x5b')]['status_code'];return db[_0xaa6b('0xc9')][_0xaa6b('0x59')]({'where':{'messageId':_0x5ceb43[_0xaa6b('0x5b')][_0xaa6b('0xcf')]}});}break;case _0xaa6b('0xd0'):var _0x418e5e=_0x5ceb43[_0xaa6b('0x5b')][_0xaa6b('0x8b')][0x0];if(_0x418e5e[_0xaa6b('0x88')]&&_0x418e5e[_0xaa6b('0x2f')][_0xaa6b('0xd1')]===_0xaa6b('0xd2')){_0x448980=_0x418e5e[_0xaa6b('0x2f')][_0xaa6b('0xd1')];return db[_0xaa6b('0xc9')][_0xaa6b('0x59')]({'where':{'messageId':_0x418e5e['messageId']}});}break;case _0xaa6b('0x8f'):if(_0x5ceb43[_0xaa6b('0x5b')][_0xaa6b('0x88')]&&_0x5ceb43[_0xaa6b('0x5b')][_0xaa6b('0x2f')]){_0x448980=_0x5ceb43[_0xaa6b('0x5b')][_0xaa6b('0x2f')];return db['SmsMessage']['find']({'where':{'messageId':_0x5ceb43[_0xaa6b('0x5b')][_0xaa6b('0x88')]}});}break;case _0xaa6b('0x93'):if(_0x5ceb43[_0xaa6b('0x5b')][0x0]['message']['id']){_0x448980=_0x5ceb43[_0xaa6b('0x5b')][0x0]['type'];return db['SmsMessage'][_0xaa6b('0x59')]({'where':{'messageId':_0x5ceb43[_0xaa6b('0x5b')][0x0][_0xaa6b('0x2b')]['id']}});}break;case _0xaa6b('0x94'):if(_0x5ceb43['body']['redif']&&_0x5ceb43['body'][_0xaa6b('0x2f')]){_0x448980=_0x5ceb43[_0xaa6b('0x5b')]['status'];return db[_0xaa6b('0xc9')][_0xaa6b('0x59')]({'where':{'messageId':_0x5ceb43['body'][_0xaa6b('0xd3')]}});}break;}}})[_0xaa6b('0x22')](handleEntityNotFound(_0x35f63b,null))[_0xaa6b('0x22')](function(_0x2c717d){if(_0x2c717d){_0x58427f=_0x2c717d;switch(_0x217984[_0xaa6b('0x51')]){case _0xaa6b('0x84'):if(_0x448980===_0xaa6b('0xd2')){return _0x58427f[_0xaa6b('0x3a')]({'read':!![]});}else{logger[_0xaa6b('0x28')](_0xaa6b('0x25'),_0xaa6b('0x2f'),_0xaa6b('0x84'),util[_0xaa6b('0xd4')](_0x5ceb43[_0xaa6b('0x5b')],{'showHidden':![],'depth':null}));}break;case'connectel':if(_0x448980==='1'){return _0x58427f['update']({'read':!![]});}else{logger[_0xaa6b('0x28')](_0xaa6b('0x25'),_0xaa6b('0x2f'),_0xaa6b('0x84'),util[_0xaa6b('0xd4')](_0x5ceb43[_0xaa6b('0x5b')],{'showHidden':![],'depth':null}));}break;case _0xaa6b('0x87'):if(!_0x5ceb43['body'][_0xaa6b('0xd5')]&&_0x448980>=0xc8&&_0x448980<=0xce){return _0x58427f['update']({'read':!![]});}else{logger[_0xaa6b('0x28')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xaa6b('0x2f'),_0xaa6b('0x87'),util[_0xaa6b('0xd4')](_0x5ceb43[_0xaa6b('0x5b')],{'showHidden':![],'depth':null}));}break;case _0xaa6b('0xd0'):var _0x5c02e3=_0x5ceb43[_0xaa6b('0x5b')][_0xaa6b('0x8b')][0x0];if(_0x5c02e3['status'][_0xaa6b('0xd1')]===_0xaa6b('0xd2')){return _0x58427f[_0xaa6b('0x3a')]({'read':!![]});}else{logger[_0xaa6b('0x28')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xaa6b('0x2f'),_0xaa6b('0xd0'),util[_0xaa6b('0xd4')](_0x5ceb43['body'],{'showHidden':![],'depth':null}));}break;case _0xaa6b('0x8f'):if(_0x448980==_0xaa6b('0xd6')||_0x448980==_0xaa6b('0xd7')){return _0x58427f['update']({'read':!![]});}else{logger[_0xaa6b('0x28')](_0xaa6b('0x25'),'status',_0xaa6b('0x8f'),util[_0xaa6b('0xd4')](_0x5ceb43['body'],{'showHidden':![],'depth':null}));}break;case _0xaa6b('0x93'):if(_0x448980==_0xaa6b('0xd8')){return _0x58427f['update']({'read':!![]});}else{logger[_0xaa6b('0x28')](_0xaa6b('0x25'),_0xaa6b('0x2f'),_0xaa6b('0x93'),util['inspect'](_0x5ceb43[_0xaa6b('0x5b')],{'showHidden':![],'depth':null}));}break;case _0xaa6b('0x94'):if(_0x448980===_0xaa6b('0xd9')||_0x448980===_0xaa6b('0xda')){return _0x58427f[_0xaa6b('0x3a')]({'read':!![]});}else{logger[_0xaa6b('0x28')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xaa6b('0x2f'),_0xaa6b('0x94'),util['inspect'](_0x5ceb43[_0xaa6b('0x5b')],{'showHidden':![],'depth':null}));}break;}return _0x58427f;}})[_0xaa6b('0x22')](respondWithResult(_0x35f63b,null))[_0xaa6b('0x2d')](handleError(_0x35f63b,null));};exports[_0xaa6b('0xdb')]=function(_0x115d87,_0x3559dc,_0x334ba2){var _0x1839e9,_0x290fef,_0x373249;return db[_0xaa6b('0x40')][_0xaa6b('0x59')]({'where':{'id':_0x115d87[_0xaa6b('0x63')]['id']}})[_0xaa6b('0x22')](handleEntityNotFound(_0x3559dc,null))[_0xaa6b('0x22')](function(_0x51e133){if(_0x51e133){_0x373249=_0x51e133;logger['debug']('SmsAccount,\x20%s,\x20%s,\x20%s','status',_0xaa6b('0xcb'),_0x51e133[_0xaa6b('0x51')],util[_0xaa6b('0xd4')](_0x115d87[_0xaa6b('0x43')],{'showHidden':![],'depth':null}));switch(_0x51e133[_0xaa6b('0x51')]){case _0xaa6b('0x8c'):if(_0x115d87['query'][_0xaa6b('0xdc')]&&_0x115d87[_0xaa6b('0x43')][_0xaa6b('0xdd')]){_0x290fef=_0x115d87[_0xaa6b('0x43')][_0xaa6b('0xdd')];return db[_0xaa6b('0xc9')][_0xaa6b('0x59')]({'where':{'messageId':_0x115d87[_0xaa6b('0x43')][_0xaa6b('0xdc')]}});}break;}}})[_0xaa6b('0x22')](handleEntityNotFound(_0x3559dc,null))[_0xaa6b('0x22')](function(_0x4e13ef){if(_0x4e13ef){_0x1839e9=_0x4e13ef;switch(_0x373249[_0xaa6b('0x51')]){case _0xaa6b('0x8c'):if(_0x290fef==='2'||_0x290fef==='6'){return _0x1839e9['update']({'read':!![]});}else{logger['error']('SmsAccount,\x20%s,\x20%s,\x20%s','status',_0xaa6b('0x8c'),util['inspect'](_0x115d87[_0xaa6b('0x43')],{'showHidden':![],'depth':null}));};break;}return _0x1839e9;}})[_0xaa6b('0x22')](respondWithResult(_0x3559dc,null))[_0xaa6b('0x2d')](handleError(_0x3559dc,null));};exports[_0xaa6b('0xde')]=function(_0xe4bfaa,_0x3b4403,_0x412506){return db[_0xaa6b('0x40')]['find']({'where':{'id':_0xe4bfaa[_0xaa6b('0x63')]['id']}})[_0xaa6b('0x22')](handleEntityNotFound(_0x3b4403,null))['then'](function(_0x503166){if(_0x503166){return _0x503166['addAgents'](_0xe4bfaa['body'][_0xaa6b('0x6d')],_[_0xaa6b('0x9e')](_0xe4bfaa['body'],['ids','id'])||{})[_0xaa6b('0xa2')](function(_0x818ed2){for(var _0x89a4c4=0x0;_0x89a4c4<_0xe4bfaa[_0xaa6b('0x5b')][_0xaa6b('0x6d')][_0xaa6b('0x48')];_0x89a4c4+=0x1){socket['emit'](_0xaa6b('0xdf'),{'UserId':Number(_0xe4bfaa[_0xaa6b('0x5b')][_0xaa6b('0x6d')][_0x89a4c4]),'SmsAccountId':Number(_0xe4bfaa[_0xaa6b('0x63')]['id'])});}return _0x818ed2;});}})[_0xaa6b('0x22')](respondWithResult(_0x3b4403,null))[_0xaa6b('0x2d')](handleError(_0x3b4403,null));};exports[_0xaa6b('0xe0')]=function(_0x1ccbc4,_0x42d460,_0x40ab8e){return db[_0xaa6b('0x40')][_0xaa6b('0x59')]({'where':{'id':_0x1ccbc4[_0xaa6b('0x63')]['id']}})['then'](handleEntityNotFound(_0x42d460,null))['then'](function(_0x1491b4){if(_0x1491b4){return _0x1491b4[_0xaa6b('0xe0')](_0x1ccbc4['query'][_0xaa6b('0x6d')])['then'](function(){if(_[_0xaa6b('0xe1')](_0x1ccbc4[_0xaa6b('0x43')]['ids'])){for(var _0x21bc4a=0x0;_0x21bc4a<_0x1ccbc4[_0xaa6b('0x43')]['ids'][_0xaa6b('0x48')];_0x21bc4a+=0x1){socket[_0xaa6b('0xe2')](_0xaa6b('0xe3'),{'UserId':Number(_0x1ccbc4[_0xaa6b('0x43')]['ids'][_0x21bc4a]),'SmsAccountId':Number(_0x1ccbc4[_0xaa6b('0x63')]['id'])});}}else{socket[_0xaa6b('0xe2')](_0xaa6b('0xe3'),{'UserId':Number(_0x1ccbc4[_0xaa6b('0x43')][_0xaa6b('0x6d')]),'SmsAccountId':Number(_0x1ccbc4['params']['id'])});}});}})[_0xaa6b('0x22')](respondWithStatusCode(_0x42d460,null))[_0xaa6b('0x2d')](handleError(_0x42d460,null));};exports['getAgents']=function(_0xcd7551,_0x116e75,_0x4e6c2d){var _0x469c5a={};var _0x955f29={};var _0x361748;var _0x5dc028;return db[_0xaa6b('0x40')][_0xaa6b('0x68')]({'where':{'id':_0xcd7551[_0xaa6b('0x63')]['id']}})[_0xaa6b('0x22')](handleEntityNotFound(_0x116e75,null))[_0xaa6b('0x22')](function(_0x173455){if(_0x173455){_0x361748=_0x173455;_0x955f29[_0xaa6b('0x45')]=_['keys'](db[_0xaa6b('0xad')][_0xaa6b('0x41')]);_0x955f29['query']=_[_0xaa6b('0x69')](_0xcd7551[_0xaa6b('0x43')]);_0x955f29[_0xaa6b('0x4e')]=_[_0xaa6b('0x44')](_0x955f29[_0xaa6b('0x45')],_0x955f29[_0xaa6b('0x43')]);_0x469c5a['attributes']=_[_0xaa6b('0x44')](_0x955f29[_0xaa6b('0x45')],qs[_0xaa6b('0x47')](_0xcd7551[_0xaa6b('0x43')][_0xaa6b('0x47')]));_0x469c5a[_0xaa6b('0x46')]=_0x469c5a[_0xaa6b('0x46')][_0xaa6b('0x48')]?_0x469c5a['attributes']:_0x955f29['model'];_0x469c5a[_0xaa6b('0x4a')]=qs[_0xaa6b('0x4b')](_0xcd7551[_0xaa6b('0x43')][_0xaa6b('0x4b')]);_0x469c5a[_0xaa6b('0x4c')]=qs[_0xaa6b('0x4e')](_['pick'](_0xcd7551[_0xaa6b('0x43')],_0x955f29['filters']));if(_0xcd7551[_0xaa6b('0x43')][_0xaa6b('0x4f')]){_0x469c5a['where']=_[_0xaa6b('0x50')](_0x469c5a[_0xaa6b('0x4c')],{'$or':_[_0xaa6b('0xb9')](_0x469c5a['attributes'],function(_0x536390){var _0x1b08de={};_0x1b08de[_0x536390]={'$like':'%'+_0xcd7551[_0xaa6b('0x43')]['filter']+'%'};return _0x1b08de;})});}_0x469c5a=_[_0xaa6b('0x50')]({},_0x469c5a,_0xcd7551[_0xaa6b('0x53')]);return _0x361748[_0xaa6b('0xe4')](_0x469c5a);}})['then'](function(_0x29f0eb){if(_0x29f0eb){_0x5dc028=_0x29f0eb[_0xaa6b('0x48')];if(!_0xcd7551[_0xaa6b('0x43')][_0xaa6b('0x6a')](_0xaa6b('0x49'))){_0x469c5a[_0xaa6b('0x34')]=qs[_0xaa6b('0x34')](_0xcd7551[_0xaa6b('0x43')][_0xaa6b('0x34')]);_0x469c5a[_0xaa6b('0x32')]=qs[_0xaa6b('0x32')](_0xcd7551[_0xaa6b('0x43')][_0xaa6b('0x32')]);}return _0x361748[_0xaa6b('0xe4')](_0x469c5a);}})[_0xaa6b('0x22')](function(_0x2aa468){if(_0x2aa468){return _0x2aa468?{'count':_0x5dc028,'rows':_0x2aa468}:null;}})[_0xaa6b('0x22')](respondWithResult(_0x116e75,null))['catch'](handleError(_0x116e75,null));}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.events.js b/server/api/smsAccount/smsAccount.events.js index 144bef8..403471e 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 _0x5595=['hook','events','../../mysqldb','SmsAccount','setMaxListeners','update','remove','emit'];(function(_0xc6b104,_0x1d805a){var _0x1c6fce=function(_0x1bfb3f){while(--_0x1bfb3f){_0xc6b104['push'](_0xc6b104['shift']());}};_0x1c6fce(++_0x1d805a);}(_0x5595,0x141));var _0x5559=function(_0x799896,_0x5c435e){_0x799896=_0x799896-0x0;var _0x3847cc=_0x5595[_0x799896];return _0x3847cc;};'use strict';var EventEmitter=require(_0x5559('0x0'));var SmsAccount=require(_0x5559('0x1'))['db'][_0x5559('0x2')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0x5559('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x5559('0x4'),'afterDestroy':_0x5559('0x5')};function emitEvent(_0x134715){return function(_0x5618ab,_0x4b9821,_0x4f14c7){SmsAccountEvents['emit'](_0x134715+':'+_0x5618ab['id'],_0x5618ab);SmsAccountEvents[_0x5559('0x6')](_0x134715,_0x5618ab);_0x4f14c7(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsAccount[_0x5559('0x7')](e,emitEvent(event));}}module['exports']=SmsAccountEvents; \ No newline at end of file +var _0xf421=['update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','SmsAccount','setMaxListeners','save'];(function(_0x3fba9f,_0x3b7b9b){var _0x192cf1=function(_0x557290){while(--_0x557290){_0x3fba9f['push'](_0x3fba9f['shift']());}};_0x192cf1(++_0x3b7b9b);}(_0xf421,0x1c9));var _0x1f42=function(_0x287d51,_0x46b59f){_0x287d51=_0x287d51-0x0;var _0x3709c7=_0xf421[_0x287d51];return _0x3709c7;};'use strict';var EventEmitter=require(_0x1f42('0x0'));var SmsAccount=require(_0x1f42('0x1'))['db'][_0x1f42('0x2')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0x1f42('0x3')](0x0);var events={'afterCreate':_0x1f42('0x4'),'afterUpdate':_0x1f42('0x5'),'afterDestroy':_0x1f42('0x6')};function emitEvent(_0x2e5393){return function(_0x36ba29,_0x4aa7c7,_0x1688f1){SmsAccountEvents['emit'](_0x2e5393+':'+_0x36ba29['id'],_0x36ba29);SmsAccountEvents[_0x1f42('0x7')](_0x2e5393,_0x36ba29);_0x1688f1(null);};}for(var e in events){if(events[_0x1f42('0x8')](e)){var event=events[e];SmsAccount[_0x1f42('0x9')](e,emitEvent(event));}}module[_0x1f42('0xa')]=SmsAccountEvents; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.model.js b/server/api/smsAccount/smsAccount.model.js index 0e6a680..b4d1ce7 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 _0xb032=['path','../../config/environment','./smsAccount.attributes','exports','define','SmsAccount','sms_accounts','util','../../config/logger','api','moment','bluebird'];(function(_0x443e4d,_0x171f88){var _0x4bd86d=function(_0x102448){while(--_0x102448){_0x443e4d['push'](_0x443e4d['shift']());}};_0x4bd86d(++_0x171f88);}(_0xb032,0xeb));var _0x2b03=function(_0xac3b20,_0x48e68c){_0xac3b20=_0xac3b20-0x0;var _0x580caf=_0xb032[_0xac3b20];return _0x580caf;};'use strict';var _=require('lodash');var util=require(_0x2b03('0x0'));var logger=require(_0x2b03('0x1'))(_0x2b03('0x2'));var moment=require(_0x2b03('0x3'));var BPromise=require(_0x2b03('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2b03('0x5'));var rimraf=require('rimraf');var config=require(_0x2b03('0x6'));var attributes=require(_0x2b03('0x7'));module[_0x2b03('0x8')]=function(_0x53ff93,_0x572e18){return _0x53ff93[_0x2b03('0x9')](_0x2b03('0xa'),attributes,{'tableName':_0x2b03('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x84df=['sms_accounts','lodash','util','api','moment','bluebird','request-promise','rimraf','../../config/environment','./smsAccount.attributes','exports','SmsAccount'];(function(_0x152121,_0x120c53){var _0x592a85=function(_0x241cab){while(--_0x241cab){_0x152121['push'](_0x152121['shift']());}};_0x592a85(++_0x120c53);}(_0x84df,0x175));var _0xf84d=function(_0x406696,_0x39f9b1){_0x406696=_0x406696-0x0;var _0x10e35c=_0x84df[_0x406696];return _0x10e35c;};'use strict';var _=require(_0xf84d('0x0'));var util=require(_0xf84d('0x1'));var logger=require('../../config/logger')(_0xf84d('0x2'));var moment=require(_0xf84d('0x3'));var BPromise=require(_0xf84d('0x4'));var rp=require(_0xf84d('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf84d('0x6'));var config=require(_0xf84d('0x7'));var attributes=require(_0xf84d('0x8'));module[_0xf84d('0x9')]=function(_0x1ade21,_0x5783c3){return _0x1ade21['define'](_0xf84d('0xa'),attributes,{'tableName':_0xf84d('0xb'),'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 24fcecf..19a566e 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 _0xfc7c=['include','model','map','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','request','then','info','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','SmsAccount,\x20%s,\x20%s','message','result','catch','ShowSmsAccount','options','raw','attributes'];(function(_0x28025d,_0x2be2c3){var _0x2f9815=function(_0x45284e){while(--_0x45284e){_0x28025d['push'](_0x28025d['shift']());}};_0x2f9815(++_0x2be2c3);}(_0xfc7c,0x135));var _0xcfc7=function(_0x2329fc,_0x44840a){_0x2329fc=_0x2329fc-0x0;var _0x6b358f=_0xfc7c[_0x2329fc];return _0x6b358f;};'use strict';var _=require(_0xcfc7('0x0'));var util=require(_0xcfc7('0x1'));var moment=require(_0xcfc7('0x2'));var BPromise=require('bluebird');var rs=require(_0xcfc7('0x3'));var fs=require('fs');var Redis=require(_0xcfc7('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xcfc7('0x5'));var logger=require(_0xcfc7('0x6'))(_0xcfc7('0x7'));var config=require(_0xcfc7('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xcfc7('0x9')][_0xcfc7('0xa')]({'port':0x232a});config[_0xcfc7('0xb')]=_[_0xcfc7('0xc')](config['redis'],{'host':_0xcfc7('0xd'),'port':0x18eb});var socket=require(_0xcfc7('0xe'))(new Redis(config[_0xcfc7('0xb')]));require('./smsAccount.socket')['register'](socket);function respondWithRpcPromise(_0x55fee1,_0x5a4ebf,_0x5ba3d9){return new BPromise(function(_0x24e402,_0x2617bc){return client[_0xcfc7('0xf')](_0x55fee1,_0x5ba3d9)[_0xcfc7('0x10')](function(_0x3738e2){logger[_0xcfc7('0x11')]('SmsAccount,\x20%s,\x20%s',_0x5a4ebf,_0xcfc7('0x12'));logger[_0xcfc7('0x13')](_0xcfc7('0x14'),_0x5a4ebf,_0xcfc7('0x12'),JSON[_0xcfc7('0x15')](_0x3738e2));if(_0x3738e2[_0xcfc7('0x16')]){if(_0x3738e2[_0xcfc7('0x16')]['code']===0x1f4){logger['error'](_0xcfc7('0x17'),_0x5a4ebf,_0x3738e2['error'][_0xcfc7('0x18')]);return _0x2617bc(_0x3738e2[_0xcfc7('0x16')]['message']);}logger['error'](_0xcfc7('0x17'),_0x5a4ebf,_0x3738e2[_0xcfc7('0x16')][_0xcfc7('0x18')]);return _0x24e402(_0x3738e2['error'][_0xcfc7('0x18')]);}else{logger['info'](_0xcfc7('0x17'),_0x5a4ebf,_0xcfc7('0x12'));_0x24e402(_0x3738e2[_0xcfc7('0x19')][_0xcfc7('0x18')]);}})[_0xcfc7('0x1a')](function(_0x1fdf86){logger[_0xcfc7('0x16')](_0xcfc7('0x17'),_0x5a4ebf,_0x1fdf86);_0x2617bc(_0x1fdf86);});});}exports[_0xcfc7('0x1b')]=function(_0xcdedec){var _0xc2a630=this;return new Promise(function(_0x395bae,_0x1a79b1){return db['SmsAccount']['find']({'raw':_0xcdedec[_0xcfc7('0x1c')]?_0xcdedec[_0xcfc7('0x1c')][_0xcfc7('0x1d')]===undefined?!![]:![]:!![],'where':_0xcdedec[_0xcfc7('0x1c')]?_0xcdedec[_0xcfc7('0x1c')]['where']||null:null,'attributes':_0xcdedec[_0xcfc7('0x1c')]?_0xcdedec[_0xcfc7('0x1c')][_0xcfc7('0x1e')]||null:null,'include':_0xcdedec[_0xcfc7('0x1c')]?_0xcdedec[_0xcfc7('0x1c')][_0xcfc7('0x1f')]?_['map'](_0xcdedec[_0xcfc7('0x1c')][_0xcfc7('0x1f')],function(_0x47f9e7){return{'model':db[_0x47f9e7[_0xcfc7('0x20')]],'as':_0x47f9e7['as'],'attributes':_0x47f9e7[_0xcfc7('0x1e')],'include':_0x47f9e7[_0xcfc7('0x1f')]?_[_0xcfc7('0x21')](_0x47f9e7[_0xcfc7('0x1f')],function(_0xb97c13){return{'model':db[_0xb97c13[_0xcfc7('0x20')]],'as':_0xb97c13['as'],'attributes':_0xb97c13[_0xcfc7('0x1e')],'include':_0xb97c13[_0xcfc7('0x1f')]?_['map'](_0xb97c13['include'],function(_0x4389e6){return{'model':db[_0x4389e6[_0xcfc7('0x20')]],'as':_0x4389e6['as'],'attributes':_0x4389e6['attributes']};}):[]};}):[]};}):[]:[]})[_0xcfc7('0x10')](function(_0x299ddd){logger[_0xcfc7('0x11')]('ShowSmsAccount',_0xcdedec);logger['debug'](_0xcfc7('0x1b'),_0xcdedec,JSON[_0xcfc7('0x15')](_0x299ddd));_0x395bae(_0x299ddd);})['catch'](function(_0x5b5ee1){logger[_0xcfc7('0x16')](_0xcfc7('0x1b'),_0x5b5ee1[_0xcfc7('0x18')],_0xcdedec);_0x1a79b1(_0xc2a630['error'](0x1f4,_0x5b5ee1['message']));});});}; \ No newline at end of file +var _0x02bc=['include','map','model','stringify','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','localhost','./smsAccount.socket','request','then','info','SmsAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','SmsAccount,\x20%s,\x20%s','message','result','SmsAccount','find','options','where','attributes'];(function(_0x462b34,_0x2dbe8c){var _0x1a5506=function(_0xe95f){while(--_0xe95f){_0x462b34['push'](_0x462b34['shift']());}};_0x1a5506(++_0x2dbe8c);}(_0x02bc,0xb4));var _0xc02b=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x02bc[_0x432682];return _0x463d05;};'use strict';var _=require(_0xc02b('0x0'));var util=require(_0xc02b('0x1'));var moment=require(_0xc02b('0x2'));var BPromise=require(_0xc02b('0x3'));var rs=require(_0xc02b('0x4'));var fs=require('fs');var Redis=require(_0xc02b('0x5'));var db=require(_0xc02b('0x6'))['db'];var utils=require(_0xc02b('0x7'));var logger=require(_0xc02b('0x8'))('rpc');var config=require(_0xc02b('0x9'));var jayson=require(_0xc02b('0xa'));var client=jayson[_0xc02b('0xb')][_0xc02b('0xc')]({'port':0x232a});config[_0xc02b('0xd')]=_['defaults'](config['redis'],{'host':_0xc02b('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xc02b('0xd')]));require(_0xc02b('0xf'))['register'](socket);function respondWithRpcPromise(_0x5d6693,_0x13c151,_0x4ddc51){return new BPromise(function(_0x93a79d,_0x34e250){return client[_0xc02b('0x10')](_0x5d6693,_0x4ddc51)[_0xc02b('0x11')](function(_0xf5b17){logger[_0xc02b('0x12')]('SmsAccount,\x20%s,\x20%s',_0x13c151,'request\x20sent');logger['debug'](_0xc02b('0x13'),_0x13c151,_0xc02b('0x14'),JSON['stringify'](_0xf5b17));if(_0xf5b17[_0xc02b('0x15')]){if(_0xf5b17[_0xc02b('0x15')]['code']===0x1f4){logger[_0xc02b('0x15')]('SmsAccount,\x20%s,\x20%s',_0x13c151,_0xf5b17['error']['message']);return _0x34e250(_0xf5b17['error']['message']);}logger['error'](_0xc02b('0x16'),_0x13c151,_0xf5b17[_0xc02b('0x15')][_0xc02b('0x17')]);return _0x93a79d(_0xf5b17['error'][_0xc02b('0x17')]);}else{logger[_0xc02b('0x12')]('SmsAccount,\x20%s,\x20%s',_0x13c151,_0xc02b('0x14'));_0x93a79d(_0xf5b17[_0xc02b('0x18')]['message']);}})['catch'](function(_0x79f80d){logger['error'](_0xc02b('0x16'),_0x13c151,_0x79f80d);_0x34e250(_0x79f80d);});});}exports['ShowSmsAccount']=function(_0x34b9c0){var _0x2f8cc2=this;return new Promise(function(_0x290f3a,_0x2127a2){return db[_0xc02b('0x19')][_0xc02b('0x1a')]({'raw':_0x34b9c0[_0xc02b('0x1b')]?_0x34b9c0['options']['raw']===undefined?!![]:![]:!![],'where':_0x34b9c0['options']?_0x34b9c0[_0xc02b('0x1b')][_0xc02b('0x1c')]||null:null,'attributes':_0x34b9c0[_0xc02b('0x1b')]?_0x34b9c0[_0xc02b('0x1b')][_0xc02b('0x1d')]||null:null,'include':_0x34b9c0[_0xc02b('0x1b')]?_0x34b9c0['options'][_0xc02b('0x1e')]?_[_0xc02b('0x1f')](_0x34b9c0['options'][_0xc02b('0x1e')],function(_0x350171){return{'model':db[_0x350171[_0xc02b('0x20')]],'as':_0x350171['as'],'attributes':_0x350171[_0xc02b('0x1d')],'include':_0x350171[_0xc02b('0x1e')]?_[_0xc02b('0x1f')](_0x350171[_0xc02b('0x1e')],function(_0x5b091a){return{'model':db[_0x5b091a[_0xc02b('0x20')]],'as':_0x5b091a['as'],'attributes':_0x5b091a[_0xc02b('0x1d')],'include':_0x5b091a[_0xc02b('0x1e')]?_['map'](_0x5b091a[_0xc02b('0x1e')],function(_0x51a6cd){return{'model':db[_0x51a6cd[_0xc02b('0x20')]],'as':_0x51a6cd['as'],'attributes':_0x51a6cd['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x4b8037){logger['info']('ShowSmsAccount',_0x34b9c0);logger['debug']('ShowSmsAccount',_0x34b9c0,JSON[_0xc02b('0x21')](_0x4b8037));_0x290f3a(_0x4b8037);})[_0xc02b('0x22')](function(_0x35ba77){logger['error']('ShowSmsAccount',_0x35ba77['message'],_0x34b9c0);_0x2127a2(_0x2f8cc2['error'](0x1f4,_0x35ba77['message']));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.socket.js b/server/api/smsAccount/smsAccount.socket.js index 7d5ddb7..ee9056d 100644 --- a/server/api/smsAccount/smsAccount.socket.js +++ b/server/api/smsAccount/smsAccount.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['register','length','smsAccount:','./smsAccount.events','save','remove','emit','removeListener'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2b10c6,_0x185590){_0x2b10c6=_0x2b10c6-0x0;var _0x3789d2=_0xa9e0[_0x2b10c6];return _0x3789d2;};'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(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1da04e,_0x31024b){_0x1da04e=_0x1da04e-0x0;var _0xdd8c41=_0xa9e0[_0x1da04e];return _0xdd8c41;};'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 f332db8..0433b89 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 _0x7217=['Router','fs-extra','../../config/environment','./smsApplication.controller','get','isAuthenticated','index','/:id','show','post','create','put','delete','destroy','exports','multer','path','connect-timeout','express'];(function(_0x18f146,_0x3738ed){var _0x1e413c=function(_0xf5551e){while(--_0xf5551e){_0x18f146['push'](_0x18f146['shift']());}};_0x1e413c(++_0x3738ed);}(_0x7217,0x19e));var _0x7721=function(_0x3a6efd,_0x2a5102){_0x3a6efd=_0x3a6efd-0x0;var _0x487b9a=_0x7217[_0x3a6efd];return _0x487b9a;};'use strict';var multer=require(_0x7721('0x0'));var util=require('util');var path=require(_0x7721('0x1'));var timeout=require(_0x7721('0x2'));var express=require(_0x7721('0x3'));var router=express[_0x7721('0x4')]();var fs_extra=require(_0x7721('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x7721('0x6'));var controller=require(_0x7721('0x7'));router[_0x7721('0x8')]('/',auth[_0x7721('0x9')](),controller[_0x7721('0xa')]);router[_0x7721('0x8')](_0x7721('0xb'),auth[_0x7721('0x9')](),controller[_0x7721('0xc')]);router[_0x7721('0xd')]('/',auth[_0x7721('0x9')](),controller[_0x7721('0xe')]);router[_0x7721('0xf')](_0x7721('0xb'),auth[_0x7721('0x9')](),controller['update']);router[_0x7721('0x10')](_0x7721('0xb'),auth[_0x7721('0x9')](),controller[_0x7721('0x11')]);module[_0x7721('0x12')]=router; \ No newline at end of file +var _0x008c=['exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsApplication.controller','get','isAuthenticated','index','post','put','/:id'];(function(_0x4c4b04,_0x569c2b){var _0xad2374=function(_0x1fb354){while(--_0x1fb354){_0x4c4b04['push'](_0x4c4b04['shift']());}};_0xad2374(++_0x569c2b);}(_0x008c,0x188));var _0xc008=function(_0x267c52,_0x3c0df3){_0x267c52=_0x267c52-0x0;var _0x46c47b=_0x008c[_0x267c52];return _0x46c47b;};'use strict';var multer=require(_0xc008('0x0'));var util=require(_0xc008('0x1'));var path=require(_0xc008('0x2'));var timeout=require(_0xc008('0x3'));var express=require(_0xc008('0x4'));var router=express['Router']();var fs_extra=require(_0xc008('0x5'));var auth=require(_0xc008('0x6'));var interaction=require(_0xc008('0x7'));var config=require(_0xc008('0x8'));var controller=require(_0xc008('0x9'));router[_0xc008('0xa')]('/',auth[_0xc008('0xb')](),controller[_0xc008('0xc')]);router[_0xc008('0xa')]('/:id',auth[_0xc008('0xb')](),controller['show']);router[_0xc008('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0xc008('0xe')](_0xc008('0xf'),auth['isAuthenticated'](),controller['update']);router['delete'](_0xc008('0xf'),auth[_0xc008('0xb')](),controller['destroy']);module[_0xc008('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 5f6a85d..0120345 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 _0x3951=['noop','*,*,*,*','sequelize','INTEGER','STRING'];(function(_0x37f7e0,_0x52ebad){var _0x48f7d9=function(_0x2d8356){while(--_0x2d8356){_0x37f7e0['push'](_0x37f7e0['shift']());}};_0x48f7d9(++_0x52ebad);}(_0x3951,0x1a1));var _0x1395=function(_0x355dcf,_0x441f7b){_0x355dcf=_0x355dcf-0x0;var _0x4539c2=_0x3951[_0x355dcf];return _0x4539c2;};'use strict';var Sequelize=require(_0x1395('0x0'));module['exports']={'priority':{'type':Sequelize[_0x1395('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x1395('0x2')],'allowNull':![],'defaultValue':_0x1395('0x3')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0x1395('0x2')]},'interval':{'type':Sequelize[_0x1395('0x2')],'defaultValue':_0x1395('0x4')}}; \ No newline at end of file +var _0x5815=['INTEGER','STRING','noop','*,*,*,*','sequelize','exports'];(function(_0x427476,_0x318626){var _0x2f9771=function(_0x18d583){while(--_0x18d583){_0x427476['push'](_0x427476['shift']());}};_0x2f9771(++_0x318626);}(_0x5815,0x1d2));var _0x5581=function(_0x2082a1,_0x590127){_0x2082a1=_0x2082a1-0x0;var _0x7df734=_0x5815[_0x2082a1];return _0x7df734;};'use strict';var Sequelize=require(_0x5581('0x0'));module[_0x5581('0x1')]={'priority':{'type':Sequelize[_0x5581('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x5581('0x3')],'allowNull':![],'defaultValue':_0x5581('0x4')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0x5581('0x3')]},'interval':{'type':Sequelize[_0x5581('0x3')],'defaultValue':_0x5581('0x5')}}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.controller.js b/server/api/smsApplication/smsApplication.controller.js index c32c078..9f1cdfa 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 _0x1e1e=['papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','offset','undefined','count','limit','status','set','Content-Range','json','apply','reject','save','then','destroy','error','stack','name','index','SmsApplication','rawAttributes','key','model','keys','filters','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','includeAll','catch','params','options','find','create','body','update','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','crypto','jsforce','desk.js','querystring'];(function(_0x5783f4,_0x4a9e0a){var _0x28e380=function(_0x1ffc49){while(--_0x1ffc49){_0x5783f4['push'](_0x5783f4['shift']());}};_0x28e380(++_0x4a9e0a);}(_0x1e1e,0x159));var _0xe1e1=function(_0x3d5f84,_0x569548){_0x3d5f84=_0x3d5f84-0x0;var _0x1981b8=_0x1e1e[_0x3d5f84];return _0x1981b8;};'use strict';var emlformat=require(_0xe1e1('0x0'));var rimraf=require(_0xe1e1('0x1'));var zipdir=require(_0xe1e1('0x2'));var jsonpatch=require(_0xe1e1('0x3'));var rp=require('request-promise');var moment=require(_0xe1e1('0x4'));var BPromise=require(_0xe1e1('0x5'));var Mustache=require(_0xe1e1('0x6'));var util=require(_0xe1e1('0x7'));var path=require(_0xe1e1('0x8'));var sox=require('sox');var csv=require(_0xe1e1('0x9'));var ejs=require(_0xe1e1('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0xe1e1('0xb'));var jsforce=require(_0xe1e1('0xc'));var deskjs=require(_0xe1e1('0xd'));var toCsv=require(_0xe1e1('0x9'));var querystring=require(_0xe1e1('0xe'));var Papa=require(_0xe1e1('0xf'));var Redis=require(_0xe1e1('0x10'));var authService=require(_0xe1e1('0x11'));var qs=require(_0xe1e1('0x12'));var as=require(_0xe1e1('0x13'));var hardwareService=require(_0xe1e1('0x14'));var logger=require(_0xe1e1('0x15'))(_0xe1e1('0x16'));var utils=require(_0xe1e1('0x17'));var config=require(_0xe1e1('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xe1e1('0x19'))['db'];function respondWithStatusCode(_0x5add06,_0x445906){_0x445906=_0x445906||0xcc;return function(_0x54c412){if(_0x54c412){return _0x5add06[_0xe1e1('0x1a')](_0x445906);}return _0x5add06['status'](_0x445906)[_0xe1e1('0x1b')]();};}function respondWithResult(_0x4f618e,_0x546206){_0x546206=_0x546206||0xc8;return function(_0x397920){if(_0x397920){return _0x4f618e['status'](_0x546206)['json'](_0x397920);}};}function respondWithFilteredResult(_0xe46e5e,_0x4aad2e){return function(_0x4272f0){if(_0x4272f0){var _0x42e2f5=typeof _0x4aad2e[_0xe1e1('0x1c')]===_0xe1e1('0x1d')&&typeof _0x4aad2e['limit']===_0xe1e1('0x1d');var _0x3ddefb=_0x4272f0[_0xe1e1('0x1e')];var _0x4364f5=_0x42e2f5?0x0:_0x4aad2e[_0xe1e1('0x1c')];var _0x588e35=_0x42e2f5?_0x4272f0[_0xe1e1('0x1e')]:_0x4aad2e[_0xe1e1('0x1c')]+_0x4aad2e[_0xe1e1('0x1f')];var _0x597265;if(_0x588e35>=_0x3ddefb){_0x588e35=_0x3ddefb;_0x597265=0xc8;}else{_0x597265=0xce;}_0xe46e5e[_0xe1e1('0x20')](_0x597265);return _0xe46e5e[_0xe1e1('0x21')](_0xe1e1('0x22'),_0x4364f5+'-'+_0x588e35+'/'+_0x3ddefb)[_0xe1e1('0x23')](_0x4272f0);}return null;};}function patchUpdates(_0x45490e){return function(_0x2a59eb){try{jsonpatch[_0xe1e1('0x24')](_0x2a59eb,_0x45490e,!![]);}catch(_0x53abde){return BPromise[_0xe1e1('0x25')](_0x53abde);}return _0x2a59eb[_0xe1e1('0x26')]();};}function saveUpdates(_0x3a764e,_0x27de6a){return function(_0x135749){if(_0x135749){return _0x135749['update'](_0x3a764e)[_0xe1e1('0x27')](function(_0x39f207){return _0x39f207;});}return null;};}function removeEntity(_0x492534,_0x28ac71){return function(_0x236935){if(_0x236935){return _0x236935[_0xe1e1('0x28')]()[_0xe1e1('0x27')](function(){_0x492534[_0xe1e1('0x20')](0xcc)[_0xe1e1('0x1b')]();});}};}function handleEntityNotFound(_0x559ced,_0x47d1cc){return function(_0x1d1570){if(!_0x1d1570){_0x559ced['sendStatus'](0x194);}return _0x1d1570;};}function handleError(_0x4a39ba,_0x45c44f){_0x45c44f=_0x45c44f||0x1f4;return function(_0x2ee33c){logger[_0xe1e1('0x29')](_0x2ee33c[_0xe1e1('0x2a')]);if(_0x2ee33c['name']){delete _0x2ee33c[_0xe1e1('0x2b')];}_0x4a39ba[_0xe1e1('0x20')](_0x45c44f)['send'](_0x2ee33c);};}exports[_0xe1e1('0x2c')]=function(_0x2c3c68,_0x1cd886){var _0x2e9260={},_0x24080d={},_0x1ca8f9={'count':0x0,'rows':[]};var _0x117bb9=_['map'](db[_0xe1e1('0x2d')][_0xe1e1('0x2e')],function(_0x22c099){return{'name':_0x22c099['fieldName'],'type':_0x22c099['type'][_0xe1e1('0x2f')]};});_0x24080d[_0xe1e1('0x30')]=_['map'](_0x117bb9,_0xe1e1('0x2b'));_0x24080d['query']=_[_0xe1e1('0x31')](_0x2c3c68['query']);_0x24080d[_0xe1e1('0x32')]=_['intersection'](_0x24080d[_0xe1e1('0x30')],_0x24080d[_0xe1e1('0x33')]);_0x2e9260[_0xe1e1('0x34')]=_[_0xe1e1('0x35')](_0x24080d[_0xe1e1('0x30')],qs[_0xe1e1('0x36')](_0x2c3c68[_0xe1e1('0x33')][_0xe1e1('0x36')]));_0x2e9260['attributes']=_0x2e9260['attributes'][_0xe1e1('0x37')]?_0x2e9260[_0xe1e1('0x34')]:_0x24080d['model'];if(!_0x2c3c68[_0xe1e1('0x33')][_0xe1e1('0x38')](_0xe1e1('0x39'))){_0x2e9260[_0xe1e1('0x1f')]=qs[_0xe1e1('0x1f')](_0x2c3c68[_0xe1e1('0x33')][_0xe1e1('0x1f')]);_0x2e9260['offset']=qs[_0xe1e1('0x1c')](_0x2c3c68[_0xe1e1('0x33')][_0xe1e1('0x1c')]);}_0x2e9260[_0xe1e1('0x3a')]=qs[_0xe1e1('0x3b')](_0x2c3c68['query'][_0xe1e1('0x3b')]);_0x2e9260[_0xe1e1('0x3c')]=qs[_0xe1e1('0x32')](_[_0xe1e1('0x3d')](_0x2c3c68['query'],_0x24080d[_0xe1e1('0x32')]),_0x117bb9);if(_0x2c3c68[_0xe1e1('0x33')][_0xe1e1('0x3e')]){_0x2e9260[_0xe1e1('0x3c')]=_[_0xe1e1('0x3f')](_0x2e9260[_0xe1e1('0x3c')],{'$or':_['map'](_0x117bb9,function(_0x2c3935){if(_0x2c3935['type']!=='VIRTUAL'){var _0x1b098b={};_0x1b098b[_0x2c3935[_0xe1e1('0x2b')]]={'$like':'%'+_0x2c3c68[_0xe1e1('0x33')]['filter']+'%'};return _0x1b098b;}})});}_0x2e9260=_[_0xe1e1('0x3f')]({},_0x2e9260,_0x2c3c68['options']);var _0x54da02={'where':_0x2e9260[_0xe1e1('0x3c')]};return db[_0xe1e1('0x2d')][_0xe1e1('0x1e')](_0x54da02)[_0xe1e1('0x27')](function(_0x16f2d5){_0x1ca8f9['count']=_0x16f2d5;if(_0x2c3c68[_0xe1e1('0x33')][_0xe1e1('0x40')]){_0x2e9260['include']=[{'all':!![]}];}return db[_0xe1e1('0x2d')]['findAll'](_0x2e9260);})[_0xe1e1('0x27')](function(_0x47381f){_0x1ca8f9['rows']=_0x47381f;return _0x1ca8f9;})['then'](respondWithFilteredResult(_0x1cd886,_0x2e9260))[_0xe1e1('0x41')](handleError(_0x1cd886,null));};exports['show']=function(_0x1181f6,_0x2dc496){var _0x104756={'raw':!![],'where':{'id':_0x1181f6[_0xe1e1('0x42')]['id']}},_0x202368={};_0x202368['model']=_['keys'](db['SmsApplication']['rawAttributes']);_0x202368[_0xe1e1('0x33')]=_['keys'](_0x1181f6[_0xe1e1('0x33')]);_0x202368[_0xe1e1('0x32')]=_['intersection'](_0x202368[_0xe1e1('0x30')],_0x202368[_0xe1e1('0x33')]);_0x104756[_0xe1e1('0x34')]=_[_0xe1e1('0x35')](_0x202368['model'],qs[_0xe1e1('0x36')](_0x1181f6[_0xe1e1('0x33')][_0xe1e1('0x36')]));_0x104756['attributes']=_0x104756[_0xe1e1('0x34')][_0xe1e1('0x37')]?_0x104756[_0xe1e1('0x34')]:_0x202368[_0xe1e1('0x30')];if(_0x1181f6[_0xe1e1('0x33')][_0xe1e1('0x40')]){_0x104756['include']=[{'all':!![]}];}_0x104756=_[_0xe1e1('0x3f')]({},_0x104756,_0x1181f6[_0xe1e1('0x43')]);return db[_0xe1e1('0x2d')][_0xe1e1('0x44')](_0x104756)[_0xe1e1('0x27')](handleEntityNotFound(_0x2dc496,null))[_0xe1e1('0x27')](respondWithResult(_0x2dc496,null))['catch'](handleError(_0x2dc496,null));};exports[_0xe1e1('0x45')]=function(_0x43878b,_0x39f220){return db[_0xe1e1('0x2d')][_0xe1e1('0x45')](_0x43878b[_0xe1e1('0x46')],{})[_0xe1e1('0x27')](respondWithResult(_0x39f220,0xc9))[_0xe1e1('0x41')](handleError(_0x39f220,null));};exports[_0xe1e1('0x47')]=function(_0x25dad4,_0x117585){if(_0x25dad4[_0xe1e1('0x46')]['id']){delete _0x25dad4[_0xe1e1('0x46')]['id'];}return db[_0xe1e1('0x2d')][_0xe1e1('0x44')]({'where':{'id':_0x25dad4[_0xe1e1('0x42')]['id']}})[_0xe1e1('0x27')](handleEntityNotFound(_0x117585,null))[_0xe1e1('0x27')](saveUpdates(_0x25dad4[_0xe1e1('0x46')],null))[_0xe1e1('0x27')](respondWithResult(_0x117585,null))[_0xe1e1('0x41')](handleError(_0x117585,null));};exports[_0xe1e1('0x28')]=function(_0x3dc906,_0x10bc99){return db[_0xe1e1('0x2d')][_0xe1e1('0x44')]({'where':{'id':_0x3dc906[_0xe1e1('0x42')]['id']}})[_0xe1e1('0x27')](handleEntityNotFound(_0x10bc99,null))[_0xe1e1('0x27')](removeEntity(_0x10bc99,null))['catch'](handleError(_0x10bc99,null));}; \ No newline at end of file +var _0x6e94=['filter','merge','VIRTUAL','options','SmsApplication','include','rows','catch','params','intersection','length','find','create','body','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','offset','undefined','limit','count','set','Content-Range','json','then','destroy','sendStatus','name','index','map','rawAttributes','fieldName','type','key','query','keys','filters','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick'];(function(_0x53f9c2,_0x5659e9){var _0x960075=function(_0x4d281a){while(--_0x4d281a){_0x53f9c2['push'](_0x53f9c2['shift']());}};_0x960075(++_0x5659e9);}(_0x6e94,0x126));var _0x46e9=function(_0xfa634c,_0x414e0e){_0xfa634c=_0xfa634c-0x0;var _0x73e478=_0x6e94[_0xfa634c];return _0x73e478;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x46e9('0x0'));var zipdir=require(_0x46e9('0x1'));var jsonpatch=require(_0x46e9('0x2'));var rp=require(_0x46e9('0x3'));var moment=require(_0x46e9('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x46e9('0x5'));var path=require(_0x46e9('0x6'));var sox=require(_0x46e9('0x7'));var csv=require(_0x46e9('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x46e9('0x9'));var _=require(_0x46e9('0xa'));var squel=require(_0x46e9('0xb'));var crypto=require(_0x46e9('0xc'));var jsforce=require(_0x46e9('0xd'));var deskjs=require(_0x46e9('0xe'));var toCsv=require(_0x46e9('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x46e9('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x46e9('0x10'));var as=require(_0x46e9('0x11'));var hardwareService=require(_0x46e9('0x12'));var logger=require(_0x46e9('0x13'))(_0x46e9('0x14'));var utils=require(_0x46e9('0x15'));var config=require(_0x46e9('0x16'));var licenseUtil=require(_0x46e9('0x17'));var db=require(_0x46e9('0x18'))['db'];function respondWithStatusCode(_0x5868b2,_0x2fc3f6){_0x2fc3f6=_0x2fc3f6||0xcc;return function(_0x41c2c4){if(_0x41c2c4){return _0x5868b2['sendStatus'](_0x2fc3f6);}return _0x5868b2[_0x46e9('0x19')](_0x2fc3f6)[_0x46e9('0x1a')]();};}function respondWithResult(_0x5cfcd1,_0x40f3b1){_0x40f3b1=_0x40f3b1||0xc8;return function(_0x4c7da9){if(_0x4c7da9){return _0x5cfcd1['status'](_0x40f3b1)['json'](_0x4c7da9);}};}function respondWithFilteredResult(_0x54c3d6,_0x453bf3){return function(_0x534e8d){if(_0x534e8d){var _0x561768=typeof _0x453bf3[_0x46e9('0x1b')]===_0x46e9('0x1c')&&typeof _0x453bf3[_0x46e9('0x1d')]===_0x46e9('0x1c');var _0x1761ff=_0x534e8d[_0x46e9('0x1e')];var _0x3a0d52=_0x561768?0x0:_0x453bf3[_0x46e9('0x1b')];var _0x473738=_0x561768?_0x534e8d[_0x46e9('0x1e')]:_0x453bf3[_0x46e9('0x1b')]+_0x453bf3[_0x46e9('0x1d')];var _0x5ea3a3;if(_0x473738>=_0x1761ff){_0x473738=_0x1761ff;_0x5ea3a3=0xc8;}else{_0x5ea3a3=0xce;}_0x54c3d6[_0x46e9('0x19')](_0x5ea3a3);return _0x54c3d6[_0x46e9('0x1f')](_0x46e9('0x20'),_0x3a0d52+'-'+_0x473738+'/'+_0x1761ff)[_0x46e9('0x21')](_0x534e8d);}return null;};}function patchUpdates(_0x63d9b1){return function(_0x290377){try{jsonpatch['apply'](_0x290377,_0x63d9b1,!![]);}catch(_0x1d588f){return BPromise['reject'](_0x1d588f);}return _0x290377['save']();};}function saveUpdates(_0x354759,_0x3e3b54){return function(_0x556698){if(_0x556698){return _0x556698['update'](_0x354759)[_0x46e9('0x22')](function(_0x35ff51){return _0x35ff51;});}return null;};}function removeEntity(_0x5f4f90,_0x221fbc){return function(_0x2db92c){if(_0x2db92c){return _0x2db92c[_0x46e9('0x23')]()[_0x46e9('0x22')](function(){_0x5f4f90[_0x46e9('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4418d1,_0x5c8122){return function(_0x5ea013){if(!_0x5ea013){_0x4418d1[_0x46e9('0x24')](0x194);}return _0x5ea013;};}function handleError(_0x5b2b53,_0x507760){_0x507760=_0x507760||0x1f4;return function(_0x3fe21c){logger['error'](_0x3fe21c['stack']);if(_0x3fe21c[_0x46e9('0x25')]){delete _0x3fe21c[_0x46e9('0x25')];}_0x5b2b53[_0x46e9('0x19')](_0x507760)['send'](_0x3fe21c);};}exports[_0x46e9('0x26')]=function(_0x50cf1b,_0x1e28a1){var _0x453928={},_0x454387={},_0x116324={'count':0x0,'rows':[]};var _0x19c86a=_[_0x46e9('0x27')](db['SmsApplication'][_0x46e9('0x28')],function(_0x4b4889){return{'name':_0x4b4889[_0x46e9('0x29')],'type':_0x4b4889[_0x46e9('0x2a')][_0x46e9('0x2b')]};});_0x454387['model']=_['map'](_0x19c86a,_0x46e9('0x25'));_0x454387[_0x46e9('0x2c')]=_[_0x46e9('0x2d')](_0x50cf1b[_0x46e9('0x2c')]);_0x454387[_0x46e9('0x2e')]=_['intersection'](_0x454387[_0x46e9('0x2f')],_0x454387[_0x46e9('0x2c')]);_0x453928[_0x46e9('0x30')]=_['intersection'](_0x454387[_0x46e9('0x2f')],qs[_0x46e9('0x31')](_0x50cf1b[_0x46e9('0x2c')]['fields']));_0x453928[_0x46e9('0x30')]=_0x453928[_0x46e9('0x30')]['length']?_0x453928['attributes']:_0x454387['model'];if(!_0x50cf1b[_0x46e9('0x2c')][_0x46e9('0x32')](_0x46e9('0x33'))){_0x453928[_0x46e9('0x1d')]=qs[_0x46e9('0x1d')](_0x50cf1b[_0x46e9('0x2c')][_0x46e9('0x1d')]);_0x453928[_0x46e9('0x1b')]=qs[_0x46e9('0x1b')](_0x50cf1b[_0x46e9('0x2c')]['offset']);}_0x453928[_0x46e9('0x34')]=qs[_0x46e9('0x35')](_0x50cf1b['query'][_0x46e9('0x35')]);_0x453928[_0x46e9('0x36')]=qs['filters'](_[_0x46e9('0x37')](_0x50cf1b[_0x46e9('0x2c')],_0x454387['filters']),_0x19c86a);if(_0x50cf1b[_0x46e9('0x2c')][_0x46e9('0x38')]){_0x453928[_0x46e9('0x36')]=_[_0x46e9('0x39')](_0x453928['where'],{'$or':_[_0x46e9('0x27')](_0x19c86a,function(_0x54e9fb){if(_0x54e9fb[_0x46e9('0x2a')]!==_0x46e9('0x3a')){var _0xac0c0d={};_0xac0c0d[_0x54e9fb['name']]={'$like':'%'+_0x50cf1b[_0x46e9('0x2c')][_0x46e9('0x38')]+'%'};return _0xac0c0d;}})});}_0x453928=_[_0x46e9('0x39')]({},_0x453928,_0x50cf1b[_0x46e9('0x3b')]);var _0x4f33d4={'where':_0x453928[_0x46e9('0x36')]};return db[_0x46e9('0x3c')][_0x46e9('0x1e')](_0x4f33d4)[_0x46e9('0x22')](function(_0x2f480b){_0x116324[_0x46e9('0x1e')]=_0x2f480b;if(_0x50cf1b['query']['includeAll']){_0x453928[_0x46e9('0x3d')]=[{'all':!![]}];}return db[_0x46e9('0x3c')]['findAll'](_0x453928);})[_0x46e9('0x22')](function(_0x577fa6){_0x116324[_0x46e9('0x3e')]=_0x577fa6;return _0x116324;})[_0x46e9('0x22')](respondWithFilteredResult(_0x1e28a1,_0x453928))[_0x46e9('0x3f')](handleError(_0x1e28a1,null));};exports['show']=function(_0x57cad7,_0x4a9031){var _0x4f8436={'raw':!![],'where':{'id':_0x57cad7[_0x46e9('0x40')]['id']}},_0x3ef13f={};_0x3ef13f[_0x46e9('0x2f')]=_['keys'](db[_0x46e9('0x3c')][_0x46e9('0x28')]);_0x3ef13f[_0x46e9('0x2c')]=_[_0x46e9('0x2d')](_0x57cad7['query']);_0x3ef13f[_0x46e9('0x2e')]=_['intersection'](_0x3ef13f['model'],_0x3ef13f[_0x46e9('0x2c')]);_0x4f8436['attributes']=_[_0x46e9('0x41')](_0x3ef13f[_0x46e9('0x2f')],qs[_0x46e9('0x31')](_0x57cad7[_0x46e9('0x2c')][_0x46e9('0x31')]));_0x4f8436[_0x46e9('0x30')]=_0x4f8436[_0x46e9('0x30')][_0x46e9('0x42')]?_0x4f8436[_0x46e9('0x30')]:_0x3ef13f[_0x46e9('0x2f')];if(_0x57cad7[_0x46e9('0x2c')]['includeAll']){_0x4f8436[_0x46e9('0x3d')]=[{'all':!![]}];}_0x4f8436=_['merge']({},_0x4f8436,_0x57cad7['options']);return db[_0x46e9('0x3c')][_0x46e9('0x43')](_0x4f8436)[_0x46e9('0x22')](handleEntityNotFound(_0x4a9031,null))['then'](respondWithResult(_0x4a9031,null))[_0x46e9('0x3f')](handleError(_0x4a9031,null));};exports[_0x46e9('0x44')]=function(_0x3ba6d6,_0x4f1670){return db[_0x46e9('0x3c')][_0x46e9('0x44')](_0x3ba6d6[_0x46e9('0x45')],{})[_0x46e9('0x22')](respondWithResult(_0x4f1670,0xc9))[_0x46e9('0x3f')](handleError(_0x4f1670,null));};exports['update']=function(_0x4592a3,_0x165502){if(_0x4592a3[_0x46e9('0x45')]['id']){delete _0x4592a3[_0x46e9('0x45')]['id'];}return db['SmsApplication']['find']({'where':{'id':_0x4592a3[_0x46e9('0x40')]['id']}})[_0x46e9('0x22')](handleEntityNotFound(_0x165502,null))['then'](saveUpdates(_0x4592a3[_0x46e9('0x45')],null))[_0x46e9('0x22')](respondWithResult(_0x165502,null))[_0x46e9('0x3f')](handleError(_0x165502,null));};exports[_0x46e9('0x23')]=function(_0x55d41a,_0x4b7b1a){return db[_0x46e9('0x3c')]['find']({'where':{'id':_0x55d41a['params']['id']}})[_0x46e9('0x22')](handleEntityNotFound(_0x4b7b1a,null))[_0x46e9('0x22')](removeEntity(_0x4b7b1a,null))[_0x46e9('0x3f')](handleError(_0x4b7b1a,null));}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.model.js b/server/api/smsApplication/smsApplication.model.js index a44482e..552d269 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 _0x2f6c=['./smsApplication.attributes','define','SmsApplication','sms_applications','utf8mb4_unicode_ci','util','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x1b1f88,_0x3fe1cb){var _0x5045b9=function(_0x5c1367){while(--_0x5c1367){_0x1b1f88['push'](_0x1b1f88['shift']());}};_0x5045b9(++_0x3fe1cb);}(_0x2f6c,0x1f1));var _0xc2f6=function(_0x323d87,_0x4ef3f9){_0x323d87=_0x323d87-0x0;var _0x5e8f74=_0x2f6c[_0x323d87];return _0x5e8f74;};'use strict';var _=require('lodash');var util=require(_0xc2f6('0x0'));var logger=require(_0xc2f6('0x1'))('api');var moment=require('moment');var BPromise=require(_0xc2f6('0x2'));var rp=require(_0xc2f6('0x3'));var fs=require('fs');var path=require(_0xc2f6('0x4'));var rimraf=require(_0xc2f6('0x5'));var config=require(_0xc2f6('0x6'));var attributes=require(_0xc2f6('0x7'));module['exports']=function(_0x19c6d1,_0x1fbf4b){return _0x19c6d1[_0xc2f6('0x8')](_0xc2f6('0x9'),attributes,{'tableName':_0xc2f6('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xc2f6('0xb')});}; \ No newline at end of file +var _0xdcde=['path','rimraf','../../config/environment','exports','SmsApplication','sms_applications','utf8mb4','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0xdcde,0x8b));var _0xedcd=function(_0x2679c0,_0x2ee8b5){_0x2679c0=_0x2679c0-0x0;var _0x1e54b1=_0xdcde[_0x2679c0];return _0x1e54b1;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xedcd('0x0'))(_0xedcd('0x1'));var moment=require(_0xedcd('0x2'));var BPromise=require(_0xedcd('0x3'));var rp=require(_0xedcd('0x4'));var fs=require('fs');var path=require(_0xedcd('0x5'));var rimraf=require(_0xedcd('0x6'));var config=require(_0xedcd('0x7'));var attributes=require('./smsApplication.attributes');module[_0xedcd('0x8')]=function(_0x3f0d88,_0xb4e2a7){return _0x3f0d88['define'](_0xedcd('0x9'),attributes,{'tableName':_0xedcd('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xedcd('0xb'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.rpc.js b/server/api/smsApplication/smsApplication.rpc.js index 2c7d80e..919d77a 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 _0x457b=['SmsApplication,\x20%s,\x20%s','request\x20sent','debug','SmsApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','info'];(function(_0x294694,_0x1d16b0){var _0x5774c9=function(_0x2ee0bc){while(--_0x2ee0bc){_0x294694['push'](_0x294694['shift']());}};_0x5774c9(++_0x1d16b0);}(_0x457b,0xca));var _0xb457=function(_0x5212bf,_0x51d007){_0x5212bf=_0x5212bf-0x0;var _0x1c426c=_0x457b[_0x5212bf];return _0x1c426c;};'use strict';var _=require(_0xb457('0x0'));var util=require(_0xb457('0x1'));var moment=require('moment');var BPromise=require(_0xb457('0x2'));var rs=require(_0xb457('0x3'));var fs=require('fs');var Redis=require(_0xb457('0x4'));var db=require(_0xb457('0x5'))['db'];var utils=require(_0xb457('0x6'));var logger=require('../../config/logger')(_0xb457('0x7'));var config=require(_0xb457('0x8'));var jayson=require(_0xb457('0x9'));var client=jayson[_0xb457('0xa')][_0xb457('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x523e05,_0x5b8ba2,_0x13632b){return new BPromise(function(_0x2182d6,_0x48388c){return client['request'](_0x523e05,_0x13632b)[_0xb457('0xc')](function(_0x3baee8){logger[_0xb457('0xd')](_0xb457('0xe'),_0x5b8ba2,_0xb457('0xf'));logger[_0xb457('0x10')](_0xb457('0x11'),_0x5b8ba2,_0xb457('0xf'),JSON[_0xb457('0x12')](_0x3baee8));if(_0x3baee8[_0xb457('0x13')]){if(_0x3baee8[_0xb457('0x13')][_0xb457('0x14')]===0x1f4){logger['error']('SmsApplication,\x20%s,\x20%s',_0x5b8ba2,_0x3baee8[_0xb457('0x13')][_0xb457('0x15')]);return _0x48388c(_0x3baee8[_0xb457('0x13')][_0xb457('0x15')]);}logger[_0xb457('0x13')]('SmsApplication,\x20%s,\x20%s',_0x5b8ba2,_0x3baee8['error'][_0xb457('0x15')]);return _0x2182d6(_0x3baee8[_0xb457('0x13')][_0xb457('0x15')]);}else{logger[_0xb457('0xd')]('SmsApplication,\x20%s,\x20%s',_0x5b8ba2,_0xb457('0xf'));_0x2182d6(_0x3baee8[_0xb457('0x16')][_0xb457('0x15')]);}})[_0xb457('0x17')](function(_0x250a02){logger[_0xb457('0x13')](_0xb457('0xe'),_0x5b8ba2,_0x250a02);_0x48388c(_0x250a02);});});} \ No newline at end of file +var _0x56b9=['moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','then','info','SmsApplication,\x20%s,\x20%s','debug','SmsApplication,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util'];(function(_0x36f47e,_0x1d85cd){var _0x4e6a98=function(_0x2e4935){while(--_0x2e4935){_0x36f47e['push'](_0x36f47e['shift']());}};_0x4e6a98(++_0x1d85cd);}(_0x56b9,0x196));var _0x956b=function(_0x98f6aa,_0x189da0){_0x98f6aa=_0x98f6aa-0x0;var _0x25b7da=_0x56b9[_0x98f6aa];return _0x25b7da;};'use strict';var _=require(_0x956b('0x0'));var util=require(_0x956b('0x1'));var moment=require(_0x956b('0x2'));var BPromise=require(_0x956b('0x3'));var rs=require(_0x956b('0x4'));var fs=require('fs');var Redis=require(_0x956b('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x956b('0x6'));var logger=require('../../config/logger')(_0x956b('0x7'));var config=require(_0x956b('0x8'));var jayson=require(_0x956b('0x9'));var client=jayson['client'][_0x956b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3d40b0,_0x322012,_0x2683d8){return new BPromise(function(_0x222eae,_0x299c94){return client[_0x956b('0xb')](_0x3d40b0,_0x2683d8)[_0x956b('0xc')](function(_0x5e0388){logger[_0x956b('0xd')](_0x956b('0xe'),_0x322012,'request\x20sent');logger[_0x956b('0xf')](_0x956b('0x10'),_0x322012,_0x956b('0x11'),JSON[_0x956b('0x12')](_0x5e0388));if(_0x5e0388[_0x956b('0x13')]){if(_0x5e0388['error'][_0x956b('0x14')]===0x1f4){logger[_0x956b('0x13')](_0x956b('0xe'),_0x322012,_0x5e0388[_0x956b('0x13')][_0x956b('0x15')]);return _0x299c94(_0x5e0388[_0x956b('0x13')][_0x956b('0x15')]);}logger[_0x956b('0x13')](_0x956b('0xe'),_0x322012,_0x5e0388[_0x956b('0x13')][_0x956b('0x15')]);return _0x222eae(_0x5e0388['error'][_0x956b('0x15')]);}else{logger[_0x956b('0xd')](_0x956b('0xe'),_0x322012,'request\x20sent');_0x222eae(_0x5e0388[_0x956b('0x16')][_0x956b('0x15')]);}})[_0x956b('0x17')](function(_0x3cc1b7){logger[_0x956b('0x13')](_0x956b('0xe'),_0x322012,_0x3cc1b7);_0x299c94(_0x3cc1b7);});});} \ No newline at end of file diff --git a/server/api/smsInteraction/index.js b/server/api/smsInteraction/index.js index ffffc74..8105239 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 _0x9354=['/:id/messages','getMessages','download','create','post','addMessage','/:id/tags','tracked','sms','smsinteraction:addtags','addTags','put','smsinteraction:update','update','delete','smsinteraction:destroy','destroy','removeTags','util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./smsInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id','show'];(function(_0x15834d,_0x1feb94){var _0xfe2fa9=function(_0x173246){while(--_0x173246){_0x15834d['push'](_0x15834d['shift']());}};_0xfe2fa9(++_0x1feb94);}(_0x9354,0x96));var _0x4935=function(_0x254081,_0x20731a){_0x254081=_0x254081-0x0;var _0x5d1e2a=_0x9354[_0x254081];return _0x5d1e2a;};'use strict';var multer=require('multer');var util=require(_0x4935('0x0'));var path=require(_0x4935('0x1'));var timeout=require('connect-timeout');var express=require(_0x4935('0x2'));var router=express[_0x4935('0x3')]();var fs_extra=require(_0x4935('0x4'));var auth=require(_0x4935('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x4935('0x6'));var controller=require(_0x4935('0x7'));router[_0x4935('0x8')]('/',auth[_0x4935('0x9')](),controller[_0x4935('0xa')]);router[_0x4935('0x8')](_0x4935('0xb'),auth[_0x4935('0x9')](),controller[_0x4935('0xc')]);router['get'](_0x4935('0xd'),auth['isAuthenticated'](),controller[_0x4935('0xe')]);router[_0x4935('0x8')](_0x4935('0xf'),auth[_0x4935('0x9')](),controller[_0x4935('0x10')]);router[_0x4935('0x8')]('/:id/download',auth['isAuthenticated'](),controller[_0x4935('0x11')]);router['post']('/',auth['isAuthenticated'](),controller[_0x4935('0x12')]);router[_0x4935('0x13')](_0x4935('0xf'),auth[_0x4935('0x9')](),controller[_0x4935('0x14')]);router[_0x4935('0x13')](_0x4935('0x15'),auth[_0x4935('0x9')](),interaction[_0x4935('0x16')](_0x4935('0x17'),_0x4935('0x18')),controller[_0x4935('0x19')]);router[_0x4935('0x1a')](_0x4935('0xd'),auth[_0x4935('0x9')](),interaction[_0x4935('0x16')]('sms',_0x4935('0x1b')),controller[_0x4935('0x1c')]);router[_0x4935('0x1d')](_0x4935('0xd'),auth[_0x4935('0x9')](),interaction[_0x4935('0x16')]('sms',_0x4935('0x1e')),controller[_0x4935('0x1f')]);router['delete'](_0x4935('0x15'),auth[_0x4935('0x9')](),controller[_0x4935('0x20')]);module['exports']=router; \ No newline at end of file +var _0xed3c=['sms','smsinteraction:addtags','addTags','put','tracked','smsinteraction:update','update','delete','/:id','smsinteraction:destroy','destroy','/:id/tags','removeTags','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','./smsInteraction.controller','get','isAuthenticated','index','describe','show','/:id/messages','getMessages','/:id/download','download','create','post','addMessage'];(function(_0x3aac23,_0x4b5a92){var _0x4d0f6a=function(_0x5156a1){while(--_0x5156a1){_0x3aac23['push'](_0x3aac23['shift']());}};_0x4d0f6a(++_0x4b5a92);}(_0xed3c,0x1a6));var _0xced3=function(_0x51ed46,_0x4b7ad2){_0x51ed46=_0x51ed46-0x0;var _0xc2b1e7=_0xed3c[_0x51ed46];return _0xc2b1e7;};'use strict';var multer=require(_0xced3('0x0'));var util=require(_0xced3('0x1'));var path=require(_0xced3('0x2'));var timeout=require(_0xced3('0x3'));var express=require('express');var router=express[_0xced3('0x4')]();var fs_extra=require(_0xced3('0x5'));var auth=require(_0xced3('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xced3('0x7'));router[_0xced3('0x8')]('/',auth[_0xced3('0x9')](),controller[_0xced3('0xa')]);router['get']('/describe',auth['isAuthenticated'](),controller[_0xced3('0xb')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0xced3('0xc')]);router[_0xced3('0x8')](_0xced3('0xd'),auth[_0xced3('0x9')](),controller[_0xced3('0xe')]);router['get'](_0xced3('0xf'),auth[_0xced3('0x9')](),controller[_0xced3('0x10')]);router['post']('/',auth[_0xced3('0x9')](),controller[_0xced3('0x11')]);router[_0xced3('0x12')](_0xced3('0xd'),auth[_0xced3('0x9')](),controller[_0xced3('0x13')]);router[_0xced3('0x12')]('/:id/tags',auth[_0xced3('0x9')](),interaction['tracked'](_0xced3('0x14'),_0xced3('0x15')),controller[_0xced3('0x16')]);router[_0xced3('0x17')]('/:id',auth[_0xced3('0x9')](),interaction[_0xced3('0x18')]('sms',_0xced3('0x19')),controller[_0xced3('0x1a')]);router[_0xced3('0x1b')](_0xced3('0x1c'),auth['isAuthenticated'](),interaction[_0xced3('0x18')]('sms',_0xced3('0x1d')),controller[_0xced3('0x1e')]);router[_0xced3('0x1b')](_0xced3('0x1f'),auth[_0xced3('0x9')](),controller[_0xced3('0x20')]);module[_0xced3('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 1b5c627..79099be 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 _0x81d4=['BOOLEAN','moment','exports','DATE','STRING','ENUM','out'];(function(_0x2a08df,_0x116e0d){var _0x583bd3=function(_0x4fd8c8){while(--_0x4fd8c8){_0x2a08df['push'](_0x2a08df['shift']());}};_0x583bd3(++_0x116e0d);}(_0x81d4,0x197));var _0x481d=function(_0x237f3c,_0x3b2b04){_0x237f3c=_0x237f3c-0x0;var _0x10de6f=_0x81d4[_0x237f3c];return _0x10de6f;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x481d('0x0'));module[_0x481d('0x1')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x481d('0x2')]},'disposition':{'type':Sequelize[_0x481d('0x3')]},'secondDisposition':{'type':Sequelize[_0x481d('0x3')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0x481d('0x3')]},'read1stAt':{'type':Sequelize[_0x481d('0x2')]},'firstMsgDirection':{'type':Sequelize[_0x481d('0x4')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x481d('0x2')]},'lastMsgDirection':{'type':Sequelize[_0x481d('0x4')]('in',_0x481d('0x5')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x481d('0x6')],'defaultValue':![]}}; \ No newline at end of file +var _0x933c=['out','sequelize','moment','exports','BOOLEAN','DATE','STRING','ENUM'];(function(_0x533524,_0x39b2d2){var _0x7be805=function(_0x52a4d0){while(--_0x52a4d0){_0x533524['push'](_0x533524['shift']());}};_0x7be805(++_0x39b2d2);}(_0x933c,0x99));var _0xc933=function(_0x1939b8,_0x2d907c){_0x1939b8=_0x1939b8-0x0;var _0x5a6328=_0x933c[_0x1939b8];return _0x5a6328;};'use strict';var Sequelize=require(_0xc933('0x0'));var moment=require(_0xc933('0x1'));module[_0xc933('0x2')]={'closed':{'type':Sequelize[_0xc933('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xc933('0x4')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0xc933('0x5')]},'note':{'type':Sequelize[_0xc933('0x5')]},'phone':{'type':Sequelize[_0xc933('0x5')]},'read1stAt':{'type':Sequelize[_0xc933('0x4')]},'firstMsgDirection':{'type':Sequelize[_0xc933('0x6')]('in',_0xc933('0x7')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0xc933('0x6')]('in','out'),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0xc933('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 e70feb0..4bcdc3b 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 _0x779b=['Sequelize','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','t.id\x20IN\x20?','resolve','i.SmsAccountId\x20IS\x20NOT\x20NULL','user','role','agent','i.SmsAccountId\x20IS\x20NULL','sequelize','toString','merge','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','contactName','c.firstName','c.lastName','Contact.lastName','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','groupBy','SmsInteractionId','rows','show','rawAttributes','intersection','includeAll','create','describe','SmsMessage','params','addMessage','getMessages','findOne','nolimit','pick','format','YYYY-MM-DD\x20HH:mm:ss','options','include','findAll','addTags','setTags','ids','emit','removeTags','unix','join','root','server','files','tmp','attachments','CmContact','firstName','lastName','Messages','secret','get','mkdirSync','Sms','Owner','N.A.','closedAt','disposition','out','System','direction','renderFile','views','downloadInteraction.ejs','.pdf','createPdfFromHTML','download','log','err','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','path','sox','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../components/export/pdf','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','defaults','redis','localhost','./smsInteraction.socket','sendStatus','end','json','offset','undefined','count','limit','status','set','Content-Range','apply','reject','save','update','then','destroy','error','name','map','fullname','TagIds','forEach','Tags','push','catch','answered','total','closed','waiting','UserId','talking','unmanaged','index','SmsInteraction','fieldName','type','key','model','query','keys','filters','fields','attributes','hasOwnProperty','order','sort','where','select','field','color','tools_tags','u.id','u.fullname','ui.SmsInteractionId','from','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','a.id\x20=\x20i.SmsAccountId','sms_messages','me.SmsInteractionId\x20=\x20i.id','sms_interaction_has_tags','it.SmsInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','length','find','unreadMessages','value','having','`\x20=\x200','`\x20>\x200','Contact','split','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','text','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','User','operator','$substring','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','body','buildExpression','some','compact','isEmpty','SmsAccountId','i.SmsAccountId\x20IN\x20?','concat','createdAt','parse','$gte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','filter','replace','isNumeric','i.id\x20LIKE\x20?','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'];(function(_0x1422bd,_0x3dbde0){var _0x2f4558=function(_0x4dbfaf){while(--_0x4dbfaf){_0x1422bd['push'](_0x1422bd['shift']());}};_0x2f4558(++_0x3dbde0);}(_0x779b,0x14d));var _0xb779=function(_0x3c587d,_0x36898a){_0x3c587d=_0x3c587d-0x0;var _0x5244f7=_0x779b[_0x3c587d];return _0x5244f7;};'use strict';var emlformat=require(_0xb779('0x0'));var rimraf=require(_0xb779('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb779('0x2'));var rp=require('request-promise');var moment=require(_0xb779('0x3'));var BPromise=require(_0xb779('0x4'));var Mustache=require(_0xb779('0x5'));var util=require('util');var path=require(_0xb779('0x6'));var sox=require(_0xb779('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb779('0x8'));var _=require('lodash');var squel=require(_0xb779('0x9'));var crypto=require(_0xb779('0xa'));var jsforce=require(_0xb779('0xb'));var deskjs=require(_0xb779('0xc'));var toCsv=require(_0xb779('0xd'));var querystring=require(_0xb779('0xe'));var Papa=require(_0xb779('0xf'));var Redis=require(_0xb779('0x10'));var authService=require(_0xb779('0x11'));var qs=require(_0xb779('0x12'));var as=require(_0xb779('0x13'));var pdf=require(_0xb779('0x14'));var hardwareService=require(_0xb779('0x15'));var logger=require(_0xb779('0x16'))('api');var utils=require(_0xb779('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xb779('0x18'))['db'];config['redis']=_[_0xb779('0x19')](config[_0xb779('0x1a')],{'host':_0xb779('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xb779('0x1a')]));require(_0xb779('0x1c'))['register'](socket);function respondWithStatusCode(_0xc0e596,_0x19d96a){_0x19d96a=_0x19d96a||0xcc;return function(_0x4fdfbf){if(_0x4fdfbf){return _0xc0e596[_0xb779('0x1d')](_0x19d96a);}return _0xc0e596['status'](_0x19d96a)[_0xb779('0x1e')]();};}function respondWithResult(_0x24bf0c,_0xfd3256){_0xfd3256=_0xfd3256||0xc8;return function(_0x19f94f){if(_0x19f94f){return _0x24bf0c['status'](_0xfd3256)[_0xb779('0x1f')](_0x19f94f);}};}function respondWithFilteredResult(_0x2d4c77,_0x439ecf){return function(_0x4f18ff){if(_0x4f18ff){var _0x4d84e6=typeof _0x439ecf[_0xb779('0x20')]===_0xb779('0x21')&&typeof _0x439ecf['limit']===_0xb779('0x21');var _0x512b9c=_0x4f18ff['count'];var _0x1207d4=_0x4d84e6?0x0:_0x439ecf['offset'];var _0x3d8163=_0x4d84e6?_0x4f18ff[_0xb779('0x22')]:_0x439ecf['offset']+_0x439ecf[_0xb779('0x23')];var _0x52b379;if(_0x3d8163>=_0x512b9c){_0x3d8163=_0x512b9c;_0x52b379=0xc8;}else{_0x52b379=0xce;}_0x2d4c77[_0xb779('0x24')](_0x52b379);return _0x2d4c77[_0xb779('0x25')](_0xb779('0x26'),_0x1207d4+'-'+_0x3d8163+'/'+_0x512b9c)[_0xb779('0x1f')](_0x4f18ff);}return null;};}function patchUpdates(_0xf48142){return function(_0x1df998){try{jsonpatch[_0xb779('0x27')](_0x1df998,_0xf48142,!![]);}catch(_0xe2c957){return BPromise[_0xb779('0x28')](_0xe2c957);}return _0x1df998[_0xb779('0x29')]();};}function saveUpdates(_0x420bad,_0x3f86cc){return function(_0x2e23de){if(_0x2e23de){return _0x2e23de[_0xb779('0x2a')](_0x420bad)[_0xb779('0x2b')](function(_0x15693f){return _0x15693f;});}return null;};}function removeEntity(_0x599699,_0x379ebe){return function(_0x3d3401){if(_0x3d3401){return _0x3d3401[_0xb779('0x2c')]()[_0xb779('0x2b')](function(){_0x599699['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x29f928,_0x163d54){return function(_0x5324d9){if(!_0x5324d9){_0x29f928[_0xb779('0x1d')](0x194);}return _0x5324d9;};}function handleError(_0x14c69c,_0x381f50){_0x381f50=_0x381f50||0x1f4;return function(_0x139cd9){logger[_0xb779('0x2d')](_0x139cd9['stack']);if(_0x139cd9[_0xb779('0x2e')]){delete _0x139cd9[_0xb779('0x2e')];}_0x14c69c[_0xb779('0x24')](_0x381f50)['send'](_0x139cd9);};}function getInteractionUsers(_0x11f2b0,_0x315cbc){return new BPromise(function(_0x5afea4,_0x30419f){try{if(_0x315cbc[_0x11f2b0['id']]){_0x11f2b0['Users']=_[_0xb779('0x2f')](_0x315cbc[_0x11f2b0['id']],function(_0x359153){return{'id':_0x359153['id'],'fullname':_0x359153[_0xb779('0x30')]};});}}catch(_0x4cc337){_0x30419f(_0x4cc337);}_0x5afea4(_0x11f2b0);});}function getInteractionTags(_0x1c355f,_0x114822){return new BPromise(function(_0x42da9b,_0xb55bd4){try{if(_0x1c355f[_0xb779('0x31')]){_0x1c355f['Tags']=[];_0x1c355f[_0xb779('0x31')]['split'](',')[_0xb779('0x32')](function(_0x54b354){_0x1c355f[_0xb779('0x33')][_0xb779('0x34')](_0x114822[_0x54b354]);});}delete _0x1c355f[_0xb779('0x31')];}catch(_0x3c4842){_0xb55bd4(_0x3c4842);}_0x42da9b(_0x1c355f);});}function updateSmsInteraction(_0x635881,_0x35b9e6,_0x575d94){return new BPromise(function(_0x4dddef,_0x462ca6){return getInteractionUsers(_0x635881,_0x575d94)[_0xb779('0x2b')](function(_0x154855){return getInteractionTags(_0x154855,_0x35b9e6);})[_0xb779('0x2b')](function(_0xbaa4dc){return getStateInteraction(_0xbaa4dc);})[_0xb779('0x2b')](function(_0x4c7309){_0x4dddef(_0x4c7309);})[_0xb779('0x35')](function(_0x21c99f){_0x462ca6(_0x21c99f);});});}function getStateInteraction(_0x180f1c){return new BPromise(function(_0x3a8a32){_0x180f1c['waiting']=0x0;_0x180f1c['talking']=0x0;_0x180f1c[_0xb779('0x36')]=0x0;_0x180f1c['unmanaged']=0x0;_0x180f1c[_0xb779('0x37')]=0x0;if(!_0x180f1c[_0xb779('0x38')]&&!_0x180f1c['UserId']){_0x180f1c[_0xb779('0x39')]+=0x1;}if(!_0x180f1c[_0xb779('0x38')]&&_0x180f1c[_0xb779('0x3a')]){_0x180f1c[_0xb779('0x3b')]+=0x1;if(_0x180f1c[_0xb779('0x39')]){_0x180f1c[_0xb779('0x39')]-=0x1;}}if(_0x180f1c[_0xb779('0x38')]&&_0x180f1c[_0xb779('0x3a')]){_0x180f1c[_0xb779('0x36')]+=0x1;if(_0x180f1c[_0xb779('0x3b')]){_0x180f1c['talking']-=0x1;}}if(_0x180f1c[_0xb779('0x38')]&&!_0x180f1c['UserId']){_0x180f1c[_0xb779('0x3c')]+=0x1;if(_0x180f1c[_0xb779('0x39')]){_0x180f1c[_0xb779('0x39')]-=0x1;}}_0x180f1c[_0xb779('0x37')]+=0x1;_0x3a8a32(_0x180f1c);});}exports[_0xb779('0x3d')]=function(_0x30ce1b,_0x461597){var _0xee46f0={},_0x2f7b5c={},_0x23ef19={'count':0x0,'rows':[]};var _0x3fd416=_[_0xb779('0x2f')](db[_0xb779('0x3e')]['rawAttributes'],function(_0x2f900a){return{'name':_0x2f900a[_0xb779('0x3f')],'type':_0x2f900a[_0xb779('0x40')][_0xb779('0x41')]};});_0x2f7b5c[_0xb779('0x42')]=_[_0xb779('0x2f')](_0x3fd416,_0xb779('0x2e'));_0x2f7b5c[_0xb779('0x43')]=_[_0xb779('0x44')](_0x30ce1b['query']);_0x2f7b5c[_0xb779('0x45')]=_['intersection'](_0x2f7b5c['model'],_0x2f7b5c[_0xb779('0x43')]);_0xee46f0['attributes']=_['intersection'](_0x2f7b5c[_0xb779('0x42')],qs[_0xb779('0x46')](_0x30ce1b['query'][_0xb779('0x46')]));_0xee46f0['attributes']=_0xee46f0[_0xb779('0x47')]['length']?_0xee46f0[_0xb779('0x47')]:_0x2f7b5c[_0xb779('0x42')];if(!_0x30ce1b['query'][_0xb779('0x48')]('nolimit')){_0xee46f0['limit']=qs[_0xb779('0x23')](_0x30ce1b['query'][_0xb779('0x23')]);_0xee46f0[_0xb779('0x20')]=qs[_0xb779('0x20')](_0x30ce1b[_0xb779('0x43')][_0xb779('0x20')]);}_0xee46f0[_0xb779('0x49')]=qs[_0xb779('0x4a')](_0x30ce1b['query'][_0xb779('0x4a')]);_0xee46f0[_0xb779('0x4b')]=qs['filters'](_['pick'](_0x30ce1b['query'],_0x2f7b5c[_0xb779('0x45')]),_0x3fd416);var _0x23f8b3=[];var _0x20790b=squel[_0xb779('0x4c')]()[_0xb779('0x4d')]('id')[_0xb779('0x4d')]('name')['field'](_0xb779('0x4e'))['from'](_0xb779('0x4f'));var _0x51f5f0=squel['select']()[_0xb779('0x4d')](_0xb779('0x50'))[_0xb779('0x4d')](_0xb779('0x51'))[_0xb779('0x4d')](_0xb779('0x52'))[_0xb779('0x53')](_0xb779('0x54'),'ui')[_0xb779('0x55')](_0xb779('0x56'),'u','u.id\x20=\x20ui.UserId');var _0x1d0fc=squel['select']()[_0xb779('0x53')](_0xb779('0x57'),'i')['left_join'](_0xb779('0x58'),'c',_0xb779('0x59'))['left_join']('users','o',_0xb779('0x5a'))[_0xb779('0x55')](_0xb779('0x5b'),'a',_0xb779('0x5c'))[_0xb779('0x55')](_0xb779('0x5d'),'me',_0xb779('0x5e'))[_0xb779('0x55')](_0xb779('0x5f'),'it',_0xb779('0x60'))['left_join'](_0xb779('0x4f'),'t',_0xb779('0x61'));var _0x30c913=squel['expr']();var _0x32f33d=[];var _0x1bd7e2=squel[_0xb779('0x62')]();var _0x1857af;if(_0x30ce1b['query'][_0xb779('0x63')]){_0x1857af=as[_0xb779('0x64')](_0x30ce1b[_0xb779('0x43')][_0xb779('0x63')]);var _0xbd26b6=_0x1857af[_0xb779('0x65')];for(var _0x441016=0x0;_0x441016<_0x1857af[_0xb779('0x66')][_0xb779('0x67')];_0x441016++){var _0x3d00cf=_0x1857af[_0xb779('0x66')][_0x441016];var _0x4c2766='i';var _0x28bf90=_[_0xb779('0x68')](_0x3fd416,['name',_0x3d00cf[_0xb779('0x4d')]]);if(!_0x28bf90){switch(_0x3d00cf[_0xb779('0x4d')]){case _0xb779('0x69'):if(_0x3d00cf[_0xb779('0x6a')]==0x1){_0x1d0fc[_0xb779('0x6b')]('`'+_0x3d00cf[_0xb779('0x4d')]+_0xb779('0x6c'));}else{_0x1d0fc[_0xb779('0x6b')]('`'+_0x3d00cf['field']+_0xb779('0x6d'));}break;case _0xb779('0x6e'):if(_0x3d00cf['operator']==='$substring'){if(_0x3d00cf['value'][_0xb779('0x6f')]('\x20')[_0xb779('0x67')]>0x1){_0x30c913[_0xbd26b6](_0xb779('0x70'),qs['getFullTextValue'](_0x3d00cf['value']),null);}else{var _0x3d5ec0='%'+_0x3d00cf['value']+'%';_0x30c913[_0xbd26b6](_0xb779('0x71'),_0x3d5ec0,_0x3d5ec0,_0x3d5ec0);}}else{_0x28bf90=_[_0xb779('0x68')](_0x3fd416,[_0xb779('0x2e'),_0xb779('0x72')]);_0x3d00cf[_0xb779('0x4d')]='ContactId';_0x131e6d=as['buildExpression'](_0x4c2766,_0x28bf90['type'],_0x3d00cf);_0x30c913[_0xbd26b6](_0x131e6d[_0xb779('0x73')],_0x131e6d['value'][_0xb779('0x74')],_0x131e6d[_0xb779('0x6a')]['end']);}break;case _0xb779('0x75'):var _0x5b2855=_0x3d00cf[_0xb779('0x6a')][_0xb779('0x6f')](',')['map'](function(_0x3a230e){return Number(_0x3a230e);});_0x5b2855[_0xb779('0x32')](function(_0x5ce835){_0x1bd7e2['or'](_0xb779('0x76'),'%,'+_0x5ce835+',%');});_0x32f33d=_['union'](_0x32f33d,_0x5b2855);break;case _0xb779('0x77'):if(_0x3d00cf[_0xb779('0x78')]===_0xb779('0x79')){_0x30c913[_0xbd26b6](_0xb779('0x7a'),'%'+_0x3d00cf[_0xb779('0x6a')]+'%',null);}else{_0x28bf90=_[_0xb779('0x68')](_0x3fd416,['name',_0xb779('0x3a')]);_0x3d00cf[_0xb779('0x4d')]=_0xb779('0x3a');_0x131e6d=as['buildExpression'](_0x4c2766,_0x28bf90['type'],_0x3d00cf);_0x30c913[_0xbd26b6](_0x131e6d['text'],_0x131e6d[_0xb779('0x6a')][_0xb779('0x74')],_0x131e6d[_0xb779('0x6a')][_0xb779('0x1e')]);}break;case _0xb779('0x7b'):_0x131e6d=as[_0xb779('0x7c')]('me',null,_0x3d00cf);_0x30c913[_0xbd26b6](_0x131e6d[_0xb779('0x73')],_0x131e6d['value'][_0xb779('0x74')],_0x131e6d[_0xb779('0x6a')][_0xb779('0x1e')]);break;}}else{var _0x131e6d=as[_0xb779('0x7c')](_0x4c2766,_0x28bf90[_0xb779('0x40')],_0x3d00cf);_0x30c913[_0xbd26b6](_0x131e6d[_0xb779('0x73')],_0x131e6d[_0xb779('0x6a')][_0xb779('0x74')],_0x131e6d['value'][_0xb779('0x1e')]);}}}else{var _0x27ac2e=_(_0x30ce1b[_0xb779('0x43')])[_0xb779('0x44')]()['map'](function(_0xe5a8f2){return _[_0xb779('0x7d')](_0x3fd416,['name',_0xe5a8f2])?_0xe5a8f2:undefined;})[_0xb779('0x7e')]()[_0xb779('0x6a')]();if(!_[_0xb779('0x7f')](_0x27ac2e)){_0x27ac2e[_0xb779('0x32')](function(_0x4ab485){if(_0x4ab485===_0xb779('0x80')){_0x1d0fc[_0xb779('0x4b')](_0xb779('0x81'),[][_0xb779('0x82')](_0x30ce1b[_0xb779('0x43')][_0x4ab485]));}else if(_0x4ab485===_0xb779('0x83')){var _0xe77a4a=JSON[_0xb779('0x84')](_0x30ce1b[_0xb779('0x43')][_0x4ab485])[_0xb779('0x85')];var _0x318ac7=JSON[_0xb779('0x84')](_0x30ce1b[_0xb779('0x43')][_0x4ab485])['$lte'];_0x1d0fc[_0xb779('0x4b')](_0xb779('0x86'),_0xe77a4a,_0x318ac7);}else{if(_0x30ce1b[_0xb779('0x43')][_0x4ab485]===_0xb779('0x87')){_0x1d0fc['where']('i.'+_0x4ab485+_0xb779('0x88'));}else{_0x1d0fc[_0xb779('0x4b')]('i.'+_0x4ab485+_0xb779('0x89'),_0x30ce1b[_0xb779('0x43')][_0x4ab485]);}}});}if(_0x30ce1b[_0xb779('0x43')][_0xb779('0x8a')]){if(_0x30ce1b[_0xb779('0x43')][_0xb779('0x8a')]==0x1){_0x1d0fc[_0xb779('0x6b')](_0xb779('0x8b'));}else{_0x1d0fc[_0xb779('0x6b')](_0xb779('0x8c'));}}if(_0x30ce1b[_0xb779('0x43')][_0xb779('0x8d')]){_0x32f33d=_['isArray'](_0x30ce1b['query'][_0xb779('0x8d')])?_0x30ce1b[_0xb779('0x43')][_0xb779('0x8d')]:new Array(_0x30ce1b[_0xb779('0x43')]['tag']);_0x32f33d[_0xb779('0x32')](function(_0x4d9753){_0x1bd7e2['or'](_0xb779('0x76'),'%,'+_0x4d9753+',%');});}if(_0x30ce1b[_0xb779('0x43')][_0xb779('0x8e')]){var _0xcedaa2=_0x30ce1b[_0xb779('0x43')]['filter'][_0xb779('0x8f')]('\x5c','\x5c\x5c')[_0xb779('0x8f')](/'/g,'\x27\x27');if(qs[_0xb779('0x90')](_0xcedaa2)){_0x30c913['or'](_0xb779('0x91'),_0xcedaa2+'%')['or'](_0xb779('0x92'),_0xcedaa2+'%');}else{_0x30c913['or'](_0xb779('0x93'),qs['getFullTextValue'](_0xcedaa2))['or'](_0xb779('0x94'),_0xcedaa2+'%');}}}_0x1d0fc[_0xb779('0x4b')](_0x30c913);_0x1d0fc[_0xb779('0x95')](_0xb779('0x96'));var _0x2d213a={'type':db[_0xb779('0x97')][_0xb779('0x98')][_0xb779('0x99')],'raw':!![]};var _0x63c282=_0x1d0fc[_0xb779('0x9a')]();_0x63c282[_0xb779('0x4d')](_0xb779('0x96'));_0x63c282[_0xb779('0x4d')](_0xb779('0x9b'),_0xb779('0x69'));if(_0xee46f0[_0xb779('0x49')]){_0xee46f0[_0xb779('0x49')][_0xb779('0x32')](function(_0x39679a){var _0xfb590f=_0x39679a[0x0]==='contactName'?_0x39679a[0x0]:'i.'+_0x39679a[0x0];_0x1d0fc['order'](_0xfb590f,_0x39679a[0x1]==='DESC'?![]:!![]);});}if(!_['isEmpty'](_0x32f33d)){_0x1d0fc[_0xb779('0x6b')](_0x1bd7e2);_0x63c282[_0xb779('0x4b')](_0xb779('0x9c'),_0x32f33d);}BPromise[_0xb779('0x9d')]()['then'](function(){if(!_0x1857af){if(_0x30ce1b['query']['SmsAccountId'])return;_0x63c282['where'](_0xb779('0x9e'));_0x1d0fc['where'](_0xb779('0x9e'));return;}if(_0x30ce1b[_0xb779('0x9f')][_0xb779('0xa0')]!==_0xb779('0xa1'))return;return _0x30ce1b[_0xb779('0x9f')]['getSmsAccounts']({'attributes':['id'],'raw':!![]})['then'](function(_0x4d6f28){if(_[_0xb779('0x7f')](_0x4d6f28)){_0x63c282['where'](_0xb779('0xa2'));_0x1d0fc[_0xb779('0x4b')](_0xb779('0xa2'));}else{_0x63c282[_0xb779('0x4b')](_0xb779('0x81'),_[_0xb779('0x2f')](_0x4d6f28,'id'));_0x1d0fc['where']('i.SmsAccountId\x20IN\x20?',_[_0xb779('0x2f')](_0x4d6f28,'id'));}});})[_0xb779('0x2b')](function(){if(_0x30ce1b['user'][_0xb779('0xa0')]===_0xb779('0xa1')&&!_0x1857af&&!_0x30ce1b[_0xb779('0x43')][_0xb779('0x80')])return[];return db['sequelize'][_0xb779('0x43')](_0x63c282['toString'](),_0x2d213a);})[_0xb779('0x2b')](function(_0x1afd9d){_0x23ef19[_0xb779('0x22')]=_0x1afd9d['length'];if(_0x23ef19[_0xb779('0x22')]===0x0)return[];return db[_0xb779('0xa3')]['query'](_0x20790b[_0xb779('0xa4')](),_0x2d213a)[_0xb779('0x2b')](function(_0x3185b9){_0x23f8b3=_['keyBy'](_0x3185b9,'id');_0x2d213a=_[_0xb779('0xa5')](_0x2d213a,{'model':db[_0xb779('0x3e')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x30ce1b[_0xb779('0x43')][_0xb779('0x46')]){_0xee46f0[_0xb779('0x47')]['forEach'](function(_0x15b9ac){_0x1d0fc[_0xb779('0x4d')]('i.'+_0x15b9ac);});}else{_0x1d0fc[_0xb779('0x4d')](_0xb779('0x9b'),_0xb779('0x69'));_0x1d0fc[_0xb779('0x4d')](_0xb779('0xa6'),_0xb779('0xa7'));_0x1d0fc[_0xb779('0x4d')](_0xb779('0xa8'),_0xb779('0xa9'));_0x1d0fc[_0xb779('0x4d')](_0xb779('0xaa'),_0xb779('0xab'));_0x1d0fc[_0xb779('0x4d')]('i.*');_0x1d0fc[_0xb779('0x4d')](_0xb779('0xac'),'Contact.firstName');_0x1d0fc[_0xb779('0x4d')](_0xb779('0xad'),_0xb779('0xae'));_0x1d0fc[_0xb779('0x4d')]('c.email',_0xb779('0xaf'));_0x1d0fc[_0xb779('0x4d')](_0xb779('0xb0'),_0xb779('0xb1'));_0x1d0fc[_0xb779('0x4d')](_0xb779('0xb2'),_0xb779('0xb3'));_0x1d0fc[_0xb779('0x4d')](_0xb779('0xb4'),_0xb779('0xb5'));_0x1d0fc[_0xb779('0x4d')]('o.fullname',_0xb779('0xb6'));_0x1d0fc['field'](_0xb779('0xb7'),_0xb779('0xb8'));_0x1d0fc[_0xb779('0x4d')](_0xb779('0xb9'),'TagIds');}if(_0xee46f0[_0xb779('0x23')])_0x1d0fc[_0xb779('0x23')](_0xee46f0[_0xb779('0x23')]);if(_0xee46f0[_0xb779('0x20')])_0x1d0fc[_0xb779('0x20')](_0xee46f0[_0xb779('0x20')]);return db[_0xb779('0xa3')][_0xb779('0x43')](_0x1d0fc[_0xb779('0xa4')](),_0x2d213a);})[_0xb779('0x2b')](function(_0x5c8f68){if(_0x5c8f68[_0xb779('0x67')]>0x0)_0x51f5f0[_0xb779('0x4b')]('ui.SmsInteractionId\x20IN\x20?',_[_0xb779('0x2f')](_0x5c8f68,'id'));return db['sequelize'][_0xb779('0x43')](_0x51f5f0['toString'](),_0x2d213a)[_0xb779('0x2b')](function(_0x296ca0){var _0x5ba36f=_[_0xb779('0xba')](_0x296ca0,_0xb779('0xbb'));var _0x2e1bb6=[];_0x5c8f68[_0xb779('0x32')](function(_0x54debd){_0x2e1bb6[_0xb779('0x34')](updateSmsInteraction(_0x54debd,_0x23f8b3,_0x5ba36f));});return BPromise['all'](_0x2e1bb6);});});})[_0xb779('0x2b')](function(_0x412547){_0x23ef19[_0xb779('0xbc')]=_0x412547;return _0x23ef19;})['then'](respondWithFilteredResult(_0x461597,_0xee46f0))[_0xb779('0x35')](handleError(_0x461597,null));};exports[_0xb779('0xbd')]=function(_0xb616c5,_0x59edf8){var _0x1ed08b={'raw':![],'where':{'id':_0xb616c5['params']['id']}},_0x3e9e5e={};_0x3e9e5e['model']=_['keys'](db[_0xb779('0x3e')][_0xb779('0xbe')]);_0x3e9e5e['query']=_[_0xb779('0x44')](_0xb616c5[_0xb779('0x43')]);_0x3e9e5e['filters']=_[_0xb779('0xbf')](_0x3e9e5e[_0xb779('0x42')],_0x3e9e5e['query']);_0x1ed08b[_0xb779('0x47')]=_[_0xb779('0xbf')](_0x3e9e5e[_0xb779('0x42')],qs['fields'](_0xb616c5[_0xb779('0x43')]['fields']));_0x1ed08b[_0xb779('0x47')]=_0x1ed08b[_0xb779('0x47')][_0xb779('0x67')]?_0x1ed08b['attributes']:_0x3e9e5e[_0xb779('0x42')];if(_0xb616c5[_0xb779('0x43')][_0xb779('0xc0')]){_0x1ed08b['include']=[{'all':!![]}];}_0x1ed08b=_[_0xb779('0xa5')]({},_0x1ed08b,_0xb616c5['options']);return db['SmsInteraction'][_0xb779('0x68')](_0x1ed08b)[_0xb779('0x2b')](handleEntityNotFound(_0x59edf8,null))[_0xb779('0x2b')](respondWithResult(_0x59edf8,null))[_0xb779('0x35')](handleError(_0x59edf8,null));};exports[_0xb779('0xc1')]=function(_0x46a6fd,_0x300b4f){return db[_0xb779('0x3e')][_0xb779('0xc1')](_0x46a6fd['body'],{})['then'](respondWithResult(_0x300b4f,0xc9))[_0xb779('0x35')](handleError(_0x300b4f,null));};exports['update']=function(_0x4e6a47,_0x3aecd5){if(_0x4e6a47['body']['id']){delete _0x4e6a47['body']['id'];}return db['SmsInteraction'][_0xb779('0x68')]({'where':{'id':_0x4e6a47['params']['id']}})['then'](handleEntityNotFound(_0x3aecd5,null))[_0xb779('0x2b')](saveUpdates(_0x4e6a47[_0xb779('0x7b')],null))[_0xb779('0x2b')](respondWithResult(_0x3aecd5,null))[_0xb779('0x35')](handleError(_0x3aecd5,null));};exports[_0xb779('0x2c')]=function(_0x1168ba,_0x58fe51){return db[_0xb779('0x3e')][_0xb779('0x68')]({'where':{'id':_0x1168ba['params']['id']}})[_0xb779('0x2b')](handleEntityNotFound(_0x58fe51,null))[_0xb779('0x2b')](removeEntity(_0x58fe51,null))['catch'](handleError(_0x58fe51,null));};exports[_0xb779('0xc2')]=function(_0x5c88f9,_0x3ed906){return db[_0xb779('0x3e')][_0xb779('0xc2')]()[_0xb779('0x2b')](respondWithResult(_0x3ed906,null))[_0xb779('0x35')](handleError(_0x3ed906,null));};exports['addMessage']=function(_0x4748a1,_0x46463e,_0x53c1ec){return db[_0xb779('0xc3')][_0xb779('0x68')]({'where':{'id':_0x4748a1[_0xb779('0xc4')]['id']}})[_0xb779('0x2b')](handleEntityNotFound(_0x46463e,null))[_0xb779('0x2b')](function(_0x4deb7d){if(_0x4deb7d){return _0x4deb7d[_0xb779('0xc5')](_0x4748a1[_0xb779('0x7b')]['ids'],_['omit'](_0x4748a1[_0xb779('0x7b')],['ids','id'])||{});}})[_0xb779('0x2b')](respondWithResult(_0x46463e,null))['catch'](handleError(_0x46463e,null));};exports[_0xb779('0xc6')]=function(_0x29eccc,_0x47f33b,_0x2f36dc){var _0x4c9ec2={'raw':![],'where':{}};var _0x192baa={};var _0x13b94e={'count':0x0,'rows':[]};return db[_0xb779('0x3e')][_0xb779('0xc7')]({'where':{'id':_0x29eccc[_0xb779('0xc4')]['id']}})[_0xb779('0x2b')](handleEntityNotFound(_0x47f33b,null))[_0xb779('0x2b')](function(_0xce99ad){if(_0xce99ad){_0x192baa[_0xb779('0x42')]=_['keys'](db[_0xb779('0xc3')][_0xb779('0xbe')]);_0x192baa[_0xb779('0x43')]=_[_0xb779('0x44')](_0x29eccc[_0xb779('0x43')]);_0x192baa[_0xb779('0x45')]=_[_0xb779('0xbf')](_0x192baa[_0xb779('0x42')],_0x192baa[_0xb779('0x43')]);_0x4c9ec2['attributes']=_[_0xb779('0xbf')](_0x192baa['model'],qs[_0xb779('0x46')](_0x29eccc['query']['fields']));_0x4c9ec2[_0xb779('0x47')]=_0x4c9ec2[_0xb779('0x47')][_0xb779('0x67')]?_0x4c9ec2[_0xb779('0x47')]:_0x192baa[_0xb779('0x42')];if(!_0x29eccc['query'][_0xb779('0x48')](_0xb779('0xc8'))){_0x4c9ec2['limit']=qs['limit'](_0x29eccc['query']['limit']);_0x4c9ec2[_0xb779('0x20')]=qs[_0xb779('0x20')](_0x29eccc[_0xb779('0x43')][_0xb779('0x20')]);}_0x4c9ec2[_0xb779('0x49')]=qs[_0xb779('0x4a')](_0x29eccc[_0xb779('0x43')][_0xb779('0x4a')]);_0x4c9ec2['where']=qs[_0xb779('0x45')](_[_0xb779('0xc9')](_0x29eccc[_0xb779('0x43')],_0x192baa['filters']));_0x4c9ec2[_0xb779('0x4b')][_0xb779('0xbb')]=_0xce99ad['id'];if(_0x29eccc[_0xb779('0x43')]['filter']){_0x4c9ec2[_0xb779('0x4b')]=_['merge'](_0x4c9ec2['where'],{'$or':_[_0xb779('0x2f')](_0x4c9ec2['attributes'],function(_0x16df40){var _0x1cd91d={};_0x1cd91d[_0x16df40]={'$like':'%'+_0x29eccc[_0xb779('0x43')][_0xb779('0x8e')]+'%'};return _0x1cd91d;})});}if(_0x29eccc[_0xb779('0x43')]['$gte']){var _0x43efa2=_0x29eccc['query']['$gte'][_0xb779('0x6f')](',');var _0x4bebd9={};_0x4bebd9[_0x43efa2[0x0]]={'$gte':moment(_0x43efa2[0x1])[_0xb779('0xca')](_0xb779('0xcb'))};_0x4c9ec2[_0xb779('0x4b')]=_[_0xb779('0xa5')](_0x4c9ec2[_0xb779('0x4b')],_0x4bebd9);}_0x4c9ec2=_[_0xb779('0xa5')]({},_0x4c9ec2,_0x29eccc[_0xb779('0xcc')]);return db[_0xb779('0xc3')][_0xb779('0x22')]({'where':_0x4c9ec2[_0xb779('0x4b')]})[_0xb779('0x2b')](function(_0x239bb2){_0x13b94e[_0xb779('0x22')]=_0x239bb2;if(_0x29eccc[_0xb779('0x43')]['includeAll']){_0x4c9ec2[_0xb779('0xcd')]=[{'all':!![]}];}return db[_0xb779('0xc3')][_0xb779('0xce')](_0x4c9ec2);})[_0xb779('0x2b')](function(_0x2f7696){_0x13b94e[_0xb779('0xbc')]=_0x2f7696;return _0x13b94e;});}})['then'](respondWithFilteredResult(_0x47f33b,_0x4c9ec2))['catch'](handleError(_0x47f33b,null));};exports[_0xb779('0xcf')]=function(_0x2b4f41,_0x3ab5d7,_0x4110d0){return db[_0xb779('0x3e')]['find']({'where':{'id':_0x2b4f41[_0xb779('0xc4')]['id']}})[_0xb779('0x2b')](handleEntityNotFound(_0x3ab5d7,null))[_0xb779('0x2b')](function(_0x583f62){if(_0x583f62){return _0x583f62[_0xb779('0xd0')](_0x2b4f41['body'][_0xb779('0xd1')],_['omit'](_0x2b4f41[_0xb779('0x7b')],['ids','id'])||{})['spread'](function(){return db['Tag']['findAll']({'attributes':['id','name',_0xb779('0x4e')],'where':{'id':_0x2b4f41[_0xb779('0x7b')][_0xb779('0xd1')]}});})[_0xb779('0x2b')](function(_0x5b9405){socket[_0xb779('0xd2')]('smsInteractionTags:save',{'id':Number(_0x2b4f41['params']['id']),'tags':_0x5b9405||[]});return{'id':Number(_0x2b4f41[_0xb779('0xc4')]['id']),'tags':_0x5b9405||[]};});}})[_0xb779('0x2b')](respondWithResult(_0x3ab5d7,null))[_0xb779('0x35')](handleError(_0x3ab5d7,null));};exports[_0xb779('0xd3')]=function(_0x2c6a5a,_0x263aa0,_0x167fb6){return db[_0xb779('0x3e')][_0xb779('0x68')]({'where':{'id':_0x2c6a5a[_0xb779('0xc4')]['id']}})[_0xb779('0x2b')](handleEntityNotFound(_0x263aa0,null))[_0xb779('0x2b')](function(_0x90921b){if(_0x90921b){return _0x90921b['removeTags'](_0x2c6a5a[_0xb779('0x43')]['ids']);}})[_0xb779('0x2b')](respondWithStatusCode(_0x263aa0,null))[_0xb779('0x35')](handleError(_0x263aa0,null));};exports['download']=function(_0x552b32,_0x2da4d6){var _0x4ba450=moment()[_0xb779('0xd4')]()[_0xb779('0xa4')]();var _0x939dc9=path[_0xb779('0xd5')](config[_0xb779('0xd6')],_0xb779('0xd7'),_0xb779('0xd8'),_0xb779('0xd9'));var _0x4287c5=path[_0xb779('0xd5')](config[_0xb779('0xd6')],'server',_0xb779('0xd8'),_0xb779('0xda'));var _0x362874=path[_0xb779('0xd5')](_0x939dc9,_0x4ba450);var _0x348d38=util[_0xb779('0xca')]('transcript-%d-%s.zip',_0x552b32[_0xb779('0xc4')]['id'],_0x4ba450);var _0x2dc473=path[_0xb779('0xd5')](_0x939dc9,_0x348d38);var _0xcf2952=[];_0xcf2952[_0xb779('0x34')]({'model':db['User'],'as':_0xb779('0x77'),'attributes':['id',_0xb779('0x30')],'raw':!![]});_0xcf2952[_0xb779('0x34')]({'model':db[_0xb779('0xdb')],'as':_0xb779('0x6e'),'attributes':['id',_0xb779('0xdc'),_0xb779('0xdd')],'raw':!![]});var _0x15eabd=[{'model':db[_0xb779('0xc3')],'as':_0xb779('0xde'),'attributes':['id',_0xb779('0x7b'),_0xb779('0x83'),'direction',_0xb779('0xdf'),'read'],'include':_0xcf2952}];_0x15eabd[_0xb779('0x34')]({'model':db['SmsAccount'],'as':'Account','attributes':['id',_0xb779('0x2e')]});_0x15eabd[_0xb779('0x34')]({'model':db['User'],'as':'Owner','attributes':['id','fullname']});return db['SmsInteraction'][_0xb779('0x68')]({'where':{'id':_0x552b32[_0xb779('0xc4')]['id']},'include':_0x15eabd})['then'](handleEntityNotFound(_0x2da4d6,null))[_0xb779('0x2b')](function(_0x3d2582){if(_0x3d2582){var _0x57c22b=_0x3d2582[_0xb779('0xe0')]({'plain':!![]});fs[_0xb779('0xe1')](_0x362874);var _0x3498d2={'channel':_0xb779('0xe2'),'account':_0x57c22b['Account'][_0xb779('0x2e')],'agent':_0x57c22b[_0xb779('0xe3')]?_0x57c22b[_0xb779('0xe3')]['fullname']:_0xb779('0xe4'),'createdAt':moment(_0x57c22b['createdAt'])[_0xb779('0xca')]('YYYY-MM-DD\x20HH:mm:ss')[_0xb779('0xa4')](),'closedAt':_0x57c22b[_0xb779('0x38')]?moment(_0x57c22b[_0xb779('0xe5')])[_0xb779('0xca')](_0xb779('0xcb'))[_0xb779('0xa4')]():'','disposition':_0x57c22b[_0xb779('0xe6')],'messages':_(_0x57c22b[_0xb779('0xde')])[_0xb779('0x8e')]({'secret':![]})['map'](function(_0x301d0b){return{'date':moment(_0x301d0b[_0xb779('0x83')])[_0xb779('0xca')]('YYYY-MM-DD\x20HH:mm:ss')[_0xb779('0xa4')](),'sender':_0x301d0b['direction']===_0xb779('0xe7')?_0x301d0b['User']?_0x301d0b[_0xb779('0x77')][_0xb779('0x30')]:_0xb779('0xe8'):_0x301d0b[_0xb779('0x6e')][_0xb779('0xdc')]+(_0x301d0b[_0xb779('0x6e')][_0xb779('0xdd')]?'\x20'+_0x301d0b[_0xb779('0x6e')]['lastName']:''),'body':_0x301d0b[_0xb779('0x7b')],'direction':_0x301d0b[_0xb779('0xe9')]===_0xb779('0xe7')?'A':'C','secret':_0x301d0b[_0xb779('0xdf')],'read':_0x301d0b[_0xb779('0x8a')]};})[_0xb779('0x6a')]()};return ejs[_0xb779('0xea')](path[_0xb779('0xd5')](config[_0xb779('0xd6')],_0xb779('0xd7'),_0xb779('0xeb'),_0xb779('0xec')),{'interaction':_0x3498d2})[_0xb779('0x2b')](function(_0xf3c906){var _0x4c7dfb=path['join'](_0x362874,'transcript-'+_0x57c22b['id']+'-'+_0x4ba450+_0xb779('0xed'));var _0x2d03f2={'path':_0x4c7dfb,'channel':_0xb779('0xe2'),'interactionId':_0x57c22b['id']};return pdf[_0xb779('0xee')](_0xf3c906,_0x2d03f2);})[_0xb779('0x2b')](function(){return new BPromise(function(_0x4c0469,_0x109036){zipdir(_0x362874,{'saveTo':_0x2dc473},function(_0x42069b,_0x26e918){if(_0x42069b)return _0x109036(_0x42069b);return _0x4c0469(_0x26e918);});})[_0xb779('0x2b')](function(){return new BPromise(function(_0xdc1a66,_0x4fbc53){rimraf(_0x362874,function(_0x6a9d90){if(_0x6a9d90)_0x4fbc53(_0x6a9d90);return _0xdc1a66();});});})[_0xb779('0x2b')](function(){return _0x2da4d6[_0xb779('0xef')](_0x2dc473,_0x348d38,function(_0x436cec){if(_0x436cec){console[_0xb779('0xf0')](_0xb779('0xf1'),_0x436cec);}else{fs['unlinkSync'](_0x2dc473);}});});});}else{return _0x2da4d6[_0xb779('0x1d')](0xc8);}})[_0xb779('0x35')](handleError(_0x2da4d6,null));}; \ No newline at end of file +var _0x426b=['fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','fs-extra','lodash','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','redis','defaults','localhost','./smsInteraction.socket','register','end','status','undefined','count','offset','set','apply','reject','then','sendStatus','error','stack','name','send','Users','fullname','Tags','split','forEach','push','catch','waiting','talking','answered','unmanaged','total','closed','UserId','index','map','SmsInteraction','rawAttributes','fieldName','type','key','model','query','attributes','intersection','fields','length','nolimit','limit','order','filters','select','field','color','tools_tags','u.id','u.fullname','from','user_has_sms_interactions','users','u.id\x20=\x20ui.UserId','sms_interactions','left_join','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','sms_accounts','a.id\x20=\x20i.SmsAccountId','me.SmsInteractionId\x20=\x20i.id','sms_interaction_has_tags','it.SmsInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','sqlOperator','conditions','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','text','start','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','buildExpression','body','keys','some','compact','isEmpty','where','i.SmsAccountId\x20IN\x20?','concat','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','i.phone\x20LIKE\x20?','group','i.id','QueryTypes','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','DESC','t.id\x20IN\x20?','resolve','SmsAccountId','i.SmsAccountId\x20IS\x20NOT\x20NULL','user','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','i.*','c.firstName','c.lastName','Contact.lastName','c.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','o.internal','GROUP_CONCAT(DISTINCT\x20t.id)','TagIds','ui.SmsInteractionId\x20IN\x20?','groupBy','all','rows','params','includeAll','include','options','create','describe','addMessage','ids','omit','findOne','SmsMessage','hasOwnProperty','sort','pick','SmsInteractionId','YYYY-MM-DD\x20HH:mm:ss','findAll','addTags','spread','smsInteractionTags:save','removeTags','unix','join','root','server','files','attachments','format','CmContact','firstName','lastName','secret','Account','Owner','get','Sms','N.A.','closedAt','Messages','out','System','direction','renderFile','views','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','log','err','unlinkSync','eml-format','rimraf'];(function(_0x21d416,_0x2b8d90){var _0x3ced8d=function(_0x30ef8c){while(--_0x30ef8c){_0x21d416['push'](_0x21d416['shift']());}};_0x3ced8d(++_0x2b8d90);}(_0x426b,0x1d8));var _0xb426=function(_0x2e44cf,_0x16f684){_0x2e44cf=_0x2e44cf-0x0;var _0x361268=_0x426b[_0x2e44cf];return _0x361268;};'use strict';var emlformat=require(_0xb426('0x0'));var rimraf=require(_0xb426('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb426('0x2'));var rp=require(_0xb426('0x3'));var moment=require(_0xb426('0x4'));var BPromise=require(_0xb426('0x5'));var Mustache=require(_0xb426('0x6'));var util=require('util');var path=require(_0xb426('0x7'));var sox=require(_0xb426('0x8'));var csv=require('to-csv');var ejs=require(_0xb426('0x9'));var fs=require('fs');var fs_extra=require(_0xb426('0xa'));var _=require(_0xb426('0xb'));var squel=require(_0xb426('0xc'));var crypto=require(_0xb426('0xd'));var jsforce=require(_0xb426('0xe'));var deskjs=require(_0xb426('0xf'));var toCsv=require('to-csv');var querystring=require(_0xb426('0x10'));var Papa=require(_0xb426('0x11'));var Redis=require(_0xb426('0x12'));var authService=require(_0xb426('0x13'));var qs=require(_0xb426('0x14'));var as=require('../../components/parsers/advancedSearch');var pdf=require('../../components/export/pdf');var hardwareService=require(_0xb426('0x15'));var logger=require(_0xb426('0x16'))('api');var utils=require(_0xb426('0x17'));var config=require(_0xb426('0x18'));var licenseUtil=require(_0xb426('0x19'));var db=require(_0xb426('0x1a'))['db'];config[_0xb426('0x1b')]=_[_0xb426('0x1c')](config['redis'],{'host':_0xb426('0x1d'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xb426('0x1b')]));require(_0xb426('0x1e'))[_0xb426('0x1f')](socket);function respondWithStatusCode(_0x1d6084,_0x490b48){_0x490b48=_0x490b48||0xcc;return function(_0x421b07){if(_0x421b07){return _0x1d6084['sendStatus'](_0x490b48);}return _0x1d6084['status'](_0x490b48)[_0xb426('0x20')]();};}function respondWithResult(_0x3f8272,_0x3c7a5a){_0x3c7a5a=_0x3c7a5a||0xc8;return function(_0x197408){if(_0x197408){return _0x3f8272[_0xb426('0x21')](_0x3c7a5a)['json'](_0x197408);}};}function respondWithFilteredResult(_0x1db8ea,_0x5d9c67){return function(_0x36178e){if(_0x36178e){var _0x2f1446=typeof _0x5d9c67['offset']===_0xb426('0x22')&&typeof _0x5d9c67['limit']==='undefined';var _0x203374=_0x36178e[_0xb426('0x23')];var _0xcd284b=_0x2f1446?0x0:_0x5d9c67[_0xb426('0x24')];var _0x791da5=_0x2f1446?_0x36178e[_0xb426('0x23')]:_0x5d9c67[_0xb426('0x24')]+_0x5d9c67['limit'];var _0x4d4ce0;if(_0x791da5>=_0x203374){_0x791da5=_0x203374;_0x4d4ce0=0xc8;}else{_0x4d4ce0=0xce;}_0x1db8ea[_0xb426('0x21')](_0x4d4ce0);return _0x1db8ea[_0xb426('0x25')]('Content-Range',_0xcd284b+'-'+_0x791da5+'/'+_0x203374)['json'](_0x36178e);}return null;};}function patchUpdates(_0x311677){return function(_0x481238){try{jsonpatch[_0xb426('0x26')](_0x481238,_0x311677,!![]);}catch(_0x5825c7){return BPromise[_0xb426('0x27')](_0x5825c7);}return _0x481238['save']();};}function saveUpdates(_0xaa5951,_0x4f70fa){return function(_0x412e47){if(_0x412e47){return _0x412e47['update'](_0xaa5951)['then'](function(_0x1f1482){return _0x1f1482;});}return null;};}function removeEntity(_0x5b6765,_0x58c001){return function(_0x35337e){if(_0x35337e){return _0x35337e['destroy']()[_0xb426('0x28')](function(){_0x5b6765['status'](0xcc)[_0xb426('0x20')]();});}};}function handleEntityNotFound(_0x3990d3,_0x5ef66a){return function(_0x3416f7){if(!_0x3416f7){_0x3990d3[_0xb426('0x29')](0x194);}return _0x3416f7;};}function handleError(_0x3ad23b,_0x489dda){_0x489dda=_0x489dda||0x1f4;return function(_0x59887a){logger[_0xb426('0x2a')](_0x59887a[_0xb426('0x2b')]);if(_0x59887a[_0xb426('0x2c')]){delete _0x59887a[_0xb426('0x2c')];}_0x3ad23b['status'](_0x489dda)[_0xb426('0x2d')](_0x59887a);};}function getInteractionUsers(_0x4c1f66,_0x309a5a){return new BPromise(function(_0x44ca97,_0x47bc8b){try{if(_0x309a5a[_0x4c1f66['id']]){_0x4c1f66[_0xb426('0x2e')]=_['map'](_0x309a5a[_0x4c1f66['id']],function(_0x4c1d8a){return{'id':_0x4c1d8a['id'],'fullname':_0x4c1d8a[_0xb426('0x2f')]};});}}catch(_0x4cea54){_0x47bc8b(_0x4cea54);}_0x44ca97(_0x4c1f66);});}function getInteractionTags(_0x2b306a,_0xb1b7f9){return new BPromise(function(_0x4ea447,_0x5a482c){try{if(_0x2b306a['TagIds']){_0x2b306a[_0xb426('0x30')]=[];_0x2b306a['TagIds'][_0xb426('0x31')](',')[_0xb426('0x32')](function(_0x95012c){_0x2b306a['Tags'][_0xb426('0x33')](_0xb1b7f9[_0x95012c]);});}delete _0x2b306a['TagIds'];}catch(_0x53ecc2){_0x5a482c(_0x53ecc2);}_0x4ea447(_0x2b306a);});}function updateSmsInteraction(_0x5c58ab,_0x20d937,_0x590791){return new BPromise(function(_0x30e089,_0x21eac3){return getInteractionUsers(_0x5c58ab,_0x590791)[_0xb426('0x28')](function(_0x54d9a2){return getInteractionTags(_0x54d9a2,_0x20d937);})[_0xb426('0x28')](function(_0x11edbb){return getStateInteraction(_0x11edbb);})[_0xb426('0x28')](function(_0x2388e7){_0x30e089(_0x2388e7);})[_0xb426('0x34')](function(_0xa0d4b9){_0x21eac3(_0xa0d4b9);});});}function getStateInteraction(_0x8c361d){return new BPromise(function(_0x2079f9){_0x8c361d[_0xb426('0x35')]=0x0;_0x8c361d[_0xb426('0x36')]=0x0;_0x8c361d[_0xb426('0x37')]=0x0;_0x8c361d[_0xb426('0x38')]=0x0;_0x8c361d[_0xb426('0x39')]=0x0;if(!_0x8c361d[_0xb426('0x3a')]&&!_0x8c361d[_0xb426('0x3b')]){_0x8c361d[_0xb426('0x35')]+=0x1;}if(!_0x8c361d[_0xb426('0x3a')]&&_0x8c361d[_0xb426('0x3b')]){_0x8c361d[_0xb426('0x36')]+=0x1;if(_0x8c361d['waiting']){_0x8c361d[_0xb426('0x35')]-=0x1;}}if(_0x8c361d[_0xb426('0x3a')]&&_0x8c361d[_0xb426('0x3b')]){_0x8c361d[_0xb426('0x37')]+=0x1;if(_0x8c361d[_0xb426('0x36')]){_0x8c361d[_0xb426('0x36')]-=0x1;}}if(_0x8c361d[_0xb426('0x3a')]&&!_0x8c361d[_0xb426('0x3b')]){_0x8c361d[_0xb426('0x38')]+=0x1;if(_0x8c361d['waiting']){_0x8c361d[_0xb426('0x35')]-=0x1;}}_0x8c361d[_0xb426('0x39')]+=0x1;_0x2079f9(_0x8c361d);});}exports[_0xb426('0x3c')]=function(_0x709847,_0x483087){var _0x5e2dcb={},_0x365a08={},_0x3037f8={'count':0x0,'rows':[]};var _0x372eee=_[_0xb426('0x3d')](db[_0xb426('0x3e')][_0xb426('0x3f')],function(_0x5d6088){return{'name':_0x5d6088[_0xb426('0x40')],'type':_0x5d6088[_0xb426('0x41')][_0xb426('0x42')]};});_0x365a08[_0xb426('0x43')]=_['map'](_0x372eee,_0xb426('0x2c'));_0x365a08[_0xb426('0x44')]=_['keys'](_0x709847[_0xb426('0x44')]);_0x365a08['filters']=_['intersection'](_0x365a08[_0xb426('0x43')],_0x365a08[_0xb426('0x44')]);_0x5e2dcb[_0xb426('0x45')]=_[_0xb426('0x46')](_0x365a08[_0xb426('0x43')],qs['fields'](_0x709847[_0xb426('0x44')][_0xb426('0x47')]));_0x5e2dcb[_0xb426('0x45')]=_0x5e2dcb[_0xb426('0x45')][_0xb426('0x48')]?_0x5e2dcb['attributes']:_0x365a08['model'];if(!_0x709847[_0xb426('0x44')]['hasOwnProperty'](_0xb426('0x49'))){_0x5e2dcb[_0xb426('0x4a')]=qs['limit'](_0x709847['query'][_0xb426('0x4a')]);_0x5e2dcb[_0xb426('0x24')]=qs[_0xb426('0x24')](_0x709847[_0xb426('0x44')][_0xb426('0x24')]);}_0x5e2dcb[_0xb426('0x4b')]=qs['sort'](_0x709847['query']['sort']);_0x5e2dcb['where']=qs['filters'](_['pick'](_0x709847[_0xb426('0x44')],_0x365a08[_0xb426('0x4c')]),_0x372eee);var _0x380ac5=[];var _0x44cfdd=squel[_0xb426('0x4d')]()[_0xb426('0x4e')]('id')[_0xb426('0x4e')](_0xb426('0x2c'))[_0xb426('0x4e')](_0xb426('0x4f'))['from'](_0xb426('0x50'));var _0x29c00e=squel[_0xb426('0x4d')]()[_0xb426('0x4e')](_0xb426('0x51'))[_0xb426('0x4e')](_0xb426('0x52'))[_0xb426('0x4e')]('ui.SmsInteractionId')[_0xb426('0x53')](_0xb426('0x54'),'ui')['left_join'](_0xb426('0x55'),'u',_0xb426('0x56'));var _0x35e9ea=squel['select']()[_0xb426('0x53')](_0xb426('0x57'),'i')[_0xb426('0x58')]('cm_contacts','c',_0xb426('0x59'))[_0xb426('0x58')](_0xb426('0x55'),'o',_0xb426('0x5a'))['left_join'](_0xb426('0x5b'),'a',_0xb426('0x5c'))['left_join']('sms_messages','me',_0xb426('0x5d'))[_0xb426('0x58')](_0xb426('0x5e'),'it',_0xb426('0x5f'))['left_join'](_0xb426('0x50'),'t',_0xb426('0x60'));var _0x1d210d=squel[_0xb426('0x61')]();var _0x943ba4=[];var _0x56dfed=squel[_0xb426('0x61')]();var _0xbc7d84;if(_0x709847[_0xb426('0x44')]['search']){_0xbc7d84=as['parseSearch'](_0x709847['query'][_0xb426('0x62')]);var _0x1edd73=_0xbc7d84[_0xb426('0x63')];for(var _0x219932=0x0;_0x219932<_0xbc7d84['conditions']['length'];_0x219932++){var _0x46671a=_0xbc7d84[_0xb426('0x64')][_0x219932];var _0xe28042='i';var _0x38979d=_[_0xb426('0x65')](_0x372eee,[_0xb426('0x2c'),_0x46671a[_0xb426('0x4e')]]);if(!_0x38979d){switch(_0x46671a[_0xb426('0x4e')]){case _0xb426('0x66'):if(_0x46671a[_0xb426('0x67')]==0x1){_0x35e9ea[_0xb426('0x68')]('`'+_0x46671a[_0xb426('0x4e')]+_0xb426('0x69'));}else{_0x35e9ea[_0xb426('0x68')]('`'+_0x46671a[_0xb426('0x4e')]+'`\x20>\x200');}break;case _0xb426('0x6a'):if(_0x46671a[_0xb426('0x6b')]===_0xb426('0x6c')){if(_0x46671a['value'][_0xb426('0x31')]('\x20')[_0xb426('0x48')]>0x1){_0x1d210d[_0x1edd73](_0xb426('0x6d'),qs[_0xb426('0x6e')](_0x46671a[_0xb426('0x67')]),null);}else{var _0x2f3675='%'+_0x46671a['value']+'%';_0x1d210d[_0x1edd73](_0xb426('0x6f'),_0x2f3675,_0x2f3675,_0x2f3675);}}else{_0x38979d=_[_0xb426('0x65')](_0x372eee,[_0xb426('0x2c'),_0xb426('0x70')]);_0x46671a['field']=_0xb426('0x70');_0x3d19af=as['buildExpression'](_0xe28042,_0x38979d[_0xb426('0x41')],_0x46671a);_0x1d210d[_0x1edd73](_0x3d19af[_0xb426('0x71')],_0x3d19af[_0xb426('0x67')][_0xb426('0x72')],_0x3d19af[_0xb426('0x67')][_0xb426('0x20')]);}break;case'Tag':var _0x135994=_0x46671a['value'][_0xb426('0x31')](',')['map'](function(_0x194a5b){return Number(_0x194a5b);});_0x135994[_0xb426('0x32')](function(_0x57d555){_0x56dfed['or'](_0xb426('0x73'),'%,'+_0x57d555+',%');});_0x943ba4=_[_0xb426('0x74')](_0x943ba4,_0x135994);break;case _0xb426('0x75'):if(_0x46671a['operator']===_0xb426('0x6c')){_0x1d210d[_0x1edd73](_0xb426('0x76'),'%'+_0x46671a[_0xb426('0x67')]+'%',null);}else{_0x38979d=_['find'](_0x372eee,[_0xb426('0x2c'),_0xb426('0x3b')]);_0x46671a[_0xb426('0x4e')]=_0xb426('0x3b');_0x3d19af=as[_0xb426('0x77')](_0xe28042,_0x38979d[_0xb426('0x41')],_0x46671a);_0x1d210d[_0x1edd73](_0x3d19af[_0xb426('0x71')],_0x3d19af['value'][_0xb426('0x72')],_0x3d19af[_0xb426('0x67')][_0xb426('0x20')]);}break;case _0xb426('0x78'):_0x3d19af=as[_0xb426('0x77')]('me',null,_0x46671a);_0x1d210d[_0x1edd73](_0x3d19af[_0xb426('0x71')],_0x3d19af[_0xb426('0x67')][_0xb426('0x72')],_0x3d19af[_0xb426('0x67')][_0xb426('0x20')]);break;}}else{var _0x3d19af=as[_0xb426('0x77')](_0xe28042,_0x38979d['type'],_0x46671a);_0x1d210d[_0x1edd73](_0x3d19af['text'],_0x3d19af[_0xb426('0x67')][_0xb426('0x72')],_0x3d19af[_0xb426('0x67')][_0xb426('0x20')]);}}}else{var _0x27a15e=_(_0x709847[_0xb426('0x44')])[_0xb426('0x79')]()['map'](function(_0x1ea703){return _[_0xb426('0x7a')](_0x372eee,[_0xb426('0x2c'),_0x1ea703])?_0x1ea703:undefined;})[_0xb426('0x7b')]()[_0xb426('0x67')]();if(!_[_0xb426('0x7c')](_0x27a15e)){_0x27a15e[_0xb426('0x32')](function(_0xc1ffdb){if(_0xc1ffdb==='SmsAccountId'){_0x35e9ea[_0xb426('0x7d')](_0xb426('0x7e'),[][_0xb426('0x7f')](_0x709847[_0xb426('0x44')][_0xc1ffdb]));}else if(_0xc1ffdb===_0xb426('0x80')){var _0x41da6d=JSON[_0xb426('0x81')](_0x709847[_0xb426('0x44')][_0xc1ffdb])[_0xb426('0x82')];var _0xa5da86=JSON[_0xb426('0x81')](_0x709847[_0xb426('0x44')][_0xc1ffdb])[_0xb426('0x83')];_0x35e9ea['where'](_0xb426('0x84'),_0x41da6d,_0xa5da86);}else{if(_0x709847['query'][_0xc1ffdb]===_0xb426('0x85')){_0x35e9ea['where']('i.'+_0xc1ffdb+_0xb426('0x86'));}else{_0x35e9ea['where']('i.'+_0xc1ffdb+_0xb426('0x87'),_0x709847[_0xb426('0x44')][_0xc1ffdb]);}}});}if(_0x709847['query'][_0xb426('0x88')]){if(_0x709847[_0xb426('0x44')][_0xb426('0x88')]==0x1){_0x35e9ea[_0xb426('0x68')](_0xb426('0x89'));}else{_0x35e9ea['having'](_0xb426('0x8a'));}}if(_0x709847[_0xb426('0x44')][_0xb426('0x8b')]){_0x943ba4=_[_0xb426('0x8c')](_0x709847['query']['tag'])?_0x709847['query'][_0xb426('0x8b')]:new Array(_0x709847[_0xb426('0x44')][_0xb426('0x8b')]);_0x943ba4[_0xb426('0x32')](function(_0x14c04e){_0x56dfed['or'](_0xb426('0x73'),'%,'+_0x14c04e+',%');});}if(_0x709847[_0xb426('0x44')]['filter']){var _0x5a37b3=_0x709847[_0xb426('0x44')][_0xb426('0x8d')][_0xb426('0x8e')]('\x5c','\x5c\x5c')[_0xb426('0x8e')](/'/g,'\x27\x27');if(qs['isNumeric'](_0x5a37b3)){_0x1d210d['or']('i.id\x20LIKE\x20?',_0x5a37b3+'%')['or'](_0xb426('0x8f'),_0x5a37b3+'%');}else{_0x1d210d['or']('MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs['getFullTextValue'](_0x5a37b3))['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0x5a37b3+'%');}}}_0x35e9ea[_0xb426('0x7d')](_0x1d210d);_0x35e9ea[_0xb426('0x90')](_0xb426('0x91'));var _0x14de59={'type':db['Sequelize'][_0xb426('0x92')]['SELECT'],'raw':!![]};var _0x285e6e=_0x35e9ea[_0xb426('0x93')]();_0x285e6e['field'](_0xb426('0x91'));_0x285e6e['field'](_0xb426('0x94'),_0xb426('0x66'));if(_0x5e2dcb[_0xb426('0x4b')]){_0x5e2dcb[_0xb426('0x4b')][_0xb426('0x32')](function(_0x58e5af){var _0x5ee25b=_0x58e5af[0x0]===_0xb426('0x95')?_0x58e5af[0x0]:'i.'+_0x58e5af[0x0];_0x35e9ea[_0xb426('0x4b')](_0x5ee25b,_0x58e5af[0x1]===_0xb426('0x96')?![]:!![]);});}if(!_[_0xb426('0x7c')](_0x943ba4)){_0x35e9ea[_0xb426('0x68')](_0x56dfed);_0x285e6e[_0xb426('0x7d')](_0xb426('0x97'),_0x943ba4);}BPromise[_0xb426('0x98')]()[_0xb426('0x28')](function(){if(!_0xbc7d84){if(_0x709847[_0xb426('0x44')][_0xb426('0x99')])return;_0x285e6e[_0xb426('0x7d')]('i.SmsAccountId\x20IS\x20NOT\x20NULL');_0x35e9ea['where'](_0xb426('0x9a'));return;}if(_0x709847[_0xb426('0x9b')]['role']!==_0xb426('0x9c'))return;return _0x709847['user'][_0xb426('0x9d')]({'attributes':['id'],'raw':!![]})[_0xb426('0x28')](function(_0x37184c){if(_[_0xb426('0x7c')](_0x37184c)){_0x285e6e[_0xb426('0x7d')](_0xb426('0x9e'));_0x35e9ea[_0xb426('0x7d')](_0xb426('0x9e'));}else{_0x285e6e[_0xb426('0x7d')](_0xb426('0x7e'),_[_0xb426('0x3d')](_0x37184c,'id'));_0x35e9ea[_0xb426('0x7d')](_0xb426('0x7e'),_[_0xb426('0x3d')](_0x37184c,'id'));}});})[_0xb426('0x28')](function(){if(_0x709847[_0xb426('0x9b')]['role']===_0xb426('0x9c')&&!_0xbc7d84&&!_0x709847[_0xb426('0x44')][_0xb426('0x99')])return[];return db[_0xb426('0x9f')][_0xb426('0x44')](_0x285e6e[_0xb426('0xa0')](),_0x14de59);})[_0xb426('0x28')](function(_0x23c151){_0x3037f8[_0xb426('0x23')]=_0x23c151[_0xb426('0x48')];if(_0x3037f8[_0xb426('0x23')]===0x0)return[];return db[_0xb426('0x9f')]['query'](_0x44cfdd[_0xb426('0xa0')](),_0x14de59)['then'](function(_0x39d4cd){_0x380ac5=_[_0xb426('0xa1')](_0x39d4cd,'id');_0x14de59=_[_0xb426('0xa2')](_0x14de59,{'model':db[_0xb426('0x3e')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x709847[_0xb426('0x44')][_0xb426('0x47')]){_0x5e2dcb[_0xb426('0x45')][_0xb426('0x32')](function(_0x4979fe){_0x35e9ea[_0xb426('0x4e')]('i.'+_0x4979fe);});}else{_0x35e9ea[_0xb426('0x4e')](_0xb426('0x94'),_0xb426('0x66'));_0x35e9ea[_0xb426('0x4e')](_0xb426('0xa3'),'Account.key');_0x35e9ea[_0xb426('0x4e')](_0xb426('0xa4'),_0xb426('0xa5'));_0x35e9ea[_0xb426('0x4e')](_0xb426('0xa6'),_0xb426('0x95'));_0x35e9ea[_0xb426('0x4e')](_0xb426('0xa7'));_0x35e9ea[_0xb426('0x4e')](_0xb426('0xa8'),'Contact.firstName');_0x35e9ea[_0xb426('0x4e')](_0xb426('0xa9'),_0xb426('0xaa'));_0x35e9ea[_0xb426('0x4e')](_0xb426('0xab'),'Contact.email');_0x35e9ea[_0xb426('0x4e')](_0xb426('0xac'),_0xb426('0xad'));_0x35e9ea[_0xb426('0x4e')](_0xb426('0xae'),_0xb426('0xaf'));_0x35e9ea[_0xb426('0x4e')](_0xb426('0xb0'),_0xb426('0xb1'));_0x35e9ea[_0xb426('0x4e')](_0xb426('0xb2'),'Owner.fullname');_0x35e9ea['field'](_0xb426('0xb3'),'Owner.internal');_0x35e9ea['field'](_0xb426('0xb4'),_0xb426('0xb5'));}if(_0x5e2dcb[_0xb426('0x4a')])_0x35e9ea[_0xb426('0x4a')](_0x5e2dcb[_0xb426('0x4a')]);if(_0x5e2dcb[_0xb426('0x24')])_0x35e9ea[_0xb426('0x24')](_0x5e2dcb['offset']);return db[_0xb426('0x9f')][_0xb426('0x44')](_0x35e9ea[_0xb426('0xa0')](),_0x14de59);})[_0xb426('0x28')](function(_0x30bfa0){if(_0x30bfa0[_0xb426('0x48')]>0x0)_0x29c00e[_0xb426('0x7d')](_0xb426('0xb6'),_[_0xb426('0x3d')](_0x30bfa0,'id'));return db[_0xb426('0x9f')]['query'](_0x29c00e[_0xb426('0xa0')](),_0x14de59)[_0xb426('0x28')](function(_0x12c53b){var _0x3b4aef=_[_0xb426('0xb7')](_0x12c53b,'SmsInteractionId');var _0x194e45=[];_0x30bfa0[_0xb426('0x32')](function(_0x40c353){_0x194e45[_0xb426('0x33')](updateSmsInteraction(_0x40c353,_0x380ac5,_0x3b4aef));});return BPromise[_0xb426('0xb8')](_0x194e45);});});})[_0xb426('0x28')](function(_0x314e06){_0x3037f8[_0xb426('0xb9')]=_0x314e06;return _0x3037f8;})[_0xb426('0x28')](respondWithFilteredResult(_0x483087,_0x5e2dcb))['catch'](handleError(_0x483087,null));};exports['show']=function(_0x314641,_0x2edf26){var _0x4d10c1={'raw':![],'where':{'id':_0x314641[_0xb426('0xba')]['id']}},_0x1c0521={};_0x1c0521[_0xb426('0x43')]=_[_0xb426('0x79')](db[_0xb426('0x3e')][_0xb426('0x3f')]);_0x1c0521[_0xb426('0x44')]=_['keys'](_0x314641[_0xb426('0x44')]);_0x1c0521['filters']=_['intersection'](_0x1c0521[_0xb426('0x43')],_0x1c0521[_0xb426('0x44')]);_0x4d10c1[_0xb426('0x45')]=_[_0xb426('0x46')](_0x1c0521[_0xb426('0x43')],qs[_0xb426('0x47')](_0x314641['query'][_0xb426('0x47')]));_0x4d10c1[_0xb426('0x45')]=_0x4d10c1[_0xb426('0x45')][_0xb426('0x48')]?_0x4d10c1['attributes']:_0x1c0521['model'];if(_0x314641['query'][_0xb426('0xbb')]){_0x4d10c1[_0xb426('0xbc')]=[{'all':!![]}];}_0x4d10c1=_['merge']({},_0x4d10c1,_0x314641[_0xb426('0xbd')]);return db[_0xb426('0x3e')][_0xb426('0x65')](_0x4d10c1)[_0xb426('0x28')](handleEntityNotFound(_0x2edf26,null))[_0xb426('0x28')](respondWithResult(_0x2edf26,null))[_0xb426('0x34')](handleError(_0x2edf26,null));};exports[_0xb426('0xbe')]=function(_0x283b0d,_0x291bdc){return db['SmsInteraction'][_0xb426('0xbe')](_0x283b0d['body'],{})[_0xb426('0x28')](respondWithResult(_0x291bdc,0xc9))[_0xb426('0x34')](handleError(_0x291bdc,null));};exports['update']=function(_0x22db86,_0x5db1af){if(_0x22db86['body']['id']){delete _0x22db86[_0xb426('0x78')]['id'];}return db[_0xb426('0x3e')]['find']({'where':{'id':_0x22db86[_0xb426('0xba')]['id']}})[_0xb426('0x28')](handleEntityNotFound(_0x5db1af,null))['then'](saveUpdates(_0x22db86[_0xb426('0x78')],null))[_0xb426('0x28')](respondWithResult(_0x5db1af,null))['catch'](handleError(_0x5db1af,null));};exports['destroy']=function(_0x47a8da,_0x4a3003){return db[_0xb426('0x3e')][_0xb426('0x65')]({'where':{'id':_0x47a8da[_0xb426('0xba')]['id']}})['then'](handleEntityNotFound(_0x4a3003,null))[_0xb426('0x28')](removeEntity(_0x4a3003,null))[_0xb426('0x34')](handleError(_0x4a3003,null));};exports[_0xb426('0xbf')]=function(_0x2e6bea,_0x11f81d){return db[_0xb426('0x3e')][_0xb426('0xbf')]()[_0xb426('0x28')](respondWithResult(_0x11f81d,null))['catch'](handleError(_0x11f81d,null));};exports[_0xb426('0xc0')]=function(_0x275587,_0x43aeeb,_0x1ba749){return db['SmsMessage']['find']({'where':{'id':_0x275587[_0xb426('0xba')]['id']}})['then'](handleEntityNotFound(_0x43aeeb,null))[_0xb426('0x28')](function(_0x133295){if(_0x133295){return _0x133295['addMessage'](_0x275587['body'][_0xb426('0xc1')],_[_0xb426('0xc2')](_0x275587['body'],['ids','id'])||{});}})['then'](respondWithResult(_0x43aeeb,null))[_0xb426('0x34')](handleError(_0x43aeeb,null));};exports['getMessages']=function(_0x40f2ba,_0x2dcc6b,_0x594d5b){var _0x55db84={'raw':![],'where':{}};var _0x33f9fe={};var _0x13a5f7={'count':0x0,'rows':[]};return db['SmsInteraction'][_0xb426('0xc3')]({'where':{'id':_0x40f2ba['params']['id']}})[_0xb426('0x28')](handleEntityNotFound(_0x2dcc6b,null))[_0xb426('0x28')](function(_0x668b6b){if(_0x668b6b){_0x33f9fe[_0xb426('0x43')]=_[_0xb426('0x79')](db[_0xb426('0xc4')][_0xb426('0x3f')]);_0x33f9fe[_0xb426('0x44')]=_[_0xb426('0x79')](_0x40f2ba[_0xb426('0x44')]);_0x33f9fe[_0xb426('0x4c')]=_[_0xb426('0x46')](_0x33f9fe[_0xb426('0x43')],_0x33f9fe[_0xb426('0x44')]);_0x55db84['attributes']=_['intersection'](_0x33f9fe[_0xb426('0x43')],qs[_0xb426('0x47')](_0x40f2ba[_0xb426('0x44')]['fields']));_0x55db84[_0xb426('0x45')]=_0x55db84['attributes']['length']?_0x55db84[_0xb426('0x45')]:_0x33f9fe['model'];if(!_0x40f2ba[_0xb426('0x44')][_0xb426('0xc5')](_0xb426('0x49'))){_0x55db84[_0xb426('0x4a')]=qs['limit'](_0x40f2ba[_0xb426('0x44')]['limit']);_0x55db84[_0xb426('0x24')]=qs[_0xb426('0x24')](_0x40f2ba[_0xb426('0x44')][_0xb426('0x24')]);}_0x55db84[_0xb426('0x4b')]=qs[_0xb426('0xc6')](_0x40f2ba[_0xb426('0x44')][_0xb426('0xc6')]);_0x55db84[_0xb426('0x7d')]=qs[_0xb426('0x4c')](_[_0xb426('0xc7')](_0x40f2ba[_0xb426('0x44')],_0x33f9fe[_0xb426('0x4c')]));_0x55db84[_0xb426('0x7d')][_0xb426('0xc8')]=_0x668b6b['id'];if(_0x40f2ba[_0xb426('0x44')][_0xb426('0x8d')]){_0x55db84[_0xb426('0x7d')]=_[_0xb426('0xa2')](_0x55db84[_0xb426('0x7d')],{'$or':_[_0xb426('0x3d')](_0x55db84[_0xb426('0x45')],function(_0x3acbe8){var _0x43248b={};_0x43248b[_0x3acbe8]={'$like':'%'+_0x40f2ba['query'][_0xb426('0x8d')]+'%'};return _0x43248b;})});}if(_0x40f2ba[_0xb426('0x44')]['$gte']){var _0x44e4b0=_0x40f2ba[_0xb426('0x44')][_0xb426('0x82')][_0xb426('0x31')](',');var _0x5ed82a={};_0x5ed82a[_0x44e4b0[0x0]]={'$gte':moment(_0x44e4b0[0x1])['format'](_0xb426('0xc9'))};_0x55db84[_0xb426('0x7d')]=_[_0xb426('0xa2')](_0x55db84[_0xb426('0x7d')],_0x5ed82a);}_0x55db84=_[_0xb426('0xa2')]({},_0x55db84,_0x40f2ba['options']);return db[_0xb426('0xc4')][_0xb426('0x23')]({'where':_0x55db84[_0xb426('0x7d')]})[_0xb426('0x28')](function(_0x3d1f23){_0x13a5f7['count']=_0x3d1f23;if(_0x40f2ba['query'][_0xb426('0xbb')]){_0x55db84[_0xb426('0xbc')]=[{'all':!![]}];}return db['SmsMessage'][_0xb426('0xca')](_0x55db84);})[_0xb426('0x28')](function(_0x310737){_0x13a5f7[_0xb426('0xb9')]=_0x310737;return _0x13a5f7;});}})[_0xb426('0x28')](respondWithFilteredResult(_0x2dcc6b,_0x55db84))['catch'](handleError(_0x2dcc6b,null));};exports[_0xb426('0xcb')]=function(_0xddf7f9,_0x62eda3,_0x3d779b){return db[_0xb426('0x3e')][_0xb426('0x65')]({'where':{'id':_0xddf7f9[_0xb426('0xba')]['id']}})['then'](handleEntityNotFound(_0x62eda3,null))[_0xb426('0x28')](function(_0x55b2d5){if(_0x55b2d5){return _0x55b2d5['setTags'](_0xddf7f9[_0xb426('0x78')][_0xb426('0xc1')],_[_0xb426('0xc2')](_0xddf7f9[_0xb426('0x78')],[_0xb426('0xc1'),'id'])||{})[_0xb426('0xcc')](function(){return db['Tag'][_0xb426('0xca')]({'attributes':['id','name',_0xb426('0x4f')],'where':{'id':_0xddf7f9[_0xb426('0x78')]['ids']}});})[_0xb426('0x28')](function(_0x4e7990){socket['emit'](_0xb426('0xcd'),{'id':Number(_0xddf7f9[_0xb426('0xba')]['id']),'tags':_0x4e7990||[]});return{'id':Number(_0xddf7f9[_0xb426('0xba')]['id']),'tags':_0x4e7990||[]};});}})[_0xb426('0x28')](respondWithResult(_0x62eda3,null))['catch'](handleError(_0x62eda3,null));};exports['removeTags']=function(_0x239170,_0x139600,_0x478a34){return db[_0xb426('0x3e')][_0xb426('0x65')]({'where':{'id':_0x239170[_0xb426('0xba')]['id']}})['then'](handleEntityNotFound(_0x139600,null))[_0xb426('0x28')](function(_0x4c95f3){if(_0x4c95f3){return _0x4c95f3[_0xb426('0xce')](_0x239170[_0xb426('0x44')][_0xb426('0xc1')]);}})[_0xb426('0x28')](respondWithStatusCode(_0x139600,null))[_0xb426('0x34')](handleError(_0x139600,null));};exports['download']=function(_0x1554ac,_0x2eb759){var _0x45cab1=moment()[_0xb426('0xcf')]()['toString']();var _0x688da1=path[_0xb426('0xd0')](config[_0xb426('0xd1')],_0xb426('0xd2'),_0xb426('0xd3'),'tmp');var _0x5bc392=path[_0xb426('0xd0')](config['root'],_0xb426('0xd2'),_0xb426('0xd3'),_0xb426('0xd4'));var _0x379bbf=path[_0xb426('0xd0')](_0x688da1,_0x45cab1);var _0x1dff7a=util[_0xb426('0xd5')]('transcript-%d-%s.zip',_0x1554ac[_0xb426('0xba')]['id'],_0x45cab1);var _0x1955c9=path['join'](_0x688da1,_0x1dff7a);var _0x4486d8=[];_0x4486d8[_0xb426('0x33')]({'model':db[_0xb426('0x75')],'as':_0xb426('0x75'),'attributes':['id','fullname'],'raw':!![]});_0x4486d8[_0xb426('0x33')]({'model':db[_0xb426('0xd6')],'as':'Contact','attributes':['id',_0xb426('0xd7'),_0xb426('0xd8')],'raw':!![]});var _0x1bbb54=[{'model':db['SmsMessage'],'as':'Messages','attributes':['id','body','createdAt','direction',_0xb426('0xd9'),'read'],'include':_0x4486d8}];_0x1bbb54[_0xb426('0x33')]({'model':db['SmsAccount'],'as':_0xb426('0xda'),'attributes':['id',_0xb426('0x2c')]});_0x1bbb54[_0xb426('0x33')]({'model':db['User'],'as':_0xb426('0xdb'),'attributes':['id',_0xb426('0x2f')]});return db[_0xb426('0x3e')]['find']({'where':{'id':_0x1554ac[_0xb426('0xba')]['id']},'include':_0x1bbb54})[_0xb426('0x28')](handleEntityNotFound(_0x2eb759,null))['then'](function(_0x168b75){if(_0x168b75){var _0x51a45a=_0x168b75[_0xb426('0xdc')]({'plain':!![]});fs['mkdirSync'](_0x379bbf);var _0x1d27c9={'channel':_0xb426('0xdd'),'account':_0x51a45a[_0xb426('0xda')][_0xb426('0x2c')],'agent':_0x51a45a['Owner']?_0x51a45a[_0xb426('0xdb')]['fullname']:_0xb426('0xde'),'createdAt':moment(_0x51a45a[_0xb426('0x80')])[_0xb426('0xd5')](_0xb426('0xc9'))[_0xb426('0xa0')](),'closedAt':_0x51a45a[_0xb426('0x3a')]?moment(_0x51a45a[_0xb426('0xdf')])[_0xb426('0xd5')](_0xb426('0xc9'))[_0xb426('0xa0')]():'','disposition':_0x51a45a['disposition'],'messages':_(_0x51a45a[_0xb426('0xe0')])[_0xb426('0x8d')]({'secret':![]})[_0xb426('0x3d')](function(_0x5b1582){return{'date':moment(_0x5b1582['createdAt'])[_0xb426('0xd5')]('YYYY-MM-DD\x20HH:mm:ss')[_0xb426('0xa0')](),'sender':_0x5b1582['direction']===_0xb426('0xe1')?_0x5b1582['User']?_0x5b1582['User'][_0xb426('0x2f')]:_0xb426('0xe2'):_0x5b1582[_0xb426('0x6a')][_0xb426('0xd7')]+(_0x5b1582[_0xb426('0x6a')][_0xb426('0xd8')]?'\x20'+_0x5b1582[_0xb426('0x6a')]['lastName']:''),'body':_0x5b1582[_0xb426('0x78')],'direction':_0x5b1582[_0xb426('0xe3')]===_0xb426('0xe1')?'A':'C','secret':_0x5b1582[_0xb426('0xd9')],'read':_0x5b1582[_0xb426('0x88')]};})[_0xb426('0x67')]()};return ejs[_0xb426('0xe4')](path[_0xb426('0xd0')](config[_0xb426('0xd1')],_0xb426('0xd2'),_0xb426('0xe5'),_0xb426('0xe6')),{'interaction':_0x1d27c9})[_0xb426('0x28')](function(_0x16399d){var _0x2f1c26=path['join'](_0x379bbf,_0xb426('0xe7')+_0x51a45a['id']+'-'+_0x45cab1+_0xb426('0xe8'));var _0x232a14={'path':_0x2f1c26,'channel':_0xb426('0xdd'),'interactionId':_0x51a45a['id']};return pdf[_0xb426('0xe9')](_0x16399d,_0x232a14);})[_0xb426('0x28')](function(){return new BPromise(function(_0x1f9867,_0xae4a6e){zipdir(_0x379bbf,{'saveTo':_0x1955c9},function(_0x474202,_0x53279a){if(_0x474202)return _0xae4a6e(_0x474202);return _0x1f9867(_0x53279a);});})['then'](function(){return new BPromise(function(_0x52cd5d,_0x43844b){rimraf(_0x379bbf,function(_0x40f9fb){if(_0x40f9fb)_0x43844b(_0x40f9fb);return _0x52cd5d();});});})['then'](function(){return _0x2eb759['download'](_0x1955c9,_0x1dff7a,function(_0x57c2ee){if(_0x57c2ee){console[_0xb426('0xea')](_0xb426('0xeb'),_0x57c2ee);}else{fs[_0xb426('0xec')](_0x1955c9);}});});});}else{return _0x2eb759[_0xb426('0x29')](0xc8);}})[_0xb426('0x34')](handleError(_0x2eb759,null));}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.events.js b/server/api/smsInteraction/smsInteraction.events.js index fdb19a6..d90730c 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 _0xfef3=['setDataValue','Users','map','findAll','unreadMessages','length','emit','catch','hasOwnProperty','hook','events','SmsInteraction','SmsMessage','setMaxListeners','update','remove','getUsers','then'];(function(_0x348d32,_0x20de03){var _0x3b1b89=function(_0x27656b){while(--_0x27656b){_0x348d32['push'](_0x348d32['shift']());}};_0x3b1b89(++_0x20de03);}(_0xfef3,0x118));var _0x3fef=function(_0x3fea87,_0x5917e4){_0x3fea87=_0x3fea87-0x0;var _0x5c5a53=_0xfef3[_0x3fea87];return _0x5c5a53;};'use strict';var EventEmitter=require(_0x3fef('0x0'));var SmsInteraction=require('../../mysqldb')['db'][_0x3fef('0x1')];var SmsMessage=require('../../mysqldb')['db'][_0x3fef('0x2')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0x3fef('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x3fef('0x4'),'afterDestroy':_0x3fef('0x5')};function emitEvent(_0x538f28){return function(_0x2f88b8,_0x1351b1,_0x5dd9fb){_0x2f88b8[_0x3fef('0x6')]({'attributes':['id'],'raw':!![]})[_0x3fef('0x7')](function(_0x800850){_0x2f88b8[_0x3fef('0x8')](_0x3fef('0x9'),_0x800850[_0x3fef('0xa')](function(_0x356ad8){return{'id':_0x356ad8['id']};}));return SmsMessage[_0x3fef('0xb')]({'where':{'SmsInteractionId':_0x2f88b8['id'],'direction':'in','read':![]},'raw':!![]});})[_0x3fef('0x7')](function(_0x307586){_0x2f88b8[_0x3fef('0x8')](_0x3fef('0xc'),_0x307586[_0x3fef('0xd')]);SmsInteractionEvents[_0x3fef('0xe')](_0x538f28+':'+_0x2f88b8['id'],_0x2f88b8);SmsInteractionEvents['emit'](_0x538f28,_0x2f88b8);_0x5dd9fb(null);})[_0x3fef('0xf')](_0x5dd9fb(null));};}for(var e in events){if(events[_0x3fef('0x10')](e)){var event=events[e];SmsInteraction[_0x3fef('0x11')](e,emitEvent(event));}}module['exports']=SmsInteractionEvents; \ No newline at end of file +var _0x0598=['catch','hasOwnProperty','events','../../mysqldb','save','update','setDataValue','Users','map','then','unreadMessages','length'];(function(_0x476ab8,_0x19f377){var _0x58fdf6=function(_0x1df1b2){while(--_0x1df1b2){_0x476ab8['push'](_0x476ab8['shift']());}};_0x58fdf6(++_0x19f377);}(_0x0598,0x92));var _0x8059=function(_0x24126f,_0x2202ae){_0x24126f=_0x24126f-0x0;var _0xc9b13a=_0x0598[_0x24126f];return _0xc9b13a;};'use strict';var EventEmitter=require(_0x8059('0x0'));var SmsInteraction=require(_0x8059('0x1'))['db']['SmsInteraction'];var SmsMessage=require(_0x8059('0x1'))['db']['SmsMessage'];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x8059('0x2'),'afterUpdate':_0x8059('0x3'),'afterDestroy':'remove'};function emitEvent(_0x54f42f){return function(_0x555fb5,_0x467206,_0xa7d7c1){_0x555fb5['getUsers']({'attributes':['id'],'raw':!![]})['then'](function(_0x248273){_0x555fb5[_0x8059('0x4')](_0x8059('0x5'),_0x248273[_0x8059('0x6')](function(_0x5df268){return{'id':_0x5df268['id']};}));return SmsMessage['findAll']({'where':{'SmsInteractionId':_0x555fb5['id'],'direction':'in','read':![]},'raw':!![]});})[_0x8059('0x7')](function(_0x1bf5fd){_0x555fb5[_0x8059('0x4')](_0x8059('0x8'),_0x1bf5fd[_0x8059('0x9')]);SmsInteractionEvents['emit'](_0x54f42f+':'+_0x555fb5['id'],_0x555fb5);SmsInteractionEvents['emit'](_0x54f42f,_0x555fb5);_0xa7d7c1(null);})[_0x8059('0xa')](_0xa7d7c1(null));};}for(var e in events){if(events[_0x8059('0xb')](e)){var event=events[e];SmsInteraction['hook'](e,emitEvent(event));}}module['exports']=SmsInteractionEvents; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.model.js b/server/api/smsInteraction/smsInteraction.model.js index 0650c5b..a2d7903 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 _0x6cd8=['sms_interactions','changed','closed','closedAt','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','bluebird','rimraf','./smsInteraction.attributes','exports','define'];(function(_0x49c68e,_0x1c1673){var _0x33032b=function(_0x42ac31){while(--_0x42ac31){_0x49c68e['push'](_0x49c68e['shift']());}};_0x33032b(++_0x1c1673);}(_0x6cd8,0x1cc));var _0x86cd=function(_0x5473ca,_0x1a17cc){_0x5473ca=_0x5473ca-0x0;var _0x189950=_0x6cd8[_0x5473ca];return _0x189950;};'use strict';var _=require(_0x86cd('0x0'));var util=require(_0x86cd('0x1'));var logger=require(_0x86cd('0x2'))('api');var moment=require('moment');var BPromise=require(_0x86cd('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x86cd('0x4'));var config=require('../../config/environment');var attributes=require(_0x86cd('0x5'));module[_0x86cd('0x6')]=function(_0x97dc8,_0x4e3f88){return _0x97dc8[_0x86cd('0x7')]('SmsInteraction',attributes,{'tableName':_0x86cd('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x1eeedd,_0x487da0,_0x2b5cd0){if(_0x1eeedd[_0x86cd('0x9')](_0x86cd('0xa'))){_0x1eeedd[_0x86cd('0xb')]=moment()['format'](_0x86cd('0xc'));}_0x2b5cd0(null,_0x1eeedd);}}});}; \ No newline at end of file +var _0xfc76=['bluebird','request-promise','path','../../config/environment','./smsInteraction.attributes','exports','define','SmsInteraction','sms_interactions','format','util','../../config/logger','api','moment'];(function(_0x55816d,_0x15c16){var _0x2e91c5=function(_0xa4374c){while(--_0xa4374c){_0x55816d['push'](_0x55816d['shift']());}};_0x2e91c5(++_0x15c16);}(_0xfc76,0x96));var _0x6fc7=function(_0x1bf2dd,_0x3bed45){_0x1bf2dd=_0x1bf2dd-0x0;var _0x3e2001=_0xfc76[_0x1bf2dd];return _0x3e2001;};'use strict';var _=require('lodash');var util=require(_0x6fc7('0x0'));var logger=require(_0x6fc7('0x1'))(_0x6fc7('0x2'));var moment=require(_0x6fc7('0x3'));var BPromise=require(_0x6fc7('0x4'));var rp=require(_0x6fc7('0x5'));var fs=require('fs');var path=require(_0x6fc7('0x6'));var rimraf=require('rimraf');var config=require(_0x6fc7('0x7'));var attributes=require(_0x6fc7('0x8'));module[_0x6fc7('0x9')]=function(_0x57c11d,_0x5a5ef3){return _0x57c11d[_0x6fc7('0xa')](_0x6fc7('0xb'),attributes,{'tableName':_0x6fc7('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x4592a4,_0x4d9810,_0x548f8d){if(_0x4592a4['changed']('closed')){_0x4592a4['closedAt']=moment()[_0x6fc7('0xd')]('YYYY-MM-DD\x20HH:mm:ss');}_0x548f8d(null,_0x4592a4);}}});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.rpc.js b/server/api/smsInteraction/smsInteraction.rpc.js index ecad2a3..bc7d3bb 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 _0x0810=['http','redis','defaults','localhost','socket.io-emitter','register','request','then','info','SmsInteraction,\x20%s,\x20%s','debug','SmsInteraction,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent','result','catch','UpdateSmsInteraction','SmsInteraction','options','raw','where','limit','find','body','ids','omit','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x0810,0x135));var _0x0081=function(_0x3cd746,_0xb404d6){_0x3cd746=_0x3cd746-0x0;var _0x2cffd3=_0x0810[_0x3cd746];return _0x2cffd3;};'use strict';var _=require(_0x0081('0x0'));var util=require(_0x0081('0x1'));var moment=require(_0x0081('0x2'));var BPromise=require(_0x0081('0x3'));var rs=require(_0x0081('0x4'));var fs=require('fs');var Redis=require(_0x0081('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x0081('0x6'));var logger=require(_0x0081('0x7'))(_0x0081('0x8'));var config=require(_0x0081('0x9'));var jayson=require(_0x0081('0xa'));var client=jayson['client'][_0x0081('0xb')]({'port':0x232a});config[_0x0081('0xc')]=_[_0x0081('0xd')](config[_0x0081('0xc')],{'host':_0x0081('0xe'),'port':0x18eb});var socket=require(_0x0081('0xf'))(new Redis(config['redis']));require('./smsInteraction.socket')[_0x0081('0x10')](socket);function respondWithRpcPromise(_0x43518c,_0x2bf9bb,_0x4f64e9){return new BPromise(function(_0x4e030f,_0x2b4390){return client[_0x0081('0x11')](_0x43518c,_0x4f64e9)[_0x0081('0x12')](function(_0x2505fe){logger[_0x0081('0x13')](_0x0081('0x14'),_0x2bf9bb,'request\x20sent');logger[_0x0081('0x15')](_0x0081('0x16'),_0x2bf9bb,'request\x20sent',JSON[_0x0081('0x17')](_0x2505fe));if(_0x2505fe[_0x0081('0x18')]){if(_0x2505fe[_0x0081('0x18')]['code']===0x1f4){logger[_0x0081('0x18')](_0x0081('0x14'),_0x2bf9bb,_0x2505fe['error'][_0x0081('0x19')]);return _0x2b4390(_0x2505fe['error'][_0x0081('0x19')]);}logger[_0x0081('0x18')]('SmsInteraction,\x20%s,\x20%s',_0x2bf9bb,_0x2505fe[_0x0081('0x18')]['message']);return _0x4e030f(_0x2505fe[_0x0081('0x18')][_0x0081('0x19')]);}else{logger[_0x0081('0x13')](_0x0081('0x14'),_0x2bf9bb,_0x0081('0x1a'));_0x4e030f(_0x2505fe[_0x0081('0x1b')][_0x0081('0x19')]);}})[_0x0081('0x1c')](function(_0x45fc67){logger[_0x0081('0x18')](_0x0081('0x14'),_0x2bf9bb,_0x45fc67);_0x2b4390(_0x45fc67);});});}exports[_0x0081('0x1d')]=function(_0x5e40a2){var _0x5597cf=this;return new Promise(function(_0x57deb2,_0x32f225){return db[_0x0081('0x1e')]['update'](_0x5e40a2['body'],{'raw':_0x5e40a2['options']?_0x5e40a2[_0x0081('0x1f')][_0x0081('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5e40a2[_0x0081('0x1f')]?_0x5e40a2[_0x0081('0x1f')][_0x0081('0x21')]||null:null,'attributes':_0x5e40a2[_0x0081('0x1f')]?_0x5e40a2[_0x0081('0x1f')]['attributes']||null:null,'limit':_0x5e40a2[_0x0081('0x1f')]?_0x5e40a2[_0x0081('0x1f')][_0x0081('0x22')]||null:null})[_0x0081('0x12')](function(_0x5c54f4){logger[_0x0081('0x13')](_0x0081('0x1d'),_0x5e40a2);logger['debug'](_0x0081('0x1d'),_0x5e40a2,JSON['stringify'](_0x5c54f4));_0x57deb2(_0x5c54f4);})['catch'](function(_0x402b2b){logger[_0x0081('0x18')](_0x0081('0x1d'),_0x402b2b[_0x0081('0x19')],_0x5e40a2);_0x32f225(_0x5597cf[_0x0081('0x18')](0x1f4,_0x402b2b[_0x0081('0x19')]));});});};exports['AddTagsToSmsInteraction']=function(_0x3382d6){return new Promise(function(_0x83cb60,_0x474f12){return db[_0x0081('0x1e')][_0x0081('0x23')]({'where':_0x3382d6[_0x0081('0x1f')]?_0x3382d6[_0x0081('0x1f')]['where']||null:null})[_0x0081('0x12')](function(_0xefdfff){if(_0xefdfff){return _0xefdfff['addTags'](_0x3382d6[_0x0081('0x24')][_0x0081('0x25')],_[_0x0081('0x26')](_0x3382d6[_0x0081('0x24')],[_0x0081('0x25'),'id'])||{});}})['spread'](function(_0x452623){logger[_0x0081('0x13')](_0x0081('0x27'),_0x3382d6);logger['debug']('AddTags',_0x3382d6,JSON['stringify'](_0x452623));_0x83cb60(_0x452623);})[_0x0081('0x1c')](function(_0x550188){logger['error'](_0x0081('0x27'),_0x550188['message'],_0x3382d6);_0x474f12(_this[_0x0081('0x18')](0x1f4,_0x550188[_0x0081('0x19')]));});});}; \ No newline at end of file +var _0x29d0=['request\x20sent','SmsInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','SmsInteraction','update','body','options','raw','where','attributes','debug','UpdateSmsInteraction','AddTagsToSmsInteraction','find','addTags','ids','omit','spread','AddTags','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','redis','defaults','localhost','./smsInteraction.socket','register','request','then','info','SmsInteraction,\x20%s,\x20%s'];(function(_0x13561c,_0x39f191){var _0x48f231=function(_0x19c49b){while(--_0x19c49b){_0x13561c['push'](_0x13561c['shift']());}};_0x48f231(++_0x39f191);}(_0x29d0,0x19b));var _0x029d=function(_0x3f1899,_0x4a0a39){_0x3f1899=_0x3f1899-0x0;var _0x5d2b33=_0x29d0[_0x3f1899];return _0x5d2b33;};'use strict';var _=require('lodash');var util=require(_0x029d('0x0'));var moment=require(_0x029d('0x1'));var BPromise=require(_0x029d('0x2'));var rs=require(_0x029d('0x3'));var fs=require('fs');var Redis=require(_0x029d('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x029d('0x5'));var logger=require(_0x029d('0x6'))(_0x029d('0x7'));var config=require(_0x029d('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x029d('0x9')]['http']({'port':0x232a});config[_0x029d('0xa')]=_[_0x029d('0xb')](config[_0x029d('0xa')],{'host':_0x029d('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x029d('0xa')]));require(_0x029d('0xd'))[_0x029d('0xe')](socket);function respondWithRpcPromise(_0x40c087,_0x358b2b,_0x2a2524){return new BPromise(function(_0x19dcce,_0x5c4b36){return client[_0x029d('0xf')](_0x40c087,_0x2a2524)[_0x029d('0x10')](function(_0x4eec9a){logger[_0x029d('0x11')](_0x029d('0x12'),_0x358b2b,_0x029d('0x13'));logger['debug'](_0x029d('0x14'),_0x358b2b,_0x029d('0x13'),JSON[_0x029d('0x15')](_0x4eec9a));if(_0x4eec9a[_0x029d('0x16')]){if(_0x4eec9a[_0x029d('0x16')][_0x029d('0x17')]===0x1f4){logger[_0x029d('0x16')](_0x029d('0x12'),_0x358b2b,_0x4eec9a[_0x029d('0x16')][_0x029d('0x18')]);return _0x5c4b36(_0x4eec9a[_0x029d('0x16')]['message']);}logger[_0x029d('0x16')]('SmsInteraction,\x20%s,\x20%s',_0x358b2b,_0x4eec9a[_0x029d('0x16')][_0x029d('0x18')]);return _0x19dcce(_0x4eec9a[_0x029d('0x16')][_0x029d('0x18')]);}else{logger[_0x029d('0x11')](_0x029d('0x12'),_0x358b2b,'request\x20sent');_0x19dcce(_0x4eec9a[_0x029d('0x19')][_0x029d('0x18')]);}})[_0x029d('0x1a')](function(_0x5456a7){logger[_0x029d('0x16')](_0x029d('0x12'),_0x358b2b,_0x5456a7);_0x5c4b36(_0x5456a7);});});}exports['UpdateSmsInteraction']=function(_0x4535ea){var _0x49ca63=this;return new Promise(function(_0x31cff9,_0xc392e4){return db[_0x029d('0x1b')][_0x029d('0x1c')](_0x4535ea[_0x029d('0x1d')],{'raw':_0x4535ea[_0x029d('0x1e')]?_0x4535ea[_0x029d('0x1e')][_0x029d('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4535ea['options']?_0x4535ea[_0x029d('0x1e')][_0x029d('0x20')]||null:null,'attributes':_0x4535ea['options']?_0x4535ea['options'][_0x029d('0x21')]||null:null,'limit':_0x4535ea[_0x029d('0x1e')]?_0x4535ea[_0x029d('0x1e')]['limit']||null:null})[_0x029d('0x10')](function(_0x15e0a4){logger[_0x029d('0x11')]('UpdateSmsInteraction',_0x4535ea);logger[_0x029d('0x22')](_0x029d('0x23'),_0x4535ea,JSON[_0x029d('0x15')](_0x15e0a4));_0x31cff9(_0x15e0a4);})['catch'](function(_0x2422fa){logger['error'](_0x029d('0x23'),_0x2422fa[_0x029d('0x18')],_0x4535ea);_0xc392e4(_0x49ca63['error'](0x1f4,_0x2422fa[_0x029d('0x18')]));});});};exports[_0x029d('0x24')]=function(_0x3ebfb1){return new Promise(function(_0x231826,_0x37e75c){return db[_0x029d('0x1b')][_0x029d('0x25')]({'where':_0x3ebfb1[_0x029d('0x1e')]?_0x3ebfb1[_0x029d('0x1e')][_0x029d('0x20')]||null:null})[_0x029d('0x10')](function(_0x42f7c){if(_0x42f7c){return _0x42f7c[_0x029d('0x26')](_0x3ebfb1[_0x029d('0x1d')][_0x029d('0x27')],_[_0x029d('0x28')](_0x3ebfb1[_0x029d('0x1d')],['ids','id'])||{});}})[_0x029d('0x29')](function(_0x2c5aee){logger['info']('AddTags',_0x3ebfb1);logger[_0x029d('0x22')](_0x029d('0x2a'),_0x3ebfb1,JSON[_0x029d('0x15')](_0x2c5aee));_0x231826(_0x2c5aee);})[_0x029d('0x1a')](function(_0x1af594){logger[_0x029d('0x16')](_0x029d('0x2a'),_0x1af594[_0x029d('0x18')],_0x3ebfb1);_0x37e75c(_this[_0x029d('0x16')](0x1f4,_0x1af594['message']));});});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.socket.js b/server/api/smsInteraction/smsInteraction.socket.js index e08337c..78662c7 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 _0x34fb=['removeListener','length','smsInteraction:','./smsInteraction.events','save','update','emit'];(function(_0x705b98,_0x1c345b){var _0x47b72f=function(_0x44f02a){while(--_0x44f02a){_0x705b98['push'](_0x705b98['shift']());}};_0x47b72f(++_0x1c345b);}(_0x34fb,0x106));var _0xb34f=function(_0x1616df,_0x3e66b5){_0x1616df=_0x1616df-0x0;var _0x6a7d7b=_0x34fb[_0x1616df];return _0x6a7d7b;};'use strict';var SmsInteractionEvents=require(_0xb34f('0x0'));var events=[_0xb34f('0x1'),'remove',_0xb34f('0x2')];function createListener(_0x12a5a1,_0x4bf715){return function(_0x411479){_0x4bf715[_0xb34f('0x3')](_0x12a5a1,_0x411479);};}function removeListener(_0x110247,_0x3bf175){return function(){SmsInteractionEvents[_0xb34f('0x4')](_0x110247,_0x3bf175);};}exports['register']=function(_0x11145c){for(var _0x408bac=0x0,_0xa62157=events[_0xb34f('0x5')];_0x408bac<_0xa62157;_0x408bac++){var _0x4b3232=events[_0x408bac];var _0x5d7683=createListener(_0xb34f('0x6')+_0x4b3232,_0x11145c);SmsInteractionEvents['on'](_0x4b3232,_0x5d7683);}}; \ No newline at end of file +var _0x3f7e=['save','remove','update','emit','removeListener','register','length','./smsInteraction.events'];(function(_0x50a0c2,_0x4befab){var _0x5ebadd=function(_0x3a3342){while(--_0x3a3342){_0x50a0c2['push'](_0x50a0c2['shift']());}};_0x5ebadd(++_0x4befab);}(_0x3f7e,0x77));var _0xe3f7=function(_0x8c3ab6,_0x583f2c){_0x8c3ab6=_0x8c3ab6-0x0;var _0x410d67=_0x3f7e[_0x8c3ab6];return _0x410d67;};'use strict';var SmsInteractionEvents=require(_0xe3f7('0x0'));var events=[_0xe3f7('0x1'),_0xe3f7('0x2'),_0xe3f7('0x3')];function createListener(_0x900a51,_0x31f29e){return function(_0x55c67d){_0x31f29e[_0xe3f7('0x4')](_0x900a51,_0x55c67d);};}function removeListener(_0x29cb79,_0x12db65){return function(){SmsInteractionEvents[_0xe3f7('0x5')](_0x29cb79,_0x12db65);};}exports[_0xe3f7('0x6')]=function(_0x3f4d8e){for(var _0x669265=0x0,_0x1ea818=events[_0xe3f7('0x7')];_0x669265<_0x1ea818;_0x669265++){var _0x21871d=events[_0x669265];var _0x5c4755=createListener('smsInteraction:'+_0x21871d,_0x3f4d8e);SmsInteractionEvents['on'](_0x21871d,_0x5c4755);}}; \ No newline at end of file diff --git a/server/api/smsMessage/index.js b/server/api/smsMessage/index.js index f7cb60f..23177d6 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 _0x6f1e=['multer','util','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsMessage.controller','get','isAuthenticated','index','show','post','tracked','sms','smsmessage:create','create','/:id/status','status','put','update','/:id/accept','/:id/reject','delete','/:id','destroy'];(function(_0x4d7c38,_0x10654e){var _0x22353a=function(_0x349893){while(--_0x349893){_0x4d7c38['push'](_0x4d7c38['shift']());}};_0x22353a(++_0x10654e);}(_0x6f1e,0x78));var _0xe6f1=function(_0x221628,_0x1c3672){_0x221628=_0x221628-0x0;var _0x7b67e=_0x6f1e[_0x221628];return _0x7b67e;};'use strict';var multer=require(_0xe6f1('0x0'));var util=require(_0xe6f1('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(_0xe6f1('0x2'));var interaction=require(_0xe6f1('0x3'));var config=require(_0xe6f1('0x4'));var controller=require(_0xe6f1('0x5'));router[_0xe6f1('0x6')]('/',auth[_0xe6f1('0x7')](),controller[_0xe6f1('0x8')]);router[_0xe6f1('0x6')]('/describe',auth[_0xe6f1('0x7')](),controller['describe']);router['get']('/:id',auth[_0xe6f1('0x7')](),controller[_0xe6f1('0x9')]);router[_0xe6f1('0xa')]('/',auth[_0xe6f1('0x7')](),interaction[_0xe6f1('0xb')](_0xe6f1('0xc'),_0xe6f1('0xd')),controller[_0xe6f1('0xe')]);router[_0xe6f1('0xa')](_0xe6f1('0xf'),controller[_0xe6f1('0x10')]);router[_0xe6f1('0x11')]('/:id',auth[_0xe6f1('0x7')](),controller[_0xe6f1('0x12')]);router[_0xe6f1('0x11')](_0xe6f1('0x13'),auth['isAuthenticated'](),controller['accept']);router[_0xe6f1('0x11')](_0xe6f1('0x14'),auth[_0xe6f1('0x7')](),controller['reject']);router[_0xe6f1('0x15')](_0xe6f1('0x16'),auth[_0xe6f1('0x7')](),controller[_0xe6f1('0x17')]);module['exports']=router; \ No newline at end of file +var _0x359c=['delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../config/environment','./smsMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','sms','smsmessage:create','create','/:id/status','put','/:id/accept','accept'];(function(_0x123251,_0x511089){var _0x114da1=function(_0x1fd37a){while(--_0x1fd37a){_0x123251['push'](_0x123251['shift']());}};_0x114da1(++_0x511089);}(_0x359c,0xa5));var _0xc359=function(_0x2b93bb,_0x51002a){_0x2b93bb=_0x2b93bb-0x0;var _0x2bedc9=_0x359c[_0x2b93bb];return _0x2bedc9;};'use strict';var multer=require(_0xc359('0x0'));var util=require(_0xc359('0x1'));var path=require(_0xc359('0x2'));var timeout=require(_0xc359('0x3'));var express=require(_0xc359('0x4'));var router=express[_0xc359('0x5')]();var fs_extra=require(_0xc359('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xc359('0x7'));var controller=require(_0xc359('0x8'));router[_0xc359('0x9')]('/',auth[_0xc359('0xa')](),controller[_0xc359('0xb')]);router[_0xc359('0x9')](_0xc359('0xc'),auth[_0xc359('0xa')](),controller[_0xc359('0xd')]);router[_0xc359('0x9')](_0xc359('0xe'),auth[_0xc359('0xa')](),controller[_0xc359('0xf')]);router[_0xc359('0x10')]('/',auth[_0xc359('0xa')](),interaction['tracked'](_0xc359('0x11'),_0xc359('0x12')),controller[_0xc359('0x13')]);router[_0xc359('0x10')](_0xc359('0x14'),controller['status']);router['put']('/:id',auth[_0xc359('0xa')](),controller['update']);router[_0xc359('0x15')](_0xc359('0x16'),auth[_0xc359('0xa')](),controller[_0xc359('0x17')]);router['put']('/:id/reject',auth['isAuthenticated'](),controller['reject']);router[_0xc359('0x18')](_0xc359('0xe'),auth['isAuthenticated'](),controller[_0xc359('0x19')]);module[_0xc359('0x1a')]=router; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.attributes.js b/server/api/smsMessage/smsMessage.attributes.js index 7f38cd9..0fcd0ce 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 _0x3468=['STRING','sequelize','medium','out'];(function(_0x58a4fe,_0x11d439){var _0x697de2=function(_0xe38c14){while(--_0xe38c14){_0x58a4fe['push'](_0x58a4fe['shift']());}};_0x697de2(++_0x11d439);}(_0x3468,0x8d));var _0x8346=function(_0x15c7ab,_0x5ac8f7){_0x15c7ab=_0x15c7ab-0x0;var _0x2c0b5f=_0x3468[_0x15c7ab];return _0x2c0b5f;};'use strict';var Sequelize=require(_0x8346('0x0'));module['exports']={'body':{'type':Sequelize['TEXT'](_0x8346('0x1')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0x8346('0x2')),'defaultValue':_0x8346('0x2'),'allowNull':![]},'messageId':{'type':Sequelize[_0x8346('0x3')](0xbe)},'phone':{'type':Sequelize['STRING']},'readAt':{'type':Sequelize['DATE']},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'providerName':{'type':Sequelize[_0x8346('0x3')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0xb40c=['STRING','DATE','sequelize','exports','TEXT','BOOLEAN','out'];(function(_0x819464,_0x46fc91){var _0x49dcc0=function(_0x36b2b2){while(--_0x36b2b2){_0x819464['push'](_0x819464['shift']());}};_0x49dcc0(++_0x46fc91);}(_0xb40c,0x79));var _0xcb40=function(_0x11bb6c,_0x57f583){_0x11bb6c=_0x11bb6c-0x0;var _0xc08bea=_0xb40c[_0x11bb6c];return _0xc08bea;};'use strict';var Sequelize=require(_0xcb40('0x0'));module[_0xcb40('0x1')]={'body':{'type':Sequelize[_0xcb40('0x2')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0xcb40('0x3')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0xcb40('0x4')),'defaultValue':_0xcb40('0x4'),'allowNull':![]},'messageId':{'type':Sequelize['STRING'](0xbe)},'phone':{'type':Sequelize[_0xcb40('0x5')]},'readAt':{'type':Sequelize[_0xcb40('0x6')]},'secret':{'type':Sequelize[_0xcb40('0x3')],'defaultValue':![]},'providerName':{'type':Sequelize[_0xcb40('0x5')]},'providerResponse':{'type':Sequelize[_0xcb40('0x2')]}}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.controller.js b/server/api/smsMessage/smsMessage.controller.js index be1d091..9aa8213 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 _0x3f48=['limit','set','Content-Range','apply','reject','update','destroy','then','stack','name','send','index','map','SmsMessage','rawAttributes','type','query','keys','filters','intersection','model','fields','attributes','length','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','params','find','create','body','describe','sms-interactions','accept','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','SmsInteractionId','isNil','read1stAt','interaction','[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','AcceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT','User','fullname','internal','manual','interface','channel','motionChannel','event','EventManager','acceptmessage','SmsInteraction','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','RejectMessage','rejectMessage','contact','email','SmsAccountId','received\x20delivery\x20report\x20from','twilio','MessageSid','messageId','SmsAccount,\x20%s,\x20%s,\x20%s','inspect','plivo','MessageUUID','indexOf','sent','Status','plivio','infobip','groupName','DELIVERED','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./smsMessage.socket','register','client','http','request','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','sendStatus','status','end','json','undefined','count','offset'];(function(_0x556d3d,_0x11b936){var _0x3d134c=function(_0x522f52){while(--_0x522f52){_0x556d3d['push'](_0x556d3d['shift']());}};_0x3d134c(++_0x11b936);}(_0x3f48,0x17c));var _0x83f4=function(_0x2b932c,_0xf396f0){_0x2b932c=_0x2b932c-0x0;var _0x143a60=_0x3f48[_0x2b932c];return _0x143a60;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x83f4('0x0'));var jsonpatch=require(_0x83f4('0x1'));var rp=require(_0x83f4('0x2'));var moment=require(_0x83f4('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x83f4('0x4'));var util=require(_0x83f4('0x5'));var path=require('path');var sox=require(_0x83f4('0x6'));var csv=require('to-csv');var ejs=require(_0x83f4('0x7'));var fs=require('fs');var fs_extra=require(_0x83f4('0x8'));var _=require(_0x83f4('0x9'));var squel=require(_0x83f4('0xa'));var crypto=require(_0x83f4('0xb'));var jsforce=require(_0x83f4('0xc'));var deskjs=require(_0x83f4('0xd'));var toCsv=require(_0x83f4('0xe'));var querystring=require('querystring');var Papa=require(_0x83f4('0xf'));var Redis=require(_0x83f4('0x10'));var authService=require(_0x83f4('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x83f4('0x12'))(_0x83f4('0x13'));var utils=require(_0x83f4('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x83f4('0x15'));var db=require(_0x83f4('0x16'))['db'];config['redis']=_[_0x83f4('0x17')](config[_0x83f4('0x18')],{'host':_0x83f4('0x19'),'port':0x18eb});var socket=require(_0x83f4('0x1a'))(new Redis(config[_0x83f4('0x18')]));require(_0x83f4('0x1b'))[_0x83f4('0x1c')](socket);var jayson=require('jayson/promise');var client=jayson[_0x83f4('0x1d')][_0x83f4('0x1e')]({'port':0x232c});var client9002=jayson[_0x83f4('0x1d')][_0x83f4('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x38f762,_0x11dc6d,_0x4f0f62,_0x1b5626){return new BPromise(function(_0x37dbac,_0x239e1e){var _0x202511=_0x1b5626||client;return _0x202511[_0x83f4('0x1f')](_0x38f762,_0x4f0f62)['then'](function(_0x1b4702){logger['info'](_0x83f4('0x20'),_0x11dc6d,_0x83f4('0x21'));logger[_0x83f4('0x22')](_0x83f4('0x23'),_0x11dc6d,_0x83f4('0x21'),JSON[_0x83f4('0x24')](_0x1b4702));if(_0x1b4702['error']){if(_0x1b4702[_0x83f4('0x25')][_0x83f4('0x26')]===0x1f4){logger[_0x83f4('0x25')](_0x83f4('0x20'),_0x11dc6d,_0x1b4702['error']['message']);return _0x239e1e(_0x1b4702[_0x83f4('0x25')][_0x83f4('0x27')]);}logger[_0x83f4('0x25')](_0x83f4('0x20'),_0x11dc6d,_0x1b4702['error'][_0x83f4('0x27')]);return _0x37dbac(_0x1b4702[_0x83f4('0x25')][_0x83f4('0x27')]);}else{logger[_0x83f4('0x28')]('SmsMessage,\x20%s,\x20%s',_0x11dc6d,_0x83f4('0x21'));_0x37dbac(_0x1b4702['result'][_0x83f4('0x27')]);}})[_0x83f4('0x29')](function(_0x224d63){logger[_0x83f4('0x25')](_0x83f4('0x20'),_0x11dc6d,_0x224d63);_0x239e1e(_0x224d63);});});}function respondWithStatusCode(_0x46d0d3,_0x7b3d0c){_0x7b3d0c=_0x7b3d0c||0xcc;return function(_0x2a0d34){if(_0x2a0d34){return _0x46d0d3[_0x83f4('0x2a')](_0x7b3d0c);}return _0x46d0d3[_0x83f4('0x2b')](_0x7b3d0c)[_0x83f4('0x2c')]();};}function respondWithResult(_0x4fa94f,_0x2530be){_0x2530be=_0x2530be||0xc8;return function(_0x4eeab6){if(_0x4eeab6){return _0x4fa94f['status'](_0x2530be)[_0x83f4('0x2d')](_0x4eeab6);}};}function respondWithFilteredResult(_0x5f17f5,_0x250693){return function(_0xbc819e){if(_0xbc819e){var _0x139913=typeof _0x250693['offset']==='undefined'&&typeof _0x250693['limit']===_0x83f4('0x2e');var _0x410a42=_0xbc819e[_0x83f4('0x2f')];var _0x1b48fa=_0x139913?0x0:_0x250693['offset'];var _0x29350b=_0x139913?_0xbc819e[_0x83f4('0x2f')]:_0x250693[_0x83f4('0x30')]+_0x250693[_0x83f4('0x31')];var _0x43cf2d;if(_0x29350b>=_0x410a42){_0x29350b=_0x410a42;_0x43cf2d=0xc8;}else{_0x43cf2d=0xce;}_0x5f17f5[_0x83f4('0x2b')](_0x43cf2d);return _0x5f17f5[_0x83f4('0x32')](_0x83f4('0x33'),_0x1b48fa+'-'+_0x29350b+'/'+_0x410a42)['json'](_0xbc819e);}return null;};}function patchUpdates(_0x203d08){return function(_0x55040d){try{jsonpatch[_0x83f4('0x34')](_0x55040d,_0x203d08,!![]);}catch(_0x520a90){return BPromise[_0x83f4('0x35')](_0x520a90);}return _0x55040d['save']();};}function saveUpdates(_0xae4f66,_0x2d7ed3){return function(_0x5a7084){if(_0x5a7084){return _0x5a7084[_0x83f4('0x36')](_0xae4f66)['then'](function(_0x461f7e){return _0x461f7e;});}return null;};}function removeEntity(_0x593de5,_0x209199){return function(_0x5e7ca3){if(_0x5e7ca3){return _0x5e7ca3[_0x83f4('0x37')]()[_0x83f4('0x38')](function(){_0x593de5[_0x83f4('0x2b')](0xcc)[_0x83f4('0x2c')]();});}};}function handleEntityNotFound(_0x383495,_0x16d082){return function(_0x5ebafc){if(!_0x5ebafc){_0x383495[_0x83f4('0x2a')](0x194);}return _0x5ebafc;};}function handleError(_0x2a88d5,_0x3e2d5f){_0x3e2d5f=_0x3e2d5f||0x1f4;return function(_0x238a11){logger[_0x83f4('0x25')](_0x238a11[_0x83f4('0x39')]);if(_0x238a11[_0x83f4('0x3a')]){delete _0x238a11[_0x83f4('0x3a')];}_0x2a88d5[_0x83f4('0x2b')](_0x3e2d5f)[_0x83f4('0x3b')](_0x238a11);};}exports[_0x83f4('0x3c')]=function(_0x3a7c22,_0x3f25e9){var _0x6370fa={},_0x3cca5b={},_0x6f9555={'count':0x0,'rows':[]};var _0xb1825a=_[_0x83f4('0x3d')](db[_0x83f4('0x3e')][_0x83f4('0x3f')],function(_0xeb9761){return{'name':_0xeb9761['fieldName'],'type':_0xeb9761[_0x83f4('0x40')]['key']};});_0x3cca5b['model']=_[_0x83f4('0x3d')](_0xb1825a,_0x83f4('0x3a'));_0x3cca5b[_0x83f4('0x41')]=_[_0x83f4('0x42')](_0x3a7c22['query']);_0x3cca5b[_0x83f4('0x43')]=_[_0x83f4('0x44')](_0x3cca5b[_0x83f4('0x45')],_0x3cca5b[_0x83f4('0x41')]);_0x6370fa['attributes']=_[_0x83f4('0x44')](_0x3cca5b[_0x83f4('0x45')],qs[_0x83f4('0x46')](_0x3a7c22[_0x83f4('0x41')][_0x83f4('0x46')]));_0x6370fa[_0x83f4('0x47')]=_0x6370fa[_0x83f4('0x47')][_0x83f4('0x48')]?_0x6370fa['attributes']:_0x3cca5b[_0x83f4('0x45')];if(!_0x3a7c22[_0x83f4('0x41')]['hasOwnProperty']('nolimit')){_0x6370fa[_0x83f4('0x31')]=qs[_0x83f4('0x31')](_0x3a7c22[_0x83f4('0x41')][_0x83f4('0x31')]);_0x6370fa[_0x83f4('0x30')]=qs[_0x83f4('0x30')](_0x3a7c22[_0x83f4('0x41')][_0x83f4('0x30')]);}_0x6370fa['order']=qs[_0x83f4('0x49')](_0x3a7c22['query'][_0x83f4('0x49')]);_0x6370fa[_0x83f4('0x4a')]=qs[_0x83f4('0x43')](_[_0x83f4('0x4b')](_0x3a7c22[_0x83f4('0x41')],_0x3cca5b['filters']),_0xb1825a);if(_0x3a7c22['query'][_0x83f4('0x4c')]){_0x6370fa[_0x83f4('0x4a')]=_[_0x83f4('0x4d')](_0x6370fa[_0x83f4('0x4a')],{'$or':_[_0x83f4('0x3d')](_0xb1825a,function(_0x581cf4){if(_0x581cf4[_0x83f4('0x40')]!==_0x83f4('0x4e')){var _0x1ecac6={};_0x1ecac6[_0x581cf4[_0x83f4('0x3a')]]={'$like':'%'+_0x3a7c22[_0x83f4('0x41')]['filter']+'%'};return _0x1ecac6;}})});}_0x6370fa=_[_0x83f4('0x4d')]({},_0x6370fa,_0x3a7c22[_0x83f4('0x4f')]);var _0x67f0be={'where':_0x6370fa['where']};return db[_0x83f4('0x3e')]['count'](_0x67f0be)['then'](function(_0x5d1493){_0x6f9555[_0x83f4('0x2f')]=_0x5d1493;if(_0x3a7c22[_0x83f4('0x41')][_0x83f4('0x50')]){_0x6370fa[_0x83f4('0x51')]=[{'all':!![]}];}return db[_0x83f4('0x3e')][_0x83f4('0x52')](_0x6370fa);})[_0x83f4('0x38')](function(_0xa35ad9){_0x6f9555[_0x83f4('0x53')]=_0xa35ad9;return _0x6f9555;})[_0x83f4('0x38')](respondWithFilteredResult(_0x3f25e9,_0x6370fa))[_0x83f4('0x29')](handleError(_0x3f25e9,null));};exports['show']=function(_0x47bb2d,_0x49e769){var _0x89038d={'raw':!![],'where':{'id':_0x47bb2d[_0x83f4('0x54')]['id']}},_0x1eb62f={};_0x1eb62f[_0x83f4('0x45')]=_['keys'](db[_0x83f4('0x3e')][_0x83f4('0x3f')]);_0x1eb62f['query']=_['keys'](_0x47bb2d[_0x83f4('0x41')]);_0x1eb62f[_0x83f4('0x43')]=_['intersection'](_0x1eb62f[_0x83f4('0x45')],_0x1eb62f[_0x83f4('0x41')]);_0x89038d[_0x83f4('0x47')]=_['intersection'](_0x1eb62f[_0x83f4('0x45')],qs[_0x83f4('0x46')](_0x47bb2d[_0x83f4('0x41')][_0x83f4('0x46')]));_0x89038d[_0x83f4('0x47')]=_0x89038d[_0x83f4('0x47')][_0x83f4('0x48')]?_0x89038d[_0x83f4('0x47')]:_0x1eb62f['model'];if(_0x47bb2d['query'][_0x83f4('0x50')]){_0x89038d[_0x83f4('0x51')]=[{'all':!![]}];}_0x89038d=_[_0x83f4('0x4d')]({},_0x89038d,_0x47bb2d[_0x83f4('0x4f')]);return db['SmsMessage'][_0x83f4('0x55')](_0x89038d)[_0x83f4('0x38')](handleEntityNotFound(_0x49e769,null))['then'](respondWithResult(_0x49e769,null))['catch'](handleError(_0x49e769,null));};exports['create']=function(_0x2970ae,_0x44ad00){return db[_0x83f4('0x3e')][_0x83f4('0x56')](_0x2970ae[_0x83f4('0x57')],{})['then'](respondWithResult(_0x44ad00,0xc9))[_0x83f4('0x29')](handleError(_0x44ad00,null));};exports[_0x83f4('0x36')]=function(_0x23386b,_0x4f2ec7){if(_0x23386b[_0x83f4('0x57')]['id']){delete _0x23386b[_0x83f4('0x57')]['id'];}return db[_0x83f4('0x3e')]['find']({'where':{'id':_0x23386b['params']['id']}})[_0x83f4('0x38')](handleEntityNotFound(_0x4f2ec7,null))[_0x83f4('0x38')](saveUpdates(_0x23386b['body'],null))[_0x83f4('0x38')](respondWithResult(_0x4f2ec7,null))[_0x83f4('0x29')](handleError(_0x4f2ec7,null));};exports[_0x83f4('0x37')]=function(_0x52888b,_0x360396){return db[_0x83f4('0x3e')][_0x83f4('0x55')]({'where':{'id':_0x52888b['params']['id']}})[_0x83f4('0x38')](handleEntityNotFound(_0x360396,null))['then'](removeEntity(_0x360396,null))[_0x83f4('0x29')](handleError(_0x360396,null));};exports[_0x83f4('0x58')]=function(_0xdaf4ed,_0x36b804){return db[_0x83f4('0x3e')][_0x83f4('0x58')]()[_0x83f4('0x38')](respondWithResult(_0x36b804,null))[_0x83f4('0x29')](handleError(_0x36b804,null));};var interaction_log=require(_0x83f4('0x12'))(_0x83f4('0x59'));exports[_0x83f4('0x5a')]=function(_0x155c62,_0x299b1c,_0x47c000){var _0x424cea={'agent':{},'channel':'sms'};if(_0x155c62['body']['id']){delete _0x155c62[_0x83f4('0x57')]['id'];}_0x155c62[_0x83f4('0x57')]['read']=!![];_0x155c62[_0x83f4('0x57')][_0x83f4('0x5b')]=moment()[_0x83f4('0x5c')](_0x83f4('0x5d'));_0x155c62['body'][_0x83f4('0x5e')]=_0x155c62[_0x83f4('0x57')][_0x83f4('0x5e')]||_0x155c62[_0x83f4('0x5f')]['id'];_0x424cea[_0x83f4('0x60')]['id']=_0x155c62[_0x83f4('0x57')][_0x83f4('0x5e')];return db[_0x83f4('0x3e')][_0x83f4('0x55')]({'where':{'id':_0x155c62['params']['id'],'UserId':null}})[_0x83f4('0x38')](handleEntityNotFound(_0x299b1c,null))['then'](saveUpdates(_0x155c62[_0x83f4('0x57')],null))[_0x83f4('0x38')](function(_0x34d313){if(_0x34d313){_0x424cea[_0x83f4('0x27')]=_0x34d313['get']({'plain':!![]});return db['SmsInteraction'][_0x83f4('0x55')]({'where':{'id':_0x34d313[_0x83f4('0x61')]}});}return null;})[_0x83f4('0x38')](handleEntityNotFound(_0x299b1c,null))[_0x83f4('0x38')](function(_0x30e376){if(_0x30e376){return _0x30e376[_0x83f4('0x36')]({'UserId':_0x155c62[_0x83f4('0x57')][_0x83f4('0x5e')],'read1stAt':_[_0x83f4('0x62')](_0x30e376[_0x83f4('0x63')])?moment()[_0x83f4('0x5c')](_0x83f4('0x5d')):undefined});}return null;})[_0x83f4('0x38')](function(_0x3b1a50){if(_0x3b1a50){_0x424cea[_0x83f4('0x64')]=_0x3b1a50['get']({'plain':!![]});interaction_log[_0x83f4('0x28')](_0x83f4('0x65'),_0x155c62[_0x83f4('0x5f')]['id'],_0x155c62[_0x83f4('0x5f')][_0x83f4('0x3a')],_0x155c62[_0x83f4('0x5f')]['role'],_0x424cea[_0x83f4('0x64')]['id'],_0x155c62[_0x83f4('0x57')]?JSON[_0x83f4('0x24')](_0x155c62['body']):'null');return respondWithRpcPromise(_0x83f4('0x66'),'acceptMessage',_0x424cea);}return null;})[_0x83f4('0x38')](function(_0x43b202){var _0x50d524=_0x83f4('0x67')+_0x43b202[_0x83f4('0x27')][_0x83f4('0x68')];return db[_0x83f4('0x69')][_0x83f4('0x41')](_0x50d524,{'type':db[_0x83f4('0x6a')][_0x83f4('0x6b')][_0x83f4('0x6c')],'raw':!![]})[_0x83f4('0x38')](function(_0x4d0c4a){return _0x4d0c4a;});})[_0x83f4('0x38')](function(_0x380740){if(_0x380740){_0x424cea['message']['contact']=_0x380740[0x0];if(!_0x155c62[_0x83f4('0x57')][_0x83f4('0x5e')])return;return db[_0x83f4('0x6d')][_0x83f4('0x55')]({'where':{'id':_0x155c62[_0x83f4('0x57')][_0x83f4('0x5e')],'role':_0x83f4('0x60')},'attributes':['id',_0x83f4('0x3a'),_0x83f4('0x6e'),'email',_0x83f4('0x6f')],'raw':!![]});}return null;})[_0x83f4('0x38')](function(_0x1ba29f){if(!_0x1ba29f)return null;_0x424cea[_0x83f4('0x27')]['agent']=_0x1ba29f;return _0x424cea;})[_0x83f4('0x38')](function(_0x33b972){if(_0x33b972){if(_0x155c62[_0x83f4('0x57')][_0x83f4('0x70')]){_0x424cea[_0x83f4('0x27')][_0x83f4('0x71')]=util[_0x83f4('0x5c')]('SIP/%s',_0x155c62[_0x83f4('0x5f')][_0x83f4('0x3a')]);_0x424cea[_0x83f4('0x27')]['channel']=_0x424cea[_0x83f4('0x72')];_0x424cea[_0x83f4('0x27')][_0x83f4('0x73')]=_0x424cea[_0x83f4('0x72')];_0x424cea[_0x83f4('0x27')][_0x83f4('0x74')]=_0x83f4('0x5a');return respondWithRpcPromise('EventManager',_0x83f4('0x75'),{'event':_0x83f4('0x76'),'message':_0x424cea[_0x83f4('0x27')]},client9002)[_0x83f4('0x38')](function(){return _0x424cea;});}return _0x424cea;}return null;})['then'](respondWithResult(_0x299b1c,null))[_0x83f4('0x29')](handleError(_0x299b1c,null));};var interaction_log=require(_0x83f4('0x12'))(_0x83f4('0x59'));exports['reject']=function(_0x515d97,_0x5b6ea9,_0xc070a6){var _0x4bce8e={'agent':{},'channel':'sms'};if(_0x515d97[_0x83f4('0x57')]['id']){delete _0x515d97[_0x83f4('0x57')]['id'];}_0x515d97[_0x83f4('0x57')][_0x83f4('0x5e')]=_0x515d97[_0x83f4('0x57')][_0x83f4('0x5e')]||_0x515d97[_0x83f4('0x5f')]['id'];_0x4bce8e[_0x83f4('0x60')]['id']=_0x515d97[_0x83f4('0x57')]['UserId'];return db[_0x83f4('0x3e')][_0x83f4('0x55')]({'where':{'id':_0x515d97[_0x83f4('0x54')]['id'],'UserId':null}})[_0x83f4('0x38')](handleEntityNotFound(_0x5b6ea9,null))[_0x83f4('0x38')](function(_0x33c07b){if(_0x33c07b){_0x4bce8e[_0x83f4('0x27')]=_0x33c07b['get']({'plain':!![]});return db[_0x83f4('0x77')][_0x83f4('0x55')]({'where':{'id':_0x33c07b[_0x83f4('0x61')]}});}return null;})[_0x83f4('0x38')](handleEntityNotFound(_0x5b6ea9,null))['then'](function(_0x560f10){if(_0x560f10){_0x4bce8e['interaction']=_0x560f10['get']({'plain':!![]});interaction_log[_0x83f4('0x28')](_0x83f4('0x78'),_0x515d97['user']['id'],_0x515d97[_0x83f4('0x5f')][_0x83f4('0x3a')],_0x515d97['user'][_0x83f4('0x79')],_0x4bce8e[_0x83f4('0x64')]['id'],_0x515d97[_0x83f4('0x57')]?JSON[_0x83f4('0x24')](_0x515d97[_0x83f4('0x57')]):_0x83f4('0x7a'));return respondWithRpcPromise(_0x83f4('0x7b'),_0x83f4('0x7c'),_0x4bce8e);}return null;})[_0x83f4('0x38')](function(_0x1ca25d){var _0x391104='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x1ca25d['message']['ContactId'];return db['sequelize']['query'](_0x391104,{'type':db['Sequelize'][_0x83f4('0x6b')][_0x83f4('0x6c')],'raw':!![]})[_0x83f4('0x38')](function(_0x4028f0){return _0x4028f0;});})[_0x83f4('0x38')](function(_0x37565e){if(_0x37565e){_0x4bce8e['message'][_0x83f4('0x7d')]=_0x37565e[0x0];if(!_0x515d97[_0x83f4('0x57')][_0x83f4('0x5e')])return;return db['User'][_0x83f4('0x55')]({'where':{'id':_0x515d97['body'][_0x83f4('0x5e')],'role':_0x83f4('0x60')},'attributes':['id',_0x83f4('0x3a'),_0x83f4('0x6e'),_0x83f4('0x7e'),_0x83f4('0x6f')],'raw':!![]});}return null;})[_0x83f4('0x38')](function(_0x544633){if(!_0x544633)return null;_0x4bce8e[_0x83f4('0x27')]['agent']=_0x544633;return _0x4bce8e;})[_0x83f4('0x38')](function(_0x30b691){if(_0x30b691){_0x30b691[_0x83f4('0x27')][_0x83f4('0x71')]=util['format']('SIP/%s',_0x515d97['user'][_0x83f4('0x3a')]);_0x30b691[_0x83f4('0x27')][_0x83f4('0x72')]=_0x4bce8e[_0x83f4('0x72')];_0x30b691['message'][_0x83f4('0x73')]=_0x4bce8e['channel'];_0x30b691['message'][_0x83f4('0x74')]=_0x83f4('0x35');respondWithRpcPromise(_0x83f4('0x75'),_0x83f4('0x75'),{'event':'rejectmessage','message':_0x30b691[_0x83f4('0x27')]},client9002);return _0x4bce8e;}return null;})[_0x83f4('0x38')](respondWithResult(_0x5b6ea9,null))['catch'](handleError(_0x5b6ea9,null));};exports['status']=function(_0x295012,_0x3ee3fb,_0x171c9e){if(_0x295012[_0x83f4('0x57')]['id']){delete _0x295012[_0x83f4('0x57')]['id'];}var _0x529b79;return db[_0x83f4('0x3e')][_0x83f4('0x55')]({'where':{'id':_0x295012[_0x83f4('0x54')]['id']}})[_0x83f4('0x38')](handleEntityNotFound(_0x3ee3fb,null))[_0x83f4('0x38')](function(_0x2d755a){if(_0x2d755a){_0x529b79=_0x2d755a;return db['SmsAccount'][_0x83f4('0x55')]({'where':{'id':_0x2d755a[_0x83f4('0x7f')]}});}})[_0x83f4('0x38')](handleEntityNotFound(_0x3ee3fb,null))[_0x83f4('0x38')](function(_0xbfa991){if(_0xbfa991){logger[_0x83f4('0x22')](_0x83f4('0x23'),_0x83f4('0x2b'),_0x83f4('0x80'),_0xbfa991['type'],util['inspect'](_0x295012['body'],{'showHidden':![],'depth':null}));switch(_0xbfa991[_0x83f4('0x40')]){case _0x83f4('0x81'):if(_0x295012['body'][_0x83f4('0x82')]&&_0x295012[_0x83f4('0x57')]['MessageSid']===_0x529b79[_0x83f4('0x83')]){return _0x529b79[_0x83f4('0x36')]({'read':!![]});}else{logger[_0x83f4('0x25')](_0x83f4('0x84'),'status',_0x83f4('0x81'),util[_0x83f4('0x85')](_0x295012[_0x83f4('0x57')],{'showHidden':![],'depth':null}));}break;case _0x83f4('0x86'):if(_0x295012['body'][_0x83f4('0x87')]&&_0x295012[_0x83f4('0x57')]['MessageUUID']===_0x529b79[_0x83f4('0x83')]&&_[_0x83f4('0x88')]([_0x83f4('0x89'),'delivered'],_0x295012[_0x83f4('0x57')][_0x83f4('0x8a')])>=0x0){return _0x529b79[_0x83f4('0x36')]({'read':!![]});}else{logger['error'](_0x83f4('0x84'),_0x83f4('0x2b'),_0x83f4('0x8b'),util[_0x83f4('0x85')](_0x295012[_0x83f4('0x57')],{'showHidden':![],'depth':null}));}break;case _0x83f4('0x8c'):var _0x4f467c=_0x295012[_0x83f4('0x57')]['results'][0x0];if(_0x4f467c['status'][_0x83f4('0x8d')]===_0x83f4('0x8e')){return _0x529b79[_0x83f4('0x36')]({'read':!![]});}else{logger[_0x83f4('0x25')](_0x83f4('0x84'),_0x83f4('0x2b'),_0x83f4('0x8c'),util[_0x83f4('0x85')](_0x295012[_0x83f4('0x57')],{'showHidden':![],'depth':null}));}break;}return _0x529b79;}})[_0x83f4('0x38')](respondWithResult(_0x3ee3fb,null))[_0x83f4('0x29')](handleError(_0x3ee3fb,null));}; \ No newline at end of file +var _0xb758=['internal','manual','channel','motionChannel','event','EventManager','acceptmessage','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','SELECT','interface','SIP/%s','SmsAccountId','received\x20delivery\x20report\x20from','inspect','MessageSid','messageId','SmsAccount,\x20%s,\x20%s,\x20%s','twilio','plivo','MessageUUID','indexOf','sent','delivered','plivio','infobip','results','DELIVERED','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','path','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/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','./smsMessage.socket','register','jayson/promise','client','http','info','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','json','offset','undefined','count','apply','reject','save','update','then','destroy','stack','name','send','index','map','SmsMessage','rawAttributes','fieldName','type','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','filter','merge','VIRTUAL','includeAll','include','rows','show','params','keys','options','find','create','body','describe','sms-interactions','sms','read','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','SmsInteraction','SmsInteractionId','isNil','read1stAt','format','interaction','get','role','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','Sequelize','QueryTypes','contact','User','fullname','email'];(function(_0x407cb1,_0x2b1ac1){var _0x11bd3b=function(_0x5de5b3){while(--_0x5de5b3){_0x407cb1['push'](_0x407cb1['shift']());}};_0x11bd3b(++_0x2b1ac1);}(_0xb758,0x14a));var _0x8b75=function(_0x3c2b2e,_0x3e6e53){_0x3c2b2e=_0x3c2b2e-0x0;var _0x27a338=_0xb758[_0x3c2b2e];return _0x27a338;};'use strict';var emlformat=require(_0x8b75('0x0'));var rimraf=require(_0x8b75('0x1'));var zipdir=require(_0x8b75('0x2'));var jsonpatch=require(_0x8b75('0x3'));var rp=require('request-promise');var moment=require(_0x8b75('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x8b75('0x5'));var util=require('util');var path=require(_0x8b75('0x6'));var sox=require(_0x8b75('0x7'));var csv=require('to-csv');var ejs=require(_0x8b75('0x8'));var fs=require('fs');var fs_extra=require(_0x8b75('0x9'));var _=require(_0x8b75('0xa'));var squel=require(_0x8b75('0xb'));var crypto=require(_0x8b75('0xc'));var jsforce=require(_0x8b75('0xd'));var deskjs=require(_0x8b75('0xe'));var toCsv=require(_0x8b75('0xf'));var querystring=require(_0x8b75('0x10'));var Papa=require(_0x8b75('0x11'));var Redis=require(_0x8b75('0x12'));var authService=require(_0x8b75('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x8b75('0x14'));var hardwareService=require(_0x8b75('0x15'));var logger=require(_0x8b75('0x16'))(_0x8b75('0x17'));var utils=require(_0x8b75('0x18'));var config=require(_0x8b75('0x19'));var licenseUtil=require(_0x8b75('0x1a'));var db=require('../../mysqldb')['db'];config[_0x8b75('0x1b')]=_[_0x8b75('0x1c')](config['redis'],{'host':_0x8b75('0x1d'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x8b75('0x1b')]));require(_0x8b75('0x1e'))[_0x8b75('0x1f')](socket);var jayson=require(_0x8b75('0x20'));var client=jayson[_0x8b75('0x21')][_0x8b75('0x22')]({'port':0x232c});var client9002=jayson[_0x8b75('0x21')]['http']({'port':0x232a});function respondWithRpcPromise(_0x10b52c,_0x1f48a7,_0x32a73f,_0x78e366){return new BPromise(function(_0x1aed0a,_0x286df6){var _0x3367a=_0x78e366||client;return _0x3367a['request'](_0x10b52c,_0x32a73f)['then'](function(_0x553587){logger[_0x8b75('0x23')](_0x8b75('0x24'),_0x1f48a7,_0x8b75('0x25'));logger[_0x8b75('0x26')](_0x8b75('0x27'),_0x1f48a7,_0x8b75('0x25'),JSON[_0x8b75('0x28')](_0x553587));if(_0x553587[_0x8b75('0x29')]){if(_0x553587['error'][_0x8b75('0x2a')]===0x1f4){logger[_0x8b75('0x29')]('SmsMessage,\x20%s,\x20%s',_0x1f48a7,_0x553587[_0x8b75('0x29')]['message']);return _0x286df6(_0x553587['error']['message']);}logger[_0x8b75('0x29')](_0x8b75('0x24'),_0x1f48a7,_0x553587[_0x8b75('0x29')][_0x8b75('0x2b')]);return _0x1aed0a(_0x553587[_0x8b75('0x29')][_0x8b75('0x2b')]);}else{logger['info'](_0x8b75('0x24'),_0x1f48a7,_0x8b75('0x25'));_0x1aed0a(_0x553587[_0x8b75('0x2c')]['message']);}})[_0x8b75('0x2d')](function(_0x53bdc9){logger['error']('SmsMessage,\x20%s,\x20%s',_0x1f48a7,_0x53bdc9);_0x286df6(_0x53bdc9);});});}function respondWithStatusCode(_0x6b7b21,_0x273cb7){_0x273cb7=_0x273cb7||0xcc;return function(_0x4663a0){if(_0x4663a0){return _0x6b7b21[_0x8b75('0x2e')](_0x273cb7);}return _0x6b7b21[_0x8b75('0x2f')](_0x273cb7)[_0x8b75('0x30')]();};}function respondWithResult(_0x4d3fbd,_0x3f9b7c){_0x3f9b7c=_0x3f9b7c||0xc8;return function(_0x473532){if(_0x473532){return _0x4d3fbd[_0x8b75('0x2f')](_0x3f9b7c)[_0x8b75('0x31')](_0x473532);}};}function respondWithFilteredResult(_0xe5d5cf,_0x5bac9a){return function(_0x18f40f){if(_0x18f40f){var _0xe35c84=typeof _0x5bac9a[_0x8b75('0x32')]===_0x8b75('0x33')&&typeof _0x5bac9a['limit']===_0x8b75('0x33');var _0x4b7606=_0x18f40f[_0x8b75('0x34')];var _0x160588=_0xe35c84?0x0:_0x5bac9a['offset'];var _0x3bb985=_0xe35c84?_0x18f40f[_0x8b75('0x34')]:_0x5bac9a[_0x8b75('0x32')]+_0x5bac9a['limit'];var _0x1fd454;if(_0x3bb985>=_0x4b7606){_0x3bb985=_0x4b7606;_0x1fd454=0xc8;}else{_0x1fd454=0xce;}_0xe5d5cf[_0x8b75('0x2f')](_0x1fd454);return _0xe5d5cf['set']('Content-Range',_0x160588+'-'+_0x3bb985+'/'+_0x4b7606)[_0x8b75('0x31')](_0x18f40f);}return null;};}function patchUpdates(_0x59263d){return function(_0x1b094f){try{jsonpatch[_0x8b75('0x35')](_0x1b094f,_0x59263d,!![]);}catch(_0x12e266){return BPromise[_0x8b75('0x36')](_0x12e266);}return _0x1b094f[_0x8b75('0x37')]();};}function saveUpdates(_0x1a09b6,_0x45da4b){return function(_0x5af8c6){if(_0x5af8c6){return _0x5af8c6[_0x8b75('0x38')](_0x1a09b6)[_0x8b75('0x39')](function(_0x487f20){return _0x487f20;});}return null;};}function removeEntity(_0x2292cf,_0x3c7be6){return function(_0x5cc0a3){if(_0x5cc0a3){return _0x5cc0a3[_0x8b75('0x3a')]()[_0x8b75('0x39')](function(){_0x2292cf[_0x8b75('0x2f')](0xcc)[_0x8b75('0x30')]();});}};}function handleEntityNotFound(_0x4eff9d,_0x530123){return function(_0x859140){if(!_0x859140){_0x4eff9d[_0x8b75('0x2e')](0x194);}return _0x859140;};}function handleError(_0x3b7b58,_0x2f2fb7){_0x2f2fb7=_0x2f2fb7||0x1f4;return function(_0x2b9b58){logger[_0x8b75('0x29')](_0x2b9b58[_0x8b75('0x3b')]);if(_0x2b9b58[_0x8b75('0x3c')]){delete _0x2b9b58[_0x8b75('0x3c')];}_0x3b7b58[_0x8b75('0x2f')](_0x2f2fb7)[_0x8b75('0x3d')](_0x2b9b58);};}exports[_0x8b75('0x3e')]=function(_0x43d831,_0x118794){var _0x2c3e4c={},_0x585c13={},_0x4bdcc2={'count':0x0,'rows':[]};var _0x358bba=_[_0x8b75('0x3f')](db[_0x8b75('0x40')][_0x8b75('0x41')],function(_0x5bc8ac){return{'name':_0x5bc8ac[_0x8b75('0x42')],'type':_0x5bc8ac[_0x8b75('0x43')][_0x8b75('0x44')]};});_0x585c13['model']=_[_0x8b75('0x3f')](_0x358bba,_0x8b75('0x3c'));_0x585c13[_0x8b75('0x45')]=_['keys'](_0x43d831[_0x8b75('0x45')]);_0x585c13[_0x8b75('0x46')]=_[_0x8b75('0x47')](_0x585c13[_0x8b75('0x48')],_0x585c13[_0x8b75('0x45')]);_0x2c3e4c[_0x8b75('0x49')]=_[_0x8b75('0x47')](_0x585c13[_0x8b75('0x48')],qs[_0x8b75('0x4a')](_0x43d831['query'][_0x8b75('0x4a')]));_0x2c3e4c[_0x8b75('0x49')]=_0x2c3e4c['attributes'][_0x8b75('0x4b')]?_0x2c3e4c[_0x8b75('0x49')]:_0x585c13[_0x8b75('0x48')];if(!_0x43d831['query'][_0x8b75('0x4c')](_0x8b75('0x4d'))){_0x2c3e4c[_0x8b75('0x4e')]=qs[_0x8b75('0x4e')](_0x43d831[_0x8b75('0x45')][_0x8b75('0x4e')]);_0x2c3e4c[_0x8b75('0x32')]=qs[_0x8b75('0x32')](_0x43d831[_0x8b75('0x45')][_0x8b75('0x32')]);}_0x2c3e4c[_0x8b75('0x4f')]=qs[_0x8b75('0x50')](_0x43d831['query'][_0x8b75('0x50')]);_0x2c3e4c[_0x8b75('0x51')]=qs[_0x8b75('0x46')](_['pick'](_0x43d831['query'],_0x585c13[_0x8b75('0x46')]),_0x358bba);if(_0x43d831[_0x8b75('0x45')][_0x8b75('0x52')]){_0x2c3e4c['where']=_[_0x8b75('0x53')](_0x2c3e4c[_0x8b75('0x51')],{'$or':_[_0x8b75('0x3f')](_0x358bba,function(_0x4092f5){if(_0x4092f5[_0x8b75('0x43')]!==_0x8b75('0x54')){var _0x36079d={};_0x36079d[_0x4092f5[_0x8b75('0x3c')]]={'$like':'%'+_0x43d831['query']['filter']+'%'};return _0x36079d;}})});}_0x2c3e4c=_[_0x8b75('0x53')]({},_0x2c3e4c,_0x43d831['options']);var _0x5f5d3c={'where':_0x2c3e4c[_0x8b75('0x51')]};return db[_0x8b75('0x40')][_0x8b75('0x34')](_0x5f5d3c)['then'](function(_0x4b0a5c){_0x4bdcc2[_0x8b75('0x34')]=_0x4b0a5c;if(_0x43d831[_0x8b75('0x45')][_0x8b75('0x55')]){_0x2c3e4c[_0x8b75('0x56')]=[{'all':!![]}];}return db['SmsMessage']['findAll'](_0x2c3e4c);})[_0x8b75('0x39')](function(_0x37d21a){_0x4bdcc2[_0x8b75('0x57')]=_0x37d21a;return _0x4bdcc2;})[_0x8b75('0x39')](respondWithFilteredResult(_0x118794,_0x2c3e4c))[_0x8b75('0x2d')](handleError(_0x118794,null));};exports[_0x8b75('0x58')]=function(_0x23df4c,_0x8318a3){var _0x25321e={'raw':!![],'where':{'id':_0x23df4c[_0x8b75('0x59')]['id']}},_0x2e41e8={};_0x2e41e8['model']=_[_0x8b75('0x5a')](db[_0x8b75('0x40')]['rawAttributes']);_0x2e41e8['query']=_[_0x8b75('0x5a')](_0x23df4c[_0x8b75('0x45')]);_0x2e41e8['filters']=_[_0x8b75('0x47')](_0x2e41e8['model'],_0x2e41e8[_0x8b75('0x45')]);_0x25321e['attributes']=_[_0x8b75('0x47')](_0x2e41e8[_0x8b75('0x48')],qs['fields'](_0x23df4c[_0x8b75('0x45')][_0x8b75('0x4a')]));_0x25321e[_0x8b75('0x49')]=_0x25321e[_0x8b75('0x49')][_0x8b75('0x4b')]?_0x25321e[_0x8b75('0x49')]:_0x2e41e8[_0x8b75('0x48')];if(_0x23df4c['query']['includeAll']){_0x25321e['include']=[{'all':!![]}];}_0x25321e=_[_0x8b75('0x53')]({},_0x25321e,_0x23df4c[_0x8b75('0x5b')]);return db[_0x8b75('0x40')][_0x8b75('0x5c')](_0x25321e)[_0x8b75('0x39')](handleEntityNotFound(_0x8318a3,null))[_0x8b75('0x39')](respondWithResult(_0x8318a3,null))[_0x8b75('0x2d')](handleError(_0x8318a3,null));};exports[_0x8b75('0x5d')]=function(_0x1613e7,_0x253946){return db[_0x8b75('0x40')][_0x8b75('0x5d')](_0x1613e7[_0x8b75('0x5e')],{})[_0x8b75('0x39')](respondWithResult(_0x253946,0xc9))[_0x8b75('0x2d')](handleError(_0x253946,null));};exports[_0x8b75('0x38')]=function(_0x2cf0be,_0x36a80d){if(_0x2cf0be[_0x8b75('0x5e')]['id']){delete _0x2cf0be[_0x8b75('0x5e')]['id'];}return db[_0x8b75('0x40')][_0x8b75('0x5c')]({'where':{'id':_0x2cf0be[_0x8b75('0x59')]['id']}})[_0x8b75('0x39')](handleEntityNotFound(_0x36a80d,null))[_0x8b75('0x39')](saveUpdates(_0x2cf0be['body'],null))[_0x8b75('0x39')](respondWithResult(_0x36a80d,null))[_0x8b75('0x2d')](handleError(_0x36a80d,null));};exports[_0x8b75('0x3a')]=function(_0x1f4ec5,_0x4da7fe){return db[_0x8b75('0x40')][_0x8b75('0x5c')]({'where':{'id':_0x1f4ec5[_0x8b75('0x59')]['id']}})[_0x8b75('0x39')](handleEntityNotFound(_0x4da7fe,null))[_0x8b75('0x39')](removeEntity(_0x4da7fe,null))[_0x8b75('0x2d')](handleError(_0x4da7fe,null));};exports[_0x8b75('0x5f')]=function(_0x107ef5,_0x387be1){return db[_0x8b75('0x40')][_0x8b75('0x5f')]()[_0x8b75('0x39')](respondWithResult(_0x387be1,null))[_0x8b75('0x2d')](handleError(_0x387be1,null));};var interaction_log=require(_0x8b75('0x16'))(_0x8b75('0x60'));exports['accept']=function(_0x47676d,_0x352566,_0x33e6a1){var _0x531064={'agent':{},'channel':_0x8b75('0x61')};if(_0x47676d['body']['id']){delete _0x47676d[_0x8b75('0x5e')]['id'];}_0x47676d[_0x8b75('0x5e')][_0x8b75('0x62')]=!![];_0x47676d[_0x8b75('0x5e')][_0x8b75('0x63')]=moment()['format'](_0x8b75('0x64'));_0x47676d[_0x8b75('0x5e')]['UserId']=_0x47676d['body'][_0x8b75('0x65')]||_0x47676d[_0x8b75('0x66')]['id'];_0x531064[_0x8b75('0x67')]['id']=_0x47676d[_0x8b75('0x5e')][_0x8b75('0x65')];return db['SmsMessage'][_0x8b75('0x5c')]({'where':{'id':_0x47676d[_0x8b75('0x59')]['id'],'UserId':null}})[_0x8b75('0x39')](handleEntityNotFound(_0x352566,null))['then'](saveUpdates(_0x47676d['body'],null))['then'](function(_0x347a46){if(_0x347a46){_0x531064['message']=_0x347a46['get']({'plain':!![]});return db[_0x8b75('0x68')][_0x8b75('0x5c')]({'where':{'id':_0x347a46[_0x8b75('0x69')]}});}return null;})['then'](handleEntityNotFound(_0x352566,null))[_0x8b75('0x39')](function(_0x33f70d){if(_0x33f70d){return _0x33f70d[_0x8b75('0x38')]({'UserId':_0x47676d['body'][_0x8b75('0x65')],'read1stAt':_[_0x8b75('0x6a')](_0x33f70d[_0x8b75('0x6b')])?moment()[_0x8b75('0x6c')](_0x8b75('0x64')):undefined});}return null;})[_0x8b75('0x39')](function(_0x4fbf76){if(_0x4fbf76){_0x531064[_0x8b75('0x6d')]=_0x4fbf76[_0x8b75('0x6e')]({'plain':!![]});interaction_log[_0x8b75('0x23')]('[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x47676d[_0x8b75('0x66')]['id'],_0x47676d[_0x8b75('0x66')][_0x8b75('0x3c')],_0x47676d[_0x8b75('0x66')][_0x8b75('0x6f')],_0x531064[_0x8b75('0x6d')]['id'],_0x47676d['body']?JSON[_0x8b75('0x28')](_0x47676d[_0x8b75('0x5e')]):_0x8b75('0x70'));return respondWithRpcPromise(_0x8b75('0x71'),_0x8b75('0x72'),_0x531064);}return null;})[_0x8b75('0x39')](function(_0x2d5a29){var _0x1157df=_0x8b75('0x73')+_0x2d5a29[_0x8b75('0x2b')][_0x8b75('0x74')];return db['sequelize']['query'](_0x1157df,{'type':db[_0x8b75('0x75')][_0x8b75('0x76')]['SELECT'],'raw':!![]})['then'](function(_0x330a1f){return _0x330a1f;});})[_0x8b75('0x39')](function(_0x3644dd){if(_0x3644dd){_0x531064['message'][_0x8b75('0x77')]=_0x3644dd[0x0];if(!_0x47676d[_0x8b75('0x5e')][_0x8b75('0x65')])return;return db[_0x8b75('0x78')][_0x8b75('0x5c')]({'where':{'id':_0x47676d[_0x8b75('0x5e')][_0x8b75('0x65')],'role':'agent'},'attributes':['id',_0x8b75('0x3c'),_0x8b75('0x79'),_0x8b75('0x7a'),_0x8b75('0x7b')],'raw':!![]});}return null;})[_0x8b75('0x39')](function(_0x135119){if(!_0x135119)return null;_0x531064[_0x8b75('0x2b')][_0x8b75('0x67')]=_0x135119;return _0x531064;})['then'](function(_0x26d292){if(_0x26d292){if(_0x47676d[_0x8b75('0x5e')][_0x8b75('0x7c')]){_0x531064[_0x8b75('0x2b')]['interface']=util[_0x8b75('0x6c')]('SIP/%s',_0x47676d[_0x8b75('0x66')][_0x8b75('0x3c')]);_0x531064[_0x8b75('0x2b')][_0x8b75('0x7d')]=_0x531064[_0x8b75('0x7d')];_0x531064[_0x8b75('0x2b')][_0x8b75('0x7e')]=_0x531064[_0x8b75('0x7d')];_0x531064[_0x8b75('0x2b')][_0x8b75('0x7f')]='accept';return respondWithRpcPromise(_0x8b75('0x80'),_0x8b75('0x80'),{'event':_0x8b75('0x81'),'message':_0x531064[_0x8b75('0x2b')]},client9002)[_0x8b75('0x39')](function(){return _0x531064;});}return _0x531064;}return null;})[_0x8b75('0x39')](respondWithResult(_0x352566,null))[_0x8b75('0x2d')](handleError(_0x352566,null));};var interaction_log=require(_0x8b75('0x16'))('sms-interactions');exports['reject']=function(_0x4592c6,_0x42629c,_0xd8fc2c){var _0x166a94={'agent':{},'channel':_0x8b75('0x61')};if(_0x4592c6['body']['id']){delete _0x4592c6[_0x8b75('0x5e')]['id'];}_0x4592c6['body']['UserId']=_0x4592c6['body'][_0x8b75('0x65')]||_0x4592c6[_0x8b75('0x66')]['id'];_0x166a94[_0x8b75('0x67')]['id']=_0x4592c6['body']['UserId'];return db['SmsMessage'][_0x8b75('0x5c')]({'where':{'id':_0x4592c6[_0x8b75('0x59')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x42629c,null))[_0x8b75('0x39')](function(_0x4156c2){if(_0x4156c2){_0x166a94[_0x8b75('0x2b')]=_0x4156c2[_0x8b75('0x6e')]({'plain':!![]});return db[_0x8b75('0x68')]['find']({'where':{'id':_0x4156c2[_0x8b75('0x69')]}});}return null;})[_0x8b75('0x39')](handleEntityNotFound(_0x42629c,null))[_0x8b75('0x39')](function(_0x55aa90){if(_0x55aa90){_0x166a94[_0x8b75('0x6d')]=_0x55aa90[_0x8b75('0x6e')]({'plain':!![]});interaction_log[_0x8b75('0x23')](_0x8b75('0x82'),_0x4592c6[_0x8b75('0x66')]['id'],_0x4592c6[_0x8b75('0x66')][_0x8b75('0x3c')],_0x4592c6[_0x8b75('0x66')][_0x8b75('0x6f')],_0x166a94[_0x8b75('0x6d')]['id'],_0x4592c6[_0x8b75('0x5e')]?JSON[_0x8b75('0x28')](_0x4592c6[_0x8b75('0x5e')]):'null');return respondWithRpcPromise(_0x8b75('0x83'),'rejectMessage',_0x166a94);}return null;})[_0x8b75('0x39')](function(_0x134c68){var _0x498e8f=_0x8b75('0x73')+_0x134c68[_0x8b75('0x2b')]['ContactId'];return db['sequelize'][_0x8b75('0x45')](_0x498e8f,{'type':db[_0x8b75('0x75')][_0x8b75('0x76')][_0x8b75('0x84')],'raw':!![]})['then'](function(_0x5975f2){return _0x5975f2;});})['then'](function(_0x23c392){if(_0x23c392){_0x166a94['message']['contact']=_0x23c392[0x0];if(!_0x4592c6[_0x8b75('0x5e')][_0x8b75('0x65')])return;return db[_0x8b75('0x78')][_0x8b75('0x5c')]({'where':{'id':_0x4592c6[_0x8b75('0x5e')][_0x8b75('0x65')],'role':'agent'},'attributes':['id',_0x8b75('0x3c'),_0x8b75('0x79'),_0x8b75('0x7a'),'internal'],'raw':!![]});}return null;})[_0x8b75('0x39')](function(_0x17d133){if(!_0x17d133)return null;_0x166a94[_0x8b75('0x2b')][_0x8b75('0x67')]=_0x17d133;return _0x166a94;})[_0x8b75('0x39')](function(_0x216b93){if(_0x216b93){_0x216b93[_0x8b75('0x2b')][_0x8b75('0x85')]=util[_0x8b75('0x6c')](_0x8b75('0x86'),_0x4592c6[_0x8b75('0x66')][_0x8b75('0x3c')]);_0x216b93[_0x8b75('0x2b')][_0x8b75('0x7d')]=_0x166a94['channel'];_0x216b93[_0x8b75('0x2b')][_0x8b75('0x7e')]=_0x166a94[_0x8b75('0x7d')];_0x216b93[_0x8b75('0x2b')][_0x8b75('0x7f')]=_0x8b75('0x36');respondWithRpcPromise(_0x8b75('0x80'),_0x8b75('0x80'),{'event':'rejectmessage','message':_0x216b93[_0x8b75('0x2b')]},client9002);return _0x166a94;}return null;})[_0x8b75('0x39')](respondWithResult(_0x42629c,null))[_0x8b75('0x2d')](handleError(_0x42629c,null));};exports['status']=function(_0x4352c0,_0x4de111,_0x56fd02){if(_0x4352c0[_0x8b75('0x5e')]['id']){delete _0x4352c0[_0x8b75('0x5e')]['id'];}var _0x5a70e6;return db[_0x8b75('0x40')][_0x8b75('0x5c')]({'where':{'id':_0x4352c0[_0x8b75('0x59')]['id']}})['then'](handleEntityNotFound(_0x4de111,null))[_0x8b75('0x39')](function(_0x3fc78e){if(_0x3fc78e){_0x5a70e6=_0x3fc78e;return db['SmsAccount'][_0x8b75('0x5c')]({'where':{'id':_0x3fc78e[_0x8b75('0x87')]}});}})[_0x8b75('0x39')](handleEntityNotFound(_0x4de111,null))[_0x8b75('0x39')](function(_0x19133e){if(_0x19133e){logger['debug'](_0x8b75('0x27'),_0x8b75('0x2f'),_0x8b75('0x88'),_0x19133e[_0x8b75('0x43')],util[_0x8b75('0x89')](_0x4352c0[_0x8b75('0x5e')],{'showHidden':![],'depth':null}));switch(_0x19133e['type']){case'twilio':if(_0x4352c0[_0x8b75('0x5e')][_0x8b75('0x8a')]&&_0x4352c0[_0x8b75('0x5e')][_0x8b75('0x8a')]===_0x5a70e6[_0x8b75('0x8b')]){return _0x5a70e6[_0x8b75('0x38')]({'read':!![]});}else{logger[_0x8b75('0x29')](_0x8b75('0x8c'),_0x8b75('0x2f'),_0x8b75('0x8d'),util[_0x8b75('0x89')](_0x4352c0[_0x8b75('0x5e')],{'showHidden':![],'depth':null}));}break;case _0x8b75('0x8e'):if(_0x4352c0['body'][_0x8b75('0x8f')]&&_0x4352c0['body'][_0x8b75('0x8f')]===_0x5a70e6['messageId']&&_[_0x8b75('0x90')]([_0x8b75('0x91'),_0x8b75('0x92')],_0x4352c0['body']['Status'])>=0x0){return _0x5a70e6[_0x8b75('0x38')]({'read':!![]});}else{logger[_0x8b75('0x29')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x8b75('0x2f'),_0x8b75('0x93'),util[_0x8b75('0x89')](_0x4352c0[_0x8b75('0x5e')],{'showHidden':![],'depth':null}));}break;case _0x8b75('0x94'):var _0x41d0aa=_0x4352c0['body'][_0x8b75('0x95')][0x0];if(_0x41d0aa[_0x8b75('0x2f')]['groupName']===_0x8b75('0x96')){return _0x5a70e6[_0x8b75('0x38')]({'read':!![]});}else{logger[_0x8b75('0x29')](_0x8b75('0x8c'),'status',_0x8b75('0x94'),util[_0x8b75('0x89')](_0x4352c0[_0x8b75('0x5e')],{'showHidden':![],'depth':null}));}break;}return _0x5a70e6;}})[_0x8b75('0x39')](respondWithResult(_0x4de111,null))[_0x8b75('0x2d')](handleError(_0x4de111,null));}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.events.js b/server/api/smsMessage/smsMessage.events.js index 3d6bac2..0262bce 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 _0x5754=['emit','hasOwnProperty','exports','../../mysqldb','SmsMessage','save','update'];(function(_0x3e7e96,_0x5683ca){var _0x13f6f0=function(_0x320767){while(--_0x320767){_0x3e7e96['push'](_0x3e7e96['shift']());}};_0x13f6f0(++_0x5683ca);}(_0x5754,0x1f4));var _0x4575=function(_0xe7950d,_0x36acc0){_0xe7950d=_0xe7950d-0x0;var _0x22e51f=_0x5754[_0xe7950d];return _0x22e51f;};'use strict';var EventEmitter=require('events');var SmsMessage=require(_0x4575('0x0'))['db'][_0x4575('0x1')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x4575('0x2'),'afterUpdate':_0x4575('0x3'),'afterDestroy':'remove'};function emitEvent(_0x280150){return function(_0x416bcf,_0x3bdb86,_0xb1e699){SmsMessageEvents[_0x4575('0x4')](_0x280150+':'+_0x416bcf['id'],_0x416bcf);SmsMessageEvents[_0x4575('0x4')](_0x280150,_0x416bcf);_0xb1e699(null);};}for(var e in events){if(events[_0x4575('0x5')](e)){var event=events[e];SmsMessage['hook'](e,emitEvent(event));}}module[_0x4575('0x6')]=SmsMessageEvents; \ No newline at end of file +var _0x45f5=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','SmsMessage','save','update','remove'];(function(_0x4197d1,_0x3889f7){var _0x8d5c0=function(_0x43ec1b){while(--_0x43ec1b){_0x4197d1['push'](_0x4197d1['shift']());}};_0x8d5c0(++_0x3889f7);}(_0x45f5,0x1d0));var _0x545f=function(_0x2459fd,_0x575d9b){_0x2459fd=_0x2459fd-0x0;var _0x364cd2=_0x45f5[_0x2459fd];return _0x364cd2;};'use strict';var EventEmitter=require(_0x545f('0x0'));var SmsMessage=require(_0x545f('0x1'))['db'][_0x545f('0x2')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x545f('0x3'),'afterUpdate':_0x545f('0x4'),'afterDestroy':_0x545f('0x5')};function emitEvent(_0x4a278c){return function(_0x1db3a8,_0x2963b6,_0x236191){SmsMessageEvents[_0x545f('0x6')](_0x4a278c+':'+_0x1db3a8['id'],_0x1db3a8);SmsMessageEvents['emit'](_0x4a278c,_0x1db3a8);_0x236191(null);};}for(var e in events){if(events[_0x545f('0x7')](e)){var event=events[e];SmsMessage[_0x545f('0x8')](e,emitEvent(event));}}module[_0x545f('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 f03611f..4e6b6ad 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 _0xd295=['plivo','authId','https://api.plivo.com/v1/Account/%s/Message/','toString','Missing\x20parameters:\x20authId,\x20authToken','infobip','baseUrl','application/json','IBSSO\x20','Missing\x20parameters:\x20base_url','csc','apiKey','login','text','timestamp','md5','digest','hex','signature=','GET','/external/get/send.php?','keys','id_sms','clickatell','apiMessageId','Missing\x20parameters:\x20apiKey','bandwidth','https://messaging.bandwidth.com/api/v2/users/','accountId','/messages','applicationId','intelepeer','https://api.intelepeer.com/_rest/v4/app/sms/send','Bearer\x20','code','message','https://api.intelepeer.com/_rest/v4/app/sms/mdr','Token\x20not\x20received','finally','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./smsMessage.attributes','exports','define','sms_messages','messageId','body','FULLTEXT','models','get','direction','toLowerCase','isNil','UserId','SmsInteraction','SmsInteractionId','then','update','createdAt','error','out','secret','SmsAccount','find','type','twilio','accountSid','authToken','phone','messages','create','remote','/api/sms/messages/','/status?token=','token','sid','catch','inspect','SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','skebby','username','smsMethod','sender','login?username=','split','sms','user_key','total_sent','read','Missing\x20parameters:\x20username,\x20password','connectel','POST','https://smsapi.connectel.se/api/v2/send/','deliveryReport','clicksend','password','xCALLY\x20Motion','senderString','%s:%s','format','Basic\x20%s','base64','http_code','data','head','message_id','clickSend'];(function(_0x1b07ca,_0x27943d){var _0x524114=function(_0x2178bc){while(--_0x2178bc){_0x1b07ca['push'](_0x1b07ca['shift']());}};_0x524114(++_0x27943d);}(_0xd295,0x18b));var _0x5d29=function(_0x103d50,_0x400aae){_0x103d50=_0x103d50-0x0;var _0x469d69=_0xd295[_0x103d50];return _0x469d69;};'use strict';var _=require(_0x5d29('0x0'));var util=require(_0x5d29('0x1'));var logger=require(_0x5d29('0x2'))(_0x5d29('0x3'));var moment=require(_0x5d29('0x4'));var BPromise=require('bluebird');var rp=require(_0x5d29('0x5'));var fs=require('fs');var path=require(_0x5d29('0x6'));var rimraf=require(_0x5d29('0x7'));var config=require(_0x5d29('0x8'));var attributes=require(_0x5d29('0x9'));module[_0x5d29('0xa')]=function(_0x2f0e6a,_0x3e8d92){return _0x2f0e6a[_0x5d29('0xb')]('SmsMessage',attributes,{'tableName':_0x5d29('0xc'),'paranoid':![],'indexes':[{'name':_0x5d29('0xd'),'fields':[_0x5d29('0xd')]},{'name':'fti_sms_messages','fields':[_0x5d29('0xe')],'type':_0x5d29('0xf')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x2f62f5,_0x5ea7ce,_0xc68639){var _0x5644ad=_0x2f0e6a[_0x5d29('0x10')];var _0x3f725e=_0x2f62f5[_0x5d29('0x11')]({'plain':!![]});if(_0x3f725e[_0x5d29('0x12')][_0x5d29('0x13')]()==='in'||_0x3f725e[_0x5d29('0x12')][_0x5d29('0x13')]()==='out'&&!_0x3f725e['secret']&&!_[_0x5d29('0x14')](_0x3f725e[_0x5d29('0x15')])&&!_['isNil'](_0x3f725e['SmsInteractionId'])){_0x5644ad[_0x5d29('0x16')]['findOne']({'where':{'id':_0x3f725e[_0x5d29('0x17')]}})[_0x5d29('0x18')](function(_0x5025df){if(_0x5025df){_0x5025df[_0x5d29('0x19')]({'lastMsgAt':_0x3f725e[_0x5d29('0x1a')],'lastMsgDirection':_0x3f725e['direction'][_0x5d29('0x13')]()});}})['catch'](function(_0x5afef5){console[_0x5d29('0x1b')](_0x5afef5);});}if(_0x3f725e[_0x5d29('0x12')]===_0x5d29('0x1c')&&!_0x3f725e[_0x5d29('0x1d')]){var _0x696919;_0x5644ad[_0x5d29('0x1e')][_0x5d29('0x1f')]({'where':{'id':_0x3f725e['SmsAccountId']},'raw':!![]})[_0x5d29('0x18')](function(_0x313d47){_0x696919=_0x313d47;if(_0x696919&&_0x696919[_0x5d29('0x20')]){switch(_0x696919[_0x5d29('0x20')]){case _0x5d29('0x21'):var _0x51de68=require('twilio');if(_0x696919[_0x5d29('0x22')]&&_0x696919[_0x5d29('0x23')]&&_0x696919[_0x5d29('0x24')]){var _0x4a7922=new _0x51de68(_0x696919['accountSid'],_0x696919['authToken']);_0x4a7922[_0x5d29('0x25')][_0x5d29('0x26')]({'body':_0x3f725e['body'],'to':_0x3f725e['phone'],'from':_0x696919[_0x5d29('0x24')],'statusCallback':_0x696919[_0x5d29('0x27')]+_0x5d29('0x28')+_0x3f725e['id']+_0x5d29('0x29')+_0x696919[_0x5d29('0x2a')]})[_0x5d29('0x18')](function(_0x342f9a){if(_0x342f9a[_0x5d29('0x2b')]){return _0x2f62f5['update']({'messageId':_0x342f9a['sid']});}})[_0x5d29('0x2c')](function(_0x5acdc7){logger[_0x5d29('0x1b')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','twilio',util[_0x5d29('0x2d')](_0x5acdc7,{'showHidden':![],'depth':null}));});}else{logger[_0x5d29('0x1b')](_0x5d29('0x2e'),_0x5d29('0x2f'),_0x5d29('0x21'),_0x5d29('0x30'));}break;case _0x5d29('0x31'):var _0x1dfea6='https://api.skebby.it/API/v1.0/REST/';if(_0x696919[_0x5d29('0x32')]&&_0x696919['password']){var _0x39e88e={'recipient':[_0x3f725e[_0x5d29('0x24')]],'message':_0x3f725e[_0x5d29('0xe')],'message_type':_0x696919[_0x5d29('0x33')]};if(_0x696919['smsMethod']&&_0x696919[_0x5d29('0x33')]!=='SI'){_0x39e88e[_0x5d29('0x34')]=_0x696919[_0x5d29('0x24')];}var _0x5232a1={'url':_0x1dfea6+_0x5d29('0x35')+_0x696919[_0x5d29('0x32')]+'&password='+_0x696919['password'],'method':'GET'};rp(_0x5232a1)['then'](function(_0x3849ae){var _0x3d0235=_0x3849ae[_0x5d29('0x36')](';');var _0x3e4d43={'user_key':_0x3d0235[0x0],'session_key':_0x3d0235[0x1]};_0x5232a1={'url':_0x1dfea6+_0x5d29('0x37'),'method':'POST','headers':{'user_key':_0x3e4d43[_0x5d29('0x38')],'Session_key':_0x3e4d43['session_key']},'json':!![],'body':_0x39e88e};return rp(_0x5232a1);})[_0x5d29('0x18')](function(_0x1fabf2){if(_0x1fabf2[_0x5d29('0x39')]>=0x1){var _0x53f531={'messageId':_0x1fabf2['internal_order_id']};if(_0x696919['smsMethod']!=='GP'||!_0x696919['deliveryReport']){_0x53f531[_0x5d29('0x3a')]=!![];}return _0x2f62f5[_0x5d29('0x19')](_0x53f531);}else{return logger['error'](_0x5d29('0x2e'),_0x5d29('0x2f'),'skebby',util[_0x5d29('0x2d')](_0x1fabf2,{'showHidden':![],'depth':null}));}})[_0x5d29('0x2c')](function(_0x4e6b3a){return logger[_0x5d29('0x1b')](_0x5d29('0x2e'),'afterCreate','skebby',util[_0x5d29('0x2d')](_0x4e6b3a,{'showHidden':![],'depth':null}));});}else{logger[_0x5d29('0x1b')](_0x5d29('0x2e'),_0x5d29('0x2f'),_0x5d29('0x31'),_0x5d29('0x3b'));}break;case _0x5d29('0x3c'):if(_0x696919[_0x5d29('0x23')]){var _0x5dbc0e={'recipient':_0x3f725e['phone'],'message':_0x3f725e[_0x5d29('0xe')],'sender':_0x696919['senderString']||_0x696919[_0x5d29('0x24')],'authorization':_0x696919[_0x5d29('0x23')]};var _0x5ea7ce={'method':_0x5d29('0x3d'),'uri':_0x5d29('0x3e'),'body':_0x5dbc0e,'json':!![]};rp(_0x5ea7ce)[_0x5d29('0x18')](function(_0x4fe1f3){var _0x36468b={'messageId':_0x4fe1f3['requestid']};if(!_0x696919[_0x5d29('0x3f')]){_0x36468b[_0x5d29('0x3a')]=!![];}return _0x2f62f5[_0x5d29('0x19')](_0x36468b);})['catch'](function(_0x468531){logger[_0x5d29('0x1b')](_0x5d29('0x2e'),_0x5d29('0x2f'),'connectel',util[_0x5d29('0x2d')](_0x468531,{'showHidden':![],'depth':null}));});}else{logger[_0x5d29('0x1b')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x5d29('0x2f'),'connectel','Missing\x20parameters:\x20authToken');}break;case _0x5d29('0x40'):if(_0x696919[_0x5d29('0x32')]&&_0x696919[_0x5d29('0x41')]){var _0x5dbc0e={'messages':[{'source':_0x5d29('0x42'),'to':_0x3f725e[_0x5d29('0x24')],'body':_0x3f725e[_0x5d29('0xe')],'from':_0x696919[_0x5d29('0x43')]||_0x696919[_0x5d29('0x24')]}]};var _0x21f7fe=util['format'](_0x5d29('0x44'),_0x696919['username'],_0x696919['password']);var _0x5ea7ce={'method':'POST','uri':'https://rest.clicksend.com/v3/sms/send','body':_0x5dbc0e,'headers':{'Authorization':util[_0x5d29('0x45')](_0x5d29('0x46'),new Buffer(_0x21f7fe)['toString'](_0x5d29('0x47')))},'json':!![]};rp(_0x5ea7ce)['then'](function(_0x1d1db4){if(_0x1d1db4[_0x5d29('0x48')]>=0xc8&&_0x1d1db4[_0x5d29('0x48')]<=0xce){if(_0x1d1db4[_0x5d29('0x49')]&&_0x1d1db4['data']['queued_count']>0x0){var _0x1b42a1=_[_0x5d29('0x4a')](_0x1d1db4[_0x5d29('0x49')]['messages']);var _0x1d022c={'messageId':_0x1b42a1[_0x5d29('0x4b')]};if(!_0x696919[_0x5d29('0x3f')]){_0x1d022c[_0x5d29('0x3a')]=!![];}return _0x2f62f5[_0x5d29('0x19')](_0x1d022c);}else{logger['error'](_0x5d29('0x2e'),_0x5d29('0x2f'),'clickSend',util[_0x5d29('0x2d')](_0x1d1db4,{'showHidden':![],'depth':null}));}}else{logger['error'](_0x5d29('0x2e'),_0x5d29('0x2f'),_0x5d29('0x4c'),util[_0x5d29('0x2d')](_0x1d1db4,{'showHidden':![],'depth':null}));}})['catch'](function(_0x352ed2){logger[_0x5d29('0x1b')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x5d29('0x2f'),_0x5d29('0x4c'),util[_0x5d29('0x2d')](_0x352ed2,{'showHidden':![],'depth':null}));});}else{logger[_0x5d29('0x1b')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x5d29('0x2f'),_0x5d29('0x4c'),_0x5d29('0x3b'));}break;case _0x5d29('0x4d'):if(_0x696919['authId']&&_0x696919[_0x5d29('0x23')]){var _0x5dbc0e={'dst':_0x3f725e[_0x5d29('0x24')],'text':_0x3f725e[_0x5d29('0xe')],'src':_0x696919[_0x5d29('0x43')]||_0x696919[_0x5d29('0x24')],'url':_0x696919[_0x5d29('0x27')]+_0x5d29('0x28')+_0x3f725e['id']+_0x5d29('0x29')+_0x696919[_0x5d29('0x2a')]};var _0x21f7fe=util['format'](_0x5d29('0x44'),_0x696919[_0x5d29('0x4e')],_0x696919['authToken']);var _0x5ea7ce={'method':'POST','uri':util[_0x5d29('0x45')](_0x5d29('0x4f'),_0x696919[_0x5d29('0x4e')]),'body':_0x5dbc0e,'headers':{'Authorization':util['format'](_0x5d29('0x46'),new Buffer(_0x21f7fe)[_0x5d29('0x50')](_0x5d29('0x47')))},'json':!![]};rp(_0x5ea7ce)['then'](function(_0x3b2250){var _0x42d71b={'messageId':_0x3b2250['message_uuid'][0x0]};return _0x2f62f5['update'](_0x42d71b);})['catch'](function(_0x4ee481){logger[_0x5d29('0x1b')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x5d29('0x4d'),util[_0x5d29('0x2d')](_0x4ee481,{'showHidden':![],'depth':null}));});}else{logger[_0x5d29('0x1b')](_0x5d29('0x2e'),_0x5d29('0x2f'),_0x5d29('0x4d'),_0x5d29('0x51'));}break;case _0x5d29('0x52'):if(_0x696919[_0x5d29('0x32')]&&_0x696919[_0x5d29('0x41')]){if(_0x696919[_0x5d29('0x53')]){var _0x4c5ba3={'method':'POST','uri':_0x696919[_0x5d29('0x53')]+'/auth/1/session','body':{'username':_0x696919['username'],'password':_0x696919[_0x5d29('0x41')]},'json':!![]};return rp(_0x4c5ba3)['then'](function(_0x6803ca){var _0x5dc668={'method':'POST','uri':_0x696919[_0x5d29('0x53')]+'/sms/2/text/advanced','body':{'messages':[{'from':_0x696919['phone'],'destinations':[{'to':_0x3f725e['phone']}],'text':_0x3f725e['body'],'notifyUrl':_0x696919[_0x5d29('0x27')]+'/api/sms/messages/'+_0x3f725e['id']+_0x5d29('0x29')+_0x696919[_0x5d29('0x2a')],'notifyContentType':_0x5d29('0x54'),'callbackData':_0x696919['phone']+';'+_0x3f725e[_0x5d29('0xe')]}]},'headers':{'Authorization':_0x5d29('0x55')+_0x6803ca[_0x5d29('0x2a')]},'json':!![]};return rp(_0x5dc668)['then'](function(_0x5b9874){if(_0x5b9874[_0x5d29('0x25')]){var _0x2d00d8={'messageId':_0x5b9874[_0x5d29('0x25')][0x0][_0x5d29('0xd')]};if(!_0x696919['deliveryReport']){_0x2d00d8['read']=!![];}return _0x2f62f5[_0x5d29('0x19')](_0x2d00d8);}else{return logger[_0x5d29('0x1b')](_0x5d29('0x2e'),_0x5d29('0x2f'),'infobip',util['inspect'](_0x5b9874,{'showHidden':![],'depth':null}));}});})[_0x5d29('0x2c')](function(_0xa177b6){return logger['error'](_0x5d29('0x2e'),_0x5d29('0x2f'),_0x5d29('0x52'),util[_0x5d29('0x2d')](_0xa177b6,{'showHidden':![],'depth':null}));});}else{logger[_0x5d29('0x1b')](_0x5d29('0x2e'),'afterCreate',_0x5d29('0x52'),_0x5d29('0x56'));}}else{logger['error'](_0x5d29('0x2e'),_0x5d29('0x2f'),_0x5d29('0x52'),_0x5d29('0x3b'));}break;case _0x5d29('0x57'):var _0x2b891b=require('crypto');if(_0x696919[_0x5d29('0x58')]){var _0x58024d={};_0x58024d[_0x5d29('0x59')]=_0x696919[_0x5d29('0x32')];_0x58024d['phone']=_0x3f725e[_0x5d29('0x24')];_0x58024d['sender']=_0x696919[_0x5d29('0x24')];_0x58024d[_0x5d29('0x5a')]=_0x3f725e[_0x5d29('0xe')];_0x58024d[_0x5d29('0x5b')]=+new Date();var _0x45e621='';var _0x9f0e67='';var _0x3800bf=Object['keys'](_0x58024d);_0x3800bf['sort']();for(var _0x378bff=0x0;_0x378bff<_0x3800bf['length'];_0x378bff++){if(_0x45e621!=''){_0x45e621+='&';}_0x45e621+=_0x3800bf[_0x378bff]+'='+encodeURIComponent(_0x58024d[_0x3800bf[_0x378bff]]);_0x9f0e67+=_0x58024d[_0x3800bf[_0x378bff]];}_0x9f0e67+=_0x696919['apiKey'];_0x9f0e67=_0x2b891b['createHash'](_0x5d29('0x5c'))['update'](_0x9f0e67)[_0x5d29('0x5d')](_0x5d29('0x5e'));if(_0x45e621!==''){_0x45e621+='&';}_0x45e621+=_0x5d29('0x5f')+_0x9f0e67;var _0x5232a1={'method':_0x5d29('0x60'),'uri':_0x696919[_0x5d29('0x53')]+_0x5d29('0x61')+_0x45e621,'json':!![]};return rp(_0x5232a1)[_0x5d29('0x18')](function(_0x1b2497){var _0x659079=Object[_0x5d29('0x62')](_0x1b2497);if(_0x1b2497[_0x659079[0x0]][_0x5d29('0x1b')]&&parseInt(_0x1b2497[_0x659079[0x0]]['error'])===0x0){var _0x31d49f={'messageId':_0x1b2497[_0x659079[0x0]][_0x5d29('0x63')]};if(!_0x696919[_0x5d29('0x3f')]){_0x31d49f[_0x5d29('0x3a')]=!![];}return _0x2f62f5[_0x5d29('0x19')](_0x31d49f);}else{return logger[_0x5d29('0x1b')](_0x5d29('0x2e'),'afterCreate',_0x5d29('0x57'),util[_0x5d29('0x2d')](_0x1b2497[_0x5d29('0x1b')],{'showHidden':![],'depth':null}));}})[_0x5d29('0x2c')](function(_0x5cf56b){return logger[_0x5d29('0x1b')](_0x5d29('0x2e'),_0x5d29('0x2f'),_0x5d29('0x57'),util[_0x5d29('0x2d')](_0x5cf56b,{'showHidden':![],'depth':null}));});}else{logger[_0x5d29('0x1b')](_0x5d29('0x2e'),_0x5d29('0x2f'),'csc','Missing\x20parameters:\x20apiKey');}break;case _0x5d29('0x64'):if(_0x696919[_0x5d29('0x58')]){var _0xcc1aab={'method':'POST','uri':'https://platform.clickatell.com/messages','headers':{'Authorization':_0x696919['apiKey']},'body':{'content':_0x3f725e[_0x5d29('0xe')],'to':[_0x3f725e['phone']],'from':_0x696919[_0x5d29('0x24')],'binary':![],'clientMessageId':'uuid','charset':'UTF-8'},'json':!![]};rp(_0xcc1aab)[_0x5d29('0x18')](function(_0x236153){if(!_0x236153[_0x5d29('0x1b')]){var _0x2e0d51={'messageId':_0x236153[_0x5d29('0x25')][0x0][_0x5d29('0x65')]};if(!_0x696919['deliveryReport']){_0x2e0d51[_0x5d29('0x3a')]=!![];}return _0x2f62f5[_0x5d29('0x19')](_0x2e0d51);}else{return logger[_0x5d29('0x1b')](_0x5d29('0x2e'),_0x5d29('0x2f'),_0x5d29('0x64'),util[_0x5d29('0x2d')](_0x236153[_0x5d29('0x1b')],{'showHidden':![],'depth':null}));}})['catch'](function(_0x307eb0){return logger[_0x5d29('0x1b')](_0x5d29('0x2e'),'afterCreate',_0x5d29('0x64'),util[_0x5d29('0x2d')](_0x307eb0,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x5d29('0x2e'),'afterCreate',_0x5d29('0x64'),_0x5d29('0x66'));}break;case _0x5d29('0x67'):if(_0x696919['username']&&_0x696919[_0x5d29('0x41')]){var _0x21f7fe=util[_0x5d29('0x45')](_0x5d29('0x44'),_0x696919[_0x5d29('0x32')],_0x696919[_0x5d29('0x41')]);var _0x5ea7ce={'method':'POST','uri':_0x5d29('0x68')+_0x696919[_0x5d29('0x69')]+_0x5d29('0x6a'),'body':{'to':[_0x3f725e[_0x5d29('0x24')]],'text':_0x3f725e['body'],'from':_0x696919[_0x5d29('0x24')],'applicationId':_0x696919[_0x5d29('0x6b')]},'headers':{'Authorization':util[_0x5d29('0x45')](_0x5d29('0x46'),new Buffer(_0x21f7fe)[_0x5d29('0x50')]('base64'))},'json':!![]};rp(_0x5ea7ce)[_0x5d29('0x18')](function(_0x24e97c){if(_0x24e97c['id']){var _0x233123={'messageId':_0x24e97c['id']};return _0x2f62f5[_0x5d29('0x19')](_0x233123);}else{logger[_0x5d29('0x1b')](_0x5d29('0x2e'),_0x5d29('0x2f'),_0x5d29('0x67'),util[_0x5d29('0x2d')](_0x24e97c,{'showHidden':![],'depth':null}));}})[_0x5d29('0x2c')](function(_0xa63249){logger['error'](_0x5d29('0x2e'),'afterCreate',_0x5d29('0x67'),util[_0x5d29('0x2d')](_0xa63249,{'showHidden':![],'depth':null}));});}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x5d29('0x2f'),_0x5d29('0x67'),_0x5d29('0x3b'));}break;case _0x5d29('0x6c'):if(_0x696919['apiKey']){var _0x8cf35d={};var _0x5232a1={'method':'POST','uri':_0x5d29('0x6d'),'headers':{'Authorization':_0x5d29('0x6e')+_0x696919[_0x5d29('0x58')],'Content-Type':'application/json'},'body':{'from':_0x696919['phone'],'to':_0x3f725e[_0x5d29('0x24')],'text':_0x3f725e[_0x5d29('0xe')]},'json':!![]};return rp(_0x5232a1)['then'](function(_0x292975){if(_0x292975[_0x5d29('0x6f')]==0xca){_0x8cf35d[_0x5d29('0x70')]=_0x292975;var _0x79d3fb={'method':_0x5d29('0x3d'),'uri':_0x5d29('0x71'),'headers':{'Authorization':_0x5d29('0x6e')+_0x696919['apiKey'],'Content-Type':_0x5d29('0x54')},'body':{'refid':_0x8cf35d[_0x5d29('0x70')]['refid']},'json':!![]};return rp(_0x79d3fb)[_0x5d29('0x18')](function(_0x21e5a8){_0x8cf35d['status']=_0x21e5a8;var _0x39e380={'messageId':_0x8cf35d[_0x5d29('0x70')]['refid'],'read':!![]};return _0x2f62f5[_0x5d29('0x19')](_0x39e380);});}else{return logger[_0x5d29('0x1b')](_0x5d29('0x2e'),'afterCreate',_0x5d29('0x6c'),util[_0x5d29('0x2d')](_0x292975,{'showHidden':![],'depth':null}));}})[_0x5d29('0x2c')](function(_0x1ff532){return logger[_0x5d29('0x1b')](_0x5d29('0x2e'),_0x5d29('0x2f'),_0x5d29('0x6c'),util[_0x5d29('0x2d')](_0x1ff532,{'showHidden':![],'depth':null}));});}else{return logger[_0x5d29('0x1b')](_0x5d29('0x2e'),_0x5d29('0x2f'),_0x5d29('0x6c'),_0x5d29('0x72'));}break;}}})[_0x5d29('0x73')](function(){_0xc68639();});}else{_0xc68639();}}},'charset':_0x5d29('0x74'),'collate':_0x5d29('0x75')});}; \ No newline at end of file +var _0xfb8b=['/sms/2/text/advanced','application/json','IBSSO\x20','infobip','Missing\x20parameters:\x20base_url','csc','crypto','login','sender','text','timestamp','keys','apiKey','createHash','md5','digest','/external/get/send.php?','id_sms','Missing\x20parameters:\x20apiKey','clickatell','https://platform.clickatell.com/messages','apiMessageId','%s:%s','accountId','/messages','applicationId','bandwidth','intelepeer','Bearer\x20','code','message','https://api.intelepeer.com/_rest/v4/app/sms/mdr','refid','status','Token\x20not\x20received','finally','lodash','../../config/logger','api','moment','path','rimraf','../../config/environment','./smsMessage.attributes','exports','define','sms_messages','messageId','body','models','get','toLowerCase','out','secret','isNil','SmsInteractionId','SmsInteraction','update','direction','catch','error','SmsAccount','SmsAccountId','then','type','twilio','accountSid','phone','authToken','messages','/api/sms/messages/','/status?token=','token','SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','inspect','skebby','https://api.skebby.it/API/v1.0/REST/','username','password','smsMethod','login?username=','&password=','GET','split','sms','POST','user_key','session_key','total_sent','internal_order_id','deliveryReport','read','Missing\x20parameters:\x20username,\x20password','connectel','senderString','https://smsapi.connectel.se/api/v2/send/','requestid','Missing\x20parameters:\x20authToken','xCALLY\x20Motion','format','Basic\x20%s','toString','base64','http_code','data','clickSend','remote','authId','https://api.plivo.com/v1/Account/%s/Message/','message_uuid','plivo','baseUrl','/auth/1/session'];(function(_0x2be501,_0x5052ea){var _0x1fae7c=function(_0x5b1638){while(--_0x5b1638){_0x2be501['push'](_0x2be501['shift']());}};_0x1fae7c(++_0x5052ea);}(_0xfb8b,0x108));var _0xbfb8=function(_0x1867a7,_0x5adb74){_0x1867a7=_0x1867a7-0x0;var _0x58b13e=_0xfb8b[_0x1867a7];return _0x58b13e;};'use strict';var _=require(_0xbfb8('0x0'));var util=require('util');var logger=require(_0xbfb8('0x1'))(_0xbfb8('0x2'));var moment=require(_0xbfb8('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xbfb8('0x4'));var rimraf=require(_0xbfb8('0x5'));var config=require(_0xbfb8('0x6'));var attributes=require(_0xbfb8('0x7'));module[_0xbfb8('0x8')]=function(_0x46349b,_0x500861){return _0x46349b[_0xbfb8('0x9')]('SmsMessage',attributes,{'tableName':_0xbfb8('0xa'),'paranoid':![],'indexes':[{'name':'messageId','fields':[_0xbfb8('0xb')]},{'name':'fti_sms_messages','fields':[_0xbfb8('0xc')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x38917b,_0x2c35ba,_0x2d9614){var _0x3c5000=_0x46349b[_0xbfb8('0xd')];var _0x16ade4=_0x38917b[_0xbfb8('0xe')]({'plain':!![]});if(_0x16ade4['direction'][_0xbfb8('0xf')]()==='in'||_0x16ade4['direction'][_0xbfb8('0xf')]()===_0xbfb8('0x10')&&!_0x16ade4[_0xbfb8('0x11')]&&!_[_0xbfb8('0x12')](_0x16ade4['UserId'])&&!_['isNil'](_0x16ade4[_0xbfb8('0x13')])){_0x3c5000[_0xbfb8('0x14')]['findOne']({'where':{'id':_0x16ade4['SmsInteractionId']}})['then'](function(_0x4f3e7a){if(_0x4f3e7a){_0x4f3e7a[_0xbfb8('0x15')]({'lastMsgAt':_0x16ade4['createdAt'],'lastMsgDirection':_0x16ade4[_0xbfb8('0x16')][_0xbfb8('0xf')]()});}})[_0xbfb8('0x17')](function(_0x4c0e30){console[_0xbfb8('0x18')](_0x4c0e30);});}if(_0x16ade4[_0xbfb8('0x16')]==='out'&&!_0x16ade4['secret']){var _0x2f444e;_0x3c5000[_0xbfb8('0x19')]['find']({'where':{'id':_0x16ade4[_0xbfb8('0x1a')]},'raw':!![]})[_0xbfb8('0x1b')](function(_0x4d9847){_0x2f444e=_0x4d9847;if(_0x2f444e&&_0x2f444e[_0xbfb8('0x1c')]){switch(_0x2f444e[_0xbfb8('0x1c')]){case'twilio':var _0x55bfe4=require(_0xbfb8('0x1d'));if(_0x2f444e[_0xbfb8('0x1e')]&&_0x2f444e['authToken']&&_0x2f444e[_0xbfb8('0x1f')]){var _0x2792e2=new _0x55bfe4(_0x2f444e[_0xbfb8('0x1e')],_0x2f444e[_0xbfb8('0x20')]);_0x2792e2[_0xbfb8('0x21')]['create']({'body':_0x16ade4['body'],'to':_0x16ade4['phone'],'from':_0x2f444e[_0xbfb8('0x1f')],'statusCallback':_0x2f444e['remote']+_0xbfb8('0x22')+_0x16ade4['id']+_0xbfb8('0x23')+_0x2f444e[_0xbfb8('0x24')]})['then'](function(_0x3ca041){if(_0x3ca041['sid']){return _0x38917b[_0xbfb8('0x15')]({'messageId':_0x3ca041['sid']});}})[_0xbfb8('0x17')](function(_0x336a21){logger[_0xbfb8('0x18')](_0xbfb8('0x25'),_0xbfb8('0x26'),_0xbfb8('0x1d'),util[_0xbfb8('0x27')](_0x336a21,{'showHidden':![],'depth':null}));});}else{logger[_0xbfb8('0x18')](_0xbfb8('0x25'),_0xbfb8('0x26'),_0xbfb8('0x1d'),'Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken');}break;case _0xbfb8('0x28'):var _0x4f80d8=_0xbfb8('0x29');if(_0x2f444e[_0xbfb8('0x2a')]&&_0x2f444e[_0xbfb8('0x2b')]){var _0xe3bbf1={'recipient':[_0x16ade4[_0xbfb8('0x1f')]],'message':_0x16ade4[_0xbfb8('0xc')],'message_type':_0x2f444e[_0xbfb8('0x2c')]};if(_0x2f444e[_0xbfb8('0x2c')]&&_0x2f444e['smsMethod']!=='SI'){_0xe3bbf1['sender']=_0x2f444e[_0xbfb8('0x1f')];}var _0x445a4f={'url':_0x4f80d8+_0xbfb8('0x2d')+_0x2f444e['username']+_0xbfb8('0x2e')+_0x2f444e[_0xbfb8('0x2b')],'method':_0xbfb8('0x2f')};rp(_0x445a4f)['then'](function(_0x77fb4b){var _0x53f4a7=_0x77fb4b[_0xbfb8('0x30')](';');var _0xc8b326={'user_key':_0x53f4a7[0x0],'session_key':_0x53f4a7[0x1]};_0x445a4f={'url':_0x4f80d8+_0xbfb8('0x31'),'method':_0xbfb8('0x32'),'headers':{'user_key':_0xc8b326[_0xbfb8('0x33')],'Session_key':_0xc8b326[_0xbfb8('0x34')]},'json':!![],'body':_0xe3bbf1};return rp(_0x445a4f);})['then'](function(_0x3bc16e){if(_0x3bc16e[_0xbfb8('0x35')]>=0x1){var _0x451683={'messageId':_0x3bc16e[_0xbfb8('0x36')]};if(_0x2f444e[_0xbfb8('0x2c')]!=='GP'||!_0x2f444e[_0xbfb8('0x37')]){_0x451683[_0xbfb8('0x38')]=!![];}return _0x38917b[_0xbfb8('0x15')](_0x451683);}else{return logger[_0xbfb8('0x18')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0xbfb8('0x28'),util[_0xbfb8('0x27')](_0x3bc16e,{'showHidden':![],'depth':null}));}})[_0xbfb8('0x17')](function(_0xb12a67){return logger['error'](_0xbfb8('0x25'),_0xbfb8('0x26'),_0xbfb8('0x28'),util[_0xbfb8('0x27')](_0xb12a67,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xbfb8('0x25'),_0xbfb8('0x26'),_0xbfb8('0x28'),_0xbfb8('0x39'));}break;case _0xbfb8('0x3a'):if(_0x2f444e[_0xbfb8('0x20')]){var _0x3c4a58={'recipient':_0x16ade4['phone'],'message':_0x16ade4[_0xbfb8('0xc')],'sender':_0x2f444e[_0xbfb8('0x3b')]||_0x2f444e[_0xbfb8('0x1f')],'authorization':_0x2f444e[_0xbfb8('0x20')]};var _0x2c35ba={'method':_0xbfb8('0x32'),'uri':_0xbfb8('0x3c'),'body':_0x3c4a58,'json':!![]};rp(_0x2c35ba)[_0xbfb8('0x1b')](function(_0x250fca){var _0x21dcba={'messageId':_0x250fca[_0xbfb8('0x3d')]};if(!_0x2f444e[_0xbfb8('0x37')]){_0x21dcba[_0xbfb8('0x38')]=!![];}return _0x38917b[_0xbfb8('0x15')](_0x21dcba);})[_0xbfb8('0x17')](function(_0x51e89f){logger[_0xbfb8('0x18')](_0xbfb8('0x25'),'afterCreate','connectel',util[_0xbfb8('0x27')](_0x51e89f,{'showHidden':![],'depth':null}));});}else{logger[_0xbfb8('0x18')](_0xbfb8('0x25'),_0xbfb8('0x26'),_0xbfb8('0x3a'),_0xbfb8('0x3e'));}break;case'clicksend':if(_0x2f444e[_0xbfb8('0x2a')]&&_0x2f444e[_0xbfb8('0x2b')]){var _0x3c4a58={'messages':[{'source':_0xbfb8('0x3f'),'to':_0x16ade4[_0xbfb8('0x1f')],'body':_0x16ade4['body'],'from':_0x2f444e[_0xbfb8('0x3b')]||_0x2f444e[_0xbfb8('0x1f')]}]};var _0x279f96=util[_0xbfb8('0x40')]('%s:%s',_0x2f444e[_0xbfb8('0x2a')],_0x2f444e['password']);var _0x2c35ba={'method':_0xbfb8('0x32'),'uri':'https://rest.clicksend.com/v3/sms/send','body':_0x3c4a58,'headers':{'Authorization':util['format'](_0xbfb8('0x41'),new Buffer(_0x279f96)[_0xbfb8('0x42')](_0xbfb8('0x43')))},'json':!![]};rp(_0x2c35ba)[_0xbfb8('0x1b')](function(_0x39f852){if(_0x39f852['http_code']>=0xc8&&_0x39f852[_0xbfb8('0x44')]<=0xce){if(_0x39f852[_0xbfb8('0x45')]&&_0x39f852[_0xbfb8('0x45')]['queued_count']>0x0){var _0x342392=_['head'](_0x39f852[_0xbfb8('0x45')][_0xbfb8('0x21')]);var _0x104baa={'messageId':_0x342392['message_id']};if(!_0x2f444e[_0xbfb8('0x37')]){_0x104baa[_0xbfb8('0x38')]=!![];}return _0x38917b[_0xbfb8('0x15')](_0x104baa);}else{logger[_0xbfb8('0x18')](_0xbfb8('0x25'),_0xbfb8('0x26'),'clickSend',util[_0xbfb8('0x27')](_0x39f852,{'showHidden':![],'depth':null}));}}else{logger[_0xbfb8('0x18')](_0xbfb8('0x25'),'afterCreate',_0xbfb8('0x46'),util[_0xbfb8('0x27')](_0x39f852,{'showHidden':![],'depth':null}));}})[_0xbfb8('0x17')](function(_0x2accff){logger[_0xbfb8('0x18')](_0xbfb8('0x25'),_0xbfb8('0x26'),_0xbfb8('0x46'),util[_0xbfb8('0x27')](_0x2accff,{'showHidden':![],'depth':null}));});}else{logger[_0xbfb8('0x18')](_0xbfb8('0x25'),'afterCreate','clickSend',_0xbfb8('0x39'));}break;case'plivo':if(_0x2f444e['authId']&&_0x2f444e[_0xbfb8('0x20')]){var _0x3c4a58={'dst':_0x16ade4[_0xbfb8('0x1f')],'text':_0x16ade4[_0xbfb8('0xc')],'src':_0x2f444e['senderString']||_0x2f444e[_0xbfb8('0x1f')],'url':_0x2f444e[_0xbfb8('0x47')]+'/api/sms/messages/'+_0x16ade4['id']+_0xbfb8('0x23')+_0x2f444e[_0xbfb8('0x24')]};var _0x279f96=util['format']('%s:%s',_0x2f444e[_0xbfb8('0x48')],_0x2f444e['authToken']);var _0x2c35ba={'method':_0xbfb8('0x32'),'uri':util[_0xbfb8('0x40')](_0xbfb8('0x49'),_0x2f444e[_0xbfb8('0x48')]),'body':_0x3c4a58,'headers':{'Authorization':util[_0xbfb8('0x40')](_0xbfb8('0x41'),new Buffer(_0x279f96)[_0xbfb8('0x42')]('base64'))},'json':!![]};rp(_0x2c35ba)[_0xbfb8('0x1b')](function(_0xa66ba5){var _0x1e5866={'messageId':_0xa66ba5[_0xbfb8('0x4a')][0x0]};return _0x38917b[_0xbfb8('0x15')](_0x1e5866);})[_0xbfb8('0x17')](function(_0x423266){logger[_0xbfb8('0x18')](_0xbfb8('0x25'),'afterCreate',_0xbfb8('0x4b'),util[_0xbfb8('0x27')](_0x423266,{'showHidden':![],'depth':null}));});}else{logger[_0xbfb8('0x18')](_0xbfb8('0x25'),'afterCreate',_0xbfb8('0x4b'),'Missing\x20parameters:\x20authId,\x20authToken');}break;case'infobip':if(_0x2f444e[_0xbfb8('0x2a')]&&_0x2f444e[_0xbfb8('0x2b')]){if(_0x2f444e[_0xbfb8('0x4c')]){var _0x5ddc1f={'method':_0xbfb8('0x32'),'uri':_0x2f444e['baseUrl']+_0xbfb8('0x4d'),'body':{'username':_0x2f444e[_0xbfb8('0x2a')],'password':_0x2f444e[_0xbfb8('0x2b')]},'json':!![]};return rp(_0x5ddc1f)[_0xbfb8('0x1b')](function(_0x2e43e0){var _0x216f03={'method':_0xbfb8('0x32'),'uri':_0x2f444e[_0xbfb8('0x4c')]+_0xbfb8('0x4e'),'body':{'messages':[{'from':_0x2f444e[_0xbfb8('0x1f')],'destinations':[{'to':_0x16ade4[_0xbfb8('0x1f')]}],'text':_0x16ade4[_0xbfb8('0xc')],'notifyUrl':_0x2f444e[_0xbfb8('0x47')]+_0xbfb8('0x22')+_0x16ade4['id']+_0xbfb8('0x23')+_0x2f444e['token'],'notifyContentType':_0xbfb8('0x4f'),'callbackData':_0x2f444e[_0xbfb8('0x1f')]+';'+_0x16ade4[_0xbfb8('0xc')]}]},'headers':{'Authorization':_0xbfb8('0x50')+_0x2e43e0[_0xbfb8('0x24')]},'json':!![]};return rp(_0x216f03)[_0xbfb8('0x1b')](function(_0x1223d2){if(_0x1223d2[_0xbfb8('0x21')]){var _0x3b9b40={'messageId':_0x1223d2[_0xbfb8('0x21')][0x0][_0xbfb8('0xb')]};if(!_0x2f444e[_0xbfb8('0x37')]){_0x3b9b40[_0xbfb8('0x38')]=!![];}return _0x38917b['update'](_0x3b9b40);}else{return logger[_0xbfb8('0x18')](_0xbfb8('0x25'),_0xbfb8('0x26'),'infobip',util[_0xbfb8('0x27')](_0x1223d2,{'showHidden':![],'depth':null}));}});})['catch'](function(_0x34120a){return logger[_0xbfb8('0x18')](_0xbfb8('0x25'),'afterCreate',_0xbfb8('0x51'),util[_0xbfb8('0x27')](_0x34120a,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xbfb8('0x25'),_0xbfb8('0x26'),_0xbfb8('0x51'),_0xbfb8('0x52'));}}else{logger[_0xbfb8('0x18')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xbfb8('0x26'),'infobip','Missing\x20parameters:\x20username,\x20password');}break;case _0xbfb8('0x53'):var _0x2f406f=require(_0xbfb8('0x54'));if(_0x2f444e['apiKey']){var _0xb43cc1={};_0xb43cc1[_0xbfb8('0x55')]=_0x2f444e[_0xbfb8('0x2a')];_0xb43cc1[_0xbfb8('0x1f')]=_0x16ade4[_0xbfb8('0x1f')];_0xb43cc1[_0xbfb8('0x56')]=_0x2f444e[_0xbfb8('0x1f')];_0xb43cc1[_0xbfb8('0x57')]=_0x16ade4[_0xbfb8('0xc')];_0xb43cc1[_0xbfb8('0x58')]=+new Date();var _0x25a831='';var _0x2936c9='';var _0x27589f=Object[_0xbfb8('0x59')](_0xb43cc1);_0x27589f['sort']();for(var _0x287ecb=0x0;_0x287ecb<_0x27589f['length'];_0x287ecb++){if(_0x25a831!=''){_0x25a831+='&';}_0x25a831+=_0x27589f[_0x287ecb]+'='+encodeURIComponent(_0xb43cc1[_0x27589f[_0x287ecb]]);_0x2936c9+=_0xb43cc1[_0x27589f[_0x287ecb]];}_0x2936c9+=_0x2f444e[_0xbfb8('0x5a')];_0x2936c9=_0x2f406f[_0xbfb8('0x5b')](_0xbfb8('0x5c'))[_0xbfb8('0x15')](_0x2936c9)[_0xbfb8('0x5d')]('hex');if(_0x25a831!==''){_0x25a831+='&';}_0x25a831+='signature='+_0x2936c9;var _0x445a4f={'method':_0xbfb8('0x2f'),'uri':_0x2f444e['baseUrl']+_0xbfb8('0x5e')+_0x25a831,'json':!![]};return rp(_0x445a4f)['then'](function(_0x5371a3){var _0x4392fd=Object[_0xbfb8('0x59')](_0x5371a3);if(_0x5371a3[_0x4392fd[0x0]]['error']&&parseInt(_0x5371a3[_0x4392fd[0x0]][_0xbfb8('0x18')])===0x0){var _0x734b6f={'messageId':_0x5371a3[_0x4392fd[0x0]][_0xbfb8('0x5f')]};if(!_0x2f444e[_0xbfb8('0x37')]){_0x734b6f['read']=!![];}return _0x38917b[_0xbfb8('0x15')](_0x734b6f);}else{return logger[_0xbfb8('0x18')](_0xbfb8('0x25'),_0xbfb8('0x26'),_0xbfb8('0x53'),util[_0xbfb8('0x27')](_0x5371a3[_0xbfb8('0x18')],{'showHidden':![],'depth':null}));}})[_0xbfb8('0x17')](function(_0x3870de){return logger[_0xbfb8('0x18')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xbfb8('0x26'),_0xbfb8('0x53'),util[_0xbfb8('0x27')](_0x3870de,{'showHidden':![],'depth':null}));});}else{logger[_0xbfb8('0x18')](_0xbfb8('0x25'),_0xbfb8('0x26'),_0xbfb8('0x53'),_0xbfb8('0x60'));}break;case _0xbfb8('0x61'):if(_0x2f444e['apiKey']){var _0x54c47b={'method':_0xbfb8('0x32'),'uri':_0xbfb8('0x62'),'headers':{'Authorization':_0x2f444e[_0xbfb8('0x5a')]},'body':{'content':_0x16ade4[_0xbfb8('0xc')],'to':[_0x16ade4['phone']],'from':_0x2f444e['phone'],'binary':![],'clientMessageId':'uuid','charset':'UTF-8'},'json':!![]};rp(_0x54c47b)['then'](function(_0x2f92f7){if(!_0x2f92f7[_0xbfb8('0x18')]){var _0x27def8={'messageId':_0x2f92f7[_0xbfb8('0x21')][0x0][_0xbfb8('0x63')]};if(!_0x2f444e[_0xbfb8('0x37')]){_0x27def8[_0xbfb8('0x38')]=!![];}return _0x38917b['update'](_0x27def8);}else{return logger[_0xbfb8('0x18')](_0xbfb8('0x25'),_0xbfb8('0x26'),_0xbfb8('0x61'),util[_0xbfb8('0x27')](_0x2f92f7[_0xbfb8('0x18')],{'showHidden':![],'depth':null}));}})[_0xbfb8('0x17')](function(_0x258faa){return logger[_0xbfb8('0x18')](_0xbfb8('0x25'),_0xbfb8('0x26'),_0xbfb8('0x61'),util['inspect'](_0x258faa,{'showHidden':![],'depth':null}));});}else{logger[_0xbfb8('0x18')](_0xbfb8('0x25'),_0xbfb8('0x26'),_0xbfb8('0x61'),'Missing\x20parameters:\x20apiKey');}break;case'bandwidth':if(_0x2f444e[_0xbfb8('0x2a')]&&_0x2f444e[_0xbfb8('0x2b')]){var _0x279f96=util['format'](_0xbfb8('0x64'),_0x2f444e['username'],_0x2f444e[_0xbfb8('0x2b')]);var _0x2c35ba={'method':_0xbfb8('0x32'),'uri':'https://messaging.bandwidth.com/api/v2/users/'+_0x2f444e[_0xbfb8('0x65')]+_0xbfb8('0x66'),'body':{'to':[_0x16ade4[_0xbfb8('0x1f')]],'text':_0x16ade4[_0xbfb8('0xc')],'from':_0x2f444e['phone'],'applicationId':_0x2f444e[_0xbfb8('0x67')]},'headers':{'Authorization':util[_0xbfb8('0x40')]('Basic\x20%s',new Buffer(_0x279f96)[_0xbfb8('0x42')](_0xbfb8('0x43')))},'json':!![]};rp(_0x2c35ba)['then'](function(_0x4afe76){if(_0x4afe76['id']){var _0x42a4ab={'messageId':_0x4afe76['id']};return _0x38917b[_0xbfb8('0x15')](_0x42a4ab);}else{logger[_0xbfb8('0x18')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0xbfb8('0x68'),util[_0xbfb8('0x27')](_0x4afe76,{'showHidden':![],'depth':null}));}})[_0xbfb8('0x17')](function(_0x1892e7){logger[_0xbfb8('0x18')](_0xbfb8('0x25'),'afterCreate',_0xbfb8('0x68'),util[_0xbfb8('0x27')](_0x1892e7,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xbfb8('0x25'),_0xbfb8('0x26'),_0xbfb8('0x68'),_0xbfb8('0x39'));}break;case _0xbfb8('0x69'):if(_0x2f444e['apiKey']){var _0x2e11ce={};var _0x445a4f={'method':_0xbfb8('0x32'),'uri':'https://api.intelepeer.com/_rest/v4/app/sms/send','headers':{'Authorization':_0xbfb8('0x6a')+_0x2f444e[_0xbfb8('0x5a')],'Content-Type':_0xbfb8('0x4f')},'body':{'from':_0x2f444e[_0xbfb8('0x1f')],'to':_0x16ade4[_0xbfb8('0x1f')],'text':_0x16ade4[_0xbfb8('0xc')]},'json':!![]};return rp(_0x445a4f)[_0xbfb8('0x1b')](function(_0x465a80){if(_0x465a80[_0xbfb8('0x6b')]==0xca){_0x2e11ce[_0xbfb8('0x6c')]=_0x465a80;var _0x47569e={'method':_0xbfb8('0x32'),'uri':_0xbfb8('0x6d'),'headers':{'Authorization':_0xbfb8('0x6a')+_0x2f444e['apiKey'],'Content-Type':_0xbfb8('0x4f')},'body':{'refid':_0x2e11ce['message'][_0xbfb8('0x6e')]},'json':!![]};return rp(_0x47569e)[_0xbfb8('0x1b')](function(_0x524e2b){_0x2e11ce[_0xbfb8('0x6f')]=_0x524e2b;var _0x5abc90={'messageId':_0x2e11ce['message'][_0xbfb8('0x6e')],'read':!![]};return _0x38917b['update'](_0x5abc90);});}else{return logger[_0xbfb8('0x18')](_0xbfb8('0x25'),'afterCreate','intelepeer',util['inspect'](_0x465a80,{'showHidden':![],'depth':null}));}})['catch'](function(_0x50356b){return logger[_0xbfb8('0x18')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xbfb8('0x26'),_0xbfb8('0x69'),util[_0xbfb8('0x27')](_0x50356b,{'showHidden':![],'depth':null}));});}else{return logger[_0xbfb8('0x18')](_0xbfb8('0x25'),_0xbfb8('0x26'),_0xbfb8('0x69'),_0xbfb8('0x70'));}break;}}})[_0xbfb8('0x71')](function(){_0x2d9614();});}else{_0x2d9614();}}},'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.rpc.js b/server/api/smsMessage/smsMessage.rpc.js index f6ec51a..c00794c 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 _0x308c=['jayson/promise','http','redis','localhost','socket.io-emitter','./smsMessage.socket','then','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','SmsMessage','create','body','options','raw','CreateSmsMessage','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0x2adc32,_0xfaf5fe){var _0x8d5a07=function(_0x2e641c){while(--_0x2e641c){_0x2adc32['push'](_0x2adc32['shift']());}};_0x8d5a07(++_0xfaf5fe);}(_0x308c,0x173));var _0xc308=function(_0x122096,_0x60c295){_0x122096=_0x122096-0x0;var _0x3d1966=_0x308c[_0x122096];return _0x3d1966;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xc308('0x0'));var BPromise=require(_0xc308('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc308('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xc308('0x3'));var logger=require(_0xc308('0x4'))(_0xc308('0x5'));var config=require('../../config/environment');var jayson=require(_0xc308('0x6'));var client=jayson['client'][_0xc308('0x7')]({'port':0x232a});config[_0xc308('0x8')]=_['defaults'](config[_0xc308('0x8')],{'host':_0xc308('0x9'),'port':0x18eb});var socket=require(_0xc308('0xa'))(new Redis(config[_0xc308('0x8')]));require(_0xc308('0xb'))['register'](socket);function respondWithRpcPromise(_0x4334c3,_0x456129,_0x171e58){return new BPromise(function(_0x920903,_0x1a9074){return client['request'](_0x4334c3,_0x171e58)[_0xc308('0xc')](function(_0x57566f){logger['info'](_0xc308('0xd'),_0x456129,_0xc308('0xe'));logger[_0xc308('0xf')](_0xc308('0x10'),_0x456129,_0xc308('0xe'),JSON[_0xc308('0x11')](_0x57566f));if(_0x57566f[_0xc308('0x12')]){if(_0x57566f[_0xc308('0x12')]['code']===0x1f4){logger[_0xc308('0x12')]('SmsMessage,\x20%s,\x20%s',_0x456129,_0x57566f[_0xc308('0x12')]['message']);return _0x1a9074(_0x57566f[_0xc308('0x12')][_0xc308('0x13')]);}logger['error']('SmsMessage,\x20%s,\x20%s',_0x456129,_0x57566f['error'][_0xc308('0x13')]);return _0x920903(_0x57566f[_0xc308('0x12')][_0xc308('0x13')]);}else{logger[_0xc308('0x14')](_0xc308('0xd'),_0x456129,_0xc308('0xe'));_0x920903(_0x57566f[_0xc308('0x15')][_0xc308('0x13')]);}})[_0xc308('0x16')](function(_0x393f39){logger[_0xc308('0x12')](_0xc308('0xd'),_0x456129,_0x393f39);_0x1a9074(_0x393f39);});});}exports['CreateSmsMessage']=function(_0x7f5bd3){var _0x25dec8=this;return new Promise(function(_0x4a3429,_0x3e6a7f){return db[_0xc308('0x17')][_0xc308('0x18')](_0x7f5bd3[_0xc308('0x19')],{'raw':_0x7f5bd3['options']?_0x7f5bd3[_0xc308('0x1a')][_0xc308('0x1b')]===undefined?!![]:![]:!![]})['then'](function(_0x3a9c10){logger[_0xc308('0x14')](_0xc308('0x1c'),_0x7f5bd3);logger[_0xc308('0xf')]('CreateSmsMessage',_0x7f5bd3,JSON[_0xc308('0x11')](_0x3a9c10));_0x4a3429(_0x3a9c10);})[_0xc308('0x16')](function(_0x3fc346){logger[_0xc308('0x12')](_0xc308('0x1c'),_0x3fc346[_0xc308('0x13')],_0x7f5bd3);_0x3e6a7f(_0x25dec8[_0xc308('0x12')](0x1f4,_0x3fc346[_0xc308('0x13')]));});});}; \ No newline at end of file +var _0xf7ef=['localhost','socket.io-emitter','./smsMessage.socket','register','request','then','info','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','CreateSmsMessage','SmsMessage','create','body','options','raw','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','http','redis','defaults'];(function(_0x10bcc4,_0x4400e2){var _0x2da988=function(_0x2ee849){while(--_0x2ee849){_0x10bcc4['push'](_0x10bcc4['shift']());}};_0x2da988(++_0x4400e2);}(_0xf7ef,0x181));var _0xff7e=function(_0x289577,_0xc1ba55){_0x289577=_0x289577-0x0;var _0x191cc8=_0xf7ef[_0x289577];return _0x191cc8;};'use strict';var _=require(_0xff7e('0x0'));var util=require(_0xff7e('0x1'));var moment=require(_0xff7e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xff7e('0x3'));var db=require(_0xff7e('0x4'))['db'];var utils=require(_0xff7e('0x5'));var logger=require('../../config/logger')(_0xff7e('0x6'));var config=require('../../config/environment');var jayson=require(_0xff7e('0x7'));var client=jayson['client'][_0xff7e('0x8')]({'port':0x232a});config[_0xff7e('0x9')]=_[_0xff7e('0xa')](config[_0xff7e('0x9')],{'host':_0xff7e('0xb'),'port':0x18eb});var socket=require(_0xff7e('0xc'))(new Redis(config[_0xff7e('0x9')]));require(_0xff7e('0xd'))[_0xff7e('0xe')](socket);function respondWithRpcPromise(_0x2a4f0b,_0x4235ae,_0x2f6a6c){return new BPromise(function(_0x6bcdb5,_0x559149){return client[_0xff7e('0xf')](_0x2a4f0b,_0x2f6a6c)[_0xff7e('0x10')](function(_0x2fa105){logger[_0xff7e('0x11')](_0xff7e('0x12'),_0x4235ae,_0xff7e('0x13'));logger[_0xff7e('0x14')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x4235ae,_0xff7e('0x13'),JSON[_0xff7e('0x15')](_0x2fa105));if(_0x2fa105[_0xff7e('0x16')]){if(_0x2fa105[_0xff7e('0x16')][_0xff7e('0x17')]===0x1f4){logger[_0xff7e('0x16')](_0xff7e('0x12'),_0x4235ae,_0x2fa105[_0xff7e('0x16')][_0xff7e('0x18')]);return _0x559149(_0x2fa105[_0xff7e('0x16')][_0xff7e('0x18')]);}logger[_0xff7e('0x16')]('SmsMessage,\x20%s,\x20%s',_0x4235ae,_0x2fa105[_0xff7e('0x16')][_0xff7e('0x18')]);return _0x6bcdb5(_0x2fa105[_0xff7e('0x16')][_0xff7e('0x18')]);}else{logger['info']('SmsMessage,\x20%s,\x20%s',_0x4235ae,'request\x20sent');_0x6bcdb5(_0x2fa105[_0xff7e('0x19')][_0xff7e('0x18')]);}})['catch'](function(_0x4ee076){logger[_0xff7e('0x16')](_0xff7e('0x12'),_0x4235ae,_0x4ee076);_0x559149(_0x4ee076);});});}exports[_0xff7e('0x1a')]=function(_0x560587){var _0x426c02=this;return new Promise(function(_0x14d9f9,_0x2b90f9){return db[_0xff7e('0x1b')][_0xff7e('0x1c')](_0x560587[_0xff7e('0x1d')],{'raw':_0x560587['options']?_0x560587[_0xff7e('0x1e')][_0xff7e('0x1f')]===undefined?!![]:![]:!![]})[_0xff7e('0x10')](function(_0x2c61a3){logger['info'](_0xff7e('0x1a'),_0x560587);logger[_0xff7e('0x14')]('CreateSmsMessage',_0x560587,JSON[_0xff7e('0x15')](_0x2c61a3));_0x14d9f9(_0x2c61a3);})[_0xff7e('0x20')](function(_0x3f2bdf){logger[_0xff7e('0x16')](_0xff7e('0x1a'),_0x3f2bdf[_0xff7e('0x18')],_0x560587);_0x2b90f9(_0x426c02['error'](0x1f4,_0x3f2bdf[_0xff7e('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.socket.js b/server/api/smsMessage/smsMessage.socket.js index d28a69b..5b51312 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 _0x3d20=['./smsMessage.events','save','emit','removeListener','register'];(function(_0x4defd6,_0x37bbd3){var _0x4c9276=function(_0x1d7a3d){while(--_0x1d7a3d){_0x4defd6['push'](_0x4defd6['shift']());}};_0x4c9276(++_0x37bbd3);}(_0x3d20,0x131));var _0x03d2=function(_0x13b02f,_0x462a53){_0x13b02f=_0x13b02f-0x0;var _0x12e9a6=_0x3d20[_0x13b02f];return _0x12e9a6;};'use strict';var SmsMessageEvents=require(_0x03d2('0x0'));var events=[_0x03d2('0x1'),'remove','update'];function createListener(_0x3ef34a,_0x12d0ab){return function(_0x4fbc9b){_0x12d0ab[_0x03d2('0x2')](_0x3ef34a,_0x4fbc9b);};}function removeListener(_0x3a49df,_0x27ccc7){return function(){SmsMessageEvents[_0x03d2('0x3')](_0x3a49df,_0x27ccc7);};}exports[_0x03d2('0x4')]=function(_0x4cca69){for(var _0x51ee9f=0x0,_0x4e06b5=events['length'];_0x51ee9f<_0x4e06b5;_0x51ee9f++){var _0x44c5b2=events[_0x51ee9f];var _0x14eb7d=createListener('smsMessage:'+_0x44c5b2,_0x4cca69);SmsMessageEvents['on'](_0x44c5b2,_0x14eb7d);}}; \ No newline at end of file +var _0xc9fa=['removeListener','register','length','./smsMessage.events','save','remove','emit'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0xc9fa,0x129));var _0xac9f=function(_0x5f0888,_0x339dae){_0x5f0888=_0x5f0888-0x0;var _0x2cbad2=_0xc9fa[_0x5f0888];return _0x2cbad2;};'use strict';var SmsMessageEvents=require(_0xac9f('0x0'));var events=[_0xac9f('0x1'),_0xac9f('0x2'),'update'];function createListener(_0x21ebb0,_0x4f5ad2){return function(_0x20d10e){_0x4f5ad2[_0xac9f('0x3')](_0x21ebb0,_0x20d10e);};}function removeListener(_0x416dbe,_0x5d5bf6){return function(){SmsMessageEvents[_0xac9f('0x4')](_0x416dbe,_0x5d5bf6);};}exports[_0xac9f('0x5')]=function(_0x509a31){for(var _0x199939=0x0,_0x3f0a33=events[_0xac9f('0x6')];_0x199939<_0x3f0a33;_0x199939++){var _0x21ee84=events[_0x199939];var _0x562307=createListener('smsMessage:'+_0x21ee84,_0x509a31);SmsMessageEvents['on'](_0x21ee84,_0x562307);}}; \ No newline at end of file diff --git a/server/api/smsQueue/index.js b/server/api/smsQueue/index.js index c3149c3..0aab99c 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 _0xfa3a=['delete','removeTeams','removeAgents','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./smsQueue.controller','get','index','/describe','isAuthenticated','describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','getAgents','create','post','addTeams','/:id/users','put','update'];(function(_0x160c73,_0x2ee678){var _0xd9302=function(_0x169454){while(--_0x169454){_0x160c73['push'](_0x160c73['shift']());}};_0xd9302(++_0x2ee678);}(_0xfa3a,0x1b6));var _0xafa3=function(_0x1e1943,_0x1a6d54){_0x1e1943=_0x1e1943-0x0;var _0x4989a9=_0xfa3a[_0x1e1943];return _0x4989a9;};'use strict';var multer=require(_0xafa3('0x0'));var util=require(_0xafa3('0x1'));var path=require(_0xafa3('0x2'));var timeout=require(_0xafa3('0x3'));var express=require('express');var router=express[_0xafa3('0x4')]();var fs_extra=require(_0xafa3('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xafa3('0x6'));var config=require(_0xafa3('0x7'));var controller=require(_0xafa3('0x8'));router[_0xafa3('0x9')]('/',auth['isAuthenticated'](),controller[_0xafa3('0xa')]);router[_0xafa3('0x9')](_0xafa3('0xb'),auth[_0xafa3('0xc')](),controller[_0xafa3('0xd')]);router[_0xafa3('0x9')](_0xafa3('0xe'),auth[_0xafa3('0xc')](),controller[_0xafa3('0xf')]);router['get'](_0xafa3('0x10'),auth['isAuthenticated'](),controller[_0xafa3('0x11')]);router[_0xafa3('0x9')](_0xafa3('0x12'),auth['isAuthenticated'](),controller[_0xafa3('0x13')]);router[_0xafa3('0x9')]('/:id/users',auth[_0xafa3('0xc')](),controller[_0xafa3('0x14')]);router['post']('/',auth[_0xafa3('0xc')](),controller[_0xafa3('0x15')]);router[_0xafa3('0x16')](_0xafa3('0x12'),auth[_0xafa3('0xc')](),controller[_0xafa3('0x17')]);router[_0xafa3('0x16')](_0xafa3('0x18'),auth[_0xafa3('0xc')](),controller['addAgents']);router[_0xafa3('0x19')](_0xafa3('0xe'),auth[_0xafa3('0xc')](),controller[_0xafa3('0x1a')]);router[_0xafa3('0x1b')]('/:id',auth['isAuthenticated'](),controller['destroy']);router[_0xafa3('0x1b')](_0xafa3('0x12'),auth[_0xafa3('0xc')](),controller[_0xafa3('0x1c')]);router[_0xafa3('0x1b')](_0xafa3('0x18'),auth[_0xafa3('0xc')](),controller[_0xafa3('0x1d')]);module[_0xafa3('0x1e')]=router; \ No newline at end of file +var _0xd82d=['describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','create','post','put','update','delete','destroy','removeAgents','exports','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsQueue.controller','get','isAuthenticated','index','/describe'];(function(_0x2ed2f0,_0x1f75c2){var _0x4a4969=function(_0x42ed5d){while(--_0x42ed5d){_0x2ed2f0['push'](_0x2ed2f0['shift']());}};_0x4a4969(++_0x1f75c2);}(_0xd82d,0x145));var _0xdd82=function(_0x211a51,_0x4e0374){_0x211a51=_0x211a51-0x0;var _0x54f820=_0xd82d[_0x211a51];return _0x54f820;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0xdd82('0x0'));var express=require('express');var router=express[_0xdd82('0x1')]();var fs_extra=require(_0xdd82('0x2'));var auth=require(_0xdd82('0x3'));var interaction=require(_0xdd82('0x4'));var config=require(_0xdd82('0x5'));var controller=require(_0xdd82('0x6'));router[_0xdd82('0x7')]('/',auth[_0xdd82('0x8')](),controller[_0xdd82('0x9')]);router['get'](_0xdd82('0xa'),auth['isAuthenticated'](),controller[_0xdd82('0xb')]);router[_0xdd82('0x7')](_0xdd82('0xc'),auth[_0xdd82('0x8')](),controller[_0xdd82('0xd')]);router[_0xdd82('0x7')](_0xdd82('0xe'),auth['isAuthenticated'](),controller[_0xdd82('0xf')]);router[_0xdd82('0x7')](_0xdd82('0x10'),auth['isAuthenticated'](),controller[_0xdd82('0x11')]);router[_0xdd82('0x7')](_0xdd82('0x12'),auth[_0xdd82('0x8')](),controller[_0xdd82('0x13')]);router['post']('/',auth['isAuthenticated'](),controller[_0xdd82('0x14')]);router[_0xdd82('0x15')](_0xdd82('0x10'),auth[_0xdd82('0x8')](),controller['addTeams']);router[_0xdd82('0x15')](_0xdd82('0x12'),auth[_0xdd82('0x8')](),controller['addAgents']);router[_0xdd82('0x16')](_0xdd82('0xc'),auth[_0xdd82('0x8')](),controller[_0xdd82('0x17')]);router[_0xdd82('0x18')](_0xdd82('0xc'),auth['isAuthenticated'](),controller[_0xdd82('0x19')]);router['delete']('/:id/teams',auth[_0xdd82('0x8')](),controller['removeTeams']);router[_0xdd82('0x18')]('/:id/users',auth[_0xdd82('0x8')](),controller[_0xdd82('0x1a')]);module[_0xdd82('0x1b')]=router; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.attributes.js b/server/api/smsQueue/smsQueue.attributes.js index 7d5eb6f..b92927d 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 _0x81e9=['INTEGER','ENUM','rrmemory','beepall','roundrobin','STRING','name'];(function(_0x598689,_0x1c9369){var _0x3f3c69=function(_0x48de9a){while(--_0x48de9a){_0x598689['push'](_0x598689['shift']());}};_0x3f3c69(++_0x1c9369);}(_0x81e9,0xa6));var _0x981e=function(_0x29b609,_0x19d388){_0x29b609=_0x29b609-0x0;var _0x54c952=_0x81e9[_0x29b609];return _0x54c952;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x981e('0x0')],'unique':_0x981e('0x1'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x981e('0x0')]},'timeout':{'type':Sequelize[_0x981e('0x2')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x981e('0x3')](_0x981e('0x4'),_0x981e('0x5'),_0x981e('0x6'))}}; \ No newline at end of file +var _0x7fb9=['beepall','roundrobin','name','STRING','INTEGER'];(function(_0x1e33b5,_0x48feec){var _0x2a6450=function(_0x35de64){while(--_0x35de64){_0x1e33b5['push'](_0x1e33b5['shift']());}};_0x2a6450(++_0x48feec);}(_0x7fb9,0x11f));var _0x97fb=function(_0x12d033,_0x25fa2f){_0x12d033=_0x12d033-0x0;var _0x3b4e80=_0x7fb9[_0x12d033];return _0x3b4e80;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0x97fb('0x0'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x97fb('0x1')]},'timeout':{'type':Sequelize[_0x97fb('0x2')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM']('rrmemory',_0x97fb('0x3'),_0x97fb('0x4'))}}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.controller.js b/server/api/smsQueue/smsQueue.controller.js index d652901..a49fd95 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 _0x0551=['../../mysqldb','redis','defaults','socket.io-emitter','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','UserProfileResource','error','stack','name','send','index','SmsQueue','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','show','length','catch','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','SmsQueues','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','getMembers','findOne','UserSmsQueue','SmsQueueId','options','User','findAndCountAll','agent','smsPause','updatedAt','createdAt','%s/%s','getTeams','Team','addTeams','ids','online','interface','flatMap','Agents','sequelize','transaction','each','findOrCreate','forEach','emit','userSmsQueue:save','field','tq.TeamId','from','team_has_sms_queues','join','user_has_teams','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','all','union','value','isEmpty','userSmsQueue:remove','addAgents','omit','spread','find','removeAgents','isArray','getAgents','eml-format','zip-dir','fast-json-patch','request-promise','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util'];(function(_0xf25430,_0x1f276e){var _0x446ede=function(_0xef399d){while(--_0xef399d){_0xf25430['push'](_0xf25430['shift']());}};_0x446ede(++_0x1f276e);}(_0x0551,0x191));var _0x1055=function(_0x196dc5,_0x50be9d){_0x196dc5=_0x196dc5-0x0;var _0x56458e=_0x0551[_0x196dc5];return _0x56458e;};'use strict';var emlformat=require(_0x1055('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x1055('0x1'));var jsonpatch=require(_0x1055('0x2'));var rp=require(_0x1055('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x1055('0x4'));var path=require(_0x1055('0x5'));var sox=require(_0x1055('0x6'));var csv=require(_0x1055('0x7'));var ejs=require(_0x1055('0x8'));var fs=require('fs');var fs_extra=require(_0x1055('0x9'));var _=require(_0x1055('0xa'));var squel=require(_0x1055('0xb'));var crypto=require(_0x1055('0xc'));var jsforce=require(_0x1055('0xd'));var deskjs=require(_0x1055('0xe'));var toCsv=require(_0x1055('0x7'));var querystring=require(_0x1055('0xf'));var Papa=require(_0x1055('0x10'));var Redis=require(_0x1055('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x1055('0x12'));var hardwareService=require(_0x1055('0x13'));var logger=require(_0x1055('0x14'))(_0x1055('0x15'));var utils=require(_0x1055('0x16'));var config=require(_0x1055('0x17'));var licenseUtil=require(_0x1055('0x18'));var db=require(_0x1055('0x19'))['db'];config[_0x1055('0x1a')]=_[_0x1055('0x1b')](config[_0x1055('0x1a')],{'host':'localhost','port':0x18eb});var socket=require(_0x1055('0x1c'))(new Redis(config[_0x1055('0x1a')]));require('./smsQueue.socket')['register'](socket);function respondWithStatusCode(_0x57bb24,_0xf8ed56){_0xf8ed56=_0xf8ed56||0xcc;return function(_0x37ec22){if(_0x37ec22){return _0x57bb24[_0x1055('0x1d')](_0xf8ed56);}return _0x57bb24[_0x1055('0x1e')](_0xf8ed56)[_0x1055('0x1f')]();};}function respondWithResult(_0x5be15d,_0x2edfd0){_0x2edfd0=_0x2edfd0||0xc8;return function(_0x474d2e){if(_0x474d2e){return _0x5be15d[_0x1055('0x1e')](_0x2edfd0)[_0x1055('0x20')](_0x474d2e);}};}function respondWithFilteredResult(_0x269f21,_0x2a6c86){return function(_0x438e05){if(_0x438e05){var _0x4f302a=typeof _0x2a6c86[_0x1055('0x21')]===_0x1055('0x22')&&typeof _0x2a6c86[_0x1055('0x23')]===_0x1055('0x22');var _0x27d83c=_0x438e05[_0x1055('0x24')];var _0x2702ed=_0x4f302a?0x0:_0x2a6c86[_0x1055('0x21')];var _0x500930=_0x4f302a?_0x438e05[_0x1055('0x24')]:_0x2a6c86[_0x1055('0x21')]+_0x2a6c86['limit'];var _0x275d39;if(_0x500930>=_0x27d83c){_0x500930=_0x27d83c;_0x275d39=0xc8;}else{_0x275d39=0xce;}_0x269f21[_0x1055('0x1e')](_0x275d39);return _0x269f21[_0x1055('0x25')]('Content-Range',_0x2702ed+'-'+_0x500930+'/'+_0x27d83c)[_0x1055('0x20')](_0x438e05);}return null;};}function patchUpdates(_0x4d8319){return function(_0x22dec5){try{jsonpatch[_0x1055('0x26')](_0x22dec5,_0x4d8319,!![]);}catch(_0x50daa2){return BPromise[_0x1055('0x27')](_0x50daa2);}return _0x22dec5[_0x1055('0x28')]();};}function saveUpdates(_0x36c9ed,_0x1d7fe1){return function(_0x17d1c7){if(_0x17d1c7){return _0x17d1c7[_0x1055('0x29')](_0x36c9ed)[_0x1055('0x2a')](function(_0x5cac2d){return _0x5cac2d;});}return null;};}function removeEntity(_0x4eb893,_0x4107ce){return function(_0x1a4e45){if(_0x1a4e45){return _0x1a4e45[_0x1055('0x2b')]()[_0x1055('0x2a')](function(){var _0x362ce1=_0x1a4e45['get']({'plain':!![]});var _0x136473='SmsQueues';return db[_0x1055('0x2c')][_0x1055('0x2b')]({'where':{'type':_0x136473,'resourceId':_0x362ce1['id']}})['then'](function(){return _0x1a4e45;});})['then'](function(){_0x4eb893[_0x1055('0x1e')](0xcc)[_0x1055('0x1f')]();});}};}function handleEntityNotFound(_0x4743c6,_0x131cae){return function(_0x13500a){if(!_0x13500a){_0x4743c6[_0x1055('0x1d')](0x194);}return _0x13500a;};}function handleError(_0x22b26b,_0x6271bd){_0x6271bd=_0x6271bd||0x1f4;return function(_0x27d064){logger[_0x1055('0x2d')](_0x27d064[_0x1055('0x2e')]);if(_0x27d064[_0x1055('0x2f')]){delete _0x27d064['name'];}_0x22b26b[_0x1055('0x1e')](_0x6271bd)[_0x1055('0x30')](_0x27d064);};}exports[_0x1055('0x31')]=function(_0x5417d3,_0x5af492){var _0x73b11b={},_0x58ba73={},_0x32ffb0={'count':0x0,'rows':[]};var _0x174edf=_['map'](db[_0x1055('0x32')][_0x1055('0x33')],function(_0xeec678){return{'name':_0xeec678[_0x1055('0x34')],'type':_0xeec678[_0x1055('0x35')][_0x1055('0x36')]};});_0x58ba73[_0x1055('0x37')]=_[_0x1055('0x38')](_0x174edf,_0x1055('0x2f'));_0x58ba73[_0x1055('0x39')]=_[_0x1055('0x3a')](_0x5417d3[_0x1055('0x39')]);_0x58ba73[_0x1055('0x3b')]=_[_0x1055('0x3c')](_0x58ba73[_0x1055('0x37')],_0x58ba73['query']);_0x73b11b['attributes']=_[_0x1055('0x3c')](_0x58ba73[_0x1055('0x37')],qs[_0x1055('0x3d')](_0x5417d3['query']['fields']));_0x73b11b[_0x1055('0x3e')]=_0x73b11b[_0x1055('0x3e')]['length']?_0x73b11b[_0x1055('0x3e')]:_0x58ba73[_0x1055('0x37')];if(!_0x5417d3[_0x1055('0x39')][_0x1055('0x3f')](_0x1055('0x40'))){_0x73b11b['limit']=qs[_0x1055('0x23')](_0x5417d3['query'][_0x1055('0x23')]);_0x73b11b[_0x1055('0x21')]=qs['offset'](_0x5417d3[_0x1055('0x39')][_0x1055('0x21')]);}_0x73b11b[_0x1055('0x41')]=qs[_0x1055('0x42')](_0x5417d3[_0x1055('0x39')][_0x1055('0x42')]);_0x73b11b[_0x1055('0x43')]=qs[_0x1055('0x3b')](_[_0x1055('0x44')](_0x5417d3['query'],_0x58ba73[_0x1055('0x3b')]),_0x174edf);if(_0x5417d3[_0x1055('0x39')][_0x1055('0x45')]){_0x73b11b[_0x1055('0x43')]=_[_0x1055('0x46')](_0x73b11b['where'],{'$or':_[_0x1055('0x38')](_0x174edf,function(_0x29c4ea){if(_0x29c4ea[_0x1055('0x35')]!==_0x1055('0x47')){var _0xb52b3b={};_0xb52b3b[_0x29c4ea[_0x1055('0x2f')]]={'$like':'%'+_0x5417d3[_0x1055('0x39')][_0x1055('0x45')]+'%'};return _0xb52b3b;}})});}_0x73b11b=_[_0x1055('0x46')]({},_0x73b11b,_0x5417d3['options']);var _0x9fb858={'where':_0x73b11b[_0x1055('0x43')]};return db[_0x1055('0x32')]['count'](_0x9fb858)[_0x1055('0x2a')](function(_0x642ea8){_0x32ffb0[_0x1055('0x24')]=_0x642ea8;if(_0x5417d3[_0x1055('0x39')][_0x1055('0x48')]){_0x73b11b[_0x1055('0x49')]=[{'all':!![]}];}return db[_0x1055('0x32')][_0x1055('0x4a')](_0x73b11b);})['then'](function(_0x58007e){_0x32ffb0[_0x1055('0x4b')]=_0x58007e;return _0x32ffb0;})[_0x1055('0x2a')](respondWithFilteredResult(_0x5af492,_0x73b11b))['catch'](handleError(_0x5af492,null));};exports[_0x1055('0x4c')]=function(_0x8829cd,_0x4da3b2){var _0x4163d6={'raw':!![],'where':{'id':_0x8829cd['params']['id']}},_0x58c7a5={};_0x58c7a5['model']=_[_0x1055('0x3a')](db[_0x1055('0x32')][_0x1055('0x33')]);_0x58c7a5['query']=_[_0x1055('0x3a')](_0x8829cd[_0x1055('0x39')]);_0x58c7a5['filters']=_['intersection'](_0x58c7a5[_0x1055('0x37')],_0x58c7a5[_0x1055('0x39')]);_0x4163d6[_0x1055('0x3e')]=_[_0x1055('0x3c')](_0x58c7a5['model'],qs[_0x1055('0x3d')](_0x8829cd['query'][_0x1055('0x3d')]));_0x4163d6[_0x1055('0x3e')]=_0x4163d6['attributes'][_0x1055('0x4d')]?_0x4163d6[_0x1055('0x3e')]:_0x58c7a5[_0x1055('0x37')];if(_0x8829cd[_0x1055('0x39')]['includeAll']){_0x4163d6[_0x1055('0x49')]=[{'all':!![]}];}_0x4163d6=_['merge']({},_0x4163d6,_0x8829cd['options']);return db[_0x1055('0x32')]['find'](_0x4163d6)[_0x1055('0x2a')](handleEntityNotFound(_0x4da3b2,null))['then'](respondWithResult(_0x4da3b2,null))[_0x1055('0x4e')](handleError(_0x4da3b2,null));};exports[_0x1055('0x4f')]=function(_0x2e583b,_0x12fcf7){return db['SmsQueue']['create'](_0x2e583b[_0x1055('0x50')],{})[_0x1055('0x2a')](function(_0x254173){var _0x3ae12d=_0x2e583b[_0x1055('0x51')][_0x1055('0x52')]({'plain':!![]});if(!_0x3ae12d)throw new Error(_0x1055('0x53'));if(_0x3ae12d['role']===_0x1055('0x51')){var _0x513883=_0x254173[_0x1055('0x52')]({'plain':!![]});var _0x2f9535=_0x1055('0x54');return db['UserProfileSection']['find']({'where':{'name':_0x2f9535,'userProfileId':_0x3ae12d[_0x1055('0x55')]},'raw':!![]})[_0x1055('0x2a')](function(_0x4c9ea2){if(_0x4c9ea2&&_0x4c9ea2[_0x1055('0x56')]===0x0){return db['UserProfileResource'][_0x1055('0x4f')]({'name':_0x513883['name'],'resourceId':_0x513883['id'],'type':_0x4c9ea2[_0x1055('0x2f')],'sectionId':_0x4c9ea2['id']},{})[_0x1055('0x2a')](function(){return _0x254173;});}else{return _0x254173;}})[_0x1055('0x4e')](function(_0x24bae8){logger[_0x1055('0x2d')](_0x1055('0x57'),_0x24bae8);throw _0x24bae8;});}return _0x254173;})[_0x1055('0x2a')](respondWithResult(_0x12fcf7,0xc9))['catch'](handleError(_0x12fcf7,null));};exports['update']=function(_0x276c4f,_0x4e95a1){if(_0x276c4f['body']['id']){delete _0x276c4f[_0x1055('0x50')]['id'];}return db['SmsQueue']['find']({'where':{'id':_0x276c4f[_0x1055('0x58')]['id']}})[_0x1055('0x2a')](handleEntityNotFound(_0x4e95a1,null))['then'](saveUpdates(_0x276c4f[_0x1055('0x50')],null))[_0x1055('0x2a')](respondWithResult(_0x4e95a1,null))[_0x1055('0x4e')](handleError(_0x4e95a1,null));};exports[_0x1055('0x2b')]=function(_0x1fb3c8,_0x49f4a8){return db[_0x1055('0x32')]['find']({'where':{'id':_0x1fb3c8['params']['id']}})['then'](handleEntityNotFound(_0x49f4a8,null))[_0x1055('0x2a')](removeEntity(_0x49f4a8,null))[_0x1055('0x4e')](handleError(_0x49f4a8,null));};exports[_0x1055('0x59')]=function(_0x38dcc1,_0x147a7c){return db['SmsQueue'][_0x1055('0x59')]()[_0x1055('0x2a')](respondWithResult(_0x147a7c,null))['catch'](handleError(_0x147a7c,null));};exports[_0x1055('0x5a')]=function(_0x282f7e,_0x3a8aba,_0xa7a3be){var _0x45b5f={'raw':!![],'where':{}},_0x7ff5dc={},_0x2f20af;return db[_0x1055('0x32')][_0x1055('0x5b')]({'where':{'id':_0x282f7e[_0x1055('0x58')]['id']}})['then'](handleEntityNotFound(_0x3a8aba,null))[_0x1055('0x2a')](function(_0x173baa){if(_0x173baa){_0x2f20af=_0x173baa[_0x1055('0x52')]({'plain':!![]});_0x7ff5dc[_0x1055('0x37')]=_[_0x1055('0x3a')](db[_0x1055('0x5c')]['rawAttributes']);_0x7ff5dc[_0x1055('0x39')]=_[_0x1055('0x3a')](_0x282f7e[_0x1055('0x39')]);_0x7ff5dc['filters']=_[_0x1055('0x3c')](_0x7ff5dc[_0x1055('0x37')],_0x7ff5dc[_0x1055('0x39')]);_0x45b5f[_0x1055('0x3e')]=_[_0x1055('0x3c')](_0x7ff5dc[_0x1055('0x37')],qs[_0x1055('0x3d')](_0x282f7e[_0x1055('0x39')][_0x1055('0x3d')]));_0x45b5f[_0x1055('0x3e')]=_0x45b5f['attributes'][_0x1055('0x4d')]?_0x45b5f[_0x1055('0x3e')]:_0x7ff5dc[_0x1055('0x37')];if(!_0x282f7e['query'][_0x1055('0x3f')](_0x1055('0x40'))){_0x45b5f['limit']=qs[_0x1055('0x23')](_0x282f7e[_0x1055('0x39')][_0x1055('0x23')]);_0x45b5f[_0x1055('0x21')]=qs['offset'](_0x282f7e[_0x1055('0x39')][_0x1055('0x21')]);}_0x45b5f[_0x1055('0x41')]=qs[_0x1055('0x42')](_0x282f7e[_0x1055('0x39')][_0x1055('0x42')]);_0x45b5f[_0x1055('0x43')]=qs[_0x1055('0x3b')](_[_0x1055('0x44')](_0x282f7e[_0x1055('0x39')],_0x7ff5dc[_0x1055('0x3b')]));_0x45b5f[_0x1055('0x43')][_0x1055('0x5d')]=_0x173baa['id'];if(_0x282f7e[_0x1055('0x39')][_0x1055('0x45')]){_0x45b5f[_0x1055('0x43')]=_[_0x1055('0x46')](_0x45b5f[_0x1055('0x43')],{'$or':_['map'](_0x45b5f[_0x1055('0x3e')],function(_0x689d18){var _0x1fb711={};_0x1fb711[_0x689d18]={'$like':'%'+_0x282f7e[_0x1055('0x39')][_0x1055('0x45')]+'%'};return _0x1fb711;})});}_0x45b5f=_[_0x1055('0x46')]({},_0x45b5f,_0x282f7e[_0x1055('0x5e')]);return db[_0x1055('0x5c')][_0x1055('0x4a')](_0x45b5f);}})[_0x1055('0x2a')](function(_0x2a11fb){if(_0x2a11fb){return db[_0x1055('0x5f')][_0x1055('0x60')]({'where':{'id':_[_0x1055('0x38')](_0x2a11fb,'UserId'),'role':_0x1055('0x61')},'attributes':['id',_0x1055('0x2f'),_0x1055('0x62'),_0x1055('0x63'),_0x1055('0x64')]});}})[_0x1055('0x2a')](function(_0x73e99a){if(_0x73e99a){return{'count':_0x73e99a[_0x1055('0x24')],'rows':_[_0x1055('0x38')](_0x73e99a[_0x1055('0x4b')],function(_0x2d535a){return{'membername':_0x2d535a[_0x1055('0x2f')],'UserId':_0x2d535a['id'],'queue_name':_0x2f20af[_0x1055('0x2f')],'SmsQueueId':_0x2f20af['id'],'interface':util['format'](_0x1055('0x65'),'SIP',_0x2d535a[_0x1055('0x2f')]),'penalty':0x0,'paused':_0x2d535a[_0x1055('0x62')],'createdAt':_0x2d535a['createdAt'],'updatedAt':_0x2d535a[_0x1055('0x63')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x3a8aba,_0x45b5f))[_0x1055('0x4e')](handleError(_0x3a8aba,null));};exports[_0x1055('0x66')]=function(_0x3df832,_0x60498e,_0x22295d){var _0x2ca98c={};var _0x14307a={};var _0x1a796c;var _0x4b764b;return db[_0x1055('0x32')][_0x1055('0x5b')]({'where':{'id':_0x3df832[_0x1055('0x58')]['id']}})['then'](handleEntityNotFound(_0x60498e,null))[_0x1055('0x2a')](function(_0xf2e8d1){if(_0xf2e8d1){_0x1a796c=_0xf2e8d1;_0x14307a[_0x1055('0x37')]=_[_0x1055('0x3a')](db[_0x1055('0x67')][_0x1055('0x33')]);_0x14307a[_0x1055('0x39')]=_['keys'](_0x3df832[_0x1055('0x39')]);_0x14307a[_0x1055('0x3b')]=_[_0x1055('0x3c')](_0x14307a[_0x1055('0x37')],_0x14307a['query']);_0x2ca98c['attributes']=_[_0x1055('0x3c')](_0x14307a[_0x1055('0x37')],qs[_0x1055('0x3d')](_0x3df832[_0x1055('0x39')][_0x1055('0x3d')]));_0x2ca98c[_0x1055('0x3e')]=_0x2ca98c[_0x1055('0x3e')][_0x1055('0x4d')]?_0x2ca98c[_0x1055('0x3e')]:_0x14307a[_0x1055('0x37')];_0x2ca98c[_0x1055('0x41')]=qs[_0x1055('0x42')](_0x3df832[_0x1055('0x39')][_0x1055('0x42')]);_0x2ca98c['where']=qs[_0x1055('0x3b')](_[_0x1055('0x44')](_0x3df832['query'],_0x14307a['filters']));if(_0x3df832['query'][_0x1055('0x45')]){_0x2ca98c[_0x1055('0x43')]=_[_0x1055('0x46')](_0x2ca98c[_0x1055('0x43')],{'$or':_[_0x1055('0x38')](_0x2ca98c[_0x1055('0x3e')],function(_0x3027eb){var _0x2ccdab={};_0x2ccdab[_0x3027eb]={'$like':'%'+_0x3df832[_0x1055('0x39')]['filter']+'%'};return _0x2ccdab;})});}_0x2ca98c=_[_0x1055('0x46')]({},_0x2ca98c,_0x3df832[_0x1055('0x5e')]);return _0x1a796c['getTeams'](_0x2ca98c);}})[_0x1055('0x2a')](function(_0x1f3dd1){if(_0x1f3dd1){_0x4b764b=_0x1f3dd1['length'];if(!_0x3df832[_0x1055('0x39')][_0x1055('0x3f')](_0x1055('0x40'))){_0x2ca98c['limit']=qs[_0x1055('0x23')](_0x3df832[_0x1055('0x39')][_0x1055('0x23')]);_0x2ca98c[_0x1055('0x21')]=qs[_0x1055('0x21')](_0x3df832[_0x1055('0x39')]['offset']);}return _0x1a796c[_0x1055('0x66')](_0x2ca98c);}})[_0x1055('0x2a')](function(_0x49755d){if(_0x49755d){return _0x49755d?{'count':_0x4b764b,'rows':_0x49755d}:null;}})[_0x1055('0x2a')](respondWithResult(_0x60498e,null))['catch'](handleError(_0x60498e,null));};exports[_0x1055('0x68')]=function(_0x44ae14,_0x172d10,_0x295111){var _0x2aa669=_0x44ae14[_0x1055('0x50')][_0x1055('0x69')];return db[_0x1055('0x67')][_0x1055('0x4a')]({'where':{'id':_0x2aa669},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id',_0x1055('0x2f'),_0x1055('0x6a'),'voicePause',_0x1055('0x6b')],'raw':!![]}]})['then'](function(_0x55bfd2){if(_0x55bfd2){var _0x533629=_[_0x1055('0x6c')](_0x55bfd2,function(_0x4716f4){var _0xad8ba9=_0x4716f4['get']({'plain':!![]});return _0xad8ba9[_0x1055('0x6d')];});return db[_0x1055('0x32')]['find']({'where':{'id':_0x44ae14['params']['id']}})['then'](function(_0x3a8c6f){return db[_0x1055('0x6e')][_0x1055('0x6f')](function(_0x107093){return _0x3a8c6f[_0x1055('0x68')](_0x2aa669,{'transaction':_0x107093})[_0x1055('0x2a')](function(){return BPromise[_0x1055('0x70')](_0x533629,function(_0x479116){return db['UserSmsQueue'][_0x1055('0x71')]({'where':{'UserId':_0x479116['id'],'SmsQueueId':_0x44ae14[_0x1055('0x58')]['id']},'transaction':_0x107093});});})[_0x1055('0x2a')](function(){_0x533629[_0x1055('0x72')](function(_0x370794){socket[_0x1055('0x73')](_0x1055('0x74'),{'UserId':_0x370794['id'],'SmsQueueId':_0x3a8c6f['id']});});});});});}})['then'](respondWithStatusCode(_0x172d10,null))['catch'](handleError(_0x172d10,null));};exports['removeTeams']=function(_0x294b92,_0x18944f,_0x263b99){return db[_0x1055('0x67')]['findAll']({'where':{'id':_0x294b92[_0x1055('0x39')][_0x1055('0x69')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x1055('0x6d'),'attributes':['id'],'raw':!![]}]})[_0x1055('0x2a')](handleEntityNotFound(_0x18944f,null))['then'](function(_0x728441){var _0x360853=_[_0x1055('0x38')](_0x728441,'id');var _0x15377f=[];var _0x44cc88=[];var _0x2dd4f9=squel['select']();_0x2dd4f9[_0x1055('0x75')](_0x1055('0x76'))[_0x1055('0x77')](_0x1055('0x78'),'tq')[_0x1055('0x79')](_0x1055('0x7a'),'ut','ut.TeamId\x20=\x20tq.TeamId')['where']('SmsQueueId\x20=\x20?',_0x294b92[_0x1055('0x58')]['id']);for(var _0x2c64dd=0x0;_0x2c64dd<_0x728441[_0x1055('0x4d')];_0x2c64dd+=0x1){let _0x701547=_0x728441[_0x2c64dd];for(var _0x3c5405=0x0;_0x3c5405<_0x701547[_0x1055('0x6d')][_0x1055('0x4d')];_0x3c5405+=0x1){let _0x1690df=_0x701547[_0x1055('0x6d')][_0x3c5405];var _0x483b24=_0x2dd4f9['clone']();_0x483b24[_0x1055('0x43')](_0x1055('0x7b'),_0x1690df['id']);_0x44cc88[_0x1055('0x7c')](db['sequelize'][_0x1055('0x39')](_0x483b24[_0x1055('0x7d')](),{'type':db[_0x1055('0x6e')][_0x1055('0x7e')][_0x1055('0x7f')]})[_0x1055('0x2a')](function(_0xc50dae){if(_0xc50dae[_0x1055('0x4d')]===0x1){return _0x1690df['id'];}else{var _0x16b2f5=_[_0x1055('0x80')](_[_0x1055('0x38')](_0xc50dae,_0x1055('0x81')),function(_0x22b19e){return _['includes'](_0x360853,_0x22b19e);});if(_0x16b2f5){return _0x1690df['id'];}}}));}}return BPromise[_0x1055('0x82')](_0x44cc88)[_0x1055('0x2a')](function(_0x434a69){_0x15377f=_(_0x15377f)[_0x1055('0x83')](_0x434a69)['compact']()[_0x1055('0x84')]();return db[_0x1055('0x32')]['find']({'where':{'id':_0x294b92[_0x1055('0x58')]['id']}})[_0x1055('0x2a')](function(_0x175b83){return db[_0x1055('0x6e')][_0x1055('0x6f')](function(_0x287b7e){return _0x175b83['removeTeams'](_0x294b92['query'][_0x1055('0x69')],{'transaction':_0x287b7e})[_0x1055('0x2a')](function(){if(!_[_0x1055('0x85')](_0x15377f)){return _0x175b83['removeAgents'](_0x15377f,{'transaction':_0x287b7e});}})['then'](function(){_0x15377f['forEach'](function(_0x17270c){socket[_0x1055('0x73')](_0x1055('0x86'),{'UserId':_0x17270c,'SmsQueueId':_0x175b83['id']});});});});});});})[_0x1055('0x2a')](respondWithStatusCode(_0x18944f,null))[_0x1055('0x4e')](handleError(_0x18944f,null));};exports[_0x1055('0x87')]=function(_0x3493d3,_0x40e219,_0x284db7){return db[_0x1055('0x32')]['find']({'where':{'id':_0x3493d3[_0x1055('0x58')]['id']}})['then'](handleEntityNotFound(_0x40e219,null))[_0x1055('0x2a')](function(_0x176f78){if(_0x176f78){return _0x176f78[_0x1055('0x87')](_0x3493d3['body'][_0x1055('0x69')],_[_0x1055('0x88')](_0x3493d3['body'],[_0x1055('0x69'),'id'])||{})[_0x1055('0x89')](function(_0x42cb57){for(var _0x229069=0x0;_0x229069<_0x3493d3[_0x1055('0x50')]['ids'][_0x1055('0x4d')];_0x229069+=0x1){socket[_0x1055('0x73')](_0x1055('0x74'),{'UserId':Number(_0x3493d3[_0x1055('0x50')][_0x1055('0x69')][_0x229069]),'SmsQueueId':Number(_0x3493d3[_0x1055('0x58')]['id'])});}return _0x42cb57;});}})[_0x1055('0x2a')](respondWithResult(_0x40e219,null))[_0x1055('0x4e')](handleError(_0x40e219,null));};exports['removeAgents']=function(_0x473d88,_0xc2426b,_0x315f91){return db[_0x1055('0x32')][_0x1055('0x8a')]({'where':{'id':_0x473d88[_0x1055('0x58')]['id']}})[_0x1055('0x2a')](handleEntityNotFound(_0xc2426b,null))[_0x1055('0x2a')](function(_0x4c559a){if(_0x4c559a){return _0x4c559a[_0x1055('0x8b')](_0x473d88[_0x1055('0x39')][_0x1055('0x69')])[_0x1055('0x2a')](function(){if(_[_0x1055('0x8c')](_0x473d88['query'][_0x1055('0x69')])){for(var _0x1ac85b=0x0;_0x1ac85b<_0x473d88[_0x1055('0x39')][_0x1055('0x69')][_0x1055('0x4d')];_0x1ac85b+=0x1){socket['emit'](_0x1055('0x86'),{'UserId':Number(_0x473d88[_0x1055('0x39')]['ids'][_0x1ac85b]),'SmsQueueId':Number(_0x473d88['params']['id'])});}}else{socket[_0x1055('0x73')](_0x1055('0x86'),{'UserId':Number(_0x473d88[_0x1055('0x39')]['ids']),'SmsQueueId':Number(_0x473d88[_0x1055('0x58')]['id'])});}});}})[_0x1055('0x2a')](respondWithStatusCode(_0xc2426b,null))['catch'](handleError(_0xc2426b,null));};exports[_0x1055('0x8d')]=function(_0x4f464a,_0x1840b2,_0x44503a){var _0x54b765={};var _0xc2217f={};var _0x38be26;var _0x37b40d;return db[_0x1055('0x32')][_0x1055('0x5b')]({'where':{'id':_0x4f464a[_0x1055('0x58')]['id']}})[_0x1055('0x2a')](handleEntityNotFound(_0x1840b2,null))[_0x1055('0x2a')](function(_0x3104c9){if(_0x3104c9){_0x38be26=_0x3104c9;_0xc2217f[_0x1055('0x37')]=_['keys'](db[_0x1055('0x5f')][_0x1055('0x33')]);_0xc2217f[_0x1055('0x39')]=_[_0x1055('0x3a')](_0x4f464a[_0x1055('0x39')]);_0xc2217f[_0x1055('0x3b')]=_[_0x1055('0x3c')](_0xc2217f[_0x1055('0x37')],_0xc2217f[_0x1055('0x39')]);_0x54b765[_0x1055('0x3e')]=_[_0x1055('0x3c')](_0xc2217f[_0x1055('0x37')],qs[_0x1055('0x3d')](_0x4f464a['query'][_0x1055('0x3d')]));_0x54b765[_0x1055('0x3e')]=_0x54b765[_0x1055('0x3e')][_0x1055('0x4d')]?_0x54b765['attributes']:_0xc2217f['model'];_0x54b765[_0x1055('0x41')]=qs['sort'](_0x4f464a[_0x1055('0x39')]['sort']);_0x54b765[_0x1055('0x43')]=qs[_0x1055('0x3b')](_[_0x1055('0x44')](_0x4f464a[_0x1055('0x39')],_0xc2217f['filters']));if(_0x4f464a[_0x1055('0x39')][_0x1055('0x45')]){_0x54b765[_0x1055('0x43')]=_[_0x1055('0x46')](_0x54b765[_0x1055('0x43')],{'$or':_[_0x1055('0x38')](_0x54b765[_0x1055('0x3e')],function(_0x50aebf){var _0x44cb09={};_0x44cb09[_0x50aebf]={'$like':'%'+_0x4f464a[_0x1055('0x39')]['filter']+'%'};return _0x44cb09;})});}_0x54b765=_[_0x1055('0x46')]({},_0x54b765,_0x4f464a['options']);return _0x38be26[_0x1055('0x8d')](_0x54b765);}})[_0x1055('0x2a')](function(_0x59f9fe){if(_0x59f9fe){_0x37b40d=_0x59f9fe[_0x1055('0x4d')];if(!_0x4f464a[_0x1055('0x39')]['hasOwnProperty'](_0x1055('0x40'))){_0x54b765['limit']=qs[_0x1055('0x23')](_0x4f464a[_0x1055('0x39')][_0x1055('0x23')]);_0x54b765['offset']=qs[_0x1055('0x21')](_0x4f464a[_0x1055('0x39')][_0x1055('0x21')]);}return _0x38be26[_0x1055('0x8d')](_0x54b765);}})[_0x1055('0x2a')](function(_0x59927f){if(_0x59927f){return _0x59927f?{'count':_0x37b40d,'rows':_0x59927f}:null;}})[_0x1055('0x2a')](respondWithResult(_0x1840b2,null))[_0x1055('0x4e')](handleError(_0x1840b2,null));}; \ No newline at end of file +var _0xbc3d=['mustache','util','path','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./smsQueue.socket','register','sendStatus','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','UserProfileResource','status','end','name','send','rawAttributes','fieldName','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','pick','filter','where','merge','type','VIRTUAL','options','includeAll','SmsQueue','findAll','catch','show','params','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','SmsQueues','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserSmsQueue','nolimit','SmsQueueId','User','smsPause','updatedAt','createdAt','rows','format','SIP','getTeams','Team','addTeams','Agents','online','voicePause','interface','flatMap','sequelize','findOrCreate','userSmsQueue:save','ids','select','field','tq.TeamId','from','team_has_sms_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','SmsQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','QueryTypes','every','TeamId','includes','all','union','compact','transaction','isEmpty','forEach','emit','addAgents','omit','spread','removeAgents','isArray','userSmsQueue:remove','getAgents','eml-format','request-promise','moment'];(function(_0xbd08b4,_0x4790ed){var _0x314f1e=function(_0x161589){while(--_0x161589){_0xbd08b4['push'](_0xbd08b4['shift']());}};_0x314f1e(++_0x4790ed);}(_0xbc3d,0x1ad));var _0xdbc3=function(_0x4207f4,_0x1f778b){_0x4207f4=_0x4207f4-0x0;var _0x29a621=_0xbc3d[_0x4207f4];return _0x29a621;};'use strict';var emlformat=require(_0xdbc3('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xdbc3('0x1'));var moment=require(_0xdbc3('0x2'));var BPromise=require('bluebird');var Mustache=require(_0xdbc3('0x3'));var util=require(_0xdbc3('0x4'));var path=require(_0xdbc3('0x5'));var sox=require(_0xdbc3('0x6'));var csv=require('to-csv');var ejs=require(_0xdbc3('0x7'));var fs=require('fs');var fs_extra=require(_0xdbc3('0x8'));var _=require(_0xdbc3('0x9'));var squel=require('squel');var crypto=require(_0xdbc3('0xa'));var jsforce=require(_0xdbc3('0xb'));var deskjs=require(_0xdbc3('0xc'));var toCsv=require(_0xdbc3('0xd'));var querystring=require(_0xdbc3('0xe'));var Papa=require(_0xdbc3('0xf'));var Redis=require(_0xdbc3('0x10'));var authService=require(_0xdbc3('0x11'));var qs=require(_0xdbc3('0x12'));var as=require(_0xdbc3('0x13'));var hardwareService=require(_0xdbc3('0x14'));var logger=require(_0xdbc3('0x15'))(_0xdbc3('0x16'));var utils=require(_0xdbc3('0x17'));var config=require(_0xdbc3('0x18'));var licenseUtil=require(_0xdbc3('0x19'));var db=require(_0xdbc3('0x1a'))['db'];config[_0xdbc3('0x1b')]=_['defaults'](config[_0xdbc3('0x1b')],{'host':_0xdbc3('0x1c'),'port':0x18eb});var socket=require(_0xdbc3('0x1d'))(new Redis(config[_0xdbc3('0x1b')]));require(_0xdbc3('0x1e'))[_0xdbc3('0x1f')](socket);function respondWithStatusCode(_0x331b81,_0x11916e){_0x11916e=_0x11916e||0xcc;return function(_0x3e5cf4){if(_0x3e5cf4){return _0x331b81[_0xdbc3('0x20')](_0x11916e);}return _0x331b81['status'](_0x11916e)['end']();};}function respondWithResult(_0x5243bb,_0x2ccb90){_0x2ccb90=_0x2ccb90||0xc8;return function(_0x422cba){if(_0x422cba){return _0x5243bb['status'](_0x2ccb90)[_0xdbc3('0x21')](_0x422cba);}};}function respondWithFilteredResult(_0x5d30f9,_0x31f332){return function(_0x375965){if(_0x375965){var _0x1bb2ba=typeof _0x31f332[_0xdbc3('0x22')]===_0xdbc3('0x23')&&typeof _0x31f332[_0xdbc3('0x24')]===_0xdbc3('0x23');var _0x3026ad=_0x375965['count'];var _0x543d18=_0x1bb2ba?0x0:_0x31f332[_0xdbc3('0x22')];var _0x14e446=_0x1bb2ba?_0x375965[_0xdbc3('0x25')]:_0x31f332[_0xdbc3('0x22')]+_0x31f332['limit'];var _0x24f955;if(_0x14e446>=_0x3026ad){_0x14e446=_0x3026ad;_0x24f955=0xc8;}else{_0x24f955=0xce;}_0x5d30f9['status'](_0x24f955);return _0x5d30f9[_0xdbc3('0x26')](_0xdbc3('0x27'),_0x543d18+'-'+_0x14e446+'/'+_0x3026ad)[_0xdbc3('0x21')](_0x375965);}return null;};}function patchUpdates(_0x19b9a6){return function(_0xd33416){try{jsonpatch[_0xdbc3('0x28')](_0xd33416,_0x19b9a6,!![]);}catch(_0x2153ce){return BPromise[_0xdbc3('0x29')](_0x2153ce);}return _0xd33416['save']();};}function saveUpdates(_0x94160d,_0x2e6a72){return function(_0x1c2f9e){if(_0x1c2f9e){return _0x1c2f9e[_0xdbc3('0x2a')](_0x94160d)[_0xdbc3('0x2b')](function(_0x8d9be2){return _0x8d9be2;});}return null;};}function removeEntity(_0x30e77a,_0x4b056d){return function(_0x1f9a33){if(_0x1f9a33){return _0x1f9a33[_0xdbc3('0x2c')]()['then'](function(){var _0x4e3713=_0x1f9a33['get']({'plain':!![]});var _0x428444='SmsQueues';return db[_0xdbc3('0x2d')][_0xdbc3('0x2c')]({'where':{'type':_0x428444,'resourceId':_0x4e3713['id']}})[_0xdbc3('0x2b')](function(){return _0x1f9a33;});})['then'](function(){_0x30e77a[_0xdbc3('0x2e')](0xcc)[_0xdbc3('0x2f')]();});}};}function handleEntityNotFound(_0x257de9,_0x43a87d){return function(_0x3616b1){if(!_0x3616b1){_0x257de9[_0xdbc3('0x20')](0x194);}return _0x3616b1;};}function handleError(_0x1b3254,_0x396234){_0x396234=_0x396234||0x1f4;return function(_0x1ba693){logger['error'](_0x1ba693['stack']);if(_0x1ba693[_0xdbc3('0x30')]){delete _0x1ba693['name'];}_0x1b3254[_0xdbc3('0x2e')](_0x396234)[_0xdbc3('0x31')](_0x1ba693);};}exports['index']=function(_0xc93138,_0x51241b){var _0x1c9240={},_0x1a5fdb={},_0x3d546d={'count':0x0,'rows':[]};var _0x587547=_['map'](db['SmsQueue'][_0xdbc3('0x32')],function(_0x38d926){return{'name':_0x38d926[_0xdbc3('0x33')],'type':_0x38d926['type'][_0xdbc3('0x34')]};});_0x1a5fdb[_0xdbc3('0x35')]=_[_0xdbc3('0x36')](_0x587547,_0xdbc3('0x30'));_0x1a5fdb[_0xdbc3('0x37')]=_[_0xdbc3('0x38')](_0xc93138[_0xdbc3('0x37')]);_0x1a5fdb[_0xdbc3('0x39')]=_[_0xdbc3('0x3a')](_0x1a5fdb[_0xdbc3('0x35')],_0x1a5fdb[_0xdbc3('0x37')]);_0x1c9240[_0xdbc3('0x3b')]=_[_0xdbc3('0x3a')](_0x1a5fdb[_0xdbc3('0x35')],qs[_0xdbc3('0x3c')](_0xc93138['query'][_0xdbc3('0x3c')]));_0x1c9240['attributes']=_0x1c9240[_0xdbc3('0x3b')][_0xdbc3('0x3d')]?_0x1c9240[_0xdbc3('0x3b')]:_0x1a5fdb[_0xdbc3('0x35')];if(!_0xc93138[_0xdbc3('0x37')][_0xdbc3('0x3e')]('nolimit')){_0x1c9240[_0xdbc3('0x24')]=qs[_0xdbc3('0x24')](_0xc93138['query']['limit']);_0x1c9240['offset']=qs['offset'](_0xc93138[_0xdbc3('0x37')][_0xdbc3('0x22')]);}_0x1c9240[_0xdbc3('0x3f')]=qs[_0xdbc3('0x40')](_0xc93138[_0xdbc3('0x37')][_0xdbc3('0x40')]);_0x1c9240['where']=qs['filters'](_[_0xdbc3('0x41')](_0xc93138['query'],_0x1a5fdb[_0xdbc3('0x39')]),_0x587547);if(_0xc93138['query'][_0xdbc3('0x42')]){_0x1c9240[_0xdbc3('0x43')]=_[_0xdbc3('0x44')](_0x1c9240[_0xdbc3('0x43')],{'$or':_[_0xdbc3('0x36')](_0x587547,function(_0x18719f){if(_0x18719f[_0xdbc3('0x45')]!==_0xdbc3('0x46')){var _0x2a009c={};_0x2a009c[_0x18719f[_0xdbc3('0x30')]]={'$like':'%'+_0xc93138[_0xdbc3('0x37')][_0xdbc3('0x42')]+'%'};return _0x2a009c;}})});}_0x1c9240=_[_0xdbc3('0x44')]({},_0x1c9240,_0xc93138[_0xdbc3('0x47')]);var _0x4a83d8={'where':_0x1c9240[_0xdbc3('0x43')]};return db['SmsQueue'][_0xdbc3('0x25')](_0x4a83d8)[_0xdbc3('0x2b')](function(_0x415340){_0x3d546d[_0xdbc3('0x25')]=_0x415340;if(_0xc93138[_0xdbc3('0x37')][_0xdbc3('0x48')]){_0x1c9240['include']=[{'all':!![]}];}return db[_0xdbc3('0x49')][_0xdbc3('0x4a')](_0x1c9240);})['then'](function(_0x3acb87){_0x3d546d['rows']=_0x3acb87;return _0x3d546d;})['then'](respondWithFilteredResult(_0x51241b,_0x1c9240))[_0xdbc3('0x4b')](handleError(_0x51241b,null));};exports[_0xdbc3('0x4c')]=function(_0x3a9c34,_0xe433f4){var _0x1581de={'raw':!![],'where':{'id':_0x3a9c34[_0xdbc3('0x4d')]['id']}},_0xbc26fb={};_0xbc26fb[_0xdbc3('0x35')]=_[_0xdbc3('0x38')](db[_0xdbc3('0x49')]['rawAttributes']);_0xbc26fb[_0xdbc3('0x37')]=_[_0xdbc3('0x38')](_0x3a9c34[_0xdbc3('0x37')]);_0xbc26fb[_0xdbc3('0x39')]=_[_0xdbc3('0x3a')](_0xbc26fb[_0xdbc3('0x35')],_0xbc26fb[_0xdbc3('0x37')]);_0x1581de['attributes']=_[_0xdbc3('0x3a')](_0xbc26fb[_0xdbc3('0x35')],qs[_0xdbc3('0x3c')](_0x3a9c34[_0xdbc3('0x37')][_0xdbc3('0x3c')]));_0x1581de['attributes']=_0x1581de[_0xdbc3('0x3b')][_0xdbc3('0x3d')]?_0x1581de[_0xdbc3('0x3b')]:_0xbc26fb[_0xdbc3('0x35')];if(_0x3a9c34[_0xdbc3('0x37')][_0xdbc3('0x48')]){_0x1581de['include']=[{'all':!![]}];}_0x1581de=_[_0xdbc3('0x44')]({},_0x1581de,_0x3a9c34[_0xdbc3('0x47')]);return db['SmsQueue'][_0xdbc3('0x4e')](_0x1581de)['then'](handleEntityNotFound(_0xe433f4,null))[_0xdbc3('0x2b')](respondWithResult(_0xe433f4,null))[_0xdbc3('0x4b')](handleError(_0xe433f4,null));};exports[_0xdbc3('0x4f')]=function(_0x54d676,_0x471e55){return db[_0xdbc3('0x49')][_0xdbc3('0x4f')](_0x54d676[_0xdbc3('0x50')],{})['then'](function(_0x3b5c50){var _0x23a6b6=_0x54d676[_0xdbc3('0x51')][_0xdbc3('0x52')]({'plain':!![]});if(!_0x23a6b6)throw new Error(_0xdbc3('0x53'));if(_0x23a6b6[_0xdbc3('0x54')]==='user'){var _0xe4fdf=_0x3b5c50['get']({'plain':!![]});var _0x37adc3=_0xdbc3('0x55');return db['UserProfileSection']['find']({'where':{'name':_0x37adc3,'userProfileId':_0x23a6b6[_0xdbc3('0x56')]},'raw':!![]})[_0xdbc3('0x2b')](function(_0xc4557a){if(_0xc4557a&&_0xc4557a[_0xdbc3('0x57')]===0x0){return db[_0xdbc3('0x2d')]['create']({'name':_0xe4fdf[_0xdbc3('0x30')],'resourceId':_0xe4fdf['id'],'type':_0xc4557a[_0xdbc3('0x30')],'sectionId':_0xc4557a['id']},{})[_0xdbc3('0x2b')](function(){return _0x3b5c50;});}else{return _0x3b5c50;}})[_0xdbc3('0x4b')](function(_0x525e6e){logger[_0xdbc3('0x58')](_0xdbc3('0x59'),_0x525e6e);throw _0x525e6e;});}return _0x3b5c50;})[_0xdbc3('0x2b')](respondWithResult(_0x471e55,0xc9))['catch'](handleError(_0x471e55,null));};exports[_0xdbc3('0x2a')]=function(_0x1996c5,_0x175c38){if(_0x1996c5['body']['id']){delete _0x1996c5['body']['id'];}return db[_0xdbc3('0x49')][_0xdbc3('0x4e')]({'where':{'id':_0x1996c5['params']['id']}})[_0xdbc3('0x2b')](handleEntityNotFound(_0x175c38,null))[_0xdbc3('0x2b')](saveUpdates(_0x1996c5[_0xdbc3('0x50')],null))['then'](respondWithResult(_0x175c38,null))[_0xdbc3('0x4b')](handleError(_0x175c38,null));};exports[_0xdbc3('0x2c')]=function(_0x288c1e,_0xc8b8e5){return db[_0xdbc3('0x49')]['find']({'where':{'id':_0x288c1e[_0xdbc3('0x4d')]['id']}})[_0xdbc3('0x2b')](handleEntityNotFound(_0xc8b8e5,null))[_0xdbc3('0x2b')](removeEntity(_0xc8b8e5,null))[_0xdbc3('0x4b')](handleError(_0xc8b8e5,null));};exports['describe']=function(_0x15b304,_0x37e8f5){return db[_0xdbc3('0x49')][_0xdbc3('0x5a')]()['then'](respondWithResult(_0x37e8f5,null))['catch'](handleError(_0x37e8f5,null));};exports[_0xdbc3('0x5b')]=function(_0xa44f59,_0x4ee62a,_0x5dbb81){var _0x12a092={'raw':!![],'where':{}},_0x57703c={},_0x5bc213;return db[_0xdbc3('0x49')][_0xdbc3('0x5c')]({'where':{'id':_0xa44f59[_0xdbc3('0x4d')]['id']}})['then'](handleEntityNotFound(_0x4ee62a,null))[_0xdbc3('0x2b')](function(_0x480421){if(_0x480421){_0x5bc213=_0x480421[_0xdbc3('0x52')]({'plain':!![]});_0x57703c[_0xdbc3('0x35')]=_[_0xdbc3('0x38')](db[_0xdbc3('0x5d')][_0xdbc3('0x32')]);_0x57703c[_0xdbc3('0x37')]=_['keys'](_0xa44f59[_0xdbc3('0x37')]);_0x57703c[_0xdbc3('0x39')]=_[_0xdbc3('0x3a')](_0x57703c[_0xdbc3('0x35')],_0x57703c[_0xdbc3('0x37')]);_0x12a092[_0xdbc3('0x3b')]=_[_0xdbc3('0x3a')](_0x57703c[_0xdbc3('0x35')],qs['fields'](_0xa44f59[_0xdbc3('0x37')]['fields']));_0x12a092[_0xdbc3('0x3b')]=_0x12a092[_0xdbc3('0x3b')][_0xdbc3('0x3d')]?_0x12a092[_0xdbc3('0x3b')]:_0x57703c[_0xdbc3('0x35')];if(!_0xa44f59[_0xdbc3('0x37')][_0xdbc3('0x3e')](_0xdbc3('0x5e'))){_0x12a092[_0xdbc3('0x24')]=qs[_0xdbc3('0x24')](_0xa44f59[_0xdbc3('0x37')][_0xdbc3('0x24')]);_0x12a092[_0xdbc3('0x22')]=qs['offset'](_0xa44f59[_0xdbc3('0x37')]['offset']);}_0x12a092[_0xdbc3('0x3f')]=qs[_0xdbc3('0x40')](_0xa44f59[_0xdbc3('0x37')]['sort']);_0x12a092[_0xdbc3('0x43')]=qs[_0xdbc3('0x39')](_[_0xdbc3('0x41')](_0xa44f59[_0xdbc3('0x37')],_0x57703c[_0xdbc3('0x39')]));_0x12a092['where'][_0xdbc3('0x5f')]=_0x480421['id'];if(_0xa44f59[_0xdbc3('0x37')]['filter']){_0x12a092['where']=_['merge'](_0x12a092[_0xdbc3('0x43')],{'$or':_[_0xdbc3('0x36')](_0x12a092['attributes'],function(_0x319531){var _0x2c5b4b={};_0x2c5b4b[_0x319531]={'$like':'%'+_0xa44f59[_0xdbc3('0x37')][_0xdbc3('0x42')]+'%'};return _0x2c5b4b;})});}_0x12a092=_['merge']({},_0x12a092,_0xa44f59[_0xdbc3('0x47')]);return db[_0xdbc3('0x5d')]['findAll'](_0x12a092);}})['then'](function(_0x147cc4){if(_0x147cc4){return db[_0xdbc3('0x60')]['findAndCountAll']({'where':{'id':_['map'](_0x147cc4,'UserId'),'role':'agent'},'attributes':['id',_0xdbc3('0x30'),_0xdbc3('0x61'),_0xdbc3('0x62'),_0xdbc3('0x63')]});}})[_0xdbc3('0x2b')](function(_0x333c53){if(_0x333c53){return{'count':_0x333c53[_0xdbc3('0x25')],'rows':_['map'](_0x333c53[_0xdbc3('0x64')],function(_0x4f61ac){return{'membername':_0x4f61ac[_0xdbc3('0x30')],'UserId':_0x4f61ac['id'],'queue_name':_0x5bc213[_0xdbc3('0x30')],'SmsQueueId':_0x5bc213['id'],'interface':util[_0xdbc3('0x65')]('%s/%s',_0xdbc3('0x66'),_0x4f61ac['name']),'penalty':0x0,'paused':_0x4f61ac[_0xdbc3('0x61')],'createdAt':_0x4f61ac['createdAt'],'updatedAt':_0x4f61ac[_0xdbc3('0x62')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xdbc3('0x2b')](respondWithFilteredResult(_0x4ee62a,_0x12a092))['catch'](handleError(_0x4ee62a,null));};exports[_0xdbc3('0x67')]=function(_0x1054f6,_0x4f5306,_0x5602bc){var _0x447f56={};var _0x46bac5={};var _0x43b2eb;var _0x10982b;return db[_0xdbc3('0x49')][_0xdbc3('0x5c')]({'where':{'id':_0x1054f6[_0xdbc3('0x4d')]['id']}})[_0xdbc3('0x2b')](handleEntityNotFound(_0x4f5306,null))[_0xdbc3('0x2b')](function(_0x57c865){if(_0x57c865){_0x43b2eb=_0x57c865;_0x46bac5[_0xdbc3('0x35')]=_[_0xdbc3('0x38')](db[_0xdbc3('0x68')]['rawAttributes']);_0x46bac5[_0xdbc3('0x37')]=_[_0xdbc3('0x38')](_0x1054f6[_0xdbc3('0x37')]);_0x46bac5[_0xdbc3('0x39')]=_[_0xdbc3('0x3a')](_0x46bac5[_0xdbc3('0x35')],_0x46bac5[_0xdbc3('0x37')]);_0x447f56[_0xdbc3('0x3b')]=_[_0xdbc3('0x3a')](_0x46bac5[_0xdbc3('0x35')],qs[_0xdbc3('0x3c')](_0x1054f6['query'][_0xdbc3('0x3c')]));_0x447f56[_0xdbc3('0x3b')]=_0x447f56[_0xdbc3('0x3b')][_0xdbc3('0x3d')]?_0x447f56['attributes']:_0x46bac5['model'];_0x447f56[_0xdbc3('0x3f')]=qs['sort'](_0x1054f6[_0xdbc3('0x37')][_0xdbc3('0x40')]);_0x447f56[_0xdbc3('0x43')]=qs[_0xdbc3('0x39')](_[_0xdbc3('0x41')](_0x1054f6[_0xdbc3('0x37')],_0x46bac5[_0xdbc3('0x39')]));if(_0x1054f6[_0xdbc3('0x37')][_0xdbc3('0x42')]){_0x447f56['where']=_[_0xdbc3('0x44')](_0x447f56[_0xdbc3('0x43')],{'$or':_[_0xdbc3('0x36')](_0x447f56[_0xdbc3('0x3b')],function(_0x52fae1){var _0x3195a8={};_0x3195a8[_0x52fae1]={'$like':'%'+_0x1054f6[_0xdbc3('0x37')][_0xdbc3('0x42')]+'%'};return _0x3195a8;})});}_0x447f56=_['merge']({},_0x447f56,_0x1054f6['options']);return _0x43b2eb['getTeams'](_0x447f56);}})[_0xdbc3('0x2b')](function(_0x80e21e){if(_0x80e21e){_0x10982b=_0x80e21e['length'];if(!_0x1054f6['query'][_0xdbc3('0x3e')](_0xdbc3('0x5e'))){_0x447f56[_0xdbc3('0x24')]=qs[_0xdbc3('0x24')](_0x1054f6[_0xdbc3('0x37')][_0xdbc3('0x24')]);_0x447f56[_0xdbc3('0x22')]=qs[_0xdbc3('0x22')](_0x1054f6[_0xdbc3('0x37')][_0xdbc3('0x22')]);}return _0x43b2eb[_0xdbc3('0x67')](_0x447f56);}})[_0xdbc3('0x2b')](function(_0x461c74){if(_0x461c74){return _0x461c74?{'count':_0x10982b,'rows':_0x461c74}:null;}})[_0xdbc3('0x2b')](respondWithResult(_0x4f5306,null))[_0xdbc3('0x4b')](handleError(_0x4f5306,null));};exports[_0xdbc3('0x69')]=function(_0x558a51,_0x524a44,_0x45c2f1){var _0x38c0a9=_0x558a51[_0xdbc3('0x50')]['ids'];return db[_0xdbc3('0x68')][_0xdbc3('0x4a')]({'where':{'id':_0x38c0a9},'attributes':['id'],'include':[{'model':db[_0xdbc3('0x60')],'as':_0xdbc3('0x6a'),'attributes':['id',_0xdbc3('0x30'),_0xdbc3('0x6b'),_0xdbc3('0x6c'),_0xdbc3('0x6d')],'raw':!![]}]})['then'](function(_0x2dff8e){if(_0x2dff8e){var _0x242070=_[_0xdbc3('0x6e')](_0x2dff8e,function(_0x20ef44){var _0x50337d=_0x20ef44[_0xdbc3('0x52')]({'plain':!![]});return _0x50337d[_0xdbc3('0x6a')];});return db['SmsQueue'][_0xdbc3('0x4e')]({'where':{'id':_0x558a51[_0xdbc3('0x4d')]['id']}})[_0xdbc3('0x2b')](function(_0x44b8f6){return db[_0xdbc3('0x6f')]['transaction'](function(_0x5df37a){return _0x44b8f6[_0xdbc3('0x69')](_0x38c0a9,{'transaction':_0x5df37a})[_0xdbc3('0x2b')](function(){return BPromise['each'](_0x242070,function(_0x427a3d){return db[_0xdbc3('0x5d')][_0xdbc3('0x70')]({'where':{'UserId':_0x427a3d['id'],'SmsQueueId':_0x558a51[_0xdbc3('0x4d')]['id']},'transaction':_0x5df37a});});})[_0xdbc3('0x2b')](function(){_0x242070['forEach'](function(_0x306d0d){socket['emit'](_0xdbc3('0x71'),{'UserId':_0x306d0d['id'],'SmsQueueId':_0x44b8f6['id']});});});});});}})[_0xdbc3('0x2b')](respondWithStatusCode(_0x524a44,null))[_0xdbc3('0x4b')](handleError(_0x524a44,null));};exports['removeTeams']=function(_0x2f2d83,_0x467ddd,_0x5bd6c3){return db[_0xdbc3('0x68')]['findAll']({'where':{'id':_0x2f2d83[_0xdbc3('0x37')][_0xdbc3('0x72')]},'attributes':['id'],'include':[{'model':db[_0xdbc3('0x60')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xdbc3('0x2b')](handleEntityNotFound(_0x467ddd,null))['then'](function(_0x113e98){var _0xb2278a=_['map'](_0x113e98,'id');var _0x51a968=[];var _0x82a742=[];var _0x54ffe3=squel[_0xdbc3('0x73')]();_0x54ffe3[_0xdbc3('0x74')](_0xdbc3('0x75'))[_0xdbc3('0x76')](_0xdbc3('0x77'),'tq')[_0xdbc3('0x78')](_0xdbc3('0x79'),'ut',_0xdbc3('0x7a'))[_0xdbc3('0x43')](_0xdbc3('0x7b'),_0x2f2d83[_0xdbc3('0x4d')]['id']);for(var _0x4c09d6=0x0;_0x4c09d6<_0x113e98['length'];_0x4c09d6+=0x1){let _0x3d1a98=_0x113e98[_0x4c09d6];for(var _0x2e51c3=0x0;_0x2e51c3<_0x3d1a98[_0xdbc3('0x6a')][_0xdbc3('0x3d')];_0x2e51c3+=0x1){let _0x5550e1=_0x3d1a98[_0xdbc3('0x6a')][_0x2e51c3];var _0x5350dd=_0x54ffe3[_0xdbc3('0x7c')]();_0x5350dd[_0xdbc3('0x43')](_0xdbc3('0x7d'),_0x5550e1['id']);_0x82a742['push'](db['sequelize'][_0xdbc3('0x37')](_0x5350dd['toString'](),{'type':db['sequelize'][_0xdbc3('0x7e')]['SELECT']})[_0xdbc3('0x2b')](function(_0x31c75a){if(_0x31c75a['length']===0x1){return _0x5550e1['id'];}else{var _0x5e677d=_[_0xdbc3('0x7f')](_['map'](_0x31c75a,_0xdbc3('0x80')),function(_0x43cf39){return _[_0xdbc3('0x81')](_0xb2278a,_0x43cf39);});if(_0x5e677d){return _0x5550e1['id'];}}}));}}return BPromise[_0xdbc3('0x82')](_0x82a742)[_0xdbc3('0x2b')](function(_0x2e492c){_0x51a968=_(_0x51a968)[_0xdbc3('0x83')](_0x2e492c)[_0xdbc3('0x84')]()['value']();return db[_0xdbc3('0x49')][_0xdbc3('0x4e')]({'where':{'id':_0x2f2d83[_0xdbc3('0x4d')]['id']}})[_0xdbc3('0x2b')](function(_0x39b9b3){return db[_0xdbc3('0x6f')][_0xdbc3('0x85')](function(_0x100425){return _0x39b9b3['removeTeams'](_0x2f2d83[_0xdbc3('0x37')][_0xdbc3('0x72')],{'transaction':_0x100425})[_0xdbc3('0x2b')](function(){if(!_[_0xdbc3('0x86')](_0x51a968)){return _0x39b9b3['removeAgents'](_0x51a968,{'transaction':_0x100425});}})['then'](function(){_0x51a968[_0xdbc3('0x87')](function(_0x4803f4){socket[_0xdbc3('0x88')]('userSmsQueue:remove',{'UserId':_0x4803f4,'SmsQueueId':_0x39b9b3['id']});});});});});});})['then'](respondWithStatusCode(_0x467ddd,null))[_0xdbc3('0x4b')](handleError(_0x467ddd,null));};exports[_0xdbc3('0x89')]=function(_0x584781,_0x39bff4,_0x547bd3){return db[_0xdbc3('0x49')]['find']({'where':{'id':_0x584781['params']['id']}})[_0xdbc3('0x2b')](handleEntityNotFound(_0x39bff4,null))[_0xdbc3('0x2b')](function(_0x1ea6db){if(_0x1ea6db){return _0x1ea6db[_0xdbc3('0x89')](_0x584781[_0xdbc3('0x50')][_0xdbc3('0x72')],_[_0xdbc3('0x8a')](_0x584781[_0xdbc3('0x50')],[_0xdbc3('0x72'),'id'])||{})[_0xdbc3('0x8b')](function(_0x296b50){for(var _0x1610b1=0x0;_0x1610b1<_0x584781['body'][_0xdbc3('0x72')]['length'];_0x1610b1+=0x1){socket[_0xdbc3('0x88')](_0xdbc3('0x71'),{'UserId':Number(_0x584781[_0xdbc3('0x50')][_0xdbc3('0x72')][_0x1610b1]),'SmsQueueId':Number(_0x584781[_0xdbc3('0x4d')]['id'])});}return _0x296b50;});}})[_0xdbc3('0x2b')](respondWithResult(_0x39bff4,null))[_0xdbc3('0x4b')](handleError(_0x39bff4,null));};exports[_0xdbc3('0x8c')]=function(_0x536539,_0x3cbc86,_0x4f181a){return db[_0xdbc3('0x49')][_0xdbc3('0x4e')]({'where':{'id':_0x536539[_0xdbc3('0x4d')]['id']}})[_0xdbc3('0x2b')](handleEntityNotFound(_0x3cbc86,null))[_0xdbc3('0x2b')](function(_0x242e3d){if(_0x242e3d){return _0x242e3d[_0xdbc3('0x8c')](_0x536539[_0xdbc3('0x37')]['ids'])[_0xdbc3('0x2b')](function(){if(_[_0xdbc3('0x8d')](_0x536539[_0xdbc3('0x37')][_0xdbc3('0x72')])){for(var _0x4d6df5=0x0;_0x4d6df5<_0x536539[_0xdbc3('0x37')][_0xdbc3('0x72')]['length'];_0x4d6df5+=0x1){socket[_0xdbc3('0x88')](_0xdbc3('0x8e'),{'UserId':Number(_0x536539[_0xdbc3('0x37')][_0xdbc3('0x72')][_0x4d6df5]),'SmsQueueId':Number(_0x536539[_0xdbc3('0x4d')]['id'])});}}else{socket['emit'](_0xdbc3('0x8e'),{'UserId':Number(_0x536539['query'][_0xdbc3('0x72')]),'SmsQueueId':Number(_0x536539['params']['id'])});}});}})['then'](respondWithStatusCode(_0x3cbc86,null))[_0xdbc3('0x4b')](handleError(_0x3cbc86,null));};exports[_0xdbc3('0x8f')]=function(_0x2ccbc6,_0x1a14e6,_0x4bf126){var _0x5e43ca={};var _0x57f8d1={};var _0xc112b8;var _0x36e5c4;return db[_0xdbc3('0x49')][_0xdbc3('0x5c')]({'where':{'id':_0x2ccbc6[_0xdbc3('0x4d')]['id']}})['then'](handleEntityNotFound(_0x1a14e6,null))[_0xdbc3('0x2b')](function(_0x3d85ff){if(_0x3d85ff){_0xc112b8=_0x3d85ff;_0x57f8d1[_0xdbc3('0x35')]=_[_0xdbc3('0x38')](db[_0xdbc3('0x60')][_0xdbc3('0x32')]);_0x57f8d1[_0xdbc3('0x37')]=_[_0xdbc3('0x38')](_0x2ccbc6['query']);_0x57f8d1[_0xdbc3('0x39')]=_[_0xdbc3('0x3a')](_0x57f8d1[_0xdbc3('0x35')],_0x57f8d1[_0xdbc3('0x37')]);_0x5e43ca['attributes']=_[_0xdbc3('0x3a')](_0x57f8d1[_0xdbc3('0x35')],qs[_0xdbc3('0x3c')](_0x2ccbc6['query'][_0xdbc3('0x3c')]));_0x5e43ca[_0xdbc3('0x3b')]=_0x5e43ca[_0xdbc3('0x3b')][_0xdbc3('0x3d')]?_0x5e43ca[_0xdbc3('0x3b')]:_0x57f8d1[_0xdbc3('0x35')];_0x5e43ca[_0xdbc3('0x3f')]=qs[_0xdbc3('0x40')](_0x2ccbc6[_0xdbc3('0x37')][_0xdbc3('0x40')]);_0x5e43ca[_0xdbc3('0x43')]=qs[_0xdbc3('0x39')](_[_0xdbc3('0x41')](_0x2ccbc6[_0xdbc3('0x37')],_0x57f8d1[_0xdbc3('0x39')]));if(_0x2ccbc6[_0xdbc3('0x37')][_0xdbc3('0x42')]){_0x5e43ca['where']=_[_0xdbc3('0x44')](_0x5e43ca[_0xdbc3('0x43')],{'$or':_[_0xdbc3('0x36')](_0x5e43ca['attributes'],function(_0x21e8f3){var _0x15bea8={};_0x15bea8[_0x21e8f3]={'$like':'%'+_0x2ccbc6[_0xdbc3('0x37')]['filter']+'%'};return _0x15bea8;})});}_0x5e43ca=_['merge']({},_0x5e43ca,_0x2ccbc6['options']);return _0xc112b8[_0xdbc3('0x8f')](_0x5e43ca);}})[_0xdbc3('0x2b')](function(_0x1d371e){if(_0x1d371e){_0x36e5c4=_0x1d371e[_0xdbc3('0x3d')];if(!_0x2ccbc6[_0xdbc3('0x37')]['hasOwnProperty'](_0xdbc3('0x5e'))){_0x5e43ca[_0xdbc3('0x24')]=qs[_0xdbc3('0x24')](_0x2ccbc6['query'][_0xdbc3('0x24')]);_0x5e43ca[_0xdbc3('0x22')]=qs['offset'](_0x2ccbc6[_0xdbc3('0x37')][_0xdbc3('0x22')]);}return _0xc112b8[_0xdbc3('0x8f')](_0x5e43ca);}})['then'](function(_0x164bc3){if(_0x164bc3){return _0x164bc3?{'count':_0x36e5c4,'rows':_0x164bc3}:null;}})[_0xdbc3('0x2b')](respondWithResult(_0x1a14e6,null))['catch'](handleError(_0x1a14e6,null));}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.events.js b/server/api/smsQueue/smsQueue.events.js index e6f9762..0727d4a 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 _0x9e41=['hook','exports','events','../../mysqldb','SmsQueue','setMaxListeners','save','update','remove','emit'];(function(_0x59dfe9,_0x2cc2b5){var _0x170a32=function(_0x1b1725){while(--_0x1b1725){_0x59dfe9['push'](_0x59dfe9['shift']());}};_0x170a32(++_0x2cc2b5);}(_0x9e41,0x1a6));var _0x19e4=function(_0x883b73,_0x5ac016){_0x883b73=_0x883b73-0x0;var _0x4277dd=_0x9e41[_0x883b73];return _0x4277dd;};'use strict';var EventEmitter=require(_0x19e4('0x0'));var SmsQueue=require(_0x19e4('0x1'))['db'][_0x19e4('0x2')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0x19e4('0x3')](0x0);var events={'afterCreate':_0x19e4('0x4'),'afterUpdate':_0x19e4('0x5'),'afterDestroy':_0x19e4('0x6')};function emitEvent(_0x312001){return function(_0x51718a,_0x423834,_0x4e7bf){SmsQueueEvents['emit'](_0x312001+':'+_0x51718a['id'],_0x51718a);SmsQueueEvents[_0x19e4('0x7')](_0x312001,_0x51718a);_0x4e7bf(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsQueue[_0x19e4('0x8')](e,emitEvent(event));}}module[_0x19e4('0x9')]=SmsQueueEvents; \ No newline at end of file +var _0xf671=['hasOwnProperty','hook','events','../../mysqldb','SmsQueue','setMaxListeners','save','emit'];(function(_0x49c5d4,_0x26aba8){var _0x22143=function(_0x203a16){while(--_0x203a16){_0x49c5d4['push'](_0x49c5d4['shift']());}};_0x22143(++_0x26aba8);}(_0xf671,0xb2));var _0x1f67=function(_0x532c55,_0x4dab9a){_0x532c55=_0x532c55-0x0;var _0x1eefe9=_0xf671[_0x532c55];return _0x1eefe9;};'use strict';var EventEmitter=require(_0x1f67('0x0'));var SmsQueue=require(_0x1f67('0x1'))['db'][_0x1f67('0x2')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0x1f67('0x3')](0x0);var events={'afterCreate':_0x1f67('0x4'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x207d5e){return function(_0x45f973,_0x438e20,_0x55997e){SmsQueueEvents['emit'](_0x207d5e+':'+_0x45f973['id'],_0x45f973);SmsQueueEvents[_0x1f67('0x5')](_0x207d5e,_0x45f973);_0x55997e(null);};}for(var e in events){if(events[_0x1f67('0x6')](e)){var event=events[e];SmsQueue[_0x1f67('0x7')](e,emitEvent(event));}}module['exports']=SmsQueueEvents; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.model.js b/server/api/smsQueue/smsQueue.model.js index e89f13b..2aa879f 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 _0xc879=['../../config/environment','./smsQueue.attributes','define','SmsQueue','util','../../config/logger','api','moment','bluebird','path','rimraf'];(function(_0x29b9c3,_0x269ac7){var _0x371b52=function(_0x242a1b){while(--_0x242a1b){_0x29b9c3['push'](_0x29b9c3['shift']());}};_0x371b52(++_0x269ac7);}(_0xc879,0x101));var _0x9c87=function(_0x2112d4,_0x3c863c){_0x2112d4=_0x2112d4-0x0;var _0x434972=_0xc879[_0x2112d4];return _0x434972;};'use strict';var _=require('lodash');var util=require(_0x9c87('0x0'));var logger=require(_0x9c87('0x1'))(_0x9c87('0x2'));var moment=require(_0x9c87('0x3'));var BPromise=require(_0x9c87('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9c87('0x5'));var rimraf=require(_0x9c87('0x6'));var config=require(_0x9c87('0x7'));var attributes=require(_0x9c87('0x8'));module['exports']=function(_0x2f639e,_0x560c7c){return _0x2f639e[_0x9c87('0x9')](_0x9c87('0xa'),attributes,{'tableName':'sms_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfb52=['request-promise','path','exports','SmsQueue','sms_queues','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0xfb52,0x7e));var _0x2fb5=function(_0x4ce178,_0x228a4f){_0x4ce178=_0x4ce178-0x0;var _0x21a47f=_0xfb52[_0x4ce178];return _0x21a47f;};'use strict';var _=require(_0x2fb5('0x0'));var util=require(_0x2fb5('0x1'));var logger=require(_0x2fb5('0x2'))(_0x2fb5('0x3'));var moment=require(_0x2fb5('0x4'));var BPromise=require(_0x2fb5('0x5'));var rp=require(_0x2fb5('0x6'));var fs=require('fs');var path=require(_0x2fb5('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./smsQueue.attributes');module[_0x2fb5('0x8')]=function(_0x5e3f95,_0x113c63){return _0x5e3f95['define'](_0x2fb5('0x9'),attributes,{'tableName':_0x2fb5('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 b1593fe..425c985 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 _0x7cd0=['model','attributes','debug','find','where','ShowSmsQueue','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','socket.io-emitter','redis','./smsQueue.socket','register','request','then','SmsQueue,\x20%s,\x20%s','request\x20sent','SmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','GetSmsQueue','SmsQueue','options','raw','limit','include','map'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x7cd0,0x13e));var _0x07cd=function(_0x4057cb,_0x518388){_0x4057cb=_0x4057cb-0x0;var _0x5ef8be=_0x7cd0[_0x4057cb];return _0x5ef8be;};'use strict';var _=require(_0x07cd('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x07cd('0x1'));var rs=require(_0x07cd('0x2'));var fs=require('fs');var Redis=require(_0x07cd('0x3'));var db=require(_0x07cd('0x4'))['db'];var utils=require(_0x07cd('0x5'));var logger=require(_0x07cd('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x07cd('0x7'));var client=jayson[_0x07cd('0x8')][_0x07cd('0x9')]({'port':0x232a});config['redis']=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x07cd('0xa'))(new Redis(config[_0x07cd('0xb')]));require(_0x07cd('0xc'))[_0x07cd('0xd')](socket);function respondWithRpcPromise(_0x417176,_0x120181,_0x10c435){return new BPromise(function(_0x3d26b3,_0x2b2380){return client[_0x07cd('0xe')](_0x417176,_0x10c435)[_0x07cd('0xf')](function(_0x7d122b){logger['info'](_0x07cd('0x10'),_0x120181,_0x07cd('0x11'));logger['debug'](_0x07cd('0x12'),_0x120181,'request\x20sent',JSON[_0x07cd('0x13')](_0x7d122b));if(_0x7d122b[_0x07cd('0x14')]){if(_0x7d122b[_0x07cd('0x14')][_0x07cd('0x15')]===0x1f4){logger[_0x07cd('0x14')]('SmsQueue,\x20%s,\x20%s',_0x120181,_0x7d122b[_0x07cd('0x14')]['message']);return _0x2b2380(_0x7d122b[_0x07cd('0x14')]['message']);}logger['error'](_0x07cd('0x10'),_0x120181,_0x7d122b[_0x07cd('0x14')][_0x07cd('0x16')]);return _0x3d26b3(_0x7d122b[_0x07cd('0x14')][_0x07cd('0x16')]);}else{logger[_0x07cd('0x17')]('SmsQueue,\x20%s,\x20%s',_0x120181,_0x07cd('0x11'));_0x3d26b3(_0x7d122b[_0x07cd('0x18')][_0x07cd('0x16')]);}})[_0x07cd('0x19')](function(_0x11a8bc){logger[_0x07cd('0x14')](_0x07cd('0x10'),_0x120181,_0x11a8bc);_0x2b2380(_0x11a8bc);});});}exports[_0x07cd('0x1a')]=function(_0x4d2429){var _0x6bc400=this;return new Promise(function(_0x171cf4,_0xe1efe4){return db[_0x07cd('0x1b')]['findAll']({'raw':_0x4d2429[_0x07cd('0x1c')]?_0x4d2429[_0x07cd('0x1c')][_0x07cd('0x1d')]===undefined?!![]:![]:!![],'where':_0x4d2429[_0x07cd('0x1c')]?_0x4d2429[_0x07cd('0x1c')]['where']||null:null,'attributes':_0x4d2429['options']?_0x4d2429[_0x07cd('0x1c')]['attributes']||null:null,'limit':_0x4d2429[_0x07cd('0x1c')]?_0x4d2429[_0x07cd('0x1c')][_0x07cd('0x1e')]||null:null,'include':_0x4d2429[_0x07cd('0x1c')]?_0x4d2429[_0x07cd('0x1c')][_0x07cd('0x1f')]?_[_0x07cd('0x20')](_0x4d2429[_0x07cd('0x1c')][_0x07cd('0x1f')],function(_0x135be5){return{'model':db[_0x135be5['model']],'as':_0x135be5['as'],'attributes':_0x135be5['attributes'],'include':_0x135be5[_0x07cd('0x1f')]?_[_0x07cd('0x20')](_0x135be5[_0x07cd('0x1f')],function(_0x9e43e1){return{'model':db[_0x9e43e1[_0x07cd('0x21')]],'as':_0x9e43e1['as'],'attributes':_0x9e43e1['attributes'],'include':_0x9e43e1[_0x07cd('0x1f')]?_[_0x07cd('0x20')](_0x9e43e1[_0x07cd('0x1f')],function(_0x115a42){return{'model':db[_0x115a42['model']],'as':_0x115a42['as'],'attributes':_0x115a42[_0x07cd('0x22')]};}):[]};}):[]};}):[]:[]})[_0x07cd('0xf')](function(_0xd81678){logger[_0x07cd('0x17')](_0x07cd('0x1a'),_0x4d2429);logger[_0x07cd('0x23')](_0x07cd('0x1a'),_0x4d2429,JSON['stringify'](_0xd81678));_0x171cf4(_0xd81678);})[_0x07cd('0x19')](function(_0x211585){logger[_0x07cd('0x14')]('GetSmsQueue',_0x211585[_0x07cd('0x16')],_0x4d2429);_0xe1efe4(_0x6bc400[_0x07cd('0x14')](0x1f4,_0x211585[_0x07cd('0x16')]));});});};exports['ShowSmsQueue']=function(_0x37627c){var _0x360329=this;return new Promise(function(_0x3269df,_0x38908a){return db[_0x07cd('0x1b')][_0x07cd('0x24')]({'raw':_0x37627c['options']?_0x37627c[_0x07cd('0x1c')][_0x07cd('0x1d')]===undefined?!![]:![]:!![],'where':_0x37627c[_0x07cd('0x1c')]?_0x37627c[_0x07cd('0x1c')][_0x07cd('0x25')]||null:null,'attributes':_0x37627c[_0x07cd('0x1c')]?_0x37627c[_0x07cd('0x1c')][_0x07cd('0x22')]||null:null,'include':_0x37627c[_0x07cd('0x1c')]?_0x37627c[_0x07cd('0x1c')][_0x07cd('0x1f')]?_['map'](_0x37627c[_0x07cd('0x1c')][_0x07cd('0x1f')],function(_0x3a3ac2){return{'model':db[_0x3a3ac2[_0x07cd('0x21')]],'as':_0x3a3ac2['as'],'attributes':_0x3a3ac2['attributes'],'include':_0x3a3ac2[_0x07cd('0x1f')]?_[_0x07cd('0x20')](_0x3a3ac2[_0x07cd('0x1f')],function(_0x15bd20){return{'model':db[_0x15bd20[_0x07cd('0x21')]],'as':_0x15bd20['as'],'attributes':_0x15bd20[_0x07cd('0x22')],'include':_0x15bd20[_0x07cd('0x1f')]?_[_0x07cd('0x20')](_0x15bd20[_0x07cd('0x1f')],function(_0x332c5e){return{'model':db[_0x332c5e[_0x07cd('0x21')]],'as':_0x332c5e['as'],'attributes':_0x332c5e[_0x07cd('0x22')]};}):[]};}):[]};}):[]:[]})[_0x07cd('0xf')](function(_0x3d87ce){logger['info'](_0x07cd('0x26'),_0x37627c);logger[_0x07cd('0x23')](_0x07cd('0x26'),_0x37627c,JSON[_0x07cd('0x13')](_0x3d87ce));_0x3269df(_0x3d87ce);})[_0x07cd('0x19')](function(_0x56a942){logger['error']('ShowSmsQueue',_0x56a942[_0x07cd('0x16')],_0x37627c);_0x38908a(_0x360329[_0x07cd('0x14')](0x1f4,_0x56a942['message']));});});}; \ No newline at end of file +var _0x142e=['rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','register','then','info','request\x20sent','debug','SmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','SmsQueue,\x20%s,\x20%s','message','result','catch','GetSmsQueue','SmsQueue','findAll','options','raw','attributes','limit','map','include','model','ShowSmsQueue','find','where','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x5111e7,_0x2789a3){var _0x47e315=function(_0x154d36){while(--_0x154d36){_0x5111e7['push'](_0x5111e7['shift']());}};_0x47e315(++_0x2789a3);}(_0x142e,0x1e4));var _0xe142=function(_0x3ea5cd,_0x407716){_0x3ea5cd=_0x3ea5cd-0x0;var _0x384157=_0x142e[_0x3ea5cd];return _0x384157;};'use strict';var _=require(_0xe142('0x0'));var util=require(_0xe142('0x1'));var moment=require(_0xe142('0x2'));var BPromise=require(_0xe142('0x3'));var rs=require(_0xe142('0x4'));var fs=require('fs');var Redis=require(_0xe142('0x5'));var db=require(_0xe142('0x6'))['db'];var utils=require(_0xe142('0x7'));var logger=require('../../config/logger')(_0xe142('0x8'));var config=require(_0xe142('0x9'));var jayson=require(_0xe142('0xa'));var client=jayson[_0xe142('0xb')]['http']({'port':0x232a});config[_0xe142('0xc')]=_[_0xe142('0xd')](config[_0xe142('0xc')],{'host':_0xe142('0xe'),'port':0x18eb});var socket=require(_0xe142('0xf'))(new Redis(config['redis']));require('./smsQueue.socket')[_0xe142('0x10')](socket);function respondWithRpcPromise(_0x3fcd93,_0x35f5db,_0x5a5977){return new BPromise(function(_0x320156,_0x199dfc){return client['request'](_0x3fcd93,_0x5a5977)[_0xe142('0x11')](function(_0x40a952){logger[_0xe142('0x12')]('SmsQueue,\x20%s,\x20%s',_0x35f5db,_0xe142('0x13'));logger[_0xe142('0x14')](_0xe142('0x15'),_0x35f5db,_0xe142('0x13'),JSON[_0xe142('0x16')](_0x40a952));if(_0x40a952[_0xe142('0x17')]){if(_0x40a952['error']['code']===0x1f4){logger['error'](_0xe142('0x18'),_0x35f5db,_0x40a952['error'][_0xe142('0x19')]);return _0x199dfc(_0x40a952[_0xe142('0x17')][_0xe142('0x19')]);}logger[_0xe142('0x17')](_0xe142('0x18'),_0x35f5db,_0x40a952[_0xe142('0x17')][_0xe142('0x19')]);return _0x320156(_0x40a952[_0xe142('0x17')]['message']);}else{logger[_0xe142('0x12')]('SmsQueue,\x20%s,\x20%s',_0x35f5db,_0xe142('0x13'));_0x320156(_0x40a952[_0xe142('0x1a')]['message']);}})[_0xe142('0x1b')](function(_0xd4cc01){logger['error'](_0xe142('0x18'),_0x35f5db,_0xd4cc01);_0x199dfc(_0xd4cc01);});});}exports[_0xe142('0x1c')]=function(_0x248ae9){var _0x5d60fe=this;return new Promise(function(_0x58638b,_0x313068){return db[_0xe142('0x1d')][_0xe142('0x1e')]({'raw':_0x248ae9[_0xe142('0x1f')]?_0x248ae9[_0xe142('0x1f')][_0xe142('0x20')]===undefined?!![]:![]:!![],'where':_0x248ae9['options']?_0x248ae9[_0xe142('0x1f')]['where']||null:null,'attributes':_0x248ae9['options']?_0x248ae9[_0xe142('0x1f')][_0xe142('0x21')]||null:null,'limit':_0x248ae9['options']?_0x248ae9[_0xe142('0x1f')][_0xe142('0x22')]||null:null,'include':_0x248ae9[_0xe142('0x1f')]?_0x248ae9[_0xe142('0x1f')]['include']?_[_0xe142('0x23')](_0x248ae9[_0xe142('0x1f')][_0xe142('0x24')],function(_0x2793db){return{'model':db[_0x2793db['model']],'as':_0x2793db['as'],'attributes':_0x2793db[_0xe142('0x21')],'include':_0x2793db[_0xe142('0x24')]?_['map'](_0x2793db[_0xe142('0x24')],function(_0x553809){return{'model':db[_0x553809[_0xe142('0x25')]],'as':_0x553809['as'],'attributes':_0x553809[_0xe142('0x21')],'include':_0x553809[_0xe142('0x24')]?_['map'](_0x553809['include'],function(_0x18c353){return{'model':db[_0x18c353['model']],'as':_0x18c353['as'],'attributes':_0x18c353[_0xe142('0x21')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x40421d){logger[_0xe142('0x12')](_0xe142('0x1c'),_0x248ae9);logger['debug']('GetSmsQueue',_0x248ae9,JSON[_0xe142('0x16')](_0x40421d));_0x58638b(_0x40421d);})[_0xe142('0x1b')](function(_0x43bb14){logger['error'](_0xe142('0x1c'),_0x43bb14[_0xe142('0x19')],_0x248ae9);_0x313068(_0x5d60fe['error'](0x1f4,_0x43bb14[_0xe142('0x19')]));});});};exports[_0xe142('0x26')]=function(_0xb749bb){var _0x2a9385=this;return new Promise(function(_0x2b14ad,_0x49f5d8){return db[_0xe142('0x1d')][_0xe142('0x27')]({'raw':_0xb749bb[_0xe142('0x1f')]?_0xb749bb['options'][_0xe142('0x20')]===undefined?!![]:![]:!![],'where':_0xb749bb[_0xe142('0x1f')]?_0xb749bb[_0xe142('0x1f')][_0xe142('0x28')]||null:null,'attributes':_0xb749bb['options']?_0xb749bb[_0xe142('0x1f')]['attributes']||null:null,'include':_0xb749bb[_0xe142('0x1f')]?_0xb749bb[_0xe142('0x1f')]['include']?_['map'](_0xb749bb[_0xe142('0x1f')][_0xe142('0x24')],function(_0xa7d80e){return{'model':db[_0xa7d80e['model']],'as':_0xa7d80e['as'],'attributes':_0xa7d80e['attributes'],'include':_0xa7d80e[_0xe142('0x24')]?_[_0xe142('0x23')](_0xa7d80e[_0xe142('0x24')],function(_0x24e4e5){return{'model':db[_0x24e4e5[_0xe142('0x25')]],'as':_0x24e4e5['as'],'attributes':_0x24e4e5[_0xe142('0x21')],'include':_0x24e4e5['include']?_[_0xe142('0x23')](_0x24e4e5[_0xe142('0x24')],function(_0x20a49c){return{'model':db[_0x20a49c[_0xe142('0x25')]],'as':_0x20a49c['as'],'attributes':_0x20a49c[_0xe142('0x21')]};}):[]};}):[]};}):[]:[]})[_0xe142('0x11')](function(_0x4b7dfb){logger[_0xe142('0x12')](_0xe142('0x26'),_0xb749bb);logger[_0xe142('0x14')](_0xe142('0x26'),_0xb749bb,JSON[_0xe142('0x16')](_0x4b7dfb));_0x2b14ad(_0x4b7dfb);})[_0xe142('0x1b')](function(_0x2d4028){logger[_0xe142('0x17')](_0xe142('0x26'),_0x2d4028[_0xe142('0x19')],_0xb749bb);_0x49f5d8(_0x2a9385[_0xe142('0x17')](0x1f4,_0x2d4028[_0xe142('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.socket.js b/server/api/smsQueue/smsQueue.socket.js index 09a810a..7376785 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 _0x4db9=['length','./smsQueue.events','save','remove','update','removeListener'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x4db9,0xe5));var _0x94db=function(_0x384231,_0x50be41){_0x384231=_0x384231-0x0;var _0x2480bf=_0x4db9[_0x384231];return _0x2480bf;};'use strict';var SmsQueueEvents=require(_0x94db('0x0'));var events=[_0x94db('0x1'),_0x94db('0x2'),_0x94db('0x3')];function createListener(_0x574645,_0x258485){return function(_0x20f969){_0x258485['emit'](_0x574645,_0x20f969);};}function removeListener(_0x223fb6,_0x5d26d7){return function(){SmsQueueEvents[_0x94db('0x4')](_0x223fb6,_0x5d26d7);};}exports['register']=function(_0x26ca23){for(var _0x3c5912=0x0,_0x5612dd=events[_0x94db('0x5')];_0x3c5912<_0x5612dd;_0x3c5912++){var _0x542a5d=events[_0x3c5912];var _0x19dc6b=createListener('smsQueue:'+_0x542a5d,_0x26ca23);SmsQueueEvents['on'](_0x542a5d,_0x19dc6b);}}; \ No newline at end of file +var _0xf42e=['smsQueue:','./smsQueue.events','save','remove','update','emit','removeListener'];(function(_0x323d3a,_0x400d82){var _0x22cddb=function(_0x191de8){while(--_0x191de8){_0x323d3a['push'](_0x323d3a['shift']());}};_0x22cddb(++_0x400d82);}(_0xf42e,0x1b3));var _0xef42=function(_0x52f85f,_0x46c1c4){_0x52f85f=_0x52f85f-0x0;var _0x5dffa2=_0xf42e[_0x52f85f];return _0x5dffa2;};'use strict';var SmsQueueEvents=require(_0xef42('0x0'));var events=[_0xef42('0x1'),_0xef42('0x2'),_0xef42('0x3')];function createListener(_0x5500b8,_0x52e76b){return function(_0x519fb8){_0x52e76b[_0xef42('0x4')](_0x5500b8,_0x519fb8);};}function removeListener(_0x58e010,_0x8600dd){return function(){SmsQueueEvents[_0xef42('0x5')](_0x58e010,_0x8600dd);};}exports['register']=function(_0x2a88c0){for(var _0x3e03dd=0x0,_0x60219d=events['length'];_0x3e03dd<_0x60219d;_0x3e03dd++){var _0x5d3817=events[_0x3e03dd];var _0x327ad9=createListener(_0xef42('0x6')+_0x5d3817,_0x2a88c0);SmsQueueEvents['on'](_0x5d3817,_0x327ad9);}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/index.js b/server/api/smsQueueReport/index.js index 3627e08..14dc549 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 _0xdb70=['multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsQueueReport.controller','get','isAuthenticated','index','describe','/:id','show','create','update','delete','exports'];(function(_0x15402d,_0x4c9826){var _0x1d9d74=function(_0x38d88d){while(--_0x38d88d){_0x15402d['push'](_0x15402d['shift']());}};_0x1d9d74(++_0x4c9826);}(_0xdb70,0xa0));var _0x0db7=function(_0x50c2b0,_0x1a0f45){_0x50c2b0=_0x50c2b0-0x0;var _0x4151a0=_0xdb70[_0x50c2b0];return _0x4151a0;};'use strict';var multer=require(_0x0db7('0x0'));var util=require(_0x0db7('0x1'));var path=require(_0x0db7('0x2'));var timeout=require('connect-timeout');var express=require(_0x0db7('0x3'));var router=express[_0x0db7('0x4')]();var fs_extra=require(_0x0db7('0x5'));var auth=require(_0x0db7('0x6'));var interaction=require(_0x0db7('0x7'));var config=require(_0x0db7('0x8'));var controller=require(_0x0db7('0x9'));router[_0x0db7('0xa')]('/',auth[_0x0db7('0xb')](),controller[_0x0db7('0xc')]);router[_0x0db7('0xa')]('/describe',auth[_0x0db7('0xb')](),controller[_0x0db7('0xd')]);router[_0x0db7('0xa')](_0x0db7('0xe'),auth[_0x0db7('0xb')](),controller[_0x0db7('0xf')]);router['post']('/',auth[_0x0db7('0xb')](),controller[_0x0db7('0x10')]);router['put'](_0x0db7('0xe'),auth[_0x0db7('0xb')](),controller[_0x0db7('0x11')]);router[_0x0db7('0x12')]('/:id',auth[_0x0db7('0xb')](),controller['destroy']);module[_0x0db7('0x13')]=router; \ No newline at end of file +var _0x303f=['multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','./smsQueueReport.controller','get','isAuthenticated','index','/describe','describe','show','create','put','update','delete','destroy','exports'];(function(_0x507337,_0x12992f){var _0x5345c9=function(_0x2df27c){while(--_0x2df27c){_0x507337['push'](_0x507337['shift']());}};_0x5345c9(++_0x12992f);}(_0x303f,0xbe));var _0xf303=function(_0x4c224a,_0x34bb){_0x4c224a=_0x4c224a-0x0;var _0x4cf8d7=_0x303f[_0x4c224a];return _0x4cf8d7;};'use strict';var multer=require(_0xf303('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xf303('0x1'));var express=require(_0xf303('0x2'));var router=express[_0xf303('0x3')]();var fs_extra=require(_0xf303('0x4'));var auth=require(_0xf303('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xf303('0x6'));router[_0xf303('0x7')]('/',auth[_0xf303('0x8')](),controller[_0xf303('0x9')]);router[_0xf303('0x7')](_0xf303('0xa'),auth['isAuthenticated'](),controller[_0xf303('0xb')]);router['get']('/:id',auth[_0xf303('0x8')](),controller[_0xf303('0xc')]);router['post']('/',auth[_0xf303('0x8')](),controller[_0xf303('0xd')]);router[_0xf303('0xe')]('/:id',auth[_0xf303('0x8')](),controller[_0xf303('0xf')]);router[_0xf303('0x10')]('/:id',auth[_0xf303('0x8')](),controller[_0xf303('0x11')]);module[_0xf303('0x12')]=router; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.attributes.js b/server/api/smsQueueReport/smsQueueReport.attributes.js index 5806396..4035c5d 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 _0xb6ac=['STRING','DATE','sequelize','exports'];(function(_0x1aba25,_0x1faed1){var _0x47d997=function(_0x4f9e11){while(--_0x4f9e11){_0x1aba25['push'](_0x1aba25['shift']());}};_0x47d997(++_0x1faed1);}(_0xb6ac,0x86));var _0xcb6a=function(_0x1c2edf,_0x1bb7a4){_0x1c2edf=_0x1c2edf-0x0;var _0x14cd06=_0xb6ac[_0x1c2edf];return _0x14cd06;};'use strict';var moment=require('moment');var Sequelize=require(_0xcb6a('0x0'));module[_0xcb6a('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0xcb6a('0x2')]},'joinAt':{'type':Sequelize[_0xcb6a('0x3')]},'leaveAt':{'type':Sequelize[_0xcb6a('0x3')]},'acceptAt':{'type':Sequelize[_0xcb6a('0x3')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0xcb6a('0x2')]}}; \ No newline at end of file +var _0xbf2d=['STRING','DATE','moment','exports'];(function(_0x3cf5a3,_0x5a4492){var _0x39ba2d=function(_0x3ed989){while(--_0x3ed989){_0x3cf5a3['push'](_0x3cf5a3['shift']());}};_0x39ba2d(++_0x5a4492);}(_0xbf2d,0xb6));var _0xdbf2=function(_0x3a5b8c,_0x55cc2e){_0x3a5b8c=_0x3a5b8c-0x0;var _0x4300ae=_0xbf2d[_0x3a5b8c];return _0x4300ae;};'use strict';var moment=require(_0xdbf2('0x0'));var Sequelize=require('sequelize');module[_0xdbf2('0x1')]={'uniqueid':{'type':Sequelize[_0xdbf2('0x2')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0xdbf2('0x3')]},'leaveAt':{'type':Sequelize[_0xdbf2('0x3')]},'acceptAt':{'type':Sequelize[_0xdbf2('0x3')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0xdbf2('0x2')]}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.controller.js b/server/api/smsQueueReport/smsQueueReport.controller.js index df297e6..78d26bf 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 _0xec22=['destroy','end','sendStatus','name','index','map','SmsQueueReport','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','catch','params','rawAttributes','length','includeAll','create','body','find','describe','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','sox','ejs','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../config/license/util','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then'];(function(_0x96584a,_0x1bbecf){var _0x220292=function(_0x1683c5){while(--_0x1683c5){_0x96584a['push'](_0x96584a['shift']());}};_0x220292(++_0x1bbecf);}(_0xec22,0x6b));var _0x2ec2=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0xec22[_0x4565bf];return _0x5610ba;};'use strict';var emlformat=require(_0x2ec2('0x0'));var rimraf=require(_0x2ec2('0x1'));var zipdir=require(_0x2ec2('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x2ec2('0x3'));var BPromise=require(_0x2ec2('0x4'));var Mustache=require(_0x2ec2('0x5'));var util=require(_0x2ec2('0x6'));var path=require('path');var sox=require(_0x2ec2('0x7'));var csv=require('to-csv');var ejs=require(_0x2ec2('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x2ec2('0x9'));var crypto=require('crypto');var jsforce=require(_0x2ec2('0xa'));var deskjs=require(_0x2ec2('0xb'));var toCsv=require('to-csv');var querystring=require(_0x2ec2('0xc'));var Papa=require('papaparse');var Redis=require(_0x2ec2('0xd'));var authService=require(_0x2ec2('0xe'));var qs=require(_0x2ec2('0xf'));var as=require(_0x2ec2('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x2ec2('0x11'));var config=require(_0x2ec2('0x12'));var licenseUtil=require(_0x2ec2('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x27048f,_0x20eb12){_0x20eb12=_0x20eb12||0xcc;return function(_0x3104db){if(_0x3104db){return _0x27048f['sendStatus'](_0x20eb12);}return _0x27048f[_0x2ec2('0x14')](_0x20eb12)['end']();};}function respondWithResult(_0x24e344,_0x4c6d95){_0x4c6d95=_0x4c6d95||0xc8;return function(_0x4f0126){if(_0x4f0126){return _0x24e344['status'](_0x4c6d95)[_0x2ec2('0x15')](_0x4f0126);}};}function respondWithFilteredResult(_0x59c9cb,_0x21c735){return function(_0x300fa3){if(_0x300fa3){var _0x5dd740=typeof _0x21c735[_0x2ec2('0x16')]==='undefined'&&typeof _0x21c735[_0x2ec2('0x17')]===_0x2ec2('0x18');var _0xb43302=_0x300fa3[_0x2ec2('0x19')];var _0x25be36=_0x5dd740?0x0:_0x21c735['offset'];var _0x163b8a=_0x5dd740?_0x300fa3[_0x2ec2('0x19')]:_0x21c735[_0x2ec2('0x16')]+_0x21c735[_0x2ec2('0x17')];var _0x385ca0;if(_0x163b8a>=_0xb43302){_0x163b8a=_0xb43302;_0x385ca0=0xc8;}else{_0x385ca0=0xce;}_0x59c9cb[_0x2ec2('0x14')](_0x385ca0);return _0x59c9cb[_0x2ec2('0x1a')](_0x2ec2('0x1b'),_0x25be36+'-'+_0x163b8a+'/'+_0xb43302)[_0x2ec2('0x15')](_0x300fa3);}return null;};}function patchUpdates(_0x1514cc){return function(_0x2b54d7){try{jsonpatch[_0x2ec2('0x1c')](_0x2b54d7,_0x1514cc,!![]);}catch(_0x12c4ad){return BPromise[_0x2ec2('0x1d')](_0x12c4ad);}return _0x2b54d7[_0x2ec2('0x1e')]();};}function saveUpdates(_0x4792b2,_0x536ee9){return function(_0x401985){if(_0x401985){return _0x401985[_0x2ec2('0x1f')](_0x4792b2)[_0x2ec2('0x20')](function(_0x33bdc9){return _0x33bdc9;});}return null;};}function removeEntity(_0x2b5777,_0x2d9205){return function(_0x37d058){if(_0x37d058){return _0x37d058[_0x2ec2('0x21')]()[_0x2ec2('0x20')](function(){_0x2b5777[_0x2ec2('0x14')](0xcc)[_0x2ec2('0x22')]();});}};}function handleEntityNotFound(_0x417453,_0x2ab9cc){return function(_0x497103){if(!_0x497103){_0x417453[_0x2ec2('0x23')](0x194);}return _0x497103;};}function handleError(_0x3d0e7f,_0x35cb90){_0x35cb90=_0x35cb90||0x1f4;return function(_0x3e0dd5){logger['error'](_0x3e0dd5['stack']);if(_0x3e0dd5['name']){delete _0x3e0dd5[_0x2ec2('0x24')];}_0x3d0e7f[_0x2ec2('0x14')](_0x35cb90)['send'](_0x3e0dd5);};}exports[_0x2ec2('0x25')]=function(_0x5bf553,_0xa06fa5){var _0x44ca4e={},_0x3edbb9={},_0x156709={'count':0x0,'rows':[]};var _0x59884e=_[_0x2ec2('0x26')](db[_0x2ec2('0x27')]['rawAttributes'],function(_0x237e74){return{'name':_0x237e74[_0x2ec2('0x28')],'type':_0x237e74[_0x2ec2('0x29')][_0x2ec2('0x2a')]};});_0x3edbb9[_0x2ec2('0x2b')]=_[_0x2ec2('0x26')](_0x59884e,_0x2ec2('0x24'));_0x3edbb9[_0x2ec2('0x2c')]=_[_0x2ec2('0x2d')](_0x5bf553[_0x2ec2('0x2c')]);_0x3edbb9[_0x2ec2('0x2e')]=_[_0x2ec2('0x2f')](_0x3edbb9[_0x2ec2('0x2b')],_0x3edbb9[_0x2ec2('0x2c')]);_0x44ca4e['attributes']=_[_0x2ec2('0x2f')](_0x3edbb9['model'],qs[_0x2ec2('0x30')](_0x5bf553[_0x2ec2('0x2c')][_0x2ec2('0x30')]));_0x44ca4e[_0x2ec2('0x31')]=_0x44ca4e[_0x2ec2('0x31')]['length']?_0x44ca4e[_0x2ec2('0x31')]:_0x3edbb9[_0x2ec2('0x2b')];if(!_0x5bf553[_0x2ec2('0x2c')][_0x2ec2('0x32')]('nolimit')){_0x44ca4e[_0x2ec2('0x17')]=qs[_0x2ec2('0x17')](_0x5bf553[_0x2ec2('0x2c')][_0x2ec2('0x17')]);_0x44ca4e['offset']=qs[_0x2ec2('0x16')](_0x5bf553[_0x2ec2('0x2c')][_0x2ec2('0x16')]);}_0x44ca4e['order']=qs[_0x2ec2('0x33')](_0x5bf553['query']['sort']);_0x44ca4e[_0x2ec2('0x34')]=qs['filters'](_[_0x2ec2('0x35')](_0x5bf553['query'],_0x3edbb9[_0x2ec2('0x2e')]),_0x59884e);if(_0x5bf553['query'][_0x2ec2('0x36')]){_0x44ca4e[_0x2ec2('0x34')]=_[_0x2ec2('0x37')](_0x44ca4e['where'],{'$or':_[_0x2ec2('0x26')](_0x59884e,function(_0x2e54bb){if(_0x2e54bb[_0x2ec2('0x29')]!==_0x2ec2('0x38')){var _0x22a267={};_0x22a267[_0x2e54bb[_0x2ec2('0x24')]]={'$like':'%'+_0x5bf553[_0x2ec2('0x2c')]['filter']+'%'};return _0x22a267;}})});}_0x44ca4e=_[_0x2ec2('0x37')]({},_0x44ca4e,_0x5bf553[_0x2ec2('0x39')]);var _0x41aa6f={'where':_0x44ca4e[_0x2ec2('0x34')]};return db['SmsQueueReport'][_0x2ec2('0x19')](_0x41aa6f)['then'](function(_0x5bbe81){_0x156709['count']=_0x5bbe81;if(_0x5bf553[_0x2ec2('0x2c')]['includeAll']){_0x44ca4e[_0x2ec2('0x3a')]=[{'all':!![]}];}return db[_0x2ec2('0x27')][_0x2ec2('0x3b')](_0x44ca4e);})['then'](function(_0x4637ba){_0x156709[_0x2ec2('0x3c')]=_0x4637ba;return _0x156709;})[_0x2ec2('0x20')](respondWithFilteredResult(_0xa06fa5,_0x44ca4e))[_0x2ec2('0x3d')](handleError(_0xa06fa5,null));};exports['show']=function(_0x4dc37f,_0xd3ce1f){var _0x5d269f={'raw':!![],'where':{'id':_0x4dc37f[_0x2ec2('0x3e')]['id']}},_0x818607={};_0x818607['model']=_[_0x2ec2('0x2d')](db[_0x2ec2('0x27')][_0x2ec2('0x3f')]);_0x818607[_0x2ec2('0x2c')]=_[_0x2ec2('0x2d')](_0x4dc37f[_0x2ec2('0x2c')]);_0x818607[_0x2ec2('0x2e')]=_[_0x2ec2('0x2f')](_0x818607['model'],_0x818607['query']);_0x5d269f[_0x2ec2('0x31')]=_[_0x2ec2('0x2f')](_0x818607[_0x2ec2('0x2b')],qs['fields'](_0x4dc37f['query'][_0x2ec2('0x30')]));_0x5d269f[_0x2ec2('0x31')]=_0x5d269f[_0x2ec2('0x31')][_0x2ec2('0x40')]?_0x5d269f[_0x2ec2('0x31')]:_0x818607[_0x2ec2('0x2b')];if(_0x4dc37f[_0x2ec2('0x2c')][_0x2ec2('0x41')]){_0x5d269f[_0x2ec2('0x3a')]=[{'all':!![]}];}_0x5d269f=_[_0x2ec2('0x37')]({},_0x5d269f,_0x4dc37f[_0x2ec2('0x39')]);return db[_0x2ec2('0x27')]['find'](_0x5d269f)[_0x2ec2('0x20')](handleEntityNotFound(_0xd3ce1f,null))[_0x2ec2('0x20')](respondWithResult(_0xd3ce1f,null))[_0x2ec2('0x3d')](handleError(_0xd3ce1f,null));};exports[_0x2ec2('0x42')]=function(_0xdf8a9e,_0x52143f){return db['SmsQueueReport']['create'](_0xdf8a9e[_0x2ec2('0x43')],{})[_0x2ec2('0x20')](respondWithResult(_0x52143f,0xc9))['catch'](handleError(_0x52143f,null));};exports[_0x2ec2('0x1f')]=function(_0x23e749,_0x3b2d69){if(_0x23e749[_0x2ec2('0x43')]['id']){delete _0x23e749[_0x2ec2('0x43')]['id'];}return db['SmsQueueReport']['find']({'where':{'id':_0x23e749[_0x2ec2('0x3e')]['id']}})['then'](handleEntityNotFound(_0x3b2d69,null))['then'](saveUpdates(_0x23e749['body'],null))[_0x2ec2('0x20')](respondWithResult(_0x3b2d69,null))[_0x2ec2('0x3d')](handleError(_0x3b2d69,null));};exports[_0x2ec2('0x21')]=function(_0x1bce14,_0x3ad0df){return db[_0x2ec2('0x27')][_0x2ec2('0x44')]({'where':{'id':_0x1bce14[_0x2ec2('0x3e')]['id']}})[_0x2ec2('0x20')](handleEntityNotFound(_0x3ad0df,null))[_0x2ec2('0x20')](removeEntity(_0x3ad0df,null))[_0x2ec2('0x3d')](handleError(_0x3ad0df,null));};exports[_0x2ec2('0x45')]=function(_0x2551a5,_0x2663c3){return db[_0x2ec2('0x27')][_0x2ec2('0x45')]()[_0x2ec2('0x20')](respondWithResult(_0x2663c3,null))['catch'](handleError(_0x2663c3,null));}; \ No newline at end of file +var _0xd4c7=['eml-format','rimraf','fast-json-patch','bluebird','mustache','util','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','offset','limit','undefined','count','Content-Range','json','apply','reject','save','update','destroy','then','error','name','index','SmsQueueReport','rawAttributes','type','key','map','keys','query','intersection','model','attributes','fields','length','nolimit','sort','where','filters','pick','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','describe'];(function(_0x15942a,_0x13b58c){var _0x36a9fb=function(_0x549c27){while(--_0x549c27){_0x15942a['push'](_0x15942a['shift']());}};_0x36a9fb(++_0x13b58c);}(_0xd4c7,0x90));var _0x7d4c=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0xd4c7[_0x2b4411];return _0x8e41ef;};'use strict';var emlformat=require(_0x7d4c('0x0'));var rimraf=require(_0x7d4c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7d4c('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x7d4c('0x3'));var Mustache=require(_0x7d4c('0x4'));var util=require(_0x7d4c('0x5'));var path=require('path');var sox=require(_0x7d4c('0x6'));var csv=require('to-csv');var ejs=require(_0x7d4c('0x7'));var fs=require('fs');var fs_extra=require(_0x7d4c('0x8'));var _=require(_0x7d4c('0x9'));var squel=require('squel');var crypto=require(_0x7d4c('0xa'));var jsforce=require(_0x7d4c('0xb'));var deskjs=require(_0x7d4c('0xc'));var toCsv=require(_0x7d4c('0xd'));var querystring=require(_0x7d4c('0xe'));var Papa=require(_0x7d4c('0xf'));var Redis=require(_0x7d4c('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x7d4c('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7d4c('0x12'));var logger=require('../../config/logger')(_0x7d4c('0x13'));var utils=require(_0x7d4c('0x14'));var config=require(_0x7d4c('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x7d4c('0x16'))['db'];function respondWithStatusCode(_0x61d24e,_0x1cb14b){_0x1cb14b=_0x1cb14b||0xcc;return function(_0x4f247b){if(_0x4f247b){return _0x61d24e[_0x7d4c('0x17')](_0x1cb14b);}return _0x61d24e[_0x7d4c('0x18')](_0x1cb14b)[_0x7d4c('0x19')]();};}function respondWithResult(_0x4f4952,_0x197a63){_0x197a63=_0x197a63||0xc8;return function(_0x218b13){if(_0x218b13){return _0x4f4952[_0x7d4c('0x18')](_0x197a63)['json'](_0x218b13);}};}function respondWithFilteredResult(_0x81c2c8,_0x5ebf10){return function(_0x105ecf){if(_0x105ecf){var _0x2f10b4=typeof _0x5ebf10[_0x7d4c('0x1a')]==='undefined'&&typeof _0x5ebf10[_0x7d4c('0x1b')]===_0x7d4c('0x1c');var _0x1982cb=_0x105ecf[_0x7d4c('0x1d')];var _0xeee93b=_0x2f10b4?0x0:_0x5ebf10[_0x7d4c('0x1a')];var _0x1ef5e7=_0x2f10b4?_0x105ecf[_0x7d4c('0x1d')]:_0x5ebf10['offset']+_0x5ebf10[_0x7d4c('0x1b')];var _0x35057e;if(_0x1ef5e7>=_0x1982cb){_0x1ef5e7=_0x1982cb;_0x35057e=0xc8;}else{_0x35057e=0xce;}_0x81c2c8['status'](_0x35057e);return _0x81c2c8['set'](_0x7d4c('0x1e'),_0xeee93b+'-'+_0x1ef5e7+'/'+_0x1982cb)[_0x7d4c('0x1f')](_0x105ecf);}return null;};}function patchUpdates(_0x240157){return function(_0x443bf7){try{jsonpatch[_0x7d4c('0x20')](_0x443bf7,_0x240157,!![]);}catch(_0x44f8cb){return BPromise[_0x7d4c('0x21')](_0x44f8cb);}return _0x443bf7[_0x7d4c('0x22')]();};}function saveUpdates(_0x282638,_0x2fd45e){return function(_0x320745){if(_0x320745){return _0x320745[_0x7d4c('0x23')](_0x282638)['then'](function(_0x1e97c0){return _0x1e97c0;});}return null;};}function removeEntity(_0x5af4ce,_0x1ab620){return function(_0x2096c4){if(_0x2096c4){return _0x2096c4[_0x7d4c('0x24')]()[_0x7d4c('0x25')](function(){_0x5af4ce[_0x7d4c('0x18')](0xcc)[_0x7d4c('0x19')]();});}};}function handleEntityNotFound(_0x98cccb,_0x1b12b1){return function(_0x3f9ce8){if(!_0x3f9ce8){_0x98cccb[_0x7d4c('0x17')](0x194);}return _0x3f9ce8;};}function handleError(_0x49bf3b,_0x1fc0f5){_0x1fc0f5=_0x1fc0f5||0x1f4;return function(_0x5f10a1){logger[_0x7d4c('0x26')](_0x5f10a1['stack']);if(_0x5f10a1[_0x7d4c('0x27')]){delete _0x5f10a1[_0x7d4c('0x27')];}_0x49bf3b[_0x7d4c('0x18')](_0x1fc0f5)['send'](_0x5f10a1);};}exports[_0x7d4c('0x28')]=function(_0x3784a0,_0x4b1c06){var _0x116b20={},_0x135018={},_0x7cb400={'count':0x0,'rows':[]};var _0x5603e4=_['map'](db[_0x7d4c('0x29')][_0x7d4c('0x2a')],function(_0x7e5c95){return{'name':_0x7e5c95['fieldName'],'type':_0x7e5c95[_0x7d4c('0x2b')][_0x7d4c('0x2c')]};});_0x135018['model']=_[_0x7d4c('0x2d')](_0x5603e4,_0x7d4c('0x27'));_0x135018['query']=_[_0x7d4c('0x2e')](_0x3784a0[_0x7d4c('0x2f')]);_0x135018['filters']=_[_0x7d4c('0x30')](_0x135018[_0x7d4c('0x31')],_0x135018[_0x7d4c('0x2f')]);_0x116b20[_0x7d4c('0x32')]=_[_0x7d4c('0x30')](_0x135018['model'],qs[_0x7d4c('0x33')](_0x3784a0['query']['fields']));_0x116b20['attributes']=_0x116b20[_0x7d4c('0x32')][_0x7d4c('0x34')]?_0x116b20[_0x7d4c('0x32')]:_0x135018[_0x7d4c('0x31')];if(!_0x3784a0['query']['hasOwnProperty'](_0x7d4c('0x35'))){_0x116b20[_0x7d4c('0x1b')]=qs[_0x7d4c('0x1b')](_0x3784a0[_0x7d4c('0x2f')]['limit']);_0x116b20[_0x7d4c('0x1a')]=qs[_0x7d4c('0x1a')](_0x3784a0[_0x7d4c('0x2f')]['offset']);}_0x116b20['order']=qs[_0x7d4c('0x36')](_0x3784a0[_0x7d4c('0x2f')][_0x7d4c('0x36')]);_0x116b20[_0x7d4c('0x37')]=qs[_0x7d4c('0x38')](_[_0x7d4c('0x39')](_0x3784a0[_0x7d4c('0x2f')],_0x135018[_0x7d4c('0x38')]),_0x5603e4);if(_0x3784a0[_0x7d4c('0x2f')][_0x7d4c('0x3a')]){_0x116b20[_0x7d4c('0x37')]=_[_0x7d4c('0x3b')](_0x116b20[_0x7d4c('0x37')],{'$or':_['map'](_0x5603e4,function(_0x44b3f2){if(_0x44b3f2[_0x7d4c('0x2b')]!=='VIRTUAL'){var _0x46c9c6={};_0x46c9c6[_0x44b3f2['name']]={'$like':'%'+_0x3784a0[_0x7d4c('0x2f')][_0x7d4c('0x3a')]+'%'};return _0x46c9c6;}})});}_0x116b20=_[_0x7d4c('0x3b')]({},_0x116b20,_0x3784a0[_0x7d4c('0x3c')]);var _0x498846={'where':_0x116b20['where']};return db[_0x7d4c('0x29')]['count'](_0x498846)[_0x7d4c('0x25')](function(_0x5134fd){_0x7cb400[_0x7d4c('0x1d')]=_0x5134fd;if(_0x3784a0[_0x7d4c('0x2f')][_0x7d4c('0x3d')]){_0x116b20[_0x7d4c('0x3e')]=[{'all':!![]}];}return db[_0x7d4c('0x29')][_0x7d4c('0x3f')](_0x116b20);})[_0x7d4c('0x25')](function(_0x2341a1){_0x7cb400[_0x7d4c('0x40')]=_0x2341a1;return _0x7cb400;})['then'](respondWithFilteredResult(_0x4b1c06,_0x116b20))[_0x7d4c('0x41')](handleError(_0x4b1c06,null));};exports[_0x7d4c('0x42')]=function(_0x4a2a73,_0x4e3ee5){var _0x13cf69={'raw':!![],'where':{'id':_0x4a2a73[_0x7d4c('0x43')]['id']}},_0x3efb5b={};_0x3efb5b[_0x7d4c('0x31')]=_['keys'](db[_0x7d4c('0x29')][_0x7d4c('0x2a')]);_0x3efb5b[_0x7d4c('0x2f')]=_[_0x7d4c('0x2e')](_0x4a2a73['query']);_0x3efb5b[_0x7d4c('0x38')]=_[_0x7d4c('0x30')](_0x3efb5b[_0x7d4c('0x31')],_0x3efb5b[_0x7d4c('0x2f')]);_0x13cf69[_0x7d4c('0x32')]=_[_0x7d4c('0x30')](_0x3efb5b[_0x7d4c('0x31')],qs[_0x7d4c('0x33')](_0x4a2a73['query'][_0x7d4c('0x33')]));_0x13cf69[_0x7d4c('0x32')]=_0x13cf69[_0x7d4c('0x32')][_0x7d4c('0x34')]?_0x13cf69[_0x7d4c('0x32')]:_0x3efb5b[_0x7d4c('0x31')];if(_0x4a2a73[_0x7d4c('0x2f')][_0x7d4c('0x3d')]){_0x13cf69[_0x7d4c('0x3e')]=[{'all':!![]}];}_0x13cf69=_[_0x7d4c('0x3b')]({},_0x13cf69,_0x4a2a73['options']);return db['SmsQueueReport'][_0x7d4c('0x44')](_0x13cf69)[_0x7d4c('0x25')](handleEntityNotFound(_0x4e3ee5,null))[_0x7d4c('0x25')](respondWithResult(_0x4e3ee5,null))[_0x7d4c('0x41')](handleError(_0x4e3ee5,null));};exports[_0x7d4c('0x45')]=function(_0x44d6cb,_0x2bb396){return db[_0x7d4c('0x29')]['create'](_0x44d6cb[_0x7d4c('0x46')],{})[_0x7d4c('0x25')](respondWithResult(_0x2bb396,0xc9))[_0x7d4c('0x41')](handleError(_0x2bb396,null));};exports['update']=function(_0x29ff7d,_0x7d58fd){if(_0x29ff7d[_0x7d4c('0x46')]['id']){delete _0x29ff7d['body']['id'];}return db[_0x7d4c('0x29')][_0x7d4c('0x44')]({'where':{'id':_0x29ff7d[_0x7d4c('0x43')]['id']}})[_0x7d4c('0x25')](handleEntityNotFound(_0x7d58fd,null))[_0x7d4c('0x25')](saveUpdates(_0x29ff7d[_0x7d4c('0x46')],null))['then'](respondWithResult(_0x7d58fd,null))[_0x7d4c('0x41')](handleError(_0x7d58fd,null));};exports[_0x7d4c('0x24')]=function(_0x4af8d0,_0x529dac){return db[_0x7d4c('0x29')][_0x7d4c('0x44')]({'where':{'id':_0x4af8d0[_0x7d4c('0x43')]['id']}})['then'](handleEntityNotFound(_0x529dac,null))[_0x7d4c('0x25')](removeEntity(_0x529dac,null))['catch'](handleError(_0x529dac,null));};exports[_0x7d4c('0x47')]=function(_0x5f4a6a,_0x5aaa53){return db['SmsQueueReport']['describe']()[_0x7d4c('0x25')](respondWithResult(_0x5aaa53,null))['catch'](handleError(_0x5aaa53,null));}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.model.js b/server/api/smsQueueReport/smsQueueReport.model.js index 3e55623..8c01b7c 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 _0xe706=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsQueueReport.attributes','exports','define','SmsQueueReport','report_sms_queue','uniqueid','lodash','util'];(function(_0x405faf,_0x38d0f0){var _0x2308e5=function(_0x34e928){while(--_0x34e928){_0x405faf['push'](_0x405faf['shift']());}};_0x2308e5(++_0x38d0f0);}(_0xe706,0xa3));var _0x6e70=function(_0x57746e,_0x45093f){_0x57746e=_0x57746e-0x0;var _0x5caeaa=_0xe706[_0x57746e];return _0x5caeaa;};'use strict';var _=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var logger=require(_0x6e70('0x2'))('api');var moment=require(_0x6e70('0x3'));var BPromise=require(_0x6e70('0x4'));var rp=require(_0x6e70('0x5'));var fs=require('fs');var path=require(_0x6e70('0x6'));var rimraf=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));var attributes=require(_0x6e70('0x9'));module[_0x6e70('0xa')]=function(_0x1b0389,_0x4381d1){return _0x1b0389[_0x6e70('0xb')](_0x6e70('0xc'),attributes,{'tableName':_0x6e70('0xd'),'paranoid':![],'indexes':[{'name':_0x6e70('0xe'),'fields':[_0x6e70('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xe706=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsQueueReport.attributes','exports','define','SmsQueueReport','report_sms_queue','uniqueid','lodash','util'];(function(_0x10c2d3,_0x2f5914){var _0x5a0b13=function(_0x412864){while(--_0x412864){_0x10c2d3['push'](_0x10c2d3['shift']());}};_0x5a0b13(++_0x2f5914);}(_0xe706,0xa3));var _0x6e70=function(_0x15a8e1,_0x21e63d){_0x15a8e1=_0x15a8e1-0x0;var _0x185130=_0xe706[_0x15a8e1];return _0x185130;};'use strict';var _=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var logger=require(_0x6e70('0x2'))('api');var moment=require(_0x6e70('0x3'));var BPromise=require(_0x6e70('0x4'));var rp=require(_0x6e70('0x5'));var fs=require('fs');var path=require(_0x6e70('0x6'));var rimraf=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));var attributes=require(_0x6e70('0x9'));module[_0x6e70('0xa')]=function(_0x1b0389,_0x4381d1){return _0x1b0389[_0x6e70('0xb')](_0x6e70('0xc'),attributes,{'tableName':_0x6e70('0xd'),'paranoid':![],'indexes':[{'name':_0x6e70('0xe'),'fields':[_0x6e70('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.rpc.js b/server/api/smsQueueReport/smsQueueReport.rpc.js index b62dc25..02af2c2 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 _0xfe55=['../../config/logger','rpc','../../config/environment','client','http','then','info','SmsQueueReport,\x20%s,\x20%s','request\x20sent','debug','SmsQueueReport,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','CreateSmsQueueReport','SmsQueueReport','create','body','options','stringify','raw','attributes','limit','UpdateSmsQueueReport','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x986b7,_0x572241){var _0xef1d2c=function(_0x402d5b){while(--_0x402d5b){_0x986b7['push'](_0x986b7['shift']());}};_0xef1d2c(++_0x572241);}(_0xfe55,0x164));var _0x5fe5=function(_0x209941,_0x5c9988){_0x209941=_0x209941-0x0;var _0x1e8729=_0xfe55[_0x209941];return _0x1e8729;};'use strict';var _=require(_0x5fe5('0x0'));var util=require(_0x5fe5('0x1'));var moment=require(_0x5fe5('0x2'));var BPromise=require(_0x5fe5('0x3'));var rs=require(_0x5fe5('0x4'));var fs=require('fs');var Redis=require(_0x5fe5('0x5'));var db=require(_0x5fe5('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x5fe5('0x7'))(_0x5fe5('0x8'));var config=require(_0x5fe5('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x5fe5('0xa')][_0x5fe5('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x435279,_0x1fffb8,_0x7ef067){return new BPromise(function(_0x350e0f,_0xe2e647){return client['request'](_0x435279,_0x7ef067)[_0x5fe5('0xc')](function(_0x471960){logger[_0x5fe5('0xd')](_0x5fe5('0xe'),_0x1fffb8,_0x5fe5('0xf'));logger[_0x5fe5('0x10')](_0x5fe5('0x11'),_0x1fffb8,_0x5fe5('0xf'),JSON['stringify'](_0x471960));if(_0x471960[_0x5fe5('0x12')]){if(_0x471960['error'][_0x5fe5('0x13')]===0x1f4){logger['error'](_0x5fe5('0xe'),_0x1fffb8,_0x471960[_0x5fe5('0x12')][_0x5fe5('0x14')]);return _0xe2e647(_0x471960[_0x5fe5('0x12')][_0x5fe5('0x14')]);}logger[_0x5fe5('0x12')](_0x5fe5('0xe'),_0x1fffb8,_0x471960[_0x5fe5('0x12')][_0x5fe5('0x14')]);return _0x350e0f(_0x471960['error'][_0x5fe5('0x14')]);}else{logger[_0x5fe5('0xd')](_0x5fe5('0xe'),_0x1fffb8,_0x5fe5('0xf'));_0x350e0f(_0x471960[_0x5fe5('0x15')][_0x5fe5('0x14')]);}})[_0x5fe5('0x16')](function(_0x4ce502){logger['error'](_0x5fe5('0xe'),_0x1fffb8,_0x4ce502);_0xe2e647(_0x4ce502);});});}exports[_0x5fe5('0x17')]=function(_0x155610){var _0x949a0=this;return new Promise(function(_0x31164e,_0x4578d2){return db[_0x5fe5('0x18')][_0x5fe5('0x19')](_0x155610[_0x5fe5('0x1a')],{'raw':_0x155610[_0x5fe5('0x1b')]?_0x155610[_0x5fe5('0x1b')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x3d187f){logger[_0x5fe5('0xd')](_0x5fe5('0x17'),_0x155610);logger[_0x5fe5('0x10')]('CreateSmsQueueReport',_0x155610,JSON[_0x5fe5('0x1c')](_0x3d187f));_0x31164e(_0x3d187f);})['catch'](function(_0x4c7d43){logger['error']('CreateSmsQueueReport',_0x4c7d43[_0x5fe5('0x14')],_0x155610);_0x4578d2(_0x949a0['error'](0x1f4,_0x4c7d43[_0x5fe5('0x14')]));});});};exports['UpdateSmsQueueReport']=function(_0x2fbaec){var _0x528b38=this;return new Promise(function(_0x58caf7,_0x36f723){return db['SmsQueueReport']['update'](_0x2fbaec[_0x5fe5('0x1a')],{'raw':_0x2fbaec[_0x5fe5('0x1b')]?_0x2fbaec[_0x5fe5('0x1b')][_0x5fe5('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2fbaec[_0x5fe5('0x1b')]?_0x2fbaec[_0x5fe5('0x1b')]['where']||null:null,'attributes':_0x2fbaec[_0x5fe5('0x1b')]?_0x2fbaec[_0x5fe5('0x1b')][_0x5fe5('0x1e')]||null:null,'limit':_0x2fbaec['options']?_0x2fbaec[_0x5fe5('0x1b')][_0x5fe5('0x1f')]||null:null})[_0x5fe5('0xc')](function(_0x2aec4d){logger[_0x5fe5('0xd')]('UpdateSmsQueueReport',_0x2fbaec);logger[_0x5fe5('0x10')](_0x5fe5('0x20'),_0x2fbaec,JSON['stringify'](_0x2aec4d));_0x58caf7(_0x2aec4d);})['catch'](function(_0x514bb0){logger[_0x5fe5('0x12')]('UpdateSmsQueueReport',_0x514bb0[_0x5fe5('0x14')],_0x2fbaec);_0x36f723(_0x528b38['error'](0x1f4,_0x514bb0[_0x5fe5('0x14')]));});});}; \ No newline at end of file +var _0x13e2=['result','catch','CreateSmsQueueReport','SmsQueueReport','body','options','raw','debug','update','where','attributes','limit','UpdateSmsQueueReport','moment','bluebird','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SmsQueueReport,\x20%s,\x20%s','request\x20sent','stringify','error','code','message'];(function(_0x26e6d5,_0x13ceff){var _0x174341=function(_0x53b570){while(--_0x53b570){_0x26e6d5['push'](_0x26e6d5['shift']());}};_0x174341(++_0x13ceff);}(_0x13e2,0x1a0));var _0x213e=function(_0x42a1ed,_0x2a12ed){_0x42a1ed=_0x42a1ed-0x0;var _0x1bea9a=_0x13e2[_0x42a1ed];return _0x1bea9a;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x213e('0x0'));var BPromise=require(_0x213e('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x213e('0x2'));var logger=require(_0x213e('0x3'))(_0x213e('0x4'));var config=require(_0x213e('0x5'));var jayson=require(_0x213e('0x6'));var client=jayson[_0x213e('0x7')][_0x213e('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2b299e,_0xbbf76f,_0x148722){return new BPromise(function(_0x55ad0d,_0x24ec42){return client[_0x213e('0x9')](_0x2b299e,_0x148722)[_0x213e('0xa')](function(_0x4e6b8a){logger[_0x213e('0xb')](_0x213e('0xc'),_0xbbf76f,_0x213e('0xd'));logger['debug']('SmsQueueReport,\x20%s,\x20%s,\x20%s',_0xbbf76f,_0x213e('0xd'),JSON[_0x213e('0xe')](_0x4e6b8a));if(_0x4e6b8a[_0x213e('0xf')]){if(_0x4e6b8a[_0x213e('0xf')][_0x213e('0x10')]===0x1f4){logger[_0x213e('0xf')](_0x213e('0xc'),_0xbbf76f,_0x4e6b8a[_0x213e('0xf')]['message']);return _0x24ec42(_0x4e6b8a[_0x213e('0xf')][_0x213e('0x11')]);}logger[_0x213e('0xf')](_0x213e('0xc'),_0xbbf76f,_0x4e6b8a[_0x213e('0xf')][_0x213e('0x11')]);return _0x55ad0d(_0x4e6b8a[_0x213e('0xf')][_0x213e('0x11')]);}else{logger[_0x213e('0xb')](_0x213e('0xc'),_0xbbf76f,_0x213e('0xd'));_0x55ad0d(_0x4e6b8a[_0x213e('0x12')][_0x213e('0x11')]);}})[_0x213e('0x13')](function(_0x177a90){logger[_0x213e('0xf')](_0x213e('0xc'),_0xbbf76f,_0x177a90);_0x24ec42(_0x177a90);});});}exports[_0x213e('0x14')]=function(_0x2d2a16){var _0x149e89=this;return new Promise(function(_0x2eff65,_0x132dcd){return db[_0x213e('0x15')]['create'](_0x2d2a16[_0x213e('0x16')],{'raw':_0x2d2a16[_0x213e('0x17')]?_0x2d2a16[_0x213e('0x17')][_0x213e('0x18')]===undefined?!![]:![]:!![]})['then'](function(_0x416781){logger[_0x213e('0xb')]('CreateSmsQueueReport',_0x2d2a16);logger[_0x213e('0x19')]('CreateSmsQueueReport',_0x2d2a16,JSON[_0x213e('0xe')](_0x416781));_0x2eff65(_0x416781);})[_0x213e('0x13')](function(_0x442c44){logger[_0x213e('0xf')](_0x213e('0x14'),_0x442c44[_0x213e('0x11')],_0x2d2a16);_0x132dcd(_0x149e89[_0x213e('0xf')](0x1f4,_0x442c44[_0x213e('0x11')]));});});};exports['UpdateSmsQueueReport']=function(_0x152798){var _0x5f2f31=this;return new Promise(function(_0x476e72,_0x3fa317){return db['SmsQueueReport'][_0x213e('0x1a')](_0x152798[_0x213e('0x16')],{'raw':_0x152798[_0x213e('0x17')]?_0x152798['options'][_0x213e('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x152798[_0x213e('0x17')]?_0x152798[_0x213e('0x17')][_0x213e('0x1b')]||null:null,'attributes':_0x152798[_0x213e('0x17')]?_0x152798['options'][_0x213e('0x1c')]||null:null,'limit':_0x152798[_0x213e('0x17')]?_0x152798['options'][_0x213e('0x1d')]||null:null})['then'](function(_0x2650e8){logger['info'](_0x213e('0x1e'),_0x152798);logger[_0x213e('0x19')]('UpdateSmsQueueReport',_0x152798,JSON[_0x213e('0xe')](_0x2650e8));_0x476e72(_0x2650e8);})[_0x213e('0x13')](function(_0x4bf887){logger[_0x213e('0xf')](_0x213e('0x1e'),_0x4bf887[_0x213e('0x11')],_0x152798);_0x3fa317(_0x5f2f31[_0x213e('0xf')](0x1f4,_0x4bf887['message']));});});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/index.js b/server/api/smsTransferReport/index.js index 3997687..8ee91b6 100644 --- a/server/api/smsTransferReport/index.js +++ b/server/api/smsTransferReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6c7b=['./smsTransferReport.controller','get','isAuthenticated','index','describe','/:id','show','post','update','delete','destroy','multer','express','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6c7b,0x10b));var _0xb6c7=function(_0x2fa443,_0x2251ea){_0x2fa443=_0x2fa443-0x0;var _0x5630bc=_0x6c7b[_0x2fa443];return _0x5630bc;};'use strict';var multer=require(_0xb6c7('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0xb6c7('0x1'));var router=express['Router']();var fs_extra=require(_0xb6c7('0x2'));var auth=require(_0xb6c7('0x3'));var interaction=require(_0xb6c7('0x4'));var config=require('../../config/environment');var controller=require(_0xb6c7('0x5'));router[_0xb6c7('0x6')]('/',auth[_0xb6c7('0x7')](),controller[_0xb6c7('0x8')]);router[_0xb6c7('0x6')]('/describe',auth[_0xb6c7('0x7')](),controller[_0xb6c7('0x9')]);router[_0xb6c7('0x6')](_0xb6c7('0xa'),auth[_0xb6c7('0x7')](),controller[_0xb6c7('0xb')]);router[_0xb6c7('0xc')]('/',auth[_0xb6c7('0x7')](),controller['create']);router['put'](_0xb6c7('0xa'),auth[_0xb6c7('0x7')](),controller[_0xb6c7('0xd')]);router[_0xb6c7('0xe')](_0xb6c7('0xa'),auth[_0xb6c7('0x7')](),controller[_0xb6c7('0xf')]);module['exports']=router; \ No newline at end of file +var _0x7579=['delete','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsTransferReport.controller','isAuthenticated','index','get','/:id','post','create','put','update'];(function(_0xa9f89e,_0x51ee9e){var _0x5a979d=function(_0x190606){while(--_0x190606){_0xa9f89e['push'](_0xa9f89e['shift']());}};_0x5a979d(++_0x51ee9e);}(_0x7579,0x1e2));var _0x9757=function(_0x493b27,_0xad3bf){_0x493b27=_0x493b27-0x0;var _0x57d4d7=_0x7579[_0x493b27];return _0x57d4d7;};'use strict';var multer=require(_0x9757('0x0'));var util=require(_0x9757('0x1'));var path=require(_0x9757('0x2'));var timeout=require(_0x9757('0x3'));var express=require(_0x9757('0x4'));var router=express[_0x9757('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x9757('0x6'));var interaction=require(_0x9757('0x7'));var config=require(_0x9757('0x8'));var controller=require(_0x9757('0x9'));router['get']('/',auth[_0x9757('0xa')](),controller[_0x9757('0xb')]);router[_0x9757('0xc')]('/describe',auth[_0x9757('0xa')](),controller['describe']);router[_0x9757('0xc')](_0x9757('0xd'),auth[_0x9757('0xa')](),controller['show']);router[_0x9757('0xe')]('/',auth[_0x9757('0xa')](),controller[_0x9757('0xf')]);router[_0x9757('0x10')](_0x9757('0xd'),auth[_0x9757('0xa')](),controller[_0x9757('0x11')]);router[_0x9757('0x12')](_0x9757('0xd'),auth[_0x9757('0xa')](),controller[_0x9757('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.attributes.js b/server/api/smsTransferReport/smsTransferReport.attributes.js index a51caff..8169035 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 _0xb43b=['DATE','NOW','moment','sequelize','STRING','ENUM','account','queue'];(function(_0x5976f8,_0x1265b7){var _0x179715=function(_0x2b2c4b){while(--_0x2b2c4b){_0x5976f8['push'](_0x5976f8['shift']());}};_0x179715(++_0x1265b7);}(_0xb43b,0x1b2));var _0xbb43=function(_0x25af70,_0x377463){_0x25af70=_0x25af70-0x0;var _0x51e8a7=_0xb43b[_0x25af70];return _0x51e8a7;};'use strict';var moment=require(_0xbb43('0x0'));var Sequelize=require(_0xbb43('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0xbb43('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xbb43('0x3')](_0xbb43('0x4'),'agent',_0xbb43('0x5')),'allowNull':![],'defaultValue':_0xbb43('0x5')},'transferredAt':{'type':Sequelize[_0xbb43('0x6')],'allowNull':![],'defaultValue':Sequelize[_0xbb43('0x7')]}}; \ No newline at end of file +var _0xf4eb=['NOW','moment','account','queue','DATE'];(function(_0x4e193e,_0x55e21f){var _0x597620=function(_0x399333){while(--_0x399333){_0x4e193e['push'](_0x4e193e['shift']());}};_0x597620(++_0x55e21f);}(_0xf4eb,0xec));var _0xbf4e=function(_0x2982a2,_0x3b21a4){_0x2982a2=_0x2982a2-0x0;var _0x1cccc7=_0xf4eb[_0x2982a2];return _0x1cccc7;};'use strict';var moment=require(_0xbf4e('0x0'));var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xbf4e('0x1'),'agent','queue'),'allowNull':![],'defaultValue':_0xbf4e('0x2')},'transferredAt':{'type':Sequelize[_0xbf4e('0x3')],'allowNull':![],'defaultValue':Sequelize[_0xbf4e('0x4')]}}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.controller.js b/server/api/smsTransferReport/smsTransferReport.controller.js index 44bfb48..ee60007 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 _0x3a38=['SmsTransferReport','include','findAll','rows','params','length','includeAll','options','catch','create','body','update','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','undefined','limit','count','status','Content-Range','reject','save','then','destroy','error','stack','name','send','index','rawAttributes','type','key','model','map','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x3a38,0xa7));var _0x83a3=function(_0x4d296c,_0x5c67d6){_0x4d296c=_0x4d296c-0x0;var _0x4ec01f=_0x3a38[_0x4d296c];return _0x4ec01f;};'use strict';var emlformat=require(_0x83a3('0x0'));var rimraf=require(_0x83a3('0x1'));var zipdir=require(_0x83a3('0x2'));var jsonpatch=require(_0x83a3('0x3'));var rp=require(_0x83a3('0x4'));var moment=require('moment');var BPromise=require(_0x83a3('0x5'));var Mustache=require(_0x83a3('0x6'));var util=require(_0x83a3('0x7'));var path=require(_0x83a3('0x8'));var sox=require(_0x83a3('0x9'));var csv=require(_0x83a3('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x83a3('0xb'));var _=require(_0x83a3('0xc'));var squel=require('squel');var crypto=require(_0x83a3('0xd'));var jsforce=require(_0x83a3('0xe'));var deskjs=require(_0x83a3('0xf'));var toCsv=require(_0x83a3('0xa'));var querystring=require('querystring');var Papa=require(_0x83a3('0x10'));var Redis=require('ioredis');var authService=require(_0x83a3('0x11'));var qs=require(_0x83a3('0x12'));var as=require(_0x83a3('0x13'));var hardwareService=require(_0x83a3('0x14'));var logger=require(_0x83a3('0x15'))(_0x83a3('0x16'));var utils=require('../../config/utils');var config=require(_0x83a3('0x17'));var licenseUtil=require(_0x83a3('0x18'));var db=require(_0x83a3('0x19'))['db'];function respondWithStatusCode(_0x398128,_0x4468ed){_0x4468ed=_0x4468ed||0xcc;return function(_0x1673c7){if(_0x1673c7){return _0x398128[_0x83a3('0x1a')](_0x4468ed);}return _0x398128['status'](_0x4468ed)[_0x83a3('0x1b')]();};}function respondWithResult(_0x3ab83e,_0x5a65af){_0x5a65af=_0x5a65af||0xc8;return function(_0x12092a){if(_0x12092a){return _0x3ab83e['status'](_0x5a65af)[_0x83a3('0x1c')](_0x12092a);}};}function respondWithFilteredResult(_0x5e7b3f,_0x39e565){return function(_0x38b63d){if(_0x38b63d){var _0x453d56=typeof _0x39e565[_0x83a3('0x1d')]===_0x83a3('0x1e')&&typeof _0x39e565[_0x83a3('0x1f')]===_0x83a3('0x1e');var _0x52ea19=_0x38b63d[_0x83a3('0x20')];var _0x3ee936=_0x453d56?0x0:_0x39e565['offset'];var _0x23c40f=_0x453d56?_0x38b63d[_0x83a3('0x20')]:_0x39e565[_0x83a3('0x1d')]+_0x39e565[_0x83a3('0x1f')];var _0x3c27dc;if(_0x23c40f>=_0x52ea19){_0x23c40f=_0x52ea19;_0x3c27dc=0xc8;}else{_0x3c27dc=0xce;}_0x5e7b3f[_0x83a3('0x21')](_0x3c27dc);return _0x5e7b3f['set'](_0x83a3('0x22'),_0x3ee936+'-'+_0x23c40f+'/'+_0x52ea19)[_0x83a3('0x1c')](_0x38b63d);}return null;};}function patchUpdates(_0x39b065){return function(_0x5c74c5){try{jsonpatch['apply'](_0x5c74c5,_0x39b065,!![]);}catch(_0x345918){return BPromise[_0x83a3('0x23')](_0x345918);}return _0x5c74c5[_0x83a3('0x24')]();};}function saveUpdates(_0x2dc1d4,_0x3218fd){return function(_0x497646){if(_0x497646){return _0x497646['update'](_0x2dc1d4)[_0x83a3('0x25')](function(_0x19e228){return _0x19e228;});}return null;};}function removeEntity(_0x484547,_0x49af71){return function(_0x34b303){if(_0x34b303){return _0x34b303[_0x83a3('0x26')]()[_0x83a3('0x25')](function(){_0x484547[_0x83a3('0x21')](0xcc)[_0x83a3('0x1b')]();});}};}function handleEntityNotFound(_0x128dd3,_0x4397b3){return function(_0x4e51c3){if(!_0x4e51c3){_0x128dd3[_0x83a3('0x1a')](0x194);}return _0x4e51c3;};}function handleError(_0x288559,_0x22d668){_0x22d668=_0x22d668||0x1f4;return function(_0xc6c560){logger[_0x83a3('0x27')](_0xc6c560[_0x83a3('0x28')]);if(_0xc6c560[_0x83a3('0x29')]){delete _0xc6c560['name'];}_0x288559[_0x83a3('0x21')](_0x22d668)[_0x83a3('0x2a')](_0xc6c560);};}exports[_0x83a3('0x2b')]=function(_0x4bed1a,_0x29b5e1){var _0x1f28b6={},_0xe3903e={},_0x4f1e46={'count':0x0,'rows':[]};var _0x36d474=_['map'](db['SmsTransferReport'][_0x83a3('0x2c')],function(_0x308308){return{'name':_0x308308['fieldName'],'type':_0x308308[_0x83a3('0x2d')][_0x83a3('0x2e')]};});_0xe3903e[_0x83a3('0x2f')]=_[_0x83a3('0x30')](_0x36d474,_0x83a3('0x29'));_0xe3903e[_0x83a3('0x31')]=_[_0x83a3('0x32')](_0x4bed1a['query']);_0xe3903e[_0x83a3('0x33')]=_[_0x83a3('0x34')](_0xe3903e['model'],_0xe3903e[_0x83a3('0x31')]);_0x1f28b6['attributes']=_[_0x83a3('0x34')](_0xe3903e[_0x83a3('0x2f')],qs[_0x83a3('0x35')](_0x4bed1a[_0x83a3('0x31')][_0x83a3('0x35')]));_0x1f28b6[_0x83a3('0x36')]=_0x1f28b6[_0x83a3('0x36')]['length']?_0x1f28b6[_0x83a3('0x36')]:_0xe3903e['model'];if(!_0x4bed1a['query'][_0x83a3('0x37')](_0x83a3('0x38'))){_0x1f28b6[_0x83a3('0x1f')]=qs[_0x83a3('0x1f')](_0x4bed1a[_0x83a3('0x31')][_0x83a3('0x1f')]);_0x1f28b6['offset']=qs[_0x83a3('0x1d')](_0x4bed1a[_0x83a3('0x31')]['offset']);}_0x1f28b6[_0x83a3('0x39')]=qs[_0x83a3('0x3a')](_0x4bed1a[_0x83a3('0x31')][_0x83a3('0x3a')]);_0x1f28b6['where']=qs[_0x83a3('0x33')](_[_0x83a3('0x3b')](_0x4bed1a[_0x83a3('0x31')],_0xe3903e[_0x83a3('0x33')]),_0x36d474);if(_0x4bed1a['query'][_0x83a3('0x3c')]){_0x1f28b6[_0x83a3('0x3d')]=_[_0x83a3('0x3e')](_0x1f28b6['where'],{'$or':_[_0x83a3('0x30')](_0x36d474,function(_0x1631df){if(_0x1631df['type']!==_0x83a3('0x3f')){var _0x32faf4={};_0x32faf4[_0x1631df[_0x83a3('0x29')]]={'$like':'%'+_0x4bed1a[_0x83a3('0x31')][_0x83a3('0x3c')]+'%'};return _0x32faf4;}})});}_0x1f28b6=_[_0x83a3('0x3e')]({},_0x1f28b6,_0x4bed1a['options']);var _0x2bee48={'where':_0x1f28b6[_0x83a3('0x3d')]};return db[_0x83a3('0x40')][_0x83a3('0x20')](_0x2bee48)[_0x83a3('0x25')](function(_0x1fb6cf){_0x4f1e46[_0x83a3('0x20')]=_0x1fb6cf;if(_0x4bed1a[_0x83a3('0x31')]['includeAll']){_0x1f28b6[_0x83a3('0x41')]=[{'all':!![]}];}return db['SmsTransferReport'][_0x83a3('0x42')](_0x1f28b6);})['then'](function(_0x2fcf3a){_0x4f1e46[_0x83a3('0x43')]=_0x2fcf3a;return _0x4f1e46;})['then'](respondWithFilteredResult(_0x29b5e1,_0x1f28b6))['catch'](handleError(_0x29b5e1,null));};exports['show']=function(_0x38eee9,_0x69d0b){var _0x2db65e={'raw':!![],'where':{'id':_0x38eee9[_0x83a3('0x44')]['id']}},_0x174876={};_0x174876[_0x83a3('0x2f')]=_[_0x83a3('0x32')](db[_0x83a3('0x40')][_0x83a3('0x2c')]);_0x174876['query']=_[_0x83a3('0x32')](_0x38eee9[_0x83a3('0x31')]);_0x174876['filters']=_['intersection'](_0x174876['model'],_0x174876['query']);_0x2db65e[_0x83a3('0x36')]=_[_0x83a3('0x34')](_0x174876[_0x83a3('0x2f')],qs[_0x83a3('0x35')](_0x38eee9[_0x83a3('0x31')][_0x83a3('0x35')]));_0x2db65e[_0x83a3('0x36')]=_0x2db65e[_0x83a3('0x36')][_0x83a3('0x45')]?_0x2db65e['attributes']:_0x174876[_0x83a3('0x2f')];if(_0x38eee9[_0x83a3('0x31')][_0x83a3('0x46')]){_0x2db65e[_0x83a3('0x41')]=[{'all':!![]}];}_0x2db65e=_[_0x83a3('0x3e')]({},_0x2db65e,_0x38eee9[_0x83a3('0x47')]);return db[_0x83a3('0x40')]['find'](_0x2db65e)['then'](handleEntityNotFound(_0x69d0b,null))[_0x83a3('0x25')](respondWithResult(_0x69d0b,null))[_0x83a3('0x48')](handleError(_0x69d0b,null));};exports[_0x83a3('0x49')]=function(_0x5c777c,_0x2ad377){return db[_0x83a3('0x40')]['create'](_0x5c777c[_0x83a3('0x4a')],{})['then'](respondWithResult(_0x2ad377,0xc9))[_0x83a3('0x48')](handleError(_0x2ad377,null));};exports[_0x83a3('0x4b')]=function(_0x2d1c73,_0x54de08){if(_0x2d1c73[_0x83a3('0x4a')]['id']){delete _0x2d1c73['body']['id'];}return db['SmsTransferReport'][_0x83a3('0x4c')]({'where':{'id':_0x2d1c73[_0x83a3('0x44')]['id']}})[_0x83a3('0x25')](handleEntityNotFound(_0x54de08,null))[_0x83a3('0x25')](saveUpdates(_0x2d1c73[_0x83a3('0x4a')],null))[_0x83a3('0x25')](respondWithResult(_0x54de08,null))['catch'](handleError(_0x54de08,null));};exports[_0x83a3('0x26')]=function(_0x5a8e69,_0x5ba81f){return db[_0x83a3('0x40')][_0x83a3('0x4c')]({'where':{'id':_0x5a8e69[_0x83a3('0x44')]['id']}})[_0x83a3('0x25')](handleEntityNotFound(_0x5ba81f,null))[_0x83a3('0x25')](removeEntity(_0x5ba81f,null))[_0x83a3('0x48')](handleError(_0x5ba81f,null));};exports['describe']=function(_0x68e68,_0x2fea07){return db['SmsTransferReport']['describe']()[_0x83a3('0x25')](respondWithResult(_0x2fea07,null))[_0x83a3('0x48')](handleError(_0x2fea07,null));}; \ No newline at end of file +var _0x632a=['findAll','rows','show','params','rawAttributes','options','catch','create','body','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','index','map','SmsTransferReport','fieldName','key','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','type','VIRTUAL','filter','includeAll','include'];(function(_0x101f7e,_0x5175f9){var _0x136dde=function(_0xe3cd3a){while(--_0xe3cd3a){_0x101f7e['push'](_0x101f7e['shift']());}};_0x136dde(++_0x5175f9);}(_0x632a,0x15b));var _0xa632=function(_0xc330e2,_0x2710df){_0xc330e2=_0xc330e2-0x0;var _0x97df23=_0x632a[_0xc330e2];return _0x97df23;};'use strict';var emlformat=require(_0xa632('0x0'));var rimraf=require(_0xa632('0x1'));var zipdir=require(_0xa632('0x2'));var jsonpatch=require(_0xa632('0x3'));var rp=require(_0xa632('0x4'));var moment=require(_0xa632('0x5'));var BPromise=require(_0xa632('0x6'));var Mustache=require(_0xa632('0x7'));var util=require(_0xa632('0x8'));var path=require('path');var sox=require(_0xa632('0x9'));var csv=require(_0xa632('0xa'));var ejs=require(_0xa632('0xb'));var fs=require('fs');var fs_extra=require(_0xa632('0xc'));var _=require(_0xa632('0xd'));var squel=require(_0xa632('0xe'));var crypto=require(_0xa632('0xf'));var jsforce=require(_0xa632('0x10'));var deskjs=require(_0xa632('0x11'));var toCsv=require(_0xa632('0xa'));var querystring=require(_0xa632('0x12'));var Papa=require(_0xa632('0x13'));var Redis=require(_0xa632('0x14'));var authService=require(_0xa632('0x15'));var qs=require('../../components/parsers/qs');var as=require(_0xa632('0x16'));var hardwareService=require(_0xa632('0x17'));var logger=require(_0xa632('0x18'))(_0xa632('0x19'));var utils=require(_0xa632('0x1a'));var config=require(_0xa632('0x1b'));var licenseUtil=require(_0xa632('0x1c'));var db=require(_0xa632('0x1d'))['db'];function respondWithStatusCode(_0x311f32,_0x14c6e4){_0x14c6e4=_0x14c6e4||0xcc;return function(_0x33e7e1){if(_0x33e7e1){return _0x311f32['sendStatus'](_0x14c6e4);}return _0x311f32[_0xa632('0x1e')](_0x14c6e4)[_0xa632('0x1f')]();};}function respondWithResult(_0x2dac20,_0x1e9083){_0x1e9083=_0x1e9083||0xc8;return function(_0x471d01){if(_0x471d01){return _0x2dac20[_0xa632('0x1e')](_0x1e9083)[_0xa632('0x20')](_0x471d01);}};}function respondWithFilteredResult(_0x4781b5,_0x53c721){return function(_0x6fe284){if(_0x6fe284){var _0x5b7dc3=typeof _0x53c721[_0xa632('0x21')]===_0xa632('0x22')&&typeof _0x53c721[_0xa632('0x23')]==='undefined';var _0x16eefd=_0x6fe284[_0xa632('0x24')];var _0xd5ae94=_0x5b7dc3?0x0:_0x53c721[_0xa632('0x21')];var _0x53180c=_0x5b7dc3?_0x6fe284[_0xa632('0x24')]:_0x53c721['offset']+_0x53c721[_0xa632('0x23')];var _0x30e682;if(_0x53180c>=_0x16eefd){_0x53180c=_0x16eefd;_0x30e682=0xc8;}else{_0x30e682=0xce;}_0x4781b5['status'](_0x30e682);return _0x4781b5[_0xa632('0x25')](_0xa632('0x26'),_0xd5ae94+'-'+_0x53180c+'/'+_0x16eefd)['json'](_0x6fe284);}return null;};}function patchUpdates(_0x245ec7){return function(_0x4b1634){try{jsonpatch[_0xa632('0x27')](_0x4b1634,_0x245ec7,!![]);}catch(_0x421241){return BPromise[_0xa632('0x28')](_0x421241);}return _0x4b1634[_0xa632('0x29')]();};}function saveUpdates(_0x206f46,_0x526d18){return function(_0x263852){if(_0x263852){return _0x263852[_0xa632('0x2a')](_0x206f46)[_0xa632('0x2b')](function(_0x2bae8b){return _0x2bae8b;});}return null;};}function removeEntity(_0x41c16a,_0x4ddb3a){return function(_0x36a912){if(_0x36a912){return _0x36a912[_0xa632('0x2c')]()[_0xa632('0x2b')](function(){_0x41c16a['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3b0599,_0x206629){return function(_0x2390b9){if(!_0x2390b9){_0x3b0599['sendStatus'](0x194);}return _0x2390b9;};}function handleError(_0x220835,_0x3e31e4){_0x3e31e4=_0x3e31e4||0x1f4;return function(_0x290816){logger[_0xa632('0x2d')](_0x290816[_0xa632('0x2e')]);if(_0x290816[_0xa632('0x2f')]){delete _0x290816[_0xa632('0x2f')];}_0x220835[_0xa632('0x1e')](_0x3e31e4)['send'](_0x290816);};}exports[_0xa632('0x30')]=function(_0x3698a6,_0x2d6732){var _0x25dab5={},_0x382c46={},_0x5ead9c={'count':0x0,'rows':[]};var _0x1965ac=_[_0xa632('0x31')](db[_0xa632('0x32')]['rawAttributes'],function(_0x45ba4e){return{'name':_0x45ba4e[_0xa632('0x33')],'type':_0x45ba4e['type'][_0xa632('0x34')]};});_0x382c46['model']=_[_0xa632('0x31')](_0x1965ac,_0xa632('0x2f'));_0x382c46[_0xa632('0x35')]=_[_0xa632('0x36')](_0x3698a6[_0xa632('0x35')]);_0x382c46[_0xa632('0x37')]=_['intersection'](_0x382c46[_0xa632('0x38')],_0x382c46[_0xa632('0x35')]);_0x25dab5[_0xa632('0x39')]=_[_0xa632('0x3a')](_0x382c46[_0xa632('0x38')],qs[_0xa632('0x3b')](_0x3698a6[_0xa632('0x35')][_0xa632('0x3b')]));_0x25dab5[_0xa632('0x39')]=_0x25dab5['attributes'][_0xa632('0x3c')]?_0x25dab5[_0xa632('0x39')]:_0x382c46['model'];if(!_0x3698a6[_0xa632('0x35')][_0xa632('0x3d')](_0xa632('0x3e'))){_0x25dab5['limit']=qs[_0xa632('0x23')](_0x3698a6[_0xa632('0x35')][_0xa632('0x23')]);_0x25dab5[_0xa632('0x21')]=qs[_0xa632('0x21')](_0x3698a6[_0xa632('0x35')][_0xa632('0x21')]);}_0x25dab5[_0xa632('0x3f')]=qs[_0xa632('0x40')](_0x3698a6[_0xa632('0x35')][_0xa632('0x40')]);_0x25dab5[_0xa632('0x41')]=qs['filters'](_[_0xa632('0x42')](_0x3698a6[_0xa632('0x35')],_0x382c46[_0xa632('0x37')]),_0x1965ac);if(_0x3698a6['query']['filter']){_0x25dab5['where']=_[_0xa632('0x43')](_0x25dab5[_0xa632('0x41')],{'$or':_['map'](_0x1965ac,function(_0x299316){if(_0x299316[_0xa632('0x44')]!==_0xa632('0x45')){var _0x164c95={};_0x164c95[_0x299316[_0xa632('0x2f')]]={'$like':'%'+_0x3698a6[_0xa632('0x35')][_0xa632('0x46')]+'%'};return _0x164c95;}})});}_0x25dab5=_['merge']({},_0x25dab5,_0x3698a6['options']);var _0x2026e7={'where':_0x25dab5[_0xa632('0x41')]};return db[_0xa632('0x32')]['count'](_0x2026e7)[_0xa632('0x2b')](function(_0x78384f){_0x5ead9c[_0xa632('0x24')]=_0x78384f;if(_0x3698a6['query'][_0xa632('0x47')]){_0x25dab5[_0xa632('0x48')]=[{'all':!![]}];}return db['SmsTransferReport'][_0xa632('0x49')](_0x25dab5);})[_0xa632('0x2b')](function(_0x3fc48d){_0x5ead9c[_0xa632('0x4a')]=_0x3fc48d;return _0x5ead9c;})[_0xa632('0x2b')](respondWithFilteredResult(_0x2d6732,_0x25dab5))['catch'](handleError(_0x2d6732,null));};exports[_0xa632('0x4b')]=function(_0x3963d1,_0x5b7e54){var _0x450415={'raw':!![],'where':{'id':_0x3963d1[_0xa632('0x4c')]['id']}},_0x292915={};_0x292915[_0xa632('0x38')]=_[_0xa632('0x36')](db[_0xa632('0x32')][_0xa632('0x4d')]);_0x292915[_0xa632('0x35')]=_['keys'](_0x3963d1[_0xa632('0x35')]);_0x292915[_0xa632('0x37')]=_[_0xa632('0x3a')](_0x292915['model'],_0x292915['query']);_0x450415['attributes']=_[_0xa632('0x3a')](_0x292915[_0xa632('0x38')],qs[_0xa632('0x3b')](_0x3963d1['query'][_0xa632('0x3b')]));_0x450415['attributes']=_0x450415[_0xa632('0x39')][_0xa632('0x3c')]?_0x450415[_0xa632('0x39')]:_0x292915[_0xa632('0x38')];if(_0x3963d1['query'][_0xa632('0x47')]){_0x450415['include']=[{'all':!![]}];}_0x450415=_[_0xa632('0x43')]({},_0x450415,_0x3963d1[_0xa632('0x4e')]);return db[_0xa632('0x32')]['find'](_0x450415)[_0xa632('0x2b')](handleEntityNotFound(_0x5b7e54,null))[_0xa632('0x2b')](respondWithResult(_0x5b7e54,null))[_0xa632('0x4f')](handleError(_0x5b7e54,null));};exports['create']=function(_0x3af3fa,_0x2c1bc4){return db[_0xa632('0x32')][_0xa632('0x50')](_0x3af3fa[_0xa632('0x51')],{})[_0xa632('0x2b')](respondWithResult(_0x2c1bc4,0xc9))[_0xa632('0x4f')](handleError(_0x2c1bc4,null));};exports['update']=function(_0x556e73,_0x258e4d){if(_0x556e73[_0xa632('0x51')]['id']){delete _0x556e73[_0xa632('0x51')]['id'];}return db['SmsTransferReport'][_0xa632('0x52')]({'where':{'id':_0x556e73[_0xa632('0x4c')]['id']}})[_0xa632('0x2b')](handleEntityNotFound(_0x258e4d,null))[_0xa632('0x2b')](saveUpdates(_0x556e73['body'],null))['then'](respondWithResult(_0x258e4d,null))['catch'](handleError(_0x258e4d,null));};exports[_0xa632('0x2c')]=function(_0x25a83a,_0x5213d2){return db['SmsTransferReport']['find']({'where':{'id':_0x25a83a[_0xa632('0x4c')]['id']}})[_0xa632('0x2b')](handleEntityNotFound(_0x5213d2,null))[_0xa632('0x2b')](removeEntity(_0x5213d2,null))[_0xa632('0x4f')](handleError(_0x5213d2,null));};exports[_0xa632('0x53')]=function(_0x49f3ec,_0x58a047){return db[_0xa632('0x32')][_0xa632('0x53')]()[_0xa632('0x2b')](respondWithResult(_0x58a047,null))['catch'](handleError(_0x58a047,null));}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.model.js b/server/api/smsTransferReport/smsTransferReport.model.js index dd065a4..f7f0273 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 _0x4bba=['path','../../config/environment','./smsTransferReport.attributes','define','SmsTransferReport','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x3ac97e,_0x1350a5){var _0xc3d785=function(_0xdeea47){while(--_0xdeea47){_0x3ac97e['push'](_0x3ac97e['shift']());}};_0xc3d785(++_0x1350a5);}(_0x4bba,0x131));var _0xa4bb=function(_0x491a7f,_0x28bb80){_0x491a7f=_0x491a7f-0x0;var _0x3d8f44=_0x4bba[_0x491a7f];return _0x3d8f44;};'use strict';var _=require(_0xa4bb('0x0'));var util=require(_0xa4bb('0x1'));var logger=require(_0xa4bb('0x2'))(_0xa4bb('0x3'));var moment=require(_0xa4bb('0x4'));var BPromise=require(_0xa4bb('0x5'));var rp=require(_0xa4bb('0x6'));var fs=require('fs');var path=require(_0xa4bb('0x7'));var rimraf=require('rimraf');var config=require(_0xa4bb('0x8'));var attributes=require(_0xa4bb('0x9'));module['exports']=function(_0x3ccaae,_0x32a59b){return _0x3ccaae[_0xa4bb('0xa')](_0xa4bb('0xb'),attributes,{'tableName':'report_sms_transfer','paranoid':![],'indexes':[{'name':_0xa4bb('0xc'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x7c53=['rimraf','../../config/environment','./smsTransferReport.attributes','define','SmsTransferReport','report_sms_transfer','uniqueid','lodash','moment','bluebird','request-promise','path'];(function(_0x577168,_0x1dec18){var _0x288c71=function(_0x6c0698){while(--_0x6c0698){_0x577168['push'](_0x577168['shift']());}};_0x288c71(++_0x1dec18);}(_0x7c53,0xbb));var _0x37c5=function(_0x8feac6,_0x5c6fc1){_0x8feac6=_0x8feac6-0x0;var _0x52e685=_0x7c53[_0x8feac6];return _0x52e685;};'use strict';var _=require(_0x37c5('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x37c5('0x1'));var BPromise=require(_0x37c5('0x2'));var rp=require(_0x37c5('0x3'));var fs=require('fs');var path=require(_0x37c5('0x4'));var rimraf=require(_0x37c5('0x5'));var config=require(_0x37c5('0x6'));var attributes=require(_0x37c5('0x7'));module['exports']=function(_0x186929,_0x9ce684){return _0x186929[_0x37c5('0x8')](_0x37c5('0x9'),attributes,{'tableName':_0x37c5('0xa'),'paranoid':![],'indexes':[{'name':_0x37c5('0xb'),'fields':[_0x37c5('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 d909d7c..8d322a9 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 _0x291c=['error','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','then','info','SmsTransferReport,\x20%s,\x20%s','request\x20sent','debug','SmsTransferReport,\x20%s,\x20%s,\x20%s','code'];(function(_0x31bf10,_0x503f9d){var _0x476bd8=function(_0x242181){while(--_0x242181){_0x31bf10['push'](_0x31bf10['shift']());}};_0x476bd8(++_0x503f9d);}(_0x291c,0x137));var _0xc291=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x291c[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0xc291('0x0'));var util=require(_0xc291('0x1'));var moment=require(_0xc291('0x2'));var BPromise=require(_0xc291('0x3'));var rs=require(_0xc291('0x4'));var fs=require('fs');var Redis=require(_0xc291('0x5'));var db=require(_0xc291('0x6'))['db'];var utils=require(_0xc291('0x7'));var logger=require(_0xc291('0x8'))(_0xc291('0x9'));var config=require(_0xc291('0xa'));var jayson=require('jayson/promise');var client=jayson[_0xc291('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5a7459,_0x40dc89,_0x2d3526){return new BPromise(function(_0x42a6ac,_0x26e775){return client['request'](_0x5a7459,_0x2d3526)[_0xc291('0xc')](function(_0x2beb3b){logger[_0xc291('0xd')](_0xc291('0xe'),_0x40dc89,_0xc291('0xf'));logger[_0xc291('0x10')](_0xc291('0x11'),_0x40dc89,_0xc291('0xf'),JSON['stringify'](_0x2beb3b));if(_0x2beb3b['error']){if(_0x2beb3b['error'][_0xc291('0x12')]===0x1f4){logger[_0xc291('0x13')](_0xc291('0xe'),_0x40dc89,_0x2beb3b['error'][_0xc291('0x14')]);return _0x26e775(_0x2beb3b['error'][_0xc291('0x14')]);}logger[_0xc291('0x13')](_0xc291('0xe'),_0x40dc89,_0x2beb3b[_0xc291('0x13')][_0xc291('0x14')]);return _0x42a6ac(_0x2beb3b[_0xc291('0x13')][_0xc291('0x14')]);}else{logger[_0xc291('0xd')](_0xc291('0xe'),_0x40dc89,_0xc291('0xf'));_0x42a6ac(_0x2beb3b['result'][_0xc291('0x14')]);}})[_0xc291('0x15')](function(_0x5888de){logger[_0xc291('0x13')]('SmsTransferReport,\x20%s,\x20%s',_0x40dc89,_0x5888de);_0x26e775(_0x5888de);});});} \ No newline at end of file +var _0x4f99=['client','http','then','info','SmsTransferReport,\x20%s,\x20%s','request\x20sent','debug','SmsTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise'];(function(_0x2dc14b,_0x2f1f9f){var _0x514740=function(_0x5eb0ba){while(--_0x5eb0ba){_0x2dc14b['push'](_0x2dc14b['shift']());}};_0x514740(++_0x2f1f9f);}(_0x4f99,0x157));var _0x94f9=function(_0xa7d8c3,_0x46ff3a){_0xa7d8c3=_0xa7d8c3-0x0;var _0xb38061=_0x4f99[_0xa7d8c3];return _0xb38061;};'use strict';var _=require(_0x94f9('0x0'));var util=require(_0x94f9('0x1'));var moment=require('moment');var BPromise=require(_0x94f9('0x2'));var rs=require(_0x94f9('0x3'));var fs=require('fs');var Redis=require(_0x94f9('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x94f9('0x5'));var logger=require(_0x94f9('0x6'))('rpc');var config=require(_0x94f9('0x7'));var jayson=require(_0x94f9('0x8'));var client=jayson[_0x94f9('0x9')][_0x94f9('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x36bfd9,_0x484a54,_0x1e4823){return new BPromise(function(_0x5a4301,_0x3550f0){return client['request'](_0x36bfd9,_0x1e4823)[_0x94f9('0xb')](function(_0x50af31){logger[_0x94f9('0xc')](_0x94f9('0xd'),_0x484a54,_0x94f9('0xe'));logger[_0x94f9('0xf')](_0x94f9('0x10'),_0x484a54,_0x94f9('0xe'),JSON[_0x94f9('0x11')](_0x50af31));if(_0x50af31['error']){if(_0x50af31[_0x94f9('0x12')][_0x94f9('0x13')]===0x1f4){logger[_0x94f9('0x12')](_0x94f9('0xd'),_0x484a54,_0x50af31[_0x94f9('0x12')][_0x94f9('0x14')]);return _0x3550f0(_0x50af31[_0x94f9('0x12')][_0x94f9('0x14')]);}logger[_0x94f9('0x12')](_0x94f9('0xd'),_0x484a54,_0x50af31[_0x94f9('0x12')][_0x94f9('0x14')]);return _0x5a4301(_0x50af31[_0x94f9('0x12')][_0x94f9('0x14')]);}else{logger[_0x94f9('0xc')]('SmsTransferReport,\x20%s,\x20%s',_0x484a54,_0x94f9('0xe'));_0x5a4301(_0x50af31[_0x94f9('0x15')][_0x94f9('0x14')]);}})['catch'](function(_0x490841){logger[_0x94f9('0x12')](_0x94f9('0xd'),_0x484a54,_0x490841);_0x3550f0(_0x490841);});});} \ No newline at end of file diff --git a/server/api/sound/index.js b/server/api/sound/index.js index b0bc43b..182b2c6 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 _0xad57=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./sound.controller','get','isAuthenticated','index','/:id/download','join','root','server/files/sounds/original/','originalname','replace','%s-%s%s','basename','extname','now','single','file','create','put','delete','exports','multer','util'];(function(_0x3443a7,_0x8b77e4){var _0x38db94=function(_0xe60678){while(--_0xe60678){_0x3443a7['push'](_0x3443a7['shift']());}};_0x38db94(++_0x8b77e4);}(_0xad57,0x8a));var _0x7ad5=function(_0x23232b,_0x5e22bf){_0x23232b=_0x23232b-0x0;var _0x5de4be=_0xad57[_0x23232b];return _0x5de4be;};'use strict';var multer=require(_0x7ad5('0x0'));var util=require(_0x7ad5('0x1'));var path=require(_0x7ad5('0x2'));var timeout=require(_0x7ad5('0x3'));var express=require(_0x7ad5('0x4'));var router=express[_0x7ad5('0x5')]();var fs_extra=require(_0x7ad5('0x6'));var auth=require(_0x7ad5('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x7ad5('0x8'));router[_0x7ad5('0x9')]('/',auth[_0x7ad5('0xa')](),controller[_0x7ad5('0xb')]);router[_0x7ad5('0x9')]('/:id',auth[_0x7ad5('0xa')](),controller['show']);router[_0x7ad5('0x9')](_0x7ad5('0xc'),auth[_0x7ad5('0xa')](),controller['download']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x3dc3cd,_0x399646,_0x5e17ce){_0x5e17ce(null,path[_0x7ad5('0xd')](config[_0x7ad5('0xe')],_0x7ad5('0xf')));},'filename':function(_0x23f68f,_0x5cdfdf,_0xee9784){_0x5cdfdf[_0x7ad5('0x10')]=_0x5cdfdf['originalname'][_0x7ad5('0x11')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0xee9784(null,util['format'](_0x7ad5('0x12'),path[_0x7ad5('0x13')](_0x5cdfdf[_0x7ad5('0x10')],path[_0x7ad5('0x14')](_0x5cdfdf['originalname'])),Date[_0x7ad5('0x15')](),path['extname'](_0x5cdfdf[_0x7ad5('0x10')])));}})});router['post']('/',upload[_0x7ad5('0x16')](_0x7ad5('0x17')),controller[_0x7ad5('0x18')]);router[_0x7ad5('0x19')]('/:id',auth[_0x7ad5('0xa')](),controller['update']);router[_0x7ad5('0x1a')]('/:id',auth[_0x7ad5('0xa')](),controller[_0x7ad5('0x1a')]);module[_0x7ad5('0x1b')]=router; \ No newline at end of file +var _0x2ad8=['download','diskStorage','join','originalname','replace','format','%s-%s%s','basename','now','single','file','create','put','delete','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./sound.controller','get','isAuthenticated','index','/:id','show','/:id/download'];(function(_0x19d48b,_0xf68c66){var _0x2d3f1e=function(_0x156b57){while(--_0x156b57){_0x19d48b['push'](_0x19d48b['shift']());}};_0x2d3f1e(++_0xf68c66);}(_0x2ad8,0x176));var _0x82ad=function(_0x119cd8,_0x556b73){_0x119cd8=_0x119cd8-0x0;var _0x7072a3=_0x2ad8[_0x119cd8];return _0x7072a3;};'use strict';var multer=require(_0x82ad('0x0'));var util=require(_0x82ad('0x1'));var path=require('path');var timeout=require(_0x82ad('0x2'));var express=require(_0x82ad('0x3'));var router=express[_0x82ad('0x4')]();var fs_extra=require(_0x82ad('0x5'));var auth=require(_0x82ad('0x6'));var interaction=require(_0x82ad('0x7'));var config=require(_0x82ad('0x8'));var controller=require(_0x82ad('0x9'));router[_0x82ad('0xa')]('/',auth[_0x82ad('0xb')](),controller[_0x82ad('0xc')]);router['get'](_0x82ad('0xd'),auth[_0x82ad('0xb')](),controller[_0x82ad('0xe')]);router['get'](_0x82ad('0xf'),auth['isAuthenticated'](),controller[_0x82ad('0x10')]);var upload=multer({'storage':multer[_0x82ad('0x11')]({'destination':function(_0x4d2c60,_0x17dc03,_0x1395f2){_0x1395f2(null,path[_0x82ad('0x12')](config['root'],'server/files/sounds/original/'));},'filename':function(_0x4dafea,_0x51fc52,_0x33ae5f){_0x51fc52[_0x82ad('0x13')]=_0x51fc52['originalname'][_0x82ad('0x14')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x33ae5f(null,util[_0x82ad('0x15')](_0x82ad('0x16'),path[_0x82ad('0x17')](_0x51fc52[_0x82ad('0x13')],path['extname'](_0x51fc52[_0x82ad('0x13')])),Date[_0x82ad('0x18')](),path['extname'](_0x51fc52[_0x82ad('0x13')])));}})});router['post']('/',upload[_0x82ad('0x19')](_0x82ad('0x1a')),controller[_0x82ad('0x1b')]);router[_0x82ad('0x1c')]('/:id',auth[_0x82ad('0xb')](),controller['update']);router['delete'](_0x82ad('0xd'),auth[_0x82ad('0xb')](),controller[_0x82ad('0x1d')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/sound/sound.attributes.js b/server/api/sound/sound.attributes.js index 621ee2e..21e9953 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 _0x9f7c=['BIGINT','sequelize','STRING','FLOAT','INTEGER'];(function(_0x1f9e89,_0x2143d3){var _0x571079=function(_0x47f2b3){while(--_0x47f2b3){_0x1f9e89['push'](_0x1f9e89['shift']());}};_0x571079(++_0x2143d3);}(_0x9f7c,0x119));var _0xc9f7=function(_0x454c10,_0x1e525c){_0x454c10=_0x454c10-0x0;var _0x1fd1d9=_0x9f7c[_0x454c10];return _0x1fd1d9;};'use strict';var Sequelize=require(_0xc9f7('0x0'));module['exports']={'name':{'type':Sequelize[_0xc9f7('0x1')],'unique':'name','allowNull':![]},'save_name':{'type':Sequelize['STRING']},'display_name':{'type':Sequelize[_0xc9f7('0x1')],'defaultValue':''},'description':{'type':Sequelize[_0xc9f7('0x1')]},'original_format':{'type':Sequelize['STRING']},'original_duration':{'type':Sequelize[_0xc9f7('0x2')]},'original_sampleCount':{'type':Sequelize['BIGINT']},'original_channelCount':{'type':Sequelize[_0xc9f7('0x3')]},'original_bitRate':{'type':Sequelize[_0xc9f7('0x4')]},'original_sampleRate':{'type':Sequelize['INTEGER']},'converted_format':{'type':Sequelize[_0xc9f7('0x1')]},'converted_duration':{'type':Sequelize[_0xc9f7('0x2')]},'converted_sampleCount':{'type':Sequelize['BIGINT']},'converted_channelCount':{'type':Sequelize['INTEGER']},'converted_bitRate':{'type':Sequelize[_0xc9f7('0x4')]},'converted_sampleRate':{'type':Sequelize[_0xc9f7('0x3')]}}; \ No newline at end of file +var _0xb465=['FLOAT','INTEGER','BIGINT','exports','STRING','name'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xb465,0x9f));var _0x5b46=function(_0x1c273d,_0x42046e){_0x1c273d=_0x1c273d-0x0;var _0x3974cd=_0xb465[_0x1c273d];return _0x3974cd;};'use strict';var Sequelize=require('sequelize');module[_0x5b46('0x0')]={'name':{'type':Sequelize[_0x5b46('0x1')],'unique':_0x5b46('0x2'),'allowNull':![]},'save_name':{'type':Sequelize[_0x5b46('0x1')]},'display_name':{'type':Sequelize[_0x5b46('0x1')],'defaultValue':''},'description':{'type':Sequelize[_0x5b46('0x1')]},'original_format':{'type':Sequelize[_0x5b46('0x1')]},'original_duration':{'type':Sequelize[_0x5b46('0x3')]},'original_sampleCount':{'type':Sequelize['BIGINT']},'original_channelCount':{'type':Sequelize['INTEGER']},'original_bitRate':{'type':Sequelize['BIGINT']},'original_sampleRate':{'type':Sequelize[_0x5b46('0x4')]},'converted_format':{'type':Sequelize['STRING']},'converted_duration':{'type':Sequelize[_0x5b46('0x3')]},'converted_sampleCount':{'type':Sequelize[_0x5b46('0x5')]},'converted_channelCount':{'type':Sequelize[_0x5b46('0x4')]},'converted_bitRate':{'type':Sequelize[_0x5b46('0x5')]},'converted_sampleRate':{'type':Sequelize[_0x5b46('0x4')]}}; \ No newline at end of file diff --git a/server/api/sound/sound.controller.js b/server/api/sound/sound.controller.js index 7e9cee6..02ad815 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 _0xe96a=['undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','Sounds','UserProfileResource','error','name','send','index','map','rawAttributes','fieldName','key','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','options','Sound','includeAll','rows','params','include','find','catch','download','save_name','existsSync','join','server/files/sounds/converted','converted_format','Sequelize','ValidationError','Sound\x20not\x20found','root','format','%s.%s','basename','file','extname','originalname','filename','substring','wav','Sound\x20upload\x20filepath:\x20%s','chmodSync','0777','transcode','unlinkSync','src','original_duration','duration','sampleCount','original_channelCount','channelCount','original_bitRate','bitRate','original_sampleRate','dest','converted_duration','converted_sampleCount','converted_channelCount','converted_bitRate','sampleRate','create','role','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','get','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','start','body','description','delete','server/files/sounds/original','original_format','eml-format','rimraf','fast-json-patch','request-promise','moment','util','path','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset'];(function(_0x147331,_0x3c2a32){var _0x5524fb=function(_0x2b5c4a){while(--_0x2b5c4a){_0x147331['push'](_0x147331['shift']());}};_0x5524fb(++_0x3c2a32);}(_0xe96a,0x1e6));var _0xae96=function(_0x102f97,_0x5bda2f){_0x102f97=_0x102f97-0x0;var _0xd22058=_0xe96a[_0x102f97];return _0xd22058;};'use strict';var emlformat=require(_0xae96('0x0'));var rimraf=require(_0xae96('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xae96('0x2'));var rp=require(_0xae96('0x3'));var moment=require(_0xae96('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xae96('0x5'));var path=require(_0xae96('0x6'));var sox=require(_0xae96('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xae96('0x8'));var _=require(_0xae96('0x9'));var squel=require(_0xae96('0xa'));var crypto=require(_0xae96('0xb'));var jsforce=require(_0xae96('0xc'));var deskjs=require(_0xae96('0xd'));var toCsv=require(_0xae96('0xe'));var querystring=require(_0xae96('0xf'));var Papa=require('papaparse');var Redis=require(_0xae96('0x10'));var authService=require(_0xae96('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xae96('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xae96('0x13'))(_0xae96('0x14'));var utils=require(_0xae96('0x15'));var config=require(_0xae96('0x16'));var licenseUtil=require(_0xae96('0x17'));var db=require(_0xae96('0x18'))['db'];function respondWithStatusCode(_0x42d6e2,_0x1eee3c){_0x1eee3c=_0x1eee3c||0xcc;return function(_0x1f20d0){if(_0x1f20d0){return _0x42d6e2[_0xae96('0x19')](_0x1eee3c);}return _0x42d6e2[_0xae96('0x1a')](_0x1eee3c)[_0xae96('0x1b')]();};}function respondWithResult(_0x422262,_0x7c16a4){_0x7c16a4=_0x7c16a4||0xc8;return function(_0x522e29){if(_0x522e29){return _0x422262[_0xae96('0x1a')](_0x7c16a4)[_0xae96('0x1c')](_0x522e29);}};}function respondWithFilteredResult(_0x1df994,_0x4b065e){return function(_0x1bb1d0){if(_0x1bb1d0){var _0x1b233e=typeof _0x4b065e[_0xae96('0x1d')]===_0xae96('0x1e')&&typeof _0x4b065e[_0xae96('0x1f')]==='undefined';var _0x58438c=_0x1bb1d0[_0xae96('0x20')];var _0x4b8fe8=_0x1b233e?0x0:_0x4b065e['offset'];var _0x47de6c=_0x1b233e?_0x1bb1d0['count']:_0x4b065e[_0xae96('0x1d')]+_0x4b065e[_0xae96('0x1f')];var _0x255c4f;if(_0x47de6c>=_0x58438c){_0x47de6c=_0x58438c;_0x255c4f=0xc8;}else{_0x255c4f=0xce;}_0x1df994[_0xae96('0x1a')](_0x255c4f);return _0x1df994[_0xae96('0x21')](_0xae96('0x22'),_0x4b8fe8+'-'+_0x47de6c+'/'+_0x58438c)[_0xae96('0x1c')](_0x1bb1d0);}return null;};}function patchUpdates(_0x43e5e3){return function(_0x839e2d){try{jsonpatch[_0xae96('0x23')](_0x839e2d,_0x43e5e3,!![]);}catch(_0x51855c){return BPromise[_0xae96('0x24')](_0x51855c);}return _0x839e2d[_0xae96('0x25')]();};}function saveUpdates(_0x163e80,_0x1a8fc7){return function(_0x3b606b){if(_0x3b606b){return _0x3b606b[_0xae96('0x26')](_0x163e80)[_0xae96('0x27')](function(_0x5b1457){return _0x5b1457;});}return null;};}function removeEntity(_0x16b1bb,_0x4bdb3c){return function(_0x45bd16){if(_0x45bd16){return _0x45bd16[_0xae96('0x28')]()[_0xae96('0x27')](function(){var _0x2ee0a1=_0x45bd16['get']({'plain':!![]});var _0x4b9900=_0xae96('0x29');return db[_0xae96('0x2a')][_0xae96('0x28')]({'where':{'type':_0x4b9900,'resourceId':_0x2ee0a1['id']}})[_0xae96('0x27')](function(){return _0x45bd16;});})[_0xae96('0x27')](function(){_0x16b1bb['status'](0xcc)[_0xae96('0x1b')]();});}};}function handleEntityNotFound(_0x3d4ba6,_0x45d350){return function(_0x1d13d2){if(!_0x1d13d2){_0x3d4ba6['sendStatus'](0x194);}return _0x1d13d2;};}function handleError(_0x2ce8ed,_0x580c28){_0x580c28=_0x580c28||0x1f4;return function(_0x4e6994){logger[_0xae96('0x2b')](_0x4e6994['stack']);if(_0x4e6994[_0xae96('0x2c')]){delete _0x4e6994['name'];}_0x2ce8ed[_0xae96('0x1a')](_0x580c28)[_0xae96('0x2d')](_0x4e6994);};}exports[_0xae96('0x2e')]=function(_0x469558,_0x6f9d69){var _0x498f47={},_0x9d7ab2={},_0x8f2793={'count':0x0,'rows':[]};var _0x1e0e21=_[_0xae96('0x2f')](db['Sound'][_0xae96('0x30')],function(_0x1d6091){return{'name':_0x1d6091[_0xae96('0x31')],'type':_0x1d6091['type'][_0xae96('0x32')]};});_0x9d7ab2['model']=_['map'](_0x1e0e21,_0xae96('0x2c'));_0x9d7ab2[_0xae96('0x33')]=_[_0xae96('0x34')](_0x469558[_0xae96('0x33')]);_0x9d7ab2[_0xae96('0x35')]=_['intersection'](_0x9d7ab2[_0xae96('0x36')],_0x9d7ab2['query']);_0x498f47[_0xae96('0x37')]=_[_0xae96('0x38')](_0x9d7ab2[_0xae96('0x36')],qs[_0xae96('0x39')](_0x469558[_0xae96('0x33')]['fields']));_0x498f47[_0xae96('0x37')]=_0x498f47[_0xae96('0x37')][_0xae96('0x3a')]?_0x498f47[_0xae96('0x37')]:_0x9d7ab2['model'];if(!_0x469558[_0xae96('0x33')][_0xae96('0x3b')](_0xae96('0x3c'))){_0x498f47[_0xae96('0x1f')]=qs[_0xae96('0x1f')](_0x469558[_0xae96('0x33')][_0xae96('0x1f')]);_0x498f47[_0xae96('0x1d')]=qs[_0xae96('0x1d')](_0x469558[_0xae96('0x33')]['offset']);}_0x498f47[_0xae96('0x3d')]=qs['sort'](_0x469558[_0xae96('0x33')][_0xae96('0x3e')]);_0x498f47[_0xae96('0x3f')]=qs[_0xae96('0x35')](_[_0xae96('0x40')](_0x469558[_0xae96('0x33')],_0x9d7ab2[_0xae96('0x35')]),_0x1e0e21);if(_0x469558['query'][_0xae96('0x41')]){_0x498f47[_0xae96('0x3f')]=_[_0xae96('0x42')](_0x498f47[_0xae96('0x3f')],{'$or':_[_0xae96('0x2f')](_0x1e0e21,function(_0x479c12){if(_0x479c12[_0xae96('0x43')]!=='VIRTUAL'){var _0x300621={};_0x300621[_0x479c12[_0xae96('0x2c')]]={'$like':'%'+_0x469558['query'][_0xae96('0x41')]+'%'};return _0x300621;}})});}_0x498f47=_[_0xae96('0x42')]({},_0x498f47,_0x469558[_0xae96('0x44')]);var _0x370a6e={'where':_0x498f47['where']};return db[_0xae96('0x45')][_0xae96('0x20')](_0x370a6e)[_0xae96('0x27')](function(_0x14b991){_0x8f2793[_0xae96('0x20')]=_0x14b991;if(_0x469558[_0xae96('0x33')][_0xae96('0x46')]){_0x498f47['include']=[{'all':!![]}];}return db['Sound']['findAll'](_0x498f47);})[_0xae96('0x27')](function(_0x24cacc){_0x8f2793[_0xae96('0x47')]=_0x24cacc;return _0x8f2793;})['then'](respondWithFilteredResult(_0x6f9d69,_0x498f47))['catch'](handleError(_0x6f9d69,null));};exports['show']=function(_0x2446a8,_0x3878a7){var _0x4f43b0={'raw':!![],'where':{'id':_0x2446a8[_0xae96('0x48')]['id']}},_0x582ffc={};_0x582ffc['model']=_['keys'](db[_0xae96('0x45')][_0xae96('0x30')]);_0x582ffc[_0xae96('0x33')]=_[_0xae96('0x34')](_0x2446a8['query']);_0x582ffc[_0xae96('0x35')]=_[_0xae96('0x38')](_0x582ffc['model'],_0x582ffc[_0xae96('0x33')]);_0x4f43b0['attributes']=_[_0xae96('0x38')](_0x582ffc[_0xae96('0x36')],qs[_0xae96('0x39')](_0x2446a8[_0xae96('0x33')][_0xae96('0x39')]));_0x4f43b0['attributes']=_0x4f43b0[_0xae96('0x37')][_0xae96('0x3a')]?_0x4f43b0[_0xae96('0x37')]:_0x582ffc[_0xae96('0x36')];if(_0x2446a8[_0xae96('0x33')][_0xae96('0x46')]){_0x4f43b0[_0xae96('0x49')]=[{'all':!![]}];}_0x4f43b0=_['merge']({},_0x4f43b0,_0x2446a8[_0xae96('0x44')]);return db[_0xae96('0x45')][_0xae96('0x4a')](_0x4f43b0)[_0xae96('0x27')](handleEntityNotFound(_0x3878a7,null))['then'](respondWithResult(_0x3878a7,null))[_0xae96('0x4b')](handleError(_0x3878a7,null));};exports[_0xae96('0x4c')]=function(_0x16f0e6,_0x1eda46,_0x2c18a5){return db['Sound'][_0xae96('0x4a')]({'where':{'id':_0x16f0e6['params']['id']},'attributes':[_0xae96('0x2c'),_0xae96('0x4d'),'converted_format'],'raw':!![]})[_0xae96('0x27')](handleEntityNotFound(_0x1eda46,null))[_0xae96('0x27')](function(_0x2ae107){if(_0x2ae107){if(!fs[_0xae96('0x4e')](path[_0xae96('0x4f')](config['root'],_0xae96('0x50'),_0x2ae107['save_name']+'.'+_0x2ae107[_0xae96('0x51')]))){throw new db[(_0xae96('0x52'))][(_0xae96('0x53'))](_0xae96('0x54'));}return _0x1eda46[_0xae96('0x4c')](path['join'](config[_0xae96('0x55')],_0xae96('0x50'),util[_0xae96('0x56')](_0xae96('0x57'),_0x2ae107[_0xae96('0x4d')],_0x2ae107[_0xae96('0x51')])),util['format']('%s.%s',_0x2ae107[_0xae96('0x2c')],_0x2ae107[_0xae96('0x51')]));}return null;})['catch'](handleError(_0x1eda46,null));};exports['create']=function(_0x56048a,_0x48ad06,_0x5dad8e){var _0xed2f8b={'name':path[_0xae96('0x58')](_0x56048a[_0xae96('0x59')]['originalname'],path[_0xae96('0x5a')](_0x56048a[_0xae96('0x59')][_0xae96('0x5b')])),'save_name':path[_0xae96('0x58')](_0x56048a['file'][_0xae96('0x5c')],path[_0xae96('0x5a')](_0x56048a[_0xae96('0x59')][_0xae96('0x5c')])),'original_format':path[_0xae96('0x5a')](_0x56048a['file']['originalname'])[_0xae96('0x5d')](0x1),'converted_format':_0xae96('0x5e')};var _0x3484d3=path['join'](config[_0xae96('0x55')],'server/files/sounds/original',_0x56048a['file'][_0xae96('0x5c')]);var _0x2e24f2=path[_0xae96('0x4f')](config[_0xae96('0x55')],_0xae96('0x50'),util['format']('%s.%s',path['basename'](_0x56048a[_0xae96('0x59')]['filename'],path['extname'](_0x56048a[_0xae96('0x59')][_0xae96('0x5c')])),_0xed2f8b['converted_format']));logger['info'](_0xae96('0x5f'),_0x3484d3);logger['info']('Sound\x20upload\x20destination:\x20%s',_0x2e24f2);try{fs[_0xae96('0x60')](_0x3484d3,parseInt(_0xae96('0x61'),0x8));var _0x1d0b59=sox[_0xae96('0x62')](_0x3484d3,_0x2e24f2,{'sampleRate':0x1f40,'format':_0xae96('0x5e'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x1d0b59['on'](_0xae96('0x2b'),function(_0x340cd5){fs[_0xae96('0x63')](_0x3484d3);_0x48ad06[_0xae96('0x1a')](0x1f4)[_0xae96('0x2d')](_0x340cd5);});_0x1d0b59['on'](_0xae96('0x64'),function(_0x2d51bb){_0xed2f8b[_0xae96('0x65')]=isNaN(_0x2d51bb[_0xae96('0x66')])?null:_0x2d51bb['duration']*0x3e8;_0xed2f8b['original_sampleCount']=isNaN(_0x2d51bb[_0xae96('0x67')])?null:_0x2d51bb['sampleCount'];_0xed2f8b[_0xae96('0x68')]=isNaN(_0x2d51bb[_0xae96('0x69')])?null:_0x2d51bb[_0xae96('0x69')];_0xed2f8b[_0xae96('0x6a')]=isNaN(_0x2d51bb[_0xae96('0x6b')])?null:_0x2d51bb['bitRate'];_0xed2f8b[_0xae96('0x6c')]=isNaN(_0x2d51bb['sampleRate'])?null:_0x2d51bb['sampleRate'];});_0x1d0b59['on'](_0xae96('0x6d'),function(_0x54dbf9){_0xed2f8b[_0xae96('0x6e')]=isNaN(_0x54dbf9['duration'])?null:_0x54dbf9[_0xae96('0x66')]*0x3e8;_0xed2f8b[_0xae96('0x6f')]=isNaN(_0x54dbf9[_0xae96('0x67')])?null:_0x54dbf9[_0xae96('0x67')];_0xed2f8b[_0xae96('0x70')]=isNaN(_0x54dbf9[_0xae96('0x69')])?null:_0x54dbf9[_0xae96('0x69')];_0xed2f8b[_0xae96('0x71')]=isNaN(_0x54dbf9[_0xae96('0x6b')])?null:_0x54dbf9[_0xae96('0x6b')];_0xed2f8b['converted_sampleRate']=isNaN(_0x54dbf9[_0xae96('0x72')])?null:_0x54dbf9[_0xae96('0x72')];});_0x1d0b59['on'](_0xae96('0x1b'),function(){fs['chmodSync'](_0x2e24f2,parseInt('0777',0x8));return db[_0xae96('0x45')][_0xae96('0x73')](_0xed2f8b)['then'](function(_0x16516c){var _0x52793e={'role':_0x56048a['body'][_0xae96('0x74')],'userProfileId':_0x56048a['body'][_0xae96('0x75')]};if(!_0x52793e)throw new Error(_0xae96('0x76'));if(_0x52793e['role']===_0xae96('0x77')){var _0x349ee1=_0x16516c[_0xae96('0x78')]({'plain':!![]});return db['UserProfileSection']['find']({'where':{'name':_0xae96('0x29'),'userProfileId':_0x52793e[_0xae96('0x75')]},'raw':!![]})[_0xae96('0x27')](function(_0x4f916a){if(_0x4f916a&&_0x4f916a[_0xae96('0x79')]===0x0){return db[_0xae96('0x2a')][_0xae96('0x73')]({'name':_0x349ee1[_0xae96('0x2c')],'resourceId':_0x349ee1['id'],'type':_0x4f916a[_0xae96('0x2c')],'sectionId':_0x4f916a['id']},{})[_0xae96('0x27')](function(){return _0x16516c;});}else{return _0x16516c;}})[_0xae96('0x4b')](function(_0x4138bb){logger[_0xae96('0x2b')](_0xae96('0x7a'),_0x4138bb);throw _0x4138bb;});}return _0x16516c;})['then'](respondWithResult(_0x48ad06,null))['catch'](handleError(_0x48ad06,null));});_0x1d0b59[_0xae96('0x7b')]();}catch(_0x534e1b){_0x48ad06['status'](0x1f4)[_0xae96('0x2d')](_0x534e1b);}};exports[_0xae96('0x26')]=function(_0x480977,_0x14bf28,_0x3840fb){return db[_0xae96('0x45')][_0xae96('0x4a')]({'where':{'id':_0x480977[_0xae96('0x48')]['id']}})[_0xae96('0x27')](handleEntityNotFound(_0x14bf28,null))['then'](saveUpdates(_[_0xae96('0x40')](_0x480977[_0xae96('0x7c')],[_0xae96('0x2c'),_0xae96('0x7d')]),null))[_0xae96('0x27')](respondWithResult(_0x14bf28,null))[_0xae96('0x4b')](handleError(_0x14bf28,null));};exports[_0xae96('0x7e')]=function(_0x5b2c8a,_0x554e49,_0x3d5e8c){return db[_0xae96('0x45')][_0xae96('0x4a')]({'where':{'id':_0x5b2c8a['params']['id']}})[_0xae96('0x27')](function(_0x6d1a0b){if(_0x6d1a0b){return _0x6d1a0b['destroy']();}})[_0xae96('0x27')](function(_0x31f101){var _0x51bd25=path[_0xae96('0x4f')](config[_0xae96('0x55')],_0xae96('0x7f'),util[_0xae96('0x56')](_0xae96('0x57'),_0x31f101[_0xae96('0x4d')],_0x31f101[_0xae96('0x80')]));var _0x4f08ee=path[_0xae96('0x4f')](config[_0xae96('0x55')],'server/files/sounds/converted',util[_0xae96('0x56')](_0xae96('0x57'),_0x31f101[_0xae96('0x4d')],_0x31f101[_0xae96('0x51')]));fs[_0xae96('0x63')](_0x51bd25);fs[_0xae96('0x63')](_0x4f08ee);return _0x31f101;})[_0xae96('0x27')](function(_0x49d47e){if(_0x49d47e){return _0x554e49[_0xae96('0x1a')](0xcc)[_0xae96('0x1b')]();}})[_0xae96('0x27')](handleEntityNotFound(_0x554e49,null))[_0xae96('0x4b')](handleError(_0x554e49,null));}; \ No newline at end of file +var _0xe210=['error','src','original_duration','duration','original_sampleCount','sampleCount','original_channelCount','channelCount','original_bitRate','bitRate','original_sampleRate','sampleRate','dest','converted_sampleCount','converted_bitRate','converted_sampleRate','body','role','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','autoAssociation','start','description','delete','server/files/sounds/original','original_format','unlinkSync','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','ejs','fs-extra','lodash','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','limit','count','set','Content-Range','reject','update','then','destroy','get','Sounds','UserProfileResource','end','name','send','index','map','Sound','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','merge','options','where','include','findAll','rows','catch','show','params','includeAll','find','save_name','existsSync','join','root','server/files/sounds/converted','converted_format','Sequelize','ValidationError','download','%s.%s','format','create','extname','file','filename','originalname','substring','wav','basename','info','Sound\x20upload\x20filepath:\x20%s','Sound\x20upload\x20destination:\x20%s','chmodSync','0777','transcode'];(function(_0x302aaf,_0x1ab784){var _0x2bedb9=function(_0x41773d){while(--_0x41773d){_0x302aaf['push'](_0x302aaf['shift']());}};_0x2bedb9(++_0x1ab784);}(_0xe210,0x196));var _0x0e21=function(_0x50aa2e,_0xfbd6f0){_0x50aa2e=_0x50aa2e-0x0;var _0x5e07f0=_0xe210[_0x50aa2e];return _0x5e07f0;};'use strict';var emlformat=require(_0x0e21('0x0'));var rimraf=require(_0x0e21('0x1'));var zipdir=require(_0x0e21('0x2'));var jsonpatch=require(_0x0e21('0x3'));var rp=require('request-promise');var moment=require(_0x0e21('0x4'));var BPromise=require(_0x0e21('0x5'));var Mustache=require(_0x0e21('0x6'));var util=require(_0x0e21('0x7'));var path=require(_0x0e21('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x0e21('0x9'));var fs=require('fs');var fs_extra=require(_0x0e21('0xa'));var _=require(_0x0e21('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x0e21('0xc'));var deskjs=require(_0x0e21('0xd'));var toCsv=require('to-csv');var querystring=require(_0x0e21('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x0e21('0xf'));var qs=require(_0x0e21('0x10'));var as=require(_0x0e21('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0e21('0x12'))(_0x0e21('0x13'));var utils=require(_0x0e21('0x14'));var config=require(_0x0e21('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x0e21('0x16'))['db'];function respondWithStatusCode(_0xeb297f,_0x707dc){_0x707dc=_0x707dc||0xcc;return function(_0x498dd4){if(_0x498dd4){return _0xeb297f[_0x0e21('0x17')](_0x707dc);}return _0xeb297f[_0x0e21('0x18')](_0x707dc)['end']();};}function respondWithResult(_0x51938f,_0x26234a){_0x26234a=_0x26234a||0xc8;return function(_0x4f2847){if(_0x4f2847){return _0x51938f[_0x0e21('0x18')](_0x26234a)[_0x0e21('0x19')](_0x4f2847);}};}function respondWithFilteredResult(_0x12604e,_0x54d0d2){return function(_0x5c6a23){if(_0x5c6a23){var _0x1c5e77=typeof _0x54d0d2[_0x0e21('0x1a')]==='undefined'&&typeof _0x54d0d2[_0x0e21('0x1b')]==='undefined';var _0x248c50=_0x5c6a23[_0x0e21('0x1c')];var _0x23e4a8=_0x1c5e77?0x0:_0x54d0d2['offset'];var _0x286cf0=_0x1c5e77?_0x5c6a23['count']:_0x54d0d2['offset']+_0x54d0d2[_0x0e21('0x1b')];var _0x34954c;if(_0x286cf0>=_0x248c50){_0x286cf0=_0x248c50;_0x34954c=0xc8;}else{_0x34954c=0xce;}_0x12604e[_0x0e21('0x18')](_0x34954c);return _0x12604e[_0x0e21('0x1d')](_0x0e21('0x1e'),_0x23e4a8+'-'+_0x286cf0+'/'+_0x248c50)[_0x0e21('0x19')](_0x5c6a23);}return null;};}function patchUpdates(_0x51f01c){return function(_0x343c55){try{jsonpatch['apply'](_0x343c55,_0x51f01c,!![]);}catch(_0xeb1132){return BPromise[_0x0e21('0x1f')](_0xeb1132);}return _0x343c55['save']();};}function saveUpdates(_0x400127,_0x289445){return function(_0x5e5c19){if(_0x5e5c19){return _0x5e5c19[_0x0e21('0x20')](_0x400127)[_0x0e21('0x21')](function(_0x3c7960){return _0x3c7960;});}return null;};}function removeEntity(_0x17b20a,_0x345c28){return function(_0x3c315f){if(_0x3c315f){return _0x3c315f[_0x0e21('0x22')]()[_0x0e21('0x21')](function(){var _0x2cea09=_0x3c315f[_0x0e21('0x23')]({'plain':!![]});var _0x43b753=_0x0e21('0x24');return db[_0x0e21('0x25')][_0x0e21('0x22')]({'where':{'type':_0x43b753,'resourceId':_0x2cea09['id']}})['then'](function(){return _0x3c315f;});})['then'](function(){_0x17b20a['status'](0xcc)[_0x0e21('0x26')]();});}};}function handleEntityNotFound(_0x410cda,_0x44cb3f){return function(_0x574c14){if(!_0x574c14){_0x410cda[_0x0e21('0x17')](0x194);}return _0x574c14;};}function handleError(_0x26cbf3,_0x21226e){_0x21226e=_0x21226e||0x1f4;return function(_0x56451f){logger['error'](_0x56451f['stack']);if(_0x56451f[_0x0e21('0x27')]){delete _0x56451f['name'];}_0x26cbf3[_0x0e21('0x18')](_0x21226e)[_0x0e21('0x28')](_0x56451f);};}exports[_0x0e21('0x29')]=function(_0x57f328,_0x8437c5){var _0x13fc0b={},_0x897e0={},_0x5030b1={'count':0x0,'rows':[]};var _0x51eeb5=_[_0x0e21('0x2a')](db[_0x0e21('0x2b')][_0x0e21('0x2c')],function(_0x12eb0b){return{'name':_0x12eb0b[_0x0e21('0x2d')],'type':_0x12eb0b[_0x0e21('0x2e')][_0x0e21('0x2f')]};});_0x897e0[_0x0e21('0x30')]=_[_0x0e21('0x2a')](_0x51eeb5,_0x0e21('0x27'));_0x897e0[_0x0e21('0x31')]=_[_0x0e21('0x32')](_0x57f328['query']);_0x897e0['filters']=_[_0x0e21('0x33')](_0x897e0[_0x0e21('0x30')],_0x897e0[_0x0e21('0x31')]);_0x13fc0b[_0x0e21('0x34')]=_[_0x0e21('0x33')](_0x897e0['model'],qs[_0x0e21('0x35')](_0x57f328[_0x0e21('0x31')][_0x0e21('0x35')]));_0x13fc0b['attributes']=_0x13fc0b[_0x0e21('0x34')][_0x0e21('0x36')]?_0x13fc0b[_0x0e21('0x34')]:_0x897e0[_0x0e21('0x30')];if(!_0x57f328[_0x0e21('0x31')][_0x0e21('0x37')](_0x0e21('0x38'))){_0x13fc0b[_0x0e21('0x1b')]=qs['limit'](_0x57f328[_0x0e21('0x31')][_0x0e21('0x1b')]);_0x13fc0b[_0x0e21('0x1a')]=qs[_0x0e21('0x1a')](_0x57f328[_0x0e21('0x31')][_0x0e21('0x1a')]);}_0x13fc0b[_0x0e21('0x39')]=qs[_0x0e21('0x3a')](_0x57f328[_0x0e21('0x31')][_0x0e21('0x3a')]);_0x13fc0b['where']=qs[_0x0e21('0x3b')](_[_0x0e21('0x3c')](_0x57f328['query'],_0x897e0[_0x0e21('0x3b')]),_0x51eeb5);if(_0x57f328[_0x0e21('0x31')][_0x0e21('0x3d')]){_0x13fc0b['where']=_[_0x0e21('0x3e')](_0x13fc0b['where'],{'$or':_[_0x0e21('0x2a')](_0x51eeb5,function(_0x226a8c){if(_0x226a8c[_0x0e21('0x2e')]!=='VIRTUAL'){var _0x45c1dd={};_0x45c1dd[_0x226a8c[_0x0e21('0x27')]]={'$like':'%'+_0x57f328[_0x0e21('0x31')][_0x0e21('0x3d')]+'%'};return _0x45c1dd;}})});}_0x13fc0b=_['merge']({},_0x13fc0b,_0x57f328[_0x0e21('0x3f')]);var _0xa1e0bc={'where':_0x13fc0b[_0x0e21('0x40')]};return db[_0x0e21('0x2b')][_0x0e21('0x1c')](_0xa1e0bc)[_0x0e21('0x21')](function(_0x1116e3){_0x5030b1['count']=_0x1116e3;if(_0x57f328[_0x0e21('0x31')]['includeAll']){_0x13fc0b[_0x0e21('0x41')]=[{'all':!![]}];}return db[_0x0e21('0x2b')][_0x0e21('0x42')](_0x13fc0b);})[_0x0e21('0x21')](function(_0x5d06f8){_0x5030b1[_0x0e21('0x43')]=_0x5d06f8;return _0x5030b1;})[_0x0e21('0x21')](respondWithFilteredResult(_0x8437c5,_0x13fc0b))[_0x0e21('0x44')](handleError(_0x8437c5,null));};exports[_0x0e21('0x45')]=function(_0x2c937f,_0x2d672e){var _0x3b49ad={'raw':!![],'where':{'id':_0x2c937f[_0x0e21('0x46')]['id']}},_0x143ac0={};_0x143ac0[_0x0e21('0x30')]=_[_0x0e21('0x32')](db['Sound'][_0x0e21('0x2c')]);_0x143ac0[_0x0e21('0x31')]=_['keys'](_0x2c937f[_0x0e21('0x31')]);_0x143ac0[_0x0e21('0x3b')]=_['intersection'](_0x143ac0[_0x0e21('0x30')],_0x143ac0['query']);_0x3b49ad[_0x0e21('0x34')]=_[_0x0e21('0x33')](_0x143ac0[_0x0e21('0x30')],qs[_0x0e21('0x35')](_0x2c937f[_0x0e21('0x31')][_0x0e21('0x35')]));_0x3b49ad[_0x0e21('0x34')]=_0x3b49ad['attributes'][_0x0e21('0x36')]?_0x3b49ad[_0x0e21('0x34')]:_0x143ac0['model'];if(_0x2c937f[_0x0e21('0x31')][_0x0e21('0x47')]){_0x3b49ad['include']=[{'all':!![]}];}_0x3b49ad=_[_0x0e21('0x3e')]({},_0x3b49ad,_0x2c937f[_0x0e21('0x3f')]);return db[_0x0e21('0x2b')][_0x0e21('0x48')](_0x3b49ad)[_0x0e21('0x21')](handleEntityNotFound(_0x2d672e,null))[_0x0e21('0x21')](respondWithResult(_0x2d672e,null))[_0x0e21('0x44')](handleError(_0x2d672e,null));};exports['download']=function(_0x1ce2f3,_0xc25cda,_0x399a31){return db[_0x0e21('0x2b')]['find']({'where':{'id':_0x1ce2f3[_0x0e21('0x46')]['id']},'attributes':[_0x0e21('0x27'),_0x0e21('0x49'),'converted_format'],'raw':!![]})['then'](handleEntityNotFound(_0xc25cda,null))[_0x0e21('0x21')](function(_0x1ec2de){if(_0x1ec2de){if(!fs[_0x0e21('0x4a')](path[_0x0e21('0x4b')](config[_0x0e21('0x4c')],_0x0e21('0x4d'),_0x1ec2de[_0x0e21('0x49')]+'.'+_0x1ec2de[_0x0e21('0x4e')]))){throw new db[(_0x0e21('0x4f'))][(_0x0e21('0x50'))]('Sound\x20not\x20found');}return _0xc25cda[_0x0e21('0x51')](path[_0x0e21('0x4b')](config[_0x0e21('0x4c')],_0x0e21('0x4d'),util['format'](_0x0e21('0x52'),_0x1ec2de[_0x0e21('0x49')],_0x1ec2de['converted_format'])),util[_0x0e21('0x53')](_0x0e21('0x52'),_0x1ec2de[_0x0e21('0x27')],_0x1ec2de[_0x0e21('0x4e')]));}return null;})[_0x0e21('0x44')](handleError(_0xc25cda,null));};exports[_0x0e21('0x54')]=function(_0x414654,_0x13c160,_0x5dbbae){var _0xaee8c2={'name':path['basename'](_0x414654['file']['originalname'],path[_0x0e21('0x55')](_0x414654[_0x0e21('0x56')]['originalname'])),'save_name':path['basename'](_0x414654[_0x0e21('0x56')]['filename'],path['extname'](_0x414654[_0x0e21('0x56')][_0x0e21('0x57')])),'original_format':path[_0x0e21('0x55')](_0x414654[_0x0e21('0x56')][_0x0e21('0x58')])[_0x0e21('0x59')](0x1),'converted_format':_0x0e21('0x5a')};var _0x139f50=path[_0x0e21('0x4b')](config[_0x0e21('0x4c')],'server/files/sounds/original',_0x414654[_0x0e21('0x56')]['filename']);var _0x5c2761=path[_0x0e21('0x4b')](config[_0x0e21('0x4c')],_0x0e21('0x4d'),util[_0x0e21('0x53')](_0x0e21('0x52'),path[_0x0e21('0x5b')](_0x414654['file'][_0x0e21('0x57')],path[_0x0e21('0x55')](_0x414654['file'][_0x0e21('0x57')])),_0xaee8c2['converted_format']));logger[_0x0e21('0x5c')](_0x0e21('0x5d'),_0x139f50);logger[_0x0e21('0x5c')](_0x0e21('0x5e'),_0x5c2761);try{fs[_0x0e21('0x5f')](_0x139f50,parseInt(_0x0e21('0x60'),0x8));var _0x4572d7=sox[_0x0e21('0x61')](_0x139f50,_0x5c2761,{'sampleRate':0x1f40,'format':'wav','channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x4572d7['on'](_0x0e21('0x62'),function(_0x8643a6){fs['unlinkSync'](_0x139f50);_0x13c160[_0x0e21('0x18')](0x1f4)['send'](_0x8643a6);});_0x4572d7['on'](_0x0e21('0x63'),function(_0x5df254){_0xaee8c2[_0x0e21('0x64')]=isNaN(_0x5df254[_0x0e21('0x65')])?null:_0x5df254[_0x0e21('0x65')]*0x3e8;_0xaee8c2[_0x0e21('0x66')]=isNaN(_0x5df254[_0x0e21('0x67')])?null:_0x5df254[_0x0e21('0x67')];_0xaee8c2[_0x0e21('0x68')]=isNaN(_0x5df254[_0x0e21('0x69')])?null:_0x5df254[_0x0e21('0x69')];_0xaee8c2[_0x0e21('0x6a')]=isNaN(_0x5df254[_0x0e21('0x6b')])?null:_0x5df254[_0x0e21('0x6b')];_0xaee8c2[_0x0e21('0x6c')]=isNaN(_0x5df254[_0x0e21('0x6d')])?null:_0x5df254[_0x0e21('0x6d')];});_0x4572d7['on'](_0x0e21('0x6e'),function(_0x201f0a){_0xaee8c2['converted_duration']=isNaN(_0x201f0a[_0x0e21('0x65')])?null:_0x201f0a['duration']*0x3e8;_0xaee8c2[_0x0e21('0x6f')]=isNaN(_0x201f0a[_0x0e21('0x67')])?null:_0x201f0a['sampleCount'];_0xaee8c2['converted_channelCount']=isNaN(_0x201f0a[_0x0e21('0x69')])?null:_0x201f0a['channelCount'];_0xaee8c2[_0x0e21('0x70')]=isNaN(_0x201f0a[_0x0e21('0x6b')])?null:_0x201f0a['bitRate'];_0xaee8c2[_0x0e21('0x71')]=isNaN(_0x201f0a['sampleRate'])?null:_0x201f0a[_0x0e21('0x6d')];});_0x4572d7['on'](_0x0e21('0x26'),function(){fs['chmodSync'](_0x5c2761,parseInt(_0x0e21('0x60'),0x8));return db['Sound'][_0x0e21('0x54')](_0xaee8c2)[_0x0e21('0x21')](function(_0x514032){var _0x18b47f={'role':_0x414654[_0x0e21('0x72')][_0x0e21('0x73')],'userProfileId':_0x414654[_0x0e21('0x72')][_0x0e21('0x74')]};if(!_0x18b47f)throw new Error(_0x0e21('0x75'));if(_0x18b47f[_0x0e21('0x73')]==='user'){var _0x57009e=_0x514032['get']({'plain':!![]});return db[_0x0e21('0x76')][_0x0e21('0x48')]({'where':{'name':_0x0e21('0x24'),'userProfileId':_0x18b47f[_0x0e21('0x74')]},'raw':!![]})['then'](function(_0x2fb7a6){if(_0x2fb7a6&&_0x2fb7a6[_0x0e21('0x77')]===0x0){return db[_0x0e21('0x25')][_0x0e21('0x54')]({'name':_0x57009e[_0x0e21('0x27')],'resourceId':_0x57009e['id'],'type':_0x2fb7a6['name'],'sectionId':_0x2fb7a6['id']},{})[_0x0e21('0x21')](function(){return _0x514032;});}else{return _0x514032;}})['catch'](function(_0x361ebe){logger[_0x0e21('0x62')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x361ebe);throw _0x361ebe;});}return _0x514032;})['then'](respondWithResult(_0x13c160,null))[_0x0e21('0x44')](handleError(_0x13c160,null));});_0x4572d7[_0x0e21('0x78')]();}catch(_0x443e8b){_0x13c160['status'](0x1f4)[_0x0e21('0x28')](_0x443e8b);}};exports[_0x0e21('0x20')]=function(_0x11a8b3,_0x2bfe21,_0x51f74e){return db['Sound'][_0x0e21('0x48')]({'where':{'id':_0x11a8b3[_0x0e21('0x46')]['id']}})[_0x0e21('0x21')](handleEntityNotFound(_0x2bfe21,null))['then'](saveUpdates(_[_0x0e21('0x3c')](_0x11a8b3['body'],[_0x0e21('0x27'),_0x0e21('0x79')]),null))[_0x0e21('0x21')](respondWithResult(_0x2bfe21,null))[_0x0e21('0x44')](handleError(_0x2bfe21,null));};exports[_0x0e21('0x7a')]=function(_0x546f1b,_0x1ca4d7,_0x118c8){return db['Sound']['find']({'where':{'id':_0x546f1b[_0x0e21('0x46')]['id']}})[_0x0e21('0x21')](function(_0x443699){if(_0x443699){return _0x443699['destroy']();}})[_0x0e21('0x21')](function(_0x44cfc9){var _0x50dd9f=path[_0x0e21('0x4b')](config[_0x0e21('0x4c')],_0x0e21('0x7b'),util[_0x0e21('0x53')](_0x0e21('0x52'),_0x44cfc9[_0x0e21('0x49')],_0x44cfc9[_0x0e21('0x7c')]));var _0x213d48=path['join'](config[_0x0e21('0x4c')],_0x0e21('0x4d'),util[_0x0e21('0x53')](_0x0e21('0x52'),_0x44cfc9['save_name'],_0x44cfc9[_0x0e21('0x4e')]));fs['unlinkSync'](_0x50dd9f);fs[_0x0e21('0x7d')](_0x213d48);return _0x44cfc9;})[_0x0e21('0x21')](function(_0x27d7b0){if(_0x27d7b0){return _0x1ca4d7['status'](0xcc)[_0x0e21('0x26')]();}})['then'](handleEntityNotFound(_0x1ca4d7,null))[_0x0e21('0x44')](handleError(_0x1ca4d7,null));}; \ No newline at end of file diff --git a/server/api/sound/sound.model.js b/server/api/sound/sound.model.js index 2d08007..d1bf564 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 _0x34fb=['bluebird','request-promise','path','rimraf','../../config/environment','lodash','util','moment'];(function(_0x45ec35,_0x27778b){var _0xe7564b=function(_0x25dd02){while(--_0x25dd02){_0x45ec35['push'](_0x45ec35['shift']());}};_0xe7564b(++_0x27778b);}(_0x34fb,0xdd));var _0xb34f=function(_0xe67ee1,_0x317979){_0xe67ee1=_0xe67ee1-0x0;var _0x3b7d32=_0x34fb[_0xe67ee1];return _0x3b7d32;};'use strict';var _=require(_0xb34f('0x0'));var util=require(_0xb34f('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xb34f('0x2'));var BPromise=require(_0xb34f('0x3'));var rp=require(_0xb34f('0x4'));var fs=require('fs');var path=require(_0xb34f('0x5'));var rimraf=require(_0xb34f('0x6'));var config=require(_0xb34f('0x7'));var attributes=require('./sound.attributes');module['exports']=function(_0x112893,_0x5d2379){return _0x112893['define']('Sound',attributes,{'tableName':'tools_sounds','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6779=['util','../../config/logger','bluebird','path','rimraf','../../config/environment','./sound.attributes','exports','define','lodash'];(function(_0x29d850,_0x128fca){var _0x123065=function(_0x519f86){while(--_0x519f86){_0x29d850['push'](_0x29d850['shift']());}};_0x123065(++_0x128fca);}(_0x6779,0x77));var _0x9677=function(_0x1fbca0,_0x506b2d){_0x1fbca0=_0x1fbca0-0x0;var _0x1ddfdf=_0x6779[_0x1fbca0];return _0x1ddfdf;};'use strict';var _=require(_0x9677('0x0'));var util=require(_0x9677('0x1'));var logger=require(_0x9677('0x2'))('api');var moment=require('moment');var BPromise=require(_0x9677('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9677('0x4'));var rimraf=require(_0x9677('0x5'));var config=require(_0x9677('0x6'));var attributes=require(_0x9677('0x7'));module[_0x9677('0x8')]=function(_0x3c4b45,_0x4d6b01){return _0x3c4b45[_0x9677('0x9')]('Sound',attributes,{'tableName':'tools_sounds','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/sound/sound.rpc.js b/server/api/sound/sound.rpc.js index c33227b..a728fa2 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 _0xecce=['find','options','raw','where','attributes','include','map','model','stringify','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','request','then','info','Sound,\x20%s,\x20%s','request\x20sent','debug','Sound,\x20%s,\x20%s,\x20%s','error','message','result','catch','ShowSound','Sound'];(function(_0x92c450,_0x41f1e3){var _0x2a9599=function(_0x4f27df){while(--_0x4f27df){_0x92c450['push'](_0x92c450['shift']());}};_0x2a9599(++_0x41f1e3);}(_0xecce,0x1e9));var _0xeecc=function(_0x253201,_0x55488a){_0x253201=_0x253201-0x0;var _0x4a479a=_0xecce[_0x253201];return _0x4a479a;};'use strict';var _=require(_0xeecc('0x0'));var util=require(_0xeecc('0x1'));var moment=require('moment');var BPromise=require(_0xeecc('0x2'));var rs=require(_0xeecc('0x3'));var fs=require('fs');var Redis=require(_0xeecc('0x4'));var db=require(_0xeecc('0x5'))['db'];var utils=require(_0xeecc('0x6'));var logger=require(_0xeecc('0x7'))(_0xeecc('0x8'));var config=require(_0xeecc('0x9'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x48f10a,_0x5ac1ea,_0x29561c){return new BPromise(function(_0x294152,_0xefd59b){return client[_0xeecc('0xa')](_0x48f10a,_0x29561c)[_0xeecc('0xb')](function(_0x1e7764){logger[_0xeecc('0xc')](_0xeecc('0xd'),_0x5ac1ea,_0xeecc('0xe'));logger[_0xeecc('0xf')](_0xeecc('0x10'),_0x5ac1ea,_0xeecc('0xe'),JSON['stringify'](_0x1e7764));if(_0x1e7764[_0xeecc('0x11')]){if(_0x1e7764[_0xeecc('0x11')]['code']===0x1f4){logger[_0xeecc('0x11')](_0xeecc('0xd'),_0x5ac1ea,_0x1e7764[_0xeecc('0x11')][_0xeecc('0x12')]);return _0xefd59b(_0x1e7764[_0xeecc('0x11')][_0xeecc('0x12')]);}logger['error'](_0xeecc('0xd'),_0x5ac1ea,_0x1e7764[_0xeecc('0x11')][_0xeecc('0x12')]);return _0x294152(_0x1e7764[_0xeecc('0x11')][_0xeecc('0x12')]);}else{logger[_0xeecc('0xc')]('Sound,\x20%s,\x20%s',_0x5ac1ea,_0xeecc('0xe'));_0x294152(_0x1e7764[_0xeecc('0x13')][_0xeecc('0x12')]);}})[_0xeecc('0x14')](function(_0x23c823){logger[_0xeecc('0x11')](_0xeecc('0xd'),_0x5ac1ea,_0x23c823);_0xefd59b(_0x23c823);});});}exports[_0xeecc('0x15')]=function(_0x567515){var _0x402804=this;return new Promise(function(_0x3b90e5,_0x20849a){return db[_0xeecc('0x16')][_0xeecc('0x17')]({'raw':_0x567515[_0xeecc('0x18')]?_0x567515[_0xeecc('0x18')][_0xeecc('0x19')]===undefined?!![]:![]:!![],'where':_0x567515[_0xeecc('0x18')]?_0x567515['options'][_0xeecc('0x1a')]||null:null,'attributes':_0x567515['options']?_0x567515['options'][_0xeecc('0x1b')]||null:null,'include':_0x567515['options']?_0x567515[_0xeecc('0x18')][_0xeecc('0x1c')]?_[_0xeecc('0x1d')](_0x567515[_0xeecc('0x18')][_0xeecc('0x1c')],function(_0x191a03){return{'model':db[_0x191a03[_0xeecc('0x1e')]],'as':_0x191a03['as'],'attributes':_0x191a03['attributes'],'include':_0x191a03[_0xeecc('0x1c')]?_['map'](_0x191a03['include'],function(_0x203914){return{'model':db[_0x203914[_0xeecc('0x1e')]],'as':_0x203914['as'],'attributes':_0x203914['attributes'],'include':_0x203914[_0xeecc('0x1c')]?_[_0xeecc('0x1d')](_0x203914[_0xeecc('0x1c')],function(_0x4d2d33){return{'model':db[_0x4d2d33[_0xeecc('0x1e')]],'as':_0x4d2d33['as'],'attributes':_0x4d2d33[_0xeecc('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xeecc('0xb')](function(_0x57ec4b){logger[_0xeecc('0xc')]('ShowSound',_0x567515);logger[_0xeecc('0xf')]('ShowSound',_0x567515,JSON[_0xeecc('0x1f')](_0x57ec4b));_0x3b90e5(_0x57ec4b);})[_0xeecc('0x14')](function(_0x48cf18){logger['error'](_0xeecc('0x15'),_0x48cf18['message'],_0x567515);_0x20849a(_0x402804[_0xeecc('0x11')](0x1f4,_0x48cf18['message']));});});}; \ No newline at end of file +var _0xf662=['../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','Sound,\x20%s,\x20%s','request\x20sent','debug','Sound,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','ShowSound','Sound','find','options','raw','attributes','include','map','model','stringify','lodash','util','moment','randomstring','ioredis','../../mysqldb'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf662,0x170));var _0x2f66=function(_0x4599b6,_0x40c254){_0x4599b6=_0x4599b6-0x0;var _0x2e014c=_0xf662[_0x4599b6];return _0x2e014c;};'use strict';var _=require(_0x2f66('0x0'));var util=require(_0x2f66('0x1'));var moment=require(_0x2f66('0x2'));var BPromise=require('bluebird');var rs=require(_0x2f66('0x3'));var fs=require('fs');var Redis=require(_0x2f66('0x4'));var db=require(_0x2f66('0x5'))['db'];var utils=require(_0x2f66('0x6'));var logger=require(_0x2f66('0x7'))(_0x2f66('0x8'));var config=require(_0x2f66('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x2f66('0xa')][_0x2f66('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x46407d,_0x19332e,_0x1a08f8){return new BPromise(function(_0x567a42,_0x249ebc){return client[_0x2f66('0xc')](_0x46407d,_0x1a08f8)[_0x2f66('0xd')](function(_0x5f7289){logger[_0x2f66('0xe')](_0x2f66('0xf'),_0x19332e,_0x2f66('0x10'));logger[_0x2f66('0x11')](_0x2f66('0x12'),_0x19332e,_0x2f66('0x10'),JSON['stringify'](_0x5f7289));if(_0x5f7289[_0x2f66('0x13')]){if(_0x5f7289[_0x2f66('0x13')][_0x2f66('0x14')]===0x1f4){logger[_0x2f66('0x13')](_0x2f66('0xf'),_0x19332e,_0x5f7289[_0x2f66('0x13')][_0x2f66('0x15')]);return _0x249ebc(_0x5f7289[_0x2f66('0x13')][_0x2f66('0x15')]);}logger[_0x2f66('0x13')](_0x2f66('0xf'),_0x19332e,_0x5f7289[_0x2f66('0x13')][_0x2f66('0x15')]);return _0x567a42(_0x5f7289[_0x2f66('0x13')][_0x2f66('0x15')]);}else{logger[_0x2f66('0xe')](_0x2f66('0xf'),_0x19332e,_0x2f66('0x10'));_0x567a42(_0x5f7289[_0x2f66('0x16')][_0x2f66('0x15')]);}})[_0x2f66('0x17')](function(_0x3328b2){logger[_0x2f66('0x13')]('Sound,\x20%s,\x20%s',_0x19332e,_0x3328b2);_0x249ebc(_0x3328b2);});});}exports[_0x2f66('0x18')]=function(_0x1429be){var _0x59c149=this;return new Promise(function(_0x389498,_0x47fa92){return db[_0x2f66('0x19')][_0x2f66('0x1a')]({'raw':_0x1429be[_0x2f66('0x1b')]?_0x1429be[_0x2f66('0x1b')][_0x2f66('0x1c')]===undefined?!![]:![]:!![],'where':_0x1429be[_0x2f66('0x1b')]?_0x1429be['options']['where']||null:null,'attributes':_0x1429be[_0x2f66('0x1b')]?_0x1429be[_0x2f66('0x1b')][_0x2f66('0x1d')]||null:null,'include':_0x1429be[_0x2f66('0x1b')]?_0x1429be[_0x2f66('0x1b')][_0x2f66('0x1e')]?_[_0x2f66('0x1f')](_0x1429be[_0x2f66('0x1b')]['include'],function(_0xe07892){return{'model':db[_0xe07892['model']],'as':_0xe07892['as'],'attributes':_0xe07892[_0x2f66('0x1d')],'include':_0xe07892[_0x2f66('0x1e')]?_[_0x2f66('0x1f')](_0xe07892['include'],function(_0x46ff9b){return{'model':db[_0x46ff9b[_0x2f66('0x20')]],'as':_0x46ff9b['as'],'attributes':_0x46ff9b[_0x2f66('0x1d')],'include':_0x46ff9b[_0x2f66('0x1e')]?_['map'](_0x46ff9b[_0x2f66('0x1e')],function(_0x116039){return{'model':db[_0x116039[_0x2f66('0x20')]],'as':_0x116039['as'],'attributes':_0x116039[_0x2f66('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x2f66('0xd')](function(_0x36a237){logger[_0x2f66('0xe')](_0x2f66('0x18'),_0x1429be);logger['debug'](_0x2f66('0x18'),_0x1429be,JSON[_0x2f66('0x21')](_0x36a237));_0x389498(_0x36a237);})[_0x2f66('0x17')](function(_0x24bcf8){logger[_0x2f66('0x13')](_0x2f66('0x18'),_0x24bcf8[_0x2f66('0x15')],_0x1429be);_0x47fa92(_0x59c149[_0x2f66('0x13')](0x1f4,_0x24bcf8[_0x2f66('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/squareMessage/index.js b/server/api/squareMessage/index.js index 8a44d67..2072d44 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 _0x14a0=['get','isAuthenticated','/:id','show','create','delete','destroy','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./squareMessage.controller'];(function(_0x4f8767,_0x5d485a){var _0x4ddb43=function(_0x40c574){while(--_0x40c574){_0x4f8767['push'](_0x4f8767['shift']());}};_0x4ddb43(++_0x5d485a);}(_0x14a0,0x8e));var _0x014a=function(_0x4d72d4,_0x31a85a){_0x4d72d4=_0x4d72d4-0x0;var _0x1084de=_0x14a0[_0x4d72d4];return _0x1084de;};'use strict';var multer=require('multer');var util=require(_0x014a('0x0'));var path=require(_0x014a('0x1'));var timeout=require(_0x014a('0x2'));var express=require(_0x014a('0x3'));var router=express[_0x014a('0x4')]();var fs_extra=require(_0x014a('0x5'));var auth=require(_0x014a('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x014a('0x7'));router[_0x014a('0x8')]('/',auth[_0x014a('0x9')](),controller['index']);router['get'](_0x014a('0xa'),auth[_0x014a('0x9')](),controller[_0x014a('0xb')]);router['post']('/',auth['isAuthenticated'](),controller[_0x014a('0xc')]);router['put']('/:id',auth['isAuthenticated'](),controller['update']);router[_0x014a('0xd')]('/:id',auth[_0x014a('0x9')](),controller[_0x014a('0xe')]);module['exports']=router; \ No newline at end of file +var _0xac4a=['express','Router','../../components/interaction/service','../../config/environment','./squareMessage.controller','isAuthenticated','get','show','create','/:id','delete','destroy','exports','multer','util','path','connect-timeout'];(function(_0x107634,_0x4ca2e9){var _0x137d88=function(_0x16af1e){while(--_0x16af1e){_0x107634['push'](_0x107634['shift']());}};_0x137d88(++_0x4ca2e9);}(_0xac4a,0x13f));var _0xaac4=function(_0x53a509,_0x180c59){_0x53a509=_0x53a509-0x0;var _0x5a013a=_0xac4a[_0x53a509];return _0x5a013a;};'use strict';var multer=require(_0xaac4('0x0'));var util=require(_0xaac4('0x1'));var path=require(_0xaac4('0x2'));var timeout=require(_0xaac4('0x3'));var express=require(_0xaac4('0x4'));var router=express[_0xaac4('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xaac4('0x6'));var config=require(_0xaac4('0x7'));var controller=require(_0xaac4('0x8'));router['get']('/',auth[_0xaac4('0x9')](),controller['index']);router[_0xaac4('0xa')]('/:id',auth[_0xaac4('0x9')](),controller[_0xaac4('0xb')]);router['post']('/',auth['isAuthenticated'](),controller[_0xaac4('0xc')]);router['put'](_0xaac4('0xd'),auth['isAuthenticated'](),controller['update']);router[_0xaac4('0xe')](_0xaac4('0xd'),auth[_0xaac4('0x9')](),controller[_0xaac4('0xf')]);module[_0xaac4('0x10')]=router; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.attributes.js b/server/api/squareMessage/squareMessage.attributes.js index 874d757..fa7d186 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 _0xac5b=['ENUM','out','sequelize','STRING','TEXT','medium'];(function(_0x3815c2,_0x1f54e3){var _0x271f88=function(_0x53963c){while(--_0x53963c){_0x3815c2['push'](_0x3815c2['shift']());}};_0x271f88(++_0x1f54e3);}(_0xac5b,0x17c));var _0xbac5=function(_0x11a220,_0x4e470a){_0x11a220=_0x11a220-0x0;var _0x20d8fe=_0xac5b[_0x11a220];return _0x20d8fe;};'use strict';var Sequelize=require(_0xbac5('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0xbac5('0x1')]},'body':{'type':Sequelize[_0xbac5('0x2')](_0xbac5('0x3')),'allowNull':![]},'direction':{'type':Sequelize[_0xbac5('0x4')]('in',_0xbac5('0x5')),'defaultValue':_0xbac5('0x5'),'allowNull':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0xea6d=['ENUM','out','STRING','TEXT','exports','medium'];(function(_0xf79891,_0x399c9b){var _0x4a248c=function(_0x1694ac){while(--_0x1694ac){_0xf79891['push'](_0xf79891['shift']());}};_0x4a248c(++_0x399c9b);}(_0xea6d,0x100));var _0xdea6=function(_0x49249c,_0x1e0997){_0x49249c=_0x49249c-0x0;var _0x484741=_0xea6d[_0x49249c];return _0x484741;};'use strict';var Sequelize=require('sequelize');module[_0xdea6('0x0')]={'uniqueid':{'type':Sequelize['STRING']},'body':{'type':Sequelize['TEXT'](_0xdea6('0x1')),'allowNull':![]},'direction':{'type':Sequelize[_0xdea6('0x2')]('in','out'),'defaultValue':_0xdea6('0x3'),'allowNull':![]},'providerName':{'type':Sequelize[_0xdea6('0x4')]},'providerResponse':{'type':Sequelize[_0xdea6('0x5')]}}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.controller.js b/server/api/squareMessage/squareMessage.controller.js index c6fb5c2..48db33d 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 _0x1a4d=['to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','destroy','error','stack','name','send','index','map','SquareMessage','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','then','includeAll','include','findAll','rows','catch','show','params','keys','rawAttributes','find','create','body','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js'];(function(_0x582f72,_0x886d8){var _0x4cd5fe=function(_0x4ac1c7){while(--_0x4ac1c7){_0x582f72['push'](_0x582f72['shift']());}};_0x4cd5fe(++_0x886d8);}(_0x1a4d,0x189));var _0xd1a4=function(_0x526d9a,_0x3728d7){_0x526d9a=_0x526d9a-0x0;var _0x3c902f=_0x1a4d[_0x526d9a];return _0x3c902f;};'use strict';var emlformat=require(_0xd1a4('0x0'));var rimraf=require(_0xd1a4('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd1a4('0x2'));var rp=require(_0xd1a4('0x3'));var moment=require(_0xd1a4('0x4'));var BPromise=require(_0xd1a4('0x5'));var Mustache=require(_0xd1a4('0x6'));var util=require(_0xd1a4('0x7'));var path=require(_0xd1a4('0x8'));var sox=require(_0xd1a4('0x9'));var csv=require('to-csv');var ejs=require(_0xd1a4('0xa'));var fs=require('fs');var fs_extra=require(_0xd1a4('0xb'));var _=require(_0xd1a4('0xc'));var squel=require(_0xd1a4('0xd'));var crypto=require(_0xd1a4('0xe'));var jsforce=require(_0xd1a4('0xf'));var deskjs=require(_0xd1a4('0x10'));var toCsv=require(_0xd1a4('0x11'));var querystring=require(_0xd1a4('0x12'));var Papa=require(_0xd1a4('0x13'));var Redis=require('ioredis');var authService=require(_0xd1a4('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0xd1a4('0x15'));var hardwareService=require(_0xd1a4('0x16'));var logger=require(_0xd1a4('0x17'))(_0xd1a4('0x18'));var utils=require(_0xd1a4('0x19'));var config=require(_0xd1a4('0x1a'));var licenseUtil=require(_0xd1a4('0x1b'));var db=require(_0xd1a4('0x1c'))['db'];function respondWithStatusCode(_0x218194,_0x30db3c){_0x30db3c=_0x30db3c||0xcc;return function(_0x5af3b7){if(_0x5af3b7){return _0x218194[_0xd1a4('0x1d')](_0x30db3c);}return _0x218194['status'](_0x30db3c)[_0xd1a4('0x1e')]();};}function respondWithResult(_0x45c9e1,_0x70d1c8){_0x70d1c8=_0x70d1c8||0xc8;return function(_0x50a2d2){if(_0x50a2d2){return _0x45c9e1[_0xd1a4('0x1f')](_0x70d1c8)[_0xd1a4('0x20')](_0x50a2d2);}};}function respondWithFilteredResult(_0x4a73bb,_0x5a373f){return function(_0x2914cb){if(_0x2914cb){var _0x53f480=typeof _0x5a373f['offset']===_0xd1a4('0x21')&&typeof _0x5a373f[_0xd1a4('0x22')]==='undefined';var _0x42be68=_0x2914cb[_0xd1a4('0x23')];var _0x2ee34b=_0x53f480?0x0:_0x5a373f[_0xd1a4('0x24')];var _0x17fdc6=_0x53f480?_0x2914cb['count']:_0x5a373f[_0xd1a4('0x24')]+_0x5a373f['limit'];var _0x5cf4e3;if(_0x17fdc6>=_0x42be68){_0x17fdc6=_0x42be68;_0x5cf4e3=0xc8;}else{_0x5cf4e3=0xce;}_0x4a73bb[_0xd1a4('0x1f')](_0x5cf4e3);return _0x4a73bb[_0xd1a4('0x25')](_0xd1a4('0x26'),_0x2ee34b+'-'+_0x17fdc6+'/'+_0x42be68)[_0xd1a4('0x20')](_0x2914cb);}return null;};}function patchUpdates(_0x454226){return function(_0x38d503){try{jsonpatch[_0xd1a4('0x27')](_0x38d503,_0x454226,!![]);}catch(_0x3f54a9){return BPromise[_0xd1a4('0x28')](_0x3f54a9);}return _0x38d503[_0xd1a4('0x29')]();};}function saveUpdates(_0x36aa8c,_0x319e6f){return function(_0x17d2cb){if(_0x17d2cb){return _0x17d2cb[_0xd1a4('0x2a')](_0x36aa8c)['then'](function(_0x17b376){return _0x17b376;});}return null;};}function removeEntity(_0x37c9af,_0x3d39a5){return function(_0x31ed84){if(_0x31ed84){return _0x31ed84[_0xd1a4('0x2b')]()['then'](function(){_0x37c9af[_0xd1a4('0x1f')](0xcc)[_0xd1a4('0x1e')]();});}};}function handleEntityNotFound(_0xb319e4,_0x5f7b02){return function(_0x2e7076){if(!_0x2e7076){_0xb319e4[_0xd1a4('0x1d')](0x194);}return _0x2e7076;};}function handleError(_0x18d17f,_0x1915e7){_0x1915e7=_0x1915e7||0x1f4;return function(_0x56f7a3){logger[_0xd1a4('0x2c')](_0x56f7a3[_0xd1a4('0x2d')]);if(_0x56f7a3[_0xd1a4('0x2e')]){delete _0x56f7a3[_0xd1a4('0x2e')];}_0x18d17f[_0xd1a4('0x1f')](_0x1915e7)[_0xd1a4('0x2f')](_0x56f7a3);};}exports[_0xd1a4('0x30')]=function(_0xf5853f,_0x114e47){var _0xc6931e={},_0x40ac0a={},_0x49c8df={'count':0x0,'rows':[]};var _0x4b092e=_[_0xd1a4('0x31')](db[_0xd1a4('0x32')]['rawAttributes'],function(_0x341698){return{'name':_0x341698['fieldName'],'type':_0x341698[_0xd1a4('0x33')][_0xd1a4('0x34')]};});_0x40ac0a[_0xd1a4('0x35')]=_['map'](_0x4b092e,_0xd1a4('0x2e'));_0x40ac0a['query']=_['keys'](_0xf5853f[_0xd1a4('0x36')]);_0x40ac0a[_0xd1a4('0x37')]=_[_0xd1a4('0x38')](_0x40ac0a[_0xd1a4('0x35')],_0x40ac0a[_0xd1a4('0x36')]);_0xc6931e[_0xd1a4('0x39')]=_[_0xd1a4('0x38')](_0x40ac0a[_0xd1a4('0x35')],qs[_0xd1a4('0x3a')](_0xf5853f[_0xd1a4('0x36')][_0xd1a4('0x3a')]));_0xc6931e[_0xd1a4('0x39')]=_0xc6931e['attributes'][_0xd1a4('0x3b')]?_0xc6931e['attributes']:_0x40ac0a[_0xd1a4('0x35')];if(!_0xf5853f[_0xd1a4('0x36')][_0xd1a4('0x3c')](_0xd1a4('0x3d'))){_0xc6931e['limit']=qs[_0xd1a4('0x22')](_0xf5853f[_0xd1a4('0x36')]['limit']);_0xc6931e[_0xd1a4('0x24')]=qs[_0xd1a4('0x24')](_0xf5853f[_0xd1a4('0x36')]['offset']);}_0xc6931e['order']=qs[_0xd1a4('0x3e')](_0xf5853f['query'][_0xd1a4('0x3e')]);_0xc6931e[_0xd1a4('0x3f')]=qs[_0xd1a4('0x37')](_[_0xd1a4('0x40')](_0xf5853f[_0xd1a4('0x36')],_0x40ac0a['filters']),_0x4b092e);if(_0xf5853f[_0xd1a4('0x36')][_0xd1a4('0x41')]){_0xc6931e[_0xd1a4('0x3f')]=_[_0xd1a4('0x42')](_0xc6931e[_0xd1a4('0x3f')],{'$or':_[_0xd1a4('0x31')](_0x4b092e,function(_0x1423a3){if(_0x1423a3[_0xd1a4('0x33')]!==_0xd1a4('0x43')){var _0x52983c={};_0x52983c[_0x1423a3['name']]={'$like':'%'+_0xf5853f[_0xd1a4('0x36')][_0xd1a4('0x41')]+'%'};return _0x52983c;}})});}_0xc6931e=_[_0xd1a4('0x42')]({},_0xc6931e,_0xf5853f[_0xd1a4('0x44')]);var _0x108d28={'where':_0xc6931e[_0xd1a4('0x3f')]};return db['SquareMessage'][_0xd1a4('0x23')](_0x108d28)[_0xd1a4('0x45')](function(_0xbae47f){_0x49c8df[_0xd1a4('0x23')]=_0xbae47f;if(_0xf5853f[_0xd1a4('0x36')][_0xd1a4('0x46')]){_0xc6931e[_0xd1a4('0x47')]=[{'all':!![]}];}return db[_0xd1a4('0x32')][_0xd1a4('0x48')](_0xc6931e);})['then'](function(_0x909ea9){_0x49c8df[_0xd1a4('0x49')]=_0x909ea9;return _0x49c8df;})[_0xd1a4('0x45')](respondWithFilteredResult(_0x114e47,_0xc6931e))[_0xd1a4('0x4a')](handleError(_0x114e47,null));};exports[_0xd1a4('0x4b')]=function(_0x2add56,_0xb8493d){var _0x34f403={'raw':!![],'where':{'id':_0x2add56[_0xd1a4('0x4c')]['id']}},_0x2a00d6={};_0x2a00d6['model']=_[_0xd1a4('0x4d')](db[_0xd1a4('0x32')][_0xd1a4('0x4e')]);_0x2a00d6[_0xd1a4('0x36')]=_[_0xd1a4('0x4d')](_0x2add56[_0xd1a4('0x36')]);_0x2a00d6[_0xd1a4('0x37')]=_[_0xd1a4('0x38')](_0x2a00d6['model'],_0x2a00d6[_0xd1a4('0x36')]);_0x34f403[_0xd1a4('0x39')]=_[_0xd1a4('0x38')](_0x2a00d6['model'],qs['fields'](_0x2add56[_0xd1a4('0x36')]['fields']));_0x34f403[_0xd1a4('0x39')]=_0x34f403[_0xd1a4('0x39')][_0xd1a4('0x3b')]?_0x34f403[_0xd1a4('0x39')]:_0x2a00d6['model'];if(_0x2add56['query'][_0xd1a4('0x46')]){_0x34f403[_0xd1a4('0x47')]=[{'all':!![]}];}_0x34f403=_[_0xd1a4('0x42')]({},_0x34f403,_0x2add56[_0xd1a4('0x44')]);return db['SquareMessage'][_0xd1a4('0x4f')](_0x34f403)['then'](handleEntityNotFound(_0xb8493d,null))[_0xd1a4('0x45')](respondWithResult(_0xb8493d,null))['catch'](handleError(_0xb8493d,null));};exports['create']=function(_0x9f445,_0x477a8e){return db['SquareMessage'][_0xd1a4('0x50')](_0x9f445[_0xd1a4('0x51')],{})[_0xd1a4('0x45')](respondWithResult(_0x477a8e,0xc9))[_0xd1a4('0x4a')](handleError(_0x477a8e,null));};exports[_0xd1a4('0x2a')]=function(_0x58c5cc,_0x338ad9){if(_0x58c5cc['body']['id']){delete _0x58c5cc['body']['id'];}return db[_0xd1a4('0x32')][_0xd1a4('0x4f')]({'where':{'id':_0x58c5cc[_0xd1a4('0x4c')]['id']}})['then'](handleEntityNotFound(_0x338ad9,null))[_0xd1a4('0x45')](saveUpdates(_0x58c5cc[_0xd1a4('0x51')],null))['then'](respondWithResult(_0x338ad9,null))[_0xd1a4('0x4a')](handleError(_0x338ad9,null));};exports['destroy']=function(_0x5dbcb6,_0x1c06d6){return db[_0xd1a4('0x32')][_0xd1a4('0x4f')]({'where':{'id':_0x5dbcb6[_0xd1a4('0x4c')]['id']}})['then'](handleEntityNotFound(_0x1c06d6,null))[_0xd1a4('0x45')](removeEntity(_0x1c06d6,null))[_0xd1a4('0x4a')](handleError(_0x1c06d6,null));}; \ No newline at end of file +var _0xe1e8=['map','SquareMessage','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','create','body','update','eml-format','zip-dir','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','limit','undefined','count','offset','set','Content-Range','then','destroy','stack','name','send','index'];(function(_0x2221a7,_0x3c3ab9){var _0x30ec70=function(_0x44e134){while(--_0x44e134){_0x2221a7['push'](_0x2221a7['shift']());}};_0x30ec70(++_0x3c3ab9);}(_0xe1e8,0x1cb));var _0x8e1e=function(_0x51c51f,_0x43fa96){_0x51c51f=_0x51c51f-0x0;var _0x28665f=_0xe1e8[_0x51c51f];return _0x28665f;};'use strict';var emlformat=require(_0x8e1e('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x8e1e('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x8e1e('0x2'));var BPromise=require(_0x8e1e('0x3'));var Mustache=require(_0x8e1e('0x4'));var util=require(_0x8e1e('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0x8e1e('0x6'));var ejs=require(_0x8e1e('0x7'));var fs=require('fs');var fs_extra=require(_0x8e1e('0x8'));var _=require(_0x8e1e('0x9'));var squel=require('squel');var crypto=require(_0x8e1e('0xa'));var jsforce=require(_0x8e1e('0xb'));var deskjs=require(_0x8e1e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x8e1e('0xd'));var Redis=require(_0x8e1e('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x8e1e('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8e1e('0x10'));var logger=require(_0x8e1e('0x11'))(_0x8e1e('0x12'));var utils=require(_0x8e1e('0x13'));var config=require(_0x8e1e('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x8e1e('0x15'))['db'];function respondWithStatusCode(_0x206783,_0x3d0265){_0x3d0265=_0x3d0265||0xcc;return function(_0x57919e){if(_0x57919e){return _0x206783[_0x8e1e('0x16')](_0x3d0265);}return _0x206783[_0x8e1e('0x17')](_0x3d0265)[_0x8e1e('0x18')]();};}function respondWithResult(_0x161bb7,_0x5cb057){_0x5cb057=_0x5cb057||0xc8;return function(_0x5b8fd1){if(_0x5b8fd1){return _0x161bb7['status'](_0x5cb057)[_0x8e1e('0x19')](_0x5b8fd1);}};}function respondWithFilteredResult(_0x120903,_0x2d2d4f){return function(_0x1bd383){if(_0x1bd383){var _0xf439a=typeof _0x2d2d4f['offset']==='undefined'&&typeof _0x2d2d4f[_0x8e1e('0x1a')]===_0x8e1e('0x1b');var _0x31a1f4=_0x1bd383[_0x8e1e('0x1c')];var _0x4738f3=_0xf439a?0x0:_0x2d2d4f[_0x8e1e('0x1d')];var _0x5bbfde=_0xf439a?_0x1bd383[_0x8e1e('0x1c')]:_0x2d2d4f[_0x8e1e('0x1d')]+_0x2d2d4f['limit'];var _0x4e9fd4;if(_0x5bbfde>=_0x31a1f4){_0x5bbfde=_0x31a1f4;_0x4e9fd4=0xc8;}else{_0x4e9fd4=0xce;}_0x120903[_0x8e1e('0x17')](_0x4e9fd4);return _0x120903[_0x8e1e('0x1e')](_0x8e1e('0x1f'),_0x4738f3+'-'+_0x5bbfde+'/'+_0x31a1f4)[_0x8e1e('0x19')](_0x1bd383);}return null;};}function patchUpdates(_0x325028){return function(_0xa5c182){try{jsonpatch['apply'](_0xa5c182,_0x325028,!![]);}catch(_0x7ad0a5){return BPromise['reject'](_0x7ad0a5);}return _0xa5c182['save']();};}function saveUpdates(_0x4e2e6d,_0x849b18){return function(_0x342ae1){if(_0x342ae1){return _0x342ae1['update'](_0x4e2e6d)[_0x8e1e('0x20')](function(_0x47972b){return _0x47972b;});}return null;};}function removeEntity(_0x323286,_0x499c31){return function(_0x4e5a22){if(_0x4e5a22){return _0x4e5a22[_0x8e1e('0x21')]()[_0x8e1e('0x20')](function(){_0x323286[_0x8e1e('0x17')](0xcc)[_0x8e1e('0x18')]();});}};}function handleEntityNotFound(_0x584bb6,_0x31371f){return function(_0x3b9587){if(!_0x3b9587){_0x584bb6[_0x8e1e('0x16')](0x194);}return _0x3b9587;};}function handleError(_0x5c9ed8,_0x509fe6){_0x509fe6=_0x509fe6||0x1f4;return function(_0xbd295f){logger['error'](_0xbd295f[_0x8e1e('0x22')]);if(_0xbd295f[_0x8e1e('0x23')]){delete _0xbd295f[_0x8e1e('0x23')];}_0x5c9ed8[_0x8e1e('0x17')](_0x509fe6)[_0x8e1e('0x24')](_0xbd295f);};}exports[_0x8e1e('0x25')]=function(_0x1764b4,_0x370ee2){var _0x4d7008={},_0x53756d={},_0x2e7d84={'count':0x0,'rows':[]};var _0x1ad99e=_[_0x8e1e('0x26')](db[_0x8e1e('0x27')]['rawAttributes'],function(_0x227fd3){return{'name':_0x227fd3[_0x8e1e('0x28')],'type':_0x227fd3[_0x8e1e('0x29')][_0x8e1e('0x2a')]};});_0x53756d[_0x8e1e('0x2b')]=_['map'](_0x1ad99e,_0x8e1e('0x23'));_0x53756d[_0x8e1e('0x2c')]=_[_0x8e1e('0x2d')](_0x1764b4[_0x8e1e('0x2c')]);_0x53756d[_0x8e1e('0x2e')]=_[_0x8e1e('0x2f')](_0x53756d['model'],_0x53756d[_0x8e1e('0x2c')]);_0x4d7008[_0x8e1e('0x30')]=_['intersection'](_0x53756d[_0x8e1e('0x2b')],qs['fields'](_0x1764b4[_0x8e1e('0x2c')][_0x8e1e('0x31')]));_0x4d7008[_0x8e1e('0x30')]=_0x4d7008[_0x8e1e('0x30')]['length']?_0x4d7008['attributes']:_0x53756d[_0x8e1e('0x2b')];if(!_0x1764b4[_0x8e1e('0x2c')][_0x8e1e('0x32')]('nolimit')){_0x4d7008['limit']=qs[_0x8e1e('0x1a')](_0x1764b4[_0x8e1e('0x2c')][_0x8e1e('0x1a')]);_0x4d7008['offset']=qs[_0x8e1e('0x1d')](_0x1764b4[_0x8e1e('0x2c')]['offset']);}_0x4d7008[_0x8e1e('0x33')]=qs[_0x8e1e('0x34')](_0x1764b4[_0x8e1e('0x2c')]['sort']);_0x4d7008[_0x8e1e('0x35')]=qs[_0x8e1e('0x2e')](_[_0x8e1e('0x36')](_0x1764b4['query'],_0x53756d[_0x8e1e('0x2e')]),_0x1ad99e);if(_0x1764b4[_0x8e1e('0x2c')][_0x8e1e('0x37')]){_0x4d7008[_0x8e1e('0x35')]=_[_0x8e1e('0x38')](_0x4d7008['where'],{'$or':_['map'](_0x1ad99e,function(_0x1be215){if(_0x1be215[_0x8e1e('0x29')]!==_0x8e1e('0x39')){var _0x235962={};_0x235962[_0x1be215[_0x8e1e('0x23')]]={'$like':'%'+_0x1764b4[_0x8e1e('0x2c')][_0x8e1e('0x37')]+'%'};return _0x235962;}})});}_0x4d7008=_[_0x8e1e('0x38')]({},_0x4d7008,_0x1764b4[_0x8e1e('0x3a')]);var _0x1a9b74={'where':_0x4d7008[_0x8e1e('0x35')]};return db[_0x8e1e('0x27')][_0x8e1e('0x1c')](_0x1a9b74)[_0x8e1e('0x20')](function(_0x2e01d5){_0x2e7d84[_0x8e1e('0x1c')]=_0x2e01d5;if(_0x1764b4[_0x8e1e('0x2c')][_0x8e1e('0x3b')]){_0x4d7008[_0x8e1e('0x3c')]=[{'all':!![]}];}return db['SquareMessage'][_0x8e1e('0x3d')](_0x4d7008);})['then'](function(_0x28517b){_0x2e7d84[_0x8e1e('0x3e')]=_0x28517b;return _0x2e7d84;})['then'](respondWithFilteredResult(_0x370ee2,_0x4d7008))[_0x8e1e('0x3f')](handleError(_0x370ee2,null));};exports[_0x8e1e('0x40')]=function(_0x45cebd,_0x53c00f){var _0x46ad25={'raw':!![],'where':{'id':_0x45cebd[_0x8e1e('0x41')]['id']}},_0x50f510={};_0x50f510['model']=_[_0x8e1e('0x2d')](db[_0x8e1e('0x27')][_0x8e1e('0x42')]);_0x50f510[_0x8e1e('0x2c')]=_[_0x8e1e('0x2d')](_0x45cebd[_0x8e1e('0x2c')]);_0x50f510[_0x8e1e('0x2e')]=_[_0x8e1e('0x2f')](_0x50f510[_0x8e1e('0x2b')],_0x50f510[_0x8e1e('0x2c')]);_0x46ad25[_0x8e1e('0x30')]=_[_0x8e1e('0x2f')](_0x50f510[_0x8e1e('0x2b')],qs[_0x8e1e('0x31')](_0x45cebd[_0x8e1e('0x2c')][_0x8e1e('0x31')]));_0x46ad25[_0x8e1e('0x30')]=_0x46ad25[_0x8e1e('0x30')]['length']?_0x46ad25['attributes']:_0x50f510['model'];if(_0x45cebd['query']['includeAll']){_0x46ad25[_0x8e1e('0x3c')]=[{'all':!![]}];}_0x46ad25=_[_0x8e1e('0x38')]({},_0x46ad25,_0x45cebd[_0x8e1e('0x3a')]);return db['SquareMessage'][_0x8e1e('0x43')](_0x46ad25)[_0x8e1e('0x20')](handleEntityNotFound(_0x53c00f,null))[_0x8e1e('0x20')](respondWithResult(_0x53c00f,null))['catch'](handleError(_0x53c00f,null));};exports[_0x8e1e('0x44')]=function(_0x116553,_0x4ea221){return db[_0x8e1e('0x27')][_0x8e1e('0x44')](_0x116553[_0x8e1e('0x45')],{})[_0x8e1e('0x20')](respondWithResult(_0x4ea221,0xc9))['catch'](handleError(_0x4ea221,null));};exports[_0x8e1e('0x46')]=function(_0x16d169,_0x26a8dd){if(_0x16d169[_0x8e1e('0x45')]['id']){delete _0x16d169['body']['id'];}return db[_0x8e1e('0x27')][_0x8e1e('0x43')]({'where':{'id':_0x16d169[_0x8e1e('0x41')]['id']}})[_0x8e1e('0x20')](handleEntityNotFound(_0x26a8dd,null))[_0x8e1e('0x20')](saveUpdates(_0x16d169[_0x8e1e('0x45')],null))['then'](respondWithResult(_0x26a8dd,null))[_0x8e1e('0x3f')](handleError(_0x26a8dd,null));};exports['destroy']=function(_0x517dc3,_0x15dd5a){return db[_0x8e1e('0x27')][_0x8e1e('0x43')]({'where':{'id':_0x517dc3[_0x8e1e('0x41')]['id']}})[_0x8e1e('0x20')](handleEntityNotFound(_0x15dd5a,null))[_0x8e1e('0x20')](removeEntity(_0x15dd5a,null))[_0x8e1e('0x3f')](handleError(_0x15dd5a,null));}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.model.js b/server/api/squareMessage/squareMessage.model.js index ef3b9cf..61f7875 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 _0x2864=['moment','bluebird','path','../../config/environment','./squareMessage.attributes','exports','define','lodash','util','api'];(function(_0x2b4411,_0x2625ed){var _0x8e41ef=function(_0x2aa8c1){while(--_0x2aa8c1){_0x2b4411['push'](_0x2b4411['shift']());}};_0x8e41ef(++_0x2625ed);}(_0x2864,0x179));var _0x4286=function(_0x5c9e08,_0x14a8e6){_0x5c9e08=_0x5c9e08-0x0;var _0x502e01=_0x2864[_0x5c9e08];return _0x502e01;};'use strict';var _=require(_0x4286('0x0'));var util=require(_0x4286('0x1'));var logger=require('../../config/logger')(_0x4286('0x2'));var moment=require(_0x4286('0x3'));var BPromise=require(_0x4286('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4286('0x5'));var rimraf=require('rimraf');var config=require(_0x4286('0x6'));var attributes=require(_0x4286('0x7'));module[_0x4286('0x8')]=function(_0x3f1154,_0x3309c7){return _0x3f1154[_0x4286('0x9')]('SquareMessage',attributes,{'tableName':'square_messages','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3c46=['define','SquareMessage','square_messages','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./squareMessage.attributes','exports'];(function(_0x3a031a,_0xd706bb){var _0x2c71c6=function(_0x2d6b6b){while(--_0x2d6b6b){_0x3a031a['push'](_0x3a031a['shift']());}};_0x2c71c6(++_0xd706bb);}(_0x3c46,0xb9));var _0x63c4=function(_0x1ab50c,_0x54a581){_0x1ab50c=_0x1ab50c-0x0;var _0x23e558=_0x3c46[_0x1ab50c];return _0x23e558;};'use strict';var _=require(_0x63c4('0x0'));var util=require(_0x63c4('0x1'));var logger=require(_0x63c4('0x2'))(_0x63c4('0x3'));var moment=require(_0x63c4('0x4'));var BPromise=require(_0x63c4('0x5'));var rp=require(_0x63c4('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x63c4('0x7'));var config=require(_0x63c4('0x8'));var attributes=require(_0x63c4('0x9'));module[_0x63c4('0xa')]=function(_0x3bb643,_0x1f4de3){return _0x3bb643[_0x63c4('0xb')](_0x63c4('0xc'),attributes,{'tableName':_0x63c4('0xd'),'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 c42f0b9..d6ab691 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 _0xf902=['result','catch','CreateSquareMessage','create','options','raw','stringify','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SquareMessage,\x20%s,\x20%s','request\x20sent','debug','SquareMessage,\x20%s,\x20%s,\x20%s','error','code','message'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xf902,0x129));var _0x2f90=function(_0x26785e,_0x40b08){_0x26785e=_0x26785e-0x0;var _0x4d672a=_0xf902[_0x26785e];return _0x4d672a;};'use strict';var _=require(_0x2f90('0x0'));var util=require(_0x2f90('0x1'));var moment=require('moment');var BPromise=require(_0x2f90('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2f90('0x3'));var db=require(_0x2f90('0x4'))['db'];var utils=require(_0x2f90('0x5'));var logger=require(_0x2f90('0x6'))(_0x2f90('0x7'));var config=require(_0x2f90('0x8'));var jayson=require(_0x2f90('0x9'));var client=jayson[_0x2f90('0xa')][_0x2f90('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xfbb12e,_0xcb143e,_0x280e63){return new BPromise(function(_0x5c94ed,_0x2d3fc3){return client[_0x2f90('0xc')](_0xfbb12e,_0x280e63)[_0x2f90('0xd')](function(_0x14c55c){logger[_0x2f90('0xe')](_0x2f90('0xf'),_0xcb143e,_0x2f90('0x10'));logger[_0x2f90('0x11')](_0x2f90('0x12'),_0xcb143e,_0x2f90('0x10'),JSON['stringify'](_0x14c55c));if(_0x14c55c[_0x2f90('0x13')]){if(_0x14c55c[_0x2f90('0x13')][_0x2f90('0x14')]===0x1f4){logger[_0x2f90('0x13')]('SquareMessage,\x20%s,\x20%s',_0xcb143e,_0x14c55c[_0x2f90('0x13')]['message']);return _0x2d3fc3(_0x14c55c['error'][_0x2f90('0x15')]);}logger[_0x2f90('0x13')](_0x2f90('0xf'),_0xcb143e,_0x14c55c[_0x2f90('0x13')]['message']);return _0x5c94ed(_0x14c55c[_0x2f90('0x13')][_0x2f90('0x15')]);}else{logger[_0x2f90('0xe')](_0x2f90('0xf'),_0xcb143e,_0x2f90('0x10'));_0x5c94ed(_0x14c55c[_0x2f90('0x16')][_0x2f90('0x15')]);}})[_0x2f90('0x17')](function(_0x5b57b4){logger[_0x2f90('0x13')](_0x2f90('0xf'),_0xcb143e,_0x5b57b4);_0x2d3fc3(_0x5b57b4);});});}exports[_0x2f90('0x18')]=function(_0x41fe33){var _0x17925f=this;return new Promise(function(_0xe9a96f,_0xffd0f8){return db['SquareMessage'][_0x2f90('0x19')](_0x41fe33['body'],{'raw':_0x41fe33['options']?_0x41fe33[_0x2f90('0x1a')][_0x2f90('0x1b')]===undefined?!![]:![]:!![]})[_0x2f90('0xd')](function(_0x5e92d2){logger[_0x2f90('0xe')](_0x2f90('0x18'),_0x41fe33);logger[_0x2f90('0x11')](_0x2f90('0x18'),_0x41fe33,JSON[_0x2f90('0x1c')](_0x5e92d2));_0xe9a96f(_0x5e92d2);})[_0x2f90('0x17')](function(_0x1f77a1){logger[_0x2f90('0x13')](_0x2f90('0x18'),_0x1f77a1[_0x2f90('0x15')],_0x41fe33);_0xffd0f8(_0x17925f[_0x2f90('0x13')](0x1f4,_0x1f77a1[_0x2f90('0x15')]));});});}; \ No newline at end of file +var _0xfb98=['error','message','result','SquareMessage','body','options','raw','CreateSquareMessage','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','SquareMessage,\x20%s,\x20%s','debug','SquareMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x5192de,_0x4e91cd){var _0x4e287e=function(_0x3639bc){while(--_0x3639bc){_0x5192de['push'](_0x5192de['shift']());}};_0x4e287e(++_0x4e91cd);}(_0xfb98,0x9f));var _0x8fb9=function(_0x408bfb,_0x2c2919){_0x408bfb=_0x408bfb-0x0;var _0x53efbd=_0xfb98[_0x408bfb];return _0x53efbd;};'use strict';var _=require(_0x8fb9('0x0'));var util=require(_0x8fb9('0x1'));var moment=require(_0x8fb9('0x2'));var BPromise=require(_0x8fb9('0x3'));var rs=require(_0x8fb9('0x4'));var fs=require('fs');var Redis=require(_0x8fb9('0x5'));var db=require(_0x8fb9('0x6'))['db'];var utils=require(_0x8fb9('0x7'));var logger=require(_0x8fb9('0x8'))(_0x8fb9('0x9'));var config=require('../../config/environment');var jayson=require(_0x8fb9('0xa'));var client=jayson[_0x8fb9('0xb')][_0x8fb9('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x20a163,_0x5befcf,_0x36cdff){return new BPromise(function(_0x59f0ce,_0x5aed15){return client[_0x8fb9('0xd')](_0x20a163,_0x36cdff)[_0x8fb9('0xe')](function(_0x1bc6f7){logger[_0x8fb9('0xf')](_0x8fb9('0x10'),_0x5befcf,'request\x20sent');logger[_0x8fb9('0x11')](_0x8fb9('0x12'),_0x5befcf,_0x8fb9('0x13'),JSON[_0x8fb9('0x14')](_0x1bc6f7));if(_0x1bc6f7[_0x8fb9('0x15')]){if(_0x1bc6f7[_0x8fb9('0x15')]['code']===0x1f4){logger[_0x8fb9('0x15')](_0x8fb9('0x10'),_0x5befcf,_0x1bc6f7[_0x8fb9('0x15')][_0x8fb9('0x16')]);return _0x5aed15(_0x1bc6f7['error']['message']);}logger['error'](_0x8fb9('0x10'),_0x5befcf,_0x1bc6f7['error'][_0x8fb9('0x16')]);return _0x59f0ce(_0x1bc6f7[_0x8fb9('0x15')][_0x8fb9('0x16')]);}else{logger[_0x8fb9('0xf')]('SquareMessage,\x20%s,\x20%s',_0x5befcf,_0x8fb9('0x13'));_0x59f0ce(_0x1bc6f7[_0x8fb9('0x17')][_0x8fb9('0x16')]);}})['catch'](function(_0x457a8f){logger[_0x8fb9('0x15')]('SquareMessage,\x20%s,\x20%s',_0x5befcf,_0x457a8f);_0x5aed15(_0x457a8f);});});}exports['CreateSquareMessage']=function(_0x43c66c){var _0x4f257a=this;return new Promise(function(_0x1b3b27,_0x43e0af){return db[_0x8fb9('0x18')]['create'](_0x43c66c[_0x8fb9('0x19')],{'raw':_0x43c66c[_0x8fb9('0x1a')]?_0x43c66c[_0x8fb9('0x1a')][_0x8fb9('0x1b')]===undefined?!![]:![]:!![]})[_0x8fb9('0xe')](function(_0x3ec383){logger['info'](_0x8fb9('0x1c'),_0x43c66c);logger[_0x8fb9('0x11')](_0x8fb9('0x1c'),_0x43c66c,JSON[_0x8fb9('0x14')](_0x3ec383));_0x1b3b27(_0x3ec383);})[_0x8fb9('0x1d')](function(_0xeabff){logger['error'](_0x8fb9('0x1c'),_0xeabff[_0x8fb9('0x16')],_0x43c66c);_0x43e0af(_0x4f257a['error'](0x1f4,_0xeabff['message']));});});}; \ No newline at end of file diff --git a/server/api/squareOdbc/index.js b/server/api/squareOdbc/index.js index ddf8b13..a723ed3 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 _0x801d=['../../components/auth/service','../../components/interaction/service','../../config/environment','get','/:id','isAuthenticated','show','/:id/test','15s','test','create','update','destroy','exports','multer','util','connect-timeout','express','Router'];(function(_0x270dba,_0x1817d2){var _0x36b83b=function(_0x15a276){while(--_0x15a276){_0x270dba['push'](_0x270dba['shift']());}};_0x36b83b(++_0x1817d2);}(_0x801d,0x13e));var _0xd801=function(_0x47a7d0,_0x4e182d){_0x47a7d0=_0x47a7d0-0x0;var _0xb9bd08=_0x801d[_0x47a7d0];return _0xb9bd08;};'use strict';var multer=require(_0xd801('0x0'));var util=require(_0xd801('0x1'));var path=require('path');var timeout=require(_0xd801('0x2'));var express=require(_0xd801('0x3'));var router=express[_0xd801('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xd801('0x5'));var interaction=require(_0xd801('0x6'));var config=require(_0xd801('0x7'));var controller=require('./squareOdbc.controller');router[_0xd801('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0xd801('0x8')](_0xd801('0x9'),auth[_0xd801('0xa')](),controller[_0xd801('0xb')]);router[_0xd801('0x8')](_0xd801('0xc'),auth['isAuthenticated'](),timeout(_0xd801('0xd')),controller[_0xd801('0xe')]);router['post']('/',auth[_0xd801('0xa')](),controller[_0xd801('0xf')]);router['put'](_0xd801('0x9'),auth[_0xd801('0xa')](),controller[_0xd801('0x10')]);router['delete'](_0xd801('0x9'),auth[_0xd801('0xa')](),controller[_0xd801('0x11')]);module[_0xd801('0x12')]=router; \ No newline at end of file +var _0x5664=['test','post','create','update','delete','exports','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','/:id/test'];(function(_0x4cf98e,_0xba4b79){var _0x1623ac=function(_0x459bc0){while(--_0x459bc0){_0x4cf98e['push'](_0x4cf98e['shift']());}};_0x1623ac(++_0xba4b79);}(_0x5664,0x65));var _0x4566=function(_0x1bb58c,_0x2c8a4d){_0x1bb58c=_0x1bb58c-0x0;var _0x277586=_0x5664[_0x1bb58c];return _0x277586;};'use strict';var multer=require('multer');var util=require(_0x4566('0x0'));var path=require(_0x4566('0x1'));var timeout=require(_0x4566('0x2'));var express=require(_0x4566('0x3'));var router=express['Router']();var fs_extra=require(_0x4566('0x4'));var auth=require(_0x4566('0x5'));var interaction=require(_0x4566('0x6'));var config=require(_0x4566('0x7'));var controller=require('./squareOdbc.controller');router[_0x4566('0x8')]('/',auth[_0x4566('0x9')](),controller[_0x4566('0xa')]);router[_0x4566('0x8')](_0x4566('0xb'),auth[_0x4566('0x9')](),controller['show']);router[_0x4566('0x8')](_0x4566('0xc'),auth[_0x4566('0x9')](),timeout('15s'),controller[_0x4566('0xd')]);router[_0x4566('0xe')]('/',auth[_0x4566('0x9')](),controller[_0x4566('0xf')]);router['put'](_0x4566('0xb'),auth['isAuthenticated'](),controller[_0x4566('0x10')]);router[_0x4566('0x11')](_0x4566('0xb'),auth['isAuthenticated'](),controller['destroy']);module[_0x4566('0x12')]=router; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.attributes.js b/server/api/squareOdbc/squareOdbc.attributes.js index b6fff2e..8883820 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 _0x6fe1=['exports','STRING','sequelize'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x6fe1,0xd7));var _0x16fe=function(_0x235f49,_0x2992b4){_0x235f49=_0x235f49-0x0;var _0x551139=_0x6fe1[_0x235f49];return _0x551139;};'use strict';var Sequelize=require(_0x16fe('0x0'));module[_0x16fe('0x1')]={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![]},'dsn':{'type':Sequelize[_0x16fe('0x2')]},'description':{'type':Sequelize[_0x16fe('0x2')]}}; \ No newline at end of file +var _0xd6aa=['exports','STRING','name','sequelize'];(function(_0x1e4360,_0x930b9b){var _0x31e6b4=function(_0x49dd8e){while(--_0x49dd8e){_0x1e4360['push'](_0x1e4360['shift']());}};_0x31e6b4(++_0x930b9b);}(_0xd6aa,0x137));var _0xad6a=function(_0x1b3aa1,_0x282743){_0x1b3aa1=_0x1b3aa1-0x0;var _0x5ef553=_0xd6aa[_0x1b3aa1];return _0x5ef553;};'use strict';var Sequelize=require(_0xad6a('0x0'));module[_0xad6a('0x1')]={'name':{'type':Sequelize[_0xad6a('0x2')],'unique':_0xad6a('0x3'),'allowNull':![]},'dsn':{'type':Sequelize[_0xad6a('0x2')]},'description':{'type':Sequelize[_0xad6a('0x2')]}}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.controller.js b/server/api/squareOdbc/squareOdbc.controller.js index 84dd13e..d8b4e4f 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 _0x8637=['name','send','index','map','SquareOdbc','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','findAll','rows','catch','show','params','fields','includeAll','include','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','test','dsn','odbc','openSync','eml-format','rimraf','request-promise','bluebird','mustache','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','../../mysqldb','status','end','json','undefined','count','offset','limit','set','Content-Range','apply','save','destroy','then','get','UserProfileResource','sendStatus','error','stack'];(function(_0x3a5c58,_0x2bdaac){var _0x9e5314=function(_0xc68992){while(--_0xc68992){_0x3a5c58['push'](_0x3a5c58['shift']());}};_0x9e5314(++_0x2bdaac);}(_0x8637,0x194));var _0x7863=function(_0x2f1211,_0x525ba2){_0x2f1211=_0x2f1211-0x0;var _0x2bb871=_0x8637[_0x2f1211];return _0x2bb871;};'use strict';var emlformat=require(_0x7863('0x0'));var rimraf=require(_0x7863('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x7863('0x2'));var moment=require('moment');var BPromise=require(_0x7863('0x3'));var Mustache=require(_0x7863('0x4'));var util=require('util');var path=require(_0x7863('0x5'));var sox=require('sox');var csv=require(_0x7863('0x6'));var ejs=require(_0x7863('0x7'));var fs=require('fs');var fs_extra=require(_0x7863('0x8'));var _=require(_0x7863('0x9'));var squel=require(_0x7863('0xa'));var crypto=require(_0x7863('0xb'));var jsforce=require(_0x7863('0xc'));var deskjs=require(_0x7863('0xd'));var toCsv=require(_0x7863('0x6'));var querystring=require(_0x7863('0xe'));var Papa=require(_0x7863('0xf'));var Redis=require(_0x7863('0x10'));var authService=require(_0x7863('0x11'));var qs=require(_0x7863('0x12'));var as=require(_0x7863('0x13'));var hardwareService=require(_0x7863('0x14'));var logger=require(_0x7863('0x15'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x7863('0x16'))['db'];function respondWithStatusCode(_0x3851d8,_0x1543c9){_0x1543c9=_0x1543c9||0xcc;return function(_0x1ef6ab){if(_0x1ef6ab){return _0x3851d8['sendStatus'](_0x1543c9);}return _0x3851d8[_0x7863('0x17')](_0x1543c9)[_0x7863('0x18')]();};}function respondWithResult(_0x551f18,_0x2a0715){_0x2a0715=_0x2a0715||0xc8;return function(_0x152017){if(_0x152017){return _0x551f18[_0x7863('0x17')](_0x2a0715)[_0x7863('0x19')](_0x152017);}};}function respondWithFilteredResult(_0x54d315,_0x5a157b){return function(_0x5451a4){if(_0x5451a4){var _0x2bcded=typeof _0x5a157b['offset']==='undefined'&&typeof _0x5a157b['limit']===_0x7863('0x1a');var _0x926119=_0x5451a4[_0x7863('0x1b')];var _0x41da96=_0x2bcded?0x0:_0x5a157b[_0x7863('0x1c')];var _0x597dfe=_0x2bcded?_0x5451a4['count']:_0x5a157b[_0x7863('0x1c')]+_0x5a157b[_0x7863('0x1d')];var _0x194b63;if(_0x597dfe>=_0x926119){_0x597dfe=_0x926119;_0x194b63=0xc8;}else{_0x194b63=0xce;}_0x54d315[_0x7863('0x17')](_0x194b63);return _0x54d315[_0x7863('0x1e')](_0x7863('0x1f'),_0x41da96+'-'+_0x597dfe+'/'+_0x926119)['json'](_0x5451a4);}return null;};}function patchUpdates(_0x2f58ad){return function(_0x22b219){try{jsonpatch[_0x7863('0x20')](_0x22b219,_0x2f58ad,!![]);}catch(_0x432f85){return BPromise['reject'](_0x432f85);}return _0x22b219[_0x7863('0x21')]();};}function saveUpdates(_0x4a6cb7,_0x4fdd6b){return function(_0x6dcedc){if(_0x6dcedc){return _0x6dcedc['update'](_0x4a6cb7)['then'](function(_0x33df21){return _0x33df21;});}return null;};}function removeEntity(_0x9c7945,_0x55b16e){return function(_0x56996c){if(_0x56996c){return _0x56996c[_0x7863('0x22')]()[_0x7863('0x23')](function(){var _0x232697=_0x56996c[_0x7863('0x24')]({'plain':!![]});var _0x4bb70a='ODBC';return db[_0x7863('0x25')][_0x7863('0x22')]({'where':{'type':_0x4bb70a,'resourceId':_0x232697['id']}})[_0x7863('0x23')](function(){return _0x56996c;});})['then'](function(){_0x9c7945[_0x7863('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x23bf75,_0x3abb0d){return function(_0x2d9d84){if(!_0x2d9d84){_0x23bf75[_0x7863('0x26')](0x194);}return _0x2d9d84;};}function handleError(_0xe38653,_0x1e3fb9){_0x1e3fb9=_0x1e3fb9||0x1f4;return function(_0x1c7801){logger[_0x7863('0x27')](_0x1c7801[_0x7863('0x28')]);if(_0x1c7801[_0x7863('0x29')]){delete _0x1c7801[_0x7863('0x29')];}_0xe38653[_0x7863('0x17')](_0x1e3fb9)[_0x7863('0x2a')](_0x1c7801);};}exports[_0x7863('0x2b')]=function(_0x518c7a,_0x1e8bd0){var _0x29685c={},_0x590b3b={},_0xb096a4={'count':0x0,'rows':[]};var _0x56bc95=_[_0x7863('0x2c')](db[_0x7863('0x2d')][_0x7863('0x2e')],function(_0x10fa9b){return{'name':_0x10fa9b[_0x7863('0x2f')],'type':_0x10fa9b[_0x7863('0x30')]['key']};});_0x590b3b[_0x7863('0x31')]=_['map'](_0x56bc95,_0x7863('0x29'));_0x590b3b[_0x7863('0x32')]=_[_0x7863('0x33')](_0x518c7a[_0x7863('0x32')]);_0x590b3b[_0x7863('0x34')]=_[_0x7863('0x35')](_0x590b3b[_0x7863('0x31')],_0x590b3b[_0x7863('0x32')]);_0x29685c['attributes']=_[_0x7863('0x35')](_0x590b3b['model'],qs['fields'](_0x518c7a['query']['fields']));_0x29685c[_0x7863('0x36')]=_0x29685c['attributes'][_0x7863('0x37')]?_0x29685c[_0x7863('0x36')]:_0x590b3b[_0x7863('0x31')];if(!_0x518c7a[_0x7863('0x32')][_0x7863('0x38')](_0x7863('0x39'))){_0x29685c[_0x7863('0x1d')]=qs['limit'](_0x518c7a['query'][_0x7863('0x1d')]);_0x29685c[_0x7863('0x1c')]=qs['offset'](_0x518c7a['query']['offset']);}_0x29685c[_0x7863('0x3a')]=qs[_0x7863('0x3b')](_0x518c7a[_0x7863('0x32')][_0x7863('0x3b')]);_0x29685c[_0x7863('0x3c')]=qs[_0x7863('0x34')](_[_0x7863('0x3d')](_0x518c7a[_0x7863('0x32')],_0x590b3b['filters']),_0x56bc95);if(_0x518c7a[_0x7863('0x32')][_0x7863('0x3e')]){_0x29685c['where']=_[_0x7863('0x3f')](_0x29685c[_0x7863('0x3c')],{'$or':_[_0x7863('0x2c')](_0x56bc95,function(_0x3413e6){if(_0x3413e6[_0x7863('0x30')]!==_0x7863('0x40')){var _0xc5a9e={};_0xc5a9e[_0x3413e6['name']]={'$like':'%'+_0x518c7a[_0x7863('0x32')]['filter']+'%'};return _0xc5a9e;}})});}_0x29685c=_[_0x7863('0x3f')]({},_0x29685c,_0x518c7a[_0x7863('0x41')]);var _0x5e2c07={'where':_0x29685c['where']};return db['SquareOdbc'][_0x7863('0x1b')](_0x5e2c07)[_0x7863('0x23')](function(_0x4d4f0a){_0xb096a4['count']=_0x4d4f0a;if(_0x518c7a[_0x7863('0x32')]['includeAll']){_0x29685c['include']=[{'all':!![]}];}return db[_0x7863('0x2d')][_0x7863('0x42')](_0x29685c);})['then'](function(_0x54c4d6){_0xb096a4[_0x7863('0x43')]=_0x54c4d6;return _0xb096a4;})[_0x7863('0x23')](respondWithFilteredResult(_0x1e8bd0,_0x29685c))[_0x7863('0x44')](handleError(_0x1e8bd0,null));};exports[_0x7863('0x45')]=function(_0x5b57bc,_0x4f2569){var _0x248256={'raw':!![],'where':{'id':_0x5b57bc[_0x7863('0x46')]['id']}},_0x1010b7={};_0x1010b7[_0x7863('0x31')]=_[_0x7863('0x33')](db['SquareOdbc'][_0x7863('0x2e')]);_0x1010b7[_0x7863('0x32')]=_[_0x7863('0x33')](_0x5b57bc[_0x7863('0x32')]);_0x1010b7[_0x7863('0x34')]=_['intersection'](_0x1010b7[_0x7863('0x31')],_0x1010b7['query']);_0x248256[_0x7863('0x36')]=_[_0x7863('0x35')](_0x1010b7['model'],qs['fields'](_0x5b57bc[_0x7863('0x32')][_0x7863('0x47')]));_0x248256['attributes']=_0x248256['attributes'][_0x7863('0x37')]?_0x248256[_0x7863('0x36')]:_0x1010b7[_0x7863('0x31')];if(_0x5b57bc[_0x7863('0x32')][_0x7863('0x48')]){_0x248256[_0x7863('0x49')]=[{'all':!![]}];}_0x248256=_[_0x7863('0x3f')]({},_0x248256,_0x5b57bc[_0x7863('0x41')]);return db[_0x7863('0x2d')]['find'](_0x248256)[_0x7863('0x23')](handleEntityNotFound(_0x4f2569,null))[_0x7863('0x23')](respondWithResult(_0x4f2569,null))[_0x7863('0x44')](handleError(_0x4f2569,null));};exports[_0x7863('0x4a')]=function(_0x5e2678,_0x1e2e6f){return db[_0x7863('0x2d')][_0x7863('0x4a')](_0x5e2678[_0x7863('0x4b')],{})['then'](function(_0x1cd8a7){var _0x4fd9a9=_0x5e2678[_0x7863('0x4c')][_0x7863('0x24')]({'plain':!![]});if(!_0x4fd9a9)throw new Error(_0x7863('0x4d'));if(_0x4fd9a9[_0x7863('0x4e')]===_0x7863('0x4c')){var _0x2156dc=_0x1cd8a7[_0x7863('0x24')]({'plain':!![]});var _0x3f24f7='ODBC';return db[_0x7863('0x4f')][_0x7863('0x50')]({'where':{'name':_0x3f24f7,'userProfileId':_0x4fd9a9[_0x7863('0x51')]},'raw':!![]})[_0x7863('0x23')](function(_0x484933){if(_0x484933&&_0x484933[_0x7863('0x52')]===0x0){return db['UserProfileResource'][_0x7863('0x4a')]({'name':_0x2156dc[_0x7863('0x29')],'resourceId':_0x2156dc['id'],'type':_0x484933[_0x7863('0x29')],'sectionId':_0x484933['id']},{})['then'](function(){return _0x1cd8a7;});}else{return _0x1cd8a7;}})[_0x7863('0x44')](function(_0x52d138){logger[_0x7863('0x27')](_0x7863('0x53'),_0x52d138);throw _0x52d138;});}return _0x1cd8a7;})['then'](respondWithResult(_0x1e2e6f,0xc9))[_0x7863('0x44')](handleError(_0x1e2e6f,null));};exports[_0x7863('0x54')]=function(_0x2debf4,_0x5d6e6f){if(_0x2debf4[_0x7863('0x4b')]['id']){delete _0x2debf4['body']['id'];}return db[_0x7863('0x2d')]['find']({'where':{'id':_0x2debf4[_0x7863('0x46')]['id']}})['then'](handleEntityNotFound(_0x5d6e6f,null))[_0x7863('0x23')](saveUpdates(_0x2debf4[_0x7863('0x4b')],null))[_0x7863('0x23')](respondWithResult(_0x5d6e6f,null))[_0x7863('0x44')](handleError(_0x5d6e6f,null));};exports[_0x7863('0x22')]=function(_0x10ee37,_0x536235){return db[_0x7863('0x2d')][_0x7863('0x50')]({'where':{'id':_0x10ee37['params']['id']}})[_0x7863('0x23')](handleEntityNotFound(_0x536235,null))[_0x7863('0x23')](removeEntity(_0x536235,null))[_0x7863('0x44')](handleError(_0x536235,null));};exports[_0x7863('0x55')]=function(_0x4a3ce8,_0x31beb3,_0x5371e2){var _0x3d6cab;return db[_0x7863('0x2d')]['find']({'where':{'id':_0x4a3ce8[_0x7863('0x46')]['id']},'attributes':['id',_0x7863('0x56')]})[_0x7863('0x23')](handleEntityNotFound(_0x31beb3,null))['then'](function(_0x281a30){if(_0x281a30){var _0x36aeb3=require(_0x7863('0x57'))();_0x36aeb3[_0x7863('0x58')](_0x281a30[_0x7863('0x56')]);_0x36aeb3['closeSync']();return _0x281a30;}})[_0x7863('0x23')](respondWithResult(_0x31beb3,null))[_0x7863('0x44')](handleError(_0x31beb3,null));}; \ No newline at end of file +var _0x7fe4=['test','odbc','openSync','dsn','closeSync','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','get','ODBC','UserProfileResource','destroy','sendStatus','error','stack','name','send','map','SquareOdbc','rawAttributes','type','model','query','keys','attributes','intersection','fields','nolimit','order','sort','filters','where','merge','filter','options','includeAll','include','findAll','rows','catch','show','params','length','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s'];(function(_0x2307fa,_0x266e5e){var _0x496486=function(_0x53466e){while(--_0x53466e){_0x2307fa['push'](_0x2307fa['shift']());}};_0x496486(++_0x266e5e);}(_0x7fe4,0x1cc));var _0x47fe=function(_0x45783c,_0x49c56d){_0x45783c=_0x45783c-0x0;var _0x1161da=_0x7fe4[_0x45783c];return _0x1161da;};'use strict';var emlformat=require(_0x47fe('0x0'));var rimraf=require(_0x47fe('0x1'));var zipdir=require(_0x47fe('0x2'));var jsonpatch=require(_0x47fe('0x3'));var rp=require(_0x47fe('0x4'));var moment=require(_0x47fe('0x5'));var BPromise=require(_0x47fe('0x6'));var Mustache=require(_0x47fe('0x7'));var util=require(_0x47fe('0x8'));var path=require(_0x47fe('0x9'));var sox=require(_0x47fe('0xa'));var csv=require(_0x47fe('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x47fe('0xc'));var _=require(_0x47fe('0xd'));var squel=require(_0x47fe('0xe'));var crypto=require(_0x47fe('0xf'));var jsforce=require('jsforce');var deskjs=require(_0x47fe('0x10'));var toCsv=require(_0x47fe('0xb'));var querystring=require(_0x47fe('0x11'));var Papa=require(_0x47fe('0x12'));var Redis=require(_0x47fe('0x13'));var authService=require(_0x47fe('0x14'));var qs=require(_0x47fe('0x15'));var as=require(_0x47fe('0x16'));var hardwareService=require(_0x47fe('0x17'));var logger=require(_0x47fe('0x18'))('api');var utils=require(_0x47fe('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0x47fe('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x259637,_0xb7978d){_0xb7978d=_0xb7978d||0xcc;return function(_0x624832){if(_0x624832){return _0x259637['sendStatus'](_0xb7978d);}return _0x259637[_0x47fe('0x1b')](_0xb7978d)[_0x47fe('0x1c')]();};}function respondWithResult(_0x54681a,_0x2ed3eb){_0x2ed3eb=_0x2ed3eb||0xc8;return function(_0x1ea657){if(_0x1ea657){return _0x54681a[_0x47fe('0x1b')](_0x2ed3eb)[_0x47fe('0x1d')](_0x1ea657);}};}function respondWithFilteredResult(_0x1bdc7b,_0xe3f264){return function(_0xd49f8){if(_0xd49f8){var _0x27f74e=typeof _0xe3f264[_0x47fe('0x1e')]===_0x47fe('0x1f')&&typeof _0xe3f264[_0x47fe('0x20')]==='undefined';var _0x366b82=_0xd49f8['count'];var _0x3dc127=_0x27f74e?0x0:_0xe3f264[_0x47fe('0x1e')];var _0x1c7732=_0x27f74e?_0xd49f8[_0x47fe('0x21')]:_0xe3f264[_0x47fe('0x1e')]+_0xe3f264[_0x47fe('0x20')];var _0x5eb451;if(_0x1c7732>=_0x366b82){_0x1c7732=_0x366b82;_0x5eb451=0xc8;}else{_0x5eb451=0xce;}_0x1bdc7b['status'](_0x5eb451);return _0x1bdc7b[_0x47fe('0x22')](_0x47fe('0x23'),_0x3dc127+'-'+_0x1c7732+'/'+_0x366b82)[_0x47fe('0x1d')](_0xd49f8);}return null;};}function patchUpdates(_0x4f2375){return function(_0x989b45){try{jsonpatch[_0x47fe('0x24')](_0x989b45,_0x4f2375,!![]);}catch(_0x124176){return BPromise[_0x47fe('0x25')](_0x124176);}return _0x989b45[_0x47fe('0x26')]();};}function saveUpdates(_0x488225,_0x51b94e){return function(_0x34cc79){if(_0x34cc79){return _0x34cc79[_0x47fe('0x27')](_0x488225)['then'](function(_0x488a1a){return _0x488a1a;});}return null;};}function removeEntity(_0xf8319f,_0x4b4e38){return function(_0x5c5965){if(_0x5c5965){return _0x5c5965['destroy']()[_0x47fe('0x28')](function(){var _0x28b537=_0x5c5965[_0x47fe('0x29')]({'plain':!![]});var _0x30851e=_0x47fe('0x2a');return db[_0x47fe('0x2b')][_0x47fe('0x2c')]({'where':{'type':_0x30851e,'resourceId':_0x28b537['id']}})[_0x47fe('0x28')](function(){return _0x5c5965;});})[_0x47fe('0x28')](function(){_0xf8319f[_0x47fe('0x1b')](0xcc)[_0x47fe('0x1c')]();});}};}function handleEntityNotFound(_0x3c9a17,_0x2beb58){return function(_0x5ebab5){if(!_0x5ebab5){_0x3c9a17[_0x47fe('0x2d')](0x194);}return _0x5ebab5;};}function handleError(_0x259c1a,_0x2fb53f){_0x2fb53f=_0x2fb53f||0x1f4;return function(_0x529053){logger[_0x47fe('0x2e')](_0x529053[_0x47fe('0x2f')]);if(_0x529053['name']){delete _0x529053[_0x47fe('0x30')];}_0x259c1a[_0x47fe('0x1b')](_0x2fb53f)[_0x47fe('0x31')](_0x529053);};}exports['index']=function(_0x2fb732,_0x149342){var _0x5a2d01={},_0x1c21a1={},_0x448899={'count':0x0,'rows':[]};var _0x557b02=_[_0x47fe('0x32')](db[_0x47fe('0x33')][_0x47fe('0x34')],function(_0x1ed268){return{'name':_0x1ed268['fieldName'],'type':_0x1ed268[_0x47fe('0x35')]['key']};});_0x1c21a1[_0x47fe('0x36')]=_[_0x47fe('0x32')](_0x557b02,'name');_0x1c21a1[_0x47fe('0x37')]=_[_0x47fe('0x38')](_0x2fb732[_0x47fe('0x37')]);_0x1c21a1['filters']=_['intersection'](_0x1c21a1[_0x47fe('0x36')],_0x1c21a1[_0x47fe('0x37')]);_0x5a2d01[_0x47fe('0x39')]=_[_0x47fe('0x3a')](_0x1c21a1[_0x47fe('0x36')],qs[_0x47fe('0x3b')](_0x2fb732[_0x47fe('0x37')][_0x47fe('0x3b')]));_0x5a2d01[_0x47fe('0x39')]=_0x5a2d01[_0x47fe('0x39')]['length']?_0x5a2d01[_0x47fe('0x39')]:_0x1c21a1[_0x47fe('0x36')];if(!_0x2fb732[_0x47fe('0x37')]['hasOwnProperty'](_0x47fe('0x3c'))){_0x5a2d01[_0x47fe('0x20')]=qs['limit'](_0x2fb732[_0x47fe('0x37')][_0x47fe('0x20')]);_0x5a2d01[_0x47fe('0x1e')]=qs[_0x47fe('0x1e')](_0x2fb732[_0x47fe('0x37')][_0x47fe('0x1e')]);}_0x5a2d01[_0x47fe('0x3d')]=qs['sort'](_0x2fb732['query'][_0x47fe('0x3e')]);_0x5a2d01['where']=qs[_0x47fe('0x3f')](_['pick'](_0x2fb732['query'],_0x1c21a1[_0x47fe('0x3f')]),_0x557b02);if(_0x2fb732[_0x47fe('0x37')]['filter']){_0x5a2d01[_0x47fe('0x40')]=_[_0x47fe('0x41')](_0x5a2d01[_0x47fe('0x40')],{'$or':_[_0x47fe('0x32')](_0x557b02,function(_0x2466b1){if(_0x2466b1[_0x47fe('0x35')]!=='VIRTUAL'){var _0x3555e2={};_0x3555e2[_0x2466b1[_0x47fe('0x30')]]={'$like':'%'+_0x2fb732[_0x47fe('0x37')][_0x47fe('0x42')]+'%'};return _0x3555e2;}})});}_0x5a2d01=_[_0x47fe('0x41')]({},_0x5a2d01,_0x2fb732[_0x47fe('0x43')]);var _0x545a94={'where':_0x5a2d01['where']};return db[_0x47fe('0x33')][_0x47fe('0x21')](_0x545a94)[_0x47fe('0x28')](function(_0x4a9993){_0x448899[_0x47fe('0x21')]=_0x4a9993;if(_0x2fb732[_0x47fe('0x37')][_0x47fe('0x44')]){_0x5a2d01[_0x47fe('0x45')]=[{'all':!![]}];}return db[_0x47fe('0x33')][_0x47fe('0x46')](_0x5a2d01);})[_0x47fe('0x28')](function(_0x4af6fa){_0x448899[_0x47fe('0x47')]=_0x4af6fa;return _0x448899;})[_0x47fe('0x28')](respondWithFilteredResult(_0x149342,_0x5a2d01))[_0x47fe('0x48')](handleError(_0x149342,null));};exports[_0x47fe('0x49')]=function(_0x2cc8c3,_0x2f6dff){var _0x54e1de={'raw':!![],'where':{'id':_0x2cc8c3[_0x47fe('0x4a')]['id']}},_0xb08a31={};_0xb08a31[_0x47fe('0x36')]=_['keys'](db[_0x47fe('0x33')]['rawAttributes']);_0xb08a31[_0x47fe('0x37')]=_[_0x47fe('0x38')](_0x2cc8c3['query']);_0xb08a31['filters']=_[_0x47fe('0x3a')](_0xb08a31['model'],_0xb08a31['query']);_0x54e1de[_0x47fe('0x39')]=_['intersection'](_0xb08a31[_0x47fe('0x36')],qs[_0x47fe('0x3b')](_0x2cc8c3[_0x47fe('0x37')]['fields']));_0x54e1de[_0x47fe('0x39')]=_0x54e1de[_0x47fe('0x39')][_0x47fe('0x4b')]?_0x54e1de['attributes']:_0xb08a31[_0x47fe('0x36')];if(_0x2cc8c3[_0x47fe('0x37')][_0x47fe('0x44')]){_0x54e1de[_0x47fe('0x45')]=[{'all':!![]}];}_0x54e1de=_[_0x47fe('0x41')]({},_0x54e1de,_0x2cc8c3[_0x47fe('0x43')]);return db[_0x47fe('0x33')][_0x47fe('0x4c')](_0x54e1de)[_0x47fe('0x28')](handleEntityNotFound(_0x2f6dff,null))[_0x47fe('0x28')](respondWithResult(_0x2f6dff,null))[_0x47fe('0x48')](handleError(_0x2f6dff,null));};exports[_0x47fe('0x4d')]=function(_0x44be91,_0xb218d){return db['SquareOdbc'][_0x47fe('0x4d')](_0x44be91[_0x47fe('0x4e')],{})[_0x47fe('0x28')](function(_0x53087b){var _0xe8c536=_0x44be91['user']['get']({'plain':!![]});if(!_0xe8c536)throw new Error(_0x47fe('0x4f'));if(_0xe8c536[_0x47fe('0x50')]===_0x47fe('0x51')){var _0xc75ad0=_0x53087b[_0x47fe('0x29')]({'plain':!![]});var _0xbb0568=_0x47fe('0x2a');return db[_0x47fe('0x52')][_0x47fe('0x4c')]({'where':{'name':_0xbb0568,'userProfileId':_0xe8c536[_0x47fe('0x53')]},'raw':!![]})[_0x47fe('0x28')](function(_0x4b2a1f){if(_0x4b2a1f&&_0x4b2a1f[_0x47fe('0x54')]===0x0){return db['UserProfileResource']['create']({'name':_0xc75ad0[_0x47fe('0x30')],'resourceId':_0xc75ad0['id'],'type':_0x4b2a1f[_0x47fe('0x30')],'sectionId':_0x4b2a1f['id']},{})[_0x47fe('0x28')](function(){return _0x53087b;});}else{return _0x53087b;}})[_0x47fe('0x48')](function(_0x10d82e){logger[_0x47fe('0x2e')](_0x47fe('0x55'),_0x10d82e);throw _0x10d82e;});}return _0x53087b;})[_0x47fe('0x28')](respondWithResult(_0xb218d,0xc9))[_0x47fe('0x48')](handleError(_0xb218d,null));};exports[_0x47fe('0x27')]=function(_0x336e82,_0x1e86b4){if(_0x336e82[_0x47fe('0x4e')]['id']){delete _0x336e82[_0x47fe('0x4e')]['id'];}return db[_0x47fe('0x33')]['find']({'where':{'id':_0x336e82['params']['id']}})[_0x47fe('0x28')](handleEntityNotFound(_0x1e86b4,null))[_0x47fe('0x28')](saveUpdates(_0x336e82['body'],null))[_0x47fe('0x28')](respondWithResult(_0x1e86b4,null))['catch'](handleError(_0x1e86b4,null));};exports['destroy']=function(_0x3853f7,_0x263a55){return db['SquareOdbc']['find']({'where':{'id':_0x3853f7[_0x47fe('0x4a')]['id']}})[_0x47fe('0x28')](handleEntityNotFound(_0x263a55,null))[_0x47fe('0x28')](removeEntity(_0x263a55,null))[_0x47fe('0x48')](handleError(_0x263a55,null));};exports[_0x47fe('0x56')]=function(_0x17c20d,_0x48bf19,_0x52b560){var _0x353d73;return db[_0x47fe('0x33')][_0x47fe('0x4c')]({'where':{'id':_0x17c20d['params']['id']},'attributes':['id','dsn']})[_0x47fe('0x28')](handleEntityNotFound(_0x48bf19,null))[_0x47fe('0x28')](function(_0x3da73b){if(_0x3da73b){var _0x3504a2=require(_0x47fe('0x57'))();_0x3504a2[_0x47fe('0x58')](_0x3da73b[_0x47fe('0x59')]);_0x3504a2[_0x47fe('0x5a')]();return _0x3da73b;}})['then'](respondWithResult(_0x48bf19,null))[_0x47fe('0x48')](handleError(_0x48bf19,null));}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.model.js b/server/api/squareOdbc/squareOdbc.model.js index 5bf03c1..bb882f9 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 _0x63d3=['../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./squareOdbc.attributes','exports','define','SquareOdbc','square_odbc','lodash','util'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x63d3,0x1d2));var _0x363d=function(_0x4c71f0,_0x52151f){_0x4c71f0=_0x4c71f0-0x0;var _0x2ceb53=_0x63d3[_0x4c71f0];return _0x2ceb53;};'use strict';var _=require(_0x363d('0x0'));var util=require(_0x363d('0x1'));var logger=require(_0x363d('0x2'))(_0x363d('0x3'));var moment=require('moment');var BPromise=require(_0x363d('0x4'));var rp=require(_0x363d('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x363d('0x6'));var config=require(_0x363d('0x7'));var attributes=require(_0x363d('0x8'));module[_0x363d('0x9')]=function(_0x3704df,_0x282354){return _0x3704df[_0x363d('0xa')](_0x363d('0xb'),attributes,{'tableName':_0x363d('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1213=['bluebird','path','rimraf','../../config/environment','./squareOdbc.attributes','exports','define','square_odbc','lodash','util','api'];(function(_0x477c9e,_0x3a5b92){var _0x3dc0e4=function(_0x16c08b){while(--_0x16c08b){_0x477c9e['push'](_0x477c9e['shift']());}};_0x3dc0e4(++_0x3a5b92);}(_0x1213,0xb8));var _0x3121=function(_0x447725,_0x49753b){_0x447725=_0x447725-0x0;var _0x399167=_0x1213[_0x447725];return _0x399167;};'use strict';var _=require(_0x3121('0x0'));var util=require(_0x3121('0x1'));var logger=require('../../config/logger')(_0x3121('0x2'));var moment=require('moment');var BPromise=require(_0x3121('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3121('0x4'));var rimraf=require(_0x3121('0x5'));var config=require(_0x3121('0x6'));var attributes=require(_0x3121('0x7'));module[_0x3121('0x8')]=function(_0x516782,_0x2965db){return _0x516782[_0x3121('0x9')]('SquareOdbc',attributes,{'tableName':_0x3121('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.rpc.js b/server/api/squareOdbc/squareOdbc.rpc.js index 2ded93b..22555b7 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 _0xe479=['SquareOdbc,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','ShowSquareOdbc','SquareOdbc','options','attributes','include','model','map','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','then','info','SquareOdbc,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x57add2,_0x4f2b7d){var _0x4e3670=function(_0x3311b){while(--_0x3311b){_0x57add2['push'](_0x57add2['shift']());}};_0x4e3670(++_0x4f2b7d);}(_0xe479,0x1a1));var _0x9e47=function(_0x450a58,_0x208941){_0x450a58=_0x450a58-0x0;var _0x2e249e=_0xe479[_0x450a58];return _0x2e249e;};'use strict';var _=require(_0x9e47('0x0'));var util=require(_0x9e47('0x1'));var moment=require(_0x9e47('0x2'));var BPromise=require(_0x9e47('0x3'));var rs=require(_0x9e47('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9e47('0x5'))['db'];var utils=require(_0x9e47('0x6'));var logger=require('../../config/logger')(_0x9e47('0x7'));var config=require('../../config/environment');var jayson=require(_0x9e47('0x8'));var client=jayson[_0x9e47('0x9')][_0x9e47('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x381661,_0x5afe4b,_0x2aef3f){return new BPromise(function(_0x4bb1e1,_0x3d6b1e){return client[_0x9e47('0xb')](_0x381661,_0x2aef3f)[_0x9e47('0xc')](function(_0x50b7cc){logger[_0x9e47('0xd')](_0x9e47('0xe'),_0x5afe4b,_0x9e47('0xf'));logger[_0x9e47('0x10')](_0x9e47('0x11'),_0x5afe4b,_0x9e47('0xf'),JSON[_0x9e47('0x12')](_0x50b7cc));if(_0x50b7cc['error']){if(_0x50b7cc['error'][_0x9e47('0x13')]===0x1f4){logger[_0x9e47('0x14')](_0x9e47('0xe'),_0x5afe4b,_0x50b7cc[_0x9e47('0x14')][_0x9e47('0x15')]);return _0x3d6b1e(_0x50b7cc[_0x9e47('0x14')]['message']);}logger['error']('SquareOdbc,\x20%s,\x20%s',_0x5afe4b,_0x50b7cc[_0x9e47('0x14')]['message']);return _0x4bb1e1(_0x50b7cc[_0x9e47('0x14')][_0x9e47('0x15')]);}else{logger[_0x9e47('0xd')](_0x9e47('0xe'),_0x5afe4b,_0x9e47('0xf'));_0x4bb1e1(_0x50b7cc[_0x9e47('0x16')][_0x9e47('0x15')]);}})['catch'](function(_0x56901a){logger['error']('SquareOdbc,\x20%s,\x20%s',_0x5afe4b,_0x56901a);_0x3d6b1e(_0x56901a);});});}exports[_0x9e47('0x17')]=function(_0x1fcecf){var _0x4db743=this;return new Promise(function(_0x1b5ce2,_0x3be4ce){return db[_0x9e47('0x18')]['find']({'raw':_0x1fcecf[_0x9e47('0x19')]?_0x1fcecf[_0x9e47('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x1fcecf[_0x9e47('0x19')]?_0x1fcecf[_0x9e47('0x19')]['where']||null:null,'attributes':_0x1fcecf['options']?_0x1fcecf[_0x9e47('0x19')][_0x9e47('0x1a')]||null:null,'include':_0x1fcecf[_0x9e47('0x19')]?_0x1fcecf['options']['include']?_['map'](_0x1fcecf[_0x9e47('0x19')][_0x9e47('0x1b')],function(_0x53026b){return{'model':db[_0x53026b[_0x9e47('0x1c')]],'as':_0x53026b['as'],'attributes':_0x53026b[_0x9e47('0x1a')],'include':_0x53026b[_0x9e47('0x1b')]?_[_0x9e47('0x1d')](_0x53026b[_0x9e47('0x1b')],function(_0x271c6e){return{'model':db[_0x271c6e[_0x9e47('0x1c')]],'as':_0x271c6e['as'],'attributes':_0x271c6e[_0x9e47('0x1a')],'include':_0x271c6e[_0x9e47('0x1b')]?_['map'](_0x271c6e[_0x9e47('0x1b')],function(_0x5f0eee){return{'model':db[_0x5f0eee[_0x9e47('0x1c')]],'as':_0x5f0eee['as'],'attributes':_0x5f0eee['attributes']};}):[]};}):[]};}):[]:[]})[_0x9e47('0xc')](function(_0x48ba06){logger[_0x9e47('0xd')](_0x9e47('0x17'),_0x1fcecf);logger[_0x9e47('0x10')]('ShowSquareOdbc',_0x1fcecf,JSON[_0x9e47('0x12')](_0x48ba06));_0x1b5ce2(_0x48ba06);})[_0x9e47('0x1e')](function(_0x33720e){logger['error']('ShowSquareOdbc',_0x33720e['message'],_0x1fcecf);_0x3be4ce(_0x4db743[_0x9e47('0x14')](0x1f4,_0x33720e[_0x9e47('0x15')]));});});}; \ No newline at end of file +var _0x5b81=['attributes','include','map','model','debug','lodash','moment','ioredis','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','info','SquareOdbc,\x20%s,\x20%s','SquareOdbc,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','ShowSquareOdbc','SquareOdbc','find','options','raw','where'];(function(_0x36eb8d,_0x1a4ee5){var _0x271aab=function(_0x12d1fb){while(--_0x12d1fb){_0x36eb8d['push'](_0x36eb8d['shift']());}};_0x271aab(++_0x1a4ee5);}(_0x5b81,0x13b));var _0x15b8=function(_0x4c15f1,_0x2f056c){_0x4c15f1=_0x4c15f1-0x0;var _0xc81295=_0x5b81[_0x4c15f1];return _0xc81295;};'use strict';var _=require(_0x15b8('0x0'));var util=require('util');var moment=require(_0x15b8('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x15b8('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x15b8('0x3'));var logger=require('../../config/logger')('rpc');var config=require(_0x15b8('0x4'));var jayson=require(_0x15b8('0x5'));var client=jayson[_0x15b8('0x6')][_0x15b8('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x5f36d5,_0x251205,_0x4b4197){return new BPromise(function(_0x36d1e2,_0x2127c3){return client[_0x15b8('0x8')](_0x5f36d5,_0x4b4197)[_0x15b8('0x9')](function(_0x5cb2d5){logger[_0x15b8('0xa')](_0x15b8('0xb'),_0x251205,'request\x20sent');logger['debug'](_0x15b8('0xc'),_0x251205,_0x15b8('0xd'),JSON[_0x15b8('0xe')](_0x5cb2d5));if(_0x5cb2d5[_0x15b8('0xf')]){if(_0x5cb2d5['error'][_0x15b8('0x10')]===0x1f4){logger[_0x15b8('0xf')](_0x15b8('0xb'),_0x251205,_0x5cb2d5[_0x15b8('0xf')][_0x15b8('0x11')]);return _0x2127c3(_0x5cb2d5[_0x15b8('0xf')]['message']);}logger[_0x15b8('0xf')](_0x15b8('0xb'),_0x251205,_0x5cb2d5[_0x15b8('0xf')][_0x15b8('0x11')]);return _0x36d1e2(_0x5cb2d5[_0x15b8('0xf')][_0x15b8('0x11')]);}else{logger['info']('SquareOdbc,\x20%s,\x20%s',_0x251205,_0x15b8('0xd'));_0x36d1e2(_0x5cb2d5[_0x15b8('0x12')][_0x15b8('0x11')]);}})[_0x15b8('0x13')](function(_0x54fb21){logger[_0x15b8('0xf')](_0x15b8('0xb'),_0x251205,_0x54fb21);_0x2127c3(_0x54fb21);});});}exports[_0x15b8('0x14')]=function(_0x54be04){var _0x571aa6=this;return new Promise(function(_0xedd58d,_0x432b1f){return db[_0x15b8('0x15')][_0x15b8('0x16')]({'raw':_0x54be04[_0x15b8('0x17')]?_0x54be04['options'][_0x15b8('0x18')]===undefined?!![]:![]:!![],'where':_0x54be04[_0x15b8('0x17')]?_0x54be04['options'][_0x15b8('0x19')]||null:null,'attributes':_0x54be04[_0x15b8('0x17')]?_0x54be04[_0x15b8('0x17')][_0x15b8('0x1a')]||null:null,'include':_0x54be04[_0x15b8('0x17')]?_0x54be04[_0x15b8('0x17')][_0x15b8('0x1b')]?_[_0x15b8('0x1c')](_0x54be04['options'][_0x15b8('0x1b')],function(_0x51c611){return{'model':db[_0x51c611['model']],'as':_0x51c611['as'],'attributes':_0x51c611[_0x15b8('0x1a')],'include':_0x51c611[_0x15b8('0x1b')]?_['map'](_0x51c611[_0x15b8('0x1b')],function(_0x222ae7){return{'model':db[_0x222ae7[_0x15b8('0x1d')]],'as':_0x222ae7['as'],'attributes':_0x222ae7[_0x15b8('0x1a')],'include':_0x222ae7[_0x15b8('0x1b')]?_[_0x15b8('0x1c')](_0x222ae7[_0x15b8('0x1b')],function(_0x511729){return{'model':db[_0x511729[_0x15b8('0x1d')]],'as':_0x511729['as'],'attributes':_0x511729[_0x15b8('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x15b8('0x9')](function(_0x4ba9a4){logger[_0x15b8('0xa')]('ShowSquareOdbc',_0x54be04);logger[_0x15b8('0x1e')](_0x15b8('0x14'),_0x54be04,JSON[_0x15b8('0xe')](_0x4ba9a4));_0xedd58d(_0x4ba9a4);})[_0x15b8('0x13')](function(_0x3514e3){logger[_0x15b8('0xf')](_0x15b8('0x14'),_0x3514e3[_0x15b8('0x11')],_0x54be04);_0x432b1f(_0x571aa6[_0x15b8('0xf')](0x1f4,_0x3514e3['message']));});});}; \ No newline at end of file diff --git a/server/api/squareProject/index.js b/server/api/squareProject/index.js index 6a4b942..9a632a0 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 _0xd4d1=['exports','multer','util','path','express','../../components/auth/service','../../components/interaction/service','./squareProject.controller','get','isAuthenticated','/:id','show','/:id/users','create','post','addUsers','update','delete','removeUsers'];(function(_0x43bec6,_0x5724d9){var _0x53908a=function(_0x4ce28f){while(--_0x4ce28f){_0x43bec6['push'](_0x43bec6['shift']());}};_0x53908a(++_0x5724d9);}(_0xd4d1,0x86));var _0x1d4d=function(_0x536edc,_0x33b294){_0x536edc=_0x536edc-0x0;var _0x15c2ec=_0xd4d1[_0x536edc];return _0x15c2ec;};'use strict';var multer=require(_0x1d4d('0x0'));var util=require(_0x1d4d('0x1'));var path=require(_0x1d4d('0x2'));var timeout=require('connect-timeout');var express=require(_0x1d4d('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x1d4d('0x4'));var interaction=require(_0x1d4d('0x5'));var config=require('../../config/environment');var controller=require(_0x1d4d('0x6'));router[_0x1d4d('0x7')]('/',auth[_0x1d4d('0x8')](),controller['index']);router[_0x1d4d('0x7')](_0x1d4d('0x9'),auth[_0x1d4d('0x8')](),controller[_0x1d4d('0xa')]);router[_0x1d4d('0x7')](_0x1d4d('0xb'),auth[_0x1d4d('0x8')](),controller['getUsers']);router['post']('/',auth['isAuthenticated'](),controller[_0x1d4d('0xc')]);router[_0x1d4d('0xd')](_0x1d4d('0xb'),auth['isAuthenticated'](),controller[_0x1d4d('0xe')]);router['put'](_0x1d4d('0x9'),auth[_0x1d4d('0x8')](),controller[_0x1d4d('0xf')]);router[_0x1d4d('0x10')](_0x1d4d('0x9'),auth[_0x1d4d('0x8')](),controller['destroy']);router[_0x1d4d('0x10')]('/:id/users',auth[_0x1d4d('0x8')](),controller[_0x1d4d('0x11')]);module[_0x1d4d('0x12')]=router; \ No newline at end of file +var _0x56c8=['/:id','/:id/users','getUsers','post','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index'];(function(_0x26b80e,_0x5c9333){var _0x84a8a8=function(_0x2e5b4a){while(--_0x2e5b4a){_0x26b80e['push'](_0x26b80e['shift']());}};_0x84a8a8(++_0x5c9333);}(_0x56c8,0x12f));var _0x856c=function(_0x1c516b,_0x543355){_0x1c516b=_0x1c516b-0x0;var _0x3aa323=_0x56c8[_0x1c516b];return _0x3aa323;};'use strict';var multer=require(_0x856c('0x0'));var util=require(_0x856c('0x1'));var path=require(_0x856c('0x2'));var timeout=require(_0x856c('0x3'));var express=require('express');var router=express[_0x856c('0x4')]();var fs_extra=require(_0x856c('0x5'));var auth=require(_0x856c('0x6'));var interaction=require(_0x856c('0x7'));var config=require(_0x856c('0x8'));var controller=require('./squareProject.controller');router[_0x856c('0x9')]('/',auth[_0x856c('0xa')](),controller[_0x856c('0xb')]);router[_0x856c('0x9')](_0x856c('0xc'),auth[_0x856c('0xa')](),controller['show']);router['get'](_0x856c('0xd'),auth[_0x856c('0xa')](),controller[_0x856c('0xe')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x856c('0xf')](_0x856c('0xd'),auth[_0x856c('0xa')](),controller['addUsers']);router[_0x856c('0x10')](_0x856c('0xc'),auth['isAuthenticated'](),controller[_0x856c('0x11')]);router[_0x856c('0x12')](_0x856c('0xc'),auth[_0x856c('0xa')](),controller[_0x856c('0x13')]);router[_0x856c('0x12')](_0x856c('0xd'),auth[_0x856c('0xa')](),controller['removeUsers']);module[_0x856c('0x14')]=router; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.attributes.js b/server/api/squareProject/squareProject.attributes.js index 3460cfc..2406950 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 _0x9a18=['getDataValue','preproduction','toString','utf8','long','DATE','sequelize','STRING','name','TEXT','BLOB'];(function(_0x50bf5a,_0x807bba){var _0x4ddc1d=function(_0x349a61){while(--_0x349a61){_0x50bf5a['push'](_0x50bf5a['shift']());}};_0x4ddc1d(++_0x807bba);}(_0x9a18,0x187));var _0x89a1=function(_0x428eac,_0x2c45af){_0x428eac=_0x428eac-0x0;var _0xc04778=_0x9a18[_0x428eac];return _0xc04778;};'use strict';var Sequelize=require(_0x89a1('0x0'));module['exports']={'name':{'type':Sequelize[_0x89a1('0x1')],'unique':_0x89a1('0x2'),'allowNull':![]},'description':{'type':Sequelize[_0x89a1('0x1')]},'notes':{'type':Sequelize[_0x89a1('0x3')]},'preproduction':{'type':Sequelize[_0x89a1('0x4')]('long'),'get':function(){if(this[_0x89a1('0x5')](_0x89a1('0x6'))){return this[_0x89a1('0x5')](_0x89a1('0x6'))[_0x89a1('0x7')](_0x89a1('0x8'));}}},'production':{'type':Sequelize[_0x89a1('0x4')](_0x89a1('0x9')),'get':function(){if(this['getDataValue']('production')){return this[_0x89a1('0x5')]('production')[_0x89a1('0x7')](_0x89a1('0x8'));}}},'savedAt':{'type':Sequelize[_0x89a1('0xa')]},'publishedAt':{'type':Sequelize[_0x89a1('0xa')]}}; \ No newline at end of file +var _0xef4d=['getDataValue','preproduction','toString','utf8','production','DATE','sequelize','exports','name','STRING','TEXT','BLOB','long'];(function(_0x1a64da,_0x13a6f5){var _0x37eb35=function(_0x1a638a){while(--_0x1a638a){_0x1a64da['push'](_0x1a64da['shift']());}};_0x37eb35(++_0x13a6f5);}(_0xef4d,0xaf));var _0xdef4=function(_0x369151,_0x179f72){_0x369151=_0x369151-0x0;var _0x4292d5=_0xef4d[_0x369151];return _0x4292d5;};'use strict';var Sequelize=require(_0xdef4('0x0'));module[_0xdef4('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xdef4('0x2'),'allowNull':![]},'description':{'type':Sequelize[_0xdef4('0x3')]},'notes':{'type':Sequelize[_0xdef4('0x4')]},'preproduction':{'type':Sequelize[_0xdef4('0x5')](_0xdef4('0x6')),'get':function(){if(this[_0xdef4('0x7')](_0xdef4('0x8'))){return this[_0xdef4('0x7')](_0xdef4('0x8'))[_0xdef4('0x9')](_0xdef4('0xa'));}}},'production':{'type':Sequelize[_0xdef4('0x5')](_0xdef4('0x6')),'get':function(){if(this[_0xdef4('0x7')](_0xdef4('0xb'))){return this['getDataValue'](_0xdef4('0xb'))[_0xdef4('0x9')](_0xdef4('0xa'));}}},'savedAt':{'type':Sequelize['DATE']},'publishedAt':{'type':Sequelize[_0xdef4('0xc')]}}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.controller.js b/server/api/squareProject/squareProject.controller.js index 303bff4..e95aa43 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 _0xdcca=['getUsers','findOne','order','hasOwnProperty','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./squareProject.socket','register','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','then','get','UserProfileResource','error','stack','name','send','index','map','SquareProject','rawAttributes','type','key','model','query','keys','filters','attributes','intersection','fields','length','nolimit','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','create','body','user','role','find','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','addUsers','omit','removeUsers','ids','isArray','emit','userSquareProject:remove'];(function(_0x1026d2,_0x42fe66){var _0x4a6773=function(_0x1a295f){while(--_0x1a295f){_0x1026d2['push'](_0x1026d2['shift']());}};_0x4a6773(++_0x42fe66);}(_0xdcca,0x67));var _0xadcc=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xdcca[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xadcc('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xadcc('0x1'));var jsonpatch=require(_0xadcc('0x2'));var rp=require(_0xadcc('0x3'));var moment=require('moment');var BPromise=require(_0xadcc('0x4'));var Mustache=require(_0xadcc('0x5'));var util=require(_0xadcc('0x6'));var path=require(_0xadcc('0x7'));var sox=require(_0xadcc('0x8'));var csv=require('to-csv');var ejs=require(_0xadcc('0x9'));var fs=require('fs');var fs_extra=require(_0xadcc('0xa'));var _=require(_0xadcc('0xb'));var squel=require(_0xadcc('0xc'));var crypto=require('crypto');var jsforce=require(_0xadcc('0xd'));var deskjs=require(_0xadcc('0xe'));var toCsv=require(_0xadcc('0xf'));var querystring=require(_0xadcc('0x10'));var Papa=require(_0xadcc('0x11'));var Redis=require(_0xadcc('0x12'));var authService=require(_0xadcc('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xadcc('0x14'));var logger=require(_0xadcc('0x15'))('api');var utils=require(_0xadcc('0x16'));var config=require(_0xadcc('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xadcc('0x18'))['db'];config[_0xadcc('0x19')]=_[_0xadcc('0x1a')](config[_0xadcc('0x19')],{'host':_0xadcc('0x1b'),'port':0x18eb});var socket=require(_0xadcc('0x1c'))(new Redis(config['redis']));require(_0xadcc('0x1d'))[_0xadcc('0x1e')](socket);function respondWithStatusCode(_0x553452,_0x4158ff){_0x4158ff=_0x4158ff||0xcc;return function(_0x2091e9){if(_0x2091e9){return _0x553452[_0xadcc('0x1f')](_0x4158ff);}return _0x553452['status'](_0x4158ff)[_0xadcc('0x20')]();};}function respondWithResult(_0x36ce34,_0x58658e){_0x58658e=_0x58658e||0xc8;return function(_0x363361){if(_0x363361){return _0x36ce34[_0xadcc('0x21')](_0x58658e)[_0xadcc('0x22')](_0x363361);}};}function respondWithFilteredResult(_0x39d882,_0x16dde2){return function(_0x5863bf){if(_0x5863bf){var _0x87c7eb=typeof _0x16dde2[_0xadcc('0x23')]===_0xadcc('0x24')&&typeof _0x16dde2[_0xadcc('0x25')]===_0xadcc('0x24');var _0x2481d4=_0x5863bf[_0xadcc('0x26')];var _0x365a44=_0x87c7eb?0x0:_0x16dde2['offset'];var _0x1b7f74=_0x87c7eb?_0x5863bf[_0xadcc('0x26')]:_0x16dde2[_0xadcc('0x23')]+_0x16dde2['limit'];var _0xd3797;if(_0x1b7f74>=_0x2481d4){_0x1b7f74=_0x2481d4;_0xd3797=0xc8;}else{_0xd3797=0xce;}_0x39d882[_0xadcc('0x21')](_0xd3797);return _0x39d882[_0xadcc('0x27')](_0xadcc('0x28'),_0x365a44+'-'+_0x1b7f74+'/'+_0x2481d4)['json'](_0x5863bf);}return null;};}function patchUpdates(_0xecb69){return function(_0x5f9bf3){try{jsonpatch[_0xadcc('0x29')](_0x5f9bf3,_0xecb69,!![]);}catch(_0x1b17fe){return BPromise[_0xadcc('0x2a')](_0x1b17fe);}return _0x5f9bf3[_0xadcc('0x2b')]();};}function saveUpdates(_0x5c7a46,_0x2d90e1){return function(_0x5d1a24){if(_0x5d1a24){return _0x5d1a24[_0xadcc('0x2c')](_0x5c7a46)['then'](function(_0x594399){return _0x594399;});}return null;};}function removeEntity(_0x522480,_0x2a1b8a){return function(_0x411a0e){if(_0x411a0e){return _0x411a0e[_0xadcc('0x2d')]()[_0xadcc('0x2e')](function(){var _0x26e1ba=_0x411a0e[_0xadcc('0x2f')]({'plain':!![]});var _0x2c0afd='SquareProjects';return db[_0xadcc('0x30')][_0xadcc('0x2d')]({'where':{'type':_0x2c0afd,'resourceId':_0x26e1ba['id']}})[_0xadcc('0x2e')](function(){return _0x411a0e;});})[_0xadcc('0x2e')](function(){_0x522480[_0xadcc('0x21')](0xcc)[_0xadcc('0x20')]();});}};}function handleEntityNotFound(_0x3c686f,_0x1ca792){return function(_0x5b979d){if(!_0x5b979d){_0x3c686f[_0xadcc('0x1f')](0x194);}return _0x5b979d;};}function handleError(_0x34f068,_0x1a84af){_0x1a84af=_0x1a84af||0x1f4;return function(_0x52e2c0){logger[_0xadcc('0x31')](_0x52e2c0[_0xadcc('0x32')]);if(_0x52e2c0[_0xadcc('0x33')]){delete _0x52e2c0[_0xadcc('0x33')];}_0x34f068[_0xadcc('0x21')](_0x1a84af)[_0xadcc('0x34')](_0x52e2c0);};}exports[_0xadcc('0x35')]=function(_0x11dbda,_0x3d2690){var _0x5ccd12={},_0x5485ac={},_0x2bb06b={'count':0x0,'rows':[]};var _0x304163=_[_0xadcc('0x36')](db[_0xadcc('0x37')][_0xadcc('0x38')],function(_0x5b4498){return{'name':_0x5b4498['fieldName'],'type':_0x5b4498[_0xadcc('0x39')][_0xadcc('0x3a')]};});_0x5485ac[_0xadcc('0x3b')]=_['map'](_0x304163,_0xadcc('0x33'));_0x5485ac[_0xadcc('0x3c')]=_[_0xadcc('0x3d')](_0x11dbda[_0xadcc('0x3c')]);_0x5485ac[_0xadcc('0x3e')]=_['intersection'](_0x5485ac['model'],_0x5485ac['query']);_0x5ccd12[_0xadcc('0x3f')]=_[_0xadcc('0x40')](_0x5485ac[_0xadcc('0x3b')],qs[_0xadcc('0x41')](_0x11dbda[_0xadcc('0x3c')][_0xadcc('0x41')]));_0x5ccd12['attributes']=_0x5ccd12[_0xadcc('0x3f')][_0xadcc('0x42')]?_0x5ccd12[_0xadcc('0x3f')]:_0x5485ac[_0xadcc('0x3b')];if(!_0x11dbda[_0xadcc('0x3c')]['hasOwnProperty'](_0xadcc('0x43'))){_0x5ccd12['limit']=qs[_0xadcc('0x25')](_0x11dbda[_0xadcc('0x3c')][_0xadcc('0x25')]);_0x5ccd12[_0xadcc('0x23')]=qs['offset'](_0x11dbda['query'][_0xadcc('0x23')]);}_0x5ccd12['order']=qs[_0xadcc('0x44')](_0x11dbda[_0xadcc('0x3c')][_0xadcc('0x44')]);_0x5ccd12['where']=qs[_0xadcc('0x3e')](_[_0xadcc('0x45')](_0x11dbda[_0xadcc('0x3c')],_0x5485ac[_0xadcc('0x3e')]),_0x304163);if(_0x11dbda['query'][_0xadcc('0x46')]){_0x5ccd12[_0xadcc('0x47')]=_[_0xadcc('0x48')](_0x5ccd12[_0xadcc('0x47')],{'$or':_[_0xadcc('0x36')](_0x304163,function(_0x11c2df){if(_0x11c2df[_0xadcc('0x39')]!==_0xadcc('0x49')){var _0x3bbe58={};_0x3bbe58[_0x11c2df['name']]={'$like':'%'+_0x11dbda['query'][_0xadcc('0x46')]+'%'};return _0x3bbe58;}})});}_0x5ccd12=_[_0xadcc('0x48')]({},_0x5ccd12,_0x11dbda[_0xadcc('0x4a')]);var _0x58c78d={'where':_0x5ccd12[_0xadcc('0x47')]};return db[_0xadcc('0x37')][_0xadcc('0x26')](_0x58c78d)[_0xadcc('0x2e')](function(_0x14ae22){_0x2bb06b['count']=_0x14ae22;if(_0x11dbda[_0xadcc('0x3c')][_0xadcc('0x4b')]){_0x5ccd12[_0xadcc('0x4c')]=[{'all':!![]}];}return db[_0xadcc('0x37')][_0xadcc('0x4d')](_0x5ccd12);})[_0xadcc('0x2e')](function(_0x1a6794){_0x2bb06b[_0xadcc('0x4e')]=_0x1a6794;return _0x2bb06b;})[_0xadcc('0x2e')](respondWithFilteredResult(_0x3d2690,_0x5ccd12))[_0xadcc('0x4f')](handleError(_0x3d2690,null));};exports['show']=function(_0xfa7a37,_0x16c1a1){var _0x34ec74={'raw':![],'where':{'id':_0xfa7a37['params']['id']}},_0x1b0fa1={};_0x1b0fa1[_0xadcc('0x3b')]=_[_0xadcc('0x3d')](db[_0xadcc('0x37')][_0xadcc('0x38')]);_0x1b0fa1['query']=_[_0xadcc('0x3d')](_0xfa7a37['query']);_0x1b0fa1[_0xadcc('0x3e')]=_[_0xadcc('0x40')](_0x1b0fa1['model'],_0x1b0fa1[_0xadcc('0x3c')]);_0x34ec74[_0xadcc('0x3f')]=_[_0xadcc('0x40')](_0x1b0fa1[_0xadcc('0x3b')],qs[_0xadcc('0x41')](_0xfa7a37['query'][_0xadcc('0x41')]));_0x34ec74[_0xadcc('0x3f')]=_0x34ec74[_0xadcc('0x3f')][_0xadcc('0x42')]?_0x34ec74['attributes']:_0x1b0fa1['model'];if(_0xfa7a37['query'][_0xadcc('0x4b')]){_0x34ec74[_0xadcc('0x4c')]=[{'all':!![]}];}_0x34ec74=_[_0xadcc('0x48')]({},_0x34ec74,_0xfa7a37[_0xadcc('0x4a')]);return db[_0xadcc('0x37')]['find'](_0x34ec74)[_0xadcc('0x2e')](handleEntityNotFound(_0x16c1a1,null))[_0xadcc('0x2e')](respondWithResult(_0x16c1a1,null))[_0xadcc('0x4f')](handleError(_0x16c1a1,null));};exports['create']=function(_0x21aadf,_0x5dd471){return db[_0xadcc('0x37')][_0xadcc('0x50')](_0x21aadf[_0xadcc('0x51')],{})['then'](function(_0x478576){var _0x25af7e=_0x21aadf[_0xadcc('0x52')][_0xadcc('0x2f')]({'plain':!![]});if(!_0x25af7e)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x25af7e[_0xadcc('0x53')]===_0xadcc('0x52')){var _0x16c73f=_0x478576[_0xadcc('0x2f')]({'plain':!![]});var _0x192cd4='SquareProjects';return db['UserProfileSection'][_0xadcc('0x54')]({'where':{'name':_0x192cd4,'userProfileId':_0x25af7e['userProfileId']},'raw':!![]})[_0xadcc('0x2e')](function(_0xf2aad6){if(_0xf2aad6&&_0xf2aad6[_0xadcc('0x55')]===0x0){return db['UserProfileResource']['create']({'name':_0x16c73f[_0xadcc('0x33')],'resourceId':_0x16c73f['id'],'type':_0xf2aad6[_0xadcc('0x33')],'sectionId':_0xf2aad6['id']},{})[_0xadcc('0x2e')](function(){return _0x478576;});}else{return _0x478576;}})[_0xadcc('0x4f')](function(_0x5b760a){logger[_0xadcc('0x31')](_0xadcc('0x56'),_0x5b760a);throw _0x5b760a;});}return _0x478576;})[_0xadcc('0x2e')](respondWithResult(_0x5dd471,0xc9))[_0xadcc('0x4f')](handleError(_0x5dd471,null));};exports[_0xadcc('0x2c')]=function(_0x98b6ca,_0x23d61d){if(_0x98b6ca[_0xadcc('0x51')]['id']){delete _0x98b6ca['body']['id'];}return db[_0xadcc('0x37')][_0xadcc('0x54')]({'where':{'id':_0x98b6ca[_0xadcc('0x57')]['id']}})[_0xadcc('0x2e')](handleEntityNotFound(_0x23d61d,null))['then'](saveUpdates(_0x98b6ca[_0xadcc('0x51')],null))[_0xadcc('0x2e')](respondWithResult(_0x23d61d,null))[_0xadcc('0x4f')](handleError(_0x23d61d,null));};exports['destroy']=function(_0x28a879,_0x1fd500){return db[_0xadcc('0x37')][_0xadcc('0x54')]({'where':{'id':_0x28a879[_0xadcc('0x57')]['id']}})['then'](handleEntityNotFound(_0x1fd500,null))[_0xadcc('0x2e')](removeEntity(_0x1fd500,null))[_0xadcc('0x4f')](handleError(_0x1fd500,null));};exports[_0xadcc('0x58')]=function(_0xe2b223,_0x5bbd89,_0x3a0614){return db[_0xadcc('0x37')][_0xadcc('0x54')]({'where':{'id':_0xe2b223[_0xadcc('0x57')]['id']}})[_0xadcc('0x2e')](handleEntityNotFound(_0x5bbd89,null))['then'](function(_0x25d513){if(_0x25d513){return _0x25d513[_0xadcc('0x58')](_0xe2b223[_0xadcc('0x51')]['ids'],_[_0xadcc('0x59')](_0xe2b223['body'],['ids','id'])||{});}})[_0xadcc('0x2e')](respondWithResult(_0x5bbd89,null))[_0xadcc('0x4f')](handleError(_0x5bbd89,null));};exports[_0xadcc('0x5a')]=function(_0x2dcd96,_0x4b6287,_0x1e09de){return db[_0xadcc('0x37')][_0xadcc('0x54')]({'where':{'id':_0x2dcd96['params']['id']}})[_0xadcc('0x2e')](handleEntityNotFound(_0x4b6287,null))[_0xadcc('0x2e')](function(_0x5643fb){if(_0x5643fb){return _0x5643fb[_0xadcc('0x5a')](_0x2dcd96[_0xadcc('0x3c')][_0xadcc('0x5b')])[_0xadcc('0x2e')](function(){if(_[_0xadcc('0x5c')](_0x2dcd96[_0xadcc('0x3c')][_0xadcc('0x5b')])){for(var _0x228671=0x0;_0x228671<_0x2dcd96[_0xadcc('0x3c')]['ids']['length'];_0x228671+=0x1){socket[_0xadcc('0x5d')](_0xadcc('0x5e'),{'UserId':Number(_0x2dcd96[_0xadcc('0x3c')][_0xadcc('0x5b')][_0x228671]),'SquareProjectId':Number(_0x2dcd96[_0xadcc('0x57')]['id'])});}}else{socket[_0xadcc('0x5d')](_0xadcc('0x5e'),{'UserId':Number(_0x2dcd96[_0xadcc('0x3c')][_0xadcc('0x5b')]),'SquareProjectId':Number(_0x2dcd96['params']['id'])});}});}})[_0xadcc('0x2e')](respondWithStatusCode(_0x4b6287,null))[_0xadcc('0x4f')](handleError(_0x4b6287,null));};exports[_0xadcc('0x5f')]=function(_0x2ec2b9,_0x28a2a9,_0x1f8816){var _0x264cff={};var _0x212b05={};var _0x560b74;var _0x9f4cfa;return db[_0xadcc('0x37')][_0xadcc('0x60')]({'where':{'id':_0x2ec2b9[_0xadcc('0x57')]['id']}})[_0xadcc('0x2e')](handleEntityNotFound(_0x28a2a9,null))[_0xadcc('0x2e')](function(_0xc87132){if(_0xc87132){_0x560b74=_0xc87132;_0x212b05[_0xadcc('0x3b')]=_['keys'](db['User'][_0xadcc('0x38')]);_0x212b05[_0xadcc('0x3c')]=_[_0xadcc('0x3d')](_0x2ec2b9['query']);_0x212b05[_0xadcc('0x3e')]=_[_0xadcc('0x40')](_0x212b05[_0xadcc('0x3b')],_0x212b05[_0xadcc('0x3c')]);_0x264cff[_0xadcc('0x3f')]=_[_0xadcc('0x40')](_0x212b05['model'],qs[_0xadcc('0x41')](_0x2ec2b9['query'][_0xadcc('0x41')]));_0x264cff[_0xadcc('0x3f')]=_0x264cff['attributes'][_0xadcc('0x42')]?_0x264cff[_0xadcc('0x3f')]:_0x212b05[_0xadcc('0x3b')];_0x264cff[_0xadcc('0x61')]=qs['sort'](_0x2ec2b9[_0xadcc('0x3c')]['sort']);_0x264cff[_0xadcc('0x47')]=qs[_0xadcc('0x3e')](_['pick'](_0x2ec2b9['query'],_0x212b05[_0xadcc('0x3e')]));if(_0x2ec2b9[_0xadcc('0x3c')][_0xadcc('0x46')]){_0x264cff[_0xadcc('0x47')]=_[_0xadcc('0x48')](_0x264cff[_0xadcc('0x47')],{'$or':_['map'](_0x264cff[_0xadcc('0x3f')],function(_0x2da863){var _0x25bfcc={};_0x25bfcc[_0x2da863]={'$like':'%'+_0x2ec2b9['query'][_0xadcc('0x46')]+'%'};return _0x25bfcc;})});}_0x264cff=_['merge']({},_0x264cff,_0x2ec2b9[_0xadcc('0x4a')]);return _0x560b74[_0xadcc('0x5f')](_0x264cff);}})[_0xadcc('0x2e')](function(_0x3362bf){if(_0x3362bf){_0x9f4cfa=_0x3362bf['length'];if(!_0x2ec2b9[_0xadcc('0x3c')][_0xadcc('0x62')](_0xadcc('0x43'))){_0x264cff[_0xadcc('0x25')]=qs['limit'](_0x2ec2b9[_0xadcc('0x3c')][_0xadcc('0x25')]);_0x264cff[_0xadcc('0x23')]=qs[_0xadcc('0x23')](_0x2ec2b9[_0xadcc('0x3c')][_0xadcc('0x23')]);}return _0x560b74[_0xadcc('0x5f')](_0x264cff);}})[_0xadcc('0x2e')](function(_0x100fb4){if(_0x100fb4){return _0x100fb4?{'count':_0x9f4cfa,'rows':_0x100fb4}:null;}})['then'](respondWithResult(_0x28a2a9,null))[_0xadcc('0x4f')](handleError(_0x28a2a9,null));}; \ No newline at end of file +var _0x7fb3=['../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','socket.io-emitter','./squareProject.socket','status','end','json','offset','undefined','count','limit','Content-Range','apply','save','update','then','destroy','get','SquareProjects','sendStatus','error','stack','name','send','index','map','SquareProject','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','find','create','body','user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','addUsers','ids','omit','removeUsers','isArray','emit','userSquareProject:remove','getUsers','findOne','order','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis'];(function(_0x573500,_0x171587){var _0x7a64e4=function(_0x208cb4){while(--_0x208cb4){_0x573500['push'](_0x573500['shift']());}};_0x7a64e4(++_0x171587);}(_0x7fb3,0x1d3));var _0x37fb=function(_0x6173fc,_0x32aadf){_0x6173fc=_0x6173fc-0x0;var _0x965fbe=_0x7fb3[_0x6173fc];return _0x965fbe;};'use strict';var emlformat=require(_0x37fb('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x37fb('0x1'));var jsonpatch=require(_0x37fb('0x2'));var rp=require('request-promise');var moment=require(_0x37fb('0x3'));var BPromise=require(_0x37fb('0x4'));var Mustache=require(_0x37fb('0x5'));var util=require('util');var path=require(_0x37fb('0x6'));var sox=require(_0x37fb('0x7'));var csv=require(_0x37fb('0x8'));var ejs=require(_0x37fb('0x9'));var fs=require('fs');var fs_extra=require(_0x37fb('0xa'));var _=require(_0x37fb('0xb'));var squel=require(_0x37fb('0xc'));var crypto=require(_0x37fb('0xd'));var jsforce=require(_0x37fb('0xe'));var deskjs=require(_0x37fb('0xf'));var toCsv=require(_0x37fb('0x8'));var querystring=require(_0x37fb('0x10'));var Papa=require('papaparse');var Redis=require(_0x37fb('0x11'));var authService=require(_0x37fb('0x12'));var qs=require(_0x37fb('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x37fb('0x14'));var logger=require(_0x37fb('0x15'))(_0x37fb('0x16'));var utils=require(_0x37fb('0x17'));var config=require(_0x37fb('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x37fb('0x19'))['db'];config[_0x37fb('0x1a')]=_['defaults'](config[_0x37fb('0x1a')],{'host':'localhost','port':0x18eb});var socket=require(_0x37fb('0x1b'))(new Redis(config[_0x37fb('0x1a')]));require(_0x37fb('0x1c'))['register'](socket);function respondWithStatusCode(_0x24cc3e,_0x30af8b){_0x30af8b=_0x30af8b||0xcc;return function(_0x7f7e35){if(_0x7f7e35){return _0x24cc3e['sendStatus'](_0x30af8b);}return _0x24cc3e[_0x37fb('0x1d')](_0x30af8b)[_0x37fb('0x1e')]();};}function respondWithResult(_0x2f5910,_0x4a46cc){_0x4a46cc=_0x4a46cc||0xc8;return function(_0x16481b){if(_0x16481b){return _0x2f5910['status'](_0x4a46cc)[_0x37fb('0x1f')](_0x16481b);}};}function respondWithFilteredResult(_0x50ab17,_0x19e828){return function(_0x316cd3){if(_0x316cd3){var _0x31e03a=typeof _0x19e828[_0x37fb('0x20')]===_0x37fb('0x21')&&typeof _0x19e828['limit']===_0x37fb('0x21');var _0x1b2dbe=_0x316cd3[_0x37fb('0x22')];var _0x32099a=_0x31e03a?0x0:_0x19e828[_0x37fb('0x20')];var _0x1e230b=_0x31e03a?_0x316cd3[_0x37fb('0x22')]:_0x19e828[_0x37fb('0x20')]+_0x19e828[_0x37fb('0x23')];var _0x574bd3;if(_0x1e230b>=_0x1b2dbe){_0x1e230b=_0x1b2dbe;_0x574bd3=0xc8;}else{_0x574bd3=0xce;}_0x50ab17[_0x37fb('0x1d')](_0x574bd3);return _0x50ab17['set'](_0x37fb('0x24'),_0x32099a+'-'+_0x1e230b+'/'+_0x1b2dbe)[_0x37fb('0x1f')](_0x316cd3);}return null;};}function patchUpdates(_0x25d9e5){return function(_0xe1594f){try{jsonpatch[_0x37fb('0x25')](_0xe1594f,_0x25d9e5,!![]);}catch(_0x3b5e06){return BPromise['reject'](_0x3b5e06);}return _0xe1594f[_0x37fb('0x26')]();};}function saveUpdates(_0x47f950,_0x4e1479){return function(_0x10e3f4){if(_0x10e3f4){return _0x10e3f4[_0x37fb('0x27')](_0x47f950)[_0x37fb('0x28')](function(_0x313c0c){return _0x313c0c;});}return null;};}function removeEntity(_0x256606,_0x38ca6e){return function(_0x1f7fac){if(_0x1f7fac){return _0x1f7fac[_0x37fb('0x29')]()[_0x37fb('0x28')](function(){var _0x41690d=_0x1f7fac[_0x37fb('0x2a')]({'plain':!![]});var _0x6b750e=_0x37fb('0x2b');return db['UserProfileResource'][_0x37fb('0x29')]({'where':{'type':_0x6b750e,'resourceId':_0x41690d['id']}})[_0x37fb('0x28')](function(){return _0x1f7fac;});})['then'](function(){_0x256606[_0x37fb('0x1d')](0xcc)[_0x37fb('0x1e')]();});}};}function handleEntityNotFound(_0x67d467,_0x1af59a){return function(_0x2f7719){if(!_0x2f7719){_0x67d467[_0x37fb('0x2c')](0x194);}return _0x2f7719;};}function handleError(_0x2b7639,_0x330f83){_0x330f83=_0x330f83||0x1f4;return function(_0x22f668){logger[_0x37fb('0x2d')](_0x22f668[_0x37fb('0x2e')]);if(_0x22f668[_0x37fb('0x2f')]){delete _0x22f668[_0x37fb('0x2f')];}_0x2b7639[_0x37fb('0x1d')](_0x330f83)[_0x37fb('0x30')](_0x22f668);};}exports[_0x37fb('0x31')]=function(_0x5e431c,_0x23c9b6){var _0xdf67fd={},_0x257048={},_0x350213={'count':0x0,'rows':[]};var _0x101fbc=_[_0x37fb('0x32')](db[_0x37fb('0x33')][_0x37fb('0x34')],function(_0x191f01){return{'name':_0x191f01[_0x37fb('0x35')],'type':_0x191f01[_0x37fb('0x36')]['key']};});_0x257048[_0x37fb('0x37')]=_[_0x37fb('0x32')](_0x101fbc,_0x37fb('0x2f'));_0x257048[_0x37fb('0x38')]=_[_0x37fb('0x39')](_0x5e431c[_0x37fb('0x38')]);_0x257048[_0x37fb('0x3a')]=_[_0x37fb('0x3b')](_0x257048[_0x37fb('0x37')],_0x257048['query']);_0xdf67fd[_0x37fb('0x3c')]=_[_0x37fb('0x3b')](_0x257048[_0x37fb('0x37')],qs[_0x37fb('0x3d')](_0x5e431c[_0x37fb('0x38')]['fields']));_0xdf67fd[_0x37fb('0x3c')]=_0xdf67fd[_0x37fb('0x3c')][_0x37fb('0x3e')]?_0xdf67fd['attributes']:_0x257048[_0x37fb('0x37')];if(!_0x5e431c[_0x37fb('0x38')][_0x37fb('0x3f')](_0x37fb('0x40'))){_0xdf67fd['limit']=qs[_0x37fb('0x23')](_0x5e431c[_0x37fb('0x38')][_0x37fb('0x23')]);_0xdf67fd[_0x37fb('0x20')]=qs[_0x37fb('0x20')](_0x5e431c[_0x37fb('0x38')][_0x37fb('0x20')]);}_0xdf67fd['order']=qs['sort'](_0x5e431c[_0x37fb('0x38')][_0x37fb('0x41')]);_0xdf67fd[_0x37fb('0x42')]=qs[_0x37fb('0x3a')](_[_0x37fb('0x43')](_0x5e431c[_0x37fb('0x38')],_0x257048['filters']),_0x101fbc);if(_0x5e431c[_0x37fb('0x38')][_0x37fb('0x44')]){_0xdf67fd[_0x37fb('0x42')]=_[_0x37fb('0x45')](_0xdf67fd[_0x37fb('0x42')],{'$or':_[_0x37fb('0x32')](_0x101fbc,function(_0x4af743){if(_0x4af743['type']!=='VIRTUAL'){var _0x10e45e={};_0x10e45e[_0x4af743[_0x37fb('0x2f')]]={'$like':'%'+_0x5e431c[_0x37fb('0x38')][_0x37fb('0x44')]+'%'};return _0x10e45e;}})});}_0xdf67fd=_[_0x37fb('0x45')]({},_0xdf67fd,_0x5e431c[_0x37fb('0x46')]);var _0x4b447d={'where':_0xdf67fd[_0x37fb('0x42')]};return db['SquareProject']['count'](_0x4b447d)[_0x37fb('0x28')](function(_0x40c41e){_0x350213['count']=_0x40c41e;if(_0x5e431c[_0x37fb('0x38')][_0x37fb('0x47')]){_0xdf67fd[_0x37fb('0x48')]=[{'all':!![]}];}return db['SquareProject'][_0x37fb('0x49')](_0xdf67fd);})['then'](function(_0xaf15c3){_0x350213[_0x37fb('0x4a')]=_0xaf15c3;return _0x350213;})[_0x37fb('0x28')](respondWithFilteredResult(_0x23c9b6,_0xdf67fd))[_0x37fb('0x4b')](handleError(_0x23c9b6,null));};exports['show']=function(_0x2e8bb5,_0xf67bee){var _0x45499a={'raw':![],'where':{'id':_0x2e8bb5['params']['id']}},_0x16d5d5={};_0x16d5d5[_0x37fb('0x37')]=_[_0x37fb('0x39')](db[_0x37fb('0x33')][_0x37fb('0x34')]);_0x16d5d5['query']=_[_0x37fb('0x39')](_0x2e8bb5[_0x37fb('0x38')]);_0x16d5d5[_0x37fb('0x3a')]=_[_0x37fb('0x3b')](_0x16d5d5[_0x37fb('0x37')],_0x16d5d5['query']);_0x45499a[_0x37fb('0x3c')]=_[_0x37fb('0x3b')](_0x16d5d5['model'],qs[_0x37fb('0x3d')](_0x2e8bb5[_0x37fb('0x38')]['fields']));_0x45499a['attributes']=_0x45499a['attributes'][_0x37fb('0x3e')]?_0x45499a[_0x37fb('0x3c')]:_0x16d5d5['model'];if(_0x2e8bb5[_0x37fb('0x38')][_0x37fb('0x47')]){_0x45499a[_0x37fb('0x48')]=[{'all':!![]}];}_0x45499a=_[_0x37fb('0x45')]({},_0x45499a,_0x2e8bb5[_0x37fb('0x46')]);return db[_0x37fb('0x33')][_0x37fb('0x4c')](_0x45499a)[_0x37fb('0x28')](handleEntityNotFound(_0xf67bee,null))['then'](respondWithResult(_0xf67bee,null))[_0x37fb('0x4b')](handleError(_0xf67bee,null));};exports['create']=function(_0x17d0d7,_0xf8539f){return db['SquareProject'][_0x37fb('0x4d')](_0x17d0d7[_0x37fb('0x4e')],{})[_0x37fb('0x28')](function(_0x4c5146){var _0x2615bf=_0x17d0d7[_0x37fb('0x4f')][_0x37fb('0x2a')]({'plain':!![]});if(!_0x2615bf)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2615bf[_0x37fb('0x50')]===_0x37fb('0x4f')){var _0x2e239b=_0x4c5146['get']({'plain':!![]});var _0x1d38f3=_0x37fb('0x2b');return db[_0x37fb('0x51')][_0x37fb('0x4c')]({'where':{'name':_0x1d38f3,'userProfileId':_0x2615bf[_0x37fb('0x52')]},'raw':!![]})['then'](function(_0x1d7a6d){if(_0x1d7a6d&&_0x1d7a6d[_0x37fb('0x53')]===0x0){return db[_0x37fb('0x54')]['create']({'name':_0x2e239b[_0x37fb('0x2f')],'resourceId':_0x2e239b['id'],'type':_0x1d7a6d[_0x37fb('0x2f')],'sectionId':_0x1d7a6d['id']},{})[_0x37fb('0x28')](function(){return _0x4c5146;});}else{return _0x4c5146;}})[_0x37fb('0x4b')](function(_0x3bf7d1){logger[_0x37fb('0x2d')](_0x37fb('0x55'),_0x3bf7d1);throw _0x3bf7d1;});}return _0x4c5146;})[_0x37fb('0x28')](respondWithResult(_0xf8539f,0xc9))[_0x37fb('0x4b')](handleError(_0xf8539f,null));};exports['update']=function(_0x3d2939,_0x3dd272){if(_0x3d2939['body']['id']){delete _0x3d2939[_0x37fb('0x4e')]['id'];}return db[_0x37fb('0x33')][_0x37fb('0x4c')]({'where':{'id':_0x3d2939[_0x37fb('0x56')]['id']}})[_0x37fb('0x28')](handleEntityNotFound(_0x3dd272,null))['then'](saveUpdates(_0x3d2939[_0x37fb('0x4e')],null))['then'](respondWithResult(_0x3dd272,null))[_0x37fb('0x4b')](handleError(_0x3dd272,null));};exports[_0x37fb('0x29')]=function(_0x568710,_0x311edb){return db[_0x37fb('0x33')][_0x37fb('0x4c')]({'where':{'id':_0x568710[_0x37fb('0x56')]['id']}})[_0x37fb('0x28')](handleEntityNotFound(_0x311edb,null))['then'](removeEntity(_0x311edb,null))['catch'](handleError(_0x311edb,null));};exports[_0x37fb('0x57')]=function(_0x1beb15,_0x3db348,_0x443215){return db[_0x37fb('0x33')][_0x37fb('0x4c')]({'where':{'id':_0x1beb15[_0x37fb('0x56')]['id']}})['then'](handleEntityNotFound(_0x3db348,null))[_0x37fb('0x28')](function(_0x48d283){if(_0x48d283){return _0x48d283[_0x37fb('0x57')](_0x1beb15['body'][_0x37fb('0x58')],_[_0x37fb('0x59')](_0x1beb15[_0x37fb('0x4e')],['ids','id'])||{});}})[_0x37fb('0x28')](respondWithResult(_0x3db348,null))[_0x37fb('0x4b')](handleError(_0x3db348,null));};exports[_0x37fb('0x5a')]=function(_0x4299e8,_0x3467bb,_0x1b9b58){return db[_0x37fb('0x33')]['find']({'where':{'id':_0x4299e8[_0x37fb('0x56')]['id']}})[_0x37fb('0x28')](handleEntityNotFound(_0x3467bb,null))[_0x37fb('0x28')](function(_0x411744){if(_0x411744){return _0x411744['removeUsers'](_0x4299e8[_0x37fb('0x38')]['ids'])[_0x37fb('0x28')](function(){if(_[_0x37fb('0x5b')](_0x4299e8[_0x37fb('0x38')][_0x37fb('0x58')])){for(var _0x344525=0x0;_0x344525<_0x4299e8[_0x37fb('0x38')][_0x37fb('0x58')][_0x37fb('0x3e')];_0x344525+=0x1){socket[_0x37fb('0x5c')](_0x37fb('0x5d'),{'UserId':Number(_0x4299e8['query'][_0x37fb('0x58')][_0x344525]),'SquareProjectId':Number(_0x4299e8[_0x37fb('0x56')]['id'])});}}else{socket[_0x37fb('0x5c')](_0x37fb('0x5d'),{'UserId':Number(_0x4299e8[_0x37fb('0x38')][_0x37fb('0x58')]),'SquareProjectId':Number(_0x4299e8[_0x37fb('0x56')]['id'])});}});}})['then'](respondWithStatusCode(_0x3467bb,null))['catch'](handleError(_0x3467bb,null));};exports[_0x37fb('0x5e')]=function(_0x3bbb38,_0x28b512,_0x47c28e){var _0x4950b8={};var _0x15b9d8={};var _0x43d099;var _0x52ac87;return db[_0x37fb('0x33')][_0x37fb('0x5f')]({'where':{'id':_0x3bbb38[_0x37fb('0x56')]['id']}})[_0x37fb('0x28')](handleEntityNotFound(_0x28b512,null))['then'](function(_0x59192f){if(_0x59192f){_0x43d099=_0x59192f;_0x15b9d8['model']=_[_0x37fb('0x39')](db['User'][_0x37fb('0x34')]);_0x15b9d8[_0x37fb('0x38')]=_[_0x37fb('0x39')](_0x3bbb38[_0x37fb('0x38')]);_0x15b9d8[_0x37fb('0x3a')]=_[_0x37fb('0x3b')](_0x15b9d8['model'],_0x15b9d8['query']);_0x4950b8['attributes']=_['intersection'](_0x15b9d8[_0x37fb('0x37')],qs[_0x37fb('0x3d')](_0x3bbb38[_0x37fb('0x38')][_0x37fb('0x3d')]));_0x4950b8[_0x37fb('0x3c')]=_0x4950b8[_0x37fb('0x3c')][_0x37fb('0x3e')]?_0x4950b8['attributes']:_0x15b9d8['model'];_0x4950b8[_0x37fb('0x60')]=qs['sort'](_0x3bbb38[_0x37fb('0x38')][_0x37fb('0x41')]);_0x4950b8[_0x37fb('0x42')]=qs[_0x37fb('0x3a')](_[_0x37fb('0x43')](_0x3bbb38['query'],_0x15b9d8['filters']));if(_0x3bbb38[_0x37fb('0x38')][_0x37fb('0x44')]){_0x4950b8[_0x37fb('0x42')]=_[_0x37fb('0x45')](_0x4950b8[_0x37fb('0x42')],{'$or':_['map'](_0x4950b8['attributes'],function(_0x3a0c85){var _0x57fad9={};_0x57fad9[_0x3a0c85]={'$like':'%'+_0x3bbb38['query']['filter']+'%'};return _0x57fad9;})});}_0x4950b8=_[_0x37fb('0x45')]({},_0x4950b8,_0x3bbb38[_0x37fb('0x46')]);return _0x43d099[_0x37fb('0x5e')](_0x4950b8);}})['then'](function(_0x8d1a12){if(_0x8d1a12){_0x52ac87=_0x8d1a12[_0x37fb('0x3e')];if(!_0x3bbb38[_0x37fb('0x38')]['hasOwnProperty']('nolimit')){_0x4950b8[_0x37fb('0x23')]=qs[_0x37fb('0x23')](_0x3bbb38[_0x37fb('0x38')][_0x37fb('0x23')]);_0x4950b8['offset']=qs[_0x37fb('0x20')](_0x3bbb38[_0x37fb('0x38')]['offset']);}return _0x43d099['getUsers'](_0x4950b8);}})[_0x37fb('0x28')](function(_0x23bd8a){if(_0x23bd8a){return _0x23bd8a?{'count':_0x52ac87,'rows':_0x23bd8a}:null;}})['then'](respondWithResult(_0x28b512,null))[_0x37fb('0x4b')](handleError(_0x28b512,null));}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.events.js b/server/api/squareProject/squareProject.events.js index b8be698..677874f 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 _0x8098=['emit','hook','exports','events','../../mysqldb','SquareProject','update','remove'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8098,0xc3));var _0x8809=function(_0x4bab59,_0x574b82){_0x4bab59=_0x4bab59-0x0;var _0xa553f1=_0x8098[_0x4bab59];return _0xa553f1;};'use strict';var EventEmitter=require(_0x8809('0x0'));var SquareProject=require(_0x8809('0x1'))['db'][_0x8809('0x2')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x8809('0x3'),'afterDestroy':_0x8809('0x4')};function emitEvent(_0x5b8bc0){return function(_0x4971f7,_0xf5415e,_0xc96432){SquareProjectEvents[_0x8809('0x5')](_0x5b8bc0+':'+_0x4971f7['id'],_0x4971f7);SquareProjectEvents['emit'](_0x5b8bc0,_0x4971f7);_0xc96432(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SquareProject[_0x8809('0x6')](e,emitEvent(event));}}module[_0x8809('0x7')]=SquareProjectEvents; \ No newline at end of file +var _0xc396=['setMaxListeners','update','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x82129b,_0x484ae9){var _0x2ae5dc=function(_0x299e34){while(--_0x299e34){_0x82129b['push'](_0x82129b['shift']());}};_0x2ae5dc(++_0x484ae9);}(_0xc396,0x1de));var _0x6c39=function(_0x199b70,_0x415ba7){_0x199b70=_0x199b70-0x0;var _0x8b87d4=_0xc396[_0x199b70];return _0x8b87d4;};'use strict';var EventEmitter=require(_0x6c39('0x0'));var SquareProject=require(_0x6c39('0x1'))['db']['SquareProject'];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0x6c39('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x6c39('0x3'),'afterDestroy':'remove'};function emitEvent(_0x12f818){return function(_0x170896,_0x558c63,_0x2dbb7e){SquareProjectEvents['emit'](_0x12f818+':'+_0x170896['id'],_0x170896);SquareProjectEvents[_0x6c39('0x4')](_0x12f818,_0x170896);_0x2dbb7e(null);};}for(var e in events){if(events[_0x6c39('0x5')](e)){var event=events[e];SquareProject[_0x6c39('0x6')](e,emitEvent(event));}}module[_0x6c39('0x7')]=SquareProjectEvents; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.model.js b/server/api/squareProject/squareProject.model.js index 7122b19..39c0ce2 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 _0x9ef0=['define','square_projects','changed','preproduction','savedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','./squareProject.attributes','exports'];(function(_0x185bc3,_0x377413){var _0x3c0416=function(_0x1e761d){while(--_0x1e761d){_0x185bc3['push'](_0x185bc3['shift']());}};_0x3c0416(++_0x377413);}(_0x9ef0,0x16c));var _0x09ef=function(_0x3be87b,_0x47cfa9){_0x3be87b=_0x3be87b-0x0;var _0x12d59d=_0x9ef0[_0x3be87b];return _0x12d59d;};'use strict';var _=require(_0x09ef('0x0'));var util=require(_0x09ef('0x1'));var logger=require(_0x09ef('0x2'))(_0x09ef('0x3'));var moment=require(_0x09ef('0x4'));var BPromise=require(_0x09ef('0x5'));var rp=require(_0x09ef('0x6'));var fs=require('fs');var path=require(_0x09ef('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x09ef('0x8'));module[_0x09ef('0x9')]=function(_0x2b5d62,_0x31b76a){return _0x2b5d62[_0x09ef('0xa')]('SquareProject',attributes,{'tableName':_0x09ef('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x2a6a2e,_0x352151,_0x403d8d){if(_0x2a6a2e[_0x09ef('0xc')](_0x09ef('0xd'))){_0x2a6a2e[_0x09ef('0xe')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}if(_0x2a6a2e[_0x09ef('0xc')]('production')){_0x2a6a2e['publishedAt']=moment()[_0x09ef('0xf')](_0x09ef('0x10'));}_0x403d8d(null,_0x2a6a2e);}}});}; \ No newline at end of file +var _0x43df=['./squareProject.attributes','exports','SquareProject','square_projects','changed','savedAt','format','production','YYYY-MM-DD\x20HH:mm:ss','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x4c56ee,_0x15d6a8){var _0x3d5dce=function(_0x2122bc){while(--_0x2122bc){_0x4c56ee['push'](_0x4c56ee['shift']());}};_0x3d5dce(++_0x15d6a8);}(_0x43df,0x14d));var _0xf43d=function(_0x340b5f,_0x1dabc7){_0x340b5f=_0x340b5f-0x0;var _0x150ddf=_0x43df[_0x340b5f];return _0x150ddf;};'use strict';var _=require(_0xf43d('0x0'));var util=require(_0xf43d('0x1'));var logger=require('../../config/logger')(_0xf43d('0x2'));var moment=require(_0xf43d('0x3'));var BPromise=require(_0xf43d('0x4'));var rp=require(_0xf43d('0x5'));var fs=require('fs');var path=require(_0xf43d('0x6'));var rimraf=require(_0xf43d('0x7'));var config=require(_0xf43d('0x8'));var attributes=require(_0xf43d('0x9'));module[_0xf43d('0xa')]=function(_0x13f952,_0x1eb040){return _0x13f952['define'](_0xf43d('0xb'),attributes,{'tableName':_0xf43d('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x7dcba4,_0x3c93f2,_0x102f53){if(_0x7dcba4[_0xf43d('0xd')]('preproduction')){_0x7dcba4[_0xf43d('0xe')]=moment()[_0xf43d('0xf')]('YYYY-MM-DD\x20HH:mm:ss');}if(_0x7dcba4[_0xf43d('0xd')](_0xf43d('0x10'))){_0x7dcba4['publishedAt']=moment()[_0xf43d('0xf')](_0xf43d('0x11'));}_0x102f53(null,_0x7dcba4);}}});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.rpc.js b/server/api/squareProject/squareProject.rpc.js index eb94d61..e0ff80c 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 _0x6709=['options','raw','where','attributes','include','map','model','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','redis','localhost','socket.io-emitter','./squareProject.socket','register','request','then','SquareProject,\x20%s,\x20%s','request\x20sent','debug','SquareProject,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','ShowSquareProject','find'];(function(_0x2d34d6,_0x397ff9){var _0x1d3d12=function(_0x558800){while(--_0x558800){_0x2d34d6['push'](_0x2d34d6['shift']());}};_0x1d3d12(++_0x397ff9);}(_0x6709,0x9c));var _0x9670=function(_0x456fb1,_0x859a1d){_0x456fb1=_0x456fb1-0x0;var _0x4083d6=_0x6709[_0x456fb1];return _0x4083d6;};'use strict';var _=require(_0x9670('0x0'));var util=require(_0x9670('0x1'));var moment=require(_0x9670('0x2'));var BPromise=require(_0x9670('0x3'));var rs=require(_0x9670('0x4'));var fs=require('fs');var Redis=require(_0x9670('0x5'));var db=require(_0x9670('0x6'))['db'];var utils=require(_0x9670('0x7'));var logger=require('../../config/logger')(_0x9670('0x8'));var config=require(_0x9670('0x9'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});config[_0x9670('0xa')]=_['defaults'](config[_0x9670('0xa')],{'host':_0x9670('0xb'),'port':0x18eb});var socket=require(_0x9670('0xc'))(new Redis(config[_0x9670('0xa')]));require(_0x9670('0xd'))[_0x9670('0xe')](socket);function respondWithRpcPromise(_0x4d4e95,_0x4f43fa,_0x4de823){return new BPromise(function(_0xc49e32,_0x333ab9){return client[_0x9670('0xf')](_0x4d4e95,_0x4de823)[_0x9670('0x10')](function(_0x1dad62){logger['info'](_0x9670('0x11'),_0x4f43fa,_0x9670('0x12'));logger[_0x9670('0x13')](_0x9670('0x14'),_0x4f43fa,_0x9670('0x12'),JSON['stringify'](_0x1dad62));if(_0x1dad62[_0x9670('0x15')]){if(_0x1dad62[_0x9670('0x15')][_0x9670('0x16')]===0x1f4){logger['error'](_0x9670('0x11'),_0x4f43fa,_0x1dad62[_0x9670('0x15')][_0x9670('0x17')]);return _0x333ab9(_0x1dad62[_0x9670('0x15')][_0x9670('0x17')]);}logger[_0x9670('0x15')](_0x9670('0x11'),_0x4f43fa,_0x1dad62[_0x9670('0x15')][_0x9670('0x17')]);return _0xc49e32(_0x1dad62[_0x9670('0x15')][_0x9670('0x17')]);}else{logger[_0x9670('0x18')](_0x9670('0x11'),_0x4f43fa,_0x9670('0x12'));_0xc49e32(_0x1dad62[_0x9670('0x19')][_0x9670('0x17')]);}})[_0x9670('0x1a')](function(_0x3d7874){logger[_0x9670('0x15')](_0x9670('0x11'),_0x4f43fa,_0x3d7874);_0x333ab9(_0x3d7874);});});}exports[_0x9670('0x1b')]=function(_0x266a3f){var _0xad53a3=this;return new Promise(function(_0x4a8d9d,_0x321ee0){return db['SquareProject'][_0x9670('0x1c')]({'raw':_0x266a3f[_0x9670('0x1d')]?_0x266a3f[_0x9670('0x1d')][_0x9670('0x1e')]===undefined?!![]:![]:!![],'where':_0x266a3f[_0x9670('0x1d')]?_0x266a3f[_0x9670('0x1d')][_0x9670('0x1f')]||null:null,'attributes':_0x266a3f[_0x9670('0x1d')]?_0x266a3f[_0x9670('0x1d')][_0x9670('0x20')]||null:null,'include':_0x266a3f[_0x9670('0x1d')]?_0x266a3f[_0x9670('0x1d')][_0x9670('0x21')]?_[_0x9670('0x22')](_0x266a3f['options']['include'],function(_0x503412){return{'model':db[_0x503412[_0x9670('0x23')]],'as':_0x503412['as'],'attributes':_0x503412['attributes'],'include':_0x503412['include']?_[_0x9670('0x22')](_0x503412['include'],function(_0x49c4b9){return{'model':db[_0x49c4b9[_0x9670('0x23')]],'as':_0x49c4b9['as'],'attributes':_0x49c4b9[_0x9670('0x20')],'include':_0x49c4b9['include']?_[_0x9670('0x22')](_0x49c4b9[_0x9670('0x21')],function(_0x55b3a1){return{'model':db[_0x55b3a1[_0x9670('0x23')]],'as':_0x55b3a1['as'],'attributes':_0x55b3a1[_0x9670('0x20')]};}):[]};}):[]};}):[]:[]})[_0x9670('0x10')](function(_0x4e8ac3){logger[_0x9670('0x18')](_0x9670('0x1b'),_0x266a3f);logger[_0x9670('0x13')]('ShowSquareProject',_0x266a3f,JSON[_0x9670('0x24')](_0x4e8ac3));_0x4a8d9d(_0x4e8ac3);})[_0x9670('0x1a')](function(_0x3acd2a){logger[_0x9670('0x15')]('ShowSquareProject',_0x3acd2a[_0x9670('0x17')],_0x266a3f);_0x321ee0(_0xad53a3[_0x9670('0x15')](0x1f4,_0x3acd2a['message']));});});}; \ No newline at end of file +var _0x7094=['stringify','error','code','SquareProject,\x20%s,\x20%s','message','result','catch','ShowSquareProject','find','options','raw','where','attributes','include','map','model','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','redis','defaults','localhost','socket.io-emitter','./squareProject.socket','register','request','then','info','request\x20sent','debug','SquareProject,\x20%s,\x20%s,\x20%s'];(function(_0xa5a2e,_0x55ad0d){var _0x261b44=function(_0x498885){while(--_0x498885){_0xa5a2e['push'](_0xa5a2e['shift']());}};_0x261b44(++_0x55ad0d);}(_0x7094,0x196));var _0x4709=function(_0x26a46e,_0x3ede52){_0x26a46e=_0x26a46e-0x0;var _0x1e3ae2=_0x7094[_0x26a46e];return _0x1e3ae2;};'use strict';var _=require(_0x4709('0x0'));var util=require(_0x4709('0x1'));var moment=require('moment');var BPromise=require(_0x4709('0x2'));var rs=require(_0x4709('0x3'));var fs=require('fs');var Redis=require(_0x4709('0x4'));var db=require(_0x4709('0x5'))['db'];var utils=require(_0x4709('0x6'));var logger=require(_0x4709('0x7'))(_0x4709('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x4709('0x9')][_0x4709('0xa')]({'port':0x232a});config[_0x4709('0xb')]=_[_0x4709('0xc')](config[_0x4709('0xb')],{'host':_0x4709('0xd'),'port':0x18eb});var socket=require(_0x4709('0xe'))(new Redis(config[_0x4709('0xb')]));require(_0x4709('0xf'))[_0x4709('0x10')](socket);function respondWithRpcPromise(_0x50cfb0,_0x425b10,_0x35117c){return new BPromise(function(_0x280c7b,_0x3b2777){return client[_0x4709('0x11')](_0x50cfb0,_0x35117c)[_0x4709('0x12')](function(_0x2d3181){logger[_0x4709('0x13')]('SquareProject,\x20%s,\x20%s',_0x425b10,_0x4709('0x14'));logger[_0x4709('0x15')](_0x4709('0x16'),_0x425b10,_0x4709('0x14'),JSON[_0x4709('0x17')](_0x2d3181));if(_0x2d3181[_0x4709('0x18')]){if(_0x2d3181[_0x4709('0x18')][_0x4709('0x19')]===0x1f4){logger[_0x4709('0x18')](_0x4709('0x1a'),_0x425b10,_0x2d3181[_0x4709('0x18')]['message']);return _0x3b2777(_0x2d3181['error'][_0x4709('0x1b')]);}logger[_0x4709('0x18')](_0x4709('0x1a'),_0x425b10,_0x2d3181[_0x4709('0x18')][_0x4709('0x1b')]);return _0x280c7b(_0x2d3181[_0x4709('0x18')][_0x4709('0x1b')]);}else{logger[_0x4709('0x13')]('SquareProject,\x20%s,\x20%s',_0x425b10,_0x4709('0x14'));_0x280c7b(_0x2d3181[_0x4709('0x1c')]['message']);}})[_0x4709('0x1d')](function(_0x2a4c0a){logger[_0x4709('0x18')](_0x4709('0x1a'),_0x425b10,_0x2a4c0a);_0x3b2777(_0x2a4c0a);});});}exports[_0x4709('0x1e')]=function(_0x10279b){var _0x1d6732=this;return new Promise(function(_0x2a9a68,_0x1b56fa){return db['SquareProject'][_0x4709('0x1f')]({'raw':_0x10279b[_0x4709('0x20')]?_0x10279b[_0x4709('0x20')][_0x4709('0x21')]===undefined?!![]:![]:!![],'where':_0x10279b[_0x4709('0x20')]?_0x10279b[_0x4709('0x20')][_0x4709('0x22')]||null:null,'attributes':_0x10279b[_0x4709('0x20')]?_0x10279b[_0x4709('0x20')][_0x4709('0x23')]||null:null,'include':_0x10279b[_0x4709('0x20')]?_0x10279b[_0x4709('0x20')][_0x4709('0x24')]?_[_0x4709('0x25')](_0x10279b['options'][_0x4709('0x24')],function(_0x52f7e6){return{'model':db[_0x52f7e6['model']],'as':_0x52f7e6['as'],'attributes':_0x52f7e6[_0x4709('0x23')],'include':_0x52f7e6[_0x4709('0x24')]?_[_0x4709('0x25')](_0x52f7e6[_0x4709('0x24')],function(_0x1b2665){return{'model':db[_0x1b2665[_0x4709('0x26')]],'as':_0x1b2665['as'],'attributes':_0x1b2665[_0x4709('0x23')],'include':_0x1b2665[_0x4709('0x24')]?_['map'](_0x1b2665[_0x4709('0x24')],function(_0x1de00d){return{'model':db[_0x1de00d['model']],'as':_0x1de00d['as'],'attributes':_0x1de00d[_0x4709('0x23')]};}):[]};}):[]};}):[]:[]})[_0x4709('0x12')](function(_0x5cfb0d){logger[_0x4709('0x13')]('ShowSquareProject',_0x10279b);logger[_0x4709('0x15')](_0x4709('0x1e'),_0x10279b,JSON[_0x4709('0x17')](_0x5cfb0d));_0x2a9a68(_0x5cfb0d);})['catch'](function(_0x3eaf86){logger['error'](_0x4709('0x1e'),_0x3eaf86['message'],_0x10279b);_0x1b56fa(_0x1d6732[_0x4709('0x18')](0x1f4,_0x3eaf86['message']));});});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.socket.js b/server/api/squareProject/squareProject.socket.js index a6eead5..a495bb6 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 _0xadd6=['squareProject:','./squareProject.events','save','remove','update','removeListener','length'];(function(_0x17e771,_0x55fd17){var _0x1f3a6d=function(_0x346ee3){while(--_0x346ee3){_0x17e771['push'](_0x17e771['shift']());}};_0x1f3a6d(++_0x55fd17);}(_0xadd6,0x158));var _0x6add=function(_0xccc0d4,_0x2f6bf7){_0xccc0d4=_0xccc0d4-0x0;var _0x27a653=_0xadd6[_0xccc0d4];return _0x27a653;};'use strict';var SquareProjectEvents=require(_0x6add('0x0'));var events=[_0x6add('0x1'),_0x6add('0x2'),_0x6add('0x3')];function createListener(_0x54f885,_0x54c150){return function(_0x1195ce){_0x54c150['emit'](_0x54f885,_0x1195ce);};}function removeListener(_0xa42216,_0x3cbe3d){return function(){SquareProjectEvents[_0x6add('0x4')](_0xa42216,_0x3cbe3d);};}exports['register']=function(_0x1eddeb){for(var _0x5d7537=0x0,_0x1485c9=events[_0x6add('0x5')];_0x5d7537<_0x1485c9;_0x5d7537++){var _0x2a584b=events[_0x5d7537];var _0x121051=createListener(_0x6add('0x6')+_0x2a584b,_0x1eddeb);SquareProjectEvents['on'](_0x2a584b,_0x121051);}}; \ No newline at end of file +var _0x84f4=['emit','squareProject:','./squareProject.events','save','remove'];(function(_0xdf07df,_0x39e3b2){var _0x4dcea6=function(_0x101def){while(--_0x101def){_0xdf07df['push'](_0xdf07df['shift']());}};_0x4dcea6(++_0x39e3b2);}(_0x84f4,0x165));var _0x484f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x84f4[_0x3dd15e];return _0x231fd0;};'use strict';var SquareProjectEvents=require(_0x484f('0x0'));var events=[_0x484f('0x1'),_0x484f('0x2'),'update'];function createListener(_0xc760cd,_0x18073f){return function(_0x155d3a){_0x18073f[_0x484f('0x3')](_0xc760cd,_0x155d3a);};}function removeListener(_0x56142b,_0x53caf7){return function(){SquareProjectEvents['removeListener'](_0x56142b,_0x53caf7);};}exports['register']=function(_0x48a0d2){for(var _0x415d1b=0x0,_0x44f279=events['length'];_0x415d1b<_0x44f279;_0x415d1b++){var _0xfcd972=events[_0x415d1b];var _0x36f33e=createListener(_0x484f('0x4')+_0xfcd972,_0x48a0d2);SquareProjectEvents['on'](_0xfcd972,_0x36f33e);}}; \ No newline at end of file diff --git a/server/api/squareRecording/index.js b/server/api/squareRecording/index.js index 3147d52..1c63680 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 _0xf494=['../../config/environment','./squareRecording.controller','get','isAuthenticated','index','show','/:id/download','download','post','create','/:id','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x3bc712,_0x497831){var _0x3b861c=function(_0x431da7){while(--_0x431da7){_0x3bc712['push'](_0x3bc712['shift']());}};_0x3b861c(++_0x497831);}(_0xf494,0x1c6));var _0x4f49=function(_0x36b444,_0x505b35){_0x36b444=_0x36b444-0x0;var _0x786323=_0xf494[_0x36b444];return _0x786323;};'use strict';var multer=require(_0x4f49('0x0'));var util=require(_0x4f49('0x1'));var path=require(_0x4f49('0x2'));var timeout=require('connect-timeout');var express=require(_0x4f49('0x3'));var router=express[_0x4f49('0x4')]();var fs_extra=require(_0x4f49('0x5'));var auth=require(_0x4f49('0x6'));var interaction=require(_0x4f49('0x7'));var config=require(_0x4f49('0x8'));var controller=require(_0x4f49('0x9'));router[_0x4f49('0xa')]('/',auth[_0x4f49('0xb')](),controller[_0x4f49('0xc')]);router[_0x4f49('0xa')]('/:id',auth['isAuthenticated'](),controller[_0x4f49('0xd')]);router[_0x4f49('0xa')](_0x4f49('0xe'),auth[_0x4f49('0xb')](),controller[_0x4f49('0xf')]);router[_0x4f49('0x10')]('/',auth[_0x4f49('0xb')](),controller[_0x4f49('0x11')]);router['put'](_0x4f49('0x12'),auth[_0x4f49('0xb')](),controller['update']);router[_0x4f49('0x13')]('/:id',auth['isAuthenticated'](),controller[_0x4f49('0x14')]);module[_0x4f49('0x15')]=router; \ No newline at end of file +var _0x7a54=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareRecording.controller','get','index','/:id','isAuthenticated','post','put','update','delete','destroy','exports','multer','util','path','express'];(function(_0x5a6743,_0x2cb9b8){var _0x51894e=function(_0x1e40b5){while(--_0x1e40b5){_0x5a6743['push'](_0x5a6743['shift']());}};_0x51894e(++_0x2cb9b8);}(_0x7a54,0x106));var _0x47a5=function(_0x204354,_0x408a72){_0x204354=_0x204354-0x0;var _0x3e928b=_0x7a54[_0x204354];return _0x3e928b;};'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('0x9')]('/:id/download',auth['isAuthenticated'](),controller['download']);router[_0x47a5('0xd')]('/',auth[_0x47a5('0xc')](),controller['create']);router[_0x47a5('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x47a5('0xf')]);router[_0x47a5('0x10')](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller[_0x47a5('0x11')]);module[_0x47a5('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 a4c4210..1ba9f97 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 _0x032e=['VIRTUAL','getDataValue','savePath','substring','lastIndexOf','sequelize','STRING'];(function(_0x520ba7,_0x12b617){var _0x20b10e=function(_0x26b43c){while(--_0x26b43c){_0x520ba7['push'](_0x520ba7['shift']());}};_0x20b10e(++_0x12b617);}(_0x032e,0x124));var _0xe032=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x032e[_0x501510];return _0x1e6ee5;};'use strict';var Sequelize=require(_0xe032('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0xe032('0x1')]},'callerid':{'type':Sequelize[_0xe032('0x1')]},'calleridname':{'type':Sequelize['STRING']},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize[_0xe032('0x1')]},'priority':{'type':Sequelize[_0xe032('0x1')]},'accountcode':{'type':Sequelize[_0xe032('0x1')]},'dnid':{'type':Sequelize[_0xe032('0x1')]},'projectName':{'type':Sequelize[_0xe032('0x1')]},'saveName':{'type':Sequelize[_0xe032('0x1')]},'filename':{'type':Sequelize[_0xe032('0x1')]},'savePath':{'type':Sequelize[_0xe032('0x1')]},'format':{'type':Sequelize[_0xe032('0x2')],'get':function(){var _0x1576c8='';var _0x3289b0=this[_0xe032('0x3')](_0xe032('0x4'));if(_0x3289b0){_0x1576c8=_0x3289b0[_0xe032('0x5')](_0x3289b0[_0xe032('0x6')]('.'));}return _0x1576c8;}}}; \ No newline at end of file +var _0x2675=['getDataValue','savePath','lastIndexOf','sequelize','STRING','VIRTUAL'];(function(_0x25d73b,_0x15dae9){var _0x5f4b34=function(_0x2b3532){while(--_0x2b3532){_0x25d73b['push'](_0x25d73b['shift']());}};_0x5f4b34(++_0x15dae9);}(_0x2675,0x75));var _0x5267=function(_0x1a6fcf,_0x70c146){_0x1a6fcf=_0x1a6fcf-0x0;var _0x5598bd=_0x2675[_0x1a6fcf];return _0x5598bd;};'use strict';var Sequelize=require(_0x5267('0x0'));module['exports']={'uniqueid':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x5267('0x1')]},'context':{'type':Sequelize[_0x5267('0x1')]},'extension':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x5267('0x1')]},'accountcode':{'type':Sequelize[_0x5267('0x1')]},'dnid':{'type':Sequelize['STRING']},'projectName':{'type':Sequelize[_0x5267('0x1')]},'saveName':{'type':Sequelize[_0x5267('0x1')]},'filename':{'type':Sequelize[_0x5267('0x1')]},'savePath':{'type':Sequelize[_0x5267('0x1')]},'format':{'type':Sequelize[_0x5267('0x2')],'get':function(){var _0xc56cd5='';var _0x527c16=this[_0x5267('0x3')](_0x5267('0x4'));if(_0x527c16){_0xc56cd5=_0x527c16['substring'](_0x527c16[_0x5267('0x5')]('.'));}return _0xc56cd5;}}}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.controller.js b/server/api/squareRecording/squareRecording.controller.js index 945ffe1..e8994d6 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 _0xe309=['../../config/license/hardware','api','../../config/utils','../../mysqldb','end','json','offset','limit','undefined','count','status','set','Content-Range','apply','reject','update','then','error','name','SquareRecording','rawAttributes','fieldName','type','key','model','map','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','params','create','body','find','download','../../components/encryptor','uniqueid','filename','savePath','format','secrets','recording','existsSync','ValidationError','extname','message','SquareRecording\x20not\x20found','send','destroy','isNil','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x56a871,_0x18b7fe){var _0x124954=function(_0x39b7a1){while(--_0x39b7a1){_0x56a871['push'](_0x56a871['shift']());}};_0x124954(++_0x18b7fe);}(_0xe309,0xa2));var _0x9e30=function(_0x4cd54e,_0x9b7996){_0x4cd54e=_0x4cd54e-0x0;var _0xeedbe1=_0xe309[_0x4cd54e];return _0xeedbe1;};'use strict';var emlformat=require(_0x9e30('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x9e30('0x1'));var jsonpatch=require(_0x9e30('0x2'));var rp=require(_0x9e30('0x3'));var moment=require('moment');var BPromise=require(_0x9e30('0x4'));var Mustache=require(_0x9e30('0x5'));var util=require(_0x9e30('0x6'));var path=require(_0x9e30('0x7'));var sox=require('sox');var csv=require(_0x9e30('0x8'));var ejs=require(_0x9e30('0x9'));var fs=require('fs');var fs_extra=require(_0x9e30('0xa'));var _=require(_0x9e30('0xb'));var squel=require('squel');var crypto=require(_0x9e30('0xc'));var jsforce=require(_0x9e30('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x9e30('0x8'));var querystring=require(_0x9e30('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x9e30('0xf'));var qs=require(_0x9e30('0x10'));var as=require(_0x9e30('0x11'));var hardwareService=require(_0x9e30('0x12'));var logger=require('../../config/logger')(_0x9e30('0x13'));var utils=require(_0x9e30('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x9e30('0x15'))['db'];function respondWithStatusCode(_0x14e4b0,_0xb74afc){_0xb74afc=_0xb74afc||0xcc;return function(_0x50898e){if(_0x50898e){return _0x14e4b0['sendStatus'](_0xb74afc);}return _0x14e4b0['status'](_0xb74afc)[_0x9e30('0x16')]();};}function respondWithResult(_0x1b785f,_0x36f213){_0x36f213=_0x36f213||0xc8;return function(_0x5d38de){if(_0x5d38de){return _0x1b785f['status'](_0x36f213)[_0x9e30('0x17')](_0x5d38de);}};}function respondWithFilteredResult(_0x3ea251,_0x14420b){return function(_0x3cd842){if(_0x3cd842){var _0x1315f8=typeof _0x14420b[_0x9e30('0x18')]==='undefined'&&typeof _0x14420b[_0x9e30('0x19')]===_0x9e30('0x1a');var _0x14c1b5=_0x3cd842[_0x9e30('0x1b')];var _0x549276=_0x1315f8?0x0:_0x14420b[_0x9e30('0x18')];var _0x2e52c8=_0x1315f8?_0x3cd842['count']:_0x14420b[_0x9e30('0x18')]+_0x14420b[_0x9e30('0x19')];var _0x112036;if(_0x2e52c8>=_0x14c1b5){_0x2e52c8=_0x14c1b5;_0x112036=0xc8;}else{_0x112036=0xce;}_0x3ea251[_0x9e30('0x1c')](_0x112036);return _0x3ea251[_0x9e30('0x1d')](_0x9e30('0x1e'),_0x549276+'-'+_0x2e52c8+'/'+_0x14c1b5)[_0x9e30('0x17')](_0x3cd842);}return null;};}function patchUpdates(_0x524a87){return function(_0x252194){try{jsonpatch[_0x9e30('0x1f')](_0x252194,_0x524a87,!![]);}catch(_0x21269c){return BPromise[_0x9e30('0x20')](_0x21269c);}return _0x252194['save']();};}function saveUpdates(_0x1571bf,_0x358835){return function(_0x1e1536){if(_0x1e1536){return _0x1e1536[_0x9e30('0x21')](_0x1571bf)[_0x9e30('0x22')](function(_0x5d2855){return _0x5d2855;});}return null;};}function removeEntity(_0x2a74bb,_0x433975){return function(_0x217b5a){if(_0x217b5a){return _0x217b5a['destroy']()[_0x9e30('0x22')](function(){_0x2a74bb[_0x9e30('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4d1ca3,_0x339be1){return function(_0xa3b171){if(!_0xa3b171){_0x4d1ca3['sendStatus'](0x194);}return _0xa3b171;};}function handleError(_0x9fe6b9,_0x14edab){_0x14edab=_0x14edab||0x1f4;return function(_0x21f7aa){logger[_0x9e30('0x23')](_0x21f7aa['stack']);if(_0x21f7aa[_0x9e30('0x24')]){delete _0x21f7aa[_0x9e30('0x24')];}_0x9fe6b9['status'](_0x14edab)['send'](_0x21f7aa);};}exports['index']=function(_0xc26684,_0x591b3a){var _0x5a1492={},_0x4b1a2={},_0x190f79={'count':0x0,'rows':[]};var _0x18f9e6=_['map'](db[_0x9e30('0x25')][_0x9e30('0x26')],function(_0x59ef28){return{'name':_0x59ef28[_0x9e30('0x27')],'type':_0x59ef28[_0x9e30('0x28')][_0x9e30('0x29')]};});_0x4b1a2[_0x9e30('0x2a')]=_[_0x9e30('0x2b')](_0x18f9e6,_0x9e30('0x24'));_0x4b1a2[_0x9e30('0x2c')]=_[_0x9e30('0x2d')](_0xc26684[_0x9e30('0x2c')]);_0x4b1a2[_0x9e30('0x2e')]=_['intersection'](_0x4b1a2['model'],_0x4b1a2[_0x9e30('0x2c')]);_0x5a1492[_0x9e30('0x2f')]=_[_0x9e30('0x30')](_0x4b1a2[_0x9e30('0x2a')],qs['fields'](_0xc26684[_0x9e30('0x2c')][_0x9e30('0x31')]));_0x5a1492[_0x9e30('0x2f')]=_0x5a1492['attributes'][_0x9e30('0x32')]?_0x5a1492[_0x9e30('0x2f')]:_0x4b1a2['model'];if(!_0xc26684[_0x9e30('0x2c')][_0x9e30('0x33')](_0x9e30('0x34'))){_0x5a1492[_0x9e30('0x19')]=qs[_0x9e30('0x19')](_0xc26684[_0x9e30('0x2c')]['limit']);_0x5a1492['offset']=qs['offset'](_0xc26684[_0x9e30('0x2c')][_0x9e30('0x18')]);}_0x5a1492['order']=qs['sort'](_0xc26684[_0x9e30('0x2c')][_0x9e30('0x35')]);_0x5a1492[_0x9e30('0x36')]=qs[_0x9e30('0x2e')](_[_0x9e30('0x37')](_0xc26684[_0x9e30('0x2c')],_0x4b1a2[_0x9e30('0x2e')]),_0x18f9e6);if(_0xc26684[_0x9e30('0x2c')][_0x9e30('0x38')]){_0x5a1492[_0x9e30('0x36')]=_[_0x9e30('0x39')](_0x5a1492[_0x9e30('0x36')],{'$or':_[_0x9e30('0x2b')](_0x18f9e6,function(_0x22baef){if(_0x22baef[_0x9e30('0x28')]!=='VIRTUAL'){var _0xfea124={};_0xfea124[_0x22baef[_0x9e30('0x24')]]={'$like':'%'+_0xc26684[_0x9e30('0x2c')]['filter']+'%'};return _0xfea124;}})});}_0x5a1492=_[_0x9e30('0x39')]({},_0x5a1492,_0xc26684[_0x9e30('0x3a')]);var _0x2dccc1={'where':_0x5a1492[_0x9e30('0x36')]};return db[_0x9e30('0x25')][_0x9e30('0x1b')](_0x2dccc1)[_0x9e30('0x22')](function(_0x9beec5){_0x190f79['count']=_0x9beec5;if(_0xc26684['query'][_0x9e30('0x3b')]){_0x5a1492[_0x9e30('0x3c')]=[{'all':!![]}];}return db[_0x9e30('0x25')][_0x9e30('0x3d')](_0x5a1492);})[_0x9e30('0x22')](function(_0x525d2f){_0x190f79[_0x9e30('0x3e')]=_0x525d2f;return _0x190f79;})['then'](respondWithFilteredResult(_0x591b3a,_0x5a1492))[_0x9e30('0x3f')](handleError(_0x591b3a,null));};exports['show']=function(_0x39a240,_0x1628f9){var _0x4db43f={'raw':!![],'where':{'id':_0x39a240[_0x9e30('0x40')]['id']}},_0x5aa275={};_0x5aa275[_0x9e30('0x2a')]=_['keys'](db[_0x9e30('0x25')][_0x9e30('0x26')]);_0x5aa275['query']=_[_0x9e30('0x2d')](_0x39a240[_0x9e30('0x2c')]);_0x5aa275['filters']=_['intersection'](_0x5aa275[_0x9e30('0x2a')],_0x5aa275[_0x9e30('0x2c')]);_0x4db43f[_0x9e30('0x2f')]=_[_0x9e30('0x30')](_0x5aa275[_0x9e30('0x2a')],qs[_0x9e30('0x31')](_0x39a240[_0x9e30('0x2c')]['fields']));_0x4db43f[_0x9e30('0x2f')]=_0x4db43f[_0x9e30('0x2f')][_0x9e30('0x32')]?_0x4db43f[_0x9e30('0x2f')]:_0x5aa275[_0x9e30('0x2a')];if(_0x39a240[_0x9e30('0x2c')][_0x9e30('0x3b')]){_0x4db43f['include']=[{'all':!![]}];}_0x4db43f=_[_0x9e30('0x39')]({},_0x4db43f,_0x39a240[_0x9e30('0x3a')]);return db[_0x9e30('0x25')]['find'](_0x4db43f)['then'](handleEntityNotFound(_0x1628f9,null))[_0x9e30('0x22')](respondWithResult(_0x1628f9,null))[_0x9e30('0x3f')](handleError(_0x1628f9,null));};exports['create']=function(_0xa48542,_0x3b8190){return db['SquareRecording'][_0x9e30('0x41')](_0xa48542['body'],{})[_0x9e30('0x22')](respondWithResult(_0x3b8190,0xc9))[_0x9e30('0x3f')](handleError(_0x3b8190,null));};exports[_0x9e30('0x21')]=function(_0x51726d,_0x2e00ef){if(_0x51726d[_0x9e30('0x42')]['id']){delete _0x51726d['body']['id'];}return db[_0x9e30('0x25')][_0x9e30('0x43')]({'where':{'id':_0x51726d['params']['id']}})['then'](handleEntityNotFound(_0x2e00ef,null))[_0x9e30('0x22')](saveUpdates(_0x51726d[_0x9e30('0x42')],null))[_0x9e30('0x22')](respondWithResult(_0x2e00ef,null))[_0x9e30('0x3f')](handleError(_0x2e00ef,null));};exports[_0x9e30('0x44')]=function(_0x4045cf,_0x28ed67,_0x186df8){var _0x1fed4c=require(_0x9e30('0x45'));var _0x38e072=![];var _0x3ac250={};if(_0x4045cf[_0x9e30('0x2c')][_0x9e30('0x28')]&&_0x4045cf[_0x9e30('0x2c')]['type']===_0x9e30('0x46')){_0x3ac250[_0x9e30('0x46')]=_0x4045cf[_0x9e30('0x40')]['id'];}else{_0x3ac250['id']=_0x4045cf['params']['id'];}return db[_0x9e30('0x25')][_0x9e30('0x43')]({'where':_0x3ac250,'attributes':['id','savePath',_0x9e30('0x47')],'raw':!![]})[_0x9e30('0x22')](handleEntityNotFound(_0x28ed67,null))[_0x9e30('0x22')](function(_0x4bde9b){if(_0x4bde9b){var _0x3e3020=_0x4bde9b[_0x9e30('0x48')];var _0xef4193=util[_0x9e30('0x49')]('%s.cypher',_0x3e3020);if(fs['existsSync'](_0xef4193)){_0x38e072=!![];return _0x1fed4c['decryptFile'](_0xef4193,_0x3e3020,config[_0x9e30('0x4a')][_0x9e30('0x4b')])[_0x9e30('0x22')](function(){return _0x4bde9b;});}return _0x4bde9b;}})['then'](function(_0x541088){if(_0x541088){var _0x387c96=_0x541088[_0x9e30('0x48')];if(!fs[_0x9e30('0x4c')](_0x387c96)){throw new db['Sequelize'][(_0x9e30('0x4d'))]('SquareRecording\x20not\x20found');}if(_0x541088['filename']){return _0x28ed67[_0x9e30('0x44')](_0x387c96,_0x541088[_0x9e30('0x47')]+path[_0x9e30('0x4e')](_0x387c96),function(){if(_0x38e072){fs['unlink'](_0x387c96);}});}else{return _0x28ed67['download'](_0x387c96,function(_0x4a4cf0){if(_0x38e072){fs['unlink'](_0x387c96);}});}}})[_0x9e30('0x3f')](function(_0x52e301){if(_0x52e301[_0x9e30('0x4f')]===_0x9e30('0x50')){_0x28ed67[_0x9e30('0x1c')](0x194)[_0x9e30('0x51')]('Not\x20found');}else{return handleError(_0x28ed67,null);}});};exports[_0x9e30('0x52')]=function(_0x4049b9,_0x5cae33){return db['SquareRecording'][_0x9e30('0x43')]({'where':{'id':_0x4049b9[_0x9e30('0x40')]['id']}})[_0x9e30('0x22')](function(_0x251193){if(_[_0x9e30('0x53')](_0x251193)){throw new ReferenceError('Entity\x20not\x20found');}return _0x251193;})[_0x9e30('0x22')](function(_0x1f0718){var _0x42bd77=_0x1f0718['savePath'];logger[_0x9e30('0x54')](_0x9e30('0x55'),_0x42bd77);if(!_[_0x9e30('0x53')](_0x1f0718[_0x9e30('0x48')])&&fs['existsSync'](_0x42bd77)){logger[_0x9e30('0x54')](_0x9e30('0x56')+_0x42bd77+_0x9e30('0x57'));fs[_0x9e30('0x58')](_0x42bd77);}_0x42bd77=_0x42bd77+_0x9e30('0x59');if(!_[_0x9e30('0x53')](_0x1f0718['savePath'])&&fs[_0x9e30('0x4c')](_0x42bd77)){logger[_0x9e30('0x54')](_0x9e30('0x56')+_0x42bd77+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0x9e30('0x58')](_0x42bd77);}return _0x1f0718;})[_0x9e30('0x22')](function(_0x10565a){if(!_0x10565a)throw new InternalError();return _0x10565a[_0x9e30('0x52')]();})[_0x9e30('0x22')](function(){_0x5cae33[_0x9e30('0x1c')](0xcc)[_0x9e30('0x16')]();})['catch'](handleError(_0x5cae33,null));}; \ No newline at end of file +var _0xf014=['fields','attributes','sort','pick','where','merge','filter','SquareRecording','includeAll','findAll','rows','catch','show','params','length','include','find','create','body','download','uniqueid','savePath','filename','format','%s.cypher','existsSync','decryptFile','secrets','Sequelize','ValidationError','SquareRecording\x20not\x20found','extname','unlink','Not\x20found','isNil','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','save','update','then','destroy','name','send','index','map','rawAttributes','type','key','model','query','keys','filters','intersection'];(function(_0x10c681,_0x3ae83b){var _0x34dfc6=function(_0x42a60f){while(--_0x42a60f){_0x10c681['push'](_0x10c681['shift']());}};_0x34dfc6(++_0x3ae83b);}(_0xf014,0xe2));var _0x4f01=function(_0x14a0b5,_0x1de8af){_0x14a0b5=_0x14a0b5-0x0;var _0x3a320b=_0xf014[_0x14a0b5];return _0x3a320b;};'use strict';var emlformat=require(_0x4f01('0x0'));var rimraf=require(_0x4f01('0x1'));var zipdir=require(_0x4f01('0x2'));var jsonpatch=require(_0x4f01('0x3'));var rp=require('request-promise');var moment=require(_0x4f01('0x4'));var BPromise=require(_0x4f01('0x5'));var Mustache=require(_0x4f01('0x6'));var util=require(_0x4f01('0x7'));var path=require(_0x4f01('0x8'));var sox=require(_0x4f01('0x9'));var csv=require(_0x4f01('0xa'));var ejs=require(_0x4f01('0xb'));var fs=require('fs');var fs_extra=require(_0x4f01('0xc'));var _=require('lodash');var squel=require(_0x4f01('0xd'));var crypto=require(_0x4f01('0xe'));var jsforce=require(_0x4f01('0xf'));var deskjs=require(_0x4f01('0x10'));var toCsv=require(_0x4f01('0xa'));var querystring=require(_0x4f01('0x11'));var Papa=require(_0x4f01('0x12'));var Redis=require(_0x4f01('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x4f01('0x14'));var as=require(_0x4f01('0x15'));var hardwareService=require(_0x4f01('0x16'));var logger=require(_0x4f01('0x17'))('api');var utils=require(_0x4f01('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x4f01('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x110385,_0x5c4fbb){_0x5c4fbb=_0x5c4fbb||0xcc;return function(_0x1f3c71){if(_0x1f3c71){return _0x110385[_0x4f01('0x1a')](_0x5c4fbb);}return _0x110385[_0x4f01('0x1b')](_0x5c4fbb)[_0x4f01('0x1c')]();};}function respondWithResult(_0x5388be,_0x1414d9){_0x1414d9=_0x1414d9||0xc8;return function(_0x603d91){if(_0x603d91){return _0x5388be[_0x4f01('0x1b')](_0x1414d9)[_0x4f01('0x1d')](_0x603d91);}};}function respondWithFilteredResult(_0x1021c0,_0x3be9a0){return function(_0x38ab2e){if(_0x38ab2e){var _0x46a4cc=typeof _0x3be9a0[_0x4f01('0x1e')]==='undefined'&&typeof _0x3be9a0[_0x4f01('0x1f')]===_0x4f01('0x20');var _0x153091=_0x38ab2e[_0x4f01('0x21')];var _0x20256a=_0x46a4cc?0x0:_0x3be9a0[_0x4f01('0x1e')];var _0x4a4b37=_0x46a4cc?_0x38ab2e[_0x4f01('0x21')]:_0x3be9a0['offset']+_0x3be9a0[_0x4f01('0x1f')];var _0x530dfb;if(_0x4a4b37>=_0x153091){_0x4a4b37=_0x153091;_0x530dfb=0xc8;}else{_0x530dfb=0xce;}_0x1021c0['status'](_0x530dfb);return _0x1021c0[_0x4f01('0x22')](_0x4f01('0x23'),_0x20256a+'-'+_0x4a4b37+'/'+_0x153091)[_0x4f01('0x1d')](_0x38ab2e);}return null;};}function patchUpdates(_0x4c066c){return function(_0x1968ca){try{jsonpatch[_0x4f01('0x24')](_0x1968ca,_0x4c066c,!![]);}catch(_0x14ecc3){return BPromise['reject'](_0x14ecc3);}return _0x1968ca[_0x4f01('0x25')]();};}function saveUpdates(_0x49fab0,_0x20ffc0){return function(_0xa813e4){if(_0xa813e4){return _0xa813e4[_0x4f01('0x26')](_0x49fab0)[_0x4f01('0x27')](function(_0x567cb6){return _0x567cb6;});}return null;};}function removeEntity(_0x42550d,_0x346d2a){return function(_0x4d4b98){if(_0x4d4b98){return _0x4d4b98[_0x4f01('0x28')]()[_0x4f01('0x27')](function(){_0x42550d['status'](0xcc)[_0x4f01('0x1c')]();});}};}function handleEntityNotFound(_0x3e9e83,_0x352a2b){return function(_0x522a61){if(!_0x522a61){_0x3e9e83[_0x4f01('0x1a')](0x194);}return _0x522a61;};}function handleError(_0x1e640d,_0x528891){_0x528891=_0x528891||0x1f4;return function(_0x8adb6e){logger['error'](_0x8adb6e['stack']);if(_0x8adb6e[_0x4f01('0x29')]){delete _0x8adb6e[_0x4f01('0x29')];}_0x1e640d[_0x4f01('0x1b')](_0x528891)[_0x4f01('0x2a')](_0x8adb6e);};}exports[_0x4f01('0x2b')]=function(_0x4eb9c4,_0x443bde){var _0x54e295={},_0x43dd33={},_0x26a3c6={'count':0x0,'rows':[]};var _0x5e933f=_[_0x4f01('0x2c')](db['SquareRecording'][_0x4f01('0x2d')],function(_0x5d525c){return{'name':_0x5d525c['fieldName'],'type':_0x5d525c[_0x4f01('0x2e')][_0x4f01('0x2f')]};});_0x43dd33[_0x4f01('0x30')]=_[_0x4f01('0x2c')](_0x5e933f,_0x4f01('0x29'));_0x43dd33[_0x4f01('0x31')]=_[_0x4f01('0x32')](_0x4eb9c4[_0x4f01('0x31')]);_0x43dd33[_0x4f01('0x33')]=_['intersection'](_0x43dd33[_0x4f01('0x30')],_0x43dd33[_0x4f01('0x31')]);_0x54e295['attributes']=_[_0x4f01('0x34')](_0x43dd33[_0x4f01('0x30')],qs['fields'](_0x4eb9c4[_0x4f01('0x31')][_0x4f01('0x35')]));_0x54e295['attributes']=_0x54e295[_0x4f01('0x36')]['length']?_0x54e295[_0x4f01('0x36')]:_0x43dd33[_0x4f01('0x30')];if(!_0x4eb9c4[_0x4f01('0x31')]['hasOwnProperty']('nolimit')){_0x54e295[_0x4f01('0x1f')]=qs[_0x4f01('0x1f')](_0x4eb9c4[_0x4f01('0x31')][_0x4f01('0x1f')]);_0x54e295['offset']=qs['offset'](_0x4eb9c4[_0x4f01('0x31')][_0x4f01('0x1e')]);}_0x54e295['order']=qs[_0x4f01('0x37')](_0x4eb9c4['query'][_0x4f01('0x37')]);_0x54e295['where']=qs[_0x4f01('0x33')](_[_0x4f01('0x38')](_0x4eb9c4[_0x4f01('0x31')],_0x43dd33['filters']),_0x5e933f);if(_0x4eb9c4[_0x4f01('0x31')]['filter']){_0x54e295[_0x4f01('0x39')]=_[_0x4f01('0x3a')](_0x54e295['where'],{'$or':_['map'](_0x5e933f,function(_0x1a2bea){if(_0x1a2bea[_0x4f01('0x2e')]!=='VIRTUAL'){var _0x130f83={};_0x130f83[_0x1a2bea[_0x4f01('0x29')]]={'$like':'%'+_0x4eb9c4[_0x4f01('0x31')][_0x4f01('0x3b')]+'%'};return _0x130f83;}})});}_0x54e295=_['merge']({},_0x54e295,_0x4eb9c4['options']);var _0x3bd7f1={'where':_0x54e295[_0x4f01('0x39')]};return db[_0x4f01('0x3c')][_0x4f01('0x21')](_0x3bd7f1)[_0x4f01('0x27')](function(_0x42df68){_0x26a3c6[_0x4f01('0x21')]=_0x42df68;if(_0x4eb9c4[_0x4f01('0x31')][_0x4f01('0x3d')]){_0x54e295['include']=[{'all':!![]}];}return db[_0x4f01('0x3c')][_0x4f01('0x3e')](_0x54e295);})[_0x4f01('0x27')](function(_0x41bccf){_0x26a3c6[_0x4f01('0x3f')]=_0x41bccf;return _0x26a3c6;})[_0x4f01('0x27')](respondWithFilteredResult(_0x443bde,_0x54e295))[_0x4f01('0x40')](handleError(_0x443bde,null));};exports[_0x4f01('0x41')]=function(_0x38eb6f,_0x46587d){var _0x51e30f={'raw':!![],'where':{'id':_0x38eb6f[_0x4f01('0x42')]['id']}},_0x52dbec={};_0x52dbec[_0x4f01('0x30')]=_['keys'](db[_0x4f01('0x3c')][_0x4f01('0x2d')]);_0x52dbec[_0x4f01('0x31')]=_['keys'](_0x38eb6f[_0x4f01('0x31')]);_0x52dbec[_0x4f01('0x33')]=_['intersection'](_0x52dbec['model'],_0x52dbec[_0x4f01('0x31')]);_0x51e30f['attributes']=_[_0x4f01('0x34')](_0x52dbec[_0x4f01('0x30')],qs[_0x4f01('0x35')](_0x38eb6f[_0x4f01('0x31')]['fields']));_0x51e30f[_0x4f01('0x36')]=_0x51e30f['attributes'][_0x4f01('0x43')]?_0x51e30f['attributes']:_0x52dbec[_0x4f01('0x30')];if(_0x38eb6f['query'][_0x4f01('0x3d')]){_0x51e30f[_0x4f01('0x44')]=[{'all':!![]}];}_0x51e30f=_[_0x4f01('0x3a')]({},_0x51e30f,_0x38eb6f['options']);return db[_0x4f01('0x3c')][_0x4f01('0x45')](_0x51e30f)[_0x4f01('0x27')](handleEntityNotFound(_0x46587d,null))['then'](respondWithResult(_0x46587d,null))[_0x4f01('0x40')](handleError(_0x46587d,null));};exports[_0x4f01('0x46')]=function(_0xa8f10b,_0x4ae7dd){return db[_0x4f01('0x3c')][_0x4f01('0x46')](_0xa8f10b[_0x4f01('0x47')],{})['then'](respondWithResult(_0x4ae7dd,0xc9))[_0x4f01('0x40')](handleError(_0x4ae7dd,null));};exports['update']=function(_0x112a5c,_0x534c2f){if(_0x112a5c['body']['id']){delete _0x112a5c[_0x4f01('0x47')]['id'];}return db['SquareRecording'][_0x4f01('0x45')]({'where':{'id':_0x112a5c[_0x4f01('0x42')]['id']}})[_0x4f01('0x27')](handleEntityNotFound(_0x534c2f,null))[_0x4f01('0x27')](saveUpdates(_0x112a5c['body'],null))[_0x4f01('0x27')](respondWithResult(_0x534c2f,null))[_0x4f01('0x40')](handleError(_0x534c2f,null));};exports[_0x4f01('0x48')]=function(_0x46fc8e,_0x13f3e1,_0x17276f){var _0x3ac42f=require('../../components/encryptor');var _0x4891fc=![];var _0xe6b108={};if(_0x46fc8e[_0x4f01('0x31')]['type']&&_0x46fc8e[_0x4f01('0x31')][_0x4f01('0x2e')]===_0x4f01('0x49')){_0xe6b108[_0x4f01('0x49')]=_0x46fc8e[_0x4f01('0x42')]['id'];}else{_0xe6b108['id']=_0x46fc8e[_0x4f01('0x42')]['id'];}return db[_0x4f01('0x3c')][_0x4f01('0x45')]({'where':_0xe6b108,'attributes':['id',_0x4f01('0x4a'),_0x4f01('0x4b')],'raw':!![]})[_0x4f01('0x27')](handleEntityNotFound(_0x13f3e1,null))['then'](function(_0x375153){if(_0x375153){var _0x33a7e3=_0x375153[_0x4f01('0x4a')];var _0x1e8d0e=util[_0x4f01('0x4c')](_0x4f01('0x4d'),_0x33a7e3);if(fs[_0x4f01('0x4e')](_0x1e8d0e)){_0x4891fc=!![];return _0x3ac42f[_0x4f01('0x4f')](_0x1e8d0e,_0x33a7e3,config[_0x4f01('0x50')]['recording'])[_0x4f01('0x27')](function(){return _0x375153;});}return _0x375153;}})[_0x4f01('0x27')](function(_0x50932a){if(_0x50932a){var _0x3a3c7a=_0x50932a['savePath'];if(!fs['existsSync'](_0x3a3c7a)){throw new db[(_0x4f01('0x51'))][(_0x4f01('0x52'))](_0x4f01('0x53'));}if(_0x50932a['filename']){return _0x13f3e1[_0x4f01('0x48')](_0x3a3c7a,_0x50932a[_0x4f01('0x4b')]+path[_0x4f01('0x54')](_0x3a3c7a),function(){if(_0x4891fc){fs[_0x4f01('0x55')](_0x3a3c7a);}});}else{return _0x13f3e1['download'](_0x3a3c7a,function(_0x44d01b){if(_0x4891fc){fs[_0x4f01('0x55')](_0x3a3c7a);}});}}})[_0x4f01('0x40')](function(_0x2fb267){if(_0x2fb267['message']===_0x4f01('0x53')){_0x13f3e1[_0x4f01('0x1b')](0x194)['send'](_0x4f01('0x56'));}else{return handleError(_0x13f3e1,null);}});};exports['destroy']=function(_0x11e5ec,_0x2c2077){return db[_0x4f01('0x3c')][_0x4f01('0x45')]({'where':{'id':_0x11e5ec['params']['id']}})['then'](function(_0x17fba9){if(_[_0x4f01('0x57')](_0x17fba9)){throw new ReferenceError('Entity\x20not\x20found');}return _0x17fba9;})[_0x4f01('0x27')](function(_0x26c0f9){var _0xa018cb=_0x26c0f9[_0x4f01('0x4a')];logger[_0x4f01('0x58')](_0x4f01('0x59'),_0xa018cb);if(!_[_0x4f01('0x57')](_0x26c0f9[_0x4f01('0x4a')])&&fs['existsSync'](_0xa018cb)){logger[_0x4f01('0x58')](_0x4f01('0x5a')+_0xa018cb+_0x4f01('0x5b'));fs[_0x4f01('0x5c')](_0xa018cb);}_0xa018cb=_0xa018cb+'.cypher';if(!_[_0x4f01('0x57')](_0x26c0f9[_0x4f01('0x4a')])&&fs[_0x4f01('0x4e')](_0xa018cb)){logger[_0x4f01('0x58')](_0x4f01('0x5a')+_0xa018cb+_0x4f01('0x5b'));fs[_0x4f01('0x5c')](_0xa018cb);}return _0x26c0f9;})[_0x4f01('0x27')](function(_0x12df91){if(!_0x12df91)throw new InternalError();return _0x12df91[_0x4f01('0x28')]();})[_0x4f01('0x27')](function(){_0x2c2077[_0x4f01('0x1b')](0xcc)['end']();})[_0x4f01('0x40')](handleError(_0x2c2077,null));}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.model.js b/server/api/squareRecording/squareRecording.model.js index 8e2572d..083a0d2 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 _0x288a=['define','SquareRecording','util','../../config/logger','api','moment','path','../../config/environment','./squareRecording.attributes','exports'];(function(_0x1ed116,_0x23bc80){var _0x574066=function(_0x424f9e){while(--_0x424f9e){_0x1ed116['push'](_0x1ed116['shift']());}};_0x574066(++_0x23bc80);}(_0x288a,0x188));var _0xa288=function(_0x23def1,_0x9de1e3){_0x23def1=_0x23def1-0x0;var _0x59c69e=_0x288a[_0x23def1];return _0x59c69e;};'use strict';var _=require('lodash');var util=require(_0xa288('0x0'));var logger=require(_0xa288('0x1'))(_0xa288('0x2'));var moment=require(_0xa288('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xa288('0x4'));var rimraf=require('rimraf');var config=require(_0xa288('0x5'));var attributes=require(_0xa288('0x6'));module[_0xa288('0x7')]=function(_0x4ad8fb,_0x1e2c4b){return _0x4ad8fb[_0xa288('0x8')](_0xa288('0x9'),attributes,{'tableName':'square_recordings','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x13c5=['exports','square_recordings','lodash','path','./squareRecording.attributes'];(function(_0x3fe469,_0x40058a){var _0x78e9ae=function(_0xe474eb){while(--_0xe474eb){_0x3fe469['push'](_0x3fe469['shift']());}};_0x78e9ae(++_0x40058a);}(_0x13c5,0x7a));var _0x513c=function(_0xcd903d,_0x2dcbc0){_0xcd903d=_0xcd903d-0x0;var _0x4342a3=_0x13c5[_0xcd903d];return _0x4342a3;};'use strict';var _=require(_0x513c('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x513c('0x1'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x513c('0x2'));module[_0x513c('0x3')]=function(_0x982017,_0x2ad2db){return _0x982017['define']('SquareRecording',attributes,{'tableName':_0x513c('0x4'),'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 4acf17d..568b222 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 _0xfdf4=['options','raw','then','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request','info','SquareRecording,\x20%s,\x20%s','debug','SquareRecording,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','CreateSquareRecording','SquareRecording','body'];(function(_0xac151d,_0x4ea1d2){var _0x111dba=function(_0x13d7f4){while(--_0x13d7f4){_0xac151d['push'](_0xac151d['shift']());}};_0x111dba(++_0x4ea1d2);}(_0xfdf4,0x11b));var _0x4fdf=function(_0x1e16a6,_0x59f411){_0x1e16a6=_0x1e16a6-0x0;var _0x15cf24=_0xfdf4[_0x1e16a6];return _0x15cf24;};'use strict';var _=require(_0x4fdf('0x0'));var util=require('util');var moment=require(_0x4fdf('0x1'));var BPromise=require(_0x4fdf('0x2'));var rs=require(_0x4fdf('0x3'));var fs=require('fs');var Redis=require(_0x4fdf('0x4'));var db=require(_0x4fdf('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x4fdf('0x6'))(_0x4fdf('0x7'));var config=require(_0x4fdf('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x4fdf('0x9')][_0x4fdf('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x36d06b,_0x5233c0,_0x55b13e){return new BPromise(function(_0x5a126c,_0x22a97b){return client[_0x4fdf('0xb')](_0x36d06b,_0x55b13e)['then'](function(_0xcdd596){logger[_0x4fdf('0xc')](_0x4fdf('0xd'),_0x5233c0,'request\x20sent');logger[_0x4fdf('0xe')](_0x4fdf('0xf'),_0x5233c0,_0x4fdf('0x10'),JSON[_0x4fdf('0x11')](_0xcdd596));if(_0xcdd596[_0x4fdf('0x12')]){if(_0xcdd596['error']['code']===0x1f4){logger[_0x4fdf('0x12')](_0x4fdf('0xd'),_0x5233c0,_0xcdd596[_0x4fdf('0x12')][_0x4fdf('0x13')]);return _0x22a97b(_0xcdd596['error']['message']);}logger['error']('SquareRecording,\x20%s,\x20%s',_0x5233c0,_0xcdd596[_0x4fdf('0x12')][_0x4fdf('0x13')]);return _0x5a126c(_0xcdd596[_0x4fdf('0x12')][_0x4fdf('0x13')]);}else{logger['info']('SquareRecording,\x20%s,\x20%s',_0x5233c0,_0x4fdf('0x10'));_0x5a126c(_0xcdd596[_0x4fdf('0x14')]['message']);}})[_0x4fdf('0x15')](function(_0x2a67f8){logger[_0x4fdf('0x12')](_0x4fdf('0xd'),_0x5233c0,_0x2a67f8);_0x22a97b(_0x2a67f8);});});}exports[_0x4fdf('0x16')]=function(_0x241422){var _0x15a550=this;return new Promise(function(_0x1d4d39,_0x407ec6){return db[_0x4fdf('0x17')]['create'](_0x241422[_0x4fdf('0x18')],{'raw':_0x241422[_0x4fdf('0x19')]?_0x241422[_0x4fdf('0x19')][_0x4fdf('0x1a')]===undefined?!![]:![]:!![]})[_0x4fdf('0x1b')](function(_0x1acc6f){logger[_0x4fdf('0xc')](_0x4fdf('0x16'),_0x241422);logger[_0x4fdf('0xe')](_0x4fdf('0x16'),_0x241422,JSON['stringify'](_0x1acc6f));_0x1d4d39(_0x1acc6f);})[_0x4fdf('0x15')](function(_0x3c3eae){logger[_0x4fdf('0x12')](_0x4fdf('0x16'),_0x3c3eae[_0x4fdf('0x13')],_0x241422);_0x407ec6(_0x15a550[_0x4fdf('0x12')](0x1f4,_0x3c3eae[_0x4fdf('0x13')]));});});}; \ No newline at end of file +var _0xe38e=['../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','SquareRecording,\x20%s,\x20%s','request\x20sent','debug','SquareRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','CreateSquareRecording','SquareRecording','create','body','then','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0xf5d71c,_0x2613a6){var _0x5af672=function(_0x191f52){while(--_0x191f52){_0xf5d71c['push'](_0xf5d71c['shift']());}};_0x5af672(++_0x2613a6);}(_0xe38e,0x1e0));var _0xee38=function(_0xa685f1,_0x14b0e2){_0xa685f1=_0xa685f1-0x0;var _0x566511=_0xe38e[_0xa685f1];return _0x566511;};'use strict';var _=require(_0xee38('0x0'));var util=require('util');var moment=require(_0xee38('0x1'));var BPromise=require(_0xee38('0x2'));var rs=require(_0xee38('0x3'));var fs=require('fs');var Redis=require(_0xee38('0x4'));var db=require(_0xee38('0x5'))['db'];var utils=require(_0xee38('0x6'));var logger=require(_0xee38('0x7'))('rpc');var config=require(_0xee38('0x8'));var jayson=require(_0xee38('0x9'));var client=jayson['client'][_0xee38('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x10bd47,_0x5266fc,_0x247011){return new BPromise(function(_0x529145,_0x173318){return client[_0xee38('0xb')](_0x10bd47,_0x247011)['then'](function(_0x2e9c9c){logger['info'](_0xee38('0xc'),_0x5266fc,_0xee38('0xd'));logger[_0xee38('0xe')](_0xee38('0xf'),_0x5266fc,_0xee38('0xd'),JSON[_0xee38('0x10')](_0x2e9c9c));if(_0x2e9c9c['error']){if(_0x2e9c9c[_0xee38('0x11')][_0xee38('0x12')]===0x1f4){logger[_0xee38('0x11')](_0xee38('0xc'),_0x5266fc,_0x2e9c9c[_0xee38('0x11')][_0xee38('0x13')]);return _0x173318(_0x2e9c9c[_0xee38('0x11')][_0xee38('0x13')]);}logger[_0xee38('0x11')](_0xee38('0xc'),_0x5266fc,_0x2e9c9c[_0xee38('0x11')][_0xee38('0x13')]);return _0x529145(_0x2e9c9c['error']['message']);}else{logger[_0xee38('0x14')](_0xee38('0xc'),_0x5266fc,_0xee38('0xd'));_0x529145(_0x2e9c9c['result']['message']);}})[_0xee38('0x15')](function(_0x1c6a28){logger[_0xee38('0x11')](_0xee38('0xc'),_0x5266fc,_0x1c6a28);_0x173318(_0x1c6a28);});});}exports[_0xee38('0x16')]=function(_0x4707e7){var _0x137974=this;return new Promise(function(_0x40afb0,_0x5b2b04){return db[_0xee38('0x17')][_0xee38('0x18')](_0x4707e7[_0xee38('0x19')],{'raw':_0x4707e7['options']?_0x4707e7['options']['raw']===undefined?!![]:![]:!![]})[_0xee38('0x1a')](function(_0x432a6e){logger['info'](_0xee38('0x16'),_0x4707e7);logger[_0xee38('0xe')](_0xee38('0x16'),_0x4707e7,JSON[_0xee38('0x10')](_0x432a6e));_0x40afb0(_0x432a6e);})[_0xee38('0x15')](function(_0x47329e){logger['error'](_0xee38('0x16'),_0x47329e[_0xee38('0x13')],_0x4707e7);_0x5b2b04(_0x137974['error'](0x1f4,_0x47329e[_0xee38('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/squareReport/index.js b/server/api/squareReport/index.js index b05a292..7156090 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 _0xb10b=['../../components/interaction/service','../../config/environment','./squareReport.controller','get','index','isAuthenticated','describe','/:id','show','post','update','destroy','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service'];(function(_0x295724,_0xbd5c55){var _0x311dfd=function(_0xc2d60d){while(--_0xc2d60d){_0x295724['push'](_0x295724['shift']());}};_0x311dfd(++_0xbd5c55);}(_0xb10b,0x12a));var _0xbb10=function(_0x3bfd9a,_0x5c5a47){_0x3bfd9a=_0x3bfd9a-0x0;var _0x34ae7c=_0xb10b[_0x3bfd9a];return _0x34ae7c;};'use strict';var multer=require(_0xbb10('0x0'));var util=require('util');var path=require(_0xbb10('0x1'));var timeout=require(_0xbb10('0x2'));var express=require(_0xbb10('0x3'));var router=express['Router']();var fs_extra=require(_0xbb10('0x4'));var auth=require(_0xbb10('0x5'));var interaction=require(_0xbb10('0x6'));var config=require(_0xbb10('0x7'));var controller=require(_0xbb10('0x8'));router[_0xbb10('0x9')]('/',auth['isAuthenticated'](),controller[_0xbb10('0xa')]);router[_0xbb10('0x9')]('/describe',auth[_0xbb10('0xb')](),controller[_0xbb10('0xc')]);router[_0xbb10('0x9')](_0xbb10('0xd'),auth[_0xbb10('0xb')](),controller[_0xbb10('0xe')]);router[_0xbb10('0xf')]('/',auth[_0xbb10('0xb')](),controller['create']);router['put'](_0xbb10('0xd'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x10')]);router['delete'](_0xbb10('0xd'),auth['isAuthenticated'](),controller[_0xbb10('0x11')]);module[_0xbb10('0x12')]=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(_0x26c04b,_0x43a36){var _0x5d1bed=function(_0x2d60af){while(--_0x2d60af){_0x26c04b['push'](_0x26c04b['shift']());}};_0x5d1bed(++_0x43a36);}(_0xbaf0,0x12a));var _0x0baf=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0xbaf0[_0x6c993a];return _0x27f547;};'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 a530427..39466ca 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 _0x1458=['exports','STRING','DATE','BOOLEAN','sequelize'];(function(_0x160c73,_0x2ee678){var _0xd9302=function(_0x169454){while(--_0x169454){_0x160c73['push'](_0x160c73['shift']());}};_0xd9302(++_0x2ee678);}(_0x1458,0x16c));var _0x8145=function(_0x170d16,_0x443724){_0x170d16=_0x170d16-0x0;var _0x1bf864=_0x1458[_0x170d16];return _0x1bf864;};'use strict';var Sequelize=require(_0x8145('0x0'));module[_0x8145('0x1')]={'network':{'type':Sequelize[_0x8145('0x2')]},'network_script':{'type':Sequelize[_0x8145('0x2')]},'request':{'type':Sequelize[_0x8145('0x2')]},'channel':{'type':Sequelize[_0x8145('0x2')]},'language':{'type':Sequelize[_0x8145('0x2')]},'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x8145('0x2')]},'version':{'type':Sequelize[_0x8145('0x2')]},'callerid':{'type':Sequelize[_0x8145('0x2')]},'calleridname':{'type':Sequelize[_0x8145('0x2')]},'callingpres':{'type':Sequelize[_0x8145('0x2')]},'callingani2':{'type':Sequelize['STRING']},'callington':{'type':Sequelize[_0x8145('0x2')]},'callingtns':{'type':Sequelize['STRING']},'dnid':{'type':Sequelize['STRING']},'rdnis':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x8145('0x2')]},'extension':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x8145('0x2')]},'enhanced':{'type':Sequelize[_0x8145('0x2')]},'accountcode':{'type':Sequelize['STRING']},'threadid':{'type':Sequelize[_0x8145('0x2')]},'project_name':{'type':Sequelize[_0x8145('0x2')]},'joinAt':{'type':Sequelize[_0x8145('0x3')]},'leaveAt':{'type':Sequelize[_0x8145('0x3')]},'bot':{'type':Sequelize[_0x8145('0x4')],'defaultValue':![]}}; \ No newline at end of file +var _0x2b63=['sequelize','exports','STRING','DATE'];(function(_0x2c398c,_0x26eee2){var _0x1a7964=function(_0x2b04f3){while(--_0x2b04f3){_0x2c398c['push'](_0x2c398c['shift']());}};_0x1a7964(++_0x26eee2);}(_0x2b63,0x1d4));var _0x32b6=function(_0x30735f,_0x3c2cec){_0x30735f=_0x30735f-0x0;var _0x140ac6=_0x2b63[_0x30735f];return _0x140ac6;};'use strict';var Sequelize=require(_0x32b6('0x0'));module[_0x32b6('0x1')]={'network':{'type':Sequelize['STRING']},'network_script':{'type':Sequelize['STRING']},'request':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x32b6('0x2')]},'language':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x32b6('0x2')]},'uniqueid':{'type':Sequelize[_0x32b6('0x2')]},'version':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0x32b6('0x2')]},'calleridname':{'type':Sequelize['STRING']},'callingpres':{'type':Sequelize[_0x32b6('0x2')]},'callingani2':{'type':Sequelize[_0x32b6('0x2')]},'callington':{'type':Sequelize[_0x32b6('0x2')]},'callingtns':{'type':Sequelize['STRING']},'dnid':{'type':Sequelize[_0x32b6('0x2')]},'rdnis':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x32b6('0x2')]},'extension':{'type':Sequelize[_0x32b6('0x2')]},'priority':{'type':Sequelize['STRING']},'enhanced':{'type':Sequelize[_0x32b6('0x2')]},'accountcode':{'type':Sequelize['STRING']},'threadid':{'type':Sequelize[_0x32b6('0x2')]},'project_name':{'type':Sequelize[_0x32b6('0x2')]},'joinAt':{'type':Sequelize[_0x32b6('0x3')]},'leaveAt':{'type':Sequelize[_0x32b6('0x3')]},'bot':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.controller.js b/server/api/squareReport/squareReport.controller.js index bdfdb45..b68306d 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 _0x31fa=['show','params','find','create','body','describe','zip-dir','fast-json-patch','moment','bluebird','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','map','SquareReport','rawAttributes','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','offset','order','sort','where','pick','VIRTUAL','filter','merge','includeAll','include','catch'];(function(_0xdb8c20,_0x1b4fff){var _0x4d2d2e=function(_0x2c7328){while(--_0x2c7328){_0xdb8c20['push'](_0xdb8c20['shift']());}};_0x4d2d2e(++_0x1b4fff);}(_0x31fa,0x90));var _0xa31f=function(_0x1d1779,_0x284147){_0x1d1779=_0x1d1779-0x0;var _0x2377e9=_0x31fa[_0x1d1779];return _0x2377e9;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xa31f('0x0'));var jsonpatch=require(_0xa31f('0x1'));var rp=require('request-promise');var moment=require(_0xa31f('0x2'));var BPromise=require(_0xa31f('0x3'));var Mustache=require('mustache');var util=require('util');var path=require(_0xa31f('0x4'));var sox=require(_0xa31f('0x5'));var csv=require(_0xa31f('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa31f('0x7'));var _=require(_0xa31f('0x8'));var squel=require(_0xa31f('0x9'));var crypto=require(_0xa31f('0xa'));var jsforce=require(_0xa31f('0xb'));var deskjs=require(_0xa31f('0xc'));var toCsv=require(_0xa31f('0x6'));var querystring=require(_0xa31f('0xd'));var Papa=require(_0xa31f('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xa31f('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa31f('0x10'))(_0xa31f('0x11'));var utils=require(_0xa31f('0x12'));var config=require(_0xa31f('0x13'));var licenseUtil=require(_0xa31f('0x14'));var db=require(_0xa31f('0x15'))['db'];function respondWithStatusCode(_0x31d4e1,_0x35c511){_0x35c511=_0x35c511||0xcc;return function(_0xf16a46){if(_0xf16a46){return _0x31d4e1[_0xa31f('0x16')](_0x35c511);}return _0x31d4e1[_0xa31f('0x17')](_0x35c511)['end']();};}function respondWithResult(_0x3809c8,_0x160e16){_0x160e16=_0x160e16||0xc8;return function(_0x1e1014){if(_0x1e1014){return _0x3809c8[_0xa31f('0x17')](_0x160e16)[_0xa31f('0x18')](_0x1e1014);}};}function respondWithFilteredResult(_0x19eb5e,_0x3741ab){return function(_0x1c3edf){if(_0x1c3edf){var _0x1fac9b=typeof _0x3741ab['offset']===_0xa31f('0x19')&&typeof _0x3741ab[_0xa31f('0x1a')]===_0xa31f('0x19');var _0x4ba82c=_0x1c3edf[_0xa31f('0x1b')];var _0x21f572=_0x1fac9b?0x0:_0x3741ab['offset'];var _0x4c2062=_0x1fac9b?_0x1c3edf[_0xa31f('0x1b')]:_0x3741ab['offset']+_0x3741ab[_0xa31f('0x1a')];var _0x1889ed;if(_0x4c2062>=_0x4ba82c){_0x4c2062=_0x4ba82c;_0x1889ed=0xc8;}else{_0x1889ed=0xce;}_0x19eb5e['status'](_0x1889ed);return _0x19eb5e['set'](_0xa31f('0x1c'),_0x21f572+'-'+_0x4c2062+'/'+_0x4ba82c)[_0xa31f('0x18')](_0x1c3edf);}return null;};}function patchUpdates(_0x2453ef){return function(_0x469a3e){try{jsonpatch[_0xa31f('0x1d')](_0x469a3e,_0x2453ef,!![]);}catch(_0x54211f){return BPromise[_0xa31f('0x1e')](_0x54211f);}return _0x469a3e[_0xa31f('0x1f')]();};}function saveUpdates(_0x461a5a,_0x582a3b){return function(_0x2a3cdb){if(_0x2a3cdb){return _0x2a3cdb[_0xa31f('0x20')](_0x461a5a)[_0xa31f('0x21')](function(_0x1078fd){return _0x1078fd;});}return null;};}function removeEntity(_0x35bd41,_0x138407){return function(_0x20cce6){if(_0x20cce6){return _0x20cce6[_0xa31f('0x22')]()[_0xa31f('0x21')](function(){_0x35bd41['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2bbe9d,_0x243cdb){return function(_0x34e378){if(!_0x34e378){_0x2bbe9d['sendStatus'](0x194);}return _0x34e378;};}function handleError(_0x16278c,_0x3c892e){_0x3c892e=_0x3c892e||0x1f4;return function(_0x3e62dd){logger['error'](_0x3e62dd[_0xa31f('0x23')]);if(_0x3e62dd[_0xa31f('0x24')]){delete _0x3e62dd['name'];}_0x16278c[_0xa31f('0x17')](_0x3c892e)[_0xa31f('0x25')](_0x3e62dd);};}exports['index']=function(_0x402fd6,_0x45329c){var _0x545e59={},_0x34d695={},_0x5ecbe5={'count':0x0,'rows':[]};var _0xa62eae=_[_0xa31f('0x26')](db[_0xa31f('0x27')][_0xa31f('0x28')],function(_0x40ed24){return{'name':_0x40ed24['fieldName'],'type':_0x40ed24[_0xa31f('0x29')][_0xa31f('0x2a')]};});_0x34d695[_0xa31f('0x2b')]=_[_0xa31f('0x26')](_0xa62eae,'name');_0x34d695[_0xa31f('0x2c')]=_[_0xa31f('0x2d')](_0x402fd6[_0xa31f('0x2c')]);_0x34d695[_0xa31f('0x2e')]=_[_0xa31f('0x2f')](_0x34d695[_0xa31f('0x2b')],_0x34d695[_0xa31f('0x2c')]);_0x545e59['attributes']=_[_0xa31f('0x2f')](_0x34d695['model'],qs[_0xa31f('0x30')](_0x402fd6[_0xa31f('0x2c')][_0xa31f('0x30')]));_0x545e59[_0xa31f('0x31')]=_0x545e59['attributes'][_0xa31f('0x32')]?_0x545e59[_0xa31f('0x31')]:_0x34d695[_0xa31f('0x2b')];if(!_0x402fd6['query'][_0xa31f('0x33')]('nolimit')){_0x545e59[_0xa31f('0x1a')]=qs['limit'](_0x402fd6[_0xa31f('0x2c')][_0xa31f('0x1a')]);_0x545e59[_0xa31f('0x34')]=qs[_0xa31f('0x34')](_0x402fd6[_0xa31f('0x2c')][_0xa31f('0x34')]);}_0x545e59[_0xa31f('0x35')]=qs[_0xa31f('0x36')](_0x402fd6[_0xa31f('0x2c')][_0xa31f('0x36')]);_0x545e59[_0xa31f('0x37')]=qs['filters'](_[_0xa31f('0x38')](_0x402fd6[_0xa31f('0x2c')],_0x34d695[_0xa31f('0x2e')]),_0xa62eae);if(_0x402fd6[_0xa31f('0x2c')]['filter']){_0x545e59[_0xa31f('0x37')]=_['merge'](_0x545e59[_0xa31f('0x37')],{'$or':_[_0xa31f('0x26')](_0xa62eae,function(_0x3c8d93){if(_0x3c8d93[_0xa31f('0x29')]!==_0xa31f('0x39')){var _0x106ff7={};_0x106ff7[_0x3c8d93[_0xa31f('0x24')]]={'$like':'%'+_0x402fd6[_0xa31f('0x2c')][_0xa31f('0x3a')]+'%'};return _0x106ff7;}})});}_0x545e59=_[_0xa31f('0x3b')]({},_0x545e59,_0x402fd6['options']);var _0x1e5d81={'where':_0x545e59['where']};return db[_0xa31f('0x27')][_0xa31f('0x1b')](_0x1e5d81)[_0xa31f('0x21')](function(_0x596d5b){_0x5ecbe5[_0xa31f('0x1b')]=_0x596d5b;if(_0x402fd6[_0xa31f('0x2c')][_0xa31f('0x3c')]){_0x545e59[_0xa31f('0x3d')]=[{'all':!![]}];}return db[_0xa31f('0x27')]['findAll'](_0x545e59);})[_0xa31f('0x21')](function(_0x5a48bc){_0x5ecbe5['rows']=_0x5a48bc;return _0x5ecbe5;})[_0xa31f('0x21')](respondWithFilteredResult(_0x45329c,_0x545e59))[_0xa31f('0x3e')](handleError(_0x45329c,null));};exports[_0xa31f('0x3f')]=function(_0x2a2789,_0x1eac9e){var _0x28e467={'raw':!![],'where':{'id':_0x2a2789[_0xa31f('0x40')]['id']}},_0xc6ad1a={};_0xc6ad1a[_0xa31f('0x2b')]=_[_0xa31f('0x2d')](db[_0xa31f('0x27')][_0xa31f('0x28')]);_0xc6ad1a[_0xa31f('0x2c')]=_[_0xa31f('0x2d')](_0x2a2789[_0xa31f('0x2c')]);_0xc6ad1a[_0xa31f('0x2e')]=_['intersection'](_0xc6ad1a[_0xa31f('0x2b')],_0xc6ad1a[_0xa31f('0x2c')]);_0x28e467['attributes']=_[_0xa31f('0x2f')](_0xc6ad1a['model'],qs[_0xa31f('0x30')](_0x2a2789[_0xa31f('0x2c')][_0xa31f('0x30')]));_0x28e467[_0xa31f('0x31')]=_0x28e467['attributes'][_0xa31f('0x32')]?_0x28e467[_0xa31f('0x31')]:_0xc6ad1a[_0xa31f('0x2b')];if(_0x2a2789[_0xa31f('0x2c')][_0xa31f('0x3c')]){_0x28e467['include']=[{'all':!![]}];}_0x28e467=_[_0xa31f('0x3b')]({},_0x28e467,_0x2a2789['options']);return db[_0xa31f('0x27')][_0xa31f('0x41')](_0x28e467)['then'](handleEntityNotFound(_0x1eac9e,null))[_0xa31f('0x21')](respondWithResult(_0x1eac9e,null))['catch'](handleError(_0x1eac9e,null));};exports[_0xa31f('0x42')]=function(_0x34aca5,_0x3664f2){return db['SquareReport']['create'](_0x34aca5[_0xa31f('0x43')],{})[_0xa31f('0x21')](respondWithResult(_0x3664f2,0xc9))[_0xa31f('0x3e')](handleError(_0x3664f2,null));};exports[_0xa31f('0x20')]=function(_0xddd330,_0x4c2fa2){if(_0xddd330[_0xa31f('0x43')]['id']){delete _0xddd330['body']['id'];}return db[_0xa31f('0x27')][_0xa31f('0x41')]({'where':{'id':_0xddd330[_0xa31f('0x40')]['id']}})[_0xa31f('0x21')](handleEntityNotFound(_0x4c2fa2,null))['then'](saveUpdates(_0xddd330['body'],null))[_0xa31f('0x21')](respondWithResult(_0x4c2fa2,null))['catch'](handleError(_0x4c2fa2,null));};exports['destroy']=function(_0x48ee53,_0x3a78d8){return db['SquareReport'][_0xa31f('0x41')]({'where':{'id':_0x48ee53[_0xa31f('0x40')]['id']}})[_0xa31f('0x21')](handleEntityNotFound(_0x3a78d8,null))[_0xa31f('0x21')](removeEntity(_0x3a78d8,null))[_0xa31f('0x3e')](handleError(_0x3a78d8,null));};exports[_0xa31f('0x44')]=function(_0x5ad341,_0x54a222){return db['SquareReport'][_0xa31f('0x44')]()[_0xa31f('0x21')](respondWithResult(_0x54a222,null))[_0xa31f('0x3e')](handleError(_0x54a222,null));}; \ No newline at end of file +var _0xd92b=['api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','undefined','limit','count','offset','Content-Range','save','update','then','name','send','index','map','SquareReport','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','merge','options','findAll','rows','catch','show','params','includeAll','find','create','body','destroy','describe','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger'];(function(_0x815ca5,_0x3bbad3){var _0x42b5ec=function(_0x5a7bc6){while(--_0x5a7bc6){_0x815ca5['push'](_0x815ca5['shift']());}};_0x42b5ec(++_0x3bbad3);}(_0xd92b,0x116));var _0xbd92=function(_0x2a9c27,_0xa9f75){_0x2a9c27=_0x2a9c27-0x0;var _0x22b1c9=_0xd92b[_0x2a9c27];return _0x22b1c9;};'use strict';var emlformat=require(_0xbd92('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xbd92('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xbd92('0x2'));var moment=require(_0xbd92('0x3'));var BPromise=require(_0xbd92('0x4'));var Mustache=require(_0xbd92('0x5'));var util=require(_0xbd92('0x6'));var path=require(_0xbd92('0x7'));var sox=require(_0xbd92('0x8'));var csv=require(_0xbd92('0x9'));var ejs=require(_0xbd92('0xa'));var fs=require('fs');var fs_extra=require(_0xbd92('0xb'));var _=require(_0xbd92('0xc'));var squel=require(_0xbd92('0xd'));var crypto=require(_0xbd92('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xbd92('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xbd92('0x10'));var Redis=require(_0xbd92('0x11'));var authService=require(_0xbd92('0x12'));var qs=require(_0xbd92('0x13'));var as=require(_0xbd92('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xbd92('0x15'))(_0xbd92('0x16'));var utils=require(_0xbd92('0x17'));var config=require(_0xbd92('0x18'));var licenseUtil=require(_0xbd92('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x15d00a,_0x3d431f){_0x3d431f=_0x3d431f||0xcc;return function(_0x275567){if(_0x275567){return _0x15d00a[_0xbd92('0x1a')](_0x3d431f);}return _0x15d00a[_0xbd92('0x1b')](_0x3d431f)[_0xbd92('0x1c')]();};}function respondWithResult(_0x46f1b0,_0x1f758a){_0x1f758a=_0x1f758a||0xc8;return function(_0x2e2ba4){if(_0x2e2ba4){return _0x46f1b0[_0xbd92('0x1b')](_0x1f758a)[_0xbd92('0x1d')](_0x2e2ba4);}};}function respondWithFilteredResult(_0x4e0597,_0x4b1d7e){return function(_0x5af1f7){if(_0x5af1f7){var _0x3b81b5=typeof _0x4b1d7e['offset']===_0xbd92('0x1e')&&typeof _0x4b1d7e[_0xbd92('0x1f')]===_0xbd92('0x1e');var _0x4b6301=_0x5af1f7[_0xbd92('0x20')];var _0x3511ae=_0x3b81b5?0x0:_0x4b1d7e[_0xbd92('0x21')];var _0x5e3854=_0x3b81b5?_0x5af1f7[_0xbd92('0x20')]:_0x4b1d7e[_0xbd92('0x21')]+_0x4b1d7e[_0xbd92('0x1f')];var _0x51d1f4;if(_0x5e3854>=_0x4b6301){_0x5e3854=_0x4b6301;_0x51d1f4=0xc8;}else{_0x51d1f4=0xce;}_0x4e0597[_0xbd92('0x1b')](_0x51d1f4);return _0x4e0597['set'](_0xbd92('0x22'),_0x3511ae+'-'+_0x5e3854+'/'+_0x4b6301)[_0xbd92('0x1d')](_0x5af1f7);}return null;};}function patchUpdates(_0x2689ef){return function(_0x228c7d){try{jsonpatch['apply'](_0x228c7d,_0x2689ef,!![]);}catch(_0x277c83){return BPromise['reject'](_0x277c83);}return _0x228c7d[_0xbd92('0x23')]();};}function saveUpdates(_0x1197aa,_0x36df86){return function(_0x281857){if(_0x281857){return _0x281857[_0xbd92('0x24')](_0x1197aa)[_0xbd92('0x25')](function(_0x4b9fdf){return _0x4b9fdf;});}return null;};}function removeEntity(_0x5ba96c,_0x5cd017){return function(_0x4d4cc5){if(_0x4d4cc5){return _0x4d4cc5['destroy']()[_0xbd92('0x25')](function(){_0x5ba96c['status'](0xcc)[_0xbd92('0x1c')]();});}};}function handleEntityNotFound(_0x5f1a75,_0x2db368){return function(_0x579db6){if(!_0x579db6){_0x5f1a75[_0xbd92('0x1a')](0x194);}return _0x579db6;};}function handleError(_0xccfd2e,_0x16e52c){_0x16e52c=_0x16e52c||0x1f4;return function(_0x3da33a){logger['error'](_0x3da33a['stack']);if(_0x3da33a[_0xbd92('0x26')]){delete _0x3da33a[_0xbd92('0x26')];}_0xccfd2e[_0xbd92('0x1b')](_0x16e52c)[_0xbd92('0x27')](_0x3da33a);};}exports[_0xbd92('0x28')]=function(_0x2b3649,_0x115be6){var _0x3ca977={},_0x1d7b67={},_0x7d5b33={'count':0x0,'rows':[]};var _0x213c26=_[_0xbd92('0x29')](db[_0xbd92('0x2a')][_0xbd92('0x2b')],function(_0x307b28){return{'name':_0x307b28[_0xbd92('0x2c')],'type':_0x307b28[_0xbd92('0x2d')][_0xbd92('0x2e')]};});_0x1d7b67[_0xbd92('0x2f')]=_['map'](_0x213c26,'name');_0x1d7b67[_0xbd92('0x30')]=_[_0xbd92('0x31')](_0x2b3649[_0xbd92('0x30')]);_0x1d7b67['filters']=_[_0xbd92('0x32')](_0x1d7b67[_0xbd92('0x2f')],_0x1d7b67['query']);_0x3ca977[_0xbd92('0x33')]=_['intersection'](_0x1d7b67['model'],qs['fields'](_0x2b3649[_0xbd92('0x30')][_0xbd92('0x34')]));_0x3ca977['attributes']=_0x3ca977[_0xbd92('0x33')][_0xbd92('0x35')]?_0x3ca977[_0xbd92('0x33')]:_0x1d7b67[_0xbd92('0x2f')];if(!_0x2b3649[_0xbd92('0x30')][_0xbd92('0x36')](_0xbd92('0x37'))){_0x3ca977[_0xbd92('0x1f')]=qs[_0xbd92('0x1f')](_0x2b3649[_0xbd92('0x30')][_0xbd92('0x1f')]);_0x3ca977['offset']=qs[_0xbd92('0x21')](_0x2b3649['query'][_0xbd92('0x21')]);}_0x3ca977[_0xbd92('0x38')]=qs['sort'](_0x2b3649[_0xbd92('0x30')][_0xbd92('0x39')]);_0x3ca977[_0xbd92('0x3a')]=qs['filters'](_[_0xbd92('0x3b')](_0x2b3649[_0xbd92('0x30')],_0x1d7b67[_0xbd92('0x3c')]),_0x213c26);if(_0x2b3649[_0xbd92('0x30')][_0xbd92('0x3d')]){_0x3ca977[_0xbd92('0x3a')]=_[_0xbd92('0x3e')](_0x3ca977[_0xbd92('0x3a')],{'$or':_['map'](_0x213c26,function(_0x9acae7){if(_0x9acae7[_0xbd92('0x2d')]!=='VIRTUAL'){var _0x44f455={};_0x44f455[_0x9acae7['name']]={'$like':'%'+_0x2b3649['query']['filter']+'%'};return _0x44f455;}})});}_0x3ca977=_[_0xbd92('0x3e')]({},_0x3ca977,_0x2b3649[_0xbd92('0x3f')]);var _0x544cb5={'where':_0x3ca977['where']};return db['SquareReport']['count'](_0x544cb5)[_0xbd92('0x25')](function(_0x11a898){_0x7d5b33[_0xbd92('0x20')]=_0x11a898;if(_0x2b3649['query']['includeAll']){_0x3ca977['include']=[{'all':!![]}];}return db[_0xbd92('0x2a')][_0xbd92('0x40')](_0x3ca977);})['then'](function(_0x52fe94){_0x7d5b33[_0xbd92('0x41')]=_0x52fe94;return _0x7d5b33;})['then'](respondWithFilteredResult(_0x115be6,_0x3ca977))[_0xbd92('0x42')](handleError(_0x115be6,null));};exports[_0xbd92('0x43')]=function(_0x5a61e9,_0x51ff62){var _0x12aae2={'raw':!![],'where':{'id':_0x5a61e9[_0xbd92('0x44')]['id']}},_0x3975a0={};_0x3975a0[_0xbd92('0x2f')]=_['keys'](db[_0xbd92('0x2a')][_0xbd92('0x2b')]);_0x3975a0[_0xbd92('0x30')]=_[_0xbd92('0x31')](_0x5a61e9[_0xbd92('0x30')]);_0x3975a0[_0xbd92('0x3c')]=_[_0xbd92('0x32')](_0x3975a0[_0xbd92('0x2f')],_0x3975a0['query']);_0x12aae2['attributes']=_['intersection'](_0x3975a0[_0xbd92('0x2f')],qs['fields'](_0x5a61e9['query']['fields']));_0x12aae2[_0xbd92('0x33')]=_0x12aae2['attributes'][_0xbd92('0x35')]?_0x12aae2[_0xbd92('0x33')]:_0x3975a0[_0xbd92('0x2f')];if(_0x5a61e9[_0xbd92('0x30')][_0xbd92('0x45')]){_0x12aae2['include']=[{'all':!![]}];}_0x12aae2=_[_0xbd92('0x3e')]({},_0x12aae2,_0x5a61e9[_0xbd92('0x3f')]);return db[_0xbd92('0x2a')][_0xbd92('0x46')](_0x12aae2)[_0xbd92('0x25')](handleEntityNotFound(_0x51ff62,null))[_0xbd92('0x25')](respondWithResult(_0x51ff62,null))[_0xbd92('0x42')](handleError(_0x51ff62,null));};exports[_0xbd92('0x47')]=function(_0xe02b35,_0x1b48df){return db[_0xbd92('0x2a')][_0xbd92('0x47')](_0xe02b35[_0xbd92('0x48')],{})[_0xbd92('0x25')](respondWithResult(_0x1b48df,0xc9))[_0xbd92('0x42')](handleError(_0x1b48df,null));};exports['update']=function(_0x5bd635,_0x17d598){if(_0x5bd635[_0xbd92('0x48')]['id']){delete _0x5bd635[_0xbd92('0x48')]['id'];}return db[_0xbd92('0x2a')][_0xbd92('0x46')]({'where':{'id':_0x5bd635[_0xbd92('0x44')]['id']}})['then'](handleEntityNotFound(_0x17d598,null))[_0xbd92('0x25')](saveUpdates(_0x5bd635[_0xbd92('0x48')],null))[_0xbd92('0x25')](respondWithResult(_0x17d598,null))['catch'](handleError(_0x17d598,null));};exports[_0xbd92('0x49')]=function(_0x47986a,_0x340719){return db['SquareReport'][_0xbd92('0x46')]({'where':{'id':_0x47986a[_0xbd92('0x44')]['id']}})[_0xbd92('0x25')](handleEntityNotFound(_0x340719,null))[_0xbd92('0x25')](removeEntity(_0x340719,null))[_0xbd92('0x42')](handleError(_0x340719,null));};exports[_0xbd92('0x4a')]=function(_0x593247,_0x555819){return db[_0xbd92('0x2a')][_0xbd92('0x4a')]()[_0xbd92('0x25')](respondWithResult(_0x555819,null))[_0xbd92('0x42')](handleError(_0x555819,null));}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.model.js b/server/api/squareReport/squareReport.model.js index 80b9c26..ef8084b 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 _0x4fd9=['SquareReport','uid_pname','uniqueid','project_name','leaveAt','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./squareReport.attributes','exports','define'];(function(_0x375072,_0x1ad2ed){var _0x3e82e7=function(_0x2a03ec){while(--_0x2a03ec){_0x375072['push'](_0x375072['shift']());}};_0x3e82e7(++_0x1ad2ed);}(_0x4fd9,0xf5));var _0x94fd=function(_0x5a103d,_0x80baa){_0x5a103d=_0x5a103d-0x0;var _0x5c10e4=_0x4fd9[_0x5a103d];return _0x5c10e4;};'use strict';var _=require('lodash');var util=require(_0x94fd('0x0'));var logger=require(_0x94fd('0x1'))('api');var moment=require(_0x94fd('0x2'));var BPromise=require(_0x94fd('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x94fd('0x4'));var rimraf=require(_0x94fd('0x5'));var config=require(_0x94fd('0x6'));var attributes=require(_0x94fd('0x7'));module[_0x94fd('0x8')]=function(_0x304fa6,_0x4625a5){return _0x304fa6[_0x94fd('0x9')](_0x94fd('0xa'),attributes,{'tableName':'report_square','paranoid':![],'indexes':[{'name':_0x94fd('0xb'),'fields':[_0x94fd('0xc'),_0x94fd('0xd')]},{'name':'leaveAt','fields':[_0x94fd('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xfe6c=['project_name','leaveAt','lodash','util','../../config/logger','moment','request-promise','path','rimraf','../../config/environment','./squareReport.attributes','exports','define','report_square'];(function(_0x5121f7,_0x4ddd3a){var _0x2b115b=function(_0xa62744){while(--_0xa62744){_0x5121f7['push'](_0x5121f7['shift']());}};_0x2b115b(++_0x4ddd3a);}(_0xfe6c,0x64));var _0xcfe6=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xfe6c[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xcfe6('0x0'));var util=require(_0xcfe6('0x1'));var logger=require(_0xcfe6('0x2'))('api');var moment=require(_0xcfe6('0x3'));var BPromise=require('bluebird');var rp=require(_0xcfe6('0x4'));var fs=require('fs');var path=require(_0xcfe6('0x5'));var rimraf=require(_0xcfe6('0x6'));var config=require(_0xcfe6('0x7'));var attributes=require(_0xcfe6('0x8'));module[_0xcfe6('0x9')]=function(_0x41e7d2,_0x3408a8){return _0x41e7d2[_0xcfe6('0xa')]('SquareReport',attributes,{'tableName':_0xcfe6('0xb'),'paranoid':![],'indexes':[{'name':'uid_pname','fields':['uniqueid',_0xcfe6('0xc')]},{'name':_0xcfe6('0xd'),'fields':['leaveAt']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.rpc.js b/server/api/squareReport/squareReport.rpc.js index 8e5b4ff..32993ef 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 _0xdd7a=['CreateSquareReport','debug','stringify','update','where','attributes','UpdateSquareReport','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','info','SquareReport,\x20%s,\x20%s','request\x20sent','SquareReport,\x20%s,\x20%s,\x20%s','error','message','result','SquareReport','body','options','raw','then'];(function(_0x1d1eef,_0x5930b8){var _0x360c1a=function(_0x4a4dae){while(--_0x4a4dae){_0x1d1eef['push'](_0x1d1eef['shift']());}};_0x360c1a(++_0x5930b8);}(_0xdd7a,0xa8));var _0xadd7=function(_0x1e89ce,_0x4bc9e5){_0x1e89ce=_0x1e89ce-0x0;var _0x403167=_0xdd7a[_0x1e89ce];return _0x403167;};'use strict';var _=require(_0xadd7('0x0'));var util=require(_0xadd7('0x1'));var moment=require('moment');var BPromise=require(_0xadd7('0x2'));var rs=require(_0xadd7('0x3'));var fs=require('fs');var Redis=require(_0xadd7('0x4'));var db=require(_0xadd7('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xadd7('0x6'))(_0xadd7('0x7'));var config=require('../../config/environment');var jayson=require(_0xadd7('0x8'));var client=jayson[_0xadd7('0x9')][_0xadd7('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x545e6a,_0x129a41,_0x3da64b){return new BPromise(function(_0x45e722,_0x262f67){return client[_0xadd7('0xb')](_0x545e6a,_0x3da64b)['then'](function(_0x4169f9){logger[_0xadd7('0xc')](_0xadd7('0xd'),_0x129a41,_0xadd7('0xe'));logger['debug'](_0xadd7('0xf'),_0x129a41,'request\x20sent',JSON['stringify'](_0x4169f9));if(_0x4169f9[_0xadd7('0x10')]){if(_0x4169f9[_0xadd7('0x10')]['code']===0x1f4){logger[_0xadd7('0x10')](_0xadd7('0xd'),_0x129a41,_0x4169f9[_0xadd7('0x10')]['message']);return _0x262f67(_0x4169f9['error'][_0xadd7('0x11')]);}logger[_0xadd7('0x10')](_0xadd7('0xd'),_0x129a41,_0x4169f9[_0xadd7('0x10')][_0xadd7('0x11')]);return _0x45e722(_0x4169f9[_0xadd7('0x10')]['message']);}else{logger['info'](_0xadd7('0xd'),_0x129a41,_0xadd7('0xe'));_0x45e722(_0x4169f9[_0xadd7('0x12')]['message']);}})['catch'](function(_0x3bb7c8){logger[_0xadd7('0x10')](_0xadd7('0xd'),_0x129a41,_0x3bb7c8);_0x262f67(_0x3bb7c8);});});}exports['CreateSquareReport']=function(_0x3f0c05){var _0x596dd9=this;return new Promise(function(_0x27a69a,_0x5a9e13){return db[_0xadd7('0x13')]['create'](_0x3f0c05[_0xadd7('0x14')],{'raw':_0x3f0c05[_0xadd7('0x15')]?_0x3f0c05[_0xadd7('0x15')][_0xadd7('0x16')]===undefined?!![]:![]:!![]})[_0xadd7('0x17')](function(_0x3f8c86){logger[_0xadd7('0xc')](_0xadd7('0x18'),_0x3f0c05);logger[_0xadd7('0x19')]('CreateSquareReport',_0x3f0c05,JSON[_0xadd7('0x1a')](_0x3f8c86));_0x27a69a(_0x3f8c86);})['catch'](function(_0x2baf07){logger['error'](_0xadd7('0x18'),_0x2baf07[_0xadd7('0x11')],_0x3f0c05);_0x5a9e13(_0x596dd9['error'](0x1f4,_0x2baf07['message']));});});};exports['UpdateSquareReport']=function(_0x389bda){var _0x454bba=this;return new Promise(function(_0x5168e2,_0x27012e){return db[_0xadd7('0x13')][_0xadd7('0x1b')](_0x389bda[_0xadd7('0x14')],{'raw':_0x389bda['options']?_0x389bda[_0xadd7('0x15')][_0xadd7('0x16')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x389bda[_0xadd7('0x15')]?_0x389bda[_0xadd7('0x15')][_0xadd7('0x1c')]||null:null,'attributes':_0x389bda[_0xadd7('0x15')]?_0x389bda[_0xadd7('0x15')][_0xadd7('0x1d')]||null:null,'limit':_0x389bda[_0xadd7('0x15')]?_0x389bda[_0xadd7('0x15')]['limit']||null:null})['then'](function(_0x353180){logger['info'](_0xadd7('0x1e'),_0x389bda);logger['debug'](_0xadd7('0x1e'),_0x389bda,JSON[_0xadd7('0x1a')](_0x353180));_0x5168e2(_0x353180);})[_0xadd7('0x1f')](function(_0x2f76f5){logger[_0xadd7('0x10')]('UpdateSquareReport',_0x2f76f5['message'],_0x389bda);_0x27012e(_0x454bba[_0xadd7('0x10')](0x1f4,_0x2f76f5[_0xadd7('0x11')]));});});}; \ No newline at end of file +var _0x8284=['debug','request\x20sent','stringify','error','code','message','SquareReport,\x20%s,\x20%s','info','catch','CreateSquareReport','body','options','raw','UpdateSquareReport','SquareReport','update','where','attributes','limit','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x587983,_0x169c97){var _0x4b844c=function(_0x4700e2){while(--_0x4700e2){_0x587983['push'](_0x587983['shift']());}};_0x4b844c(++_0x169c97);}(_0x8284,0x97));var _0x4828=function(_0x5a352e,_0x396cb5){_0x5a352e=_0x5a352e-0x0;var _0x175cb8=_0x8284[_0x5a352e];return _0x175cb8;};'use strict';var _=require(_0x4828('0x0'));var util=require(_0x4828('0x1'));var moment=require(_0x4828('0x2'));var BPromise=require(_0x4828('0x3'));var rs=require(_0x4828('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x4828('0x5'));var logger=require(_0x4828('0x6'))(_0x4828('0x7'));var config=require(_0x4828('0x8'));var jayson=require(_0x4828('0x9'));var client=jayson[_0x4828('0xa')][_0x4828('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5a8833,_0x7e17ae,_0x29a108){return new BPromise(function(_0x5e0f01,_0x1e5860){return client[_0x4828('0xc')](_0x5a8833,_0x29a108)[_0x4828('0xd')](function(_0x5ce3a1){logger['info']('SquareReport,\x20%s,\x20%s',_0x7e17ae,'request\x20sent');logger[_0x4828('0xe')]('SquareReport,\x20%s,\x20%s,\x20%s',_0x7e17ae,_0x4828('0xf'),JSON[_0x4828('0x10')](_0x5ce3a1));if(_0x5ce3a1[_0x4828('0x11')]){if(_0x5ce3a1['error'][_0x4828('0x12')]===0x1f4){logger['error']('SquareReport,\x20%s,\x20%s',_0x7e17ae,_0x5ce3a1[_0x4828('0x11')][_0x4828('0x13')]);return _0x1e5860(_0x5ce3a1['error'][_0x4828('0x13')]);}logger['error'](_0x4828('0x14'),_0x7e17ae,_0x5ce3a1[_0x4828('0x11')]['message']);return _0x5e0f01(_0x5ce3a1[_0x4828('0x11')][_0x4828('0x13')]);}else{logger[_0x4828('0x15')](_0x4828('0x14'),_0x7e17ae,_0x4828('0xf'));_0x5e0f01(_0x5ce3a1['result'][_0x4828('0x13')]);}})[_0x4828('0x16')](function(_0x1de2a2){logger[_0x4828('0x11')](_0x4828('0x14'),_0x7e17ae,_0x1de2a2);_0x1e5860(_0x1de2a2);});});}exports[_0x4828('0x17')]=function(_0xc8123){var _0xad509b=this;return new Promise(function(_0x3166fe,_0x2af73d){return db['SquareReport']['create'](_0xc8123[_0x4828('0x18')],{'raw':_0xc8123[_0x4828('0x19')]?_0xc8123['options'][_0x4828('0x1a')]===undefined?!![]:![]:!![]})[_0x4828('0xd')](function(_0x34b2c0){logger[_0x4828('0x15')](_0x4828('0x17'),_0xc8123);logger[_0x4828('0xe')]('CreateSquareReport',_0xc8123,JSON['stringify'](_0x34b2c0));_0x3166fe(_0x34b2c0);})['catch'](function(_0x1d71aa){logger[_0x4828('0x11')]('CreateSquareReport',_0x1d71aa[_0x4828('0x13')],_0xc8123);_0x2af73d(_0xad509b[_0x4828('0x11')](0x1f4,_0x1d71aa[_0x4828('0x13')]));});});};exports[_0x4828('0x1b')]=function(_0x19eb50){var _0x561951=this;return new Promise(function(_0x22848c,_0x11bc99){return db[_0x4828('0x1c')][_0x4828('0x1d')](_0x19eb50[_0x4828('0x18')],{'raw':_0x19eb50[_0x4828('0x19')]?_0x19eb50[_0x4828('0x19')][_0x4828('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x19eb50[_0x4828('0x19')]?_0x19eb50[_0x4828('0x19')][_0x4828('0x1e')]||null:null,'attributes':_0x19eb50['options']?_0x19eb50[_0x4828('0x19')][_0x4828('0x1f')]||null:null,'limit':_0x19eb50[_0x4828('0x19')]?_0x19eb50[_0x4828('0x19')][_0x4828('0x20')]||null:null})[_0x4828('0xd')](function(_0x37dd43){logger[_0x4828('0x15')](_0x4828('0x1b'),_0x19eb50);logger[_0x4828('0xe')](_0x4828('0x1b'),_0x19eb50,JSON['stringify'](_0x37dd43));_0x22848c(_0x37dd43);})[_0x4828('0x16')](function(_0x11a2e7){logger['error'](_0x4828('0x1b'),_0x11a2e7['message'],_0x19eb50);_0x11bc99(_0x561951['error'](0x1f4,_0x11a2e7[_0x4828('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/index.js b/server/api/squareReportDetail/index.js index 9b499f8..321e570 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 _0x45e7=['isAuthenticated','index','/describe','describe','/:id','show','post','update','delete','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareReportDetail.controller','get'];(function(_0x25eb58,_0x43c1f0){var _0x1bdf9b=function(_0x3ee08e){while(--_0x3ee08e){_0x25eb58['push'](_0x25eb58['shift']());}};_0x1bdf9b(++_0x43c1f0);}(_0x45e7,0x73));var _0x745e=function(_0x190e94,_0x117fc1){_0x190e94=_0x190e94-0x0;var _0x3012a0=_0x45e7[_0x190e94];return _0x3012a0;};'use strict';var multer=require(_0x745e('0x0'));var util=require(_0x745e('0x1'));var path=require(_0x745e('0x2'));var timeout=require(_0x745e('0x3'));var express=require('express');var router=express[_0x745e('0x4')]();var fs_extra=require(_0x745e('0x5'));var auth=require(_0x745e('0x6'));var interaction=require(_0x745e('0x7'));var config=require(_0x745e('0x8'));var controller=require(_0x745e('0x9'));router[_0x745e('0xa')]('/',auth[_0x745e('0xb')](),controller[_0x745e('0xc')]);router[_0x745e('0xa')](_0x745e('0xd'),auth[_0x745e('0xb')](),controller[_0x745e('0xe')]);router[_0x745e('0xa')](_0x745e('0xf'),auth[_0x745e('0xb')](),controller[_0x745e('0x10')]);router[_0x745e('0x11')]('/',auth[_0x745e('0xb')](),controller['create']);router['put']('/:id',auth[_0x745e('0xb')](),controller[_0x745e('0x12')]);router[_0x745e('0x13')]('/:id',auth[_0x745e('0xb')](),controller['destroy']);module[_0x745e('0x14')]=router; \ No newline at end of file +var _0x878c=['../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','describe','/:id','show','post','create','put','update','destroy','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0xe6e78c,_0x582369){var _0x2a09c8=function(_0x470ccc){while(--_0x470ccc){_0xe6e78c['push'](_0xe6e78c['shift']());}};_0x2a09c8(++_0x582369);}(_0x878c,0x175));var _0xc878=function(_0x2083e6,_0x5a997a){_0x2083e6=_0x2083e6-0x0;var _0x3b1aae=_0x878c[_0x2083e6];return _0x3b1aae;};'use strict';var multer=require('multer');var util=require(_0xc878('0x0'));var path=require(_0xc878('0x1'));var timeout=require(_0xc878('0x2'));var express=require(_0xc878('0x3'));var router=express[_0xc878('0x4')]();var fs_extra=require(_0xc878('0x5'));var auth=require(_0xc878('0x6'));var interaction=require(_0xc878('0x7'));var config=require(_0xc878('0x8'));var controller=require('./squareReportDetail.controller');router[_0xc878('0x9')]('/',auth[_0xc878('0xa')](),controller['index']);router[_0xc878('0x9')](_0xc878('0xb'),auth[_0xc878('0xa')](),controller[_0xc878('0xc')]);router[_0xc878('0x9')](_0xc878('0xd'),auth[_0xc878('0xa')](),controller[_0xc878('0xe')]);router[_0xc878('0xf')]('/',auth[_0xc878('0xa')](),controller[_0xc878('0x10')]);router[_0xc878('0x11')](_0xc878('0xd'),auth[_0xc878('0xa')](),controller[_0xc878('0x12')]);router['delete']('/:id',auth[_0xc878('0xa')](),controller[_0xc878('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 1086b43..ef68f5a 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 _0x49ee=['TEXT','sequelize','exports','STRING'];(function(_0x26e568,_0x15e4ef){var _0x76accc=function(_0xa8c36f){while(--_0xa8c36f){_0x26e568['push'](_0x26e568['shift']());}};_0x76accc(++_0x15e4ef);}(_0x49ee,0x1e1));var _0xe49e=function(_0x16c3de,_0x13d649){_0x16c3de=_0x16c3de-0x0;var _0x2a2aa4=_0x49ee[_0x16c3de];return _0x2a2aa4;};'use strict';var Sequelize=require(_0xe49e('0x0'));module[_0xe49e('0x1')]={'uniqueid':{'type':Sequelize['STRING']},'node':{'type':Sequelize[_0xe49e('0x2')]},'application':{'type':Sequelize[_0xe49e('0x2')]},'data':{'type':Sequelize[_0xe49e('0x3')]},'project_name':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0xe49e('0x2')]}}; \ No newline at end of file +var _0xfe74=['STRING','TEXT','sequelize','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xfe74,0x196));var _0x4fe7=function(_0x589367,_0x33d2c3){_0x589367=_0x589367-0x0;var _0x38aa01=_0xfe74[_0x589367];return _0x38aa01;};'use strict';var Sequelize=require(_0x4fe7('0x0'));module[_0x4fe7('0x1')]={'uniqueid':{'type':Sequelize[_0x4fe7('0x2')]},'node':{'type':Sequelize[_0x4fe7('0x2')]},'application':{'type':Sequelize[_0x4fe7('0x2')]},'data':{'type':Sequelize[_0x4fe7('0x3')]},'project_name':{'type':Sequelize[_0x4fe7('0x2')]},'callerid':{'type':Sequelize[_0x4fe7('0x2')]}}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.controller.js b/server/api/squareReportDetail/squareReportDetail.controller.js index 729174b..3fb12c0 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 _0xe64f=['status','json','offset','undefined','count','set','Content-Range','apply','reject','update','then','sendStatus','error','name','send','SquareDetailsReport','rawAttributes','fieldName','key','model','map','query','keys','filters','intersection','attributes','fields','length','limit','order','sort','pick','filter','where','type','VIRTUAL','merge','options','include','rows','catch','params','includeAll','find','create','body','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','sox','lodash','crypto','to-csv','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','end'];(function(_0xd4c1cb,_0x4f1c5e){var _0x4efbcb=function(_0x37bd3c){while(--_0x37bd3c){_0xd4c1cb['push'](_0xd4c1cb['shift']());}};_0x4efbcb(++_0x4f1c5e);}(_0xe64f,0x102));var _0xfe64=function(_0x17d289,_0x1f7626){_0x17d289=_0x17d289-0x0;var _0x53dee1=_0xe64f[_0x17d289];return _0x53dee1;};'use strict';var emlformat=require(_0xfe64('0x0'));var rimraf=require(_0xfe64('0x1'));var zipdir=require(_0xfe64('0x2'));var jsonpatch=require(_0xfe64('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xfe64('0x4'));var Mustache=require(_0xfe64('0x5'));var util=require(_0xfe64('0x6'));var path=require('path');var sox=require(_0xfe64('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xfe64('0x8'));var squel=require('squel');var crypto=require(_0xfe64('0x9'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xfe64('0xa'));var querystring=require('querystring');var Papa=require(_0xfe64('0xb'));var Redis=require('ioredis');var authService=require(_0xfe64('0xc'));var qs=require(_0xfe64('0xd'));var as=require(_0xfe64('0xe'));var hardwareService=require(_0xfe64('0xf'));var logger=require(_0xfe64('0x10'))(_0xfe64('0x11'));var utils=require('../../config/utils');var config=require(_0xfe64('0x12'));var licenseUtil=require(_0xfe64('0x13'));var db=require(_0xfe64('0x14'))['db'];function respondWithStatusCode(_0x1f0077,_0x4159b9){_0x4159b9=_0x4159b9||0xcc;return function(_0x43dd47){if(_0x43dd47){return _0x1f0077['sendStatus'](_0x4159b9);}return _0x1f0077['status'](_0x4159b9)[_0xfe64('0x15')]();};}function respondWithResult(_0x31ba47,_0x54f7d4){_0x54f7d4=_0x54f7d4||0xc8;return function(_0x245e09){if(_0x245e09){return _0x31ba47[_0xfe64('0x16')](_0x54f7d4)[_0xfe64('0x17')](_0x245e09);}};}function respondWithFilteredResult(_0x2ef5a2,_0x210f00){return function(_0x5e1fc9){if(_0x5e1fc9){var _0x2fd0b5=typeof _0x210f00[_0xfe64('0x18')]===_0xfe64('0x19')&&typeof _0x210f00['limit']==='undefined';var _0x3ecb3e=_0x5e1fc9[_0xfe64('0x1a')];var _0x541834=_0x2fd0b5?0x0:_0x210f00[_0xfe64('0x18')];var _0x2368f5=_0x2fd0b5?_0x5e1fc9[_0xfe64('0x1a')]:_0x210f00[_0xfe64('0x18')]+_0x210f00['limit'];var _0x3a6321;if(_0x2368f5>=_0x3ecb3e){_0x2368f5=_0x3ecb3e;_0x3a6321=0xc8;}else{_0x3a6321=0xce;}_0x2ef5a2[_0xfe64('0x16')](_0x3a6321);return _0x2ef5a2[_0xfe64('0x1b')](_0xfe64('0x1c'),_0x541834+'-'+_0x2368f5+'/'+_0x3ecb3e)[_0xfe64('0x17')](_0x5e1fc9);}return null;};}function patchUpdates(_0x3d61ed){return function(_0x4d68b8){try{jsonpatch[_0xfe64('0x1d')](_0x4d68b8,_0x3d61ed,!![]);}catch(_0x56cbd9){return BPromise[_0xfe64('0x1e')](_0x56cbd9);}return _0x4d68b8['save']();};}function saveUpdates(_0x2b45e7,_0x22a863){return function(_0xb49722){if(_0xb49722){return _0xb49722[_0xfe64('0x1f')](_0x2b45e7)[_0xfe64('0x20')](function(_0x382cb7){return _0x382cb7;});}return null;};}function removeEntity(_0x29a10c,_0x28c369){return function(_0x43e480){if(_0x43e480){return _0x43e480['destroy']()[_0xfe64('0x20')](function(){_0x29a10c[_0xfe64('0x16')](0xcc)[_0xfe64('0x15')]();});}};}function handleEntityNotFound(_0x53da18,_0x145be4){return function(_0x59fce4){if(!_0x59fce4){_0x53da18[_0xfe64('0x21')](0x194);}return _0x59fce4;};}function handleError(_0x21ad89,_0xfb2566){_0xfb2566=_0xfb2566||0x1f4;return function(_0x43c7e2){logger[_0xfe64('0x22')](_0x43c7e2['stack']);if(_0x43c7e2[_0xfe64('0x23')]){delete _0x43c7e2['name'];}_0x21ad89['status'](_0xfb2566)[_0xfe64('0x24')](_0x43c7e2);};}exports['index']=function(_0x6a5107,_0x6eddb3){var _0x2e8164={},_0x2d3d32={},_0x406064={'count':0x0,'rows':[]};var _0x47fb59=_['map'](db[_0xfe64('0x25')][_0xfe64('0x26')],function(_0x6680cf){return{'name':_0x6680cf[_0xfe64('0x27')],'type':_0x6680cf['type'][_0xfe64('0x28')]};});_0x2d3d32[_0xfe64('0x29')]=_[_0xfe64('0x2a')](_0x47fb59,_0xfe64('0x23'));_0x2d3d32[_0xfe64('0x2b')]=_[_0xfe64('0x2c')](_0x6a5107[_0xfe64('0x2b')]);_0x2d3d32[_0xfe64('0x2d')]=_[_0xfe64('0x2e')](_0x2d3d32[_0xfe64('0x29')],_0x2d3d32[_0xfe64('0x2b')]);_0x2e8164[_0xfe64('0x2f')]=_[_0xfe64('0x2e')](_0x2d3d32['model'],qs[_0xfe64('0x30')](_0x6a5107[_0xfe64('0x2b')][_0xfe64('0x30')]));_0x2e8164[_0xfe64('0x2f')]=_0x2e8164['attributes'][_0xfe64('0x31')]?_0x2e8164['attributes']:_0x2d3d32[_0xfe64('0x29')];if(!_0x6a5107[_0xfe64('0x2b')]['hasOwnProperty']('nolimit')){_0x2e8164[_0xfe64('0x32')]=qs[_0xfe64('0x32')](_0x6a5107['query']['limit']);_0x2e8164[_0xfe64('0x18')]=qs[_0xfe64('0x18')](_0x6a5107[_0xfe64('0x2b')]['offset']);}_0x2e8164[_0xfe64('0x33')]=qs[_0xfe64('0x34')](_0x6a5107[_0xfe64('0x2b')]['sort']);_0x2e8164['where']=qs[_0xfe64('0x2d')](_[_0xfe64('0x35')](_0x6a5107[_0xfe64('0x2b')],_0x2d3d32['filters']),_0x47fb59);if(_0x6a5107['query'][_0xfe64('0x36')]){_0x2e8164[_0xfe64('0x37')]=_['merge'](_0x2e8164[_0xfe64('0x37')],{'$or':_[_0xfe64('0x2a')](_0x47fb59,function(_0x85e122){if(_0x85e122[_0xfe64('0x38')]!==_0xfe64('0x39')){var _0xe9890e={};_0xe9890e[_0x85e122['name']]={'$like':'%'+_0x6a5107[_0xfe64('0x2b')][_0xfe64('0x36')]+'%'};return _0xe9890e;}})});}_0x2e8164=_[_0xfe64('0x3a')]({},_0x2e8164,_0x6a5107[_0xfe64('0x3b')]);var _0x34dafa={'where':_0x2e8164[_0xfe64('0x37')]};return db['SquareDetailsReport'][_0xfe64('0x1a')](_0x34dafa)[_0xfe64('0x20')](function(_0x4f2d5c){_0x406064[_0xfe64('0x1a')]=_0x4f2d5c;if(_0x6a5107['query']['includeAll']){_0x2e8164[_0xfe64('0x3c')]=[{'all':!![]}];}return db['SquareDetailsReport']['findAll'](_0x2e8164);})[_0xfe64('0x20')](function(_0x15cf64){_0x406064[_0xfe64('0x3d')]=_0x15cf64;return _0x406064;})[_0xfe64('0x20')](respondWithFilteredResult(_0x6eddb3,_0x2e8164))[_0xfe64('0x3e')](handleError(_0x6eddb3,null));};exports['show']=function(_0x3f5d1a,_0x2c2a06){var _0x17f374={'raw':!![],'where':{'id':_0x3f5d1a[_0xfe64('0x3f')]['id']}},_0x2c16f2={};_0x2c16f2[_0xfe64('0x29')]=_[_0xfe64('0x2c')](db[_0xfe64('0x25')][_0xfe64('0x26')]);_0x2c16f2[_0xfe64('0x2b')]=_[_0xfe64('0x2c')](_0x3f5d1a[_0xfe64('0x2b')]);_0x2c16f2[_0xfe64('0x2d')]=_[_0xfe64('0x2e')](_0x2c16f2[_0xfe64('0x29')],_0x2c16f2[_0xfe64('0x2b')]);_0x17f374[_0xfe64('0x2f')]=_[_0xfe64('0x2e')](_0x2c16f2['model'],qs['fields'](_0x3f5d1a['query'][_0xfe64('0x30')]));_0x17f374[_0xfe64('0x2f')]=_0x17f374[_0xfe64('0x2f')][_0xfe64('0x31')]?_0x17f374[_0xfe64('0x2f')]:_0x2c16f2[_0xfe64('0x29')];if(_0x3f5d1a[_0xfe64('0x2b')][_0xfe64('0x40')]){_0x17f374[_0xfe64('0x3c')]=[{'all':!![]}];}_0x17f374=_[_0xfe64('0x3a')]({},_0x17f374,_0x3f5d1a[_0xfe64('0x3b')]);return db[_0xfe64('0x25')][_0xfe64('0x41')](_0x17f374)[_0xfe64('0x20')](handleEntityNotFound(_0x2c2a06,null))[_0xfe64('0x20')](respondWithResult(_0x2c2a06,null))[_0xfe64('0x3e')](handleError(_0x2c2a06,null));};exports[_0xfe64('0x42')]=function(_0x13f9c2,_0xaf1c92){return db[_0xfe64('0x25')][_0xfe64('0x42')](_0x13f9c2[_0xfe64('0x43')],{})[_0xfe64('0x20')](respondWithResult(_0xaf1c92,0xc9))[_0xfe64('0x3e')](handleError(_0xaf1c92,null));};exports[_0xfe64('0x1f')]=function(_0x1de786,_0x22c99d){if(_0x1de786['body']['id']){delete _0x1de786[_0xfe64('0x43')]['id'];}return db['SquareDetailsReport'][_0xfe64('0x41')]({'where':{'id':_0x1de786[_0xfe64('0x3f')]['id']}})[_0xfe64('0x20')](handleEntityNotFound(_0x22c99d,null))[_0xfe64('0x20')](saveUpdates(_0x1de786[_0xfe64('0x43')],null))[_0xfe64('0x20')](respondWithResult(_0x22c99d,null))['catch'](handleError(_0x22c99d,null));};exports[_0xfe64('0x44')]=function(_0x2ad1b7,_0x13af65){return db['SquareDetailsReport'][_0xfe64('0x41')]({'where':{'id':_0x2ad1b7[_0xfe64('0x3f')]['id']}})[_0xfe64('0x20')](handleEntityNotFound(_0x13af65,null))[_0xfe64('0x20')](removeEntity(_0x13af65,null))[_0xfe64('0x3e')](handleError(_0x13af65,null));};exports[_0xfe64('0x45')]=function(_0x1705ea,_0x5658a0){return db[_0xfe64('0x25')][_0xfe64('0x45')]()['then'](respondWithResult(_0x5658a0,null))[_0xfe64('0x3e')](handleError(_0x5658a0,null));}; \ No newline at end of file +var _0x9b8c=['attributes','fields','length','nolimit','order','sort','pick','filter','VIRTUAL','merge','where','includeAll','include','findAll','rows','show','params','model','keys','options','find','create','body','catch','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','desk.js','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','limit','count','set','Content-Range','reject','save','update','destroy','then','error','name','send','map','SquareDetailsReport','rawAttributes','fieldName','type','key','query','filters','intersection'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x9b8c,0x1ed));var _0xc9b8=function(_0x2576d7,_0x167624){_0x2576d7=_0x2576d7-0x0;var _0x16a08c=_0x9b8c[_0x2576d7];return _0x16a08c;};'use strict';var emlformat=require(_0xc9b8('0x0'));var rimraf=require(_0xc9b8('0x1'));var zipdir=require(_0xc9b8('0x2'));var jsonpatch=require(_0xc9b8('0x3'));var rp=require(_0xc9b8('0x4'));var moment=require(_0xc9b8('0x5'));var BPromise=require(_0xc9b8('0x6'));var Mustache=require(_0xc9b8('0x7'));var util=require(_0xc9b8('0x8'));var path=require('path');var sox=require(_0xc9b8('0x9'));var csv=require(_0xc9b8('0xa'));var ejs=require(_0xc9b8('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc9b8('0xc'));var squel=require(_0xc9b8('0xd'));var crypto=require(_0xc9b8('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xc9b8('0xf'));var toCsv=require(_0xc9b8('0xa'));var querystring=require(_0xc9b8('0x10'));var Papa=require('papaparse');var Redis=require(_0xc9b8('0x11'));var authService=require(_0xc9b8('0x12'));var qs=require(_0xc9b8('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc9b8('0x14'));var logger=require('../../config/logger')(_0xc9b8('0x15'));var utils=require(_0xc9b8('0x16'));var config=require(_0xc9b8('0x17'));var licenseUtil=require(_0xc9b8('0x18'));var db=require(_0xc9b8('0x19'))['db'];function respondWithStatusCode(_0x101545,_0x3114bd){_0x3114bd=_0x3114bd||0xcc;return function(_0x202e17){if(_0x202e17){return _0x101545[_0xc9b8('0x1a')](_0x3114bd);}return _0x101545[_0xc9b8('0x1b')](_0x3114bd)[_0xc9b8('0x1c')]();};}function respondWithResult(_0x4a66e9,_0x3d739b){_0x3d739b=_0x3d739b||0xc8;return function(_0x316aaf){if(_0x316aaf){return _0x4a66e9[_0xc9b8('0x1b')](_0x3d739b)[_0xc9b8('0x1d')](_0x316aaf);}};}function respondWithFilteredResult(_0xf0fd6a,_0x26ff1e){return function(_0x225388){if(_0x225388){var _0x152859=typeof _0x26ff1e[_0xc9b8('0x1e')]===_0xc9b8('0x1f')&&typeof _0x26ff1e[_0xc9b8('0x20')]===_0xc9b8('0x1f');var _0x58c985=_0x225388['count'];var _0x520718=_0x152859?0x0:_0x26ff1e[_0xc9b8('0x1e')];var _0xe66ec6=_0x152859?_0x225388[_0xc9b8('0x21')]:_0x26ff1e['offset']+_0x26ff1e[_0xc9b8('0x20')];var _0xba243c;if(_0xe66ec6>=_0x58c985){_0xe66ec6=_0x58c985;_0xba243c=0xc8;}else{_0xba243c=0xce;}_0xf0fd6a['status'](_0xba243c);return _0xf0fd6a[_0xc9b8('0x22')](_0xc9b8('0x23'),_0x520718+'-'+_0xe66ec6+'/'+_0x58c985)[_0xc9b8('0x1d')](_0x225388);}return null;};}function patchUpdates(_0x6f99c1){return function(_0x3cb761){try{jsonpatch['apply'](_0x3cb761,_0x6f99c1,!![]);}catch(_0xc49678){return BPromise[_0xc9b8('0x24')](_0xc49678);}return _0x3cb761[_0xc9b8('0x25')]();};}function saveUpdates(_0x345e6b,_0x3b6391){return function(_0xa2599a){if(_0xa2599a){return _0xa2599a[_0xc9b8('0x26')](_0x345e6b)['then'](function(_0x5f33b9){return _0x5f33b9;});}return null;};}function removeEntity(_0x1f92f7,_0x253a57){return function(_0x26e9df){if(_0x26e9df){return _0x26e9df[_0xc9b8('0x27')]()[_0xc9b8('0x28')](function(){_0x1f92f7[_0xc9b8('0x1b')](0xcc)[_0xc9b8('0x1c')]();});}};}function handleEntityNotFound(_0x2f907b,_0xbfe1d4){return function(_0x3cb550){if(!_0x3cb550){_0x2f907b['sendStatus'](0x194);}return _0x3cb550;};}function handleError(_0x953585,_0x268177){_0x268177=_0x268177||0x1f4;return function(_0xb7904d){logger[_0xc9b8('0x29')](_0xb7904d['stack']);if(_0xb7904d[_0xc9b8('0x2a')]){delete _0xb7904d[_0xc9b8('0x2a')];}_0x953585[_0xc9b8('0x1b')](_0x268177)[_0xc9b8('0x2b')](_0xb7904d);};}exports['index']=function(_0x254086,_0x446b86){var _0x15b6c6={},_0x18ad7e={},_0x58dbbb={'count':0x0,'rows':[]};var _0x33eac0=_[_0xc9b8('0x2c')](db[_0xc9b8('0x2d')][_0xc9b8('0x2e')],function(_0x528950){return{'name':_0x528950[_0xc9b8('0x2f')],'type':_0x528950[_0xc9b8('0x30')][_0xc9b8('0x31')]};});_0x18ad7e['model']=_['map'](_0x33eac0,'name');_0x18ad7e[_0xc9b8('0x32')]=_['keys'](_0x254086[_0xc9b8('0x32')]);_0x18ad7e[_0xc9b8('0x33')]=_[_0xc9b8('0x34')](_0x18ad7e['model'],_0x18ad7e['query']);_0x15b6c6[_0xc9b8('0x35')]=_[_0xc9b8('0x34')](_0x18ad7e['model'],qs[_0xc9b8('0x36')](_0x254086[_0xc9b8('0x32')][_0xc9b8('0x36')]));_0x15b6c6['attributes']=_0x15b6c6['attributes'][_0xc9b8('0x37')]?_0x15b6c6['attributes']:_0x18ad7e['model'];if(!_0x254086[_0xc9b8('0x32')]['hasOwnProperty'](_0xc9b8('0x38'))){_0x15b6c6[_0xc9b8('0x20')]=qs['limit'](_0x254086[_0xc9b8('0x32')][_0xc9b8('0x20')]);_0x15b6c6[_0xc9b8('0x1e')]=qs['offset'](_0x254086[_0xc9b8('0x32')][_0xc9b8('0x1e')]);}_0x15b6c6[_0xc9b8('0x39')]=qs['sort'](_0x254086[_0xc9b8('0x32')][_0xc9b8('0x3a')]);_0x15b6c6['where']=qs[_0xc9b8('0x33')](_[_0xc9b8('0x3b')](_0x254086[_0xc9b8('0x32')],_0x18ad7e[_0xc9b8('0x33')]),_0x33eac0);if(_0x254086[_0xc9b8('0x32')][_0xc9b8('0x3c')]){_0x15b6c6['where']=_['merge'](_0x15b6c6['where'],{'$or':_[_0xc9b8('0x2c')](_0x33eac0,function(_0x430199){if(_0x430199['type']!==_0xc9b8('0x3d')){var _0x5157ca={};_0x5157ca[_0x430199['name']]={'$like':'%'+_0x254086[_0xc9b8('0x32')][_0xc9b8('0x3c')]+'%'};return _0x5157ca;}})});}_0x15b6c6=_[_0xc9b8('0x3e')]({},_0x15b6c6,_0x254086['options']);var _0x25d00f={'where':_0x15b6c6[_0xc9b8('0x3f')]};return db[_0xc9b8('0x2d')][_0xc9b8('0x21')](_0x25d00f)[_0xc9b8('0x28')](function(_0x25deaa){_0x58dbbb[_0xc9b8('0x21')]=_0x25deaa;if(_0x254086['query'][_0xc9b8('0x40')]){_0x15b6c6[_0xc9b8('0x41')]=[{'all':!![]}];}return db[_0xc9b8('0x2d')][_0xc9b8('0x42')](_0x15b6c6);})[_0xc9b8('0x28')](function(_0x1238d4){_0x58dbbb[_0xc9b8('0x43')]=_0x1238d4;return _0x58dbbb;})[_0xc9b8('0x28')](respondWithFilteredResult(_0x446b86,_0x15b6c6))['catch'](handleError(_0x446b86,null));};exports[_0xc9b8('0x44')]=function(_0x3fbdc1,_0x17bff5){var _0x2c8956={'raw':!![],'where':{'id':_0x3fbdc1[_0xc9b8('0x45')]['id']}},_0x287dd3={};_0x287dd3[_0xc9b8('0x46')]=_[_0xc9b8('0x47')](db[_0xc9b8('0x2d')][_0xc9b8('0x2e')]);_0x287dd3[_0xc9b8('0x32')]=_[_0xc9b8('0x47')](_0x3fbdc1[_0xc9b8('0x32')]);_0x287dd3[_0xc9b8('0x33')]=_[_0xc9b8('0x34')](_0x287dd3['model'],_0x287dd3[_0xc9b8('0x32')]);_0x2c8956['attributes']=_[_0xc9b8('0x34')](_0x287dd3['model'],qs['fields'](_0x3fbdc1[_0xc9b8('0x32')][_0xc9b8('0x36')]));_0x2c8956[_0xc9b8('0x35')]=_0x2c8956[_0xc9b8('0x35')][_0xc9b8('0x37')]?_0x2c8956[_0xc9b8('0x35')]:_0x287dd3[_0xc9b8('0x46')];if(_0x3fbdc1[_0xc9b8('0x32')][_0xc9b8('0x40')]){_0x2c8956[_0xc9b8('0x41')]=[{'all':!![]}];}_0x2c8956=_[_0xc9b8('0x3e')]({},_0x2c8956,_0x3fbdc1[_0xc9b8('0x48')]);return db['SquareDetailsReport'][_0xc9b8('0x49')](_0x2c8956)['then'](handleEntityNotFound(_0x17bff5,null))[_0xc9b8('0x28')](respondWithResult(_0x17bff5,null))['catch'](handleError(_0x17bff5,null));};exports[_0xc9b8('0x4a')]=function(_0x4d6df2,_0x116047){return db[_0xc9b8('0x2d')]['create'](_0x4d6df2[_0xc9b8('0x4b')],{})[_0xc9b8('0x28')](respondWithResult(_0x116047,0xc9))[_0xc9b8('0x4c')](handleError(_0x116047,null));};exports[_0xc9b8('0x26')]=function(_0x2ddb87,_0x4fea7e){if(_0x2ddb87[_0xc9b8('0x4b')]['id']){delete _0x2ddb87[_0xc9b8('0x4b')]['id'];}return db[_0xc9b8('0x2d')][_0xc9b8('0x49')]({'where':{'id':_0x2ddb87[_0xc9b8('0x45')]['id']}})[_0xc9b8('0x28')](handleEntityNotFound(_0x4fea7e,null))[_0xc9b8('0x28')](saveUpdates(_0x2ddb87[_0xc9b8('0x4b')],null))[_0xc9b8('0x28')](respondWithResult(_0x4fea7e,null))['catch'](handleError(_0x4fea7e,null));};exports[_0xc9b8('0x27')]=function(_0x344411,_0x2f15f5){return db[_0xc9b8('0x2d')]['find']({'where':{'id':_0x344411[_0xc9b8('0x45')]['id']}})[_0xc9b8('0x28')](handleEntityNotFound(_0x2f15f5,null))[_0xc9b8('0x28')](removeEntity(_0x2f15f5,null))[_0xc9b8('0x4c')](handleError(_0x2f15f5,null));};exports[_0xc9b8('0x4d')]=function(_0x8ac25,_0x16aaa7){return db['SquareDetailsReport']['describe']()['then'](respondWithResult(_0x16aaa7,null))[_0xc9b8('0x4c')](handleError(_0x16aaa7,null));}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.model.js b/server/api/squareReportDetail/squareReportDetail.model.js index d582c21..5333cad 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 _0x2fbb=['util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','define','report_square_details','lodash'];(function(_0x1da527,_0x2dc953){var _0x40fc7c=function(_0x9949f5){while(--_0x9949f5){_0x1da527['push'](_0x1da527['shift']());}};_0x40fc7c(++_0x2dc953);}(_0x2fbb,0xd1));var _0xb2fb=function(_0x425dde,_0x793e27){_0x425dde=_0x425dde-0x0;var _0x3c0491=_0x2fbb[_0x425dde];return _0x3c0491;};'use strict';var _=require(_0xb2fb('0x0'));var util=require(_0xb2fb('0x1'));var logger=require(_0xb2fb('0x2'))('api');var moment=require(_0xb2fb('0x3'));var BPromise=require(_0xb2fb('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb2fb('0x5'));var rimraf=require(_0xb2fb('0x6'));var config=require(_0xb2fb('0x7'));var attributes=require('./squareReportDetail.attributes');module['exports']=function(_0x284f14,_0x270136){return _0x284f14[_0xb2fb('0x8')]('SquareDetailsReport',attributes,{'tableName':_0xb2fb('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7be8=['SquareDetailsReport','report_square_details','lodash','util','api','bluebird','path','rimraf','../../config/environment','./squareReportDetail.attributes','exports','define'];(function(_0x4d55ed,_0x18ebc8){var _0x2cb865=function(_0x40ba34){while(--_0x40ba34){_0x4d55ed['push'](_0x4d55ed['shift']());}};_0x2cb865(++_0x18ebc8);}(_0x7be8,0x7a));var _0x87be=function(_0x5c489b,_0x22f0a6){_0x5c489b=_0x5c489b-0x0;var _0x39ffa7=_0x7be8[_0x5c489b];return _0x39ffa7;};'use strict';var _=require(_0x87be('0x0'));var util=require(_0x87be('0x1'));var logger=require('../../config/logger')(_0x87be('0x2'));var moment=require('moment');var BPromise=require(_0x87be('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x87be('0x4'));var rimraf=require(_0x87be('0x5'));var config=require(_0x87be('0x6'));var attributes=require(_0x87be('0x7'));module[_0x87be('0x8')]=function(_0x3babb1,_0x4f59be){return _0x3babb1[_0x87be('0x9')](_0x87be('0xa'),attributes,{'tableName':_0x87be('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 0c22171..d84f2a0 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 _0xc900=['../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SquareDetailsReport,\x20%s,\x20%s','request\x20sent','debug','SquareDetailsReport,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','CreateSquareDetailsReport','SquareDetailsReport','create','options','raw','moment','bluebird','randomstring'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc900,0xb3));var _0x0c90=function(_0x215dea,_0x5c742f){_0x215dea=_0x215dea-0x0;var _0x2dac3f=_0xc900[_0x215dea];return _0x2dac3f;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x0c90('0x0'));var BPromise=require(_0x0c90('0x1'));var rs=require(_0x0c90('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0c90('0x3'))['db'];var utils=require(_0x0c90('0x4'));var logger=require('../../config/logger')(_0x0c90('0x5'));var config=require(_0x0c90('0x6'));var jayson=require(_0x0c90('0x7'));var client=jayson[_0x0c90('0x8')][_0x0c90('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x302ab1,_0x5b1a5c,_0x24e5be){return new BPromise(function(_0x1c1996,_0x23daed){return client[_0x0c90('0xa')](_0x302ab1,_0x24e5be)[_0x0c90('0xb')](function(_0x3d0f49){logger[_0x0c90('0xc')](_0x0c90('0xd'),_0x5b1a5c,_0x0c90('0xe'));logger[_0x0c90('0xf')](_0x0c90('0x10'),_0x5b1a5c,_0x0c90('0xe'),JSON[_0x0c90('0x11')](_0x3d0f49));if(_0x3d0f49['error']){if(_0x3d0f49[_0x0c90('0x12')]['code']===0x1f4){logger[_0x0c90('0x12')]('SquareDetailsReport,\x20%s,\x20%s',_0x5b1a5c,_0x3d0f49[_0x0c90('0x12')][_0x0c90('0x13')]);return _0x23daed(_0x3d0f49[_0x0c90('0x12')][_0x0c90('0x13')]);}logger[_0x0c90('0x12')]('SquareDetailsReport,\x20%s,\x20%s',_0x5b1a5c,_0x3d0f49[_0x0c90('0x12')][_0x0c90('0x13')]);return _0x1c1996(_0x3d0f49['error'][_0x0c90('0x13')]);}else{logger[_0x0c90('0xc')](_0x0c90('0xd'),_0x5b1a5c,'request\x20sent');_0x1c1996(_0x3d0f49['result'][_0x0c90('0x13')]);}})[_0x0c90('0x14')](function(_0x2b8135){logger[_0x0c90('0x12')](_0x0c90('0xd'),_0x5b1a5c,_0x2b8135);_0x23daed(_0x2b8135);});});}exports[_0x0c90('0x15')]=function(_0x42321a){var _0x57b9a6=this;return new Promise(function(_0xc3bb47,_0x38becc){return db[_0x0c90('0x16')][_0x0c90('0x17')](_0x42321a['body'],{'raw':_0x42321a[_0x0c90('0x18')]?_0x42321a[_0x0c90('0x18')][_0x0c90('0x19')]===undefined?!![]:![]:!![]})[_0x0c90('0xb')](function(_0x315932){logger[_0x0c90('0xc')]('CreateSquareDetailsReport',_0x42321a);logger[_0x0c90('0xf')]('CreateSquareDetailsReport',_0x42321a,JSON[_0x0c90('0x11')](_0x315932));_0xc3bb47(_0x315932);})[_0x0c90('0x14')](function(_0x47b13c){logger[_0x0c90('0x12')](_0x0c90('0x15'),_0x47b13c[_0x0c90('0x13')],_0x42321a);_0x38becc(_0x57b9a6[_0x0c90('0x12')](0x1f4,_0x47b13c[_0x0c90('0x13')]));});});}; \ No newline at end of file +var _0x25e7=['SquareDetailsReport','create','body','options','raw','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','request','then','info','SquareDetailsReport,\x20%s,\x20%s','request\x20sent','debug','SquareDetailsReport,\x20%s,\x20%s,\x20%s','error','message','result','catch','CreateSquareDetailsReport'];(function(_0x1bc013,_0x7771c6){var _0x55df36=function(_0x1c02e0){while(--_0x1c02e0){_0x1bc013['push'](_0x1bc013['shift']());}};_0x55df36(++_0x7771c6);}(_0x25e7,0x1d6));var _0x725e=function(_0x5a07a2,_0x32f99c){_0x5a07a2=_0x5a07a2-0x0;var _0x2238fe=_0x25e7[_0x5a07a2];return _0x2238fe;};'use strict';var _=require(_0x725e('0x0'));var util=require(_0x725e('0x1'));var moment=require(_0x725e('0x2'));var BPromise=require(_0x725e('0x3'));var rs=require(_0x725e('0x4'));var fs=require('fs');var Redis=require(_0x725e('0x5'));var db=require(_0x725e('0x6'))['db'];var utils=require(_0x725e('0x7'));var logger=require(_0x725e('0x8'))(_0x725e('0x9'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x725e('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x481316,_0x111a50,_0x192c27){return new BPromise(function(_0x216b33,_0x67de0c){return client[_0x725e('0xb')](_0x481316,_0x192c27)[_0x725e('0xc')](function(_0x39858a){logger[_0x725e('0xd')](_0x725e('0xe'),_0x111a50,_0x725e('0xf'));logger[_0x725e('0x10')](_0x725e('0x11'),_0x111a50,'request\x20sent',JSON['stringify'](_0x39858a));if(_0x39858a[_0x725e('0x12')]){if(_0x39858a[_0x725e('0x12')]['code']===0x1f4){logger['error'](_0x725e('0xe'),_0x111a50,_0x39858a[_0x725e('0x12')]['message']);return _0x67de0c(_0x39858a[_0x725e('0x12')][_0x725e('0x13')]);}logger[_0x725e('0x12')]('SquareDetailsReport,\x20%s,\x20%s',_0x111a50,_0x39858a[_0x725e('0x12')][_0x725e('0x13')]);return _0x216b33(_0x39858a[_0x725e('0x12')][_0x725e('0x13')]);}else{logger[_0x725e('0xd')](_0x725e('0xe'),_0x111a50,'request\x20sent');_0x216b33(_0x39858a[_0x725e('0x14')][_0x725e('0x13')]);}})[_0x725e('0x15')](function(_0x54ac0f){logger[_0x725e('0x12')](_0x725e('0xe'),_0x111a50,_0x54ac0f);_0x67de0c(_0x54ac0f);});});}exports[_0x725e('0x16')]=function(_0x397e33){var _0x268438=this;return new Promise(function(_0x2811e7,_0x528e7d){return db[_0x725e('0x17')][_0x725e('0x18')](_0x397e33[_0x725e('0x19')],{'raw':_0x397e33[_0x725e('0x1a')]?_0x397e33[_0x725e('0x1a')][_0x725e('0x1b')]===undefined?!![]:![]:!![]})['then'](function(_0x2fc416){logger[_0x725e('0xd')](_0x725e('0x16'),_0x397e33);logger[_0x725e('0x10')](_0x725e('0x16'),_0x397e33,JSON[_0x725e('0x1c')](_0x2fc416));_0x2811e7(_0x2fc416);})[_0x725e('0x15')](function(_0x262b01){logger[_0x725e('0x12')]('CreateSquareDetailsReport',_0x262b01[_0x725e('0x13')],_0x397e33);_0x528e7d(_0x268438[_0x725e('0x12')](0x1f4,_0x262b01[_0x725e('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/system/index.js b/server/api/system/index.js index 3fb2187..dad478f 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 _0xa485=['isAuthenticated','killProcess','exports','express','Router','../../components/auth/service','index','/process/:pid/kill'];(function(_0x3aa17e,_0x12d321){var _0x4d3ff7=function(_0x3173e5){while(--_0x3173e5){_0x3aa17e['push'](_0x3aa17e['shift']());}};_0x4d3ff7(++_0x12d321);}(_0xa485,0xb3));var _0x5a48=function(_0x2e7125,_0x1896c0){_0x2e7125=_0x2e7125-0x0;var _0x140571=_0xa485[_0x2e7125];return _0x140571;};'use strict';var express=require(_0x5a48('0x0'));var router=express[_0x5a48('0x1')]();var auth=require(_0x5a48('0x2'));var controller=require('./system.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x5a48('0x3')]);router['get'](_0x5a48('0x4'),auth[_0x5a48('0x5')](),controller[_0x5a48('0x6')]);module[_0x5a48('0x7')]=router; \ No newline at end of file +var _0x8f31=['/process/:pid/kill','killProcess','exports','express','Router','../../components/auth/service','./system.controller','get','isAuthenticated','index'];(function(_0x1b349a,_0x22222c){var _0x5d1f7c=function(_0x368d7c){while(--_0x368d7c){_0x1b349a['push'](_0x1b349a['shift']());}};_0x5d1f7c(++_0x22222c);}(_0x8f31,0xa3));var _0x18f3=function(_0x4bc65f,_0x39ec43){_0x4bc65f=_0x4bc65f-0x0;var _0x44f85f=_0x8f31[_0x4bc65f];return _0x44f85f;};'use strict';var express=require(_0x18f3('0x0'));var router=express[_0x18f3('0x1')]();var auth=require(_0x18f3('0x2'));var controller=require(_0x18f3('0x3'));router[_0x18f3('0x4')]('/',auth[_0x18f3('0x5')](),controller[_0x18f3('0x6')]);router[_0x18f3('0x4')](_0x18f3('0x7'),auth[_0x18f3('0x5')](),controller[_0x18f3('0x8')]);module[_0x18f3('0x9')]=router; \ No newline at end of file diff --git a/server/api/system/system.controller.js b/server/api/system/system.controller.js index 19a6841..494fb74 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 _0x1733=['util','bluebird','lodash','error','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','inspect','name','status','send','index','then','catch','json','killProcess','components/import/cm','params','pid','split','length','indexOf','format','Process\x20with\x20pid\x20%s\x20not\x20found!','kill','Process\x20with\x20pid\x20%s\x20killed\x20correctly','systeminformation','child_process','../../config/logger'];(function(_0x28c7ad,_0x2899f0){var _0x5cd1eb=function(_0x49fe6d){while(--_0x49fe6d){_0x28c7ad['push'](_0x28c7ad['shift']());}};_0x5cd1eb(++_0x2899f0);}(_0x1733,0x10b));var _0x3173=function(_0x2cff82,_0x34c0e6){_0x2cff82=_0x2cff82-0x0;var _0x4d559e=_0x1733[_0x2cff82];return _0x4d559e;};'use strict';var info=require(_0x3173('0x0'));var exec=require(_0x3173('0x1'))['exec'];var logger=require(_0x3173('0x2'))('api');var util=require(_0x3173('0x3'));var BPromise=require(_0x3173('0x4'));var _=require(_0x3173('0x5'));function handleError(_0x270a24,_0x38ee46,_0x435f71){_0x38ee46=_0x38ee46||0x1f4;return function(_0x558b79){logger[_0x3173('0x6')](_0x3173('0x7'),_0x435f71,_0x38ee46,util[_0x3173('0x8')](_0x558b79,{'showHidden':![],'depth':null}));delete _0x558b79[_0x3173('0x9')];_0x270a24[_0x3173('0xa')](_0x38ee46)[_0x3173('0xb')](_0x558b79);};}exports[_0x3173('0xc')]=function(_0x3fea79,_0x25452e){return info['getAllData']()[_0x3173('0xd')](function(_0x275ba5){return _0x25452e['status'](0xc8)['json'](_0x275ba5);})[_0x3173('0xe')](function(_0xad5491){return _0x25452e[_0x3173('0xa')](0x1f4)[_0x3173('0xf')](_0xad5491);});};exports[_0x3173('0x10')]=function(_0x329087,_0x4ca623){var _0xb382aa=[_0x3173('0x11')];return new BPromise(function(_0x20d863,_0x31d9f7){return exec(util['format']('ps\x20-p\x20%s\x20-ww\x20-o\x20args',_0x329087[_0x3173('0x12')][_0x3173('0x13')]),function(_0x5d1e08,_0x11524a,_0x54c456){if(_0x5d1e08){return _0x31d9f7(_0x5d1e08);}return _0x20d863(_0x11524a);});})[_0x3173('0xd')](function(_0x179e4d){var _0x248a05=![];var _0x31cdf1=_0x179e4d[_0x3173('0x14')](/\n/);for(var _0x52ae4e=0x0,_0x239d2c=_0xb382aa[_0x3173('0x15')];_0x52ae4e<_0x239d2c,_0x248a05===![];_0x52ae4e+=0x1){if(_0x179e4d[_0x3173('0x16')](_0xb382aa[_0x52ae4e])>=0x0){_0x248a05=!![];}}if(!_0x248a05){throw new Error(util[_0x3173('0x17')](_0x3173('0x18'),_0x329087[_0x3173('0x12')][_0x3173('0x13')]));}process[_0x3173('0x19')](_0x329087['params'][_0x3173('0x13')],'SIGINT');return _0x4ca623[_0x3173('0xa')](0xc8)[_0x3173('0xf')]({'message':util[_0x3173('0x17')](_0x3173('0x1a'),_0x329087[_0x3173('0x12')][_0x3173('0x13')])});})[_0x3173('0xe')](handleError(_0x4ca623,null,_0x3173('0x10')));}; \ No newline at end of file +var _0x0ce7=['bluebird','lodash','inspect','name','send','index','then','catch','json','killProcess','components/import/cm','ps\x20-p\x20%s\x20-ww\x20-o\x20args','params','pid','split','indexOf','format','Process\x20with\x20pid\x20%s\x20not\x20found!','kill','SIGINT','Process\x20with\x20pid\x20%s\x20killed\x20correctly','systeminformation','exec','../../config/logger','api','util'];(function(_0x2fee96,_0x2f735d){var _0x2e6ad1=function(_0x2c55ad){while(--_0x2c55ad){_0x2fee96['push'](_0x2fee96['shift']());}};_0x2e6ad1(++_0x2f735d);}(_0x0ce7,0x119));var _0x70ce=function(_0x512653,_0x596518){_0x512653=_0x512653-0x0;var _0x30966b=_0x0ce7[_0x512653];return _0x30966b;};'use strict';var info=require(_0x70ce('0x0'));var exec=require('child_process')[_0x70ce('0x1')];var logger=require(_0x70ce('0x2'))(_0x70ce('0x3'));var util=require(_0x70ce('0x4'));var BPromise=require(_0x70ce('0x5'));var _=require(_0x70ce('0x6'));function handleError(_0x26696b,_0x501622,_0x576a03){_0x501622=_0x501622||0x1f4;return function(_0x367cdd){logger['error']('<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s',_0x576a03,_0x501622,util[_0x70ce('0x7')](_0x367cdd,{'showHidden':![],'depth':null}));delete _0x367cdd[_0x70ce('0x8')];_0x26696b['status'](_0x501622)[_0x70ce('0x9')](_0x367cdd);};}exports[_0x70ce('0xa')]=function(_0x383625,_0x1ce1e9){return info['getAllData']()[_0x70ce('0xb')](function(_0x255cc8){return _0x1ce1e9['status'](0xc8)['json'](_0x255cc8);})[_0x70ce('0xc')](function(_0x46324d){return _0x1ce1e9['status'](0x1f4)[_0x70ce('0xd')](_0x46324d);});};exports[_0x70ce('0xe')]=function(_0x3f7443,_0x101adb){var _0x114a65=[_0x70ce('0xf')];return new BPromise(function(_0x522256,_0x5ae035){return exec(util['format'](_0x70ce('0x10'),_0x3f7443[_0x70ce('0x11')][_0x70ce('0x12')]),function(_0x1bc9ac,_0x297d98,_0xc44505){if(_0x1bc9ac){return _0x5ae035(_0x1bc9ac);}return _0x522256(_0x297d98);});})[_0x70ce('0xb')](function(_0x4f13fd){var _0x5f4e7e=![];var _0x107a44=_0x4f13fd[_0x70ce('0x13')](/\n/);for(var _0xa729d8=0x0,_0x1048ac=_0x114a65['length'];_0xa729d8<_0x1048ac,_0x5f4e7e===![];_0xa729d8+=0x1){if(_0x4f13fd[_0x70ce('0x14')](_0x114a65[_0xa729d8])>=0x0){_0x5f4e7e=!![];}}if(!_0x5f4e7e){throw new Error(util[_0x70ce('0x15')](_0x70ce('0x16'),_0x3f7443[_0x70ce('0x11')][_0x70ce('0x12')]));}process[_0x70ce('0x17')](_0x3f7443[_0x70ce('0x11')]['pid'],_0x70ce('0x18'));return _0x101adb['status'](0xc8)[_0x70ce('0xd')]({'message':util[_0x70ce('0x15')](_0x70ce('0x19'),_0x3f7443[_0x70ce('0x11')][_0x70ce('0x12')])});})[_0x70ce('0xc')](handleError(_0x101adb,null,_0x70ce('0xe')));}; \ No newline at end of file diff --git a/server/api/tag/index.js b/server/api/tag/index.js index da95ad7..d10dc68 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 _0x216c=['multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','post','create','put','update','delete','destroy'];(function(_0x26dc37,_0x4116df){var _0x1ddb80=function(_0x4974a1){while(--_0x4974a1){_0x26dc37['push'](_0x26dc37['shift']());}};_0x1ddb80(++_0x4116df);}(_0x216c,0xb4));var _0xc216=function(_0xb92bae,_0x105f6b){_0xb92bae=_0xb92bae-0x0;var _0x16bf7b=_0x216c[_0xb92bae];return _0x16bf7b;};'use strict';var multer=require(_0xc216('0x0'));var util=require(_0xc216('0x1'));var path=require(_0xc216('0x2'));var timeout=require(_0xc216('0x3'));var express=require(_0xc216('0x4'));var router=express[_0xc216('0x5')]();var fs_extra=require(_0xc216('0x6'));var auth=require(_0xc216('0x7'));var interaction=require(_0xc216('0x8'));var config=require(_0xc216('0x9'));var controller=require('./tag.controller');router[_0xc216('0xa')]('/',auth[_0xc216('0xb')](),controller[_0xc216('0xc')]);router['get'](_0xc216('0xd'),auth['isAuthenticated'](),controller['show']);router[_0xc216('0xe')]('/',auth[_0xc216('0xb')](),controller[_0xc216('0xf')]);router[_0xc216('0x10')](_0xc216('0xd'),auth[_0xc216('0xb')](),controller[_0xc216('0x11')]);router[_0xc216('0x12')](_0xc216('0xd'),auth[_0xc216('0xb')](),controller[_0xc216('0x13')]);module['exports']=router; \ No newline at end of file +var _0x5b7b=['isAuthenticated','index','/:id','post','create','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./tag.controller','get'];(function(_0x54a8d3,_0x12b8b7){var _0x5eec0e=function(_0xbc1ade){while(--_0xbc1ade){_0x54a8d3['push'](_0x54a8d3['shift']());}};_0x5eec0e(++_0x12b8b7);}(_0x5b7b,0xd9));var _0xb5b7=function(_0x22b8a3,_0x2a79a7){_0x22b8a3=_0x22b8a3-0x0;var _0x199a0c=_0x5b7b[_0x22b8a3];return _0x199a0c;};'use strict';var multer=require(_0xb5b7('0x0'));var util=require('util');var path=require(_0xb5b7('0x1'));var timeout=require(_0xb5b7('0x2'));var express=require(_0xb5b7('0x3'));var router=express[_0xb5b7('0x4')]();var fs_extra=require(_0xb5b7('0x5'));var auth=require(_0xb5b7('0x6'));var interaction=require(_0xb5b7('0x7'));var config=require(_0xb5b7('0x8'));var controller=require(_0xb5b7('0x9'));router[_0xb5b7('0xa')]('/',auth[_0xb5b7('0xb')](),controller[_0xb5b7('0xc')]);router[_0xb5b7('0xa')](_0xb5b7('0xd'),auth[_0xb5b7('0xb')](),controller['show']);router[_0xb5b7('0xe')]('/',auth[_0xb5b7('0xb')](),controller[_0xb5b7('0xf')]);router['put'](_0xb5b7('0xd'),auth[_0xb5b7('0xb')](),controller['update']);router[_0xb5b7('0x10')]('/:id',auth[_0xb5b7('0xb')](),controller[_0xb5b7('0x11')]);module[_0xb5b7('0x12')]=router; \ No newline at end of file diff --git a/server/api/tag/tag.attributes.js b/server/api/tag/tag.attributes.js index ed81bbc..6921465 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 _0x1a5c=['sequelize','exports','STRING','name','#0091EA'];(function(_0x3e371b,_0x523a20){var _0x24a24a=function(_0x59526b){while(--_0x59526b){_0x3e371b['push'](_0x3e371b['shift']());}};_0x24a24a(++_0x523a20);}(_0x1a5c,0x12c));var _0xc1a5=function(_0x31e29a,_0x349c9b){_0x31e29a=_0x31e29a-0x0;var _0x32d892=_0x1a5c[_0x31e29a];return _0x32d892;};'use strict';var Sequelize=require(_0xc1a5('0x0'));module[_0xc1a5('0x1')]={'name':{'type':Sequelize[_0xc1a5('0x2')],'unique':_0xc1a5('0x3'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0xc1a5('0x2')],'defaultValue':_0xc1a5('0x4')},'description':{'type':Sequelize[_0xc1a5('0x2')]}}; \ No newline at end of file +var _0xd61e=['name','#0091EA','sequelize','exports','STRING'];(function(_0x639778,_0x3232d2){var _0x321b6b=function(_0x57754a){while(--_0x57754a){_0x639778['push'](_0x639778['shift']());}};_0x321b6b(++_0x3232d2);}(_0xd61e,0x13d));var _0xed61=function(_0x935075,_0x10110a){_0x935075=_0x935075-0x0;var _0x5bc40d=_0xd61e[_0x935075];return _0x5bc40d;};'use strict';var Sequelize=require(_0xed61('0x0'));module[_0xed61('0x1')]={'name':{'type':Sequelize[_0xed61('0x2')],'unique':_0xed61('0x3'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0xed61('0x2')],'defaultValue':_0xed61('0x4')},'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 61e725a..23d35cf 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 _0x87ae=['moment','bluebird','mustache','path','sox','to-csv','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','end','offset','limit','undefined','count','set','Content-Range','json','apply','reject','update','then','UserProfileResource','destroy','status','stack','name','index','map','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','filter','where','merge','type','VIRTUAL','options','Tag','includeAll','findAll','rows','show','params','length','include','find','catch','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Tags','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','zip-dir'];(function(_0x8bb4c1,_0x2d6e53){var _0x67a6e1=function(_0x1155e5){while(--_0x1155e5){_0x8bb4c1['push'](_0x8bb4c1['shift']());}};_0x67a6e1(++_0x2d6e53);}(_0x87ae,0xf5));var _0xe87a=function(_0xf48cce,_0x3531e4){_0xf48cce=_0xf48cce-0x0;var _0x2a5c38=_0x87ae[_0xf48cce];return _0x2a5c38;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xe87a('0x0'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xe87a('0x1'));var BPromise=require(_0xe87a('0x2'));var Mustache=require(_0xe87a('0x3'));var util=require('util');var path=require(_0xe87a('0x4'));var sox=require(_0xe87a('0x5'));var csv=require(_0xe87a('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xe87a('0x7'));var squel=require(_0xe87a('0x8'));var crypto=require('crypto');var jsforce=require(_0xe87a('0x9'));var deskjs=require(_0xe87a('0xa'));var toCsv=require('to-csv');var querystring=require(_0xe87a('0xb'));var Papa=require(_0xe87a('0xc'));var Redis=require('ioredis');var authService=require(_0xe87a('0xd'));var qs=require(_0xe87a('0xe'));var as=require(_0xe87a('0xf'));var hardwareService=require(_0xe87a('0x10'));var logger=require(_0xe87a('0x11'))(_0xe87a('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xe87a('0x13'));var db=require(_0xe87a('0x14'))['db'];function respondWithStatusCode(_0x3e990c,_0x4db185){_0x4db185=_0x4db185||0xcc;return function(_0x1a725a){if(_0x1a725a){return _0x3e990c[_0xe87a('0x15')](_0x4db185);}return _0x3e990c['status'](_0x4db185)[_0xe87a('0x16')]();};}function respondWithResult(_0x353c52,_0x136340){_0x136340=_0x136340||0xc8;return function(_0x5032c5){if(_0x5032c5){return _0x353c52['status'](_0x136340)['json'](_0x5032c5);}};}function respondWithFilteredResult(_0x53a4f7,_0x44474f){return function(_0x1fa2cd){if(_0x1fa2cd){var _0xd2ca53=typeof _0x44474f[_0xe87a('0x17')]==='undefined'&&typeof _0x44474f[_0xe87a('0x18')]===_0xe87a('0x19');var _0x527c58=_0x1fa2cd['count'];var _0x4160e2=_0xd2ca53?0x0:_0x44474f['offset'];var _0x182e6f=_0xd2ca53?_0x1fa2cd[_0xe87a('0x1a')]:_0x44474f[_0xe87a('0x17')]+_0x44474f['limit'];var _0x444eeb;if(_0x182e6f>=_0x527c58){_0x182e6f=_0x527c58;_0x444eeb=0xc8;}else{_0x444eeb=0xce;}_0x53a4f7['status'](_0x444eeb);return _0x53a4f7[_0xe87a('0x1b')](_0xe87a('0x1c'),_0x4160e2+'-'+_0x182e6f+'/'+_0x527c58)[_0xe87a('0x1d')](_0x1fa2cd);}return null;};}function patchUpdates(_0x4059e1){return function(_0x104f67){try{jsonpatch[_0xe87a('0x1e')](_0x104f67,_0x4059e1,!![]);}catch(_0x1e37aa){return BPromise[_0xe87a('0x1f')](_0x1e37aa);}return _0x104f67['save']();};}function saveUpdates(_0x59c17c,_0x42ba03){return function(_0x363c6a){if(_0x363c6a){return _0x363c6a[_0xe87a('0x20')](_0x59c17c)[_0xe87a('0x21')](function(_0x15ced2){return _0x15ced2;});}return null;};}function removeEntity(_0x46731f,_0x56eba0){return function(_0x59d9f7){if(_0x59d9f7){return _0x59d9f7['destroy']()['then'](function(){var _0x328921=_0x59d9f7['get']({'plain':!![]});var _0x1108d0='Tags';return db[_0xe87a('0x22')][_0xe87a('0x23')]({'where':{'type':_0x1108d0,'resourceId':_0x328921['id']}})[_0xe87a('0x21')](function(){return _0x59d9f7;});})[_0xe87a('0x21')](function(){_0x46731f[_0xe87a('0x24')](0xcc)[_0xe87a('0x16')]();});}};}function handleEntityNotFound(_0x4fe080,_0x3fc24e){return function(_0x5b984f){if(!_0x5b984f){_0x4fe080['sendStatus'](0x194);}return _0x5b984f;};}function handleError(_0x39ec27,_0x48511b){_0x48511b=_0x48511b||0x1f4;return function(_0x537b52){logger['error'](_0x537b52[_0xe87a('0x25')]);if(_0x537b52[_0xe87a('0x26')]){delete _0x537b52[_0xe87a('0x26')];}_0x39ec27['status'](_0x48511b)['send'](_0x537b52);};}exports[_0xe87a('0x27')]=function(_0x5a747b,_0x4f61f7){var _0x3a5dc4={},_0x1d9742={},_0x15407d={'count':0x0,'rows':[]};var _0x2d3f77=_[_0xe87a('0x28')](db['Tag'][_0xe87a('0x29')],function(_0x4b80df){return{'name':_0x4b80df[_0xe87a('0x2a')],'type':_0x4b80df['type'][_0xe87a('0x2b')]};});_0x1d9742[_0xe87a('0x2c')]=_[_0xe87a('0x28')](_0x2d3f77,_0xe87a('0x26'));_0x1d9742[_0xe87a('0x2d')]=_[_0xe87a('0x2e')](_0x5a747b[_0xe87a('0x2d')]);_0x1d9742[_0xe87a('0x2f')]=_[_0xe87a('0x30')](_0x1d9742[_0xe87a('0x2c')],_0x1d9742['query']);_0x3a5dc4['attributes']=_['intersection'](_0x1d9742[_0xe87a('0x2c')],qs['fields'](_0x5a747b[_0xe87a('0x2d')][_0xe87a('0x31')]));_0x3a5dc4['attributes']=_0x3a5dc4[_0xe87a('0x32')]['length']?_0x3a5dc4['attributes']:_0x1d9742[_0xe87a('0x2c')];if(!_0x5a747b[_0xe87a('0x2d')][_0xe87a('0x33')](_0xe87a('0x34'))){_0x3a5dc4['limit']=qs[_0xe87a('0x18')](_0x5a747b[_0xe87a('0x2d')]['limit']);_0x3a5dc4[_0xe87a('0x17')]=qs[_0xe87a('0x17')](_0x5a747b['query'][_0xe87a('0x17')]);}_0x3a5dc4[_0xe87a('0x35')]=qs[_0xe87a('0x36')](_0x5a747b[_0xe87a('0x2d')][_0xe87a('0x36')]);_0x3a5dc4['where']=qs[_0xe87a('0x2f')](_['pick'](_0x5a747b[_0xe87a('0x2d')],_0x1d9742['filters']),_0x2d3f77);if(_0x5a747b['query'][_0xe87a('0x37')]){_0x3a5dc4[_0xe87a('0x38')]=_[_0xe87a('0x39')](_0x3a5dc4[_0xe87a('0x38')],{'$or':_[_0xe87a('0x28')](_0x2d3f77,function(_0x1109b9){if(_0x1109b9[_0xe87a('0x3a')]!==_0xe87a('0x3b')){var _0xda1ce1={};_0xda1ce1[_0x1109b9[_0xe87a('0x26')]]={'$like':'%'+_0x5a747b[_0xe87a('0x2d')][_0xe87a('0x37')]+'%'};return _0xda1ce1;}})});}_0x3a5dc4=_[_0xe87a('0x39')]({},_0x3a5dc4,_0x5a747b[_0xe87a('0x3c')]);var _0x553537={'where':_0x3a5dc4[_0xe87a('0x38')]};return db[_0xe87a('0x3d')][_0xe87a('0x1a')](_0x553537)[_0xe87a('0x21')](function(_0x5eb4e1){_0x15407d['count']=_0x5eb4e1;if(_0x5a747b['query'][_0xe87a('0x3e')]){_0x3a5dc4['include']=[{'all':!![]}];}return db['Tag'][_0xe87a('0x3f')](_0x3a5dc4);})['then'](function(_0x5b1f55){_0x15407d[_0xe87a('0x40')]=_0x5b1f55;return _0x15407d;})[_0xe87a('0x21')](respondWithFilteredResult(_0x4f61f7,_0x3a5dc4))['catch'](handleError(_0x4f61f7,null));};exports[_0xe87a('0x41')]=function(_0x4e8f4c,_0x5ad3af){var _0x551ba3={'raw':!![],'where':{'id':_0x4e8f4c[_0xe87a('0x42')]['id']}},_0x3aba9c={};_0x3aba9c['model']=_[_0xe87a('0x2e')](db[_0xe87a('0x3d')][_0xe87a('0x29')]);_0x3aba9c['query']=_['keys'](_0x4e8f4c['query']);_0x3aba9c['filters']=_[_0xe87a('0x30')](_0x3aba9c['model'],_0x3aba9c[_0xe87a('0x2d')]);_0x551ba3[_0xe87a('0x32')]=_[_0xe87a('0x30')](_0x3aba9c[_0xe87a('0x2c')],qs['fields'](_0x4e8f4c[_0xe87a('0x2d')][_0xe87a('0x31')]));_0x551ba3['attributes']=_0x551ba3[_0xe87a('0x32')][_0xe87a('0x43')]?_0x551ba3[_0xe87a('0x32')]:_0x3aba9c[_0xe87a('0x2c')];if(_0x4e8f4c[_0xe87a('0x2d')][_0xe87a('0x3e')]){_0x551ba3[_0xe87a('0x44')]=[{'all':!![]}];}_0x551ba3=_[_0xe87a('0x39')]({},_0x551ba3,_0x4e8f4c[_0xe87a('0x3c')]);return db['Tag'][_0xe87a('0x45')](_0x551ba3)[_0xe87a('0x21')](handleEntityNotFound(_0x5ad3af,null))[_0xe87a('0x21')](respondWithResult(_0x5ad3af,null))[_0xe87a('0x46')](handleError(_0x5ad3af,null));};exports['create']=function(_0x6ddec4,_0x28c00b){return db[_0xe87a('0x3d')][_0xe87a('0x47')](_0x6ddec4[_0xe87a('0x48')],{})[_0xe87a('0x21')](function(_0x154f73){var _0x324d97=_0x6ddec4['user'][_0xe87a('0x49')]({'plain':!![]});if(!_0x324d97)throw new Error(_0xe87a('0x4a'));if(_0x324d97[_0xe87a('0x4b')]==='user'){var _0x19d380=_0x154f73[_0xe87a('0x49')]({'plain':!![]});var _0xe032c8=_0xe87a('0x4c');return db[_0xe87a('0x4d')][_0xe87a('0x45')]({'where':{'name':_0xe032c8,'userProfileId':_0x324d97[_0xe87a('0x4e')]},'raw':!![]})[_0xe87a('0x21')](function(_0x1d268a){if(_0x1d268a&&_0x1d268a[_0xe87a('0x4f')]===0x0){return db[_0xe87a('0x22')][_0xe87a('0x47')]({'name':_0x19d380['name'],'resourceId':_0x19d380['id'],'type':_0x1d268a[_0xe87a('0x26')],'sectionId':_0x1d268a['id']},{})[_0xe87a('0x21')](function(){return _0x154f73;});}else{return _0x154f73;}})[_0xe87a('0x46')](function(_0x1bbd2e){logger[_0xe87a('0x50')](_0xe87a('0x51'),_0x1bbd2e);throw _0x1bbd2e;});}return _0x154f73;})[_0xe87a('0x21')](respondWithResult(_0x28c00b,0xc9))[_0xe87a('0x46')](handleError(_0x28c00b,null));};exports[_0xe87a('0x20')]=function(_0x5ee0b9,_0x553df2){if(_0x5ee0b9[_0xe87a('0x48')]['id']){delete _0x5ee0b9[_0xe87a('0x48')]['id'];}return db['Tag'][_0xe87a('0x45')]({'where':{'id':_0x5ee0b9[_0xe87a('0x42')]['id']}})['then'](handleEntityNotFound(_0x553df2,null))[_0xe87a('0x21')](saveUpdates(_0x5ee0b9[_0xe87a('0x48')],null))['then'](respondWithResult(_0x553df2,null))[_0xe87a('0x46')](handleError(_0x553df2,null));};exports[_0xe87a('0x23')]=function(_0x86d45e,_0xe84a3a){return db['Tag']['find']({'where':{'id':_0x86d45e[_0xe87a('0x42')]['id']}})[_0xe87a('0x21')](handleEntityNotFound(_0xe84a3a,null))['then'](removeEntity(_0xe84a3a,null))[_0xe87a('0x46')](handleError(_0xe84a3a,null));}; \ No newline at end of file +var _0x3eec=['set','Content-Range','apply','reject','save','update','then','get','Tags','end','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','keys','find','Tag','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','destroy','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','status','json','undefined','count','offset','limit'];(function(_0x2a9e33,_0x588b29){var _0x3337e4=function(_0x4d6f42){while(--_0x4d6f42){_0x2a9e33['push'](_0x2a9e33['shift']());}};_0x3337e4(++_0x588b29);}(_0x3eec,0x1e9));var _0xc3ee=function(_0x3f7c6b,_0x4ac9b6){_0x3f7c6b=_0x3f7c6b-0x0;var _0x4ad8b6=_0x3eec[_0x3f7c6b];return _0x4ad8b6;};'use strict';var emlformat=require(_0xc3ee('0x0'));var rimraf=require(_0xc3ee('0x1'));var zipdir=require(_0xc3ee('0x2'));var jsonpatch=require(_0xc3ee('0x3'));var rp=require('request-promise');var moment=require(_0xc3ee('0x4'));var BPromise=require(_0xc3ee('0x5'));var Mustache=require(_0xc3ee('0x6'));var util=require(_0xc3ee('0x7'));var path=require(_0xc3ee('0x8'));var sox=require(_0xc3ee('0x9'));var csv=require('to-csv');var ejs=require(_0xc3ee('0xa'));var fs=require('fs');var fs_extra=require(_0xc3ee('0xb'));var _=require(_0xc3ee('0xc'));var squel=require(_0xc3ee('0xd'));var crypto=require(_0xc3ee('0xe'));var jsforce=require(_0xc3ee('0xf'));var deskjs=require(_0xc3ee('0x10'));var toCsv=require(_0xc3ee('0x11'));var querystring=require(_0xc3ee('0x12'));var Papa=require(_0xc3ee('0x13'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xc3ee('0x14'));var as=require(_0xc3ee('0x15'));var hardwareService=require(_0xc3ee('0x16'));var logger=require(_0xc3ee('0x17'))('api');var utils=require(_0xc3ee('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0xc3ee('0x19'));var db=require(_0xc3ee('0x1a'))['db'];function respondWithStatusCode(_0x4beb01,_0x5f2c3a){_0x5f2c3a=_0x5f2c3a||0xcc;return function(_0x2eb82e){if(_0x2eb82e){return _0x4beb01['sendStatus'](_0x5f2c3a);}return _0x4beb01[_0xc3ee('0x1b')](_0x5f2c3a)['end']();};}function respondWithResult(_0x19feb3,_0x58ebe7){_0x58ebe7=_0x58ebe7||0xc8;return function(_0x3d669d){if(_0x3d669d){return _0x19feb3[_0xc3ee('0x1b')](_0x58ebe7)[_0xc3ee('0x1c')](_0x3d669d);}};}function respondWithFilteredResult(_0x664bad,_0x476f8f){return function(_0xf63359){if(_0xf63359){var _0x277e11=typeof _0x476f8f['offset']===_0xc3ee('0x1d')&&typeof _0x476f8f['limit']===_0xc3ee('0x1d');var _0x1bf49a=_0xf63359[_0xc3ee('0x1e')];var _0x219db0=_0x277e11?0x0:_0x476f8f[_0xc3ee('0x1f')];var _0x3acb0c=_0x277e11?_0xf63359[_0xc3ee('0x1e')]:_0x476f8f[_0xc3ee('0x1f')]+_0x476f8f[_0xc3ee('0x20')];var _0x202a9a;if(_0x3acb0c>=_0x1bf49a){_0x3acb0c=_0x1bf49a;_0x202a9a=0xc8;}else{_0x202a9a=0xce;}_0x664bad[_0xc3ee('0x1b')](_0x202a9a);return _0x664bad[_0xc3ee('0x21')](_0xc3ee('0x22'),_0x219db0+'-'+_0x3acb0c+'/'+_0x1bf49a)[_0xc3ee('0x1c')](_0xf63359);}return null;};}function patchUpdates(_0x3e7224){return function(_0x46a8c9){try{jsonpatch[_0xc3ee('0x23')](_0x46a8c9,_0x3e7224,!![]);}catch(_0x30df3a){return BPromise[_0xc3ee('0x24')](_0x30df3a);}return _0x46a8c9[_0xc3ee('0x25')]();};}function saveUpdates(_0x11778f,_0x493fea){return function(_0x4d672e){if(_0x4d672e){return _0x4d672e[_0xc3ee('0x26')](_0x11778f)[_0xc3ee('0x27')](function(_0x3b8f75){return _0x3b8f75;});}return null;};}function removeEntity(_0x464ffc,_0x28bfeb){return function(_0x238df7){if(_0x238df7){return _0x238df7['destroy']()[_0xc3ee('0x27')](function(){var _0x3f8f7b=_0x238df7[_0xc3ee('0x28')]({'plain':!![]});var _0xfd03bd=_0xc3ee('0x29');return db['UserProfileResource']['destroy']({'where':{'type':_0xfd03bd,'resourceId':_0x3f8f7b['id']}})[_0xc3ee('0x27')](function(){return _0x238df7;});})[_0xc3ee('0x27')](function(){_0x464ffc[_0xc3ee('0x1b')](0xcc)[_0xc3ee('0x2a')]();});}};}function handleEntityNotFound(_0x836fac,_0x4ecfec){return function(_0x56201a){if(!_0x56201a){_0x836fac['sendStatus'](0x194);}return _0x56201a;};}function handleError(_0x1be005,_0x2f2c29){_0x2f2c29=_0x2f2c29||0x1f4;return function(_0x44678b){logger[_0xc3ee('0x2b')](_0x44678b[_0xc3ee('0x2c')]);if(_0x44678b['name']){delete _0x44678b[_0xc3ee('0x2d')];}_0x1be005[_0xc3ee('0x1b')](_0x2f2c29)[_0xc3ee('0x2e')](_0x44678b);};}exports[_0xc3ee('0x2f')]=function(_0x1f7b3a,_0x8bbe1e){var _0x3b17f7={},_0x4da264={},_0x330b71={'count':0x0,'rows':[]};var _0x35c19a=_[_0xc3ee('0x30')](db['Tag'][_0xc3ee('0x31')],function(_0x240a16){return{'name':_0x240a16[_0xc3ee('0x32')],'type':_0x240a16[_0xc3ee('0x33')][_0xc3ee('0x34')]};});_0x4da264[_0xc3ee('0x35')]=_[_0xc3ee('0x30')](_0x35c19a,'name');_0x4da264[_0xc3ee('0x36')]=_['keys'](_0x1f7b3a[_0xc3ee('0x36')]);_0x4da264[_0xc3ee('0x37')]=_[_0xc3ee('0x38')](_0x4da264[_0xc3ee('0x35')],_0x4da264[_0xc3ee('0x36')]);_0x3b17f7[_0xc3ee('0x39')]=_['intersection'](_0x4da264[_0xc3ee('0x35')],qs[_0xc3ee('0x3a')](_0x1f7b3a[_0xc3ee('0x36')][_0xc3ee('0x3a')]));_0x3b17f7[_0xc3ee('0x39')]=_0x3b17f7[_0xc3ee('0x39')][_0xc3ee('0x3b')]?_0x3b17f7[_0xc3ee('0x39')]:_0x4da264[_0xc3ee('0x35')];if(!_0x1f7b3a[_0xc3ee('0x36')][_0xc3ee('0x3c')](_0xc3ee('0x3d'))){_0x3b17f7[_0xc3ee('0x20')]=qs[_0xc3ee('0x20')](_0x1f7b3a[_0xc3ee('0x36')][_0xc3ee('0x20')]);_0x3b17f7[_0xc3ee('0x1f')]=qs[_0xc3ee('0x1f')](_0x1f7b3a[_0xc3ee('0x36')][_0xc3ee('0x1f')]);}_0x3b17f7[_0xc3ee('0x3e')]=qs['sort'](_0x1f7b3a[_0xc3ee('0x36')]['sort']);_0x3b17f7[_0xc3ee('0x3f')]=qs[_0xc3ee('0x37')](_[_0xc3ee('0x40')](_0x1f7b3a[_0xc3ee('0x36')],_0x4da264[_0xc3ee('0x37')]),_0x35c19a);if(_0x1f7b3a[_0xc3ee('0x36')]['filter']){_0x3b17f7[_0xc3ee('0x3f')]=_[_0xc3ee('0x41')](_0x3b17f7[_0xc3ee('0x3f')],{'$or':_['map'](_0x35c19a,function(_0x181179){if(_0x181179[_0xc3ee('0x33')]!==_0xc3ee('0x42')){var _0x1fe17f={};_0x1fe17f[_0x181179[_0xc3ee('0x2d')]]={'$like':'%'+_0x1f7b3a[_0xc3ee('0x36')][_0xc3ee('0x43')]+'%'};return _0x1fe17f;}})});}_0x3b17f7=_[_0xc3ee('0x41')]({},_0x3b17f7,_0x1f7b3a[_0xc3ee('0x44')]);var _0x23d365={'where':_0x3b17f7[_0xc3ee('0x3f')]};return db['Tag'][_0xc3ee('0x1e')](_0x23d365)[_0xc3ee('0x27')](function(_0x4a89b7){_0x330b71['count']=_0x4a89b7;if(_0x1f7b3a[_0xc3ee('0x36')][_0xc3ee('0x45')]){_0x3b17f7[_0xc3ee('0x46')]=[{'all':!![]}];}return db['Tag'][_0xc3ee('0x47')](_0x3b17f7);})[_0xc3ee('0x27')](function(_0x112e77){_0x330b71[_0xc3ee('0x48')]=_0x112e77;return _0x330b71;})[_0xc3ee('0x27')](respondWithFilteredResult(_0x8bbe1e,_0x3b17f7))[_0xc3ee('0x49')](handleError(_0x8bbe1e,null));};exports[_0xc3ee('0x4a')]=function(_0x724c4e,_0x49b424){var _0x602d47={'raw':!![],'where':{'id':_0x724c4e[_0xc3ee('0x4b')]['id']}},_0xf833d9={};_0xf833d9[_0xc3ee('0x35')]=_[_0xc3ee('0x4c')](db['Tag'][_0xc3ee('0x31')]);_0xf833d9['query']=_['keys'](_0x724c4e[_0xc3ee('0x36')]);_0xf833d9[_0xc3ee('0x37')]=_['intersection'](_0xf833d9[_0xc3ee('0x35')],_0xf833d9[_0xc3ee('0x36')]);_0x602d47['attributes']=_[_0xc3ee('0x38')](_0xf833d9['model'],qs[_0xc3ee('0x3a')](_0x724c4e['query'][_0xc3ee('0x3a')]));_0x602d47[_0xc3ee('0x39')]=_0x602d47['attributes']['length']?_0x602d47['attributes']:_0xf833d9[_0xc3ee('0x35')];if(_0x724c4e[_0xc3ee('0x36')][_0xc3ee('0x45')]){_0x602d47[_0xc3ee('0x46')]=[{'all':!![]}];}_0x602d47=_[_0xc3ee('0x41')]({},_0x602d47,_0x724c4e['options']);return db['Tag'][_0xc3ee('0x4d')](_0x602d47)[_0xc3ee('0x27')](handleEntityNotFound(_0x49b424,null))['then'](respondWithResult(_0x49b424,null))[_0xc3ee('0x49')](handleError(_0x49b424,null));};exports['create']=function(_0x60e36a,_0x5d0017){return db[_0xc3ee('0x4e')][_0xc3ee('0x4f')](_0x60e36a[_0xc3ee('0x50')],{})[_0xc3ee('0x27')](function(_0x8c8cc6){var _0x281adc=_0x60e36a[_0xc3ee('0x51')]['get']({'plain':!![]});if(!_0x281adc)throw new Error(_0xc3ee('0x52'));if(_0x281adc[_0xc3ee('0x53')]===_0xc3ee('0x51')){var _0x237aa8=_0x8c8cc6['get']({'plain':!![]});var _0xd246f2=_0xc3ee('0x29');return db[_0xc3ee('0x54')][_0xc3ee('0x4d')]({'where':{'name':_0xd246f2,'userProfileId':_0x281adc[_0xc3ee('0x55')]},'raw':!![]})[_0xc3ee('0x27')](function(_0x14df9d){if(_0x14df9d&&_0x14df9d['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x237aa8['name'],'resourceId':_0x237aa8['id'],'type':_0x14df9d[_0xc3ee('0x2d')],'sectionId':_0x14df9d['id']},{})[_0xc3ee('0x27')](function(){return _0x8c8cc6;});}else{return _0x8c8cc6;}})[_0xc3ee('0x49')](function(_0x2b9ea){logger[_0xc3ee('0x2b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2b9ea);throw _0x2b9ea;});}return _0x8c8cc6;})['then'](respondWithResult(_0x5d0017,0xc9))[_0xc3ee('0x49')](handleError(_0x5d0017,null));};exports['update']=function(_0x1ca127,_0x28eca9){if(_0x1ca127[_0xc3ee('0x50')]['id']){delete _0x1ca127['body']['id'];}return db[_0xc3ee('0x4e')][_0xc3ee('0x4d')]({'where':{'id':_0x1ca127[_0xc3ee('0x4b')]['id']}})[_0xc3ee('0x27')](handleEntityNotFound(_0x28eca9,null))[_0xc3ee('0x27')](saveUpdates(_0x1ca127[_0xc3ee('0x50')],null))[_0xc3ee('0x27')](respondWithResult(_0x28eca9,null))[_0xc3ee('0x49')](handleError(_0x28eca9,null));};exports[_0xc3ee('0x56')]=function(_0x5d5ca5,_0x3fdc8f){return db[_0xc3ee('0x4e')][_0xc3ee('0x4d')]({'where':{'id':_0x5d5ca5[_0xc3ee('0x4b')]['id']}})[_0xc3ee('0x27')](handleEntityNotFound(_0x3fdc8f,null))[_0xc3ee('0x27')](removeEntity(_0x3fdc8f,null))[_0xc3ee('0x49')](handleError(_0x3fdc8f,null));}; \ No newline at end of file diff --git a/server/api/tag/tag.model.js b/server/api/tag/tag.model.js index 4a1e8e0..c578eda 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 _0xf045=['exports','define','Tag','tools_tags','util','../../config/logger','moment','bluebird','path','rimraf','./tag.attributes'];(function(_0x36884e,_0x48008f){var _0x1cc367=function(_0x388a78){while(--_0x388a78){_0x36884e['push'](_0x36884e['shift']());}};_0x1cc367(++_0x48008f);}(_0xf045,0x93));var _0x5f04=function(_0x3b873d,_0x179947){_0x3b873d=_0x3b873d-0x0;var _0x2b70f2=_0xf045[_0x3b873d];return _0x2b70f2;};'use strict';var _=require('lodash');var util=require(_0x5f04('0x0'));var logger=require(_0x5f04('0x1'))('api');var moment=require(_0x5f04('0x2'));var BPromise=require(_0x5f04('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5f04('0x4'));var rimraf=require(_0x5f04('0x5'));var config=require('../../config/environment');var attributes=require(_0x5f04('0x6'));module[_0x5f04('0x7')]=function(_0x4ae394,_0x4e2b04){return _0x4ae394[_0x5f04('0x8')](_0x5f04('0x9'),attributes,{'tableName':_0x5f04('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbdee=['tools_tags','lodash','util','api','moment','bluebird','request-promise','rimraf','../../config/environment','exports','define','Tag'];(function(_0x545fd5,_0x38f377){var _0x5babce=function(_0x29cd09){while(--_0x29cd09){_0x545fd5['push'](_0x545fd5['shift']());}};_0x5babce(++_0x38f377);}(_0xbdee,0x181));var _0xebde=function(_0x38a1b2,_0x4257b3){_0x38a1b2=_0x38a1b2-0x0;var _0x5d4164=_0xbdee[_0x38a1b2];return _0x5d4164;};'use strict';var _=require(_0xebde('0x0'));var util=require(_0xebde('0x1'));var logger=require('../../config/logger')(_0xebde('0x2'));var moment=require(_0xebde('0x3'));var BPromise=require(_0xebde('0x4'));var rp=require(_0xebde('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xebde('0x6'));var config=require(_0xebde('0x7'));var attributes=require('./tag.attributes');module[_0xebde('0x8')]=function(_0x15ad6f,_0xfddbc5){return _0x15ad6f[_0xebde('0x9')](_0xebde('0xa'),attributes,{'tableName':_0xebde('0xb'),'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 6eafa73..ec39c97 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 _0x3667=['error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Tag,\x20%s,\x20%s','request\x20sent','debug','Tag,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x5d15c7,_0x50fc96){var _0x338486=function(_0x19d976){while(--_0x19d976){_0x5d15c7['push'](_0x5d15c7['shift']());}};_0x338486(++_0x50fc96);}(_0x3667,0xcd));var _0x7366=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3667[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x7366('0x0'));var util=require(_0x7366('0x1'));var moment=require(_0x7366('0x2'));var BPromise=require(_0x7366('0x3'));var rs=require(_0x7366('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7366('0x5'))['db'];var utils=require(_0x7366('0x6'));var logger=require('../../config/logger')(_0x7366('0x7'));var config=require(_0x7366('0x8'));var jayson=require(_0x7366('0x9'));var client=jayson[_0x7366('0xa')][_0x7366('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x589397,_0x28f6c8,_0xa1a3c5){return new BPromise(function(_0x2dd32b,_0x26e9a9){return client[_0x7366('0xc')](_0x589397,_0xa1a3c5)[_0x7366('0xd')](function(_0x1995c7){logger[_0x7366('0xe')](_0x7366('0xf'),_0x28f6c8,_0x7366('0x10'));logger[_0x7366('0x11')](_0x7366('0x12'),_0x28f6c8,_0x7366('0x10'),JSON[_0x7366('0x13')](_0x1995c7));if(_0x1995c7[_0x7366('0x14')]){if(_0x1995c7[_0x7366('0x14')][_0x7366('0x15')]===0x1f4){logger[_0x7366('0x14')](_0x7366('0xf'),_0x28f6c8,_0x1995c7[_0x7366('0x14')][_0x7366('0x16')]);return _0x26e9a9(_0x1995c7[_0x7366('0x14')][_0x7366('0x16')]);}logger[_0x7366('0x14')](_0x7366('0xf'),_0x28f6c8,_0x1995c7[_0x7366('0x14')][_0x7366('0x16')]);return _0x2dd32b(_0x1995c7[_0x7366('0x14')]['message']);}else{logger[_0x7366('0xe')](_0x7366('0xf'),_0x28f6c8,_0x7366('0x10'));_0x2dd32b(_0x1995c7[_0x7366('0x17')][_0x7366('0x16')]);}})[_0x7366('0x18')](function(_0x2bc2af){logger[_0x7366('0x14')](_0x7366('0xf'),_0x28f6c8,_0x2bc2af);_0x26e9a9(_0x2bc2af);});});} \ No newline at end of file +var _0xdd0c=['error','code','message','result','catch','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','Tag,\x20%s,\x20%s','request\x20sent','debug','Tag,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x941f77,_0x448bef){var _0x5c9aa2=function(_0x5554b7){while(--_0x5554b7){_0x941f77['push'](_0x941f77['shift']());}};_0x5c9aa2(++_0x448bef);}(_0xdd0c,0x165));var _0xcdd0=function(_0x15d135,_0x22ffde){_0x15d135=_0x15d135-0x0;var _0x1d72d0=_0xdd0c[_0x15d135];return _0x1d72d0;};'use strict';var _=require('lodash');var util=require(_0xcdd0('0x0'));var moment=require(_0xcdd0('0x1'));var BPromise=require(_0xcdd0('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xcdd0('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xcdd0('0x4'));var logger=require(_0xcdd0('0x5'))(_0xcdd0('0x6'));var config=require(_0xcdd0('0x7'));var jayson=require(_0xcdd0('0x8'));var client=jayson['client'][_0xcdd0('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1b6f5d,_0x1fd3f6,_0x15c402){return new BPromise(function(_0x337496,_0x557a65){return client[_0xcdd0('0xa')](_0x1b6f5d,_0x15c402)['then'](function(_0x5db720){logger[_0xcdd0('0xb')](_0xcdd0('0xc'),_0x1fd3f6,_0xcdd0('0xd'));logger[_0xcdd0('0xe')](_0xcdd0('0xf'),_0x1fd3f6,_0xcdd0('0xd'),JSON[_0xcdd0('0x10')](_0x5db720));if(_0x5db720[_0xcdd0('0x11')]){if(_0x5db720[_0xcdd0('0x11')][_0xcdd0('0x12')]===0x1f4){logger['error']('Tag,\x20%s,\x20%s',_0x1fd3f6,_0x5db720[_0xcdd0('0x11')][_0xcdd0('0x13')]);return _0x557a65(_0x5db720['error'][_0xcdd0('0x13')]);}logger[_0xcdd0('0x11')]('Tag,\x20%s,\x20%s',_0x1fd3f6,_0x5db720[_0xcdd0('0x11')][_0xcdd0('0x13')]);return _0x337496(_0x5db720[_0xcdd0('0x11')][_0xcdd0('0x13')]);}else{logger[_0xcdd0('0xb')]('Tag,\x20%s,\x20%s',_0x1fd3f6,'request\x20sent');_0x337496(_0x5db720[_0xcdd0('0x14')][_0xcdd0('0x13')]);}})[_0xcdd0('0x15')](function(_0xf7af04){logger[_0xcdd0('0x11')](_0xcdd0('0xc'),_0x1fd3f6,_0xf7af04);_0x557a65(_0xf7af04);});});} \ No newline at end of file diff --git a/server/api/team/index.js b/server/api/team/index.js index 3ffa37c..5c6e7d9 100644 --- a/server/api/team/index.js +++ b/server/api/team/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./team.controller','get','index','/:id','getQueues','/:id/users','isAuthenticated','getAgents','post','addQueues','addAgents','update','delete','removeAgents','multer','util','path'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xa9e0[_0x5b644e];return _0x49c6bf;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/queues',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/queues',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0xf')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x11')]);router['put'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x12')]);router[_0x0a9e('0x13')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller['destroy']);router[_0x0a9e('0x13')]('/:id/queues',auth[_0x0a9e('0xd')](),controller['removeQueues']);router[_0x0a9e('0x13')](_0x0a9e('0xc'),auth['isAuthenticated'](),controller[_0x0a9e('0x14')]);module['exports']=router; \ No newline at end of file +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(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_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'));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 cafea1e..c972c5d 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 _0x2032=['name','exports','STRING'];(function(_0x5106d7,_0x1fffb2){var _0xbf5616=function(_0x42b3d3){while(--_0x42b3d3){_0x5106d7['push'](_0x5106d7['shift']());}};_0xbf5616(++_0x1fffb2);}(_0x2032,0xd9));var _0x2203=function(_0xcc0650,_0x4e8da4){_0xcc0650=_0xcc0650-0x0;var _0x5b62ee=_0x2032[_0xcc0650];return _0x5b62ee;};'use strict';var Sequelize=require('sequelize');module[_0x2203('0x0')]={'name':{'type':Sequelize[_0x2203('0x1')],'allowNull':![],'unique':_0x2203('0x2')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xb10b=['name','sequelize','STRING'];(function(_0x56fa19,_0x1789c1){var _0x4d1bed=function(_0x2df9ec){while(--_0x2df9ec){_0x56fa19['push'](_0x56fa19['shift']());}};_0x4d1bed(++_0x1789c1);}(_0xb10b,0x12a));var _0xbb10=function(_0x4291a2,_0x2ee2e5){_0x4291a2=_0x4291a2-0x0;var _0x235817=_0xb10b[_0x4291a2];return _0x235817;};'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 diff --git a/server/api/team/team.controller.js b/server/api/team/team.controller.js index 1f80f27..2d8bf4d 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 _0x6dac=['OpenchannelQueueId','UserOpenchannelQueue','SELECT\x20WhatsappQueueId\x20FROM\x20team_has_whatsapp_queues\x20WHERE\x20TeamId\x20=\x20','WhatsappQueueId','UserWhatsappQueue','UserVoicePrefix','VoicePrefixId','getQueues','channel','isValidChannel','ValidationError','Unknown\x20channel','toLowerCase','Queue','order','capitalize','Queues','addQueues','findOne','add','ids','removeQueues','remove','addAgents','isArray','Voice','Chat','Sms','Fax','Whatsapp','transaction','through','penalty','QueueId','TeamVoiceQueue','findOrCreate','User','online','voicePause','interface','UserVoiceQueueRt','upsert','format','SIP/%s','all','TeamVoicePrefix','spread','removeAgents','Mail','Openchannel','emit','getAgents','hasOwnProperty','rimraf','fast-json-patch','moment','mustache','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./team.socket','status','end','offset','limit','undefined','count','json','save','then','error','name','send','map','Team','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','nolimit','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','show','params','length','find','catch','create','body','get','role','user','Teams','UserProfileSection','userProfileId','autoAssociation','sequelize','Sequelize','QueryTypes','SELECT','UserId','VoiceQueueId','UserVoiceQueue','destroy','MailQueueId','UserMailQueue','SELECT\x20SmsQueueId\x20FROM\x20team_has_sms_queues\x20WHERE\x20TeamId\x20=\x20','SmsQueueId','UserSmsQueue','SELECT\x20ChatQueueId\x20FROM\x20team_has_chat_queues\x20WHERE\x20TeamId\x20=\x20','ChatQueueId','UserChatQueue','SELECT\x20FaxQueueId\x20FROM\x20team_has_fax_queues\x20WHERE\x20TeamId\x20=\x20','FaxQueueId','UserFaxQueue','SELECT\x20OpenchannelQueueId\x20FROM\x20team_has_openchannel_queues\x20WHERE\x20TeamId\x20=\x20'];(function(_0x18c55f,_0x327651){var _0x334690=function(_0x4510b0){while(--_0x4510b0){_0x18c55f['push'](_0x18c55f['shift']());}};_0x334690(++_0x327651);}(_0x6dac,0x15d));var _0xc6da=function(_0x495378,_0xd34709){_0x495378=_0x495378-0x0;var _0x460fbc=_0x6dac[_0x495378];return _0x460fbc;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc6da('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc6da('0x1'));var rp=require('request-promise');var moment=require(_0xc6da('0x2'));var BPromise=require('bluebird');var Mustache=require(_0xc6da('0x3'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0xc6da('0x4'));var ejs=require(_0xc6da('0x5'));var fs=require('fs');var fs_extra=require(_0xc6da('0x6'));var _=require(_0xc6da('0x7'));var squel=require(_0xc6da('0x8'));var crypto=require(_0xc6da('0x9'));var jsforce=require(_0xc6da('0xa'));var deskjs=require(_0xc6da('0xb'));var toCsv=require(_0xc6da('0x4'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xc6da('0xc'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xc6da('0xd'));var hardwareService=require(_0xc6da('0xe'));var logger=require(_0xc6da('0xf'))('api');var utils=require(_0xc6da('0x10'));var config=require(_0xc6da('0x11'));var licenseUtil=require('../../config/license/util');var db=require(_0xc6da('0x12'))['db'];config[_0xc6da('0x13')]=_[_0xc6da('0x14')](config[_0xc6da('0x13')],{'host':_0xc6da('0x15'),'port':0x18eb});var socket=require(_0xc6da('0x16'))(new Redis(config[_0xc6da('0x13')]));require(_0xc6da('0x17'))['register'](socket);function respondWithStatusCode(_0x4f1579,_0x53f9b1){_0x53f9b1=_0x53f9b1||0xcc;return function(_0x2b8bc2){if(_0x2b8bc2){return _0x4f1579['sendStatus'](_0x53f9b1);}return _0x4f1579[_0xc6da('0x18')](_0x53f9b1)[_0xc6da('0x19')]();};}function respondWithResult(_0x33e2e8,_0x3250c3){_0x3250c3=_0x3250c3||0xc8;return function(_0x481602){if(_0x481602){return _0x33e2e8['status'](_0x3250c3)['json'](_0x481602);}};}function respondWithFilteredResult(_0x1740ba,_0x3d17cc){return function(_0x698997){if(_0x698997){var _0x1c4926=typeof _0x3d17cc[_0xc6da('0x1a')]==='undefined'&&typeof _0x3d17cc[_0xc6da('0x1b')]===_0xc6da('0x1c');var _0x123398=_0x698997[_0xc6da('0x1d')];var _0x465020=_0x1c4926?0x0:_0x3d17cc[_0xc6da('0x1a')];var _0x46340d=_0x1c4926?_0x698997[_0xc6da('0x1d')]:_0x3d17cc[_0xc6da('0x1a')]+_0x3d17cc['limit'];var _0x4eab08;if(_0x46340d>=_0x123398){_0x46340d=_0x123398;_0x4eab08=0xc8;}else{_0x4eab08=0xce;}_0x1740ba[_0xc6da('0x18')](_0x4eab08);return _0x1740ba['set']('Content-Range',_0x465020+'-'+_0x46340d+'/'+_0x123398)[_0xc6da('0x1e')](_0x698997);}return null;};}function patchUpdates(_0x1710a4){return function(_0x204f94){try{jsonpatch['apply'](_0x204f94,_0x1710a4,!![]);}catch(_0x33c321){return BPromise['reject'](_0x33c321);}return _0x204f94[_0xc6da('0x1f')]();};}function saveUpdates(_0x557811,_0x38d6f0){return function(_0x15ce7b){if(_0x15ce7b){return _0x15ce7b['update'](_0x557811)[_0xc6da('0x20')](function(_0x515f80){return _0x515f80;});}return null;};}function handleEntityNotFound(_0x24de69,_0x799460){return function(_0x518c26){if(!_0x518c26){_0x24de69['sendStatus'](0x194);}return _0x518c26;};}function handleError(_0x35deb0,_0x2cbc92){_0x2cbc92=_0x2cbc92||0x1f4;return function(_0x560a97){logger[_0xc6da('0x21')](_0x560a97['stack']);if(_0x560a97[_0xc6da('0x22')]){delete _0x560a97['name'];}_0x35deb0[_0xc6da('0x18')](_0x2cbc92)[_0xc6da('0x23')](_0x560a97);};}exports['index']=function(_0x143591,_0x341b78){var _0x4d27c2={},_0x1d9f75={},_0xec2058={'count':0x0,'rows':[]};var _0x4fd772=_[_0xc6da('0x24')](db[_0xc6da('0x25')][_0xc6da('0x26')],function(_0x59b09c){return{'name':_0x59b09c[_0xc6da('0x27')],'type':_0x59b09c['type'][_0xc6da('0x28')]};});_0x1d9f75[_0xc6da('0x29')]=_[_0xc6da('0x24')](_0x4fd772,_0xc6da('0x22'));_0x1d9f75[_0xc6da('0x2a')]=_[_0xc6da('0x2b')](_0x143591[_0xc6da('0x2a')]);_0x1d9f75[_0xc6da('0x2c')]=_[_0xc6da('0x2d')](_0x1d9f75['model'],_0x1d9f75[_0xc6da('0x2a')]);_0x4d27c2[_0xc6da('0x2e')]=_[_0xc6da('0x2d')](_0x1d9f75[_0xc6da('0x29')],qs[_0xc6da('0x2f')](_0x143591[_0xc6da('0x2a')][_0xc6da('0x2f')]));_0x4d27c2[_0xc6da('0x2e')]=_0x4d27c2[_0xc6da('0x2e')]['length']?_0x4d27c2[_0xc6da('0x2e')]:_0x1d9f75[_0xc6da('0x29')];if(!_0x143591[_0xc6da('0x2a')]['hasOwnProperty'](_0xc6da('0x30'))){_0x4d27c2[_0xc6da('0x1b')]=qs[_0xc6da('0x1b')](_0x143591['query'][_0xc6da('0x1b')]);_0x4d27c2['offset']=qs[_0xc6da('0x1a')](_0x143591['query']['offset']);}_0x4d27c2['order']=qs['sort'](_0x143591[_0xc6da('0x2a')][_0xc6da('0x31')]);_0x4d27c2[_0xc6da('0x32')]=qs[_0xc6da('0x2c')](_[_0xc6da('0x33')](_0x143591['query'],_0x1d9f75[_0xc6da('0x2c')]),_0x4fd772);if(_0x143591[_0xc6da('0x2a')][_0xc6da('0x34')]){_0x4d27c2[_0xc6da('0x32')]=_[_0xc6da('0x35')](_0x4d27c2['where'],{'$or':_[_0xc6da('0x24')](_0x4fd772,function(_0x56a09c){if(_0x56a09c[_0xc6da('0x36')]!==_0xc6da('0x37')){var _0x18826c={};_0x18826c[_0x56a09c[_0xc6da('0x22')]]={'$like':'%'+_0x143591['query'][_0xc6da('0x34')]+'%'};return _0x18826c;}})});}_0x4d27c2=_[_0xc6da('0x35')]({},_0x4d27c2,_0x143591[_0xc6da('0x38')]);var _0x41adef={'where':_0x4d27c2[_0xc6da('0x32')]};return db['Team']['count'](_0x41adef)[_0xc6da('0x20')](function(_0x24b0f6){_0xec2058[_0xc6da('0x1d')]=_0x24b0f6;if(_0x143591['query'][_0xc6da('0x39')]){_0x4d27c2[_0xc6da('0x3a')]=[{'all':!![]}];}return db['Team'][_0xc6da('0x3b')](_0x4d27c2);})[_0xc6da('0x20')](function(_0xfaf7c3){_0xec2058[_0xc6da('0x3c')]=_0xfaf7c3;return _0xec2058;})[_0xc6da('0x20')](respondWithFilteredResult(_0x341b78,_0x4d27c2))['catch'](handleError(_0x341b78,null));};exports[_0xc6da('0x3d')]=function(_0x177a49,_0x4d1a79){var _0x238758={'raw':![],'where':{'id':_0x177a49[_0xc6da('0x3e')]['id']}},_0xaee1b1={};_0xaee1b1[_0xc6da('0x29')]=_[_0xc6da('0x2b')](db['Team'][_0xc6da('0x26')]);_0xaee1b1[_0xc6da('0x2a')]=_[_0xc6da('0x2b')](_0x177a49['query']);_0xaee1b1[_0xc6da('0x2c')]=_[_0xc6da('0x2d')](_0xaee1b1['model'],_0xaee1b1[_0xc6da('0x2a')]);_0x238758[_0xc6da('0x2e')]=_[_0xc6da('0x2d')](_0xaee1b1[_0xc6da('0x29')],qs['fields'](_0x177a49['query'][_0xc6da('0x2f')]));_0x238758[_0xc6da('0x2e')]=_0x238758[_0xc6da('0x2e')][_0xc6da('0x3f')]?_0x238758[_0xc6da('0x2e')]:_0xaee1b1[_0xc6da('0x29')];if(_0x177a49['query']['includeAll']){_0x238758['include']=[{'all':!![]}];}_0x238758=_[_0xc6da('0x35')]({},_0x238758,_0x177a49[_0xc6da('0x38')]);return db[_0xc6da('0x25')][_0xc6da('0x40')](_0x238758)[_0xc6da('0x20')](handleEntityNotFound(_0x4d1a79,null))[_0xc6da('0x20')](respondWithResult(_0x4d1a79,null))[_0xc6da('0x41')](handleError(_0x4d1a79,null));};exports[_0xc6da('0x42')]=function(_0x824712,_0x434295){return db[_0xc6da('0x25')]['create'](_0x824712[_0xc6da('0x43')],{})[_0xc6da('0x20')](function(_0x1864aa){var _0x3d7d08=_0x824712['user'][_0xc6da('0x44')]({'plain':!![]});if(!_0x3d7d08)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3d7d08[_0xc6da('0x45')]===_0xc6da('0x46')){var _0x65e9e1=_0x1864aa[_0xc6da('0x44')]({'plain':!![]});var _0x56be95=_0xc6da('0x47');return db[_0xc6da('0x48')][_0xc6da('0x40')]({'where':{'name':_0x56be95,'userProfileId':_0x3d7d08[_0xc6da('0x49')]},'raw':!![]})[_0xc6da('0x20')](function(_0x54ffb1){if(_0x54ffb1&&_0x54ffb1[_0xc6da('0x4a')]===0x0){return db['UserProfileResource']['create']({'name':_0x65e9e1[_0xc6da('0x22')],'resourceId':_0x65e9e1['id'],'type':_0x54ffb1[_0xc6da('0x22')],'sectionId':_0x54ffb1['id']},{})[_0xc6da('0x20')](function(){return _0x1864aa;});}else{return _0x1864aa;}})['catch'](function(_0x50773f){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x50773f);throw _0x50773f;});}return _0x1864aa;})['then'](respondWithResult(_0x434295,0xc9))[_0xc6da('0x41')](handleError(_0x434295,null));};exports['update']=function(_0x11b43c,_0x449b9a){if(_0x11b43c[_0xc6da('0x43')]['id']){delete _0x11b43c[_0xc6da('0x43')]['id'];}return db[_0xc6da('0x25')][_0xc6da('0x40')]({'where':{'id':_0x11b43c[_0xc6da('0x3e')]['id']}})['then'](handleEntityNotFound(_0x449b9a,null))['then'](saveUpdates(_0x11b43c['body'],null))[_0xc6da('0x20')](respondWithResult(_0x449b9a,null))[_0xc6da('0x41')](handleError(_0x449b9a,null));};exports['destroy']=function(_0x5d3b26,_0x4c0aec){var _0x461077=_0x5d3b26[_0xc6da('0x3e')]['id'];var _0x3b14fa=[];return db[_0xc6da('0x4b')]['transaction'](function(_0x290cd5){var _0x51bd81='SELECT\x20UserId\x20FROM\x20user_has_teams\x20WHERE\x20TeamId\x20=\x20'+_0x461077;return db[_0xc6da('0x4b')]['query'](_0x51bd81,{'type':db[_0xc6da('0x4c')][_0xc6da('0x4d')][_0xc6da('0x4e')],'raw':!![],'transaction':_0x290cd5})[_0xc6da('0x20')](function(_0x24818c){_0x3b14fa=_['map'](_0x24818c,function(_0x275350){return Number(_0x275350[_0xc6da('0x4f')]);});})[_0xc6da('0x20')](function(){var _0x1e42b3='SELECT\x20VoiceQueueId\x20FROM\x20team_has_voice_queues\x20WHERE\x20TeamId\x20=\x20'+_0x461077;return db['sequelize']['query'](_0x1e42b3,{'type':db['Sequelize'][_0xc6da('0x4d')][_0xc6da('0x4e')],'raw':!![],'transaction':_0x290cd5});})[_0xc6da('0x20')](function(_0x497b46){var _0x2823c1=_[_0xc6da('0x24')](_0x497b46,function(_0x4c296c){return Number(_0x4c296c[_0xc6da('0x50')]);});return db[_0xc6da('0x51')][_0xc6da('0x52')]({'where':{'UserId':{'$in':_0x3b14fa},'VoiceQueueId':{'$in':_0x2823c1}},'transaction':_0x290cd5});})['then'](function(){var _0x33818a='SELECT\x20MailQueueId\x20FROM\x20team_has_mail_queues\x20WHERE\x20TeamId\x20=\x20'+_0x461077;return db[_0xc6da('0x4b')][_0xc6da('0x2a')](_0x33818a,{'type':db[_0xc6da('0x4c')][_0xc6da('0x4d')][_0xc6da('0x4e')],'raw':!![],'transaction':_0x290cd5});})[_0xc6da('0x20')](function(_0xa9ca0b){var _0x24ed80=_[_0xc6da('0x24')](_0xa9ca0b,function(_0x5a4ebe){return Number(_0x5a4ebe[_0xc6da('0x53')]);});return db[_0xc6da('0x54')][_0xc6da('0x52')]({'where':{'UserId':{'$in':_0x3b14fa},'MailQueueId':{'$in':_0x24ed80}},'transaction':_0x290cd5});})[_0xc6da('0x20')](function(){var _0x11b5b8=_0xc6da('0x55')+_0x461077;return db[_0xc6da('0x4b')][_0xc6da('0x2a')](_0x11b5b8,{'type':db[_0xc6da('0x4c')][_0xc6da('0x4d')][_0xc6da('0x4e')],'raw':!![],'transaction':_0x290cd5});})[_0xc6da('0x20')](function(_0x5efebb){var _0x4d7078=_[_0xc6da('0x24')](_0x5efebb,function(_0x416d1b){return Number(_0x416d1b[_0xc6da('0x56')]);});return db[_0xc6da('0x57')][_0xc6da('0x52')]({'where':{'UserId':{'$in':_0x3b14fa},'SmsQueueId':{'$in':_0x4d7078}},'transaction':_0x290cd5});})[_0xc6da('0x20')](function(){var _0x417605=_0xc6da('0x58')+_0x461077;return db[_0xc6da('0x4b')]['query'](_0x417605,{'type':db['Sequelize'][_0xc6da('0x4d')][_0xc6da('0x4e')],'raw':!![],'transaction':_0x290cd5});})[_0xc6da('0x20')](function(_0xdde3de){var _0x3d7b1c=_[_0xc6da('0x24')](_0xdde3de,function(_0x5cc9a7){return Number(_0x5cc9a7[_0xc6da('0x59')]);});return db[_0xc6da('0x5a')][_0xc6da('0x52')]({'where':{'UserId':{'$in':_0x3b14fa},'ChatQueueId':{'$in':_0x3d7b1c}},'transaction':_0x290cd5});})['then'](function(){var _0xcb8645=_0xc6da('0x5b')+_0x461077;return db[_0xc6da('0x4b')][_0xc6da('0x2a')](_0xcb8645,{'type':db['Sequelize'][_0xc6da('0x4d')]['SELECT'],'raw':!![],'transaction':_0x290cd5});})[_0xc6da('0x20')](function(_0x22925c){var _0x23e4a3=_[_0xc6da('0x24')](_0x22925c,function(_0x37fce0){return Number(_0x37fce0[_0xc6da('0x5c')]);});return db[_0xc6da('0x5d')][_0xc6da('0x52')]({'where':{'UserId':{'$in':_0x3b14fa},'FaxQueueId':{'$in':_0x23e4a3}},'transaction':_0x290cd5});})[_0xc6da('0x20')](function(){var _0x321cc1=_0xc6da('0x5e')+_0x461077;return db[_0xc6da('0x4b')][_0xc6da('0x2a')](_0x321cc1,{'type':db[_0xc6da('0x4c')]['QueryTypes'][_0xc6da('0x4e')],'raw':!![],'transaction':_0x290cd5});})[_0xc6da('0x20')](function(_0x365bd){var _0x217a30=_[_0xc6da('0x24')](_0x365bd,function(_0x4a63ad){return Number(_0x4a63ad[_0xc6da('0x5f')]);});return db[_0xc6da('0x60')][_0xc6da('0x52')]({'where':{'UserId':{'$in':_0x3b14fa},'OpenchannelQueueId':{'$in':_0x217a30}},'transaction':_0x290cd5});})[_0xc6da('0x20')](function(){var _0x2886c6=_0xc6da('0x61')+_0x461077;return db[_0xc6da('0x4b')][_0xc6da('0x2a')](_0x2886c6,{'type':db[_0xc6da('0x4c')][_0xc6da('0x4d')][_0xc6da('0x4e')],'raw':!![],'transaction':_0x290cd5});})[_0xc6da('0x20')](function(_0x6c3305){var _0x1265d4=_[_0xc6da('0x24')](_0x6c3305,function(_0x1e7061){return Number(_0x1e7061[_0xc6da('0x62')]);});return db[_0xc6da('0x63')][_0xc6da('0x52')]({'where':{'UserId':{'$in':_0x3b14fa},'WhatsappQueueId':{'$in':_0x1265d4}},'transaction':_0x290cd5});})[_0xc6da('0x20')](function(){return db['TeamVoicePrefix'][_0xc6da('0x40')]({'where':{'TeamId':_0x461077}});})['then'](function(_0x57476a){if(_0x57476a===null){return;}return db[_0xc6da('0x64')][_0xc6da('0x52')]({'where':{'UserId':{'$in':_0x3b14fa},'VoicePrefixId':_0x57476a[_0xc6da('0x65')]},'transaction':_0x290cd5});})[_0xc6da('0x20')](function(){return db['Team'][_0xc6da('0x52')]({'where':{'id':_0x461077},'cascade':!![],'transaction':_0x290cd5});})[_0xc6da('0x20')](function(_0x1480fd){if(_0x1480fd===0x0){_0x4c0aec['sendStatus'](0x194);}else{return db['UserProfileResource'][_0xc6da('0x52')]({'where':{'type':_0xc6da('0x47'),'resourceId':_0x461077},'cascade':!![],'transaction':_0x290cd5})['then'](function(){_0x4c0aec[_0xc6da('0x18')](0xcc)['end']();});}})[_0xc6da('0x41')](function(_0x590b9f){_0x4c0aec[_0xc6da('0x18')](0x1f4)['send'](_0x590b9f);});});};exports[_0xc6da('0x66')]=function(_0x107413,_0xf84708,_0x4fe334){return db[_0xc6da('0x25')]['findOne']({'where':{'id':_0x107413[_0xc6da('0x3e')]['id']}})['then'](handleEntityNotFound(_0xf84708,null))[_0xc6da('0x20')](function(_0x2bd859){if(!_0x107413[_0xc6da('0x2a')][_0xc6da('0x67')]||!utils[_0xc6da('0x68')](_0x107413['query'][_0xc6da('0x67')])){throw new db['Sequelize'][(_0xc6da('0x69'))](_0xc6da('0x6a'));}var _0x1365b1={};var _0x7ec36f={};_0x7ec36f[_0xc6da('0x29')]=_[_0xc6da('0x2b')](db[_['capitalize'](_0x107413[_0xc6da('0x2a')][_0xc6da('0x67')][_0xc6da('0x6b')]())+_0xc6da('0x6c')][_0xc6da('0x26')]);_0x7ec36f['query']=_[_0xc6da('0x2b')](_0x107413['query']);_0x7ec36f[_0xc6da('0x2c')]=_[_0xc6da('0x2d')](_0x7ec36f[_0xc6da('0x29')],_0x7ec36f[_0xc6da('0x2a')]);_0x1365b1['attributes']=_[_0xc6da('0x2d')](_0x7ec36f[_0xc6da('0x29')],qs['fields'](_0x107413['query'][_0xc6da('0x2f')]));_0x1365b1[_0xc6da('0x2e')]=_0x1365b1['attributes'][_0xc6da('0x3f')]?_0x1365b1[_0xc6da('0x2e')]:_0x7ec36f[_0xc6da('0x29')];_0x1365b1[_0xc6da('0x1b')]=qs[_0xc6da('0x1b')](_0x107413[_0xc6da('0x2a')][_0xc6da('0x1b')]);_0x1365b1['offset']=qs[_0xc6da('0x1a')](_0x107413[_0xc6da('0x2a')][_0xc6da('0x1a')]);_0x1365b1[_0xc6da('0x6d')]=qs[_0xc6da('0x31')](_0x107413[_0xc6da('0x2a')][_0xc6da('0x31')]);_0x1365b1[_0xc6da('0x32')]=qs['filters'](_[_0xc6da('0x33')](_0x107413[_0xc6da('0x2a')],_0x7ec36f[_0xc6da('0x2c')]));_0x1365b1=_[_0xc6da('0x35')]({},_0x1365b1,_0x107413[_0xc6da('0x38')]);return _0x2bd859[_0xc6da('0x44')+_[_0xc6da('0x6e')](_0x107413[_0xc6da('0x2a')][_0xc6da('0x67')][_0xc6da('0x6b')]())+_0xc6da('0x6f')](_0x1365b1);})[_0xc6da('0x20')](respondWithResult(_0xf84708,null))[_0xc6da('0x41')](handleError(_0xf84708,null));};exports[_0xc6da('0x70')]=function(_0x3c327e,_0x61ca00,_0x1c4164){return db['Team'][_0xc6da('0x71')]({'where':{'id':_0x3c327e['params']['id']}})[_0xc6da('0x20')](function(_0x8fae86){if(_0x8fae86){if(!_0x3c327e[_0xc6da('0x43')][_0xc6da('0x67')]||!utils[_0xc6da('0x68')](_0x3c327e[_0xc6da('0x43')]['channel'])){throw new db[(_0xc6da('0x4c'))][(_0xc6da('0x69'))](_0xc6da('0x6a'));}return _0x8fae86[_0xc6da('0x72')+_[_0xc6da('0x6e')](_0x3c327e[_0xc6da('0x43')][_0xc6da('0x67')][_0xc6da('0x6b')]())+'Queues'](_0x3c327e['body'][_0xc6da('0x73')]);}return null;})[_0xc6da('0x20')](handleEntityNotFound(_0x61ca00,null))[_0xc6da('0x20')](respondWithStatusCode(_0x61ca00,null))[_0xc6da('0x41')](handleError(_0x61ca00,null));};exports[_0xc6da('0x74')]=function(_0x572586,_0x1d697f,_0x4de0de){return db[_0xc6da('0x25')][_0xc6da('0x71')]({'where':{'id':_0x572586[_0xc6da('0x3e')]['id']}})[_0xc6da('0x20')](function(_0xb87345){if(_0xb87345){if(!_0x572586[_0xc6da('0x2a')]['channel']||!utils[_0xc6da('0x68')](_0x572586[_0xc6da('0x2a')][_0xc6da('0x67')])){throw new db[(_0xc6da('0x4c'))][(_0xc6da('0x69'))](_0xc6da('0x6a'));}return _0xb87345[_0xc6da('0x75')+_[_0xc6da('0x6e')](_0x572586[_0xc6da('0x2a')]['channel']['toLowerCase']())+_0xc6da('0x6f')](_0x572586[_0xc6da('0x2a')][_0xc6da('0x73')]);}return null;})[_0xc6da('0x20')](handleEntityNotFound(_0x1d697f,null))[_0xc6da('0x20')](respondWithStatusCode(_0x1d697f,null))[_0xc6da('0x41')](handleError(_0x1d697f,null));};exports[_0xc6da('0x76')]=function(_0x5516fc,_0x4440d2){var _0x571a98=_[_0xc6da('0x77')](_0x5516fc['body'][_0xc6da('0x73')])?_0x5516fc[_0xc6da('0x43')][_0xc6da('0x73')]:[_0x5516fc[_0xc6da('0x43')][_0xc6da('0x73')]];var _0x3bb819=_0x5516fc[_0xc6da('0x3e')]['id'];return db[_0xc6da('0x25')][_0xc6da('0x40')]({'where':{'id':_0x3bb819}})[_0xc6da('0x20')](handleEntityNotFound(_0x4440d2,null))['then'](function(_0x201524){if(_0x201524){var _0x6cc3ab=[_0xc6da('0x78'),_0xc6da('0x79'),'Mail',_0xc6da('0x7a'),_0xc6da('0x7b'),'Openchannel',_0xc6da('0x7c')];return db[_0xc6da('0x4b')][_0xc6da('0x7d')](function(_0x3ffba4){var _0x2ec449=_[_0xc6da('0x24')](_0x6cc3ab,function(_0x16b8a1){var _0x2dc30a={'attributes':['id',_0xc6da('0x22')]};if(_0x16b8a1==='Voice'){_0x2dc30a[_0xc6da('0x7e')]={'attributes':[_0xc6da('0x7f')]};}return _0x201524['get'+_0x16b8a1+_0xc6da('0x6f')](_0x2dc30a)[_0xc6da('0x20')](function(_0x3f37a9){var _0x29a6cf=_[_0xc6da('0x24')](_0x3f37a9,function(_0x30e946){var _0x17c757=_[_0xc6da('0x24')](_0x571a98,function(_0x4e6fa5){var _0x1ba913={'where':{'UserId':_0x4e6fa5,[_0x16b8a1+_0xc6da('0x80')]:_0x30e946['id']},'transaction':_0x3ffba4};if(_0x16b8a1===_0xc6da('0x78')){_0x1ba913[_0xc6da('0x14')]={'penalty':_0x30e946[_0xc6da('0x81')][_0xc6da('0x7f')]};}return db['User'+_0x16b8a1+_0xc6da('0x6c')][_0xc6da('0x82')](_0x1ba913)['then'](function(){socket['emit'](_0xc6da('0x46')+_0x16b8a1+'Queue:save',{'UserId':_0x4e6fa5,[_0x16b8a1+_0xc6da('0x80')]:_0x30e946['id']});if(_0x16b8a1!=='Voice'){return;}return db[_0xc6da('0x83')]['findAll']({'where':{'id':_0x571a98,'online':0x1},'attributes':['id','name',_0xc6da('0x84'),_0xc6da('0x85'),_0xc6da('0x86')],'raw':!![]})[_0xc6da('0x20')](function(_0x369273){var _0xb4937=_[_0xc6da('0x24')](_0x369273,function(_0x3e10fd){return db[_0xc6da('0x87')][_0xc6da('0x88')]({'membername':_0x3e10fd[_0xc6da('0x22')],'UserId':_0x3e10fd['id'],'queue_name':_0x30e946[_0xc6da('0x22')],'VoiceQueueId':_0x30e946['id'],'interface':_['isNil'](_0x3e10fd[_0xc6da('0x86')])?util[_0xc6da('0x89')](_0xc6da('0x8a'),_0x3e10fd[_0xc6da('0x22')]):_0x3e10fd[_0xc6da('0x86')],'paused':_0x3e10fd[_0xc6da('0x85')]||![],'penalty':_0x30e946['TeamVoiceQueue'][_0xc6da('0x7f')]},{'transaction':_0x3ffba4});});return Promise[_0xc6da('0x8b')](_0xb4937);});});});return Promise[_0xc6da('0x8b')](_0x17c757);});return Promise[_0xc6da('0x8b')](_0x29a6cf);})[_0xc6da('0x20')](function(){return db[_0xc6da('0x8c')][_0xc6da('0x71')]({'where':{'teamId':_0x3bb819}})['then'](function(_0x486e63){if(_0x486e63){var _0x3e2645=_[_0xc6da('0x24')](_0x571a98,function(_0x332861){db[_0xc6da('0x64')][_0xc6da('0x88')]({'UserId':_0x332861,'VoicePrefixId':_0x486e63[_0xc6da('0x65')]});});return Promise[_0xc6da('0x8b')](_0x3e2645);}});});});return Promise['all'](_0x2ec449)[_0xc6da('0x20')](function(){return _0x201524['addAgents'](_0x571a98,{'transaction':_0x3ffba4})[_0xc6da('0x8d')](function(_0x56c7d8){return _0x56c7d8;});});});}})[_0xc6da('0x20')](respondWithResult(_0x4440d2,null))[_0xc6da('0x41')](handleError(_0x4440d2,null));};exports[_0xc6da('0x8e')]=function(_0x81f48f,_0x14429c){var _0x1cb1cf=_['isArray'](_0x81f48f['query'][_0xc6da('0x73')])?_0x81f48f[_0xc6da('0x2a')]['ids']:[_0x81f48f[_0xc6da('0x2a')]['ids']];var _0x49d5ee=_0x81f48f[_0xc6da('0x3e')]['id'];return db[_0xc6da('0x25')]['find']({'where':{'id':_0x49d5ee}})[_0xc6da('0x20')](handleEntityNotFound(_0x14429c,null))[_0xc6da('0x20')](function(_0x594401){if(_0x594401){var _0x3511c8=['Voice',_0xc6da('0x79'),_0xc6da('0x8f'),_0xc6da('0x7a'),_0xc6da('0x7b'),_0xc6da('0x90'),_0xc6da('0x7c')];return db[_0xc6da('0x4b')][_0xc6da('0x7d')](function(_0x1de851){var _0x57e6cf=_[_0xc6da('0x24')](_0x3511c8,function(_0x2b7026){var _0x191945={'attributes':['id',_0xc6da('0x22')]};return _0x594401['get'+_0x2b7026+_0xc6da('0x6f')](_0x191945)['then'](function(_0x4055d9){var _0x181f4f=_[_0xc6da('0x24')](_0x4055d9,function(_0x2ecc10){return _0x2ecc10[_0xc6da('0x8e')](_0x1cb1cf,{'transaction':_0x1de851})[_0xc6da('0x20')](function(){var _0x59cb80=_[_0xc6da('0x24')](_0x1cb1cf,function(_0x1435de){socket[_0xc6da('0x91')]('user'+_0x2b7026+'Queue:remove',{'UserId':Number(_0x1435de),[_0x2b7026+'QueueId']:_0x2ecc10['id']});if(_0x2b7026!==_0xc6da('0x78')){return;}return db['UserVoiceQueueRt']['destroy']({'where':{'VoiceQueueId':_0x2ecc10['id'],'UserId':_0x1435de},'transaction':_0x1de851});});return Promise[_0xc6da('0x8b')](_0x59cb80);});});return Promise[_0xc6da('0x8b')](_0x181f4f);});});return Promise[_0xc6da('0x8b')](_0x57e6cf)[_0xc6da('0x20')](function(){return _0x594401[_0xc6da('0x8e')](_0x1cb1cf,{'transaction':_0x1de851});})[_0xc6da('0x20')](function(){return db[_0xc6da('0x8c')]['findOne']({'where':{'teamId':_0x49d5ee}})[_0xc6da('0x20')](function(_0x24e54b){if(_0x24e54b){var _0x42cbc2=_[_0xc6da('0x24')](_0x1cb1cf,function(_0x44704b){db['UserVoicePrefix'][_0xc6da('0x52')]({'where':{'UserId':_0x44704b,'VoicePrefixId':_0x24e54b[_0xc6da('0x65')]}});});return Promise[_0xc6da('0x8b')](_0x42cbc2);}});});});}})[_0xc6da('0x20')](respondWithStatusCode(_0x14429c,null))[_0xc6da('0x41')](handleError(_0x14429c,null));};exports[_0xc6da('0x92')]=function(_0x1f6738,_0x1a2892,_0x1a0082){var _0x450218={};var _0x317d22={};var _0x1219d1;var _0x40aa79;return db[_0xc6da('0x25')]['findOne']({'where':{'id':_0x1f6738[_0xc6da('0x3e')]['id']}})[_0xc6da('0x20')](handleEntityNotFound(_0x1a2892,null))[_0xc6da('0x20')](function(_0x8bfe4c){if(_0x8bfe4c){_0x1219d1=_0x8bfe4c;_0x317d22[_0xc6da('0x29')]=_['keys'](db[_0xc6da('0x83')][_0xc6da('0x26')]);_0x317d22[_0xc6da('0x2a')]=_[_0xc6da('0x2b')](_0x1f6738[_0xc6da('0x2a')]);_0x317d22[_0xc6da('0x2c')]=_[_0xc6da('0x2d')](_0x317d22[_0xc6da('0x29')],_0x317d22['query']);_0x450218['attributes']=_[_0xc6da('0x2d')](_0x317d22['model'],qs[_0xc6da('0x2f')](_0x1f6738['query'][_0xc6da('0x2f')]));_0x450218[_0xc6da('0x2e')]=_0x450218[_0xc6da('0x2e')][_0xc6da('0x3f')]?_0x450218[_0xc6da('0x2e')]:_0x317d22[_0xc6da('0x29')];_0x450218[_0xc6da('0x6d')]=qs[_0xc6da('0x31')](_0x1f6738[_0xc6da('0x2a')][_0xc6da('0x31')]);_0x450218[_0xc6da('0x32')]=qs[_0xc6da('0x2c')](_[_0xc6da('0x33')](_0x1f6738[_0xc6da('0x2a')],_0x317d22[_0xc6da('0x2c')]));if(_0x1f6738['query'][_0xc6da('0x34')]){_0x450218[_0xc6da('0x32')]=_['merge'](_0x450218['where'],{'$or':_[_0xc6da('0x24')](_0x450218[_0xc6da('0x2e')],function(_0x456d8b){var _0x1e7088={};_0x1e7088[_0x456d8b]={'$like':'%'+_0x1f6738['query'][_0xc6da('0x34')]+'%'};return _0x1e7088;})});}_0x450218=_['merge']({},_0x450218,_0x1f6738['options']);return _0x1219d1[_0xc6da('0x92')](_0x450218);}})[_0xc6da('0x20')](function(_0x46d4a4){if(_0x46d4a4){_0x40aa79=_0x46d4a4[_0xc6da('0x3f')];if(!_0x1f6738[_0xc6da('0x2a')][_0xc6da('0x93')](_0xc6da('0x30'))){_0x450218[_0xc6da('0x1b')]=qs[_0xc6da('0x1b')](_0x1f6738[_0xc6da('0x2a')]['limit']);_0x450218['offset']=qs[_0xc6da('0x1a')](_0x1f6738['query'][_0xc6da('0x1a')]);}return _0x1219d1['getAgents'](_0x450218);}})[_0xc6da('0x20')](function(_0x2bccd3){if(_0x2bccd3){return _0x2bccd3?{'count':_0x40aa79,'rows':_0x2bccd3}:null;}})['then'](respondWithResult(_0x1a2892,null))[_0xc6da('0x41')](handleError(_0x1a2892,null));}; \ No newline at end of file +var _0x9de2=['request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./team.socket','register','sendStatus','status','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','error','stack','name','send','index','map','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','where','filter','merge','type','VIRTUAL','options','Team','includeAll','findAll','rows','show','params','length','include','find','catch','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','destroy','sequelize','transaction','SELECT\x20UserId\x20FROM\x20user_has_teams\x20WHERE\x20TeamId\x20=\x20','Sequelize','QueryTypes','SELECT','UserId','SELECT\x20VoiceQueueId\x20FROM\x20team_has_voice_queues\x20WHERE\x20TeamId\x20=\x20','UserVoiceQueue','MailQueueId','UserMailQueue','SELECT\x20SmsQueueId\x20FROM\x20team_has_sms_queues\x20WHERE\x20TeamId\x20=\x20','UserSmsQueue','SELECT\x20ChatQueueId\x20FROM\x20team_has_chat_queues\x20WHERE\x20TeamId\x20=\x20','UserChatQueue','FaxQueueId','UserFaxQueue','SELECT\x20OpenchannelQueueId\x20FROM\x20team_has_openchannel_queues\x20WHERE\x20TeamId\x20=\x20','OpenchannelQueueId','SELECT\x20WhatsappQueueId\x20FROM\x20team_has_whatsapp_queues\x20WHERE\x20TeamId\x20=\x20','WhatsappQueueId','TeamVoicePrefix','UserVoicePrefix','VoicePrefixId','Teams','end','getQueues','channel','isValidChannel','ValidationError','Unknown\x20channel','capitalize','toLowerCase','Queue','order','sort','Queues','addQueues','add','ids','removeQueues','findOne','remove','addAgents','isArray','Voice','Chat','Sms','Fax','Openchannel','Whatsapp','through','TeamVoiceQueue','penalty','User','findOrCreate','Queue:save','QueueId','online','voicePause','interface','isNil','format','SIP/%s','all','spread','removeAgents','Mail','emit','Queue:remove','UserVoiceQueueRt','pick','getAgents','eml-format','rimraf','fast-json-patch'];(function(_0x4b2426,_0x5a1056){var _0x171413=function(_0x5708dd){while(--_0x5708dd){_0x4b2426['push'](_0x4b2426['shift']());}};_0x171413(++_0x5a1056);}(_0x9de2,0x141));var _0x29de=function(_0x230da2,_0x4df769){_0x230da2=_0x230da2-0x0;var _0x47179d=_0x9de2[_0x230da2];return _0x47179d;};'use strict';var emlformat=require(_0x29de('0x0'));var rimraf=require(_0x29de('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x29de('0x2'));var rp=require(_0x29de('0x3'));var moment=require('moment');var BPromise=require(_0x29de('0x4'));var Mustache=require(_0x29de('0x5'));var util=require(_0x29de('0x6'));var path=require(_0x29de('0x7'));var sox=require(_0x29de('0x8'));var csv=require('to-csv');var ejs=require(_0x29de('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x29de('0xa'));var squel=require(_0x29de('0xb'));var crypto=require(_0x29de('0xc'));var jsforce=require(_0x29de('0xd'));var deskjs=require(_0x29de('0xe'));var toCsv=require(_0x29de('0xf'));var querystring=require(_0x29de('0x10'));var Papa=require(_0x29de('0x11'));var Redis=require(_0x29de('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x29de('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x29de('0x14'));var logger=require('../../config/logger')(_0x29de('0x15'));var utils=require(_0x29de('0x16'));var config=require(_0x29de('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x29de('0x18'))['db'];config[_0x29de('0x19')]=_[_0x29de('0x1a')](config[_0x29de('0x19')],{'host':_0x29de('0x1b'),'port':0x18eb});var socket=require(_0x29de('0x1c'))(new Redis(config[_0x29de('0x19')]));require(_0x29de('0x1d'))[_0x29de('0x1e')](socket);function respondWithStatusCode(_0x37357b,_0x414f7d){_0x414f7d=_0x414f7d||0xcc;return function(_0x55e3d6){if(_0x55e3d6){return _0x37357b[_0x29de('0x1f')](_0x414f7d);}return _0x37357b[_0x29de('0x20')](_0x414f7d)['end']();};}function respondWithResult(_0x1bda17,_0x588ccd){_0x588ccd=_0x588ccd||0xc8;return function(_0x2acc32){if(_0x2acc32){return _0x1bda17[_0x29de('0x20')](_0x588ccd)['json'](_0x2acc32);}};}function respondWithFilteredResult(_0xe406a6,_0x16e1ac){return function(_0x2f4304){if(_0x2f4304){var _0x2c523d=typeof _0x16e1ac[_0x29de('0x21')]===_0x29de('0x22')&&typeof _0x16e1ac[_0x29de('0x23')]==='undefined';var _0x12fb47=_0x2f4304[_0x29de('0x24')];var _0x327146=_0x2c523d?0x0:_0x16e1ac['offset'];var _0x32c294=_0x2c523d?_0x2f4304['count']:_0x16e1ac[_0x29de('0x21')]+_0x16e1ac[_0x29de('0x23')];var _0x3a0a25;if(_0x32c294>=_0x12fb47){_0x32c294=_0x12fb47;_0x3a0a25=0xc8;}else{_0x3a0a25=0xce;}_0xe406a6[_0x29de('0x20')](_0x3a0a25);return _0xe406a6[_0x29de('0x25')](_0x29de('0x26'),_0x327146+'-'+_0x32c294+'/'+_0x12fb47)['json'](_0x2f4304);}return null;};}function patchUpdates(_0x18da2d){return function(_0x4bdeb6){try{jsonpatch[_0x29de('0x27')](_0x4bdeb6,_0x18da2d,!![]);}catch(_0x2e5e1e){return BPromise[_0x29de('0x28')](_0x2e5e1e);}return _0x4bdeb6['save']();};}function saveUpdates(_0x29c212,_0x3b33a6){return function(_0x249356){if(_0x249356){return _0x249356[_0x29de('0x29')](_0x29c212)[_0x29de('0x2a')](function(_0x28f21){return _0x28f21;});}return null;};}function handleEntityNotFound(_0x24ecc2,_0x25d8eb){return function(_0x57df14){if(!_0x57df14){_0x24ecc2[_0x29de('0x1f')](0x194);}return _0x57df14;};}function handleError(_0x6cb490,_0x1cae06){_0x1cae06=_0x1cae06||0x1f4;return function(_0x8115d8){logger[_0x29de('0x2b')](_0x8115d8[_0x29de('0x2c')]);if(_0x8115d8[_0x29de('0x2d')]){delete _0x8115d8[_0x29de('0x2d')];}_0x6cb490[_0x29de('0x20')](_0x1cae06)[_0x29de('0x2e')](_0x8115d8);};}exports[_0x29de('0x2f')]=function(_0xad3b34,_0x3ed86b){var _0x5ac36a={},_0x67bbcd={},_0x216e94={'count':0x0,'rows':[]};var _0x5e1ef6=_[_0x29de('0x30')](db['Team'][_0x29de('0x31')],function(_0x312cad){return{'name':_0x312cad[_0x29de('0x32')],'type':_0x312cad['type'][_0x29de('0x33')]};});_0x67bbcd[_0x29de('0x34')]=_[_0x29de('0x30')](_0x5e1ef6,_0x29de('0x2d'));_0x67bbcd[_0x29de('0x35')]=_[_0x29de('0x36')](_0xad3b34[_0x29de('0x35')]);_0x67bbcd[_0x29de('0x37')]=_[_0x29de('0x38')](_0x67bbcd[_0x29de('0x34')],_0x67bbcd[_0x29de('0x35')]);_0x5ac36a[_0x29de('0x39')]=_[_0x29de('0x38')](_0x67bbcd[_0x29de('0x34')],qs[_0x29de('0x3a')](_0xad3b34[_0x29de('0x35')][_0x29de('0x3a')]));_0x5ac36a[_0x29de('0x39')]=_0x5ac36a[_0x29de('0x39')]['length']?_0x5ac36a[_0x29de('0x39')]:_0x67bbcd['model'];if(!_0xad3b34[_0x29de('0x35')][_0x29de('0x3b')](_0x29de('0x3c'))){_0x5ac36a['limit']=qs['limit'](_0xad3b34[_0x29de('0x35')][_0x29de('0x23')]);_0x5ac36a[_0x29de('0x21')]=qs[_0x29de('0x21')](_0xad3b34[_0x29de('0x35')][_0x29de('0x21')]);}_0x5ac36a['order']=qs['sort'](_0xad3b34[_0x29de('0x35')]['sort']);_0x5ac36a[_0x29de('0x3d')]=qs[_0x29de('0x37')](_['pick'](_0xad3b34[_0x29de('0x35')],_0x67bbcd['filters']),_0x5e1ef6);if(_0xad3b34['query'][_0x29de('0x3e')]){_0x5ac36a[_0x29de('0x3d')]=_[_0x29de('0x3f')](_0x5ac36a[_0x29de('0x3d')],{'$or':_[_0x29de('0x30')](_0x5e1ef6,function(_0x26c681){if(_0x26c681[_0x29de('0x40')]!==_0x29de('0x41')){var _0x47fea1={};_0x47fea1[_0x26c681[_0x29de('0x2d')]]={'$like':'%'+_0xad3b34[_0x29de('0x35')]['filter']+'%'};return _0x47fea1;}})});}_0x5ac36a=_[_0x29de('0x3f')]({},_0x5ac36a,_0xad3b34[_0x29de('0x42')]);var _0x2c516f={'where':_0x5ac36a[_0x29de('0x3d')]};return db[_0x29de('0x43')]['count'](_0x2c516f)['then'](function(_0x57b6bb){_0x216e94[_0x29de('0x24')]=_0x57b6bb;if(_0xad3b34[_0x29de('0x35')][_0x29de('0x44')]){_0x5ac36a['include']=[{'all':!![]}];}return db['Team'][_0x29de('0x45')](_0x5ac36a);})[_0x29de('0x2a')](function(_0x3278d7){_0x216e94[_0x29de('0x46')]=_0x3278d7;return _0x216e94;})['then'](respondWithFilteredResult(_0x3ed86b,_0x5ac36a))['catch'](handleError(_0x3ed86b,null));};exports[_0x29de('0x47')]=function(_0x3ce427,_0x3ef047){var _0x6bbdf2={'raw':![],'where':{'id':_0x3ce427[_0x29de('0x48')]['id']}},_0x2b1057={};_0x2b1057[_0x29de('0x34')]=_[_0x29de('0x36')](db[_0x29de('0x43')]['rawAttributes']);_0x2b1057['query']=_[_0x29de('0x36')](_0x3ce427[_0x29de('0x35')]);_0x2b1057[_0x29de('0x37')]=_[_0x29de('0x38')](_0x2b1057[_0x29de('0x34')],_0x2b1057[_0x29de('0x35')]);_0x6bbdf2[_0x29de('0x39')]=_['intersection'](_0x2b1057[_0x29de('0x34')],qs[_0x29de('0x3a')](_0x3ce427['query'][_0x29de('0x3a')]));_0x6bbdf2[_0x29de('0x39')]=_0x6bbdf2[_0x29de('0x39')][_0x29de('0x49')]?_0x6bbdf2['attributes']:_0x2b1057[_0x29de('0x34')];if(_0x3ce427['query']['includeAll']){_0x6bbdf2[_0x29de('0x4a')]=[{'all':!![]}];}_0x6bbdf2=_['merge']({},_0x6bbdf2,_0x3ce427[_0x29de('0x42')]);return db[_0x29de('0x43')][_0x29de('0x4b')](_0x6bbdf2)['then'](handleEntityNotFound(_0x3ef047,null))['then'](respondWithResult(_0x3ef047,null))[_0x29de('0x4c')](handleError(_0x3ef047,null));};exports[_0x29de('0x4d')]=function(_0x5f274c,_0x1e2548){return db[_0x29de('0x43')][_0x29de('0x4d')](_0x5f274c[_0x29de('0x4e')],{})[_0x29de('0x2a')](function(_0x53b242){var _0x3e4a2a=_0x5f274c[_0x29de('0x4f')][_0x29de('0x50')]({'plain':!![]});if(!_0x3e4a2a)throw new Error(_0x29de('0x51'));if(_0x3e4a2a[_0x29de('0x52')]===_0x29de('0x4f')){var _0xe252d3=_0x53b242[_0x29de('0x50')]({'plain':!![]});var _0x58ac84='Teams';return db[_0x29de('0x53')]['find']({'where':{'name':_0x58ac84,'userProfileId':_0x3e4a2a[_0x29de('0x54')]},'raw':!![]})['then'](function(_0xc7424a){if(_0xc7424a&&_0xc7424a[_0x29de('0x55')]===0x0){return db[_0x29de('0x56')]['create']({'name':_0xe252d3[_0x29de('0x2d')],'resourceId':_0xe252d3['id'],'type':_0xc7424a['name'],'sectionId':_0xc7424a['id']},{})['then'](function(){return _0x53b242;});}else{return _0x53b242;}})['catch'](function(_0x446ce8){logger[_0x29de('0x2b')](_0x29de('0x57'),_0x446ce8);throw _0x446ce8;});}return _0x53b242;})[_0x29de('0x2a')](respondWithResult(_0x1e2548,0xc9))[_0x29de('0x4c')](handleError(_0x1e2548,null));};exports[_0x29de('0x29')]=function(_0x4a7a3f,_0x1110d5){if(_0x4a7a3f[_0x29de('0x4e')]['id']){delete _0x4a7a3f[_0x29de('0x4e')]['id'];}return db['Team'][_0x29de('0x4b')]({'where':{'id':_0x4a7a3f['params']['id']}})[_0x29de('0x2a')](handleEntityNotFound(_0x1110d5,null))[_0x29de('0x2a')](saveUpdates(_0x4a7a3f[_0x29de('0x4e')],null))['then'](respondWithResult(_0x1110d5,null))[_0x29de('0x4c')](handleError(_0x1110d5,null));};exports[_0x29de('0x58')]=function(_0x1a4389,_0x26f270){var _0x257910=_0x1a4389[_0x29de('0x48')]['id'];var _0x2790d4=[];return db[_0x29de('0x59')][_0x29de('0x5a')](function(_0x34b821){var _0x4cb730=_0x29de('0x5b')+_0x257910;return db[_0x29de('0x59')][_0x29de('0x35')](_0x4cb730,{'type':db[_0x29de('0x5c')][_0x29de('0x5d')][_0x29de('0x5e')],'raw':!![],'transaction':_0x34b821})['then'](function(_0x5e9d28){_0x2790d4=_[_0x29de('0x30')](_0x5e9d28,function(_0x4ef6ab){return Number(_0x4ef6ab[_0x29de('0x5f')]);});})[_0x29de('0x2a')](function(){var _0x354eb0=_0x29de('0x60')+_0x257910;return db[_0x29de('0x59')][_0x29de('0x35')](_0x354eb0,{'type':db[_0x29de('0x5c')][_0x29de('0x5d')][_0x29de('0x5e')],'raw':!![],'transaction':_0x34b821});})['then'](function(_0x38f1bc){var _0x4520ab=_['map'](_0x38f1bc,function(_0x2c1d23){return Number(_0x2c1d23['VoiceQueueId']);});return db[_0x29de('0x61')]['destroy']({'where':{'UserId':{'$in':_0x2790d4},'VoiceQueueId':{'$in':_0x4520ab}},'transaction':_0x34b821});})[_0x29de('0x2a')](function(){var _0x59460e='SELECT\x20MailQueueId\x20FROM\x20team_has_mail_queues\x20WHERE\x20TeamId\x20=\x20'+_0x257910;return db['sequelize'][_0x29de('0x35')](_0x59460e,{'type':db[_0x29de('0x5c')][_0x29de('0x5d')][_0x29de('0x5e')],'raw':!![],'transaction':_0x34b821});})['then'](function(_0x2afd1e){var _0x1994a3=_['map'](_0x2afd1e,function(_0xdff683){return Number(_0xdff683[_0x29de('0x62')]);});return db[_0x29de('0x63')][_0x29de('0x58')]({'where':{'UserId':{'$in':_0x2790d4},'MailQueueId':{'$in':_0x1994a3}},'transaction':_0x34b821});})[_0x29de('0x2a')](function(){var _0x4eda0f=_0x29de('0x64')+_0x257910;return db[_0x29de('0x59')][_0x29de('0x35')](_0x4eda0f,{'type':db[_0x29de('0x5c')][_0x29de('0x5d')][_0x29de('0x5e')],'raw':!![],'transaction':_0x34b821});})[_0x29de('0x2a')](function(_0x4ff2b7){var _0x4360a5=_[_0x29de('0x30')](_0x4ff2b7,function(_0x11025c){return Number(_0x11025c['SmsQueueId']);});return db[_0x29de('0x65')][_0x29de('0x58')]({'where':{'UserId':{'$in':_0x2790d4},'SmsQueueId':{'$in':_0x4360a5}},'transaction':_0x34b821});})[_0x29de('0x2a')](function(){var _0x29010a=_0x29de('0x66')+_0x257910;return db[_0x29de('0x59')][_0x29de('0x35')](_0x29010a,{'type':db[_0x29de('0x5c')][_0x29de('0x5d')][_0x29de('0x5e')],'raw':!![],'transaction':_0x34b821});})[_0x29de('0x2a')](function(_0x6a93a0){var _0x363180=_[_0x29de('0x30')](_0x6a93a0,function(_0x14ff2){return Number(_0x14ff2['ChatQueueId']);});return db[_0x29de('0x67')][_0x29de('0x58')]({'where':{'UserId':{'$in':_0x2790d4},'ChatQueueId':{'$in':_0x363180}},'transaction':_0x34b821});})[_0x29de('0x2a')](function(){var _0x2afe2d='SELECT\x20FaxQueueId\x20FROM\x20team_has_fax_queues\x20WHERE\x20TeamId\x20=\x20'+_0x257910;return db[_0x29de('0x59')][_0x29de('0x35')](_0x2afe2d,{'type':db[_0x29de('0x5c')][_0x29de('0x5d')][_0x29de('0x5e')],'raw':!![],'transaction':_0x34b821});})[_0x29de('0x2a')](function(_0x53394c){var _0x5bdf5d=_[_0x29de('0x30')](_0x53394c,function(_0x14ec84){return Number(_0x14ec84[_0x29de('0x68')]);});return db[_0x29de('0x69')][_0x29de('0x58')]({'where':{'UserId':{'$in':_0x2790d4},'FaxQueueId':{'$in':_0x5bdf5d}},'transaction':_0x34b821});})[_0x29de('0x2a')](function(){var _0x2120c6=_0x29de('0x6a')+_0x257910;return db[_0x29de('0x59')][_0x29de('0x35')](_0x2120c6,{'type':db[_0x29de('0x5c')]['QueryTypes'][_0x29de('0x5e')],'raw':!![],'transaction':_0x34b821});})[_0x29de('0x2a')](function(_0x413e6c){var _0x1d622a=_[_0x29de('0x30')](_0x413e6c,function(_0x32858e){return Number(_0x32858e[_0x29de('0x6b')]);});return db['UserOpenchannelQueue'][_0x29de('0x58')]({'where':{'UserId':{'$in':_0x2790d4},'OpenchannelQueueId':{'$in':_0x1d622a}},'transaction':_0x34b821});})[_0x29de('0x2a')](function(){var _0x3c47c2=_0x29de('0x6c')+_0x257910;return db[_0x29de('0x59')][_0x29de('0x35')](_0x3c47c2,{'type':db['Sequelize']['QueryTypes']['SELECT'],'raw':!![],'transaction':_0x34b821});})['then'](function(_0x530a01){var _0x2b8e79=_[_0x29de('0x30')](_0x530a01,function(_0x527fb6){return Number(_0x527fb6[_0x29de('0x6d')]);});return db['UserWhatsappQueue'][_0x29de('0x58')]({'where':{'UserId':{'$in':_0x2790d4},'WhatsappQueueId':{'$in':_0x2b8e79}},'transaction':_0x34b821});})[_0x29de('0x2a')](function(){return db[_0x29de('0x6e')][_0x29de('0x4b')]({'where':{'TeamId':_0x257910}});})[_0x29de('0x2a')](function(_0x27b4ed){if(_0x27b4ed===null){return;}return db[_0x29de('0x6f')][_0x29de('0x58')]({'where':{'UserId':{'$in':_0x2790d4},'VoicePrefixId':_0x27b4ed[_0x29de('0x70')]},'transaction':_0x34b821});})[_0x29de('0x2a')](function(){return db['Team'][_0x29de('0x58')]({'where':{'id':_0x257910},'cascade':!![],'transaction':_0x34b821});})[_0x29de('0x2a')](function(_0x4c6fce){if(_0x4c6fce===0x0){_0x26f270['sendStatus'](0x194);}else{return db['UserProfileResource'][_0x29de('0x58')]({'where':{'type':_0x29de('0x71'),'resourceId':_0x257910},'cascade':!![],'transaction':_0x34b821})[_0x29de('0x2a')](function(){_0x26f270[_0x29de('0x20')](0xcc)[_0x29de('0x72')]();});}})[_0x29de('0x4c')](function(_0x29ec8d){_0x26f270['status'](0x1f4)[_0x29de('0x2e')](_0x29ec8d);});});};exports[_0x29de('0x73')]=function(_0x2dd0d6,_0x16e973,_0x394ac5){return db[_0x29de('0x43')]['findOne']({'where':{'id':_0x2dd0d6[_0x29de('0x48')]['id']}})[_0x29de('0x2a')](handleEntityNotFound(_0x16e973,null))['then'](function(_0xbbf762){if(!_0x2dd0d6['query'][_0x29de('0x74')]||!utils[_0x29de('0x75')](_0x2dd0d6[_0x29de('0x35')][_0x29de('0x74')])){throw new db[(_0x29de('0x5c'))][(_0x29de('0x76'))](_0x29de('0x77'));}var _0x22967b={};var _0x4024b7={};_0x4024b7[_0x29de('0x34')]=_[_0x29de('0x36')](db[_[_0x29de('0x78')](_0x2dd0d6[_0x29de('0x35')][_0x29de('0x74')][_0x29de('0x79')]())+_0x29de('0x7a')][_0x29de('0x31')]);_0x4024b7[_0x29de('0x35')]=_[_0x29de('0x36')](_0x2dd0d6[_0x29de('0x35')]);_0x4024b7['filters']=_[_0x29de('0x38')](_0x4024b7[_0x29de('0x34')],_0x4024b7['query']);_0x22967b[_0x29de('0x39')]=_[_0x29de('0x38')](_0x4024b7[_0x29de('0x34')],qs[_0x29de('0x3a')](_0x2dd0d6[_0x29de('0x35')][_0x29de('0x3a')]));_0x22967b[_0x29de('0x39')]=_0x22967b['attributes']['length']?_0x22967b['attributes']:_0x4024b7[_0x29de('0x34')];_0x22967b[_0x29de('0x23')]=qs['limit'](_0x2dd0d6[_0x29de('0x35')][_0x29de('0x23')]);_0x22967b['offset']=qs[_0x29de('0x21')](_0x2dd0d6[_0x29de('0x35')][_0x29de('0x21')]);_0x22967b[_0x29de('0x7b')]=qs['sort'](_0x2dd0d6[_0x29de('0x35')][_0x29de('0x7c')]);_0x22967b[_0x29de('0x3d')]=qs[_0x29de('0x37')](_['pick'](_0x2dd0d6[_0x29de('0x35')],_0x4024b7[_0x29de('0x37')]));_0x22967b=_[_0x29de('0x3f')]({},_0x22967b,_0x2dd0d6[_0x29de('0x42')]);return _0xbbf762[_0x29de('0x50')+_[_0x29de('0x78')](_0x2dd0d6[_0x29de('0x35')][_0x29de('0x74')][_0x29de('0x79')]())+_0x29de('0x7d')](_0x22967b);})[_0x29de('0x2a')](respondWithResult(_0x16e973,null))['catch'](handleError(_0x16e973,null));};exports[_0x29de('0x7e')]=function(_0x46c30c,_0x3be0b3,_0x17a972){return db[_0x29de('0x43')]['findOne']({'where':{'id':_0x46c30c[_0x29de('0x48')]['id']}})[_0x29de('0x2a')](function(_0xc0a1a){if(_0xc0a1a){if(!_0x46c30c[_0x29de('0x4e')]['channel']||!utils[_0x29de('0x75')](_0x46c30c[_0x29de('0x4e')][_0x29de('0x74')])){throw new db[(_0x29de('0x5c'))][(_0x29de('0x76'))](_0x29de('0x77'));}return _0xc0a1a[_0x29de('0x7f')+_['capitalize'](_0x46c30c[_0x29de('0x4e')][_0x29de('0x74')][_0x29de('0x79')]())+_0x29de('0x7d')](_0x46c30c[_0x29de('0x4e')][_0x29de('0x80')]);}return null;})[_0x29de('0x2a')](handleEntityNotFound(_0x3be0b3,null))[_0x29de('0x2a')](respondWithStatusCode(_0x3be0b3,null))[_0x29de('0x4c')](handleError(_0x3be0b3,null));};exports[_0x29de('0x81')]=function(_0x336348,_0x53b114,_0x2f4bf1){return db[_0x29de('0x43')][_0x29de('0x82')]({'where':{'id':_0x336348[_0x29de('0x48')]['id']}})[_0x29de('0x2a')](function(_0x56aed6){if(_0x56aed6){if(!_0x336348[_0x29de('0x35')][_0x29de('0x74')]||!utils[_0x29de('0x75')](_0x336348[_0x29de('0x35')][_0x29de('0x74')])){throw new db[(_0x29de('0x5c'))]['ValidationError']('Unknown\x20channel');}return _0x56aed6[_0x29de('0x83')+_[_0x29de('0x78')](_0x336348[_0x29de('0x35')]['channel'][_0x29de('0x79')]())+_0x29de('0x7d')](_0x336348[_0x29de('0x35')][_0x29de('0x80')]);}return null;})[_0x29de('0x2a')](handleEntityNotFound(_0x53b114,null))[_0x29de('0x2a')](respondWithStatusCode(_0x53b114,null))['catch'](handleError(_0x53b114,null));};exports[_0x29de('0x84')]=function(_0xea3bb,_0x2e734d){var _0x28f521=_[_0x29de('0x85')](_0xea3bb[_0x29de('0x4e')][_0x29de('0x80')])?_0xea3bb[_0x29de('0x4e')][_0x29de('0x80')]:[_0xea3bb[_0x29de('0x4e')][_0x29de('0x80')]];var _0x5412db=_0xea3bb[_0x29de('0x48')]['id'];return db['Team'][_0x29de('0x4b')]({'where':{'id':_0x5412db}})[_0x29de('0x2a')](handleEntityNotFound(_0x2e734d,null))['then'](function(_0x344ebf){if(_0x344ebf){var _0x489f81=[_0x29de('0x86'),_0x29de('0x87'),'Mail',_0x29de('0x88'),_0x29de('0x89'),_0x29de('0x8a'),_0x29de('0x8b')];return db['sequelize'][_0x29de('0x5a')](function(_0x44c5b8){var _0x17f21d=_['map'](_0x489f81,function(_0xdd41cc){var _0x4d0ba3={'attributes':['id',_0x29de('0x2d')]};if(_0xdd41cc===_0x29de('0x86')){_0x4d0ba3[_0x29de('0x8c')]={'attributes':['penalty']};}return _0x344ebf[_0x29de('0x50')+_0xdd41cc+'Queues'](_0x4d0ba3)[_0x29de('0x2a')](function(_0x4da6d2){var _0x29e93b=_[_0x29de('0x30')](_0x4da6d2,function(_0x1c3b80){var _0x1ad283=_[_0x29de('0x30')](_0x28f521,function(_0x1508ec){var _0x472d59={'where':{'UserId':_0x1508ec,[_0xdd41cc+'QueueId']:_0x1c3b80['id']},'transaction':_0x44c5b8};if(_0xdd41cc===_0x29de('0x86')){_0x472d59[_0x29de('0x1a')]={'penalty':_0x1c3b80[_0x29de('0x8d')][_0x29de('0x8e')]};}return db[_0x29de('0x8f')+_0xdd41cc+_0x29de('0x7a')][_0x29de('0x90')](_0x472d59)[_0x29de('0x2a')](function(){socket['emit'](_0x29de('0x4f')+_0xdd41cc+_0x29de('0x91'),{'UserId':_0x1508ec,[_0xdd41cc+_0x29de('0x92')]:_0x1c3b80['id']});if(_0xdd41cc!==_0x29de('0x86')){return;}return db[_0x29de('0x8f')][_0x29de('0x45')]({'where':{'id':_0x28f521,'online':0x1},'attributes':['id',_0x29de('0x2d'),_0x29de('0x93'),_0x29de('0x94'),_0x29de('0x95')],'raw':!![]})['then'](function(_0x18efa5){var _0x53ea3a=_[_0x29de('0x30')](_0x18efa5,function(_0x2b8b14){return db['UserVoiceQueueRt']['upsert']({'membername':_0x2b8b14[_0x29de('0x2d')],'UserId':_0x2b8b14['id'],'queue_name':_0x1c3b80[_0x29de('0x2d')],'VoiceQueueId':_0x1c3b80['id'],'interface':_[_0x29de('0x96')](_0x2b8b14[_0x29de('0x95')])?util[_0x29de('0x97')](_0x29de('0x98'),_0x2b8b14[_0x29de('0x2d')]):_0x2b8b14[_0x29de('0x95')],'paused':_0x2b8b14['voicePause']||![],'penalty':_0x1c3b80[_0x29de('0x8d')][_0x29de('0x8e')]},{'transaction':_0x44c5b8});});return Promise[_0x29de('0x99')](_0x53ea3a);});});});return Promise['all'](_0x1ad283);});return Promise[_0x29de('0x99')](_0x29e93b);})['then'](function(){return db[_0x29de('0x6e')][_0x29de('0x82')]({'where':{'teamId':_0x5412db}})[_0x29de('0x2a')](function(_0x1fc122){if(_0x1fc122){var _0x2bb953=_[_0x29de('0x30')](_0x28f521,function(_0x55e366){db[_0x29de('0x6f')]['upsert']({'UserId':_0x55e366,'VoicePrefixId':_0x1fc122[_0x29de('0x70')]});});return Promise[_0x29de('0x99')](_0x2bb953);}});});});return Promise[_0x29de('0x99')](_0x17f21d)['then'](function(){return _0x344ebf['addAgents'](_0x28f521,{'transaction':_0x44c5b8})[_0x29de('0x9a')](function(_0x1680c9){return _0x1680c9;});});});}})[_0x29de('0x2a')](respondWithResult(_0x2e734d,null))[_0x29de('0x4c')](handleError(_0x2e734d,null));};exports[_0x29de('0x9b')]=function(_0x5327f9,_0x3cb09c){var _0x299dd5=_['isArray'](_0x5327f9[_0x29de('0x35')][_0x29de('0x80')])?_0x5327f9[_0x29de('0x35')][_0x29de('0x80')]:[_0x5327f9['query'][_0x29de('0x80')]];var _0x11e381=_0x5327f9[_0x29de('0x48')]['id'];return db[_0x29de('0x43')]['find']({'where':{'id':_0x11e381}})[_0x29de('0x2a')](handleEntityNotFound(_0x3cb09c,null))[_0x29de('0x2a')](function(_0x1a10c0){if(_0x1a10c0){var _0x37e0e0=[_0x29de('0x86'),_0x29de('0x87'),_0x29de('0x9c'),_0x29de('0x88'),_0x29de('0x89'),'Openchannel',_0x29de('0x8b')];return db[_0x29de('0x59')][_0x29de('0x5a')](function(_0x4ada7a){var _0x317c7d=_[_0x29de('0x30')](_0x37e0e0,function(_0x37ac9f){var _0x1d6edc={'attributes':['id','name']};return _0x1a10c0[_0x29de('0x50')+_0x37ac9f+_0x29de('0x7d')](_0x1d6edc)['then'](function(_0x325309){var _0x5239dd=_[_0x29de('0x30')](_0x325309,function(_0x229873){return _0x229873[_0x29de('0x9b')](_0x299dd5,{'transaction':_0x4ada7a})[_0x29de('0x2a')](function(){var _0x301b93=_[_0x29de('0x30')](_0x299dd5,function(_0x77f6d9){socket[_0x29de('0x9d')](_0x29de('0x4f')+_0x37ac9f+_0x29de('0x9e'),{'UserId':Number(_0x77f6d9),[_0x37ac9f+_0x29de('0x92')]:_0x229873['id']});if(_0x37ac9f!==_0x29de('0x86')){return;}return db[_0x29de('0x9f')][_0x29de('0x58')]({'where':{'VoiceQueueId':_0x229873['id'],'UserId':_0x77f6d9},'transaction':_0x4ada7a});});return Promise[_0x29de('0x99')](_0x301b93);});});return Promise['all'](_0x5239dd);});});return Promise[_0x29de('0x99')](_0x317c7d)['then'](function(){return _0x1a10c0['removeAgents'](_0x299dd5,{'transaction':_0x4ada7a});})[_0x29de('0x2a')](function(){return db[_0x29de('0x6e')][_0x29de('0x82')]({'where':{'teamId':_0x11e381}})[_0x29de('0x2a')](function(_0x20e0b1){if(_0x20e0b1){var _0x442da4=_[_0x29de('0x30')](_0x299dd5,function(_0x491b42){db[_0x29de('0x6f')][_0x29de('0x58')]({'where':{'UserId':_0x491b42,'VoicePrefixId':_0x20e0b1[_0x29de('0x70')]}});});return Promise[_0x29de('0x99')](_0x442da4);}});});});}})['then'](respondWithStatusCode(_0x3cb09c,null))[_0x29de('0x4c')](handleError(_0x3cb09c,null));};exports['getAgents']=function(_0x5d959f,_0x412019,_0x44b40f){var _0x531eae={};var _0x3dd0d6={};var _0x103c4a;var _0x5db146;return db['Team'][_0x29de('0x82')]({'where':{'id':_0x5d959f[_0x29de('0x48')]['id']}})['then'](handleEntityNotFound(_0x412019,null))[_0x29de('0x2a')](function(_0x18afad){if(_0x18afad){_0x103c4a=_0x18afad;_0x3dd0d6['model']=_[_0x29de('0x36')](db[_0x29de('0x8f')][_0x29de('0x31')]);_0x3dd0d6['query']=_[_0x29de('0x36')](_0x5d959f[_0x29de('0x35')]);_0x3dd0d6[_0x29de('0x37')]=_[_0x29de('0x38')](_0x3dd0d6[_0x29de('0x34')],_0x3dd0d6[_0x29de('0x35')]);_0x531eae['attributes']=_[_0x29de('0x38')](_0x3dd0d6[_0x29de('0x34')],qs[_0x29de('0x3a')](_0x5d959f['query'][_0x29de('0x3a')]));_0x531eae[_0x29de('0x39')]=_0x531eae[_0x29de('0x39')]['length']?_0x531eae[_0x29de('0x39')]:_0x3dd0d6[_0x29de('0x34')];_0x531eae[_0x29de('0x7b')]=qs[_0x29de('0x7c')](_0x5d959f[_0x29de('0x35')][_0x29de('0x7c')]);_0x531eae[_0x29de('0x3d')]=qs[_0x29de('0x37')](_[_0x29de('0xa0')](_0x5d959f[_0x29de('0x35')],_0x3dd0d6[_0x29de('0x37')]));if(_0x5d959f['query'][_0x29de('0x3e')]){_0x531eae[_0x29de('0x3d')]=_[_0x29de('0x3f')](_0x531eae[_0x29de('0x3d')],{'$or':_[_0x29de('0x30')](_0x531eae[_0x29de('0x39')],function(_0x51ce7d){var _0xf9b695={};_0xf9b695[_0x51ce7d]={'$like':'%'+_0x5d959f[_0x29de('0x35')]['filter']+'%'};return _0xf9b695;})});}_0x531eae=_[_0x29de('0x3f')]({},_0x531eae,_0x5d959f['options']);return _0x103c4a['getAgents'](_0x531eae);}})['then'](function(_0x3c60d7){if(_0x3c60d7){_0x5db146=_0x3c60d7[_0x29de('0x49')];if(!_0x5d959f['query'][_0x29de('0x3b')]('nolimit')){_0x531eae[_0x29de('0x23')]=qs[_0x29de('0x23')](_0x5d959f[_0x29de('0x35')][_0x29de('0x23')]);_0x531eae['offset']=qs[_0x29de('0x21')](_0x5d959f[_0x29de('0x35')]['offset']);}return _0x103c4a[_0x29de('0xa1')](_0x531eae);}})[_0x29de('0x2a')](function(_0x22c124){if(_0x22c124){return _0x22c124?{'count':_0x5db146,'rows':_0x22c124}:null;}})[_0x29de('0x2a')](respondWithResult(_0x412019,null))[_0x29de('0x4c')](handleError(_0x412019,null));}; \ No newline at end of file diff --git a/server/api/team/team.events.js b/server/api/team/team.events.js index 28664d6..6e63bca 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 _0xa70f=['../../mysqldb','Team','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x5b0fad,_0x577006){var _0x54ecd9=function(_0x87be9f){while(--_0x87be9f){_0x5b0fad['push'](_0x5b0fad['shift']());}};_0x54ecd9(++_0x577006);}(_0xa70f,0x172));var _0xfa70=function(_0x12a95e,_0x2862c0){_0x12a95e=_0x12a95e-0x0;var _0x5d1986=_0xa70f[_0x12a95e];return _0x5d1986;};'use strict';var EventEmitter=require('events');var Team=require(_0xfa70('0x0'))['db'][_0xfa70('0x1')];var TeamEvents=new EventEmitter();TeamEvents[_0xfa70('0x2')](0x0);var events={'afterCreate':_0xfa70('0x3'),'afterUpdate':_0xfa70('0x4'),'afterDestroy':_0xfa70('0x5')};function emitEvent(_0x31a479){return function(_0x4e4884,_0x1d92ac,_0x51e5e6){TeamEvents[_0xfa70('0x6')](_0x31a479+':'+_0x4e4884['id'],_0x4e4884);TeamEvents[_0xfa70('0x6')](_0x31a479,_0x4e4884);_0x51e5e6(null);};}for(var e in events){if(events[_0xfa70('0x7')](e)){var event=events[e];Team[_0xfa70('0x8')](e,emitEvent(event));}}module[_0xfa70('0x9')]=TeamEvents; \ No newline at end of file +var _0x73f1=['Team','setMaxListeners','save','remove','emit','hook','exports','events','../../mysqldb'];(function(_0x1dc5a4,_0x2e364a){var _0x4abd2a=function(_0x2aba4d){while(--_0x2aba4d){_0x1dc5a4['push'](_0x1dc5a4['shift']());}};_0x4abd2a(++_0x2e364a);}(_0x73f1,0x10c));var _0x173f=function(_0x437ab9,_0x3ee599){_0x437ab9=_0x437ab9-0x0;var _0x365d84=_0x73f1[_0x437ab9];return _0x365d84;};'use strict';var EventEmitter=require(_0x173f('0x0'));var Team=require(_0x173f('0x1'))['db'][_0x173f('0x2')];var TeamEvents=new EventEmitter();TeamEvents[_0x173f('0x3')](0x0);var events={'afterCreate':_0x173f('0x4'),'afterUpdate':'update','afterDestroy':_0x173f('0x5')};function emitEvent(_0x4b0dae){return function(_0x3a0c10,_0x24e7c4,_0x5415ff){TeamEvents[_0x173f('0x6')](_0x4b0dae+':'+_0x3a0c10['id'],_0x3a0c10);TeamEvents[_0x173f('0x6')](_0x4b0dae,_0x3a0c10);_0x5415ff(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Team[_0x173f('0x7')](e,emitEvent(event));}}module[_0x173f('0x8')]=TeamEvents; \ No newline at end of file diff --git a/server/api/team/team.model.js b/server/api/team/team.model.js index 5d91257..be59969 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 _0xb408=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./team.attributes','exports','define','teams','lodash'];(function(_0x5f4087,_0x4e836f){var _0x3a9f81=function(_0x23c64e){while(--_0x23c64e){_0x5f4087['push'](_0x5f4087['shift']());}};_0x3a9f81(++_0x4e836f);}(_0xb408,0x1bf));var _0x8b40=function(_0x3428a8,_0x4859c7){_0x3428a8=_0x3428a8-0x0;var _0x538873=_0xb408[_0x3428a8];return _0x538873;};'use strict';var _=require(_0x8b40('0x0'));var util=require(_0x8b40('0x1'));var logger=require(_0x8b40('0x2'))(_0x8b40('0x3'));var moment=require(_0x8b40('0x4'));var BPromise=require(_0x8b40('0x5'));var rp=require(_0x8b40('0x6'));var fs=require('fs');var path=require(_0x8b40('0x7'));var rimraf=require(_0x8b40('0x8'));var config=require(_0x8b40('0x9'));var attributes=require(_0x8b40('0xa'));module[_0x8b40('0xb')]=function(_0x5851cd,_0x43c163){return _0x5851cd[_0x8b40('0xc')]('Team',attributes,{'tableName':_0x8b40('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf95a=['rimraf','exports','Team','teams','lodash','util','../../config/logger','api','bluebird','path'];(function(_0x45385c,_0x840419){var _0x523eb1=function(_0x557e5c){while(--_0x557e5c){_0x45385c['push'](_0x45385c['shift']());}};_0x523eb1(++_0x840419);}(_0xf95a,0x1c6));var _0xaf95=function(_0x2ec291,_0x444d66){_0x2ec291=_0x2ec291-0x0;var _0x128a82=_0xf95a[_0x2ec291];return _0x128a82;};'use strict';var _=require(_0xaf95('0x0'));var util=require(_0xaf95('0x1'));var logger=require(_0xaf95('0x2'))(_0xaf95('0x3'));var moment=require('moment');var BPromise=require(_0xaf95('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xaf95('0x5'));var rimraf=require(_0xaf95('0x6'));var config=require('../../config/environment');var attributes=require('./team.attributes');module[_0xaf95('0x7')]=function(_0x115f13,_0x4684a1){return _0x115f13['define'](_0xaf95('0x8'),attributes,{'tableName':_0xaf95('0x9'),'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 41b6277..4173042 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 _0x3148=['Team,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','socket.io-emitter','./team.socket','register','request','then','info'];(function(_0x46ca16,_0x4d9ede){var _0x54240c=function(_0x340862){while(--_0x340862){_0x46ca16['push'](_0x46ca16['shift']());}};_0x54240c(++_0x4d9ede);}(_0x3148,0x1d3));var _0x8314=function(_0x5e8ee4,_0x3ed1a6){_0x5e8ee4=_0x5e8ee4-0x0;var _0x28285b=_0x3148[_0x5e8ee4];return _0x28285b;};'use strict';var _=require(_0x8314('0x0'));var util=require(_0x8314('0x1'));var moment=require('moment');var BPromise=require(_0x8314('0x2'));var rs=require(_0x8314('0x3'));var fs=require('fs');var Redis=require(_0x8314('0x4'));var db=require(_0x8314('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x8314('0x6'))(_0x8314('0x7'));var config=require(_0x8314('0x8'));var jayson=require(_0x8314('0x9'));var client=jayson[_0x8314('0xa')][_0x8314('0xb')]({'port':0x232a});config[_0x8314('0xc')]=_['defaults'](config[_0x8314('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x8314('0xd'))(new Redis(config[_0x8314('0xc')]));require(_0x8314('0xe'))[_0x8314('0xf')](socket);function respondWithRpcPromise(_0x118966,_0x5284ac,_0x5b5459){return new BPromise(function(_0xfaf56c,_0x34b949){return client[_0x8314('0x10')](_0x118966,_0x5b5459)[_0x8314('0x11')](function(_0x5cf1cf){logger[_0x8314('0x12')](_0x8314('0x13'),_0x5284ac,'request\x20sent');logger[_0x8314('0x14')]('Team,\x20%s,\x20%s,\x20%s',_0x5284ac,'request\x20sent',JSON[_0x8314('0x15')](_0x5cf1cf));if(_0x5cf1cf[_0x8314('0x16')]){if(_0x5cf1cf[_0x8314('0x16')][_0x8314('0x17')]===0x1f4){logger['error'](_0x8314('0x13'),_0x5284ac,_0x5cf1cf[_0x8314('0x16')][_0x8314('0x18')]);return _0x34b949(_0x5cf1cf[_0x8314('0x16')][_0x8314('0x18')]);}logger[_0x8314('0x16')]('Team,\x20%s,\x20%s',_0x5284ac,_0x5cf1cf['error'][_0x8314('0x18')]);return _0xfaf56c(_0x5cf1cf[_0x8314('0x16')][_0x8314('0x18')]);}else{logger['info'](_0x8314('0x13'),_0x5284ac,_0x8314('0x19'));_0xfaf56c(_0x5cf1cf['result'][_0x8314('0x18')]);}})[_0x8314('0x1a')](function(_0x4ac7c8){logger[_0x8314('0x16')]('Team,\x20%s,\x20%s',_0x5284ac,_0x4ac7c8);_0x34b949(_0x4ac7c8);});});} \ No newline at end of file +var _0x75cc=['rpc','../../config/environment','jayson/promise','client','http','redis','localhost','./team.socket','register','request','then','Team,\x20%s,\x20%s','request\x20sent','debug','Team,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','moment','bluebird','randomstring','../../mysqldb','../../config/logger'];(function(_0xd16b08,_0x4f18ef){var _0x279475=function(_0x5dcfa2){while(--_0x5dcfa2){_0xd16b08['push'](_0xd16b08['shift']());}};_0x279475(++_0x4f18ef);}(_0x75cc,0x1ab));var _0xc75c=function(_0x4584cd,_0x42b19e){_0x4584cd=_0x4584cd-0x0;var _0x13e214=_0x75cc[_0x4584cd];return _0x13e214;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xc75c('0x0'));var BPromise=require(_0xc75c('0x1'));var rs=require(_0xc75c('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc75c('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xc75c('0x4'))(_0xc75c('0x5'));var config=require(_0xc75c('0x6'));var jayson=require(_0xc75c('0x7'));var client=jayson[_0xc75c('0x8')][_0xc75c('0x9')]({'port':0x232a});config[_0xc75c('0xa')]=_['defaults'](config[_0xc75c('0xa')],{'host':_0xc75c('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xc75c('0xa')]));require(_0xc75c('0xc'))[_0xc75c('0xd')](socket);function respondWithRpcPromise(_0x557680,_0x1d3859,_0x3c97e1){return new BPromise(function(_0xbd719c,_0x17943b){return client[_0xc75c('0xe')](_0x557680,_0x3c97e1)[_0xc75c('0xf')](function(_0x7dbad2){logger['info'](_0xc75c('0x10'),_0x1d3859,_0xc75c('0x11'));logger[_0xc75c('0x12')](_0xc75c('0x13'),_0x1d3859,_0xc75c('0x11'),JSON[_0xc75c('0x14')](_0x7dbad2));if(_0x7dbad2[_0xc75c('0x15')]){if(_0x7dbad2['error'][_0xc75c('0x16')]===0x1f4){logger[_0xc75c('0x15')](_0xc75c('0x10'),_0x1d3859,_0x7dbad2[_0xc75c('0x15')][_0xc75c('0x17')]);return _0x17943b(_0x7dbad2[_0xc75c('0x15')][_0xc75c('0x17')]);}logger[_0xc75c('0x15')](_0xc75c('0x10'),_0x1d3859,_0x7dbad2[_0xc75c('0x15')][_0xc75c('0x17')]);return _0xbd719c(_0x7dbad2[_0xc75c('0x15')][_0xc75c('0x17')]);}else{logger[_0xc75c('0x18')]('Team,\x20%s,\x20%s',_0x1d3859,'request\x20sent');_0xbd719c(_0x7dbad2[_0xc75c('0x19')][_0xc75c('0x17')]);}})[_0xc75c('0x1a')](function(_0x220fdd){logger[_0xc75c('0x15')](_0xc75c('0x10'),_0x1d3859,_0x220fdd);_0x17943b(_0x220fdd);});});} \ No newline at end of file diff --git a/server/api/team/team.socket.js b/server/api/team/team.socket.js index 923ed23..bea778b 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 _0xd3f5=['emit','removeListener','length','./team.events','save','update'];(function(_0x2c6a9c,_0x244ed9){var _0x21591f=function(_0x481acf){while(--_0x481acf){_0x2c6a9c['push'](_0x2c6a9c['shift']());}};_0x21591f(++_0x244ed9);}(_0xd3f5,0x147));var _0x5d3f=function(_0x2d7f0e,_0x3e6fbd){_0x2d7f0e=_0x2d7f0e-0x0;var _0x110b07=_0xd3f5[_0x2d7f0e];return _0x110b07;};'use strict';var TeamEvents=require(_0x5d3f('0x0'));var events=[_0x5d3f('0x1'),'remove',_0x5d3f('0x2')];function createListener(_0x175604,_0x346643){return function(_0x432ba1){_0x346643[_0x5d3f('0x3')](_0x175604,_0x432ba1);};}function removeListener(_0x3f663f,_0x413cf4){return function(){TeamEvents[_0x5d3f('0x4')](_0x3f663f,_0x413cf4);};}exports['register']=function(_0x1d7b89){for(var _0x4b7986=0x0,_0x2e0ad6=events[_0x5d3f('0x5')];_0x4b7986<_0x2e0ad6;_0x4b7986++){var _0x5791d4=events[_0x4b7986];var _0x1b18bb=createListener('team:'+_0x5791d4,_0x1d7b89);TeamEvents['on'](_0x5791d4,_0x1b18bb);}}; \ No newline at end of file +var _0x4065=['update','emit','removeListener','length'];(function(_0x1344d6,_0x2181e6){var _0xf45b24=function(_0x2d90c1){while(--_0x2d90c1){_0x1344d6['push'](_0x1344d6['shift']());}};_0xf45b24(++_0x2181e6);}(_0x4065,0xdc));var _0x5406=function(_0x4d03f2,_0x3a7fae){_0x4d03f2=_0x4d03f2-0x0;var _0x229e46=_0x4065[_0x4d03f2];return _0x229e46;};'use strict';var TeamEvents=require('./team.events');var events=['save','remove',_0x5406('0x0')];function createListener(_0x582af0,_0x43096a){return function(_0x46186c){_0x43096a[_0x5406('0x1')](_0x582af0,_0x46186c);};}function removeListener(_0x5dde3e,_0xc5c0b5){return function(){TeamEvents[_0x5406('0x2')](_0x5dde3e,_0xc5c0b5);};}exports['register']=function(_0x1d2a1c){for(var _0x3bf3db=0x0,_0x2a6577=events[_0x5406('0x3')];_0x3bf3db<_0x2a6577;_0x3bf3db++){var _0x44f868=events[_0x3bf3db];var _0x3acd44=createListener('team:'+_0x44f868,_0x1d2a1c);TeamEvents['on'](_0x44f868,_0x3acd44);}}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js b/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js index 71f6e7a..7ef00fd 100644 --- a/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js +++ b/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5d99=['exports','INTEGER'];(function(_0x1f99f5,_0x1bb5d7){var _0x5009b5=function(_0x489deb){while(--_0x489deb){_0x1f99f5['push'](_0x1f99f5['shift']());}};_0x5009b5(++_0x1bb5d7);}(_0x5d99,0x150));var _0x95d9=function(_0x5c5c52,_0x36d085){_0x5c5c52=_0x5c5c52-0x0;var _0x4229ff=_0x5d99[_0x5c5c52];return _0x4229ff;};'use strict';var Sequelize=require('sequelize');module[_0x95d9('0x0')]={'TeamId':{'type':Sequelize[_0x95d9('0x1')]},'VoicePrefixId':{'type':Sequelize[_0x95d9('0x1')]}}; \ No newline at end of file +var _0xd1da=['sequelize','exports','INTEGER'];(function(_0x187470,_0x32f90b){var _0xe9c0dc=function(_0x265fbd){while(--_0x265fbd){_0x187470['push'](_0x187470['shift']());}};_0xe9c0dc(++_0x32f90b);}(_0xd1da,0x162));var _0xad1d=function(_0xa1e2fd,_0x1c9305){_0xa1e2fd=_0xa1e2fd-0x0;var _0x218880=_0xd1da[_0xa1e2fd];return _0x218880;};'use strict';var Sequelize=require(_0xad1d('0x0'));module[_0xad1d('0x1')]={'TeamId':{'type':Sequelize[_0xad1d('0x2')]},'VoicePrefixId':{'type':Sequelize[_0xad1d('0x2')]}}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/teamVoicePrefix.model.js b/server/api/teamVoicePrefix/teamVoicePrefix.model.js index aef928a..92214a3 100644 --- a/server/api/teamVoicePrefix/teamVoicePrefix.model.js +++ b/server/api/teamVoicePrefix/teamVoicePrefix.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc04a=['exports','team_has_voice_prefixes','lodash','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','./teamVoicePrefix.attributes'];(function(_0x3635ce,_0x33a6f9){var _0x97ecd0=function(_0x123d98){while(--_0x123d98){_0x3635ce['push'](_0x3635ce['shift']());}};_0x97ecd0(++_0x33a6f9);}(_0xc04a,0x12e));var _0xac04=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc04a[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xac04('0x0'));var util=require('util');var logger=require(_0xac04('0x1'))('api');var moment=require(_0xac04('0x2'));var BPromise=require(_0xac04('0x3'));var rp=require(_0xac04('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xac04('0x5'));var config=require(_0xac04('0x6'));var attributes=require(_0xac04('0x7'));module[_0xac04('0x8')]=function(_0x5add53,_0x5c6f52){return _0x5add53['define']('TeamVoicePrefix',attributes,{'tableName':_0xac04('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x93e6=['api','bluebird','path','rimraf','../../config/environment','exports','lodash'];(function(_0x79abc4,_0x51afdd){var _0x2c8e64=function(_0x412edd){while(--_0x412edd){_0x79abc4['push'](_0x79abc4['shift']());}};_0x2c8e64(++_0x51afdd);}(_0x93e6,0x11e));var _0x693e=function(_0x3af619,_0x53662){_0x3af619=_0x3af619-0x0;var _0x5d3375=_0x93e6[_0x3af619];return _0x5d3375;};'use strict';var _=require(_0x693e('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x693e('0x1'));var moment=require('moment');var BPromise=require(_0x693e('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x693e('0x3'));var rimraf=require(_0x693e('0x4'));var config=require(_0x693e('0x5'));var attributes=require('./teamVoicePrefix.attributes');module[_0x693e('0x6')]=function(_0x388eb6,_0x2569a4){return _0x388eb6['define']('TeamVoicePrefix',attributes,{'tableName':'team_has_voice_prefixes','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/index.js b/server/api/teamVoiceQueue/index.js index 44d642d..72f5bab 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 _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x46ea49,_0x4de660){var _0x974144=function(_0x2ccf0a){while(--_0x2ccf0a){_0x46ea49['push'](_0x46ea49['shift']());}};_0x974144(++_0x4de660);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var fs_extra=require(_0x3071('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));module[_0x3071('0x7')]=router; \ No newline at end of file +var _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x458eef,_0x551783){var _0x2fb384=function(_0x28465e){while(--_0x28465e){_0x458eef['push'](_0x458eef['shift']());}};_0x2fb384(++_0x551783);}(_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/teamVoiceQueue/teamVoiceQueue.attributes.js b/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js index 8e61fdd..ab5d434 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 _0x4ea2=['INTEGER','sequelize','exports'];(function(_0x47a349,_0x4699d9){var _0x18ab75=function(_0x210796){while(--_0x210796){_0x47a349['push'](_0x47a349['shift']());}};_0x18ab75(++_0x4699d9);}(_0x4ea2,0x15a));var _0x24ea=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x4ea2[_0x2641f9];return _0x585741;};'use strict';var Sequelize=require(_0x24ea('0x0'));module[_0x24ea('0x1')]={'penalty':{'type':Sequelize[_0x24ea('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x1229=['exports','INTEGER'];(function(_0x1a4861,_0x510d80){var _0x55c004=function(_0x5c8dd0){while(--_0x5c8dd0){_0x1a4861['push'](_0x1a4861['shift']());}};_0x55c004(++_0x510d80);}(_0x1229,0xac));var _0x9122=function(_0x8c43de,_0x90ff31){_0x8c43de=_0x8c43de-0x0;var _0xa6591b=_0x1229[_0x8c43de];return _0xa6591b;};'use strict';var Sequelize=require('sequelize');module[_0x9122('0x0')]={'penalty':{'type':Sequelize[_0x9122('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 676a7c1..2333c1c 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 _0xbc82=['path','./teamVoiceQueue.attributes','team_has_voice_queues','lodash','moment'];(function(_0x19c283,_0x2825b1){var _0x50eea8=function(_0x27a49f){while(--_0x27a49f){_0x19c283['push'](_0x19c283['shift']());}};_0x50eea8(++_0x2825b1);}(_0xbc82,0x13e));var _0x2bc8=function(_0x57a310,_0x143c72){_0x57a310=_0x57a310-0x0;var _0x47598b=_0xbc82[_0x57a310];return _0x47598b;};'use strict';var _=require(_0x2bc8('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x2bc8('0x1'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x2bc8('0x2'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x2bc8('0x3'));module['exports']=function(_0x54d303,_0x3d12fc){return _0x54d303['define']('TeamVoiceQueue',attributes,{'tableName':_0x2bc8('0x4'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc5ba=['./teamVoiceQueue.attributes','exports','define','TeamVoiceQueue','team_has_voice_queues','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x5bc3b5,_0x486e69){var _0x15eac7=function(_0x48cf03){while(--_0x48cf03){_0x5bc3b5['push'](_0x5bc3b5['shift']());}};_0x15eac7(++_0x486e69);}(_0xc5ba,0xb9));var _0xac5b=function(_0xcf5436,_0x4632c3){_0xcf5436=_0xcf5436-0x0;var _0xc4f5c8=_0xc5ba[_0xcf5436];return _0xc4f5c8;};'use strict';var _=require(_0xac5b('0x0'));var util=require(_0xac5b('0x1'));var logger=require(_0xac5b('0x2'))(_0xac5b('0x3'));var moment=require(_0xac5b('0x4'));var BPromise=require(_0xac5b('0x5'));var rp=require(_0xac5b('0x6'));var fs=require('fs');var path=require(_0xac5b('0x7'));var rimraf=require(_0xac5b('0x8'));var config=require(_0xac5b('0x9'));var attributes=require(_0xac5b('0xa'));module[_0xac5b('0xb')]=function(_0x23cf2f,_0x17fcf3){return _0x23cf2f[_0xac5b('0xc')](_0xac5b('0xd'),attributes,{'tableName':_0xac5b('0xe'),'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 c9f0172..1e76ef6 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 _0xa273=['request\x20sent','debug','stringify','error','code','message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','then','TeamVoiceQueue,\x20%s,\x20%s'];(function(_0x57dfbc,_0x282179){var _0x227083=function(_0x58c218){while(--_0x58c218){_0x57dfbc['push'](_0x57dfbc['shift']());}};_0x227083(++_0x282179);}(_0xa273,0x1d5));var _0x3a27=function(_0x3cc8a6,_0x37b0d8){_0x3cc8a6=_0x3cc8a6-0x0;var _0x13389=_0xa273[_0x3cc8a6];return _0x13389;};'use strict';var _=require(_0x3a27('0x0'));var util=require(_0x3a27('0x1'));var moment=require(_0x3a27('0x2'));var BPromise=require(_0x3a27('0x3'));var rs=require(_0x3a27('0x4'));var fs=require('fs');var Redis=require(_0x3a27('0x5'));var db=require(_0x3a27('0x6'))['db'];var utils=require(_0x3a27('0x7'));var logger=require(_0x3a27('0x8'))(_0x3a27('0x9'));var config=require('../../config/environment');var jayson=require(_0x3a27('0xa'));var client=jayson[_0x3a27('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x43aa5b,_0x6240d4,_0x3c1afb){return new BPromise(function(_0x486981,_0x45b3c8){return client['request'](_0x43aa5b,_0x3c1afb)[_0x3a27('0xc')](function(_0x237f38){logger['info'](_0x3a27('0xd'),_0x6240d4,_0x3a27('0xe'));logger[_0x3a27('0xf')]('TeamVoiceQueue,\x20%s,\x20%s,\x20%s',_0x6240d4,_0x3a27('0xe'),JSON[_0x3a27('0x10')](_0x237f38));if(_0x237f38[_0x3a27('0x11')]){if(_0x237f38[_0x3a27('0x11')][_0x3a27('0x12')]===0x1f4){logger[_0x3a27('0x11')](_0x3a27('0xd'),_0x6240d4,_0x237f38[_0x3a27('0x11')]['message']);return _0x45b3c8(_0x237f38[_0x3a27('0x11')][_0x3a27('0x13')]);}logger['error'](_0x3a27('0xd'),_0x6240d4,_0x237f38[_0x3a27('0x11')][_0x3a27('0x13')]);return _0x486981(_0x237f38['error'][_0x3a27('0x13')]);}else{logger[_0x3a27('0x14')](_0x3a27('0xd'),_0x6240d4,'request\x20sent');_0x486981(_0x237f38[_0x3a27('0x15')][_0x3a27('0x13')]);}})[_0x3a27('0x16')](function(_0x421161){logger[_0x3a27('0x11')](_0x3a27('0xd'),_0x6240d4,_0x421161);_0x45b3c8(_0x421161);});});} \ No newline at end of file +var _0xb93f=['catch','lodash','util','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','http','then','TeamVoiceQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result'];(function(_0x1d89d0,_0x3f82f2){var _0x559209=function(_0x5ec2f7){while(--_0x5ec2f7){_0x1d89d0['push'](_0x1d89d0['shift']());}};_0x559209(++_0x3f82f2);}(_0xb93f,0x67));var _0xfb93=function(_0x39bc44,_0x1d4373){_0x39bc44=_0x39bc44-0x0;var _0x2916d8=_0xb93f[_0x39bc44];return _0x2916d8;};'use strict';var _=require(_0xfb93('0x0'));var util=require(_0xfb93('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xfb93('0x2'));var db=require(_0xfb93('0x3'))['db'];var utils=require(_0xfb93('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0xfb93('0x5'));var jayson=require(_0xfb93('0x6'));var client=jayson['client'][_0xfb93('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x5118b2,_0x3602d5,_0xd06816){return new BPromise(function(_0x3c23dc,_0x31d7e4){return client['request'](_0x5118b2,_0xd06816)[_0xfb93('0x8')](function(_0x220a4d){logger['info'](_0xfb93('0x9'),_0x3602d5,_0xfb93('0xa'));logger[_0xfb93('0xb')]('TeamVoiceQueue,\x20%s,\x20%s,\x20%s',_0x3602d5,_0xfb93('0xa'),JSON[_0xfb93('0xc')](_0x220a4d));if(_0x220a4d[_0xfb93('0xd')]){if(_0x220a4d[_0xfb93('0xd')]['code']===0x1f4){logger[_0xfb93('0xd')](_0xfb93('0x9'),_0x3602d5,_0x220a4d[_0xfb93('0xd')][_0xfb93('0xe')]);return _0x31d7e4(_0x220a4d[_0xfb93('0xd')][_0xfb93('0xe')]);}logger[_0xfb93('0xd')]('TeamVoiceQueue,\x20%s,\x20%s',_0x3602d5,_0x220a4d['error']['message']);return _0x3c23dc(_0x220a4d[_0xfb93('0xd')][_0xfb93('0xe')]);}else{logger['info'](_0xfb93('0x9'),_0x3602d5,'request\x20sent');_0x3c23dc(_0x220a4d[_0xfb93('0xf')][_0xfb93('0xe')]);}})[_0xfb93('0x10')](function(_0x4b28a7){logger['error'](_0xfb93('0x9'),_0x3602d5,_0x4b28a7);_0x31d7e4(_0x4b28a7);});});} \ No newline at end of file diff --git a/server/api/template/index.js b/server/api/template/index.js index 2b7c002..52b3bc6 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 _0x7fea=['get','isAuthenticated','index','/:id','show','post','put','update','exports','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x32faf2,_0x324d23){var _0x375f84=function(_0x4e39b4){while(--_0x4e39b4){_0x32faf2['push'](_0x32faf2['shift']());}};_0x375f84(++_0x324d23);}(_0x7fea,0x149));var _0xa7fe=function(_0xd285b8,_0x41d317){_0xd285b8=_0xd285b8-0x0;var _0x5bace5=_0x7fea[_0xd285b8];return _0x5bace5;};'use strict';var multer=require('multer');var util=require(_0xa7fe('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xa7fe('0x1'));var router=express[_0xa7fe('0x2')]();var fs_extra=require(_0xa7fe('0x3'));var auth=require(_0xa7fe('0x4'));var interaction=require(_0xa7fe('0x5'));var config=require(_0xa7fe('0x6'));var controller=require('./template.controller');router[_0xa7fe('0x7')]('/',auth[_0xa7fe('0x8')](),controller[_0xa7fe('0x9')]);router[_0xa7fe('0x7')](_0xa7fe('0xa'),auth[_0xa7fe('0x8')](),controller[_0xa7fe('0xb')]);router[_0xa7fe('0xc')]('/',auth['isAuthenticated'](),controller['create']);router[_0xa7fe('0xd')](_0xa7fe('0xa'),auth[_0xa7fe('0x8')](),controller[_0xa7fe('0xe')]);router['delete'](_0xa7fe('0xa'),auth[_0xa7fe('0x8')](),controller['destroy']);module[_0xa7fe('0xf')]=router; \ No newline at end of file +var _0xf4ce=['create','update','delete','exports','multer','connect-timeout','express','Router','fs-extra','isAuthenticated','index','get','/:id','show'];(function(_0x4f82e0,_0x555487){var _0x3b8c7e=function(_0x1653bb){while(--_0x1653bb){_0x4f82e0['push'](_0x4f82e0['shift']());}};_0x3b8c7e(++_0x555487);}(_0xf4ce,0xf2));var _0xef4c=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xf4ce[_0x501510];return _0x1e6ee5;};'use strict';var multer=require(_0xef4c('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xef4c('0x1'));var express=require(_0xef4c('0x2'));var router=express[_0xef4c('0x3')]();var fs_extra=require(_0xef4c('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./template.controller');router['get']('/',auth[_0xef4c('0x5')](),controller[_0xef4c('0x6')]);router[_0xef4c('0x7')](_0xef4c('0x8'),auth[_0xef4c('0x5')](),controller[_0xef4c('0x9')]);router['post']('/',auth[_0xef4c('0x5')](),controller[_0xef4c('0xa')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0xef4c('0xb')]);router[_0xef4c('0xc')](_0xef4c('0x8'),auth[_0xef4c('0x5')](),controller['destroy']);module[_0xef4c('0xd')]=router; \ No newline at end of file diff --git a/server/api/template/template.attributes.js b/server/api/template/template.attributes.js index a76c41e..83506db 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 _0xf696=['exports','STRING'];(function(_0x1d1779,_0x284147){var _0x2377e9=function(_0x299f6f){while(--_0x299f6f){_0x1d1779['push'](_0x1d1779['shift']());}};_0x2377e9(++_0x284147);}(_0xf696,0xb6));var _0x6f69=function(_0x1c629c,_0x3c151b){_0x1c629c=_0x1c629c-0x0;var _0x468853=_0xf696[_0x1c629c];return _0x468853;};'use strict';var Sequelize=require('sequelize');module[_0x6f69('0x0')]={'name':{'type':Sequelize[_0x6f69('0x1')]},'description':{'type':Sequelize[_0x6f69('0x1')]},'html':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0xb56e=['TEXT','sequelize','exports'];(function(_0x5f3f88,_0x562baf){var _0xd08119=function(_0x42dbf7){while(--_0x42dbf7){_0x5f3f88['push'](_0x5f3f88['shift']());}};_0xd08119(++_0x562baf);}(_0xb56e,0x16c));var _0xeb56=function(_0xa4b77a,_0x657ffa){_0xa4b77a=_0xa4b77a-0x0;var _0x1fa39e=_0xb56e[_0xa4b77a];return _0x1fa39e;};'use strict';var Sequelize=require(_0xeb56('0x0'));module[_0xeb56('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'html':{'type':Sequelize[_0xeb56('0x2')]}}; \ No newline at end of file diff --git a/server/api/template/template.controller.js b/server/api/template/template.controller.js index eebe029..b8913c5 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 _0xb124=['includeAll','include','findAll','rows','show','keys','rawAttributes','merge','find','catch','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Templates','UserProfileSection','autoAssociation','update','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','undefined','count','status','set','Content-Range','apply','destroy','then','UserProfileResource','error','stack','name','send','fieldName','key','map','query','intersection','attributes','model','fields','limit','where','filters','pick','filter','type','options','Template'];(function(_0x372434,_0x346fa){var _0x1e6a4b=function(_0x4b8a54){while(--_0x4b8a54){_0x372434['push'](_0x372434['shift']());}};_0x1e6a4b(++_0x346fa);}(_0xb124,0x149));var _0x4b12=function(_0x47e7cb,_0x4c1b8d){_0x47e7cb=_0x47e7cb-0x0;var _0x2a8874=_0xb124[_0x47e7cb];return _0x2a8874;};'use strict';var emlformat=require(_0x4b12('0x0'));var rimraf=require(_0x4b12('0x1'));var zipdir=require(_0x4b12('0x2'));var jsonpatch=require(_0x4b12('0x3'));var rp=require(_0x4b12('0x4'));var moment=require(_0x4b12('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x4b12('0x6'));var util=require(_0x4b12('0x7'));var path=require(_0x4b12('0x8'));var sox=require('sox');var csv=require(_0x4b12('0x9'));var ejs=require(_0x4b12('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4b12('0xb'));var squel=require(_0x4b12('0xc'));var crypto=require('crypto');var jsforce=require(_0x4b12('0xd'));var deskjs=require(_0x4b12('0xe'));var toCsv=require(_0x4b12('0x9'));var querystring=require(_0x4b12('0xf'));var Papa=require(_0x4b12('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x4b12('0x11'));var hardwareService=require(_0x4b12('0x12'));var logger=require(_0x4b12('0x13'))('api');var utils=require(_0x4b12('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x4b12('0x15'));var db=require(_0x4b12('0x16'))['db'];function respondWithStatusCode(_0x5da74c,_0x25aab3){_0x25aab3=_0x25aab3||0xcc;return function(_0x2455e8){if(_0x2455e8){return _0x5da74c[_0x4b12('0x17')](_0x25aab3);}return _0x5da74c['status'](_0x25aab3)[_0x4b12('0x18')]();};}function respondWithResult(_0x5d35c2,_0x417c95){_0x417c95=_0x417c95||0xc8;return function(_0x4c1538){if(_0x4c1538){return _0x5d35c2['status'](_0x417c95)[_0x4b12('0x19')](_0x4c1538);}};}function respondWithFilteredResult(_0x333745,_0x1b0fba){return function(_0x8e128c){if(_0x8e128c){var _0x4992d1=typeof _0x1b0fba[_0x4b12('0x1a')]==='undefined'&&typeof _0x1b0fba['limit']===_0x4b12('0x1b');var _0x2c648d=_0x8e128c[_0x4b12('0x1c')];var _0x231c9b=_0x4992d1?0x0:_0x1b0fba[_0x4b12('0x1a')];var _0x3a6568=_0x4992d1?_0x8e128c[_0x4b12('0x1c')]:_0x1b0fba['offset']+_0x1b0fba['limit'];var _0x52fedf;if(_0x3a6568>=_0x2c648d){_0x3a6568=_0x2c648d;_0x52fedf=0xc8;}else{_0x52fedf=0xce;}_0x333745[_0x4b12('0x1d')](_0x52fedf);return _0x333745[_0x4b12('0x1e')](_0x4b12('0x1f'),_0x231c9b+'-'+_0x3a6568+'/'+_0x2c648d)[_0x4b12('0x19')](_0x8e128c);}return null;};}function patchUpdates(_0x5a4db7){return function(_0x44865d){try{jsonpatch[_0x4b12('0x20')](_0x44865d,_0x5a4db7,!![]);}catch(_0x1b3da7){return BPromise['reject'](_0x1b3da7);}return _0x44865d['save']();};}function saveUpdates(_0x4b2e68,_0x91df0b){return function(_0x3be715){if(_0x3be715){return _0x3be715['update'](_0x4b2e68)['then'](function(_0x263125){return _0x263125;});}return null;};}function removeEntity(_0x429157,_0x350906){return function(_0x1ec970){if(_0x1ec970){return _0x1ec970[_0x4b12('0x21')]()[_0x4b12('0x22')](function(){var _0x368a8b=_0x1ec970['get']({'plain':!![]});var _0x425a20='Templates';return db[_0x4b12('0x23')]['destroy']({'where':{'type':_0x425a20,'resourceId':_0x368a8b['id']}})['then'](function(){return _0x1ec970;});})[_0x4b12('0x22')](function(){_0x429157[_0x4b12('0x1d')](0xcc)[_0x4b12('0x18')]();});}};}function handleEntityNotFound(_0x10d618,_0xea7a9e){return function(_0x3b8203){if(!_0x3b8203){_0x10d618[_0x4b12('0x17')](0x194);}return _0x3b8203;};}function handleError(_0x35ea93,_0x337ca5){_0x337ca5=_0x337ca5||0x1f4;return function(_0x53abee){logger[_0x4b12('0x24')](_0x53abee[_0x4b12('0x25')]);if(_0x53abee[_0x4b12('0x26')]){delete _0x53abee[_0x4b12('0x26')];}_0x35ea93[_0x4b12('0x1d')](_0x337ca5)[_0x4b12('0x27')](_0x53abee);};}exports['index']=function(_0x4083e2,_0x179f40){var _0x15c846={},_0x12956e={},_0x1cc623={'count':0x0,'rows':[]};var _0x459bd=_['map'](db['Template']['rawAttributes'],function(_0x5ca287){return{'name':_0x5ca287[_0x4b12('0x28')],'type':_0x5ca287['type'][_0x4b12('0x29')]};});_0x12956e['model']=_[_0x4b12('0x2a')](_0x459bd,'name');_0x12956e['query']=_['keys'](_0x4083e2[_0x4b12('0x2b')]);_0x12956e['filters']=_[_0x4b12('0x2c')](_0x12956e['model'],_0x12956e[_0x4b12('0x2b')]);_0x15c846[_0x4b12('0x2d')]=_[_0x4b12('0x2c')](_0x12956e[_0x4b12('0x2e')],qs['fields'](_0x4083e2[_0x4b12('0x2b')][_0x4b12('0x2f')]));_0x15c846[_0x4b12('0x2d')]=_0x15c846[_0x4b12('0x2d')]['length']?_0x15c846[_0x4b12('0x2d')]:_0x12956e[_0x4b12('0x2e')];if(!_0x4083e2['query']['hasOwnProperty']('nolimit')){_0x15c846['limit']=qs[_0x4b12('0x30')](_0x4083e2[_0x4b12('0x2b')][_0x4b12('0x30')]);_0x15c846[_0x4b12('0x1a')]=qs[_0x4b12('0x1a')](_0x4083e2['query'][_0x4b12('0x1a')]);}_0x15c846['order']=qs['sort'](_0x4083e2[_0x4b12('0x2b')]['sort']);_0x15c846[_0x4b12('0x31')]=qs[_0x4b12('0x32')](_[_0x4b12('0x33')](_0x4083e2[_0x4b12('0x2b')],_0x12956e[_0x4b12('0x32')]),_0x459bd);if(_0x4083e2[_0x4b12('0x2b')][_0x4b12('0x34')]){_0x15c846[_0x4b12('0x31')]=_['merge'](_0x15c846['where'],{'$or':_[_0x4b12('0x2a')](_0x459bd,function(_0xc6cf44){if(_0xc6cf44[_0x4b12('0x35')]!=='VIRTUAL'){var _0x16cac5={};_0x16cac5[_0xc6cf44[_0x4b12('0x26')]]={'$like':'%'+_0x4083e2[_0x4b12('0x2b')][_0x4b12('0x34')]+'%'};return _0x16cac5;}})});}_0x15c846=_['merge']({},_0x15c846,_0x4083e2[_0x4b12('0x36')]);var _0x1f5817={'where':_0x15c846[_0x4b12('0x31')]};return db[_0x4b12('0x37')][_0x4b12('0x1c')](_0x1f5817)[_0x4b12('0x22')](function(_0x203a11){_0x1cc623[_0x4b12('0x1c')]=_0x203a11;if(_0x4083e2[_0x4b12('0x2b')][_0x4b12('0x38')]){_0x15c846[_0x4b12('0x39')]=[{'all':!![]}];}return db[_0x4b12('0x37')][_0x4b12('0x3a')](_0x15c846);})[_0x4b12('0x22')](function(_0x1ee11b){_0x1cc623[_0x4b12('0x3b')]=_0x1ee11b;return _0x1cc623;})[_0x4b12('0x22')](respondWithFilteredResult(_0x179f40,_0x15c846))['catch'](handleError(_0x179f40,null));};exports[_0x4b12('0x3c')]=function(_0x1cd46e,_0x16855a){var _0x40f5c1={'raw':!![],'where':{'id':_0x1cd46e['params']['id']}},_0x3f03fa={};_0x3f03fa[_0x4b12('0x2e')]=_[_0x4b12('0x3d')](db[_0x4b12('0x37')][_0x4b12('0x3e')]);_0x3f03fa[_0x4b12('0x2b')]=_[_0x4b12('0x3d')](_0x1cd46e[_0x4b12('0x2b')]);_0x3f03fa[_0x4b12('0x32')]=_['intersection'](_0x3f03fa[_0x4b12('0x2e')],_0x3f03fa['query']);_0x40f5c1[_0x4b12('0x2d')]=_['intersection'](_0x3f03fa[_0x4b12('0x2e')],qs[_0x4b12('0x2f')](_0x1cd46e[_0x4b12('0x2b')]['fields']));_0x40f5c1[_0x4b12('0x2d')]=_0x40f5c1[_0x4b12('0x2d')]['length']?_0x40f5c1['attributes']:_0x3f03fa[_0x4b12('0x2e')];if(_0x1cd46e[_0x4b12('0x2b')][_0x4b12('0x38')]){_0x40f5c1[_0x4b12('0x39')]=[{'all':!![]}];}_0x40f5c1=_[_0x4b12('0x3f')]({},_0x40f5c1,_0x1cd46e[_0x4b12('0x36')]);return db[_0x4b12('0x37')][_0x4b12('0x40')](_0x40f5c1)[_0x4b12('0x22')](handleEntityNotFound(_0x16855a,null))[_0x4b12('0x22')](respondWithResult(_0x16855a,null))[_0x4b12('0x41')](handleError(_0x16855a,null));};exports['create']=function(_0x36b6b9,_0x24efa7){return db[_0x4b12('0x37')][_0x4b12('0x42')](_0x36b6b9[_0x4b12('0x43')],{})['then'](function(_0x8086d0){var _0x23cbdf=_0x36b6b9[_0x4b12('0x44')][_0x4b12('0x45')]({'plain':!![]});if(!_0x23cbdf)throw new Error(_0x4b12('0x46'));if(_0x23cbdf[_0x4b12('0x47')]===_0x4b12('0x44')){var _0x5a2dfa=_0x8086d0[_0x4b12('0x45')]({'plain':!![]});var _0x159223=_0x4b12('0x48');return db[_0x4b12('0x49')][_0x4b12('0x40')]({'where':{'name':_0x159223,'userProfileId':_0x23cbdf['userProfileId']},'raw':!![]})[_0x4b12('0x22')](function(_0x170ed5){if(_0x170ed5&&_0x170ed5[_0x4b12('0x4a')]===0x0){return db[_0x4b12('0x23')]['create']({'name':_0x5a2dfa[_0x4b12('0x26')],'resourceId':_0x5a2dfa['id'],'type':_0x170ed5[_0x4b12('0x26')],'sectionId':_0x170ed5['id']},{})['then'](function(){return _0x8086d0;});}else{return _0x8086d0;}})[_0x4b12('0x41')](function(_0x29881d){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x29881d);throw _0x29881d;});}return _0x8086d0;})[_0x4b12('0x22')](respondWithResult(_0x24efa7,0xc9))[_0x4b12('0x41')](handleError(_0x24efa7,null));};exports[_0x4b12('0x4b')]=function(_0x5bc67c,_0x3c2ef9){if(_0x5bc67c[_0x4b12('0x43')]['id']){delete _0x5bc67c[_0x4b12('0x43')]['id'];}return db[_0x4b12('0x37')]['find']({'where':{'id':_0x5bc67c[_0x4b12('0x4c')]['id']}})[_0x4b12('0x22')](handleEntityNotFound(_0x3c2ef9,null))[_0x4b12('0x22')](saveUpdates(_0x5bc67c[_0x4b12('0x43')],null))[_0x4b12('0x22')](respondWithResult(_0x3c2ef9,null))[_0x4b12('0x41')](handleError(_0x3c2ef9,null));};exports[_0x4b12('0x21')]=function(_0x12a077,_0x2adb8c){return db[_0x4b12('0x37')][_0x4b12('0x40')]({'where':{'id':_0x12a077['params']['id']}})[_0x4b12('0x22')](handleEntityNotFound(_0x2adb8c,null))[_0x4b12('0x22')](removeEntity(_0x2adb8c,null))[_0x4b12('0x41')](handleError(_0x2adb8c,null));}; \ No newline at end of file +var _0x9289=['create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','eml-format','rimraf','zip-dir','fast-json-patch','moment','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','limit','count','offset','set','Content-Range','save','update','then','destroy','get','Templates','error','stack','name','send','index','map','Template','rawAttributes','fieldName','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','findAll','rows','catch','show','params','options','find'];(function(_0x38023e,_0x473a72){var _0x475351=function(_0x900c7f){while(--_0x900c7f){_0x38023e['push'](_0x38023e['shift']());}};_0x475351(++_0x473a72);}(_0x9289,0xb9));var _0x9928=function(_0x2220e8,_0xda4f58){_0x2220e8=_0x2220e8-0x0;var _0x237bee=_0x9289[_0x2220e8];return _0x237bee;};'use strict';var emlformat=require(_0x9928('0x0'));var rimraf=require(_0x9928('0x1'));var zipdir=require(_0x9928('0x2'));var jsonpatch=require(_0x9928('0x3'));var rp=require('request-promise');var moment=require(_0x9928('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x9928('0x5'));var path=require(_0x9928('0x6'));var sox=require(_0x9928('0x7'));var csv=require(_0x9928('0x8'));var ejs=require(_0x9928('0x9'));var fs=require('fs');var fs_extra=require(_0x9928('0xa'));var _=require(_0x9928('0xb'));var squel=require(_0x9928('0xc'));var crypto=require(_0x9928('0xd'));var jsforce=require(_0x9928('0xe'));var deskjs=require(_0x9928('0xf'));var toCsv=require('to-csv');var querystring=require(_0x9928('0x10'));var Papa=require(_0x9928('0x11'));var Redis=require(_0x9928('0x12'));var authService=require(_0x9928('0x13'));var qs=require(_0x9928('0x14'));var as=require(_0x9928('0x15'));var hardwareService=require(_0x9928('0x16'));var logger=require(_0x9928('0x17'))(_0x9928('0x18'));var utils=require('../../config/utils');var config=require(_0x9928('0x19'));var licenseUtil=require(_0x9928('0x1a'));var db=require(_0x9928('0x1b'))['db'];function respondWithStatusCode(_0x31b6cf,_0x309814){_0x309814=_0x309814||0xcc;return function(_0x1c8f4d){if(_0x1c8f4d){return _0x31b6cf[_0x9928('0x1c')](_0x309814);}return _0x31b6cf['status'](_0x309814)[_0x9928('0x1d')]();};}function respondWithResult(_0x5c01f3,_0x2ffb3b){_0x2ffb3b=_0x2ffb3b||0xc8;return function(_0x2a1906){if(_0x2a1906){return _0x5c01f3[_0x9928('0x1e')](_0x2ffb3b)[_0x9928('0x1f')](_0x2a1906);}};}function respondWithFilteredResult(_0x26cff0,_0x1081c9){return function(_0x5ba07f){if(_0x5ba07f){var _0x9c91c7=typeof _0x1081c9['offset']===_0x9928('0x20')&&typeof _0x1081c9[_0x9928('0x21')]==='undefined';var _0x196711=_0x5ba07f[_0x9928('0x22')];var _0x5157e1=_0x9c91c7?0x0:_0x1081c9[_0x9928('0x23')];var _0x5c0e6f=_0x9c91c7?_0x5ba07f[_0x9928('0x22')]:_0x1081c9['offset']+_0x1081c9['limit'];var _0x49df59;if(_0x5c0e6f>=_0x196711){_0x5c0e6f=_0x196711;_0x49df59=0xc8;}else{_0x49df59=0xce;}_0x26cff0[_0x9928('0x1e')](_0x49df59);return _0x26cff0[_0x9928('0x24')](_0x9928('0x25'),_0x5157e1+'-'+_0x5c0e6f+'/'+_0x196711)[_0x9928('0x1f')](_0x5ba07f);}return null;};}function patchUpdates(_0xc4f68b){return function(_0x4f1ac9){try{jsonpatch['apply'](_0x4f1ac9,_0xc4f68b,!![]);}catch(_0x4502f3){return BPromise['reject'](_0x4502f3);}return _0x4f1ac9[_0x9928('0x26')]();};}function saveUpdates(_0x6ec6e,_0x3db825){return function(_0x3acb53){if(_0x3acb53){return _0x3acb53[_0x9928('0x27')](_0x6ec6e)[_0x9928('0x28')](function(_0x1419bb){return _0x1419bb;});}return null;};}function removeEntity(_0x10c4f8,_0x4691cb){return function(_0xc9b9d){if(_0xc9b9d){return _0xc9b9d[_0x9928('0x29')]()[_0x9928('0x28')](function(){var _0x3f3cab=_0xc9b9d[_0x9928('0x2a')]({'plain':!![]});var _0x5f8c96=_0x9928('0x2b');return db['UserProfileResource'][_0x9928('0x29')]({'where':{'type':_0x5f8c96,'resourceId':_0x3f3cab['id']}})['then'](function(){return _0xc9b9d;});})['then'](function(){_0x10c4f8[_0x9928('0x1e')](0xcc)[_0x9928('0x1d')]();});}};}function handleEntityNotFound(_0x2886f0,_0x43b220){return function(_0x79a52f){if(!_0x79a52f){_0x2886f0[_0x9928('0x1c')](0x194);}return _0x79a52f;};}function handleError(_0x15d123,_0x44084c){_0x44084c=_0x44084c||0x1f4;return function(_0x5dd560){logger[_0x9928('0x2c')](_0x5dd560[_0x9928('0x2d')]);if(_0x5dd560[_0x9928('0x2e')]){delete _0x5dd560[_0x9928('0x2e')];}_0x15d123[_0x9928('0x1e')](_0x44084c)[_0x9928('0x2f')](_0x5dd560);};}exports[_0x9928('0x30')]=function(_0x904c0d,_0x3d4a9a){var _0x38bf5b={},_0x25f761={},_0x10f056={'count':0x0,'rows':[]};var _0x30374b=_[_0x9928('0x31')](db[_0x9928('0x32')][_0x9928('0x33')],function(_0x30c86b){return{'name':_0x30c86b[_0x9928('0x34')],'type':_0x30c86b['type'][_0x9928('0x35')]};});_0x25f761[_0x9928('0x36')]=_[_0x9928('0x31')](_0x30374b,'name');_0x25f761[_0x9928('0x37')]=_[_0x9928('0x38')](_0x904c0d['query']);_0x25f761[_0x9928('0x39')]=_['intersection'](_0x25f761[_0x9928('0x36')],_0x25f761[_0x9928('0x37')]);_0x38bf5b[_0x9928('0x3a')]=_[_0x9928('0x3b')](_0x25f761[_0x9928('0x36')],qs[_0x9928('0x3c')](_0x904c0d[_0x9928('0x37')][_0x9928('0x3c')]));_0x38bf5b[_0x9928('0x3a')]=_0x38bf5b[_0x9928('0x3a')][_0x9928('0x3d')]?_0x38bf5b['attributes']:_0x25f761[_0x9928('0x36')];if(!_0x904c0d[_0x9928('0x37')][_0x9928('0x3e')](_0x9928('0x3f'))){_0x38bf5b[_0x9928('0x21')]=qs[_0x9928('0x21')](_0x904c0d[_0x9928('0x37')][_0x9928('0x21')]);_0x38bf5b[_0x9928('0x23')]=qs[_0x9928('0x23')](_0x904c0d[_0x9928('0x37')][_0x9928('0x23')]);}_0x38bf5b[_0x9928('0x40')]=qs[_0x9928('0x41')](_0x904c0d[_0x9928('0x37')][_0x9928('0x41')]);_0x38bf5b[_0x9928('0x42')]=qs[_0x9928('0x39')](_[_0x9928('0x43')](_0x904c0d['query'],_0x25f761[_0x9928('0x39')]),_0x30374b);if(_0x904c0d[_0x9928('0x37')][_0x9928('0x44')]){_0x38bf5b[_0x9928('0x42')]=_[_0x9928('0x45')](_0x38bf5b[_0x9928('0x42')],{'$or':_[_0x9928('0x31')](_0x30374b,function(_0x4c1215){if(_0x4c1215[_0x9928('0x46')]!==_0x9928('0x47')){var _0x26bb1f={};_0x26bb1f[_0x4c1215[_0x9928('0x2e')]]={'$like':'%'+_0x904c0d[_0x9928('0x37')][_0x9928('0x44')]+'%'};return _0x26bb1f;}})});}_0x38bf5b=_[_0x9928('0x45')]({},_0x38bf5b,_0x904c0d['options']);var _0x4c6d12={'where':_0x38bf5b[_0x9928('0x42')]};return db[_0x9928('0x32')][_0x9928('0x22')](_0x4c6d12)[_0x9928('0x28')](function(_0x530db1){_0x10f056[_0x9928('0x22')]=_0x530db1;if(_0x904c0d[_0x9928('0x37')]['includeAll']){_0x38bf5b['include']=[{'all':!![]}];}return db[_0x9928('0x32')][_0x9928('0x48')](_0x38bf5b);})[_0x9928('0x28')](function(_0x271f95){_0x10f056[_0x9928('0x49')]=_0x271f95;return _0x10f056;})[_0x9928('0x28')](respondWithFilteredResult(_0x3d4a9a,_0x38bf5b))[_0x9928('0x4a')](handleError(_0x3d4a9a,null));};exports[_0x9928('0x4b')]=function(_0x446361,_0xeb535a){var _0x3c42eb={'raw':!![],'where':{'id':_0x446361[_0x9928('0x4c')]['id']}},_0x5bbd45={};_0x5bbd45[_0x9928('0x36')]=_[_0x9928('0x38')](db['Template'][_0x9928('0x33')]);_0x5bbd45[_0x9928('0x37')]=_[_0x9928('0x38')](_0x446361['query']);_0x5bbd45['filters']=_[_0x9928('0x3b')](_0x5bbd45['model'],_0x5bbd45[_0x9928('0x37')]);_0x3c42eb[_0x9928('0x3a')]=_['intersection'](_0x5bbd45[_0x9928('0x36')],qs[_0x9928('0x3c')](_0x446361['query'][_0x9928('0x3c')]));_0x3c42eb[_0x9928('0x3a')]=_0x3c42eb['attributes']['length']?_0x3c42eb[_0x9928('0x3a')]:_0x5bbd45[_0x9928('0x36')];if(_0x446361[_0x9928('0x37')]['includeAll']){_0x3c42eb['include']=[{'all':!![]}];}_0x3c42eb=_['merge']({},_0x3c42eb,_0x446361[_0x9928('0x4d')]);return db[_0x9928('0x32')][_0x9928('0x4e')](_0x3c42eb)['then'](handleEntityNotFound(_0xeb535a,null))[_0x9928('0x28')](respondWithResult(_0xeb535a,null))[_0x9928('0x4a')](handleError(_0xeb535a,null));};exports[_0x9928('0x4f')]=function(_0x49a0b5,_0x26755a){return db[_0x9928('0x32')][_0x9928('0x4f')](_0x49a0b5['body'],{})[_0x9928('0x28')](function(_0x361064){var _0x3aa427=_0x49a0b5[_0x9928('0x50')][_0x9928('0x2a')]({'plain':!![]});if(!_0x3aa427)throw new Error(_0x9928('0x51'));if(_0x3aa427[_0x9928('0x52')]===_0x9928('0x50')){var _0xd7e44f=_0x361064[_0x9928('0x2a')]({'plain':!![]});var _0x128eac=_0x9928('0x2b');return db[_0x9928('0x53')][_0x9928('0x4e')]({'where':{'name':_0x128eac,'userProfileId':_0x3aa427[_0x9928('0x54')]},'raw':!![]})[_0x9928('0x28')](function(_0xc04008){if(_0xc04008&&_0xc04008[_0x9928('0x55')]===0x0){return db['UserProfileResource']['create']({'name':_0xd7e44f[_0x9928('0x2e')],'resourceId':_0xd7e44f['id'],'type':_0xc04008[_0x9928('0x2e')],'sectionId':_0xc04008['id']},{})[_0x9928('0x28')](function(){return _0x361064;});}else{return _0x361064;}})[_0x9928('0x4a')](function(_0xd9b6de){logger[_0x9928('0x2c')](_0x9928('0x56'),_0xd9b6de);throw _0xd9b6de;});}return _0x361064;})[_0x9928('0x28')](respondWithResult(_0x26755a,0xc9))[_0x9928('0x4a')](handleError(_0x26755a,null));};exports[_0x9928('0x27')]=function(_0x5eaec2,_0x3098f2){if(_0x5eaec2[_0x9928('0x57')]['id']){delete _0x5eaec2[_0x9928('0x57')]['id'];}return db[_0x9928('0x32')]['find']({'where':{'id':_0x5eaec2[_0x9928('0x4c')]['id']}})[_0x9928('0x28')](handleEntityNotFound(_0x3098f2,null))[_0x9928('0x28')](saveUpdates(_0x5eaec2[_0x9928('0x57')],null))[_0x9928('0x28')](respondWithResult(_0x3098f2,null))[_0x9928('0x4a')](handleError(_0x3098f2,null));};exports[_0x9928('0x29')]=function(_0x4f1ef2,_0x58ec5a){return db['Template']['find']({'where':{'id':_0x4f1ef2[_0x9928('0x4c')]['id']}})['then'](handleEntityNotFound(_0x58ec5a,null))[_0x9928('0x28')](removeEntity(_0x58ec5a,null))[_0x9928('0x4a')](handleError(_0x58ec5a,null));}; \ No newline at end of file diff --git a/server/api/template/template.model.js b/server/api/template/template.model.js index 84ee6dd..294143f 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 _0x7874=['../../config/environment','./template.attributes','tools_templates','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);}(_0x7874,0x116));var _0x4787=function(_0x5c0979,_0x287854){_0x5c0979=_0x5c0979-0x0;var _0x309972=_0x7874[_0x5c0979];return _0x309972;};'use strict';var _=require('lodash');var util=require(_0x4787('0x0'));var logger=require(_0x4787('0x1'))(_0x4787('0x2'));var moment=require(_0x4787('0x3'));var BPromise=require(_0x4787('0x4'));var rp=require(_0x4787('0x5'));var fs=require('fs');var path=require(_0x4787('0x6'));var rimraf=require(_0x4787('0x7'));var config=require(_0x4787('0x8'));var attributes=require(_0x4787('0x9'));module['exports']=function(_0x7c6145,_0xe7b628){return _0x7c6145['define']('Template',attributes,{'tableName':_0x4787('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1ab6=['define','Template','tools_templates','util','api','moment','request-promise','./template.attributes'];(function(_0x59c6ec,_0xeb6ac2){var _0x4d49d6=function(_0x1521d6){while(--_0x1521d6){_0x59c6ec['push'](_0x59c6ec['shift']());}};_0x4d49d6(++_0xeb6ac2);}(_0x1ab6,0xa3));var _0x61ab=function(_0x2b7515,_0x15c51c){_0x2b7515=_0x2b7515-0x0;var _0x430a6d=_0x1ab6[_0x2b7515];return _0x430a6d;};'use strict';var _=require('lodash');var util=require(_0x61ab('0x0'));var logger=require('../../config/logger')(_0x61ab('0x1'));var moment=require(_0x61ab('0x2'));var BPromise=require('bluebird');var rp=require(_0x61ab('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x61ab('0x4'));module['exports']=function(_0x54f2f0,_0x374b87){return _0x54f2f0[_0x61ab('0x5')](_0x61ab('0x6'),attributes,{'tableName':_0x61ab('0x7'),'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 2dc79d5..0d4f75b 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 _0xcefc=['Template,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetTemplate','Template','findAll','options','raw','where','limit','include','map','attributes','model','then','lodash','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','info','Template,\x20%s,\x20%s','request\x20sent'];(function(_0x3e4282,_0x3c68d6){var _0x30596b=function(_0xc4f4fd){while(--_0xc4f4fd){_0x3e4282['push'](_0x3e4282['shift']());}};_0x30596b(++_0x3c68d6);}(_0xcefc,0x1f2));var _0xccef=function(_0x1c34db,_0x5684ad){_0x1c34db=_0x1c34db-0x0;var _0x3b2a3e=_0xcefc[_0x1c34db];return _0x3b2a3e;};'use strict';var _=require(_0xccef('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xccef('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xccef('0x2'))['db'];var utils=require(_0xccef('0x3'));var logger=require('../../config/logger')(_0xccef('0x4'));var config=require(_0xccef('0x5'));var jayson=require(_0xccef('0x6'));var client=jayson[_0xccef('0x7')][_0xccef('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x10ae7f,_0x232284,_0x4d9cc5){return new BPromise(function(_0x341a13,_0x5069f8){return client['request'](_0x10ae7f,_0x4d9cc5)['then'](function(_0x2f82e5){logger[_0xccef('0x9')](_0xccef('0xa'),_0x232284,_0xccef('0xb'));logger['debug'](_0xccef('0xc'),_0x232284,_0xccef('0xb'),JSON[_0xccef('0xd')](_0x2f82e5));if(_0x2f82e5[_0xccef('0xe')]){if(_0x2f82e5[_0xccef('0xe')][_0xccef('0xf')]===0x1f4){logger[_0xccef('0xe')](_0xccef('0xa'),_0x232284,_0x2f82e5['error'][_0xccef('0x10')]);return _0x5069f8(_0x2f82e5[_0xccef('0xe')][_0xccef('0x10')]);}logger[_0xccef('0xe')](_0xccef('0xa'),_0x232284,_0x2f82e5[_0xccef('0xe')][_0xccef('0x10')]);return _0x341a13(_0x2f82e5['error']['message']);}else{logger[_0xccef('0x9')]('Template,\x20%s,\x20%s',_0x232284,_0xccef('0xb'));_0x341a13(_0x2f82e5['result'][_0xccef('0x10')]);}})[_0xccef('0x11')](function(_0x50a646){logger[_0xccef('0xe')](_0xccef('0xa'),_0x232284,_0x50a646);_0x5069f8(_0x50a646);});});}exports[_0xccef('0x12')]=function(_0x2e6a88){var _0x3d991d=this;return new Promise(function(_0x5dbd0f,_0xd8d739){return db[_0xccef('0x13')][_0xccef('0x14')]({'raw':_0x2e6a88[_0xccef('0x15')]?_0x2e6a88[_0xccef('0x15')][_0xccef('0x16')]===undefined?!![]:![]:!![],'where':_0x2e6a88[_0xccef('0x15')]?_0x2e6a88[_0xccef('0x15')][_0xccef('0x17')]||null:null,'attributes':_0x2e6a88[_0xccef('0x15')]?_0x2e6a88[_0xccef('0x15')]['attributes']||null:null,'limit':_0x2e6a88[_0xccef('0x15')]?_0x2e6a88['options'][_0xccef('0x18')]||null:null,'include':_0x2e6a88[_0xccef('0x15')]?_0x2e6a88[_0xccef('0x15')][_0xccef('0x19')]?_[_0xccef('0x1a')](_0x2e6a88['options'][_0xccef('0x19')],function(_0x41d28d){return{'model':db[_0x41d28d['model']],'as':_0x41d28d['as'],'attributes':_0x41d28d[_0xccef('0x1b')],'include':_0x41d28d[_0xccef('0x19')]?_['map'](_0x41d28d[_0xccef('0x19')],function(_0x21a00b){return{'model':db[_0x21a00b[_0xccef('0x1c')]],'as':_0x21a00b['as'],'attributes':_0x21a00b[_0xccef('0x1b')],'include':_0x21a00b['include']?_['map'](_0x21a00b[_0xccef('0x19')],function(_0x3d3d08){return{'model':db[_0x3d3d08[_0xccef('0x1c')]],'as':_0x3d3d08['as'],'attributes':_0x3d3d08[_0xccef('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xccef('0x1d')](function(_0x40f3b2){logger[_0xccef('0x9')](_0xccef('0x12'),_0x2e6a88);logger['debug'](_0xccef('0x12'),_0x2e6a88,JSON[_0xccef('0xd')](_0x40f3b2));_0x5dbd0f(_0x40f3b2);})[_0xccef('0x11')](function(_0x2742d3){logger[_0xccef('0xe')](_0xccef('0x12'),_0x2742d3[_0xccef('0x10')],_0x2e6a88);_0xd8d739(_0x3d991d[_0xccef('0xe')](0x1f4,_0x2742d3[_0xccef('0x10')]));});});}; \ No newline at end of file +var _0x3e62=['bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','then','info','debug','Template,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','Template,\x20%s,\x20%s','message','result','catch','findAll','options','raw','where','attributes','limit','map','include','model','GetTemplate','lodash','moment'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x3e62,0x17e));var _0x23e6=function(_0x5c7023,_0x485cc7){_0x5c7023=_0x5c7023-0x0;var _0x4e6201=_0x3e62[_0x5c7023];return _0x4e6201;};'use strict';var _=require(_0x23e6('0x0'));var util=require('util');var moment=require(_0x23e6('0x1'));var BPromise=require(_0x23e6('0x2'));var rs=require(_0x23e6('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x23e6('0x4'))['db'];var utils=require(_0x23e6('0x5'));var logger=require(_0x23e6('0x6'))(_0x23e6('0x7'));var config=require(_0x23e6('0x8'));var jayson=require(_0x23e6('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x5524a1,_0x1399d0,_0x415c6e){return new BPromise(function(_0x6f349f,_0x585b17){return client['request'](_0x5524a1,_0x415c6e)[_0x23e6('0xa')](function(_0x2e6945){logger[_0x23e6('0xb')]('Template,\x20%s,\x20%s',_0x1399d0,'request\x20sent');logger[_0x23e6('0xc')](_0x23e6('0xd'),_0x1399d0,_0x23e6('0xe'),JSON[_0x23e6('0xf')](_0x2e6945));if(_0x2e6945[_0x23e6('0x10')]){if(_0x2e6945[_0x23e6('0x10')][_0x23e6('0x11')]===0x1f4){logger[_0x23e6('0x10')](_0x23e6('0x12'),_0x1399d0,_0x2e6945[_0x23e6('0x10')][_0x23e6('0x13')]);return _0x585b17(_0x2e6945['error'][_0x23e6('0x13')]);}logger[_0x23e6('0x10')](_0x23e6('0x12'),_0x1399d0,_0x2e6945[_0x23e6('0x10')]['message']);return _0x6f349f(_0x2e6945['error'][_0x23e6('0x13')]);}else{logger[_0x23e6('0xb')](_0x23e6('0x12'),_0x1399d0,_0x23e6('0xe'));_0x6f349f(_0x2e6945[_0x23e6('0x14')][_0x23e6('0x13')]);}})[_0x23e6('0x15')](function(_0x5b4abe){logger['error'](_0x23e6('0x12'),_0x1399d0,_0x5b4abe);_0x585b17(_0x5b4abe);});});}exports['GetTemplate']=function(_0x263784){var _0x402ac2=this;return new Promise(function(_0x1eefae,_0x24ad88){return db['Template'][_0x23e6('0x16')]({'raw':_0x263784[_0x23e6('0x17')]?_0x263784['options'][_0x23e6('0x18')]===undefined?!![]:![]:!![],'where':_0x263784[_0x23e6('0x17')]?_0x263784[_0x23e6('0x17')][_0x23e6('0x19')]||null:null,'attributes':_0x263784[_0x23e6('0x17')]?_0x263784[_0x23e6('0x17')][_0x23e6('0x1a')]||null:null,'limit':_0x263784[_0x23e6('0x17')]?_0x263784[_0x23e6('0x17')][_0x23e6('0x1b')]||null:null,'include':_0x263784['options']?_0x263784[_0x23e6('0x17')]['include']?_[_0x23e6('0x1c')](_0x263784['options'][_0x23e6('0x1d')],function(_0x193770){return{'model':db[_0x193770[_0x23e6('0x1e')]],'as':_0x193770['as'],'attributes':_0x193770[_0x23e6('0x1a')],'include':_0x193770[_0x23e6('0x1d')]?_[_0x23e6('0x1c')](_0x193770[_0x23e6('0x1d')],function(_0xfb116d){return{'model':db[_0xfb116d[_0x23e6('0x1e')]],'as':_0xfb116d['as'],'attributes':_0xfb116d[_0x23e6('0x1a')],'include':_0xfb116d[_0x23e6('0x1d')]?_[_0x23e6('0x1c')](_0xfb116d[_0x23e6('0x1d')],function(_0xad8053){return{'model':db[_0xad8053[_0x23e6('0x1e')]],'as':_0xad8053['as'],'attributes':_0xad8053[_0x23e6('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x23e6('0xa')](function(_0x28bfd7){logger[_0x23e6('0xb')](_0x23e6('0x1f'),_0x263784);logger['debug']('GetTemplate',_0x263784,JSON[_0x23e6('0xf')](_0x28bfd7));_0x1eefae(_0x28bfd7);})['catch'](function(_0x55c176){logger[_0x23e6('0x10')](_0x23e6('0x1f'),_0x55c176[_0x23e6('0x13')],_0x263784);_0x24ad88(_0x402ac2['error'](0x1f4,_0x55c176['message']));});});}; \ No newline at end of file diff --git a/server/api/trigger/index.js b/server/api/trigger/index.js index d1c01f1..69c89b4 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 _0x473a=['getAllConditions','/:id/any_conditions','getAnyConditions','/:id/actions','getActions','post','create','addAllCondition','addAction','put','delete','destroy','exports','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./trigger.controller','isAuthenticated','index','/:id','show','get','/:id/all_conditions'];(function(_0x3f55ee,_0x104eef){var _0xf895ba=function(_0x1c8d0f){while(--_0x1c8d0f){_0x3f55ee['push'](_0x3f55ee['shift']());}};_0xf895ba(++_0x104eef);}(_0x473a,0x1cd));var _0xa473=function(_0x2e81fe,_0x1bf00e){_0x2e81fe=_0x2e81fe-0x0;var _0x59df9a=_0x473a[_0x2e81fe];return _0x59df9a;};'use strict';var multer=require(_0xa473('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xa473('0x1'));var express=require(_0xa473('0x2'));var router=express[_0xa473('0x3')]();var fs_extra=require(_0xa473('0x4'));var auth=require(_0xa473('0x5'));var interaction=require(_0xa473('0x6'));var config=require(_0xa473('0x7'));var controller=require(_0xa473('0x8'));router['get']('/',auth[_0xa473('0x9')](),controller[_0xa473('0xa')]);router['get'](_0xa473('0xb'),auth[_0xa473('0x9')](),controller[_0xa473('0xc')]);router[_0xa473('0xd')](_0xa473('0xe'),auth['isAuthenticated'](),controller[_0xa473('0xf')]);router[_0xa473('0xd')](_0xa473('0x10'),auth['isAuthenticated'](),controller[_0xa473('0x11')]);router[_0xa473('0xd')](_0xa473('0x12'),auth[_0xa473('0x9')](),controller[_0xa473('0x13')]);router[_0xa473('0x14')]('/',auth[_0xa473('0x9')](),controller[_0xa473('0x15')]);router[_0xa473('0x14')](_0xa473('0xe'),auth[_0xa473('0x9')](),controller[_0xa473('0x16')]);router[_0xa473('0x14')](_0xa473('0x10'),auth[_0xa473('0x9')](),controller['addAnyCondition']);router[_0xa473('0x14')](_0xa473('0x12'),auth['isAuthenticated'](),controller[_0xa473('0x17')]);router[_0xa473('0x18')](_0xa473('0xb'),auth['isAuthenticated'](),controller['update']);router[_0xa473('0x19')](_0xa473('0xb'),auth['isAuthenticated'](),controller[_0xa473('0x1a')]);module[_0xa473('0x1b')]=router; \ No newline at end of file +var _0x8bd2=['path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./trigger.controller','get','index','/:id','show','/:id/all_conditions','isAuthenticated','/:id/any_conditions','/:id/actions','getActions','post','addAllCondition','addAnyCondition','addAction','update','delete','destroy','exports','util'];(function(_0x4d3c17,_0x317c47){var _0xe81017=function(_0x498f4a){while(--_0x498f4a){_0x4d3c17['push'](_0x4d3c17['shift']());}};_0xe81017(++_0x317c47);}(_0x8bd2,0x1d3));var _0x28bd=function(_0x879e31,_0x139d02){_0x879e31=_0x879e31-0x0;var _0x3467e8=_0x8bd2[_0x879e31];return _0x3467e8;};'use strict';var multer=require('multer');var util=require(_0x28bd('0x0'));var path=require(_0x28bd('0x1'));var timeout=require(_0x28bd('0x2'));var express=require('express');var router=express[_0x28bd('0x3')]();var fs_extra=require(_0x28bd('0x4'));var auth=require(_0x28bd('0x5'));var interaction=require(_0x28bd('0x6'));var config=require(_0x28bd('0x7'));var controller=require(_0x28bd('0x8'));router[_0x28bd('0x9')]('/',auth['isAuthenticated'](),controller[_0x28bd('0xa')]);router[_0x28bd('0x9')](_0x28bd('0xb'),auth['isAuthenticated'](),controller[_0x28bd('0xc')]);router['get'](_0x28bd('0xd'),auth[_0x28bd('0xe')](),controller['getAllConditions']);router[_0x28bd('0x9')](_0x28bd('0xf'),auth[_0x28bd('0xe')](),controller['getAnyConditions']);router[_0x28bd('0x9')](_0x28bd('0x10'),auth[_0x28bd('0xe')](),controller[_0x28bd('0x11')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x28bd('0x12')](_0x28bd('0xd'),auth[_0x28bd('0xe')](),controller[_0x28bd('0x13')]);router[_0x28bd('0x12')](_0x28bd('0xf'),auth[_0x28bd('0xe')](),controller[_0x28bd('0x14')]);router['post'](_0x28bd('0x10'),auth[_0x28bd('0xe')](),controller[_0x28bd('0x15')]);router['put']('/:id',auth[_0x28bd('0xe')](),controller[_0x28bd('0x16')]);router[_0x28bd('0x17')](_0x28bd('0xb'),auth[_0x28bd('0xe')](),controller[_0x28bd('0x18')]);module[_0x28bd('0x19')]=router; \ No newline at end of file diff --git a/server/api/trigger/trigger.attributes.js b/server/api/trigger/trigger.attributes.js index 25575cd..004e7bd 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 _0x5ec0=['BOOLEAN','sequelize','exports','STRING'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5ec0,0x14d));var _0x05ec=function(_0x53ccf2,_0x13cb67){_0x53ccf2=_0x53ccf2-0x0;var _0x5a2964=_0x5ec0[_0x53ccf2];return _0x5a2964;};'use strict';var Sequelize=require(_0x05ec('0x0'));module[_0x05ec('0x1')]={'name':{'type':Sequelize[_0x05ec('0x2')]},'channel':{'type':Sequelize[_0x05ec('0x2')]},'description':{'type':Sequelize['STRING']},'status':{'type':Sequelize[_0x05ec('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0x9178=['sequelize','STRING','BOOLEAN'];(function(_0x58e9bc,_0x31f868){var _0x45df8f=function(_0x490f45){while(--_0x490f45){_0x58e9bc['push'](_0x58e9bc['shift']());}};_0x45df8f(++_0x31f868);}(_0x9178,0xa8));var _0x8917=function(_0x3f2195,_0x5ce83c){_0x3f2195=_0x3f2195-0x0;var _0x26da27=_0x9178[_0x3f2195];return _0x26da27;};'use strict';var Sequelize=require(_0x8917('0x0'));module['exports']={'name':{'type':Sequelize[_0x8917('0x1')]},'channel':{'type':Sequelize[_0x8917('0x1')]},'description':{'type':Sequelize[_0x8917('0x1')]},'status':{'type':Sequelize[_0x8917('0x2')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/trigger/trigger.controller.js b/server/api/trigger/trigger.controller.js index f8272fb..d56cc96 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 _0xff58=['userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','Condition','addAnyCondition','TriggerAnyId','getAllConditions','findOne','getAnyConditions','addAction','TriggerId','Action','getActions','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','offset','undefined','count','limit','set','Content-Range','json','reject','update','destroy','then','get','Triggers','UserProfileResource','error','stack','name','send','map','Trigger','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','include','catch','includeAll','options','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xff58,0x12b));var _0x8ff5=function(_0x51e79c,_0x51485e){_0x51e79c=_0x51e79c-0x0;var _0x2467be=_0xff58[_0x51e79c];return _0x2467be;};'use strict';var emlformat=require(_0x8ff5('0x0'));var rimraf=require(_0x8ff5('0x1'));var zipdir=require(_0x8ff5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8ff5('0x3'));var moment=require(_0x8ff5('0x4'));var BPromise=require(_0x8ff5('0x5'));var Mustache=require(_0x8ff5('0x6'));var util=require(_0x8ff5('0x7'));var path=require(_0x8ff5('0x8'));var sox=require(_0x8ff5('0x9'));var csv=require(_0x8ff5('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8ff5('0xb'));var _=require(_0x8ff5('0xc'));var squel=require('squel');var crypto=require(_0x8ff5('0xd'));var jsforce=require(_0x8ff5('0xe'));var deskjs=require(_0x8ff5('0xf'));var toCsv=require(_0x8ff5('0xa'));var querystring=require(_0x8ff5('0x10'));var Papa=require(_0x8ff5('0x11'));var Redis=require(_0x8ff5('0x12'));var authService=require(_0x8ff5('0x13'));var qs=require(_0x8ff5('0x14'));var as=require(_0x8ff5('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8ff5('0x16'))(_0x8ff5('0x17'));var utils=require('../../config/utils');var config=require(_0x8ff5('0x18'));var licenseUtil=require(_0x8ff5('0x19'));var db=require(_0x8ff5('0x1a'))['db'];function respondWithStatusCode(_0x5cb4a1,_0x228642){_0x228642=_0x228642||0xcc;return function(_0x5d6019){if(_0x5d6019){return _0x5cb4a1[_0x8ff5('0x1b')](_0x228642);}return _0x5cb4a1['status'](_0x228642)[_0x8ff5('0x1c')]();};}function respondWithResult(_0xc0341e,_0x4f223a){_0x4f223a=_0x4f223a||0xc8;return function(_0x315a17){if(_0x315a17){return _0xc0341e[_0x8ff5('0x1d')](_0x4f223a)['json'](_0x315a17);}};}function respondWithFilteredResult(_0x1fd189,_0x522982){return function(_0x1c23da){if(_0x1c23da){var _0x561755=typeof _0x522982[_0x8ff5('0x1e')]===_0x8ff5('0x1f')&&typeof _0x522982['limit']===_0x8ff5('0x1f');var _0xfd9736=_0x1c23da[_0x8ff5('0x20')];var _0x53bd7f=_0x561755?0x0:_0x522982[_0x8ff5('0x1e')];var _0x4eee8c=_0x561755?_0x1c23da['count']:_0x522982[_0x8ff5('0x1e')]+_0x522982[_0x8ff5('0x21')];var _0x23fefb;if(_0x4eee8c>=_0xfd9736){_0x4eee8c=_0xfd9736;_0x23fefb=0xc8;}else{_0x23fefb=0xce;}_0x1fd189[_0x8ff5('0x1d')](_0x23fefb);return _0x1fd189[_0x8ff5('0x22')](_0x8ff5('0x23'),_0x53bd7f+'-'+_0x4eee8c+'/'+_0xfd9736)[_0x8ff5('0x24')](_0x1c23da);}return null;};}function patchUpdates(_0x4f410e){return function(_0x465ab6){try{jsonpatch['apply'](_0x465ab6,_0x4f410e,!![]);}catch(_0x26278e){return BPromise[_0x8ff5('0x25')](_0x26278e);}return _0x465ab6['save']();};}function saveUpdates(_0x56f7f7,_0x49141c){return function(_0x53c29b){if(_0x53c29b){return _0x53c29b[_0x8ff5('0x26')](_0x56f7f7)['then'](function(_0x1a29fb){return _0x1a29fb;});}return null;};}function removeEntity(_0x3b6c90,_0x450244){return function(_0x1ad6fa){if(_0x1ad6fa){return _0x1ad6fa[_0x8ff5('0x27')]()[_0x8ff5('0x28')](function(){var _0x1ba51c=_0x1ad6fa[_0x8ff5('0x29')]({'plain':!![]});var _0x3acfe4=_0x8ff5('0x2a');return db[_0x8ff5('0x2b')][_0x8ff5('0x27')]({'where':{'type':_0x3acfe4,'resourceId':_0x1ba51c['id']}})[_0x8ff5('0x28')](function(){return _0x1ad6fa;});})[_0x8ff5('0x28')](function(){_0x3b6c90['status'](0xcc)[_0x8ff5('0x1c')]();});}};}function handleEntityNotFound(_0x3a83a3,_0x59f380){return function(_0x42d3e8){if(!_0x42d3e8){_0x3a83a3['sendStatus'](0x194);}return _0x42d3e8;};}function handleError(_0x5c9700,_0xc5e8df){_0xc5e8df=_0xc5e8df||0x1f4;return function(_0x54087d){logger[_0x8ff5('0x2c')](_0x54087d[_0x8ff5('0x2d')]);if(_0x54087d[_0x8ff5('0x2e')]){delete _0x54087d[_0x8ff5('0x2e')];}_0x5c9700[_0x8ff5('0x1d')](_0xc5e8df)[_0x8ff5('0x2f')](_0x54087d);};}exports['index']=function(_0x3313c8,_0xff5663){var _0x4d86f5={},_0x1180e2={},_0xe778b1={'count':0x0,'rows':[]};var _0x109e59=_[_0x8ff5('0x30')](db[_0x8ff5('0x31')][_0x8ff5('0x32')],function(_0x2261c2){return{'name':_0x2261c2[_0x8ff5('0x33')],'type':_0x2261c2[_0x8ff5('0x34')][_0x8ff5('0x35')]};});_0x1180e2['model']=_[_0x8ff5('0x30')](_0x109e59,_0x8ff5('0x2e'));_0x1180e2[_0x8ff5('0x36')]=_[_0x8ff5('0x37')](_0x3313c8[_0x8ff5('0x36')]);_0x1180e2[_0x8ff5('0x38')]=_[_0x8ff5('0x39')](_0x1180e2[_0x8ff5('0x3a')],_0x1180e2['query']);_0x4d86f5[_0x8ff5('0x3b')]=_[_0x8ff5('0x39')](_0x1180e2[_0x8ff5('0x3a')],qs[_0x8ff5('0x3c')](_0x3313c8[_0x8ff5('0x36')][_0x8ff5('0x3c')]));_0x4d86f5[_0x8ff5('0x3b')]=_0x4d86f5[_0x8ff5('0x3b')][_0x8ff5('0x3d')]?_0x4d86f5[_0x8ff5('0x3b')]:_0x1180e2[_0x8ff5('0x3a')];if(!_0x3313c8[_0x8ff5('0x36')][_0x8ff5('0x3e')](_0x8ff5('0x3f'))){_0x4d86f5['limit']=qs[_0x8ff5('0x21')](_0x3313c8[_0x8ff5('0x36')][_0x8ff5('0x21')]);_0x4d86f5[_0x8ff5('0x1e')]=qs[_0x8ff5('0x1e')](_0x3313c8[_0x8ff5('0x36')][_0x8ff5('0x1e')]);}_0x4d86f5[_0x8ff5('0x40')]=qs[_0x8ff5('0x41')](_0x3313c8[_0x8ff5('0x36')][_0x8ff5('0x41')]);_0x4d86f5[_0x8ff5('0x42')]=qs[_0x8ff5('0x38')](_[_0x8ff5('0x43')](_0x3313c8['query'],_0x1180e2[_0x8ff5('0x38')]),_0x109e59);if(_0x3313c8[_0x8ff5('0x36')]['filter']){_0x4d86f5[_0x8ff5('0x42')]=_[_0x8ff5('0x44')](_0x4d86f5[_0x8ff5('0x42')],{'$or':_['map'](_0x109e59,function(_0x11a3a5){if(_0x11a3a5[_0x8ff5('0x34')]!==_0x8ff5('0x45')){var _0x25aac8={};_0x25aac8[_0x11a3a5[_0x8ff5('0x2e')]]={'$like':'%'+_0x3313c8[_0x8ff5('0x36')][_0x8ff5('0x46')]+'%'};return _0x25aac8;}})});}_0x4d86f5=_[_0x8ff5('0x44')]({},_0x4d86f5,_0x3313c8['options']);var _0x3937c3={'where':_0x4d86f5[_0x8ff5('0x42')]};return db[_0x8ff5('0x31')][_0x8ff5('0x20')](_0x3937c3)['then'](function(_0x5ce880){_0xe778b1['count']=_0x5ce880;if(_0x3313c8[_0x8ff5('0x36')]['includeAll']){_0x4d86f5[_0x8ff5('0x47')]=[{'all':!![]}];}return db[_0x8ff5('0x31')]['findAll'](_0x4d86f5);})[_0x8ff5('0x28')](function(_0x2cf391){_0xe778b1['rows']=_0x2cf391;return _0xe778b1;})['then'](respondWithFilteredResult(_0xff5663,_0x4d86f5))[_0x8ff5('0x48')](handleError(_0xff5663,null));};exports['show']=function(_0x37e0ba,_0x34f631){var _0x299604={'raw':![],'where':{'id':_0x37e0ba['params']['id']}},_0x49cb24={};_0x49cb24[_0x8ff5('0x3a')]=_['keys'](db[_0x8ff5('0x31')]['rawAttributes']);_0x49cb24[_0x8ff5('0x36')]=_[_0x8ff5('0x37')](_0x37e0ba[_0x8ff5('0x36')]);_0x49cb24[_0x8ff5('0x38')]=_['intersection'](_0x49cb24['model'],_0x49cb24[_0x8ff5('0x36')]);_0x299604[_0x8ff5('0x3b')]=_[_0x8ff5('0x39')](_0x49cb24[_0x8ff5('0x3a')],qs[_0x8ff5('0x3c')](_0x37e0ba[_0x8ff5('0x36')]['fields']));_0x299604['attributes']=_0x299604[_0x8ff5('0x3b')][_0x8ff5('0x3d')]?_0x299604['attributes']:_0x49cb24['model'];if(_0x37e0ba[_0x8ff5('0x36')][_0x8ff5('0x49')]){_0x299604['include']=[{'all':!![]}];}_0x299604=_[_0x8ff5('0x44')]({},_0x299604,_0x37e0ba[_0x8ff5('0x4a')]);return db[_0x8ff5('0x31')][_0x8ff5('0x4b')](_0x299604)[_0x8ff5('0x28')](handleEntityNotFound(_0x34f631,null))['then'](respondWithResult(_0x34f631,null))[_0x8ff5('0x48')](handleError(_0x34f631,null));};exports[_0x8ff5('0x4c')]=function(_0x54325d,_0x2ef2f7){return db[_0x8ff5('0x31')][_0x8ff5('0x4c')](_0x54325d[_0x8ff5('0x4d')],{})[_0x8ff5('0x28')](function(_0x4820e8){var _0x108408=_0x54325d['user']['get']({'plain':!![]});if(!_0x108408)throw new Error(_0x8ff5('0x4e'));if(_0x108408[_0x8ff5('0x4f')]===_0x8ff5('0x50')){var _0xbd4011=_0x4820e8[_0x8ff5('0x29')]({'plain':!![]});var _0x38b130=_0x8ff5('0x2a');return db['UserProfileSection'][_0x8ff5('0x4b')]({'where':{'name':_0x38b130,'userProfileId':_0x108408[_0x8ff5('0x51')]},'raw':!![]})[_0x8ff5('0x28')](function(_0x412d99){if(_0x412d99&&_0x412d99[_0x8ff5('0x52')]===0x0){return db['UserProfileResource'][_0x8ff5('0x4c')]({'name':_0xbd4011[_0x8ff5('0x2e')],'resourceId':_0xbd4011['id'],'type':_0x412d99[_0x8ff5('0x2e')],'sectionId':_0x412d99['id']},{})['then'](function(){return _0x4820e8;});}else{return _0x4820e8;}})[_0x8ff5('0x48')](function(_0x2177ac){logger[_0x8ff5('0x2c')](_0x8ff5('0x53'),_0x2177ac);throw _0x2177ac;});}return _0x4820e8;})[_0x8ff5('0x28')](respondWithResult(_0x2ef2f7,0xc9))[_0x8ff5('0x48')](handleError(_0x2ef2f7,null));};exports['update']=function(_0x258f6a,_0x5d4d8a){if(_0x258f6a['body']['id']){delete _0x258f6a['body']['id'];}return db[_0x8ff5('0x31')]['find']({'where':{'id':_0x258f6a[_0x8ff5('0x54')]['id']}})['then'](handleEntityNotFound(_0x5d4d8a,null))['then'](saveUpdates(_0x258f6a[_0x8ff5('0x4d')],null))[_0x8ff5('0x28')](respondWithResult(_0x5d4d8a,null))[_0x8ff5('0x48')](handleError(_0x5d4d8a,null));};exports[_0x8ff5('0x27')]=function(_0x34acd7,_0x3e6bad){return db['Trigger'][_0x8ff5('0x4b')]({'where':{'id':_0x34acd7['params']['id']}})['then'](handleEntityNotFound(_0x3e6bad,null))['then'](removeEntity(_0x3e6bad,null))[_0x8ff5('0x48')](handleError(_0x3e6bad,null));};exports['addAllCondition']=function(_0x13c519,_0x5f1e2f,_0x27c0ea){if(_0x13c519[_0x8ff5('0x4d')]['id']){delete _0x13c519[_0x8ff5('0x4d')]['id'];}return db[_0x8ff5('0x31')][_0x8ff5('0x4b')]({'where':{'id':_0x13c519[_0x8ff5('0x54')]['id']}})[_0x8ff5('0x28')](handleEntityNotFound(_0x5f1e2f,null))[_0x8ff5('0x28')](function(_0x300623){if(_0x300623){_0x13c519['body']['TriggerAllId']=_0x300623['id'];return db[_0x8ff5('0x55')][_0x8ff5('0x4c')](_0x13c519['body']);}})['then'](respondWithResult(_0x5f1e2f,null))[_0x8ff5('0x48')](handleError(_0x5f1e2f,null));};exports[_0x8ff5('0x56')]=function(_0x3617d8,_0x297d7d,_0x311c85){if(_0x3617d8[_0x8ff5('0x4d')]['id']){delete _0x3617d8[_0x8ff5('0x4d')]['id'];}return db[_0x8ff5('0x31')]['find']({'where':{'id':_0x3617d8[_0x8ff5('0x54')]['id']}})[_0x8ff5('0x28')](handleEntityNotFound(_0x297d7d,null))[_0x8ff5('0x28')](function(_0x2ee859){if(_0x2ee859){_0x3617d8[_0x8ff5('0x4d')][_0x8ff5('0x57')]=_0x2ee859['id'];return db['Condition'][_0x8ff5('0x4c')](_0x3617d8[_0x8ff5('0x4d')]);}})[_0x8ff5('0x28')](respondWithResult(_0x297d7d,null))[_0x8ff5('0x48')](handleError(_0x297d7d,null));};exports[_0x8ff5('0x58')]=function(_0x187870,_0x9c323d,_0x2b1781){var _0x5bf11c={};var _0x3a97c6={};var _0x929035;var _0x510b27;return db[_0x8ff5('0x31')][_0x8ff5('0x59')]({'where':{'id':_0x187870[_0x8ff5('0x54')]['id']}})[_0x8ff5('0x28')](handleEntityNotFound(_0x9c323d,null))[_0x8ff5('0x28')](function(_0x29159f){if(_0x29159f){_0x929035=_0x29159f;_0x3a97c6[_0x8ff5('0x3a')]=_[_0x8ff5('0x37')](db[_0x8ff5('0x55')][_0x8ff5('0x32')]);_0x3a97c6[_0x8ff5('0x36')]=_['keys'](_0x187870[_0x8ff5('0x36')]);_0x3a97c6[_0x8ff5('0x38')]=_[_0x8ff5('0x39')](_0x3a97c6['model'],_0x3a97c6[_0x8ff5('0x36')]);_0x5bf11c[_0x8ff5('0x3b')]=_['intersection'](_0x3a97c6[_0x8ff5('0x3a')],qs[_0x8ff5('0x3c')](_0x187870[_0x8ff5('0x36')][_0x8ff5('0x3c')]));_0x5bf11c[_0x8ff5('0x3b')]=_0x5bf11c[_0x8ff5('0x3b')][_0x8ff5('0x3d')]?_0x5bf11c[_0x8ff5('0x3b')]:_0x3a97c6['model'];_0x5bf11c['order']=qs[_0x8ff5('0x41')](_0x187870['query'][_0x8ff5('0x41')]);_0x5bf11c[_0x8ff5('0x42')]=qs[_0x8ff5('0x38')](_[_0x8ff5('0x43')](_0x187870[_0x8ff5('0x36')],_0x3a97c6[_0x8ff5('0x38')]));if(_0x187870[_0x8ff5('0x36')][_0x8ff5('0x46')]){_0x5bf11c[_0x8ff5('0x42')]=_[_0x8ff5('0x44')](_0x5bf11c[_0x8ff5('0x42')],{'$or':_['map'](_0x5bf11c[_0x8ff5('0x3b')],function(_0x560279){var _0x43575b={};_0x43575b[_0x560279]={'$like':'%'+_0x187870['query']['filter']+'%'};return _0x43575b;})});}_0x5bf11c=_[_0x8ff5('0x44')]({},_0x5bf11c,_0x187870[_0x8ff5('0x4a')]);return _0x929035[_0x8ff5('0x58')](_0x5bf11c);}})['then'](function(_0x22ce5a){if(_0x22ce5a){_0x510b27=_0x22ce5a[_0x8ff5('0x3d')];if(!_0x187870[_0x8ff5('0x36')][_0x8ff5('0x3e')]('nolimit')){_0x5bf11c[_0x8ff5('0x21')]=qs[_0x8ff5('0x21')](_0x187870[_0x8ff5('0x36')]['limit']);_0x5bf11c['offset']=qs[_0x8ff5('0x1e')](_0x187870[_0x8ff5('0x36')]['offset']);}return _0x929035[_0x8ff5('0x58')](_0x5bf11c);}})['then'](function(_0x50d330){if(_0x50d330){return _0x50d330?{'count':_0x510b27,'rows':_0x50d330}:null;}})[_0x8ff5('0x28')](respondWithResult(_0x9c323d,null))[_0x8ff5('0x48')](handleError(_0x9c323d,null));};exports[_0x8ff5('0x5a')]=function(_0x23a81e,_0x2f4b0a,_0x483a6e){var _0x5b4d63={};var _0x2b4a3c={};var _0x3c2160;var _0x2c14d9;return db[_0x8ff5('0x31')][_0x8ff5('0x59')]({'where':{'id':_0x23a81e[_0x8ff5('0x54')]['id']}})[_0x8ff5('0x28')](handleEntityNotFound(_0x2f4b0a,null))[_0x8ff5('0x28')](function(_0x5316e4){if(_0x5316e4){_0x3c2160=_0x5316e4;_0x2b4a3c[_0x8ff5('0x3a')]=_['keys'](db[_0x8ff5('0x55')][_0x8ff5('0x32')]);_0x2b4a3c[_0x8ff5('0x36')]=_[_0x8ff5('0x37')](_0x23a81e[_0x8ff5('0x36')]);_0x2b4a3c[_0x8ff5('0x38')]=_[_0x8ff5('0x39')](_0x2b4a3c[_0x8ff5('0x3a')],_0x2b4a3c['query']);_0x5b4d63[_0x8ff5('0x3b')]=_[_0x8ff5('0x39')](_0x2b4a3c[_0x8ff5('0x3a')],qs[_0x8ff5('0x3c')](_0x23a81e['query']['fields']));_0x5b4d63['attributes']=_0x5b4d63[_0x8ff5('0x3b')][_0x8ff5('0x3d')]?_0x5b4d63[_0x8ff5('0x3b')]:_0x2b4a3c[_0x8ff5('0x3a')];_0x5b4d63[_0x8ff5('0x40')]=qs[_0x8ff5('0x41')](_0x23a81e[_0x8ff5('0x36')][_0x8ff5('0x41')]);_0x5b4d63['where']=qs[_0x8ff5('0x38')](_[_0x8ff5('0x43')](_0x23a81e['query'],_0x2b4a3c['filters']));if(_0x23a81e[_0x8ff5('0x36')][_0x8ff5('0x46')]){_0x5b4d63[_0x8ff5('0x42')]=_['merge'](_0x5b4d63[_0x8ff5('0x42')],{'$or':_[_0x8ff5('0x30')](_0x5b4d63[_0x8ff5('0x3b')],function(_0x58ac24){var _0x336f0a={};_0x336f0a[_0x58ac24]={'$like':'%'+_0x23a81e[_0x8ff5('0x36')][_0x8ff5('0x46')]+'%'};return _0x336f0a;})});}_0x5b4d63=_[_0x8ff5('0x44')]({},_0x5b4d63,_0x23a81e[_0x8ff5('0x4a')]);return _0x3c2160[_0x8ff5('0x5a')](_0x5b4d63);}})['then'](function(_0x1bd8b1){if(_0x1bd8b1){_0x2c14d9=_0x1bd8b1[_0x8ff5('0x3d')];if(!_0x23a81e[_0x8ff5('0x36')][_0x8ff5('0x3e')](_0x8ff5('0x3f'))){_0x5b4d63['limit']=qs['limit'](_0x23a81e['query'][_0x8ff5('0x21')]);_0x5b4d63[_0x8ff5('0x1e')]=qs['offset'](_0x23a81e[_0x8ff5('0x36')]['offset']);}return _0x3c2160['getAnyConditions'](_0x5b4d63);}})['then'](function(_0x1fd9b6){if(_0x1fd9b6){return _0x1fd9b6?{'count':_0x2c14d9,'rows':_0x1fd9b6}:null;}})[_0x8ff5('0x28')](respondWithResult(_0x2f4b0a,null))[_0x8ff5('0x48')](handleError(_0x2f4b0a,null));};exports[_0x8ff5('0x5b')]=function(_0x503fcd,_0x4a3b0e,_0x429c31){if(_0x503fcd['body']['id']){delete _0x503fcd[_0x8ff5('0x4d')]['id'];}return db['Trigger'][_0x8ff5('0x4b')]({'where':{'id':_0x503fcd['params']['id']}})[_0x8ff5('0x28')](handleEntityNotFound(_0x4a3b0e,null))[_0x8ff5('0x28')](function(_0x246d79){if(_0x246d79){_0x503fcd[_0x8ff5('0x4d')][_0x8ff5('0x5c')]=_0x246d79['id'];return db[_0x8ff5('0x5d')][_0x8ff5('0x4c')](_0x503fcd[_0x8ff5('0x4d')]);}})[_0x8ff5('0x28')](respondWithResult(_0x4a3b0e,null))[_0x8ff5('0x48')](handleError(_0x4a3b0e,null));};exports[_0x8ff5('0x5e')]=function(_0x5abf0e,_0x1e3046,_0x501b54){var _0x5729a3={};var _0x483b51={};var _0x1333a5;var _0x485be1;return db['Trigger'][_0x8ff5('0x59')]({'where':{'id':_0x5abf0e[_0x8ff5('0x54')]['id']}})[_0x8ff5('0x28')](handleEntityNotFound(_0x1e3046,null))['then'](function(_0x8e2c9c){if(_0x8e2c9c){_0x1333a5=_0x8e2c9c;_0x483b51['model']=_['keys'](db[_0x8ff5('0x5d')][_0x8ff5('0x32')]);_0x483b51['query']=_['keys'](_0x5abf0e['query']);_0x483b51[_0x8ff5('0x38')]=_[_0x8ff5('0x39')](_0x483b51[_0x8ff5('0x3a')],_0x483b51[_0x8ff5('0x36')]);_0x5729a3[_0x8ff5('0x3b')]=_['intersection'](_0x483b51[_0x8ff5('0x3a')],qs['fields'](_0x5abf0e['query']['fields']));_0x5729a3[_0x8ff5('0x3b')]=_0x5729a3[_0x8ff5('0x3b')][_0x8ff5('0x3d')]?_0x5729a3[_0x8ff5('0x3b')]:_0x483b51['model'];_0x5729a3['order']=qs['sort'](_0x5abf0e[_0x8ff5('0x36')][_0x8ff5('0x41')]);_0x5729a3[_0x8ff5('0x42')]=qs['filters'](_['pick'](_0x5abf0e[_0x8ff5('0x36')],_0x483b51['filters']));if(_0x5abf0e[_0x8ff5('0x36')]['filter']){_0x5729a3['where']=_[_0x8ff5('0x44')](_0x5729a3[_0x8ff5('0x42')],{'$or':_[_0x8ff5('0x30')](_0x5729a3['attributes'],function(_0x2164e0){var _0x317928={};_0x317928[_0x2164e0]={'$like':'%'+_0x5abf0e[_0x8ff5('0x36')]['filter']+'%'};return _0x317928;})});}_0x5729a3=_[_0x8ff5('0x44')]({},_0x5729a3,_0x5abf0e[_0x8ff5('0x4a')]);return _0x1333a5[_0x8ff5('0x5e')](_0x5729a3);}})[_0x8ff5('0x28')](function(_0x133694){if(_0x133694){_0x485be1=_0x133694[_0x8ff5('0x3d')];if(!_0x5abf0e['query'][_0x8ff5('0x3e')]('nolimit')){_0x5729a3['limit']=qs[_0x8ff5('0x21')](_0x5abf0e[_0x8ff5('0x36')][_0x8ff5('0x21')]);_0x5729a3['offset']=qs['offset'](_0x5abf0e['query'][_0x8ff5('0x1e')]);}return _0x1333a5[_0x8ff5('0x5e')](_0x5729a3);}})[_0x8ff5('0x28')](function(_0xcc4cd0){if(_0xcc4cd0){return _0xcc4cd0?{'count':_0x485be1,'rows':_0xcc4cd0}:null;}})[_0x8ff5('0x28')](respondWithResult(_0x1e3046,null))[_0x8ff5('0x48')](handleError(_0x1e3046,null));}; \ No newline at end of file +var _0x83c9=['path','sox','to-csv','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','destroy','then','get','UserProfileResource','error','name','send','index','map','Trigger','rawAttributes','fieldName','key','model','keys','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','filters','where','merge','type','VIRTUAL','includeAll','include','findAll','catch','params','options','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addAllCondition','Condition','addAnyCondition','TriggerAnyId','getAllConditions','findOne','order','filter','addAction','Action','getActions','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util'];(function(_0x227427,_0x39a41d){var _0x2f3aef=function(_0x391c69){while(--_0x391c69){_0x227427['push'](_0x227427['shift']());}};_0x2f3aef(++_0x39a41d);}(_0x83c9,0x169));var _0x983c=function(_0x26d034,_0x2c22db){_0x26d034=_0x26d034-0x0;var _0x3015aa=_0x83c9[_0x26d034];return _0x3015aa;};'use strict';var emlformat=require(_0x983c('0x0'));var rimraf=require(_0x983c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x983c('0x2'));var rp=require(_0x983c('0x3'));var moment=require('moment');var BPromise=require(_0x983c('0x4'));var Mustache=require(_0x983c('0x5'));var util=require(_0x983c('0x6'));var path=require(_0x983c('0x7'));var sox=require(_0x983c('0x8'));var csv=require(_0x983c('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x983c('0xa'));var _=require(_0x983c('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x983c('0xc'));var deskjs=require(_0x983c('0xd'));var toCsv=require(_0x983c('0x9'));var querystring=require(_0x983c('0xe'));var Papa=require(_0x983c('0xf'));var Redis=require(_0x983c('0x10'));var authService=require(_0x983c('0x11'));var qs=require(_0x983c('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x983c('0x13'))('api');var utils=require(_0x983c('0x14'));var config=require(_0x983c('0x15'));var licenseUtil=require(_0x983c('0x16'));var db=require(_0x983c('0x17'))['db'];function respondWithStatusCode(_0x552d3f,_0x135edf){_0x135edf=_0x135edf||0xcc;return function(_0x10bd82){if(_0x10bd82){return _0x552d3f[_0x983c('0x18')](_0x135edf);}return _0x552d3f[_0x983c('0x19')](_0x135edf)['end']();};}function respondWithResult(_0x44c3fe,_0x48aba5){_0x48aba5=_0x48aba5||0xc8;return function(_0x467c7d){if(_0x467c7d){return _0x44c3fe[_0x983c('0x19')](_0x48aba5)[_0x983c('0x1a')](_0x467c7d);}};}function respondWithFilteredResult(_0x54bff1,_0x17d7a1){return function(_0x12292b){if(_0x12292b){var _0x2eacc7=typeof _0x17d7a1[_0x983c('0x1b')]==='undefined'&&typeof _0x17d7a1[_0x983c('0x1c')]===_0x983c('0x1d');var _0x3267a7=_0x12292b[_0x983c('0x1e')];var _0x44e7af=_0x2eacc7?0x0:_0x17d7a1[_0x983c('0x1b')];var _0x4150a4=_0x2eacc7?_0x12292b['count']:_0x17d7a1[_0x983c('0x1b')]+_0x17d7a1[_0x983c('0x1c')];var _0x43d05c;if(_0x4150a4>=_0x3267a7){_0x4150a4=_0x3267a7;_0x43d05c=0xc8;}else{_0x43d05c=0xce;}_0x54bff1[_0x983c('0x19')](_0x43d05c);return _0x54bff1[_0x983c('0x1f')](_0x983c('0x20'),_0x44e7af+'-'+_0x4150a4+'/'+_0x3267a7)[_0x983c('0x1a')](_0x12292b);}return null;};}function patchUpdates(_0x5e3590){return function(_0x4182f4){try{jsonpatch[_0x983c('0x21')](_0x4182f4,_0x5e3590,!![]);}catch(_0x28400a){return BPromise[_0x983c('0x22')](_0x28400a);}return _0x4182f4[_0x983c('0x23')]();};}function saveUpdates(_0x16b26e,_0x53814c){return function(_0x466fe8){if(_0x466fe8){return _0x466fe8[_0x983c('0x24')](_0x16b26e)['then'](function(_0x2927e2){return _0x2927e2;});}return null;};}function removeEntity(_0x1ff003,_0x33c6f7){return function(_0x35962e){if(_0x35962e){return _0x35962e[_0x983c('0x25')]()[_0x983c('0x26')](function(){var _0x4ce434=_0x35962e[_0x983c('0x27')]({'plain':!![]});var _0xd382bc='Triggers';return db[_0x983c('0x28')][_0x983c('0x25')]({'where':{'type':_0xd382bc,'resourceId':_0x4ce434['id']}})[_0x983c('0x26')](function(){return _0x35962e;});})[_0x983c('0x26')](function(){_0x1ff003['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x708f6,_0x40a504){return function(_0x1de967){if(!_0x1de967){_0x708f6[_0x983c('0x18')](0x194);}return _0x1de967;};}function handleError(_0x571170,_0x13ae24){_0x13ae24=_0x13ae24||0x1f4;return function(_0x569d2f){logger[_0x983c('0x29')](_0x569d2f['stack']);if(_0x569d2f[_0x983c('0x2a')]){delete _0x569d2f['name'];}_0x571170['status'](_0x13ae24)[_0x983c('0x2b')](_0x569d2f);};}exports[_0x983c('0x2c')]=function(_0x467b21,_0x252c8e){var _0x4164f1={},_0x4ff412={},_0x1d5551={'count':0x0,'rows':[]};var _0x434474=_[_0x983c('0x2d')](db[_0x983c('0x2e')][_0x983c('0x2f')],function(_0x2f9328){return{'name':_0x2f9328[_0x983c('0x30')],'type':_0x2f9328['type'][_0x983c('0x31')]};});_0x4ff412[_0x983c('0x32')]=_['map'](_0x434474,_0x983c('0x2a'));_0x4ff412['query']=_[_0x983c('0x33')](_0x467b21['query']);_0x4ff412['filters']=_[_0x983c('0x34')](_0x4ff412[_0x983c('0x32')],_0x4ff412[_0x983c('0x35')]);_0x4164f1[_0x983c('0x36')]=_[_0x983c('0x34')](_0x4ff412['model'],qs[_0x983c('0x37')](_0x467b21[_0x983c('0x35')][_0x983c('0x37')]));_0x4164f1[_0x983c('0x36')]=_0x4164f1[_0x983c('0x36')][_0x983c('0x38')]?_0x4164f1['attributes']:_0x4ff412[_0x983c('0x32')];if(!_0x467b21[_0x983c('0x35')][_0x983c('0x39')](_0x983c('0x3a'))){_0x4164f1[_0x983c('0x1c')]=qs[_0x983c('0x1c')](_0x467b21[_0x983c('0x35')][_0x983c('0x1c')]);_0x4164f1[_0x983c('0x1b')]=qs[_0x983c('0x1b')](_0x467b21[_0x983c('0x35')]['offset']);}_0x4164f1['order']=qs[_0x983c('0x3b')](_0x467b21[_0x983c('0x35')][_0x983c('0x3b')]);_0x4164f1['where']=qs['filters'](_[_0x983c('0x3c')](_0x467b21['query'],_0x4ff412[_0x983c('0x3d')]),_0x434474);if(_0x467b21[_0x983c('0x35')]['filter']){_0x4164f1[_0x983c('0x3e')]=_[_0x983c('0x3f')](_0x4164f1['where'],{'$or':_[_0x983c('0x2d')](_0x434474,function(_0x32bfbf){if(_0x32bfbf[_0x983c('0x40')]!==_0x983c('0x41')){var _0x43e0d2={};_0x43e0d2[_0x32bfbf['name']]={'$like':'%'+_0x467b21[_0x983c('0x35')]['filter']+'%'};return _0x43e0d2;}})});}_0x4164f1=_[_0x983c('0x3f')]({},_0x4164f1,_0x467b21['options']);var _0xa70b3f={'where':_0x4164f1['where']};return db[_0x983c('0x2e')][_0x983c('0x1e')](_0xa70b3f)['then'](function(_0x4eb444){_0x1d5551[_0x983c('0x1e')]=_0x4eb444;if(_0x467b21[_0x983c('0x35')][_0x983c('0x42')]){_0x4164f1[_0x983c('0x43')]=[{'all':!![]}];}return db[_0x983c('0x2e')][_0x983c('0x44')](_0x4164f1);})['then'](function(_0x2a51f3){_0x1d5551['rows']=_0x2a51f3;return _0x1d5551;})[_0x983c('0x26')](respondWithFilteredResult(_0x252c8e,_0x4164f1))[_0x983c('0x45')](handleError(_0x252c8e,null));};exports['show']=function(_0x20971d,_0x1df094){var _0x42e3ae={'raw':![],'where':{'id':_0x20971d[_0x983c('0x46')]['id']}},_0x3047e3={};_0x3047e3['model']=_[_0x983c('0x33')](db['Trigger'][_0x983c('0x2f')]);_0x3047e3[_0x983c('0x35')]=_[_0x983c('0x33')](_0x20971d[_0x983c('0x35')]);_0x3047e3[_0x983c('0x3d')]=_[_0x983c('0x34')](_0x3047e3[_0x983c('0x32')],_0x3047e3[_0x983c('0x35')]);_0x42e3ae[_0x983c('0x36')]=_['intersection'](_0x3047e3['model'],qs[_0x983c('0x37')](_0x20971d[_0x983c('0x35')][_0x983c('0x37')]));_0x42e3ae['attributes']=_0x42e3ae['attributes'][_0x983c('0x38')]?_0x42e3ae[_0x983c('0x36')]:_0x3047e3[_0x983c('0x32')];if(_0x20971d[_0x983c('0x35')][_0x983c('0x42')]){_0x42e3ae[_0x983c('0x43')]=[{'all':!![]}];}_0x42e3ae=_[_0x983c('0x3f')]({},_0x42e3ae,_0x20971d[_0x983c('0x47')]);return db[_0x983c('0x2e')]['find'](_0x42e3ae)[_0x983c('0x26')](handleEntityNotFound(_0x1df094,null))[_0x983c('0x26')](respondWithResult(_0x1df094,null))[_0x983c('0x45')](handleError(_0x1df094,null));};exports[_0x983c('0x48')]=function(_0x25c95b,_0x33fcf6){return db[_0x983c('0x2e')][_0x983c('0x48')](_0x25c95b[_0x983c('0x49')],{})[_0x983c('0x26')](function(_0x3919a0){var _0x596105=_0x25c95b[_0x983c('0x4a')][_0x983c('0x27')]({'plain':!![]});if(!_0x596105)throw new Error(_0x983c('0x4b'));if(_0x596105[_0x983c('0x4c')]===_0x983c('0x4a')){var _0x46865f=_0x3919a0[_0x983c('0x27')]({'plain':!![]});var _0x4972a3='Triggers';return db[_0x983c('0x4d')][_0x983c('0x4e')]({'where':{'name':_0x4972a3,'userProfileId':_0x596105['userProfileId']},'raw':!![]})[_0x983c('0x26')](function(_0x1d3749){if(_0x1d3749&&_0x1d3749[_0x983c('0x4f')]===0x0){return db[_0x983c('0x28')][_0x983c('0x48')]({'name':_0x46865f[_0x983c('0x2a')],'resourceId':_0x46865f['id'],'type':_0x1d3749['name'],'sectionId':_0x1d3749['id']},{})[_0x983c('0x26')](function(){return _0x3919a0;});}else{return _0x3919a0;}})[_0x983c('0x45')](function(_0x405dfd){logger[_0x983c('0x29')](_0x983c('0x50'),_0x405dfd);throw _0x405dfd;});}return _0x3919a0;})[_0x983c('0x26')](respondWithResult(_0x33fcf6,0xc9))[_0x983c('0x45')](handleError(_0x33fcf6,null));};exports[_0x983c('0x24')]=function(_0x580d45,_0x17a8cd){if(_0x580d45['body']['id']){delete _0x580d45[_0x983c('0x49')]['id'];}return db[_0x983c('0x2e')][_0x983c('0x4e')]({'where':{'id':_0x580d45[_0x983c('0x46')]['id']}})[_0x983c('0x26')](handleEntityNotFound(_0x17a8cd,null))['then'](saveUpdates(_0x580d45[_0x983c('0x49')],null))[_0x983c('0x26')](respondWithResult(_0x17a8cd,null))[_0x983c('0x45')](handleError(_0x17a8cd,null));};exports[_0x983c('0x25')]=function(_0x23f262,_0x3d1854){return db['Trigger']['find']({'where':{'id':_0x23f262[_0x983c('0x46')]['id']}})['then'](handleEntityNotFound(_0x3d1854,null))[_0x983c('0x26')](removeEntity(_0x3d1854,null))[_0x983c('0x45')](handleError(_0x3d1854,null));};exports[_0x983c('0x51')]=function(_0x42bfc5,_0x400d1d,_0x49378c){if(_0x42bfc5[_0x983c('0x49')]['id']){delete _0x42bfc5[_0x983c('0x49')]['id'];}return db[_0x983c('0x2e')][_0x983c('0x4e')]({'where':{'id':_0x42bfc5['params']['id']}})['then'](handleEntityNotFound(_0x400d1d,null))[_0x983c('0x26')](function(_0x2c8862){if(_0x2c8862){_0x42bfc5[_0x983c('0x49')]['TriggerAllId']=_0x2c8862['id'];return db[_0x983c('0x52')][_0x983c('0x48')](_0x42bfc5[_0x983c('0x49')]);}})[_0x983c('0x26')](respondWithResult(_0x400d1d,null))[_0x983c('0x45')](handleError(_0x400d1d,null));};exports[_0x983c('0x53')]=function(_0x46736c,_0x29ffc5,_0x4abe57){if(_0x46736c[_0x983c('0x49')]['id']){delete _0x46736c[_0x983c('0x49')]['id'];}return db['Trigger']['find']({'where':{'id':_0x46736c['params']['id']}})[_0x983c('0x26')](handleEntityNotFound(_0x29ffc5,null))[_0x983c('0x26')](function(_0x3d9ba0){if(_0x3d9ba0){_0x46736c[_0x983c('0x49')][_0x983c('0x54')]=_0x3d9ba0['id'];return db['Condition'][_0x983c('0x48')](_0x46736c[_0x983c('0x49')]);}})[_0x983c('0x26')](respondWithResult(_0x29ffc5,null))[_0x983c('0x45')](handleError(_0x29ffc5,null));};exports[_0x983c('0x55')]=function(_0x44c410,_0x296a39,_0x535dfd){var _0x363b75={};var _0x925389={};var _0x4bc0c1;var _0x156784;return db[_0x983c('0x2e')][_0x983c('0x56')]({'where':{'id':_0x44c410['params']['id']}})['then'](handleEntityNotFound(_0x296a39,null))[_0x983c('0x26')](function(_0x3be6f8){if(_0x3be6f8){_0x4bc0c1=_0x3be6f8;_0x925389[_0x983c('0x32')]=_['keys'](db[_0x983c('0x52')]['rawAttributes']);_0x925389[_0x983c('0x35')]=_[_0x983c('0x33')](_0x44c410[_0x983c('0x35')]);_0x925389['filters']=_[_0x983c('0x34')](_0x925389['model'],_0x925389[_0x983c('0x35')]);_0x363b75[_0x983c('0x36')]=_[_0x983c('0x34')](_0x925389['model'],qs[_0x983c('0x37')](_0x44c410['query']['fields']));_0x363b75[_0x983c('0x36')]=_0x363b75['attributes'][_0x983c('0x38')]?_0x363b75[_0x983c('0x36')]:_0x925389[_0x983c('0x32')];_0x363b75[_0x983c('0x57')]=qs[_0x983c('0x3b')](_0x44c410['query']['sort']);_0x363b75[_0x983c('0x3e')]=qs[_0x983c('0x3d')](_[_0x983c('0x3c')](_0x44c410[_0x983c('0x35')],_0x925389['filters']));if(_0x44c410['query'][_0x983c('0x58')]){_0x363b75['where']=_[_0x983c('0x3f')](_0x363b75[_0x983c('0x3e')],{'$or':_[_0x983c('0x2d')](_0x363b75[_0x983c('0x36')],function(_0x3c4eb4){var _0x160a59={};_0x160a59[_0x3c4eb4]={'$like':'%'+_0x44c410[_0x983c('0x35')][_0x983c('0x58')]+'%'};return _0x160a59;})});}_0x363b75=_['merge']({},_0x363b75,_0x44c410[_0x983c('0x47')]);return _0x4bc0c1['getAllConditions'](_0x363b75);}})[_0x983c('0x26')](function(_0x5f9ec4){if(_0x5f9ec4){_0x156784=_0x5f9ec4[_0x983c('0x38')];if(!_0x44c410[_0x983c('0x35')][_0x983c('0x39')](_0x983c('0x3a'))){_0x363b75[_0x983c('0x1c')]=qs[_0x983c('0x1c')](_0x44c410[_0x983c('0x35')][_0x983c('0x1c')]);_0x363b75['offset']=qs[_0x983c('0x1b')](_0x44c410['query']['offset']);}return _0x4bc0c1[_0x983c('0x55')](_0x363b75);}})['then'](function(_0x1bd31e){if(_0x1bd31e){return _0x1bd31e?{'count':_0x156784,'rows':_0x1bd31e}:null;}})[_0x983c('0x26')](respondWithResult(_0x296a39,null))[_0x983c('0x45')](handleError(_0x296a39,null));};exports['getAnyConditions']=function(_0x270971,_0x40f72e,_0x104712){var _0x231cce={};var _0xc35c={};var _0x4815bd;var _0x44ebbc;return db[_0x983c('0x2e')]['findOne']({'where':{'id':_0x270971['params']['id']}})[_0x983c('0x26')](handleEntityNotFound(_0x40f72e,null))[_0x983c('0x26')](function(_0x3bf310){if(_0x3bf310){_0x4815bd=_0x3bf310;_0xc35c[_0x983c('0x32')]=_[_0x983c('0x33')](db['Condition'][_0x983c('0x2f')]);_0xc35c['query']=_[_0x983c('0x33')](_0x270971[_0x983c('0x35')]);_0xc35c['filters']=_['intersection'](_0xc35c['model'],_0xc35c[_0x983c('0x35')]);_0x231cce[_0x983c('0x36')]=_[_0x983c('0x34')](_0xc35c['model'],qs[_0x983c('0x37')](_0x270971['query'][_0x983c('0x37')]));_0x231cce['attributes']=_0x231cce[_0x983c('0x36')][_0x983c('0x38')]?_0x231cce[_0x983c('0x36')]:_0xc35c['model'];_0x231cce[_0x983c('0x57')]=qs['sort'](_0x270971[_0x983c('0x35')][_0x983c('0x3b')]);_0x231cce[_0x983c('0x3e')]=qs[_0x983c('0x3d')](_['pick'](_0x270971['query'],_0xc35c['filters']));if(_0x270971[_0x983c('0x35')][_0x983c('0x58')]){_0x231cce[_0x983c('0x3e')]=_[_0x983c('0x3f')](_0x231cce[_0x983c('0x3e')],{'$or':_[_0x983c('0x2d')](_0x231cce[_0x983c('0x36')],function(_0x3108e3){var _0x2e50c0={};_0x2e50c0[_0x3108e3]={'$like':'%'+_0x270971[_0x983c('0x35')]['filter']+'%'};return _0x2e50c0;})});}_0x231cce=_[_0x983c('0x3f')]({},_0x231cce,_0x270971[_0x983c('0x47')]);return _0x4815bd['getAnyConditions'](_0x231cce);}})['then'](function(_0x550487){if(_0x550487){_0x44ebbc=_0x550487[_0x983c('0x38')];if(!_0x270971[_0x983c('0x35')][_0x983c('0x39')]('nolimit')){_0x231cce[_0x983c('0x1c')]=qs[_0x983c('0x1c')](_0x270971[_0x983c('0x35')][_0x983c('0x1c')]);_0x231cce[_0x983c('0x1b')]=qs[_0x983c('0x1b')](_0x270971[_0x983c('0x35')]['offset']);}return _0x4815bd['getAnyConditions'](_0x231cce);}})['then'](function(_0x39ba59){if(_0x39ba59){return _0x39ba59?{'count':_0x44ebbc,'rows':_0x39ba59}:null;}})['then'](respondWithResult(_0x40f72e,null))['catch'](handleError(_0x40f72e,null));};exports[_0x983c('0x59')]=function(_0x15ae0d,_0x1b6ceb,_0x3bf034){if(_0x15ae0d['body']['id']){delete _0x15ae0d[_0x983c('0x49')]['id'];}return db['Trigger'][_0x983c('0x4e')]({'where':{'id':_0x15ae0d['params']['id']}})['then'](handleEntityNotFound(_0x1b6ceb,null))[_0x983c('0x26')](function(_0x401628){if(_0x401628){_0x15ae0d[_0x983c('0x49')]['TriggerId']=_0x401628['id'];return db[_0x983c('0x5a')][_0x983c('0x48')](_0x15ae0d[_0x983c('0x49')]);}})['then'](respondWithResult(_0x1b6ceb,null))[_0x983c('0x45')](handleError(_0x1b6ceb,null));};exports[_0x983c('0x5b')]=function(_0x366c37,_0x46a36f,_0x1ca9c7){var _0x4f4146={};var _0x3a155a={};var _0x214c3b;var _0x2a48a4;return db[_0x983c('0x2e')]['findOne']({'where':{'id':_0x366c37[_0x983c('0x46')]['id']}})[_0x983c('0x26')](handleEntityNotFound(_0x46a36f,null))[_0x983c('0x26')](function(_0x13852e){if(_0x13852e){_0x214c3b=_0x13852e;_0x3a155a['model']=_[_0x983c('0x33')](db[_0x983c('0x5a')][_0x983c('0x2f')]);_0x3a155a[_0x983c('0x35')]=_['keys'](_0x366c37['query']);_0x3a155a['filters']=_[_0x983c('0x34')](_0x3a155a['model'],_0x3a155a['query']);_0x4f4146[_0x983c('0x36')]=_[_0x983c('0x34')](_0x3a155a['model'],qs[_0x983c('0x37')](_0x366c37[_0x983c('0x35')][_0x983c('0x37')]));_0x4f4146['attributes']=_0x4f4146['attributes'][_0x983c('0x38')]?_0x4f4146[_0x983c('0x36')]:_0x3a155a[_0x983c('0x32')];_0x4f4146['order']=qs[_0x983c('0x3b')](_0x366c37[_0x983c('0x35')][_0x983c('0x3b')]);_0x4f4146[_0x983c('0x3e')]=qs[_0x983c('0x3d')](_[_0x983c('0x3c')](_0x366c37[_0x983c('0x35')],_0x3a155a[_0x983c('0x3d')]));if(_0x366c37[_0x983c('0x35')][_0x983c('0x58')]){_0x4f4146[_0x983c('0x3e')]=_[_0x983c('0x3f')](_0x4f4146[_0x983c('0x3e')],{'$or':_[_0x983c('0x2d')](_0x4f4146[_0x983c('0x36')],function(_0x4a77de){var _0x357000={};_0x357000[_0x4a77de]={'$like':'%'+_0x366c37[_0x983c('0x35')]['filter']+'%'};return _0x357000;})});}_0x4f4146=_[_0x983c('0x3f')]({},_0x4f4146,_0x366c37[_0x983c('0x47')]);return _0x214c3b[_0x983c('0x5b')](_0x4f4146);}})['then'](function(_0x452f15){if(_0x452f15){_0x2a48a4=_0x452f15[_0x983c('0x38')];if(!_0x366c37['query'][_0x983c('0x39')](_0x983c('0x3a'))){_0x4f4146['limit']=qs[_0x983c('0x1c')](_0x366c37[_0x983c('0x35')][_0x983c('0x1c')]);_0x4f4146['offset']=qs[_0x983c('0x1b')](_0x366c37[_0x983c('0x35')][_0x983c('0x1b')]);}return _0x214c3b[_0x983c('0x5b')](_0x4f4146);}})[_0x983c('0x26')](function(_0x564ee6){if(_0x564ee6){return _0x564ee6?{'count':_0x2a48a4,'rows':_0x564ee6}:null;}})['then'](respondWithResult(_0x46a36f,null))[_0x983c('0x45')](handleError(_0x46a36f,null));}; \ No newline at end of file diff --git a/server/api/trigger/trigger.model.js b/server/api/trigger/trigger.model.js index e73e044..94930f5 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 _0xfc76=['tools_triggers','util','../../config/logger','api','moment','bluebird','path','rimraf','./trigger.attributes','define'];(function(_0x1f320c,_0x22e8a9){var _0x4f340d=function(_0x6cea14){while(--_0x6cea14){_0x1f320c['push'](_0x1f320c['shift']());}};_0x4f340d(++_0x22e8a9);}(_0xfc76,0xb5));var _0x6fc7=function(_0xe13377,_0x819f64){_0xe13377=_0xe13377-0x0;var _0x15ba64=_0xfc76[_0xe13377];return _0x15ba64;};'use strict';var _=require('lodash');var util=require(_0x6fc7('0x0'));var logger=require(_0x6fc7('0x1'))(_0x6fc7('0x2'));var moment=require(_0x6fc7('0x3'));var BPromise=require(_0x6fc7('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6fc7('0x5'));var rimraf=require(_0x6fc7('0x6'));var config=require('../../config/environment');var attributes=require(_0x6fc7('0x7'));module['exports']=function(_0xe8177b,_0x82a35a){return _0xe8177b[_0x6fc7('0x8')]('Trigger',attributes,{'tableName':_0x6fc7('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4a80=['api','bluebird','request-promise','path','rimraf','../../config/environment','./trigger.attributes','exports','define','tools_triggers','lodash','../../config/logger'];(function(_0x28ac6e,_0x3705eb){var _0x372a24=function(_0x457d06){while(--_0x457d06){_0x28ac6e['push'](_0x28ac6e['shift']());}};_0x372a24(++_0x3705eb);}(_0x4a80,0xbe));var _0x04a8=function(_0x3e41aa,_0x3b5f7e){_0x3e41aa=_0x3e41aa-0x0;var _0x28ab00=_0x4a80[_0x3e41aa];return _0x28ab00;};'use strict';var _=require(_0x04a8('0x0'));var util=require('util');var logger=require(_0x04a8('0x1'))(_0x04a8('0x2'));var moment=require('moment');var BPromise=require(_0x04a8('0x3'));var rp=require(_0x04a8('0x4'));var fs=require('fs');var path=require(_0x04a8('0x5'));var rimraf=require(_0x04a8('0x6'));var config=require(_0x04a8('0x7'));var attributes=require(_0x04a8('0x8'));module[_0x04a8('0x9')]=function(_0x353b43,_0x709eea){return _0x353b43[_0x04a8('0xa')]('Trigger',attributes,{'tableName':_0x04a8('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 93f02d1..db66798 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 _0xb531=['randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','Trigger,\x20%s,\x20%s','request\x20sent','Trigger,\x20%s,\x20%s,\x20%s','stringify','code','error','message','info','catch','GetTrigger','Trigger','findAll','options','raw','where','attributes','limit','include','map','model','then','ShowTrigger','find','lodash','moment','bluebird'];(function(_0x1b87d1,_0x5d5014){var _0x4eede7=function(_0x42aaa9){while(--_0x42aaa9){_0x1b87d1['push'](_0x1b87d1['shift']());}};_0x4eede7(++_0x5d5014);}(_0xb531,0x115));var _0x1b53=function(_0x24831b,_0x57ec2c){_0x24831b=_0x24831b-0x0;var _0x76e887=_0xb531[_0x24831b];return _0x76e887;};'use strict';var _=require(_0x1b53('0x0'));var util=require('util');var moment=require(_0x1b53('0x1'));var BPromise=require(_0x1b53('0x2'));var rs=require(_0x1b53('0x3'));var fs=require('fs');var Redis=require(_0x1b53('0x4'));var db=require(_0x1b53('0x5'))['db'];var utils=require(_0x1b53('0x6'));var logger=require('../../config/logger')(_0x1b53('0x7'));var config=require('../../config/environment');var jayson=require(_0x1b53('0x8'));var client=jayson[_0x1b53('0x9')][_0x1b53('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x53ed77,_0x5f193c,_0x33cbd3){return new BPromise(function(_0x4fea61,_0x39c549){return client[_0x1b53('0xb')](_0x53ed77,_0x33cbd3)['then'](function(_0x3ecace){logger['info'](_0x1b53('0xc'),_0x5f193c,_0x1b53('0xd'));logger['debug'](_0x1b53('0xe'),_0x5f193c,_0x1b53('0xd'),JSON[_0x1b53('0xf')](_0x3ecace));if(_0x3ecace['error']){if(_0x3ecace['error'][_0x1b53('0x10')]===0x1f4){logger['error'](_0x1b53('0xc'),_0x5f193c,_0x3ecace[_0x1b53('0x11')][_0x1b53('0x12')]);return _0x39c549(_0x3ecace[_0x1b53('0x11')]['message']);}logger[_0x1b53('0x11')]('Trigger,\x20%s,\x20%s',_0x5f193c,_0x3ecace['error'][_0x1b53('0x12')]);return _0x4fea61(_0x3ecace['error'][_0x1b53('0x12')]);}else{logger[_0x1b53('0x13')]('Trigger,\x20%s,\x20%s',_0x5f193c,_0x1b53('0xd'));_0x4fea61(_0x3ecace['result'][_0x1b53('0x12')]);}})[_0x1b53('0x14')](function(_0x1aaa1d){logger[_0x1b53('0x11')](_0x1b53('0xc'),_0x5f193c,_0x1aaa1d);_0x39c549(_0x1aaa1d);});});}exports[_0x1b53('0x15')]=function(_0x435e1e){var _0x72a1bb=this;return new Promise(function(_0xb248a7,_0x47f715){return db[_0x1b53('0x16')][_0x1b53('0x17')]({'raw':_0x435e1e[_0x1b53('0x18')]?_0x435e1e['options'][_0x1b53('0x19')]===undefined?!![]:![]:!![],'where':_0x435e1e['options']?_0x435e1e[_0x1b53('0x18')][_0x1b53('0x1a')]||null:null,'attributes':_0x435e1e[_0x1b53('0x18')]?_0x435e1e[_0x1b53('0x18')][_0x1b53('0x1b')]||null:null,'limit':_0x435e1e[_0x1b53('0x18')]?_0x435e1e[_0x1b53('0x18')][_0x1b53('0x1c')]||null:null,'include':_0x435e1e['options']?_0x435e1e[_0x1b53('0x18')][_0x1b53('0x1d')]?_[_0x1b53('0x1e')](_0x435e1e[_0x1b53('0x18')][_0x1b53('0x1d')],function(_0x39dbfa){return{'model':db[_0x39dbfa[_0x1b53('0x1f')]],'as':_0x39dbfa['as'],'attributes':_0x39dbfa[_0x1b53('0x1b')],'include':_0x39dbfa[_0x1b53('0x1d')]?_[_0x1b53('0x1e')](_0x39dbfa['include'],function(_0x2f8785){return{'model':db[_0x2f8785[_0x1b53('0x1f')]],'as':_0x2f8785['as'],'attributes':_0x2f8785[_0x1b53('0x1b')],'include':_0x2f8785['include']?_['map'](_0x2f8785[_0x1b53('0x1d')],function(_0x550714){return{'model':db[_0x550714[_0x1b53('0x1f')]],'as':_0x550714['as'],'attributes':_0x550714[_0x1b53('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x1b53('0x20')](function(_0x58b5da){logger['info']('GetTrigger',_0x435e1e);logger['debug'](_0x1b53('0x15'),_0x435e1e,JSON['stringify'](_0x58b5da));_0xb248a7(_0x58b5da);})['catch'](function(_0x11b40c){logger[_0x1b53('0x11')](_0x1b53('0x15'),_0x11b40c[_0x1b53('0x12')],_0x435e1e);_0x47f715(_0x72a1bb[_0x1b53('0x11')](0x1f4,_0x11b40c[_0x1b53('0x12')]));});});};exports[_0x1b53('0x21')]=function(_0x10fde9){var _0x44a764=this;return new Promise(function(_0x5c040c,_0x3ed04b){return db[_0x1b53('0x16')][_0x1b53('0x22')]({'raw':_0x10fde9[_0x1b53('0x18')]?_0x10fde9[_0x1b53('0x18')][_0x1b53('0x19')]===undefined?!![]:![]:!![],'where':_0x10fde9[_0x1b53('0x18')]?_0x10fde9[_0x1b53('0x18')][_0x1b53('0x1a')]||null:null,'attributes':_0x10fde9[_0x1b53('0x18')]?_0x10fde9[_0x1b53('0x18')][_0x1b53('0x1b')]||null:null,'include':_0x10fde9['options']?_0x10fde9[_0x1b53('0x18')][_0x1b53('0x1d')]?_['map'](_0x10fde9[_0x1b53('0x18')]['include'],function(_0x3a63f0){return{'model':db[_0x3a63f0['model']],'as':_0x3a63f0['as'],'attributes':_0x3a63f0[_0x1b53('0x1b')],'include':_0x3a63f0['include']?_[_0x1b53('0x1e')](_0x3a63f0[_0x1b53('0x1d')],function(_0x269ab0){return{'model':db[_0x269ab0[_0x1b53('0x1f')]],'as':_0x269ab0['as'],'attributes':_0x269ab0[_0x1b53('0x1b')],'include':_0x269ab0[_0x1b53('0x1d')]?_[_0x1b53('0x1e')](_0x269ab0[_0x1b53('0x1d')],function(_0x4058f1){return{'model':db[_0x4058f1[_0x1b53('0x1f')]],'as':_0x4058f1['as'],'attributes':_0x4058f1[_0x1b53('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x1b53('0x20')](function(_0x2f005d){logger[_0x1b53('0x13')](_0x1b53('0x21'),_0x10fde9);logger['debug'](_0x1b53('0x21'),_0x10fde9,JSON['stringify'](_0x2f005d));_0x5c040c(_0x2f005d);})[_0x1b53('0x14')](function(_0x43ea4d){logger[_0x1b53('0x11')](_0x1b53('0x21'),_0x43ea4d[_0x1b53('0x12')],_0x10fde9);_0x3ed04b(_0x44a764[_0x1b53('0x11')](0x1f4,_0x43ea4d['message']));});});}; \ No newline at end of file +var _0xdf18=['ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','request\x20sent','Trigger,\x20%s,\x20%s,\x20%s','stringify','code','error','Trigger,\x20%s,\x20%s','message','info','result','Trigger','options','raw','limit','include','map','model','attributes','GetTrigger','debug','find','where','then','ShowTrigger','catch','lodash','moment','bluebird','randomstring'];(function(_0x470711,_0x415ae0){var _0x33b3aa=function(_0x4fb7c0){while(--_0x4fb7c0){_0x470711['push'](_0x470711['shift']());}};_0x33b3aa(++_0x415ae0);}(_0xdf18,0x1d8));var _0x8df1=function(_0x4dba0d,_0x92bb78){_0x4dba0d=_0x4dba0d-0x0;var _0x50cf83=_0xdf18[_0x4dba0d];return _0x50cf83;};'use strict';var _=require(_0x8df1('0x0'));var util=require('util');var moment=require(_0x8df1('0x1'));var BPromise=require(_0x8df1('0x2'));var rs=require(_0x8df1('0x3'));var fs=require('fs');var Redis=require(_0x8df1('0x4'));var db=require(_0x8df1('0x5'))['db'];var utils=require(_0x8df1('0x6'));var logger=require('../../config/logger')(_0x8df1('0x7'));var config=require('../../config/environment');var jayson=require(_0x8df1('0x8'));var client=jayson[_0x8df1('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1cefc6,_0x4944cd,_0x3c56db){return new BPromise(function(_0x9186aa,_0x36856b){return client['request'](_0x1cefc6,_0x3c56db)['then'](function(_0x1bfa3b){logger['info']('Trigger,\x20%s,\x20%s',_0x4944cd,_0x8df1('0xa'));logger['debug'](_0x8df1('0xb'),_0x4944cd,'request\x20sent',JSON[_0x8df1('0xc')](_0x1bfa3b));if(_0x1bfa3b['error']){if(_0x1bfa3b['error'][_0x8df1('0xd')]===0x1f4){logger[_0x8df1('0xe')](_0x8df1('0xf'),_0x4944cd,_0x1bfa3b[_0x8df1('0xe')][_0x8df1('0x10')]);return _0x36856b(_0x1bfa3b['error'][_0x8df1('0x10')]);}logger[_0x8df1('0xe')](_0x8df1('0xf'),_0x4944cd,_0x1bfa3b['error']['message']);return _0x9186aa(_0x1bfa3b[_0x8df1('0xe')]['message']);}else{logger[_0x8df1('0x11')](_0x8df1('0xf'),_0x4944cd,_0x8df1('0xa'));_0x9186aa(_0x1bfa3b[_0x8df1('0x12')]['message']);}})['catch'](function(_0x2c9b29){logger[_0x8df1('0xe')](_0x8df1('0xf'),_0x4944cd,_0x2c9b29);_0x36856b(_0x2c9b29);});});}exports['GetTrigger']=function(_0x1c7709){var _0x503795=this;return new Promise(function(_0x111cc8,_0x67800c){return db[_0x8df1('0x13')]['findAll']({'raw':_0x1c7709[_0x8df1('0x14')]?_0x1c7709[_0x8df1('0x14')][_0x8df1('0x15')]===undefined?!![]:![]:!![],'where':_0x1c7709[_0x8df1('0x14')]?_0x1c7709[_0x8df1('0x14')]['where']||null:null,'attributes':_0x1c7709[_0x8df1('0x14')]?_0x1c7709[_0x8df1('0x14')]['attributes']||null:null,'limit':_0x1c7709[_0x8df1('0x14')]?_0x1c7709['options'][_0x8df1('0x16')]||null:null,'include':_0x1c7709[_0x8df1('0x14')]?_0x1c7709[_0x8df1('0x14')][_0x8df1('0x17')]?_[_0x8df1('0x18')](_0x1c7709[_0x8df1('0x14')][_0x8df1('0x17')],function(_0x22bd23){return{'model':db[_0x22bd23[_0x8df1('0x19')]],'as':_0x22bd23['as'],'attributes':_0x22bd23['attributes'],'include':_0x22bd23['include']?_[_0x8df1('0x18')](_0x22bd23[_0x8df1('0x17')],function(_0x567367){return{'model':db[_0x567367['model']],'as':_0x567367['as'],'attributes':_0x567367[_0x8df1('0x1a')],'include':_0x567367['include']?_[_0x8df1('0x18')](_0x567367['include'],function(_0x20055b){return{'model':db[_0x20055b[_0x8df1('0x19')]],'as':_0x20055b['as'],'attributes':_0x20055b['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x5dc718){logger[_0x8df1('0x11')](_0x8df1('0x1b'),_0x1c7709);logger[_0x8df1('0x1c')](_0x8df1('0x1b'),_0x1c7709,JSON[_0x8df1('0xc')](_0x5dc718));_0x111cc8(_0x5dc718);})['catch'](function(_0x5beb35){logger['error']('GetTrigger',_0x5beb35['message'],_0x1c7709);_0x67800c(_0x503795[_0x8df1('0xe')](0x1f4,_0x5beb35[_0x8df1('0x10')]));});});};exports['ShowTrigger']=function(_0x26c03c){var _0x2e0b41=this;return new Promise(function(_0x259d54,_0x4d50ca){return db[_0x8df1('0x13')][_0x8df1('0x1d')]({'raw':_0x26c03c[_0x8df1('0x14')]?_0x26c03c[_0x8df1('0x14')]['raw']===undefined?!![]:![]:!![],'where':_0x26c03c[_0x8df1('0x14')]?_0x26c03c[_0x8df1('0x14')][_0x8df1('0x1e')]||null:null,'attributes':_0x26c03c['options']?_0x26c03c[_0x8df1('0x14')][_0x8df1('0x1a')]||null:null,'include':_0x26c03c['options']?_0x26c03c[_0x8df1('0x14')][_0x8df1('0x17')]?_['map'](_0x26c03c[_0x8df1('0x14')][_0x8df1('0x17')],function(_0x2934cf){return{'model':db[_0x2934cf[_0x8df1('0x19')]],'as':_0x2934cf['as'],'attributes':_0x2934cf[_0x8df1('0x1a')],'include':_0x2934cf[_0x8df1('0x17')]?_['map'](_0x2934cf[_0x8df1('0x17')],function(_0x5ecd81){return{'model':db[_0x5ecd81[_0x8df1('0x19')]],'as':_0x5ecd81['as'],'attributes':_0x5ecd81[_0x8df1('0x1a')],'include':_0x5ecd81[_0x8df1('0x17')]?_[_0x8df1('0x18')](_0x5ecd81[_0x8df1('0x17')],function(_0x369896){return{'model':db[_0x369896[_0x8df1('0x19')]],'as':_0x369896['as'],'attributes':_0x369896[_0x8df1('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x8df1('0x1f')](function(_0x293253){logger['info'](_0x8df1('0x20'),_0x26c03c);logger['debug'](_0x8df1('0x20'),_0x26c03c,JSON[_0x8df1('0xc')](_0x293253));_0x259d54(_0x293253);})[_0x8df1('0x21')](function(_0x3d8607){logger[_0x8df1('0xe')](_0x8df1('0x20'),_0x3d8607[_0x8df1('0x10')],_0x26c03c);_0x4d50ca(_0x2e0b41['error'](0x1f4,_0x3d8607[_0x8df1('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/trunk/index.js b/server/api/trunk/index.js index 934fabd..dc0b248 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 _0xda2f=['/:id','post','/:id/clone','clone','put','delete','destroy','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','./trunk.controller','get','isAuthenticated','index'];(function(_0x15b380,_0x1a3c5f){var _0x232c5c=function(_0x12f8e0){while(--_0x12f8e0){_0x15b380['push'](_0x15b380['shift']());}};_0x232c5c(++_0x1a3c5f);}(_0xda2f,0x1db));var _0xfda2=function(_0x275641,_0x134533){_0x275641=_0x275641-0x0;var _0x2f9590=_0xda2f[_0x275641];return _0x2f9590;};'use strict';var multer=require(_0xfda2('0x0'));var util=require(_0xfda2('0x1'));var path=require(_0xfda2('0x2'));var timeout=require(_0xfda2('0x3'));var express=require(_0xfda2('0x4'));var router=express[_0xfda2('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xfda2('0x6'));var config=require('../../config/environment');var controller=require(_0xfda2('0x7'));router[_0xfda2('0x8')]('/',auth[_0xfda2('0x9')](),controller[_0xfda2('0xa')]);router[_0xfda2('0x8')](_0xfda2('0xb'),auth[_0xfda2('0x9')](),controller['show']);router[_0xfda2('0xc')](_0xfda2('0xd'),auth[_0xfda2('0x9')](),controller[_0xfda2('0xe')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0xfda2('0xf')](_0xfda2('0xb'),auth['isAuthenticated'](),controller['update']);router[_0xfda2('0x10')](_0xfda2('0xb'),auth['isAuthenticated'](),controller[_0xfda2('0x11')]);module['exports']=router; \ No newline at end of file +var _0xe908=['./trunk.controller','get','index','/:id','isAuthenticated','create','put','update','delete','exports','multer','path','express','Router','fs-extra','../../components/auth/service','../../config/environment'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xe908,0xf8));var _0x8e90=function(_0x465a0c,_0x19d4d5){_0x465a0c=_0x465a0c-0x0;var _0x1e202e=_0xe908[_0x465a0c];return _0x1e202e;};'use strict';var multer=require(_0x8e90('0x0'));var util=require('util');var path=require(_0x8e90('0x1'));var timeout=require('connect-timeout');var express=require(_0x8e90('0x2'));var router=express[_0x8e90('0x3')]();var fs_extra=require(_0x8e90('0x4'));var auth=require(_0x8e90('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x8e90('0x6'));var controller=require(_0x8e90('0x7'));router[_0x8e90('0x8')]('/',auth['isAuthenticated'](),controller[_0x8e90('0x9')]);router[_0x8e90('0x8')](_0x8e90('0xa'),auth[_0x8e90('0xb')](),controller['show']);router['post']('/:id/clone',auth[_0x8e90('0xb')](),controller['clone']);router['post']('/',auth[_0x8e90('0xb')](),controller[_0x8e90('0xc')]);router[_0x8e90('0xd')](_0x8e90('0xa'),auth[_0x8e90('0xb')](),controller[_0x8e90('0xe')]);router[_0x8e90('0xf')](_0x8e90('0xa'),auth[_0x8e90('0xb')](),controller['destroy']);module[_0x8e90('0x10')]=router; \ No newline at end of file diff --git a/server/api/trunk/trunk.attributes.js b/server/api/trunk/trunk.attributes.js index 13f9556..fd6afd8 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 _0x2067=['ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','udp','setDataValue','transport','join','getDataValue','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','shortinfo','inband','auto','nonat','outgoing','yes','force_rport,comedia','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]','port,invite','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','\x22\x22\x20<>','INTEGER','always','accept','refuse','originate','uas','pai','fingerprint','passive','dynamic','BOOLEAN','sequelize','exports','STRING','friend','user','peer','from-voip-provider','ENUM'];(function(_0x11d8ec,_0x5108ec){var _0x19e852=function(_0x3b0619){while(--_0x3b0619){_0x11d8ec['push'](_0x11d8ec['shift']());}};_0x19e852(++_0x5108ec);}(_0x2067,0x94));var _0x7206=function(_0x8a0140,_0x4a1b16){_0x8a0140=_0x8a0140-0x0;var _0x1be8a8=_0x2067[_0x8a0140];return _0x1be8a8;};'use strict';var Sequelize=require(_0x7206('0x0'));module[_0x7206('0x1')]={'name':{'type':Sequelize[_0x7206('0x2')],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize['ENUM'](_0x7206('0x3'),_0x7206('0x4'),_0x7206('0x5')),'allowNull':![],'defaultValue':_0x7206('0x3')},'context':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x7206('0x6')},'callingpres':{'type':Sequelize[_0x7206('0x7')](_0x7206('0x8'),_0x7206('0x9'),_0x7206('0xa'),_0x7206('0xb'),_0x7206('0xc'),_0x7206('0xd'),_0x7206('0xe'),_0x7206('0xf'))},'deny':{'type':Sequelize[_0x7206('0x2')]},'permit':{'type':Sequelize[_0x7206('0x2')]},'secret':{'type':Sequelize[_0x7206('0x2')]},'md5secret':{'type':Sequelize['STRING']},'remotesecret':{'type':Sequelize[_0x7206('0x2')]},'transport':{'type':Sequelize[_0x7206('0x2')],'defaultValue':_0x7206('0x10'),'set':function(_0x4b5065){this[_0x7206('0x11')](_0x7206('0x12'),_0x4b5065?_0x4b5065[_0x7206('0x13')](','):null);},'get':function(){return this[_0x7206('0x14')](_0x7206('0x12'))?this['getDataValue'](_0x7206('0x12'))[_0x7206('0x15')](','):null;},'comment':_0x7206('0x16')},'dtmfmode':{'type':Sequelize['ENUM'](_0x7206('0x17'),'info',_0x7206('0x18'),_0x7206('0x19'),_0x7206('0x1a')),'defaultValue':_0x7206('0x17')},'directmedia':{'type':Sequelize[_0x7206('0x7')]('yes','no',_0x7206('0x1b'),'update',_0x7206('0x1c')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize['ENUM'](_0x7206('0x1d'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x7206('0x2')]},'directmediadeny':{'type':Sequelize[_0x7206('0x2')]},'nat':{'type':Sequelize[_0x7206('0x2')],'defaultValue':_0x7206('0x1e'),'set':function(_0x309fe0){this[_0x7206('0x11')](_0x7206('0x1f'),_0x309fe0?_0x309fe0[_0x7206('0x13')](','):null);},'get':function(){return this['getDataValue']('nat')?this[_0x7206('0x14')]('nat')[_0x7206('0x15')](','):null;},'comment':_0x7206('0x20')},'callgroup':{'type':Sequelize[_0x7206('0x2')]},'namedcallgroup':{'type':Sequelize[_0x7206('0x2')]},'pickupgroup':{'type':Sequelize[_0x7206('0x2')]},'namedpickupgroup':{'type':Sequelize[_0x7206('0x2')]},'language':{'type':Sequelize['STRING'],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x7206('0x2')],'allowNull':!![]},'disallow':{'type':Sequelize[_0x7206('0x2')],'defaultValue':_0x7206('0x21')},'allow':{'type':Sequelize[_0x7206('0x2')],'allowNull':![],'defaultValue':_0x7206('0x22'),'set':function(_0x12a5af){this[_0x7206('0x11')](_0x7206('0x23'),_0x12a5af?_0x12a5af[_0x7206('0x13')](';'):_0x7206('0x22'));},'get':function(){return this[_0x7206('0x14')](_0x7206('0x23'))?this[_0x7206('0x14')](_0x7206('0x23'))[_0x7206('0x15')](';'):null;},'comment':_0x7206('0x24')},'autoframing':{'type':Sequelize[_0x7206('0x7')](_0x7206('0x1d'),'no')},'insecure':{'type':Sequelize[_0x7206('0x2')],'defaultValue':_0x7206('0x25'),'set':function(_0x3757d3){this['setDataValue'](_0x7206('0x26'),_0x3757d3?_0x3757d3[_0x7206('0x13')](','):null);},'get':function(){return this[_0x7206('0x14')](_0x7206('0x26'))?this[_0x7206('0x14')](_0x7206('0x26'))[_0x7206('0x15')](','):null;},'comment':_0x7206('0x27')},'trustrpid':{'type':Sequelize[_0x7206('0x7')]('yes','no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x7206('0x7')](_0x7206('0x1d'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x7206('0x7')](_0x7206('0x1d'),'no','never')},'promiscredir':{'type':Sequelize[_0x7206('0x7')](_0x7206('0x1d'),'no')},'useclientcode':{'type':Sequelize[_0x7206('0x7')](_0x7206('0x1d'),'no')},'accountcode':{'type':Sequelize['INTEGER'](0xb)},'setvar':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0x7206('0x2')],'defaultValue':_0x7206('0x28')},'amaflags':{'type':Sequelize['STRING']},'callcounter':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':_0x7206('0x1d')},'busylevel':{'type':Sequelize[_0x7206('0x29')](0xb)},'allowoverlap':{'type':Sequelize[_0x7206('0x7')](_0x7206('0x1d'),'no')},'allowsubscribe':{'type':Sequelize[_0x7206('0x7')](_0x7206('0x1d'),'no')},'allowtransfer':{'type':Sequelize[_0x7206('0x7')](_0x7206('0x1d'),'no')},'ignoresdpversion':{'type':Sequelize[_0x7206('0x7')](_0x7206('0x1d'),'no')},'subscribecontext':{'type':Sequelize['STRING']},'template':{'type':Sequelize['STRING']},'videosupport':{'type':Sequelize[_0x7206('0x7')]('yes','no',_0x7206('0x2a')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x7206('0x29')](0xb)},'rfc2833compensate':{'type':Sequelize[_0x7206('0x7')]('yes','no')},'mailbox':{'type':Sequelize[_0x7206('0x2')]},'session_timers':{'type':Sequelize[_0x7206('0x7')](_0x7206('0x2b'),_0x7206('0x2c'),_0x7206('0x2d'))},'session_expires':{'type':Sequelize[_0x7206('0x29')](0xb)},'session_minse':{'type':Sequelize[_0x7206('0x29')](0xb)},'session_refresher':{'type':Sequelize[_0x7206('0x7')]('uac',_0x7206('0x2e')),'defaultValue':'uas'},'t38pt_usertpsource':{'type':Sequelize['STRING']},'regexten':{'type':Sequelize[_0x7206('0x2')]},'fromdomain':{'type':Sequelize[_0x7206('0x2')]},'fromuser':{'type':Sequelize[_0x7206('0x2')]},'port':{'type':Sequelize[_0x7206('0x29')](0x5)},'qualify':{'type':Sequelize['ENUM'](_0x7206('0x1d'),'no'),'defaultValue':'yes'},'keepalive':{'type':Sequelize[_0x7206('0x29')](0xb)},'defaultip':{'type':Sequelize['STRING']},'defaultuser':{'type':Sequelize[_0x7206('0x2')]},'rtptimeout':{'type':Sequelize[_0x7206('0x29')](0xb)},'rtpholdtimeout':{'type':Sequelize[_0x7206('0x29')](0xb)},'rtpkeepalive':{'type':Sequelize[_0x7206('0x29')](0xb)},'sendrpid':{'type':Sequelize[_0x7206('0x7')](_0x7206('0x1d'),'no',_0x7206('0x2f')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize['STRING']},'callbackextension':{'type':Sequelize[_0x7206('0x2')]},'timert1':{'type':Sequelize[_0x7206('0x29')](0xb)},'timerb':{'type':Sequelize['INTEGER'](0xb)},'qualifyfreq':{'type':Sequelize[_0x7206('0x29')](0xb)},'contactpermit':{'type':Sequelize[_0x7206('0x2')]},'contactdeny':{'type':Sequelize[_0x7206('0x2')]},'contactacl':{'type':Sequelize[_0x7206('0x2')]},'unsolicited_mailbox':{'type':Sequelize[_0x7206('0x2')]},'use_q850_reason':{'type':Sequelize['STRING']},'maxforwards':{'type':Sequelize['INTEGER'](0xb)},'encryption':{'type':Sequelize[_0x7206('0x7')](_0x7206('0x1d'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0x7206('0x7')](_0x7206('0x1d'),'no')},'force_avp':{'type':Sequelize[_0x7206('0x7')](_0x7206('0x1d'),'no')},'icesupport':{'type':Sequelize[_0x7206('0x7')]('yes','no')},'dtlsenable':{'type':Sequelize[_0x7206('0x7')](_0x7206('0x1d'),'no')},'dtlsverify':{'type':Sequelize[_0x7206('0x7')](_0x7206('0x1d'),'no',_0x7206('0x30'),'certificate')},'dtlsrekey':{'type':Sequelize[_0x7206('0x29')](0xb)},'dtlscertfile':{'type':Sequelize[_0x7206('0x2')]},'dtlsprivatekey':{'type':Sequelize['STRING']},'dtlscipher':{'type':Sequelize['STRING']},'dtlscafile':{'type':Sequelize['STRING']},'dtlscapath':{'type':Sequelize[_0x7206('0x2')]},'dtlssetup':{'type':Sequelize['ENUM']('active',_0x7206('0x31'),'actpass'),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize['STRING']},'usereqphone':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x7206('0x2')]},'recordofffeature':{'type':Sequelize[_0x7206('0x2')]},'call_limit':{'type':Sequelize[_0x7206('0x29')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize['ENUM'](_0x7206('0x1d'),'no')},'subscribemwi':{'type':Sequelize['ENUM'](_0x7206('0x1d'),'no')},'vmexten':{'type':Sequelize[_0x7206('0x2')]},'mohinterpret':{'type':Sequelize[_0x7206('0x2')]},'mohsuggest':{'type':Sequelize[_0x7206('0x2')]},'parkinglot':{'type':Sequelize[_0x7206('0x2')]},'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize['STRING'],'defaultValue':_0x7206('0x32')},'canreinvite':{'type':Sequelize[_0x7206('0x7')](_0x7206('0x1d'),'no','nonat','update','update,nonat'),'defaultValue':'no'},'registry':{'type':Sequelize['STRING']},'otherFields':{'type':Sequelize[_0x7206('0x2')]},'active':{'type':Sequelize[_0x7206('0x33')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0x7206('0x2')],'defaultValue':'no'}}; \ No newline at end of file +var _0xfc59=['BOOLEAN','sequelize','exports','STRING','name','ENUM','friend','user','peer','from-voip-provider','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','udp','setDataValue','transport','getDataValue','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','shortinfo','auto','yes','nonat','update','nat','join','all','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]','port,invite','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','INTEGER','refuse','originate','uac','uas','pai','fingerprint','certificate','active','dynamic','update,nonat'];(function(_0x43d11d,_0xccff91){var _0x38cd08=function(_0x131ae2){while(--_0x131ae2){_0x43d11d['push'](_0x43d11d['shift']());}};_0x38cd08(++_0xccff91);}(_0xfc59,0x1cc));var _0x9fc5=function(_0x3b09c7,_0x1584a1){_0x3b09c7=_0x3b09c7-0x0;var _0x3465a7=_0xfc59[_0x3b09c7];return _0x3465a7;};'use strict';var Sequelize=require(_0x9fc5('0x0'));module[_0x9fc5('0x1')]={'name':{'type':Sequelize[_0x9fc5('0x2')],'allowNull':![],'unique':_0x9fc5('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x9fc5('0x4')](_0x9fc5('0x5'),_0x9fc5('0x6'),_0x9fc5('0x7')),'allowNull':![],'defaultValue':_0x9fc5('0x5')},'context':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x9fc5('0x8')},'callingpres':{'type':Sequelize[_0x9fc5('0x4')](_0x9fc5('0x9'),_0x9fc5('0xa'),'ALLOWED_FAILED_SCREEN',_0x9fc5('0xb'),_0x9fc5('0xc'),_0x9fc5('0xd'),_0x9fc5('0xe'),_0x9fc5('0xf'))},'deny':{'type':Sequelize[_0x9fc5('0x2')]},'permit':{'type':Sequelize[_0x9fc5('0x2')]},'secret':{'type':Sequelize['STRING']},'md5secret':{'type':Sequelize['STRING']},'remotesecret':{'type':Sequelize[_0x9fc5('0x2')]},'transport':{'type':Sequelize[_0x9fc5('0x2')],'defaultValue':_0x9fc5('0x10'),'set':function(_0x435b06){this[_0x9fc5('0x11')](_0x9fc5('0x12'),_0x435b06?_0x435b06['join'](','):null);},'get':function(){return this[_0x9fc5('0x13')](_0x9fc5('0x12'))?this[_0x9fc5('0x13')]('transport')[_0x9fc5('0x14')](','):null;},'comment':_0x9fc5('0x15')},'dtmfmode':{'type':Sequelize[_0x9fc5('0x4')](_0x9fc5('0x16'),_0x9fc5('0x17'),_0x9fc5('0x18'),'inband',_0x9fc5('0x19')),'defaultValue':'rfc2833'},'directmedia':{'type':Sequelize[_0x9fc5('0x4')](_0x9fc5('0x1a'),'no',_0x9fc5('0x1b'),_0x9fc5('0x1c'),'outgoing'),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x9fc5('0x4')]('yes','no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x9fc5('0x2')]},'directmediadeny':{'type':Sequelize[_0x9fc5('0x2')]},'nat':{'type':Sequelize['STRING'],'defaultValue':'force_rport,comedia','set':function(_0x1b12f4){this[_0x9fc5('0x11')](_0x9fc5('0x1d'),_0x1b12f4?_0x1b12f4[_0x9fc5('0x1e')](','):null);},'get':function(){return this[_0x9fc5('0x13')](_0x9fc5('0x1d'))?this[_0x9fc5('0x13')]('nat')['split'](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]'},'callgroup':{'type':Sequelize['STRING']},'namedcallgroup':{'type':Sequelize[_0x9fc5('0x2')]},'pickupgroup':{'type':Sequelize[_0x9fc5('0x2')]},'namedpickupgroup':{'type':Sequelize[_0x9fc5('0x2')]},'language':{'type':Sequelize[_0x9fc5('0x2')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x9fc5('0x2')],'allowNull':!![]},'disallow':{'type':Sequelize[_0x9fc5('0x2')],'defaultValue':_0x9fc5('0x1f')},'allow':{'type':Sequelize[_0x9fc5('0x2')],'allowNull':![],'defaultValue':_0x9fc5('0x20'),'set':function(_0x368912){this[_0x9fc5('0x11')]('allow',_0x368912?_0x368912[_0x9fc5('0x1e')](';'):_0x9fc5('0x20'));},'get':function(){return this[_0x9fc5('0x13')](_0x9fc5('0x21'))?this['getDataValue'](_0x9fc5('0x21'))[_0x9fc5('0x14')](';'):null;},'comment':_0x9fc5('0x22')},'autoframing':{'type':Sequelize['ENUM'](_0x9fc5('0x1a'),'no')},'insecure':{'type':Sequelize[_0x9fc5('0x2')],'defaultValue':_0x9fc5('0x23'),'set':function(_0x23b4c4){this[_0x9fc5('0x11')]('insecure',_0x23b4c4?_0x23b4c4[_0x9fc5('0x1e')](','):null);},'get':function(){return this[_0x9fc5('0x13')](_0x9fc5('0x24'))?this[_0x9fc5('0x13')](_0x9fc5('0x24'))[_0x9fc5('0x14')](','):null;},'comment':_0x9fc5('0x25')},'trustrpid':{'type':Sequelize[_0x9fc5('0x4')](_0x9fc5('0x1a'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x9fc5('0x4')](_0x9fc5('0x1a'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x9fc5('0x4')]('yes','no',_0x9fc5('0x26'))},'promiscredir':{'type':Sequelize[_0x9fc5('0x4')](_0x9fc5('0x1a'),'no')},'useclientcode':{'type':Sequelize[_0x9fc5('0x4')](_0x9fc5('0x1a'),'no')},'accountcode':{'type':Sequelize[_0x9fc5('0x27')](0xb)},'setvar':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0x9fc5('0x2')],'defaultValue':'\x22\x22\x20<>'},'amaflags':{'type':Sequelize[_0x9fc5('0x2')]},'callcounter':{'type':Sequelize[_0x9fc5('0x4')](_0x9fc5('0x1a'),'no'),'defaultValue':_0x9fc5('0x1a')},'busylevel':{'type':Sequelize[_0x9fc5('0x27')](0xb)},'allowoverlap':{'type':Sequelize['ENUM'](_0x9fc5('0x1a'),'no')},'allowsubscribe':{'type':Sequelize['ENUM'](_0x9fc5('0x1a'),'no')},'allowtransfer':{'type':Sequelize[_0x9fc5('0x4')](_0x9fc5('0x1a'),'no')},'ignoresdpversion':{'type':Sequelize[_0x9fc5('0x4')]('yes','no')},'subscribecontext':{'type':Sequelize[_0x9fc5('0x2')]},'template':{'type':Sequelize[_0x9fc5('0x2')]},'videosupport':{'type':Sequelize[_0x9fc5('0x4')](_0x9fc5('0x1a'),'no','always'),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x9fc5('0x27')](0xb)},'rfc2833compensate':{'type':Sequelize['ENUM']('yes','no')},'mailbox':{'type':Sequelize[_0x9fc5('0x2')]},'session_timers':{'type':Sequelize['ENUM']('accept',_0x9fc5('0x28'),_0x9fc5('0x29'))},'session_expires':{'type':Sequelize[_0x9fc5('0x27')](0xb)},'session_minse':{'type':Sequelize[_0x9fc5('0x27')](0xb)},'session_refresher':{'type':Sequelize[_0x9fc5('0x4')](_0x9fc5('0x2a'),_0x9fc5('0x2b')),'defaultValue':_0x9fc5('0x2b')},'t38pt_usertpsource':{'type':Sequelize[_0x9fc5('0x2')]},'regexten':{'type':Sequelize[_0x9fc5('0x2')]},'fromdomain':{'type':Sequelize[_0x9fc5('0x2')]},'fromuser':{'type':Sequelize[_0x9fc5('0x2')]},'port':{'type':Sequelize[_0x9fc5('0x27')](0x5)},'qualify':{'type':Sequelize[_0x9fc5('0x4')](_0x9fc5('0x1a'),'no'),'defaultValue':_0x9fc5('0x1a')},'keepalive':{'type':Sequelize[_0x9fc5('0x27')](0xb)},'defaultip':{'type':Sequelize[_0x9fc5('0x2')]},'defaultuser':{'type':Sequelize[_0x9fc5('0x2')]},'rtptimeout':{'type':Sequelize['INTEGER'](0xb)},'rtpholdtimeout':{'type':Sequelize['INTEGER'](0xb)},'rtpkeepalive':{'type':Sequelize[_0x9fc5('0x27')](0xb)},'sendrpid':{'type':Sequelize[_0x9fc5('0x4')](_0x9fc5('0x1a'),'no',_0x9fc5('0x2c')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x9fc5('0x2')]},'callbackextension':{'type':Sequelize[_0x9fc5('0x2')]},'timert1':{'type':Sequelize[_0x9fc5('0x27')](0xb)},'timerb':{'type':Sequelize[_0x9fc5('0x27')](0xb)},'qualifyfreq':{'type':Sequelize[_0x9fc5('0x27')](0xb)},'contactpermit':{'type':Sequelize['STRING']},'contactdeny':{'type':Sequelize[_0x9fc5('0x2')]},'contactacl':{'type':Sequelize[_0x9fc5('0x2')]},'unsolicited_mailbox':{'type':Sequelize[_0x9fc5('0x2')]},'use_q850_reason':{'type':Sequelize[_0x9fc5('0x2')]},'maxforwards':{'type':Sequelize['INTEGER'](0xb)},'encryption':{'type':Sequelize[_0x9fc5('0x4')](_0x9fc5('0x1a'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize['ENUM'](_0x9fc5('0x1a'),'no')},'force_avp':{'type':Sequelize[_0x9fc5('0x4')]('yes','no')},'icesupport':{'type':Sequelize[_0x9fc5('0x4')](_0x9fc5('0x1a'),'no')},'dtlsenable':{'type':Sequelize[_0x9fc5('0x4')]('yes','no')},'dtlsverify':{'type':Sequelize[_0x9fc5('0x4')]('yes','no',_0x9fc5('0x2d'),_0x9fc5('0x2e'))},'dtlsrekey':{'type':Sequelize['INTEGER'](0xb)},'dtlscertfile':{'type':Sequelize[_0x9fc5('0x2')]},'dtlsprivatekey':{'type':Sequelize[_0x9fc5('0x2')]},'dtlscipher':{'type':Sequelize[_0x9fc5('0x2')]},'dtlscafile':{'type':Sequelize[_0x9fc5('0x2')]},'dtlscapath':{'type':Sequelize[_0x9fc5('0x2')]},'dtlssetup':{'type':Sequelize['ENUM'](_0x9fc5('0x2f'),'passive','actpass'),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x9fc5('0x2')]},'usereqphone':{'type':Sequelize[_0x9fc5('0x4')](_0x9fc5('0x1a'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x9fc5('0x2')]},'recordofffeature':{'type':Sequelize[_0x9fc5('0x2')]},'call_limit':{'type':Sequelize[_0x9fc5('0x27')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0x9fc5('0x4')](_0x9fc5('0x1a'),'no')},'subscribemwi':{'type':Sequelize['ENUM'](_0x9fc5('0x1a'),'no')},'vmexten':{'type':Sequelize[_0x9fc5('0x2')]},'mohinterpret':{'type':Sequelize[_0x9fc5('0x2')]},'mohsuggest':{'type':Sequelize[_0x9fc5('0x2')]},'parkinglot':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x9fc5('0x2')]},'host':{'type':Sequelize['STRING'],'defaultValue':_0x9fc5('0x30')},'canreinvite':{'type':Sequelize[_0x9fc5('0x4')]('yes','no',_0x9fc5('0x1b'),_0x9fc5('0x1c'),_0x9fc5('0x31')),'defaultValue':'no'},'registry':{'type':Sequelize['STRING']},'otherFields':{'type':Sequelize[_0x9fc5('0x2')]},'active':{'type':Sequelize[_0x9fc5('0x32')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0x9fc5('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 b81d546..ad38ae1 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 _0x55ca=['catch','status','json','offset','undefined','count','limit','Content-Range','apply','save','update','destroy','get','UserProfileResource','end','stack','name','send','Trunk','rawAttributes','type','model','map','filters','intersection','query','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','where','merge','VIRTUAL','filter','includeAll','include','findAll','rows','show','params','keys','length','options','find','clone','omit','updatedAt','body','createdAt','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Trunks','UserProfileSection','userProfileId','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','join','server/files/templates/trunk.ejs','utf8','root','server/files/templates/registry.ejs','writeFileSync','/etc/asterisk/sip_xcally_trunks.conf','registry','render','Reload','chan_sip.so','readFileSync','/etc/asterisk/sip_xcally_registers.conf','eml-format','rimraf','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','http','request','then','info','Trunk,\x20%s,\x20%s','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','stringify','error','message','result'];(function(_0x265f0d,_0x712ad1){var _0x3f7b74=function(_0x58a60e){while(--_0x58a60e){_0x265f0d['push'](_0x265f0d['shift']());}};_0x3f7b74(++_0x712ad1);}(_0x55ca,0x126));var _0xa55c=function(_0x4de003,_0x1677e9){_0x4de003=_0x4de003-0x0;var _0x2875b9=_0x55ca[_0x4de003];return _0x2875b9;};'use strict';var emlformat=require(_0xa55c('0x0'));var rimraf=require(_0xa55c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xa55c('0x2'));var BPromise=require(_0xa55c('0x3'));var Mustache=require('mustache');var util=require(_0xa55c('0x4'));var path=require(_0xa55c('0x5'));var sox=require(_0xa55c('0x6'));var csv=require(_0xa55c('0x7'));var ejs=require(_0xa55c('0x8'));var fs=require('fs');var fs_extra=require(_0xa55c('0x9'));var _=require(_0xa55c('0xa'));var squel=require('squel');var crypto=require(_0xa55c('0xb'));var jsforce=require(_0xa55c('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xa55c('0x7'));var querystring=require(_0xa55c('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xa55c('0xe'));var qs=require(_0xa55c('0xf'));var as=require(_0xa55c('0x10'));var hardwareService=require(_0xa55c('0x11'));var logger=require(_0xa55c('0x12'))(_0xa55c('0x13'));var utils=require(_0xa55c('0x14'));var config=require(_0xa55c('0x15'));var licenseUtil=require(_0xa55c('0x16'));var db=require(_0xa55c('0x17'))['db'];var jayson=require('jayson/promise');var client=jayson['client'][_0xa55c('0x18')]({'port':0x232a});function respondWithRpcPromise(_0x576044,_0x5a3672,_0x59ea8d,_0x18ee85){return new BPromise(function(_0x3930e4,_0x462cd6){var _0x938bd6=_0x18ee85||client;return _0x938bd6[_0xa55c('0x19')](_0x576044,_0x59ea8d)[_0xa55c('0x1a')](function(_0x4e0b2f){logger[_0xa55c('0x1b')](_0xa55c('0x1c'),_0x5a3672,_0xa55c('0x1d'));logger[_0xa55c('0x1e')](_0xa55c('0x1f'),_0x5a3672,_0xa55c('0x1d'),JSON[_0xa55c('0x20')](_0x4e0b2f));if(_0x4e0b2f[_0xa55c('0x21')]){if(_0x4e0b2f[_0xa55c('0x21')]['code']===0x1f4){logger[_0xa55c('0x21')](_0xa55c('0x1c'),_0x5a3672,_0x4e0b2f[_0xa55c('0x21')][_0xa55c('0x22')]);return _0x462cd6(_0x4e0b2f[_0xa55c('0x21')][_0xa55c('0x22')]);}logger['error']('Trunk,\x20%s,\x20%s',_0x5a3672,_0x4e0b2f[_0xa55c('0x21')][_0xa55c('0x22')]);return _0x3930e4(_0x4e0b2f[_0xa55c('0x21')]['message']);}else{logger[_0xa55c('0x1b')](_0xa55c('0x1c'),_0x5a3672,'request\x20sent');_0x3930e4(_0x4e0b2f[_0xa55c('0x23')][_0xa55c('0x22')]);}})[_0xa55c('0x24')](function(_0x1965f1){logger[_0xa55c('0x21')]('Trunk,\x20%s,\x20%s',_0x5a3672,_0x1965f1);_0x462cd6(_0x1965f1);});});}function respondWithStatusCode(_0x1fc828,_0x504c24){_0x504c24=_0x504c24||0xcc;return function(_0x5ba836){if(_0x5ba836){return _0x1fc828['sendStatus'](_0x504c24);}return _0x1fc828[_0xa55c('0x25')](_0x504c24)['end']();};}function respondWithResult(_0x3ecbe7,_0x190757){_0x190757=_0x190757||0xc8;return function(_0x3f64de){if(_0x3f64de){return _0x3ecbe7[_0xa55c('0x25')](_0x190757)[_0xa55c('0x26')](_0x3f64de);}};}function respondWithFilteredResult(_0x170ba4,_0x1da633){return function(_0x11e7f7){if(_0x11e7f7){var _0x192df2=typeof _0x1da633[_0xa55c('0x27')]===_0xa55c('0x28')&&typeof _0x1da633['limit']===_0xa55c('0x28');var _0x28814f=_0x11e7f7[_0xa55c('0x29')];var _0x906caa=_0x192df2?0x0:_0x1da633['offset'];var _0x1377b0=_0x192df2?_0x11e7f7[_0xa55c('0x29')]:_0x1da633[_0xa55c('0x27')]+_0x1da633[_0xa55c('0x2a')];var _0x45ee8d;if(_0x1377b0>=_0x28814f){_0x1377b0=_0x28814f;_0x45ee8d=0xc8;}else{_0x45ee8d=0xce;}_0x170ba4[_0xa55c('0x25')](_0x45ee8d);return _0x170ba4['set'](_0xa55c('0x2b'),_0x906caa+'-'+_0x1377b0+'/'+_0x28814f)['json'](_0x11e7f7);}return null;};}function patchUpdates(_0x35c9c2){return function(_0x1d730b){try{jsonpatch[_0xa55c('0x2c')](_0x1d730b,_0x35c9c2,!![]);}catch(_0x223813){return BPromise['reject'](_0x223813);}return _0x1d730b[_0xa55c('0x2d')]();};}function saveUpdates(_0x2096ae,_0x331e58){return function(_0x20da31){if(_0x20da31){return _0x20da31[_0xa55c('0x2e')](_0x2096ae)[_0xa55c('0x1a')](function(_0x29748a){return _0x29748a;});}return null;};}function removeEntity(_0x24d44d,_0x2808e9){return function(_0xcbaf2e){if(_0xcbaf2e){return _0xcbaf2e[_0xa55c('0x2f')]()['then'](function(){var _0x54ca97=_0xcbaf2e[_0xa55c('0x30')]({'plain':!![]});var _0x19733e='Trunks';return db[_0xa55c('0x31')][_0xa55c('0x2f')]({'where':{'type':_0x19733e,'resourceId':_0x54ca97['id']}})[_0xa55c('0x1a')](function(){return _0xcbaf2e;});})[_0xa55c('0x1a')](function(){_0x24d44d[_0xa55c('0x25')](0xcc)[_0xa55c('0x32')]();});}};}function handleEntityNotFound(_0x3ce1b3,_0x222d4b){return function(_0x3959e3){if(!_0x3959e3){_0x3ce1b3['sendStatus'](0x194);}return _0x3959e3;};}function handleError(_0x5f3e99,_0x4b23d3){_0x4b23d3=_0x4b23d3||0x1f4;return function(_0x3fd75f){logger[_0xa55c('0x21')](_0x3fd75f[_0xa55c('0x33')]);if(_0x3fd75f['name']){delete _0x3fd75f[_0xa55c('0x34')];}_0x5f3e99['status'](_0x4b23d3)[_0xa55c('0x35')](_0x3fd75f);};}exports['index']=function(_0x18c6f1,_0x39267c){var _0x3c0ec1={},_0x4d3eb5={},_0x7c4a47={'count':0x0,'rows':[]};var _0x30f23b=_['map'](db[_0xa55c('0x36')][_0xa55c('0x37')],function(_0x4d9083){return{'name':_0x4d9083['fieldName'],'type':_0x4d9083[_0xa55c('0x38')]['key']};});_0x4d3eb5[_0xa55c('0x39')]=_[_0xa55c('0x3a')](_0x30f23b,'name');_0x4d3eb5['query']=_['keys'](_0x18c6f1['query']);_0x4d3eb5[_0xa55c('0x3b')]=_[_0xa55c('0x3c')](_0x4d3eb5[_0xa55c('0x39')],_0x4d3eb5[_0xa55c('0x3d')]);_0x3c0ec1[_0xa55c('0x3e')]=_['intersection'](_0x4d3eb5[_0xa55c('0x39')],qs[_0xa55c('0x3f')](_0x18c6f1[_0xa55c('0x3d')][_0xa55c('0x3f')]));_0x3c0ec1[_0xa55c('0x3e')]=_0x3c0ec1[_0xa55c('0x3e')]['length']?_0x3c0ec1[_0xa55c('0x3e')]:_0x4d3eb5['model'];if(!_0x18c6f1['query'][_0xa55c('0x40')](_0xa55c('0x41'))){_0x3c0ec1['limit']=qs[_0xa55c('0x2a')](_0x18c6f1['query']['limit']);_0x3c0ec1[_0xa55c('0x27')]=qs[_0xa55c('0x27')](_0x18c6f1[_0xa55c('0x3d')]['offset']);}_0x3c0ec1[_0xa55c('0x42')]=qs[_0xa55c('0x43')](_0x18c6f1['query'][_0xa55c('0x43')]);_0x3c0ec1['where']=qs[_0xa55c('0x3b')](_[_0xa55c('0x44')](_0x18c6f1['query'],_0x4d3eb5[_0xa55c('0x3b')]),_0x30f23b);if(_0x18c6f1[_0xa55c('0x3d')]['filter']){_0x3c0ec1[_0xa55c('0x45')]=_[_0xa55c('0x46')](_0x3c0ec1[_0xa55c('0x45')],{'$or':_['map'](_0x30f23b,function(_0x334f52){if(_0x334f52['type']!==_0xa55c('0x47')){var _0x3a8af4={};_0x3a8af4[_0x334f52[_0xa55c('0x34')]]={'$like':'%'+_0x18c6f1['query'][_0xa55c('0x48')]+'%'};return _0x3a8af4;}})});}_0x3c0ec1=_[_0xa55c('0x46')]({},_0x3c0ec1,_0x18c6f1['options']);var _0x3d19f5={'where':_0x3c0ec1[_0xa55c('0x45')]};return db['Trunk'][_0xa55c('0x29')](_0x3d19f5)[_0xa55c('0x1a')](function(_0x52f9a7){_0x7c4a47[_0xa55c('0x29')]=_0x52f9a7;if(_0x18c6f1[_0xa55c('0x3d')][_0xa55c('0x49')]){_0x3c0ec1[_0xa55c('0x4a')]=[{'all':!![]}];}return db['Trunk'][_0xa55c('0x4b')](_0x3c0ec1);})['then'](function(_0x2157d6){_0x7c4a47[_0xa55c('0x4c')]=_0x2157d6;return _0x7c4a47;})[_0xa55c('0x1a')](respondWithFilteredResult(_0x39267c,_0x3c0ec1))['catch'](handleError(_0x39267c,null));};exports[_0xa55c('0x4d')]=function(_0x250b00,_0x574fe9){var _0x5be06={'raw':![],'where':{'id':_0x250b00[_0xa55c('0x4e')]['id']}},_0x34de95={};_0x34de95[_0xa55c('0x39')]=_[_0xa55c('0x4f')](db[_0xa55c('0x36')][_0xa55c('0x37')]);_0x34de95[_0xa55c('0x3d')]=_[_0xa55c('0x4f')](_0x250b00[_0xa55c('0x3d')]);_0x34de95['filters']=_[_0xa55c('0x3c')](_0x34de95[_0xa55c('0x39')],_0x34de95[_0xa55c('0x3d')]);_0x5be06['attributes']=_[_0xa55c('0x3c')](_0x34de95[_0xa55c('0x39')],qs['fields'](_0x250b00[_0xa55c('0x3d')]['fields']));_0x5be06[_0xa55c('0x3e')]=_0x5be06[_0xa55c('0x3e')][_0xa55c('0x50')]?_0x5be06[_0xa55c('0x3e')]:_0x34de95[_0xa55c('0x39')];if(_0x250b00['query'][_0xa55c('0x49')]){_0x5be06[_0xa55c('0x4a')]=[{'all':!![]}];}_0x5be06=_['merge']({},_0x5be06,_0x250b00[_0xa55c('0x51')]);return db[_0xa55c('0x36')][_0xa55c('0x52')](_0x5be06)[_0xa55c('0x1a')](handleEntityNotFound(_0x574fe9,null))['then'](respondWithResult(_0x574fe9,null))['catch'](handleError(_0x574fe9,null));};exports[_0xa55c('0x53')]=function(_0x250dea,_0x3ca5b8){var _0x44ac57={'where':{'id':_0x250dea[_0xa55c('0x4e')]['id']}},_0x54cbde={};_0x54cbde['model']=_[_0xa55c('0x4f')](db[_0xa55c('0x36')][_0xa55c('0x37')]);_0x44ac57[_0xa55c('0x3e')]=_[_0xa55c('0x3c')](_0x54cbde['model'],qs[_0xa55c('0x3f')](_0x250dea['query'][_0xa55c('0x3f')]));_0x44ac57[_0xa55c('0x3e')]=_0x44ac57[_0xa55c('0x3e')][_0xa55c('0x50')]?_0x44ac57[_0xa55c('0x3e')]:_0x54cbde[_0xa55c('0x39')];if(_0x250dea[_0xa55c('0x3d')]['includeAll']){_0x44ac57[_0xa55c('0x4a')]=[{'all':!![]}];}_0x44ac57=_[_0xa55c('0x46')]({},_0x44ac57,_0x250dea[_0xa55c('0x51')]);return db[_0xa55c('0x36')][_0xa55c('0x52')](_0x44ac57)['then'](handleEntityNotFound(_0x3ca5b8,null))[_0xa55c('0x1a')](function(_0x3cd40d){if(_0x3cd40d){var _0x28bac4=_0x3cd40d[_0xa55c('0x30')]({'plain':!![]});_0x28bac4=qs[_0xa55c('0x54')](_0x28bac4,['id','createdAt',_0xa55c('0x55')]);_0x250dea[_0xa55c('0x56')]=_[_0xa55c('0x54')](_0x250dea[_0xa55c('0x56')],['id',_0xa55c('0x57'),'updatedAt']);return db[_0xa55c('0x36')]['create'](_[_0xa55c('0x46')](_0x28bac4,_0x250dea['body']),{'include':_0x250dea[_0xa55c('0x3d')]['includeAll']?[{'all':!![]}]:undefined})[_0xa55c('0x1a')](function(_0x1333da){var _0x21d6b4=_0x250dea[_0xa55c('0x58')][_0xa55c('0x30')]({'plain':!![]});if(!_0x21d6b4)throw new Error(_0xa55c('0x59'));if(_0x21d6b4[_0xa55c('0x5a')]===_0xa55c('0x58')){var _0x14b515=_0x1333da[_0xa55c('0x30')]({'plain':!![]});var _0x51c736=_0xa55c('0x5b');return db[_0xa55c('0x5c')]['find']({'where':{'name':_0x51c736,'userProfileId':_0x21d6b4[_0xa55c('0x5d')]},'raw':!![]})[_0xa55c('0x1a')](function(_0x3e3b4b){if(_0x3e3b4b&&_0x3e3b4b[_0xa55c('0x5e')]===0x0){return db[_0xa55c('0x31')][_0xa55c('0x5f')]({'name':_0x14b515[_0xa55c('0x34')],'resourceId':_0x14b515['id'],'type':_0x3e3b4b[_0xa55c('0x34')],'sectionId':_0x3e3b4b['id']},{})['then'](function(){return _0x1333da;});}else{return _0x1333da;}})[_0xa55c('0x24')](function(_0x475131){logger[_0xa55c('0x21')](_0xa55c('0x60'),_0x475131);throw _0x475131;});}return _0x1333da;});}})[_0xa55c('0x1a')](respondWithResult(_0x3ca5b8,0xc9))[_0xa55c('0x24')](handleError(_0x3ca5b8,null));};exports[_0xa55c('0x5f')]=function(_0x4249c1,_0x25d5a1,_0x4a08ca){var _0x347562;return db[_0xa55c('0x36')][_0xa55c('0x5f')](_0x4249c1[_0xa55c('0x56')],{'raw':!![]})[_0xa55c('0x1a')](function(_0x10e711){_0x347562=_0x10e711;return db[_0xa55c('0x36')][_0xa55c('0x4b')]({'raw':!![]});})[_0xa55c('0x1a')](function(_0x3178a6){var _0x3bbc4b=fs['readFileSync'](path[_0xa55c('0x61')](config['root'],_0xa55c('0x62')),_0xa55c('0x63'));var _0x129bb4=fs['readFileSync'](path['join'](config[_0xa55c('0x64')],_0xa55c('0x65')),_0xa55c('0x63'));var _0x42529f=ejs['render'](_0x3bbc4b,{'trunks':_0x3178a6||[]});fs[_0xa55c('0x66')](_0xa55c('0x67'),_0x42529f);if(_0x347562[_0xa55c('0x68')]){var _0x3a9910=ejs[_0xa55c('0x69')](_0x129bb4,{'trunks':_0x3178a6||[]});fs['writeFileSync']('/etc/asterisk/sip_xcally_registers.conf',_0x3a9910);}})[_0xa55c('0x1a')](function(){return respondWithRpcPromise(_0xa55c('0x6a'),_0xa55c('0x5f'),{'module':_0xa55c('0x6b')});})[_0xa55c('0x1a')](function(){var _0x4b2032=_0x4249c1[_0xa55c('0x58')][_0xa55c('0x30')]({'plain':!![]});if(!_0x4b2032)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4b2032[_0xa55c('0x5a')]===_0xa55c('0x58')){var _0xa340fb=_0x347562['get']({'plain':!![]});return db[_0xa55c('0x5c')][_0xa55c('0x52')]({'where':{'name':_0xa55c('0x5b'),'userProfileId':_0x4b2032[_0xa55c('0x5d')]},'raw':!![]})[_0xa55c('0x1a')](function(_0x506f74){if(_0x506f74&&_0x506f74[_0xa55c('0x5e')]===0x0){return db[_0xa55c('0x31')]['create']({'name':_0xa340fb['name'],'resourceId':_0xa340fb['id'],'type':_0x506f74[_0xa55c('0x34')],'sectionId':_0x506f74['id']},{})['then'](function(){return _0x347562;});}else{return _0x347562;}})[_0xa55c('0x24')](function(_0x5ca0bc){logger[_0xa55c('0x21')](_0xa55c('0x60'),_0x5ca0bc);throw _0x5ca0bc;});}return _0x347562;})[_0xa55c('0x1a')](respondWithResult(_0x25d5a1,0xc9))[_0xa55c('0x24')](handleError(_0x25d5a1,null));};exports[_0xa55c('0x2e')]=function(_0xff7b1c,_0x16dfc6,_0x5d8551){var _0x463195;return db[_0xa55c('0x36')][_0xa55c('0x52')]({'where':{'id':_0xff7b1c[_0xa55c('0x4e')]['id']}})['then'](handleEntityNotFound(_0x16dfc6,null))[_0xa55c('0x1a')](saveUpdates(_0xff7b1c[_0xa55c('0x56')],null))[_0xa55c('0x1a')](function(_0x2298ac){if(_0x2298ac){_0x463195=_0x2298ac;return db['Trunk']['findAll']({'raw':!![]});}})[_0xa55c('0x1a')](function(_0x428872){if(_0x428872){var _0x12e3a8=fs[_0xa55c('0x6c')](path['join'](config['root'],_0xa55c('0x62')),_0xa55c('0x63'));var _0xd33c9c=fs[_0xa55c('0x6c')](path[_0xa55c('0x61')](config[_0xa55c('0x64')],_0xa55c('0x65')),'utf8');var _0x19497b=ejs['render'](_0x12e3a8,{'trunks':_0x428872||[]});fs[_0xa55c('0x66')]('/etc/asterisk/sip_xcally_trunks.conf',_0x19497b);var _0x36ded7=ejs[_0xa55c('0x69')](_0xd33c9c,{'trunks':_0x428872||[]});fs[_0xa55c('0x66')](_0xa55c('0x6d'),_0x36ded7);return respondWithRpcPromise(_0xa55c('0x6a'),_0xa55c('0x2e'),{'module':_0xa55c('0x6b')});}return null;})[_0xa55c('0x1a')](function(_0x576a1b){if(_0x576a1b){return _0x463195;}})['then'](respondWithResult(_0x16dfc6,null))[_0xa55c('0x24')](handleError(_0x16dfc6,null));};exports[_0xa55c('0x2f')]=function(_0xc2ad5c,_0x256db0,_0x1622cb){var _0x137728;return db['Trunk'][_0xa55c('0x52')]({'where':{'id':_0xc2ad5c[_0xa55c('0x4e')]['id']}})[_0xa55c('0x1a')](handleEntityNotFound(_0x256db0,null))[_0xa55c('0x1a')](removeEntity(_0x256db0,null))[_0xa55c('0x1a')](function(){return db[_0xa55c('0x36')][_0xa55c('0x4b')]({'raw':!![]});})[_0xa55c('0x1a')](function(_0x58b670){var _0x25d09d=fs[_0xa55c('0x6c')](path[_0xa55c('0x61')](config[_0xa55c('0x64')],_0xa55c('0x62')),'utf8');var _0x2685d8=fs[_0xa55c('0x6c')](path['join'](config['root'],_0xa55c('0x65')),_0xa55c('0x63'));var _0x5c2229=ejs['render'](_0x25d09d,{'trunks':_0x58b670});var _0x579726=ejs['render'](_0x2685d8,{'trunks':_0x58b670});fs[_0xa55c('0x66')](_0xa55c('0x67'),_0x5c2229);fs[_0xa55c('0x66')](_0xa55c('0x6d'),_0x579726);return respondWithRpcPromise(_0xa55c('0x6a'),_0xa55c('0x2f'),{'module':'chan_sip.so'});})[_0xa55c('0x24')](handleError(_0x256db0,null));}; \ No newline at end of file +var _0x9bde=['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','../../config/license/util','../../mysqldb','client','request','then','info','Trunk,\x20%s,\x20%s','debug','Trunk,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','sendStatus','status','end','json','undefined','limit','count','set','Content-Range','apply','reject','save','update','get','Trunks','UserProfileResource','destroy','stack','name','send','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','offset','order','sort','where','pick','filter','VIRTUAL','merge','Trunk','includeAll','findAll','rows','show','params','fields','include','options','clone','find','omit','createdAt','body','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readFileSync','join','server/files/templates/registry.ejs','utf8','render','/etc/asterisk/sip_xcally_trunks.conf','registry','/etc/asterisk/sip_xcally_registers.conf','Reload','chan_sip.so','root','server/files/templates/trunk.ejs','writeFileSync','rimraf'];(function(_0xf15036,_0x52e137){var _0x2985dd=function(_0x2d2dca){while(--_0x2d2dca){_0xf15036['push'](_0xf15036['shift']());}};_0x2985dd(++_0x52e137);}(_0x9bde,0xe1));var _0xe9bd=function(_0x14b339,_0x2fb78e){_0x14b339=_0x14b339-0x0;var _0x4e68c1=_0x9bde[_0x14b339];return _0x4e68c1;};'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'];var jayson=require('jayson/promise');var client=jayson[_0xe9bd('0x19')]['http']({'port':0x232a});function respondWithRpcPromise(_0x220d07,_0x429e88,_0x3435b4,_0x51109f){return new BPromise(function(_0x47ba5e,_0x46a95e){var _0x248818=_0x51109f||client;return _0x248818[_0xe9bd('0x1a')](_0x220d07,_0x3435b4)[_0xe9bd('0x1b')](function(_0x3360bd){logger[_0xe9bd('0x1c')](_0xe9bd('0x1d'),_0x429e88,'request\x20sent');logger[_0xe9bd('0x1e')](_0xe9bd('0x1f'),_0x429e88,_0xe9bd('0x20'),JSON['stringify'](_0x3360bd));if(_0x3360bd[_0xe9bd('0x21')]){if(_0x3360bd[_0xe9bd('0x21')][_0xe9bd('0x22')]===0x1f4){logger[_0xe9bd('0x21')]('Trunk,\x20%s,\x20%s',_0x429e88,_0x3360bd[_0xe9bd('0x21')]['message']);return _0x46a95e(_0x3360bd[_0xe9bd('0x21')]['message']);}logger[_0xe9bd('0x21')](_0xe9bd('0x1d'),_0x429e88,_0x3360bd[_0xe9bd('0x21')][_0xe9bd('0x23')]);return _0x47ba5e(_0x3360bd[_0xe9bd('0x21')][_0xe9bd('0x23')]);}else{logger[_0xe9bd('0x1c')]('Trunk,\x20%s,\x20%s',_0x429e88,_0xe9bd('0x20'));_0x47ba5e(_0x3360bd[_0xe9bd('0x24')]['message']);}})[_0xe9bd('0x25')](function(_0x505c23){logger[_0xe9bd('0x21')](_0xe9bd('0x1d'),_0x429e88,_0x505c23);_0x46a95e(_0x505c23);});});}function respondWithStatusCode(_0x36f8c0,_0xf02209){_0xf02209=_0xf02209||0xcc;return function(_0x5bc4bf){if(_0x5bc4bf){return _0x36f8c0[_0xe9bd('0x26')](_0xf02209);}return _0x36f8c0[_0xe9bd('0x27')](_0xf02209)[_0xe9bd('0x28')]();};}function respondWithResult(_0x39b206,_0x2641be){_0x2641be=_0x2641be||0xc8;return function(_0xb52d45){if(_0xb52d45){return _0x39b206[_0xe9bd('0x27')](_0x2641be)[_0xe9bd('0x29')](_0xb52d45);}};}function respondWithFilteredResult(_0x1ae889,_0x5987af){return function(_0x3c211a){if(_0x3c211a){var _0x38fdfa=typeof _0x5987af['offset']===_0xe9bd('0x2a')&&typeof _0x5987af[_0xe9bd('0x2b')]===_0xe9bd('0x2a');var _0x429055=_0x3c211a[_0xe9bd('0x2c')];var _0x183601=_0x38fdfa?0x0:_0x5987af['offset'];var _0x5b7f1d=_0x38fdfa?_0x3c211a[_0xe9bd('0x2c')]:_0x5987af['offset']+_0x5987af[_0xe9bd('0x2b')];var _0x1f2c0e;if(_0x5b7f1d>=_0x429055){_0x5b7f1d=_0x429055;_0x1f2c0e=0xc8;}else{_0x1f2c0e=0xce;}_0x1ae889[_0xe9bd('0x27')](_0x1f2c0e);return _0x1ae889[_0xe9bd('0x2d')](_0xe9bd('0x2e'),_0x183601+'-'+_0x5b7f1d+'/'+_0x429055)['json'](_0x3c211a);}return null;};}function patchUpdates(_0x4b7bc2){return function(_0x7f2c5){try{jsonpatch[_0xe9bd('0x2f')](_0x7f2c5,_0x4b7bc2,!![]);}catch(_0x3f96a0){return BPromise[_0xe9bd('0x30')](_0x3f96a0);}return _0x7f2c5[_0xe9bd('0x31')]();};}function saveUpdates(_0x1f0f9e,_0x3c31ee){return function(_0x66213a){if(_0x66213a){return _0x66213a[_0xe9bd('0x32')](_0x1f0f9e)['then'](function(_0x426004){return _0x426004;});}return null;};}function removeEntity(_0x81a31f,_0x390a43){return function(_0x5117bc){if(_0x5117bc){return _0x5117bc['destroy']()[_0xe9bd('0x1b')](function(){var _0x2e9593=_0x5117bc[_0xe9bd('0x33')]({'plain':!![]});var _0x3ed60a=_0xe9bd('0x34');return db[_0xe9bd('0x35')][_0xe9bd('0x36')]({'where':{'type':_0x3ed60a,'resourceId':_0x2e9593['id']}})[_0xe9bd('0x1b')](function(){return _0x5117bc;});})[_0xe9bd('0x1b')](function(){_0x81a31f[_0xe9bd('0x27')](0xcc)[_0xe9bd('0x28')]();});}};}function handleEntityNotFound(_0x549dd1,_0x2ad46e){return function(_0x199477){if(!_0x199477){_0x549dd1[_0xe9bd('0x26')](0x194);}return _0x199477;};}function handleError(_0x8ff624,_0x264ba0){_0x264ba0=_0x264ba0||0x1f4;return function(_0x147da5){logger['error'](_0x147da5[_0xe9bd('0x37')]);if(_0x147da5[_0xe9bd('0x38')]){delete _0x147da5['name'];}_0x8ff624[_0xe9bd('0x27')](_0x264ba0)[_0xe9bd('0x39')](_0x147da5);};}exports['index']=function(_0x4b1da0,_0x2785e6){var _0xdf43b9={},_0x4d2f3d={},_0x2d1289={'count':0x0,'rows':[]};var _0x3ea705=_[_0xe9bd('0x3a')](db['Trunk'][_0xe9bd('0x3b')],function(_0x4d1945){return{'name':_0x4d1945[_0xe9bd('0x3c')],'type':_0x4d1945[_0xe9bd('0x3d')][_0xe9bd('0x3e')]};});_0x4d2f3d[_0xe9bd('0x3f')]=_['map'](_0x3ea705,_0xe9bd('0x38'));_0x4d2f3d[_0xe9bd('0x40')]=_[_0xe9bd('0x41')](_0x4b1da0[_0xe9bd('0x40')]);_0x4d2f3d[_0xe9bd('0x42')]=_[_0xe9bd('0x43')](_0x4d2f3d[_0xe9bd('0x3f')],_0x4d2f3d[_0xe9bd('0x40')]);_0xdf43b9[_0xe9bd('0x44')]=_[_0xe9bd('0x43')](_0x4d2f3d['model'],qs['fields'](_0x4b1da0[_0xe9bd('0x40')]['fields']));_0xdf43b9[_0xe9bd('0x44')]=_0xdf43b9[_0xe9bd('0x44')][_0xe9bd('0x45')]?_0xdf43b9['attributes']:_0x4d2f3d[_0xe9bd('0x3f')];if(!_0x4b1da0[_0xe9bd('0x40')][_0xe9bd('0x46')]('nolimit')){_0xdf43b9[_0xe9bd('0x2b')]=qs[_0xe9bd('0x2b')](_0x4b1da0[_0xe9bd('0x40')][_0xe9bd('0x2b')]);_0xdf43b9[_0xe9bd('0x47')]=qs[_0xe9bd('0x47')](_0x4b1da0[_0xe9bd('0x40')][_0xe9bd('0x47')]);}_0xdf43b9[_0xe9bd('0x48')]=qs[_0xe9bd('0x49')](_0x4b1da0[_0xe9bd('0x40')][_0xe9bd('0x49')]);_0xdf43b9[_0xe9bd('0x4a')]=qs[_0xe9bd('0x42')](_[_0xe9bd('0x4b')](_0x4b1da0['query'],_0x4d2f3d['filters']),_0x3ea705);if(_0x4b1da0[_0xe9bd('0x40')][_0xe9bd('0x4c')]){_0xdf43b9[_0xe9bd('0x4a')]=_['merge'](_0xdf43b9['where'],{'$or':_[_0xe9bd('0x3a')](_0x3ea705,function(_0x3f6f22){if(_0x3f6f22[_0xe9bd('0x3d')]!==_0xe9bd('0x4d')){var _0x39fb61={};_0x39fb61[_0x3f6f22[_0xe9bd('0x38')]]={'$like':'%'+_0x4b1da0[_0xe9bd('0x40')]['filter']+'%'};return _0x39fb61;}})});}_0xdf43b9=_[_0xe9bd('0x4e')]({},_0xdf43b9,_0x4b1da0['options']);var _0x36726e={'where':_0xdf43b9[_0xe9bd('0x4a')]};return db[_0xe9bd('0x4f')][_0xe9bd('0x2c')](_0x36726e)[_0xe9bd('0x1b')](function(_0x4b7b67){_0x2d1289[_0xe9bd('0x2c')]=_0x4b7b67;if(_0x4b1da0[_0xe9bd('0x40')][_0xe9bd('0x50')]){_0xdf43b9['include']=[{'all':!![]}];}return db[_0xe9bd('0x4f')][_0xe9bd('0x51')](_0xdf43b9);})[_0xe9bd('0x1b')](function(_0x5a466b){_0x2d1289[_0xe9bd('0x52')]=_0x5a466b;return _0x2d1289;})[_0xe9bd('0x1b')](respondWithFilteredResult(_0x2785e6,_0xdf43b9))[_0xe9bd('0x25')](handleError(_0x2785e6,null));};exports[_0xe9bd('0x53')]=function(_0x1ee09c,_0x579d26){var _0x3f4833={'raw':![],'where':{'id':_0x1ee09c[_0xe9bd('0x54')]['id']}},_0x4b8ff9={};_0x4b8ff9[_0xe9bd('0x3f')]=_[_0xe9bd('0x41')](db[_0xe9bd('0x4f')][_0xe9bd('0x3b')]);_0x4b8ff9['query']=_[_0xe9bd('0x41')](_0x1ee09c['query']);_0x4b8ff9[_0xe9bd('0x42')]=_[_0xe9bd('0x43')](_0x4b8ff9['model'],_0x4b8ff9['query']);_0x3f4833[_0xe9bd('0x44')]=_['intersection'](_0x4b8ff9[_0xe9bd('0x3f')],qs['fields'](_0x1ee09c[_0xe9bd('0x40')][_0xe9bd('0x55')]));_0x3f4833['attributes']=_0x3f4833[_0xe9bd('0x44')]['length']?_0x3f4833[_0xe9bd('0x44')]:_0x4b8ff9[_0xe9bd('0x3f')];if(_0x1ee09c[_0xe9bd('0x40')]['includeAll']){_0x3f4833[_0xe9bd('0x56')]=[{'all':!![]}];}_0x3f4833=_[_0xe9bd('0x4e')]({},_0x3f4833,_0x1ee09c[_0xe9bd('0x57')]);return db[_0xe9bd('0x4f')]['find'](_0x3f4833)['then'](handleEntityNotFound(_0x579d26,null))[_0xe9bd('0x1b')](respondWithResult(_0x579d26,null))['catch'](handleError(_0x579d26,null));};exports[_0xe9bd('0x58')]=function(_0x3c33b8,_0xc7dd2f){var _0xc818b4={'where':{'id':_0x3c33b8[_0xe9bd('0x54')]['id']}},_0x159f68={};_0x159f68[_0xe9bd('0x3f')]=_[_0xe9bd('0x41')](db[_0xe9bd('0x4f')][_0xe9bd('0x3b')]);_0xc818b4[_0xe9bd('0x44')]=_[_0xe9bd('0x43')](_0x159f68['model'],qs['fields'](_0x3c33b8['query'][_0xe9bd('0x55')]));_0xc818b4['attributes']=_0xc818b4[_0xe9bd('0x44')][_0xe9bd('0x45')]?_0xc818b4[_0xe9bd('0x44')]:_0x159f68[_0xe9bd('0x3f')];if(_0x3c33b8[_0xe9bd('0x40')][_0xe9bd('0x50')]){_0xc818b4[_0xe9bd('0x56')]=[{'all':!![]}];}_0xc818b4=_[_0xe9bd('0x4e')]({},_0xc818b4,_0x3c33b8[_0xe9bd('0x57')]);return db['Trunk'][_0xe9bd('0x59')](_0xc818b4)[_0xe9bd('0x1b')](handleEntityNotFound(_0xc7dd2f,null))[_0xe9bd('0x1b')](function(_0x3f848d){if(_0x3f848d){var _0x4d58c1=_0x3f848d[_0xe9bd('0x33')]({'plain':!![]});_0x4d58c1=qs[_0xe9bd('0x5a')](_0x4d58c1,['id',_0xe9bd('0x5b'),'updatedAt']);_0x3c33b8[_0xe9bd('0x5c')]=_[_0xe9bd('0x5a')](_0x3c33b8[_0xe9bd('0x5c')],['id',_0xe9bd('0x5b'),'updatedAt']);return db['Trunk'][_0xe9bd('0x5d')](_[_0xe9bd('0x4e')](_0x4d58c1,_0x3c33b8[_0xe9bd('0x5c')]),{'include':_0x3c33b8[_0xe9bd('0x40')]['includeAll']?[{'all':!![]}]:undefined})['then'](function(_0x305efa){var _0x20855b=_0x3c33b8[_0xe9bd('0x5e')][_0xe9bd('0x33')]({'plain':!![]});if(!_0x20855b)throw new Error(_0xe9bd('0x5f'));if(_0x20855b[_0xe9bd('0x60')]==='user'){var _0x179c8d=_0x305efa['get']({'plain':!![]});var _0x27e07c=_0xe9bd('0x34');return db[_0xe9bd('0x61')][_0xe9bd('0x59')]({'where':{'name':_0x27e07c,'userProfileId':_0x20855b['userProfileId']},'raw':!![]})[_0xe9bd('0x1b')](function(_0x263ad9){if(_0x263ad9&&_0x263ad9[_0xe9bd('0x62')]===0x0){return db['UserProfileResource'][_0xe9bd('0x5d')]({'name':_0x179c8d[_0xe9bd('0x38')],'resourceId':_0x179c8d['id'],'type':_0x263ad9[_0xe9bd('0x38')],'sectionId':_0x263ad9['id']},{})[_0xe9bd('0x1b')](function(){return _0x305efa;});}else{return _0x305efa;}})[_0xe9bd('0x25')](function(_0x16b66c){logger[_0xe9bd('0x21')](_0xe9bd('0x63'),_0x16b66c);throw _0x16b66c;});}return _0x305efa;});}})[_0xe9bd('0x1b')](respondWithResult(_0xc7dd2f,0xc9))[_0xe9bd('0x25')](handleError(_0xc7dd2f,null));};exports[_0xe9bd('0x5d')]=function(_0x37d07a,_0x5d1e4b,_0x3a12e9){var _0x9d0603;return db['Trunk'][_0xe9bd('0x5d')](_0x37d07a[_0xe9bd('0x5c')],{'raw':!![]})['then'](function(_0x561165){_0x9d0603=_0x561165;return db[_0xe9bd('0x4f')][_0xe9bd('0x51')]({'raw':!![]});})['then'](function(_0x4ec8be){var _0x4a6422=fs[_0xe9bd('0x64')](path['join'](config['root'],'server/files/templates/trunk.ejs'),'utf8');var _0x1fc88d=fs[_0xe9bd('0x64')](path[_0xe9bd('0x65')](config['root'],_0xe9bd('0x66')),_0xe9bd('0x67'));var _0x337284=ejs[_0xe9bd('0x68')](_0x4a6422,{'trunks':_0x4ec8be||[]});fs['writeFileSync'](_0xe9bd('0x69'),_0x337284);if(_0x9d0603[_0xe9bd('0x6a')]){var _0x11ebcb=ejs['render'](_0x1fc88d,{'trunks':_0x4ec8be||[]});fs['writeFileSync'](_0xe9bd('0x6b'),_0x11ebcb);}})[_0xe9bd('0x1b')](function(){return respondWithRpcPromise(_0xe9bd('0x6c'),_0xe9bd('0x5d'),{'module':_0xe9bd('0x6d')});})[_0xe9bd('0x1b')](function(){var _0x3fda4c=_0x37d07a[_0xe9bd('0x5e')]['get']({'plain':!![]});if(!_0x3fda4c)throw new Error(_0xe9bd('0x5f'));if(_0x3fda4c[_0xe9bd('0x60')]===_0xe9bd('0x5e')){var _0x3db47a=_0x9d0603[_0xe9bd('0x33')]({'plain':!![]});return db['UserProfileSection'][_0xe9bd('0x59')]({'where':{'name':'Trunks','userProfileId':_0x3fda4c['userProfileId']},'raw':!![]})[_0xe9bd('0x1b')](function(_0x4496e3){if(_0x4496e3&&_0x4496e3['autoAssociation']===0x0){return db[_0xe9bd('0x35')][_0xe9bd('0x5d')]({'name':_0x3db47a[_0xe9bd('0x38')],'resourceId':_0x3db47a['id'],'type':_0x4496e3[_0xe9bd('0x38')],'sectionId':_0x4496e3['id']},{})['then'](function(){return _0x9d0603;});}else{return _0x9d0603;}})[_0xe9bd('0x25')](function(_0x41fb41){logger['error'](_0xe9bd('0x63'),_0x41fb41);throw _0x41fb41;});}return _0x9d0603;})[_0xe9bd('0x1b')](respondWithResult(_0x5d1e4b,0xc9))[_0xe9bd('0x25')](handleError(_0x5d1e4b,null));};exports[_0xe9bd('0x32')]=function(_0x2e63c7,_0x1a36aa,_0x466a89){var _0x5e127b;return db[_0xe9bd('0x4f')][_0xe9bd('0x59')]({'where':{'id':_0x2e63c7[_0xe9bd('0x54')]['id']}})[_0xe9bd('0x1b')](handleEntityNotFound(_0x1a36aa,null))[_0xe9bd('0x1b')](saveUpdates(_0x2e63c7[_0xe9bd('0x5c')],null))[_0xe9bd('0x1b')](function(_0x2adc49){if(_0x2adc49){_0x5e127b=_0x2adc49;return db[_0xe9bd('0x4f')]['findAll']({'raw':!![]});}})[_0xe9bd('0x1b')](function(_0x466952){if(_0x466952){var _0x256890=fs[_0xe9bd('0x64')](path[_0xe9bd('0x65')](config[_0xe9bd('0x6e')],_0xe9bd('0x6f')),'utf8');var _0x18519d=fs[_0xe9bd('0x64')](path['join'](config[_0xe9bd('0x6e')],_0xe9bd('0x66')),_0xe9bd('0x67'));var _0x2083c4=ejs[_0xe9bd('0x68')](_0x256890,{'trunks':_0x466952||[]});fs[_0xe9bd('0x70')](_0xe9bd('0x69'),_0x2083c4);var _0x4f3dc6=ejs['render'](_0x18519d,{'trunks':_0x466952||[]});fs[_0xe9bd('0x70')](_0xe9bd('0x6b'),_0x4f3dc6);return respondWithRpcPromise(_0xe9bd('0x6c'),_0xe9bd('0x32'),{'module':_0xe9bd('0x6d')});}return null;})[_0xe9bd('0x1b')](function(_0x1b46f4){if(_0x1b46f4){return _0x5e127b;}})['then'](respondWithResult(_0x1a36aa,null))[_0xe9bd('0x25')](handleError(_0x1a36aa,null));};exports[_0xe9bd('0x36')]=function(_0x29833b,_0x256862,_0x14cdd5){var _0x74063;return db[_0xe9bd('0x4f')]['find']({'where':{'id':_0x29833b['params']['id']}})['then'](handleEntityNotFound(_0x256862,null))[_0xe9bd('0x1b')](removeEntity(_0x256862,null))['then'](function(){return db['Trunk']['findAll']({'raw':!![]});})[_0xe9bd('0x1b')](function(_0x402ab2){var _0xf170d4=fs[_0xe9bd('0x64')](path[_0xe9bd('0x65')](config[_0xe9bd('0x6e')],_0xe9bd('0x6f')),_0xe9bd('0x67'));var _0x14ec42=fs['readFileSync'](path[_0xe9bd('0x65')](config['root'],_0xe9bd('0x66')),_0xe9bd('0x67'));var _0x22c67f=ejs[_0xe9bd('0x68')](_0xf170d4,{'trunks':_0x402ab2});var _0x416938=ejs['render'](_0x14ec42,{'trunks':_0x402ab2});fs['writeFileSync']('/etc/asterisk/sip_xcally_trunks.conf',_0x22c67f);fs[_0xe9bd('0x70')](_0xe9bd('0x6b'),_0x416938);return respondWithRpcPromise('Reload',_0xe9bd('0x36'),{'module':_0xe9bd('0x6d')});})[_0xe9bd('0x25')](handleError(_0x256862,null));}; \ No newline at end of file diff --git a/server/api/trunk/trunk.model.js b/server/api/trunk/trunk.model.js index 1f40295..fdf5231 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 _0xe5f1=['define','tools_trunks','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','exports'];(function(_0x8a2b4d,_0x34c09d){var _0x3ddcfb=function(_0x561006){while(--_0x561006){_0x8a2b4d['push'](_0x8a2b4d['shift']());}};_0x3ddcfb(++_0x34c09d);}(_0xe5f1,0xf2));var _0x1e5f=function(_0x252cde,_0x503adc){_0x252cde=_0x252cde-0x0;var _0x1be614=_0xe5f1[_0x252cde];return _0x1be614;};'use strict';var _=require(_0x1e5f('0x0'));var util=require(_0x1e5f('0x1'));var logger=require(_0x1e5f('0x2'))(_0x1e5f('0x3'));var moment=require(_0x1e5f('0x4'));var BPromise=require(_0x1e5f('0x5'));var rp=require(_0x1e5f('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1e5f('0x7'));var config=require(_0x1e5f('0x8'));var attributes=require('./trunk.attributes');module[_0x1e5f('0x9')]=function(_0x286bba,_0x318d5b){return _0x286bba[_0x1e5f('0xa')]('Trunk',attributes,{'tableName':_0x1e5f('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfedc=['path','rimraf','../../config/environment','./trunk.attributes','exports','Trunk','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xfedc,0x172));var _0xcfed=function(_0x1f71d8,_0x278518){_0x1f71d8=_0x1f71d8-0x0;var _0x10b045=_0xfedc[_0x1f71d8];return _0x10b045;};'use strict';var _=require(_0xcfed('0x0'));var util=require(_0xcfed('0x1'));var logger=require(_0xcfed('0x2'))(_0xcfed('0x3'));var moment=require(_0xcfed('0x4'));var BPromise=require(_0xcfed('0x5'));var rp=require(_0xcfed('0x6'));var fs=require('fs');var path=require(_0xcfed('0x7'));var rimraf=require(_0xcfed('0x8'));var config=require(_0xcfed('0x9'));var attributes=require(_0xcfed('0xa'));module[_0xcfed('0xb')]=function(_0x32c63b,_0x5e7446){return _0x32c63b['define'](_0xcfed('0xc'),attributes,{'tableName':'tools_trunks','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/trunk/trunk.rpc.js b/server/api/trunk/trunk.rpc.js index cbd3a27..f70eb0e 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 _0xee9f=['lodash','moment','bluebird','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Trunk,\x20%s,\x20%s','debug','Trunk,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent','result','GetTrunk','findAll','raw','options','where','limit','include','map','model','attributes','catch','ShowTrunk','Trunk','find'];(function(_0x326f81,_0x57c9d8){var _0x8a3c6e=function(_0xde3601){while(--_0xde3601){_0x326f81['push'](_0x326f81['shift']());}};_0x8a3c6e(++_0x57c9d8);}(_0xee9f,0x1c7));var _0xfee9=function(_0x4696b5,_0x300faf){_0x4696b5=_0x4696b5-0x0;var _0x5202c4=_0xee9f[_0x4696b5];return _0x5202c4;};'use strict';var _=require(_0xfee9('0x0'));var util=require('util');var moment=require(_0xfee9('0x1'));var BPromise=require(_0xfee9('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xfee9('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xfee9('0x4'))(_0xfee9('0x5'));var config=require(_0xfee9('0x6'));var jayson=require(_0xfee9('0x7'));var client=jayson[_0xfee9('0x8')][_0xfee9('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x596fe5,_0x418003,_0x1bec2f){return new BPromise(function(_0x4630bf,_0x5010d4){return client[_0xfee9('0xa')](_0x596fe5,_0x1bec2f)[_0xfee9('0xb')](function(_0x33122f){logger[_0xfee9('0xc')](_0xfee9('0xd'),_0x418003,'request\x20sent');logger[_0xfee9('0xe')](_0xfee9('0xf'),_0x418003,'request\x20sent',JSON[_0xfee9('0x10')](_0x33122f));if(_0x33122f['error']){if(_0x33122f[_0xfee9('0x11')]['code']===0x1f4){logger[_0xfee9('0x11')](_0xfee9('0xd'),_0x418003,_0x33122f[_0xfee9('0x11')][_0xfee9('0x12')]);return _0x5010d4(_0x33122f[_0xfee9('0x11')][_0xfee9('0x12')]);}logger[_0xfee9('0x11')](_0xfee9('0xd'),_0x418003,_0x33122f[_0xfee9('0x11')][_0xfee9('0x12')]);return _0x4630bf(_0x33122f[_0xfee9('0x11')][_0xfee9('0x12')]);}else{logger[_0xfee9('0xc')](_0xfee9('0xd'),_0x418003,_0xfee9('0x13'));_0x4630bf(_0x33122f[_0xfee9('0x14')]['message']);}})['catch'](function(_0x3c9920){logger[_0xfee9('0x11')](_0xfee9('0xd'),_0x418003,_0x3c9920);_0x5010d4(_0x3c9920);});});}exports[_0xfee9('0x15')]=function(_0x3e44a0){var _0x13e14e=this;return new Promise(function(_0x28edff,_0x55d70c){return db['Trunk'][_0xfee9('0x16')]({'raw':_0x3e44a0['options']?_0x3e44a0['options'][_0xfee9('0x17')]===undefined?!![]:![]:!![],'where':_0x3e44a0[_0xfee9('0x18')]?_0x3e44a0['options'][_0xfee9('0x19')]||null:null,'attributes':_0x3e44a0['options']?_0x3e44a0[_0xfee9('0x18')]['attributes']||null:null,'limit':_0x3e44a0[_0xfee9('0x18')]?_0x3e44a0['options'][_0xfee9('0x1a')]||null:null,'include':_0x3e44a0[_0xfee9('0x18')]?_0x3e44a0[_0xfee9('0x18')][_0xfee9('0x1b')]?_[_0xfee9('0x1c')](_0x3e44a0['options']['include'],function(_0x26bde0){return{'model':db[_0x26bde0[_0xfee9('0x1d')]],'as':_0x26bde0['as'],'attributes':_0x26bde0[_0xfee9('0x1e')],'include':_0x26bde0[_0xfee9('0x1b')]?_[_0xfee9('0x1c')](_0x26bde0[_0xfee9('0x1b')],function(_0x1941a8){return{'model':db[_0x1941a8[_0xfee9('0x1d')]],'as':_0x1941a8['as'],'attributes':_0x1941a8[_0xfee9('0x1e')],'include':_0x1941a8[_0xfee9('0x1b')]?_[_0xfee9('0x1c')](_0x1941a8[_0xfee9('0x1b')],function(_0x556bd4){return{'model':db[_0x556bd4[_0xfee9('0x1d')]],'as':_0x556bd4['as'],'attributes':_0x556bd4['attributes']};}):[]};}):[]};}):[]:[]})[_0xfee9('0xb')](function(_0x551180){logger[_0xfee9('0xc')]('GetTrunk',_0x3e44a0);logger[_0xfee9('0xe')](_0xfee9('0x15'),_0x3e44a0,JSON['stringify'](_0x551180));_0x28edff(_0x551180);})[_0xfee9('0x1f')](function(_0x30056f){logger[_0xfee9('0x11')](_0xfee9('0x15'),_0x30056f[_0xfee9('0x12')],_0x3e44a0);_0x55d70c(_0x13e14e['error'](0x1f4,_0x30056f['message']));});});};exports[_0xfee9('0x20')]=function(_0x52408a){var _0x38f54b=this;return new Promise(function(_0x59f27a,_0x2781a2){return db[_0xfee9('0x21')][_0xfee9('0x22')]({'raw':_0x52408a[_0xfee9('0x18')]?_0x52408a[_0xfee9('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x52408a[_0xfee9('0x18')]?_0x52408a[_0xfee9('0x18')][_0xfee9('0x19')]||null:null,'attributes':_0x52408a[_0xfee9('0x18')]?_0x52408a[_0xfee9('0x18')][_0xfee9('0x1e')]||null:null,'include':_0x52408a[_0xfee9('0x18')]?_0x52408a[_0xfee9('0x18')][_0xfee9('0x1b')]?_['map'](_0x52408a['options'][_0xfee9('0x1b')],function(_0x68c4ee){return{'model':db[_0x68c4ee[_0xfee9('0x1d')]],'as':_0x68c4ee['as'],'attributes':_0x68c4ee[_0xfee9('0x1e')],'include':_0x68c4ee[_0xfee9('0x1b')]?_[_0xfee9('0x1c')](_0x68c4ee[_0xfee9('0x1b')],function(_0x1b9f24){return{'model':db[_0x1b9f24[_0xfee9('0x1d')]],'as':_0x1b9f24['as'],'attributes':_0x1b9f24['attributes'],'include':_0x1b9f24['include']?_[_0xfee9('0x1c')](_0x1b9f24[_0xfee9('0x1b')],function(_0x58e2a3){return{'model':db[_0x58e2a3[_0xfee9('0x1d')]],'as':_0x58e2a3['as'],'attributes':_0x58e2a3['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x32f12e){logger[_0xfee9('0xc')](_0xfee9('0x20'),_0x52408a);logger[_0xfee9('0xe')](_0xfee9('0x20'),_0x52408a,JSON[_0xfee9('0x10')](_0x32f12e));_0x59f27a(_0x32f12e);})[_0xfee9('0x1f')](function(_0x1803fd){logger['error']('ShowTrunk',_0x1803fd['message'],_0x52408a);_0x2781a2(_0x38f54b[_0xfee9('0x11')](0x1f4,_0x1803fd[_0xfee9('0x12')]));});});}; \ No newline at end of file +var _0xfc9d=['message','result','catch','GetTrunk','Trunk','findAll','options','raw','where','attributes','limit','include','map','model','stringify','ShowTrunk','find','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','Trunk,\x20%s,\x20%s','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','error','code'];(function(_0x2a44f8,_0x5e779d){var _0xfc6cf7=function(_0x2834af){while(--_0x2834af){_0x2a44f8['push'](_0x2a44f8['shift']());}};_0xfc6cf7(++_0x5e779d);}(_0xfc9d,0x15e));var _0xdfc9=function(_0x2f75ce,_0x229bf4){_0x2f75ce=_0x2f75ce-0x0;var _0x5f1f2d=_0xfc9d[_0x2f75ce];return _0x5f1f2d;};'use strict';var _=require(_0xdfc9('0x0'));var util=require(_0xdfc9('0x1'));var moment=require(_0xdfc9('0x2'));var BPromise=require(_0xdfc9('0x3'));var rs=require(_0xdfc9('0x4'));var fs=require('fs');var Redis=require(_0xdfc9('0x5'));var db=require(_0xdfc9('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xdfc9('0x7'))('rpc');var config=require(_0xdfc9('0x8'));var jayson=require(_0xdfc9('0x9'));var client=jayson[_0xdfc9('0xa')][_0xdfc9('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2058cf,_0x39049a,_0x4508f8){return new BPromise(function(_0x560c91,_0x6077c7){return client['request'](_0x2058cf,_0x4508f8)[_0xdfc9('0xc')](function(_0x21f5b5){logger[_0xdfc9('0xd')](_0xdfc9('0xe'),_0x39049a,_0xdfc9('0xf'));logger[_0xdfc9('0x10')](_0xdfc9('0x11'),_0x39049a,'request\x20sent',JSON['stringify'](_0x21f5b5));if(_0x21f5b5[_0xdfc9('0x12')]){if(_0x21f5b5[_0xdfc9('0x12')][_0xdfc9('0x13')]===0x1f4){logger['error']('Trunk,\x20%s,\x20%s',_0x39049a,_0x21f5b5[_0xdfc9('0x12')]['message']);return _0x6077c7(_0x21f5b5[_0xdfc9('0x12')]['message']);}logger['error'](_0xdfc9('0xe'),_0x39049a,_0x21f5b5[_0xdfc9('0x12')][_0xdfc9('0x14')]);return _0x560c91(_0x21f5b5[_0xdfc9('0x12')]['message']);}else{logger[_0xdfc9('0xd')]('Trunk,\x20%s,\x20%s',_0x39049a,'request\x20sent');_0x560c91(_0x21f5b5[_0xdfc9('0x15')][_0xdfc9('0x14')]);}})[_0xdfc9('0x16')](function(_0x13631b){logger[_0xdfc9('0x12')]('Trunk,\x20%s,\x20%s',_0x39049a,_0x13631b);_0x6077c7(_0x13631b);});});}exports[_0xdfc9('0x17')]=function(_0x580c18){var _0x18049f=this;return new Promise(function(_0x3bc513,_0x31290b){return db[_0xdfc9('0x18')][_0xdfc9('0x19')]({'raw':_0x580c18[_0xdfc9('0x1a')]?_0x580c18[_0xdfc9('0x1a')][_0xdfc9('0x1b')]===undefined?!![]:![]:!![],'where':_0x580c18[_0xdfc9('0x1a')]?_0x580c18[_0xdfc9('0x1a')][_0xdfc9('0x1c')]||null:null,'attributes':_0x580c18[_0xdfc9('0x1a')]?_0x580c18['options'][_0xdfc9('0x1d')]||null:null,'limit':_0x580c18[_0xdfc9('0x1a')]?_0x580c18[_0xdfc9('0x1a')][_0xdfc9('0x1e')]||null:null,'include':_0x580c18['options']?_0x580c18[_0xdfc9('0x1a')][_0xdfc9('0x1f')]?_[_0xdfc9('0x20')](_0x580c18[_0xdfc9('0x1a')]['include'],function(_0x510004){return{'model':db[_0x510004[_0xdfc9('0x21')]],'as':_0x510004['as'],'attributes':_0x510004[_0xdfc9('0x1d')],'include':_0x510004[_0xdfc9('0x1f')]?_[_0xdfc9('0x20')](_0x510004[_0xdfc9('0x1f')],function(_0x5eec42){return{'model':db[_0x5eec42[_0xdfc9('0x21')]],'as':_0x5eec42['as'],'attributes':_0x5eec42[_0xdfc9('0x1d')],'include':_0x5eec42[_0xdfc9('0x1f')]?_[_0xdfc9('0x20')](_0x5eec42[_0xdfc9('0x1f')],function(_0x32d123){return{'model':db[_0x32d123[_0xdfc9('0x21')]],'as':_0x32d123['as'],'attributes':_0x32d123['attributes']};}):[]};}):[]};}):[]:[]})[_0xdfc9('0xc')](function(_0x17bdfe){logger[_0xdfc9('0xd')]('GetTrunk',_0x580c18);logger['debug'](_0xdfc9('0x17'),_0x580c18,JSON[_0xdfc9('0x22')](_0x17bdfe));_0x3bc513(_0x17bdfe);})[_0xdfc9('0x16')](function(_0x4fe476){logger['error']('GetTrunk',_0x4fe476['message'],_0x580c18);_0x31290b(_0x18049f[_0xdfc9('0x12')](0x1f4,_0x4fe476[_0xdfc9('0x14')]));});});};exports[_0xdfc9('0x23')]=function(_0x384c10){var _0x279dfb=this;return new Promise(function(_0x3b5b4e,_0x5e7553){return db[_0xdfc9('0x18')][_0xdfc9('0x24')]({'raw':_0x384c10[_0xdfc9('0x1a')]?_0x384c10[_0xdfc9('0x1a')][_0xdfc9('0x1b')]===undefined?!![]:![]:!![],'where':_0x384c10[_0xdfc9('0x1a')]?_0x384c10[_0xdfc9('0x1a')][_0xdfc9('0x1c')]||null:null,'attributes':_0x384c10[_0xdfc9('0x1a')]?_0x384c10['options'][_0xdfc9('0x1d')]||null:null,'include':_0x384c10[_0xdfc9('0x1a')]?_0x384c10[_0xdfc9('0x1a')][_0xdfc9('0x1f')]?_[_0xdfc9('0x20')](_0x384c10[_0xdfc9('0x1a')][_0xdfc9('0x1f')],function(_0x35e3e3){return{'model':db[_0x35e3e3['model']],'as':_0x35e3e3['as'],'attributes':_0x35e3e3[_0xdfc9('0x1d')],'include':_0x35e3e3[_0xdfc9('0x1f')]?_[_0xdfc9('0x20')](_0x35e3e3[_0xdfc9('0x1f')],function(_0x34cf91){return{'model':db[_0x34cf91[_0xdfc9('0x21')]],'as':_0x34cf91['as'],'attributes':_0x34cf91[_0xdfc9('0x1d')],'include':_0x34cf91['include']?_[_0xdfc9('0x20')](_0x34cf91[_0xdfc9('0x1f')],function(_0x2a791f){return{'model':db[_0x2a791f['model']],'as':_0x2a791f['as'],'attributes':_0x2a791f[_0xdfc9('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xdfc9('0xc')](function(_0x3d9820){logger[_0xdfc9('0xd')](_0xdfc9('0x23'),_0x384c10);logger[_0xdfc9('0x10')](_0xdfc9('0x23'),_0x384c10,JSON['stringify'](_0x3d9820));_0x3b5b4e(_0x3d9820);})['catch'](function(_0x8a3a8){logger['error'](_0xdfc9('0x23'),_0x8a3a8[_0xdfc9('0x14')],_0x384c10);_0x5e7553(_0x279dfb[_0xdfc9('0x12')](0x1f4,_0x8a3a8[_0xdfc9('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/user-setting/index.js b/server/api/user-setting/index.js index 0ac0aba..b37699a 100644 --- a/server/api/user-setting/index.js +++ b/server/api/user-setting/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0492=['exports','express','../../components/auth/service','./user-setting.controller','put','/:id','update'];(function(_0x301566,_0x4a8dab){var _0x2c80fd=function(_0x4896af){while(--_0x4896af){_0x301566['push'](_0x301566['shift']());}};_0x2c80fd(++_0x4a8dab);}(_0x0492,0x158));var _0x2049=function(_0xda464c,_0x26e47d){_0xda464c=_0xda464c-0x0;var _0x19e222=_0x0492[_0xda464c];return _0x19e222;};'use strict';var express=require(_0x2049('0x0'));var router=express['Router']();var auth=require(_0x2049('0x1'));var controller=require(_0x2049('0x2'));router[_0x2049('0x3')](_0x2049('0x4'),auth['isAuthenticated'](),controller[_0x2049('0x5')]);module[_0x2049('0x6')]=router; \ No newline at end of file +var _0x8649=['../../components/auth/service','./user-setting.controller','put','/:id','update','exports','Router'];(function(_0x418397,_0x180f68){var _0x4a7c35=function(_0x53f6a0){while(--_0x53f6a0){_0x418397['push'](_0x418397['shift']());}};_0x4a7c35(++_0x180f68);}(_0x8649,0x76));var _0x9864=function(_0x457cbd,_0x2f6337){_0x457cbd=_0x457cbd-0x0;var _0x406bbe=_0x8649[_0x457cbd];return _0x406bbe;};'use strict';var express=require('express');var router=express[_0x9864('0x0')]();var auth=require(_0x9864('0x1'));var controller=require(_0x9864('0x2'));router[_0x9864('0x3')](_0x9864('0x4'),auth['isAuthenticated'](),controller[_0x9864('0x5')]);module[_0x9864('0x6')]=router; \ No newline at end of file diff --git a/server/api/user-setting/user-setting.attributes.js b/server/api/user-setting/user-setting.attributes.js index 9c6f85b..ecbe4c5 100644 --- a/server/api/user-setting/user-setting.attributes.js +++ b/server/api/user-setting/user-setting.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['exports','BOOLEAN','DATE','sequelize','error','warning'];(function(_0xb90f24,_0x397070){var _0x56a8f8=function(_0x20b18f){while(--_0x20b18f){_0xb90f24['push'](_0xb90f24['shift']());}};_0x56a8f8(++_0x397070);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2160a9,_0x3cbd9e){_0x2160a9=_0x2160a9-0x0;var _0xa88cf7=_0xa9e0[_0x2160a9];return _0xa88cf7;};'use strict';var Sequelize=require(_0x0a9e('0x0'));const CLIENT_SIDE_LOG_LEVELS=[_0x0a9e('0x1'),_0x0a9e('0x2'),'info','debug'];module[_0x0a9e('0x3')]={'clientSideLoggingLevel':{'type':Sequelize['ENUM'](CLIENT_SIDE_LOG_LEVELS),'allowNull':![],'defaultValue':_0x0a9e('0x1'),'validate':{'isIn':[CLIENT_SIDE_LOG_LEVELS]}},'clientSideLoggingEnabled':{'type':Sequelize[_0x0a9e('0x4')],'defaultValue':![]},'clientSideLoggingEnabledSince':{'type':Sequelize[_0x0a9e('0x5')],'allowNull':!![],'defaultValue':null}}; \ No newline at end of file +var _0xa9e0=['exports','BOOLEAN','DATE','sequelize','error','warning'];(function(_0x42c62b,_0xc0673c){var _0x204c57=function(_0x5f190f){while(--_0x5f190f){_0x42c62b['push'](_0x42c62b['shift']());}};_0x204c57(++_0xc0673c);}(_0xa9e0,0x123));var _0x0a9e=function(_0xf0bcac,_0x531755){_0xf0bcac=_0xf0bcac-0x0;var _0x4e4c65=_0xa9e0[_0xf0bcac];return _0x4e4c65;};'use strict';var Sequelize=require(_0x0a9e('0x0'));const CLIENT_SIDE_LOG_LEVELS=[_0x0a9e('0x1'),_0x0a9e('0x2'),'info','debug'];module[_0x0a9e('0x3')]={'clientSideLoggingLevel':{'type':Sequelize['ENUM'](CLIENT_SIDE_LOG_LEVELS),'allowNull':![],'defaultValue':_0x0a9e('0x1'),'validate':{'isIn':[CLIENT_SIDE_LOG_LEVELS]}},'clientSideLoggingEnabled':{'type':Sequelize[_0x0a9e('0x4')],'defaultValue':![]},'clientSideLoggingEnabledSince':{'type':Sequelize[_0x0a9e('0x5')],'allowNull':!![],'defaultValue':null}}; \ No newline at end of file diff --git a/server/api/user-setting/user-setting.controller.js b/server/api/user-setting/user-setting.controller.js index f163b77..ba67de7 100644 --- a/server/api/user-setting/user-setting.controller.js +++ b/server/api/user-setting/user-setting.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb43b=['defaults','status','json','update','sendStatus','name','send','user','role','admin','params','UserSetting','find','then','body','catch','lodash','../../config/logger','api','../../config/environment','../../mysqldb','socket.io-emitter','redis','./user-setting.socket','register'];(function(_0x3659e0,_0x364f9a){var _0x21d0ab=function(_0x2efd4f){while(--_0x2efd4f){_0x3659e0['push'](_0x3659e0['shift']());}};_0x21d0ab(++_0x364f9a);}(_0xb43b,0xbf));var _0xbb43=function(_0x59649d,_0x55a5c1){_0x59649d=_0x59649d-0x0;var _0x6417e1=_0xb43b[_0x59649d];return _0x6417e1;};'use strict';var _=require(_0xbb43('0x0'));var Redis=require('ioredis');var logger=require(_0xbb43('0x1'))(_0xbb43('0x2'));var config=require(_0xbb43('0x3'));var db=require(_0xbb43('0x4'))['db'];var socket=require(_0xbb43('0x5'))(new Redis(config[_0xbb43('0x6')]));require(_0xbb43('0x7'))[_0xbb43('0x8')](socket);config[_0xbb43('0x6')]=_[_0xbb43('0x9')](config[_0xbb43('0x6')],{'host':'localhost','port':0x18eb});function respondWithResult(_0x16fc1c,_0x4a070c){_0x4a070c=_0x4a070c||0xc8;return function(_0x54806a){if(_0x54806a){return _0x16fc1c[_0xbb43('0xa')](_0x4a070c)[_0xbb43('0xb')](_0x54806a);}};}function saveUpdates(_0x20ed03){return function(_0x2239d8){if(_0x2239d8){return _0x2239d8[_0xbb43('0xc')](_0x20ed03)['then'](function(_0x9d2ac7){return _0x9d2ac7;});}return null;};}function handleEntityNotFound(_0x55a6da){return function(_0x121f18){if(!_0x121f18){_0x55a6da[_0xbb43('0xd')](0x194);}return _0x121f18;};}function handleError(_0x5a4589,_0xba4e2){_0xba4e2=_0xba4e2||0x1f4;return function(_0x192286){logger['error'](_0x192286['stack']);if(_0x192286['name']){delete _0x192286[_0xbb43('0xe')];}_0x5a4589['status'](_0xba4e2)[_0xbb43('0xf')](_0x192286);};}exports['update']=function(_0x2b0f1d,_0x217a4e){if(_0x2b0f1d[_0xbb43('0x10')][_0xbb43('0x11')]!==_0xbb43('0x12'))throw new Error('Unauthorized');if(isNaN(Number(_0x2b0f1d[_0xbb43('0x13')]['id'])))throw new Error('Invalid\x20user\x20setting\x20id');return db[_0xbb43('0x14')][_0xbb43('0x15')]({'where':{'id':_0x2b0f1d[_0xbb43('0x13')]['id']}})[_0xbb43('0x16')](handleEntityNotFound(_0x217a4e,null))[_0xbb43('0x16')](saveUpdates(_0x2b0f1d[_0xbb43('0x17')],null))[_0xbb43('0x16')](respondWithResult(_0x217a4e,null))[_0xbb43('0x18')](handleError(_0x217a4e,null));}; \ No newline at end of file +var _0x3eec=['socket.io-emitter','redis','./user-setting.socket','register','localhost','status','json','update','sendStatus','stack','name','send','user','admin','Unauthorized','params','Invalid\x20user\x20setting\x20id','UserSetting','find','then','catch','lodash','ioredis','../../config/logger','api','../../mysqldb'];(function(_0x32f7d7,_0x54231b){var _0x133d09=function(_0x41a7ab){while(--_0x41a7ab){_0x32f7d7['push'](_0x32f7d7['shift']());}};_0x133d09(++_0x54231b);}(_0x3eec,0x1e9));var _0xc3ee=function(_0x413d58,_0x2cfcb8){_0x413d58=_0x413d58-0x0;var _0xbe549a=_0x3eec[_0x413d58];return _0xbe549a;};'use strict';var _=require(_0xc3ee('0x0'));var Redis=require(_0xc3ee('0x1'));var logger=require(_0xc3ee('0x2'))(_0xc3ee('0x3'));var config=require('../../config/environment');var db=require(_0xc3ee('0x4'))['db'];var socket=require(_0xc3ee('0x5'))(new Redis(config[_0xc3ee('0x6')]));require(_0xc3ee('0x7'))[_0xc3ee('0x8')](socket);config[_0xc3ee('0x6')]=_['defaults'](config[_0xc3ee('0x6')],{'host':_0xc3ee('0x9'),'port':0x18eb});function respondWithResult(_0xea4318,_0x2cc750){_0x2cc750=_0x2cc750||0xc8;return function(_0x356374){if(_0x356374){return _0xea4318[_0xc3ee('0xa')](_0x2cc750)[_0xc3ee('0xb')](_0x356374);}};}function saveUpdates(_0x2c9701){return function(_0x6325a3){if(_0x6325a3){return _0x6325a3[_0xc3ee('0xc')](_0x2c9701)['then'](function(_0x523511){return _0x523511;});}return null;};}function handleEntityNotFound(_0x15d756){return function(_0x155e0f){if(!_0x155e0f){_0x15d756[_0xc3ee('0xd')](0x194);}return _0x155e0f;};}function handleError(_0x1a2bea,_0x4f27b5){_0x4f27b5=_0x4f27b5||0x1f4;return function(_0x1c4eac){logger['error'](_0x1c4eac[_0xc3ee('0xe')]);if(_0x1c4eac[_0xc3ee('0xf')]){delete _0x1c4eac['name'];}_0x1a2bea['status'](_0x4f27b5)[_0xc3ee('0x10')](_0x1c4eac);};}exports['update']=function(_0x7ce8a7,_0x535d1a){if(_0x7ce8a7[_0xc3ee('0x11')]['role']!==_0xc3ee('0x12'))throw new Error(_0xc3ee('0x13'));if(isNaN(Number(_0x7ce8a7[_0xc3ee('0x14')]['id'])))throw new Error(_0xc3ee('0x15'));return db[_0xc3ee('0x16')][_0xc3ee('0x17')]({'where':{'id':_0x7ce8a7[_0xc3ee('0x14')]['id']}})['then'](handleEntityNotFound(_0x535d1a,null))[_0xc3ee('0x18')](saveUpdates(_0x7ce8a7['body'],null))[_0xc3ee('0x18')](respondWithResult(_0x535d1a,null))[_0xc3ee('0x19')](handleError(_0x535d1a,null));}; \ No newline at end of file diff --git a/server/api/user-setting/user-setting.events.js b/server/api/user-setting/user-setting.events.js index 32628ff..38b1234 100644 --- a/server/api/user-setting/user-setting.events.js +++ b/server/api/user-setting/user-setting.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1757=['hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners','update','remove','emit'];(function(_0x151721,_0x20d5bc){var _0x2deaa7=function(_0x499812){while(--_0x499812){_0x151721['push'](_0x151721['shift']());}};_0x2deaa7(++_0x20d5bc);}(_0x1757,0xd2));var _0x7175=function(_0x144071,_0x33edf1){_0x144071=_0x144071-0x0;var _0x2dc87c=_0x1757[_0x144071];return _0x2dc87c;};'use strict';var EventEmitter=require(_0x7175('0x0'));var UserSetting=require(_0x7175('0x1'))['db']['UserSetting'];var UserSettingEvents=new EventEmitter();UserSettingEvents[_0x7175('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x7175('0x3'),'afterDestroy':_0x7175('0x4')};function emitEvent(_0x1048ec){return function(_0x1eea88,_0x32a213,_0x791a28){UserSettingEvents[_0x7175('0x5')](_0x1048ec+':'+_0x1eea88['id'],_0x1eea88);UserSettingEvents[_0x7175('0x5')](_0x1048ec,_0x1eea88);_0x791a28(null);};}for(var e in events){if(events[_0x7175('0x6')](e)){var event=events[e];UserSetting[_0x7175('0x7')](e,emitEvent(event));}}module[_0x7175('0x8')]=UserSettingEvents; \ No newline at end of file +var _0x1d90=['setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x2257a6,_0x1f5a37){var _0x418925=function(_0x26a6c6){while(--_0x26a6c6){_0x2257a6['push'](_0x2257a6['shift']());}};_0x418925(++_0x1f5a37);}(_0x1d90,0x102));var _0x01d9=function(_0x11b58d,_0x555c55){_0x11b58d=_0x11b58d-0x0;var _0xc2811b=_0x1d90[_0x11b58d];return _0xc2811b;};'use strict';var EventEmitter=require(_0x01d9('0x0'));var UserSetting=require(_0x01d9('0x1'))['db']['UserSetting'];var UserSettingEvents=new EventEmitter();UserSettingEvents[_0x01d9('0x2')](0x0);var events={'afterCreate':_0x01d9('0x3'),'afterUpdate':_0x01d9('0x4'),'afterDestroy':_0x01d9('0x5')};function emitEvent(_0x2ec3f0){return function(_0x20c38a,_0x2477be,_0x301c81){UserSettingEvents[_0x01d9('0x6')](_0x2ec3f0+':'+_0x20c38a['id'],_0x20c38a);UserSettingEvents[_0x01d9('0x6')](_0x2ec3f0,_0x20c38a);_0x301c81(null);};}for(var e in events){if(events[_0x01d9('0x7')](e)){var event=events[e];UserSetting[_0x01d9('0x8')](e,emitEvent(event));}}module[_0x01d9('0x9')]=UserSettingEvents; \ No newline at end of file diff --git a/server/api/user-setting/user-setting.model.js b/server/api/user-setting/user-setting.model.js index d8c469e..fee3a92 100644 --- a/server/api/user-setting/user-setting.model.js +++ b/server/api/user-setting/user-setting.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2547=['define','UserSetting','user_settings','clientSideLoggingEnabled','clientSideLoggingEnabledSince','exports'];(function(_0xbd08b4,_0x4790ed){var _0x314f1e=function(_0x161589){while(--_0x161589){_0xbd08b4['push'](_0xbd08b4['shift']());}};_0x314f1e(++_0x4790ed);}(_0x2547,0x1cd));var _0x7254=function(_0x4860b4,_0x335d9f){_0x4860b4=_0x4860b4-0x0;var _0x479307=_0x2547[_0x4860b4];return _0x479307;};'use strict';var attributes=require('./user-setting.attributes');module[_0x7254('0x0')]=function(_0x23e38c){return _0x23e38c[_0x7254('0x1')](_0x7254('0x2'),attributes,{'tableName':_0x7254('0x3'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x1a36de){if(!_0x1a36de[_0x7254('0x4')])_0x1a36de[_0x7254('0x5')]=null;else if(_0x1a36de['clientSideLoggingEnabledSince']===null)_0x1a36de[_0x7254('0x5')]=new Date();}}});}; \ No newline at end of file +var _0x5423=['exports','define','UserSetting','clientSideLoggingEnabled','clientSideLoggingEnabledSince','./user-setting.attributes'];(function(_0x243c74,_0x16c08d){var _0x24d59e=function(_0x29cb65){while(--_0x29cb65){_0x243c74['push'](_0x243c74['shift']());}};_0x24d59e(++_0x16c08d);}(_0x5423,0xe3));var _0x3542=function(_0x1322ae,_0x2bb29e){_0x1322ae=_0x1322ae-0x0;var _0x1048c2=_0x5423[_0x1322ae];return _0x1048c2;};'use strict';var attributes=require(_0x3542('0x0'));module[_0x3542('0x1')]=function(_0x511bd3){return _0x511bd3[_0x3542('0x2')](_0x3542('0x3'),attributes,{'tableName':'user_settings','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0xec03e2){if(!_0xec03e2[_0x3542('0x4')])_0xec03e2[_0x3542('0x5')]=null;else if(_0xec03e2[_0x3542('0x5')]===null)_0xec03e2['clientSideLoggingEnabledSince']=new Date();}}});}; \ No newline at end of file diff --git a/server/api/user-setting/user-setting.socket.js b/server/api/user-setting/user-setting.socket.js index 06d9f28..5df0c23 100644 --- a/server/api/user-setting/user-setting.socket.js +++ b/server/api/user-setting/user-setting.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3581=['./user-setting.events','save','remove','update','emit','user-setting:update','user-setting:update:user-','length','user-setting:'];(function(_0x11c5e0,_0x482d0c){var _0x251020=function(_0x521961){while(--_0x521961){_0x11c5e0['push'](_0x11c5e0['shift']());}};_0x251020(++_0x482d0c);}(_0x3581,0xb4));var _0x1358=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3581[_0x3dd15e];return _0x231fd0;};'use strict';var UserSettingEvents=require(_0x1358('0x0'));var events=[_0x1358('0x1'),_0x1358('0x2'),_0x1358('0x3')];function createListener(_0x4919b9,_0xcde56){return function(_0x6e313b){_0xcde56[_0x1358('0x4')](_0x4919b9,_0x6e313b);if(_0x4919b9===_0x1358('0x5')){_0xcde56['emit'](_0x1358('0x6')+_0x6e313b['UserId'],_0x6e313b);}};}exports['register']=function(_0x3281d0){for(var _0xc10a93=0x0,_0x17413e=events[_0x1358('0x7')];_0xc10a93<_0x17413e;_0xc10a93++){var _0x42dd63=events[_0xc10a93];var _0x1815a0=createListener(_0x1358('0x8')+_0x42dd63,_0x3281d0);UserSettingEvents['on'](_0x42dd63,_0x1815a0);}}; \ No newline at end of file +var _0xddd4=['./user-setting.events','save','emit','user-setting:update:user-','UserId','register','length'];(function(_0x25acf8,_0x184db7){var _0x47b3e5=function(_0x4d5d3d){while(--_0x4d5d3d){_0x25acf8['push'](_0x25acf8['shift']());}};_0x47b3e5(++_0x184db7);}(_0xddd4,0x93));var _0x4ddd=function(_0x47fd36,_0x41535d){_0x47fd36=_0x47fd36-0x0;var _0x21a0fc=_0xddd4[_0x47fd36];return _0x21a0fc;};'use strict';var UserSettingEvents=require(_0x4ddd('0x0'));var events=[_0x4ddd('0x1'),'remove','update'];function createListener(_0x3287e7,_0x55595a){return function(_0x2f4f43){_0x55595a['emit'](_0x3287e7,_0x2f4f43);if(_0x3287e7==='user-setting:update'){_0x55595a[_0x4ddd('0x2')](_0x4ddd('0x3')+_0x2f4f43[_0x4ddd('0x4')],_0x2f4f43);}};}exports[_0x4ddd('0x5')]=function(_0x7b2aa6){for(var _0x5ca34c=0x0,_0x469b6f=events[_0x4ddd('0x6')];_0x5ca34c<_0x469b6f;_0x5ca34c++){var _0x2a7122=events[_0x5ca34c];var _0x2e6941=createListener('user-setting:'+_0x2a7122,_0x7b2aa6);UserSettingEvents['on'](_0x2a7122,_0x2e6941);}}; \ No newline at end of file diff --git a/server/api/user/index.js b/server/api/user/index.js index f9df952..30695fb 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 _0xfb04=['removeMailInteractions','removeFaxInteractions','/:id/whatsapp_interactions','removeWhatsappInteractions','removeFaxAccounts','removeMailAccounts','removeOpenchannelAccounts','removeSmsAccounts','removeChatWebsites','removeSquareProjects','/:id/api_key','removeApiKey','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../config/environment','get','index','describe','isAuthenticated','whoami','/presence','getPresence','/:id','show','/:id/avatar','/:id/open_tabs','getOpenTabs','/:id/contacts','getContacts','/:id/queues','getQueues','/:id/queues_rt','getVoiceQueuesRt','/:id/groups','getGroups','/:id/recordings','getRecordings','/:id/screen_recordings','/:id/chat/interactions','/:id/openchannel/interactions','getOpenchannelInteractions','/:id/mail/interactions','/:id/sms/interactions','getSmsInteractions','getFaxInteractions','/:id/whatsapp/interactions','/:id/teams','getTeams','/:id/lists','/:id/agents','getAgents','/:id/prefixes','/:id/fax_accounts','getFaxAccounts','getMailAccounts','/:id/openchannel_accounts','getOpenchannelAccounts','/:id/sms_accounts','getSmsAccounts','/:id/chat_websites','getChatWebsites','/:id/whatsapp_accounts','/:id/square_projects','getSquareProjects','/:id/scheduled_calls','getScheduledCalls','getApiKey','post','addContacts','create','/create_many','bulkCreate','addQueues','join','root','format','now','originalname','addAvatar','/:id/login','login','/:id/logout','logout','/:id/unpause','unpause','addTeams','/:id/chat_interactions','/:id/mail_interactions','/:id/fax_interactions','addFaxInteractions','/:id/sms_interactions','/:id/openchannel_interactions','addOpenchannelInteractions','addWhatsappInteractions','addFaxAccounts','/:id/mail_accounts','addMailAccounts','addSmsAccounts','addChatWebsites','put','update','/:id/password','changePassword','delete','removeQueues','removeChatInteractions'];(function(_0x263a74,_0xc31414){var _0x2aa86c=function(_0x382896){while(--_0x382896){_0x263a74['push'](_0x263a74['shift']());}};_0x2aa86c(++_0xc31414);}(_0xfb04,0x15d));var _0x4fb0=function(_0x3af0f6,_0x4e952f){_0x3af0f6=_0x3af0f6-0x0;var _0x135a35=_0xfb04[_0x3af0f6];return _0x135a35;};'use strict';var multer=require(_0x4fb0('0x0'));var util=require(_0x4fb0('0x1'));var path=require(_0x4fb0('0x2'));var timeout=require(_0x4fb0('0x3'));var express=require(_0x4fb0('0x4'));var router=express[_0x4fb0('0x5')]();var fs_extra=require(_0x4fb0('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x4fb0('0x7'));var controller=require('./user.controller');router[_0x4fb0('0x8')]('/',auth['isAuthenticated'](),controller[_0x4fb0('0x9')]);router[_0x4fb0('0x8')]('/describe',auth['isAuthenticated'](),controller[_0x4fb0('0xa')]);router['get']('/whoami',auth[_0x4fb0('0xb')](),controller[_0x4fb0('0xc')]);router[_0x4fb0('0x8')](_0x4fb0('0xd'),auth[_0x4fb0('0xb')](),controller[_0x4fb0('0xe')]);router['get'](_0x4fb0('0xf'),auth[_0x4fb0('0xb')](),controller[_0x4fb0('0x10')]);router['get'](_0x4fb0('0x11'),controller['getAvatar']);router[_0x4fb0('0x8')](_0x4fb0('0x12'),auth[_0x4fb0('0xb')](),controller[_0x4fb0('0x13')]);router[_0x4fb0('0x8')](_0x4fb0('0x14'),auth['isAuthenticated'](),controller[_0x4fb0('0x15')]);router[_0x4fb0('0x8')](_0x4fb0('0x16'),auth[_0x4fb0('0xb')](),controller[_0x4fb0('0x17')]);router['get'](_0x4fb0('0x18'),auth[_0x4fb0('0xb')](),controller[_0x4fb0('0x19')]);router['get'](_0x4fb0('0x1a'),auth['isAuthenticated'](),controller[_0x4fb0('0x1b')]);router[_0x4fb0('0x8')](_0x4fb0('0x1c'),auth[_0x4fb0('0xb')](),controller[_0x4fb0('0x1d')]);router[_0x4fb0('0x8')](_0x4fb0('0x1e'),auth[_0x4fb0('0xb')](),controller['getScreenRecordings']);router[_0x4fb0('0x8')](_0x4fb0('0x1f'),auth['isAuthenticated'](),controller['getChatInteractions']);router[_0x4fb0('0x8')](_0x4fb0('0x20'),auth[_0x4fb0('0xb')](),controller[_0x4fb0('0x21')]);router[_0x4fb0('0x8')](_0x4fb0('0x22'),auth['isAuthenticated'](),controller['getMailInteractions']);router[_0x4fb0('0x8')](_0x4fb0('0x23'),auth['isAuthenticated'](),controller[_0x4fb0('0x24')]);router['get']('/:id/fax/interactions',auth[_0x4fb0('0xb')](),controller[_0x4fb0('0x25')]);router['get'](_0x4fb0('0x26'),auth[_0x4fb0('0xb')](),controller['getWhatsappInteractions']);router[_0x4fb0('0x8')](_0x4fb0('0x27'),auth[_0x4fb0('0xb')](),controller[_0x4fb0('0x28')]);router['get'](_0x4fb0('0x29'),auth[_0x4fb0('0xb')](),controller['getLists']);router[_0x4fb0('0x8')](_0x4fb0('0x2a'),auth[_0x4fb0('0xb')](),controller[_0x4fb0('0x2b')]);router[_0x4fb0('0x8')](_0x4fb0('0x2c'),auth['isAuthenticated'](),controller['getVoicePrefixes']);router['get'](_0x4fb0('0x2d'),auth[_0x4fb0('0xb')](),controller[_0x4fb0('0x2e')]);router[_0x4fb0('0x8')]('/:id/mail_accounts',auth[_0x4fb0('0xb')](),controller[_0x4fb0('0x2f')]);router['get'](_0x4fb0('0x30'),auth[_0x4fb0('0xb')](),controller[_0x4fb0('0x31')]);router[_0x4fb0('0x8')](_0x4fb0('0x32'),auth[_0x4fb0('0xb')](),controller[_0x4fb0('0x33')]);router['get'](_0x4fb0('0x34'),auth[_0x4fb0('0xb')](),controller[_0x4fb0('0x35')]);router[_0x4fb0('0x8')](_0x4fb0('0x36'),auth[_0x4fb0('0xb')](),controller['getWhatsappAccounts']);router[_0x4fb0('0x8')](_0x4fb0('0x37'),auth['isAuthenticated'](),controller[_0x4fb0('0x38')]);router[_0x4fb0('0x8')](_0x4fb0('0x39'),auth[_0x4fb0('0xb')](),controller[_0x4fb0('0x3a')]);router[_0x4fb0('0x8')]('/:id/api_key',auth[_0x4fb0('0xb')](),controller[_0x4fb0('0x3b')]);router[_0x4fb0('0x3c')](_0x4fb0('0x14'),auth['isAuthenticated'](),controller[_0x4fb0('0x3d')]);router[_0x4fb0('0x3c')]('/',auth['isAuthenticated'](),controller[_0x4fb0('0x3e')]);router[_0x4fb0('0x3c')](_0x4fb0('0x3f'),auth[_0x4fb0('0xb')](),controller[_0x4fb0('0x40')]);router[_0x4fb0('0x3c')](_0x4fb0('0x16'),auth[_0x4fb0('0xb')](),controller[_0x4fb0('0x41')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x2b2179,_0x5a9c5a,_0x587638){_0x587638(null,path[_0x4fb0('0x42')](config[_0x4fb0('0x43')],'server/files/images/'));},'filename':function(_0x5edfec,_0x1547b9,_0x2fc7e8){_0x2fc7e8(null,util[_0x4fb0('0x44')]('%s-%s',Date[_0x4fb0('0x45')](),_0x1547b9[_0x4fb0('0x46')]));}})});router['post']('/:id/avatar',upload['single']('file'),controller[_0x4fb0('0x47')]);router[_0x4fb0('0x3c')](_0x4fb0('0x48'),auth[_0x4fb0('0xb')](),controller[_0x4fb0('0x49')]);router[_0x4fb0('0x3c')](_0x4fb0('0x4a'),auth[_0x4fb0('0xb')](),controller[_0x4fb0('0x4b')]);router['post']('/:id/pause',auth[_0x4fb0('0xb')](),controller['pause']);router[_0x4fb0('0x3c')](_0x4fb0('0x4c'),auth['isAuthenticated'](),controller[_0x4fb0('0x4d')]);router[_0x4fb0('0x3c')]('/:id/teams',auth[_0x4fb0('0xb')](),controller[_0x4fb0('0x4e')]);router['post'](_0x4fb0('0x4f'),auth[_0x4fb0('0xb')](),controller['addChatInteractions']);router[_0x4fb0('0x3c')](_0x4fb0('0x50'),auth[_0x4fb0('0xb')](),controller['addMailInteractions']);router[_0x4fb0('0x3c')](_0x4fb0('0x51'),auth[_0x4fb0('0xb')](),controller[_0x4fb0('0x52')]);router[_0x4fb0('0x3c')](_0x4fb0('0x53'),auth[_0x4fb0('0xb')](),controller['addSmsInteractions']);router[_0x4fb0('0x3c')](_0x4fb0('0x54'),auth[_0x4fb0('0xb')](),controller[_0x4fb0('0x55')]);router[_0x4fb0('0x3c')]('/:id/whatsapp_interactions',auth['isAuthenticated'](),controller[_0x4fb0('0x56')]);router['post'](_0x4fb0('0x2d'),auth[_0x4fb0('0xb')](),controller[_0x4fb0('0x57')]);router[_0x4fb0('0x3c')](_0x4fb0('0x58'),auth[_0x4fb0('0xb')](),controller[_0x4fb0('0x59')]);router[_0x4fb0('0x3c')](_0x4fb0('0x30'),auth[_0x4fb0('0xb')](),controller['addOpenchannelAccounts']);router[_0x4fb0('0x3c')](_0x4fb0('0x32'),auth[_0x4fb0('0xb')](),controller[_0x4fb0('0x5a')]);router['post'](_0x4fb0('0x34'),auth[_0x4fb0('0xb')](),controller[_0x4fb0('0x5b')]);router[_0x4fb0('0x3c')]('/:id/whatsapp_accounts',auth['isAuthenticated'](),controller['addWhatsappAccounts']);router[_0x4fb0('0x3c')](_0x4fb0('0x37'),auth['isAuthenticated'](),controller['addSquareProjects']);router[_0x4fb0('0x3c')]('/:id/api_key',auth[_0x4fb0('0xb')](),controller['createApiKey']);router[_0x4fb0('0x5c')]('/:id',auth['isAuthenticated'](),controller[_0x4fb0('0x5d')]);router[_0x4fb0('0x5c')](_0x4fb0('0x5e'),auth[_0x4fb0('0xb')](),controller[_0x4fb0('0x5f')]);router[_0x4fb0('0x60')]('/:id/queues',auth[_0x4fb0('0xb')](),controller[_0x4fb0('0x61')]);router[_0x4fb0('0x60')]('/:id/teams',auth[_0x4fb0('0xb')](),controller['removeTeams']);router['delete'](_0x4fb0('0xf'),auth[_0x4fb0('0xb')](),controller['destroy']);router[_0x4fb0('0x60')]('/:id/chat_interactions',auth[_0x4fb0('0xb')](),controller[_0x4fb0('0x62')]);router[_0x4fb0('0x60')]('/:id/mail_interactions',auth[_0x4fb0('0xb')](),controller[_0x4fb0('0x63')]);router['delete']('/:id/fax_interactions',auth['isAuthenticated'](),controller[_0x4fb0('0x64')]);router[_0x4fb0('0x60')]('/:id/sms_interactions',auth['isAuthenticated'](),controller['removeSmsInteractions']);router[_0x4fb0('0x60')]('/:id/openchannel_interactions',auth['isAuthenticated'](),controller['removeOpenchannelInteractions']);router['delete'](_0x4fb0('0x65'),auth['isAuthenticated'](),controller[_0x4fb0('0x66')]);router['delete']('/:id/fax_accounts',auth['isAuthenticated'](),controller[_0x4fb0('0x67')]);router[_0x4fb0('0x60')]('/:id/mail_accounts',auth[_0x4fb0('0xb')](),controller[_0x4fb0('0x68')]);router[_0x4fb0('0x60')](_0x4fb0('0x30'),auth[_0x4fb0('0xb')](),controller[_0x4fb0('0x69')]);router[_0x4fb0('0x60')]('/:id/sms_accounts',auth[_0x4fb0('0xb')](),controller[_0x4fb0('0x6a')]);router[_0x4fb0('0x60')](_0x4fb0('0x34'),auth[_0x4fb0('0xb')](),controller[_0x4fb0('0x6b')]);router[_0x4fb0('0x60')]('/:id/whatsapp_accounts',auth[_0x4fb0('0xb')](),controller['removeWhatsappAccounts']);router[_0x4fb0('0x60')]('/:id/square_projects',auth['isAuthenticated'](),controller[_0x4fb0('0x6c')]);router[_0x4fb0('0x60')](_0x4fb0('0x6d'),auth[_0x4fb0('0xb')](),controller[_0x4fb0('0x6e')]);module[_0x4fb0('0x6f')]=router; \ No newline at end of file +var _0xe319=['/:id/openchannel/interactions','getOpenchannelInteractions','/:id/mail/interactions','getSmsInteractions','getFaxInteractions','/:id/whatsapp/interactions','getWhatsappInteractions','/:id/teams','/:id/lists','/:id/agents','/:id/prefixes','getVoicePrefixes','/:id/fax_accounts','getFaxAccounts','/:id/openchannel_accounts','/:id/sms_accounts','getSmsAccounts','getChatWebsites','/:id/whatsapp_accounts','getWhatsappAccounts','/:id/square_projects','getScheduledCalls','/:id/api_key','getApiKey','post','/:id/contacts','addContacts','create','/create_many','bulkCreate','addQueues','diskStorage','join','format','%s-%s','now','originalname','file','/:id/login','login','/:id/logout','logout','/:id/pause','pause','/:id/unpause','unpause','addTeams','/:id/chat_interactions','/:id/mail_interactions','addMailInteractions','/:id/fax_interactions','/:id/sms_interactions','/:id/openchannel_interactions','addOpenchannelInteractions','/:id/whatsapp_interactions','addWhatsappInteractions','addFaxAccounts','/:id/mail_accounts','addMailAccounts','addOpenchannelAccounts','addSmsAccounts','/:id/chat_websites','addChatWebsites','addWhatsappAccounts','createApiKey','put','/:id','update','/:id/password','changePassword','delete','removeQueues','destroy','removeChatInteractions','removeMailInteractions','removeFaxInteractions','removeSmsInteractions','removeOpenchannelInteractions','removeWhatsappInteractions','removeFaxAccounts','removeMailAccounts','removeOpenchannelAccounts','removeChatWebsites','removeWhatsappAccounts','removeSquareProjects','removeApiKey','multer','express','../../components/auth/service','../../components/interaction/service','./user.controller','get','isAuthenticated','index','/describe','describe','/whoami','whoami','/presence','getPresence','show','getAvatar','/:id/open_tabs','getOpenTabs','/:id/queues','getQueues','/:id/queues_rt','getGroups','/:id/recordings','/:id/screen_recordings','getScreenRecordings','/:id/chat/interactions','getChatInteractions'];(function(_0x49d19d,_0x245cf5){var _0x4ebef1=function(_0xf0a4e6){while(--_0xf0a4e6){_0x49d19d['push'](_0x49d19d['shift']());}};_0x4ebef1(++_0x245cf5);}(_0xe319,0xc7));var _0x9e31=function(_0x360aed,_0x4a6994){_0x360aed=_0x360aed-0x0;var _0x56fa9c=_0xe319[_0x360aed];return _0x56fa9c;};'use strict';var multer=require(_0x9e31('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x9e31('0x1'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x9e31('0x2'));var interaction=require(_0x9e31('0x3'));var config=require('../../config/environment');var controller=require(_0x9e31('0x4'));router[_0x9e31('0x5')]('/',auth[_0x9e31('0x6')](),controller[_0x9e31('0x7')]);router[_0x9e31('0x5')](_0x9e31('0x8'),auth['isAuthenticated'](),controller[_0x9e31('0x9')]);router[_0x9e31('0x5')](_0x9e31('0xa'),auth[_0x9e31('0x6')](),controller[_0x9e31('0xb')]);router[_0x9e31('0x5')](_0x9e31('0xc'),auth[_0x9e31('0x6')](),controller[_0x9e31('0xd')]);router['get']('/:id',auth[_0x9e31('0x6')](),controller[_0x9e31('0xe')]);router[_0x9e31('0x5')]('/:id/avatar',controller[_0x9e31('0xf')]);router['get'](_0x9e31('0x10'),auth[_0x9e31('0x6')](),controller[_0x9e31('0x11')]);router['get']('/:id/contacts',auth[_0x9e31('0x6')](),controller['getContacts']);router['get'](_0x9e31('0x12'),auth['isAuthenticated'](),controller[_0x9e31('0x13')]);router[_0x9e31('0x5')](_0x9e31('0x14'),auth[_0x9e31('0x6')](),controller['getVoiceQueuesRt']);router[_0x9e31('0x5')]('/:id/groups',auth[_0x9e31('0x6')](),controller[_0x9e31('0x15')]);router[_0x9e31('0x5')](_0x9e31('0x16'),auth[_0x9e31('0x6')](),controller['getRecordings']);router['get'](_0x9e31('0x17'),auth[_0x9e31('0x6')](),controller[_0x9e31('0x18')]);router[_0x9e31('0x5')](_0x9e31('0x19'),auth[_0x9e31('0x6')](),controller[_0x9e31('0x1a')]);router[_0x9e31('0x5')](_0x9e31('0x1b'),auth[_0x9e31('0x6')](),controller[_0x9e31('0x1c')]);router[_0x9e31('0x5')](_0x9e31('0x1d'),auth[_0x9e31('0x6')](),controller['getMailInteractions']);router[_0x9e31('0x5')]('/:id/sms/interactions',auth['isAuthenticated'](),controller[_0x9e31('0x1e')]);router[_0x9e31('0x5')]('/:id/fax/interactions',auth['isAuthenticated'](),controller[_0x9e31('0x1f')]);router['get'](_0x9e31('0x20'),auth[_0x9e31('0x6')](),controller[_0x9e31('0x21')]);router[_0x9e31('0x5')](_0x9e31('0x22'),auth[_0x9e31('0x6')](),controller['getTeams']);router['get'](_0x9e31('0x23'),auth['isAuthenticated'](),controller['getLists']);router[_0x9e31('0x5')](_0x9e31('0x24'),auth[_0x9e31('0x6')](),controller['getAgents']);router[_0x9e31('0x5')](_0x9e31('0x25'),auth[_0x9e31('0x6')](),controller[_0x9e31('0x26')]);router[_0x9e31('0x5')](_0x9e31('0x27'),auth['isAuthenticated'](),controller[_0x9e31('0x28')]);router[_0x9e31('0x5')]('/:id/mail_accounts',auth[_0x9e31('0x6')](),controller['getMailAccounts']);router['get'](_0x9e31('0x29'),auth[_0x9e31('0x6')](),controller['getOpenchannelAccounts']);router[_0x9e31('0x5')](_0x9e31('0x2a'),auth[_0x9e31('0x6')](),controller[_0x9e31('0x2b')]);router[_0x9e31('0x5')]('/:id/chat_websites',auth['isAuthenticated'](),controller[_0x9e31('0x2c')]);router[_0x9e31('0x5')](_0x9e31('0x2d'),auth[_0x9e31('0x6')](),controller[_0x9e31('0x2e')]);router[_0x9e31('0x5')](_0x9e31('0x2f'),auth[_0x9e31('0x6')](),controller['getSquareProjects']);router[_0x9e31('0x5')]('/:id/scheduled_calls',auth['isAuthenticated'](),controller[_0x9e31('0x30')]);router[_0x9e31('0x5')](_0x9e31('0x31'),auth[_0x9e31('0x6')](),controller[_0x9e31('0x32')]);router[_0x9e31('0x33')](_0x9e31('0x34'),auth[_0x9e31('0x6')](),controller[_0x9e31('0x35')]);router['post']('/',auth['isAuthenticated'](),controller[_0x9e31('0x36')]);router['post'](_0x9e31('0x37'),auth[_0x9e31('0x6')](),controller[_0x9e31('0x38')]);router[_0x9e31('0x33')](_0x9e31('0x12'),auth[_0x9e31('0x6')](),controller[_0x9e31('0x39')]);var upload=multer({'storage':multer[_0x9e31('0x3a')]({'destination':function(_0x2a855c,_0xd438f0,_0x111c20){_0x111c20(null,path[_0x9e31('0x3b')](config['root'],'server/files/images/'));},'filename':function(_0x4bb0ca,_0x198568,_0x4aafec){_0x4aafec(null,util[_0x9e31('0x3c')](_0x9e31('0x3d'),Date[_0x9e31('0x3e')](),_0x198568[_0x9e31('0x3f')]));}})});router['post']('/:id/avatar',upload['single'](_0x9e31('0x40')),controller['addAvatar']);router[_0x9e31('0x33')](_0x9e31('0x41'),auth[_0x9e31('0x6')](),controller[_0x9e31('0x42')]);router[_0x9e31('0x33')](_0x9e31('0x43'),auth[_0x9e31('0x6')](),controller[_0x9e31('0x44')]);router[_0x9e31('0x33')](_0x9e31('0x45'),auth[_0x9e31('0x6')](),controller[_0x9e31('0x46')]);router[_0x9e31('0x33')](_0x9e31('0x47'),auth[_0x9e31('0x6')](),controller[_0x9e31('0x48')]);router[_0x9e31('0x33')]('/:id/teams',auth[_0x9e31('0x6')](),controller[_0x9e31('0x49')]);router[_0x9e31('0x33')](_0x9e31('0x4a'),auth['isAuthenticated'](),controller['addChatInteractions']);router[_0x9e31('0x33')](_0x9e31('0x4b'),auth[_0x9e31('0x6')](),controller[_0x9e31('0x4c')]);router[_0x9e31('0x33')](_0x9e31('0x4d'),auth['isAuthenticated'](),controller['addFaxInteractions']);router[_0x9e31('0x33')](_0x9e31('0x4e'),auth[_0x9e31('0x6')](),controller['addSmsInteractions']);router['post'](_0x9e31('0x4f'),auth[_0x9e31('0x6')](),controller[_0x9e31('0x50')]);router[_0x9e31('0x33')](_0x9e31('0x51'),auth[_0x9e31('0x6')](),controller[_0x9e31('0x52')]);router[_0x9e31('0x33')](_0x9e31('0x27'),auth[_0x9e31('0x6')](),controller[_0x9e31('0x53')]);router[_0x9e31('0x33')](_0x9e31('0x54'),auth[_0x9e31('0x6')](),controller[_0x9e31('0x55')]);router['post'](_0x9e31('0x29'),auth[_0x9e31('0x6')](),controller[_0x9e31('0x56')]);router[_0x9e31('0x33')](_0x9e31('0x2a'),auth[_0x9e31('0x6')](),controller[_0x9e31('0x57')]);router[_0x9e31('0x33')](_0x9e31('0x58'),auth[_0x9e31('0x6')](),controller[_0x9e31('0x59')]);router[_0x9e31('0x33')](_0x9e31('0x2d'),auth[_0x9e31('0x6')](),controller[_0x9e31('0x5a')]);router['post']('/:id/square_projects',auth[_0x9e31('0x6')](),controller['addSquareProjects']);router['post'](_0x9e31('0x31'),auth[_0x9e31('0x6')](),controller[_0x9e31('0x5b')]);router[_0x9e31('0x5c')](_0x9e31('0x5d'),auth[_0x9e31('0x6')](),controller[_0x9e31('0x5e')]);router[_0x9e31('0x5c')](_0x9e31('0x5f'),auth[_0x9e31('0x6')](),controller[_0x9e31('0x60')]);router[_0x9e31('0x61')](_0x9e31('0x12'),auth[_0x9e31('0x6')](),controller[_0x9e31('0x62')]);router[_0x9e31('0x61')](_0x9e31('0x22'),auth[_0x9e31('0x6')](),controller['removeTeams']);router[_0x9e31('0x61')]('/:id',auth[_0x9e31('0x6')](),controller[_0x9e31('0x63')]);router['delete'](_0x9e31('0x4a'),auth[_0x9e31('0x6')](),controller[_0x9e31('0x64')]);router['delete']('/:id/mail_interactions',auth[_0x9e31('0x6')](),controller[_0x9e31('0x65')]);router[_0x9e31('0x61')](_0x9e31('0x4d'),auth[_0x9e31('0x6')](),controller[_0x9e31('0x66')]);router[_0x9e31('0x61')](_0x9e31('0x4e'),auth[_0x9e31('0x6')](),controller[_0x9e31('0x67')]);router[_0x9e31('0x61')](_0x9e31('0x4f'),auth[_0x9e31('0x6')](),controller[_0x9e31('0x68')]);router[_0x9e31('0x61')](_0x9e31('0x51'),auth[_0x9e31('0x6')](),controller[_0x9e31('0x69')]);router[_0x9e31('0x61')](_0x9e31('0x27'),auth[_0x9e31('0x6')](),controller[_0x9e31('0x6a')]);router[_0x9e31('0x61')](_0x9e31('0x54'),auth[_0x9e31('0x6')](),controller[_0x9e31('0x6b')]);router['delete']('/:id/openchannel_accounts',auth[_0x9e31('0x6')](),controller[_0x9e31('0x6c')]);router[_0x9e31('0x61')](_0x9e31('0x2a'),auth[_0x9e31('0x6')](),controller['removeSmsAccounts']);router['delete']('/:id/chat_websites',auth[_0x9e31('0x6')](),controller[_0x9e31('0x6d')]);router[_0x9e31('0x61')](_0x9e31('0x2d'),auth[_0x9e31('0x6')](),controller[_0x9e31('0x6e')]);router[_0x9e31('0x61')](_0x9e31('0x2f'),auth[_0x9e31('0x6')](),controller[_0x9e31('0x6f')]);router['delete'](_0x9e31('0x31'),auth[_0x9e31('0x6')](),controller[_0x9e31('0x70')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/user/user.attributes.js b/server/api/user/user.attributes.js index 4f5cc0c..3123e8e 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 _0xcd94=['passive','actpass','nonat','update,nonat','TEXT','showWebBar','isArray','udp','wss','force_avp','icesupport','dtlsenable','dtlsverify','dtlssetup','dtlscertfile','dtlsprivatekey','rtcp_mux','encryption','avpf','permissions','map','VIRTUAL','phoneBarEnableScreenRecordingByAgent','false','screenrecording','blocked','blockedAt','UNSIGNED','sequelize','moment','util','STRING','name','setDataValue','defaultuser','The\x20name\x20of\x20the\x20user','fullname','format','\x22%s\x22\x20<%s>','getDataValue','email','toLowerCase','ENUM','admin','user','agent','local','internal','accountcode','BOOLEAN','DATE','INTEGER','dynamic','peer','friend','from-sip','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','transport','join','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','shortinfo','inband','auto','yes','update','outgoing','force_rport,comedia','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','\x22\x22\x20<>','always','accept','refuse','originate','uas','fingerprint','active'];(function(_0x7a2b99,_0x5235b1){var _0x559482=function(_0x3a6d89){while(--_0x3a6d89){_0x7a2b99['push'](_0x7a2b99['shift']());}};_0x559482(++_0x5235b1);}(_0xcd94,0xd6));var _0x4cd9=function(_0x43d11d,_0xccff91){_0x43d11d=_0x43d11d-0x0;var _0x38cd08=_0xcd94[_0x43d11d];return _0x38cd08;};'use strict';var Sequelize=require(_0x4cd9('0x0'));var moment=require(_0x4cd9('0x1'));var util=require(_0x4cd9('0x2'));var _=require('lodash');module['exports']={'name':{'type':Sequelize[_0x4cd9('0x3')],'allowNull':![],'unique':_0x4cd9('0x4'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x3b60bf){this[_0x4cd9('0x5')](_0x4cd9('0x4'),_0x3b60bf);this[_0x4cd9('0x5')](_0x4cd9('0x6'),_0x3b60bf);},'comment':_0x4cd9('0x7')},'fullname':{'type':Sequelize['STRING'],'allowNull':![],'set':function(_0x166162){this[_0x4cd9('0x5')](_0x4cd9('0x8'),_0x166162);this[_0x4cd9('0x5')]('callerid',util[_0x4cd9('0x9')](_0x4cd9('0xa'),_0x166162,this[_0x4cd9('0xb')]('internal')));}},'alias':{'type':Sequelize[_0x4cd9('0x3')]},'email':{'type':Sequelize[_0x4cd9('0x3')],'allowNull':![],'unique':_0x4cd9('0xc'),'validate':{'isEmail':!![]},'set':function(_0x311ec0){if(_0x311ec0){this[_0x4cd9('0x5')](_0x4cd9('0xc'),_0x311ec0[_0x4cd9('0xd')]());}}},'role':{'type':Sequelize[_0x4cd9('0xe')](_0x4cd9('0xf'),_0x4cd9('0x10'),_0x4cd9('0x11'),'telephone'),'allowNull':![]},'password':{'type':Sequelize[_0x4cd9('0x3')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0x4cd9('0x3')],'defaultValue':_0x4cd9('0x12')},'internal':{'type':Sequelize['INTEGER'](0xb),'allowNull':![],'unique':_0x4cd9('0x13'),'set':function(_0xef8cc8){this['setDataValue']('internal',_0xef8cc8);this[_0x4cd9('0x5')](_0x4cd9('0x14'),_0xef8cc8);this[_0x4cd9('0x5')]('callerid',util[_0x4cd9('0x9')](_0x4cd9('0xa'),this[_0x4cd9('0xb')](_0x4cd9('0x8')),_0xef8cc8));}},'salt':{'type':Sequelize[_0x4cd9('0x3')]},'phone':{'type':Sequelize[_0x4cd9('0x3')]},'mobile':{'type':Sequelize['STRING']},'address':{'type':Sequelize[_0x4cd9('0x3')]},'zipcode':{'type':Sequelize['STRING']},'userpic':{'type':Sequelize[_0x4cd9('0x3')]},'city':{'type':Sequelize[_0x4cd9('0x3')]},'country':{'type':Sequelize[_0x4cd9('0x3')]},'online':{'type':Sequelize[_0x4cd9('0x15')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0x4cd9('0x16')]},'voicePause':{'type':Sequelize[_0x4cd9('0x15')],'defaultValue':![]},'chatPause':{'type':Sequelize[_0x4cd9('0x15')],'defaultValue':![]},'mailPause':{'type':Sequelize[_0x4cd9('0x15')],'defaultValue':![]},'faxPause':{'type':Sequelize[_0x4cd9('0x15')],'defaultValue':![]},'smsPause':{'type':Sequelize[_0x4cd9('0x15')],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0x4cd9('0x15')],'defaultValue':![]},'openchannelPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'pauseType':{'type':Sequelize[_0x4cd9('0x3')],'defaultValue':'DEFAULT\x20PAUSE'},'lastPauseAt':{'type':Sequelize['DATE']},'chatCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'mailCapacity':{'type':Sequelize[_0x4cd9('0x17')],'defaultValue':0x0},'faxCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'smsCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0x4cd9('0x17')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0x4cd9('0x15')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0x4cd9('0x17')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0x4cd9('0x17')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize['INTEGER'],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0x4cd9('0x15')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0x4cd9('0x15')],'defaultValue':![]},'chanspy':{'type':Sequelize[_0x4cd9('0x15')],'defaultValue':![]},'description':{'type':Sequelize[_0x4cd9('0x3')],'allowNull':!![]},'host':{'type':Sequelize[_0x4cd9('0x3')],'allowNull':!![],'defaultValue':_0x4cd9('0x18')},'ipaddr':{'type':Sequelize[_0x4cd9('0x3')],'allowNull':!![]},'port':{'type':Sequelize[_0x4cd9('0x17')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0x4cd9('0x17')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0x4cd9('0x3')],'allowNull':!![]},'regserver':{'type':Sequelize['STRING'],'allowNull':!![]},'useragent':{'type':Sequelize[_0x4cd9('0x3')],'allowNull':!![]},'lastms':{'type':Sequelize[_0x4cd9('0x17')](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0x4cd9('0xe')]('friend',_0x4cd9('0x10'),_0x4cd9('0x19')),'allowNull':!![],'defaultValue':_0x4cd9('0x1a')},'context':{'type':Sequelize[_0x4cd9('0x3')],'allowNull':!![],'defaultValue':_0x4cd9('0x1b')},'callingpres':{'type':Sequelize['ENUM'](_0x4cd9('0x1c'),_0x4cd9('0x1d'),_0x4cd9('0x1e'),_0x4cd9('0x1f'),_0x4cd9('0x20'),_0x4cd9('0x21'),_0x4cd9('0x22'),_0x4cd9('0x23')),'allowNull':!![]},'deny':{'type':Sequelize[_0x4cd9('0x3')],'allowNull':!![]},'permit':{'type':Sequelize[_0x4cd9('0x3')],'allowNull':!![]},'secret':{'type':Sequelize['STRING'],'allowNull':!![]},'md5secret':{'type':Sequelize[_0x4cd9('0x3')],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0x4cd9('0x3')],'allowNull':!![]},'transport':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':'udp','set':function(_0x59c01b){this['setDataValue'](_0x4cd9('0x24'),_0x59c01b?_0x59c01b[_0x4cd9('0x25')](','):null);},'get':function(){return this['getDataValue']('transport')?this[_0x4cd9('0xb')]('transport')[_0x4cd9('0x26')](','):null;},'comment':_0x4cd9('0x27')},'dtmfmode':{'type':Sequelize[_0x4cd9('0xe')](_0x4cd9('0x28'),_0x4cd9('0x29'),_0x4cd9('0x2a'),_0x4cd9('0x2b'),_0x4cd9('0x2c')),'allowNull':!![],'defaultValue':_0x4cd9('0x28')},'directmedia':{'type':Sequelize[_0x4cd9('0xe')](_0x4cd9('0x2d'),'no','nonat',_0x4cd9('0x2e'),_0x4cd9('0x2f')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x4cd9('0xe')](_0x4cd9('0x2d'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x4cd9('0x3')],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0x4cd9('0x3')],'allowNull':!![]},'nat':{'type':Sequelize[_0x4cd9('0x3')],'allowNull':!![],'defaultValue':_0x4cd9('0x30'),'set':function(_0x3c4df6){this['setDataValue'](_0x4cd9('0x31'),_0x3c4df6?_0x3c4df6[_0x4cd9('0x25')](','):null);},'get':function(){return this['getDataValue'](_0x4cd9('0x31'))?this[_0x4cd9('0xb')](_0x4cd9('0x31'))[_0x4cd9('0x26')](','):null;},'comment':_0x4cd9('0x32')},'callgroup':{'type':Sequelize[_0x4cd9('0x3')]},'namedcallgroup':{'type':Sequelize[_0x4cd9('0x3')]},'pickupgroup':{'type':Sequelize['STRING']},'namedpickupgroup':{'type':Sequelize[_0x4cd9('0x3')]},'language':{'type':Sequelize[_0x4cd9('0x3')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x4cd9('0x3')]},'disallow':{'type':Sequelize[_0x4cd9('0x3')],'allowNull':![],'defaultValue':'all'},'allow':{'type':Sequelize[_0x4cd9('0x3')],'allowNull':![],'defaultValue':_0x4cd9('0x33'),'set':function(_0x3c6dbe){this[_0x4cd9('0x5')](_0x4cd9('0x34'),_0x3c6dbe?_0x3c6dbe['join'](';'):'ulaw;alaw;gsm');},'get':function(){return this[_0x4cd9('0xb')]('allow')?this[_0x4cd9('0xb')](_0x4cd9('0x34'))[_0x4cd9('0x26')](';'):null;},'comment':_0x4cd9('0x35')},'autoframing':{'type':Sequelize[_0x4cd9('0xe')]('yes','no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0x4cd9('0x3')],'allowNull':!![],'set':function(_0x1aadf3){this['setDataValue'](_0x4cd9('0x36'),_0x1aadf3?_0x1aadf3[_0x4cd9('0x25')](','):null);},'get':function(){return this[_0x4cd9('0xb')]('insecure')?this[_0x4cd9('0xb')](_0x4cd9('0x36'))[_0x4cd9('0x26')](','):null;},'comment':_0x4cd9('0x37')},'trustrpid':{'type':Sequelize[_0x4cd9('0xe')](_0x4cd9('0x2d'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize['ENUM'](_0x4cd9('0x2d'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x4cd9('0xe')](_0x4cd9('0x2d'),'no',_0x4cd9('0x38')),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0x4cd9('0xe')]('yes','no'),'allowNull':!![]},'useclientcode':{'type':Sequelize['ENUM'](_0x4cd9('0x2d'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0x4cd9('0x17')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0x4cd9('0x3')],'allowNull':!![]},'callerid':{'type':Sequelize[_0x4cd9('0x3')],'allowNull':!![],'defaultValue':_0x4cd9('0x39')},'amaflags':{'type':Sequelize[_0x4cd9('0x3')],'allowNull':!![]},'callcounter':{'type':Sequelize[_0x4cd9('0xe')](_0x4cd9('0x2d'),'no'),'allowNull':!![],'defaultValue':_0x4cd9('0x2d')},'busylevel':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize['ENUM'](_0x4cd9('0x2d'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0x4cd9('0xe')](_0x4cd9('0x2d'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0x4cd9('0xe')]('yes','no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize['ENUM'](_0x4cd9('0x2d'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0x4cd9('0x3')],'allowNull':!![]},'template':{'type':Sequelize[_0x4cd9('0x3')],'allowNull':!![]},'videosupport':{'type':Sequelize[_0x4cd9('0xe')](_0x4cd9('0x2d'),'no',_0x4cd9('0x3a')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x4cd9('0x17')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0x4cd9('0xe')](_0x4cd9('0x2d'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0x4cd9('0x3')],'allowNull':!![]},'session_timers':{'type':Sequelize[_0x4cd9('0xe')](_0x4cd9('0x3b'),_0x4cd9('0x3c'),_0x4cd9('0x3d')),'allowNull':!![]},'session_expires':{'type':Sequelize[_0x4cd9('0x17')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0x4cd9('0x17')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0x4cd9('0xe')]('uac',_0x4cd9('0x3e')),'allowNull':!![],'defaultValue':'uas'},'t38pt_usertpsource':{'type':Sequelize[_0x4cd9('0x3')],'allowNull':!![]},'regexten':{'type':Sequelize['STRING'],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0x4cd9('0x3')],'allowNull':!![]},'fromuser':{'type':Sequelize[_0x4cd9('0x3')],'allowNull':!![]},'qualify':{'type':Sequelize[_0x4cd9('0xe')]('yes','no'),'allowNull':!![],'defaultValue':_0x4cd9('0x2d')},'keepalive':{'type':Sequelize[_0x4cd9('0x17')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0x4cd9('0x3')],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0x4cd9('0x3')],'allowNull':!![]},'rtptimeout':{'type':Sequelize[_0x4cd9('0x17')](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0x4cd9('0x17')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0x4cd9('0x17')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0x4cd9('0xe')](_0x4cd9('0x2d'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize['STRING'],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0x4cd9('0x3')],'allowNull':!![]},'timert1':{'type':Sequelize[_0x4cd9('0x17')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0x4cd9('0x17')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0x4cd9('0x3')],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0x4cd9('0x3')],'allowNull':!![]},'contactacl':{'type':Sequelize['STRING'],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0x4cd9('0x3')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0x4cd9('0x3')],'allowNull':!![]},'maxforwards':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'encryption':{'type':Sequelize[_0x4cd9('0xe')](_0x4cd9('0x2d'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize['ENUM'](_0x4cd9('0x2d'),'no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0x4cd9('0xe')](_0x4cd9('0x2d'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize[_0x4cd9('0xe')](_0x4cd9('0x2d'),'no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize['ENUM'](_0x4cd9('0x2d'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0x4cd9('0xe')]('yes','no',_0x4cd9('0x3f'),'certificate'),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0x4cd9('0x17')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0x4cd9('0x3')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0x4cd9('0x3')],'allowNull':!![]},'dtlscipher':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscafile':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0x4cd9('0x3')],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0x4cd9('0xe')](_0x4cd9('0x40'),_0x4cd9('0x41'),_0x4cd9('0x42')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x4cd9('0x3')],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0x4cd9('0xe')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize['STRING'],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0x4cd9('0x3')],'allowNull':!![]},'call_limit':{'type':Sequelize[_0x4cd9('0x17')](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0x4cd9('0xe')](_0x4cd9('0x2d'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0x4cd9('0xe')](_0x4cd9('0x2d'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0x4cd9('0x3')],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0x4cd9('0x3')],'allowNull':!![]},'mohsuggest':{'type':Sequelize['STRING'],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0x4cd9('0x3')],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0x4cd9('0xe')]('yes','no',_0x4cd9('0x43'),'update',_0x4cd9('0x44')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0x4cd9('0x15')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0x4cd9('0x3')]},'resetPasswordExpires':{'type':Sequelize['DATE']},'passwordResetAt':{'type':Sequelize[_0x4cd9('0x16')],'defaultValue':null},'previousPasswords':{'type':Sequelize[_0x4cd9('0x45')]},'showWebBar':{'type':Sequelize[_0x4cd9('0x17')],'defaultValue':0x0,'set':function(_0x70f6ac){this[_0x4cd9('0x5')](_0x4cd9('0x46'),_0x70f6ac);var _0x3e6f9b=this['get']({'plain':!![]});switch(_0x70f6ac){case 0x0:case 0x1:var _0x1da0ba=_0x3e6f9b[_0x4cd9('0x24')]?_[_0x4cd9('0x47')](_0x3e6f9b[_0x4cd9('0x24')])?_0x3e6f9b[_0x4cd9('0x24')]['join']():_0x3e6f9b[_0x4cd9('0x24')]:_0x4cd9('0x48');if(_0x1da0ba===_0x4cd9('0x49')){_0x1da0ba=_0x4cd9('0x48');}this[_0x4cd9('0x5')](_0x4cd9('0x24'),_0x1da0ba);this[_0x4cd9('0x5')]('encryption','no');this['setDataValue']('avpf',null);this[_0x4cd9('0x5')](_0x4cd9('0x4a'),null);this[_0x4cd9('0x5')](_0x4cd9('0x4b'),null);this[_0x4cd9('0x5')](_0x4cd9('0x4c'),null);this[_0x4cd9('0x5')](_0x4cd9('0x4d'),null);this[_0x4cd9('0x5')](_0x4cd9('0x4e'),null);this[_0x4cd9('0x5')](_0x4cd9('0x4f'),null);this[_0x4cd9('0x5')](_0x4cd9('0x50'),null);this[_0x4cd9('0x5')](_0x4cd9('0x51'),'no');break;case 0x2:this[_0x4cd9('0x5')](_0x4cd9('0x24'),_0x4cd9('0x49'));this[_0x4cd9('0x5')](_0x4cd9('0x52'),'yes');this[_0x4cd9('0x5')](_0x4cd9('0x53'),_0x4cd9('0x2d'));this[_0x4cd9('0x5')](_0x4cd9('0x4a'),_0x4cd9('0x2d'));this[_0x4cd9('0x5')](_0x4cd9('0x4b'),_0x4cd9('0x2d'));this[_0x4cd9('0x5')](_0x4cd9('0x4c'),_0x4cd9('0x2d'));this[_0x4cd9('0x5')]('dtlsverify','no');this[_0x4cd9('0x5')](_0x4cd9('0x4e'),_0x4cd9('0x42'));this[_0x4cd9('0x5')](_0x4cd9('0x4f'),_0x3e6f9b[_0x4cd9('0x4f')]||'/etc/pki/tls/certs/motion.crt');this[_0x4cd9('0x5')](_0x4cd9('0x50'),_0x3e6f9b[_0x4cd9('0x50')]||'/etc/pki/tls/private/motion.key');this[_0x4cd9('0x5')]('rtcp_mux',_0x4cd9('0x2d'));break;default:}}},'permissions':{'type':Sequelize[_0x4cd9('0x45')],'set':function(_0x176ab5){this[_0x4cd9('0x5')](_0x4cd9('0x54'),_0x176ab5?_0x176ab5[_0x4cd9('0x25')](','):[]);},'get':function(){return this[_0x4cd9('0xb')]('permissions')?_[_0x4cd9('0x55')](this[_0x4cd9('0xb')](_0x4cd9('0x54'))[_0x4cd9('0x26')](','),function(_0x3b4699){return parseInt(_0x3b4699,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0x4cd9('0x3')]},'phoneBarNoReplyNumber':{'type':Sequelize['STRING']},'phoneBarBusyNumber':{'type':Sequelize[_0x4cd9('0x3')]},'phoneBarUnconditional':{'type':Sequelize[_0x4cd9('0x15')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0x4cd9('0x15')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0x4cd9('0x15')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0x4cd9('0x15')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0x4cd9('0x15')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0x4cd9('0x17')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0x4cd9('0x3')],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0x4cd9('0x17')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0x4cd9('0xe')](_0x4cd9('0x2d'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0x4cd9('0x15')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0x4cd9('0x3')]},'phoneBarEnableJaws':{'type':Sequelize[_0x4cd9('0x15')],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0x4cd9('0x56')],'get':function(){return this[_0x4cd9('0xb')]('phoneBarEnableScreenRecordingByAgent')?this[_0x4cd9('0xb')](_0x4cd9('0x57')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0x4cd9('0x15')],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0x4cd9('0x15')],'defaultValue':![]},'interface':{'type':Sequelize[_0x4cd9('0x3')],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0x4cd9('0x15')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize['STRING'],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0x4cd9('0x3')],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0x4cd9('0x15')],'defaultValue':![],'set':function(_0xc2935b){if(typeof _0xc2935b==='string'){var _0x23919f=_0xc2935b==='1'?!![]:_0xc2935b==='0'?![]:_0xc2935b==='true'?!![]:_0xc2935b===_0x4cd9('0x58')?![]:![];this[_0x4cd9('0x5')](_0x4cd9('0x59'),_0x23919f);}else{this['setDataValue']('screenrecording',_0xc2935b);}}},'blocked':{'type':Sequelize[_0x4cd9('0x15')],'defaultValue':![],'set':function(_0x3ae614){this[_0x4cd9('0x5')](_0x4cd9('0x5a'),_0x3ae614);if(_0x3ae614===!![]){this['setDataValue'](_0x4cd9('0x5b'),moment());this['setDataValue']('loginAttempts',0x0);}else{this[_0x4cd9('0x5')](_0x4cd9('0x5b'),null);}}},'blockedAt':{'type':Sequelize[_0x4cd9('0x16')],'defaultValue':null},'loginAttempts':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'disabled':{'type':Sequelize[_0x4cd9('0x15')],'defaultValue':![]},'settingsEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'wssPort':{'type':Sequelize['INTEGER'](0x5)[_0x4cd9('0x5c')],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize[_0x4cd9('0x15')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'ignorePauseForPreviewCalls':{'type':Sequelize[_0x4cd9('0x15')],'defaultValue':![]},'selectRecallMeCampaign':{'type':Sequelize[_0x4cd9('0x15')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0x4cd9('0x15')],'defaultValue':![]}}; \ No newline at end of file +var _0xb367=['DEFAULT\x20PAUSE','DATE','dynamic','ENUM','peer','friend','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB','udp','transport','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','shortinfo','inband','auto','yes','nonat','update','outgoing','force_rport,comedia','nat','join','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','always','refuse','originate','uas','fingerprint','certificate','passive','actpass','get','wss','encryption','avpf','force_avp','icesupport','dtlsverify','dtlscertfile','dtlsprivatekey','rtcp_mux','dtlsenable','dtlssetup','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','TEXT','permissions','map','true','false','screenrecording','blockedAt','loginAttempts','UNSIGNED','moment','util','lodash','exports','STRING','name','setDataValue','defaultuser','The\x20name\x20of\x20the\x20user','fullname','callerid','getDataValue','email','toLowerCase','admin','user','agent','telephone','local','INTEGER','internal','format','BOOLEAN'];(function(_0x3afe18,_0x26922c){var _0x19ed1f=function(_0x1c0660){while(--_0x1c0660){_0x3afe18['push'](_0x3afe18['shift']());}};_0x19ed1f(++_0x26922c);}(_0xb367,0xf1));var _0x7b36=function(_0x11ac64,_0x55cd47){_0x11ac64=_0x11ac64-0x0;var _0x15e739=_0xb367[_0x11ac64];return _0x15e739;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x7b36('0x0'));var util=require(_0x7b36('0x1'));var _=require(_0x7b36('0x2'));module[_0x7b36('0x3')]={'name':{'type':Sequelize[_0x7b36('0x4')],'allowNull':![],'unique':_0x7b36('0x5'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x2e589f){this[_0x7b36('0x6')]('name',_0x2e589f);this['setDataValue'](_0x7b36('0x7'),_0x2e589f);},'comment':_0x7b36('0x8')},'fullname':{'type':Sequelize[_0x7b36('0x4')],'allowNull':![],'set':function(_0x2eadda){this[_0x7b36('0x6')](_0x7b36('0x9'),_0x2eadda);this[_0x7b36('0x6')](_0x7b36('0xa'),util['format']('\x22%s\x22\x20<%s>',_0x2eadda,this[_0x7b36('0xb')]('internal')));}},'alias':{'type':Sequelize[_0x7b36('0x4')]},'email':{'type':Sequelize[_0x7b36('0x4')],'allowNull':![],'unique':_0x7b36('0xc'),'validate':{'isEmail':!![]},'set':function(_0x32ea70){if(_0x32ea70){this[_0x7b36('0x6')]('email',_0x32ea70[_0x7b36('0xd')]());}}},'role':{'type':Sequelize['ENUM'](_0x7b36('0xe'),_0x7b36('0xf'),_0x7b36('0x10'),_0x7b36('0x11')),'allowNull':![]},'password':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0x7b36('0x4')],'defaultValue':_0x7b36('0x12')},'internal':{'type':Sequelize[_0x7b36('0x13')](0xb),'allowNull':![],'unique':_0x7b36('0x14'),'set':function(_0x3e4c11){this[_0x7b36('0x6')](_0x7b36('0x14'),_0x3e4c11);this[_0x7b36('0x6')]('accountcode',_0x3e4c11);this[_0x7b36('0x6')]('callerid',util[_0x7b36('0x15')]('\x22%s\x22\x20<%s>',this[_0x7b36('0xb')](_0x7b36('0x9')),_0x3e4c11));}},'salt':{'type':Sequelize['STRING']},'phone':{'type':Sequelize['STRING']},'mobile':{'type':Sequelize[_0x7b36('0x4')]},'address':{'type':Sequelize['STRING']},'zipcode':{'type':Sequelize[_0x7b36('0x4')]},'userpic':{'type':Sequelize[_0x7b36('0x4')]},'city':{'type':Sequelize[_0x7b36('0x4')]},'country':{'type':Sequelize[_0x7b36('0x4')]},'online':{'type':Sequelize[_0x7b36('0x16')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize['DATE']},'voicePause':{'type':Sequelize[_0x7b36('0x16')],'defaultValue':![]},'chatPause':{'type':Sequelize[_0x7b36('0x16')],'defaultValue':![]},'mailPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'faxPause':{'type':Sequelize[_0x7b36('0x16')],'defaultValue':![]},'smsPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0x7b36('0x16')],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0x7b36('0x16')],'defaultValue':![]},'pauseType':{'type':Sequelize[_0x7b36('0x4')],'defaultValue':_0x7b36('0x17')},'lastPauseAt':{'type':Sequelize[_0x7b36('0x18')]},'chatCapacity':{'type':Sequelize[_0x7b36('0x13')],'defaultValue':0x0},'mailCapacity':{'type':Sequelize[_0x7b36('0x13')],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0x7b36('0x13')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0x7b36('0x13')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0x7b36('0x13')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0x7b36('0x16')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0x7b36('0x16')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0x7b36('0x13')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize['INTEGER'](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0x7b36('0x16')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0x7b36('0x13')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0x7b36('0x16')],'defaultValue':![]},'chanspy':{'type':Sequelize[_0x7b36('0x16')],'defaultValue':![]},'description':{'type':Sequelize[_0x7b36('0x4')],'allowNull':!![]},'host':{'type':Sequelize[_0x7b36('0x4')],'allowNull':!![],'defaultValue':_0x7b36('0x19')},'ipaddr':{'type':Sequelize['STRING'],'allowNull':!![]},'port':{'type':Sequelize[_0x7b36('0x13')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0x7b36('0x13')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0x7b36('0x4')],'allowNull':!![]},'regserver':{'type':Sequelize[_0x7b36('0x4')],'allowNull':!![]},'useragent':{'type':Sequelize[_0x7b36('0x4')],'allowNull':!![]},'lastms':{'type':Sequelize[_0x7b36('0x13')](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0x7b36('0x1a')]('friend',_0x7b36('0xf'),_0x7b36('0x1b')),'allowNull':!![],'defaultValue':_0x7b36('0x1c')},'context':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':'from-sip'},'callingpres':{'type':Sequelize[_0x7b36('0x1a')]('ALLOWED_NOT_SCREENED',_0x7b36('0x1d'),_0x7b36('0x1e'),'ALLOWED',_0x7b36('0x1f'),_0x7b36('0x20'),'PROHIB_FAILED_SCREEN',_0x7b36('0x21')),'allowNull':!![]},'deny':{'type':Sequelize[_0x7b36('0x4')],'allowNull':!![]},'permit':{'type':Sequelize[_0x7b36('0x4')],'allowNull':!![]},'secret':{'type':Sequelize[_0x7b36('0x4')],'allowNull':!![]},'md5secret':{'type':Sequelize[_0x7b36('0x4')],'allowNull':!![]},'remotesecret':{'type':Sequelize['STRING'],'allowNull':!![]},'transport':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x7b36('0x22'),'set':function(_0x5e6233){this[_0x7b36('0x6')](_0x7b36('0x23'),_0x5e6233?_0x5e6233['join'](','):null);},'get':function(){return this[_0x7b36('0xb')]('transport')?this['getDataValue'](_0x7b36('0x23'))[_0x7b36('0x24')](','):null;},'comment':_0x7b36('0x25')},'dtmfmode':{'type':Sequelize[_0x7b36('0x1a')](_0x7b36('0x26'),_0x7b36('0x27'),_0x7b36('0x28'),_0x7b36('0x29'),_0x7b36('0x2a')),'allowNull':!![],'defaultValue':_0x7b36('0x26')},'directmedia':{'type':Sequelize[_0x7b36('0x1a')](_0x7b36('0x2b'),'no',_0x7b36('0x2c'),_0x7b36('0x2d'),_0x7b36('0x2e')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x7b36('0x4')],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0x7b36('0x4')],'allowNull':!![]},'nat':{'type':Sequelize[_0x7b36('0x4')],'allowNull':!![],'defaultValue':_0x7b36('0x2f'),'set':function(_0x10650d){this[_0x7b36('0x6')](_0x7b36('0x30'),_0x10650d?_0x10650d[_0x7b36('0x31')](','):null);},'get':function(){return this[_0x7b36('0xb')](_0x7b36('0x30'))?this['getDataValue'](_0x7b36('0x30'))[_0x7b36('0x24')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]'},'callgroup':{'type':Sequelize[_0x7b36('0x4')]},'namedcallgroup':{'type':Sequelize[_0x7b36('0x4')]},'pickupgroup':{'type':Sequelize[_0x7b36('0x4')]},'namedpickupgroup':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x7b36('0x4')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x7b36('0x4')]},'disallow':{'type':Sequelize[_0x7b36('0x4')],'allowNull':![],'defaultValue':_0x7b36('0x32')},'allow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x7b36('0x33'),'set':function(_0x546fba){this['setDataValue'](_0x7b36('0x34'),_0x546fba?_0x546fba['join'](';'):_0x7b36('0x33'));},'get':function(){return this['getDataValue'](_0x7b36('0x34'))?this['getDataValue']('allow')[_0x7b36('0x24')](';'):null;},'comment':_0x7b36('0x35')},'autoframing':{'type':Sequelize[_0x7b36('0x1a')](_0x7b36('0x2b'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0x7b36('0x4')],'allowNull':!![],'set':function(_0x3a2e7a){this[_0x7b36('0x6')]('insecure',_0x3a2e7a?_0x3a2e7a[_0x7b36('0x31')](','):null);},'get':function(){return this[_0x7b36('0xb')](_0x7b36('0x36'))?this[_0x7b36('0xb')](_0x7b36('0x36'))[_0x7b36('0x24')](','):null;},'comment':_0x7b36('0x37')},'trustrpid':{'type':Sequelize[_0x7b36('0x1a')](_0x7b36('0x2b'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x7b36('0x1a')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x7b36('0x1a')]('yes','no',_0x7b36('0x38')),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0x7b36('0x1a')]('yes','no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0x7b36('0x1a')](_0x7b36('0x2b'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'setvar':{'type':Sequelize['STRING'],'allowNull':!![]},'callerid':{'type':Sequelize[_0x7b36('0x4')],'allowNull':!![],'defaultValue':'\x22\x22\x20<>'},'amaflags':{'type':Sequelize[_0x7b36('0x4')],'allowNull':!![]},'callcounter':{'type':Sequelize[_0x7b36('0x1a')](_0x7b36('0x2b'),'no'),'allowNull':!![],'defaultValue':_0x7b36('0x2b')},'busylevel':{'type':Sequelize[_0x7b36('0x13')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0x7b36('0x1a')](_0x7b36('0x2b'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0x7b36('0x1a')](_0x7b36('0x2b'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0x7b36('0x1a')]('yes','no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0x7b36('0x4')],'allowNull':!![]},'template':{'type':Sequelize[_0x7b36('0x4')],'allowNull':!![]},'videosupport':{'type':Sequelize[_0x7b36('0x1a')](_0x7b36('0x2b'),'no',_0x7b36('0x39')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x7b36('0x13')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize['ENUM'](_0x7b36('0x2b'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0x7b36('0x4')],'allowNull':!![]},'session_timers':{'type':Sequelize['ENUM']('accept',_0x7b36('0x3a'),_0x7b36('0x3b')),'allowNull':!![]},'session_expires':{'type':Sequelize[_0x7b36('0x13')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0x7b36('0x13')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0x7b36('0x1a')]('uac',_0x7b36('0x3c')),'allowNull':!![],'defaultValue':'uas'},'t38pt_usertpsource':{'type':Sequelize[_0x7b36('0x4')],'allowNull':!![]},'regexten':{'type':Sequelize[_0x7b36('0x4')],'allowNull':!![]},'fromdomain':{'type':Sequelize['STRING'],'allowNull':!![]},'fromuser':{'type':Sequelize[_0x7b36('0x4')],'allowNull':!![]},'qualify':{'type':Sequelize[_0x7b36('0x1a')]('yes','no'),'allowNull':!![],'defaultValue':_0x7b36('0x2b')},'keepalive':{'type':Sequelize[_0x7b36('0x13')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0x7b36('0x4')],'allowNull':!![]},'defaultuser':{'type':Sequelize['STRING'],'allowNull':!![]},'rtptimeout':{'type':Sequelize[_0x7b36('0x13')](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0x7b36('0x13')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0x7b36('0x13')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize['ENUM'](_0x7b36('0x2b'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x7b36('0x4')],'allowNull':!![]},'callbackextension':{'type':Sequelize['STRING'],'allowNull':!![]},'timert1':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'timerb':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0x7b36('0x13')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0x7b36('0x4')],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0x7b36('0x4')],'allowNull':!![]},'contactacl':{'type':Sequelize['STRING'],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0x7b36('0x4')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize['STRING'],'allowNull':!![]},'maxforwards':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'encryption':{'type':Sequelize['ENUM'](_0x7b36('0x2b'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0x7b36('0x1a')](_0x7b36('0x2b'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize[_0x7b36('0x1a')](_0x7b36('0x2b'),'no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0x7b36('0x1a')]('yes','no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0x7b36('0x1a')](_0x7b36('0x2b'),'no',_0x7b36('0x3d'),_0x7b36('0x3e')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0x7b36('0x4')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0x7b36('0x4')],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0x7b36('0x4')],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0x7b36('0x4')],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0x7b36('0x4')],'allowNull':!![]},'dtlssetup':{'type':Sequelize['ENUM']('active',_0x7b36('0x3f'),_0x7b36('0x40')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x7b36('0x4')],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0x7b36('0x1a')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x7b36('0x4')],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0x7b36('0x4')],'allowNull':!![]},'call_limit':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0x7b36('0x1a')]('yes','no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0x7b36('0x1a')](_0x7b36('0x2b'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0x7b36('0x4')],'allowNull':!![]},'mohinterpret':{'type':Sequelize['STRING'],'allowNull':!![]},'mohsuggest':{'type':Sequelize['STRING'],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0x7b36('0x4')],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0x7b36('0x1a')](_0x7b36('0x2b'),'no',_0x7b36('0x2c'),_0x7b36('0x2d'),'update,nonat'),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0x7b36('0x4')]},'resetPasswordExpires':{'type':Sequelize['DATE']},'passwordResetAt':{'type':Sequelize[_0x7b36('0x18')],'defaultValue':null},'previousPasswords':{'type':Sequelize['TEXT']},'showWebBar':{'type':Sequelize[_0x7b36('0x13')],'defaultValue':0x0,'set':function(_0x44df9d){this[_0x7b36('0x6')]('showWebBar',_0x44df9d);var _0x45fc94=this[_0x7b36('0x41')]({'plain':!![]});switch(_0x44df9d){case 0x0:case 0x1:var _0xb51cd3=_0x45fc94[_0x7b36('0x23')]?_['isArray'](_0x45fc94[_0x7b36('0x23')])?_0x45fc94[_0x7b36('0x23')][_0x7b36('0x31')]():_0x45fc94[_0x7b36('0x23')]:_0x7b36('0x22');if(_0xb51cd3===_0x7b36('0x42')){_0xb51cd3=_0x7b36('0x22');}this[_0x7b36('0x6')]('transport',_0xb51cd3);this[_0x7b36('0x6')](_0x7b36('0x43'),'no');this[_0x7b36('0x6')](_0x7b36('0x44'),null);this[_0x7b36('0x6')](_0x7b36('0x45'),null);this[_0x7b36('0x6')](_0x7b36('0x46'),null);this[_0x7b36('0x6')]('dtlsenable',null);this[_0x7b36('0x6')](_0x7b36('0x47'),null);this[_0x7b36('0x6')]('dtlssetup',null);this['setDataValue'](_0x7b36('0x48'),null);this['setDataValue'](_0x7b36('0x49'),null);this['setDataValue'](_0x7b36('0x4a'),'no');break;case 0x2:this[_0x7b36('0x6')]('transport','wss');this[_0x7b36('0x6')](_0x7b36('0x43'),_0x7b36('0x2b'));this[_0x7b36('0x6')](_0x7b36('0x44'),_0x7b36('0x2b'));this[_0x7b36('0x6')](_0x7b36('0x45'),_0x7b36('0x2b'));this[_0x7b36('0x6')]('icesupport',_0x7b36('0x2b'));this['setDataValue'](_0x7b36('0x4b'),'yes');this['setDataValue']('dtlsverify','no');this[_0x7b36('0x6')](_0x7b36('0x4c'),_0x7b36('0x40'));this['setDataValue']('dtlscertfile',_0x45fc94[_0x7b36('0x48')]||_0x7b36('0x4d'));this[_0x7b36('0x6')]('dtlsprivatekey',_0x45fc94[_0x7b36('0x49')]||_0x7b36('0x4e'));this[_0x7b36('0x6')](_0x7b36('0x4a'),'yes');break;default:}}},'permissions':{'type':Sequelize[_0x7b36('0x4f')],'set':function(_0x272185){this[_0x7b36('0x6')](_0x7b36('0x50'),_0x272185?_0x272185[_0x7b36('0x31')](','):[]);},'get':function(){return this[_0x7b36('0xb')](_0x7b36('0x50'))?_[_0x7b36('0x51')](this[_0x7b36('0xb')](_0x7b36('0x50'))[_0x7b36('0x24')](','),function(_0x2ec178){return parseInt(_0x2ec178,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize['STRING']},'phoneBarNoReplyNumber':{'type':Sequelize[_0x7b36('0x4')]},'phoneBarBusyNumber':{'type':Sequelize['STRING']},'phoneBarUnconditional':{'type':Sequelize[_0x7b36('0x16')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0x7b36('0x16')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0x7b36('0x16')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0x7b36('0x16')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0x7b36('0x16')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0x7b36('0x16')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0x7b36('0x13')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0x7b36('0x4')],'defaultValue':''},'crudPermissions':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0x7b36('0x1a')](_0x7b36('0x2b'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0x7b36('0x16')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize['STRING']},'phoneBarEnableJaws':{'type':Sequelize[_0x7b36('0x16')],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0x7b36('0x16')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize['VIRTUAL'],'get':function(){return this['getDataValue']('phoneBarEnableScreenRecordingByAgent')?this['getDataValue']('phoneBarEnableScreenRecordingByAgent'):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0x7b36('0x16')],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0x7b36('0x16')],'defaultValue':![]},'interface':{'type':Sequelize[_0x7b36('0x4')],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0x7b36('0x16')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0x7b36('0x4')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize['STRING'],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0x7b36('0x16')],'defaultValue':![],'set':function(_0x3c5ea0){if(typeof _0x3c5ea0==='string'){var _0x52370b=_0x3c5ea0==='1'?!![]:_0x3c5ea0==='0'?![]:_0x3c5ea0===_0x7b36('0x52')?!![]:_0x3c5ea0===_0x7b36('0x53')?![]:![];this[_0x7b36('0x6')](_0x7b36('0x54'),_0x52370b);}else{this[_0x7b36('0x6')](_0x7b36('0x54'),_0x3c5ea0);}}},'blocked':{'type':Sequelize[_0x7b36('0x16')],'defaultValue':![],'set':function(_0x5e98e7){this[_0x7b36('0x6')]('blocked',_0x5e98e7);if(_0x5e98e7===!![]){this['setDataValue'](_0x7b36('0x55'),moment());this['setDataValue'](_0x7b36('0x56'),0x0);}else{this[_0x7b36('0x6')](_0x7b36('0x55'),null);}}},'blockedAt':{'type':Sequelize[_0x7b36('0x18')],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0x7b36('0x13')],'defaultValue':0x0},'disabled':{'type':Sequelize[_0x7b36('0x16')],'defaultValue':![]},'settingsEnabled':{'type':Sequelize[_0x7b36('0x16')],'defaultValue':!![]},'wssPort':{'type':Sequelize[_0x7b36('0x13')](0x5)[_0x7b36('0x57')],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize[_0x7b36('0x16')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x7b36('0x16')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x7b36('0x16')],'defaultValue':!![]},'ignorePauseForPreviewCalls':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'selectRecallMeCampaign':{'type':Sequelize[_0x7b36('0x16')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0x7b36('0x16')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/user/user.controller.js b/server/api/user/user.controller.js index 856024b..901b414 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 _0x470d=['checkUserLimits','settingsEnabled','userProfileId','VoiceMail','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','bulkCreate','some','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20administrator','each','isEmpty','compact','changePassword','oldPassword','newPassword','Sequelize','Invalid\x20body\x20format.\x20Use\x20oldPassword\x20and\x20newPassword','authenticate','ValidationError','Wrong\x20credentials','New\x20password\x20must\x20be\x20different\x20from\x20old\x20password','Invalid\x20body\x20format.\x20Use\x20newPassword','findOne','enforcePasswordHistory','passwordHistoryLimit','previousPasswords','validatePasswordHistory','updatePasswordsHistory','channel','voicePause','Unknown\x20channel','add','toLowerCase','Queues','penalty','spread','capitalize','QueueId','VoiceQueue','voice','online','interface','format','UserVoiceQueueRt','upsert','remove','isArray','Queue:remove','emit','addAvatar','userpic','filename','getAvatar','join','root','server/files/images/logos/default_profile.png','download','existsSync','server/files/images/','ChatOpenTabs','FaxOpenTabs','FAX','createdAt','OpenchannelOpenTabs','MailOpenTabs','MAIL','SMS','WhatsappOpenTabs','WHATSAPP','concat','getContacts','CmContact','fields','order','sort','pick','hasOwnProperty','CmList','Tag','Tags','color','tag','nolimit','getQueues','isValidChannel','Unknown\x20role','getGroups','ChatGroup','getRecordings','VoiceRecording','UserId','getScreenRecordings','ScreenRecording','getChatInteractions','ChatInteraction','OpenchannelInteraction','getOpenchannelInteractions','MailInteraction','getSmsInteractions','SmsInteraction','getFaxInteractions','FaxInteraction','getWhatsappInteractions','phone','mobile','loginInPause','LOCAL/%s@from-sip/n','intrf','SIP/%s','user:forcelogout','headers','x-forwarded-for','connection','remoteAddress','socket','User\x20not\x20found\x20or\x20not\x20allowed\x20to\x20perform\x20login\x20method','getVoiceQueues','MemberReport','forEach','update','YYYY-MM-DD\x20HH:mm:ss','getChannels','LOGIN','LOGININPAUSE','isMiddleware','resolve','pause','PAUSE','DEFAULT\x20PAUSE','unpause','chatPause','faxPause','openchannelPause','smsPause','whatsapppause','lastPauseAt','QueuePause','manual','%s%s','Pause','getTeams','addTeams','Team','setDataValue','Voice','getChatQueues','getMailQueues','Mail','getSmsQueues','Sms','getWhatsappQueues','Whatsapp','getFaxQueues','Fax','Openchannel','flatten','transaction','addAgent','getDataValue','Queue:save','TeamVoicePrefix','removeTeams','Chat','getOpenchannelQueues','VoicePrefixId','getLists','getAgents','values','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','user_has_fax_interactions:save','removeFaxInteractions','user_has_fax_interactions:remove','addSmsInteractions','user_has_sms_interactions:save','user_has_sms_interactions:remove','addOpenchannelInteractions','user_has_openchannel_interactions:save','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','addWhatsappInteractions','removeWhatsappInteractions','getVoicePrefixes','FaxAccount','getFaxAccounts','addFaxAccounts','removeFaxAccounts','getMailAccounts','MailAccount','addMailAccounts','removeMailAccounts','getOpenchannelAccounts','OpenchannelAccount','addOpenchannelAccounts','removeOpenchannelAccounts','getSmsAccounts','SmsAccount','addSmsAccounts','removeSmsAccounts','ChatWebsite','getChatWebsites','addChatWebsites','removeChatWebsites','getWhatsappAccounts','addWhatsappAccounts','removeWhatsappAccounts','getSquareProjects','addSquareProjects','removeSquareProjects','CmHopper','$and','$or','$gte','$lt','$lte','$ne','$not','$between','$in','$notIn','$like','$notLike','$iLike','$notILike','$overlap','$contains','$contained','$any','lastName','dialActive','Queue','retrieveApiKey','token','You\x20don\x27t\x20have\x20sufficient\x20privileges\x20to\x20access\x20this\x20resource.','createApiKey','iat','removeApiKey','apiKeyNonce','apiKeyIat','API\x20key\x20not\x20available','Unable\x20to\x20retrieve\x20the\x20current\x20user','getUserSetting','getPresence','teams','queues','inbound','lower','col','asc','desc','orderBy','http','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)','offline','idle','unknown','ringing','voiceStatus','busy','slice','charAt','toUpperCase','select','field','ui.','InteractionId','ui.createdAt','user_has_','ui.UserId\x20=\x20?','toString','OpenTabs','moment','bluebird','util','path','lodash','squel','jayson/promise','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../mysqldb','socket.io-emitter','redis','./user.socket','register','defaults','localhost','client','request','then','info','User,\x20%s,\x20%s','request\x20sent','debug','User,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','json','offset','limit','count','set','Content-Range','destroy','get','admin','user','Agents','agent','Telephones','telephone','filter','ignore','map','value','includes','role','find','UserProfileResource','stack','name','send','index','User','fieldName','type','key','password','getOptions','where','query','includeAll','include','userSetting','true','UserSetting','attributes','push','findAll','rows','openTabs','length','chat','dataValues','sms','openchannel','all','show','params','differenceBy','keys','rawAttributes','salt','filters','intersection','model','merge','options','whatsapp','fax','mail','body','describe','addContacts','ids','omit','Setting','findById','securePassword','validatePasswordPattern','max','isNil','internal','min_internal','sequelize','select\x20(select\x20IFNULL(max(internal)+1,1)\x20from\x20users\x20where\x20internal\x20<\x20md.internal)\x20as\x20\x27from\x27,\x20md.internal\x20-\x201\x20as\x20\x27to\x27\x20from\x20users\x20md\x20where\x20md.internal\x20!=\x201\x20and\x20not\x20exists\x20(select\x201\x20from\x20users\x20md2\x20where\x20md2.internal\x20=\x20md.internal\x20-\x201)','SELECT','from','voicemail','fullname','email','permissions','101','102','103','110','104','106','107','100','115','create','Unauthorized','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x470d,0x117));var _0xd470=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x470d[_0x501510];return _0x1e6ee5;};'use strict';var moment=require(_0xd470('0x0'));var BPromise=require(_0xd470('0x1'));var util=require(_0xd470('0x2'));var path=require(_0xd470('0x3'));var fs=require('fs');var _=require(_0xd470('0x4'));var squel=require(_0xd470('0x5'));var jayson=require(_0xd470('0x6'));var Redis=require('ioredis');var authService=require(_0xd470('0x7'));var qs=require(_0xd470('0x8'));var logger=require(_0xd470('0x9'))(_0xd470('0xa'));var utils=require(_0xd470('0xb'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xd470('0xc'))['db'];var socket=require(_0xd470('0xd'))(new Redis(config[_0xd470('0xe')]));require(_0xd470('0xf'))[_0xd470('0x10')](socket);config[_0xd470('0xe')]=_[_0xd470('0x11')](config[_0xd470('0xe')],{'host':_0xd470('0x12'),'port':0x18eb});var client=jayson[_0xd470('0x13')]['http']({'port':0x232a});var values;function respondWithRpcPromise(_0x8ecde4,_0x2ddc39,_0x138ff0,_0x5a7a30){return new BPromise(function(_0x14ebf2,_0x4fa3af){var _0x3eef69=_0x5a7a30||client;return _0x3eef69[_0xd470('0x14')](_0x8ecde4,_0x138ff0)[_0xd470('0x15')](function(_0x4023e3){logger[_0xd470('0x16')](_0xd470('0x17'),_0x2ddc39,_0xd470('0x18'));logger[_0xd470('0x19')](_0xd470('0x1a'),_0x2ddc39,_0xd470('0x18'),JSON[_0xd470('0x1b')](_0x4023e3));if(_0x4023e3[_0xd470('0x1c')]){if(_0x4023e3[_0xd470('0x1c')][_0xd470('0x1d')]===0x1f4){logger[_0xd470('0x1c')](_0xd470('0x17'),_0x2ddc39,_0x4023e3[_0xd470('0x1c')][_0xd470('0x1e')]);return _0x4fa3af(_0x4023e3[_0xd470('0x1c')][_0xd470('0x1e')]);}logger[_0xd470('0x1c')](_0xd470('0x17'),_0x2ddc39,_0x4023e3[_0xd470('0x1c')][_0xd470('0x1e')]);return _0x14ebf2(_0x4023e3['error'][_0xd470('0x1e')]);}else{logger[_0xd470('0x16')](_0xd470('0x17'),_0x2ddc39,'request\x20sent');_0x14ebf2(_0x4023e3[_0xd470('0x1f')][_0xd470('0x1e')]);}})[_0xd470('0x20')](function(_0x545bd6){logger[_0xd470('0x1c')](_0xd470('0x17'),_0x2ddc39,_0x545bd6);_0x4fa3af(_0x545bd6);});});}function respondWithStatusCode(_0x24fc49,_0x3dcc26){_0x3dcc26=_0x3dcc26||0xcc;return function(_0x4a8fe8){if(_0x4a8fe8){return _0x24fc49[_0xd470('0x21')](_0x3dcc26);}return _0x24fc49[_0xd470('0x22')](_0x3dcc26)[_0xd470('0x23')]();};}function respondWithResult(_0xaa64a4,_0x26c405){_0x26c405=_0x26c405||0xc8;return function(_0x150576){if(_0x150576){return _0xaa64a4[_0xd470('0x22')](_0x26c405)[_0xd470('0x24')](_0x150576);}};}function respondWithFilteredResult(_0x4b7df9,_0xb9277){return function(_0x58a7b6){if(_0x58a7b6){var _0x145114=typeof _0xb9277[_0xd470('0x25')]==='undefined'&&typeof _0xb9277[_0xd470('0x26')]==='undefined';var _0x199304=_0x58a7b6[_0xd470('0x27')];var _0x42116=_0x145114?0x0:_0xb9277[_0xd470('0x25')];var _0x35bfb8=_0x145114?_0x58a7b6[_0xd470('0x27')]:_0xb9277[_0xd470('0x25')]+_0xb9277[_0xd470('0x26')];var _0x5ab339;if(_0x35bfb8>=_0x199304){_0x35bfb8=_0x199304;_0x5ab339=0xc8;}else{_0x5ab339=0xce;}_0x4b7df9[_0xd470('0x22')](_0x5ab339);return _0x4b7df9[_0xd470('0x28')](_0xd470('0x29'),_0x42116+'-'+_0x35bfb8+'/'+_0x199304)[_0xd470('0x24')](_0x58a7b6);}return null;};}function saveUpdates(_0x6e67a3){return function(_0x18a064){if(_0x18a064){return _0x18a064['update'](_0x6e67a3)[_0xd470('0x15')](function(_0x3703e6){return _0x3703e6;});}return null;};}function removeEntity(_0x3367f9){return function(_0x4318df){if(_0x4318df){return _0x4318df[_0xd470('0x2a')]()['then'](function(){var _0x540c2e=_0x4318df[_0xd470('0x2b')]({'plain':!![]});if(_0x540c2e['role']===_0xd470('0x2c'))return;var _0x5f1812=[{'name':'Users','value':_0xd470('0x2d'),'ignore':!![]},{'name':_0xd470('0x2e'),'value':_0xd470('0x2f'),'ignore':![]},{'name':_0xd470('0x30'),'value':_0xd470('0x31'),'ignore':![]}];var _0x3c3d3c=_(_0x5f1812)[_0xd470('0x32')](_0xd470('0x33'))[_0xd470('0x34')](_0xd470('0x35'))[_0xd470('0x35')]();if(_[_0xd470('0x36')](_0x3c3d3c,_0x540c2e[_0xd470('0x37')])){return;}var _0x38f2a8=_[_0xd470('0x38')](_0x5f1812,['value',_0x540c2e[_0xd470('0x37')]])['name'];return db[_0xd470('0x39')][_0xd470('0x2a')]({'where':{'type':_0x38f2a8,'resourceId':_0x540c2e['id']}})['then'](function(){return _0x4318df;});})[_0xd470('0x15')](function(){_0x3367f9[_0xd470('0x22')](0xcc)[_0xd470('0x23')]();});}};}function handleEntityNotFound(_0x5e30ff){return function(_0x535776){if(!_0x535776){_0x5e30ff['sendStatus'](0x194);}return _0x535776;};}function handleError(_0x4eebcc,_0x279e57){_0x279e57=_0x279e57||0x1f4;return function(_0x530743){logger[_0xd470('0x1c')](_0x530743[_0xd470('0x3a')]);if(_0x530743[_0xd470('0x3b')]){delete _0x530743[_0xd470('0x3b')];}_0x4eebcc[_0xd470('0x22')](_0x279e57)[_0xd470('0x3c')](_0x530743);};}exports[_0xd470('0x3d')]=function(_0x190b5e,_0x95dae5){var _0x2c1dc8={},_0xd832a7={'count':0x0,'rows':[]};var _0x350c05=_(db[_0xd470('0x3e')]['rawAttributes'])[_0xd470('0x34')](function(_0x1f8274){return{'name':_0x1f8274[_0xd470('0x3f')],'type':_0x1f8274[_0xd470('0x40')][_0xd470('0x41')]};})[_0xd470('0x32')](function(_0x5e757c){return!_[_0xd470('0x36')]([_0xd470('0x42'),'salt'],_0x5e757c[_0xd470('0x3b')]);})['value']();_0x2c1dc8=qs[_0xd470('0x43')](_0x350c05,_0x190b5e);var _0x1a9dc7={'where':_0x2c1dc8[_0xd470('0x44')]};return db[_0xd470('0x3e')]['count'](_0x1a9dc7)[_0xd470('0x15')](function(_0xf91533){_0xd832a7[_0xd470('0x27')]=_0xf91533;if(_0x190b5e[_0xd470('0x45')][_0xd470('0x46')]){_0x2c1dc8[_0xd470('0x47')]=[{'all':!![]}];}if(_0x190b5e['query'][_0xd470('0x48')]===_0xd470('0x49')){_0x2c1dc8[_0xd470('0x47')]=[{'model':db[_0xd470('0x4a')],'as':_0xd470('0x48')}];}if(!_['includes'](_0x2c1dc8[_0xd470('0x4b')],'id')){_0x2c1dc8['attributes'][_0xd470('0x4c')]('id');}return db[_0xd470('0x3e')][_0xd470('0x4d')](_0x2c1dc8);})['then'](function(_0x11f9f5){_0xd832a7[_0xd470('0x4e')]=_0x11f9f5;if(_0x190b5e[_0xd470('0x45')][_0xd470('0x4f')]===_0xd470('0x49')){var _0x211243=[];for(var _0x1e4cc2=0x0;_0x1e4cc2<_0xd832a7[_0xd470('0x4e')][_0xd470('0x50')];_0x1e4cc2++){_0x211243['push'](get_open_tabs(_0xd470('0x51'),_0xd832a7[_0xd470('0x4e')][_0x1e4cc2][_0xd470('0x52')]));_0x211243[_0xd470('0x4c')](get_open_tabs(_0xd470('0x53'),_0xd832a7[_0xd470('0x4e')][_0x1e4cc2][_0xd470('0x52')]));_0x211243[_0xd470('0x4c')](get_open_tabs('fax',_0xd832a7[_0xd470('0x4e')][_0x1e4cc2]['dataValues']));_0x211243[_0xd470('0x4c')](get_open_tabs('mail',_0xd832a7['rows'][_0x1e4cc2][_0xd470('0x52')]));_0x211243[_0xd470('0x4c')](get_open_tabs(_0xd470('0x54'),_0xd832a7[_0xd470('0x4e')][_0x1e4cc2]['dataValues']));_0x211243[_0xd470('0x4c')](get_open_tabs('whatsapp',_0xd832a7[_0xd470('0x4e')][_0x1e4cc2][_0xd470('0x52')]));}return BPromise[_0xd470('0x55')](_0x211243)[_0xd470('0x15')](function(){return _0xd832a7;});}else{return _0xd832a7;}})[_0xd470('0x15')](respondWithFilteredResult(_0x95dae5,_0x2c1dc8))[_0xd470('0x20')](handleError(_0x95dae5,null));};exports[_0xd470('0x56')]=function(_0x26bb48,_0x7d4e97){var _0x2144b7={'raw':![],'where':{'id':_0x26bb48[_0xd470('0x57')]['id']}},_0x1ee5c0={};_0x1ee5c0['model']=_[_0xd470('0x58')](_[_0xd470('0x59')](db[_0xd470('0x3e')][_0xd470('0x5a')]),[_0xd470('0x42'),_0xd470('0x5b')]);_0x1ee5c0[_0xd470('0x45')]=_[_0xd470('0x59')](_0x26bb48['query']);_0x1ee5c0[_0xd470('0x5c')]=_[_0xd470('0x5d')](_0x1ee5c0[_0xd470('0x5e')],_0x1ee5c0[_0xd470('0x45')]);_0x2144b7[_0xd470('0x4b')]=_[_0xd470('0x5d')](_0x1ee5c0['model'],qs['fields'](_0x26bb48[_0xd470('0x45')]['fields']));_0x2144b7[_0xd470('0x4b')]=_0x2144b7[_0xd470('0x4b')][_0xd470('0x50')]?_0x2144b7[_0xd470('0x4b')]:_0x1ee5c0[_0xd470('0x5e')];if(_0x26bb48[_0xd470('0x45')][_0xd470('0x46')]){_0x2144b7['include']=[{'all':!![]}];}if(_0x26bb48['query'][_0xd470('0x48')]===_0xd470('0x49')){_0x2144b7[_0xd470('0x47')]=[{'model':db[_0xd470('0x4a')],'as':_0xd470('0x48')}];}_0x2144b7=_[_0xd470('0x5f')]({},_0x2144b7,_0x26bb48[_0xd470('0x60')]);if(!_['includes'](_0x2144b7[_0xd470('0x4b')],'id')){_0x2144b7['attributes'][_0xd470('0x4c')]('id');}return db['User'][_0xd470('0x38')](_0x2144b7)[_0xd470('0x15')](handleEntityNotFound(_0x7d4e97,null))[_0xd470('0x15')](function(_0x249a82){var _0x1773ee=[];values=_0x249a82;if(_0x26bb48['query'][_0xd470('0x4f')]===_0xd470('0x49')){_0x1773ee[_0xd470('0x4c')](get_open_tabs(_0xd470('0x51'),_0x249a82[_0xd470('0x52')]));_0x1773ee['push'](get_open_tabs(_0xd470('0x53'),_0x249a82[_0xd470('0x52')]));_0x1773ee['push'](get_open_tabs('openchannel',_0x249a82[_0xd470('0x52')]));_0x1773ee[_0xd470('0x4c')](get_open_tabs(_0xd470('0x61'),_0x249a82[_0xd470('0x52')]));_0x1773ee['push'](get_open_tabs(_0xd470('0x62'),_0x249a82[_0xd470('0x52')]));_0x1773ee[_0xd470('0x4c')](get_open_tabs(_0xd470('0x63'),_0x249a82[_0xd470('0x52')]));return BPromise['all'](_0x1773ee);}else{return values;}})[_0xd470('0x15')](function(){return values;})[_0xd470('0x15')](respondWithResult(_0x7d4e97,null))[_0xd470('0x20')](handleError(_0x7d4e97,null));};exports['update']=function(_0x32c0ba,_0x41fd0e){if(_0x32c0ba['body']['id']){delete _0x32c0ba[_0xd470('0x64')]['id'];}delete _0x32c0ba['body']['role'];return db['User'][_0xd470('0x38')]({'where':{'id':_0x32c0ba[_0xd470('0x57')]['id']}})[_0xd470('0x15')](handleEntityNotFound(_0x41fd0e,null))[_0xd470('0x15')](saveUpdates(_0x32c0ba['body'],null))['then'](respondWithResult(_0x41fd0e,null))[_0xd470('0x20')](handleError(_0x41fd0e,null));};exports[_0xd470('0x65')]=function(_0x553938,_0x150ba6){return db[_0xd470('0x3e')]['describe']()[_0xd470('0x15')](respondWithResult(_0x150ba6,null))[_0xd470('0x20')](handleError(_0x150ba6,null));};exports[_0xd470('0x66')]=function(_0x5e3e5d,_0x2cc3e8){return db[_0xd470('0x3e')][_0xd470('0x38')]({'where':{'id':_0x5e3e5d[_0xd470('0x57')]['id']}})[_0xd470('0x15')](handleEntityNotFound(_0x2cc3e8,null))['then'](function(_0x4825c0){if(_0x4825c0){return _0x4825c0[_0xd470('0x66')](_0x5e3e5d[_0xd470('0x64')][_0xd470('0x67')],_[_0xd470('0x68')](_0x5e3e5d['body'],[_0xd470('0x67'),'id'])||{});}})['then'](respondWithResult(_0x2cc3e8,null))[_0xd470('0x20')](handleError(_0x2cc3e8,null));};function validateUser(_0x9aeac){return new BPromise(function(_0x1c0ae4,_0x44ea3c){if(_0x9aeac['internal'])return _0x1c0ae4(_0x9aeac);return db[_0xd470('0x69')][_0xd470('0x6a')](0x1)['then'](function(_0x4efcbf){if(_0x4efcbf[_0xd470('0x6b')])authService[_0xd470('0x6c')](_0x9aeac[_0xd470('0x42')]);db['User'][_0xd470('0x6d')]('internal')[_0xd470('0x15')](function(_0x46d28e){if(_[_0xd470('0x6e')](_0x46d28e)){_0x9aeac[_0xd470('0x6f')]=_0x4efcbf[_0xd470('0x70')]||0x1;return;}if(_[_0xd470('0x6e')](_0x4efcbf[_0xd470('0x70')])||_0x4efcbf[_0xd470('0x70')]===_0x46d28e){_0x9aeac[_0xd470('0x6f')]=_0x46d28e+0x1;return;}if(_0x4efcbf[_0xd470('0x70')]>_0x46d28e){_0x9aeac[_0xd470('0x6f')]=_0x4efcbf[_0xd470('0x70')];return;}return db[_0xd470('0x71')][_0xd470('0x45')](_0xd470('0x72'),{'type':db[_0xd470('0x71')]['QueryTypes'][_0xd470('0x73')]})[_0xd470('0x15')](function(_0x17dd6d){if(_0x17dd6d&&_0x17dd6d[_0xd470('0x50')]){for(var _0x26233c=0x0,_0x469b18=_0x17dd6d[_0xd470('0x50')];_0x26233c<_0x469b18&&_[_0xd470('0x6e')](_0x9aeac[_0xd470('0x6f')]);_0x26233c++){if(_0x4efcbf[_0xd470('0x70')]<=_0x17dd6d[_0x26233c][_0xd470('0x74')]){_0x9aeac[_0xd470('0x6f')]=_0x17dd6d[_0x26233c][_0xd470('0x74')];}else if(_0x4efcbf[_0xd470('0x70')]>_0x17dd6d[_0x26233c][_0xd470('0x74')]&&_0x4efcbf[_0xd470('0x70')]<=_0x17dd6d[_0x26233c]['to']){_0x9aeac[_0xd470('0x6f')]=_0x4efcbf[_0xd470('0x70')];}}}if(_['isNil'](_0x9aeac[_0xd470('0x6f')])){_0x9aeac[_0xd470('0x6f')]=_0x46d28e+0x1;}return _0x1c0ae4(_0x9aeac);});});})['catch'](function(_0x24802a){_0x44ea3c(_0x24802a);});});}function updateUser(_0x355c66){return new BPromise(function(_0x20e5fe,_0x29e3c9){try{if(_0x355c66[_0xd470('0x75')]){_0x355c66['mailbox']=_0x355c66[_0xd470('0x6f')];_0x355c66['VoiceMail']={'mailbox':_0x355c66['internal'],'password':_0x355c66[_0xd470('0x42')],'fullname':_0x355c66[_0xd470('0x76')],'email':_0x355c66[_0xd470('0x77')]};}if(_0x355c66[_0xd470('0x37')]==='agent'){if(!_0x355c66[_0xd470('0x78')])_0x355c66['permissions']=[_0xd470('0x79'),_0xd470('0x7a'),_0xd470('0x7b'),'113',_0xd470('0x7c'),_0xd470('0x7d'),'105',_0xd470('0x7e'),_0xd470('0x7f'),'108','109',_0xd470('0x80'),'111','114',_0xd470('0x81')];}_0x20e5fe(_0x355c66);}catch(_0x5218fc){_0x29e3c9(_0x5218fc);}});}exports[_0xd470('0x82')]=function(_0x360f94,_0x110e21){if(_0x360f94[_0xd470('0x2d')][_0xd470('0x37')]==='agent')throw new Error(_0xd470('0x83'));if(_0x360f94[_0xd470('0x64')]['role']===_0xd470('0x2d')&&_0x360f94[_0xd470('0x2d')]['role']!==_0xd470('0x2c')){throw new Error(_0xd470('0x84'));}if(_0x360f94[_0xd470('0x64')][_0xd470('0x37')]===_0xd470('0x2c')&&_0x360f94[_0xd470('0x2d')][_0xd470('0x37')]!==_0xd470('0x2c')){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20another\x20administrator');}return licenseUtil[_0xd470('0x85')]([_0x360f94[_0xd470('0x64')]])['then'](function(){return validateUser(_0x360f94[_0xd470('0x64')]);})[_0xd470('0x15')](function(_0x4bf492){return updateUser(_0x4bf492)['then'](function(_0x3bd6ab){if(_0x3bd6ab[_0xd470('0x37')]===_0xd470('0x2c')){_0x3bd6ab[_0xd470('0x86')]=_0x360f94[_0xd470('0x2d')][_0xd470('0x86')];delete _0x3bd6ab[_0xd470('0x87')];}return _0x3bd6ab;});})[_0xd470('0x15')](function(_0x11fd5c){return db[_0xd470('0x3e')][_0xd470('0x82')](_0x11fd5c,{'include':[{'model':db['VoiceMail'],'as':_0xd470('0x88')}]});})['then'](function(_0x2564bd){if(_0x360f94['body'][_0xd470('0x37')]==='user')return _0x2564bd;if(_0x360f94[_0xd470('0x2d')][_0xd470('0x37')]!==_0xd470('0x2d'))return _0x2564bd;return db[_0xd470('0x89')][_0xd470('0x38')]({'where':{'name':_0x2564bd[_0xd470('0x37')]===_0xd470('0x2f')?_0xd470('0x2e'):'Telephones','userProfileId':_0x360f94['user'][_0xd470('0x87')]},'raw':!![]})[_0xd470('0x15')](function(_0x267fbe){if(!_0x267fbe||_0x267fbe[_0xd470('0x8a')]!=0x0)return _0x2564bd;return db['UserProfileResource']['create']({'name':_0x2564bd[_0xd470('0x3b')],'resourceId':_0x2564bd['id'],'type':_0x267fbe['name'],'sectionId':_0x267fbe['id']},{})['then'](function(){return _0x2564bd;});})[_0xd470('0x20')](function(_0x1dc3b6){logger[_0xd470('0x1c')](_0xd470('0x8b'),_0x1dc3b6);throw _0x1dc3b6;});})['then'](respondWithResult(_0x110e21,0xc9))['catch'](handleError(_0x110e21,null));};exports[_0xd470('0x8c')]=function(_0x331718,_0x25f667){var _0xe1b49b=_0x331718['body'];var _0xa8f79d=[];if(_0x331718['user'][_0xd470('0x37')]===_0xd470('0x2f'))throw new Error(_0xd470('0x83'));if(_[_0xd470('0x8d')](_0xe1b49b,[_0xd470('0x37'),_0xd470('0x2d')])&&_0x331718[_0xd470('0x2d')][_0xd470('0x37')]!==_0xd470('0x2c')){throw new Error(_0xd470('0x84'));}if(_['some'](_0xe1b49b,['role',_0xd470('0x2c')])&&_0x331718['user'][_0xd470('0x37')]!=='admin'){throw new Error(_0xd470('0x8e'));}return licenseUtil[_0xd470('0x85')](_0xe1b49b)[_0xd470('0x15')](function(){return validateUser(_0xe1b49b[0x0]);})[_0xd470('0x15')](function(){for(var _0x482878=0x1;_0x482878<_0xe1b49b['length'];_0x482878++){var _0x3facc7=_0xe1b49b[_0x482878-0x1][_0xd470('0x6f')];if(!_0xe1b49b[_0x482878]['internal'])_0xe1b49b[_0x482878]['internal']=_0x3facc7+0x1;_0xa8f79d[_0xd470('0x4c')](validateUser(_0xe1b49b[_0x482878]));}return BPromise[_0xd470('0x55')](_0xa8f79d);})[_0xd470('0x15')](function(){_0xa8f79d=[];for(var _0x3461cf=0x0;_0x3461cf<_0xe1b49b[_0xd470('0x50')];_0x3461cf++){_0xa8f79d[_0xd470('0x4c')](updateUser(_0xe1b49b[_0x3461cf]));}return BPromise[_0xd470('0x55')](_0xa8f79d);})['then'](function(){return BPromise[_0xd470('0x8f')](_0xe1b49b,function(_0x45db03){return db['User'][_0xd470('0x82')](_0x45db03,{'include':[{'model':db['VoiceMail'],'as':'VoiceMail'}]})[_0xd470('0x15')](function(_0x3ee09d){_0x45db03['id']=_0x3ee09d['id'];return _0x45db03;});});})[_0xd470('0x15')](function(_0x3e0ea1){if(_0x331718['body'][_0xd470('0x37')]===_0xd470('0x2d'))return _0x3e0ea1;if(_0x331718['user'][_0xd470('0x37')]!==_0xd470('0x2d'))return _0x3e0ea1;var _0x5ef351=_['some'](_0x3e0ea1,function(_0x9ad3b3){return _0x9ad3b3[_0xd470('0x37')]==='agent'||_0x9ad3b3[_0xd470('0x37')]===_0xd470('0x31');});if(!_0x5ef351)return _0x3e0ea1;return db['UserProfileSection'][_0xd470('0x4d')]({'where':{'name':{'$or':[_0xd470('0x2e'),'Telephones']},'userProfileId':_0x331718[_0xd470('0x2d')][_0xd470('0x87')]},'raw':!![]})[_0xd470('0x15')](function(_0x5e3e66){if(_[_0xd470('0x90')](_0x5e3e66)||!_[_0xd470('0x8d')](_0x5e3e66,[_0xd470('0x8a'),0x0]))return _0x3e0ea1;_0xa8f79d=[];var _0x3bec89=_(_0x5e3e66)[_0xd470('0x34')](function(_0x4083ce){if(_0x4083ce[_0xd470('0x8a')]===0x1)return;return _0x4083ce[_0xd470('0x3b')]===_0xd470('0x2e')?_0xd470('0x2f'):_0xd470('0x31');})[_0xd470('0x91')]()[_0xd470('0x35')]();for(var _0x74dc66=0x0;_0x74dc66<_0x3e0ea1[_0xd470('0x50')];_0x74dc66++){if(!_[_0xd470('0x36')](_0x3bec89,_0x3e0ea1[_0x74dc66][_0xd470('0x37')]))return;var _0x3d90cd=_0x3e0ea1[_0x74dc66][_0xd470('0x37')]==='agent'?'Agents':'Telephones';_0xa8f79d['push'](db[_0xd470('0x39')]['create']({'name':_0x3e0ea1[_0x74dc66][_0xd470('0x3b')],'resourceId':_0x3e0ea1[_0x74dc66]['id'],'type':_0x3d90cd,'sectionId':_[_0xd470('0x38')](_0x5e3e66,[_0xd470('0x3b'),_0x3d90cd])['id']},{}));}return BPromise[_0xd470('0x55')](_0xa8f79d);});})['then'](respondWithResult(_0x25f667,0xc9))[_0xd470('0x20')](handleError(_0x25f667,null));};exports[_0xd470('0x92')]=function(_0x4fa145,_0x5a5d34){if(_0x4fa145[_0xd470('0x64')]['id']){delete _0x4fa145['body']['id'];}return db[_0xd470('0x3e')][_0xd470('0x38')]({'where':{'id':_0x4fa145['params']['id']}})[_0xd470('0x15')](function(_0xe85401){if(!_0xe85401)return null;if(_0xe85401['id']===_0x4fa145[_0xd470('0x2d')]['id']){if(!_0x4fa145[_0xd470('0x64')][_0xd470('0x93')]||!_0x4fa145[_0xd470('0x64')][_0xd470('0x94')]){throw new db[(_0xd470('0x95'))]['ValidationError'](_0xd470('0x96'));}if(!_0xe85401[_0xd470('0x97')](_0x4fa145['body'][_0xd470('0x93')])){throw new db[(_0xd470('0x95'))][(_0xd470('0x98'))](_0xd470('0x99'));}if(_0x4fa145[_0xd470('0x64')][_0xd470('0x93')]===_0x4fa145[_0xd470('0x64')][_0xd470('0x94')]){throw new db[(_0xd470('0x95'))][(_0xd470('0x98'))](_0xd470('0x9a'));}}else if(_0x4fa145['user'][_0xd470('0x37')]===_0xd470('0x2c')){if(!_0x4fa145[_0xd470('0x64')][_0xd470('0x94')]){throw new db[(_0xd470('0x95'))]['ValidationError'](_0xd470('0x9b'));}}else if(_0x4fa145[_0xd470('0x2d')][_0xd470('0x37')]===_0xd470('0x2d')){if(!_0x4fa145['body'][_0xd470('0x94')]){throw new db[(_0xd470('0x95'))][(_0xd470('0x98'))](_0xd470('0x9b'));}if(_0xe85401['role']!==_0xd470('0x2f')){throw new db[(_0xd470('0x95'))][(_0xd470('0x98'))](_0xd470('0x83'));}}else{throw new db[(_0xd470('0x95'))]['ValidationError'](_0xd470('0x83'));}return _0xe85401;})[_0xd470('0x15')](handleEntityNotFound(_0x5a5d34,null))[_0xd470('0x15')](function(_0x125c3e){return db[_0xd470('0x69')][_0xd470('0x9c')]({'attributes':['id',_0xd470('0x6b'),_0xd470('0x9d'),_0xd470('0x9e')]})[_0xd470('0x15')](function(_0x3089ce){if(_0x3089ce['securePassword'])authService[_0xd470('0x6c')](_0x4fa145['body'][_0xd470('0x94')]);if(!_0x3089ce['enforcePasswordHistory']||!_0x125c3e[_0xd470('0x9f')])return _0x125c3e;authService[_0xd470('0xa0')](_0x4fa145[_0xd470('0x64')][_0xd470('0x94')],_0x125c3e['previousPasswords'],_0x3089ce[_0xd470('0x9e')]);return _0x125c3e;})[_0xd470('0x15')](saveUpdates({'password':_0x4fa145[_0xd470('0x64')][_0xd470('0x94')],'passwordResetAt':_0x4fa145[_0xd470('0x2d')]['id']==_0x4fa145[_0xd470('0x57')]['id']?moment():null,'previousPasswords':authService[_0xd470('0xa1')](_0x4fa145[_0xd470('0x64')][_0xd470('0x94')],_0x125c3e['previousPasswords'])},null));})[_0xd470('0x15')](respondWithResult(_0x5a5d34,null))[_0xd470('0x20')](handleError(_0x5a5d34,null));};exports['addQueues']=function(_0x45de82,_0x4f2215){var _0x2d89c2=_0x45de82[_0xd470('0x64')][_0xd470('0xa2')];return db[_0xd470('0x3e')]['find']({'where':{'id':_0x45de82[_0xd470('0x57')]['id']},'attributes':['id',_0xd470('0x3b'),_0xd470('0x37'),'online','loginInPause',_0xd470('0xa3'),'interface']})[_0xd470('0x15')](handleEntityNotFound(_0x4f2215,null))[_0xd470('0x15')](function(_0x4b0ec4){if(_0x4b0ec4){if(!utils['isValidChannel'](_0x2d89c2)){throw new db['Sequelize']['ValidationError'](_0xd470('0xa4'));}return _0x4b0ec4[_0xd470('0xa5')+_['capitalize'](_0x2d89c2[_0xd470('0xa6')]())+_0xd470('0xa7')](_0x45de82[_0xd470('0x64')]['ids'],{'penalty':_0x45de82[_0xd470('0x64')][_0xd470('0xa8')]||0x0})[_0xd470('0xa9')](function(_0xb8aa1){for(var _0x297d79=0x0;_0x297d79<_0x45de82[_0xd470('0x64')]['ids'][_0xd470('0x50')];_0x297d79+=0x1){var _0xf0f920={'UserId':Number(_0x45de82[_0xd470('0x57')]['id'])};_0xf0f920[_[_0xd470('0xaa')](_0x2d89c2['toLowerCase']())+_0xd470('0xab')]=Number(_0x45de82[_0xd470('0x64')][_0xd470('0x67')][_0x297d79]);socket['emit']('user'+_[_0xd470('0xaa')](_0x2d89c2[_0xd470('0xa6')]())+'Queue:save',_0xf0f920);}return _0xb8aa1;})[_0xd470('0x15')](function(){if(_0x2d89c2==='voice'){return db[_0xd470('0xac')][_0xd470('0x4d')]({'where':{'id':_0x45de82[_0xd470('0x64')][_0xd470('0x67')]||[]},'raw':!![],'attributes':['id',_0xd470('0x3b')]});}})[_0xd470('0x15')](function(_0x2b51bc){var _0x31002a=_0x4b0ec4[_0xd470('0x2b')]({'plain':!![]});var _0x33aa42=[];if(_0x2d89c2===_0xd470('0xad')&&_0x31002a[_0xd470('0x37')]==='agent'&&_0x31002a[_0xd470('0xae')]){for(var _0x35edcd=0x0;_0x35edcd<_0x2b51bc[_0xd470('0x50')];_0x35edcd+=0x1){_0x33aa42[_0xd470('0x4c')]({'membername':_0x31002a['name'],'UserId':_0x31002a['id'],'queue_name':_0x2b51bc[_0x35edcd][_0xd470('0x3b')],'VoiceQueueId':_0x2b51bc[_0x35edcd]['id'],'interface':_['isNil'](_0x31002a[_0xd470('0xaf')])?util[_0xd470('0xb0')]('SIP/%s',_0x31002a[_0xd470('0x3b')]):_0x31002a[_0xd470('0xaf')],'paused':_0x31002a[_0xd470('0xa3')]||![],'penalty':_0x45de82[_0xd470('0x64')]['penalty']||0x0});}return BPromise[_0xd470('0x8f')](_0x33aa42,function(_0x172294){return db[_0xd470('0xb1')][_0xd470('0xb2')](_0x172294);});}return _0x4b0ec4;});}})['then'](respondWithStatusCode(_0x4f2215,null))[_0xd470('0x20')](handleError(_0x4f2215,null));};exports['removeQueues']=function(_0x2d5beb,_0x1eeb9c){var _0xb49e13,_0x5e0bb7;return db[_0xd470('0x3e')][_0xd470('0x38')]({'where':{'id':_0x2d5beb[_0xd470('0x57')]['id']},'attributes':['id',_0xd470('0x3b'),_0xd470('0x37')]})[_0xd470('0x15')](handleEntityNotFound(_0x1eeb9c,null))[_0xd470('0x15')](function(_0x54d005){if(_0x54d005){_0xb49e13=_0x54d005;if(!_0x2d5beb[_0xd470('0x45')]['channel']||!utils['isValidChannel'](_0x2d5beb['query'][_0xd470('0xa2')])){throw new db[(_0xd470('0x95'))][(_0xd470('0x98'))](_0xd470('0xa4'));}return _0x54d005[_0xd470('0xb3')+_[_0xd470('0xaa')](_0x2d5beb[_0xd470('0x45')][_0xd470('0xa2')][_0xd470('0xa6')]())+_0xd470('0xa7')](_0x2d5beb['query'][_0xd470('0x67')]);}})[_0xd470('0x15')](function(_0xe85e3a){if(_[_0xd470('0xb4')](_0x2d5beb[_0xd470('0x45')][_0xd470('0x67')])){for(var _0x176763=0x0;_0x176763<_0x2d5beb[_0xd470('0x45')][_0xd470('0x67')][_0xd470('0x50')];_0x176763+=0x1){_0x5e0bb7={'UserId':Number(_0x2d5beb[_0xd470('0x57')]['id'])};_0x5e0bb7[_[_0xd470('0xaa')](_0x2d5beb[_0xd470('0x45')][_0xd470('0xa2')][_0xd470('0xa6')]())+'QueueId']=Number(_0x2d5beb[_0xd470('0x45')][_0xd470('0x67')][_0x176763]);socket['emit'](_0xd470('0x2d')+_[_0xd470('0xaa')](_0x2d5beb[_0xd470('0x45')][_0xd470('0xa2')][_0xd470('0xa6')]())+_0xd470('0xb5'),_0x5e0bb7);}}else{_0x5e0bb7={'UserId':Number(_0x2d5beb[_0xd470('0x57')]['id'])};_0x5e0bb7[_[_0xd470('0xaa')](_0x2d5beb['query'][_0xd470('0xa2')]['toLowerCase']())+_0xd470('0xab')]=Number(_0x2d5beb[_0xd470('0x45')]['ids']);socket[_0xd470('0xb6')](_0xd470('0x2d')+_[_0xd470('0xaa')](_0x2d5beb['query'][_0xd470('0xa2')][_0xd470('0xa6')]())+_0xd470('0xb5'),_0x5e0bb7);}return _0xe85e3a;})[_0xd470('0x15')](function(){if(_0x2d5beb[_0xd470('0x45')][_0xd470('0xa2')]==='voice'){return db[_0xd470('0xb1')]['destroy']({'where':{'UserId':_0x2d5beb[_0xd470('0x57')]['id'],'VoiceQueueId':_0x2d5beb[_0xd470('0x45')]['ids']},'individualHooks':!![]})[_0xd470('0x15')](function(){return _0xb49e13;});}return _0xb49e13;})[_0xd470('0x15')](respondWithStatusCode(_0x1eeb9c,null))[_0xd470('0x20')](handleError(_0x1eeb9c,null));};exports[_0xd470('0xb7')]=function(_0xa59490,_0x3de3d4){_0xa59490[_0xd470('0x64')][_0xd470('0xb8')]=_0xa59490['file'][_0xd470('0xb9')];return db['User'][_0xd470('0x38')]({'where':{'id':_0xa59490[_0xd470('0x57')]['id']}})[_0xd470('0x15')](handleEntityNotFound(_0x3de3d4,null))['then'](saveUpdates(_0xa59490[_0xd470('0x64')],null))[_0xd470('0x15')](respondWithResult(_0x3de3d4,null))[_0xd470('0x20')](handleError(_0x3de3d4,null));};exports[_0xd470('0xba')]=function(_0x445c6a,_0x4b2563){var _0x148aac=path[_0xd470('0xbb')](config[_0xd470('0xbc')],_0xd470('0xbd'));return db['User'][_0xd470('0x38')]({'where':{'id':_0x445c6a[_0xd470('0x57')]['id']},'attributes':['id',_0xd470('0xb8')],'raw':!![]})[_0xd470('0x15')](handleEntityNotFound(_0x4b2563,null))[_0xd470('0x15')](function(_0x55af2f){if(_0x55af2f){if(_['isNil'](_0x55af2f[_0xd470('0xb8')])){return _0x4b2563[_0xd470('0xbe')](_0x148aac);}else{if(!fs[_0xd470('0xbf')](path[_0xd470('0xbb')](config['root'],_0xd470('0xc0'),_0x55af2f[_0xd470('0xb8')]))){return _0x4b2563[_0xd470('0xbe')](_0x148aac);}return _0x4b2563[_0xd470('0xbe')](path[_0xd470('0xbb')](config[_0xd470('0xbc')],_0xd470('0xc0'),_0x55af2f[_0xd470('0xb8')]));}}})['catch'](handleError(_0x4b2563,null));};exports['getOpenTabs']=function(_0x5a5965,_0x1c16e6){return db[_0xd470('0x3e')]['find']({'where':{'id':_0x5a5965[_0xd470('0x57')]['id']},'attributes':['id']})[_0xd470('0x15')](handleEntityNotFound(_0x1c16e6,null))[_0xd470('0x15')](function(_0x1fc1eb){var _0x45f1f3=[];values=_0x1fc1eb[_0xd470('0x52')];_0x45f1f3['push'](get_open_tabs(_0xd470('0x51'),_0x1fc1eb[_0xd470('0x52')]));_0x45f1f3[_0xd470('0x4c')](get_open_tabs(_0xd470('0x53'),_0x1fc1eb[_0xd470('0x52')]));_0x45f1f3['push'](get_open_tabs(_0xd470('0x54'),_0x1fc1eb['dataValues']));_0x45f1f3[_0xd470('0x4c')](get_open_tabs(_0xd470('0x61'),_0x1fc1eb[_0xd470('0x52')]));_0x45f1f3['push'](get_open_tabs('fax',_0x1fc1eb[_0xd470('0x52')]));_0x45f1f3[_0xd470('0x4c')](get_open_tabs('mail',_0x1fc1eb['dataValues']));return BPromise[_0xd470('0x55')](_0x45f1f3);})['then'](function(_0x89277){if(_0x89277){var _0x3f3c17=_['map'](values[_0xd470('0xc1')],function(_0x1d58de){return{'channel':'CHAT','id':_0x1d58de['id'],'createdAt':_0x1d58de['createdAt']};});var _0x3316b0=_[_0xd470('0x34')](values[_0xd470('0xc2')],function(_0x5cdaa2){return{'channel':_0xd470('0xc3'),'id':_0x5cdaa2['id'],'createdAt':_0x5cdaa2[_0xd470('0xc4')]};});var _0x3760cf=_[_0xd470('0x34')](values[_0xd470('0xc5')],function(_0x20c393){return{'channel':'OPENCHANNEL','id':_0x20c393['id'],'createdAt':_0x20c393[_0xd470('0xc4')]};});var _0x32f9b2=_['map'](values[_0xd470('0xc6')],function(_0x272640){return{'channel':_0xd470('0xc7'),'id':_0x272640['id'],'createdAt':_0x272640['createdAt']};});var _0x4e9064=_[_0xd470('0x34')](values['SmsOpenTabs'],function(_0x2bccc8){return{'channel':_0xd470('0xc8'),'id':_0x2bccc8['id'],'createdAt':_0x2bccc8['createdAt']};});var _0x2e7a3f=_['map'](values[_0xd470('0xc9')],function(_0x1f532b){return{'channel':_0xd470('0xca'),'id':_0x1f532b['id'],'createdAt':_0x1f532b[_0xd470('0xc4')]};});var _0x22da50=_[_0xd470('0xcb')](_0x3f3c17,_0x3316b0,_0x3760cf,_0x32f9b2,_0x4e9064,_0x2e7a3f);var _0x3f589e={'count':_0x22da50[_0xd470('0x50')],'rows':_0x22da50};return _0x3f589e;}else return null;})[_0xd470('0x15')](respondWithResult(_0x1c16e6,null))['catch'](handleError(_0x1c16e6,null));};exports[_0xd470('0xcc')]=function(_0x40d545,_0x5a4034){var _0x2fbd1b={};var _0x6599b7={};var _0x52e812;var _0x19d900;return db[_0xd470('0x3e')][_0xd470('0x9c')]({'where':{'id':_0x40d545[_0xd470('0x57')]['id']}})[_0xd470('0x15')](handleEntityNotFound(_0x5a4034,null))['then'](function(_0x16ac26){if(_0x16ac26){_0x52e812=_0x16ac26;_0x6599b7['model']=_[_0xd470('0x59')](db[_0xd470('0xcd')]['rawAttributes']);_0x6599b7[_0xd470('0x45')]=_['keys'](_0x40d545[_0xd470('0x45')]);_0x6599b7[_0xd470('0x5c')]=_[_0xd470('0x5d')](_0x6599b7['model'],_0x6599b7[_0xd470('0x45')]);_0x2fbd1b['attributes']=_[_0xd470('0x5d')](_0x6599b7[_0xd470('0x5e')],qs[_0xd470('0xce')](_0x40d545[_0xd470('0x45')][_0xd470('0xce')]));_0x2fbd1b[_0xd470('0x4b')]=_0x2fbd1b[_0xd470('0x4b')][_0xd470('0x50')]?_0x2fbd1b[_0xd470('0x4b')]:_0x6599b7[_0xd470('0x5e')];_0x2fbd1b[_0xd470('0xcf')]=qs['sort'](_0x40d545[_0xd470('0x45')][_0xd470('0xd0')]);_0x2fbd1b[_0xd470('0x44')]=qs[_0xd470('0x5c')](_[_0xd470('0xd1')](_0x40d545[_0xd470('0x45')],_0x6599b7[_0xd470('0x5c')]));if(_0x40d545[_0xd470('0x45')][_0xd470('0x32')]){_0x2fbd1b[_0xd470('0x44')]=_[_0xd470('0x5f')](_0x2fbd1b[_0xd470('0x44')],{'$or':_[_0xd470('0x34')](_0x2fbd1b[_0xd470('0x4b')],function(_0x41ce4d){var _0x1d147b={};_0x1d147b[_0x41ce4d]={'$like':'%'+_0x40d545[_0xd470('0x45')][_0xd470('0x32')]+'%'};return _0x1d147b;})});}_0x2fbd1b=_[_0xd470('0x5f')]({},_0x2fbd1b,_0x40d545['options']);return _0x52e812[_0xd470('0xcc')](_0x2fbd1b);}})[_0xd470('0x15')](function(_0x7d05f1){if(_0x7d05f1){_0x19d900=_0x7d05f1[_0xd470('0x50')];if(_0x40d545[_0xd470('0x45')][_0xd470('0xd2')](_0xd470('0x46'))){_0x2fbd1b['include']=[{'model':db[_0xd470('0xd3')],'as':'List','required':![]},{'model':db[_0xd470('0xd4')],'as':_0xd470('0xd5'),'attributes':['id',_0xd470('0x3b'),_0xd470('0xd6')],'where':_0x40d545[_0xd470('0x45')]['tag']?{'id':_0x40d545[_0xd470('0x45')][_0xd470('0xd7')]}:undefined,'required':_0x40d545[_0xd470('0x45')][_0xd470('0xd7')]?!![]:![]}];}if(!_0x40d545['query'][_0xd470('0xd2')](_0xd470('0xd8'))){_0x2fbd1b[_0xd470('0x26')]=qs[_0xd470('0x26')](_0x40d545[_0xd470('0x45')][_0xd470('0x26')]);_0x2fbd1b[_0xd470('0x25')]=qs[_0xd470('0x25')](_0x40d545['query'][_0xd470('0x25')]);}return _0x52e812['getContacts'](_0x2fbd1b);}})[_0xd470('0x15')](function(_0x4084a1){if(_0x4084a1){return _0x4084a1?{'count':_0x19d900,'rows':_0x4084a1}:null;}})[_0xd470('0x15')](respondWithResult(_0x5a4034,null))[_0xd470('0x20')](handleError(_0x5a4034,null));};exports[_0xd470('0xd9')]=function(_0x5eff1e,_0x33e44c){var _0x3649c3;var _0x334fb1={};var _0x3f4d7e;return db[_0xd470('0x3e')][_0xd470('0x9c')]({'where':{'id':_0x5eff1e[_0xd470('0x57')]['id']},'attributes':['id',_0xd470('0x3b'),'role']})[_0xd470('0x15')](handleEntityNotFound(_0x33e44c,null))['then'](function(_0x7b74d){if(!utils[_0xd470('0xda')](_0x5eff1e[_0xd470('0x45')][_0xd470('0xa2')])){throw new db[(_0xd470('0x95'))]['ValidationError']('Unknown\x20channel');}_0x3649c3=_0x7b74d;var _0x5cf4b4={};_0x5cf4b4[_0xd470('0x5e')]=_[_0xd470('0x59')](db[_[_0xd470('0xaa')](_0x5eff1e['query']['channel'])+'Queue']['rawAttributes']);_0x5cf4b4[_0xd470('0x45')]=_['keys'](_0x5eff1e['query']);_0x5cf4b4['filters']=_['intersection'](_0x5cf4b4[_0xd470('0x5e')],_0x5cf4b4[_0xd470('0x45')]);_0x334fb1['attributes']=_[_0xd470('0x5d')](_0x5cf4b4['model'],qs[_0xd470('0xce')](_0x5eff1e[_0xd470('0x45')][_0xd470('0xce')]));_0x334fb1[_0xd470('0x4b')]=_0x334fb1[_0xd470('0x4b')][_0xd470('0x50')]?_0x334fb1[_0xd470('0x4b')]:_0x5cf4b4[_0xd470('0x5e')];_0x334fb1[_0xd470('0xcf')]=qs[_0xd470('0xd0')](_0x5eff1e[_0xd470('0x45')][_0xd470('0xd0')]);_0x334fb1[_0xd470('0x44')]=qs[_0xd470('0x5c')](_[_0xd470('0xd1')](_0x5eff1e[_0xd470('0x45')],_0x5cf4b4[_0xd470('0x5c')]));if(_0x5eff1e['query']['filter']){_0x334fb1[_0xd470('0x44')]=_[_0xd470('0x5f')](_0x334fb1[_0xd470('0x44')],{'$or':_[_0xd470('0x34')](_0x334fb1[_0xd470('0x4b')],function(_0x41a2af){var _0x48941a={};_0x48941a[_0x41a2af]={'$like':'%'+_0x5eff1e[_0xd470('0x45')][_0xd470('0x32')]+'%'};return _0x48941a;})});}_0x334fb1=_[_0xd470('0x5f')]({},_0x334fb1,_0x5eff1e[_0xd470('0x60')]);switch(_0x3649c3[_0xd470('0x37')]){case _0xd470('0x2c'):return db[_[_0xd470('0xaa')](_0x5eff1e[_0xd470('0x45')]['channel'])+'Queue']['findAll'](_0x334fb1);case _0xd470('0x2d'):case _0xd470('0x2f'):return _0x3649c3[_0xd470('0x2b')+_[_0xd470('0xaa')](_0x5eff1e['query'][_0xd470('0xa2')])+_0xd470('0xa7')](_0x334fb1);default:throw new db[(_0xd470('0x95'))][(_0xd470('0x98'))](_0xd470('0xdb'));}})[_0xd470('0x15')](function(_0x10c4d6){_0x3f4d7e=_0x10c4d6[_0xd470('0x50')];if(!_0x5eff1e['query'][_0xd470('0xd2')](_0xd470('0xd8'))){_0x334fb1[_0xd470('0x26')]=qs[_0xd470('0x26')](_0x5eff1e[_0xd470('0x45')][_0xd470('0x26')]);_0x334fb1[_0xd470('0x25')]=qs[_0xd470('0x25')](_0x5eff1e[_0xd470('0x45')][_0xd470('0x25')]);}switch(_0x3649c3['role']){case _0xd470('0x2c'):return db[_[_0xd470('0xaa')](_0x5eff1e[_0xd470('0x45')][_0xd470('0xa2')])+'Queue'][_0xd470('0x4d')](_0x334fb1);case _0xd470('0x2d'):case'agent':return _0x3649c3[_0xd470('0x2b')+_[_0xd470('0xaa')](_0x5eff1e[_0xd470('0x45')][_0xd470('0xa2')])+'Queues'](_0x334fb1);}})['then'](function(_0x54e75f){return{'count':_0x3f4d7e,'rows':_0x54e75f};})[_0xd470('0x15')](respondWithResult(_0x33e44c,null))[_0xd470('0x20')](handleError(_0x33e44c,null));};exports['getVoiceQueuesRt']=function(_0x562720,_0x5e4bc1){var _0x42eec9={};var _0x32b90b={};var _0x441c5f;var _0x9990a7;return db[_0xd470('0x3e')][_0xd470('0x9c')]({'where':{'id':_0x562720[_0xd470('0x57')]['id']}})['then'](handleEntityNotFound(_0x5e4bc1,null))[_0xd470('0x15')](function(_0x3dcd0c){if(_0x3dcd0c){_0x441c5f=_0x3dcd0c;_0x32b90b[_0xd470('0x5e')]=_[_0xd470('0x59')](db[_0xd470('0xb1')][_0xd470('0x5a')]);_0x32b90b[_0xd470('0x45')]=_['keys'](_0x562720[_0xd470('0x45')]);_0x32b90b[_0xd470('0x5c')]=_[_0xd470('0x5d')](_0x32b90b[_0xd470('0x5e')],_0x32b90b[_0xd470('0x45')]);_0x42eec9['attributes']=_[_0xd470('0x5d')](_0x32b90b[_0xd470('0x5e')],qs[_0xd470('0xce')](_0x562720[_0xd470('0x45')][_0xd470('0xce')]));_0x42eec9['attributes']=_0x42eec9[_0xd470('0x4b')]['length']?_0x42eec9[_0xd470('0x4b')]:_0x32b90b[_0xd470('0x5e')];_0x42eec9[_0xd470('0xcf')]=qs[_0xd470('0xd0')](_0x562720[_0xd470('0x45')][_0xd470('0xd0')]);_0x42eec9[_0xd470('0x44')]=qs[_0xd470('0x5c')](_[_0xd470('0xd1')](_0x562720[_0xd470('0x45')],_0x32b90b[_0xd470('0x5c')]));if(_0x562720[_0xd470('0x45')][_0xd470('0x32')]){_0x42eec9[_0xd470('0x44')]=_[_0xd470('0x5f')](_0x42eec9[_0xd470('0x44')],{'$or':_[_0xd470('0x34')](_0x42eec9['attributes'],function(_0xaebb01){var _0x2c8481={};_0x2c8481[_0xaebb01]={'$like':'%'+_0x562720[_0xd470('0x45')][_0xd470('0x32')]+'%'};return _0x2c8481;})});}_0x42eec9=_[_0xd470('0x5f')]({},_0x42eec9,_0x562720[_0xd470('0x60')]);return _0x441c5f['getVoiceQueuesRt'](_0x42eec9);}})['then'](function(_0x5b40fc){if(_0x5b40fc){_0x9990a7=_0x5b40fc[_0xd470('0x50')];if(!_0x562720[_0xd470('0x45')][_0xd470('0xd2')](_0xd470('0xd8'))){_0x42eec9[_0xd470('0x26')]=qs[_0xd470('0x26')](_0x562720[_0xd470('0x45')]['limit']);_0x42eec9[_0xd470('0x25')]=qs[_0xd470('0x25')](_0x562720[_0xd470('0x45')][_0xd470('0x25')]);}return _0x441c5f['getVoiceQueuesRt'](_0x42eec9);}})['then'](function(_0x3d39d4){if(_0x3d39d4){return _0x3d39d4?{'count':_0x9990a7,'rows':_0x3d39d4}:null;}})[_0xd470('0x15')](respondWithResult(_0x5e4bc1,null))[_0xd470('0x20')](handleError(_0x5e4bc1,null));};exports[_0xd470('0xdc')]=function(_0x2c52f1,_0x2431b5){var _0x4399be={};var _0x5955ea={};var _0x507832;var _0x505fc7;return db[_0xd470('0x3e')][_0xd470('0x9c')]({'where':{'id':_0x2c52f1[_0xd470('0x57')]['id']}})[_0xd470('0x15')](handleEntityNotFound(_0x2431b5,null))[_0xd470('0x15')](function(_0xf0b7f4){if(_0xf0b7f4){_0x507832=_0xf0b7f4;_0x5955ea[_0xd470('0x5e')]=_[_0xd470('0x59')](db[_0xd470('0xdd')][_0xd470('0x5a')]);_0x5955ea['query']=_[_0xd470('0x59')](_0x2c52f1['query']);_0x5955ea['filters']=_[_0xd470('0x5d')](_0x5955ea[_0xd470('0x5e')],_0x5955ea[_0xd470('0x45')]);_0x4399be[_0xd470('0x4b')]=_['intersection'](_0x5955ea[_0xd470('0x5e')],qs['fields'](_0x2c52f1['query'][_0xd470('0xce')]));_0x4399be[_0xd470('0x4b')]=_0x4399be[_0xd470('0x4b')][_0xd470('0x50')]?_0x4399be[_0xd470('0x4b')]:_0x5955ea['model'];_0x4399be[_0xd470('0xcf')]=qs[_0xd470('0xd0')](_0x2c52f1[_0xd470('0x45')]['sort']);_0x4399be[_0xd470('0x44')]=qs[_0xd470('0x5c')](_[_0xd470('0xd1')](_0x2c52f1[_0xd470('0x45')],_0x5955ea[_0xd470('0x5c')]));if(_0x2c52f1[_0xd470('0x45')][_0xd470('0x32')]){_0x4399be[_0xd470('0x44')]=_[_0xd470('0x5f')](_0x4399be[_0xd470('0x44')],{'$or':_[_0xd470('0x34')](_0x4399be[_0xd470('0x4b')],function(_0x19b2fd){var _0x4ea099={};_0x4ea099[_0x19b2fd]={'$like':'%'+_0x2c52f1['query'][_0xd470('0x32')]+'%'};return _0x4ea099;})});}_0x4399be=_[_0xd470('0x5f')]({},_0x4399be,_0x2c52f1[_0xd470('0x60')]);return _0x507832['getGroups'](_0x4399be);}})[_0xd470('0x15')](function(_0x2d3efb){if(_0x2d3efb){_0x505fc7=_0x2d3efb['length'];if(!_0x2c52f1[_0xd470('0x45')][_0xd470('0xd2')]('nolimit')){_0x4399be[_0xd470('0x26')]=qs[_0xd470('0x26')](_0x2c52f1['query'][_0xd470('0x26')]);_0x4399be[_0xd470('0x25')]=qs['offset'](_0x2c52f1[_0xd470('0x45')][_0xd470('0x25')]);}return _0x507832[_0xd470('0xdc')](_0x4399be);}})[_0xd470('0x15')](function(_0x187b26){if(_0x187b26){return _0x187b26?{'count':_0x505fc7,'rows':_0x187b26}:null;}})[_0xd470('0x15')](respondWithResult(_0x2431b5,null))[_0xd470('0x20')](handleError(_0x2431b5,null));};exports[_0xd470('0xde')]=function(_0xa4c8b,_0x41d05a){var _0x114418={'raw':!![],'where':{}};var _0x204001={};var _0x1b79a1={'count':0x0,'rows':[]};return db[_0xd470('0x3e')][_0xd470('0x9c')]({'where':{'id':_0xa4c8b[_0xd470('0x57')]['id']}})[_0xd470('0x15')](handleEntityNotFound(_0x41d05a,null))[_0xd470('0x15')](function(_0x35bab){if(_0x35bab){_0x204001[_0xd470('0x5e')]=_['keys'](db[_0xd470('0xdf')][_0xd470('0x5a')]);_0x204001[_0xd470('0x45')]=_[_0xd470('0x59')](_0xa4c8b[_0xd470('0x45')]);_0x204001[_0xd470('0x5c')]=_[_0xd470('0x5d')](_0x204001[_0xd470('0x5e')],_0x204001['query']);_0x114418['attributes']=_[_0xd470('0x5d')](_0x204001[_0xd470('0x5e')],qs[_0xd470('0xce')](_0xa4c8b['query'][_0xd470('0xce')]));_0x114418[_0xd470('0x4b')]=_0x114418[_0xd470('0x4b')]['length']?_0x114418[_0xd470('0x4b')]:_0x204001[_0xd470('0x5e')];if(!_0xa4c8b['query'][_0xd470('0xd2')](_0xd470('0xd8'))){_0x114418[_0xd470('0x26')]=qs[_0xd470('0x26')](_0xa4c8b[_0xd470('0x45')]['limit']);_0x114418[_0xd470('0x25')]=qs[_0xd470('0x25')](_0xa4c8b[_0xd470('0x45')][_0xd470('0x25')]);}_0x114418[_0xd470('0xcf')]=qs[_0xd470('0xd0')](_0xa4c8b[_0xd470('0x45')][_0xd470('0xd0')]);_0x114418[_0xd470('0x44')]=qs[_0xd470('0x5c')](_[_0xd470('0xd1')](_0xa4c8b[_0xd470('0x45')],_0x204001[_0xd470('0x5c')]));_0x114418[_0xd470('0x44')][_0xd470('0xe0')]=_0x35bab['id'];if(_0xa4c8b[_0xd470('0x45')]['filter']){_0x114418['where']=_[_0xd470('0x5f')](_0x114418[_0xd470('0x44')],{'$or':_['map'](_0x114418[_0xd470('0x4b')],function(_0x26b205){var _0x14367d={};_0x14367d[_0x26b205]={'$like':'%'+_0xa4c8b[_0xd470('0x45')][_0xd470('0x32')]+'%'};return _0x14367d;})});}_0x114418=_[_0xd470('0x5f')]({},_0x114418,_0xa4c8b[_0xd470('0x60')]);return db[_0xd470('0xdf')][_0xd470('0x27')]({'where':_0x114418[_0xd470('0x44')]})[_0xd470('0x15')](function(_0x19a093){_0x1b79a1[_0xd470('0x27')]=_0x19a093;if(_0xa4c8b[_0xd470('0x45')][_0xd470('0x46')]){_0x114418[_0xd470('0x47')]=[{'all':!![]}];}return db[_0xd470('0xdf')]['findAll'](_0x114418);})['then'](function(_0x409e1e){_0x1b79a1['rows']=_0x409e1e;return _0x1b79a1;});}})[_0xd470('0x15')](respondWithFilteredResult(_0x41d05a,_0x114418))[_0xd470('0x20')](handleError(_0x41d05a,null));};exports[_0xd470('0xe1')]=function(_0x3587c3,_0x1f48f4){var _0x2f0984={'raw':!![],'where':{}};var _0x44941c={};var _0x587ae0={'count':0x0,'rows':[]};return db[_0xd470('0x3e')][_0xd470('0x9c')]({'where':{'id':_0x3587c3[_0xd470('0x57')]['id']}})['then'](handleEntityNotFound(_0x1f48f4,null))[_0xd470('0x15')](function(_0x3578a0){if(_0x3578a0){_0x44941c[_0xd470('0x5e')]=_[_0xd470('0x59')](db[_0xd470('0xe2')][_0xd470('0x5a')]);_0x44941c[_0xd470('0x45')]=_[_0xd470('0x59')](_0x3587c3[_0xd470('0x45')]);_0x44941c[_0xd470('0x5c')]=_[_0xd470('0x5d')](_0x44941c[_0xd470('0x5e')],_0x44941c[_0xd470('0x45')]);_0x2f0984[_0xd470('0x4b')]=_[_0xd470('0x5d')](_0x44941c[_0xd470('0x5e')],qs[_0xd470('0xce')](_0x3587c3[_0xd470('0x45')][_0xd470('0xce')]));_0x2f0984[_0xd470('0x4b')]=_0x2f0984['attributes']['length']?_0x2f0984[_0xd470('0x4b')]:_0x44941c[_0xd470('0x5e')];if(!_0x3587c3[_0xd470('0x45')][_0xd470('0xd2')](_0xd470('0xd8'))){_0x2f0984['limit']=qs[_0xd470('0x26')](_0x3587c3[_0xd470('0x45')]['limit']);_0x2f0984[_0xd470('0x25')]=qs[_0xd470('0x25')](_0x3587c3[_0xd470('0x45')][_0xd470('0x25')]);}_0x2f0984[_0xd470('0xcf')]=qs[_0xd470('0xd0')](_0x3587c3[_0xd470('0x45')][_0xd470('0xd0')]);_0x2f0984[_0xd470('0x44')]=qs['filters'](_[_0xd470('0xd1')](_0x3587c3['query'],_0x44941c[_0xd470('0x5c')]));_0x2f0984[_0xd470('0x44')][_0xd470('0xe0')]=_0x3578a0['id'];if(_0x3587c3['query'][_0xd470('0x32')]){_0x2f0984['where']=_[_0xd470('0x5f')](_0x2f0984[_0xd470('0x44')],{'$or':_[_0xd470('0x34')](_0x2f0984[_0xd470('0x4b')],function(_0x249c10){var _0x9704d7={};_0x9704d7[_0x249c10]={'$like':'%'+_0x3587c3['query']['filter']+'%'};return _0x9704d7;})});}_0x2f0984=_[_0xd470('0x5f')]({},_0x2f0984,_0x3587c3[_0xd470('0x60')]);return db[_0xd470('0xe2')][_0xd470('0x27')]({'where':_0x2f0984[_0xd470('0x44')]})[_0xd470('0x15')](function(_0x37dfea){_0x587ae0['count']=_0x37dfea;if(_0x3587c3[_0xd470('0x45')]['includeAll']){_0x2f0984[_0xd470('0x47')]=[{'all':!![]}];}return db[_0xd470('0xe2')][_0xd470('0x4d')](_0x2f0984);})[_0xd470('0x15')](function(_0x21bed5){_0x587ae0['rows']=_0x21bed5;return _0x587ae0;});}})['then'](respondWithFilteredResult(_0x1f48f4,_0x2f0984))[_0xd470('0x20')](handleError(_0x1f48f4,null));};exports[_0xd470('0xe3')]=function(_0x4c1c3e,_0x5ee806){var _0x6207f4={};var _0x2d369b={};var _0x18a984;var _0x4df023;return db[_0xd470('0x3e')][_0xd470('0x9c')]({'where':{'id':_0x4c1c3e[_0xd470('0x57')]['id']}})[_0xd470('0x15')](handleEntityNotFound(_0x5ee806,null))[_0xd470('0x15')](function(_0x2b00c7){if(_0x2b00c7){_0x18a984=_0x2b00c7;_0x2d369b[_0xd470('0x5e')]=_['keys'](db[_0xd470('0xe4')][_0xd470('0x5a')]);_0x2d369b[_0xd470('0x45')]=_[_0xd470('0x59')](_0x4c1c3e['query']);_0x2d369b[_0xd470('0x5c')]=_[_0xd470('0x5d')](_0x2d369b['model'],_0x2d369b['query']);_0x6207f4[_0xd470('0x4b')]=_[_0xd470('0x5d')](_0x2d369b[_0xd470('0x5e')],qs['fields'](_0x4c1c3e['query'][_0xd470('0xce')]));_0x6207f4[_0xd470('0x4b')]=_0x6207f4['attributes'][_0xd470('0x50')]?_0x6207f4[_0xd470('0x4b')]:_0x2d369b['model'];_0x6207f4['order']=qs['sort'](_0x4c1c3e[_0xd470('0x45')][_0xd470('0xd0')]);_0x6207f4[_0xd470('0x44')]=qs[_0xd470('0x5c')](_['pick'](_0x4c1c3e[_0xd470('0x45')],_0x2d369b[_0xd470('0x5c')]));if(_0x4c1c3e['query'][_0xd470('0x32')]){_0x6207f4[_0xd470('0x44')]=_[_0xd470('0x5f')](_0x6207f4[_0xd470('0x44')],{'$or':_['map'](_0x6207f4[_0xd470('0x4b')],function(_0x3fe270){var _0x62c8a1={};_0x62c8a1[_0x3fe270]={'$like':'%'+_0x4c1c3e[_0xd470('0x45')][_0xd470('0x32')]+'%'};return _0x62c8a1;})});}_0x6207f4=_[_0xd470('0x5f')]({},_0x6207f4,_0x4c1c3e[_0xd470('0x60')]);return _0x18a984[_0xd470('0xe3')](_0x6207f4);}})[_0xd470('0x15')](function(_0x547cc4){if(_0x547cc4){_0x4df023=_0x547cc4[_0xd470('0x50')];if(!_0x4c1c3e[_0xd470('0x45')][_0xd470('0xd2')](_0xd470('0xd8'))){_0x6207f4[_0xd470('0x26')]=qs[_0xd470('0x26')](_0x4c1c3e[_0xd470('0x45')][_0xd470('0x26')]);_0x6207f4[_0xd470('0x25')]=qs['offset'](_0x4c1c3e[_0xd470('0x45')]['offset']);}return _0x18a984[_0xd470('0xe3')](_0x6207f4);}})[_0xd470('0x15')](function(_0x23cc7e){if(_0x23cc7e){return _0x23cc7e?{'count':_0x4df023,'rows':_0x23cc7e}:null;}})[_0xd470('0x15')](respondWithResult(_0x5ee806,null))[_0xd470('0x20')](handleError(_0x5ee806,null));};exports['getOpenchannelInteractions']=function(_0x5c996a,_0x32d2d6){var _0x2a836f={};var _0x361365={};var _0x14e01d;var _0x17eeb5;return db[_0xd470('0x3e')]['findOne']({'where':{'id':_0x5c996a[_0xd470('0x57')]['id']}})[_0xd470('0x15')](handleEntityNotFound(_0x32d2d6,null))[_0xd470('0x15')](function(_0x7305f7){if(_0x7305f7){_0x14e01d=_0x7305f7;_0x361365[_0xd470('0x5e')]=_[_0xd470('0x59')](db[_0xd470('0xe5')][_0xd470('0x5a')]);_0x361365[_0xd470('0x45')]=_[_0xd470('0x59')](_0x5c996a['query']);_0x361365[_0xd470('0x5c')]=_['intersection'](_0x361365[_0xd470('0x5e')],_0x361365['query']);_0x2a836f['attributes']=_[_0xd470('0x5d')](_0x361365['model'],qs[_0xd470('0xce')](_0x5c996a[_0xd470('0x45')][_0xd470('0xce')]));_0x2a836f[_0xd470('0x4b')]=_0x2a836f['attributes'][_0xd470('0x50')]?_0x2a836f[_0xd470('0x4b')]:_0x361365['model'];_0x2a836f[_0xd470('0xcf')]=qs[_0xd470('0xd0')](_0x5c996a[_0xd470('0x45')][_0xd470('0xd0')]);_0x2a836f[_0xd470('0x44')]=qs[_0xd470('0x5c')](_['pick'](_0x5c996a[_0xd470('0x45')],_0x361365[_0xd470('0x5c')]));if(_0x5c996a[_0xd470('0x45')]['filter']){_0x2a836f[_0xd470('0x44')]=_[_0xd470('0x5f')](_0x2a836f[_0xd470('0x44')],{'$or':_['map'](_0x2a836f['attributes'],function(_0xed43a2){var _0x7e2e69={};_0x7e2e69[_0xed43a2]={'$like':'%'+_0x5c996a[_0xd470('0x45')][_0xd470('0x32')]+'%'};return _0x7e2e69;})});}_0x2a836f=_['merge']({},_0x2a836f,_0x5c996a['options']);return _0x14e01d[_0xd470('0xe6')](_0x2a836f);}})[_0xd470('0x15')](function(_0x50d624){if(_0x50d624){_0x17eeb5=_0x50d624['length'];if(!_0x5c996a[_0xd470('0x45')]['hasOwnProperty']('nolimit')){_0x2a836f[_0xd470('0x26')]=qs[_0xd470('0x26')](_0x5c996a[_0xd470('0x45')]['limit']);_0x2a836f[_0xd470('0x25')]=qs[_0xd470('0x25')](_0x5c996a[_0xd470('0x45')][_0xd470('0x25')]);}return _0x14e01d[_0xd470('0xe6')](_0x2a836f);}})[_0xd470('0x15')](function(_0x32a837){if(_0x32a837){return _0x32a837?{'count':_0x17eeb5,'rows':_0x32a837}:null;}})[_0xd470('0x15')](respondWithResult(_0x32d2d6,null))[_0xd470('0x20')](handleError(_0x32d2d6,null));};exports['getMailInteractions']=function(_0x2fcfb3,_0x5781e3){var _0x2f8610={'raw':!![],'where':{}};var _0x4c58ed={};var _0x2c123b={'count':0x0,'rows':[]};return db[_0xd470('0x3e')][_0xd470('0x9c')]({'where':{'id':_0x2fcfb3['params']['id']}})[_0xd470('0x15')](handleEntityNotFound(_0x5781e3,null))[_0xd470('0x15')](function(_0x4cbc80){if(_0x4cbc80){_0x4c58ed[_0xd470('0x5e')]=_[_0xd470('0x59')](db[_0xd470('0xe7')]['rawAttributes']);_0x4c58ed['query']=_[_0xd470('0x59')](_0x2fcfb3[_0xd470('0x45')]);_0x4c58ed[_0xd470('0x5c')]=_['intersection'](_0x4c58ed[_0xd470('0x5e')],_0x4c58ed[_0xd470('0x45')]);_0x2f8610[_0xd470('0x4b')]=_[_0xd470('0x5d')](_0x4c58ed[_0xd470('0x5e')],qs[_0xd470('0xce')](_0x2fcfb3[_0xd470('0x45')][_0xd470('0xce')]));_0x2f8610[_0xd470('0x4b')]=_0x2f8610[_0xd470('0x4b')][_0xd470('0x50')]?_0x2f8610[_0xd470('0x4b')]:_0x4c58ed['model'];if(!_0x2fcfb3['query'][_0xd470('0xd2')](_0xd470('0xd8'))){_0x2f8610[_0xd470('0x26')]=qs[_0xd470('0x26')](_0x2fcfb3[_0xd470('0x45')]['limit']);_0x2f8610[_0xd470('0x25')]=qs[_0xd470('0x25')](_0x2fcfb3['query']['offset']);}_0x2f8610[_0xd470('0xcf')]=qs['sort'](_0x2fcfb3['query']['sort']);_0x2f8610[_0xd470('0x44')]=qs[_0xd470('0x5c')](_[_0xd470('0xd1')](_0x2fcfb3[_0xd470('0x45')],_0x4c58ed['filters']));_0x2f8610[_0xd470('0x44')][_0xd470('0xe0')]=_0x4cbc80['id'];if(_0x2fcfb3['query']['filter']){_0x2f8610['where']=_[_0xd470('0x5f')](_0x2f8610[_0xd470('0x44')],{'$or':_['map'](_0x2f8610[_0xd470('0x4b')],function(_0x50bce1){var _0xa2f6cf={};_0xa2f6cf[_0x50bce1]={'$like':'%'+_0x2fcfb3[_0xd470('0x45')][_0xd470('0x32')]+'%'};return _0xa2f6cf;})});}_0x2f8610=_[_0xd470('0x5f')]({},_0x2f8610,_0x2fcfb3['options']);return db[_0xd470('0xe7')]['count']({'where':_0x2f8610[_0xd470('0x44')]})['then'](function(_0x20d464){_0x2c123b[_0xd470('0x27')]=_0x20d464;if(_0x2fcfb3['query'][_0xd470('0x46')]){_0x2f8610['include']=[{'all':!![]}];}return db[_0xd470('0xe7')][_0xd470('0x4d')](_0x2f8610);})[_0xd470('0x15')](function(_0x18e80e){_0x2c123b[_0xd470('0x4e')]=_0x18e80e;return _0x2c123b;});}})[_0xd470('0x15')](respondWithFilteredResult(_0x5781e3,_0x2f8610))['catch'](handleError(_0x5781e3,null));};exports[_0xd470('0xe8')]=function(_0x1cff43,_0x3327e8){var _0x1dd22b={};var _0x43a8cf={};var _0x59750b;var _0x1af488;return db[_0xd470('0x3e')][_0xd470('0x9c')]({'where':{'id':_0x1cff43[_0xd470('0x57')]['id']}})[_0xd470('0x15')](handleEntityNotFound(_0x3327e8,null))['then'](function(_0xac04bb){if(_0xac04bb){_0x59750b=_0xac04bb;_0x43a8cf[_0xd470('0x5e')]=_[_0xd470('0x59')](db[_0xd470('0xe9')]['rawAttributes']);_0x43a8cf[_0xd470('0x45')]=_[_0xd470('0x59')](_0x1cff43[_0xd470('0x45')]);_0x43a8cf[_0xd470('0x5c')]=_[_0xd470('0x5d')](_0x43a8cf[_0xd470('0x5e')],_0x43a8cf[_0xd470('0x45')]);_0x1dd22b[_0xd470('0x4b')]=_['intersection'](_0x43a8cf[_0xd470('0x5e')],qs[_0xd470('0xce')](_0x1cff43[_0xd470('0x45')][_0xd470('0xce')]));_0x1dd22b[_0xd470('0x4b')]=_0x1dd22b[_0xd470('0x4b')][_0xd470('0x50')]?_0x1dd22b['attributes']:_0x43a8cf['model'];_0x1dd22b['order']=qs[_0xd470('0xd0')](_0x1cff43['query']['sort']);_0x1dd22b[_0xd470('0x44')]=qs[_0xd470('0x5c')](_[_0xd470('0xd1')](_0x1cff43[_0xd470('0x45')],_0x43a8cf[_0xd470('0x5c')]));if(_0x1cff43[_0xd470('0x45')][_0xd470('0x32')]){_0x1dd22b[_0xd470('0x44')]=_['merge'](_0x1dd22b[_0xd470('0x44')],{'$or':_[_0xd470('0x34')](_0x1dd22b[_0xd470('0x4b')],function(_0xbbd047){var _0x389820={};_0x389820[_0xbbd047]={'$like':'%'+_0x1cff43[_0xd470('0x45')][_0xd470('0x32')]+'%'};return _0x389820;})});}_0x1dd22b=_[_0xd470('0x5f')]({},_0x1dd22b,_0x1cff43[_0xd470('0x60')]);return _0x59750b['getSmsInteractions'](_0x1dd22b);}})[_0xd470('0x15')](function(_0x56990d){if(_0x56990d){_0x1af488=_0x56990d[_0xd470('0x50')];if(!_0x1cff43[_0xd470('0x45')]['hasOwnProperty'](_0xd470('0xd8'))){_0x1dd22b['limit']=qs[_0xd470('0x26')](_0x1cff43[_0xd470('0x45')][_0xd470('0x26')]);_0x1dd22b[_0xd470('0x25')]=qs[_0xd470('0x25')](_0x1cff43['query'][_0xd470('0x25')]);}return _0x59750b['getSmsInteractions'](_0x1dd22b);}})['then'](function(_0x28dc90){if(_0x28dc90){return _0x28dc90?{'count':_0x1af488,'rows':_0x28dc90}:null;}})[_0xd470('0x15')](respondWithResult(_0x3327e8,null))[_0xd470('0x20')](handleError(_0x3327e8,null));};exports[_0xd470('0xea')]=function(_0x3f8188,_0x411bd0){var _0x254719={};var _0x793a3f={};var _0x10fe0;var _0x204f60;return db['User'][_0xd470('0x9c')]({'where':{'id':_0x3f8188[_0xd470('0x57')]['id']}})[_0xd470('0x15')](handleEntityNotFound(_0x411bd0,null))[_0xd470('0x15')](function(_0x20d819){if(_0x20d819){_0x10fe0=_0x20d819;_0x793a3f[_0xd470('0x5e')]=_['keys'](db[_0xd470('0xeb')][_0xd470('0x5a')]);_0x793a3f[_0xd470('0x45')]=_[_0xd470('0x59')](_0x3f8188[_0xd470('0x45')]);_0x793a3f['filters']=_[_0xd470('0x5d')](_0x793a3f[_0xd470('0x5e')],_0x793a3f[_0xd470('0x45')]);_0x254719[_0xd470('0x4b')]=_[_0xd470('0x5d')](_0x793a3f['model'],qs[_0xd470('0xce')](_0x3f8188[_0xd470('0x45')][_0xd470('0xce')]));_0x254719['attributes']=_0x254719[_0xd470('0x4b')][_0xd470('0x50')]?_0x254719[_0xd470('0x4b')]:_0x793a3f[_0xd470('0x5e')];_0x254719['order']=qs[_0xd470('0xd0')](_0x3f8188[_0xd470('0x45')][_0xd470('0xd0')]);_0x254719['where']=qs['filters'](_[_0xd470('0xd1')](_0x3f8188[_0xd470('0x45')],_0x793a3f[_0xd470('0x5c')]));if(_0x3f8188['query'][_0xd470('0x32')]){_0x254719[_0xd470('0x44')]=_['merge'](_0x254719[_0xd470('0x44')],{'$or':_[_0xd470('0x34')](_0x254719['attributes'],function(_0x328de1){var _0x4b1561={};_0x4b1561[_0x328de1]={'$like':'%'+_0x3f8188[_0xd470('0x45')][_0xd470('0x32')]+'%'};return _0x4b1561;})});}_0x254719=_[_0xd470('0x5f')]({},_0x254719,_0x3f8188['options']);return _0x10fe0[_0xd470('0xea')](_0x254719);}})[_0xd470('0x15')](function(_0x5afe2d){if(_0x5afe2d){_0x204f60=_0x5afe2d[_0xd470('0x50')];if(!_0x3f8188[_0xd470('0x45')][_0xd470('0xd2')](_0xd470('0xd8'))){_0x254719[_0xd470('0x26')]=qs[_0xd470('0x26')](_0x3f8188[_0xd470('0x45')][_0xd470('0x26')]);_0x254719['offset']=qs['offset'](_0x3f8188[_0xd470('0x45')][_0xd470('0x25')]);}return _0x10fe0[_0xd470('0xea')](_0x254719);}})[_0xd470('0x15')](function(_0x4ee693){if(_0x4ee693){return _0x4ee693?{'count':_0x204f60,'rows':_0x4ee693}:null;}})['then'](respondWithResult(_0x411bd0,null))[_0xd470('0x20')](handleError(_0x411bd0,null));};exports['getWhatsappInteractions']=function(_0x4900b2,_0x46bd59){var _0x36a4f7={};var _0xe5e9ee={};var _0x3f17bd;var _0x5572a4;return db['User'][_0xd470('0x9c')]({'where':{'id':_0x4900b2[_0xd470('0x57')]['id']}})[_0xd470('0x15')](handleEntityNotFound(_0x46bd59,null))[_0xd470('0x15')](function(_0x3e81ce){if(_0x3e81ce){_0x3f17bd=_0x3e81ce;_0xe5e9ee[_0xd470('0x5e')]=_[_0xd470('0x59')](db['WhatsappInteraction']['rawAttributes']);_0xe5e9ee['query']=_['keys'](_0x4900b2[_0xd470('0x45')]);_0xe5e9ee[_0xd470('0x5c')]=_['intersection'](_0xe5e9ee[_0xd470('0x5e')],_0xe5e9ee[_0xd470('0x45')]);_0x36a4f7[_0xd470('0x4b')]=_[_0xd470('0x5d')](_0xe5e9ee['model'],qs[_0xd470('0xce')](_0x4900b2[_0xd470('0x45')][_0xd470('0xce')]));_0x36a4f7[_0xd470('0x4b')]=_0x36a4f7['attributes']['length']?_0x36a4f7[_0xd470('0x4b')]:_0xe5e9ee[_0xd470('0x5e')];_0x36a4f7['order']=qs[_0xd470('0xd0')](_0x4900b2[_0xd470('0x45')]['sort']);_0x36a4f7['where']=qs['filters'](_[_0xd470('0xd1')](_0x4900b2[_0xd470('0x45')],_0xe5e9ee[_0xd470('0x5c')]));if(_0x4900b2[_0xd470('0x45')][_0xd470('0x32')]){_0x36a4f7[_0xd470('0x44')]=_[_0xd470('0x5f')](_0x36a4f7['where'],{'$or':_[_0xd470('0x34')](_0x36a4f7['attributes'],function(_0x5c7b53){var _0x5662b3={};_0x5662b3[_0x5c7b53]={'$like':'%'+_0x4900b2['query'][_0xd470('0x32')]+'%'};return _0x5662b3;})});}_0x36a4f7=_[_0xd470('0x5f')]({},_0x36a4f7,_0x4900b2[_0xd470('0x60')]);return _0x3f17bd[_0xd470('0xec')](_0x36a4f7);}})['then'](function(_0xdf1ac4){if(_0xdf1ac4){_0x5572a4=_0xdf1ac4[_0xd470('0x50')];if(!_0x4900b2[_0xd470('0x45')][_0xd470('0xd2')]('nolimit')){_0x36a4f7[_0xd470('0x26')]=qs[_0xd470('0x26')](_0x4900b2[_0xd470('0x45')][_0xd470('0x26')]);_0x36a4f7['offset']=qs[_0xd470('0x25')](_0x4900b2[_0xd470('0x45')][_0xd470('0x25')]);}return _0x3f17bd['getWhatsappInteractions'](_0x36a4f7);}})[_0xd470('0x15')](function(_0x4cdce3){if(_0x4cdce3){return _0x4cdce3?{'count':_0x5572a4,'rows':_0x4cdce3}:null;}})['then'](respondWithResult(_0x46bd59,null))[_0xd470('0x20')](handleError(_0x46bd59,null));};exports['login']=function(_0x41c0a8,_0x41b669,_0x9d8e3d){var _0x5b0aeb;var _0x379da6;var _0x31baf5;var _0x1d8ee1=!_[_0xd470('0x6e')](_0x41c0a8['params']['id'])?_0x41c0a8[_0xd470('0x57')]['id']:!_[_0xd470('0x6e')](_0x41c0a8['user']['id'])?_0x41c0a8[_0xd470('0x2d')]['id']:null;return db['User'][_0xd470('0x38')]({'where':{'id':_0x1d8ee1,'role':{'$or':[_0xd470('0x2c'),_0xd470('0x2d'),_0xd470('0x2f')]}},'attributes':['id',_0xd470('0x3b'),_0xd470('0xed'),_0xd470('0xee'),_0xd470('0x37'),_0xd470('0x6f'),_0xd470('0xef')]})[_0xd470('0x15')](function(_0x5f2fcb){if(_0x5f2fcb){if(_0x5f2fcb[_0xd470('0x37')]==='agent'){_0x5b0aeb=_0x5f2fcb;if(_0x41c0a8[_0xd470('0x64')][_0xd470('0xaf')]){_0x31baf5=util[_0xd470('0xb0')](_0xd470('0xf0'),_0x5b0aeb[_0x41c0a8[_0xd470('0x64')]['interface']]);}else if(_0x41c0a8['body'][_0xd470('0xf1')]){_0x31baf5=util[_0xd470('0xb0')](_0xd470('0xf2'),_0x41c0a8[_0xd470('0x64')][_0xd470('0xf1')]);}else{_0x31baf5=util[_0xd470('0xb0')]('SIP/%s',_0x5b0aeb[_0xd470('0x3b')]);}socket['to'](util[_0xd470('0xb0')]('user:%s',_0x5b0aeb[_0xd470('0x3b')]))[_0xd470('0xb6')](_0xd470('0xf3'),{'user':{'id':_0x5b0aeb['id'],'name':_0x5b0aeb[_0xd470('0x3b')]},'ip':_0x41c0a8[_0xd470('0xf4')][_0xd470('0xf5')]||_0x41c0a8[_0xd470('0xf6')][_0xd470('0xf7')]||_0x41c0a8[_0xd470('0xf8')][_0xd470('0xf7')]||_0x41c0a8['connection'][_0xd470('0xf8')][_0xd470('0xf7')]});return db[_0xd470('0xb1')][_0xd470('0x2a')]({'where':{'membername':_0x5b0aeb[_0xd470('0x3b')]},'individualHooks':!![]});}}else{throw new db[(_0xd470('0x95'))][(_0xd470('0x98'))](_0xd470('0xf9'));}})[_0xd470('0x15')](function(){if(_0x5b0aeb){return _0x5b0aeb[_0xd470('0xfa')]({'raw':!![]});}})[_0xd470('0x15')](function(_0x567b71){if(_0x5b0aeb){var _0x20598c=[];if(_0x567b71){_0x379da6=_0x567b71;if(_0x379da6[_0xd470('0x50')]){for(var _0x39f810=0x0;_0x39f810<_0x379da6[_0xd470('0x50')];_0x39f810++){_0x20598c[_0xd470('0x4c')]({'membername':_0x5b0aeb[_0xd470('0x3b')],'UserId':_0x5b0aeb['id'],'queue_name':_0x379da6[_0x39f810][_0xd470('0x3b')],'VoiceQueueId':_0x379da6[_0x39f810]['id'],'interface':_0x31baf5,'paused':_0x5b0aeb['loginInPause']||![],'penalty':_0x379da6[_0x39f810]['UserVoiceQueue.penalty']||0x0});}return BPromise[_0xd470('0x8f')](_0x20598c,function(_0xb88247){return db[_0xd470('0xb1')][_0xd470('0xb2')](_0xb88247);});}}}})['then'](function(){if(_0x5b0aeb){return db[_0xd470('0xfb')][_0xd470('0x4d')]({'where':{'membername':_0x5b0aeb[_0xd470('0x3b')],'exitAt':null}});}})[_0xd470('0x15')](function(_0x3fb47a){if(_0x5b0aeb){var _0x518ce4=[];_0x3fb47a[_0xd470('0xfc')](function(_0x375c33){_0x518ce4[_0xd470('0x4c')](_0x375c33[_0xd470('0xfd')]({'exitAt':moment()[_0xd470('0xb0')](_0xd470('0xfe'))}));});return BPromise['all'](_0x518ce4);}})[_0xd470('0x15')](function(){if(_0x5b0aeb){var _0x320ea7=[];var _0x3d21ac=[];var _0x4b02b1=utils[_0xd470('0xff')]();var _0x3aedef={'membername':_0x5b0aeb[_0xd470('0x3b')],'interface':_0x31baf5,'enterAt':moment()[_0xd470('0xb0')](_0xd470('0xfe')),'role':_0x5b0aeb['role'],'internal':_0x5b0aeb['internal']};_0x4b02b1[_0xd470('0xfc')](function(_0x53ad45){_0x320ea7[_0xd470('0x4c')](_[_0xd470('0x5f')]({'channel':_0x53ad45,'type':_0xd470('0x100'),'data1':_0x41c0a8[_0xd470('0x64')]['device'],'data2':_0x31baf5},_0x3aedef));if(_0x5b0aeb[_0xd470('0xef')]){_0x3d21ac[_0xd470('0x4c')](_[_0xd470('0x5f')]({'channel':_0x53ad45,'type':'PAUSE','data1':_0xd470('0x101')},_0x3aedef));}});return db[_0xd470('0xfb')][_0xd470('0x8c')](_0x320ea7['concat'](_0x3d21ac),{'individualHooks':!![]});}})[_0xd470('0x15')](function(){if(_0x5b0aeb){return _0x5b0aeb[_0xd470('0xfd')]({'online':!![],'lastLoginAt':moment()['format'](_0xd470('0xfe')),'voicePause':_0x5b0aeb[_0xd470('0xef')]||![],'mailPause':_0x5b0aeb[_0xd470('0xef')]||![],'chatPause':_0x5b0aeb['loginInPause']||![],'faxPause':_0x5b0aeb[_0xd470('0xef')]||![],'smsPause':_0x5b0aeb[_0xd470('0xef')]||![],'openchannelPause':_0x5b0aeb['loginInPause']||![],'whatsappPause':_0x5b0aeb[_0xd470('0xef')]||![],'pauseType':_0x5b0aeb['loginInPause']?_0xd470('0x101'):null,'interface':_0x31baf5,'lastPauseAt':moment()[_0xd470('0xb0')](_0xd470('0xfe'))});}})[_0xd470('0x15')](function(_0x184783){if(_0x41c0a8[_0xd470('0x102')]){return _0x9d8e3d();}else{return BPromise[_0xd470('0x103')](_0x184783)[_0xd470('0x15')](respondWithResult(_0x41b669,null));}})[_0xd470('0x20')](handleError(_0x41b669,null));};exports['logout']=function(_0x144862,_0x442f4b){var _0x18ad1e;return db[_0xd470('0x3e')][_0xd470('0x38')]({'where':{'id':_0x144862['params']['id'],'role':_0xd470('0x2f')},'attributes':['id','name','role']})[_0xd470('0x15')](handleEntityNotFound(_0x442f4b,null))[_0xd470('0x15')](function(_0x351238){if(_0x351238){_0x18ad1e=_0x351238;return db[_0xd470('0xb1')][_0xd470('0x2a')]({'where':{'membername':_0x18ad1e['name']},'individualHooks':!![]});}})[_0xd470('0x15')](function(){return db['MemberReport'][_0xd470('0x4d')]({'where':{'membername':_0x18ad1e[_0xd470('0x3b')],'exitAt':null}});})[_0xd470('0x15')](function(_0x8ae644){var _0x1f44dd=[];_0x8ae644['forEach'](function(_0x6ac797){_0x1f44dd[_0xd470('0x4c')](_0x6ac797[_0xd470('0xfd')]({'exitAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')}));});return BPromise['all'](_0x1f44dd);})[_0xd470('0x15')](function(){return _0x18ad1e[_0xd470('0xfd')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})[_0xd470('0x15')](respondWithResult(_0x442f4b,null))[_0xd470('0x20')](handleError(_0x442f4b,null));};exports[_0xd470('0x104')]=function(_0x4c7af7,_0xc60f13){var _0x383ada;return db[_0xd470('0xb1')][_0xd470('0xfd')]({'paused':0x1},{'where':{'UserId':_0x4c7af7['params']['id']},'individualHooks':!![]})[_0xd470('0x15')](function(){return db[_0xd470('0x3e')]['find']({'where':{'id':_0x4c7af7[_0xd470('0x57')]['id'],'role':_0xd470('0x2f')},'attributes':['id',_0xd470('0x3b'),_0xd470('0x37'),'internal','interface']});})['then'](handleEntityNotFound(_0xc60f13,null))[_0xd470('0x15')](function(_0x304ee7){if(_0x304ee7){_0x383ada=_0x304ee7;return respondWithRpcPromise('QueuePause','pause',{'id':_0x383ada['id'],'name':_0x383ada[_0xd470('0x3b')],'pause':!![]});}})['then'](function(){if(_0x383ada){return db[_0xd470('0xfb')]['findAll']({'where':{'membername':_0x383ada['name'],'type':_0xd470('0x105'),'exitAt':null}});}})[_0xd470('0x15')](function(_0x3af44c){if(_0x3af44c[_0xd470('0x50')]){var _0x3ebb6a=moment()['format'](_0xd470('0xfe'));for(var _0x59368b=0x0,_0x4726c4=_0x3af44c[_0xd470('0x50')];_0x59368b<_0x4726c4;_0x59368b++){_0x3af44c[_0x59368b]['updateAttributes']({'exitAt':_0x3ebb6a});}}})['then'](function(){var _0x50c358=[];var _0x2cef8f=utils[_0xd470('0xff')]();_0x2cef8f[_0xd470('0xfc')](function(_0x5cb116){_0x50c358[_0xd470('0x4c')]({'channel':_0x5cb116,'membername':_0x383ada[_0xd470('0x3b')],'interface':_[_0xd470('0x6e')](_0x383ada[_0xd470('0xaf')])?util[_0xd470('0xb0')](_0xd470('0xf2'),_0x383ada['name']):_0x383ada['interface'],'type':_0xd470('0x105'),'enterAt':moment()['format'](_0xd470('0xfe')),'data1':_0x4c7af7[_0xd470('0x64')][_0xd470('0x40')]||_0xd470('0x106'),'role':_0x383ada[_0xd470('0x37')],'internal':_0x383ada[_0xd470('0x6f')]});});return db[_0xd470('0xfb')]['bulkCreate'](_0x50c358,{'individualHooks':!![]});})[_0xd470('0x15')](function(){return _0x383ada[_0xd470('0xfd')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x4c7af7[_0xd470('0x64')][_0xd470('0x40')]||'DEFAULT\x20PAUSE','lastPauseAt':moment()[_0xd470('0xb0')](_0xd470('0xfe'))});})[_0xd470('0x15')](respondWithResult(_0xc60f13,null))[_0xd470('0x20')](handleError(_0xc60f13,null));};exports[_0xd470('0x107')]=function(_0x4d824c,_0x3a7967){var _0x408b23;return db[_0xd470('0x3e')][_0xd470('0x38')]({'where':{'id':_0x4d824c[_0xd470('0x57')]['id']},'attributes':['id','name',_0xd470('0x37'),'voicePause','mailPause',_0xd470('0x108'),_0xd470('0x109'),_0xd470('0x10a'),_0xd470('0x10b'),_0xd470('0x10c'),'pauseType',_0xd470('0x10d')]})[_0xd470('0x15')](handleEntityNotFound(_0x3a7967,null))['then'](function(_0x2072da){if(_0x2072da){_0x408b23=_0x2072da;if(_0x4d824c['body']['channel']&&!utils['isValidChannel'](_0x4d824c[_0xd470('0x64')][_0xd470('0xa2')])){throw new db[(_0xd470('0x95'))][(_0xd470('0x98'))](_0xd470('0xa4'));}switch(_0x4d824c[_0xd470('0x64')]['channel']){case _0xd470('0xad'):return respondWithRpcPromise(_0xd470('0x10e'),_0xd470('0x107'),{'id':_0x408b23['id'],'name':_0x408b23[_0xd470('0x3b')],'pause':![]})[_0xd470('0x15')](function(){return db[_0xd470('0xb1')][_0xd470('0xfd')]({'paused':0x0},{'where':{'UserId':_0x408b23['id']},'individualHooks':!![]});})[_0xd470('0x15')](function(){return db[_0xd470('0xfb')][_0xd470('0x38')]({'where':{'channel':_0x4d824c[_0xd470('0x64')][_0xd470('0xa2')],'membername':_0x408b23['name'],'type':_0xd470('0x105'),'exitAt':null}});})[_0xd470('0x15')](function(_0x430361){if(_0x430361){return _0x430361[_0xd470('0xfd')]({'exitAt':moment()['format'](_0xd470('0xfe')),'data2':_0xd470('0x10f')},{'individualHooks':!![]});}return null;})[_0xd470('0x15')](function(){return _0x408b23['update']({'voicePause':![]});});case _0xd470('0x63'):case _0xd470('0x51'):case'fax':case'sms':case _0xd470('0x61'):case _0xd470('0x54'):return db[_0xd470('0xfb')][_0xd470('0x38')]({'where':{'channel':_0x4d824c[_0xd470('0x64')][_0xd470('0xa2')],'membername':_0x408b23[_0xd470('0x3b')],'type':_0xd470('0x105'),'exitAt':null}})[_0xd470('0x15')](function(_0x1e593a){if(_0x1e593a){return _0x1e593a[_0xd470('0xfd')]({'exitAt':moment()[_0xd470('0xb0')](_0xd470('0xfe')),'data2':_0xd470('0x10f')},{'individualHooks':!![]});}return null;})[_0xd470('0x15')](function(){var _0x559b3f={};_[_0xd470('0x28')](_0x559b3f,util[_0xd470('0xb0')](_0xd470('0x110'),_0x4d824c[_0xd470('0x64')]['channel'],_0xd470('0x111')),![]);return _0x408b23[_0xd470('0xfd')](_0x559b3f);});default:return respondWithRpcPromise(_0xd470('0x10e'),_0xd470('0x107'),{'id':_0x408b23['id'],'name':_0x408b23['name'],'pause':![]})['then'](function(){return db[_0xd470('0xb1')]['update']({'paused':0x0},{'where':{'UserId':_0x408b23['id']}});})[_0xd470('0x15')](function(){return db[_0xd470('0xfb')][_0xd470('0x4d')]({'where':{'membername':_0x408b23['name'],'type':_0xd470('0x105'),'exitAt':null}});})[_0xd470('0x15')](function(_0x34d7fd){var _0x4a008b=[];_0x34d7fd[_0xd470('0xfc')](function(_0x101866){_0x4a008b[_0xd470('0x4c')](_0x101866['update']({'exitAt':moment()[_0xd470('0xb0')]('YYYY-MM-DD\x20HH:mm:ss'),'data2':_0xd470('0x10f')}));});return BPromise[_0xd470('0x55')](_0x4a008b);})[_0xd470('0x15')](function(){return _0x408b23[_0xd470('0xfd')]({'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'whatsappPause':![],'openchannelPause':![]});});}}})[_0xd470('0x15')](respondWithResult(_0x3a7967,null))[_0xd470('0x20')](handleError(_0x3a7967,null));};exports[_0xd470('0x112')]=function(_0x529876,_0x236c44){var _0xe62c52={};var _0x4fa7bb={};var _0x3937bf;var _0x5e3b40;return db[_0xd470('0x3e')][_0xd470('0x9c')]({'where':{'id':_0x529876[_0xd470('0x57')]['id']}})[_0xd470('0x15')](handleEntityNotFound(_0x236c44,null))['then'](function(_0x4c6e80){if(_0x4c6e80){_0x3937bf=_0x4c6e80;_0x4fa7bb[_0xd470('0x5e')]=_[_0xd470('0x59')](db['Team'][_0xd470('0x5a')]);_0x4fa7bb['query']=_[_0xd470('0x59')](_0x529876['query']);_0x4fa7bb[_0xd470('0x5c')]=_[_0xd470('0x5d')](_0x4fa7bb['model'],_0x4fa7bb[_0xd470('0x45')]);_0xe62c52[_0xd470('0x4b')]=_[_0xd470('0x5d')](_0x4fa7bb[_0xd470('0x5e')],qs[_0xd470('0xce')](_0x529876[_0xd470('0x45')][_0xd470('0xce')]));_0xe62c52[_0xd470('0x4b')]=_0xe62c52['attributes'][_0xd470('0x50')]?_0xe62c52[_0xd470('0x4b')]:_0x4fa7bb[_0xd470('0x5e')];_0xe62c52[_0xd470('0xcf')]=qs['sort'](_0x529876[_0xd470('0x45')][_0xd470('0xd0')]);_0xe62c52[_0xd470('0x44')]=qs[_0xd470('0x5c')](_[_0xd470('0xd1')](_0x529876[_0xd470('0x45')],_0x4fa7bb[_0xd470('0x5c')]));if(_0x529876[_0xd470('0x45')]['filter']){_0xe62c52[_0xd470('0x44')]=_[_0xd470('0x5f')](_0xe62c52[_0xd470('0x44')],{'$or':_[_0xd470('0x34')](_0xe62c52['attributes'],function(_0x3933a2){var _0x509430={};_0x509430[_0x3933a2]={'$like':'%'+_0x529876[_0xd470('0x45')][_0xd470('0x32')]+'%'};return _0x509430;})});}_0xe62c52=_[_0xd470('0x5f')]({},_0xe62c52,_0x529876[_0xd470('0x60')]);return _0x3937bf[_0xd470('0x112')](_0xe62c52);}})[_0xd470('0x15')](function(_0x2591c7){if(_0x2591c7){_0x5e3b40=_0x2591c7[_0xd470('0x50')];if(!_0x529876[_0xd470('0x45')][_0xd470('0xd2')](_0xd470('0xd8'))){_0xe62c52[_0xd470('0x26')]=qs[_0xd470('0x26')](_0x529876['query'][_0xd470('0x26')]);_0xe62c52[_0xd470('0x25')]=qs['offset'](_0x529876[_0xd470('0x45')][_0xd470('0x25')]);}return _0x3937bf[_0xd470('0x112')](_0xe62c52);}})['then'](function(_0x4ffafd){if(_0x4ffafd){return _0x4ffafd?{'count':_0x5e3b40,'rows':_0x4ffafd}:null;}})[_0xd470('0x15')](respondWithResult(_0x236c44,null))[_0xd470('0x20')](handleError(_0x236c44,null));};exports['addTeams']=function(_0x36997a,_0x22ddd8){return db[_0xd470('0x3e')]['find']({'where':{'id':_0x36997a[_0xd470('0x57')]['id']}})[_0xd470('0x15')](handleEntityNotFound(_0x22ddd8,null))[_0xd470('0x15')](function(_0x257378){if(_0x257378){var _0x18eafe=_0x257378[_0xd470('0x2b')]({'plain':!![]});return _0x257378[_0xd470('0x113')](_0x36997a[_0xd470('0x64')][_0xd470('0x67')],_[_0xd470('0x68')](_0x36997a['body'],[_0xd470('0x67'),'id'])||{})['then'](function(){for(var _0x3821b2=0x0;_0x3821b2<_0x36997a[_0xd470('0x64')]['ids'][_0xd470('0x50')];_0x3821b2++){var _0x4be930=[];var _0x509c2c={};db[_0xd470('0x114')][_0xd470('0x9c')]({'where':{'id':_0x36997a['body'][_0xd470('0x67')][_0x3821b2]}})[_0xd470('0x15')](function(_0x5813b4){_0x509c2c=_0x5813b4[_0xd470('0x52')];_0x4be930['push'](_0x5813b4['getVoiceQueues']()['then'](function(_0x2cd47b){for(var _0x4ef542=0x0;_0x4ef542<_0x2cd47b[_0xd470('0x50')];_0x4ef542++){_0x2cd47b[_0x4ef542][_0xd470('0x115')](_0xd470('0xa2'),_0xd470('0x116'));}return _0x2cd47b;}));_0x4be930['push'](_0x5813b4[_0xd470('0x117')]()[_0xd470('0x15')](function(_0x43c95a){for(var _0x316d52=0x0;_0x316d52<_0x43c95a[_0xd470('0x50')];_0x316d52++){_0x43c95a[_0x316d52][_0xd470('0x115')](_0xd470('0xa2'),'Chat');}return _0x43c95a;}));_0x4be930[_0xd470('0x4c')](_0x5813b4[_0xd470('0x118')]()['then'](function(_0x5a464a){for(var _0x1b87c5=0x0;_0x1b87c5<_0x5a464a[_0xd470('0x50')];_0x1b87c5++){_0x5a464a[_0x1b87c5]['setDataValue']('channel',_0xd470('0x119'));}return _0x5a464a;}));_0x4be930['push'](_0x5813b4[_0xd470('0x11a')]()['then'](function(_0xf20eec){for(var _0x5d6daa=0x0;_0x5d6daa<_0xf20eec['length'];_0x5d6daa++){_0xf20eec[_0x5d6daa][_0xd470('0x115')](_0xd470('0xa2'),_0xd470('0x11b'));}return _0xf20eec;}));_0x4be930[_0xd470('0x4c')](_0x5813b4[_0xd470('0x11c')]()[_0xd470('0x15')](function(_0x844a98){for(var _0x25302d=0x0;_0x25302d<_0x844a98[_0xd470('0x50')];_0x25302d++){_0x844a98[_0x25302d][_0xd470('0x115')](_0xd470('0xa2'),_0xd470('0x11d'));}return _0x844a98;}));_0x4be930['push'](_0x5813b4[_0xd470('0x11e')]()['then'](function(_0x5efd22){for(var _0x24c373=0x0;_0x24c373<_0x5efd22[_0xd470('0x50')];_0x24c373++){_0x5efd22[_0x24c373][_0xd470('0x115')](_0xd470('0xa2'),_0xd470('0x11f'));}return _0x5efd22;}));_0x4be930[_0xd470('0x4c')](_0x5813b4['getOpenchannelQueues']()[_0xd470('0x15')](function(_0x91fdcf){for(var _0x5944cb=0x0;_0x5944cb<_0x91fdcf[_0xd470('0x50')];_0x5944cb++){_0x91fdcf[_0x5944cb]['setDataValue'](_0xd470('0xa2'),_0xd470('0x120'));}return _0x91fdcf;}));return BPromise[_0xd470('0x55')](_0x4be930);})[_0xd470('0x15')](function(_0x306a41){var _0x1fafba=_[_0xd470('0x121')](_0x306a41);_0x4be930=[];return db[_0xd470('0x71')][_0xd470('0x122')](function(_0x1d5973){for(var _0x4c20a9=0x0;_0x4c20a9<_0x1fafba[_0xd470('0x50')];_0x4c20a9++){_0x4be930[_0xd470('0x4c')](_0x1fafba[_0x4c20a9][_0xd470('0x123')](_0x18eafe['id']),{'transaction':_0x1d5973});}return BPromise[_0xd470('0x55')](_0x4be930)[_0xd470('0x15')](function(){if(_0x18eafe[_0xd470('0xae')]){return BPromise[_0xd470('0x8f')](_[_0xd470('0x32')](_0x1fafba,function(_0xf0180b){return _0xf0180b[_0xd470('0x124')](_0xd470('0xa2'))==='Voice';}),function(_0x4d5882){return db[_0xd470('0xb1')][_0xd470('0xb2')]({'membername':_0x18eafe[_0xd470('0x3b')],'UserId':_0x18eafe['id'],'queue_name':_0x4d5882[_0xd470('0x3b')],'VoiceQueueId':_0x4d5882['id'],'interface':_[_0xd470('0x6e')](_0x18eafe[_0xd470('0xaf')])?util[_0xd470('0xb0')](_0xd470('0xf2'),_0x18eafe['name']):_0x18eafe[_0xd470('0xaf')],'paused':_0x18eafe[_0xd470('0xa3')]||![],'penalty':_0x18eafe[_0xd470('0xa8')]},{'transaction':_0x1d5973});});}else{return;}})['then'](function(){for(var _0x3cd457=0x0;_0x3cd457<_0x1fafba[_0xd470('0x50')];_0x3cd457++){var _0x1b2df8=_0x1fafba[_0x3cd457][_0xd470('0x124')](_0xd470('0xa2'));var _0x4ab1ea=_0x1b2df8+'QueueId';socket[_0xd470('0xb6')]('user'+_0x1b2df8+_0xd470('0x125'),{'UserId':_0x18eafe['id'],['queueField']:_0x1fafba[_0x3cd457]['id']});}});});})[_0xd470('0x15')](function(){db[_0xd470('0x126')][_0xd470('0x9c')]({'where':{'teamId':_0x509c2c['id']}})[_0xd470('0x15')](function(_0x263515){if(_0x263515){db['UserVoicePrefix'][_0xd470('0x82')]({'UserId':_0x36997a['params']['id'],'VoicePrefixId':_0x263515['VoicePrefixId']});}});});}});}})[_0xd470('0x15')](respondWithStatusCode(_0x22ddd8,null))['catch'](handleError(_0x22ddd8,null));};exports[_0xd470('0x127')]=function(_0x40433e,_0x22c956){return db[_0xd470('0x3e')][_0xd470('0x9c')]({'where':{'id':_0x40433e[_0xd470('0x57')]['id']}})[_0xd470('0x15')](handleEntityNotFound(_0x22c956,null))[_0xd470('0x15')](function(_0x371531){if(_0x371531){var _0x29acc7=_0x371531[_0xd470('0x2b')]({'plain':!![]});var _0x530014=_0x40433e[_0xd470('0x45')][_0xd470('0x67')];return _0x371531['removeTeams'](_0x530014)[_0xd470('0x15')](function(){for(var _0x5b5a54=0x0;_0x5b5a54<_0x530014['length'];_0x5b5a54++){var _0x374349=[];var _0x22233d={};db[_0xd470('0x114')][_0xd470('0x9c')]({'where':{'id':_0x530014[_0x5b5a54]}})[_0xd470('0x15')](function(_0x155413){_0x22233d=_0x155413['dataValues'];_0x374349['push'](_0x155413[_0xd470('0xfa')]()[_0xd470('0x15')](function(_0x34a5b0){for(var _0x454385=0x0;_0x454385<_0x34a5b0[_0xd470('0x50')];_0x454385++){_0x34a5b0[_0x454385][_0xd470('0x115')](_0xd470('0xa2'),'Voice');}return _0x34a5b0;}));_0x374349[_0xd470('0x4c')](_0x155413[_0xd470('0x117')]()[_0xd470('0x15')](function(_0x59dce3){for(var _0x39c36a=0x0;_0x39c36a<_0x59dce3[_0xd470('0x50')];_0x39c36a++){_0x59dce3[_0x39c36a][_0xd470('0x115')](_0xd470('0xa2'),_0xd470('0x128'));}return _0x59dce3;}));_0x374349['push'](_0x155413[_0xd470('0x118')]()[_0xd470('0x15')](function(_0x243e85){for(var _0x45e923=0x0;_0x45e923<_0x243e85[_0xd470('0x50')];_0x45e923++){_0x243e85[_0x45e923][_0xd470('0x115')](_0xd470('0xa2'),_0xd470('0x119'));}return _0x243e85;}));_0x374349[_0xd470('0x4c')](_0x155413[_0xd470('0x11a')]()[_0xd470('0x15')](function(_0x39a1ea){for(var _0x45a963=0x0;_0x45a963<_0x39a1ea[_0xd470('0x50')];_0x45a963++){_0x39a1ea[_0x45a963]['setDataValue'](_0xd470('0xa2'),_0xd470('0x11b'));}return _0x39a1ea;}));_0x374349['push'](_0x155413[_0xd470('0x11c')]()[_0xd470('0x15')](function(_0x57d049){for(var _0x3cd045=0x0;_0x3cd045<_0x57d049[_0xd470('0x50')];_0x3cd045++){_0x57d049[_0x3cd045][_0xd470('0x115')]('channel',_0xd470('0x11d'));}return _0x57d049;}));_0x374349['push'](_0x155413[_0xd470('0x11e')]()[_0xd470('0x15')](function(_0x3369b9){for(var _0x589640=0x0;_0x589640<_0x3369b9[_0xd470('0x50')];_0x589640++){_0x3369b9[_0x589640][_0xd470('0x115')](_0xd470('0xa2'),_0xd470('0x11f'));}return _0x3369b9;}));_0x374349[_0xd470('0x4c')](_0x155413[_0xd470('0x129')]()['then'](function(_0x1e51c3){for(var _0x3e0b90=0x0;_0x3e0b90<_0x1e51c3[_0xd470('0x50')];_0x3e0b90++){_0x1e51c3[_0x3e0b90][_0xd470('0x115')](_0xd470('0xa2'),_0xd470('0x120'));}return _0x1e51c3;}));return BPromise[_0xd470('0x55')](_0x374349);})[_0xd470('0x15')](function(_0x4bcff3){var _0x3e4f8b=_[_0xd470('0x121')](_0x4bcff3);_0x374349=[];return db['sequelize'][_0xd470('0x122')](function(_0x3bc748){for(var _0x23f074=0x0;_0x23f074<_0x3e4f8b[_0xd470('0x50')];_0x23f074++){_0x374349[_0xd470('0x4c')](_0x3e4f8b[_0x23f074]['removeAgent'](_0x29acc7['id']),{'transaction':_0x3bc748});}return BPromise[_0xd470('0x55')](_0x374349)['then'](function(){if(_0x29acc7[_0xd470('0xae')]){return BPromise[_0xd470('0x8f')](_[_0xd470('0x32')](_0x3e4f8b,function(_0x40d803){return _0x40d803['getDataValue'](_0xd470('0xa2'))===_0xd470('0x116');}),function(_0x29c924){return db[_0xd470('0xb1')][_0xd470('0x2a')]({'where':{'VoiceQueueId':_0x29c924['id'],'UserId':_0x29acc7['id']},'transaction':_0x3bc748});});}else{return;}})[_0xd470('0x15')](function(){db[_0xd470('0x126')][_0xd470('0x9c')]({'where':{'teamId':_0x22233d['id']}})[_0xd470('0x15')](function(_0x126147){if(_0x126147){return db['UserVoicePrefix']['destroy']({'where':{'UserId':_0x29acc7['id'],'VoicePrefixId':_0x126147['dataValues'][_0xd470('0x12a')]}});}});})['then'](function(){for(var _0x48cca3=0x0;_0x48cca3<_0x3e4f8b['length'];_0x48cca3++){var _0x3ee49e=_0x3e4f8b[_0x48cca3][_0xd470('0x124')](_0xd470('0xa2'));var _0x39b158=_0x3ee49e+'QueueId';socket[_0xd470('0xb6')](_0xd470('0x2d')+_0x3ee49e+_0xd470('0xb5'),{'UserId':_0x29acc7['id'],['queueField']:_0x3e4f8b[_0x48cca3]['id']});}});});});}});}})[_0xd470('0x15')](respondWithStatusCode(_0x22c956,null))['catch'](handleError(_0x22c956,null));};exports['getLists']=function(_0x4f7b96,_0x4b30a6){var _0x16e5d6={};var _0x242dac={};var _0x418bec;var _0x27173b;return db[_0xd470('0x3e')]['findOne']({'where':{'id':_0x4f7b96[_0xd470('0x57')]['id']}})[_0xd470('0x15')](handleEntityNotFound(_0x4b30a6,null))['then'](function(_0x3948df){if(_0x3948df){_0x418bec=_0x3948df;_0x242dac[_0xd470('0x5e')]=_[_0xd470('0x59')](db[_0xd470('0xd3')][_0xd470('0x5a')]);_0x242dac[_0xd470('0x45')]=_[_0xd470('0x59')](_0x4f7b96['query']);_0x242dac['filters']=_['intersection'](_0x242dac[_0xd470('0x5e')],_0x242dac[_0xd470('0x45')]);_0x16e5d6[_0xd470('0x4b')]=_[_0xd470('0x5d')](_0x242dac[_0xd470('0x5e')],qs['fields'](_0x4f7b96[_0xd470('0x45')][_0xd470('0xce')]));_0x16e5d6[_0xd470('0x4b')]=_0x16e5d6[_0xd470('0x4b')]['length']?_0x16e5d6[_0xd470('0x4b')]:_0x242dac[_0xd470('0x5e')];_0x16e5d6['order']=qs[_0xd470('0xd0')](_0x4f7b96['query'][_0xd470('0xd0')]);_0x16e5d6[_0xd470('0x44')]=qs[_0xd470('0x5c')](_[_0xd470('0xd1')](_0x4f7b96[_0xd470('0x45')],_0x242dac[_0xd470('0x5c')]));if(_0x4f7b96[_0xd470('0x45')][_0xd470('0x32')]){_0x16e5d6[_0xd470('0x44')]=_[_0xd470('0x5f')](_0x16e5d6[_0xd470('0x44')],{'$or':_['map'](_0x16e5d6[_0xd470('0x4b')],function(_0x580191){var _0x1de2da={};_0x1de2da[_0x580191]={'$like':'%'+_0x4f7b96['query']['filter']+'%'};return _0x1de2da;})});}_0x16e5d6=_[_0xd470('0x5f')]({},_0x16e5d6,_0x4f7b96['options']);return _0x418bec[_0xd470('0x12b')](_0x16e5d6);}})[_0xd470('0x15')](function(_0xc26d93){if(_0xc26d93){_0x27173b=_0xc26d93['length'];if(!_0x4f7b96[_0xd470('0x45')]['hasOwnProperty'](_0xd470('0xd8'))){_0x16e5d6[_0xd470('0x26')]=qs[_0xd470('0x26')](_0x4f7b96[_0xd470('0x45')][_0xd470('0x26')]);_0x16e5d6['offset']=qs[_0xd470('0x25')](_0x4f7b96[_0xd470('0x45')][_0xd470('0x25')]);}return _0x418bec[_0xd470('0x12b')](_0x16e5d6);}})[_0xd470('0x15')](function(_0x351131){if(_0x351131){return _0x351131?{'count':_0x27173b,'rows':_0x351131}:null;}})[_0xd470('0x15')](respondWithResult(_0x4b30a6,null))[_0xd470('0x20')](handleError(_0x4b30a6,null));};exports[_0xd470('0x12c')]=function(_0xc29daa,_0x559d67){var _0x1bf307={};var _0x503fe2={};var _0x1b3521;return db[_0xd470('0x3e')][_0xd470('0x9c')]({'where':{'id':_0xc29daa['params']['id']}})['then'](handleEntityNotFound(_0x559d67,null))['then'](function(_0x34e72c){if(_0x34e72c){_0x1b3521=_0x34e72c;_0x503fe2[_0xd470('0x5e')]=_[_0xd470('0x59')](db[_0xd470('0x3e')][_0xd470('0x5a')]);_0x503fe2[_0xd470('0x45')]=_[_0xd470('0x59')](_0xc29daa[_0xd470('0x45')]);_0x503fe2['filters']=_['intersection'](_0x503fe2['model'],_0x503fe2['query']);_0x1bf307[_0xd470('0x4b')]=_[_0xd470('0x5d')](_0x503fe2[_0xd470('0x5e')],qs[_0xd470('0xce')](_0xc29daa['query'][_0xd470('0xce')]));_0x1bf307[_0xd470('0x4b')]=_0x1bf307['attributes'][_0xd470('0x50')]?_0x1bf307[_0xd470('0x4b')]:_0x503fe2[_0xd470('0x5e')];_0x1bf307['order']=qs[_0xd470('0xd0')](_0xc29daa[_0xd470('0x45')]['sort']);_0x1bf307[_0xd470('0x44')]=qs[_0xd470('0x5c')](_[_0xd470('0xd1')](_0xc29daa[_0xd470('0x45')],_0x503fe2[_0xd470('0x5c')]));if(_0xc29daa['query']['filter']){_0x1bf307[_0xd470('0x44')]=_[_0xd470('0x5f')](_0x1bf307[_0xd470('0x44')],{'$or':_[_0xd470('0x34')](_0x1bf307[_0xd470('0x4b')],function(_0x4e5b40){var _0x1b6832={};_0x1b6832[_0x4e5b40]={'$like':'%'+_0xc29daa[_0xd470('0x45')][_0xd470('0x32')]+'%'};return _0x1b6832;})});}_0x1bf307[_0xd470('0x5e')]=db[_0xd470('0x3e')];_0x1bf307['as']='Agents';_0x1bf307=_[_0xd470('0x5f')]({},_0x1bf307,_0xc29daa[_0xd470('0x60')]);return _0x1b3521['getVoiceQueues']({'include':[_0x1bf307]});}})['then'](function(_0x40bfc6){if(_0x40bfc6){var _0x5a8049={},_0x270632=[];for(var _0x56c6ec=0x0;_0x56c6ec<_0x40bfc6[_0xd470('0x50')];_0x56c6ec+=0x1){for(var _0x4e9ab4=0x0,_0x56bc72;_0x4e9ab4<_0x40bfc6[_0x56c6ec][_0xd470('0x2e')][_0xd470('0x50')];_0x4e9ab4+=0x1){_0x56bc72=_0x40bfc6[_0x56c6ec]['Agents'][_0x4e9ab4][_0xd470('0x2b')]({'plain':!![]});_0x5a8049[_0x56bc72['id']]=_0x56bc72;}}_0x5a8049=_[_0xd470('0x12d')](_0x5a8049);for(var _0x1d8291=qs[_0xd470('0x25')](_0xc29daa[_0xd470('0x45')][_0xd470('0x25')]);_0x1d8291<_0x5a8049[_0xd470('0x50')]&&_0x270632['length']=_0x4bdadc){_0x1ea825=_0x4bdadc;_0x4079de=0xc8;}else{_0x4079de=0xce;}_0x146dde[_0xd6e8('0x21')](_0x4079de);return _0x146dde[_0xd6e8('0x28')](_0xd6e8('0x29'),_0x4ae214+'-'+_0x1ea825+'/'+_0x4bdadc)[_0xd6e8('0x23')](_0x3d6d78);}return null;};}function saveUpdates(_0xc5ada5){return function(_0x217696){if(_0x217696){return _0x217696[_0xd6e8('0x2a')](_0xc5ada5)['then'](function(_0x371c18){return _0x371c18;});}return null;};}function removeEntity(_0x2ed5ff){return function(_0x52d4ed){if(_0x52d4ed){return _0x52d4ed['destroy']()['then'](function(){var _0x1b418c=_0x52d4ed[_0xd6e8('0x2b')]({'plain':!![]});if(_0x1b418c['role']==='admin')return;var _0x129f1a=[{'name':_0xd6e8('0x2c'),'value':_0xd6e8('0x2d'),'ignore':!![]},{'name':_0xd6e8('0x2e'),'value':_0xd6e8('0x2f'),'ignore':![]},{'name':_0xd6e8('0x30'),'value':_0xd6e8('0x31'),'ignore':![]}];var _0x1530e1=_(_0x129f1a)[_0xd6e8('0x32')](_0xd6e8('0x33'))[_0xd6e8('0x34')](_0xd6e8('0x35'))['value']();if(_['includes'](_0x1530e1,_0x1b418c[_0xd6e8('0x36')])){return;}var _0x5dae0b=_[_0xd6e8('0x37')](_0x129f1a,[_0xd6e8('0x35'),_0x1b418c[_0xd6e8('0x36')]])[_0xd6e8('0x38')];return db['UserProfileResource'][_0xd6e8('0x39')]({'where':{'type':_0x5dae0b,'resourceId':_0x1b418c['id']}})[_0xd6e8('0x17')](function(){return _0x52d4ed;});})[_0xd6e8('0x17')](function(){_0x2ed5ff[_0xd6e8('0x21')](0xcc)[_0xd6e8('0x22')]();});}};}function handleEntityNotFound(_0x8dd2af){return function(_0x49882d){if(!_0x49882d){_0x8dd2af[_0xd6e8('0x20')](0x194);}return _0x49882d;};}function handleError(_0x51166b,_0x3f9686){_0x3f9686=_0x3f9686||0x1f4;return function(_0xd04163){logger[_0xd6e8('0x1c')](_0xd04163[_0xd6e8('0x3a')]);if(_0xd04163[_0xd6e8('0x38')]){delete _0xd04163[_0xd6e8('0x38')];}_0x51166b['status'](_0x3f9686)[_0xd6e8('0x3b')](_0xd04163);};}exports[_0xd6e8('0x3c')]=function(_0x38cad1,_0x380045){var _0x37c182={},_0x4c423a={'count':0x0,'rows':[]};var _0x52c3cf=_(db[_0xd6e8('0x3d')][_0xd6e8('0x3e')])['map'](function(_0x557ef5){return{'name':_0x557ef5[_0xd6e8('0x3f')],'type':_0x557ef5[_0xd6e8('0x40')][_0xd6e8('0x41')]};})['filter'](function(_0x272627){return!_[_0xd6e8('0x42')]([_0xd6e8('0x43'),'salt'],_0x272627[_0xd6e8('0x38')]);})[_0xd6e8('0x35')]();_0x37c182=qs[_0xd6e8('0x44')](_0x52c3cf,_0x38cad1);var _0x10c290={'where':_0x37c182[_0xd6e8('0x45')]};return db[_0xd6e8('0x3d')][_0xd6e8('0x27')](_0x10c290)[_0xd6e8('0x17')](function(_0x1a4c23){_0x4c423a[_0xd6e8('0x27')]=_0x1a4c23;if(_0x38cad1[_0xd6e8('0x46')][_0xd6e8('0x47')]){_0x37c182['include']=[{'all':!![]}];}if(_0x38cad1[_0xd6e8('0x46')][_0xd6e8('0x48')]===_0xd6e8('0x49')){_0x37c182['include']=[{'model':db['UserSetting'],'as':'userSetting'}];}if(!_[_0xd6e8('0x42')](_0x37c182[_0xd6e8('0x4a')],'id')){_0x37c182[_0xd6e8('0x4a')]['push']('id');}return db[_0xd6e8('0x3d')]['findAll'](_0x37c182);})['then'](function(_0x1318ea){_0x4c423a[_0xd6e8('0x4b')]=_0x1318ea;if(_0x38cad1[_0xd6e8('0x46')][_0xd6e8('0x4c')]===_0xd6e8('0x49')){var _0x5c190e=[];for(var _0x375b39=0x0;_0x375b39<_0x4c423a['rows']['length'];_0x375b39++){_0x5c190e['push'](get_open_tabs(_0xd6e8('0x4d'),_0x4c423a['rows'][_0x375b39][_0xd6e8('0x4e')]));_0x5c190e[_0xd6e8('0x4f')](get_open_tabs(_0xd6e8('0x50'),_0x4c423a[_0xd6e8('0x4b')][_0x375b39]['dataValues']));_0x5c190e['push'](get_open_tabs('fax',_0x4c423a[_0xd6e8('0x4b')][_0x375b39]['dataValues']));_0x5c190e[_0xd6e8('0x4f')](get_open_tabs(_0xd6e8('0x51'),_0x4c423a[_0xd6e8('0x4b')][_0x375b39][_0xd6e8('0x4e')]));_0x5c190e['push'](get_open_tabs(_0xd6e8('0x52'),_0x4c423a[_0xd6e8('0x4b')][_0x375b39][_0xd6e8('0x4e')]));_0x5c190e[_0xd6e8('0x4f')](get_open_tabs(_0xd6e8('0x53'),_0x4c423a[_0xd6e8('0x4b')][_0x375b39][_0xd6e8('0x4e')]));}return BPromise[_0xd6e8('0x54')](_0x5c190e)[_0xd6e8('0x17')](function(){return _0x4c423a;});}else{return _0x4c423a;}})[_0xd6e8('0x17')](respondWithFilteredResult(_0x380045,_0x37c182))['catch'](handleError(_0x380045,null));};exports[_0xd6e8('0x55')]=function(_0x2f698e,_0x46a0eb){var _0x2c458b={'raw':![],'where':{'id':_0x2f698e[_0xd6e8('0x56')]['id']}},_0x318925={};_0x318925[_0xd6e8('0x57')]=_[_0xd6e8('0x58')](_[_0xd6e8('0x59')](db[_0xd6e8('0x3d')]['rawAttributes']),['password',_0xd6e8('0x5a')]);_0x318925[_0xd6e8('0x46')]=_['keys'](_0x2f698e[_0xd6e8('0x46')]);_0x318925[_0xd6e8('0x5b')]=_['intersection'](_0x318925[_0xd6e8('0x57')],_0x318925[_0xd6e8('0x46')]);_0x2c458b[_0xd6e8('0x4a')]=_[_0xd6e8('0x5c')](_0x318925[_0xd6e8('0x57')],qs[_0xd6e8('0x5d')](_0x2f698e[_0xd6e8('0x46')]['fields']));_0x2c458b[_0xd6e8('0x4a')]=_0x2c458b[_0xd6e8('0x4a')][_0xd6e8('0x5e')]?_0x2c458b[_0xd6e8('0x4a')]:_0x318925[_0xd6e8('0x57')];if(_0x2f698e[_0xd6e8('0x46')][_0xd6e8('0x47')]){_0x2c458b[_0xd6e8('0x5f')]=[{'all':!![]}];}if(_0x2f698e[_0xd6e8('0x46')][_0xd6e8('0x48')]===_0xd6e8('0x49')){_0x2c458b[_0xd6e8('0x5f')]=[{'model':db[_0xd6e8('0x60')],'as':_0xd6e8('0x48')}];}_0x2c458b=_[_0xd6e8('0x61')]({},_0x2c458b,_0x2f698e[_0xd6e8('0x62')]);if(!_[_0xd6e8('0x42')](_0x2c458b['attributes'],'id')){_0x2c458b[_0xd6e8('0x4a')][_0xd6e8('0x4f')]('id');}return db[_0xd6e8('0x3d')][_0xd6e8('0x37')](_0x2c458b)[_0xd6e8('0x17')](handleEntityNotFound(_0x46a0eb,null))[_0xd6e8('0x17')](function(_0x4d3518){var _0x36a4b3=[];values=_0x4d3518;if(_0x2f698e[_0xd6e8('0x46')][_0xd6e8('0x4c')]==='true'){_0x36a4b3[_0xd6e8('0x4f')](get_open_tabs('chat',_0x4d3518[_0xd6e8('0x4e')]));_0x36a4b3['push'](get_open_tabs(_0xd6e8('0x50'),_0x4d3518[_0xd6e8('0x4e')]));_0x36a4b3[_0xd6e8('0x4f')](get_open_tabs('openchannel',_0x4d3518[_0xd6e8('0x4e')]));_0x36a4b3[_0xd6e8('0x4f')](get_open_tabs(_0xd6e8('0x53'),_0x4d3518[_0xd6e8('0x4e')]));_0x36a4b3['push'](get_open_tabs(_0xd6e8('0x63'),_0x4d3518[_0xd6e8('0x4e')]));_0x36a4b3['push'](get_open_tabs(_0xd6e8('0x51'),_0x4d3518[_0xd6e8('0x4e')]));return BPromise['all'](_0x36a4b3);}else{return values;}})[_0xd6e8('0x17')](function(){return values;})['then'](respondWithResult(_0x46a0eb,null))[_0xd6e8('0x64')](handleError(_0x46a0eb,null));};exports[_0xd6e8('0x2a')]=function(_0x29435e,_0x5994d0){if(_0x29435e['body']['id']){delete _0x29435e['body']['id'];}delete _0x29435e['body'][_0xd6e8('0x36')];return db[_0xd6e8('0x3d')][_0xd6e8('0x37')]({'where':{'id':_0x29435e['params']['id']}})[_0xd6e8('0x17')](handleEntityNotFound(_0x5994d0,null))[_0xd6e8('0x17')](saveUpdates(_0x29435e[_0xd6e8('0x65')],null))[_0xd6e8('0x17')](respondWithResult(_0x5994d0,null))[_0xd6e8('0x64')](handleError(_0x5994d0,null));};exports['describe']=function(_0x5800ae,_0x5b8ab2){return db['User'][_0xd6e8('0x66')]()[_0xd6e8('0x17')](respondWithResult(_0x5b8ab2,null))[_0xd6e8('0x64')](handleError(_0x5b8ab2,null));};exports[_0xd6e8('0x67')]=function(_0xfcd24d,_0x210d17){return db[_0xd6e8('0x3d')][_0xd6e8('0x37')]({'where':{'id':_0xfcd24d['params']['id']}})[_0xd6e8('0x17')](handleEntityNotFound(_0x210d17,null))[_0xd6e8('0x17')](function(_0x373f36){if(_0x373f36){return _0x373f36['addContacts'](_0xfcd24d['body'][_0xd6e8('0x68')],_[_0xd6e8('0x69')](_0xfcd24d[_0xd6e8('0x65')],['ids','id'])||{});}})[_0xd6e8('0x17')](respondWithResult(_0x210d17,null))[_0xd6e8('0x64')](handleError(_0x210d17,null));};function validateUser(_0x30b261){return new BPromise(function(_0x5a5ab8,_0x299737){if(_0x30b261[_0xd6e8('0x6a')])return _0x5a5ab8(_0x30b261);return db[_0xd6e8('0x6b')][_0xd6e8('0x6c')](0x1)[_0xd6e8('0x17')](function(_0x435d2c){if(_0x435d2c[_0xd6e8('0x6d')])authService[_0xd6e8('0x6e')](_0x30b261['password']);db[_0xd6e8('0x3d')][_0xd6e8('0x6f')](_0xd6e8('0x6a'))[_0xd6e8('0x17')](function(_0x22a26c){if(_[_0xd6e8('0x70')](_0x22a26c)){_0x30b261[_0xd6e8('0x6a')]=_0x435d2c[_0xd6e8('0x71')]||0x1;return;}if(_[_0xd6e8('0x70')](_0x435d2c[_0xd6e8('0x71')])||_0x435d2c[_0xd6e8('0x71')]===_0x22a26c){_0x30b261[_0xd6e8('0x6a')]=_0x22a26c+0x1;return;}if(_0x435d2c[_0xd6e8('0x71')]>_0x22a26c){_0x30b261['internal']=_0x435d2c['min_internal'];return;}return db[_0xd6e8('0x72')][_0xd6e8('0x46')](_0xd6e8('0x73'),{'type':db['sequelize'][_0xd6e8('0x74')][_0xd6e8('0x75')]})[_0xd6e8('0x17')](function(_0xfea81f){if(_0xfea81f&&_0xfea81f[_0xd6e8('0x5e')]){for(var _0x5945c7=0x0,_0x1600f2=_0xfea81f[_0xd6e8('0x5e')];_0x5945c7<_0x1600f2&&_[_0xd6e8('0x70')](_0x30b261[_0xd6e8('0x6a')]);_0x5945c7++){if(_0x435d2c[_0xd6e8('0x71')]<=_0xfea81f[_0x5945c7][_0xd6e8('0x76')]){_0x30b261[_0xd6e8('0x6a')]=_0xfea81f[_0x5945c7][_0xd6e8('0x76')];}else if(_0x435d2c[_0xd6e8('0x71')]>_0xfea81f[_0x5945c7][_0xd6e8('0x76')]&&_0x435d2c[_0xd6e8('0x71')]<=_0xfea81f[_0x5945c7]['to']){_0x30b261[_0xd6e8('0x6a')]=_0x435d2c[_0xd6e8('0x71')];}}}if(_[_0xd6e8('0x70')](_0x30b261[_0xd6e8('0x6a')])){_0x30b261['internal']=_0x22a26c+0x1;}return _0x5a5ab8(_0x30b261);});});})['catch'](function(_0x4c3586){_0x299737(_0x4c3586);});});}function updateUser(_0x39cd2c){return new BPromise(function(_0x49a906,_0x3c09bf){try{if(_0x39cd2c[_0xd6e8('0x77')]){_0x39cd2c[_0xd6e8('0x78')]=_0x39cd2c['internal'];_0x39cd2c[_0xd6e8('0x79')]={'mailbox':_0x39cd2c[_0xd6e8('0x6a')],'password':_0x39cd2c[_0xd6e8('0x43')],'fullname':_0x39cd2c['fullname'],'email':_0x39cd2c[_0xd6e8('0x7a')]};}if(_0x39cd2c[_0xd6e8('0x36')]==='agent'){if(!_0x39cd2c[_0xd6e8('0x7b')])_0x39cd2c['permissions']=[_0xd6e8('0x7c'),_0xd6e8('0x7d'),'103',_0xd6e8('0x7e'),_0xd6e8('0x7f'),_0xd6e8('0x80'),_0xd6e8('0x81'),'106',_0xd6e8('0x82'),_0xd6e8('0x83'),_0xd6e8('0x84'),_0xd6e8('0x85'),_0xd6e8('0x86'),_0xd6e8('0x87'),'115'];}_0x49a906(_0x39cd2c);}catch(_0x46cf85){_0x3c09bf(_0x46cf85);}});}exports[_0xd6e8('0x88')]=function(_0x6ef9d6,_0xd33a1b){if(_0x6ef9d6['user'][_0xd6e8('0x36')]===_0xd6e8('0x2f'))throw new Error(_0xd6e8('0x89'));if(_0x6ef9d6[_0xd6e8('0x65')][_0xd6e8('0x36')]===_0xd6e8('0x2d')&&_0x6ef9d6['user'][_0xd6e8('0x36')]!==_0xd6e8('0x8a')){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user');}if(_0x6ef9d6[_0xd6e8('0x65')][_0xd6e8('0x36')]===_0xd6e8('0x8a')&&_0x6ef9d6[_0xd6e8('0x2d')]['role']!==_0xd6e8('0x8a')){throw new Error(_0xd6e8('0x8b'));}return licenseUtil[_0xd6e8('0x8c')]([_0x6ef9d6[_0xd6e8('0x65')]])[_0xd6e8('0x17')](function(){return validateUser(_0x6ef9d6[_0xd6e8('0x65')]);})['then'](function(_0x2961b0){return updateUser(_0x2961b0)[_0xd6e8('0x17')](function(_0x10055b){if(_0x10055b[_0xd6e8('0x36')]===_0xd6e8('0x8a')){_0x10055b[_0xd6e8('0x8d')]=_0x6ef9d6[_0xd6e8('0x2d')]['settingsEnabled'];delete _0x10055b[_0xd6e8('0x8e')];}return _0x10055b;});})[_0xd6e8('0x17')](function(_0x482960){return db[_0xd6e8('0x3d')][_0xd6e8('0x88')](_0x482960,{'include':[{'model':db[_0xd6e8('0x79')],'as':_0xd6e8('0x79')}]});})[_0xd6e8('0x17')](function(_0x1d040e){if(_0x6ef9d6[_0xd6e8('0x65')][_0xd6e8('0x36')]==='user')return _0x1d040e;if(_0x6ef9d6[_0xd6e8('0x2d')][_0xd6e8('0x36')]!=='user')return _0x1d040e;return db['UserProfileSection'][_0xd6e8('0x37')]({'where':{'name':_0x1d040e['role']===_0xd6e8('0x2f')?_0xd6e8('0x2e'):_0xd6e8('0x30'),'userProfileId':_0x6ef9d6[_0xd6e8('0x2d')][_0xd6e8('0x8e')]},'raw':!![]})[_0xd6e8('0x17')](function(_0x3f1ea7){if(!_0x3f1ea7||_0x3f1ea7['autoAssociation']!=0x0)return _0x1d040e;return db[_0xd6e8('0x8f')][_0xd6e8('0x88')]({'name':_0x1d040e[_0xd6e8('0x38')],'resourceId':_0x1d040e['id'],'type':_0x3f1ea7[_0xd6e8('0x38')],'sectionId':_0x3f1ea7['id']},{})[_0xd6e8('0x17')](function(){return _0x1d040e;});})[_0xd6e8('0x64')](function(_0x177b1f){logger[_0xd6e8('0x1c')](_0xd6e8('0x90'),_0x177b1f);throw _0x177b1f;});})[_0xd6e8('0x17')](respondWithResult(_0xd33a1b,0xc9))['catch'](handleError(_0xd33a1b,null));};exports[_0xd6e8('0x91')]=function(_0x5c97b9,_0x1bf28f){var _0x1bae86=_0x5c97b9[_0xd6e8('0x65')];var _0x313a1b=[];if(_0x5c97b9[_0xd6e8('0x2d')][_0xd6e8('0x36')]==='agent')throw new Error(_0xd6e8('0x89'));if(_['some'](_0x1bae86,[_0xd6e8('0x36'),_0xd6e8('0x2d')])&&_0x5c97b9[_0xd6e8('0x2d')][_0xd6e8('0x36')]!==_0xd6e8('0x8a')){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user');}if(_[_0xd6e8('0x92')](_0x1bae86,['role',_0xd6e8('0x8a')])&&_0x5c97b9['user'][_0xd6e8('0x36')]!==_0xd6e8('0x8a')){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20administrator');}return licenseUtil['checkUserLimits'](_0x1bae86)[_0xd6e8('0x17')](function(){return validateUser(_0x1bae86[0x0]);})[_0xd6e8('0x17')](function(){for(var _0x2f612c=0x1;_0x2f612c<_0x1bae86['length'];_0x2f612c++){var _0x415b3a=_0x1bae86[_0x2f612c-0x1][_0xd6e8('0x6a')];if(!_0x1bae86[_0x2f612c][_0xd6e8('0x6a')])_0x1bae86[_0x2f612c]['internal']=_0x415b3a+0x1;_0x313a1b[_0xd6e8('0x4f')](validateUser(_0x1bae86[_0x2f612c]));}return BPromise[_0xd6e8('0x54')](_0x313a1b);})[_0xd6e8('0x17')](function(){_0x313a1b=[];for(var _0x19fe2f=0x0;_0x19fe2f<_0x1bae86[_0xd6e8('0x5e')];_0x19fe2f++){_0x313a1b['push'](updateUser(_0x1bae86[_0x19fe2f]));}return BPromise['all'](_0x313a1b);})['then'](function(){return BPromise[_0xd6e8('0x93')](_0x1bae86,function(_0x320824){return db['User'][_0xd6e8('0x88')](_0x320824,{'include':[{'model':db[_0xd6e8('0x79')],'as':_0xd6e8('0x79')}]})['then'](function(_0x4db5d2){_0x320824['id']=_0x4db5d2['id'];return _0x320824;});});})[_0xd6e8('0x17')](function(_0x1eb80b){if(_0x5c97b9[_0xd6e8('0x65')][_0xd6e8('0x36')]===_0xd6e8('0x2d'))return _0x1eb80b;if(_0x5c97b9[_0xd6e8('0x2d')][_0xd6e8('0x36')]!==_0xd6e8('0x2d'))return _0x1eb80b;var _0x227f4b=_[_0xd6e8('0x92')](_0x1eb80b,function(_0x3dc091){return _0x3dc091[_0xd6e8('0x36')]===_0xd6e8('0x2f')||_0x3dc091[_0xd6e8('0x36')]==='telephone';});if(!_0x227f4b)return _0x1eb80b;return db[_0xd6e8('0x94')][_0xd6e8('0x95')]({'where':{'name':{'$or':[_0xd6e8('0x2e'),_0xd6e8('0x30')]},'userProfileId':_0x5c97b9[_0xd6e8('0x2d')][_0xd6e8('0x8e')]},'raw':!![]})['then'](function(_0x3c43f){if(_[_0xd6e8('0x96')](_0x3c43f)||!_[_0xd6e8('0x92')](_0x3c43f,[_0xd6e8('0x97'),0x0]))return _0x1eb80b;_0x313a1b=[];var _0x28c04a=_(_0x3c43f)['map'](function(_0x1c5461){if(_0x1c5461[_0xd6e8('0x97')]===0x1)return;return _0x1c5461[_0xd6e8('0x38')]==='Agents'?_0xd6e8('0x2f'):'telephone';})['compact']()['value']();for(var _0x396260=0x0;_0x396260<_0x1eb80b[_0xd6e8('0x5e')];_0x396260++){if(!_[_0xd6e8('0x42')](_0x28c04a,_0x1eb80b[_0x396260][_0xd6e8('0x36')]))return;var _0x2092d3=_0x1eb80b[_0x396260][_0xd6e8('0x36')]===_0xd6e8('0x2f')?'Agents':_0xd6e8('0x30');_0x313a1b['push'](db[_0xd6e8('0x8f')][_0xd6e8('0x88')]({'name':_0x1eb80b[_0x396260][_0xd6e8('0x38')],'resourceId':_0x1eb80b[_0x396260]['id'],'type':_0x2092d3,'sectionId':_[_0xd6e8('0x37')](_0x3c43f,[_0xd6e8('0x38'),_0x2092d3])['id']},{}));}return BPromise[_0xd6e8('0x54')](_0x313a1b);});})[_0xd6e8('0x17')](respondWithResult(_0x1bf28f,0xc9))['catch'](handleError(_0x1bf28f,null));};exports[_0xd6e8('0x98')]=function(_0x19e425,_0x1791f4){if(_0x19e425[_0xd6e8('0x65')]['id']){delete _0x19e425['body']['id'];}return db['User'][_0xd6e8('0x37')]({'where':{'id':_0x19e425[_0xd6e8('0x56')]['id']}})['then'](function(_0x1c628e){if(!_0x1c628e)return null;if(_0x1c628e['id']===_0x19e425['user']['id']){if(!_0x19e425['body'][_0xd6e8('0x99')]||!_0x19e425['body'][_0xd6e8('0x9a')]){throw new db[(_0xd6e8('0x9b'))][(_0xd6e8('0x9c'))](_0xd6e8('0x9d'));}if(!_0x1c628e[_0xd6e8('0x9e')](_0x19e425[_0xd6e8('0x65')][_0xd6e8('0x99')])){throw new db['Sequelize'][(_0xd6e8('0x9c'))](_0xd6e8('0x9f'));}if(_0x19e425[_0xd6e8('0x65')][_0xd6e8('0x99')]===_0x19e425['body']['newPassword']){throw new db[(_0xd6e8('0x9b'))][(_0xd6e8('0x9c'))](_0xd6e8('0xa0'));}}else if(_0x19e425[_0xd6e8('0x2d')][_0xd6e8('0x36')]===_0xd6e8('0x8a')){if(!_0x19e425[_0xd6e8('0x65')][_0xd6e8('0x9a')]){throw new db['Sequelize'][(_0xd6e8('0x9c'))](_0xd6e8('0xa1'));}}else if(_0x19e425[_0xd6e8('0x2d')][_0xd6e8('0x36')]===_0xd6e8('0x2d')){if(!_0x19e425[_0xd6e8('0x65')]['newPassword']){throw new db[(_0xd6e8('0x9b'))][(_0xd6e8('0x9c'))](_0xd6e8('0xa1'));}if(_0x1c628e[_0xd6e8('0x36')]!==_0xd6e8('0x2f')){throw new db[(_0xd6e8('0x9b'))]['ValidationError'](_0xd6e8('0x89'));}}else{throw new db[(_0xd6e8('0x9b'))]['ValidationError'](_0xd6e8('0x89'));}return _0x1c628e;})[_0xd6e8('0x17')](handleEntityNotFound(_0x1791f4,null))[_0xd6e8('0x17')](function(_0x46011d){return db[_0xd6e8('0x6b')][_0xd6e8('0xa2')]({'attributes':['id',_0xd6e8('0x6d'),'enforcePasswordHistory',_0xd6e8('0xa3')]})[_0xd6e8('0x17')](function(_0x38647a){if(_0x38647a[_0xd6e8('0x6d')])authService[_0xd6e8('0x6e')](_0x19e425[_0xd6e8('0x65')][_0xd6e8('0x9a')]);if(!_0x38647a['enforcePasswordHistory']||!_0x46011d[_0xd6e8('0xa4')])return _0x46011d;authService[_0xd6e8('0xa5')](_0x19e425[_0xd6e8('0x65')][_0xd6e8('0x9a')],_0x46011d['previousPasswords'],_0x38647a['passwordHistoryLimit']);return _0x46011d;})[_0xd6e8('0x17')](saveUpdates({'password':_0x19e425[_0xd6e8('0x65')][_0xd6e8('0x9a')],'passwordResetAt':_0x19e425[_0xd6e8('0x2d')]['id']==_0x19e425['params']['id']?moment():null,'previousPasswords':authService[_0xd6e8('0xa6')](_0x19e425[_0xd6e8('0x65')][_0xd6e8('0x9a')],_0x46011d[_0xd6e8('0xa4')])},null));})[_0xd6e8('0x17')](respondWithResult(_0x1791f4,null))[_0xd6e8('0x64')](handleError(_0x1791f4,null));};exports['addQueues']=function(_0xa689e1,_0x32452c){var _0x5c3f83=_0xa689e1[_0xd6e8('0x65')][_0xd6e8('0xa7')];return db[_0xd6e8('0x3d')][_0xd6e8('0x37')]({'where':{'id':_0xa689e1[_0xd6e8('0x56')]['id']},'attributes':['id',_0xd6e8('0x38'),_0xd6e8('0x36'),_0xd6e8('0xa8'),_0xd6e8('0xa9'),_0xd6e8('0xaa'),_0xd6e8('0xab')]})[_0xd6e8('0x17')](handleEntityNotFound(_0x32452c,null))['then'](function(_0x4b840a){if(_0x4b840a){if(!utils[_0xd6e8('0xac')](_0x5c3f83)){throw new db['Sequelize'][(_0xd6e8('0x9c'))](_0xd6e8('0xad'));}return _0x4b840a[_0xd6e8('0xae')+_[_0xd6e8('0xaf')](_0x5c3f83[_0xd6e8('0xb0')]())+_0xd6e8('0xb1')](_0xa689e1[_0xd6e8('0x65')][_0xd6e8('0x68')],{'penalty':_0xa689e1[_0xd6e8('0x65')][_0xd6e8('0xb2')]||0x0})[_0xd6e8('0xb3')](function(_0x32266f){for(var _0x8dbc81=0x0;_0x8dbc81<_0xa689e1[_0xd6e8('0x65')]['ids'][_0xd6e8('0x5e')];_0x8dbc81+=0x1){var _0x17045f={'UserId':Number(_0xa689e1['params']['id'])};_0x17045f[_[_0xd6e8('0xaf')](_0x5c3f83['toLowerCase']())+_0xd6e8('0xb4')]=Number(_0xa689e1[_0xd6e8('0x65')][_0xd6e8('0x68')][_0x8dbc81]);socket[_0xd6e8('0xb5')](_0xd6e8('0x2d')+_['capitalize'](_0x5c3f83['toLowerCase']())+_0xd6e8('0xb6'),_0x17045f);}return _0x32266f;})[_0xd6e8('0x17')](function(){if(_0x5c3f83===_0xd6e8('0xb7')){return db['VoiceQueue']['findAll']({'where':{'id':_0xa689e1[_0xd6e8('0x65')]['ids']||[]},'raw':!![],'attributes':['id',_0xd6e8('0x38')]});}})[_0xd6e8('0x17')](function(_0x3bcfee){var _0x169b1d=_0x4b840a['get']({'plain':!![]});var _0x4a8e50=[];if(_0x5c3f83===_0xd6e8('0xb7')&&_0x169b1d[_0xd6e8('0x36')]==='agent'&&_0x169b1d[_0xd6e8('0xa8')]){for(var _0xe8dfc5=0x0;_0xe8dfc5<_0x3bcfee[_0xd6e8('0x5e')];_0xe8dfc5+=0x1){_0x4a8e50[_0xd6e8('0x4f')]({'membername':_0x169b1d[_0xd6e8('0x38')],'UserId':_0x169b1d['id'],'queue_name':_0x3bcfee[_0xe8dfc5]['name'],'VoiceQueueId':_0x3bcfee[_0xe8dfc5]['id'],'interface':_[_0xd6e8('0x70')](_0x169b1d[_0xd6e8('0xab')])?util[_0xd6e8('0xb8')](_0xd6e8('0xb9'),_0x169b1d[_0xd6e8('0x38')]):_0x169b1d[_0xd6e8('0xab')],'paused':_0x169b1d['voicePause']||![],'penalty':_0xa689e1[_0xd6e8('0x65')][_0xd6e8('0xb2')]||0x0});}return BPromise['each'](_0x4a8e50,function(_0x2aa014){return db[_0xd6e8('0xba')][_0xd6e8('0xbb')](_0x2aa014);});}return _0x4b840a;});}})[_0xd6e8('0x17')](respondWithStatusCode(_0x32452c,null))[_0xd6e8('0x64')](handleError(_0x32452c,null));};exports[_0xd6e8('0xbc')]=function(_0x24a71b,_0x44718c){var _0x327520,_0x255c72;return db['User']['find']({'where':{'id':_0x24a71b[_0xd6e8('0x56')]['id']},'attributes':['id',_0xd6e8('0x38'),_0xd6e8('0x36')]})[_0xd6e8('0x17')](handleEntityNotFound(_0x44718c,null))[_0xd6e8('0x17')](function(_0x28a9c7){if(_0x28a9c7){_0x327520=_0x28a9c7;if(!_0x24a71b[_0xd6e8('0x46')][_0xd6e8('0xa7')]||!utils[_0xd6e8('0xac')](_0x24a71b[_0xd6e8('0x46')][_0xd6e8('0xa7')])){throw new db[(_0xd6e8('0x9b'))][(_0xd6e8('0x9c'))](_0xd6e8('0xad'));}return _0x28a9c7[_0xd6e8('0xbd')+_[_0xd6e8('0xaf')](_0x24a71b['query']['channel'][_0xd6e8('0xb0')]())+'Queues'](_0x24a71b[_0xd6e8('0x46')]['ids']);}})[_0xd6e8('0x17')](function(_0x2e507c){if(_[_0xd6e8('0xbe')](_0x24a71b[_0xd6e8('0x46')][_0xd6e8('0x68')])){for(var _0x13cbc7=0x0;_0x13cbc7<_0x24a71b['query'][_0xd6e8('0x68')][_0xd6e8('0x5e')];_0x13cbc7+=0x1){_0x255c72={'UserId':Number(_0x24a71b[_0xd6e8('0x56')]['id'])};_0x255c72[_[_0xd6e8('0xaf')](_0x24a71b[_0xd6e8('0x46')][_0xd6e8('0xa7')]['toLowerCase']())+_0xd6e8('0xb4')]=Number(_0x24a71b[_0xd6e8('0x46')][_0xd6e8('0x68')][_0x13cbc7]);socket[_0xd6e8('0xb5')](_0xd6e8('0x2d')+_[_0xd6e8('0xaf')](_0x24a71b[_0xd6e8('0x46')][_0xd6e8('0xa7')][_0xd6e8('0xb0')]())+_0xd6e8('0xbf'),_0x255c72);}}else{_0x255c72={'UserId':Number(_0x24a71b[_0xd6e8('0x56')]['id'])};_0x255c72[_[_0xd6e8('0xaf')](_0x24a71b[_0xd6e8('0x46')][_0xd6e8('0xa7')][_0xd6e8('0xb0')]())+_0xd6e8('0xb4')]=Number(_0x24a71b['query'][_0xd6e8('0x68')]);socket[_0xd6e8('0xb5')](_0xd6e8('0x2d')+_[_0xd6e8('0xaf')](_0x24a71b[_0xd6e8('0x46')][_0xd6e8('0xa7')][_0xd6e8('0xb0')]())+'Queue:remove',_0x255c72);}return _0x2e507c;})['then'](function(){if(_0x24a71b[_0xd6e8('0x46')]['channel']===_0xd6e8('0xb7')){return db[_0xd6e8('0xba')]['destroy']({'where':{'UserId':_0x24a71b[_0xd6e8('0x56')]['id'],'VoiceQueueId':_0x24a71b[_0xd6e8('0x46')]['ids']},'individualHooks':!![]})['then'](function(){return _0x327520;});}return _0x327520;})[_0xd6e8('0x17')](respondWithStatusCode(_0x44718c,null))[_0xd6e8('0x64')](handleError(_0x44718c,null));};exports[_0xd6e8('0xc0')]=function(_0x3b7688,_0x14bf31){_0x3b7688[_0xd6e8('0x65')][_0xd6e8('0xc1')]=_0x3b7688['file']['filename'];return db[_0xd6e8('0x3d')]['find']({'where':{'id':_0x3b7688['params']['id']}})[_0xd6e8('0x17')](handleEntityNotFound(_0x14bf31,null))[_0xd6e8('0x17')](saveUpdates(_0x3b7688[_0xd6e8('0x65')],null))[_0xd6e8('0x17')](respondWithResult(_0x14bf31,null))['catch'](handleError(_0x14bf31,null));};exports[_0xd6e8('0xc2')]=function(_0x302fcb,_0x4578c5){var _0xaaa51d=path['join'](config['root'],_0xd6e8('0xc3'));return db[_0xd6e8('0x3d')]['find']({'where':{'id':_0x302fcb['params']['id']},'attributes':['id',_0xd6e8('0xc1')],'raw':!![]})['then'](handleEntityNotFound(_0x4578c5,null))['then'](function(_0x731d77){if(_0x731d77){if(_[_0xd6e8('0x70')](_0x731d77[_0xd6e8('0xc1')])){return _0x4578c5[_0xd6e8('0xc4')](_0xaaa51d);}else{if(!fs[_0xd6e8('0xc5')](path['join'](config[_0xd6e8('0xc6')],_0xd6e8('0xc7'),_0x731d77[_0xd6e8('0xc1')]))){return _0x4578c5[_0xd6e8('0xc4')](_0xaaa51d);}return _0x4578c5[_0xd6e8('0xc4')](path[_0xd6e8('0xc8')](config[_0xd6e8('0xc6')],_0xd6e8('0xc7'),_0x731d77['userpic']));}}})[_0xd6e8('0x64')](handleError(_0x4578c5,null));};exports[_0xd6e8('0xc9')]=function(_0x455af1,_0xd02ce1){return db[_0xd6e8('0x3d')][_0xd6e8('0x37')]({'where':{'id':_0x455af1['params']['id']},'attributes':['id']})[_0xd6e8('0x17')](handleEntityNotFound(_0xd02ce1,null))['then'](function(_0x331bcd){var _0x335599=[];values=_0x331bcd[_0xd6e8('0x4e')];_0x335599[_0xd6e8('0x4f')](get_open_tabs(_0xd6e8('0x4d'),_0x331bcd[_0xd6e8('0x4e')]));_0x335599['push'](get_open_tabs(_0xd6e8('0x50'),_0x331bcd[_0xd6e8('0x4e')]));_0x335599[_0xd6e8('0x4f')](get_open_tabs(_0xd6e8('0x52'),_0x331bcd[_0xd6e8('0x4e')]));_0x335599[_0xd6e8('0x4f')](get_open_tabs(_0xd6e8('0x53'),_0x331bcd[_0xd6e8('0x4e')]));_0x335599[_0xd6e8('0x4f')](get_open_tabs(_0xd6e8('0x63'),_0x331bcd[_0xd6e8('0x4e')]));_0x335599[_0xd6e8('0x4f')](get_open_tabs(_0xd6e8('0x51'),_0x331bcd[_0xd6e8('0x4e')]));return BPromise[_0xd6e8('0x54')](_0x335599);})[_0xd6e8('0x17')](function(_0x4ae43d){if(_0x4ae43d){var _0x19b6e5=_[_0xd6e8('0x34')](values[_0xd6e8('0xca')],function(_0xbd6e80){return{'channel':'CHAT','id':_0xbd6e80['id'],'createdAt':_0xbd6e80[_0xd6e8('0xcb')]};});var _0x5306e5=_[_0xd6e8('0x34')](values['FaxOpenTabs'],function(_0x3ab4de){return{'channel':_0xd6e8('0xcc'),'id':_0x3ab4de['id'],'createdAt':_0x3ab4de[_0xd6e8('0xcb')]};});var _0x41b145=_[_0xd6e8('0x34')](values['OpenchannelOpenTabs'],function(_0x4c9a16){return{'channel':_0xd6e8('0xcd'),'id':_0x4c9a16['id'],'createdAt':_0x4c9a16[_0xd6e8('0xcb')]};});var _0x47e753=_['map'](values['MailOpenTabs'],function(_0x2a84c8){return{'channel':_0xd6e8('0xce'),'id':_0x2a84c8['id'],'createdAt':_0x2a84c8[_0xd6e8('0xcb')]};});var _0xa9100c=_[_0xd6e8('0x34')](values[_0xd6e8('0xcf')],function(_0x1ddef1){return{'channel':'SMS','id':_0x1ddef1['id'],'createdAt':_0x1ddef1['createdAt']};});var _0x5eba64=_[_0xd6e8('0x34')](values[_0xd6e8('0xd0')],function(_0xf97700){return{'channel':_0xd6e8('0xd1'),'id':_0xf97700['id'],'createdAt':_0xf97700[_0xd6e8('0xcb')]};});var _0x158c81=_[_0xd6e8('0xd2')](_0x19b6e5,_0x5306e5,_0x41b145,_0x47e753,_0xa9100c,_0x5eba64);var _0x25f239={'count':_0x158c81[_0xd6e8('0x5e')],'rows':_0x158c81};return _0x25f239;}else return null;})[_0xd6e8('0x17')](respondWithResult(_0xd02ce1,null))[_0xd6e8('0x64')](handleError(_0xd02ce1,null));};exports[_0xd6e8('0xd3')]=function(_0xd76eab,_0xf15ac1){var _0x173800={};var _0x4492e0={};var _0x252ae2;var _0x4801f9;return db[_0xd6e8('0x3d')][_0xd6e8('0xa2')]({'where':{'id':_0xd76eab[_0xd6e8('0x56')]['id']}})[_0xd6e8('0x17')](handleEntityNotFound(_0xf15ac1,null))[_0xd6e8('0x17')](function(_0x90cbf7){if(_0x90cbf7){_0x252ae2=_0x90cbf7;_0x4492e0[_0xd6e8('0x57')]=_[_0xd6e8('0x59')](db[_0xd6e8('0xd4')][_0xd6e8('0x3e')]);_0x4492e0[_0xd6e8('0x46')]=_['keys'](_0xd76eab[_0xd6e8('0x46')]);_0x4492e0[_0xd6e8('0x5b')]=_['intersection'](_0x4492e0[_0xd6e8('0x57')],_0x4492e0['query']);_0x173800[_0xd6e8('0x4a')]=_[_0xd6e8('0x5c')](_0x4492e0[_0xd6e8('0x57')],qs[_0xd6e8('0x5d')](_0xd76eab[_0xd6e8('0x46')]['fields']));_0x173800[_0xd6e8('0x4a')]=_0x173800['attributes']['length']?_0x173800[_0xd6e8('0x4a')]:_0x4492e0[_0xd6e8('0x57')];_0x173800[_0xd6e8('0xd5')]=qs[_0xd6e8('0xd6')](_0xd76eab[_0xd6e8('0x46')]['sort']);_0x173800[_0xd6e8('0x45')]=qs[_0xd6e8('0x5b')](_[_0xd6e8('0xd7')](_0xd76eab[_0xd6e8('0x46')],_0x4492e0[_0xd6e8('0x5b')]));if(_0xd76eab['query']['filter']){_0x173800[_0xd6e8('0x45')]=_[_0xd6e8('0x61')](_0x173800[_0xd6e8('0x45')],{'$or':_[_0xd6e8('0x34')](_0x173800[_0xd6e8('0x4a')],function(_0x366144){var _0x2cb0a4={};_0x2cb0a4[_0x366144]={'$like':'%'+_0xd76eab[_0xd6e8('0x46')]['filter']+'%'};return _0x2cb0a4;})});}_0x173800=_[_0xd6e8('0x61')]({},_0x173800,_0xd76eab['options']);return _0x252ae2[_0xd6e8('0xd3')](_0x173800);}})[_0xd6e8('0x17')](function(_0xe37d0e){if(_0xe37d0e){_0x4801f9=_0xe37d0e['length'];if(_0xd76eab[_0xd6e8('0x46')][_0xd6e8('0xd8')](_0xd6e8('0x47'))){_0x173800['include']=[{'model':db[_0xd6e8('0xd9')],'as':_0xd6e8('0xda'),'required':![]},{'model':db[_0xd6e8('0xdb')],'as':'Tags','attributes':['id','name','color'],'where':_0xd76eab[_0xd6e8('0x46')][_0xd6e8('0xdc')]?{'id':_0xd76eab[_0xd6e8('0x46')]['tag']}:undefined,'required':_0xd76eab[_0xd6e8('0x46')][_0xd6e8('0xdc')]?!![]:![]}];}if(!_0xd76eab[_0xd6e8('0x46')]['hasOwnProperty'](_0xd6e8('0xdd'))){_0x173800[_0xd6e8('0x26')]=qs[_0xd6e8('0x26')](_0xd76eab['query'][_0xd6e8('0x26')]);_0x173800[_0xd6e8('0x24')]=qs[_0xd6e8('0x24')](_0xd76eab[_0xd6e8('0x46')][_0xd6e8('0x24')]);}return _0x252ae2[_0xd6e8('0xd3')](_0x173800);}})[_0xd6e8('0x17')](function(_0x107bf0){if(_0x107bf0){return _0x107bf0?{'count':_0x4801f9,'rows':_0x107bf0}:null;}})['then'](respondWithResult(_0xf15ac1,null))[_0xd6e8('0x64')](handleError(_0xf15ac1,null));};exports[_0xd6e8('0xde')]=function(_0x1e7e45,_0x22c225){var _0x55ad8d;var _0x3006f7={};var _0x5140ed;return db[_0xd6e8('0x3d')][_0xd6e8('0xa2')]({'where':{'id':_0x1e7e45[_0xd6e8('0x56')]['id']},'attributes':['id',_0xd6e8('0x38'),_0xd6e8('0x36')]})[_0xd6e8('0x17')](handleEntityNotFound(_0x22c225,null))['then'](function(_0x380fc7){if(!utils[_0xd6e8('0xac')](_0x1e7e45[_0xd6e8('0x46')]['channel'])){throw new db[(_0xd6e8('0x9b'))]['ValidationError'](_0xd6e8('0xad'));}_0x55ad8d=_0x380fc7;var _0xd571a1={};_0xd571a1[_0xd6e8('0x57')]=_['keys'](db[_[_0xd6e8('0xaf')](_0x1e7e45[_0xd6e8('0x46')][_0xd6e8('0xa7')])+_0xd6e8('0xdf')]['rawAttributes']);_0xd571a1[_0xd6e8('0x46')]=_[_0xd6e8('0x59')](_0x1e7e45['query']);_0xd571a1[_0xd6e8('0x5b')]=_[_0xd6e8('0x5c')](_0xd571a1[_0xd6e8('0x57')],_0xd571a1[_0xd6e8('0x46')]);_0x3006f7[_0xd6e8('0x4a')]=_[_0xd6e8('0x5c')](_0xd571a1['model'],qs[_0xd6e8('0x5d')](_0x1e7e45[_0xd6e8('0x46')]['fields']));_0x3006f7[_0xd6e8('0x4a')]=_0x3006f7[_0xd6e8('0x4a')]['length']?_0x3006f7[_0xd6e8('0x4a')]:_0xd571a1[_0xd6e8('0x57')];_0x3006f7['order']=qs[_0xd6e8('0xd6')](_0x1e7e45['query']['sort']);_0x3006f7[_0xd6e8('0x45')]=qs[_0xd6e8('0x5b')](_[_0xd6e8('0xd7')](_0x1e7e45['query'],_0xd571a1[_0xd6e8('0x5b')]));if(_0x1e7e45[_0xd6e8('0x46')][_0xd6e8('0x32')]){_0x3006f7['where']=_[_0xd6e8('0x61')](_0x3006f7[_0xd6e8('0x45')],{'$or':_[_0xd6e8('0x34')](_0x3006f7[_0xd6e8('0x4a')],function(_0x21b217){var _0x189e99={};_0x189e99[_0x21b217]={'$like':'%'+_0x1e7e45[_0xd6e8('0x46')][_0xd6e8('0x32')]+'%'};return _0x189e99;})});}_0x3006f7=_[_0xd6e8('0x61')]({},_0x3006f7,_0x1e7e45[_0xd6e8('0x62')]);switch(_0x55ad8d[_0xd6e8('0x36')]){case'admin':return db[_['capitalize'](_0x1e7e45[_0xd6e8('0x46')][_0xd6e8('0xa7')])+_0xd6e8('0xdf')]['findAll'](_0x3006f7);case _0xd6e8('0x2d'):case _0xd6e8('0x2f'):return _0x55ad8d[_0xd6e8('0x2b')+_[_0xd6e8('0xaf')](_0x1e7e45['query']['channel'])+_0xd6e8('0xb1')](_0x3006f7);default:throw new db[(_0xd6e8('0x9b'))][(_0xd6e8('0x9c'))]('Unknown\x20role');}})[_0xd6e8('0x17')](function(_0x4d4830){_0x5140ed=_0x4d4830['length'];if(!_0x1e7e45[_0xd6e8('0x46')][_0xd6e8('0xd8')](_0xd6e8('0xdd'))){_0x3006f7[_0xd6e8('0x26')]=qs[_0xd6e8('0x26')](_0x1e7e45['query'][_0xd6e8('0x26')]);_0x3006f7[_0xd6e8('0x24')]=qs['offset'](_0x1e7e45[_0xd6e8('0x46')][_0xd6e8('0x24')]);}switch(_0x55ad8d[_0xd6e8('0x36')]){case _0xd6e8('0x8a'):return db[_['capitalize'](_0x1e7e45['query']['channel'])+_0xd6e8('0xdf')][_0xd6e8('0x95')](_0x3006f7);case _0xd6e8('0x2d'):case _0xd6e8('0x2f'):return _0x55ad8d[_0xd6e8('0x2b')+_[_0xd6e8('0xaf')](_0x1e7e45['query']['channel'])+_0xd6e8('0xb1')](_0x3006f7);}})[_0xd6e8('0x17')](function(_0x5b0963){return{'count':_0x5140ed,'rows':_0x5b0963};})['then'](respondWithResult(_0x22c225,null))[_0xd6e8('0x64')](handleError(_0x22c225,null));};exports[_0xd6e8('0xe0')]=function(_0x4da048,_0x34e21b){var _0x376807={};var _0x323faf={};var _0x51f86c;var _0x379240;return db['User'][_0xd6e8('0xa2')]({'where':{'id':_0x4da048[_0xd6e8('0x56')]['id']}})[_0xd6e8('0x17')](handleEntityNotFound(_0x34e21b,null))[_0xd6e8('0x17')](function(_0x6e1ceb){if(_0x6e1ceb){_0x51f86c=_0x6e1ceb;_0x323faf['model']=_['keys'](db['UserVoiceQueueRt'][_0xd6e8('0x3e')]);_0x323faf[_0xd6e8('0x46')]=_['keys'](_0x4da048[_0xd6e8('0x46')]);_0x323faf['filters']=_['intersection'](_0x323faf['model'],_0x323faf[_0xd6e8('0x46')]);_0x376807[_0xd6e8('0x4a')]=_[_0xd6e8('0x5c')](_0x323faf[_0xd6e8('0x57')],qs[_0xd6e8('0x5d')](_0x4da048[_0xd6e8('0x46')]['fields']));_0x376807['attributes']=_0x376807[_0xd6e8('0x4a')]['length']?_0x376807[_0xd6e8('0x4a')]:_0x323faf[_0xd6e8('0x57')];_0x376807[_0xd6e8('0xd5')]=qs['sort'](_0x4da048['query'][_0xd6e8('0xd6')]);_0x376807[_0xd6e8('0x45')]=qs[_0xd6e8('0x5b')](_[_0xd6e8('0xd7')](_0x4da048[_0xd6e8('0x46')],_0x323faf[_0xd6e8('0x5b')]));if(_0x4da048['query'][_0xd6e8('0x32')]){_0x376807['where']=_[_0xd6e8('0x61')](_0x376807[_0xd6e8('0x45')],{'$or':_['map'](_0x376807[_0xd6e8('0x4a')],function(_0x1278cd){var _0x2e3fc4={};_0x2e3fc4[_0x1278cd]={'$like':'%'+_0x4da048[_0xd6e8('0x46')]['filter']+'%'};return _0x2e3fc4;})});}_0x376807=_[_0xd6e8('0x61')]({},_0x376807,_0x4da048[_0xd6e8('0x62')]);return _0x51f86c[_0xd6e8('0xe0')](_0x376807);}})['then'](function(_0x4d2b9c){if(_0x4d2b9c){_0x379240=_0x4d2b9c[_0xd6e8('0x5e')];if(!_0x4da048[_0xd6e8('0x46')][_0xd6e8('0xd8')](_0xd6e8('0xdd'))){_0x376807[_0xd6e8('0x26')]=qs[_0xd6e8('0x26')](_0x4da048['query']['limit']);_0x376807['offset']=qs[_0xd6e8('0x24')](_0x4da048[_0xd6e8('0x46')][_0xd6e8('0x24')]);}return _0x51f86c[_0xd6e8('0xe0')](_0x376807);}})[_0xd6e8('0x17')](function(_0x17ca13){if(_0x17ca13){return _0x17ca13?{'count':_0x379240,'rows':_0x17ca13}:null;}})[_0xd6e8('0x17')](respondWithResult(_0x34e21b,null))[_0xd6e8('0x64')](handleError(_0x34e21b,null));};exports[_0xd6e8('0xe1')]=function(_0x1d200e,_0x1f01f9){var _0x35f10d={};var _0x56b7c9={};var _0x5c3ff9;var _0x3fb171;return db['User'][_0xd6e8('0xa2')]({'where':{'id':_0x1d200e[_0xd6e8('0x56')]['id']}})[_0xd6e8('0x17')](handleEntityNotFound(_0x1f01f9,null))[_0xd6e8('0x17')](function(_0x1ef353){if(_0x1ef353){_0x5c3ff9=_0x1ef353;_0x56b7c9[_0xd6e8('0x57')]=_[_0xd6e8('0x59')](db[_0xd6e8('0xe2')][_0xd6e8('0x3e')]);_0x56b7c9[_0xd6e8('0x46')]=_['keys'](_0x1d200e[_0xd6e8('0x46')]);_0x56b7c9['filters']=_[_0xd6e8('0x5c')](_0x56b7c9[_0xd6e8('0x57')],_0x56b7c9[_0xd6e8('0x46')]);_0x35f10d[_0xd6e8('0x4a')]=_[_0xd6e8('0x5c')](_0x56b7c9['model'],qs['fields'](_0x1d200e[_0xd6e8('0x46')]['fields']));_0x35f10d[_0xd6e8('0x4a')]=_0x35f10d[_0xd6e8('0x4a')][_0xd6e8('0x5e')]?_0x35f10d[_0xd6e8('0x4a')]:_0x56b7c9[_0xd6e8('0x57')];_0x35f10d[_0xd6e8('0xd5')]=qs[_0xd6e8('0xd6')](_0x1d200e[_0xd6e8('0x46')][_0xd6e8('0xd6')]);_0x35f10d[_0xd6e8('0x45')]=qs[_0xd6e8('0x5b')](_['pick'](_0x1d200e[_0xd6e8('0x46')],_0x56b7c9[_0xd6e8('0x5b')]));if(_0x1d200e['query']['filter']){_0x35f10d['where']=_['merge'](_0x35f10d[_0xd6e8('0x45')],{'$or':_[_0xd6e8('0x34')](_0x35f10d['attributes'],function(_0x3278a7){var _0x5da53d={};_0x5da53d[_0x3278a7]={'$like':'%'+_0x1d200e[_0xd6e8('0x46')]['filter']+'%'};return _0x5da53d;})});}_0x35f10d=_[_0xd6e8('0x61')]({},_0x35f10d,_0x1d200e['options']);return _0x5c3ff9[_0xd6e8('0xe1')](_0x35f10d);}})[_0xd6e8('0x17')](function(_0x72ad83){if(_0x72ad83){_0x3fb171=_0x72ad83[_0xd6e8('0x5e')];if(!_0x1d200e[_0xd6e8('0x46')][_0xd6e8('0xd8')](_0xd6e8('0xdd'))){_0x35f10d['limit']=qs[_0xd6e8('0x26')](_0x1d200e[_0xd6e8('0x46')][_0xd6e8('0x26')]);_0x35f10d[_0xd6e8('0x24')]=qs[_0xd6e8('0x24')](_0x1d200e[_0xd6e8('0x46')][_0xd6e8('0x24')]);}return _0x5c3ff9[_0xd6e8('0xe1')](_0x35f10d);}})[_0xd6e8('0x17')](function(_0x49660f){if(_0x49660f){return _0x49660f?{'count':_0x3fb171,'rows':_0x49660f}:null;}})['then'](respondWithResult(_0x1f01f9,null))[_0xd6e8('0x64')](handleError(_0x1f01f9,null));};exports['getRecordings']=function(_0x409805,_0x264006){var _0x22783f={'raw':!![],'where':{}};var _0x5eeeae={};var _0x2539d5={'count':0x0,'rows':[]};return db[_0xd6e8('0x3d')][_0xd6e8('0xa2')]({'where':{'id':_0x409805[_0xd6e8('0x56')]['id']}})[_0xd6e8('0x17')](handleEntityNotFound(_0x264006,null))['then'](function(_0x2002fe){if(_0x2002fe){_0x5eeeae[_0xd6e8('0x57')]=_[_0xd6e8('0x59')](db[_0xd6e8('0xe3')][_0xd6e8('0x3e')]);_0x5eeeae[_0xd6e8('0x46')]=_['keys'](_0x409805[_0xd6e8('0x46')]);_0x5eeeae[_0xd6e8('0x5b')]=_[_0xd6e8('0x5c')](_0x5eeeae[_0xd6e8('0x57')],_0x5eeeae[_0xd6e8('0x46')]);_0x22783f['attributes']=_[_0xd6e8('0x5c')](_0x5eeeae['model'],qs['fields'](_0x409805[_0xd6e8('0x46')][_0xd6e8('0x5d')]));_0x22783f['attributes']=_0x22783f[_0xd6e8('0x4a')][_0xd6e8('0x5e')]?_0x22783f[_0xd6e8('0x4a')]:_0x5eeeae[_0xd6e8('0x57')];if(!_0x409805[_0xd6e8('0x46')][_0xd6e8('0xd8')](_0xd6e8('0xdd'))){_0x22783f[_0xd6e8('0x26')]=qs['limit'](_0x409805[_0xd6e8('0x46')][_0xd6e8('0x26')]);_0x22783f[_0xd6e8('0x24')]=qs[_0xd6e8('0x24')](_0x409805[_0xd6e8('0x46')][_0xd6e8('0x24')]);}_0x22783f[_0xd6e8('0xd5')]=qs['sort'](_0x409805[_0xd6e8('0x46')][_0xd6e8('0xd6')]);_0x22783f['where']=qs[_0xd6e8('0x5b')](_[_0xd6e8('0xd7')](_0x409805[_0xd6e8('0x46')],_0x5eeeae['filters']));_0x22783f['where'][_0xd6e8('0xe4')]=_0x2002fe['id'];if(_0x409805[_0xd6e8('0x46')][_0xd6e8('0x32')]){_0x22783f[_0xd6e8('0x45')]=_[_0xd6e8('0x61')](_0x22783f[_0xd6e8('0x45')],{'$or':_[_0xd6e8('0x34')](_0x22783f[_0xd6e8('0x4a')],function(_0x4d9942){var _0x142b5c={};_0x142b5c[_0x4d9942]={'$like':'%'+_0x409805[_0xd6e8('0x46')]['filter']+'%'};return _0x142b5c;})});}_0x22783f=_[_0xd6e8('0x61')]({},_0x22783f,_0x409805[_0xd6e8('0x62')]);return db['VoiceRecording'][_0xd6e8('0x27')]({'where':_0x22783f['where']})[_0xd6e8('0x17')](function(_0x5ba48e){_0x2539d5[_0xd6e8('0x27')]=_0x5ba48e;if(_0x409805[_0xd6e8('0x46')][_0xd6e8('0x47')]){_0x22783f['include']=[{'all':!![]}];}return db[_0xd6e8('0xe3')][_0xd6e8('0x95')](_0x22783f);})[_0xd6e8('0x17')](function(_0xcfeba1){_0x2539d5[_0xd6e8('0x4b')]=_0xcfeba1;return _0x2539d5;});}})[_0xd6e8('0x17')](respondWithFilteredResult(_0x264006,_0x22783f))['catch'](handleError(_0x264006,null));};exports[_0xd6e8('0xe5')]=function(_0x3b93c2,_0x5d7d43){var _0x1345a9={'raw':!![],'where':{}};var _0xd1e678={};var _0x372c12={'count':0x0,'rows':[]};return db['User']['findOne']({'where':{'id':_0x3b93c2[_0xd6e8('0x56')]['id']}})['then'](handleEntityNotFound(_0x5d7d43,null))[_0xd6e8('0x17')](function(_0x2c0d7b){if(_0x2c0d7b){_0xd1e678[_0xd6e8('0x57')]=_[_0xd6e8('0x59')](db['ScreenRecording']['rawAttributes']);_0xd1e678['query']=_['keys'](_0x3b93c2[_0xd6e8('0x46')]);_0xd1e678[_0xd6e8('0x5b')]=_[_0xd6e8('0x5c')](_0xd1e678[_0xd6e8('0x57')],_0xd1e678[_0xd6e8('0x46')]);_0x1345a9[_0xd6e8('0x4a')]=_[_0xd6e8('0x5c')](_0xd1e678[_0xd6e8('0x57')],qs[_0xd6e8('0x5d')](_0x3b93c2[_0xd6e8('0x46')][_0xd6e8('0x5d')]));_0x1345a9[_0xd6e8('0x4a')]=_0x1345a9['attributes'][_0xd6e8('0x5e')]?_0x1345a9[_0xd6e8('0x4a')]:_0xd1e678[_0xd6e8('0x57')];if(!_0x3b93c2[_0xd6e8('0x46')][_0xd6e8('0xd8')]('nolimit')){_0x1345a9['limit']=qs[_0xd6e8('0x26')](_0x3b93c2[_0xd6e8('0x46')][_0xd6e8('0x26')]);_0x1345a9[_0xd6e8('0x24')]=qs[_0xd6e8('0x24')](_0x3b93c2['query']['offset']);}_0x1345a9['order']=qs[_0xd6e8('0xd6')](_0x3b93c2['query'][_0xd6e8('0xd6')]);_0x1345a9[_0xd6e8('0x45')]=qs[_0xd6e8('0x5b')](_[_0xd6e8('0xd7')](_0x3b93c2['query'],_0xd1e678[_0xd6e8('0x5b')]));_0x1345a9[_0xd6e8('0x45')][_0xd6e8('0xe4')]=_0x2c0d7b['id'];if(_0x3b93c2['query'][_0xd6e8('0x32')]){_0x1345a9[_0xd6e8('0x45')]=_[_0xd6e8('0x61')](_0x1345a9['where'],{'$or':_['map'](_0x1345a9[_0xd6e8('0x4a')],function(_0x1c8b6e){var _0x3e2ff6={};_0x3e2ff6[_0x1c8b6e]={'$like':'%'+_0x3b93c2['query'][_0xd6e8('0x32')]+'%'};return _0x3e2ff6;})});}_0x1345a9=_[_0xd6e8('0x61')]({},_0x1345a9,_0x3b93c2[_0xd6e8('0x62')]);return db['ScreenRecording'][_0xd6e8('0x27')]({'where':_0x1345a9[_0xd6e8('0x45')]})['then'](function(_0x5dbd2f){_0x372c12[_0xd6e8('0x27')]=_0x5dbd2f;if(_0x3b93c2['query'][_0xd6e8('0x47')]){_0x1345a9[_0xd6e8('0x5f')]=[{'all':!![]}];}return db[_0xd6e8('0xe6')][_0xd6e8('0x95')](_0x1345a9);})[_0xd6e8('0x17')](function(_0x3b24a9){_0x372c12[_0xd6e8('0x4b')]=_0x3b24a9;return _0x372c12;});}})[_0xd6e8('0x17')](respondWithFilteredResult(_0x5d7d43,_0x1345a9))[_0xd6e8('0x64')](handleError(_0x5d7d43,null));};exports[_0xd6e8('0xe7')]=function(_0x20ba30,_0x4adb9f){var _0x24a527={};var _0x11838b={};var _0x4fc078;var _0x456ac4;return db[_0xd6e8('0x3d')][_0xd6e8('0xa2')]({'where':{'id':_0x20ba30['params']['id']}})['then'](handleEntityNotFound(_0x4adb9f,null))[_0xd6e8('0x17')](function(_0x1dd42f){if(_0x1dd42f){_0x4fc078=_0x1dd42f;_0x11838b[_0xd6e8('0x57')]=_[_0xd6e8('0x59')](db['ChatInteraction']['rawAttributes']);_0x11838b[_0xd6e8('0x46')]=_[_0xd6e8('0x59')](_0x20ba30['query']);_0x11838b[_0xd6e8('0x5b')]=_[_0xd6e8('0x5c')](_0x11838b[_0xd6e8('0x57')],_0x11838b[_0xd6e8('0x46')]);_0x24a527[_0xd6e8('0x4a')]=_[_0xd6e8('0x5c')](_0x11838b[_0xd6e8('0x57')],qs['fields'](_0x20ba30[_0xd6e8('0x46')][_0xd6e8('0x5d')]));_0x24a527['attributes']=_0x24a527['attributes'][_0xd6e8('0x5e')]?_0x24a527[_0xd6e8('0x4a')]:_0x11838b[_0xd6e8('0x57')];_0x24a527[_0xd6e8('0xd5')]=qs['sort'](_0x20ba30[_0xd6e8('0x46')]['sort']);_0x24a527[_0xd6e8('0x45')]=qs[_0xd6e8('0x5b')](_[_0xd6e8('0xd7')](_0x20ba30[_0xd6e8('0x46')],_0x11838b[_0xd6e8('0x5b')]));if(_0x20ba30[_0xd6e8('0x46')]['filter']){_0x24a527['where']=_[_0xd6e8('0x61')](_0x24a527[_0xd6e8('0x45')],{'$or':_[_0xd6e8('0x34')](_0x24a527[_0xd6e8('0x4a')],function(_0x501e47){var _0x1692e7={};_0x1692e7[_0x501e47]={'$like':'%'+_0x20ba30[_0xd6e8('0x46')][_0xd6e8('0x32')]+'%'};return _0x1692e7;})});}_0x24a527=_[_0xd6e8('0x61')]({},_0x24a527,_0x20ba30[_0xd6e8('0x62')]);return _0x4fc078['getChatInteractions'](_0x24a527);}})[_0xd6e8('0x17')](function(_0x3910fb){if(_0x3910fb){_0x456ac4=_0x3910fb[_0xd6e8('0x5e')];if(!_0x20ba30[_0xd6e8('0x46')][_0xd6e8('0xd8')](_0xd6e8('0xdd'))){_0x24a527[_0xd6e8('0x26')]=qs[_0xd6e8('0x26')](_0x20ba30[_0xd6e8('0x46')]['limit']);_0x24a527[_0xd6e8('0x24')]=qs[_0xd6e8('0x24')](_0x20ba30[_0xd6e8('0x46')][_0xd6e8('0x24')]);}return _0x4fc078[_0xd6e8('0xe7')](_0x24a527);}})['then'](function(_0x2fddd5){if(_0x2fddd5){return _0x2fddd5?{'count':_0x456ac4,'rows':_0x2fddd5}:null;}})[_0xd6e8('0x17')](respondWithResult(_0x4adb9f,null))[_0xd6e8('0x64')](handleError(_0x4adb9f,null));};exports[_0xd6e8('0xe8')]=function(_0x16ce47,_0x138aa2){var _0x545969={};var _0xc109f2={};var _0xcf2cb2;var _0x23b1f4;return db[_0xd6e8('0x3d')]['findOne']({'where':{'id':_0x16ce47[_0xd6e8('0x56')]['id']}})[_0xd6e8('0x17')](handleEntityNotFound(_0x138aa2,null))[_0xd6e8('0x17')](function(_0x166b7e){if(_0x166b7e){_0xcf2cb2=_0x166b7e;_0xc109f2[_0xd6e8('0x57')]=_[_0xd6e8('0x59')](db['OpenchannelInteraction']['rawAttributes']);_0xc109f2[_0xd6e8('0x46')]=_['keys'](_0x16ce47['query']);_0xc109f2[_0xd6e8('0x5b')]=_[_0xd6e8('0x5c')](_0xc109f2[_0xd6e8('0x57')],_0xc109f2['query']);_0x545969['attributes']=_[_0xd6e8('0x5c')](_0xc109f2[_0xd6e8('0x57')],qs['fields'](_0x16ce47[_0xd6e8('0x46')][_0xd6e8('0x5d')]));_0x545969[_0xd6e8('0x4a')]=_0x545969[_0xd6e8('0x4a')][_0xd6e8('0x5e')]?_0x545969[_0xd6e8('0x4a')]:_0xc109f2['model'];_0x545969[_0xd6e8('0xd5')]=qs[_0xd6e8('0xd6')](_0x16ce47[_0xd6e8('0x46')][_0xd6e8('0xd6')]);_0x545969['where']=qs[_0xd6e8('0x5b')](_[_0xd6e8('0xd7')](_0x16ce47[_0xd6e8('0x46')],_0xc109f2[_0xd6e8('0x5b')]));if(_0x16ce47[_0xd6e8('0x46')][_0xd6e8('0x32')]){_0x545969[_0xd6e8('0x45')]=_[_0xd6e8('0x61')](_0x545969[_0xd6e8('0x45')],{'$or':_['map'](_0x545969[_0xd6e8('0x4a')],function(_0x3bd67d){var _0x1da17c={};_0x1da17c[_0x3bd67d]={'$like':'%'+_0x16ce47[_0xd6e8('0x46')][_0xd6e8('0x32')]+'%'};return _0x1da17c;})});}_0x545969=_[_0xd6e8('0x61')]({},_0x545969,_0x16ce47[_0xd6e8('0x62')]);return _0xcf2cb2[_0xd6e8('0xe8')](_0x545969);}})[_0xd6e8('0x17')](function(_0x12ec18){if(_0x12ec18){_0x23b1f4=_0x12ec18[_0xd6e8('0x5e')];if(!_0x16ce47[_0xd6e8('0x46')][_0xd6e8('0xd8')]('nolimit')){_0x545969[_0xd6e8('0x26')]=qs[_0xd6e8('0x26')](_0x16ce47[_0xd6e8('0x46')]['limit']);_0x545969[_0xd6e8('0x24')]=qs[_0xd6e8('0x24')](_0x16ce47[_0xd6e8('0x46')][_0xd6e8('0x24')]);}return _0xcf2cb2[_0xd6e8('0xe8')](_0x545969);}})[_0xd6e8('0x17')](function(_0x1bc300){if(_0x1bc300){return _0x1bc300?{'count':_0x23b1f4,'rows':_0x1bc300}:null;}})['then'](respondWithResult(_0x138aa2,null))[_0xd6e8('0x64')](handleError(_0x138aa2,null));};exports['getMailInteractions']=function(_0x527c60,_0x5a20c1){var _0x7bd909={'raw':!![],'where':{}};var _0x3060e0={};var _0x5a0633={'count':0x0,'rows':[]};return db[_0xd6e8('0x3d')][_0xd6e8('0xa2')]({'where':{'id':_0x527c60[_0xd6e8('0x56')]['id']}})[_0xd6e8('0x17')](handleEntityNotFound(_0x5a20c1,null))[_0xd6e8('0x17')](function(_0x1dba23){if(_0x1dba23){_0x3060e0['model']=_[_0xd6e8('0x59')](db[_0xd6e8('0xe9')][_0xd6e8('0x3e')]);_0x3060e0['query']=_['keys'](_0x527c60['query']);_0x3060e0[_0xd6e8('0x5b')]=_[_0xd6e8('0x5c')](_0x3060e0[_0xd6e8('0x57')],_0x3060e0['query']);_0x7bd909[_0xd6e8('0x4a')]=_[_0xd6e8('0x5c')](_0x3060e0['model'],qs[_0xd6e8('0x5d')](_0x527c60['query']['fields']));_0x7bd909[_0xd6e8('0x4a')]=_0x7bd909[_0xd6e8('0x4a')][_0xd6e8('0x5e')]?_0x7bd909[_0xd6e8('0x4a')]:_0x3060e0[_0xd6e8('0x57')];if(!_0x527c60[_0xd6e8('0x46')][_0xd6e8('0xd8')](_0xd6e8('0xdd'))){_0x7bd909[_0xd6e8('0x26')]=qs[_0xd6e8('0x26')](_0x527c60[_0xd6e8('0x46')][_0xd6e8('0x26')]);_0x7bd909['offset']=qs['offset'](_0x527c60[_0xd6e8('0x46')]['offset']);}_0x7bd909['order']=qs[_0xd6e8('0xd6')](_0x527c60[_0xd6e8('0x46')][_0xd6e8('0xd6')]);_0x7bd909[_0xd6e8('0x45')]=qs[_0xd6e8('0x5b')](_[_0xd6e8('0xd7')](_0x527c60[_0xd6e8('0x46')],_0x3060e0[_0xd6e8('0x5b')]));_0x7bd909[_0xd6e8('0x45')][_0xd6e8('0xe4')]=_0x1dba23['id'];if(_0x527c60[_0xd6e8('0x46')][_0xd6e8('0x32')]){_0x7bd909[_0xd6e8('0x45')]=_['merge'](_0x7bd909['where'],{'$or':_[_0xd6e8('0x34')](_0x7bd909[_0xd6e8('0x4a')],function(_0x521e01){var _0x4e1ce5={};_0x4e1ce5[_0x521e01]={'$like':'%'+_0x527c60['query'][_0xd6e8('0x32')]+'%'};return _0x4e1ce5;})});}_0x7bd909=_[_0xd6e8('0x61')]({},_0x7bd909,_0x527c60[_0xd6e8('0x62')]);return db[_0xd6e8('0xe9')][_0xd6e8('0x27')]({'where':_0x7bd909[_0xd6e8('0x45')]})[_0xd6e8('0x17')](function(_0x2affcc){_0x5a0633['count']=_0x2affcc;if(_0x527c60[_0xd6e8('0x46')][_0xd6e8('0x47')]){_0x7bd909[_0xd6e8('0x5f')]=[{'all':!![]}];}return db[_0xd6e8('0xe9')]['findAll'](_0x7bd909);})[_0xd6e8('0x17')](function(_0x2057ff){_0x5a0633['rows']=_0x2057ff;return _0x5a0633;});}})[_0xd6e8('0x17')](respondWithFilteredResult(_0x5a20c1,_0x7bd909))[_0xd6e8('0x64')](handleError(_0x5a20c1,null));};exports['getSmsInteractions']=function(_0x560a69,_0x56c562){var _0x4954c7={};var _0x16b672={};var _0x167203;var _0x16d570;return db['User'][_0xd6e8('0xa2')]({'where':{'id':_0x560a69['params']['id']}})['then'](handleEntityNotFound(_0x56c562,null))['then'](function(_0x26f68e){if(_0x26f68e){_0x167203=_0x26f68e;_0x16b672[_0xd6e8('0x57')]=_[_0xd6e8('0x59')](db[_0xd6e8('0xea')][_0xd6e8('0x3e')]);_0x16b672['query']=_[_0xd6e8('0x59')](_0x560a69[_0xd6e8('0x46')]);_0x16b672['filters']=_[_0xd6e8('0x5c')](_0x16b672['model'],_0x16b672[_0xd6e8('0x46')]);_0x4954c7['attributes']=_[_0xd6e8('0x5c')](_0x16b672['model'],qs[_0xd6e8('0x5d')](_0x560a69[_0xd6e8('0x46')][_0xd6e8('0x5d')]));_0x4954c7[_0xd6e8('0x4a')]=_0x4954c7[_0xd6e8('0x4a')][_0xd6e8('0x5e')]?_0x4954c7['attributes']:_0x16b672[_0xd6e8('0x57')];_0x4954c7[_0xd6e8('0xd5')]=qs['sort'](_0x560a69[_0xd6e8('0x46')][_0xd6e8('0xd6')]);_0x4954c7['where']=qs[_0xd6e8('0x5b')](_[_0xd6e8('0xd7')](_0x560a69['query'],_0x16b672[_0xd6e8('0x5b')]));if(_0x560a69[_0xd6e8('0x46')]['filter']){_0x4954c7[_0xd6e8('0x45')]=_['merge'](_0x4954c7[_0xd6e8('0x45')],{'$or':_[_0xd6e8('0x34')](_0x4954c7[_0xd6e8('0x4a')],function(_0xf0bb8d){var _0x3b8cb4={};_0x3b8cb4[_0xf0bb8d]={'$like':'%'+_0x560a69[_0xd6e8('0x46')][_0xd6e8('0x32')]+'%'};return _0x3b8cb4;})});}_0x4954c7=_[_0xd6e8('0x61')]({},_0x4954c7,_0x560a69['options']);return _0x167203['getSmsInteractions'](_0x4954c7);}})[_0xd6e8('0x17')](function(_0x41624a){if(_0x41624a){_0x16d570=_0x41624a[_0xd6e8('0x5e')];if(!_0x560a69[_0xd6e8('0x46')][_0xd6e8('0xd8')](_0xd6e8('0xdd'))){_0x4954c7[_0xd6e8('0x26')]=qs[_0xd6e8('0x26')](_0x560a69[_0xd6e8('0x46')][_0xd6e8('0x26')]);_0x4954c7[_0xd6e8('0x24')]=qs['offset'](_0x560a69[_0xd6e8('0x46')]['offset']);}return _0x167203['getSmsInteractions'](_0x4954c7);}})[_0xd6e8('0x17')](function(_0x4c1b1d){if(_0x4c1b1d){return _0x4c1b1d?{'count':_0x16d570,'rows':_0x4c1b1d}:null;}})[_0xd6e8('0x17')](respondWithResult(_0x56c562,null))[_0xd6e8('0x64')](handleError(_0x56c562,null));};exports[_0xd6e8('0xeb')]=function(_0x4b3107,_0x2f66d5){var _0x1446dc={};var _0x4dc114={};var _0x51e989;var _0x5bf7b0;return db['User'][_0xd6e8('0xa2')]({'where':{'id':_0x4b3107[_0xd6e8('0x56')]['id']}})['then'](handleEntityNotFound(_0x2f66d5,null))[_0xd6e8('0x17')](function(_0x1aeb3a){if(_0x1aeb3a){_0x51e989=_0x1aeb3a;_0x4dc114[_0xd6e8('0x57')]=_[_0xd6e8('0x59')](db['FaxInteraction'][_0xd6e8('0x3e')]);_0x4dc114['query']=_['keys'](_0x4b3107['query']);_0x4dc114[_0xd6e8('0x5b')]=_[_0xd6e8('0x5c')](_0x4dc114[_0xd6e8('0x57')],_0x4dc114[_0xd6e8('0x46')]);_0x1446dc[_0xd6e8('0x4a')]=_[_0xd6e8('0x5c')](_0x4dc114[_0xd6e8('0x57')],qs[_0xd6e8('0x5d')](_0x4b3107[_0xd6e8('0x46')][_0xd6e8('0x5d')]));_0x1446dc['attributes']=_0x1446dc['attributes'][_0xd6e8('0x5e')]?_0x1446dc[_0xd6e8('0x4a')]:_0x4dc114[_0xd6e8('0x57')];_0x1446dc['order']=qs[_0xd6e8('0xd6')](_0x4b3107['query'][_0xd6e8('0xd6')]);_0x1446dc['where']=qs['filters'](_[_0xd6e8('0xd7')](_0x4b3107[_0xd6e8('0x46')],_0x4dc114[_0xd6e8('0x5b')]));if(_0x4b3107[_0xd6e8('0x46')][_0xd6e8('0x32')]){_0x1446dc[_0xd6e8('0x45')]=_[_0xd6e8('0x61')](_0x1446dc[_0xd6e8('0x45')],{'$or':_['map'](_0x1446dc[_0xd6e8('0x4a')],function(_0x586601){var _0x48d095={};_0x48d095[_0x586601]={'$like':'%'+_0x4b3107['query'][_0xd6e8('0x32')]+'%'};return _0x48d095;})});}_0x1446dc=_[_0xd6e8('0x61')]({},_0x1446dc,_0x4b3107[_0xd6e8('0x62')]);return _0x51e989[_0xd6e8('0xeb')](_0x1446dc);}})[_0xd6e8('0x17')](function(_0x5293e0){if(_0x5293e0){_0x5bf7b0=_0x5293e0[_0xd6e8('0x5e')];if(!_0x4b3107['query'][_0xd6e8('0xd8')]('nolimit')){_0x1446dc[_0xd6e8('0x26')]=qs['limit'](_0x4b3107[_0xd6e8('0x46')][_0xd6e8('0x26')]);_0x1446dc[_0xd6e8('0x24')]=qs[_0xd6e8('0x24')](_0x4b3107[_0xd6e8('0x46')]['offset']);}return _0x51e989[_0xd6e8('0xeb')](_0x1446dc);}})[_0xd6e8('0x17')](function(_0x1703d7){if(_0x1703d7){return _0x1703d7?{'count':_0x5bf7b0,'rows':_0x1703d7}:null;}})[_0xd6e8('0x17')](respondWithResult(_0x2f66d5,null))['catch'](handleError(_0x2f66d5,null));};exports['getWhatsappInteractions']=function(_0x2e3612,_0x5ad7a6){var _0x21a196={};var _0x5ae873={};var _0x5dfc8d;var _0x1bc94b;return db[_0xd6e8('0x3d')][_0xd6e8('0xa2')]({'where':{'id':_0x2e3612['params']['id']}})[_0xd6e8('0x17')](handleEntityNotFound(_0x5ad7a6,null))['then'](function(_0x3b7619){if(_0x3b7619){_0x5dfc8d=_0x3b7619;_0x5ae873[_0xd6e8('0x57')]=_[_0xd6e8('0x59')](db[_0xd6e8('0xec')]['rawAttributes']);_0x5ae873['query']=_[_0xd6e8('0x59')](_0x2e3612[_0xd6e8('0x46')]);_0x5ae873[_0xd6e8('0x5b')]=_[_0xd6e8('0x5c')](_0x5ae873[_0xd6e8('0x57')],_0x5ae873['query']);_0x21a196[_0xd6e8('0x4a')]=_['intersection'](_0x5ae873[_0xd6e8('0x57')],qs[_0xd6e8('0x5d')](_0x2e3612[_0xd6e8('0x46')]['fields']));_0x21a196[_0xd6e8('0x4a')]=_0x21a196[_0xd6e8('0x4a')][_0xd6e8('0x5e')]?_0x21a196[_0xd6e8('0x4a')]:_0x5ae873[_0xd6e8('0x57')];_0x21a196[_0xd6e8('0xd5')]=qs[_0xd6e8('0xd6')](_0x2e3612[_0xd6e8('0x46')][_0xd6e8('0xd6')]);_0x21a196[_0xd6e8('0x45')]=qs[_0xd6e8('0x5b')](_['pick'](_0x2e3612['query'],_0x5ae873[_0xd6e8('0x5b')]));if(_0x2e3612[_0xd6e8('0x46')][_0xd6e8('0x32')]){_0x21a196[_0xd6e8('0x45')]=_[_0xd6e8('0x61')](_0x21a196['where'],{'$or':_[_0xd6e8('0x34')](_0x21a196[_0xd6e8('0x4a')],function(_0x3ffead){var _0x3aa349={};_0x3aa349[_0x3ffead]={'$like':'%'+_0x2e3612[_0xd6e8('0x46')]['filter']+'%'};return _0x3aa349;})});}_0x21a196=_[_0xd6e8('0x61')]({},_0x21a196,_0x2e3612[_0xd6e8('0x62')]);return _0x5dfc8d[_0xd6e8('0xed')](_0x21a196);}})[_0xd6e8('0x17')](function(_0x1f956a){if(_0x1f956a){_0x1bc94b=_0x1f956a[_0xd6e8('0x5e')];if(!_0x2e3612[_0xd6e8('0x46')]['hasOwnProperty']('nolimit')){_0x21a196['limit']=qs['limit'](_0x2e3612[_0xd6e8('0x46')][_0xd6e8('0x26')]);_0x21a196[_0xd6e8('0x24')]=qs[_0xd6e8('0x24')](_0x2e3612['query'][_0xd6e8('0x24')]);}return _0x5dfc8d[_0xd6e8('0xed')](_0x21a196);}})[_0xd6e8('0x17')](function(_0x306aa3){if(_0x306aa3){return _0x306aa3?{'count':_0x1bc94b,'rows':_0x306aa3}:null;}})['then'](respondWithResult(_0x5ad7a6,null))[_0xd6e8('0x64')](handleError(_0x5ad7a6,null));};exports['login']=function(_0x24474b,_0x3e9ae6,_0x3352b1){var _0x379148;var _0x5cc754;var _0x50793c;var _0x212d90=!_[_0xd6e8('0x70')](_0x24474b[_0xd6e8('0x56')]['id'])?_0x24474b[_0xd6e8('0x56')]['id']:!_[_0xd6e8('0x70')](_0x24474b[_0xd6e8('0x2d')]['id'])?_0x24474b[_0xd6e8('0x2d')]['id']:null;return db[_0xd6e8('0x3d')][_0xd6e8('0x37')]({'where':{'id':_0x212d90,'role':{'$or':[_0xd6e8('0x8a'),'user',_0xd6e8('0x2f')]}},'attributes':['id',_0xd6e8('0x38'),_0xd6e8('0xee'),_0xd6e8('0xef'),_0xd6e8('0x36'),_0xd6e8('0x6a'),_0xd6e8('0xa9')]})[_0xd6e8('0x17')](function(_0x4e0bf3){if(_0x4e0bf3){if(_0x4e0bf3[_0xd6e8('0x36')]===_0xd6e8('0x2f')){_0x379148=_0x4e0bf3;if(_0x24474b[_0xd6e8('0x65')][_0xd6e8('0xab')]){_0x50793c=util[_0xd6e8('0xb8')](_0xd6e8('0xf0'),_0x379148[_0x24474b['body'][_0xd6e8('0xab')]]);}else if(_0x24474b[_0xd6e8('0x65')][_0xd6e8('0xf1')]){_0x50793c=util[_0xd6e8('0xb8')](_0xd6e8('0xb9'),_0x24474b[_0xd6e8('0x65')][_0xd6e8('0xf1')]);}else{_0x50793c=util[_0xd6e8('0xb8')]('SIP/%s',_0x379148[_0xd6e8('0x38')]);}socket['to'](util['format']('user:%s',_0x379148[_0xd6e8('0x38')]))[_0xd6e8('0xb5')](_0xd6e8('0xf2'),{'user':{'id':_0x379148['id'],'name':_0x379148[_0xd6e8('0x38')]},'ip':_0x24474b[_0xd6e8('0xf3')][_0xd6e8('0xf4')]||_0x24474b[_0xd6e8('0xf5')][_0xd6e8('0xf6')]||_0x24474b['socket']['remoteAddress']||_0x24474b[_0xd6e8('0xf5')][_0xd6e8('0xf7')][_0xd6e8('0xf6')]});return db['UserVoiceQueueRt'][_0xd6e8('0x39')]({'where':{'membername':_0x379148[_0xd6e8('0x38')]},'individualHooks':!![]});}}else{throw new db[(_0xd6e8('0x9b'))][(_0xd6e8('0x9c'))](_0xd6e8('0xf8'));}})[_0xd6e8('0x17')](function(){if(_0x379148){return _0x379148[_0xd6e8('0xf9')]({'raw':!![]});}})['then'](function(_0xe7a880){if(_0x379148){var _0x5bf472=[];if(_0xe7a880){_0x5cc754=_0xe7a880;if(_0x5cc754[_0xd6e8('0x5e')]){for(var _0x29c3b8=0x0;_0x29c3b8<_0x5cc754[_0xd6e8('0x5e')];_0x29c3b8++){_0x5bf472[_0xd6e8('0x4f')]({'membername':_0x379148['name'],'UserId':_0x379148['id'],'queue_name':_0x5cc754[_0x29c3b8]['name'],'VoiceQueueId':_0x5cc754[_0x29c3b8]['id'],'interface':_0x50793c,'paused':_0x379148[_0xd6e8('0xa9')]||![],'penalty':_0x5cc754[_0x29c3b8][_0xd6e8('0xfa')]||0x0});}return BPromise[_0xd6e8('0x93')](_0x5bf472,function(_0x810d69){return db['UserVoiceQueueRt'][_0xd6e8('0xbb')](_0x810d69);});}}}})[_0xd6e8('0x17')](function(){if(_0x379148){return db['MemberReport'][_0xd6e8('0x95')]({'where':{'membername':_0x379148['name'],'exitAt':null}});}})[_0xd6e8('0x17')](function(_0x17e648){if(_0x379148){var _0x1189a0=[];_0x17e648[_0xd6e8('0xfb')](function(_0x424b2b){_0x1189a0[_0xd6e8('0x4f')](_0x424b2b[_0xd6e8('0x2a')]({'exitAt':moment()[_0xd6e8('0xb8')](_0xd6e8('0xfc'))}));});return BPromise[_0xd6e8('0x54')](_0x1189a0);}})[_0xd6e8('0x17')](function(){if(_0x379148){var _0x2f253d=[];var _0x64e27a=[];var _0x1ae741=utils[_0xd6e8('0xfd')]();var _0x5c5d70={'membername':_0x379148[_0xd6e8('0x38')],'interface':_0x50793c,'enterAt':moment()[_0xd6e8('0xb8')](_0xd6e8('0xfc')),'role':_0x379148[_0xd6e8('0x36')],'internal':_0x379148[_0xd6e8('0x6a')]};_0x1ae741['forEach'](function(_0x2b1c1b){_0x2f253d[_0xd6e8('0x4f')](_['merge']({'channel':_0x2b1c1b,'type':_0xd6e8('0xfe'),'data1':_0x24474b[_0xd6e8('0x65')]['device'],'data2':_0x50793c},_0x5c5d70));if(_0x379148['loginInPause']){_0x64e27a[_0xd6e8('0x4f')](_[_0xd6e8('0x61')]({'channel':_0x2b1c1b,'type':_0xd6e8('0xff'),'data1':'LOGININPAUSE'},_0x5c5d70));}});return db[_0xd6e8('0x100')]['bulkCreate'](_0x2f253d['concat'](_0x64e27a),{'individualHooks':!![]});}})[_0xd6e8('0x17')](function(){if(_0x379148){return _0x379148['update']({'online':!![],'lastLoginAt':moment()[_0xd6e8('0xb8')](_0xd6e8('0xfc')),'voicePause':_0x379148[_0xd6e8('0xa9')]||![],'mailPause':_0x379148['loginInPause']||![],'chatPause':_0x379148[_0xd6e8('0xa9')]||![],'faxPause':_0x379148[_0xd6e8('0xa9')]||![],'smsPause':_0x379148[_0xd6e8('0xa9')]||![],'openchannelPause':_0x379148[_0xd6e8('0xa9')]||![],'whatsappPause':_0x379148[_0xd6e8('0xa9')]||![],'pauseType':_0x379148[_0xd6e8('0xa9')]?_0xd6e8('0x101'):null,'interface':_0x50793c,'lastPauseAt':moment()[_0xd6e8('0xb8')](_0xd6e8('0xfc'))});}})['then'](function(_0x444bc1){if(_0x24474b['isMiddleware']){return _0x3352b1();}else{return BPromise[_0xd6e8('0x102')](_0x444bc1)['then'](respondWithResult(_0x3e9ae6,null));}})[_0xd6e8('0x64')](handleError(_0x3e9ae6,null));};exports[_0xd6e8('0x103')]=function(_0x22e4ed,_0x2def28){var _0x3b5fbc;return db['User'][_0xd6e8('0x37')]({'where':{'id':_0x22e4ed[_0xd6e8('0x56')]['id'],'role':_0xd6e8('0x2f')},'attributes':['id',_0xd6e8('0x38'),_0xd6e8('0x36')]})[_0xd6e8('0x17')](handleEntityNotFound(_0x2def28,null))[_0xd6e8('0x17')](function(_0x111fd6){if(_0x111fd6){_0x3b5fbc=_0x111fd6;return db['UserVoiceQueueRt'][_0xd6e8('0x39')]({'where':{'membername':_0x3b5fbc['name']},'individualHooks':!![]});}})[_0xd6e8('0x17')](function(){return db[_0xd6e8('0x100')][_0xd6e8('0x95')]({'where':{'membername':_0x3b5fbc['name'],'exitAt':null}});})[_0xd6e8('0x17')](function(_0x547792){var _0x8b6787=[];_0x547792[_0xd6e8('0xfb')](function(_0x228306){_0x8b6787[_0xd6e8('0x4f')](_0x228306[_0xd6e8('0x2a')]({'exitAt':moment()[_0xd6e8('0xb8')](_0xd6e8('0xfc'))}));});return BPromise[_0xd6e8('0x54')](_0x8b6787);})[_0xd6e8('0x17')](function(){return _0x3b5fbc[_0xd6e8('0x2a')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})[_0xd6e8('0x17')](respondWithResult(_0x2def28,null))[_0xd6e8('0x64')](handleError(_0x2def28,null));};exports[_0xd6e8('0x104')]=function(_0x5daafd,_0x1f29a9){var _0x5522fd;return db[_0xd6e8('0xba')][_0xd6e8('0x2a')]({'paused':0x1},{'where':{'UserId':_0x5daafd['params']['id']},'individualHooks':!![]})[_0xd6e8('0x17')](function(){return db[_0xd6e8('0x3d')][_0xd6e8('0x37')]({'where':{'id':_0x5daafd[_0xd6e8('0x56')]['id'],'role':_0xd6e8('0x2f')},'attributes':['id','name',_0xd6e8('0x36'),'internal',_0xd6e8('0xab')]});})[_0xd6e8('0x17')](handleEntityNotFound(_0x1f29a9,null))[_0xd6e8('0x17')](function(_0x1cc486){if(_0x1cc486){_0x5522fd=_0x1cc486;return respondWithRpcPromise(_0xd6e8('0x105'),'pause',{'id':_0x5522fd['id'],'name':_0x5522fd[_0xd6e8('0x38')],'pause':!![]});}})[_0xd6e8('0x17')](function(){if(_0x5522fd){return db['MemberReport'][_0xd6e8('0x95')]({'where':{'membername':_0x5522fd[_0xd6e8('0x38')],'type':_0xd6e8('0xff'),'exitAt':null}});}})[_0xd6e8('0x17')](function(_0x1129b9){if(_0x1129b9[_0xd6e8('0x5e')]){var _0x5c5c6a=moment()[_0xd6e8('0xb8')](_0xd6e8('0xfc'));for(var _0x2232d0=0x0,_0x30fb85=_0x1129b9[_0xd6e8('0x5e')];_0x2232d0<_0x30fb85;_0x2232d0++){_0x1129b9[_0x2232d0][_0xd6e8('0x106')]({'exitAt':_0x5c5c6a});}}})['then'](function(){var _0x5b0056=[];var _0x175793=utils[_0xd6e8('0xfd')]();_0x175793[_0xd6e8('0xfb')](function(_0x34e020){_0x5b0056[_0xd6e8('0x4f')]({'channel':_0x34e020,'membername':_0x5522fd[_0xd6e8('0x38')],'interface':_[_0xd6e8('0x70')](_0x5522fd[_0xd6e8('0xab')])?util['format'](_0xd6e8('0xb9'),_0x5522fd[_0xd6e8('0x38')]):_0x5522fd[_0xd6e8('0xab')],'type':_0xd6e8('0xff'),'enterAt':moment()['format'](_0xd6e8('0xfc')),'data1':_0x5daafd[_0xd6e8('0x65')]['type']||'DEFAULT\x20PAUSE','role':_0x5522fd['role'],'internal':_0x5522fd[_0xd6e8('0x6a')]});});return db['MemberReport'][_0xd6e8('0x91')](_0x5b0056,{'individualHooks':!![]});})[_0xd6e8('0x17')](function(){return _0x5522fd[_0xd6e8('0x2a')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x5daafd[_0xd6e8('0x65')]['type']||'DEFAULT\x20PAUSE','lastPauseAt':moment()['format'](_0xd6e8('0xfc'))});})[_0xd6e8('0x17')](respondWithResult(_0x1f29a9,null))[_0xd6e8('0x64')](handleError(_0x1f29a9,null));};exports['unpause']=function(_0x36f7c2,_0x3cd6b5){var _0x30d3be;return db[_0xd6e8('0x3d')][_0xd6e8('0x37')]({'where':{'id':_0x36f7c2[_0xd6e8('0x56')]['id']},'attributes':['id',_0xd6e8('0x38'),_0xd6e8('0x36'),'voicePause',_0xd6e8('0x107'),_0xd6e8('0x108'),_0xd6e8('0x109'),_0xd6e8('0x10a'),_0xd6e8('0x10b'),_0xd6e8('0x10c'),_0xd6e8('0x10d'),_0xd6e8('0x10e')]})[_0xd6e8('0x17')](handleEntityNotFound(_0x3cd6b5,null))['then'](function(_0x48e47e){if(_0x48e47e){_0x30d3be=_0x48e47e;if(_0x36f7c2[_0xd6e8('0x65')]['channel']&&!utils[_0xd6e8('0xac')](_0x36f7c2[_0xd6e8('0x65')][_0xd6e8('0xa7')])){throw new db[(_0xd6e8('0x9b'))]['ValidationError'](_0xd6e8('0xad'));}switch(_0x36f7c2[_0xd6e8('0x65')]['channel']){case _0xd6e8('0xb7'):return respondWithRpcPromise(_0xd6e8('0x105'),_0xd6e8('0x10f'),{'id':_0x30d3be['id'],'name':_0x30d3be['name'],'pause':![]})[_0xd6e8('0x17')](function(){return db['UserVoiceQueueRt']['update']({'paused':0x0},{'where':{'UserId':_0x30d3be['id']},'individualHooks':!![]});})[_0xd6e8('0x17')](function(){return db[_0xd6e8('0x100')]['find']({'where':{'channel':_0x36f7c2['body'][_0xd6e8('0xa7')],'membername':_0x30d3be['name'],'type':_0xd6e8('0xff'),'exitAt':null}});})[_0xd6e8('0x17')](function(_0x387dca){if(_0x387dca){return _0x387dca[_0xd6e8('0x2a')]({'exitAt':moment()[_0xd6e8('0xb8')](_0xd6e8('0xfc')),'data2':'manual'},{'individualHooks':!![]});}return null;})[_0xd6e8('0x17')](function(){return _0x30d3be['update']({'voicePause':![]});});case _0xd6e8('0x51'):case _0xd6e8('0x4d'):case'fax':case'sms':case'whatsapp':case _0xd6e8('0x52'):return db[_0xd6e8('0x100')][_0xd6e8('0x37')]({'where':{'channel':_0x36f7c2[_0xd6e8('0x65')]['channel'],'membername':_0x30d3be['name'],'type':_0xd6e8('0xff'),'exitAt':null}})[_0xd6e8('0x17')](function(_0x1860af){if(_0x1860af){return _0x1860af['update']({'exitAt':moment()['format'](_0xd6e8('0xfc')),'data2':_0xd6e8('0x110')},{'individualHooks':!![]});}return null;})[_0xd6e8('0x17')](function(){var _0x34fe0b={};_[_0xd6e8('0x28')](_0x34fe0b,util[_0xd6e8('0xb8')](_0xd6e8('0x111'),_0x36f7c2[_0xd6e8('0x65')][_0xd6e8('0xa7')],'Pause'),![]);return _0x30d3be['update'](_0x34fe0b);});default:return respondWithRpcPromise(_0xd6e8('0x105'),_0xd6e8('0x10f'),{'id':_0x30d3be['id'],'name':_0x30d3be[_0xd6e8('0x38')],'pause':![]})[_0xd6e8('0x17')](function(){return db['UserVoiceQueueRt']['update']({'paused':0x0},{'where':{'UserId':_0x30d3be['id']}});})[_0xd6e8('0x17')](function(){return db[_0xd6e8('0x100')][_0xd6e8('0x95')]({'where':{'membername':_0x30d3be[_0xd6e8('0x38')],'type':'PAUSE','exitAt':null}});})[_0xd6e8('0x17')](function(_0x3b4110){var _0x2a0bd3=[];_0x3b4110[_0xd6e8('0xfb')](function(_0x1650b6){_0x2a0bd3[_0xd6e8('0x4f')](_0x1650b6[_0xd6e8('0x2a')]({'exitAt':moment()['format'](_0xd6e8('0xfc')),'data2':_0xd6e8('0x110')}));});return BPromise[_0xd6e8('0x54')](_0x2a0bd3);})[_0xd6e8('0x17')](function(){return _0x30d3be['update']({'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'whatsappPause':![],'openchannelPause':![]});});}}})['then'](respondWithResult(_0x3cd6b5,null))['catch'](handleError(_0x3cd6b5,null));};exports[_0xd6e8('0x112')]=function(_0x58962c,_0x5d220a){var _0x980070={};var _0x1747aa={};var _0xfa6046;var _0x34087a;return db[_0xd6e8('0x3d')][_0xd6e8('0xa2')]({'where':{'id':_0x58962c['params']['id']}})[_0xd6e8('0x17')](handleEntityNotFound(_0x5d220a,null))['then'](function(_0x2b55e8){if(_0x2b55e8){_0xfa6046=_0x2b55e8;_0x1747aa[_0xd6e8('0x57')]=_[_0xd6e8('0x59')](db[_0xd6e8('0x113')][_0xd6e8('0x3e')]);_0x1747aa[_0xd6e8('0x46')]=_[_0xd6e8('0x59')](_0x58962c[_0xd6e8('0x46')]);_0x1747aa[_0xd6e8('0x5b')]=_[_0xd6e8('0x5c')](_0x1747aa[_0xd6e8('0x57')],_0x1747aa[_0xd6e8('0x46')]);_0x980070['attributes']=_[_0xd6e8('0x5c')](_0x1747aa[_0xd6e8('0x57')],qs[_0xd6e8('0x5d')](_0x58962c[_0xd6e8('0x46')][_0xd6e8('0x5d')]));_0x980070['attributes']=_0x980070[_0xd6e8('0x4a')][_0xd6e8('0x5e')]?_0x980070[_0xd6e8('0x4a')]:_0x1747aa[_0xd6e8('0x57')];_0x980070['order']=qs[_0xd6e8('0xd6')](_0x58962c[_0xd6e8('0x46')]['sort']);_0x980070[_0xd6e8('0x45')]=qs[_0xd6e8('0x5b')](_[_0xd6e8('0xd7')](_0x58962c[_0xd6e8('0x46')],_0x1747aa[_0xd6e8('0x5b')]));if(_0x58962c['query'][_0xd6e8('0x32')]){_0x980070[_0xd6e8('0x45')]=_[_0xd6e8('0x61')](_0x980070[_0xd6e8('0x45')],{'$or':_[_0xd6e8('0x34')](_0x980070[_0xd6e8('0x4a')],function(_0x5c96a6){var _0x5be1a5={};_0x5be1a5[_0x5c96a6]={'$like':'%'+_0x58962c['query'][_0xd6e8('0x32')]+'%'};return _0x5be1a5;})});}_0x980070=_[_0xd6e8('0x61')]({},_0x980070,_0x58962c[_0xd6e8('0x62')]);return _0xfa6046['getTeams'](_0x980070);}})[_0xd6e8('0x17')](function(_0xa7cc1f){if(_0xa7cc1f){_0x34087a=_0xa7cc1f[_0xd6e8('0x5e')];if(!_0x58962c['query'][_0xd6e8('0xd8')]('nolimit')){_0x980070[_0xd6e8('0x26')]=qs['limit'](_0x58962c[_0xd6e8('0x46')][_0xd6e8('0x26')]);_0x980070['offset']=qs['offset'](_0x58962c['query'][_0xd6e8('0x24')]);}return _0xfa6046['getTeams'](_0x980070);}})[_0xd6e8('0x17')](function(_0x5c2d52){if(_0x5c2d52){return _0x5c2d52?{'count':_0x34087a,'rows':_0x5c2d52}:null;}})[_0xd6e8('0x17')](respondWithResult(_0x5d220a,null))[_0xd6e8('0x64')](handleError(_0x5d220a,null));};exports[_0xd6e8('0x114')]=function(_0x21f01f,_0x20b923){return db[_0xd6e8('0x3d')][_0xd6e8('0x37')]({'where':{'id':_0x21f01f[_0xd6e8('0x56')]['id']}})[_0xd6e8('0x17')](handleEntityNotFound(_0x20b923,null))[_0xd6e8('0x17')](function(_0x18d6f7){if(_0x18d6f7){var _0x5ead2e=_0x18d6f7[_0xd6e8('0x2b')]({'plain':!![]});return _0x18d6f7[_0xd6e8('0x114')](_0x21f01f[_0xd6e8('0x65')][_0xd6e8('0x68')],_['omit'](_0x21f01f[_0xd6e8('0x65')],['ids','id'])||{})[_0xd6e8('0x17')](function(){for(var _0x1ce559=0x0;_0x1ce559<_0x21f01f[_0xd6e8('0x65')][_0xd6e8('0x68')]['length'];_0x1ce559++){var _0x1e07f7=[];var _0x1bc267={};db[_0xd6e8('0x113')][_0xd6e8('0xa2')]({'where':{'id':_0x21f01f[_0xd6e8('0x65')][_0xd6e8('0x68')][_0x1ce559]}})[_0xd6e8('0x17')](function(_0x42dec1){_0x1bc267=_0x42dec1[_0xd6e8('0x4e')];_0x1e07f7[_0xd6e8('0x4f')](_0x42dec1[_0xd6e8('0xf9')]()[_0xd6e8('0x17')](function(_0x22d6ff){for(var _0x352d4f=0x0;_0x352d4f<_0x22d6ff[_0xd6e8('0x5e')];_0x352d4f++){_0x22d6ff[_0x352d4f][_0xd6e8('0x115')]('channel',_0xd6e8('0x116'));}return _0x22d6ff;}));_0x1e07f7[_0xd6e8('0x4f')](_0x42dec1[_0xd6e8('0x117')]()['then'](function(_0x2c899d){for(var _0x5b36c5=0x0;_0x5b36c5<_0x2c899d[_0xd6e8('0x5e')];_0x5b36c5++){_0x2c899d[_0x5b36c5][_0xd6e8('0x115')]('channel','Chat');}return _0x2c899d;}));_0x1e07f7[_0xd6e8('0x4f')](_0x42dec1[_0xd6e8('0x118')]()[_0xd6e8('0x17')](function(_0x35880c){for(var _0x297c86=0x0;_0x297c86<_0x35880c['length'];_0x297c86++){_0x35880c[_0x297c86][_0xd6e8('0x115')](_0xd6e8('0xa7'),_0xd6e8('0x119'));}return _0x35880c;}));_0x1e07f7[_0xd6e8('0x4f')](_0x42dec1[_0xd6e8('0x11a')]()['then'](function(_0x54dd62){for(var _0x2565e7=0x0;_0x2565e7<_0x54dd62['length'];_0x2565e7++){_0x54dd62[_0x2565e7][_0xd6e8('0x115')]('channel',_0xd6e8('0x11b'));}return _0x54dd62;}));_0x1e07f7[_0xd6e8('0x4f')](_0x42dec1[_0xd6e8('0x11c')]()[_0xd6e8('0x17')](function(_0x53847b){for(var _0x26c5da=0x0;_0x26c5da<_0x53847b[_0xd6e8('0x5e')];_0x26c5da++){_0x53847b[_0x26c5da]['setDataValue'](_0xd6e8('0xa7'),'Whatsapp');}return _0x53847b;}));_0x1e07f7['push'](_0x42dec1[_0xd6e8('0x11d')]()[_0xd6e8('0x17')](function(_0x58e300){for(var _0x12074d=0x0;_0x12074d<_0x58e300[_0xd6e8('0x5e')];_0x12074d++){_0x58e300[_0x12074d]['setDataValue'](_0xd6e8('0xa7'),_0xd6e8('0x11e'));}return _0x58e300;}));_0x1e07f7['push'](_0x42dec1['getOpenchannelQueues']()[_0xd6e8('0x17')](function(_0x288517){for(var _0x1144b6=0x0;_0x1144b6<_0x288517[_0xd6e8('0x5e')];_0x1144b6++){_0x288517[_0x1144b6][_0xd6e8('0x115')](_0xd6e8('0xa7'),_0xd6e8('0x11f'));}return _0x288517;}));return BPromise['all'](_0x1e07f7);})[_0xd6e8('0x17')](function(_0x38718b){var _0x3c34c3=_[_0xd6e8('0x120')](_0x38718b);_0x1e07f7=[];return db[_0xd6e8('0x72')][_0xd6e8('0x121')](function(_0x25b2ca){for(var _0x4649b9=0x0;_0x4649b9<_0x3c34c3[_0xd6e8('0x5e')];_0x4649b9++){_0x1e07f7[_0xd6e8('0x4f')](_0x3c34c3[_0x4649b9][_0xd6e8('0x122')](_0x5ead2e['id']),{'transaction':_0x25b2ca});}return BPromise['all'](_0x1e07f7)[_0xd6e8('0x17')](function(){if(_0x5ead2e[_0xd6e8('0xa8')]){return BPromise[_0xd6e8('0x93')](_[_0xd6e8('0x32')](_0x3c34c3,function(_0x5dc729){return _0x5dc729['getDataValue'](_0xd6e8('0xa7'))===_0xd6e8('0x116');}),function(_0x4055c4){return db['UserVoiceQueueRt']['upsert']({'membername':_0x5ead2e[_0xd6e8('0x38')],'UserId':_0x5ead2e['id'],'queue_name':_0x4055c4[_0xd6e8('0x38')],'VoiceQueueId':_0x4055c4['id'],'interface':_['isNil'](_0x5ead2e[_0xd6e8('0xab')])?util[_0xd6e8('0xb8')]('SIP/%s',_0x5ead2e[_0xd6e8('0x38')]):_0x5ead2e[_0xd6e8('0xab')],'paused':_0x5ead2e[_0xd6e8('0xaa')]||![],'penalty':_0x5ead2e['penalty']},{'transaction':_0x25b2ca});});}else{return;}})[_0xd6e8('0x17')](function(){for(var _0x5975a0=0x0;_0x5975a0<_0x3c34c3['length'];_0x5975a0++){var _0xd6778a=_0x3c34c3[_0x5975a0][_0xd6e8('0x123')](_0xd6e8('0xa7'));var _0x28ce68=_0xd6778a+_0xd6e8('0xb4');socket['emit'](_0xd6e8('0x2d')+_0xd6778a+_0xd6e8('0xb6'),{'UserId':_0x5ead2e['id'],['queueField']:_0x3c34c3[_0x5975a0]['id']});}});});})[_0xd6e8('0x17')](function(){db[_0xd6e8('0x124')][_0xd6e8('0xa2')]({'where':{'teamId':_0x1bc267['id']}})['then'](function(_0x1f86af){if(_0x1f86af){db[_0xd6e8('0x125')][_0xd6e8('0x88')]({'UserId':_0x21f01f[_0xd6e8('0x56')]['id'],'VoicePrefixId':_0x1f86af[_0xd6e8('0x126')]});}});});}});}})[_0xd6e8('0x17')](respondWithStatusCode(_0x20b923,null))[_0xd6e8('0x64')](handleError(_0x20b923,null));};exports[_0xd6e8('0x127')]=function(_0x25d5d5,_0x27400e){return db[_0xd6e8('0x3d')]['findOne']({'where':{'id':_0x25d5d5[_0xd6e8('0x56')]['id']}})['then'](handleEntityNotFound(_0x27400e,null))[_0xd6e8('0x17')](function(_0x4d9ebf){if(_0x4d9ebf){var _0x14f974=_0x4d9ebf['get']({'plain':!![]});var _0x15f739=_0x25d5d5[_0xd6e8('0x46')]['ids'];return _0x4d9ebf['removeTeams'](_0x15f739)['then'](function(){for(var _0x650654=0x0;_0x650654<_0x15f739['length'];_0x650654++){var _0x19aa8f=[];var _0x39525f={};db[_0xd6e8('0x113')]['findOne']({'where':{'id':_0x15f739[_0x650654]}})[_0xd6e8('0x17')](function(_0x211833){_0x39525f=_0x211833[_0xd6e8('0x4e')];_0x19aa8f[_0xd6e8('0x4f')](_0x211833[_0xd6e8('0xf9')]()[_0xd6e8('0x17')](function(_0x225c0f){for(var _0x47fe8b=0x0;_0x47fe8b<_0x225c0f[_0xd6e8('0x5e')];_0x47fe8b++){_0x225c0f[_0x47fe8b]['setDataValue']('channel',_0xd6e8('0x116'));}return _0x225c0f;}));_0x19aa8f['push'](_0x211833[_0xd6e8('0x117')]()[_0xd6e8('0x17')](function(_0xf5c0ab){for(var _0x1001d8=0x0;_0x1001d8<_0xf5c0ab[_0xd6e8('0x5e')];_0x1001d8++){_0xf5c0ab[_0x1001d8][_0xd6e8('0x115')](_0xd6e8('0xa7'),_0xd6e8('0x128'));}return _0xf5c0ab;}));_0x19aa8f[_0xd6e8('0x4f')](_0x211833[_0xd6e8('0x118')]()['then'](function(_0x213e54){for(var _0x5ac4a9=0x0;_0x5ac4a9<_0x213e54[_0xd6e8('0x5e')];_0x5ac4a9++){_0x213e54[_0x5ac4a9][_0xd6e8('0x115')]('channel',_0xd6e8('0x119'));}return _0x213e54;}));_0x19aa8f['push'](_0x211833[_0xd6e8('0x11a')]()[_0xd6e8('0x17')](function(_0x98f115){for(var _0x4b2137=0x0;_0x4b2137<_0x98f115[_0xd6e8('0x5e')];_0x4b2137++){_0x98f115[_0x4b2137][_0xd6e8('0x115')](_0xd6e8('0xa7'),_0xd6e8('0x11b'));}return _0x98f115;}));_0x19aa8f[_0xd6e8('0x4f')](_0x211833['getWhatsappQueues']()[_0xd6e8('0x17')](function(_0x38af84){for(var _0xa9dd9a=0x0;_0xa9dd9a<_0x38af84[_0xd6e8('0x5e')];_0xa9dd9a++){_0x38af84[_0xa9dd9a][_0xd6e8('0x115')](_0xd6e8('0xa7'),_0xd6e8('0x129'));}return _0x38af84;}));_0x19aa8f[_0xd6e8('0x4f')](_0x211833['getFaxQueues']()[_0xd6e8('0x17')](function(_0x475d79){for(var _0x35c950=0x0;_0x35c950<_0x475d79[_0xd6e8('0x5e')];_0x35c950++){_0x475d79[_0x35c950][_0xd6e8('0x115')](_0xd6e8('0xa7'),_0xd6e8('0x11e'));}return _0x475d79;}));_0x19aa8f['push'](_0x211833['getOpenchannelQueues']()[_0xd6e8('0x17')](function(_0x136fbc){for(var _0x53d21a=0x0;_0x53d21a<_0x136fbc[_0xd6e8('0x5e')];_0x53d21a++){_0x136fbc[_0x53d21a][_0xd6e8('0x115')](_0xd6e8('0xa7'),_0xd6e8('0x11f'));}return _0x136fbc;}));return BPromise[_0xd6e8('0x54')](_0x19aa8f);})[_0xd6e8('0x17')](function(_0x246da9){var _0x9cb1fa=_[_0xd6e8('0x120')](_0x246da9);_0x19aa8f=[];return db[_0xd6e8('0x72')]['transaction'](function(_0x507005){for(var _0x2fb71e=0x0;_0x2fb71e<_0x9cb1fa[_0xd6e8('0x5e')];_0x2fb71e++){_0x19aa8f[_0xd6e8('0x4f')](_0x9cb1fa[_0x2fb71e][_0xd6e8('0x12a')](_0x14f974['id']),{'transaction':_0x507005});}return BPromise[_0xd6e8('0x54')](_0x19aa8f)[_0xd6e8('0x17')](function(){if(_0x14f974[_0xd6e8('0xa8')]){return BPromise[_0xd6e8('0x93')](_['filter'](_0x9cb1fa,function(_0x1dff02){return _0x1dff02[_0xd6e8('0x123')](_0xd6e8('0xa7'))==='Voice';}),function(_0x255411){return db[_0xd6e8('0xba')][_0xd6e8('0x39')]({'where':{'VoiceQueueId':_0x255411['id'],'UserId':_0x14f974['id']},'transaction':_0x507005});});}else{return;}})[_0xd6e8('0x17')](function(){db[_0xd6e8('0x124')]['findOne']({'where':{'teamId':_0x39525f['id']}})[_0xd6e8('0x17')](function(_0x1a782b){if(_0x1a782b){return db[_0xd6e8('0x125')][_0xd6e8('0x39')]({'where':{'UserId':_0x14f974['id'],'VoicePrefixId':_0x1a782b[_0xd6e8('0x4e')][_0xd6e8('0x126')]}});}});})[_0xd6e8('0x17')](function(){for(var _0xdc8865=0x0;_0xdc8865<_0x9cb1fa[_0xd6e8('0x5e')];_0xdc8865++){var _0x5dec8b=_0x9cb1fa[_0xdc8865][_0xd6e8('0x123')]('channel');var _0x42eaae=_0x5dec8b+_0xd6e8('0xb4');socket[_0xd6e8('0xb5')]('user'+_0x5dec8b+_0xd6e8('0xbf'),{'UserId':_0x14f974['id'],['queueField']:_0x9cb1fa[_0xdc8865]['id']});}});});});}});}})[_0xd6e8('0x17')](respondWithStatusCode(_0x27400e,null))[_0xd6e8('0x64')](handleError(_0x27400e,null));};exports[_0xd6e8('0x12b')]=function(_0x504a4c,_0xebb5fe){var _0x4ec18b={};var _0x4908fa={};var _0x292697;var _0x84824f;return db['User'][_0xd6e8('0xa2')]({'where':{'id':_0x504a4c[_0xd6e8('0x56')]['id']}})[_0xd6e8('0x17')](handleEntityNotFound(_0xebb5fe,null))[_0xd6e8('0x17')](function(_0x1ecfa3){if(_0x1ecfa3){_0x292697=_0x1ecfa3;_0x4908fa[_0xd6e8('0x57')]=_[_0xd6e8('0x59')](db['CmList'][_0xd6e8('0x3e')]);_0x4908fa[_0xd6e8('0x46')]=_[_0xd6e8('0x59')](_0x504a4c[_0xd6e8('0x46')]);_0x4908fa[_0xd6e8('0x5b')]=_['intersection'](_0x4908fa['model'],_0x4908fa[_0xd6e8('0x46')]);_0x4ec18b[_0xd6e8('0x4a')]=_[_0xd6e8('0x5c')](_0x4908fa['model'],qs[_0xd6e8('0x5d')](_0x504a4c['query']['fields']));_0x4ec18b['attributes']=_0x4ec18b[_0xd6e8('0x4a')]['length']?_0x4ec18b[_0xd6e8('0x4a')]:_0x4908fa[_0xd6e8('0x57')];_0x4ec18b['order']=qs['sort'](_0x504a4c[_0xd6e8('0x46')][_0xd6e8('0xd6')]);_0x4ec18b[_0xd6e8('0x45')]=qs['filters'](_[_0xd6e8('0xd7')](_0x504a4c[_0xd6e8('0x46')],_0x4908fa['filters']));if(_0x504a4c['query'][_0xd6e8('0x32')]){_0x4ec18b['where']=_['merge'](_0x4ec18b['where'],{'$or':_[_0xd6e8('0x34')](_0x4ec18b[_0xd6e8('0x4a')],function(_0x4f2c88){var _0x482128={};_0x482128[_0x4f2c88]={'$like':'%'+_0x504a4c[_0xd6e8('0x46')][_0xd6e8('0x32')]+'%'};return _0x482128;})});}_0x4ec18b=_[_0xd6e8('0x61')]({},_0x4ec18b,_0x504a4c[_0xd6e8('0x62')]);return _0x292697[_0xd6e8('0x12b')](_0x4ec18b);}})[_0xd6e8('0x17')](function(_0x63edf6){if(_0x63edf6){_0x84824f=_0x63edf6[_0xd6e8('0x5e')];if(!_0x504a4c[_0xd6e8('0x46')][_0xd6e8('0xd8')]('nolimit')){_0x4ec18b[_0xd6e8('0x26')]=qs[_0xd6e8('0x26')](_0x504a4c[_0xd6e8('0x46')][_0xd6e8('0x26')]);_0x4ec18b[_0xd6e8('0x24')]=qs[_0xd6e8('0x24')](_0x504a4c['query'][_0xd6e8('0x24')]);}return _0x292697['getLists'](_0x4ec18b);}})[_0xd6e8('0x17')](function(_0x316d4f){if(_0x316d4f){return _0x316d4f?{'count':_0x84824f,'rows':_0x316d4f}:null;}})[_0xd6e8('0x17')](respondWithResult(_0xebb5fe,null))['catch'](handleError(_0xebb5fe,null));};exports[_0xd6e8('0x12c')]=function(_0x5e9dce,_0x49bb4b){var _0x2346d7={};var _0x440726={};var _0x295bcb;return db[_0xd6e8('0x3d')][_0xd6e8('0xa2')]({'where':{'id':_0x5e9dce['params']['id']}})['then'](handleEntityNotFound(_0x49bb4b,null))['then'](function(_0x24b9d3){if(_0x24b9d3){_0x295bcb=_0x24b9d3;_0x440726['model']=_[_0xd6e8('0x59')](db[_0xd6e8('0x3d')][_0xd6e8('0x3e')]);_0x440726[_0xd6e8('0x46')]=_[_0xd6e8('0x59')](_0x5e9dce[_0xd6e8('0x46')]);_0x440726[_0xd6e8('0x5b')]=_['intersection'](_0x440726[_0xd6e8('0x57')],_0x440726[_0xd6e8('0x46')]);_0x2346d7[_0xd6e8('0x4a')]=_[_0xd6e8('0x5c')](_0x440726['model'],qs[_0xd6e8('0x5d')](_0x5e9dce[_0xd6e8('0x46')][_0xd6e8('0x5d')]));_0x2346d7[_0xd6e8('0x4a')]=_0x2346d7['attributes'][_0xd6e8('0x5e')]?_0x2346d7[_0xd6e8('0x4a')]:_0x440726[_0xd6e8('0x57')];_0x2346d7[_0xd6e8('0xd5')]=qs['sort'](_0x5e9dce[_0xd6e8('0x46')][_0xd6e8('0xd6')]);_0x2346d7[_0xd6e8('0x45')]=qs['filters'](_[_0xd6e8('0xd7')](_0x5e9dce[_0xd6e8('0x46')],_0x440726[_0xd6e8('0x5b')]));if(_0x5e9dce[_0xd6e8('0x46')][_0xd6e8('0x32')]){_0x2346d7[_0xd6e8('0x45')]=_[_0xd6e8('0x61')](_0x2346d7[_0xd6e8('0x45')],{'$or':_[_0xd6e8('0x34')](_0x2346d7['attributes'],function(_0x48bddf){var _0x250baa={};_0x250baa[_0x48bddf]={'$like':'%'+_0x5e9dce[_0xd6e8('0x46')][_0xd6e8('0x32')]+'%'};return _0x250baa;})});}_0x2346d7[_0xd6e8('0x57')]=db[_0xd6e8('0x3d')];_0x2346d7['as']=_0xd6e8('0x2e');_0x2346d7=_['merge']({},_0x2346d7,_0x5e9dce['options']);return _0x295bcb[_0xd6e8('0xf9')]({'include':[_0x2346d7]});}})[_0xd6e8('0x17')](function(_0xd6601f){if(_0xd6601f){var _0x222059={},_0x18c2fe=[];for(var _0x467193=0x0;_0x467193<_0xd6601f[_0xd6e8('0x5e')];_0x467193+=0x1){for(var _0x3f6372=0x0,_0x1546c5;_0x3f6372<_0xd6601f[_0x467193][_0xd6e8('0x2e')][_0xd6e8('0x5e')];_0x3f6372+=0x1){_0x1546c5=_0xd6601f[_0x467193][_0xd6e8('0x2e')][_0x3f6372]['get']({'plain':!![]});_0x222059[_0x1546c5['id']]=_0x1546c5;}}_0x222059=_[_0xd6e8('0x12d')](_0x222059);for(var _0x4b0bff=qs[_0xd6e8('0x24')](_0x5e9dce['query'][_0xd6e8('0x24')]);_0x4b0bff<_0x222059[_0xd6e8('0x5e')]&&_0x18c2fe[_0xd6e8('0x5e')]=_0x3d3ccd['agents']){throw new Error(_0x1ae9('0x56'));}})[_0x1ae9('0xf')](function(){if(_0x587c7e){return db[_0x1ae9('0x4a')][_0x1ae9('0x4b')]({'where':{'membername':_0x587c7e[_0x1ae9('0x29')]},'individualHooks':!![]});}})[_0x1ae9('0xf')](function(){if(_0x587c7e){return _0x587c7e['getVoiceQueues']({'raw':!![]});}})[_0x1ae9('0xf')](function(_0x145eec){if(_0x587c7e){if(_0x145eec){var _0xede1e0=[];_0x5aff76=_0x145eec;if(_0x5aff76[_0x1ae9('0x2c')]){for(var _0x165a2c=0x0;_0x165a2c<_0x5aff76[_0x1ae9('0x2c')];_0x165a2c++){_0xede1e0[_0x1ae9('0x32')](db[_0x1ae9('0x4a')][_0x1ae9('0x57')]({'membername':_0x587c7e[_0x1ae9('0x29')],'UserId':_0x587c7e['id'],'queue_name':_0x5aff76[_0x165a2c]['name'],'VoiceQueueId':_0x5aff76[_0x165a2c]['id'],'interface':_0x95bc56,'paused':_0x587c7e[_0x1ae9('0x50')]||![],'penalty':_0x5aff76[_0x165a2c]['UserVoiceQueue.penalty']||0x0}));}return BPromise[_0x1ae9('0x48')](_0xede1e0);}}}})[_0x1ae9('0xf')](function(){if(_0x587c7e){return db[_0x1ae9('0x37')]['findAll']({'where':{'membername':_0x587c7e[_0x1ae9('0x29')],'exitAt':null}});}})[_0x1ae9('0xf')](function(_0x553bb1){if(_0x587c7e){if(_0x553bb1&&_0x553bb1[_0x1ae9('0x2c')]){var _0x49f383=[];_0x553bb1[_0x1ae9('0x31')](function(_0x3965a2){_0x49f383['push'](_0x3965a2[_0x1ae9('0x40')]({'exitAt':moment()[_0x1ae9('0x2d')](_0x1ae9('0x2e'))}));});return BPromise[_0x1ae9('0x48')](_0x49f383);}}})[_0x1ae9('0xf')](function(_0x526faf){if(_0x587c7e){var _0x496ce9=[];var _0x2bbc36=[];var _0xfda3c6=utils['getChannels']();var _0x13c6c8={'membername':_0x587c7e[_0x1ae9('0x29')],'interface':_0x95bc56,'enterAt':moment()[_0x1ae9('0x2d')](_0x1ae9('0x2e')),'role':_0x587c7e[_0x1ae9('0x36')],'internal':_0x587c7e[_0x1ae9('0x4f')]};_0xfda3c6['forEach'](function(_0x26716d){_0x496ce9['push'](_['merge']({'channel':_0x26716d,'type':_0x1ae9('0x58'),'data1':'callysquare','data2':_0x95bc56},_0x13c6c8));if(_0x587c7e[_0x1ae9('0x50')]){_0x2bbc36[_0x1ae9('0x32')](_[_0x1ae9('0x59')]({'channel':_0x26716d,'type':_0x1ae9('0x2b'),'data1':_0x1ae9('0x5a')},_0x13c6c8));}});return db[_0x1ae9('0x37')][_0x1ae9('0x38')](_0x496ce9['concat'](_0x2bbc36),{'individualHooks':!![]});}})[_0x1ae9('0xf')](function(){if(_0x587c7e){return _0x587c7e[_0x1ae9('0x40')]({'online':!![],'lastLoginAt':moment()[_0x1ae9('0x2d')](_0x1ae9('0x2e')),'voicePause':_0x587c7e['loginInPause']||![],'mailPause':_0x587c7e[_0x1ae9('0x50')]||![],'chatPause':_0x587c7e['loginInPause']||![],'faxPause':_0x587c7e['loginInPause']||![],'smsPause':_0x587c7e[_0x1ae9('0x50')]||![],'openchannelPause':_0x587c7e[_0x1ae9('0x50')]||![],'pauseType':_0x587c7e[_0x1ae9('0x50')]?_0x1ae9('0x5a'):null,'lastPauseAt':moment()[_0x1ae9('0x2d')]('YYYY-MM-DD\x20HH:mm:ss'),'interface':_0x95bc56});}})[_0x1ae9('0xf')](function(_0x1c3443){_0x540fa7(_0x1c3443);})[_0x1ae9('0x19')](function(_0x3f3ee8){_0x242177(_0x14a55f[_0x1ae9('0x16')](0x1f4,_0x3f3ee8[_0x1ae9('0x17')]));});});}; \ No newline at end of file +var _0x098c=['interface','SIP/%s','body','type','DEFAULT\x20PAUSE','uniqueid','UnpauseUser','findOne','channel','voice','mail','chat','fax','sms','openchannel','%s%s','Pause','all','LogoutUser','destroy','length','LoginUser','mobile','phone','loginInPause','count','getLicense','agents','Maximum\x20login\x20has\x20been\x20reached','upsert','UserVoiceQueue.penalty','getChannels','LOGIN','callysquare','merge','LOGININPAUSE','bulkCreate','concat','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','localhost','socket.io-emitter','./user.socket','register','request','then','info','User,\x20%s,\x20%s','request\x20sent','debug','User,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','User','findAll','options','raw','where','limit','map','include','model','attributes','GetUser','stringify','ShowUser','find','PauseUser','role','internal','UserVoiceQueueRt','update','MemberReport','name','PAUSE','format','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','forEach','push','isNil'];(function(_0x7a4b16,_0x2c3b70){var _0x59e441=function(_0xfc8375){while(--_0xfc8375){_0x7a4b16['push'](_0x7a4b16['shift']());}};_0x59e441(++_0x2c3b70);}(_0x098c,0xe0));var _0xc098=function(_0x3accdb,_0x187888){_0x3accdb=_0x3accdb-0x0;var _0x4dab57=_0x098c[_0x3accdb];return _0x4dab57;};'use strict';var _=require('lodash');var util=require(_0xc098('0x0'));var moment=require('moment');var BPromise=require(_0xc098('0x1'));var rs=require(_0xc098('0x2'));var fs=require('fs');var Redis=require(_0xc098('0x3'));var db=require(_0xc098('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xc098('0x5'))(_0xc098('0x6'));var config=require(_0xc098('0x7'));var jayson=require(_0xc098('0x8'));var client=jayson['client'][_0xc098('0x9')]({'port':0x232a});config[_0xc098('0xa')]=_['defaults'](config['redis'],{'host':_0xc098('0xb'),'port':0x18eb});var socket=require(_0xc098('0xc'))(new Redis(config[_0xc098('0xa')]));require(_0xc098('0xd'))[_0xc098('0xe')](socket);function respondWithRpcPromise(_0x190c43,_0x1c8b29,_0x27fabe){return new BPromise(function(_0x28adab,_0x404639){return client[_0xc098('0xf')](_0x190c43,_0x27fabe)[_0xc098('0x10')](function(_0x5886ce){logger[_0xc098('0x11')](_0xc098('0x12'),_0x1c8b29,_0xc098('0x13'));logger[_0xc098('0x14')](_0xc098('0x15'),_0x1c8b29,_0xc098('0x13'),JSON['stringify'](_0x5886ce));if(_0x5886ce[_0xc098('0x16')]){if(_0x5886ce[_0xc098('0x16')][_0xc098('0x17')]===0x1f4){logger[_0xc098('0x16')](_0xc098('0x12'),_0x1c8b29,_0x5886ce[_0xc098('0x16')][_0xc098('0x18')]);return _0x404639(_0x5886ce[_0xc098('0x16')]['message']);}logger[_0xc098('0x16')](_0xc098('0x12'),_0x1c8b29,_0x5886ce[_0xc098('0x16')]['message']);return _0x28adab(_0x5886ce[_0xc098('0x16')][_0xc098('0x18')]);}else{logger[_0xc098('0x11')](_0xc098('0x12'),_0x1c8b29,'request\x20sent');_0x28adab(_0x5886ce[_0xc098('0x19')][_0xc098('0x18')]);}})[_0xc098('0x1a')](function(_0x2683b9){logger[_0xc098('0x16')](_0xc098('0x12'),_0x1c8b29,_0x2683b9);_0x404639(_0x2683b9);});});}exports['GetUser']=function(_0x2d4611){var _0xd8709e=this;return new Promise(function(_0x4523a3,_0x21b0df){return db[_0xc098('0x1b')][_0xc098('0x1c')]({'raw':_0x2d4611[_0xc098('0x1d')]?_0x2d4611['options'][_0xc098('0x1e')]===undefined?!![]:![]:!![],'where':_0x2d4611[_0xc098('0x1d')]?_0x2d4611[_0xc098('0x1d')][_0xc098('0x1f')]||null:null,'attributes':_0x2d4611[_0xc098('0x1d')]?_0x2d4611[_0xc098('0x1d')]['attributes']||null:null,'limit':_0x2d4611[_0xc098('0x1d')]?_0x2d4611[_0xc098('0x1d')][_0xc098('0x20')]||null:null,'include':_0x2d4611[_0xc098('0x1d')]?_0x2d4611[_0xc098('0x1d')]['include']?_[_0xc098('0x21')](_0x2d4611[_0xc098('0x1d')][_0xc098('0x22')],function(_0x2306d2){return{'model':db[_0x2306d2[_0xc098('0x23')]],'as':_0x2306d2['as'],'attributes':_0x2306d2[_0xc098('0x24')],'include':_0x2306d2['include']?_[_0xc098('0x21')](_0x2306d2['include'],function(_0x2c0d66){return{'model':db[_0x2c0d66['model']],'as':_0x2c0d66['as'],'attributes':_0x2c0d66[_0xc098('0x24')],'include':_0x2c0d66[_0xc098('0x22')]?_[_0xc098('0x21')](_0x2c0d66[_0xc098('0x22')],function(_0x956680){return{'model':db[_0x956680[_0xc098('0x23')]],'as':_0x956680['as'],'attributes':_0x956680[_0xc098('0x24')]};}):[]};}):[]};}):[]:[]})[_0xc098('0x10')](function(_0x504c15){logger[_0xc098('0x11')](_0xc098('0x25'),_0x2d4611);logger[_0xc098('0x14')](_0xc098('0x25'),_0x2d4611,JSON[_0xc098('0x26')](_0x504c15));_0x4523a3(_0x504c15);})[_0xc098('0x1a')](function(_0x3f51bb){logger[_0xc098('0x16')](_0xc098('0x25'),_0x3f51bb[_0xc098('0x18')],_0x2d4611);_0x21b0df(_0xd8709e[_0xc098('0x16')](0x1f4,_0x3f51bb[_0xc098('0x18')]));});});};exports[_0xc098('0x27')]=function(_0x40ba37){var _0x25d14a=this;return new Promise(function(_0x489669,_0x1a3386){return db[_0xc098('0x1b')][_0xc098('0x28')]({'raw':_0x40ba37[_0xc098('0x1d')]?_0x40ba37[_0xc098('0x1d')][_0xc098('0x1e')]===undefined?!![]:![]:!![],'where':_0x40ba37['options']?_0x40ba37[_0xc098('0x1d')][_0xc098('0x1f')]||null:null,'attributes':_0x40ba37[_0xc098('0x1d')]?_0x40ba37[_0xc098('0x1d')]['attributes']||null:null,'include':_0x40ba37['options']?_0x40ba37[_0xc098('0x1d')][_0xc098('0x22')]?_['map'](_0x40ba37[_0xc098('0x1d')][_0xc098('0x22')],function(_0x2b3486){return{'model':db[_0x2b3486[_0xc098('0x23')]],'as':_0x2b3486['as'],'attributes':_0x2b3486[_0xc098('0x24')],'include':_0x2b3486[_0xc098('0x22')]?_[_0xc098('0x21')](_0x2b3486[_0xc098('0x22')],function(_0x27f55a){return{'model':db[_0x27f55a[_0xc098('0x23')]],'as':_0x27f55a['as'],'attributes':_0x27f55a['attributes'],'include':_0x27f55a[_0xc098('0x22')]?_[_0xc098('0x21')](_0x27f55a[_0xc098('0x22')],function(_0x2b4725){return{'model':db[_0x2b4725[_0xc098('0x23')]],'as':_0x2b4725['as'],'attributes':_0x2b4725[_0xc098('0x24')]};}):[]};}):[]};}):[]:[]})[_0xc098('0x10')](function(_0x1377e4){logger['info']('ShowUser',_0x40ba37);logger[_0xc098('0x14')](_0xc098('0x27'),_0x40ba37,JSON[_0xc098('0x26')](_0x1377e4));_0x489669(_0x1377e4);})[_0xc098('0x1a')](function(_0x5b8911){logger[_0xc098('0x16')](_0xc098('0x27'),_0x5b8911['message'],_0x40ba37);_0x1a3386(_0x25d14a[_0xc098('0x16')](0x1f4,_0x5b8911[_0xc098('0x18')]));});});};exports[_0xc098('0x29')]=function(_0x32ca94){var _0x2238a5=this;return new Promise(function(_0x259722,_0x591e7f){var _0x5d8815;return db[_0xc098('0x1b')]['find']({'where':_0x32ca94['options'][_0xc098('0x1f')]||{},'attributes':['id','name',_0xc098('0x2a'),_0xc098('0x2b'),'interface']})[_0xc098('0x10')](function(_0x2f8c09){if(_0x2f8c09){_0x5d8815=_0x2f8c09;return db[_0xc098('0x2c')][_0xc098('0x2d')]({'paused':0x1},{'where':{'UserId':_0x5d8815['id']},'individualHooks':!![]});}})['then'](function(){if(_0x5d8815){return db[_0xc098('0x2e')][_0xc098('0x1c')]({'where':{'membername':_0x5d8815[_0xc098('0x2f')],'type':_0xc098('0x30'),'exitAt':null}});}})['then'](function(_0x3bc901){if(_0x5d8815){if(_0x3bc901&&_0x3bc901['length']){var _0x19663c=moment()[_0xc098('0x31')](_0xc098('0x32'));for(var _0x35c017=0x0,_0x10f68c=_0x3bc901['length'];_0x35c017<_0x10f68c;_0x35c017++){_0x3bc901[_0x35c017][_0xc098('0x33')]({'exitAt':_0x19663c});}}}})[_0xc098('0x10')](function(){if(_0x5d8815){var _0x59b975=[];var _0x3cea04=utils['getChannels']();_0x3cea04[_0xc098('0x34')](function(_0x4f443d){_0x59b975[_0xc098('0x35')]({'channel':_0x4f443d,'membername':_0x5d8815[_0xc098('0x2f')],'interface':_[_0xc098('0x36')](_0x5d8815[_0xc098('0x37')])?util['format'](_0xc098('0x38'),_0x5d8815['name']):_0x5d8815[_0xc098('0x37')],'type':_0xc098('0x30'),'enterAt':moment()['format'](_0xc098('0x32')),'data1':_0x32ca94[_0xc098('0x39')][_0xc098('0x3a')]||_0xc098('0x3b'),'role':_0x5d8815[_0xc098('0x2a')],'internal':_0x5d8815[_0xc098('0x2b')],'uniqueid':_0x32ca94[_0xc098('0x39')][_0xc098('0x3c')]||null});});return db['MemberReport']['bulkCreate'](_0x59b975,{'individualHooks':!![]});}})[_0xc098('0x10')](function(){if(_0x5d8815){return _0x5d8815[_0xc098('0x2d')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'openchannelPause':!![],'whatsappPause':!![],'pauseType':_0x32ca94[_0xc098('0x39')][_0xc098('0x3a')]||_0xc098('0x3b'),'lastPauseAt':moment()[_0xc098('0x31')](_0xc098('0x32'))});}})['then'](function(_0x1fc0b4){_0x259722(_0x1fc0b4);})['catch'](function(_0x5bb887){_0x591e7f(_0x2238a5[_0xc098('0x16')](0x1f4,_0x5bb887[_0xc098('0x18')]));});});};exports[_0xc098('0x3d')]=function(_0x3dce0b){var _0x4ba421=this;return new Promise(function(_0x4719e8,_0x12bc10){var _0x548338;return db['User'][_0xc098('0x3e')]({'where':_0x3dce0b['options'][_0xc098('0x1f')]||{},'attributes':['id',_0xc098('0x2f')]})[_0xc098('0x10')](function(_0x575c49){if(_0x575c49){_0x548338=_0x575c49;if(_0x3dce0b['body']['channel']&&!utils['isValidChannel'](_0x3dce0b[_0xc098('0x39')][_0xc098('0x3f')])){throw new Error('Unknown\x20channel');}switch(_0x3dce0b[_0xc098('0x39')][_0xc098('0x3f')]){case _0xc098('0x40'):return db[_0xc098('0x2c')][_0xc098('0x2d')]({'paused':0x0},{'where':{'UserId':_0x548338['id']}})[_0xc098('0x10')](function(){return db[_0xc098('0x2e')][_0xc098('0x28')]({'where':{'channel':_0x3dce0b[_0xc098('0x39')]['channel'],'membername':_0x548338[_0xc098('0x2f')],'type':_0xc098('0x30'),'exitAt':null}});})['then'](function(_0x35edf1){if(_0x35edf1){return _0x35edf1[_0xc098('0x2d')]({'exitAt':moment()[_0xc098('0x31')](_0xc098('0x32')),'data2':'system'},{'individualHooks':!![]});}return null;})[_0xc098('0x10')](function(){return _0x548338[_0xc098('0x2d')]({'voicePause':![]});});case _0xc098('0x41'):case _0xc098('0x42'):case _0xc098('0x43'):case _0xc098('0x44'):case _0xc098('0x45'):case'whatsapp':return db[_0xc098('0x2e')]['find']({'where':{'channel':_0x3dce0b[_0xc098('0x39')][_0xc098('0x3f')],'membername':_0x548338[_0xc098('0x2f')],'type':_0xc098('0x30'),'exitAt':null}})[_0xc098('0x10')](function(_0x3b3ee4){return _0x3b3ee4[_0xc098('0x2d')]({'exitAt':moment()[_0xc098('0x31')](_0xc098('0x32')),'data2':'system'},{'individualHooks':!![]});})['then'](function(){var _0x38d26d={};_['set'](_0x38d26d,util[_0xc098('0x31')](_0xc098('0x46'),_0x3dce0b[_0xc098('0x39')]['channel'],_0xc098('0x47')),![]);return _0x548338[_0xc098('0x2d')](_0x38d26d);});default:return db[_0xc098('0x2c')][_0xc098('0x2d')]({'paused':0x0},{'where':{'UserId':_0x548338['id']}})[_0xc098('0x10')](function(){return db[_0xc098('0x2e')][_0xc098('0x1c')]({'where':{'membername':_0x548338[_0xc098('0x2f')],'type':_0xc098('0x30'),'exitAt':null}});})[_0xc098('0x10')](function(_0x5dadc1){var _0x2c228d=[];_0x5dadc1['forEach'](function(_0x5336ee){_0x2c228d['push'](_0x5336ee[_0xc098('0x2d')]({'exitAt':moment()[_0xc098('0x31')]('YYYY-MM-DD\x20HH:mm:ss'),'data2':'system'}));});return BPromise[_0xc098('0x48')](_0x2c228d);})[_0xc098('0x10')](function(){return _0x548338[_0xc098('0x2d')]({'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![]});});}}})[_0xc098('0x10')](function(_0x162dd1){_0x4719e8(_0x162dd1);})[_0xc098('0x1a')](function(_0x24c830){_0x12bc10(_0x4ba421['error'](0x1f4,_0x24c830['message']));});});};exports[_0xc098('0x49')]=function(_0x18a174){var _0x3e4278=this;return new Promise(function(_0xc5850f,_0x1eba02){var _0x4897d0;return db[_0xc098('0x1b')][_0xc098('0x3e')]({'where':_0x18a174['options']['where']||{},'attributes':['id',_0xc098('0x2f')]})[_0xc098('0x10')](function(_0x53e2b8){if(_0x53e2b8){_0x4897d0=_0x53e2b8;return db[_0xc098('0x2c')][_0xc098('0x4a')]({'where':{'membername':_0x4897d0[_0xc098('0x2f')]},'individualHooks':!![]});}})['then'](function(){if(_0x4897d0){return db['MemberReport'][_0xc098('0x1c')]({'where':{'membername':_0x4897d0[_0xc098('0x2f')],'exitAt':null}});}})[_0xc098('0x10')](function(_0x51e80f){if(_0x4897d0){if(_0x51e80f&&_0x51e80f[_0xc098('0x4b')]){var _0x3bdf81=[];_0x51e80f[_0xc098('0x34')](function(_0x4a55a5){_0x3bdf81[_0xc098('0x35')](_0x4a55a5[_0xc098('0x2d')]({'exitAt':moment()[_0xc098('0x31')](_0xc098('0x32'))}));});return BPromise[_0xc098('0x48')](_0x3bdf81);}}})['then'](function(){if(_0x4897d0){return _0x4897d0['update']({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});}})['then'](function(_0x1d8cf5){_0xc5850f(_0x1d8cf5);})[_0xc098('0x1a')](function(_0x54f45a){_0x1eba02(_0x3e4278['error'](0x1f4,_0x54f45a[_0xc098('0x18')]));});});};exports[_0xc098('0x4c')]=function(_0x56a4bc){var _0x3d6b1e=this;return new Promise(function(_0x184c44,_0x2c672b){var _0x117e57;var _0x1249b1;var _0x1e1373;var _0x53cefc;return db[_0xc098('0x1b')][_0xc098('0x3e')]({'where':_0x56a4bc[_0xc098('0x1d')][_0xc098('0x1f')]||{},'attributes':['id','name','role',_0xc098('0x4d'),_0xc098('0x4e'),_0xc098('0x2b'),_0xc098('0x4f'),_0xc098('0x37')]})[_0xc098('0x10')](function(_0x595386){if(_0x595386){_0x117e57=_0x595386;_0x53cefc=_0x56a4bc[_0xc098('0x39')][_0xc098('0x37')]?_0x56a4bc[_0xc098('0x39')][_0xc098('0x37')]:util[_0xc098('0x31')](_0xc098('0x38'),_0x117e57[_0xc098('0x2f')]);return db[_0xc098('0x1b')][_0xc098('0x50')]({'where':{'role':'agent','online':!![],'id':{'$ne':_0x117e57['id']}}});}})[_0xc098('0x10')](function(_0x8e8ea9){if(_0x8e8ea9){_0x1e1373=_0x8e8ea9;return require('../../config/license/util')[_0xc098('0x51')]();}})[_0xc098('0x10')](function(_0x58a86f){if(_0x58a86f&&_0x58a86f[_0xc098('0x52')]&&_0x1e1373>=_0x58a86f[_0xc098('0x52')]){throw new Error(_0xc098('0x53'));}})[_0xc098('0x10')](function(){if(_0x117e57){return db[_0xc098('0x2c')][_0xc098('0x4a')]({'where':{'membername':_0x117e57[_0xc098('0x2f')]},'individualHooks':!![]});}})['then'](function(){if(_0x117e57){return _0x117e57['getVoiceQueues']({'raw':!![]});}})['then'](function(_0x13ea18){if(_0x117e57){if(_0x13ea18){var _0x29043a=[];_0x1249b1=_0x13ea18;if(_0x1249b1[_0xc098('0x4b')]){for(var _0x479816=0x0;_0x479816<_0x1249b1[_0xc098('0x4b')];_0x479816++){_0x29043a['push'](db['UserVoiceQueueRt'][_0xc098('0x54')]({'membername':_0x117e57[_0xc098('0x2f')],'UserId':_0x117e57['id'],'queue_name':_0x1249b1[_0x479816]['name'],'VoiceQueueId':_0x1249b1[_0x479816]['id'],'interface':_0x53cefc,'paused':_0x117e57[_0xc098('0x4f')]||![],'penalty':_0x1249b1[_0x479816][_0xc098('0x55')]||0x0}));}return BPromise[_0xc098('0x48')](_0x29043a);}}}})[_0xc098('0x10')](function(){if(_0x117e57){return db[_0xc098('0x2e')][_0xc098('0x1c')]({'where':{'membername':_0x117e57[_0xc098('0x2f')],'exitAt':null}});}})[_0xc098('0x10')](function(_0x58983b){if(_0x117e57){if(_0x58983b&&_0x58983b[_0xc098('0x4b')]){var _0x5d5dfe=[];_0x58983b[_0xc098('0x34')](function(_0x2a3a2a){_0x5d5dfe['push'](_0x2a3a2a[_0xc098('0x2d')]({'exitAt':moment()[_0xc098('0x31')]('YYYY-MM-DD\x20HH:mm:ss')}));});return BPromise[_0xc098('0x48')](_0x5d5dfe);}}})[_0xc098('0x10')](function(_0x3977f3){if(_0x117e57){var _0x401c07=[];var _0xf804f0=[];var _0x39d4ca=utils[_0xc098('0x56')]();var _0x96f121={'membername':_0x117e57['name'],'interface':_0x53cefc,'enterAt':moment()[_0xc098('0x31')](_0xc098('0x32')),'role':_0x117e57['role'],'internal':_0x117e57[_0xc098('0x2b')]};_0x39d4ca[_0xc098('0x34')](function(_0x37e624){_0x401c07[_0xc098('0x35')](_['merge']({'channel':_0x37e624,'type':_0xc098('0x57'),'data1':_0xc098('0x58'),'data2':_0x53cefc},_0x96f121));if(_0x117e57[_0xc098('0x4f')]){_0xf804f0['push'](_[_0xc098('0x59')]({'channel':_0x37e624,'type':_0xc098('0x30'),'data1':_0xc098('0x5a')},_0x96f121));}});return db[_0xc098('0x2e')][_0xc098('0x5b')](_0x401c07[_0xc098('0x5c')](_0xf804f0),{'individualHooks':!![]});}})[_0xc098('0x10')](function(){if(_0x117e57){return _0x117e57[_0xc098('0x2d')]({'online':!![],'lastLoginAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'voicePause':_0x117e57[_0xc098('0x4f')]||![],'mailPause':_0x117e57[_0xc098('0x4f')]||![],'chatPause':_0x117e57[_0xc098('0x4f')]||![],'faxPause':_0x117e57[_0xc098('0x4f')]||![],'smsPause':_0x117e57[_0xc098('0x4f')]||![],'openchannelPause':_0x117e57[_0xc098('0x4f')]||![],'pauseType':_0x117e57[_0xc098('0x4f')]?_0xc098('0x5a'):null,'lastPauseAt':moment()[_0xc098('0x31')](_0xc098('0x32')),'interface':_0x53cefc});}})[_0xc098('0x10')](function(_0x3f1306){_0x184c44(_0x3f1306);})[_0xc098('0x1a')](function(_0x20ce52){_0x2c672b(_0x3d6b1e['error'](0x1f4,_0x20ce52[_0xc098('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/user/user.socket.js b/server/api/user/user.socket.js index bef827a..fdd23c3 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 _0xfd86=['remove','update','emit','removeListener','register','length','user:','./user.events','save'];(function(_0x59a1a0,_0x45d4a8){var _0x442238=function(_0x48f6e5){while(--_0x48f6e5){_0x59a1a0['push'](_0x59a1a0['shift']());}};_0x442238(++_0x45d4a8);}(_0xfd86,0x18a));var _0x6fd8=function(_0x5806c3,_0x5105d8){_0x5806c3=_0x5806c3-0x0;var _0x48ac77=_0xfd86[_0x5806c3];return _0x48ac77;};'use strict';var UserEvents=require(_0x6fd8('0x0'));var events=[_0x6fd8('0x1'),_0x6fd8('0x2'),_0x6fd8('0x3')];function createListener(_0x3622a9,_0x4cf409){return function(_0x4012e0){_0x4cf409[_0x6fd8('0x4')](_0x3622a9,_0x4012e0);};}function removeListener(_0x559a08,_0xc4bb10){return function(){UserEvents[_0x6fd8('0x5')](_0x559a08,_0xc4bb10);};}exports[_0x6fd8('0x6')]=function(_0x570102){for(var _0x4e14ee=0x0,_0xc8ed74=events[_0x6fd8('0x7')];_0x4e14ee<_0xc8ed74;_0x4e14ee++){var _0x449986=events[_0x4e14ee];var _0x5d0b7a=createListener(_0x6fd8('0x8')+_0x449986,_0x570102);UserEvents['on'](_0x449986,_0x5d0b7a);}}; \ No newline at end of file +var _0x4e9f=['user:','./user.events','save','remove','emit','length'];(function(_0x1177d5,_0x22b649){var _0xc3ddc2=function(_0x43ff95){while(--_0x43ff95){_0x1177d5['push'](_0x1177d5['shift']());}};_0xc3ddc2(++_0x22b649);}(_0x4e9f,0x109));var _0xf4e9=function(_0x147796,_0x234fe6){_0x147796=_0x147796-0x0;var _0xd30d4=_0x4e9f[_0x147796];return _0xd30d4;};'use strict';var UserEvents=require(_0xf4e9('0x0'));var events=[_0xf4e9('0x1'),_0xf4e9('0x2'),'update'];function createListener(_0x2d2a46,_0x1154ef){return function(_0x432459){_0x1154ef[_0xf4e9('0x3')](_0x2d2a46,_0x432459);};}function removeListener(_0x5da84b,_0x58a221){return function(){UserEvents['removeListener'](_0x5da84b,_0x58a221);};}exports['register']=function(_0x235fce){for(var _0x3964e9=0x0,_0x4074a4=events[_0xf4e9('0x4')];_0x3964e9<_0x4074a4;_0x3964e9++){var _0x564781=events[_0x3964e9];var _0x1b8e5c=createListener(_0xf4e9('0x5')+_0x564781,_0x235fce);UserEvents['on'](_0x564781,_0x1b8e5c);}}; \ No newline at end of file diff --git a/server/api/userChatQueue/index.js b/server/api/userChatQueue/index.js index f244848..5d978d5 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 _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x202a6d,_0x5bef9e){var _0x28fa4f=function(_0x622c88){while(--_0x622c88){_0x202a6d['push'](_0x202a6d['shift']());}};_0x28fa4f(++_0x5bef9e);}(_0x9c44,0x178));var _0x49c4=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x9c44[_0x2641f9];return _0x585741;};'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(_0x3e2014,_0x559db1){var _0x2a5742=function(_0x3d66de){while(--_0x3d66de){_0x3e2014['push'](_0x3e2014['shift']());}};_0x2a5742(++_0x559db1);}(_0xe706,0xa3));var _0x6e70=function(_0x4361b6,_0x29e3fe){_0x4361b6=_0x4361b6-0x0;var _0x477231=_0xe706[_0x4361b6];return _0x477231;};'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/userChatQueue/userChatQueue.attributes.js b/server/api/userChatQueue/userChatQueue.attributes.js index f67de60..8073959 100644 --- a/server/api/userChatQueue/userChatQueue.attributes.js +++ b/server/api/userChatQueue/userChatQueue.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xad05=['exports','INTEGER','sequelize'];(function(_0x16ce6c,_0x557333){var _0x3402c3=function(_0x120ba0){while(--_0x120ba0){_0x16ce6c['push'](_0x16ce6c['shift']());}};_0x3402c3(++_0x557333);}(_0xad05,0x1c7));var _0x5ad0=function(_0x4b1032,_0x36952e){_0x4b1032=_0x4b1032-0x0;var _0x5a1d55=_0xad05[_0x4b1032];return _0x5a1d55;};'use strict';var Sequelize=require(_0x5ad0('0x0'));module[_0x5ad0('0x1')]={'penalty':{'type':Sequelize[_0x5ad0('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x5398=['sequelize','exports'];(function(_0x15fb43,_0x3972ae){var _0x38c9a4=function(_0x1b6115){while(--_0x1b6115){_0x15fb43['push'](_0x15fb43['shift']());}};_0x38c9a4(++_0x3972ae);}(_0x5398,0x146));var _0x8539=function(_0x1a39d3,_0x50bbbf){_0x1a39d3=_0x1a39d3-0x0;var _0x2881b5=_0x5398[_0x1a39d3];return _0x2881b5;};'use strict';var Sequelize=require(_0x8539('0x0'));module[_0x8539('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.model.js b/server/api/userChatQueue/userChatQueue.model.js index 2b25462..3bd90b4 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 _0x3274=['exports','define','UserChatQueue','user_has_chat_queues','lodash','util','../../config/logger','bluebird','request-promise','rimraf','../../config/environment','./userChatQueue.attributes'];(function(_0x534bef,_0x40a9bc){var _0x32cac6=function(_0x36e474){while(--_0x36e474){_0x534bef['push'](_0x534bef['shift']());}};_0x32cac6(++_0x40a9bc);}(_0x3274,0x130));var _0x4327=function(_0x273116,_0x1ea8b3){_0x273116=_0x273116-0x0;var _0x3a97b9=_0x3274[_0x273116];return _0x3a97b9;};'use strict';var _=require(_0x4327('0x0'));var util=require(_0x4327('0x1'));var logger=require(_0x4327('0x2'))('api');var moment=require('moment');var BPromise=require(_0x4327('0x3'));var rp=require(_0x4327('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4327('0x5'));var config=require(_0x4327('0x6'));var attributes=require(_0x4327('0x7'));module[_0x4327('0x8')]=function(_0x528501,_0x1976d3){return _0x528501[_0x4327('0x9')](_0x4327('0xa'),attributes,{'tableName':_0x4327('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x511a=['../../config/environment','./userChatQueue.attributes','exports','define','util','../../config/logger','bluebird','path'];(function(_0x4cd96,_0x1bcb35){var _0x454914=function(_0x18e7e4){while(--_0x18e7e4){_0x4cd96['push'](_0x4cd96['shift']());}};_0x454914(++_0x1bcb35);}(_0x511a,0x74));var _0xa511=function(_0x1537f9,_0x2a8188){_0x1537f9=_0x1537f9-0x0;var _0x47d95a=_0x511a[_0x1537f9];return _0x47d95a;};'use strict';var _=require('lodash');var util=require(_0xa511('0x0'));var logger=require(_0xa511('0x1'))('api');var moment=require('moment');var BPromise=require(_0xa511('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa511('0x3'));var rimraf=require('rimraf');var config=require(_0xa511('0x4'));var attributes=require(_0xa511('0x5'));module[_0xa511('0x6')]=function(_0x5aec8f,_0x1f207a){return _0x5aec8f[_0xa511('0x7')]('UserChatQueue',attributes,{'tableName':'user_has_chat_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.rpc.js b/server/api/userChatQueue/userChatQueue.rpc.js index 2e8e8c0..62d6873 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 _0x6832=['request\x20sent','stringify','error','code','message','result','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','UserChatQueue,\x20%s,\x20%s','debug'];(function(_0x5d87f1,_0x32efd1){var _0x56b4a1=function(_0xbc8b0b){while(--_0xbc8b0b){_0x5d87f1['push'](_0x5d87f1['shift']());}};_0x56b4a1(++_0x32efd1);}(_0x6832,0x141));var _0x2683=function(_0xd34fe4,_0x5ad8b9){_0xd34fe4=_0xd34fe4-0x0;var _0x2ad3eb=_0x6832[_0xd34fe4];return _0x2ad3eb;};'use strict';var _=require('lodash');var util=require(_0x2683('0x0'));var moment=require(_0x2683('0x1'));var BPromise=require(_0x2683('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2683('0x3'))['db'];var utils=require(_0x2683('0x4'));var logger=require(_0x2683('0x5'))(_0x2683('0x6'));var config=require(_0x2683('0x7'));var jayson=require(_0x2683('0x8'));var client=jayson[_0x2683('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0xef2f43,_0x443d3c,_0x1f1340){return new BPromise(function(_0x2752ef,_0x5cfaca){return client[_0x2683('0xa')](_0xef2f43,_0x1f1340)[_0x2683('0xb')](function(_0x4b9492){logger[_0x2683('0xc')](_0x2683('0xd'),_0x443d3c,'request\x20sent');logger[_0x2683('0xe')]('UserChatQueue,\x20%s,\x20%s,\x20%s',_0x443d3c,_0x2683('0xf'),JSON[_0x2683('0x10')](_0x4b9492));if(_0x4b9492[_0x2683('0x11')]){if(_0x4b9492['error'][_0x2683('0x12')]===0x1f4){logger[_0x2683('0x11')](_0x2683('0xd'),_0x443d3c,_0x4b9492[_0x2683('0x11')][_0x2683('0x13')]);return _0x5cfaca(_0x4b9492[_0x2683('0x11')][_0x2683('0x13')]);}logger[_0x2683('0x11')]('UserChatQueue,\x20%s,\x20%s',_0x443d3c,_0x4b9492[_0x2683('0x11')][_0x2683('0x13')]);return _0x2752ef(_0x4b9492[_0x2683('0x11')][_0x2683('0x13')]);}else{logger[_0x2683('0xc')](_0x2683('0xd'),_0x443d3c,'request\x20sent');_0x2752ef(_0x4b9492[_0x2683('0x14')]['message']);}})['catch'](function(_0x181008){logger[_0x2683('0x11')](_0x2683('0xd'),_0x443d3c,_0x181008);_0x5cfaca(_0x181008);});});} \ No newline at end of file +var _0xe391=['UserChatQueue,\x20%s,\x20%s','request\x20sent','debug','UserChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x1de4b8,_0x529b41){var _0x557699=function(_0xb10c18){while(--_0xb10c18){_0x1de4b8['push'](_0x1de4b8['shift']());}};_0x557699(++_0x529b41);}(_0xe391,0x104));var _0x1e39=function(_0x1c6ef2,_0x8d926a){_0x1c6ef2=_0x1c6ef2-0x0;var _0x404b8c=_0xe391[_0x1c6ef2];return _0x404b8c;};'use strict';var _=require('lodash');var util=require(_0x1e39('0x0'));var moment=require(_0x1e39('0x1'));var BPromise=require(_0x1e39('0x2'));var rs=require(_0x1e39('0x3'));var fs=require('fs');var Redis=require(_0x1e39('0x4'));var db=require(_0x1e39('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x1e39('0x6'))(_0x1e39('0x7'));var config=require(_0x1e39('0x8'));var jayson=require(_0x1e39('0x9'));var client=jayson[_0x1e39('0xa')][_0x1e39('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x33345f,_0xdaf731,_0x1e3c70){return new BPromise(function(_0x380910,_0x24b3f2){return client[_0x1e39('0xc')](_0x33345f,_0x1e3c70)[_0x1e39('0xd')](function(_0x146615){logger[_0x1e39('0xe')](_0x1e39('0xf'),_0xdaf731,_0x1e39('0x10'));logger[_0x1e39('0x11')](_0x1e39('0x12'),_0xdaf731,_0x1e39('0x10'),JSON[_0x1e39('0x13')](_0x146615));if(_0x146615['error']){if(_0x146615[_0x1e39('0x14')][_0x1e39('0x15')]===0x1f4){logger[_0x1e39('0x14')](_0x1e39('0xf'),_0xdaf731,_0x146615['error'][_0x1e39('0x16')]);return _0x24b3f2(_0x146615[_0x1e39('0x14')][_0x1e39('0x16')]);}logger[_0x1e39('0x14')](_0x1e39('0xf'),_0xdaf731,_0x146615[_0x1e39('0x14')][_0x1e39('0x16')]);return _0x380910(_0x146615[_0x1e39('0x14')]['message']);}else{logger[_0x1e39('0xe')](_0x1e39('0xf'),_0xdaf731,_0x1e39('0x10'));_0x380910(_0x146615[_0x1e39('0x17')][_0x1e39('0x16')]);}})[_0x1e39('0x18')](function(_0x1fdcf4){logger[_0x1e39('0x14')]('UserChatQueue,\x20%s,\x20%s',_0xdaf731,_0x1fdcf4);_0x24b3f2(_0x1fdcf4);});});} \ No newline at end of file diff --git a/server/api/userFaxQueue/index.js b/server/api/userFaxQueue/index.js index fb552da..abd2237 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 _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x241b54,_0x550539){var _0x358d30=function(_0x3caac5){while(--_0x3caac5){_0x241b54['push'](_0x241b54['shift']());}};_0x358d30(++_0x550539);}(_0x70e0,0x17b));var _0x070e=function(_0x404177,_0x19ccb2){_0x404177=_0x404177-0x0;var _0x52582d=_0x70e0[_0x404177];return _0x52582d;};'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(_0x48cc39,_0x4bbb8c){var _0x155301=function(_0x54f207){while(--_0x54f207){_0x48cc39['push'](_0x48cc39['shift']());}};_0x155301(++_0x4bbb8c);}(_0x70e0,0x17b));var _0x070e=function(_0x57328f,_0x4a772e){_0x57328f=_0x57328f-0x0;var _0x27cb34=_0x70e0[_0x57328f];return _0x27cb34;};'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/userFaxQueue/userFaxQueue.attributes.js b/server/api/userFaxQueue/userFaxQueue.attributes.js index 9c5bcd6..1062be0 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 _0x7bc3=['INTEGER','sequelize'];(function(_0x37f229,_0x2417cc){var _0x4fe43a=function(_0x873d9f){while(--_0x873d9f){_0x37f229['push'](_0x37f229['shift']());}};_0x4fe43a(++_0x2417cc);}(_0x7bc3,0x197));var _0x37bc=function(_0x325eea,_0x4bf3ff){_0x325eea=_0x325eea-0x0;var _0x4ada09=_0x7bc3[_0x325eea];return _0x4ada09;};'use strict';var Sequelize=require(_0x37bc('0x0'));module['exports']={'penalty':{'type':Sequelize[_0x37bc('0x1')],'defaultValue':0x0},'assigned':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'queue':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x36fc=['sequelize','INTEGER','STRING'];(function(_0x48b810,_0x173a5e){var _0x23c17d=function(_0x38531e){while(--_0x38531e){_0x48b810['push'](_0x48b810['shift']());}};_0x23c17d(++_0x173a5e);}(_0x36fc,0x1ef));var _0xc36f=function(_0x2f956c,_0x517107){_0x2f956c=_0x2f956c-0x0;var _0xa66ccd=_0x36fc[_0x2f956c];return _0xa66ccd;};'use strict';var Sequelize=require(_0xc36f('0x0'));module['exports']={'penalty':{'type':Sequelize[_0xc36f('0x1')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0xc36f('0x1')],'defaultValue':0x0},'queue':{'type':Sequelize[_0xc36f('0x2')]}}; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.model.js b/server/api/userFaxQueue/userFaxQueue.model.js index 345ccfe..39f4688 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 _0x58fd=['api','moment','bluebird','request-promise','path','./userFaxQueue.attributes','exports','define','UserFaxQueue','user_has_fax_queues','lodash','util','../../config/logger'];(function(_0x2bed2f,_0x2bfeb0){var _0x298e34=function(_0x2b4dff){while(--_0x2b4dff){_0x2bed2f['push'](_0x2bed2f['shift']());}};_0x298e34(++_0x2bfeb0);}(_0x58fd,0xc0));var _0xd58f=function(_0x3e112d,_0x2bb132){_0x3e112d=_0x3e112d-0x0;var _0x531c31=_0x58fd[_0x3e112d];return _0x531c31;};'use strict';var _=require(_0xd58f('0x0'));var util=require(_0xd58f('0x1'));var logger=require(_0xd58f('0x2'))(_0xd58f('0x3'));var moment=require(_0xd58f('0x4'));var BPromise=require(_0xd58f('0x5'));var rp=require(_0xd58f('0x6'));var fs=require('fs');var path=require(_0xd58f('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xd58f('0x8'));module[_0xd58f('0x9')]=function(_0x4d4b12,_0x5c1db6){return _0x4d4b12[_0xd58f('0xa')](_0xd58f('0xb'),attributes,{'tableName':_0xd58f('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb6b4=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userFaxQueue.attributes','exports','define','UserFaxQueue','lodash','util'];(function(_0x41ed92,_0x1eedd4){var _0x4a7e3b=function(_0xa0a7e5){while(--_0xa0a7e5){_0x41ed92['push'](_0x41ed92['shift']());}};_0x4a7e3b(++_0x1eedd4);}(_0xb6b4,0x177));var _0x4b6b=function(_0x7ab339,_0x46cad6){_0x7ab339=_0x7ab339-0x0;var _0x1c56e4=_0xb6b4[_0x7ab339];return _0x1c56e4;};'use strict';var _=require(_0x4b6b('0x0'));var util=require(_0x4b6b('0x1'));var logger=require(_0x4b6b('0x2'))('api');var moment=require(_0x4b6b('0x3'));var BPromise=require(_0x4b6b('0x4'));var rp=require(_0x4b6b('0x5'));var fs=require('fs');var path=require(_0x4b6b('0x6'));var rimraf=require(_0x4b6b('0x7'));var config=require(_0x4b6b('0x8'));var attributes=require(_0x4b6b('0x9'));module[_0x4b6b('0xa')]=function(_0x50790b,_0x30ccc0){return _0x50790b[_0x4b6b('0xb')](_0x4b6b('0xc'),attributes,{'tableName':'user_has_fax_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.rpc.js b/server/api/userFaxQueue/userFaxQueue.rpc.js index ae9ddac..5a76fec 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 _0x7d88=['catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','info','UserFaxQueue,\x20%s,\x20%s','request\x20sent','debug','UserFaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x5a56cc,_0x29650c){var _0x589caa=function(_0x1e3ce5){while(--_0x1e3ce5){_0x5a56cc['push'](_0x5a56cc['shift']());}};_0x589caa(++_0x29650c);}(_0x7d88,0x171));var _0x87d8=function(_0x322eff,_0x48ebda){_0x322eff=_0x322eff-0x0;var _0x16c253=_0x7d88[_0x322eff];return _0x16c253;};'use strict';var _=require(_0x87d8('0x0'));var util=require(_0x87d8('0x1'));var moment=require(_0x87d8('0x2'));var BPromise=require('bluebird');var rs=require(_0x87d8('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x87d8('0x4'))['db'];var utils=require(_0x87d8('0x5'));var logger=require(_0x87d8('0x6'))(_0x87d8('0x7'));var config=require(_0x87d8('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x87d8('0x9')][_0x87d8('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3ca80e,_0x44850b,_0x2f8852){return new BPromise(function(_0x23d6e0,_0x2d4981){return client[_0x87d8('0xb')](_0x3ca80e,_0x2f8852)['then'](function(_0x15ba5b){logger[_0x87d8('0xc')](_0x87d8('0xd'),_0x44850b,_0x87d8('0xe'));logger[_0x87d8('0xf')](_0x87d8('0x10'),_0x44850b,_0x87d8('0xe'),JSON[_0x87d8('0x11')](_0x15ba5b));if(_0x15ba5b[_0x87d8('0x12')]){if(_0x15ba5b[_0x87d8('0x12')][_0x87d8('0x13')]===0x1f4){logger['error'](_0x87d8('0xd'),_0x44850b,_0x15ba5b[_0x87d8('0x12')]['message']);return _0x2d4981(_0x15ba5b[_0x87d8('0x12')][_0x87d8('0x14')]);}logger[_0x87d8('0x12')](_0x87d8('0xd'),_0x44850b,_0x15ba5b[_0x87d8('0x12')][_0x87d8('0x14')]);return _0x23d6e0(_0x15ba5b['error']['message']);}else{logger[_0x87d8('0xc')](_0x87d8('0xd'),_0x44850b,_0x87d8('0xe'));_0x23d6e0(_0x15ba5b[_0x87d8('0x15')]['message']);}})[_0x87d8('0x16')](function(_0x3fac30){logger[_0x87d8('0x12')]('UserFaxQueue,\x20%s,\x20%s',_0x44850b,_0x3fac30);_0x2d4981(_0x3fac30);});});} \ No newline at end of file +var _0xfa63=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','UserFaxQueue,\x20%s,\x20%s','debug','UserFaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xfa63,0x187));var _0x3fa6=function(_0x3ab129,_0x2b5b93){_0x3ab129=_0x3ab129-0x0;var _0x12e126=_0xfa63[_0x3ab129];return _0x12e126;};'use strict';var _=require(_0x3fa6('0x0'));var util=require(_0x3fa6('0x1'));var moment=require(_0x3fa6('0x2'));var BPromise=require(_0x3fa6('0x3'));var rs=require(_0x3fa6('0x4'));var fs=require('fs');var Redis=require(_0x3fa6('0x5'));var db=require(_0x3fa6('0x6'))['db'];var utils=require(_0x3fa6('0x7'));var logger=require('../../config/logger')(_0x3fa6('0x8'));var config=require(_0x3fa6('0x9'));var jayson=require(_0x3fa6('0xa'));var client=jayson[_0x3fa6('0xb')][_0x3fa6('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x488096,_0x278b63,_0x346655){return new BPromise(function(_0x2491dc,_0x1f158e){return client['request'](_0x488096,_0x346655)[_0x3fa6('0xd')](function(_0x5b726d){logger['info'](_0x3fa6('0xe'),_0x278b63,'request\x20sent');logger[_0x3fa6('0xf')](_0x3fa6('0x10'),_0x278b63,'request\x20sent',JSON[_0x3fa6('0x11')](_0x5b726d));if(_0x5b726d['error']){if(_0x5b726d[_0x3fa6('0x12')]['code']===0x1f4){logger['error'](_0x3fa6('0xe'),_0x278b63,_0x5b726d[_0x3fa6('0x12')][_0x3fa6('0x13')]);return _0x1f158e(_0x5b726d['error']['message']);}logger[_0x3fa6('0x12')](_0x3fa6('0xe'),_0x278b63,_0x5b726d[_0x3fa6('0x12')][_0x3fa6('0x13')]);return _0x2491dc(_0x5b726d[_0x3fa6('0x12')][_0x3fa6('0x13')]);}else{logger[_0x3fa6('0x14')](_0x3fa6('0xe'),_0x278b63,'request\x20sent');_0x2491dc(_0x5b726d[_0x3fa6('0x15')][_0x3fa6('0x13')]);}})[_0x3fa6('0x16')](function(_0x36ed55){logger['error'](_0x3fa6('0xe'),_0x278b63,_0x36ed55);_0x1f158e(_0x36ed55);});});} \ No newline at end of file diff --git a/server/api/userMailQueue/index.js b/server/api/userMailQueue/index.js index de40d10..c03fd8d 100644 --- a/server/api/userMailQueue/index.js +++ b/server/api/userMailQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x1cf41d,_0x32c65d){var _0x2c9d02=function(_0x1b0c87){while(--_0x1b0c87){_0x1cf41d['push'](_0x1cf41d['shift']());}};_0x2c9d02(++_0x32c65d);}(_0xe706,0xa3));var _0x6e70=function(_0x1114dc,_0x50aed4){_0x1114dc=_0x1114dc-0x0;var _0x164894=_0xe706[_0x1114dc];return _0x164894;};'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 _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x21df86,_0x572ce5){var _0x9897df=function(_0x3107eb){while(--_0x3107eb){_0x21df86['push'](_0x21df86['shift']());}};_0x9897df(++_0x572ce5);}(_0x70e0,0x17b));var _0x070e=function(_0x57fc08,_0x5ef248){_0x57fc08=_0x57fc08-0x0;var _0x55836f=_0x70e0[_0x57fc08];return _0x55836f;};'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/userMailQueue/userMailQueue.attributes.js b/server/api/userMailQueue/userMailQueue.attributes.js index 41eb726..9d0325c 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 _0xd99d=['sequelize','INTEGER'];(function(_0x14772d,_0x489ace){var _0x49a203=function(_0x4cea95){while(--_0x4cea95){_0x14772d['push'](_0x14772d['shift']());}};_0x49a203(++_0x489ace);}(_0xd99d,0x1ae));var _0xdd99=function(_0x38e63e,_0x580c71){_0x38e63e=_0x38e63e-0x0;var _0x5204b3=_0xd99d[_0x38e63e];return _0x5204b3;};'use strict';var Sequelize=require(_0xdd99('0x0'));module['exports']={'penalty':{'type':Sequelize[_0xdd99('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0x9512=['exports','INTEGER','sequelize'];(function(_0x425867,_0x31ff8d){var _0x5a88df=function(_0x2818f7){while(--_0x2818f7){_0x425867['push'](_0x425867['shift']());}};_0x5a88df(++_0x31ff8d);}(_0x9512,0x1ac));var _0x2951=function(_0x7babd9,_0x1d1f5e){_0x7babd9=_0x7babd9-0x0;var _0x394174=_0x9512[_0x7babd9];return _0x394174;};'use strict';var Sequelize=require(_0x2951('0x0'));module[_0x2951('0x1')]={'penalty':{'type':Sequelize[_0x2951('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 119d038..941495c 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 _0xf8ec=['../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./userMailQueue.attributes','exports','define','UserMailQueue','user_has_mail_queues','lodash','util'];(function(_0x299784,_0xb0918f){var _0x5ab008=function(_0x49c1f5){while(--_0x49c1f5){_0x299784['push'](_0x299784['shift']());}};_0x5ab008(++_0xb0918f);}(_0xf8ec,0x8a));var _0xcf8e=function(_0x5608a3,_0x5b33c5){_0x5608a3=_0x5608a3-0x0;var _0x1ed50a=_0xf8ec[_0x5608a3];return _0x1ed50a;};'use strict';var _=require(_0xcf8e('0x0'));var util=require(_0xcf8e('0x1'));var logger=require(_0xcf8e('0x2'))(_0xcf8e('0x3'));var moment=require(_0xcf8e('0x4'));var BPromise=require(_0xcf8e('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xcf8e('0x6'));var rimraf=require(_0xcf8e('0x7'));var config=require(_0xcf8e('0x8'));var attributes=require(_0xcf8e('0x9'));module[_0xcf8e('0xa')]=function(_0x303426,_0x3a3b64){return _0x303426[_0xcf8e('0xb')](_0xcf8e('0xc'),attributes,{'tableName':_0xcf8e('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6268=['../../config/environment','define','UserMailQueue','user_has_mail_queues','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf'];(function(_0x542fc9,_0x19be0f){var _0x14f212=function(_0x13fa7a){while(--_0x13fa7a){_0x542fc9['push'](_0x542fc9['shift']());}};_0x14f212(++_0x19be0f);}(_0x6268,0x94));var _0x8626=function(_0x3dd238,_0x3f8be8){_0x3dd238=_0x3dd238-0x0;var _0x55e77b=_0x6268[_0x3dd238];return _0x55e77b;};'use strict';var _=require(_0x8626('0x0'));var util=require(_0x8626('0x1'));var logger=require(_0x8626('0x2'))(_0x8626('0x3'));var moment=require('moment');var BPromise=require(_0x8626('0x4'));var rp=require(_0x8626('0x5'));var fs=require('fs');var path=require(_0x8626('0x6'));var rimraf=require(_0x8626('0x7'));var config=require(_0x8626('0x8'));var attributes=require('./userMailQueue.attributes');module['exports']=function(_0x1365b4,_0x1d6ea9){return _0x1365b4[_0x8626('0x9')](_0x8626('0xa'),attributes,{'tableName':_0x8626('0xb'),'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 9e53a71..a037421 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 _0x5fc3=['../../config/environment','jayson/promise','request','then','info','request\x20sent','debug','stringify','error','code','message','UserMailQueue,\x20%s,\x20%s','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc'];(function(_0x5e26ea,_0x368228){var _0x2808ba=function(_0x427df3){while(--_0x427df3){_0x5e26ea['push'](_0x5e26ea['shift']());}};_0x2808ba(++_0x368228);}(_0x5fc3,0xa8));var _0x35fc=function(_0x1cec84,_0x101ec2){_0x1cec84=_0x1cec84-0x0;var _0x12b7d3=_0x5fc3[_0x1cec84];return _0x12b7d3;};'use strict';var _=require(_0x35fc('0x0'));var util=require(_0x35fc('0x1'));var moment=require('moment');var BPromise=require(_0x35fc('0x2'));var rs=require(_0x35fc('0x3'));var fs=require('fs');var Redis=require(_0x35fc('0x4'));var db=require(_0x35fc('0x5'))['db'];var utils=require(_0x35fc('0x6'));var logger=require('../../config/logger')(_0x35fc('0x7'));var config=require(_0x35fc('0x8'));var jayson=require(_0x35fc('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x19a0d1,_0x508b32,_0x16e153){return new BPromise(function(_0x27524f,_0xc72d93){return client[_0x35fc('0xa')](_0x19a0d1,_0x16e153)[_0x35fc('0xb')](function(_0xf9d3a6){logger[_0x35fc('0xc')]('UserMailQueue,\x20%s,\x20%s',_0x508b32,_0x35fc('0xd'));logger[_0x35fc('0xe')]('UserMailQueue,\x20%s,\x20%s,\x20%s',_0x508b32,_0x35fc('0xd'),JSON[_0x35fc('0xf')](_0xf9d3a6));if(_0xf9d3a6['error']){if(_0xf9d3a6[_0x35fc('0x10')][_0x35fc('0x11')]===0x1f4){logger['error']('UserMailQueue,\x20%s,\x20%s',_0x508b32,_0xf9d3a6[_0x35fc('0x10')]['message']);return _0xc72d93(_0xf9d3a6[_0x35fc('0x10')][_0x35fc('0x12')]);}logger[_0x35fc('0x10')](_0x35fc('0x13'),_0x508b32,_0xf9d3a6[_0x35fc('0x10')]['message']);return _0x27524f(_0xf9d3a6['error']['message']);}else{logger['info'](_0x35fc('0x13'),_0x508b32,_0x35fc('0xd'));_0x27524f(_0xf9d3a6[_0x35fc('0x14')][_0x35fc('0x12')]);}})[_0x35fc('0x15')](function(_0x1121fa){logger['error'](_0x35fc('0x13'),_0x508b32,_0x1121fa);_0xc72d93(_0x1121fa);});});} \ No newline at end of file +var _0x008c=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','UserMailQueue,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','UserMailQueue,\x20%s,\x20%s','message','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x008c,0x188));var _0xc008=function(_0x16e6db,_0x2e5a01){_0x16e6db=_0x16e6db-0x0;var _0x5a9151=_0x008c[_0x16e6db];return _0x5a9151;};'use strict';var _=require(_0xc008('0x0'));var util=require(_0xc008('0x1'));var moment=require(_0xc008('0x2'));var BPromise=require(_0xc008('0x3'));var rs=require(_0xc008('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc008('0x5'))['db'];var utils=require(_0xc008('0x6'));var logger=require(_0xc008('0x7'))(_0xc008('0x8'));var config=require(_0xc008('0x9'));var jayson=require(_0xc008('0xa'));var client=jayson[_0xc008('0xb')][_0xc008('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x9c8cb2,_0x4af530,_0x428fa9){return new BPromise(function(_0x5aa09b,_0x30be38){return client['request'](_0x9c8cb2,_0x428fa9)['then'](function(_0x27830d){logger[_0xc008('0xd')]('UserMailQueue,\x20%s,\x20%s',_0x4af530,'request\x20sent');logger['debug'](_0xc008('0xe'),_0x4af530,_0xc008('0xf'),JSON['stringify'](_0x27830d));if(_0x27830d[_0xc008('0x10')]){if(_0x27830d[_0xc008('0x10')][_0xc008('0x11')]===0x1f4){logger[_0xc008('0x10')](_0xc008('0x12'),_0x4af530,_0x27830d[_0xc008('0x10')][_0xc008('0x13')]);return _0x30be38(_0x27830d['error']['message']);}logger[_0xc008('0x10')]('UserMailQueue,\x20%s,\x20%s',_0x4af530,_0x27830d[_0xc008('0x10')][_0xc008('0x13')]);return _0x5aa09b(_0x27830d[_0xc008('0x10')][_0xc008('0x13')]);}else{logger[_0xc008('0xd')]('UserMailQueue,\x20%s,\x20%s',_0x4af530,'request\x20sent');_0x5aa09b(_0x27830d['result'][_0xc008('0x13')]);}})[_0xc008('0x14')](function(_0x3cafe3){logger[_0xc008('0x10')]('UserMailQueue,\x20%s,\x20%s',_0x4af530,_0x3cafe3);_0x30be38(_0x3cafe3);});});} \ No newline at end of file diff --git a/server/api/userNotification/index.js b/server/api/userNotification/index.js index d4e0d23..e2c4abb 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 _0x1c72=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./userNotification.controller','exports','path'];(function(_0x2c0b18,_0x20b8d0){var _0x3af0b3=function(_0x1d3a6b){while(--_0x1d3a6b){_0x2c0b18['push'](_0x2c0b18['shift']());}};_0x3af0b3(++_0x20b8d0);}(_0x1c72,0x1ad));var _0x21c7=function(_0x575e5f,_0x36289f){_0x575e5f=_0x575e5f-0x0;var _0x5a7b06=_0x1c72[_0x575e5f];return _0x5a7b06;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x21c7('0x0'));var timeout=require(_0x21c7('0x1'));var express=require(_0x21c7('0x2'));var router=express[_0x21c7('0x3')]();var fs_extra=require(_0x21c7('0x4'));var auth=require(_0x21c7('0x5'));var interaction=require(_0x21c7('0x6'));var config=require(_0x21c7('0x7'));var controller=require(_0x21c7('0x8'));router['post']('/',auth['isAuthenticated'](),controller['sendUserNotification']);module[_0x21c7('0x9')]=router; \ No newline at end of file +var _0x2b5c=['exports','multer','util','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./userNotification.controller'];(function(_0x369151,_0x179f72){var _0x4292d5=function(_0x330422){while(--_0x330422){_0x369151['push'](_0x369151['shift']());}};_0x4292d5(++_0x179f72);}(_0x2b5c,0x1c3));var _0xc2b5=function(_0x2612dd,_0x1b3ed){_0x2612dd=_0x2612dd-0x0;var _0x15af02=_0x2b5c[_0x2612dd];return _0x15af02;};'use strict';var multer=require(_0xc2b5('0x0'));var util=require(_0xc2b5('0x1'));var path=require(_0xc2b5('0x2'));var timeout=require('connect-timeout');var express=require(_0xc2b5('0x3'));var router=express[_0xc2b5('0x4')]();var fs_extra=require(_0xc2b5('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xc2b5('0x6'));var config=require(_0xc2b5('0x7'));var controller=require(_0xc2b5('0x8'));router['post']('/',auth['isAuthenticated'](),controller['sendUserNotification']);module[_0xc2b5('0x9')]=router; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.attributes.js b/server/api/userNotification/userNotification.attributes.js index 6edfc4e..77e7b7c 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 _0x7c18=['exports','TEXT','STRING','BOOLEAN','sequelize'];(function(_0x48668b,_0xe95867){var _0x4e48b2=function(_0x53c33c){while(--_0x53c33c){_0x48668b['push'](_0x48668b['shift']());}};_0x4e48b2(++_0xe95867);}(_0x7c18,0x176));var _0x87c1=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x7c18[_0x501510];return _0x1e6ee5;};'use strict';var Sequelize=require(_0x87c1('0x0'));module[_0x87c1('0x1')]={'body':{'type':Sequelize[_0x87c1('0x2')]},'senderName':{'type':Sequelize['STRING']},'recipientsId':{'type':Sequelize[_0x87c1('0x2')]},'recipientsDescription':{'type':Sequelize[_0x87c1('0x3')]},'beep':{'type':Sequelize[_0x87c1('0x4')]}}; \ No newline at end of file +var _0x3e03=['STRING','BOOLEAN','exports','TEXT'];(function(_0x22a37a,_0x56c975){var _0x35a731=function(_0x590012){while(--_0x590012){_0x22a37a['push'](_0x22a37a['shift']());}};_0x35a731(++_0x56c975);}(_0x3e03,0x12a));var _0x33e0=function(_0xd09668,_0x1435b2){_0xd09668=_0xd09668-0x0;var _0x68726=_0x3e03[_0xd09668];return _0x68726;};'use strict';var Sequelize=require('sequelize');module[_0x33e0('0x0')]={'body':{'type':Sequelize[_0x33e0('0x1')]},'senderName':{'type':Sequelize[_0x33e0('0x2')]},'recipientsId':{'type':Sequelize['TEXT']},'recipientsDescription':{'type':Sequelize[_0x33e0('0x2')]},'beep':{'type':Sequelize[_0x33e0('0x3')]}}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.controller.js b/server/api/userNotification/userNotification.controller.js index 4b72e52..3fcf5f7 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 _0x0cc7=['count','limit','set','Content-Range','apply','reject','save','then','stack','name','send','hasOwnProperty','text','body','TemplateId','Sequelize','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','view','ValidationError','recipients','error','Invalid\x20\x27recipients\x27\x20object','chatqueue','mailqueue','openchannelqueue','smsqueue','voicequeue','whatsappqueue','team','some','model','senderName','user','recipientsDescription','beep','SenderId','sortBy','join','sequelize','transaction','UserNotification','create','forEach','recipient','emit','userNotification:send','Template','findOne','Invalid\x20\x27TemplateId\x27\x20parameter','render','catch','startCase','toLowerCase','User','union','ids','queue','replace','Queue','all','flatten','map','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','defaults','redis','localhost','./userNotification.socket','register','sendStatus','status','end','json','offset','undefined'];(function(_0x568039,_0x570f8e){var _0x1595fc=function(_0x50ac8f){while(--_0x50ac8f){_0x568039['push'](_0x568039['shift']());}};_0x1595fc(++_0x570f8e);}(_0x0cc7,0xa1));var _0x70cc=function(_0x28aea5,_0x3bb12e){_0x28aea5=_0x28aea5-0x0;var _0x6a55f9=_0x0cc7[_0x28aea5];return _0x6a55f9;};'use strict';var emlformat=require(_0x70cc('0x0'));var rimraf=require(_0x70cc('0x1'));var zipdir=require(_0x70cc('0x2'));var jsonpatch=require(_0x70cc('0x3'));var rp=require(_0x70cc('0x4'));var moment=require(_0x70cc('0x5'));var BPromise=require(_0x70cc('0x6'));var Mustache=require(_0x70cc('0x7'));var util=require(_0x70cc('0x8'));var path=require('path');var sox=require('sox');var csv=require(_0x70cc('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x70cc('0xa'));var squel=require(_0x70cc('0xb'));var crypto=require(_0x70cc('0xc'));var jsforce=require(_0x70cc('0xd'));var deskjs=require(_0x70cc('0xe'));var toCsv=require(_0x70cc('0x9'));var querystring=require(_0x70cc('0xf'));var Papa=require(_0x70cc('0x10'));var Redis=require(_0x70cc('0x11'));var authService=require(_0x70cc('0x12'));var qs=require(_0x70cc('0x13'));var as=require(_0x70cc('0x14'));var hardwareService=require(_0x70cc('0x15'));var logger=require('../../config/logger')(_0x70cc('0x16'));var utils=require(_0x70cc('0x17'));var config=require(_0x70cc('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x70cc('0x19'))['db'];config['redis']=_[_0x70cc('0x1a')](config[_0x70cc('0x1b')],{'host':_0x70cc('0x1c'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x70cc('0x1b')]));require(_0x70cc('0x1d'))[_0x70cc('0x1e')](socket);function respondWithStatusCode(_0x567b9f,_0x4e8158){_0x4e8158=_0x4e8158||0xcc;return function(_0x427a3b){if(_0x427a3b){return _0x567b9f[_0x70cc('0x1f')](_0x4e8158);}return _0x567b9f[_0x70cc('0x20')](_0x4e8158)[_0x70cc('0x21')]();};}function respondWithResult(_0x4e86f3,_0xb796a3){_0xb796a3=_0xb796a3||0xc8;return function(_0x5ca355){if(_0x5ca355){return _0x4e86f3[_0x70cc('0x20')](_0xb796a3)[_0x70cc('0x22')](_0x5ca355);}};}function respondWithFilteredResult(_0x1354d4,_0x2a999a){return function(_0x3b1e20){if(_0x3b1e20){var _0x3a09c2=typeof _0x2a999a[_0x70cc('0x23')]===_0x70cc('0x24')&&typeof _0x2a999a['limit']===_0x70cc('0x24');var _0x32a4b7=_0x3b1e20['count'];var _0x36194d=_0x3a09c2?0x0:_0x2a999a['offset'];var _0x428083=_0x3a09c2?_0x3b1e20[_0x70cc('0x25')]:_0x2a999a[_0x70cc('0x23')]+_0x2a999a[_0x70cc('0x26')];var _0x51b0c2;if(_0x428083>=_0x32a4b7){_0x428083=_0x32a4b7;_0x51b0c2=0xc8;}else{_0x51b0c2=0xce;}_0x1354d4[_0x70cc('0x20')](_0x51b0c2);return _0x1354d4[_0x70cc('0x27')](_0x70cc('0x28'),_0x36194d+'-'+_0x428083+'/'+_0x32a4b7)[_0x70cc('0x22')](_0x3b1e20);}return null;};}function patchUpdates(_0x1e08ba){return function(_0x2bb02b){try{jsonpatch[_0x70cc('0x29')](_0x2bb02b,_0x1e08ba,!![]);}catch(_0x53329e){return BPromise[_0x70cc('0x2a')](_0x53329e);}return _0x2bb02b[_0x70cc('0x2b')]();};}function saveUpdates(_0x5a4d49,_0x2205da){return function(_0x225421){if(_0x225421){return _0x225421['update'](_0x5a4d49)[_0x70cc('0x2c')](function(_0x49a563){return _0x49a563;});}return null;};}function removeEntity(_0x2c1c77,_0x666e18){return function(_0x3583d9){if(_0x3583d9){return _0x3583d9['destroy']()[_0x70cc('0x2c')](function(){_0x2c1c77[_0x70cc('0x20')](0xcc)[_0x70cc('0x21')]();});}};}function handleEntityNotFound(_0x348558,_0x24e3e2){return function(_0x13fa9e){if(!_0x13fa9e){_0x348558[_0x70cc('0x1f')](0x194);}return _0x13fa9e;};}function handleError(_0x5c03fd,_0x5cabe5){_0x5cabe5=_0x5cabe5||0x1f4;return function(_0x5adf96){logger['error'](_0x5adf96[_0x70cc('0x2d')]);if(_0x5adf96[_0x70cc('0x2e')]){delete _0x5adf96['name'];}_0x5c03fd['status'](_0x5cabe5)[_0x70cc('0x2f')](_0x5adf96);};}exports['sendUserNotification']=function(_0x29bd6a,_0xa82c54,_0x29c775){if(!_0x29bd6a['body'][_0x70cc('0x30')](_0x70cc('0x31'))&&!_0x29bd6a[_0x70cc('0x32')]['hasOwnProperty'](_0x70cc('0x33'))){throw new db[(_0x70cc('0x34'))]['ValidationError'](_0x70cc('0x35'));}else{if(_0x29bd6a[_0x70cc('0x32')][_0x70cc('0x30')]('TemplateId')&&!_0x29bd6a['body'][_0x70cc('0x30')](_0x70cc('0x36'))){throw new db[(_0x70cc('0x34'))][(_0x70cc('0x37'))]('Missing\x20\x27view\x27\x20parameter');}if(!_0x29bd6a['body'][_0x70cc('0x30')](_0x70cc('0x38'))){throw new db[(_0x70cc('0x34'))][(_0x70cc('0x37'))]('Missing\x20\x27recipients\x27\x20parameter');}else{try{var _0x4a1c2b=JSON['parse'](_0x29bd6a[_0x70cc('0x32')][_0x70cc('0x38')]);}catch(_0x5bd0c6){logger[_0x70cc('0x39')](_0x5bd0c6);throw new db[(_0x70cc('0x34'))][(_0x70cc('0x37'))](_0x70cc('0x3a'));}var _0x11b1ab=[_0x70cc('0x3b'),'faxqueue',_0x70cc('0x3c'),_0x70cc('0x3d'),_0x70cc('0x3e'),_0x70cc('0x3f'),_0x70cc('0x40'),_0x70cc('0x41'),'user'];if(_[_0x70cc('0x42')](_0x4a1c2b,function(_0x5c95e6){return!_['includes'](_0x11b1ab,_0x5c95e6[_0x70cc('0x43')]['toLowerCase']());})){throw new db[(_0x70cc('0x34'))][(_0x70cc('0x37'))]('Invalid\x20model\x20in\x20\x27recipients\x27\x20object');}}}var _0x41e737={};_0x41e737['senderName']=_0x29bd6a[_0x70cc('0x32')]['hasOwnProperty']('senderName')?_0x29bd6a[_0x70cc('0x32')][_0x70cc('0x44')]:_0x29bd6a[_0x70cc('0x45')]['fullname'];_0x41e737[_0x70cc('0x46')]=_['isEmpty'](_0x29bd6a[_0x70cc('0x32')]['recipientsDescription'])?null:_0x29bd6a[_0x70cc('0x32')]['recipientsDescription'];_0x41e737['beep']=_0x29bd6a[_0x70cc('0x32')][_0x70cc('0x47')]||![];_0x41e737[_0x70cc('0x48')]=_0x29bd6a[_0x70cc('0x45')]['id'];return getContent(_0x29bd6a[_0x70cc('0x32')])['then'](function(_0x563cb6){_0x41e737[_0x70cc('0x32')]=_0x563cb6;return getRecipients(_0x4a1c2b);})[_0x70cc('0x2c')](function(_0x3b3295){_0x41e737['recipientsId']=_[_0x70cc('0x49')](_0x3b3295)[_0x70cc('0x4a')](',');return db[_0x70cc('0x4b')][_0x70cc('0x4c')](function(_0x298b5e){return db[_0x70cc('0x4d')][_0x70cc('0x4e')](_0x41e737,{'raw':!![],'transaction':_0x298b5e})['then'](function(_0x1c96db){var _0xcb789a={'sender':_0x41e737[_0x70cc('0x44')],'description':_0x41e737['recipientsDescription'],'content':_0x41e737[_0x70cc('0x32')],'beep':_0x41e737[_0x70cc('0x47')]};_0x3b3295[_0x70cc('0x4f')](function(_0x5e904f){_0xcb789a[_0x70cc('0x50')]=_0x5e904f;socket[_0x70cc('0x51')](_0x70cc('0x52'),_0xcb789a);});return _0x1c96db;});});})[_0x70cc('0x2c')](respondWithResult(_0xa82c54,0xc9))['catch'](handleError(_0xa82c54,null));};function getContent(_0x59ef31){return new BPromise(function(_0x23cfd8,_0x24e9be){if(_0x59ef31[_0x70cc('0x31')]){_0x23cfd8(_0x59ef31[_0x70cc('0x31')]);return;}return db[_0x70cc('0x53')][_0x70cc('0x54')]({'attributes':['html'],'where':{'id':_0x59ef31[_0x70cc('0x33')]},'raw':!![]})['then'](function(_0x4027e1){if(!_0x4027e1)throw new db[(_0x70cc('0x34'))][(_0x70cc('0x37'))](_0x70cc('0x55'));var _0x54112e=Mustache[_0x70cc('0x56')](_0x4027e1['html'],_0x59ef31[_0x70cc('0x36')]);_0x23cfd8(_0x54112e);})[_0x70cc('0x57')](function(_0x1ca529){_0x24e9be(_0x1ca529);});});}function getRecipients(_0x30bdb5){return new BPromise(function(_0x3e14cb,_0x9d081){var _0x26c4e7=[];var _0x1ad775=[];_0x30bdb5['forEach'](function(_0x5db44f){var _0x398951=_[_0x70cc('0x58')](_0x5db44f[_0x70cc('0x43')][_0x70cc('0x59')]());if(_0x398951===_0x70cc('0x5a')){_0x26c4e7=_[_0x70cc('0x5b')](_0x26c4e7,_0x5db44f[_0x70cc('0x5c')]);}else{if(_['includes'](_0x398951,_0x70cc('0x5d')))_0x398951=_0x398951[_0x70cc('0x5e')](_0x70cc('0x5d'),_0x70cc('0x5f'));_0x5db44f['ids']['forEach'](function(_0x47558a){_0x1ad775['push'](getAgents(_0x398951,_0x47558a));});}});return BPromise[_0x70cc('0x60')](_0x1ad775)['then'](function(_0x11090c){_0x26c4e7=_['union'](_0x26c4e7,_[_0x70cc('0x61')](_0x11090c));_0x3e14cb(_0x26c4e7);})[_0x70cc('0x57')](function(_0x11edef){_0x9d081(_0x11edef);});});}function getAgents(_0x3abf59,_0x1772e9){return new BPromise(function(_0x3219f9,_0x2a3819){return db[_0x3abf59]['findOne']({'where':{'id':_0x1772e9}})[_0x70cc('0x2c')](function(_0x564597){return _0x564597['getAgents']({'attributes':['id'],'raw':!![]})['then'](function(_0x1c43d7){var _0x4d4bab=_[_0x70cc('0x62')](_0x1c43d7,'id');_0x3219f9(_0x4d4bab);});})['catch'](function(_0x469e1e){_0x2a3819(_0x469e1e);});});} \ No newline at end of file +var _0xa55e=['openchannelqueue','smsqueue','voicequeue','whatsappqueue','team','user','some','includes','model','toLowerCase','senderName','fullname','recipientsDescription','isEmpty','beep','SenderId','then','recipientsId','sequelize','transaction','UserNotification','create','forEach','emit','userNotification:send','catch','findOne','html','Invalid\x20\x27TemplateId\x27\x20parameter','render','startCase','User','union','ids','queue','replace','Queue','all','getAgents','map','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','register','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','destroy','end','error','stack','name','send','sendUserNotification','body','hasOwnProperty','text','TemplateId','Sequelize','ValidationError','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','view','Missing\x20\x27view\x27\x20parameter','recipients','Missing\x20\x27recipients\x27\x20parameter','Invalid\x20\x27recipients\x27\x20object','chatqueue','mailqueue'];(function(_0x540041,_0x388ca0){var _0x5a4898=function(_0x18a165){while(--_0x18a165){_0x540041['push'](_0x540041['shift']());}};_0x5a4898(++_0x388ca0);}(_0xa55e,0x94));var _0xea55=function(_0x44cbde,_0x2bcb1b){_0x44cbde=_0x44cbde-0x0;var _0x27c329=_0xa55e[_0x44cbde];return _0x27c329;};'use strict';var emlformat=require(_0xea55('0x0'));var rimraf=require(_0xea55('0x1'));var zipdir=require(_0xea55('0x2'));var jsonpatch=require(_0xea55('0x3'));var rp=require(_0xea55('0x4'));var moment=require(_0xea55('0x5'));var BPromise=require(_0xea55('0x6'));var Mustache=require(_0xea55('0x7'));var util=require('util');var path=require(_0xea55('0x8'));var sox=require(_0xea55('0x9'));var csv=require(_0xea55('0xa'));var ejs=require(_0xea55('0xb'));var fs=require('fs');var fs_extra=require(_0xea55('0xc'));var _=require(_0xea55('0xd'));var squel=require(_0xea55('0xe'));var crypto=require(_0xea55('0xf'));var jsforce=require(_0xea55('0x10'));var deskjs=require(_0xea55('0x11'));var toCsv=require('to-csv');var querystring=require(_0xea55('0x12'));var Papa=require(_0xea55('0x13'));var Redis=require(_0xea55('0x14'));var authService=require(_0xea55('0x15'));var qs=require('../../components/parsers/qs');var as=require(_0xea55('0x16'));var hardwareService=require(_0xea55('0x17'));var logger=require(_0xea55('0x18'))(_0xea55('0x19'));var utils=require(_0xea55('0x1a'));var config=require(_0xea55('0x1b'));var licenseUtil=require(_0xea55('0x1c'));var db=require(_0xea55('0x1d'))['db'];config['redis']=_[_0xea55('0x1e')](config[_0xea55('0x1f')],{'host':_0xea55('0x20'),'port':0x18eb});var socket=require(_0xea55('0x21'))(new Redis(config[_0xea55('0x1f')]));require('./userNotification.socket')[_0xea55('0x22')](socket);function respondWithStatusCode(_0x472245,_0x2a61ee){_0x2a61ee=_0x2a61ee||0xcc;return function(_0x53cabd){if(_0x53cabd){return _0x472245[_0xea55('0x23')](_0x2a61ee);}return _0x472245[_0xea55('0x24')](_0x2a61ee)['end']();};}function respondWithResult(_0x5992a0,_0x1014da){_0x1014da=_0x1014da||0xc8;return function(_0x44fef2){if(_0x44fef2){return _0x5992a0[_0xea55('0x24')](_0x1014da)[_0xea55('0x25')](_0x44fef2);}};}function respondWithFilteredResult(_0x4145aa,_0x244178){return function(_0x39f351){if(_0x39f351){var _0x7e39dd=typeof _0x244178[_0xea55('0x26')]===_0xea55('0x27')&&typeof _0x244178[_0xea55('0x28')]===_0xea55('0x27');var _0x244209=_0x39f351[_0xea55('0x29')];var _0x3e87cf=_0x7e39dd?0x0:_0x244178[_0xea55('0x26')];var _0x58c16a=_0x7e39dd?_0x39f351['count']:_0x244178['offset']+_0x244178[_0xea55('0x28')];var _0x35d203;if(_0x58c16a>=_0x244209){_0x58c16a=_0x244209;_0x35d203=0xc8;}else{_0x35d203=0xce;}_0x4145aa[_0xea55('0x24')](_0x35d203);return _0x4145aa[_0xea55('0x2a')](_0xea55('0x2b'),_0x3e87cf+'-'+_0x58c16a+'/'+_0x244209)[_0xea55('0x25')](_0x39f351);}return null;};}function patchUpdates(_0x1bbcfd){return function(_0x442d3a){try{jsonpatch['apply'](_0x442d3a,_0x1bbcfd,!![]);}catch(_0x315a93){return BPromise[_0xea55('0x2c')](_0x315a93);}return _0x442d3a[_0xea55('0x2d')]();};}function saveUpdates(_0x1db05d,_0x18d46d){return function(_0x3104af){if(_0x3104af){return _0x3104af[_0xea55('0x2e')](_0x1db05d)['then'](function(_0x44478f){return _0x44478f;});}return null;};}function removeEntity(_0x2350cc,_0x5f1241){return function(_0xc95329){if(_0xc95329){return _0xc95329[_0xea55('0x2f')]()['then'](function(){_0x2350cc[_0xea55('0x24')](0xcc)[_0xea55('0x30')]();});}};}function handleEntityNotFound(_0x3235f3,_0x26d0c4){return function(_0x1b22f0){if(!_0x1b22f0){_0x3235f3[_0xea55('0x23')](0x194);}return _0x1b22f0;};}function handleError(_0x124332,_0x5ce9f5){_0x5ce9f5=_0x5ce9f5||0x1f4;return function(_0x401c63){logger[_0xea55('0x31')](_0x401c63[_0xea55('0x32')]);if(_0x401c63[_0xea55('0x33')]){delete _0x401c63[_0xea55('0x33')];}_0x124332['status'](_0x5ce9f5)[_0xea55('0x34')](_0x401c63);};}exports[_0xea55('0x35')]=function(_0x35723f,_0x42d8b2,_0x3a99e7){if(!_0x35723f[_0xea55('0x36')][_0xea55('0x37')](_0xea55('0x38'))&&!_0x35723f[_0xea55('0x36')][_0xea55('0x37')](_0xea55('0x39'))){throw new db[(_0xea55('0x3a'))][(_0xea55('0x3b'))](_0xea55('0x3c'));}else{if(_0x35723f['body'][_0xea55('0x37')]('TemplateId')&&!_0x35723f[_0xea55('0x36')][_0xea55('0x37')](_0xea55('0x3d'))){throw new db[(_0xea55('0x3a'))]['ValidationError'](_0xea55('0x3e'));}if(!_0x35723f[_0xea55('0x36')][_0xea55('0x37')](_0xea55('0x3f'))){throw new db['Sequelize']['ValidationError'](_0xea55('0x40'));}else{try{var _0x1c4976=JSON['parse'](_0x35723f[_0xea55('0x36')]['recipients']);}catch(_0x42c73a){logger[_0xea55('0x31')](_0x42c73a);throw new db[(_0xea55('0x3a'))][(_0xea55('0x3b'))](_0xea55('0x41'));}var _0x1f5a74=[_0xea55('0x42'),'faxqueue',_0xea55('0x43'),_0xea55('0x44'),_0xea55('0x45'),_0xea55('0x46'),_0xea55('0x47'),_0xea55('0x48'),_0xea55('0x49')];if(_[_0xea55('0x4a')](_0x1c4976,function(_0x404c98){return!_[_0xea55('0x4b')](_0x1f5a74,_0x404c98[_0xea55('0x4c')][_0xea55('0x4d')]());})){throw new db[(_0xea55('0x3a'))]['ValidationError']('Invalid\x20model\x20in\x20\x27recipients\x27\x20object');}}}var _0x3fab6e={};_0x3fab6e['senderName']=_0x35723f[_0xea55('0x36')][_0xea55('0x37')](_0xea55('0x4e'))?_0x35723f['body']['senderName']:_0x35723f[_0xea55('0x49')][_0xea55('0x4f')];_0x3fab6e[_0xea55('0x50')]=_[_0xea55('0x51')](_0x35723f[_0xea55('0x36')][_0xea55('0x50')])?null:_0x35723f[_0xea55('0x36')][_0xea55('0x50')];_0x3fab6e[_0xea55('0x52')]=_0x35723f[_0xea55('0x36')][_0xea55('0x52')]||![];_0x3fab6e[_0xea55('0x53')]=_0x35723f[_0xea55('0x49')]['id'];return getContent(_0x35723f[_0xea55('0x36')])['then'](function(_0x1e3438){_0x3fab6e[_0xea55('0x36')]=_0x1e3438;return getRecipients(_0x1c4976);})[_0xea55('0x54')](function(_0x1e210c){_0x3fab6e[_0xea55('0x55')]=_['sortBy'](_0x1e210c)['join'](',');return db[_0xea55('0x56')][_0xea55('0x57')](function(_0x4a7ee1){return db[_0xea55('0x58')][_0xea55('0x59')](_0x3fab6e,{'raw':!![],'transaction':_0x4a7ee1})[_0xea55('0x54')](function(_0x316436){var _0x2a1811={'sender':_0x3fab6e[_0xea55('0x4e')],'description':_0x3fab6e[_0xea55('0x50')],'content':_0x3fab6e[_0xea55('0x36')],'beep':_0x3fab6e[_0xea55('0x52')]};_0x1e210c[_0xea55('0x5a')](function(_0xb0236e){_0x2a1811['recipient']=_0xb0236e;socket[_0xea55('0x5b')](_0xea55('0x5c'),_0x2a1811);});return _0x316436;});});})[_0xea55('0x54')](respondWithResult(_0x42d8b2,0xc9))[_0xea55('0x5d')](handleError(_0x42d8b2,null));};function getContent(_0x487d7c){return new BPromise(function(_0x2ebe01,_0x5ae8c9){if(_0x487d7c[_0xea55('0x38')]){_0x2ebe01(_0x487d7c['text']);return;}return db['Template'][_0xea55('0x5e')]({'attributes':[_0xea55('0x5f')],'where':{'id':_0x487d7c[_0xea55('0x39')]},'raw':!![]})[_0xea55('0x54')](function(_0x1e09e6){if(!_0x1e09e6)throw new db[(_0xea55('0x3a'))][(_0xea55('0x3b'))](_0xea55('0x60'));var _0x3403ce=Mustache[_0xea55('0x61')](_0x1e09e6['html'],_0x487d7c[_0xea55('0x3d')]);_0x2ebe01(_0x3403ce);})[_0xea55('0x5d')](function(_0x1829fb){_0x5ae8c9(_0x1829fb);});});}function getRecipients(_0xf24a36){return new BPromise(function(_0x12d20d,_0x31ea43){var _0x2ba99b=[];var _0x5aac35=[];_0xf24a36[_0xea55('0x5a')](function(_0x300f16){var _0x4c4395=_[_0xea55('0x62')](_0x300f16[_0xea55('0x4c')][_0xea55('0x4d')]());if(_0x4c4395===_0xea55('0x63')){_0x2ba99b=_[_0xea55('0x64')](_0x2ba99b,_0x300f16[_0xea55('0x65')]);}else{if(_[_0xea55('0x4b')](_0x4c4395,_0xea55('0x66')))_0x4c4395=_0x4c4395[_0xea55('0x67')](_0xea55('0x66'),_0xea55('0x68'));_0x300f16[_0xea55('0x65')][_0xea55('0x5a')](function(_0x51467c){_0x5aac35['push'](getAgents(_0x4c4395,_0x51467c));});}});return BPromise[_0xea55('0x69')](_0x5aac35)['then'](function(_0x19a39b){_0x2ba99b=_['union'](_0x2ba99b,_['flatten'](_0x19a39b));_0x12d20d(_0x2ba99b);})[_0xea55('0x5d')](function(_0x1be653){_0x31ea43(_0x1be653);});});}function getAgents(_0x38714f,_0x4e213b){return new BPromise(function(_0x2640f6,_0x203ceb){return db[_0x38714f][_0xea55('0x5e')]({'where':{'id':_0x4e213b}})[_0xea55('0x54')](function(_0x469af0){return _0x469af0[_0xea55('0x6a')]({'attributes':['id'],'raw':!![]})[_0xea55('0x54')](function(_0x5bc854){var _0x49a85e=_[_0xea55('0x6b')](_0x5bc854,'id');_0x2640f6(_0x49a85e);});})[_0xea55('0x5d')](function(_0x5078f0){_0x203ceb(_0x5078f0);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.events.js b/server/api/userNotification/userNotification.events.js index 453f90b..8e49942 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 _0xcf2d=['events','../../mysqldb','UserNotification','setMaxListeners','save','update','emit','hasOwnProperty','hook','exports'];(function(_0x1e7b16,_0x4607a1){var _0x37fadc=function(_0x1fc9ce){while(--_0x1fc9ce){_0x1e7b16['push'](_0x1e7b16['shift']());}};_0x37fadc(++_0x4607a1);}(_0xcf2d,0x82));var _0xdcf2=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xcf2d[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0xdcf2('0x0'));var UserNotification=require(_0xdcf2('0x1'))['db'][_0xdcf2('0x2')];var UserNotificationEvents=new EventEmitter();UserNotificationEvents[_0xdcf2('0x3')](0x0);var events={'afterCreate':_0xdcf2('0x4'),'afterUpdate':_0xdcf2('0x5'),'afterDestroy':'remove'};function emitEvent(_0x73bac){return function(_0x3469bf,_0x26f923,_0x411e19){UserNotificationEvents[_0xdcf2('0x6')](_0x73bac+':'+_0x3469bf['id'],_0x3469bf);UserNotificationEvents[_0xdcf2('0x6')](_0x73bac,_0x3469bf);_0x411e19(null);};}for(var e in events){if(events[_0xdcf2('0x7')](e)){var event=events[e];UserNotification[_0xdcf2('0x8')](e,emitEvent(event));}}module[_0xdcf2('0x9')]=UserNotificationEvents; \ No newline at end of file +var _0xc280=['../../mysqldb','UserNotification','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x499b6e,_0x503e38){var _0x3f35f1=function(_0x38ec5a){while(--_0x38ec5a){_0x499b6e['push'](_0x499b6e['shift']());}};_0x3f35f1(++_0x503e38);}(_0xc280,0xdb));var _0x0c28=function(_0x430c88,_0x586985){_0x430c88=_0x430c88-0x0;var _0x1a8724=_0xc280[_0x430c88];return _0x1a8724;};'use strict';var EventEmitter=require(_0x0c28('0x0'));var UserNotification=require(_0x0c28('0x1'))['db'][_0x0c28('0x2')];var UserNotificationEvents=new EventEmitter();UserNotificationEvents[_0x0c28('0x3')](0x0);var events={'afterCreate':_0x0c28('0x4'),'afterUpdate':_0x0c28('0x5'),'afterDestroy':_0x0c28('0x6')};function emitEvent(_0x1e0320){return function(_0x509db3,_0x24afab,_0x105386){UserNotificationEvents[_0x0c28('0x7')](_0x1e0320+':'+_0x509db3['id'],_0x509db3);UserNotificationEvents[_0x0c28('0x7')](_0x1e0320,_0x509db3);_0x105386(null);};}for(var e in events){if(events[_0x0c28('0x8')](e)){var event=events[e];UserNotification[_0x0c28('0x9')](e,emitEvent(event));}}module[_0x0c28('0xa')]=UserNotificationEvents; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.model.js b/server/api/userNotification/userNotification.model.js index 215ccf3..5b9aab6 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 _0xa643=['utf8mb4_unicode_ci','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./userNotification.attributes','define','UserNotification','userNotifications','utf8mb4'];(function(_0x1fa672,_0x2cf955){var _0x5b5d61=function(_0x462e0e){while(--_0x462e0e){_0x1fa672['push'](_0x1fa672['shift']());}};_0x5b5d61(++_0x2cf955);}(_0xa643,0xa9));var _0x3a64=function(_0x6f82b4,_0x23fffe){_0x6f82b4=_0x6f82b4-0x0;var _0x358d04=_0xa643[_0x6f82b4];return _0x358d04;};'use strict';var _=require('lodash');var util=require(_0x3a64('0x0'));var logger=require(_0x3a64('0x1'))(_0x3a64('0x2'));var moment=require('moment');var BPromise=require(_0x3a64('0x3'));var rp=require(_0x3a64('0x4'));var fs=require('fs');var path=require(_0x3a64('0x5'));var rimraf=require(_0x3a64('0x6'));var config=require(_0x3a64('0x7'));var attributes=require(_0x3a64('0x8'));module['exports']=function(_0x87ca0,_0x4eaf95){return _0x87ca0[_0x3a64('0x9')](_0x3a64('0xa'),attributes,{'tableName':_0x3a64('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x3a64('0xc'),'collate':_0x3a64('0xd')});}; \ No newline at end of file +var _0x791e=['exports','userNotifications','utf8mb4','util','api','moment','bluebird','path','rimraf','../../config/environment','./userNotification.attributes'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x791e,0x1d1));var _0xe791=function(_0x3540f8,_0x2a9c23){_0x3540f8=_0x3540f8-0x0;var _0x79166a=_0x791e[_0x3540f8];return _0x79166a;};'use strict';var _=require('lodash');var util=require(_0xe791('0x0'));var logger=require('../../config/logger')(_0xe791('0x1'));var moment=require(_0xe791('0x2'));var BPromise=require(_0xe791('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe791('0x4'));var rimraf=require(_0xe791('0x5'));var config=require(_0xe791('0x6'));var attributes=require(_0xe791('0x7'));module[_0xe791('0x8')]=function(_0x19bde9,_0x4227b1){return _0x19bde9['define']('UserNotification',attributes,{'tableName':_0xe791('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xe791('0xa'),'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 8746c6b..7d1a5db 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 _0xbe71=['ioredis','../../config/utils','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./userNotification.socket','register','request','then','info','debug','UserNotification,\x20%s,\x20%s,\x20%s','stringify','error','code','message','util','moment','bluebird','randomstring'];(function(_0x1566af,_0x31cf29){var _0x5a57a4=function(_0x421d13){while(--_0x421d13){_0x1566af['push'](_0x1566af['shift']());}};_0x5a57a4(++_0x31cf29);}(_0xbe71,0x1be));var _0x1be7=function(_0x560948,_0x1253ba){_0x560948=_0x560948-0x0;var _0x6b757b=_0xbe71[_0x560948];return _0x6b757b;};'use strict';var _=require('lodash');var util=require(_0x1be7('0x0'));var moment=require(_0x1be7('0x1'));var BPromise=require(_0x1be7('0x2'));var rs=require(_0x1be7('0x3'));var fs=require('fs');var Redis=require(_0x1be7('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x1be7('0x5'));var logger=require('../../config/logger')(_0x1be7('0x6'));var config=require('../../config/environment');var jayson=require(_0x1be7('0x7'));var client=jayson[_0x1be7('0x8')][_0x1be7('0x9')]({'port':0x232a});config[_0x1be7('0xa')]=_[_0x1be7('0xb')](config['redis'],{'host':_0x1be7('0xc'),'port':0x18eb});var socket=require(_0x1be7('0xd'))(new Redis(config[_0x1be7('0xa')]));require(_0x1be7('0xe'))[_0x1be7('0xf')](socket);function respondWithRpcPromise(_0x471135,_0x3d4571,_0x5c678c){return new BPromise(function(_0x39a2ab,_0x57a293){return client[_0x1be7('0x10')](_0x471135,_0x5c678c)[_0x1be7('0x11')](function(_0x80ebe2){logger[_0x1be7('0x12')]('UserNotification,\x20%s,\x20%s',_0x3d4571,'request\x20sent');logger[_0x1be7('0x13')](_0x1be7('0x14'),_0x3d4571,'request\x20sent',JSON[_0x1be7('0x15')](_0x80ebe2));if(_0x80ebe2[_0x1be7('0x16')]){if(_0x80ebe2[_0x1be7('0x16')][_0x1be7('0x17')]===0x1f4){logger[_0x1be7('0x16')]('UserNotification,\x20%s,\x20%s',_0x3d4571,_0x80ebe2['error'][_0x1be7('0x18')]);return _0x57a293(_0x80ebe2[_0x1be7('0x16')][_0x1be7('0x18')]);}logger[_0x1be7('0x16')]('UserNotification,\x20%s,\x20%s',_0x3d4571,_0x80ebe2[_0x1be7('0x16')][_0x1be7('0x18')]);return _0x39a2ab(_0x80ebe2[_0x1be7('0x16')]['message']);}else{logger['info']('UserNotification,\x20%s,\x20%s',_0x3d4571,'request\x20sent');_0x39a2ab(_0x80ebe2['result'][_0x1be7('0x18')]);}})['catch'](function(_0x220650){logger[_0x1be7('0x16')]('UserNotification,\x20%s,\x20%s',_0x3d4571,_0x220650);_0x57a293(_0x220650);});});} \ No newline at end of file +var _0x8e38=['moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','./userNotification.socket','register','info','UserNotification,\x20%s,\x20%s','UserNotification,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','catch','lodash','util'];(function(_0x1f4375,_0x3a895a){var _0xaca331=function(_0x8fff6e){while(--_0x8fff6e){_0x1f4375['push'](_0x1f4375['shift']());}};_0xaca331(++_0x3a895a);}(_0x8e38,0x76));var _0x88e3=function(_0x4ac42b,_0x228b9a){_0x4ac42b=_0x4ac42b-0x0;var _0x284aa5=_0x8e38[_0x4ac42b];return _0x284aa5;};'use strict';var _=require(_0x88e3('0x0'));var util=require(_0x88e3('0x1'));var moment=require(_0x88e3('0x2'));var BPromise=require('bluebird');var rs=require(_0x88e3('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x88e3('0x4'))['db'];var utils=require(_0x88e3('0x5'));var logger=require(_0x88e3('0x6'))(_0x88e3('0x7'));var config=require('../../config/environment');var jayson=require(_0x88e3('0x8'));var client=jayson[_0x88e3('0x9')][_0x88e3('0xa')]({'port':0x232a});config[_0x88e3('0xb')]=_[_0x88e3('0xc')](config[_0x88e3('0xb')],{'host':_0x88e3('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x88e3('0xb')]));require(_0x88e3('0xe'))[_0x88e3('0xf')](socket);function respondWithRpcPromise(_0x188aff,_0x55da9c,_0xdb3e9e){return new BPromise(function(_0x4de7c3,_0x47723a){return client['request'](_0x188aff,_0xdb3e9e)['then'](function(_0x303385){logger[_0x88e3('0x10')](_0x88e3('0x11'),_0x55da9c,'request\x20sent');logger['debug'](_0x88e3('0x12'),_0x55da9c,_0x88e3('0x13'),JSON[_0x88e3('0x14')](_0x303385));if(_0x303385['error']){if(_0x303385['error']['code']===0x1f4){logger[_0x88e3('0x15')](_0x88e3('0x11'),_0x55da9c,_0x303385['error'][_0x88e3('0x16')]);return _0x47723a(_0x303385[_0x88e3('0x15')]['message']);}logger[_0x88e3('0x15')](_0x88e3('0x11'),_0x55da9c,_0x303385[_0x88e3('0x15')][_0x88e3('0x16')]);return _0x4de7c3(_0x303385[_0x88e3('0x15')]['message']);}else{logger['info'](_0x88e3('0x11'),_0x55da9c,_0x88e3('0x13'));_0x4de7c3(_0x303385['result'][_0x88e3('0x16')]);}})[_0x88e3('0x17')](function(_0x427a06){logger['error']('UserNotification,\x20%s,\x20%s',_0x55da9c,_0x427a06);_0x47723a(_0x427a06);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.socket.js b/server/api/userNotification/userNotification.socket.js index 1488b1d..8853696 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 _0x8611=['length','userNotification:','./userNotification.events','save','remove','update','emit','removeListener'];(function(_0x3ab9ee,_0x4a74b8){var _0x82ee88=function(_0x6ccc7e){while(--_0x6ccc7e){_0x3ab9ee['push'](_0x3ab9ee['shift']());}};_0x82ee88(++_0x4a74b8);}(_0x8611,0x18a));var _0x1861=function(_0x2469cb,_0x5b37a7){_0x2469cb=_0x2469cb-0x0;var _0x71f849=_0x8611[_0x2469cb];return _0x71f849;};'use strict';var UserNotificationEvents=require(_0x1861('0x0'));var events=[_0x1861('0x1'),_0x1861('0x2'),_0x1861('0x3')];function createListener(_0xac7387,_0x26c868){return function(_0x2853b4){_0x26c868[_0x1861('0x4')](_0xac7387,_0x2853b4);};}function removeListener(_0x1689d2,_0x3a82c2){return function(){UserNotificationEvents[_0x1861('0x5')](_0x1689d2,_0x3a82c2);};}exports['register']=function(_0x4e68cc){for(var _0x347cc2=0x0,_0x2f4d26=events[_0x1861('0x6')];_0x347cc2<_0x2f4d26;_0x347cc2++){var _0x50f21a=events[_0x347cc2];var _0x45799d=createListener(_0x1861('0x7')+_0x50f21a,_0x4e68cc);UserNotificationEvents['on'](_0x50f21a,_0x45799d);}}; \ No newline at end of file +var _0xbc6f=['length','userNotification:','./userNotification.events','save','update','emit','removeListener'];(function(_0x3bf04a,_0x56ed90){var _0x241e4b=function(_0x105e52){while(--_0x105e52){_0x3bf04a['push'](_0x3bf04a['shift']());}};_0x241e4b(++_0x56ed90);}(_0xbc6f,0xdb));var _0xfbc6=function(_0x2ac2de,_0x109a1e){_0x2ac2de=_0x2ac2de-0x0;var _0xf453a1=_0xbc6f[_0x2ac2de];return _0xf453a1;};'use strict';var UserNotificationEvents=require(_0xfbc6('0x0'));var events=[_0xfbc6('0x1'),'remove',_0xfbc6('0x2')];function createListener(_0x32173b,_0x324385){return function(_0x59bc61){_0x324385[_0xfbc6('0x3')](_0x32173b,_0x59bc61);};}function removeListener(_0x25eca3,_0x354fc9){return function(){UserNotificationEvents[_0xfbc6('0x4')](_0x25eca3,_0x354fc9);};}exports['register']=function(_0x2b1cd0){for(var _0x13d224=0x0,_0x156f30=events[_0xfbc6('0x5')];_0x13d224<_0x156f30;_0x13d224++){var _0x45926d=events[_0x13d224];var _0x88131e=createListener(_0xfbc6('0x6')+_0x45926d,_0x2b1cd0);UserNotificationEvents['on'](_0x45926d,_0x88131e);}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/index.js b/server/api/userOpenchannelQueue/index.js index 86603d9..a914f50 100644 --- a/server/api/userOpenchannelQueue/index.js +++ b/server/api/userOpenchannelQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0xda51ff,_0x519854){var _0x4f52fa=function(_0x2716c8){while(--_0x2716c8){_0xda51ff['push'](_0xda51ff['shift']());}};_0x4f52fa(++_0x519854);}(_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 _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x28bc83,_0xf9c54e){var _0x5af40f=function(_0x45a17c){while(--_0x45a17c){_0x28bc83['push'](_0x28bc83['shift']());}};_0x5af40f(++_0xf9c54e);}(_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/userOpenchannelQueue/userOpenchannelQueue.attributes.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js index 1a8b6ae..02dfd8c 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 _0xc281=['sequelize'];(function(_0x3676fc,_0x369252){var _0x305fa1=function(_0x21b996){while(--_0x21b996){_0x3676fc['push'](_0x3676fc['shift']());}};_0x305fa1(++_0x369252);}(_0xc281,0x98));var _0x1c28=function(_0x39092c,_0x167f0c){_0x39092c=_0x39092c-0x0;var _0x7e47a=_0xc281[_0x39092c];return _0x7e47a;};'use strict';var Sequelize=require(_0x1c28('0x0'));module['exports']={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x7c92=['exports','INTEGER'];(function(_0x3e95bc,_0x275ae3){var _0x46727d=function(_0x1c1e49){while(--_0x1c1e49){_0x3e95bc['push'](_0x3e95bc['shift']());}};_0x46727d(++_0x275ae3);}(_0x7c92,0x110));var _0x27c9=function(_0x4b0bad,_0x38ad61){_0x4b0bad=_0x4b0bad-0x0;var _0x15ed0d=_0x7c92[_0x4b0bad];return _0x15ed0d;};'use strict';var Sequelize=require('sequelize');module[_0x27c9('0x0')]={'penalty':{'type':Sequelize[_0x27c9('0x1')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.model.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.model.js index 4654e8a..a27226f 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 _0xa423=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./userOpenchannelQueue.attributes','exports','define','UserOpenchannelQueue','user_has_openchannel_queues'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa423,0x1a0));var _0x3a42=function(_0x3f78b0,_0x3e102f){_0x3f78b0=_0x3f78b0-0x0;var _0x226432=_0xa423[_0x3f78b0];return _0x226432;};'use strict';var _=require('lodash');var util=require(_0x3a42('0x0'));var logger=require(_0x3a42('0x1'))(_0x3a42('0x2'));var moment=require(_0x3a42('0x3'));var BPromise=require(_0x3a42('0x4'));var rp=require(_0x3a42('0x5'));var fs=require('fs');var path=require(_0x3a42('0x6'));var rimraf=require(_0x3a42('0x7'));var config=require('../../config/environment');var attributes=require(_0x3a42('0x8'));module[_0x3a42('0x9')]=function(_0x411fe8,_0x337a73){return _0x411fe8[_0x3a42('0xa')](_0x3a42('0xb'),attributes,{'tableName':_0x3a42('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd24f=['lodash','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','./userOpenchannelQueue.attributes','exports','define','UserOpenchannelQueue','user_has_openchannel_queues'];(function(_0x5dc831,_0x1eea09){var _0x4cbdcf=function(_0x59135a){while(--_0x59135a){_0x5dc831['push'](_0x5dc831['shift']());}};_0x4cbdcf(++_0x1eea09);}(_0xd24f,0xe4));var _0xfd24=function(_0x2af353,_0x418430){_0x2af353=_0x2af353-0x0;var _0x3f3f4e=_0xd24f[_0x2af353];return _0x3f3f4e;};'use strict';var _=require(_0xfd24('0x0'));var util=require('util');var logger=require(_0xfd24('0x1'))('api');var moment=require('moment');var BPromise=require(_0xfd24('0x2'));var rp=require(_0xfd24('0x3'));var fs=require('fs');var path=require(_0xfd24('0x4'));var rimraf=require(_0xfd24('0x5'));var config=require(_0xfd24('0x6'));var attributes=require(_0xfd24('0x7'));module[_0xfd24('0x8')]=function(_0x53b17a,_0x1b445b){return _0x53b17a[_0xfd24('0x9')](_0xfd24('0xa'),attributes,{'tableName':_0xfd24('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.rpc.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.rpc.js index 0543895..18241c9 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 _0xe11d=['UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','UserOpenchannelQueue,\x20%s,\x20%s','message','result','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','debug'];(function(_0xfdacab,_0x2f8637){var _0x39874e=function(_0x7c5ddd){while(--_0x7c5ddd){_0xfdacab['push'](_0xfdacab['shift']());}};_0x39874e(++_0x2f8637);}(_0xe11d,0x1eb));var _0xde11=function(_0x591720,_0x26db1c){_0x591720=_0x591720-0x0;var _0x23f8b9=_0xe11d[_0x591720];return _0x23f8b9;};'use strict';var _=require(_0xde11('0x0'));var util=require('util');var moment=require(_0xde11('0x1'));var BPromise=require(_0xde11('0x2'));var rs=require(_0xde11('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xde11('0x4'))['db'];var utils=require(_0xde11('0x5'));var logger=require(_0xde11('0x6'))(_0xde11('0x7'));var config=require(_0xde11('0x8'));var jayson=require(_0xde11('0x9'));var client=jayson[_0xde11('0xa')][_0xde11('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x544b6f,_0x3ae248,_0x137fa6){return new BPromise(function(_0x2be12b,_0x3c3222){return client[_0xde11('0xc')](_0x544b6f,_0x137fa6)['then'](function(_0xe64d0){logger[_0xde11('0xd')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x3ae248,'request\x20sent');logger[_0xde11('0xe')](_0xde11('0xf'),_0x3ae248,_0xde11('0x10'),JSON[_0xde11('0x11')](_0xe64d0));if(_0xe64d0[_0xde11('0x12')]){if(_0xe64d0['error'][_0xde11('0x13')]===0x1f4){logger[_0xde11('0x12')](_0xde11('0x14'),_0x3ae248,_0xe64d0['error']['message']);return _0x3c3222(_0xe64d0[_0xde11('0x12')][_0xde11('0x15')]);}logger[_0xde11('0x12')](_0xde11('0x14'),_0x3ae248,_0xe64d0[_0xde11('0x12')][_0xde11('0x15')]);return _0x2be12b(_0xe64d0[_0xde11('0x12')]['message']);}else{logger[_0xde11('0xd')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x3ae248,'request\x20sent');_0x2be12b(_0xe64d0[_0xde11('0x16')]['message']);}})['catch'](function(_0x995da1){logger[_0xde11('0x12')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x3ae248,_0x995da1);_0x3c3222(_0x995da1);});});} \ No newline at end of file +var _0x2832=['jayson/promise','client','request','then','UserOpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','lodash','util','moment','bluebird','randomstring','../../config/logger','../../config/environment'];(function(_0xdbd4f7,_0x4e3bdd){var _0x5c3f9d=function(_0xa7a35a){while(--_0xa7a35a){_0xdbd4f7['push'](_0xdbd4f7['shift']());}};_0x5c3f9d(++_0x4e3bdd);}(_0x2832,0x11f));var _0x2283=function(_0x50d278,_0x5336fe){_0x50d278=_0x50d278-0x0;var _0x4a128a=_0x2832[_0x50d278];return _0x4a128a;};'use strict';var _=require(_0x2283('0x0'));var util=require(_0x2283('0x1'));var moment=require(_0x2283('0x2'));var BPromise=require(_0x2283('0x3'));var rs=require(_0x2283('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x2283('0x5'))('rpc');var config=require(_0x2283('0x6'));var jayson=require(_0x2283('0x7'));var client=jayson[_0x2283('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1f0eb8,_0x4e624c,_0x5df1af){return new BPromise(function(_0x146e5c,_0x4b2d1f){return client[_0x2283('0x9')](_0x1f0eb8,_0x5df1af)[_0x2283('0xa')](function(_0x1776a8){logger['info'](_0x2283('0xb'),_0x4e624c,_0x2283('0xc'));logger[_0x2283('0xd')](_0x2283('0xe'),_0x4e624c,_0x2283('0xc'),JSON[_0x2283('0xf')](_0x1776a8));if(_0x1776a8[_0x2283('0x10')]){if(_0x1776a8[_0x2283('0x10')][_0x2283('0x11')]===0x1f4){logger[_0x2283('0x10')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x4e624c,_0x1776a8[_0x2283('0x10')][_0x2283('0x12')]);return _0x4b2d1f(_0x1776a8[_0x2283('0x10')][_0x2283('0x12')]);}logger[_0x2283('0x10')](_0x2283('0xb'),_0x4e624c,_0x1776a8['error'][_0x2283('0x12')]);return _0x146e5c(_0x1776a8[_0x2283('0x10')]['message']);}else{logger[_0x2283('0x13')](_0x2283('0xb'),_0x4e624c,'request\x20sent');_0x146e5c(_0x1776a8['result'][_0x2283('0x12')]);}})[_0x2283('0x14')](function(_0x1c1c84){logger[_0x2283('0x10')](_0x2283('0xb'),_0x4e624c,_0x1c1c84);_0x4b2d1f(_0x1c1c84);});});} \ No newline at end of file diff --git a/server/api/userProfile/index.js b/server/api/userProfile/index.js index 229696c..026c997 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 _0x0034=['/:id/clone','addSections','/:id/resources','addResources','put','destroy','delete','removeSections','exports','multer','util','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfile.controller','get','isAuthenticated','index','/describe','/:id','show','/:id/sections','getSections','create','post'];(function(_0x542702,_0x585e35){var _0x47b5b6=function(_0x4816c9){while(--_0x4816c9){_0x542702['push'](_0x542702['shift']());}};_0x47b5b6(++_0x585e35);}(_0x0034,0x75));var _0x4003=function(_0x5af812,_0x43d252){_0x5af812=_0x5af812-0x0;var _0x1489f2=_0x0034[_0x5af812];return _0x1489f2;};'use strict';var multer=require(_0x4003('0x0'));var util=require(_0x4003('0x1'));var path=require(_0x4003('0x2'));var timeout=require('connect-timeout');var express=require(_0x4003('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x4003('0x4'));var interaction=require(_0x4003('0x5'));var config=require(_0x4003('0x6'));var controller=require(_0x4003('0x7'));router[_0x4003('0x8')]('/',auth[_0x4003('0x9')](),controller[_0x4003('0xa')]);router[_0x4003('0x8')](_0x4003('0xb'),auth[_0x4003('0x9')](),controller['describe']);router['get'](_0x4003('0xc'),auth['isAuthenticated'](),controller[_0x4003('0xd')]);router['get'](_0x4003('0xe'),auth['isAuthenticated'](),controller[_0x4003('0xf')]);router[_0x4003('0x8')]('/:id/resources',auth['isAuthenticated'](),controller['getResources']);router['post']('/',auth[_0x4003('0x9')](),controller[_0x4003('0x10')]);router[_0x4003('0x11')](_0x4003('0x12'),auth[_0x4003('0x9')](),controller['clone']);router[_0x4003('0x11')](_0x4003('0xe'),auth[_0x4003('0x9')](),controller[_0x4003('0x13')]);router[_0x4003('0x11')](_0x4003('0x14'),auth[_0x4003('0x9')](),controller[_0x4003('0x15')]);router[_0x4003('0x16')](_0x4003('0xc'),auth[_0x4003('0x9')](),controller['update']);router['delete']('/:id',auth[_0x4003('0x9')](),controller[_0x4003('0x17')]);router[_0x4003('0x18')](_0x4003('0xe'),auth[_0x4003('0x9')](),controller[_0x4003('0x19')]);router['delete'](_0x4003('0x14'),auth[_0x4003('0x9')](),controller['removeResources']);module[_0x4003('0x1a')]=router; \ No newline at end of file +var _0x462c=['/:id/sections','getSections','/:id/resources','getResources','post','create','clone','put','/:id','update','delete','removeSections','removeResources','exports','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./userProfile.controller','get','isAuthenticated','index','/describe','describe','show'];(function(_0x24259d,_0x64a194){var _0x5a701=function(_0x204516){while(--_0x204516){_0x24259d['push'](_0x24259d['shift']());}};_0x5a701(++_0x64a194);}(_0x462c,0x188));var _0xc462=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0x462c[_0x126558];return _0x1f6d14;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xc462('0x0'));var timeout=require(_0xc462('0x1'));var express=require('express');var router=express[_0xc462('0x2')]();var fs_extra=require(_0xc462('0x3'));var auth=require(_0xc462('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xc462('0x5'));var controller=require(_0xc462('0x6'));router[_0xc462('0x7')]('/',auth[_0xc462('0x8')](),controller[_0xc462('0x9')]);router[_0xc462('0x7')](_0xc462('0xa'),auth['isAuthenticated'](),controller[_0xc462('0xb')]);router[_0xc462('0x7')]('/:id',auth[_0xc462('0x8')](),controller[_0xc462('0xc')]);router[_0xc462('0x7')](_0xc462('0xd'),auth[_0xc462('0x8')](),controller[_0xc462('0xe')]);router[_0xc462('0x7')](_0xc462('0xf'),auth['isAuthenticated'](),controller[_0xc462('0x10')]);router[_0xc462('0x11')]('/',auth[_0xc462('0x8')](),controller[_0xc462('0x12')]);router[_0xc462('0x11')]('/:id/clone',auth[_0xc462('0x8')](),controller[_0xc462('0x13')]);router['post']('/:id/sections',auth[_0xc462('0x8')](),controller['addSections']);router[_0xc462('0x11')](_0xc462('0xf'),auth[_0xc462('0x8')](),controller['addResources']);router[_0xc462('0x14')](_0xc462('0x15'),auth['isAuthenticated'](),controller[_0xc462('0x16')]);router['delete']('/:id',auth[_0xc462('0x8')](),controller['destroy']);router[_0xc462('0x17')](_0xc462('0xd'),auth[_0xc462('0x8')](),controller[_0xc462('0x18')]);router[_0xc462('0x17')]('/:id/resources',auth[_0xc462('0x8')](),controller[_0xc462('0x19')]);module[_0xc462('0x1a')]=router; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.attributes.js b/server/api/userProfile/userProfile.attributes.js index dc603b8..06f41b4 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 _0xc69d=['BOOLEAN','exports','name','STRING','join','getDataValue','crudPermissions'];(function(_0x43599e,_0x2d60f3){var _0x56994f=function(_0x2b9a58){while(--_0x2b9a58){_0x43599e['push'](_0x43599e['shift']());}};_0x56994f(++_0x2d60f3);}(_0xc69d,0x104));var _0xdc69=function(_0x21c6b8,_0x16d6f6){_0x21c6b8=_0x21c6b8-0x0;var _0x39d474=_0xc69d[_0x21c6b8];return _0x39d474;};'use strict';var Sequelize=require('sequelize');module[_0xdc69('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xdc69('0x1')},'crudPermissions':{'type':Sequelize[_0xdc69('0x2')],'set':function(_0x493941){this['setDataValue']('crudPermissions',_0x493941?_0x493941[_0xdc69('0x3')](''):[]);},'get':function(){return this[_0xdc69('0x4')]('crudPermissions')?this['getDataValue'](_0xdc69('0x5'))['split'](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0xdc69('0x2')],'allowNull':!![]},'privacyEnabled':{'type':Sequelize[_0xdc69('0x6')],'defaultValue':![]},'downloadAttachments':{'type':Sequelize[_0xdc69('0x6')],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize[_0xdc69('0x6')],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize[_0xdc69('0x6')],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0xdc69('0x6')],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize[_0xdc69('0x6')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0xdc69('0x6')],'defaultValue':!![]}}; \ No newline at end of file +var _0x6baa=['BOOLEAN','sequelize','exports','STRING','name','setDataValue','join','getDataValue','crudPermissions','split'];(function(_0x2b6482,_0x95e8a8){var _0x53e68f=function(_0x544be1){while(--_0x544be1){_0x2b6482['push'](_0x2b6482['shift']());}};_0x53e68f(++_0x95e8a8);}(_0x6baa,0xe7));var _0xa6ba=function(_0x12840f,_0x29feb2){_0x12840f=_0x12840f-0x0;var _0xf8f00=_0x6baa[_0x12840f];return _0xf8f00;};'use strict';var Sequelize=require(_0xa6ba('0x0'));module[_0xa6ba('0x1')]={'name':{'type':Sequelize[_0xa6ba('0x2')],'allowNull':![],'unique':_0xa6ba('0x3')},'crudPermissions':{'type':Sequelize[_0xa6ba('0x2')],'set':function(_0x4fc9c7){this[_0xa6ba('0x4')]('crudPermissions',_0x4fc9c7?_0x4fc9c7[_0xa6ba('0x5')](''):[]);},'get':function(){return this[_0xa6ba('0x6')](_0xa6ba('0x7'))?this[_0xa6ba('0x6')]('crudPermissions')[_0xa6ba('0x8')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'privacyEnabled':{'type':Sequelize[_0xa6ba('0x9')],'defaultValue':![]},'downloadAttachments':{'type':Sequelize[_0xa6ba('0x9')],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize[_0xa6ba('0x9')],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize[_0xa6ba('0x9')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize[_0xa6ba('0x9')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0xa6ba('0x9')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.controller.js b/server/api/userProfile/userProfile.controller.js index 57302d1..d0775b2 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 _0x0c2b=['intersection','attributes','fields','length','hasOwnProperty','sort','filter','where','merge','VIRTUAL','includeAll','include','findAll','rows','show','params','options','find','create','catch','clone','get','omit','createdAt','updatedAt','sequelize','transaction','body','UserProfileSection','each','autoAssociation','UserProfileResource','sectionId','Resources','update','describe','addSections','destroy','userProfileId','push','removeSections','ids','getSections','includes','isEmpty','subsections','enabled','findOne','Dashboard','forEach','resourceId','Plugin','addResources','bulkCreate','removeResources','getResources','section','Missing\x20section\x20parameter','nolimit','eml-format','rimraf','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./userProfile.socket','register','status','end','json','undefined','limit','count','offset','set','apply','reject','save','then','sendStatus','name','send','index','map','UserProfile','rawAttributes','fieldName','type','key','model','query','keys','filters'];(function(_0x32a45f,_0x348dea){var _0x1837b1=function(_0x1168f4){while(--_0x1168f4){_0x32a45f['push'](_0x32a45f['shift']());}};_0x1837b1(++_0x348dea);}(_0x0c2b,0x194));var _0xb0c2=function(_0x340b0d,_0x1b362a){_0x340b0d=_0x340b0d-0x0;var _0x3d6044=_0x0c2b[_0x340b0d];return _0x3d6044;};'use strict';var emlformat=require(_0xb0c2('0x0'));var rimraf=require(_0xb0c2('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb0c2('0x2'));var rp=require(_0xb0c2('0x3'));var moment=require(_0xb0c2('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xb0c2('0x5'));var path=require(_0xb0c2('0x6'));var sox=require(_0xb0c2('0x7'));var csv=require(_0xb0c2('0x8'));var ejs=require(_0xb0c2('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb0c2('0xa'));var squel=require(_0xb0c2('0xb'));var crypto=require(_0xb0c2('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xb0c2('0xd'));var toCsv=require(_0xb0c2('0x8'));var querystring=require(_0xb0c2('0xe'));var Papa=require(_0xb0c2('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xb0c2('0x10'));var as=require(_0xb0c2('0x11'));var hardwareService=require(_0xb0c2('0x12'));var logger=require(_0xb0c2('0x13'))('api');var utils=require(_0xb0c2('0x14'));var config=require(_0xb0c2('0x15'));var licenseUtil=require(_0xb0c2('0x16'));var db=require(_0xb0c2('0x17'))['db'];config[_0xb0c2('0x18')]=_[_0xb0c2('0x19')](config[_0xb0c2('0x18')],{'host':_0xb0c2('0x1a'),'port':0x18eb});var socket=require(_0xb0c2('0x1b'))(new Redis(config[_0xb0c2('0x18')]));require(_0xb0c2('0x1c'))[_0xb0c2('0x1d')](socket);function respondWithStatusCode(_0x2efdab,_0x34b086){_0x34b086=_0x34b086||0xcc;return function(_0x6eb706){if(_0x6eb706){return _0x2efdab['sendStatus'](_0x34b086);}return _0x2efdab[_0xb0c2('0x1e')](_0x34b086)[_0xb0c2('0x1f')]();};}function respondWithResult(_0x43f6ba,_0x4ed594){_0x4ed594=_0x4ed594||0xc8;return function(_0x5b9e81){if(_0x5b9e81){return _0x43f6ba[_0xb0c2('0x1e')](_0x4ed594)[_0xb0c2('0x20')](_0x5b9e81);}};}function respondWithFilteredResult(_0x1a4486,_0x51a9b2){return function(_0x85c702){if(_0x85c702){var _0x5147fc=typeof _0x51a9b2['offset']===_0xb0c2('0x21')&&typeof _0x51a9b2[_0xb0c2('0x22')]===_0xb0c2('0x21');var _0x47e28e=_0x85c702[_0xb0c2('0x23')];var _0x2604be=_0x5147fc?0x0:_0x51a9b2[_0xb0c2('0x24')];var _0x432e35=_0x5147fc?_0x85c702[_0xb0c2('0x23')]:_0x51a9b2[_0xb0c2('0x24')]+_0x51a9b2[_0xb0c2('0x22')];var _0x26d9c0;if(_0x432e35>=_0x47e28e){_0x432e35=_0x47e28e;_0x26d9c0=0xc8;}else{_0x26d9c0=0xce;}_0x1a4486[_0xb0c2('0x1e')](_0x26d9c0);return _0x1a4486[_0xb0c2('0x25')]('Content-Range',_0x2604be+'-'+_0x432e35+'/'+_0x47e28e)[_0xb0c2('0x20')](_0x85c702);}return null;};}function patchUpdates(_0x2e1419){return function(_0x1f9c4d){try{jsonpatch[_0xb0c2('0x26')](_0x1f9c4d,_0x2e1419,!![]);}catch(_0x3b3049){return BPromise[_0xb0c2('0x27')](_0x3b3049);}return _0x1f9c4d[_0xb0c2('0x28')]();};}function saveUpdates(_0x49b9e5,_0x457793){return function(_0x5d36e0){if(_0x5d36e0){return _0x5d36e0['update'](_0x49b9e5)['then'](function(_0x4c3359){return _0x4c3359;});}return null;};}function removeEntity(_0x3fac8a,_0x1ededc){return function(_0x31aeeb){if(_0x31aeeb){return _0x31aeeb['destroy']()[_0xb0c2('0x29')](function(){_0x3fac8a[_0xb0c2('0x1e')](0xcc)[_0xb0c2('0x1f')]();});}};}function handleEntityNotFound(_0x2633c6,_0x153291){return function(_0xd2c19f){if(!_0xd2c19f){_0x2633c6[_0xb0c2('0x2a')](0x194);}return _0xd2c19f;};}function handleError(_0x161271,_0x1d8639){_0x1d8639=_0x1d8639||0x1f4;return function(_0xcd6281){logger['error'](_0xcd6281['stack']);if(_0xcd6281['name']){delete _0xcd6281[_0xb0c2('0x2b')];}_0x161271[_0xb0c2('0x1e')](_0x1d8639)[_0xb0c2('0x2c')](_0xcd6281);};}exports[_0xb0c2('0x2d')]=function(_0x341b01,_0x29b920){var _0x5cd61a={},_0x470779={},_0x2a1ef0={'count':0x0,'rows':[]};var _0x2afb2f=_[_0xb0c2('0x2e')](db[_0xb0c2('0x2f')][_0xb0c2('0x30')],function(_0x13052e){return{'name':_0x13052e[_0xb0c2('0x31')],'type':_0x13052e[_0xb0c2('0x32')][_0xb0c2('0x33')]};});_0x470779[_0xb0c2('0x34')]=_['map'](_0x2afb2f,_0xb0c2('0x2b'));_0x470779[_0xb0c2('0x35')]=_[_0xb0c2('0x36')](_0x341b01[_0xb0c2('0x35')]);_0x470779[_0xb0c2('0x37')]=_[_0xb0c2('0x38')](_0x470779['model'],_0x470779['query']);_0x5cd61a[_0xb0c2('0x39')]=_[_0xb0c2('0x38')](_0x470779[_0xb0c2('0x34')],qs[_0xb0c2('0x3a')](_0x341b01[_0xb0c2('0x35')][_0xb0c2('0x3a')]));_0x5cd61a[_0xb0c2('0x39')]=_0x5cd61a[_0xb0c2('0x39')][_0xb0c2('0x3b')]?_0x5cd61a['attributes']:_0x470779[_0xb0c2('0x34')];if(!_0x341b01['query'][_0xb0c2('0x3c')]('nolimit')){_0x5cd61a[_0xb0c2('0x22')]=qs[_0xb0c2('0x22')](_0x341b01[_0xb0c2('0x35')]['limit']);_0x5cd61a[_0xb0c2('0x24')]=qs['offset'](_0x341b01[_0xb0c2('0x35')]['offset']);}_0x5cd61a['order']=qs['sort'](_0x341b01[_0xb0c2('0x35')][_0xb0c2('0x3d')]);_0x5cd61a['where']=qs[_0xb0c2('0x37')](_['pick'](_0x341b01[_0xb0c2('0x35')],_0x470779[_0xb0c2('0x37')]),_0x2afb2f);if(_0x341b01[_0xb0c2('0x35')][_0xb0c2('0x3e')]){_0x5cd61a[_0xb0c2('0x3f')]=_[_0xb0c2('0x40')](_0x5cd61a['where'],{'$or':_[_0xb0c2('0x2e')](_0x2afb2f,function(_0x50cfef){if(_0x50cfef[_0xb0c2('0x32')]!==_0xb0c2('0x41')){var _0x313d67={};_0x313d67[_0x50cfef[_0xb0c2('0x2b')]]={'$like':'%'+_0x341b01['query'][_0xb0c2('0x3e')]+'%'};return _0x313d67;}})});}_0x5cd61a=_[_0xb0c2('0x40')]({},_0x5cd61a,_0x341b01['options']);var _0x4e4ca7={'where':_0x5cd61a['where']};return db[_0xb0c2('0x2f')][_0xb0c2('0x23')](_0x4e4ca7)[_0xb0c2('0x29')](function(_0xfef1ff){_0x2a1ef0['count']=_0xfef1ff;if(_0x341b01['query'][_0xb0c2('0x42')]){_0x5cd61a[_0xb0c2('0x43')]=[{'all':!![]}];}return db['UserProfile'][_0xb0c2('0x44')](_0x5cd61a);})[_0xb0c2('0x29')](function(_0x3deb14){_0x2a1ef0[_0xb0c2('0x45')]=_0x3deb14;return _0x2a1ef0;})[_0xb0c2('0x29')](respondWithFilteredResult(_0x29b920,_0x5cd61a))['catch'](handleError(_0x29b920,null));};exports[_0xb0c2('0x46')]=function(_0x30c608,_0x36dd14){var _0x5e5b0d={'raw':![],'where':{'id':_0x30c608[_0xb0c2('0x47')]['id']}},_0x5649f0={};_0x5649f0['model']=_['keys'](db[_0xb0c2('0x2f')][_0xb0c2('0x30')]);_0x5649f0['query']=_[_0xb0c2('0x36')](_0x30c608[_0xb0c2('0x35')]);_0x5649f0[_0xb0c2('0x37')]=_[_0xb0c2('0x38')](_0x5649f0[_0xb0c2('0x34')],_0x5649f0[_0xb0c2('0x35')]);_0x5e5b0d[_0xb0c2('0x39')]=_[_0xb0c2('0x38')](_0x5649f0[_0xb0c2('0x34')],qs[_0xb0c2('0x3a')](_0x30c608[_0xb0c2('0x35')][_0xb0c2('0x3a')]));_0x5e5b0d[_0xb0c2('0x39')]=_0x5e5b0d[_0xb0c2('0x39')][_0xb0c2('0x3b')]?_0x5e5b0d[_0xb0c2('0x39')]:_0x5649f0[_0xb0c2('0x34')];if(_0x30c608[_0xb0c2('0x35')]['includeAll']){_0x5e5b0d[_0xb0c2('0x43')]=[{'all':!![]}];}_0x5e5b0d=_[_0xb0c2('0x40')]({},_0x5e5b0d,_0x30c608[_0xb0c2('0x48')]);return db[_0xb0c2('0x2f')][_0xb0c2('0x49')](_0x5e5b0d)['then'](handleEntityNotFound(_0x36dd14,null))[_0xb0c2('0x29')](respondWithResult(_0x36dd14,null))['catch'](handleError(_0x36dd14,null));};exports[_0xb0c2('0x4a')]=function(_0x3ca3bb,_0x1009c7){return db[_0xb0c2('0x2f')][_0xb0c2('0x4a')](_0x3ca3bb['body'],{})['then'](respondWithResult(_0x1009c7,0xc9))[_0xb0c2('0x4b')](handleError(_0x1009c7,null));};exports[_0xb0c2('0x4c')]=function(_0x4b859c,_0x1539b5){var _0xd6a96d={'where':{'id':_0x4b859c['params']['id']}},_0x40486a={};_0x40486a[_0xb0c2('0x34')]=_[_0xb0c2('0x36')](db[_0xb0c2('0x2f')]['rawAttributes']);_0xd6a96d[_0xb0c2('0x39')]=_[_0xb0c2('0x38')](_0x40486a[_0xb0c2('0x34')],qs[_0xb0c2('0x3a')](_0x4b859c[_0xb0c2('0x35')][_0xb0c2('0x3a')]));_0xd6a96d[_0xb0c2('0x39')]=_0xd6a96d[_0xb0c2('0x39')]['length']?_0xd6a96d[_0xb0c2('0x39')]:_0x40486a[_0xb0c2('0x34')];if(_0x4b859c[_0xb0c2('0x35')][_0xb0c2('0x42')]){_0xd6a96d['include']=[{'all':!![]}];}_0xd6a96d=_[_0xb0c2('0x40')]({},_0xd6a96d,_0x4b859c[_0xb0c2('0x48')]);return db[_0xb0c2('0x2f')][_0xb0c2('0x49')](_0xd6a96d)[_0xb0c2('0x29')](handleEntityNotFound(_0x1539b5,null))['then'](function(_0x362219){if(_0x362219){var _0x238f14=_0x362219[_0xb0c2('0x4d')]({'plain':!![]});_0x238f14=qs[_0xb0c2('0x4e')](_0x238f14,['id',_0xb0c2('0x4f'),_0xb0c2('0x50'),'crudPermissions']);_0x4b859c['body']=_[_0xb0c2('0x4e')](_0x4b859c['body'],['id',_0xb0c2('0x4f'),_0xb0c2('0x50')]);return db[_0xb0c2('0x51')][_0xb0c2('0x52')](function(_0x16aeac){return db[_0xb0c2('0x2f')]['create'](_[_0xb0c2('0x40')](_0x238f14,_0x4b859c[_0xb0c2('0x53')]),{'include':_0x4b859c[_0xb0c2('0x35')][_0xb0c2('0x42')]?[{'all':!![]}]:undefined,'transaction':_0x16aeac})[_0xb0c2('0x29')](function(_0x1972e1){var _0xcfd27=_0x1972e1[_0xb0c2('0x4d')]({'plain':!![]});return db[_0xb0c2('0x54')][_0xb0c2('0x44')]({'where':{'userProfileId':_0x4b859c[_0xb0c2('0x47')]['id']},'raw':!![]})['then'](function(_0x2e9251){if(_0x2e9251){return BPromise[_0xb0c2('0x55')](_0x2e9251,function(_0x1438e3){return new BPromise(function(_0x56f1e9,_0x959e29){if(_0x1438e3['autoAssociation']===null||_0x1438e3[_0xb0c2('0x56')]===0x1)_0x56f1e9(null);return db[_0xb0c2('0x57')]['findAll']({'where':{'sectionId':_0x1438e3['id']},'raw':!![]})[_0xb0c2('0x29')](function(_0x35d9fa){var _0x37c73e=_[_0xb0c2('0x2e')](_0x35d9fa,function(_0x35552d){return qs['omit'](_0x35552d,['id','createdAt',_0xb0c2('0x50'),_0xb0c2('0x58')]);});_0x56f1e9(_0x37c73e);})[_0xb0c2('0x4b')](function(_0x5ba847){_0x959e29(_0x5ba847);});})[_0xb0c2('0x29')](function(_0x4e48a8){var _0x380501=qs[_0xb0c2('0x4e')](_0x1438e3,['id',_0xb0c2('0x4f'),'updatedAt']);_0x380501['userProfileId']=_0xcfd27['id'];if(_0x4e48a8)_0x380501[_0xb0c2('0x59')]=_0x4e48a8;return _0x380501;})['then'](function(_0x527b9f){return db[_0xb0c2('0x54')][_0xb0c2('0x4a')](_0x527b9f,{'include':[{'model':db[_0xb0c2('0x57')],'as':_0xb0c2('0x59')}],'raw':!![],'transaction':_0x16aeac});});})[_0xb0c2('0x29')](function(){return _0xcfd27;});}});});});}})[_0xb0c2('0x29')](respondWithResult(_0x1539b5,0xc9))[_0xb0c2('0x4b')](handleError(_0x1539b5,null));};exports[_0xb0c2('0x5a')]=function(_0x78bcce,_0x549f12){if(_0x78bcce[_0xb0c2('0x53')]['id']){delete _0x78bcce[_0xb0c2('0x53')]['id'];}return db[_0xb0c2('0x2f')]['find']({'where':{'id':_0x78bcce['params']['id']}})['then'](handleEntityNotFound(_0x549f12,null))[_0xb0c2('0x29')](saveUpdates(_0x78bcce[_0xb0c2('0x53')],null))['then'](respondWithResult(_0x549f12,null))[_0xb0c2('0x4b')](handleError(_0x549f12,null));};exports['destroy']=function(_0x343201,_0x403064){return db[_0xb0c2('0x2f')]['find']({'where':{'id':_0x343201[_0xb0c2('0x47')]['id']}})['then'](handleEntityNotFound(_0x403064,null))['then'](removeEntity(_0x403064,null))[_0xb0c2('0x4b')](handleError(_0x403064,null));};exports[_0xb0c2('0x5b')]=function(_0x43a734,_0x1ea9dc){return db[_0xb0c2('0x2f')][_0xb0c2('0x5b')]()[_0xb0c2('0x29')](respondWithResult(_0x1ea9dc,null))['catch'](handleError(_0x1ea9dc,null));};exports[_0xb0c2('0x5c')]=function(_0x5e4c90,_0x2ff748){var _0x1eedac=_0x5e4c90[_0xb0c2('0x53')];return db[_0xb0c2('0x2f')][_0xb0c2('0x49')]({'where':{'id':_0x5e4c90[_0xb0c2('0x47')]['id']}})[_0xb0c2('0x29')](handleEntityNotFound(_0x2ff748,null))['then'](function(_0x5c6501){if(_0x5c6501){return db[_0xb0c2('0x51')][_0xb0c2('0x52')](function(_0x23a308){return db[_0xb0c2('0x54')][_0xb0c2('0x5d')]({'where':{'userProfileId':_0x5e4c90['params']['id'],'sectionId':_[_0xb0c2('0x2e')](_0x1eedac,function(_0x30afd0){return _0x30afd0[_0xb0c2('0x58')];})},'transaction':_0x23a308})[_0xb0c2('0x29')](function(){var _0x1508c9=_['map'](_0x1eedac,function(_0x17db1e){_0x17db1e[_0xb0c2('0x5e')]=_0x5e4c90[_0xb0c2('0x47')]['id'];return _0x17db1e;});var _0xa2a591=[];return BPromise[_0xb0c2('0x55')](_0x1508c9,function(_0x181984){return db['UserProfileSection'][_0xb0c2('0x4a')](_0x181984,{'include':[{'model':db[_0xb0c2('0x57')],'as':_0xb0c2('0x59')}],'raw':!![],'transaction':_0x23a308})[_0xb0c2('0x29')](function(_0x2899f1){_0xa2a591[_0xb0c2('0x5f')](_0x2899f1[_0xb0c2('0x4d')]({'plain':!![]}));});})[_0xb0c2('0x29')](function(){return _0xa2a591;});});});}})[_0xb0c2('0x29')](function(_0x2f11ef){return _0x2f11ef;})[_0xb0c2('0x29')](respondWithResult(_0x2ff748,null))[_0xb0c2('0x4b')](handleError(_0x2ff748,null));};exports[_0xb0c2('0x60')]=function(_0x590d41,_0x5ba83d){var _0x413a0e;return db[_0xb0c2('0x2f')][_0xb0c2('0x49')]({'where':{'id':_0x590d41[_0xb0c2('0x47')]['id']},'attributes':['id',_0xb0c2('0x2b')]})['then'](handleEntityNotFound(_0x5ba83d,null))['then'](function(_0x109168){if(_0x109168){_0x413a0e=_0x109168;return db[_0xb0c2('0x54')]['destroy']({'where':{'userProfileId':_0x590d41[_0xb0c2('0x47')]['id'],'sectionId':_0x590d41[_0xb0c2('0x35')][_0xb0c2('0x61')]}});}})[_0xb0c2('0x29')](function(){return _0x413a0e;})['then'](respondWithStatusCode(_0x5ba83d,null))['catch'](handleError(_0x5ba83d,null));};exports[_0xb0c2('0x62')]=function(_0x94671,_0x12d3cd){var _0x1a2158=[];var _0x1eb93e=[];return db[_0xb0c2('0x54')][_0xb0c2('0x44')]({'where':{'userProfileId':_0x94671[_0xb0c2('0x47')]['id']},'raw':!![]})[_0xb0c2('0x29')](function(_0x1079d3){_0x1a2158=_[_0xb0c2('0x3e')](_0x1079d3,function(_0x20e8fe){return _0x20e8fe['enabled']===0x1||_[_0xb0c2('0x63')]([0x3eb,0x709],_0x20e8fe[_0xb0c2('0x58')]);});if(!_[_0xb0c2('0x64')](_0x1a2158)){return _['map'](_0x1a2158,function(_0x3a13a4){return _0x3a13a4['sectionId'];});}else{return;}})[_0xb0c2('0x29')](function(_0x397d6a){if(_0x397d6a)_0x1eb93e=_0x397d6a;if(_[_0xb0c2('0x63')](_0x1eb93e,0x64)){var _0x1605ba=_[_0xb0c2('0x49')](_0x1a2158,{'sectionId':0x64});return hasDefaultDashboard(_0x1605ba)[_0xb0c2('0x29')](function(_0x42373a){return _[_0xb0c2('0x2e')](_0x1a2158,function(_0x11ae62){if(_0x11ae62['sectionId']===0x64){_0x11ae62[_0xb0c2('0x65')]=_0x42373a;}return _0x11ae62;});});}else{return;}})[_0xb0c2('0x29')](function(_0x4f4a7a){if(_0x4f4a7a)_0x1a2158=_0x4f4a7a;if(_[_0xb0c2('0x63')](_0x1eb93e,0x3eb)){var _0xd906e=_[_0xb0c2('0x49')](_0x1a2158,{'sectionId':0x3eb});return getCustomDashboards(_0xd906e)[_0xb0c2('0x29')](function(_0x4907d8){return _[_0xb0c2('0x2e')](_0x1a2158,function(_0x4bf065){if(_0xd906e[_0xb0c2('0x66')]){if(_0x4bf065[_0xb0c2('0x58')]===0x3eb){_0x4bf065['subsections']=_0x4907d8;}}else{if(_0x4bf065['sectionId']===0x64){_0x4bf065[_0xb0c2('0x65')]=_0x4907d8;}}return _0x4bf065;});});}else{return;}})[_0xb0c2('0x29')](function(_0x5c611d){if(_0x5c611d)_0x1a2158=_0x5c611d;if(_[_0xb0c2('0x63')](_0x1eb93e,0x709)){var _0x20e44c=_['find'](_0x1a2158,{'sectionId':0x709});return getPlugins(_0x20e44c)[_0xb0c2('0x29')](function(_0x10f379){if(_0x20e44c[_0xb0c2('0x66')]){return _['map'](_0x1a2158,function(_0x3c5c11){if(_0x3c5c11[_0xb0c2('0x58')]===0x709){_0x3c5c11['subsections']=_0x10f379;}return _0x3c5c11;});}else{var _0x388d92={'sectionId':0x76c,'enabled':0x1,'subsections':_0x10f379};var _0x5c0385=_[_0xb0c2('0x2e')](_0x1a2158);_0x5c0385[_0xb0c2('0x5f')](_0x388d92);return _0x5c0385;}});}else{return;}})['then'](function(_0x521c77){if(_0x521c77)_0x1a2158=_0x521c77;return _[_0xb0c2('0x3e')](_0x1a2158,[_0xb0c2('0x66'),0x1]);})[_0xb0c2('0x29')](respondWithResult(_0x12d3cd,null))[_0xb0c2('0x4b')](handleError(_0x12d3cd,null));};function hasDefaultDashboard(_0xa732e4){var _0x9092e9=[0x65];return new BPromise(function(_0x675ead,_0x595270){try{if(_0xa732e4[_0xb0c2('0x56')]){_0x675ead(_0x9092e9);}else{return db[_0xb0c2('0x57')][_0xb0c2('0x67')]({'where':{'sectionId':_0xa732e4['id']},'raw':!![]})[_0xb0c2('0x29')](function(_0x1f4a3a){_0x1f4a3a?_0x675ead(_0x9092e9):_0x675ead();});}}catch(_0x2981f2){_0x595270(_0x2981f2);}});}function getCustomDashboards(_0x57fe45){var _0x3a9b9d=[];return new BPromise(function(_0x43dd5e,_0x59b02a){try{if(_0x57fe45[_0xb0c2('0x56')]){return db[_0xb0c2('0x68')][_0xb0c2('0x44')]({'raw':!![]})['then'](function(_0x3dbf8b){_0x3dbf8b[_0xb0c2('0x69')](function(_0x3891c0){_0x3a9b9d[_0xb0c2('0x5f')](_0x3891c0['id']+0x1869f);});_0x43dd5e(_0x3a9b9d);});}else{return db[_0xb0c2('0x57')]['findAll']({'where':{'sectionId':_0x57fe45['id']},'raw':!![]})['then'](function(_0x2fa0e1){_0x2fa0e1[_0xb0c2('0x69')](function(_0x238f3a){_0x3a9b9d['push'](_0x238f3a[_0xb0c2('0x6a')]+0x1869f);});_0x43dd5e(_0x3a9b9d);});}}catch(_0x40a198){_0x59b02a(_0x40a198);}});}function getPlugins(_0x4bdcdc){var _0x454e92=[];return new BPromise(function(_0xe6f984,_0x585a0a){try{if(_0x4bdcdc[_0xb0c2('0x56')]){return db[_0xb0c2('0x6b')][_0xb0c2('0x44')]({'raw':!![]})[_0xb0c2('0x29')](function(_0x125769){_0x125769['forEach'](function(_0x5c27d3){_0x454e92['push'](_0x5c27d3['id']+0x15b38);});_0xe6f984(_0x454e92);});}else{return db[_0xb0c2('0x57')][_0xb0c2('0x44')]({'where':{'sectionId':_0x4bdcdc['id']},'raw':!![]})['then'](function(_0x402c3c){_0x402c3c[_0xb0c2('0x69')](function(_0x225a50){_0x454e92['push'](_0x225a50[_0xb0c2('0x6a')]+0x15b38);});_0xe6f984(_0x454e92);});}}catch(_0x1c1bd5){_0x585a0a(_0x1c1bd5);}});}exports[_0xb0c2('0x6c')]=function(_0xaf62c8,_0x334276){return db[_0xb0c2('0x2f')]['find']({'where':{'id':_0xaf62c8[_0xb0c2('0x47')]['id']}})['then'](handleEntityNotFound(_0x334276,null))[_0xb0c2('0x29')](function(_0x3aec9f){if(_0x3aec9f){return db[_0xb0c2('0x51')]['transaction'](function(_0x2e7c38){return db['UserProfileSection'][_0xb0c2('0x44')]({'where':{'userProfileId':_0xaf62c8[_0xb0c2('0x47')]['id']},'attributes':['id'],'raw':!![]})[_0xb0c2('0x29')](function(_0x5b63f8){if(_0x5b63f8){return db[_0xb0c2('0x54')][_0xb0c2('0x5d')]({'where':{'userProfileId':_0xaf62c8['params']['id'],'id':_['map'](_0x5b63f8,function(_0x5cbb03){return _0x5cbb03['id'];})},'transaction':_0x2e7c38});}})[_0xb0c2('0x29')](function(_0x293c66){var _0x1f012d=_['map'](_0xaf62c8['body'],function(_0x17a508){_0x17a508[_0xb0c2('0x5e')]=_0xaf62c8[_0xb0c2('0x47')]['id'];return _0x17a508;});return db[_0xb0c2('0x54')][_0xb0c2('0x6d')](_0x1f012d,{'raw':!![],'transaction':_0x2e7c38});})[_0xb0c2('0x29')](function(_0x424320){var _0x3b00cf=_[_0xb0c2('0x3e')](_[_0xb0c2('0x2e')](_0x424320,function(_0x5a6dab){return _0x5a6dab[_0xb0c2('0x4d')]({'plain':!![]});}),{'includeAll':![]});if(_0x3b00cf){return db['UserProfileSection']['findAll']({'where':{'userProfileId':_0xaf62c8[_0xb0c2('0x47')]['id'],'sectionId':_[_0xb0c2('0x2e')](_0x3b00cf,function(_0x29d0ec){return _0x29d0ec[_0xb0c2('0x58')];})},'attributes':['id',_0xb0c2('0x58')],'raw':!![]})['then'](function(_0x3bb9bc){var _0x24792d=_['map'](_0xaf62c8[_0xb0c2('0x53')],function(_0x78b225){_0x78b225['userProfileId']=_0xaf62c8[_0xb0c2('0x47')]['id'];return _0x78b225;});return db[_0xb0c2('0x57')][_0xb0c2('0x6d')](_0x24792d,{'raw':!![],'transaction':_0x2e7c38});});}})[_0xb0c2('0x4b')](handleError(_0x334276,null));});}})[_0xb0c2('0x29')](function(_0x5c97a9){var _0x1a2fb4=_[_0xb0c2('0x2e')](_0x5c97a9,function(_0x4511f8){return _0x4511f8[_0xb0c2('0x4d')]({'plain':!![]});});})[_0xb0c2('0x29')](respondWithResult(_0x334276,null))[_0xb0c2('0x4b')](handleError(_0x334276,null));};exports['removeResources']=function(_0x2cc194,_0x9bf962,_0x5c87ce){return db[_0xb0c2('0x2f')][_0xb0c2('0x49')]({'where':{'id':_0x2cc194[_0xb0c2('0x47')]['id']}})[_0xb0c2('0x29')](handleEntityNotFound(_0x9bf962,null))[_0xb0c2('0x29')](function(_0x418d0f){if(_0x418d0f){return _0x418d0f[_0xb0c2('0x6e')](_0x2cc194['query'][_0xb0c2('0x61')]);}})[_0xb0c2('0x29')](respondWithStatusCode(_0x9bf962,null))['catch'](handleError(_0x9bf962,null));};exports[_0xb0c2('0x6f')]=function(_0x1dec77,_0x158c58){var _0x506e08={};if(!_0x1dec77['query'][_0xb0c2('0x70')])throw new Error(_0xb0c2('0x71'));if(!_0x1dec77[_0xb0c2('0x35')][_0xb0c2('0x3c')](_0xb0c2('0x72'))){_0x506e08['limit']=qs['limit'](_0x1dec77[_0xb0c2('0x35')][_0xb0c2('0x22')]);_0x506e08[_0xb0c2('0x24')]=qs['offset'](_0x1dec77[_0xb0c2('0x35')][_0xb0c2('0x24')]);}return db[_0xb0c2('0x2f')][_0xb0c2('0x49')]({'where':{'id':_0x1dec77[_0xb0c2('0x47')]['id']}})[_0xb0c2('0x29')](function(_0x4ac59e){if(!_0x4ac59e)throw new Error('No\x20User\x20Profile\x20found\x20for\x20id\x20'+_0x1dec77[_0xb0c2('0x47')]['id']);return db['UserProfile'][_0xb0c2('0x6f')](_0x1dec77);})[_0xb0c2('0x29')](respondWithFilteredResult(_0x158c58,_0x506e08))[_0xb0c2('0x4b')](handleError(_0x158c58,null));}; \ No newline at end of file +var _0x16a2=['Resources','describe','addSections','push','removeSections','ids','getSections','enabled','includes','isEmpty','subsections','Dashboard','forEach','Plugin','addResources','bulkCreate','removeResources','getResources','section','hasOwnProperty','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','./userProfile.socket','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','destroy','stack','name','send','index','map','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','nolimit','sort','where','filters','pick','filter','VIRTUAL','merge','options','UserProfile','then','includeAll','include','rows','catch','show','params','find','create','body','rawAttributes','get','omit','updatedAt','crudPermissions','createdAt','sequelize','transaction','UserProfileSection','findAll','each','autoAssociation','UserProfileResource','sectionId','userProfileId'];(function(_0x434e50,_0x4ed139){var _0x377d0d=function(_0x3f5aa2){while(--_0x3f5aa2){_0x434e50['push'](_0x434e50['shift']());}};_0x377d0d(++_0x4ed139);}(_0x16a2,0x1d0));var _0x216a=function(_0x586fa2,_0x1a45bc){_0x586fa2=_0x586fa2-0x0;var _0x515be9=_0x16a2[_0x586fa2];return _0x515be9;};'use strict';var emlformat=require(_0x216a('0x0'));var rimraf=require(_0x216a('0x1'));var zipdir=require(_0x216a('0x2'));var jsonpatch=require(_0x216a('0x3'));var rp=require(_0x216a('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x216a('0x5'));var util=require(_0x216a('0x6'));var path=require(_0x216a('0x7'));var sox=require(_0x216a('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x216a('0x9'));var _=require(_0x216a('0xa'));var squel=require(_0x216a('0xb'));var crypto=require('crypto');var jsforce=require(_0x216a('0xc'));var deskjs=require(_0x216a('0xd'));var toCsv=require(_0x216a('0xe'));var querystring=require(_0x216a('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x216a('0x10'));var qs=require(_0x216a('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x216a('0x12'));var logger=require(_0x216a('0x13'))(_0x216a('0x14'));var utils=require(_0x216a('0x15'));var config=require(_0x216a('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x216a('0x17'))['db'];config[_0x216a('0x18')]=_['defaults'](config[_0x216a('0x18')],{'host':_0x216a('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x216a('0x18')]));require(_0x216a('0x1a'))['register'](socket);function respondWithStatusCode(_0x117b1e,_0x5c41f2){_0x5c41f2=_0x5c41f2||0xcc;return function(_0x8802c6){if(_0x8802c6){return _0x117b1e[_0x216a('0x1b')](_0x5c41f2);}return _0x117b1e[_0x216a('0x1c')](_0x5c41f2)[_0x216a('0x1d')]();};}function respondWithResult(_0x4dedd0,_0x46f19d){_0x46f19d=_0x46f19d||0xc8;return function(_0x263c8e){if(_0x263c8e){return _0x4dedd0['status'](_0x46f19d)[_0x216a('0x1e')](_0x263c8e);}};}function respondWithFilteredResult(_0x56debf,_0x2e7acf){return function(_0x577624){if(_0x577624){var _0x35f178=typeof _0x2e7acf[_0x216a('0x1f')]===_0x216a('0x20')&&typeof _0x2e7acf[_0x216a('0x21')]===_0x216a('0x20');var _0x5bb15b=_0x577624[_0x216a('0x22')];var _0x17aec6=_0x35f178?0x0:_0x2e7acf[_0x216a('0x1f')];var _0x3bccf7=_0x35f178?_0x577624['count']:_0x2e7acf[_0x216a('0x1f')]+_0x2e7acf[_0x216a('0x21')];var _0x418ab9;if(_0x3bccf7>=_0x5bb15b){_0x3bccf7=_0x5bb15b;_0x418ab9=0xc8;}else{_0x418ab9=0xce;}_0x56debf[_0x216a('0x1c')](_0x418ab9);return _0x56debf[_0x216a('0x23')](_0x216a('0x24'),_0x17aec6+'-'+_0x3bccf7+'/'+_0x5bb15b)[_0x216a('0x1e')](_0x577624);}return null;};}function patchUpdates(_0x12f60b){return function(_0x11d375){try{jsonpatch[_0x216a('0x25')](_0x11d375,_0x12f60b,!![]);}catch(_0x457253){return BPromise['reject'](_0x457253);}return _0x11d375[_0x216a('0x26')]();};}function saveUpdates(_0x5cf17c,_0x3b0480){return function(_0x3ebc8d){if(_0x3ebc8d){return _0x3ebc8d[_0x216a('0x27')](_0x5cf17c)['then'](function(_0x23b673){return _0x23b673;});}return null;};}function removeEntity(_0x55a0d6,_0x36a07a){return function(_0x495422){if(_0x495422){return _0x495422[_0x216a('0x28')]()['then'](function(){_0x55a0d6[_0x216a('0x1c')](0xcc)[_0x216a('0x1d')]();});}};}function handleEntityNotFound(_0x566950,_0x23fe29){return function(_0x16004b){if(!_0x16004b){_0x566950[_0x216a('0x1b')](0x194);}return _0x16004b;};}function handleError(_0x26565c,_0xb02c4){_0xb02c4=_0xb02c4||0x1f4;return function(_0x530c76){logger['error'](_0x530c76[_0x216a('0x29')]);if(_0x530c76['name']){delete _0x530c76[_0x216a('0x2a')];}_0x26565c['status'](_0xb02c4)[_0x216a('0x2b')](_0x530c76);};}exports[_0x216a('0x2c')]=function(_0x2879dc,_0x3ea1dc){var _0x41b2e3={},_0x54d46e={},_0x2eaec2={'count':0x0,'rows':[]};var _0x50ed2c=_[_0x216a('0x2d')](db['UserProfile']['rawAttributes'],function(_0x51ac97){return{'name':_0x51ac97[_0x216a('0x2e')],'type':_0x51ac97[_0x216a('0x2f')][_0x216a('0x30')]};});_0x54d46e[_0x216a('0x31')]=_[_0x216a('0x2d')](_0x50ed2c,'name');_0x54d46e[_0x216a('0x32')]=_[_0x216a('0x33')](_0x2879dc[_0x216a('0x32')]);_0x54d46e['filters']=_[_0x216a('0x34')](_0x54d46e[_0x216a('0x31')],_0x54d46e[_0x216a('0x32')]);_0x41b2e3[_0x216a('0x35')]=_['intersection'](_0x54d46e[_0x216a('0x31')],qs[_0x216a('0x36')](_0x2879dc[_0x216a('0x32')][_0x216a('0x36')]));_0x41b2e3[_0x216a('0x35')]=_0x41b2e3[_0x216a('0x35')][_0x216a('0x37')]?_0x41b2e3['attributes']:_0x54d46e[_0x216a('0x31')];if(!_0x2879dc[_0x216a('0x32')]['hasOwnProperty'](_0x216a('0x38'))){_0x41b2e3[_0x216a('0x21')]=qs['limit'](_0x2879dc[_0x216a('0x32')][_0x216a('0x21')]);_0x41b2e3[_0x216a('0x1f')]=qs[_0x216a('0x1f')](_0x2879dc[_0x216a('0x32')]['offset']);}_0x41b2e3['order']=qs[_0x216a('0x39')](_0x2879dc[_0x216a('0x32')][_0x216a('0x39')]);_0x41b2e3[_0x216a('0x3a')]=qs[_0x216a('0x3b')](_[_0x216a('0x3c')](_0x2879dc['query'],_0x54d46e[_0x216a('0x3b')]),_0x50ed2c);if(_0x2879dc['query'][_0x216a('0x3d')]){_0x41b2e3[_0x216a('0x3a')]=_['merge'](_0x41b2e3[_0x216a('0x3a')],{'$or':_[_0x216a('0x2d')](_0x50ed2c,function(_0x1b7309){if(_0x1b7309[_0x216a('0x2f')]!==_0x216a('0x3e')){var _0x4a68df={};_0x4a68df[_0x1b7309[_0x216a('0x2a')]]={'$like':'%'+_0x2879dc[_0x216a('0x32')][_0x216a('0x3d')]+'%'};return _0x4a68df;}})});}_0x41b2e3=_[_0x216a('0x3f')]({},_0x41b2e3,_0x2879dc[_0x216a('0x40')]);var _0x513281={'where':_0x41b2e3[_0x216a('0x3a')]};return db[_0x216a('0x41')]['count'](_0x513281)[_0x216a('0x42')](function(_0x4c858a){_0x2eaec2['count']=_0x4c858a;if(_0x2879dc[_0x216a('0x32')][_0x216a('0x43')]){_0x41b2e3[_0x216a('0x44')]=[{'all':!![]}];}return db['UserProfile']['findAll'](_0x41b2e3);})[_0x216a('0x42')](function(_0x189d32){_0x2eaec2[_0x216a('0x45')]=_0x189d32;return _0x2eaec2;})[_0x216a('0x42')](respondWithFilteredResult(_0x3ea1dc,_0x41b2e3))[_0x216a('0x46')](handleError(_0x3ea1dc,null));};exports[_0x216a('0x47')]=function(_0x117921,_0x2f1415){var _0x38bfba={'raw':![],'where':{'id':_0x117921[_0x216a('0x48')]['id']}},_0x3b9949={};_0x3b9949['model']=_[_0x216a('0x33')](db[_0x216a('0x41')]['rawAttributes']);_0x3b9949[_0x216a('0x32')]=_[_0x216a('0x33')](_0x117921['query']);_0x3b9949[_0x216a('0x3b')]=_[_0x216a('0x34')](_0x3b9949[_0x216a('0x31')],_0x3b9949[_0x216a('0x32')]);_0x38bfba[_0x216a('0x35')]=_[_0x216a('0x34')](_0x3b9949[_0x216a('0x31')],qs[_0x216a('0x36')](_0x117921[_0x216a('0x32')]['fields']));_0x38bfba[_0x216a('0x35')]=_0x38bfba[_0x216a('0x35')][_0x216a('0x37')]?_0x38bfba[_0x216a('0x35')]:_0x3b9949[_0x216a('0x31')];if(_0x117921[_0x216a('0x32')][_0x216a('0x43')]){_0x38bfba[_0x216a('0x44')]=[{'all':!![]}];}_0x38bfba=_['merge']({},_0x38bfba,_0x117921['options']);return db[_0x216a('0x41')][_0x216a('0x49')](_0x38bfba)[_0x216a('0x42')](handleEntityNotFound(_0x2f1415,null))['then'](respondWithResult(_0x2f1415,null))['catch'](handleError(_0x2f1415,null));};exports[_0x216a('0x4a')]=function(_0x3f41f2,_0x31b8ba){return db[_0x216a('0x41')][_0x216a('0x4a')](_0x3f41f2[_0x216a('0x4b')],{})[_0x216a('0x42')](respondWithResult(_0x31b8ba,0xc9))[_0x216a('0x46')](handleError(_0x31b8ba,null));};exports['clone']=function(_0x56487b,_0x46caaf){var _0x1635aa={'where':{'id':_0x56487b[_0x216a('0x48')]['id']}},_0x5088cf={};_0x5088cf[_0x216a('0x31')]=_['keys'](db[_0x216a('0x41')][_0x216a('0x4c')]);_0x1635aa['attributes']=_[_0x216a('0x34')](_0x5088cf[_0x216a('0x31')],qs[_0x216a('0x36')](_0x56487b[_0x216a('0x32')][_0x216a('0x36')]));_0x1635aa[_0x216a('0x35')]=_0x1635aa[_0x216a('0x35')][_0x216a('0x37')]?_0x1635aa[_0x216a('0x35')]:_0x5088cf[_0x216a('0x31')];if(_0x56487b[_0x216a('0x32')][_0x216a('0x43')]){_0x1635aa['include']=[{'all':!![]}];}_0x1635aa=_['merge']({},_0x1635aa,_0x56487b[_0x216a('0x40')]);return db[_0x216a('0x41')][_0x216a('0x49')](_0x1635aa)[_0x216a('0x42')](handleEntityNotFound(_0x46caaf,null))['then'](function(_0x18fc95){if(_0x18fc95){var _0x4efa34=_0x18fc95[_0x216a('0x4d')]({'plain':!![]});_0x4efa34=qs[_0x216a('0x4e')](_0x4efa34,['id','createdAt',_0x216a('0x4f'),_0x216a('0x50')]);_0x56487b[_0x216a('0x4b')]=_[_0x216a('0x4e')](_0x56487b[_0x216a('0x4b')],['id',_0x216a('0x51'),_0x216a('0x4f')]);return db[_0x216a('0x52')][_0x216a('0x53')](function(_0x437ae5){return db[_0x216a('0x41')][_0x216a('0x4a')](_[_0x216a('0x3f')](_0x4efa34,_0x56487b['body']),{'include':_0x56487b[_0x216a('0x32')][_0x216a('0x43')]?[{'all':!![]}]:undefined,'transaction':_0x437ae5})['then'](function(_0x5c4993){var _0x5b6d81=_0x5c4993['get']({'plain':!![]});return db[_0x216a('0x54')][_0x216a('0x55')]({'where':{'userProfileId':_0x56487b[_0x216a('0x48')]['id']},'raw':!![]})[_0x216a('0x42')](function(_0x542b7d){if(_0x542b7d){return BPromise[_0x216a('0x56')](_0x542b7d,function(_0xfc00e6){return new BPromise(function(_0xafd74b,_0x4c76fa){if(_0xfc00e6[_0x216a('0x57')]===null||_0xfc00e6[_0x216a('0x57')]===0x1)_0xafd74b(null);return db[_0x216a('0x58')][_0x216a('0x55')]({'where':{'sectionId':_0xfc00e6['id']},'raw':!![]})[_0x216a('0x42')](function(_0x9a63a7){var _0x1f16d6=_['map'](_0x9a63a7,function(_0x5dec32){return qs[_0x216a('0x4e')](_0x5dec32,['id','createdAt','updatedAt',_0x216a('0x59')]);});_0xafd74b(_0x1f16d6);})[_0x216a('0x46')](function(_0x190bb6){_0x4c76fa(_0x190bb6);});})[_0x216a('0x42')](function(_0x49cbc3){var _0xc9da0f=qs[_0x216a('0x4e')](_0xfc00e6,['id',_0x216a('0x51'),_0x216a('0x4f')]);_0xc9da0f[_0x216a('0x5a')]=_0x5b6d81['id'];if(_0x49cbc3)_0xc9da0f['Resources']=_0x49cbc3;return _0xc9da0f;})[_0x216a('0x42')](function(_0x159b02){return db[_0x216a('0x54')][_0x216a('0x4a')](_0x159b02,{'include':[{'model':db[_0x216a('0x58')],'as':_0x216a('0x5b')}],'raw':!![],'transaction':_0x437ae5});});})['then'](function(){return _0x5b6d81;});}});});});}})[_0x216a('0x42')](respondWithResult(_0x46caaf,0xc9))['catch'](handleError(_0x46caaf,null));};exports[_0x216a('0x27')]=function(_0x1c7e9b,_0x59028d){if(_0x1c7e9b[_0x216a('0x4b')]['id']){delete _0x1c7e9b['body']['id'];}return db[_0x216a('0x41')][_0x216a('0x49')]({'where':{'id':_0x1c7e9b[_0x216a('0x48')]['id']}})['then'](handleEntityNotFound(_0x59028d,null))[_0x216a('0x42')](saveUpdates(_0x1c7e9b[_0x216a('0x4b')],null))[_0x216a('0x42')](respondWithResult(_0x59028d,null))[_0x216a('0x46')](handleError(_0x59028d,null));};exports['destroy']=function(_0x5b3842,_0x1cf263){return db['UserProfile'][_0x216a('0x49')]({'where':{'id':_0x5b3842[_0x216a('0x48')]['id']}})[_0x216a('0x42')](handleEntityNotFound(_0x1cf263,null))['then'](removeEntity(_0x1cf263,null))['catch'](handleError(_0x1cf263,null));};exports['describe']=function(_0x5c109b,_0xd9e15d){return db[_0x216a('0x41')][_0x216a('0x5c')]()[_0x216a('0x42')](respondWithResult(_0xd9e15d,null))[_0x216a('0x46')](handleError(_0xd9e15d,null));};exports[_0x216a('0x5d')]=function(_0x260ada,_0x3aa096){var _0x5ec531=_0x260ada['body'];return db['UserProfile'][_0x216a('0x49')]({'where':{'id':_0x260ada[_0x216a('0x48')]['id']}})[_0x216a('0x42')](handleEntityNotFound(_0x3aa096,null))[_0x216a('0x42')](function(_0x30a076){if(_0x30a076){return db[_0x216a('0x52')][_0x216a('0x53')](function(_0x56df56){return db[_0x216a('0x54')][_0x216a('0x28')]({'where':{'userProfileId':_0x260ada[_0x216a('0x48')]['id'],'sectionId':_[_0x216a('0x2d')](_0x5ec531,function(_0x3cbebd){return _0x3cbebd[_0x216a('0x59')];})},'transaction':_0x56df56})[_0x216a('0x42')](function(){var _0x52550f=_[_0x216a('0x2d')](_0x5ec531,function(_0x42e239){_0x42e239[_0x216a('0x5a')]=_0x260ada['params']['id'];return _0x42e239;});var _0x5d1346=[];return BPromise[_0x216a('0x56')](_0x52550f,function(_0x5da2cd){return db[_0x216a('0x54')][_0x216a('0x4a')](_0x5da2cd,{'include':[{'model':db[_0x216a('0x58')],'as':_0x216a('0x5b')}],'raw':!![],'transaction':_0x56df56})[_0x216a('0x42')](function(_0x2718db){_0x5d1346[_0x216a('0x5e')](_0x2718db[_0x216a('0x4d')]({'plain':!![]}));});})[_0x216a('0x42')](function(){return _0x5d1346;});});});}})['then'](function(_0x553f2b){return _0x553f2b;})[_0x216a('0x42')](respondWithResult(_0x3aa096,null))[_0x216a('0x46')](handleError(_0x3aa096,null));};exports[_0x216a('0x5f')]=function(_0x3a8126,_0x5b3337){var _0x114434;return db[_0x216a('0x41')][_0x216a('0x49')]({'where':{'id':_0x3a8126[_0x216a('0x48')]['id']},'attributes':['id',_0x216a('0x2a')]})[_0x216a('0x42')](handleEntityNotFound(_0x5b3337,null))['then'](function(_0xefa09c){if(_0xefa09c){_0x114434=_0xefa09c;return db['UserProfileSection']['destroy']({'where':{'userProfileId':_0x3a8126[_0x216a('0x48')]['id'],'sectionId':_0x3a8126['query'][_0x216a('0x60')]}});}})[_0x216a('0x42')](function(){return _0x114434;})[_0x216a('0x42')](respondWithStatusCode(_0x5b3337,null))[_0x216a('0x46')](handleError(_0x5b3337,null));};exports[_0x216a('0x61')]=function(_0x400036,_0x3fdc0d){var _0x328460=[];var _0x44eb51=[];return db['UserProfileSection'][_0x216a('0x55')]({'where':{'userProfileId':_0x400036[_0x216a('0x48')]['id']},'raw':!![]})['then'](function(_0xaf5c0f){_0x328460=_[_0x216a('0x3d')](_0xaf5c0f,function(_0x38f826){return _0x38f826[_0x216a('0x62')]===0x1||_[_0x216a('0x63')]([0x3eb,0x709],_0x38f826[_0x216a('0x59')]);});if(!_[_0x216a('0x64')](_0x328460)){return _['map'](_0x328460,function(_0x28abac){return _0x28abac[_0x216a('0x59')];});}else{return;}})['then'](function(_0x403145){if(_0x403145)_0x44eb51=_0x403145;if(_[_0x216a('0x63')](_0x44eb51,0x64)){var _0x5c4cb1=_[_0x216a('0x49')](_0x328460,{'sectionId':0x64});return hasDefaultDashboard(_0x5c4cb1)[_0x216a('0x42')](function(_0x36738d){return _[_0x216a('0x2d')](_0x328460,function(_0x2b144e){if(_0x2b144e[_0x216a('0x59')]===0x64){_0x2b144e['subsections']=_0x36738d;}return _0x2b144e;});});}else{return;}})[_0x216a('0x42')](function(_0x424fde){if(_0x424fde)_0x328460=_0x424fde;if(_[_0x216a('0x63')](_0x44eb51,0x3eb)){var _0x828758=_['find'](_0x328460,{'sectionId':0x3eb});return getCustomDashboards(_0x828758)[_0x216a('0x42')](function(_0xe5182d){return _[_0x216a('0x2d')](_0x328460,function(_0x18a234){if(_0x828758[_0x216a('0x62')]){if(_0x18a234[_0x216a('0x59')]===0x3eb){_0x18a234[_0x216a('0x65')]=_0xe5182d;}}else{if(_0x18a234[_0x216a('0x59')]===0x64){_0x18a234[_0x216a('0x65')]=_0xe5182d;}}return _0x18a234;});});}else{return;}})[_0x216a('0x42')](function(_0x1879d2){if(_0x1879d2)_0x328460=_0x1879d2;if(_[_0x216a('0x63')](_0x44eb51,0x709)){var _0xb73be7=_[_0x216a('0x49')](_0x328460,{'sectionId':0x709});return getPlugins(_0xb73be7)['then'](function(_0x2433c6){if(_0xb73be7[_0x216a('0x62')]){return _[_0x216a('0x2d')](_0x328460,function(_0x207127){if(_0x207127[_0x216a('0x59')]===0x709){_0x207127[_0x216a('0x65')]=_0x2433c6;}return _0x207127;});}else{var _0x21a83b={'sectionId':0x76c,'enabled':0x1,'subsections':_0x2433c6};var _0x3ba401=_[_0x216a('0x2d')](_0x328460);_0x3ba401[_0x216a('0x5e')](_0x21a83b);return _0x3ba401;}});}else{return;}})[_0x216a('0x42')](function(_0x5a63e3){if(_0x5a63e3)_0x328460=_0x5a63e3;return _[_0x216a('0x3d')](_0x328460,[_0x216a('0x62'),0x1]);})[_0x216a('0x42')](respondWithResult(_0x3fdc0d,null))[_0x216a('0x46')](handleError(_0x3fdc0d,null));};function hasDefaultDashboard(_0x3e69c0){var _0x4fe984=[0x65];return new BPromise(function(_0x50e0b8,_0x1d776f){try{if(_0x3e69c0[_0x216a('0x57')]){_0x50e0b8(_0x4fe984);}else{return db[_0x216a('0x58')]['findOne']({'where':{'sectionId':_0x3e69c0['id']},'raw':!![]})[_0x216a('0x42')](function(_0x5b49a1){_0x5b49a1?_0x50e0b8(_0x4fe984):_0x50e0b8();});}}catch(_0x341717){_0x1d776f(_0x341717);}});}function getCustomDashboards(_0x373fc0){var _0x56e284=[];return new BPromise(function(_0x52df2e,_0x419cf6){try{if(_0x373fc0[_0x216a('0x57')]){return db[_0x216a('0x66')][_0x216a('0x55')]({'raw':!![]})[_0x216a('0x42')](function(_0x5e9b15){_0x5e9b15[_0x216a('0x67')](function(_0x4d5b5f){_0x56e284[_0x216a('0x5e')](_0x4d5b5f['id']+0x1869f);});_0x52df2e(_0x56e284);});}else{return db[_0x216a('0x58')]['findAll']({'where':{'sectionId':_0x373fc0['id']},'raw':!![]})['then'](function(_0x16ad29){_0x16ad29[_0x216a('0x67')](function(_0x538754){_0x56e284[_0x216a('0x5e')](_0x538754['resourceId']+0x1869f);});_0x52df2e(_0x56e284);});}}catch(_0x1df37e){_0x419cf6(_0x1df37e);}});}function getPlugins(_0xc3e887){var _0x37ccc3=[];return new BPromise(function(_0x58d268,_0x55cafb){try{if(_0xc3e887[_0x216a('0x57')]){return db[_0x216a('0x68')]['findAll']({'raw':!![]})['then'](function(_0x29d4b3){_0x29d4b3['forEach'](function(_0x1494ae){_0x37ccc3[_0x216a('0x5e')](_0x1494ae['id']+0x15b38);});_0x58d268(_0x37ccc3);});}else{return db[_0x216a('0x58')][_0x216a('0x55')]({'where':{'sectionId':_0xc3e887['id']},'raw':!![]})['then'](function(_0x5a2629){_0x5a2629[_0x216a('0x67')](function(_0xe3f6b7){_0x37ccc3[_0x216a('0x5e')](_0xe3f6b7['resourceId']+0x15b38);});_0x58d268(_0x37ccc3);});}}catch(_0x495116){_0x55cafb(_0x495116);}});}exports[_0x216a('0x69')]=function(_0x152162,_0x546805){return db[_0x216a('0x41')][_0x216a('0x49')]({'where':{'id':_0x152162[_0x216a('0x48')]['id']}})[_0x216a('0x42')](handleEntityNotFound(_0x546805,null))[_0x216a('0x42')](function(_0x43ef19){if(_0x43ef19){return db[_0x216a('0x52')][_0x216a('0x53')](function(_0x1f4a4f){return db[_0x216a('0x54')][_0x216a('0x55')]({'where':{'userProfileId':_0x152162[_0x216a('0x48')]['id']},'attributes':['id'],'raw':!![]})[_0x216a('0x42')](function(_0x5e576b){if(_0x5e576b){return db[_0x216a('0x54')][_0x216a('0x28')]({'where':{'userProfileId':_0x152162[_0x216a('0x48')]['id'],'id':_[_0x216a('0x2d')](_0x5e576b,function(_0x51af9f){return _0x51af9f['id'];})},'transaction':_0x1f4a4f});}})[_0x216a('0x42')](function(_0x11c04c){var _0x2b754b=_[_0x216a('0x2d')](_0x152162[_0x216a('0x4b')],function(_0x36001c){_0x36001c[_0x216a('0x5a')]=_0x152162[_0x216a('0x48')]['id'];return _0x36001c;});return db['UserProfileSection'][_0x216a('0x6a')](_0x2b754b,{'raw':!![],'transaction':_0x1f4a4f});})[_0x216a('0x42')](function(_0x428379){var _0x34b174=_[_0x216a('0x3d')](_['map'](_0x428379,function(_0xff67be){return _0xff67be['get']({'plain':!![]});}),{'includeAll':![]});if(_0x34b174){return db['UserProfileSection']['findAll']({'where':{'userProfileId':_0x152162['params']['id'],'sectionId':_[_0x216a('0x2d')](_0x34b174,function(_0x4215e9){return _0x4215e9[_0x216a('0x59')];})},'attributes':['id',_0x216a('0x59')],'raw':!![]})['then'](function(_0x8746bd){var _0x87b2a5=_[_0x216a('0x2d')](_0x152162[_0x216a('0x4b')],function(_0x3a8b1a){_0x3a8b1a[_0x216a('0x5a')]=_0x152162[_0x216a('0x48')]['id'];return _0x3a8b1a;});return db[_0x216a('0x58')][_0x216a('0x6a')](_0x87b2a5,{'raw':!![],'transaction':_0x1f4a4f});});}})[_0x216a('0x46')](handleError(_0x546805,null));});}})[_0x216a('0x42')](function(_0x50ec45){var _0x55e9b4=_[_0x216a('0x2d')](_0x50ec45,function(_0x3d6472){return _0x3d6472[_0x216a('0x4d')]({'plain':!![]});});})['then'](respondWithResult(_0x546805,null))[_0x216a('0x46')](handleError(_0x546805,null));};exports[_0x216a('0x6b')]=function(_0x590d03,_0x183d89,_0x3e4829){return db[_0x216a('0x41')][_0x216a('0x49')]({'where':{'id':_0x590d03[_0x216a('0x48')]['id']}})[_0x216a('0x42')](handleEntityNotFound(_0x183d89,null))['then'](function(_0x381ba2){if(_0x381ba2){return _0x381ba2[_0x216a('0x6b')](_0x590d03[_0x216a('0x32')][_0x216a('0x60')]);}})[_0x216a('0x42')](respondWithStatusCode(_0x183d89,null))[_0x216a('0x46')](handleError(_0x183d89,null));};exports[_0x216a('0x6c')]=function(_0x5c8623,_0x2e94fe){var _0x2f5152={};if(!_0x5c8623[_0x216a('0x32')][_0x216a('0x6d')])throw new Error('Missing\x20section\x20parameter');if(!_0x5c8623[_0x216a('0x32')][_0x216a('0x6e')]('nolimit')){_0x2f5152[_0x216a('0x21')]=qs['limit'](_0x5c8623[_0x216a('0x32')][_0x216a('0x21')]);_0x2f5152[_0x216a('0x1f')]=qs[_0x216a('0x1f')](_0x5c8623[_0x216a('0x32')]['offset']);}return db[_0x216a('0x41')][_0x216a('0x49')]({'where':{'id':_0x5c8623[_0x216a('0x48')]['id']}})['then'](function(_0x170af9){if(!_0x170af9)throw new Error('No\x20User\x20Profile\x20found\x20for\x20id\x20'+_0x5c8623[_0x216a('0x48')]['id']);return db[_0x216a('0x41')][_0x216a('0x6c')](_0x5c8623);})[_0x216a('0x42')](respondWithFilteredResult(_0x2e94fe,_0x2f5152))[_0x216a('0x46')](handleError(_0x2e94fe,null));}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.events.js b/server/api/userProfile/userProfile.events.js index f132451..2cad00a 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 _0x4bd3=['events','UserProfile','setMaxListeners','emit','hook','exports'];(function(_0x4febba,_0x2ef37b){var _0x2909cf=function(_0x3ef41c){while(--_0x3ef41c){_0x4febba['push'](_0x4febba['shift']());}};_0x2909cf(++_0x2ef37b);}(_0x4bd3,0x174));var _0x34bd=function(_0x171a99,_0x472db5){_0x171a99=_0x171a99-0x0;var _0x4ea70a=_0x4bd3[_0x171a99];return _0x4ea70a;};'use strict';var EventEmitter=require(_0x34bd('0x0'));var UserProfile=require('../../mysqldb')['db'][_0x34bd('0x1')];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0x34bd('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x22b921){return function(_0x44854a,_0x1fc8eb,_0x5846f3){UserProfileEvents[_0x34bd('0x3')](_0x22b921+':'+_0x44854a['id'],_0x44854a);UserProfileEvents[_0x34bd('0x3')](_0x22b921,_0x44854a);_0x5846f3(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserProfile[_0x34bd('0x4')](e,emitEvent(event));}}module[_0x34bd('0x5')]=UserProfileEvents; \ No newline at end of file +var _0x5ff9=['../../mysqldb','setMaxListeners','save','emit','hasOwnProperty','exports','events'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5ff9,0xa0));var _0x95ff=function(_0x7f6fdf,_0x285285){_0x7f6fdf=_0x7f6fdf-0x0;var _0x1f469d=_0x5ff9[_0x7f6fdf];return _0x1f469d;};'use strict';var EventEmitter=require(_0x95ff('0x0'));var UserProfile=require(_0x95ff('0x1'))['db']['UserProfile'];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0x95ff('0x2')](0x0);var events={'afterCreate':_0x95ff('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x3d1ce4){return function(_0x58eb5d,_0x5b1bee,_0x174f9d){UserProfileEvents[_0x95ff('0x4')](_0x3d1ce4+':'+_0x58eb5d['id'],_0x58eb5d);UserProfileEvents['emit'](_0x3d1ce4,_0x58eb5d);_0x174f9d(null);};}for(var e in events){if(events[_0x95ff('0x5')](e)){var event=events[e];UserProfile['hook'](e,emitEvent(event));}}module[_0x95ff('0x6')]=UserProfileEvents; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.model.js b/server/api/userProfile/userProfile.model.js index 619a44f..55aa3cb 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 _0x0785=['ListId','lists','companies','CmCompany','globalcustomfields','chatqueues','ChatQueue','chatwebsites','ChatWebsite','faxqueues','FaxQueue','faxaccounts','FaxAccount','inboundroutes','internalroutes','VoiceExtension','contexts','VoiceContext','voicemails','VoiceMail','voicerecordings','Agents','membername','User','role','agent','Telephones','telephone','queue','VoiceQueue','inbound','musiconholds','VoiceMusicOnHold','chanspies','VoiceChanSpy','mailqueues','MailQueue','mailaccounts','MailAccount','mailsubstatuses','MailSubstatus','OpenchannelQueue','OpenchannelAccount','smsqueues','smsaccounts','SmsAccount','whatsappqueues','WhatsappQueue','whatsappaccounts','WhatsappAccount','teams','Team','voicequeues','queuecampaigns','parentSections','QueueCampaigns','telephones','Users','admin','ZendeskAccount','salesforceaccounts','SalesforceAccount','freshdeskaccounts','SugarcrmAccount','deskaccounts','DeskAccount','zohoaccounts','ZohoAccount','vtigeraccounts','cannedanswers','dispositions','Disposition','customdashboards','Dashboard','intervals','Interval','Pause','scheduler','Schedule','Tag','templates','triggers','variables','Variable','plugins','Plugin','extractedreports','metrics','AnalyticMetric','charAt','slice','Sequelize','QueryTypes','SELECT','select','ui.','ui.createdAt','user_has_','where','ui.UserId\x20=\x20?','sequelize','query','toString','define','UserProfile','user_profiles','raw','section','mergeResources','Invalid\x20section\x20\x27','isEmpty','push','find','params','all','ignore','length','autoAssociation','model','rawAttributes','keys','filters','intersection','attributes','fields','hasOwnProperty','limit','offset','order','sort','pick','merge','VIRTUAL','AnalyticExtractedReport','foreignKey','forEach','reportType','reportId','CustomReports','count','rows','includeAll','CmContact','color','tag','ThroughTags','openTabs','true','chat','dataValues','sms','mail','openchannel','whatsapp','lodash','./userProfile.attributes','../../components/parsers/qs','squel','exports','models','filter','field','value','then','map','catch','findAll','associatedResources','name','UserProfileResource','type','resourceId','toLowerCase','squareprojects','childModel','SquareProject','squarerecordings','projectName','projects','JscriptyProject','Lists'];(function(_0x257642,_0x270a80){var _0x3d813b=function(_0x2a1c8a){while(--_0x2a1c8a){_0x257642['push'](_0x257642['shift']());}};_0x3d813b(++_0x270a80);}(_0x0785,0x9a));var _0x5078=function(_0x394576,_0x5d447b){_0x394576=_0x394576-0x0;var _0x3dbf0b=_0x0785[_0x394576];return _0x3dbf0b;};'use strict';var _=require(_0x5078('0x0'));var attributes=require(_0x5078('0x1'));var qs=require(_0x5078('0x2'));var squel=require(_0x5078('0x3'));module[_0x5078('0x4')]=function(_0x10660d){var _0x4204d0=_0x10660d[_0x5078('0x5')];function _0x4d0904(_0x344b2f,_0x1fb89d){return new Promise(function(_0xd7f4a5,_0x4455d6){if(!_0x1fb89d)return _0xd7f4a5(null);var _0x248b09=_0x1fb89d[_0x5078('0x6')]?{[_0x1fb89d['filter'][_0x5078('0x7')]]:_0x1fb89d['filter'][_0x5078('0x8')]}:undefined;return _0x4204d0[_0x344b2f]['findAll']({'where':_0x248b09,'raw':!![]})[_0x5078('0x9')](function(_0x713efd){_0x1fb89d['associatedResources']=_[_0x5078('0xa')](_0x713efd,'id');_0xd7f4a5(_0x1fb89d);})[_0x5078('0xb')](function(_0x48aad1){_0x4455d6(_0x48aad1);});});}function _0x128b25(_0x405a85,_0x48d21d){return new Promise(function(_0x59444b,_0x2bdb15){var _0x548006=_0x405a85[_0x5078('0x6')]?{[_0x405a85[_0x5078('0x6')][_0x5078('0x7')]]:_0x405a85[_0x5078('0x6')][_0x5078('0x8')]}:undefined;return _0x4204d0[_0x405a85['model']][_0x5078('0xc')]({'where':_0x548006,'raw':!![]})[_0x5078('0x9')](function(_0x11f405){_0x48d21d[_0x5078('0xd')]=_[_0x5078('0xa')](_0x11f405,function(_0x3d25e4){return _0x3d25e4[_0x5078('0xe')];});_0x59444b(_0x48d21d);})[_0x5078('0xb')](function(_0x41ef39){_0x2bdb15(_0x41ef39);});});}function _0x1e7613(_0x48c253,_0x22a70a,_0x2dff29){if(!_0x22a70a)return Promise['resolve'](null);return new Promise(function(_0x306eb5,_0x163cd6){return _0x4204d0[_0x5078('0xf')][_0x5078('0xc')]({'where':{'sectionId':_0x22a70a['id']},'raw':!![]})[_0x5078('0x9')](function(_0x54b8fa){if(_0x48c253['field']&&_0x48c253[_0x5078('0x7')]!=='id'){_0x22a70a[_0x5078('0xd')]=_[_0x5078('0xa')](_0x54b8fa,function(_0x972f81){return _0x972f81[_0x48c253[_0x5078('0x7')]];});}else{if(_0x2dff29==='AnalyticExtractedReport'){_0x22a70a['associatedResources']=_[_0x5078('0xa')](_0x54b8fa,function(_0xa94ce8){return{'id':_0xa94ce8['resourceId'],'type':_0xa94ce8[_0x5078('0x10')]};});}else{_0x22a70a[_0x5078('0xd')]=_[_0x5078('0xa')](_0x54b8fa,function(_0x4563bf){return _0x4563bf[_0x5078('0x11')];});}}_0x306eb5(_0x22a70a);})['catch'](function(_0x52af87){_0x163cd6(_0x52af87);});});}function _0x27d397(_0x4d0f9c,_0x3fad99){var _0x321ebc={'parentSections':[]};switch(_0x4d0f9c[_0x5078('0x12')]()){case _0x5078('0x13'):_0x321ebc[_0x5078('0x14')]=_0x5078('0x15');break;case'odbc':_0x321ebc['childModel']='SquareOdbc';break;case _0x5078('0x16'):_0x321ebc[_0x5078('0x14')]='SquareRecording';_0x321ebc['parentSections']=[{'name':'SquareProjects','field':'name','foreignKey':_0x5078('0x17')}];break;case _0x5078('0x18'):_0x321ebc[_0x5078('0x14')]=_0x5078('0x19');break;case'contacts':_0x321ebc[_0x5078('0x14')]='CmContact';_0x321ebc['parentSections']=[{'name':_0x5078('0x1a'),'field':'id','foreignKey':_0x5078('0x1b')}];break;case _0x5078('0x1c'):_0x321ebc[_0x5078('0x14')]='CmList';break;case _0x5078('0x1d'):_0x321ebc['childModel']=_0x5078('0x1e');break;case _0x5078('0x1f'):_0x321ebc['childModel']='CmCustomField';break;case _0x5078('0x20'):_0x321ebc[_0x5078('0x14')]=_0x5078('0x21');break;case _0x5078('0x22'):_0x321ebc['childModel']=_0x5078('0x23');break;case _0x5078('0x24'):_0x321ebc['childModel']=_0x5078('0x25');break;case _0x5078('0x26'):_0x321ebc['childModel']=_0x5078('0x27');break;case _0x5078('0x28'):case _0x5078('0x29'):case'outboundroutes':_0x321ebc[_0x5078('0x14')]=_0x5078('0x2a');break;case _0x5078('0x2b'):_0x321ebc[_0x5078('0x14')]=_0x5078('0x2c');break;case _0x5078('0x2d'):_0x321ebc['childModel']=_0x5078('0x2e');break;case _0x5078('0x2f'):_0x321ebc[_0x5078('0x14')]='VoiceRecording';_0x321ebc['parentSections']=[{'name':_0x5078('0x30'),'field':_0x5078('0xe'),'foreignKey':_0x5078('0x31'),'model':_0x5078('0x32'),'filter':{'field':_0x5078('0x33'),'value':[_0x5078('0x34')]}},{'name':_0x5078('0x35'),'field':_0x5078('0xe'),'foreignKey':_0x5078('0x31'),'model':_0x5078('0x32'),'filter':{'field':_0x5078('0x33'),'value':[_0x5078('0x36')]}},{'name':'VoiceQueues','field':_0x5078('0xe'),'foreignKey':_0x5078('0x37'),'model':_0x5078('0x38'),'filter':{'field':_0x5078('0x10'),'value':[_0x5078('0x39')]}},{'name':'QueueCampaigns','field':'name','foreignKey':_0x5078('0x37'),'model':'VoiceQueue','filter':{'field':'type','value':['outbound']}}];break;case _0x5078('0x3a'):_0x321ebc['childModel']=_0x5078('0x3b');break;case _0x5078('0x3c'):_0x321ebc[_0x5078('0x14')]=_0x5078('0x3d');break;case'voiceprefixes':_0x321ebc['childModel']='VoicePrefix';break;case'ivrcampaigns':_0x321ebc[_0x5078('0x14')]='Campaign';break;case _0x5078('0x3e'):_0x321ebc[_0x5078('0x14')]=_0x5078('0x3f');break;case _0x5078('0x40'):_0x321ebc[_0x5078('0x14')]=_0x5078('0x41');break;case _0x5078('0x42'):_0x321ebc[_0x5078('0x14')]=_0x5078('0x43');break;case'openchannelqueues':_0x321ebc[_0x5078('0x14')]=_0x5078('0x44');break;case'openchannelaccounts':_0x321ebc[_0x5078('0x14')]=_0x5078('0x45');break;case _0x5078('0x46'):_0x321ebc[_0x5078('0x14')]='SmsQueue';break;case _0x5078('0x47'):_0x321ebc[_0x5078('0x14')]=_0x5078('0x48');break;case _0x5078('0x49'):_0x321ebc[_0x5078('0x14')]=_0x5078('0x4a');break;case _0x5078('0x4b'):_0x321ebc[_0x5078('0x14')]=_0x5078('0x4c');break;case _0x5078('0x4d'):_0x321ebc[_0x5078('0x14')]=_0x5078('0x4e');break;case _0x5078('0x4f'):case _0x5078('0x50'):_0x321ebc[_0x5078('0x14')]=_0x5078('0x38');if(_0x3fad99){_0x321ebc[_0x5078('0x51')]=[{'name':'VoiceQueues'},{'name':_0x5078('0x52')}];}break;case'users':case'agents':case _0x5078('0x53'):_0x321ebc['childModel']=_0x5078('0x32');if(_0x3fad99){_0x321ebc[_0x5078('0x51')]=[{'name':_0x5078('0x54'),'filter':{'field':_0x5078('0x33'),'value':[_0x5078('0x55'),'user']},'ignore':!![]},{'name':_0x5078('0x30')},{'name':'Telephones'}];}break;case'zendeskaccounts':_0x321ebc[_0x5078('0x14')]=_0x5078('0x56');break;case _0x5078('0x57'):_0x321ebc['childModel']=_0x5078('0x58');break;case _0x5078('0x59'):_0x321ebc['childModel']='FreshdeskAccount';break;case'sugarcrmaccounts':_0x321ebc[_0x5078('0x14')]=_0x5078('0x5a');break;case _0x5078('0x5b'):_0x321ebc[_0x5078('0x14')]=_0x5078('0x5c');break;case _0x5078('0x5d'):_0x321ebc[_0x5078('0x14')]=_0x5078('0x5e');break;case _0x5078('0x5f'):_0x321ebc[_0x5078('0x14')]=_0x5078('0x32');break;case _0x5078('0x60'):_0x321ebc[_0x5078('0x14')]='CannedAnswer';break;case _0x5078('0x61'):_0x321ebc[_0x5078('0x14')]=_0x5078('0x62');break;case _0x5078('0x63'):_0x321ebc['childModel']=_0x5078('0x64');break;case _0x5078('0x65'):_0x321ebc[_0x5078('0x14')]=_0x5078('0x66');break;case'pauses':_0x321ebc['childModel']=_0x5078('0x67');break;case _0x5078('0x68'):_0x321ebc['childModel']=_0x5078('0x69');break;case'sounds':_0x321ebc['childModel']='Sound';break;case'tags':_0x321ebc[_0x5078('0x14')]=_0x5078('0x6a');break;case _0x5078('0x6b'):_0x321ebc[_0x5078('0x14')]='Template';break;case _0x5078('0x6c'):_0x321ebc['childModel']='Trigger';break;case'trunks':_0x321ebc[_0x5078('0x14')]='Trunk';break;case _0x5078('0x6d'):_0x321ebc['childModel']=_0x5078('0x6e');break;case _0x5078('0x6f'):_0x321ebc[_0x5078('0x14')]=_0x5078('0x70');break;case _0x5078('0x71'):_0x321ebc['childModel']='AnalyticExtractedReport';_0x321ebc[_0x5078('0x51')]=[{'name':'Reports','field':'id','foreignKey':'reportId'}];break;case _0x5078('0x72'):_0x321ebc[_0x5078('0x14')]=_0x5078('0x73');break;}return _0x321ebc;}function _0x5b0d0b(_0x5b38c7,_0x356af0){var _0x4f6322=_0x5b38c7[_0x5078('0x74')](0x0)['toUpperCase']()+_0x5b38c7[_0x5078('0x75')](0x1);var _0x29b54b={'type':_0x4204d0[_0x5078('0x76')][_0x5078('0x77')][_0x5078('0x78')],'raw':!![]};return new Promise(function(_0xfec9c1,_0x4a792e){var _0x2f2e6d=squel[_0x5078('0x79')]()[_0x5078('0x7')](_0x5078('0x7a')+_0x4f6322+'InteractionId','id')[_0x5078('0x7')](_0x5078('0x7b'))['from'](_0x5078('0x7c')+_0x5b38c7+'_interactions','ui')[_0x5078('0x7d')](_0x5078('0x7e'),_0x356af0['id']);return _0x4204d0[_0x5078('0x7f')][_0x5078('0x80')](_0x2f2e6d[_0x5078('0x81')](),_0x29b54b)[_0x5078('0x9')](function(_0x5cb0e4){_0x356af0[_0x4f6322+'OpenTabs']=_0x5cb0e4;_0xfec9c1(_0x5cb0e4);})['catch'](function(_0x58a861){_0x4a792e(_0x58a861);});});}return _0x10660d[_0x5078('0x82')](_0x5078('0x83'),attributes,{'tableName':_0x5078('0x84'),'paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x1dc7bf){var _0x3d3e95={'raw':_0x1dc7bf['query'][_0x5078('0x85')],'where':{}};var _0x830b89={};var _0x27477c={'count':0x0,'rows':[]};var _0x2574e9=_0x1dc7bf[_0x5078('0x80')][_0x5078('0x86')];var _0x27d228=_0x1dc7bf['query'][_0x5078('0x87')]||![];var _0x8d9019=_0x27d397(_0x2574e9,_0x27d228);if(!_0x8d9019[_0x5078('0x14')])throw new Error(_0x5078('0x88')+_0x2574e9+'\x27');var _0x42fe99=[{'name':_0x2574e9}];if(!_[_0x5078('0x89')](_0x8d9019[_0x5078('0x51')]))_0x42fe99=_0x8d9019[_0x5078('0x51')];var _0x3cf7c8=[];for(var _0x2db72b=0x0;_0x2db72b<_0x42fe99['length'];_0x2db72b++){_0x3cf7c8[_0x5078('0x8a')](_0x4204d0['UserProfileSection'][_0x5078('0x8b')]({'where':{'userProfileId':_0x1dc7bf[_0x5078('0x8c')]['id'],'name':_0x42fe99[_0x2db72b][_0x5078('0xe')]},'raw':!![]}));}return Promise[_0x5078('0x8d')](_0x3cf7c8)[_0x5078('0x9')](function(_0x3f8e66){var _0x1af540=_[_0x5078('0x6')](_0x3f8e66,function(_0x404cb4){return _0x404cb4?_0x404cb4:undefined;});var _0x31c7f4=_[_0x5078('0x6')](_0x42fe99,[_0x5078('0x8e'),!![]]);var _0x393c39=_[_0x5078('0x89')](_0x1af540)&&_['isEmpty'](_0x31c7f4)?null:_['union'](_0x31c7f4,_0x1af540);if(!_0x393c39)return null;var _0x25667c=[];for(var _0x5ba52c=0x0;_0x5ba52c<_0x393c39[_0x5078('0x8f')];_0x5ba52c++){var _0x3a267a=_[_0x5078('0x8b')](_0x42fe99,function(_0x546115){return _0x393c39[_0x5ba52c]?_0x546115[_0x5078('0xe')]===_0x393c39[_0x5ba52c][_0x5078('0xe')]:null;});if(_0x3a267a){if(_0x393c39[_0x5ba52c][_0x5078('0x8e')]){_0x25667c[_0x5078('0x8a')](_0x4d0904(_0x8d9019['childModel'],_0x393c39[_0x5ba52c]));}else{if(!_0x393c39[_0x5ba52c][_0x5078('0x90')]){_0x25667c[_0x5078('0x8a')](_0x1e7613(_0x3a267a,_0x393c39[_0x5ba52c],_0x8d9019[_0x5078('0x14')]));}else{if(_0x3a267a[_0x5078('0x91')]){_0x25667c[_0x5078('0x8a')](_0x128b25(_0x3a267a,_0x393c39[_0x5ba52c]));}}}}}return Promise['all'](_0x25667c);})['then'](function(_0x2d8df9){var _0x3bcf6f=_0x2d8df9;var _0x33bb7b=null;if(_0x3bcf6f){_0x33bb7b=_0x3bcf6f[_0x5078('0x8f')]===0x1?_0x3bcf6f[0x0]:null;}if(!_0x33bb7b&&!_0x3bcf6f)return _0x27477c;var _0x1cdf34=_0x4204d0[_0x8d9019[_0x5078('0x14')]][_0x5078('0x92')];_0x830b89[_0x5078('0x91')]=_[_0x5078('0x93')](_0x1cdf34);_0x830b89[_0x5078('0x80')]=_[_0x5078('0x93')](_0x1dc7bf[_0x5078('0x80')]);_0x830b89[_0x5078('0x94')]=_[_0x5078('0x95')](_0x830b89[_0x5078('0x91')],_0x830b89[_0x5078('0x80')]);_0x3d3e95[_0x5078('0x96')]=_[_0x5078('0x95')](_0x830b89[_0x5078('0x91')],qs[_0x5078('0x97')](_0x1dc7bf['query'][_0x5078('0x97')]));_0x3d3e95[_0x5078('0x96')]=_0x3d3e95[_0x5078('0x96')][_0x5078('0x8f')]?_0x3d3e95[_0x5078('0x96')]:_0x830b89[_0x5078('0x91')];if(!_0x1dc7bf[_0x5078('0x80')][_0x5078('0x98')]('nolimit')){_0x3d3e95[_0x5078('0x99')]=qs[_0x5078('0x99')](_0x1dc7bf['query'][_0x5078('0x99')]);_0x3d3e95[_0x5078('0x9a')]=qs[_0x5078('0x9a')](_0x1dc7bf['query'][_0x5078('0x9a')]);}_0x3d3e95[_0x5078('0x9b')]=qs['sort'](_0x1dc7bf[_0x5078('0x80')][_0x5078('0x9c')]);_0x3d3e95[_0x5078('0x7d')]=qs[_0x5078('0x94')](_[_0x5078('0x9d')](_0x1dc7bf[_0x5078('0x80')],_0x830b89[_0x5078('0x94')]));if(_0x1dc7bf['query'][_0x5078('0x6')]){_0x3d3e95['where']=_[_0x5078('0x9e')](_0x3d3e95[_0x5078('0x7d')],{'$or':_[_0x5078('0xa')](_0x1cdf34,function(_0x22f81f){if(_0x22f81f[_0x5078('0x10')]['key']!==_0x5078('0x9f')){var _0x34f06a={};_0x34f06a[_0x22f81f[_0x5078('0x7')]]={'$like':'%'+_0x1dc7bf[_0x5078('0x80')][_0x5078('0x6')]+'%'};return _0x34f06a;}})});}var _0x27a59f=[];var _0x4cd168=null;var _0x1a980f={};if(_0x33bb7b){_0x4cd168=_['find'](_0x42fe99,[_0x5078('0xe'),_0x33bb7b[_0x5078('0xe')]]);if(_0x4cd168[_0x5078('0x7')]){_0x1a980f={};if(_0x8d9019[_0x5078('0x14')]===_0x5078('0xa0')){_0x1a980f[_0x4cd168[_0x5078('0xa1')]]=_[_0x5078('0xa')](_0x33bb7b[_0x5078('0xd')],'id');}else{_0x1a980f[_0x4cd168[_0x5078('0xa1')]]=_0x33bb7b[_0x5078('0xd')];}_0x27a59f['push'](_0x1a980f);}else{_0x3d3e95[_0x5078('0x7d')]['id']=_0x33bb7b[_0x5078('0xd')];}}else{for(var _0xd4f476=0x0;_0xd4f476<_0x3bcf6f[_0x5078('0x8f')];_0xd4f476++){_0x4cd168=_[_0x5078('0x8b')](_0x42fe99,[_0x5078('0xe'),_0x3bcf6f[_0xd4f476][_0x5078('0xe')]]);if(_0x4cd168[_0x5078('0x7')]){_0x1a980f={};_0x1a980f[_0x4cd168[_0x5078('0xa1')]]=_0x3bcf6f[_0xd4f476][_0x5078('0xd')];_0x27a59f[_0x5078('0x8a')](_0x1a980f);}else{if(!_0x3d3e95[_0x5078('0x7d')]['id'])_0x3d3e95[_0x5078('0x7d')]['id']=[];_0x3bcf6f[_0xd4f476][_0x5078('0xd')][_0x5078('0xa2')](function(_0x200f85){_0x3d3e95[_0x5078('0x7d')]['id'][_0x5078('0x8a')](_0x200f85);});}}}if(!_[_0x5078('0x89')](_0x27a59f)){_0x3d3e95['where']=_[_0x5078('0x9e')](_0x3d3e95[_0x5078('0x7d')],{'$and':{'$or':_0x27a59f}});}_0x3d3e95=_[_0x5078('0x9e')]({},_0x3d3e95,_0x1dc7bf['options']);if(_0x33bb7b&&!_0x33bb7b[_0x5078('0x90')]&&_0x8d9019[_0x5078('0x14')]==='AnalyticExtractedReport'){if(_0x1dc7bf[_0x5078('0x80')]['includeAll']){_0x3d3e95['include']=[{'all':!![]}];}return _0x4204d0[_0x8d9019[_0x5078('0x14')]][_0x5078('0xc')](_0x3d3e95)[_0x5078('0x9')](function(_0x37e4c7){var _0x5a247e=[];_0x37e4c7['forEach'](function(_0x335af2){var _0x4e2f67;switch(_0x335af2[_0x5078('0xa3')]){case'default':_0x4e2f67=_['find'](_0x33bb7b[_0x5078('0xd')],function(_0x260d4b){return _0x260d4b['id']===_0x335af2[_0x5078('0xa4')]&&_0x260d4b[_0x5078('0x10')]==='DefaultReports';});break;case'custom':_0x4e2f67=_[_0x5078('0x8b')](_0x33bb7b[_0x5078('0xd')],function(_0x5a7dde){return _0x5a7dde['id']===_0x335af2[_0x5078('0xa4')]&&_0x5a7dde[_0x5078('0x10')]===_0x5078('0xa5');});break;}if(_0x4e2f67)_0x5a247e['push'](_0x335af2);});_0x27477c[_0x5078('0xa6')]=_0x5a247e['length'];_0x27477c[_0x5078('0xa7')]=_0x5a247e;return _0x27477c;});}else{return _0x4204d0[_0x8d9019[_0x5078('0x14')]][_0x5078('0xa6')]({'where':_0x3d3e95[_0x5078('0x7d')]})[_0x5078('0x9')](function(_0x5e3b50){_0x27477c['count']=_0x5e3b50;if(_0x1dc7bf[_0x5078('0x80')][_0x5078('0xa8')]){if(_0x8d9019[_0x5078('0x14')]===_0x5078('0xa9')){_0x3d3e95['include']=[{'model':_0x4204d0[_0x5078('0x6a')],'as':'Tags','attributes':['id',_0x5078('0xe'),_0x5078('0xaa')],'required':_0x1dc7bf[_0x5078('0x80')][_0x5078('0xab')]?!![]:![]},{'model':_0x4204d0[_0x5078('0x6a')],'as':_0x5078('0xac'),'attributes':['id',_0x5078('0xe'),_0x5078('0xaa')],'through':_0x1dc7bf[_0x5078('0x80')][_0x5078('0xab')]?{'attributes':[],'where':{'TagId':_0x1dc7bf['query'][_0x5078('0xab')]||undefined}}:{},'required':_0x1dc7bf['query'][_0x5078('0xab')]?!![]:![]}];}else{_0x3d3e95['include']=[{'all':!![]}];}}return _0x4204d0[_0x8d9019['childModel']][_0x5078('0xc')](_0x3d3e95);})[_0x5078('0x9')](function(_0x5d3dc9){_0x27477c[_0x5078('0xa7')]=_0x5d3dc9;if(_0x2574e9===_0x5078('0x30')&&_0x1dc7bf['query'][_0x5078('0xad')]===_0x5078('0xae')){var _0x4d0da2=[];for(var _0x15caaa=0x0;_0x15caaa<_0x27477c['rows'][_0x5078('0x8f')];_0x15caaa++){_0x4d0da2[_0x5078('0x8a')](_0x5b0d0b(_0x5078('0xaf'),_0x27477c[_0x5078('0xa7')][_0x15caaa][_0x5078('0xb0')]));_0x4d0da2['push'](_0x5b0d0b(_0x5078('0xb1'),_0x27477c[_0x5078('0xa7')][_0x15caaa]['dataValues']));_0x4d0da2[_0x5078('0x8a')](_0x5b0d0b('fax',_0x27477c[_0x5078('0xa7')][_0x15caaa][_0x5078('0xb0')]));_0x4d0da2['push'](_0x5b0d0b(_0x5078('0xb2'),_0x27477c[_0x5078('0xa7')][_0x15caaa][_0x5078('0xb0')]));_0x4d0da2[_0x5078('0x8a')](_0x5b0d0b(_0x5078('0xb3'),_0x27477c[_0x5078('0xa7')][_0x15caaa][_0x5078('0xb0')]));_0x4d0da2['push'](_0x5b0d0b(_0x5078('0xb4'),_0x27477c[_0x5078('0xa7')][_0x15caaa][_0x5078('0xb0')]));}return Promise[_0x5078('0x8d')](_0x4d0da2)[_0x5078('0x9')](function(){return _0x27477c;});}return _0x27477c;});}});}}});}; \ No newline at end of file +var _0xf79a=['faxaccounts','FaxAccount','internalroutes','VoiceExtension','contexts','VoiceContext','voicemails','VoiceMail','voicerecordings','VoiceRecording','Agents','membername','User','agent','Telephones','role','queue','VoiceQueue','inbound','QueueCampaigns','VoiceMusicOnHold','VoiceChanSpy','voiceprefixes','ivrcampaigns','Campaign','MailQueue','mailaccounts','MailAccount','mailsubstatuses','MailSubstatus','openchannelqueues','openchannelaccounts','OpenchannelAccount','smsaccounts','SmsAccount','whatsappqueues','WhatsappQueue','whatsappaccounts','WhatsappAccount','teams','voicequeues','VoiceQueues','users','agents','telephones','Users','admin','user','ZendeskAccount','salesforceaccounts','freshdeskaccounts','FreshdeskAccount','SugarcrmAccount','deskaccounts','zohoaccounts','ZohoAccount','cannedanswers','CannedAnswer','Disposition','customdashboards','Dashboard','intervals','Interval','Pause','scheduler','Schedule','sounds','tags','Tag','Template','triggers','Trigger','Trunk','variables','Variable','extractedreports','Reports','reportId','AnalyticMetric','charAt','slice','QueryTypes','select','ui.','InteractionId','ui.createdAt','from','user_has_','_interactions','where','query','toString','UserProfile','user_profiles','raw','section','mergeResources','Invalid\x20section\x20\x27','push','UserProfileSection','find','params','all','ignore','isEmpty','union','length','rawAttributes','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','limit','offset','pick','merge','key','VIRTUAL','foreignKey','forEach','autoAssociation','includeAll','reportType','default','DefaultReports','count','rows','include','Tags','color','tag','ThroughTags','openTabs','true','chat','sms','fax','mail','openchannel','whatsapp','dataValues','lodash','./userProfile.attributes','../../components/parsers/qs','exports','models','filter','field','value','then','associatedResources','map','catch','model','findAll','name','resolve','UserProfileResource','AnalyticExtractedReport','type','resourceId','toLowerCase','squareprojects','childModel','SquareProject','odbc','SquareRecording','parentSections','SquareProjects','projectName','projects','contacts','CmContact','Lists','ListId','lists','companies','CmCompany','globalcustomfields','chatqueues','ChatQueue','chatwebsites','ChatWebsite','faxqueues','FaxQueue'];(function(_0x3ae5e8,_0x4eb175){var _0x3b2b91=function(_0x3ff308){while(--_0x3ff308){_0x3ae5e8['push'](_0x3ae5e8['shift']());}};_0x3b2b91(++_0x4eb175);}(_0xf79a,0x14c));var _0xaf79=function(_0x2cbb3f,_0x3cd395){_0x2cbb3f=_0x2cbb3f-0x0;var _0x1bcbaa=_0xf79a[_0x2cbb3f];return _0x1bcbaa;};'use strict';var _=require(_0xaf79('0x0'));var attributes=require(_0xaf79('0x1'));var qs=require(_0xaf79('0x2'));var squel=require('squel');module[_0xaf79('0x3')]=function(_0x3dfabc){var _0x1baaad=_0x3dfabc[_0xaf79('0x4')];function _0x141e95(_0x8fb88f,_0x25df80){return new Promise(function(_0x841f53,_0x2e54bd){if(!_0x25df80)return _0x841f53(null);var _0x54f773=_0x25df80[_0xaf79('0x5')]?{[_0x25df80[_0xaf79('0x5')][_0xaf79('0x6')]]:_0x25df80[_0xaf79('0x5')][_0xaf79('0x7')]}:undefined;return _0x1baaad[_0x8fb88f]['findAll']({'where':_0x54f773,'raw':!![]})[_0xaf79('0x8')](function(_0x55f9eb){_0x25df80[_0xaf79('0x9')]=_[_0xaf79('0xa')](_0x55f9eb,'id');_0x841f53(_0x25df80);})[_0xaf79('0xb')](function(_0x257b9d){_0x2e54bd(_0x257b9d);});});}function _0x332aa7(_0x5e5542,_0x1fd867){return new Promise(function(_0x1dedf0,_0x2d0aa4){var _0x50b9bf=_0x5e5542['filter']?{[_0x5e5542[_0xaf79('0x5')][_0xaf79('0x6')]]:_0x5e5542['filter']['value']}:undefined;return _0x1baaad[_0x5e5542[_0xaf79('0xc')]][_0xaf79('0xd')]({'where':_0x50b9bf,'raw':!![]})[_0xaf79('0x8')](function(_0x5d1127){_0x1fd867[_0xaf79('0x9')]=_[_0xaf79('0xa')](_0x5d1127,function(_0xbd7bd1){return _0xbd7bd1[_0xaf79('0xe')];});_0x1dedf0(_0x1fd867);})[_0xaf79('0xb')](function(_0x17c9aa){_0x2d0aa4(_0x17c9aa);});});}function _0x1ccd95(_0x2f5708,_0xfb0115,_0x4d1589){if(!_0xfb0115)return Promise[_0xaf79('0xf')](null);return new Promise(function(_0x45e2b8,_0x173294){return _0x1baaad[_0xaf79('0x10')][_0xaf79('0xd')]({'where':{'sectionId':_0xfb0115['id']},'raw':!![]})['then'](function(_0x20925b){if(_0x2f5708['field']&&_0x2f5708[_0xaf79('0x6')]!=='id'){_0xfb0115[_0xaf79('0x9')]=_['map'](_0x20925b,function(_0x27b31e){return _0x27b31e[_0x2f5708[_0xaf79('0x6')]];});}else{if(_0x4d1589===_0xaf79('0x11')){_0xfb0115['associatedResources']=_[_0xaf79('0xa')](_0x20925b,function(_0x264cd2){return{'id':_0x264cd2['resourceId'],'type':_0x264cd2[_0xaf79('0x12')]};});}else{_0xfb0115[_0xaf79('0x9')]=_['map'](_0x20925b,function(_0x592c0c){return _0x592c0c[_0xaf79('0x13')];});}}_0x45e2b8(_0xfb0115);})['catch'](function(_0x5ee750){_0x173294(_0x5ee750);});});}function _0x31768b(_0x13990d,_0x5453ef){var _0x5668c2={'parentSections':[]};switch(_0x13990d[_0xaf79('0x14')]()){case _0xaf79('0x15'):_0x5668c2[_0xaf79('0x16')]=_0xaf79('0x17');break;case _0xaf79('0x18'):_0x5668c2[_0xaf79('0x16')]='SquareOdbc';break;case'squarerecordings':_0x5668c2['childModel']=_0xaf79('0x19');_0x5668c2[_0xaf79('0x1a')]=[{'name':_0xaf79('0x1b'),'field':_0xaf79('0xe'),'foreignKey':_0xaf79('0x1c')}];break;case _0xaf79('0x1d'):_0x5668c2[_0xaf79('0x16')]='JscriptyProject';break;case _0xaf79('0x1e'):_0x5668c2[_0xaf79('0x16')]=_0xaf79('0x1f');_0x5668c2['parentSections']=[{'name':_0xaf79('0x20'),'field':'id','foreignKey':_0xaf79('0x21')}];break;case _0xaf79('0x22'):_0x5668c2[_0xaf79('0x16')]='CmList';break;case _0xaf79('0x23'):_0x5668c2[_0xaf79('0x16')]=_0xaf79('0x24');break;case _0xaf79('0x25'):_0x5668c2[_0xaf79('0x16')]='CmCustomField';break;case _0xaf79('0x26'):_0x5668c2[_0xaf79('0x16')]=_0xaf79('0x27');break;case _0xaf79('0x28'):_0x5668c2['childModel']=_0xaf79('0x29');break;case _0xaf79('0x2a'):_0x5668c2['childModel']=_0xaf79('0x2b');break;case _0xaf79('0x2c'):_0x5668c2[_0xaf79('0x16')]=_0xaf79('0x2d');break;case'inboundroutes':case _0xaf79('0x2e'):case'outboundroutes':_0x5668c2['childModel']=_0xaf79('0x2f');break;case _0xaf79('0x30'):_0x5668c2[_0xaf79('0x16')]=_0xaf79('0x31');break;case _0xaf79('0x32'):_0x5668c2[_0xaf79('0x16')]=_0xaf79('0x33');break;case _0xaf79('0x34'):_0x5668c2[_0xaf79('0x16')]=_0xaf79('0x35');_0x5668c2[_0xaf79('0x1a')]=[{'name':_0xaf79('0x36'),'field':'name','foreignKey':_0xaf79('0x37'),'model':_0xaf79('0x38'),'filter':{'field':'role','value':[_0xaf79('0x39')]}},{'name':_0xaf79('0x3a'),'field':_0xaf79('0xe'),'foreignKey':_0xaf79('0x37'),'model':_0xaf79('0x38'),'filter':{'field':_0xaf79('0x3b'),'value':['telephone']}},{'name':'VoiceQueues','field':_0xaf79('0xe'),'foreignKey':_0xaf79('0x3c'),'model':_0xaf79('0x3d'),'filter':{'field':_0xaf79('0x12'),'value':[_0xaf79('0x3e')]}},{'name':_0xaf79('0x3f'),'field':'name','foreignKey':_0xaf79('0x3c'),'model':'VoiceQueue','filter':{'field':'type','value':['outbound']}}];break;case'musiconholds':_0x5668c2[_0xaf79('0x16')]=_0xaf79('0x40');break;case'chanspies':_0x5668c2[_0xaf79('0x16')]=_0xaf79('0x41');break;case _0xaf79('0x42'):_0x5668c2[_0xaf79('0x16')]='VoicePrefix';break;case _0xaf79('0x43'):_0x5668c2[_0xaf79('0x16')]=_0xaf79('0x44');break;case'mailqueues':_0x5668c2[_0xaf79('0x16')]=_0xaf79('0x45');break;case _0xaf79('0x46'):_0x5668c2[_0xaf79('0x16')]=_0xaf79('0x47');break;case _0xaf79('0x48'):_0x5668c2[_0xaf79('0x16')]=_0xaf79('0x49');break;case _0xaf79('0x4a'):_0x5668c2[_0xaf79('0x16')]='OpenchannelQueue';break;case _0xaf79('0x4b'):_0x5668c2[_0xaf79('0x16')]=_0xaf79('0x4c');break;case'smsqueues':_0x5668c2[_0xaf79('0x16')]='SmsQueue';break;case _0xaf79('0x4d'):_0x5668c2[_0xaf79('0x16')]=_0xaf79('0x4e');break;case _0xaf79('0x4f'):_0x5668c2[_0xaf79('0x16')]=_0xaf79('0x50');break;case _0xaf79('0x51'):_0x5668c2['childModel']=_0xaf79('0x52');break;case _0xaf79('0x53'):_0x5668c2['childModel']='Team';break;case _0xaf79('0x54'):case'queuecampaigns':_0x5668c2['childModel']=_0xaf79('0x3d');if(_0x5453ef){_0x5668c2['parentSections']=[{'name':_0xaf79('0x55')},{'name':_0xaf79('0x3f')}];}break;case _0xaf79('0x56'):case _0xaf79('0x57'):case _0xaf79('0x58'):_0x5668c2[_0xaf79('0x16')]=_0xaf79('0x38');if(_0x5453ef){_0x5668c2[_0xaf79('0x1a')]=[{'name':_0xaf79('0x59'),'filter':{'field':_0xaf79('0x3b'),'value':[_0xaf79('0x5a'),_0xaf79('0x5b')]},'ignore':!![]},{'name':_0xaf79('0x36')},{'name':_0xaf79('0x3a')}];}break;case'zendeskaccounts':_0x5668c2[_0xaf79('0x16')]=_0xaf79('0x5c');break;case _0xaf79('0x5d'):_0x5668c2[_0xaf79('0x16')]='SalesforceAccount';break;case _0xaf79('0x5e'):_0x5668c2['childModel']=_0xaf79('0x5f');break;case'sugarcrmaccounts':_0x5668c2[_0xaf79('0x16')]=_0xaf79('0x60');break;case _0xaf79('0x61'):_0x5668c2[_0xaf79('0x16')]='DeskAccount';break;case _0xaf79('0x62'):_0x5668c2[_0xaf79('0x16')]=_0xaf79('0x63');break;case'vtigeraccounts':_0x5668c2['childModel']='User';break;case _0xaf79('0x64'):_0x5668c2['childModel']=_0xaf79('0x65');break;case'dispositions':_0x5668c2[_0xaf79('0x16')]=_0xaf79('0x66');break;case _0xaf79('0x67'):_0x5668c2['childModel']=_0xaf79('0x68');break;case _0xaf79('0x69'):_0x5668c2[_0xaf79('0x16')]=_0xaf79('0x6a');break;case'pauses':_0x5668c2[_0xaf79('0x16')]=_0xaf79('0x6b');break;case _0xaf79('0x6c'):_0x5668c2[_0xaf79('0x16')]=_0xaf79('0x6d');break;case _0xaf79('0x6e'):_0x5668c2[_0xaf79('0x16')]='Sound';break;case _0xaf79('0x6f'):_0x5668c2[_0xaf79('0x16')]=_0xaf79('0x70');break;case'templates':_0x5668c2[_0xaf79('0x16')]=_0xaf79('0x71');break;case _0xaf79('0x72'):_0x5668c2[_0xaf79('0x16')]=_0xaf79('0x73');break;case'trunks':_0x5668c2['childModel']=_0xaf79('0x74');break;case _0xaf79('0x75'):_0x5668c2[_0xaf79('0x16')]=_0xaf79('0x76');break;case'plugins':_0x5668c2[_0xaf79('0x16')]='Plugin';break;case _0xaf79('0x77'):_0x5668c2[_0xaf79('0x16')]=_0xaf79('0x11');_0x5668c2[_0xaf79('0x1a')]=[{'name':_0xaf79('0x78'),'field':'id','foreignKey':_0xaf79('0x79')}];break;case'metrics':_0x5668c2['childModel']=_0xaf79('0x7a');break;}return _0x5668c2;}function _0xd5e195(_0x1e1a18,_0x501ed4){var _0x456080=_0x1e1a18[_0xaf79('0x7b')](0x0)['toUpperCase']()+_0x1e1a18[_0xaf79('0x7c')](0x1);var _0x107369={'type':_0x1baaad['Sequelize'][_0xaf79('0x7d')]['SELECT'],'raw':!![]};return new Promise(function(_0x142281,_0x41fa64){var _0x160031=squel[_0xaf79('0x7e')]()[_0xaf79('0x6')](_0xaf79('0x7f')+_0x456080+_0xaf79('0x80'),'id')[_0xaf79('0x6')](_0xaf79('0x81'))[_0xaf79('0x82')](_0xaf79('0x83')+_0x1e1a18+_0xaf79('0x84'),'ui')[_0xaf79('0x85')]('ui.UserId\x20=\x20?',_0x501ed4['id']);return _0x1baaad['sequelize'][_0xaf79('0x86')](_0x160031[_0xaf79('0x87')](),_0x107369)[_0xaf79('0x8')](function(_0x2857fa){_0x501ed4[_0x456080+'OpenTabs']=_0x2857fa;_0x142281(_0x2857fa);})[_0xaf79('0xb')](function(_0x213b3a){_0x41fa64(_0x213b3a);});});}return _0x3dfabc['define'](_0xaf79('0x88'),attributes,{'tableName':_0xaf79('0x89'),'paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x6de90){var _0x97e643={'raw':_0x6de90[_0xaf79('0x86')][_0xaf79('0x8a')],'where':{}};var _0x4db96b={};var _0x2bdad1={'count':0x0,'rows':[]};var _0x5ddd05=_0x6de90['query'][_0xaf79('0x8b')];var _0x567b18=_0x6de90[_0xaf79('0x86')][_0xaf79('0x8c')]||![];var _0x14bf1f=_0x31768b(_0x5ddd05,_0x567b18);if(!_0x14bf1f[_0xaf79('0x16')])throw new Error(_0xaf79('0x8d')+_0x5ddd05+'\x27');var _0x293f38=[{'name':_0x5ddd05}];if(!_['isEmpty'](_0x14bf1f[_0xaf79('0x1a')]))_0x293f38=_0x14bf1f[_0xaf79('0x1a')];var _0x171616=[];for(var _0x3d2f1d=0x0;_0x3d2f1d<_0x293f38['length'];_0x3d2f1d++){_0x171616[_0xaf79('0x8e')](_0x1baaad[_0xaf79('0x8f')][_0xaf79('0x90')]({'where':{'userProfileId':_0x6de90[_0xaf79('0x91')]['id'],'name':_0x293f38[_0x3d2f1d][_0xaf79('0xe')]},'raw':!![]}));}return Promise[_0xaf79('0x92')](_0x171616)[_0xaf79('0x8')](function(_0x14fd13){var _0x24a93e=_[_0xaf79('0x5')](_0x14fd13,function(_0x4b8408){return _0x4b8408?_0x4b8408:undefined;});var _0x300efd=_['filter'](_0x293f38,[_0xaf79('0x93'),!![]]);var _0x3da73b=_[_0xaf79('0x94')](_0x24a93e)&&_[_0xaf79('0x94')](_0x300efd)?null:_[_0xaf79('0x95')](_0x300efd,_0x24a93e);if(!_0x3da73b)return null;var _0x485488=[];for(var _0x353ac6=0x0;_0x353ac6<_0x3da73b[_0xaf79('0x96')];_0x353ac6++){var _0x3b3473=_[_0xaf79('0x90')](_0x293f38,function(_0x22d46a){return _0x3da73b[_0x353ac6]?_0x22d46a[_0xaf79('0xe')]===_0x3da73b[_0x353ac6][_0xaf79('0xe')]:null;});if(_0x3b3473){if(_0x3da73b[_0x353ac6][_0xaf79('0x93')]){_0x485488[_0xaf79('0x8e')](_0x141e95(_0x14bf1f[_0xaf79('0x16')],_0x3da73b[_0x353ac6]));}else{if(!_0x3da73b[_0x353ac6]['autoAssociation']){_0x485488[_0xaf79('0x8e')](_0x1ccd95(_0x3b3473,_0x3da73b[_0x353ac6],_0x14bf1f[_0xaf79('0x16')]));}else{if(_0x3b3473[_0xaf79('0xc')]){_0x485488['push'](_0x332aa7(_0x3b3473,_0x3da73b[_0x353ac6]));}}}}}return Promise[_0xaf79('0x92')](_0x485488);})['then'](function(_0x1c8db3){var _0x364cab=_0x1c8db3;var _0x1c0462=null;if(_0x364cab){_0x1c0462=_0x364cab[_0xaf79('0x96')]===0x1?_0x364cab[0x0]:null;}if(!_0x1c0462&&!_0x364cab)return _0x2bdad1;var _0x262e3f=_0x1baaad[_0x14bf1f[_0xaf79('0x16')]][_0xaf79('0x97')];_0x4db96b[_0xaf79('0xc')]=_[_0xaf79('0x98')](_0x262e3f);_0x4db96b[_0xaf79('0x86')]=_[_0xaf79('0x98')](_0x6de90[_0xaf79('0x86')]);_0x4db96b[_0xaf79('0x99')]=_[_0xaf79('0x9a')](_0x4db96b['model'],_0x4db96b[_0xaf79('0x86')]);_0x97e643['attributes']=_[_0xaf79('0x9a')](_0x4db96b[_0xaf79('0xc')],qs[_0xaf79('0x9b')](_0x6de90[_0xaf79('0x86')][_0xaf79('0x9b')]));_0x97e643[_0xaf79('0x9c')]=_0x97e643[_0xaf79('0x9c')]['length']?_0x97e643['attributes']:_0x4db96b[_0xaf79('0xc')];if(!_0x6de90['query'][_0xaf79('0x9d')](_0xaf79('0x9e'))){_0x97e643['limit']=qs[_0xaf79('0x9f')](_0x6de90[_0xaf79('0x86')][_0xaf79('0x9f')]);_0x97e643['offset']=qs[_0xaf79('0xa0')](_0x6de90[_0xaf79('0x86')][_0xaf79('0xa0')]);}_0x97e643['order']=qs['sort'](_0x6de90[_0xaf79('0x86')]['sort']);_0x97e643[_0xaf79('0x85')]=qs[_0xaf79('0x99')](_[_0xaf79('0xa1')](_0x6de90['query'],_0x4db96b['filters']));if(_0x6de90[_0xaf79('0x86')][_0xaf79('0x5')]){_0x97e643[_0xaf79('0x85')]=_[_0xaf79('0xa2')](_0x97e643[_0xaf79('0x85')],{'$or':_['map'](_0x262e3f,function(_0x35b0ee){if(_0x35b0ee[_0xaf79('0x12')][_0xaf79('0xa3')]!==_0xaf79('0xa4')){var _0x734014={};_0x734014[_0x35b0ee['field']]={'$like':'%'+_0x6de90[_0xaf79('0x86')][_0xaf79('0x5')]+'%'};return _0x734014;}})});}var _0x31995a=[];var _0x17ef1a=null;var _0x1e2e28={};if(_0x1c0462){_0x17ef1a=_[_0xaf79('0x90')](_0x293f38,[_0xaf79('0xe'),_0x1c0462[_0xaf79('0xe')]]);if(_0x17ef1a[_0xaf79('0x6')]){_0x1e2e28={};if(_0x14bf1f[_0xaf79('0x16')]===_0xaf79('0x11')){_0x1e2e28[_0x17ef1a['foreignKey']]=_['map'](_0x1c0462[_0xaf79('0x9')],'id');}else{_0x1e2e28[_0x17ef1a['foreignKey']]=_0x1c0462[_0xaf79('0x9')];}_0x31995a[_0xaf79('0x8e')](_0x1e2e28);}else{_0x97e643[_0xaf79('0x85')]['id']=_0x1c0462['associatedResources'];}}else{for(var _0x214776=0x0;_0x214776<_0x364cab[_0xaf79('0x96')];_0x214776++){_0x17ef1a=_['find'](_0x293f38,[_0xaf79('0xe'),_0x364cab[_0x214776][_0xaf79('0xe')]]);if(_0x17ef1a[_0xaf79('0x6')]){_0x1e2e28={};_0x1e2e28[_0x17ef1a[_0xaf79('0xa5')]]=_0x364cab[_0x214776][_0xaf79('0x9')];_0x31995a[_0xaf79('0x8e')](_0x1e2e28);}else{if(!_0x97e643['where']['id'])_0x97e643[_0xaf79('0x85')]['id']=[];_0x364cab[_0x214776]['associatedResources'][_0xaf79('0xa6')](function(_0x2bb754){_0x97e643[_0xaf79('0x85')]['id']['push'](_0x2bb754);});}}}if(!_[_0xaf79('0x94')](_0x31995a)){_0x97e643['where']=_[_0xaf79('0xa2')](_0x97e643[_0xaf79('0x85')],{'$and':{'$or':_0x31995a}});}_0x97e643=_[_0xaf79('0xa2')]({},_0x97e643,_0x6de90['options']);if(_0x1c0462&&!_0x1c0462[_0xaf79('0xa7')]&&_0x14bf1f[_0xaf79('0x16')]===_0xaf79('0x11')){if(_0x6de90[_0xaf79('0x86')][_0xaf79('0xa8')]){_0x97e643['include']=[{'all':!![]}];}return _0x1baaad[_0x14bf1f['childModel']]['findAll'](_0x97e643)[_0xaf79('0x8')](function(_0x7a3727){var _0x227057=[];_0x7a3727[_0xaf79('0xa6')](function(_0x26f59e){var _0x3d8663;switch(_0x26f59e[_0xaf79('0xa9')]){case _0xaf79('0xaa'):_0x3d8663=_['find'](_0x1c0462['associatedResources'],function(_0x5bcd3f){return _0x5bcd3f['id']===_0x26f59e[_0xaf79('0x79')]&&_0x5bcd3f[_0xaf79('0x12')]===_0xaf79('0xab');});break;case'custom':_0x3d8663=_[_0xaf79('0x90')](_0x1c0462[_0xaf79('0x9')],function(_0x31387d){return _0x31387d['id']===_0x26f59e[_0xaf79('0x79')]&&_0x31387d[_0xaf79('0x12')]==='CustomReports';});break;}if(_0x3d8663)_0x227057[_0xaf79('0x8e')](_0x26f59e);});_0x2bdad1[_0xaf79('0xac')]=_0x227057[_0xaf79('0x96')];_0x2bdad1[_0xaf79('0xad')]=_0x227057;return _0x2bdad1;});}else{return _0x1baaad[_0x14bf1f[_0xaf79('0x16')]]['count']({'where':_0x97e643[_0xaf79('0x85')]})[_0xaf79('0x8')](function(_0x31af2f){_0x2bdad1[_0xaf79('0xac')]=_0x31af2f;if(_0x6de90[_0xaf79('0x86')]['includeAll']){if(_0x14bf1f[_0xaf79('0x16')]==='CmContact'){_0x97e643[_0xaf79('0xae')]=[{'model':_0x1baaad[_0xaf79('0x70')],'as':_0xaf79('0xaf'),'attributes':['id','name',_0xaf79('0xb0')],'required':_0x6de90['query'][_0xaf79('0xb1')]?!![]:![]},{'model':_0x1baaad[_0xaf79('0x70')],'as':_0xaf79('0xb2'),'attributes':['id','name',_0xaf79('0xb0')],'through':_0x6de90['query'][_0xaf79('0xb1')]?{'attributes':[],'where':{'TagId':_0x6de90[_0xaf79('0x86')][_0xaf79('0xb1')]||undefined}}:{},'required':_0x6de90[_0xaf79('0x86')][_0xaf79('0xb1')]?!![]:![]}];}else{_0x97e643[_0xaf79('0xae')]=[{'all':!![]}];}}return _0x1baaad[_0x14bf1f['childModel']][_0xaf79('0xd')](_0x97e643);})[_0xaf79('0x8')](function(_0x52ccaa){_0x2bdad1[_0xaf79('0xad')]=_0x52ccaa;if(_0x5ddd05===_0xaf79('0x36')&&_0x6de90[_0xaf79('0x86')][_0xaf79('0xb3')]===_0xaf79('0xb4')){var _0x1024c4=[];for(var _0x355866=0x0;_0x355866<_0x2bdad1['rows'][_0xaf79('0x96')];_0x355866++){_0x1024c4[_0xaf79('0x8e')](_0xd5e195(_0xaf79('0xb5'),_0x2bdad1[_0xaf79('0xad')][_0x355866]['dataValues']));_0x1024c4['push'](_0xd5e195(_0xaf79('0xb6'),_0x2bdad1[_0xaf79('0xad')][_0x355866]['dataValues']));_0x1024c4[_0xaf79('0x8e')](_0xd5e195(_0xaf79('0xb7'),_0x2bdad1[_0xaf79('0xad')][_0x355866]['dataValues']));_0x1024c4[_0xaf79('0x8e')](_0xd5e195(_0xaf79('0xb8'),_0x2bdad1['rows'][_0x355866]['dataValues']));_0x1024c4[_0xaf79('0x8e')](_0xd5e195(_0xaf79('0xb9'),_0x2bdad1[_0xaf79('0xad')][_0x355866]['dataValues']));_0x1024c4[_0xaf79('0x8e')](_0xd5e195(_0xaf79('0xba'),_0x2bdad1['rows'][_0x355866][_0xaf79('0xbb')]));}return Promise[_0xaf79('0x92')](_0x1024c4)['then'](function(){return _0x2bdad1;});}return _0x2bdad1;});}});}}});}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.rpc.js b/server/api/userProfile/userProfile.rpc.js index 0b9f8cb..87ce3b0 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 _0x471a=['moment','randomstring','ioredis','../../mysqldb','../../config/utils','jayson/promise','defaults','redis','localhost','request','then','info','UserProfile,\x20%s,\x20%s','request\x20sent','UserProfile,\x20%s,\x20%s,\x20%s','stringify','error','code','message','lodash','util'];(function(_0xf4356f,_0x478f6d){var _0x3c304c=function(_0x1a08dc){while(--_0x1a08dc){_0xf4356f['push'](_0xf4356f['shift']());}};_0x3c304c(++_0x478f6d);}(_0x471a,0x18d));var _0xa471=function(_0x2f8971,_0x52987f){_0x2f8971=_0x2f8971-0x0;var _0x145510=_0x471a[_0x2f8971];return _0x145510;};'use strict';var _=require(_0xa471('0x0'));var util=require(_0xa471('0x1'));var moment=require(_0xa471('0x2'));var BPromise=require('bluebird');var rs=require(_0xa471('0x3'));var fs=require('fs');var Redis=require(_0xa471('0x4'));var db=require(_0xa471('0x5'))['db'];var utils=require(_0xa471('0x6'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0xa471('0x7'));var client=jayson['client']['http']({'port':0x232a});config['redis']=_[_0xa471('0x8')](config[_0xa471('0x9')],{'host':_0xa471('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa471('0x9')]));require('./userProfile.socket')['register'](socket);function respondWithRpcPromise(_0x13f06e,_0x1b111b,_0x407404){return new BPromise(function(_0x3641a9,_0x55c23a){return client[_0xa471('0xb')](_0x13f06e,_0x407404)[_0xa471('0xc')](function(_0xc9e14f){logger[_0xa471('0xd')](_0xa471('0xe'),_0x1b111b,_0xa471('0xf'));logger['debug'](_0xa471('0x10'),_0x1b111b,'request\x20sent',JSON[_0xa471('0x11')](_0xc9e14f));if(_0xc9e14f['error']){if(_0xc9e14f[_0xa471('0x12')][_0xa471('0x13')]===0x1f4){logger[_0xa471('0x12')](_0xa471('0xe'),_0x1b111b,_0xc9e14f[_0xa471('0x12')][_0xa471('0x14')]);return _0x55c23a(_0xc9e14f['error'][_0xa471('0x14')]);}logger[_0xa471('0x12')](_0xa471('0xe'),_0x1b111b,_0xc9e14f[_0xa471('0x12')][_0xa471('0x14')]);return _0x3641a9(_0xc9e14f['error'][_0xa471('0x14')]);}else{logger[_0xa471('0xd')](_0xa471('0xe'),_0x1b111b,'request\x20sent');_0x3641a9(_0xc9e14f['result'][_0xa471('0x14')]);}})['catch'](function(_0x3ef862){logger['error']('UserProfile,\x20%s,\x20%s',_0x1b111b,_0x3ef862);_0x55c23a(_0x3ef862);});});} \ No newline at end of file +var _0xaafc=['localhost','register','request','then','info','UserProfile,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/environment','client','redis','defaults'];(function(_0xc45cce,_0x100222){var _0x56c536=function(_0x5e9f4e){while(--_0x5e9f4e){_0xc45cce['push'](_0xc45cce['shift']());}};_0x56c536(++_0x100222);}(_0xaafc,0x176));var _0xcaaf=function(_0x1a440f,_0x4ae43f){_0x1a440f=_0x1a440f-0x0;var _0x1bf6c9=_0xaafc[_0x1a440f];return _0x1bf6c9;};'use strict';var _=require('lodash');var util=require(_0xcaaf('0x0'));var moment=require(_0xcaaf('0x1'));var BPromise=require(_0xcaaf('0x2'));var rs=require(_0xcaaf('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xcaaf('0x4'))['db'];var utils=require(_0xcaaf('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0xcaaf('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xcaaf('0x7')]['http']({'port':0x232a});config[_0xcaaf('0x8')]=_[_0xcaaf('0x9')](config[_0xcaaf('0x8')],{'host':_0xcaaf('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xcaaf('0x8')]));require('./userProfile.socket')[_0xcaaf('0xb')](socket);function respondWithRpcPromise(_0x54dc9d,_0x94f4d6,_0x5f11b0){return new BPromise(function(_0x163ced,_0x12f13d){return client[_0xcaaf('0xc')](_0x54dc9d,_0x5f11b0)[_0xcaaf('0xd')](function(_0x3c6e77){logger[_0xcaaf('0xe')](_0xcaaf('0xf'),_0x94f4d6,_0xcaaf('0x10'));logger[_0xcaaf('0x11')]('UserProfile,\x20%s,\x20%s,\x20%s',_0x94f4d6,_0xcaaf('0x10'),JSON[_0xcaaf('0x12')](_0x3c6e77));if(_0x3c6e77[_0xcaaf('0x13')]){if(_0x3c6e77[_0xcaaf('0x13')][_0xcaaf('0x14')]===0x1f4){logger[_0xcaaf('0x13')](_0xcaaf('0xf'),_0x94f4d6,_0x3c6e77[_0xcaaf('0x13')][_0xcaaf('0x15')]);return _0x12f13d(_0x3c6e77[_0xcaaf('0x13')][_0xcaaf('0x15')]);}logger['error'](_0xcaaf('0xf'),_0x94f4d6,_0x3c6e77[_0xcaaf('0x13')][_0xcaaf('0x15')]);return _0x163ced(_0x3c6e77[_0xcaaf('0x13')][_0xcaaf('0x15')]);}else{logger[_0xcaaf('0xe')]('UserProfile,\x20%s,\x20%s',_0x94f4d6,_0xcaaf('0x10'));_0x163ced(_0x3c6e77[_0xcaaf('0x16')]['message']);}})[_0xcaaf('0x17')](function(_0x2c988c){logger[_0xcaaf('0x13')](_0xcaaf('0xf'),_0x94f4d6,_0x2c988c);_0x12f13d(_0x2c988c);});});} \ No newline at end of file diff --git a/server/api/userProfile/userProfile.socket.js b/server/api/userProfile/userProfile.socket.js index da9a34b..d01187b 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 _0xb288=['update','removeListener','register','userProfile:','./userProfile.events','save','remove'];(function(_0x38c009,_0x11bbc7){var _0x4730fb=function(_0x4cc772){while(--_0x4cc772){_0x38c009['push'](_0x38c009['shift']());}};_0x4730fb(++_0x11bbc7);}(_0xb288,0x123));var _0x8b28=function(_0x50b5e3,_0x436e21){_0x50b5e3=_0x50b5e3-0x0;var _0x781400=_0xb288[_0x50b5e3];return _0x781400;};'use strict';var UserProfileEvents=require(_0x8b28('0x0'));var events=[_0x8b28('0x1'),_0x8b28('0x2'),_0x8b28('0x3')];function createListener(_0x1257d8,_0x47e43e){return function(_0x5d1bd1){_0x47e43e['emit'](_0x1257d8,_0x5d1bd1);};}function removeListener(_0x3136f5,_0x156b05){return function(){UserProfileEvents[_0x8b28('0x4')](_0x3136f5,_0x156b05);};}exports[_0x8b28('0x5')]=function(_0x1a53da){for(var _0x44e707=0x0,_0x391227=events['length'];_0x44e707<_0x391227;_0x44e707++){var _0x575d6d=events[_0x44e707];var _0x2e08e4=createListener(_0x8b28('0x6')+_0x575d6d,_0x1a53da);UserProfileEvents['on'](_0x575d6d,_0x2e08e4);}}; \ No newline at end of file +var _0xdf98=['./userProfile.events','save','remove','removeListener','length'];(function(_0x4f2d12,_0x5aedd1){var _0x1cc876=function(_0x47c141){while(--_0x47c141){_0x4f2d12['push'](_0x4f2d12['shift']());}};_0x1cc876(++_0x5aedd1);}(_0xdf98,0x127));var _0x8df9=function(_0x375ccf,_0x14964c){_0x375ccf=_0x375ccf-0x0;var _0x1507e8=_0xdf98[_0x375ccf];return _0x1507e8;};'use strict';var UserProfileEvents=require(_0x8df9('0x0'));var events=[_0x8df9('0x1'),_0x8df9('0x2'),'update'];function createListener(_0x432d85,_0x27004e){return function(_0x20fad6){_0x27004e['emit'](_0x432d85,_0x20fad6);};}function removeListener(_0x406611,_0x42d81d){return function(){UserProfileEvents[_0x8df9('0x3')](_0x406611,_0x42d81d);};}exports['register']=function(_0x573267){for(var _0x46d7d3=0x0,_0x5552c7=events[_0x8df9('0x4')];_0x46d7d3<_0x5552c7;_0x46d7d3++){var _0x6fd7b9=events[_0x46d7d3];var _0x3f744f=createListener('userProfile:'+_0x6fd7b9,_0x573267);UserProfileEvents['on'](_0x6fd7b9,_0x3f744f);}}; \ No newline at end of file diff --git a/server/api/userProfileResource/index.js b/server/api/userProfileResource/index.js index bd7ca1f..0c2a67e 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 _0xd315=['describe','show','post','put','/:id','update','delete','destroy','exports','multer','util','path','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe'];(function(_0x20ddc5,_0x2ce3bf){var _0x1d256e=function(_0x3873ac){while(--_0x3873ac){_0x20ddc5['push'](_0x20ddc5['shift']());}};_0x1d256e(++_0x2ce3bf);}(_0xd315,0x1d1));var _0x5d31=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd315[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x5d31('0x0'));var util=require(_0x5d31('0x1'));var path=require(_0x5d31('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x5d31('0x3')]();var fs_extra=require(_0x5d31('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x5d31('0x5'));var config=require(_0x5d31('0x6'));var controller=require('./userProfileResource.controller');router[_0x5d31('0x7')]('/',auth[_0x5d31('0x8')](),controller['index']);router[_0x5d31('0x7')](_0x5d31('0x9'),auth[_0x5d31('0x8')](),controller[_0x5d31('0xa')]);router['get']('/:id',auth[_0x5d31('0x8')](),controller[_0x5d31('0xb')]);router[_0x5d31('0xc')]('/',auth['isAuthenticated'](),controller['create']);router[_0x5d31('0xd')](_0x5d31('0xe'),auth['isAuthenticated'](),controller[_0x5d31('0xf')]);router[_0x5d31('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x5d31('0x11')]);module[_0x5d31('0x12')]=router; \ No newline at end of file +var _0x2642=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfileResource.controller','get','/describe','isAuthenticated','describe','/:id','post','create','put','update','delete','destroy','exports','multer','util','connect-timeout','express'];(function(_0x8dc04d,_0xaa7559){var _0x2f5f28=function(_0xdd2d1d){while(--_0xdd2d1d){_0x8dc04d['push'](_0x8dc04d['shift']());}};_0x2f5f28(++_0xaa7559);}(_0x2642,0x80));var _0x2264=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x2642[_0x3947c9];return _0x2e7871;};'use strict';var multer=require(_0x2264('0x0'));var util=require(_0x2264('0x1'));var path=require('path');var timeout=require(_0x2264('0x2'));var express=require(_0x2264('0x3'));var router=express[_0x2264('0x4')]();var fs_extra=require(_0x2264('0x5'));var auth=require(_0x2264('0x6'));var interaction=require(_0x2264('0x7'));var config=require(_0x2264('0x8'));var controller=require(_0x2264('0x9'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x2264('0xa')](_0x2264('0xb'),auth[_0x2264('0xc')](),controller[_0x2264('0xd')]);router[_0x2264('0xa')](_0x2264('0xe'),auth[_0x2264('0xc')](),controller['show']);router[_0x2264('0xf')]('/',auth[_0x2264('0xc')](),controller[_0x2264('0x10')]);router[_0x2264('0x11')]('/:id',auth['isAuthenticated'](),controller[_0x2264('0x12')]);router[_0x2264('0x13')](_0x2264('0xe'),auth[_0x2264('0xc')](),controller[_0x2264('0x14')]);module[_0x2264('0x15')]=router; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.attributes.js b/server/api/userProfileResource/userProfileResource.attributes.js index 8ec9156..064e7eb 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 _0xed26=['INTEGER','sequelize','exports','STRING'];(function(_0x22818b,_0x3c8c44){var _0x5e9a47=function(_0x4f47ac){while(--_0x4f47ac){_0x22818b['push'](_0x22818b['shift']());}};_0x5e9a47(++_0x3c8c44);}(_0xed26,0xf1));var _0x6ed2=function(_0x39b91a,_0x443bb1){_0x39b91a=_0x39b91a-0x0;var _0x54b3f4=_0xed26[_0x39b91a];return _0x54b3f4;};'use strict';var Sequelize=require(_0x6ed2('0x0'));module[_0x6ed2('0x1')]={'name':{'type':Sequelize[_0x6ed2('0x2')],'allowNull':![]},'resourceId':{'type':Sequelize[_0x6ed2('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0x6ed2('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x436b=['STRING'];(function(_0x3f4819,_0x4cf509){var _0x100290=function(_0x1485af){while(--_0x1485af){_0x3f4819['push'](_0x3f4819['shift']());}};_0x100290(++_0x4cf509);}(_0x436b,0x19d));var _0xb436=function(_0x509af6,_0x348740){_0x509af6=_0x509af6-0x0;var _0x54edde=_0x436b[_0x509af6];return _0x54edde;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xb436('0x0')],'allowNull':![]},'resourceId':{'type':Sequelize['INTEGER'],'allowNull':![]},'type':{'type':Sequelize[_0xb436('0x0')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.controller.js b/server/api/userProfileResource/userProfileResource.controller.js index af25162..b390bf7 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 _0xc6ac=['filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','findAll','rows','show','params','includeAll','include','find','catch','create','body','update','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','limit','undefined','count','offset','set','Content-Range','apply','reject','save','then','destroy','end','error','name','send','UserProfileResource','rawAttributes','fieldName','type','key','map','query','keys'];(function(_0x58965a,_0x2e71db){var _0x254efc=function(_0xf14fb4){while(--_0xf14fb4){_0x58965a['push'](_0x58965a['shift']());}};_0x254efc(++_0x2e71db);}(_0xc6ac,0x15b));var _0xcc6a=function(_0x35fcaa,_0xde0d63){_0x35fcaa=_0x35fcaa-0x0;var _0x59dcdf=_0xc6ac[_0x35fcaa];return _0x59dcdf;};'use strict';var emlformat=require(_0xcc6a('0x0'));var rimraf=require(_0xcc6a('0x1'));var zipdir=require(_0xcc6a('0x2'));var jsonpatch=require(_0xcc6a('0x3'));var rp=require(_0xcc6a('0x4'));var moment=require(_0xcc6a('0x5'));var BPromise=require(_0xcc6a('0x6'));var Mustache=require(_0xcc6a('0x7'));var util=require(_0xcc6a('0x8'));var path=require(_0xcc6a('0x9'));var sox=require(_0xcc6a('0xa'));var csv=require(_0xcc6a('0xb'));var ejs=require(_0xcc6a('0xc'));var fs=require('fs');var fs_extra=require(_0xcc6a('0xd'));var _=require('lodash');var squel=require(_0xcc6a('0xe'));var crypto=require(_0xcc6a('0xf'));var jsforce=require(_0xcc6a('0x10'));var deskjs=require('desk.js');var toCsv=require(_0xcc6a('0xb'));var querystring=require(_0xcc6a('0x11'));var Papa=require(_0xcc6a('0x12'));var Redis=require(_0xcc6a('0x13'));var authService=require(_0xcc6a('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0xcc6a('0x15'));var hardwareService=require(_0xcc6a('0x16'));var logger=require(_0xcc6a('0x17'))('api');var utils=require(_0xcc6a('0x18'));var config=require(_0xcc6a('0x19'));var licenseUtil=require(_0xcc6a('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x59ce6d,_0xf0f6d5){_0xf0f6d5=_0xf0f6d5||0xcc;return function(_0x211444){if(_0x211444){return _0x59ce6d[_0xcc6a('0x1b')](_0xf0f6d5);}return _0x59ce6d['status'](_0xf0f6d5)['end']();};}function respondWithResult(_0x369dc1,_0xcb9e2e){_0xcb9e2e=_0xcb9e2e||0xc8;return function(_0x43710d){if(_0x43710d){return _0x369dc1[_0xcc6a('0x1c')](_0xcb9e2e)[_0xcc6a('0x1d')](_0x43710d);}};}function respondWithFilteredResult(_0x337ec5,_0x4133fa){return function(_0x403b18){if(_0x403b18){var _0x56ffb0=typeof _0x4133fa['offset']==='undefined'&&typeof _0x4133fa[_0xcc6a('0x1e')]===_0xcc6a('0x1f');var _0x307f2a=_0x403b18[_0xcc6a('0x20')];var _0x33079c=_0x56ffb0?0x0:_0x4133fa[_0xcc6a('0x21')];var _0x2d9585=_0x56ffb0?_0x403b18[_0xcc6a('0x20')]:_0x4133fa[_0xcc6a('0x21')]+_0x4133fa[_0xcc6a('0x1e')];var _0x1d20a3;if(_0x2d9585>=_0x307f2a){_0x2d9585=_0x307f2a;_0x1d20a3=0xc8;}else{_0x1d20a3=0xce;}_0x337ec5['status'](_0x1d20a3);return _0x337ec5[_0xcc6a('0x22')](_0xcc6a('0x23'),_0x33079c+'-'+_0x2d9585+'/'+_0x307f2a)[_0xcc6a('0x1d')](_0x403b18);}return null;};}function patchUpdates(_0x368a6e){return function(_0x1495d8){try{jsonpatch[_0xcc6a('0x24')](_0x1495d8,_0x368a6e,!![]);}catch(_0x36c80f){return BPromise[_0xcc6a('0x25')](_0x36c80f);}return _0x1495d8[_0xcc6a('0x26')]();};}function saveUpdates(_0x19d32c,_0x329d17){return function(_0x845088){if(_0x845088){return _0x845088['update'](_0x19d32c)[_0xcc6a('0x27')](function(_0x3a081e){return _0x3a081e;});}return null;};}function removeEntity(_0x38f812,_0x581aae){return function(_0x10016a){if(_0x10016a){return _0x10016a[_0xcc6a('0x28')]()[_0xcc6a('0x27')](function(){_0x38f812[_0xcc6a('0x1c')](0xcc)[_0xcc6a('0x29')]();});}};}function handleEntityNotFound(_0x5fc697,_0x50abc1){return function(_0x26def8){if(!_0x26def8){_0x5fc697[_0xcc6a('0x1b')](0x194);}return _0x26def8;};}function handleError(_0x3514f3,_0x5f27e5){_0x5f27e5=_0x5f27e5||0x1f4;return function(_0x3afb3a){logger[_0xcc6a('0x2a')](_0x3afb3a['stack']);if(_0x3afb3a[_0xcc6a('0x2b')]){delete _0x3afb3a[_0xcc6a('0x2b')];}_0x3514f3[_0xcc6a('0x1c')](_0x5f27e5)[_0xcc6a('0x2c')](_0x3afb3a);};}exports['index']=function(_0x194aab,_0x3cf14c){var _0x2c6d88={},_0x4f176b={},_0x2590a2={'count':0x0,'rows':[]};var _0x5308d4=_['map'](db[_0xcc6a('0x2d')][_0xcc6a('0x2e')],function(_0x3aa315){return{'name':_0x3aa315[_0xcc6a('0x2f')],'type':_0x3aa315[_0xcc6a('0x30')][_0xcc6a('0x31')]};});_0x4f176b['model']=_[_0xcc6a('0x32')](_0x5308d4,_0xcc6a('0x2b'));_0x4f176b[_0xcc6a('0x33')]=_[_0xcc6a('0x34')](_0x194aab[_0xcc6a('0x33')]);_0x4f176b[_0xcc6a('0x35')]=_[_0xcc6a('0x36')](_0x4f176b[_0xcc6a('0x37')],_0x4f176b['query']);_0x2c6d88[_0xcc6a('0x38')]=_[_0xcc6a('0x36')](_0x4f176b[_0xcc6a('0x37')],qs[_0xcc6a('0x39')](_0x194aab[_0xcc6a('0x33')][_0xcc6a('0x39')]));_0x2c6d88[_0xcc6a('0x38')]=_0x2c6d88['attributes'][_0xcc6a('0x3a')]?_0x2c6d88['attributes']:_0x4f176b['model'];if(!_0x194aab['query'][_0xcc6a('0x3b')](_0xcc6a('0x3c'))){_0x2c6d88[_0xcc6a('0x1e')]=qs[_0xcc6a('0x1e')](_0x194aab[_0xcc6a('0x33')]['limit']);_0x2c6d88['offset']=qs[_0xcc6a('0x21')](_0x194aab[_0xcc6a('0x33')][_0xcc6a('0x21')]);}_0x2c6d88['order']=qs[_0xcc6a('0x3d')](_0x194aab[_0xcc6a('0x33')][_0xcc6a('0x3d')]);_0x2c6d88[_0xcc6a('0x3e')]=qs[_0xcc6a('0x35')](_[_0xcc6a('0x3f')](_0x194aab[_0xcc6a('0x33')],_0x4f176b[_0xcc6a('0x35')]),_0x5308d4);if(_0x194aab[_0xcc6a('0x33')][_0xcc6a('0x40')]){_0x2c6d88[_0xcc6a('0x3e')]=_[_0xcc6a('0x41')](_0x2c6d88[_0xcc6a('0x3e')],{'$or':_[_0xcc6a('0x32')](_0x5308d4,function(_0x262a1e){if(_0x262a1e[_0xcc6a('0x30')]!==_0xcc6a('0x42')){var _0x386cbc={};_0x386cbc[_0x262a1e['name']]={'$like':'%'+_0x194aab['query'][_0xcc6a('0x40')]+'%'};return _0x386cbc;}})});}_0x2c6d88=_[_0xcc6a('0x41')]({},_0x2c6d88,_0x194aab[_0xcc6a('0x43')]);var _0x1fd8e1={'where':_0x2c6d88[_0xcc6a('0x3e')]};return db[_0xcc6a('0x2d')][_0xcc6a('0x20')](_0x1fd8e1)[_0xcc6a('0x27')](function(_0x49b65c){_0x2590a2['count']=_0x49b65c;if(_0x194aab[_0xcc6a('0x33')]['includeAll']){_0x2c6d88['include']=[{'all':!![]}];}return db['UserProfileResource'][_0xcc6a('0x44')](_0x2c6d88);})[_0xcc6a('0x27')](function(_0xb42897){_0x2590a2[_0xcc6a('0x45')]=_0xb42897;return _0x2590a2;})[_0xcc6a('0x27')](respondWithFilteredResult(_0x3cf14c,_0x2c6d88))['catch'](handleError(_0x3cf14c,null));};exports[_0xcc6a('0x46')]=function(_0xfbb079,_0x17e5a0){var _0x2f966f={'raw':![],'where':{'id':_0xfbb079[_0xcc6a('0x47')]['id']}},_0x14ca90={};_0x14ca90['model']=_[_0xcc6a('0x34')](db[_0xcc6a('0x2d')][_0xcc6a('0x2e')]);_0x14ca90[_0xcc6a('0x33')]=_['keys'](_0xfbb079[_0xcc6a('0x33')]);_0x14ca90['filters']=_[_0xcc6a('0x36')](_0x14ca90[_0xcc6a('0x37')],_0x14ca90[_0xcc6a('0x33')]);_0x2f966f['attributes']=_[_0xcc6a('0x36')](_0x14ca90[_0xcc6a('0x37')],qs[_0xcc6a('0x39')](_0xfbb079['query']['fields']));_0x2f966f[_0xcc6a('0x38')]=_0x2f966f[_0xcc6a('0x38')][_0xcc6a('0x3a')]?_0x2f966f[_0xcc6a('0x38')]:_0x14ca90[_0xcc6a('0x37')];if(_0xfbb079['query'][_0xcc6a('0x48')]){_0x2f966f[_0xcc6a('0x49')]=[{'all':!![]}];}_0x2f966f=_['merge']({},_0x2f966f,_0xfbb079[_0xcc6a('0x43')]);return db[_0xcc6a('0x2d')][_0xcc6a('0x4a')](_0x2f966f)[_0xcc6a('0x27')](handleEntityNotFound(_0x17e5a0,null))[_0xcc6a('0x27')](respondWithResult(_0x17e5a0,null))[_0xcc6a('0x4b')](handleError(_0x17e5a0,null));};exports['create']=function(_0x4e1a0b,_0x47c999){return db[_0xcc6a('0x2d')][_0xcc6a('0x4c')](_0x4e1a0b[_0xcc6a('0x4d')],{})[_0xcc6a('0x27')](respondWithResult(_0x47c999,0xc9))['catch'](handleError(_0x47c999,null));};exports[_0xcc6a('0x4e')]=function(_0x5e7bab,_0x3aa7dd){if(_0x5e7bab[_0xcc6a('0x4d')]['id']){delete _0x5e7bab[_0xcc6a('0x4d')]['id'];}return db[_0xcc6a('0x2d')][_0xcc6a('0x4a')]({'where':{'id':_0x5e7bab[_0xcc6a('0x47')]['id']}})['then'](handleEntityNotFound(_0x3aa7dd,null))[_0xcc6a('0x27')](saveUpdates(_0x5e7bab[_0xcc6a('0x4d')],null))[_0xcc6a('0x27')](respondWithResult(_0x3aa7dd,null))[_0xcc6a('0x4b')](handleError(_0x3aa7dd,null));};exports[_0xcc6a('0x28')]=function(_0x362bf6,_0x431684){return db[_0xcc6a('0x2d')][_0xcc6a('0x4a')]({'where':{'id':_0x362bf6[_0xcc6a('0x47')]['id']}})['then'](handleEntityNotFound(_0x431684,null))[_0xcc6a('0x27')](removeEntity(_0x431684,null))[_0xcc6a('0x4b')](handleError(_0x431684,null));};exports[_0xcc6a('0x4f')]=function(_0x34531d,_0x14f5e5){return db[_0xcc6a('0x2d')]['describe']()['then'](respondWithResult(_0x14f5e5,null))[_0xcc6a('0x4b')](handleError(_0x14f5e5,null));}; \ No newline at end of file +var _0x781d=['sendStatus','status','end','offset','undefined','limit','count','Content-Range','json','apply','reject','update','destroy','then','error','name','send','index','map','UserProfileResource','fieldName','type','key','query','keys','intersection','model','attributes','fields','length','nolimit','order','where','filters','filter','merge','VIRTUAL','includeAll','catch','show','params','rawAttributes','options','body','find','describe','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb'];(function(_0x5d4607,_0x6b5e7b){var _0x5e4a86=function(_0x46891a){while(--_0x46891a){_0x5d4607['push'](_0x5d4607['shift']());}};_0x5e4a86(++_0x6b5e7b);}(_0x781d,0x14a));var _0xd781=function(_0x2d7f0e,_0x3e6fbd){_0x2d7f0e=_0x2d7f0e-0x0;var _0x110b07=_0x781d[_0x2d7f0e];return _0x110b07;};'use strict';var emlformat=require(_0xd781('0x0'));var rimraf=require(_0xd781('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xd781('0x2'));var moment=require(_0xd781('0x3'));var BPromise=require(_0xd781('0x4'));var Mustache=require(_0xd781('0x5'));var util=require(_0xd781('0x6'));var path=require(_0xd781('0x7'));var sox=require(_0xd781('0x8'));var csv=require(_0xd781('0x9'));var ejs=require(_0xd781('0xa'));var fs=require('fs');var fs_extra=require(_0xd781('0xb'));var _=require('lodash');var squel=require(_0xd781('0xc'));var crypto=require(_0xd781('0xd'));var jsforce=require(_0xd781('0xe'));var deskjs=require(_0xd781('0xf'));var toCsv=require('to-csv');var querystring=require(_0xd781('0x10'));var Papa=require('papaparse');var Redis=require(_0xd781('0x11'));var authService=require(_0xd781('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xd781('0x13'));var hardwareService=require(_0xd781('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0xd781('0x15'));var config=require(_0xd781('0x16'));var licenseUtil=require(_0xd781('0x17'));var db=require(_0xd781('0x18'))['db'];function respondWithStatusCode(_0xbea78b,_0x1f2f1e){_0x1f2f1e=_0x1f2f1e||0xcc;return function(_0xc7758f){if(_0xc7758f){return _0xbea78b[_0xd781('0x19')](_0x1f2f1e);}return _0xbea78b[_0xd781('0x1a')](_0x1f2f1e)[_0xd781('0x1b')]();};}function respondWithResult(_0xd454e7,_0x587953){_0x587953=_0x587953||0xc8;return function(_0x477bdc){if(_0x477bdc){return _0xd454e7[_0xd781('0x1a')](_0x587953)['json'](_0x477bdc);}};}function respondWithFilteredResult(_0x3a1f48,_0x48bffc){return function(_0x294e5a){if(_0x294e5a){var _0x22d787=typeof _0x48bffc[_0xd781('0x1c')]===_0xd781('0x1d')&&typeof _0x48bffc[_0xd781('0x1e')]===_0xd781('0x1d');var _0x501b0d=_0x294e5a['count'];var _0x1407fc=_0x22d787?0x0:_0x48bffc[_0xd781('0x1c')];var _0x395d9c=_0x22d787?_0x294e5a[_0xd781('0x1f')]:_0x48bffc[_0xd781('0x1c')]+_0x48bffc[_0xd781('0x1e')];var _0x260aa8;if(_0x395d9c>=_0x501b0d){_0x395d9c=_0x501b0d;_0x260aa8=0xc8;}else{_0x260aa8=0xce;}_0x3a1f48[_0xd781('0x1a')](_0x260aa8);return _0x3a1f48['set'](_0xd781('0x20'),_0x1407fc+'-'+_0x395d9c+'/'+_0x501b0d)[_0xd781('0x21')](_0x294e5a);}return null;};}function patchUpdates(_0x1036d3){return function(_0x103758){try{jsonpatch[_0xd781('0x22')](_0x103758,_0x1036d3,!![]);}catch(_0x274665){return BPromise[_0xd781('0x23')](_0x274665);}return _0x103758['save']();};}function saveUpdates(_0xe0c65f,_0x4e2c56){return function(_0x567fdf){if(_0x567fdf){return _0x567fdf[_0xd781('0x24')](_0xe0c65f)['then'](function(_0x175ba6){return _0x175ba6;});}return null;};}function removeEntity(_0x101480,_0x395087){return function(_0x31bf57){if(_0x31bf57){return _0x31bf57[_0xd781('0x25')]()[_0xd781('0x26')](function(){_0x101480[_0xd781('0x1a')](0xcc)[_0xd781('0x1b')]();});}};}function handleEntityNotFound(_0x10940b,_0x5662db){return function(_0x529ca1){if(!_0x529ca1){_0x10940b[_0xd781('0x19')](0x194);}return _0x529ca1;};}function handleError(_0x849587,_0xdad0b1){_0xdad0b1=_0xdad0b1||0x1f4;return function(_0x57b41e){logger[_0xd781('0x27')](_0x57b41e['stack']);if(_0x57b41e['name']){delete _0x57b41e[_0xd781('0x28')];}_0x849587['status'](_0xdad0b1)[_0xd781('0x29')](_0x57b41e);};}exports[_0xd781('0x2a')]=function(_0x5c3848,_0x5b6b9d){var _0x43cc74={},_0x5b0464={},_0x296a0b={'count':0x0,'rows':[]};var _0x4a3bd3=_[_0xd781('0x2b')](db[_0xd781('0x2c')]['rawAttributes'],function(_0x54521e){return{'name':_0x54521e[_0xd781('0x2d')],'type':_0x54521e[_0xd781('0x2e')][_0xd781('0x2f')]};});_0x5b0464['model']=_['map'](_0x4a3bd3,_0xd781('0x28'));_0x5b0464[_0xd781('0x30')]=_[_0xd781('0x31')](_0x5c3848['query']);_0x5b0464['filters']=_[_0xd781('0x32')](_0x5b0464[_0xd781('0x33')],_0x5b0464['query']);_0x43cc74[_0xd781('0x34')]=_[_0xd781('0x32')](_0x5b0464['model'],qs[_0xd781('0x35')](_0x5c3848[_0xd781('0x30')][_0xd781('0x35')]));_0x43cc74[_0xd781('0x34')]=_0x43cc74['attributes'][_0xd781('0x36')]?_0x43cc74[_0xd781('0x34')]:_0x5b0464[_0xd781('0x33')];if(!_0x5c3848[_0xd781('0x30')]['hasOwnProperty'](_0xd781('0x37'))){_0x43cc74[_0xd781('0x1e')]=qs['limit'](_0x5c3848[_0xd781('0x30')]['limit']);_0x43cc74[_0xd781('0x1c')]=qs[_0xd781('0x1c')](_0x5c3848['query'][_0xd781('0x1c')]);}_0x43cc74[_0xd781('0x38')]=qs['sort'](_0x5c3848[_0xd781('0x30')]['sort']);_0x43cc74[_0xd781('0x39')]=qs[_0xd781('0x3a')](_['pick'](_0x5c3848[_0xd781('0x30')],_0x5b0464[_0xd781('0x3a')]),_0x4a3bd3);if(_0x5c3848['query'][_0xd781('0x3b')]){_0x43cc74[_0xd781('0x39')]=_[_0xd781('0x3c')](_0x43cc74['where'],{'$or':_[_0xd781('0x2b')](_0x4a3bd3,function(_0x22b94e){if(_0x22b94e[_0xd781('0x2e')]!==_0xd781('0x3d')){var _0x2e8218={};_0x2e8218[_0x22b94e[_0xd781('0x28')]]={'$like':'%'+_0x5c3848[_0xd781('0x30')][_0xd781('0x3b')]+'%'};return _0x2e8218;}})});}_0x43cc74=_[_0xd781('0x3c')]({},_0x43cc74,_0x5c3848['options']);var _0x2a60d6={'where':_0x43cc74['where']};return db[_0xd781('0x2c')][_0xd781('0x1f')](_0x2a60d6)['then'](function(_0x1a5833){_0x296a0b[_0xd781('0x1f')]=_0x1a5833;if(_0x5c3848[_0xd781('0x30')][_0xd781('0x3e')]){_0x43cc74['include']=[{'all':!![]}];}return db[_0xd781('0x2c')]['findAll'](_0x43cc74);})[_0xd781('0x26')](function(_0xcdaacf){_0x296a0b['rows']=_0xcdaacf;return _0x296a0b;})['then'](respondWithFilteredResult(_0x5b6b9d,_0x43cc74))[_0xd781('0x3f')](handleError(_0x5b6b9d,null));};exports[_0xd781('0x40')]=function(_0x15b49d,_0x23bbab){var _0x53aba6={'raw':![],'where':{'id':_0x15b49d[_0xd781('0x41')]['id']}},_0x46e7f6={};_0x46e7f6['model']=_['keys'](db[_0xd781('0x2c')][_0xd781('0x42')]);_0x46e7f6[_0xd781('0x30')]=_['keys'](_0x15b49d['query']);_0x46e7f6[_0xd781('0x3a')]=_[_0xd781('0x32')](_0x46e7f6[_0xd781('0x33')],_0x46e7f6[_0xd781('0x30')]);_0x53aba6[_0xd781('0x34')]=_[_0xd781('0x32')](_0x46e7f6['model'],qs['fields'](_0x15b49d[_0xd781('0x30')][_0xd781('0x35')]));_0x53aba6[_0xd781('0x34')]=_0x53aba6[_0xd781('0x34')][_0xd781('0x36')]?_0x53aba6['attributes']:_0x46e7f6[_0xd781('0x33')];if(_0x15b49d[_0xd781('0x30')][_0xd781('0x3e')]){_0x53aba6['include']=[{'all':!![]}];}_0x53aba6=_[_0xd781('0x3c')]({},_0x53aba6,_0x15b49d[_0xd781('0x43')]);return db[_0xd781('0x2c')]['find'](_0x53aba6)[_0xd781('0x26')](handleEntityNotFound(_0x23bbab,null))[_0xd781('0x26')](respondWithResult(_0x23bbab,null))['catch'](handleError(_0x23bbab,null));};exports['create']=function(_0x13a907,_0x16d16e){return db[_0xd781('0x2c')]['create'](_0x13a907[_0xd781('0x44')],{})[_0xd781('0x26')](respondWithResult(_0x16d16e,0xc9))[_0xd781('0x3f')](handleError(_0x16d16e,null));};exports[_0xd781('0x24')]=function(_0x336d30,_0x3828ad){if(_0x336d30[_0xd781('0x44')]['id']){delete _0x336d30['body']['id'];}return db[_0xd781('0x2c')][_0xd781('0x45')]({'where':{'id':_0x336d30[_0xd781('0x41')]['id']}})['then'](handleEntityNotFound(_0x3828ad,null))[_0xd781('0x26')](saveUpdates(_0x336d30[_0xd781('0x44')],null))['then'](respondWithResult(_0x3828ad,null))[_0xd781('0x3f')](handleError(_0x3828ad,null));};exports[_0xd781('0x25')]=function(_0x41caac,_0x207546){return db[_0xd781('0x2c')]['find']({'where':{'id':_0x41caac[_0xd781('0x41')]['id']}})['then'](handleEntityNotFound(_0x207546,null))[_0xd781('0x26')](removeEntity(_0x207546,null))['catch'](handleError(_0x207546,null));};exports[_0xd781('0x46')]=function(_0x17a46e,_0x4f9e37){return db[_0xd781('0x2c')]['describe']()['then'](respondWithResult(_0x4f9e37,null))['catch'](handleError(_0x4f9e37,null));}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.model.js b/server/api/userProfileResource/userProfileResource.model.js index e127661..0dcf04a 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 _0x2a57=['UserProfileResource','user_profile_has_resources','resourceId','lodash','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./userProfileResource.attributes','define'];(function(_0x365296,_0x265c7e){var _0x487f87=function(_0x109799){while(--_0x109799){_0x365296['push'](_0x365296['shift']());}};_0x487f87(++_0x265c7e);}(_0x2a57,0xf3));var _0x72a5=function(_0x1b91c7,_0x539acd){_0x1b91c7=_0x1b91c7-0x0;var _0xbbe014=_0x2a57[_0x1b91c7];return _0xbbe014;};'use strict';var _=require(_0x72a5('0x0'));var util=require('util');var logger=require(_0x72a5('0x1'))('api');var moment=require(_0x72a5('0x2'));var BPromise=require(_0x72a5('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x72a5('0x4'));var rimraf=require(_0x72a5('0x5'));var config=require(_0x72a5('0x6'));var attributes=require(_0x72a5('0x7'));module['exports']=function(_0x53241d,_0x2666e9){return _0x53241d[_0x72a5('0x8')](_0x72a5('0x9'),attributes,{'tableName':_0x72a5('0xa'),'paranoid':![],'indexes':[{'name':'compositeIndex','fields':[_0x72a5('0xb'),'sectionId']}],'timestamps':!![]});}; \ No newline at end of file +var _0xe726=['../../config/environment','./userProfileResource.attributes','exports','define','UserProfileResource','user_profile_has_resources','compositeIndex','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0xc31da9,_0x5ba046){var _0x3323d9=function(_0x502ab8){while(--_0x502ab8){_0xc31da9['push'](_0xc31da9['shift']());}};_0x3323d9(++_0x5ba046);}(_0xe726,0xb7));var _0x6e72=function(_0x1e073a,_0x18028c){_0x1e073a=_0x1e073a-0x0;var _0x2a877d=_0xe726[_0x1e073a];return _0x2a877d;};'use strict';var _=require(_0x6e72('0x0'));var util=require(_0x6e72('0x1'));var logger=require(_0x6e72('0x2'))(_0x6e72('0x3'));var moment=require(_0x6e72('0x4'));var BPromise=require(_0x6e72('0x5'));var rp=require(_0x6e72('0x6'));var fs=require('fs');var path=require(_0x6e72('0x7'));var rimraf=require(_0x6e72('0x8'));var config=require(_0x6e72('0x9'));var attributes=require(_0x6e72('0xa'));module[_0x6e72('0xb')]=function(_0x38603e,_0x4243c0){return _0x38603e[_0x6e72('0xc')](_0x6e72('0xd'),attributes,{'tableName':_0x6e72('0xe'),'paranoid':![],'indexes':[{'name':_0x6e72('0xf'),'fields':['resourceId','sectionId']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.rpc.js b/server/api/userProfileResource/userProfileResource.rpc.js index ca92b27..d0aebcd 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 _0xad4d=['../../config/logger','rpc','../../config/environment','jayson/promise','client','request','info','UserProfileResource,\x20%s,\x20%s','debug','UserProfileResource,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb'];(function(_0x11d706,_0x3a85fe){var _0x4acea3=function(_0x2a3182){while(--_0x2a3182){_0x11d706['push'](_0x11d706['shift']());}};_0x4acea3(++_0x3a85fe);}(_0xad4d,0x1c8));var _0xdad4=function(_0x346737,_0x3e6081){_0x346737=_0x346737-0x0;var _0x1ade2e=_0xad4d[_0x346737];return _0x1ade2e;};'use strict';var _=require(_0xdad4('0x0'));var util=require(_0xdad4('0x1'));var moment=require(_0xdad4('0x2'));var BPromise=require(_0xdad4('0x3'));var rs=require(_0xdad4('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xdad4('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xdad4('0x6'))(_0xdad4('0x7'));var config=require(_0xdad4('0x8'));var jayson=require(_0xdad4('0x9'));var client=jayson[_0xdad4('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1cf6a5,_0x10ae7f,_0x326300){return new BPromise(function(_0x36f8f1,_0x5ce44d){return client[_0xdad4('0xb')](_0x1cf6a5,_0x326300)['then'](function(_0x4a9bc1){logger[_0xdad4('0xc')](_0xdad4('0xd'),_0x10ae7f,'request\x20sent');logger[_0xdad4('0xe')](_0xdad4('0xf'),_0x10ae7f,_0xdad4('0x10'),JSON[_0xdad4('0x11')](_0x4a9bc1));if(_0x4a9bc1[_0xdad4('0x12')]){if(_0x4a9bc1[_0xdad4('0x12')][_0xdad4('0x13')]===0x1f4){logger[_0xdad4('0x12')](_0xdad4('0xd'),_0x10ae7f,_0x4a9bc1[_0xdad4('0x12')][_0xdad4('0x14')]);return _0x5ce44d(_0x4a9bc1[_0xdad4('0x12')][_0xdad4('0x14')]);}logger[_0xdad4('0x12')]('UserProfileResource,\x20%s,\x20%s',_0x10ae7f,_0x4a9bc1[_0xdad4('0x12')][_0xdad4('0x14')]);return _0x36f8f1(_0x4a9bc1['error']['message']);}else{logger[_0xdad4('0xc')](_0xdad4('0xd'),_0x10ae7f,'request\x20sent');_0x36f8f1(_0x4a9bc1['result'][_0xdad4('0x14')]);}})[_0xdad4('0x15')](function(_0x27d5e6){logger[_0xdad4('0x12')](_0xdad4('0xd'),_0x10ae7f,_0x27d5e6);_0x5ce44d(_0x27d5e6);});});} \ No newline at end of file +var _0xd88d=['debug','UserProfileResource,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','UserProfileResource,\x20%s,\x20%s','request\x20sent'];(function(_0x17b9f3,_0x2d4d46){var _0x539941=function(_0x45a99c){while(--_0x45a99c){_0x17b9f3['push'](_0x17b9f3['shift']());}};_0x539941(++_0x2d4d46);}(_0xd88d,0x158));var _0xdd88=function(_0x25b746,_0x5d0267){_0x25b746=_0x25b746-0x0;var _0x4a2712=_0xd88d[_0x25b746];return _0x4a2712;};'use strict';var _=require(_0xdd88('0x0'));var util=require(_0xdd88('0x1'));var moment=require(_0xdd88('0x2'));var BPromise=require(_0xdd88('0x3'));var rs=require(_0xdd88('0x4'));var fs=require('fs');var Redis=require(_0xdd88('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xdd88('0x6'));var logger=require(_0xdd88('0x7'))(_0xdd88('0x8'));var config=require(_0xdd88('0x9'));var jayson=require(_0xdd88('0xa'));var client=jayson['client'][_0xdd88('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x451acf,_0x43fc52,_0x4f901f){return new BPromise(function(_0x1b92cc,_0xcc8a53){return client[_0xdd88('0xc')](_0x451acf,_0x4f901f)['then'](function(_0xe3deb5){logger[_0xdd88('0xd')](_0xdd88('0xe'),_0x43fc52,_0xdd88('0xf'));logger[_0xdd88('0x10')](_0xdd88('0x11'),_0x43fc52,_0xdd88('0xf'),JSON[_0xdd88('0x12')](_0xe3deb5));if(_0xe3deb5[_0xdd88('0x13')]){if(_0xe3deb5[_0xdd88('0x13')][_0xdd88('0x14')]===0x1f4){logger['error'](_0xdd88('0xe'),_0x43fc52,_0xe3deb5['error']['message']);return _0xcc8a53(_0xe3deb5[_0xdd88('0x13')]['message']);}logger[_0xdd88('0x13')]('UserProfileResource,\x20%s,\x20%s',_0x43fc52,_0xe3deb5[_0xdd88('0x13')][_0xdd88('0x15')]);return _0x1b92cc(_0xe3deb5[_0xdd88('0x13')][_0xdd88('0x15')]);}else{logger['info'](_0xdd88('0xe'),_0x43fc52,_0xdd88('0xf'));_0x1b92cc(_0xe3deb5[_0xdd88('0x16')][_0xdd88('0x15')]);}})[_0xdd88('0x17')](function(_0x51101c){logger['error']('UserProfileResource,\x20%s,\x20%s',_0x43fc52,_0x51101c);_0xcc8a53(_0x51101c);});});} \ No newline at end of file diff --git a/server/api/userProfileSection/index.js b/server/api/userProfileSection/index.js index 626dccb..38ba4a6 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 _0x9341=['./userProfileSection.controller','isAuthenticated','index','get','/describe','describe','/:id','show','post','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x2f44ff,_0x3fc361){var _0xf448bf=function(_0x414910){while(--_0x414910){_0x2f44ff['push'](_0x2f44ff['shift']());}};_0xf448bf(++_0x3fc361);}(_0x9341,0x17e));var _0x1934=function(_0x2f75f2,_0xc04982){_0x2f75f2=_0x2f75f2-0x0;var _0x54b812=_0x9341[_0x2f75f2];return _0x54b812;};'use strict';var multer=require(_0x1934('0x0'));var util=require(_0x1934('0x1'));var path=require(_0x1934('0x2'));var timeout=require(_0x1934('0x3'));var express=require('express');var router=express[_0x1934('0x4')]();var fs_extra=require(_0x1934('0x5'));var auth=require(_0x1934('0x6'));var interaction=require(_0x1934('0x7'));var config=require(_0x1934('0x8'));var controller=require(_0x1934('0x9'));router['get']('/',auth[_0x1934('0xa')](),controller[_0x1934('0xb')]);router[_0x1934('0xc')](_0x1934('0xd'),auth['isAuthenticated'](),controller[_0x1934('0xe')]);router[_0x1934('0xc')](_0x1934('0xf'),auth[_0x1934('0xa')](),controller[_0x1934('0x10')]);router[_0x1934('0x11')]('/',auth[_0x1934('0xa')](),controller['create']);router[_0x1934('0x12')](_0x1934('0xf'),auth[_0x1934('0xa')](),controller[_0x1934('0x13')]);router[_0x1934('0x14')](_0x1934('0xf'),auth[_0x1934('0xa')](),controller[_0x1934('0x15')]);module[_0x1934('0x16')]=router; \ No newline at end of file +var _0xd8df=['describe','/:id','show','create','put','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','get','isAuthenticated','index','/describe'];(function(_0x19c780,_0x400e30){var _0x2a8139=function(_0x2f548c){while(--_0x2f548c){_0x19c780['push'](_0x19c780['shift']());}};_0x2a8139(++_0x400e30);}(_0xd8df,0x67));var _0xfd8d=function(_0xbce1fe,_0x2a6cb6){_0xbce1fe=_0xbce1fe-0x0;var _0x7d1eb9=_0xd8df[_0xbce1fe];return _0x7d1eb9;};'use strict';var multer=require(_0xfd8d('0x0'));var util=require(_0xfd8d('0x1'));var path=require(_0xfd8d('0x2'));var timeout=require(_0xfd8d('0x3'));var express=require(_0xfd8d('0x4'));var router=express[_0xfd8d('0x5')]();var fs_extra=require(_0xfd8d('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./userProfileSection.controller');router[_0xfd8d('0x7')]('/',auth[_0xfd8d('0x8')](),controller[_0xfd8d('0x9')]);router[_0xfd8d('0x7')](_0xfd8d('0xa'),auth[_0xfd8d('0x8')](),controller[_0xfd8d('0xb')]);router[_0xfd8d('0x7')](_0xfd8d('0xc'),auth[_0xfd8d('0x8')](),controller[_0xfd8d('0xd')]);router['post']('/',auth['isAuthenticated'](),controller[_0xfd8d('0xe')]);router[_0xfd8d('0xf')](_0xfd8d('0xc'),auth[_0xfd8d('0x8')](),controller['update']);router[_0xfd8d('0x10')](_0xfd8d('0xc'),auth[_0xfd8d('0x8')](),controller[_0xfd8d('0x11')]);module[_0xfd8d('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 e17ec8c..ac7ac52 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 _0x80ed=['setDataValue','join','getDataValue','crudPermissions','split','sequelize','STRING','INTEGER','BOOLEAN'];(function(_0x27f30c,_0x955e12){var _0x4d72a0=function(_0x3012c2){while(--_0x3012c2){_0x27f30c['push'](_0x27f30c['shift']());}};_0x4d72a0(++_0x955e12);}(_0x80ed,0x11c));var _0xd80e=function(_0xfdad5f,_0x45facb){_0xfdad5f=_0xfdad5f-0x0;var _0x2d265a=_0x80ed[_0xfdad5f];return _0x2d265a;};'use strict';var Sequelize=require(_0xd80e('0x0'));module['exports']={'name':{'type':Sequelize[_0xd80e('0x1')],'allowNull':![]},'category':{'type':Sequelize[_0xd80e('0x1')],'allowNull':![]},'sectionId':{'type':Sequelize[_0xd80e('0x2')],'allowNull':![]},'enabled':{'type':Sequelize['BOOLEAN'],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0xd80e('0x3')],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0xd80e('0x1')],'set':function(_0x2b742b){this[_0xd80e('0x4')]('crudPermissions',_0x2b742b?_0x2b742b[_0xd80e('0x5')](''):[]);},'get':function(){return this[_0xd80e('0x6')](_0xd80e('0x7'))?this['getDataValue'](_0xd80e('0x7'))[_0xd80e('0x8')](''):[];}}}; \ No newline at end of file +var _0x373d=['STRING','INTEGER','BOOLEAN','setDataValue','getDataValue','crudPermissions','sequelize'];(function(_0x2f5ac5,_0x1ee939){var _0x37c9a8=function(_0x15031f){while(--_0x15031f){_0x2f5ac5['push'](_0x2f5ac5['shift']());}};_0x37c9a8(++_0x1ee939);}(_0x373d,0x1e2));var _0xd373=function(_0x12ddd3,_0x175755){_0x12ddd3=_0x12ddd3-0x0;var _0x116185=_0x373d[_0x12ddd3];return _0x116185;};'use strict';var Sequelize=require(_0xd373('0x0'));module['exports']={'name':{'type':Sequelize[_0xd373('0x1')],'allowNull':![]},'category':{'type':Sequelize[_0xd373('0x1')],'allowNull':![]},'sectionId':{'type':Sequelize[_0xd373('0x2')],'allowNull':![]},'enabled':{'type':Sequelize[_0xd373('0x3')],'defaultValue':null},'autoAssociation':{'type':Sequelize['BOOLEAN'],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0xd373('0x1')],'set':function(_0x547fca){this[_0xd373('0x4')]('crudPermissions',_0x547fca?_0x547fca['join'](''):[]);},'get':function(){return this[_0xd373('0x5')](_0xd373('0x6'))?this[_0xd373('0x5')](_0xd373('0x6'))['split'](''):[];}}}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.controller.js b/server/api/userProfileSection/userProfileSection.controller.js index c56c527..e065bf0 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 _0x5a55=['eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','Content-Range','reject','save','destroy','then','error','stack','name','send','index','rawAttributes','fieldName','model','map','query','filters','intersection','attributes','fields','hasOwnProperty','order','sort','pick','filter','where','merge','type','options','UserProfileSection','include','rows','catch','show','keys','find','create','body','update','params','describe'];(function(_0xa8ff84,_0x1cef90){var _0x10f43f=function(_0x1404aa){while(--_0x1404aa){_0xa8ff84['push'](_0xa8ff84['shift']());}};_0x10f43f(++_0x1cef90);}(_0x5a55,0x1b6));var _0x55a5=function(_0x213518,_0x51e022){_0x213518=_0x213518-0x0;var _0x1baf75=_0x5a55[_0x213518];return _0x1baf75;};'use strict';var emlformat=require(_0x55a5('0x0'));var rimraf=require(_0x55a5('0x1'));var zipdir=require(_0x55a5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x55a5('0x3'));var moment=require('moment');var BPromise=require(_0x55a5('0x4'));var Mustache=require(_0x55a5('0x5'));var util=require(_0x55a5('0x6'));var path=require(_0x55a5('0x7'));var sox=require('sox');var csv=require(_0x55a5('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x55a5('0x9'));var _=require(_0x55a5('0xa'));var squel=require('squel');var crypto=require(_0x55a5('0xb'));var jsforce=require(_0x55a5('0xc'));var deskjs=require(_0x55a5('0xd'));var toCsv=require(_0x55a5('0x8'));var querystring=require(_0x55a5('0xe'));var Papa=require('papaparse');var Redis=require(_0x55a5('0xf'));var authService=require(_0x55a5('0x10'));var qs=require(_0x55a5('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x55a5('0x12'));var logger=require(_0x55a5('0x13'))(_0x55a5('0x14'));var utils=require(_0x55a5('0x15'));var config=require(_0x55a5('0x16'));var licenseUtil=require(_0x55a5('0x17'));var db=require(_0x55a5('0x18'))['db'];function respondWithStatusCode(_0x29d99d,_0x5f2f98){_0x5f2f98=_0x5f2f98||0xcc;return function(_0x3c7533){if(_0x3c7533){return _0x29d99d[_0x55a5('0x19')](_0x5f2f98);}return _0x29d99d[_0x55a5('0x1a')](_0x5f2f98)[_0x55a5('0x1b')]();};}function respondWithResult(_0x2950ca,_0xe56167){_0xe56167=_0xe56167||0xc8;return function(_0x452228){if(_0x452228){return _0x2950ca[_0x55a5('0x1a')](_0xe56167)[_0x55a5('0x1c')](_0x452228);}};}function respondWithFilteredResult(_0x33fcb4,_0x7702b6){return function(_0x45db89){if(_0x45db89){var _0xbb3b8b=typeof _0x7702b6[_0x55a5('0x1d')]===_0x55a5('0x1e')&&typeof _0x7702b6['limit']==='undefined';var _0x578d5f=_0x45db89[_0x55a5('0x1f')];var _0x3ed31d=_0xbb3b8b?0x0:_0x7702b6['offset'];var _0x477549=_0xbb3b8b?_0x45db89[_0x55a5('0x1f')]:_0x7702b6[_0x55a5('0x1d')]+_0x7702b6[_0x55a5('0x20')];var _0x289e1d;if(_0x477549>=_0x578d5f){_0x477549=_0x578d5f;_0x289e1d=0xc8;}else{_0x289e1d=0xce;}_0x33fcb4['status'](_0x289e1d);return _0x33fcb4['set'](_0x55a5('0x21'),_0x3ed31d+'-'+_0x477549+'/'+_0x578d5f)[_0x55a5('0x1c')](_0x45db89);}return null;};}function patchUpdates(_0x1565ad){return function(_0x139dff){try{jsonpatch['apply'](_0x139dff,_0x1565ad,!![]);}catch(_0x3b99aa){return BPromise[_0x55a5('0x22')](_0x3b99aa);}return _0x139dff[_0x55a5('0x23')]();};}function saveUpdates(_0x3b4a15,_0x15cac3){return function(_0x51164a){if(_0x51164a){return _0x51164a['update'](_0x3b4a15)['then'](function(_0x52fe5c){return _0x52fe5c;});}return null;};}function removeEntity(_0x3d6189,_0x4506c5){return function(_0x10ff60){if(_0x10ff60){return _0x10ff60[_0x55a5('0x24')]()[_0x55a5('0x25')](function(){_0x3d6189[_0x55a5('0x1a')](0xcc)[_0x55a5('0x1b')]();});}};}function handleEntityNotFound(_0x32fcc8,_0x246525){return function(_0x123302){if(!_0x123302){_0x32fcc8[_0x55a5('0x19')](0x194);}return _0x123302;};}function handleError(_0x41f4aa,_0x20404f){_0x20404f=_0x20404f||0x1f4;return function(_0x18c803){logger[_0x55a5('0x26')](_0x18c803[_0x55a5('0x27')]);if(_0x18c803[_0x55a5('0x28')]){delete _0x18c803['name'];}_0x41f4aa['status'](_0x20404f)[_0x55a5('0x29')](_0x18c803);};}exports[_0x55a5('0x2a')]=function(_0x9479c2,_0x18eef1){var _0x4823ef={},_0x4308dc={},_0x1f45ae={'count':0x0,'rows':[]};var _0x4c5a34=_['map'](db['UserProfileSection'][_0x55a5('0x2b')],function(_0x4f1202){return{'name':_0x4f1202[_0x55a5('0x2c')],'type':_0x4f1202['type']['key']};});_0x4308dc[_0x55a5('0x2d')]=_[_0x55a5('0x2e')](_0x4c5a34,_0x55a5('0x28'));_0x4308dc['query']=_['keys'](_0x9479c2[_0x55a5('0x2f')]);_0x4308dc[_0x55a5('0x30')]=_[_0x55a5('0x31')](_0x4308dc[_0x55a5('0x2d')],_0x4308dc[_0x55a5('0x2f')]);_0x4823ef[_0x55a5('0x32')]=_[_0x55a5('0x31')](_0x4308dc['model'],qs['fields'](_0x9479c2[_0x55a5('0x2f')][_0x55a5('0x33')]));_0x4823ef[_0x55a5('0x32')]=_0x4823ef[_0x55a5('0x32')]['length']?_0x4823ef[_0x55a5('0x32')]:_0x4308dc['model'];if(!_0x9479c2[_0x55a5('0x2f')][_0x55a5('0x34')]('nolimit')){_0x4823ef['limit']=qs['limit'](_0x9479c2[_0x55a5('0x2f')][_0x55a5('0x20')]);_0x4823ef['offset']=qs[_0x55a5('0x1d')](_0x9479c2[_0x55a5('0x2f')]['offset']);}_0x4823ef[_0x55a5('0x35')]=qs['sort'](_0x9479c2[_0x55a5('0x2f')][_0x55a5('0x36')]);_0x4823ef['where']=qs[_0x55a5('0x30')](_[_0x55a5('0x37')](_0x9479c2[_0x55a5('0x2f')],_0x4308dc[_0x55a5('0x30')]),_0x4c5a34);if(_0x9479c2[_0x55a5('0x2f')][_0x55a5('0x38')]){_0x4823ef[_0x55a5('0x39')]=_[_0x55a5('0x3a')](_0x4823ef[_0x55a5('0x39')],{'$or':_[_0x55a5('0x2e')](_0x4c5a34,function(_0x5c683e){if(_0x5c683e[_0x55a5('0x3b')]!=='VIRTUAL'){var _0x276d9c={};_0x276d9c[_0x5c683e[_0x55a5('0x28')]]={'$like':'%'+_0x9479c2[_0x55a5('0x2f')]['filter']+'%'};return _0x276d9c;}})});}_0x4823ef=_[_0x55a5('0x3a')]({},_0x4823ef,_0x9479c2[_0x55a5('0x3c')]);var _0x149c45={'where':_0x4823ef[_0x55a5('0x39')]};return db[_0x55a5('0x3d')][_0x55a5('0x1f')](_0x149c45)[_0x55a5('0x25')](function(_0x7c840c){_0x1f45ae[_0x55a5('0x1f')]=_0x7c840c;if(_0x9479c2[_0x55a5('0x2f')]['includeAll']){_0x4823ef[_0x55a5('0x3e')]=[{'all':!![]}];}return db[_0x55a5('0x3d')]['findAll'](_0x4823ef);})[_0x55a5('0x25')](function(_0x464a4d){_0x1f45ae[_0x55a5('0x3f')]=_0x464a4d;return _0x1f45ae;})[_0x55a5('0x25')](respondWithFilteredResult(_0x18eef1,_0x4823ef))[_0x55a5('0x40')](handleError(_0x18eef1,null));};exports[_0x55a5('0x41')]=function(_0x327c2c,_0x1aa525){var _0x5f2b11={'raw':![],'where':{'id':_0x327c2c['params']['id']}},_0x47cd68={};_0x47cd68['model']=_[_0x55a5('0x42')](db[_0x55a5('0x3d')]['rawAttributes']);_0x47cd68[_0x55a5('0x2f')]=_[_0x55a5('0x42')](_0x327c2c[_0x55a5('0x2f')]);_0x47cd68[_0x55a5('0x30')]=_[_0x55a5('0x31')](_0x47cd68[_0x55a5('0x2d')],_0x47cd68['query']);_0x5f2b11[_0x55a5('0x32')]=_[_0x55a5('0x31')](_0x47cd68[_0x55a5('0x2d')],qs[_0x55a5('0x33')](_0x327c2c[_0x55a5('0x2f')][_0x55a5('0x33')]));_0x5f2b11['attributes']=_0x5f2b11[_0x55a5('0x32')]['length']?_0x5f2b11[_0x55a5('0x32')]:_0x47cd68[_0x55a5('0x2d')];if(_0x327c2c[_0x55a5('0x2f')]['includeAll']){_0x5f2b11[_0x55a5('0x3e')]=[{'all':!![]}];}_0x5f2b11=_['merge']({},_0x5f2b11,_0x327c2c['options']);return db[_0x55a5('0x3d')][_0x55a5('0x43')](_0x5f2b11)['then'](handleEntityNotFound(_0x1aa525,null))['then'](respondWithResult(_0x1aa525,null))['catch'](handleError(_0x1aa525,null));};exports[_0x55a5('0x44')]=function(_0x55b90,_0x23afea){return db['UserProfileSection'][_0x55a5('0x44')](_0x55b90[_0x55a5('0x45')],{})[_0x55a5('0x25')](respondWithResult(_0x23afea,0xc9))[_0x55a5('0x40')](handleError(_0x23afea,null));};exports[_0x55a5('0x46')]=function(_0x5bb5b7,_0x55ba2e){if(_0x5bb5b7['body']['id']){delete _0x5bb5b7[_0x55a5('0x45')]['id'];}return db['UserProfileSection']['find']({'where':{'id':_0x5bb5b7['params']['id']}})[_0x55a5('0x25')](handleEntityNotFound(_0x55ba2e,null))[_0x55a5('0x25')](saveUpdates(_0x5bb5b7['body'],null))[_0x55a5('0x25')](respondWithResult(_0x55ba2e,null))[_0x55a5('0x40')](handleError(_0x55ba2e,null));};exports[_0x55a5('0x24')]=function(_0x57d4e4,_0x3d0056){return db[_0x55a5('0x3d')][_0x55a5('0x43')]({'where':{'id':_0x57d4e4[_0x55a5('0x47')]['id']}})['then'](handleEntityNotFound(_0x3d0056,null))[_0x55a5('0x25')](removeEntity(_0x3d0056,null))['catch'](handleError(_0x3d0056,null));};exports[_0x55a5('0x48')]=function(_0x2d6a69,_0x46a624){return db[_0x55a5('0x3d')][_0x55a5('0x48')]()[_0x55a5('0x25')](respondWithResult(_0x46a624,null))[_0x55a5('0x40')](handleError(_0x46a624,null));}; \ No newline at end of file +var _0x7ee8=['../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','error','stack','name','send','index','map','UserProfileSection','rawAttributes','type','model','query','keys','filters','intersection','attributes','nolimit','sort','pick','filter','where','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','fields','find','create','body','destroy','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util'];(function(_0x265628,_0x397fdd){var _0x30dc6e=function(_0x42be15){while(--_0x42be15){_0x265628['push'](_0x265628['shift']());}};_0x30dc6e(++_0x397fdd);}(_0x7ee8,0xcd));var _0x87ee=function(_0x38d6e8,_0x21c3b9){_0x38d6e8=_0x38d6e8-0x0;var _0x37e27f=_0x7ee8[_0x38d6e8];return _0x37e27f;};'use strict';var emlformat=require(_0x87ee('0x0'));var rimraf=require(_0x87ee('0x1'));var zipdir=require(_0x87ee('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x87ee('0x3'));var moment=require(_0x87ee('0x4'));var BPromise=require(_0x87ee('0x5'));var Mustache=require(_0x87ee('0x6'));var util=require(_0x87ee('0x7'));var path=require(_0x87ee('0x8'));var sox=require(_0x87ee('0x9'));var csv=require('to-csv');var ejs=require(_0x87ee('0xa'));var fs=require('fs');var fs_extra=require(_0x87ee('0xb'));var _=require(_0x87ee('0xc'));var squel=require(_0x87ee('0xd'));var crypto=require(_0x87ee('0xe'));var jsforce=require(_0x87ee('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x87ee('0x10'));var querystring=require(_0x87ee('0x11'));var Papa=require(_0x87ee('0x12'));var Redis=require(_0x87ee('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x87ee('0x14'));var as=require(_0x87ee('0x15'));var hardwareService=require(_0x87ee('0x16'));var logger=require('../../config/logger')('api');var utils=require(_0x87ee('0x17'));var config=require(_0x87ee('0x18'));var licenseUtil=require(_0x87ee('0x19'));var db=require(_0x87ee('0x1a'))['db'];function respondWithStatusCode(_0x5807df,_0x32c563){_0x32c563=_0x32c563||0xcc;return function(_0x4eb9e0){if(_0x4eb9e0){return _0x5807df[_0x87ee('0x1b')](_0x32c563);}return _0x5807df[_0x87ee('0x1c')](_0x32c563)[_0x87ee('0x1d')]();};}function respondWithResult(_0x33a0fa,_0x422923){_0x422923=_0x422923||0xc8;return function(_0x5431bd){if(_0x5431bd){return _0x33a0fa[_0x87ee('0x1c')](_0x422923)['json'](_0x5431bd);}};}function respondWithFilteredResult(_0x40dcef,_0x1fbf9b){return function(_0x3c1bd4){if(_0x3c1bd4){var _0xc9e9f5=typeof _0x1fbf9b[_0x87ee('0x1e')]===_0x87ee('0x1f')&&typeof _0x1fbf9b[_0x87ee('0x20')]===_0x87ee('0x1f');var _0x5551d8=_0x3c1bd4[_0x87ee('0x21')];var _0x33435a=_0xc9e9f5?0x0:_0x1fbf9b[_0x87ee('0x1e')];var _0x474b8f=_0xc9e9f5?_0x3c1bd4[_0x87ee('0x21')]:_0x1fbf9b['offset']+_0x1fbf9b[_0x87ee('0x20')];var _0x535520;if(_0x474b8f>=_0x5551d8){_0x474b8f=_0x5551d8;_0x535520=0xc8;}else{_0x535520=0xce;}_0x40dcef[_0x87ee('0x1c')](_0x535520);return _0x40dcef[_0x87ee('0x22')](_0x87ee('0x23'),_0x33435a+'-'+_0x474b8f+'/'+_0x5551d8)[_0x87ee('0x24')](_0x3c1bd4);}return null;};}function patchUpdates(_0x4f966e){return function(_0x4757a5){try{jsonpatch[_0x87ee('0x25')](_0x4757a5,_0x4f966e,!![]);}catch(_0x3fe0f1){return BPromise[_0x87ee('0x26')](_0x3fe0f1);}return _0x4757a5[_0x87ee('0x27')]();};}function saveUpdates(_0x22ea24,_0x4231de){return function(_0x53cd42){if(_0x53cd42){return _0x53cd42[_0x87ee('0x28')](_0x22ea24)[_0x87ee('0x29')](function(_0x36d3c6){return _0x36d3c6;});}return null;};}function removeEntity(_0x484a73,_0x4b6f31){return function(_0x5ac28b){if(_0x5ac28b){return _0x5ac28b['destroy']()[_0x87ee('0x29')](function(){_0x484a73[_0x87ee('0x1c')](0xcc)[_0x87ee('0x1d')]();});}};}function handleEntityNotFound(_0x4eb011,_0x1d03f8){return function(_0x2e69ca){if(!_0x2e69ca){_0x4eb011[_0x87ee('0x1b')](0x194);}return _0x2e69ca;};}function handleError(_0x160566,_0x2d08f6){_0x2d08f6=_0x2d08f6||0x1f4;return function(_0x1c1a9c){logger[_0x87ee('0x2a')](_0x1c1a9c[_0x87ee('0x2b')]);if(_0x1c1a9c[_0x87ee('0x2c')]){delete _0x1c1a9c['name'];}_0x160566[_0x87ee('0x1c')](_0x2d08f6)[_0x87ee('0x2d')](_0x1c1a9c);};}exports[_0x87ee('0x2e')]=function(_0x2a17ff,_0x4e5b0f){var _0x5bbc10={},_0x2c24a2={},_0x474b9e={'count':0x0,'rows':[]};var _0x2d08a8=_[_0x87ee('0x2f')](db[_0x87ee('0x30')][_0x87ee('0x31')],function(_0x50c67d){return{'name':_0x50c67d['fieldName'],'type':_0x50c67d[_0x87ee('0x32')]['key']};});_0x2c24a2[_0x87ee('0x33')]=_['map'](_0x2d08a8,'name');_0x2c24a2[_0x87ee('0x34')]=_[_0x87ee('0x35')](_0x2a17ff[_0x87ee('0x34')]);_0x2c24a2[_0x87ee('0x36')]=_[_0x87ee('0x37')](_0x2c24a2['model'],_0x2c24a2[_0x87ee('0x34')]);_0x5bbc10['attributes']=_['intersection'](_0x2c24a2['model'],qs['fields'](_0x2a17ff[_0x87ee('0x34')]['fields']));_0x5bbc10[_0x87ee('0x38')]=_0x5bbc10[_0x87ee('0x38')]['length']?_0x5bbc10[_0x87ee('0x38')]:_0x2c24a2[_0x87ee('0x33')];if(!_0x2a17ff[_0x87ee('0x34')]['hasOwnProperty'](_0x87ee('0x39'))){_0x5bbc10['limit']=qs['limit'](_0x2a17ff[_0x87ee('0x34')][_0x87ee('0x20')]);_0x5bbc10[_0x87ee('0x1e')]=qs[_0x87ee('0x1e')](_0x2a17ff[_0x87ee('0x34')]['offset']);}_0x5bbc10['order']=qs[_0x87ee('0x3a')](_0x2a17ff['query']['sort']);_0x5bbc10['where']=qs[_0x87ee('0x36')](_[_0x87ee('0x3b')](_0x2a17ff['query'],_0x2c24a2[_0x87ee('0x36')]),_0x2d08a8);if(_0x2a17ff[_0x87ee('0x34')][_0x87ee('0x3c')]){_0x5bbc10[_0x87ee('0x3d')]=_['merge'](_0x5bbc10[_0x87ee('0x3d')],{'$or':_[_0x87ee('0x2f')](_0x2d08a8,function(_0x511c7f){if(_0x511c7f['type']!==_0x87ee('0x3e')){var _0x805069={};_0x805069[_0x511c7f[_0x87ee('0x2c')]]={'$like':'%'+_0x2a17ff[_0x87ee('0x34')][_0x87ee('0x3c')]+'%'};return _0x805069;}})});}_0x5bbc10=_[_0x87ee('0x3f')]({},_0x5bbc10,_0x2a17ff[_0x87ee('0x40')]);var _0x4f95cd={'where':_0x5bbc10[_0x87ee('0x3d')]};return db[_0x87ee('0x30')][_0x87ee('0x21')](_0x4f95cd)[_0x87ee('0x29')](function(_0x3fd380){_0x474b9e['count']=_0x3fd380;if(_0x2a17ff[_0x87ee('0x34')][_0x87ee('0x41')]){_0x5bbc10[_0x87ee('0x42')]=[{'all':!![]}];}return db[_0x87ee('0x30')][_0x87ee('0x43')](_0x5bbc10);})['then'](function(_0x5ec477){_0x474b9e[_0x87ee('0x44')]=_0x5ec477;return _0x474b9e;})['then'](respondWithFilteredResult(_0x4e5b0f,_0x5bbc10))[_0x87ee('0x45')](handleError(_0x4e5b0f,null));};exports[_0x87ee('0x46')]=function(_0x3fdeb8,_0x58e323){var _0x59e4a7={'raw':![],'where':{'id':_0x3fdeb8[_0x87ee('0x47')]['id']}},_0x2e249a={};_0x2e249a[_0x87ee('0x33')]=_[_0x87ee('0x35')](db['UserProfileSection'][_0x87ee('0x31')]);_0x2e249a[_0x87ee('0x34')]=_[_0x87ee('0x35')](_0x3fdeb8[_0x87ee('0x34')]);_0x2e249a[_0x87ee('0x36')]=_['intersection'](_0x2e249a['model'],_0x2e249a[_0x87ee('0x34')]);_0x59e4a7['attributes']=_[_0x87ee('0x37')](_0x2e249a[_0x87ee('0x33')],qs[_0x87ee('0x48')](_0x3fdeb8['query'][_0x87ee('0x48')]));_0x59e4a7[_0x87ee('0x38')]=_0x59e4a7['attributes']['length']?_0x59e4a7['attributes']:_0x2e249a['model'];if(_0x3fdeb8[_0x87ee('0x34')][_0x87ee('0x41')]){_0x59e4a7[_0x87ee('0x42')]=[{'all':!![]}];}_0x59e4a7=_[_0x87ee('0x3f')]({},_0x59e4a7,_0x3fdeb8['options']);return db[_0x87ee('0x30')][_0x87ee('0x49')](_0x59e4a7)[_0x87ee('0x29')](handleEntityNotFound(_0x58e323,null))[_0x87ee('0x29')](respondWithResult(_0x58e323,null))[_0x87ee('0x45')](handleError(_0x58e323,null));};exports[_0x87ee('0x4a')]=function(_0x5a671b,_0x153516){return db['UserProfileSection'][_0x87ee('0x4a')](_0x5a671b['body'],{})[_0x87ee('0x29')](respondWithResult(_0x153516,0xc9))['catch'](handleError(_0x153516,null));};exports[_0x87ee('0x28')]=function(_0x2c8506,_0x30cfcd){if(_0x2c8506[_0x87ee('0x4b')]['id']){delete _0x2c8506[_0x87ee('0x4b')]['id'];}return db['UserProfileSection'][_0x87ee('0x49')]({'where':{'id':_0x2c8506[_0x87ee('0x47')]['id']}})[_0x87ee('0x29')](handleEntityNotFound(_0x30cfcd,null))[_0x87ee('0x29')](saveUpdates(_0x2c8506[_0x87ee('0x4b')],null))[_0x87ee('0x29')](respondWithResult(_0x30cfcd,null))[_0x87ee('0x45')](handleError(_0x30cfcd,null));};exports[_0x87ee('0x4c')]=function(_0x4f9363,_0x315419){return db[_0x87ee('0x30')][_0x87ee('0x49')]({'where':{'id':_0x4f9363[_0x87ee('0x47')]['id']}})[_0x87ee('0x29')](handleEntityNotFound(_0x315419,null))[_0x87ee('0x29')](removeEntity(_0x315419,null))[_0x87ee('0x45')](handleError(_0x315419,null));};exports['describe']=function(_0x45c1ca,_0x2047f1){return db[_0x87ee('0x30')]['describe']()['then'](respondWithResult(_0x2047f1,null))[_0x87ee('0x45')](handleError(_0x2047f1,null));}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.model.js b/server/api/userProfileSection/userProfileSection.model.js index 2d57649..1601836 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 _0x071b=['user_profile_has_sections','compositeIndex','userProfileId','lodash','util','../../config/logger','api','moment','path','../../config/environment','exports','UserProfileSection'];(function(_0x28a6f5,_0x42e31d){var _0x39caa0=function(_0x2af9ef){while(--_0x2af9ef){_0x28a6f5['push'](_0x28a6f5['shift']());}};_0x39caa0(++_0x42e31d);}(_0x071b,0x12f));var _0xb071=function(_0x2fe70f,_0x3a8615){_0x2fe70f=_0x2fe70f-0x0;var _0x235c99=_0x071b[_0x2fe70f];return _0x235c99;};'use strict';var _=require(_0xb071('0x0'));var util=require(_0xb071('0x1'));var logger=require(_0xb071('0x2'))(_0xb071('0x3'));var moment=require(_0xb071('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xb071('0x5'));var rimraf=require('rimraf');var config=require(_0xb071('0x6'));var attributes=require('./userProfileSection.attributes');module[_0xb071('0x7')]=function(_0xc8ae2e,_0x2bcc6a){return _0xc8ae2e['define'](_0xb071('0x8'),attributes,{'tableName':_0xb071('0x9'),'paranoid':![],'indexes':[{'name':_0xb071('0xa'),'fields':['sectionId',_0xb071('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xcec6=['define','UserProfileSection','user_profile_has_sections','sectionId','userProfileId','lodash','api','moment','bluebird','path','rimraf','../../config/environment','./userProfileSection.attributes'];(function(_0x514663,_0x2035b4){var _0x5eee78=function(_0x580582){while(--_0x580582){_0x514663['push'](_0x514663['shift']());}};_0x5eee78(++_0x2035b4);}(_0xcec6,0x87));var _0x6cec=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xcec6[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x6cec('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x6cec('0x1'));var moment=require(_0x6cec('0x2'));var BPromise=require(_0x6cec('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6cec('0x4'));var rimraf=require(_0x6cec('0x5'));var config=require(_0x6cec('0x6'));var attributes=require(_0x6cec('0x7'));module['exports']=function(_0x58a20d,_0x3aba01){return _0x58a20d[_0x6cec('0x8')](_0x6cec('0x9'),attributes,{'tableName':_0x6cec('0xa'),'paranoid':![],'indexes':[{'name':'compositeIndex','fields':[_0x6cec('0xb'),_0x6cec('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.rpc.js b/server/api/userProfileSection/userProfileSection.rpc.js index aee6799..e1480a3 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 _0x5af4=['catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','UserProfileSection,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result'];(function(_0x9cd4c3,_0x1c9b2c){var _0x4c9025=function(_0x25b3c6){while(--_0x25b3c6){_0x9cd4c3['push'](_0x9cd4c3['shift']());}};_0x4c9025(++_0x1c9b2c);}(_0x5af4,0xd9));var _0x45af=function(_0x395045,_0x5aa92b){_0x395045=_0x395045-0x0;var _0x286b26=_0x5af4[_0x395045];return _0x286b26;};'use strict';var _=require(_0x45af('0x0'));var util=require(_0x45af('0x1'));var moment=require(_0x45af('0x2'));var BPromise=require(_0x45af('0x3'));var rs=require(_0x45af('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x45af('0x5'))['db'];var utils=require(_0x45af('0x6'));var logger=require(_0x45af('0x7'))(_0x45af('0x8'));var config=require('../../config/environment');var jayson=require(_0x45af('0x9'));var client=jayson[_0x45af('0xa')][_0x45af('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x53e292,_0x33ef1a,_0x2c8048){return new BPromise(function(_0x36ecb0,_0x503252){return client[_0x45af('0xc')](_0x53e292,_0x2c8048)[_0x45af('0xd')](function(_0x5d7116){logger[_0x45af('0xe')](_0x45af('0xf'),_0x33ef1a,'request\x20sent');logger[_0x45af('0x10')]('UserProfileSection,\x20%s,\x20%s,\x20%s',_0x33ef1a,_0x45af('0x11'),JSON[_0x45af('0x12')](_0x5d7116));if(_0x5d7116[_0x45af('0x13')]){if(_0x5d7116[_0x45af('0x13')][_0x45af('0x14')]===0x1f4){logger[_0x45af('0x13')]('UserProfileSection,\x20%s,\x20%s',_0x33ef1a,_0x5d7116[_0x45af('0x13')][_0x45af('0x15')]);return _0x503252(_0x5d7116['error']['message']);}logger['error'](_0x45af('0xf'),_0x33ef1a,_0x5d7116[_0x45af('0x13')][_0x45af('0x15')]);return _0x36ecb0(_0x5d7116[_0x45af('0x13')][_0x45af('0x15')]);}else{logger[_0x45af('0xe')]('UserProfileSection,\x20%s,\x20%s',_0x33ef1a,_0x45af('0x11'));_0x36ecb0(_0x5d7116[_0x45af('0x16')]['message']);}})[_0x45af('0x17')](function(_0x33b0d4){logger[_0x45af('0x13')](_0x45af('0xf'),_0x33ef1a,_0x33b0d4);_0x503252(_0x33b0d4);});});} \ No newline at end of file +var _0x029f=['lodash','util','moment','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','request','then','UserProfileSection,\x20%s,\x20%s','request\x20sent','debug','UserProfileSection,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch'];(function(_0x49b207,_0x408ade){var _0x2dc8fa=function(_0x150975){while(--_0x150975){_0x49b207['push'](_0x49b207['shift']());}};_0x2dc8fa(++_0x408ade);}(_0x029f,0x7e));var _0xf029=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x029f[_0x1facfa];return _0x9ec701;};'use strict';var _=require(_0xf029('0x0'));var util=require(_0xf029('0x1'));var moment=require(_0xf029('0x2'));var BPromise=require('bluebird');var rs=require(_0xf029('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf029('0x4'))['db'];var utils=require(_0xf029('0x5'));var logger=require('../../config/logger')(_0xf029('0x6'));var config=require(_0xf029('0x7'));var jayson=require(_0xf029('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x5a3a1a,_0x39e9d4,_0x5c02ff){return new BPromise(function(_0x4b5c3d,_0x229a76){return client[_0xf029('0x9')](_0x5a3a1a,_0x5c02ff)[_0xf029('0xa')](function(_0xbbdc31){logger['info'](_0xf029('0xb'),_0x39e9d4,_0xf029('0xc'));logger[_0xf029('0xd')](_0xf029('0xe'),_0x39e9d4,'request\x20sent',JSON[_0xf029('0xf')](_0xbbdc31));if(_0xbbdc31[_0xf029('0x10')]){if(_0xbbdc31[_0xf029('0x10')][_0xf029('0x11')]===0x1f4){logger[_0xf029('0x10')](_0xf029('0xb'),_0x39e9d4,_0xbbdc31[_0xf029('0x10')][_0xf029('0x12')]);return _0x229a76(_0xbbdc31[_0xf029('0x10')][_0xf029('0x12')]);}logger[_0xf029('0x10')](_0xf029('0xb'),_0x39e9d4,_0xbbdc31['error'][_0xf029('0x12')]);return _0x4b5c3d(_0xbbdc31['error'][_0xf029('0x12')]);}else{logger[_0xf029('0x13')](_0xf029('0xb'),_0x39e9d4,_0xf029('0xc'));_0x4b5c3d(_0xbbdc31['result'][_0xf029('0x12')]);}})[_0xf029('0x14')](function(_0x35f112){logger[_0xf029('0x10')](_0xf029('0xb'),_0x39e9d4,_0x35f112);_0x229a76(_0x35f112);});});} \ No newline at end of file diff --git a/server/api/userSmsQueue/index.js b/server/api/userSmsQueue/index.js index 358fd44..7dd009f 100644 --- a/server/api/userSmsQueue/index.js +++ b/server/api/userSmsQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x2c1739,_0x2ca46d){var _0x182494=function(_0x4b31ba){while(--_0x4b31ba){_0x2c1739['push'](_0x2c1739['shift']());}};_0x182494(++_0x2ca46d);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x19d350,_0x3c843f){_0x19d350=_0x19d350-0x0;var _0x3bfc8d=_0xcb91[_0x19d350];return _0x3bfc8d;};'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 _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x15e241,_0x3f788f){var _0x4bc336=function(_0x57338a){while(--_0x57338a){_0x15e241['push'](_0x15e241['shift']());}};_0x4bc336(++_0x3f788f);}(_0xe706,0xa3));var _0x6e70=function(_0x4c10fe,_0x19e0b2){_0x4c10fe=_0x4c10fe-0x0;var _0x5d4ffe=_0xe706[_0x4c10fe];return _0x5d4ffe;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));module[_0x6e70('0x9')]=router; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.attributes.js b/server/api/userSmsQueue/userSmsQueue.attributes.js index 203f8e6..d0a0ac5 100644 --- a/server/api/userSmsQueue/userSmsQueue.attributes.js +++ b/server/api/userSmsQueue/userSmsQueue.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x34aa=['INTEGER','sequelize'];(function(_0x321a3e,_0x4e3e6d){var _0xb55d3a=function(_0x385877){while(--_0x385877){_0x321a3e['push'](_0x321a3e['shift']());}};_0xb55d3a(++_0x4e3e6d);}(_0x34aa,0x171));var _0xa34a=function(_0x502598,_0x1e95c8){_0x502598=_0x502598-0x0;var _0xbdee21=_0x34aa[_0x502598];return _0xbdee21;};'use strict';var Sequelize=require(_0xa34a('0x0'));module['exports']={'penalty':{'type':Sequelize[_0xa34a('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0x0463=['sequelize','exports','INTEGER'];(function(_0x2b708f,_0x23e8e2){var _0x4848a3=function(_0x4bc4c8){while(--_0x4bc4c8){_0x2b708f['push'](_0x2b708f['shift']());}};_0x4848a3(++_0x23e8e2);}(_0x0463,0x144));var _0x3046=function(_0x278465,_0x1e593c){_0x278465=_0x278465-0x0;var _0x1a0ff5=_0x0463[_0x278465];return _0x1a0ff5;};'use strict';var Sequelize=require(_0x3046('0x0'));module[_0x3046('0x1')]={'penalty':{'type':Sequelize[_0x3046('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.model.js b/server/api/userSmsQueue/userSmsQueue.model.js index b0535d9..00e85da 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 _0xf494=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userSmsQueue.attributes','exports','define','lodash','util'];(function(_0x3fa418,_0x42ccbd){var _0x27fb4b=function(_0x3a0a4b){while(--_0x3a0a4b){_0x3fa418['push'](_0x3fa418['shift']());}};_0x27fb4b(++_0x42ccbd);}(_0xf494,0x1c6));var _0x4f49=function(_0x595a53,_0x219f0c){_0x595a53=_0x595a53-0x0;var _0x25e023=_0xf494[_0x595a53];return _0x25e023;};'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')]('UserSmsQueue',attributes,{'tableName':'user_has_sms_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcaaf=['define','UserSmsQueue','user_has_sms_queues','lodash','../../config/logger','bluebird','request-promise','rimraf','exports'];(function(_0x5f4618,_0x202705){var _0x4c8c0e=function(_0x22dd3d){while(--_0x22dd3d){_0x5f4618['push'](_0x5f4618['shift']());}};_0x4c8c0e(++_0x202705);}(_0xcaaf,0x66));var _0xfcaa=function(_0x109d6c,_0x2433f5){_0x109d6c=_0x109d6c-0x0;var _0x467aad=_0xcaaf[_0x109d6c];return _0x467aad;};'use strict';var _=require(_0xfcaa('0x0'));var util=require('util');var logger=require(_0xfcaa('0x1'))('api');var moment=require('moment');var BPromise=require(_0xfcaa('0x2'));var rp=require(_0xfcaa('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xfcaa('0x4'));var config=require('../../config/environment');var attributes=require('./userSmsQueue.attributes');module[_0xfcaa('0x5')]=function(_0x83f91d,_0x146224){return _0x83f91d[_0xfcaa('0x6')](_0xfcaa('0x7'),attributes,{'tableName':_0xfcaa('0x8'),'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 43ff017..708ded3 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 _0x76b1=['../../config/logger','rpc','jayson/promise','client','http','then','info','UserSmsQueue,\x20%s,\x20%s','request\x20sent','debug','error','message','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x51c819,_0xd812db){var _0x15c5d2=function(_0x2977f0){while(--_0x2977f0){_0x51c819['push'](_0x51c819['shift']());}};_0x15c5d2(++_0xd812db);}(_0x76b1,0xad));var _0x176b=function(_0x6072d5,_0x22b254){_0x6072d5=_0x6072d5-0x0;var _0x514994=_0x76b1[_0x6072d5];return _0x514994;};'use strict';var _=require(_0x176b('0x0'));var util=require('util');var moment=require(_0x176b('0x1'));var BPromise=require(_0x176b('0x2'));var rs=require(_0x176b('0x3'));var fs=require('fs');var Redis=require(_0x176b('0x4'));var db=require(_0x176b('0x5'))['db'];var utils=require(_0x176b('0x6'));var logger=require(_0x176b('0x7'))(_0x176b('0x8'));var config=require('../../config/environment');var jayson=require(_0x176b('0x9'));var client=jayson[_0x176b('0xa')][_0x176b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5121f4,_0x2ffc06,_0x27d423){return new BPromise(function(_0x16d15f,_0x27b1b2){return client['request'](_0x5121f4,_0x27d423)[_0x176b('0xc')](function(_0x29a945){logger[_0x176b('0xd')](_0x176b('0xe'),_0x2ffc06,_0x176b('0xf'));logger[_0x176b('0x10')]('UserSmsQueue,\x20%s,\x20%s,\x20%s',_0x2ffc06,_0x176b('0xf'),JSON['stringify'](_0x29a945));if(_0x29a945['error']){if(_0x29a945[_0x176b('0x11')]['code']===0x1f4){logger[_0x176b('0x11')](_0x176b('0xe'),_0x2ffc06,_0x29a945[_0x176b('0x11')][_0x176b('0x12')]);return _0x27b1b2(_0x29a945[_0x176b('0x11')]['message']);}logger['error'](_0x176b('0xe'),_0x2ffc06,_0x29a945[_0x176b('0x11')]['message']);return _0x16d15f(_0x29a945['error'][_0x176b('0x12')]);}else{logger['info'](_0x176b('0xe'),_0x2ffc06,_0x176b('0xf'));_0x16d15f(_0x29a945['result'][_0x176b('0x12')]);}})[_0x176b('0x13')](function(_0x53dcc3){logger[_0x176b('0x11')](_0x176b('0xe'),_0x2ffc06,_0x53dcc3);_0x27b1b2(_0x53dcc3);});});} \ No newline at end of file +var _0xcb2e=['info','result','catch','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','request\x20sent','debug','stringify','error','code','UserSmsQueue,\x20%s,\x20%s','message'];(function(_0x1f8114,_0x554a20){var _0x1d62fd=function(_0x4ccac2){while(--_0x4ccac2){_0x1f8114['push'](_0x1f8114['shift']());}};_0x1d62fd(++_0x554a20);}(_0xcb2e,0x18f));var _0xecb2=function(_0x479d60,_0x53a732){_0x479d60=_0x479d60-0x0;var _0x4edd48=_0xcb2e[_0x479d60];return _0x4edd48;};'use strict';var _=require('lodash');var util=require(_0xecb2('0x0'));var moment=require(_0xecb2('0x1'));var BPromise=require(_0xecb2('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xecb2('0x3'));var db=require(_0xecb2('0x4'))['db'];var utils=require(_0xecb2('0x5'));var logger=require(_0xecb2('0x6'))('rpc');var config=require(_0xecb2('0x7'));var jayson=require(_0xecb2('0x8'));var client=jayson[_0xecb2('0x9')][_0xecb2('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xbf6dc5,_0x36cd91,_0x3e2509){return new BPromise(function(_0x50963a,_0x2baf55){return client[_0xecb2('0xb')](_0xbf6dc5,_0x3e2509)['then'](function(_0x4bd7a8){logger['info']('UserSmsQueue,\x20%s,\x20%s',_0x36cd91,_0xecb2('0xc'));logger[_0xecb2('0xd')]('UserSmsQueue,\x20%s,\x20%s,\x20%s',_0x36cd91,_0xecb2('0xc'),JSON[_0xecb2('0xe')](_0x4bd7a8));if(_0x4bd7a8[_0xecb2('0xf')]){if(_0x4bd7a8[_0xecb2('0xf')][_0xecb2('0x10')]===0x1f4){logger[_0xecb2('0xf')](_0xecb2('0x11'),_0x36cd91,_0x4bd7a8[_0xecb2('0xf')]['message']);return _0x2baf55(_0x4bd7a8[_0xecb2('0xf')][_0xecb2('0x12')]);}logger[_0xecb2('0xf')](_0xecb2('0x11'),_0x36cd91,_0x4bd7a8[_0xecb2('0xf')][_0xecb2('0x12')]);return _0x50963a(_0x4bd7a8[_0xecb2('0xf')]['message']);}else{logger[_0xecb2('0x13')]('UserSmsQueue,\x20%s,\x20%s',_0x36cd91,_0xecb2('0xc'));_0x50963a(_0x4bd7a8[_0xecb2('0x14')][_0xecb2('0x12')]);}})[_0xecb2('0x15')](function(_0x43a815){logger['error'](_0xecb2('0x11'),_0x36cd91,_0x43a815);_0x2baf55(_0x43a815);});});} \ No newline at end of file diff --git a/server/api/userVoicePrefix/userVoicePrefix.attributes.js b/server/api/userVoicePrefix/userVoicePrefix.attributes.js index 9a2ad09..14bae4f 100644 --- a/server/api/userVoicePrefix/userVoicePrefix.attributes.js +++ b/server/api/userVoicePrefix/userVoicePrefix.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x153e=['sequelize','exports','INTEGER'];(function(_0x2303e3,_0x23ca6c){var _0x19bfb1=function(_0x40eb0e){while(--_0x40eb0e){_0x2303e3['push'](_0x2303e3['shift']());}};_0x19bfb1(++_0x23ca6c);}(_0x153e,0x132));var _0xe153=function(_0x4d180c,_0x45c68e){_0x4d180c=_0x4d180c-0x0;var _0x49b57e=_0x153e[_0x4d180c];return _0x49b57e;};'use strict';var Sequelize=require(_0xe153('0x0'));module[_0xe153('0x1')]={'UserId':{'type':Sequelize[_0xe153('0x2')]},'VoicePrefixId':{'type':Sequelize[_0xe153('0x2')]}}; \ No newline at end of file +var _0xa951=['INTEGER','sequelize'];(function(_0x3396cd,_0x4047f0){var _0x2d6b4a=function(_0x389663){while(--_0x389663){_0x3396cd['push'](_0x3396cd['shift']());}};_0x2d6b4a(++_0x4047f0);}(_0xa951,0x103));var _0x1a95=function(_0x393e8d,_0x3b9b61){_0x393e8d=_0x393e8d-0x0;var _0xece09=_0xa951[_0x393e8d];return _0xece09;};'use strict';var Sequelize=require(_0x1a95('0x0'));module['exports']={'UserId':{'type':Sequelize[_0x1a95('0x1')]},'VoicePrefixId':{'type':Sequelize[_0x1a95('0x1')]}}; \ No newline at end of file diff --git a/server/api/userVoicePrefix/userVoicePrefix.model.js b/server/api/userVoicePrefix/userVoicePrefix.model.js index 309fd8b..971f02f 100644 --- a/server/api/userVoicePrefix/userVoicePrefix.model.js +++ b/server/api/userVoicePrefix/userVoicePrefix.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['../../config/environment','./userVoicePrefix.attributes','exports','define','UserVoicePrefix','lodash','util','../../config/logger','bluebird','path','rimraf'];(function(_0xbba620,_0x32c649){var _0x362a92=function(_0x6dd262){while(--_0x6dd262){_0xbba620['push'](_0xbba620['shift']());}};_0x362a92(++_0x32c649);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3c2a69,_0x4c8b41){_0x3c2a69=_0x3c2a69-0x0;var _0x596bc8=_0xa9e0[_0x3c2a69];return _0x596bc8;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'user_has_voice_prefixes','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa9e0=['../../config/environment','./userVoicePrefix.attributes','exports','define','UserVoicePrefix','lodash','util','../../config/logger','bluebird','path','rimraf'];(function(_0xc65332,_0x11744f){var _0x4e2519=function(_0x2e997c){while(--_0x2e997c){_0xc65332['push'](_0xc65332['shift']());}};_0x4e2519(++_0x11744f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x46aff0,_0x122890){_0x46aff0=_0x46aff0-0x0;var _0x9d78cf=_0xa9e0[_0x46aff0];return _0x9d78cf;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'user_has_voice_prefixes','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userVoiceQueue/index.js b/server/api/userVoiceQueue/index.js index 3657465..8456c7c 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 _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x4b9014,_0x3b0b76){var _0x53fdce=function(_0xe31f52){while(--_0xe31f52){_0x4b9014['push'](_0x4b9014['shift']());}};_0x53fdce(++_0x3b0b76);}(_0xa9e0,0x123));var _0x0a9e=function(_0x31e29a,_0x349c9b){_0x31e29a=_0x31e29a-0x0;var _0x32d892=_0xa9e0[_0x31e29a];return _0x32d892;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('0x7')]=router; \ No newline at end of file +var _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x309dea,_0x102688){var _0x42a668=function(_0x583e0e){while(--_0x583e0e){_0x309dea['push'](_0x309dea['shift']());}};_0x42a668(++_0x102688);}(_0x70e0,0x17b));var _0x070e=function(_0x1e6c52,_0xc59bb1){_0x1e6c52=_0x1e6c52-0x0;var _0x27b2a9=_0x70e0[_0x1e6c52];return _0x27b2a9;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');module[_0x070e('0x7')]=router; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.attributes.js b/server/api/userVoiceQueue/userVoiceQueue.attributes.js index fd3ba4f..de67ba6 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 _0x98d8=['INTEGER','sequelize'];(function(_0x2153c5,_0x2ed214){var _0x29b060=function(_0x19932d){while(--_0x19932d){_0x2153c5['push'](_0x2153c5['shift']());}};_0x29b060(++_0x2ed214);}(_0x98d8,0xcd));var _0x898d=function(_0x20229e,_0xa59f8a){_0x20229e=_0x20229e-0x0;var _0x317377=_0x98d8[_0x20229e];return _0x317377;};'use strict';var Sequelize=require(_0x898d('0x0'));module['exports']={'penalty':{'type':Sequelize[_0x898d('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0x6be8=['sequelize','INTEGER'];(function(_0x5d9942,_0x5cb366){var _0x3f35ce=function(_0x57e52c){while(--_0x57e52c){_0x5d9942['push'](_0x5d9942['shift']());}};_0x3f35ce(++_0x5cb366);}(_0x6be8,0x76));var _0x86be=function(_0x6f9e6c,_0x5ef730){_0x6f9e6c=_0x6f9e6c-0x0;var _0x20a1a0=_0x6be8[_0x6f9e6c];return _0x20a1a0;};'use strict';var Sequelize=require(_0x86be('0x0'));module['exports']={'penalty':{'type':Sequelize[_0x86be('0x1')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.model.js b/server/api/userVoiceQueue/userVoiceQueue.model.js index 84c2275..872961e 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 _0xf10e=['user_has_voice_queues','lodash','util','../../config/logger','api','request-promise','rimraf','../../config/environment','./userVoiceQueue.attributes','define','UserVoiceQueue'];(function(_0x20c72d,_0x52fe1c){var _0xec7469=function(_0x236667){while(--_0x236667){_0x20c72d['push'](_0x20c72d['shift']());}};_0xec7469(++_0x52fe1c);}(_0xf10e,0x135));var _0xef10=function(_0x38537f,_0x252124){_0x38537f=_0x38537f-0x0;var _0x141e23=_0xf10e[_0x38537f];return _0x141e23;};'use strict';var _=require(_0xef10('0x0'));var util=require(_0xef10('0x1'));var logger=require(_0xef10('0x2'))(_0xef10('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xef10('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xef10('0x5'));var config=require(_0xef10('0x6'));var attributes=require(_0xef10('0x7'));module['exports']=function(_0x161596,_0x45186b){return _0x161596[_0xef10('0x8')](_0xef10('0x9'),attributes,{'tableName':_0xef10('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x92ab=['./userVoiceQueue.attributes','UserVoiceQueue','user_has_voice_queues','lodash','api','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0x92ab,0x193));var _0xb92a=function(_0x5e0ec0,_0x2aabeb){_0x5e0ec0=_0x5e0ec0-0x0;var _0x301430=_0x92ab[_0x5e0ec0];return _0x301430;};'use strict';var _=require(_0xb92a('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xb92a('0x1'));var moment=require(_0xb92a('0x2'));var BPromise=require('bluebird');var rp=require(_0xb92a('0x3'));var fs=require('fs');var path=require(_0xb92a('0x4'));var rimraf=require(_0xb92a('0x5'));var config=require(_0xb92a('0x6'));var attributes=require(_0xb92a('0x7'));module['exports']=function(_0x15a645,_0x11acba){return _0x15a645['define'](_0xb92a('0x8'),attributes,{'tableName':_0xb92a('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.rpc.js b/server/api/userVoiceQueue/userVoiceQueue.rpc.js index b203893..6f3b441 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 _0x16c8=['util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','info','request\x20sent','debug','UserVoiceQueue,\x20%s,\x20%s,\x20%s','error','code','UserVoiceQueue,\x20%s,\x20%s','message','catch','lodash'];(function(_0x5d6456,_0x58ecc7){var _0x4d66c1=function(_0x4335e3){while(--_0x4335e3){_0x5d6456['push'](_0x5d6456['shift']());}};_0x4d66c1(++_0x58ecc7);}(_0x16c8,0xdb));var _0x816c=function(_0x2e2ae4,_0xa2167f){_0x2e2ae4=_0x2e2ae4-0x0;var _0x1867af=_0x16c8[_0x2e2ae4];return _0x1867af;};'use strict';var _=require(_0x816c('0x0'));var util=require(_0x816c('0x1'));var moment=require(_0x816c('0x2'));var BPromise=require(_0x816c('0x3'));var rs=require(_0x816c('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x816c('0x5'))['db'];var utils=require(_0x816c('0x6'));var logger=require(_0x816c('0x7'))(_0x816c('0x8'));var config=require(_0x816c('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x816c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5e4332,_0x3887c5,_0x1d6374){return new BPromise(function(_0x32984f,_0x4bbfc2){return client[_0x816c('0xb')](_0x5e4332,_0x1d6374)[_0x816c('0xc')](function(_0x4e074a){logger[_0x816c('0xd')]('UserVoiceQueue,\x20%s,\x20%s',_0x3887c5,_0x816c('0xe'));logger[_0x816c('0xf')](_0x816c('0x10'),_0x3887c5,_0x816c('0xe'),JSON['stringify'](_0x4e074a));if(_0x4e074a[_0x816c('0x11')]){if(_0x4e074a['error'][_0x816c('0x12')]===0x1f4){logger[_0x816c('0x11')](_0x816c('0x13'),_0x3887c5,_0x4e074a['error'][_0x816c('0x14')]);return _0x4bbfc2(_0x4e074a[_0x816c('0x11')]['message']);}logger[_0x816c('0x11')](_0x816c('0x13'),_0x3887c5,_0x4e074a[_0x816c('0x11')][_0x816c('0x14')]);return _0x32984f(_0x4e074a[_0x816c('0x11')][_0x816c('0x14')]);}else{logger[_0x816c('0xd')](_0x816c('0x13'),_0x3887c5,_0x816c('0xe'));_0x32984f(_0x4e074a['result'][_0x816c('0x14')]);}})[_0x816c('0x15')](function(_0x81a500){logger[_0x816c('0x11')]('UserVoiceQueue,\x20%s,\x20%s',_0x3887c5,_0x81a500);_0x4bbfc2(_0x81a500);});});} \ No newline at end of file +var _0x65e2=['bluebird','randomstring','ioredis','../../config/logger','rpc','jayson/promise','client','http','request','then','info','UserVoiceQueue,\x20%s,\x20%s','debug','UserVoiceQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','catch','lodash','moment'];(function(_0x328bd3,_0x9cf5a5){var _0x458149=function(_0x3f60d9){while(--_0x3f60d9){_0x328bd3['push'](_0x328bd3['shift']());}};_0x458149(++_0x9cf5a5);}(_0x65e2,0x14e));var _0x265e=function(_0x3f0654,_0x567937){_0x3f0654=_0x3f0654-0x0;var _0x3f8a13=_0x65e2[_0x3f0654];return _0x3f8a13;};'use strict';var _=require(_0x265e('0x0'));var util=require('util');var moment=require(_0x265e('0x1'));var BPromise=require(_0x265e('0x2'));var rs=require(_0x265e('0x3'));var fs=require('fs');var Redis=require(_0x265e('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x265e('0x5'))(_0x265e('0x6'));var config=require('../../config/environment');var jayson=require(_0x265e('0x7'));var client=jayson[_0x265e('0x8')][_0x265e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x99b079,_0x2d1e1e,_0x35a7c9){return new BPromise(function(_0x1ba327,_0x1fc720){return client[_0x265e('0xa')](_0x99b079,_0x35a7c9)[_0x265e('0xb')](function(_0x274473){logger[_0x265e('0xc')](_0x265e('0xd'),_0x2d1e1e,'request\x20sent');logger[_0x265e('0xe')](_0x265e('0xf'),_0x2d1e1e,_0x265e('0x10'),JSON[_0x265e('0x11')](_0x274473));if(_0x274473[_0x265e('0x12')]){if(_0x274473[_0x265e('0x12')]['code']===0x1f4){logger[_0x265e('0x12')](_0x265e('0xd'),_0x2d1e1e,_0x274473['error'][_0x265e('0x13')]);return _0x1fc720(_0x274473[_0x265e('0x12')]['message']);}logger[_0x265e('0x12')](_0x265e('0xd'),_0x2d1e1e,_0x274473[_0x265e('0x12')][_0x265e('0x13')]);return _0x1ba327(_0x274473[_0x265e('0x12')][_0x265e('0x13')]);}else{logger[_0x265e('0xc')]('UserVoiceQueue,\x20%s,\x20%s',_0x2d1e1e,_0x265e('0x10'));_0x1ba327(_0x274473['result']['message']);}})[_0x265e('0x14')](function(_0x1d833e){logger[_0x265e('0x12')](_0x265e('0xd'),_0x2d1e1e,_0x1d833e);_0x1fc720(_0x1d833e);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/index.js b/server/api/userVoiceQueueRt/index.js index 71c6601..64ad959 100644 --- a/server/api/userVoiceQueueRt/index.js +++ b/server/api/userVoiceQueueRt/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x9ba863,_0x2490d9){var _0x54ffff=function(_0x2a08d9){while(--_0x2a08d9){_0x9ba863['push'](_0x9ba863['shift']());}};_0x54ffff(++_0x2490d9);}(_0xa9e0,0x123));var _0x0a9e=function(_0x12d033,_0x25fa2f){_0x12d033=_0x12d033-0x0;var _0x3b4e80=_0xa9e0[_0x12d033];return _0x3b4e80;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('0x7')]=router; \ No newline at end of file +var _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x128e0a,_0xe36b56){var _0x595a97=function(_0x1ab3bb){while(--_0x1ab3bb){_0x128e0a['push'](_0x128e0a['shift']());}};_0x595a97(++_0xe36b56);}(_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/userVoiceQueueRt/userVoiceQueueRt.attributes.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js index 933f144..36c2fb6 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 _0xc7b2=['exports','INTEGER','Required\x20by\x20Asterisk','STRING'];(function(_0x2b8abb,_0x4ee457){var _0x48b536=function(_0x5c6433){while(--_0x5c6433){_0x2b8abb['push'](_0x2b8abb['shift']());}};_0x48b536(++_0x4ee457);}(_0xc7b2,0x68));var _0x2c7b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc7b2[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module[_0x2c7b('0x0')]={'uniqueid':{'type':Sequelize[_0x2c7b('0x1')],'primaryKey':!![],'autoIncrement':!![],'comment':_0x2c7b('0x2')},'membername':{'type':Sequelize[_0x2c7b('0x3')],'allowNull':![],'comment':_0x2c7b('0x2')},'UserId':{'type':Sequelize['INTEGER'],'allowNull':![]},'queue_name':{'type':Sequelize[_0x2c7b('0x3')],'allowNull':![],'unique':'queue_interface','comment':_0x2c7b('0x2')},'VoiceQueueId':{'type':Sequelize[_0x2c7b('0x1')],'allowNull':![]},'interface':{'type':Sequelize['STRING'],'allowNull':![],'unique':'queue_interface','comment':_0x2c7b('0x2')},'penalty':{'type':Sequelize[_0x2c7b('0x1')](0xb),'defaultValue':0x0,'comment':_0x2c7b('0x2')},'paused':{'type':Sequelize[_0x2c7b('0x1')](0xb),'defaultValue':0x0,'comment':_0x2c7b('0x2')}}; \ No newline at end of file +var _0xf583=['INTEGER','STRING','queue_interface','sequelize','exports','Required\x20by\x20Asterisk'];(function(_0x5447fd,_0x52a6b5){var _0x15b28a=function(_0x370d4f){while(--_0x370d4f){_0x5447fd['push'](_0x5447fd['shift']());}};_0x15b28a(++_0x52a6b5);}(_0xf583,0x111));var _0x3f58=function(_0x1bc0ae,_0x439dfe){_0x1bc0ae=_0x1bc0ae-0x0;var _0x501104=_0xf583[_0x1bc0ae];return _0x501104;};'use strict';var Sequelize=require(_0x3f58('0x0'));module[_0x3f58('0x1')]={'uniqueid':{'type':Sequelize['INTEGER'],'primaryKey':!![],'autoIncrement':!![],'comment':_0x3f58('0x2')},'membername':{'type':Sequelize['STRING'],'allowNull':![],'comment':'Required\x20by\x20Asterisk'},'UserId':{'type':Sequelize[_0x3f58('0x3')],'allowNull':![]},'queue_name':{'type':Sequelize[_0x3f58('0x4')],'allowNull':![],'unique':_0x3f58('0x5'),'comment':'Required\x20by\x20Asterisk'},'VoiceQueueId':{'type':Sequelize[_0x3f58('0x3')],'allowNull':![]},'interface':{'type':Sequelize[_0x3f58('0x4')],'allowNull':![],'unique':_0x3f58('0x5'),'comment':_0x3f58('0x2')},'penalty':{'type':Sequelize[_0x3f58('0x3')](0xb),'defaultValue':0x0,'comment':'Required\x20by\x20Asterisk'},'paused':{'type':Sequelize[_0x3f58('0x3')](0xb),'defaultValue':0x0,'comment':_0x3f58('0x2')}}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js index c2c065d..4804772 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 _0xddba=['save','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','UserVoiceQueueRt','setMaxListeners'];(function(_0xe02f34,_0x2e3f03){var _0x2976e7=function(_0xc91734){while(--_0xc91734){_0xe02f34['push'](_0xe02f34['shift']());}};_0x2976e7(++_0x2e3f03);}(_0xddba,0x146));var _0xaddb=function(_0x528675,_0x4ec0ac){_0x528675=_0x528675-0x0;var _0xaf5411=_0xddba[_0x528675];return _0xaf5411;};'use strict';var EventEmitter=require(_0xaddb('0x0'));var UserVoiceQueueRt=require(_0xaddb('0x1'))['db'][_0xaddb('0x2')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0xaddb('0x3')](0x0);var events={'afterCreate':_0xaddb('0x4'),'afterUpdate':'update','afterDestroy':_0xaddb('0x5')};function emitEvent(_0x1d8fe9){return function(_0x4f5179,_0x3baa71,_0x54a3de){UserVoiceQueueRtEvents['emit'](_0x1d8fe9+':'+_0x4f5179['id'],_0x4f5179);UserVoiceQueueRtEvents[_0xaddb('0x6')](_0x1d8fe9,_0x4f5179);_0x54a3de(null);};}for(var e in events){if(events[_0xaddb('0x7')](e)){var event=events[e];UserVoiceQueueRt[_0xaddb('0x8')](e,emitEvent(event));}}module[_0xaddb('0x9')]=UserVoiceQueueRtEvents; \ No newline at end of file +var _0xc5ea=['save','update','remove','emit','hasOwnProperty','hook','events','../../mysqldb','UserVoiceQueueRt','setMaxListeners'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0xc5ea,0x1aa));var _0xac5e=function(_0xcd3e25,_0x3778c5){_0xcd3e25=_0xcd3e25-0x0;var _0x7164ce=_0xc5ea[_0xcd3e25];return _0x7164ce;};'use strict';var EventEmitter=require(_0xac5e('0x0'));var UserVoiceQueueRt=require(_0xac5e('0x1'))['db'][_0xac5e('0x2')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0xac5e('0x3')](0x0);var events={'afterCreate':_0xac5e('0x4'),'afterUpdate':_0xac5e('0x5'),'afterDestroy':_0xac5e('0x6')};function emitEvent(_0x541e3){return function(_0x171dcb,_0x1c7036,_0x374bd3){UserVoiceQueueRtEvents['emit'](_0x541e3+':'+_0x171dcb['id'],_0x171dcb);UserVoiceQueueRtEvents[_0xac5e('0x7')](_0x541e3,_0x171dcb);_0x374bd3(null);};}for(var e in events){if(events[_0xac5e('0x8')](e)){var event=events[e];UserVoiceQueueRt[_0xac5e('0x9')](e,emitEvent(event));}}module['exports']=UserVoiceQueueRtEvents; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js index 809a5ba..29900e8 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 _0xc64d=['lodash','../../config/logger','api','moment','bluebird','rimraf','../../config/environment','./userVoiceQueueRt.attributes','exports','UserVoiceQueueRt','user_has_voice_queues_rt'];(function(_0x1de7ec,_0x3ece6d){var _0x174ba1=function(_0x263f0b){while(--_0x263f0b){_0x1de7ec['push'](_0x1de7ec['shift']());}};_0x174ba1(++_0x3ece6d);}(_0xc64d,0x79));var _0xdc64=function(_0x2054e8,_0xc148a1){_0x2054e8=_0x2054e8-0x0;var _0xeb9c57=_0xc64d[_0x2054e8];return _0xeb9c57;};'use strict';var _=require(_0xdc64('0x0'));var util=require('util');var logger=require(_0xdc64('0x1'))(_0xdc64('0x2'));var moment=require(_0xdc64('0x3'));var BPromise=require(_0xdc64('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xdc64('0x5'));var config=require(_0xdc64('0x6'));var attributes=require(_0xdc64('0x7'));module[_0xdc64('0x8')]=function(_0x5ea825,_0x1cbfcd){return _0x5ea825['define'](_0xdc64('0x9'),attributes,{'tableName':_0xdc64('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x822f=['user_has_voice_queues_rt','lodash','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','exports','define','UserVoiceQueueRt'];(function(_0x273bf8,_0x38888a){var _0x10e784=function(_0x13a2f5){while(--_0x13a2f5){_0x273bf8['push'](_0x273bf8['shift']());}};_0x10e784(++_0x38888a);}(_0x822f,0xa9));var _0xf822=function(_0x32f2dd,_0x13a687){_0x32f2dd=_0x32f2dd-0x0;var _0x2f017=_0x822f[_0x32f2dd];return _0x2f017;};'use strict';var _=require(_0xf822('0x0'));var util=require('util');var logger=require(_0xf822('0x1'))(_0xf822('0x2'));var moment=require(_0xf822('0x3'));var BPromise=require(_0xf822('0x4'));var rp=require(_0xf822('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf822('0x6'));var config=require(_0xf822('0x7'));var attributes=require('./userVoiceQueueRt.attributes');module[_0xf822('0x8')]=function(_0x576131,_0x25efe9){return _0x576131[_0xf822('0x9')](_0xf822('0xa'),attributes,{'tableName':_0xf822('0xb'),'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 dd94588..f194b3d 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 _0x2bd0=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','defaults','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','code','message','result','catch','GetVoiceQueueRtPauses','UserVoiceQueueRt','options','where','sequelize','literal','`paused`\x20=\x201,\x201,\x20null','outboundQueuePauses','lodash','util','bluebird'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x2bd0,0x91));var _0x02bd=function(_0x28d18d,_0x55896b){_0x28d18d=_0x28d18d-0x0;var _0x470640=_0x2bd0[_0x28d18d];return _0x470640;};'use strict';var _=require(_0x02bd('0x0'));var util=require(_0x02bd('0x1'));var moment=require('moment');var BPromise=require(_0x02bd('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x02bd('0x3'));var db=require(_0x02bd('0x4'))['db'];var utils=require(_0x02bd('0x5'));var logger=require(_0x02bd('0x6'))(_0x02bd('0x7'));var config=require('../../config/environment');var jayson=require(_0x02bd('0x8'));var client=jayson['client'][_0x02bd('0x9')]({'port':0x232a});config['redis']=_[_0x02bd('0xa')](config[_0x02bd('0xb')],{'host':_0x02bd('0xc'),'port':0x18eb});var socket=require(_0x02bd('0xd'))(new Redis(config[_0x02bd('0xb')]));require(_0x02bd('0xe'))[_0x02bd('0xf')](socket);function respondWithRpcPromise(_0x3cb7a8,_0x38f7a3,_0xf2b311){return new BPromise(function(_0x593bdc,_0xadf062){return client[_0x02bd('0x10')](_0x3cb7a8,_0xf2b311)[_0x02bd('0x11')](function(_0x1114ce){logger[_0x02bd('0x12')](_0x02bd('0x13'),_0x38f7a3,_0x02bd('0x14'));logger[_0x02bd('0x15')](_0x02bd('0x16'),_0x38f7a3,_0x02bd('0x14'),JSON[_0x02bd('0x17')](_0x1114ce));if(_0x1114ce[_0x02bd('0x18')]){if(_0x1114ce[_0x02bd('0x18')][_0x02bd('0x19')]===0x1f4){logger[_0x02bd('0x18')](_0x02bd('0x13'),_0x38f7a3,_0x1114ce[_0x02bd('0x18')][_0x02bd('0x1a')]);return _0xadf062(_0x1114ce['error'][_0x02bd('0x1a')]);}logger['error']('UserVoiceQueueRt,\x20%s,\x20%s',_0x38f7a3,_0x1114ce[_0x02bd('0x18')][_0x02bd('0x1a')]);return _0x593bdc(_0x1114ce['error'][_0x02bd('0x1a')]);}else{logger[_0x02bd('0x12')](_0x02bd('0x13'),_0x38f7a3,_0x02bd('0x14'));_0x593bdc(_0x1114ce[_0x02bd('0x1b')][_0x02bd('0x1a')]);}})[_0x02bd('0x1c')](function(_0x524c44){logger['error'](_0x02bd('0x13'),_0x38f7a3,_0x524c44);_0xadf062(_0x524c44);});});}exports[_0x02bd('0x1d')]=function(_0x3071ba){var _0x27f5c2=this;return new Promise(function(_0x24005d,_0x2241d3){return db[_0x02bd('0x1e')]['findAll']({'raw':_0x3071ba[_0x02bd('0x1f')]?_0x3071ba[_0x02bd('0x1f')]['raw']===undefined?!![]:![]:!![],'where':_0x3071ba['options']?_0x3071ba[_0x02bd('0x1f')][_0x02bd('0x20')]||null:null,'attributes':[[db[_0x02bd('0x21')]['fn']('COUNT',db[_0x02bd('0x21')]['fn']('IF',db[_0x02bd('0x21')][_0x02bd('0x22')](_0x02bd('0x23')))),_0x02bd('0x24')]]})[_0x02bd('0x11')](function(_0x4fdff4){logger[_0x02bd('0x12')](_0x02bd('0x1d'),_0x3071ba);logger[_0x02bd('0x15')](_0x02bd('0x1d'),_0x3071ba,JSON['stringify'](_0x4fdff4));_0x24005d(_0x4fdff4);})[_0x02bd('0x1c')](function(_0x28c85c){logger[_0x02bd('0x18')](_0x02bd('0x1d'),_0x28c85c[_0x02bd('0x1a')],_0x3071ba);_0x2241d3(_0x27f5c2[_0x02bd('0x18')](0x1f4,_0x28c85c['message']));});});}; \ No newline at end of file +var _0xceb2=['message','result','GetVoiceQueueRtPauses','options','raw','where','sequelize','COUNT','literal','outboundQueuePauses','catch','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','defaults','redis','./userVoiceQueueRt.socket','register','request','then','info','request\x20sent','debug','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','stringify','error','UserVoiceQueueRt,\x20%s,\x20%s'];(function(_0x135b01,_0x575e88){var _0x3d0a78=function(_0x44f90d){while(--_0x44f90d){_0x135b01['push'](_0x135b01['shift']());}};_0x3d0a78(++_0x575e88);}(_0xceb2,0x181));var _0x2ceb=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xceb2[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x2ceb('0x0'));var util=require(_0x2ceb('0x1'));var moment=require('moment');var BPromise=require(_0x2ceb('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2ceb('0x3'));var db=require(_0x2ceb('0x4'))['db'];var utils=require(_0x2ceb('0x5'));var logger=require(_0x2ceb('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x2ceb('0x7'));var client=jayson[_0x2ceb('0x8')][_0x2ceb('0x9')]({'port':0x232a});config['redis']=_[_0x2ceb('0xa')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x2ceb('0xb')]));require(_0x2ceb('0xc'))[_0x2ceb('0xd')](socket);function respondWithRpcPromise(_0x1c6492,_0x40cfc0,_0x3647dd){return new BPromise(function(_0x271b51,_0x1edffa){return client[_0x2ceb('0xe')](_0x1c6492,_0x3647dd)[_0x2ceb('0xf')](function(_0x266d94){logger[_0x2ceb('0x10')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x40cfc0,_0x2ceb('0x11'));logger[_0x2ceb('0x12')](_0x2ceb('0x13'),_0x40cfc0,_0x2ceb('0x11'),JSON[_0x2ceb('0x14')](_0x266d94));if(_0x266d94['error']){if(_0x266d94['error']['code']===0x1f4){logger[_0x2ceb('0x15')](_0x2ceb('0x16'),_0x40cfc0,_0x266d94[_0x2ceb('0x15')]['message']);return _0x1edffa(_0x266d94['error'][_0x2ceb('0x17')]);}logger[_0x2ceb('0x15')](_0x2ceb('0x16'),_0x40cfc0,_0x266d94[_0x2ceb('0x15')]['message']);return _0x271b51(_0x266d94['error'][_0x2ceb('0x17')]);}else{logger['info'](_0x2ceb('0x16'),_0x40cfc0,'request\x20sent');_0x271b51(_0x266d94[_0x2ceb('0x18')][_0x2ceb('0x17')]);}})['catch'](function(_0x330efa){logger[_0x2ceb('0x15')](_0x2ceb('0x16'),_0x40cfc0,_0x330efa);_0x1edffa(_0x330efa);});});}exports[_0x2ceb('0x19')]=function(_0x4442f2){var _0x3e9179=this;return new Promise(function(_0x2532ec,_0x4bd854){return db['UserVoiceQueueRt']['findAll']({'raw':_0x4442f2['options']?_0x4442f2[_0x2ceb('0x1a')][_0x2ceb('0x1b')]===undefined?!![]:![]:!![],'where':_0x4442f2['options']?_0x4442f2['options'][_0x2ceb('0x1c')]||null:null,'attributes':[[db[_0x2ceb('0x1d')]['fn'](_0x2ceb('0x1e'),db[_0x2ceb('0x1d')]['fn']('IF',db[_0x2ceb('0x1d')][_0x2ceb('0x1f')]('`paused`\x20=\x201,\x201,\x20null'))),_0x2ceb('0x20')]]})[_0x2ceb('0xf')](function(_0x31beca){logger[_0x2ceb('0x10')](_0x2ceb('0x19'),_0x4442f2);logger[_0x2ceb('0x12')](_0x2ceb('0x19'),_0x4442f2,JSON[_0x2ceb('0x14')](_0x31beca));_0x2532ec(_0x31beca);})[_0x2ceb('0x21')](function(_0x4a2fde){logger[_0x2ceb('0x15')]('GetVoiceQueueRtPauses',_0x4a2fde[_0x2ceb('0x17')],_0x4442f2);_0x4bd854(_0x3e9179[_0x2ceb('0x15')](0x1f4,_0x4a2fde[_0x2ceb('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js index ad11f89..7c77bda 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 _0x741c=['remove','update','removeListener','register','length','userVoiceQueueRt:','./userVoiceQueueRt.events','save'];(function(_0xeed8c3,_0x1701e8){var _0x3778d2=function(_0x8409d0){while(--_0x8409d0){_0xeed8c3['push'](_0xeed8c3['shift']());}};_0x3778d2(++_0x1701e8);}(_0x741c,0x196));var _0xc741=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x741c[_0x4a9fb1];return _0x348672;};'use strict';var UserVoiceQueueRtEvents=require(_0xc741('0x0'));var events=[_0xc741('0x1'),_0xc741('0x2'),_0xc741('0x3')];function createListener(_0x1241fd,_0x31de60){return function(_0x5c8d3b){_0x31de60['emit'](_0x1241fd,_0x5c8d3b);};}function removeListener(_0x4089bf,_0x4ccc27){return function(){UserVoiceQueueRtEvents[_0xc741('0x4')](_0x4089bf,_0x4ccc27);};}exports[_0xc741('0x5')]=function(_0x3708ae){for(var _0x133bc4=0x0,_0x3f3d82=events[_0xc741('0x6')];_0x133bc4<_0x3f3d82;_0x133bc4++){var _0x46b743=events[_0x133bc4];var _0x598ead=createListener(_0xc741('0x7')+_0x46b743,_0x3708ae);UserVoiceQueueRtEvents['on'](_0x46b743,_0x598ead);}}; \ No newline at end of file +var _0xfa9f=['save','remove','update','emit','removeListener','length','userVoiceQueueRt:'];(function(_0x5c80e0,_0x2fd6e2){var _0x276cc9=function(_0x49ee7e){while(--_0x49ee7e){_0x5c80e0['push'](_0x5c80e0['shift']());}};_0x276cc9(++_0x2fd6e2);}(_0xfa9f,0x93));var _0xffa9=function(_0x22b70f,_0x4c853f){_0x22b70f=_0x22b70f-0x0;var _0x100985=_0xfa9f[_0x22b70f];return _0x100985;};'use strict';var UserVoiceQueueRtEvents=require('./userVoiceQueueRt.events');var events=[_0xffa9('0x0'),_0xffa9('0x1'),_0xffa9('0x2')];function createListener(_0x29abd2,_0x3e69f8){return function(_0x492e53){_0x3e69f8[_0xffa9('0x3')](_0x29abd2,_0x492e53);};}function removeListener(_0x5bed37,_0x2f8db9){return function(){UserVoiceQueueRtEvents[_0xffa9('0x4')](_0x5bed37,_0x2f8db9);};}exports['register']=function(_0xf1a9c6){for(var _0x4fb309=0x0,_0x4948c0=events[_0xffa9('0x5')];_0x4fb309<_0x4948c0;_0x4fb309++){var _0x1fe931=events[_0x4fb309];var _0x249501=createListener(_0xffa9('0x6')+_0x1fe931,_0xf1a9c6);UserVoiceQueueRtEvents['on'](_0x1fe931,_0x249501);}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/index.js b/server/api/userWhatsappQueue/index.js index d67640a..3002fbd 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 _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x59e067,_0x377449){var _0x3a2d0d=function(_0xa955a2){while(--_0xa955a2){_0x59e067['push'](_0x59e067['shift']());}};_0x3a2d0d(++_0x377449);}(_0xa9e0,0x123));var _0x0a9e=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xa9e0[_0x501510];return _0x1e6ee5;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('0x7')]=router; \ No newline at end of file +var _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x1ac05d,_0x449e91){var _0xd578=function(_0x4aa576){while(--_0x4aa576){_0x1ac05d['push'](_0x1ac05d['shift']());}};_0xd578(++_0x449e91);}(_0x70e0,0x17b));var _0x070e=function(_0x528887,_0x1b5b37){_0x528887=_0x528887-0x0;var _0xdd9cdc=_0x70e0[_0x528887];return _0xdd9cdc;};'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/userWhatsappQueue/userWhatsappQueue.attributes.js b/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js index 7d2d456..da91877 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 _0x1ac6=['sequelize','exports','INTEGER'];(function(_0x44a442,_0x1cba8f){var _0x44db54=function(_0x1c1434){while(--_0x1c1434){_0x44a442['push'](_0x44a442['shift']());}};_0x44db54(++_0x1cba8f);}(_0x1ac6,0x10b));var _0x61ac=function(_0x498c78,_0x2eab48){_0x498c78=_0x498c78-0x0;var _0xb7697f=_0x1ac6[_0x498c78];return _0xb7697f;};'use strict';var Sequelize=require(_0x61ac('0x0'));module[_0x61ac('0x1')]={'penalty':{'type':Sequelize[_0x61ac('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x12f1=['INTEGER','sequelize'];(function(_0x5907fd,_0x3cef95){var _0xd8f7db=function(_0x417636){while(--_0x417636){_0x5907fd['push'](_0x5907fd['shift']());}};_0xd8f7db(++_0x3cef95);}(_0x12f1,0x151));var _0x112f=function(_0x1ff92d,_0x3bfdeb){_0x1ff92d=_0x1ff92d-0x0;var _0x129a98=_0x12f1[_0x1ff92d];return _0x129a98;};'use strict';var Sequelize=require(_0x112f('0x0'));module['exports']={'penalty':{'type':Sequelize[_0x112f('0x1')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.model.js b/server/api/userWhatsappQueue/userWhatsappQueue.model.js index bbd88d0..e7d0b5a 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 _0x2c0b=['rimraf','../../config/environment','./userWhatsappQueue.attributes','define','UserWhatsappQueue','lodash','util','../../config/logger','bluebird','path'];(function(_0x2f162d,_0x58e61e){var _0x69a220=function(_0x1190a4){while(--_0x1190a4){_0x2f162d['push'](_0x2f162d['shift']());}};_0x69a220(++_0x58e61e);}(_0x2c0b,0x163));var _0xb2c0=function(_0x1e0c7a,_0x6b6dcb){_0x1e0c7a=_0x1e0c7a-0x0;var _0x33bcf4=_0x2c0b[_0x1e0c7a];return _0x33bcf4;};'use strict';var _=require(_0xb2c0('0x0'));var util=require(_0xb2c0('0x1'));var logger=require(_0xb2c0('0x2'))('api');var moment=require('moment');var BPromise=require(_0xb2c0('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb2c0('0x4'));var rimraf=require(_0xb2c0('0x5'));var config=require(_0xb2c0('0x6'));var attributes=require(_0xb2c0('0x7'));module['exports']=function(_0x34f5be,_0x117036){return _0x34f5be[_0xb2c0('0x8')](_0xb2c0('0x9'),attributes,{'tableName':'user_has_whatsapp_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x98ab=['UserWhatsappQueue','user_has_whatsapp_queues','util','api','moment','request-promise','rimraf','../../config/environment','./userWhatsappQueue.attributes','exports','define'];(function(_0xf55307,_0x1635a9){var _0x5c700b=function(_0x40c8bc){while(--_0x40c8bc){_0xf55307['push'](_0xf55307['shift']());}};_0x5c700b(++_0x1635a9);}(_0x98ab,0x16d));var _0xb98a=function(_0x4f47c0,_0x192781){_0x4f47c0=_0x4f47c0-0x0;var _0x4247bf=_0x98ab[_0x4f47c0];return _0x4247bf;};'use strict';var _=require('lodash');var util=require(_0xb98a('0x0'));var logger=require('../../config/logger')(_0xb98a('0x1'));var moment=require(_0xb98a('0x2'));var BPromise=require('bluebird');var rp=require(_0xb98a('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb98a('0x4'));var config=require(_0xb98a('0x5'));var attributes=require(_0xb98a('0x6'));module[_0xb98a('0x7')]=function(_0x2e208c,_0x45a741){return _0x2e208c[_0xb98a('0x8')](_0xb98a('0x9'),attributes,{'tableName':_0xb98a('0xa'),'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 92cb129..889ada5 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 _0x3714=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','request\x20sent','debug','UserWhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','UserWhatsappQueue,\x20%s,\x20%s','message','info','result','lodash','util','moment'];(function(_0x6626c,_0x55b490){var _0x598583=function(_0x40cce3){while(--_0x40cce3){_0x6626c['push'](_0x6626c['shift']());}};_0x598583(++_0x55b490);}(_0x3714,0x18d));var _0x4371=function(_0x548990,_0x3832a){_0x548990=_0x548990-0x0;var _0x2076bd=_0x3714[_0x548990];return _0x2076bd;};'use strict';var _=require(_0x4371('0x0'));var util=require(_0x4371('0x1'));var moment=require(_0x4371('0x2'));var BPromise=require(_0x4371('0x3'));var rs=require(_0x4371('0x4'));var fs=require('fs');var Redis=require(_0x4371('0x5'));var db=require(_0x4371('0x6'))['db'];var utils=require(_0x4371('0x7'));var logger=require(_0x4371('0x8'))(_0x4371('0x9'));var config=require(_0x4371('0xa'));var jayson=require(_0x4371('0xb'));var client=jayson[_0x4371('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0x39fe0e,_0x3f0b94,_0x3e7d28){return new BPromise(function(_0x33e9ab,_0x3d0c03){return client[_0x4371('0xd')](_0x39fe0e,_0x3e7d28)[_0x4371('0xe')](function(_0x23aaff){logger['info']('UserWhatsappQueue,\x20%s,\x20%s',_0x3f0b94,_0x4371('0xf'));logger[_0x4371('0x10')](_0x4371('0x11'),_0x3f0b94,_0x4371('0xf'),JSON[_0x4371('0x12')](_0x23aaff));if(_0x23aaff[_0x4371('0x13')]){if(_0x23aaff[_0x4371('0x13')][_0x4371('0x14')]===0x1f4){logger['error'](_0x4371('0x15'),_0x3f0b94,_0x23aaff[_0x4371('0x13')][_0x4371('0x16')]);return _0x3d0c03(_0x23aaff[_0x4371('0x13')][_0x4371('0x16')]);}logger[_0x4371('0x13')](_0x4371('0x15'),_0x3f0b94,_0x23aaff[_0x4371('0x13')][_0x4371('0x16')]);return _0x33e9ab(_0x23aaff[_0x4371('0x13')][_0x4371('0x16')]);}else{logger[_0x4371('0x17')](_0x4371('0x15'),_0x3f0b94,_0x4371('0xf'));_0x33e9ab(_0x23aaff[_0x4371('0x18')][_0x4371('0x16')]);}})['catch'](function(_0x266a1f){logger[_0x4371('0x13')](_0x4371('0x15'),_0x3f0b94,_0x266a1f);_0x3d0c03(_0x266a1f);});});} \ No newline at end of file +var _0x4545=['../../config/logger','rpc','../../config/environment','client','http','request','then','UserWhatsappQueue,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils'];(function(_0x20f256,_0x2f58ec){var _0x5ced25=function(_0x15a4c4){while(--_0x15a4c4){_0x20f256['push'](_0x20f256['shift']());}};_0x5ced25(++_0x2f58ec);}(_0x4545,0x15f));var _0x5454=function(_0x27af45,_0x1b57aa){_0x27af45=_0x27af45-0x0;var _0x18df21=_0x4545[_0x27af45];return _0x18df21;};'use strict';var _=require(_0x5454('0x0'));var util=require(_0x5454('0x1'));var moment=require(_0x5454('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5454('0x3'));var db=require(_0x5454('0x4'))['db'];var utils=require(_0x5454('0x5'));var logger=require(_0x5454('0x6'))(_0x5454('0x7'));var config=require(_0x5454('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x5454('0x9')][_0x5454('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3ba325,_0x27559a,_0x1d2be4){return new BPromise(function(_0x2bcc1e,_0x1fdba7){return client[_0x5454('0xb')](_0x3ba325,_0x1d2be4)[_0x5454('0xc')](function(_0x135644){logger['info'](_0x5454('0xd'),_0x27559a,'request\x20sent');logger['debug']('UserWhatsappQueue,\x20%s,\x20%s,\x20%s',_0x27559a,'request\x20sent',JSON[_0x5454('0xe')](_0x135644));if(_0x135644[_0x5454('0xf')]){if(_0x135644[_0x5454('0xf')][_0x5454('0x10')]===0x1f4){logger[_0x5454('0xf')](_0x5454('0xd'),_0x27559a,_0x135644[_0x5454('0xf')][_0x5454('0x11')]);return _0x1fdba7(_0x135644[_0x5454('0xf')][_0x5454('0x11')]);}logger['error'](_0x5454('0xd'),_0x27559a,_0x135644[_0x5454('0xf')][_0x5454('0x11')]);return _0x2bcc1e(_0x135644['error'][_0x5454('0x11')]);}else{logger[_0x5454('0x12')](_0x5454('0xd'),_0x27559a,'request\x20sent');_0x2bcc1e(_0x135644[_0x5454('0x13')][_0x5454('0x11')]);}})[_0x5454('0x14')](function(_0x177617){logger[_0x5454('0xf')](_0x5454('0xd'),_0x27559a,_0x177617);_0x1fdba7(_0x177617);});});} \ No newline at end of file diff --git a/server/api/variable/index.js b/server/api/variable/index.js index 3c9bfb4..d1e0bd4 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 _0x6108=['isAuthenticated','index','post','create','/:id','update','delete','exports','multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','get'];(function(_0x576be9,_0x5dd358){var _0x5b5e13=function(_0x4bd1c1){while(--_0x4bd1c1){_0x576be9['push'](_0x576be9['shift']());}};_0x5b5e13(++_0x5dd358);}(_0x6108,0xbc));var _0x8610=function(_0x2db541,_0x25f82c){_0x2db541=_0x2db541-0x0;var _0x1faa0e=_0x6108[_0x2db541];return _0x1faa0e;};'use strict';var multer=require(_0x8610('0x0'));var util=require('util');var path=require(_0x8610('0x1'));var timeout=require(_0x8610('0x2'));var express=require(_0x8610('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x8610('0x4'));var interaction=require(_0x8610('0x5'));var config=require('../../config/environment');var controller=require('./variable.controller');router[_0x8610('0x6')]('/',auth[_0x8610('0x7')](),controller[_0x8610('0x8')]);router[_0x8610('0x6')]('/:id',auth[_0x8610('0x7')](),controller['show']);router[_0x8610('0x9')]('/',auth[_0x8610('0x7')](),controller[_0x8610('0xa')]);router['put'](_0x8610('0xb'),auth[_0x8610('0x7')](),controller[_0x8610('0xc')]);router[_0x8610('0xd')](_0x8610('0xb'),auth[_0x8610('0x7')](),controller['destroy']);module[_0x8610('0xe')]=router; \ No newline at end of file +var _0xf041=['delete','exports','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','isAuthenticated','get','/:id','show','create','put','update'];(function(_0x4b973d,_0x54b57f){var _0x44e3de=function(_0x46c877){while(--_0x46c877){_0x4b973d['push'](_0x4b973d['shift']());}};_0x44e3de(++_0x54b57f);}(_0xf041,0x15b));var _0x1f04=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xf041[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1f04('0x0'));var timeout=require(_0x1f04('0x1'));var express=require(_0x1f04('0x2'));var router=express[_0x1f04('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1f04('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x1f04('0x5'));var controller=require('./variable.controller');router['get']('/',auth[_0x1f04('0x6')](),controller['index']);router[_0x1f04('0x7')](_0x1f04('0x8'),auth[_0x1f04('0x6')](),controller[_0x1f04('0x9')]);router['post']('/',auth[_0x1f04('0x6')](),controller[_0x1f04('0xa')]);router[_0x1f04('0xb')](_0x1f04('0x8'),auth[_0x1f04('0x6')](),controller[_0x1f04('0xc')]);router[_0x1f04('0xd')](_0x1f04('0x8'),auth['isAuthenticated'](),controller['destroy']);module[_0x1f04('0xe')]=router; \ No newline at end of file diff --git a/server/api/variable/variable.attributes.js b/server/api/variable/variable.attributes.js index 3a08ddb..efa25c8 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 _0x9290=['name','sequelize','exports','STRING'];(function(_0x4077eb,_0x14752c){var _0x3bde32=function(_0x5b6101){while(--_0x5b6101){_0x4077eb['push'](_0x4077eb['shift']());}};_0x3bde32(++_0x14752c);}(_0x9290,0x79));var _0x0929=function(_0x575a31,_0x56336f){_0x575a31=_0x575a31-0x0;var _0x5d7dad=_0x9290[_0x575a31];return _0x5d7dad;};'use strict';var Sequelize=require(_0x0929('0x0'));module[_0x0929('0x1')]={'name':{'type':Sequelize[_0x0929('0x2')],'unique':_0x0929('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x0929('0x2')]}}; \ No newline at end of file +var _0xfc90=['exports','STRING','name','sequelize'];(function(_0x52542c,_0x1f9526){var _0x12c8f0=function(_0x7c4434){while(--_0x7c4434){_0x52542c['push'](_0x52542c['shift']());}};_0x12c8f0(++_0x1f9526);}(_0xfc90,0x17b));var _0x0fc9=function(_0x1d5008,_0x3aebdd){_0x1d5008=_0x1d5008-0x0;var _0x1ca041=_0xfc90[_0x1d5008];return _0x1ca041;};'use strict';var Sequelize=require(_0x0fc9('0x0'));module[_0x0fc9('0x1')]={'name':{'type':Sequelize[_0x0fc9('0x2')],'unique':_0x0fc9('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x0fc9('0x2')]}}; \ No newline at end of file diff --git a/server/api/variable/variable.controller.js b/server/api/variable/variable.controller.js index fe36e5f..2163f7c 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 _0xe2c1=['index','map','Variable','rawAttributes','fieldName','model','query','filters','attributes','intersection','fields','length','nolimit','order','sort','where','pick','type','VIRTUAL','filter','merge','options','includeAll','include','findAll','rows','keys','find','catch','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','params','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','reject','save','update','destroy','then','get','Variables','UserProfileResource','end','error','stack','name','send'];(function(_0x4e6ae6,_0x49dba6){var _0x23c108=function(_0x1bc103){while(--_0x1bc103){_0x4e6ae6['push'](_0x4e6ae6['shift']());}};_0x23c108(++_0x49dba6);}(_0xe2c1,0xca));var _0x1e2c=function(_0x4933b2,_0x21179c){_0x4933b2=_0x4933b2-0x0;var _0x557585=_0xe2c1[_0x4933b2];return _0x557585;};'use strict';var emlformat=require(_0x1e2c('0x0'));var rimraf=require(_0x1e2c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x1e2c('0x2'));var rp=require(_0x1e2c('0x3'));var moment=require('moment');var BPromise=require(_0x1e2c('0x4'));var Mustache=require(_0x1e2c('0x5'));var util=require('util');var path=require(_0x1e2c('0x6'));var sox=require(_0x1e2c('0x7'));var csv=require(_0x1e2c('0x8'));var ejs=require(_0x1e2c('0x9'));var fs=require('fs');var fs_extra=require(_0x1e2c('0xa'));var _=require(_0x1e2c('0xb'));var squel=require('squel');var crypto=require(_0x1e2c('0xc'));var jsforce=require(_0x1e2c('0xd'));var deskjs=require(_0x1e2c('0xe'));var toCsv=require(_0x1e2c('0x8'));var querystring=require(_0x1e2c('0xf'));var Papa=require(_0x1e2c('0x10'));var Redis=require(_0x1e2c('0x11'));var authService=require(_0x1e2c('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x1e2c('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x1e2c('0x14'))(_0x1e2c('0x15'));var utils=require(_0x1e2c('0x16'));var config=require(_0x1e2c('0x17'));var licenseUtil=require(_0x1e2c('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x10ba07,_0x2c7044){_0x2c7044=_0x2c7044||0xcc;return function(_0x4ca0ca){if(_0x4ca0ca){return _0x10ba07[_0x1e2c('0x19')](_0x2c7044);}return _0x10ba07[_0x1e2c('0x1a')](_0x2c7044)['end']();};}function respondWithResult(_0x234d25,_0xdfd18){_0xdfd18=_0xdfd18||0xc8;return function(_0x3b084f){if(_0x3b084f){return _0x234d25['status'](_0xdfd18)[_0x1e2c('0x1b')](_0x3b084f);}};}function respondWithFilteredResult(_0x31ff17,_0x5d7eef){return function(_0x7db71f){if(_0x7db71f){var _0x2d9b53=typeof _0x5d7eef['offset']===_0x1e2c('0x1c')&&typeof _0x5d7eef[_0x1e2c('0x1d')]==='undefined';var _0xbc26e=_0x7db71f[_0x1e2c('0x1e')];var _0x2191fe=_0x2d9b53?0x0:_0x5d7eef[_0x1e2c('0x1f')];var _0x258ef6=_0x2d9b53?_0x7db71f['count']:_0x5d7eef[_0x1e2c('0x1f')]+_0x5d7eef['limit'];var _0x207ba4;if(_0x258ef6>=_0xbc26e){_0x258ef6=_0xbc26e;_0x207ba4=0xc8;}else{_0x207ba4=0xce;}_0x31ff17[_0x1e2c('0x1a')](_0x207ba4);return _0x31ff17[_0x1e2c('0x20')](_0x1e2c('0x21'),_0x2191fe+'-'+_0x258ef6+'/'+_0xbc26e)[_0x1e2c('0x1b')](_0x7db71f);}return null;};}function patchUpdates(_0x51c406){return function(_0x5f12a8){try{jsonpatch['apply'](_0x5f12a8,_0x51c406,!![]);}catch(_0x24981e){return BPromise[_0x1e2c('0x22')](_0x24981e);}return _0x5f12a8[_0x1e2c('0x23')]();};}function saveUpdates(_0x2ce56f,_0x21515a){return function(_0x46b3cd){if(_0x46b3cd){return _0x46b3cd[_0x1e2c('0x24')](_0x2ce56f)['then'](function(_0x501578){return _0x501578;});}return null;};}function removeEntity(_0x136ea1,_0x3cb7db){return function(_0x3aa583){if(_0x3aa583){return _0x3aa583[_0x1e2c('0x25')]()[_0x1e2c('0x26')](function(){var _0x2cde1a=_0x3aa583[_0x1e2c('0x27')]({'plain':!![]});var _0x1c6eb1=_0x1e2c('0x28');return db[_0x1e2c('0x29')][_0x1e2c('0x25')]({'where':{'type':_0x1c6eb1,'resourceId':_0x2cde1a['id']}})[_0x1e2c('0x26')](function(){return _0x3aa583;});})[_0x1e2c('0x26')](function(){_0x136ea1[_0x1e2c('0x1a')](0xcc)[_0x1e2c('0x2a')]();});}};}function handleEntityNotFound(_0x575d88,_0x3ce363){return function(_0x572edd){if(!_0x572edd){_0x575d88[_0x1e2c('0x19')](0x194);}return _0x572edd;};}function handleError(_0x1f6e3d,_0x153806){_0x153806=_0x153806||0x1f4;return function(_0x29a93c){logger[_0x1e2c('0x2b')](_0x29a93c[_0x1e2c('0x2c')]);if(_0x29a93c[_0x1e2c('0x2d')]){delete _0x29a93c['name'];}_0x1f6e3d[_0x1e2c('0x1a')](_0x153806)[_0x1e2c('0x2e')](_0x29a93c);};}exports[_0x1e2c('0x2f')]=function(_0x3ad6b3,_0x3d08fe){var _0x1ce166={},_0x21fcc4={},_0x5204d3={'count':0x0,'rows':[]};var _0x1b7915=_[_0x1e2c('0x30')](db[_0x1e2c('0x31')][_0x1e2c('0x32')],function(_0x5daf2d){return{'name':_0x5daf2d[_0x1e2c('0x33')],'type':_0x5daf2d['type']['key']};});_0x21fcc4[_0x1e2c('0x34')]=_[_0x1e2c('0x30')](_0x1b7915,_0x1e2c('0x2d'));_0x21fcc4['query']=_['keys'](_0x3ad6b3[_0x1e2c('0x35')]);_0x21fcc4[_0x1e2c('0x36')]=_['intersection'](_0x21fcc4['model'],_0x21fcc4[_0x1e2c('0x35')]);_0x1ce166[_0x1e2c('0x37')]=_[_0x1e2c('0x38')](_0x21fcc4['model'],qs[_0x1e2c('0x39')](_0x3ad6b3[_0x1e2c('0x35')][_0x1e2c('0x39')]));_0x1ce166['attributes']=_0x1ce166[_0x1e2c('0x37')][_0x1e2c('0x3a')]?_0x1ce166['attributes']:_0x21fcc4[_0x1e2c('0x34')];if(!_0x3ad6b3[_0x1e2c('0x35')]['hasOwnProperty'](_0x1e2c('0x3b'))){_0x1ce166['limit']=qs['limit'](_0x3ad6b3[_0x1e2c('0x35')][_0x1e2c('0x1d')]);_0x1ce166[_0x1e2c('0x1f')]=qs[_0x1e2c('0x1f')](_0x3ad6b3[_0x1e2c('0x35')][_0x1e2c('0x1f')]);}_0x1ce166[_0x1e2c('0x3c')]=qs['sort'](_0x3ad6b3['query'][_0x1e2c('0x3d')]);_0x1ce166[_0x1e2c('0x3e')]=qs['filters'](_[_0x1e2c('0x3f')](_0x3ad6b3[_0x1e2c('0x35')],_0x21fcc4[_0x1e2c('0x36')]),_0x1b7915);if(_0x3ad6b3['query']['filter']){_0x1ce166[_0x1e2c('0x3e')]=_['merge'](_0x1ce166[_0x1e2c('0x3e')],{'$or':_[_0x1e2c('0x30')](_0x1b7915,function(_0x2e8054){if(_0x2e8054[_0x1e2c('0x40')]!==_0x1e2c('0x41')){var _0x53585e={};_0x53585e[_0x2e8054[_0x1e2c('0x2d')]]={'$like':'%'+_0x3ad6b3['query'][_0x1e2c('0x42')]+'%'};return _0x53585e;}})});}_0x1ce166=_[_0x1e2c('0x43')]({},_0x1ce166,_0x3ad6b3[_0x1e2c('0x44')]);var _0x56991d={'where':_0x1ce166[_0x1e2c('0x3e')]};return db['Variable'][_0x1e2c('0x1e')](_0x56991d)['then'](function(_0x47d122){_0x5204d3[_0x1e2c('0x1e')]=_0x47d122;if(_0x3ad6b3[_0x1e2c('0x35')][_0x1e2c('0x45')]){_0x1ce166[_0x1e2c('0x46')]=[{'all':!![]}];}return db[_0x1e2c('0x31')][_0x1e2c('0x47')](_0x1ce166);})[_0x1e2c('0x26')](function(_0x5bf760){_0x5204d3[_0x1e2c('0x48')]=_0x5bf760;return _0x5204d3;})[_0x1e2c('0x26')](respondWithFilteredResult(_0x3d08fe,_0x1ce166))['catch'](handleError(_0x3d08fe,null));};exports['show']=function(_0x39dcd3,_0x3dff57){var _0x51d2eb={'raw':!![],'where':{'id':_0x39dcd3['params']['id']}},_0x3c71f6={};_0x3c71f6[_0x1e2c('0x34')]=_[_0x1e2c('0x49')](db[_0x1e2c('0x31')][_0x1e2c('0x32')]);_0x3c71f6['query']=_[_0x1e2c('0x49')](_0x39dcd3['query']);_0x3c71f6[_0x1e2c('0x36')]=_[_0x1e2c('0x38')](_0x3c71f6[_0x1e2c('0x34')],_0x3c71f6[_0x1e2c('0x35')]);_0x51d2eb[_0x1e2c('0x37')]=_['intersection'](_0x3c71f6['model'],qs[_0x1e2c('0x39')](_0x39dcd3[_0x1e2c('0x35')][_0x1e2c('0x39')]));_0x51d2eb[_0x1e2c('0x37')]=_0x51d2eb['attributes'][_0x1e2c('0x3a')]?_0x51d2eb[_0x1e2c('0x37')]:_0x3c71f6[_0x1e2c('0x34')];if(_0x39dcd3[_0x1e2c('0x35')][_0x1e2c('0x45')]){_0x51d2eb[_0x1e2c('0x46')]=[{'all':!![]}];}_0x51d2eb=_['merge']({},_0x51d2eb,_0x39dcd3[_0x1e2c('0x44')]);return db['Variable'][_0x1e2c('0x4a')](_0x51d2eb)[_0x1e2c('0x26')](handleEntityNotFound(_0x3dff57,null))[_0x1e2c('0x26')](respondWithResult(_0x3dff57,null))[_0x1e2c('0x4b')](handleError(_0x3dff57,null));};exports['create']=function(_0x358baa,_0x4e27e8){return db[_0x1e2c('0x31')][_0x1e2c('0x4c')](_0x358baa[_0x1e2c('0x4d')],{})[_0x1e2c('0x26')](function(_0x2cd194){var _0x501339=_0x358baa['user'][_0x1e2c('0x27')]({'plain':!![]});if(!_0x501339)throw new Error(_0x1e2c('0x4e'));if(_0x501339[_0x1e2c('0x4f')]==='user'){var _0x11d412=_0x2cd194[_0x1e2c('0x27')]({'plain':!![]});var _0x1e9a1a=_0x1e2c('0x28');return db[_0x1e2c('0x50')][_0x1e2c('0x4a')]({'where':{'name':_0x1e9a1a,'userProfileId':_0x501339['userProfileId']},'raw':!![]})['then'](function(_0x1cbd3b){if(_0x1cbd3b&&_0x1cbd3b[_0x1e2c('0x51')]===0x0){return db[_0x1e2c('0x29')][_0x1e2c('0x4c')]({'name':_0x11d412[_0x1e2c('0x2d')],'resourceId':_0x11d412['id'],'type':_0x1cbd3b[_0x1e2c('0x2d')],'sectionId':_0x1cbd3b['id']},{})[_0x1e2c('0x26')](function(){return _0x2cd194;});}else{return _0x2cd194;}})['catch'](function(_0x2b9f54){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2b9f54);throw _0x2b9f54;});}return _0x2cd194;})[_0x1e2c('0x26')](respondWithResult(_0x4e27e8,0xc9))[_0x1e2c('0x4b')](handleError(_0x4e27e8,null));};exports[_0x1e2c('0x24')]=function(_0x24ced6,_0xf96e40){if(_0x24ced6[_0x1e2c('0x4d')]['id']){delete _0x24ced6['body']['id'];}return db[_0x1e2c('0x31')][_0x1e2c('0x4a')]({'where':{'id':_0x24ced6['params']['id']}})[_0x1e2c('0x26')](handleEntityNotFound(_0xf96e40,null))[_0x1e2c('0x26')](saveUpdates(_0x24ced6[_0x1e2c('0x4d')],null))[_0x1e2c('0x26')](respondWithResult(_0xf96e40,null))[_0x1e2c('0x4b')](handleError(_0xf96e40,null));};exports[_0x1e2c('0x25')]=function(_0x48a89d,_0x237038){return db[_0x1e2c('0x31')][_0x1e2c('0x4a')]({'where':{'id':_0x48a89d[_0x1e2c('0x52')]['id']}})[_0x1e2c('0x26')](handleEntityNotFound(_0x237038,null))[_0x1e2c('0x26')](removeEntity(_0x237038,null))[_0x1e2c('0x4b')](handleError(_0x237038,null));}; \ No newline at end of file +var _0x47b9=['query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','Variable','includeAll','rows','show','params','keys','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Variables','UserProfileSection','find','userProfileId','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','save','update','then','destroy','get','UserProfileResource','sendStatus','error','stack','name','send','index','rawAttributes','type','key','model','map'];(function(_0x525c7b,_0x488fcc){var _0x27b33e=function(_0x56d43b){while(--_0x56d43b){_0x525c7b['push'](_0x525c7b['shift']());}};_0x27b33e(++_0x488fcc);}(_0x47b9,0x16c));var _0x947b=function(_0x1b51ea,_0x394fd9){_0x1b51ea=_0x1b51ea-0x0;var _0x18bbdc=_0x47b9[_0x1b51ea];return _0x18bbdc;};'use strict';var emlformat=require(_0x947b('0x0'));var rimraf=require(_0x947b('0x1'));var zipdir=require(_0x947b('0x2'));var jsonpatch=require(_0x947b('0x3'));var rp=require(_0x947b('0x4'));var moment=require(_0x947b('0x5'));var BPromise=require(_0x947b('0x6'));var Mustache=require(_0x947b('0x7'));var util=require(_0x947b('0x8'));var path=require(_0x947b('0x9'));var sox=require('sox');var csv=require(_0x947b('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x947b('0xb'));var squel=require(_0x947b('0xc'));var crypto=require(_0x947b('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x947b('0xe'));var Papa=require(_0x947b('0xf'));var Redis=require(_0x947b('0x10'));var authService=require(_0x947b('0x11'));var qs=require(_0x947b('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x947b('0x13'))(_0x947b('0x14'));var utils=require('../../config/utils');var config=require(_0x947b('0x15'));var licenseUtil=require(_0x947b('0x16'));var db=require(_0x947b('0x17'))['db'];function respondWithStatusCode(_0x25c0f7,_0x2ecc8b){_0x2ecc8b=_0x2ecc8b||0xcc;return function(_0x28254e){if(_0x28254e){return _0x25c0f7['sendStatus'](_0x2ecc8b);}return _0x25c0f7[_0x947b('0x18')](_0x2ecc8b)[_0x947b('0x19')]();};}function respondWithResult(_0x5bd382,_0x6308a5){_0x6308a5=_0x6308a5||0xc8;return function(_0x2a4399){if(_0x2a4399){return _0x5bd382[_0x947b('0x18')](_0x6308a5)['json'](_0x2a4399);}};}function respondWithFilteredResult(_0x511f4c,_0x13ac0e){return function(_0xf0ded5){if(_0xf0ded5){var _0x254529=typeof _0x13ac0e[_0x947b('0x1a')]===_0x947b('0x1b')&&typeof _0x13ac0e[_0x947b('0x1c')]===_0x947b('0x1b');var _0x50ab6e=_0xf0ded5[_0x947b('0x1d')];var _0x4d2272=_0x254529?0x0:_0x13ac0e['offset'];var _0x1b519f=_0x254529?_0xf0ded5['count']:_0x13ac0e[_0x947b('0x1a')]+_0x13ac0e[_0x947b('0x1c')];var _0x4ab67c;if(_0x1b519f>=_0x50ab6e){_0x1b519f=_0x50ab6e;_0x4ab67c=0xc8;}else{_0x4ab67c=0xce;}_0x511f4c[_0x947b('0x18')](_0x4ab67c);return _0x511f4c[_0x947b('0x1e')](_0x947b('0x1f'),_0x4d2272+'-'+_0x1b519f+'/'+_0x50ab6e)[_0x947b('0x20')](_0xf0ded5);}return null;};}function patchUpdates(_0x3a06dc){return function(_0x2aa395){try{jsonpatch[_0x947b('0x21')](_0x2aa395,_0x3a06dc,!![]);}catch(_0x4d968f){return BPromise['reject'](_0x4d968f);}return _0x2aa395[_0x947b('0x22')]();};}function saveUpdates(_0x47ad82,_0x2173dc){return function(_0x19fd43){if(_0x19fd43){return _0x19fd43[_0x947b('0x23')](_0x47ad82)[_0x947b('0x24')](function(_0x1604bc){return _0x1604bc;});}return null;};}function removeEntity(_0xb99581,_0x4d94aa){return function(_0x4f3c24){if(_0x4f3c24){return _0x4f3c24[_0x947b('0x25')]()[_0x947b('0x24')](function(){var _0x1ac1c6=_0x4f3c24[_0x947b('0x26')]({'plain':!![]});var _0x5d988c='Variables';return db[_0x947b('0x27')][_0x947b('0x25')]({'where':{'type':_0x5d988c,'resourceId':_0x1ac1c6['id']}})[_0x947b('0x24')](function(){return _0x4f3c24;});})[_0x947b('0x24')](function(){_0xb99581[_0x947b('0x18')](0xcc)[_0x947b('0x19')]();});}};}function handleEntityNotFound(_0x3d102d,_0x3bcc61){return function(_0x183337){if(!_0x183337){_0x3d102d[_0x947b('0x28')](0x194);}return _0x183337;};}function handleError(_0x174f30,_0xc1a165){_0xc1a165=_0xc1a165||0x1f4;return function(_0x3f91b1){logger[_0x947b('0x29')](_0x3f91b1[_0x947b('0x2a')]);if(_0x3f91b1['name']){delete _0x3f91b1[_0x947b('0x2b')];}_0x174f30['status'](_0xc1a165)[_0x947b('0x2c')](_0x3f91b1);};}exports[_0x947b('0x2d')]=function(_0x23a019,_0x2f4b69){var _0x5ad92c={},_0x41d622={},_0x4fb0b0={'count':0x0,'rows':[]};var _0x4697f6=_['map'](db['Variable'][_0x947b('0x2e')],function(_0x74bf2c){return{'name':_0x74bf2c['fieldName'],'type':_0x74bf2c[_0x947b('0x2f')][_0x947b('0x30')]};});_0x41d622[_0x947b('0x31')]=_[_0x947b('0x32')](_0x4697f6,_0x947b('0x2b'));_0x41d622[_0x947b('0x33')]=_['keys'](_0x23a019[_0x947b('0x33')]);_0x41d622[_0x947b('0x34')]=_[_0x947b('0x35')](_0x41d622[_0x947b('0x31')],_0x41d622['query']);_0x5ad92c[_0x947b('0x36')]=_[_0x947b('0x35')](_0x41d622[_0x947b('0x31')],qs[_0x947b('0x37')](_0x23a019[_0x947b('0x33')][_0x947b('0x37')]));_0x5ad92c[_0x947b('0x36')]=_0x5ad92c[_0x947b('0x36')][_0x947b('0x38')]?_0x5ad92c['attributes']:_0x41d622[_0x947b('0x31')];if(!_0x23a019['query'][_0x947b('0x39')]('nolimit')){_0x5ad92c[_0x947b('0x1c')]=qs[_0x947b('0x1c')](_0x23a019[_0x947b('0x33')]['limit']);_0x5ad92c[_0x947b('0x1a')]=qs['offset'](_0x23a019[_0x947b('0x33')][_0x947b('0x1a')]);}_0x5ad92c[_0x947b('0x3a')]=qs[_0x947b('0x3b')](_0x23a019['query']['sort']);_0x5ad92c[_0x947b('0x3c')]=qs[_0x947b('0x34')](_[_0x947b('0x3d')](_0x23a019['query'],_0x41d622[_0x947b('0x34')]),_0x4697f6);if(_0x23a019['query'][_0x947b('0x3e')]){_0x5ad92c[_0x947b('0x3c')]=_[_0x947b('0x3f')](_0x5ad92c[_0x947b('0x3c')],{'$or':_['map'](_0x4697f6,function(_0x317b15){if(_0x317b15['type']!==_0x947b('0x40')){var _0x25be53={};_0x25be53[_0x317b15[_0x947b('0x2b')]]={'$like':'%'+_0x23a019[_0x947b('0x33')][_0x947b('0x3e')]+'%'};return _0x25be53;}})});}_0x5ad92c=_['merge']({},_0x5ad92c,_0x23a019[_0x947b('0x41')]);var _0x21e0d9={'where':_0x5ad92c[_0x947b('0x3c')]};return db[_0x947b('0x42')][_0x947b('0x1d')](_0x21e0d9)['then'](function(_0xc3aa10){_0x4fb0b0['count']=_0xc3aa10;if(_0x23a019[_0x947b('0x33')][_0x947b('0x43')]){_0x5ad92c['include']=[{'all':!![]}];}return db[_0x947b('0x42')]['findAll'](_0x5ad92c);})[_0x947b('0x24')](function(_0x19840c){_0x4fb0b0[_0x947b('0x44')]=_0x19840c;return _0x4fb0b0;})[_0x947b('0x24')](respondWithFilteredResult(_0x2f4b69,_0x5ad92c))['catch'](handleError(_0x2f4b69,null));};exports[_0x947b('0x45')]=function(_0x531918,_0x14697e){var _0x49eb45={'raw':!![],'where':{'id':_0x531918[_0x947b('0x46')]['id']}},_0x363a24={};_0x363a24[_0x947b('0x31')]=_[_0x947b('0x47')](db[_0x947b('0x42')][_0x947b('0x2e')]);_0x363a24['query']=_['keys'](_0x531918[_0x947b('0x33')]);_0x363a24[_0x947b('0x34')]=_[_0x947b('0x35')](_0x363a24['model'],_0x363a24[_0x947b('0x33')]);_0x49eb45[_0x947b('0x36')]=_[_0x947b('0x35')](_0x363a24['model'],qs[_0x947b('0x37')](_0x531918[_0x947b('0x33')][_0x947b('0x37')]));_0x49eb45[_0x947b('0x36')]=_0x49eb45[_0x947b('0x36')][_0x947b('0x38')]?_0x49eb45[_0x947b('0x36')]:_0x363a24[_0x947b('0x31')];if(_0x531918[_0x947b('0x33')]['includeAll']){_0x49eb45['include']=[{'all':!![]}];}_0x49eb45=_['merge']({},_0x49eb45,_0x531918[_0x947b('0x41')]);return db[_0x947b('0x42')]['find'](_0x49eb45)['then'](handleEntityNotFound(_0x14697e,null))[_0x947b('0x24')](respondWithResult(_0x14697e,null))['catch'](handleError(_0x14697e,null));};exports[_0x947b('0x48')]=function(_0x492280,_0x4d8d4d){return db[_0x947b('0x42')]['create'](_0x492280['body'],{})[_0x947b('0x24')](function(_0x285f5b){var _0x375917=_0x492280[_0x947b('0x49')][_0x947b('0x26')]({'plain':!![]});if(!_0x375917)throw new Error(_0x947b('0x4a'));if(_0x375917[_0x947b('0x4b')]===_0x947b('0x49')){var _0x4b84dd=_0x285f5b[_0x947b('0x26')]({'plain':!![]});var _0x3398e3=_0x947b('0x4c');return db[_0x947b('0x4d')][_0x947b('0x4e')]({'where':{'name':_0x3398e3,'userProfileId':_0x375917[_0x947b('0x4f')]},'raw':!![]})[_0x947b('0x24')](function(_0x49e963){if(_0x49e963&&_0x49e963['autoAssociation']===0x0){return db[_0x947b('0x27')][_0x947b('0x48')]({'name':_0x4b84dd[_0x947b('0x2b')],'resourceId':_0x4b84dd['id'],'type':_0x49e963['name'],'sectionId':_0x49e963['id']},{})[_0x947b('0x24')](function(){return _0x285f5b;});}else{return _0x285f5b;}})[_0x947b('0x50')](function(_0x26d8bd){logger[_0x947b('0x29')](_0x947b('0x51'),_0x26d8bd);throw _0x26d8bd;});}return _0x285f5b;})[_0x947b('0x24')](respondWithResult(_0x4d8d4d,0xc9))[_0x947b('0x50')](handleError(_0x4d8d4d,null));};exports[_0x947b('0x23')]=function(_0x2bbd82,_0x18195a){if(_0x2bbd82[_0x947b('0x52')]['id']){delete _0x2bbd82[_0x947b('0x52')]['id'];}return db[_0x947b('0x42')][_0x947b('0x4e')]({'where':{'id':_0x2bbd82[_0x947b('0x46')]['id']}})[_0x947b('0x24')](handleEntityNotFound(_0x18195a,null))['then'](saveUpdates(_0x2bbd82[_0x947b('0x52')],null))[_0x947b('0x24')](respondWithResult(_0x18195a,null))['catch'](handleError(_0x18195a,null));};exports[_0x947b('0x25')]=function(_0x3f287f,_0x478dc3){return db['Variable']['find']({'where':{'id':_0x3f287f['params']['id']}})[_0x947b('0x24')](handleEntityNotFound(_0x478dc3,null))[_0x947b('0x24')](removeEntity(_0x478dc3,null))['catch'](handleError(_0x478dc3,null));}; \ No newline at end of file diff --git a/server/api/variable/variable.model.js b/server/api/variable/variable.model.js index 93fd345..1a491ca 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 _0xc1bc=['rimraf','../../config/environment','./variable.attributes','define','tools_variables','util','api','bluebird','request-promise','path'];(function(_0x44df77,_0x525b17){var _0x5c9462=function(_0x45b8d4){while(--_0x45b8d4){_0x44df77['push'](_0x44df77['shift']());}};_0x5c9462(++_0x525b17);}(_0xc1bc,0xff));var _0xcc1b=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xc1bc[_0x2dafbe];return _0x58a45a;};'use strict';var _=require('lodash');var util=require(_0xcc1b('0x0'));var logger=require('../../config/logger')(_0xcc1b('0x1'));var moment=require('moment');var BPromise=require(_0xcc1b('0x2'));var rp=require(_0xcc1b('0x3'));var fs=require('fs');var path=require(_0xcc1b('0x4'));var rimraf=require(_0xcc1b('0x5'));var config=require(_0xcc1b('0x6'));var attributes=require(_0xcc1b('0x7'));module['exports']=function(_0x1234a1,_0x4a8842){return _0x1234a1[_0xcc1b('0x8')]('Variable',attributes,{'tableName':_0xcc1b('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x15b3=['bluebird','request-promise','path','rimraf','../../config/environment','./variable.attributes','exports','define','Variable','../../config/logger','api','moment'];(function(_0x39017c,_0x15f210){var _0x584624=function(_0x48afe4){while(--_0x48afe4){_0x39017c['push'](_0x39017c['shift']());}};_0x584624(++_0x15f210);}(_0x15b3,0x81));var _0x315b=function(_0x436b34,_0x35d237){_0x436b34=_0x436b34-0x0;var _0x409f6b=_0x15b3[_0x436b34];return _0x409f6b;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x315b('0x0'))(_0x315b('0x1'));var moment=require(_0x315b('0x2'));var BPromise=require(_0x315b('0x3'));var rp=require(_0x315b('0x4'));var fs=require('fs');var path=require(_0x315b('0x5'));var rimraf=require(_0x315b('0x6'));var config=require(_0x315b('0x7'));var attributes=require(_0x315b('0x8'));module[_0x315b('0x9')]=function(_0x2b2ede,_0xa2fd82){return _0x2b2ede[_0x315b('0xa')](_0x315b('0xb'),attributes,{'tableName':'tools_variables','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 8ac36e2..42164b8 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 _0x8ef6=['result','catch','Variable','find','options','raw','include','model','attributes','map','ShowVariable','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','Variable,\x20%s,\x20%s','request\x20sent','debug','Variable,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x39979b,_0x2111f9){var _0x560b41=function(_0x859cc0){while(--_0x859cc0){_0x39979b['push'](_0x39979b['shift']());}};_0x560b41(++_0x2111f9);}(_0x8ef6,0xf2));var _0x68ef=function(_0x5d4a4f,_0x1ac5c0){_0x5d4a4f=_0x5d4a4f-0x0;var _0x2eff7a=_0x8ef6[_0x5d4a4f];return _0x2eff7a;};'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')]('Variable,\x20%s,\x20%s',_0x4740e8,_0x68ef('0xf'));_0x4eb5eb(_0x22ae26[_0x68ef('0x16')][_0x68ef('0x15')]);}})[_0x68ef('0x17')](function(_0x5c4456){logger[_0x68ef('0x13')]('Variable,\x20%s,\x20%s',_0x4740e8,_0x5c4456);_0x228967(_0x5c4456);});});}exports['ShowVariable']=function(_0x2633c1){var _0x404870=this;return new Promise(function(_0x4ade0d,_0x527870){return db[_0x68ef('0x18')][_0x68ef('0x19')]({'raw':_0x2633c1[_0x68ef('0x1a')]?_0x2633c1['options'][_0x68ef('0x1b')]===undefined?!![]:![]:!![],'where':_0x2633c1[_0x68ef('0x1a')]?_0x2633c1[_0x68ef('0x1a')]['where']||null:null,'attributes':_0x2633c1[_0x68ef('0x1a')]?_0x2633c1[_0x68ef('0x1a')]['attributes']||null:null,'include':_0x2633c1[_0x68ef('0x1a')]?_0x2633c1[_0x68ef('0x1a')][_0x68ef('0x1c')]?_['map'](_0x2633c1['options']['include'],function(_0x26018d){return{'model':db[_0x26018d[_0x68ef('0x1d')]],'as':_0x26018d['as'],'attributes':_0x26018d[_0x68ef('0x1e')],'include':_0x26018d[_0x68ef('0x1c')]?_[_0x68ef('0x1f')](_0x26018d[_0x68ef('0x1c')],function(_0x258cd5){return{'model':db[_0x258cd5[_0x68ef('0x1d')]],'as':_0x258cd5['as'],'attributes':_0x258cd5[_0x68ef('0x1e')],'include':_0x258cd5[_0x68ef('0x1c')]?_['map'](_0x258cd5[_0x68ef('0x1c')],function(_0x57f9ee){return{'model':db[_0x57f9ee['model']],'as':_0x57f9ee['as'],'attributes':_0x57f9ee['attributes']};}):[]};}):[]};}):[]:[]})[_0x68ef('0xc')](function(_0x268f32){logger[_0x68ef('0xd')](_0x68ef('0x20'),_0x2633c1);logger['debug']('ShowVariable',_0x2633c1,JSON[_0x68ef('0x12')](_0x268f32));_0x4ade0d(_0x268f32);})[_0x68ef('0x17')](function(_0x7bf96){logger[_0x68ef('0x13')](_0x68ef('0x20'),_0x7bf96[_0x68ef('0x15')],_0x2633c1);_0x527870(_0x404870[_0x68ef('0x13')](0x1f4,_0x7bf96[_0x68ef('0x15')]));});});}; \ No newline at end of file +var _0xe14b=['ioredis','../../config/utils','../../config/environment','jayson/promise','client','http','then','info','Variable,\x20%s,\x20%s','Variable,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','ShowVariable','Variable','find','options','raw','where','attributes','map','include','model','stringify','lodash','util','randomstring'];(function(_0x3408b2,_0x41cee5){var _0x244f81=function(_0x4d7e51){while(--_0x4d7e51){_0x3408b2['push'](_0x3408b2['shift']());}};_0x244f81(++_0x41cee5);}(_0xe14b,0x93));var _0xbe14=function(_0x2cd832,_0x6a0705){_0x2cd832=_0x2cd832-0x0;var _0x4f052e=_0xe14b[_0x2cd832];return _0x4f052e;};'use strict';var _=require(_0xbe14('0x0'));var util=require(_0xbe14('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xbe14('0x2'));var fs=require('fs');var Redis=require(_0xbe14('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xbe14('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0xbe14('0x5'));var jayson=require(_0xbe14('0x6'));var client=jayson[_0xbe14('0x7')][_0xbe14('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1d9ade,_0x39387e,_0x196fca){return new BPromise(function(_0x566ae7,_0x50f909){return client['request'](_0x1d9ade,_0x196fca)[_0xbe14('0x9')](function(_0x6fceff){logger[_0xbe14('0xa')](_0xbe14('0xb'),_0x39387e,'request\x20sent');logger['debug'](_0xbe14('0xc'),_0x39387e,_0xbe14('0xd'),JSON['stringify'](_0x6fceff));if(_0x6fceff[_0xbe14('0xe')]){if(_0x6fceff[_0xbe14('0xe')][_0xbe14('0xf')]===0x1f4){logger[_0xbe14('0xe')](_0xbe14('0xb'),_0x39387e,_0x6fceff[_0xbe14('0xe')][_0xbe14('0x10')]);return _0x50f909(_0x6fceff[_0xbe14('0xe')][_0xbe14('0x10')]);}logger[_0xbe14('0xe')](_0xbe14('0xb'),_0x39387e,_0x6fceff[_0xbe14('0xe')][_0xbe14('0x10')]);return _0x566ae7(_0x6fceff['error']['message']);}else{logger[_0xbe14('0xa')](_0xbe14('0xb'),_0x39387e,_0xbe14('0xd'));_0x566ae7(_0x6fceff[_0xbe14('0x11')]['message']);}})[_0xbe14('0x12')](function(_0xe9c3ec){logger[_0xbe14('0xe')](_0xbe14('0xb'),_0x39387e,_0xe9c3ec);_0x50f909(_0xe9c3ec);});});}exports[_0xbe14('0x13')]=function(_0x29ab73){var _0x17ae86=this;return new Promise(function(_0x5ea1f8,_0x137ee5){return db[_0xbe14('0x14')][_0xbe14('0x15')]({'raw':_0x29ab73[_0xbe14('0x16')]?_0x29ab73[_0xbe14('0x16')][_0xbe14('0x17')]===undefined?!![]:![]:!![],'where':_0x29ab73['options']?_0x29ab73[_0xbe14('0x16')][_0xbe14('0x18')]||null:null,'attributes':_0x29ab73[_0xbe14('0x16')]?_0x29ab73[_0xbe14('0x16')][_0xbe14('0x19')]||null:null,'include':_0x29ab73['options']?_0x29ab73[_0xbe14('0x16')]['include']?_[_0xbe14('0x1a')](_0x29ab73['options'][_0xbe14('0x1b')],function(_0x4a25fa){return{'model':db[_0x4a25fa[_0xbe14('0x1c')]],'as':_0x4a25fa['as'],'attributes':_0x4a25fa[_0xbe14('0x19')],'include':_0x4a25fa['include']?_[_0xbe14('0x1a')](_0x4a25fa['include'],function(_0x4587a8){return{'model':db[_0x4587a8['model']],'as':_0x4587a8['as'],'attributes':_0x4587a8[_0xbe14('0x19')],'include':_0x4587a8[_0xbe14('0x1b')]?_[_0xbe14('0x1a')](_0x4587a8[_0xbe14('0x1b')],function(_0x15ef02){return{'model':db[_0x15ef02[_0xbe14('0x1c')]],'as':_0x15ef02['as'],'attributes':_0x15ef02['attributes']};}):[]};}):[]};}):[]:[]})[_0xbe14('0x9')](function(_0x1ba46a){logger[_0xbe14('0xa')](_0xbe14('0x13'),_0x29ab73);logger['debug'](_0xbe14('0x13'),_0x29ab73,JSON[_0xbe14('0x1d')](_0x1ba46a));_0x5ea1f8(_0x1ba46a);})['catch'](function(_0x3c3613){logger[_0xbe14('0xe')](_0xbe14('0x13'),_0x3c3613[_0xbe14('0x10')],_0x29ab73);_0x137ee5(_0x17ae86[_0xbe14('0xe')](0x1f4,_0x3c3613[_0xbe14('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/version/index.js b/server/api/version/index.js index 858e4f5..90a2070 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 _0xb5f9=['get','/fetch','isAuthenticated','canUpdate','fetch','/reset','/restart','restart','/migrations','migrations','../../components/auth/service'];(function(_0x198faf,_0x283d0b){var _0x13c210=function(_0x3a098b){while(--_0x3a098b){_0x198faf['push'](_0x198faf['shift']());}};_0x13c210(++_0x283d0b);}(_0xb5f9,0x1c2));var _0x9b5f=function(_0x25acc5,_0x4e5cdb){_0x25acc5=_0x25acc5-0x0;var _0x57e9f5=_0xb5f9[_0x25acc5];return _0x57e9f5;};'use strict';var express=require('express');var router=express['Router']();var auth=require(_0x9b5f('0x0'));var controller=require('./version.controller');router[_0x9b5f('0x1')]('/',controller['index']);router[_0x9b5f('0x1')](_0x9b5f('0x2'),auth[_0x9b5f('0x3')](),auth[_0x9b5f('0x4')](),controller[_0x9b5f('0x5')]);router[_0x9b5f('0x1')](_0x9b5f('0x6'),auth[_0x9b5f('0x3')](),auth[_0x9b5f('0x4')](),controller['reset']);router[_0x9b5f('0x1')]('/pull',auth[_0x9b5f('0x3')](),auth['canUpdate'](),controller['pull']);router[_0x9b5f('0x1')](_0x9b5f('0x7'),auth['isAuthenticated'](),controller[_0x9b5f('0x8')]);router['get'](_0x9b5f('0x9'),controller[_0x9b5f('0xa')]);module['exports']=router; \ No newline at end of file +var _0x3f9e=['exports','express','Router','../../components/auth/service','./version.controller','index','get','/fetch','isAuthenticated','canUpdate','fetch','reset','/pull','pull','/restart','restart','/migrations','migrations'];(function(_0x2c5744,_0x5ccf85){var _0x4ebbf6=function(_0x1835ff){while(--_0x1835ff){_0x2c5744['push'](_0x2c5744['shift']());}};_0x4ebbf6(++_0x5ccf85);}(_0x3f9e,0x19f));var _0xe3f9=function(_0x419fa1,_0x580e54){_0x419fa1=_0x419fa1-0x0;var _0x3f5ebf=_0x3f9e[_0x419fa1];return _0x3f5ebf;};'use strict';var express=require(_0xe3f9('0x0'));var router=express[_0xe3f9('0x1')]();var auth=require(_0xe3f9('0x2'));var controller=require(_0xe3f9('0x3'));router['get']('/',controller[_0xe3f9('0x4')]);router[_0xe3f9('0x5')](_0xe3f9('0x6'),auth[_0xe3f9('0x7')](),auth[_0xe3f9('0x8')](),controller[_0xe3f9('0x9')]);router[_0xe3f9('0x5')]('/reset',auth[_0xe3f9('0x7')](),auth[_0xe3f9('0x8')](),controller[_0xe3f9('0xa')]);router[_0xe3f9('0x5')](_0xe3f9('0xb'),auth['isAuthenticated'](),auth[_0xe3f9('0x8')](),controller[_0xe3f9('0xc')]);router[_0xe3f9('0x5')](_0xe3f9('0xd'),auth['isAuthenticated'](),controller[_0xe3f9('0xe')]);router[_0xe3f9('0x5')](_0xe3f9('0xf'),controller[_0xe3f9('0x10')]);module[_0xe3f9('0x11')]=router; \ No newline at end of file diff --git a/server/api/version/version.controller.js b/server/api/version/version.controller.js index ca5ee95..0c2bbc9 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 _0xd7fe=['\x20to\x20','last','UniqueConstraintError','Database\x20already\x20up-to-date','umzug','path','pkginfo','version','compare-versions','exec','../../mysqldb','../../config/environment','../../config/pm2','../../config/logger','root','query','tags','latest','exports','json','status','fetch','origin','master','error','git\x20fetch','git\x20fetch\x20origin\x20master','reset','--hard','info','git\x20reset\x20--hard\x20FETCH_HEAD','git\x20reset\x20--hard','pull','npm\x20install\x20--production','restart','then','pm2\x20restart\x20motion\x20%s','Your\x20system\x20has\x20been\x20restart\x20successfully','catch','migrations','readdirSync','length','.js','push','sort','sequelize','Migration','getQueryInterface','Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.','server','Database\x20migrated\x20successfully\x20from\x20version\x20'];(function(_0x28c91e,_0x51ea45){var _0x892800=function(_0x1f40fb){while(--_0x1f40fb){_0x28c91e['push'](_0x28c91e['shift']());}};_0x892800(++_0x51ea45);}(_0xd7fe,0x6a));var _0xed7f=function(_0x3a491c,_0x1c5f21){_0x3a491c=_0x3a491c-0x0;var _0xd3dccc=_0xd7fe[_0x3a491c];return _0xd3dccc;};'use strict';var Umzug=require(_0xed7f('0x0'));var path=require(_0xed7f('0x1'));var fs=require('fs');var _=require('lodash');var pkginfo=require(_0xed7f('0x2'))(module,_0xed7f('0x3'));var compareVersions=require(_0xed7f('0x4'));var exec=require('child_process')[_0xed7f('0x5')];var db=require(_0xed7f('0x6'))['db'];var config=require(_0xed7f('0x7'));var pm2=require(_0xed7f('0x8'));var logger=require(_0xed7f('0x9'))('update');var git=require('simple-git')(config[_0xed7f('0xa')]);exports['index']=function(_0x491fe3,_0x205d76){var _0x5d9295={'current':module['exports'][_0xed7f('0x3')],'phonebar':0x2};if(_0x491fe3[_0xed7f('0xb')]&&_0x491fe3['query']['latest']){return git['fetch']()[_0xed7f('0xc')](function(_0x2a1991,_0x4d76fe){_0x5d9295[_0xed7f('0xd')]=(_0x2a1991?module[_0xed7f('0xe')][_0xed7f('0x3')]:_0x4d76fe[_0xed7f('0xd')])||'2.0.0';return _0x205d76['status'](0xc8)[_0xed7f('0xf')](_0x5d9295);});}else{return _0x205d76[_0xed7f('0x10')](0xc8)[_0xed7f('0xf')](_0x5d9295);}};exports[_0xed7f('0x11')]=function(_0x258712,_0x3d302b){return git[_0xed7f('0x11')]([_0xed7f('0x12'),_0xed7f('0x13')],function(_0x1976f0){if(_0x1976f0){logger[_0xed7f('0x14')](_0x1976f0);return _0x3d302b[_0xed7f('0x10')](0x1f4)[_0xed7f('0xf')](_0x1976f0);}logger['info'](_0xed7f('0x15'));return _0x3d302b[_0xed7f('0x10')](0xc8)[_0xed7f('0xf')]({'output':_0xed7f('0x16')});});};exports[_0xed7f('0x17')]=function(_0x3bf648,_0x7471ec){return git[_0xed7f('0x17')]([_0xed7f('0x18'),'FETCH_HEAD'],function(_0x2025a3){if(_0x2025a3){logger[_0xed7f('0x14')](_0x2025a3);return _0x7471ec[_0xed7f('0x10')](0x1f4)['json'](_0x2025a3);}logger[_0xed7f('0x19')](_0xed7f('0x1a'));return _0x7471ec[_0xed7f('0x10')](0xc8)[_0xed7f('0xf')]({'output':_0xed7f('0x1b')});});};exports[_0xed7f('0x1c')]=function(_0x4c52ae,_0x9dd204){exec(_0xed7f('0x1d'),function(_0x224da2,_0x545d45,_0x3bc03d){logger['info'](_0x545d45);logger[_0xed7f('0x19')](_0x3bc03d);if(_0x224da2){logger[_0xed7f('0x14')](_0x224da2);return _0x9dd204['status'](0x1f4)[_0xed7f('0xf')](_0x224da2);}return _0x9dd204[_0xed7f('0x10')](0xc8)[_0xed7f('0xf')]({'output':_0x545d45});});};exports[_0xed7f('0x1e')]=function(_0x5b591d,_0x35b493){return pm2[_0xed7f('0x1e')]('motion2')[_0xed7f('0x1f')](function(_0x52f7aa){logger[_0xed7f('0x19')](_0xed7f('0x20'),_0x52f7aa);return _0x35b493[_0xed7f('0x10')](0xc8)['json']({'output':_0xed7f('0x21')});})[_0xed7f('0x22')](function(_0x3059af){logger['error'](_0x3059af);return _0x35b493['status'](0x1f4)['json'](_0x3059af);});};exports[_0xed7f('0x23')]=function(_0x2e4101,_0x2d04b3){var _0x178864=fs[_0xed7f('0x24')](path['join'](config['root'],'server',_0xed7f('0x23')));var _0x180867=[];for(var _0x5794d7=0x0;_0x5794d7<_0x178864[_0xed7f('0x25')];_0x5794d7++){var _0x30c6ef=_0x178864[_0x5794d7]['replace'](_0xed7f('0x26'),'');if(compareVersions(module[_0xed7f('0xe')]['version'],_0x30c6ef)===-0x1){_0x180867[_0xed7f('0x27')](_0x30c6ef);}}if(_0x180867[_0xed7f('0x25')]){var _0x328fe8=_0x180867[_0xed7f('0x28')](compareVersions);var _0x458ce2=new Umzug({'storage':_0xed7f('0x29'),'storageOptions':{'model':db['Migration'],'modelName':_0xed7f('0x2a'),'columnName':_0xed7f('0x3')},'migrations':{'params':[db[_0xed7f('0x29')][_0xed7f('0x2b')](),db[_0xed7f('0x29')]['constructor'],function(){throw new Error(_0xed7f('0x2c'));}],'path':path['join'](config[_0xed7f('0xa')],_0xed7f('0x2d'),_0xed7f('0x23')),'pattern':/\.js$/}});_0x458ce2['up']({'migrations':_['map'](_0x328fe8,function(_0x410224){return _0x410224+_0xed7f('0x26');})})[_0xed7f('0x1f')](function(){return _0x2d04b3[_0xed7f('0x10')](0xc8)[_0xed7f('0xf')]({'output':_0xed7f('0x2e')+module[_0xed7f('0xe')][_0xed7f('0x3')]+_0xed7f('0x2f')+_[_0xed7f('0x30')](_0x328fe8),'migrations':_['join'](_0x328fe8)});})[_0xed7f('0x22')](function(_0x5f3ae1){if(_0x5f3ae1 instanceof db[_0xed7f('0x29')][_0xed7f('0x31')]){return _0x2d04b3['status'](0xc8)[_0xed7f('0xf')]({'output':_0xed7f('0x32')});}else{return _0x2d04b3[_0xed7f('0x10')](0x1f4)['json'](_0x5f3ae1);}});}else{return _0x2d04b3[_0xed7f('0x10')](0xc8)[_0xed7f('0xf')]({'output':_0xed7f('0x32')});}}; \ No newline at end of file +var _0xbb0e=['pull','npm\x20install\x20--production','restart','motion2','Your\x20system\x20has\x20been\x20restart\x20successfully','catch','join','server','length','replace','push','sort','sequelize','Migration','getQueryInterface','migrations','map','Database\x20migrated\x20successfully\x20from\x20version\x20','\x20to\x20','UniqueConstraintError','Database\x20already\x20up-to-date','umzug','path','lodash','pkginfo','version','child_process','../../mysqldb','../../config/environment','../../config/pm2','../../config/logger','simple-git','root','index','exports','query','fetch','tags','latest','2.0.0','status','json','error','info','git\x20fetch','git\x20fetch\x20origin\x20master','reset','--hard','FETCH_HEAD','git\x20reset\x20--hard\x20FETCH_HEAD','git\x20reset\x20--hard'];(function(_0x45f951,_0x2750c8){var _0x24756c=function(_0x31c931){while(--_0x31c931){_0x45f951['push'](_0x45f951['shift']());}};_0x24756c(++_0x2750c8);}(_0xbb0e,0xe1));var _0xebb0=function(_0x3012b8,_0x73547b){_0x3012b8=_0x3012b8-0x0;var _0x2c02f3=_0xbb0e[_0x3012b8];return _0x2c02f3;};'use strict';var Umzug=require(_0xebb0('0x0'));var path=require(_0xebb0('0x1'));var fs=require('fs');var _=require(_0xebb0('0x2'));var pkginfo=require(_0xebb0('0x3'))(module,_0xebb0('0x4'));var compareVersions=require('compare-versions');var exec=require(_0xebb0('0x5'))['exec'];var db=require(_0xebb0('0x6'))['db'];var config=require(_0xebb0('0x7'));var pm2=require(_0xebb0('0x8'));var logger=require(_0xebb0('0x9'))('update');var git=require(_0xebb0('0xa'))(config[_0xebb0('0xb')]);exports[_0xebb0('0xc')]=function(_0x3f36a0,_0x5d5682){var _0x502f35={'current':module[_0xebb0('0xd')][_0xebb0('0x4')],'phonebar':0x2};if(_0x3f36a0[_0xebb0('0xe')]&&_0x3f36a0[_0xebb0('0xe')]['latest']){return git[_0xebb0('0xf')]()[_0xebb0('0x10')](function(_0x92cd5f,_0x407a2a){_0x502f35[_0xebb0('0x11')]=(_0x92cd5f?module[_0xebb0('0xd')][_0xebb0('0x4')]:_0x407a2a[_0xebb0('0x11')])||_0xebb0('0x12');return _0x5d5682[_0xebb0('0x13')](0xc8)[_0xebb0('0x14')](_0x502f35);});}else{return _0x5d5682[_0xebb0('0x13')](0xc8)[_0xebb0('0x14')](_0x502f35);}};exports['fetch']=function(_0x3c26a3,_0x158149){return git[_0xebb0('0xf')](['origin','master'],function(_0x2c5d3e){if(_0x2c5d3e){logger[_0xebb0('0x15')](_0x2c5d3e);return _0x158149['status'](0x1f4)['json'](_0x2c5d3e);}logger[_0xebb0('0x16')](_0xebb0('0x17'));return _0x158149['status'](0xc8)[_0xebb0('0x14')]({'output':_0xebb0('0x18')});});};exports[_0xebb0('0x19')]=function(_0x192e91,_0x2ebc13){return git['reset']([_0xebb0('0x1a'),_0xebb0('0x1b')],function(_0x123161){if(_0x123161){logger[_0xebb0('0x15')](_0x123161);return _0x2ebc13[_0xebb0('0x13')](0x1f4)[_0xebb0('0x14')](_0x123161);}logger[_0xebb0('0x16')](_0xebb0('0x1c'));return _0x2ebc13[_0xebb0('0x13')](0xc8)[_0xebb0('0x14')]({'output':_0xebb0('0x1d')});});};exports[_0xebb0('0x1e')]=function(_0x9e9b33,_0x374f64){exec(_0xebb0('0x1f'),function(_0x56ca74,_0x17f144,_0xd5091d){logger[_0xebb0('0x16')](_0x17f144);logger[_0xebb0('0x16')](_0xd5091d);if(_0x56ca74){logger[_0xebb0('0x15')](_0x56ca74);return _0x374f64[_0xebb0('0x13')](0x1f4)[_0xebb0('0x14')](_0x56ca74);}return _0x374f64[_0xebb0('0x13')](0xc8)['json']({'output':_0x17f144});});};exports[_0xebb0('0x20')]=function(_0x260f1d,_0x34da37){return pm2[_0xebb0('0x20')](_0xebb0('0x21'))['then'](function(_0x18fed9){logger[_0xebb0('0x16')]('pm2\x20restart\x20motion\x20%s',_0x18fed9);return _0x34da37[_0xebb0('0x13')](0xc8)[_0xebb0('0x14')]({'output':_0xebb0('0x22')});})[_0xebb0('0x23')](function(_0x2fb917){logger[_0xebb0('0x15')](_0x2fb917);return _0x34da37[_0xebb0('0x13')](0x1f4)[_0xebb0('0x14')](_0x2fb917);});};exports['migrations']=function(_0x20b8d3,_0x848df0){var _0x2cf082=fs['readdirSync'](path[_0xebb0('0x24')](config[_0xebb0('0xb')],_0xebb0('0x25'),'migrations'));var _0x417069=[];for(var _0x2769f6=0x0;_0x2769f6<_0x2cf082[_0xebb0('0x26')];_0x2769f6++){var _0x21cbc2=_0x2cf082[_0x2769f6][_0xebb0('0x27')]('.js','');if(compareVersions(module[_0xebb0('0xd')][_0xebb0('0x4')],_0x21cbc2)===-0x1){_0x417069[_0xebb0('0x28')](_0x21cbc2);}}if(_0x417069[_0xebb0('0x26')]){var _0x549862=_0x417069[_0xebb0('0x29')](compareVersions);var _0x120918=new Umzug({'storage':_0xebb0('0x2a'),'storageOptions':{'model':db['Migration'],'modelName':_0xebb0('0x2b'),'columnName':_0xebb0('0x4')},'migrations':{'params':[db[_0xebb0('0x2a')][_0xebb0('0x2c')](),db[_0xebb0('0x2a')]['constructor'],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[_0xebb0('0x24')](config[_0xebb0('0xb')],_0xebb0('0x25'),_0xebb0('0x2d')),'pattern':/\.js$/}});_0x120918['up']({'migrations':_[_0xebb0('0x2e')](_0x549862,function(_0x278fa7){return _0x278fa7+'.js';})})['then'](function(){return _0x848df0[_0xebb0('0x13')](0xc8)[_0xebb0('0x14')]({'output':_0xebb0('0x2f')+module[_0xebb0('0xd')][_0xebb0('0x4')]+_0xebb0('0x30')+_['last'](_0x549862),'migrations':_[_0xebb0('0x24')](_0x549862)});})['catch'](function(_0x3f53da){if(_0x3f53da instanceof db[_0xebb0('0x2a')][_0xebb0('0x31')]){return _0x848df0['status'](0xc8)[_0xebb0('0x14')]({'output':_0xebb0('0x32')});}else{return _0x848df0[_0xebb0('0x13')](0x1f4)['json'](_0x3f53da);}});}else{return _0x848df0[_0xebb0('0x13')](0xc8)[_0xebb0('0x14')]({'output':_0xebb0('0x32')});}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/index.js b/server/api/voiceAgentReport/index.js index 019a789..823b33f 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 _0x46dd=['exports','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./voiceAgentReport.controller','get','isAuthenticated','index','/describe','describe','show','create','/:id','destroy'];(function(_0x4f2c6a,_0x5ee4f0){var _0x176d06=function(_0x2e151a){while(--_0x2e151a){_0x4f2c6a['push'](_0x4f2c6a['shift']());}};_0x176d06(++_0x5ee4f0);}(_0x46dd,0x169));var _0xd46d=function(_0x1a89a1,_0x56d889){_0x1a89a1=_0x1a89a1-0x0;var _0x3d5b46=_0x46dd[_0x1a89a1];return _0x3d5b46;};'use strict';var multer=require(_0xd46d('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xd46d('0x1'));var express=require(_0xd46d('0x2'));var router=express[_0xd46d('0x3')]();var fs_extra=require(_0xd46d('0x4'));var auth=require(_0xd46d('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xd46d('0x6'));var controller=require(_0xd46d('0x7'));router[_0xd46d('0x8')]('/',auth[_0xd46d('0x9')](),controller[_0xd46d('0xa')]);router[_0xd46d('0x8')](_0xd46d('0xb'),auth[_0xd46d('0x9')](),controller[_0xd46d('0xc')]);router[_0xd46d('0x8')]('/:id',auth[_0xd46d('0x9')](),controller[_0xd46d('0xd')]);router['post']('/',auth['isAuthenticated'](),controller[_0xd46d('0xe')]);router['put'](_0xd46d('0xf'),auth[_0xd46d('0x9')](),controller['update']);router['delete'](_0xd46d('0xf'),auth[_0xd46d('0x9')](),controller[_0xd46d('0x10')]);module[_0xd46d('0x11')]=router; \ No newline at end of file +var _0x4098=['./voiceAgentReport.controller','get','isAuthenticated','index','/describe','describe','show','post','put','/:id','update','delete','destroy','multer','Router','fs-extra','../../components/auth/service','../../config/environment'];(function(_0x3ccd24,_0x4994e6){var _0x1aad39=function(_0x3f66c7){while(--_0x3f66c7){_0x3ccd24['push'](_0x3ccd24['shift']());}};_0x1aad39(++_0x4994e6);}(_0x4098,0xe5));var _0x8409=function(_0x3505b2,_0x1a9bc2){_0x3505b2=_0x3505b2-0x0;var _0x5af888=_0x4098[_0x3505b2];return _0x5af888;};'use strict';var multer=require(_0x8409('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x8409('0x1')]();var fs_extra=require(_0x8409('0x2'));var auth=require(_0x8409('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x8409('0x4'));var controller=require(_0x8409('0x5'));router[_0x8409('0x6')]('/',auth[_0x8409('0x7')](),controller[_0x8409('0x8')]);router[_0x8409('0x6')](_0x8409('0x9'),auth[_0x8409('0x7')](),controller[_0x8409('0xa')]);router[_0x8409('0x6')]('/:id',auth[_0x8409('0x7')](),controller[_0x8409('0xb')]);router[_0x8409('0xc')]('/',auth[_0x8409('0x7')](),controller['create']);router[_0x8409('0xd')](_0x8409('0xe'),auth[_0x8409('0x7')](),controller[_0x8409('0xf')]);router[_0x8409('0x10')]('/:id',auth[_0x8409('0x7')](),controller[_0x8409('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.attributes.js b/server/api/voiceAgentReport/voiceAgentReport.attributes.js index 3a28954..ad55c4e 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 _0x160f=['STRING','DATE','BOOLEAN','INTEGER','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','exports'];(function(_0x725a4c,_0x102507){var _0x37b2cc=function(_0x505fc9){while(--_0x505fc9){_0x725a4c['push'](_0x725a4c['shift']());}};_0x37b2cc(++_0x102507);}(_0x160f,0x1ef));var _0xf160=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x160f[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xf160('0x0'));module[_0xf160('0x1')]={'type':{'type':Sequelize[_0xf160('0x2')]},'uniqueid':{'type':Sequelize[_0xf160('0x2')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0xf160('0x2')]},'queue':{'type':Sequelize[_0xf160('0x2')]},'interface':{'type':Sequelize[_0xf160('0x2')]},'membername':{'type':Sequelize[_0xf160('0x2')]},'agentcalledAt':{'type':Sequelize[_0xf160('0x3')]},'agentconnectAt':{'type':Sequelize[_0xf160('0x3')]},'agentcompleteAt':{'type':Sequelize['DATE']},'agentringnoanswerAt':{'type':Sequelize[_0xf160('0x3')]},'agentdumpAt':{'type':Sequelize[_0xf160('0x3')]},'holdtime':{'type':Sequelize['INTEGER']},'agentcomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0xf160('0x4')],'defaultValue':![]},'agentdump':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'talktime':{'type':Sequelize['INTEGER']},'agentacw':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'acwtime':{'type':Sequelize[_0xf160('0x5')]},'reason':{'type':Sequelize[_0xf160('0x2')]},'lastevent':{'type':Sequelize[_0xf160('0x2')]},'channel':{'type':Sequelize[_0xf160('0x2')]},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0xf160('0x2')]},'connectedlinename':{'type':Sequelize[_0xf160('0x2')]},'language':{'type':Sequelize[_0xf160('0x2')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0xf160('0x2')]},'exten':{'type':Sequelize[_0xf160('0x2')]},'priority':{'type':Sequelize[_0xf160('0x2')]},'destchannel':{'type':Sequelize[_0xf160('0x2')]},'destchannelstate':{'type':Sequelize[_0xf160('0x5')]},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize[_0xf160('0x2')]},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0xf160('0x2')]},'destconnectedlinename':{'type':Sequelize[_0xf160('0x2')]},'destlanguage':{'type':Sequelize[_0xf160('0x2')]},'destaccountcode':{'type':Sequelize[_0xf160('0x2')]},'destcontext':{'type':Sequelize[_0xf160('0x2')]},'destexten':{'type':Sequelize[_0xf160('0x2')]},'destpriority':{'type':Sequelize[_0xf160('0x2')]},'destuniqueid':{'type':Sequelize[_0xf160('0x2')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0xf160('0x2')]},'answeredelsewheremembername':{'type':Sequelize['STRING']},'transfer':{'type':Sequelize[_0xf160('0x4')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0xf160('0x2')],'comment':_0xf160('0x6')},'transferexten':{'type':Sequelize[_0xf160('0x2')]},'transferuniqueid':{'type':Sequelize['STRING']},'agententerreason':{'type':Sequelize[_0xf160('0x5')],'defaultValue':0x0}}; \ No newline at end of file +var _0x8227=['BOOLEAN','FORWARD,\x20BLIND,\x20ATTENDED','exports','STRING','DATE','INTEGER'];(function(_0x5d4607,_0x6b5e7b){var _0x5e4a86=function(_0x46891a){while(--_0x46891a){_0x5d4607['push'](_0x5d4607['shift']());}};_0x5e4a86(++_0x6b5e7b);}(_0x8227,0x146));var _0x7822=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x8227[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require('sequelize');module[_0x7822('0x0')]={'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x7822('0x1')]},'calleridnum':{'type':Sequelize[_0x7822('0x1')]},'calleridname':{'type':Sequelize[_0x7822('0x1')]},'queue':{'type':Sequelize[_0x7822('0x1')]},'interface':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x7822('0x1')]},'agentcalledAt':{'type':Sequelize[_0x7822('0x2')]},'agentconnectAt':{'type':Sequelize[_0x7822('0x2')]},'agentcompleteAt':{'type':Sequelize[_0x7822('0x2')]},'agentringnoanswerAt':{'type':Sequelize[_0x7822('0x2')]},'agentdumpAt':{'type':Sequelize[_0x7822('0x2')]},'holdtime':{'type':Sequelize[_0x7822('0x3')]},'agentcomplete':{'type':Sequelize[_0x7822('0x4')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentdump':{'type':Sequelize[_0x7822('0x4')],'defaultValue':![]},'talktime':{'type':Sequelize['INTEGER']},'agentacw':{'type':Sequelize[_0x7822('0x4')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x7822('0x3')]},'reason':{'type':Sequelize[_0x7822('0x1')]},'lastevent':{'type':Sequelize[_0x7822('0x1')]},'channel':{'type':Sequelize[_0x7822('0x1')]},'channelstate':{'type':Sequelize[_0x7822('0x3')]},'channelstatedesc':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0x7822('0x1')]},'language':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x7822('0x1')]},'context':{'type':Sequelize[_0x7822('0x1')]},'exten':{'type':Sequelize[_0x7822('0x1')]},'priority':{'type':Sequelize[_0x7822('0x1')]},'destchannel':{'type':Sequelize[_0x7822('0x1')]},'destchannelstate':{'type':Sequelize[_0x7822('0x3')]},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize[_0x7822('0x1')]},'destconnectedlinenum':{'type':Sequelize[_0x7822('0x1')]},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize[_0x7822('0x1')]},'destaccountcode':{'type':Sequelize[_0x7822('0x1')]},'destcontext':{'type':Sequelize[_0x7822('0x1')]},'destexten':{'type':Sequelize[_0x7822('0x1')]},'destpriority':{'type':Sequelize[_0x7822('0x1')]},'destuniqueid':{'type':Sequelize['STRING']},'answeredelsewheredestinationuniqueid':{'type':Sequelize['STRING']},'answeredelsewheremembername':{'type':Sequelize[_0x7822('0x1')]},'transfer':{'type':Sequelize[_0x7822('0x4')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x7822('0x1')],'comment':_0x7822('0x5')},'transferexten':{'type':Sequelize[_0x7822('0x1')]},'transferuniqueid':{'type':Sequelize[_0x7822('0x1')]},'agententerreason':{'type':Sequelize[_0x7822('0x3')],'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 fcd6c69..2ed22f9 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(_0x40a825,_0x3bac79){var _0x273a54=function(_0x5628d8){while(--_0x5628d8){_0x40a825['push'](_0x40a825['shift']());}};_0x273a54(++_0x3bac79);}(_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'];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(_0x25e7cb,_0x3579b7){var _0x375d92=function(_0xe8cf3b){while(--_0xe8cf3b){_0x25e7cb['push'](_0x25e7cb['shift']());}};_0x375d92(++_0x3579b7);}(_0xa9e0,0x123));var _0x0a9e=function(_0x13ea00,_0x12f610){_0x13ea00=_0x13ea00-0x0;var _0x1f7347=_0xa9e0[_0x13ea00];return _0x1f7347;};'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 6c35c25..d3984b2 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 _0xdad2=['uniqueid','destuniqueid','util','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','exports','define'];(function(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0xdad2,0x14c));var _0x2dad=function(_0x178e48,_0x3c9509){_0x178e48=_0x178e48-0x0;var _0x440d7e=_0xdad2[_0x178e48];return _0x440d7e;};'use strict';var _=require('lodash');var util=require(_0x2dad('0x0'));var logger=require(_0x2dad('0x1'))('api');var moment=require(_0x2dad('0x2'));var BPromise=require(_0x2dad('0x3'));var rp=require(_0x2dad('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2dad('0x5'));var config=require(_0x2dad('0x6'));var attributes=require('./voiceAgentReport.attributes');module[_0x2dad('0x7')]=function(_0x36a054,_0x27ca04){return _0x36a054[_0x2dad('0x8')]('VoiceAgentReport',attributes,{'tableName':'report_agent','paranoid':![],'indexes':[{'fields':[_0x2dad('0x9'),_0x2dad('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x979e=['lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','VoiceAgentReport','report_agent','uniqueid','destuniqueid'];(function(_0x3f4027,_0x221cbb){var _0x4aea2e=function(_0x29bcbb){while(--_0x29bcbb){_0x3f4027['push'](_0x3f4027['shift']());}};_0x4aea2e(++_0x221cbb);}(_0x979e,0x195));var _0xe979=function(_0x5fafc0,_0xff0ffe){_0x5fafc0=_0x5fafc0-0x0;var _0x19c51b=_0x979e[_0x5fafc0];return _0x19c51b;};'use strict';var _=require(_0xe979('0x0'));var util=require(_0xe979('0x1'));var logger=require(_0xe979('0x2'))(_0xe979('0x3'));var moment=require('moment');var BPromise=require(_0xe979('0x4'));var rp=require(_0xe979('0x5'));var fs=require('fs');var path=require(_0xe979('0x6'));var rimraf=require(_0xe979('0x7'));var config=require(_0xe979('0x8'));var attributes=require('./voiceAgentReport.attributes');module[_0xe979('0x9')]=function(_0x580e20,_0x1a0d35){return _0x580e20[_0xe979('0xa')](_0xe979('0xb'),attributes,{'tableName':_0xe979('0xc'),'paranoid':![],'indexes':[{'fields':[_0xe979('0xd'),_0xe979('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.rpc.js b/server/api/voiceAgentReport/voiceAgentReport.rpc.js index 9b60058..2071d42 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 _0x0d66=['code','message','result','create','body','options','raw','CreateVoiceAgentReport','stringify','UpdateVoiceAgentReport','VoiceAgentReport','update','where','attributes','limit','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','http','then','info','VoiceAgentReport,\x20%s,\x20%s','request\x20sent','debug','VoiceAgentReport,\x20%s,\x20%s,\x20%s','error'];(function(_0x51aebb,_0x337d75){var _0x4d162e=function(_0x3b4879){while(--_0x3b4879){_0x51aebb['push'](_0x51aebb['shift']());}};_0x4d162e(++_0x337d75);}(_0x0d66,0x142));var _0x60d6=function(_0x47f7ec,_0x369f9d){_0x47f7ec=_0x47f7ec-0x0;var _0x415101=_0x0d66[_0x47f7ec];return _0x415101;};'use strict';var _=require(_0x60d6('0x0'));var util=require(_0x60d6('0x1'));var moment=require(_0x60d6('0x2'));var BPromise=require(_0x60d6('0x3'));var rs=require(_0x60d6('0x4'));var fs=require('fs');var Redis=require(_0x60d6('0x5'));var db=require(_0x60d6('0x6'))['db'];var utils=require(_0x60d6('0x7'));var logger=require(_0x60d6('0x8'))('rpc');var config=require('../../config/environment');var jayson=require(_0x60d6('0x9'));var client=jayson['client'][_0x60d6('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2bfa87,_0x446bf2,_0x537b81){return new BPromise(function(_0x44cb64,_0x38916d){return client['request'](_0x2bfa87,_0x537b81)[_0x60d6('0xb')](function(_0x3a4b6c){logger[_0x60d6('0xc')](_0x60d6('0xd'),_0x446bf2,_0x60d6('0xe'));logger[_0x60d6('0xf')](_0x60d6('0x10'),_0x446bf2,'request\x20sent',JSON['stringify'](_0x3a4b6c));if(_0x3a4b6c[_0x60d6('0x11')]){if(_0x3a4b6c[_0x60d6('0x11')][_0x60d6('0x12')]===0x1f4){logger[_0x60d6('0x11')]('VoiceAgentReport,\x20%s,\x20%s',_0x446bf2,_0x3a4b6c[_0x60d6('0x11')][_0x60d6('0x13')]);return _0x38916d(_0x3a4b6c[_0x60d6('0x11')][_0x60d6('0x13')]);}logger['error'](_0x60d6('0xd'),_0x446bf2,_0x3a4b6c[_0x60d6('0x11')]['message']);return _0x44cb64(_0x3a4b6c['error'][_0x60d6('0x13')]);}else{logger[_0x60d6('0xc')](_0x60d6('0xd'),_0x446bf2,_0x60d6('0xe'));_0x44cb64(_0x3a4b6c[_0x60d6('0x14')][_0x60d6('0x13')]);}})['catch'](function(_0x3c0fe4){logger[_0x60d6('0x11')]('VoiceAgentReport,\x20%s,\x20%s',_0x446bf2,_0x3c0fe4);_0x38916d(_0x3c0fe4);});});}exports['CreateVoiceAgentReport']=function(_0x147270){var _0x2e9392=this;return new Promise(function(_0x92ba6f,_0x3810bd){return db['VoiceAgentReport'][_0x60d6('0x15')](_0x147270[_0x60d6('0x16')],{'raw':_0x147270[_0x60d6('0x17')]?_0x147270[_0x60d6('0x17')][_0x60d6('0x18')]===undefined?!![]:![]:!![]})[_0x60d6('0xb')](function(_0xea58fd){logger['info'](_0x60d6('0x19'),_0x147270);logger[_0x60d6('0xf')]('CreateVoiceAgentReport',_0x147270,JSON[_0x60d6('0x1a')](_0xea58fd));_0x92ba6f(_0xea58fd);})['catch'](function(_0x5f49ee){logger['error']('CreateVoiceAgentReport',_0x5f49ee[_0x60d6('0x13')],_0x147270);_0x3810bd(_0x2e9392['error'](0x1f4,_0x5f49ee['message']));});});};exports[_0x60d6('0x1b')]=function(_0x47985c){var _0x16dfca=this;return new Promise(function(_0x4175ff,_0x3e07da){return db[_0x60d6('0x1c')][_0x60d6('0x1d')](_0x47985c[_0x60d6('0x16')],{'raw':_0x47985c[_0x60d6('0x17')]?_0x47985c[_0x60d6('0x17')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x47985c[_0x60d6('0x17')]?_0x47985c[_0x60d6('0x17')][_0x60d6('0x1e')]||null:null,'attributes':_0x47985c['options']?_0x47985c['options'][_0x60d6('0x1f')]||null:null,'limit':_0x47985c['options']?_0x47985c[_0x60d6('0x17')][_0x60d6('0x20')]||null:null})[_0x60d6('0xb')](function(_0x6b3c4b){logger['info'](_0x60d6('0x1b'),_0x47985c);logger['debug'](_0x60d6('0x1b'),_0x47985c,JSON['stringify'](_0x6b3c4b));_0x4175ff(_0x6b3c4b);})[_0x60d6('0x21')](function(_0x1f511c){logger[_0x60d6('0x11')](_0x60d6('0x1b'),_0x1f511c['message'],_0x47985c);_0x3e07da(_0x16dfca[_0x60d6('0x11')](0x1f4,_0x1f511c[_0x60d6('0x13')]));});});}; \ No newline at end of file +var _0x0687=['debug','request\x20sent','stringify','error','VoiceAgentReport,\x20%s,\x20%s','message','result','CreateVoiceAgentReport','VoiceAgentReport','options','raw','then','UpdateVoiceAgentReport','update','body','where','attributes','limit','catch','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','info'];(function(_0x6c1bd9,_0x3462b6){var _0x48eb4d=function(_0x4de0df){while(--_0x4de0df){_0x6c1bd9['push'](_0x6c1bd9['shift']());}};_0x48eb4d(++_0x3462b6);}(_0x0687,0x113));var _0x7068=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x0687[_0x14add3];return _0x4a174f;};'use strict';var _=require('lodash');var util=require(_0x7068('0x0'));var moment=require(_0x7068('0x1'));var BPromise=require(_0x7068('0x2'));var rs=require(_0x7068('0x3'));var fs=require('fs');var Redis=require(_0x7068('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x7068('0x5'));var logger=require(_0x7068('0x6'))('rpc');var config=require(_0x7068('0x7'));var jayson=require(_0x7068('0x8'));var client=jayson[_0x7068('0x9')][_0x7068('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x20156e,_0x19981a,_0xb7a4e9){return new BPromise(function(_0x58c062,_0x1f92a1){return client[_0x7068('0xb')](_0x20156e,_0xb7a4e9)['then'](function(_0x50273d){logger[_0x7068('0xc')]('VoiceAgentReport,\x20%s,\x20%s',_0x19981a,'request\x20sent');logger[_0x7068('0xd')]('VoiceAgentReport,\x20%s,\x20%s,\x20%s',_0x19981a,_0x7068('0xe'),JSON[_0x7068('0xf')](_0x50273d));if(_0x50273d['error']){if(_0x50273d['error']['code']===0x1f4){logger[_0x7068('0x10')](_0x7068('0x11'),_0x19981a,_0x50273d[_0x7068('0x10')][_0x7068('0x12')]);return _0x1f92a1(_0x50273d[_0x7068('0x10')]['message']);}logger[_0x7068('0x10')](_0x7068('0x11'),_0x19981a,_0x50273d[_0x7068('0x10')]['message']);return _0x58c062(_0x50273d[_0x7068('0x10')][_0x7068('0x12')]);}else{logger[_0x7068('0xc')]('VoiceAgentReport,\x20%s,\x20%s',_0x19981a,_0x7068('0xe'));_0x58c062(_0x50273d[_0x7068('0x13')][_0x7068('0x12')]);}})['catch'](function(_0x1992e0){logger['error'](_0x7068('0x11'),_0x19981a,_0x1992e0);_0x1f92a1(_0x1992e0);});});}exports[_0x7068('0x14')]=function(_0x195f7d){var _0x24b3bf=this;return new Promise(function(_0x2fd9eb,_0x2757ce){return db[_0x7068('0x15')]['create'](_0x195f7d['body'],{'raw':_0x195f7d[_0x7068('0x16')]?_0x195f7d['options'][_0x7068('0x17')]===undefined?!![]:![]:!![]})[_0x7068('0x18')](function(_0xc75f96){logger['info']('CreateVoiceAgentReport',_0x195f7d);logger[_0x7068('0xd')](_0x7068('0x14'),_0x195f7d,JSON[_0x7068('0xf')](_0xc75f96));_0x2fd9eb(_0xc75f96);})['catch'](function(_0x27b4a2){logger[_0x7068('0x10')](_0x7068('0x14'),_0x27b4a2[_0x7068('0x12')],_0x195f7d);_0x2757ce(_0x24b3bf[_0x7068('0x10')](0x1f4,_0x27b4a2[_0x7068('0x12')]));});});};exports[_0x7068('0x19')]=function(_0x2da988){var _0x546726=this;return new Promise(function(_0x29c8d7,_0x53ab89){return db[_0x7068('0x15')][_0x7068('0x1a')](_0x2da988[_0x7068('0x1b')],{'raw':_0x2da988[_0x7068('0x16')]?_0x2da988[_0x7068('0x16')][_0x7068('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2da988[_0x7068('0x16')]?_0x2da988[_0x7068('0x16')][_0x7068('0x1c')]||null:null,'attributes':_0x2da988[_0x7068('0x16')]?_0x2da988[_0x7068('0x16')][_0x7068('0x1d')]||null:null,'limit':_0x2da988['options']?_0x2da988[_0x7068('0x16')][_0x7068('0x1e')]||null:null})[_0x7068('0x18')](function(_0x428029){logger[_0x7068('0xc')](_0x7068('0x19'),_0x2da988);logger[_0x7068('0xd')](_0x7068('0x19'),_0x2da988,JSON['stringify'](_0x428029));_0x29c8d7(_0x428029);})[_0x7068('0x1f')](function(_0x1cfcc8){logger[_0x7068('0x10')](_0x7068('0x19'),_0x1cfcc8['message'],_0x2da988);_0x53ab89(_0x546726[_0x7068('0x10')](0x1f4,_0x1cfcc8[_0x7068('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/index.js b/server/api/voiceCallReport/index.js index 8e06a36..d9ae5da 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 _0xeec6=['isAuthenticated','index','/describe','describe','get','show','post','/:id','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceCallReport.controller'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0xeec6,0x1c2));var _0x6eec=function(_0xb7b878,_0x5c3b92){_0xb7b878=_0xb7b878-0x0;var _0x3c84b9=_0xeec6[_0xb7b878];return _0x3c84b9;};'use strict';var multer=require(_0x6eec('0x0'));var util=require(_0x6eec('0x1'));var path=require(_0x6eec('0x2'));var timeout=require(_0x6eec('0x3'));var express=require('express');var router=express[_0x6eec('0x4')]();var fs_extra=require(_0x6eec('0x5'));var auth=require(_0x6eec('0x6'));var interaction=require(_0x6eec('0x7'));var config=require(_0x6eec('0x8'));var controller=require(_0x6eec('0x9'));router['get']('/',auth[_0x6eec('0xa')](),controller[_0x6eec('0xb')]);router['get'](_0x6eec('0xc'),auth[_0x6eec('0xa')](),controller[_0x6eec('0xd')]);router[_0x6eec('0xe')]('/:id',auth[_0x6eec('0xa')](),controller[_0x6eec('0xf')]);router[_0x6eec('0x10')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x6eec('0x11'),auth[_0x6eec('0xa')](),controller['update']);router['delete'](_0x6eec('0x11'),auth['isAuthenticated'](),controller[_0x6eec('0x12')]);module[_0x6eec('0x13')]=router; \ No newline at end of file +var _0xd13e=['update','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../config/environment','./voiceCallReport.controller','get','/describe','isAuthenticated','describe','/:id','show','post','create','put'];(function(_0x575c75,_0x120aa9){var _0x436370=function(_0x235a5a){while(--_0x235a5a){_0x575c75['push'](_0x575c75['shift']());}};_0x436370(++_0x120aa9);}(_0xd13e,0x193));var _0xed13=function(_0x4c42c3,_0x28fcde){_0x4c42c3=_0x4c42c3-0x0;var _0x2f3510=_0xd13e[_0x4c42c3];return _0x2f3510;};'use strict';var multer=require(_0xed13('0x0'));var util=require(_0xed13('0x1'));var path=require(_0xed13('0x2'));var timeout=require(_0xed13('0x3'));var express=require('express');var router=express[_0xed13('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xed13('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xed13('0x6'));var controller=require(_0xed13('0x7'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0xed13('0x8')](_0xed13('0x9'),auth[_0xed13('0xa')](),controller[_0xed13('0xb')]);router[_0xed13('0x8')](_0xed13('0xc'),auth[_0xed13('0xa')](),controller[_0xed13('0xd')]);router[_0xed13('0xe')]('/',auth['isAuthenticated'](),controller[_0xed13('0xf')]);router[_0xed13('0x10')](_0xed13('0xc'),auth[_0xed13('0xa')](),controller[_0xed13('0x11')]);router['delete'](_0xed13('0xc'),auth[_0xed13('0xa')](),controller[_0xed13('0x12')]);module[_0xed13('0x13')]=router; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.attributes.js b/server/api/voiceCallReport/voiceCallReport.attributes.js index 461d318..7c21e2c 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 _0x31b9=['STRING','ENUM','inbound','internal','outbound','inbound-fax','dialer','TEXT','DATE','INTEGER'];(function(_0x137be1,_0x464a94){var _0x154c72=function(_0x163449){while(--_0x163449){_0x137be1['push'](_0x137be1['shift']());}};_0x154c72(++_0x464a94);}(_0x31b9,0xb4));var _0x931b=function(_0x188fbe,_0x315039){_0x188fbe=_0x188fbe-0x0;var _0x36e031=_0x31b9[_0x188fbe];return _0x36e031;};'use strict';var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize[_0x931b('0x0')]},'type':{'type':Sequelize[_0x931b('0x1')](_0x931b('0x2'),_0x931b('0x3'),_0x931b('0x4'),_0x931b('0x5'),'outbound-fax',_0x931b('0x6'))},'tag':{'type':Sequelize[_0x931b('0x0')]},'accountcode':{'type':Sequelize['STRING']},'source':{'type':Sequelize[_0x931b('0x0')]},'destination':{'type':Sequelize[_0x931b('0x0')]},'destinationcontext':{'type':Sequelize[_0x931b('0x0')]},'callerid':{'type':Sequelize[_0x931b('0x0')]},'channel':{'type':Sequelize[_0x931b('0x0')]},'destinationchannel':{'type':Sequelize[_0x931b('0x0')]},'lastapplication':{'type':Sequelize['STRING']},'lastdata':{'type':Sequelize[_0x931b('0x7')]},'starttime':{'type':Sequelize[_0x931b('0x8')]},'systemanswertime':{'type':Sequelize[_0x931b('0x8')]},'answertime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0x931b('0x8')]},'duration':{'type':Sequelize['INTEGER']},'billableseconds':{'type':Sequelize[_0x931b('0x9')]},'mohtime':{'type':Sequelize[_0x931b('0x9')],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x931b('0x0')]},'amaflags':{'type':Sequelize[_0x931b('0x0')]},'userfield':{'type':Sequelize[_0x931b('0x0')]},'userDisposition':{'type':Sequelize[_0x931b('0x0')]},'userSecondDisposition':{'type':Sequelize[_0x931b('0x0')]},'userThirdDisposition':{'type':Sequelize[_0x931b('0x0')]},'note':{'type':Sequelize[_0x931b('0x0')]},'prefix':{'type':Sequelize[_0x931b('0x0')]},'routeid':{'type':Sequelize[_0x931b('0x9')]},'sipcallid':{'type':Sequelize[_0x931b('0x0')]}}; \ No newline at end of file +var _0xfb71=['sequelize','exports','STRING','ENUM','inbound','inbound-fax','outbound-fax','dialer','TEXT','DATE','INTEGER'];(function(_0x3bcba4,_0xaa7d1){var _0x269e3a=function(_0x2b2070){while(--_0x2b2070){_0x3bcba4['push'](_0x3bcba4['shift']());}};_0x269e3a(++_0xaa7d1);}(_0xfb71,0x1ef));var _0x1fb7=function(_0x3122d7,_0x585e77){_0x3122d7=_0x3122d7-0x0;var _0x3a206c=_0xfb71[_0x3122d7];return _0x3a206c;};'use strict';var Sequelize=require(_0x1fb7('0x0'));module[_0x1fb7('0x1')]={'uniqueid':{'type':Sequelize[_0x1fb7('0x2')]},'type':{'type':Sequelize[_0x1fb7('0x3')](_0x1fb7('0x4'),'internal','outbound',_0x1fb7('0x5'),_0x1fb7('0x6'),_0x1fb7('0x7'))},'tag':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x1fb7('0x2')]},'source':{'type':Sequelize[_0x1fb7('0x2')]},'destination':{'type':Sequelize[_0x1fb7('0x2')]},'destinationcontext':{'type':Sequelize[_0x1fb7('0x2')]},'callerid':{'type':Sequelize[_0x1fb7('0x2')]},'channel':{'type':Sequelize[_0x1fb7('0x2')]},'destinationchannel':{'type':Sequelize['STRING']},'lastapplication':{'type':Sequelize[_0x1fb7('0x2')]},'lastdata':{'type':Sequelize[_0x1fb7('0x8')]},'starttime':{'type':Sequelize['DATE']},'systemanswertime':{'type':Sequelize[_0x1fb7('0x9')]},'answertime':{'type':Sequelize[_0x1fb7('0x9')]},'endtime':{'type':Sequelize[_0x1fb7('0x9')]},'duration':{'type':Sequelize[_0x1fb7('0xa')]},'billableseconds':{'type':Sequelize[_0x1fb7('0xa')]},'mohtime':{'type':Sequelize[_0x1fb7('0xa')],'defaultValue':0x0},'disposition':{'type':Sequelize['STRING']},'amaflags':{'type':Sequelize['STRING']},'userfield':{'type':Sequelize[_0x1fb7('0x2')]},'userDisposition':{'type':Sequelize[_0x1fb7('0x2')]},'userSecondDisposition':{'type':Sequelize[_0x1fb7('0x2')]},'userThirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x1fb7('0x2')]},'prefix':{'type':Sequelize[_0x1fb7('0x2')]},'routeid':{'type':Sequelize[_0x1fb7('0xa')]},'sipcallid':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.controller.js b/server/api/voiceCallReport/voiceCallReport.controller.js index e8f09e6..2133fa4 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 _0x5f66=['../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/license/util','sendStatus','status','end','json','undefined','limit','count','offset','Content-Range','apply','reject','save','destroy','then','error','name','send','index','map','VoiceCallReport','rawAttributes','fieldName','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filter','merge','type','VIRTUAL','includeAll','include','fullname','alias','User','rows','catch','show','params','find','create','body','describe','uniqueid','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x5f66,0x1a0));var _0x65f6=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x5f66[_0x21a9d9];return _0x46adce;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x65f6('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x65f6('0x1'));var rp=require(_0x65f6('0x2'));var moment=require(_0x65f6('0x3'));var BPromise=require(_0x65f6('0x4'));var Mustache=require(_0x65f6('0x5'));var util=require('util');var path=require(_0x65f6('0x6'));var sox=require('sox');var csv=require(_0x65f6('0x7'));var ejs=require(_0x65f6('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x65f6('0x9'));var crypto=require(_0x65f6('0xa'));var jsforce=require(_0x65f6('0xb'));var deskjs=require(_0x65f6('0xc'));var toCsv=require(_0x65f6('0x7'));var querystring=require(_0x65f6('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x65f6('0xe'));var qs=require(_0x65f6('0xf'));var as=require(_0x65f6('0x10'));var hardwareService=require(_0x65f6('0x11'));var logger=require('../../config/logger')(_0x65f6('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x65f6('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x419819,_0x4862a5){_0x4862a5=_0x4862a5||0xcc;return function(_0x2f964a){if(_0x2f964a){return _0x419819[_0x65f6('0x14')](_0x4862a5);}return _0x419819[_0x65f6('0x15')](_0x4862a5)[_0x65f6('0x16')]();};}function respondWithResult(_0x369f96,_0x1d29fd){_0x1d29fd=_0x1d29fd||0xc8;return function(_0x44144b){if(_0x44144b){return _0x369f96[_0x65f6('0x15')](_0x1d29fd)[_0x65f6('0x17')](_0x44144b);}};}function respondWithFilteredResult(_0x3440af,_0x59154e){return function(_0x19b9ff){if(_0x19b9ff){var _0x49a913=typeof _0x59154e['offset']===_0x65f6('0x18')&&typeof _0x59154e[_0x65f6('0x19')]===_0x65f6('0x18');var _0x1c955c=_0x19b9ff[_0x65f6('0x1a')];var _0x1f974c=_0x49a913?0x0:_0x59154e[_0x65f6('0x1b')];var _0x18380e=_0x49a913?_0x19b9ff['count']:_0x59154e['offset']+_0x59154e[_0x65f6('0x19')];var _0x5b4055;if(_0x18380e>=_0x1c955c){_0x18380e=_0x1c955c;_0x5b4055=0xc8;}else{_0x5b4055=0xce;}_0x3440af['status'](_0x5b4055);return _0x3440af['set'](_0x65f6('0x1c'),_0x1f974c+'-'+_0x18380e+'/'+_0x1c955c)[_0x65f6('0x17')](_0x19b9ff);}return null;};}function patchUpdates(_0x5114a4){return function(_0x39e19f){try{jsonpatch[_0x65f6('0x1d')](_0x39e19f,_0x5114a4,!![]);}catch(_0xbee6a4){return BPromise[_0x65f6('0x1e')](_0xbee6a4);}return _0x39e19f[_0x65f6('0x1f')]();};}function saveUpdates(_0xc139c2,_0x581374){return function(_0x197a49){if(_0x197a49){return _0x197a49['update'](_0xc139c2)['then'](function(_0x212247){return _0x212247;});}return null;};}function removeEntity(_0xd173f4,_0x524e42){return function(_0x1eeaaa){if(_0x1eeaaa){return _0x1eeaaa[_0x65f6('0x20')]()[_0x65f6('0x21')](function(){_0xd173f4[_0x65f6('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x9d7bb0,_0x59ea32){return function(_0x20a161){if(!_0x20a161){_0x9d7bb0['sendStatus'](0x194);}return _0x20a161;};}function handleError(_0x5cb131,_0x4fde2f){_0x4fde2f=_0x4fde2f||0x1f4;return function(_0x29abdb){logger[_0x65f6('0x22')](_0x29abdb['stack']);if(_0x29abdb[_0x65f6('0x23')]){delete _0x29abdb[_0x65f6('0x23')];}_0x5cb131['status'](_0x4fde2f)[_0x65f6('0x24')](_0x29abdb);};}exports[_0x65f6('0x25')]=function(_0x28d0df,_0x559330){var _0x4ac04b={},_0x488d36={},_0x266cfe={'count':0x0,'rows':[]};var _0x3c032f=_[_0x65f6('0x26')](db[_0x65f6('0x27')][_0x65f6('0x28')],function(_0x14a387){return{'name':_0x14a387[_0x65f6('0x29')],'type':_0x14a387['type']['key']};});_0x488d36[_0x65f6('0x2a')]=_[_0x65f6('0x26')](_0x3c032f,'name');_0x488d36['query']=_[_0x65f6('0x2b')](_0x28d0df[_0x65f6('0x2c')]);_0x488d36[_0x65f6('0x2d')]=_[_0x65f6('0x2e')](_0x488d36[_0x65f6('0x2a')],_0x488d36[_0x65f6('0x2c')]);_0x4ac04b['attributes']=_[_0x65f6('0x2e')](_0x488d36[_0x65f6('0x2a')],qs[_0x65f6('0x2f')](_0x28d0df['query'][_0x65f6('0x2f')]));_0x4ac04b[_0x65f6('0x30')]=_0x4ac04b[_0x65f6('0x30')][_0x65f6('0x31')]?_0x4ac04b[_0x65f6('0x30')]:_0x488d36[_0x65f6('0x2a')];if(!_0x28d0df['query'][_0x65f6('0x32')](_0x65f6('0x33'))){_0x4ac04b['limit']=qs[_0x65f6('0x19')](_0x28d0df['query'][_0x65f6('0x19')]);_0x4ac04b['offset']=qs[_0x65f6('0x1b')](_0x28d0df[_0x65f6('0x2c')]['offset']);}_0x4ac04b[_0x65f6('0x34')]=qs[_0x65f6('0x35')](_0x28d0df[_0x65f6('0x2c')]['sort']);_0x4ac04b['where']=qs[_0x65f6('0x2d')](_['pick'](_0x28d0df[_0x65f6('0x2c')],_0x488d36['filters']),_0x3c032f);if(_0x28d0df[_0x65f6('0x2c')][_0x65f6('0x36')]){_0x4ac04b['where']=_[_0x65f6('0x37')](_0x4ac04b['where'],{'$or':_['map'](_0x3c032f,function(_0x71b16b){if(_0x71b16b[_0x65f6('0x38')]!==_0x65f6('0x39')){var _0x313be5={};_0x313be5[_0x71b16b[_0x65f6('0x23')]]={'$like':'%'+_0x28d0df[_0x65f6('0x2c')][_0x65f6('0x36')]+'%'};return _0x313be5;}})});}_0x4ac04b=_[_0x65f6('0x37')]({},_0x4ac04b,_0x28d0df['options']);var _0x3aa254={'where':_0x4ac04b['where']};return db[_0x65f6('0x27')][_0x65f6('0x1a')](_0x3aa254)[_0x65f6('0x21')](function(_0x2ea7f7){_0x266cfe['count']=_0x2ea7f7;if(_0x28d0df[_0x65f6('0x2c')][_0x65f6('0x3a')]){_0x4ac04b[_0x65f6('0x3b')]=[{'attributes':['id',_0x65f6('0x23'),_0x65f6('0x3c'),_0x65f6('0x3d')],'model':db[_0x65f6('0x3e')],'as':_0x65f6('0x3e')}];}return db[_0x65f6('0x27')]['findAll'](_0x4ac04b);})[_0x65f6('0x21')](function(_0x400ed2){_0x266cfe[_0x65f6('0x3f')]=_0x400ed2;return _0x266cfe;})[_0x65f6('0x21')](respondWithFilteredResult(_0x559330,_0x4ac04b))[_0x65f6('0x40')](handleError(_0x559330,null));};exports[_0x65f6('0x41')]=function(_0xe0b72d,_0x2e91e8){var _0x461393={'raw':!![],'where':{'id':_0xe0b72d[_0x65f6('0x42')]['id']}},_0x2abbed={};_0x2abbed[_0x65f6('0x2a')]=_[_0x65f6('0x2b')](db[_0x65f6('0x27')][_0x65f6('0x28')]);_0x2abbed[_0x65f6('0x2c')]=_['keys'](_0xe0b72d[_0x65f6('0x2c')]);_0x2abbed[_0x65f6('0x2d')]=_[_0x65f6('0x2e')](_0x2abbed[_0x65f6('0x2a')],_0x2abbed['query']);_0x461393[_0x65f6('0x30')]=_[_0x65f6('0x2e')](_0x2abbed[_0x65f6('0x2a')],qs['fields'](_0xe0b72d[_0x65f6('0x2c')][_0x65f6('0x2f')]));_0x461393[_0x65f6('0x30')]=_0x461393[_0x65f6('0x30')]['length']?_0x461393[_0x65f6('0x30')]:_0x2abbed['model'];if(_0xe0b72d[_0x65f6('0x2c')][_0x65f6('0x3a')]){_0x461393['include']=[{'all':!![]}];}_0x461393=_[_0x65f6('0x37')]({},_0x461393,_0xe0b72d['options']);return db[_0x65f6('0x27')][_0x65f6('0x43')](_0x461393)[_0x65f6('0x21')](handleEntityNotFound(_0x2e91e8,null))[_0x65f6('0x21')](respondWithResult(_0x2e91e8,null))[_0x65f6('0x40')](handleError(_0x2e91e8,null));};exports[_0x65f6('0x44')]=function(_0x4d30c5,_0x51bf6c){return db[_0x65f6('0x27')][_0x65f6('0x44')](_0x4d30c5[_0x65f6('0x45')],{})[_0x65f6('0x21')](respondWithResult(_0x51bf6c,0xc9))[_0x65f6('0x40')](handleError(_0x51bf6c,null));};exports[_0x65f6('0x20')]=function(_0x149c28,_0x41690c){return db[_0x65f6('0x27')]['find']({'where':{'id':_0x149c28[_0x65f6('0x42')]['id']}})[_0x65f6('0x21')](handleEntityNotFound(_0x41690c,null))[_0x65f6('0x21')](removeEntity(_0x41690c,null))['catch'](handleError(_0x41690c,null));};exports[_0x65f6('0x46')]=function(_0x42d453,_0x49ba5a){return db[_0x65f6('0x27')][_0x65f6('0x46')]()['then'](respondWithResult(_0x49ba5a,null))[_0x65f6('0x40')](handleError(_0x49ba5a,null));};exports['update']=function(_0x247be3,_0x3b241f){if(_0x247be3[_0x65f6('0x45')]['uniqueid']){delete _0x247be3[_0x65f6('0x45')][_0x65f6('0x47')];}return db['VoiceCallReport'][_0x65f6('0x43')]({'where':{'uniqueid':_0x247be3[_0x65f6('0x42')]['id'],'UserId':{'$or':[null,_0x247be3['user']['id']]}}})[_0x65f6('0x21')](handleEntityNotFound(_0x3b241f,null))[_0x65f6('0x21')](saveUpdates(_0x247be3[_0x65f6('0x45')],null))[_0x65f6('0x21')](respondWithResult(_0x3b241f,null))[_0x65f6('0x40')](handleError(_0x3b241f,null));}; \ No newline at end of file +var _0xb10b=['desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','reject','update','then','destroy','end','error','stack','name','send','index','map','rawAttributes','fieldName','key','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','VIRTUAL','filter','merge','options','VoiceCallReport','includeAll','include','alias','User','rows','show','find','create','body','catch','params','describe','uniqueid','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce'];(function(_0x1c5f3f,_0x3280cf){var _0x4a94fe=function(_0x45b817){while(--_0x45b817){_0x1c5f3f['push'](_0x1c5f3f['shift']());}};_0x4a94fe(++_0x3280cf);}(_0xb10b,0x12a));var _0xbb10=function(_0x2a4d07,_0x3664aa){_0x2a4d07=_0x2a4d07-0x0;var _0x3d0203=_0xb10b[_0x2a4d07];return _0x3d0203;};'use strict';var emlformat=require(_0xbb10('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xbb10('0x1'));var jsonpatch=require(_0xbb10('0x2'));var rp=require(_0xbb10('0x3'));var moment=require('moment');var BPromise=require(_0xbb10('0x4'));var Mustache=require(_0xbb10('0x5'));var util=require(_0xbb10('0x6'));var path=require(_0xbb10('0x7'));var sox=require(_0xbb10('0x8'));var csv=require(_0xbb10('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xbb10('0xa'));var _=require(_0xbb10('0xb'));var squel=require('squel');var crypto=require(_0xbb10('0xc'));var jsforce=require(_0xbb10('0xd'));var deskjs=require(_0xbb10('0xe'));var toCsv=require(_0xbb10('0x9'));var querystring=require(_0xbb10('0xf'));var Papa=require(_0xbb10('0x10'));var Redis=require(_0xbb10('0x11'));var authService=require(_0xbb10('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbb10('0x13'));var logger=require(_0xbb10('0x14'))(_0xbb10('0x15'));var utils=require('../../config/utils');var config=require(_0xbb10('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xbb10('0x17'))['db'];function respondWithStatusCode(_0x916a32,_0x285009){_0x285009=_0x285009||0xcc;return function(_0x193a27){if(_0x193a27){return _0x916a32[_0xbb10('0x18')](_0x285009);}return _0x916a32[_0xbb10('0x19')](_0x285009)['end']();};}function respondWithResult(_0x26e021,_0x42d7e4){_0x42d7e4=_0x42d7e4||0xc8;return function(_0x45b9d6){if(_0x45b9d6){return _0x26e021[_0xbb10('0x19')](_0x42d7e4)[_0xbb10('0x1a')](_0x45b9d6);}};}function respondWithFilteredResult(_0x2f2ebf,_0x24a57b){return function(_0x36b5e8){if(_0x36b5e8){var _0x3e26f4=typeof _0x24a57b[_0xbb10('0x1b')]==='undefined'&&typeof _0x24a57b[_0xbb10('0x1c')]===_0xbb10('0x1d');var _0x133ac2=_0x36b5e8[_0xbb10('0x1e')];var _0x378da8=_0x3e26f4?0x0:_0x24a57b[_0xbb10('0x1b')];var _0x575cca=_0x3e26f4?_0x36b5e8[_0xbb10('0x1e')]:_0x24a57b[_0xbb10('0x1b')]+_0x24a57b[_0xbb10('0x1c')];var _0x48b6e9;if(_0x575cca>=_0x133ac2){_0x575cca=_0x133ac2;_0x48b6e9=0xc8;}else{_0x48b6e9=0xce;}_0x2f2ebf[_0xbb10('0x19')](_0x48b6e9);return _0x2f2ebf[_0xbb10('0x1f')](_0xbb10('0x20'),_0x378da8+'-'+_0x575cca+'/'+_0x133ac2)[_0xbb10('0x1a')](_0x36b5e8);}return null;};}function patchUpdates(_0xdf237d){return function(_0x44e563){try{jsonpatch['apply'](_0x44e563,_0xdf237d,!![]);}catch(_0x12f888){return BPromise[_0xbb10('0x21')](_0x12f888);}return _0x44e563['save']();};}function saveUpdates(_0x4c4b0d,_0x8e2b97){return function(_0x311abe){if(_0x311abe){return _0x311abe[_0xbb10('0x22')](_0x4c4b0d)[_0xbb10('0x23')](function(_0x445761){return _0x445761;});}return null;};}function removeEntity(_0x1824b7,_0x407cb4){return function(_0x436104){if(_0x436104){return _0x436104[_0xbb10('0x24')]()[_0xbb10('0x23')](function(){_0x1824b7[_0xbb10('0x19')](0xcc)[_0xbb10('0x25')]();});}};}function handleEntityNotFound(_0x537898,_0x4fedac){return function(_0x4fb5e0){if(!_0x4fb5e0){_0x537898[_0xbb10('0x18')](0x194);}return _0x4fb5e0;};}function handleError(_0x3c5ae7,_0x2c89b9){_0x2c89b9=_0x2c89b9||0x1f4;return function(_0x4e25ff){logger[_0xbb10('0x26')](_0x4e25ff[_0xbb10('0x27')]);if(_0x4e25ff[_0xbb10('0x28')]){delete _0x4e25ff[_0xbb10('0x28')];}_0x3c5ae7[_0xbb10('0x19')](_0x2c89b9)[_0xbb10('0x29')](_0x4e25ff);};}exports[_0xbb10('0x2a')]=function(_0x4aabb9,_0x3796c7){var _0x21ac54={},_0xfc3595={},_0x2e0249={'count':0x0,'rows':[]};var _0x1d30aa=_[_0xbb10('0x2b')](db['VoiceCallReport'][_0xbb10('0x2c')],function(_0x4ee02e){return{'name':_0x4ee02e[_0xbb10('0x2d')],'type':_0x4ee02e['type'][_0xbb10('0x2e')]};});_0xfc3595[_0xbb10('0x2f')]=_[_0xbb10('0x2b')](_0x1d30aa,'name');_0xfc3595['query']=_[_0xbb10('0x30')](_0x4aabb9[_0xbb10('0x31')]);_0xfc3595['filters']=_[_0xbb10('0x32')](_0xfc3595[_0xbb10('0x2f')],_0xfc3595[_0xbb10('0x31')]);_0x21ac54[_0xbb10('0x33')]=_[_0xbb10('0x32')](_0xfc3595[_0xbb10('0x2f')],qs[_0xbb10('0x34')](_0x4aabb9['query'][_0xbb10('0x34')]));_0x21ac54[_0xbb10('0x33')]=_0x21ac54[_0xbb10('0x33')][_0xbb10('0x35')]?_0x21ac54[_0xbb10('0x33')]:_0xfc3595[_0xbb10('0x2f')];if(!_0x4aabb9[_0xbb10('0x31')][_0xbb10('0x36')](_0xbb10('0x37'))){_0x21ac54['limit']=qs[_0xbb10('0x1c')](_0x4aabb9[_0xbb10('0x31')][_0xbb10('0x1c')]);_0x21ac54[_0xbb10('0x1b')]=qs['offset'](_0x4aabb9[_0xbb10('0x31')]['offset']);}_0x21ac54['order']=qs[_0xbb10('0x38')](_0x4aabb9[_0xbb10('0x31')][_0xbb10('0x38')]);_0x21ac54[_0xbb10('0x39')]=qs[_0xbb10('0x3a')](_[_0xbb10('0x3b')](_0x4aabb9['query'],_0xfc3595[_0xbb10('0x3a')]),_0x1d30aa);if(_0x4aabb9[_0xbb10('0x31')]['filter']){_0x21ac54['where']=_['merge'](_0x21ac54[_0xbb10('0x39')],{'$or':_[_0xbb10('0x2b')](_0x1d30aa,function(_0x2b658a){if(_0x2b658a['type']!==_0xbb10('0x3c')){var _0x3e8538={};_0x3e8538[_0x2b658a[_0xbb10('0x28')]]={'$like':'%'+_0x4aabb9['query'][_0xbb10('0x3d')]+'%'};return _0x3e8538;}})});}_0x21ac54=_[_0xbb10('0x3e')]({},_0x21ac54,_0x4aabb9[_0xbb10('0x3f')]);var _0x446f49={'where':_0x21ac54['where']};return db[_0xbb10('0x40')][_0xbb10('0x1e')](_0x446f49)['then'](function(_0xe2040f){_0x2e0249[_0xbb10('0x1e')]=_0xe2040f;if(_0x4aabb9[_0xbb10('0x31')][_0xbb10('0x41')]){_0x21ac54[_0xbb10('0x42')]=[{'attributes':['id',_0xbb10('0x28'),'fullname',_0xbb10('0x43')],'model':db[_0xbb10('0x44')],'as':_0xbb10('0x44')}];}return db[_0xbb10('0x40')]['findAll'](_0x21ac54);})[_0xbb10('0x23')](function(_0x331751){_0x2e0249[_0xbb10('0x45')]=_0x331751;return _0x2e0249;})[_0xbb10('0x23')](respondWithFilteredResult(_0x3796c7,_0x21ac54))['catch'](handleError(_0x3796c7,null));};exports[_0xbb10('0x46')]=function(_0x202c60,_0x54ac18){var _0x5d9a4f={'raw':!![],'where':{'id':_0x202c60['params']['id']}},_0x38d78f={};_0x38d78f[_0xbb10('0x2f')]=_[_0xbb10('0x30')](db['VoiceCallReport'][_0xbb10('0x2c')]);_0x38d78f[_0xbb10('0x31')]=_[_0xbb10('0x30')](_0x202c60['query']);_0x38d78f[_0xbb10('0x3a')]=_[_0xbb10('0x32')](_0x38d78f[_0xbb10('0x2f')],_0x38d78f[_0xbb10('0x31')]);_0x5d9a4f[_0xbb10('0x33')]=_[_0xbb10('0x32')](_0x38d78f[_0xbb10('0x2f')],qs[_0xbb10('0x34')](_0x202c60[_0xbb10('0x31')][_0xbb10('0x34')]));_0x5d9a4f[_0xbb10('0x33')]=_0x5d9a4f[_0xbb10('0x33')]['length']?_0x5d9a4f[_0xbb10('0x33')]:_0x38d78f[_0xbb10('0x2f')];if(_0x202c60['query'][_0xbb10('0x41')]){_0x5d9a4f[_0xbb10('0x42')]=[{'all':!![]}];}_0x5d9a4f=_[_0xbb10('0x3e')]({},_0x5d9a4f,_0x202c60[_0xbb10('0x3f')]);return db[_0xbb10('0x40')][_0xbb10('0x47')](_0x5d9a4f)[_0xbb10('0x23')](handleEntityNotFound(_0x54ac18,null))['then'](respondWithResult(_0x54ac18,null))['catch'](handleError(_0x54ac18,null));};exports[_0xbb10('0x48')]=function(_0x76a208,_0x2b12bd){return db['VoiceCallReport']['create'](_0x76a208[_0xbb10('0x49')],{})[_0xbb10('0x23')](respondWithResult(_0x2b12bd,0xc9))[_0xbb10('0x4a')](handleError(_0x2b12bd,null));};exports[_0xbb10('0x24')]=function(_0x10159b,_0x22b315){return db[_0xbb10('0x40')][_0xbb10('0x47')]({'where':{'id':_0x10159b[_0xbb10('0x4b')]['id']}})[_0xbb10('0x23')](handleEntityNotFound(_0x22b315,null))['then'](removeEntity(_0x22b315,null))['catch'](handleError(_0x22b315,null));};exports[_0xbb10('0x4c')]=function(_0x467dba,_0x36ab7d){return db[_0xbb10('0x40')][_0xbb10('0x4c')]()[_0xbb10('0x23')](respondWithResult(_0x36ab7d,null))[_0xbb10('0x4a')](handleError(_0x36ab7d,null));};exports[_0xbb10('0x22')]=function(_0x1c0d8f,_0x1214f7){if(_0x1c0d8f[_0xbb10('0x49')][_0xbb10('0x4d')]){delete _0x1c0d8f[_0xbb10('0x49')][_0xbb10('0x4d')];}return db[_0xbb10('0x40')]['find']({'where':{'uniqueid':_0x1c0d8f[_0xbb10('0x4b')]['id'],'UserId':{'$or':[null,_0x1c0d8f['user']['id']]}}})[_0xbb10('0x23')](handleEntityNotFound(_0x1214f7,null))[_0xbb10('0x23')](saveUpdates(_0x1c0d8f[_0xbb10('0x49')],null))[_0xbb10('0x23')](respondWithResult(_0x1214f7,null))[_0xbb10('0x4a')](handleError(_0x1214f7,null));}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.model.js b/server/api/voiceCallReport/voiceCallReport.model.js index 6b21aa7..d416011 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 _0x7c7c=['VoiceCallReport','report_call','uniqueid','lodash','util','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','./voiceCallReport.attributes','exports','define'];(function(_0x3805d7,_0x2b41dd){var _0x383027=function(_0x188696){while(--_0x188696){_0x3805d7['push'](_0x3805d7['shift']());}};_0x383027(++_0x2b41dd);}(_0x7c7c,0xd5));var _0xc7c7=function(_0x27d572,_0x20ef4a){_0x27d572=_0x27d572-0x0;var _0x1876ab=_0x7c7c[_0x27d572];return _0x1876ab;};'use strict';var _=require(_0xc7c7('0x0'));var util=require(_0xc7c7('0x1'));var logger=require(_0xc7c7('0x2'))(_0xc7c7('0x3'));var moment=require(_0xc7c7('0x4'));var BPromise=require('bluebird');var rp=require(_0xc7c7('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc7c7('0x6'));var config=require(_0xc7c7('0x7'));var attributes=require(_0xc7c7('0x8'));module[_0xc7c7('0x9')]=function(_0x5b8009,_0x30bc0d){return _0x5b8009[_0xc7c7('0xa')](_0xc7c7('0xb'),attributes,{'tableName':_0xc7c7('0xc'),'paranoid':![],'indexes':[{'fields':[_0xc7c7('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xce92=['path','exports','define','VoiceCallReport','report_call','uniqueid','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x2aecb2,_0x343312){var _0x3ebb80=function(_0x19fab3){while(--_0x19fab3){_0x2aecb2['push'](_0x2aecb2['shift']());}};_0x3ebb80(++_0x343312);}(_0xce92,0x186));var _0x2ce9=function(_0x2d2006,_0x2d27b3){_0x2d2006=_0x2d2006-0x0;var _0x442661=_0xce92[_0x2d2006];return _0x442661;};'use strict';var _=require(_0x2ce9('0x0'));var util=require('util');var logger=require(_0x2ce9('0x1'))(_0x2ce9('0x2'));var moment=require(_0x2ce9('0x3'));var BPromise=require(_0x2ce9('0x4'));var rp=require(_0x2ce9('0x5'));var fs=require('fs');var path=require(_0x2ce9('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./voiceCallReport.attributes');module[_0x2ce9('0x7')]=function(_0x52ae15,_0x2024b4){return _0x52ae15[_0x2ce9('0x8')](_0x2ce9('0x9'),attributes,{'tableName':_0x2ce9('0xa'),'paranoid':![],'indexes':[{'fields':[_0x2ce9('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.rpc.js b/server/api/voiceCallReport/voiceCallReport.rpc.js index 9a02201..4d0409a 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 _0x3e68=['UpdateVoiceCallReport','stringify','moment','ioredis','../../config/logger','../../config/environment','jayson/promise','client','then','info','VoiceCallReport,\x20%s,\x20%s','request\x20sent','debug','VoiceCallReport,\x20%s,\x20%s,\x20%s','error','code','message','catch','GetVoiceCallReport','findAll','options','raw','where','attributes','limit','include','map','model','CreateVoiceCallReport','VoiceCallReport','create','body'];(function(_0x30bd4d,_0x50eb60){var _0x306915=function(_0x5ae782){while(--_0x5ae782){_0x30bd4d['push'](_0x30bd4d['shift']());}};_0x306915(++_0x50eb60);}(_0x3e68,0x142));var _0x83e6=function(_0x4fa1e8,_0x20dd38){_0x4fa1e8=_0x4fa1e8-0x0;var _0x46cc1a=_0x3e68[_0x4fa1e8];return _0x46cc1a;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x83e6('0x0'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x83e6('0x1'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x83e6('0x2'))('rpc');var config=require(_0x83e6('0x3'));var jayson=require(_0x83e6('0x4'));var client=jayson[_0x83e6('0x5')]['http']({'port':0x232a});function respondWithRpcPromise(_0x52566e,_0xc31c7b,_0x141eef){return new BPromise(function(_0x48acad,_0x31393a){return client['request'](_0x52566e,_0x141eef)[_0x83e6('0x6')](function(_0x3d5423){logger[_0x83e6('0x7')](_0x83e6('0x8'),_0xc31c7b,_0x83e6('0x9'));logger[_0x83e6('0xa')](_0x83e6('0xb'),_0xc31c7b,_0x83e6('0x9'),JSON['stringify'](_0x3d5423));if(_0x3d5423[_0x83e6('0xc')]){if(_0x3d5423[_0x83e6('0xc')][_0x83e6('0xd')]===0x1f4){logger['error'](_0x83e6('0x8'),_0xc31c7b,_0x3d5423['error'][_0x83e6('0xe')]);return _0x31393a(_0x3d5423[_0x83e6('0xc')][_0x83e6('0xe')]);}logger[_0x83e6('0xc')](_0x83e6('0x8'),_0xc31c7b,_0x3d5423[_0x83e6('0xc')][_0x83e6('0xe')]);return _0x48acad(_0x3d5423['error']['message']);}else{logger['info']('VoiceCallReport,\x20%s,\x20%s',_0xc31c7b,_0x83e6('0x9'));_0x48acad(_0x3d5423['result'][_0x83e6('0xe')]);}})[_0x83e6('0xf')](function(_0x3f187b){logger[_0x83e6('0xc')]('VoiceCallReport,\x20%s,\x20%s',_0xc31c7b,_0x3f187b);_0x31393a(_0x3f187b);});});}exports[_0x83e6('0x10')]=function(_0x35d442){var _0x300000=this;return new Promise(function(_0x169076,_0x5cba8e){return db['VoiceCallReport'][_0x83e6('0x11')]({'raw':_0x35d442[_0x83e6('0x12')]?_0x35d442[_0x83e6('0x12')][_0x83e6('0x13')]===undefined?!![]:![]:!![],'where':_0x35d442[_0x83e6('0x12')]?_0x35d442[_0x83e6('0x12')][_0x83e6('0x14')]||null:null,'attributes':_0x35d442[_0x83e6('0x12')]?_0x35d442[_0x83e6('0x12')][_0x83e6('0x15')]||null:null,'limit':_0x35d442[_0x83e6('0x12')]?_0x35d442['options'][_0x83e6('0x16')]||null:null,'include':_0x35d442[_0x83e6('0x12')]?_0x35d442[_0x83e6('0x12')][_0x83e6('0x17')]?_['map'](_0x35d442[_0x83e6('0x12')][_0x83e6('0x17')],function(_0x304cd4){return{'model':db[_0x304cd4['model']],'as':_0x304cd4['as'],'attributes':_0x304cd4[_0x83e6('0x15')],'include':_0x304cd4[_0x83e6('0x17')]?_[_0x83e6('0x18')](_0x304cd4['include'],function(_0x291aa4){return{'model':db[_0x291aa4[_0x83e6('0x19')]],'as':_0x291aa4['as'],'attributes':_0x291aa4[_0x83e6('0x15')],'include':_0x291aa4[_0x83e6('0x17')]?_['map'](_0x291aa4[_0x83e6('0x17')],function(_0x57d638){return{'model':db[_0x57d638[_0x83e6('0x19')]],'as':_0x57d638['as'],'attributes':_0x57d638[_0x83e6('0x15')]};}):[]};}):[]};}):[]:[]})[_0x83e6('0x6')](function(_0x56a6d7){logger[_0x83e6('0x7')]('GetVoiceCallReport',_0x35d442);logger['debug'](_0x83e6('0x10'),_0x35d442,JSON['stringify'](_0x56a6d7));_0x169076(_0x56a6d7);})[_0x83e6('0xf')](function(_0xe7827d){logger[_0x83e6('0xc')](_0x83e6('0x10'),_0xe7827d[_0x83e6('0xe')],_0x35d442);_0x5cba8e(_0x300000[_0x83e6('0xc')](0x1f4,_0xe7827d[_0x83e6('0xe')]));});});};exports[_0x83e6('0x1a')]=function(_0x283dd4){var _0x4c3b97=this;return new Promise(function(_0x2c03b4,_0x410cf4){return db[_0x83e6('0x1b')][_0x83e6('0x1c')](_0x283dd4[_0x83e6('0x1d')],{'raw':_0x283dd4['options']?_0x283dd4[_0x83e6('0x12')][_0x83e6('0x13')]===undefined?!![]:![]:!![]})[_0x83e6('0x6')](function(_0x4ceb73){logger[_0x83e6('0x7')](_0x83e6('0x1a'),_0x283dd4);logger['debug']('CreateVoiceCallReport',_0x283dd4,JSON['stringify'](_0x4ceb73));_0x2c03b4(_0x4ceb73);})[_0x83e6('0xf')](function(_0x1e8312){logger['error']('CreateVoiceCallReport',_0x1e8312['message'],_0x283dd4);_0x410cf4(_0x4c3b97[_0x83e6('0xc')](0x1f4,_0x1e8312[_0x83e6('0xe')]));});});};exports[_0x83e6('0x1e')]=function(_0x252e7){var _0x301941=this;return new Promise(function(_0x327904,_0x3e1f0b){return db[_0x83e6('0x1b')]['update'](_0x252e7[_0x83e6('0x1d')],{'raw':_0x252e7[_0x83e6('0x12')]?_0x252e7[_0x83e6('0x12')][_0x83e6('0x13')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x252e7[_0x83e6('0x12')]?_0x252e7[_0x83e6('0x12')][_0x83e6('0x14')]||null:null,'attributes':_0x252e7[_0x83e6('0x12')]?_0x252e7['options'][_0x83e6('0x15')]||null:null,'limit':_0x252e7['options']?_0x252e7['options'][_0x83e6('0x16')]||null:null})['then'](function(_0x571989){logger[_0x83e6('0x7')](_0x83e6('0x1e'),_0x252e7);logger[_0x83e6('0xa')](_0x83e6('0x1e'),_0x252e7,JSON[_0x83e6('0x1f')](_0x571989));_0x327904(_0x571989);})[_0x83e6('0xf')](function(_0x598eed){logger['error'](_0x83e6('0x1e'),_0x598eed[_0x83e6('0xe')],_0x252e7);_0x3e1f0b(_0x301941[_0x83e6('0xc')](0x1f4,_0x598eed[_0x83e6('0xe')]));});});}; \ No newline at end of file +var _0xad01=['create','body','then','stringify','UpdateVoiceCallReport','update','where','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request\x20sent','VoiceCallReport,\x20%s,\x20%s,\x20%s','code','error','VoiceCallReport,\x20%s,\x20%s','message','info','result','catch','GetVoiceCallReport','VoiceCallReport','findAll','options','raw','attributes','limit','include','map','model','debug','CreateVoiceCallReport'];(function(_0x14e8f4,_0x3d052a){var _0x3d8914=function(_0x3772ae){while(--_0x3772ae){_0x14e8f4['push'](_0x14e8f4['shift']());}};_0x3d8914(++_0x3d052a);}(_0xad01,0x7f));var _0x1ad0=function(_0x158ff0,_0x3409ba){_0x158ff0=_0x158ff0-0x0;var _0x5864e5=_0xad01[_0x158ff0];return _0x5864e5;};'use strict';var _=require(_0x1ad0('0x0'));var util=require(_0x1ad0('0x1'));var moment=require(_0x1ad0('0x2'));var BPromise=require(_0x1ad0('0x3'));var rs=require(_0x1ad0('0x4'));var fs=require('fs');var Redis=require(_0x1ad0('0x5'));var db=require(_0x1ad0('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x1ad0('0x7'))('rpc');var config=require(_0x1ad0('0x8'));var jayson=require(_0x1ad0('0x9'));var client=jayson[_0x1ad0('0xa')][_0x1ad0('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4d041c,_0x543e09,_0x266d4d){return new BPromise(function(_0x4e545f,_0x39ae98){return client['request'](_0x4d041c,_0x266d4d)['then'](function(_0x32971f){logger['info']('VoiceCallReport,\x20%s,\x20%s',_0x543e09,_0x1ad0('0xc'));logger['debug'](_0x1ad0('0xd'),_0x543e09,'request\x20sent',JSON['stringify'](_0x32971f));if(_0x32971f['error']){if(_0x32971f['error'][_0x1ad0('0xe')]===0x1f4){logger[_0x1ad0('0xf')](_0x1ad0('0x10'),_0x543e09,_0x32971f[_0x1ad0('0xf')][_0x1ad0('0x11')]);return _0x39ae98(_0x32971f['error'][_0x1ad0('0x11')]);}logger[_0x1ad0('0xf')]('VoiceCallReport,\x20%s,\x20%s',_0x543e09,_0x32971f['error'][_0x1ad0('0x11')]);return _0x4e545f(_0x32971f['error'][_0x1ad0('0x11')]);}else{logger[_0x1ad0('0x12')](_0x1ad0('0x10'),_0x543e09,'request\x20sent');_0x4e545f(_0x32971f[_0x1ad0('0x13')]['message']);}})[_0x1ad0('0x14')](function(_0x45e49b){logger[_0x1ad0('0xf')](_0x1ad0('0x10'),_0x543e09,_0x45e49b);_0x39ae98(_0x45e49b);});});}exports[_0x1ad0('0x15')]=function(_0x22bb2d){var _0x405ef1=this;return new Promise(function(_0x9a4101,_0x396ff0){return db[_0x1ad0('0x16')][_0x1ad0('0x17')]({'raw':_0x22bb2d[_0x1ad0('0x18')]?_0x22bb2d['options'][_0x1ad0('0x19')]===undefined?!![]:![]:!![],'where':_0x22bb2d[_0x1ad0('0x18')]?_0x22bb2d['options']['where']||null:null,'attributes':_0x22bb2d[_0x1ad0('0x18')]?_0x22bb2d[_0x1ad0('0x18')][_0x1ad0('0x1a')]||null:null,'limit':_0x22bb2d[_0x1ad0('0x18')]?_0x22bb2d[_0x1ad0('0x18')][_0x1ad0('0x1b')]||null:null,'include':_0x22bb2d['options']?_0x22bb2d[_0x1ad0('0x18')][_0x1ad0('0x1c')]?_[_0x1ad0('0x1d')](_0x22bb2d[_0x1ad0('0x18')][_0x1ad0('0x1c')],function(_0x1d5e55){return{'model':db[_0x1d5e55['model']],'as':_0x1d5e55['as'],'attributes':_0x1d5e55['attributes'],'include':_0x1d5e55[_0x1ad0('0x1c')]?_[_0x1ad0('0x1d')](_0x1d5e55['include'],function(_0xc9f953){return{'model':db[_0xc9f953[_0x1ad0('0x1e')]],'as':_0xc9f953['as'],'attributes':_0xc9f953[_0x1ad0('0x1a')],'include':_0xc9f953['include']?_[_0x1ad0('0x1d')](_0xc9f953[_0x1ad0('0x1c')],function(_0xfbc9ae){return{'model':db[_0xfbc9ae['model']],'as':_0xfbc9ae['as'],'attributes':_0xfbc9ae[_0x1ad0('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5c6f77){logger[_0x1ad0('0x12')](_0x1ad0('0x15'),_0x22bb2d);logger[_0x1ad0('0x1f')](_0x1ad0('0x15'),_0x22bb2d,JSON['stringify'](_0x5c6f77));_0x9a4101(_0x5c6f77);})['catch'](function(_0x4bf787){logger['error'](_0x1ad0('0x15'),_0x4bf787['message'],_0x22bb2d);_0x396ff0(_0x405ef1[_0x1ad0('0xf')](0x1f4,_0x4bf787['message']));});});};exports[_0x1ad0('0x20')]=function(_0x3d8dcf){var _0xe38a62=this;return new Promise(function(_0x534252,_0x1ad6db){return db['VoiceCallReport'][_0x1ad0('0x21')](_0x3d8dcf[_0x1ad0('0x22')],{'raw':_0x3d8dcf[_0x1ad0('0x18')]?_0x3d8dcf[_0x1ad0('0x18')][_0x1ad0('0x19')]===undefined?!![]:![]:!![]})[_0x1ad0('0x23')](function(_0x5d5608){logger['info'](_0x1ad0('0x20'),_0x3d8dcf);logger[_0x1ad0('0x1f')]('CreateVoiceCallReport',_0x3d8dcf,JSON[_0x1ad0('0x24')](_0x5d5608));_0x534252(_0x5d5608);})['catch'](function(_0x31c147){logger[_0x1ad0('0xf')](_0x1ad0('0x20'),_0x31c147['message'],_0x3d8dcf);_0x1ad6db(_0xe38a62[_0x1ad0('0xf')](0x1f4,_0x31c147['message']));});});};exports[_0x1ad0('0x25')]=function(_0x1d24be){var _0x5d397c=this;return new Promise(function(_0x3fcae5,_0x3ec329){return db[_0x1ad0('0x16')][_0x1ad0('0x26')](_0x1d24be[_0x1ad0('0x22')],{'raw':_0x1d24be[_0x1ad0('0x18')]?_0x1d24be[_0x1ad0('0x18')][_0x1ad0('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1d24be[_0x1ad0('0x18')]?_0x1d24be[_0x1ad0('0x18')][_0x1ad0('0x27')]||null:null,'attributes':_0x1d24be[_0x1ad0('0x18')]?_0x1d24be[_0x1ad0('0x18')][_0x1ad0('0x1a')]||null:null,'limit':_0x1d24be['options']?_0x1d24be[_0x1ad0('0x18')][_0x1ad0('0x1b')]||null:null})[_0x1ad0('0x23')](function(_0x543ead){logger[_0x1ad0('0x12')]('UpdateVoiceCallReport',_0x1d24be);logger[_0x1ad0('0x1f')]('UpdateVoiceCallReport',_0x1d24be,JSON['stringify'](_0x543ead));_0x3fcae5(_0x543ead);})[_0x1ad0('0x14')](function(_0x3b9d6e){logger['error']('UpdateVoiceCallReport',_0x3b9d6e[_0x1ad0('0x11')],_0x1d24be);_0x3ec329(_0x5d397c[_0x1ad0('0xf')](0x1f4,_0x3b9d6e[_0x1ad0('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/index.js b/server/api/voiceChanSpy/index.js index 33f69d1..bf59d9a 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 _0x26f8=['../../config/environment','get','isAuthenticated','index','/:id','show','post','create','put','update','exports','multer','util','path','connect-timeout','express','fs-extra'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x26f8,0x12c));var _0x826f=function(_0x3cf387,_0x31ed26){_0x3cf387=_0x3cf387-0x0;var _0x24425f=_0x26f8[_0x3cf387];return _0x24425f;};'use strict';var multer=require(_0x826f('0x0'));var util=require(_0x826f('0x1'));var path=require(_0x826f('0x2'));var timeout=require(_0x826f('0x3'));var express=require(_0x826f('0x4'));var router=express['Router']();var fs_extra=require(_0x826f('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x826f('0x6'));var controller=require('./voiceChanSpy.controller');router[_0x826f('0x7')]('/',auth[_0x826f('0x8')](),controller[_0x826f('0x9')]);router['get'](_0x826f('0xa'),auth[_0x826f('0x8')](),controller[_0x826f('0xb')]);router[_0x826f('0xc')]('/',auth[_0x826f('0x8')](),controller[_0x826f('0xd')]);router[_0x826f('0xe')](_0x826f('0xa'),auth['isAuthenticated'](),controller[_0x826f('0xf')]);router['delete'](_0x826f('0xa'),auth[_0x826f('0x8')](),controller['destroy']);module[_0x826f('0x10')]=router; \ No newline at end of file +var _0xd96f=['get','isAuthenticated','index','/:id','show','create','put','update','exports','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./voiceChanSpy.controller'];(function(_0x455d9c,_0x9490ab){var _0x14f50c=function(_0x16f799){while(--_0x16f799){_0x455d9c['push'](_0x455d9c['shift']());}};_0x14f50c(++_0x9490ab);}(_0xd96f,0x1d9));var _0xfd96=function(_0x515013,_0x331ccc){_0x515013=_0x515013-0x0;var _0x48ba47=_0xd96f[_0x515013];return _0x48ba47;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xfd96('0x0'));var timeout=require(_0xfd96('0x1'));var express=require('express');var router=express[_0xfd96('0x2')]();var fs_extra=require(_0xfd96('0x3'));var auth=require(_0xfd96('0x4'));var interaction=require(_0xfd96('0x5'));var config=require('../../config/environment');var controller=require(_0xfd96('0x6'));router[_0xfd96('0x7')]('/',auth[_0xfd96('0x8')](),controller[_0xfd96('0x9')]);router[_0xfd96('0x7')](_0xfd96('0xa'),auth[_0xfd96('0x8')](),controller[_0xfd96('0xb')]);router['post']('/',auth[_0xfd96('0x8')](),controller[_0xfd96('0xc')]);router[_0xfd96('0xd')]('/:id',auth[_0xfd96('0x8')](),controller[_0xfd96('0xe')]);router['delete'](_0xfd96('0xa'),auth[_0xfd96('0x8')](),controller['destroy']);module[_0xfd96('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 45d9c25..81fc6b8 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 _0x54b3=['sequelize','exports','STRING','name','setDataValue','join','getDataValue','options','split','BOOLEAN'];(function(_0x264d50,_0x2532aa){var _0x15c756=function(_0x262b30){while(--_0x262b30){_0x264d50['push'](_0x264d50['shift']());}};_0x15c756(++_0x2532aa);}(_0x54b3,0xb4));var _0x354b=function(_0x4e808c,_0x3ebb84){_0x4e808c=_0x4e808c-0x0;var _0x1db4c6=_0x54b3[_0x4e808c];return _0x1db4c6;};'use strict';var Sequelize=require(_0x354b('0x0'));module[_0x354b('0x1')]={'name':{'type':Sequelize['STRING']},'prefix':{'type':Sequelize[_0x354b('0x2')],'unique':_0x354b('0x3'),'allowNull':![]},'options':{'type':Sequelize['STRING'],'set':function(_0x38f447){this[_0x354b('0x4')]('options',_0x38f447?_0x38f447[_0x354b('0x5')](''):[]);},'get':function(){return this[_0x354b('0x6')](_0x354b('0x7'))?this[_0x354b('0x6')](_0x354b('0x7'))[_0x354b('0x8')](''):[];}},'auth':{'type':Sequelize[_0x354b('0x9')],'defaultValue':![]},'password':{'type':Sequelize['STRING']},'record':{'type':Sequelize[_0x354b('0x9')],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0x354b('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xb964=['setDataValue','options','join','getDataValue','split','BOOLEAN','sequelize','exports','STRING','name'];(function(_0xe3bbea,_0x3ae4d3){var _0x18713d=function(_0x453117){while(--_0x453117){_0xe3bbea['push'](_0xe3bbea['shift']());}};_0x18713d(++_0x3ae4d3);}(_0xb964,0xec));var _0x4b96=function(_0x465858,_0x273fc9){_0x465858=_0x465858-0x0;var _0x42526f=_0xb964[_0x465858];return _0x42526f;};'use strict';var Sequelize=require(_0x4b96('0x0'));module[_0x4b96('0x1')]={'name':{'type':Sequelize[_0x4b96('0x2')]},'prefix':{'type':Sequelize[_0x4b96('0x2')],'unique':_0x4b96('0x3'),'allowNull':![]},'options':{'type':Sequelize[_0x4b96('0x2')],'set':function(_0x162a4e){this[_0x4b96('0x4')](_0x4b96('0x5'),_0x162a4e?_0x162a4e[_0x4b96('0x6')](''):[]);},'get':function(){return this[_0x4b96('0x7')](_0x4b96('0x5'))?this[_0x4b96('0x7')](_0x4b96('0x5'))[_0x4b96('0x8')](''):[];}},'auth':{'type':Sequelize[_0x4b96('0x9')],'defaultValue':![]},'password':{'type':Sequelize[_0x4b96('0x2')]},'record':{'type':Sequelize[_0x4b96('0x9')],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0x4b96('0x2')]},'description':{'type':Sequelize[_0x4b96('0x2')]}}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.controller.js b/server/api/voiceChanSpy/voiceChanSpy.controller.js index 856eabd..21a0a70 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 _0x257e=['../../mysqldb','status','end','json','offset','limit','save','update','then','get','ChanSpies','destroy','stack','name','index','map','VoiceChanSpy','type','key','model','filters','intersection','query','attributes','fields','length','order','sort','where','pick','merge','VIRTUAL','filter','options','count','includeAll','include','findAll','rows','params','keys','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util'];(function(_0x56418a,_0x19239b){var _0x50434c=function(_0x33a261){while(--_0x33a261){_0x56418a['push'](_0x56418a['shift']());}};_0x50434c(++_0x19239b);}(_0x257e,0x1dc));var _0xe257=function(_0x45f111,_0x3a1a4a){_0x45f111=_0x45f111-0x0;var _0x483508=_0x257e[_0x45f111];return _0x483508;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe257('0x0'));var zipdir=require(_0xe257('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe257('0x2'));var moment=require('moment');var BPromise=require(_0xe257('0x3'));var Mustache=require(_0xe257('0x4'));var util=require(_0xe257('0x5'));var path=require(_0xe257('0x6'));var sox=require('sox');var csv=require(_0xe257('0x7'));var ejs=require(_0xe257('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xe257('0x9'));var squel=require(_0xe257('0xa'));var crypto=require(_0xe257('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xe257('0xc'));var toCsv=require(_0xe257('0x7'));var querystring=require(_0xe257('0xd'));var Papa=require(_0xe257('0xe'));var Redis=require(_0xe257('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xe257('0x10'));var hardwareService=require(_0xe257('0x11'));var logger=require('../../config/logger')(_0xe257('0x12'));var utils=require(_0xe257('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0xe257('0x14'));var db=require(_0xe257('0x15'))['db'];function respondWithStatusCode(_0x8d4cee,_0x41b454){_0x41b454=_0x41b454||0xcc;return function(_0x2bc9a3){if(_0x2bc9a3){return _0x8d4cee['sendStatus'](_0x41b454);}return _0x8d4cee[_0xe257('0x16')](_0x41b454)[_0xe257('0x17')]();};}function respondWithResult(_0x49afa3,_0x273854){_0x273854=_0x273854||0xc8;return function(_0x441cde){if(_0x441cde){return _0x49afa3[_0xe257('0x16')](_0x273854)[_0xe257('0x18')](_0x441cde);}};}function respondWithFilteredResult(_0x1e34db,_0x44f6d8){return function(_0x44a016){if(_0x44a016){var _0x396be4=typeof _0x44f6d8[_0xe257('0x19')]==='undefined'&&typeof _0x44f6d8[_0xe257('0x1a')]==='undefined';var _0x2a1a10=_0x44a016['count'];var _0x481419=_0x396be4?0x0:_0x44f6d8[_0xe257('0x19')];var _0x56f1dc=_0x396be4?_0x44a016['count']:_0x44f6d8[_0xe257('0x19')]+_0x44f6d8['limit'];var _0x3d62ce;if(_0x56f1dc>=_0x2a1a10){_0x56f1dc=_0x2a1a10;_0x3d62ce=0xc8;}else{_0x3d62ce=0xce;}_0x1e34db[_0xe257('0x16')](_0x3d62ce);return _0x1e34db['set']('Content-Range',_0x481419+'-'+_0x56f1dc+'/'+_0x2a1a10)['json'](_0x44a016);}return null;};}function patchUpdates(_0x34033d){return function(_0x5ca40f){try{jsonpatch['apply'](_0x5ca40f,_0x34033d,!![]);}catch(_0x56fd6f){return BPromise['reject'](_0x56fd6f);}return _0x5ca40f[_0xe257('0x1b')]();};}function saveUpdates(_0x47f1ed,_0x2a2816){return function(_0x3a8bc6){if(_0x3a8bc6){return _0x3a8bc6[_0xe257('0x1c')](_0x47f1ed)[_0xe257('0x1d')](function(_0x5382ca){return _0x5382ca;});}return null;};}function removeEntity(_0x580365,_0x3bc026){return function(_0x11b467){if(_0x11b467){return _0x11b467['destroy']()['then'](function(){var _0x17be93=_0x11b467[_0xe257('0x1e')]({'plain':!![]});var _0x301fd4=_0xe257('0x1f');return db['UserProfileResource'][_0xe257('0x20')]({'where':{'type':_0x301fd4,'resourceId':_0x17be93['id']}})[_0xe257('0x1d')](function(){return _0x11b467;});})[_0xe257('0x1d')](function(){_0x580365[_0xe257('0x16')](0xcc)[_0xe257('0x17')]();});}};}function handleEntityNotFound(_0x5532d3,_0x1c3c8c){return function(_0x260baa){if(!_0x260baa){_0x5532d3['sendStatus'](0x194);}return _0x260baa;};}function handleError(_0x31a468,_0x5097cc){_0x5097cc=_0x5097cc||0x1f4;return function(_0x39a0f2){logger['error'](_0x39a0f2[_0xe257('0x21')]);if(_0x39a0f2[_0xe257('0x22')]){delete _0x39a0f2[_0xe257('0x22')];}_0x31a468['status'](_0x5097cc)['send'](_0x39a0f2);};}exports[_0xe257('0x23')]=function(_0x595c7a,_0x57812a){var _0x182edb={},_0x4d4a43={},_0x4202a0={'count':0x0,'rows':[]};var _0x4e3f0e=_[_0xe257('0x24')](db[_0xe257('0x25')]['rawAttributes'],function(_0x24c58e){return{'name':_0x24c58e['fieldName'],'type':_0x24c58e[_0xe257('0x26')][_0xe257('0x27')]};});_0x4d4a43[_0xe257('0x28')]=_[_0xe257('0x24')](_0x4e3f0e,_0xe257('0x22'));_0x4d4a43['query']=_['keys'](_0x595c7a['query']);_0x4d4a43[_0xe257('0x29')]=_[_0xe257('0x2a')](_0x4d4a43['model'],_0x4d4a43[_0xe257('0x2b')]);_0x182edb[_0xe257('0x2c')]=_[_0xe257('0x2a')](_0x4d4a43[_0xe257('0x28')],qs[_0xe257('0x2d')](_0x595c7a[_0xe257('0x2b')][_0xe257('0x2d')]));_0x182edb[_0xe257('0x2c')]=_0x182edb[_0xe257('0x2c')][_0xe257('0x2e')]?_0x182edb[_0xe257('0x2c')]:_0x4d4a43[_0xe257('0x28')];if(!_0x595c7a[_0xe257('0x2b')]['hasOwnProperty']('nolimit')){_0x182edb[_0xe257('0x1a')]=qs[_0xe257('0x1a')](_0x595c7a['query']['limit']);_0x182edb[_0xe257('0x19')]=qs[_0xe257('0x19')](_0x595c7a[_0xe257('0x2b')][_0xe257('0x19')]);}_0x182edb[_0xe257('0x2f')]=qs[_0xe257('0x30')](_0x595c7a[_0xe257('0x2b')][_0xe257('0x30')]);_0x182edb[_0xe257('0x31')]=qs[_0xe257('0x29')](_[_0xe257('0x32')](_0x595c7a['query'],_0x4d4a43[_0xe257('0x29')]),_0x4e3f0e);if(_0x595c7a[_0xe257('0x2b')]['filter']){_0x182edb[_0xe257('0x31')]=_[_0xe257('0x33')](_0x182edb['where'],{'$or':_[_0xe257('0x24')](_0x4e3f0e,function(_0x389c4e){if(_0x389c4e[_0xe257('0x26')]!==_0xe257('0x34')){var _0x7d47={};_0x7d47[_0x389c4e[_0xe257('0x22')]]={'$like':'%'+_0x595c7a[_0xe257('0x2b')][_0xe257('0x35')]+'%'};return _0x7d47;}})});}_0x182edb=_[_0xe257('0x33')]({},_0x182edb,_0x595c7a[_0xe257('0x36')]);var _0x390bfe={'where':_0x182edb[_0xe257('0x31')]};return db[_0xe257('0x25')][_0xe257('0x37')](_0x390bfe)[_0xe257('0x1d')](function(_0x54efe0){_0x4202a0[_0xe257('0x37')]=_0x54efe0;if(_0x595c7a[_0xe257('0x2b')][_0xe257('0x38')]){_0x182edb[_0xe257('0x39')]=[{'all':!![]}];}return db[_0xe257('0x25')][_0xe257('0x3a')](_0x182edb);})['then'](function(_0x4b9316){_0x4202a0[_0xe257('0x3b')]=_0x4b9316;return _0x4202a0;})[_0xe257('0x1d')](respondWithFilteredResult(_0x57812a,_0x182edb))['catch'](handleError(_0x57812a,null));};exports['show']=function(_0x496967,_0x35d78b){var _0x5651ad={'raw':![],'where':{'id':_0x496967[_0xe257('0x3c')]['id']}},_0x4b06a6={};_0x4b06a6[_0xe257('0x28')]=_[_0xe257('0x3d')](db['VoiceChanSpy']['rawAttributes']);_0x4b06a6[_0xe257('0x2b')]=_['keys'](_0x496967[_0xe257('0x2b')]);_0x4b06a6['filters']=_[_0xe257('0x2a')](_0x4b06a6[_0xe257('0x28')],_0x4b06a6[_0xe257('0x2b')]);_0x5651ad[_0xe257('0x2c')]=_['intersection'](_0x4b06a6['model'],qs[_0xe257('0x2d')](_0x496967[_0xe257('0x2b')][_0xe257('0x2d')]));_0x5651ad[_0xe257('0x2c')]=_0x5651ad['attributes'][_0xe257('0x2e')]?_0x5651ad[_0xe257('0x2c')]:_0x4b06a6[_0xe257('0x28')];if(_0x496967['query'][_0xe257('0x38')]){_0x5651ad[_0xe257('0x39')]=[{'all':!![]}];}_0x5651ad=_['merge']({},_0x5651ad,_0x496967['options']);return db[_0xe257('0x25')][_0xe257('0x3e')](_0x5651ad)[_0xe257('0x1d')](handleEntityNotFound(_0x35d78b,null))[_0xe257('0x1d')](respondWithResult(_0x35d78b,null))[_0xe257('0x3f')](handleError(_0x35d78b,null));};exports[_0xe257('0x40')]=function(_0x3aef54,_0x228b4b){return db[_0xe257('0x25')][_0xe257('0x40')](_0x3aef54[_0xe257('0x41')],{})['then'](function(_0x40f399){var _0x53d481=_0x3aef54[_0xe257('0x42')][_0xe257('0x1e')]({'plain':!![]});if(!_0x53d481)throw new Error(_0xe257('0x43'));if(_0x53d481[_0xe257('0x44')]===_0xe257('0x42')){var _0x4b8a7b=_0x40f399['get']({'plain':!![]});var _0x1e41cb='ChanSpies';return db['UserProfileSection'][_0xe257('0x3e')]({'where':{'name':_0x1e41cb,'userProfileId':_0x53d481['userProfileId']},'raw':!![]})[_0xe257('0x1d')](function(_0x4a2e7e){if(_0x4a2e7e&&_0x4a2e7e['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x4b8a7b['name'],'resourceId':_0x4b8a7b['id'],'type':_0x4a2e7e[_0xe257('0x22')],'sectionId':_0x4a2e7e['id']},{})[_0xe257('0x1d')](function(){return _0x40f399;});}else{return _0x40f399;}})[_0xe257('0x3f')](function(_0x115293){logger[_0xe257('0x45')](_0xe257('0x46'),_0x115293);throw _0x115293;});}return _0x40f399;})[_0xe257('0x1d')](respondWithResult(_0x228b4b,0xc9))[_0xe257('0x3f')](handleError(_0x228b4b,null));};exports['update']=function(_0x185e8f,_0x53a8a0){if(_0x185e8f[_0xe257('0x41')]['id']){delete _0x185e8f['body']['id'];}return db['VoiceChanSpy'][_0xe257('0x3e')]({'where':{'id':_0x185e8f[_0xe257('0x3c')]['id']}})['then'](handleEntityNotFound(_0x53a8a0,null))['then'](saveUpdates(_0x185e8f[_0xe257('0x41')],null))[_0xe257('0x1d')](respondWithResult(_0x53a8a0,null))['catch'](handleError(_0x53a8a0,null));};exports[_0xe257('0x20')]=function(_0x20695a,_0x1ce428){return db['VoiceChanSpy'][_0xe257('0x3e')]({'where':{'id':_0x20695a[_0xe257('0x3c')]['id']}})['then'](handleEntityNotFound(_0x1ce428,null))[_0xe257('0x1d')](removeEntity(_0x1ce428,null))[_0xe257('0x3f')](handleError(_0x1ce428,null));}; \ No newline at end of file +var _0xbf1a=['update','get','ChanSpies','UserProfileResource','then','error','name','send','VoiceChanSpy','rawAttributes','fieldName','key','model','map','keys','filters','query','attributes','intersection','fields','length','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','include','findAll','rows','show','params','find','create','body','user','autoAssociation','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','count','offset','limit','set','Content-Range','json','reject','save'];(function(_0x47408e,_0x481428){var _0x1636bc=function(_0x2fe7a6){while(--_0x2fe7a6){_0x47408e['push'](_0x47408e['shift']());}};_0x1636bc(++_0x481428);}(_0xbf1a,0x7c));var _0xabf1=function(_0x40ff03,_0x3a73f2){_0x40ff03=_0x40ff03-0x0;var _0x46b16=_0xbf1a[_0x40ff03];return _0x46b16;};'use strict';var emlformat=require(_0xabf1('0x0'));var rimraf=require(_0xabf1('0x1'));var zipdir=require(_0xabf1('0x2'));var jsonpatch=require(_0xabf1('0x3'));var rp=require(_0xabf1('0x4'));var moment=require('moment');var BPromise=require(_0xabf1('0x5'));var Mustache=require('mustache');var util=require(_0xabf1('0x6'));var path=require(_0xabf1('0x7'));var sox=require(_0xabf1('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xabf1('0x9'));var _=require('lodash');var squel=require(_0xabf1('0xa'));var crypto=require(_0xabf1('0xb'));var jsforce=require(_0xabf1('0xc'));var deskjs=require(_0xabf1('0xd'));var toCsv=require(_0xabf1('0xe'));var querystring=require(_0xabf1('0xf'));var Papa=require('papaparse');var Redis=require(_0xabf1('0x10'));var authService=require(_0xabf1('0x11'));var qs=require(_0xabf1('0x12'));var as=require(_0xabf1('0x13'));var hardwareService=require(_0xabf1('0x14'));var logger=require(_0xabf1('0x15'))('api');var utils=require(_0xabf1('0x16'));var config=require(_0xabf1('0x17'));var licenseUtil=require(_0xabf1('0x18'));var db=require(_0xabf1('0x19'))['db'];function respondWithStatusCode(_0x3e1738,_0x1186b7){_0x1186b7=_0x1186b7||0xcc;return function(_0x27ade4){if(_0x27ade4){return _0x3e1738[_0xabf1('0x1a')](_0x1186b7);}return _0x3e1738[_0xabf1('0x1b')](_0x1186b7)[_0xabf1('0x1c')]();};}function respondWithResult(_0x4cb7f7,_0x783976){_0x783976=_0x783976||0xc8;return function(_0xcbe7da){if(_0xcbe7da){return _0x4cb7f7[_0xabf1('0x1b')](_0x783976)['json'](_0xcbe7da);}};}function respondWithFilteredResult(_0x293110,_0x3dd81a){return function(_0x719d3e){if(_0x719d3e){var _0x3537e4=typeof _0x3dd81a['offset']===_0xabf1('0x1d')&&typeof _0x3dd81a['limit']===_0xabf1('0x1d');var _0x23093b=_0x719d3e[_0xabf1('0x1e')];var _0x363c21=_0x3537e4?0x0:_0x3dd81a[_0xabf1('0x1f')];var _0xd5dc16=_0x3537e4?_0x719d3e[_0xabf1('0x1e')]:_0x3dd81a[_0xabf1('0x1f')]+_0x3dd81a[_0xabf1('0x20')];var _0x18f315;if(_0xd5dc16>=_0x23093b){_0xd5dc16=_0x23093b;_0x18f315=0xc8;}else{_0x18f315=0xce;}_0x293110[_0xabf1('0x1b')](_0x18f315);return _0x293110[_0xabf1('0x21')](_0xabf1('0x22'),_0x363c21+'-'+_0xd5dc16+'/'+_0x23093b)[_0xabf1('0x23')](_0x719d3e);}return null;};}function patchUpdates(_0x367d7e){return function(_0x5a0413){try{jsonpatch['apply'](_0x5a0413,_0x367d7e,!![]);}catch(_0xa715e7){return BPromise[_0xabf1('0x24')](_0xa715e7);}return _0x5a0413[_0xabf1('0x25')]();};}function saveUpdates(_0x53e531,_0x216862){return function(_0x3fbce0){if(_0x3fbce0){return _0x3fbce0[_0xabf1('0x26')](_0x53e531)['then'](function(_0xb16c27){return _0xb16c27;});}return null;};}function removeEntity(_0x57fea6,_0x30fac8){return function(_0x551401){if(_0x551401){return _0x551401['destroy']()['then'](function(){var _0x29d5bf=_0x551401[_0xabf1('0x27')]({'plain':!![]});var _0x4939cd=_0xabf1('0x28');return db[_0xabf1('0x29')]['destroy']({'where':{'type':_0x4939cd,'resourceId':_0x29d5bf['id']}})['then'](function(){return _0x551401;});})[_0xabf1('0x2a')](function(){_0x57fea6[_0xabf1('0x1b')](0xcc)[_0xabf1('0x1c')]();});}};}function handleEntityNotFound(_0x420590,_0x136a1d){return function(_0x555593){if(!_0x555593){_0x420590[_0xabf1('0x1a')](0x194);}return _0x555593;};}function handleError(_0x51cab0,_0x315b40){_0x315b40=_0x315b40||0x1f4;return function(_0x5ddf0d){logger[_0xabf1('0x2b')](_0x5ddf0d['stack']);if(_0x5ddf0d[_0xabf1('0x2c')]){delete _0x5ddf0d[_0xabf1('0x2c')];}_0x51cab0[_0xabf1('0x1b')](_0x315b40)[_0xabf1('0x2d')](_0x5ddf0d);};}exports['index']=function(_0x2e3b6c,_0x45b960){var _0x4d3dd7={},_0xe9a38d={},_0x4d9208={'count':0x0,'rows':[]};var _0x5e3be3=_['map'](db[_0xabf1('0x2e')][_0xabf1('0x2f')],function(_0x1d0f54){return{'name':_0x1d0f54[_0xabf1('0x30')],'type':_0x1d0f54['type'][_0xabf1('0x31')]};});_0xe9a38d[_0xabf1('0x32')]=_[_0xabf1('0x33')](_0x5e3be3,_0xabf1('0x2c'));_0xe9a38d['query']=_[_0xabf1('0x34')](_0x2e3b6c['query']);_0xe9a38d[_0xabf1('0x35')]=_['intersection'](_0xe9a38d['model'],_0xe9a38d[_0xabf1('0x36')]);_0x4d3dd7[_0xabf1('0x37')]=_[_0xabf1('0x38')](_0xe9a38d[_0xabf1('0x32')],qs[_0xabf1('0x39')](_0x2e3b6c[_0xabf1('0x36')][_0xabf1('0x39')]));_0x4d3dd7[_0xabf1('0x37')]=_0x4d3dd7['attributes'][_0xabf1('0x3a')]?_0x4d3dd7[_0xabf1('0x37')]:_0xe9a38d['model'];if(!_0x2e3b6c['query']['hasOwnProperty'](_0xabf1('0x3b'))){_0x4d3dd7['limit']=qs[_0xabf1('0x20')](_0x2e3b6c[_0xabf1('0x36')][_0xabf1('0x20')]);_0x4d3dd7[_0xabf1('0x1f')]=qs['offset'](_0x2e3b6c[_0xabf1('0x36')]['offset']);}_0x4d3dd7[_0xabf1('0x3c')]=qs[_0xabf1('0x3d')](_0x2e3b6c[_0xabf1('0x36')][_0xabf1('0x3d')]);_0x4d3dd7['where']=qs[_0xabf1('0x35')](_[_0xabf1('0x3e')](_0x2e3b6c[_0xabf1('0x36')],_0xe9a38d[_0xabf1('0x35')]),_0x5e3be3);if(_0x2e3b6c[_0xabf1('0x36')][_0xabf1('0x3f')]){_0x4d3dd7[_0xabf1('0x40')]=_[_0xabf1('0x41')](_0x4d3dd7[_0xabf1('0x40')],{'$or':_[_0xabf1('0x33')](_0x5e3be3,function(_0x520916){if(_0x520916['type']!==_0xabf1('0x42')){var _0x7c5288={};_0x7c5288[_0x520916[_0xabf1('0x2c')]]={'$like':'%'+_0x2e3b6c[_0xabf1('0x36')][_0xabf1('0x3f')]+'%'};return _0x7c5288;}})});}_0x4d3dd7=_['merge']({},_0x4d3dd7,_0x2e3b6c[_0xabf1('0x43')]);var _0x4e8ac7={'where':_0x4d3dd7[_0xabf1('0x40')]};return db[_0xabf1('0x2e')][_0xabf1('0x1e')](_0x4e8ac7)[_0xabf1('0x2a')](function(_0x304f52){_0x4d9208[_0xabf1('0x1e')]=_0x304f52;if(_0x2e3b6c['query']['includeAll']){_0x4d3dd7[_0xabf1('0x44')]=[{'all':!![]}];}return db['VoiceChanSpy'][_0xabf1('0x45')](_0x4d3dd7);})[_0xabf1('0x2a')](function(_0x14368a){_0x4d9208[_0xabf1('0x46')]=_0x14368a;return _0x4d9208;})[_0xabf1('0x2a')](respondWithFilteredResult(_0x45b960,_0x4d3dd7))['catch'](handleError(_0x45b960,null));};exports[_0xabf1('0x47')]=function(_0x4375c2,_0x529308){var _0x379d8a={'raw':![],'where':{'id':_0x4375c2[_0xabf1('0x48')]['id']}},_0x3f969e={};_0x3f969e[_0xabf1('0x32')]=_['keys'](db[_0xabf1('0x2e')]['rawAttributes']);_0x3f969e[_0xabf1('0x36')]=_[_0xabf1('0x34')](_0x4375c2[_0xabf1('0x36')]);_0x3f969e['filters']=_[_0xabf1('0x38')](_0x3f969e[_0xabf1('0x32')],_0x3f969e['query']);_0x379d8a['attributes']=_[_0xabf1('0x38')](_0x3f969e[_0xabf1('0x32')],qs[_0xabf1('0x39')](_0x4375c2['query']['fields']));_0x379d8a['attributes']=_0x379d8a[_0xabf1('0x37')][_0xabf1('0x3a')]?_0x379d8a[_0xabf1('0x37')]:_0x3f969e[_0xabf1('0x32')];if(_0x4375c2['query']['includeAll']){_0x379d8a[_0xabf1('0x44')]=[{'all':!![]}];}_0x379d8a=_[_0xabf1('0x41')]({},_0x379d8a,_0x4375c2[_0xabf1('0x43')]);return db['VoiceChanSpy'][_0xabf1('0x49')](_0x379d8a)[_0xabf1('0x2a')](handleEntityNotFound(_0x529308,null))['then'](respondWithResult(_0x529308,null))['catch'](handleError(_0x529308,null));};exports['create']=function(_0x5b12e9,_0x4771b5){return db[_0xabf1('0x2e')][_0xabf1('0x4a')](_0x5b12e9[_0xabf1('0x4b')],{})[_0xabf1('0x2a')](function(_0x4677a9){var _0x2346cb=_0x5b12e9[_0xabf1('0x4c')][_0xabf1('0x27')]({'plain':!![]});if(!_0x2346cb)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2346cb['role']==='user'){var _0x5d0859=_0x4677a9[_0xabf1('0x27')]({'plain':!![]});var _0x565122=_0xabf1('0x28');return db['UserProfileSection']['find']({'where':{'name':_0x565122,'userProfileId':_0x2346cb['userProfileId']},'raw':!![]})['then'](function(_0x439c33){if(_0x439c33&&_0x439c33[_0xabf1('0x4d')]===0x0){return db[_0xabf1('0x29')][_0xabf1('0x4a')]({'name':_0x5d0859['name'],'resourceId':_0x5d0859['id'],'type':_0x439c33[_0xabf1('0x2c')],'sectionId':_0x439c33['id']},{})[_0xabf1('0x2a')](function(){return _0x4677a9;});}else{return _0x4677a9;}})[_0xabf1('0x4e')](function(_0x40210b){logger[_0xabf1('0x2b')](_0xabf1('0x4f'),_0x40210b);throw _0x40210b;});}return _0x4677a9;})[_0xabf1('0x2a')](respondWithResult(_0x4771b5,0xc9))['catch'](handleError(_0x4771b5,null));};exports[_0xabf1('0x26')]=function(_0x192d92,_0x1f1219){if(_0x192d92['body']['id']){delete _0x192d92['body']['id'];}return db[_0xabf1('0x2e')][_0xabf1('0x49')]({'where':{'id':_0x192d92['params']['id']}})['then'](handleEntityNotFound(_0x1f1219,null))[_0xabf1('0x2a')](saveUpdates(_0x192d92[_0xabf1('0x4b')],null))[_0xabf1('0x2a')](respondWithResult(_0x1f1219,null))[_0xabf1('0x4e')](handleError(_0x1f1219,null));};exports[_0xabf1('0x50')]=function(_0xf0bf7d,_0xbac2c9){return db[_0xabf1('0x2e')]['find']({'where':{'id':_0xf0bf7d['params']['id']}})['then'](handleEntityNotFound(_0xbac2c9,null))['then'](removeEntity(_0xbac2c9,null))[_0xabf1('0x4e')](handleError(_0xbac2c9,null));}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.model.js b/server/api/voiceChanSpy/voiceChanSpy.model.js index 6eb403b..bbf2440 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 _0x830f=['Set','CDR(type)=%s','chanspy','${UNIQUEID}.%s,a','recordingFormat','Authenticate','password','ChanSpy','SIP/%s,%s','options','join','record','StopMixMonitor','concat','internal','name','User','findAll','agent','catch','models','define','VoiceChanSpy','then','length','VoiceExtension','bulkCreate','destroy','lodash','./voiceChanSpy.attributes','context','format','%s%s','prefix','system','push','merge'];(function(_0x41a804,_0xcde371){var _0x26870d=function(_0x46fb2a){while(--_0x46fb2a){_0x41a804['push'](_0x41a804['shift']());}};_0x26870d(++_0xcde371);}(_0x830f,0x169));var _0xf830=function(_0x151d16,_0x229f24){_0x151d16=_0x151d16-0x0;var _0x5c1130=_0x830f[_0x151d16];return _0x5c1130;};'use strict';var _=require(_0xf830('0x0'));var util=require('util');var BPromise=require('bluebird');var attributes=require(_0xf830('0x1'));var getUserApplications=function(_0x33956a,_0x31c71f,_0x31efe8){var _0x21c954=0x1;var _0x7000f7=[];var _0x2933f6={'context':_0x31c71f[_0xf830('0x2')]||'from-sip','exten':util[_0xf830('0x3')](_0xf830('0x4'),_0x33956a[_0xf830('0x5')],_0x31efe8),'type':_0xf830('0x6'),'isApp':![],'ChanSpyId':_0x33956a['id'],'UserId':_0x31c71f['id']};_0x7000f7[_0xf830('0x7')](_[_0xf830('0x8')]({'app':_0xf830('0x9'),'appdata':util['format'](_0xf830('0xa'),_0xf830('0xb')),'priority':_0x21c954++},_0x2933f6));if(_0x33956a['record']){_0x7000f7[_0xf830('0x7')](_[_0xf830('0x8')]({'app':'MixMonitor','appdata':util['format'](_0xf830('0xc'),_0x33956a[_0xf830('0xd')]),'priority':_0x21c954++},_0x2933f6));}if(_0x33956a['auth']){_0x7000f7[_0xf830('0x7')](_[_0xf830('0x8')]({'app':_0xf830('0xe'),'appdata':_0x33956a[_0xf830('0xf')],'priority':_0x21c954++},_0x2933f6));}_0x7000f7['push'](_[_0xf830('0x8')]({'app':_0xf830('0x10'),'appdata':util[_0xf830('0x3')](_0xf830('0x11'),_0x31c71f['name'],_0x33956a[_0xf830('0x12')]?_0x33956a['options'][_0xf830('0x13')](''):''),'priority':_0x21c954++},_0x2933f6));if(_0x33956a[_0xf830('0x14')]){_0x7000f7[_0xf830('0x7')](_[_0xf830('0x8')]({'app':_0xf830('0x15'),'priority':_0x21c954++},_0x2933f6));}return _0x7000f7;};var getChanSpyApplications=function(_0x2fdee3,_0x1db931){var _0x5d502d=[];for(var _0x4e7813=0x0,_0x3effc2=0x1;_0x4e7813<_0x1db931['length'];_0x4e7813++,_0x3effc2=0x1){_0x5d502d=_0x5d502d[_0xf830('0x16')](getUserApplications(_0x2fdee3,_0x1db931[_0x4e7813],_0x1db931[_0x4e7813][_0xf830('0x17')]));if(_0x1db931[_0x4e7813][_0xf830('0x17')]!=_0x1db931[_0x4e7813][_0xf830('0x18')]){_0x5d502d=_0x5d502d[_0xf830('0x16')](getUserApplications(_0x2fdee3,_0x1db931[_0x4e7813],_0x1db931[_0x4e7813][_0xf830('0x18')]));}}return _0x5d502d;};var getChanSpyPromise=function(_0x44c677,_0x32740c){return new BPromise(function(_0x1be708,_0x4e7438){return _0x44c677[_0xf830('0x19')][_0xf830('0x1a')]({'attributes':['id',_0xf830('0x18'),_0xf830('0x17')],'where':{'role':_0xf830('0x1b'),'chanspy':!![]},'raw':!![]})['then'](function(_0x59ff25){if(_0x59ff25){return _0x1be708(getChanSpyApplications(_0x32740c,_0x59ff25));}return _0x1be708([]);})[_0xf830('0x1c')](function(_0x4a346d){_0x4e7438(_0x4a346d);});});};module['exports']=function(_0x2c051a,_0xc2722d){var _0x11e4a2=_0x2c051a[_0xf830('0x1d')];return _0x2c051a[_0xf830('0x1e')](_0xf830('0x1f'),attributes,{'tableName':'voice_chanspy','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x2a383b,_0x1a4272,_0x581276){return getChanSpyPromise(_0x11e4a2,_0x2a383b)[_0xf830('0x20')](function(_0x1d3daf){if(_0x1d3daf&&_0x1d3daf[_0xf830('0x21')]){return _0x11e4a2[_0xf830('0x22')][_0xf830('0x23')](_0x1d3daf);}})['then'](function(){_0x581276();})['catch'](function(_0x1b0b25){_0x581276(_0x1b0b25);});},'afterUpdate':function(_0x18245e,_0x35f6e9,_0xc372bc){return _0x11e4a2[_0xf830('0x22')][_0xf830('0x24')]({'where':{'ChanSpyId':_0x18245e['id']}})['then'](function(){return getChanSpyPromise(_0x11e4a2,_0x18245e);})[_0xf830('0x20')](function(_0x539d64){if(_0x539d64&&_0x539d64[_0xf830('0x21')]){return _0x11e4a2[_0xf830('0x22')][_0xf830('0x23')](_0x539d64);}})[_0xf830('0x20')](function(){_0xc372bc();})[_0xf830('0x1c')](function(_0x1ddf7f){_0xc372bc(_0x1ddf7f);});},'afterDestroy':function(_0x187c9f,_0x4c1758,_0x1678ba){return _0x11e4a2[_0xf830('0x22')][_0xf830('0x24')]({'where':{'ChanSpyId':_0x187c9f['id']}})[_0xf830('0x20')](function(){_0x1678ba();})[_0xf830('0x1c')](function(_0x215688){_0x1678ba(_0x215688);});}}});}; \ No newline at end of file +var _0x613d=['merge','Set','CDR(type)=%s','chanspy','record','MixMonitor','${UNIQUEID}.%s,a','recordingFormat','auth','Authenticate','password','ChanSpy','SIP/%s,%s','name','options','join','StopMixMonitor','length','concat','internal','User','findAll','agent','catch','models','define','VoiceChanSpy','voice_chanspy','then','VoiceExtension','bulkCreate','destroy','lodash','util','bluebird','./voiceChanSpy.attributes','context','from-sip','format','%s%s','prefix','system','push'];(function(_0x117276,_0x2c725e){var _0x51b05f=function(_0x3c933c){while(--_0x3c933c){_0x117276['push'](_0x117276['shift']());}};_0x51b05f(++_0x2c725e);}(_0x613d,0x76));var _0xd613=function(_0xb12603,_0x142505){_0xb12603=_0xb12603-0x0;var _0x2bdc24=_0x613d[_0xb12603];return _0x2bdc24;};'use strict';var _=require(_0xd613('0x0'));var util=require(_0xd613('0x1'));var BPromise=require(_0xd613('0x2'));var attributes=require(_0xd613('0x3'));var getUserApplications=function(_0x3c43db,_0x221a64,_0x3f7375){var _0x210133=0x1;var _0x15eb3f=[];var _0x1c7af2={'context':_0x221a64[_0xd613('0x4')]||_0xd613('0x5'),'exten':util[_0xd613('0x6')](_0xd613('0x7'),_0x3c43db[_0xd613('0x8')],_0x3f7375),'type':_0xd613('0x9'),'isApp':![],'ChanSpyId':_0x3c43db['id'],'UserId':_0x221a64['id']};_0x15eb3f[_0xd613('0xa')](_[_0xd613('0xb')]({'app':_0xd613('0xc'),'appdata':util[_0xd613('0x6')](_0xd613('0xd'),_0xd613('0xe')),'priority':_0x210133++},_0x1c7af2));if(_0x3c43db[_0xd613('0xf')]){_0x15eb3f[_0xd613('0xa')](_[_0xd613('0xb')]({'app':_0xd613('0x10'),'appdata':util[_0xd613('0x6')](_0xd613('0x11'),_0x3c43db[_0xd613('0x12')]),'priority':_0x210133++},_0x1c7af2));}if(_0x3c43db[_0xd613('0x13')]){_0x15eb3f['push'](_[_0xd613('0xb')]({'app':_0xd613('0x14'),'appdata':_0x3c43db[_0xd613('0x15')],'priority':_0x210133++},_0x1c7af2));}_0x15eb3f[_0xd613('0xa')](_['merge']({'app':_0xd613('0x16'),'appdata':util[_0xd613('0x6')](_0xd613('0x17'),_0x221a64[_0xd613('0x18')],_0x3c43db['options']?_0x3c43db[_0xd613('0x19')][_0xd613('0x1a')](''):''),'priority':_0x210133++},_0x1c7af2));if(_0x3c43db[_0xd613('0xf')]){_0x15eb3f[_0xd613('0xa')](_[_0xd613('0xb')]({'app':_0xd613('0x1b'),'priority':_0x210133++},_0x1c7af2));}return _0x15eb3f;};var getChanSpyApplications=function(_0x5942a6,_0x3470ad){var _0x5cdd77=[];for(var _0x4ca388=0x0,_0x4112e6=0x1;_0x4ca388<_0x3470ad[_0xd613('0x1c')];_0x4ca388++,_0x4112e6=0x1){_0x5cdd77=_0x5cdd77[_0xd613('0x1d')](getUserApplications(_0x5942a6,_0x3470ad[_0x4ca388],_0x3470ad[_0x4ca388][_0xd613('0x1e')]));if(_0x3470ad[_0x4ca388]['internal']!=_0x3470ad[_0x4ca388][_0xd613('0x18')]){_0x5cdd77=_0x5cdd77['concat'](getUserApplications(_0x5942a6,_0x3470ad[_0x4ca388],_0x3470ad[_0x4ca388][_0xd613('0x18')]));}}return _0x5cdd77;};var getChanSpyPromise=function(_0x41dfe8,_0x11fb41){return new BPromise(function(_0x5248a9,_0x18fe6e){return _0x41dfe8[_0xd613('0x1f')][_0xd613('0x20')]({'attributes':['id','name',_0xd613('0x1e')],'where':{'role':_0xd613('0x21'),'chanspy':!![]},'raw':!![]})['then'](function(_0x988d66){if(_0x988d66){return _0x5248a9(getChanSpyApplications(_0x11fb41,_0x988d66));}return _0x5248a9([]);})[_0xd613('0x22')](function(_0x55f8fb){_0x18fe6e(_0x55f8fb);});});};module['exports']=function(_0x3fed93,_0x55083a){var _0x3394c3=_0x3fed93[_0xd613('0x23')];return _0x3fed93[_0xd613('0x24')](_0xd613('0x25'),attributes,{'tableName':_0xd613('0x26'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x4eda8b,_0x31f0d6,_0x1de304){return getChanSpyPromise(_0x3394c3,_0x4eda8b)[_0xd613('0x27')](function(_0x844827){if(_0x844827&&_0x844827[_0xd613('0x1c')]){return _0x3394c3[_0xd613('0x28')][_0xd613('0x29')](_0x844827);}})[_0xd613('0x27')](function(){_0x1de304();})['catch'](function(_0xe13e31){_0x1de304(_0xe13e31);});},'afterUpdate':function(_0x527140,_0x3288dc,_0x418b50){return _0x3394c3[_0xd613('0x28')][_0xd613('0x2a')]({'where':{'ChanSpyId':_0x527140['id']}})[_0xd613('0x27')](function(){return getChanSpyPromise(_0x3394c3,_0x527140);})[_0xd613('0x27')](function(_0x1bd8d2){if(_0x1bd8d2&&_0x1bd8d2[_0xd613('0x1c')]){return _0x3394c3['VoiceExtension'][_0xd613('0x29')](_0x1bd8d2);}})[_0xd613('0x27')](function(){_0x418b50();})[_0xd613('0x22')](function(_0x13c7c6){_0x418b50(_0x13c7c6);});},'afterDestroy':function(_0x44753e,_0x4ec84a,_0x22f0a8){return _0x3394c3[_0xd613('0x28')][_0xd613('0x2a')]({'where':{'ChanSpyId':_0x44753e['id']}})[_0xd613('0x27')](function(){_0x22f0a8();})['catch'](function(_0x2dcfb1){_0x22f0a8(_0x2dcfb1);});}}});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.rpc.js b/server/api/voiceChanSpy/voiceChanSpy.rpc.js index 08bc179..6e9ce23 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 _0x407f=['rpc','../../config/environment','jayson/promise','client','http','then','info','VoiceChanSpy,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x50cd41,_0x4874a7){var _0x399475=function(_0x1946da){while(--_0x1946da){_0x50cd41['push'](_0x50cd41['shift']());}};_0x399475(++_0x4874a7);}(_0x407f,0xc2));var _0xf407=function(_0x151f09,_0x45c6af){_0x151f09=_0x151f09-0x0;var _0x1bb92e=_0x407f[_0x151f09];return _0x1bb92e;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0xf407('0x0'));var rs=require(_0xf407('0x1'));var fs=require('fs');var Redis=require(_0xf407('0x2'));var db=require(_0xf407('0x3'))['db'];var utils=require(_0xf407('0x4'));var logger=require(_0xf407('0x5'))(_0xf407('0x6'));var config=require(_0xf407('0x7'));var jayson=require(_0xf407('0x8'));var client=jayson[_0xf407('0x9')][_0xf407('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2bce9d,_0x2d4ec6,_0x3ac774){return new BPromise(function(_0x38ee37,_0x3ab539){return client['request'](_0x2bce9d,_0x3ac774)[_0xf407('0xb')](function(_0xc3473a){logger[_0xf407('0xc')](_0xf407('0xd'),_0x2d4ec6,'request\x20sent');logger['debug']('VoiceChanSpy,\x20%s,\x20%s,\x20%s',_0x2d4ec6,_0xf407('0xe'),JSON[_0xf407('0xf')](_0xc3473a));if(_0xc3473a[_0xf407('0x10')]){if(_0xc3473a[_0xf407('0x10')][_0xf407('0x11')]===0x1f4){logger['error'](_0xf407('0xd'),_0x2d4ec6,_0xc3473a[_0xf407('0x10')][_0xf407('0x12')]);return _0x3ab539(_0xc3473a[_0xf407('0x10')][_0xf407('0x12')]);}logger[_0xf407('0x10')](_0xf407('0xd'),_0x2d4ec6,_0xc3473a[_0xf407('0x10')]['message']);return _0x38ee37(_0xc3473a['error'][_0xf407('0x12')]);}else{logger['info'](_0xf407('0xd'),_0x2d4ec6,'request\x20sent');_0x38ee37(_0xc3473a['result'][_0xf407('0x12')]);}})[_0xf407('0x13')](function(_0x1cdc81){logger[_0xf407('0x10')](_0xf407('0xd'),_0x2d4ec6,_0x1cdc81);_0x3ab539(_0x1cdc81);});});} \ No newline at end of file +var _0x91a7=['message','VoiceChanSpy,\x20%s,\x20%s','catch','util','moment','bluebird','ioredis','../../config/utils','../../config/environment','jayson/promise','http','request','then','info','request\x20sent','debug','stringify','error','code'];(function(_0x298bb1,_0x1f5213){var _0x477643=function(_0x3c30ef){while(--_0x3c30ef){_0x298bb1['push'](_0x298bb1['shift']());}};_0x477643(++_0x1f5213);}(_0x91a7,0xe7));var _0x791a=function(_0x184c04,_0x3579ff){_0x184c04=_0x184c04-0x0;var _0x2a91d6=_0x91a7[_0x184c04];return _0x2a91d6;};'use strict';var _=require('lodash');var util=require(_0x791a('0x0'));var moment=require(_0x791a('0x1'));var BPromise=require(_0x791a('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x791a('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x791a('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x791a('0x5'));var jayson=require(_0x791a('0x6'));var client=jayson['client'][_0x791a('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x5db6db,_0x33baac,_0x159e24){return new BPromise(function(_0x5aa10a,_0x1a32b4){return client[_0x791a('0x8')](_0x5db6db,_0x159e24)[_0x791a('0x9')](function(_0x80ff65){logger[_0x791a('0xa')]('VoiceChanSpy,\x20%s,\x20%s',_0x33baac,_0x791a('0xb'));logger[_0x791a('0xc')]('VoiceChanSpy,\x20%s,\x20%s,\x20%s',_0x33baac,_0x791a('0xb'),JSON[_0x791a('0xd')](_0x80ff65));if(_0x80ff65[_0x791a('0xe')]){if(_0x80ff65[_0x791a('0xe')][_0x791a('0xf')]===0x1f4){logger[_0x791a('0xe')]('VoiceChanSpy,\x20%s,\x20%s',_0x33baac,_0x80ff65['error'][_0x791a('0x10')]);return _0x1a32b4(_0x80ff65[_0x791a('0xe')]['message']);}logger[_0x791a('0xe')](_0x791a('0x11'),_0x33baac,_0x80ff65['error'][_0x791a('0x10')]);return _0x5aa10a(_0x80ff65[_0x791a('0xe')][_0x791a('0x10')]);}else{logger[_0x791a('0xa')]('VoiceChanSpy,\x20%s,\x20%s',_0x33baac,_0x791a('0xb'));_0x5aa10a(_0x80ff65['result'][_0x791a('0x10')]);}})[_0x791a('0x12')](function(_0x49ae3e){logger[_0x791a('0xe')]('VoiceChanSpy,\x20%s,\x20%s',_0x33baac,_0x49ae3e);_0x1a32b4(_0x49ae3e);});});} \ No newline at end of file diff --git a/server/api/voiceContext/index.js b/server/api/voiceContext/index.js index f4652d0..dc6fe43 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 _0xdae7=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceContext.controller','get','isAuthenticated','/:id','show','post','update','delete','destroy','exports','util'];(function(_0x57e1cc,_0x2395de){var _0x24c35f=function(_0x1810da){while(--_0x1810da){_0x57e1cc['push'](_0x57e1cc['shift']());}};_0x24c35f(++_0x2395de);}(_0xdae7,0x1da));var _0x7dae=function(_0x4322c6,_0x28f126){_0x4322c6=_0x4322c6-0x0;var _0x4e7537=_0xdae7[_0x4322c6];return _0x4e7537;};'use strict';var multer=require('multer');var util=require(_0x7dae('0x0'));var path=require(_0x7dae('0x1'));var timeout=require(_0x7dae('0x2'));var express=require(_0x7dae('0x3'));var router=express[_0x7dae('0x4')]();var fs_extra=require(_0x7dae('0x5'));var auth=require(_0x7dae('0x6'));var interaction=require(_0x7dae('0x7'));var config=require(_0x7dae('0x8'));var controller=require(_0x7dae('0x9'));router[_0x7dae('0xa')]('/',auth[_0x7dae('0xb')](),controller['index']);router[_0x7dae('0xa')](_0x7dae('0xc'),auth['isAuthenticated'](),controller[_0x7dae('0xd')]);router[_0x7dae('0xe')]('/',auth[_0x7dae('0xb')](),controller['create']);router['put'](_0x7dae('0xc'),auth[_0x7dae('0xb')](),controller[_0x7dae('0xf')]);router[_0x7dae('0x10')](_0x7dae('0xc'),auth[_0x7dae('0xb')](),controller[_0x7dae('0x11')]);module[_0x7dae('0x12')]=router; \ No newline at end of file +var _0x4952=['util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceContext.controller','isAuthenticated','index','/:id','create','update','delete','destroy','exports'];(function(_0x327040,_0x6f7206){var _0x201070=function(_0x33f64d){while(--_0x33f64d){_0x327040['push'](_0x327040['shift']());}};_0x201070(++_0x6f7206);}(_0x4952,0x187));var _0x2495=function(_0x4d40dd,_0x39592b){_0x4d40dd=_0x4d40dd-0x0;var _0x1c51f2=_0x4952[_0x4d40dd];return _0x1c51f2;};'use strict';var multer=require('multer');var util=require(_0x2495('0x0'));var path=require(_0x2495('0x1'));var timeout=require(_0x2495('0x2'));var express=require(_0x2495('0x3'));var router=express[_0x2495('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x2495('0x5'));var interaction=require(_0x2495('0x6'));var config=require(_0x2495('0x7'));var controller=require(_0x2495('0x8'));router['get']('/',auth[_0x2495('0x9')](),controller[_0x2495('0xa')]);router['get'](_0x2495('0xb'),auth[_0x2495('0x9')](),controller['show']);router['post']('/',auth[_0x2495('0x9')](),controller[_0x2495('0xc')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0x2495('0xd')]);router[_0x2495('0xe')](_0x2495('0xb'),auth[_0x2495('0x9')](),controller[_0x2495('0xf')]);module[_0x2495('0x10')]=router; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.attributes.js b/server/api/voiceContext/voiceContext.attributes.js index 56b87b9..2933bf6 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 _0x4d89=['sequelize','exports','STRING','BOOLEAN'];(function(_0x50534b,_0x5d675a){var _0xfa6bde=function(_0x2b67dc){while(--_0x2b67dc){_0x50534b['push'](_0x50534b['shift']());}};_0xfa6bde(++_0x5d675a);}(_0x4d89,0x158));var _0x94d8=function(_0x15c5c7,_0x3b5f26){_0x15c5c7=_0x15c5c7-0x0;var _0x47c0f3=_0x4d89[_0x15c5c7];return _0x47c0f3;};'use strict';var Sequelize=require(_0x94d8('0x0'));module[_0x94d8('0x1')]={'name':{'type':Sequelize[_0x94d8('0x2')],'unique':'name'},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0x94d8('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0x0046=['name','STRING'];(function(_0x1694f5,_0x49b7c3){var _0x5b4321=function(_0x58c183){while(--_0x58c183){_0x1694f5['push'](_0x1694f5['shift']());}};_0x5b4321(++_0x49b7c3);}(_0x0046,0x8f));var _0x6004=function(_0x726230,_0x365d10){_0x726230=_0x726230-0x0;var _0x2bf5f1=_0x0046[_0x726230];return _0x2bf5f1;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x6004('0x0')],'unique':_0x6004('0x1')},'description':{'type':Sequelize[_0x6004('0x0')],'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 c37148c..1bae635 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 _0xed47=['Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','jayson/promise','client','http','request','then','info','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','get','UserProfileResource','destroy','name','map','VoiceContext','rawAttributes','fieldName','key','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','type','VIRTUAL','merge','options','includeAll','include','show','params','length','find','create','body','readFileSync','join','root','server/files/templates/context.ejs','utf8','render','writeFileSync','/etc/asterisk/extensions_xcally_contexts.conf','Reload','chan_sip.so'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0xed47,0x139));var _0x7ed4=function(_0x18805f,_0x9973b){_0x18805f=_0x18805f-0x0;var _0x54edbb=_0xed47[_0x18805f];return _0x54edbb;};'use strict';var emlformat=require(_0x7ed4('0x0'));var rimraf=require(_0x7ed4('0x1'));var zipdir=require(_0x7ed4('0x2'));var jsonpatch=require(_0x7ed4('0x3'));var rp=require(_0x7ed4('0x4'));var moment=require('moment');var BPromise=require(_0x7ed4('0x5'));var Mustache=require(_0x7ed4('0x6'));var util=require(_0x7ed4('0x7'));var path=require(_0x7ed4('0x8'));var sox=require(_0x7ed4('0x9'));var csv=require(_0x7ed4('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7ed4('0xb'));var _=require(_0x7ed4('0xc'));var squel=require(_0x7ed4('0xd'));var crypto=require('crypto');var jsforce=require(_0x7ed4('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x7ed4('0xa'));var querystring=require(_0x7ed4('0xf'));var Papa=require('papaparse');var Redis=require(_0x7ed4('0x10'));var authService=require(_0x7ed4('0x11'));var qs=require(_0x7ed4('0x12'));var as=require(_0x7ed4('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7ed4('0x14'))('api');var utils=require(_0x7ed4('0x15'));var config=require(_0x7ed4('0x16'));var licenseUtil=require(_0x7ed4('0x17'));var db=require('../../mysqldb')['db'];var jayson=require(_0x7ed4('0x18'));var client=jayson[_0x7ed4('0x19')][_0x7ed4('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x1df8d7,_0x2c778c,_0x2f7bd7,_0x5204f0){return new BPromise(function(_0x4c4a6f,_0x547b7b){var _0x2ad845=_0x5204f0||client;return _0x2ad845[_0x7ed4('0x1b')](_0x1df8d7,_0x2f7bd7)[_0x7ed4('0x1c')](function(_0x58b12f){logger[_0x7ed4('0x1d')](_0x7ed4('0x1e'),_0x2c778c,_0x7ed4('0x1f'));logger[_0x7ed4('0x20')](_0x7ed4('0x21'),_0x2c778c,'request\x20sent',JSON[_0x7ed4('0x22')](_0x58b12f));if(_0x58b12f[_0x7ed4('0x23')]){if(_0x58b12f['error'][_0x7ed4('0x24')]===0x1f4){logger[_0x7ed4('0x23')](_0x7ed4('0x1e'),_0x2c778c,_0x58b12f[_0x7ed4('0x23')][_0x7ed4('0x25')]);return _0x547b7b(_0x58b12f[_0x7ed4('0x23')]['message']);}logger[_0x7ed4('0x23')]('VoiceContext,\x20%s,\x20%s',_0x2c778c,_0x58b12f['error'][_0x7ed4('0x25')]);return _0x4c4a6f(_0x58b12f[_0x7ed4('0x23')][_0x7ed4('0x25')]);}else{logger[_0x7ed4('0x1d')](_0x7ed4('0x1e'),_0x2c778c,'request\x20sent');_0x4c4a6f(_0x58b12f[_0x7ed4('0x26')][_0x7ed4('0x25')]);}})[_0x7ed4('0x27')](function(_0x25c306){logger[_0x7ed4('0x23')](_0x7ed4('0x1e'),_0x2c778c,_0x25c306);_0x547b7b(_0x25c306);});});}function respondWithStatusCode(_0x48536d,_0x10189b){_0x10189b=_0x10189b||0xcc;return function(_0x2cb62b){if(_0x2cb62b){return _0x48536d[_0x7ed4('0x28')](_0x10189b);}return _0x48536d[_0x7ed4('0x29')](_0x10189b)[_0x7ed4('0x2a')]();};}function respondWithResult(_0x19202f,_0x4b1496){_0x4b1496=_0x4b1496||0xc8;return function(_0x28022e){if(_0x28022e){return _0x19202f[_0x7ed4('0x29')](_0x4b1496)[_0x7ed4('0x2b')](_0x28022e);}};}function respondWithFilteredResult(_0x841737,_0x3a9d77){return function(_0xe81438){if(_0xe81438){var _0x456008=typeof _0x3a9d77[_0x7ed4('0x2c')]===_0x7ed4('0x2d')&&typeof _0x3a9d77[_0x7ed4('0x2e')]==='undefined';var _0x5c2eb2=_0xe81438['count'];var _0x2691c8=_0x456008?0x0:_0x3a9d77[_0x7ed4('0x2c')];var _0x213c73=_0x456008?_0xe81438[_0x7ed4('0x2f')]:_0x3a9d77[_0x7ed4('0x2c')]+_0x3a9d77[_0x7ed4('0x2e')];var _0xc3fc27;if(_0x213c73>=_0x5c2eb2){_0x213c73=_0x5c2eb2;_0xc3fc27=0xc8;}else{_0xc3fc27=0xce;}_0x841737[_0x7ed4('0x29')](_0xc3fc27);return _0x841737[_0x7ed4('0x30')]('Content-Range',_0x2691c8+'-'+_0x213c73+'/'+_0x5c2eb2)[_0x7ed4('0x2b')](_0xe81438);}return null;};}function patchUpdates(_0x2946d3){return function(_0x1970e6){try{jsonpatch[_0x7ed4('0x31')](_0x1970e6,_0x2946d3,!![]);}catch(_0x46a8b8){return BPromise[_0x7ed4('0x32')](_0x46a8b8);}return _0x1970e6[_0x7ed4('0x33')]();};}function saveUpdates(_0x3117bf,_0x4dc235){return function(_0x3609a9){if(_0x3609a9){return _0x3609a9['update'](_0x3117bf)[_0x7ed4('0x1c')](function(_0x33092f){return _0x33092f;});}return null;};}function removeEntity(_0x5b6226,_0x104177){return function(_0x2bb576){if(_0x2bb576){return _0x2bb576['destroy']()[_0x7ed4('0x1c')](function(){var _0x40ff39=_0x2bb576[_0x7ed4('0x34')]({'plain':!![]});var _0x58286c='Contexts';return db[_0x7ed4('0x35')][_0x7ed4('0x36')]({'where':{'type':_0x58286c,'resourceId':_0x40ff39['id']}})[_0x7ed4('0x1c')](function(){return _0x2bb576;});})['then'](function(){_0x5b6226['status'](0xcc)[_0x7ed4('0x2a')]();});}};}function handleEntityNotFound(_0x32ad33,_0x232049){return function(_0xdb9efc){if(!_0xdb9efc){_0x32ad33['sendStatus'](0x194);}return _0xdb9efc;};}function handleError(_0x559a3e,_0x2406e8){_0x2406e8=_0x2406e8||0x1f4;return function(_0x27467c){logger[_0x7ed4('0x23')](_0x27467c['stack']);if(_0x27467c[_0x7ed4('0x37')]){delete _0x27467c[_0x7ed4('0x37')];}_0x559a3e[_0x7ed4('0x29')](_0x2406e8)['send'](_0x27467c);};}exports['index']=function(_0x424910,_0x1eed19){var _0x27b2fb={},_0x155c83={},_0x31d63c={'count':0x0,'rows':[]};var _0x4216b8=_[_0x7ed4('0x38')](db[_0x7ed4('0x39')][_0x7ed4('0x3a')],function(_0x149d6e){return{'name':_0x149d6e[_0x7ed4('0x3b')],'type':_0x149d6e['type'][_0x7ed4('0x3c')]};});_0x155c83[_0x7ed4('0x3d')]=_[_0x7ed4('0x38')](_0x4216b8,'name');_0x155c83['query']=_[_0x7ed4('0x3e')](_0x424910[_0x7ed4('0x3f')]);_0x155c83[_0x7ed4('0x40')]=_[_0x7ed4('0x41')](_0x155c83[_0x7ed4('0x3d')],_0x155c83[_0x7ed4('0x3f')]);_0x27b2fb[_0x7ed4('0x42')]=_[_0x7ed4('0x41')](_0x155c83['model'],qs[_0x7ed4('0x43')](_0x424910['query'][_0x7ed4('0x43')]));_0x27b2fb['attributes']=_0x27b2fb[_0x7ed4('0x42')]['length']?_0x27b2fb['attributes']:_0x155c83[_0x7ed4('0x3d')];if(!_0x424910[_0x7ed4('0x3f')][_0x7ed4('0x44')](_0x7ed4('0x45'))){_0x27b2fb[_0x7ed4('0x2e')]=qs[_0x7ed4('0x2e')](_0x424910[_0x7ed4('0x3f')]['limit']);_0x27b2fb[_0x7ed4('0x2c')]=qs['offset'](_0x424910[_0x7ed4('0x3f')][_0x7ed4('0x2c')]);}_0x27b2fb[_0x7ed4('0x46')]=qs['sort'](_0x424910[_0x7ed4('0x3f')][_0x7ed4('0x47')]);_0x27b2fb[_0x7ed4('0x48')]=qs['filters'](_['pick'](_0x424910[_0x7ed4('0x3f')],_0x155c83[_0x7ed4('0x40')]),_0x4216b8);if(_0x424910[_0x7ed4('0x3f')]['filter']){_0x27b2fb[_0x7ed4('0x48')]=_['merge'](_0x27b2fb['where'],{'$or':_['map'](_0x4216b8,function(_0x5d4ce9){if(_0x5d4ce9[_0x7ed4('0x49')]!==_0x7ed4('0x4a')){var _0x36c2e0={};_0x36c2e0[_0x5d4ce9['name']]={'$like':'%'+_0x424910['query']['filter']+'%'};return _0x36c2e0;}})});}_0x27b2fb=_[_0x7ed4('0x4b')]({},_0x27b2fb,_0x424910[_0x7ed4('0x4c')]);var _0x202153={'where':_0x27b2fb[_0x7ed4('0x48')]};return db[_0x7ed4('0x39')]['count'](_0x202153)[_0x7ed4('0x1c')](function(_0x1a28e6){_0x31d63c[_0x7ed4('0x2f')]=_0x1a28e6;if(_0x424910['query'][_0x7ed4('0x4d')]){_0x27b2fb[_0x7ed4('0x4e')]=[{'all':!![]}];}return db['VoiceContext']['findAll'](_0x27b2fb);})[_0x7ed4('0x1c')](function(_0x195b99){_0x31d63c['rows']=_0x195b99;return _0x31d63c;})[_0x7ed4('0x1c')](respondWithFilteredResult(_0x1eed19,_0x27b2fb))[_0x7ed4('0x27')](handleError(_0x1eed19,null));};exports[_0x7ed4('0x4f')]=function(_0xb33a6c,_0x494746){var _0x38a057={'raw':![],'where':{'id':_0xb33a6c[_0x7ed4('0x50')]['id']}},_0x2dedf1={};_0x2dedf1['model']=_['keys'](db[_0x7ed4('0x39')]['rawAttributes']);_0x2dedf1[_0x7ed4('0x3f')]=_[_0x7ed4('0x3e')](_0xb33a6c[_0x7ed4('0x3f')]);_0x2dedf1[_0x7ed4('0x40')]=_[_0x7ed4('0x41')](_0x2dedf1[_0x7ed4('0x3d')],_0x2dedf1[_0x7ed4('0x3f')]);_0x38a057[_0x7ed4('0x42')]=_['intersection'](_0x2dedf1[_0x7ed4('0x3d')],qs['fields'](_0xb33a6c[_0x7ed4('0x3f')][_0x7ed4('0x43')]));_0x38a057[_0x7ed4('0x42')]=_0x38a057[_0x7ed4('0x42')][_0x7ed4('0x51')]?_0x38a057[_0x7ed4('0x42')]:_0x2dedf1[_0x7ed4('0x3d')];if(_0xb33a6c[_0x7ed4('0x3f')][_0x7ed4('0x4d')]){_0x38a057[_0x7ed4('0x4e')]=[{'all':!![]}];}_0x38a057=_[_0x7ed4('0x4b')]({},_0x38a057,_0xb33a6c[_0x7ed4('0x4c')]);return db[_0x7ed4('0x39')][_0x7ed4('0x52')](_0x38a057)[_0x7ed4('0x1c')](handleEntityNotFound(_0x494746,null))['then'](respondWithResult(_0x494746,null))['catch'](handleError(_0x494746,null));};exports[_0x7ed4('0x53')]=function(_0x462ecf,_0x544ca5,_0x5acaa3){var _0x440c97;return db[_0x7ed4('0x39')][_0x7ed4('0x53')](_0x462ecf[_0x7ed4('0x54')],{'raw':!![]})[_0x7ed4('0x1c')](function(_0x29b156){_0x440c97=_0x29b156;return db[_0x7ed4('0x39')]['findAll']({'raw':!![]});})[_0x7ed4('0x1c')](function(_0x493c70){var _0x4d7158=fs[_0x7ed4('0x55')](path[_0x7ed4('0x56')](config[_0x7ed4('0x57')],_0x7ed4('0x58')),_0x7ed4('0x59'));var _0x2765b5=ejs[_0x7ed4('0x5a')](_0x4d7158,{'contexts':_0x493c70||[]});fs[_0x7ed4('0x5b')](_0x7ed4('0x5c'),_0x2765b5);})[_0x7ed4('0x1c')](function(){return respondWithRpcPromise(_0x7ed4('0x5d'),'create',{'module':_0x7ed4('0x5e')});})[_0x7ed4('0x1c')](function(){var _0x399181=_0x462ecf['user'][_0x7ed4('0x34')]({'plain':!![]});if(!_0x399181)throw new Error(_0x7ed4('0x5f'));if(_0x399181[_0x7ed4('0x60')]==='user'){var _0x4eccf4=_0x440c97[_0x7ed4('0x34')]({'plain':!![]});return db[_0x7ed4('0x61')]['find']({'where':{'name':'Contexts','userProfileId':_0x399181[_0x7ed4('0x62')]},'raw':!![]})[_0x7ed4('0x1c')](function(_0x343bbc){if(_0x343bbc&&_0x343bbc[_0x7ed4('0x63')]===0x0){return db['UserProfileResource'][_0x7ed4('0x53')]({'name':_0x4eccf4[_0x7ed4('0x37')],'resourceId':_0x4eccf4['id'],'type':_0x343bbc[_0x7ed4('0x37')],'sectionId':_0x343bbc['id']},{})['then'](function(){return _0x440c97;});}else{return _0x440c97;}})[_0x7ed4('0x27')](function(_0x4d554a){logger[_0x7ed4('0x23')](_0x7ed4('0x64'),_0x4d554a);throw _0x4d554a;});}return _0x440c97;})[_0x7ed4('0x1c')](respondWithResult(_0x544ca5,0xc9))[_0x7ed4('0x27')](handleError(_0x544ca5,null));};exports[_0x7ed4('0x65')]=function(_0x2db486,_0x4b674b,_0x29d6cd){var _0x4a6cbe;return db[_0x7ed4('0x39')][_0x7ed4('0x52')]({'where':{'id':_0x2db486[_0x7ed4('0x50')]['id']}})[_0x7ed4('0x1c')](handleEntityNotFound(_0x4b674b,null))[_0x7ed4('0x1c')](saveUpdates(_0x2db486[_0x7ed4('0x54')],null))[_0x7ed4('0x1c')](function(_0x2252fc){if(_0x2252fc){_0x4a6cbe=_0x2252fc;return db[_0x7ed4('0x39')]['findAll']({'raw':!![]});}})[_0x7ed4('0x1c')](function(_0x899ecb){var _0xf585b=fs[_0x7ed4('0x55')](path[_0x7ed4('0x56')](config['root'],'server/files/templates/context.ejs'),_0x7ed4('0x59'));var _0x30a805=ejs['render'](_0xf585b,{'contexts':_0x899ecb||[]});fs[_0x7ed4('0x5b')](_0x7ed4('0x5c'),_0x30a805);})[_0x7ed4('0x1c')](function(){return respondWithRpcPromise(_0x7ed4('0x5d'),_0x7ed4('0x65'),{'module':_0x7ed4('0x5e')});})[_0x7ed4('0x1c')](function(){return _0x4a6cbe;})[_0x7ed4('0x1c')](respondWithResult(_0x4b674b,null))[_0x7ed4('0x27')](handleError(_0x4b674b,null));};exports[_0x7ed4('0x36')]=function(_0x49aabe,_0x44e981,_0x18b252){var _0x7c3dd8;return db['VoiceContext'][_0x7ed4('0x52')]({'where':{'id':_0x49aabe[_0x7ed4('0x50')]['id']}})[_0x7ed4('0x1c')](handleEntityNotFound(_0x44e981,null))[_0x7ed4('0x1c')](removeEntity(_0x44e981,null))['then'](function(){return db['VoiceContext']['findAll']({'raw':!![]});})['then'](function(_0x50d449){var _0x46e747=fs[_0x7ed4('0x55')](path[_0x7ed4('0x56')](config[_0x7ed4('0x57')],_0x7ed4('0x58')),_0x7ed4('0x59'));var _0x251480=ejs['render'](_0x46e747,{'contexts':_0x50d449});fs[_0x7ed4('0x5b')](_0x7ed4('0x5c'),_0x251480);return respondWithRpcPromise(_0x7ed4('0x5d'),_0x7ed4('0x36'),{'module':_0x7ed4('0x5e')});})[_0x7ed4('0x27')](handleError(_0x44e981,null));}; \ No newline at end of file +var _0x3814=['util','path','fs-extra','lodash','squel','crypto','desk.js','to-csv','ioredis','../../components/auth/service','../../config/license/hardware','../../config/environment','../../config/license/util','../../mysqldb','request','then','info','VoiceContext,\x20%s,\x20%s','debug','VoiceContext,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','sendStatus','status','json','offset','undefined','count','set','Content-Range','reject','save','update','get','UserProfileResource','destroy','end','stack','name','send','map','VoiceContext','rawAttributes','fieldName','type','key','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','limit','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','filters','find','create','body','join','root','server/files/templates/context.ejs','render','writeFileSync','/etc/asterisk/extensions_xcally_contexts.conf','Reload','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Contexts','userProfileId','autoAssociation','readFileSync','chan_sip.so','utf8','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache'];(function(_0x5aab8a,_0x5b4ef3){var _0x446400=function(_0x28ed2e){while(--_0x28ed2e){_0x5aab8a['push'](_0x5aab8a['shift']());}};_0x446400(++_0x5b4ef3);}(_0x3814,0x188));var _0x4381=function(_0x130aa2,_0x1f0cdd){_0x130aa2=_0x130aa2-0x0;var _0x3638a9=_0x3814[_0x130aa2];return _0x3638a9;};'use strict';var emlformat=require(_0x4381('0x0'));var rimraf=require(_0x4381('0x1'));var zipdir=require(_0x4381('0x2'));var jsonpatch=require(_0x4381('0x3'));var rp=require(_0x4381('0x4'));var moment=require(_0x4381('0x5'));var BPromise=require(_0x4381('0x6'));var Mustache=require(_0x4381('0x7'));var util=require(_0x4381('0x8'));var path=require(_0x4381('0x9'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4381('0xa'));var _=require(_0x4381('0xb'));var squel=require(_0x4381('0xc'));var crypto=require(_0x4381('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x4381('0xe'));var toCsv=require(_0x4381('0xf'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x4381('0x10'));var authService=require(_0x4381('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4381('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x4381('0x13'));var licenseUtil=require(_0x4381('0x14'));var db=require(_0x4381('0x15'))['db'];var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x122fae,_0x5a15c6,_0x12e8f2,_0x3efb46){return new BPromise(function(_0x236f83,_0x529348){var _0x3424f3=_0x3efb46||client;return _0x3424f3[_0x4381('0x16')](_0x122fae,_0x12e8f2)[_0x4381('0x17')](function(_0x45dca1){logger[_0x4381('0x18')](_0x4381('0x19'),_0x5a15c6,'request\x20sent');logger[_0x4381('0x1a')](_0x4381('0x1b'),_0x5a15c6,_0x4381('0x1c'),JSON[_0x4381('0x1d')](_0x45dca1));if(_0x45dca1[_0x4381('0x1e')]){if(_0x45dca1[_0x4381('0x1e')][_0x4381('0x1f')]===0x1f4){logger[_0x4381('0x1e')](_0x4381('0x19'),_0x5a15c6,_0x45dca1['error']['message']);return _0x529348(_0x45dca1[_0x4381('0x1e')]['message']);}logger['error'](_0x4381('0x19'),_0x5a15c6,_0x45dca1['error'][_0x4381('0x20')]);return _0x236f83(_0x45dca1[_0x4381('0x1e')][_0x4381('0x20')]);}else{logger[_0x4381('0x18')]('VoiceContext,\x20%s,\x20%s',_0x5a15c6,'request\x20sent');_0x236f83(_0x45dca1[_0x4381('0x21')][_0x4381('0x20')]);}})['catch'](function(_0x37ee1a){logger['error'](_0x4381('0x19'),_0x5a15c6,_0x37ee1a);_0x529348(_0x37ee1a);});});}function respondWithStatusCode(_0x5879ca,_0x5c3728){_0x5c3728=_0x5c3728||0xcc;return function(_0x14f3bf){if(_0x14f3bf){return _0x5879ca[_0x4381('0x22')](_0x5c3728);}return _0x5879ca[_0x4381('0x23')](_0x5c3728)['end']();};}function respondWithResult(_0x37419a,_0x4e6a35){_0x4e6a35=_0x4e6a35||0xc8;return function(_0x34d46d){if(_0x34d46d){return _0x37419a['status'](_0x4e6a35)[_0x4381('0x24')](_0x34d46d);}};}function respondWithFilteredResult(_0x2fec31,_0xc8acea){return function(_0x11fcd0){if(_0x11fcd0){var _0xdaa93b=typeof _0xc8acea[_0x4381('0x25')]===_0x4381('0x26')&&typeof _0xc8acea['limit']===_0x4381('0x26');var _0x21fd5b=_0x11fcd0[_0x4381('0x27')];var _0x46a23a=_0xdaa93b?0x0:_0xc8acea[_0x4381('0x25')];var _0x3575ee=_0xdaa93b?_0x11fcd0[_0x4381('0x27')]:_0xc8acea[_0x4381('0x25')]+_0xc8acea['limit'];var _0x1ac7d4;if(_0x3575ee>=_0x21fd5b){_0x3575ee=_0x21fd5b;_0x1ac7d4=0xc8;}else{_0x1ac7d4=0xce;}_0x2fec31['status'](_0x1ac7d4);return _0x2fec31[_0x4381('0x28')](_0x4381('0x29'),_0x46a23a+'-'+_0x3575ee+'/'+_0x21fd5b)[_0x4381('0x24')](_0x11fcd0);}return null;};}function patchUpdates(_0x366f0c){return function(_0x5dd6df){try{jsonpatch['apply'](_0x5dd6df,_0x366f0c,!![]);}catch(_0x490df9){return BPromise[_0x4381('0x2a')](_0x490df9);}return _0x5dd6df[_0x4381('0x2b')]();};}function saveUpdates(_0x3da1fa,_0x198f67){return function(_0xe9accd){if(_0xe9accd){return _0xe9accd[_0x4381('0x2c')](_0x3da1fa)['then'](function(_0x536757){return _0x536757;});}return null;};}function removeEntity(_0x8d2a55,_0x492b01){return function(_0x5d5d7d){if(_0x5d5d7d){return _0x5d5d7d['destroy']()[_0x4381('0x17')](function(){var _0x2b2130=_0x5d5d7d[_0x4381('0x2d')]({'plain':!![]});var _0x49f186='Contexts';return db[_0x4381('0x2e')][_0x4381('0x2f')]({'where':{'type':_0x49f186,'resourceId':_0x2b2130['id']}})['then'](function(){return _0x5d5d7d;});})[_0x4381('0x17')](function(){_0x8d2a55[_0x4381('0x23')](0xcc)[_0x4381('0x30')]();});}};}function handleEntityNotFound(_0x4ed4ca,_0x2829ab){return function(_0x32587f){if(!_0x32587f){_0x4ed4ca[_0x4381('0x22')](0x194);}return _0x32587f;};}function handleError(_0x5ee6f7,_0x2b6d6d){_0x2b6d6d=_0x2b6d6d||0x1f4;return function(_0x2cff8c){logger['error'](_0x2cff8c[_0x4381('0x31')]);if(_0x2cff8c['name']){delete _0x2cff8c[_0x4381('0x32')];}_0x5ee6f7['status'](_0x2b6d6d)[_0x4381('0x33')](_0x2cff8c);};}exports['index']=function(_0x4ac616,_0x38aeef){var _0x256163={},_0x144fd1={},_0x35bd3c={'count':0x0,'rows':[]};var _0x1a90a3=_[_0x4381('0x34')](db[_0x4381('0x35')][_0x4381('0x36')],function(_0x561d3d){return{'name':_0x561d3d[_0x4381('0x37')],'type':_0x561d3d[_0x4381('0x38')][_0x4381('0x39')]};});_0x144fd1['model']=_[_0x4381('0x34')](_0x1a90a3,_0x4381('0x32'));_0x144fd1[_0x4381('0x3a')]=_[_0x4381('0x3b')](_0x4ac616[_0x4381('0x3a')]);_0x144fd1['filters']=_[_0x4381('0x3c')](_0x144fd1[_0x4381('0x3d')],_0x144fd1[_0x4381('0x3a')]);_0x256163[_0x4381('0x3e')]=_[_0x4381('0x3c')](_0x144fd1[_0x4381('0x3d')],qs[_0x4381('0x3f')](_0x4ac616[_0x4381('0x3a')][_0x4381('0x3f')]));_0x256163['attributes']=_0x256163['attributes'][_0x4381('0x40')]?_0x256163['attributes']:_0x144fd1['model'];if(!_0x4ac616['query'][_0x4381('0x41')]('nolimit')){_0x256163[_0x4381('0x42')]=qs[_0x4381('0x42')](_0x4ac616[_0x4381('0x3a')]['limit']);_0x256163['offset']=qs[_0x4381('0x25')](_0x4ac616['query']['offset']);}_0x256163['order']=qs[_0x4381('0x43')](_0x4ac616[_0x4381('0x3a')][_0x4381('0x43')]);_0x256163[_0x4381('0x44')]=qs['filters'](_['pick'](_0x4ac616[_0x4381('0x3a')],_0x144fd1['filters']),_0x1a90a3);if(_0x4ac616['query'][_0x4381('0x45')]){_0x256163[_0x4381('0x44')]=_[_0x4381('0x46')](_0x256163['where'],{'$or':_[_0x4381('0x34')](_0x1a90a3,function(_0x5206a1){if(_0x5206a1['type']!==_0x4381('0x47')){var _0x553c57={};_0x553c57[_0x5206a1[_0x4381('0x32')]]={'$like':'%'+_0x4ac616[_0x4381('0x3a')][_0x4381('0x45')]+'%'};return _0x553c57;}})});}_0x256163=_[_0x4381('0x46')]({},_0x256163,_0x4ac616[_0x4381('0x48')]);var _0x29f732={'where':_0x256163[_0x4381('0x44')]};return db[_0x4381('0x35')][_0x4381('0x27')](_0x29f732)[_0x4381('0x17')](function(_0x1e0fd8){_0x35bd3c['count']=_0x1e0fd8;if(_0x4ac616[_0x4381('0x3a')][_0x4381('0x49')]){_0x256163[_0x4381('0x4a')]=[{'all':!![]}];}return db[_0x4381('0x35')][_0x4381('0x4b')](_0x256163);})[_0x4381('0x17')](function(_0x387148){_0x35bd3c[_0x4381('0x4c')]=_0x387148;return _0x35bd3c;})['then'](respondWithFilteredResult(_0x38aeef,_0x256163))[_0x4381('0x4d')](handleError(_0x38aeef,null));};exports[_0x4381('0x4e')]=function(_0xa38b64,_0x56348e){var _0x5ad083={'raw':![],'where':{'id':_0xa38b64[_0x4381('0x4f')]['id']}},_0x55d859={};_0x55d859[_0x4381('0x3d')]=_[_0x4381('0x3b')](db[_0x4381('0x35')][_0x4381('0x36')]);_0x55d859[_0x4381('0x3a')]=_[_0x4381('0x3b')](_0xa38b64[_0x4381('0x3a')]);_0x55d859[_0x4381('0x50')]=_[_0x4381('0x3c')](_0x55d859[_0x4381('0x3d')],_0x55d859[_0x4381('0x3a')]);_0x5ad083['attributes']=_['intersection'](_0x55d859[_0x4381('0x3d')],qs[_0x4381('0x3f')](_0xa38b64[_0x4381('0x3a')]['fields']));_0x5ad083['attributes']=_0x5ad083['attributes'][_0x4381('0x40')]?_0x5ad083['attributes']:_0x55d859[_0x4381('0x3d')];if(_0xa38b64[_0x4381('0x3a')][_0x4381('0x49')]){_0x5ad083[_0x4381('0x4a')]=[{'all':!![]}];}_0x5ad083=_[_0x4381('0x46')]({},_0x5ad083,_0xa38b64['options']);return db[_0x4381('0x35')][_0x4381('0x51')](_0x5ad083)[_0x4381('0x17')](handleEntityNotFound(_0x56348e,null))[_0x4381('0x17')](respondWithResult(_0x56348e,null))[_0x4381('0x4d')](handleError(_0x56348e,null));};exports[_0x4381('0x52')]=function(_0x5ede7d,_0x20708a,_0x54597d){var _0x287b65;return db[_0x4381('0x35')][_0x4381('0x52')](_0x5ede7d[_0x4381('0x53')],{'raw':!![]})[_0x4381('0x17')](function(_0x4be48a){_0x287b65=_0x4be48a;return db[_0x4381('0x35')][_0x4381('0x4b')]({'raw':!![]});})[_0x4381('0x17')](function(_0x4b1af1){var _0x1331c4=fs['readFileSync'](path[_0x4381('0x54')](config[_0x4381('0x55')],_0x4381('0x56')),'utf8');var _0xc2e24=ejs[_0x4381('0x57')](_0x1331c4,{'contexts':_0x4b1af1||[]});fs[_0x4381('0x58')](_0x4381('0x59'),_0xc2e24);})[_0x4381('0x17')](function(){return respondWithRpcPromise(_0x4381('0x5a'),_0x4381('0x52'),{'module':'chan_sip.so'});})[_0x4381('0x17')](function(){var _0x58c604=_0x5ede7d[_0x4381('0x5b')][_0x4381('0x2d')]({'plain':!![]});if(!_0x58c604)throw new Error(_0x4381('0x5c'));if(_0x58c604[_0x4381('0x5d')]==='user'){var _0x3a6d66=_0x287b65[_0x4381('0x2d')]({'plain':!![]});return db['UserProfileSection'][_0x4381('0x51')]({'where':{'name':_0x4381('0x5e'),'userProfileId':_0x58c604[_0x4381('0x5f')]},'raw':!![]})[_0x4381('0x17')](function(_0x478446){if(_0x478446&&_0x478446[_0x4381('0x60')]===0x0){return db['UserProfileResource'][_0x4381('0x52')]({'name':_0x3a6d66[_0x4381('0x32')],'resourceId':_0x3a6d66['id'],'type':_0x478446[_0x4381('0x32')],'sectionId':_0x478446['id']},{})[_0x4381('0x17')](function(){return _0x287b65;});}else{return _0x287b65;}})[_0x4381('0x4d')](function(_0x54865e){logger[_0x4381('0x1e')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x54865e);throw _0x54865e;});}return _0x287b65;})[_0x4381('0x17')](respondWithResult(_0x20708a,0xc9))[_0x4381('0x4d')](handleError(_0x20708a,null));};exports['update']=function(_0x171053,_0x15ede6,_0x414039){var _0x3eff50;return db[_0x4381('0x35')][_0x4381('0x51')]({'where':{'id':_0x171053[_0x4381('0x4f')]['id']}})[_0x4381('0x17')](handleEntityNotFound(_0x15ede6,null))[_0x4381('0x17')](saveUpdates(_0x171053[_0x4381('0x53')],null))[_0x4381('0x17')](function(_0x52d3af){if(_0x52d3af){_0x3eff50=_0x52d3af;return db[_0x4381('0x35')]['findAll']({'raw':!![]});}})[_0x4381('0x17')](function(_0x1aae5c){var _0x55c82a=fs[_0x4381('0x61')](path[_0x4381('0x54')](config[_0x4381('0x55')],_0x4381('0x56')),'utf8');var _0x1bae0a=ejs[_0x4381('0x57')](_0x55c82a,{'contexts':_0x1aae5c||[]});fs[_0x4381('0x58')](_0x4381('0x59'),_0x1bae0a);})[_0x4381('0x17')](function(){return respondWithRpcPromise('Reload',_0x4381('0x2c'),{'module':_0x4381('0x62')});})[_0x4381('0x17')](function(){return _0x3eff50;})[_0x4381('0x17')](respondWithResult(_0x15ede6,null))[_0x4381('0x4d')](handleError(_0x15ede6,null));};exports[_0x4381('0x2f')]=function(_0x49aaa5,_0x5d5d09,_0x3ea574){var _0xe748de;return db[_0x4381('0x35')][_0x4381('0x51')]({'where':{'id':_0x49aaa5[_0x4381('0x4f')]['id']}})[_0x4381('0x17')](handleEntityNotFound(_0x5d5d09,null))[_0x4381('0x17')](removeEntity(_0x5d5d09,null))[_0x4381('0x17')](function(){return db[_0x4381('0x35')][_0x4381('0x4b')]({'raw':!![]});})[_0x4381('0x17')](function(_0x1d678e){var _0x2d0b95=fs[_0x4381('0x61')](path['join'](config['root'],'server/files/templates/context.ejs'),_0x4381('0x63'));var _0x529001=ejs[_0x4381('0x57')](_0x2d0b95,{'contexts':_0x1d678e});fs[_0x4381('0x58')](_0x4381('0x59'),_0x529001);return respondWithRpcPromise(_0x4381('0x5a'),'destroy',{'module':_0x4381('0x62')});})['catch'](handleError(_0x5d5d09,null));}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.model.js b/server/api/voiceContext/voiceContext.model.js index bc8d67e..9471a1e 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 _0x31ee=['rimraf','exports','define','VoiceContext','voice_contexts','lodash','util','../../config/logger','api','moment','request-promise','path'];(function(_0x460d70,_0xadce71){var _0x43aa2f=function(_0x12902){while(--_0x12902){_0x460d70['push'](_0x460d70['shift']());}};_0x43aa2f(++_0xadce71);}(_0x31ee,0x1a9));var _0xe31e=function(_0x468b79,_0x3970cf){_0x468b79=_0x468b79-0x0;var _0x384693=_0x31ee[_0x468b79];return _0x384693;};'use strict';var _=require(_0xe31e('0x0'));var util=require(_0xe31e('0x1'));var logger=require(_0xe31e('0x2'))(_0xe31e('0x3'));var moment=require(_0xe31e('0x4'));var BPromise=require('bluebird');var rp=require(_0xe31e('0x5'));var fs=require('fs');var path=require(_0xe31e('0x6'));var rimraf=require(_0xe31e('0x7'));var config=require('../../config/environment');var attributes=require('./voiceContext.attributes');module[_0xe31e('0x8')]=function(_0x3d751a,_0x2e853d){return _0x3d751a[_0xe31e('0x9')](_0xe31e('0xa'),attributes,{'tableName':_0xe31e('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x926f=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./voiceContext.attributes','exports','define','VoiceContext','voice_contexts'];(function(_0x5daf99,_0x5c1406){var _0x5eee0c=function(_0x240fcf){while(--_0x240fcf){_0x5daf99['push'](_0x5daf99['shift']());}};_0x5eee0c(++_0x5c1406);}(_0x926f,0xb6));var _0xf926=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x926f[_0x501510];return _0x1e6ee5;};'use strict';var _=require(_0xf926('0x0'));var util=require(_0xf926('0x1'));var logger=require(_0xf926('0x2'))(_0xf926('0x3'));var moment=require(_0xf926('0x4'));var BPromise=require(_0xf926('0x5'));var rp=require(_0xf926('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf926('0x7'));var config=require(_0xf926('0x8'));var attributes=require(_0xf926('0x9'));module[_0xf926('0xa')]=function(_0x210f4f,_0x55c098){return _0x210f4f[_0xf926('0xb')](_0xf926('0xc'),attributes,{'tableName':_0xf926('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.rpc.js b/server/api/voiceContext/voiceContext.rpc.js index 4e7a7b9..1e45692 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 _0xf4f2=['../../mysqldb','../../config/environment','http','request','then','info','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','lodash','util','bluebird','randomstring'];(function(_0x21d8f4,_0x19bc9a){var _0x260756=function(_0x470302){while(--_0x470302){_0x21d8f4['push'](_0x21d8f4['shift']());}};_0x260756(++_0x19bc9a);}(_0xf4f2,0x12e));var _0x2f4f=function(_0x30a3a8,_0x106712){_0x30a3a8=_0x30a3a8-0x0;var _0x1177e1=_0xf4f2[_0x30a3a8];return _0x1177e1;};'use strict';var _=require(_0x2f4f('0x0'));var util=require(_0x2f4f('0x1'));var moment=require('moment');var BPromise=require(_0x2f4f('0x2'));var rs=require(_0x2f4f('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2f4f('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x2f4f('0x5'));var jayson=require('jayson/promise');var client=jayson['client'][_0x2f4f('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x17b6e2,_0x4cbcf7,_0x448a0b){return new BPromise(function(_0xfd39e8,_0x22c085){return client[_0x2f4f('0x7')](_0x17b6e2,_0x448a0b)[_0x2f4f('0x8')](function(_0x256565){logger[_0x2f4f('0x9')](_0x2f4f('0xa'),_0x4cbcf7,_0x2f4f('0xb'));logger[_0x2f4f('0xc')]('VoiceContext,\x20%s,\x20%s,\x20%s',_0x4cbcf7,_0x2f4f('0xb'),JSON[_0x2f4f('0xd')](_0x256565));if(_0x256565[_0x2f4f('0xe')]){if(_0x256565[_0x2f4f('0xe')][_0x2f4f('0xf')]===0x1f4){logger[_0x2f4f('0xe')](_0x2f4f('0xa'),_0x4cbcf7,_0x256565[_0x2f4f('0xe')][_0x2f4f('0x10')]);return _0x22c085(_0x256565[_0x2f4f('0xe')][_0x2f4f('0x10')]);}logger['error'](_0x2f4f('0xa'),_0x4cbcf7,_0x256565[_0x2f4f('0xe')]['message']);return _0xfd39e8(_0x256565[_0x2f4f('0xe')]['message']);}else{logger[_0x2f4f('0x9')](_0x2f4f('0xa'),_0x4cbcf7,'request\x20sent');_0xfd39e8(_0x256565[_0x2f4f('0x11')][_0x2f4f('0x10')]);}})['catch'](function(_0x1a961b){logger[_0x2f4f('0xe')](_0x2f4f('0xa'),_0x4cbcf7,_0x1a961b);_0x22c085(_0x1a961b);});});} \ No newline at end of file +var _0xcf66=['jayson/promise','client','http','request','then','request\x20sent','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','VoiceContext,\x20%s,\x20%s','message','result','catch','lodash','util','moment','randomstring','ioredis','../../config/logger','rpc'];(function(_0xd129b7,_0x2140ed){var _0x4fc3b3=function(_0x49ea95){while(--_0x49ea95){_0xd129b7['push'](_0xd129b7['shift']());}};_0x4fc3b3(++_0x2140ed);}(_0xcf66,0x71));var _0x6cf6=function(_0x110931,_0x5a46d8){_0x110931=_0x110931-0x0;var _0xdb767e=_0xcf66[_0x110931];return _0xdb767e;};'use strict';var _=require(_0x6cf6('0x0'));var util=require(_0x6cf6('0x1'));var moment=require(_0x6cf6('0x2'));var BPromise=require('bluebird');var rs=require(_0x6cf6('0x3'));var fs=require('fs');var Redis=require(_0x6cf6('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x6cf6('0x5'))(_0x6cf6('0x6'));var config=require('../../config/environment');var jayson=require(_0x6cf6('0x7'));var client=jayson[_0x6cf6('0x8')][_0x6cf6('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5eb082,_0x94c6a9,_0x308d0d){return new BPromise(function(_0x36b892,_0x748c93){return client[_0x6cf6('0xa')](_0x5eb082,_0x308d0d)[_0x6cf6('0xb')](function(_0x5b3827){logger['info']('VoiceContext,\x20%s,\x20%s',_0x94c6a9,_0x6cf6('0xc'));logger['debug'](_0x6cf6('0xd'),_0x94c6a9,_0x6cf6('0xc'),JSON[_0x6cf6('0xe')](_0x5b3827));if(_0x5b3827[_0x6cf6('0xf')]){if(_0x5b3827['error']['code']===0x1f4){logger['error'](_0x6cf6('0x10'),_0x94c6a9,_0x5b3827[_0x6cf6('0xf')][_0x6cf6('0x11')]);return _0x748c93(_0x5b3827[_0x6cf6('0xf')][_0x6cf6('0x11')]);}logger[_0x6cf6('0xf')]('VoiceContext,\x20%s,\x20%s',_0x94c6a9,_0x5b3827[_0x6cf6('0xf')]['message']);return _0x36b892(_0x5b3827[_0x6cf6('0xf')][_0x6cf6('0x11')]);}else{logger['info'](_0x6cf6('0x10'),_0x94c6a9,_0x6cf6('0xc'));_0x36b892(_0x5b3827[_0x6cf6('0x12')][_0x6cf6('0x11')]);}})[_0x6cf6('0x13')](function(_0x2bdb12){logger[_0x6cf6('0xf')](_0x6cf6('0x10'),_0x94c6a9,_0x2bdb12);_0x748c93(_0x2bdb12);});});} \ No newline at end of file diff --git a/server/api/voiceDialReport/index.js b/server/api/voiceDialReport/index.js index 0572d9a..a5028fb 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 _0x9a7f=['update','delete','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./voiceDialReport.controller','get','isAuthenticated','/describe','describe','/:id','post','create','put'];(function(_0x178e48,_0x3c9509){var _0x440d7e=function(_0xc2f8a0){while(--_0xc2f8a0){_0x178e48['push'](_0x178e48['shift']());}};_0x440d7e(++_0x3c9509);}(_0x9a7f,0x1cf));var _0xf9a7=function(_0xab37c5,_0x268863){_0xab37c5=_0xab37c5-0x0;var _0x416525=_0x9a7f[_0xab37c5];return _0x416525;};'use strict';var multer=require(_0xf9a7('0x0'));var util=require(_0xf9a7('0x1'));var path=require(_0xf9a7('0x2'));var timeout=require(_0xf9a7('0x3'));var express=require(_0xf9a7('0x4'));var router=express['Router']();var fs_extra=require(_0xf9a7('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xf9a7('0x6'));var config=require(_0xf9a7('0x7'));var controller=require(_0xf9a7('0x8'));router[_0xf9a7('0x9')]('/',auth[_0xf9a7('0xa')](),controller['index']);router[_0xf9a7('0x9')](_0xf9a7('0xb'),auth['isAuthenticated'](),controller[_0xf9a7('0xc')]);router[_0xf9a7('0x9')](_0xf9a7('0xd'),auth[_0xf9a7('0xa')](),controller['show']);router[_0xf9a7('0xe')]('/',auth[_0xf9a7('0xa')](),controller[_0xf9a7('0xf')]);router[_0xf9a7('0x10')](_0xf9a7('0xd'),auth[_0xf9a7('0xa')](),controller[_0xf9a7('0x11')]);router[_0xf9a7('0x12')](_0xf9a7('0xd'),auth['isAuthenticated'](),controller['destroy']);module[_0xf9a7('0x13')]=router; \ No newline at end of file +var _0x4a3d=['create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceDialReport.controller','get','/describe','/:id','isAuthenticated','show','post'];(function(_0x158a58,_0x28e8e7){var _0x4935d9=function(_0x1e698c){while(--_0x1e698c){_0x158a58['push'](_0x158a58['shift']());}};_0x4935d9(++_0x28e8e7);}(_0x4a3d,0x79));var _0xd4a3=function(_0xee600b,_0x5e682a){_0xee600b=_0xee600b-0x0;var _0x47b519=_0x4a3d[_0xee600b];return _0x47b519;};'use strict';var multer=require(_0xd4a3('0x0'));var util=require(_0xd4a3('0x1'));var path=require(_0xd4a3('0x2'));var timeout=require(_0xd4a3('0x3'));var express=require(_0xd4a3('0x4'));var router=express[_0xd4a3('0x5')]();var fs_extra=require(_0xd4a3('0x6'));var auth=require(_0xd4a3('0x7'));var interaction=require(_0xd4a3('0x8'));var config=require(_0xd4a3('0x9'));var controller=require(_0xd4a3('0xa'));router[_0xd4a3('0xb')]('/',auth['isAuthenticated'](),controller['index']);router[_0xd4a3('0xb')](_0xd4a3('0xc'),auth['isAuthenticated'](),controller['describe']);router[_0xd4a3('0xb')](_0xd4a3('0xd'),auth[_0xd4a3('0xe')](),controller[_0xd4a3('0xf')]);router[_0xd4a3('0x10')]('/',auth[_0xd4a3('0xe')](),controller[_0xd4a3('0x11')]);router[_0xd4a3('0x12')]('/:id',auth[_0xd4a3('0xe')](),controller[_0xd4a3('0x13')]);router[_0xd4a3('0x14')](_0xd4a3('0xd'),auth[_0xd4a3('0xe')](),controller[_0xd4a3('0x15')]);module[_0xd4a3('0x16')]=router; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.attributes.js b/server/api/voiceDialReport/voiceDialReport.attributes.js index 1efbc4d..68c5dba 100644 --- a/server/api/voiceDialReport/voiceDialReport.attributes.js +++ b/server/api/voiceDialReport/voiceDialReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe5b3=['STRING','INTEGER','DATE','exports'];(function(_0x3f6f3e,_0x4862c1){var _0x268808=function(_0x1f194d){while(--_0x1f194d){_0x3f6f3e['push'](_0x3f6f3e['shift']());}};_0x268808(++_0x4862c1);}(_0xe5b3,0x133));var _0x3e5b=function(_0x5562c2,_0x1ac118){_0x5562c2=_0x5562c2-0x0;var _0x43427f=_0xe5b3[_0x5562c2];return _0x43427f;};'use strict';var Sequelize=require('sequelize');module[_0x3e5b('0x0')]={'privilege':{'type':Sequelize[_0x3e5b('0x1')]},'channel':{'type':Sequelize[_0x3e5b('0x1')]},'channelstate':{'type':Sequelize[_0x3e5b('0x2')]},'channelstatedesc':{'type':Sequelize[_0x3e5b('0x1')]},'calleridnum':{'type':Sequelize[_0x3e5b('0x1')]},'calleridname':{'type':Sequelize[_0x3e5b('0x1')]},'connectedlinenum':{'type':Sequelize[_0x3e5b('0x1')]},'connectedlinename':{'type':Sequelize[_0x3e5b('0x1')]},'language':{'type':Sequelize[_0x3e5b('0x1')]},'accountcode':{'type':Sequelize[_0x3e5b('0x1')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0x3e5b('0x1')]},'priority':{'type':Sequelize[_0x3e5b('0x2')]},'uniqueid':{'type':Sequelize['STRING']},'linkedid':{'type':Sequelize[_0x3e5b('0x1')]},'destchannel':{'type':Sequelize[_0x3e5b('0x1')]},'destchannelstate':{'type':Sequelize[_0x3e5b('0x2')]},'destchannelstatedesc':{'type':Sequelize[_0x3e5b('0x1')]},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0x3e5b('0x1')]},'destconnectedlinename':{'type':Sequelize[_0x3e5b('0x1')]},'destlanguage':{'type':Sequelize[_0x3e5b('0x1')]},'destaccountcode':{'type':Sequelize[_0x3e5b('0x1')]},'destcontext':{'type':Sequelize[_0x3e5b('0x1')]},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize[_0x3e5b('0x2')]},'destuniqueid':{'type':Sequelize['STRING']},'destlinkedid':{'type':Sequelize[_0x3e5b('0x1')]},'dialstring':{'type':Sequelize[_0x3e5b('0x1')]},'dialstatus':{'type':Sequelize[_0x3e5b('0x1')]},'starttime':{'type':Sequelize[_0x3e5b('0x3')]},'answertime':{'type':Sequelize[_0x3e5b('0x3')]},'endtime':{'type':Sequelize[_0x3e5b('0x3')]},'lastevent':{'type':Sequelize[_0x3e5b('0x1')],'comment':'called,connect,complete'},'routeId':{'type':Sequelize[_0x3e5b('0x2')]},'duration':{'type':Sequelize['INTEGER']},'holdtime':{'type':Sequelize['INTEGER']},'billableseconds':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x81bd=['exports','STRING','INTEGER','DATE','sequelize'];(function(_0x54b892,_0x2a3009){var _0x1256e1=function(_0x32278b){while(--_0x32278b){_0x54b892['push'](_0x54b892['shift']());}};_0x1256e1(++_0x2a3009);}(_0x81bd,0x7c));var _0xd81b=function(_0x500419,_0x549162){_0x500419=_0x500419-0x0;var _0x241c1a=_0x81bd[_0x500419];return _0x241c1a;};'use strict';var Sequelize=require(_0xd81b('0x0'));module[_0xd81b('0x1')]={'privilege':{'type':Sequelize[_0xd81b('0x2')]},'channel':{'type':Sequelize[_0xd81b('0x2')]},'channelstate':{'type':Sequelize[_0xd81b('0x3')]},'channelstatedesc':{'type':Sequelize[_0xd81b('0x2')]},'calleridnum':{'type':Sequelize[_0xd81b('0x2')]},'calleridname':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0xd81b('0x2')]},'connectedlinename':{'type':Sequelize[_0xd81b('0x2')]},'language':{'type':Sequelize[_0xd81b('0x2')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0xd81b('0x2')]},'exten':{'type':Sequelize[_0xd81b('0x2')]},'priority':{'type':Sequelize[_0xd81b('0x3')]},'uniqueid':{'type':Sequelize['STRING']},'linkedid':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize[_0xd81b('0x2')]},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize[_0xd81b('0x2')]},'destcalleridnum':{'type':Sequelize[_0xd81b('0x2')]},'destcalleridname':{'type':Sequelize[_0xd81b('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0xd81b('0x2')]},'destconnectedlinename':{'type':Sequelize[_0xd81b('0x2')]},'destlanguage':{'type':Sequelize[_0xd81b('0x2')]},'destaccountcode':{'type':Sequelize[_0xd81b('0x2')]},'destcontext':{'type':Sequelize[_0xd81b('0x2')]},'destexten':{'type':Sequelize[_0xd81b('0x2')]},'destpriority':{'type':Sequelize[_0xd81b('0x3')]},'destuniqueid':{'type':Sequelize[_0xd81b('0x2')]},'destlinkedid':{'type':Sequelize[_0xd81b('0x2')]},'dialstring':{'type':Sequelize[_0xd81b('0x2')]},'dialstatus':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0xd81b('0x4')]},'answertime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0xd81b('0x4')]},'lastevent':{'type':Sequelize[_0xd81b('0x2')],'comment':'called,connect,complete'},'routeId':{'type':Sequelize[_0xd81b('0x3')]},'duration':{'type':Sequelize['INTEGER']},'holdtime':{'type':Sequelize[_0xd81b('0x3')]},'billableseconds':{'type':Sequelize[_0xd81b('0x3')]}}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.controller.js b/server/api/voiceDialReport/voiceDialReport.controller.js index b73db7c..fa0e687 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 _0xfd49=['moment','bluebird','util','path','sox','ejs','fs-extra','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','sendStatus','error','name','send','index','rawAttributes','fieldName','model','map','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','sort','where','merge','type','options','VoiceDialReport','includeAll','findAll','rows','catch','show','params','length','include','find','create','body','describe','eml-format','rimraf','zip-dir','request-promise'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0xfd49,0x124));var _0x9fd4=function(_0x2bfd51,_0x358447){_0x2bfd51=_0x2bfd51-0x0;var _0x22447d=_0xfd49[_0x2bfd51];return _0x22447d;};'use strict';var emlformat=require(_0x9fd4('0x0'));var rimraf=require(_0x9fd4('0x1'));var zipdir=require(_0x9fd4('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x9fd4('0x3'));var moment=require(_0x9fd4('0x4'));var BPromise=require(_0x9fd4('0x5'));var Mustache=require('mustache');var util=require(_0x9fd4('0x6'));var path=require(_0x9fd4('0x7'));var sox=require(_0x9fd4('0x8'));var csv=require('to-csv');var ejs=require(_0x9fd4('0x9'));var fs=require('fs');var fs_extra=require(_0x9fd4('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x9fd4('0xb'));var jsforce=require(_0x9fd4('0xc'));var deskjs=require(_0x9fd4('0xd'));var toCsv=require(_0x9fd4('0xe'));var querystring=require(_0x9fd4('0xf'));var Papa=require(_0x9fd4('0x10'));var Redis=require(_0x9fd4('0x11'));var authService=require(_0x9fd4('0x12'));var qs=require(_0x9fd4('0x13'));var as=require(_0x9fd4('0x14'));var hardwareService=require(_0x9fd4('0x15'));var logger=require(_0x9fd4('0x16'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x9fd4('0x17'));var db=require(_0x9fd4('0x18'))['db'];function respondWithStatusCode(_0x16f5c1,_0x117b22){_0x117b22=_0x117b22||0xcc;return function(_0x31b121){if(_0x31b121){return _0x16f5c1['sendStatus'](_0x117b22);}return _0x16f5c1[_0x9fd4('0x19')](_0x117b22)[_0x9fd4('0x1a')]();};}function respondWithResult(_0x53fe77,_0x371729){_0x371729=_0x371729||0xc8;return function(_0x3e8db7){if(_0x3e8db7){return _0x53fe77['status'](_0x371729)[_0x9fd4('0x1b')](_0x3e8db7);}};}function respondWithFilteredResult(_0x5aaa45,_0x566421){return function(_0x39e50d){if(_0x39e50d){var _0x5696d4=typeof _0x566421[_0x9fd4('0x1c')]===_0x9fd4('0x1d')&&typeof _0x566421[_0x9fd4('0x1e')]==='undefined';var _0x152558=_0x39e50d[_0x9fd4('0x1f')];var _0x101bad=_0x5696d4?0x0:_0x566421['offset'];var _0x403eaa=_0x5696d4?_0x39e50d['count']:_0x566421['offset']+_0x566421[_0x9fd4('0x1e')];var _0x22f5fc;if(_0x403eaa>=_0x152558){_0x403eaa=_0x152558;_0x22f5fc=0xc8;}else{_0x22f5fc=0xce;}_0x5aaa45[_0x9fd4('0x19')](_0x22f5fc);return _0x5aaa45[_0x9fd4('0x20')](_0x9fd4('0x21'),_0x101bad+'-'+_0x403eaa+'/'+_0x152558)[_0x9fd4('0x1b')](_0x39e50d);}return null;};}function patchUpdates(_0x57ff65){return function(_0x20b19c){try{jsonpatch[_0x9fd4('0x22')](_0x20b19c,_0x57ff65,!![]);}catch(_0x3a521f){return BPromise[_0x9fd4('0x23')](_0x3a521f);}return _0x20b19c['save']();};}function saveUpdates(_0x3eabb9,_0x1752d7){return function(_0x3d76fa){if(_0x3d76fa){return _0x3d76fa[_0x9fd4('0x24')](_0x3eabb9)[_0x9fd4('0x25')](function(_0x44aad0){return _0x44aad0;});}return null;};}function removeEntity(_0x2e47b7,_0x42b181){return function(_0xbf39ec){if(_0xbf39ec){return _0xbf39ec[_0x9fd4('0x26')]()[_0x9fd4('0x25')](function(){_0x2e47b7[_0x9fd4('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x200afb,_0x4aee1a){return function(_0x545b74){if(!_0x545b74){_0x200afb[_0x9fd4('0x27')](0x194);}return _0x545b74;};}function handleError(_0x2224db,_0x18eba4){_0x18eba4=_0x18eba4||0x1f4;return function(_0x1a60f4){logger[_0x9fd4('0x28')](_0x1a60f4['stack']);if(_0x1a60f4[_0x9fd4('0x29')]){delete _0x1a60f4['name'];}_0x2224db[_0x9fd4('0x19')](_0x18eba4)[_0x9fd4('0x2a')](_0x1a60f4);};}exports[_0x9fd4('0x2b')]=function(_0x39c07d,_0x286ad8){var _0x47e649={},_0x13dbcc={},_0x4ab10d={'count':0x0,'rows':[]};var _0x1cdce6=_['map'](db['VoiceDialReport'][_0x9fd4('0x2c')],function(_0x4b1e20){return{'name':_0x4b1e20[_0x9fd4('0x2d')],'type':_0x4b1e20['type']['key']};});_0x13dbcc[_0x9fd4('0x2e')]=_[_0x9fd4('0x2f')](_0x1cdce6,'name');_0x13dbcc[_0x9fd4('0x30')]=_[_0x9fd4('0x31')](_0x39c07d[_0x9fd4('0x30')]);_0x13dbcc[_0x9fd4('0x32')]=_['intersection'](_0x13dbcc[_0x9fd4('0x2e')],_0x13dbcc['query']);_0x47e649[_0x9fd4('0x33')]=_[_0x9fd4('0x34')](_0x13dbcc[_0x9fd4('0x2e')],qs[_0x9fd4('0x35')](_0x39c07d[_0x9fd4('0x30')][_0x9fd4('0x35')]));_0x47e649[_0x9fd4('0x33')]=_0x47e649[_0x9fd4('0x33')]['length']?_0x47e649[_0x9fd4('0x33')]:_0x13dbcc['model'];if(!_0x39c07d[_0x9fd4('0x30')][_0x9fd4('0x36')](_0x9fd4('0x37'))){_0x47e649['limit']=qs['limit'](_0x39c07d[_0x9fd4('0x30')][_0x9fd4('0x1e')]);_0x47e649[_0x9fd4('0x1c')]=qs[_0x9fd4('0x1c')](_0x39c07d[_0x9fd4('0x30')][_0x9fd4('0x1c')]);}_0x47e649['order']=qs[_0x9fd4('0x38')](_0x39c07d[_0x9fd4('0x30')]['sort']);_0x47e649[_0x9fd4('0x39')]=qs[_0x9fd4('0x32')](_['pick'](_0x39c07d[_0x9fd4('0x30')],_0x13dbcc['filters']),_0x1cdce6);if(_0x39c07d['query']['filter']){_0x47e649[_0x9fd4('0x39')]=_[_0x9fd4('0x3a')](_0x47e649[_0x9fd4('0x39')],{'$or':_[_0x9fd4('0x2f')](_0x1cdce6,function(_0x35b144){if(_0x35b144[_0x9fd4('0x3b')]!=='VIRTUAL'){var _0x26a735={};_0x26a735[_0x35b144[_0x9fd4('0x29')]]={'$like':'%'+_0x39c07d[_0x9fd4('0x30')]['filter']+'%'};return _0x26a735;}})});}_0x47e649=_['merge']({},_0x47e649,_0x39c07d[_0x9fd4('0x3c')]);var _0x672199={'where':_0x47e649[_0x9fd4('0x39')]};return db[_0x9fd4('0x3d')][_0x9fd4('0x1f')](_0x672199)['then'](function(_0x160162){_0x4ab10d['count']=_0x160162;if(_0x39c07d['query'][_0x9fd4('0x3e')]){_0x47e649['include']=[{'all':!![]}];}return db[_0x9fd4('0x3d')][_0x9fd4('0x3f')](_0x47e649);})['then'](function(_0x4d96f2){_0x4ab10d[_0x9fd4('0x40')]=_0x4d96f2;return _0x4ab10d;})[_0x9fd4('0x25')](respondWithFilteredResult(_0x286ad8,_0x47e649))[_0x9fd4('0x41')](handleError(_0x286ad8,null));};exports[_0x9fd4('0x42')]=function(_0x2ab691,_0xbd7c39){var _0x3c7de5={'raw':!![],'where':{'id':_0x2ab691[_0x9fd4('0x43')]['id']}},_0x4aae83={};_0x4aae83[_0x9fd4('0x2e')]=_[_0x9fd4('0x31')](db[_0x9fd4('0x3d')]['rawAttributes']);_0x4aae83['query']=_[_0x9fd4('0x31')](_0x2ab691[_0x9fd4('0x30')]);_0x4aae83[_0x9fd4('0x32')]=_[_0x9fd4('0x34')](_0x4aae83[_0x9fd4('0x2e')],_0x4aae83[_0x9fd4('0x30')]);_0x3c7de5[_0x9fd4('0x33')]=_[_0x9fd4('0x34')](_0x4aae83[_0x9fd4('0x2e')],qs[_0x9fd4('0x35')](_0x2ab691[_0x9fd4('0x30')][_0x9fd4('0x35')]));_0x3c7de5[_0x9fd4('0x33')]=_0x3c7de5[_0x9fd4('0x33')][_0x9fd4('0x44')]?_0x3c7de5['attributes']:_0x4aae83[_0x9fd4('0x2e')];if(_0x2ab691[_0x9fd4('0x30')]['includeAll']){_0x3c7de5[_0x9fd4('0x45')]=[{'all':!![]}];}_0x3c7de5=_[_0x9fd4('0x3a')]({},_0x3c7de5,_0x2ab691[_0x9fd4('0x3c')]);return db['VoiceDialReport'][_0x9fd4('0x46')](_0x3c7de5)[_0x9fd4('0x25')](handleEntityNotFound(_0xbd7c39,null))['then'](respondWithResult(_0xbd7c39,null))[_0x9fd4('0x41')](handleError(_0xbd7c39,null));};exports[_0x9fd4('0x47')]=function(_0x3a3dd5,_0x49e40e){return db['VoiceDialReport'][_0x9fd4('0x47')](_0x3a3dd5[_0x9fd4('0x48')],{})['then'](respondWithResult(_0x49e40e,0xc9))[_0x9fd4('0x41')](handleError(_0x49e40e,null));};exports[_0x9fd4('0x24')]=function(_0x3d5ccc,_0x5ccdd9){if(_0x3d5ccc[_0x9fd4('0x48')]['id']){delete _0x3d5ccc[_0x9fd4('0x48')]['id'];}return db[_0x9fd4('0x3d')][_0x9fd4('0x46')]({'where':{'id':_0x3d5ccc[_0x9fd4('0x43')]['id']}})[_0x9fd4('0x25')](handleEntityNotFound(_0x5ccdd9,null))[_0x9fd4('0x25')](saveUpdates(_0x3d5ccc[_0x9fd4('0x48')],null))[_0x9fd4('0x25')](respondWithResult(_0x5ccdd9,null))[_0x9fd4('0x41')](handleError(_0x5ccdd9,null));};exports[_0x9fd4('0x26')]=function(_0x3708da,_0x50402a){return db[_0x9fd4('0x3d')][_0x9fd4('0x46')]({'where':{'id':_0x3708da['params']['id']}})[_0x9fd4('0x25')](handleEntityNotFound(_0x50402a,null))[_0x9fd4('0x25')](removeEntity(_0x50402a,null))[_0x9fd4('0x41')](handleError(_0x50402a,null));};exports['describe']=function(_0x4c3537,_0x57c7ea){return db[_0x9fd4('0x3d')][_0x9fd4('0x49')]()['then'](respondWithResult(_0x57c7ea,null))[_0x9fd4('0x41')](handleError(_0x57c7ea,null));}; \ No newline at end of file +var _0x4005=['rows','catch','params','includeAll','options','create','body','find','destroy','describe','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/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','set','Content-Range','apply','reject','update','then','end','error','stack','send','index','map','VoiceDialReport','rawAttributes','fieldName','key','name','query','keys','filters','intersection','attributes','model','fields','length','hasOwnProperty','order','sort','where','merge','type','VIRTUAL','filter','count','include'];(function(_0x4ca126,_0x3cab0f){var _0x369abc=function(_0x115ee4){while(--_0x115ee4){_0x4ca126['push'](_0x4ca126['shift']());}};_0x369abc(++_0x3cab0f);}(_0x4005,0x14a));var _0x5400=function(_0x37ebe4,_0x39788b){_0x37ebe4=_0x37ebe4-0x0;var _0x41377f=_0x4005[_0x37ebe4];return _0x41377f;};'use strict';var emlformat=require(_0x5400('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x5400('0x1'));var jsonpatch=require(_0x5400('0x2'));var rp=require(_0x5400('0x3'));var moment=require(_0x5400('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x5400('0x5'));var util=require(_0x5400('0x6'));var path=require(_0x5400('0x7'));var sox=require(_0x5400('0x8'));var csv=require(_0x5400('0x9'));var ejs=require(_0x5400('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x5400('0xb'));var squel=require(_0x5400('0xc'));var crypto=require(_0x5400('0xd'));var jsforce=require(_0x5400('0xe'));var deskjs=require(_0x5400('0xf'));var toCsv=require('to-csv');var querystring=require(_0x5400('0x10'));var Papa=require(_0x5400('0x11'));var Redis=require(_0x5400('0x12'));var authService=require(_0x5400('0x13'));var qs=require(_0x5400('0x14'));var as=require(_0x5400('0x15'));var hardwareService=require(_0x5400('0x16'));var logger=require(_0x5400('0x17'))(_0x5400('0x18'));var utils=require(_0x5400('0x19'));var config=require(_0x5400('0x1a'));var licenseUtil=require(_0x5400('0x1b'));var db=require(_0x5400('0x1c'))['db'];function respondWithStatusCode(_0x5526f0,_0x387d2a){_0x387d2a=_0x387d2a||0xcc;return function(_0x396567){if(_0x396567){return _0x5526f0[_0x5400('0x1d')](_0x387d2a);}return _0x5526f0[_0x5400('0x1e')](_0x387d2a)['end']();};}function respondWithResult(_0x2fabc3,_0x50953a){_0x50953a=_0x50953a||0xc8;return function(_0x14c828){if(_0x14c828){return _0x2fabc3[_0x5400('0x1e')](_0x50953a)[_0x5400('0x1f')](_0x14c828);}};}function respondWithFilteredResult(_0x16f94f,_0x17390b){return function(_0x16435e){if(_0x16435e){var _0x31d5af=typeof _0x17390b[_0x5400('0x20')]===_0x5400('0x21')&&typeof _0x17390b[_0x5400('0x22')]===_0x5400('0x21');var _0x36e66f=_0x16435e['count'];var _0x32f4fc=_0x31d5af?0x0:_0x17390b[_0x5400('0x20')];var _0x1205e9=_0x31d5af?_0x16435e['count']:_0x17390b[_0x5400('0x20')]+_0x17390b[_0x5400('0x22')];var _0x30eef3;if(_0x1205e9>=_0x36e66f){_0x1205e9=_0x36e66f;_0x30eef3=0xc8;}else{_0x30eef3=0xce;}_0x16f94f['status'](_0x30eef3);return _0x16f94f[_0x5400('0x23')](_0x5400('0x24'),_0x32f4fc+'-'+_0x1205e9+'/'+_0x36e66f)[_0x5400('0x1f')](_0x16435e);}return null;};}function patchUpdates(_0x225dba){return function(_0x8bae7c){try{jsonpatch[_0x5400('0x25')](_0x8bae7c,_0x225dba,!![]);}catch(_0x460ae0){return BPromise[_0x5400('0x26')](_0x460ae0);}return _0x8bae7c['save']();};}function saveUpdates(_0x40f4d0,_0x54f7e6){return function(_0x3f8dd6){if(_0x3f8dd6){return _0x3f8dd6[_0x5400('0x27')](_0x40f4d0)[_0x5400('0x28')](function(_0x32a10f){return _0x32a10f;});}return null;};}function removeEntity(_0x207033,_0xf19cb8){return function(_0x4e3062){if(_0x4e3062){return _0x4e3062['destroy']()[_0x5400('0x28')](function(){_0x207033[_0x5400('0x1e')](0xcc)[_0x5400('0x29')]();});}};}function handleEntityNotFound(_0x71e87,_0x4036e8){return function(_0x33fab9){if(!_0x33fab9){_0x71e87['sendStatus'](0x194);}return _0x33fab9;};}function handleError(_0x37d460,_0x57315c){_0x57315c=_0x57315c||0x1f4;return function(_0xcade8c){logger[_0x5400('0x2a')](_0xcade8c[_0x5400('0x2b')]);if(_0xcade8c['name']){delete _0xcade8c['name'];}_0x37d460[_0x5400('0x1e')](_0x57315c)[_0x5400('0x2c')](_0xcade8c);};}exports[_0x5400('0x2d')]=function(_0x2446c9,_0x56990a){var _0x3537f9={},_0x3aa7ca={},_0x417c7b={'count':0x0,'rows':[]};var _0x161c20=_[_0x5400('0x2e')](db[_0x5400('0x2f')][_0x5400('0x30')],function(_0x4d21ac){return{'name':_0x4d21ac[_0x5400('0x31')],'type':_0x4d21ac['type'][_0x5400('0x32')]};});_0x3aa7ca['model']=_[_0x5400('0x2e')](_0x161c20,_0x5400('0x33'));_0x3aa7ca[_0x5400('0x34')]=_[_0x5400('0x35')](_0x2446c9[_0x5400('0x34')]);_0x3aa7ca[_0x5400('0x36')]=_[_0x5400('0x37')](_0x3aa7ca['model'],_0x3aa7ca['query']);_0x3537f9[_0x5400('0x38')]=_['intersection'](_0x3aa7ca[_0x5400('0x39')],qs[_0x5400('0x3a')](_0x2446c9['query'][_0x5400('0x3a')]));_0x3537f9[_0x5400('0x38')]=_0x3537f9[_0x5400('0x38')][_0x5400('0x3b')]?_0x3537f9[_0x5400('0x38')]:_0x3aa7ca['model'];if(!_0x2446c9['query'][_0x5400('0x3c')]('nolimit')){_0x3537f9[_0x5400('0x22')]=qs[_0x5400('0x22')](_0x2446c9['query'][_0x5400('0x22')]);_0x3537f9['offset']=qs['offset'](_0x2446c9[_0x5400('0x34')][_0x5400('0x20')]);}_0x3537f9[_0x5400('0x3d')]=qs[_0x5400('0x3e')](_0x2446c9[_0x5400('0x34')][_0x5400('0x3e')]);_0x3537f9['where']=qs['filters'](_['pick'](_0x2446c9[_0x5400('0x34')],_0x3aa7ca['filters']),_0x161c20);if(_0x2446c9[_0x5400('0x34')]['filter']){_0x3537f9[_0x5400('0x3f')]=_[_0x5400('0x40')](_0x3537f9[_0x5400('0x3f')],{'$or':_[_0x5400('0x2e')](_0x161c20,function(_0x475402){if(_0x475402[_0x5400('0x41')]!==_0x5400('0x42')){var _0x49e516={};_0x49e516[_0x475402[_0x5400('0x33')]]={'$like':'%'+_0x2446c9[_0x5400('0x34')][_0x5400('0x43')]+'%'};return _0x49e516;}})});}_0x3537f9=_[_0x5400('0x40')]({},_0x3537f9,_0x2446c9['options']);var _0x7d20ed={'where':_0x3537f9['where']};return db['VoiceDialReport'][_0x5400('0x44')](_0x7d20ed)[_0x5400('0x28')](function(_0x583941){_0x417c7b['count']=_0x583941;if(_0x2446c9[_0x5400('0x34')]['includeAll']){_0x3537f9[_0x5400('0x45')]=[{'all':!![]}];}return db[_0x5400('0x2f')]['findAll'](_0x3537f9);})[_0x5400('0x28')](function(_0x1220b8){_0x417c7b[_0x5400('0x46')]=_0x1220b8;return _0x417c7b;})[_0x5400('0x28')](respondWithFilteredResult(_0x56990a,_0x3537f9))[_0x5400('0x47')](handleError(_0x56990a,null));};exports['show']=function(_0x379fe8,_0x3a8f5a){var _0x1f6d2e={'raw':!![],'where':{'id':_0x379fe8[_0x5400('0x48')]['id']}},_0x4ef870={};_0x4ef870[_0x5400('0x39')]=_[_0x5400('0x35')](db[_0x5400('0x2f')][_0x5400('0x30')]);_0x4ef870[_0x5400('0x34')]=_[_0x5400('0x35')](_0x379fe8[_0x5400('0x34')]);_0x4ef870[_0x5400('0x36')]=_[_0x5400('0x37')](_0x4ef870[_0x5400('0x39')],_0x4ef870[_0x5400('0x34')]);_0x1f6d2e[_0x5400('0x38')]=_['intersection'](_0x4ef870['model'],qs[_0x5400('0x3a')](_0x379fe8[_0x5400('0x34')][_0x5400('0x3a')]));_0x1f6d2e[_0x5400('0x38')]=_0x1f6d2e['attributes']['length']?_0x1f6d2e[_0x5400('0x38')]:_0x4ef870[_0x5400('0x39')];if(_0x379fe8[_0x5400('0x34')][_0x5400('0x49')]){_0x1f6d2e[_0x5400('0x45')]=[{'all':!![]}];}_0x1f6d2e=_[_0x5400('0x40')]({},_0x1f6d2e,_0x379fe8[_0x5400('0x4a')]);return db[_0x5400('0x2f')]['find'](_0x1f6d2e)['then'](handleEntityNotFound(_0x3a8f5a,null))['then'](respondWithResult(_0x3a8f5a,null))['catch'](handleError(_0x3a8f5a,null));};exports['create']=function(_0x16e510,_0x58d244){return db[_0x5400('0x2f')][_0x5400('0x4b')](_0x16e510[_0x5400('0x4c')],{})[_0x5400('0x28')](respondWithResult(_0x58d244,0xc9))[_0x5400('0x47')](handleError(_0x58d244,null));};exports[_0x5400('0x27')]=function(_0x2aa999,_0x2ac71f){if(_0x2aa999[_0x5400('0x4c')]['id']){delete _0x2aa999[_0x5400('0x4c')]['id'];}return db['VoiceDialReport'][_0x5400('0x4d')]({'where':{'id':_0x2aa999[_0x5400('0x48')]['id']}})[_0x5400('0x28')](handleEntityNotFound(_0x2ac71f,null))[_0x5400('0x28')](saveUpdates(_0x2aa999[_0x5400('0x4c')],null))[_0x5400('0x28')](respondWithResult(_0x2ac71f,null))['catch'](handleError(_0x2ac71f,null));};exports[_0x5400('0x4e')]=function(_0x30d95c,_0x1e9da8){return db[_0x5400('0x2f')]['find']({'where':{'id':_0x30d95c[_0x5400('0x48')]['id']}})[_0x5400('0x28')](handleEntityNotFound(_0x1e9da8,null))['then'](removeEntity(_0x1e9da8,null))[_0x5400('0x47')](handleError(_0x1e9da8,null));};exports['describe']=function(_0x503c3e,_0x4ed620){return db[_0x5400('0x2f')][_0x5400('0x4f')]()['then'](respondWithResult(_0x4ed620,null))[_0x5400('0x47')](handleError(_0x4ed620,null));}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.model.js b/server/api/voiceDialReport/voiceDialReport.model.js index 6b1c0f0..2d90c57 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 _0xa1a3=['bluebird','../../config/environment','exports','define','VoiceDialReport','report_dial','uniqueid','util','moment'];(function(_0x56482c,_0x16118d){var _0x5aae7a=function(_0x52512f){while(--_0x52512f){_0x56482c['push'](_0x56482c['shift']());}};_0x5aae7a(++_0x16118d);}(_0xa1a3,0x1d2));var _0x3a1a=function(_0xbb8a47,_0x47e5f2){_0xbb8a47=_0xbb8a47-0x0;var _0x3be3b6=_0xa1a3[_0xbb8a47];return _0x3be3b6;};'use strict';var _=require('lodash');var util=require(_0x3a1a('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x3a1a('0x1'));var BPromise=require(_0x3a1a('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x3a1a('0x3'));var attributes=require('./voiceDialReport.attributes');module[_0x3a1a('0x4')]=function(_0xad22e6,_0x1af970){return _0xad22e6[_0x3a1a('0x5')](_0x3a1a('0x6'),attributes,{'tableName':_0x3a1a('0x7'),'paranoid':![],'indexes':[{'fields':[_0x3a1a('0x8')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x65c7=['../../config/logger','api','moment','request-promise','rimraf','../../config/environment','./voiceDialReport.attributes','exports','VoiceDialReport','report_dial','uniqueid','util'];(function(_0x3e8270,_0x293590){var _0x1ccde9=function(_0x213490){while(--_0x213490){_0x3e8270['push'](_0x3e8270['shift']());}};_0x1ccde9(++_0x293590);}(_0x65c7,0x137));var _0x765c=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x65c7[_0x501510];return _0x1e6ee5;};'use strict';var _=require('lodash');var util=require(_0x765c('0x0'));var logger=require(_0x765c('0x1'))(_0x765c('0x2'));var moment=require(_0x765c('0x3'));var BPromise=require('bluebird');var rp=require(_0x765c('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x765c('0x5'));var config=require(_0x765c('0x6'));var attributes=require(_0x765c('0x7'));module[_0x765c('0x8')]=function(_0x3a127b,_0x87e37f){return _0x3a127b['define'](_0x765c('0x9'),attributes,{'tableName':_0x765c('0xa'),'paranoid':![],'indexes':[{'fields':[_0x765c('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.rpc.js b/server/api/voiceDialReport/voiceDialReport.rpc.js index bbf5ba0..2d88828 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 _0x521b=['request\x20sent','debug','VoiceDialReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateVoiceDialReport','VoiceDialReport','body','options','UpdateVoiceDialReport','update','raw','where','attributes','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','client','http','request','then','info','VoiceDialReport,\x20%s,\x20%s'];(function(_0x50f392,_0x1d8441){var _0x5926f2=function(_0x17df32){while(--_0x17df32){_0x50f392['push'](_0x50f392['shift']());}};_0x5926f2(++_0x1d8441);}(_0x521b,0xb8));var _0xb521=function(_0x25a055,_0x173511){_0x25a055=_0x25a055-0x0;var _0x2295f9=_0x521b[_0x25a055];return _0x2295f9;};'use strict';var _=require(_0xb521('0x0'));var util=require(_0xb521('0x1'));var moment=require(_0xb521('0x2'));var BPromise=require(_0xb521('0x3'));var rs=require(_0xb521('0x4'));var fs=require('fs');var Redis=require(_0xb521('0x5'));var db=require(_0xb521('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xb521('0x7'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xb521('0x8')][_0xb521('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x57d7c2,_0x28f32a,_0x1da442){return new BPromise(function(_0x3ab557,_0xc6fb2f){return client[_0xb521('0xa')](_0x57d7c2,_0x1da442)[_0xb521('0xb')](function(_0x4f1f7a){logger[_0xb521('0xc')](_0xb521('0xd'),_0x28f32a,_0xb521('0xe'));logger[_0xb521('0xf')](_0xb521('0x10'),_0x28f32a,'request\x20sent',JSON[_0xb521('0x11')](_0x4f1f7a));if(_0x4f1f7a['error']){if(_0x4f1f7a[_0xb521('0x12')][_0xb521('0x13')]===0x1f4){logger['error'](_0xb521('0xd'),_0x28f32a,_0x4f1f7a[_0xb521('0x12')][_0xb521('0x14')]);return _0xc6fb2f(_0x4f1f7a[_0xb521('0x12')][_0xb521('0x14')]);}logger[_0xb521('0x12')](_0xb521('0xd'),_0x28f32a,_0x4f1f7a['error'][_0xb521('0x14')]);return _0x3ab557(_0x4f1f7a[_0xb521('0x12')]['message']);}else{logger[_0xb521('0xc')]('VoiceDialReport,\x20%s,\x20%s',_0x28f32a,_0xb521('0xe'));_0x3ab557(_0x4f1f7a[_0xb521('0x15')][_0xb521('0x14')]);}})[_0xb521('0x16')](function(_0x55e947){logger['error']('VoiceDialReport,\x20%s,\x20%s',_0x28f32a,_0x55e947);_0xc6fb2f(_0x55e947);});});}exports[_0xb521('0x17')]=function(_0x48f9c6){var _0x4ce48f=this;return new Promise(function(_0x728a65,_0x547f97){return db[_0xb521('0x18')]['create'](_0x48f9c6[_0xb521('0x19')],{'raw':_0x48f9c6[_0xb521('0x1a')]?_0x48f9c6[_0xb521('0x1a')]['raw']===undefined?!![]:![]:!![]})[_0xb521('0xb')](function(_0x1fe7bd){logger[_0xb521('0xc')](_0xb521('0x17'),_0x48f9c6);logger[_0xb521('0xf')](_0xb521('0x17'),_0x48f9c6,JSON['stringify'](_0x1fe7bd));_0x728a65(_0x1fe7bd);})[_0xb521('0x16')](function(_0x23a192){logger[_0xb521('0x12')](_0xb521('0x17'),_0x23a192[_0xb521('0x14')],_0x48f9c6);_0x547f97(_0x4ce48f[_0xb521('0x12')](0x1f4,_0x23a192['message']));});});};exports[_0xb521('0x1b')]=function(_0x3ba45e){var _0x2ed55d=this;return new Promise(function(_0x22fcda,_0xee597a){return db[_0xb521('0x18')][_0xb521('0x1c')](_0x3ba45e[_0xb521('0x19')],{'raw':_0x3ba45e[_0xb521('0x1a')]?_0x3ba45e[_0xb521('0x1a')][_0xb521('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3ba45e[_0xb521('0x1a')]?_0x3ba45e[_0xb521('0x1a')][_0xb521('0x1e')]||null:null,'attributes':_0x3ba45e[_0xb521('0x1a')]?_0x3ba45e[_0xb521('0x1a')][_0xb521('0x1f')]||null:null,'limit':_0x3ba45e[_0xb521('0x1a')]?_0x3ba45e[_0xb521('0x1a')][_0xb521('0x20')]||null:null})[_0xb521('0xb')](function(_0x47934c){logger[_0xb521('0xc')]('UpdateVoiceDialReport',_0x3ba45e);logger[_0xb521('0xf')](_0xb521('0x1b'),_0x3ba45e,JSON['stringify'](_0x47934c));_0x22fcda(_0x47934c);})[_0xb521('0x16')](function(_0x473c10){logger[_0xb521('0x12')]('UpdateVoiceDialReport',_0x473c10[_0xb521('0x14')],_0x3ba45e);_0xee597a(_0x2ed55d[_0xb521('0x12')](0x1f4,_0x473c10[_0xb521('0x14')]));});});}; \ No newline at end of file +var _0xbacd=['../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','then','info','request\x20sent','debug','VoiceDialReport,\x20%s,\x20%s,\x20%s','error','VoiceDialReport,\x20%s,\x20%s','message','result','CreateVoiceDialReport','VoiceDialReport','create','options','raw','stringify','catch','UpdateVoiceDialReport','update','body','attributes','limit','lodash','util','bluebird','randomstring','ioredis'];(function(_0xba32bb,_0x451331){var _0x14eb0d=function(_0x4062be){while(--_0x4062be){_0xba32bb['push'](_0xba32bb['shift']());}};_0x14eb0d(++_0x451331);}(_0xbacd,0x103));var _0xdbac=function(_0x3b37e9,_0x4fb60){_0x3b37e9=_0x3b37e9-0x0;var _0x381481=_0xbacd[_0x3b37e9];return _0x381481;};'use strict';var _=require(_0xdbac('0x0'));var util=require(_0xdbac('0x1'));var moment=require('moment');var BPromise=require(_0xdbac('0x2'));var rs=require(_0xdbac('0x3'));var fs=require('fs');var Redis=require(_0xdbac('0x4'));var db=require(_0xdbac('0x5'))['db'];var utils=require(_0xdbac('0x6'));var logger=require(_0xdbac('0x7'))(_0xdbac('0x8'));var config=require('../../config/environment');var jayson=require(_0xdbac('0x9'));var client=jayson[_0xdbac('0xa')][_0xdbac('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x62d381,_0xfcffa1,_0x1ba50a){return new BPromise(function(_0x277a8a,_0x5d6446){return client['request'](_0x62d381,_0x1ba50a)[_0xdbac('0xc')](function(_0x1e4bef){logger[_0xdbac('0xd')]('VoiceDialReport,\x20%s,\x20%s',_0xfcffa1,_0xdbac('0xe'));logger[_0xdbac('0xf')](_0xdbac('0x10'),_0xfcffa1,_0xdbac('0xe'),JSON['stringify'](_0x1e4bef));if(_0x1e4bef['error']){if(_0x1e4bef[_0xdbac('0x11')]['code']===0x1f4){logger['error'](_0xdbac('0x12'),_0xfcffa1,_0x1e4bef[_0xdbac('0x11')][_0xdbac('0x13')]);return _0x5d6446(_0x1e4bef[_0xdbac('0x11')][_0xdbac('0x13')]);}logger[_0xdbac('0x11')](_0xdbac('0x12'),_0xfcffa1,_0x1e4bef[_0xdbac('0x11')][_0xdbac('0x13')]);return _0x277a8a(_0x1e4bef['error'][_0xdbac('0x13')]);}else{logger[_0xdbac('0xd')](_0xdbac('0x12'),_0xfcffa1,_0xdbac('0xe'));_0x277a8a(_0x1e4bef[_0xdbac('0x14')][_0xdbac('0x13')]);}})['catch'](function(_0x15c951){logger['error'](_0xdbac('0x12'),_0xfcffa1,_0x15c951);_0x5d6446(_0x15c951);});});}exports[_0xdbac('0x15')]=function(_0x1061b9){var _0x2be56c=this;return new Promise(function(_0x25d02b,_0x56f80d){return db[_0xdbac('0x16')][_0xdbac('0x17')](_0x1061b9['body'],{'raw':_0x1061b9[_0xdbac('0x18')]?_0x1061b9[_0xdbac('0x18')][_0xdbac('0x19')]===undefined?!![]:![]:!![]})[_0xdbac('0xc')](function(_0x5e0ca2){logger['info']('CreateVoiceDialReport',_0x1061b9);logger['debug'](_0xdbac('0x15'),_0x1061b9,JSON[_0xdbac('0x1a')](_0x5e0ca2));_0x25d02b(_0x5e0ca2);})[_0xdbac('0x1b')](function(_0x91f8db){logger[_0xdbac('0x11')](_0xdbac('0x15'),_0x91f8db[_0xdbac('0x13')],_0x1061b9);_0x56f80d(_0x2be56c[_0xdbac('0x11')](0x1f4,_0x91f8db[_0xdbac('0x13')]));});});};exports[_0xdbac('0x1c')]=function(_0x71122b){var _0x2a0e89=this;return new Promise(function(_0xe9754c,_0x241c0d){return db[_0xdbac('0x16')][_0xdbac('0x1d')](_0x71122b[_0xdbac('0x1e')],{'raw':_0x71122b[_0xdbac('0x18')]?_0x71122b['options'][_0xdbac('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x71122b[_0xdbac('0x18')]?_0x71122b['options']['where']||null:null,'attributes':_0x71122b[_0xdbac('0x18')]?_0x71122b['options'][_0xdbac('0x1f')]||null:null,'limit':_0x71122b[_0xdbac('0x18')]?_0x71122b[_0xdbac('0x18')][_0xdbac('0x20')]||null:null})[_0xdbac('0xc')](function(_0x423469){logger[_0xdbac('0xd')](_0xdbac('0x1c'),_0x71122b);logger[_0xdbac('0xf')](_0xdbac('0x1c'),_0x71122b,JSON[_0xdbac('0x1a')](_0x423469));_0xe9754c(_0x423469);})[_0xdbac('0x1b')](function(_0x27d471){logger[_0xdbac('0x11')](_0xdbac('0x1c'),_0x27d471['message'],_0x71122b);_0x241c0d(_0x2a0e89['error'](0x1f4,_0x27d471['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/index.js b/server/api/voiceExtension/index.js index 0dc1a91..0107403 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 _0x3aa2=['destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','get','/:id','show','create','post','/:id/applications','put','update','delete'];(function(_0x5c2a2b,_0x22c94e){var _0x19921f=function(_0x3fb937){while(--_0x3fb937){_0x5c2a2b['push'](_0x5c2a2b['shift']());}};_0x19921f(++_0x22c94e);}(_0x3aa2,0x1ba));var _0x23aa=function(_0x19cb1a,_0x4ce1b2){_0x19cb1a=_0x19cb1a-0x0;var _0x399650=_0x3aa2[_0x19cb1a];return _0x399650;};'use strict';var multer=require(_0x23aa('0x0'));var util=require(_0x23aa('0x1'));var path=require(_0x23aa('0x2'));var timeout=require(_0x23aa('0x3'));var express=require(_0x23aa('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x23aa('0x5'));var interaction=require(_0x23aa('0x6'));var config=require(_0x23aa('0x7'));var controller=require('./voiceExtension.controller');router['get']('/',auth[_0x23aa('0x8')](),controller['index']);router[_0x23aa('0x9')](_0x23aa('0xa'),auth[_0x23aa('0x8')](),controller[_0x23aa('0xb')]);router['post']('/',auth[_0x23aa('0x8')](),controller[_0x23aa('0xc')]);router[_0x23aa('0xd')](_0x23aa('0xe'),auth['isAuthenticated'](),controller['addApplications']);router[_0x23aa('0xf')]('/:id',auth[_0x23aa('0x8')](),controller[_0x23aa('0x10')]);router[_0x23aa('0x11')](_0x23aa('0xa'),auth[_0x23aa('0x8')](),controller[_0x23aa('0x12')]);module[_0x23aa('0x13')]=router; \ No newline at end of file +var _0x0fe9=['../../config/environment','get','isAuthenticated','create','post','/:id/applications','addApplications','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x3f5415,_0x281c73){var _0x1892d9=function(_0x224867){while(--_0x224867){_0x3f5415['push'](_0x3f5415['shift']());}};_0x1892d9(++_0x281c73);}(_0x0fe9,0x19c));var _0x90fe=function(_0x1e56bd,_0x42e6a2){_0x1e56bd=_0x1e56bd-0x0;var _0x35aded=_0x0fe9[_0x1e56bd];return _0x35aded;};'use strict';var multer=require(_0x90fe('0x0'));var util=require(_0x90fe('0x1'));var path=require(_0x90fe('0x2'));var timeout=require(_0x90fe('0x3'));var express=require('express');var router=express[_0x90fe('0x4')]();var fs_extra=require(_0x90fe('0x5'));var auth=require(_0x90fe('0x6'));var interaction=require(_0x90fe('0x7'));var config=require(_0x90fe('0x8'));var controller=require('./voiceExtension.controller');router[_0x90fe('0x9')]('/',auth['isAuthenticated'](),controller['index']);router['get']('/:id',auth[_0x90fe('0xa')](),controller['show']);router['post']('/',auth[_0x90fe('0xa')](),controller[_0x90fe('0xb')]);router[_0x90fe('0xc')](_0x90fe('0xd'),auth[_0x90fe('0xa')](),controller[_0x90fe('0xe')]);router[_0x90fe('0xf')](_0x90fe('0x10'),auth[_0x90fe('0xa')](),controller[_0x90fe('0x11')]);router[_0x90fe('0x12')](_0x90fe('0x10'),auth[_0x90fe('0xa')](),controller[_0x90fe('0x13')]);module[_0x90fe('0x14')]=router; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.attributes.js b/server/api/voiceExtension/voiceExtension.attributes.js index b5bc454..03fb01d 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 _0x0166=['BOOLEAN','VIRTUAL','getDataValue','exten','sequelize','exports','STRING','compositeIndex','inbound','outbound','internal','inbound-fax','outbound-fax','system','any','*,*,*,*','INTEGER'];(function(_0x308b60,_0x39b5bc){var _0x4b33a5=function(_0x49d1cc){while(--_0x49d1cc){_0x308b60['push'](_0x308b60['shift']());}};_0x4b33a5(++_0x39b5bc);}(_0x0166,0x7b));var _0x6016=function(_0x504385,_0x4d19db){_0x504385=_0x504385-0x0;var _0x3fa96f=_0x0166[_0x504385];return _0x3fa96f;};'use strict';var Sequelize=require(_0x6016('0x0'));module[_0x6016('0x1')]={'context':{'type':Sequelize[_0x6016('0x2')],'allowNull':![],'unique':_0x6016('0x3'),'validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x6016('0x3')},'priority':{'type':Sequelize[_0x6016('0x2')],'allowNull':![],'defaultValue':'1','unique':'compositeIndex'},'tag':{'type':Sequelize[_0x6016('0x2')],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize[_0x6016('0x2')],'allowNull':![],'defaultValue':'NoOp'},'appdata':{'type':Sequelize['STRING'](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize['ENUM'](_0x6016('0x4'),_0x6016('0x5'),_0x6016('0x6'),_0x6016('0x7'),_0x6016('0x8'),_0x6016('0x9'),_0x6016('0xa')),'allowNull':![]},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x6016('0x2')],'allowNull':![],'defaultValue':_0x6016('0xb')},'IntervalId':{'type':Sequelize[_0x6016('0xc')]},'isApp':{'type':Sequelize[_0x6016('0xd')],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize[_0x6016('0x2')],'defaultValue':null},'callerID':{'type':Sequelize[_0x6016('0x2')],'allowNull':!![]},'record':{'type':Sequelize[_0x6016('0xd')],'defaultValue':![]},'cutdigits':{'type':Sequelize[_0x6016('0xc')]},'recordingFormat':{'type':Sequelize[_0x6016('0x2')],'defaultValue':'wav'},'answer':{'type':Sequelize[_0x6016('0xd')],'defaultValue':!![]},'name':{'type':Sequelize[_0x6016('0xe')],'get':function(_0x9c2c3f){return this[_0x6016('0xf')](_0x6016('0x10'));}},'alias':{'type':Sequelize[_0x6016('0x2')],'allowNull':!![]}}; \ No newline at end of file +var _0xeece=['inbound-fax','outbound-fax','system','*,*,*,*','INTEGER','BOOLEAN','wav','VIRTUAL','getDataValue','sequelize','exports','STRING','compositeIndex','NoOp','ENUM','inbound','outbound'];(function(_0x504d0e,_0x56b84b){var _0x5f408a=function(_0x396c76){while(--_0x396c76){_0x504d0e['push'](_0x504d0e['shift']());}};_0x5f408a(++_0x56b84b);}(_0xeece,0x1a1));var _0xeeec=function(_0x3f415c,_0x310f72){_0x3f415c=_0x3f415c-0x0;var _0x8f2df8=_0xeece[_0x3f415c];return _0x8f2df8;};'use strict';var Sequelize=require(_0xeeec('0x0'));module[_0xeeec('0x1')]={'context':{'type':Sequelize[_0xeeec('0x2')],'allowNull':![],'unique':_0xeeec('0x3'),'validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xeeec('0x3')},'priority':{'type':Sequelize[_0xeeec('0x2')],'allowNull':![],'defaultValue':'1','unique':'compositeIndex'},'tag':{'type':Sequelize[_0xeeec('0x2')],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize[_0xeeec('0x2')],'allowNull':![],'defaultValue':_0xeeec('0x4')},'appdata':{'type':Sequelize[_0xeeec('0x2')](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize[_0xeeec('0x5')](_0xeeec('0x6'),_0xeeec('0x7'),'internal',_0xeeec('0x8'),_0xeeec('0x9'),_0xeeec('0xa'),'any'),'allowNull':![]},'description':{'type':Sequelize[_0xeeec('0x2')]},'interval':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xeeec('0xb')},'IntervalId':{'type':Sequelize[_0xeeec('0xc')]},'isApp':{'type':Sequelize[_0xeeec('0xd')],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize[_0xeeec('0x2')],'defaultValue':null},'callerID':{'type':Sequelize['STRING'],'allowNull':!![]},'record':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'cutdigits':{'type':Sequelize[_0xeeec('0xc')]},'recordingFormat':{'type':Sequelize[_0xeeec('0x2')],'defaultValue':_0xeeec('0xe')},'answer':{'type':Sequelize[_0xeeec('0xd')],'defaultValue':!![]},'name':{'type':Sequelize[_0xeeec('0xf')],'get':function(_0x57c13c){return this[_0xeeec('0x10')]('exten');}},'alias':{'type':Sequelize[_0xeeec('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 425f760..d17fa5f 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 _0xe563=['internal','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','pick','description','recordingFormat','mandatoryDisposition','alias','addApplications','transaction','sequelize','ISOLATION_LEVELS','findOne','createRouting','bulkCreate','findAndCountAll','cast(priority\x20as\x20unsigned)','finally','send','lodash','ioredis','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./voiceExtension.socket','sendStatus','status','limit','undefined','count','offset','set','json','then','get','InboundRoutes','inbound','OutboundRoutes','outbound','filter','ignore','value','includes','type','find','name','UserProfileResource','destroy','error','stack','VoiceExtension','rawAttributes','fieldName','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','merge','map','VIRTUAL','includeAll','findAll','rows','show','include','options','catch','create','body','exten','concat','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','InternalRoutes'];(function(_0x7243a2,_0x4eb58c){var _0x16c32e=function(_0x4bc52b){while(--_0x4bc52b){_0x7243a2['push'](_0x7243a2['shift']());}};_0x16c32e(++_0x4eb58c);}(_0xe563,0x12e));var _0x3e56=function(_0x42f57c,_0x25b2a4){_0x42f57c=_0x42f57c-0x0;var _0xf09124=_0xe563[_0x42f57c];return _0xf09124;};'use strict';var _=require(_0x3e56('0x0'));var Redis=require(_0x3e56('0x1'));var qs=require(_0x3e56('0x2'));var logger=require(_0x3e56('0x3'))('api');var config=require(_0x3e56('0x4'));var db=require(_0x3e56('0x5'))['db'];config[_0x3e56('0x6')]=_[_0x3e56('0x7')](config['redis'],{'host':_0x3e56('0x8'),'port':0x18eb});var socket=require(_0x3e56('0x9'))(new Redis(config[_0x3e56('0x6')]));require(_0x3e56('0xa'))['register'](socket);function respondWithStatusCode(_0x4b9f66,_0x10654b){_0x10654b=_0x10654b||0xcc;return function(_0x358191){if(_0x358191){return _0x4b9f66[_0x3e56('0xb')](_0x10654b);}return _0x4b9f66['status'](_0x10654b)['end']();};}function respondWithResult(_0x4d1213,_0xc07388){_0xc07388=_0xc07388||0xc8;return function(_0x32de55){if(_0x32de55){return _0x4d1213[_0x3e56('0xc')](_0xc07388)['json'](_0x32de55);}};}function respondWithFilteredResult(_0x19ca73,_0x4759fe){return function(_0x56a7c8){if(_0x56a7c8){var _0x14b610=typeof _0x4759fe['offset']==='undefined'&&typeof _0x4759fe[_0x3e56('0xd')]===_0x3e56('0xe');var _0x279396=_0x56a7c8[_0x3e56('0xf')];var _0x5dda3e=_0x14b610?0x0:_0x4759fe[_0x3e56('0x10')];var _0x1dde6e=_0x14b610?_0x56a7c8['count']:_0x4759fe['offset']+_0x4759fe[_0x3e56('0xd')];var _0x5b2a48;if(_0x1dde6e>=_0x279396){_0x1dde6e=_0x279396;_0x5b2a48=0xc8;}else{_0x5b2a48=0xce;}_0x19ca73['status'](_0x5b2a48);return _0x19ca73[_0x3e56('0x11')]('Content-Range',_0x5dda3e+'-'+_0x1dde6e+'/'+_0x279396)[_0x3e56('0x12')](_0x56a7c8);}return null;};}function removeEntity(_0x1894da){return function(_0x13e6b1){if(_0x13e6b1){return _0x13e6b1['destroy']()[_0x3e56('0x13')](function(){var _0x421ca=_0x13e6b1[_0x3e56('0x14')]({'plain':!![]});var _0x48fcba=[{'name':_0x3e56('0x15'),'value':_0x3e56('0x16'),'ignore':![]},{'name':_0x3e56('0x17'),'value':_0x3e56('0x18'),'ignore':![]},{'name':'InternalRoutes','value':'internal','ignore':![]}];var _0x2f90a6=_(_0x48fcba)[_0x3e56('0x19')](_0x3e56('0x1a'))['map'](_0x3e56('0x1b'))[_0x3e56('0x1b')]();if(_[_0x3e56('0x1c')](_0x2f90a6,_0x421ca[_0x3e56('0x1d')])){return;}var _0xa7ec92=_[_0x3e56('0x1e')](_0x48fcba,[_0x3e56('0x1b'),_0x421ca[_0x3e56('0x1d')]])[_0x3e56('0x1f')];return db[_0x3e56('0x20')][_0x3e56('0x21')]({'where':{'type':_0xa7ec92,'resourceId':_0x421ca['id']}})[_0x3e56('0x13')](function(){return _0x13e6b1;});})[_0x3e56('0x13')](function(){_0x1894da[_0x3e56('0xc')](0xcc)['end']();});}};}function handleEntityNotFound(_0xb0be3d){return function(_0x52cfc2){if(!_0x52cfc2){_0xb0be3d[_0x3e56('0xb')](0x194);}return _0x52cfc2;};}function handleError(_0x169ccc,_0x3b6eb1){_0x3b6eb1=_0x3b6eb1||0x1f4;return function(_0x178681){logger[_0x3e56('0x22')](_0x178681[_0x3e56('0x23')]);if(_0x178681[_0x3e56('0x1f')]){delete _0x178681[_0x3e56('0x1f')];}_0x169ccc[_0x3e56('0xc')](_0x3b6eb1)['send'](_0x178681);};}exports['index']=function(_0x3f0b07,_0x501129){var _0x25bd22={},_0x1067c0={},_0x5b4a10={'count':0x0,'rows':[]};var _0x318ee0=_['map'](db[_0x3e56('0x24')][_0x3e56('0x25')],function(_0xc38708){return{'name':_0xc38708[_0x3e56('0x26')],'type':_0xc38708[_0x3e56('0x1d')][_0x3e56('0x27')]};});_0x1067c0['model']=_['map'](_0x318ee0,'name');_0x1067c0[_0x3e56('0x28')]=_[_0x3e56('0x29')](_0x3f0b07[_0x3e56('0x28')]);_0x1067c0[_0x3e56('0x2a')]=_[_0x3e56('0x2b')](_0x1067c0[_0x3e56('0x2c')],_0x1067c0[_0x3e56('0x28')]);_0x25bd22[_0x3e56('0x2d')]=_[_0x3e56('0x2b')](_0x1067c0[_0x3e56('0x2c')],qs['fields'](_0x3f0b07[_0x3e56('0x28')][_0x3e56('0x2e')]));_0x25bd22['attributes']=_0x25bd22[_0x3e56('0x2d')][_0x3e56('0x2f')]?_0x25bd22[_0x3e56('0x2d')]:_0x1067c0[_0x3e56('0x2c')];if(!_0x3f0b07[_0x3e56('0x28')][_0x3e56('0x30')](_0x3e56('0x31'))){_0x25bd22['limit']=qs['limit'](_0x3f0b07[_0x3e56('0x28')][_0x3e56('0xd')]);_0x25bd22[_0x3e56('0x10')]=qs[_0x3e56('0x10')](_0x3f0b07[_0x3e56('0x28')][_0x3e56('0x10')]);}_0x25bd22['order']=qs[_0x3e56('0x32')](_0x3f0b07[_0x3e56('0x28')]['sort']);_0x25bd22[_0x3e56('0x33')]=qs[_0x3e56('0x2a')](_['pick'](_0x3f0b07[_0x3e56('0x28')],_0x1067c0[_0x3e56('0x2a')]),_0x318ee0);if(_0x3f0b07[_0x3e56('0x28')][_0x3e56('0x19')]){_0x25bd22[_0x3e56('0x33')]=_[_0x3e56('0x34')](_0x25bd22[_0x3e56('0x33')],{'$or':_[_0x3e56('0x35')](_0x318ee0,function(_0x53ab62){if(_0x53ab62['type']!==_0x3e56('0x36')){var _0x213a83={};_0x213a83[_0x53ab62[_0x3e56('0x1f')]]={'$like':'%'+_0x3f0b07[_0x3e56('0x28')]['filter']+'%'};return _0x213a83;}})});}_0x25bd22=_[_0x3e56('0x34')]({},_0x25bd22,_0x3f0b07['options']);var _0x5953bf={'where':_0x25bd22[_0x3e56('0x33')]};return db[_0x3e56('0x24')][_0x3e56('0xf')](_0x5953bf)['then'](function(_0x1af0f7){_0x5b4a10[_0x3e56('0xf')]=_0x1af0f7;if(_0x3f0b07[_0x3e56('0x28')][_0x3e56('0x37')]){_0x25bd22['include']=[{'all':!![]}];}return db[_0x3e56('0x24')][_0x3e56('0x38')](_0x25bd22);})[_0x3e56('0x13')](function(_0x223528){_0x5b4a10[_0x3e56('0x39')]=_0x223528;return _0x5b4a10;})[_0x3e56('0x13')](respondWithFilteredResult(_0x501129,_0x25bd22))['catch'](handleError(_0x501129,null));};exports[_0x3e56('0x3a')]=function(_0x144df9,_0x2c3dc4){var _0x742b55={'raw':![],'where':{'id':_0x144df9['params']['id']}},_0x5907e3={};_0x5907e3[_0x3e56('0x2c')]=_[_0x3e56('0x29')](db[_0x3e56('0x24')][_0x3e56('0x25')]);_0x5907e3[_0x3e56('0x28')]=_[_0x3e56('0x29')](_0x144df9['query']);_0x5907e3[_0x3e56('0x2a')]=_[_0x3e56('0x2b')](_0x5907e3[_0x3e56('0x2c')],_0x5907e3[_0x3e56('0x28')]);_0x742b55[_0x3e56('0x2d')]=_[_0x3e56('0x2b')](_0x5907e3['model'],qs['fields'](_0x144df9[_0x3e56('0x28')][_0x3e56('0x2e')]));_0x742b55[_0x3e56('0x2d')]=_0x742b55[_0x3e56('0x2d')][_0x3e56('0x2f')]?_0x742b55[_0x3e56('0x2d')]:_0x5907e3[_0x3e56('0x2c')];if(_0x144df9[_0x3e56('0x28')][_0x3e56('0x37')]){_0x742b55[_0x3e56('0x3b')]=[{'all':!![]}];}_0x742b55=_[_0x3e56('0x34')]({},_0x742b55,_0x144df9[_0x3e56('0x3c')]);return db[_0x3e56('0x24')][_0x3e56('0x1e')](_0x742b55)['then'](handleEntityNotFound(_0x2c3dc4,null))[_0x3e56('0x13')](respondWithResult(_0x2c3dc4,null))['catch'](handleError(_0x2c3dc4,null));};exports[_0x3e56('0x21')]=function(_0x4e25a5,_0x18dbef){return db[_0x3e56('0x24')][_0x3e56('0x1e')]({'where':{'id':_0x4e25a5['params']['id']}})[_0x3e56('0x13')](handleEntityNotFound(_0x18dbef,null))[_0x3e56('0x13')](removeEntity(_0x18dbef,null))[_0x3e56('0x3d')](handleError(_0x18dbef,null));};exports[_0x3e56('0x3e')]=function(_0x5a3985,_0x58da18){if(_0x5a3985['body']['type']==='outbound'&&!_['startsWith'](_0x5a3985[_0x3e56('0x3f')]['exten'],'_')){_0x5a3985[_0x3e56('0x3f')][_0x3e56('0x40')]='_'[_0x3e56('0x41')](_0x5a3985[_0x3e56('0x3f')][_0x3e56('0x40')]);}return db[_0x3e56('0x24')][_0x3e56('0x3e')](_0x5a3985[_0x3e56('0x3f')],{'raw':![]})['then'](function(_0x4c8abe){var _0x433aa7=_0x5a3985[_0x3e56('0x42')][_0x3e56('0x14')]({'plain':!![]});if(!_0x433aa7)throw new Error(_0x3e56('0x43'));if(_0x433aa7[_0x3e56('0x44')]===_0x3e56('0x42')){var _0x3443d4=_0x4c8abe['get']({'plain':!![]});var _0x91951=[{'name':_0x3e56('0x15'),'value':_0x3e56('0x16')},{'name':'OutboundRoutes','value':'outbound'},{'name':_0x3e56('0x45'),'value':_0x3e56('0x46')}];var _0x2be141=_[_0x3e56('0x1e')](_0x91951,[_0x3e56('0x1b'),_0x3443d4['type']])[_0x3e56('0x1f')];return db[_0x3e56('0x47')][_0x3e56('0x1e')]({'where':{'name':_0x2be141,'userProfileId':_0x433aa7[_0x3e56('0x48')]},'raw':!![]})[_0x3e56('0x13')](function(_0x4538a9){if(_0x4538a9&&_0x4538a9[_0x3e56('0x49')]===0x0){return db[_0x3e56('0x20')]['create']({'name':_0x3443d4[_0x3e56('0x1f')],'resourceId':_0x3443d4['id'],'type':_0x4538a9[_0x3e56('0x1f')],'sectionId':_0x4538a9['id']},{})[_0x3e56('0x13')](function(){return _0x4c8abe;});}else{return _0x4c8abe;}})[_0x3e56('0x3d')](function(_0x2b9b80){logger[_0x3e56('0x22')](_0x3e56('0x4a'),_0x2b9b80);throw _0x2b9b80;});}return _0x4c8abe;})['then'](respondWithResult(_0x58da18,0xc9))[_0x3e56('0x3d')](handleError(_0x58da18,null));};exports[_0x3e56('0x4b')]=function(_0x5ed90d,_0x2cbfe9){if(_0x5ed90d[_0x3e56('0x3f')]['id']){delete _0x5ed90d['body']['id'];}return db[_0x3e56('0x24')][_0x3e56('0x1e')]({'where':{'id':_0x5ed90d[_0x3e56('0x4c')]['id']}})[_0x3e56('0x13')](handleEntityNotFound(_0x2cbfe9,null))['then'](function(_0xdbb2b5){if(_0xdbb2b5){return db['VoiceExtension'][_0x3e56('0x4b')](_[_0x3e56('0x4d')](_0x5ed90d['body'],[_0x3e56('0x40'),'context',_0x3e56('0x4e'),_0x3e56('0x4f'),'cutdigits',_0x3e56('0x50'),_0x3e56('0x51')]),{'where':{'context':_0xdbb2b5['context'],'exten':_0xdbb2b5[_0x3e56('0x40')]},'individualHooks':!![]})['then'](function(_0x396cfb){return _0x396cfb;});}return null;})[_0x3e56('0x13')](respondWithStatusCode(_0x2cbfe9,null))['catch'](handleError(_0x2cbfe9,null));};exports[_0x3e56('0x52')]=function(_0x170f54,_0x461247){var _0x5a83f2=_0x170f54[_0x3e56('0x4c')]['id'];var _0xf78bc8=_0x170f54[_0x3e56('0x3f')];var _0x2c96de=0xc8;var _0x3b85ea=null;return db['sequelize'][_0x3e56('0x53')]({'isolationLevel':db[_0x3e56('0x54')]['Transaction'][_0x3e56('0x55')]['READ_COMMITTED']},function(_0x295f72){return db[_0x3e56('0x24')][_0x3e56('0x56')]({'where':{'id':_0x5a83f2},'transaction':_0x295f72})['then'](function(_0x532d23){if(_0x532d23){return db['VoiceExtension'][_0x3e56('0x21')]({'where':{'VoiceExtensionId':_0x5a83f2},'transaction':_0x295f72})[_0x3e56('0x13')](function(){var _0x1c5971=_[_0x3e56('0x35')](_0xf78bc8,function(_0x2a46cf){_0x2a46cf['VoiceExtensionId']=_0x5a83f2;_0x2a46cf['isApp']=!![];return _0x2a46cf;});return _0x532d23[_0x3e56('0x57')](_0x1c5971);})[_0x3e56('0x13')](function(_0x169833){return db['VoiceExtension'][_0x3e56('0x58')](_0x169833,{'transaction':_0x295f72});});}else{_0x2c96de=0x194;_0x3b85ea=[];}});})[_0x3e56('0x13')](function(){if(_0x2c96de!==0x194){return db[_0x3e56('0x24')][_0x3e56('0x59')]({'where':{'isApp':!![],'VoiceExtensionId':_0x5a83f2},'order':_0x3e56('0x5a')})[_0x3e56('0x13')](function(_0xb5f696){_0x3b85ea=_0xb5f696;});}})[_0x3e56('0x3d')](function(_0x4e99c0){_0x2c96de=0x1f4;logger[_0x3e56('0x22')](_0x4e99c0[_0x3e56('0x23')]);if(_0x4e99c0[_0x3e56('0x1f')]){delete _0x4e99c0[_0x3e56('0x1f')];}_0x3b85ea=_0x4e99c0;})[_0x3e56('0x5b')](function(){if(_0x3b85ea===null){_0x461247['sendStatus'](_0x2c96de);}else{if(_0x2c96de===0x1f4){_0x461247[_0x3e56('0xc')](_0x2c96de)[_0x3e56('0x5c')](_0x3b85ea);}else{_0x461247[_0x3e56('0xc')](_0x2c96de)[_0x3e56('0x12')](_0x3b85ea);}}});}; \ No newline at end of file +var _0x945f=['sendStatus','error','stack','index','VoiceExtension','rawAttributes','fieldName','model','query','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','filters','filter','merge','options','includeAll','include','rows','catch','show','params','keys','find','create','startsWith','body','exten','concat','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','OutboundRoutes','outbound','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','description','recordingFormat','cutdigits','mandatoryDisposition','addApplications','transaction','sequelize','READ_COMMITTED','findOne','isApp','createRouting','bulkCreate','findAndCountAll','cast(priority\x20as\x20unsigned)','finally','send','lodash','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./voiceExtension.socket','register','status','end','json','offset','limit','undefined','count','set','Content-Range','destroy','then','get','InboundRoutes','inbound','InternalRoutes','internal','map','value','includes','type','name','UserProfileResource'];(function(_0x392195,_0x3f84e8){var _0x2cd2a4=function(_0x21376b){while(--_0x21376b){_0x392195['push'](_0x392195['shift']());}};_0x2cd2a4(++_0x3f84e8);}(_0x945f,0x93));var _0xf945=function(_0x4c05c0,_0x271d45){_0x4c05c0=_0x4c05c0-0x0;var _0x43a1d4=_0x945f[_0x4c05c0];return _0x43a1d4;};'use strict';var _=require(_0xf945('0x0'));var Redis=require(_0xf945('0x1'));var qs=require(_0xf945('0x2'));var logger=require(_0xf945('0x3'))(_0xf945('0x4'));var config=require(_0xf945('0x5'));var db=require(_0xf945('0x6'))['db'];config[_0xf945('0x7')]=_[_0xf945('0x8')](config['redis'],{'host':_0xf945('0x9'),'port':0x18eb});var socket=require(_0xf945('0xa'))(new Redis(config['redis']));require(_0xf945('0xb'))[_0xf945('0xc')](socket);function respondWithStatusCode(_0x2940e7,_0x7c4a2f){_0x7c4a2f=_0x7c4a2f||0xcc;return function(_0x1b6bb3){if(_0x1b6bb3){return _0x2940e7['sendStatus'](_0x7c4a2f);}return _0x2940e7[_0xf945('0xd')](_0x7c4a2f)[_0xf945('0xe')]();};}function respondWithResult(_0x298536,_0x347a07){_0x347a07=_0x347a07||0xc8;return function(_0x34ad06){if(_0x34ad06){return _0x298536['status'](_0x347a07)[_0xf945('0xf')](_0x34ad06);}};}function respondWithFilteredResult(_0x1695ea,_0x1ed5fa){return function(_0x9958e2){if(_0x9958e2){var _0x57a59b=typeof _0x1ed5fa[_0xf945('0x10')]==='undefined'&&typeof _0x1ed5fa[_0xf945('0x11')]===_0xf945('0x12');var _0x4a7061=_0x9958e2[_0xf945('0x13')];var _0x5a21ee=_0x57a59b?0x0:_0x1ed5fa[_0xf945('0x10')];var _0x2a9cde=_0x57a59b?_0x9958e2['count']:_0x1ed5fa['offset']+_0x1ed5fa[_0xf945('0x11')];var _0x177796;if(_0x2a9cde>=_0x4a7061){_0x2a9cde=_0x4a7061;_0x177796=0xc8;}else{_0x177796=0xce;}_0x1695ea[_0xf945('0xd')](_0x177796);return _0x1695ea[_0xf945('0x14')](_0xf945('0x15'),_0x5a21ee+'-'+_0x2a9cde+'/'+_0x4a7061)[_0xf945('0xf')](_0x9958e2);}return null;};}function removeEntity(_0xaedc36){return function(_0x496fba){if(_0x496fba){return _0x496fba[_0xf945('0x16')]()[_0xf945('0x17')](function(){var _0x25d096=_0x496fba[_0xf945('0x18')]({'plain':!![]});var _0x39ad72=[{'name':_0xf945('0x19'),'value':_0xf945('0x1a'),'ignore':![]},{'name':'OutboundRoutes','value':'outbound','ignore':![]},{'name':_0xf945('0x1b'),'value':_0xf945('0x1c'),'ignore':![]}];var _0x1934c5=_(_0x39ad72)['filter']('ignore')[_0xf945('0x1d')](_0xf945('0x1e'))[_0xf945('0x1e')]();if(_[_0xf945('0x1f')](_0x1934c5,_0x25d096[_0xf945('0x20')])){return;}var _0x5cf2f7=_['find'](_0x39ad72,[_0xf945('0x1e'),_0x25d096[_0xf945('0x20')]])[_0xf945('0x21')];return db[_0xf945('0x22')][_0xf945('0x16')]({'where':{'type':_0x5cf2f7,'resourceId':_0x25d096['id']}})[_0xf945('0x17')](function(){return _0x496fba;});})[_0xf945('0x17')](function(){_0xaedc36[_0xf945('0xd')](0xcc)[_0xf945('0xe')]();});}};}function handleEntityNotFound(_0x57de52){return function(_0x1d76ca){if(!_0x1d76ca){_0x57de52[_0xf945('0x23')](0x194);}return _0x1d76ca;};}function handleError(_0x4679e2,_0x5cafd2){_0x5cafd2=_0x5cafd2||0x1f4;return function(_0x415d0e){logger[_0xf945('0x24')](_0x415d0e[_0xf945('0x25')]);if(_0x415d0e['name']){delete _0x415d0e[_0xf945('0x21')];}_0x4679e2[_0xf945('0xd')](_0x5cafd2)['send'](_0x415d0e);};}exports[_0xf945('0x26')]=function(_0x57091b,_0x223a88){var _0x373643={},_0x2b8f87={},_0x972860={'count':0x0,'rows':[]};var _0x3f432c=_['map'](db[_0xf945('0x27')][_0xf945('0x28')],function(_0x423596){return{'name':_0x423596[_0xf945('0x29')],'type':_0x423596[_0xf945('0x20')]['key']};});_0x2b8f87[_0xf945('0x2a')]=_['map'](_0x3f432c,_0xf945('0x21'));_0x2b8f87['query']=_['keys'](_0x57091b[_0xf945('0x2b')]);_0x2b8f87['filters']=_[_0xf945('0x2c')](_0x2b8f87['model'],_0x2b8f87['query']);_0x373643[_0xf945('0x2d')]=_[_0xf945('0x2c')](_0x2b8f87[_0xf945('0x2a')],qs[_0xf945('0x2e')](_0x57091b[_0xf945('0x2b')][_0xf945('0x2e')]));_0x373643[_0xf945('0x2d')]=_0x373643[_0xf945('0x2d')][_0xf945('0x2f')]?_0x373643[_0xf945('0x2d')]:_0x2b8f87[_0xf945('0x2a')];if(!_0x57091b[_0xf945('0x2b')][_0xf945('0x30')]('nolimit')){_0x373643['limit']=qs[_0xf945('0x11')](_0x57091b[_0xf945('0x2b')]['limit']);_0x373643[_0xf945('0x10')]=qs[_0xf945('0x10')](_0x57091b['query'][_0xf945('0x10')]);}_0x373643['order']=qs['sort'](_0x57091b[_0xf945('0x2b')][_0xf945('0x31')]);_0x373643[_0xf945('0x32')]=qs['filters'](_[_0xf945('0x33')](_0x57091b[_0xf945('0x2b')],_0x2b8f87[_0xf945('0x34')]),_0x3f432c);if(_0x57091b['query'][_0xf945('0x35')]){_0x373643[_0xf945('0x32')]=_[_0xf945('0x36')](_0x373643[_0xf945('0x32')],{'$or':_[_0xf945('0x1d')](_0x3f432c,function(_0x11dc79){if(_0x11dc79[_0xf945('0x20')]!=='VIRTUAL'){var _0x1d6665={};_0x1d6665[_0x11dc79[_0xf945('0x21')]]={'$like':'%'+_0x57091b[_0xf945('0x2b')][_0xf945('0x35')]+'%'};return _0x1d6665;}})});}_0x373643=_[_0xf945('0x36')]({},_0x373643,_0x57091b[_0xf945('0x37')]);var _0x315fef={'where':_0x373643['where']};return db['VoiceExtension'][_0xf945('0x13')](_0x315fef)[_0xf945('0x17')](function(_0x4fa5fc){_0x972860[_0xf945('0x13')]=_0x4fa5fc;if(_0x57091b[_0xf945('0x2b')][_0xf945('0x38')]){_0x373643[_0xf945('0x39')]=[{'all':!![]}];}return db[_0xf945('0x27')]['findAll'](_0x373643);})['then'](function(_0x3d0c69){_0x972860[_0xf945('0x3a')]=_0x3d0c69;return _0x972860;})['then'](respondWithFilteredResult(_0x223a88,_0x373643))[_0xf945('0x3b')](handleError(_0x223a88,null));};exports[_0xf945('0x3c')]=function(_0x21f12d,_0x35b813){var _0x49dd6b={'raw':![],'where':{'id':_0x21f12d[_0xf945('0x3d')]['id']}},_0x41ae2f={};_0x41ae2f[_0xf945('0x2a')]=_[_0xf945('0x3e')](db[_0xf945('0x27')][_0xf945('0x28')]);_0x41ae2f[_0xf945('0x2b')]=_[_0xf945('0x3e')](_0x21f12d[_0xf945('0x2b')]);_0x41ae2f[_0xf945('0x34')]=_[_0xf945('0x2c')](_0x41ae2f[_0xf945('0x2a')],_0x41ae2f['query']);_0x49dd6b[_0xf945('0x2d')]=_[_0xf945('0x2c')](_0x41ae2f[_0xf945('0x2a')],qs[_0xf945('0x2e')](_0x21f12d[_0xf945('0x2b')][_0xf945('0x2e')]));_0x49dd6b[_0xf945('0x2d')]=_0x49dd6b[_0xf945('0x2d')][_0xf945('0x2f')]?_0x49dd6b['attributes']:_0x41ae2f['model'];if(_0x21f12d[_0xf945('0x2b')][_0xf945('0x38')]){_0x49dd6b['include']=[{'all':!![]}];}_0x49dd6b=_[_0xf945('0x36')]({},_0x49dd6b,_0x21f12d[_0xf945('0x37')]);return db[_0xf945('0x27')][_0xf945('0x3f')](_0x49dd6b)['then'](handleEntityNotFound(_0x35b813,null))[_0xf945('0x17')](respondWithResult(_0x35b813,null))[_0xf945('0x3b')](handleError(_0x35b813,null));};exports[_0xf945('0x16')]=function(_0x48edd6,_0x1fa449){return db[_0xf945('0x27')][_0xf945('0x3f')]({'where':{'id':_0x48edd6[_0xf945('0x3d')]['id']}})[_0xf945('0x17')](handleEntityNotFound(_0x1fa449,null))['then'](removeEntity(_0x1fa449,null))[_0xf945('0x3b')](handleError(_0x1fa449,null));};exports[_0xf945('0x40')]=function(_0x3bbab6,_0x47bc4f){if(_0x3bbab6['body'][_0xf945('0x20')]==='outbound'&&!_[_0xf945('0x41')](_0x3bbab6[_0xf945('0x42')]['exten'],'_')){_0x3bbab6['body'][_0xf945('0x43')]='_'[_0xf945('0x44')](_0x3bbab6[_0xf945('0x42')][_0xf945('0x43')]);}return db[_0xf945('0x27')][_0xf945('0x40')](_0x3bbab6[_0xf945('0x42')],{'raw':![]})[_0xf945('0x17')](function(_0x88fc6b){var _0x3139f1=_0x3bbab6[_0xf945('0x45')]['get']({'plain':!![]});if(!_0x3139f1)throw new Error(_0xf945('0x46'));if(_0x3139f1['role']===_0xf945('0x45')){var _0x172900=_0x88fc6b[_0xf945('0x18')]({'plain':!![]});var _0x1aed2d=[{'name':'InboundRoutes','value':_0xf945('0x1a')},{'name':_0xf945('0x47'),'value':_0xf945('0x48')},{'name':_0xf945('0x1b'),'value':'internal'}];var _0x58bc72=_[_0xf945('0x3f')](_0x1aed2d,['value',_0x172900[_0xf945('0x20')]])[_0xf945('0x21')];return db['UserProfileSection'][_0xf945('0x3f')]({'where':{'name':_0x58bc72,'userProfileId':_0x3139f1['userProfileId']},'raw':!![]})['then'](function(_0x2f4783){if(_0x2f4783&&_0x2f4783['autoAssociation']===0x0){return db['UserProfileResource'][_0xf945('0x40')]({'name':_0x172900['name'],'resourceId':_0x172900['id'],'type':_0x2f4783['name'],'sectionId':_0x2f4783['id']},{})[_0xf945('0x17')](function(){return _0x88fc6b;});}else{return _0x88fc6b;}})['catch'](function(_0x1c3258){logger[_0xf945('0x24')](_0xf945('0x49'),_0x1c3258);throw _0x1c3258;});}return _0x88fc6b;})[_0xf945('0x17')](respondWithResult(_0x47bc4f,0xc9))[_0xf945('0x3b')](handleError(_0x47bc4f,null));};exports['update']=function(_0x53d7e6,_0x275e05){if(_0x53d7e6['body']['id']){delete _0x53d7e6[_0xf945('0x42')]['id'];}return db['VoiceExtension']['find']({'where':{'id':_0x53d7e6[_0xf945('0x3d')]['id']}})[_0xf945('0x17')](handleEntityNotFound(_0x275e05,null))[_0xf945('0x17')](function(_0x257d19){if(_0x257d19){return db['VoiceExtension']['update'](_[_0xf945('0x33')](_0x53d7e6['body'],[_0xf945('0x43'),_0xf945('0x4a'),_0xf945('0x4b'),_0xf945('0x4c'),_0xf945('0x4d'),_0xf945('0x4e'),'alias']),{'where':{'context':_0x257d19[_0xf945('0x4a')],'exten':_0x257d19[_0xf945('0x43')]},'individualHooks':!![]})['then'](function(_0x2458db){return _0x2458db;});}return null;})[_0xf945('0x17')](respondWithStatusCode(_0x275e05,null))['catch'](handleError(_0x275e05,null));};exports[_0xf945('0x4f')]=function(_0x495dd9,_0x7f2ca8){var _0x47040d=_0x495dd9['params']['id'];var _0x989343=_0x495dd9[_0xf945('0x42')];var _0x1a575b=0xc8;var _0x45e9a0=null;return db['sequelize'][_0xf945('0x50')]({'isolationLevel':db[_0xf945('0x51')]['Transaction']['ISOLATION_LEVELS'][_0xf945('0x52')]},function(_0x499505){return db['VoiceExtension'][_0xf945('0x53')]({'where':{'id':_0x47040d},'transaction':_0x499505})[_0xf945('0x17')](function(_0x6839d9){if(_0x6839d9){return db[_0xf945('0x27')][_0xf945('0x16')]({'where':{'VoiceExtensionId':_0x47040d},'transaction':_0x499505})[_0xf945('0x17')](function(){var _0xd94a7e=_['map'](_0x989343,function(_0x56dc96){_0x56dc96['VoiceExtensionId']=_0x47040d;_0x56dc96[_0xf945('0x54')]=!![];return _0x56dc96;});return _0x6839d9[_0xf945('0x55')](_0xd94a7e);})[_0xf945('0x17')](function(_0x4e56ab){return db['VoiceExtension'][_0xf945('0x56')](_0x4e56ab,{'transaction':_0x499505});});}else{_0x1a575b=0x194;_0x45e9a0=[];}});})['then'](function(){if(_0x1a575b!==0x194){return db[_0xf945('0x27')][_0xf945('0x57')]({'where':{'isApp':!![],'VoiceExtensionId':_0x47040d},'order':_0xf945('0x58')})[_0xf945('0x17')](function(_0x2e8e4b){_0x45e9a0=_0x2e8e4b;});}})[_0xf945('0x3b')](function(_0xb85088){_0x1a575b=0x1f4;logger['error'](_0xb85088[_0xf945('0x25')]);if(_0xb85088[_0xf945('0x21')]){delete _0xb85088[_0xf945('0x21')];}_0x45e9a0=_0xb85088;})[_0xf945('0x59')](function(){if(_0x45e9a0===null){_0x7f2ca8[_0xf945('0x23')](_0x1a575b);}else{if(_0x1a575b===0x1f4){_0x7f2ca8[_0xf945('0xd')](_0x1a575b)[_0xf945('0x5a')](_0x45e9a0);}else{_0x7f2ca8['status'](_0x1a575b)[_0xf945('0xf')](_0x45e9a0);}}});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.events.js b/server/api/voiceExtension/voiceExtension.events.js index 267fc1b..2cc8747 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 _0xda30=['update','remove','emit','hook','exports','events','VoiceExtension','save'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xda30,0xc5));var _0x0da3=function(_0x1b828b,_0x344400){_0x1b828b=_0x1b828b-0x0;var _0x98da1a=_0xda30[_0x1b828b];return _0x98da1a;};'use strict';var EventEmitter=require(_0x0da3('0x0'));var VoiceExtension=require('../../mysqldb')['db'][_0x0da3('0x1')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x0da3('0x2'),'afterUpdate':_0x0da3('0x3'),'afterDestroy':_0x0da3('0x4')};function emitEvent(_0x5fdd16){return function(_0x1f4407,_0x4cb3cf,_0x8a81a6){VoiceExtensionEvents[_0x0da3('0x5')](_0x5fdd16+':'+_0x1f4407['id'],_0x1f4407);VoiceExtensionEvents[_0x0da3('0x5')](_0x5fdd16,_0x1f4407);_0x8a81a6(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceExtension[_0x0da3('0x6')](e,emitEvent(event));}}module[_0x0da3('0x7')]=VoiceExtensionEvents; \ No newline at end of file +var _0xb29b=['remove','emit','hook','../../mysqldb','VoiceExtension','setMaxListeners','save','update'];(function(_0x19c13f,_0x17b479){var _0x1be51b=function(_0x3708a0){while(--_0x3708a0){_0x19c13f['push'](_0x19c13f['shift']());}};_0x1be51b(++_0x17b479);}(_0xb29b,0x1cb));var _0xbb29=function(_0x288af2,_0x2b86b5){_0x288af2=_0x288af2-0x0;var _0x5871d3=_0xb29b[_0x288af2];return _0x5871d3;};'use strict';var EventEmitter=require('events');var VoiceExtension=require(_0xbb29('0x0'))['db'][_0xbb29('0x1')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0xbb29('0x2')](0x0);var events={'afterCreate':_0xbb29('0x3'),'afterUpdate':_0xbb29('0x4'),'afterDestroy':_0xbb29('0x5')};function emitEvent(_0x20b317){return function(_0x327a94,_0x5b0093,_0x1c9c88){VoiceExtensionEvents[_0xbb29('0x6')](_0x20b317+':'+_0x327a94['id'],_0x327a94);VoiceExtensionEvents[_0xbb29('0x6')](_0x20b317,_0x327a94);_0x1c9c88(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceExtension[_0xbb29('0x7')](e,emitEvent(event));}}module['exports']=VoiceExtensionEvents; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.model.js b/server/api/voiceExtension/voiceExtension.model.js index 78323f6..6c17f8e 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 _0xdcc4=['XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','CDR(type)=outbound','outbound','CDR(destination)=','cutdigits','${EXTEN:','${EXTEN}','CDR(routeid)=','ExecIf','):Goto(','CDR(prefix)=${EXTEN:0:','outboundrouteid=','hasOwnProperty','recordingFormat','none','push','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','wav','timeout','url','split','length','trunk','param','phone','prefix','options','indexOf','U(xcally-mixmonitor-context)','replace','isEmpty','Interval','findAll','interval','then','*,*,*,*','intervals','map','filter','IntervalId','toLowerCase','tag','CDR(tag)=','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):','Set(CALLERID(all)=','callerID','NoOp(No\x20number\x20available)','queue','playback','includes','app','appType','custom','answer','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','XCALLY-MOTION-PROGRESS=1','splice','GotoIfTime',',${EXTEN},','outboundDial','appdata','priority','last','concat','define','VoiceExtension','get','lodash','./voiceExtension.attributes','exports','type','Set','exten','alias','CDR(routeAlias)=','No\x20alias\x20set','context','inbound','XCALLY-MOTION-ANSWER=0'];(function(_0x591f38,_0xd9561d){var _0x54e4d9=function(_0x39b1ca){while(--_0x39b1ca){_0x591f38['push'](_0x591f38['shift']());}};_0x54e4d9(++_0xd9561d);}(_0xdcc4,0xea));var _0x4dcc=function(_0x37d37d,_0x185b97){_0x37d37d=_0x37d37d-0x0;var _0x821309=_0xdcc4[_0x37d37d];return _0x821309;};'use strict';var _=require(_0x4dcc('0x0'));var attributes=require(_0x4dcc('0x1'));module[_0x4dcc('0x2')]=function(_0x19df7f){var _0x17fde8=_0x19df7f['models'];function _0x128a7b(_0x5c1ea7){var _0x416d97=0x2;var _0x30c165=[{'type':_0x5c1ea7[_0x4dcc('0x3')],'app':_0x4dcc('0x4'),'appdata':'CDR(type)='+_0x5c1ea7[_0x4dcc('0x3')],'context':_0x5c1ea7['context'],'exten':_0x5c1ea7[_0x4dcc('0x5')],'priority':_0x416d97++,'VoiceExtensionId':_0x5c1ea7['id']},{'type':_0x5c1ea7[_0x4dcc('0x3')],'app':_0x5c1ea7[_0x4dcc('0x6')]?_0x4dcc('0x4'):'NoOp','appdata':_0x5c1ea7[_0x4dcc('0x6')]?_0x4dcc('0x7')+_0x5c1ea7[_0x4dcc('0x6')]:_0x4dcc('0x8'),'context':_0x5c1ea7[_0x4dcc('0x9')],'exten':_0x5c1ea7[_0x4dcc('0x5')],'priority':_0x416d97++,'VoiceExtensionId':_0x5c1ea7['id']}];if(_0x5c1ea7[_0x4dcc('0x3')]===_0x4dcc('0xa')){_0x30c165['push']({'type':_0x4dcc('0xa'),'app':_0x4dcc('0x4'),'appdata':'CDR(routeid)='+_0x5c1ea7['id'],'context':_0x5c1ea7[_0x4dcc('0x9')],'exten':_0x5c1ea7[_0x4dcc('0x5')],'priority':_0x416d97++,'VoiceExtensionId':_0x5c1ea7['id']});}_0x30c165['push']({'type':_0x5c1ea7[_0x4dcc('0x3')],'app':_0x4dcc('0x4'),'appdata':_0x4dcc('0xb'),'context':_0x5c1ea7[_0x4dcc('0x9')],'exten':_0x5c1ea7[_0x4dcc('0x5')],'priority':_0x416d97++,'VoiceExtensionId':_0x5c1ea7['id']},{'type':_0x5c1ea7[_0x4dcc('0x3')],'app':_0x4dcc('0x4'),'appdata':_0x4dcc('0xc'),'context':_0x5c1ea7['context'],'exten':_0x5c1ea7['exten'],'priority':_0x416d97++,'VoiceExtensionId':_0x5c1ea7['id']},{'type':_0x5c1ea7[_0x4dcc('0x3')],'app':_0x4dcc('0x4'),'appdata':_0x4dcc('0xd'),'context':_0x5c1ea7[_0x4dcc('0x9')],'exten':_0x5c1ea7[_0x4dcc('0x5')],'priority':_0x416d97++,'VoiceExtensionId':_0x5c1ea7['id']});return _0x30c165;}function _0x5dacd1(_0x281ada){var _0x387523=0x2;var _0x5bf52e=[{'type':'outbound','app':'Set','appdata':_0x4dcc('0xe'),'context':_0x281ada[_0x4dcc('0x9')],'exten':_0x281ada['exten'],'priority':_0x387523++,'VoiceExtensionId':_0x281ada['id']},{'type':_0x4dcc('0xf'),'app':_0x281ada[_0x4dcc('0x6')]?_0x4dcc('0x4'):'NoOp','appdata':_0x281ada[_0x4dcc('0x6')]?_0x4dcc('0x7')+_0x281ada[_0x4dcc('0x6')]:_0x4dcc('0x8'),'context':_0x281ada[_0x4dcc('0x9')],'exten':_0x281ada[_0x4dcc('0x5')],'priority':_0x387523++,'VoiceExtensionId':_0x281ada['id']},{'type':_0x4dcc('0xf'),'app':_0x4dcc('0x4'),'appdata':_0x4dcc('0x10')+(_0x281ada[_0x4dcc('0x11')]?_0x4dcc('0x12')+_0x281ada[_0x4dcc('0x11')]+'}':_0x4dcc('0x13')),'context':_0x281ada[_0x4dcc('0x9')],'exten':_0x281ada[_0x4dcc('0x5')],'priority':_0x387523++,'VoiceExtensionId':_0x281ada['id']},{'type':_0x4dcc('0xf'),'app':'Set','appdata':_0x4dcc('0x14')+_0x281ada['id'],'context':_0x281ada[_0x4dcc('0x9')],'exten':_0x281ada[_0x4dcc('0x5')],'priority':_0x387523++,'VoiceExtensionId':_0x281ada['id']},{'type':'outbound','app':_0x4dcc('0x15'),'appdata':'$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto('+(_0x387523+0x2)+_0x4dcc('0x16')+(_0x387523+0x1)+')','context':_0x281ada[_0x4dcc('0x9')],'exten':_0x281ada['exten'],'priority':_0x387523++,'VoiceExtensionId':_0x281ada['id']},{'type':_0x4dcc('0xf'),'app':_0x4dcc('0x4'),'appdata':_0x281ada['cutdigits']?_0x4dcc('0x17')+_0x281ada[_0x4dcc('0x11')]+'}':'CDR(prefix)=noprefix','context':_0x281ada['context'],'exten':_0x281ada[_0x4dcc('0x5')],'priority':_0x387523++,'VoiceExtensionId':_0x281ada['id']},{'type':_0x4dcc('0xf'),'app':_0x4dcc('0x4'),'appdata':'XCALLY-MOTION-ANSWER=0','context':_0x281ada[_0x4dcc('0x9')],'exten':_0x281ada['exten'],'priority':_0x387523++,'VoiceExtensionId':_0x281ada['id']},{'type':_0x4dcc('0xf'),'app':_0x4dcc('0x4'),'appdata':_0x4dcc('0xc'),'context':_0x281ada['context'],'exten':_0x281ada[_0x4dcc('0x5')],'priority':_0x387523++,'VoiceExtensionId':_0x281ada['id']},{'type':'outbound','app':'Set','appdata':_0x4dcc('0xd'),'context':_0x281ada['context'],'exten':_0x281ada[_0x4dcc('0x5')],'priority':_0x387523++,'VoiceExtensionId':_0x281ada['id']},{'type':_0x4dcc('0xf'),'app':_0x4dcc('0x4'),'appdata':_0x4dcc('0x18')+_0x281ada['id'],'context':_0x281ada[_0x4dcc('0x9')],'exten':_0x281ada[_0x4dcc('0x5')],'priority':_0x387523++,'VoiceExtensionId':_0x281ada['id']}];if(_0x281ada[_0x4dcc('0x19')](_0x4dcc('0x1a'))&&_0x281ada[_0x4dcc('0x1a')]!==_0x4dcc('0x1b')){_0x5bf52e[_0x4dcc('0x1c')]({'type':'outbound','app':'Set','appdata':_0x4dcc('0x1d'),'context':_0x281ada['context'],'exten':_0x281ada[_0x4dcc('0x5')],'priority':_0x387523++,'VoiceExtensionId':_0x281ada['id']},{'type':_0x4dcc('0xf'),'app':_0x4dcc('0x4'),'appdata':_0x4dcc('0x1e')+_0x281ada[_0x4dcc('0x1a')]||_0x4dcc('0x1f'),'context':_0x281ada[_0x4dcc('0x9')],'exten':_0x281ada[_0x4dcc('0x5')],'priority':_0x387523++,'VoiceExtensionId':_0x281ada['id']});}return _0x5bf52e;}function _0x54a8e8(_0x20ea33,_0x5698b8){var _0x6722ca=[{'name':'trunk','param':0x0},{'name':_0x4dcc('0x20'),'param':0x1},{'name':'options','param':0x2},{'name':_0x4dcc('0x21'),'param':0x3}];var _0x32b6cd={};var _0xc0caf7=_0x5698b8[_0x4dcc('0x22')](',');var _0x19df27=[];for(var _0x5d84d0=0x0;_0x5d84d0<_0x6722ca[_0x4dcc('0x23')];_0x5d84d0++){switch(_0x6722ca[_0x5d84d0]['name']){case _0x4dcc('0x24'):_0x32b6cd[_0x4dcc('0x24')]=_0xc0caf7[_0x6722ca[_0x5d84d0][_0x4dcc('0x25')]][_0x4dcc('0x22')]('/')[0x1];_0x32b6cd[_0x4dcc('0x26')]=_0xc0caf7[_0x6722ca[_0x5d84d0][_0x4dcc('0x25')]][_0x4dcc('0x22')]('/')[0x2];_0x32b6cd[_0x4dcc('0x27')]=_0x32b6cd[_0x4dcc('0x26')]?_0x32b6cd[_0x4dcc('0x26')][_0x4dcc('0x22')]('$')[0x0]:undefined;_0x32b6cd[_0x4dcc('0x26')]=_0x20ea33['cutdigits']?(_0x32b6cd['prefix']||'')+_0x4dcc('0x12')+_0x20ea33[_0x4dcc('0x11')]+'}':(_0x32b6cd[_0x4dcc('0x27')]||'')+'${EXTEN}';_0x19df27[_0x6722ca[_0x5d84d0][_0x4dcc('0x25')]]=['SIP',_0x32b6cd[_0x4dcc('0x24')],_0x32b6cd['phone']]['join']('/');break;case _0x4dcc('0x28'):_0x32b6cd[_0x4dcc('0x28')]=_0xc0caf7[_0x6722ca[_0x5d84d0][_0x4dcc('0x25')]];if(_0x20ea33[_0x4dcc('0x1a')]!==_0x4dcc('0x1b')){if(_0x32b6cd[_0x4dcc('0x28')][_0x4dcc('0x29')](_0x4dcc('0x2a'))<0x0){_0x32b6cd['options']+='U(xcally-mixmonitor-context)';}}else{_0x32b6cd[_0x4dcc('0x28')]=_0x32b6cd['options'][_0x4dcc('0x2b')]('U(xcally-mixmonitor-context)','');}_0x19df27[_0x6722ca[_0x5d84d0][_0x4dcc('0x25')]]=_0x32b6cd['options'];break;default:_0x19df27[_0x6722ca[_0x5d84d0][_0x4dcc('0x25')]]=_0xc0caf7[_0x6722ca[_0x5d84d0][_0x4dcc('0x25')]];}}return _0x19df27['join'](',');}function _0x14209b(_0x290d50,_0x2944d4,_0x52bcbf){return new Promise(function(_0x33abed,_0xf383e1){var _0x3745db=[];if(_[_0x4dcc('0x2c')](_0x2944d4))return _0x33abed(_0x3745db);_0x17fde8[_0x4dcc('0x2d')][_0x4dcc('0x2e')]({'attributes':['id',_0x4dcc('0x2f'),'IntervalId'],'raw':!![]})[_0x4dcc('0x30')](function(_0x41b342){for(var _0x75548c=0x0,_0x5f499f=0x0;_0x75548c<_0x2944d4[_0x4dcc('0x23')];_0x75548c++,_0x5f499f=0x0){var _0xc8bab8=_0x2944d4[_0x75548c];var _0x5db64b=[];var _0xb68cf2=[];delete _0xc8bab8['id'];if(_0xc8bab8[_0x4dcc('0x2f')]!==_0x4dcc('0x31')){_0xc8bab8[_0x4dcc('0x32')]=[_0xc8bab8[_0x4dcc('0x2f')]];}else{_0xc8bab8[_0x4dcc('0x32')]=_0xc8bab8['IntervalId']?_[_0x4dcc('0x33')](_[_0x4dcc('0x34')](_0x41b342,{'IntervalId':_0xc8bab8[_0x4dcc('0x35')]}),'interval'):[];}_0xc8bab8[_0x4dcc('0x9')]=_0x290d50['context'];_0xc8bab8['exten']=_0x290d50[_0x4dcc('0x5')];if(_0xc8bab8['type'])_0xc8bab8[_0x4dcc('0x3')]=_0xc8bab8[_0x4dcc('0x3')][_0x4dcc('0x36')]();if(_0x290d50['type']===_0x4dcc('0xf')){if(_0xc8bab8['hasOwnProperty'](_0x4dcc('0x37'))&&_0xc8bab8['tag']&&_0xc8bab8[_0x4dcc('0x37')]!=='--'){_0x5db64b[_0x4dcc('0x1c')]({'type':_0xc8bab8['type'][_0x4dcc('0x36')](),'app':_0x4dcc('0x4'),'appdata':_0x4dcc('0x38')+_0xc8bab8[_0x4dcc('0x37')],'context':_0x290d50[_0x4dcc('0x9')],'exten':_0x290d50[_0x4dcc('0x5')],'priority':_0xc8bab8[_0x4dcc('0x32')]['length']+_0x52bcbf+_0x5f499f++,'VoiceExtensionId':_0x290d50['id']});}_0x5db64b[_0x4dcc('0x1c')]({'type':_0xc8bab8[_0x4dcc('0x3')][_0x4dcc('0x36')](),'app':_0x4dcc('0x15'),'appdata':_0x4dcc('0x39')+(_0xc8bab8['callerID']?_0x4dcc('0x3a')+_0xc8bab8[_0x4dcc('0x3b')]+')':_0x4dcc('0x3c')),'context':_0x290d50[_0x4dcc('0x9')],'exten':_0x290d50[_0x4dcc('0x5')],'priority':_0xc8bab8[_0x4dcc('0x32')][_0x4dcc('0x23')]+_0x52bcbf+_0x5f499f++,'VoiceExtensionId':_0x290d50['id']});}else{if(_0xc8bab8['hasOwnProperty']('answer')){if([_0x4dcc('0x3d'),_0x4dcc('0x3e')][_0x4dcc('0x3f')](_0xc8bab8[_0x4dcc('0x40')][_0x4dcc('0x36')]())&&_0xc8bab8[_0x4dcc('0x41')]!==_0x4dcc('0x42')){if(_0xc8bab8[_0x4dcc('0x43')]){_0x5db64b[_0x4dcc('0x1c')]({'type':_0xc8bab8['type'][_0x4dcc('0x36')](),'app':'ExecIf','appdata':_0x4dcc('0x44'),'context':_0x290d50['context'],'exten':_0x290d50[_0x4dcc('0x5')],'priority':_0xc8bab8[_0x4dcc('0x32')][_0x4dcc('0x23')]+_0x52bcbf+_0x5f499f++,'VoiceExtensionId':_0x290d50['id']});_0x5db64b[_0x4dcc('0x1c')]({'type':_0xc8bab8['type']['toLowerCase'](),'app':_0x4dcc('0x4'),'appdata':_0x4dcc('0x45'),'context':_0x290d50[_0x4dcc('0x9')],'exten':_0x290d50[_0x4dcc('0x5')],'priority':_0xc8bab8[_0x4dcc('0x32')][_0x4dcc('0x23')]+_0x52bcbf+_0x5f499f++,'VoiceExtensionId':_0x290d50['id']});}else{_0x5db64b['push']({'type':_0xc8bab8[_0x4dcc('0x3')][_0x4dcc('0x36')](),'app':'ExecIf','appdata':'$[${XCALLY-MOTION-PROGRESS}=0]?Progress','context':_0x290d50['context'],'exten':_0x290d50[_0x4dcc('0x5')],'priority':_0xc8bab8[_0x4dcc('0x32')][_0x4dcc('0x23')]+_0x52bcbf+_0x5f499f++,'VoiceExtensionId':_0x290d50['id']});_0x5db64b['push']({'type':_0xc8bab8[_0x4dcc('0x3')][_0x4dcc('0x36')](),'app':_0x4dcc('0x4'),'appdata':_0x4dcc('0x46'),'context':_0x290d50[_0x4dcc('0x9')],'exten':_0x290d50[_0x4dcc('0x5')],'priority':_0xc8bab8[_0x4dcc('0x32')][_0x4dcc('0x23')]+_0x52bcbf+_0x5f499f++,'VoiceExtensionId':_0x290d50['id']});}}}}for(var _0x4659b0=0x0;_0x4659b0<_0xc8bab8[_0x4dcc('0x32')][_0x4dcc('0x23')];_0x4659b0++){var _0x3ed8a1=_0x52bcbf+_0xc8bab8[_0x4dcc('0x32')][_0x4dcc('0x23')];var _0x36ef30=_0x4659b0===_0xc8bab8[_0x4dcc('0x32')][_0x4dcc('0x23')]-0x1?_0x52bcbf+_0x5db64b['length']+_0xb68cf2[_0x4dcc('0x23')]+0x2:_0x52bcbf+_0x4659b0+0x1;_0x5db64b[_0x4dcc('0x47')](_0x4659b0,0x0,{'type':_0x290d50[_0x4dcc('0x3')],'app':_0x4dcc('0x48'),'appdata':_0xc8bab8['intervals'][_0x4659b0]+'?'+_0x290d50[_0x4dcc('0x9')]+',${EXTEN},'+_0x3ed8a1+':'+_0x290d50['context']+_0x4dcc('0x49')+_0x36ef30,'exten':_0x290d50[_0x4dcc('0x5')],'context':_0x290d50[_0x4dcc('0x9')],'priority':_0x52bcbf+_0x4659b0,'VoiceExtensionId':_0x290d50['id']});}if(_0xc8bab8[_0x4dcc('0x41')]===_0x4dcc('0x4a'))_0xc8bab8[_0x4dcc('0x4b')]=_0x54a8e8(_0x290d50,_0xc8bab8[_0x4dcc('0x4b')]);_0xc8bab8[_0x4dcc('0x4c')]=_0x5db64b[_0x4dcc('0x23')]?_[_0x4dcc('0x4d')](_0x5db64b)[_0x4dcc('0x4c')]+0x1:_0x52bcbf;_0x3745db=_[_0x4dcc('0x4e')](_0x3745db,_0x5db64b,[_0xc8bab8],_0xb68cf2);_0x52bcbf=_['last'](_0x3745db)[_0x4dcc('0x4c')]+0x1;}return _0x33abed(_0x3745db);})['catch'](function(_0x9b37ee){_0xf383e1(_0x9b37ee);});});}return _0x19df7f[_0x4dcc('0x4f')](_0x4dcc('0x50'),attributes,{'tableName':'voice_extensions','paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x1848c1){var _0x82d92f=this[_0x4dcc('0x51')]({'plain':!![]});var _0x5b1f7f=_0x82d92f[_0x4dcc('0x3')]==='outbound'?_0x5dacd1(_0x82d92f):_0x128a7b(_0x82d92f);return _0x14209b(_0x82d92f,_0x1848c1,_['last'](_0x5b1f7f)[_0x4dcc('0x4c')]+0x1)[_0x4dcc('0x30')](function(_0x97981f){var _0x5d7e8d=_[_0x4dcc('0x4e')](_0x5b1f7f,_0x97981f);_0x5d7e8d[_0x4dcc('0x1c')]({'type':_0x82d92f[_0x4dcc('0x3')],'app':'Hangup','exten':_0x82d92f[_0x4dcc('0x5')],'context':_0x82d92f[_0x4dcc('0x9')],'priority':_[_0x4dcc('0x4d')](_0x5d7e8d)['priority']+0x1,'VoiceExtensionId':_0x82d92f['id']});return _0x5d7e8d;});}}});}; \ No newline at end of file +var _0x82a7=['get','Hangup','./voiceExtension.attributes','exports','models','type','Set','CDR(type)=','context','exten','alias','No\x20alias\x20set','push','CDR(routeid)=','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','outbound','NoOp','CDR(routeAlias)=','cutdigits','${EXTEN:','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=noprefix','outboundrouteid=','hasOwnProperty','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','timeout','length','name','trunk','param','split','phone','prefix','${EXTEN}','SIP','join','options','indexOf','U(xcally-mixmonitor-context)','replace','isEmpty','Interval','interval','IntervalId','then','intervals','toLowerCase','tag','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):','callerID','Set(CALLERID(all)=','NoOp(No\x20number\x20available)','answer','queue','playback','includes','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','splice',',${EXTEN},','outboundDial','appdata','last','priority','define','VoiceExtension','voice_extensions'];(function(_0x56ec52,_0x35e3c3){var _0x324eb2=function(_0x38a417){while(--_0x38a417){_0x56ec52['push'](_0x56ec52['shift']());}};_0x324eb2(++_0x35e3c3);}(_0x82a7,0x1c4));var _0x782a=function(_0x211541,_0x4d483e){_0x211541=_0x211541-0x0;var _0xa36e54=_0x82a7[_0x211541];return _0xa36e54;};'use strict';var _=require('lodash');var attributes=require(_0x782a('0x0'));module[_0x782a('0x1')]=function(_0x1e39e4){var _0x2844de=_0x1e39e4[_0x782a('0x2')];function _0x3dc9c7(_0x4d030b){var _0x1f0a98=0x2;var _0x2511cb=[{'type':_0x4d030b[_0x782a('0x3')],'app':_0x782a('0x4'),'appdata':_0x782a('0x5')+_0x4d030b[_0x782a('0x3')],'context':_0x4d030b[_0x782a('0x6')],'exten':_0x4d030b[_0x782a('0x7')],'priority':_0x1f0a98++,'VoiceExtensionId':_0x4d030b['id']},{'type':_0x4d030b[_0x782a('0x3')],'app':_0x4d030b['alias']?_0x782a('0x4'):'NoOp','appdata':_0x4d030b[_0x782a('0x8')]?'CDR(routeAlias)='+_0x4d030b['alias']:_0x782a('0x9'),'context':_0x4d030b['context'],'exten':_0x4d030b[_0x782a('0x7')],'priority':_0x1f0a98++,'VoiceExtensionId':_0x4d030b['id']}];if(_0x4d030b[_0x782a('0x3')]==='inbound'){_0x2511cb[_0x782a('0xa')]({'type':'inbound','app':_0x782a('0x4'),'appdata':_0x782a('0xb')+_0x4d030b['id'],'context':_0x4d030b[_0x782a('0x6')],'exten':_0x4d030b[_0x782a('0x7')],'priority':_0x1f0a98++,'VoiceExtensionId':_0x4d030b['id']});}_0x2511cb[_0x782a('0xa')]({'type':_0x4d030b[_0x782a('0x3')],'app':_0x782a('0x4'),'appdata':_0x782a('0xc'),'context':_0x4d030b[_0x782a('0x6')],'exten':_0x4d030b[_0x782a('0x7')],'priority':_0x1f0a98++,'VoiceExtensionId':_0x4d030b['id']},{'type':_0x4d030b[_0x782a('0x3')],'app':_0x782a('0x4'),'appdata':_0x782a('0xd'),'context':_0x4d030b[_0x782a('0x6')],'exten':_0x4d030b['exten'],'priority':_0x1f0a98++,'VoiceExtensionId':_0x4d030b['id']},{'type':_0x4d030b['type'],'app':_0x782a('0x4'),'appdata':_0x782a('0xe'),'context':_0x4d030b[_0x782a('0x6')],'exten':_0x4d030b[_0x782a('0x7')],'priority':_0x1f0a98++,'VoiceExtensionId':_0x4d030b['id']});return _0x2511cb;}function _0x2774a2(_0x27eb96){var _0x322001=0x2;var _0x4f3fa8=[{'type':'outbound','app':'Set','appdata':'CDR(type)=outbound','context':_0x27eb96[_0x782a('0x6')],'exten':_0x27eb96[_0x782a('0x7')],'priority':_0x322001++,'VoiceExtensionId':_0x27eb96['id']},{'type':_0x782a('0xf'),'app':_0x27eb96[_0x782a('0x8')]?_0x782a('0x4'):_0x782a('0x10'),'appdata':_0x27eb96[_0x782a('0x8')]?_0x782a('0x11')+_0x27eb96['alias']:_0x782a('0x9'),'context':_0x27eb96[_0x782a('0x6')],'exten':_0x27eb96[_0x782a('0x7')],'priority':_0x322001++,'VoiceExtensionId':_0x27eb96['id']},{'type':'outbound','app':_0x782a('0x4'),'appdata':'CDR(destination)='+(_0x27eb96[_0x782a('0x12')]?_0x782a('0x13')+_0x27eb96[_0x782a('0x12')]+'}':'${EXTEN}'),'context':_0x27eb96[_0x782a('0x6')],'exten':_0x27eb96[_0x782a('0x7')],'priority':_0x322001++,'VoiceExtensionId':_0x27eb96['id']},{'type':_0x782a('0xf'),'app':_0x782a('0x4'),'appdata':_0x782a('0xb')+_0x27eb96['id'],'context':_0x27eb96['context'],'exten':_0x27eb96[_0x782a('0x7')],'priority':_0x322001++,'VoiceExtensionId':_0x27eb96['id']},{'type':_0x782a('0xf'),'app':_0x782a('0x14'),'appdata':_0x782a('0x15')+(_0x322001+0x2)+_0x782a('0x16')+(_0x322001+0x1)+')','context':_0x27eb96[_0x782a('0x6')],'exten':_0x27eb96['exten'],'priority':_0x322001++,'VoiceExtensionId':_0x27eb96['id']},{'type':_0x782a('0xf'),'app':_0x782a('0x4'),'appdata':_0x27eb96[_0x782a('0x12')]?'CDR(prefix)=${EXTEN:0:'+_0x27eb96[_0x782a('0x12')]+'}':_0x782a('0x17'),'context':_0x27eb96['context'],'exten':_0x27eb96[_0x782a('0x7')],'priority':_0x322001++,'VoiceExtensionId':_0x27eb96['id']},{'type':'outbound','app':_0x782a('0x4'),'appdata':_0x782a('0xc'),'context':_0x27eb96['context'],'exten':_0x27eb96[_0x782a('0x7')],'priority':_0x322001++,'VoiceExtensionId':_0x27eb96['id']},{'type':_0x782a('0xf'),'app':_0x782a('0x4'),'appdata':_0x782a('0xd'),'context':_0x27eb96[_0x782a('0x6')],'exten':_0x27eb96[_0x782a('0x7')],'priority':_0x322001++,'VoiceExtensionId':_0x27eb96['id']},{'type':_0x782a('0xf'),'app':_0x782a('0x4'),'appdata':_0x782a('0xe'),'context':_0x27eb96[_0x782a('0x6')],'exten':_0x27eb96['exten'],'priority':_0x322001++,'VoiceExtensionId':_0x27eb96['id']},{'type':_0x782a('0xf'),'app':_0x782a('0x4'),'appdata':_0x782a('0x18')+_0x27eb96['id'],'context':_0x27eb96[_0x782a('0x6')],'exten':_0x27eb96[_0x782a('0x7')],'priority':_0x322001++,'VoiceExtensionId':_0x27eb96['id']}];if(_0x27eb96[_0x782a('0x19')](_0x782a('0x1a'))&&_0x27eb96[_0x782a('0x1a')]!==_0x782a('0x1b')){_0x4f3fa8[_0x782a('0xa')]({'type':_0x782a('0xf'),'app':_0x782a('0x4'),'appdata':_0x782a('0x1c'),'context':_0x27eb96[_0x782a('0x6')],'exten':_0x27eb96[_0x782a('0x7')],'priority':_0x322001++,'VoiceExtensionId':_0x27eb96['id']},{'type':'outbound','app':'Set','appdata':'_XCALLY_MIXMONITOR_FORMAT='+_0x27eb96[_0x782a('0x1a')]||'wav','context':_0x27eb96[_0x782a('0x6')],'exten':_0x27eb96[_0x782a('0x7')],'priority':_0x322001++,'VoiceExtensionId':_0x27eb96['id']});}return _0x4f3fa8;}function _0x22ef19(_0x217026,_0x21fa03){var _0x2db270=[{'name':'trunk','param':0x0},{'name':_0x782a('0x1d'),'param':0x1},{'name':'options','param':0x2},{'name':'url','param':0x3}];var _0x56cd30={};var _0x284986=_0x21fa03['split'](',');var _0x1d2708=[];for(var _0x49e9b7=0x0;_0x49e9b7<_0x2db270[_0x782a('0x1e')];_0x49e9b7++){switch(_0x2db270[_0x49e9b7][_0x782a('0x1f')]){case'trunk':_0x56cd30[_0x782a('0x20')]=_0x284986[_0x2db270[_0x49e9b7][_0x782a('0x21')]][_0x782a('0x22')]('/')[0x1];_0x56cd30[_0x782a('0x23')]=_0x284986[_0x2db270[_0x49e9b7][_0x782a('0x21')]][_0x782a('0x22')]('/')[0x2];_0x56cd30[_0x782a('0x24')]=_0x56cd30[_0x782a('0x23')]?_0x56cd30['phone'][_0x782a('0x22')]('$')[0x0]:undefined;_0x56cd30[_0x782a('0x23')]=_0x217026[_0x782a('0x12')]?(_0x56cd30[_0x782a('0x24')]||'')+'${EXTEN:'+_0x217026[_0x782a('0x12')]+'}':(_0x56cd30[_0x782a('0x24')]||'')+_0x782a('0x25');_0x1d2708[_0x2db270[_0x49e9b7][_0x782a('0x21')]]=[_0x782a('0x26'),_0x56cd30['trunk'],_0x56cd30['phone']][_0x782a('0x27')]('/');break;case'options':_0x56cd30[_0x782a('0x28')]=_0x284986[_0x2db270[_0x49e9b7][_0x782a('0x21')]];if(_0x217026[_0x782a('0x1a')]!==_0x782a('0x1b')){if(_0x56cd30[_0x782a('0x28')][_0x782a('0x29')](_0x782a('0x2a'))<0x0){_0x56cd30[_0x782a('0x28')]+='U(xcally-mixmonitor-context)';}}else{_0x56cd30[_0x782a('0x28')]=_0x56cd30[_0x782a('0x28')][_0x782a('0x2b')](_0x782a('0x2a'),'');}_0x1d2708[_0x2db270[_0x49e9b7]['param']]=_0x56cd30[_0x782a('0x28')];break;default:_0x1d2708[_0x2db270[_0x49e9b7][_0x782a('0x21')]]=_0x284986[_0x2db270[_0x49e9b7][_0x782a('0x21')]];}}return _0x1d2708[_0x782a('0x27')](',');}function _0x594008(_0x4d1f75,_0x4a953,_0x3e9202){return new Promise(function(_0x5519d0,_0x373747){var _0x4a6207=[];if(_[_0x782a('0x2c')](_0x4a953))return _0x5519d0(_0x4a6207);_0x2844de[_0x782a('0x2d')]['findAll']({'attributes':['id',_0x782a('0x2e'),_0x782a('0x2f')],'raw':!![]})[_0x782a('0x30')](function(_0x5100a6){for(var _0x155ee3=0x0,_0x1f0d6d=0x0;_0x155ee3<_0x4a953['length'];_0x155ee3++,_0x1f0d6d=0x0){var _0x2ab9ef=_0x4a953[_0x155ee3];var _0x1e95b3=[];var _0x2fbb42=[];delete _0x2ab9ef['id'];if(_0x2ab9ef[_0x782a('0x2e')]!=='*,*,*,*'){_0x2ab9ef[_0x782a('0x31')]=[_0x2ab9ef['interval']];}else{_0x2ab9ef[_0x782a('0x31')]=_0x2ab9ef['IntervalId']?_['map'](_['filter'](_0x5100a6,{'IntervalId':_0x2ab9ef['IntervalId']}),'interval'):[];}_0x2ab9ef['context']=_0x4d1f75[_0x782a('0x6')];_0x2ab9ef[_0x782a('0x7')]=_0x4d1f75['exten'];if(_0x2ab9ef['type'])_0x2ab9ef[_0x782a('0x3')]=_0x2ab9ef['type'][_0x782a('0x32')]();if(_0x4d1f75[_0x782a('0x3')]===_0x782a('0xf')){if(_0x2ab9ef[_0x782a('0x19')](_0x782a('0x33'))&&_0x2ab9ef['tag']&&_0x2ab9ef['tag']!=='--'){_0x1e95b3[_0x782a('0xa')]({'type':_0x2ab9ef[_0x782a('0x3')]['toLowerCase'](),'app':_0x782a('0x4'),'appdata':'CDR(tag)='+_0x2ab9ef[_0x782a('0x33')],'context':_0x4d1f75[_0x782a('0x6')],'exten':_0x4d1f75['exten'],'priority':_0x2ab9ef[_0x782a('0x31')][_0x782a('0x1e')]+_0x3e9202+_0x1f0d6d++,'VoiceExtensionId':_0x4d1f75['id']});}_0x1e95b3[_0x782a('0xa')]({'type':_0x2ab9ef[_0x782a('0x3')]['toLowerCase'](),'app':_0x782a('0x14'),'appdata':_0x782a('0x34')+(_0x2ab9ef[_0x782a('0x35')]?_0x782a('0x36')+_0x2ab9ef[_0x782a('0x35')]+')':_0x782a('0x37')),'context':_0x4d1f75[_0x782a('0x6')],'exten':_0x4d1f75[_0x782a('0x7')],'priority':_0x2ab9ef['intervals']['length']+_0x3e9202+_0x1f0d6d++,'VoiceExtensionId':_0x4d1f75['id']});}else{if(_0x2ab9ef['hasOwnProperty'](_0x782a('0x38'))){if([_0x782a('0x39'),_0x782a('0x3a')][_0x782a('0x3b')](_0x2ab9ef['app'][_0x782a('0x32')]())&&_0x2ab9ef['appType']!==_0x782a('0x3c')){if(_0x2ab9ef['answer']){_0x1e95b3[_0x782a('0xa')]({'type':_0x2ab9ef['type'][_0x782a('0x32')](),'app':'ExecIf','appdata':_0x782a('0x3d'),'context':_0x4d1f75['context'],'exten':_0x4d1f75[_0x782a('0x7')],'priority':_0x2ab9ef[_0x782a('0x31')]['length']+_0x3e9202+_0x1f0d6d++,'VoiceExtensionId':_0x4d1f75['id']});_0x1e95b3[_0x782a('0xa')]({'type':_0x2ab9ef[_0x782a('0x3')][_0x782a('0x32')](),'app':_0x782a('0x4'),'appdata':_0x782a('0x3e'),'context':_0x4d1f75['context'],'exten':_0x4d1f75[_0x782a('0x7')],'priority':_0x2ab9ef['intervals']['length']+_0x3e9202+_0x1f0d6d++,'VoiceExtensionId':_0x4d1f75['id']});}else{_0x1e95b3[_0x782a('0xa')]({'type':_0x2ab9ef[_0x782a('0x3')][_0x782a('0x32')](),'app':_0x782a('0x14'),'appdata':_0x782a('0x3f'),'context':_0x4d1f75[_0x782a('0x6')],'exten':_0x4d1f75[_0x782a('0x7')],'priority':_0x2ab9ef[_0x782a('0x31')][_0x782a('0x1e')]+_0x3e9202+_0x1f0d6d++,'VoiceExtensionId':_0x4d1f75['id']});_0x1e95b3['push']({'type':_0x2ab9ef[_0x782a('0x3')]['toLowerCase'](),'app':_0x782a('0x4'),'appdata':'XCALLY-MOTION-PROGRESS=1','context':_0x4d1f75['context'],'exten':_0x4d1f75[_0x782a('0x7')],'priority':_0x2ab9ef[_0x782a('0x31')]['length']+_0x3e9202+_0x1f0d6d++,'VoiceExtensionId':_0x4d1f75['id']});}}}}for(var _0x1b2dd5=0x0;_0x1b2dd5<_0x2ab9ef['intervals']['length'];_0x1b2dd5++){var _0x4fd464=_0x3e9202+_0x2ab9ef[_0x782a('0x31')]['length'];var _0x47d015=_0x1b2dd5===_0x2ab9ef[_0x782a('0x31')][_0x782a('0x1e')]-0x1?_0x3e9202+_0x1e95b3[_0x782a('0x1e')]+_0x2fbb42[_0x782a('0x1e')]+0x2:_0x3e9202+_0x1b2dd5+0x1;_0x1e95b3[_0x782a('0x40')](_0x1b2dd5,0x0,{'type':_0x4d1f75[_0x782a('0x3')],'app':'GotoIfTime','appdata':_0x2ab9ef[_0x782a('0x31')][_0x1b2dd5]+'?'+_0x4d1f75['context']+',${EXTEN},'+_0x4fd464+':'+_0x4d1f75[_0x782a('0x6')]+_0x782a('0x41')+_0x47d015,'exten':_0x4d1f75[_0x782a('0x7')],'context':_0x4d1f75[_0x782a('0x6')],'priority':_0x3e9202+_0x1b2dd5,'VoiceExtensionId':_0x4d1f75['id']});}if(_0x2ab9ef['appType']===_0x782a('0x42'))_0x2ab9ef[_0x782a('0x43')]=_0x22ef19(_0x4d1f75,_0x2ab9ef[_0x782a('0x43')]);_0x2ab9ef['priority']=_0x1e95b3['length']?_[_0x782a('0x44')](_0x1e95b3)['priority']+0x1:_0x3e9202;_0x4a6207=_['concat'](_0x4a6207,_0x1e95b3,[_0x2ab9ef],_0x2fbb42);_0x3e9202=_[_0x782a('0x44')](_0x4a6207)[_0x782a('0x45')]+0x1;}return _0x5519d0(_0x4a6207);})['catch'](function(_0x1ef879){_0x373747(_0x1ef879);});});}return _0x1e39e4[_0x782a('0x46')](_0x782a('0x47'),attributes,{'tableName':_0x782a('0x48'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x3f9ad7){var _0x5110c2=this[_0x782a('0x49')]({'plain':!![]});var _0x2f61a0=_0x5110c2[_0x782a('0x3')]===_0x782a('0xf')?_0x2774a2(_0x5110c2):_0x3dc9c7(_0x5110c2);return _0x594008(_0x5110c2,_0x3f9ad7,_[_0x782a('0x44')](_0x2f61a0)[_0x782a('0x45')]+0x1)[_0x782a('0x30')](function(_0x61b5f6){var _0x53816=_['concat'](_0x2f61a0,_0x61b5f6);_0x53816['push']({'type':_0x5110c2[_0x782a('0x3')],'app':_0x782a('0x4a'),'exten':_0x5110c2[_0x782a('0x7')],'context':_0x5110c2[_0x782a('0x6')],'priority':_[_0x782a('0x44')](_0x53816)[_0x782a('0x45')]+0x1,'VoiceExtensionId':_0x5110c2['id']});return _0x53816;});}}});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.rpc.js b/server/api/voiceExtension/voiceExtension.rpc.js index 028102e..3cc43f4 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 _0x90b1=['register','request','then','info','VoiceExtension,\x20%s,\x20%s','debug','VoiceExtension,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','GetVoiceExtension','VoiceExtension','options','where','attributes','limit','include','map','model','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','http','redis','defaults','localhost','socket.io-emitter'];(function(_0x26f3b1,_0x22a32a){var _0x4df642=function(_0x47ee26){while(--_0x47ee26){_0x26f3b1['push'](_0x26f3b1['shift']());}};_0x4df642(++_0x22a32a);}(_0x90b1,0x1bb));var _0x190b=function(_0x5c3261,_0x3201ad){_0x5c3261=_0x5c3261-0x0;var _0x4c3d7d=_0x90b1[_0x5c3261];return _0x4c3d7d;};'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});config[_0x190b('0x8')]=_[_0x190b('0x9')](config[_0x190b('0x8')],{'host':_0x190b('0xa'),'port':0x18eb});var socket=require(_0x190b('0xb'))(new Redis(config[_0x190b('0x8')]));require('./voiceExtension.socket')[_0x190b('0xc')](socket);function respondWithRpcPromise(_0x186101,_0x163966,_0x33fd04){return new BPromise(function(_0x41b788,_0x409aa3){return client[_0x190b('0xd')](_0x186101,_0x33fd04)[_0x190b('0xe')](function(_0x5d6497){logger[_0x190b('0xf')](_0x190b('0x10'),_0x163966,'request\x20sent');logger[_0x190b('0x11')](_0x190b('0x12'),_0x163966,_0x190b('0x13'),JSON[_0x190b('0x14')](_0x5d6497));if(_0x5d6497[_0x190b('0x15')]){if(_0x5d6497[_0x190b('0x15')][_0x190b('0x16')]===0x1f4){logger[_0x190b('0x15')](_0x190b('0x10'),_0x163966,_0x5d6497[_0x190b('0x15')][_0x190b('0x17')]);return _0x409aa3(_0x5d6497[_0x190b('0x15')][_0x190b('0x17')]);}logger[_0x190b('0x15')](_0x190b('0x10'),_0x163966,_0x5d6497[_0x190b('0x15')][_0x190b('0x17')]);return _0x41b788(_0x5d6497['error'][_0x190b('0x17')]);}else{logger['info'](_0x190b('0x10'),_0x163966,_0x190b('0x13'));_0x41b788(_0x5d6497[_0x190b('0x18')][_0x190b('0x17')]);}})['catch'](function(_0x298343){logger[_0x190b('0x15')](_0x190b('0x10'),_0x163966,_0x298343);_0x409aa3(_0x298343);});});}exports[_0x190b('0x19')]=function(_0x1b5427){var _0x177170=this;return new Promise(function(_0x47d704,_0x3ed24c){return db[_0x190b('0x1a')]['findAll']({'raw':_0x1b5427[_0x190b('0x1b')]?_0x1b5427['options']['raw']===undefined?!![]:![]:!![],'where':_0x1b5427[_0x190b('0x1b')]?_0x1b5427[_0x190b('0x1b')][_0x190b('0x1c')]||null:null,'attributes':_0x1b5427['options']?_0x1b5427[_0x190b('0x1b')][_0x190b('0x1d')]||null:null,'limit':_0x1b5427[_0x190b('0x1b')]?_0x1b5427[_0x190b('0x1b')][_0x190b('0x1e')]||null:null,'include':_0x1b5427[_0x190b('0x1b')]?_0x1b5427[_0x190b('0x1b')]['include']?_['map'](_0x1b5427[_0x190b('0x1b')][_0x190b('0x1f')],function(_0x50605b){return{'model':db[_0x50605b['model']],'as':_0x50605b['as'],'attributes':_0x50605b[_0x190b('0x1d')],'include':_0x50605b['include']?_[_0x190b('0x20')](_0x50605b[_0x190b('0x1f')],function(_0x51f8b4){return{'model':db[_0x51f8b4[_0x190b('0x21')]],'as':_0x51f8b4['as'],'attributes':_0x51f8b4[_0x190b('0x1d')],'include':_0x51f8b4['include']?_[_0x190b('0x20')](_0x51f8b4[_0x190b('0x1f')],function(_0x359b4a){return{'model':db[_0x359b4a['model']],'as':_0x359b4a['as'],'attributes':_0x359b4a['attributes']};}):[]};}):[]};}):[]:[]})[_0x190b('0xe')](function(_0x4d5f3f){logger[_0x190b('0xf')](_0x190b('0x19'),_0x1b5427);logger['debug'](_0x190b('0x19'),_0x1b5427,JSON['stringify'](_0x4d5f3f));_0x47d704(_0x4d5f3f);})[_0x190b('0x22')](function(_0x4ff5a6){logger[_0x190b('0x15')]('GetVoiceExtension',_0x4ff5a6[_0x190b('0x17')],_0x1b5427);_0x3ed24c(_0x177170[_0x190b('0x15')](0x1f4,_0x4ff5a6['message']));});});}; \ No newline at end of file +var _0x2cd0=['register','request','info','VoiceExtension,\x20%s,\x20%s','VoiceExtension,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','GetVoiceExtension','VoiceExtension','findAll','options','raw','attributes','limit','include','map','model','then','debug','catch','lodash','util','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./voiceExtension.socket'];(function(_0x346f68,_0xb45d9d){var _0x2d1803=function(_0x3e5b6a){while(--_0x3e5b6a){_0x346f68['push'](_0x346f68['shift']());}};_0x2d1803(++_0xb45d9d);}(_0x2cd0,0x8a));var _0x02cd=function(_0x4456a2,_0x376ff2){_0x4456a2=_0x4456a2-0x0;var _0xf36b56=_0x2cd0[_0x4456a2];return _0xf36b56;};'use strict';var _=require(_0x02cd('0x0'));var util=require(_0x02cd('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x02cd('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x02cd('0x3'));var logger=require(_0x02cd('0x4'))(_0x02cd('0x5'));var config=require(_0x02cd('0x6'));var jayson=require(_0x02cd('0x7'));var client=jayson[_0x02cd('0x8')][_0x02cd('0x9')]({'port':0x232a});config[_0x02cd('0xa')]=_[_0x02cd('0xb')](config[_0x02cd('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x02cd('0xc'))(new Redis(config[_0x02cd('0xa')]));require(_0x02cd('0xd'))[_0x02cd('0xe')](socket);function respondWithRpcPromise(_0x45cc20,_0xd0cc56,_0x18dfe0){return new BPromise(function(_0x2364c3,_0x15a488){return client[_0x02cd('0xf')](_0x45cc20,_0x18dfe0)['then'](function(_0x59f017){logger[_0x02cd('0x10')](_0x02cd('0x11'),_0xd0cc56,'request\x20sent');logger['debug'](_0x02cd('0x12'),_0xd0cc56,'request\x20sent',JSON[_0x02cd('0x13')](_0x59f017));if(_0x59f017[_0x02cd('0x14')]){if(_0x59f017[_0x02cd('0x14')][_0x02cd('0x15')]===0x1f4){logger[_0x02cd('0x14')](_0x02cd('0x11'),_0xd0cc56,_0x59f017['error']['message']);return _0x15a488(_0x59f017[_0x02cd('0x14')][_0x02cd('0x16')]);}logger[_0x02cd('0x14')](_0x02cd('0x11'),_0xd0cc56,_0x59f017[_0x02cd('0x14')]['message']);return _0x2364c3(_0x59f017[_0x02cd('0x14')]['message']);}else{logger['info'](_0x02cd('0x11'),_0xd0cc56,_0x02cd('0x17'));_0x2364c3(_0x59f017[_0x02cd('0x18')][_0x02cd('0x16')]);}})['catch'](function(_0x341ace){logger['error'](_0x02cd('0x11'),_0xd0cc56,_0x341ace);_0x15a488(_0x341ace);});});}exports[_0x02cd('0x19')]=function(_0x332688){var _0x20b7ea=this;return new Promise(function(_0x3edee6,_0x1f51b1){return db[_0x02cd('0x1a')][_0x02cd('0x1b')]({'raw':_0x332688[_0x02cd('0x1c')]?_0x332688[_0x02cd('0x1c')][_0x02cd('0x1d')]===undefined?!![]:![]:!![],'where':_0x332688[_0x02cd('0x1c')]?_0x332688[_0x02cd('0x1c')]['where']||null:null,'attributes':_0x332688[_0x02cd('0x1c')]?_0x332688['options'][_0x02cd('0x1e')]||null:null,'limit':_0x332688[_0x02cd('0x1c')]?_0x332688['options'][_0x02cd('0x1f')]||null:null,'include':_0x332688[_0x02cd('0x1c')]?_0x332688['options'][_0x02cd('0x20')]?_[_0x02cd('0x21')](_0x332688[_0x02cd('0x1c')][_0x02cd('0x20')],function(_0x5d2fc1){return{'model':db[_0x5d2fc1[_0x02cd('0x22')]],'as':_0x5d2fc1['as'],'attributes':_0x5d2fc1[_0x02cd('0x1e')],'include':_0x5d2fc1[_0x02cd('0x20')]?_[_0x02cd('0x21')](_0x5d2fc1[_0x02cd('0x20')],function(_0x2762ba){return{'model':db[_0x2762ba[_0x02cd('0x22')]],'as':_0x2762ba['as'],'attributes':_0x2762ba[_0x02cd('0x1e')],'include':_0x2762ba[_0x02cd('0x20')]?_[_0x02cd('0x21')](_0x2762ba['include'],function(_0x139d7f){return{'model':db[_0x139d7f[_0x02cd('0x22')]],'as':_0x139d7f['as'],'attributes':_0x139d7f[_0x02cd('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x02cd('0x23')](function(_0x212b7d){logger[_0x02cd('0x10')](_0x02cd('0x19'),_0x332688);logger[_0x02cd('0x24')](_0x02cd('0x19'),_0x332688,JSON['stringify'](_0x212b7d));_0x3edee6(_0x212b7d);})[_0x02cd('0x25')](function(_0xbe10e8){logger[_0x02cd('0x14')](_0x02cd('0x19'),_0xbe10e8[_0x02cd('0x16')],_0x332688);_0x1f51b1(_0x20b7ea[_0x02cd('0x14')](0x1f4,_0xbe10e8['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.socket.js b/server/api/voiceExtension/voiceExtension.socket.js index ef3064c..64b2aa3 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(_0x16583a,_0x22a3f6){var _0x446a80=function(_0xefa0a1){while(--_0xefa0a1){_0x16583a['push'](_0x16583a['shift']());}};_0x446a80(++_0x22a3f6);}(_0x53ec,0x192));var _0xc53e=function(_0x1fcb67,_0x70fb6c){_0x1fcb67=_0x1fcb67-0x0;var _0x17a001=_0x53ec[_0x1fcb67];return _0x17a001;};'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 _0x5fc3=['./voiceExtension.events','save','update','emit','removeListener','register','voiceExtension:'];(function(_0xeba907,_0x48670c){var _0x2f4776=function(_0x209390){while(--_0x209390){_0xeba907['push'](_0xeba907['shift']());}};_0x2f4776(++_0x48670c);}(_0x5fc3,0xa8));var _0x35fc=function(_0x2bf466,_0x4929a5){_0x2bf466=_0x2bf466-0x0;var _0x856885=_0x5fc3[_0x2bf466];return _0x856885;};'use strict';var VoiceExtensionEvents=require(_0x35fc('0x0'));var events=[_0x35fc('0x1'),'remove',_0x35fc('0x2')];function createListener(_0x2ac6da,_0x196bc2){return function(_0x91d024){_0x196bc2[_0x35fc('0x3')](_0x2ac6da,_0x91d024);};}function removeListener(_0x5e75e6,_0x2d1404){return function(){VoiceExtensionEvents[_0x35fc('0x4')](_0x5e75e6,_0x2d1404);};}exports[_0x35fc('0x5')]=function(_0x5b85ad){for(var _0x5754be=0x0,_0x19a0d1=events['length'];_0x5754be<_0x19a0d1;_0x5754be++){var _0x16e153=events[_0x5754be];var _0x27524f=createListener(_0x35fc('0x6')+_0x16e153,_0x5b85ad);VoiceExtensionEvents['on'](_0x16e153,_0x27524f);}}; \ No newline at end of file diff --git a/server/api/voiceMail/index.js b/server/api/voiceMail/index.js index 28b5019..a9af659 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 _0xa46e=['delete','destroy','multer','util','connect-timeout','express','Router','../../components/auth/service','../../config/environment','get','index','isAuthenticated','show','/:id/messages','create','put','update'];(function(_0x410e5e,_0x255732){var _0x597520=function(_0x526b68){while(--_0x526b68){_0x410e5e['push'](_0x410e5e['shift']());}};_0x597520(++_0x255732);}(_0xa46e,0x8a));var _0xea46=function(_0x136a0d,_0x476fe2){_0x136a0d=_0x136a0d-0x0;var _0x212ea5=_0xa46e[_0x136a0d];return _0x212ea5;};'use strict';var multer=require(_0xea46('0x0'));var util=require(_0xea46('0x1'));var path=require('path');var timeout=require(_0xea46('0x2'));var express=require(_0xea46('0x3'));var router=express[_0xea46('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xea46('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xea46('0x6'));var controller=require('./voiceMail.controller');router[_0xea46('0x7')]('/',auth['isAuthenticated'](),controller[_0xea46('0x8')]);router[_0xea46('0x7')]('/:id',auth[_0xea46('0x9')](),controller[_0xea46('0xa')]);router[_0xea46('0x7')](_0xea46('0xb'),auth[_0xea46('0x9')](),controller['getMessages']);router['post']('/',auth['isAuthenticated'](),controller[_0xea46('0xc')]);router[_0xea46('0xd')]('/:id',auth[_0xea46('0x9')](),controller[_0xea46('0xe')]);router[_0xea46('0xf')]('/:id',auth[_0xea46('0x9')](),controller[_0xea46('0x10')]);module['exports']=router; \ No newline at end of file +var _0x326f=['multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMail.controller','get','isAuthenticated','/:id','show','getMessages','post','create','put','delete','exports'];(function(_0x2993e4,_0x2af2db){var _0x4167b5=function(_0x2150a5){while(--_0x2150a5){_0x2993e4['push'](_0x2993e4['shift']());}};_0x4167b5(++_0x2af2db);}(_0x326f,0xd1));var _0xf326=function(_0x3279ac,_0x9c0657){_0x3279ac=_0x3279ac-0x0;var _0x2b52b0=_0x326f[_0x3279ac];return _0x2b52b0;};'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/messages',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/voiceMail/voiceMail.attributes.js b/server/api/voiceMail/voiceMail.attributes.js index 42aa677..c9f0321 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 _0xde86=['central','ENUM','yes','TIMESTAMP','VIRTUAL','getDataValue','fullname','\x20-\x20','mailbox','exports','STRING','from-voicemail','contest_mailbox','setDataValue','string','trim'];(function(_0x37f727,_0x2b3ec8){var _0x10efcc=function(_0x46ffcd){while(--_0x46ffcd){_0x37f727['push'](_0x37f727['shift']());}};_0x10efcc(++_0x2b3ec8);}(_0xde86,0x119));var _0x6de8=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xde86[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module[_0x6de8('0x0')]={'customer_id':{'type':Sequelize[_0x6de8('0x1')]},'context':{'type':Sequelize[_0x6de8('0x1')],'defaultValue':_0x6de8('0x2'),'unique':_0x6de8('0x3')},'mailbox':{'type':Sequelize[_0x6de8('0x1')],'defaultValue':'','allowNull':![],'unique':'contest_mailbox'},'password':{'type':Sequelize[_0x6de8('0x1')]},'fullname':{'type':Sequelize[_0x6de8('0x1')]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]},'set':function(_0x2bbf38){this[_0x6de8('0x4')]('email',typeof _0x2bbf38===_0x6de8('0x5')&&_0x2bbf38[_0x6de8('0x6')]()?_0x2bbf38[_0x6de8('0x6')]():null);}},'pager':{'type':Sequelize[_0x6de8('0x1')]},'tz':{'type':Sequelize[_0x6de8('0x1')],'defaultValue':_0x6de8('0x7')},'attach':{'type':Sequelize[_0x6de8('0x8')]('yes','no'),'defaultValue':_0x6de8('0x9'),'allowNull':![]},'saycid':{'type':Sequelize[_0x6de8('0x8')](_0x6de8('0x9'),'no'),'defaultValue':'yes','allowNull':![]},'dialout':{'type':Sequelize[_0x6de8('0x1')]},'callback':{'type':Sequelize[_0x6de8('0x1')]},'review':{'type':Sequelize[_0x6de8('0x8')](_0x6de8('0x9'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0x6de8('0x8')](_0x6de8('0x9'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0x6de8('0x8')](_0x6de8('0x9'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':'TINYINT(4)','defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0x6de8('0x8')](_0x6de8('0x9'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0x6de8('0x8')](_0x6de8('0x9'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize['ENUM'](_0x6de8('0x9'),'no'),'defaultValue':_0x6de8('0x9'),'allowNull':![]},'forcename':{'type':Sequelize[_0x6de8('0x8')](_0x6de8('0x9'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0x6de8('0x8')](_0x6de8('0x9'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0x6de8('0x8')](_0x6de8('0x9'),'no'),'defaultValue':_0x6de8('0x9'),'allowNull':![]},'stamp':{'type':_0x6de8('0xa')},'emailsubject':{'type':Sequelize[_0x6de8('0x1')]},'emailbody':{'type':Sequelize[_0x6de8('0x1')]},'maxsecs':{'type':Sequelize['INTEGER'](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize['INTEGER'](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0x6de8('0xb')],'get':function(){return this[_0x6de8('0xc')](_0x6de8('0xd'))+_0x6de8('0xe')+this['getDataValue'](_0x6de8('0xf'));}}}; \ No newline at end of file +var _0x47b1=['TINYINT(4)','TIMESTAMP','INTEGER','VIRTUAL','getDataValue','fullname','\x20-\x20','mailbox','exports','STRING','contest_mailbox','setDataValue','email','string','trim','central','ENUM','yes'];(function(_0x397d79,_0x11c0fb){var _0x2928dc=function(_0x3e6b7b){while(--_0x3e6b7b){_0x397d79['push'](_0x397d79['shift']());}};_0x2928dc(++_0x11c0fb);}(_0x47b1,0xbc));var _0x147b=function(_0x1edb88,_0x29dcf4){_0x1edb88=_0x1edb88-0x0;var _0x3bfbdd=_0x47b1[_0x1edb88];return _0x3bfbdd;};'use strict';var Sequelize=require('sequelize');module[_0x147b('0x0')]={'customer_id':{'type':Sequelize[_0x147b('0x1')]},'context':{'type':Sequelize['STRING'],'defaultValue':'from-voicemail','unique':_0x147b('0x2')},'mailbox':{'type':Sequelize[_0x147b('0x1')],'defaultValue':'','allowNull':![],'unique':_0x147b('0x2')},'password':{'type':Sequelize[_0x147b('0x1')]},'fullname':{'type':Sequelize[_0x147b('0x1')]},'email':{'type':Sequelize[_0x147b('0x1')],'validate':{'isEmail':!![]},'set':function(_0x45382d){this[_0x147b('0x3')](_0x147b('0x4'),typeof _0x45382d===_0x147b('0x5')&&_0x45382d[_0x147b('0x6')]()?_0x45382d[_0x147b('0x6')]():null);}},'pager':{'type':Sequelize['STRING']},'tz':{'type':Sequelize[_0x147b('0x1')],'defaultValue':_0x147b('0x7')},'attach':{'type':Sequelize[_0x147b('0x8')](_0x147b('0x9'),'no'),'defaultValue':_0x147b('0x9'),'allowNull':![]},'saycid':{'type':Sequelize[_0x147b('0x8')]('yes','no'),'defaultValue':'yes','allowNull':![]},'dialout':{'type':Sequelize[_0x147b('0x1')]},'callback':{'type':Sequelize[_0x147b('0x1')]},'review':{'type':Sequelize[_0x147b('0x8')](_0x147b('0x9'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0x147b('0x8')](_0x147b('0x9'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0x147b('0x8')]('yes','no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0x147b('0xa'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0x147b('0x8')]('yes','no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0x147b('0x8')](_0x147b('0x9'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0x147b('0x8')]('yes','no'),'defaultValue':'yes','allowNull':![]},'forcename':{'type':Sequelize[_0x147b('0x8')]('yes','no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0x147b('0x8')](_0x147b('0x9'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0x147b('0x8')](_0x147b('0x9'),'no'),'defaultValue':_0x147b('0x9'),'allowNull':![]},'stamp':{'type':_0x147b('0xb')},'emailsubject':{'type':Sequelize[_0x147b('0x1')]},'emailbody':{'type':Sequelize[_0x147b('0x1')]},'maxsecs':{'type':Sequelize[_0x147b('0xc')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0x147b('0xc')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0x147b('0xd')],'get':function(){return this[_0x147b('0xe')](_0x147b('0xf'))+_0x147b('0x10')+this[_0x147b('0xe')](_0x147b('0x11'));}}}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.controller.js b/server/api/voiceMail/voiceMail.controller.js index 2343731..efa094d 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 _0x750a=['mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','../../config/license/util','status','end','offset','undefined','count','set','json','destroy','then','get','Voicemails','UserProfileResource','sendStatus','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','keys','filters','intersection','query','fields','attributes','hasOwnProperty','nolimit','limit','order','sort','where','pick','merge','VIRTUAL','filter','options','VoiceMail','include','findAll','rows','catch','show','params','includeAll','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','body','getMessages','findOne','VoiceMailMessage','length','findAndCountAll','rimraf','request-promise','moment','bluebird'];(function(_0xbca161,_0x4ff432){var _0x16b108=function(_0x1f0463){while(--_0x1f0463){_0xbca161['push'](_0xbca161['shift']());}};_0x16b108(++_0x4ff432);}(_0x750a,0x140));var _0xa750=function(_0x5205ff,_0x4b1398){_0x5205ff=_0x5205ff-0x0;var _0x4b6e51=_0x750a[_0x5205ff];return _0x4b6e51;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa750('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xa750('0x1'));var moment=require(_0xa750('0x2'));var BPromise=require(_0xa750('0x3'));var Mustache=require(_0xa750('0x4'));var util=require(_0xa750('0x5'));var path=require(_0xa750('0x6'));var sox=require(_0xa750('0x7'));var csv=require(_0xa750('0x8'));var ejs=require(_0xa750('0x9'));var fs=require('fs');var fs_extra=require(_0xa750('0xa'));var _=require(_0xa750('0xb'));var squel=require(_0xa750('0xc'));var crypto=require(_0xa750('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xa750('0x8'));var querystring=require('querystring');var Papa=require(_0xa750('0xe'));var Redis=require(_0xa750('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xa750('0x10'));var as=require(_0xa750('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xa750('0x12'));var utils=require('../../config/utils');var config=require(_0xa750('0x13'));var licenseUtil=require(_0xa750('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x24ec62,_0x1c5657){_0x1c5657=_0x1c5657||0xcc;return function(_0x344c67){if(_0x344c67){return _0x24ec62['sendStatus'](_0x1c5657);}return _0x24ec62[_0xa750('0x15')](_0x1c5657)[_0xa750('0x16')]();};}function respondWithResult(_0x2d3421,_0x24e48a){_0x24e48a=_0x24e48a||0xc8;return function(_0xa66181){if(_0xa66181){return _0x2d3421[_0xa750('0x15')](_0x24e48a)['json'](_0xa66181);}};}function respondWithFilteredResult(_0x3ae2a1,_0x8488ea){return function(_0x290d46){if(_0x290d46){var _0x49fe3b=typeof _0x8488ea[_0xa750('0x17')]===_0xa750('0x18')&&typeof _0x8488ea['limit']==='undefined';var _0x321eb2=_0x290d46['count'];var _0x433dbd=_0x49fe3b?0x0:_0x8488ea[_0xa750('0x17')];var _0x4f1faa=_0x49fe3b?_0x290d46[_0xa750('0x19')]:_0x8488ea['offset']+_0x8488ea['limit'];var _0x25e335;if(_0x4f1faa>=_0x321eb2){_0x4f1faa=_0x321eb2;_0x25e335=0xc8;}else{_0x25e335=0xce;}_0x3ae2a1['status'](_0x25e335);return _0x3ae2a1[_0xa750('0x1a')]('Content-Range',_0x433dbd+'-'+_0x4f1faa+'/'+_0x321eb2)[_0xa750('0x1b')](_0x290d46);}return null;};}function patchUpdates(_0x4a007d){return function(_0x3dc7f1){try{jsonpatch['apply'](_0x3dc7f1,_0x4a007d,!![]);}catch(_0x1efb68){return BPromise['reject'](_0x1efb68);}return _0x3dc7f1['save']();};}function saveUpdates(_0xaa9d3e,_0x52da84){return function(_0x216fbf){if(_0x216fbf){return _0x216fbf['update'](_0xaa9d3e)['then'](function(_0x5b433d){return _0x5b433d;});}return null;};}function removeEntity(_0x5d758e,_0x15d72f){return function(_0x2ec6c4){if(_0x2ec6c4){return _0x2ec6c4[_0xa750('0x1c')]()[_0xa750('0x1d')](function(){var _0x1b80a5=_0x2ec6c4[_0xa750('0x1e')]({'plain':!![]});var _0x3001bc=_0xa750('0x1f');return db[_0xa750('0x20')][_0xa750('0x1c')]({'where':{'type':_0x3001bc,'resourceId':_0x1b80a5['id']}})[_0xa750('0x1d')](function(){return _0x2ec6c4;});})[_0xa750('0x1d')](function(){_0x5d758e[_0xa750('0x15')](0xcc)[_0xa750('0x16')]();});}};}function handleEntityNotFound(_0x310e2d,_0x4ffff4){return function(_0x3d3923){if(!_0x3d3923){_0x310e2d[_0xa750('0x21')](0x194);}return _0x3d3923;};}function handleError(_0x21cd2c,_0x4cceee){_0x4cceee=_0x4cceee||0x1f4;return function(_0x35ab53){logger[_0xa750('0x22')](_0x35ab53[_0xa750('0x23')]);if(_0x35ab53[_0xa750('0x24')]){delete _0x35ab53['name'];}_0x21cd2c[_0xa750('0x15')](_0x4cceee)[_0xa750('0x25')](_0x35ab53);};}exports[_0xa750('0x26')]=function(_0x2aef3a,_0x2c5253){var _0x59ab33={},_0x46cc11={},_0x4c2c9e={'count':0x0,'rows':[]};var _0x2d0e93=_[_0xa750('0x27')](db['VoiceMail'][_0xa750('0x28')],function(_0x6bc25d){return{'name':_0x6bc25d[_0xa750('0x29')],'type':_0x6bc25d[_0xa750('0x2a')][_0xa750('0x2b')]};});_0x46cc11[_0xa750('0x2c')]=_[_0xa750('0x27')](_0x2d0e93,_0xa750('0x24'));_0x46cc11['query']=_[_0xa750('0x2d')](_0x2aef3a['query']);_0x46cc11[_0xa750('0x2e')]=_[_0xa750('0x2f')](_0x46cc11[_0xa750('0x2c')],_0x46cc11[_0xa750('0x30')]);_0x59ab33['attributes']=_[_0xa750('0x2f')](_0x46cc11[_0xa750('0x2c')],qs['fields'](_0x2aef3a[_0xa750('0x30')][_0xa750('0x31')]));_0x59ab33[_0xa750('0x32')]=_0x59ab33[_0xa750('0x32')]['length']?_0x59ab33[_0xa750('0x32')]:_0x46cc11['model'];if(!_0x2aef3a['query'][_0xa750('0x33')](_0xa750('0x34'))){_0x59ab33[_0xa750('0x35')]=qs['limit'](_0x2aef3a[_0xa750('0x30')][_0xa750('0x35')]);_0x59ab33[_0xa750('0x17')]=qs['offset'](_0x2aef3a[_0xa750('0x30')][_0xa750('0x17')]);}_0x59ab33[_0xa750('0x36')]=qs['sort'](_0x2aef3a[_0xa750('0x30')][_0xa750('0x37')]);_0x59ab33[_0xa750('0x38')]=qs['filters'](_[_0xa750('0x39')](_0x2aef3a[_0xa750('0x30')],_0x46cc11[_0xa750('0x2e')]),_0x2d0e93);if(_0x2aef3a[_0xa750('0x30')]['filter']){_0x59ab33['where']=_[_0xa750('0x3a')](_0x59ab33[_0xa750('0x38')],{'$or':_['map'](_0x2d0e93,function(_0x43dc3a){if(_0x43dc3a[_0xa750('0x2a')]!==_0xa750('0x3b')){var _0x1166ff={};_0x1166ff[_0x43dc3a[_0xa750('0x24')]]={'$like':'%'+_0x2aef3a['query'][_0xa750('0x3c')]+'%'};return _0x1166ff;}})});}_0x59ab33=_[_0xa750('0x3a')]({},_0x59ab33,_0x2aef3a[_0xa750('0x3d')]);var _0x134874={'where':_0x59ab33[_0xa750('0x38')]};return db[_0xa750('0x3e')][_0xa750('0x19')](_0x134874)['then'](function(_0x3daa38){_0x4c2c9e['count']=_0x3daa38;if(_0x2aef3a[_0xa750('0x30')]['includeAll']){_0x59ab33[_0xa750('0x3f')]=[{'all':!![]}];}return db[_0xa750('0x3e')][_0xa750('0x40')](_0x59ab33);})[_0xa750('0x1d')](function(_0x430d60){_0x4c2c9e[_0xa750('0x41')]=_0x430d60;return _0x4c2c9e;})[_0xa750('0x1d')](respondWithFilteredResult(_0x2c5253,_0x59ab33))[_0xa750('0x42')](handleError(_0x2c5253,null));};exports[_0xa750('0x43')]=function(_0x108a1a,_0x36a8d6){var _0x1458f1={'raw':!![],'where':{'id':_0x108a1a[_0xa750('0x44')]['id']}},_0x3ec860={};_0x3ec860[_0xa750('0x2c')]=_[_0xa750('0x2d')](db[_0xa750('0x3e')][_0xa750('0x28')]);_0x3ec860[_0xa750('0x30')]=_[_0xa750('0x2d')](_0x108a1a['query']);_0x3ec860[_0xa750('0x2e')]=_[_0xa750('0x2f')](_0x3ec860[_0xa750('0x2c')],_0x3ec860[_0xa750('0x30')]);_0x1458f1[_0xa750('0x32')]=_[_0xa750('0x2f')](_0x3ec860[_0xa750('0x2c')],qs[_0xa750('0x31')](_0x108a1a[_0xa750('0x30')]['fields']));_0x1458f1[_0xa750('0x32')]=_0x1458f1[_0xa750('0x32')]['length']?_0x1458f1[_0xa750('0x32')]:_0x3ec860[_0xa750('0x2c')];if(_0x108a1a[_0xa750('0x30')][_0xa750('0x45')]){_0x1458f1[_0xa750('0x3f')]=[{'all':!![]}];}_0x1458f1=_[_0xa750('0x3a')]({},_0x1458f1,_0x108a1a[_0xa750('0x3d')]);return db[_0xa750('0x3e')][_0xa750('0x46')](_0x1458f1)[_0xa750('0x1d')](handleEntityNotFound(_0x36a8d6,null))['then'](respondWithResult(_0x36a8d6,null))[_0xa750('0x42')](handleError(_0x36a8d6,null));};exports[_0xa750('0x47')]=function(_0x58afd2,_0x93e49f){return db[_0xa750('0x3e')][_0xa750('0x47')](_0x58afd2['body'],{})[_0xa750('0x1d')](function(_0x3fc623){var _0x1e5a9a=_0x58afd2[_0xa750('0x48')]['get']({'plain':!![]});if(!_0x1e5a9a)throw new Error(_0xa750('0x49'));if(_0x1e5a9a[_0xa750('0x4a')]===_0xa750('0x48')){var _0xed4f88=_0x3fc623['get']({'plain':!![]});var _0x203f2a=_0xa750('0x1f');return db['UserProfileSection'][_0xa750('0x46')]({'where':{'name':_0x203f2a,'userProfileId':_0x1e5a9a['userProfileId']},'raw':!![]})[_0xa750('0x1d')](function(_0x69995b){if(_0x69995b&&_0x69995b['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0xed4f88[_0xa750('0x24')],'resourceId':_0xed4f88['id'],'type':_0x69995b[_0xa750('0x24')],'sectionId':_0x69995b['id']},{})['then'](function(){return _0x3fc623;});}else{return _0x3fc623;}})[_0xa750('0x42')](function(_0x1a79a9){logger[_0xa750('0x22')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1a79a9);throw _0x1a79a9;});}return _0x3fc623;})['then'](respondWithResult(_0x93e49f,0xc9))['catch'](handleError(_0x93e49f,null));};exports['update']=function(_0x3c34d4,_0x4a1b5d){if(_0x3c34d4[_0xa750('0x4b')]['id']){delete _0x3c34d4[_0xa750('0x4b')]['id'];}return db['VoiceMail'][_0xa750('0x46')]({'where':{'id':_0x3c34d4['params']['id']}})[_0xa750('0x1d')](handleEntityNotFound(_0x4a1b5d,null))['then'](saveUpdates(_0x3c34d4['body'],null))['then'](respondWithResult(_0x4a1b5d,null))['catch'](handleError(_0x4a1b5d,null));};exports[_0xa750('0x1c')]=function(_0x40dac2,_0x5f1313){return db['VoiceMail']['find']({'where':{'id':_0x40dac2[_0xa750('0x44')]['id']}})[_0xa750('0x1d')](handleEntityNotFound(_0x5f1313,null))[_0xa750('0x1d')](removeEntity(_0x5f1313,null))[_0xa750('0x42')](handleError(_0x5f1313,null));};exports[_0xa750('0x4c')]=function(_0x13528a,_0x599e7e,_0x590b1c){return db[_0xa750('0x3e')][_0xa750('0x4d')]({'where':{'id':_0x13528a[_0xa750('0x44')]['id']}})[_0xa750('0x1d')](handleEntityNotFound(_0x599e7e,null))[_0xa750('0x1d')](function(_0x5a3cd5){var _0x4030b3;var _0xaa63be={},_0x2c7dd0={};_0x2c7dd0[_0xa750('0x2c')]=_[_0xa750('0x2d')](db[_0xa750('0x4e')][_0xa750('0x28')]);_0x2c7dd0[_0xa750('0x30')]=_['keys'](_0x13528a[_0xa750('0x30')]);_0x2c7dd0[_0xa750('0x2e')]=_[_0xa750('0x2f')](_0x2c7dd0[_0xa750('0x2c')],_0x2c7dd0[_0xa750('0x30')]);_0xaa63be['attributes']=_[_0xa750('0x2f')](_0x2c7dd0[_0xa750('0x2c')],qs[_0xa750('0x31')](_0x13528a[_0xa750('0x30')][_0xa750('0x31')]));_0xaa63be[_0xa750('0x32')]=_0xaa63be[_0xa750('0x32')][_0xa750('0x4f')]?_0xaa63be[_0xa750('0x32')]:_0x2c7dd0[_0xa750('0x2c')];if(!_0x13528a[_0xa750('0x30')][_0xa750('0x33')](_0xa750('0x34'))){_0xaa63be[_0xa750('0x35')]=qs[_0xa750('0x35')](_0x13528a[_0xa750('0x30')]['limit']);_0xaa63be[_0xa750('0x17')]=qs['offset'](_0x13528a[_0xa750('0x30')][_0xa750('0x17')]);}_0xaa63be[_0xa750('0x36')]=qs['sort'](_0x13528a[_0xa750('0x30')][_0xa750('0x37')]);_0xaa63be[_0xa750('0x38')]=qs[_0xa750('0x2e')](_[_0xa750('0x39')](_0x13528a[_0xa750('0x30')],_0x2c7dd0['filters']));if(_0x13528a[_0xa750('0x30')][_0xa750('0x3c')]){_0xaa63be['where']=_[_0xa750('0x3a')](_0xaa63be[_0xa750('0x38')],{'$or':_[_0xa750('0x27')](_0xaa63be[_0xa750('0x32')],function(_0x3255c7){var _0x1b7597={};_0x1b7597[_0x3255c7]={'$like':'%'+_0x13528a[_0xa750('0x30')][_0xa750('0x3c')]+'%'};return _0x1b7597;})});}_0xaa63be[_0xa750('0x38')]=_[_0xa750('0x3a')](_0xaa63be[_0xa750('0x38')],{'mailboxuser':_0x5a3cd5['mailbox']});_0xaa63be=_['merge']({},_0xaa63be,_0x13528a[_0xa750('0x3d')]);return db[_0xa750('0x4e')][_0xa750('0x50')](_0xaa63be)[_0xa750('0x1d')](respondWithFilteredResult(_0x599e7e,_0xaa63be));})['catch'](handleError(_0x599e7e,null));}; \ No newline at end of file +var _0x0102=['rawAttributes','fieldName','type','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','rows','catch','keys','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','getMessages','findOne','VoiceMailMessage','mailbox','findAndCountAll','rimraf','zip-dir','fast-json-patch','request-promise','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','end','status','json','offset','undefined','limit','count','set','apply','reject','save','get','Voicemails','destroy','then','sendStatus','stack','name','send','index','VoiceMail'];(function(_0xd8186c,_0xbde792){var _0x5448fb=function(_0x3f9ccd){while(--_0x3f9ccd){_0xd8186c['push'](_0xd8186c['shift']());}};_0x5448fb(++_0xbde792);}(_0x0102,0x186));var _0x2010=function(_0x5e720a,_0x4afb01){_0x5e720a=_0x5e720a-0x0;var _0xfb0232=_0x0102[_0x5e720a];return _0xfb0232;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2010('0x0'));var zipdir=require(_0x2010('0x1'));var jsonpatch=require(_0x2010('0x2'));var rp=require(_0x2010('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x2010('0x4'));var csv=require(_0x2010('0x5'));var ejs=require(_0x2010('0x6'));var fs=require('fs');var fs_extra=require(_0x2010('0x7'));var _=require('lodash');var squel=require(_0x2010('0x8'));var crypto=require('crypto');var jsforce=require(_0x2010('0x9'));var deskjs=require(_0x2010('0xa'));var toCsv=require('to-csv');var querystring=require(_0x2010('0xb'));var Papa=require(_0x2010('0xc'));var Redis=require(_0x2010('0xd'));var authService=require(_0x2010('0xe'));var qs=require(_0x2010('0xf'));var as=require(_0x2010('0x10'));var hardwareService=require(_0x2010('0x11'));var logger=require(_0x2010('0x12'))(_0x2010('0x13'));var utils=require(_0x2010('0x14'));var config=require(_0x2010('0x15'));var licenseUtil=require(_0x2010('0x16'));var db=require(_0x2010('0x17'))['db'];function respondWithStatusCode(_0x3f307c,_0x3e8624){_0x3e8624=_0x3e8624||0xcc;return function(_0x388991){if(_0x388991){return _0x3f307c['sendStatus'](_0x3e8624);}return _0x3f307c['status'](_0x3e8624)[_0x2010('0x18')]();};}function respondWithResult(_0x385720,_0x2e8ec2){_0x2e8ec2=_0x2e8ec2||0xc8;return function(_0x10b587){if(_0x10b587){return _0x385720[_0x2010('0x19')](_0x2e8ec2)[_0x2010('0x1a')](_0x10b587);}};}function respondWithFilteredResult(_0x517ff4,_0x3195fa){return function(_0x136418){if(_0x136418){var _0x5ad412=typeof _0x3195fa[_0x2010('0x1b')]===_0x2010('0x1c')&&typeof _0x3195fa[_0x2010('0x1d')]===_0x2010('0x1c');var _0x2d0bf2=_0x136418[_0x2010('0x1e')];var _0x83cd35=_0x5ad412?0x0:_0x3195fa[_0x2010('0x1b')];var _0x309477=_0x5ad412?_0x136418['count']:_0x3195fa['offset']+_0x3195fa[_0x2010('0x1d')];var _0x38a15a;if(_0x309477>=_0x2d0bf2){_0x309477=_0x2d0bf2;_0x38a15a=0xc8;}else{_0x38a15a=0xce;}_0x517ff4[_0x2010('0x19')](_0x38a15a);return _0x517ff4[_0x2010('0x1f')]('Content-Range',_0x83cd35+'-'+_0x309477+'/'+_0x2d0bf2)['json'](_0x136418);}return null;};}function patchUpdates(_0x22c252){return function(_0x171e45){try{jsonpatch[_0x2010('0x20')](_0x171e45,_0x22c252,!![]);}catch(_0x26facc){return BPromise[_0x2010('0x21')](_0x26facc);}return _0x171e45[_0x2010('0x22')]();};}function saveUpdates(_0x4f621c,_0x3db13d){return function(_0x1cfa57){if(_0x1cfa57){return _0x1cfa57['update'](_0x4f621c)['then'](function(_0x50aecc){return _0x50aecc;});}return null;};}function removeEntity(_0x424453,_0x574719){return function(_0x277dcc){if(_0x277dcc){return _0x277dcc['destroy']()['then'](function(){var _0xdb57be=_0x277dcc[_0x2010('0x23')]({'plain':!![]});var _0x52b4fe=_0x2010('0x24');return db['UserProfileResource'][_0x2010('0x25')]({'where':{'type':_0x52b4fe,'resourceId':_0xdb57be['id']}})[_0x2010('0x26')](function(){return _0x277dcc;});})[_0x2010('0x26')](function(){_0x424453[_0x2010('0x19')](0xcc)[_0x2010('0x18')]();});}};}function handleEntityNotFound(_0x2f63bb,_0x981b65){return function(_0x3eb4dc){if(!_0x3eb4dc){_0x2f63bb[_0x2010('0x27')](0x194);}return _0x3eb4dc;};}function handleError(_0x103460,_0x122ee3){_0x122ee3=_0x122ee3||0x1f4;return function(_0x2ebdbb){logger['error'](_0x2ebdbb[_0x2010('0x28')]);if(_0x2ebdbb['name']){delete _0x2ebdbb[_0x2010('0x29')];}_0x103460[_0x2010('0x19')](_0x122ee3)[_0x2010('0x2a')](_0x2ebdbb);};}exports[_0x2010('0x2b')]=function(_0x564a64,_0x554f66){var _0x136d5f={},_0x48d9f2={},_0x2839f2={'count':0x0,'rows':[]};var _0x1d5d7a=_['map'](db[_0x2010('0x2c')][_0x2010('0x2d')],function(_0x2b1ff7){return{'name':_0x2b1ff7[_0x2010('0x2e')],'type':_0x2b1ff7[_0x2010('0x2f')]['key']};});_0x48d9f2[_0x2010('0x30')]=_[_0x2010('0x31')](_0x1d5d7a,_0x2010('0x29'));_0x48d9f2['query']=_['keys'](_0x564a64[_0x2010('0x32')]);_0x48d9f2[_0x2010('0x33')]=_[_0x2010('0x34')](_0x48d9f2['model'],_0x48d9f2['query']);_0x136d5f[_0x2010('0x35')]=_[_0x2010('0x34')](_0x48d9f2[_0x2010('0x30')],qs[_0x2010('0x36')](_0x564a64[_0x2010('0x32')]['fields']));_0x136d5f['attributes']=_0x136d5f['attributes'][_0x2010('0x37')]?_0x136d5f[_0x2010('0x35')]:_0x48d9f2[_0x2010('0x30')];if(!_0x564a64['query'][_0x2010('0x38')](_0x2010('0x39'))){_0x136d5f[_0x2010('0x1d')]=qs[_0x2010('0x1d')](_0x564a64['query'][_0x2010('0x1d')]);_0x136d5f[_0x2010('0x1b')]=qs[_0x2010('0x1b')](_0x564a64['query'][_0x2010('0x1b')]);}_0x136d5f['order']=qs[_0x2010('0x3a')](_0x564a64[_0x2010('0x32')][_0x2010('0x3a')]);_0x136d5f[_0x2010('0x3b')]=qs[_0x2010('0x33')](_[_0x2010('0x3c')](_0x564a64['query'],_0x48d9f2[_0x2010('0x33')]),_0x1d5d7a);if(_0x564a64['query'][_0x2010('0x3d')]){_0x136d5f[_0x2010('0x3b')]=_[_0x2010('0x3e')](_0x136d5f[_0x2010('0x3b')],{'$or':_[_0x2010('0x31')](_0x1d5d7a,function(_0x1f053c){if(_0x1f053c[_0x2010('0x2f')]!==_0x2010('0x3f')){var _0x2fcaef={};_0x2fcaef[_0x1f053c[_0x2010('0x29')]]={'$like':'%'+_0x564a64[_0x2010('0x32')][_0x2010('0x3d')]+'%'};return _0x2fcaef;}})});}_0x136d5f=_[_0x2010('0x3e')]({},_0x136d5f,_0x564a64[_0x2010('0x40')]);var _0x4b6251={'where':_0x136d5f['where']};return db[_0x2010('0x2c')][_0x2010('0x1e')](_0x4b6251)[_0x2010('0x26')](function(_0x35d631){_0x2839f2[_0x2010('0x1e')]=_0x35d631;if(_0x564a64[_0x2010('0x32')][_0x2010('0x41')]){_0x136d5f['include']=[{'all':!![]}];}return db[_0x2010('0x2c')]['findAll'](_0x136d5f);})[_0x2010('0x26')](function(_0x3ff496){_0x2839f2[_0x2010('0x42')]=_0x3ff496;return _0x2839f2;})[_0x2010('0x26')](respondWithFilteredResult(_0x554f66,_0x136d5f))[_0x2010('0x43')](handleError(_0x554f66,null));};exports['show']=function(_0x364338,_0x71eb35){var _0x3dd83c={'raw':!![],'where':{'id':_0x364338['params']['id']}},_0x41b3b5={};_0x41b3b5[_0x2010('0x30')]=_['keys'](db['VoiceMail']['rawAttributes']);_0x41b3b5[_0x2010('0x32')]=_[_0x2010('0x44')](_0x364338[_0x2010('0x32')]);_0x41b3b5[_0x2010('0x33')]=_[_0x2010('0x34')](_0x41b3b5[_0x2010('0x30')],_0x41b3b5['query']);_0x3dd83c[_0x2010('0x35')]=_[_0x2010('0x34')](_0x41b3b5[_0x2010('0x30')],qs['fields'](_0x364338['query'][_0x2010('0x36')]));_0x3dd83c['attributes']=_0x3dd83c[_0x2010('0x35')][_0x2010('0x37')]?_0x3dd83c[_0x2010('0x35')]:_0x41b3b5[_0x2010('0x30')];if(_0x364338['query'][_0x2010('0x41')]){_0x3dd83c[_0x2010('0x45')]=[{'all':!![]}];}_0x3dd83c=_[_0x2010('0x3e')]({},_0x3dd83c,_0x364338[_0x2010('0x40')]);return db[_0x2010('0x2c')][_0x2010('0x46')](_0x3dd83c)['then'](handleEntityNotFound(_0x71eb35,null))[_0x2010('0x26')](respondWithResult(_0x71eb35,null))[_0x2010('0x43')](handleError(_0x71eb35,null));};exports[_0x2010('0x47')]=function(_0x4dc0cf,_0x30e5d0){return db[_0x2010('0x2c')]['create'](_0x4dc0cf[_0x2010('0x48')],{})[_0x2010('0x26')](function(_0x110791){var _0x242274=_0x4dc0cf[_0x2010('0x49')][_0x2010('0x23')]({'plain':!![]});if(!_0x242274)throw new Error(_0x2010('0x4a'));if(_0x242274[_0x2010('0x4b')]==='user'){var _0x5258b9=_0x110791[_0x2010('0x23')]({'plain':!![]});var _0xe1721f='Voicemails';return db[_0x2010('0x4c')][_0x2010('0x46')]({'where':{'name':_0xe1721f,'userProfileId':_0x242274[_0x2010('0x4d')]},'raw':!![]})[_0x2010('0x26')](function(_0x1f1a59){if(_0x1f1a59&&_0x1f1a59['autoAssociation']===0x0){return db['UserProfileResource'][_0x2010('0x47')]({'name':_0x5258b9[_0x2010('0x29')],'resourceId':_0x5258b9['id'],'type':_0x1f1a59[_0x2010('0x29')],'sectionId':_0x1f1a59['id']},{})[_0x2010('0x26')](function(){return _0x110791;});}else{return _0x110791;}})[_0x2010('0x43')](function(_0x2d8164){logger[_0x2010('0x4e')](_0x2010('0x4f'),_0x2d8164);throw _0x2d8164;});}return _0x110791;})[_0x2010('0x26')](respondWithResult(_0x30e5d0,0xc9))[_0x2010('0x43')](handleError(_0x30e5d0,null));};exports[_0x2010('0x50')]=function(_0x5313b5,_0x24421a){if(_0x5313b5[_0x2010('0x48')]['id']){delete _0x5313b5['body']['id'];}return db[_0x2010('0x2c')][_0x2010('0x46')]({'where':{'id':_0x5313b5[_0x2010('0x51')]['id']}})[_0x2010('0x26')](handleEntityNotFound(_0x24421a,null))[_0x2010('0x26')](saveUpdates(_0x5313b5[_0x2010('0x48')],null))[_0x2010('0x26')](respondWithResult(_0x24421a,null))[_0x2010('0x43')](handleError(_0x24421a,null));};exports[_0x2010('0x25')]=function(_0x2dbc2c,_0x1c0b2d){return db[_0x2010('0x2c')][_0x2010('0x46')]({'where':{'id':_0x2dbc2c[_0x2010('0x51')]['id']}})[_0x2010('0x26')](handleEntityNotFound(_0x1c0b2d,null))[_0x2010('0x26')](removeEntity(_0x1c0b2d,null))[_0x2010('0x43')](handleError(_0x1c0b2d,null));};exports[_0x2010('0x52')]=function(_0x2d7765,_0x6f8565,_0x21ee87){return db[_0x2010('0x2c')][_0x2010('0x53')]({'where':{'id':_0x2d7765['params']['id']}})[_0x2010('0x26')](handleEntityNotFound(_0x6f8565,null))['then'](function(_0x5253d5){var _0x1225d7;var _0x13f33d={},_0x4fb5d5={};_0x4fb5d5[_0x2010('0x30')]=_[_0x2010('0x44')](db[_0x2010('0x54')][_0x2010('0x2d')]);_0x4fb5d5['query']=_[_0x2010('0x44')](_0x2d7765[_0x2010('0x32')]);_0x4fb5d5[_0x2010('0x33')]=_[_0x2010('0x34')](_0x4fb5d5['model'],_0x4fb5d5[_0x2010('0x32')]);_0x13f33d['attributes']=_[_0x2010('0x34')](_0x4fb5d5[_0x2010('0x30')],qs[_0x2010('0x36')](_0x2d7765[_0x2010('0x32')]['fields']));_0x13f33d['attributes']=_0x13f33d[_0x2010('0x35')][_0x2010('0x37')]?_0x13f33d['attributes']:_0x4fb5d5['model'];if(!_0x2d7765[_0x2010('0x32')][_0x2010('0x38')](_0x2010('0x39'))){_0x13f33d[_0x2010('0x1d')]=qs['limit'](_0x2d7765[_0x2010('0x32')]['limit']);_0x13f33d[_0x2010('0x1b')]=qs[_0x2010('0x1b')](_0x2d7765[_0x2010('0x32')][_0x2010('0x1b')]);}_0x13f33d['order']=qs[_0x2010('0x3a')](_0x2d7765[_0x2010('0x32')]['sort']);_0x13f33d[_0x2010('0x3b')]=qs[_0x2010('0x33')](_[_0x2010('0x3c')](_0x2d7765[_0x2010('0x32')],_0x4fb5d5[_0x2010('0x33')]));if(_0x2d7765[_0x2010('0x32')][_0x2010('0x3d')]){_0x13f33d[_0x2010('0x3b')]=_[_0x2010('0x3e')](_0x13f33d[_0x2010('0x3b')],{'$or':_[_0x2010('0x31')](_0x13f33d[_0x2010('0x35')],function(_0x4ebdca){var _0x3ca7b3={};_0x3ca7b3[_0x4ebdca]={'$like':'%'+_0x2d7765[_0x2010('0x32')][_0x2010('0x3d')]+'%'};return _0x3ca7b3;})});}_0x13f33d['where']=_['merge'](_0x13f33d[_0x2010('0x3b')],{'mailboxuser':_0x5253d5[_0x2010('0x55')]});_0x13f33d=_[_0x2010('0x3e')]({},_0x13f33d,_0x2d7765[_0x2010('0x40')]);return db[_0x2010('0x54')][_0x2010('0x56')](_0x13f33d)['then'](respondWithFilteredResult(_0x6f8565,_0x13f33d));})[_0x2010('0x43')](handleError(_0x6f8565,null));}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.model.js b/server/api/voiceMail/voiceMail.model.js index 48f8bc7..0509015 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 _0x93ec=['api','moment','bluebird','request-promise','path','rimraf','./voiceMail.attributes','exports','define','mailbox_context','mailbox','context','lodash','util'];(function(_0x56e4e7,_0x1db098){var _0x383618=function(_0xb088c6){while(--_0xb088c6){_0x56e4e7['push'](_0x56e4e7['shift']());}};_0x383618(++_0x1db098);}(_0x93ec,0x116));var _0xc93e=function(_0x59ae80,_0x56b205){_0x59ae80=_0x59ae80-0x0;var _0x473bf9=_0x93ec[_0x59ae80];return _0x473bf9;};'use strict';var _=require(_0xc93e('0x0'));var util=require(_0xc93e('0x1'));var logger=require('../../config/logger')(_0xc93e('0x2'));var moment=require(_0xc93e('0x3'));var BPromise=require(_0xc93e('0x4'));var rp=require(_0xc93e('0x5'));var fs=require('fs');var path=require(_0xc93e('0x6'));var rimraf=require(_0xc93e('0x7'));var config=require('../../config/environment');var attributes=require(_0xc93e('0x8'));module[_0xc93e('0x9')]=function(_0x4a8bc6,_0x193780){return _0x4a8bc6[_0xc93e('0xa')]('VoiceMail',attributes,{'tableName':'voice_voicemail','paranoid':![],'indexes':[{'name':_0xc93e('0xb'),'fields':[_0xc93e('0xc'),_0xc93e('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xd9b5=['exports','VoiceMail','voice_voicemail','mailbox_context','mailbox','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','./voiceMail.attributes'];(function(_0x3132e8,_0x499a0e){var _0x43eb8c=function(_0x2321e1){while(--_0x2321e1){_0x3132e8['push'](_0x3132e8['shift']());}};_0x43eb8c(++_0x499a0e);}(_0xd9b5,0x91));var _0x5d9b=function(_0x34e07a,_0x459810){_0x34e07a=_0x34e07a-0x0;var _0x2816d0=_0xd9b5[_0x34e07a];return _0x2816d0;};'use strict';var _=require(_0x5d9b('0x0'));var util=require(_0x5d9b('0x1'));var logger=require(_0x5d9b('0x2'))(_0x5d9b('0x3'));var moment=require(_0x5d9b('0x4'));var BPromise=require('bluebird');var rp=require(_0x5d9b('0x5'));var fs=require('fs');var path=require(_0x5d9b('0x6'));var rimraf=require(_0x5d9b('0x7'));var config=require('../../config/environment');var attributes=require(_0x5d9b('0x8'));module[_0x5d9b('0x9')]=function(_0xea99ed,_0x1d4bb0){return _0xea99ed['define'](_0x5d9b('0xa'),attributes,{'tableName':_0x5d9b('0xb'),'paranoid':![],'indexes':[{'name':_0x5d9b('0xc'),'fields':[_0x5d9b('0xd'),'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 4cc7b96..5fc21ae 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 _0xca83=['info','request\x20sent','VoiceMail,\x20%s,\x20%s,\x20%s','stringify','code','error','message','VoiceMail,\x20%s,\x20%s','result','lodash','util','moment','randomstring','../../config/logger','../../config/environment','jayson/promise','client','http','request'];(function(_0x421276,_0x118c8d){var _0x1d85cc=function(_0x5eb20c){while(--_0x5eb20c){_0x421276['push'](_0x421276['shift']());}};_0x1d85cc(++_0x118c8d);}(_0xca83,0xda));var _0x3ca8=function(_0xa148b7,_0x2f3eb2){_0xa148b7=_0xa148b7-0x0;var _0x51efd3=_0xca83[_0xa148b7];return _0x51efd3;};'use strict';var _=require(_0x3ca8('0x0'));var util=require(_0x3ca8('0x1'));var moment=require(_0x3ca8('0x2'));var BPromise=require('bluebird');var rs=require(_0x3ca8('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x3ca8('0x4'))('rpc');var config=require(_0x3ca8('0x5'));var jayson=require(_0x3ca8('0x6'));var client=jayson[_0x3ca8('0x7')][_0x3ca8('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4e20cd,_0x29564d,_0x33fb89){return new BPromise(function(_0x472661,_0xbbbcd2){return client[_0x3ca8('0x9')](_0x4e20cd,_0x33fb89)['then'](function(_0x2de28c){logger[_0x3ca8('0xa')]('VoiceMail,\x20%s,\x20%s',_0x29564d,_0x3ca8('0xb'));logger['debug'](_0x3ca8('0xc'),_0x29564d,_0x3ca8('0xb'),JSON[_0x3ca8('0xd')](_0x2de28c));if(_0x2de28c['error']){if(_0x2de28c['error'][_0x3ca8('0xe')]===0x1f4){logger[_0x3ca8('0xf')]('VoiceMail,\x20%s,\x20%s',_0x29564d,_0x2de28c[_0x3ca8('0xf')][_0x3ca8('0x10')]);return _0xbbbcd2(_0x2de28c['error'][_0x3ca8('0x10')]);}logger[_0x3ca8('0xf')](_0x3ca8('0x11'),_0x29564d,_0x2de28c[_0x3ca8('0xf')][_0x3ca8('0x10')]);return _0x472661(_0x2de28c['error']['message']);}else{logger[_0x3ca8('0xa')](_0x3ca8('0x11'),_0x29564d,_0x3ca8('0xb'));_0x472661(_0x2de28c[_0x3ca8('0x12')]['message']);}})['catch'](function(_0x4ae5dc){logger[_0x3ca8('0xf')]('VoiceMail,\x20%s,\x20%s',_0x29564d,_0x4ae5dc);_0xbbbcd2(_0x4ae5dc);});});} \ No newline at end of file +var _0x9197=['message','VoiceMail,\x20%s,\x20%s','result','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','request\x20sent','debug','VoiceMail,\x20%s,\x20%s,\x20%s','error'];(function(_0x37eae7,_0x5d27bb){var _0x51b227=function(_0x23a90a){while(--_0x23a90a){_0x37eae7['push'](_0x37eae7['shift']());}};_0x51b227(++_0x5d27bb);}(_0x9197,0x13e));var _0x7919=function(_0x2120a0,_0xd955dc){_0x2120a0=_0x2120a0-0x0;var _0x62cb6c=_0x9197[_0x2120a0];return _0x62cb6c;};'use strict';var _=require(_0x7919('0x0'));var util=require(_0x7919('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x7919('0x2'));var fs=require('fs');var Redis=require(_0x7919('0x3'));var db=require(_0x7919('0x4'))['db'];var utils=require(_0x7919('0x5'));var logger=require(_0x7919('0x6'))(_0x7919('0x7'));var config=require('../../config/environment');var jayson=require(_0x7919('0x8'));var client=jayson[_0x7919('0x9')][_0x7919('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x9631fb,_0x2650fc,_0x78647f){return new BPromise(function(_0x50382b,_0x538f36){return client[_0x7919('0xb')](_0x9631fb,_0x78647f)[_0x7919('0xc')](function(_0x5e9041){logger[_0x7919('0xd')]('VoiceMail,\x20%s,\x20%s',_0x2650fc,_0x7919('0xe'));logger[_0x7919('0xf')](_0x7919('0x10'),_0x2650fc,_0x7919('0xe'),JSON['stringify'](_0x5e9041));if(_0x5e9041[_0x7919('0x11')]){if(_0x5e9041[_0x7919('0x11')]['code']===0x1f4){logger[_0x7919('0x11')]('VoiceMail,\x20%s,\x20%s',_0x2650fc,_0x5e9041[_0x7919('0x11')][_0x7919('0x12')]);return _0x538f36(_0x5e9041['error'][_0x7919('0x12')]);}logger[_0x7919('0x11')](_0x7919('0x13'),_0x2650fc,_0x5e9041[_0x7919('0x11')]['message']);return _0x50382b(_0x5e9041[_0x7919('0x11')]['message']);}else{logger['info'](_0x7919('0x13'),_0x2650fc,_0x7919('0xe'));_0x50382b(_0x5e9041[_0x7919('0x14')][_0x7919('0x12')]);}})['catch'](function(_0x2d5b2e){logger[_0x7919('0x11')](_0x7919('0x13'),_0x2650fc,_0x2d5b2e);_0x538f36(_0x2d5b2e);});});} \ No newline at end of file diff --git a/server/api/voiceMailMessage/index.js b/server/api/voiceMailMessage/index.js index 692d6a2..2ef1c7f 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 _0x197f=['multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','/:id/download','download','create','update','delete','exports'];(function(_0x211632,_0x378e2e){var _0x5a1da1=function(_0x44aff2){while(--_0x44aff2){_0x211632['push'](_0x211632['shift']());}};_0x5a1da1(++_0x378e2e);}(_0x197f,0xc8));var _0xf197=function(_0x3aad20,_0x149745){_0x3aad20=_0x3aad20-0x0;var _0x4fb8a8=_0x197f[_0x3aad20];return _0x4fb8a8;};'use strict';var multer=require(_0xf197('0x0'));var util=require(_0xf197('0x1'));var path=require(_0xf197('0x2'));var timeout=require(_0xf197('0x3'));var express=require(_0xf197('0x4'));var router=express[_0xf197('0x5')]();var fs_extra=require(_0xf197('0x6'));var auth=require(_0xf197('0x7'));var interaction=require(_0xf197('0x8'));var config=require(_0xf197('0x9'));var controller=require('./voiceMailMessage.controller');router[_0xf197('0xa')]('/',auth[_0xf197('0xb')](),controller['index']);router[_0xf197('0xa')](_0xf197('0xc'),auth[_0xf197('0xb')](),controller[_0xf197('0xd')]);router[_0xf197('0xa')](_0xf197('0xe'),auth[_0xf197('0xb')](),controller[_0xf197('0xf')]);router['post']('/',auth['isAuthenticated'](),controller[_0xf197('0x10')]);router['put']('/:id',auth[_0xf197('0xb')](),controller[_0xf197('0x11')]);router[_0xf197('0x12')](_0xf197('0xc'),auth['isAuthenticated'](),controller['destroy']);module[_0xf197('0x13')]=router; \ No newline at end of file +var _0x4d3c=['update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/:id','show','/:id/download','download','post','create','put'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4d3c,0x14e));var _0xc4d3=function(_0x526eb9,_0xa3bf6c){_0x526eb9=_0x526eb9-0x0;var _0xe2c0f1=_0x4d3c[_0x526eb9];return _0xe2c0f1;};'use strict';var multer=require(_0xc4d3('0x0'));var util=require(_0xc4d3('0x1'));var path=require(_0xc4d3('0x2'));var timeout=require(_0xc4d3('0x3'));var express=require('express');var router=express[_0xc4d3('0x4')]();var fs_extra=require(_0xc4d3('0x5'));var auth=require(_0xc4d3('0x6'));var interaction=require(_0xc4d3('0x7'));var config=require('../../config/environment');var controller=require('./voiceMailMessage.controller');router[_0xc4d3('0x8')]('/',auth[_0xc4d3('0x9')](),controller[_0xc4d3('0xa')]);router[_0xc4d3('0x8')](_0xc4d3('0xb'),auth['isAuthenticated'](),controller[_0xc4d3('0xc')]);router[_0xc4d3('0x8')](_0xc4d3('0xd'),auth[_0xc4d3('0x9')](),controller[_0xc4d3('0xe')]);router[_0xc4d3('0xf')]('/',auth['isAuthenticated'](),controller[_0xc4d3('0x10')]);router[_0xc4d3('0x11')]('/:id',auth[_0xc4d3('0x9')](),controller[_0xc4d3('0x12')]);router[_0xc4d3('0x13')]('/:id',auth[_0xc4d3('0x9')](),controller[_0xc4d3('0x14')]);module[_0xc4d3('0x15')]=router; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.attributes.js b/server/api/voiceMailMessage/voiceMailMessage.attributes.js index 903bfb6..7d958db 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 _0x33eb=['STRING','literal','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','sequelize','exports','VIRTUAL','getDataValue','INTEGER'];(function(_0x1d66df,_0x3b12a5){var _0x2d5f25=function(_0x58e8f2){while(--_0x58e8f2){_0x1d66df['push'](_0x1d66df['shift']());}};_0x2d5f25(++_0x3b12a5);}(_0x33eb,0x8b));var _0xb33e=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x33eb[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0xb33e('0x0'));module[_0xb33e('0x1')]={'name':{'type':Sequelize[_0xb33e('0x2')],'get':function(_0x5e016b){return this[_0xb33e('0x3')]('id');}},'msgnum':{'type':Sequelize[_0xb33e('0x4')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0xb33e('0x5')],'defaultValue':''},'context':{'type':Sequelize[_0xb33e('0x5')],'defaultValue':''},'macrocontext':{'type':Sequelize['STRING'],'defaultValue':''},'callerid':{'type':Sequelize[_0xb33e('0x5')],'defaultValue':''},'origtime':{'type':Sequelize[_0xb33e('0x5')],'defaultValue':''},'duration':{'type':Sequelize[_0xb33e('0x5')],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0xb33e('0x5')],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0xb33e('0x5')],'defaultValue':''},'recording':{'type':Sequelize['BLOB']('long'),'defaultValue':null},'flag':{'type':Sequelize['STRING'],'defaultValue':''},'msg_id':{'type':Sequelize['STRING'],'defaultValue':''},'stamp':{'type':'TIMESTAMP','defaultValue':Sequelize[_0xb33e('0x6')](_0xb33e('0x7'))}}; \ No newline at end of file +var _0x2868=['BLOB','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','sequelize','VIRTUAL','getDataValue','INTEGER','STRING'];(function(_0x342baa,_0x4a110f){var _0x1208f3=function(_0x56a645){while(--_0x56a645){_0x342baa['push'](_0x342baa['shift']());}};_0x1208f3(++_0x4a110f);}(_0x2868,0x80));var _0x8286=function(_0x208d99,_0x4701d1){_0x208d99=_0x208d99-0x0;var _0x579e56=_0x2868[_0x208d99];return _0x579e56;};'use strict';var Sequelize=require(_0x8286('0x0'));module['exports']={'name':{'type':Sequelize[_0x8286('0x1')],'get':function(_0xfd026a){return this[_0x8286('0x2')]('id');}},'msgnum':{'type':Sequelize[_0x8286('0x3')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0x8286('0x4')],'defaultValue':''},'context':{'type':Sequelize[_0x8286('0x4')],'defaultValue':''},'macrocontext':{'type':Sequelize[_0x8286('0x4')],'defaultValue':''},'callerid':{'type':Sequelize[_0x8286('0x4')],'defaultValue':''},'origtime':{'type':Sequelize[_0x8286('0x4')],'defaultValue':''},'duration':{'type':Sequelize[_0x8286('0x4')],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0x8286('0x4')],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0x8286('0x4')],'defaultValue':''},'recording':{'type':Sequelize[_0x8286('0x5')]('long'),'defaultValue':null},'flag':{'type':Sequelize['STRING'],'defaultValue':''},'msg_id':{'type':Sequelize[_0x8286('0x4')],'defaultValue':''},'stamp':{'type':'TIMESTAMP','defaultValue':Sequelize['literal'](_0x8286('0x6'))}}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.controller.js b/server/api/voiceMailMessage/voiceMailMessage.controller.js index f2a2972..44e8826 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 _0x0924=['../../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','rawAttributes','type','model','differenceBy','keys','query','filters','attributes','intersection','hasOwnProperty','sort','pick','filter','where','merge','map','VIRTUAL','includeAll','findAll','rows','catch','params','VoiceMailMessage','fields','length','include','options','find','create','body','download','recording','msg_id','Sequelize','ValidationError','VoiceMailMessage\x20not\x20found','audio/wav','attachment','Content-Disposition','attachment;\x20filename=\x22','fast-json-patch','request-promise','bluebird','mustache','path','sox','fs-extra','lodash','squel','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api'];(function(_0x3aa1d5,_0x470cc2){var _0x931515=function(_0x2d0a02){while(--_0x2d0a02){_0x3aa1d5['push'](_0x3aa1d5['shift']());}};_0x931515(++_0x470cc2);}(_0x0924,0x135));var _0x4092=function(_0x745e14,_0x262a08){_0x745e14=_0x745e14-0x0;var _0x55b28d=_0x0924[_0x745e14];return _0x55b28d;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x4092('0x0'));var rp=require(_0x4092('0x1'));var moment=require('moment');var BPromise=require(_0x4092('0x2'));var Mustache=require(_0x4092('0x3'));var util=require('util');var path=require(_0x4092('0x4'));var sox=require(_0x4092('0x5'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4092('0x6'));var _=require(_0x4092('0x7'));var squel=require(_0x4092('0x8'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x4092('0x9'));var toCsv=require(_0x4092('0xa'));var querystring=require(_0x4092('0xb'));var Papa=require(_0x4092('0xc'));var Redis=require(_0x4092('0xd'));var authService=require(_0x4092('0xe'));var qs=require(_0x4092('0xf'));var as=require(_0x4092('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x4092('0x11'))(_0x4092('0x12'));var utils=require(_0x4092('0x13'));var config=require(_0x4092('0x14'));var licenseUtil=require(_0x4092('0x15'));var db=require(_0x4092('0x16'))['db'];function respondWithStatusCode(_0xd98c55,_0x4a648c){_0x4a648c=_0x4a648c||0xcc;return function(_0x14e87f){if(_0x14e87f){return _0xd98c55[_0x4092('0x17')](_0x4a648c);}return _0xd98c55[_0x4092('0x18')](_0x4a648c)[_0x4092('0x19')]();};}function respondWithResult(_0x2905a4,_0x37aa0a){_0x37aa0a=_0x37aa0a||0xc8;return function(_0x2ae071){if(_0x2ae071){return _0x2905a4[_0x4092('0x18')](_0x37aa0a)[_0x4092('0x1a')](_0x2ae071);}};}function respondWithFilteredResult(_0xc422ac,_0x20eb78){return function(_0x56c448){if(_0x56c448){var _0x97b92c=typeof _0x20eb78[_0x4092('0x1b')]===_0x4092('0x1c')&&typeof _0x20eb78[_0x4092('0x1d')]==='undefined';var _0x8f3254=_0x56c448[_0x4092('0x1e')];var _0x97c4d6=_0x97b92c?0x0:_0x20eb78[_0x4092('0x1b')];var _0x24d3c9=_0x97b92c?_0x56c448['count']:_0x20eb78['offset']+_0x20eb78[_0x4092('0x1d')];var _0x2c4262;if(_0x24d3c9>=_0x8f3254){_0x24d3c9=_0x8f3254;_0x2c4262=0xc8;}else{_0x2c4262=0xce;}_0xc422ac[_0x4092('0x18')](_0x2c4262);return _0xc422ac['set'](_0x4092('0x1f'),_0x97c4d6+'-'+_0x24d3c9+'/'+_0x8f3254)[_0x4092('0x1a')](_0x56c448);}return null;};}function patchUpdates(_0x1834eb){return function(_0x1219fb){try{jsonpatch[_0x4092('0x20')](_0x1219fb,_0x1834eb,!![]);}catch(_0xdcb829){return BPromise[_0x4092('0x21')](_0xdcb829);}return _0x1219fb[_0x4092('0x22')]();};}function saveUpdates(_0x28142b,_0x10083b){return function(_0x4ac84f){if(_0x4ac84f){return _0x4ac84f[_0x4092('0x23')](_0x28142b)[_0x4092('0x24')](function(_0x28c18a){return _0x28c18a;});}return null;};}function removeEntity(_0x28c251,_0x4e0795){return function(_0x1360d3){if(_0x1360d3){return _0x1360d3[_0x4092('0x25')]()[_0x4092('0x24')](function(){_0x28c251[_0x4092('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x346cab,_0xfeadb8){return function(_0x249ebc){if(!_0x249ebc){_0x346cab[_0x4092('0x17')](0x194);}return _0x249ebc;};}function handleError(_0x306d6e,_0x28550a){_0x28550a=_0x28550a||0x1f4;return function(_0x50d6bb){logger[_0x4092('0x26')](_0x50d6bb['stack']);if(_0x50d6bb[_0x4092('0x27')]){delete _0x50d6bb[_0x4092('0x27')];}_0x306d6e['status'](_0x28550a)[_0x4092('0x28')](_0x50d6bb);};}exports[_0x4092('0x29')]=function(_0xbe7001,_0xe069e3){var _0x6c5fda={},_0x35c38b={},_0x604d21={'count':0x0,'rows':[]};var _0x48cb0e=_['map'](db['VoiceMailMessage'][_0x4092('0x2a')],function(_0x5e213d){return{'name':_0x5e213d['fieldName'],'type':_0x5e213d[_0x4092('0x2b')]['key']};});_0x35c38b[_0x4092('0x2c')]=_[_0x4092('0x2d')](_['map'](_0x48cb0e,_0x4092('0x27')),[_0x4092('0x27')]);_0x35c38b['query']=_[_0x4092('0x2e')](_0xbe7001[_0x4092('0x2f')]);_0x35c38b[_0x4092('0x30')]=_['intersection'](_0x35c38b['model'],_0x35c38b[_0x4092('0x2f')]);_0x6c5fda[_0x4092('0x31')]=_[_0x4092('0x32')](_0x35c38b['model'],qs['fields'](_0xbe7001['query']['fields']));_0x6c5fda[_0x4092('0x31')]=_0x6c5fda[_0x4092('0x31')]['length']?_0x6c5fda[_0x4092('0x31')]:_0x35c38b[_0x4092('0x2c')];if(!_0xbe7001[_0x4092('0x2f')][_0x4092('0x33')]('nolimit')){_0x6c5fda[_0x4092('0x1d')]=qs[_0x4092('0x1d')](_0xbe7001['query'][_0x4092('0x1d')]);_0x6c5fda['offset']=qs['offset'](_0xbe7001[_0x4092('0x2f')][_0x4092('0x1b')]);}_0x6c5fda['order']=qs[_0x4092('0x34')](_0xbe7001[_0x4092('0x2f')]['sort']);_0x6c5fda['where']=qs[_0x4092('0x30')](_[_0x4092('0x35')](_0xbe7001[_0x4092('0x2f')],_0x35c38b[_0x4092('0x30')]),_0x48cb0e);if(_0xbe7001['query'][_0x4092('0x36')]){_0x6c5fda[_0x4092('0x37')]=_[_0x4092('0x38')](_0x6c5fda[_0x4092('0x37')],{'$or':_[_0x4092('0x39')](_0x48cb0e,function(_0x41b4cd){if(_0x41b4cd[_0x4092('0x2b')]!==_0x4092('0x3a')){var _0x4a0d82={};_0x4a0d82[_0x41b4cd[_0x4092('0x27')]]={'$like':'%'+_0xbe7001[_0x4092('0x2f')][_0x4092('0x36')]+'%'};return _0x4a0d82;}})});}_0x6c5fda=_['merge']({},_0x6c5fda,_0xbe7001['options']);var _0x289549={'where':_0x6c5fda['where']};return db['VoiceMailMessage'][_0x4092('0x1e')](_0x289549)['then'](function(_0x2c8322){_0x604d21[_0x4092('0x1e')]=_0x2c8322;if(_0xbe7001[_0x4092('0x2f')][_0x4092('0x3b')]){_0x6c5fda['include']=[{'all':!![]}];}return db['VoiceMailMessage'][_0x4092('0x3c')](_0x6c5fda);})['then'](function(_0x488b1b){_0x604d21[_0x4092('0x3d')]=_0x488b1b;return _0x604d21;})[_0x4092('0x24')](respondWithFilteredResult(_0xe069e3,_0x6c5fda))[_0x4092('0x3e')](handleError(_0xe069e3,null));};exports['show']=function(_0x4462d4,_0x363a28){var _0x37d7a1={'raw':!![],'where':{'id':_0x4462d4[_0x4092('0x3f')]['id']}},_0x3f14d2={};_0x3f14d2[_0x4092('0x2c')]=_[_0x4092('0x2e')](db[_0x4092('0x40')][_0x4092('0x2a')]);_0x3f14d2['query']=_[_0x4092('0x2e')](_0x4462d4[_0x4092('0x2f')]);_0x3f14d2[_0x4092('0x30')]=_[_0x4092('0x32')](_0x3f14d2['model'],_0x3f14d2[_0x4092('0x2f')]);_0x37d7a1[_0x4092('0x31')]=_[_0x4092('0x32')](_0x3f14d2[_0x4092('0x2c')],qs[_0x4092('0x41')](_0x4462d4['query'][_0x4092('0x41')]));_0x37d7a1['attributes']=_0x37d7a1[_0x4092('0x31')][_0x4092('0x42')]?_0x37d7a1[_0x4092('0x31')]:_0x3f14d2[_0x4092('0x2c')];if(_0x4462d4[_0x4092('0x2f')][_0x4092('0x3b')]){_0x37d7a1[_0x4092('0x43')]=[{'all':!![]}];}_0x37d7a1=_[_0x4092('0x38')]({},_0x37d7a1,_0x4462d4[_0x4092('0x44')]);return db[_0x4092('0x40')][_0x4092('0x45')](_0x37d7a1)[_0x4092('0x24')](handleEntityNotFound(_0x363a28,null))['then'](respondWithResult(_0x363a28,null))[_0x4092('0x3e')](handleError(_0x363a28,null));};exports['create']=function(_0x13b7af,_0x2814b7){return db['VoiceMailMessage'][_0x4092('0x46')](_0x13b7af[_0x4092('0x47')],{})[_0x4092('0x24')](respondWithResult(_0x2814b7,0xc9))['catch'](handleError(_0x2814b7,null));};exports['update']=function(_0x4a5bb9,_0x28c34e){if(_0x4a5bb9[_0x4092('0x47')]['id']){delete _0x4a5bb9[_0x4092('0x47')]['id'];}return db[_0x4092('0x40')][_0x4092('0x45')]({'where':{'id':_0x4a5bb9['params']['id']}})['then'](handleEntityNotFound(_0x28c34e,null))[_0x4092('0x24')](saveUpdates(_0x4a5bb9[_0x4092('0x47')],null))[_0x4092('0x24')](respondWithResult(_0x28c34e,null))[_0x4092('0x3e')](handleError(_0x28c34e,null));};exports[_0x4092('0x25')]=function(_0x49fd1f,_0x3fbaa6){return db[_0x4092('0x40')][_0x4092('0x45')]({'where':{'id':_0x49fd1f[_0x4092('0x3f')]['id']}})[_0x4092('0x24')](handleEntityNotFound(_0x3fbaa6,null))[_0x4092('0x24')](removeEntity(_0x3fbaa6,null))[_0x4092('0x3e')](handleError(_0x3fbaa6,null));};exports[_0x4092('0x48')]=function(_0x23ddf8,_0x4fc607,_0xfc139d){return db[_0x4092('0x40')][_0x4092('0x45')]({'where':{'id':_0x23ddf8[_0x4092('0x3f')]['id']},'attributes':['id',_0x4092('0x49'),_0x4092('0x4a')]})[_0x4092('0x24')](handleEntityNotFound(_0x4fc607,null))[_0x4092('0x24')](function(_0x30a5b4){if(_0x30a5b4){if(!_0x30a5b4[_0x4092('0x49')]){throw new db[(_0x4092('0x4b'))][(_0x4092('0x4c'))](_0x4092('0x4d'));}var _0x4b23c1={'Content-Type':_0x4092('0x4e'),'Content-Disposition':_0x4092('0x4f')};if(_0x30a5b4[_0x4092('0x4a')]){_0x4b23c1[_0x4092('0x50')]=_0x4092('0x51')+_0x30a5b4[_0x4092('0x4a')]+'.wav\x22';}_0x4fc607['set'](_0x4b23c1);return _0x4fc607['send'](new Buffer(_0x30a5b4[_0x4092('0x49')]));}})[_0x4092('0x3e')](handleError(_0x4fc607,null));}; \ No newline at end of file +var _0x59c5=['end','stack','name','send','VoiceMailMessage','rawAttributes','fieldName','type','key','model','differenceBy','map','keys','query','filters','intersection','attributes','length','nolimit','order','sort','where','pick','filter','merge','options','include','findAll','catch','show','params','fields','create','body','update','find','download','recording','msg_id','Sequelize','VoiceMailMessage\x20not\x20found','audio/wav','attachment','Content-Disposition','attachment;\x20filename=\x22','.wav\x22','set','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','count','offset','limit','Content-Range','apply','reject','save','then','destroy'];(function(_0x13af42,_0x2bacc6){var _0x588344=function(_0x10595a){while(--_0x10595a){_0x13af42['push'](_0x13af42['shift']());}};_0x588344(++_0x2bacc6);}(_0x59c5,0x134));var _0x559c=function(_0x8485ba,_0x3c72d3){_0x8485ba=_0x8485ba-0x0;var _0x26dca3=_0x59c5[_0x8485ba];return _0x26dca3;};'use strict';var emlformat=require(_0x559c('0x0'));var rimraf=require(_0x559c('0x1'));var zipdir=require(_0x559c('0x2'));var jsonpatch=require(_0x559c('0x3'));var rp=require(_0x559c('0x4'));var moment=require(_0x559c('0x5'));var BPromise=require(_0x559c('0x6'));var Mustache=require(_0x559c('0x7'));var util=require('util');var path=require('path');var sox=require(_0x559c('0x8'));var csv=require('to-csv');var ejs=require(_0x559c('0x9'));var fs=require('fs');var fs_extra=require(_0x559c('0xa'));var _=require(_0x559c('0xb'));var squel=require('squel');var crypto=require(_0x559c('0xc'));var jsforce=require(_0x559c('0xd'));var deskjs=require(_0x559c('0xe'));var toCsv=require(_0x559c('0xf'));var querystring=require(_0x559c('0x10'));var Papa=require(_0x559c('0x11'));var Redis=require(_0x559c('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x559c('0x13'));var as=require(_0x559c('0x14'));var hardwareService=require(_0x559c('0x15'));var logger=require(_0x559c('0x16'))(_0x559c('0x17'));var utils=require('../../config/utils');var config=require(_0x559c('0x18'));var licenseUtil=require(_0x559c('0x19'));var db=require(_0x559c('0x1a'))['db'];function respondWithStatusCode(_0x92929f,_0x410cdb){_0x410cdb=_0x410cdb||0xcc;return function(_0x5c823){if(_0x5c823){return _0x92929f[_0x559c('0x1b')](_0x410cdb);}return _0x92929f[_0x559c('0x1c')](_0x410cdb)['end']();};}function respondWithResult(_0x26ca33,_0x4b8a34){_0x4b8a34=_0x4b8a34||0xc8;return function(_0xc58f65){if(_0xc58f65){return _0x26ca33['status'](_0x4b8a34)[_0x559c('0x1d')](_0xc58f65);}};}function respondWithFilteredResult(_0x16703b,_0xb9cc4e){return function(_0x483eb9){if(_0x483eb9){var _0x2bcc57=typeof _0xb9cc4e['offset']===_0x559c('0x1e')&&typeof _0xb9cc4e['limit']===_0x559c('0x1e');var _0x59875d=_0x483eb9[_0x559c('0x1f')];var _0x30dfae=_0x2bcc57?0x0:_0xb9cc4e[_0x559c('0x20')];var _0x5a8152=_0x2bcc57?_0x483eb9[_0x559c('0x1f')]:_0xb9cc4e['offset']+_0xb9cc4e[_0x559c('0x21')];var _0xfa049b;if(_0x5a8152>=_0x59875d){_0x5a8152=_0x59875d;_0xfa049b=0xc8;}else{_0xfa049b=0xce;}_0x16703b['status'](_0xfa049b);return _0x16703b['set'](_0x559c('0x22'),_0x30dfae+'-'+_0x5a8152+'/'+_0x59875d)[_0x559c('0x1d')](_0x483eb9);}return null;};}function patchUpdates(_0xeaf7a1){return function(_0x3bd904){try{jsonpatch[_0x559c('0x23')](_0x3bd904,_0xeaf7a1,!![]);}catch(_0x2e376d){return BPromise[_0x559c('0x24')](_0x2e376d);}return _0x3bd904[_0x559c('0x25')]();};}function saveUpdates(_0x11f8f1,_0xd6b5f2){return function(_0x1e33de){if(_0x1e33de){return _0x1e33de['update'](_0x11f8f1)[_0x559c('0x26')](function(_0x17c98f){return _0x17c98f;});}return null;};}function removeEntity(_0x11d54d,_0x4d703c){return function(_0x25edff){if(_0x25edff){return _0x25edff[_0x559c('0x27')]()[_0x559c('0x26')](function(){_0x11d54d[_0x559c('0x1c')](0xcc)[_0x559c('0x28')]();});}};}function handleEntityNotFound(_0x571443,_0xcf9b1d){return function(_0x595539){if(!_0x595539){_0x571443[_0x559c('0x1b')](0x194);}return _0x595539;};}function handleError(_0x434e7a,_0x58e48e){_0x58e48e=_0x58e48e||0x1f4;return function(_0x208430){logger['error'](_0x208430[_0x559c('0x29')]);if(_0x208430[_0x559c('0x2a')]){delete _0x208430[_0x559c('0x2a')];}_0x434e7a[_0x559c('0x1c')](_0x58e48e)[_0x559c('0x2b')](_0x208430);};}exports['index']=function(_0x22b0be,_0x214198){var _0x526aea={},_0x140443={},_0x152abb={'count':0x0,'rows':[]};var _0x45e6e9=_['map'](db[_0x559c('0x2c')][_0x559c('0x2d')],function(_0x193c96){return{'name':_0x193c96[_0x559c('0x2e')],'type':_0x193c96[_0x559c('0x2f')][_0x559c('0x30')]};});_0x140443[_0x559c('0x31')]=_[_0x559c('0x32')](_[_0x559c('0x33')](_0x45e6e9,_0x559c('0x2a')),[_0x559c('0x2a')]);_0x140443['query']=_[_0x559c('0x34')](_0x22b0be[_0x559c('0x35')]);_0x140443[_0x559c('0x36')]=_[_0x559c('0x37')](_0x140443['model'],_0x140443[_0x559c('0x35')]);_0x526aea[_0x559c('0x38')]=_[_0x559c('0x37')](_0x140443[_0x559c('0x31')],qs['fields'](_0x22b0be[_0x559c('0x35')]['fields']));_0x526aea[_0x559c('0x38')]=_0x526aea[_0x559c('0x38')][_0x559c('0x39')]?_0x526aea[_0x559c('0x38')]:_0x140443[_0x559c('0x31')];if(!_0x22b0be[_0x559c('0x35')]['hasOwnProperty'](_0x559c('0x3a'))){_0x526aea[_0x559c('0x21')]=qs['limit'](_0x22b0be[_0x559c('0x35')][_0x559c('0x21')]);_0x526aea[_0x559c('0x20')]=qs['offset'](_0x22b0be[_0x559c('0x35')][_0x559c('0x20')]);}_0x526aea[_0x559c('0x3b')]=qs[_0x559c('0x3c')](_0x22b0be[_0x559c('0x35')][_0x559c('0x3c')]);_0x526aea[_0x559c('0x3d')]=qs['filters'](_[_0x559c('0x3e')](_0x22b0be[_0x559c('0x35')],_0x140443['filters']),_0x45e6e9);if(_0x22b0be[_0x559c('0x35')][_0x559c('0x3f')]){_0x526aea[_0x559c('0x3d')]=_[_0x559c('0x40')](_0x526aea['where'],{'$or':_[_0x559c('0x33')](_0x45e6e9,function(_0x5736f9){if(_0x5736f9['type']!=='VIRTUAL'){var _0x476c00={};_0x476c00[_0x5736f9[_0x559c('0x2a')]]={'$like':'%'+_0x22b0be[_0x559c('0x35')]['filter']+'%'};return _0x476c00;}})});}_0x526aea=_[_0x559c('0x40')]({},_0x526aea,_0x22b0be[_0x559c('0x41')]);var _0x1fcfdc={'where':_0x526aea[_0x559c('0x3d')]};return db[_0x559c('0x2c')][_0x559c('0x1f')](_0x1fcfdc)[_0x559c('0x26')](function(_0x2a094d){_0x152abb[_0x559c('0x1f')]=_0x2a094d;if(_0x22b0be['query']['includeAll']){_0x526aea[_0x559c('0x42')]=[{'all':!![]}];}return db[_0x559c('0x2c')][_0x559c('0x43')](_0x526aea);})[_0x559c('0x26')](function(_0x15afd2){_0x152abb['rows']=_0x15afd2;return _0x152abb;})[_0x559c('0x26')](respondWithFilteredResult(_0x214198,_0x526aea))[_0x559c('0x44')](handleError(_0x214198,null));};exports[_0x559c('0x45')]=function(_0x27bd58,_0x4f9141){var _0x44c3e2={'raw':!![],'where':{'id':_0x27bd58[_0x559c('0x46')]['id']}},_0x5c4900={};_0x5c4900[_0x559c('0x31')]=_[_0x559c('0x34')](db[_0x559c('0x2c')][_0x559c('0x2d')]);_0x5c4900[_0x559c('0x35')]=_[_0x559c('0x34')](_0x27bd58[_0x559c('0x35')]);_0x5c4900[_0x559c('0x36')]=_[_0x559c('0x37')](_0x5c4900[_0x559c('0x31')],_0x5c4900[_0x559c('0x35')]);_0x44c3e2[_0x559c('0x38')]=_[_0x559c('0x37')](_0x5c4900[_0x559c('0x31')],qs[_0x559c('0x47')](_0x27bd58[_0x559c('0x35')][_0x559c('0x47')]));_0x44c3e2[_0x559c('0x38')]=_0x44c3e2['attributes'][_0x559c('0x39')]?_0x44c3e2['attributes']:_0x5c4900[_0x559c('0x31')];if(_0x27bd58[_0x559c('0x35')]['includeAll']){_0x44c3e2[_0x559c('0x42')]=[{'all':!![]}];}_0x44c3e2=_[_0x559c('0x40')]({},_0x44c3e2,_0x27bd58[_0x559c('0x41')]);return db[_0x559c('0x2c')]['find'](_0x44c3e2)[_0x559c('0x26')](handleEntityNotFound(_0x4f9141,null))[_0x559c('0x26')](respondWithResult(_0x4f9141,null))[_0x559c('0x44')](handleError(_0x4f9141,null));};exports[_0x559c('0x48')]=function(_0xede129,_0x10d4c9){return db[_0x559c('0x2c')][_0x559c('0x48')](_0xede129[_0x559c('0x49')],{})[_0x559c('0x26')](respondWithResult(_0x10d4c9,0xc9))[_0x559c('0x44')](handleError(_0x10d4c9,null));};exports[_0x559c('0x4a')]=function(_0x482f28,_0x3f11b9){if(_0x482f28[_0x559c('0x49')]['id']){delete _0x482f28[_0x559c('0x49')]['id'];}return db[_0x559c('0x2c')]['find']({'where':{'id':_0x482f28['params']['id']}})[_0x559c('0x26')](handleEntityNotFound(_0x3f11b9,null))[_0x559c('0x26')](saveUpdates(_0x482f28[_0x559c('0x49')],null))['then'](respondWithResult(_0x3f11b9,null))[_0x559c('0x44')](handleError(_0x3f11b9,null));};exports['destroy']=function(_0x143925,_0x260718){return db[_0x559c('0x2c')][_0x559c('0x4b')]({'where':{'id':_0x143925['params']['id']}})[_0x559c('0x26')](handleEntityNotFound(_0x260718,null))[_0x559c('0x26')](removeEntity(_0x260718,null))[_0x559c('0x44')](handleError(_0x260718,null));};exports[_0x559c('0x4c')]=function(_0x557cf0,_0x5741fe,_0x4e6783){return db[_0x559c('0x2c')][_0x559c('0x4b')]({'where':{'id':_0x557cf0['params']['id']},'attributes':['id',_0x559c('0x4d'),_0x559c('0x4e')]})[_0x559c('0x26')](handleEntityNotFound(_0x5741fe,null))[_0x559c('0x26')](function(_0x8b13e1){if(_0x8b13e1){if(!_0x8b13e1['recording']){throw new db[(_0x559c('0x4f'))]['ValidationError'](_0x559c('0x50'));}var _0x33b75e={'Content-Type':_0x559c('0x51'),'Content-Disposition':_0x559c('0x52')};if(_0x8b13e1[_0x559c('0x4e')]){_0x33b75e[_0x559c('0x53')]=_0x559c('0x54')+_0x8b13e1['msg_id']+_0x559c('0x55');}_0x5741fe[_0x559c('0x56')](_0x33b75e);return _0x5741fe['send'](new Buffer(_0x8b13e1[_0x559c('0x4d')]));}})[_0x559c('0x44')](handleError(_0x5741fe,null));}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.model.js b/server/api/voiceMailMessage/voiceMailMessage.model.js index 2f64a53..b021f5d 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 _0x29a4=['util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','exports','define','dir','lodash'];(function(_0x673722,_0x275d7e){var _0x21249c=function(_0x25b4e7){while(--_0x25b4e7){_0x673722['push'](_0x673722['shift']());}};_0x21249c(++_0x275d7e);}(_0x29a4,0x15b));var _0x429a=function(_0x50007c,_0x1cbf11){_0x50007c=_0x50007c-0x0;var _0x5c1ec7=_0x29a4[_0x50007c];return _0x5c1ec7;};'use strict';var _=require(_0x429a('0x0'));var util=require(_0x429a('0x1'));var logger=require(_0x429a('0x2'))(_0x429a('0x3'));var moment=require(_0x429a('0x4'));var BPromise=require('bluebird');var rp=require(_0x429a('0x5'));var fs=require('fs');var path=require(_0x429a('0x6'));var rimraf=require(_0x429a('0x7'));var config=require(_0x429a('0x8'));var attributes=require('./voiceMailMessage.attributes');module[_0x429a('0x9')]=function(_0x10527e,_0x528f84){return _0x10527e[_0x429a('0xa')]('VoiceMailMessage',attributes,{'tableName':'voice_voicemail_messages','paranoid':![],'indexes':[{'name':_0x429a('0xb'),'fields':[_0x429a('0xb')]}],'timestamps':![]});}; \ No newline at end of file +var _0x4c63=['dir','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./voiceMailMessage.attributes','exports','define','VoiceMailMessage','voice_voicemail_messages'];(function(_0x4819c3,_0x36732d){var _0x3c6537=function(_0x493b90){while(--_0x493b90){_0x4819c3['push'](_0x4819c3['shift']());}};_0x3c6537(++_0x36732d);}(_0x4c63,0x1b4));var _0x34c6=function(_0x5bdbfc,_0x168fe8){_0x5bdbfc=_0x5bdbfc-0x0;var _0x26c68e=_0x4c63[_0x5bdbfc];return _0x26c68e;};'use strict';var _=require(_0x34c6('0x0'));var util=require(_0x34c6('0x1'));var logger=require(_0x34c6('0x2'))(_0x34c6('0x3'));var moment=require(_0x34c6('0x4'));var BPromise=require(_0x34c6('0x5'));var rp=require(_0x34c6('0x6'));var fs=require('fs');var path=require(_0x34c6('0x7'));var rimraf=require('rimraf');var config=require(_0x34c6('0x8'));var attributes=require(_0x34c6('0x9'));module[_0x34c6('0xa')]=function(_0xb35164,_0x1e2f99){return _0xb35164[_0x34c6('0xb')](_0x34c6('0xc'),attributes,{'tableName':_0x34c6('0xd'),'paranoid':![],'indexes':[{'name':_0x34c6('0xe'),'fields':[_0x34c6('0xe')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.rpc.js b/server/api/voiceMailMessage/voiceMailMessage.rpc.js index b77ae5b..b707e24 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 _0x67c2=['message','result','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','debug','request\x20sent','stringify','error','VoiceMailMessage,\x20%s,\x20%s'];(function(_0x3654c5,_0x2f4ecd){var _0xf5f082=function(_0x20cdcf){while(--_0x20cdcf){_0x3654c5['push'](_0x3654c5['shift']());}};_0xf5f082(++_0x2f4ecd);}(_0x67c2,0xa2));var _0x267c=function(_0x1aff76,_0x5eb084){_0x1aff76=_0x1aff76-0x0;var _0x2521b6=_0x67c2[_0x1aff76];return _0x2521b6;};'use strict';var _=require('lodash');var util=require(_0x267c('0x0'));var moment=require(_0x267c('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x267c('0x2'));var db=require(_0x267c('0x3'))['db'];var utils=require(_0x267c('0x4'));var logger=require(_0x267c('0x5'))(_0x267c('0x6'));var config=require(_0x267c('0x7'));var jayson=require(_0x267c('0x8'));var client=jayson[_0x267c('0x9')][_0x267c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x34a438,_0x4bd02f,_0x259d20){return new BPromise(function(_0x251223,_0x363d8c){return client[_0x267c('0xb')](_0x34a438,_0x259d20)['then'](function(_0x14b837){logger[_0x267c('0xc')]('VoiceMailMessage,\x20%s,\x20%s',_0x4bd02f,'request\x20sent');logger[_0x267c('0xd')]('VoiceMailMessage,\x20%s,\x20%s,\x20%s',_0x4bd02f,_0x267c('0xe'),JSON[_0x267c('0xf')](_0x14b837));if(_0x14b837['error']){if(_0x14b837[_0x267c('0x10')]['code']===0x1f4){logger[_0x267c('0x10')](_0x267c('0x11'),_0x4bd02f,_0x14b837['error'][_0x267c('0x12')]);return _0x363d8c(_0x14b837[_0x267c('0x10')][_0x267c('0x12')]);}logger[_0x267c('0x10')]('VoiceMailMessage,\x20%s,\x20%s',_0x4bd02f,_0x14b837[_0x267c('0x10')][_0x267c('0x12')]);return _0x251223(_0x14b837[_0x267c('0x10')]['message']);}else{logger['info'](_0x267c('0x11'),_0x4bd02f,_0x267c('0xe'));_0x251223(_0x14b837[_0x267c('0x13')][_0x267c('0x12')]);}})['catch'](function(_0x504289){logger[_0x267c('0x10')](_0x267c('0x11'),_0x4bd02f,_0x504289);_0x363d8c(_0x504289);});});} \ No newline at end of file +var _0x4d3c=['code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','request','info','VoiceMailMessage,\x20%s,\x20%s','request\x20sent','VoiceMailMessage,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x2140b1,_0x406293){var _0x2d161e=function(_0x4f4162){while(--_0x4f4162){_0x2140b1['push'](_0x2140b1['shift']());}};_0x2d161e(++_0x406293);}(_0x4d3c,0x16c));var _0xc4d3=function(_0x31cef4,_0x40f9cc){_0x31cef4=_0x31cef4-0x0;var _0x247289=_0x4d3c[_0x31cef4];return _0x247289;};'use strict';var _=require('lodash');var util=require(_0xc4d3('0x0'));var moment=require(_0xc4d3('0x1'));var BPromise=require(_0xc4d3('0x2'));var rs=require(_0xc4d3('0x3'));var fs=require('fs');var Redis=require(_0xc4d3('0x4'));var db=require(_0xc4d3('0x5'))['db'];var utils=require(_0xc4d3('0x6'));var logger=require(_0xc4d3('0x7'))(_0xc4d3('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2bfc3f,_0x1906d5,_0x308b9a){return new BPromise(function(_0x672ddd,_0x1638e3){return client[_0xc4d3('0x9')](_0x2bfc3f,_0x308b9a)['then'](function(_0x22a1ed){logger[_0xc4d3('0xa')](_0xc4d3('0xb'),_0x1906d5,_0xc4d3('0xc'));logger['debug'](_0xc4d3('0xd'),_0x1906d5,'request\x20sent',JSON[_0xc4d3('0xe')](_0x22a1ed));if(_0x22a1ed[_0xc4d3('0xf')]){if(_0x22a1ed[_0xc4d3('0xf')][_0xc4d3('0x10')]===0x1f4){logger[_0xc4d3('0xf')]('VoiceMailMessage,\x20%s,\x20%s',_0x1906d5,_0x22a1ed[_0xc4d3('0xf')][_0xc4d3('0x11')]);return _0x1638e3(_0x22a1ed['error'][_0xc4d3('0x11')]);}logger['error'](_0xc4d3('0xb'),_0x1906d5,_0x22a1ed[_0xc4d3('0xf')][_0xc4d3('0x11')]);return _0x672ddd(_0x22a1ed[_0xc4d3('0xf')][_0xc4d3('0x11')]);}else{logger[_0xc4d3('0xa')](_0xc4d3('0xb'),_0x1906d5,_0xc4d3('0xc'));_0x672ddd(_0x22a1ed[_0xc4d3('0x12')][_0xc4d3('0x11')]);}})[_0xc4d3('0x13')](function(_0x134338){logger[_0xc4d3('0xf')](_0xc4d3('0xb'),_0x1906d5,_0x134338);_0x1638e3(_0x134338);});});} \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/index.js b/server/api/voiceMusicOnHold/index.js index f711aa8..9c94927 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 _0x880d=['update','destroy','delete','/:id/sounds/:id2','removeSound','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','/:id/sounds','post','create','addSound','put'];(function(_0x2caa20,_0x15abae){var _0x2f01ee=function(_0x16cc5b){while(--_0x16cc5b){_0x2caa20['push'](_0x2caa20['shift']());}};_0x2f01ee(++_0x15abae);}(_0x880d,0x116));var _0xd880=function(_0x2a7b8e,_0x50ffce){_0x2a7b8e=_0x2a7b8e-0x0;var _0x29b5c8=_0x880d[_0x2a7b8e];return _0x29b5c8;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xd880('0x0'));var timeout=require(_0xd880('0x1'));var express=require(_0xd880('0x2'));var router=express[_0xd880('0x3')]();var fs_extra=require(_0xd880('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xd880('0x5'));var config=require(_0xd880('0x6'));var controller=require('./voiceMusicOnHold.controller');router[_0xd880('0x7')]('/',auth[_0xd880('0x8')](),controller['index']);router[_0xd880('0x7')](_0xd880('0x9'),auth[_0xd880('0x8')](),controller[_0xd880('0xa')]);router['get'](_0xd880('0xb'),auth[_0xd880('0x8')](),controller['getSounds']);router[_0xd880('0xc')]('/',auth[_0xd880('0x8')](),controller[_0xd880('0xd')]);router[_0xd880('0xc')]('/:id/sounds',auth['isAuthenticated'](),controller[_0xd880('0xe')]);router[_0xd880('0xf')]('/:id',auth[_0xd880('0x8')](),controller[_0xd880('0x10')]);router['delete'](_0xd880('0x9'),auth[_0xd880('0x8')](),controller[_0xd880('0x11')]);router[_0xd880('0x12')](_0xd880('0x13'),auth['isAuthenticated'](),controller[_0xd880('0x14')]);module['exports']=router; \ No newline at end of file +var _0xd767=['create','/:id/sounds','addSound','put','update','delete','/:id','destroy','/:id/sounds/:id2','multer','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./voiceMusicOnHold.controller','isAuthenticated','index','get','getSounds','post'];(function(_0x46b6a6,_0x58a0e3){var _0x235dcd=function(_0x206bca){while(--_0x206bca){_0x46b6a6['push'](_0x46b6a6['shift']());}};_0x235dcd(++_0x58a0e3);}(_0xd767,0xfb));var _0x7d76=function(_0x3c2757,_0x4dda3c){_0x3c2757=_0x3c2757-0x0;var _0x27d38b=_0xd767[_0x3c2757];return _0x27d38b;};'use strict';var multer=require(_0x7d76('0x0'));var util=require('util');var path=require(_0x7d76('0x1'));var timeout=require(_0x7d76('0x2'));var express=require('express');var router=express[_0x7d76('0x3')]();var fs_extra=require(_0x7d76('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x7d76('0x5'));var config=require(_0x7d76('0x6'));var controller=require(_0x7d76('0x7'));router['get']('/',auth[_0x7d76('0x8')](),controller[_0x7d76('0x9')]);router[_0x7d76('0xa')]('/:id',auth[_0x7d76('0x8')](),controller['show']);router[_0x7d76('0xa')]('/:id/sounds',auth['isAuthenticated'](),controller[_0x7d76('0xb')]);router[_0x7d76('0xc')]('/',auth[_0x7d76('0x8')](),controller[_0x7d76('0xd')]);router[_0x7d76('0xc')](_0x7d76('0xe'),auth[_0x7d76('0x8')](),controller[_0x7d76('0xf')]);router[_0x7d76('0x10')]('/:id',auth[_0x7d76('0x8')](),controller[_0x7d76('0x11')]);router[_0x7d76('0x12')](_0x7d76('0x13'),auth[_0x7d76('0x8')](),controller[_0x7d76('0x14')]);router[_0x7d76('0x12')](_0x7d76('0x15'),auth[_0x7d76('0x8')](),controller['removeSound']);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js index d43de33..6c30670 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 _0xc1fe=['exports','name','files','quietmp3nb','mp3','STRING','alpha','TIMESTAMP','BOOLEAN','sequelize'];(function(_0xcb8fde,_0x24399c){var _0x16dd77=function(_0x27cab4){while(--_0x27cab4){_0xcb8fde['push'](_0xcb8fde['shift']());}};_0x16dd77(++_0x24399c);}(_0xc1fe,0x18f));var _0xec1f=function(_0x3b8a9f,_0x1f85e9){_0x3b8a9f=_0x3b8a9f-0x0;var _0x3afb86=_0xc1fe[_0x3b8a9f];return _0x3afb86;};'use strict';var Sequelize=require(_0xec1f('0x0'));module[_0xec1f('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xec1f('0x2')},'mode':{'type':Sequelize['ENUM']('custom',_0xec1f('0x3'),'mp3nb',_0xec1f('0x4'),'quietmp3',_0xec1f('0x5')),'allowNull':!![],'defaultValue':_0xec1f('0x3')},'directory':{'type':Sequelize[_0xec1f('0x6')],'allowNull':!![]},'application':{'type':Sequelize['STRING'],'allowNull':!![]},'digit':{'type':Sequelize[_0xec1f('0x6')],'allowNull':!![]},'sort':{'type':Sequelize[_0xec1f('0x6')],'allowNull':!![],'defaultValue':_0xec1f('0x7')},'format':{'type':Sequelize[_0xec1f('0x6')],'allowNull':!![]},'stamp':{'type':_0xec1f('0x8')},'defaultEntry':{'type':Sequelize[_0xec1f('0x9')],'defaultValue':0x0}}; \ No newline at end of file +var _0x26c5=['BOOLEAN','sequelize','exports','STRING','name','custom','files','mp3nb','quietmp3nb','quietmp3','TIMESTAMP'];(function(_0x2775a4,_0x3c9afa){var _0x40267c=function(_0x5a3788){while(--_0x5a3788){_0x2775a4['push'](_0x2775a4['shift']());}};_0x40267c(++_0x3c9afa);}(_0x26c5,0x11f));var _0x526c=function(_0x4f77a2,_0x4df36a){_0x4f77a2=_0x4f77a2-0x0;var _0x5e21a9=_0x26c5[_0x4f77a2];return _0x5e21a9;};'use strict';var Sequelize=require(_0x526c('0x0'));module[_0x526c('0x1')]={'name':{'type':Sequelize[_0x526c('0x2')],'allowNull':![],'unique':_0x526c('0x3')},'mode':{'type':Sequelize['ENUM'](_0x526c('0x4'),_0x526c('0x5'),_0x526c('0x6'),_0x526c('0x7'),_0x526c('0x8'),'mp3'),'allowNull':!![],'defaultValue':_0x526c('0x5')},'directory':{'type':Sequelize[_0x526c('0x2')],'allowNull':!![]},'application':{'type':Sequelize[_0x526c('0x2')],'allowNull':!![]},'digit':{'type':Sequelize[_0x526c('0x2')],'allowNull':!![]},'sort':{'type':Sequelize[_0x526c('0x2')],'allowNull':!![],'defaultValue':'alpha'},'format':{'type':Sequelize[_0x526c('0x2')],'allowNull':!![]},'stamp':{'type':_0x526c('0x9')},'defaultEntry':{'type':Sequelize[_0x526c('0xa')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.controller.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.controller.js index 378825d..418800e 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 _0xb130=['join','root','server/files/moh','create','mode','mkdirSync','user','get','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readdirSync','forEach','unlinkSync','ValidationError','addSound','Sound','findOne','save_name','converted_format','createdAt','server/files/sounds/converted','format','%s.%s','basename','extname','symlinkSync','Sequelize','message','removeSound','id2','getSounds','pick','options','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','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','set','Content-Range','apply','reject','then','destroy','MusicOnHolds','UserProfileResource','stack','name','send','map','VoiceMusicOnHold','rawAttributes','fieldName','type','key','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','filter','count','includeAll','include','catch','show','params','find','update','body','sequelize','transaction','files','directory'];(function(_0x3a4fa5,_0x8af161){var _0x38c5ff=function(_0x1861a2){while(--_0x1861a2){_0x3a4fa5['push'](_0x3a4fa5['shift']());}};_0x38c5ff(++_0x8af161);}(_0xb130,0x176));var _0x0b13=function(_0x10f68e,_0xf198ea){_0x10f68e=_0x10f68e-0x0;var _0x4c8372=_0xb130[_0x10f68e];return _0x4c8372;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0b13('0x0'));var zipdir=require(_0x0b13('0x1'));var jsonpatch=require(_0x0b13('0x2'));var rp=require(_0x0b13('0x3'));var moment=require(_0x0b13('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x0b13('0x5'));var util=require(_0x0b13('0x6'));var path=require(_0x0b13('0x7'));var sox=require(_0x0b13('0x8'));var csv=require(_0x0b13('0x9'));var ejs=require(_0x0b13('0xa'));var fs=require('fs');var fs_extra=require(_0x0b13('0xb'));var _=require(_0x0b13('0xc'));var squel=require(_0x0b13('0xd'));var crypto=require(_0x0b13('0xe'));var jsforce=require(_0x0b13('0xf'));var deskjs=require(_0x0b13('0x10'));var toCsv=require(_0x0b13('0x9'));var querystring=require(_0x0b13('0x11'));var Papa=require(_0x0b13('0x12'));var Redis=require('ioredis');var authService=require(_0x0b13('0x13'));var qs=require(_0x0b13('0x14'));var as=require(_0x0b13('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x0b13('0x16'));var licenseUtil=require(_0x0b13('0x17'));var db=require(_0x0b13('0x18'))['db'];function respondWithStatusCode(_0x4231d1,_0x395dd4){_0x395dd4=_0x395dd4||0xcc;return function(_0x31000e){if(_0x31000e){return _0x4231d1[_0x0b13('0x19')](_0x395dd4);}return _0x4231d1[_0x0b13('0x1a')](_0x395dd4)[_0x0b13('0x1b')]();};}function respondWithResult(_0x15e371,_0x44d005){_0x44d005=_0x44d005||0xc8;return function(_0x5bb9a7){if(_0x5bb9a7){return _0x15e371[_0x0b13('0x1a')](_0x44d005)[_0x0b13('0x1c')](_0x5bb9a7);}};}function respondWithFilteredResult(_0x11d047,_0x5c0834){return function(_0x4e811e){if(_0x4e811e){var _0x54d9a8=typeof _0x5c0834[_0x0b13('0x1d')]===_0x0b13('0x1e')&&typeof _0x5c0834[_0x0b13('0x1f')]==='undefined';var _0x1278e8=_0x4e811e['count'];var _0x1134ea=_0x54d9a8?0x0:_0x5c0834[_0x0b13('0x1d')];var _0x5cd511=_0x54d9a8?_0x4e811e['count']:_0x5c0834[_0x0b13('0x1d')]+_0x5c0834[_0x0b13('0x1f')];var _0x325379;if(_0x5cd511>=_0x1278e8){_0x5cd511=_0x1278e8;_0x325379=0xc8;}else{_0x325379=0xce;}_0x11d047[_0x0b13('0x1a')](_0x325379);return _0x11d047[_0x0b13('0x20')](_0x0b13('0x21'),_0x1134ea+'-'+_0x5cd511+'/'+_0x1278e8)[_0x0b13('0x1c')](_0x4e811e);}return null;};}function patchUpdates(_0x40684d){return function(_0x5cf6d0){try{jsonpatch[_0x0b13('0x22')](_0x5cf6d0,_0x40684d,!![]);}catch(_0x1fddf7){return BPromise[_0x0b13('0x23')](_0x1fddf7);}return _0x5cf6d0['save']();};}function saveUpdates(_0x4a3636,_0x3e749a){return function(_0x552312){if(_0x552312){return _0x552312['update'](_0x4a3636)[_0x0b13('0x24')](function(_0x32ea46){return _0x32ea46;});}return null;};}function removeEntity(_0x29a222,_0x36f058){return function(_0x5803ca){if(_0x5803ca){return _0x5803ca[_0x0b13('0x25')]()[_0x0b13('0x24')](function(){var _0x1c376a=_0x5803ca['get']({'plain':!![]});var _0xe05668=_0x0b13('0x26');return db[_0x0b13('0x27')]['destroy']({'where':{'type':_0xe05668,'resourceId':_0x1c376a['id']}})[_0x0b13('0x24')](function(){return _0x5803ca;});})[_0x0b13('0x24')](function(){_0x29a222[_0x0b13('0x1a')](0xcc)[_0x0b13('0x1b')]();});}};}function handleEntityNotFound(_0x11c56f,_0x1d00cf){return function(_0x1ac854){if(!_0x1ac854){_0x11c56f[_0x0b13('0x19')](0x194);}return _0x1ac854;};}function handleError(_0x2bcc2c,_0x2ce4bb){_0x2ce4bb=_0x2ce4bb||0x1f4;return function(_0x46ed82){logger['error'](_0x46ed82[_0x0b13('0x28')]);if(_0x46ed82[_0x0b13('0x29')]){delete _0x46ed82['name'];}_0x2bcc2c[_0x0b13('0x1a')](_0x2ce4bb)[_0x0b13('0x2a')](_0x46ed82);};}exports['index']=function(_0x28d450,_0x4a9bfe){var _0x548092={},_0x11028a={},_0x25f9a8={'count':0x0,'rows':[]};var _0x596ad2=_[_0x0b13('0x2b')](db[_0x0b13('0x2c')][_0x0b13('0x2d')],function(_0x54fe45){return{'name':_0x54fe45[_0x0b13('0x2e')],'type':_0x54fe45[_0x0b13('0x2f')][_0x0b13('0x30')]};});_0x11028a['model']=_['map'](_0x596ad2,'name');_0x11028a[_0x0b13('0x31')]=_[_0x0b13('0x32')](_0x28d450[_0x0b13('0x31')]);_0x11028a[_0x0b13('0x33')]=_['intersection'](_0x11028a[_0x0b13('0x34')],_0x11028a[_0x0b13('0x31')]);_0x548092[_0x0b13('0x35')]=_[_0x0b13('0x36')](_0x11028a[_0x0b13('0x34')],qs[_0x0b13('0x37')](_0x28d450[_0x0b13('0x31')][_0x0b13('0x37')]));_0x548092['attributes']=_0x548092[_0x0b13('0x35')][_0x0b13('0x38')]?_0x548092[_0x0b13('0x35')]:_0x11028a['model'];if(!_0x28d450[_0x0b13('0x31')][_0x0b13('0x39')](_0x0b13('0x3a'))){_0x548092[_0x0b13('0x1f')]=qs[_0x0b13('0x1f')](_0x28d450[_0x0b13('0x31')][_0x0b13('0x1f')]);_0x548092[_0x0b13('0x1d')]=qs[_0x0b13('0x1d')](_0x28d450[_0x0b13('0x31')][_0x0b13('0x1d')]);}_0x548092[_0x0b13('0x3b')]=qs[_0x0b13('0x3c')](_0x28d450['query']['sort']);delete _0x28d450[_0x0b13('0x31')][_0x0b13('0x3c')];_0x548092['where']=qs[_0x0b13('0x33')](_['pick'](_0x28d450[_0x0b13('0x31')],_0x11028a['filters']),_0x596ad2);if(_0x28d450[_0x0b13('0x31')]['filter']){_0x548092[_0x0b13('0x3d')]=_[_0x0b13('0x3e')](_0x548092[_0x0b13('0x3d')],{'$or':_[_0x0b13('0x2b')](_0x596ad2,function(_0x42519a){if(_0x42519a[_0x0b13('0x2f')]!==_0x0b13('0x3f')){var _0xa31639={};_0xa31639[_0x42519a[_0x0b13('0x29')]]={'$like':'%'+_0x28d450[_0x0b13('0x31')][_0x0b13('0x40')]+'%'};return _0xa31639;}})});}_0x548092=_[_0x0b13('0x3e')]({},_0x548092,_0x28d450['options']);var _0x1810a6={'where':_0x548092[_0x0b13('0x3d')]};return db[_0x0b13('0x2c')][_0x0b13('0x41')](_0x1810a6)[_0x0b13('0x24')](function(_0xe9022a){_0x25f9a8['count']=_0xe9022a;if(_0x28d450['query'][_0x0b13('0x42')]){_0x548092[_0x0b13('0x43')]=[{'all':!![]}];}return db[_0x0b13('0x2c')]['findAll'](_0x548092);})[_0x0b13('0x24')](function(_0x38e838){_0x25f9a8['rows']=_0x38e838;return _0x25f9a8;})[_0x0b13('0x24')](respondWithFilteredResult(_0x4a9bfe,_0x548092))[_0x0b13('0x44')](handleError(_0x4a9bfe,null));};exports[_0x0b13('0x45')]=function(_0x5d739c,_0x4a42c6){var _0x424be7={'raw':![],'where':{'id':_0x5d739c[_0x0b13('0x46')]['id']}},_0x44a191={};_0x44a191['model']=_[_0x0b13('0x32')](db[_0x0b13('0x2c')][_0x0b13('0x2d')]);_0x44a191[_0x0b13('0x31')]=_['keys'](_0x5d739c[_0x0b13('0x31')]);_0x44a191[_0x0b13('0x33')]=_['intersection'](_0x44a191['model'],_0x44a191[_0x0b13('0x31')]);_0x424be7[_0x0b13('0x35')]=_[_0x0b13('0x36')](_0x44a191['model'],qs[_0x0b13('0x37')](_0x5d739c[_0x0b13('0x31')]['fields']));_0x424be7['attributes']=_0x424be7['attributes'][_0x0b13('0x38')]?_0x424be7[_0x0b13('0x35')]:_0x44a191['model'];if(_0x5d739c['query'][_0x0b13('0x42')]){_0x424be7['include']=[{'all':!![]}];}_0x424be7=_[_0x0b13('0x3e')]({},_0x424be7,_0x5d739c['options']);return db[_0x0b13('0x2c')][_0x0b13('0x47')](_0x424be7)[_0x0b13('0x24')](handleEntityNotFound(_0x4a42c6,null))[_0x0b13('0x24')](respondWithResult(_0x4a42c6,null))[_0x0b13('0x44')](handleError(_0x4a42c6,null));};exports[_0x0b13('0x48')]=function(_0x614fe6,_0x144e97){if(_0x614fe6[_0x0b13('0x49')]['id']){delete _0x614fe6[_0x0b13('0x49')]['id'];}return db[_0x0b13('0x2c')]['find']({'where':{'id':_0x614fe6[_0x0b13('0x46')]['id']}})[_0x0b13('0x24')](handleEntityNotFound(_0x144e97,null))['then'](saveUpdates(_0x614fe6[_0x0b13('0x49')],null))[_0x0b13('0x24')](respondWithResult(_0x144e97,null))['catch'](handleError(_0x144e97,null));};exports['create']=function(_0x38079c,_0xaefa97,_0x5a1664){return db[_0x0b13('0x4a')][_0x0b13('0x4b')](function(_0xc2e846){if(_0x38079c['body']['mode']===_0x0b13('0x4c')){_0x38079c[_0x0b13('0x49')][_0x0b13('0x4d')]=path[_0x0b13('0x4e')](config[_0x0b13('0x4f')],_0x0b13('0x50'),_0x38079c[_0x0b13('0x49')][_0x0b13('0x29')]);}return db[_0x0b13('0x2c')][_0x0b13('0x51')](_0x38079c['body'],{'transaction':_0xc2e846})[_0x0b13('0x24')](function(_0x2b732c){if(_0x38079c[_0x0b13('0x49')][_0x0b13('0x52')]==='files'){fs[_0x0b13('0x53')](_0x2b732c['directory'],parseInt('0777',0x8));}var _0x1c1f01=_0x38079c[_0x0b13('0x54')][_0x0b13('0x55')]({'plain':!![]});if(!_0x1c1f01)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1c1f01['role']===_0x0b13('0x54')){var _0x5458a7=_0x2b732c[_0x0b13('0x55')]({'plain':!![]});return db[_0x0b13('0x56')]['find']({'where':{'name':_0x0b13('0x26'),'userProfileId':_0x1c1f01[_0x0b13('0x57')]},'raw':!![]})[_0x0b13('0x24')](function(_0x5f1d64){if(_0x5f1d64&&_0x5f1d64[_0x0b13('0x58')]===0x0){return db[_0x0b13('0x27')][_0x0b13('0x51')]({'name':_0x5458a7[_0x0b13('0x29')],'resourceId':_0x5458a7['id'],'type':_0x5f1d64[_0x0b13('0x29')],'sectionId':_0x5f1d64['id']},{})[_0x0b13('0x24')](function(){return _0x2b732c;});}else{return _0x2b732c;}})[_0x0b13('0x44')](function(_0x490e85){logger['error'](_0x0b13('0x59'),_0x490e85);});}return _0x2b732c;});})[_0x0b13('0x24')](respondWithResult(_0xaefa97,0xc9))[_0x0b13('0x44')](handleError(_0xaefa97,null));};exports[_0x0b13('0x25')]=function(_0x7708d3,_0x2af5a2,_0x28728c){var _0x6e07d6;return db[_0x0b13('0x2c')][_0x0b13('0x47')]({'where':{'id':_0x7708d3['params']['id']}})[_0x0b13('0x24')](function(_0x26bc32){if(_0x26bc32){return db[_0x0b13('0x4a')][_0x0b13('0x4b')](function(_0x537be0){return _0x26bc32['destroy']({'transaction':_0x537be0,'raw':!![]})[_0x0b13('0x24')](function(_0x4c7034){if(_0x4c7034[_0x0b13('0x4d')]){fs[_0x0b13('0x5a')](_0x4c7034['directory'])[_0x0b13('0x5b')](function(_0x3bce74){fs[_0x0b13('0x5c')](path['join'](_0x4c7034[_0x0b13('0x4d')],_0x3bce74));});fs['rmdirSync'](_0x4c7034[_0x0b13('0x4d')]);}return _0x4c7034;});})[_0x0b13('0x44')](function(_0x18ebf7){throw new db['Sequelize'][(_0x0b13('0x5d'))](_0x18ebf7['message']);});}})['then'](handleEntityNotFound(_0x2af5a2,null))[_0x0b13('0x24')](removeEntity(_0x2af5a2,null))[_0x0b13('0x44')](handleError(_0x2af5a2,null));};exports['addSound']=function(_0x33c013,_0x4c46b5,_0x44af98){return db[_0x0b13('0x4a')][_0x0b13('0x4b')](function(_0x18aff7){var _0x4083f2;return db['VoiceMusicOnHold'][_0x0b13('0x47')]({'where':{'id':_0x33c013['params']['id']}})[_0x0b13('0x24')](function(_0xd08c99){if(_0xd08c99){_0x4083f2=_0xd08c99;return _0xd08c99[_0x0b13('0x5e')](_0x33c013['body']['id'],{'transaction':_0x18aff7});}})['then'](function(_0x50670e){if(_0x50670e){return db[_0x0b13('0x5f')][_0x0b13('0x60')]({'where':{'id':_0x33c013[_0x0b13('0x49')]['id']},'attributes':['id',_0x0b13('0x29'),_0x0b13('0x61'),_0x0b13('0x62'),_0x0b13('0x63')],'raw':!![]});}})[_0x0b13('0x24')](function(_0x3f2c1c){if(_0x3f2c1c){var _0x15023c=path[_0x0b13('0x4e')](config[_0x0b13('0x4f')],_0x0b13('0x64'),util[_0x0b13('0x65')](_0x0b13('0x66'),path[_0x0b13('0x67')](_0x3f2c1c[_0x0b13('0x61')],path[_0x0b13('0x68')](_0x3f2c1c[_0x0b13('0x61')])),_0x3f2c1c['converted_format']));var _0x406f1d=path[_0x0b13('0x4e')](config[_0x0b13('0x4f')],_0x0b13('0x50'),_0x4083f2[_0x0b13('0x29')],util[_0x0b13('0x65')](_0x0b13('0x66'),_0x3f2c1c[_0x0b13('0x29')],_0x3f2c1c['converted_format']));fs[_0x0b13('0x69')](_0x15023c,_0x406f1d);return _0x3f2c1c;}})[_0x0b13('0x44')](function(_0x519349){throw new db[(_0x0b13('0x6a'))][(_0x0b13('0x5d'))](_0x519349[_0x0b13('0x6b')]);});})[_0x0b13('0x24')](handleEntityNotFound(_0x4c46b5,null))[_0x0b13('0x24')](respondWithResult(_0x4c46b5,0xc9))[_0x0b13('0x44')](handleError(_0x4c46b5,null));};exports[_0x0b13('0x6c')]=function(_0x10da27,_0x2650d7,_0x52d902){return db[_0x0b13('0x4a')][_0x0b13('0x4b')](function(_0x4b6271){var _0x23b730;return db['VoiceMusicOnHold'][_0x0b13('0x60')]({'where':{'id':_0x10da27[_0x0b13('0x46')]['id']}})[_0x0b13('0x24')](handleEntityNotFound(_0x2650d7,null))[_0x0b13('0x24')](function(_0x5092bf){if(_0x5092bf){_0x23b730=_0x5092bf;return _0x5092bf[_0x0b13('0x6c')](_0x10da27[_0x0b13('0x46')][_0x0b13('0x6d')]);}})[_0x0b13('0x24')](function(_0x1f4c19){if(_0x1f4c19){return db[_0x0b13('0x5f')][_0x0b13('0x60')]({'where':{'id':_0x10da27[_0x0b13('0x46')][_0x0b13('0x6d')]},'attributes':['id',_0x0b13('0x29'),_0x0b13('0x61'),_0x0b13('0x62'),'createdAt'],'raw':!![]});}})[_0x0b13('0x24')](function(_0x34f072){if(_0x34f072){fs[_0x0b13('0x5c')](path[_0x0b13('0x4e')](_0x23b730[_0x0b13('0x4d')],util[_0x0b13('0x65')](_0x0b13('0x66'),_0x34f072[_0x0b13('0x29')],_0x34f072[_0x0b13('0x62')])));return _0x34f072;}})[_0x0b13('0x44')](function(_0x115e29){throw new db[(_0x0b13('0x6a'))][(_0x0b13('0x5d'))](_0x115e29[_0x0b13('0x6b')]);});})[_0x0b13('0x24')](handleEntityNotFound(_0x2650d7,null))[_0x0b13('0x24')](respondWithStatusCode(_0x2650d7,0xcc))[_0x0b13('0x44')](handleError(_0x2650d7,null));};exports[_0x0b13('0x6e')]=function(_0x4043a4,_0x1de80e,_0x2500bf){var _0x363ee6={};var _0x3beb1e={};var _0x528b85;var _0x3b10a2;return db[_0x0b13('0x2c')][_0x0b13('0x60')]({'where':{'id':_0x4043a4[_0x0b13('0x46')]['id']}})[_0x0b13('0x24')](handleEntityNotFound(_0x1de80e,null))['then'](function(_0x261939){if(_0x261939){_0x528b85=_0x261939;_0x3beb1e[_0x0b13('0x34')]=_[_0x0b13('0x32')](db['Sound'][_0x0b13('0x2d')]);_0x3beb1e[_0x0b13('0x31')]=_[_0x0b13('0x32')](_0x4043a4[_0x0b13('0x31')]);_0x3beb1e[_0x0b13('0x33')]=_[_0x0b13('0x36')](_0x3beb1e['model'],_0x3beb1e[_0x0b13('0x31')]);_0x363ee6['attributes']=_[_0x0b13('0x36')](_0x3beb1e[_0x0b13('0x34')],qs['fields'](_0x4043a4[_0x0b13('0x31')][_0x0b13('0x37')]));_0x363ee6[_0x0b13('0x35')]=_0x363ee6[_0x0b13('0x35')][_0x0b13('0x38')]?_0x363ee6['attributes']:_0x3beb1e[_0x0b13('0x34')];_0x363ee6['order']=qs[_0x0b13('0x3c')](_0x4043a4[_0x0b13('0x31')][_0x0b13('0x3c')]);_0x363ee6[_0x0b13('0x3d')]=qs[_0x0b13('0x33')](_[_0x0b13('0x6f')](_0x4043a4['query'],_0x3beb1e[_0x0b13('0x33')]));if(_0x4043a4[_0x0b13('0x31')]['filter']){_0x363ee6[_0x0b13('0x3d')]=_['merge'](_0x363ee6['where'],{'$or':_[_0x0b13('0x2b')](_0x363ee6['attributes'],function(_0x1cec3a){var _0x857e6d={};_0x857e6d[_0x1cec3a]={'$like':'%'+_0x4043a4[_0x0b13('0x31')]['filter']+'%'};return _0x857e6d;})});}_0x363ee6=_[_0x0b13('0x3e')]({},_0x363ee6,_0x4043a4[_0x0b13('0x70')]);return _0x528b85[_0x0b13('0x6e')](_0x363ee6);}})[_0x0b13('0x24')](function(_0x39804f){if(_0x39804f){_0x3b10a2=_0x39804f['length'];if(!_0x4043a4[_0x0b13('0x31')][_0x0b13('0x39')](_0x0b13('0x3a'))){_0x363ee6['limit']=qs['limit'](_0x4043a4[_0x0b13('0x31')][_0x0b13('0x1f')]);_0x363ee6['offset']=qs['offset'](_0x4043a4[_0x0b13('0x31')]['offset']);}return _0x528b85[_0x0b13('0x6e')](_0x363ee6);}})[_0x0b13('0x24')](function(_0x452336){if(_0x452336){return _0x452336?{'count':_0x3b10a2,'rows':_0x452336}:null;}})[_0x0b13('0x24')](respondWithResult(_0x1de80e,null))['catch'](handleError(_0x1de80e,null));}; \ No newline at end of file +var _0xdfb4=['set','Content-Range','apply','reject','save','then','destroy','get','MusicOnHolds','UserProfileResource','stack','name','send','index','map','VoiceMusicOnHold','rawAttributes','type','key','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','length','find','update','body','params','create','sequelize','mode','files','directory','join','root','server/files/moh','0777','user','role','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','transaction','forEach','unlinkSync','rmdirSync','Sequelize','ValidationError','message','addSound','Sound','findOne','save_name','converted_format','server/files/sounds/converted','format','%s.%s','basename','extname','symlinkSync','removeSound','id2','getSounds','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','ejs','fs-extra','lodash','crypto','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','limit','undefined','count','offset'];(function(_0xca2355,_0x547c4f){var _0x408db3=function(_0xe2e88b){while(--_0xe2e88b){_0xca2355['push'](_0xca2355['shift']());}};_0x408db3(++_0x547c4f);}(_0xdfb4,0x1b3));var _0x4dfb=function(_0x27fa52,_0x347642){_0x27fa52=_0x27fa52-0x0;var _0x332b19=_0xdfb4[_0x27fa52];return _0x332b19;};'use strict';var emlformat=require(_0x4dfb('0x0'));var rimraf=require(_0x4dfb('0x1'));var zipdir=require(_0x4dfb('0x2'));var jsonpatch=require(_0x4dfb('0x3'));var rp=require(_0x4dfb('0x4'));var moment=require(_0x4dfb('0x5'));var BPromise=require(_0x4dfb('0x6'));var Mustache=require('mustache');var util=require(_0x4dfb('0x7'));var path=require(_0x4dfb('0x8'));var sox=require(_0x4dfb('0x9'));var csv=require('to-csv');var ejs=require(_0x4dfb('0xa'));var fs=require('fs');var fs_extra=require(_0x4dfb('0xb'));var _=require(_0x4dfb('0xc'));var squel=require('squel');var crypto=require(_0x4dfb('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x4dfb('0xe'));var toCsv=require(_0x4dfb('0xf'));var querystring=require(_0x4dfb('0x10'));var Papa=require(_0x4dfb('0x11'));var Redis=require('ioredis');var authService=require(_0x4dfb('0x12'));var qs=require(_0x4dfb('0x13'));var as=require(_0x4dfb('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x4dfb('0x15'));var utils=require('../../config/utils');var config=require(_0x4dfb('0x16'));var licenseUtil=require(_0x4dfb('0x17'));var db=require(_0x4dfb('0x18'))['db'];function respondWithStatusCode(_0x588d83,_0x13a1a0){_0x13a1a0=_0x13a1a0||0xcc;return function(_0x4a0c7d){if(_0x4a0c7d){return _0x588d83[_0x4dfb('0x19')](_0x13a1a0);}return _0x588d83[_0x4dfb('0x1a')](_0x13a1a0)[_0x4dfb('0x1b')]();};}function respondWithResult(_0x2c5ac4,_0x2ef1fa){_0x2ef1fa=_0x2ef1fa||0xc8;return function(_0x3ed12d){if(_0x3ed12d){return _0x2c5ac4[_0x4dfb('0x1a')](_0x2ef1fa)[_0x4dfb('0x1c')](_0x3ed12d);}};}function respondWithFilteredResult(_0x9594b8,_0x2f667a){return function(_0x610b41){if(_0x610b41){var _0x561a94=typeof _0x2f667a['offset']==='undefined'&&typeof _0x2f667a[_0x4dfb('0x1d')]===_0x4dfb('0x1e');var _0x4a2038=_0x610b41[_0x4dfb('0x1f')];var _0x76a677=_0x561a94?0x0:_0x2f667a[_0x4dfb('0x20')];var _0x6ade4d=_0x561a94?_0x610b41[_0x4dfb('0x1f')]:_0x2f667a[_0x4dfb('0x20')]+_0x2f667a['limit'];var _0x22f440;if(_0x6ade4d>=_0x4a2038){_0x6ade4d=_0x4a2038;_0x22f440=0xc8;}else{_0x22f440=0xce;}_0x9594b8[_0x4dfb('0x1a')](_0x22f440);return _0x9594b8[_0x4dfb('0x21')](_0x4dfb('0x22'),_0x76a677+'-'+_0x6ade4d+'/'+_0x4a2038)['json'](_0x610b41);}return null;};}function patchUpdates(_0x3aa143){return function(_0x28db38){try{jsonpatch[_0x4dfb('0x23')](_0x28db38,_0x3aa143,!![]);}catch(_0x3d3a19){return BPromise[_0x4dfb('0x24')](_0x3d3a19);}return _0x28db38[_0x4dfb('0x25')]();};}function saveUpdates(_0x149a2e,_0xe7e089){return function(_0x465b53){if(_0x465b53){return _0x465b53['update'](_0x149a2e)[_0x4dfb('0x26')](function(_0x201f43){return _0x201f43;});}return null;};}function removeEntity(_0x1a7c63,_0x30b891){return function(_0x35491a){if(_0x35491a){return _0x35491a[_0x4dfb('0x27')]()[_0x4dfb('0x26')](function(){var _0x1e63de=_0x35491a[_0x4dfb('0x28')]({'plain':!![]});var _0x2b78cc=_0x4dfb('0x29');return db[_0x4dfb('0x2a')][_0x4dfb('0x27')]({'where':{'type':_0x2b78cc,'resourceId':_0x1e63de['id']}})[_0x4dfb('0x26')](function(){return _0x35491a;});})[_0x4dfb('0x26')](function(){_0x1a7c63['status'](0xcc)[_0x4dfb('0x1b')]();});}};}function handleEntityNotFound(_0x217bf8,_0x239744){return function(_0x30f4b7){if(!_0x30f4b7){_0x217bf8[_0x4dfb('0x19')](0x194);}return _0x30f4b7;};}function handleError(_0x43a059,_0x16a33e){_0x16a33e=_0x16a33e||0x1f4;return function(_0x3152d7){logger['error'](_0x3152d7[_0x4dfb('0x2b')]);if(_0x3152d7[_0x4dfb('0x2c')]){delete _0x3152d7['name'];}_0x43a059['status'](_0x16a33e)[_0x4dfb('0x2d')](_0x3152d7);};}exports[_0x4dfb('0x2e')]=function(_0x448186,_0x4bc746){var _0x4f9389={},_0x551dfa={},_0x50cc82={'count':0x0,'rows':[]};var _0x2aa84e=_[_0x4dfb('0x2f')](db[_0x4dfb('0x30')][_0x4dfb('0x31')],function(_0x51e090){return{'name':_0x51e090['fieldName'],'type':_0x51e090[_0x4dfb('0x32')][_0x4dfb('0x33')]};});_0x551dfa[_0x4dfb('0x34')]=_[_0x4dfb('0x2f')](_0x2aa84e,'name');_0x551dfa['query']=_[_0x4dfb('0x35')](_0x448186[_0x4dfb('0x36')]);_0x551dfa[_0x4dfb('0x37')]=_[_0x4dfb('0x38')](_0x551dfa['model'],_0x551dfa[_0x4dfb('0x36')]);_0x4f9389[_0x4dfb('0x39')]=_['intersection'](_0x551dfa[_0x4dfb('0x34')],qs[_0x4dfb('0x3a')](_0x448186[_0x4dfb('0x36')][_0x4dfb('0x3a')]));_0x4f9389['attributes']=_0x4f9389[_0x4dfb('0x39')]['length']?_0x4f9389[_0x4dfb('0x39')]:_0x551dfa['model'];if(!_0x448186[_0x4dfb('0x36')][_0x4dfb('0x3b')](_0x4dfb('0x3c'))){_0x4f9389[_0x4dfb('0x1d')]=qs[_0x4dfb('0x1d')](_0x448186[_0x4dfb('0x36')][_0x4dfb('0x1d')]);_0x4f9389[_0x4dfb('0x20')]=qs[_0x4dfb('0x20')](_0x448186[_0x4dfb('0x36')][_0x4dfb('0x20')]);}_0x4f9389[_0x4dfb('0x3d')]=qs[_0x4dfb('0x3e')](_0x448186['query'][_0x4dfb('0x3e')]);delete _0x448186[_0x4dfb('0x36')][_0x4dfb('0x3e')];_0x4f9389[_0x4dfb('0x3f')]=qs[_0x4dfb('0x37')](_[_0x4dfb('0x40')](_0x448186['query'],_0x551dfa[_0x4dfb('0x37')]),_0x2aa84e);if(_0x448186[_0x4dfb('0x36')][_0x4dfb('0x41')]){_0x4f9389['where']=_[_0x4dfb('0x42')](_0x4f9389['where'],{'$or':_['map'](_0x2aa84e,function(_0x3bfab1){if(_0x3bfab1['type']!==_0x4dfb('0x43')){var _0x5e7139={};_0x5e7139[_0x3bfab1[_0x4dfb('0x2c')]]={'$like':'%'+_0x448186[_0x4dfb('0x36')][_0x4dfb('0x41')]+'%'};return _0x5e7139;}})});}_0x4f9389=_[_0x4dfb('0x42')]({},_0x4f9389,_0x448186[_0x4dfb('0x44')]);var _0x1243e9={'where':_0x4f9389[_0x4dfb('0x3f')]};return db[_0x4dfb('0x30')][_0x4dfb('0x1f')](_0x1243e9)['then'](function(_0x4f845e){_0x50cc82[_0x4dfb('0x1f')]=_0x4f845e;if(_0x448186[_0x4dfb('0x36')][_0x4dfb('0x45')]){_0x4f9389[_0x4dfb('0x46')]=[{'all':!![]}];}return db[_0x4dfb('0x30')][_0x4dfb('0x47')](_0x4f9389);})[_0x4dfb('0x26')](function(_0x21160f){_0x50cc82[_0x4dfb('0x48')]=_0x21160f;return _0x50cc82;})[_0x4dfb('0x26')](respondWithFilteredResult(_0x4bc746,_0x4f9389))[_0x4dfb('0x49')](handleError(_0x4bc746,null));};exports[_0x4dfb('0x4a')]=function(_0x2143bb,_0x426611){var _0x526b48={'raw':![],'where':{'id':_0x2143bb['params']['id']}},_0x37a1cd={};_0x37a1cd[_0x4dfb('0x34')]=_['keys'](db[_0x4dfb('0x30')][_0x4dfb('0x31')]);_0x37a1cd[_0x4dfb('0x36')]=_['keys'](_0x2143bb[_0x4dfb('0x36')]);_0x37a1cd[_0x4dfb('0x37')]=_[_0x4dfb('0x38')](_0x37a1cd[_0x4dfb('0x34')],_0x37a1cd[_0x4dfb('0x36')]);_0x526b48['attributes']=_['intersection'](_0x37a1cd[_0x4dfb('0x34')],qs[_0x4dfb('0x3a')](_0x2143bb[_0x4dfb('0x36')][_0x4dfb('0x3a')]));_0x526b48[_0x4dfb('0x39')]=_0x526b48[_0x4dfb('0x39')][_0x4dfb('0x4b')]?_0x526b48['attributes']:_0x37a1cd[_0x4dfb('0x34')];if(_0x2143bb[_0x4dfb('0x36')][_0x4dfb('0x45')]){_0x526b48[_0x4dfb('0x46')]=[{'all':!![]}];}_0x526b48=_[_0x4dfb('0x42')]({},_0x526b48,_0x2143bb[_0x4dfb('0x44')]);return db[_0x4dfb('0x30')][_0x4dfb('0x4c')](_0x526b48)[_0x4dfb('0x26')](handleEntityNotFound(_0x426611,null))[_0x4dfb('0x26')](respondWithResult(_0x426611,null))[_0x4dfb('0x49')](handleError(_0x426611,null));};exports[_0x4dfb('0x4d')]=function(_0x307221,_0x2bfefd){if(_0x307221[_0x4dfb('0x4e')]['id']){delete _0x307221[_0x4dfb('0x4e')]['id'];}return db[_0x4dfb('0x30')][_0x4dfb('0x4c')]({'where':{'id':_0x307221[_0x4dfb('0x4f')]['id']}})[_0x4dfb('0x26')](handleEntityNotFound(_0x2bfefd,null))[_0x4dfb('0x26')](saveUpdates(_0x307221[_0x4dfb('0x4e')],null))[_0x4dfb('0x26')](respondWithResult(_0x2bfefd,null))['catch'](handleError(_0x2bfefd,null));};exports[_0x4dfb('0x50')]=function(_0x147c3a,_0x39e126,_0x3af70f){return db[_0x4dfb('0x51')]['transaction'](function(_0x2c1b9c){if(_0x147c3a[_0x4dfb('0x4e')][_0x4dfb('0x52')]===_0x4dfb('0x53')){_0x147c3a[_0x4dfb('0x4e')][_0x4dfb('0x54')]=path[_0x4dfb('0x55')](config[_0x4dfb('0x56')],_0x4dfb('0x57'),_0x147c3a[_0x4dfb('0x4e')][_0x4dfb('0x2c')]);}return db[_0x4dfb('0x30')][_0x4dfb('0x50')](_0x147c3a[_0x4dfb('0x4e')],{'transaction':_0x2c1b9c})[_0x4dfb('0x26')](function(_0x54d6a6){if(_0x147c3a[_0x4dfb('0x4e')]['mode']===_0x4dfb('0x53')){fs['mkdirSync'](_0x54d6a6[_0x4dfb('0x54')],parseInt(_0x4dfb('0x58'),0x8));}var _0x52f221=_0x147c3a[_0x4dfb('0x59')]['get']({'plain':!![]});if(!_0x52f221)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x52f221[_0x4dfb('0x5a')]==='user'){var _0x3c5fe0=_0x54d6a6[_0x4dfb('0x28')]({'plain':!![]});return db[_0x4dfb('0x5b')][_0x4dfb('0x4c')]({'where':{'name':_0x4dfb('0x29'),'userProfileId':_0x52f221[_0x4dfb('0x5c')]},'raw':!![]})[_0x4dfb('0x26')](function(_0x3a5d8d){if(_0x3a5d8d&&_0x3a5d8d[_0x4dfb('0x5d')]===0x0){return db[_0x4dfb('0x2a')][_0x4dfb('0x50')]({'name':_0x3c5fe0[_0x4dfb('0x2c')],'resourceId':_0x3c5fe0['id'],'type':_0x3a5d8d[_0x4dfb('0x2c')],'sectionId':_0x3a5d8d['id']},{})[_0x4dfb('0x26')](function(){return _0x54d6a6;});}else{return _0x54d6a6;}})['catch'](function(_0xa967e7){logger[_0x4dfb('0x5e')](_0x4dfb('0x5f'),_0xa967e7);});}return _0x54d6a6;});})[_0x4dfb('0x26')](respondWithResult(_0x39e126,0xc9))['catch'](handleError(_0x39e126,null));};exports['destroy']=function(_0x213816,_0x5764dc,_0x34e5c8){var _0x1f6879;return db[_0x4dfb('0x30')]['find']({'where':{'id':_0x213816[_0x4dfb('0x4f')]['id']}})[_0x4dfb('0x26')](function(_0x37670e){if(_0x37670e){return db[_0x4dfb('0x51')][_0x4dfb('0x60')](function(_0x32e85c){return _0x37670e[_0x4dfb('0x27')]({'transaction':_0x32e85c,'raw':!![]})[_0x4dfb('0x26')](function(_0x41b8f3){if(_0x41b8f3[_0x4dfb('0x54')]){fs['readdirSync'](_0x41b8f3[_0x4dfb('0x54')])[_0x4dfb('0x61')](function(_0x14420e){fs[_0x4dfb('0x62')](path[_0x4dfb('0x55')](_0x41b8f3[_0x4dfb('0x54')],_0x14420e));});fs[_0x4dfb('0x63')](_0x41b8f3[_0x4dfb('0x54')]);}return _0x41b8f3;});})[_0x4dfb('0x49')](function(_0x45b258){throw new db[(_0x4dfb('0x64'))][(_0x4dfb('0x65'))](_0x45b258[_0x4dfb('0x66')]);});}})[_0x4dfb('0x26')](handleEntityNotFound(_0x5764dc,null))['then'](removeEntity(_0x5764dc,null))['catch'](handleError(_0x5764dc,null));};exports[_0x4dfb('0x67')]=function(_0xd9ae98,_0x288c4b,_0x570ed4){return db[_0x4dfb('0x51')][_0x4dfb('0x60')](function(_0x3f90ee){var _0x5dc503;return db[_0x4dfb('0x30')]['find']({'where':{'id':_0xd9ae98['params']['id']}})[_0x4dfb('0x26')](function(_0xb0fbc9){if(_0xb0fbc9){_0x5dc503=_0xb0fbc9;return _0xb0fbc9[_0x4dfb('0x67')](_0xd9ae98['body']['id'],{'transaction':_0x3f90ee});}})[_0x4dfb('0x26')](function(_0x55d528){if(_0x55d528){return db[_0x4dfb('0x68')][_0x4dfb('0x69')]({'where':{'id':_0xd9ae98[_0x4dfb('0x4e')]['id']},'attributes':['id',_0x4dfb('0x2c'),_0x4dfb('0x6a'),_0x4dfb('0x6b'),'createdAt'],'raw':!![]});}})['then'](function(_0x35aef1){if(_0x35aef1){var _0x83ccf3=path[_0x4dfb('0x55')](config['root'],_0x4dfb('0x6c'),util[_0x4dfb('0x6d')](_0x4dfb('0x6e'),path[_0x4dfb('0x6f')](_0x35aef1[_0x4dfb('0x6a')],path[_0x4dfb('0x70')](_0x35aef1[_0x4dfb('0x6a')])),_0x35aef1[_0x4dfb('0x6b')]));var _0x4a4e9f=path[_0x4dfb('0x55')](config[_0x4dfb('0x56')],_0x4dfb('0x57'),_0x5dc503[_0x4dfb('0x2c')],util['format'](_0x4dfb('0x6e'),_0x35aef1['name'],_0x35aef1[_0x4dfb('0x6b')]));fs[_0x4dfb('0x71')](_0x83ccf3,_0x4a4e9f);return _0x35aef1;}})[_0x4dfb('0x49')](function(_0x5999a3){throw new db[(_0x4dfb('0x64'))][(_0x4dfb('0x65'))](_0x5999a3[_0x4dfb('0x66')]);});})['then'](handleEntityNotFound(_0x288c4b,null))['then'](respondWithResult(_0x288c4b,0xc9))[_0x4dfb('0x49')](handleError(_0x288c4b,null));};exports[_0x4dfb('0x72')]=function(_0x19d159,_0x9ef345,_0x1e08d2){return db[_0x4dfb('0x51')][_0x4dfb('0x60')](function(_0x1c0ae1){var _0x4478fd;return db[_0x4dfb('0x30')][_0x4dfb('0x69')]({'where':{'id':_0x19d159[_0x4dfb('0x4f')]['id']}})[_0x4dfb('0x26')](handleEntityNotFound(_0x9ef345,null))[_0x4dfb('0x26')](function(_0x2816ad){if(_0x2816ad){_0x4478fd=_0x2816ad;return _0x2816ad[_0x4dfb('0x72')](_0x19d159[_0x4dfb('0x4f')][_0x4dfb('0x73')]);}})['then'](function(_0x66bb3a){if(_0x66bb3a){return db['Sound']['findOne']({'where':{'id':_0x19d159[_0x4dfb('0x4f')]['id2']},'attributes':['id','name',_0x4dfb('0x6a'),_0x4dfb('0x6b'),'createdAt'],'raw':!![]});}})[_0x4dfb('0x26')](function(_0x309cb8){if(_0x309cb8){fs[_0x4dfb('0x62')](path['join'](_0x4478fd[_0x4dfb('0x54')],util[_0x4dfb('0x6d')](_0x4dfb('0x6e'),_0x309cb8[_0x4dfb('0x2c')],_0x309cb8[_0x4dfb('0x6b')])));return _0x309cb8;}})['catch'](function(_0x4383d3){throw new db['Sequelize']['ValidationError'](_0x4383d3['message']);});})['then'](handleEntityNotFound(_0x9ef345,null))[_0x4dfb('0x26')](respondWithStatusCode(_0x9ef345,0xcc))[_0x4dfb('0x49')](handleError(_0x9ef345,null));};exports[_0x4dfb('0x74')]=function(_0x86c9af,_0x29a3a2,_0x1c71b3){var _0x5610e3={};var _0x417f92={};var _0x1a23d6;var _0x45fad8;return db[_0x4dfb('0x30')]['findOne']({'where':{'id':_0x86c9af['params']['id']}})['then'](handleEntityNotFound(_0x29a3a2,null))[_0x4dfb('0x26')](function(_0x43611e){if(_0x43611e){_0x1a23d6=_0x43611e;_0x417f92[_0x4dfb('0x34')]=_['keys'](db[_0x4dfb('0x68')]['rawAttributes']);_0x417f92[_0x4dfb('0x36')]=_[_0x4dfb('0x35')](_0x86c9af[_0x4dfb('0x36')]);_0x417f92[_0x4dfb('0x37')]=_[_0x4dfb('0x38')](_0x417f92['model'],_0x417f92['query']);_0x5610e3['attributes']=_[_0x4dfb('0x38')](_0x417f92[_0x4dfb('0x34')],qs[_0x4dfb('0x3a')](_0x86c9af[_0x4dfb('0x36')][_0x4dfb('0x3a')]));_0x5610e3['attributes']=_0x5610e3['attributes'][_0x4dfb('0x4b')]?_0x5610e3[_0x4dfb('0x39')]:_0x417f92[_0x4dfb('0x34')];_0x5610e3[_0x4dfb('0x3d')]=qs[_0x4dfb('0x3e')](_0x86c9af[_0x4dfb('0x36')][_0x4dfb('0x3e')]);_0x5610e3[_0x4dfb('0x3f')]=qs[_0x4dfb('0x37')](_[_0x4dfb('0x40')](_0x86c9af['query'],_0x417f92['filters']));if(_0x86c9af[_0x4dfb('0x36')][_0x4dfb('0x41')]){_0x5610e3[_0x4dfb('0x3f')]=_[_0x4dfb('0x42')](_0x5610e3['where'],{'$or':_['map'](_0x5610e3['attributes'],function(_0xdc947c){var _0x558e72={};_0x558e72[_0xdc947c]={'$like':'%'+_0x86c9af[_0x4dfb('0x36')][_0x4dfb('0x41')]+'%'};return _0x558e72;})});}_0x5610e3=_[_0x4dfb('0x42')]({},_0x5610e3,_0x86c9af[_0x4dfb('0x44')]);return _0x1a23d6[_0x4dfb('0x74')](_0x5610e3);}})[_0x4dfb('0x26')](function(_0x6b8e8b){if(_0x6b8e8b){_0x45fad8=_0x6b8e8b[_0x4dfb('0x4b')];if(!_0x86c9af['query']['hasOwnProperty'](_0x4dfb('0x3c'))){_0x5610e3[_0x4dfb('0x1d')]=qs[_0x4dfb('0x1d')](_0x86c9af[_0x4dfb('0x36')]['limit']);_0x5610e3[_0x4dfb('0x20')]=qs[_0x4dfb('0x20')](_0x86c9af[_0x4dfb('0x36')][_0x4dfb('0x20')]);}return _0x1a23d6[_0x4dfb('0x74')](_0x5610e3);}})[_0x4dfb('0x26')](function(_0x4a6e82){if(_0x4a6e82){return _0x4a6e82?{'count':_0x45fad8,'rows':_0x4a6e82}:null;}})[_0x4dfb('0x26')](respondWithResult(_0x29a3a2,null))[_0x4dfb('0x49')](handleError(_0x29a3a2,null));}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js index 1ac015b..41200e3 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 _0xc32f=['moment','bluebird','request-promise','path','rimraf','./voiceMusicOnHold.attributes','VoiceMusicOnHold','voice_musiconhold','lodash','util'];(function(_0x3e10b5,_0x75ba59){var _0x1c98b7=function(_0x1910a7){while(--_0x1910a7){_0x3e10b5['push'](_0x3e10b5['shift']());}};_0x1c98b7(++_0x75ba59);}(_0xc32f,0xc6));var _0xfc32=function(_0x5aaa43,_0x3678ce){_0x5aaa43=_0x5aaa43-0x0;var _0x970433=_0xc32f[_0x5aaa43];return _0x970433;};'use strict';var _=require(_0xfc32('0x0'));var util=require(_0xfc32('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xfc32('0x2'));var BPromise=require(_0xfc32('0x3'));var rp=require(_0xfc32('0x4'));var fs=require('fs');var path=require(_0xfc32('0x5'));var rimraf=require(_0xfc32('0x6'));var config=require('../../config/environment');var attributes=require(_0xfc32('0x7'));module['exports']=function(_0x5db6a9,_0x70ef01){return _0x5db6a9['define'](_0xfc32('0x8'),attributes,{'tableName':_0xfc32('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7da8=['bluebird','request-promise','path','rimraf','../../config/environment','./voiceMusicOnHold.attributes','exports','define','VoiceMusicOnHold','util','../../config/logger','api','moment'];(function(_0x49f0bf,_0x2d7338){var _0x3aec47=function(_0x4feb86){while(--_0x4feb86){_0x49f0bf['push'](_0x49f0bf['shift']());}};_0x3aec47(++_0x2d7338);}(_0x7da8,0x127));var _0x87da=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0x7da8[_0x2b4411];return _0x8e41ef;};'use strict';var _=require('lodash');var util=require(_0x87da('0x0'));var logger=require(_0x87da('0x1'))(_0x87da('0x2'));var moment=require(_0x87da('0x3'));var BPromise=require(_0x87da('0x4'));var rp=require(_0x87da('0x5'));var fs=require('fs');var path=require(_0x87da('0x6'));var rimraf=require(_0x87da('0x7'));var config=require(_0x87da('0x8'));var attributes=require(_0x87da('0x9'));module[_0x87da('0xa')]=function(_0x2e17f8,_0x108fa7){return _0x2e17f8[_0x87da('0xb')](_0x87da('0xc'),attributes,{'tableName':'voice_musiconhold','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js index 1b98832..c3130cb 100644 --- a/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js +++ b/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['http','info','VoiceMusicOnHold,\x20%s,\x20%s','request\x20sent','debug','VoiceMusicOnHold,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x4b564a,_0x4bad99){var _0x20994f=function(_0x42a070){while(--_0x42a070){_0x4b564a['push'](_0x4b564a['shift']());}};_0x20994f(++_0x4bad99);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3ce3c,_0x319337){_0x3ce3c=_0x3ce3c-0x0;var _0x55a2c9=_0xa9e0[_0x3ce3c];return _0x55a2c9;};'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 _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(_0x3f82bb,_0x1944c2){var _0xaea81a=function(_0x4616d0){while(--_0x4616d0){_0x3f82bb['push'](_0x3f82bb['shift']());}};_0xaea81a(++_0x1944c2);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x14fad0,_0x278d75){_0x14fad0=_0x14fad0-0x0;var _0x5c665f=_0xcb91[_0x14fad0];return _0x5c665f;};'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 10b9c28..b65798b 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 _0x0738=['index','/describe','describe','show','/:id/users','getAgents','post','addAgents','addTeams','put','/:id','update','delete','destroy','/:id/teams','removeTeams','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./voicePrefix.controller','get','isAuthenticated'];(function(_0x1f7542,_0x44efdf){var _0x367fb3=function(_0x5a6618){while(--_0x5a6618){_0x1f7542['push'](_0x1f7542['shift']());}};_0x367fb3(++_0x44efdf);}(_0x0738,0xb9));var _0x8073=function(_0x55cdc5,_0x2b2297){_0x55cdc5=_0x55cdc5-0x0;var _0x29acd5=_0x0738[_0x55cdc5];return _0x29acd5;};'use strict';var multer=require(_0x8073('0x0'));var util=require(_0x8073('0x1'));var path=require(_0x8073('0x2'));var timeout=require(_0x8073('0x3'));var express=require(_0x8073('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x8073('0x5'));var interaction=require(_0x8073('0x6'));var config=require(_0x8073('0x7'));var controller=require(_0x8073('0x8'));router[_0x8073('0x9')]('/',auth[_0x8073('0xa')](),controller[_0x8073('0xb')]);router[_0x8073('0x9')](_0x8073('0xc'),auth[_0x8073('0xa')](),controller[_0x8073('0xd')]);router['get']('/:id',auth[_0x8073('0xa')](),controller[_0x8073('0xe')]);router['get'](_0x8073('0xf'),auth[_0x8073('0xa')](),controller[_0x8073('0x10')]);router[_0x8073('0x9')]('/:id/teams',auth[_0x8073('0xa')](),controller['getTeams']);router[_0x8073('0x11')]('/',auth['isAuthenticated'](),controller['create']);router[_0x8073('0x11')](_0x8073('0xf'),auth['isAuthenticated'](),controller[_0x8073('0x12')]);router[_0x8073('0x11')]('/:id/teams',auth[_0x8073('0xa')](),controller[_0x8073('0x13')]);router[_0x8073('0x14')](_0x8073('0x15'),auth['isAuthenticated'](),controller[_0x8073('0x16')]);router[_0x8073('0x17')](_0x8073('0x15'),auth[_0x8073('0xa')](),controller[_0x8073('0x18')]);router[_0x8073('0x17')]('/:id/users',auth[_0x8073('0xa')](),controller['removeAgents']);router[_0x8073('0x17')](_0x8073('0x19'),auth['isAuthenticated'](),controller[_0x8073('0x1a')]);module[_0x8073('0x1b')]=router; \ No newline at end of file +var _0xd4c5=['removeTeams','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/users','getTeams','post','addAgents','/:id/teams','addTeams','put','update','delete','destroy','removeAgents'];(function(_0xc3e2ac,_0x184cde){var _0x62e8c=function(_0x24c7d5){while(--_0x24c7d5){_0xc3e2ac['push'](_0xc3e2ac['shift']());}};_0x62e8c(++_0x184cde);}(_0xd4c5,0x1d2));var _0x5d4c=function(_0x321d7c,_0x116466){_0x321d7c=_0x321d7c-0x0;var _0x5f474d=_0xd4c5[_0x321d7c];return _0x5f474d;};'use strict';var multer=require(_0x5d4c('0x0'));var util=require(_0x5d4c('0x1'));var path=require(_0x5d4c('0x2'));var timeout=require('connect-timeout');var express=require(_0x5d4c('0x3'));var router=express[_0x5d4c('0x4')]();var fs_extra=require(_0x5d4c('0x5'));var auth=require(_0x5d4c('0x6'));var interaction=require(_0x5d4c('0x7'));var config=require(_0x5d4c('0x8'));var controller=require('./voicePrefix.controller');router[_0x5d4c('0x9')]('/',auth[_0x5d4c('0xa')](),controller[_0x5d4c('0xb')]);router[_0x5d4c('0x9')](_0x5d4c('0xc'),auth[_0x5d4c('0xa')](),controller[_0x5d4c('0xd')]);router[_0x5d4c('0x9')](_0x5d4c('0xe'),auth[_0x5d4c('0xa')](),controller[_0x5d4c('0xf')]);router[_0x5d4c('0x9')](_0x5d4c('0x10'),auth[_0x5d4c('0xa')](),controller['getAgents']);router[_0x5d4c('0x9')]('/:id/teams',auth[_0x5d4c('0xa')](),controller[_0x5d4c('0x11')]);router[_0x5d4c('0x12')]('/',auth[_0x5d4c('0xa')](),controller['create']);router[_0x5d4c('0x12')](_0x5d4c('0x10'),auth[_0x5d4c('0xa')](),controller[_0x5d4c('0x13')]);router['post'](_0x5d4c('0x14'),auth[_0x5d4c('0xa')](),controller[_0x5d4c('0x15')]);router[_0x5d4c('0x16')](_0x5d4c('0xe'),auth[_0x5d4c('0xa')](),controller[_0x5d4c('0x17')]);router[_0x5d4c('0x18')](_0x5d4c('0xe'),auth['isAuthenticated'](),controller[_0x5d4c('0x19')]);router[_0x5d4c('0x18')](_0x5d4c('0x10'),auth[_0x5d4c('0xa')](),controller[_0x5d4c('0x1a')]);router['delete'](_0x5d4c('0x14'),auth[_0x5d4c('0xa')](),controller[_0x5d4c('0x1b')]);module[_0x5d4c('0x1c')]=router; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.attributes.js b/server/api/voicePrefix/voicePrefix.attributes.js index 7786fcf..8b3ad3c 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 _0x0041=['VIRTUAL','system-','getDataValue','INTEGER','sequelize','exports','STRING','name'];(function(_0x11ca3c,_0x40d0a3){var _0x496daf=function(_0x2a42d8){while(--_0x2a42d8){_0x11ca3c['push'](_0x11ca3c['shift']());}};_0x496daf(++_0x40d0a3);}(_0x0041,0xbc));var _0x1004=function(_0x27a31a,_0x241ba2){_0x27a31a=_0x27a31a-0x0;var _0xd0f9ba=_0x0041[_0x27a31a];return _0xd0f9ba;};'use strict';var Sequelize=require(_0x1004('0x0'));module[_0x1004('0x1')]={'name':{'type':Sequelize[_0x1004('0x2')],'allowNull':![],'unique':_0x1004('0x3')},'prefix':{'type':Sequelize[_0x1004('0x4')],'get':function(_0x12cdae){return _0x1004('0x5')+this[_0x1004('0x6')](_0x1004('0x3'))+'-';}},'description':{'type':Sequelize[_0x1004('0x2')]},'callerIdAll':{'type':Sequelize[_0x1004('0x2')]},'VoiceExtensionId':{'type':Sequelize[_0x1004('0x7')]}}; \ No newline at end of file +var _0x04b7=['system-','getDataValue','sequelize','exports','STRING','name','VIRTUAL'];(function(_0x403211,_0xa7ad5b){var _0x4721e4=function(_0x443b2f){while(--_0x443b2f){_0x403211['push'](_0x403211['shift']());}};_0x4721e4(++_0xa7ad5b);}(_0x04b7,0x160));var _0x704b=function(_0x1ee2ae,_0x17c0eb){_0x1ee2ae=_0x1ee2ae-0x0;var _0x1780e5=_0x04b7[_0x1ee2ae];return _0x1780e5;};'use strict';var Sequelize=require(_0x704b('0x0'));module[_0x704b('0x1')]={'name':{'type':Sequelize[_0x704b('0x2')],'allowNull':![],'unique':_0x704b('0x3')},'prefix':{'type':Sequelize[_0x704b('0x4')],'get':function(_0x3d9f9d){return _0x704b('0x5')+this[_0x704b('0x6')]('name')+'-';}},'description':{'type':Sequelize[_0x704b('0x2')]},'callerIdAll':{'type':Sequelize[_0x704b('0x2')]},'VoiceExtensionId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.controller.js b/server/api/voicePrefix/voicePrefix.controller.js index dc94563..15f2095 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 _0x4024=['../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./voicePrefix.socket','register','sendStatus','status','end','json','undefined','limit','count','offset','set','apply','reject','save','then','destroy','VoicePrefixes','UserProfileResource','error','stack','name','send','index','VoicePrefix','rawAttributes','fieldName','type','model','map','keys','query','intersection','attributes','fields','length','hasOwnProperty','order','sort','filters','pick','where','merge','VIRTUAL','filter','includeAll','include','findAll','rows','show','params','find','catch','describe','create','transaction','body','get','VoiceExtension','VoiceExtensionId','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','context','from-sip','app','system','description','Voice\x20Prefix\x20Extension','appdata','prefix','Voice\x20Prefix','VoicePrefixId','Extensions\x20creation\x20failed','push','Set','callerIdAll','PREFIX-CALLERIDALL=','NoOp','No\x20callerid\x20available','goto','${EXTEN:','charAt','update','system-','sequelize','findById','addAgents','ids','omit','spread','emit','userVoicePrefix:save','removeAgents','userVoicePrefix:remove','getAgents','findOne','User','options','nolimit','getTeams','addTeams','Team','online','voicePause','flatMap','Agents','each','TeamVoicePrefix','upsert','UserVoicePrefix','findOrCreate','select','team_has_voice_prefixes','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoicePrefixId\x20=\x20?','ut.UserId\x20=\x20?','toString','SELECT','every','includes','all','union','compact','value','forEach','eml-format','rimraf','fast-json-patch','request-promise','bluebird','util','path','ejs','fs-extra','lodash','crypto','to-csv','ioredis'];(function(_0x4eab00,_0x5a4036){var _0x1488d3=function(_0x425473){while(--_0x425473){_0x4eab00['push'](_0x4eab00['shift']());}};_0x1488d3(++_0x5a4036);}(_0x4024,0x89));var _0x4402=function(_0x10d768,_0x5cf3bc){_0x10d768=_0x10d768-0x0;var _0x41e3ac=_0x4024[_0x10d768];return _0x41e3ac;};'use strict';var emlformat=require(_0x4402('0x0'));var rimraf=require(_0x4402('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4402('0x2'));var rp=require(_0x4402('0x3'));var moment=require('moment');var BPromise=require(_0x4402('0x4'));var Mustache=require('mustache');var util=require(_0x4402('0x5'));var path=require(_0x4402('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x4402('0x7'));var fs=require('fs');var fs_extra=require(_0x4402('0x8'));var _=require(_0x4402('0x9'));var squel=require('squel');var crypto=require(_0x4402('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x4402('0xb'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x4402('0xc'));var authService=require('../../components/auth/service');var qs=require(_0x4402('0xd'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4402('0xe'));var logger=require('../../config/logger')(_0x4402('0xf'));var utils=require(_0x4402('0x10'));var config=require('../../config/environment');var licenseUtil=require(_0x4402('0x11'));var db=require(_0x4402('0x12'))['db'];config[_0x4402('0x13')]=_['defaults'](config[_0x4402('0x13')],{'host':_0x4402('0x14'),'port':0x18eb});var socket=require(_0x4402('0x15'))(new Redis(config[_0x4402('0x13')]));require(_0x4402('0x16'))[_0x4402('0x17')](socket);function respondWithStatusCode(_0x18c7a8,_0x3c7dd2){_0x3c7dd2=_0x3c7dd2||0xcc;return function(_0x295ac5){if(_0x295ac5){return _0x18c7a8[_0x4402('0x18')](_0x3c7dd2);}return _0x18c7a8[_0x4402('0x19')](_0x3c7dd2)[_0x4402('0x1a')]();};}function respondWithResult(_0x2a2ce8,_0x19fe7b){_0x19fe7b=_0x19fe7b||0xc8;return function(_0xfd9853){if(_0xfd9853){return _0x2a2ce8[_0x4402('0x19')](_0x19fe7b)[_0x4402('0x1b')](_0xfd9853);}};}function respondWithFilteredResult(_0x25e88b,_0x186c22){return function(_0x231382){if(_0x231382){var _0x5b127f=typeof _0x186c22['offset']===_0x4402('0x1c')&&typeof _0x186c22[_0x4402('0x1d')]==='undefined';var _0x756962=_0x231382[_0x4402('0x1e')];var _0x5cb0c5=_0x5b127f?0x0:_0x186c22[_0x4402('0x1f')];var _0x4e0340=_0x5b127f?_0x231382['count']:_0x186c22[_0x4402('0x1f')]+_0x186c22[_0x4402('0x1d')];var _0x28f44b;if(_0x4e0340>=_0x756962){_0x4e0340=_0x756962;_0x28f44b=0xc8;}else{_0x28f44b=0xce;}_0x25e88b['status'](_0x28f44b);return _0x25e88b[_0x4402('0x20')]('Content-Range',_0x5cb0c5+'-'+_0x4e0340+'/'+_0x756962)['json'](_0x231382);}return null;};}function patchUpdates(_0x6f1f72){return function(_0x275c70){try{jsonpatch[_0x4402('0x21')](_0x275c70,_0x6f1f72,!![]);}catch(_0xc583b){return BPromise[_0x4402('0x22')](_0xc583b);}return _0x275c70[_0x4402('0x23')]();};}function saveUpdates(_0x289a3e,_0x6b1fc5){return function(_0x24a9b8){if(_0x24a9b8){return _0x24a9b8['update'](_0x289a3e)[_0x4402('0x24')](function(_0x4e1c04){return _0x4e1c04;});}return null;};}function removeEntity(_0x3733cd,_0x5ab28d){return function(_0x29f56b){if(_0x29f56b){return _0x29f56b[_0x4402('0x25')]()['then'](function(){var _0x15c19f=_0x29f56b['get']({'plain':!![]});var _0x59d52f=_0x4402('0x26');return db[_0x4402('0x27')][_0x4402('0x25')]({'where':{'type':_0x59d52f,'resourceId':_0x15c19f['id']}})[_0x4402('0x24')](function(){return _0x29f56b;});})[_0x4402('0x24')](function(){_0x3733cd['status'](0xcc)[_0x4402('0x1a')]();});}};}function handleEntityNotFound(_0x52e625,_0x71da2f){return function(_0x1e2340){if(!_0x1e2340){_0x52e625[_0x4402('0x18')](0x194);}return _0x1e2340;};}function handleError(_0x48d20d,_0x38037e){_0x38037e=_0x38037e||0x1f4;return function(_0x6c87f6){logger[_0x4402('0x28')](_0x6c87f6[_0x4402('0x29')]);if(_0x6c87f6[_0x4402('0x2a')]){delete _0x6c87f6[_0x4402('0x2a')];}_0x48d20d[_0x4402('0x19')](_0x38037e)[_0x4402('0x2b')](_0x6c87f6);};}exports[_0x4402('0x2c')]=function(_0xd46d0,_0xcea26b){var _0x50748c={},_0x39f3fc={},_0x4d8d1a={'count':0x0,'rows':[]};var _0x336168=_['map'](db[_0x4402('0x2d')][_0x4402('0x2e')],function(_0x145003){return{'name':_0x145003[_0x4402('0x2f')],'type':_0x145003[_0x4402('0x30')]['key']};});_0x39f3fc[_0x4402('0x31')]=_[_0x4402('0x32')](_0x336168,_0x4402('0x2a'));_0x39f3fc['query']=_[_0x4402('0x33')](_0xd46d0[_0x4402('0x34')]);_0x39f3fc['filters']=_[_0x4402('0x35')](_0x39f3fc[_0x4402('0x31')],_0x39f3fc[_0x4402('0x34')]);_0x50748c[_0x4402('0x36')]=_[_0x4402('0x35')](_0x39f3fc[_0x4402('0x31')],qs[_0x4402('0x37')](_0xd46d0[_0x4402('0x34')][_0x4402('0x37')]));_0x50748c['attributes']=_0x50748c[_0x4402('0x36')][_0x4402('0x38')]?_0x50748c[_0x4402('0x36')]:_0x39f3fc['model'];if(!_0xd46d0[_0x4402('0x34')][_0x4402('0x39')]('nolimit')){_0x50748c['limit']=qs[_0x4402('0x1d')](_0xd46d0[_0x4402('0x34')][_0x4402('0x1d')]);_0x50748c[_0x4402('0x1f')]=qs['offset'](_0xd46d0['query']['offset']);}_0x50748c[_0x4402('0x3a')]=qs[_0x4402('0x3b')](_0xd46d0[_0x4402('0x34')][_0x4402('0x3b')]);_0x50748c['where']=qs[_0x4402('0x3c')](_[_0x4402('0x3d')](_0xd46d0[_0x4402('0x34')],_0x39f3fc['filters']),_0x336168);if(_0xd46d0[_0x4402('0x34')]['filter']){_0x50748c[_0x4402('0x3e')]=_[_0x4402('0x3f')](_0x50748c['where'],{'$or':_[_0x4402('0x32')](_0x336168,function(_0x529526){if(_0x529526[_0x4402('0x30')]!==_0x4402('0x40')){var _0x5a4e88={};_0x5a4e88[_0x529526[_0x4402('0x2a')]]={'$like':'%'+_0xd46d0[_0x4402('0x34')][_0x4402('0x41')]+'%'};return _0x5a4e88;}})});}_0x50748c=_[_0x4402('0x3f')]({},_0x50748c,_0xd46d0['options']);var _0x540440={'where':_0x50748c[_0x4402('0x3e')]};return db['VoicePrefix'][_0x4402('0x1e')](_0x540440)[_0x4402('0x24')](function(_0xb9cf85){_0x4d8d1a[_0x4402('0x1e')]=_0xb9cf85;if(_0xd46d0[_0x4402('0x34')][_0x4402('0x42')]){_0x50748c[_0x4402('0x43')]=[{'all':!![]}];}return db[_0x4402('0x2d')][_0x4402('0x44')](_0x50748c);})[_0x4402('0x24')](function(_0x486e43){_0x4d8d1a[_0x4402('0x45')]=_0x486e43;return _0x4d8d1a;})[_0x4402('0x24')](respondWithFilteredResult(_0xcea26b,_0x50748c))['catch'](handleError(_0xcea26b,null));};exports[_0x4402('0x46')]=function(_0x370878,_0x50552a){var _0x4115d6={'raw':![],'where':{'id':_0x370878[_0x4402('0x47')]['id']}},_0x40187f={};_0x40187f[_0x4402('0x31')]=_[_0x4402('0x33')](db['VoicePrefix'][_0x4402('0x2e')]);_0x40187f[_0x4402('0x34')]=_[_0x4402('0x33')](_0x370878[_0x4402('0x34')]);_0x40187f[_0x4402('0x3c')]=_[_0x4402('0x35')](_0x40187f[_0x4402('0x31')],_0x40187f[_0x4402('0x34')]);_0x4115d6[_0x4402('0x36')]=_[_0x4402('0x35')](_0x40187f[_0x4402('0x31')],qs['fields'](_0x370878[_0x4402('0x34')]['fields']));_0x4115d6[_0x4402('0x36')]=_0x4115d6[_0x4402('0x36')]['length']?_0x4115d6[_0x4402('0x36')]:_0x40187f[_0x4402('0x31')];if(_0x370878[_0x4402('0x34')][_0x4402('0x42')]){_0x4115d6[_0x4402('0x43')]=[{'all':!![]}];}_0x4115d6=_[_0x4402('0x3f')]({},_0x4115d6,_0x370878['options']);return db[_0x4402('0x2d')][_0x4402('0x48')](_0x4115d6)[_0x4402('0x24')](handleEntityNotFound(_0x50552a,null))[_0x4402('0x24')](respondWithResult(_0x50552a,null))[_0x4402('0x49')](handleError(_0x50552a,null));};exports[_0x4402('0x25')]=function(_0x43cfbd,_0x2e3934){return db[_0x4402('0x2d')]['find']({'where':{'id':_0x43cfbd['params']['id']}})['then'](handleEntityNotFound(_0x2e3934,null))['then'](removeEntity(_0x2e3934,null))[_0x4402('0x49')](handleError(_0x2e3934,null));};exports[_0x4402('0x4a')]=function(_0x3876a9,_0x3fe6b4){return db['VoicePrefix'][_0x4402('0x4a')]()[_0x4402('0x24')](respondWithResult(_0x3fe6b4,null))[_0x4402('0x49')](handleError(_0x3fe6b4,null));};exports[_0x4402('0x4b')]=function(_0x196b2f,_0x352898){var _0x12f1fa;return db['sequelize'][_0x4402('0x4c')](function(_0x2a8085){return db[_0x4402('0x2d')][_0x4402('0x4b')](_0x196b2f[_0x4402('0x4d')],{'transaction':_0x2a8085})[_0x4402('0x24')](function(_0x5477fd){_0x12f1fa=_0x5477fd[_0x4402('0x4e')]({'plain':!![]});return db[_0x4402('0x4f')][_0x4402('0x48')]({'where':{'id':_0x12f1fa[_0x4402('0x50')]},'raw':!![]})[_0x4402('0x24')](function(_0x476bf5){return createVoicePrefixExtensions(_0x12f1fa,_0x476bf5,_0x2a8085);});});})[_0x4402('0x24')](function(){var _0x5dbf62=_0x196b2f['user'][_0x4402('0x4e')]({'plain':!![]});if(!_0x5dbf62)throw new Error(_0x4402('0x51'));if(_0x5dbf62[_0x4402('0x52')]==='user'){var _0x5a076a=_0x12f1fa;return db[_0x4402('0x53')][_0x4402('0x48')]({'where':{'name':_0x4402('0x26'),'userProfileId':_0x5dbf62[_0x4402('0x54')]},'raw':!![]})[_0x4402('0x24')](function(_0x37ba14){if(_0x37ba14&&_0x37ba14[_0x4402('0x55')]===0x0){return db[_0x4402('0x27')][_0x4402('0x4b')]({'name':_0x5a076a[_0x4402('0x2a')],'resourceId':_0x5a076a['id'],'type':_0x37ba14[_0x4402('0x2a')],'sectionId':_0x37ba14['id']},{})[_0x4402('0x24')](function(){return _0x12f1fa;});}else{return _0x12f1fa;}})[_0x4402('0x49')](function(_0x4fd479){logger[_0x4402('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4fd479);throw _0x4fd479;});}return _0x12f1fa;})[_0x4402('0x24')](respondWithResult(_0x352898,null))['catch'](handleError(_0x352898,null));};function Extension(_0x3fb9f0,_0x1e5891,_0x1e4f1a,_0x31e36c){this[_0x4402('0x56')]=_0x4402('0x57');this['exten']=_0x3fb9f0;this[_0x4402('0x58')]=_0x1e4f1a;this[_0x4402('0x30')]=_0x4402('0x59');this[_0x4402('0x5a')]=_0x4402('0x5b');this['priority']=_0x1e5891;this[_0x4402('0x5c')]=_0x31e36c;}function createVoicePrefixExtensions(_0x31d993,_0x474b04,_0xc15c0b){return new BPromise(function(_0x309077,_0x3f8e3b){var _0x33b605=new Extension(formatPrefixName(_0x31d993[_0x4402('0x5d')]),0x1,'NoOp',_0x4402('0x5e'));_0x33b605[_0x4402('0x5f')]=_0x31d993['id'];return db['VoiceExtension'][_0x4402('0x4b')](_0x33b605,{'transaction':_0xc15c0b})[_0x4402('0x24')](function(_0x582668){var _0x5218c6=_0x582668[_0x4402('0x4e')]({'plain':!![]});var _0x1746c6=_[_0x4402('0x32')](addVoicePrefixExtensions(_0x31d993,_0x474b04),function(_0x5c6121){_0x5c6121[_0x4402('0x50')]=_0x5218c6['id'];_0x5c6121[_0x4402('0x5f')]=_0x31d993['id'];return _0x5c6121;});return db[_0x4402('0x4f')]['bulkCreate'](_0x1746c6,{'transaction':_0xc15c0b})[_0x4402('0x24')](function(_0x41a2c6){if(!_0x41a2c6){return _0x3f8e3b(_0x4402('0x60'));}else{return _0x309077(_0x41a2c6);}})['catch'](function(_0x13f0d3){return _0x3f8e3b(_0x13f0d3);});});;});};function addVoicePrefixExtensions(_0x110e0f,_0x4f9865){var _0x5cef56=[];var _0x40869c=formatPrefixName(_0x110e0f['prefix']);_0x5cef56[_0x4402('0x61')](new Extension(_0x40869c,0x2,_0x4402('0x62'),'CDR(prefix)='+_0x110e0f['name']));if(_0x110e0f[_0x4402('0x63')]){_0x5cef56[_0x4402('0x61')](new Extension(_0x40869c,0x3,_0x4402('0x62'),_0x4402('0x64')+_0x110e0f['callerIdAll']));}else{_0x5cef56[_0x4402('0x61')](new Extension(_0x40869c,0x3,_0x4402('0x65'),_0x4402('0x66')));}_0x5cef56[_0x4402('0x61')](new Extension(_0x40869c,0x4,_0x4402('0x67'),_0x4f9865[_0x4402('0x56')]+','+_0x4402('0x68')+(0x8+_0x110e0f['name'][_0x4402('0x38')])+'}'+','+0x1));return _0x5cef56;}function formatPrefixName(_0x2ee6e8){var _0x559d1c='_';for(var _0x508111=0x0;_0x508111<_0x2ee6e8[_0x4402('0x38')];_0x508111++){if(_0x2ee6e8['charAt'](_0x508111)=='-'){_0x559d1c+=_0x2ee6e8[_0x4402('0x69')](_0x508111);}else{_0x559d1c+='['+_0x2ee6e8['charAt'](_0x508111)+']';}}_0x559d1c+='.';return _0x559d1c;}exports[_0x4402('0x6a')]=function(_0x10b89a,_0x22260b,_0x3f196a){var _0x3c89bf=_0x10b89a[_0x4402('0x4d')];_0x3c89bf[_0x4402('0x5d')]=_0x4402('0x6b')+_0x3c89bf[_0x4402('0x2a')]+'-';return db[_0x4402('0x6c')][_0x4402('0x4c')](function(_0xfd35f7){return db[_0x4402('0x2d')][_0x4402('0x6a')](_0x3c89bf,{'where':{'id':_0x3c89bf['id']},'transaction':_0xfd35f7})[_0x4402('0x24')](function(){return db[_0x4402('0x4f')]['destroy']({'where':{'VoicePrefixId':_0x3c89bf['id']},'transaction':_0xfd35f7})[_0x4402('0x24')](function(){return db[_0x4402('0x4f')][_0x4402('0x48')]({'where':{'id':_0x3c89bf['VoiceExtensionId']},'raw':!![]})[_0x4402('0x24')](function(_0x4a79b6){return createVoicePrefixExtensions(_0x3c89bf,_0x4a79b6,_0xfd35f7);});});});})[_0x4402('0x24')](function(){return db[_0x4402('0x2d')][_0x4402('0x6d')](_0x3c89bf['id']);})[_0x4402('0x24')](respondWithResult(_0x22260b,null))['catch'](handleError(_0x22260b,null));};exports[_0x4402('0x6e')]=function(_0x5ce15c,_0x127d47,_0x925736){return db[_0x4402('0x2d')]['find']({'where':{'id':_0x5ce15c[_0x4402('0x47')]['id']}})['then'](handleEntityNotFound(_0x127d47,null))[_0x4402('0x24')](function(_0x39ccc9){if(_0x39ccc9){return _0x39ccc9[_0x4402('0x6e')](_0x5ce15c[_0x4402('0x4d')][_0x4402('0x6f')],_[_0x4402('0x70')](_0x5ce15c[_0x4402('0x4d')],[_0x4402('0x6f'),'id'])||{})[_0x4402('0x71')](function(_0x5054f9){for(var _0x44d806=0x0;_0x44d806<_0x5ce15c[_0x4402('0x4d')][_0x4402('0x6f')][_0x4402('0x38')];_0x44d806+=0x1){socket[_0x4402('0x72')](_0x4402('0x73'),{'UserId':Number(_0x5ce15c[_0x4402('0x4d')][_0x4402('0x6f')][_0x44d806]),'VoicePrefixId':Number(_0x5ce15c[_0x4402('0x47')]['id'])});}return _0x5054f9;});}})['then'](respondWithResult(_0x127d47,null))[_0x4402('0x49')](handleError(_0x127d47,null));};exports[_0x4402('0x74')]=function(_0x2eae1c,_0x4c4845,_0xb5f21c){return db['VoicePrefix'][_0x4402('0x48')]({'where':{'id':_0x2eae1c['params']['id']}})[_0x4402('0x24')](handleEntityNotFound(_0x4c4845,null))[_0x4402('0x24')](function(_0x552962){if(_0x552962){return _0x552962[_0x4402('0x74')](_0x2eae1c['query'][_0x4402('0x6f')])[_0x4402('0x24')](function(){if(_['isArray'](_0x2eae1c[_0x4402('0x34')][_0x4402('0x6f')])){for(var _0x50f5ed=0x0;_0x50f5ed<_0x2eae1c[_0x4402('0x34')][_0x4402('0x6f')]['length'];_0x50f5ed+=0x1){socket[_0x4402('0x72')](_0x4402('0x75'),{'UserId':Number(_0x2eae1c[_0x4402('0x34')][_0x4402('0x6f')][_0x50f5ed]),'VoicePrefixId':Number(_0x2eae1c[_0x4402('0x47')]['id'])});}}else{socket[_0x4402('0x72')](_0x4402('0x75'),{'UserId':Number(_0x2eae1c[_0x4402('0x34')][_0x4402('0x6f')]),'VoicePrefixId':Number(_0x2eae1c[_0x4402('0x47')]['id'])});}});}})[_0x4402('0x24')](respondWithStatusCode(_0x4c4845,null))[_0x4402('0x49')](handleError(_0x4c4845,null));};exports[_0x4402('0x76')]=function(_0x2dd4b7,_0x5359ec,_0x1bc518){var _0xc3914e={};var _0x4b9ac8={};var _0x3f70a3;var _0x4eb578;return db[_0x4402('0x2d')][_0x4402('0x77')]({'where':{'id':_0x2dd4b7[_0x4402('0x47')]['id']}})['then'](handleEntityNotFound(_0x5359ec,null))[_0x4402('0x24')](function(_0x26fc3a){if(_0x26fc3a){_0x3f70a3=_0x26fc3a;_0x4b9ac8[_0x4402('0x31')]=_['keys'](db[_0x4402('0x78')][_0x4402('0x2e')]);_0x4b9ac8[_0x4402('0x34')]=_[_0x4402('0x33')](_0x2dd4b7['query']);_0x4b9ac8[_0x4402('0x3c')]=_[_0x4402('0x35')](_0x4b9ac8[_0x4402('0x31')],_0x4b9ac8[_0x4402('0x34')]);_0xc3914e[_0x4402('0x36')]=_[_0x4402('0x35')](_0x4b9ac8[_0x4402('0x31')],qs[_0x4402('0x37')](_0x2dd4b7[_0x4402('0x34')][_0x4402('0x37')]));_0xc3914e[_0x4402('0x36')]=_0xc3914e[_0x4402('0x36')][_0x4402('0x38')]?_0xc3914e['attributes']:_0x4b9ac8[_0x4402('0x31')];_0xc3914e[_0x4402('0x3a')]=qs[_0x4402('0x3b')](_0x2dd4b7[_0x4402('0x34')]['sort']);_0xc3914e['where']=qs[_0x4402('0x3c')](_[_0x4402('0x3d')](_0x2dd4b7[_0x4402('0x34')],_0x4b9ac8[_0x4402('0x3c')]));if(_0x2dd4b7['query'][_0x4402('0x41')]){_0xc3914e[_0x4402('0x3e')]=_['merge'](_0xc3914e[_0x4402('0x3e')],{'$or':_[_0x4402('0x32')](_0xc3914e[_0x4402('0x36')],function(_0x1271eb){var _0x297884={};_0x297884[_0x1271eb]={'$like':'%'+_0x2dd4b7['query'][_0x4402('0x41')]+'%'};return _0x297884;})});}_0xc3914e=_[_0x4402('0x3f')]({},_0xc3914e,_0x2dd4b7[_0x4402('0x79')]);return _0x3f70a3[_0x4402('0x76')](_0xc3914e);}})[_0x4402('0x24')](function(_0x1a2822){if(_0x1a2822){_0x4eb578=_0x1a2822[_0x4402('0x38')];if(!_0x2dd4b7['query'][_0x4402('0x39')](_0x4402('0x7a'))){_0xc3914e[_0x4402('0x1d')]=qs[_0x4402('0x1d')](_0x2dd4b7[_0x4402('0x34')]['limit']);_0xc3914e[_0x4402('0x1f')]=qs[_0x4402('0x1f')](_0x2dd4b7['query'][_0x4402('0x1f')]);}return _0x3f70a3['getAgents'](_0xc3914e);}})['then'](function(_0x364a26){if(_0x364a26){return _0x364a26?{'count':_0x4eb578,'rows':_0x364a26}:null;}})['then'](respondWithResult(_0x5359ec,null))[_0x4402('0x49')](handleError(_0x5359ec,null));};exports['getTeams']=function(_0x51e85d,_0x16af14,_0x7adf6d){var _0x43c796={};var _0x1f1222={};var _0x24bfa6;var _0x32b047;return db['VoicePrefix'][_0x4402('0x77')]({'where':{'id':_0x51e85d[_0x4402('0x47')]['id']}})['then'](handleEntityNotFound(_0x16af14,null))[_0x4402('0x24')](function(_0x48940e){if(_0x48940e){_0x24bfa6=_0x48940e;_0x1f1222['model']=_[_0x4402('0x33')](db['Team'][_0x4402('0x2e')]);_0x1f1222[_0x4402('0x34')]=_[_0x4402('0x33')](_0x51e85d[_0x4402('0x34')]);_0x1f1222[_0x4402('0x3c')]=_['intersection'](_0x1f1222['model'],_0x1f1222[_0x4402('0x34')]);_0x43c796[_0x4402('0x36')]=_['intersection'](_0x1f1222[_0x4402('0x31')],qs[_0x4402('0x37')](_0x51e85d[_0x4402('0x34')][_0x4402('0x37')]));_0x43c796[_0x4402('0x36')]=_0x43c796[_0x4402('0x36')]['length']?_0x43c796['attributes']:_0x1f1222[_0x4402('0x31')];_0x43c796[_0x4402('0x3a')]=qs[_0x4402('0x3b')](_0x51e85d[_0x4402('0x34')][_0x4402('0x3b')]);_0x43c796[_0x4402('0x3e')]=qs['filters'](_[_0x4402('0x3d')](_0x51e85d[_0x4402('0x34')],_0x1f1222[_0x4402('0x3c')]));if(_0x51e85d[_0x4402('0x34')][_0x4402('0x41')]){_0x43c796['where']=_[_0x4402('0x3f')](_0x43c796[_0x4402('0x3e')],{'$or':_[_0x4402('0x32')](_0x43c796[_0x4402('0x36')],function(_0x3b89e8){var _0x813e1b={};_0x813e1b[_0x3b89e8]={'$like':'%'+_0x51e85d['query']['filter']+'%'};return _0x813e1b;})});}_0x43c796=_[_0x4402('0x3f')]({},_0x43c796,_0x51e85d['options']);return _0x24bfa6[_0x4402('0x7b')](_0x43c796);}})[_0x4402('0x24')](function(_0x3eb205){if(_0x3eb205){_0x32b047=_0x3eb205[_0x4402('0x38')];if(!_0x51e85d[_0x4402('0x34')][_0x4402('0x39')](_0x4402('0x7a'))){_0x43c796[_0x4402('0x1d')]=qs[_0x4402('0x1d')](_0x51e85d[_0x4402('0x34')][_0x4402('0x1d')]);_0x43c796[_0x4402('0x1f')]=qs[_0x4402('0x1f')](_0x51e85d[_0x4402('0x34')][_0x4402('0x1f')]);}return _0x24bfa6[_0x4402('0x7b')](_0x43c796);}})[_0x4402('0x24')](function(_0x325eeb){if(_0x325eeb){return _0x325eeb?{'count':_0x32b047,'rows':_0x325eeb}:null;}})[_0x4402('0x24')](respondWithResult(_0x16af14,null))[_0x4402('0x49')](handleError(_0x16af14,null));};exports[_0x4402('0x7c')]=function(_0x385b8e,_0x418070,_0x47a76a){var _0xdd829a=_0x385b8e[_0x4402('0x4d')][_0x4402('0x6f')];var _0x2631bc;return db[_0x4402('0x7d')][_0x4402('0x44')]({'where':{'id':_0xdd829a},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id',_0x4402('0x2a'),_0x4402('0x7e'),_0x4402('0x7f'),'interface'],'raw':!![]}]})['then'](function(_0x54fee3){if(_0x54fee3){_0x2631bc=_0x54fee3;var _0x4f6010=_[_0x4402('0x80')](_0x54fee3,function(_0x179c27){var _0x2a6031=_0x179c27['get']({'plain':!![]});return _0x2a6031[_0x4402('0x81')];});return db[_0x4402('0x2d')][_0x4402('0x48')]({'where':{'id':_0x385b8e['params']['id']}})[_0x4402('0x24')](function(_0x5847b5){return db[_0x4402('0x6c')][_0x4402('0x4c')](function(_0x235d46){return _0x5847b5[_0x4402('0x7c')](_0xdd829a,{'transaction':_0x235d46})[_0x4402('0x24')](function(){return BPromise[_0x4402('0x82')](_0x2631bc,function(_0x4f2686){return db[_0x4402('0x83')][_0x4402('0x84')]({'TeamId':_0x4f2686['id'],'VoicePrefixId':_0x385b8e[_0x4402('0x47')]['id']},{'transaction':_0x235d46});});})['then'](function(){return BPromise[_0x4402('0x82')](_0x4f6010,function(_0x47e8f7){return db[_0x4402('0x85')][_0x4402('0x86')]({'where':{'UserId':_0x47e8f7['id'],'VoicePrefixId':_0x385b8e[_0x4402('0x47')]['id']},'transaction':_0x235d46});});})[_0x4402('0x24')](function(){_0x4f6010['forEach'](function(_0x91c49){socket[_0x4402('0x72')](_0x4402('0x73'),{'UserId':_0x91c49['id'],'VoicePrefixId':_0x5847b5['id']});});});});});}})[_0x4402('0x24')](respondWithStatusCode(_0x418070,null))[_0x4402('0x49')](handleError(_0x418070,null));};exports['removeTeams']=function(_0x8d0746,_0x2dbd34,_0x56f6d3){return db['Team']['findAll']({'where':{'id':_0x8d0746[_0x4402('0x34')][_0x4402('0x6f')]},'attributes':['id'],'include':[{'model':db[_0x4402('0x78')],'as':_0x4402('0x81'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x2dbd34,null))[_0x4402('0x24')](function(_0x12130d){var _0x2a2579=_[_0x4402('0x32')](_0x12130d,'id');var _0x4e7189=[];var _0x2a3361=[];var _0x2949ce=squel[_0x4402('0x87')]();_0x2949ce['field']('tq.TeamId')['from'](_0x4402('0x88'),'tq')['join'](_0x4402('0x89'),'ut',_0x4402('0x8a'))[_0x4402('0x3e')](_0x4402('0x8b'),_0x8d0746[_0x4402('0x47')]['id']);for(var _0xd604a5=0x0;_0xd604a5<_0x12130d[_0x4402('0x38')];_0xd604a5+=0x1){let _0x3c442d=_0x12130d[_0xd604a5];for(var _0x14daa4=0x0;_0x14daa4<_0x3c442d[_0x4402('0x81')][_0x4402('0x38')];_0x14daa4+=0x1){let _0x329b60=_0x3c442d[_0x4402('0x81')][_0x14daa4];var _0x368b2c=_0x2949ce['clone']();_0x368b2c[_0x4402('0x3e')](_0x4402('0x8c'),_0x329b60['id']);_0x2a3361['push'](db['sequelize']['query'](_0x368b2c[_0x4402('0x8d')](),{'type':db['sequelize']['QueryTypes'][_0x4402('0x8e')]})[_0x4402('0x24')](function(_0x594366){if(_0x594366[_0x4402('0x38')]===0x1){return _0x329b60['id'];}else{var _0xe86dc6=_[_0x4402('0x8f')](_[_0x4402('0x32')](_0x594366,'TeamId'),function(_0x386377){return _[_0x4402('0x90')](_0x2a2579,_0x386377);});if(_0xe86dc6){return _0x329b60['id'];}}}));}}return BPromise[_0x4402('0x91')](_0x2a3361)[_0x4402('0x24')](function(_0x453838){_0x4e7189=_(_0x4e7189)[_0x4402('0x92')](_0x453838)[_0x4402('0x93')]()[_0x4402('0x94')]();return db[_0x4402('0x2d')]['find']({'where':{'id':_0x8d0746[_0x4402('0x47')]['id']}})[_0x4402('0x24')](function(_0x290346){return db[_0x4402('0x6c')]['transaction'](function(_0x439026){return _0x290346['removeTeams'](_0x8d0746[_0x4402('0x34')][_0x4402('0x6f')],{'transaction':_0x439026})['then'](function(){if(!_['isEmpty'](_0x4e7189)){return _0x290346[_0x4402('0x74')](_0x4e7189,{'transaction':_0x439026});}})[_0x4402('0x24')](function(){_0x4e7189[_0x4402('0x95')](function(_0x759c30){socket[_0x4402('0x72')](_0x4402('0x75'),{'UserId':_0x759c30,'VoicePrefixId':_0x290346['id']});});});});});});})['then'](respondWithStatusCode(_0x2dbd34,null))['catch'](handleError(_0x2dbd34,null));}; \ No newline at end of file +var _0xbbbc=['filters','filter','merge','options','VoicePrefix','includeAll','include','findAll','rows','catch','show','params','find','describe','create','sequelize','transaction','VoiceExtension','VoiceExtensionId','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','VoicePrefixes','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','from-sip','exten','system','priority','NoOp','Voice\x20Prefix','VoicePrefixId','Extensions\x20creation\x20failed','prefix','push','Set','CDR(prefix)=','callerIdAll','PREFIX-CALLERIDALL=','No\x20callerid\x20available','goto','context','${EXTEN:','charAt','system-','update','findById','addAgents','ids','omit','body','emit','userVoicePrefix:save','removeAgents','isArray','findOne','pick','getAgents','Team','getTeams','hasOwnProperty','addTeams','Agents','online','interface','flatMap','each','TeamVoicePrefix','findOrCreate','forEach','removeTeams','field','from','join','user_has_teams','VoicePrefixId\x20=\x20?','clone','toString','QueryTypes','SELECT','every','TeamId','includes','all','union','compact','value','isEmpty','userVoicePrefix:remove','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','defaults','localhost','socket.io-emitter','redis','register','end','json','undefined','count','offset','limit','set','Content-Range','apply','reject','save','then','get','UserProfileResource','destroy','status','sendStatus','error','stack','name','index','map','rawAttributes','fieldName','type','key','model','query','keys','attributes','intersection','fields','length','nolimit','order','sort','where'];(function(_0x337e61,_0x4feda1){var _0x31792d=function(_0x28a1aa){while(--_0x28a1aa){_0x337e61['push'](_0x337e61['shift']());}};_0x31792d(++_0x4feda1);}(_0xbbbc,0xf6));var _0xcbbb=function(_0x47b233,_0x503e71){_0x47b233=_0x47b233-0x0;var _0xe827c1=_0xbbbc[_0x47b233];return _0xe827c1;};'use strict';var emlformat=require(_0xcbbb('0x0'));var rimraf=require(_0xcbbb('0x1'));var zipdir=require(_0xcbbb('0x2'));var jsonpatch=require(_0xcbbb('0x3'));var rp=require(_0xcbbb('0x4'));var moment=require(_0xcbbb('0x5'));var BPromise=require(_0xcbbb('0x6'));var Mustache=require('mustache');var util=require(_0xcbbb('0x7'));var path=require(_0xcbbb('0x8'));var sox=require(_0xcbbb('0x9'));var csv=require(_0xcbbb('0xa'));var ejs=require(_0xcbbb('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xcbbb('0xc'));var squel=require(_0xcbbb('0xd'));var crypto=require(_0xcbbb('0xe'));var jsforce=require(_0xcbbb('0xf'));var deskjs=require(_0xcbbb('0x10'));var toCsv=require(_0xcbbb('0xa'));var querystring=require(_0xcbbb('0x11'));var Papa=require('papaparse');var Redis=require(_0xcbbb('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xcbbb('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xcbbb('0x14'))('api');var utils=require(_0xcbbb('0x15'));var config=require(_0xcbbb('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xcbbb('0x17'))['db'];config['redis']=_[_0xcbbb('0x18')](config['redis'],{'host':_0xcbbb('0x19'),'port':0x18eb});var socket=require(_0xcbbb('0x1a'))(new Redis(config[_0xcbbb('0x1b')]));require('./voicePrefix.socket')[_0xcbbb('0x1c')](socket);function respondWithStatusCode(_0x3ff767,_0x8a325c){_0x8a325c=_0x8a325c||0xcc;return function(_0x273e13){if(_0x273e13){return _0x3ff767['sendStatus'](_0x8a325c);}return _0x3ff767['status'](_0x8a325c)[_0xcbbb('0x1d')]();};}function respondWithResult(_0x30297d,_0xf76038){_0xf76038=_0xf76038||0xc8;return function(_0x188698){if(_0x188698){return _0x30297d['status'](_0xf76038)[_0xcbbb('0x1e')](_0x188698);}};}function respondWithFilteredResult(_0x4ff973,_0x1fbfb1){return function(_0x3436af){if(_0x3436af){var _0x3572bb=typeof _0x1fbfb1['offset']==='undefined'&&typeof _0x1fbfb1['limit']===_0xcbbb('0x1f');var _0x3ae91b=_0x3436af[_0xcbbb('0x20')];var _0x25e92f=_0x3572bb?0x0:_0x1fbfb1[_0xcbbb('0x21')];var _0x1cca90=_0x3572bb?_0x3436af[_0xcbbb('0x20')]:_0x1fbfb1[_0xcbbb('0x21')]+_0x1fbfb1[_0xcbbb('0x22')];var _0x2d4335;if(_0x1cca90>=_0x3ae91b){_0x1cca90=_0x3ae91b;_0x2d4335=0xc8;}else{_0x2d4335=0xce;}_0x4ff973['status'](_0x2d4335);return _0x4ff973[_0xcbbb('0x23')](_0xcbbb('0x24'),_0x25e92f+'-'+_0x1cca90+'/'+_0x3ae91b)[_0xcbbb('0x1e')](_0x3436af);}return null;};}function patchUpdates(_0x42aaf1){return function(_0x258d1f){try{jsonpatch[_0xcbbb('0x25')](_0x258d1f,_0x42aaf1,!![]);}catch(_0x297eae){return BPromise[_0xcbbb('0x26')](_0x297eae);}return _0x258d1f[_0xcbbb('0x27')]();};}function saveUpdates(_0x5e3970,_0xf39ddd){return function(_0x4490c1){if(_0x4490c1){return _0x4490c1['update'](_0x5e3970)[_0xcbbb('0x28')](function(_0x4ffa80){return _0x4ffa80;});}return null;};}function removeEntity(_0x48dfc4,_0x575d56){return function(_0x32e070){if(_0x32e070){return _0x32e070['destroy']()['then'](function(){var _0x5499a1=_0x32e070[_0xcbbb('0x29')]({'plain':!![]});var _0x55e1d8='VoicePrefixes';return db[_0xcbbb('0x2a')][_0xcbbb('0x2b')]({'where':{'type':_0x55e1d8,'resourceId':_0x5499a1['id']}})[_0xcbbb('0x28')](function(){return _0x32e070;});})[_0xcbbb('0x28')](function(){_0x48dfc4[_0xcbbb('0x2c')](0xcc)[_0xcbbb('0x1d')]();});}};}function handleEntityNotFound(_0x3d4c0d,_0x1c986d){return function(_0x2a023f){if(!_0x2a023f){_0x3d4c0d[_0xcbbb('0x2d')](0x194);}return _0x2a023f;};}function handleError(_0x1c2ac9,_0xeb8cd8){_0xeb8cd8=_0xeb8cd8||0x1f4;return function(_0xfa973b){logger[_0xcbbb('0x2e')](_0xfa973b[_0xcbbb('0x2f')]);if(_0xfa973b[_0xcbbb('0x30')]){delete _0xfa973b[_0xcbbb('0x30')];}_0x1c2ac9[_0xcbbb('0x2c')](_0xeb8cd8)['send'](_0xfa973b);};}exports[_0xcbbb('0x31')]=function(_0x203a34,_0x5332f9){var _0xec2761={},_0x539dcf={},_0x2d37d3={'count':0x0,'rows':[]};var _0x1fb05e=_[_0xcbbb('0x32')](db['VoicePrefix'][_0xcbbb('0x33')],function(_0xa4743b){return{'name':_0xa4743b[_0xcbbb('0x34')],'type':_0xa4743b[_0xcbbb('0x35')][_0xcbbb('0x36')]};});_0x539dcf[_0xcbbb('0x37')]=_[_0xcbbb('0x32')](_0x1fb05e,_0xcbbb('0x30'));_0x539dcf[_0xcbbb('0x38')]=_[_0xcbbb('0x39')](_0x203a34['query']);_0x539dcf['filters']=_['intersection'](_0x539dcf['model'],_0x539dcf[_0xcbbb('0x38')]);_0xec2761[_0xcbbb('0x3a')]=_[_0xcbbb('0x3b')](_0x539dcf[_0xcbbb('0x37')],qs[_0xcbbb('0x3c')](_0x203a34[_0xcbbb('0x38')][_0xcbbb('0x3c')]));_0xec2761[_0xcbbb('0x3a')]=_0xec2761[_0xcbbb('0x3a')][_0xcbbb('0x3d')]?_0xec2761[_0xcbbb('0x3a')]:_0x539dcf[_0xcbbb('0x37')];if(!_0x203a34['query']['hasOwnProperty'](_0xcbbb('0x3e'))){_0xec2761['limit']=qs['limit'](_0x203a34['query'][_0xcbbb('0x22')]);_0xec2761[_0xcbbb('0x21')]=qs[_0xcbbb('0x21')](_0x203a34[_0xcbbb('0x38')][_0xcbbb('0x21')]);}_0xec2761[_0xcbbb('0x3f')]=qs[_0xcbbb('0x40')](_0x203a34[_0xcbbb('0x38')][_0xcbbb('0x40')]);_0xec2761[_0xcbbb('0x41')]=qs[_0xcbbb('0x42')](_['pick'](_0x203a34[_0xcbbb('0x38')],_0x539dcf['filters']),_0x1fb05e);if(_0x203a34[_0xcbbb('0x38')][_0xcbbb('0x43')]){_0xec2761[_0xcbbb('0x41')]=_[_0xcbbb('0x44')](_0xec2761[_0xcbbb('0x41')],{'$or':_[_0xcbbb('0x32')](_0x1fb05e,function(_0x5651fd){if(_0x5651fd['type']!=='VIRTUAL'){var _0xda1973={};_0xda1973[_0x5651fd[_0xcbbb('0x30')]]={'$like':'%'+_0x203a34[_0xcbbb('0x38')][_0xcbbb('0x43')]+'%'};return _0xda1973;}})});}_0xec2761=_[_0xcbbb('0x44')]({},_0xec2761,_0x203a34[_0xcbbb('0x45')]);var _0x2b45ee={'where':_0xec2761['where']};return db[_0xcbbb('0x46')][_0xcbbb('0x20')](_0x2b45ee)['then'](function(_0x15b3bc){_0x2d37d3[_0xcbbb('0x20')]=_0x15b3bc;if(_0x203a34[_0xcbbb('0x38')][_0xcbbb('0x47')]){_0xec2761[_0xcbbb('0x48')]=[{'all':!![]}];}return db['VoicePrefix'][_0xcbbb('0x49')](_0xec2761);})['then'](function(_0x520448){_0x2d37d3[_0xcbbb('0x4a')]=_0x520448;return _0x2d37d3;})[_0xcbbb('0x28')](respondWithFilteredResult(_0x5332f9,_0xec2761))[_0xcbbb('0x4b')](handleError(_0x5332f9,null));};exports[_0xcbbb('0x4c')]=function(_0xb5391d,_0x406e1c){var _0x2040bf={'raw':![],'where':{'id':_0xb5391d[_0xcbbb('0x4d')]['id']}},_0x3ba75e={};_0x3ba75e[_0xcbbb('0x37')]=_[_0xcbbb('0x39')](db[_0xcbbb('0x46')][_0xcbbb('0x33')]);_0x3ba75e[_0xcbbb('0x38')]=_['keys'](_0xb5391d[_0xcbbb('0x38')]);_0x3ba75e[_0xcbbb('0x42')]=_[_0xcbbb('0x3b')](_0x3ba75e[_0xcbbb('0x37')],_0x3ba75e['query']);_0x2040bf['attributes']=_['intersection'](_0x3ba75e[_0xcbbb('0x37')],qs[_0xcbbb('0x3c')](_0xb5391d[_0xcbbb('0x38')][_0xcbbb('0x3c')]));_0x2040bf[_0xcbbb('0x3a')]=_0x2040bf[_0xcbbb('0x3a')][_0xcbbb('0x3d')]?_0x2040bf['attributes']:_0x3ba75e[_0xcbbb('0x37')];if(_0xb5391d[_0xcbbb('0x38')][_0xcbbb('0x47')]){_0x2040bf[_0xcbbb('0x48')]=[{'all':!![]}];}_0x2040bf=_['merge']({},_0x2040bf,_0xb5391d[_0xcbbb('0x45')]);return db[_0xcbbb('0x46')][_0xcbbb('0x4e')](_0x2040bf)[_0xcbbb('0x28')](handleEntityNotFound(_0x406e1c,null))['then'](respondWithResult(_0x406e1c,null))['catch'](handleError(_0x406e1c,null));};exports[_0xcbbb('0x2b')]=function(_0x421137,_0x3dc052){return db['VoicePrefix']['find']({'where':{'id':_0x421137['params']['id']}})[_0xcbbb('0x28')](handleEntityNotFound(_0x3dc052,null))[_0xcbbb('0x28')](removeEntity(_0x3dc052,null))['catch'](handleError(_0x3dc052,null));};exports[_0xcbbb('0x4f')]=function(_0x35bb94,_0x2dc313){return db[_0xcbbb('0x46')]['describe']()[_0xcbbb('0x28')](respondWithResult(_0x2dc313,null))[_0xcbbb('0x4b')](handleError(_0x2dc313,null));};exports[_0xcbbb('0x50')]=function(_0x3526f5,_0xb267da){var _0x3679f4;return db[_0xcbbb('0x51')][_0xcbbb('0x52')](function(_0x2d3990){return db[_0xcbbb('0x46')][_0xcbbb('0x50')](_0x3526f5['body'],{'transaction':_0x2d3990})['then'](function(_0x3fb0bd){_0x3679f4=_0x3fb0bd[_0xcbbb('0x29')]({'plain':!![]});return db[_0xcbbb('0x53')]['find']({'where':{'id':_0x3679f4[_0xcbbb('0x54')]},'raw':!![]})['then'](function(_0x2a9958){return createVoicePrefixExtensions(_0x3679f4,_0x2a9958,_0x2d3990);});});})[_0xcbbb('0x28')](function(){var _0x317633=_0x3526f5[_0xcbbb('0x55')][_0xcbbb('0x29')]({'plain':!![]});if(!_0x317633)throw new Error(_0xcbbb('0x56'));if(_0x317633['role']==='user'){var _0x4cc098=_0x3679f4;return db[_0xcbbb('0x57')][_0xcbbb('0x4e')]({'where':{'name':_0xcbbb('0x58'),'userProfileId':_0x317633[_0xcbbb('0x59')]},'raw':!![]})[_0xcbbb('0x28')](function(_0x30bc24){if(_0x30bc24&&_0x30bc24[_0xcbbb('0x5a')]===0x0){return db[_0xcbbb('0x2a')][_0xcbbb('0x50')]({'name':_0x4cc098[_0xcbbb('0x30')],'resourceId':_0x4cc098['id'],'type':_0x30bc24[_0xcbbb('0x30')],'sectionId':_0x30bc24['id']},{})[_0xcbbb('0x28')](function(){return _0x3679f4;});}else{return _0x3679f4;}})[_0xcbbb('0x4b')](function(_0x48d295){logger[_0xcbbb('0x2e')](_0xcbbb('0x5b'),_0x48d295);throw _0x48d295;});}return _0x3679f4;})[_0xcbbb('0x28')](respondWithResult(_0xb267da,null))['catch'](handleError(_0xb267da,null));};function Extension(_0x17d714,_0x1dbf9b,_0x5501d5,_0x26f0e6){this['context']=_0xcbbb('0x5c');this[_0xcbbb('0x5d')]=_0x17d714;this['app']=_0x5501d5;this[_0xcbbb('0x35')]=_0xcbbb('0x5e');this['description']='Voice\x20Prefix\x20Extension';this[_0xcbbb('0x5f')]=_0x1dbf9b;this['appdata']=_0x26f0e6;}function createVoicePrefixExtensions(_0x411bc6,_0x4c56fe,_0xb68922){return new BPromise(function(_0x3849d8,_0x20aaa9){var _0x4b4bb7=new Extension(formatPrefixName(_0x411bc6['prefix']),0x1,_0xcbbb('0x60'),_0xcbbb('0x61'));_0x4b4bb7['VoicePrefixId']=_0x411bc6['id'];return db[_0xcbbb('0x53')][_0xcbbb('0x50')](_0x4b4bb7,{'transaction':_0xb68922})[_0xcbbb('0x28')](function(_0x556e48){var _0xe347c6=_0x556e48[_0xcbbb('0x29')]({'plain':!![]});var _0x12ef00=_[_0xcbbb('0x32')](addVoicePrefixExtensions(_0x411bc6,_0x4c56fe),function(_0xf13e52){_0xf13e52[_0xcbbb('0x54')]=_0xe347c6['id'];_0xf13e52[_0xcbbb('0x62')]=_0x411bc6['id'];return _0xf13e52;});return db['VoiceExtension']['bulkCreate'](_0x12ef00,{'transaction':_0xb68922})[_0xcbbb('0x28')](function(_0x2469e5){if(!_0x2469e5){return _0x20aaa9(_0xcbbb('0x63'));}else{return _0x3849d8(_0x2469e5);}})[_0xcbbb('0x4b')](function(_0x4bc7cc){return _0x20aaa9(_0x4bc7cc);});});;});};function addVoicePrefixExtensions(_0x5c6bf7,_0x3781df){var _0x4f6529=[];var _0x5ea915=formatPrefixName(_0x5c6bf7[_0xcbbb('0x64')]);_0x4f6529[_0xcbbb('0x65')](new Extension(_0x5ea915,0x2,_0xcbbb('0x66'),_0xcbbb('0x67')+_0x5c6bf7[_0xcbbb('0x30')]));if(_0x5c6bf7[_0xcbbb('0x68')]){_0x4f6529[_0xcbbb('0x65')](new Extension(_0x5ea915,0x3,'Set',_0xcbbb('0x69')+_0x5c6bf7['callerIdAll']));}else{_0x4f6529[_0xcbbb('0x65')](new Extension(_0x5ea915,0x3,'NoOp',_0xcbbb('0x6a')));}_0x4f6529[_0xcbbb('0x65')](new Extension(_0x5ea915,0x4,_0xcbbb('0x6b'),_0x3781df[_0xcbbb('0x6c')]+','+_0xcbbb('0x6d')+(0x8+_0x5c6bf7[_0xcbbb('0x30')][_0xcbbb('0x3d')])+'}'+','+0x1));return _0x4f6529;}function formatPrefixName(_0x619340){var _0x4ff7db='_';for(var _0x57d776=0x0;_0x57d776<_0x619340[_0xcbbb('0x3d')];_0x57d776++){if(_0x619340[_0xcbbb('0x6e')](_0x57d776)=='-'){_0x4ff7db+=_0x619340[_0xcbbb('0x6e')](_0x57d776);}else{_0x4ff7db+='['+_0x619340[_0xcbbb('0x6e')](_0x57d776)+']';}}_0x4ff7db+='.';return _0x4ff7db;}exports['update']=function(_0x583c33,_0x590fc6,_0x6060d){var _0x2f0db8=_0x583c33['body'];_0x2f0db8[_0xcbbb('0x64')]=_0xcbbb('0x6f')+_0x2f0db8['name']+'-';return db[_0xcbbb('0x51')][_0xcbbb('0x52')](function(_0x4e2198){return db[_0xcbbb('0x46')][_0xcbbb('0x70')](_0x2f0db8,{'where':{'id':_0x2f0db8['id']},'transaction':_0x4e2198})[_0xcbbb('0x28')](function(){return db['VoiceExtension']['destroy']({'where':{'VoicePrefixId':_0x2f0db8['id']},'transaction':_0x4e2198})[_0xcbbb('0x28')](function(){return db[_0xcbbb('0x53')][_0xcbbb('0x4e')]({'where':{'id':_0x2f0db8['VoiceExtensionId']},'raw':!![]})['then'](function(_0x128d79){return createVoicePrefixExtensions(_0x2f0db8,_0x128d79,_0x4e2198);});});});})[_0xcbbb('0x28')](function(){return db[_0xcbbb('0x46')][_0xcbbb('0x71')](_0x2f0db8['id']);})[_0xcbbb('0x28')](respondWithResult(_0x590fc6,null))[_0xcbbb('0x4b')](handleError(_0x590fc6,null));};exports[_0xcbbb('0x72')]=function(_0x194b4b,_0x3e401d,_0x305344){return db[_0xcbbb('0x46')]['find']({'where':{'id':_0x194b4b[_0xcbbb('0x4d')]['id']}})[_0xcbbb('0x28')](handleEntityNotFound(_0x3e401d,null))[_0xcbbb('0x28')](function(_0x3ad059){if(_0x3ad059){return _0x3ad059[_0xcbbb('0x72')](_0x194b4b['body'][_0xcbbb('0x73')],_[_0xcbbb('0x74')](_0x194b4b[_0xcbbb('0x75')],[_0xcbbb('0x73'),'id'])||{})['spread'](function(_0x264c34){for(var _0x22de60=0x0;_0x22de60<_0x194b4b[_0xcbbb('0x75')]['ids']['length'];_0x22de60+=0x1){socket[_0xcbbb('0x76')](_0xcbbb('0x77'),{'UserId':Number(_0x194b4b[_0xcbbb('0x75')][_0xcbbb('0x73')][_0x22de60]),'VoicePrefixId':Number(_0x194b4b['params']['id'])});}return _0x264c34;});}})[_0xcbbb('0x28')](respondWithResult(_0x3e401d,null))[_0xcbbb('0x4b')](handleError(_0x3e401d,null));};exports[_0xcbbb('0x78')]=function(_0x349674,_0x42a9d3,_0x5706e6){return db['VoicePrefix'][_0xcbbb('0x4e')]({'where':{'id':_0x349674[_0xcbbb('0x4d')]['id']}})[_0xcbbb('0x28')](handleEntityNotFound(_0x42a9d3,null))[_0xcbbb('0x28')](function(_0x14eaec){if(_0x14eaec){return _0x14eaec[_0xcbbb('0x78')](_0x349674['query'][_0xcbbb('0x73')])[_0xcbbb('0x28')](function(){if(_[_0xcbbb('0x79')](_0x349674[_0xcbbb('0x38')][_0xcbbb('0x73')])){for(var _0x2b1277=0x0;_0x2b1277<_0x349674[_0xcbbb('0x38')]['ids']['length'];_0x2b1277+=0x1){socket[_0xcbbb('0x76')]('userVoicePrefix:remove',{'UserId':Number(_0x349674['query'][_0xcbbb('0x73')][_0x2b1277]),'VoicePrefixId':Number(_0x349674['params']['id'])});}}else{socket['emit']('userVoicePrefix:remove',{'UserId':Number(_0x349674[_0xcbbb('0x38')]['ids']),'VoicePrefixId':Number(_0x349674[_0xcbbb('0x4d')]['id'])});}});}})['then'](respondWithStatusCode(_0x42a9d3,null))['catch'](handleError(_0x42a9d3,null));};exports['getAgents']=function(_0x4de2dd,_0x1c9dd2,_0x14c60b){var _0x56b09b={};var _0x4bb903={};var _0x130f91;var _0x1bffe9;return db['VoicePrefix'][_0xcbbb('0x7a')]({'where':{'id':_0x4de2dd[_0xcbbb('0x4d')]['id']}})[_0xcbbb('0x28')](handleEntityNotFound(_0x1c9dd2,null))[_0xcbbb('0x28')](function(_0x24b949){if(_0x24b949){_0x130f91=_0x24b949;_0x4bb903[_0xcbbb('0x37')]=_[_0xcbbb('0x39')](db['User'][_0xcbbb('0x33')]);_0x4bb903[_0xcbbb('0x38')]=_['keys'](_0x4de2dd[_0xcbbb('0x38')]);_0x4bb903[_0xcbbb('0x42')]=_[_0xcbbb('0x3b')](_0x4bb903[_0xcbbb('0x37')],_0x4bb903[_0xcbbb('0x38')]);_0x56b09b[_0xcbbb('0x3a')]=_['intersection'](_0x4bb903['model'],qs[_0xcbbb('0x3c')](_0x4de2dd[_0xcbbb('0x38')][_0xcbbb('0x3c')]));_0x56b09b[_0xcbbb('0x3a')]=_0x56b09b[_0xcbbb('0x3a')]['length']?_0x56b09b[_0xcbbb('0x3a')]:_0x4bb903[_0xcbbb('0x37')];_0x56b09b[_0xcbbb('0x3f')]=qs[_0xcbbb('0x40')](_0x4de2dd[_0xcbbb('0x38')][_0xcbbb('0x40')]);_0x56b09b[_0xcbbb('0x41')]=qs[_0xcbbb('0x42')](_[_0xcbbb('0x7b')](_0x4de2dd[_0xcbbb('0x38')],_0x4bb903[_0xcbbb('0x42')]));if(_0x4de2dd['query']['filter']){_0x56b09b[_0xcbbb('0x41')]=_[_0xcbbb('0x44')](_0x56b09b[_0xcbbb('0x41')],{'$or':_[_0xcbbb('0x32')](_0x56b09b[_0xcbbb('0x3a')],function(_0x4a964b){var _0x1d7b6b={};_0x1d7b6b[_0x4a964b]={'$like':'%'+_0x4de2dd[_0xcbbb('0x38')]['filter']+'%'};return _0x1d7b6b;})});}_0x56b09b=_['merge']({},_0x56b09b,_0x4de2dd[_0xcbbb('0x45')]);return _0x130f91['getAgents'](_0x56b09b);}})[_0xcbbb('0x28')](function(_0x1a5dd3){if(_0x1a5dd3){_0x1bffe9=_0x1a5dd3[_0xcbbb('0x3d')];if(!_0x4de2dd[_0xcbbb('0x38')]['hasOwnProperty']('nolimit')){_0x56b09b[_0xcbbb('0x22')]=qs[_0xcbbb('0x22')](_0x4de2dd['query'][_0xcbbb('0x22')]);_0x56b09b[_0xcbbb('0x21')]=qs[_0xcbbb('0x21')](_0x4de2dd[_0xcbbb('0x38')][_0xcbbb('0x21')]);}return _0x130f91[_0xcbbb('0x7c')](_0x56b09b);}})[_0xcbbb('0x28')](function(_0x49f482){if(_0x49f482){return _0x49f482?{'count':_0x1bffe9,'rows':_0x49f482}:null;}})[_0xcbbb('0x28')](respondWithResult(_0x1c9dd2,null))[_0xcbbb('0x4b')](handleError(_0x1c9dd2,null));};exports['getTeams']=function(_0x10667e,_0x549d6c,_0x7a604f){var _0x10f932={};var _0x736484={};var _0x369b6f;var _0x4dc485;return db[_0xcbbb('0x46')][_0xcbbb('0x7a')]({'where':{'id':_0x10667e[_0xcbbb('0x4d')]['id']}})[_0xcbbb('0x28')](handleEntityNotFound(_0x549d6c,null))[_0xcbbb('0x28')](function(_0x4a5a59){if(_0x4a5a59){_0x369b6f=_0x4a5a59;_0x736484['model']=_[_0xcbbb('0x39')](db[_0xcbbb('0x7d')][_0xcbbb('0x33')]);_0x736484[_0xcbbb('0x38')]=_[_0xcbbb('0x39')](_0x10667e['query']);_0x736484['filters']=_[_0xcbbb('0x3b')](_0x736484[_0xcbbb('0x37')],_0x736484[_0xcbbb('0x38')]);_0x10f932[_0xcbbb('0x3a')]=_[_0xcbbb('0x3b')](_0x736484['model'],qs[_0xcbbb('0x3c')](_0x10667e[_0xcbbb('0x38')][_0xcbbb('0x3c')]));_0x10f932['attributes']=_0x10f932[_0xcbbb('0x3a')][_0xcbbb('0x3d')]?_0x10f932[_0xcbbb('0x3a')]:_0x736484[_0xcbbb('0x37')];_0x10f932[_0xcbbb('0x3f')]=qs[_0xcbbb('0x40')](_0x10667e[_0xcbbb('0x38')][_0xcbbb('0x40')]);_0x10f932['where']=qs[_0xcbbb('0x42')](_['pick'](_0x10667e['query'],_0x736484['filters']));if(_0x10667e[_0xcbbb('0x38')]['filter']){_0x10f932[_0xcbbb('0x41')]=_[_0xcbbb('0x44')](_0x10f932['where'],{'$or':_[_0xcbbb('0x32')](_0x10f932[_0xcbbb('0x3a')],function(_0x4bf0b3){var _0x4314d3={};_0x4314d3[_0x4bf0b3]={'$like':'%'+_0x10667e[_0xcbbb('0x38')][_0xcbbb('0x43')]+'%'};return _0x4314d3;})});}_0x10f932=_['merge']({},_0x10f932,_0x10667e[_0xcbbb('0x45')]);return _0x369b6f[_0xcbbb('0x7e')](_0x10f932);}})[_0xcbbb('0x28')](function(_0x2da472){if(_0x2da472){_0x4dc485=_0x2da472[_0xcbbb('0x3d')];if(!_0x10667e[_0xcbbb('0x38')][_0xcbbb('0x7f')](_0xcbbb('0x3e'))){_0x10f932[_0xcbbb('0x22')]=qs['limit'](_0x10667e[_0xcbbb('0x38')][_0xcbbb('0x22')]);_0x10f932[_0xcbbb('0x21')]=qs['offset'](_0x10667e['query'][_0xcbbb('0x21')]);}return _0x369b6f['getTeams'](_0x10f932);}})[_0xcbbb('0x28')](function(_0x198899){if(_0x198899){return _0x198899?{'count':_0x4dc485,'rows':_0x198899}:null;}})['then'](respondWithResult(_0x549d6c,null))[_0xcbbb('0x4b')](handleError(_0x549d6c,null));};exports[_0xcbbb('0x80')]=function(_0x59d833,_0x39951f,_0x283bc8){var _0x2754d1=_0x59d833[_0xcbbb('0x75')][_0xcbbb('0x73')];var _0x458b66;return db['Team'][_0xcbbb('0x49')]({'where':{'id':_0x2754d1},'attributes':['id'],'include':[{'model':db['User'],'as':_0xcbbb('0x81'),'attributes':['id',_0xcbbb('0x30'),_0xcbbb('0x82'),'voicePause',_0xcbbb('0x83')],'raw':!![]}]})['then'](function(_0x32993d){if(_0x32993d){_0x458b66=_0x32993d;var _0x962f3f=_[_0xcbbb('0x84')](_0x32993d,function(_0x55ca6b){var _0x287b25=_0x55ca6b['get']({'plain':!![]});return _0x287b25[_0xcbbb('0x81')];});return db[_0xcbbb('0x46')][_0xcbbb('0x4e')]({'where':{'id':_0x59d833[_0xcbbb('0x4d')]['id']}})['then'](function(_0x16991b){return db['sequelize'][_0xcbbb('0x52')](function(_0xd01dff){return _0x16991b[_0xcbbb('0x80')](_0x2754d1,{'transaction':_0xd01dff})[_0xcbbb('0x28')](function(){return BPromise[_0xcbbb('0x85')](_0x458b66,function(_0x3ab011){return db[_0xcbbb('0x86')]['upsert']({'TeamId':_0x3ab011['id'],'VoicePrefixId':_0x59d833[_0xcbbb('0x4d')]['id']},{'transaction':_0xd01dff});});})[_0xcbbb('0x28')](function(){return BPromise[_0xcbbb('0x85')](_0x962f3f,function(_0x354314){return db['UserVoicePrefix'][_0xcbbb('0x87')]({'where':{'UserId':_0x354314['id'],'VoicePrefixId':_0x59d833[_0xcbbb('0x4d')]['id']},'transaction':_0xd01dff});});})[_0xcbbb('0x28')](function(){_0x962f3f[_0xcbbb('0x88')](function(_0x3fc8da){socket[_0xcbbb('0x76')]('userVoicePrefix:save',{'UserId':_0x3fc8da['id'],'VoicePrefixId':_0x16991b['id']});});});});});}})[_0xcbbb('0x28')](respondWithStatusCode(_0x39951f,null))[_0xcbbb('0x4b')](handleError(_0x39951f,null));};exports[_0xcbbb('0x89')]=function(_0x23bda8,_0x233c44,_0x26545e){return db[_0xcbbb('0x7d')][_0xcbbb('0x49')]({'where':{'id':_0x23bda8['query'][_0xcbbb('0x73')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0xcbbb('0x81'),'attributes':['id'],'raw':!![]}]})[_0xcbbb('0x28')](handleEntityNotFound(_0x233c44,null))[_0xcbbb('0x28')](function(_0x510bc9){var _0x1ce1c4=_[_0xcbbb('0x32')](_0x510bc9,'id');var _0x7fc4ea=[];var _0xde4f2b=[];var _0xabe61=squel['select']();_0xabe61[_0xcbbb('0x8a')]('tq.TeamId')[_0xcbbb('0x8b')]('team_has_voice_prefixes','tq')[_0xcbbb('0x8c')](_0xcbbb('0x8d'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0xcbbb('0x41')](_0xcbbb('0x8e'),_0x23bda8[_0xcbbb('0x4d')]['id']);for(var _0x3a3e73=0x0;_0x3a3e73<_0x510bc9[_0xcbbb('0x3d')];_0x3a3e73+=0x1){let _0x517af0=_0x510bc9[_0x3a3e73];for(var _0x4312c3=0x0;_0x4312c3<_0x517af0[_0xcbbb('0x81')][_0xcbbb('0x3d')];_0x4312c3+=0x1){let _0x1b34ac=_0x517af0[_0xcbbb('0x81')][_0x4312c3];var _0x402d10=_0xabe61[_0xcbbb('0x8f')]();_0x402d10[_0xcbbb('0x41')]('ut.UserId\x20=\x20?',_0x1b34ac['id']);_0xde4f2b['push'](db[_0xcbbb('0x51')]['query'](_0x402d10[_0xcbbb('0x90')](),{'type':db[_0xcbbb('0x51')][_0xcbbb('0x91')][_0xcbbb('0x92')]})[_0xcbbb('0x28')](function(_0x2129d8){if(_0x2129d8[_0xcbbb('0x3d')]===0x1){return _0x1b34ac['id'];}else{var _0x274e33=_[_0xcbbb('0x93')](_[_0xcbbb('0x32')](_0x2129d8,_0xcbbb('0x94')),function(_0x1c8981){return _[_0xcbbb('0x95')](_0x1ce1c4,_0x1c8981);});if(_0x274e33){return _0x1b34ac['id'];}}}));}}return BPromise[_0xcbbb('0x96')](_0xde4f2b)[_0xcbbb('0x28')](function(_0x4bcb5d){_0x7fc4ea=_(_0x7fc4ea)[_0xcbbb('0x97')](_0x4bcb5d)[_0xcbbb('0x98')]()[_0xcbbb('0x99')]();return db[_0xcbbb('0x46')]['find']({'where':{'id':_0x23bda8[_0xcbbb('0x4d')]['id']}})[_0xcbbb('0x28')](function(_0x40fc06){return db[_0xcbbb('0x51')][_0xcbbb('0x52')](function(_0x357810){return _0x40fc06['removeTeams'](_0x23bda8[_0xcbbb('0x38')][_0xcbbb('0x73')],{'transaction':_0x357810})['then'](function(){if(!_[_0xcbbb('0x9a')](_0x7fc4ea)){return _0x40fc06[_0xcbbb('0x78')](_0x7fc4ea,{'transaction':_0x357810});}})[_0xcbbb('0x28')](function(){_0x7fc4ea[_0xcbbb('0x88')](function(_0x49e6e1){socket['emit'](_0xcbbb('0x9b'),{'UserId':_0x49e6e1,'VoicePrefixId':_0x40fc06['id']});});});});});});})[_0xcbbb('0x28')](respondWithStatusCode(_0x233c44,null))[_0xcbbb('0x4b')](handleError(_0x233c44,null));}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.events.js b/server/api/voicePrefix/voicePrefix.events.js index 5e6dd28..0f62599 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 _0xaf9e=['save','update','remove','emit','hasOwnProperty','hook','exports','events','VoicePrefix','setMaxListeners'];(function(_0x48e582,_0x1a2458){var _0x615792=function(_0x569b6d){while(--_0x569b6d){_0x48e582['push'](_0x48e582['shift']());}};_0x615792(++_0x1a2458);}(_0xaf9e,0x165));var _0xeaf9=function(_0x34aa87,_0x44345b){_0x34aa87=_0x34aa87-0x0;var _0x2d8508=_0xaf9e[_0x34aa87];return _0x2d8508;};'use strict';var EventEmitter=require(_0xeaf9('0x0'));var VoicePrefix=require('../../mysqldb')['db'][_0xeaf9('0x1')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0xeaf9('0x2')](0x0);var events={'afterCreate':_0xeaf9('0x3'),'afterUpdate':_0xeaf9('0x4'),'afterDestroy':_0xeaf9('0x5')};function emitEvent(_0x1500d4){return function(_0x536479,_0x14898c,_0x54e78d){VoicePrefixEvents[_0xeaf9('0x6')](_0x1500d4+':'+_0x536479['id'],_0x536479);VoicePrefixEvents[_0xeaf9('0x6')](_0x1500d4,_0x536479);_0x54e78d(null);};}for(var e in events){if(events[_0xeaf9('0x7')](e)){var event=events[e];VoicePrefix[_0xeaf9('0x8')](e,emitEvent(event));}}module[_0xeaf9('0x9')]=VoicePrefixEvents; \ No newline at end of file +var _0x32cb=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','VoicePrefix','setMaxListeners','save'];(function(_0x512986,_0xa31647){var _0x25fd7c=function(_0x55855c){while(--_0x55855c){_0x512986['push'](_0x512986['shift']());}};_0x25fd7c(++_0xa31647);}(_0x32cb,0x11d));var _0xb32c=function(_0x93ad11,_0x5d12ba){_0x93ad11=_0x93ad11-0x0;var _0x37c69a=_0x32cb[_0x93ad11];return _0x37c69a;};'use strict';var EventEmitter=require(_0xb32c('0x0'));var VoicePrefix=require(_0xb32c('0x1'))['db'][_0xb32c('0x2')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0xb32c('0x3')](0x0);var events={'afterCreate':_0xb32c('0x4'),'afterUpdate':'update','afterDestroy':_0xb32c('0x5')};function emitEvent(_0x13e06d){return function(_0x9d08f6,_0x3ad4a0,_0x130dc9){VoicePrefixEvents[_0xb32c('0x6')](_0x13e06d+':'+_0x9d08f6['id'],_0x9d08f6);VoicePrefixEvents[_0xb32c('0x6')](_0x13e06d,_0x9d08f6);_0x130dc9(null);};}for(var e in events){if(events[_0xb32c('0x7')](e)){var event=events[e];VoicePrefix[_0xb32c('0x8')](e,emitEvent(event));}}module[_0xb32c('0x9')]=VoicePrefixEvents; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.model.js b/server/api/voicePrefix/voicePrefix.model.js index 1f6c084..24000e3 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 _0xa4d3=['define','VoicePrefix','lodash','util','../../config/logger','api','moment','path','./voicePrefix.attributes'];(function(_0x4a96ca,_0x13754e){var _0x2aed48=function(_0x361330){while(--_0x361330){_0x4a96ca['push'](_0x4a96ca['shift']());}};_0x2aed48(++_0x13754e);}(_0xa4d3,0xfe));var _0x3a4d=function(_0x5f0021,_0x2a3378){_0x5f0021=_0x5f0021-0x0;var _0x441590=_0xa4d3[_0x5f0021];return _0x441590;};'use strict';var _=require(_0x3a4d('0x0'));var util=require(_0x3a4d('0x1'));var logger=require(_0x3a4d('0x2'))(_0x3a4d('0x3'));var moment=require(_0x3a4d('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x3a4d('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x3a4d('0x6'));module['exports']=function(_0xe2661e,_0xc27f22){return _0xe2661e[_0x3a4d('0x7')](_0x3a4d('0x8'),attributes,{'tableName':'voice_prefixes','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x05fa=['VoicePrefix','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','exports','define'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x05fa,0x1e1));var _0xa05f=function(_0x29e0eb,_0x9acb52){_0x29e0eb=_0x29e0eb-0x0;var _0x597d2d=_0x05fa[_0x29e0eb];return _0x597d2d;};'use strict';var _=require(_0xa05f('0x0'));var util=require(_0xa05f('0x1'));var logger=require(_0xa05f('0x2'))(_0xa05f('0x3'));var moment=require(_0xa05f('0x4'));var BPromise=require(_0xa05f('0x5'));var rp=require(_0xa05f('0x6'));var fs=require('fs');var path=require(_0xa05f('0x7'));var rimraf=require(_0xa05f('0x8'));var config=require('../../config/environment');var attributes=require('./voicePrefix.attributes');module[_0xa05f('0x9')]=function(_0x2a3b55,_0x442955){return _0x2a3b55[_0xa05f('0xa')](_0xa05f('0xb'),attributes,{'tableName':'voice_prefixes','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 c716440..6f428b5 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 _0x1574=['moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','request','info','VoicePrefix,\x20%s,\x20%s','request\x20sent','debug','VoicePrefix,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util'];(function(_0x17928f,_0x4ad33f){var _0x500b63=function(_0x127644){while(--_0x127644){_0x17928f['push'](_0x17928f['shift']());}};_0x500b63(++_0x4ad33f);}(_0x1574,0x148));var _0x4157=function(_0x2c893e,_0x2ffaa0){_0x2c893e=_0x2c893e-0x0;var _0x1660b0=_0x1574[_0x2c893e];return _0x1660b0;};'use strict';var _=require(_0x4157('0x0'));var util=require(_0x4157('0x1'));var moment=require(_0x4157('0x2'));var BPromise=require(_0x4157('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4157('0x4'));var db=require(_0x4157('0x5'))['db'];var utils=require(_0x4157('0x6'));var logger=require(_0x4157('0x7'))(_0x4157('0x8'));var config=require(_0x4157('0x9'));var jayson=require(_0x4157('0xa'));var client=jayson[_0x4157('0xb')][_0x4157('0xc')]({'port':0x232a});config[_0x4157('0xd')]=_[_0x4157('0xe')](config[_0x4157('0xd')],{'host':_0x4157('0xf'),'port':0x18eb});var socket=require(_0x4157('0x10'))(new Redis(config[_0x4157('0xd')]));require('./voicePrefix.socket')[_0x4157('0x11')](socket);function respondWithRpcPromise(_0x598545,_0x4ba25d,_0x5a60a8){return new BPromise(function(_0x2e221c,_0xa5e176){return client[_0x4157('0x12')](_0x598545,_0x5a60a8)['then'](function(_0x43be92){logger[_0x4157('0x13')](_0x4157('0x14'),_0x4ba25d,_0x4157('0x15'));logger[_0x4157('0x16')](_0x4157('0x17'),_0x4ba25d,_0x4157('0x15'),JSON[_0x4157('0x18')](_0x43be92));if(_0x43be92[_0x4157('0x19')]){if(_0x43be92[_0x4157('0x19')][_0x4157('0x1a')]===0x1f4){logger[_0x4157('0x19')]('VoicePrefix,\x20%s,\x20%s',_0x4ba25d,_0x43be92[_0x4157('0x19')]['message']);return _0xa5e176(_0x43be92[_0x4157('0x19')][_0x4157('0x1b')]);}logger[_0x4157('0x19')](_0x4157('0x14'),_0x4ba25d,_0x43be92[_0x4157('0x19')][_0x4157('0x1b')]);return _0x2e221c(_0x43be92[_0x4157('0x19')][_0x4157('0x1b')]);}else{logger[_0x4157('0x13')](_0x4157('0x14'),_0x4ba25d,_0x4157('0x15'));_0x2e221c(_0x43be92[_0x4157('0x1c')]['message']);}})[_0x4157('0x1d')](function(_0x4f9de8){logger[_0x4157('0x19')](_0x4157('0x14'),_0x4ba25d,_0x4f9de8);_0xa5e176(_0x4f9de8);});});} \ No newline at end of file +var _0x81c6=['VoicePrefix,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','util','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','redis','defaults','socket.io-emitter','./voicePrefix.socket','request','then'];(function(_0x138adb,_0x193fee){var _0x1b27f2=function(_0x5e97a2){while(--_0x5e97a2){_0x138adb['push'](_0x138adb['shift']());}};_0x1b27f2(++_0x193fee);}(_0x81c6,0x1d5));var _0x681c=function(_0x3241f3,_0x537340){_0x3241f3=_0x3241f3-0x0;var _0x29ac16=_0x81c6[_0x3241f3];return _0x29ac16;};'use strict';var _=require('lodash');var util=require(_0x681c('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x681c('0x1'));var db=require(_0x681c('0x2'))['db'];var utils=require(_0x681c('0x3'));var logger=require('../../config/logger')(_0x681c('0x4'));var config=require(_0x681c('0x5'));var jayson=require(_0x681c('0x6'));var client=jayson[_0x681c('0x7')]['http']({'port':0x232a});config[_0x681c('0x8')]=_[_0x681c('0x9')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x681c('0xa'))(new Redis(config[_0x681c('0x8')]));require(_0x681c('0xb'))['register'](socket);function respondWithRpcPromise(_0x4f0228,_0x3e3770,_0x4ff60b){return new BPromise(function(_0x82b6ad,_0x83927a){return client[_0x681c('0xc')](_0x4f0228,_0x4ff60b)[_0x681c('0xd')](function(_0x48dc05){logger['info'](_0x681c('0xe'),_0x3e3770,_0x681c('0xf'));logger[_0x681c('0x10')]('VoicePrefix,\x20%s,\x20%s,\x20%s',_0x3e3770,_0x681c('0xf'),JSON['stringify'](_0x48dc05));if(_0x48dc05[_0x681c('0x11')]){if(_0x48dc05['error'][_0x681c('0x12')]===0x1f4){logger[_0x681c('0x11')](_0x681c('0xe'),_0x3e3770,_0x48dc05[_0x681c('0x11')][_0x681c('0x13')]);return _0x83927a(_0x48dc05[_0x681c('0x11')]['message']);}logger[_0x681c('0x11')](_0x681c('0xe'),_0x3e3770,_0x48dc05[_0x681c('0x11')][_0x681c('0x13')]);return _0x82b6ad(_0x48dc05[_0x681c('0x11')][_0x681c('0x13')]);}else{logger['info'](_0x681c('0xe'),_0x3e3770,_0x681c('0xf'));_0x82b6ad(_0x48dc05[_0x681c('0x14')][_0x681c('0x13')]);}})['catch'](function(_0x22e608){logger[_0x681c('0x11')]('VoicePrefix,\x20%s,\x20%s',_0x3e3770,_0x22e608);_0x83927a(_0x22e608);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.socket.js b/server/api/voicePrefix/voicePrefix.socket.js index fe0e796..8b54f15 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 _0x3f19=['length','voicePrefix:','./voicePrefix.events','emit','register'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x3f19,0xc0));var _0x93f1=function(_0x216e58,_0x497adc){_0x216e58=_0x216e58-0x0;var _0x5adcad=_0x3f19[_0x216e58];return _0x5adcad;};'use strict';var VoicePrefixEvents=require(_0x93f1('0x0'));var events=['save','remove','update'];function createListener(_0x33bddc,_0x4d1cac){return function(_0x452cf9){_0x4d1cac[_0x93f1('0x1')](_0x33bddc,_0x452cf9);};}function removeListener(_0x3bd3fa,_0x2057aa){return function(){VoicePrefixEvents['removeListener'](_0x3bd3fa,_0x2057aa);};}exports[_0x93f1('0x2')]=function(_0x522769){for(var _0x999026=0x0,_0x425c6f=events[_0x93f1('0x3')];_0x999026<_0x425c6f;_0x999026++){var _0xdaa92=events[_0x999026];var _0x5d7374=createListener(_0x93f1('0x4')+_0xdaa92,_0x522769);VoicePrefixEvents['on'](_0xdaa92,_0x5d7374);}}; \ No newline at end of file +var _0x96cc=['./voicePrefix.events','remove','emit','removeListener','register','length','voicePrefix:'];(function(_0x346738,_0x1920d8){var _0x445181=function(_0xda7d6d){while(--_0xda7d6d){_0x346738['push'](_0x346738['shift']());}};_0x445181(++_0x1920d8);}(_0x96cc,0x16c));var _0xc96c=function(_0x42b02a,_0x544374){_0x42b02a=_0x42b02a-0x0;var _0x4d815c=_0x96cc[_0x42b02a];return _0x4d815c;};'use strict';var VoicePrefixEvents=require(_0xc96c('0x0'));var events=['save',_0xc96c('0x1'),'update'];function createListener(_0x30bf8a,_0x3e7a95){return function(_0x107043){_0x3e7a95[_0xc96c('0x2')](_0x30bf8a,_0x107043);};}function removeListener(_0x71140d,_0x29b6f1){return function(){VoicePrefixEvents[_0xc96c('0x3')](_0x71140d,_0x29b6f1);};}exports[_0xc96c('0x4')]=function(_0x3b7f45){for(var _0x5142cd=0x0,_0x10b411=events[_0xc96c('0x5')];_0x5142cd<_0x10b411;_0x5142cd++){var _0x408afb=events[_0x5142cd];var _0x86c1a8=createListener(_0xc96c('0x6')+_0x408afb,_0x3b7f45);VoicePrefixEvents['on'](_0x408afb,_0x86c1a8);}}; \ No newline at end of file diff --git a/server/api/voiceQueue/index.js b/server/api/voiceQueue/index.js index 3dc9b5f..e3dd306 100644 --- a/server/api/voiceQueue/index.js +++ b/server/api/voiceQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueue.controller','get','index','isAuthenticated','show','/:id/hoppers','getHoppers','/:id/hopper_histories','/:id/hopper_finals','getHopperBlacks','/:id/teams','getTeams','/:id/users','getAgents','/:id/members','getMembers','/:id/lists','/:id/blacklists','getBlackLists','post','create','/:id/clone','addTeams','addAgents','addLists','addBlackLists','put','/:id','update','delete','removeTeams','removeAgents','removeLists','removeBlackLists','exports','multer','path','connect-timeout'];(function(_0x54b396,_0x3612ee){var _0x532e6d=function(_0xc8286e){while(--_0xc8286e){_0x54b396['push'](_0x54b396['shift']());}};_0x532e6d(++_0x3612ee);}(_0xb10b,0x12a));var _0xbb10=function(_0x59de2a,_0x264f62){_0x59de2a=_0x59de2a-0x0;var _0x1d18d2=_0xb10b[_0x59de2a];return _0x1d18d2;};'use strict';var multer=require(_0xbb10('0x0'));var util=require('util');var path=require(_0xbb10('0x1'));var timeout=require(_0xbb10('0x2'));var express=require(_0xbb10('0x3'));var router=express['Router']();var fs_extra=require(_0xbb10('0x4'));var auth=require(_0xbb10('0x5'));var interaction=require(_0xbb10('0x6'));var config=require(_0xbb10('0x7'));var controller=require(_0xbb10('0x8'));router[_0xbb10('0x9')]('/',auth['isAuthenticated'](),controller[_0xbb10('0xa')]);router[_0xbb10('0x9')]('/:id',auth[_0xbb10('0xb')](),controller[_0xbb10('0xc')]);router[_0xbb10('0x9')](_0xbb10('0xd'),auth[_0xbb10('0xb')](),controller[_0xbb10('0xe')]);router[_0xbb10('0x9')](_0xbb10('0xf'),auth['isAuthenticated'](),controller['getHopperHistories']);router[_0xbb10('0x9')](_0xbb10('0x10'),auth[_0xbb10('0xb')](),controller['getHopperFinals']);router[_0xbb10('0x9')]('/:id/hopper_black',auth[_0xbb10('0xb')](),controller[_0xbb10('0x11')]);router[_0xbb10('0x9')](_0xbb10('0x12'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x13')]);router['get'](_0xbb10('0x14'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x15')]);router[_0xbb10('0x9')](_0xbb10('0x16'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x17')]);router[_0xbb10('0x9')](_0xbb10('0x18'),auth[_0xbb10('0xb')](),controller['getLists']);router[_0xbb10('0x9')](_0xbb10('0x19'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x1a')]);router[_0xbb10('0x1b')]('/',auth[_0xbb10('0xb')](),controller[_0xbb10('0x1c')]);router[_0xbb10('0x1b')](_0xbb10('0x1d'),auth[_0xbb10('0xb')](),controller['clone']);router[_0xbb10('0x1b')](_0xbb10('0x12'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x1e')]);router[_0xbb10('0x1b')](_0xbb10('0x14'),auth['isAuthenticated'](),controller[_0xbb10('0x1f')]);router[_0xbb10('0x1b')]('/:id/lists',auth['isAuthenticated'](),controller[_0xbb10('0x20')]);router[_0xbb10('0x1b')](_0xbb10('0x19'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x21')]);router[_0xbb10('0x22')](_0xbb10('0x23'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x24')]);router[_0xbb10('0x25')](_0xbb10('0x23'),auth[_0xbb10('0xb')](),controller['destroy']);router['delete']('/:id/teams',auth[_0xbb10('0xb')](),controller[_0xbb10('0x26')]);router[_0xbb10('0x25')]('/:id/users',auth[_0xbb10('0xb')](),controller[_0xbb10('0x27')]);router[_0xbb10('0x25')](_0xbb10('0x18'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x28')]);router[_0xbb10('0x25')]('/:id/blacklists',auth[_0xbb10('0xb')](),controller[_0xbb10('0x29')]);module[_0xbb10('0x2a')]=router; \ No newline at end of file +var _0xa9e0=['addAgents','/:id/blacklists','addBlackLists','update','delete','destroy','removeTeams','removeAgents','removeLists','removeBlackLists','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueue.controller','get','index','/:id','getHoppers','/:id/hopper_histories','isAuthenticated','getHopperHistories','/:id/hopper_black','getHopperBlacks','/:id/teams','/:id/users','getAgents','/:id/members','getMembers','/:id/lists','getLists','post','create','/:id/clone','clone','addTeams'];(function(_0x4787ce,_0x3f2423){var _0x19432e=function(_0x1a0ce8){while(--_0x1a0ce8){_0x4787ce['push'](_0x4787ce['shift']());}};_0x19432e(++_0x3f2423);}(_0xa9e0,0x123));var _0x0a9e=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xa9e0[_0x19e35c];return _0x3e1fe8;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/hoppers',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0x8')]('/:id/hopper_finals',auth['isAuthenticated'](),controller['getHopperFinals']);router['get'](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x8')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller['getTeams']);router[_0x0a9e('0x8')](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);router[_0x0a9e('0x8')](_0x0a9e('0x14'),auth['isAuthenticated'](),controller[_0x0a9e('0x15')]);router['get'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller[_0x0a9e('0x17')]);router[_0x0a9e('0x8')]('/:id/blacklists',auth[_0x0a9e('0xd')](),controller['getBlackLists']);router[_0x0a9e('0x18')]('/',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x19')]);router[_0x0a9e('0x18')](_0x0a9e('0x1a'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1b')]);router[_0x0a9e('0x18')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1c')]);router[_0x0a9e('0x18')]('/:id/users',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1d')]);router['post'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller['addLists']);router[_0x0a9e('0x18')](_0x0a9e('0x1e'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1f')]);router['put'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x20')]);router[_0x0a9e('0x21')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x22')]);router['delete']('/:id/teams',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x23')]);router[_0x0a9e('0x21')](_0x0a9e('0x12'),auth['isAuthenticated'](),controller[_0x0a9e('0x24')]);router['delete'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller[_0x0a9e('0x25')]);router[_0x0a9e('0x21')](_0x0a9e('0x1e'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x26')]);module[_0x0a9e('0x27')]=router; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.attributes.js b/server/api/voiceQueue/voiceQueue.attributes.js index fee804d..672bda1 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 _0x53c9=['AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','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','#AMD\x20Maximum\x20Word\x20Length','#RecallMe\x20Timeout\x20(min:1)','DESC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports','STRING','ENUM','inbound','outbound','default','leastrecent','random','rrmemory','linear','wrandom','rrordered','ringall','setDataValue','strategy','getDataValue','type','dialMethod','booked','progressive','power','INTEGER','yes','all','once','TEXT','periodic_announce','join','split','leavewhenempty','BOOLEAN','acw','wrapuptime','preview','predictive','Dial\x20Method.','UNSIGNED','Max\x209999\x20channels,\x200\x20means\x20unlimited.','Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.','Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).','agentBusyFactor','dropRate','Only\x20for\x20predictive\x20method.','FLOAT','Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)','Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','tTxX','https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue','Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'];(function(_0x46e363,_0x45d7e2){var _0x3fb059=function(_0x5e6274){while(--_0x5e6274){_0x46e363['push'](_0x46e363['shift']());}};_0x3fb059(++_0x45d7e2);}(_0x53c9,0x73));var _0x953c=function(_0x53526a,_0x54f73d){_0x53526a=_0x53526a-0x0;var _0x28471d=_0x53c9[_0x53526a];return _0x28471d;};'use strict';var Sequelize=require(_0x953c('0x0'));module[_0x953c('0x1')]={'name':{'type':Sequelize[_0x953c('0x2')],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x953c('0x3')](_0x953c('0x4'),_0x953c('0x5')),'allowNull':![],'defaultValue':_0x953c('0x4')},'musiconhold':{'type':Sequelize[_0x953c('0x2')],'defaultValue':_0x953c('0x6')},'announce':{'type':Sequelize[_0x953c('0x2')],'defaultValue':''},'strategy':{'type':Sequelize[_0x953c('0x3')]('rr','ringall',_0x953c('0x7'),'fewestcalls',_0x953c('0x8'),_0x953c('0x9'),_0x953c('0xa'),_0x953c('0xb'),_0x953c('0xc')),'allowNull':![],'defaultValue':_0x953c('0xd'),'set':function(_0x4b068a){this[_0x953c('0xe')](_0x953c('0xf'),_0x4b068a?_0x4b068a:_0x953c('0x9'));},'get':function(){var _0x1bf23a=this[_0x953c('0x10')](_0x953c('0x11'));var _0x409f6d=this[_0x953c('0x10')](_0x953c('0x12'));var _0xfc81f=this[_0x953c('0x10')](_0x953c('0xf'));if(_0x1bf23a==='inbound'){return _0xfc81f;}if(_0x409f6d===_0x953c('0x13')&&_0xfc81f===_0x953c('0x9')||_0x409f6d===_0x953c('0x13')&&_0xfc81f==='roundrobin'){return _0xfc81f;}if(_0x409f6d===_0x953c('0x14')||_0x409f6d==='predictive'||_0x409f6d===_0x953c('0x15')){return _0xfc81f;}return null;}},'servicelevel':{'type':Sequelize[_0x953c('0x16')](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0x953c('0x2')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize[_0x953c('0x16')](0xb)},'timeout':{'type':Sequelize[_0x953c('0x16')](0xb),'defaultValue':0xf},'retry':{'type':Sequelize[_0x953c('0x16')](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize['STRING']},'weight':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0x953c('0x3')](_0x953c('0x17'),'no'),'defaultValue':_0x953c('0x17')},'autopause':{'type':Sequelize[_0x953c('0x3')](_0x953c('0x17'),'no',_0x953c('0x18')),'defaultValue':'no'},'autopausedelay':{'type':Sequelize[_0x953c('0x16')](0xb)},'autopausebusy':{'type':Sequelize[_0x953c('0x3')]('yes','no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize[_0x953c('0x3')]('yes','no'),'defaultValue':'no'},'maxlen':{'type':Sequelize[_0x953c('0x16')](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize['ENUM'](_0x953c('0x17'),'no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize[_0x953c('0x3')](_0x953c('0x17'),'no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize[_0x953c('0x3')](_0x953c('0x17'),'no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize[_0x953c('0x3')](_0x953c('0x17'),'no'),'defaultValue':'no'},'membermacro':{'type':Sequelize[_0x953c('0x2')],'allowNull':!![]},'membergosub':{'type':Sequelize[_0x953c('0x2')],'allowNull':!![]},'announce_frequency':{'type':Sequelize[_0x953c('0x16')](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize[_0x953c('0x16')](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize[_0x953c('0x16')](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize['ENUM'](_0x953c('0x17'),'no'),'defaultValue':_0x953c('0x17')},'announce_holdtime':{'type':Sequelize[_0x953c('0x3')](_0x953c('0x17'),'no',_0x953c('0x19')),'defaultValue':'no'},'announce_position':{'type':Sequelize[_0x953c('0x2')],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize[_0x953c('0x3')](_0x953c('0x17'),'no')},'announce_position_limit':{'type':Sequelize[_0x953c('0x16')](0xb)},'announce_round_seconds':{'type':Sequelize['ENUM']('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize[_0x953c('0x2')],'defaultValue':''},'monitor_type':{'type':Sequelize['STRING']},'queue_youarenext':{'type':Sequelize['STRING'],'defaultValue':null},'queue_thereare':{'type':Sequelize[_0x953c('0x2')],'defaultValue':null},'queue_callswaiting':{'type':Sequelize['STRING'],'defaultValue':null},'queue_holdtime':{'type':Sequelize[_0x953c('0x2')],'defaultValue':null},'queue_minute':{'type':Sequelize[_0x953c('0x2')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize[_0x953c('0x2')],'defaultValue':null},'queue_seconds':{'type':Sequelize[_0x953c('0x2')],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0x953c('0x2')],'defaultValue':null},'queue_reporthold':{'type':Sequelize[_0x953c('0x2')]},'queue_quantity1':{'type':Sequelize[_0x953c('0x2')]},'queue_quantity2':{'type':Sequelize[_0x953c('0x2')]},'queue_periodic_announce':{'type':Sequelize[_0x953c('0x2')]},'queue_less_than':{'type':Sequelize['STRING']},'periodic_announce':{'type':Sequelize[_0x953c('0x1a')],'set':function(_0x3538bf){this[_0x953c('0xe')](_0x953c('0x1b'),_0x3538bf?_0x3538bf[_0x953c('0x1c')](','):[]);},'get':function(){return this[_0x953c('0x10')](_0x953c('0x1b'))?this['getDataValue'](_0x953c('0x1b'))[_0x953c('0x1d')](','):[];}},'joinempty':{'type':Sequelize[_0x953c('0x2')],'defaultValue':'yes','set':function(_0x2021cf){this['setDataValue']('joinempty',_0x2021cf?_0x2021cf['join'](','):undefined);},'get':function(){return this[_0x953c('0x10')]('joinempty')?this[_0x953c('0x10')]('joinempty')[_0x953c('0x1d')](','):undefined;}},'leavewhenempty':{'type':Sequelize[_0x953c('0x2')],'defaultValue':'no','set':function(_0x1460b6){this['setDataValue'](_0x953c('0x1e'),_0x1460b6?_0x1460b6[_0x953c('0x1c')](','):undefined);},'get':function(){return this[_0x953c('0x10')](_0x953c('0x1e'))?this['getDataValue'](_0x953c('0x1e'))[_0x953c('0x1d')](','):undefined;}},'reportholdtime':{'type':Sequelize[_0x953c('0x3')](_0x953c('0x17'),'no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize[_0x953c('0x3')](_0x953c('0x17'),'no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x953c('0x2')]},'acw':{'type':Sequelize[_0x953c('0x1f')],'defaultValue':0x0,'set':function(_0x5895bd){this['setDataValue'](_0x953c('0x20'),_0x5895bd);if(_0x5895bd){if(this[_0x953c('0x10')](_0x953c('0x21'))<0x2){this[_0x953c('0xe')]('wrapuptime',0x2);}}}},'acwTimeout':{'type':Sequelize[_0x953c('0x16')](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0x953c('0x1f')],'defaultValue':0x0,'comment':'Active/Disactive\x20Campaign'},'dialMethod':{'type':Sequelize['ENUM'](_0x953c('0x22'),_0x953c('0x14'),'power',_0x953c('0x23'),'booked'),'defaultValue':_0x953c('0x14'),'comment':_0x953c('0x24')},'dialLimitChannel':{'type':Sequelize[_0x953c('0x16')](0x4)[_0x953c('0x25')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x953c('0x26')},'dialLimitQueue':{'type':Sequelize[_0x953c('0x16')](0x4)[_0x953c('0x25')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x953c('0x27')},'dialPowerLevel':{'type':Sequelize['FLOAT'](0x2)[_0x953c('0x25')],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':_0x953c('0x28')},'dialPredictiveOptimization':{'type':Sequelize[_0x953c('0x3')](_0x953c('0x29'),_0x953c('0x2a')),'defaultValue':_0x953c('0x2a'),'comment':_0x953c('0x2b')},'dialPredictiveOptimizationPercentage':{'type':Sequelize[_0x953c('0x2c')](0x2)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':_0x953c('0x2d')},'dialPredictiveInterval':{'type':Sequelize[_0x953c('0x16')](0x3)['UNSIGNED'],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':_0x953c('0x2e')},'dialOriginateCallerIdName':{'type':Sequelize[_0x953c('0x2')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x953c('0x2')]},'dialOriginateTimeout':{'type':Sequelize[_0x953c('0x16')](0x3)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x953c('0x2f')},'dialQueueOptions':{'type':Sequelize['STRING'],'defaultValue':_0x953c('0x30'),'comment':_0x953c('0x31')},'dialQueueTimeout':{'type':Sequelize[_0x953c('0x16')](0x3)[_0x953c('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x953c('0x32')},'dialQueueProject':{'type':Sequelize[_0x953c('0x2')],'comment':_0x953c('0x33')},'dialCongestionMaxRetry':{'type':Sequelize[_0x953c('0x16')](0x3)[_0x953c('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Congestion\x20Retry\x20(min:1,\x20max:999)'},'dialCongestionRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x953c('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x953c('0x34')},'dialBusyMaxRetry':{'type':Sequelize[_0x953c('0x16')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x953c('0x35')},'dialBusyRetryFrequency':{'type':Sequelize[_0x953c('0x16')](0x5)[_0x953c('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x953c('0x36')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x953c('0x16')](0x3)[_0x953c('0x25')],'defaultValue':0x3,'comment':_0x953c('0x37')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x953c('0x16')](0x5)[_0x953c('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialGlobalMaxRetry':{'type':Sequelize[_0x953c('0x16')](0x3)['UNSIGNED'],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':'#Global\x20Max\x20Retry\x20(min:1,\x20max:999)'},'dialTimezone':{'type':Sequelize[_0x953c('0x2')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize['STRING'],'defaultValue':_0x953c('0x38')},'dialPrefix':{'type':Sequelize[_0x953c('0x2')],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize['ENUM'](_0x953c('0x39'),_0x953c('0x3a'),_0x953c('0x3b')),'defaultValue':_0x953c('0x39')},'dialAMDActive':{'type':Sequelize[_0x953c('0x1f')],'defaultValue':0x0,'comment':_0x953c('0x3c')},'dialAMDInitialSilence':{'type':Sequelize[_0x953c('0x16')](0x9)[_0x953c('0x25')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x953c('0x3d')},'dialAMDGreeting':{'type':Sequelize[_0x953c('0x16')](0x9)[_0x953c('0x25')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x953c('0x3e')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x953c('0x16')](0x9)[_0x953c('0x25')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x953c('0x3f')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x953c('0x16')](0x9)[_0x953c('0x25')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x953c('0x40')},'dialAMDMinWordLength':{'type':Sequelize['INTEGER'](0x9)[_0x953c('0x25')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x953c('0x41')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x953c('0x16')](0x9)[_0x953c('0x25')],'defaultValue':0x32,'validate':{'min':0x0},'comment':'#AMD\x20Between\x20Words\x20Silence'},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x953c('0x16')](0x9)[_0x953c('0x25')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x953c('0x42')},'dialAMDSilenceThreshold':{'type':Sequelize[_0x953c('0x16')](0x5)[_0x953c('0x25')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':'#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)'},'dialAMDMaximumWordLength':{'type':Sequelize[_0x953c('0x16')](0x9)[_0x953c('0x25')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x953c('0x43')},'dialRecallMeTimeout':{'type':Sequelize[_0x953c('0x16')](0x5)[_0x953c('0x25')],'validate':{'min':0x1},'defaultValue':0x1e,'comment':_0x953c('0x44')},'dialRecallInQueue':{'type':Sequelize[_0x953c('0x1f')],'defaultValue':0x0,'comment':'Active/Disactive\x20Recall\x20In\x20Queue'},'dialOrderByScheduledAt':{'type':Sequelize[_0x953c('0x3')](_0x953c('0x45'),'ASC'),'defaultValue':_0x953c('0x45')},'dialQueueProject2':{'type':Sequelize[_0x953c('0x2')],'comment':'AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)'},'dialAgiAfterHangupClient':{'type':Sequelize[_0x953c('0x1f')],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize[_0x953c('0x1f')],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x953c('0x16')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x953c('0x46')},'dialCutDigit':{'type':Sequelize['INTEGER'](0x3)[_0x953c('0x25')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x953c('0x47')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x953c('0x16')](0x3)[_0x953c('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x953c('0x48')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x953c('0x16')](0x5)[_0x953c('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialDropMaxRetry':{'type':Sequelize[_0x953c('0x16')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Drop\x20Retry\x20(min:1,\x20max:999)'},'dialDropRetryFrequency':{'type':Sequelize[_0x953c('0x16')](0x5)[_0x953c('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x953c('0x49')},'dialAbandonedMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x953c('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x953c('0x4a')},'dialAbandonedRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x953c('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x953c('0x4b')},'dialMachineMaxRetry':{'type':Sequelize[_0x953c('0x16')](0x3)[_0x953c('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x953c('0x4c')},'dialMachineRetryFrequency':{'type':Sequelize[_0x953c('0x16')](0x5)[_0x953c('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x953c('0x4d')},'dialAgentRejectMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x953c('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x953c('0x4e')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x953c('0x16')](0x5)[_0x953c('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'mandatoryDispositionPauseId':{'type':Sequelize[_0x953c('0x16')],'allowNull':!![],'comment':_0x953c('0x4f')},'mandatoryDisposition':{'type':Sequelize[_0x953c('0x1f')],'defaultValue':![],'comment':_0x953c('0x50'),'set':function(_0x451f1c){if(!_0x451f1c)this['setDataValue'](_0x953c('0x51'),null);this['setDataValue'](_0x953c('0x52'),_0x451f1c);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize[_0x953c('0x16')](0x3)[_0x953c('0x25')],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize['INTEGER'](0x3)[_0x953c('0x25')],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}},'dialPreviewAutoRecallMe':{'type':Sequelize[_0x953c('0x1f')],'defaultValue':!![]},'dialPreviewRecallmeReminder':{'type':Sequelize[_0x953c('0x1f')],'defaultValue':![]}}; \ No newline at end of file +var _0x760d=['UNSIGNED','Max\x209999\x20channels,\x200\x20means\x20unlimited.','Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.','FLOAT','agentBusyFactor','dropRate','Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue','Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','07:00-22:00,*,*,*','always','never','onlyIfOpen','Active/Disactive\x20AMD','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','#RecallMe\x20Timeout\x20(min:1)','Active/Disactive\x20Recall\x20In\x20Queue','DESC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','STRING','ENUM','inbound','outbound','default','ringall','leastrecent','fewestcalls','random','rrmemory','linear','wrandom','rrordered','getDataValue','dialMethod','strategy','booked','roundrobin','progressive','predictive','power','INTEGER','yes','all','setDataValue','periodic_announce','split','joinempty','join','leavewhenempty','BOOLEAN','wrapuptime','Active/Disactive\x20Campaign','preview'];(function(_0x1bce3b,_0x5c2e60){var _0x268859=function(_0xa0ecc8){while(--_0xa0ecc8){_0x1bce3b['push'](_0x1bce3b['shift']());}};_0x268859(++_0x5c2e60);}(_0x760d,0x77));var _0xd760=function(_0x2e3acf,_0x39e3b0){_0x2e3acf=_0x2e3acf-0x0;var _0x168e7e=_0x760d[_0x2e3acf];return _0x168e7e;};'use strict';var Sequelize=require(_0xd760('0x0'));module['exports']={'name':{'type':Sequelize[_0xd760('0x1')],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0xd760('0x2')](_0xd760('0x3'),_0xd760('0x4')),'allowNull':![],'defaultValue':_0xd760('0x3')},'musiconhold':{'type':Sequelize[_0xd760('0x1')],'defaultValue':_0xd760('0x5')},'announce':{'type':Sequelize[_0xd760('0x1')],'defaultValue':''},'strategy':{'type':Sequelize[_0xd760('0x2')]('rr',_0xd760('0x6'),_0xd760('0x7'),_0xd760('0x8'),_0xd760('0x9'),_0xd760('0xa'),_0xd760('0xb'),_0xd760('0xc'),_0xd760('0xd')),'allowNull':![],'defaultValue':_0xd760('0x6'),'set':function(_0x3a1fd5){this['setDataValue']('strategy',_0x3a1fd5?_0x3a1fd5:_0xd760('0xa'));},'get':function(){var _0x26b958=this['getDataValue']('type');var _0x24b15f=this[_0xd760('0xe')](_0xd760('0xf'));var _0x18ff1=this[_0xd760('0xe')](_0xd760('0x10'));if(_0x26b958===_0xd760('0x3')){return _0x18ff1;}if(_0x24b15f===_0xd760('0x11')&&_0x18ff1===_0xd760('0xa')||_0x24b15f===_0xd760('0x11')&&_0x18ff1===_0xd760('0x12')){return _0x18ff1;}if(_0x24b15f===_0xd760('0x13')||_0x24b15f===_0xd760('0x14')||_0x24b15f===_0xd760('0x15')){return _0x18ff1;}return null;}},'servicelevel':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'context':{'type':Sequelize['STRING'],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize[_0xd760('0x16')](0xb)},'timeout':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0xf},'retry':{'type':Sequelize[_0xd760('0x16')](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize['STRING']},'weight':{'type':Sequelize[_0xd760('0x16')](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize[_0xd760('0x16')](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0xd760('0x2')](_0xd760('0x17'),'no'),'defaultValue':_0xd760('0x17')},'autopause':{'type':Sequelize['ENUM'](_0xd760('0x17'),'no',_0xd760('0x18')),'defaultValue':'no'},'autopausedelay':{'type':Sequelize['INTEGER'](0xb)},'autopausebusy':{'type':Sequelize[_0xd760('0x2')]('yes','no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize[_0xd760('0x2')]('yes','no'),'defaultValue':'no'},'maxlen':{'type':Sequelize[_0xd760('0x16')](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize[_0xd760('0x2')]('yes','no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize[_0xd760('0x2')](_0xd760('0x17'),'no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize[_0xd760('0x2')](_0xd760('0x17'),'no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize[_0xd760('0x2')]('yes','no'),'defaultValue':'no'},'membermacro':{'type':Sequelize[_0xd760('0x1')],'allowNull':!![]},'membergosub':{'type':Sequelize['STRING'],'allowNull':!![]},'announce_frequency':{'type':Sequelize[_0xd760('0x16')](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize[_0xd760('0x16')](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize[_0xd760('0x2')](_0xd760('0x17'),'no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize[_0xd760('0x2')]('yes','no'),'defaultValue':_0xd760('0x17')},'announce_holdtime':{'type':Sequelize[_0xd760('0x2')](_0xd760('0x17'),'no','once'),'defaultValue':'no'},'announce_position':{'type':Sequelize[_0xd760('0x1')],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize[_0xd760('0x2')](_0xd760('0x17'),'no')},'announce_position_limit':{'type':Sequelize['INTEGER'](0xb)},'announce_round_seconds':{'type':Sequelize[_0xd760('0x2')]('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize['STRING'],'defaultValue':''},'monitor_type':{'type':Sequelize['STRING']},'queue_youarenext':{'type':Sequelize['STRING'],'defaultValue':null},'queue_thereare':{'type':Sequelize[_0xd760('0x1')],'defaultValue':null},'queue_callswaiting':{'type':Sequelize[_0xd760('0x1')],'defaultValue':null},'queue_holdtime':{'type':Sequelize[_0xd760('0x1')],'defaultValue':null},'queue_minute':{'type':Sequelize[_0xd760('0x1')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize[_0xd760('0x1')],'defaultValue':null},'queue_seconds':{'type':Sequelize['STRING'],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0xd760('0x1')],'defaultValue':null},'queue_reporthold':{'type':Sequelize[_0xd760('0x1')]},'queue_quantity1':{'type':Sequelize[_0xd760('0x1')]},'queue_quantity2':{'type':Sequelize['STRING']},'queue_periodic_announce':{'type':Sequelize[_0xd760('0x1')]},'queue_less_than':{'type':Sequelize['STRING']},'periodic_announce':{'type':Sequelize['TEXT'],'set':function(_0x40e4ac){this[_0xd760('0x19')](_0xd760('0x1a'),_0x40e4ac?_0x40e4ac['join'](','):[]);},'get':function(){return this[_0xd760('0xe')](_0xd760('0x1a'))?this['getDataValue']('periodic_announce')[_0xd760('0x1b')](','):[];}},'joinempty':{'type':Sequelize[_0xd760('0x1')],'defaultValue':_0xd760('0x17'),'set':function(_0x56ad51){this[_0xd760('0x19')]('joinempty',_0x56ad51?_0x56ad51['join'](','):undefined);},'get':function(){return this['getDataValue'](_0xd760('0x1c'))?this[_0xd760('0xe')](_0xd760('0x1c'))[_0xd760('0x1b')](','):undefined;}},'leavewhenempty':{'type':Sequelize[_0xd760('0x1')],'defaultValue':'no','set':function(_0x5ccbf5){this[_0xd760('0x19')]('leavewhenempty',_0x5ccbf5?_0x5ccbf5[_0xd760('0x1d')](','):undefined);},'get':function(){return this['getDataValue'](_0xd760('0x1e'))?this[_0xd760('0xe')]('leavewhenempty')['split'](','):undefined;}},'reportholdtime':{'type':Sequelize['ENUM'](_0xd760('0x17'),'no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize[_0xd760('0x2')]('yes','no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize[_0xd760('0x16')](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize[_0xd760('0x2')](_0xd760('0x17'),'no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'acw':{'type':Sequelize[_0xd760('0x1f')],'defaultValue':0x0,'set':function(_0x597b9f){this[_0xd760('0x19')]('acw',_0x597b9f);if(_0x597b9f){if(this[_0xd760('0xe')](_0xd760('0x20'))<0x2){this['setDataValue']('wrapuptime',0x2);}}}},'acwTimeout':{'type':Sequelize[_0xd760('0x16')](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0xd760('0x1f')],'defaultValue':0x0,'comment':_0xd760('0x21')},'dialMethod':{'type':Sequelize[_0xd760('0x2')](_0xd760('0x22'),'progressive','power',_0xd760('0x14'),_0xd760('0x11')),'defaultValue':_0xd760('0x13'),'comment':'Dial\x20Method.'},'dialLimitChannel':{'type':Sequelize[_0xd760('0x16')](0x4)[_0xd760('0x23')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0xd760('0x24')},'dialLimitQueue':{'type':Sequelize['INTEGER'](0x4)['UNSIGNED'],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0xd760('0x25')},'dialPowerLevel':{'type':Sequelize[_0xd760('0x26')](0x2)[_0xd760('0x23')],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':'Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).'},'dialPredictiveOptimization':{'type':Sequelize[_0xd760('0x2')](_0xd760('0x27'),_0xd760('0x28')),'defaultValue':_0xd760('0x28'),'comment':'Only\x20for\x20predictive\x20method.'},'dialPredictiveOptimizationPercentage':{'type':Sequelize[_0xd760('0x26')](0x2)[_0xd760('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':'Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)'},'dialPredictiveInterval':{'type':Sequelize[_0xd760('0x16')](0x3)[_0xd760('0x23')],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':_0xd760('0x29')},'dialOriginateCallerIdName':{'type':Sequelize['STRING']},'dialOriginateCallerIdNumber':{'type':Sequelize[_0xd760('0x1')]},'dialOriginateTimeout':{'type':Sequelize[_0xd760('0x16')](0x3)[_0xd760('0x23')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0xd760('0x2a')},'dialQueueOptions':{'type':Sequelize['STRING'],'defaultValue':'tTxX','comment':_0xd760('0x2b')},'dialQueueTimeout':{'type':Sequelize[_0xd760('0x16')](0x3)[_0xd760('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xd760('0x2c')},'dialQueueProject':{'type':Sequelize[_0xd760('0x1')],'comment':_0xd760('0x2d')},'dialCongestionMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xd760('0x2e')},'dialCongestionRetryFrequency':{'type':Sequelize[_0xd760('0x16')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xd760('0x2f')},'dialBusyMaxRetry':{'type':Sequelize[_0xd760('0x16')](0x3)[_0xd760('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Busy\x20Retry\x20(min:1,\x20max:999)'},'dialBusyRetryFrequency':{'type':Sequelize[_0xd760('0x16')](0x5)[_0xd760('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialNoAnswerMaxRetry':{'type':Sequelize[_0xd760('0x16')](0x3)['UNSIGNED'],'defaultValue':0x3,'comment':'#NoAnswer\x20Retry\x20(min:1,\x20max:999)'},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0xd760('0x16')](0x5)[_0xd760('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialGlobalMaxRetry':{'type':Sequelize[_0xd760('0x16')](0x3)['UNSIGNED'],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':'#Global\x20Max\x20Retry\x20(min:1,\x20max:999)'},'dialTimezone':{'type':Sequelize['STRING'],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0xd760('0x1')],'defaultValue':_0xd760('0x30')},'dialPrefix':{'type':Sequelize[_0xd760('0x1')],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize[_0xd760('0x2')](_0xd760('0x31'),_0xd760('0x32'),_0xd760('0x33')),'defaultValue':_0xd760('0x31')},'dialAMDActive':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0xd760('0x34')},'dialAMDInitialSilence':{'type':Sequelize[_0xd760('0x16')](0x9)[_0xd760('0x23')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':'#AMD\x20Initial\x20Silence'},'dialAMDGreeting':{'type':Sequelize[_0xd760('0x16')](0x9)[_0xd760('0x23')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0xd760('0x35')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0xd760('0x16')](0x9)[_0xd760('0x23')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0xd760('0x36')},'dialAMDTotalAnalysisTime':{'type':Sequelize['INTEGER'](0x9)[_0xd760('0x23')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xd760('0x37')},'dialAMDMinWordLength':{'type':Sequelize[_0xd760('0x16')](0x9)[_0xd760('0x23')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0xd760('0x38')},'dialAMDBetweenWordsSilence':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x32,'validate':{'min':0x0},'comment':'#AMD\x20Between\x20Words\x20Silence'},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0xd760('0x16')](0x9)[_0xd760('0x23')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0xd760('0x39')},'dialAMDSilenceThreshold':{'type':Sequelize[_0xd760('0x16')](0x5)['UNSIGNED'],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0xd760('0x3a')},'dialAMDMaximumWordLength':{'type':Sequelize['INTEGER'](0x9)[_0xd760('0x23')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xd760('0x3b')},'dialRecallMeTimeout':{'type':Sequelize['INTEGER'](0x5)[_0xd760('0x23')],'validate':{'min':0x1},'defaultValue':0x1e,'comment':_0xd760('0x3c')},'dialRecallInQueue':{'type':Sequelize[_0xd760('0x1f')],'defaultValue':0x0,'comment':_0xd760('0x3d')},'dialOrderByScheduledAt':{'type':Sequelize[_0xd760('0x2')](_0xd760('0x3e'),'ASC'),'defaultValue':_0xd760('0x3e')},'dialQueueProject2':{'type':Sequelize[_0xd760('0x1')],'comment':_0xd760('0x2d')},'dialAgiAfterHangupClient':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0xd760('0x16')](0x3)[_0xd760('0x23')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xd760('0x3f')},'dialCutDigit':{'type':Sequelize[_0xd760('0x16')](0x3)[_0xd760('0x23')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xd760('0x40')},'dialNoSuchNumberMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xd760('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xd760('0x41')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xd760('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialDropMaxRetry':{'type':Sequelize[_0xd760('0x16')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xd760('0x42')},'dialDropRetryFrequency':{'type':Sequelize[_0xd760('0x16')](0x5)[_0xd760('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xd760('0x43')},'dialAbandonedMaxRetry':{'type':Sequelize[_0xd760('0x16')](0x3)[_0xd760('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Abandoned\x20Retry\x20(min:1,\x20max:999)'},'dialAbandonedRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xd760('0x44')},'dialMachineMaxRetry':{'type':Sequelize[_0xd760('0x16')](0x3)[_0xd760('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xd760('0x45')},'dialMachineRetryFrequency':{'type':Sequelize[_0xd760('0x16')](0x5)[_0xd760('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xd760('0x46')},'dialAgentRejectMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xd760('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xd760('0x47')},'dialAgentRejectRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xd760('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xd760('0x48')},'mandatoryDispositionPauseId':{'type':Sequelize[_0xd760('0x16')],'allowNull':!![],'comment':_0xd760('0x49')},'mandatoryDisposition':{'type':Sequelize[_0xd760('0x1f')],'defaultValue':![],'comment':_0xd760('0x4a'),'set':function(_0x250025){if(!_0x250025)this[_0xd760('0x19')](_0xd760('0x4b'),null);this['setDataValue'](_0xd760('0x4c'),_0x250025);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize[_0xd760('0x16')](0x3)[_0xd760('0x23')],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize[_0xd760('0x16')](0x3)[_0xd760('0x23')],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}},'dialPreviewAutoRecallMe':{'type':Sequelize[_0xd760('0x1f')],'defaultValue':!![]},'dialPreviewRecallmeReminder':{'type':Sequelize[_0xd760('0x1f')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.controller.js b/server/api/voiceQueue/voiceQueue.controller.js index cb019c7..260c28f 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 _0x2536=['end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','destroy','then','get','VoiceQueues','inbound','QueueCampaigns','outbound','value','includes','type','UserProfileResource','error','stack','name','send','index','map','VoiceQueue','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','fields','length','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','rows','catch','show','params','keys','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','createdAt','updatedAt','getHoppers','findOne','CmHopper','hasOwnProperty','nolimit','VoiceQueueId','findAll','getHopperHistories','CmHopperHistory','CmHopperFinal','getHopperBlacks','CmHopperBlack','getTeams','Team','addTeams','teams','User','Agents','online','interface','flatMap','penalty','sequelize','transaction','each','TeamVoiceQueue','upsert','UserVoiceQueue','findOrCreate','UserVoiceQueueRt','isNil','format','SIP/%s','voicePause','emit','userVoiceQueue:save','removeTeams','ids','field','tq.TeamId','from','team_has_voice_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoiceQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','union','compact','isEmpty','addAgents','omit','spread','all','removeAgents','isArray','userVoiceQueue:remove','getAgents','getMembers','getLists','addLists','dialCheckDuplicateType','insert','cm_hopper','fromQuery','phone','ContactId','ListId','select','NOW()','scheduledAt','CmListId','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','cm_hopper_final','phone\x20NOT\x20IN\x20(?)','onlyIfOpen','into','COALESCE(phone,\x27\x27)','removeLists','getBlackLists','CmList','addBlackLists','removeBlackLists','rimraf','zip-dir','request-promise','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./voiceQueue.socket','sendStatus','status'];(function(_0x1c4e02,_0x2d0c9d){var _0x211a62=function(_0x5de6b0){while(--_0x5de6b0){_0x1c4e02['push'](_0x1c4e02['shift']());}};_0x211a62(++_0x2d0c9d);}(_0x2536,0x9f));var _0x6253=function(_0x4aedb1,_0x2d004b){_0x4aedb1=_0x4aedb1-0x0;var _0x1673e8=_0x2536[_0x4aedb1];return _0x1673e8;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x6253('0x0'));var zipdir=require(_0x6253('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6253('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x6253('0x3'));var util=require(_0x6253('0x4'));var path=require(_0x6253('0x5'));var sox=require(_0x6253('0x6'));var csv=require('to-csv');var ejs=require(_0x6253('0x7'));var fs=require('fs');var fs_extra=require(_0x6253('0x8'));var _=require(_0x6253('0x9'));var squel=require(_0x6253('0xa'));var crypto=require(_0x6253('0xb'));var jsforce=require(_0x6253('0xc'));var deskjs=require(_0x6253('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x6253('0xe'));var Redis=require(_0x6253('0xf'));var authService=require(_0x6253('0x10'));var qs=require(_0x6253('0x11'));var as=require(_0x6253('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x6253('0x13'))(_0x6253('0x14'));var utils=require(_0x6253('0x15'));var config=require(_0x6253('0x16'));var licenseUtil=require(_0x6253('0x17'));var db=require(_0x6253('0x18'))['db'];config['redis']=_[_0x6253('0x19')](config[_0x6253('0x1a')],{'host':_0x6253('0x1b'),'port':0x18eb});var socket=require(_0x6253('0x1c'))(new Redis(config[_0x6253('0x1a')]));require(_0x6253('0x1d'))['register'](socket);function respondWithStatusCode(_0x30952b,_0x11a6f8){_0x11a6f8=_0x11a6f8||0xcc;return function(_0x21d7ab){if(_0x21d7ab){return _0x30952b[_0x6253('0x1e')](_0x11a6f8);}return _0x30952b[_0x6253('0x1f')](_0x11a6f8)[_0x6253('0x20')]();};}function respondWithResult(_0x40cd51,_0x55ea75){_0x55ea75=_0x55ea75||0xc8;return function(_0x7f71e6){if(_0x7f71e6){return _0x40cd51[_0x6253('0x1f')](_0x55ea75)[_0x6253('0x21')](_0x7f71e6);}};}function respondWithFilteredResult(_0x59b67f,_0x2d30da){return function(_0x2aa2d4){if(_0x2aa2d4){var _0x4dcc06=typeof _0x2d30da[_0x6253('0x22')]===_0x6253('0x23')&&typeof _0x2d30da[_0x6253('0x24')]==='undefined';var _0x1fa00d=_0x2aa2d4[_0x6253('0x25')];var _0x2a394f=_0x4dcc06?0x0:_0x2d30da[_0x6253('0x22')];var _0x4115fd=_0x4dcc06?_0x2aa2d4[_0x6253('0x25')]:_0x2d30da['offset']+_0x2d30da[_0x6253('0x24')];var _0x555916;if(_0x4115fd>=_0x1fa00d){_0x4115fd=_0x1fa00d;_0x555916=0xc8;}else{_0x555916=0xce;}_0x59b67f[_0x6253('0x1f')](_0x555916);return _0x59b67f[_0x6253('0x26')](_0x6253('0x27'),_0x2a394f+'-'+_0x4115fd+'/'+_0x1fa00d)[_0x6253('0x21')](_0x2aa2d4);}return null;};}function patchUpdates(_0x133129){return function(_0x244a98){try{jsonpatch['apply'](_0x244a98,_0x133129,!![]);}catch(_0x1360f8){return BPromise[_0x6253('0x28')](_0x1360f8);}return _0x244a98[_0x6253('0x29')]();};}function saveUpdates(_0x322ef1,_0x1ad7f5){return function(_0x5db3a5){if(_0x5db3a5){return _0x5db3a5[_0x6253('0x2a')](_0x322ef1)['then'](function(_0x5cd9aa){return _0x5cd9aa;});}return null;};}function removeEntity(_0x74be26,_0x228401){return function(_0x393e20){if(_0x393e20){return _0x393e20[_0x6253('0x2b')]()[_0x6253('0x2c')](function(){var _0x5e2333=_0x393e20[_0x6253('0x2d')]({'plain':!![]});var _0x1df64a=[{'name':_0x6253('0x2e'),'value':_0x6253('0x2f'),'ignore':![]},{'name':_0x6253('0x30'),'value':_0x6253('0x31'),'ignore':![]}];var _0x4c26b2=_(_0x1df64a)['filter']('ignore')['map'](_0x6253('0x32'))[_0x6253('0x32')]();if(_[_0x6253('0x33')](_0x4c26b2,_0x5e2333[_0x6253('0x34')])){return;}var _0x5b4e2d=_['find'](_0x1df64a,[_0x6253('0x32'),_0x5e2333[_0x6253('0x34')]])['name'];return db[_0x6253('0x35')]['destroy']({'where':{'type':_0x5b4e2d,'resourceId':_0x5e2333['id']}})[_0x6253('0x2c')](function(){return _0x393e20;});})[_0x6253('0x2c')](function(){_0x74be26['status'](0xcc)[_0x6253('0x20')]();});}};}function handleEntityNotFound(_0x836349,_0x2898f6){return function(_0x3db426){if(!_0x3db426){_0x836349['sendStatus'](0x194);}return _0x3db426;};}function handleError(_0x365371,_0x5849df){_0x5849df=_0x5849df||0x1f4;return function(_0x53fb98){logger[_0x6253('0x36')](_0x53fb98[_0x6253('0x37')]);if(_0x53fb98[_0x6253('0x38')]){delete _0x53fb98[_0x6253('0x38')];}_0x365371[_0x6253('0x1f')](_0x5849df)[_0x6253('0x39')](_0x53fb98);};}exports[_0x6253('0x3a')]=function(_0xe12f6d,_0x16328a){var _0x38883b={},_0x1d9861={},_0x3c61c3={'count':0x0,'rows':[]};var _0x12f0f8=_[_0x6253('0x3b')](db[_0x6253('0x3c')][_0x6253('0x3d')],function(_0x479753){return{'name':_0x479753[_0x6253('0x3e')],'type':_0x479753['type'][_0x6253('0x3f')]};});_0x1d9861[_0x6253('0x40')]=_[_0x6253('0x3b')](_0x12f0f8,_0x6253('0x38'));_0x1d9861[_0x6253('0x41')]=_['keys'](_0xe12f6d[_0x6253('0x41')]);_0x1d9861[_0x6253('0x42')]=_[_0x6253('0x43')](_0x1d9861[_0x6253('0x40')],_0x1d9861[_0x6253('0x41')]);_0x38883b[_0x6253('0x44')]=_['intersection'](_0x1d9861[_0x6253('0x40')],qs[_0x6253('0x45')](_0xe12f6d['query']['fields']));_0x38883b[_0x6253('0x44')]=_0x38883b[_0x6253('0x44')][_0x6253('0x46')]?_0x38883b[_0x6253('0x44')]:_0x1d9861[_0x6253('0x40')];if(!_0xe12f6d[_0x6253('0x41')]['hasOwnProperty']('nolimit')){_0x38883b[_0x6253('0x24')]=qs['limit'](_0xe12f6d[_0x6253('0x41')][_0x6253('0x24')]);_0x38883b['offset']=qs[_0x6253('0x22')](_0xe12f6d[_0x6253('0x41')][_0x6253('0x22')]);}_0x38883b[_0x6253('0x47')]=qs[_0x6253('0x48')](_0xe12f6d[_0x6253('0x41')][_0x6253('0x48')]);_0x38883b[_0x6253('0x49')]=qs['filters'](_[_0x6253('0x4a')](_0xe12f6d['query'],_0x1d9861[_0x6253('0x42')]),_0x12f0f8);if(_0xe12f6d[_0x6253('0x41')][_0x6253('0x4b')]){_0x38883b['where']=_['merge'](_0x38883b[_0x6253('0x49')],{'$or':_[_0x6253('0x3b')](_0x12f0f8,function(_0x14c19a){if(_0x14c19a[_0x6253('0x34')]!==_0x6253('0x4c')){var _0x417951={};_0x417951[_0x14c19a[_0x6253('0x38')]]={'$like':'%'+_0xe12f6d[_0x6253('0x41')][_0x6253('0x4b')]+'%'};return _0x417951;}})});}_0x38883b=_[_0x6253('0x4d')]({},_0x38883b,_0xe12f6d[_0x6253('0x4e')]);var _0x1ac8c7={'where':_0x38883b['where']};return db[_0x6253('0x3c')][_0x6253('0x25')](_0x1ac8c7)['then'](function(_0x56bff5){_0x3c61c3[_0x6253('0x25')]=_0x56bff5;if(_0xe12f6d[_0x6253('0x41')][_0x6253('0x4f')]){_0x38883b[_0x6253('0x50')]=[{'all':!![]}];}return db['VoiceQueue']['findAll'](_0x38883b);})[_0x6253('0x2c')](function(_0x563829){_0x3c61c3[_0x6253('0x51')]=_0x563829;return _0x3c61c3;})[_0x6253('0x2c')](respondWithFilteredResult(_0x16328a,_0x38883b))[_0x6253('0x52')](handleError(_0x16328a,null));};exports[_0x6253('0x53')]=function(_0x597f39,_0x226b61){var _0x14cb09={'raw':![],'where':{'id':_0x597f39[_0x6253('0x54')]['id']}},_0x1b7492={};_0x1b7492['model']=_[_0x6253('0x55')](db['VoiceQueue']['rawAttributes']);_0x1b7492[_0x6253('0x41')]=_[_0x6253('0x55')](_0x597f39[_0x6253('0x41')]);_0x1b7492[_0x6253('0x42')]=_[_0x6253('0x43')](_0x1b7492[_0x6253('0x40')],_0x1b7492[_0x6253('0x41')]);_0x14cb09[_0x6253('0x44')]=_[_0x6253('0x43')](_0x1b7492[_0x6253('0x40')],qs[_0x6253('0x45')](_0x597f39[_0x6253('0x41')][_0x6253('0x45')]));_0x14cb09['attributes']=_0x14cb09[_0x6253('0x44')]['length']?_0x14cb09[_0x6253('0x44')]:_0x1b7492[_0x6253('0x40')];if(_0x597f39[_0x6253('0x41')]['includeAll']){_0x14cb09[_0x6253('0x50')]=[{'all':!![]}];}_0x14cb09=_[_0x6253('0x4d')]({},_0x14cb09,_0x597f39[_0x6253('0x4e')]);return db[_0x6253('0x3c')][_0x6253('0x56')](_0x14cb09)[_0x6253('0x2c')](handleEntityNotFound(_0x226b61,null))['then'](respondWithResult(_0x226b61,null))['catch'](handleError(_0x226b61,null));};exports['create']=function(_0x5baa84,_0x171521){return db[_0x6253('0x3c')][_0x6253('0x57')](_0x5baa84[_0x6253('0x58')],{})[_0x6253('0x2c')](function(_0x1201f4){var _0x2c89dd=_0x5baa84[_0x6253('0x59')][_0x6253('0x2d')]({'plain':!![]});if(!_0x2c89dd)throw new Error(_0x6253('0x5a'));if(_0x2c89dd[_0x6253('0x5b')]===_0x6253('0x59')){var _0x5e4f61=_0x1201f4['get']({'plain':!![]});var _0x3d7840=[{'name':_0x6253('0x2e'),'value':_0x6253('0x2f')},{'name':'QueueCampaigns','value':_0x6253('0x31')}];var _0x1239c7=_[_0x6253('0x56')](_0x3d7840,[_0x6253('0x32'),_0x5e4f61[_0x6253('0x34')]])['name'];return db[_0x6253('0x5c')][_0x6253('0x56')]({'where':{'name':_0x1239c7,'userProfileId':_0x2c89dd[_0x6253('0x5d')]},'raw':!![]})[_0x6253('0x2c')](function(_0x129594){if(_0x129594&&_0x129594[_0x6253('0x5e')]===0x0){return db[_0x6253('0x35')][_0x6253('0x57')]({'name':_0x5e4f61['name'],'resourceId':_0x5e4f61['id'],'type':_0x129594['name'],'sectionId':_0x129594['id']},{})[_0x6253('0x2c')](function(){return _0x1201f4;});}else{return _0x1201f4;}})[_0x6253('0x52')](function(_0x23d335){logger[_0x6253('0x36')](_0x6253('0x5f'),_0x23d335);throw _0x23d335;});}return _0x1201f4;})['then'](respondWithResult(_0x171521,0xc9))['catch'](handleError(_0x171521,null));};exports[_0x6253('0x60')]=function(_0x133617,_0x1ea1b1){var _0x2b2588={'where':{'id':_0x133617[_0x6253('0x54')]['id']}},_0x531349={};_0x531349['model']=_['keys'](db[_0x6253('0x3c')][_0x6253('0x3d')]);_0x2b2588[_0x6253('0x44')]=_[_0x6253('0x43')](_0x531349[_0x6253('0x40')],qs[_0x6253('0x45')](_0x133617['query']['fields']));_0x2b2588['attributes']=_0x2b2588[_0x6253('0x44')][_0x6253('0x46')]?_0x2b2588[_0x6253('0x44')]:_0x531349[_0x6253('0x40')];if(_0x133617[_0x6253('0x41')][_0x6253('0x4f')]){_0x2b2588[_0x6253('0x50')]=[{'all':!![]}];}_0x2b2588=_[_0x6253('0x4d')]({},_0x2b2588,_0x133617[_0x6253('0x4e')]);return db[_0x6253('0x3c')][_0x6253('0x56')](_0x2b2588)[_0x6253('0x2c')](handleEntityNotFound(_0x1ea1b1,null))['then'](function(_0x8636fb){if(_0x8636fb){var _0x4e4139=_0x8636fb[_0x6253('0x2d')]({'plain':!![]});_0x4e4139=qs['omit'](_0x4e4139,['id',_0x6253('0x61'),_0x6253('0x62')]);_0x133617[_0x6253('0x58')]=_['omit'](_0x133617[_0x6253('0x58')],['id',_0x6253('0x61'),_0x6253('0x62')]);return db[_0x6253('0x3c')][_0x6253('0x57')](_[_0x6253('0x4d')](_0x4e4139,_0x133617[_0x6253('0x58')]),{'include':_0x133617[_0x6253('0x41')]['includeAll']?[{'all':!![]}]:undefined})['then'](function(_0x584708){var _0x48ed12=_0x133617[_0x6253('0x59')][_0x6253('0x2d')]({'plain':!![]});if(!_0x48ed12)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x48ed12[_0x6253('0x5b')]==='user'){var _0x238fbe=_0x584708[_0x6253('0x2d')]({'plain':!![]});var _0x1c2f95=[{'name':_0x6253('0x2e'),'value':'inbound'},{'name':'QueueCampaigns','value':_0x6253('0x31')}];var _0x4b6cb=_['find'](_0x1c2f95,['value',_0x238fbe['type']])[_0x6253('0x38')];return db[_0x6253('0x5c')][_0x6253('0x56')]({'where':{'name':_0x4b6cb,'userProfileId':_0x48ed12[_0x6253('0x5d')]},'raw':!![]})[_0x6253('0x2c')](function(_0x43ac4f){if(_0x43ac4f&&_0x43ac4f[_0x6253('0x5e')]===0x0){return db[_0x6253('0x35')][_0x6253('0x57')]({'name':_0x238fbe[_0x6253('0x38')],'resourceId':_0x238fbe['id'],'type':_0x43ac4f[_0x6253('0x38')],'sectionId':_0x43ac4f['id']},{})[_0x6253('0x2c')](function(){return _0x584708;});}else{return _0x584708;}})[_0x6253('0x52')](function(_0xb902){logger[_0x6253('0x36')](_0x6253('0x5f'),_0xb902);throw _0xb902;});}return _0x584708;});}})['then'](respondWithResult(_0x1ea1b1,0xc9))[_0x6253('0x52')](handleError(_0x1ea1b1,null));};exports[_0x6253('0x2a')]=function(_0x1c71c2,_0x1cad5f){if(_0x1c71c2[_0x6253('0x58')]['id']){delete _0x1c71c2[_0x6253('0x58')]['id'];}return db['VoiceQueue'][_0x6253('0x56')]({'where':{'id':_0x1c71c2[_0x6253('0x54')]['id']}})[_0x6253('0x2c')](handleEntityNotFound(_0x1cad5f,null))[_0x6253('0x2c')](saveUpdates(_0x1c71c2[_0x6253('0x58')],null))['then'](respondWithResult(_0x1cad5f,null))[_0x6253('0x52')](handleError(_0x1cad5f,null));};exports['destroy']=function(_0x2fb09c,_0x449f86){return db['VoiceQueue'][_0x6253('0x56')]({'where':{'id':_0x2fb09c[_0x6253('0x54')]['id']}})[_0x6253('0x2c')](handleEntityNotFound(_0x449f86,null))['then'](removeEntity(_0x449f86,null))[_0x6253('0x52')](handleError(_0x449f86,null));};exports[_0x6253('0x63')]=function(_0x2adf7e,_0xc91b99,_0x59b182){var _0x53893c={'raw':![],'where':{}};var _0xf1d8a9={};var _0x13c7d2={'count':0x0,'rows':[]};return db[_0x6253('0x3c')][_0x6253('0x64')]({'where':{'id':_0x2adf7e[_0x6253('0x54')]['id']}})[_0x6253('0x2c')](handleEntityNotFound(_0xc91b99,null))[_0x6253('0x2c')](function(_0x3b9409){if(_0x3b9409){_0xf1d8a9['model']=_['keys'](db[_0x6253('0x65')]['rawAttributes']);_0xf1d8a9[_0x6253('0x41')]=_[_0x6253('0x55')](_0x2adf7e[_0x6253('0x41')]);_0xf1d8a9[_0x6253('0x42')]=_[_0x6253('0x43')](_0xf1d8a9[_0x6253('0x40')],_0xf1d8a9[_0x6253('0x41')]);_0x53893c[_0x6253('0x44')]=_[_0x6253('0x43')](_0xf1d8a9[_0x6253('0x40')],qs[_0x6253('0x45')](_0x2adf7e[_0x6253('0x41')][_0x6253('0x45')]));_0x53893c['attributes']=_0x53893c['attributes'][_0x6253('0x46')]?_0x53893c['attributes']:_0xf1d8a9[_0x6253('0x40')];if(!_0x2adf7e[_0x6253('0x41')][_0x6253('0x66')](_0x6253('0x67'))){_0x53893c[_0x6253('0x24')]=qs[_0x6253('0x24')](_0x2adf7e[_0x6253('0x41')][_0x6253('0x24')]);_0x53893c[_0x6253('0x22')]=qs['offset'](_0x2adf7e[_0x6253('0x41')][_0x6253('0x22')]);}_0x53893c[_0x6253('0x47')]=qs[_0x6253('0x48')](_0x2adf7e['query'][_0x6253('0x48')]);_0x53893c['where']=qs[_0x6253('0x42')](_[_0x6253('0x4a')](_0x2adf7e[_0x6253('0x41')],_0xf1d8a9[_0x6253('0x42')]));_0x53893c[_0x6253('0x49')][_0x6253('0x68')]=_0x3b9409['id'];if(_0x2adf7e[_0x6253('0x41')][_0x6253('0x4b')]){_0x53893c['where']=_[_0x6253('0x4d')](_0x53893c[_0x6253('0x49')],{'$or':_[_0x6253('0x3b')](_0x53893c['attributes'],function(_0x511c62){var _0x2301e9={};_0x2301e9[_0x511c62]={'$like':'%'+_0x2adf7e[_0x6253('0x41')][_0x6253('0x4b')]+'%'};return _0x2301e9;})});}_0x53893c=_[_0x6253('0x4d')]({},_0x53893c,_0x2adf7e[_0x6253('0x4e')]);return db[_0x6253('0x65')]['count']({'where':_0x53893c['where']})['then'](function(_0x36880f){_0x13c7d2[_0x6253('0x25')]=_0x36880f;if(_0x2adf7e[_0x6253('0x41')][_0x6253('0x4f')]){_0x53893c['include']=[{'all':!![]}];}return db[_0x6253('0x65')][_0x6253('0x69')](_0x53893c);})[_0x6253('0x2c')](function(_0x4dd041){_0x13c7d2[_0x6253('0x51')]=_0x4dd041;return _0x13c7d2;});}})['then'](respondWithFilteredResult(_0xc91b99,_0x53893c))[_0x6253('0x52')](handleError(_0xc91b99,null));};exports[_0x6253('0x6a')]=function(_0x132b3a,_0x39ceb1,_0x10dcef){var _0x395274={'raw':!![],'where':{}};var _0x377bff={};var _0x2b75e2={'count':0x0,'rows':[]};return db[_0x6253('0x3c')][_0x6253('0x64')]({'where':{'id':_0x132b3a[_0x6253('0x54')]['id']}})[_0x6253('0x2c')](handleEntityNotFound(_0x39ceb1,null))['then'](function(_0x115c25){if(_0x115c25){_0x377bff[_0x6253('0x40')]=_[_0x6253('0x55')](db[_0x6253('0x6b')][_0x6253('0x3d')]);_0x377bff[_0x6253('0x41')]=_['keys'](_0x132b3a[_0x6253('0x41')]);_0x377bff[_0x6253('0x42')]=_[_0x6253('0x43')](_0x377bff['model'],_0x377bff[_0x6253('0x41')]);_0x395274[_0x6253('0x44')]=_[_0x6253('0x43')](_0x377bff[_0x6253('0x40')],qs[_0x6253('0x45')](_0x132b3a[_0x6253('0x41')][_0x6253('0x45')]));_0x395274[_0x6253('0x44')]=_0x395274[_0x6253('0x44')][_0x6253('0x46')]?_0x395274[_0x6253('0x44')]:_0x377bff['model'];if(!_0x132b3a[_0x6253('0x41')]['hasOwnProperty'](_0x6253('0x67'))){_0x395274['limit']=qs[_0x6253('0x24')](_0x132b3a[_0x6253('0x41')]['limit']);_0x395274[_0x6253('0x22')]=qs['offset'](_0x132b3a[_0x6253('0x41')]['offset']);}_0x395274[_0x6253('0x47')]=qs[_0x6253('0x48')](_0x132b3a[_0x6253('0x41')][_0x6253('0x48')]);_0x395274['where']=qs[_0x6253('0x42')](_[_0x6253('0x4a')](_0x132b3a[_0x6253('0x41')],_0x377bff[_0x6253('0x42')]));_0x395274[_0x6253('0x49')][_0x6253('0x68')]=_0x115c25['id'];if(_0x132b3a[_0x6253('0x41')]['filter']){_0x395274[_0x6253('0x49')]=_['merge'](_0x395274['where'],{'$or':_[_0x6253('0x3b')](_0x395274[_0x6253('0x44')],function(_0x3e36b9){var _0x4ae009={};_0x4ae009[_0x3e36b9]={'$like':'%'+_0x132b3a[_0x6253('0x41')][_0x6253('0x4b')]+'%'};return _0x4ae009;})});}_0x395274=_[_0x6253('0x4d')]({},_0x395274,_0x132b3a['options']);return db[_0x6253('0x6b')][_0x6253('0x25')]({'where':_0x395274['where']})[_0x6253('0x2c')](function(_0x1c387e){_0x2b75e2[_0x6253('0x25')]=_0x1c387e;if(_0x132b3a['query'][_0x6253('0x4f')]){_0x395274[_0x6253('0x50')]=[{'all':!![]}];}return db[_0x6253('0x6b')][_0x6253('0x69')](_0x395274);})['then'](function(_0x1fa03d){_0x2b75e2['rows']=_0x1fa03d;return _0x2b75e2;});}})[_0x6253('0x2c')](respondWithFilteredResult(_0x39ceb1,_0x395274))[_0x6253('0x52')](handleError(_0x39ceb1,null));};exports['getHopperFinals']=function(_0x4f0e49,_0x337780,_0x23268f){var _0x219630={'raw':!![],'where':{}};var _0x4bda3e={};var _0x55e615={'count':0x0,'rows':[]};return db[_0x6253('0x3c')][_0x6253('0x64')]({'where':{'id':_0x4f0e49[_0x6253('0x54')]['id']}})[_0x6253('0x2c')](handleEntityNotFound(_0x337780,null))[_0x6253('0x2c')](function(_0x15b0c3){if(_0x15b0c3){_0x4bda3e[_0x6253('0x40')]=_[_0x6253('0x55')](db[_0x6253('0x6c')][_0x6253('0x3d')]);_0x4bda3e['query']=_[_0x6253('0x55')](_0x4f0e49[_0x6253('0x41')]);_0x4bda3e['filters']=_[_0x6253('0x43')](_0x4bda3e[_0x6253('0x40')],_0x4bda3e[_0x6253('0x41')]);_0x219630[_0x6253('0x44')]=_[_0x6253('0x43')](_0x4bda3e[_0x6253('0x40')],qs['fields'](_0x4f0e49[_0x6253('0x41')][_0x6253('0x45')]));_0x219630[_0x6253('0x44')]=_0x219630[_0x6253('0x44')][_0x6253('0x46')]?_0x219630['attributes']:_0x4bda3e[_0x6253('0x40')];if(!_0x4f0e49[_0x6253('0x41')][_0x6253('0x66')](_0x6253('0x67'))){_0x219630[_0x6253('0x24')]=qs[_0x6253('0x24')](_0x4f0e49['query'][_0x6253('0x24')]);_0x219630[_0x6253('0x22')]=qs[_0x6253('0x22')](_0x4f0e49['query']['offset']);}_0x219630[_0x6253('0x47')]=qs['sort'](_0x4f0e49[_0x6253('0x41')][_0x6253('0x48')]);_0x219630[_0x6253('0x49')]=qs['filters'](_[_0x6253('0x4a')](_0x4f0e49[_0x6253('0x41')],_0x4bda3e[_0x6253('0x42')]));_0x219630[_0x6253('0x49')][_0x6253('0x68')]=_0x15b0c3['id'];if(_0x4f0e49[_0x6253('0x41')]['filter']){_0x219630[_0x6253('0x49')]=_[_0x6253('0x4d')](_0x219630['where'],{'$or':_[_0x6253('0x3b')](_0x219630[_0x6253('0x44')],function(_0x39e0eb){var _0x15b20b={};_0x15b20b[_0x39e0eb]={'$like':'%'+_0x4f0e49['query'][_0x6253('0x4b')]+'%'};return _0x15b20b;})});}_0x219630=_[_0x6253('0x4d')]({},_0x219630,_0x4f0e49[_0x6253('0x4e')]);return db['CmHopperFinal'][_0x6253('0x25')]({'where':_0x219630[_0x6253('0x49')]})[_0x6253('0x2c')](function(_0x3ab0eb){_0x55e615[_0x6253('0x25')]=_0x3ab0eb;if(_0x4f0e49[_0x6253('0x41')]['includeAll']){_0x219630[_0x6253('0x50')]=[{'all':!![]}];}return db['CmHopperFinal']['findAll'](_0x219630);})[_0x6253('0x2c')](function(_0x278a0d){_0x55e615['rows']=_0x278a0d;return _0x55e615;});}})[_0x6253('0x2c')](respondWithFilteredResult(_0x337780,_0x219630))[_0x6253('0x52')](handleError(_0x337780,null));};exports[_0x6253('0x6d')]=function(_0x49e3c3,_0x213f38,_0x523a5f){var _0x14732b={'raw':!![],'where':{}};var _0x362351={};var _0x1f830d={'count':0x0,'rows':[]};return db['VoiceQueue'][_0x6253('0x64')]({'where':{'id':_0x49e3c3[_0x6253('0x54')]['id']}})[_0x6253('0x2c')](handleEntityNotFound(_0x213f38,null))[_0x6253('0x2c')](function(_0x53797a){if(_0x53797a){_0x362351['model']=_['keys'](db[_0x6253('0x6e')][_0x6253('0x3d')]);_0x362351[_0x6253('0x41')]=_[_0x6253('0x55')](_0x49e3c3[_0x6253('0x41')]);_0x362351[_0x6253('0x42')]=_['intersection'](_0x362351[_0x6253('0x40')],_0x362351[_0x6253('0x41')]);_0x14732b[_0x6253('0x44')]=_[_0x6253('0x43')](_0x362351[_0x6253('0x40')],qs['fields'](_0x49e3c3['query'][_0x6253('0x45')]));_0x14732b['attributes']=_0x14732b[_0x6253('0x44')]['length']?_0x14732b['attributes']:_0x362351[_0x6253('0x40')];if(!_0x49e3c3[_0x6253('0x41')][_0x6253('0x66')](_0x6253('0x67'))){_0x14732b[_0x6253('0x24')]=qs[_0x6253('0x24')](_0x49e3c3['query'][_0x6253('0x24')]);_0x14732b['offset']=qs[_0x6253('0x22')](_0x49e3c3[_0x6253('0x41')][_0x6253('0x22')]);}_0x14732b[_0x6253('0x47')]=qs[_0x6253('0x48')](_0x49e3c3[_0x6253('0x41')][_0x6253('0x48')]);_0x14732b[_0x6253('0x49')]=qs['filters'](_[_0x6253('0x4a')](_0x49e3c3[_0x6253('0x41')],_0x362351[_0x6253('0x42')]));_0x14732b['where'][_0x6253('0x68')]=_0x53797a['id'];if(_0x49e3c3[_0x6253('0x41')][_0x6253('0x4b')]){_0x14732b[_0x6253('0x49')]=_[_0x6253('0x4d')](_0x14732b[_0x6253('0x49')],{'$or':_[_0x6253('0x3b')](_0x14732b['attributes'],function(_0x587cf8){var _0x317ebc={};_0x317ebc[_0x587cf8]={'$like':'%'+_0x49e3c3[_0x6253('0x41')]['filter']+'%'};return _0x317ebc;})});}_0x14732b=_[_0x6253('0x4d')]({},_0x14732b,_0x49e3c3[_0x6253('0x4e')]);return db[_0x6253('0x6e')][_0x6253('0x25')]({'where':_0x14732b['where']})['then'](function(_0x22d40b){_0x1f830d['count']=_0x22d40b;if(_0x49e3c3['query'][_0x6253('0x4f')]){_0x14732b['include']=[{'all':!![]}];}return db['CmHopperBlack'][_0x6253('0x69')](_0x14732b);})[_0x6253('0x2c')](function(_0x4b7bd0){_0x1f830d['rows']=_0x4b7bd0;return _0x1f830d;});}})[_0x6253('0x2c')](respondWithFilteredResult(_0x213f38,_0x14732b))['catch'](handleError(_0x213f38,null));};exports[_0x6253('0x6f')]=function(_0x2fd1c1,_0x6bd28f,_0x40c6c9){var _0x71bd8d={};var _0x335f25={};var _0x16e284;var _0x4759f9;return db[_0x6253('0x3c')][_0x6253('0x64')]({'where':{'id':_0x2fd1c1[_0x6253('0x54')]['id']}})[_0x6253('0x2c')](handleEntityNotFound(_0x6bd28f,null))['then'](function(_0x5a4187){if(_0x5a4187){_0x16e284=_0x5a4187;_0x335f25[_0x6253('0x40')]=_[_0x6253('0x55')](db[_0x6253('0x70')][_0x6253('0x3d')]);_0x335f25[_0x6253('0x41')]=_[_0x6253('0x55')](_0x2fd1c1[_0x6253('0x41')]);_0x335f25[_0x6253('0x42')]=_[_0x6253('0x43')](_0x335f25[_0x6253('0x40')],_0x335f25[_0x6253('0x41')]);_0x71bd8d[_0x6253('0x44')]=_['intersection'](_0x335f25[_0x6253('0x40')],qs[_0x6253('0x45')](_0x2fd1c1[_0x6253('0x41')]['fields']));_0x71bd8d[_0x6253('0x44')]=_0x71bd8d[_0x6253('0x44')][_0x6253('0x46')]?_0x71bd8d[_0x6253('0x44')]:_0x335f25[_0x6253('0x40')];_0x71bd8d[_0x6253('0x47')]=qs[_0x6253('0x48')](_0x2fd1c1[_0x6253('0x41')]['sort']);_0x71bd8d[_0x6253('0x49')]=qs[_0x6253('0x42')](_[_0x6253('0x4a')](_0x2fd1c1[_0x6253('0x41')],_0x335f25['filters']));if(_0x2fd1c1['query'][_0x6253('0x4b')]){_0x71bd8d[_0x6253('0x49')]=_[_0x6253('0x4d')](_0x71bd8d[_0x6253('0x49')],{'$or':_[_0x6253('0x3b')](_0x71bd8d[_0x6253('0x44')],function(_0x1ade7a){var _0x5aa9bc={};_0x5aa9bc[_0x1ade7a]={'$like':'%'+_0x2fd1c1[_0x6253('0x41')][_0x6253('0x4b')]+'%'};return _0x5aa9bc;})});}_0x71bd8d=_[_0x6253('0x4d')]({},_0x71bd8d,_0x2fd1c1[_0x6253('0x4e')]);return _0x16e284['getTeams'](_0x71bd8d);}})['then'](function(_0x4cc1dd){if(_0x4cc1dd){_0x4759f9=_0x4cc1dd[_0x6253('0x46')];if(!_0x2fd1c1[_0x6253('0x41')][_0x6253('0x66')]('nolimit')){_0x71bd8d['limit']=qs[_0x6253('0x24')](_0x2fd1c1[_0x6253('0x41')][_0x6253('0x24')]);_0x71bd8d[_0x6253('0x22')]=qs[_0x6253('0x22')](_0x2fd1c1[_0x6253('0x41')][_0x6253('0x22')]);}return _0x16e284[_0x6253('0x6f')](_0x71bd8d);}})[_0x6253('0x2c')](function(_0x37a4f2){if(_0x37a4f2){return _0x37a4f2?{'count':_0x4759f9,'rows':_0x37a4f2}:null;}})[_0x6253('0x2c')](respondWithResult(_0x6bd28f,null))[_0x6253('0x52')](handleError(_0x6bd28f,null));};exports[_0x6253('0x71')]=function(_0x7d50a1,_0x148e65,_0x26d6e9){var _0x45f1da=_0x7d50a1['body'][_0x6253('0x72')];var _0x2a6d03=_[_0x6253('0x3b')](_0x45f1da,'id');return db['Team']['findAll']({'where':{'id':_0x2a6d03},'attributes':['id'],'include':[{'model':db[_0x6253('0x73')],'as':_0x6253('0x74'),'attributes':['id',_0x6253('0x38'),_0x6253('0x75'),'voicePause',_0x6253('0x76')],'raw':!![]}]})['then'](function(_0x36f846){if(_0x36f846){var _0x2ea8df=_[_0x6253('0x77')](_0x36f846,function(_0x552d94){var _0x409692=_0x552d94[_0x6253('0x2d')]({'plain':!![]});_0x409692['Agents']['forEach'](function(_0x3dac30){_0x3dac30[_0x6253('0x78')]=_[_0x6253('0x56')](_0x45f1da,{'id':_0x409692['id']})['penalty'];});return _0x409692['Agents'];});return db[_0x6253('0x3c')]['find']({'where':{'id':_0x7d50a1['params']['id']}})[_0x6253('0x2c')](function(_0x2f6398){return db[_0x6253('0x79')][_0x6253('0x7a')](function(_0x19b0a1){return _0x2f6398[_0x6253('0x71')](_0x2a6d03,{'transaction':_0x19b0a1})[_0x6253('0x2c')](function(){return BPromise[_0x6253('0x7b')](_0x45f1da,function(_0x23af7d){return db[_0x6253('0x7c')][_0x6253('0x7d')]({'TeamId':_0x23af7d['id'],'VoiceQueueId':_0x7d50a1[_0x6253('0x54')]['id'],'penalty':_0x23af7d['penalty']},{'transaction':_0x19b0a1});});})['then'](function(){return BPromise[_0x6253('0x7b')](_0x2ea8df,function(_0x2534c2){return db[_0x6253('0x7e')][_0x6253('0x7f')]({'where':{'UserId':_0x2534c2['id'],'VoiceQueueId':_0x7d50a1[_0x6253('0x54')]['id']},'defaults':{'penalty':_0x2534c2[_0x6253('0x78')]},'transaction':_0x19b0a1});});})[_0x6253('0x2c')](function(){return BPromise[_0x6253('0x7b')](_[_0x6253('0x4b')](_0x2ea8df,{'online':!![]}),function(_0x1210a1){return db[_0x6253('0x80')][_0x6253('0x7d')]({'membername':_0x1210a1[_0x6253('0x38')],'UserId':_0x1210a1['id'],'queue_name':_0x2f6398[_0x6253('0x38')],'VoiceQueueId':_0x2f6398['id'],'interface':_[_0x6253('0x81')](_0x1210a1[_0x6253('0x76')])?util[_0x6253('0x82')](_0x6253('0x83'),_0x1210a1['name']):_0x1210a1[_0x6253('0x76')],'paused':_0x1210a1[_0x6253('0x84')]||![],'penalty':_0x1210a1[_0x6253('0x78')]},{'transaction':_0x19b0a1});});})[_0x6253('0x2c')](function(){_0x2ea8df['forEach'](function(_0x4e009b){socket[_0x6253('0x85')](_0x6253('0x86'),{'UserId':_0x4e009b['id'],'VoiceQueueId':_0x2f6398['id']});});});});});}})['then'](respondWithStatusCode(_0x148e65,null))['catch'](handleError(_0x148e65,null));};exports[_0x6253('0x87')]=function(_0x3cbf51,_0x1ad224,_0x139b29){return db[_0x6253('0x70')][_0x6253('0x69')]({'where':{'id':_0x3cbf51[_0x6253('0x41')][_0x6253('0x88')]},'attributes':['id'],'include':[{'model':db[_0x6253('0x73')],'as':_0x6253('0x74'),'attributes':['id'],'raw':!![]}]})[_0x6253('0x2c')](handleEntityNotFound(_0x1ad224,null))[_0x6253('0x2c')](function(_0x4a99a9){var _0x57172c=_[_0x6253('0x3b')](_0x4a99a9,'id');var _0xd02406=[];var _0x290720=[];var _0x245566=squel['select']();_0x245566[_0x6253('0x89')](_0x6253('0x8a'))[_0x6253('0x8b')](_0x6253('0x8c'),'tq')[_0x6253('0x8d')](_0x6253('0x8e'),'ut',_0x6253('0x8f'))[_0x6253('0x49')](_0x6253('0x90'),_0x3cbf51[_0x6253('0x54')]['id']);for(var _0x5e38b5=0x0;_0x5e38b5<_0x4a99a9[_0x6253('0x46')];_0x5e38b5+=0x1){let _0x5e7a1f=_0x4a99a9[_0x5e38b5];for(var _0x2d1d94=0x0;_0x2d1d94<_0x5e7a1f[_0x6253('0x74')][_0x6253('0x46')];_0x2d1d94+=0x1){let _0x3add26=_0x5e7a1f[_0x6253('0x74')][_0x2d1d94];var _0x4d65a7=_0x245566['clone']();_0x4d65a7[_0x6253('0x49')](_0x6253('0x91'),_0x3add26['id']);_0x290720[_0x6253('0x92')](db[_0x6253('0x79')][_0x6253('0x41')](_0x4d65a7[_0x6253('0x93')](),{'type':db[_0x6253('0x79')][_0x6253('0x94')][_0x6253('0x95')]})[_0x6253('0x2c')](function(_0x4e4d6f){if(_0x4e4d6f[_0x6253('0x46')]===0x1){return _0x3add26['id'];}else{var _0x2c1d18=_[_0x6253('0x96')](_['map'](_0x4e4d6f,_0x6253('0x97')),function(_0x4b1535){return _['includes'](_0x57172c,_0x4b1535);});if(_0x2c1d18){return _0x3add26['id'];}}}));}}return BPromise['all'](_0x290720)[_0x6253('0x2c')](function(_0x5d8464){_0xd02406=_(_0xd02406)[_0x6253('0x98')](_0x5d8464)[_0x6253('0x99')]()[_0x6253('0x32')]();return db[_0x6253('0x3c')][_0x6253('0x56')]({'where':{'id':_0x3cbf51['params']['id']}})['then'](function(_0x45d7c8){return db[_0x6253('0x79')][_0x6253('0x7a')](function(_0x1d1efb){return _0x45d7c8['removeTeams'](_0x3cbf51['query'][_0x6253('0x88')],{'transaction':_0x1d1efb})['then'](function(){if(!_[_0x6253('0x9a')](_0xd02406)){return _0x45d7c8['removeAgents'](_0xd02406,{'transaction':_0x1d1efb})[_0x6253('0x2c')](function(){return db[_0x6253('0x80')][_0x6253('0x2b')]({'where':{'VoiceQueueId':_0x3cbf51[_0x6253('0x54')]['id'],'UserId':_0xd02406},'transaction':_0x1d1efb});});}})[_0x6253('0x2c')](function(){_0xd02406['forEach'](function(_0x5772eb){socket[_0x6253('0x85')]('userVoiceQueue:remove',{'UserId':_0x5772eb,'VoiceQueueId':_0x45d7c8['id']});});});});});});})[_0x6253('0x2c')](respondWithStatusCode(_0x1ad224,null))[_0x6253('0x52')](handleError(_0x1ad224,null));};exports[_0x6253('0x9b')]=function(_0x519502,_0x3522f3,_0x20ce76){var _0x212597,_0x35fe77;return db['VoiceQueue'][_0x6253('0x56')]({'where':{'id':_0x519502[_0x6253('0x54')]['id']}})[_0x6253('0x2c')](handleEntityNotFound(_0x3522f3,null))[_0x6253('0x2c')](function(_0x1381e2){if(_0x1381e2){_0x35fe77=_0x1381e2;return _0x1381e2[_0x6253('0x9b')](_0x519502[_0x6253('0x58')][_0x6253('0x88')],_[_0x6253('0x9c')](_0x519502[_0x6253('0x58')],[_0x6253('0x88'),'id'])||{})[_0x6253('0x9d')](function(_0x434a7a){for(var _0x68b442=0x0;_0x68b442<_0x519502[_0x6253('0x58')][_0x6253('0x88')][_0x6253('0x46')];_0x68b442+=0x1){socket['emit']('userVoiceQueue:save',{'UserId':Number(_0x519502[_0x6253('0x58')][_0x6253('0x88')][_0x68b442]),'VoiceQueueId':Number(_0x519502[_0x6253('0x54')]['id'])});}return _0x434a7a;});}})['then'](function(_0x4d3101){_0x212597=_0x4d3101||[];if(_0x35fe77){return db[_0x6253('0x73')][_0x6253('0x69')]({'where':{'id':_0x519502[_0x6253('0x58')][_0x6253('0x88')]},'attributes':['id',_0x6253('0x38'),'online',_0x6253('0x84'),_0x6253('0x76')],'raw':!![]});}})[_0x6253('0x2c')](function(_0x10f521){if(!_[_0x6253('0x9a')](_0x10f521)){var _0x450c02=[];for(var _0x318ed5=0x0;_0x318ed5<_0x10f521[_0x6253('0x46')];_0x318ed5++){if(_0x10f521[_0x318ed5][_0x6253('0x75')]){_0x450c02[_0x6253('0x92')](db[_0x6253('0x80')][_0x6253('0x7d')]({'membername':_0x10f521[_0x318ed5][_0x6253('0x38')],'UserId':_0x10f521[_0x318ed5]['id'],'queue_name':_0x35fe77[_0x6253('0x38')],'VoiceQueueId':_0x35fe77['id'],'interface':_['isNil'](_0x10f521[_0x318ed5][_0x6253('0x76')])?util[_0x6253('0x82')](_0x6253('0x83'),_0x10f521[_0x318ed5][_0x6253('0x38')]):_0x10f521[_0x318ed5][_0x6253('0x76')],'paused':_0x10f521[_0x318ed5][_0x6253('0x84')]||![],'penalty':_0x519502[_0x6253('0x58')][_0x6253('0x78')]||0x0}));}}return BPromise[_0x6253('0x9e')](_0x450c02);}})[_0x6253('0x2c')](function(){return _0x212597;})[_0x6253('0x2c')](respondWithResult(_0x3522f3,null))[_0x6253('0x52')](handleError(_0x3522f3,null));};exports['removeAgents']=function(_0x4589d1,_0x1a466d,_0x1a1fb7){return db[_0x6253('0x3c')][_0x6253('0x56')]({'where':{'id':_0x4589d1['params']['id']}})[_0x6253('0x2c')](handleEntityNotFound(_0x1a466d,null))['then'](function(_0x132015){if(_0x132015){return _0x132015[_0x6253('0x9f')](_0x4589d1[_0x6253('0x41')][_0x6253('0x88')])[_0x6253('0x2c')](function(){if(_[_0x6253('0xa0')](_0x4589d1[_0x6253('0x41')][_0x6253('0x88')])){for(var _0x620413=0x0;_0x620413<_0x4589d1[_0x6253('0x41')][_0x6253('0x88')][_0x6253('0x46')];_0x620413+=0x1){socket[_0x6253('0x85')](_0x6253('0xa1'),{'UserId':Number(_0x4589d1[_0x6253('0x41')][_0x6253('0x88')][_0x620413]),'VoiceQueueId':Number(_0x4589d1[_0x6253('0x54')]['id'])});}}else{socket[_0x6253('0x85')](_0x6253('0xa1'),{'UserId':Number(_0x4589d1[_0x6253('0x41')][_0x6253('0x88')]),'VoiceQueueId':Number(_0x4589d1[_0x6253('0x54')]['id'])});}});}})[_0x6253('0x2c')](function(_0x39888c){return db['UserVoiceQueueRt'][_0x6253('0x2b')]({'where':{'VoiceQueueId':_0x4589d1['params']['id'],'UserId':_0x4589d1[_0x6253('0x41')][_0x6253('0x88')]}})[_0x6253('0x2c')](function(){return _0x39888c;});})[_0x6253('0x2c')](respondWithStatusCode(_0x1a466d,null))[_0x6253('0x52')](handleError(_0x1a466d,null));};exports[_0x6253('0xa2')]=function(_0x20fd09,_0x1b0a14,_0x250a60){var _0x3da642={};var _0x3511f8={};var _0x4d7cdb;var _0x4ba48b;return db[_0x6253('0x3c')]['findOne']({'where':{'id':_0x20fd09[_0x6253('0x54')]['id']}})[_0x6253('0x2c')](handleEntityNotFound(_0x1b0a14,null))['then'](function(_0x24de7b){if(_0x24de7b){_0x4d7cdb=_0x24de7b;_0x3511f8[_0x6253('0x40')]=_['keys'](db[_0x6253('0x73')]['rawAttributes']);_0x3511f8[_0x6253('0x41')]=_[_0x6253('0x55')](_0x20fd09[_0x6253('0x41')]);_0x3511f8[_0x6253('0x42')]=_['intersection'](_0x3511f8[_0x6253('0x40')],_0x3511f8['query']);_0x3da642[_0x6253('0x44')]=_[_0x6253('0x43')](_0x3511f8['model'],qs[_0x6253('0x45')](_0x20fd09['query'][_0x6253('0x45')]));_0x3da642[_0x6253('0x44')]=_0x3da642['attributes'][_0x6253('0x46')]?_0x3da642[_0x6253('0x44')]:_0x3511f8[_0x6253('0x40')];_0x3da642[_0x6253('0x47')]=qs[_0x6253('0x48')](_0x20fd09[_0x6253('0x41')][_0x6253('0x48')]);_0x3da642[_0x6253('0x49')]=qs['filters'](_['pick'](_0x20fd09[_0x6253('0x41')],_0x3511f8[_0x6253('0x42')]));if(_0x20fd09['query']['filter']){_0x3da642['where']=_[_0x6253('0x4d')](_0x3da642[_0x6253('0x49')],{'$or':_['map'](_0x3da642[_0x6253('0x44')],function(_0x4e8846){var _0x5a1e60={};_0x5a1e60[_0x4e8846]={'$like':'%'+_0x20fd09[_0x6253('0x41')][_0x6253('0x4b')]+'%'};return _0x5a1e60;})});}_0x3da642=_[_0x6253('0x4d')]({},_0x3da642,_0x20fd09['options']);return _0x4d7cdb[_0x6253('0xa2')](_0x3da642);}})[_0x6253('0x2c')](function(_0x1f4c9c){if(_0x1f4c9c){_0x4ba48b=_0x1f4c9c[_0x6253('0x46')];if(!_0x20fd09[_0x6253('0x41')][_0x6253('0x66')](_0x6253('0x67'))){_0x3da642[_0x6253('0x24')]=qs[_0x6253('0x24')](_0x20fd09['query'][_0x6253('0x24')]);_0x3da642[_0x6253('0x22')]=qs[_0x6253('0x22')](_0x20fd09[_0x6253('0x41')][_0x6253('0x22')]);}return _0x4d7cdb[_0x6253('0xa2')](_0x3da642);}})[_0x6253('0x2c')](function(_0x20e3cc){if(_0x20e3cc){return _0x20e3cc?{'count':_0x4ba48b,'rows':_0x20e3cc}:null;}})['then'](respondWithResult(_0x1b0a14,null))[_0x6253('0x52')](handleError(_0x1b0a14,null));};exports[_0x6253('0xa3')]=function(_0x3ff500,_0x3b1aba,_0x50118f){var _0xbcc40={};var _0xcbf5c4={};var _0x45d012;var _0x5efdd0;return db['VoiceQueue']['findOne']({'where':{'id':_0x3ff500[_0x6253('0x54')]['id']}})['then'](handleEntityNotFound(_0x3b1aba,null))[_0x6253('0x2c')](function(_0x10636d){if(_0x10636d){_0x45d012=_0x10636d;_0xcbf5c4[_0x6253('0x40')]=_[_0x6253('0x55')](db[_0x6253('0x80')][_0x6253('0x3d')]);_0xcbf5c4[_0x6253('0x41')]=_['keys'](_0x3ff500['query']);_0xcbf5c4[_0x6253('0x42')]=_[_0x6253('0x43')](_0xcbf5c4[_0x6253('0x40')],_0xcbf5c4[_0x6253('0x41')]);_0xbcc40[_0x6253('0x44')]=_[_0x6253('0x43')](_0xcbf5c4['model'],qs['fields'](_0x3ff500[_0x6253('0x41')][_0x6253('0x45')]));_0xbcc40[_0x6253('0x44')]=_0xbcc40['attributes']['length']?_0xbcc40[_0x6253('0x44')]:_0xcbf5c4[_0x6253('0x40')];_0xbcc40['order']=qs[_0x6253('0x48')](_0x3ff500['query']['sort']);_0xbcc40[_0x6253('0x49')]=qs[_0x6253('0x42')](_[_0x6253('0x4a')](_0x3ff500[_0x6253('0x41')],_0xcbf5c4[_0x6253('0x42')]));if(_0x3ff500[_0x6253('0x41')]['filter']){_0xbcc40[_0x6253('0x49')]=_[_0x6253('0x4d')](_0xbcc40[_0x6253('0x49')],{'$or':_[_0x6253('0x3b')](_0xbcc40[_0x6253('0x44')],function(_0x3c3341){var _0x546600={};_0x546600[_0x3c3341]={'$like':'%'+_0x3ff500[_0x6253('0x41')]['filter']+'%'};return _0x546600;})});}_0xbcc40=_[_0x6253('0x4d')]({},_0xbcc40,_0x3ff500['options']);return _0x45d012[_0x6253('0xa3')](_0xbcc40);}})['then'](function(_0x199f76){if(_0x199f76){_0x5efdd0=_0x199f76[_0x6253('0x46')];if(!_0x3ff500[_0x6253('0x41')][_0x6253('0x66')](_0x6253('0x67'))){_0xbcc40['limit']=qs['limit'](_0x3ff500[_0x6253('0x41')]['limit']);_0xbcc40['offset']=qs['offset'](_0x3ff500[_0x6253('0x41')][_0x6253('0x22')]);}return _0x45d012[_0x6253('0xa3')](_0xbcc40);}})[_0x6253('0x2c')](function(_0x837fc){return _0x837fc?{'count':_0x5efdd0,'rows':_0x837fc}:null;})[_0x6253('0x2c')](respondWithResult(_0x3b1aba,null))[_0x6253('0x52')](handleError(_0x3b1aba,null));};exports[_0x6253('0xa4')]=function(_0x4b3957,_0x57acb1,_0xabb46e){var _0x1e6d7d={};var _0x3f1c26={};var _0x35fc86;var _0x43cfc4;return db['VoiceQueue'][_0x6253('0x64')]({'where':{'id':_0x4b3957['params']['id']}})[_0x6253('0x2c')](handleEntityNotFound(_0x57acb1,null))[_0x6253('0x2c')](function(_0x8bfb13){if(_0x8bfb13){_0x35fc86=_0x8bfb13;_0x3f1c26['model']=_['keys'](db['CmList']['rawAttributes']);_0x3f1c26[_0x6253('0x41')]=_[_0x6253('0x55')](_0x4b3957[_0x6253('0x41')]);_0x3f1c26[_0x6253('0x42')]=_[_0x6253('0x43')](_0x3f1c26[_0x6253('0x40')],_0x3f1c26['query']);_0x1e6d7d[_0x6253('0x44')]=_[_0x6253('0x43')](_0x3f1c26[_0x6253('0x40')],qs[_0x6253('0x45')](_0x4b3957['query'][_0x6253('0x45')]));_0x1e6d7d['attributes']=_0x1e6d7d['attributes'][_0x6253('0x46')]?_0x1e6d7d[_0x6253('0x44')]:_0x3f1c26[_0x6253('0x40')];_0x1e6d7d['order']=qs[_0x6253('0x48')](_0x4b3957[_0x6253('0x41')][_0x6253('0x48')]);_0x1e6d7d['where']=qs['filters'](_['pick'](_0x4b3957['query'],_0x3f1c26[_0x6253('0x42')]));if(_0x4b3957[_0x6253('0x41')][_0x6253('0x4b')]){_0x1e6d7d[_0x6253('0x49')]=_[_0x6253('0x4d')](_0x1e6d7d['where'],{'$or':_[_0x6253('0x3b')](_0x1e6d7d[_0x6253('0x44')],function(_0x113cca){var _0x250599={};_0x250599[_0x113cca]={'$like':'%'+_0x4b3957[_0x6253('0x41')][_0x6253('0x4b')]+'%'};return _0x250599;})});}_0x1e6d7d=_['merge']({},_0x1e6d7d,_0x4b3957[_0x6253('0x4e')]);return _0x35fc86[_0x6253('0xa4')](_0x1e6d7d);}})[_0x6253('0x2c')](function(_0x527cfa){if(_0x527cfa){_0x43cfc4=_0x527cfa['length'];if(!_0x4b3957[_0x6253('0x41')][_0x6253('0x66')](_0x6253('0x67'))){_0x1e6d7d['limit']=qs['limit'](_0x4b3957[_0x6253('0x41')][_0x6253('0x24')]);_0x1e6d7d[_0x6253('0x22')]=qs[_0x6253('0x22')](_0x4b3957[_0x6253('0x41')][_0x6253('0x22')]);}return _0x35fc86['getLists'](_0x1e6d7d);}})['then'](function(_0x35cc1d){if(_0x35cc1d){return _0x35cc1d?{'count':_0x43cfc4,'rows':_0x35cc1d}:null;}})[_0x6253('0x2c')](respondWithResult(_0x57acb1,null))[_0x6253('0x52')](handleError(_0x57acb1,null));};exports[_0x6253('0xa5')]=function(_0x1803dd,_0xf98ffe,_0x933a33){var _0x18462e,_0x20e801;return db[_0x6253('0x3c')][_0x6253('0x56')]({'where':{'id':_0x1803dd[_0x6253('0x54')]['id']}})[_0x6253('0x2c')](handleEntityNotFound(_0xf98ffe,null))[_0x6253('0x2c')](function(_0x1e2077){if(_0x1e2077){_0x20e801=_0x1e2077;return _0x1e2077[_0x6253('0xa5')](_0x1803dd[_0x6253('0x58')][_0x6253('0x88')],_[_0x6253('0x9c')](_0x1803dd['body'],[_0x6253('0x88'),'id'])||{});}return null;})[_0x6253('0x9d')](function(_0xf16eda){var _0x462ded;_0x18462e=_0xf16eda||[];var _0x2299f3=[];if(_0xf16eda){for(var _0x4d08b7=0x0;_0x4d08b7<_0xf16eda['length'];_0x4d08b7+=0x1){var _0x3a1770=_0xf16eda[_0x4d08b7]['get']({'plain':!![]});_0x20e801['dialCheckDuplicateType']=_0x1803dd[_0x6253('0x58')]['dialCheckDuplicateType']?_0x1803dd[_0x6253('0x58')][_0x6253('0xa6')]:_0x20e801[_0x6253('0xa6')];switch(_0x20e801[_0x6253('0xa6')]){case'always':_0x462ded=squel[_0x6253('0xa7')]()['into'](_0x6253('0xa8'))[_0x6253('0xa9')]([_0x6253('0xaa'),'scheduledAt',_0x6253('0xab'),_0x6253('0xac'),_0x6253('0x68'),_0x6253('0x61'),_0x6253('0x62')],squel[_0x6253('0xad')]()[_0x6253('0x89')](_0x6253('0xaa'),_0x6253('0xaa'))[_0x6253('0x89')](_0x6253('0xae'),_0x6253('0xaf'))['field']('id',_0x6253('0xab'))[_0x6253('0x89')](_0x3a1770[_0x6253('0xb0')]['toString'](),_0x6253('0xac'))[_0x6253('0x89')](_0x1803dd[_0x6253('0x54')]['id']['toString'](),'VoiceQueueId')[_0x6253('0x89')](_0x6253('0xae'),_0x6253('0x61'))[_0x6253('0x89')]('NOW()',_0x6253('0x62'))['from'](_0x6253('0xb1'))[_0x6253('0x49')](_0x6253('0xb2'))[_0x6253('0x49')](_0x6253('0xb3'),_0x3a1770[_0x6253('0xb0')][_0x6253('0x93')]())[_0x6253('0x49')](_0x6253('0xb4'))[_0x6253('0x49')]('phone\x20NOT\x20IN\x20(?)',squel[_0x6253('0xad')]()['field']('COALESCE(calleridnum,\x27\x27)')[_0x6253('0x8b')](_0x6253('0xb5'))[_0x6253('0x49')](_0x6253('0x90'),_0x1803dd[_0x6253('0x54')]['id'][_0x6253('0x93')]()))['where'](_0x6253('0xb6'),squel[_0x6253('0xad')]()[_0x6253('0x89')]('COALESCE(phone,\x27\x27)')[_0x6253('0x8b')](_0x6253('0xa8'))[_0x6253('0x49')](_0x6253('0x90'),_0x1803dd[_0x6253('0x54')]['id']['toString']())))[_0x6253('0x93')]();break;case _0x6253('0xb7'):_0x462ded=squel[_0x6253('0xa7')]()[_0x6253('0xb8')](_0x6253('0xa8'))[_0x6253('0xa9')](['phone',_0x6253('0xaf'),_0x6253('0xab'),_0x6253('0xac'),_0x6253('0x68'),_0x6253('0x61'),_0x6253('0x62')],squel['select']()[_0x6253('0x89')](_0x6253('0xaa'),'phone')[_0x6253('0x89')](_0x6253('0xae'),'scheduledAt')[_0x6253('0x89')]('id','ContactId')[_0x6253('0x89')](_0x3a1770[_0x6253('0xb0')][_0x6253('0x93')](),_0x6253('0xac'))[_0x6253('0x89')](_0x1803dd[_0x6253('0x54')]['id'][_0x6253('0x93')](),'VoiceQueueId')[_0x6253('0x89')]('NOW()',_0x6253('0x61'))[_0x6253('0x89')](_0x6253('0xae'),_0x6253('0x62'))['from']('cm_contacts')[_0x6253('0x49')]('deletedAt\x20IS\x20NULL')['where'](_0x6253('0xb3'),_0x3a1770['CmListId'][_0x6253('0x93')]())[_0x6253('0x49')]('phone\x20IS\x20NOT\x20NULL')['where'](_0x6253('0xb6'),squel[_0x6253('0xad')]()['field'](_0x6253('0xb9'))[_0x6253('0x8b')](_0x6253('0xa8'))[_0x6253('0x49')](_0x6253('0x90'),_0x1803dd['params']['id'][_0x6253('0x93')]())))[_0x6253('0x93')]();break;default:_0x462ded=squel[_0x6253('0xa7')]()[_0x6253('0xb8')](_0x6253('0xa8'))['fromQuery']([_0x6253('0xaa'),_0x6253('0xaf'),_0x6253('0xab'),'ListId',_0x6253('0x68'),_0x6253('0x61'),_0x6253('0x62')],squel[_0x6253('0xad')]()[_0x6253('0x89')](_0x6253('0xaa'),'phone')[_0x6253('0x89')](_0x6253('0xae'),_0x6253('0xaf'))[_0x6253('0x89')]('id',_0x6253('0xab'))['field'](_0x3a1770[_0x6253('0xb0')][_0x6253('0x93')](),_0x6253('0xac'))[_0x6253('0x89')](_0x1803dd[_0x6253('0x54')]['id'][_0x6253('0x93')](),_0x6253('0x68'))[_0x6253('0x89')](_0x6253('0xae'),'createdAt')[_0x6253('0x89')](_0x6253('0xae'),_0x6253('0x62'))[_0x6253('0x8b')]('cm_contacts')['where'](_0x6253('0xb2'))['where'](_0x6253('0xb3'),_0x3a1770['CmListId'][_0x6253('0x93')]())['where'](_0x6253('0xb4')))['toString']();}_0x2299f3['push'](db[_0x6253('0x79')]['query'](_0x462ded));}return BPromise['all'](_0x2299f3);}})['then'](function(){return _0x18462e;})[_0x6253('0x2c')](respondWithResult(_0xf98ffe,null))['catch'](handleError(_0xf98ffe,null));};exports[_0x6253('0xba')]=function(_0x31d93a,_0x37223f,_0x1ea38e){return db[_0x6253('0x3c')][_0x6253('0x56')]({'where':{'id':_0x31d93a[_0x6253('0x54')]['id']}})[_0x6253('0x2c')](handleEntityNotFound(_0x37223f,null))[_0x6253('0x2c')](function(_0xeb2102){if(_0xeb2102){return _0xeb2102[_0x6253('0xba')](_0x31d93a[_0x6253('0x41')][_0x6253('0x88')]);}})['then'](function(_0x2622c2){if(_0x2622c2){return db[_0x6253('0x65')][_0x6253('0x2b')]({'where':{'ListId':_0x31d93a[_0x6253('0x41')][_0x6253('0x88')],'VoiceQueueId':_0x31d93a[_0x6253('0x54')]['id']}})[_0x6253('0x2c')](function(){return _0x2622c2;});}})[_0x6253('0x2c')](respondWithStatusCode(_0x37223f,null))['catch'](handleError(_0x37223f,null));};exports[_0x6253('0xbb')]=function(_0x44747f,_0x448af1,_0x45bb59){var _0x49340a={};var _0x174e58={};var _0x43341e;var _0x59e68b;return db[_0x6253('0x3c')][_0x6253('0x64')]({'where':{'id':_0x44747f[_0x6253('0x54')]['id']}})['then'](handleEntityNotFound(_0x448af1,null))[_0x6253('0x2c')](function(_0x177492){if(_0x177492){_0x43341e=_0x177492;_0x174e58[_0x6253('0x40')]=_[_0x6253('0x55')](db[_0x6253('0xbc')][_0x6253('0x3d')]);_0x174e58[_0x6253('0x41')]=_[_0x6253('0x55')](_0x44747f[_0x6253('0x41')]);_0x174e58[_0x6253('0x42')]=_[_0x6253('0x43')](_0x174e58[_0x6253('0x40')],_0x174e58[_0x6253('0x41')]);_0x49340a[_0x6253('0x44')]=_[_0x6253('0x43')](_0x174e58[_0x6253('0x40')],qs[_0x6253('0x45')](_0x44747f[_0x6253('0x41')][_0x6253('0x45')]));_0x49340a[_0x6253('0x44')]=_0x49340a['attributes'][_0x6253('0x46')]?_0x49340a[_0x6253('0x44')]:_0x174e58[_0x6253('0x40')];_0x49340a[_0x6253('0x47')]=qs[_0x6253('0x48')](_0x44747f[_0x6253('0x41')][_0x6253('0x48')]);_0x49340a['where']=qs['filters'](_[_0x6253('0x4a')](_0x44747f[_0x6253('0x41')],_0x174e58[_0x6253('0x42')]));if(_0x44747f[_0x6253('0x41')][_0x6253('0x4b')]){_0x49340a['where']=_['merge'](_0x49340a[_0x6253('0x49')],{'$or':_['map'](_0x49340a[_0x6253('0x44')],function(_0x446dd6){var _0xc19cdd={};_0xc19cdd[_0x446dd6]={'$like':'%'+_0x44747f[_0x6253('0x41')][_0x6253('0x4b')]+'%'};return _0xc19cdd;})});}_0x49340a=_['merge']({},_0x49340a,_0x44747f[_0x6253('0x4e')]);return _0x43341e['getBlackLists'](_0x49340a);}})[_0x6253('0x2c')](function(_0x30e28f){if(_0x30e28f){_0x59e68b=_0x30e28f[_0x6253('0x46')];if(!_0x44747f[_0x6253('0x41')][_0x6253('0x66')](_0x6253('0x67'))){_0x49340a[_0x6253('0x24')]=qs[_0x6253('0x24')](_0x44747f[_0x6253('0x41')][_0x6253('0x24')]);_0x49340a['offset']=qs[_0x6253('0x22')](_0x44747f[_0x6253('0x41')]['offset']);}return _0x43341e[_0x6253('0xbb')](_0x49340a);}})['then'](function(_0x5e9f27){if(_0x5e9f27){return _0x5e9f27?{'count':_0x59e68b,'rows':_0x5e9f27}:null;}})[_0x6253('0x2c')](respondWithResult(_0x448af1,null))['catch'](handleError(_0x448af1,null));};exports[_0x6253('0xbd')]=function(_0x2f71d6,_0x531e5c,_0x1da710){var _0x495ac8,_0x59fdde;return db['VoiceQueue']['find']({'where':{'id':_0x2f71d6[_0x6253('0x54')]['id']}})[_0x6253('0x2c')](handleEntityNotFound(_0x531e5c,null))[_0x6253('0x2c')](function(_0x59b9f7){if(_0x59b9f7){_0x59fdde=_0x59b9f7;return _0x59b9f7[_0x6253('0xbd')](_0x2f71d6['body'][_0x6253('0x88')],_[_0x6253('0x9c')](_0x2f71d6[_0x6253('0x58')],['ids','id'])||{});}return null;})[_0x6253('0x9d')](function(_0x2954db){var _0x4814b3;_0x495ac8=_0x2954db||[];var _0x56c1db=[];if(_0x2954db){for(var _0x31c143=0x0;_0x31c143<_0x2954db[_0x6253('0x46')];_0x31c143+=0x1){var _0x28c8fd=_0x2954db[_0x31c143]['get']({'plain':!![]});_0x4814b3=squel[_0x6253('0xa7')]()[_0x6253('0xb8')]('cm_hopper_black')[_0x6253('0xa9')]([_0x6253('0xaa'),_0x6253('0xab'),'ListId',_0x6253('0x68'),'createdAt',_0x6253('0x62')],squel[_0x6253('0xad')]()[_0x6253('0x89')](_0x6253('0xaa'),'phone')['field']('id',_0x6253('0xab'))[_0x6253('0x89')](_0x28c8fd['CmListId'][_0x6253('0x93')](),_0x6253('0xac'))[_0x6253('0x89')](_0x2f71d6[_0x6253('0x54')]['id'][_0x6253('0x93')](),_0x6253('0x68'))[_0x6253('0x89')](_0x6253('0xae'),_0x6253('0x61'))[_0x6253('0x89')](_0x6253('0xae'),_0x6253('0x62'))[_0x6253('0x8b')]('cm_contacts')[_0x6253('0x49')]('deletedAt\x20IS\x20NULL')[_0x6253('0x49')]('ListId\x20=\x20?',_0x28c8fd[_0x6253('0xb0')][_0x6253('0x93')]())[_0x6253('0x49')](_0x6253('0xb4')))['toString']();_0x56c1db[_0x6253('0x92')](db['sequelize'][_0x6253('0x41')](_0x4814b3));}return BPromise[_0x6253('0x9e')](_0x56c1db);}})[_0x6253('0x2c')](function(){return _0x495ac8;})[_0x6253('0x2c')](respondWithResult(_0x531e5c,null))[_0x6253('0x52')](handleError(_0x531e5c,null));};exports[_0x6253('0xbe')]=function(_0x48582c,_0x2453ee,_0x6db5de){return db['VoiceQueue'][_0x6253('0x56')]({'where':{'id':_0x48582c[_0x6253('0x54')]['id']}})['then'](handleEntityNotFound(_0x2453ee,null))['then'](function(_0x501c39){if(_0x501c39){return _0x501c39[_0x6253('0xbe')](_0x48582c[_0x6253('0x41')][_0x6253('0x88')]);}})[_0x6253('0x2c')](function(_0x1e251c){if(_0x1e251c){return db['CmHopperBlack']['destroy']({'where':{'ListId':_0x48582c[_0x6253('0x41')]['ids'],'VoiceQueueId':_0x48582c[_0x6253('0x54')]['id']}})[_0x6253('0x2c')](function(){return _0x1e251c;});}})['then'](respondWithStatusCode(_0x2453ee,null))[_0x6253('0x52')](handleError(_0x2453ee,null));}; \ No newline at end of file +var _0x1b5d=['api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','register','status','offset','undefined','limit','count','set','Content-Range','json','apply','save','update','then','destroy','VoiceQueues','inbound','QueueCampaigns','outbound','filter','ignore','value','includes','type','find','name','UserProfileResource','error','stack','send','index','map','VoiceQueue','rawAttributes','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','pick','merge','VIRTUAL','options','includeAll','rows','catch','show','include','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','params','createdAt','updatedAt','body','omit','role','UserProfileSection','userProfileId','getHoppers','findOne','CmHopper','nolimit','VoiceQueueId','getHopperHistories','CmHopperHistory','getHopperFinals','CmHopperFinal','findAll','getHopperBlacks','CmHopperBlack','getTeams','Team','addTeams','teams','User','Agents','online','voicePause','interface','flatMap','forEach','penalty','sequelize','each','TeamVoiceQueue','upsert','UserVoiceQueueRt','format','SIP/%s','emit','userVoiceQueue:save','removeTeams','ids','select','field','tq.TeamId','from','team_has_voice_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoiceQueueId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','all','union','compact','isEmpty','userVoiceQueue:remove','addAgents','spread','removeAgents','isArray','getAgents','getMembers','getLists','CmList','addLists','dialCheckDuplicateType','always','into','cm_hopper','fromQuery','phone','scheduledAt','ContactId','ListId','NOW()','CmListId','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','cm_hopper_final','COALESCE(phone,\x27\x27)','onlyIfOpen','insert','getBlackLists','addBlackLists','cm_hopper_black','removeBlackLists','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0x5a7112,_0x1f9492){var _0x3147f7=function(_0x4d2329){while(--_0x4d2329){_0x5a7112['push'](_0x5a7112['shift']());}};_0x3147f7(++_0x1f9492);}(_0x1b5d,0x160));var _0xd1b5=function(_0x483295,_0x59f963){_0x483295=_0x483295-0x0;var _0x399ec2=_0x1b5d[_0x483295];return _0x399ec2;};'use strict';var emlformat=require(_0xd1b5('0x0'));var rimraf=require(_0xd1b5('0x1'));var zipdir=require(_0xd1b5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xd1b5('0x3'));var BPromise=require(_0xd1b5('0x4'));var Mustache=require(_0xd1b5('0x5'));var util=require(_0xd1b5('0x6'));var path=require(_0xd1b5('0x7'));var sox=require(_0xd1b5('0x8'));var csv=require(_0xd1b5('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xd1b5('0xa'));var squel=require(_0xd1b5('0xb'));var crypto=require(_0xd1b5('0xc'));var jsforce=require(_0xd1b5('0xd'));var deskjs=require(_0xd1b5('0xe'));var toCsv=require(_0xd1b5('0x9'));var querystring=require(_0xd1b5('0xf'));var Papa=require(_0xd1b5('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xd1b5('0x11'));var as=require(_0xd1b5('0x12'));var hardwareService=require(_0xd1b5('0x13'));var logger=require('../../config/logger')(_0xd1b5('0x14'));var utils=require(_0xd1b5('0x15'));var config=require(_0xd1b5('0x16'));var licenseUtil=require(_0xd1b5('0x17'));var db=require(_0xd1b5('0x18'))['db'];config[_0xd1b5('0x19')]=_[_0xd1b5('0x1a')](config[_0xd1b5('0x19')],{'host':'localhost','port':0x18eb});var socket=require(_0xd1b5('0x1b'))(new Redis(config[_0xd1b5('0x19')]));require('./voiceQueue.socket')[_0xd1b5('0x1c')](socket);function respondWithStatusCode(_0x455fd1,_0x14927e){_0x14927e=_0x14927e||0xcc;return function(_0xd07241){if(_0xd07241){return _0x455fd1['sendStatus'](_0x14927e);}return _0x455fd1[_0xd1b5('0x1d')](_0x14927e)['end']();};}function respondWithResult(_0x45c2f1,_0x11b3ec){_0x11b3ec=_0x11b3ec||0xc8;return function(_0x3e2445){if(_0x3e2445){return _0x45c2f1['status'](_0x11b3ec)['json'](_0x3e2445);}};}function respondWithFilteredResult(_0x4510ac,_0x420a50){return function(_0x49f384){if(_0x49f384){var _0x4539e0=typeof _0x420a50[_0xd1b5('0x1e')]===_0xd1b5('0x1f')&&typeof _0x420a50[_0xd1b5('0x20')]===_0xd1b5('0x1f');var _0x2c51b5=_0x49f384[_0xd1b5('0x21')];var _0x9399a9=_0x4539e0?0x0:_0x420a50['offset'];var _0x5d218a=_0x4539e0?_0x49f384[_0xd1b5('0x21')]:_0x420a50[_0xd1b5('0x1e')]+_0x420a50[_0xd1b5('0x20')];var _0x5c6d0e;if(_0x5d218a>=_0x2c51b5){_0x5d218a=_0x2c51b5;_0x5c6d0e=0xc8;}else{_0x5c6d0e=0xce;}_0x4510ac[_0xd1b5('0x1d')](_0x5c6d0e);return _0x4510ac[_0xd1b5('0x22')](_0xd1b5('0x23'),_0x9399a9+'-'+_0x5d218a+'/'+_0x2c51b5)[_0xd1b5('0x24')](_0x49f384);}return null;};}function patchUpdates(_0x572a5d){return function(_0x340665){try{jsonpatch[_0xd1b5('0x25')](_0x340665,_0x572a5d,!![]);}catch(_0x1b5d8d){return BPromise['reject'](_0x1b5d8d);}return _0x340665[_0xd1b5('0x26')]();};}function saveUpdates(_0x3c74fd,_0x37f1a8){return function(_0x589e76){if(_0x589e76){return _0x589e76[_0xd1b5('0x27')](_0x3c74fd)[_0xd1b5('0x28')](function(_0x2be3de){return _0x2be3de;});}return null;};}function removeEntity(_0x35aa60,_0x1e3cb3){return function(_0x96077d){if(_0x96077d){return _0x96077d[_0xd1b5('0x29')]()['then'](function(){var _0x1ff2a3=_0x96077d['get']({'plain':!![]});var _0x394252=[{'name':_0xd1b5('0x2a'),'value':_0xd1b5('0x2b'),'ignore':![]},{'name':_0xd1b5('0x2c'),'value':_0xd1b5('0x2d'),'ignore':![]}];var _0x499213=_(_0x394252)[_0xd1b5('0x2e')](_0xd1b5('0x2f'))['map'](_0xd1b5('0x30'))[_0xd1b5('0x30')]();if(_[_0xd1b5('0x31')](_0x499213,_0x1ff2a3[_0xd1b5('0x32')])){return;}var _0x404b84=_[_0xd1b5('0x33')](_0x394252,[_0xd1b5('0x30'),_0x1ff2a3[_0xd1b5('0x32')]])[_0xd1b5('0x34')];return db[_0xd1b5('0x35')][_0xd1b5('0x29')]({'where':{'type':_0x404b84,'resourceId':_0x1ff2a3['id']}})[_0xd1b5('0x28')](function(){return _0x96077d;});})[_0xd1b5('0x28')](function(){_0x35aa60['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1feb8b,_0x1f0f52){return function(_0x97947f){if(!_0x97947f){_0x1feb8b['sendStatus'](0x194);}return _0x97947f;};}function handleError(_0x221abe,_0x36a6e7){_0x36a6e7=_0x36a6e7||0x1f4;return function(_0x1dc716){logger[_0xd1b5('0x36')](_0x1dc716[_0xd1b5('0x37')]);if(_0x1dc716['name']){delete _0x1dc716[_0xd1b5('0x34')];}_0x221abe[_0xd1b5('0x1d')](_0x36a6e7)[_0xd1b5('0x38')](_0x1dc716);};}exports[_0xd1b5('0x39')]=function(_0xa18ade,_0xc5da5b){var _0x3421f3={},_0x24e33e={},_0x4891b8={'count':0x0,'rows':[]};var _0x309eb4=_[_0xd1b5('0x3a')](db[_0xd1b5('0x3b')][_0xd1b5('0x3c')],function(_0x83b865){return{'name':_0x83b865['fieldName'],'type':_0x83b865[_0xd1b5('0x32')][_0xd1b5('0x3d')]};});_0x24e33e['model']=_[_0xd1b5('0x3a')](_0x309eb4,_0xd1b5('0x34'));_0x24e33e[_0xd1b5('0x3e')]=_[_0xd1b5('0x3f')](_0xa18ade['query']);_0x24e33e[_0xd1b5('0x40')]=_[_0xd1b5('0x41')](_0x24e33e[_0xd1b5('0x42')],_0x24e33e[_0xd1b5('0x3e')]);_0x3421f3[_0xd1b5('0x43')]=_[_0xd1b5('0x41')](_0x24e33e[_0xd1b5('0x42')],qs['fields'](_0xa18ade[_0xd1b5('0x3e')][_0xd1b5('0x44')]));_0x3421f3[_0xd1b5('0x43')]=_0x3421f3[_0xd1b5('0x43')][_0xd1b5('0x45')]?_0x3421f3[_0xd1b5('0x43')]:_0x24e33e['model'];if(!_0xa18ade['query'][_0xd1b5('0x46')]('nolimit')){_0x3421f3[_0xd1b5('0x20')]=qs[_0xd1b5('0x20')](_0xa18ade[_0xd1b5('0x3e')][_0xd1b5('0x20')]);_0x3421f3[_0xd1b5('0x1e')]=qs[_0xd1b5('0x1e')](_0xa18ade[_0xd1b5('0x3e')][_0xd1b5('0x1e')]);}_0x3421f3[_0xd1b5('0x47')]=qs['sort'](_0xa18ade[_0xd1b5('0x3e')][_0xd1b5('0x48')]);_0x3421f3[_0xd1b5('0x49')]=qs['filters'](_[_0xd1b5('0x4a')](_0xa18ade[_0xd1b5('0x3e')],_0x24e33e[_0xd1b5('0x40')]),_0x309eb4);if(_0xa18ade[_0xd1b5('0x3e')][_0xd1b5('0x2e')]){_0x3421f3['where']=_[_0xd1b5('0x4b')](_0x3421f3[_0xd1b5('0x49')],{'$or':_[_0xd1b5('0x3a')](_0x309eb4,function(_0x5758f5){if(_0x5758f5[_0xd1b5('0x32')]!==_0xd1b5('0x4c')){var _0x48ce00={};_0x48ce00[_0x5758f5['name']]={'$like':'%'+_0xa18ade[_0xd1b5('0x3e')][_0xd1b5('0x2e')]+'%'};return _0x48ce00;}})});}_0x3421f3=_[_0xd1b5('0x4b')]({},_0x3421f3,_0xa18ade[_0xd1b5('0x4d')]);var _0x15e395={'where':_0x3421f3[_0xd1b5('0x49')]};return db['VoiceQueue']['count'](_0x15e395)[_0xd1b5('0x28')](function(_0x4aad02){_0x4891b8[_0xd1b5('0x21')]=_0x4aad02;if(_0xa18ade[_0xd1b5('0x3e')][_0xd1b5('0x4e')]){_0x3421f3['include']=[{'all':!![]}];}return db[_0xd1b5('0x3b')]['findAll'](_0x3421f3);})[_0xd1b5('0x28')](function(_0x11052c){_0x4891b8[_0xd1b5('0x4f')]=_0x11052c;return _0x4891b8;})[_0xd1b5('0x28')](respondWithFilteredResult(_0xc5da5b,_0x3421f3))[_0xd1b5('0x50')](handleError(_0xc5da5b,null));};exports[_0xd1b5('0x51')]=function(_0x2d4830,_0x3a97af){var _0x360b10={'raw':![],'where':{'id':_0x2d4830['params']['id']}},_0x293411={};_0x293411[_0xd1b5('0x42')]=_[_0xd1b5('0x3f')](db[_0xd1b5('0x3b')]['rawAttributes']);_0x293411[_0xd1b5('0x3e')]=_[_0xd1b5('0x3f')](_0x2d4830[_0xd1b5('0x3e')]);_0x293411['filters']=_[_0xd1b5('0x41')](_0x293411[_0xd1b5('0x42')],_0x293411[_0xd1b5('0x3e')]);_0x360b10[_0xd1b5('0x43')]=_[_0xd1b5('0x41')](_0x293411[_0xd1b5('0x42')],qs[_0xd1b5('0x44')](_0x2d4830[_0xd1b5('0x3e')]['fields']));_0x360b10[_0xd1b5('0x43')]=_0x360b10['attributes'][_0xd1b5('0x45')]?_0x360b10[_0xd1b5('0x43')]:_0x293411[_0xd1b5('0x42')];if(_0x2d4830[_0xd1b5('0x3e')][_0xd1b5('0x4e')]){_0x360b10[_0xd1b5('0x52')]=[{'all':!![]}];}_0x360b10=_[_0xd1b5('0x4b')]({},_0x360b10,_0x2d4830['options']);return db[_0xd1b5('0x3b')][_0xd1b5('0x33')](_0x360b10)[_0xd1b5('0x28')](handleEntityNotFound(_0x3a97af,null))['then'](respondWithResult(_0x3a97af,null))[_0xd1b5('0x50')](handleError(_0x3a97af,null));};exports[_0xd1b5('0x53')]=function(_0x32838c,_0x397904){return db[_0xd1b5('0x3b')][_0xd1b5('0x53')](_0x32838c['body'],{})[_0xd1b5('0x28')](function(_0x4a733c){var _0x10ba17=_0x32838c[_0xd1b5('0x54')][_0xd1b5('0x55')]({'plain':!![]});if(!_0x10ba17)throw new Error(_0xd1b5('0x56'));if(_0x10ba17['role']===_0xd1b5('0x54')){var _0x59a1b9=_0x4a733c['get']({'plain':!![]});var _0x35f800=[{'name':'VoiceQueues','value':_0xd1b5('0x2b')},{'name':'QueueCampaigns','value':_0xd1b5('0x2d')}];var _0x48ea61=_[_0xd1b5('0x33')](_0x35f800,[_0xd1b5('0x30'),_0x59a1b9[_0xd1b5('0x32')]])[_0xd1b5('0x34')];return db['UserProfileSection'][_0xd1b5('0x33')]({'where':{'name':_0x48ea61,'userProfileId':_0x10ba17['userProfileId']},'raw':!![]})[_0xd1b5('0x28')](function(_0x18871c){if(_0x18871c&&_0x18871c[_0xd1b5('0x57')]===0x0){return db[_0xd1b5('0x35')][_0xd1b5('0x53')]({'name':_0x59a1b9[_0xd1b5('0x34')],'resourceId':_0x59a1b9['id'],'type':_0x18871c['name'],'sectionId':_0x18871c['id']},{})[_0xd1b5('0x28')](function(){return _0x4a733c;});}else{return _0x4a733c;}})[_0xd1b5('0x50')](function(_0x41e4e1){logger['error'](_0xd1b5('0x58'),_0x41e4e1);throw _0x41e4e1;});}return _0x4a733c;})[_0xd1b5('0x28')](respondWithResult(_0x397904,0xc9))[_0xd1b5('0x50')](handleError(_0x397904,null));};exports[_0xd1b5('0x59')]=function(_0x1ba34a,_0x25da00){var _0x2d6064={'where':{'id':_0x1ba34a[_0xd1b5('0x5a')]['id']}},_0x505be2={};_0x505be2[_0xd1b5('0x42')]=_['keys'](db[_0xd1b5('0x3b')][_0xd1b5('0x3c')]);_0x2d6064['attributes']=_[_0xd1b5('0x41')](_0x505be2['model'],qs[_0xd1b5('0x44')](_0x1ba34a[_0xd1b5('0x3e')][_0xd1b5('0x44')]));_0x2d6064[_0xd1b5('0x43')]=_0x2d6064[_0xd1b5('0x43')][_0xd1b5('0x45')]?_0x2d6064[_0xd1b5('0x43')]:_0x505be2[_0xd1b5('0x42')];if(_0x1ba34a[_0xd1b5('0x3e')][_0xd1b5('0x4e')]){_0x2d6064[_0xd1b5('0x52')]=[{'all':!![]}];}_0x2d6064=_[_0xd1b5('0x4b')]({},_0x2d6064,_0x1ba34a[_0xd1b5('0x4d')]);return db['VoiceQueue'][_0xd1b5('0x33')](_0x2d6064)['then'](handleEntityNotFound(_0x25da00,null))['then'](function(_0x4a2c46){if(_0x4a2c46){var _0x4fc4da=_0x4a2c46['get']({'plain':!![]});_0x4fc4da=qs['omit'](_0x4fc4da,['id',_0xd1b5('0x5b'),_0xd1b5('0x5c')]);_0x1ba34a[_0xd1b5('0x5d')]=_[_0xd1b5('0x5e')](_0x1ba34a[_0xd1b5('0x5d')],['id',_0xd1b5('0x5b'),_0xd1b5('0x5c')]);return db[_0xd1b5('0x3b')][_0xd1b5('0x53')](_[_0xd1b5('0x4b')](_0x4fc4da,_0x1ba34a[_0xd1b5('0x5d')]),{'include':_0x1ba34a[_0xd1b5('0x3e')][_0xd1b5('0x4e')]?[{'all':!![]}]:undefined})['then'](function(_0x3fbc34){var _0x5dfc5e=_0x1ba34a['user'][_0xd1b5('0x55')]({'plain':!![]});if(!_0x5dfc5e)throw new Error(_0xd1b5('0x56'));if(_0x5dfc5e[_0xd1b5('0x5f')]==='user'){var _0x11e635=_0x3fbc34[_0xd1b5('0x55')]({'plain':!![]});var _0x17f60b=[{'name':_0xd1b5('0x2a'),'value':'inbound'},{'name':_0xd1b5('0x2c'),'value':'outbound'}];var _0x1cda44=_[_0xd1b5('0x33')](_0x17f60b,[_0xd1b5('0x30'),_0x11e635[_0xd1b5('0x32')]])['name'];return db[_0xd1b5('0x60')][_0xd1b5('0x33')]({'where':{'name':_0x1cda44,'userProfileId':_0x5dfc5e[_0xd1b5('0x61')]},'raw':!![]})['then'](function(_0x3e88d8){if(_0x3e88d8&&_0x3e88d8['autoAssociation']===0x0){return db[_0xd1b5('0x35')]['create']({'name':_0x11e635[_0xd1b5('0x34')],'resourceId':_0x11e635['id'],'type':_0x3e88d8[_0xd1b5('0x34')],'sectionId':_0x3e88d8['id']},{})[_0xd1b5('0x28')](function(){return _0x3fbc34;});}else{return _0x3fbc34;}})[_0xd1b5('0x50')](function(_0x459850){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x459850);throw _0x459850;});}return _0x3fbc34;});}})[_0xd1b5('0x28')](respondWithResult(_0x25da00,0xc9))[_0xd1b5('0x50')](handleError(_0x25da00,null));};exports[_0xd1b5('0x27')]=function(_0x44ce63,_0x5bca2d){if(_0x44ce63['body']['id']){delete _0x44ce63['body']['id'];}return db[_0xd1b5('0x3b')][_0xd1b5('0x33')]({'where':{'id':_0x44ce63[_0xd1b5('0x5a')]['id']}})[_0xd1b5('0x28')](handleEntityNotFound(_0x5bca2d,null))['then'](saveUpdates(_0x44ce63[_0xd1b5('0x5d')],null))[_0xd1b5('0x28')](respondWithResult(_0x5bca2d,null))[_0xd1b5('0x50')](handleError(_0x5bca2d,null));};exports[_0xd1b5('0x29')]=function(_0x42037f,_0x1b8c13){return db[_0xd1b5('0x3b')][_0xd1b5('0x33')]({'where':{'id':_0x42037f['params']['id']}})['then'](handleEntityNotFound(_0x1b8c13,null))[_0xd1b5('0x28')](removeEntity(_0x1b8c13,null))['catch'](handleError(_0x1b8c13,null));};exports[_0xd1b5('0x62')]=function(_0x52631c,_0x5bc3a6,_0x41a96d){var _0x2d16a4={'raw':![],'where':{}};var _0x18fcde={};var _0x1ac275={'count':0x0,'rows':[]};return db[_0xd1b5('0x3b')][_0xd1b5('0x63')]({'where':{'id':_0x52631c[_0xd1b5('0x5a')]['id']}})[_0xd1b5('0x28')](handleEntityNotFound(_0x5bc3a6,null))[_0xd1b5('0x28')](function(_0x59b959){if(_0x59b959){_0x18fcde[_0xd1b5('0x42')]=_['keys'](db[_0xd1b5('0x64')][_0xd1b5('0x3c')]);_0x18fcde[_0xd1b5('0x3e')]=_[_0xd1b5('0x3f')](_0x52631c[_0xd1b5('0x3e')]);_0x18fcde[_0xd1b5('0x40')]=_[_0xd1b5('0x41')](_0x18fcde[_0xd1b5('0x42')],_0x18fcde[_0xd1b5('0x3e')]);_0x2d16a4[_0xd1b5('0x43')]=_[_0xd1b5('0x41')](_0x18fcde['model'],qs[_0xd1b5('0x44')](_0x52631c[_0xd1b5('0x3e')]['fields']));_0x2d16a4['attributes']=_0x2d16a4['attributes'][_0xd1b5('0x45')]?_0x2d16a4['attributes']:_0x18fcde[_0xd1b5('0x42')];if(!_0x52631c['query']['hasOwnProperty'](_0xd1b5('0x65'))){_0x2d16a4[_0xd1b5('0x20')]=qs[_0xd1b5('0x20')](_0x52631c[_0xd1b5('0x3e')][_0xd1b5('0x20')]);_0x2d16a4[_0xd1b5('0x1e')]=qs[_0xd1b5('0x1e')](_0x52631c[_0xd1b5('0x3e')][_0xd1b5('0x1e')]);}_0x2d16a4[_0xd1b5('0x47')]=qs[_0xd1b5('0x48')](_0x52631c[_0xd1b5('0x3e')][_0xd1b5('0x48')]);_0x2d16a4[_0xd1b5('0x49')]=qs[_0xd1b5('0x40')](_[_0xd1b5('0x4a')](_0x52631c[_0xd1b5('0x3e')],_0x18fcde[_0xd1b5('0x40')]));_0x2d16a4[_0xd1b5('0x49')][_0xd1b5('0x66')]=_0x59b959['id'];if(_0x52631c[_0xd1b5('0x3e')]['filter']){_0x2d16a4['where']=_[_0xd1b5('0x4b')](_0x2d16a4['where'],{'$or':_[_0xd1b5('0x3a')](_0x2d16a4[_0xd1b5('0x43')],function(_0x120e37){var _0x526a6a={};_0x526a6a[_0x120e37]={'$like':'%'+_0x52631c[_0xd1b5('0x3e')][_0xd1b5('0x2e')]+'%'};return _0x526a6a;})});}_0x2d16a4=_[_0xd1b5('0x4b')]({},_0x2d16a4,_0x52631c[_0xd1b5('0x4d')]);return db['CmHopper'][_0xd1b5('0x21')]({'where':_0x2d16a4[_0xd1b5('0x49')]})[_0xd1b5('0x28')](function(_0x5eafd2){_0x1ac275['count']=_0x5eafd2;if(_0x52631c[_0xd1b5('0x3e')]['includeAll']){_0x2d16a4[_0xd1b5('0x52')]=[{'all':!![]}];}return db[_0xd1b5('0x64')]['findAll'](_0x2d16a4);})[_0xd1b5('0x28')](function(_0x1c212e){_0x1ac275[_0xd1b5('0x4f')]=_0x1c212e;return _0x1ac275;});}})[_0xd1b5('0x28')](respondWithFilteredResult(_0x5bc3a6,_0x2d16a4))[_0xd1b5('0x50')](handleError(_0x5bc3a6,null));};exports[_0xd1b5('0x67')]=function(_0x4128ef,_0x4a4a27,_0x145d5d){var _0x2014f1={'raw':!![],'where':{}};var _0x13b0fe={};var _0x1d3d16={'count':0x0,'rows':[]};return db[_0xd1b5('0x3b')][_0xd1b5('0x63')]({'where':{'id':_0x4128ef[_0xd1b5('0x5a')]['id']}})[_0xd1b5('0x28')](handleEntityNotFound(_0x4a4a27,null))[_0xd1b5('0x28')](function(_0x33fc43){if(_0x33fc43){_0x13b0fe[_0xd1b5('0x42')]=_[_0xd1b5('0x3f')](db[_0xd1b5('0x68')]['rawAttributes']);_0x13b0fe[_0xd1b5('0x3e')]=_[_0xd1b5('0x3f')](_0x4128ef[_0xd1b5('0x3e')]);_0x13b0fe[_0xd1b5('0x40')]=_[_0xd1b5('0x41')](_0x13b0fe['model'],_0x13b0fe[_0xd1b5('0x3e')]);_0x2014f1[_0xd1b5('0x43')]=_['intersection'](_0x13b0fe[_0xd1b5('0x42')],qs[_0xd1b5('0x44')](_0x4128ef[_0xd1b5('0x3e')][_0xd1b5('0x44')]));_0x2014f1[_0xd1b5('0x43')]=_0x2014f1[_0xd1b5('0x43')][_0xd1b5('0x45')]?_0x2014f1[_0xd1b5('0x43')]:_0x13b0fe[_0xd1b5('0x42')];if(!_0x4128ef[_0xd1b5('0x3e')]['hasOwnProperty']('nolimit')){_0x2014f1[_0xd1b5('0x20')]=qs[_0xd1b5('0x20')](_0x4128ef[_0xd1b5('0x3e')][_0xd1b5('0x20')]);_0x2014f1[_0xd1b5('0x1e')]=qs['offset'](_0x4128ef['query'][_0xd1b5('0x1e')]);}_0x2014f1['order']=qs[_0xd1b5('0x48')](_0x4128ef['query']['sort']);_0x2014f1['where']=qs[_0xd1b5('0x40')](_[_0xd1b5('0x4a')](_0x4128ef[_0xd1b5('0x3e')],_0x13b0fe[_0xd1b5('0x40')]));_0x2014f1[_0xd1b5('0x49')][_0xd1b5('0x66')]=_0x33fc43['id'];if(_0x4128ef[_0xd1b5('0x3e')]['filter']){_0x2014f1[_0xd1b5('0x49')]=_[_0xd1b5('0x4b')](_0x2014f1['where'],{'$or':_[_0xd1b5('0x3a')](_0x2014f1[_0xd1b5('0x43')],function(_0x266975){var _0x4dafb4={};_0x4dafb4[_0x266975]={'$like':'%'+_0x4128ef['query'][_0xd1b5('0x2e')]+'%'};return _0x4dafb4;})});}_0x2014f1=_[_0xd1b5('0x4b')]({},_0x2014f1,_0x4128ef[_0xd1b5('0x4d')]);return db[_0xd1b5('0x68')][_0xd1b5('0x21')]({'where':_0x2014f1[_0xd1b5('0x49')]})[_0xd1b5('0x28')](function(_0x30766a){_0x1d3d16[_0xd1b5('0x21')]=_0x30766a;if(_0x4128ef['query']['includeAll']){_0x2014f1[_0xd1b5('0x52')]=[{'all':!![]}];}return db[_0xd1b5('0x68')]['findAll'](_0x2014f1);})[_0xd1b5('0x28')](function(_0x30f77f){_0x1d3d16[_0xd1b5('0x4f')]=_0x30f77f;return _0x1d3d16;});}})['then'](respondWithFilteredResult(_0x4a4a27,_0x2014f1))[_0xd1b5('0x50')](handleError(_0x4a4a27,null));};exports[_0xd1b5('0x69')]=function(_0x11fc45,_0x21c091,_0xa35ec2){var _0x5af7f7={'raw':!![],'where':{}};var _0x5a43c4={};var _0x4272aa={'count':0x0,'rows':[]};return db[_0xd1b5('0x3b')][_0xd1b5('0x63')]({'where':{'id':_0x11fc45[_0xd1b5('0x5a')]['id']}})['then'](handleEntityNotFound(_0x21c091,null))[_0xd1b5('0x28')](function(_0x43b547){if(_0x43b547){_0x5a43c4['model']=_[_0xd1b5('0x3f')](db[_0xd1b5('0x6a')][_0xd1b5('0x3c')]);_0x5a43c4[_0xd1b5('0x3e')]=_['keys'](_0x11fc45[_0xd1b5('0x3e')]);_0x5a43c4[_0xd1b5('0x40')]=_[_0xd1b5('0x41')](_0x5a43c4[_0xd1b5('0x42')],_0x5a43c4[_0xd1b5('0x3e')]);_0x5af7f7[_0xd1b5('0x43')]=_[_0xd1b5('0x41')](_0x5a43c4['model'],qs[_0xd1b5('0x44')](_0x11fc45['query']['fields']));_0x5af7f7[_0xd1b5('0x43')]=_0x5af7f7[_0xd1b5('0x43')][_0xd1b5('0x45')]?_0x5af7f7[_0xd1b5('0x43')]:_0x5a43c4[_0xd1b5('0x42')];if(!_0x11fc45['query']['hasOwnProperty']('nolimit')){_0x5af7f7[_0xd1b5('0x20')]=qs[_0xd1b5('0x20')](_0x11fc45[_0xd1b5('0x3e')][_0xd1b5('0x20')]);_0x5af7f7[_0xd1b5('0x1e')]=qs[_0xd1b5('0x1e')](_0x11fc45['query'][_0xd1b5('0x1e')]);}_0x5af7f7[_0xd1b5('0x47')]=qs[_0xd1b5('0x48')](_0x11fc45[_0xd1b5('0x3e')][_0xd1b5('0x48')]);_0x5af7f7[_0xd1b5('0x49')]=qs['filters'](_['pick'](_0x11fc45[_0xd1b5('0x3e')],_0x5a43c4[_0xd1b5('0x40')]));_0x5af7f7['where'][_0xd1b5('0x66')]=_0x43b547['id'];if(_0x11fc45[_0xd1b5('0x3e')][_0xd1b5('0x2e')]){_0x5af7f7[_0xd1b5('0x49')]=_[_0xd1b5('0x4b')](_0x5af7f7[_0xd1b5('0x49')],{'$or':_[_0xd1b5('0x3a')](_0x5af7f7[_0xd1b5('0x43')],function(_0x3d63c5){var _0xaa3b9a={};_0xaa3b9a[_0x3d63c5]={'$like':'%'+_0x11fc45[_0xd1b5('0x3e')][_0xd1b5('0x2e')]+'%'};return _0xaa3b9a;})});}_0x5af7f7=_[_0xd1b5('0x4b')]({},_0x5af7f7,_0x11fc45[_0xd1b5('0x4d')]);return db[_0xd1b5('0x6a')][_0xd1b5('0x21')]({'where':_0x5af7f7['where']})[_0xd1b5('0x28')](function(_0x3e6d9e){_0x4272aa[_0xd1b5('0x21')]=_0x3e6d9e;if(_0x11fc45['query']['includeAll']){_0x5af7f7[_0xd1b5('0x52')]=[{'all':!![]}];}return db['CmHopperFinal'][_0xd1b5('0x6b')](_0x5af7f7);})[_0xd1b5('0x28')](function(_0x369578){_0x4272aa[_0xd1b5('0x4f')]=_0x369578;return _0x4272aa;});}})[_0xd1b5('0x28')](respondWithFilteredResult(_0x21c091,_0x5af7f7))[_0xd1b5('0x50')](handleError(_0x21c091,null));};exports[_0xd1b5('0x6c')]=function(_0x4c5a99,_0x55ffd4,_0x251b91){var _0x124831={'raw':!![],'where':{}};var _0x431c09={};var _0x34864c={'count':0x0,'rows':[]};return db['VoiceQueue'][_0xd1b5('0x63')]({'where':{'id':_0x4c5a99['params']['id']}})[_0xd1b5('0x28')](handleEntityNotFound(_0x55ffd4,null))['then'](function(_0x310c82){if(_0x310c82){_0x431c09['model']=_['keys'](db[_0xd1b5('0x6d')][_0xd1b5('0x3c')]);_0x431c09[_0xd1b5('0x3e')]=_[_0xd1b5('0x3f')](_0x4c5a99[_0xd1b5('0x3e')]);_0x431c09['filters']=_[_0xd1b5('0x41')](_0x431c09[_0xd1b5('0x42')],_0x431c09[_0xd1b5('0x3e')]);_0x124831[_0xd1b5('0x43')]=_[_0xd1b5('0x41')](_0x431c09[_0xd1b5('0x42')],qs['fields'](_0x4c5a99['query'][_0xd1b5('0x44')]));_0x124831[_0xd1b5('0x43')]=_0x124831[_0xd1b5('0x43')][_0xd1b5('0x45')]?_0x124831[_0xd1b5('0x43')]:_0x431c09[_0xd1b5('0x42')];if(!_0x4c5a99[_0xd1b5('0x3e')][_0xd1b5('0x46')]('nolimit')){_0x124831[_0xd1b5('0x20')]=qs[_0xd1b5('0x20')](_0x4c5a99[_0xd1b5('0x3e')][_0xd1b5('0x20')]);_0x124831['offset']=qs[_0xd1b5('0x1e')](_0x4c5a99[_0xd1b5('0x3e')][_0xd1b5('0x1e')]);}_0x124831['order']=qs['sort'](_0x4c5a99[_0xd1b5('0x3e')]['sort']);_0x124831[_0xd1b5('0x49')]=qs[_0xd1b5('0x40')](_[_0xd1b5('0x4a')](_0x4c5a99['query'],_0x431c09['filters']));_0x124831[_0xd1b5('0x49')][_0xd1b5('0x66')]=_0x310c82['id'];if(_0x4c5a99[_0xd1b5('0x3e')][_0xd1b5('0x2e')]){_0x124831[_0xd1b5('0x49')]=_[_0xd1b5('0x4b')](_0x124831[_0xd1b5('0x49')],{'$or':_[_0xd1b5('0x3a')](_0x124831[_0xd1b5('0x43')],function(_0x3f18ee){var _0x39b7de={};_0x39b7de[_0x3f18ee]={'$like':'%'+_0x4c5a99['query'][_0xd1b5('0x2e')]+'%'};return _0x39b7de;})});}_0x124831=_[_0xd1b5('0x4b')]({},_0x124831,_0x4c5a99[_0xd1b5('0x4d')]);return db[_0xd1b5('0x6d')][_0xd1b5('0x21')]({'where':_0x124831[_0xd1b5('0x49')]})[_0xd1b5('0x28')](function(_0x1a1a32){_0x34864c[_0xd1b5('0x21')]=_0x1a1a32;if(_0x4c5a99[_0xd1b5('0x3e')][_0xd1b5('0x4e')]){_0x124831[_0xd1b5('0x52')]=[{'all':!![]}];}return db['CmHopperBlack'][_0xd1b5('0x6b')](_0x124831);})[_0xd1b5('0x28')](function(_0x3f7d0e){_0x34864c[_0xd1b5('0x4f')]=_0x3f7d0e;return _0x34864c;});}})[_0xd1b5('0x28')](respondWithFilteredResult(_0x55ffd4,_0x124831))[_0xd1b5('0x50')](handleError(_0x55ffd4,null));};exports[_0xd1b5('0x6e')]=function(_0xc24ecd,_0xac08b6,_0x1c0b67){var _0x404809={};var _0x148513={};var _0x44ccee;var _0x2ad29b;return db['VoiceQueue'][_0xd1b5('0x63')]({'where':{'id':_0xc24ecd[_0xd1b5('0x5a')]['id']}})[_0xd1b5('0x28')](handleEntityNotFound(_0xac08b6,null))[_0xd1b5('0x28')](function(_0x82a052){if(_0x82a052){_0x44ccee=_0x82a052;_0x148513[_0xd1b5('0x42')]=_[_0xd1b5('0x3f')](db[_0xd1b5('0x6f')]['rawAttributes']);_0x148513['query']=_['keys'](_0xc24ecd[_0xd1b5('0x3e')]);_0x148513['filters']=_[_0xd1b5('0x41')](_0x148513[_0xd1b5('0x42')],_0x148513[_0xd1b5('0x3e')]);_0x404809['attributes']=_[_0xd1b5('0x41')](_0x148513[_0xd1b5('0x42')],qs[_0xd1b5('0x44')](_0xc24ecd[_0xd1b5('0x3e')]['fields']));_0x404809[_0xd1b5('0x43')]=_0x404809[_0xd1b5('0x43')][_0xd1b5('0x45')]?_0x404809[_0xd1b5('0x43')]:_0x148513[_0xd1b5('0x42')];_0x404809[_0xd1b5('0x47')]=qs[_0xd1b5('0x48')](_0xc24ecd['query']['sort']);_0x404809[_0xd1b5('0x49')]=qs[_0xd1b5('0x40')](_[_0xd1b5('0x4a')](_0xc24ecd['query'],_0x148513[_0xd1b5('0x40')]));if(_0xc24ecd[_0xd1b5('0x3e')][_0xd1b5('0x2e')]){_0x404809[_0xd1b5('0x49')]=_['merge'](_0x404809['where'],{'$or':_[_0xd1b5('0x3a')](_0x404809[_0xd1b5('0x43')],function(_0x3944c2){var _0x19415d={};_0x19415d[_0x3944c2]={'$like':'%'+_0xc24ecd[_0xd1b5('0x3e')][_0xd1b5('0x2e')]+'%'};return _0x19415d;})});}_0x404809=_[_0xd1b5('0x4b')]({},_0x404809,_0xc24ecd[_0xd1b5('0x4d')]);return _0x44ccee[_0xd1b5('0x6e')](_0x404809);}})[_0xd1b5('0x28')](function(_0x4a87de){if(_0x4a87de){_0x2ad29b=_0x4a87de['length'];if(!_0xc24ecd[_0xd1b5('0x3e')]['hasOwnProperty'](_0xd1b5('0x65'))){_0x404809[_0xd1b5('0x20')]=qs[_0xd1b5('0x20')](_0xc24ecd[_0xd1b5('0x3e')][_0xd1b5('0x20')]);_0x404809['offset']=qs['offset'](_0xc24ecd['query'][_0xd1b5('0x1e')]);}return _0x44ccee[_0xd1b5('0x6e')](_0x404809);}})['then'](function(_0x44f1b4){if(_0x44f1b4){return _0x44f1b4?{'count':_0x2ad29b,'rows':_0x44f1b4}:null;}})[_0xd1b5('0x28')](respondWithResult(_0xac08b6,null))['catch'](handleError(_0xac08b6,null));};exports[_0xd1b5('0x70')]=function(_0x3be90c,_0x30805e,_0x1c37b3){var _0x1c5869=_0x3be90c['body'][_0xd1b5('0x71')];var _0x229d2b=_['map'](_0x1c5869,'id');return db[_0xd1b5('0x6f')][_0xd1b5('0x6b')]({'where':{'id':_0x229d2b},'attributes':['id'],'include':[{'model':db[_0xd1b5('0x72')],'as':_0xd1b5('0x73'),'attributes':['id',_0xd1b5('0x34'),_0xd1b5('0x74'),_0xd1b5('0x75'),_0xd1b5('0x76')],'raw':!![]}]})[_0xd1b5('0x28')](function(_0x441de4){if(_0x441de4){var _0x3232d9=_[_0xd1b5('0x77')](_0x441de4,function(_0x3f1f15){var _0x489c76=_0x3f1f15[_0xd1b5('0x55')]({'plain':!![]});_0x489c76[_0xd1b5('0x73')][_0xd1b5('0x78')](function(_0x4f90c7){_0x4f90c7[_0xd1b5('0x79')]=_['find'](_0x1c5869,{'id':_0x489c76['id']})[_0xd1b5('0x79')];});return _0x489c76['Agents'];});return db[_0xd1b5('0x3b')][_0xd1b5('0x33')]({'where':{'id':_0x3be90c[_0xd1b5('0x5a')]['id']}})[_0xd1b5('0x28')](function(_0x3236e5){return db[_0xd1b5('0x7a')]['transaction'](function(_0x4ca23b){return _0x3236e5['addTeams'](_0x229d2b,{'transaction':_0x4ca23b})['then'](function(){return BPromise[_0xd1b5('0x7b')](_0x1c5869,function(_0x3c370b){return db[_0xd1b5('0x7c')][_0xd1b5('0x7d')]({'TeamId':_0x3c370b['id'],'VoiceQueueId':_0x3be90c[_0xd1b5('0x5a')]['id'],'penalty':_0x3c370b[_0xd1b5('0x79')]},{'transaction':_0x4ca23b});});})[_0xd1b5('0x28')](function(){return BPromise[_0xd1b5('0x7b')](_0x3232d9,function(_0x32ef10){return db['UserVoiceQueue']['findOrCreate']({'where':{'UserId':_0x32ef10['id'],'VoiceQueueId':_0x3be90c[_0xd1b5('0x5a')]['id']},'defaults':{'penalty':_0x32ef10[_0xd1b5('0x79')]},'transaction':_0x4ca23b});});})[_0xd1b5('0x28')](function(){return BPromise[_0xd1b5('0x7b')](_[_0xd1b5('0x2e')](_0x3232d9,{'online':!![]}),function(_0x1c86cf){return db[_0xd1b5('0x7e')][_0xd1b5('0x7d')]({'membername':_0x1c86cf[_0xd1b5('0x34')],'UserId':_0x1c86cf['id'],'queue_name':_0x3236e5[_0xd1b5('0x34')],'VoiceQueueId':_0x3236e5['id'],'interface':_['isNil'](_0x1c86cf[_0xd1b5('0x76')])?util[_0xd1b5('0x7f')](_0xd1b5('0x80'),_0x1c86cf[_0xd1b5('0x34')]):_0x1c86cf[_0xd1b5('0x76')],'paused':_0x1c86cf[_0xd1b5('0x75')]||![],'penalty':_0x1c86cf[_0xd1b5('0x79')]},{'transaction':_0x4ca23b});});})[_0xd1b5('0x28')](function(){_0x3232d9[_0xd1b5('0x78')](function(_0x3d9dea){socket[_0xd1b5('0x81')](_0xd1b5('0x82'),{'UserId':_0x3d9dea['id'],'VoiceQueueId':_0x3236e5['id']});});});});});}})[_0xd1b5('0x28')](respondWithStatusCode(_0x30805e,null))[_0xd1b5('0x50')](handleError(_0x30805e,null));};exports[_0xd1b5('0x83')]=function(_0x393e04,_0x4f1066,_0x3fa3bb){return db[_0xd1b5('0x6f')]['findAll']({'where':{'id':_0x393e04['query'][_0xd1b5('0x84')]},'attributes':['id'],'include':[{'model':db[_0xd1b5('0x72')],'as':_0xd1b5('0x73'),'attributes':['id'],'raw':!![]}]})[_0xd1b5('0x28')](handleEntityNotFound(_0x4f1066,null))['then'](function(_0x1c03e6){var _0x5a3091=_['map'](_0x1c03e6,'id');var _0x43ff66=[];var _0x427016=[];var _0x46db68=squel[_0xd1b5('0x85')]();_0x46db68[_0xd1b5('0x86')](_0xd1b5('0x87'))[_0xd1b5('0x88')](_0xd1b5('0x89'),'tq')[_0xd1b5('0x8a')](_0xd1b5('0x8b'),'ut',_0xd1b5('0x8c'))[_0xd1b5('0x49')](_0xd1b5('0x8d'),_0x393e04[_0xd1b5('0x5a')]['id']);for(var _0x259606=0x0;_0x259606<_0x1c03e6['length'];_0x259606+=0x1){let _0x24a050=_0x1c03e6[_0x259606];for(var _0xe19ef0=0x0;_0xe19ef0<_0x24a050['Agents'][_0xd1b5('0x45')];_0xe19ef0+=0x1){let _0x4e285a=_0x24a050['Agents'][_0xe19ef0];var _0x3d52f0=_0x46db68[_0xd1b5('0x59')]();_0x3d52f0[_0xd1b5('0x49')]('ut.UserId\x20=\x20?',_0x4e285a['id']);_0x427016[_0xd1b5('0x8e')](db[_0xd1b5('0x7a')][_0xd1b5('0x3e')](_0x3d52f0[_0xd1b5('0x8f')](),{'type':db[_0xd1b5('0x7a')][_0xd1b5('0x90')][_0xd1b5('0x91')]})['then'](function(_0x53d8e6){if(_0x53d8e6['length']===0x1){return _0x4e285a['id'];}else{var _0x67d5d9=_[_0xd1b5('0x92')](_[_0xd1b5('0x3a')](_0x53d8e6,_0xd1b5('0x93')),function(_0x52cf37){return _[_0xd1b5('0x31')](_0x5a3091,_0x52cf37);});if(_0x67d5d9){return _0x4e285a['id'];}}}));}}return BPromise[_0xd1b5('0x94')](_0x427016)[_0xd1b5('0x28')](function(_0x62c9a1){_0x43ff66=_(_0x43ff66)[_0xd1b5('0x95')](_0x62c9a1)[_0xd1b5('0x96')]()[_0xd1b5('0x30')]();return db[_0xd1b5('0x3b')][_0xd1b5('0x33')]({'where':{'id':_0x393e04[_0xd1b5('0x5a')]['id']}})[_0xd1b5('0x28')](function(_0x46ead7){return db[_0xd1b5('0x7a')]['transaction'](function(_0x4bfae1){return _0x46ead7[_0xd1b5('0x83')](_0x393e04[_0xd1b5('0x3e')]['ids'],{'transaction':_0x4bfae1})[_0xd1b5('0x28')](function(){if(!_[_0xd1b5('0x97')](_0x43ff66)){return _0x46ead7['removeAgents'](_0x43ff66,{'transaction':_0x4bfae1})[_0xd1b5('0x28')](function(){return db[_0xd1b5('0x7e')][_0xd1b5('0x29')]({'where':{'VoiceQueueId':_0x393e04[_0xd1b5('0x5a')]['id'],'UserId':_0x43ff66},'transaction':_0x4bfae1});});}})[_0xd1b5('0x28')](function(){_0x43ff66[_0xd1b5('0x78')](function(_0x1a8ca7){socket[_0xd1b5('0x81')](_0xd1b5('0x98'),{'UserId':_0x1a8ca7,'VoiceQueueId':_0x46ead7['id']});});});});});});})[_0xd1b5('0x28')](respondWithStatusCode(_0x4f1066,null))[_0xd1b5('0x50')](handleError(_0x4f1066,null));};exports[_0xd1b5('0x99')]=function(_0x549498,_0x2e3540,_0x2a2014){var _0xb8e6cf,_0x180397;return db['VoiceQueue']['find']({'where':{'id':_0x549498[_0xd1b5('0x5a')]['id']}})[_0xd1b5('0x28')](handleEntityNotFound(_0x2e3540,null))[_0xd1b5('0x28')](function(_0x14d313){if(_0x14d313){_0x180397=_0x14d313;return _0x14d313['addAgents'](_0x549498[_0xd1b5('0x5d')][_0xd1b5('0x84')],_[_0xd1b5('0x5e')](_0x549498[_0xd1b5('0x5d')],['ids','id'])||{})[_0xd1b5('0x9a')](function(_0x313904){for(var _0x4509b6=0x0;_0x4509b6<_0x549498['body']['ids'][_0xd1b5('0x45')];_0x4509b6+=0x1){socket[_0xd1b5('0x81')](_0xd1b5('0x82'),{'UserId':Number(_0x549498['body'][_0xd1b5('0x84')][_0x4509b6]),'VoiceQueueId':Number(_0x549498[_0xd1b5('0x5a')]['id'])});}return _0x313904;});}})[_0xd1b5('0x28')](function(_0x4687e4){_0xb8e6cf=_0x4687e4||[];if(_0x180397){return db[_0xd1b5('0x72')][_0xd1b5('0x6b')]({'where':{'id':_0x549498[_0xd1b5('0x5d')][_0xd1b5('0x84')]},'attributes':['id',_0xd1b5('0x34'),_0xd1b5('0x74'),'voicePause',_0xd1b5('0x76')],'raw':!![]});}})[_0xd1b5('0x28')](function(_0x257311){if(!_['isEmpty'](_0x257311)){var _0xa998e4=[];for(var _0x15e2fc=0x0;_0x15e2fc<_0x257311['length'];_0x15e2fc++){if(_0x257311[_0x15e2fc][_0xd1b5('0x74')]){_0xa998e4[_0xd1b5('0x8e')](db[_0xd1b5('0x7e')][_0xd1b5('0x7d')]({'membername':_0x257311[_0x15e2fc][_0xd1b5('0x34')],'UserId':_0x257311[_0x15e2fc]['id'],'queue_name':_0x180397['name'],'VoiceQueueId':_0x180397['id'],'interface':_['isNil'](_0x257311[_0x15e2fc]['interface'])?util['format'](_0xd1b5('0x80'),_0x257311[_0x15e2fc][_0xd1b5('0x34')]):_0x257311[_0x15e2fc][_0xd1b5('0x76')],'paused':_0x257311[_0x15e2fc][_0xd1b5('0x75')]||![],'penalty':_0x549498[_0xd1b5('0x5d')][_0xd1b5('0x79')]||0x0}));}}return BPromise[_0xd1b5('0x94')](_0xa998e4);}})[_0xd1b5('0x28')](function(){return _0xb8e6cf;})[_0xd1b5('0x28')](respondWithResult(_0x2e3540,null))['catch'](handleError(_0x2e3540,null));};exports['removeAgents']=function(_0x196007,_0x5f496d,_0x2e1af0){return db[_0xd1b5('0x3b')][_0xd1b5('0x33')]({'where':{'id':_0x196007[_0xd1b5('0x5a')]['id']}})[_0xd1b5('0x28')](handleEntityNotFound(_0x5f496d,null))[_0xd1b5('0x28')](function(_0x2a2db8){if(_0x2a2db8){return _0x2a2db8[_0xd1b5('0x9b')](_0x196007[_0xd1b5('0x3e')][_0xd1b5('0x84')])[_0xd1b5('0x28')](function(){if(_[_0xd1b5('0x9c')](_0x196007[_0xd1b5('0x3e')][_0xd1b5('0x84')])){for(var _0x26fecc=0x0;_0x26fecc<_0x196007['query'][_0xd1b5('0x84')][_0xd1b5('0x45')];_0x26fecc+=0x1){socket[_0xd1b5('0x81')]('userVoiceQueue:remove',{'UserId':Number(_0x196007[_0xd1b5('0x3e')][_0xd1b5('0x84')][_0x26fecc]),'VoiceQueueId':Number(_0x196007['params']['id'])});}}else{socket[_0xd1b5('0x81')]('userVoiceQueue:remove',{'UserId':Number(_0x196007['query']['ids']),'VoiceQueueId':Number(_0x196007['params']['id'])});}});}})[_0xd1b5('0x28')](function(_0xeed2cc){return db[_0xd1b5('0x7e')][_0xd1b5('0x29')]({'where':{'VoiceQueueId':_0x196007[_0xd1b5('0x5a')]['id'],'UserId':_0x196007[_0xd1b5('0x3e')][_0xd1b5('0x84')]}})['then'](function(){return _0xeed2cc;});})['then'](respondWithStatusCode(_0x5f496d,null))['catch'](handleError(_0x5f496d,null));};exports['getAgents']=function(_0x1464a8,_0x21a148,_0x51cf2d){var _0x29fbaf={};var _0x466a8b={};var _0x3cd9c0;var _0x10dcf4;return db[_0xd1b5('0x3b')]['findOne']({'where':{'id':_0x1464a8[_0xd1b5('0x5a')]['id']}})[_0xd1b5('0x28')](handleEntityNotFound(_0x21a148,null))[_0xd1b5('0x28')](function(_0x3e0266){if(_0x3e0266){_0x3cd9c0=_0x3e0266;_0x466a8b[_0xd1b5('0x42')]=_[_0xd1b5('0x3f')](db['User'][_0xd1b5('0x3c')]);_0x466a8b[_0xd1b5('0x3e')]=_[_0xd1b5('0x3f')](_0x1464a8[_0xd1b5('0x3e')]);_0x466a8b[_0xd1b5('0x40')]=_[_0xd1b5('0x41')](_0x466a8b[_0xd1b5('0x42')],_0x466a8b['query']);_0x29fbaf[_0xd1b5('0x43')]=_[_0xd1b5('0x41')](_0x466a8b[_0xd1b5('0x42')],qs[_0xd1b5('0x44')](_0x1464a8[_0xd1b5('0x3e')]['fields']));_0x29fbaf[_0xd1b5('0x43')]=_0x29fbaf['attributes']['length']?_0x29fbaf[_0xd1b5('0x43')]:_0x466a8b[_0xd1b5('0x42')];_0x29fbaf[_0xd1b5('0x47')]=qs[_0xd1b5('0x48')](_0x1464a8['query'][_0xd1b5('0x48')]);_0x29fbaf[_0xd1b5('0x49')]=qs['filters'](_[_0xd1b5('0x4a')](_0x1464a8[_0xd1b5('0x3e')],_0x466a8b[_0xd1b5('0x40')]));if(_0x1464a8[_0xd1b5('0x3e')][_0xd1b5('0x2e')]){_0x29fbaf[_0xd1b5('0x49')]=_[_0xd1b5('0x4b')](_0x29fbaf[_0xd1b5('0x49')],{'$or':_[_0xd1b5('0x3a')](_0x29fbaf['attributes'],function(_0x3b2778){var _0x3a37f2={};_0x3a37f2[_0x3b2778]={'$like':'%'+_0x1464a8[_0xd1b5('0x3e')][_0xd1b5('0x2e')]+'%'};return _0x3a37f2;})});}_0x29fbaf=_[_0xd1b5('0x4b')]({},_0x29fbaf,_0x1464a8[_0xd1b5('0x4d')]);return _0x3cd9c0[_0xd1b5('0x9d')](_0x29fbaf);}})[_0xd1b5('0x28')](function(_0x6036fd){if(_0x6036fd){_0x10dcf4=_0x6036fd[_0xd1b5('0x45')];if(!_0x1464a8[_0xd1b5('0x3e')]['hasOwnProperty'](_0xd1b5('0x65'))){_0x29fbaf['limit']=qs[_0xd1b5('0x20')](_0x1464a8[_0xd1b5('0x3e')][_0xd1b5('0x20')]);_0x29fbaf[_0xd1b5('0x1e')]=qs[_0xd1b5('0x1e')](_0x1464a8['query'][_0xd1b5('0x1e')]);}return _0x3cd9c0[_0xd1b5('0x9d')](_0x29fbaf);}})['then'](function(_0x19e3c7){if(_0x19e3c7){return _0x19e3c7?{'count':_0x10dcf4,'rows':_0x19e3c7}:null;}})[_0xd1b5('0x28')](respondWithResult(_0x21a148,null))['catch'](handleError(_0x21a148,null));};exports[_0xd1b5('0x9e')]=function(_0x56c781,_0x3b4869,_0x2e63b2){var _0x127c94={};var _0x2b9bb3={};var _0x345398;var _0xe6d48c;return db[_0xd1b5('0x3b')][_0xd1b5('0x63')]({'where':{'id':_0x56c781['params']['id']}})[_0xd1b5('0x28')](handleEntityNotFound(_0x3b4869,null))[_0xd1b5('0x28')](function(_0x3b3377){if(_0x3b3377){_0x345398=_0x3b3377;_0x2b9bb3[_0xd1b5('0x42')]=_[_0xd1b5('0x3f')](db['UserVoiceQueueRt'][_0xd1b5('0x3c')]);_0x2b9bb3[_0xd1b5('0x3e')]=_[_0xd1b5('0x3f')](_0x56c781[_0xd1b5('0x3e')]);_0x2b9bb3[_0xd1b5('0x40')]=_[_0xd1b5('0x41')](_0x2b9bb3[_0xd1b5('0x42')],_0x2b9bb3['query']);_0x127c94[_0xd1b5('0x43')]=_[_0xd1b5('0x41')](_0x2b9bb3[_0xd1b5('0x42')],qs[_0xd1b5('0x44')](_0x56c781[_0xd1b5('0x3e')][_0xd1b5('0x44')]));_0x127c94[_0xd1b5('0x43')]=_0x127c94[_0xd1b5('0x43')]['length']?_0x127c94[_0xd1b5('0x43')]:_0x2b9bb3[_0xd1b5('0x42')];_0x127c94[_0xd1b5('0x47')]=qs['sort'](_0x56c781[_0xd1b5('0x3e')][_0xd1b5('0x48')]);_0x127c94[_0xd1b5('0x49')]=qs['filters'](_[_0xd1b5('0x4a')](_0x56c781['query'],_0x2b9bb3[_0xd1b5('0x40')]));if(_0x56c781[_0xd1b5('0x3e')][_0xd1b5('0x2e')]){_0x127c94[_0xd1b5('0x49')]=_[_0xd1b5('0x4b')](_0x127c94[_0xd1b5('0x49')],{'$or':_[_0xd1b5('0x3a')](_0x127c94[_0xd1b5('0x43')],function(_0x1abb25){var _0x1a780b={};_0x1a780b[_0x1abb25]={'$like':'%'+_0x56c781[_0xd1b5('0x3e')][_0xd1b5('0x2e')]+'%'};return _0x1a780b;})});}_0x127c94=_[_0xd1b5('0x4b')]({},_0x127c94,_0x56c781[_0xd1b5('0x4d')]);return _0x345398[_0xd1b5('0x9e')](_0x127c94);}})[_0xd1b5('0x28')](function(_0x125e97){if(_0x125e97){_0xe6d48c=_0x125e97[_0xd1b5('0x45')];if(!_0x56c781[_0xd1b5('0x3e')][_0xd1b5('0x46')]('nolimit')){_0x127c94[_0xd1b5('0x20')]=qs['limit'](_0x56c781[_0xd1b5('0x3e')]['limit']);_0x127c94[_0xd1b5('0x1e')]=qs[_0xd1b5('0x1e')](_0x56c781[_0xd1b5('0x3e')][_0xd1b5('0x1e')]);}return _0x345398[_0xd1b5('0x9e')](_0x127c94);}})['then'](function(_0x4d7c7a){return _0x4d7c7a?{'count':_0xe6d48c,'rows':_0x4d7c7a}:null;})[_0xd1b5('0x28')](respondWithResult(_0x3b4869,null))[_0xd1b5('0x50')](handleError(_0x3b4869,null));};exports[_0xd1b5('0x9f')]=function(_0x2e41a6,_0x1159b1,_0x50398f){var _0x22dc09={};var _0x71648d={};var _0x1eb5f9;var _0x17300b;return db[_0xd1b5('0x3b')][_0xd1b5('0x63')]({'where':{'id':_0x2e41a6[_0xd1b5('0x5a')]['id']}})['then'](handleEntityNotFound(_0x1159b1,null))[_0xd1b5('0x28')](function(_0x556eb5){if(_0x556eb5){_0x1eb5f9=_0x556eb5;_0x71648d['model']=_['keys'](db[_0xd1b5('0xa0')][_0xd1b5('0x3c')]);_0x71648d[_0xd1b5('0x3e')]=_['keys'](_0x2e41a6[_0xd1b5('0x3e')]);_0x71648d[_0xd1b5('0x40')]=_[_0xd1b5('0x41')](_0x71648d[_0xd1b5('0x42')],_0x71648d[_0xd1b5('0x3e')]);_0x22dc09[_0xd1b5('0x43')]=_[_0xd1b5('0x41')](_0x71648d[_0xd1b5('0x42')],qs[_0xd1b5('0x44')](_0x2e41a6[_0xd1b5('0x3e')][_0xd1b5('0x44')]));_0x22dc09[_0xd1b5('0x43')]=_0x22dc09[_0xd1b5('0x43')][_0xd1b5('0x45')]?_0x22dc09[_0xd1b5('0x43')]:_0x71648d['model'];_0x22dc09[_0xd1b5('0x47')]=qs[_0xd1b5('0x48')](_0x2e41a6[_0xd1b5('0x3e')][_0xd1b5('0x48')]);_0x22dc09['where']=qs['filters'](_['pick'](_0x2e41a6['query'],_0x71648d[_0xd1b5('0x40')]));if(_0x2e41a6[_0xd1b5('0x3e')]['filter']){_0x22dc09[_0xd1b5('0x49')]=_[_0xd1b5('0x4b')](_0x22dc09[_0xd1b5('0x49')],{'$or':_['map'](_0x22dc09[_0xd1b5('0x43')],function(_0x470ac7){var _0x2b5201={};_0x2b5201[_0x470ac7]={'$like':'%'+_0x2e41a6['query'][_0xd1b5('0x2e')]+'%'};return _0x2b5201;})});}_0x22dc09=_[_0xd1b5('0x4b')]({},_0x22dc09,_0x2e41a6[_0xd1b5('0x4d')]);return _0x1eb5f9['getLists'](_0x22dc09);}})[_0xd1b5('0x28')](function(_0x4710bc){if(_0x4710bc){_0x17300b=_0x4710bc['length'];if(!_0x2e41a6[_0xd1b5('0x3e')][_0xd1b5('0x46')](_0xd1b5('0x65'))){_0x22dc09[_0xd1b5('0x20')]=qs[_0xd1b5('0x20')](_0x2e41a6[_0xd1b5('0x3e')][_0xd1b5('0x20')]);_0x22dc09['offset']=qs[_0xd1b5('0x1e')](_0x2e41a6['query'][_0xd1b5('0x1e')]);}return _0x1eb5f9[_0xd1b5('0x9f')](_0x22dc09);}})[_0xd1b5('0x28')](function(_0x5d73ca){if(_0x5d73ca){return _0x5d73ca?{'count':_0x17300b,'rows':_0x5d73ca}:null;}})[_0xd1b5('0x28')](respondWithResult(_0x1159b1,null))[_0xd1b5('0x50')](handleError(_0x1159b1,null));};exports[_0xd1b5('0xa1')]=function(_0x5054ef,_0x166f0a,_0x55edc3){var _0x2b2d8a,_0xd4567a;return db[_0xd1b5('0x3b')][_0xd1b5('0x33')]({'where':{'id':_0x5054ef[_0xd1b5('0x5a')]['id']}})[_0xd1b5('0x28')](handleEntityNotFound(_0x166f0a,null))[_0xd1b5('0x28')](function(_0x12b8a3){if(_0x12b8a3){_0xd4567a=_0x12b8a3;return _0x12b8a3[_0xd1b5('0xa1')](_0x5054ef[_0xd1b5('0x5d')][_0xd1b5('0x84')],_[_0xd1b5('0x5e')](_0x5054ef[_0xd1b5('0x5d')],[_0xd1b5('0x84'),'id'])||{});}return null;})[_0xd1b5('0x9a')](function(_0x238908){var _0xec392;_0x2b2d8a=_0x238908||[];var _0xf2fd7c=[];if(_0x238908){for(var _0x519abe=0x0;_0x519abe<_0x238908[_0xd1b5('0x45')];_0x519abe+=0x1){var _0x2ad49d=_0x238908[_0x519abe][_0xd1b5('0x55')]({'plain':!![]});_0xd4567a['dialCheckDuplicateType']=_0x5054ef['body'][_0xd1b5('0xa2')]?_0x5054ef[_0xd1b5('0x5d')]['dialCheckDuplicateType']:_0xd4567a[_0xd1b5('0xa2')];switch(_0xd4567a['dialCheckDuplicateType']){case _0xd1b5('0xa3'):_0xec392=squel['insert']()[_0xd1b5('0xa4')](_0xd1b5('0xa5'))[_0xd1b5('0xa6')]([_0xd1b5('0xa7'),_0xd1b5('0xa8'),_0xd1b5('0xa9'),_0xd1b5('0xaa'),'VoiceQueueId','createdAt','updatedAt'],squel[_0xd1b5('0x85')]()[_0xd1b5('0x86')](_0xd1b5('0xa7'),_0xd1b5('0xa7'))[_0xd1b5('0x86')](_0xd1b5('0xab'),_0xd1b5('0xa8'))['field']('id','ContactId')['field'](_0x2ad49d[_0xd1b5('0xac')]['toString'](),_0xd1b5('0xaa'))['field'](_0x5054ef[_0xd1b5('0x5a')]['id'][_0xd1b5('0x8f')](),_0xd1b5('0x66'))['field']('NOW()',_0xd1b5('0x5b'))[_0xd1b5('0x86')](_0xd1b5('0xab'),_0xd1b5('0x5c'))['from'](_0xd1b5('0xad'))['where'](_0xd1b5('0xae'))[_0xd1b5('0x49')](_0xd1b5('0xaf'),_0x2ad49d[_0xd1b5('0xac')][_0xd1b5('0x8f')]())[_0xd1b5('0x49')](_0xd1b5('0xb0'))[_0xd1b5('0x49')](_0xd1b5('0xb1'),squel[_0xd1b5('0x85')]()[_0xd1b5('0x86')]('COALESCE(calleridnum,\x27\x27)')['from'](_0xd1b5('0xb2'))[_0xd1b5('0x49')](_0xd1b5('0x8d'),_0x5054ef[_0xd1b5('0x5a')]['id'][_0xd1b5('0x8f')]()))[_0xd1b5('0x49')](_0xd1b5('0xb1'),squel[_0xd1b5('0x85')]()['field'](_0xd1b5('0xb3'))[_0xd1b5('0x88')]('cm_hopper')[_0xd1b5('0x49')](_0xd1b5('0x8d'),_0x5054ef[_0xd1b5('0x5a')]['id'][_0xd1b5('0x8f')]())))[_0xd1b5('0x8f')]();break;case _0xd1b5('0xb4'):_0xec392=squel['insert']()['into'](_0xd1b5('0xa5'))[_0xd1b5('0xa6')]([_0xd1b5('0xa7'),'scheduledAt','ContactId',_0xd1b5('0xaa'),'VoiceQueueId',_0xd1b5('0x5b'),_0xd1b5('0x5c')],squel[_0xd1b5('0x85')]()[_0xd1b5('0x86')]('phone',_0xd1b5('0xa7'))['field'](_0xd1b5('0xab'),_0xd1b5('0xa8'))['field']('id',_0xd1b5('0xa9'))['field'](_0x2ad49d[_0xd1b5('0xac')][_0xd1b5('0x8f')](),_0xd1b5('0xaa'))[_0xd1b5('0x86')](_0x5054ef[_0xd1b5('0x5a')]['id'][_0xd1b5('0x8f')](),'VoiceQueueId')[_0xd1b5('0x86')](_0xd1b5('0xab'),_0xd1b5('0x5b'))[_0xd1b5('0x86')](_0xd1b5('0xab'),_0xd1b5('0x5c'))[_0xd1b5('0x88')]('cm_contacts')[_0xd1b5('0x49')](_0xd1b5('0xae'))[_0xd1b5('0x49')]('ListId\x20=\x20?',_0x2ad49d[_0xd1b5('0xac')]['toString']())['where']('phone\x20IS\x20NOT\x20NULL')[_0xd1b5('0x49')](_0xd1b5('0xb1'),squel[_0xd1b5('0x85')]()['field'](_0xd1b5('0xb3'))[_0xd1b5('0x88')](_0xd1b5('0xa5'))[_0xd1b5('0x49')](_0xd1b5('0x8d'),_0x5054ef['params']['id'][_0xd1b5('0x8f')]())))[_0xd1b5('0x8f')]();break;default:_0xec392=squel[_0xd1b5('0xb5')]()[_0xd1b5('0xa4')](_0xd1b5('0xa5'))[_0xd1b5('0xa6')]([_0xd1b5('0xa7'),_0xd1b5('0xa8'),_0xd1b5('0xa9'),_0xd1b5('0xaa'),'VoiceQueueId',_0xd1b5('0x5b'),_0xd1b5('0x5c')],squel[_0xd1b5('0x85')]()[_0xd1b5('0x86')]('phone','phone')[_0xd1b5('0x86')](_0xd1b5('0xab'),_0xd1b5('0xa8'))[_0xd1b5('0x86')]('id',_0xd1b5('0xa9'))[_0xd1b5('0x86')](_0x2ad49d[_0xd1b5('0xac')][_0xd1b5('0x8f')](),_0xd1b5('0xaa'))[_0xd1b5('0x86')](_0x5054ef[_0xd1b5('0x5a')]['id'][_0xd1b5('0x8f')](),_0xd1b5('0x66'))[_0xd1b5('0x86')](_0xd1b5('0xab'),_0xd1b5('0x5b'))['field'](_0xd1b5('0xab'),_0xd1b5('0x5c'))[_0xd1b5('0x88')](_0xd1b5('0xad'))[_0xd1b5('0x49')](_0xd1b5('0xae'))['where'](_0xd1b5('0xaf'),_0x2ad49d[_0xd1b5('0xac')][_0xd1b5('0x8f')]())[_0xd1b5('0x49')](_0xd1b5('0xb0')))['toString']();}_0xf2fd7c[_0xd1b5('0x8e')](db[_0xd1b5('0x7a')][_0xd1b5('0x3e')](_0xec392));}return BPromise[_0xd1b5('0x94')](_0xf2fd7c);}})[_0xd1b5('0x28')](function(){return _0x2b2d8a;})['then'](respondWithResult(_0x166f0a,null))[_0xd1b5('0x50')](handleError(_0x166f0a,null));};exports['removeLists']=function(_0x399a08,_0x493f26,_0x2cf82f){return db[_0xd1b5('0x3b')][_0xd1b5('0x33')]({'where':{'id':_0x399a08[_0xd1b5('0x5a')]['id']}})[_0xd1b5('0x28')](handleEntityNotFound(_0x493f26,null))[_0xd1b5('0x28')](function(_0x3c6137){if(_0x3c6137){return _0x3c6137['removeLists'](_0x399a08[_0xd1b5('0x3e')][_0xd1b5('0x84')]);}})[_0xd1b5('0x28')](function(_0x1cc5bc){if(_0x1cc5bc){return db[_0xd1b5('0x64')]['destroy']({'where':{'ListId':_0x399a08[_0xd1b5('0x3e')][_0xd1b5('0x84')],'VoiceQueueId':_0x399a08[_0xd1b5('0x5a')]['id']}})['then'](function(){return _0x1cc5bc;});}})['then'](respondWithStatusCode(_0x493f26,null))['catch'](handleError(_0x493f26,null));};exports[_0xd1b5('0xb6')]=function(_0x9e0de3,_0x1a4f61,_0x137386){var _0x18eb16={};var _0x37e01f={};var _0x45a97e;var _0x56c3ec;return db[_0xd1b5('0x3b')][_0xd1b5('0x63')]({'where':{'id':_0x9e0de3['params']['id']}})[_0xd1b5('0x28')](handleEntityNotFound(_0x1a4f61,null))[_0xd1b5('0x28')](function(_0x42fdb4){if(_0x42fdb4){_0x45a97e=_0x42fdb4;_0x37e01f[_0xd1b5('0x42')]=_[_0xd1b5('0x3f')](db['CmList']['rawAttributes']);_0x37e01f[_0xd1b5('0x3e')]=_[_0xd1b5('0x3f')](_0x9e0de3['query']);_0x37e01f[_0xd1b5('0x40')]=_[_0xd1b5('0x41')](_0x37e01f[_0xd1b5('0x42')],_0x37e01f[_0xd1b5('0x3e')]);_0x18eb16[_0xd1b5('0x43')]=_[_0xd1b5('0x41')](_0x37e01f[_0xd1b5('0x42')],qs[_0xd1b5('0x44')](_0x9e0de3[_0xd1b5('0x3e')][_0xd1b5('0x44')]));_0x18eb16[_0xd1b5('0x43')]=_0x18eb16['attributes'][_0xd1b5('0x45')]?_0x18eb16[_0xd1b5('0x43')]:_0x37e01f[_0xd1b5('0x42')];_0x18eb16['order']=qs['sort'](_0x9e0de3[_0xd1b5('0x3e')]['sort']);_0x18eb16['where']=qs[_0xd1b5('0x40')](_[_0xd1b5('0x4a')](_0x9e0de3['query'],_0x37e01f[_0xd1b5('0x40')]));if(_0x9e0de3[_0xd1b5('0x3e')][_0xd1b5('0x2e')]){_0x18eb16[_0xd1b5('0x49')]=_[_0xd1b5('0x4b')](_0x18eb16[_0xd1b5('0x49')],{'$or':_['map'](_0x18eb16['attributes'],function(_0x374be5){var _0x4cb6f2={};_0x4cb6f2[_0x374be5]={'$like':'%'+_0x9e0de3['query']['filter']+'%'};return _0x4cb6f2;})});}_0x18eb16=_[_0xd1b5('0x4b')]({},_0x18eb16,_0x9e0de3[_0xd1b5('0x4d')]);return _0x45a97e[_0xd1b5('0xb6')](_0x18eb16);}})[_0xd1b5('0x28')](function(_0x5c3c89){if(_0x5c3c89){_0x56c3ec=_0x5c3c89[_0xd1b5('0x45')];if(!_0x9e0de3[_0xd1b5('0x3e')]['hasOwnProperty'](_0xd1b5('0x65'))){_0x18eb16[_0xd1b5('0x20')]=qs[_0xd1b5('0x20')](_0x9e0de3['query'][_0xd1b5('0x20')]);_0x18eb16['offset']=qs[_0xd1b5('0x1e')](_0x9e0de3['query']['offset']);}return _0x45a97e[_0xd1b5('0xb6')](_0x18eb16);}})[_0xd1b5('0x28')](function(_0x157eb4){if(_0x157eb4){return _0x157eb4?{'count':_0x56c3ec,'rows':_0x157eb4}:null;}})[_0xd1b5('0x28')](respondWithResult(_0x1a4f61,null))[_0xd1b5('0x50')](handleError(_0x1a4f61,null));};exports[_0xd1b5('0xb7')]=function(_0x24e655,_0x1f3f71,_0x556048){var _0x2f3ff2,_0xcd214a;return db[_0xd1b5('0x3b')]['find']({'where':{'id':_0x24e655[_0xd1b5('0x5a')]['id']}})[_0xd1b5('0x28')](handleEntityNotFound(_0x1f3f71,null))[_0xd1b5('0x28')](function(_0x291ca7){if(_0x291ca7){_0xcd214a=_0x291ca7;return _0x291ca7[_0xd1b5('0xb7')](_0x24e655[_0xd1b5('0x5d')][_0xd1b5('0x84')],_[_0xd1b5('0x5e')](_0x24e655[_0xd1b5('0x5d')],[_0xd1b5('0x84'),'id'])||{});}return null;})[_0xd1b5('0x9a')](function(_0x577745){var _0x2db39f;_0x2f3ff2=_0x577745||[];var _0x33b19e=[];if(_0x577745){for(var _0x5ba7fa=0x0;_0x5ba7fa<_0x577745['length'];_0x5ba7fa+=0x1){var _0x2a9e42=_0x577745[_0x5ba7fa][_0xd1b5('0x55')]({'plain':!![]});_0x2db39f=squel[_0xd1b5('0xb5')]()['into'](_0xd1b5('0xb8'))['fromQuery']([_0xd1b5('0xa7'),_0xd1b5('0xa9'),_0xd1b5('0xaa'),_0xd1b5('0x66'),'createdAt',_0xd1b5('0x5c')],squel[_0xd1b5('0x85')]()[_0xd1b5('0x86')](_0xd1b5('0xa7'),_0xd1b5('0xa7'))[_0xd1b5('0x86')]('id',_0xd1b5('0xa9'))[_0xd1b5('0x86')](_0x2a9e42[_0xd1b5('0xac')]['toString'](),_0xd1b5('0xaa'))[_0xd1b5('0x86')](_0x24e655['params']['id']['toString'](),_0xd1b5('0x66'))[_0xd1b5('0x86')](_0xd1b5('0xab'),_0xd1b5('0x5b'))[_0xd1b5('0x86')](_0xd1b5('0xab'),_0xd1b5('0x5c'))[_0xd1b5('0x88')](_0xd1b5('0xad'))['where']('deletedAt\x20IS\x20NULL')[_0xd1b5('0x49')](_0xd1b5('0xaf'),_0x2a9e42[_0xd1b5('0xac')][_0xd1b5('0x8f')]())[_0xd1b5('0x49')]('phone\x20IS\x20NOT\x20NULL'))['toString']();_0x33b19e[_0xd1b5('0x8e')](db[_0xd1b5('0x7a')]['query'](_0x2db39f));}return BPromise[_0xd1b5('0x94')](_0x33b19e);}})['then'](function(){return _0x2f3ff2;})['then'](respondWithResult(_0x1f3f71,null))[_0xd1b5('0x50')](handleError(_0x1f3f71,null));};exports[_0xd1b5('0xb9')]=function(_0x4644e5,_0x5d07e5,_0x90e62f){return db['VoiceQueue']['find']({'where':{'id':_0x4644e5['params']['id']}})[_0xd1b5('0x28')](handleEntityNotFound(_0x5d07e5,null))[_0xd1b5('0x28')](function(_0x594941){if(_0x594941){return _0x594941[_0xd1b5('0xb9')](_0x4644e5[_0xd1b5('0x3e')][_0xd1b5('0x84')]);}})[_0xd1b5('0x28')](function(_0x505543){if(_0x505543){return db[_0xd1b5('0x6d')][_0xd1b5('0x29')]({'where':{'ListId':_0x4644e5['query'][_0xd1b5('0x84')],'VoiceQueueId':_0x4644e5[_0xd1b5('0x5a')]['id']}})[_0xd1b5('0x28')](function(){return _0x505543;});}})[_0xd1b5('0x28')](respondWithStatusCode(_0x5d07e5,null))[_0xd1b5('0x50')](handleError(_0x5d07e5,null));}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.events.js b/server/api/voiceQueue/voiceQueue.events.js index db50a39..8a55c4f 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 _0xa87e=['hook','exports','events','../../mysqldb','VoiceQueue','setMaxListeners','save','remove','emit','hasOwnProperty'];(function(_0x5b1674,_0x4c86de){var _0x225ad5=function(_0x3821a2){while(--_0x3821a2){_0x5b1674['push'](_0x5b1674['shift']());}};_0x225ad5(++_0x4c86de);}(_0xa87e,0x124));var _0xea87=function(_0xcd666,_0x56a4a2){_0xcd666=_0xcd666-0x0;var _0x388de6=_0xa87e[_0xcd666];return _0x388de6;};'use strict';var EventEmitter=require(_0xea87('0x0'));var VoiceQueue=require(_0xea87('0x1'))['db'][_0xea87('0x2')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0xea87('0x3')](0x0);var events={'afterCreate':_0xea87('0x4'),'afterUpdate':'update','afterDestroy':_0xea87('0x5')};function emitEvent(_0x2a3286){return function(_0x22b543,_0x10a7de,_0x162647){VoiceQueueEvents[_0xea87('0x6')](_0x2a3286+':'+_0x22b543['id'],_0x22b543);VoiceQueueEvents[_0xea87('0x6')](_0x2a3286,_0x22b543);_0x162647(null);};}for(var e in events){if(events[_0xea87('0x7')](e)){var event=events[e];VoiceQueue[_0xea87('0x8')](e,emitEvent(event));}}module[_0xea87('0x9')]=VoiceQueueEvents; \ No newline at end of file +var _0x4eb6=['setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','events','../../mysqldb','VoiceQueue'];(function(_0x892d18,_0x903215){var _0x194c07=function(_0x1e342b){while(--_0x1e342b){_0x892d18['push'](_0x892d18['shift']());}};_0x194c07(++_0x903215);}(_0x4eb6,0x9d));var _0x64eb=function(_0x160c4c,_0x317d2b){_0x160c4c=_0x160c4c-0x0;var _0x37f1cf=_0x4eb6[_0x160c4c];return _0x37f1cf;};'use strict';var EventEmitter=require(_0x64eb('0x0'));var VoiceQueue=require(_0x64eb('0x1'))['db'][_0x64eb('0x2')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0x64eb('0x3')](0x0);var events={'afterCreate':_0x64eb('0x4'),'afterUpdate':_0x64eb('0x5'),'afterDestroy':_0x64eb('0x6')};function emitEvent(_0x2fbc7b){return function(_0x238339,_0x3d3fa5,_0x931760){VoiceQueueEvents['emit'](_0x2fbc7b+':'+_0x238339['id'],_0x238339);VoiceQueueEvents[_0x64eb('0x7')](_0x2fbc7b,_0x238339);_0x931760(null);};}for(var e in events){if(events[_0x64eb('0x8')](e)){var event=events[e];VoiceQueue[_0x64eb('0x9')](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 97c67f0..373944e 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(_0x871ef5,_0x58880b){var _0x1f62ea=function(_0x13934c){while(--_0x13934c){_0x871ef5['push'](_0x871ef5['shift']());}};_0x1f62ea(++_0x58880b);}(_0x70e0,0x17b));var _0x070e=function(_0x338541,_0x5c2498){_0x338541=_0x338541-0x0;var _0x27d50a=_0x70e0[_0x338541];return _0x27d50a;};'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 _0x34e8=['voice_queues','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./voiceQueue.attributes','exports','VoiceQueue'];(function(_0x3ae229,_0x3529f4){var _0x15f641=function(_0x2a3485){while(--_0x2a3485){_0x3ae229['push'](_0x3ae229['shift']());}};_0x15f641(++_0x3529f4);}(_0x34e8,0x12c));var _0x834e=function(_0x2cdc4b,_0x2e2fa6){_0x2cdc4b=_0x2cdc4b-0x0;var _0x2e30a4=_0x34e8[_0x2cdc4b];return _0x2e30a4;};'use strict';var _=require(_0x834e('0x0'));var util=require(_0x834e('0x1'));var logger=require(_0x834e('0x2'))(_0x834e('0x3'));var moment=require('moment');var BPromise=require(_0x834e('0x4'));var rp=require(_0x834e('0x5'));var fs=require('fs');var path=require(_0x834e('0x6'));var rimraf=require(_0x834e('0x7'));var config=require(_0x834e('0x8'));var attributes=require(_0x834e('0x9'));module[_0x834e('0xa')]=function(_0x4a2018,_0x858aa1){return _0x4a2018['define'](_0x834e('0xb'),attributes,{'tableName':_0x834e('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.rpc.js b/server/api/voiceQueue/voiceQueue.rpc.js index 853764c..df50c76 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 _0x072a=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','redis','defaults','localhost','./voiceQueue.socket','register','request','then','info','VoiceQueue,\x20%s,\x20%s','debug','VoiceQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','VoiceQueue','findAll','options','raw','where','attributes','limit','include','model','map','GetVoiceQueue','ShowVoiceQueue','find','lodash'];(function(_0x3d6437,_0x146fd7){var _0xcab19d=function(_0xab887c){while(--_0xab887c){_0x3d6437['push'](_0x3d6437['shift']());}};_0xcab19d(++_0x146fd7);}(_0x072a,0x179));var _0xa072=function(_0x9f61c5,_0x481c83){_0x9f61c5=_0x9f61c5-0x0;var _0x534ee2=_0x072a[_0x9f61c5];return _0x534ee2;};'use strict';var _=require(_0xa072('0x0'));var util=require(_0xa072('0x1'));var moment=require(_0xa072('0x2'));var BPromise=require(_0xa072('0x3'));var rs=require(_0xa072('0x4'));var fs=require('fs');var Redis=require(_0xa072('0x5'));var db=require(_0xa072('0x6'))['db'];var utils=require(_0xa072('0x7'));var logger=require(_0xa072('0x8'))('rpc');var config=require(_0xa072('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xa072('0xa')][_0xa072('0xb')]({'port':0x232a});config[_0xa072('0xc')]=_[_0xa072('0xd')](config[_0xa072('0xc')],{'host':_0xa072('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xa072('0xf'))[_0xa072('0x10')](socket);function respondWithRpcPromise(_0x38ecbd,_0x1448ce,_0x1df68a){return new BPromise(function(_0x2c38fd,_0x18f9dc){return client[_0xa072('0x11')](_0x38ecbd,_0x1df68a)[_0xa072('0x12')](function(_0x418952){logger[_0xa072('0x13')](_0xa072('0x14'),_0x1448ce,'request\x20sent');logger[_0xa072('0x15')](_0xa072('0x16'),_0x1448ce,_0xa072('0x17'),JSON[_0xa072('0x18')](_0x418952));if(_0x418952[_0xa072('0x19')]){if(_0x418952[_0xa072('0x19')][_0xa072('0x1a')]===0x1f4){logger['error'](_0xa072('0x14'),_0x1448ce,_0x418952[_0xa072('0x19')][_0xa072('0x1b')]);return _0x18f9dc(_0x418952[_0xa072('0x19')][_0xa072('0x1b')]);}logger[_0xa072('0x19')](_0xa072('0x14'),_0x1448ce,_0x418952['error']['message']);return _0x2c38fd(_0x418952[_0xa072('0x19')]['message']);}else{logger[_0xa072('0x13')]('VoiceQueue,\x20%s,\x20%s',_0x1448ce,_0xa072('0x17'));_0x2c38fd(_0x418952['result']['message']);}})[_0xa072('0x1c')](function(_0x5c50c5){logger[_0xa072('0x19')](_0xa072('0x14'),_0x1448ce,_0x5c50c5);_0x18f9dc(_0x5c50c5);});});}exports['GetVoiceQueue']=function(_0x2ac3d6){var _0x5c753c=this;return new Promise(function(_0x590305,_0xab9a03){return db[_0xa072('0x1d')][_0xa072('0x1e')]({'raw':_0x2ac3d6[_0xa072('0x1f')]?_0x2ac3d6['options'][_0xa072('0x20')]===undefined?!![]:![]:!![],'where':_0x2ac3d6['options']?_0x2ac3d6[_0xa072('0x1f')][_0xa072('0x21')]||null:null,'attributes':_0x2ac3d6[_0xa072('0x1f')]?_0x2ac3d6[_0xa072('0x1f')][_0xa072('0x22')]||null:null,'limit':_0x2ac3d6['options']?_0x2ac3d6['options'][_0xa072('0x23')]||null:null,'include':_0x2ac3d6['options']?_0x2ac3d6[_0xa072('0x1f')][_0xa072('0x24')]?_['map'](_0x2ac3d6[_0xa072('0x1f')][_0xa072('0x24')],function(_0x85c7a2){return{'model':db[_0x85c7a2[_0xa072('0x25')]],'as':_0x85c7a2['as'],'attributes':_0x85c7a2[_0xa072('0x22')],'include':_0x85c7a2[_0xa072('0x24')]?_[_0xa072('0x26')](_0x85c7a2['include'],function(_0x1e8a21){return{'model':db[_0x1e8a21[_0xa072('0x25')]],'as':_0x1e8a21['as'],'attributes':_0x1e8a21[_0xa072('0x22')],'include':_0x1e8a21[_0xa072('0x24')]?_[_0xa072('0x26')](_0x1e8a21['include'],function(_0x30e179){return{'model':db[_0x30e179['model']],'as':_0x30e179['as'],'attributes':_0x30e179['attributes']};}):[]};}):[]};}):[]:[]})[_0xa072('0x12')](function(_0xceb181){logger['info'](_0xa072('0x27'),_0x2ac3d6);logger['debug'](_0xa072('0x27'),_0x2ac3d6,JSON['stringify'](_0xceb181));_0x590305(_0xceb181);})[_0xa072('0x1c')](function(_0x2ec7f0){logger[_0xa072('0x19')](_0xa072('0x27'),_0x2ec7f0['message'],_0x2ac3d6);_0xab9a03(_0x5c753c[_0xa072('0x19')](0x1f4,_0x2ec7f0[_0xa072('0x1b')]));});});};exports[_0xa072('0x28')]=function(_0x38698c){var _0x3b74c3=this;return new Promise(function(_0x504ac3,_0x5b990b){return db[_0xa072('0x1d')][_0xa072('0x29')]({'raw':_0x38698c[_0xa072('0x1f')]?_0x38698c[_0xa072('0x1f')][_0xa072('0x20')]===undefined?!![]:![]:!![],'where':_0x38698c[_0xa072('0x1f')]?_0x38698c[_0xa072('0x1f')][_0xa072('0x21')]||null:null,'attributes':_0x38698c[_0xa072('0x1f')]?_0x38698c[_0xa072('0x1f')][_0xa072('0x22')]||null:null,'include':_0x38698c[_0xa072('0x1f')]?_0x38698c[_0xa072('0x1f')][_0xa072('0x24')]?_[_0xa072('0x26')](_0x38698c['options'][_0xa072('0x24')],function(_0x1da42a){return{'model':db[_0x1da42a[_0xa072('0x25')]],'as':_0x1da42a['as'],'attributes':_0x1da42a[_0xa072('0x22')],'include':_0x1da42a[_0xa072('0x24')]?_[_0xa072('0x26')](_0x1da42a[_0xa072('0x24')],function(_0x244569){return{'model':db[_0x244569[_0xa072('0x25')]],'as':_0x244569['as'],'attributes':_0x244569[_0xa072('0x22')],'include':_0x244569[_0xa072('0x24')]?_[_0xa072('0x26')](_0x244569[_0xa072('0x24')],function(_0x90ee83){return{'model':db[_0x90ee83['model']],'as':_0x90ee83['as'],'attributes':_0x90ee83['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0xfbe722){logger['info'](_0xa072('0x28'),_0x38698c);logger[_0xa072('0x15')](_0xa072('0x28'),_0x38698c,JSON['stringify'](_0xfbe722));_0x504ac3(_0xfbe722);})[_0xa072('0x1c')](function(_0x3e389a){logger[_0xa072('0x19')](_0xa072('0x28'),_0x3e389a[_0xa072('0x1b')],_0x38698c);_0x5b990b(_0x3b74c3['error'](0x1f4,_0x3e389a[_0xa072('0x1b')]));});});}; \ No newline at end of file +var _0x6ee9=['error','code','message','catch','GetVoiceQueue','VoiceQueue','findAll','options','raw','where','attributes','include','map','model','stringify','ShowVoiceQueue','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','request','then','info','VoiceQueue,\x20%s,\x20%s','request\x20sent','debug','VoiceQueue,\x20%s,\x20%s,\x20%s'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x6ee9,0x150));var _0x96ee=function(_0x47e59b,_0x598969){_0x47e59b=_0x47e59b-0x0;var _0x4cf443=_0x6ee9[_0x47e59b];return _0x4cf443;};'use strict';var _=require(_0x96ee('0x0'));var util=require(_0x96ee('0x1'));var moment=require(_0x96ee('0x2'));var BPromise=require('bluebird');var rs=require(_0x96ee('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x96ee('0x4'))['db'];var utils=require(_0x96ee('0x5'));var logger=require(_0x96ee('0x6'))(_0x96ee('0x7'));var config=require(_0x96ee('0x8'));var jayson=require(_0x96ee('0x9'));var client=jayson[_0x96ee('0xa')][_0x96ee('0xb')]({'port':0x232a});config[_0x96ee('0xc')]=_[_0x96ee('0xd')](config[_0x96ee('0xc')],{'host':_0x96ee('0xe'),'port':0x18eb});var socket=require(_0x96ee('0xf'))(new Redis(config[_0x96ee('0xc')]));require('./voiceQueue.socket')[_0x96ee('0x10')](socket);function respondWithRpcPromise(_0x4a3e09,_0x9f9553,_0x298cf0){return new BPromise(function(_0x1c6f35,_0x12899d){return client[_0x96ee('0x11')](_0x4a3e09,_0x298cf0)[_0x96ee('0x12')](function(_0x107a4a){logger[_0x96ee('0x13')](_0x96ee('0x14'),_0x9f9553,_0x96ee('0x15'));logger[_0x96ee('0x16')](_0x96ee('0x17'),_0x9f9553,'request\x20sent',JSON['stringify'](_0x107a4a));if(_0x107a4a[_0x96ee('0x18')]){if(_0x107a4a[_0x96ee('0x18')][_0x96ee('0x19')]===0x1f4){logger['error'](_0x96ee('0x14'),_0x9f9553,_0x107a4a[_0x96ee('0x18')][_0x96ee('0x1a')]);return _0x12899d(_0x107a4a[_0x96ee('0x18')][_0x96ee('0x1a')]);}logger[_0x96ee('0x18')]('VoiceQueue,\x20%s,\x20%s',_0x9f9553,_0x107a4a[_0x96ee('0x18')][_0x96ee('0x1a')]);return _0x1c6f35(_0x107a4a['error'][_0x96ee('0x1a')]);}else{logger[_0x96ee('0x13')](_0x96ee('0x14'),_0x9f9553,_0x96ee('0x15'));_0x1c6f35(_0x107a4a['result']['message']);}})[_0x96ee('0x1b')](function(_0x410663){logger['error'](_0x96ee('0x14'),_0x9f9553,_0x410663);_0x12899d(_0x410663);});});}exports[_0x96ee('0x1c')]=function(_0x4e0aa4){var _0x229a3d=this;return new Promise(function(_0x845763,_0x3636a9){return db[_0x96ee('0x1d')][_0x96ee('0x1e')]({'raw':_0x4e0aa4[_0x96ee('0x1f')]?_0x4e0aa4[_0x96ee('0x1f')][_0x96ee('0x20')]===undefined?!![]:![]:!![],'where':_0x4e0aa4[_0x96ee('0x1f')]?_0x4e0aa4['options'][_0x96ee('0x21')]||null:null,'attributes':_0x4e0aa4['options']?_0x4e0aa4[_0x96ee('0x1f')][_0x96ee('0x22')]||null:null,'limit':_0x4e0aa4[_0x96ee('0x1f')]?_0x4e0aa4['options']['limit']||null:null,'include':_0x4e0aa4[_0x96ee('0x1f')]?_0x4e0aa4[_0x96ee('0x1f')][_0x96ee('0x23')]?_[_0x96ee('0x24')](_0x4e0aa4['options'][_0x96ee('0x23')],function(_0x1fe20b){return{'model':db[_0x1fe20b[_0x96ee('0x25')]],'as':_0x1fe20b['as'],'attributes':_0x1fe20b[_0x96ee('0x22')],'include':_0x1fe20b['include']?_[_0x96ee('0x24')](_0x1fe20b[_0x96ee('0x23')],function(_0x1e2da1){return{'model':db[_0x1e2da1[_0x96ee('0x25')]],'as':_0x1e2da1['as'],'attributes':_0x1e2da1['attributes'],'include':_0x1e2da1[_0x96ee('0x23')]?_[_0x96ee('0x24')](_0x1e2da1[_0x96ee('0x23')],function(_0x210bc5){return{'model':db[_0x210bc5[_0x96ee('0x25')]],'as':_0x210bc5['as'],'attributes':_0x210bc5[_0x96ee('0x22')]};}):[]};}):[]};}):[]:[]})[_0x96ee('0x12')](function(_0x555b14){logger['info'](_0x96ee('0x1c'),_0x4e0aa4);logger['debug'](_0x96ee('0x1c'),_0x4e0aa4,JSON[_0x96ee('0x26')](_0x555b14));_0x845763(_0x555b14);})[_0x96ee('0x1b')](function(_0x77f39b){logger['error'](_0x96ee('0x1c'),_0x77f39b[_0x96ee('0x1a')],_0x4e0aa4);_0x3636a9(_0x229a3d['error'](0x1f4,_0x77f39b[_0x96ee('0x1a')]));});});};exports[_0x96ee('0x27')]=function(_0x408b74){var _0x16b739=this;return new Promise(function(_0x11ebaf,_0x19f815){return db[_0x96ee('0x1d')]['find']({'raw':_0x408b74['options']?_0x408b74[_0x96ee('0x1f')]['raw']===undefined?!![]:![]:!![],'where':_0x408b74[_0x96ee('0x1f')]?_0x408b74[_0x96ee('0x1f')][_0x96ee('0x21')]||null:null,'attributes':_0x408b74[_0x96ee('0x1f')]?_0x408b74[_0x96ee('0x1f')][_0x96ee('0x22')]||null:null,'include':_0x408b74[_0x96ee('0x1f')]?_0x408b74[_0x96ee('0x1f')][_0x96ee('0x23')]?_['map'](_0x408b74[_0x96ee('0x1f')][_0x96ee('0x23')],function(_0x337965){return{'model':db[_0x337965['model']],'as':_0x337965['as'],'attributes':_0x337965[_0x96ee('0x22')],'include':_0x337965['include']?_['map'](_0x337965[_0x96ee('0x23')],function(_0x3cd1e0){return{'model':db[_0x3cd1e0['model']],'as':_0x3cd1e0['as'],'attributes':_0x3cd1e0[_0x96ee('0x22')],'include':_0x3cd1e0[_0x96ee('0x23')]?_[_0x96ee('0x24')](_0x3cd1e0[_0x96ee('0x23')],function(_0x30cd02){return{'model':db[_0x30cd02[_0x96ee('0x25')]],'as':_0x30cd02['as'],'attributes':_0x30cd02[_0x96ee('0x22')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1f255f){logger[_0x96ee('0x13')]('ShowVoiceQueue',_0x408b74);logger['debug'](_0x96ee('0x27'),_0x408b74,JSON[_0x96ee('0x26')](_0x1f255f));_0x11ebaf(_0x1f255f);})[_0x96ee('0x1b')](function(_0x3ba4f4){logger[_0x96ee('0x18')]('ShowVoiceQueue',_0x3ba4f4['message'],_0x408b74);_0x19f815(_0x16b739[_0x96ee('0x18')](0x1f4,_0x3ba4f4['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.socket.js b/server/api/voiceQueue/voiceQueue.socket.js index d621dfd..6aaec2c 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 _0x3164=['./voiceQueue.events','save','remove','emit','register','length'];(function(_0x4d6ac0,_0x201628){var _0x5296c4=function(_0x3d0b3d){while(--_0x3d0b3d){_0x4d6ac0['push'](_0x4d6ac0['shift']());}};_0x5296c4(++_0x201628);}(_0x3164,0x150));var _0x4316=function(_0x5e9f84,_0x576552){_0x5e9f84=_0x5e9f84-0x0;var _0x3325ee=_0x3164[_0x5e9f84];return _0x3325ee;};'use strict';var VoiceQueueEvents=require(_0x4316('0x0'));var events=[_0x4316('0x1'),_0x4316('0x2'),'update'];function createListener(_0x183118,_0x3a4e83){return function(_0x1409a9){_0x3a4e83[_0x4316('0x3')](_0x183118,_0x1409a9);};}function removeListener(_0x2cc42c,_0x1f10fb){return function(){VoiceQueueEvents['removeListener'](_0x2cc42c,_0x1f10fb);};}exports[_0x4316('0x4')]=function(_0x36b1f1){for(var _0x487d0b=0x0,_0x210fae=events[_0x4316('0x5')];_0x487d0b<_0x210fae;_0x487d0b++){var _0x51f286=events[_0x487d0b];var _0x435d84=createListener('voiceQueue:'+_0x51f286,_0x36b1f1);VoiceQueueEvents['on'](_0x51f286,_0x435d84);}}; \ No newline at end of file +var _0x989c=['emit','removeListener','register','length','voiceQueue:','./voiceQueue.events','save','remove','update'];(function(_0x580238,_0x2adec2){var _0x3d5608=function(_0x281c35){while(--_0x281c35){_0x580238['push'](_0x580238['shift']());}};_0x3d5608(++_0x2adec2);}(_0x989c,0x17f));var _0xc989=function(_0x2878b4,_0x1e5020){_0x2878b4=_0x2878b4-0x0;var _0x491938=_0x989c[_0x2878b4];return _0x491938;};'use strict';var VoiceQueueEvents=require(_0xc989('0x0'));var events=[_0xc989('0x1'),_0xc989('0x2'),_0xc989('0x3')];function createListener(_0x2cf6cd,_0x17f919){return function(_0x11ff55){_0x17f919[_0xc989('0x4')](_0x2cf6cd,_0x11ff55);};}function removeListener(_0x370009,_0x4673ea){return function(){VoiceQueueEvents[_0xc989('0x5')](_0x370009,_0x4673ea);};}exports[_0xc989('0x6')]=function(_0x2b3ed2){for(var _0x5b6d18=0x0,_0x1b1420=events[_0xc989('0x7')];_0x5b6d18<_0x1b1420;_0x5b6d18++){var _0x1d4f09=events[_0x5b6d18];var _0x12806d=createListener(_0xc989('0x8')+_0x1d4f09,_0x2b3ed2);VoiceQueueEvents['on'](_0x1d4f09,_0x12806d);}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/index.js b/server/api/voiceQueueReport/index.js index f6da3a9..50eb3e3 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 _0x2dfb=['index','get','/describe','getVoiceQueuesReport','/:id','create','put','delete','destroy','path','express','../../components/auth/service','../../components/interaction/service','isAuthenticated'];(function(_0x3d42d8,_0x4cffaa){var _0x27fc41=function(_0x3a363b){while(--_0x3a363b){_0x3d42d8['push'](_0x3d42d8['shift']());}};_0x27fc41(++_0x4cffaa);}(_0x2dfb,0x121));var _0xb2df=function(_0x14eda7,_0x5393c6){_0x14eda7=_0x14eda7-0x0;var _0x26e9e5=_0x2dfb[_0x14eda7];return _0x26e9e5;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xb2df('0x0'));var timeout=require('connect-timeout');var express=require(_0xb2df('0x1'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xb2df('0x2'));var interaction=require(_0xb2df('0x3'));var config=require('../../config/environment');var controller=require('./voiceQueueReport.controller');router['get']('/',auth[_0xb2df('0x4')](),controller[_0xb2df('0x5')]);router[_0xb2df('0x6')](_0xb2df('0x7'),auth[_0xb2df('0x4')](),controller['describe']);router['get']('/index',auth[_0xb2df('0x4')](),controller[_0xb2df('0x8')]);router[_0xb2df('0x6')](_0xb2df('0x9'),auth[_0xb2df('0x4')](),controller['show']);router['post']('/',auth[_0xb2df('0x4')](),controller[_0xb2df('0xa')]);router[_0xb2df('0xb')]('/:id',auth[_0xb2df('0x4')](),controller['update']);router[_0xb2df('0xc')](_0xb2df('0x9'),auth['isAuthenticated'](),controller[_0xb2df('0xd')]);module['exports']=router; \ No newline at end of file +var _0x69cd=['fs-extra','../../components/auth/service','../../config/environment','./voiceQueueReport.controller','isAuthenticated','index','get','describe','/index','getVoiceQueuesReport','/:id','show','destroy','exports','util','connect-timeout','express'];(function(_0x30dc0e,_0x44622d){var _0x2e2d7b=function(_0xc3de62){while(--_0xc3de62){_0x30dc0e['push'](_0x30dc0e['shift']());}};_0x2e2d7b(++_0x44622d);}(_0x69cd,0xb8));var _0xd69c=function(_0x5f25b3,_0x35481a){_0x5f25b3=_0x5f25b3-0x0;var _0x4ab9bf=_0x69cd[_0x5f25b3];return _0x4ab9bf;};'use strict';var multer=require('multer');var util=require(_0xd69c('0x0'));var path=require('path');var timeout=require(_0xd69c('0x1'));var express=require(_0xd69c('0x2'));var router=express['Router']();var fs_extra=require(_0xd69c('0x3'));var auth=require(_0xd69c('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xd69c('0x5'));var controller=require(_0xd69c('0x6'));router['get']('/',auth[_0xd69c('0x7')](),controller[_0xd69c('0x8')]);router[_0xd69c('0x9')]('/describe',auth[_0xd69c('0x7')](),controller[_0xd69c('0xa')]);router[_0xd69c('0x9')](_0xd69c('0xb'),auth['isAuthenticated'](),controller[_0xd69c('0xc')]);router[_0xd69c('0x9')](_0xd69c('0xd'),auth['isAuthenticated'](),controller[_0xd69c('0xe')]);router['post']('/',auth[_0xd69c('0x7')](),controller['create']);router['put'](_0xd69c('0xd'),auth[_0xd69c('0x7')](),controller['update']);router['delete'](_0xd69c('0xd'),auth[_0xd69c('0x7')](),controller[_0xd69c('0xf')]);module[_0xd69c('0x10')]=router; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.attributes.js b/server/api/voiceQueueReport/voiceQueueReport.attributes.js index db62a50..b83e4fa 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 _0x86ce=['exports','STRING','DATE','getDataValue','queuecallerjoinAt','YYYY-MM-DD\x20HH:mm:ss','diff','seconds','setDataValue','queuecallerleaveAt','holdtime','INTEGER','BOOLEAN','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT','FORWARD,\x20BLIND,\x20ATTENDED','moment'];(function(_0x2a990c,_0x241e85){var _0x47d328=function(_0xdad74){while(--_0xdad74){_0x2a990c['push'](_0x2a990c['shift']());}};_0x47d328(++_0x241e85);}(_0x86ce,0x11f));var _0xe86c=function(_0x4bedce,_0x265ebf){_0x4bedce=_0x4bedce-0x0;var _0x4fd2fb=_0x86ce[_0x4bedce];return _0x4fd2fb;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xe86c('0x0'));module[_0xe86c('0x1')]={'type':{'type':Sequelize[_0xe86c('0x2')]},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0xe86c('0x2')]},'calleridname':{'type':Sequelize[_0xe86c('0x2')]},'queue':{'type':Sequelize[_0xe86c('0x2')]},'queuecallerjoinAt':{'type':Sequelize[_0xe86c('0x3')]},'queuecallerleaveAt':{'type':Sequelize['DATE'],'set':function(_0xc3a037){var _0xc0c3fe=moment(_0xc3a037);var _0x291f6b=moment(this[_0xe86c('0x4')](_0xe86c('0x5')))['format'](_0xe86c('0x6'));var _0x544898=_0xc0c3fe[_0xe86c('0x7')](_0x291f6b,_0xe86c('0x8'));this[_0xe86c('0x9')](_0xe86c('0xa'),_0xc3a037);this[_0xe86c('0x9')](_0xe86c('0xb'),_0x544898||null);}},'position':{'type':Sequelize[_0xe86c('0xc')]},'count':{'type':Sequelize['INTEGER']},'queuecallerabandon':{'type':Sequelize[_0xe86c('0xd')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0xe86c('0x3')]},'queuecallercomplete':{'type':Sequelize[_0xe86c('0xd')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize['DATE']},'queuecallerexit':{'type':Sequelize[_0xe86c('0xd')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize['DATE']},'queuecallerexitreason':{'type':Sequelize[_0xe86c('0x2')],'comment':_0xe86c('0xe')},'originalposition':{'type':Sequelize[_0xe86c('0xc')]},'channel':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0xe86c('0x2')]},'accountcode':{'type':Sequelize[_0xe86c('0x2')]},'context':{'type':Sequelize[_0xe86c('0x2')]},'exten':{'type':Sequelize[_0xe86c('0x2')]},'priority':{'type':Sequelize[_0xe86c('0x2')]},'holdtime':{'type':Sequelize[_0xe86c('0xc')]},'mohtime':{'type':Sequelize[_0xe86c('0xc')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0xe86c('0xd')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0xe86c('0x2')]},'transfer':{'type':Sequelize[_0xe86c('0xd')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0xe86c('0x2')],'comment':_0xe86c('0xf')},'transferexten':{'type':Sequelize[_0xe86c('0x2')]},'transferuniqueid':{'type':Sequelize[_0xe86c('0x2')]},'disposition':{'type':Sequelize[_0xe86c('0x2')]},'secondDisposition':{'type':Sequelize[_0xe86c('0x2')]},'thirdDisposition':{'type':Sequelize['STRING']},'queuecallerenterreason':{'type':Sequelize[_0xe86c('0xc')],'defaultValue':0x0}}; \ No newline at end of file +var _0x19c1=['format','YYYY-MM-DD\x20HH:mm:ss','diff','seconds','setDataValue','queuecallerleaveAt','holdtime','INTEGER','BOOLEAN','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','exports','STRING','DATE','queuecallerjoinAt'];(function(_0x838519,_0x36361d){var _0x45f5bb=function(_0x2aa6dd){while(--_0x2aa6dd){_0x838519['push'](_0x838519['shift']());}};_0x45f5bb(++_0x36361d);}(_0x19c1,0xbb));var _0x119c=function(_0x57f7c8,_0x39efe3){_0x57f7c8=_0x57f7c8-0x0;var _0x2c9e17=_0x19c1[_0x57f7c8];return _0x2c9e17;};'use strict';var Sequelize=require(_0x119c('0x0'));var moment=require('moment');module[_0x119c('0x1')]={'type':{'type':Sequelize[_0x119c('0x2')]},'uniqueid':{'type':Sequelize[_0x119c('0x2')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x119c('0x2')]},'queuecallerjoinAt':{'type':Sequelize['DATE']},'queuecallerleaveAt':{'type':Sequelize[_0x119c('0x3')],'set':function(_0x102330){var _0x55c418=moment(_0x102330);var _0x50f51d=moment(this['getDataValue'](_0x119c('0x4')))[_0x119c('0x5')](_0x119c('0x6'));var _0x52c91e=_0x55c418[_0x119c('0x7')](_0x50f51d,_0x119c('0x8'));this[_0x119c('0x9')](_0x119c('0xa'),_0x102330);this[_0x119c('0x9')](_0x119c('0xb'),_0x52c91e||null);}},'position':{'type':Sequelize['INTEGER']},'count':{'type':Sequelize[_0x119c('0xc')]},'queuecallerabandon':{'type':Sequelize[_0x119c('0xd')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize['DATE']},'queuecallercomplete':{'type':Sequelize[_0x119c('0xd')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0x119c('0x3')]},'queuecallerexit':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0x119c('0x3')]},'queuecallerexitreason':{'type':Sequelize[_0x119c('0x2')],'comment':_0x119c('0xe')},'originalposition':{'type':Sequelize['INTEGER']},'channel':{'type':Sequelize[_0x119c('0x2')]},'connectedlinenum':{'type':Sequelize[_0x119c('0x2')]},'connectedlinename':{'type':Sequelize[_0x119c('0x2')]},'accountcode':{'type':Sequelize[_0x119c('0x2')]},'context':{'type':Sequelize[_0x119c('0x2')]},'exten':{'type':Sequelize[_0x119c('0x2')]},'priority':{'type':Sequelize[_0x119c('0x2')]},'holdtime':{'type':Sequelize['INTEGER']},'mohtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'assigned':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0x119c('0x2')]},'transfer':{'type':Sequelize[_0x119c('0xd')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x119c('0x2')],'comment':_0x119c('0xf')},'transferexten':{'type':Sequelize['STRING']},'transferuniqueid':{'type':Sequelize['STRING']},'disposition':{'type':Sequelize[_0x119c('0x2')]},'secondDisposition':{'type':Sequelize[_0x119c('0x2')]},'thirdDisposition':{'type':Sequelize[_0x119c('0x2')]},'queuecallerenterreason':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.controller.js b/server/api/voiceQueueReport/voiceQueueReport.controller.js index cec01f4..0b8ef37 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 _0xa8fb=['../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','apply','reject','save','update','then','error','name','send','index','VoiceQueueReport','rawAttributes','fieldName','type','key','model','map','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filters','filter','merge','VIRTUAL','options','includeAll','findAll','rows','show','params','keys','find','create','body','catch','destroy','describe','getVoiceQueuesReport','include','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','fs-extra','lodash','desk.js','to-csv','papaparse','ioredis'];(function(_0x349038,_0x65c2d9){var _0x43ff28=function(_0x49d0bb){while(--_0x49d0bb){_0x349038['push'](_0x349038['shift']());}};_0x43ff28(++_0x65c2d9);}(_0xa8fb,0x99));var _0xba8f=function(_0x172747,_0x1732bd){_0x172747=_0x172747-0x0;var _0x509692=_0xa8fb[_0x172747];return _0x509692;};'use strict';var emlformat=require(_0xba8f('0x0'));var rimraf=require(_0xba8f('0x1'));var zipdir=require(_0xba8f('0x2'));var jsonpatch=require(_0xba8f('0x3'));var rp=require(_0xba8f('0x4'));var moment=require(_0xba8f('0x5'));var BPromise=require(_0xba8f('0x6'));var Mustache=require(_0xba8f('0x7'));var util=require('util');var path=require(_0xba8f('0x8'));var sox=require(_0xba8f('0x9'));var csv=require('to-csv');var ejs=require(_0xba8f('0xa'));var fs=require('fs');var fs_extra=require(_0xba8f('0xb'));var _=require(_0xba8f('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xba8f('0xd'));var toCsv=require(_0xba8f('0xe'));var querystring=require('querystring');var Papa=require(_0xba8f('0xf'));var Redis=require(_0xba8f('0x10'));var authService=require(_0xba8f('0x11'));var qs=require(_0xba8f('0x12'));var as=require(_0xba8f('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xba8f('0x14'))('api');var utils=require('../../config/utils');var config=require(_0xba8f('0x15'));var licenseUtil=require(_0xba8f('0x16'));var db=require(_0xba8f('0x17'))['db'];config[_0xba8f('0x18')]=_[_0xba8f('0x19')](config[_0xba8f('0x18')],{'host':_0xba8f('0x1a'),'port':0x18eb});var socket=require(_0xba8f('0x1b'))(new Redis(config['redis']));require('./voiceQueueReport.socket')[_0xba8f('0x1c')](socket);function respondWithStatusCode(_0x27cc34,_0x5a0dab){_0x5a0dab=_0x5a0dab||0xcc;return function(_0x27b0dd){if(_0x27b0dd){return _0x27cc34[_0xba8f('0x1d')](_0x5a0dab);}return _0x27cc34[_0xba8f('0x1e')](_0x5a0dab)[_0xba8f('0x1f')]();};}function respondWithResult(_0x256458,_0x39484f){_0x39484f=_0x39484f||0xc8;return function(_0x322b2c){if(_0x322b2c){return _0x256458[_0xba8f('0x1e')](_0x39484f)[_0xba8f('0x20')](_0x322b2c);}};}function respondWithFilteredResult(_0x547f99,_0x4b885b){return function(_0x471551){if(_0x471551){var _0x9f3b1b=typeof _0x4b885b[_0xba8f('0x21')]==='undefined'&&typeof _0x4b885b['limit']===_0xba8f('0x22');var _0x95ba95=_0x471551[_0xba8f('0x23')];var _0x2b483a=_0x9f3b1b?0x0:_0x4b885b[_0xba8f('0x21')];var _0x47e786=_0x9f3b1b?_0x471551[_0xba8f('0x23')]:_0x4b885b[_0xba8f('0x21')]+_0x4b885b['limit'];var _0x118ff4;if(_0x47e786>=_0x95ba95){_0x47e786=_0x95ba95;_0x118ff4=0xc8;}else{_0x118ff4=0xce;}_0x547f99['status'](_0x118ff4);return _0x547f99[_0xba8f('0x24')](_0xba8f('0x25'),_0x2b483a+'-'+_0x47e786+'/'+_0x95ba95)[_0xba8f('0x20')](_0x471551);}return null;};}function patchUpdates(_0xd24070){return function(_0xc1d3f5){try{jsonpatch[_0xba8f('0x26')](_0xc1d3f5,_0xd24070,!![]);}catch(_0x48e538){return BPromise[_0xba8f('0x27')](_0x48e538);}return _0xc1d3f5[_0xba8f('0x28')]();};}function saveUpdates(_0x22fa67,_0x9c6ac6){return function(_0xa53ae4){if(_0xa53ae4){return _0xa53ae4[_0xba8f('0x29')](_0x22fa67)[_0xba8f('0x2a')](function(_0xb17b66){return _0xb17b66;});}return null;};}function removeEntity(_0x4e4117,_0x2e3f2f){return function(_0x1639c9){if(_0x1639c9){return _0x1639c9['destroy']()['then'](function(){_0x4e4117['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4f8012,_0x1b79de){return function(_0x2d2906){if(!_0x2d2906){_0x4f8012['sendStatus'](0x194);}return _0x2d2906;};}function handleError(_0x259969,_0x2c57b6){_0x2c57b6=_0x2c57b6||0x1f4;return function(_0x3f5c77){logger[_0xba8f('0x2b')](_0x3f5c77['stack']);if(_0x3f5c77[_0xba8f('0x2c')]){delete _0x3f5c77[_0xba8f('0x2c')];}_0x259969[_0xba8f('0x1e')](_0x2c57b6)[_0xba8f('0x2d')](_0x3f5c77);};}exports[_0xba8f('0x2e')]=function(_0x33a453,_0x3b4f89){var _0x468f54={},_0x1e9833={},_0x5eab8f={'count':0x0,'rows':[]};var _0x3cd8ec=_['map'](db[_0xba8f('0x2f')][_0xba8f('0x30')],function(_0x3c8ab3){return{'name':_0x3c8ab3[_0xba8f('0x31')],'type':_0x3c8ab3[_0xba8f('0x32')][_0xba8f('0x33')]};});_0x1e9833[_0xba8f('0x34')]=_[_0xba8f('0x35')](_0x3cd8ec,'name');_0x1e9833[_0xba8f('0x36')]=_['keys'](_0x33a453[_0xba8f('0x36')]);_0x1e9833['filters']=_[_0xba8f('0x37')](_0x1e9833[_0xba8f('0x34')],_0x1e9833[_0xba8f('0x36')]);_0x468f54[_0xba8f('0x38')]=_[_0xba8f('0x37')](_0x1e9833[_0xba8f('0x34')],qs[_0xba8f('0x39')](_0x33a453['query']['fields']));_0x468f54[_0xba8f('0x38')]=_0x468f54[_0xba8f('0x38')][_0xba8f('0x3a')]?_0x468f54[_0xba8f('0x38')]:_0x1e9833[_0xba8f('0x34')];if(!_0x33a453[_0xba8f('0x36')][_0xba8f('0x3b')](_0xba8f('0x3c'))){_0x468f54['limit']=qs[_0xba8f('0x3d')](_0x33a453[_0xba8f('0x36')][_0xba8f('0x3d')]);_0x468f54[_0xba8f('0x21')]=qs[_0xba8f('0x21')](_0x33a453['query'][_0xba8f('0x21')]);}_0x468f54[_0xba8f('0x3e')]=qs[_0xba8f('0x3f')](_0x33a453['query'][_0xba8f('0x3f')]);_0x468f54[_0xba8f('0x40')]=qs['filters'](_[_0xba8f('0x41')](_0x33a453['query'],_0x1e9833[_0xba8f('0x42')]),_0x3cd8ec);if(_0x33a453[_0xba8f('0x36')][_0xba8f('0x43')]){_0x468f54[_0xba8f('0x40')]=_[_0xba8f('0x44')](_0x468f54[_0xba8f('0x40')],{'$or':_[_0xba8f('0x35')](_0x3cd8ec,function(_0x3b2c19){if(_0x3b2c19[_0xba8f('0x32')]!==_0xba8f('0x45')){var _0x36a44c={};_0x36a44c[_0x3b2c19[_0xba8f('0x2c')]]={'$like':'%'+_0x33a453[_0xba8f('0x36')][_0xba8f('0x43')]+'%'};return _0x36a44c;}})});}_0x468f54=_[_0xba8f('0x44')]({},_0x468f54,_0x33a453[_0xba8f('0x46')]);var _0x5ac5ae={'where':_0x468f54[_0xba8f('0x40')]};return db['VoiceQueueReport'][_0xba8f('0x23')](_0x5ac5ae)[_0xba8f('0x2a')](function(_0x519dbd){_0x5eab8f[_0xba8f('0x23')]=_0x519dbd;if(_0x33a453[_0xba8f('0x36')][_0xba8f('0x47')]){_0x468f54['include']=[{'all':!![]}];}return db[_0xba8f('0x2f')][_0xba8f('0x48')](_0x468f54);})[_0xba8f('0x2a')](function(_0x458792){_0x5eab8f[_0xba8f('0x49')]=_0x458792;return _0x5eab8f;})['then'](respondWithFilteredResult(_0x3b4f89,_0x468f54))['catch'](handleError(_0x3b4f89,null));};exports[_0xba8f('0x4a')]=function(_0x48d7e8,_0xdbcfec){var _0x11d431={'raw':![],'where':{'id':_0x48d7e8[_0xba8f('0x4b')]['id']}},_0x2e0e88={};_0x2e0e88[_0xba8f('0x34')]=_['keys'](db['VoiceQueueReport'][_0xba8f('0x30')]);_0x2e0e88[_0xba8f('0x36')]=_[_0xba8f('0x4c')](_0x48d7e8[_0xba8f('0x36')]);_0x2e0e88[_0xba8f('0x42')]=_[_0xba8f('0x37')](_0x2e0e88['model'],_0x2e0e88[_0xba8f('0x36')]);_0x11d431[_0xba8f('0x38')]=_[_0xba8f('0x37')](_0x2e0e88[_0xba8f('0x34')],qs[_0xba8f('0x39')](_0x48d7e8[_0xba8f('0x36')]['fields']));_0x11d431[_0xba8f('0x38')]=_0x11d431['attributes']['length']?_0x11d431[_0xba8f('0x38')]:_0x2e0e88[_0xba8f('0x34')];if(_0x48d7e8[_0xba8f('0x36')][_0xba8f('0x47')]){_0x11d431['include']=[{'all':!![]}];}_0x11d431=_['merge']({},_0x11d431,_0x48d7e8[_0xba8f('0x46')]);return db['VoiceQueueReport'][_0xba8f('0x4d')](_0x11d431)[_0xba8f('0x2a')](handleEntityNotFound(_0xdbcfec,null))[_0xba8f('0x2a')](respondWithResult(_0xdbcfec,null))['catch'](handleError(_0xdbcfec,null));};exports[_0xba8f('0x4e')]=function(_0x50e482,_0x10fd03){return db[_0xba8f('0x2f')][_0xba8f('0x4e')](_0x50e482[_0xba8f('0x4f')],{})[_0xba8f('0x2a')](respondWithResult(_0x10fd03,0xc9))[_0xba8f('0x50')](handleError(_0x10fd03,null));};exports[_0xba8f('0x29')]=function(_0x4f8b73,_0x16f6cb){if(_0x4f8b73[_0xba8f('0x4f')]['id']){delete _0x4f8b73['body']['id'];}return db[_0xba8f('0x2f')][_0xba8f('0x4d')]({'where':{'id':_0x4f8b73[_0xba8f('0x4b')]['id']}})[_0xba8f('0x2a')](handleEntityNotFound(_0x16f6cb,null))[_0xba8f('0x2a')](saveUpdates(_0x4f8b73[_0xba8f('0x4f')],null))['then'](respondWithResult(_0x16f6cb,null))[_0xba8f('0x50')](handleError(_0x16f6cb,null));};exports[_0xba8f('0x51')]=function(_0x4e993a,_0x2621a6){return db[_0xba8f('0x2f')][_0xba8f('0x4d')]({'where':{'id':_0x4e993a['params']['id']}})['then'](handleEntityNotFound(_0x2621a6,null))['then'](removeEntity(_0x2621a6,null))[_0xba8f('0x50')](handleError(_0x2621a6,null));};exports[_0xba8f('0x52')]=function(_0x22a1d3,_0x2b2bb7){return db[_0xba8f('0x2f')]['describe']()['then'](respondWithResult(_0x2b2bb7,null))[_0xba8f('0x50')](handleError(_0x2b2bb7,null));};exports[_0xba8f('0x53')]=function(_0x217a45,_0x3fd033){var _0x4941f2={},_0x2df3a6={},_0x3dccf2={'count':0x0,'rows':[]};_0x2df3a6[_0xba8f('0x34')]=_['keys'](db[_0xba8f('0x2f')][_0xba8f('0x30')]);_0x2df3a6[_0xba8f('0x36')]=_[_0xba8f('0x4c')](_0x217a45['query']);_0x2df3a6[_0xba8f('0x42')]=_[_0xba8f('0x37')](_0x2df3a6['model'],_0x2df3a6['query']);_0x4941f2[_0xba8f('0x38')]=_[_0xba8f('0x37')](_0x2df3a6[_0xba8f('0x34')],qs['fields'](_0x217a45[_0xba8f('0x36')][_0xba8f('0x39')]));_0x4941f2[_0xba8f('0x38')]=_0x4941f2[_0xba8f('0x38')][_0xba8f('0x3a')]?_0x4941f2[_0xba8f('0x38')]:_0x2df3a6['model'];if(!_0x217a45[_0xba8f('0x36')][_0xba8f('0x3b')](_0xba8f('0x3c'))){_0x4941f2['limit']=qs[_0xba8f('0x3d')](_0x217a45[_0xba8f('0x36')]['limit']);_0x4941f2['offset']=qs[_0xba8f('0x21')](_0x217a45[_0xba8f('0x36')][_0xba8f('0x21')]);}_0x4941f2[_0xba8f('0x3e')]=qs[_0xba8f('0x3f')](_0x217a45[_0xba8f('0x36')][_0xba8f('0x3f')]);_0x4941f2['where']=qs[_0xba8f('0x42')](_['pick'](_0x217a45[_0xba8f('0x36')],_0x2df3a6[_0xba8f('0x42')]));if(_0x217a45[_0xba8f('0x36')][_0xba8f('0x43')]){_0x4941f2[_0xba8f('0x40')]=_[_0xba8f('0x44')](_0x4941f2[_0xba8f('0x40')],{'$or':_[_0xba8f('0x35')](_0x4941f2[_0xba8f('0x38')],function(_0x5ac9c8){var _0x41c133={};_0x41c133[_0x5ac9c8]={'$like':'%'+_0x217a45[_0xba8f('0x36')]['filter']+'%'};return _0x41c133;})});}_0x4941f2=_[_0xba8f('0x44')]({},_0x4941f2,_0x217a45[_0xba8f('0x46')]);var _0x2abbbd={'where':_0x4941f2[_0xba8f('0x40')]};return db['VoiceQueueReport'][_0xba8f('0x23')](_0x2abbbd)[_0xba8f('0x2a')](function(_0x4f5b33){_0x3dccf2[_0xba8f('0x23')]=_0x4f5b33;if(_0x217a45[_0xba8f('0x36')][_0xba8f('0x47')]){_0x4941f2[_0xba8f('0x54')]=[{'all':!![]}];}return db[_0xba8f('0x2f')][_0xba8f('0x48')](_0x4941f2);})[_0xba8f('0x2a')](function(_0x1ed20c){_0x3dccf2['rows']=_0x1ed20c;return _0x3dccf2;})['then'](respondWithFilteredResult(_0x3fd033,_0x4941f2,_0xba8f('0x53')))[_0xba8f('0x50')](handleError(_0x3fd033,null,_0xba8f('0x53')));}; \ No newline at end of file +var _0x1085=['pick','eml-format','rimraf','zip-dir','fast-json-patch','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','status','offset','undefined','limit','count','set','json','apply','reject','save','destroy','then','end','sendStatus','stack','name','send','map','VoiceQueueReport','rawAttributes','fieldName','type','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','filter','VIRTUAL','merge','options','includeAll','include','findAll','catch','show','params','find','create','body','update','describe','getVoiceQueuesReport','order'];(function(_0x3070dc,_0x40cf11){var _0x431489=function(_0x49bc2a){while(--_0x49bc2a){_0x3070dc['push'](_0x3070dc['shift']());}};_0x431489(++_0x40cf11);}(_0x1085,0xfd));var _0x5108=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1085[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x5108('0x0'));var rimraf=require(_0x5108('0x1'));var zipdir=require(_0x5108('0x2'));var jsonpatch=require(_0x5108('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x5108('0x4'));var util=require(_0x5108('0x5'));var path=require(_0x5108('0x6'));var sox=require(_0x5108('0x7'));var csv=require(_0x5108('0x8'));var ejs=require(_0x5108('0x9'));var fs=require('fs');var fs_extra=require(_0x5108('0xa'));var _=require(_0x5108('0xb'));var squel=require(_0x5108('0xc'));var crypto=require(_0x5108('0xd'));var jsforce=require(_0x5108('0xe'));var deskjs=require(_0x5108('0xf'));var toCsv=require('to-csv');var querystring=require(_0x5108('0x10'));var Papa=require(_0x5108('0x11'));var Redis=require(_0x5108('0x12'));var authService=require(_0x5108('0x13'));var qs=require(_0x5108('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5108('0x15'));var logger=require(_0x5108('0x16'))(_0x5108('0x17'));var utils=require(_0x5108('0x18'));var config=require(_0x5108('0x19'));var licenseUtil=require(_0x5108('0x1a'));var db=require(_0x5108('0x1b'))['db'];config['redis']=_[_0x5108('0x1c')](config[_0x5108('0x1d')],{'host':_0x5108('0x1e'),'port':0x18eb});var socket=require(_0x5108('0x1f'))(new Redis(config[_0x5108('0x1d')]));require('./voiceQueueReport.socket')['register'](socket);function respondWithStatusCode(_0x2a2a24,_0x37ef8f){_0x37ef8f=_0x37ef8f||0xcc;return function(_0x24ae88){if(_0x24ae88){return _0x2a2a24['sendStatus'](_0x37ef8f);}return _0x2a2a24['status'](_0x37ef8f)['end']();};}function respondWithResult(_0x4b71b9,_0x2a08fc){_0x2a08fc=_0x2a08fc||0xc8;return function(_0xe135ba){if(_0xe135ba){return _0x4b71b9[_0x5108('0x20')](_0x2a08fc)['json'](_0xe135ba);}};}function respondWithFilteredResult(_0x460e18,_0x473e43){return function(_0x10cb4a){if(_0x10cb4a){var _0x5aab67=typeof _0x473e43[_0x5108('0x21')]===_0x5108('0x22')&&typeof _0x473e43[_0x5108('0x23')]===_0x5108('0x22');var _0x545514=_0x10cb4a[_0x5108('0x24')];var _0x4490cd=_0x5aab67?0x0:_0x473e43[_0x5108('0x21')];var _0x560c48=_0x5aab67?_0x10cb4a[_0x5108('0x24')]:_0x473e43[_0x5108('0x21')]+_0x473e43[_0x5108('0x23')];var _0x4cbdf1;if(_0x560c48>=_0x545514){_0x560c48=_0x545514;_0x4cbdf1=0xc8;}else{_0x4cbdf1=0xce;}_0x460e18[_0x5108('0x20')](_0x4cbdf1);return _0x460e18[_0x5108('0x25')]('Content-Range',_0x4490cd+'-'+_0x560c48+'/'+_0x545514)[_0x5108('0x26')](_0x10cb4a);}return null;};}function patchUpdates(_0x5d231a){return function(_0x1c59a4){try{jsonpatch[_0x5108('0x27')](_0x1c59a4,_0x5d231a,!![]);}catch(_0xeb3ed){return BPromise[_0x5108('0x28')](_0xeb3ed);}return _0x1c59a4[_0x5108('0x29')]();};}function saveUpdates(_0x4df5ab,_0x586b2a){return function(_0x57285e){if(_0x57285e){return _0x57285e['update'](_0x4df5ab)['then'](function(_0x32d2c9){return _0x32d2c9;});}return null;};}function removeEntity(_0x1801cb,_0x33cc28){return function(_0x562ad7){if(_0x562ad7){return _0x562ad7[_0x5108('0x2a')]()[_0x5108('0x2b')](function(){_0x1801cb['status'](0xcc)[_0x5108('0x2c')]();});}};}function handleEntityNotFound(_0xfc1a4b,_0x4d6e22){return function(_0x28ee21){if(!_0x28ee21){_0xfc1a4b[_0x5108('0x2d')](0x194);}return _0x28ee21;};}function handleError(_0x5edf82,_0x380f37){_0x380f37=_0x380f37||0x1f4;return function(_0x22a564){logger['error'](_0x22a564[_0x5108('0x2e')]);if(_0x22a564['name']){delete _0x22a564[_0x5108('0x2f')];}_0x5edf82[_0x5108('0x20')](_0x380f37)[_0x5108('0x30')](_0x22a564);};}exports['index']=function(_0x2cf86d,_0x1165c0){var _0x4b1da4={},_0x3f7c14={},_0x62e362={'count':0x0,'rows':[]};var _0x53c776=_[_0x5108('0x31')](db[_0x5108('0x32')][_0x5108('0x33')],function(_0x2617dc){return{'name':_0x2617dc[_0x5108('0x34')],'type':_0x2617dc[_0x5108('0x35')]['key']};});_0x3f7c14[_0x5108('0x36')]=_[_0x5108('0x31')](_0x53c776,'name');_0x3f7c14[_0x5108('0x37')]=_[_0x5108('0x38')](_0x2cf86d[_0x5108('0x37')]);_0x3f7c14['filters']=_[_0x5108('0x39')](_0x3f7c14['model'],_0x3f7c14[_0x5108('0x37')]);_0x4b1da4[_0x5108('0x3a')]=_[_0x5108('0x39')](_0x3f7c14[_0x5108('0x36')],qs[_0x5108('0x3b')](_0x2cf86d[_0x5108('0x37')][_0x5108('0x3b')]));_0x4b1da4[_0x5108('0x3a')]=_0x4b1da4[_0x5108('0x3a')][_0x5108('0x3c')]?_0x4b1da4[_0x5108('0x3a')]:_0x3f7c14['model'];if(!_0x2cf86d[_0x5108('0x37')][_0x5108('0x3d')](_0x5108('0x3e'))){_0x4b1da4[_0x5108('0x23')]=qs[_0x5108('0x23')](_0x2cf86d[_0x5108('0x37')]['limit']);_0x4b1da4[_0x5108('0x21')]=qs[_0x5108('0x21')](_0x2cf86d[_0x5108('0x37')][_0x5108('0x21')]);}_0x4b1da4['order']=qs['sort'](_0x2cf86d[_0x5108('0x37')][_0x5108('0x3f')]);_0x4b1da4[_0x5108('0x40')]=qs[_0x5108('0x41')](_['pick'](_0x2cf86d[_0x5108('0x37')],_0x3f7c14[_0x5108('0x41')]),_0x53c776);if(_0x2cf86d[_0x5108('0x37')][_0x5108('0x42')]){_0x4b1da4[_0x5108('0x40')]=_['merge'](_0x4b1da4['where'],{'$or':_['map'](_0x53c776,function(_0x135c3){if(_0x135c3[_0x5108('0x35')]!==_0x5108('0x43')){var _0x14ac9d={};_0x14ac9d[_0x135c3[_0x5108('0x2f')]]={'$like':'%'+_0x2cf86d[_0x5108('0x37')][_0x5108('0x42')]+'%'};return _0x14ac9d;}})});}_0x4b1da4=_[_0x5108('0x44')]({},_0x4b1da4,_0x2cf86d[_0x5108('0x45')]);var _0x4a2c8c={'where':_0x4b1da4[_0x5108('0x40')]};return db[_0x5108('0x32')]['count'](_0x4a2c8c)[_0x5108('0x2b')](function(_0xf5f8ef){_0x62e362[_0x5108('0x24')]=_0xf5f8ef;if(_0x2cf86d[_0x5108('0x37')][_0x5108('0x46')]){_0x4b1da4[_0x5108('0x47')]=[{'all':!![]}];}return db['VoiceQueueReport'][_0x5108('0x48')](_0x4b1da4);})['then'](function(_0x33929e){_0x62e362['rows']=_0x33929e;return _0x62e362;})['then'](respondWithFilteredResult(_0x1165c0,_0x4b1da4))[_0x5108('0x49')](handleError(_0x1165c0,null));};exports[_0x5108('0x4a')]=function(_0x29e191,_0x3fbb67){var _0x64acea={'raw':![],'where':{'id':_0x29e191[_0x5108('0x4b')]['id']}},_0x247594={};_0x247594[_0x5108('0x36')]=_[_0x5108('0x38')](db[_0x5108('0x32')][_0x5108('0x33')]);_0x247594[_0x5108('0x37')]=_[_0x5108('0x38')](_0x29e191[_0x5108('0x37')]);_0x247594[_0x5108('0x41')]=_[_0x5108('0x39')](_0x247594['model'],_0x247594[_0x5108('0x37')]);_0x64acea[_0x5108('0x3a')]=_[_0x5108('0x39')](_0x247594[_0x5108('0x36')],qs['fields'](_0x29e191[_0x5108('0x37')][_0x5108('0x3b')]));_0x64acea[_0x5108('0x3a')]=_0x64acea[_0x5108('0x3a')][_0x5108('0x3c')]?_0x64acea['attributes']:_0x247594['model'];if(_0x29e191['query'][_0x5108('0x46')]){_0x64acea[_0x5108('0x47')]=[{'all':!![]}];}_0x64acea=_[_0x5108('0x44')]({},_0x64acea,_0x29e191[_0x5108('0x45')]);return db[_0x5108('0x32')][_0x5108('0x4c')](_0x64acea)[_0x5108('0x2b')](handleEntityNotFound(_0x3fbb67,null))[_0x5108('0x2b')](respondWithResult(_0x3fbb67,null))['catch'](handleError(_0x3fbb67,null));};exports[_0x5108('0x4d')]=function(_0x5528e8,_0x1862c8){return db['VoiceQueueReport']['create'](_0x5528e8[_0x5108('0x4e')],{})[_0x5108('0x2b')](respondWithResult(_0x1862c8,0xc9))[_0x5108('0x49')](handleError(_0x1862c8,null));};exports[_0x5108('0x4f')]=function(_0x5efc87,_0x5d4826){if(_0x5efc87[_0x5108('0x4e')]['id']){delete _0x5efc87[_0x5108('0x4e')]['id'];}return db[_0x5108('0x32')][_0x5108('0x4c')]({'where':{'id':_0x5efc87[_0x5108('0x4b')]['id']}})[_0x5108('0x2b')](handleEntityNotFound(_0x5d4826,null))[_0x5108('0x2b')](saveUpdates(_0x5efc87[_0x5108('0x4e')],null))['then'](respondWithResult(_0x5d4826,null))[_0x5108('0x49')](handleError(_0x5d4826,null));};exports['destroy']=function(_0x4b55b2,_0x2754ad){return db[_0x5108('0x32')][_0x5108('0x4c')]({'where':{'id':_0x4b55b2[_0x5108('0x4b')]['id']}})[_0x5108('0x2b')](handleEntityNotFound(_0x2754ad,null))[_0x5108('0x2b')](removeEntity(_0x2754ad,null))[_0x5108('0x49')](handleError(_0x2754ad,null));};exports['describe']=function(_0xc8e333,_0x33027e){return db[_0x5108('0x32')][_0x5108('0x50')]()[_0x5108('0x2b')](respondWithResult(_0x33027e,null))['catch'](handleError(_0x33027e,null));};exports[_0x5108('0x51')]=function(_0x33bac4,_0x3415cc){var _0xe286db={},_0xbdf95f={},_0x4a2837={'count':0x0,'rows':[]};_0xbdf95f[_0x5108('0x36')]=_[_0x5108('0x38')](db[_0x5108('0x32')][_0x5108('0x33')]);_0xbdf95f[_0x5108('0x37')]=_[_0x5108('0x38')](_0x33bac4[_0x5108('0x37')]);_0xbdf95f['filters']=_['intersection'](_0xbdf95f[_0x5108('0x36')],_0xbdf95f['query']);_0xe286db[_0x5108('0x3a')]=_[_0x5108('0x39')](_0xbdf95f[_0x5108('0x36')],qs['fields'](_0x33bac4['query'][_0x5108('0x3b')]));_0xe286db[_0x5108('0x3a')]=_0xe286db[_0x5108('0x3a')][_0x5108('0x3c')]?_0xe286db[_0x5108('0x3a')]:_0xbdf95f[_0x5108('0x36')];if(!_0x33bac4['query'][_0x5108('0x3d')](_0x5108('0x3e'))){_0xe286db[_0x5108('0x23')]=qs[_0x5108('0x23')](_0x33bac4[_0x5108('0x37')][_0x5108('0x23')]);_0xe286db[_0x5108('0x21')]=qs['offset'](_0x33bac4[_0x5108('0x37')][_0x5108('0x21')]);}_0xe286db[_0x5108('0x52')]=qs[_0x5108('0x3f')](_0x33bac4[_0x5108('0x37')]['sort']);_0xe286db[_0x5108('0x40')]=qs[_0x5108('0x41')](_[_0x5108('0x53')](_0x33bac4[_0x5108('0x37')],_0xbdf95f[_0x5108('0x41')]));if(_0x33bac4[_0x5108('0x37')][_0x5108('0x42')]){_0xe286db[_0x5108('0x40')]=_[_0x5108('0x44')](_0xe286db[_0x5108('0x40')],{'$or':_[_0x5108('0x31')](_0xe286db[_0x5108('0x3a')],function(_0x4de77a){var _0x43a2e4={};_0x43a2e4[_0x4de77a]={'$like':'%'+_0x33bac4[_0x5108('0x37')][_0x5108('0x42')]+'%'};return _0x43a2e4;})});}_0xe286db=_[_0x5108('0x44')]({},_0xe286db,_0x33bac4[_0x5108('0x45')]);var _0x3aee99={'where':_0xe286db[_0x5108('0x40')]};return db['VoiceQueueReport'][_0x5108('0x24')](_0x3aee99)[_0x5108('0x2b')](function(_0x18d539){_0x4a2837[_0x5108('0x24')]=_0x18d539;if(_0x33bac4['query'][_0x5108('0x46')]){_0xe286db['include']=[{'all':!![]}];}return db[_0x5108('0x32')][_0x5108('0x48')](_0xe286db);})[_0x5108('0x2b')](function(_0x4b541f){_0x4a2837['rows']=_0x4b541f;return _0x4a2837;})[_0x5108('0x2b')](respondWithFilteredResult(_0x3415cc,_0xe286db,_0x5108('0x51')))[_0x5108('0x49')](handleError(_0x3415cc,null,_0x5108('0x51')));}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.events.js b/server/api/voiceQueueReport/voiceQueueReport.events.js index c2f206b..504aad9 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 _0x4c0e=['hook','../../mysqldb','setMaxListeners','update','emit','hasOwnProperty'];(function(_0x481bf7,_0x437f69){var _0x461787=function(_0xb3bc9d){while(--_0xb3bc9d){_0x481bf7['push'](_0x481bf7['shift']());}};_0x461787(++_0x437f69);}(_0x4c0e,0xd3));var _0xe4c0=function(_0x220dbb,_0x99328d){_0x220dbb=_0x220dbb-0x0;var _0x2b77de=_0x4c0e[_0x220dbb];return _0x2b77de;};'use strict';var EventEmitter=require('events');var VoiceQueueReport=require(_0xe4c0('0x0'))['db']['VoiceQueueReport'];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0xe4c0('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0xe4c0('0x2'),'afterDestroy':'remove'};function emitEvent(_0x49c812){return function(_0x532714,_0x4436d0,_0x176a8a){VoiceQueueReportEvents[_0xe4c0('0x3')](_0x49c812+':'+_0x532714['id'],_0x532714);VoiceQueueReportEvents[_0xe4c0('0x3')](_0x49c812,_0x532714);_0x176a8a(null);};}for(var e in events){if(events[_0xe4c0('0x4')](e)){var event=events[e];VoiceQueueReport[_0xe4c0('0x5')](e,emitEvent(event));}}module['exports']=VoiceQueueReportEvents; \ No newline at end of file +var _0xa749=['emit','hasOwnProperty','hook','exports','../../mysqldb','VoiceQueueReport','setMaxListeners','update','remove'];(function(_0x1122a2,_0x5652cb){var _0x43f720=function(_0x30fc80){while(--_0x30fc80){_0x1122a2['push'](_0x1122a2['shift']());}};_0x43f720(++_0x5652cb);}(_0xa749,0x148));var _0x9a74=function(_0x85e8ec,_0x504c0e){_0x85e8ec=_0x85e8ec-0x0;var _0x4209c7=_0xa749[_0x85e8ec];return _0x4209c7;};'use strict';var EventEmitter=require('events');var VoiceQueueReport=require(_0x9a74('0x0'))['db'][_0x9a74('0x1')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0x9a74('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x9a74('0x3'),'afterDestroy':_0x9a74('0x4')};function emitEvent(_0x150b09){return function(_0x5c2774,_0x3b31e8,_0x36570c){VoiceQueueReportEvents[_0x9a74('0x5')](_0x150b09+':'+_0x5c2774['id'],_0x5c2774);VoiceQueueReportEvents[_0x9a74('0x5')](_0x150b09,_0x5c2774);_0x36570c(null);};}for(var e in events){if(events[_0x9a74('0x6')](e)){var event=events[e];VoiceQueueReport[_0x9a74('0x7')](e,emitEvent(event));}}module[_0x9a74('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 72f6327..86de342 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 _0x2943=['../../config/logger','bluebird','path','rimraf','./voiceQueueReport.attributes','exports','VoiceQueueReport','report_queue','uniqueid','calleridnum','lodash'];(function(_0xc2d0d0,_0x272c47){var _0x391392=function(_0x41e711){while(--_0x41e711){_0xc2d0d0['push'](_0xc2d0d0['shift']());}};_0x391392(++_0x272c47);}(_0x2943,0x11d));var _0x3294=function(_0x4bb66f,_0x3cd682){_0x4bb66f=_0x4bb66f-0x0;var _0xf2772f=_0x2943[_0x4bb66f];return _0xf2772f;};'use strict';var _=require(_0x3294('0x0'));var util=require('util');var logger=require(_0x3294('0x1'))('api');var moment=require('moment');var BPromise=require(_0x3294('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3294('0x3'));var rimraf=require(_0x3294('0x4'));var config=require('../../config/environment');var attributes=require(_0x3294('0x5'));module[_0x3294('0x6')]=function(_0x2897ac,_0x45f20d){return _0x2897ac['define'](_0x3294('0x7'),attributes,{'tableName':_0x3294('0x8'),'paranoid':![],'indexes':[{'fields':[_0x3294('0x9')]},{'fields':[_0x3294('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xf364=['report_queue','uniqueid','calleridnum','lodash','../../config/logger','api','moment','path','rimraf','../../config/environment','exports','define','VoiceQueueReport'];(function(_0x294b45,_0x4e56ed){var _0x1d80c9=function(_0xbcfa67){while(--_0xbcfa67){_0x294b45['push'](_0x294b45['shift']());}};_0x1d80c9(++_0x4e56ed);}(_0xf364,0x78));var _0x4f36=function(_0x47a7d0,_0x4e182d){_0x47a7d0=_0x47a7d0-0x0;var _0xb9bd08=_0xf364[_0x47a7d0];return _0xb9bd08;};'use strict';var _=require(_0x4f36('0x0'));var util=require('util');var logger=require(_0x4f36('0x1'))(_0x4f36('0x2'));var moment=require(_0x4f36('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x4f36('0x4'));var rimraf=require(_0x4f36('0x5'));var config=require(_0x4f36('0x6'));var attributes=require('./voiceQueueReport.attributes');module[_0x4f36('0x7')]=function(_0x1de3ca,_0x38700d){return _0x1de3ca[_0x4f36('0x8')](_0x4f36('0x9'),attributes,{'tableName':_0x4f36('0xa'),'paranoid':![],'indexes':[{'fields':[_0x4f36('0xb')]},{'fields':[_0x4f36('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.rpc.js b/server/api/voiceQueueReport/voiceQueueReport.rpc.js index 69d3638..97a392d 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 _0x7a23=['CreateVoiceQueueReport','UpdateVoiceQueueReport','update','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','socket.io-emitter','register','request','then','info','VoiceQueueReport,\x20%s,\x20%s','request\x20sent','error','message','result','catch','GetVoiceQueueReport','findAll','options','raw','where','attributes','limit','include','map','model','debug','stringify','VoiceQueueReport','create','body'];(function(_0x3d73f7,_0x3bc1aa){var _0x5047d8=function(_0x30bf56){while(--_0x30bf56){_0x3d73f7['push'](_0x3d73f7['shift']());}};_0x5047d8(++_0x3bc1aa);}(_0x7a23,0xd0));var _0x37a2=function(_0x3310fa,_0x542970){_0x3310fa=_0x3310fa-0x0;var _0x20855d=_0x7a23[_0x3310fa];return _0x20855d;};'use strict';var _=require('lodash');var util=require(_0x37a2('0x0'));var moment=require(_0x37a2('0x1'));var BPromise=require('bluebird');var rs=require(_0x37a2('0x2'));var fs=require('fs');var Redis=require(_0x37a2('0x3'));var db=require(_0x37a2('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x37a2('0x5'))(_0x37a2('0x6'));var config=require(_0x37a2('0x7'));var jayson=require(_0x37a2('0x8'));var client=jayson['client'][_0x37a2('0x9')]({'port':0x232a});config[_0x37a2('0xa')]=_[_0x37a2('0xb')](config[_0x37a2('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x37a2('0xc'))(new Redis(config['redis']));require('./voiceQueueReport.socket')[_0x37a2('0xd')](socket);function respondWithRpcPromise(_0x53697f,_0xeeb3aa,_0x210e3f){return new BPromise(function(_0x47dceb,_0x5ab330){return client[_0x37a2('0xe')](_0x53697f,_0x210e3f)[_0x37a2('0xf')](function(_0x3e6fd0){logger[_0x37a2('0x10')](_0x37a2('0x11'),_0xeeb3aa,_0x37a2('0x12'));logger['debug']('VoiceQueueReport,\x20%s,\x20%s,\x20%s',_0xeeb3aa,_0x37a2('0x12'),JSON['stringify'](_0x3e6fd0));if(_0x3e6fd0[_0x37a2('0x13')]){if(_0x3e6fd0[_0x37a2('0x13')]['code']===0x1f4){logger[_0x37a2('0x13')](_0x37a2('0x11'),_0xeeb3aa,_0x3e6fd0[_0x37a2('0x13')][_0x37a2('0x14')]);return _0x5ab330(_0x3e6fd0[_0x37a2('0x13')]['message']);}logger[_0x37a2('0x13')]('VoiceQueueReport,\x20%s,\x20%s',_0xeeb3aa,_0x3e6fd0[_0x37a2('0x13')][_0x37a2('0x14')]);return _0x47dceb(_0x3e6fd0[_0x37a2('0x13')][_0x37a2('0x14')]);}else{logger['info'](_0x37a2('0x11'),_0xeeb3aa,'request\x20sent');_0x47dceb(_0x3e6fd0[_0x37a2('0x15')][_0x37a2('0x14')]);}})[_0x37a2('0x16')](function(_0x12392a){logger['error']('VoiceQueueReport,\x20%s,\x20%s',_0xeeb3aa,_0x12392a);_0x5ab330(_0x12392a);});});}exports[_0x37a2('0x17')]=function(_0x3ba36f){var _0x1a0cb3=this;return new Promise(function(_0x3ebbed,_0x5d3e51){return db['VoiceQueueReport'][_0x37a2('0x18')]({'raw':_0x3ba36f['options']?_0x3ba36f[_0x37a2('0x19')][_0x37a2('0x1a')]===undefined?!![]:![]:!![],'where':_0x3ba36f[_0x37a2('0x19')]?_0x3ba36f[_0x37a2('0x19')][_0x37a2('0x1b')]||null:null,'attributes':_0x3ba36f[_0x37a2('0x19')]?_0x3ba36f[_0x37a2('0x19')][_0x37a2('0x1c')]||null:null,'limit':_0x3ba36f[_0x37a2('0x19')]?_0x3ba36f[_0x37a2('0x19')][_0x37a2('0x1d')]||null:null,'include':_0x3ba36f['options']?_0x3ba36f[_0x37a2('0x19')][_0x37a2('0x1e')]?_[_0x37a2('0x1f')](_0x3ba36f[_0x37a2('0x19')][_0x37a2('0x1e')],function(_0x34aedd){return{'model':db[_0x34aedd[_0x37a2('0x20')]],'as':_0x34aedd['as'],'attributes':_0x34aedd['attributes'],'include':_0x34aedd[_0x37a2('0x1e')]?_[_0x37a2('0x1f')](_0x34aedd['include'],function(_0x306aa9){return{'model':db[_0x306aa9[_0x37a2('0x20')]],'as':_0x306aa9['as'],'attributes':_0x306aa9[_0x37a2('0x1c')],'include':_0x306aa9[_0x37a2('0x1e')]?_[_0x37a2('0x1f')](_0x306aa9[_0x37a2('0x1e')],function(_0x534be7){return{'model':db[_0x534be7[_0x37a2('0x20')]],'as':_0x534be7['as'],'attributes':_0x534be7['attributes']};}):[]};}):[]};}):[]:[]})[_0x37a2('0xf')](function(_0x4d10e0){logger[_0x37a2('0x10')](_0x37a2('0x17'),_0x3ba36f);logger[_0x37a2('0x21')](_0x37a2('0x17'),_0x3ba36f,JSON[_0x37a2('0x22')](_0x4d10e0));_0x3ebbed(_0x4d10e0);})[_0x37a2('0x16')](function(_0x1824f3){logger['error'](_0x37a2('0x17'),_0x1824f3[_0x37a2('0x14')],_0x3ba36f);_0x5d3e51(_0x1a0cb3[_0x37a2('0x13')](0x1f4,_0x1824f3[_0x37a2('0x14')]));});});};exports['CreateVoiceQueueReport']=function(_0xb13283){var _0x4c3242=this;return new Promise(function(_0x539266,_0x2c3115){return db[_0x37a2('0x23')][_0x37a2('0x24')](_0xb13283[_0x37a2('0x25')],{'raw':_0xb13283[_0x37a2('0x19')]?_0xb13283[_0x37a2('0x19')][_0x37a2('0x1a')]===undefined?!![]:![]:!![]})['then'](function(_0x562ea4){logger[_0x37a2('0x10')](_0x37a2('0x26'),_0xb13283);logger[_0x37a2('0x21')]('CreateVoiceQueueReport',_0xb13283,JSON[_0x37a2('0x22')](_0x562ea4));_0x539266(_0x562ea4);})[_0x37a2('0x16')](function(_0x554cec){logger[_0x37a2('0x13')](_0x37a2('0x26'),_0x554cec['message'],_0xb13283);_0x2c3115(_0x4c3242[_0x37a2('0x13')](0x1f4,_0x554cec['message']));});});};exports[_0x37a2('0x27')]=function(_0x4d2459){var _0x4f10f5=this;return new Promise(function(_0x1be0c9,_0x374dd6){return db[_0x37a2('0x23')][_0x37a2('0x28')](_0x4d2459[_0x37a2('0x25')],{'raw':_0x4d2459[_0x37a2('0x19')]?_0x4d2459[_0x37a2('0x19')][_0x37a2('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4d2459['options']?_0x4d2459[_0x37a2('0x19')][_0x37a2('0x1b')]||null:null,'attributes':_0x4d2459[_0x37a2('0x19')]?_0x4d2459[_0x37a2('0x19')][_0x37a2('0x1c')]||null:null,'limit':_0x4d2459['options']?_0x4d2459[_0x37a2('0x19')][_0x37a2('0x1d')]||null:null})[_0x37a2('0xf')](function(_0x1992b0){logger[_0x37a2('0x10')](_0x37a2('0x27'),_0x4d2459);logger[_0x37a2('0x21')]('UpdateVoiceQueueReport',_0x4d2459,JSON[_0x37a2('0x22')](_0x1992b0));_0x1be0c9(_0x1992b0);})[_0x37a2('0x16')](function(_0x4063e0){logger['error'](_0x37a2('0x27'),_0x4063e0['message'],_0x4d2459);_0x374dd6(_0x4f10f5[_0x37a2('0x13')](0x1f4,_0x4063e0[_0x37a2('0x14')]));});});}; \ No newline at end of file +var _0x6b90=['../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','redis','defaults','localhost','socket.io-emitter','request','then','request\x20sent','debug','stringify','error','code','VoiceQueueReport,\x20%s,\x20%s','message','result','catch','GetVoiceQueueReport','VoiceQueueReport','options','raw','where','limit','include','map','model','attributes','CreateVoiceQueueReport','create','body','info','UpdateVoiceQueueReport','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x43d16c,_0x2b5447){var _0x208cce=function(_0x371720){while(--_0x371720){_0x43d16c['push'](_0x43d16c['shift']());}};_0x208cce(++_0x2b5447);}(_0x6b90,0x16b));var _0x06b9=function(_0x4befae,_0x55b079){_0x4befae=_0x4befae-0x0;var _0x76c573=_0x6b90[_0x4befae];return _0x76c573;};'use strict';var _=require(_0x06b9('0x0'));var util=require(_0x06b9('0x1'));var moment=require(_0x06b9('0x2'));var BPromise=require(_0x06b9('0x3'));var rs=require(_0x06b9('0x4'));var fs=require('fs');var Redis=require(_0x06b9('0x5'));var db=require(_0x06b9('0x6'))['db'];var utils=require(_0x06b9('0x7'));var logger=require(_0x06b9('0x8'))('rpc');var config=require(_0x06b9('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x06b9('0xa')]({'port':0x232a});config[_0x06b9('0xb')]=_[_0x06b9('0xc')](config[_0x06b9('0xb')],{'host':_0x06b9('0xd'),'port':0x18eb});var socket=require(_0x06b9('0xe'))(new Redis(config[_0x06b9('0xb')]));require('./voiceQueueReport.socket')['register'](socket);function respondWithRpcPromise(_0x54e16a,_0x34f5df,_0x234f3d){return new BPromise(function(_0x4a96eb,_0x4fa8f2){return client[_0x06b9('0xf')](_0x54e16a,_0x234f3d)[_0x06b9('0x10')](function(_0x25c5a5){logger['info']('VoiceQueueReport,\x20%s,\x20%s',_0x34f5df,_0x06b9('0x11'));logger[_0x06b9('0x12')]('VoiceQueueReport,\x20%s,\x20%s,\x20%s',_0x34f5df,'request\x20sent',JSON[_0x06b9('0x13')](_0x25c5a5));if(_0x25c5a5['error']){if(_0x25c5a5[_0x06b9('0x14')][_0x06b9('0x15')]===0x1f4){logger[_0x06b9('0x14')](_0x06b9('0x16'),_0x34f5df,_0x25c5a5[_0x06b9('0x14')][_0x06b9('0x17')]);return _0x4fa8f2(_0x25c5a5[_0x06b9('0x14')][_0x06b9('0x17')]);}logger[_0x06b9('0x14')](_0x06b9('0x16'),_0x34f5df,_0x25c5a5['error'][_0x06b9('0x17')]);return _0x4a96eb(_0x25c5a5[_0x06b9('0x14')][_0x06b9('0x17')]);}else{logger['info']('VoiceQueueReport,\x20%s,\x20%s',_0x34f5df,'request\x20sent');_0x4a96eb(_0x25c5a5[_0x06b9('0x18')][_0x06b9('0x17')]);}})[_0x06b9('0x19')](function(_0x35196a){logger[_0x06b9('0x14')](_0x06b9('0x16'),_0x34f5df,_0x35196a);_0x4fa8f2(_0x35196a);});});}exports[_0x06b9('0x1a')]=function(_0x36ff35){var _0x40447a=this;return new Promise(function(_0x4a06f5,_0xb74904){return db[_0x06b9('0x1b')]['findAll']({'raw':_0x36ff35['options']?_0x36ff35[_0x06b9('0x1c')][_0x06b9('0x1d')]===undefined?!![]:![]:!![],'where':_0x36ff35[_0x06b9('0x1c')]?_0x36ff35[_0x06b9('0x1c')][_0x06b9('0x1e')]||null:null,'attributes':_0x36ff35[_0x06b9('0x1c')]?_0x36ff35[_0x06b9('0x1c')]['attributes']||null:null,'limit':_0x36ff35[_0x06b9('0x1c')]?_0x36ff35[_0x06b9('0x1c')][_0x06b9('0x1f')]||null:null,'include':_0x36ff35[_0x06b9('0x1c')]?_0x36ff35[_0x06b9('0x1c')][_0x06b9('0x20')]?_[_0x06b9('0x21')](_0x36ff35[_0x06b9('0x1c')]['include'],function(_0x491c57){return{'model':db[_0x491c57[_0x06b9('0x22')]],'as':_0x491c57['as'],'attributes':_0x491c57[_0x06b9('0x23')],'include':_0x491c57[_0x06b9('0x20')]?_[_0x06b9('0x21')](_0x491c57['include'],function(_0x1b0a1e){return{'model':db[_0x1b0a1e[_0x06b9('0x22')]],'as':_0x1b0a1e['as'],'attributes':_0x1b0a1e[_0x06b9('0x23')],'include':_0x1b0a1e[_0x06b9('0x20')]?_[_0x06b9('0x21')](_0x1b0a1e[_0x06b9('0x20')],function(_0x27434f){return{'model':db[_0x27434f[_0x06b9('0x22')]],'as':_0x27434f['as'],'attributes':_0x27434f[_0x06b9('0x23')]};}):[]};}):[]};}):[]:[]})[_0x06b9('0x10')](function(_0x3a85b5){logger['info'](_0x06b9('0x1a'),_0x36ff35);logger[_0x06b9('0x12')](_0x06b9('0x1a'),_0x36ff35,JSON[_0x06b9('0x13')](_0x3a85b5));_0x4a06f5(_0x3a85b5);})[_0x06b9('0x19')](function(_0x107925){logger[_0x06b9('0x14')](_0x06b9('0x1a'),_0x107925[_0x06b9('0x17')],_0x36ff35);_0xb74904(_0x40447a[_0x06b9('0x14')](0x1f4,_0x107925[_0x06b9('0x17')]));});});};exports[_0x06b9('0x24')]=function(_0x5514fc){var _0x1b2564=this;return new Promise(function(_0x5ac2b2,_0x2f9cf1){return db[_0x06b9('0x1b')][_0x06b9('0x25')](_0x5514fc[_0x06b9('0x26')],{'raw':_0x5514fc[_0x06b9('0x1c')]?_0x5514fc[_0x06b9('0x1c')][_0x06b9('0x1d')]===undefined?!![]:![]:!![]})[_0x06b9('0x10')](function(_0x37eb65){logger[_0x06b9('0x27')]('CreateVoiceQueueReport',_0x5514fc);logger[_0x06b9('0x12')](_0x06b9('0x24'),_0x5514fc,JSON[_0x06b9('0x13')](_0x37eb65));_0x5ac2b2(_0x37eb65);})['catch'](function(_0x1682f0){logger[_0x06b9('0x14')](_0x06b9('0x24'),_0x1682f0[_0x06b9('0x17')],_0x5514fc);_0x2f9cf1(_0x1b2564[_0x06b9('0x14')](0x1f4,_0x1682f0['message']));});});};exports[_0x06b9('0x28')]=function(_0x31c609){var _0x399ed7=this;return new Promise(function(_0x457915,_0x4032c6){return db[_0x06b9('0x1b')]['update'](_0x31c609[_0x06b9('0x26')],{'raw':_0x31c609[_0x06b9('0x1c')]?_0x31c609['options'][_0x06b9('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x31c609[_0x06b9('0x1c')]?_0x31c609[_0x06b9('0x1c')][_0x06b9('0x1e')]||null:null,'attributes':_0x31c609[_0x06b9('0x1c')]?_0x31c609[_0x06b9('0x1c')][_0x06b9('0x23')]||null:null,'limit':_0x31c609[_0x06b9('0x1c')]?_0x31c609[_0x06b9('0x1c')][_0x06b9('0x1f')]||null:null})[_0x06b9('0x10')](function(_0x5961f5){logger[_0x06b9('0x27')]('UpdateVoiceQueueReport',_0x31c609);logger['debug'](_0x06b9('0x28'),_0x31c609,JSON[_0x06b9('0x13')](_0x5961f5));_0x457915(_0x5961f5);})[_0x06b9('0x19')](function(_0x309041){logger[_0x06b9('0x14')](_0x06b9('0x28'),_0x309041[_0x06b9('0x17')],_0x31c609);_0x4032c6(_0x399ed7[_0x06b9('0x14')](0x1f4,_0x309041['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.socket.js b/server/api/voiceQueueReport/voiceQueueReport.socket.js index 65696e4..b798370 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 _0x0e6a=['update','removeListener','register','voiceQueueReport:','save','remove'];(function(_0x5c6531,_0x1591f2){var _0x1be604=function(_0x3a0996){while(--_0x3a0996){_0x5c6531['push'](_0x5c6531['shift']());}};_0x1be604(++_0x1591f2);}(_0x0e6a,0x100));var _0xa0e6=function(_0x419715,_0x221336){_0x419715=_0x419715-0x0;var _0x274fbd=_0x0e6a[_0x419715];return _0x274fbd;};'use strict';var VoiceQueueReportEvents=require('./voiceQueueReport.events');var events=[_0xa0e6('0x0'),_0xa0e6('0x1'),_0xa0e6('0x2')];function createListener(_0xc880d9,_0x4061b1){return function(_0x40b6c7){_0x4061b1['emit'](_0xc880d9,_0x40b6c7);};}function removeListener(_0xcd5884,_0x19cadf){return function(){VoiceQueueReportEvents[_0xa0e6('0x3')](_0xcd5884,_0x19cadf);};}exports[_0xa0e6('0x4')]=function(_0xb7b1a4){for(var _0x31ce20=0x0,_0x52171c=events['length'];_0x31ce20<_0x52171c;_0x31ce20++){var _0x298038=events[_0x31ce20];var _0x267726=createListener(_0xa0e6('0x5')+_0x298038,_0xb7b1a4);VoiceQueueReportEvents['on'](_0x298038,_0x267726);}}; \ No newline at end of file +var _0xa4c2=['voiceQueueReport:','./voiceQueueReport.events','remove','removeListener','register','length'];(function(_0x138adb,_0x193fee){var _0x1b27f2=function(_0x5e97a2){while(--_0x5e97a2){_0x138adb['push'](_0x138adb['shift']());}};_0x1b27f2(++_0x193fee);}(_0xa4c2,0xc1));var _0x2a4c=function(_0x4f5ed0,_0x1c3162){_0x4f5ed0=_0x4f5ed0-0x0;var _0x181800=_0xa4c2[_0x4f5ed0];return _0x181800;};'use strict';var VoiceQueueReportEvents=require(_0x2a4c('0x0'));var events=['save',_0x2a4c('0x1'),'update'];function createListener(_0x44c6d6,_0x1ffde5){return function(_0x4aebbe){_0x1ffde5['emit'](_0x44c6d6,_0x4aebbe);};}function removeListener(_0x1e27e9,_0x558ef7){return function(){VoiceQueueReportEvents[_0x2a4c('0x2')](_0x1e27e9,_0x558ef7);};}exports[_0x2a4c('0x3')]=function(_0x5141d6){for(var _0x259803=0x0,_0x3d2511=events[_0x2a4c('0x4')];_0x259803<_0x3d2511;_0x259803++){var _0x41dfad=events[_0x259803];var _0x1f86e5=createListener(_0x2a4c('0x5')+_0x41dfad,_0x5141d6);VoiceQueueReportEvents['on'](_0x41dfad,_0x1f86e5);}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/index.js b/server/api/voiceQueuesLog/index.js index cf175a1..3c26e7c 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 _0xffde=['util','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','show','post','create','put','/:id','update','delete','multer'];(function(_0x4e0b59,_0x17db3c){var _0x516812=function(_0x1dd0d3){while(--_0x1dd0d3){_0x4e0b59['push'](_0x4e0b59['shift']());}};_0x516812(++_0x17db3c);}(_0xffde,0x7f));var _0xeffd=function(_0x3d39e7,_0x2ac5b2){_0x3d39e7=_0x3d39e7-0x0;var _0x56bfa7=_0xffde[_0x3d39e7];return _0x56bfa7;};'use strict';var multer=require(_0xeffd('0x0'));var util=require(_0xeffd('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xeffd('0x2'));var router=express[_0xeffd('0x3')]();var fs_extra=require(_0xeffd('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xeffd('0x5'));var config=require(_0xeffd('0x6'));var controller=require('./voiceQueuesLog.controller');router[_0xeffd('0x7')]('/',auth['isAuthenticated'](),controller['index']);router['get']('/:id',auth[_0xeffd('0x8')](),controller[_0xeffd('0x9')]);router[_0xeffd('0xa')]('/',auth[_0xeffd('0x8')](),controller[_0xeffd('0xb')]);router[_0xeffd('0xc')](_0xeffd('0xd'),auth[_0xeffd('0x8')](),controller[_0xeffd('0xe')]);router[_0xeffd('0xf')](_0xeffd('0xd'),auth[_0xeffd('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xca46=['get','isAuthenticated','index','/:id','show','post','put','delete','destroy','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x29cc96,_0x39d612){var _0xd403ae=function(_0x104054){while(--_0x104054){_0x29cc96['push'](_0x29cc96['shift']());}};_0xd403ae(++_0x39d612);}(_0xca46,0xa9));var _0x6ca4=function(_0x303c07,_0x282df4){_0x303c07=_0x303c07-0x0;var _0x7f1f6=_0xca46[_0x303c07];return _0x7f1f6;};'use strict';var multer=require('multer');var util=require(_0x6ca4('0x0'));var path=require('path');var timeout=require(_0x6ca4('0x1'));var express=require('express');var router=express[_0x6ca4('0x2')]();var fs_extra=require(_0x6ca4('0x3'));var auth=require(_0x6ca4('0x4'));var interaction=require(_0x6ca4('0x5'));var config=require(_0x6ca4('0x6'));var controller=require('./voiceQueuesLog.controller');router[_0x6ca4('0x7')]('/',auth[_0x6ca4('0x8')](),controller[_0x6ca4('0x9')]);router[_0x6ca4('0x7')](_0x6ca4('0xa'),auth['isAuthenticated'](),controller[_0x6ca4('0xb')]);router[_0x6ca4('0xc')]('/',auth[_0x6ca4('0x8')](),controller['create']);router[_0x6ca4('0xd')](_0x6ca4('0xa'),auth[_0x6ca4('0x8')](),controller['update']);router[_0x6ca4('0xe')]('/:id',auth[_0x6ca4('0x8')](),controller[_0x6ca4('0xf')]);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 5ecffd6..5995626 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 _0xda58=['STRING','format','YYYY-MM-DD\x20HH:mm:ss','sequelize','moment'];(function(_0x2080a3,_0x48acfa){var _0x8d7d17=function(_0x2dbc06){while(--_0x2dbc06){_0x2080a3['push'](_0x2080a3['shift']());}};_0x8d7d17(++_0x48acfa);}(_0xda58,0x1c5));var _0x8da5=function(_0x5eb55f,_0x3b009a){_0x5eb55f=_0x5eb55f-0x0;var _0x403003=_0xda58[_0x5eb55f];return _0x403003;};'use strict';var Sequelize=require(_0x8da5('0x0'));var moment=require(_0x8da5('0x1'));module['exports']={'time':{'type':Sequelize[_0x8da5('0x2')]},'callid':{'type':Sequelize[_0x8da5('0x2')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0x8da5('0x2')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0x8da5('0x2')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0x8da5('0x2')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0x8da5('0x2')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0x8da5('0x2')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0x8da5('0x2')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0x8da5('0x2')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':moment()[_0x8da5('0x3')](_0x8da5('0x4'))}}; \ No newline at end of file +var _0x6ffc=['DATE','format','YYYY-MM-DD\x20HH:mm:ss','moment','STRING'];(function(_0x170640,_0x2e2bfa){var _0x471075=function(_0x3a5f33){while(--_0x3a5f33){_0x170640['push'](_0x170640['shift']());}};_0x471075(++_0x2e2bfa);}(_0x6ffc,0x12a));var _0xc6ff=function(_0x2a9461,_0x25ecf8){_0x2a9461=_0x2a9461-0x0;var _0x15b1f0=_0x6ffc[_0x2a9461];return _0x15b1f0;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xc6ff('0x0'));module['exports']={'time':{'type':Sequelize[_0xc6ff('0x1')]},'callid':{'type':Sequelize[_0xc6ff('0x1')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0xc6ff('0x1')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0xc6ff('0x1')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0xc6ff('0x1')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0xc6ff('0x1')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0xc6ff('0x1')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0xc6ff('0x1')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0xc6ff('0x1')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0xc6ff('0x1')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0xc6ff('0x2')],'allowNull':![],'defaultValue':moment()[_0xc6ff('0x3')](_0xc6ff('0x4'))}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.controller.js b/server/api/voiceQueuesLog/voiceQueuesLog.controller.js index 9918161..1ea98e3 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 _0x499c=['to-csv','fs-extra','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','then','destroy','error','stack','name','rawAttributes','fieldName','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','VoiceQueuesLog','includeAll','include','findAll','rows','show','params','find','catch','create','body','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util'];(function(_0x4c6314,_0x5700b1){var _0x5d03ff=function(_0x26fc50){while(--_0x26fc50){_0x4c6314['push'](_0x4c6314['shift']());}};_0x5d03ff(++_0x5700b1);}(_0x499c,0xd9));var _0xc499=function(_0x38d449,_0x3a0342){_0x38d449=_0x38d449-0x0;var _0x1c68a4=_0x499c[_0x38d449];return _0x1c68a4;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc499('0x0'));var zipdir=require(_0xc499('0x1'));var jsonpatch=require(_0xc499('0x2'));var rp=require(_0xc499('0x3'));var moment=require(_0xc499('0x4'));var BPromise=require(_0xc499('0x5'));var Mustache=require(_0xc499('0x6'));var util=require(_0xc499('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0xc499('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc499('0x9'));var _=require('lodash');var squel=require(_0xc499('0xa'));var crypto=require('crypto');var jsforce=require(_0xc499('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xc499('0x8'));var querystring=require(_0xc499('0xc'));var Papa=require(_0xc499('0xd'));var Redis=require(_0xc499('0xe'));var authService=require(_0xc499('0xf'));var qs=require(_0xc499('0x10'));var as=require(_0xc499('0x11'));var hardwareService=require(_0xc499('0x12'));var logger=require(_0xc499('0x13'))(_0xc499('0x14'));var utils=require('../../config/utils');var config=require(_0xc499('0x15'));var licenseUtil=require(_0xc499('0x16'));var db=require(_0xc499('0x17'))['db'];function respondWithStatusCode(_0x3f58e0,_0x348e32){_0x348e32=_0x348e32||0xcc;return function(_0x1d8c2e){if(_0x1d8c2e){return _0x3f58e0[_0xc499('0x18')](_0x348e32);}return _0x3f58e0[_0xc499('0x19')](_0x348e32)[_0xc499('0x1a')]();};}function respondWithResult(_0x53971d,_0x288616){_0x288616=_0x288616||0xc8;return function(_0x15afe4){if(_0x15afe4){return _0x53971d[_0xc499('0x19')](_0x288616)[_0xc499('0x1b')](_0x15afe4);}};}function respondWithFilteredResult(_0x501843,_0x122c58){return function(_0x382ddd){if(_0x382ddd){var _0x37ff94=typeof _0x122c58[_0xc499('0x1c')]===_0xc499('0x1d')&&typeof _0x122c58[_0xc499('0x1e')]===_0xc499('0x1d');var _0x41e517=_0x382ddd[_0xc499('0x1f')];var _0x53b205=_0x37ff94?0x0:_0x122c58[_0xc499('0x1c')];var _0xde8c12=_0x37ff94?_0x382ddd[_0xc499('0x1f')]:_0x122c58[_0xc499('0x1c')]+_0x122c58['limit'];var _0x21540f;if(_0xde8c12>=_0x41e517){_0xde8c12=_0x41e517;_0x21540f=0xc8;}else{_0x21540f=0xce;}_0x501843['status'](_0x21540f);return _0x501843['set'](_0xc499('0x20'),_0x53b205+'-'+_0xde8c12+'/'+_0x41e517)[_0xc499('0x1b')](_0x382ddd);}return null;};}function patchUpdates(_0x70416d){return function(_0x288013){try{jsonpatch[_0xc499('0x21')](_0x288013,_0x70416d,!![]);}catch(_0x5559c0){return BPromise[_0xc499('0x22')](_0x5559c0);}return _0x288013[_0xc499('0x23')]();};}function saveUpdates(_0x339714,_0x49e252){return function(_0x1ca1c8){if(_0x1ca1c8){return _0x1ca1c8['update'](_0x339714)[_0xc499('0x24')](function(_0x12d68f){return _0x12d68f;});}return null;};}function removeEntity(_0x47c388,_0x5a3d76){return function(_0x37fedd){if(_0x37fedd){return _0x37fedd[_0xc499('0x25')]()[_0xc499('0x24')](function(){_0x47c388[_0xc499('0x19')](0xcc)[_0xc499('0x1a')]();});}};}function handleEntityNotFound(_0x3ac366,_0x47ad60){return function(_0x18c6c3){if(!_0x18c6c3){_0x3ac366[_0xc499('0x18')](0x194);}return _0x18c6c3;};}function handleError(_0x238787,_0x256f3d){_0x256f3d=_0x256f3d||0x1f4;return function(_0x421c97){logger[_0xc499('0x26')](_0x421c97[_0xc499('0x27')]);if(_0x421c97[_0xc499('0x28')]){delete _0x421c97['name'];}_0x238787[_0xc499('0x19')](_0x256f3d)['send'](_0x421c97);};}exports['index']=function(_0x26f150,_0x560deb){var _0xa0b16c={},_0x3a74c6={},_0xccd0b5={'count':0x0,'rows':[]};var _0x133c2a=_['map'](db['VoiceQueuesLog'][_0xc499('0x29')],function(_0x5a270f){return{'name':_0x5a270f[_0xc499('0x2a')],'type':_0x5a270f['type'][_0xc499('0x2b')]};});_0x3a74c6[_0xc499('0x2c')]=_[_0xc499('0x2d')](_0x133c2a,_0xc499('0x28'));_0x3a74c6[_0xc499('0x2e')]=_[_0xc499('0x2f')](_0x26f150[_0xc499('0x2e')]);_0x3a74c6[_0xc499('0x30')]=_[_0xc499('0x31')](_0x3a74c6['model'],_0x3a74c6[_0xc499('0x2e')]);_0xa0b16c[_0xc499('0x32')]=_[_0xc499('0x31')](_0x3a74c6['model'],qs[_0xc499('0x33')](_0x26f150['query']['fields']));_0xa0b16c[_0xc499('0x32')]=_0xa0b16c['attributes'][_0xc499('0x34')]?_0xa0b16c[_0xc499('0x32')]:_0x3a74c6['model'];if(!_0x26f150[_0xc499('0x2e')][_0xc499('0x35')](_0xc499('0x36'))){_0xa0b16c[_0xc499('0x1e')]=qs['limit'](_0x26f150[_0xc499('0x2e')][_0xc499('0x1e')]);_0xa0b16c['offset']=qs[_0xc499('0x1c')](_0x26f150[_0xc499('0x2e')]['offset']);}_0xa0b16c[_0xc499('0x37')]=qs[_0xc499('0x38')](_0x26f150['query'][_0xc499('0x38')]);_0xa0b16c[_0xc499('0x39')]=qs['filters'](_[_0xc499('0x3a')](_0x26f150[_0xc499('0x2e')],_0x3a74c6[_0xc499('0x30')]),_0x133c2a);if(_0x26f150[_0xc499('0x2e')][_0xc499('0x3b')]){_0xa0b16c[_0xc499('0x39')]=_[_0xc499('0x3c')](_0xa0b16c[_0xc499('0x39')],{'$or':_['map'](_0x133c2a,function(_0x1a26d3){if(_0x1a26d3[_0xc499('0x3d')]!==_0xc499('0x3e')){var _0x81d85={};_0x81d85[_0x1a26d3[_0xc499('0x28')]]={'$like':'%'+_0x26f150[_0xc499('0x2e')][_0xc499('0x3b')]+'%'};return _0x81d85;}})});}_0xa0b16c=_['merge']({},_0xa0b16c,_0x26f150[_0xc499('0x3f')]);var _0xacb573={'where':_0xa0b16c[_0xc499('0x39')]};return db[_0xc499('0x40')][_0xc499('0x1f')](_0xacb573)['then'](function(_0xe962ac){_0xccd0b5[_0xc499('0x1f')]=_0xe962ac;if(_0x26f150[_0xc499('0x2e')][_0xc499('0x41')]){_0xa0b16c[_0xc499('0x42')]=[{'all':!![]}];}return db['VoiceQueuesLog'][_0xc499('0x43')](_0xa0b16c);})[_0xc499('0x24')](function(_0x333d9e){_0xccd0b5[_0xc499('0x44')]=_0x333d9e;return _0xccd0b5;})[_0xc499('0x24')](respondWithFilteredResult(_0x560deb,_0xa0b16c))['catch'](handleError(_0x560deb,null));};exports[_0xc499('0x45')]=function(_0x54c670,_0x2a2819){var _0x1d032d={'raw':!![],'where':{'id':_0x54c670[_0xc499('0x46')]['id']}},_0x4706bf={};_0x4706bf['model']=_['keys'](db['VoiceQueuesLog'][_0xc499('0x29')]);_0x4706bf[_0xc499('0x2e')]=_[_0xc499('0x2f')](_0x54c670['query']);_0x4706bf[_0xc499('0x30')]=_[_0xc499('0x31')](_0x4706bf[_0xc499('0x2c')],_0x4706bf[_0xc499('0x2e')]);_0x1d032d['attributes']=_[_0xc499('0x31')](_0x4706bf[_0xc499('0x2c')],qs[_0xc499('0x33')](_0x54c670['query']['fields']));_0x1d032d[_0xc499('0x32')]=_0x1d032d[_0xc499('0x32')][_0xc499('0x34')]?_0x1d032d[_0xc499('0x32')]:_0x4706bf[_0xc499('0x2c')];if(_0x54c670[_0xc499('0x2e')]['includeAll']){_0x1d032d['include']=[{'all':!![]}];}_0x1d032d=_[_0xc499('0x3c')]({},_0x1d032d,_0x54c670[_0xc499('0x3f')]);return db[_0xc499('0x40')][_0xc499('0x47')](_0x1d032d)[_0xc499('0x24')](handleEntityNotFound(_0x2a2819,null))['then'](respondWithResult(_0x2a2819,null))[_0xc499('0x48')](handleError(_0x2a2819,null));};exports[_0xc499('0x49')]=function(_0xf5e44f,_0x3163e8){return db[_0xc499('0x40')][_0xc499('0x49')](_0xf5e44f['body'],{})[_0xc499('0x24')](respondWithResult(_0x3163e8,0xc9))['catch'](handleError(_0x3163e8,null));};exports['update']=function(_0x2b1e05,_0x530e54){if(_0x2b1e05[_0xc499('0x4a')]['id']){delete _0x2b1e05[_0xc499('0x4a')]['id'];}return db[_0xc499('0x40')]['find']({'where':{'id':_0x2b1e05['params']['id']}})['then'](handleEntityNotFound(_0x530e54,null))[_0xc499('0x24')](saveUpdates(_0x2b1e05[_0xc499('0x4a')],null))[_0xc499('0x24')](respondWithResult(_0x530e54,null))[_0xc499('0x48')](handleError(_0x530e54,null));};exports[_0xc499('0x25')]=function(_0x489f8b,_0x508e7f){return db[_0xc499('0x40')][_0xc499('0x47')]({'where':{'id':_0x489f8b['params']['id']}})[_0xc499('0x24')](handleEntityNotFound(_0x508e7f,null))[_0xc499('0x24')](removeEntity(_0x508e7f,null))[_0xc499('0x48')](handleError(_0x508e7f,null));}; \ No newline at end of file +var _0xb0c6=['end','json','offset','undefined','limit','count','set','reject','then','destroy','error','stack','name','send','index','map','VoiceQueuesLog','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','create','body','update','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status'];(function(_0x2c7c15,_0x1248b6){var _0x22682e=function(_0x4ff2aa){while(--_0x4ff2aa){_0x2c7c15['push'](_0x2c7c15['shift']());}};_0x22682e(++_0x1248b6);}(_0xb0c6,0x1b7));var _0x6b0c=function(_0x5bb5b3,_0x576761){_0x5bb5b3=_0x5bb5b3-0x0;var _0x2435fc=_0xb0c6[_0x5bb5b3];return _0x2435fc;};'use strict';var emlformat=require(_0x6b0c('0x0'));var rimraf=require(_0x6b0c('0x1'));var zipdir=require(_0x6b0c('0x2'));var jsonpatch=require(_0x6b0c('0x3'));var rp=require(_0x6b0c('0x4'));var moment=require(_0x6b0c('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x6b0c('0x6'));var util=require('util');var path=require(_0x6b0c('0x7'));var sox=require(_0x6b0c('0x8'));var csv=require(_0x6b0c('0x9'));var ejs=require(_0x6b0c('0xa'));var fs=require('fs');var fs_extra=require(_0x6b0c('0xb'));var _=require(_0x6b0c('0xc'));var squel=require('squel');var crypto=require(_0x6b0c('0xd'));var jsforce=require(_0x6b0c('0xe'));var deskjs=require(_0x6b0c('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x6b0c('0x10'));var Redis=require(_0x6b0c('0x11'));var authService=require(_0x6b0c('0x12'));var qs=require(_0x6b0c('0x13'));var as=require(_0x6b0c('0x14'));var hardwareService=require(_0x6b0c('0x15'));var logger=require(_0x6b0c('0x16'))('api');var utils=require(_0x6b0c('0x17'));var config=require(_0x6b0c('0x18'));var licenseUtil=require(_0x6b0c('0x19'));var db=require(_0x6b0c('0x1a'))['db'];function respondWithStatusCode(_0xe5efd,_0x1cb1de){_0x1cb1de=_0x1cb1de||0xcc;return function(_0x3ec49a){if(_0x3ec49a){return _0xe5efd[_0x6b0c('0x1b')](_0x1cb1de);}return _0xe5efd[_0x6b0c('0x1c')](_0x1cb1de)[_0x6b0c('0x1d')]();};}function respondWithResult(_0x5e72b5,_0x416604){_0x416604=_0x416604||0xc8;return function(_0x49c888){if(_0x49c888){return _0x5e72b5[_0x6b0c('0x1c')](_0x416604)[_0x6b0c('0x1e')](_0x49c888);}};}function respondWithFilteredResult(_0x4b8834,_0x1820e7){return function(_0x560e50){if(_0x560e50){var _0x490e6c=typeof _0x1820e7[_0x6b0c('0x1f')]===_0x6b0c('0x20')&&typeof _0x1820e7[_0x6b0c('0x21')]===_0x6b0c('0x20');var _0x7bdf96=_0x560e50[_0x6b0c('0x22')];var _0x21d4d5=_0x490e6c?0x0:_0x1820e7[_0x6b0c('0x1f')];var _0x1834db=_0x490e6c?_0x560e50['count']:_0x1820e7[_0x6b0c('0x1f')]+_0x1820e7[_0x6b0c('0x21')];var _0x7b0d9;if(_0x1834db>=_0x7bdf96){_0x1834db=_0x7bdf96;_0x7b0d9=0xc8;}else{_0x7b0d9=0xce;}_0x4b8834[_0x6b0c('0x1c')](_0x7b0d9);return _0x4b8834[_0x6b0c('0x23')]('Content-Range',_0x21d4d5+'-'+_0x1834db+'/'+_0x7bdf96)[_0x6b0c('0x1e')](_0x560e50);}return null;};}function patchUpdates(_0x301656){return function(_0x2d8ef){try{jsonpatch['apply'](_0x2d8ef,_0x301656,!![]);}catch(_0x2eb5f2){return BPromise[_0x6b0c('0x24')](_0x2eb5f2);}return _0x2d8ef['save']();};}function saveUpdates(_0x3d2f07,_0x1a2d00){return function(_0x2d3883){if(_0x2d3883){return _0x2d3883['update'](_0x3d2f07)[_0x6b0c('0x25')](function(_0x3b6963){return _0x3b6963;});}return null;};}function removeEntity(_0x504d32,_0x13b211){return function(_0x3f4f29){if(_0x3f4f29){return _0x3f4f29[_0x6b0c('0x26')]()['then'](function(){_0x504d32['status'](0xcc)[_0x6b0c('0x1d')]();});}};}function handleEntityNotFound(_0x454f73,_0x4a4ef7){return function(_0xe451e3){if(!_0xe451e3){_0x454f73[_0x6b0c('0x1b')](0x194);}return _0xe451e3;};}function handleError(_0x31a55b,_0x20e7c9){_0x20e7c9=_0x20e7c9||0x1f4;return function(_0x5ad6b6){logger[_0x6b0c('0x27')](_0x5ad6b6[_0x6b0c('0x28')]);if(_0x5ad6b6[_0x6b0c('0x29')]){delete _0x5ad6b6[_0x6b0c('0x29')];}_0x31a55b[_0x6b0c('0x1c')](_0x20e7c9)[_0x6b0c('0x2a')](_0x5ad6b6);};}exports[_0x6b0c('0x2b')]=function(_0x31fcd0,_0x3a5a4a){var _0x338082={},_0x3345d7={},_0x3ef758={'count':0x0,'rows':[]};var _0x43b0bb=_[_0x6b0c('0x2c')](db[_0x6b0c('0x2d')]['rawAttributes'],function(_0x1329d4){return{'name':_0x1329d4[_0x6b0c('0x2e')],'type':_0x1329d4[_0x6b0c('0x2f')][_0x6b0c('0x30')]};});_0x3345d7[_0x6b0c('0x31')]=_[_0x6b0c('0x2c')](_0x43b0bb,_0x6b0c('0x29'));_0x3345d7[_0x6b0c('0x32')]=_[_0x6b0c('0x33')](_0x31fcd0[_0x6b0c('0x32')]);_0x3345d7[_0x6b0c('0x34')]=_[_0x6b0c('0x35')](_0x3345d7[_0x6b0c('0x31')],_0x3345d7[_0x6b0c('0x32')]);_0x338082[_0x6b0c('0x36')]=_[_0x6b0c('0x35')](_0x3345d7[_0x6b0c('0x31')],qs[_0x6b0c('0x37')](_0x31fcd0['query'][_0x6b0c('0x37')]));_0x338082[_0x6b0c('0x36')]=_0x338082[_0x6b0c('0x36')][_0x6b0c('0x38')]?_0x338082['attributes']:_0x3345d7[_0x6b0c('0x31')];if(!_0x31fcd0['query']['hasOwnProperty'](_0x6b0c('0x39'))){_0x338082[_0x6b0c('0x21')]=qs[_0x6b0c('0x21')](_0x31fcd0[_0x6b0c('0x32')][_0x6b0c('0x21')]);_0x338082['offset']=qs[_0x6b0c('0x1f')](_0x31fcd0[_0x6b0c('0x32')]['offset']);}_0x338082[_0x6b0c('0x3a')]=qs[_0x6b0c('0x3b')](_0x31fcd0[_0x6b0c('0x32')]['sort']);_0x338082[_0x6b0c('0x3c')]=qs[_0x6b0c('0x34')](_[_0x6b0c('0x3d')](_0x31fcd0['query'],_0x3345d7[_0x6b0c('0x34')]),_0x43b0bb);if(_0x31fcd0[_0x6b0c('0x32')][_0x6b0c('0x3e')]){_0x338082['where']=_['merge'](_0x338082[_0x6b0c('0x3c')],{'$or':_['map'](_0x43b0bb,function(_0x130059){if(_0x130059[_0x6b0c('0x2f')]!==_0x6b0c('0x3f')){var _0x21c6a0={};_0x21c6a0[_0x130059[_0x6b0c('0x29')]]={'$like':'%'+_0x31fcd0[_0x6b0c('0x32')][_0x6b0c('0x3e')]+'%'};return _0x21c6a0;}})});}_0x338082=_[_0x6b0c('0x40')]({},_0x338082,_0x31fcd0[_0x6b0c('0x41')]);var _0x1b329b={'where':_0x338082[_0x6b0c('0x3c')]};return db[_0x6b0c('0x2d')][_0x6b0c('0x22')](_0x1b329b)[_0x6b0c('0x25')](function(_0x1f56f8){_0x3ef758['count']=_0x1f56f8;if(_0x31fcd0['query'][_0x6b0c('0x42')]){_0x338082[_0x6b0c('0x43')]=[{'all':!![]}];}return db['VoiceQueuesLog'][_0x6b0c('0x44')](_0x338082);})['then'](function(_0x331db4){_0x3ef758[_0x6b0c('0x45')]=_0x331db4;return _0x3ef758;})[_0x6b0c('0x25')](respondWithFilteredResult(_0x3a5a4a,_0x338082))[_0x6b0c('0x46')](handleError(_0x3a5a4a,null));};exports[_0x6b0c('0x47')]=function(_0x283d45,_0x584a21){var _0x56f7fb={'raw':!![],'where':{'id':_0x283d45[_0x6b0c('0x48')]['id']}},_0x5ae0a0={};_0x5ae0a0['model']=_[_0x6b0c('0x33')](db['VoiceQueuesLog'][_0x6b0c('0x49')]);_0x5ae0a0['query']=_[_0x6b0c('0x33')](_0x283d45[_0x6b0c('0x32')]);_0x5ae0a0[_0x6b0c('0x34')]=_[_0x6b0c('0x35')](_0x5ae0a0[_0x6b0c('0x31')],_0x5ae0a0[_0x6b0c('0x32')]);_0x56f7fb['attributes']=_[_0x6b0c('0x35')](_0x5ae0a0[_0x6b0c('0x31')],qs['fields'](_0x283d45[_0x6b0c('0x32')][_0x6b0c('0x37')]));_0x56f7fb['attributes']=_0x56f7fb[_0x6b0c('0x36')][_0x6b0c('0x38')]?_0x56f7fb[_0x6b0c('0x36')]:_0x5ae0a0['model'];if(_0x283d45[_0x6b0c('0x32')][_0x6b0c('0x42')]){_0x56f7fb[_0x6b0c('0x43')]=[{'all':!![]}];}_0x56f7fb=_[_0x6b0c('0x40')]({},_0x56f7fb,_0x283d45[_0x6b0c('0x41')]);return db['VoiceQueuesLog'][_0x6b0c('0x4a')](_0x56f7fb)[_0x6b0c('0x25')](handleEntityNotFound(_0x584a21,null))['then'](respondWithResult(_0x584a21,null))[_0x6b0c('0x46')](handleError(_0x584a21,null));};exports[_0x6b0c('0x4b')]=function(_0x4aa5ec,_0x49ac56){return db[_0x6b0c('0x2d')]['create'](_0x4aa5ec[_0x6b0c('0x4c')],{})['then'](respondWithResult(_0x49ac56,0xc9))[_0x6b0c('0x46')](handleError(_0x49ac56,null));};exports[_0x6b0c('0x4d')]=function(_0x3e05c5,_0x139768){if(_0x3e05c5['body']['id']){delete _0x3e05c5[_0x6b0c('0x4c')]['id'];}return db[_0x6b0c('0x2d')][_0x6b0c('0x4a')]({'where':{'id':_0x3e05c5[_0x6b0c('0x48')]['id']}})['then'](handleEntityNotFound(_0x139768,null))['then'](saveUpdates(_0x3e05c5['body'],null))[_0x6b0c('0x25')](respondWithResult(_0x139768,null))[_0x6b0c('0x46')](handleError(_0x139768,null));};exports['destroy']=function(_0x305319,_0x3a4d37){return db[_0x6b0c('0x2d')][_0x6b0c('0x4a')]({'where':{'id':_0x305319[_0x6b0c('0x48')]['id']}})[_0x6b0c('0x25')](handleEntityNotFound(_0x3a4d37,null))['then'](removeEntity(_0x3a4d37,null))[_0x6b0c('0x46')](handleError(_0x3a4d37,null));}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.model.js b/server/api/voiceQueuesLog/voiceQueuesLog.model.js index 8895b8d..36dbc49 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 _0x74eb=['define','voice_queues_log','dtm','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x74eb,0x13b));var _0xb74e=function(_0x3b8ef5,_0x5e33bc){_0x3b8ef5=_0x3b8ef5-0x0;var _0x58c8a4=_0x74eb[_0x3b8ef5];return _0x58c8a4;};'use strict';var _=require(_0xb74e('0x0'));var util=require(_0xb74e('0x1'));var logger=require(_0xb74e('0x2'))('api');var moment=require(_0xb74e('0x3'));var BPromise=require(_0xb74e('0x4'));var rp=require(_0xb74e('0x5'));var fs=require('fs');var path=require(_0xb74e('0x6'));var rimraf=require(_0xb74e('0x7'));var config=require(_0xb74e('0x8'));var attributes=require('./voiceQueuesLog.attributes');module[_0xb74e('0x9')]=function(_0x4f49f9,_0x329dc1){return _0x4f49f9[_0xb74e('0xa')]('VoiceQueuesLog',attributes,{'tableName':_0xb74e('0xb'),'paranoid':![],'indexes':[{'name':'event_dtm','fields':['event',_0xb74e('0xc')]}],'timestamps':![]});}; \ No newline at end of file +var _0xe10b=['request-promise','path','rimraf','../../config/environment','./voiceQueuesLog.attributes','exports','voice_queues_log','event_dtm','../../config/logger','api','moment','bluebird'];(function(_0x46f3bd,_0x58ed30){var _0x364a73=function(_0x259f5a){while(--_0x259f5a){_0x46f3bd['push'](_0x46f3bd['shift']());}};_0x364a73(++_0x58ed30);}(_0xe10b,0x98));var _0xbe10=function(_0x3e3b32,_0x2c8501){_0x3e3b32=_0x3e3b32-0x0;var _0x28f618=_0xe10b[_0x3e3b32];return _0x28f618;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xbe10('0x0'))(_0xbe10('0x1'));var moment=require(_0xbe10('0x2'));var BPromise=require(_0xbe10('0x3'));var rp=require(_0xbe10('0x4'));var fs=require('fs');var path=require(_0xbe10('0x5'));var rimraf=require(_0xbe10('0x6'));var config=require(_0xbe10('0x7'));var attributes=require(_0xbe10('0x8'));module[_0xbe10('0x9')]=function(_0x23abaf,_0x17c9e8){return _0x23abaf['define']('VoiceQueuesLog',attributes,{'tableName':_0xbe10('0xa'),'paranoid':![],'indexes':[{'name':_0xbe10('0xb'),'fields':['event','dtm']}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js b/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js index 5f9bee0..73e9400 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 _0x9809=['rpc','../../config/environment','client','http','then','info','VoiceQueuesLog,\x20%s,\x20%s','request\x20sent','debug','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','stringify','error','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x4c39a2,_0x35a3c6){var _0x239c75=function(_0x425244){while(--_0x425244){_0x4c39a2['push'](_0x4c39a2['shift']());}};_0x239c75(++_0x35a3c6);}(_0x9809,0x1da));var _0x9980=function(_0x1bb988,_0x31a848){_0x1bb988=_0x1bb988-0x0;var _0xf26408=_0x9809[_0x1bb988];return _0xf26408;};'use strict';var _=require(_0x9980('0x0'));var util=require(_0x9980('0x1'));var moment=require(_0x9980('0x2'));var BPromise=require(_0x9980('0x3'));var rs=require(_0x9980('0x4'));var fs=require('fs');var Redis=require(_0x9980('0x5'));var db=require(_0x9980('0x6'))['db'];var utils=require(_0x9980('0x7'));var logger=require(_0x9980('0x8'))(_0x9980('0x9'));var config=require(_0x9980('0xa'));var jayson=require('jayson/promise');var client=jayson[_0x9980('0xb')][_0x9980('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x55914b,_0x3e150d,_0x483a59){return new BPromise(function(_0x283d1f,_0x333a73){return client['request'](_0x55914b,_0x483a59)[_0x9980('0xd')](function(_0x2553c0){logger[_0x9980('0xe')](_0x9980('0xf'),_0x3e150d,_0x9980('0x10'));logger[_0x9980('0x11')](_0x9980('0x12'),_0x3e150d,_0x9980('0x10'),JSON[_0x9980('0x13')](_0x2553c0));if(_0x2553c0[_0x9980('0x14')]){if(_0x2553c0[_0x9980('0x14')]['code']===0x1f4){logger[_0x9980('0x14')](_0x9980('0xf'),_0x3e150d,_0x2553c0[_0x9980('0x14')]['message']);return _0x333a73(_0x2553c0[_0x9980('0x14')][_0x9980('0x15')]);}logger[_0x9980('0x14')](_0x9980('0xf'),_0x3e150d,_0x2553c0[_0x9980('0x14')][_0x9980('0x15')]);return _0x283d1f(_0x2553c0['error']['message']);}else{logger[_0x9980('0xe')](_0x9980('0xf'),_0x3e150d,_0x9980('0x10'));_0x283d1f(_0x2553c0[_0x9980('0x16')][_0x9980('0x15')]);}})['catch'](function(_0x275288){logger['error'](_0x9980('0xf'),_0x3e150d,_0x275288);_0x333a73(_0x275288);});});} \ No newline at end of file +var _0x98dc=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','request','info','VoiceQueuesLog,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','catch','lodash','util','moment','bluebird'];(function(_0x36403c,_0x1888c7){var _0x4299b7=function(_0x467666){while(--_0x467666){_0x36403c['push'](_0x36403c['shift']());}};_0x4299b7(++_0x1888c7);}(_0x98dc,0x18c));var _0xc98d=function(_0x3ba0f7,_0x308749){_0x3ba0f7=_0x3ba0f7-0x0;var _0x21c874=_0x98dc[_0x3ba0f7];return _0x21c874;};'use strict';var _=require(_0xc98d('0x0'));var util=require(_0xc98d('0x1'));var moment=require(_0xc98d('0x2'));var BPromise=require(_0xc98d('0x3'));var rs=require(_0xc98d('0x4'));var fs=require('fs');var Redis=require(_0xc98d('0x5'));var db=require(_0xc98d('0x6'))['db'];var utils=require(_0xc98d('0x7'));var logger=require(_0xc98d('0x8'))('rpc');var config=require(_0xc98d('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0xc98d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x40b93a,_0x999b29,_0x40fe3){return new BPromise(function(_0x3f4488,_0x5058d6){return client[_0xc98d('0xb')](_0x40b93a,_0x40fe3)['then'](function(_0x4df8f4){logger[_0xc98d('0xc')](_0xc98d('0xd'),_0x999b29,_0xc98d('0xe'));logger[_0xc98d('0xf')]('VoiceQueuesLog,\x20%s,\x20%s,\x20%s',_0x999b29,_0xc98d('0xe'),JSON[_0xc98d('0x10')](_0x4df8f4));if(_0x4df8f4[_0xc98d('0x11')]){if(_0x4df8f4[_0xc98d('0x11')]['code']===0x1f4){logger[_0xc98d('0x11')](_0xc98d('0xd'),_0x999b29,_0x4df8f4['error'][_0xc98d('0x12')]);return _0x5058d6(_0x4df8f4[_0xc98d('0x11')][_0xc98d('0x12')]);}logger[_0xc98d('0x11')](_0xc98d('0xd'),_0x999b29,_0x4df8f4['error'][_0xc98d('0x12')]);return _0x3f4488(_0x4df8f4[_0xc98d('0x11')][_0xc98d('0x12')]);}else{logger['info'](_0xc98d('0xd'),_0x999b29,_0xc98d('0xe'));_0x3f4488(_0x4df8f4['result']['message']);}})[_0xc98d('0x13')](function(_0x36310a){logger['error']('VoiceQueuesLog,\x20%s,\x20%s',_0x999b29,_0x36310a);_0x5058d6(_0x36310a);});});} \ No newline at end of file diff --git a/server/api/voiceRecording/index.js b/server/api/voiceRecording/index.js index 3bdfb77..00a14a7 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 _0x398b=['../../components/auth/service','./voiceRecording.controller','isAuthenticated','get','/describe','describe','/:id','show','/:id/downloads','downloads','/:id/transcribe','post','create','runTranscribe','put','update','delete','destroy','exports','multer','connect-timeout','express','Router','fs-extra'];(function(_0x29dcbf,_0xc02d3e){var _0x27b4b2=function(_0x8ce51c){while(--_0x8ce51c){_0x29dcbf['push'](_0x29dcbf['shift']());}};_0x27b4b2(++_0xc02d3e);}(_0x398b,0x193));var _0xb398=function(_0x8fb035,_0x217b6d){_0x8fb035=_0x8fb035-0x0;var _0x3a678d=_0x398b[_0x8fb035];return _0x3a678d;};'use strict';var multer=require(_0xb398('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xb398('0x1'));var express=require(_0xb398('0x2'));var router=express[_0xb398('0x3')]();var fs_extra=require(_0xb398('0x4'));var auth=require(_0xb398('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xb398('0x6'));router['get']('/',auth[_0xb398('0x7')](),controller['index']);router[_0xb398('0x8')](_0xb398('0x9'),auth[_0xb398('0x7')](),controller[_0xb398('0xa')]);router['get'](_0xb398('0xb'),auth[_0xb398('0x7')](),controller[_0xb398('0xc')]);router[_0xb398('0x8')]('/:id/download',auth[_0xb398('0x7')](),controller['download']);router[_0xb398('0x8')](_0xb398('0xd'),controller[_0xb398('0xe')]);router[_0xb398('0x8')](_0xb398('0xf'),auth[_0xb398('0x7')](),controller['downloadTranscribe']);router[_0xb398('0x10')]('/',auth[_0xb398('0x7')](),controller[_0xb398('0x11')]);router[_0xb398('0x10')](_0xb398('0xf'),auth[_0xb398('0x7')](),controller[_0xb398('0x12')]);router[_0xb398('0x13')](_0xb398('0xb'),auth[_0xb398('0x7')](),controller[_0xb398('0x14')]);router[_0xb398('0x15')]('/:id',auth[_0xb398('0x7')](),controller[_0xb398('0x16')]);module[_0xb398('0x17')]=router; \ No newline at end of file +var _0x29e3=['runTranscribe','put','update','delete','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','get','index','isAuthenticated','describe','/:id','show','/:id/download','download','/:id/downloads','/:id/transcribe','downloadTranscribe','post','create'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x29e3,0xcd));var _0x329e=function(_0xdb7b7e,_0x64c490){_0xdb7b7e=_0xdb7b7e-0x0;var _0x3b9e10=_0x29e3[_0xdb7b7e];return _0x3b9e10;};'use strict';var multer=require(_0x329e('0x0'));var util=require('util');var path=require(_0x329e('0x1'));var timeout=require(_0x329e('0x2'));var express=require(_0x329e('0x3'));var router=express['Router']();var fs_extra=require(_0x329e('0x4'));var auth=require(_0x329e('0x5'));var interaction=require(_0x329e('0x6'));var config=require('../../config/environment');var controller=require('./voiceRecording.controller');router[_0x329e('0x7')]('/',auth['isAuthenticated'](),controller[_0x329e('0x8')]);router[_0x329e('0x7')]('/describe',auth[_0x329e('0x9')](),controller[_0x329e('0xa')]);router[_0x329e('0x7')](_0x329e('0xb'),auth[_0x329e('0x9')](),controller[_0x329e('0xc')]);router['get'](_0x329e('0xd'),auth[_0x329e('0x9')](),controller[_0x329e('0xe')]);router[_0x329e('0x7')](_0x329e('0xf'),controller['downloads']);router['get'](_0x329e('0x10'),auth[_0x329e('0x9')](),controller[_0x329e('0x11')]);router[_0x329e('0x12')]('/',auth[_0x329e('0x9')](),controller[_0x329e('0x13')]);router[_0x329e('0x12')]('/:id/transcribe',auth[_0x329e('0x9')](),controller[_0x329e('0x14')]);router[_0x329e('0x15')](_0x329e('0xb'),auth[_0x329e('0x9')](),controller[_0x329e('0x16')]);router[_0x329e('0x17')]('/:id',auth[_0x329e('0x9')](),controller['destroy']);module[_0x329e('0x18')]=router; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.attributes.js b/server/api/voiceRecording/voiceRecording.attributes.js index 9d64a36..5ac2157 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(_0x487b0c,_0x14ff74){var _0x1adbdc=function(_0x2e7b9d){while(--_0x2e7b9d){_0x487b0c['push'](_0x487b0c['shift']());}};_0x1adbdc(++_0x14ff74);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3b5250,_0x7a0b2c){_0x3b5250=_0x3b5250-0x0;var _0xc844a1=_0xa9e0[_0x3b5250];return _0xc844a1;};'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(_0x1f9f37,_0x18776e){var _0x21c080=function(_0x4acb93){while(--_0x4acb93){_0x1f9f37['push'](_0x1f9f37['shift']());}};_0x21c080(++_0x18776e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x34bc30,_0x177cb0){_0x34bc30=_0x34bc30-0x0;var _0x5706de=_0xa9e0[_0x34bc30];return _0x5706de;};'use strict';var Sequelize=require(_0x0a9e('0x0'));var moment=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));module['exports']={'format':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x0a9e('0x3')]('value')?path[_0x0a9e('0x4')](this[_0x0a9e('0x3')](_0x0a9e('0x5'))):undefined;}},'uniqueid':{'type':Sequelize[_0x0a9e('0x6')]},'channel':{'type':Sequelize[_0x0a9e('0x6')],'set':function(_0x57b080){if(_0x57b080){this[_0x0a9e('0x7')](_0x0a9e('0x8'),_0x57b080);this[_0x0a9e('0x7')]('membername',_0x57b080['split'](/\/|-/)[0x1]);}}},'membername':{'type':Sequelize[_0x0a9e('0x6')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0x0a9e('0x6')]},'connectedlinename':{'type':Sequelize[_0x0a9e('0x6')]},'accountcode':{'type':Sequelize[_0x0a9e('0x6')]},'context':{'type':Sequelize[_0x0a9e('0x6')]},'exten':{'type':Sequelize[_0x0a9e('0x6')]},'value':{'type':Sequelize[_0x0a9e('0x6')]},'type':{'type':Sequelize['STRING']},'rating':{'type':Sequelize['INTEGER'],'validate':{'max':0x5,'min':0x0}},'queue':{'type':Sequelize['STRING']},'userDisposition':{'type':Sequelize['STRING']},'userSecondDisposition':{'type':Sequelize[_0x0a9e('0x6')]},'userThirdDisposition':{'type':Sequelize[_0x0a9e('0x6')]},'location':{'type':Sequelize[_0x0a9e('0x9')]},'transcribeName':{'type':Sequelize[_0x0a9e('0x6')]},'transcribeStatus':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':_0x0a9e('0xa')},'fileUri':{'type':Sequelize['TEXT']},'fileText':{'type':Sequelize[_0x0a9e('0x9')]},'failureReason':{'type':Sequelize[_0x0a9e('0x9')]},'sentiment':{'type':Sequelize[_0x0a9e('0x6')]},'sPositive':{'type':Sequelize[_0x0a9e('0xb')]},'sNegative':{'type':Sequelize[_0x0a9e('0xb')]},'sNeutral':{'type':Sequelize[_0x0a9e('0xb')]},'sMixed':{'type':Sequelize['FLOAT']},'tempSentiment':{'type':Sequelize[_0x0a9e('0xc')],'defaultValue':![]},'createdAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0x0a9e('0x3')]('createdAt'))[_0x0a9e('0xd')](_0x0a9e('0xe'))['toString']();}},'updatedAt':{'type':Sequelize[_0x0a9e('0xf')],'get':function(){return moment(this['getDataValue'](_0x0a9e('0x10')))[_0x0a9e('0xd')](_0x0a9e('0xe'))[_0x0a9e('0x11')]();}}}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.controller.js b/server/api/voiceRecording/voiceRecording.controller.js index 0c72a30..9d3d938 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 _0xf8f3=['sentiment','sentimentAccountId','sentimentRegion','Sentiment\x20Analysis\x20not\x20configured','CloudProvider','data1','Cloud\x20Provider\x20not\x20configured','data2','Buckets','Name','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','IN_PROGRESS','tempSentiment','runSentiment','updateAttributes','writeFile','downloadTranscribe','fileText','root','.txt','Transcript\x20not\x20available','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','papaparse','uuid/v4','ioredis','../../components/auth/service','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','end','stack','name','send','index','map','rawAttributes','type','key','model','differenceBy','format','keys','intersection','fields','attributes','length','query','hasOwnProperty','nolimit','sort','where','filters','filter','VIRTUAL','merge','options','includeAll','include','VoiceRecording','findAll','rows','catch','show','params','create','body','find','describe','download','../../components/encryptor','uniqueid','value','%s.cypher','existsSync','decryptFile','secrets','recording','Sequelize','ValidationError','VoiceRecording\x20not\x20found','filename','unlink','message','col','$and','push','extname','isNil','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','.cypher','unlinkSync','listBuckets','createBucket','upload','[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s','basename','readFileSync','bucket','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','Location','TranscriptionJob','transcribeName','TranscriptionJobName','transcribeStatus','TranscriptionJobStatus','runTranscribe','findOne','Setting','transcribe','transcribeAccountId','transcribeRegion','language','Transcribe\x20not\x20configured'];(function(_0x531d51,_0x5be6ee){var _0x1af42=function(_0x3c43aa){while(--_0x3c43aa){_0x531d51['push'](_0x531d51['shift']());}};_0x1af42(++_0x5be6ee);}(_0xf8f3,0x13d));var _0x3f8f=function(_0x1be609,_0x816854){_0x1be609=_0x1be609-0x0;var _0x4a6b27=_0xf8f3[_0x1be609];return _0x4a6b27;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3f8f('0x0'));var zipdir=require(_0x3f8f('0x1'));var jsonpatch=require(_0x3f8f('0x2'));var rp=require(_0x3f8f('0x3'));var moment=require(_0x3f8f('0x4'));var BPromise=require(_0x3f8f('0x5'));var Mustache=require(_0x3f8f('0x6'));var util=require('util');var path=require(_0x3f8f('0x7'));var sox=require(_0x3f8f('0x8'));var csv=require(_0x3f8f('0x9'));var ejs=require(_0x3f8f('0xa'));var fs=require('fs');var fs_extra=require(_0x3f8f('0xb'));var _=require(_0x3f8f('0xc'));var squel=require('squel');var crypto=require(_0x3f8f('0xd'));var jsforce=require(_0x3f8f('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x3f8f('0x9'));var querystring=require(_0x3f8f('0xf'));var Papa=require(_0x3f8f('0x10'));var AWS=require('aws-sdk');var uuidv4=require(_0x3f8f('0x11'));var Redis=require(_0x3f8f('0x12'));var authService=require(_0x3f8f('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x3f8f('0x14'));var utils=require(_0x3f8f('0x15'));var config=require(_0x3f8f('0x16'));var licenseUtil=require(_0x3f8f('0x17'));var db=require(_0x3f8f('0x18'))['db'];function respondWithStatusCode(_0x2d43f6,_0x56e026){_0x56e026=_0x56e026||0xcc;return function(_0x30fcad){if(_0x30fcad){return _0x2d43f6[_0x3f8f('0x19')](_0x56e026);}return _0x2d43f6['status'](_0x56e026)['end']();};}function respondWithResult(_0x255d18,_0x4e0847){_0x4e0847=_0x4e0847||0xc8;return function(_0x2dab4d){if(_0x2dab4d){return _0x255d18[_0x3f8f('0x1a')](_0x4e0847)[_0x3f8f('0x1b')](_0x2dab4d);}};}function respondWithFilteredResult(_0xb55000,_0x45afc0){return function(_0x215314){if(_0x215314){var _0x36e70f=typeof _0x45afc0[_0x3f8f('0x1c')]===_0x3f8f('0x1d')&&typeof _0x45afc0[_0x3f8f('0x1e')]===_0x3f8f('0x1d');var _0x30886b=_0x215314['count'];var _0x220d24=_0x36e70f?0x0:_0x45afc0[_0x3f8f('0x1c')];var _0x43dfac=_0x36e70f?_0x215314[_0x3f8f('0x1f')]:_0x45afc0[_0x3f8f('0x1c')]+_0x45afc0[_0x3f8f('0x1e')];var _0x126180;if(_0x43dfac>=_0x30886b){_0x43dfac=_0x30886b;_0x126180=0xc8;}else{_0x126180=0xce;}_0xb55000[_0x3f8f('0x1a')](_0x126180);return _0xb55000['set'](_0x3f8f('0x20'),_0x220d24+'-'+_0x43dfac+'/'+_0x30886b)['json'](_0x215314);}return null;};}function patchUpdates(_0x459af5){return function(_0x56ed3a){try{jsonpatch[_0x3f8f('0x21')](_0x56ed3a,_0x459af5,!![]);}catch(_0x1737bf){return BPromise[_0x3f8f('0x22')](_0x1737bf);}return _0x56ed3a[_0x3f8f('0x23')]();};}function saveUpdates(_0x3011bf,_0x579c16){return function(_0x2cd72b){if(_0x2cd72b){return _0x2cd72b[_0x3f8f('0x24')](_0x3011bf)[_0x3f8f('0x25')](function(_0x5dd663){return _0x5dd663;});}return null;};}function removeEntity(_0x5587e3,_0x3a8295){return function(_0x2e40a3){if(_0x2e40a3){return _0x2e40a3[_0x3f8f('0x26')]()[_0x3f8f('0x25')](function(){_0x5587e3['status'](0xcc)[_0x3f8f('0x27')]();});}};}function handleEntityNotFound(_0x3485e4,_0x32342c){return function(_0x3dd7c2){if(!_0x3dd7c2){_0x3485e4[_0x3f8f('0x19')](0x194);}return _0x3dd7c2;};}function handleError(_0x354e0c,_0x533ada){_0x533ada=_0x533ada||0x1f4;return function(_0x145157){logger['error'](_0x145157[_0x3f8f('0x28')]);if(_0x145157[_0x3f8f('0x29')]){delete _0x145157['name'];}_0x354e0c[_0x3f8f('0x1a')](_0x533ada)[_0x3f8f('0x2a')](_0x145157);};}exports[_0x3f8f('0x2b')]=function(_0x5e0ba0,_0x283011){var _0x17fcfe={},_0x40a01a={},_0x1b9a02={'count':0x0,'rows':[]};var _0x99eb1c=_[_0x3f8f('0x2c')](db['VoiceRecording'][_0x3f8f('0x2d')],function(_0x46a850){return{'name':_0x46a850['fieldName'],'type':_0x46a850[_0x3f8f('0x2e')][_0x3f8f('0x2f')]};});_0x40a01a[_0x3f8f('0x30')]=_[_0x3f8f('0x31')](_['map'](_0x99eb1c,_0x3f8f('0x29')),[_0x3f8f('0x32')]);_0x40a01a['query']=_[_0x3f8f('0x33')](_0x5e0ba0['query']);_0x40a01a['filters']=_[_0x3f8f('0x34')](_0x40a01a['model'],_0x40a01a['query']);_0x17fcfe['attributes']=_[_0x3f8f('0x34')](_0x40a01a[_0x3f8f('0x30')],qs[_0x3f8f('0x35')](_0x5e0ba0['query'][_0x3f8f('0x35')]));_0x17fcfe[_0x3f8f('0x36')]=_0x17fcfe['attributes'][_0x3f8f('0x37')]?_0x17fcfe[_0x3f8f('0x36')]:_0x40a01a[_0x3f8f('0x30')];if(!_0x5e0ba0[_0x3f8f('0x38')][_0x3f8f('0x39')](_0x3f8f('0x3a'))){_0x17fcfe[_0x3f8f('0x1e')]=qs['limit'](_0x5e0ba0[_0x3f8f('0x38')][_0x3f8f('0x1e')]);_0x17fcfe[_0x3f8f('0x1c')]=qs[_0x3f8f('0x1c')](_0x5e0ba0[_0x3f8f('0x38')][_0x3f8f('0x1c')]);}_0x17fcfe['order']=qs[_0x3f8f('0x3b')](_0x5e0ba0['query'][_0x3f8f('0x3b')]);_0x17fcfe[_0x3f8f('0x3c')]=qs[_0x3f8f('0x3d')](_['pick'](_0x5e0ba0[_0x3f8f('0x38')],_0x40a01a[_0x3f8f('0x3d')]),_0x99eb1c);if(_0x5e0ba0[_0x3f8f('0x38')][_0x3f8f('0x3e')]){_0x17fcfe[_0x3f8f('0x3c')]=_['merge'](_0x17fcfe['where'],{'$or':_[_0x3f8f('0x2c')](_0x99eb1c,function(_0x3371b7){if(_0x3371b7['type']!==_0x3f8f('0x3f')){var _0x212478={};_0x212478[_0x3371b7[_0x3f8f('0x29')]]={'$like':'%'+_0x5e0ba0['query'][_0x3f8f('0x3e')]+'%'};return _0x212478;}})});}_0x17fcfe=_[_0x3f8f('0x40')]({},_0x17fcfe,_0x5e0ba0[_0x3f8f('0x41')]);var _0x18a584={'where':_0x17fcfe[_0x3f8f('0x3c')]};return db['VoiceRecording'][_0x3f8f('0x1f')](_0x18a584)[_0x3f8f('0x25')](function(_0x491fca){_0x1b9a02[_0x3f8f('0x1f')]=_0x491fca;if(_0x5e0ba0[_0x3f8f('0x38')][_0x3f8f('0x42')]){_0x17fcfe[_0x3f8f('0x43')]=[{'all':!![]}];}return db[_0x3f8f('0x44')][_0x3f8f('0x45')](_0x17fcfe);})['then'](function(_0x238be7){_0x1b9a02[_0x3f8f('0x46')]=_0x238be7;return _0x1b9a02;})['then'](respondWithFilteredResult(_0x283011,_0x17fcfe))[_0x3f8f('0x47')](handleError(_0x283011,null));};exports[_0x3f8f('0x48')]=function(_0x5345e6,_0x57d464){var _0x26ce68={'raw':![],'where':{'id':_0x5345e6[_0x3f8f('0x49')]['id']}},_0x568dbe={};_0x568dbe[_0x3f8f('0x30')]=_[_0x3f8f('0x33')](db[_0x3f8f('0x44')]['rawAttributes']);_0x568dbe[_0x3f8f('0x38')]=_['keys'](_0x5345e6[_0x3f8f('0x38')]);_0x568dbe['filters']=_[_0x3f8f('0x34')](_0x568dbe[_0x3f8f('0x30')],_0x568dbe[_0x3f8f('0x38')]);_0x26ce68[_0x3f8f('0x36')]=_[_0x3f8f('0x34')](_0x568dbe[_0x3f8f('0x30')],qs[_0x3f8f('0x35')](_0x5345e6[_0x3f8f('0x38')][_0x3f8f('0x35')]));_0x26ce68[_0x3f8f('0x36')]=_0x26ce68['attributes'][_0x3f8f('0x37')]?_0x26ce68[_0x3f8f('0x36')]:_0x568dbe[_0x3f8f('0x30')];if(_0x5345e6[_0x3f8f('0x38')][_0x3f8f('0x42')]){_0x26ce68[_0x3f8f('0x43')]=[{'all':!![]}];}_0x26ce68=_['merge']({},_0x26ce68,_0x5345e6['options']);return db[_0x3f8f('0x44')]['find'](_0x26ce68)[_0x3f8f('0x25')](handleEntityNotFound(_0x57d464,null))['then'](respondWithResult(_0x57d464,null))[_0x3f8f('0x47')](handleError(_0x57d464,null));};exports[_0x3f8f('0x4a')]=function(_0xb551d,_0x56a2d7){return db[_0x3f8f('0x44')][_0x3f8f('0x4a')](_0xb551d[_0x3f8f('0x4b')],{})[_0x3f8f('0x25')](respondWithResult(_0x56a2d7,0xc9))[_0x3f8f('0x47')](handleError(_0x56a2d7,null));};exports[_0x3f8f('0x24')]=function(_0x182968,_0x10ac71){if(_0x182968[_0x3f8f('0x4b')]['id']){delete _0x182968[_0x3f8f('0x4b')]['id'];}return db['VoiceRecording'][_0x3f8f('0x4c')]({'where':{'id':_0x182968[_0x3f8f('0x49')]['id']}})['then'](handleEntityNotFound(_0x10ac71,null))[_0x3f8f('0x25')](saveUpdates(_0x182968[_0x3f8f('0x4b')],null))['then'](respondWithResult(_0x10ac71,null))[_0x3f8f('0x47')](handleError(_0x10ac71,null));};exports[_0x3f8f('0x4d')]=function(_0x31ccba,_0xb30aa8){return db[_0x3f8f('0x44')]['describe']()[_0x3f8f('0x25')](respondWithResult(_0xb30aa8,null))[_0x3f8f('0x47')](handleError(_0xb30aa8,null));};exports[_0x3f8f('0x4e')]=function(_0x394ea5,_0x3ebe2c,_0x4b38d0){var _0x2b60d3=require(_0x3f8f('0x4f'));var _0x347386=![];var _0x1b678a={};if(_0x394ea5[_0x3f8f('0x38')][_0x3f8f('0x2e')]&&_0x394ea5[_0x3f8f('0x38')][_0x3f8f('0x2e')]===_0x3f8f('0x50')){_0x1b678a[_0x3f8f('0x50')]=_0x394ea5[_0x3f8f('0x49')]['id'];}else{_0x1b678a['id']=_0x394ea5[_0x3f8f('0x49')]['id'];}return db['VoiceRecording'][_0x3f8f('0x4c')]({'where':_0x1b678a,'attributes':['id',_0x3f8f('0x51')],'raw':!![]})[_0x3f8f('0x25')](handleEntityNotFound(_0x3ebe2c,null))[_0x3f8f('0x25')](function(_0x23641f){if(_0x23641f){var _0xbacdff=_0x23641f[_0x3f8f('0x51')];var _0x206762=util['format'](_0x3f8f('0x52'),_0xbacdff);if(fs[_0x3f8f('0x53')](_0x206762)){_0x347386=!![];return _0x2b60d3[_0x3f8f('0x54')](_0x206762,_0xbacdff,config[_0x3f8f('0x55')][_0x3f8f('0x56')])[_0x3f8f('0x25')](function(){return _0x23641f;});}return _0x23641f;}})[_0x3f8f('0x25')](function(_0x32309e){if(_0x32309e){var _0x2cd949=_0x32309e['value'];if(!fs[_0x3f8f('0x53')](_0x2cd949)){throw new db[(_0x3f8f('0x57'))][(_0x3f8f('0x58'))](_0x3f8f('0x59'));}if(_0x32309e['filename']){return _0x3ebe2c[_0x3f8f('0x4e')](_0x2cd949,_0x32309e[_0x3f8f('0x5a')]+path['extname'](_0x2cd949),function(){if(_0x347386){fs[_0x3f8f('0x5b')](_0x2cd949);}});}else{return _0x3ebe2c[_0x3f8f('0x4e')](_0x2cd949,function(_0x1e9efd){if(_0x347386){fs['unlink'](_0x2cd949);}});}}})[_0x3f8f('0x47')](function(_0xcd89b5){if(_0xcd89b5[_0x3f8f('0x5c')]===_0x3f8f('0x59')){_0x3ebe2c[_0x3f8f('0x1a')](0x194)[_0x3f8f('0x2a')]('Not\x20found');}else{return handleError(_0x3ebe2c,null);}});};exports['downloads']=function(_0x1dc79a,_0x53b435,_0x597094){var _0x4262e4=require(_0x3f8f('0x4f'));var _0x54f189=![];var _0x38f92a={'$and':[db['sequelize']['where'](db['sequelize']['fn']('MD5',db['sequelize'][_0x3f8f('0x5d')]('uniqueid')),_0x1dc79a[_0x3f8f('0x38')]['token'])]};if(_0x1dc79a[_0x3f8f('0x38')][_0x3f8f('0x2e')]&&_0x1dc79a[_0x3f8f('0x38')][_0x3f8f('0x2e')]===_0x3f8f('0x50')){_0x38f92a[_0x3f8f('0x5e')][_0x3f8f('0x5f')]({'uniqueid':_0x1dc79a[_0x3f8f('0x49')]['id']});}else{_0x38f92a['$and'][_0x3f8f('0x5f')]({'id':_0x1dc79a[_0x3f8f('0x49')]['id']});}return db['VoiceRecording'][_0x3f8f('0x4c')]({'where':_0x38f92a,'attributes':['id',_0x3f8f('0x51')],'raw':!![]})[_0x3f8f('0x25')](handleEntityNotFound(_0x53b435,null))['then'](function(_0x5b98d4){if(_0x5b98d4){var _0x4e4f5a=util[_0x3f8f('0x32')](_0x3f8f('0x52'),_0x5b98d4[_0x3f8f('0x51')]);if(fs[_0x3f8f('0x53')](_0x4e4f5a)){_0x54f189=!![];return _0x4262e4[_0x3f8f('0x54')](_0x4e4f5a,_0x5b98d4['value'],config[_0x3f8f('0x55')]['recording'])[_0x3f8f('0x25')](function(){return _0x5b98d4;});}return _0x5b98d4;}})[_0x3f8f('0x25')](function(_0x3ba1bd){if(_0x3ba1bd){if(!fs['existsSync'](_0x3ba1bd[_0x3f8f('0x51')])){throw new db[(_0x3f8f('0x57'))]['ValidationError'](_0x3f8f('0x59'));}if(_0x3ba1bd[_0x3f8f('0x5a')]){return _0x53b435[_0x3f8f('0x4e')](_0x3ba1bd[_0x3f8f('0x51')],_0x3ba1bd['filename']+path[_0x3f8f('0x60')](_0x3ba1bd[_0x3f8f('0x51')]),function(){if(_0x54f189){fs[_0x3f8f('0x5b')](_0x3ba1bd[_0x3f8f('0x51')]);}});}else{return _0x53b435[_0x3f8f('0x4e')](_0x3ba1bd[_0x3f8f('0x51')],function(_0x1812a5){if(_0x54f189){fs[_0x3f8f('0x5b')](_0x3ba1bd[_0x3f8f('0x51')]);}});}}})['catch'](handleError(_0x53b435,null));};exports[_0x3f8f('0x26')]=function(_0x3b5bf2,_0xe34047){return db[_0x3f8f('0x44')][_0x3f8f('0x4c')]({'where':{'id':_0x3b5bf2['params']['id']}})[_0x3f8f('0x25')](function(_0xd05f4a){if(_[_0x3f8f('0x61')](_0xd05f4a)){throw new ReferenceError(_0x3f8f('0x62'));}return _0xd05f4a;})['then'](function(_0x318d33){var _0x289d39=_0x318d33[_0x3f8f('0x51')];logger[_0x3f8f('0x63')](_0x3f8f('0x64'),_0x289d39);if(!_[_0x3f8f('0x61')](_0x318d33['value'])&&fs[_0x3f8f('0x53')](_0x289d39)){logger['info'](_0x3f8f('0x65')+_0x289d39+_0x3f8f('0x66'));fs['unlinkSync'](_0x289d39);}_0x289d39=_0x289d39+_0x3f8f('0x67');if(!_[_0x3f8f('0x61')](_0x318d33[_0x3f8f('0x51')])&&fs[_0x3f8f('0x53')](_0x289d39)){logger[_0x3f8f('0x63')](_0x3f8f('0x65')+_0x289d39+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0x3f8f('0x68')](_0x289d39);}return _0x318d33;})[_0x3f8f('0x25')](function(_0x2787aa){if(!_0x2787aa)throw new InternalError();return _0x2787aa[_0x3f8f('0x26')]();})[_0x3f8f('0x25')](function(){_0xe34047[_0x3f8f('0x1a')](0xcc)[_0x3f8f('0x27')]();})[_0x3f8f('0x47')](handleError(_0xe34047,null));};function getBucketslist(_0x4e6c7c,_0x234ab7,_0x4f3406){return new Promise(function(_0x3942cf,_0x1b9651){var _0x301c56=new AWS['S3']({'accessKeyId':_0x234ab7,'secretAccessKey':_0x4e6c7c,'region':_0x4f3406});_0x301c56[_0x3f8f('0x69')]({},function(_0x3e06c2,_0x1d3ba6){if(_0x3e06c2){return _0x1b9651(_0x3e06c2);}else{return _0x3942cf(_0x1d3ba6);}});});}function createBucket(_0x63678a,_0x69e092,_0x24b589,_0x489073){return new Promise(function(_0x451310,_0x3341f9){var _0x5e00c0=new AWS['S3']({'accessKeyId':_0x69e092,'secretAccessKey':_0x63678a,'region':_0x24b589});_0x5e00c0[_0x3f8f('0x6a')]({'Bucket':_0x489073},function(_0xc68c1c,_0x5edb5d){if(_0xc68c1c){return _0x3341f9(_0xc68c1c);}else{return _0x451310(_0x5edb5d);}});});}function uploadFile(_0x4c6345,_0x2d7390,_0x5d9298,_0x538fc7,_0x3a5d58,_0x10f0ba){return new Promise(function(_0x339d09,_0x5b32a4){var _0x3cb7c3=new AWS['S3']({'accessKeyId':_0x2d7390,'secretAccessKey':_0x4c6345,'region':_0x5d9298});_0x3cb7c3[_0x3f8f('0x6b')]({'Bucket':_0x538fc7,'Key':_0x3a5d58,'Body':_0x10f0ba},function(_0x367e14,_0x52e00e){if(_0x367e14){return _0x5b32a4(_0x367e14);}else{return _0x339d09(_0x52e00e);}});});}function startTranscribe(_0x1850c7,_0x3d5b95,_0xfc2d09,_0x4dbf61,_0x20a232,_0x2cb3d2){return new Promise(function(_0x1d650c,_0x432fa0){var _0x3a5577=new AWS['TranscribeService']({'accessKeyId':_0x3d5b95,'secretAccessKey':_0x1850c7,'region':_0xfc2d09});_0x3a5577['startTranscriptionJob']({'TranscriptionJobName':_0x4dbf61,'LanguageCode':_0x20a232,'Media':{'MediaFileUri':_0x2cb3d2}},function(_0x330a78,_0x4e76ca){if(_0x330a78){return _0x432fa0(_0x330a78);}else{return _0x1d650c(_0x4e76ca);}});});}function transcribe(_0x14cdba,_0x23517,_0x19398a,_0xab303b,_0x2363c6,_0x5865de,_0x5ed3ca){return new Promise(function(_0x4fae74,_0x25c47e){var _0x45d2d2={};logger[_0x3f8f('0x63')](util[_0x3f8f('0x32')](_0x3f8f('0x6c'),_0x14cdba,_0x2363c6));return uploadFile(_0x23517,_0x19398a,_0xab303b,_0x2363c6,path[_0x3f8f('0x6d')](_0x5865de),fs[_0x3f8f('0x6e')](_0x5865de))[_0x3f8f('0x25')](function(_0x5a2f64){logger[_0x3f8f('0x63')](util[_0x3f8f('0x32')]('[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)',_0x14cdba,_0x2363c6,_0x5a2f64['Location']));_0x45d2d2[_0x3f8f('0x6f')]=_0x5a2f64['Bucket'];_0x45d2d2['location']=_0x5a2f64['Location'];logger[_0x3f8f('0x63')](util[_0x3f8f('0x32')](_0x3f8f('0x70'),_0x14cdba));return startTranscribe(_0x23517,_0x19398a,_0xab303b,uuidv4(),_0x5ed3ca,_0x5a2f64[_0x3f8f('0x71')]);})['then'](function(_0x1b972f){logger[_0x3f8f('0x63')](util[_0x3f8f('0x32')]('[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created',_0x14cdba,_0x1b972f[_0x3f8f('0x72')]['TranscriptionJobName']));_0x45d2d2[_0x3f8f('0x73')]=_0x1b972f['TranscriptionJob'][_0x3f8f('0x74')];_0x45d2d2[_0x3f8f('0x75')]=_0x1b972f[_0x3f8f('0x72')][_0x3f8f('0x76')];return _0x4fae74(_0x45d2d2);})[_0x3f8f('0x47')](function(_0x1d828e){return _0x25c47e(_0x1d828e);});});}exports[_0x3f8f('0x77')]=function(_0x1b3574,_0x420f06,_0x4f3b4e){var _0x413fdf;var _0x29f3e1;var _0x5c8679;var _0x5430d0=require('../../components/encryptor');return db['VoiceRecording'][_0x3f8f('0x78')]({'where':{'id':_0x1b3574['params']['id']}})[_0x3f8f('0x25')](function(_0x3cfc9a){if(_0x3cfc9a){var _0x39a1c4=util[_0x3f8f('0x32')](_0x3f8f('0x52'),_0x3cfc9a[_0x3f8f('0x51')]);if(fs[_0x3f8f('0x53')](_0x39a1c4)){cypher=!![];return _0x5430d0[_0x3f8f('0x54')](_0x39a1c4,_0x3cfc9a[_0x3f8f('0x51')],config[_0x3f8f('0x55')]['recording'])[_0x3f8f('0x25')](function(){return _0x3cfc9a;});}return _0x3cfc9a;}})[_0x3f8f('0x25')](function(_0x4460fb){if(!_0x4460fb){throw new db['Sequelize'][(_0x3f8f('0x58'))]('Voice\x20Recording\x20not\x20found');}_0x29f3e1=_0x4460fb;return db[_0x3f8f('0x79')][_0x3f8f('0x78')]({'where':{'id':0x1}});})['then'](handleEntityNotFound(_0x420f06,null))['then'](function(_0x4fb4aa){if(_0x4fb4aa){_0x413fdf=_0x4fb4aa;if(!_0x413fdf[_0x3f8f('0x7a')]||!_0x413fdf[_0x3f8f('0x7b')]||!_0x413fdf[_0x3f8f('0x7c')]||!_0x413fdf[_0x3f8f('0x7d')]||!_0x413fdf[_0x3f8f('0x6f')]){throw new db[(_0x3f8f('0x57'))][(_0x3f8f('0x58'))](_0x3f8f('0x7e'));}if(_0x1b3574[_0x3f8f('0x4b')]['runSentiment']&&(!_0x413fdf[_0x3f8f('0x7f')]||!_0x413fdf[_0x3f8f('0x80')]||!_0x413fdf[_0x3f8f('0x81')]||!_0x413fdf[_0x3f8f('0x7d')]||!_0x413fdf[_0x3f8f('0x6f')])){throw new db['Sequelize'][(_0x3f8f('0x58'))](_0x3f8f('0x82'));}return db[_0x3f8f('0x83')]['findOne']({'where':{'id':_0x413fdf[_0x3f8f('0x7b')]}});}})[_0x3f8f('0x25')](function(_0xbe8ce8){if(!_0xbe8ce8){throw new db['Sequelize'][(_0x3f8f('0x58'))]('Cloud\x20Provider\x20not\x20available');}if(!_0xbe8ce8[_0x3f8f('0x84')]||!_0xbe8ce8['data2']){throw new db['Sequelize']['ValidationError'](_0x3f8f('0x85'));}_0x5c8679=_0xbe8ce8;return getBucketslist(_0x5c8679[_0x3f8f('0x84')],_0x5c8679[_0x3f8f('0x86')],_0x413fdf[_0x3f8f('0x7c')]);})[_0x3f8f('0x25')](function(_0x511f28){if(_0x511f28&&_0x511f28[_0x3f8f('0x87')]){var _0x4379d6=_[_0x3f8f('0x4c')](_0x511f28[_0x3f8f('0x87')],function(_0x143fb2){return _0x143fb2[_0x3f8f('0x88')]===_0x413fdf['bucket'];});if(!_0x4379d6){logger[_0x3f8f('0x63')](util[_0x3f8f('0x32')]('[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available',_0x1b3574[_0x3f8f('0x49')]['id'],_0x413fdf[_0x3f8f('0x6f')]));return createBucket(_0x5c8679[_0x3f8f('0x84')],_0x5c8679[_0x3f8f('0x86')],_0x413fdf['transcribeRegion'],_0x413fdf['bucket']);}logger[_0x3f8f('0x63')](util[_0x3f8f('0x32')](_0x3f8f('0x89'),_0x1b3574[_0x3f8f('0x49')]['id'],_0x413fdf[_0x3f8f('0x6f')]));return;}})[_0x3f8f('0x25')](function(_0xc6d5b){if(_0x29f3e1[_0x3f8f('0x75')]==='NEW'){return transcribe(_0x1b3574[_0x3f8f('0x49')]['id'],_0x5c8679[_0x3f8f('0x84')],_0x5c8679[_0x3f8f('0x86')],_0x413fdf[_0x3f8f('0x7c')],_0x413fdf[_0x3f8f('0x6f')],_0x29f3e1['value'],_0x413fdf[_0x3f8f('0x7d')]);}else{logger[_0x3f8f('0x63')](util['format']('[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested',_0x1b3574[_0x3f8f('0x49')]['id']));return{'transcribeStatus':_0x3f8f('0x8a')};}})[_0x3f8f('0x25')](function(_0x6052b){if(_0x6052b){_0x6052b[_0x3f8f('0x8b')]=_0x1b3574['body'][_0x3f8f('0x8c')];return _0x29f3e1[_0x3f8f('0x8d')](_0x6052b);}})[_0x3f8f('0x25')](respondWithResult(_0x420f06,null))['catch'](handleError(_0x420f06,null));};function writeFile(_0x17085b,_0x3b3b86){return new Promise(function(_0x1ca3a5,_0x574088){fs[_0x3f8f('0x8e')](_0x3b3b86,_0x17085b,function(_0x354baf,_0x2780d4){if(_0x354baf){return _0x574088(_0x354baf);}else{return _0x1ca3a5(_0x2780d4);}});});}exports[_0x3f8f('0x8f')]=function(_0x1af66c,_0x3c5ce5,_0x274d88){return db[_0x3f8f('0x44')][_0x3f8f('0x78')]({'where':{'id':_0x1af66c['params']['id']}})[_0x3f8f('0x25')](handleEntityNotFound(_0x3c5ce5))[_0x3f8f('0x25')](function(_0x3a79f6){if(_0x3a79f6&&_0x3a79f6[_0x3f8f('0x90')]){var _0x2eb2f4=_0x3a79f6[_0x3f8f('0x90')];var _0x4387d3=config[_0x3f8f('0x91')]+'/server/files/transcribes/transcribe_'+_0x3a79f6['id']+_0x3f8f('0x92');if(fs[_0x3f8f('0x53')](_0x4387d3)){return _0x4387d3;}return writeFile(_0x2eb2f4,_0x4387d3)['then'](function(){return _0x4387d3;});}else{throw new db['Sequelize'][(_0x3f8f('0x58'))](_0x3f8f('0x93'));}})[_0x3f8f('0x25')](function(_0x523a9f){return _0x3c5ce5['download'](_0x523a9f);})[_0x3f8f('0x47')](handleError(_0x3c5ce5));}; \ No newline at end of file +var _0x821e=['undefined','limit','count','offset','set','Content-Range','apply','reject','save','destroy','then','error','name','index','rawAttributes','fieldName','type','key','map','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filter','VIRTUAL','merge','options','VoiceRecording','include','show','length','includeAll','find','catch','create','update','body','params','describe','download','../../components/encryptor','uniqueid','value','format','existsSync','decryptFile','secrets','recording','ValidationError','VoiceRecording\x20not\x20found','filename','extname','message','send','Not\x20found','downloads','sequelize','MD5','col','token','push','$and','%s.cypher','Sequelize','unlink','isNil','Entity\x20not\x20found','cancellazione\x20fisica\x20documento\x20%s','info','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','listBuckets','createBucket','upload','TranscribeService','[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s','basename','readFileSync','[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)','bucket','location','Location','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','TranscriptionJob','TranscriptionJobName','transcribeName','transcribeStatus','runTranscribe','findOne','Voice\x20Recording\x20not\x20found','Setting','transcribeAccountId','transcribeRegion','Transcribe\x20not\x20configured','runSentiment','sentiment','language','Sentiment\x20Analysis\x20not\x20configured','CloudProvider','data2','Buckets','Name','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','data1','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested','updateAttributes','writeFile','downloadTranscribe','fileText','root','/server/files/transcribes/transcribe_','Transcript\x20not\x20available','eml-format','zip-dir','fast-json-patch','bluebird','util','path','fs-extra','crypto','jsforce','desk.js','to-csv','querystring','papaparse','aws-sdk','uuid/v4','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json'];(function(_0x1d9a52,_0x21c9e3){var _0xf12f69=function(_0x4bd04c){while(--_0x4bd04c){_0x1d9a52['push'](_0x1d9a52['shift']());}};_0xf12f69(++_0x21c9e3);}(_0x821e,0x7c));var _0xe821=function(_0x3ceb54,_0x5bddfd){_0x3ceb54=_0x3ceb54-0x0;var _0x26d8a6=_0x821e[_0x3ceb54];return _0x26d8a6;};'use strict';var emlformat=require(_0xe821('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe821('0x1'));var jsonpatch=require(_0xe821('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xe821('0x3'));var Mustache=require('mustache');var util=require(_0xe821('0x4'));var path=require(_0xe821('0x5'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe821('0x6'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xe821('0x7'));var jsforce=require(_0xe821('0x8'));var deskjs=require(_0xe821('0x9'));var toCsv=require(_0xe821('0xa'));var querystring=require(_0xe821('0xb'));var Papa=require(_0xe821('0xc'));var AWS=require(_0xe821('0xd'));var uuidv4=require(_0xe821('0xe'));var Redis=require(_0xe821('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xe821('0x10'));var as=require(_0xe821('0x11'));var hardwareService=require(_0xe821('0x12'));var logger=require(_0xe821('0x13'))(_0xe821('0x14'));var utils=require(_0xe821('0x15'));var config=require(_0xe821('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xe821('0x17'))['db'];function respondWithStatusCode(_0x5c6fdd,_0x506a88){_0x506a88=_0x506a88||0xcc;return function(_0x2feb91){if(_0x2feb91){return _0x5c6fdd[_0xe821('0x18')](_0x506a88);}return _0x5c6fdd[_0xe821('0x19')](_0x506a88)[_0xe821('0x1a')]();};}function respondWithResult(_0x50eafc,_0x469bb7){_0x469bb7=_0x469bb7||0xc8;return function(_0xac87fe){if(_0xac87fe){return _0x50eafc[_0xe821('0x19')](_0x469bb7)[_0xe821('0x1b')](_0xac87fe);}};}function respondWithFilteredResult(_0x3a1156,_0x148319){return function(_0x2ede28){if(_0x2ede28){var _0x382578=typeof _0x148319['offset']===_0xe821('0x1c')&&typeof _0x148319[_0xe821('0x1d')]==='undefined';var _0x10df07=_0x2ede28[_0xe821('0x1e')];var _0x1f9277=_0x382578?0x0:_0x148319[_0xe821('0x1f')];var _0x40f9fa=_0x382578?_0x2ede28[_0xe821('0x1e')]:_0x148319['offset']+_0x148319[_0xe821('0x1d')];var _0x4bf8fa;if(_0x40f9fa>=_0x10df07){_0x40f9fa=_0x10df07;_0x4bf8fa=0xc8;}else{_0x4bf8fa=0xce;}_0x3a1156['status'](_0x4bf8fa);return _0x3a1156[_0xe821('0x20')](_0xe821('0x21'),_0x1f9277+'-'+_0x40f9fa+'/'+_0x10df07)[_0xe821('0x1b')](_0x2ede28);}return null;};}function patchUpdates(_0x537617){return function(_0x1bc941){try{jsonpatch[_0xe821('0x22')](_0x1bc941,_0x537617,!![]);}catch(_0x5dd71c){return BPromise[_0xe821('0x23')](_0x5dd71c);}return _0x1bc941[_0xe821('0x24')]();};}function saveUpdates(_0x3474d9,_0x15c2ec){return function(_0x27dd97){if(_0x27dd97){return _0x27dd97['update'](_0x3474d9)['then'](function(_0x4f3ac3){return _0x4f3ac3;});}return null;};}function removeEntity(_0x2087ea,_0x551260){return function(_0x18b3d4){if(_0x18b3d4){return _0x18b3d4[_0xe821('0x25')]()[_0xe821('0x26')](function(){_0x2087ea[_0xe821('0x19')](0xcc)[_0xe821('0x1a')]();});}};}function handleEntityNotFound(_0x48644e,_0x2b5b25){return function(_0x203b64){if(!_0x203b64){_0x48644e['sendStatus'](0x194);}return _0x203b64;};}function handleError(_0x215bda,_0x25668b){_0x25668b=_0x25668b||0x1f4;return function(_0x359f41){logger[_0xe821('0x27')](_0x359f41['stack']);if(_0x359f41[_0xe821('0x28')]){delete _0x359f41['name'];}_0x215bda[_0xe821('0x19')](_0x25668b)['send'](_0x359f41);};}exports[_0xe821('0x29')]=function(_0x1c9f48,_0x306936){var _0x2ea1a1={},_0x124d96={},_0x500d51={'count':0x0,'rows':[]};var _0x540271=_['map'](db['VoiceRecording'][_0xe821('0x2a')],function(_0x15e1af){return{'name':_0x15e1af[_0xe821('0x2b')],'type':_0x15e1af[_0xe821('0x2c')][_0xe821('0x2d')]};});_0x124d96['model']=_['differenceBy'](_[_0xe821('0x2e')](_0x540271,_0xe821('0x28')),['format']);_0x124d96[_0xe821('0x2f')]=_[_0xe821('0x30')](_0x1c9f48['query']);_0x124d96[_0xe821('0x31')]=_[_0xe821('0x32')](_0x124d96[_0xe821('0x33')],_0x124d96[_0xe821('0x2f')]);_0x2ea1a1[_0xe821('0x34')]=_[_0xe821('0x32')](_0x124d96[_0xe821('0x33')],qs[_0xe821('0x35')](_0x1c9f48['query']['fields']));_0x2ea1a1[_0xe821('0x34')]=_0x2ea1a1[_0xe821('0x34')]['length']?_0x2ea1a1[_0xe821('0x34')]:_0x124d96[_0xe821('0x33')];if(!_0x1c9f48[_0xe821('0x2f')][_0xe821('0x36')](_0xe821('0x37'))){_0x2ea1a1[_0xe821('0x1d')]=qs[_0xe821('0x1d')](_0x1c9f48['query'][_0xe821('0x1d')]);_0x2ea1a1[_0xe821('0x1f')]=qs[_0xe821('0x1f')](_0x1c9f48['query'][_0xe821('0x1f')]);}_0x2ea1a1['order']=qs[_0xe821('0x38')](_0x1c9f48['query'][_0xe821('0x38')]);_0x2ea1a1[_0xe821('0x39')]=qs[_0xe821('0x31')](_[_0xe821('0x3a')](_0x1c9f48[_0xe821('0x2f')],_0x124d96['filters']),_0x540271);if(_0x1c9f48[_0xe821('0x2f')][_0xe821('0x3b')]){_0x2ea1a1[_0xe821('0x39')]=_['merge'](_0x2ea1a1[_0xe821('0x39')],{'$or':_[_0xe821('0x2e')](_0x540271,function(_0x259f25){if(_0x259f25['type']!==_0xe821('0x3c')){var _0x132ef7={};_0x132ef7[_0x259f25[_0xe821('0x28')]]={'$like':'%'+_0x1c9f48['query'][_0xe821('0x3b')]+'%'};return _0x132ef7;}})});}_0x2ea1a1=_[_0xe821('0x3d')]({},_0x2ea1a1,_0x1c9f48[_0xe821('0x3e')]);var _0x18603d={'where':_0x2ea1a1[_0xe821('0x39')]};return db[_0xe821('0x3f')][_0xe821('0x1e')](_0x18603d)[_0xe821('0x26')](function(_0x1d6e8f){_0x500d51[_0xe821('0x1e')]=_0x1d6e8f;if(_0x1c9f48[_0xe821('0x2f')]['includeAll']){_0x2ea1a1[_0xe821('0x40')]=[{'all':!![]}];}return db[_0xe821('0x3f')]['findAll'](_0x2ea1a1);})[_0xe821('0x26')](function(_0xba043){_0x500d51['rows']=_0xba043;return _0x500d51;})[_0xe821('0x26')](respondWithFilteredResult(_0x306936,_0x2ea1a1))['catch'](handleError(_0x306936,null));};exports[_0xe821('0x41')]=function(_0x5cb447,_0xe21938){var _0x240530={'raw':![],'where':{'id':_0x5cb447['params']['id']}},_0xdea3f7={};_0xdea3f7['model']=_[_0xe821('0x30')](db[_0xe821('0x3f')][_0xe821('0x2a')]);_0xdea3f7[_0xe821('0x2f')]=_[_0xe821('0x30')](_0x5cb447[_0xe821('0x2f')]);_0xdea3f7[_0xe821('0x31')]=_['intersection'](_0xdea3f7[_0xe821('0x33')],_0xdea3f7[_0xe821('0x2f')]);_0x240530['attributes']=_[_0xe821('0x32')](_0xdea3f7['model'],qs[_0xe821('0x35')](_0x5cb447[_0xe821('0x2f')][_0xe821('0x35')]));_0x240530[_0xe821('0x34')]=_0x240530[_0xe821('0x34')][_0xe821('0x42')]?_0x240530[_0xe821('0x34')]:_0xdea3f7[_0xe821('0x33')];if(_0x5cb447[_0xe821('0x2f')][_0xe821('0x43')]){_0x240530[_0xe821('0x40')]=[{'all':!![]}];}_0x240530=_[_0xe821('0x3d')]({},_0x240530,_0x5cb447['options']);return db[_0xe821('0x3f')][_0xe821('0x44')](_0x240530)['then'](handleEntityNotFound(_0xe21938,null))['then'](respondWithResult(_0xe21938,null))[_0xe821('0x45')](handleError(_0xe21938,null));};exports[_0xe821('0x46')]=function(_0x4cddd4,_0x30ab57){return db[_0xe821('0x3f')][_0xe821('0x46')](_0x4cddd4['body'],{})[_0xe821('0x26')](respondWithResult(_0x30ab57,0xc9))[_0xe821('0x45')](handleError(_0x30ab57,null));};exports[_0xe821('0x47')]=function(_0x44736e,_0x3f9e4d){if(_0x44736e['body']['id']){delete _0x44736e[_0xe821('0x48')]['id'];}return db[_0xe821('0x3f')][_0xe821('0x44')]({'where':{'id':_0x44736e[_0xe821('0x49')]['id']}})[_0xe821('0x26')](handleEntityNotFound(_0x3f9e4d,null))[_0xe821('0x26')](saveUpdates(_0x44736e[_0xe821('0x48')],null))[_0xe821('0x26')](respondWithResult(_0x3f9e4d,null))[_0xe821('0x45')](handleError(_0x3f9e4d,null));};exports['describe']=function(_0x1d4911,_0x4a8f31){return db[_0xe821('0x3f')][_0xe821('0x4a')]()[_0xe821('0x26')](respondWithResult(_0x4a8f31,null))['catch'](handleError(_0x4a8f31,null));};exports[_0xe821('0x4b')]=function(_0x5aa67c,_0x4acd70,_0x2661b7){var _0x1154ac=require(_0xe821('0x4c'));var _0x1c85e8=![];var _0x16df17={};if(_0x5aa67c['query'][_0xe821('0x2c')]&&_0x5aa67c['query'][_0xe821('0x2c')]===_0xe821('0x4d')){_0x16df17['uniqueid']=_0x5aa67c['params']['id'];}else{_0x16df17['id']=_0x5aa67c[_0xe821('0x49')]['id'];}return db[_0xe821('0x3f')][_0xe821('0x44')]({'where':_0x16df17,'attributes':['id','value'],'raw':!![]})[_0xe821('0x26')](handleEntityNotFound(_0x4acd70,null))['then'](function(_0x1de02e){if(_0x1de02e){var _0x1f4956=_0x1de02e[_0xe821('0x4e')];var _0x5ba925=util[_0xe821('0x4f')]('%s.cypher',_0x1f4956);if(fs[_0xe821('0x50')](_0x5ba925)){_0x1c85e8=!![];return _0x1154ac[_0xe821('0x51')](_0x5ba925,_0x1f4956,config[_0xe821('0x52')][_0xe821('0x53')])['then'](function(){return _0x1de02e;});}return _0x1de02e;}})[_0xe821('0x26')](function(_0x47e0e9){if(_0x47e0e9){var _0x140790=_0x47e0e9['value'];if(!fs[_0xe821('0x50')](_0x140790)){throw new db['Sequelize'][(_0xe821('0x54'))](_0xe821('0x55'));}if(_0x47e0e9[_0xe821('0x56')]){return _0x4acd70[_0xe821('0x4b')](_0x140790,_0x47e0e9[_0xe821('0x56')]+path[_0xe821('0x57')](_0x140790),function(){if(_0x1c85e8){fs['unlink'](_0x140790);}});}else{return _0x4acd70[_0xe821('0x4b')](_0x140790,function(_0x7760d2){if(_0x1c85e8){fs['unlink'](_0x140790);}});}}})[_0xe821('0x45')](function(_0x17e7fe){if(_0x17e7fe[_0xe821('0x58')]===_0xe821('0x55')){_0x4acd70[_0xe821('0x19')](0x194)[_0xe821('0x59')](_0xe821('0x5a'));}else{return handleError(_0x4acd70,null);}});};exports[_0xe821('0x5b')]=function(_0x58b3c0,_0x318c73,_0x58cfb2){var _0x3a529a=require(_0xe821('0x4c'));var _0x54e0ff=![];var _0x6f4556={'$and':[db[_0xe821('0x5c')][_0xe821('0x39')](db[_0xe821('0x5c')]['fn'](_0xe821('0x5d'),db[_0xe821('0x5c')][_0xe821('0x5e')](_0xe821('0x4d'))),_0x58b3c0[_0xe821('0x2f')][_0xe821('0x5f')])]};if(_0x58b3c0['query'][_0xe821('0x2c')]&&_0x58b3c0[_0xe821('0x2f')][_0xe821('0x2c')]===_0xe821('0x4d')){_0x6f4556['$and'][_0xe821('0x60')]({'uniqueid':_0x58b3c0[_0xe821('0x49')]['id']});}else{_0x6f4556[_0xe821('0x61')][_0xe821('0x60')]({'id':_0x58b3c0['params']['id']});}return db[_0xe821('0x3f')][_0xe821('0x44')]({'where':_0x6f4556,'attributes':['id',_0xe821('0x4e')],'raw':!![]})[_0xe821('0x26')](handleEntityNotFound(_0x318c73,null))[_0xe821('0x26')](function(_0x5cc1f4){if(_0x5cc1f4){var _0x51bff0=util['format'](_0xe821('0x62'),_0x5cc1f4[_0xe821('0x4e')]);if(fs[_0xe821('0x50')](_0x51bff0)){_0x54e0ff=!![];return _0x3a529a[_0xe821('0x51')](_0x51bff0,_0x5cc1f4[_0xe821('0x4e')],config[_0xe821('0x52')][_0xe821('0x53')])[_0xe821('0x26')](function(){return _0x5cc1f4;});}return _0x5cc1f4;}})[_0xe821('0x26')](function(_0x52a7d0){if(_0x52a7d0){if(!fs['existsSync'](_0x52a7d0[_0xe821('0x4e')])){throw new db[(_0xe821('0x63'))][(_0xe821('0x54'))](_0xe821('0x55'));}if(_0x52a7d0[_0xe821('0x56')]){return _0x318c73[_0xe821('0x4b')](_0x52a7d0[_0xe821('0x4e')],_0x52a7d0[_0xe821('0x56')]+path[_0xe821('0x57')](_0x52a7d0[_0xe821('0x4e')]),function(){if(_0x54e0ff){fs[_0xe821('0x64')](_0x52a7d0[_0xe821('0x4e')]);}});}else{return _0x318c73['download'](_0x52a7d0['value'],function(_0x41fcca){if(_0x54e0ff){fs['unlink'](_0x52a7d0['value']);}});}}})['catch'](handleError(_0x318c73,null));};exports['destroy']=function(_0x59dfb5,_0x567f37){return db[_0xe821('0x3f')]['find']({'where':{'id':_0x59dfb5['params']['id']}})[_0xe821('0x26')](function(_0x2494b0){if(_[_0xe821('0x65')](_0x2494b0)){throw new ReferenceError(_0xe821('0x66'));}return _0x2494b0;})[_0xe821('0x26')](function(_0x4e4aea){var _0x2cb108=_0x4e4aea[_0xe821('0x4e')];logger['info'](_0xe821('0x67'),_0x2cb108);if(!_[_0xe821('0x65')](_0x4e4aea[_0xe821('0x4e')])&&fs['existsSync'](_0x2cb108)){logger[_0xe821('0x68')](_0xe821('0x69')+_0x2cb108+_0xe821('0x6a'));fs[_0xe821('0x6b')](_0x2cb108);}_0x2cb108=_0x2cb108+_0xe821('0x6c');if(!_[_0xe821('0x65')](_0x4e4aea[_0xe821('0x4e')])&&fs[_0xe821('0x50')](_0x2cb108)){logger['info'](_0xe821('0x69')+_0x2cb108+_0xe821('0x6a'));fs['unlinkSync'](_0x2cb108);}return _0x4e4aea;})['then'](function(_0x15d923){if(!_0x15d923)throw new InternalError();return _0x15d923[_0xe821('0x25')]();})[_0xe821('0x26')](function(){_0x567f37['status'](0xcc)['end']();})[_0xe821('0x45')](handleError(_0x567f37,null));};function getBucketslist(_0x25f942,_0x2dff40,_0x1bcaad){return new Promise(function(_0x530777,_0x4050be){var _0x18623e=new AWS['S3']({'accessKeyId':_0x2dff40,'secretAccessKey':_0x25f942,'region':_0x1bcaad});_0x18623e[_0xe821('0x6d')]({},function(_0x20d4b8,_0x190b55){if(_0x20d4b8){return _0x4050be(_0x20d4b8);}else{return _0x530777(_0x190b55);}});});}function createBucket(_0x25066a,_0x2170b1,_0x17ff64,_0x2655b1){return new Promise(function(_0x15065a,_0x3534c1){var _0x1f0303=new AWS['S3']({'accessKeyId':_0x2170b1,'secretAccessKey':_0x25066a,'region':_0x17ff64});_0x1f0303[_0xe821('0x6e')]({'Bucket':_0x2655b1},function(_0x404750,_0x4643db){if(_0x404750){return _0x3534c1(_0x404750);}else{return _0x15065a(_0x4643db);}});});}function uploadFile(_0xe56347,_0x4b1fde,_0x434a12,_0x4b513c,_0x2ac7b6,_0x1d33ce){return new Promise(function(_0x936b87,_0x483b9f){var _0x37f527=new AWS['S3']({'accessKeyId':_0x4b1fde,'secretAccessKey':_0xe56347,'region':_0x434a12});_0x37f527[_0xe821('0x6f')]({'Bucket':_0x4b513c,'Key':_0x2ac7b6,'Body':_0x1d33ce},function(_0x246e10,_0x4877b4){if(_0x246e10){return _0x483b9f(_0x246e10);}else{return _0x936b87(_0x4877b4);}});});}function startTranscribe(_0x401d01,_0xa86e35,_0x18b6b2,_0x1647cc,_0x421095,_0x59aa57){return new Promise(function(_0x587245,_0x25eca0){var _0x55dd87=new AWS[(_0xe821('0x70'))]({'accessKeyId':_0xa86e35,'secretAccessKey':_0x401d01,'region':_0x18b6b2});_0x55dd87['startTranscriptionJob']({'TranscriptionJobName':_0x1647cc,'LanguageCode':_0x421095,'Media':{'MediaFileUri':_0x59aa57}},function(_0x1f2a07,_0x486653){if(_0x1f2a07){return _0x25eca0(_0x1f2a07);}else{return _0x587245(_0x486653);}});});}function transcribe(_0x3ba6a3,_0x395fdd,_0x3bbbe0,_0x2ca618,_0x2f593b,_0x2c5f0d,_0x4c9900){return new Promise(function(_0x1f7e29,_0xbff9b){var _0xbd38eb={};logger[_0xe821('0x68')](util[_0xe821('0x4f')](_0xe821('0x71'),_0x3ba6a3,_0x2f593b));return uploadFile(_0x395fdd,_0x3bbbe0,_0x2ca618,_0x2f593b,path[_0xe821('0x72')](_0x2c5f0d),fs[_0xe821('0x73')](_0x2c5f0d))[_0xe821('0x26')](function(_0x57118d){logger['info'](util[_0xe821('0x4f')](_0xe821('0x74'),_0x3ba6a3,_0x2f593b,_0x57118d['Location']));_0xbd38eb[_0xe821('0x75')]=_0x57118d['Bucket'];_0xbd38eb[_0xe821('0x76')]=_0x57118d[_0xe821('0x77')];logger['info'](util[_0xe821('0x4f')](_0xe821('0x78'),_0x3ba6a3));return startTranscribe(_0x395fdd,_0x3bbbe0,_0x2ca618,uuidv4(),_0x4c9900,_0x57118d[_0xe821('0x77')]);})[_0xe821('0x26')](function(_0x57c9b6){logger[_0xe821('0x68')](util[_0xe821('0x4f')](_0xe821('0x79'),_0x3ba6a3,_0x57c9b6[_0xe821('0x7a')][_0xe821('0x7b')]));_0xbd38eb[_0xe821('0x7c')]=_0x57c9b6['TranscriptionJob'][_0xe821('0x7b')];_0xbd38eb[_0xe821('0x7d')]=_0x57c9b6['TranscriptionJob']['TranscriptionJobStatus'];return _0x1f7e29(_0xbd38eb);})['catch'](function(_0x1d3839){return _0xbff9b(_0x1d3839);});});}exports[_0xe821('0x7e')]=function(_0x9f21ed,_0x239b62,_0x11adcb){var _0x425ca5;var _0x26c70f;var _0x240702;var _0x17184d=require(_0xe821('0x4c'));return db[_0xe821('0x3f')][_0xe821('0x7f')]({'where':{'id':_0x9f21ed[_0xe821('0x49')]['id']}})[_0xe821('0x26')](function(_0x1db3f4){if(_0x1db3f4){var _0x293f3d=util['format']('%s.cypher',_0x1db3f4[_0xe821('0x4e')]);if(fs[_0xe821('0x50')](_0x293f3d)){cypher=!![];return _0x17184d[_0xe821('0x51')](_0x293f3d,_0x1db3f4[_0xe821('0x4e')],config['secrets'][_0xe821('0x53')])[_0xe821('0x26')](function(){return _0x1db3f4;});}return _0x1db3f4;}})[_0xe821('0x26')](function(_0xe2fb37){if(!_0xe2fb37){throw new db[(_0xe821('0x63'))][(_0xe821('0x54'))](_0xe821('0x80'));}_0x26c70f=_0xe2fb37;return db[_0xe821('0x81')][_0xe821('0x7f')]({'where':{'id':0x1}});})[_0xe821('0x26')](handleEntityNotFound(_0x239b62,null))['then'](function(_0xb39d2d){if(_0xb39d2d){_0x425ca5=_0xb39d2d;if(!_0x425ca5['transcribe']||!_0x425ca5[_0xe821('0x82')]||!_0x425ca5[_0xe821('0x83')]||!_0x425ca5['language']||!_0x425ca5[_0xe821('0x75')]){throw new db[(_0xe821('0x63'))][(_0xe821('0x54'))](_0xe821('0x84'));}if(_0x9f21ed['body'][_0xe821('0x85')]&&(!_0x425ca5[_0xe821('0x86')]||!_0x425ca5['sentimentAccountId']||!_0x425ca5['sentimentRegion']||!_0x425ca5[_0xe821('0x87')]||!_0x425ca5[_0xe821('0x75')])){throw new db[(_0xe821('0x63'))][(_0xe821('0x54'))](_0xe821('0x88'));}return db[_0xe821('0x89')][_0xe821('0x7f')]({'where':{'id':_0x425ca5[_0xe821('0x82')]}});}})[_0xe821('0x26')](function(_0x329cc8){if(!_0x329cc8){throw new db[(_0xe821('0x63'))][(_0xe821('0x54'))]('Cloud\x20Provider\x20not\x20available');}if(!_0x329cc8['data1']||!_0x329cc8[_0xe821('0x8a')]){throw new db[(_0xe821('0x63'))][(_0xe821('0x54'))]('Cloud\x20Provider\x20not\x20configured');}_0x240702=_0x329cc8;return getBucketslist(_0x240702['data1'],_0x240702['data2'],_0x425ca5[_0xe821('0x83')]);})[_0xe821('0x26')](function(_0x161f98){if(_0x161f98&&_0x161f98[_0xe821('0x8b')]){var _0x1ca977=_[_0xe821('0x44')](_0x161f98[_0xe821('0x8b')],function(_0x53b92c){return _0x53b92c[_0xe821('0x8c')]===_0x425ca5[_0xe821('0x75')];});if(!_0x1ca977){logger[_0xe821('0x68')](util[_0xe821('0x4f')](_0xe821('0x8d'),_0x9f21ed[_0xe821('0x49')]['id'],_0x425ca5[_0xe821('0x75')]));return createBucket(_0x240702[_0xe821('0x8e')],_0x240702[_0xe821('0x8a')],_0x425ca5[_0xe821('0x83')],_0x425ca5[_0xe821('0x75')]);}logger['info'](util[_0xe821('0x4f')](_0xe821('0x8f'),_0x9f21ed[_0xe821('0x49')]['id'],_0x425ca5[_0xe821('0x75')]));return;}})[_0xe821('0x26')](function(_0x5ef70b){if(_0x26c70f[_0xe821('0x7d')]==='NEW'){return transcribe(_0x9f21ed[_0xe821('0x49')]['id'],_0x240702[_0xe821('0x8e')],_0x240702[_0xe821('0x8a')],_0x425ca5[_0xe821('0x83')],_0x425ca5['bucket'],_0x26c70f[_0xe821('0x4e')],_0x425ca5[_0xe821('0x87')]);}else{logger[_0xe821('0x68')](util[_0xe821('0x4f')](_0xe821('0x90'),_0x9f21ed[_0xe821('0x49')]['id']));return{'transcribeStatus':'IN_PROGRESS'};}})[_0xe821('0x26')](function(_0x30152f){if(_0x30152f){_0x30152f['tempSentiment']=_0x9f21ed[_0xe821('0x48')][_0xe821('0x85')];return _0x26c70f[_0xe821('0x91')](_0x30152f);}})[_0xe821('0x26')](respondWithResult(_0x239b62,null))[_0xe821('0x45')](handleError(_0x239b62,null));};function writeFile(_0x391774,_0x106efc){return new Promise(function(_0x3aab02,_0xeb48dd){fs[_0xe821('0x92')](_0x106efc,_0x391774,function(_0xc35d43,_0x2cc6d1){if(_0xc35d43){return _0xeb48dd(_0xc35d43);}else{return _0x3aab02(_0x2cc6d1);}});});}exports[_0xe821('0x93')]=function(_0x4dab0c,_0x17a405,_0x58c2cb){return db[_0xe821('0x3f')][_0xe821('0x7f')]({'where':{'id':_0x4dab0c[_0xe821('0x49')]['id']}})[_0xe821('0x26')](handleEntityNotFound(_0x17a405))[_0xe821('0x26')](function(_0xf7db02){if(_0xf7db02&&_0xf7db02[_0xe821('0x94')]){var _0x47ea59=_0xf7db02['fileText'];var _0x1a7ae5=config[_0xe821('0x95')]+_0xe821('0x96')+_0xf7db02['id']+'.txt';if(fs[_0xe821('0x50')](_0x1a7ae5)){return _0x1a7ae5;}return writeFile(_0x47ea59,_0x1a7ae5)['then'](function(){return _0x1a7ae5;});}else{throw new db[(_0xe821('0x63'))][(_0xe821('0x54'))](_0xe821('0x97'));}})[_0xe821('0x26')](function(_0x31a23d){return _0x17a405[_0xe821('0x4b')](_0x31a23d);})['catch'](handleError(_0x17a405));}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.model.js b/server/api/voiceRecording/voiceRecording.model.js index 5c64fed..11c4eb9 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 _0x9f17=['bluebird','request-promise','path','../../config/environment','./voiceRecording.attributes','exports','define','voice_recordings','uniqueid','../../config/logger','api'];(function(_0x3a5558,_0x67df5a){var _0x1e50dd=function(_0x536c2d){while(--_0x536c2d){_0x3a5558['push'](_0x3a5558['shift']());}};_0x1e50dd(++_0x67df5a);}(_0x9f17,0xc4));var _0x79f1=function(_0x38cd93,_0x22e780){_0x38cd93=_0x38cd93-0x0;var _0x4063a9=_0x9f17[_0x38cd93];return _0x4063a9;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x79f1('0x0'))(_0x79f1('0x1'));var moment=require('moment');var BPromise=require(_0x79f1('0x2'));var rp=require(_0x79f1('0x3'));var fs=require('fs');var path=require(_0x79f1('0x4'));var rimraf=require('rimraf');var config=require(_0x79f1('0x5'));var attributes=require(_0x79f1('0x6'));module[_0x79f1('0x7')]=function(_0x1209b0,_0x14dda4){return _0x1209b0[_0x79f1('0x8')]('VoiceRecording',attributes,{'tableName':_0x79f1('0x9'),'paranoid':![],'indexes':[{'name':_0x79f1('0xa'),'fields':[_0x79f1('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xa9e2=['./voiceRecording.attributes','exports','VoiceRecording','voice_recordings','uniqueid','util','../../config/logger','request-promise','rimraf','../../config/environment'];(function(_0x294552,_0x561083){var _0x492e7a=function(_0x2e4be9){while(--_0x2e4be9){_0x294552['push'](_0x294552['shift']());}};_0x492e7a(++_0x561083);}(_0xa9e2,0x1e5));var _0x2a9e=function(_0x11793e,_0x111a3c){_0x11793e=_0x11793e-0x0;var _0x39c977=_0xa9e2[_0x11793e];return _0x39c977;};'use strict';var _=require('lodash');var util=require(_0x2a9e('0x0'));var logger=require(_0x2a9e('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x2a9e('0x2'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2a9e('0x3'));var config=require(_0x2a9e('0x4'));var attributes=require(_0x2a9e('0x5'));module[_0x2a9e('0x6')]=function(_0x1129e8,_0x260776){return _0x1129e8['define'](_0x2a9e('0x7'),attributes,{'tableName':_0x2a9e('0x8'),'paranoid':![],'indexes':[{'name':_0x2a9e('0x9'),'fields':[_0x2a9e('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.rpc.js b/server/api/voiceRecording/voiceRecording.rpc.js index f81e541..8e8c588 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 _0x1967=['../../config/logger','rpc','../../config/environment','client','http','request','then','info','VoiceRecording,\x20%s,\x20%s','VoiceRecording,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','UpdateVoiceRecording','VoiceRecording','update','body','options','where','debug','Setting','findOne','existsSync','value','format','encryptFile','secrets','recording','unlink','CreateVoiceRecording\x20file\x20encrypted','CreateVoiceRecording','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x3ff085,_0x27c92e){var _0x2b68c3=function(_0x37811e){while(--_0x37811e){_0x3ff085['push'](_0x3ff085['shift']());}};_0x2b68c3(++_0x27c92e);}(_0x1967,0x173));var _0x7196=function(_0xc32610,_0x28d42e){_0xc32610=_0xc32610-0x0;var _0x3bad89=_0x1967[_0xc32610];return _0x3bad89;};'use strict';var _=require('lodash');var util=require(_0x7196('0x0'));var moment=require(_0x7196('0x1'));var BPromise=require(_0x7196('0x2'));var rs=require(_0x7196('0x3'));var fs=require('fs');var Redis=require(_0x7196('0x4'));var db=require(_0x7196('0x5'))['db'];var utils=require(_0x7196('0x6'));var logger=require(_0x7196('0x7'))(_0x7196('0x8'));var config=require(_0x7196('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x7196('0xa')][_0x7196('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x194746,_0x40e0af,_0x266a6e){return new BPromise(function(_0xad78a,_0x510c72){return client[_0x7196('0xc')](_0x194746,_0x266a6e)[_0x7196('0xd')](function(_0x3f846e){logger[_0x7196('0xe')](_0x7196('0xf'),_0x40e0af,'request\x20sent');logger['debug'](_0x7196('0x10'),_0x40e0af,_0x7196('0x11'),JSON[_0x7196('0x12')](_0x3f846e));if(_0x3f846e[_0x7196('0x13')]){if(_0x3f846e[_0x7196('0x13')][_0x7196('0x14')]===0x1f4){logger[_0x7196('0x13')](_0x7196('0xf'),_0x40e0af,_0x3f846e[_0x7196('0x13')][_0x7196('0x15')]);return _0x510c72(_0x3f846e[_0x7196('0x13')]['message']);}logger[_0x7196('0x13')](_0x7196('0xf'),_0x40e0af,_0x3f846e[_0x7196('0x13')][_0x7196('0x15')]);return _0xad78a(_0x3f846e['error'][_0x7196('0x15')]);}else{logger['info'](_0x7196('0xf'),_0x40e0af,_0x7196('0x11'));_0xad78a(_0x3f846e[_0x7196('0x16')][_0x7196('0x15')]);}})[_0x7196('0x17')](function(_0x2e3e0e){logger[_0x7196('0x13')](_0x7196('0xf'),_0x40e0af,_0x2e3e0e);_0x510c72(_0x2e3e0e);});});}exports[_0x7196('0x18')]=function(_0x32fe2b){var _0x385f2d=this;return new Promise(function(_0x5b716a,_0x4c4f91){return db[_0x7196('0x19')][_0x7196('0x1a')](_0x32fe2b[_0x7196('0x1b')],{'raw':_0x32fe2b['options']?_0x32fe2b[_0x7196('0x1c')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x32fe2b['options']?_0x32fe2b[_0x7196('0x1c')][_0x7196('0x1d')]||null:null,'attributes':_0x32fe2b[_0x7196('0x1c')]?_0x32fe2b['options']['attributes']||null:null,'limit':_0x32fe2b[_0x7196('0x1c')]?_0x32fe2b[_0x7196('0x1c')]['limit']||null:null})[_0x7196('0xd')](function(_0x27ff84){logger[_0x7196('0xe')](_0x7196('0x18'),_0x32fe2b);logger[_0x7196('0x1e')]('UpdateVoiceRecording',_0x32fe2b,JSON[_0x7196('0x12')](_0x27ff84));_0x5b716a(_0x27ff84);})['catch'](function(_0x3ce9a0){logger[_0x7196('0x13')](_0x7196('0x18'),_0x3ce9a0[_0x7196('0x15')],_0x32fe2b);_0x4c4f91(_0x385f2d[_0x7196('0x13')](0x1f4,_0x3ce9a0[_0x7196('0x15')]));});});};exports['CreateVoiceRecording']=function(_0x57c404){var _0x1482e5=this;return new Promise(function(_0x2d284f,_0x184c09){var _0x4e878f=require('../../components/encryptor');var _0x41cfd2;return db[_0x7196('0x1f')][_0x7196('0x20')]({'attributes':['id','callRecordingEncryption'],'where':{'id':0x1},'raw':!![]})[_0x7196('0xd')](function(_0x4ecea1){_0x41cfd2=_0x4ecea1;return db[_0x7196('0x19')]['create'](_0x57c404[_0x7196('0x1b')]);})[_0x7196('0xd')](function(_0x1257ad){if(_0x41cfd2['callRecordingEncryption']&&fs[_0x7196('0x21')](_0x1257ad[_0x7196('0x22')])){var _0x2f9583=util[_0x7196('0x23')]('%s.cypher',_0x1257ad[_0x7196('0x22')]);return _0x4e878f[_0x7196('0x24')](_0x1257ad[_0x7196('0x22')],_0x2f9583,config[_0x7196('0x25')][_0x7196('0x26')])[_0x7196('0xd')](function(){fs[_0x7196('0x27')](_0x1257ad[_0x7196('0x22')]);logger[_0x7196('0xe')](_0x7196('0x28'));return _0x1257ad;});}return _0x1257ad;})[_0x7196('0xd')](function(_0x54e46b){logger[_0x7196('0xe')]('CreateVoiceRecording',_0x57c404);logger[_0x7196('0x1e')]('CreateVoiceRecording',_0x57c404,JSON[_0x7196('0x12')](_0x54e46b));_0x2d284f(_0x54e46b);})[_0x7196('0x17')](function(_0x5616ed){logger[_0x7196('0x13')](_0x7196('0x29'),_0x5616ed[_0x7196('0x15')],_0x57c404);_0x184c09(_0x1482e5[_0x7196('0x13')](0x1f4,_0x5616ed[_0x7196('0x15')]));});});}; \ No newline at end of file +var _0x3d04=['result','VoiceRecording','body','options','raw','where','attributes','limit','UpdateVoiceRecording','debug','catch','CreateVoiceRecording','Setting','findOne','callRecordingEncryption','format','%s.cypher','value','encryptFile','recording','unlink','CreateVoiceRecording\x20file\x20encrypted','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then','request\x20sent','stringify','error','VoiceRecording,\x20%s,\x20%s','message','info'];(function(_0x51bb38,_0x4e57a0){var _0x51c09b=function(_0x3321e2){while(--_0x3321e2){_0x51bb38['push'](_0x51bb38['shift']());}};_0x51c09b(++_0x4e57a0);}(_0x3d04,0xbe));var _0x43d0=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x3d04[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0x43d0('0x0'));var util=require(_0x43d0('0x1'));var moment=require(_0x43d0('0x2'));var BPromise=require(_0x43d0('0x3'));var rs=require(_0x43d0('0x4'));var fs=require('fs');var Redis=require(_0x43d0('0x5'));var db=require(_0x43d0('0x6'))['db'];var utils=require(_0x43d0('0x7'));var logger=require('../../config/logger')(_0x43d0('0x8'));var config=require(_0x43d0('0x9'));var jayson=require(_0x43d0('0xa'));var client=jayson[_0x43d0('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x484271,_0x50919e,_0x5efb95){return new BPromise(function(_0x457550,_0x3344d3){return client[_0x43d0('0xc')](_0x484271,_0x5efb95)[_0x43d0('0xd')](function(_0x44a763){logger['info']('VoiceRecording,\x20%s,\x20%s',_0x50919e,_0x43d0('0xe'));logger['debug']('VoiceRecording,\x20%s,\x20%s,\x20%s',_0x50919e,_0x43d0('0xe'),JSON[_0x43d0('0xf')](_0x44a763));if(_0x44a763[_0x43d0('0x10')]){if(_0x44a763[_0x43d0('0x10')]['code']===0x1f4){logger[_0x43d0('0x10')](_0x43d0('0x11'),_0x50919e,_0x44a763['error'][_0x43d0('0x12')]);return _0x3344d3(_0x44a763[_0x43d0('0x10')][_0x43d0('0x12')]);}logger['error'](_0x43d0('0x11'),_0x50919e,_0x44a763[_0x43d0('0x10')][_0x43d0('0x12')]);return _0x457550(_0x44a763['error'][_0x43d0('0x12')]);}else{logger[_0x43d0('0x13')](_0x43d0('0x11'),_0x50919e,_0x43d0('0xe'));_0x457550(_0x44a763[_0x43d0('0x14')]['message']);}})['catch'](function(_0x1e91a7){logger[_0x43d0('0x10')](_0x43d0('0x11'),_0x50919e,_0x1e91a7);_0x3344d3(_0x1e91a7);});});}exports['UpdateVoiceRecording']=function(_0x2c641e){var _0x532402=this;return new Promise(function(_0x2c9d06,_0x468ca2){return db[_0x43d0('0x15')]['update'](_0x2c641e[_0x43d0('0x16')],{'raw':_0x2c641e[_0x43d0('0x17')]?_0x2c641e['options'][_0x43d0('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2c641e[_0x43d0('0x17')]?_0x2c641e[_0x43d0('0x17')][_0x43d0('0x19')]||null:null,'attributes':_0x2c641e[_0x43d0('0x17')]?_0x2c641e[_0x43d0('0x17')][_0x43d0('0x1a')]||null:null,'limit':_0x2c641e[_0x43d0('0x17')]?_0x2c641e[_0x43d0('0x17')][_0x43d0('0x1b')]||null:null})[_0x43d0('0xd')](function(_0x19d2ff){logger[_0x43d0('0x13')](_0x43d0('0x1c'),_0x2c641e);logger[_0x43d0('0x1d')]('UpdateVoiceRecording',_0x2c641e,JSON[_0x43d0('0xf')](_0x19d2ff));_0x2c9d06(_0x19d2ff);})[_0x43d0('0x1e')](function(_0x509041){logger[_0x43d0('0x10')]('UpdateVoiceRecording',_0x509041[_0x43d0('0x12')],_0x2c641e);_0x468ca2(_0x532402[_0x43d0('0x10')](0x1f4,_0x509041['message']));});});};exports[_0x43d0('0x1f')]=function(_0x238c64){var _0x5ac4c0=this;return new Promise(function(_0x12df30,_0x4692bc){var _0x22ae3c=require('../../components/encryptor');var _0x447725;return db[_0x43d0('0x20')][_0x43d0('0x21')]({'attributes':['id',_0x43d0('0x22')],'where':{'id':0x1},'raw':!![]})[_0x43d0('0xd')](function(_0x440ecb){_0x447725=_0x440ecb;return db[_0x43d0('0x15')]['create'](_0x238c64[_0x43d0('0x16')]);})[_0x43d0('0xd')](function(_0x6bc471){if(_0x447725['callRecordingEncryption']&&fs['existsSync'](_0x6bc471['value'])){var _0x3c1ea3=util[_0x43d0('0x23')](_0x43d0('0x24'),_0x6bc471[_0x43d0('0x25')]);return _0x22ae3c[_0x43d0('0x26')](_0x6bc471[_0x43d0('0x25')],_0x3c1ea3,config['secrets'][_0x43d0('0x27')])[_0x43d0('0xd')](function(){fs[_0x43d0('0x28')](_0x6bc471[_0x43d0('0x25')]);logger[_0x43d0('0x13')](_0x43d0('0x29'));return _0x6bc471;});}return _0x6bc471;})[_0x43d0('0xd')](function(_0x1bdd74){logger[_0x43d0('0x13')](_0x43d0('0x1f'),_0x238c64);logger[_0x43d0('0x1d')]('CreateVoiceRecording',_0x238c64,JSON[_0x43d0('0xf')](_0x1bdd74));_0x12df30(_0x1bdd74);})[_0x43d0('0x1e')](function(_0x45ec78){logger[_0x43d0('0x10')]('CreateVoiceRecording',_0x45ec78[_0x43d0('0x12')],_0x238c64);_0x4692bc(_0x5ac4c0['error'](0x1f4,_0x45ec78[_0x43d0('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/index.js b/server/api/voiceTransferReport/index.js index fb11b98..e0f15e1 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 _0x292c=['path','connect-timeout','express','fs-extra','../../components/interaction/service','get','isAuthenticated','index','/describe','describe','/:id','post','put','update','destroy','multer','util'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x292c,0xec));var _0xc292=function(_0x2b45b5,_0x474458){_0x2b45b5=_0x2b45b5-0x0;var _0x1d9c06=_0x292c[_0x2b45b5];return _0x1d9c06;};'use strict';var multer=require(_0xc292('0x0'));var util=require(_0xc292('0x1'));var path=require(_0xc292('0x2'));var timeout=require(_0xc292('0x3'));var express=require(_0xc292('0x4'));var router=express['Router']();var fs_extra=require(_0xc292('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xc292('0x6'));var config=require('../../config/environment');var controller=require('./voiceTransferReport.controller');router[_0xc292('0x7')]('/',auth[_0xc292('0x8')](),controller[_0xc292('0x9')]);router[_0xc292('0x7')](_0xc292('0xa'),auth[_0xc292('0x8')](),controller[_0xc292('0xb')]);router[_0xc292('0x7')](_0xc292('0xc'),auth['isAuthenticated'](),controller['show']);router[_0xc292('0xd')]('/',auth[_0xc292('0x8')](),controller['create']);router[_0xc292('0xe')]('/:id',auth[_0xc292('0x8')](),controller[_0xc292('0xf')]);router['delete']('/:id',auth[_0xc292('0x8')](),controller[_0xc292('0x10')]);module['exports']=router; \ No newline at end of file +var _0x8c94=['/:id','show','post','create','put','update','delete','destroy','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceTransferReport.controller','isAuthenticated','index','get','/describe'];(function(_0x166d93,_0x301f09){var _0xba708=function(_0x349bf7){while(--_0x349bf7){_0x166d93['push'](_0x166d93['shift']());}};_0xba708(++_0x301f09);}(_0x8c94,0xb0));var _0x48c9=function(_0x2d7f0e,_0x3e6fbd){_0x2d7f0e=_0x2d7f0e-0x0;var _0x110b07=_0x8c94[_0x2d7f0e];return _0x110b07;};'use strict';var multer=require(_0x48c9('0x0'));var util=require(_0x48c9('0x1'));var path=require(_0x48c9('0x2'));var timeout=require(_0x48c9('0x3'));var express=require('express');var router=express[_0x48c9('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x48c9('0x5'));var interaction=require(_0x48c9('0x6'));var config=require(_0x48c9('0x7'));var controller=require(_0x48c9('0x8'));router['get']('/',auth[_0x48c9('0x9')](),controller[_0x48c9('0xa')]);router[_0x48c9('0xb')](_0x48c9('0xc'),auth[_0x48c9('0x9')](),controller['describe']);router[_0x48c9('0xb')](_0x48c9('0xd'),auth[_0x48c9('0x9')](),controller[_0x48c9('0xe')]);router[_0x48c9('0xf')]('/',auth[_0x48c9('0x9')](),controller[_0x48c9('0x10')]);router[_0x48c9('0x11')](_0x48c9('0xd'),auth['isAuthenticated'](),controller[_0x48c9('0x12')]);router[_0x48c9('0x13')](_0x48c9('0xd'),auth[_0x48c9('0x9')](),controller[_0x48c9('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.attributes.js b/server/api/voiceTransferReport/voiceTransferReport.attributes.js index 617f5b5..920cb16 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 _0xfcfa=['blind','attended','STRING','Yes','moment','ENUM'];(function(_0x33ca5d,_0x4bbfd1){var _0x574890=function(_0x55e4f4){while(--_0x55e4f4){_0x33ca5d['push'](_0x33ca5d['shift']());}};_0x574890(++_0x4bbfd1);}(_0xfcfa,0x106));var _0xafcf=function(_0x127bf7,_0x5a1071){_0x127bf7=_0x127bf7-0x0;var _0x271882=_0xfcfa[_0x127bf7];return _0x271882;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xafcf('0x0'));module['exports']={'type':{'type':Sequelize[_0xafcf('0x1')](_0xafcf('0x2'),_0xafcf('0x3'))},'result':{'type':Sequelize[_0xafcf('0x4')]},'transfererchannel':{'type':Sequelize['STRING']},'transferercalleridnum':{'type':Sequelize[_0xafcf('0x4')]},'transferercalleridname':{'type':Sequelize[_0xafcf('0x4')]},'transfererconnectedlinenum':{'type':Sequelize[_0xafcf('0x4')]},'transfererconnectedlinename':{'type':Sequelize[_0xafcf('0x4')]},'transfereraccountcode':{'type':Sequelize[_0xafcf('0x4')]},'transferercontext':{'type':Sequelize[_0xafcf('0x4')]},'transfererexten':{'type':Sequelize[_0xafcf('0x4')]},'transfererlinkedid':{'type':Sequelize[_0xafcf('0x4')]},'transfereechannel':{'type':Sequelize[_0xafcf('0x4')]},'transfereecalleridnum':{'type':Sequelize[_0xafcf('0x4')]},'transfereecalleridname':{'type':Sequelize['STRING']},'transfereeconnectedlinenum':{'type':Sequelize[_0xafcf('0x4')]},'transfereeconnectedlinename':{'type':Sequelize['STRING']},'transfereeaccountcode':{'type':Sequelize[_0xafcf('0x4')]},'transfereecontext':{'type':Sequelize['STRING']},'transfereeexten':{'type':Sequelize[_0xafcf('0x4')]},'transfereelinkedid':{'type':Sequelize['STRING']},'isexternal':{'type':Sequelize[_0xafcf('0x1')](_0xafcf('0x5'),'No')},'context':{'type':Sequelize[_0xafcf('0x4')]},'extension':{'type':Sequelize[_0xafcf('0x4')]}}; \ No newline at end of file +var _0x1390=['ENUM','blind','attended','STRING','sequelize','moment','exports'];(function(_0x485c9f,_0x399a20){var _0x2ba76e=function(_0x3598d4){while(--_0x3598d4){_0x485c9f['push'](_0x485c9f['shift']());}};_0x2ba76e(++_0x399a20);}(_0x1390,0x170));var _0x0139=function(_0x4ededb,_0x15766a){_0x4ededb=_0x4ededb-0x0;var _0xa5ed05=_0x1390[_0x4ededb];return _0xa5ed05;};'use strict';var Sequelize=require(_0x0139('0x0'));var moment=require(_0x0139('0x1'));module[_0x0139('0x2')]={'type':{'type':Sequelize[_0x0139('0x3')](_0x0139('0x4'),_0x0139('0x5'))},'result':{'type':Sequelize[_0x0139('0x6')]},'transfererchannel':{'type':Sequelize[_0x0139('0x6')]},'transferercalleridnum':{'type':Sequelize[_0x0139('0x6')]},'transferercalleridname':{'type':Sequelize[_0x0139('0x6')]},'transfererconnectedlinenum':{'type':Sequelize['STRING']},'transfererconnectedlinename':{'type':Sequelize['STRING']},'transfereraccountcode':{'type':Sequelize['STRING']},'transferercontext':{'type':Sequelize[_0x0139('0x6')]},'transfererexten':{'type':Sequelize[_0x0139('0x6')]},'transfererlinkedid':{'type':Sequelize[_0x0139('0x6')]},'transfereechannel':{'type':Sequelize['STRING']},'transfereecalleridnum':{'type':Sequelize[_0x0139('0x6')]},'transfereecalleridname':{'type':Sequelize[_0x0139('0x6')]},'transfereeconnectedlinenum':{'type':Sequelize[_0x0139('0x6')]},'transfereeconnectedlinename':{'type':Sequelize[_0x0139('0x6')]},'transfereeaccountcode':{'type':Sequelize['STRING']},'transfereecontext':{'type':Sequelize[_0x0139('0x6')]},'transfereeexten':{'type':Sequelize[_0x0139('0x6')]},'transfereelinkedid':{'type':Sequelize['STRING']},'isexternal':{'type':Sequelize[_0x0139('0x3')]('Yes','No')},'context':{'type':Sequelize[_0x0139('0x6')]},'extension':{'type':Sequelize[_0x0139('0x6')]}}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.controller.js b/server/api/voiceTransferReport/voiceTransferReport.controller.js index 0bc3a77..1b6fd49 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 _0xcf1b=['../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','VoiceTransferReport','rawAttributes','fieldName','type','model','map','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','params','include','create','body','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api'];(function(_0x4b5c47,_0x519742){var _0x86da02=function(_0xd90ab6){while(--_0xd90ab6){_0x4b5c47['push'](_0x4b5c47['shift']());}};_0x86da02(++_0x519742);}(_0xcf1b,0x166));var _0xbcf1=function(_0x8ee269,_0xc2f97){_0x8ee269=_0x8ee269-0x0;var _0x126a80=_0xcf1b[_0x8ee269];return _0x126a80;};'use strict';var emlformat=require(_0xbcf1('0x0'));var rimraf=require(_0xbcf1('0x1'));var zipdir=require(_0xbcf1('0x2'));var jsonpatch=require(_0xbcf1('0x3'));var rp=require(_0xbcf1('0x4'));var moment=require(_0xbcf1('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xbcf1('0x6'));var util=require(_0xbcf1('0x7'));var path=require('path');var sox=require(_0xbcf1('0x8'));var csv=require(_0xbcf1('0x9'));var ejs=require(_0xbcf1('0xa'));var fs=require('fs');var fs_extra=require(_0xbcf1('0xb'));var _=require(_0xbcf1('0xc'));var squel=require(_0xbcf1('0xd'));var crypto=require(_0xbcf1('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xbcf1('0xf'));var toCsv=require(_0xbcf1('0x9'));var querystring=require(_0xbcf1('0x10'));var Papa=require('papaparse');var Redis=require(_0xbcf1('0x11'));var authService=require(_0xbcf1('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbcf1('0x13'));var logger=require(_0xbcf1('0x14'))(_0xbcf1('0x15'));var utils=require(_0xbcf1('0x16'));var config=require(_0xbcf1('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xbcf1('0x18'))['db'];function respondWithStatusCode(_0x26d3f3,_0x27d810){_0x27d810=_0x27d810||0xcc;return function(_0x27a98a){if(_0x27a98a){return _0x26d3f3[_0xbcf1('0x19')](_0x27d810);}return _0x26d3f3[_0xbcf1('0x1a')](_0x27d810)[_0xbcf1('0x1b')]();};}function respondWithResult(_0xe533f8,_0x5c9409){_0x5c9409=_0x5c9409||0xc8;return function(_0x1bbbfd){if(_0x1bbbfd){return _0xe533f8['status'](_0x5c9409)[_0xbcf1('0x1c')](_0x1bbbfd);}};}function respondWithFilteredResult(_0x35f3f5,_0x37e68d){return function(_0x1f6f53){if(_0x1f6f53){var _0x48792f=typeof _0x37e68d[_0xbcf1('0x1d')]===_0xbcf1('0x1e')&&typeof _0x37e68d['limit']===_0xbcf1('0x1e');var _0x10c51f=_0x1f6f53[_0xbcf1('0x1f')];var _0x4a09fa=_0x48792f?0x0:_0x37e68d['offset'];var _0x58f870=_0x48792f?_0x1f6f53[_0xbcf1('0x1f')]:_0x37e68d['offset']+_0x37e68d[_0xbcf1('0x20')];var _0x5d939a;if(_0x58f870>=_0x10c51f){_0x58f870=_0x10c51f;_0x5d939a=0xc8;}else{_0x5d939a=0xce;}_0x35f3f5[_0xbcf1('0x1a')](_0x5d939a);return _0x35f3f5[_0xbcf1('0x21')](_0xbcf1('0x22'),_0x4a09fa+'-'+_0x58f870+'/'+_0x10c51f)[_0xbcf1('0x1c')](_0x1f6f53);}return null;};}function patchUpdates(_0x1d56f8){return function(_0x5ee540){try{jsonpatch[_0xbcf1('0x23')](_0x5ee540,_0x1d56f8,!![]);}catch(_0x307cac){return BPromise[_0xbcf1('0x24')](_0x307cac);}return _0x5ee540[_0xbcf1('0x25')]();};}function saveUpdates(_0x1d77ae,_0x398e38){return function(_0x39e9b6){if(_0x39e9b6){return _0x39e9b6[_0xbcf1('0x26')](_0x1d77ae)[_0xbcf1('0x27')](function(_0x4b77a7){return _0x4b77a7;});}return null;};}function removeEntity(_0x56cf27,_0x1ea677){return function(_0x408393){if(_0x408393){return _0x408393[_0xbcf1('0x28')]()[_0xbcf1('0x27')](function(){_0x56cf27['status'](0xcc)[_0xbcf1('0x1b')]();});}};}function handleEntityNotFound(_0x1cafe3,_0x14f8ad){return function(_0x52ea47){if(!_0x52ea47){_0x1cafe3['sendStatus'](0x194);}return _0x52ea47;};}function handleError(_0x3cb5b5,_0x2e1804){_0x2e1804=_0x2e1804||0x1f4;return function(_0x2a265d){logger['error'](_0x2a265d[_0xbcf1('0x29')]);if(_0x2a265d[_0xbcf1('0x2a')]){delete _0x2a265d[_0xbcf1('0x2a')];}_0x3cb5b5[_0xbcf1('0x1a')](_0x2e1804)[_0xbcf1('0x2b')](_0x2a265d);};}exports['index']=function(_0x3f90ae,_0x256e02){var _0x3982e2={},_0x2bfbed={},_0x3fac8c={'count':0x0,'rows':[]};var _0x3ca809=_['map'](db[_0xbcf1('0x2c')][_0xbcf1('0x2d')],function(_0x45c28c){return{'name':_0x45c28c[_0xbcf1('0x2e')],'type':_0x45c28c[_0xbcf1('0x2f')]['key']};});_0x2bfbed[_0xbcf1('0x30')]=_[_0xbcf1('0x31')](_0x3ca809,_0xbcf1('0x2a'));_0x2bfbed[_0xbcf1('0x32')]=_[_0xbcf1('0x33')](_0x3f90ae['query']);_0x2bfbed[_0xbcf1('0x34')]=_['intersection'](_0x2bfbed[_0xbcf1('0x30')],_0x2bfbed[_0xbcf1('0x32')]);_0x3982e2[_0xbcf1('0x35')]=_[_0xbcf1('0x36')](_0x2bfbed[_0xbcf1('0x30')],qs[_0xbcf1('0x37')](_0x3f90ae[_0xbcf1('0x32')][_0xbcf1('0x37')]));_0x3982e2[_0xbcf1('0x35')]=_0x3982e2['attributes'][_0xbcf1('0x38')]?_0x3982e2['attributes']:_0x2bfbed[_0xbcf1('0x30')];if(!_0x3f90ae[_0xbcf1('0x32')][_0xbcf1('0x39')](_0xbcf1('0x3a'))){_0x3982e2[_0xbcf1('0x20')]=qs[_0xbcf1('0x20')](_0x3f90ae['query'][_0xbcf1('0x20')]);_0x3982e2['offset']=qs[_0xbcf1('0x1d')](_0x3f90ae[_0xbcf1('0x32')][_0xbcf1('0x1d')]);}_0x3982e2[_0xbcf1('0x3b')]=qs[_0xbcf1('0x3c')](_0x3f90ae[_0xbcf1('0x32')][_0xbcf1('0x3c')]);_0x3982e2[_0xbcf1('0x3d')]=qs[_0xbcf1('0x34')](_['pick'](_0x3f90ae[_0xbcf1('0x32')],_0x2bfbed[_0xbcf1('0x34')]),_0x3ca809);if(_0x3f90ae[_0xbcf1('0x32')][_0xbcf1('0x3e')]){_0x3982e2[_0xbcf1('0x3d')]=_[_0xbcf1('0x3f')](_0x3982e2[_0xbcf1('0x3d')],{'$or':_[_0xbcf1('0x31')](_0x3ca809,function(_0x12553c){if(_0x12553c[_0xbcf1('0x2f')]!==_0xbcf1('0x40')){var _0x5d46f1={};_0x5d46f1[_0x12553c[_0xbcf1('0x2a')]]={'$like':'%'+_0x3f90ae[_0xbcf1('0x32')][_0xbcf1('0x3e')]+'%'};return _0x5d46f1;}})});}_0x3982e2=_[_0xbcf1('0x3f')]({},_0x3982e2,_0x3f90ae[_0xbcf1('0x41')]);var _0x1da5a8={'where':_0x3982e2[_0xbcf1('0x3d')]};return db[_0xbcf1('0x2c')][_0xbcf1('0x1f')](_0x1da5a8)[_0xbcf1('0x27')](function(_0x223477){_0x3fac8c[_0xbcf1('0x1f')]=_0x223477;if(_0x3f90ae[_0xbcf1('0x32')][_0xbcf1('0x42')]){_0x3982e2['include']=[{'all':!![]}];}return db[_0xbcf1('0x2c')][_0xbcf1('0x43')](_0x3982e2);})['then'](function(_0x55fbbf){_0x3fac8c[_0xbcf1('0x44')]=_0x55fbbf;return _0x3fac8c;})[_0xbcf1('0x27')](respondWithFilteredResult(_0x256e02,_0x3982e2))[_0xbcf1('0x45')](handleError(_0x256e02,null));};exports['show']=function(_0x1d0a6b,_0x3b1dfd){var _0x51a6d1={'raw':!![],'where':{'id':_0x1d0a6b[_0xbcf1('0x46')]['id']}},_0x12733d={};_0x12733d[_0xbcf1('0x30')]=_['keys'](db[_0xbcf1('0x2c')][_0xbcf1('0x2d')]);_0x12733d[_0xbcf1('0x32')]=_[_0xbcf1('0x33')](_0x1d0a6b['query']);_0x12733d[_0xbcf1('0x34')]=_[_0xbcf1('0x36')](_0x12733d[_0xbcf1('0x30')],_0x12733d['query']);_0x51a6d1[_0xbcf1('0x35')]=_[_0xbcf1('0x36')](_0x12733d['model'],qs[_0xbcf1('0x37')](_0x1d0a6b[_0xbcf1('0x32')]['fields']));_0x51a6d1[_0xbcf1('0x35')]=_0x51a6d1['attributes'][_0xbcf1('0x38')]?_0x51a6d1['attributes']:_0x12733d[_0xbcf1('0x30')];if(_0x1d0a6b[_0xbcf1('0x32')][_0xbcf1('0x42')]){_0x51a6d1[_0xbcf1('0x47')]=[{'all':!![]}];}_0x51a6d1=_['merge']({},_0x51a6d1,_0x1d0a6b['options']);return db[_0xbcf1('0x2c')]['find'](_0x51a6d1)[_0xbcf1('0x27')](handleEntityNotFound(_0x3b1dfd,null))['then'](respondWithResult(_0x3b1dfd,null))[_0xbcf1('0x45')](handleError(_0x3b1dfd,null));};exports[_0xbcf1('0x48')]=function(_0x564833,_0x18808){return db[_0xbcf1('0x2c')][_0xbcf1('0x48')](_0x564833[_0xbcf1('0x49')],{})[_0xbcf1('0x27')](respondWithResult(_0x18808,0xc9))[_0xbcf1('0x45')](handleError(_0x18808,null));};exports[_0xbcf1('0x26')]=function(_0xcc45a5,_0x41db46){if(_0xcc45a5['body']['id']){delete _0xcc45a5[_0xbcf1('0x49')]['id'];}return db[_0xbcf1('0x2c')][_0xbcf1('0x4a')]({'where':{'id':_0xcc45a5[_0xbcf1('0x46')]['id']}})[_0xbcf1('0x27')](handleEntityNotFound(_0x41db46,null))[_0xbcf1('0x27')](saveUpdates(_0xcc45a5[_0xbcf1('0x49')],null))[_0xbcf1('0x27')](respondWithResult(_0x41db46,null))['catch'](handleError(_0x41db46,null));};exports[_0xbcf1('0x28')]=function(_0x1babb6,_0x52b2ef){return db[_0xbcf1('0x2c')][_0xbcf1('0x4a')]({'where':{'id':_0x1babb6['params']['id']}})[_0xbcf1('0x27')](handleEntityNotFound(_0x52b2ef,null))[_0xbcf1('0x27')](removeEntity(_0x52b2ef,null))[_0xbcf1('0x45')](handleError(_0x52b2ef,null));};exports['describe']=function(_0x5b7856,_0x511d66){return db[_0xbcf1('0x2c')][_0xbcf1('0x4b')]()['then'](respondWithResult(_0x511d66,null))[_0xbcf1('0x45')](handleError(_0x511d66,null));}; \ No newline at end of file +var _0xd0e6=['key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','include','findAll','catch','show','params','create','body','find','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','end','undefined','limit','offset','Content-Range','apply','reject','update','then','error','stack','name','status','send','index','map','VoiceTransferReport','rawAttributes','fieldName','type'];(function(_0xa27c7a,_0x48f38a){var _0x538b47=function(_0x173969){while(--_0x173969){_0xa27c7a['push'](_0xa27c7a['shift']());}};_0x538b47(++_0x48f38a);}(_0xd0e6,0xb3));var _0x6d0e=function(_0x2dd324,_0x2d0881){_0x2dd324=_0x2dd324-0x0;var _0x33bc5c=_0xd0e6[_0x2dd324];return _0x33bc5c;};'use strict';var emlformat=require(_0x6d0e('0x0'));var rimraf=require(_0x6d0e('0x1'));var zipdir=require(_0x6d0e('0x2'));var jsonpatch=require(_0x6d0e('0x3'));var rp=require('request-promise');var moment=require(_0x6d0e('0x4'));var BPromise=require(_0x6d0e('0x5'));var Mustache=require(_0x6d0e('0x6'));var util=require('util');var path=require(_0x6d0e('0x7'));var sox=require(_0x6d0e('0x8'));var csv=require(_0x6d0e('0x9'));var ejs=require(_0x6d0e('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x6d0e('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x6d0e('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x6d0e('0x9'));var querystring=require('querystring');var Papa=require(_0x6d0e('0xd'));var Redis=require(_0x6d0e('0xe'));var authService=require(_0x6d0e('0xf'));var qs=require(_0x6d0e('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6d0e('0x11'));var logger=require(_0x6d0e('0x12'))(_0x6d0e('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x6d0e('0x14'));var db=require(_0x6d0e('0x15'))['db'];function respondWithStatusCode(_0x31c522,_0x325796){_0x325796=_0x325796||0xcc;return function(_0x4a6b0d){if(_0x4a6b0d){return _0x31c522[_0x6d0e('0x16')](_0x325796);}return _0x31c522['status'](_0x325796)[_0x6d0e('0x17')]();};}function respondWithResult(_0x5403fa,_0x1f76c9){_0x1f76c9=_0x1f76c9||0xc8;return function(_0x44a90e){if(_0x44a90e){return _0x5403fa['status'](_0x1f76c9)['json'](_0x44a90e);}};}function respondWithFilteredResult(_0x19a83d,_0x8b1daf){return function(_0x1c996e){if(_0x1c996e){var _0xe8fa1f=typeof _0x8b1daf['offset']===_0x6d0e('0x18')&&typeof _0x8b1daf[_0x6d0e('0x19')]===_0x6d0e('0x18');var _0x234f72=_0x1c996e['count'];var _0x507cdc=_0xe8fa1f?0x0:_0x8b1daf[_0x6d0e('0x1a')];var _0x297315=_0xe8fa1f?_0x1c996e['count']:_0x8b1daf[_0x6d0e('0x1a')]+_0x8b1daf['limit'];var _0x22b1df;if(_0x297315>=_0x234f72){_0x297315=_0x234f72;_0x22b1df=0xc8;}else{_0x22b1df=0xce;}_0x19a83d['status'](_0x22b1df);return _0x19a83d['set'](_0x6d0e('0x1b'),_0x507cdc+'-'+_0x297315+'/'+_0x234f72)['json'](_0x1c996e);}return null;};}function patchUpdates(_0xd88560){return function(_0x21b121){try{jsonpatch[_0x6d0e('0x1c')](_0x21b121,_0xd88560,!![]);}catch(_0x10235c){return BPromise[_0x6d0e('0x1d')](_0x10235c);}return _0x21b121['save']();};}function saveUpdates(_0x1eacf2,_0x6a4da1){return function(_0x5ac91f){if(_0x5ac91f){return _0x5ac91f[_0x6d0e('0x1e')](_0x1eacf2)[_0x6d0e('0x1f')](function(_0x55178d){return _0x55178d;});}return null;};}function removeEntity(_0x35a177,_0xd4cbe9){return function(_0x4325cd){if(_0x4325cd){return _0x4325cd['destroy']()[_0x6d0e('0x1f')](function(){_0x35a177['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2c4ae9,_0x567ab9){return function(_0xb93e46){if(!_0xb93e46){_0x2c4ae9[_0x6d0e('0x16')](0x194);}return _0xb93e46;};}function handleError(_0x3f60cf,_0x54e012){_0x54e012=_0x54e012||0x1f4;return function(_0x5649c3){logger[_0x6d0e('0x20')](_0x5649c3[_0x6d0e('0x21')]);if(_0x5649c3[_0x6d0e('0x22')]){delete _0x5649c3['name'];}_0x3f60cf[_0x6d0e('0x23')](_0x54e012)[_0x6d0e('0x24')](_0x5649c3);};}exports[_0x6d0e('0x25')]=function(_0xfd504b,_0x14c80f){var _0xce49ca={},_0x25c271={},_0x58e8d2={'count':0x0,'rows':[]};var _0x56288c=_[_0x6d0e('0x26')](db[_0x6d0e('0x27')][_0x6d0e('0x28')],function(_0x545246){return{'name':_0x545246[_0x6d0e('0x29')],'type':_0x545246[_0x6d0e('0x2a')][_0x6d0e('0x2b')]};});_0x25c271[_0x6d0e('0x2c')]=_[_0x6d0e('0x26')](_0x56288c,_0x6d0e('0x22'));_0x25c271[_0x6d0e('0x2d')]=_[_0x6d0e('0x2e')](_0xfd504b[_0x6d0e('0x2d')]);_0x25c271[_0x6d0e('0x2f')]=_[_0x6d0e('0x30')](_0x25c271[_0x6d0e('0x2c')],_0x25c271[_0x6d0e('0x2d')]);_0xce49ca['attributes']=_[_0x6d0e('0x30')](_0x25c271['model'],qs[_0x6d0e('0x31')](_0xfd504b[_0x6d0e('0x2d')][_0x6d0e('0x31')]));_0xce49ca[_0x6d0e('0x32')]=_0xce49ca[_0x6d0e('0x32')][_0x6d0e('0x33')]?_0xce49ca['attributes']:_0x25c271[_0x6d0e('0x2c')];if(!_0xfd504b[_0x6d0e('0x2d')][_0x6d0e('0x34')](_0x6d0e('0x35'))){_0xce49ca[_0x6d0e('0x19')]=qs[_0x6d0e('0x19')](_0xfd504b[_0x6d0e('0x2d')]['limit']);_0xce49ca[_0x6d0e('0x1a')]=qs[_0x6d0e('0x1a')](_0xfd504b[_0x6d0e('0x2d')][_0x6d0e('0x1a')]);}_0xce49ca[_0x6d0e('0x36')]=qs[_0x6d0e('0x37')](_0xfd504b[_0x6d0e('0x2d')][_0x6d0e('0x37')]);_0xce49ca[_0x6d0e('0x38')]=qs[_0x6d0e('0x2f')](_[_0x6d0e('0x39')](_0xfd504b[_0x6d0e('0x2d')],_0x25c271[_0x6d0e('0x2f')]),_0x56288c);if(_0xfd504b['query'][_0x6d0e('0x3a')]){_0xce49ca[_0x6d0e('0x38')]=_[_0x6d0e('0x3b')](_0xce49ca[_0x6d0e('0x38')],{'$or':_[_0x6d0e('0x26')](_0x56288c,function(_0x1868fb){if(_0x1868fb[_0x6d0e('0x2a')]!==_0x6d0e('0x3c')){var _0x4832eb={};_0x4832eb[_0x1868fb['name']]={'$like':'%'+_0xfd504b[_0x6d0e('0x2d')][_0x6d0e('0x3a')]+'%'};return _0x4832eb;}})});}_0xce49ca=_['merge']({},_0xce49ca,_0xfd504b[_0x6d0e('0x3d')]);var _0x57978d={'where':_0xce49ca[_0x6d0e('0x38')]};return db[_0x6d0e('0x27')][_0x6d0e('0x3e')](_0x57978d)[_0x6d0e('0x1f')](function(_0x4abe97){_0x58e8d2[_0x6d0e('0x3e')]=_0x4abe97;if(_0xfd504b[_0x6d0e('0x2d')][_0x6d0e('0x3f')]){_0xce49ca[_0x6d0e('0x40')]=[{'all':!![]}];}return db[_0x6d0e('0x27')][_0x6d0e('0x41')](_0xce49ca);})[_0x6d0e('0x1f')](function(_0x49c5de){_0x58e8d2['rows']=_0x49c5de;return _0x58e8d2;})[_0x6d0e('0x1f')](respondWithFilteredResult(_0x14c80f,_0xce49ca))[_0x6d0e('0x42')](handleError(_0x14c80f,null));};exports[_0x6d0e('0x43')]=function(_0x567eed,_0x22bd10){var _0x5831fb={'raw':!![],'where':{'id':_0x567eed[_0x6d0e('0x44')]['id']}},_0x52c796={};_0x52c796[_0x6d0e('0x2c')]=_[_0x6d0e('0x2e')](db[_0x6d0e('0x27')]['rawAttributes']);_0x52c796[_0x6d0e('0x2d')]=_[_0x6d0e('0x2e')](_0x567eed['query']);_0x52c796[_0x6d0e('0x2f')]=_[_0x6d0e('0x30')](_0x52c796[_0x6d0e('0x2c')],_0x52c796[_0x6d0e('0x2d')]);_0x5831fb[_0x6d0e('0x32')]=_['intersection'](_0x52c796['model'],qs[_0x6d0e('0x31')](_0x567eed[_0x6d0e('0x2d')][_0x6d0e('0x31')]));_0x5831fb[_0x6d0e('0x32')]=_0x5831fb[_0x6d0e('0x32')][_0x6d0e('0x33')]?_0x5831fb[_0x6d0e('0x32')]:_0x52c796['model'];if(_0x567eed[_0x6d0e('0x2d')][_0x6d0e('0x3f')]){_0x5831fb[_0x6d0e('0x40')]=[{'all':!![]}];}_0x5831fb=_[_0x6d0e('0x3b')]({},_0x5831fb,_0x567eed[_0x6d0e('0x3d')]);return db[_0x6d0e('0x27')]['find'](_0x5831fb)[_0x6d0e('0x1f')](handleEntityNotFound(_0x22bd10,null))['then'](respondWithResult(_0x22bd10,null))['catch'](handleError(_0x22bd10,null));};exports[_0x6d0e('0x45')]=function(_0x91ab2e,_0x45c85d){return db[_0x6d0e('0x27')][_0x6d0e('0x45')](_0x91ab2e[_0x6d0e('0x46')],{})[_0x6d0e('0x1f')](respondWithResult(_0x45c85d,0xc9))[_0x6d0e('0x42')](handleError(_0x45c85d,null));};exports[_0x6d0e('0x1e')]=function(_0x15a942,_0x1d6a42){if(_0x15a942[_0x6d0e('0x46')]['id']){delete _0x15a942[_0x6d0e('0x46')]['id'];}return db[_0x6d0e('0x27')][_0x6d0e('0x47')]({'where':{'id':_0x15a942[_0x6d0e('0x44')]['id']}})['then'](handleEntityNotFound(_0x1d6a42,null))[_0x6d0e('0x1f')](saveUpdates(_0x15a942[_0x6d0e('0x46')],null))[_0x6d0e('0x1f')](respondWithResult(_0x1d6a42,null))[_0x6d0e('0x42')](handleError(_0x1d6a42,null));};exports[_0x6d0e('0x48')]=function(_0x864429,_0x146004){return db[_0x6d0e('0x27')][_0x6d0e('0x47')]({'where':{'id':_0x864429[_0x6d0e('0x44')]['id']}})['then'](handleEntityNotFound(_0x146004,null))[_0x6d0e('0x1f')](removeEntity(_0x146004,null))['catch'](handleError(_0x146004,null));};exports[_0x6d0e('0x49')]=function(_0x1bffe8,_0x111338){return db[_0x6d0e('0x27')][_0x6d0e('0x49')]()[_0x6d0e('0x1f')](respondWithResult(_0x111338,null))[_0x6d0e('0x42')](handleError(_0x111338,null));}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.model.js b/server/api/voiceTransferReport/voiceTransferReport.model.js index 1e056d7..2d3cc9e 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 _0xa2c5=['report_call_transfer','lodash','util','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','./voiceTransferReport.attributes','exports','define','VoiceTransferReport'];(function(_0x4e7abc,_0x2aeca1){var _0x428796=function(_0xa2c1d){while(--_0xa2c1d){_0x4e7abc['push'](_0x4e7abc['shift']());}};_0x428796(++_0x2aeca1);}(_0xa2c5,0x12c));var _0x5a2c=function(_0x2f45ea,_0x15c656){_0x2f45ea=_0x2f45ea-0x0;var _0x485a84=_0xa2c5[_0x2f45ea];return _0x485a84;};'use strict';var _=require(_0x5a2c('0x0'));var util=require(_0x5a2c('0x1'));var logger=require(_0x5a2c('0x2'))('api');var moment=require(_0x5a2c('0x3'));var BPromise=require(_0x5a2c('0x4'));var rp=require(_0x5a2c('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5a2c('0x6'));var config=require(_0x5a2c('0x7'));var attributes=require(_0x5a2c('0x8'));module[_0x5a2c('0x9')]=function(_0x40d570,_0x1fbc92){return _0x40d570[_0x5a2c('0xa')](_0x5a2c('0xb'),attributes,{'tableName':_0x5a2c('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xca8f=['lodash','util','../../config/logger','api','moment','request-promise','../../config/environment','./voiceTransferReport.attributes','define','VoiceTransferReport','report_call_transfer'];(function(_0x2f3d1d,_0x28129e){var _0x89c489=function(_0x25b497){while(--_0x25b497){_0x2f3d1d['push'](_0x2f3d1d['shift']());}};_0x89c489(++_0x28129e);}(_0xca8f,0x113));var _0xfca8=function(_0x4fde08,_0x463a36){_0x4fde08=_0x4fde08-0x0;var _0x12e725=_0xca8f[_0x4fde08];return _0x12e725;};'use strict';var _=require(_0xfca8('0x0'));var util=require(_0xfca8('0x1'));var logger=require(_0xfca8('0x2'))(_0xfca8('0x3'));var moment=require(_0xfca8('0x4'));var BPromise=require('bluebird');var rp=require(_0xfca8('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xfca8('0x6'));var attributes=require(_0xfca8('0x7'));module['exports']=function(_0x5aaf89,_0x3d2230){return _0x5aaf89[_0xfca8('0x8')](_0xfca8('0x9'),attributes,{'tableName':_0xfca8('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 a91e0a4..95aa417 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 _0x4732=['VoiceTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','VoiceTransferReport,\x20%s,\x20%s','message','result','CreateVoiceTransferReport','VoiceTransferReport','create','options','raw','debug','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','request\x20sent'];(function(_0x2abcd4,_0x441c5a){var _0x538b30=function(_0x5f9481){while(--_0x5f9481){_0x2abcd4['push'](_0x2abcd4['shift']());}};_0x538b30(++_0x441c5a);}(_0x4732,0x1ed));var _0x2473=function(_0x5bfa44,_0x76dacc){_0x5bfa44=_0x5bfa44-0x0;var _0x43815f=_0x4732[_0x5bfa44];return _0x43815f;};'use strict';var _=require(_0x2473('0x0'));var util=require(_0x2473('0x1'));var moment=require(_0x2473('0x2'));var BPromise=require(_0x2473('0x3'));var rs=require(_0x2473('0x4'));var fs=require('fs');var Redis=require(_0x2473('0x5'));var db=require(_0x2473('0x6'))['db'];var utils=require(_0x2473('0x7'));var logger=require(_0x2473('0x8'))(_0x2473('0x9'));var config=require(_0x2473('0xa'));var jayson=require(_0x2473('0xb'));var client=jayson['client'][_0x2473('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x3c6e7f,_0x41f92a,_0x2afcfe){return new BPromise(function(_0x4afaa8,_0xbcae69){return client[_0x2473('0xd')](_0x3c6e7f,_0x2afcfe)[_0x2473('0xe')](function(_0x20ab0c){logger[_0x2473('0xf')]('VoiceTransferReport,\x20%s,\x20%s',_0x41f92a,_0x2473('0x10'));logger['debug'](_0x2473('0x11'),_0x41f92a,'request\x20sent',JSON[_0x2473('0x12')](_0x20ab0c));if(_0x20ab0c[_0x2473('0x13')]){if(_0x20ab0c[_0x2473('0x13')]['code']===0x1f4){logger[_0x2473('0x13')](_0x2473('0x14'),_0x41f92a,_0x20ab0c['error']['message']);return _0xbcae69(_0x20ab0c[_0x2473('0x13')]['message']);}logger[_0x2473('0x13')](_0x2473('0x14'),_0x41f92a,_0x20ab0c[_0x2473('0x13')]['message']);return _0x4afaa8(_0x20ab0c[_0x2473('0x13')][_0x2473('0x15')]);}else{logger['info'](_0x2473('0x14'),_0x41f92a,_0x2473('0x10'));_0x4afaa8(_0x20ab0c[_0x2473('0x16')]['message']);}})['catch'](function(_0x47aa37){logger['error'](_0x2473('0x14'),_0x41f92a,_0x47aa37);_0xbcae69(_0x47aa37);});});}exports[_0x2473('0x17')]=function(_0x4df3e0){var _0x38f966=this;return new Promise(function(_0x110b68,_0x14208c){return db[_0x2473('0x18')][_0x2473('0x19')](_0x4df3e0['body'],{'raw':_0x4df3e0['options']?_0x4df3e0[_0x2473('0x1a')][_0x2473('0x1b')]===undefined?!![]:![]:!![]})[_0x2473('0xe')](function(_0x5ac57){logger['info'](_0x2473('0x17'),_0x4df3e0);logger[_0x2473('0x1c')]('CreateVoiceTransferReport',_0x4df3e0,JSON[_0x2473('0x12')](_0x5ac57));_0x110b68(_0x5ac57);})[_0x2473('0x1d')](function(_0xa2632e){logger['error'](_0x2473('0x17'),_0xa2632e[_0x2473('0x15')],_0x4df3e0);_0x14208c(_0x38f966[_0x2473('0x13')](0x1f4,_0xa2632e['message']));});});}; \ No newline at end of file +var _0x4501=['body','options','raw','stringify','catch','util','bluebird','randomstring','ioredis','../../mysqldb','rpc','jayson/promise','client','http','request','then','info','debug','error','code','VoiceTransferReport,\x20%s,\x20%s','message','result','CreateVoiceTransferReport','VoiceTransferReport','create'];(function(_0x400b2b,_0x4b81ea){var _0x2dd26c=function(_0x50dd8f){while(--_0x50dd8f){_0x400b2b['push'](_0x400b2b['shift']());}};_0x2dd26c(++_0x4b81ea);}(_0x4501,0x6d));var _0x1450=function(_0x11cd18,_0xdd14d6){_0x11cd18=_0x11cd18-0x0;var _0x54f6b2=_0x4501[_0x11cd18];return _0x54f6b2;};'use strict';var _=require('lodash');var util=require(_0x1450('0x0'));var moment=require('moment');var BPromise=require(_0x1450('0x1'));var rs=require(_0x1450('0x2'));var fs=require('fs');var Redis=require(_0x1450('0x3'));var db=require(_0x1450('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x1450('0x5'));var config=require('../../config/environment');var jayson=require(_0x1450('0x6'));var client=jayson[_0x1450('0x7')][_0x1450('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x371865,_0xa87477,_0x3a88a5){return new BPromise(function(_0x20895a,_0x2ab7c2){return client[_0x1450('0x9')](_0x371865,_0x3a88a5)[_0x1450('0xa')](function(_0x201af5){logger[_0x1450('0xb')]('VoiceTransferReport,\x20%s,\x20%s',_0xa87477,'request\x20sent');logger[_0x1450('0xc')]('VoiceTransferReport,\x20%s,\x20%s,\x20%s',_0xa87477,'request\x20sent',JSON['stringify'](_0x201af5));if(_0x201af5[_0x1450('0xd')]){if(_0x201af5[_0x1450('0xd')][_0x1450('0xe')]===0x1f4){logger['error'](_0x1450('0xf'),_0xa87477,_0x201af5['error'][_0x1450('0x10')]);return _0x2ab7c2(_0x201af5[_0x1450('0xd')][_0x1450('0x10')]);}logger[_0x1450('0xd')](_0x1450('0xf'),_0xa87477,_0x201af5[_0x1450('0xd')][_0x1450('0x10')]);return _0x20895a(_0x201af5['error'][_0x1450('0x10')]);}else{logger[_0x1450('0xb')](_0x1450('0xf'),_0xa87477,'request\x20sent');_0x20895a(_0x201af5[_0x1450('0x11')][_0x1450('0x10')]);}})['catch'](function(_0x420e9b){logger[_0x1450('0xd')](_0x1450('0xf'),_0xa87477,_0x420e9b);_0x2ab7c2(_0x420e9b);});});}exports[_0x1450('0x12')]=function(_0xcdc80c){var _0xc04d73=this;return new Promise(function(_0x3669ed,_0x2de2fd){return db[_0x1450('0x13')][_0x1450('0x14')](_0xcdc80c[_0x1450('0x15')],{'raw':_0xcdc80c[_0x1450('0x16')]?_0xcdc80c[_0x1450('0x16')][_0x1450('0x17')]===undefined?!![]:![]:!![]})[_0x1450('0xa')](function(_0xe1f367){logger[_0x1450('0xb')](_0x1450('0x12'),_0xcdc80c);logger[_0x1450('0xc')](_0x1450('0x12'),_0xcdc80c,JSON[_0x1450('0x18')](_0xe1f367));_0x3669ed(_0xe1f367);})[_0x1450('0x19')](function(_0x5573b7){logger[_0x1450('0xd')](_0x1450('0x12'),_0x5573b7[_0x1450('0x10')],_0xcdc80c);_0x2de2fd(_0xc04d73['error'](0x1f4,_0x5573b7[_0x1450('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/webbar/index.js b/server/api/webbar/index.js index 6bfeea9..6b534f4 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 _0xb821=['/unhold','unhold','/calls','calls','/transfer','Router','../../components/auth/service','/originate','originate','post','/hangup','isAuthenticated','hangup','/answer','isWebrtcLicence','answer','/hold','hold'];(function(_0x4c0622,_0x5dacaf){var _0x1799d8=function(_0x2ba801){while(--_0x2ba801){_0x4c0622['push'](_0x4c0622['shift']());}};_0x1799d8(++_0x5dacaf);}(_0xb821,0xa7));var _0x1b82=function(_0x5003e6,_0x11a353){_0x5003e6=_0x5003e6-0x0;var _0x1f897e=_0xb821[_0x5003e6];return _0x1f897e;};'use strict';var express=require('express');var router=express[_0x1b82('0x0')]();var auth=require(_0x1b82('0x1'));var controller=require('./webbar.controller');router['post'](_0x1b82('0x2'),auth['isAuthenticated'](),auth['isWebrtcLicence'](),controller[_0x1b82('0x3')]);router[_0x1b82('0x4')](_0x1b82('0x5'),auth[_0x1b82('0x6')](),auth['isWebrtcLicence'](),controller[_0x1b82('0x7')]);router[_0x1b82('0x4')](_0x1b82('0x8'),auth[_0x1b82('0x6')](),auth[_0x1b82('0x9')](),controller[_0x1b82('0xa')]);router[_0x1b82('0x4')](_0x1b82('0xb'),auth[_0x1b82('0x6')](),auth['isWebrtcLicence'](),controller[_0x1b82('0xc')]);router[_0x1b82('0x4')](_0x1b82('0xd'),auth[_0x1b82('0x6')](),auth[_0x1b82('0x9')](),controller[_0x1b82('0xe')]);router[_0x1b82('0x4')](_0x1b82('0xf'),auth['isAuthenticated'](),auth[_0x1b82('0x9')](),controller[_0x1b82('0x10')]);router[_0x1b82('0x4')](_0x1b82('0x11'),auth['isAuthenticated'](),auth[_0x1b82('0x9')](),controller['transfer']);module['exports']=router; \ No newline at end of file +var _0x91a7=['/originate','isWebrtcLicence','/hangup','isAuthenticated','hangup','/answer','answer','post','/hold','/unhold','unhold','/calls','/transfer','transfer','exports','Router','../../components/auth/service','./webbar.controller'];(function(_0x4a450a,_0x54d42f){var _0x28baf9=function(_0x5cb70a){while(--_0x5cb70a){_0x4a450a['push'](_0x4a450a['shift']());}};_0x28baf9(++_0x54d42f);}(_0x91a7,0xe7));var _0x791a=function(_0x29c6bd,_0xf4af22){_0x29c6bd=_0x29c6bd-0x0;var _0x520948=_0x91a7[_0x29c6bd];return _0x520948;};'use strict';var express=require('express');var router=express[_0x791a('0x0')]();var auth=require(_0x791a('0x1'));var controller=require(_0x791a('0x2'));router['post'](_0x791a('0x3'),auth['isAuthenticated'](),auth[_0x791a('0x4')](),controller['originate']);router['post'](_0x791a('0x5'),auth[_0x791a('0x6')](),auth['isWebrtcLicence'](),controller[_0x791a('0x7')]);router['post'](_0x791a('0x8'),auth[_0x791a('0x6')](),auth['isWebrtcLicence'](),controller[_0x791a('0x9')]);router[_0x791a('0xa')](_0x791a('0xb'),auth[_0x791a('0x6')](),auth[_0x791a('0x4')](),controller['hold']);router[_0x791a('0xa')](_0x791a('0xc'),auth['isAuthenticated'](),auth[_0x791a('0x4')](),controller[_0x791a('0xd')]);router[_0x791a('0xa')](_0x791a('0xe'),auth[_0x791a('0x6')](),auth[_0x791a('0x4')](),controller['calls']);router['post'](_0x791a('0xf'),auth[_0x791a('0x6')](),auth['isWebrtcLicence'](),controller[_0x791a('0x10')]);module[_0x791a('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 8fa64bc..e2cbee5 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 _0x98e5=['jayson/promise','client','../../config/logger','redis','localhost','socket.io-emitter','validate','number','userId\x20is\x20required','string','callNumber\x20is\x20required','sessionId\x20is\x20required','info','stringify','emit','log','handleError:','error','stack','name','status','send','NotFound','request','code','message','result','catch','User','findOne','then','VoiceChannels','all','filter','rows','UserId','sessionId','length','\x20not\x20found!','originate','body','userId','callNumber','callerId','entityFound:','user:%s','webbar:originate','json','format','webbar:hangup','hangup\x20executed!','answer\x20fired:','webbar:answer','answer\x20executed!','webbar:hold','hold\x20executed!','unhold','unhold\x20fired:','webbar:unhold','unhold\x20executed!','calls','conference\x20fired:','webbar:conference','conference\x20executed!','transfer','transfer\x20fired:','webbar:transfer','transfer\x20executed!','../../config/environment','util'];(function(_0x3fa0a3,_0x1b6c61){var _0x26264e=function(_0x5b3200){while(--_0x5b3200){_0x3fa0a3['push'](_0x3fa0a3['shift']());}};_0x26264e(++_0x1b6c61);}(_0x98e5,0x8a));var _0x598e=function(_0x4ce80d,_0x4a07e8){_0x4ce80d=_0x4ce80d-0x0;var _0x1251ba=_0x98e5[_0x4ce80d];return _0x1251ba;};'use strict';var path=require('path');var fs=require('fs');var _=require('lodash');var db=require('../../mysqldb')['db'];var config=require(_0x598e('0x0'));var util=require(_0x598e('0x1'));var BPromise=require('bluebird');var jayson=require(_0x598e('0x2'));var amiClient=jayson[_0x598e('0x3')]['http']({'port':0x232a});var logger=require(_0x598e('0x4'))('webbarapi');var Redis=require('ioredis');config[_0x598e('0x5')]=_['defaults'](config[_0x598e('0x5')],{'host':_0x598e('0x6'),'port':0x18eb});var io=require(_0x598e('0x7'))(new Redis(config[_0x598e('0x5')]));var Schema=require(_0x598e('0x8'));var originateValidation=new Schema({'userId':{'type':_0x598e('0x9'),'required':[!![],_0x598e('0xa')]},'callNumber':{'type':_0x598e('0xb'),'required':[!![],_0x598e('0xc')]},'callerId':{'type':_0x598e('0xb')},'callbackUrl':{'type':_0x598e('0xb')}});var hangupValidation=new Schema({'userId':{'type':'number','required':[!![],_0x598e('0xa')]},'sessionId':{'type':_0x598e('0xb'),'required':![]}});var answerValidation=new Schema({'userId':{'type':'number','required':[!![],_0x598e('0xa')]},'sessionId':{'type':'string','required':![]}});var transferValidation=new Schema({'userId':{'type':_0x598e('0x9'),'required':[!![],_0x598e('0xa')]},'sessionId':{'type':_0x598e('0xb'),'required':[!![],_0x598e('0xd')]},'transferNumber':{'type':_0x598e('0xb'),'required':[!![],'transferNumber\x20is\x20required']}});var holdValidation=new Schema({'userId':{'type':_0x598e('0x9'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0x598e('0xb'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':_0x598e('0x9'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0x598e('0xb'),'required':![]}});var callsValidation=new Schema({'userId':{'type':_0x598e('0x9'),'required':[!![],_0x598e('0xa')]}});var conferenceValidation=new Schema({'userId':{'type':_0x598e('0x9'),'required':[!![],_0x598e('0xa')]}});function emit(_0x93ba6c,_0x157bb8,_0x4ed7ad){logger[_0x598e('0xe')](_0x93ba6c,_0x157bb8,JSON[_0x598e('0xf')](_0x4ed7ad));io['to'](_0x93ba6c)[_0x598e('0x10')](_0x157bb8,_0x4ed7ad);}function handleError(_0xa59147){return function(_0x50ffbb){console[_0x598e('0x11')](_0x598e('0x12'),_0x50ffbb,_0x50ffbb instanceof RangeError);logger[_0x598e('0x13')](_0x50ffbb[_0x598e('0x14')]);if(_0x50ffbb instanceof RangeError){if(_0x50ffbb[_0x598e('0x15')]){delete _0x50ffbb[_0x598e('0x15')];}_0xa59147[_0x598e('0x16')](0x194)[_0x598e('0x17')](_0x50ffbb);}else{if(_0x50ffbb[_0x598e('0x15')]){delete _0x50ffbb[_0x598e('0x15')];}_0xa59147[_0x598e('0x16')](0x1f4)[_0x598e('0x17')](_0x50ffbb);}};}function checkError(){return function(_0x128666){if(!_0x128666){throw new RangeError(_0x598e('0x18'));}return _0x128666;};}function respondWithRpcPromise(_0x1b47e9,_0xa7579a){return new BPromise(function(_0x233f16,_0x5b9c3){var _0x4a483b=amiClient;return _0x4a483b[_0x598e('0x19')](_0x1b47e9,_0xa7579a)['then'](function(_0xdec363){if(_0xdec363[_0x598e('0x13')]){if(_0xdec363['error'][_0x598e('0x1a')]===0x1f4){return _0x5b9c3(_0xdec363[_0x598e('0x13')][_0x598e('0x1b')]);}return _0x233f16(_0xdec363[_0x598e('0x13')][_0x598e('0x1b')]);}else{_0x233f16(_0xdec363[_0x598e('0x1c')]);}})[_0x598e('0x1d')](function(_0x2a8fbc){_0x5b9c3(_0x2a8fbc);});});}function getAgent(_0x23dd81){return db[_0x598e('0x1e')][_0x598e('0x1f')]({'where':{'id':_0x23dd81,'role':'agent'}})[_0x598e('0x20')](checkError());}function getAgentCheckSession(_0x534d83,_0x475d3a){return new BPromise(function(_0x25e095,_0x21739a){var _0x49a760=respondWithRpcPromise(_0x598e('0x21'));var _0xc81d68=getAgent(_0x534d83);Promise[_0x598e('0x22')]([_0x49a760,_0xc81d68])[_0x598e('0x20')](function(_0x43ddf0){var _0x5ecac3=_0x43ddf0[0x0];var _0x4fad2d=_0x43ddf0[0x1];var _0x5c541c=_[_0x598e('0x23')](_0x5ecac3[_0x598e('0x24')],function(_0x2ee4a5){return _0x2ee4a5[_0x598e('0x25')]==_0x4fad2d['id']&&_0x2ee4a5[_0x598e('0x26')]==_0x475d3a;});if(_0x5c541c[_0x598e('0x27')]==0x1){_0x25e095(_0x4fad2d);}else{_0x21739a(new RangeError('sessionId\x20'+_0x475d3a+_0x598e('0x28')));}});});}exports[_0x598e('0x29')]=function(_0x9922ca,_0x1e5b3f){logger[_0x598e('0xe')]('originate\x20fired:',_0x9922ca[_0x598e('0x2a')]);var _0x3e05b7=originateValidation[_0x598e('0x8')](_0x9922ca['body']);if(_0x3e05b7[_0x598e('0x27')]>0x0){return _0x1e5b3f[_0x598e('0x16')](0x190)['json'](_0x3e05b7);}var _0x366b23=_0x9922ca[_0x598e('0x2a')][_0x598e('0x2b')];var _0x20ef77=_0x9922ca[_0x598e('0x2a')][_0x598e('0x2c')];var _0x4c4baa=_0x9922ca[_0x598e('0x2a')][_0x598e('0x2d')];var _0x2cce05=_0x9922ca['body']['callbackUrl'];return getAgent(_0x366b23)[_0x598e('0x20')](function(_0x4bef09){logger[_0x598e('0xe')](_0x598e('0x2e'),_0x4bef09['name']);emit(util['format'](_0x598e('0x2f'),_0x4bef09['name']),_0x598e('0x30'),{'callNumber':_0x20ef77,'callerId':_0x4c4baa,'callbackUrl':_0x2cce05});return _0x1e5b3f[_0x598e('0x16')](0xc8)[_0x598e('0x31')]({'error':![],'message':'originate\x20executed!'});})[_0x598e('0x1d')](handleError(_0x1e5b3f));};exports['hangup']=function(_0x4c7c19,_0x26948c){logger[_0x598e('0xe')]('hangup\x20fired:',_0x4c7c19['body']);var _0xa3de11=hangupValidation[_0x598e('0x8')](_0x4c7c19['body']);if(_0xa3de11[_0x598e('0x27')]>0x0){return _0x26948c[_0x598e('0x16')](0x190)[_0x598e('0x31')](_0xa3de11);}var _0x20c522=_0x4c7c19[_0x598e('0x2a')][_0x598e('0x2b')];var _0x88c75f=_0x4c7c19['body'][_0x598e('0x26')];return getAgent(_0x20c522)[_0x598e('0x20')](function(_0x2873ee){logger[_0x598e('0xe')](_0x598e('0x2e'),_0x2873ee[_0x598e('0x15')]);emit(util[_0x598e('0x32')](_0x598e('0x2f'),_0x2873ee[_0x598e('0x15')]),_0x598e('0x33'),{'sessionId':_0x88c75f});return _0x26948c[_0x598e('0x16')](0xc8)[_0x598e('0x31')]({'error':![],'message':_0x598e('0x34')});})['catch'](handleError(_0x26948c));};exports['answer']=function(_0x3629d9,_0x10218f){logger[_0x598e('0xe')](_0x598e('0x35'),_0x3629d9['body']);var _0x3799c7=answerValidation[_0x598e('0x8')](_0x3629d9[_0x598e('0x2a')]);if(_0x3799c7['length']>0x0){return _0x10218f[_0x598e('0x16')](0x190)[_0x598e('0x31')](_0x3799c7);}var _0x1b36c7=_0x3629d9[_0x598e('0x2a')][_0x598e('0x2b')];var _0x19eef9=_0x3629d9[_0x598e('0x2a')][_0x598e('0x26')];return getAgent(_0x1b36c7)[_0x598e('0x20')](function(_0x33ecf9){logger[_0x598e('0xe')]('entityFound:',_0x33ecf9['name']);emit(util['format'](_0x598e('0x2f'),_0x33ecf9[_0x598e('0x15')]),_0x598e('0x36'),{'sessionId':_0x19eef9});return _0x10218f['status'](0xc8)[_0x598e('0x31')]({'error':![],'message':_0x598e('0x37')});})[_0x598e('0x1d')](handleError(_0x10218f));};exports['hold']=function(_0x307d2e,_0x1b405b){logger[_0x598e('0xe')]('hold\x20fired:',_0x307d2e[_0x598e('0x2a')]);var _0x2018d3=holdValidation[_0x598e('0x8')](_0x307d2e[_0x598e('0x2a')]);if(_0x2018d3[_0x598e('0x27')]>0x0){return _0x1b405b[_0x598e('0x16')](0x190)['json'](_0x2018d3);}var _0x2c7c8f=_0x307d2e[_0x598e('0x2a')]['userId'];var _0x3804ea=_0x307d2e[_0x598e('0x2a')][_0x598e('0x26')];return getAgent(_0x2c7c8f)['then'](function(_0x59e67b){logger['info'](_0x598e('0x2e'),_0x59e67b[_0x598e('0x15')]);emit(util['format']('user:%s',_0x59e67b[_0x598e('0x15')]),_0x598e('0x38'),{'sessionId':_0x3804ea});return _0x1b405b['status'](0xc8)['json']({'error':![],'message':_0x598e('0x39')});})[_0x598e('0x1d')](handleError(_0x1b405b));};exports[_0x598e('0x3a')]=function(_0x34a43d,_0x5cbe61){logger['info'](_0x598e('0x3b'),_0x34a43d['body']);var _0x36279f=unholdValidation['validate'](_0x34a43d[_0x598e('0x2a')]);if(_0x36279f[_0x598e('0x27')]>0x0){return _0x5cbe61[_0x598e('0x16')](0x190)[_0x598e('0x31')](_0x36279f);}var _0x40eb24=_0x34a43d[_0x598e('0x2a')][_0x598e('0x2b')];var _0x5b06b5=_0x34a43d[_0x598e('0x2a')][_0x598e('0x26')];return getAgent(_0x40eb24)[_0x598e('0x20')](function(_0x358adf){logger['info'](_0x598e('0x2e'),_0x358adf[_0x598e('0x15')]);emit(util[_0x598e('0x32')](_0x598e('0x2f'),_0x358adf[_0x598e('0x15')]),_0x598e('0x3c'),{'sessionId':_0x5b06b5});return _0x5cbe61[_0x598e('0x16')](0xc8)['json']({'error':![],'message':_0x598e('0x3d')});})[_0x598e('0x1d')](handleError(_0x5cbe61));};exports[_0x598e('0x3e')]=function(_0x32d5fe,_0x5226bc){logger[_0x598e('0xe')]('calls\x20fired:',_0x5226bc['body']);var _0x41dd04=callsValidation[_0x598e('0x8')](_0x32d5fe[_0x598e('0x2a')]);if(_0x41dd04[_0x598e('0x27')]>0x0){return _0x5226bc[_0x598e('0x16')](0x190)[_0x598e('0x31')](_0x41dd04);}var _0x386a55=_0x32d5fe[_0x598e('0x2a')][_0x598e('0x2b')];var _0x253afe=respondWithRpcPromise('VoiceChannels');var _0x4d2162=getAgent(_0x386a55);return Promise[_0x598e('0x22')]([_0x253afe,_0x4d2162])[_0x598e('0x20')](function(_0x3919c4){var _0x279007=_0x3919c4[0x0];var _0x37606d=_0x3919c4[0x1];var _0x15c69d=_[_0x598e('0x23')](_0x279007[_0x598e('0x24')],function(_0x2850d0){return _0x2850d0['UserId']==_0x37606d['id'];});return _0x5226bc['status'](0xc8)[_0x598e('0x31')]({'count':_0x15c69d[_0x598e('0x27')],'rows':_0x15c69d});})[_0x598e('0x1d')](handleError(_0x5226bc));};exports['conference']=function(_0x3d294a,_0x2dd358){logger[_0x598e('0xe')](_0x598e('0x3f'),_0x3d294a['body']);var _0x52bf2d=conferenceValidation['validate'](_0x3d294a[_0x598e('0x2a')]);if(_0x52bf2d['length']>0x0){return _0x2dd358[_0x598e('0x16')](0x190)[_0x598e('0x31')](_0x52bf2d);}var _0x199f45=_0x3d294a[_0x598e('0x2a')][_0x598e('0x2b')];return getAgent(_0x199f45)[_0x598e('0x20')](function(_0x10d836){logger['info'](_0x598e('0x2e'),_0x10d836['name']);emit(util[_0x598e('0x32')]('user:%s',_0x10d836[_0x598e('0x15')]),_0x598e('0x40'));return _0x2dd358[_0x598e('0x16')](0xc8)[_0x598e('0x31')]({'error':![],'message':_0x598e('0x41')});})[_0x598e('0x1d')](handleError(_0x2dd358));};exports[_0x598e('0x42')]=function(_0x1a1673,_0x25933e){logger[_0x598e('0xe')](_0x598e('0x43'),_0x1a1673['body']);var _0x49db94=transferValidation[_0x598e('0x8')](_0x1a1673['body']);if(_0x49db94[_0x598e('0x27')]>0x0){return _0x25933e[_0x598e('0x16')](0x190)['json'](_0x49db94);}var _0x558f88=_0x1a1673[_0x598e('0x2a')]['userId'];var _0x6ed2b6=_0x1a1673[_0x598e('0x2a')][_0x598e('0x26')];var _0x15ed32=_0x1a1673[_0x598e('0x2a')]['transferNumber'];return getAgent(_0x558f88)[_0x598e('0x20')](function(_0x5eaefe){logger[_0x598e('0xe')]('entityFound:',_0x5eaefe[_0x598e('0x15')]);emit(util['format']('user:%s',_0x5eaefe[_0x598e('0x15')]),_0x598e('0x44'),{'sessionId':_0x6ed2b6,'transferNumber':_0x15ed32});return _0x25933e[_0x598e('0x16')](0xc8)[_0x598e('0x31')]({'error':![],'message':_0x598e('0x45')});})['catch'](handleError(_0x25933e));}; \ No newline at end of file +var _0xb07f=['hold','hold\x20fired:','user:%s','webbar:hold','hold\x20executed!','unhold\x20fired:','webbar:unhold','unhold\x20executed!','calls','calls\x20fired:','rows','conference','webbar:conference','conference\x20executed!','transfer','transfer\x20fired:','transferNumber','webbar:transfer','transfer\x20executed!','path','lodash','../../mysqldb','../../config/environment','util','bluebird','jayson/promise','client','http','../../config/logger','webbarapi','redis','defaults','localhost','socket.io-emitter','validate','number','userId\x20is\x20required','string','callNumber\x20is\x20required','sessionId\x20is\x20required','transferNumber\x20is\x20required','info','stringify','log','handleError:','stack','name','send','status','NotFound','request','then','error','message','result','catch','User','agent','VoiceChannels','all','filter','UserId','length','\x20not\x20found!','originate\x20fired:','body','json','userId','callNumber','callerId','entityFound:','format','webbar:originate','hangup','hangup\x20fired:','sessionId','webbar:hangup','hangup\x20executed!','answer','answer\x20fired:','webbar:answer','answer\x20executed!'];(function(_0x8c1005,_0x1f3f16){var _0x175354=function(_0xd0e9c4){while(--_0xd0e9c4){_0x8c1005['push'](_0x8c1005['shift']());}};_0x175354(++_0x1f3f16);}(_0xb07f,0x109));var _0xfb07=function(_0x2ab52c,_0x575679){_0x2ab52c=_0x2ab52c-0x0;var _0x1d8f19=_0xb07f[_0x2ab52c];return _0x1d8f19;};'use strict';var path=require(_0xfb07('0x0'));var fs=require('fs');var _=require(_0xfb07('0x1'));var db=require(_0xfb07('0x2'))['db'];var config=require(_0xfb07('0x3'));var util=require(_0xfb07('0x4'));var BPromise=require(_0xfb07('0x5'));var jayson=require(_0xfb07('0x6'));var amiClient=jayson[_0xfb07('0x7')][_0xfb07('0x8')]({'port':0x232a});var logger=require(_0xfb07('0x9'))(_0xfb07('0xa'));var Redis=require('ioredis');config[_0xfb07('0xb')]=_[_0xfb07('0xc')](config[_0xfb07('0xb')],{'host':_0xfb07('0xd'),'port':0x18eb});var io=require(_0xfb07('0xe'))(new Redis(config[_0xfb07('0xb')]));var Schema=require(_0xfb07('0xf'));var originateValidation=new Schema({'userId':{'type':_0xfb07('0x10'),'required':[!![],_0xfb07('0x11')]},'callNumber':{'type':_0xfb07('0x12'),'required':[!![],_0xfb07('0x13')]},'callerId':{'type':_0xfb07('0x12')},'callbackUrl':{'type':'string'}});var hangupValidation=new Schema({'userId':{'type':'number','required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0xfb07('0x12'),'required':![]}});var answerValidation=new Schema({'userId':{'type':_0xfb07('0x10'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0xfb07('0x12'),'required':![]}});var transferValidation=new Schema({'userId':{'type':_0xfb07('0x10'),'required':[!![],_0xfb07('0x11')]},'sessionId':{'type':_0xfb07('0x12'),'required':[!![],_0xfb07('0x14')]},'transferNumber':{'type':_0xfb07('0x12'),'required':[!![],_0xfb07('0x15')]}});var holdValidation=new Schema({'userId':{'type':'number','required':[!![],_0xfb07('0x11')]},'sessionId':{'type':_0xfb07('0x12'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':_0xfb07('0x10'),'required':[!![],_0xfb07('0x11')]},'sessionId':{'type':_0xfb07('0x12'),'required':![]}});var callsValidation=new Schema({'userId':{'type':_0xfb07('0x10'),'required':[!![],_0xfb07('0x11')]}});var conferenceValidation=new Schema({'userId':{'type':_0xfb07('0x10'),'required':[!![],_0xfb07('0x11')]}});function emit(_0x6a14e0,_0x3dde76,_0x1cfc43){logger[_0xfb07('0x16')](_0x6a14e0,_0x3dde76,JSON[_0xfb07('0x17')](_0x1cfc43));io['to'](_0x6a14e0)['emit'](_0x3dde76,_0x1cfc43);}function handleError(_0x57fc39){return function(_0x3e747e){console[_0xfb07('0x18')](_0xfb07('0x19'),_0x3e747e,_0x3e747e instanceof RangeError);logger['error'](_0x3e747e[_0xfb07('0x1a')]);if(_0x3e747e instanceof RangeError){if(_0x3e747e[_0xfb07('0x1b')]){delete _0x3e747e['name'];}_0x57fc39['status'](0x194)[_0xfb07('0x1c')](_0x3e747e);}else{if(_0x3e747e[_0xfb07('0x1b')]){delete _0x3e747e[_0xfb07('0x1b')];}_0x57fc39[_0xfb07('0x1d')](0x1f4)[_0xfb07('0x1c')](_0x3e747e);}};}function checkError(){return function(_0x323bec){if(!_0x323bec){throw new RangeError(_0xfb07('0x1e'));}return _0x323bec;};}function respondWithRpcPromise(_0x23c2be,_0x19ad99){return new BPromise(function(_0x578bb2,_0x45806a){var _0x56d0c4=amiClient;return _0x56d0c4[_0xfb07('0x1f')](_0x23c2be,_0x19ad99)[_0xfb07('0x20')](function(_0x428c85){if(_0x428c85[_0xfb07('0x21')]){if(_0x428c85[_0xfb07('0x21')]['code']===0x1f4){return _0x45806a(_0x428c85[_0xfb07('0x21')][_0xfb07('0x22')]);}return _0x578bb2(_0x428c85[_0xfb07('0x21')][_0xfb07('0x22')]);}else{_0x578bb2(_0x428c85[_0xfb07('0x23')]);}})[_0xfb07('0x24')](function(_0x531346){_0x45806a(_0x531346);});});}function getAgent(_0x36d6f3){return db[_0xfb07('0x25')]['findOne']({'where':{'id':_0x36d6f3,'role':_0xfb07('0x26')}})[_0xfb07('0x20')](checkError());}function getAgentCheckSession(_0xe813a7,_0x149ac0){return new BPromise(function(_0x46927a,_0x2b0650){var _0x20f01a=respondWithRpcPromise(_0xfb07('0x27'));var _0x95f1d=getAgent(_0xe813a7);Promise[_0xfb07('0x28')]([_0x20f01a,_0x95f1d])[_0xfb07('0x20')](function(_0x49b06e){var _0x217932=_0x49b06e[0x0];var _0x1e4cb8=_0x49b06e[0x1];var _0x36787a=_[_0xfb07('0x29')](_0x217932['rows'],function(_0x46d57e){return _0x46d57e[_0xfb07('0x2a')]==_0x1e4cb8['id']&&_0x46d57e['sessionId']==_0x149ac0;});if(_0x36787a[_0xfb07('0x2b')]==0x1){_0x46927a(_0x1e4cb8);}else{_0x2b0650(new RangeError('sessionId\x20'+_0x149ac0+_0xfb07('0x2c')));}});});}exports['originate']=function(_0x56b48c,_0x4a8d4c){logger[_0xfb07('0x16')](_0xfb07('0x2d'),_0x56b48c[_0xfb07('0x2e')]);var _0x4452d7=originateValidation[_0xfb07('0xf')](_0x56b48c[_0xfb07('0x2e')]);if(_0x4452d7['length']>0x0){return _0x4a8d4c['status'](0x190)[_0xfb07('0x2f')](_0x4452d7);}var _0x1cccdd=_0x56b48c[_0xfb07('0x2e')][_0xfb07('0x30')];var _0x5e28cd=_0x56b48c['body'][_0xfb07('0x31')];var _0x3e0d11=_0x56b48c[_0xfb07('0x2e')][_0xfb07('0x32')];var _0x4d06f5=_0x56b48c[_0xfb07('0x2e')]['callbackUrl'];return getAgent(_0x1cccdd)['then'](function(_0x4a5055){logger[_0xfb07('0x16')](_0xfb07('0x33'),_0x4a5055[_0xfb07('0x1b')]);emit(util[_0xfb07('0x34')]('user:%s',_0x4a5055['name']),_0xfb07('0x35'),{'callNumber':_0x5e28cd,'callerId':_0x3e0d11,'callbackUrl':_0x4d06f5});return _0x4a8d4c[_0xfb07('0x1d')](0xc8)['json']({'error':![],'message':'originate\x20executed!'});})['catch'](handleError(_0x4a8d4c));};exports[_0xfb07('0x36')]=function(_0x10cd8b,_0x55de52){logger['info'](_0xfb07('0x37'),_0x10cd8b[_0xfb07('0x2e')]);var _0x18c41f=hangupValidation[_0xfb07('0xf')](_0x10cd8b[_0xfb07('0x2e')]);if(_0x18c41f['length']>0x0){return _0x55de52[_0xfb07('0x1d')](0x190)[_0xfb07('0x2f')](_0x18c41f);}var _0xac769b=_0x10cd8b[_0xfb07('0x2e')]['userId'];var _0x4ab5dd=_0x10cd8b[_0xfb07('0x2e')][_0xfb07('0x38')];return getAgent(_0xac769b)[_0xfb07('0x20')](function(_0xc5df59){logger[_0xfb07('0x16')](_0xfb07('0x33'),_0xc5df59[_0xfb07('0x1b')]);emit(util['format']('user:%s',_0xc5df59[_0xfb07('0x1b')]),_0xfb07('0x39'),{'sessionId':_0x4ab5dd});return _0x55de52['status'](0xc8)['json']({'error':![],'message':_0xfb07('0x3a')});})[_0xfb07('0x24')](handleError(_0x55de52));};exports[_0xfb07('0x3b')]=function(_0x48c179,_0x479e61){logger[_0xfb07('0x16')](_0xfb07('0x3c'),_0x48c179[_0xfb07('0x2e')]);var _0x123e3d=answerValidation[_0xfb07('0xf')](_0x48c179[_0xfb07('0x2e')]);if(_0x123e3d[_0xfb07('0x2b')]>0x0){return _0x479e61[_0xfb07('0x1d')](0x190)[_0xfb07('0x2f')](_0x123e3d);}var _0x492f1b=_0x48c179[_0xfb07('0x2e')][_0xfb07('0x30')];var _0x3d6372=_0x48c179[_0xfb07('0x2e')][_0xfb07('0x38')];return getAgent(_0x492f1b)[_0xfb07('0x20')](function(_0x4cb228){logger[_0xfb07('0x16')](_0xfb07('0x33'),_0x4cb228[_0xfb07('0x1b')]);emit(util['format']('user:%s',_0x4cb228[_0xfb07('0x1b')]),_0xfb07('0x3d'),{'sessionId':_0x3d6372});return _0x479e61['status'](0xc8)[_0xfb07('0x2f')]({'error':![],'message':_0xfb07('0x3e')});})[_0xfb07('0x24')](handleError(_0x479e61));};exports[_0xfb07('0x3f')]=function(_0x44568c,_0x567958){logger['info'](_0xfb07('0x40'),_0x44568c[_0xfb07('0x2e')]);var _0x38354c=holdValidation[_0xfb07('0xf')](_0x44568c[_0xfb07('0x2e')]);if(_0x38354c[_0xfb07('0x2b')]>0x0){return _0x567958[_0xfb07('0x1d')](0x190)[_0xfb07('0x2f')](_0x38354c);}var _0x186987=_0x44568c[_0xfb07('0x2e')]['userId'];var _0x5b304d=_0x44568c['body'][_0xfb07('0x38')];return getAgent(_0x186987)['then'](function(_0x2397f8){logger[_0xfb07('0x16')](_0xfb07('0x33'),_0x2397f8[_0xfb07('0x1b')]);emit(util[_0xfb07('0x34')](_0xfb07('0x41'),_0x2397f8['name']),_0xfb07('0x42'),{'sessionId':_0x5b304d});return _0x567958[_0xfb07('0x1d')](0xc8)[_0xfb07('0x2f')]({'error':![],'message':_0xfb07('0x43')});})[_0xfb07('0x24')](handleError(_0x567958));};exports['unhold']=function(_0x3cfb89,_0x3b85f7){logger[_0xfb07('0x16')](_0xfb07('0x44'),_0x3cfb89[_0xfb07('0x2e')]);var _0x5179c2=unholdValidation[_0xfb07('0xf')](_0x3cfb89[_0xfb07('0x2e')]);if(_0x5179c2[_0xfb07('0x2b')]>0x0){return _0x3b85f7[_0xfb07('0x1d')](0x190)[_0xfb07('0x2f')](_0x5179c2);}var _0x529936=_0x3cfb89[_0xfb07('0x2e')][_0xfb07('0x30')];var _0x26a7b7=_0x3cfb89[_0xfb07('0x2e')]['sessionId'];return getAgent(_0x529936)[_0xfb07('0x20')](function(_0x204469){logger[_0xfb07('0x16')](_0xfb07('0x33'),_0x204469[_0xfb07('0x1b')]);emit(util[_0xfb07('0x34')](_0xfb07('0x41'),_0x204469[_0xfb07('0x1b')]),_0xfb07('0x45'),{'sessionId':_0x26a7b7});return _0x3b85f7[_0xfb07('0x1d')](0xc8)['json']({'error':![],'message':_0xfb07('0x46')});})['catch'](handleError(_0x3b85f7));};exports[_0xfb07('0x47')]=function(_0xfcaeb7,_0x22fa5c){logger[_0xfb07('0x16')](_0xfb07('0x48'),_0x22fa5c[_0xfb07('0x2e')]);var _0x1c76af=callsValidation['validate'](_0xfcaeb7['body']);if(_0x1c76af['length']>0x0){return _0x22fa5c[_0xfb07('0x1d')](0x190)[_0xfb07('0x2f')](_0x1c76af);}var _0x44d1a1=_0xfcaeb7['body'][_0xfb07('0x30')];var _0x4ef1a4=respondWithRpcPromise(_0xfb07('0x27'));var _0x29e4be=getAgent(_0x44d1a1);return Promise['all']([_0x4ef1a4,_0x29e4be])[_0xfb07('0x20')](function(_0x2f9f0f){var _0x18d0de=_0x2f9f0f[0x0];var _0xc122ae=_0x2f9f0f[0x1];var _0x294dc8=_[_0xfb07('0x29')](_0x18d0de[_0xfb07('0x49')],function(_0x18ae74){return _0x18ae74[_0xfb07('0x2a')]==_0xc122ae['id'];});return _0x22fa5c[_0xfb07('0x1d')](0xc8)[_0xfb07('0x2f')]({'count':_0x294dc8[_0xfb07('0x2b')],'rows':_0x294dc8});})[_0xfb07('0x24')](handleError(_0x22fa5c));};exports[_0xfb07('0x4a')]=function(_0x5387ce,_0x275aba){logger[_0xfb07('0x16')]('conference\x20fired:',_0x5387ce['body']);var _0xb5bf41=conferenceValidation[_0xfb07('0xf')](_0x5387ce[_0xfb07('0x2e')]);if(_0xb5bf41['length']>0x0){return _0x275aba[_0xfb07('0x1d')](0x190)['json'](_0xb5bf41);}var _0x4e323f=_0x5387ce['body']['userId'];return getAgent(_0x4e323f)[_0xfb07('0x20')](function(_0x237117){logger[_0xfb07('0x16')](_0xfb07('0x33'),_0x237117[_0xfb07('0x1b')]);emit(util[_0xfb07('0x34')](_0xfb07('0x41'),_0x237117['name']),_0xfb07('0x4b'));return _0x275aba[_0xfb07('0x1d')](0xc8)[_0xfb07('0x2f')]({'error':![],'message':_0xfb07('0x4c')});})[_0xfb07('0x24')](handleError(_0x275aba));};exports[_0xfb07('0x4d')]=function(_0x268d88,_0x238492){logger['info'](_0xfb07('0x4e'),_0x268d88[_0xfb07('0x2e')]);var _0x3831bf=transferValidation[_0xfb07('0xf')](_0x268d88[_0xfb07('0x2e')]);if(_0x3831bf['length']>0x0){return _0x238492['status'](0x190)[_0xfb07('0x2f')](_0x3831bf);}var _0x231247=_0x268d88['body'][_0xfb07('0x30')];var _0x311c6d=_0x268d88[_0xfb07('0x2e')][_0xfb07('0x38')];var _0x127392=_0x268d88[_0xfb07('0x2e')][_0xfb07('0x4f')];return getAgent(_0x231247)['then'](function(_0x4c1238){logger[_0xfb07('0x16')]('entityFound:',_0x4c1238[_0xfb07('0x1b')]);emit(util[_0xfb07('0x34')](_0xfb07('0x41'),_0x4c1238[_0xfb07('0x1b')]),_0xfb07('0x50'),{'sessionId':_0x311c6d,'transferNumber':_0x127392});return _0x238492[_0xfb07('0x1d')](0xc8)[_0xfb07('0x2f')]({'error':![],'message':_0xfb07('0x51')});})[_0xfb07('0x24')](handleError(_0x238492));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/index.js b/server/api/whatsappAccount/index.js index 2a0793c..bfe67f7 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 _0x47c5=['/:id/notify','notify','send','update','delete','removeAnswers','removeAgents','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./whatsappAccount.controller','get','index','/describe','isAuthenticated','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/users','/:id/applications','getApplications','post','create','addDisposition','addAnswer','addApplications'];(function(_0x5b561d,_0x422b7c){var _0x431060=function(_0x401409){while(--_0x401409){_0x5b561d['push'](_0x5b561d['shift']());}};_0x431060(++_0x422b7c);}(_0x47c5,0x165));var _0x547c=function(_0xbb2e25,_0x30535e){_0xbb2e25=_0xbb2e25-0x0;var _0xf49318=_0x47c5[_0xbb2e25];return _0xf49318;};'use strict';var multer=require(_0x547c('0x0'));var util=require(_0x547c('0x1'));var path=require(_0x547c('0x2'));var timeout=require(_0x547c('0x3'));var express=require(_0x547c('0x4'));var router=express[_0x547c('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x547c('0x6'));var interaction=require(_0x547c('0x7'));var config=require('../../config/environment');var controller=require(_0x547c('0x8'));router[_0x547c('0x9')]('/',auth['isAuthenticated'](),controller[_0x547c('0xa')]);router[_0x547c('0x9')](_0x547c('0xb'),auth[_0x547c('0xc')](),controller[_0x547c('0xd')]);router[_0x547c('0x9')](_0x547c('0xe'),auth[_0x547c('0xc')](),controller[_0x547c('0xf')]);router[_0x547c('0x9')](_0x547c('0x10'),auth[_0x547c('0xc')](),controller[_0x547c('0x11')]);router[_0x547c('0x9')](_0x547c('0x12'),auth[_0x547c('0xc')](),controller[_0x547c('0x13')]);router['get'](_0x547c('0x14'),auth[_0x547c('0xc')](),controller['getAgents']);router[_0x547c('0x9')](_0x547c('0x15'),auth[_0x547c('0xc')](),controller[_0x547c('0x16')]);router[_0x547c('0x17')]('/',auth[_0x547c('0xc')](),controller[_0x547c('0x18')]);router[_0x547c('0x17')](_0x547c('0x10'),auth[_0x547c('0xc')](),controller[_0x547c('0x19')]);router[_0x547c('0x17')](_0x547c('0x12'),auth[_0x547c('0xc')](),controller[_0x547c('0x1a')]);router[_0x547c('0x17')](_0x547c('0x14'),auth[_0x547c('0xc')](),controller['addAgents']);router['post'](_0x547c('0x15'),auth[_0x547c('0xc')](),controller[_0x547c('0x1b')]);router['post'](_0x547c('0x1c'),controller[_0x547c('0x1d')]);router[_0x547c('0x17')]('/:id/send',auth[_0x547c('0xc')](),controller[_0x547c('0x1e')]);router['put']('/:id',auth[_0x547c('0xc')](),controller[_0x547c('0x1f')]);router['delete'](_0x547c('0xe'),auth[_0x547c('0xc')](),controller['destroy']);router[_0x547c('0x20')](_0x547c('0x10'),auth[_0x547c('0xc')](),controller['removeDispositions']);router[_0x547c('0x20')](_0x547c('0x12'),auth[_0x547c('0xc')](),controller[_0x547c('0x21')]);router[_0x547c('0x20')](_0x547c('0x14'),auth[_0x547c('0xc')](),controller[_0x547c('0x22')]);module['exports']=router; \ No newline at end of file +var _0x9536=['getAnswers','/:id/users','getAgents','/:id/applications','getApplications','post','create','addDisposition','addAnswer','addApplications','/:id/notify','notify','send','put','delete','destroy','removeAgents','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappAccount.controller','get','index','/describe','isAuthenticated','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers'];(function(_0x4785b0,_0x6daccd){var _0x43ff71=function(_0x324531){while(--_0x324531){_0x4785b0['push'](_0x4785b0['shift']());}};_0x43ff71(++_0x6daccd);}(_0x9536,0x179));var _0x6953=function(_0x172ed7,_0x3d08fd){_0x172ed7=_0x172ed7-0x0;var _0xfa8f61=_0x9536[_0x172ed7];return _0xfa8f61;};'use strict';var multer=require(_0x6953('0x0'));var util=require(_0x6953('0x1'));var path=require(_0x6953('0x2'));var timeout=require(_0x6953('0x3'));var express=require('express');var router=express[_0x6953('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x6953('0x5'));var interaction=require(_0x6953('0x6'));var config=require(_0x6953('0x7'));var controller=require(_0x6953('0x8'));router[_0x6953('0x9')]('/',auth['isAuthenticated'](),controller[_0x6953('0xa')]);router[_0x6953('0x9')](_0x6953('0xb'),auth[_0x6953('0xc')](),controller[_0x6953('0xd')]);router['get'](_0x6953('0xe'),auth[_0x6953('0xc')](),controller[_0x6953('0xf')]);router['get'](_0x6953('0x10'),auth[_0x6953('0xc')](),controller[_0x6953('0x11')]);router[_0x6953('0x9')](_0x6953('0x12'),auth[_0x6953('0xc')](),controller[_0x6953('0x13')]);router[_0x6953('0x9')](_0x6953('0x14'),auth['isAuthenticated'](),controller[_0x6953('0x15')]);router['get'](_0x6953('0x16'),auth[_0x6953('0xc')](),controller[_0x6953('0x17')]);router[_0x6953('0x18')]('/',auth[_0x6953('0xc')](),controller[_0x6953('0x19')]);router[_0x6953('0x18')](_0x6953('0x10'),auth[_0x6953('0xc')](),controller[_0x6953('0x1a')]);router[_0x6953('0x18')]('/:id/canned_answers',auth['isAuthenticated'](),controller[_0x6953('0x1b')]);router[_0x6953('0x18')](_0x6953('0x14'),auth[_0x6953('0xc')](),controller['addAgents']);router[_0x6953('0x18')](_0x6953('0x16'),auth['isAuthenticated'](),controller[_0x6953('0x1c')]);router[_0x6953('0x18')](_0x6953('0x1d'),controller[_0x6953('0x1e')]);router[_0x6953('0x18')]('/:id/send',auth[_0x6953('0xc')](),controller[_0x6953('0x1f')]);router[_0x6953('0x20')](_0x6953('0xe'),auth[_0x6953('0xc')](),controller['update']);router[_0x6953('0x21')](_0x6953('0xe'),auth['isAuthenticated'](),controller[_0x6953('0x22')]);router[_0x6953('0x21')](_0x6953('0x10'),auth[_0x6953('0xc')](),controller['removeDispositions']);router[_0x6953('0x21')](_0x6953('0x12'),auth[_0x6953('0xc')](),controller['removeAnswers']);router['delete']('/:id/users',auth[_0x6953('0xc')](),controller[_0x6953('0x23')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.attributes.js b/server/api/whatsappAccount/whatsappAccount.attributes.js index 9890053..3a6dde6 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 _0xd247=['BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDisposition','sequelize','randomstring','STRING','name','generate','ENUM','twilio','sinch','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}'];(function(_0x10e8ed,_0x384a0d){var _0x4aea4a=function(_0x486ad1){while(--_0x486ad1){_0x10e8ed['push'](_0x10e8ed['shift']());}};_0x4aea4a(++_0x384a0d);}(_0xd247,0x76));var _0x7d24=function(_0xdaffc7,_0x453662){_0xdaffc7=_0xdaffc7-0x0;var _0x503d65=_0xd247[_0xdaffc7];return _0x503d65;};'use strict';var Sequelize=require(_0x7d24('0x0'));var rs=require(_0x7d24('0x1'));module['exports']={'name':{'type':Sequelize[_0x7d24('0x2')],'unique':_0x7d24('0x3'),'allowNull':![]},'key':{'type':Sequelize[_0x7d24('0x2')],'allowNull':![]},'remote':{'type':Sequelize[_0x7d24('0x2')],'allowNull':![]},'token':{'type':Sequelize[_0x7d24('0x2')],'defaultValue':function(){return rs[_0x7d24('0x4')]();}},'phone':{'type':Sequelize[_0x7d24('0x2')]},'type':{'type':Sequelize[_0x7d24('0x5')](_0x7d24('0x6'),_0x7d24('0x7'))},'accountSid':{'type':Sequelize[_0x7d24('0x2')]},'baseUrl':{'type':Sequelize[_0x7d24('0x2')]},'authToken':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize[_0x7d24('0x8')],'defaultValue':function(){return _0x7d24('0x9');}},'notificationSound':{'type':Sequelize[_0x7d24('0xa')],'defaultValue':![]},'notificationShake':{'type':Sequelize[_0x7d24('0xa')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x7d24('0xb')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x7d24('0xa')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x7d24('0xb')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x7d24('0xa')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':_0x7d24('0xc')},'mandatoryDisposition':{'type':Sequelize[_0x7d24('0xa')],'defaultValue':![],'comment':_0x7d24('0xd'),'set':function(_0x12e46e){if(!_0x12e46e){this['setDataValue']('mandatoryDispositionPauseId',null);}this[_0x7d24('0xe')](_0x7d24('0xf'),_0x12e46e);}},'description':{'type':Sequelize[_0x7d24('0x2')]}}; \ No newline at end of file +var _0xf7e4=['name','generate','twilio','sinch','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDisposition','sequelize','randomstring','exports','STRING'];(function(_0x4938f6,_0x791533){var _0x5227f3=function(_0x112b24){while(--_0x112b24){_0x4938f6['push'](_0x4938f6['shift']());}};_0x5227f3(++_0x791533);}(_0xf7e4,0xac));var _0x4f7e=function(_0x1c7238,_0x73cfec){_0x1c7238=_0x1c7238-0x0;var _0x54da8a=_0xf7e4[_0x1c7238];return _0x54da8a;};'use strict';var Sequelize=require(_0x4f7e('0x0'));var rs=require(_0x4f7e('0x1'));module[_0x4f7e('0x2')]={'name':{'type':Sequelize[_0x4f7e('0x3')],'unique':_0x4f7e('0x4'),'allowNull':![]},'key':{'type':Sequelize[_0x4f7e('0x3')],'allowNull':![]},'remote':{'type':Sequelize['STRING'],'allowNull':![]},'token':{'type':Sequelize[_0x4f7e('0x3')],'defaultValue':function(){return rs[_0x4f7e('0x5')]();}},'phone':{'type':Sequelize[_0x4f7e('0x3')]},'type':{'type':Sequelize['ENUM'](_0x4f7e('0x6'),_0x4f7e('0x7'))},'accountSid':{'type':Sequelize[_0x4f7e('0x3')]},'baseUrl':{'type':Sequelize[_0x4f7e('0x3')]},'authToken':{'type':Sequelize[_0x4f7e('0x3')]},'notificationTemplate':{'type':Sequelize[_0x4f7e('0x8')],'defaultValue':function(){return _0x4f7e('0x9');}},'notificationSound':{'type':Sequelize[_0x4f7e('0xa')],'defaultValue':![]},'notificationShake':{'type':Sequelize[_0x4f7e('0xa')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x4f7e('0xa')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x4f7e('0xb')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x4f7e('0xb')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x4f7e('0xb')],'comment':_0x4f7e('0xc')},'mandatoryDisposition':{'type':Sequelize[_0x4f7e('0xa')],'defaultValue':![],'comment':_0x4f7e('0xd'),'set':function(_0xe51dc2){if(!_0xe51dc2){this[_0x4f7e('0xe')]('mandatoryDispositionPauseId',null);}this[_0x4f7e('0xe')](_0x4f7e('0xf'),_0xe51dc2);}},'description':{'type':Sequelize[_0x4f7e('0x3')]}}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.controller.js b/server/api/whatsappAccount/whatsappAccount.controller.js index 31ecb65..cec0abe 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 _0x756a=['WhatsappAccount','rawAttributes','fieldName','type','key','model','name','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','length','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','mandatoryDispositionPause','describe','addDisposition','WhatsappAccountId','Disposition','removeDispositions','ids','addAnswer','CannedAnswer','findOne','rows','removeAnswers','addAgents','omit','spread','userWhatsappAccount:save','removeAgents','isArray','emit','userWhatsappAccount:remove','User','getAgents','addApplications','transaction','sequelize','Transaction','WhatsappApplication','bulkCreate','findAndCountAll','priority','finally','getApplications','notify','whatsapp','account','sinch','statuses','state','read','WhatsappMessage','timestamp','applications','orderBy','asc','Applications','CmContact','Sequelize','createdAt','difference','updatedAt','CompanyId','ListId','mobile','twilio','from','From','replace','whatsapp:','messageId','MessageSid','notifications','from\x20is\x20mandatory','isNil','mapKey','ValidationError','includes','CmList','Contacts','list','defaults','contact','WhatsappInteraction','interaction','created','autoclose','push','unmanaged','*,*,*,*','ContactId','AttachmentId','UserId','unshift','agent','waitForTheAssignedAgent','Start','startRouting','receiveMessage','entity\x20found','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','stringify','Content-Type','text/xml','\x0a','body\x20is\x20mandatory\x20and\x20not\x20empty','to\x20is\x20mandatory','DESC','List','out','dataValues','Messages','rimraf','zip-dir','fast-json-patch','moment','path','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','../../config/utils','../../config/environment','redis','localhost','socket.io-emitter','jayson/promise','http','info','WhatsappAccount,\x20%s,\x20%s','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','sendStatus','end','status','json','offset','undefined','limit','count','set','apply','reject','update','then','destroy','get','WhatsappAccounts','stack','send','Pause','map'];(function(_0x3e5086,_0x48f4a2){var _0xfeb102=function(_0x5a945f){while(--_0x5a945f){_0x3e5086['push'](_0x3e5086['shift']());}};_0xfeb102(++_0x48f4a2);}(_0x756a,0x151));var _0xa756=function(_0xb1cf84,_0x813740){_0xb1cf84=_0xb1cf84-0x0;var _0x4bad2e=_0x756a[_0xb1cf84];return _0x4bad2e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa756('0x0'));var zipdir=require(_0xa756('0x1'));var jsonpatch=require(_0xa756('0x2'));var rp=require('request-promise');var moment=require(_0xa756('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xa756('0x4'));var sox=require(_0xa756('0x5'));var csv=require('to-csv');var ejs=require(_0xa756('0x6'));var fs=require('fs');var fs_extra=require(_0xa756('0x7'));var _=require(_0xa756('0x8'));var squel=require(_0xa756('0x9'));var crypto=require(_0xa756('0xa'));var jsforce=require(_0xa756('0xb'));var deskjs=require(_0xa756('0xc'));var toCsv=require(_0xa756('0xd'));var querystring=require(_0xa756('0xe'));var Papa=require(_0xa756('0xf'));var Redis=require(_0xa756('0x10'));var authService=require(_0xa756('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xa756('0x12'));var hardwareService=require(_0xa756('0x13'));var logger=require(_0xa756('0x14'))('api');var utils=require(_0xa756('0x15'));var config=require(_0xa756('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0xa756('0x17')]=_['defaults'](config[_0xa756('0x17')],{'host':_0xa756('0x18'),'port':0x18eb});var socket=require(_0xa756('0x19'))(new Redis(config[_0xa756('0x17')]));require('./whatsappAccount.socket')['register'](socket);var jayson=require(_0xa756('0x1a'));var client=jayson['client'][_0xa756('0x1b')]({'port':0x232c});function respondWithRpcPromise(_0x1db3b8,_0x2f06a5,_0x4867e2,_0x2d71aa){return new BPromise(function(_0x1f275a,_0x4a80a2){var _0x450141=_0x2d71aa||client;return _0x450141['request'](_0x1db3b8,_0x4867e2)['then'](function(_0xd7b882){logger[_0xa756('0x1c')](_0xa756('0x1d'),_0x2f06a5,'request\x20sent');logger[_0xa756('0x1e')](_0xa756('0x1f'),_0x2f06a5,_0xa756('0x20'),JSON['stringify'](_0xd7b882));if(_0xd7b882[_0xa756('0x21')]){if(_0xd7b882[_0xa756('0x21')][_0xa756('0x22')]===0x1f4){logger[_0xa756('0x21')](_0xa756('0x1d'),_0x2f06a5,_0xd7b882[_0xa756('0x21')][_0xa756('0x23')]);return _0x4a80a2(_0xd7b882[_0xa756('0x21')][_0xa756('0x23')]);}logger[_0xa756('0x21')](_0xa756('0x1d'),_0x2f06a5,_0xd7b882[_0xa756('0x21')][_0xa756('0x23')]);return _0x1f275a(_0xd7b882['error'][_0xa756('0x23')]);}else{logger[_0xa756('0x1c')](_0xa756('0x1d'),_0x2f06a5,_0xa756('0x20'));_0x1f275a(_0xd7b882[_0xa756('0x24')][_0xa756('0x23')]);}})['catch'](function(_0x1dd3c8){logger[_0xa756('0x21')](_0xa756('0x1d'),_0x2f06a5,_0x1dd3c8);_0x4a80a2(_0x1dd3c8);});});}function respondWithStatusCode(_0x3b33c4,_0x4ca7ba){_0x4ca7ba=_0x4ca7ba||0xcc;return function(_0x267c74){if(_0x267c74){return _0x3b33c4[_0xa756('0x25')](_0x4ca7ba);}return _0x3b33c4['status'](_0x4ca7ba)[_0xa756('0x26')]();};}function respondWithResult(_0x2fd134,_0x4e084c){_0x4e084c=_0x4e084c||0xc8;return function(_0x53fdbc){if(_0x53fdbc){return _0x2fd134[_0xa756('0x27')](_0x4e084c)[_0xa756('0x28')](_0x53fdbc);}};}function respondWithFilteredResult(_0x1cc454,_0x188118){return function(_0x56414f){if(_0x56414f){var _0x281b69=typeof _0x188118[_0xa756('0x29')]===_0xa756('0x2a')&&typeof _0x188118[_0xa756('0x2b')]===_0xa756('0x2a');var _0x59a8c4=_0x56414f[_0xa756('0x2c')];var _0x1fc805=_0x281b69?0x0:_0x188118['offset'];var _0x4e6816=_0x281b69?_0x56414f[_0xa756('0x2c')]:_0x188118[_0xa756('0x29')]+_0x188118['limit'];var _0x3acc41;if(_0x4e6816>=_0x59a8c4){_0x4e6816=_0x59a8c4;_0x3acc41=0xc8;}else{_0x3acc41=0xce;}_0x1cc454[_0xa756('0x27')](_0x3acc41);return _0x1cc454[_0xa756('0x2d')]('Content-Range',_0x1fc805+'-'+_0x4e6816+'/'+_0x59a8c4)[_0xa756('0x28')](_0x56414f);}return null;};}function patchUpdates(_0x155e34){return function(_0x3c7733){try{jsonpatch[_0xa756('0x2e')](_0x3c7733,_0x155e34,!![]);}catch(_0x34c3bf){return BPromise[_0xa756('0x2f')](_0x34c3bf);}return _0x3c7733['save']();};}function saveUpdates(_0x45d858,_0x35b4e5){return function(_0x30b7d8){if(_0x30b7d8){return _0x30b7d8[_0xa756('0x30')](_0x45d858)[_0xa756('0x31')](function(_0x146852){return _0x146852;});}return null;};}function removeEntity(_0x36e2f1,_0x2bd40a){return function(_0x90a2ad){if(_0x90a2ad){return _0x90a2ad[_0xa756('0x32')]()[_0xa756('0x31')](function(){var _0x92bb99=_0x90a2ad[_0xa756('0x33')]({'plain':!![]});var _0x1a3a4d=_0xa756('0x34');return db['UserProfileResource']['destroy']({'where':{'type':_0x1a3a4d,'resourceId':_0x92bb99['id']}})[_0xa756('0x31')](function(){return _0x90a2ad;});})[_0xa756('0x31')](function(){_0x36e2f1[_0xa756('0x27')](0xcc)['end']();});}};}function handleEntityNotFound(_0x7dccb9,_0xd2d954){return function(_0x3c2dee){if(!_0x3c2dee){_0x7dccb9['sendStatus'](0x194);}return _0x3c2dee;};}function handleError(_0x36d11a,_0x31a0a6){_0x31a0a6=_0x31a0a6||0x1f4;return function(_0x149aec){logger[_0xa756('0x21')](_0x149aec[_0xa756('0x35')]);if(_0x149aec['name']){delete _0x149aec['name'];}_0x36d11a[_0xa756('0x27')](_0x31a0a6)[_0xa756('0x36')](_0x149aec);};}exports['index']=function(_0x18b82c,_0x5a76a7){var _0x462f07={'include':[{'model':db[_0xa756('0x37')],'as':'mandatoryDispositionPause'}]},_0x491f56={},_0x199d98={'count':0x0,'rows':[]};var _0x2cc7a5=_[_0xa756('0x38')](db[_0xa756('0x39')][_0xa756('0x3a')],function(_0x1b7636){return{'name':_0x1b7636[_0xa756('0x3b')],'type':_0x1b7636[_0xa756('0x3c')][_0xa756('0x3d')]};});_0x491f56[_0xa756('0x3e')]=_[_0xa756('0x38')](_0x2cc7a5,_0xa756('0x3f'));_0x491f56[_0xa756('0x40')]=_[_0xa756('0x41')](_0x18b82c[_0xa756('0x40')]);_0x491f56[_0xa756('0x42')]=_[_0xa756('0x43')](_0x491f56[_0xa756('0x3e')],_0x491f56[_0xa756('0x40')]);_0x462f07[_0xa756('0x44')]=_['intersection'](_0x491f56[_0xa756('0x3e')],qs[_0xa756('0x45')](_0x18b82c[_0xa756('0x40')][_0xa756('0x45')]));_0x462f07[_0xa756('0x44')]=_0x462f07[_0xa756('0x44')]['length']?_0x462f07[_0xa756('0x44')]:_0x491f56['model'];if(!_0x18b82c[_0xa756('0x40')][_0xa756('0x46')](_0xa756('0x47'))){_0x462f07[_0xa756('0x2b')]=qs['limit'](_0x18b82c[_0xa756('0x40')][_0xa756('0x2b')]);_0x462f07[_0xa756('0x29')]=qs['offset'](_0x18b82c[_0xa756('0x40')][_0xa756('0x29')]);}_0x462f07[_0xa756('0x48')]=qs[_0xa756('0x49')](_0x18b82c[_0xa756('0x40')][_0xa756('0x49')]);_0x462f07[_0xa756('0x4a')]=qs[_0xa756('0x42')](_[_0xa756('0x4b')](_0x18b82c['query'],_0x491f56[_0xa756('0x42')]),_0x2cc7a5);if(_0x18b82c[_0xa756('0x40')][_0xa756('0x4c')]){_0x462f07[_0xa756('0x4a')]=_[_0xa756('0x4d')](_0x462f07[_0xa756('0x4a')],{'$or':_[_0xa756('0x38')](_0x2cc7a5,function(_0x42195b){if(_0x42195b[_0xa756('0x3c')]!==_0xa756('0x4e')){var _0x25bfcf={};_0x25bfcf[_0x42195b[_0xa756('0x3f')]]={'$like':'%'+_0x18b82c[_0xa756('0x40')][_0xa756('0x4c')]+'%'};return _0x25bfcf;}})});}_0x462f07=_[_0xa756('0x4d')]({},_0x462f07,_0x18b82c[_0xa756('0x4f')]);var _0x506117={'where':_0x462f07[_0xa756('0x4a')]};return db[_0xa756('0x39')][_0xa756('0x2c')](_0x506117)[_0xa756('0x31')](function(_0x504a48){_0x199d98[_0xa756('0x2c')]=_0x504a48;if(_0x18b82c[_0xa756('0x40')][_0xa756('0x50')]){_0x462f07[_0xa756('0x51')]=[{'all':!![]}];}return db[_0xa756('0x39')][_0xa756('0x52')](_0x462f07);})[_0xa756('0x31')](function(_0x1d0453){_0x199d98['rows']=_0x1d0453;return _0x199d98;})['then'](respondWithFilteredResult(_0x5a76a7,_0x462f07))[_0xa756('0x53')](handleError(_0x5a76a7,null));};exports[_0xa756('0x54')]=function(_0x2d4081,_0x41bc45){var _0x2a97cc={'raw':![],'where':{'id':_0x2d4081[_0xa756('0x55')]['id']},'include':[{'model':db[_0xa756('0x37')],'as':'mandatoryDispositionPause'}]},_0x339bde={};_0x339bde['model']=_[_0xa756('0x41')](db[_0xa756('0x39')]['rawAttributes']);_0x339bde[_0xa756('0x40')]=_[_0xa756('0x41')](_0x2d4081['query']);_0x339bde['filters']=_['intersection'](_0x339bde[_0xa756('0x3e')],_0x339bde[_0xa756('0x40')]);_0x2a97cc[_0xa756('0x44')]=_[_0xa756('0x43')](_0x339bde['model'],qs[_0xa756('0x45')](_0x2d4081[_0xa756('0x40')][_0xa756('0x45')]));_0x2a97cc['attributes']=_0x2a97cc[_0xa756('0x44')][_0xa756('0x56')]?_0x2a97cc[_0xa756('0x44')]:_0x339bde[_0xa756('0x3e')];if(_0x2d4081[_0xa756('0x40')]['includeAll']){_0x2a97cc['include']=[{'all':!![]}];}_0x2a97cc=_['merge']({},_0x2a97cc,_0x2d4081[_0xa756('0x4f')]);return db[_0xa756('0x39')][_0xa756('0x57')](_0x2a97cc)['then'](handleEntityNotFound(_0x41bc45,null))[_0xa756('0x31')](respondWithResult(_0x41bc45,null))['catch'](handleError(_0x41bc45,null));};exports[_0xa756('0x58')]=function(_0x1ab080,_0x558609){return db[_0xa756('0x39')][_0xa756('0x58')](_0x1ab080['body'],{})['then'](function(_0x556ea5){var _0x5c105a=_0x1ab080[_0xa756('0x59')]['get']({'plain':!![]});if(!_0x5c105a)throw new Error(_0xa756('0x5a'));if(_0x5c105a[_0xa756('0x5b')]==='user'){var _0x24b1d7=_0x556ea5[_0xa756('0x33')]({'plain':!![]});var _0x2f89c3=_0xa756('0x34');return db[_0xa756('0x5c')][_0xa756('0x57')]({'where':{'name':_0x2f89c3,'userProfileId':_0x5c105a[_0xa756('0x5d')]},'raw':!![]})[_0xa756('0x31')](function(_0x4c0ef6){if(_0x4c0ef6&&_0x4c0ef6['autoAssociation']===0x0){return db[_0xa756('0x5e')]['create']({'name':_0x24b1d7[_0xa756('0x3f')],'resourceId':_0x24b1d7['id'],'type':_0x4c0ef6[_0xa756('0x3f')],'sectionId':_0x4c0ef6['id']},{})[_0xa756('0x31')](function(){return _0x556ea5;});}else{return _0x556ea5;}})[_0xa756('0x53')](function(_0x3bfd6e){logger[_0xa756('0x21')](_0xa756('0x5f'),_0x3bfd6e);throw _0x3bfd6e;});}return _0x556ea5;})[_0xa756('0x31')](respondWithResult(_0x558609,0xc9))[_0xa756('0x53')](handleError(_0x558609,null));};exports[_0xa756('0x30')]=function(_0x2d06f7,_0x4a77fe){if(_0x2d06f7[_0xa756('0x60')]['id']){delete _0x2d06f7[_0xa756('0x60')]['id'];}return db[_0xa756('0x39')][_0xa756('0x57')]({'where':{'id':_0x2d06f7[_0xa756('0x55')]['id']},'include':[{'model':db[_0xa756('0x37')],'as':_0xa756('0x61')}]})[_0xa756('0x31')](handleEntityNotFound(_0x4a77fe,null))['then'](saveUpdates(_0x2d06f7[_0xa756('0x60')],null))[_0xa756('0x31')](respondWithResult(_0x4a77fe,null))[_0xa756('0x53')](handleError(_0x4a77fe,null));};exports['destroy']=function(_0x1090ce,_0x4e17fb){return db[_0xa756('0x39')][_0xa756('0x57')]({'where':{'id':_0x1090ce['params']['id']}})[_0xa756('0x31')](handleEntityNotFound(_0x4e17fb,null))['then'](removeEntity(_0x4e17fb,null))['catch'](handleError(_0x4e17fb,null));};exports[_0xa756('0x62')]=function(_0x1cfe29,_0x212c56){return db[_0xa756('0x39')][_0xa756('0x62')]()['then'](respondWithResult(_0x212c56,null))[_0xa756('0x53')](handleError(_0x212c56,null));};exports[_0xa756('0x63')]=function(_0x369dde,_0x58d504,_0x3d145a){if(_0x369dde[_0xa756('0x60')]['id']){delete _0x369dde[_0xa756('0x60')]['id'];}return db['WhatsappAccount'][_0xa756('0x57')]({'where':{'id':_0x369dde[_0xa756('0x55')]['id']}})[_0xa756('0x31')](handleEntityNotFound(_0x58d504,null))[_0xa756('0x31')](function(_0x266dba){if(_0x266dba){_0x369dde[_0xa756('0x60')][_0xa756('0x64')]=_0x266dba['id'];return db[_0xa756('0x65')][_0xa756('0x58')](_0x369dde['body']);}})['then'](respondWithResult(_0x58d504,null))[_0xa756('0x53')](handleError(_0x58d504,null));};exports['getDispositions']=function(_0x484656,_0x4be6b3,_0x5cb3b8){var _0x4461ba={'raw':![],'where':{}};var _0x4268b5={};var _0x5493ee={'count':0x0,'rows':[]};return db[_0xa756('0x39')]['findOne']({'where':{'id':_0x484656[_0xa756('0x55')]['id']}})[_0xa756('0x31')](handleEntityNotFound(_0x4be6b3,null))[_0xa756('0x31')](function(_0x2cb35a){if(_0x2cb35a){_0x4268b5[_0xa756('0x3e')]=_[_0xa756('0x41')](db[_0xa756('0x65')]['rawAttributes']);_0x4268b5[_0xa756('0x40')]=_[_0xa756('0x41')](_0x484656[_0xa756('0x40')]);_0x4268b5[_0xa756('0x42')]=_[_0xa756('0x43')](_0x4268b5['model'],_0x4268b5[_0xa756('0x40')]);_0x4461ba['attributes']=_[_0xa756('0x43')](_0x4268b5[_0xa756('0x3e')],qs[_0xa756('0x45')](_0x484656[_0xa756('0x40')]['fields']));_0x4461ba[_0xa756('0x44')]=_0x4461ba[_0xa756('0x44')]['length']?_0x4461ba[_0xa756('0x44')]:_0x4268b5[_0xa756('0x3e')];if(!_0x484656[_0xa756('0x40')][_0xa756('0x46')](_0xa756('0x47'))){_0x4461ba[_0xa756('0x2b')]=qs[_0xa756('0x2b')](_0x484656['query'][_0xa756('0x2b')]);_0x4461ba[_0xa756('0x29')]=qs[_0xa756('0x29')](_0x484656[_0xa756('0x40')][_0xa756('0x29')]);}_0x4461ba['order']=qs[_0xa756('0x49')](_0x484656[_0xa756('0x40')][_0xa756('0x49')]);_0x4461ba[_0xa756('0x4a')]=qs[_0xa756('0x42')](_['pick'](_0x484656[_0xa756('0x40')],_0x4268b5['filters']));_0x4461ba[_0xa756('0x4a')]['WhatsappAccountId']=_0x2cb35a['id'];if(_0x484656[_0xa756('0x40')][_0xa756('0x4c')]){_0x4461ba[_0xa756('0x4a')]=_[_0xa756('0x4d')](_0x4461ba[_0xa756('0x4a')],{'$or':_['map'](_0x4461ba[_0xa756('0x44')],function(_0x2a8a34){var _0x4d20f1={};_0x4d20f1[_0x2a8a34]={'$like':'%'+_0x484656[_0xa756('0x40')]['filter']+'%'};return _0x4d20f1;})});}_0x4461ba=_['merge']({},_0x4461ba,_0x484656[_0xa756('0x4f')]);return db[_0xa756('0x65')]['count']({'where':_0x4461ba['where']})[_0xa756('0x31')](function(_0x28aee6){_0x5493ee[_0xa756('0x2c')]=_0x28aee6;if(_0x484656[_0xa756('0x40')][_0xa756('0x50')]){_0x4461ba[_0xa756('0x51')]=[{'all':!![]}];}return db[_0xa756('0x65')][_0xa756('0x52')](_0x4461ba);})[_0xa756('0x31')](function(_0x50e238){_0x5493ee['rows']=_0x50e238;return _0x5493ee;});}})[_0xa756('0x31')](respondWithFilteredResult(_0x4be6b3,_0x4461ba))[_0xa756('0x53')](handleError(_0x4be6b3,null));};exports[_0xa756('0x66')]=function(_0xbd7c50,_0x3cdfaf,_0x25ba62){return db[_0xa756('0x39')][_0xa756('0x57')]({'where':{'id':_0xbd7c50[_0xa756('0x55')]['id']}})[_0xa756('0x31')](handleEntityNotFound(_0x3cdfaf,null))[_0xa756('0x31')](function(_0xa866c6){if(_0xa866c6){return _0xa866c6[_0xa756('0x66')](_0xbd7c50[_0xa756('0x40')][_0xa756('0x67')]);}})['then'](respondWithStatusCode(_0x3cdfaf,null))['catch'](handleError(_0x3cdfaf,null));};exports[_0xa756('0x68')]=function(_0x1ebb1d,_0x358308,_0x1b9cca){if(_0x1ebb1d[_0xa756('0x60')]['id']){delete _0x1ebb1d['body']['id'];}return db[_0xa756('0x39')][_0xa756('0x57')]({'where':{'id':_0x1ebb1d[_0xa756('0x55')]['id']}})[_0xa756('0x31')](handleEntityNotFound(_0x358308,null))[_0xa756('0x31')](function(_0x54b8e1){if(_0x54b8e1){_0x1ebb1d[_0xa756('0x60')][_0xa756('0x64')]=_0x54b8e1['id'];return db[_0xa756('0x69')][_0xa756('0x58')](_0x1ebb1d[_0xa756('0x60')]);}})[_0xa756('0x31')](respondWithResult(_0x358308,null))[_0xa756('0x53')](handleError(_0x358308,null));};exports['getAnswers']=function(_0x436de7,_0x3cc10f,_0x39bdff){var _0x11d6a4={'raw':![],'where':{}};var _0x593c11={};var _0x848d31={'count':0x0,'rows':[]};return db[_0xa756('0x39')][_0xa756('0x6a')]({'where':{'id':_0x436de7[_0xa756('0x55')]['id']}})[_0xa756('0x31')](handleEntityNotFound(_0x3cc10f,null))[_0xa756('0x31')](function(_0x44116e){if(_0x44116e){_0x593c11[_0xa756('0x3e')]=_[_0xa756('0x41')](db[_0xa756('0x69')]['rawAttributes']);_0x593c11[_0xa756('0x40')]=_[_0xa756('0x41')](_0x436de7[_0xa756('0x40')]);_0x593c11[_0xa756('0x42')]=_['intersection'](_0x593c11[_0xa756('0x3e')],_0x593c11['query']);_0x11d6a4[_0xa756('0x44')]=_[_0xa756('0x43')](_0x593c11[_0xa756('0x3e')],qs['fields'](_0x436de7['query']['fields']));_0x11d6a4[_0xa756('0x44')]=_0x11d6a4[_0xa756('0x44')][_0xa756('0x56')]?_0x11d6a4['attributes']:_0x593c11[_0xa756('0x3e')];if(!_0x436de7[_0xa756('0x40')][_0xa756('0x46')]('nolimit')){_0x11d6a4[_0xa756('0x2b')]=qs['limit'](_0x436de7[_0xa756('0x40')]['limit']);_0x11d6a4[_0xa756('0x29')]=qs[_0xa756('0x29')](_0x436de7['query']['offset']);}_0x11d6a4['order']=qs[_0xa756('0x49')](_0x436de7[_0xa756('0x40')][_0xa756('0x49')]);_0x11d6a4[_0xa756('0x4a')]=qs['filters'](_[_0xa756('0x4b')](_0x436de7['query'],_0x593c11[_0xa756('0x42')]));_0x11d6a4[_0xa756('0x4a')][_0xa756('0x64')]=_0x44116e['id'];if(_0x436de7[_0xa756('0x40')][_0xa756('0x4c')]){_0x11d6a4[_0xa756('0x4a')]=_['merge'](_0x11d6a4[_0xa756('0x4a')],{'$or':_[_0xa756('0x38')](_0x11d6a4[_0xa756('0x44')],function(_0x4b1333){var _0x5709ff={};_0x5709ff[_0x4b1333]={'$like':'%'+_0x436de7[_0xa756('0x40')]['filter']+'%'};return _0x5709ff;})});}_0x11d6a4=_[_0xa756('0x4d')]({},_0x11d6a4,_0x436de7[_0xa756('0x4f')]);return db[_0xa756('0x69')]['count']({'where':_0x11d6a4['where']})[_0xa756('0x31')](function(_0x54bc39){_0x848d31[_0xa756('0x2c')]=_0x54bc39;if(_0x436de7[_0xa756('0x40')][_0xa756('0x50')]){_0x11d6a4['include']=[{'all':!![]}];}return db['CannedAnswer']['findAll'](_0x11d6a4);})[_0xa756('0x31')](function(_0x7c2012){_0x848d31[_0xa756('0x6b')]=_0x7c2012;return _0x848d31;});}})[_0xa756('0x31')](respondWithFilteredResult(_0x3cc10f,_0x11d6a4))['catch'](handleError(_0x3cc10f,null));};exports[_0xa756('0x6c')]=function(_0x424a5e,_0x3a08c1,_0x11ff67){return db[_0xa756('0x39')][_0xa756('0x57')]({'where':{'id':_0x424a5e[_0xa756('0x55')]['id']}})['then'](handleEntityNotFound(_0x3a08c1,null))['then'](function(_0xc87e0f){if(_0xc87e0f){return _0xc87e0f['removeAnswers'](_0x424a5e['query']['ids']);}})[_0xa756('0x31')](respondWithStatusCode(_0x3a08c1,null))['catch'](handleError(_0x3a08c1,null));};exports['addAgents']=function(_0x1422f4,_0x2e45f2,_0x10c7a5){return db['WhatsappAccount'][_0xa756('0x57')]({'where':{'id':_0x1422f4[_0xa756('0x55')]['id']}})[_0xa756('0x31')](handleEntityNotFound(_0x2e45f2,null))['then'](function(_0x14c55e){if(_0x14c55e){return _0x14c55e[_0xa756('0x6d')](_0x1422f4['body'][_0xa756('0x67')],_[_0xa756('0x6e')](_0x1422f4['body'],['ids','id'])||{})[_0xa756('0x6f')](function(_0x41be01){for(var _0x4f6357=0x0;_0x4f6357<_0x1422f4[_0xa756('0x60')][_0xa756('0x67')]['length'];_0x4f6357+=0x1){socket['emit'](_0xa756('0x70'),{'UserId':Number(_0x1422f4[_0xa756('0x60')][_0xa756('0x67')][_0x4f6357]),'WhatsappAccountId':Number(_0x1422f4[_0xa756('0x55')]['id'])});}return _0x41be01;});}})[_0xa756('0x31')](respondWithResult(_0x2e45f2,null))[_0xa756('0x53')](handleError(_0x2e45f2,null));};exports[_0xa756('0x71')]=function(_0x4a8dbd,_0x1052ca,_0x6ecfd8){return db['WhatsappAccount']['find']({'where':{'id':_0x4a8dbd[_0xa756('0x55')]['id']}})['then'](handleEntityNotFound(_0x1052ca,null))[_0xa756('0x31')](function(_0x2d0796){if(_0x2d0796){return _0x2d0796['removeAgents'](_0x4a8dbd['query'][_0xa756('0x67')])[_0xa756('0x31')](function(){if(_[_0xa756('0x72')](_0x4a8dbd[_0xa756('0x40')]['ids'])){for(var _0x52a04f=0x0;_0x52a04f<_0x4a8dbd['query'][_0xa756('0x67')][_0xa756('0x56')];_0x52a04f+=0x1){socket[_0xa756('0x73')](_0xa756('0x74'),{'UserId':Number(_0x4a8dbd[_0xa756('0x40')][_0xa756('0x67')][_0x52a04f]),'WhatsappAccountId':Number(_0x4a8dbd[_0xa756('0x55')]['id'])});}}else{socket[_0xa756('0x73')]('userWhatsappAccount:remove',{'UserId':Number(_0x4a8dbd['query'][_0xa756('0x67')]),'WhatsappAccountId':Number(_0x4a8dbd[_0xa756('0x55')]['id'])});}});}})[_0xa756('0x31')](respondWithStatusCode(_0x1052ca,null))[_0xa756('0x53')](handleError(_0x1052ca,null));};exports['getAgents']=function(_0x3be547,_0x403c16,_0x37cd22){var _0x3b475f={};var _0x242759={};var _0x1a6b4b;var _0x38665d;return db[_0xa756('0x39')][_0xa756('0x6a')]({'where':{'id':_0x3be547[_0xa756('0x55')]['id']}})[_0xa756('0x31')](handleEntityNotFound(_0x403c16,null))[_0xa756('0x31')](function(_0x58201e){if(_0x58201e){_0x1a6b4b=_0x58201e;_0x242759[_0xa756('0x3e')]=_[_0xa756('0x41')](db[_0xa756('0x75')][_0xa756('0x3a')]);_0x242759['query']=_['keys'](_0x3be547[_0xa756('0x40')]);_0x242759['filters']=_[_0xa756('0x43')](_0x242759[_0xa756('0x3e')],_0x242759[_0xa756('0x40')]);_0x3b475f[_0xa756('0x44')]=_['intersection'](_0x242759[_0xa756('0x3e')],qs[_0xa756('0x45')](_0x3be547[_0xa756('0x40')][_0xa756('0x45')]));_0x3b475f['attributes']=_0x3b475f['attributes'][_0xa756('0x56')]?_0x3b475f[_0xa756('0x44')]:_0x242759['model'];_0x3b475f[_0xa756('0x48')]=qs[_0xa756('0x49')](_0x3be547[_0xa756('0x40')][_0xa756('0x49')]);_0x3b475f[_0xa756('0x4a')]=qs[_0xa756('0x42')](_['pick'](_0x3be547[_0xa756('0x40')],_0x242759[_0xa756('0x42')]));if(_0x3be547[_0xa756('0x40')][_0xa756('0x4c')]){_0x3b475f[_0xa756('0x4a')]=_[_0xa756('0x4d')](_0x3b475f['where'],{'$or':_[_0xa756('0x38')](_0x3b475f[_0xa756('0x44')],function(_0x41bf76){var _0x1381e7={};_0x1381e7[_0x41bf76]={'$like':'%'+_0x3be547['query'][_0xa756('0x4c')]+'%'};return _0x1381e7;})});}_0x3b475f=_[_0xa756('0x4d')]({},_0x3b475f,_0x3be547['options']);return _0x1a6b4b[_0xa756('0x76')](_0x3b475f);}})[_0xa756('0x31')](function(_0x250997){if(_0x250997){_0x38665d=_0x250997[_0xa756('0x56')];if(!_0x3be547[_0xa756('0x40')][_0xa756('0x46')]('nolimit')){_0x3b475f[_0xa756('0x2b')]=qs[_0xa756('0x2b')](_0x3be547[_0xa756('0x40')][_0xa756('0x2b')]);_0x3b475f[_0xa756('0x29')]=qs[_0xa756('0x29')](_0x3be547[_0xa756('0x40')][_0xa756('0x29')]);}return _0x1a6b4b[_0xa756('0x76')](_0x3b475f);}})['then'](function(_0x1044cf){if(_0x1044cf){return _0x1044cf?{'count':_0x38665d,'rows':_0x1044cf}:null;}})[_0xa756('0x31')](respondWithResult(_0x403c16,null))[_0xa756('0x53')](handleError(_0x403c16,null));};exports[_0xa756('0x77')]=function(_0x3fa762,_0xa06f7){var _0x10f2e7=_0x3fa762[_0xa756('0x55')]['id'];var _0x53b5a3=_0x3fa762['body'];var _0x4db0d3=0xc8;var _0x215be6=null;return db['sequelize'][_0xa756('0x78')]({'isolationLevel':db[_0xa756('0x79')][_0xa756('0x7a')]['ISOLATION_LEVELS']['READ_COMMITTED']},function(_0x5f093c){return db[_0xa756('0x39')]['findOne']({'where':{'id':_0x10f2e7},'transaction':_0x5f093c})[_0xa756('0x31')](function(_0x58f44e){if(_0x58f44e){return db['WhatsappApplication'][_0xa756('0x32')]({'where':{'WhatsappAccountId':_0x10f2e7},'transaction':_0x5f093c})[_0xa756('0x31')](function(){var _0x3f2754=_[_0xa756('0x38')](_0x53b5a3,function(_0x563428){_0x563428['WhatsappAccountId']=_0x10f2e7;return _0x563428;});return db[_0xa756('0x7b')][_0xa756('0x7c')](_0x3f2754,{'transaction':_0x5f093c});});}else{_0x4db0d3=0x194;_0x215be6=[];}});})[_0xa756('0x31')](function(){if(_0x4db0d3!==0x194){return db[_0xa756('0x7b')][_0xa756('0x7d')]({'where':{'WhatsappAccountId':_0x10f2e7},'order':_0xa756('0x7e')})[_0xa756('0x31')](function(_0x437e41){_0x215be6=_0x437e41;});}})[_0xa756('0x53')](function(_0x4920ed){_0x4db0d3=0x1f4;logger['error'](_0x4920ed[_0xa756('0x35')]);if(_0x4920ed[_0xa756('0x3f')]){delete _0x4920ed[_0xa756('0x3f')];}_0x215be6=_0x4920ed;})[_0xa756('0x7f')](function(){if(_0x215be6===null){_0xa06f7[_0xa756('0x25')](_0x4db0d3);}else{if(_0x4db0d3===0x1f4){_0xa06f7[_0xa756('0x27')](_0x4db0d3)['send'](_0x215be6);}else{_0xa06f7[_0xa756('0x27')](_0x4db0d3)[_0xa756('0x28')](_0x215be6);}}});};exports[_0xa756('0x80')]=function(_0x1cdd31,_0x5490a7,_0x1246eb){var _0x5eaab7={};var _0x385ad4={};var _0x209a01;var _0x34147b;return db[_0xa756('0x39')]['findOne']({'where':{'id':_0x1cdd31[_0xa756('0x55')]['id']}})[_0xa756('0x31')](handleEntityNotFound(_0x5490a7,null))[_0xa756('0x31')](function(_0x4b2beb){if(_0x4b2beb){_0x209a01=_0x4b2beb;_0x385ad4[_0xa756('0x3e')]=_[_0xa756('0x41')](db[_0xa756('0x7b')][_0xa756('0x3a')]);_0x385ad4[_0xa756('0x40')]=_[_0xa756('0x41')](_0x1cdd31[_0xa756('0x40')]);_0x385ad4[_0xa756('0x42')]=_[_0xa756('0x43')](_0x385ad4['model'],_0x385ad4[_0xa756('0x40')]);_0x5eaab7[_0xa756('0x44')]=_['intersection'](_0x385ad4[_0xa756('0x3e')],qs['fields'](_0x1cdd31[_0xa756('0x40')][_0xa756('0x45')]));_0x5eaab7[_0xa756('0x44')]=_0x5eaab7[_0xa756('0x44')][_0xa756('0x56')]?_0x5eaab7[_0xa756('0x44')]:_0x385ad4['model'];_0x5eaab7[_0xa756('0x48')]=qs['sort'](_0x1cdd31[_0xa756('0x40')][_0xa756('0x49')]);_0x5eaab7[_0xa756('0x4a')]=qs[_0xa756('0x42')](_[_0xa756('0x4b')](_0x1cdd31[_0xa756('0x40')],_0x385ad4[_0xa756('0x42')]));if(_0x1cdd31[_0xa756('0x40')]['filter']){_0x5eaab7[_0xa756('0x4a')]=_['merge'](_0x5eaab7['where'],{'$or':_['map'](_0x5eaab7[_0xa756('0x44')],function(_0x281a21){var _0x5540ef={};_0x5540ef[_0x281a21]={'$like':'%'+_0x1cdd31[_0xa756('0x40')][_0xa756('0x4c')]+'%'};return _0x5540ef;})});}_0x5eaab7=_[_0xa756('0x4d')]({},_0x5eaab7,_0x1cdd31['options']);return _0x209a01[_0xa756('0x80')](_0x5eaab7);}})[_0xa756('0x31')](function(_0xb341d){if(_0xb341d){_0x34147b=_0xb341d['length'];if(!_0x1cdd31[_0xa756('0x40')][_0xa756('0x46')](_0xa756('0x47'))){_0x5eaab7[_0xa756('0x2b')]=qs[_0xa756('0x2b')](_0x1cdd31[_0xa756('0x40')][_0xa756('0x2b')]);_0x5eaab7[_0xa756('0x29')]=qs[_0xa756('0x29')](_0x1cdd31[_0xa756('0x40')][_0xa756('0x29')]);}return _0x209a01['getApplications'](_0x5eaab7);}})['then'](function(_0x11f647){if(_0x11f647){return _0x11f647?{'count':_0x34147b,'rows':_0x11f647}:null;}})[_0xa756('0x31')](respondWithResult(_0x5490a7,null))[_0xa756('0x53')](handleError(_0x5490a7,null));};exports[_0xa756('0x81')]=function(_0x5e1055,_0x224764,_0x124417){var _0x220017={'channel':_0xa756('0x82')};var _0x8e279f=[];var _0x191c86=[];var _0x58d602={};return db[_0xa756('0x39')][_0xa756('0x57')]({'where':{'id':_0x5e1055[_0xa756('0x55')]['id']},'include':[{'model':db[_0xa756('0x7b')],'as':'Applications'}]})[_0xa756('0x31')](handleEntityNotFound(_0x224764,null))[_0xa756('0x31')](function(_0x5e6220){_0x220017[_0xa756('0x83')]=_0x5e6220;if(_0x220017[_0xa756('0x83')]&&_0x220017[_0xa756('0x83')][_0xa756('0x3c')]===_0xa756('0x84')&&_0x5e1055[_0xa756('0x60')][_0xa756('0x85')]){if(_0x5e1055[_0xa756('0x60')][_0xa756('0x85')]['length']===0x0)return;if(_0x5e1055[_0xa756('0x60')][_0xa756('0x85')][0x0][_0xa756('0x86')]!==_0xa756('0x87'))return;return db[_0xa756('0x88')][_0xa756('0x30')]({'read':!![],'readAt':_0x5e1055[_0xa756('0x60')][_0xa756('0x85')][0x0][_0xa756('0x89')]},{'where':{'messageId':_0x5e1055['body']['statuses'][0x0]['message_id']},'individualHooks':!![]})['then'](function(_0x58ce2e){return _0x224764[_0xa756('0x27')](0xc8)[_0xa756('0x28')](_0x58ce2e);});}_0x220017[_0xa756('0x8a')]=_[_0xa756('0x8b')](_0x5e6220['Applications'],['priority'],[_0xa756('0x8c')]);if(_0x220017[_0xa756('0x83')][_0xa756('0x8d')]){delete _0x220017[_0xa756('0x83')][_0xa756('0x8d')];}return db[_0xa756('0x8e')]['describe']()['then'](function(_0x1cdf5f){if(!_0x1cdf5f){throw new db[(_0xa756('0x8f'))]['ValidationError']('no\x20available\x20attributes');}_0x8e279f=_['difference'](_['keys'](_0x1cdf5f),[_0xa756('0x90'),'updatedAt']);_0x191c86=_[_0xa756('0x91')](_[_0xa756('0x41')](_0x1cdf5f),[_0xa756('0x90'),_0xa756('0x92'),_0xa756('0x93'),_0xa756('0x94')]);_0x220017[_0xa756('0x60')]={'mapKey':_0xa756('0x95')};if(_0x220017[_0xa756('0x83')]&&_0x220017[_0xa756('0x83')][_0xa756('0x3c')]===_0xa756('0x96')){_0x220017[_0xa756('0x60')][_0xa756('0x97')]=_0x5e1055[_0xa756('0x60')][_0xa756('0x98')][_0xa756('0x99')](_0xa756('0x9a'),'');_0x220017['body'][_0xa756('0x60')]=_0x5e1055[_0xa756('0x60')]['Body'];_0x220017['body'][_0xa756('0x9b')]=_0x5e1055[_0xa756('0x60')][_0xa756('0x9c')];}if(_0x220017[_0xa756('0x83')]&&_0x220017[_0xa756('0x83')][_0xa756('0x3c')]===_0xa756('0x84')){_0x220017[_0xa756('0x60')]['from']=_0x5e1055[_0xa756('0x60')][_0xa756('0x9d')][0x0][_0xa756('0x97')];_0x220017['body'][_0xa756('0x60')]=_0x5e1055[_0xa756('0x60')][_0xa756('0x9d')][0x0][_0xa756('0x23')][_0xa756('0x60')];_0x220017[_0xa756('0x60')][_0xa756('0x9b')]=_0x5e1055[_0xa756('0x60')]['notifications'][0x0]['message_id'];}if(_0x220017[_0xa756('0x60')]['id']){delete _0x220017[_0xa756('0x60')]['id'];}if(_['isNil'](_0x220017['body']['from'])){throw new db[(_0xa756('0x8f'))]['ValidationError'](_0xa756('0x9e'));}if(_[_0xa756('0x9f')](_0x220017[_0xa756('0x60')][_0xa756('0x60')])||_0x220017[_0xa756('0x60')][_0xa756('0x60')]===''){throw new db[(_0xa756('0x8f'))]['ValidationError']('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0xa756('0x9f')](_0x220017[_0xa756('0x60')][_0xa756('0xa0')])){throw new db[(_0xa756('0x8f'))][(_0xa756('0xa1'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x191c86);}if(!_[_0xa756('0xa2')](_0x191c86,_0x220017[_0xa756('0x60')][_0xa756('0xa0')])){throw new db[(_0xa756('0x8f'))][(_0xa756('0xa1'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x191c86);}_0x58d602[_0x220017['body'][_0xa756('0xa0')]]=_0x220017[_0xa756('0x60')]['from'];return db[_0xa756('0xa3')][_0xa756('0x57')]({'where':{'id':_0x220017[_0xa756('0x83')][_0xa756('0x94')]},'include':[{'model':db['CmContact'],'as':_0xa756('0xa4'),'where':_0x58d602,'limit':0x1,'order':[[_0xa756('0x92'),'DESC']]}]});})['then'](handleEntityNotFound(_0x224764,null))[_0xa756('0x31')](function(_0x1440c6){if(_0x1440c6){_0x220017[_0xa756('0xa5')]=_[_0xa756('0x6e')](_0x1440c6,[_0xa756('0xa4')]);if(_0x1440c6[_0xa756('0xa4')][_0xa756('0x56')]){return _0x1440c6[_0xa756('0xa4')][0x0];}var _0x55d62f=_[_0xa756('0xa6')](_0x220017[_0xa756('0x60')],{'firstName':_0x220017[_0xa756('0x60')][_0xa756('0x97')],'ListId':_0x1440c6['id']});_0x55d62f[_0x220017[_0xa756('0x60')]['mapKey']]=_0x220017[_0xa756('0x60')][_0xa756('0x97')];return db[_0xa756('0x8e')][_0xa756('0x58')](_0x55d62f,{'fields':_0x8e279f,'raw':!![]});}})[_0xa756('0x31')](handleEntityNotFound(_0x224764,null))[_0xa756('0x31')](function(_0x1d776c){if(_0x1d776c){_0x220017[_0xa756('0xa7')]=_0x1d776c;var _0x359a6e={'ContactId':_0x1d776c['id'],'phone':_0x220017[_0xa756('0x60')][_0xa756('0x97')],'WhatsappAccountId':_0x5e1055[_0xa756('0x55')]['id']};var _0x30810d={'ContactId':_0x1d776c['id'],'WhatsappAccountId':_0x5e1055['params']['id'],'closed':![]};return db[_0xa756('0xa8')][_0xa756('0x57')]({'where':_0x30810d})[_0xa756('0x31')](function(_0x3ce451){if(_0x3ce451){return[_0x3ce451,![]];}return db[_0xa756('0xa8')]['create'](_0x359a6e)[_0xa756('0x31')](function(_0x4c3a31){return[_0x4c3a31,!![]];});});}})[_0xa756('0x6f')](function(_0x362f74,_0x2fdc5e){_0x220017[_0xa756('0xa9')]=_0x362f74[_0xa756('0x33')]({'plain':!![]});_0x220017[_0xa756('0xa9')][_0xa756('0xaa')]=![];if(_0x2fdc5e){if(_0x220017['account'][_0xa756('0xab')]){_0x220017['applications'][_0xa756('0xac')]({'id':0x0,'priority':_0x220017['applications'][_0xa756('0x56')]+0x1,'app':'close','appdata':_0xa756('0xad'),'interval':_0xa756('0xae')});}_0x220017['interaction'][_0xa756('0xaa')]=!![];}return db[_0xa756('0x88')][_0xa756('0x58')]({'phone':_0x220017[_0xa756('0x60')][_0xa756('0x97')],'messageId':_0x220017[_0xa756('0x60')][_0xa756('0x9b')],'body':_0x220017['body'][_0xa756('0x60')],'WhatsappAccountId':_0x5e1055[_0xa756('0x55')]['id'],'WhatsappInteractionId':_0x362f74['id'],'direction':'in','ContactId':_0x362f74[_0xa756('0xaf')],'AttachmentId':_0x220017['body'][_0xa756('0xb0')]});})[_0xa756('0x31')](function(_0x374c4f){_0x220017[_0xa756('0x23')]=_0x374c4f;if(_0x220017[_0xa756('0xa9')][_0xa756('0xb1')]){return db['User'][_0xa756('0x57')]({'attributes':['id',_0xa756('0x3f')],'where':{'id':_0x220017[_0xa756('0xa9')][_0xa756('0xb1')]}})[_0xa756('0x31')](function(_0x418147){if(_0x418147){_0x220017[_0xa756('0x8a')][_0xa756('0xb2')]({'id':0x0,'priority':0x0,'app':_0xa756('0xb3'),'appdata':_0x418147[_0xa756('0x3f')]+','+(_0x220017[_0xa756('0x83')][_0xa756('0xb4')]||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0xa756('0xb5'),_0xa756('0xb6'),_0x220017);});}return respondWithRpcPromise('Start',_0xa756('0xb6'),_0x220017);})[_0xa756('0x31')](function(_0x19dda3){if(_0x19dda3){var _0x1abba5=0xc8;var _0x6e5947=_0xa756('0xb7');logger[_0xa756('0x1c')](_0xa756('0x1f'),_0x6e5947,_0x1abba5,_0xa756('0xb8'));logger['debug'](_0xa756('0xb9'),_0x6e5947,_0x1abba5,'entity\x20found',JSON[_0xa756('0xba')](_0x19dda3));if(_0x220017['account'][_0xa756('0x3c')]===_0xa756('0x96')){return _0x224764[_0xa756('0x27')](_0x1abba5)[_0xa756('0x2d')](_0xa756('0xbb'),_0xa756('0xbc'))[_0xa756('0x36')](_0xa756('0xbd'));}else{return _0x224764[_0xa756('0x27')](_0x1abba5)[_0xa756('0x28')](_0x19dda3);}}});})[_0xa756('0x53')](handleError(_0x224764,null));};exports[_0xa756('0x36')]=function(_0x17ce67,_0xc2f460,_0x109bc1){var _0x3ed265,_0x408424,_0x58b39e;if(_[_0xa756('0x9f')](_0x17ce67['body'][_0xa756('0x60')])||_0x17ce67[_0xa756('0x60')][_0xa756('0x60')]===''){throw new db[(_0xa756('0x8f'))][(_0xa756('0xa1'))](_0xa756('0xbe'));}if(_[_0xa756('0x9f')](_0x17ce67[_0xa756('0x60')]['to'])){throw new db[(_0xa756('0x8f'))][(_0xa756('0xa1'))](_0xa756('0xbf'));}_0x3ed265=_0x17ce67[_0xa756('0x60')]['to'];return db[_0xa756('0x39')][_0xa756('0x57')]({'where':{'id':_0x17ce67[_0xa756('0x55')]['id']},'include':[{'model':db['CmList'],'as':'List','include':[{'model':db[_0xa756('0x8e')],'as':'Contacts','where':{'mobile':_0x3ed265},'limit':0x1,'order':[[_0xa756('0x92'),_0xa756('0xc0')]]}]}]})[_0xa756('0x31')](handleEntityNotFound(_0xc2f460,null))['then'](function(_0x1a92fe){if(_0x1a92fe&&_0x1a92fe[_0xa756('0xc1')]){_0x408424=_0x1a92fe['get']({'plain':!![]});if(_0x408424[_0xa756('0xc1')]&&_0x408424[_0xa756('0xc1')]['Contacts'][_0xa756('0x56')]){return _0x408424[_0xa756('0xc1')]['Contacts'][0x0];}return db[_0xa756('0x8e')]['create'](_[_0xa756('0xa6')](_0x17ce67[_0xa756('0x60')],{'firstName':_0x3ed265,'mobile':_0x3ed265,'phone':_0x3ed265,'ListId':_0x408424[_0xa756('0x94')]}));}})[_0xa756('0x31')](handleEntityNotFound(_0xc2f460,null))['then'](function(_0x464843){if(_0x464843){_0x58b39e=_0x464843;return db[_0xa756('0xa8')][_0xa756('0x57')]({'where':{'ContactId':_0x58b39e['id'],'closed':![],'WhatsappAccountId':_0x408424['id']}})[_0xa756('0x31')](function(_0x13891e){if(_0x13891e){return[_0x13891e,![]];}return db[_0xa756('0xa8')]['create']({'UserId':_0x17ce67[_0xa756('0x59')]['id'],'ContactId':_0x58b39e['id'],'WhatsappAccountId':_0x408424['id'],'phone':_0x3ed265,'firstMsgDirection':_0xa756('0xc2'),'Messages':[_[_0xa756('0x4d')](_0x17ce67[_0xa756('0x60')],{'read':![],'body':_0x17ce67['body']['body'],'phone':_0x3ed265,'WhatsappAccountId':_0x408424['id'],'UserId':_0x17ce67['user']['id'],'ContactId':_0x58b39e['id']})]},{'include':[{'model':db['WhatsappMessage'],'as':'Messages'}]})[_0xa756('0x31')](function(_0x460be3){return[_0x460be3,!![]];});});}})[_0xa756('0x6f')](function(_0x13136d,_0x322a14){if(_0x322a14){return _0x13136d;}return db[_0xa756('0x88')][_0xa756('0x58')](_[_0xa756('0x4d')](_0x17ce67[_0xa756('0x60')],{'read':![],'body':_0x17ce67[_0xa756('0x60')][_0xa756('0x60')],'phone':_0x3ed265,'WhatsappAccountId':_0x408424['id'],'WhatsappInteractionId':_0x13136d['id'],'UserId':_0x17ce67['user']['id'],'ContactId':_0x58b39e['id']}))[_0xa756('0x31')](function(_0x2e4352){_0x13136d[_0xa756('0xc3')][_0xa756('0xc4')]=[];_0x13136d[_0xa756('0xc3')][_0xa756('0xc4')][_0xa756('0xac')](_0x2e4352[_0xa756('0xc3')]);return _0x13136d;});})[_0xa756('0x31')](respondWithResult(_0xc2f460,null))['catch'](handleError(_0xc2f460,null));}; \ No newline at end of file +var _0xe07e=['AttachmentId','User','UserId','unshift','agent','waitForTheAssignedAgent','Start','startRouting','receiveMessage','WhatsappAccount,\x20%s,\x20%s,\x20%s','entity\x20found','debug','Content-Type','text/xml','to\x20is\x20mandatory','CmList','List','DESC','user','out','dataValues','Messages','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','defaults','redis','socket.io-emitter','./whatsappAccount.socket','register','jayson/promise','client','then','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','status','end','json','offset','undefined','limit','count','set','apply','update','destroy','WhatsappAccounts','UserProfileResource','stack','name','index','mandatoryDispositionPause','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','map','options','WhatsappAccount','includeAll','include','findAll','show','params','find','create','body','get','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Pause','describe','addDisposition','WhatsappAccountId','Disposition','getDispositions','findOne','hasOwnProperty','rows','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','addAgents','omit','emit','userWhatsappAccount:save','removeAgents','isArray','userWhatsappAccount:remove','getAgents','addApplications','sequelize','Transaction','ISOLATION_LEVELS','READ_COMMITTED','WhatsappApplication','bulkCreate','findAndCountAll','priority','sendStatus','send','getApplications','notify','whatsapp','account','statuses','state','WhatsappMessage','timestamp','message_id','orderBy','Applications','asc','ValidationError','difference','updatedAt','createdAt','CompanyId','ListId','mobile','twilio','From','replace','whatsapp:','messageId','MessageSid','sinch','notifications','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','Sequelize','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','from','CmContact','Contacts','list','contact','WhatsappInteraction','spread','interaction','created','autoclose','applications','push','unmanaged','*,*,*,*','ContactId'];(function(_0x557bf4,_0x1f8dad){var _0x2916e2=function(_0x4fef9b){while(--_0x4fef9b){_0x557bf4['push'](_0x557bf4['shift']());}};_0x2916e2(++_0x1f8dad);}(_0xe07e,0x19a));var _0xee07=function(_0x1b4002,_0x5b4094){_0x1b4002=_0x1b4002-0x0;var _0x1716f3=_0xe07e[_0x1b4002];return _0x1716f3;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xee07('0x0'));var jsonpatch=require(_0xee07('0x1'));var rp=require(_0xee07('0x2'));var moment=require(_0xee07('0x3'));var BPromise=require(_0xee07('0x4'));var Mustache=require(_0xee07('0x5'));var util=require('util');var path=require('path');var sox=require(_0xee07('0x6'));var csv=require(_0xee07('0x7'));var ejs=require(_0xee07('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xee07('0x9'));var squel=require(_0xee07('0xa'));var crypto=require(_0xee07('0xb'));var jsforce=require(_0xee07('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xee07('0xd'));var Papa=require(_0xee07('0xe'));var Redis=require(_0xee07('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xee07('0x10'));var logger=require(_0xee07('0x11'))(_0xee07('0x12'));var utils=require(_0xee07('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0xee07('0x14'));var db=require('../../mysqldb')['db'];config['redis']=_[_0xee07('0x15')](config[_0xee07('0x16')],{'host':'localhost','port':0x18eb});var socket=require(_0xee07('0x17'))(new Redis(config[_0xee07('0x16')]));require(_0xee07('0x18'))[_0xee07('0x19')](socket);var jayson=require(_0xee07('0x1a'));var client=jayson[_0xee07('0x1b')]['http']({'port':0x232c});function respondWithRpcPromise(_0x10d323,_0x40d763,_0x19025e,_0x2da536){return new BPromise(function(_0x56e38f,_0x172c00){var _0x141e52=_0x2da536||client;return _0x141e52['request'](_0x10d323,_0x19025e)[_0xee07('0x1c')](function(_0x19ad06){logger[_0xee07('0x1d')](_0xee07('0x1e'),_0x40d763,_0xee07('0x1f'));logger['debug']('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x40d763,_0xee07('0x1f'),JSON[_0xee07('0x20')](_0x19ad06));if(_0x19ad06[_0xee07('0x21')]){if(_0x19ad06['error'][_0xee07('0x22')]===0x1f4){logger[_0xee07('0x21')](_0xee07('0x1e'),_0x40d763,_0x19ad06[_0xee07('0x21')][_0xee07('0x23')]);return _0x172c00(_0x19ad06[_0xee07('0x21')][_0xee07('0x23')]);}logger[_0xee07('0x21')](_0xee07('0x1e'),_0x40d763,_0x19ad06[_0xee07('0x21')][_0xee07('0x23')]);return _0x56e38f(_0x19ad06[_0xee07('0x21')][_0xee07('0x23')]);}else{logger[_0xee07('0x1d')]('WhatsappAccount,\x20%s,\x20%s',_0x40d763,'request\x20sent');_0x56e38f(_0x19ad06[_0xee07('0x24')][_0xee07('0x23')]);}})[_0xee07('0x25')](function(_0x45f67e){logger[_0xee07('0x21')](_0xee07('0x1e'),_0x40d763,_0x45f67e);_0x172c00(_0x45f67e);});});}function respondWithStatusCode(_0x11ef95,_0x236ee6){_0x236ee6=_0x236ee6||0xcc;return function(_0x562a6a){if(_0x562a6a){return _0x11ef95['sendStatus'](_0x236ee6);}return _0x11ef95[_0xee07('0x26')](_0x236ee6)[_0xee07('0x27')]();};}function respondWithResult(_0x236374,_0x187c80){_0x187c80=_0x187c80||0xc8;return function(_0x41b154){if(_0x41b154){return _0x236374[_0xee07('0x26')](_0x187c80)[_0xee07('0x28')](_0x41b154);}};}function respondWithFilteredResult(_0x33d7af,_0x528f9e){return function(_0x26e74f){if(_0x26e74f){var _0x3fe293=typeof _0x528f9e[_0xee07('0x29')]===_0xee07('0x2a')&&typeof _0x528f9e[_0xee07('0x2b')]===_0xee07('0x2a');var _0x4e2cfd=_0x26e74f[_0xee07('0x2c')];var _0x3bda3c=_0x3fe293?0x0:_0x528f9e[_0xee07('0x29')];var _0xaa7a46=_0x3fe293?_0x26e74f[_0xee07('0x2c')]:_0x528f9e[_0xee07('0x29')]+_0x528f9e[_0xee07('0x2b')];var _0x16f94b;if(_0xaa7a46>=_0x4e2cfd){_0xaa7a46=_0x4e2cfd;_0x16f94b=0xc8;}else{_0x16f94b=0xce;}_0x33d7af[_0xee07('0x26')](_0x16f94b);return _0x33d7af[_0xee07('0x2d')]('Content-Range',_0x3bda3c+'-'+_0xaa7a46+'/'+_0x4e2cfd)[_0xee07('0x28')](_0x26e74f);}return null;};}function patchUpdates(_0x153ff6){return function(_0x5c3044){try{jsonpatch[_0xee07('0x2e')](_0x5c3044,_0x153ff6,!![]);}catch(_0x25c160){return BPromise['reject'](_0x25c160);}return _0x5c3044['save']();};}function saveUpdates(_0x2408a8,_0x159f83){return function(_0x4f15d8){if(_0x4f15d8){return _0x4f15d8[_0xee07('0x2f')](_0x2408a8)['then'](function(_0x475921){return _0x475921;});}return null;};}function removeEntity(_0x311040,_0x4a4a04){return function(_0x3f0c1b){if(_0x3f0c1b){return _0x3f0c1b[_0xee07('0x30')]()[_0xee07('0x1c')](function(){var _0x578ed5=_0x3f0c1b['get']({'plain':!![]});var _0x5c272b=_0xee07('0x31');return db[_0xee07('0x32')][_0xee07('0x30')]({'where':{'type':_0x5c272b,'resourceId':_0x578ed5['id']}})[_0xee07('0x1c')](function(){return _0x3f0c1b;});})[_0xee07('0x1c')](function(){_0x311040[_0xee07('0x26')](0xcc)[_0xee07('0x27')]();});}};}function handleEntityNotFound(_0x5119fa,_0x3f163a){return function(_0x4379d5){if(!_0x4379d5){_0x5119fa['sendStatus'](0x194);}return _0x4379d5;};}function handleError(_0x559940,_0x307d1b){_0x307d1b=_0x307d1b||0x1f4;return function(_0x6dac4f){logger[_0xee07('0x21')](_0x6dac4f[_0xee07('0x33')]);if(_0x6dac4f['name']){delete _0x6dac4f[_0xee07('0x34')];}_0x559940[_0xee07('0x26')](_0x307d1b)['send'](_0x6dac4f);};}exports[_0xee07('0x35')]=function(_0x1064ec,_0x3e8a73){var _0x5e8d5a={'include':[{'model':db['Pause'],'as':_0xee07('0x36')}]},_0x303d68={},_0x2ee986={'count':0x0,'rows':[]};var _0x2a5d49=_['map'](db['WhatsappAccount'][_0xee07('0x37')],function(_0xf1c280){return{'name':_0xf1c280['fieldName'],'type':_0xf1c280[_0xee07('0x38')][_0xee07('0x39')]};});_0x303d68[_0xee07('0x3a')]=_['map'](_0x2a5d49,_0xee07('0x34'));_0x303d68[_0xee07('0x3b')]=_[_0xee07('0x3c')](_0x1064ec['query']);_0x303d68[_0xee07('0x3d')]=_[_0xee07('0x3e')](_0x303d68[_0xee07('0x3a')],_0x303d68['query']);_0x5e8d5a[_0xee07('0x3f')]=_['intersection'](_0x303d68[_0xee07('0x3a')],qs[_0xee07('0x40')](_0x1064ec[_0xee07('0x3b')][_0xee07('0x40')]));_0x5e8d5a[_0xee07('0x3f')]=_0x5e8d5a[_0xee07('0x3f')][_0xee07('0x41')]?_0x5e8d5a[_0xee07('0x3f')]:_0x303d68[_0xee07('0x3a')];if(!_0x1064ec[_0xee07('0x3b')]['hasOwnProperty'](_0xee07('0x42'))){_0x5e8d5a[_0xee07('0x2b')]=qs['limit'](_0x1064ec['query'][_0xee07('0x2b')]);_0x5e8d5a['offset']=qs[_0xee07('0x29')](_0x1064ec[_0xee07('0x3b')][_0xee07('0x29')]);}_0x5e8d5a[_0xee07('0x43')]=qs[_0xee07('0x44')](_0x1064ec['query'][_0xee07('0x44')]);_0x5e8d5a[_0xee07('0x45')]=qs[_0xee07('0x3d')](_[_0xee07('0x46')](_0x1064ec[_0xee07('0x3b')],_0x303d68[_0xee07('0x3d')]),_0x2a5d49);if(_0x1064ec[_0xee07('0x3b')][_0xee07('0x47')]){_0x5e8d5a[_0xee07('0x45')]=_[_0xee07('0x48')](_0x5e8d5a[_0xee07('0x45')],{'$or':_[_0xee07('0x49')](_0x2a5d49,function(_0x134bd5){if(_0x134bd5[_0xee07('0x38')]!=='VIRTUAL'){var _0x49b086={};_0x49b086[_0x134bd5[_0xee07('0x34')]]={'$like':'%'+_0x1064ec[_0xee07('0x3b')][_0xee07('0x47')]+'%'};return _0x49b086;}})});}_0x5e8d5a=_[_0xee07('0x48')]({},_0x5e8d5a,_0x1064ec[_0xee07('0x4a')]);var _0x383903={'where':_0x5e8d5a[_0xee07('0x45')]};return db[_0xee07('0x4b')]['count'](_0x383903)[_0xee07('0x1c')](function(_0xda8f81){_0x2ee986[_0xee07('0x2c')]=_0xda8f81;if(_0x1064ec[_0xee07('0x3b')][_0xee07('0x4c')]){_0x5e8d5a[_0xee07('0x4d')]=[{'all':!![]}];}return db[_0xee07('0x4b')][_0xee07('0x4e')](_0x5e8d5a);})[_0xee07('0x1c')](function(_0xaca1f3){_0x2ee986['rows']=_0xaca1f3;return _0x2ee986;})[_0xee07('0x1c')](respondWithFilteredResult(_0x3e8a73,_0x5e8d5a))['catch'](handleError(_0x3e8a73,null));};exports[_0xee07('0x4f')]=function(_0x5bc3c1,_0x4eeecb){var _0x551fe6={'raw':![],'where':{'id':_0x5bc3c1[_0xee07('0x50')]['id']},'include':[{'model':db['Pause'],'as':_0xee07('0x36')}]},_0x3f835b={};_0x3f835b['model']=_[_0xee07('0x3c')](db[_0xee07('0x4b')][_0xee07('0x37')]);_0x3f835b[_0xee07('0x3b')]=_[_0xee07('0x3c')](_0x5bc3c1[_0xee07('0x3b')]);_0x3f835b[_0xee07('0x3d')]=_[_0xee07('0x3e')](_0x3f835b[_0xee07('0x3a')],_0x3f835b['query']);_0x551fe6[_0xee07('0x3f')]=_['intersection'](_0x3f835b['model'],qs[_0xee07('0x40')](_0x5bc3c1[_0xee07('0x3b')][_0xee07('0x40')]));_0x551fe6[_0xee07('0x3f')]=_0x551fe6[_0xee07('0x3f')][_0xee07('0x41')]?_0x551fe6[_0xee07('0x3f')]:_0x3f835b['model'];if(_0x5bc3c1[_0xee07('0x3b')][_0xee07('0x4c')]){_0x551fe6[_0xee07('0x4d')]=[{'all':!![]}];}_0x551fe6=_[_0xee07('0x48')]({},_0x551fe6,_0x5bc3c1['options']);return db[_0xee07('0x4b')][_0xee07('0x51')](_0x551fe6)[_0xee07('0x1c')](handleEntityNotFound(_0x4eeecb,null))['then'](respondWithResult(_0x4eeecb,null))['catch'](handleError(_0x4eeecb,null));};exports[_0xee07('0x52')]=function(_0x56f490,_0xe5a6b8){return db[_0xee07('0x4b')][_0xee07('0x52')](_0x56f490[_0xee07('0x53')],{})[_0xee07('0x1c')](function(_0x2e0073){var _0x151f69=_0x56f490['user'][_0xee07('0x54')]({'plain':!![]});if(!_0x151f69)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x151f69[_0xee07('0x55')]==='user'){var _0x2131be=_0x2e0073['get']({'plain':!![]});var _0x4e7c1c=_0xee07('0x31');return db[_0xee07('0x56')]['find']({'where':{'name':_0x4e7c1c,'userProfileId':_0x151f69[_0xee07('0x57')]},'raw':!![]})[_0xee07('0x1c')](function(_0x3a7461){if(_0x3a7461&&_0x3a7461[_0xee07('0x58')]===0x0){return db[_0xee07('0x32')][_0xee07('0x52')]({'name':_0x2131be[_0xee07('0x34')],'resourceId':_0x2131be['id'],'type':_0x3a7461[_0xee07('0x34')],'sectionId':_0x3a7461['id']},{})[_0xee07('0x1c')](function(){return _0x2e0073;});}else{return _0x2e0073;}})[_0xee07('0x25')](function(_0x36f27e){logger[_0xee07('0x21')](_0xee07('0x59'),_0x36f27e);throw _0x36f27e;});}return _0x2e0073;})[_0xee07('0x1c')](respondWithResult(_0xe5a6b8,0xc9))[_0xee07('0x25')](handleError(_0xe5a6b8,null));};exports[_0xee07('0x2f')]=function(_0x5d0483,_0x552223){if(_0x5d0483[_0xee07('0x53')]['id']){delete _0x5d0483[_0xee07('0x53')]['id'];}return db['WhatsappAccount'][_0xee07('0x51')]({'where':{'id':_0x5d0483[_0xee07('0x50')]['id']},'include':[{'model':db[_0xee07('0x5a')],'as':_0xee07('0x36')}]})['then'](handleEntityNotFound(_0x552223,null))[_0xee07('0x1c')](saveUpdates(_0x5d0483[_0xee07('0x53')],null))[_0xee07('0x1c')](respondWithResult(_0x552223,null))[_0xee07('0x25')](handleError(_0x552223,null));};exports[_0xee07('0x30')]=function(_0x331db8,_0x2eae0d){return db['WhatsappAccount']['find']({'where':{'id':_0x331db8['params']['id']}})['then'](handleEntityNotFound(_0x2eae0d,null))[_0xee07('0x1c')](removeEntity(_0x2eae0d,null))[_0xee07('0x25')](handleError(_0x2eae0d,null));};exports[_0xee07('0x5b')]=function(_0x1cd923,_0x172890){return db['WhatsappAccount'][_0xee07('0x5b')]()[_0xee07('0x1c')](respondWithResult(_0x172890,null))[_0xee07('0x25')](handleError(_0x172890,null));};exports[_0xee07('0x5c')]=function(_0x493538,_0x25c3d8,_0x4417b6){if(_0x493538[_0xee07('0x53')]['id']){delete _0x493538[_0xee07('0x53')]['id'];}return db[_0xee07('0x4b')][_0xee07('0x51')]({'where':{'id':_0x493538[_0xee07('0x50')]['id']}})[_0xee07('0x1c')](handleEntityNotFound(_0x25c3d8,null))[_0xee07('0x1c')](function(_0x14fcee){if(_0x14fcee){_0x493538['body'][_0xee07('0x5d')]=_0x14fcee['id'];return db[_0xee07('0x5e')][_0xee07('0x52')](_0x493538[_0xee07('0x53')]);}})['then'](respondWithResult(_0x25c3d8,null))[_0xee07('0x25')](handleError(_0x25c3d8,null));};exports[_0xee07('0x5f')]=function(_0x2f9628,_0x4b2ea1,_0x119633){var _0x51cc5b={'raw':![],'where':{}};var _0x4f6a44={};var _0x23cf49={'count':0x0,'rows':[]};return db[_0xee07('0x4b')][_0xee07('0x60')]({'where':{'id':_0x2f9628['params']['id']}})[_0xee07('0x1c')](handleEntityNotFound(_0x4b2ea1,null))[_0xee07('0x1c')](function(_0x3020e1){if(_0x3020e1){_0x4f6a44[_0xee07('0x3a')]=_['keys'](db[_0xee07('0x5e')][_0xee07('0x37')]);_0x4f6a44[_0xee07('0x3b')]=_[_0xee07('0x3c')](_0x2f9628['query']);_0x4f6a44[_0xee07('0x3d')]=_[_0xee07('0x3e')](_0x4f6a44[_0xee07('0x3a')],_0x4f6a44[_0xee07('0x3b')]);_0x51cc5b[_0xee07('0x3f')]=_[_0xee07('0x3e')](_0x4f6a44[_0xee07('0x3a')],qs[_0xee07('0x40')](_0x2f9628[_0xee07('0x3b')]['fields']));_0x51cc5b[_0xee07('0x3f')]=_0x51cc5b[_0xee07('0x3f')]['length']?_0x51cc5b[_0xee07('0x3f')]:_0x4f6a44[_0xee07('0x3a')];if(!_0x2f9628[_0xee07('0x3b')][_0xee07('0x61')](_0xee07('0x42'))){_0x51cc5b[_0xee07('0x2b')]=qs[_0xee07('0x2b')](_0x2f9628[_0xee07('0x3b')][_0xee07('0x2b')]);_0x51cc5b[_0xee07('0x29')]=qs['offset'](_0x2f9628[_0xee07('0x3b')][_0xee07('0x29')]);}_0x51cc5b[_0xee07('0x43')]=qs['sort'](_0x2f9628[_0xee07('0x3b')][_0xee07('0x44')]);_0x51cc5b[_0xee07('0x45')]=qs[_0xee07('0x3d')](_[_0xee07('0x46')](_0x2f9628['query'],_0x4f6a44['filters']));_0x51cc5b[_0xee07('0x45')]['WhatsappAccountId']=_0x3020e1['id'];if(_0x2f9628[_0xee07('0x3b')][_0xee07('0x47')]){_0x51cc5b[_0xee07('0x45')]=_[_0xee07('0x48')](_0x51cc5b[_0xee07('0x45')],{'$or':_[_0xee07('0x49')](_0x51cc5b['attributes'],function(_0x404d1a){var _0x231f38={};_0x231f38[_0x404d1a]={'$like':'%'+_0x2f9628[_0xee07('0x3b')][_0xee07('0x47')]+'%'};return _0x231f38;})});}_0x51cc5b=_[_0xee07('0x48')]({},_0x51cc5b,_0x2f9628[_0xee07('0x4a')]);return db[_0xee07('0x5e')][_0xee07('0x2c')]({'where':_0x51cc5b['where']})['then'](function(_0x289226){_0x23cf49[_0xee07('0x2c')]=_0x289226;if(_0x2f9628[_0xee07('0x3b')][_0xee07('0x4c')]){_0x51cc5b['include']=[{'all':!![]}];}return db[_0xee07('0x5e')][_0xee07('0x4e')](_0x51cc5b);})[_0xee07('0x1c')](function(_0x48cf45){_0x23cf49[_0xee07('0x62')]=_0x48cf45;return _0x23cf49;});}})[_0xee07('0x1c')](respondWithFilteredResult(_0x4b2ea1,_0x51cc5b))['catch'](handleError(_0x4b2ea1,null));};exports['removeDispositions']=function(_0x13438e,_0x58f05c,_0x5b2d84){return db['WhatsappAccount'][_0xee07('0x51')]({'where':{'id':_0x13438e[_0xee07('0x50')]['id']}})[_0xee07('0x1c')](handleEntityNotFound(_0x58f05c,null))[_0xee07('0x1c')](function(_0x4881ea){if(_0x4881ea){return _0x4881ea[_0xee07('0x63')](_0x13438e[_0xee07('0x3b')][_0xee07('0x64')]);}})[_0xee07('0x1c')](respondWithStatusCode(_0x58f05c,null))[_0xee07('0x25')](handleError(_0x58f05c,null));};exports[_0xee07('0x65')]=function(_0x14fd2f,_0x1ce498,_0x4b61cc){if(_0x14fd2f[_0xee07('0x53')]['id']){delete _0x14fd2f[_0xee07('0x53')]['id'];}return db[_0xee07('0x4b')]['find']({'where':{'id':_0x14fd2f['params']['id']}})[_0xee07('0x1c')](handleEntityNotFound(_0x1ce498,null))[_0xee07('0x1c')](function(_0x59e955){if(_0x59e955){_0x14fd2f[_0xee07('0x53')][_0xee07('0x5d')]=_0x59e955['id'];return db[_0xee07('0x66')][_0xee07('0x52')](_0x14fd2f[_0xee07('0x53')]);}})[_0xee07('0x1c')](respondWithResult(_0x1ce498,null))[_0xee07('0x25')](handleError(_0x1ce498,null));};exports[_0xee07('0x67')]=function(_0x2ba589,_0x4da60a,_0x3a01c9){var _0x54e0bc={'raw':![],'where':{}};var _0x419b80={};var _0x52ccea={'count':0x0,'rows':[]};return db[_0xee07('0x4b')][_0xee07('0x60')]({'where':{'id':_0x2ba589['params']['id']}})['then'](handleEntityNotFound(_0x4da60a,null))[_0xee07('0x1c')](function(_0x372fec){if(_0x372fec){_0x419b80[_0xee07('0x3a')]=_['keys'](db['CannedAnswer'][_0xee07('0x37')]);_0x419b80['query']=_['keys'](_0x2ba589['query']);_0x419b80['filters']=_[_0xee07('0x3e')](_0x419b80[_0xee07('0x3a')],_0x419b80[_0xee07('0x3b')]);_0x54e0bc[_0xee07('0x3f')]=_[_0xee07('0x3e')](_0x419b80['model'],qs[_0xee07('0x40')](_0x2ba589[_0xee07('0x3b')][_0xee07('0x40')]));_0x54e0bc['attributes']=_0x54e0bc[_0xee07('0x3f')][_0xee07('0x41')]?_0x54e0bc[_0xee07('0x3f')]:_0x419b80[_0xee07('0x3a')];if(!_0x2ba589['query']['hasOwnProperty'](_0xee07('0x42'))){_0x54e0bc['limit']=qs[_0xee07('0x2b')](_0x2ba589[_0xee07('0x3b')][_0xee07('0x2b')]);_0x54e0bc[_0xee07('0x29')]=qs[_0xee07('0x29')](_0x2ba589[_0xee07('0x3b')][_0xee07('0x29')]);}_0x54e0bc['order']=qs[_0xee07('0x44')](_0x2ba589[_0xee07('0x3b')]['sort']);_0x54e0bc[_0xee07('0x45')]=qs['filters'](_[_0xee07('0x46')](_0x2ba589[_0xee07('0x3b')],_0x419b80[_0xee07('0x3d')]));_0x54e0bc[_0xee07('0x45')][_0xee07('0x5d')]=_0x372fec['id'];if(_0x2ba589['query']['filter']){_0x54e0bc['where']=_['merge'](_0x54e0bc[_0xee07('0x45')],{'$or':_[_0xee07('0x49')](_0x54e0bc[_0xee07('0x3f')],function(_0x2a6a27){var _0x4f1089={};_0x4f1089[_0x2a6a27]={'$like':'%'+_0x2ba589[_0xee07('0x3b')][_0xee07('0x47')]+'%'};return _0x4f1089;})});}_0x54e0bc=_[_0xee07('0x48')]({},_0x54e0bc,_0x2ba589['options']);return db[_0xee07('0x66')]['count']({'where':_0x54e0bc[_0xee07('0x45')]})[_0xee07('0x1c')](function(_0x19b49c){_0x52ccea[_0xee07('0x2c')]=_0x19b49c;if(_0x2ba589['query'][_0xee07('0x4c')]){_0x54e0bc[_0xee07('0x4d')]=[{'all':!![]}];}return db['CannedAnswer'][_0xee07('0x4e')](_0x54e0bc);})['then'](function(_0x193ffd){_0x52ccea[_0xee07('0x62')]=_0x193ffd;return _0x52ccea;});}})['then'](respondWithFilteredResult(_0x4da60a,_0x54e0bc))[_0xee07('0x25')](handleError(_0x4da60a,null));};exports[_0xee07('0x68')]=function(_0x133d80,_0x5a7f3e,_0x21781b){return db[_0xee07('0x4b')][_0xee07('0x51')]({'where':{'id':_0x133d80[_0xee07('0x50')]['id']}})['then'](handleEntityNotFound(_0x5a7f3e,null))[_0xee07('0x1c')](function(_0x37ee1b){if(_0x37ee1b){return _0x37ee1b[_0xee07('0x68')](_0x133d80[_0xee07('0x3b')][_0xee07('0x64')]);}})['then'](respondWithStatusCode(_0x5a7f3e,null))[_0xee07('0x25')](handleError(_0x5a7f3e,null));};exports['addAgents']=function(_0x468584,_0x577e95,_0x4e41d9){return db[_0xee07('0x4b')][_0xee07('0x51')]({'where':{'id':_0x468584['params']['id']}})[_0xee07('0x1c')](handleEntityNotFound(_0x577e95,null))[_0xee07('0x1c')](function(_0x3b124c){if(_0x3b124c){return _0x3b124c[_0xee07('0x69')](_0x468584[_0xee07('0x53')][_0xee07('0x64')],_[_0xee07('0x6a')](_0x468584[_0xee07('0x53')],[_0xee07('0x64'),'id'])||{})['spread'](function(_0x563ac6){for(var _0xb9fb5d=0x0;_0xb9fb5d<_0x468584[_0xee07('0x53')][_0xee07('0x64')][_0xee07('0x41')];_0xb9fb5d+=0x1){socket[_0xee07('0x6b')](_0xee07('0x6c'),{'UserId':Number(_0x468584[_0xee07('0x53')]['ids'][_0xb9fb5d]),'WhatsappAccountId':Number(_0x468584[_0xee07('0x50')]['id'])});}return _0x563ac6;});}})['then'](respondWithResult(_0x577e95,null))[_0xee07('0x25')](handleError(_0x577e95,null));};exports[_0xee07('0x6d')]=function(_0x31abd6,_0x594d46,_0x264613){return db[_0xee07('0x4b')]['find']({'where':{'id':_0x31abd6[_0xee07('0x50')]['id']}})[_0xee07('0x1c')](handleEntityNotFound(_0x594d46,null))[_0xee07('0x1c')](function(_0x381932){if(_0x381932){return _0x381932['removeAgents'](_0x31abd6[_0xee07('0x3b')][_0xee07('0x64')])[_0xee07('0x1c')](function(){if(_[_0xee07('0x6e')](_0x31abd6[_0xee07('0x3b')]['ids'])){for(var _0x5122a1=0x0;_0x5122a1<_0x31abd6[_0xee07('0x3b')][_0xee07('0x64')]['length'];_0x5122a1+=0x1){socket['emit'](_0xee07('0x6f'),{'UserId':Number(_0x31abd6[_0xee07('0x3b')][_0xee07('0x64')][_0x5122a1]),'WhatsappAccountId':Number(_0x31abd6[_0xee07('0x50')]['id'])});}}else{socket[_0xee07('0x6b')]('userWhatsappAccount:remove',{'UserId':Number(_0x31abd6['query'][_0xee07('0x64')]),'WhatsappAccountId':Number(_0x31abd6[_0xee07('0x50')]['id'])});}});}})[_0xee07('0x1c')](respondWithStatusCode(_0x594d46,null))[_0xee07('0x25')](handleError(_0x594d46,null));};exports[_0xee07('0x70')]=function(_0x276102,_0x28ec9d,_0x5045df){var _0x43812d={};var _0x266f52={};var _0xc382ce;var _0x4bc9e8;return db[_0xee07('0x4b')]['findOne']({'where':{'id':_0x276102[_0xee07('0x50')]['id']}})['then'](handleEntityNotFound(_0x28ec9d,null))['then'](function(_0x45da57){if(_0x45da57){_0xc382ce=_0x45da57;_0x266f52[_0xee07('0x3a')]=_[_0xee07('0x3c')](db['User']['rawAttributes']);_0x266f52[_0xee07('0x3b')]=_[_0xee07('0x3c')](_0x276102[_0xee07('0x3b')]);_0x266f52['filters']=_[_0xee07('0x3e')](_0x266f52[_0xee07('0x3a')],_0x266f52[_0xee07('0x3b')]);_0x43812d['attributes']=_[_0xee07('0x3e')](_0x266f52[_0xee07('0x3a')],qs[_0xee07('0x40')](_0x276102[_0xee07('0x3b')][_0xee07('0x40')]));_0x43812d['attributes']=_0x43812d[_0xee07('0x3f')][_0xee07('0x41')]?_0x43812d['attributes']:_0x266f52[_0xee07('0x3a')];_0x43812d[_0xee07('0x43')]=qs[_0xee07('0x44')](_0x276102['query'][_0xee07('0x44')]);_0x43812d['where']=qs[_0xee07('0x3d')](_[_0xee07('0x46')](_0x276102['query'],_0x266f52[_0xee07('0x3d')]));if(_0x276102['query'][_0xee07('0x47')]){_0x43812d[_0xee07('0x45')]=_['merge'](_0x43812d['where'],{'$or':_['map'](_0x43812d[_0xee07('0x3f')],function(_0x16b321){var _0x572e15={};_0x572e15[_0x16b321]={'$like':'%'+_0x276102[_0xee07('0x3b')][_0xee07('0x47')]+'%'};return _0x572e15;})});}_0x43812d=_[_0xee07('0x48')]({},_0x43812d,_0x276102[_0xee07('0x4a')]);return _0xc382ce[_0xee07('0x70')](_0x43812d);}})[_0xee07('0x1c')](function(_0x45e730){if(_0x45e730){_0x4bc9e8=_0x45e730[_0xee07('0x41')];if(!_0x276102[_0xee07('0x3b')][_0xee07('0x61')]('nolimit')){_0x43812d[_0xee07('0x2b')]=qs[_0xee07('0x2b')](_0x276102[_0xee07('0x3b')]['limit']);_0x43812d[_0xee07('0x29')]=qs[_0xee07('0x29')](_0x276102['query']['offset']);}return _0xc382ce[_0xee07('0x70')](_0x43812d);}})[_0xee07('0x1c')](function(_0x396ac1){if(_0x396ac1){return _0x396ac1?{'count':_0x4bc9e8,'rows':_0x396ac1}:null;}})[_0xee07('0x1c')](respondWithResult(_0x28ec9d,null))[_0xee07('0x25')](handleError(_0x28ec9d,null));};exports[_0xee07('0x71')]=function(_0x59a582,_0x11f669){var _0x3a77b5=_0x59a582[_0xee07('0x50')]['id'];var _0x86df86=_0x59a582['body'];var _0x3885d9=0xc8;var _0x549059=null;return db[_0xee07('0x72')]['transaction']({'isolationLevel':db[_0xee07('0x72')][_0xee07('0x73')][_0xee07('0x74')][_0xee07('0x75')]},function(_0xf71272){return db[_0xee07('0x4b')]['findOne']({'where':{'id':_0x3a77b5},'transaction':_0xf71272})['then'](function(_0x1235fc){if(_0x1235fc){return db[_0xee07('0x76')][_0xee07('0x30')]({'where':{'WhatsappAccountId':_0x3a77b5},'transaction':_0xf71272})['then'](function(){var _0x1cca62=_['map'](_0x86df86,function(_0x27d106){_0x27d106[_0xee07('0x5d')]=_0x3a77b5;return _0x27d106;});return db[_0xee07('0x76')][_0xee07('0x77')](_0x1cca62,{'transaction':_0xf71272});});}else{_0x3885d9=0x194;_0x549059=[];}});})['then'](function(){if(_0x3885d9!==0x194){return db[_0xee07('0x76')][_0xee07('0x78')]({'where':{'WhatsappAccountId':_0x3a77b5},'order':_0xee07('0x79')})[_0xee07('0x1c')](function(_0x2560fb){_0x549059=_0x2560fb;});}})[_0xee07('0x25')](function(_0x1b65b4){_0x3885d9=0x1f4;logger[_0xee07('0x21')](_0x1b65b4['stack']);if(_0x1b65b4[_0xee07('0x34')]){delete _0x1b65b4[_0xee07('0x34')];}_0x549059=_0x1b65b4;})['finally'](function(){if(_0x549059===null){_0x11f669[_0xee07('0x7a')](_0x3885d9);}else{if(_0x3885d9===0x1f4){_0x11f669[_0xee07('0x26')](_0x3885d9)[_0xee07('0x7b')](_0x549059);}else{_0x11f669[_0xee07('0x26')](_0x3885d9)[_0xee07('0x28')](_0x549059);}}});};exports[_0xee07('0x7c')]=function(_0x58aa5b,_0x2cb82b,_0x5b7e70){var _0xd6612b={};var _0xb7d9d7={};var _0x344e04;var _0x2abefa;return db['WhatsappAccount']['findOne']({'where':{'id':_0x58aa5b[_0xee07('0x50')]['id']}})['then'](handleEntityNotFound(_0x2cb82b,null))[_0xee07('0x1c')](function(_0x3d8698){if(_0x3d8698){_0x344e04=_0x3d8698;_0xb7d9d7[_0xee07('0x3a')]=_['keys'](db[_0xee07('0x76')][_0xee07('0x37')]);_0xb7d9d7[_0xee07('0x3b')]=_[_0xee07('0x3c')](_0x58aa5b[_0xee07('0x3b')]);_0xb7d9d7[_0xee07('0x3d')]=_[_0xee07('0x3e')](_0xb7d9d7[_0xee07('0x3a')],_0xb7d9d7['query']);_0xd6612b[_0xee07('0x3f')]=_[_0xee07('0x3e')](_0xb7d9d7[_0xee07('0x3a')],qs[_0xee07('0x40')](_0x58aa5b['query'][_0xee07('0x40')]));_0xd6612b[_0xee07('0x3f')]=_0xd6612b[_0xee07('0x3f')]['length']?_0xd6612b[_0xee07('0x3f')]:_0xb7d9d7['model'];_0xd6612b[_0xee07('0x43')]=qs[_0xee07('0x44')](_0x58aa5b[_0xee07('0x3b')][_0xee07('0x44')]);_0xd6612b[_0xee07('0x45')]=qs[_0xee07('0x3d')](_[_0xee07('0x46')](_0x58aa5b[_0xee07('0x3b')],_0xb7d9d7['filters']));if(_0x58aa5b[_0xee07('0x3b')]['filter']){_0xd6612b[_0xee07('0x45')]=_[_0xee07('0x48')](_0xd6612b['where'],{'$or':_[_0xee07('0x49')](_0xd6612b[_0xee07('0x3f')],function(_0x2f2541){var _0x12887e={};_0x12887e[_0x2f2541]={'$like':'%'+_0x58aa5b[_0xee07('0x3b')][_0xee07('0x47')]+'%'};return _0x12887e;})});}_0xd6612b=_[_0xee07('0x48')]({},_0xd6612b,_0x58aa5b[_0xee07('0x4a')]);return _0x344e04[_0xee07('0x7c')](_0xd6612b);}})['then'](function(_0x33cd09){if(_0x33cd09){_0x2abefa=_0x33cd09[_0xee07('0x41')];if(!_0x58aa5b[_0xee07('0x3b')]['hasOwnProperty']('nolimit')){_0xd6612b[_0xee07('0x2b')]=qs[_0xee07('0x2b')](_0x58aa5b[_0xee07('0x3b')][_0xee07('0x2b')]);_0xd6612b[_0xee07('0x29')]=qs[_0xee07('0x29')](_0x58aa5b[_0xee07('0x3b')][_0xee07('0x29')]);}return _0x344e04['getApplications'](_0xd6612b);}})[_0xee07('0x1c')](function(_0x3ef05a){if(_0x3ef05a){return _0x3ef05a?{'count':_0x2abefa,'rows':_0x3ef05a}:null;}})[_0xee07('0x1c')](respondWithResult(_0x2cb82b,null))[_0xee07('0x25')](handleError(_0x2cb82b,null));};exports[_0xee07('0x7d')]=function(_0x125d3c,_0x44a23c,_0x4b5991){var _0x4c986f={'channel':_0xee07('0x7e')};var _0x29e818=[];var _0x43ab39=[];var _0x486da={};return db[_0xee07('0x4b')][_0xee07('0x51')]({'where':{'id':_0x125d3c[_0xee07('0x50')]['id']},'include':[{'model':db[_0xee07('0x76')],'as':'Applications'}]})[_0xee07('0x1c')](handleEntityNotFound(_0x44a23c,null))['then'](function(_0xf10a6a){_0x4c986f[_0xee07('0x7f')]=_0xf10a6a;if(_0x4c986f[_0xee07('0x7f')]&&_0x4c986f[_0xee07('0x7f')]['type']==='sinch'&&_0x125d3c[_0xee07('0x53')][_0xee07('0x80')]){if(_0x125d3c[_0xee07('0x53')][_0xee07('0x80')][_0xee07('0x41')]===0x0)return;if(_0x125d3c[_0xee07('0x53')]['statuses'][0x0][_0xee07('0x81')]!=='read')return;return db[_0xee07('0x82')][_0xee07('0x2f')]({'read':!![],'readAt':_0x125d3c[_0xee07('0x53')][_0xee07('0x80')][0x0][_0xee07('0x83')]},{'where':{'messageId':_0x125d3c[_0xee07('0x53')][_0xee07('0x80')][0x0][_0xee07('0x84')]},'individualHooks':!![]})['then'](function(_0x337fcc){return _0x44a23c[_0xee07('0x26')](0xc8)[_0xee07('0x28')](_0x337fcc);});}_0x4c986f['applications']=_[_0xee07('0x85')](_0xf10a6a[_0xee07('0x86')],[_0xee07('0x79')],[_0xee07('0x87')]);if(_0x4c986f['account']['Applications']){delete _0x4c986f['account'][_0xee07('0x86')];}return db['CmContact'][_0xee07('0x5b')]()['then'](function(_0x1c4491){if(!_0x1c4491){throw new db['Sequelize'][(_0xee07('0x88'))]('no\x20available\x20attributes');}_0x29e818=_[_0xee07('0x89')](_[_0xee07('0x3c')](_0x1c4491),['createdAt',_0xee07('0x8a')]);_0x43ab39=_[_0xee07('0x89')](_[_0xee07('0x3c')](_0x1c4491),[_0xee07('0x8b'),_0xee07('0x8a'),_0xee07('0x8c'),_0xee07('0x8d')]);_0x4c986f[_0xee07('0x53')]={'mapKey':_0xee07('0x8e')};if(_0x4c986f['account']&&_0x4c986f[_0xee07('0x7f')][_0xee07('0x38')]===_0xee07('0x8f')){_0x4c986f['body']['from']=_0x125d3c[_0xee07('0x53')][_0xee07('0x90')][_0xee07('0x91')](_0xee07('0x92'),'');_0x4c986f[_0xee07('0x53')]['body']=_0x125d3c[_0xee07('0x53')]['Body'];_0x4c986f[_0xee07('0x53')][_0xee07('0x93')]=_0x125d3c[_0xee07('0x53')][_0xee07('0x94')];}if(_0x4c986f[_0xee07('0x7f')]&&_0x4c986f['account'][_0xee07('0x38')]===_0xee07('0x95')){_0x4c986f[_0xee07('0x53')]['from']=_0x125d3c[_0xee07('0x53')]['notifications'][0x0]['from'];_0x4c986f[_0xee07('0x53')][_0xee07('0x53')]=_0x125d3c[_0xee07('0x53')]['notifications'][0x0]['message']['body'];_0x4c986f[_0xee07('0x53')]['messageId']=_0x125d3c[_0xee07('0x53')][_0xee07('0x96')][0x0][_0xee07('0x84')];}if(_0x4c986f['body']['id']){delete _0x4c986f[_0xee07('0x53')]['id'];}if(_[_0xee07('0x97')](_0x4c986f['body']['from'])){throw new db['Sequelize']['ValidationError']('from\x20is\x20mandatory');}if(_[_0xee07('0x97')](_0x4c986f['body'][_0xee07('0x53')])||_0x4c986f['body'][_0xee07('0x53')]===''){throw new db['Sequelize'][(_0xee07('0x88'))](_0xee07('0x98'));}if(_[_0xee07('0x97')](_0x4c986f[_0xee07('0x53')][_0xee07('0x99')])){throw new db['Sequelize'][(_0xee07('0x88'))](_0xee07('0x9a')+_0x43ab39);}if(!_['includes'](_0x43ab39,_0x4c986f[_0xee07('0x53')][_0xee07('0x99')])){throw new db[(_0xee07('0x9b'))]['ValidationError'](_0xee07('0x9c')+_0x43ab39);}_0x486da[_0x4c986f[_0xee07('0x53')][_0xee07('0x99')]]=_0x4c986f[_0xee07('0x53')][_0xee07('0x9d')];return db['CmList']['find']({'where':{'id':_0x4c986f[_0xee07('0x7f')][_0xee07('0x8d')]},'include':[{'model':db[_0xee07('0x9e')],'as':_0xee07('0x9f'),'where':_0x486da,'limit':0x1,'order':[['updatedAt','DESC']]}]});})[_0xee07('0x1c')](handleEntityNotFound(_0x44a23c,null))[_0xee07('0x1c')](function(_0x5a1eec){if(_0x5a1eec){_0x4c986f[_0xee07('0xa0')]=_[_0xee07('0x6a')](_0x5a1eec,[_0xee07('0x9f')]);if(_0x5a1eec[_0xee07('0x9f')][_0xee07('0x41')]){return _0x5a1eec[_0xee07('0x9f')][0x0];}var _0x112e39=_[_0xee07('0x15')](_0x4c986f[_0xee07('0x53')],{'firstName':_0x4c986f[_0xee07('0x53')]['from'],'ListId':_0x5a1eec['id']});_0x112e39[_0x4c986f[_0xee07('0x53')][_0xee07('0x99')]]=_0x4c986f[_0xee07('0x53')][_0xee07('0x9d')];return db[_0xee07('0x9e')][_0xee07('0x52')](_0x112e39,{'fields':_0x29e818,'raw':!![]});}})[_0xee07('0x1c')](handleEntityNotFound(_0x44a23c,null))[_0xee07('0x1c')](function(_0x323857){if(_0x323857){_0x4c986f[_0xee07('0xa1')]=_0x323857;var _0x4cfb76={'ContactId':_0x323857['id'],'phone':_0x4c986f[_0xee07('0x53')][_0xee07('0x9d')],'WhatsappAccountId':_0x125d3c[_0xee07('0x50')]['id']};var _0x4bbd12={'ContactId':_0x323857['id'],'WhatsappAccountId':_0x125d3c['params']['id'],'closed':![]};return db[_0xee07('0xa2')][_0xee07('0x51')]({'where':_0x4bbd12})[_0xee07('0x1c')](function(_0x4e57a7){if(_0x4e57a7){return[_0x4e57a7,![]];}return db['WhatsappInteraction'][_0xee07('0x52')](_0x4cfb76)['then'](function(_0x1e8cc0){return[_0x1e8cc0,!![]];});});}})[_0xee07('0xa3')](function(_0x1f5e9a,_0x366d88){_0x4c986f[_0xee07('0xa4')]=_0x1f5e9a[_0xee07('0x54')]({'plain':!![]});_0x4c986f[_0xee07('0xa4')][_0xee07('0xa5')]=![];if(_0x366d88){if(_0x4c986f[_0xee07('0x7f')][_0xee07('0xa6')]){_0x4c986f[_0xee07('0xa7')][_0xee07('0xa8')]({'id':0x0,'priority':_0x4c986f[_0xee07('0xa7')][_0xee07('0x41')]+0x1,'app':'close','appdata':_0xee07('0xa9'),'interval':_0xee07('0xaa')});}_0x4c986f[_0xee07('0xa4')]['created']=!![];}return db[_0xee07('0x82')]['create']({'phone':_0x4c986f[_0xee07('0x53')][_0xee07('0x9d')],'messageId':_0x4c986f[_0xee07('0x53')][_0xee07('0x93')],'body':_0x4c986f['body']['body'],'WhatsappAccountId':_0x125d3c[_0xee07('0x50')]['id'],'WhatsappInteractionId':_0x1f5e9a['id'],'direction':'in','ContactId':_0x1f5e9a[_0xee07('0xab')],'AttachmentId':_0x4c986f[_0xee07('0x53')][_0xee07('0xac')]});})[_0xee07('0x1c')](function(_0xb562e6){_0x4c986f[_0xee07('0x23')]=_0xb562e6;if(_0x4c986f[_0xee07('0xa4')]['UserId']){return db[_0xee07('0xad')]['find']({'attributes':['id','name'],'where':{'id':_0x4c986f[_0xee07('0xa4')][_0xee07('0xae')]}})[_0xee07('0x1c')](function(_0x5c38b1){if(_0x5c38b1){_0x4c986f['applications'][_0xee07('0xaf')]({'id':0x0,'priority':0x0,'app':_0xee07('0xb0'),'appdata':_0x5c38b1[_0xee07('0x34')]+','+(_0x4c986f[_0xee07('0x7f')][_0xee07('0xb1')]||0xa),'interval':_0xee07('0xaa')});}return respondWithRpcPromise(_0xee07('0xb2'),_0xee07('0xb3'),_0x4c986f);});}return respondWithRpcPromise(_0xee07('0xb2'),_0xee07('0xb3'),_0x4c986f);})[_0xee07('0x1c')](function(_0x5e1d19){if(_0x5e1d19){var _0x27133b=0xc8;var _0x3e6c11=_0xee07('0xb4');logger['info'](_0xee07('0xb5'),_0x3e6c11,_0x27133b,_0xee07('0xb6'));logger[_0xee07('0xb7')]('WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s',_0x3e6c11,_0x27133b,'entity\x20found',JSON[_0xee07('0x20')](_0x5e1d19));if(_0x4c986f[_0xee07('0x7f')][_0xee07('0x38')]===_0xee07('0x8f')){return _0x44a23c['status'](_0x27133b)[_0xee07('0x2d')](_0xee07('0xb8'),_0xee07('0xb9'))[_0xee07('0x7b')]('\x0a');}else{return _0x44a23c[_0xee07('0x26')](_0x27133b)[_0xee07('0x28')](_0x5e1d19);}}});})[_0xee07('0x25')](handleError(_0x44a23c,null));};exports['send']=function(_0x1ec4f9,_0x34a78d,_0x46c9ee){var _0x2389ce,_0x48e450,_0x157e1b;if(_[_0xee07('0x97')](_0x1ec4f9[_0xee07('0x53')]['body'])||_0x1ec4f9['body'][_0xee07('0x53')]===''){throw new db['Sequelize'][(_0xee07('0x88'))](_0xee07('0x98'));}if(_[_0xee07('0x97')](_0x1ec4f9['body']['to'])){throw new db[(_0xee07('0x9b'))][(_0xee07('0x88'))](_0xee07('0xba'));}_0x2389ce=_0x1ec4f9[_0xee07('0x53')]['to'];return db[_0xee07('0x4b')][_0xee07('0x51')]({'where':{'id':_0x1ec4f9[_0xee07('0x50')]['id']},'include':[{'model':db[_0xee07('0xbb')],'as':_0xee07('0xbc'),'include':[{'model':db[_0xee07('0x9e')],'as':_0xee07('0x9f'),'where':{'mobile':_0x2389ce},'limit':0x1,'order':[[_0xee07('0x8a'),_0xee07('0xbd')]]}]}]})[_0xee07('0x1c')](handleEntityNotFound(_0x34a78d,null))[_0xee07('0x1c')](function(_0x2c9a3f){if(_0x2c9a3f&&_0x2c9a3f[_0xee07('0xbc')]){_0x48e450=_0x2c9a3f[_0xee07('0x54')]({'plain':!![]});if(_0x48e450[_0xee07('0xbc')]&&_0x48e450[_0xee07('0xbc')][_0xee07('0x9f')][_0xee07('0x41')]){return _0x48e450['List'][_0xee07('0x9f')][0x0];}return db['CmContact'][_0xee07('0x52')](_[_0xee07('0x15')](_0x1ec4f9[_0xee07('0x53')],{'firstName':_0x2389ce,'mobile':_0x2389ce,'phone':_0x2389ce,'ListId':_0x48e450['ListId']}));}})[_0xee07('0x1c')](handleEntityNotFound(_0x34a78d,null))[_0xee07('0x1c')](function(_0x4a7896){if(_0x4a7896){_0x157e1b=_0x4a7896;return db[_0xee07('0xa2')][_0xee07('0x51')]({'where':{'ContactId':_0x157e1b['id'],'closed':![],'WhatsappAccountId':_0x48e450['id']}})[_0xee07('0x1c')](function(_0x5251bb){if(_0x5251bb){return[_0x5251bb,![]];}return db['WhatsappInteraction'][_0xee07('0x52')]({'UserId':_0x1ec4f9[_0xee07('0xbe')]['id'],'ContactId':_0x157e1b['id'],'WhatsappAccountId':_0x48e450['id'],'phone':_0x2389ce,'firstMsgDirection':_0xee07('0xbf'),'Messages':[_[_0xee07('0x48')](_0x1ec4f9[_0xee07('0x53')],{'read':![],'body':_0x1ec4f9[_0xee07('0x53')][_0xee07('0x53')],'phone':_0x2389ce,'WhatsappAccountId':_0x48e450['id'],'UserId':_0x1ec4f9[_0xee07('0xbe')]['id'],'ContactId':_0x157e1b['id']})]},{'include':[{'model':db['WhatsappMessage'],'as':'Messages'}]})['then'](function(_0x46dcc9){return[_0x46dcc9,!![]];});});}})[_0xee07('0xa3')](function(_0x5c2b47,_0x18460b){if(_0x18460b){return _0x5c2b47;}return db['WhatsappMessage'][_0xee07('0x52')](_[_0xee07('0x48')](_0x1ec4f9[_0xee07('0x53')],{'read':![],'body':_0x1ec4f9[_0xee07('0x53')]['body'],'phone':_0x2389ce,'WhatsappAccountId':_0x48e450['id'],'WhatsappInteractionId':_0x5c2b47['id'],'UserId':_0x1ec4f9[_0xee07('0xbe')]['id'],'ContactId':_0x157e1b['id']}))[_0xee07('0x1c')](function(_0x141367){_0x5c2b47[_0xee07('0xc0')][_0xee07('0xc1')]=[];_0x5c2b47[_0xee07('0xc0')]['Messages'][_0xee07('0xa8')](_0x141367[_0xee07('0xc0')]);return _0x5c2b47;});})[_0xee07('0x1c')](respondWithResult(_0x34a78d,null))[_0xee07('0x25')](handleError(_0x34a78d,null));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.events.js b/server/api/whatsappAccount/whatsappAccount.events.js index 6f27a46..b511178 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 _0x44de=['update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','WhatsappAccount','setMaxListeners','save'];(function(_0x4abeed,_0x26b450){var _0x51275a=function(_0x59313b){while(--_0x59313b){_0x4abeed['push'](_0x4abeed['shift']());}};_0x51275a(++_0x26b450);}(_0x44de,0x166));var _0xe44d=function(_0x4b7f97,_0x344fab){_0x4b7f97=_0x4b7f97-0x0;var _0x55a091=_0x44de[_0x4b7f97];return _0x55a091;};'use strict';var EventEmitter=require(_0xe44d('0x0'));var WhatsappAccount=require(_0xe44d('0x1'))['db'][_0xe44d('0x2')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0xe44d('0x3')](0x0);var events={'afterCreate':_0xe44d('0x4'),'afterUpdate':_0xe44d('0x5'),'afterDestroy':_0xe44d('0x6')};function emitEvent(_0x4c4a91){return function(_0x2108e9,_0xd9cae1,_0x585950){WhatsappAccountEvents[_0xe44d('0x7')](_0x4c4a91+':'+_0x2108e9['id'],_0x2108e9);WhatsappAccountEvents['emit'](_0x4c4a91,_0x2108e9);_0x585950(null);};}for(var e in events){if(events[_0xe44d('0x8')](e)){var event=events[e];WhatsappAccount[_0xe44d('0x9')](e,emitEvent(event));}}module[_0xe44d('0xa')]=WhatsappAccountEvents; \ No newline at end of file +var _0x87cc=['hook','exports','../../mysqldb','WhatsappAccount','setMaxListeners','update','remove','emit','hasOwnProperty'];(function(_0x21e0e6,_0x5dfe8a){var _0x580daf=function(_0x36a21b){while(--_0x36a21b){_0x21e0e6['push'](_0x21e0e6['shift']());}};_0x580daf(++_0x5dfe8a);}(_0x87cc,0x146));var _0xc87c=function(_0x353950,_0x590b09){_0x353950=_0x353950-0x0;var _0x2f87e1=_0x87cc[_0x353950];return _0x2f87e1;};'use strict';var EventEmitter=require('events');var WhatsappAccount=require(_0xc87c('0x0'))['db'][_0xc87c('0x1')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0xc87c('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xc87c('0x3'),'afterDestroy':_0xc87c('0x4')};function emitEvent(_0x413677){return function(_0x5ed244,_0x2b0217,_0x5b7349){WhatsappAccountEvents['emit'](_0x413677+':'+_0x5ed244['id'],_0x5ed244);WhatsappAccountEvents[_0xc87c('0x5')](_0x413677,_0x5ed244);_0x5b7349(null);};}for(var e in events){if(events[_0xc87c('0x6')](e)){var event=events[e];WhatsappAccount[_0xc87c('0x7')](e,emitEvent(event));}}module[_0xc87c('0x8')]=WhatsappAccountEvents; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.model.js b/server/api/whatsappAccount/whatsappAccount.model.js index f14be8b..052e0f4 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 _0xfcf9=['request-promise','rimraf','../../config/environment','./whatsappAccount.attributes','exports','define','WhatsappAccount','whatsapp_accounts','lodash','util','../../config/logger','moment','bluebird'];(function(_0x323592,_0x2b1dba){var _0x42e062=function(_0x150cf8){while(--_0x150cf8){_0x323592['push'](_0x323592['shift']());}};_0x42e062(++_0x2b1dba);}(_0xfcf9,0xf2));var _0x9fcf=function(_0x187d2a,_0x5762e3){_0x187d2a=_0x187d2a-0x0;var _0x5e92e6=_0xfcf9[_0x187d2a];return _0x5e92e6;};'use strict';var _=require(_0x9fcf('0x0'));var util=require(_0x9fcf('0x1'));var logger=require(_0x9fcf('0x2'))('api');var moment=require(_0x9fcf('0x3'));var BPromise=require(_0x9fcf('0x4'));var rp=require(_0x9fcf('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9fcf('0x6'));var config=require(_0x9fcf('0x7'));var attributes=require(_0x9fcf('0x8'));module[_0x9fcf('0x9')]=function(_0x31e811,_0x5550ec){return _0x31e811[_0x9fcf('0xa')](_0x9fcf('0xb'),attributes,{'tableName':_0x9fcf('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe9a7=['../../config/environment','./whatsappAccount.attributes','exports','define','WhatsappAccount','whatsapp_accounts','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf'];(function(_0x1b2ea2,_0x19c7a1){var _0x40f25c=function(_0x2d74cd){while(--_0x2d74cd){_0x1b2ea2['push'](_0x1b2ea2['shift']());}};_0x40f25c(++_0x19c7a1);}(_0xe9a7,0xca));var _0x7e9a=function(_0x1558ab,_0x39d1de){_0x1558ab=_0x1558ab-0x0;var _0x53b64a=_0xe9a7[_0x1558ab];return _0x53b64a;};'use strict';var _=require(_0x7e9a('0x0'));var util=require(_0x7e9a('0x1'));var logger=require(_0x7e9a('0x2'))(_0x7e9a('0x3'));var moment=require(_0x7e9a('0x4'));var BPromise=require(_0x7e9a('0x5'));var rp=require(_0x7e9a('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7e9a('0x7'));var config=require(_0x7e9a('0x8'));var attributes=require(_0x7e9a('0x9'));module[_0x7e9a('0xa')]=function(_0x362648,_0x418023){return _0x362648[_0x7e9a('0xb')](_0x7e9a('0xc'),attributes,{'tableName':_0x7e9a('0xd'),'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 82759bc..3cad162 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 _0x7e83=['jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./whatsappAccount.socket','request','info','request\x20sent','stringify','error','code','WhatsappAccount,\x20%s,\x20%s','message','catch','ShowWhatsappAccount','options','raw','where','attributes','include','map','model','debug','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x7e83,0x7c));var _0x37e8=function(_0x5afeab,_0x536dcd){_0x5afeab=_0x5afeab-0x0;var _0x419cd3=_0x7e83[_0x5afeab];return _0x419cd3;};'use strict';var _=require(_0x37e8('0x0'));var util=require(_0x37e8('0x1'));var moment=require(_0x37e8('0x2'));var BPromise=require(_0x37e8('0x3'));var rs=require(_0x37e8('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x37e8('0x5'));var logger=require(_0x37e8('0x6'))(_0x37e8('0x7'));var config=require('../../config/environment');var jayson=require(_0x37e8('0x8'));var client=jayson[_0x37e8('0x9')]['http']({'port':0x232a});config[_0x37e8('0xa')]=_[_0x37e8('0xb')](config['redis'],{'host':_0x37e8('0xc'),'port':0x18eb});var socket=require(_0x37e8('0xd'))(new Redis(config[_0x37e8('0xa')]));require(_0x37e8('0xe'))['register'](socket);function respondWithRpcPromise(_0x789f38,_0x5659a6,_0x2f8ecc){return new BPromise(function(_0x429757,_0xb76d65){return client[_0x37e8('0xf')](_0x789f38,_0x2f8ecc)['then'](function(_0xe5d14b){logger[_0x37e8('0x10')]('WhatsappAccount,\x20%s,\x20%s',_0x5659a6,_0x37e8('0x11'));logger['debug']('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x5659a6,_0x37e8('0x11'),JSON[_0x37e8('0x12')](_0xe5d14b));if(_0xe5d14b[_0x37e8('0x13')]){if(_0xe5d14b[_0x37e8('0x13')][_0x37e8('0x14')]===0x1f4){logger['error'](_0x37e8('0x15'),_0x5659a6,_0xe5d14b[_0x37e8('0x13')]['message']);return _0xb76d65(_0xe5d14b['error'][_0x37e8('0x16')]);}logger[_0x37e8('0x13')](_0x37e8('0x15'),_0x5659a6,_0xe5d14b[_0x37e8('0x13')][_0x37e8('0x16')]);return _0x429757(_0xe5d14b[_0x37e8('0x13')][_0x37e8('0x16')]);}else{logger[_0x37e8('0x10')](_0x37e8('0x15'),_0x5659a6,'request\x20sent');_0x429757(_0xe5d14b['result'][_0x37e8('0x16')]);}})[_0x37e8('0x17')](function(_0x283020){logger[_0x37e8('0x13')](_0x37e8('0x15'),_0x5659a6,_0x283020);_0xb76d65(_0x283020);});});}exports[_0x37e8('0x18')]=function(_0x2a42ac){var _0x1684b8=this;return new Promise(function(_0x37c624,_0x1f6918){return db['WhatsappAccount']['find']({'raw':_0x2a42ac[_0x37e8('0x19')]?_0x2a42ac[_0x37e8('0x19')][_0x37e8('0x1a')]===undefined?!![]:![]:!![],'where':_0x2a42ac[_0x37e8('0x19')]?_0x2a42ac[_0x37e8('0x19')][_0x37e8('0x1b')]||null:null,'attributes':_0x2a42ac['options']?_0x2a42ac[_0x37e8('0x19')][_0x37e8('0x1c')]||null:null,'include':_0x2a42ac[_0x37e8('0x19')]?_0x2a42ac[_0x37e8('0x19')][_0x37e8('0x1d')]?_[_0x37e8('0x1e')](_0x2a42ac[_0x37e8('0x19')][_0x37e8('0x1d')],function(_0x5271cf){return{'model':db[_0x5271cf[_0x37e8('0x1f')]],'as':_0x5271cf['as'],'attributes':_0x5271cf[_0x37e8('0x1c')],'include':_0x5271cf[_0x37e8('0x1d')]?_[_0x37e8('0x1e')](_0x5271cf['include'],function(_0x41aa97){return{'model':db[_0x41aa97['model']],'as':_0x41aa97['as'],'attributes':_0x41aa97[_0x37e8('0x1c')],'include':_0x41aa97[_0x37e8('0x1d')]?_[_0x37e8('0x1e')](_0x41aa97[_0x37e8('0x1d')],function(_0x416cac){return{'model':db[_0x416cac[_0x37e8('0x1f')]],'as':_0x416cac['as'],'attributes':_0x416cac['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x151e6d){logger[_0x37e8('0x10')](_0x37e8('0x18'),_0x2a42ac);logger[_0x37e8('0x20')](_0x37e8('0x18'),_0x2a42ac,JSON['stringify'](_0x151e6d));_0x37c624(_0x151e6d);})[_0x37e8('0x17')](function(_0xc4046c){logger[_0x37e8('0x13')]('ShowWhatsappAccount',_0xc4046c[_0x37e8('0x16')],_0x2a42ac);_0x1f6918(_0x1684b8['error'](0x1f4,_0xc4046c[_0x37e8('0x16')]));});});}; \ No newline at end of file +var _0xdc7b=['include','map','model','then','debug','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','./whatsappAccount.socket','register','info','request\x20sent','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','WhatsappAccount,\x20%s,\x20%s','message','result','ShowWhatsappAccount','options','raw','where','attributes'];(function(_0x284bc3,_0x22dffe){var _0x41ac81=function(_0x47031f){while(--_0x47031f){_0x284bc3['push'](_0x284bc3['shift']());}};_0x41ac81(++_0x22dffe);}(_0xdc7b,0x153));var _0xbdc7=function(_0x326c2a,_0x12ed32){_0x326c2a=_0x326c2a-0x0;var _0x386496=_0xdc7b[_0x326c2a];return _0x386496;};'use strict';var _=require(_0xbdc7('0x0'));var util=require(_0xbdc7('0x1'));var moment=require(_0xbdc7('0x2'));var BPromise=require(_0xbdc7('0x3'));var rs=require(_0xbdc7('0x4'));var fs=require('fs');var Redis=require(_0xbdc7('0x5'));var db=require(_0xbdc7('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xbdc7('0x7'))(_0xbdc7('0x8'));var config=require(_0xbdc7('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xbdc7('0xa')][_0xbdc7('0xb')]({'port':0x232a});config[_0xbdc7('0xc')]=_[_0xbdc7('0xd')](config[_0xbdc7('0xc')],{'host':_0xbdc7('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xbdc7('0xc')]));require(_0xbdc7('0xf'))[_0xbdc7('0x10')](socket);function respondWithRpcPromise(_0x35d4e2,_0x42db4b,_0x3074bf){return new BPromise(function(_0x54a9f3,_0x466d56){return client['request'](_0x35d4e2,_0x3074bf)['then'](function(_0x2e6b23){logger[_0xbdc7('0x11')]('WhatsappAccount,\x20%s,\x20%s',_0x42db4b,_0xbdc7('0x12'));logger['debug'](_0xbdc7('0x13'),_0x42db4b,_0xbdc7('0x12'),JSON[_0xbdc7('0x14')](_0x2e6b23));if(_0x2e6b23[_0xbdc7('0x15')]){if(_0x2e6b23[_0xbdc7('0x15')][_0xbdc7('0x16')]===0x1f4){logger['error'](_0xbdc7('0x17'),_0x42db4b,_0x2e6b23[_0xbdc7('0x15')][_0xbdc7('0x18')]);return _0x466d56(_0x2e6b23[_0xbdc7('0x15')][_0xbdc7('0x18')]);}logger[_0xbdc7('0x15')](_0xbdc7('0x17'),_0x42db4b,_0x2e6b23['error'][_0xbdc7('0x18')]);return _0x54a9f3(_0x2e6b23[_0xbdc7('0x15')][_0xbdc7('0x18')]);}else{logger['info'](_0xbdc7('0x17'),_0x42db4b,'request\x20sent');_0x54a9f3(_0x2e6b23[_0xbdc7('0x19')]['message']);}})['catch'](function(_0x226346){logger[_0xbdc7('0x15')](_0xbdc7('0x17'),_0x42db4b,_0x226346);_0x466d56(_0x226346);});});}exports[_0xbdc7('0x1a')]=function(_0x163c6e){var _0x57883d=this;return new Promise(function(_0x55f825,_0x56b9cc){return db['WhatsappAccount']['find']({'raw':_0x163c6e[_0xbdc7('0x1b')]?_0x163c6e[_0xbdc7('0x1b')][_0xbdc7('0x1c')]===undefined?!![]:![]:!![],'where':_0x163c6e['options']?_0x163c6e['options'][_0xbdc7('0x1d')]||null:null,'attributes':_0x163c6e['options']?_0x163c6e[_0xbdc7('0x1b')][_0xbdc7('0x1e')]||null:null,'include':_0x163c6e[_0xbdc7('0x1b')]?_0x163c6e[_0xbdc7('0x1b')][_0xbdc7('0x1f')]?_[_0xbdc7('0x20')](_0x163c6e[_0xbdc7('0x1b')]['include'],function(_0x57fda6){return{'model':db[_0x57fda6[_0xbdc7('0x21')]],'as':_0x57fda6['as'],'attributes':_0x57fda6[_0xbdc7('0x1e')],'include':_0x57fda6[_0xbdc7('0x1f')]?_[_0xbdc7('0x20')](_0x57fda6[_0xbdc7('0x1f')],function(_0x19d3cf){return{'model':db[_0x19d3cf[_0xbdc7('0x21')]],'as':_0x19d3cf['as'],'attributes':_0x19d3cf['attributes'],'include':_0x19d3cf[_0xbdc7('0x1f')]?_[_0xbdc7('0x20')](_0x19d3cf['include'],function(_0x3326e9){return{'model':db[_0x3326e9[_0xbdc7('0x21')]],'as':_0x3326e9['as'],'attributes':_0x3326e9[_0xbdc7('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xbdc7('0x22')](function(_0xad09d8){logger[_0xbdc7('0x11')](_0xbdc7('0x1a'),_0x163c6e);logger[_0xbdc7('0x23')](_0xbdc7('0x1a'),_0x163c6e,JSON[_0xbdc7('0x14')](_0xad09d8));_0x55f825(_0xad09d8);})[_0xbdc7('0x24')](function(_0x2ff8e3){logger[_0xbdc7('0x15')]('ShowWhatsappAccount',_0x2ff8e3['message'],_0x163c6e);_0x56b9cc(_0x57883d[_0xbdc7('0x15')](0x1f4,_0x2ff8e3[_0xbdc7('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.socket.js b/server/api/whatsappAccount/whatsappAccount.socket.js index f9fdfa6..94514db 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 _0x5a4b=['update','emit','removeListener','register','length','whatsappAccount:','./whatsappAccount.events','save','remove'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x5a4b,0x1bf));var _0xb5a4=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x5a4b[_0x57b54c];return _0x59cc19;};'use strict';var WhatsappAccountEvents=require(_0xb5a4('0x0'));var events=[_0xb5a4('0x1'),_0xb5a4('0x2'),_0xb5a4('0x3')];function createListener(_0x21e910,_0x5aaa6c){return function(_0x30e74b){_0x5aaa6c[_0xb5a4('0x4')](_0x21e910,_0x30e74b);};}function removeListener(_0x2a6b97,_0x440e94){return function(){WhatsappAccountEvents[_0xb5a4('0x5')](_0x2a6b97,_0x440e94);};}exports[_0xb5a4('0x6')]=function(_0x5834e1){for(var _0x3b3686=0x0,_0x367acd=events[_0xb5a4('0x7')];_0x3b3686<_0x367acd;_0x3b3686++){var _0x17e6b7=events[_0x3b3686];var _0x3555e7=createListener(_0xb5a4('0x8')+_0x17e6b7,_0x5834e1);WhatsappAccountEvents['on'](_0x17e6b7,_0x3555e7);}}; \ No newline at end of file +var _0xb2f1=['remove','update','emit','removeListener','register','length','whatsappAccount:','./whatsappAccount.events','save'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xb2f1,0x115));var _0x1b2f=function(_0x2d9996,_0x9f3bc0){_0x2d9996=_0x2d9996-0x0;var _0x20da3c=_0xb2f1[_0x2d9996];return _0x20da3c;};'use strict';var WhatsappAccountEvents=require(_0x1b2f('0x0'));var events=[_0x1b2f('0x1'),_0x1b2f('0x2'),_0x1b2f('0x3')];function createListener(_0x5c2fad,_0x531b2b){return function(_0x3522ca){_0x531b2b[_0x1b2f('0x4')](_0x5c2fad,_0x3522ca);};}function removeListener(_0xa04827,_0x1864af){return function(){WhatsappAccountEvents[_0x1b2f('0x5')](_0xa04827,_0x1864af);};}exports[_0x1b2f('0x6')]=function(_0x7425f9){for(var _0x37f00c=0x0,_0x68ce39=events[_0x1b2f('0x7')];_0x37f00c<_0x68ce39;_0x37f00c++){var _0x2dfe14=events[_0x37f00c];var _0x45680d=createListener(_0x1b2f('0x8')+_0x2dfe14,_0x7425f9);WhatsappAccountEvents['on'](_0x2dfe14,_0x45680d);}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/index.js b/server/api/whatsappApplication/index.js index f9f8a68..3ccb3c2 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 _0x33c1=['./whatsappApplication.controller','get','/:id','isAuthenticated','show','post','create','put','update','delete','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment'];(function(_0x21e80a,_0x2e98ff){var _0x1f55de=function(_0x16820c){while(--_0x16820c){_0x21e80a['push'](_0x21e80a['shift']());}};_0x1f55de(++_0x2e98ff);}(_0x33c1,0x81));var _0x133c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x33c1[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require(_0x133c('0x0'));var path=require(_0x133c('0x1'));var timeout=require(_0x133c('0x2'));var express=require(_0x133c('0x3'));var router=express[_0x133c('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x133c('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x133c('0x6'));var controller=require(_0x133c('0x7'));router[_0x133c('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x133c('0x8')](_0x133c('0x9'),auth[_0x133c('0xa')](),controller[_0x133c('0xb')]);router[_0x133c('0xc')]('/',auth[_0x133c('0xa')](),controller[_0x133c('0xd')]);router[_0x133c('0xe')](_0x133c('0x9'),auth[_0x133c('0xa')](),controller[_0x133c('0xf')]);router[_0x133c('0x10')](_0x133c('0x9'),auth[_0x133c('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x013c=['isAuthenticated','index','/:id','show','post','create','put','delete','destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./whatsappApplication.controller','get'];(function(_0x53092d,_0x33f1ca){var _0xfb4bf=function(_0xfccc83){while(--_0xfccc83){_0x53092d['push'](_0x53092d['shift']());}};_0xfb4bf(++_0x33f1ca);}(_0x013c,0x160));var _0xc013=function(_0x41e8c4,_0x30d9ff){_0x41e8c4=_0x41e8c4-0x0;var _0x54ffbe=_0x013c[_0x41e8c4];return _0x54ffbe;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xc013('0x0'));var timeout=require(_0xc013('0x1'));var express=require(_0xc013('0x2'));var router=express[_0xc013('0x3')]();var fs_extra=require(_0xc013('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xc013('0x5'));var config=require(_0xc013('0x6'));var controller=require(_0xc013('0x7'));router[_0xc013('0x8')]('/',auth[_0xc013('0x9')](),controller[_0xc013('0xa')]);router[_0xc013('0x8')](_0xc013('0xb'),auth[_0xc013('0x9')](),controller[_0xc013('0xc')]);router[_0xc013('0xd')]('/',auth[_0xc013('0x9')](),controller[_0xc013('0xe')]);router[_0xc013('0xf')](_0xc013('0xb'),auth[_0xc013('0x9')](),controller['update']);router[_0xc013('0x10')](_0xc013('0xb'),auth[_0xc013('0x9')](),controller[_0xc013('0x11')]);module[_0xc013('0x12')]=router; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.attributes.js b/server/api/whatsappApplication/whatsappApplication.attributes.js index b3a3c8c..1a76936 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 _0x6032=['exports','INTEGER','noop','TEXT','STRING','*,*,*,*'];(function(_0x30f87a,_0x2cce5a){var _0x3a8efc=function(_0x225d6b){while(--_0x225d6b){_0x30f87a['push'](_0x30f87a['shift']());}};_0x3a8efc(++_0x2cce5a);}(_0x6032,0x16e));var _0x2603=function(_0x16f75a,_0x46350c){_0x16f75a=_0x16f75a-0x0;var _0x10edce=_0x6032[_0x16f75a];return _0x10edce;};'use strict';var Sequelize=require('sequelize');module[_0x2603('0x0')]={'priority':{'type':Sequelize[_0x2603('0x1')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x2603('0x2')},'appdata':{'type':Sequelize[_0x2603('0x3')]()},'description':{'type':Sequelize[_0x2603('0x4')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0x2603('0x5')}}; \ No newline at end of file +var _0x6699=['INTEGER','STRING','noop','TEXT','*,*,*,*','sequelize','exports'];(function(_0x897bb5,_0x4a8ce9){var _0x1b3382=function(_0x2248dd){while(--_0x2248dd){_0x897bb5['push'](_0x897bb5['shift']());}};_0x1b3382(++_0x4a8ce9);}(_0x6699,0x15c));var _0x9669=function(_0x5cef7b,_0x170c97){_0x5cef7b=_0x5cef7b-0x0;var _0x8c58f3=_0x6699[_0x5cef7b];return _0x8c58f3;};'use strict';var Sequelize=require(_0x9669('0x0'));module[_0x9669('0x1')]={'priority':{'type':Sequelize[_0x9669('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x9669('0x3')],'allowNull':![],'defaultValue':_0x9669('0x4')},'appdata':{'type':Sequelize[_0x9669('0x5')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x9669('0x3')],'defaultValue':_0x9669('0x6')}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.controller.js b/server/api/whatsappApplication/whatsappApplication.controller.js index b810ebe..33b02f5 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 _0xe3da=['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','WhatsappApplication','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','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'];(function(_0x2d6491,_0x6d0e03){var _0x17bb8f=function(_0x381ae6){while(--_0x381ae6){_0x2d6491['push'](_0x2d6491['shift']());}};_0x17bb8f(++_0x6d0e03);}(_0xe3da,0x1cd));var _0xae3d=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xe3da[_0x2641f9];return _0x585741;};'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));}; \ No newline at end of file +var _0x5324=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','update','then','sendStatus','error','stack','name','send','map','WhatsappApplication','rawAttributes','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','sort','where','filters','pick','filter','type','merge','findAll','rows','catch','includeAll','find','create','body','destroy','params','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service'];(function(_0x4f6af5,_0x3ae5e5){var _0xe43436=function(_0x307878){while(--_0x307878){_0x4f6af5['push'](_0x4f6af5['shift']());}};_0xe43436(++_0x3ae5e5);}(_0x5324,0x154));var _0x4532=function(_0x221369,_0x77d2b2){_0x221369=_0x221369-0x0;var _0x5e21de=_0x5324[_0x221369];return _0x5e21de;};'use strict';var emlformat=require(_0x4532('0x0'));var rimraf=require(_0x4532('0x1'));var zipdir=require(_0x4532('0x2'));var jsonpatch=require(_0x4532('0x3'));var rp=require('request-promise');var moment=require(_0x4532('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x4532('0x5'));var util=require(_0x4532('0x6'));var path=require(_0x4532('0x7'));var sox=require(_0x4532('0x8'));var csv=require(_0x4532('0x9'));var ejs=require(_0x4532('0xa'));var fs=require('fs');var fs_extra=require(_0x4532('0xb'));var _=require(_0x4532('0xc'));var squel=require('squel');var crypto=require(_0x4532('0xd'));var jsforce=require(_0x4532('0xe'));var deskjs=require(_0x4532('0xf'));var toCsv=require(_0x4532('0x9'));var querystring=require(_0x4532('0x10'));var Papa=require(_0x4532('0x11'));var Redis=require(_0x4532('0x12'));var authService=require(_0x4532('0x13'));var qs=require(_0x4532('0x14'));var as=require(_0x4532('0x15'));var hardwareService=require(_0x4532('0x16'));var logger=require(_0x4532('0x17'))('api');var utils=require('../../config/utils');var config=require(_0x4532('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x4532('0x19'))['db'];function respondWithStatusCode(_0x2b0540,_0x26b91f){_0x26b91f=_0x26b91f||0xcc;return function(_0x3faaeb){if(_0x3faaeb){return _0x2b0540['sendStatus'](_0x26b91f);}return _0x2b0540[_0x4532('0x1a')](_0x26b91f)[_0x4532('0x1b')]();};}function respondWithResult(_0x39acf3,_0x2e0b21){_0x2e0b21=_0x2e0b21||0xc8;return function(_0x19eaf3){if(_0x19eaf3){return _0x39acf3['status'](_0x2e0b21)['json'](_0x19eaf3);}};}function respondWithFilteredResult(_0x52166a,_0x38cd2a){return function(_0x19ea01){if(_0x19ea01){var _0x2dedca=typeof _0x38cd2a[_0x4532('0x1c')]===_0x4532('0x1d')&&typeof _0x38cd2a[_0x4532('0x1e')]===_0x4532('0x1d');var _0x4036b6=_0x19ea01[_0x4532('0x1f')];var _0x4db2a1=_0x2dedca?0x0:_0x38cd2a[_0x4532('0x1c')];var _0x469c5a=_0x2dedca?_0x19ea01[_0x4532('0x1f')]:_0x38cd2a['offset']+_0x38cd2a[_0x4532('0x1e')];var _0x3734e3;if(_0x469c5a>=_0x4036b6){_0x469c5a=_0x4036b6;_0x3734e3=0xc8;}else{_0x3734e3=0xce;}_0x52166a['status'](_0x3734e3);return _0x52166a[_0x4532('0x20')](_0x4532('0x21'),_0x4db2a1+'-'+_0x469c5a+'/'+_0x4036b6)[_0x4532('0x22')](_0x19ea01);}return null;};}function patchUpdates(_0x41a7f7){return function(_0x3f677b){try{jsonpatch[_0x4532('0x23')](_0x3f677b,_0x41a7f7,!![]);}catch(_0x6a669f){return BPromise[_0x4532('0x24')](_0x6a669f);}return _0x3f677b['save']();};}function saveUpdates(_0x94b670,_0x46dc73){return function(_0x481c26){if(_0x481c26){return _0x481c26[_0x4532('0x25')](_0x94b670)[_0x4532('0x26')](function(_0x472d0d){return _0x472d0d;});}return null;};}function removeEntity(_0xed85b1,_0x4fd4bd){return function(_0xbf825a){if(_0xbf825a){return _0xbf825a['destroy']()[_0x4532('0x26')](function(){_0xed85b1[_0x4532('0x1a')](0xcc)[_0x4532('0x1b')]();});}};}function handleEntityNotFound(_0x12ee78,_0x40e42f){return function(_0x278b04){if(!_0x278b04){_0x12ee78[_0x4532('0x27')](0x194);}return _0x278b04;};}function handleError(_0x309865,_0x4a386a){_0x4a386a=_0x4a386a||0x1f4;return function(_0x4b804b){logger[_0x4532('0x28')](_0x4b804b[_0x4532('0x29')]);if(_0x4b804b[_0x4532('0x2a')]){delete _0x4b804b[_0x4532('0x2a')];}_0x309865[_0x4532('0x1a')](_0x4a386a)[_0x4532('0x2b')](_0x4b804b);};}exports['index']=function(_0x3de0ee,_0x239e85){var _0x11d163={},_0x16836c={},_0xd6feb9={'count':0x0,'rows':[]};var _0x485a3f=_[_0x4532('0x2c')](db[_0x4532('0x2d')][_0x4532('0x2e')],function(_0x523f96){return{'name':_0x523f96['fieldName'],'type':_0x523f96['type'][_0x4532('0x2f')]};});_0x16836c[_0x4532('0x30')]=_[_0x4532('0x2c')](_0x485a3f,_0x4532('0x2a'));_0x16836c[_0x4532('0x31')]=_[_0x4532('0x32')](_0x3de0ee[_0x4532('0x31')]);_0x16836c['filters']=_['intersection'](_0x16836c[_0x4532('0x30')],_0x16836c[_0x4532('0x31')]);_0x11d163['attributes']=_[_0x4532('0x33')](_0x16836c[_0x4532('0x30')],qs[_0x4532('0x34')](_0x3de0ee[_0x4532('0x31')][_0x4532('0x34')]));_0x11d163[_0x4532('0x35')]=_0x11d163[_0x4532('0x35')][_0x4532('0x36')]?_0x11d163['attributes']:_0x16836c['model'];if(!_0x3de0ee[_0x4532('0x31')][_0x4532('0x37')]('nolimit')){_0x11d163[_0x4532('0x1e')]=qs[_0x4532('0x1e')](_0x3de0ee[_0x4532('0x31')][_0x4532('0x1e')]);_0x11d163['offset']=qs[_0x4532('0x1c')](_0x3de0ee['query'][_0x4532('0x1c')]);}_0x11d163['order']=qs[_0x4532('0x38')](_0x3de0ee[_0x4532('0x31')][_0x4532('0x38')]);_0x11d163[_0x4532('0x39')]=qs[_0x4532('0x3a')](_[_0x4532('0x3b')](_0x3de0ee[_0x4532('0x31')],_0x16836c[_0x4532('0x3a')]),_0x485a3f);if(_0x3de0ee[_0x4532('0x31')][_0x4532('0x3c')]){_0x11d163[_0x4532('0x39')]=_['merge'](_0x11d163[_0x4532('0x39')],{'$or':_['map'](_0x485a3f,function(_0x493fc4){if(_0x493fc4[_0x4532('0x3d')]!=='VIRTUAL'){var _0x421033={};_0x421033[_0x493fc4[_0x4532('0x2a')]]={'$like':'%'+_0x3de0ee[_0x4532('0x31')][_0x4532('0x3c')]+'%'};return _0x421033;}})});}_0x11d163=_[_0x4532('0x3e')]({},_0x11d163,_0x3de0ee['options']);var _0x51e813={'where':_0x11d163[_0x4532('0x39')]};return db[_0x4532('0x2d')]['count'](_0x51e813)[_0x4532('0x26')](function(_0x4c50ee){_0xd6feb9[_0x4532('0x1f')]=_0x4c50ee;if(_0x3de0ee[_0x4532('0x31')]['includeAll']){_0x11d163['include']=[{'all':!![]}];}return db[_0x4532('0x2d')][_0x4532('0x3f')](_0x11d163);})[_0x4532('0x26')](function(_0x56f3d6){_0xd6feb9[_0x4532('0x40')]=_0x56f3d6;return _0xd6feb9;})[_0x4532('0x26')](respondWithFilteredResult(_0x239e85,_0x11d163))[_0x4532('0x41')](handleError(_0x239e85,null));};exports['show']=function(_0x5cca1a,_0x3d8398){var _0x5c401a={'raw':!![],'where':{'id':_0x5cca1a['params']['id']}},_0x2b39c8={};_0x2b39c8[_0x4532('0x30')]=_[_0x4532('0x32')](db[_0x4532('0x2d')][_0x4532('0x2e')]);_0x2b39c8['query']=_['keys'](_0x5cca1a[_0x4532('0x31')]);_0x2b39c8[_0x4532('0x3a')]=_[_0x4532('0x33')](_0x2b39c8[_0x4532('0x30')],_0x2b39c8['query']);_0x5c401a[_0x4532('0x35')]=_[_0x4532('0x33')](_0x2b39c8[_0x4532('0x30')],qs[_0x4532('0x34')](_0x5cca1a[_0x4532('0x31')]['fields']));_0x5c401a[_0x4532('0x35')]=_0x5c401a[_0x4532('0x35')][_0x4532('0x36')]?_0x5c401a[_0x4532('0x35')]:_0x2b39c8[_0x4532('0x30')];if(_0x5cca1a[_0x4532('0x31')][_0x4532('0x42')]){_0x5c401a['include']=[{'all':!![]}];}_0x5c401a=_[_0x4532('0x3e')]({},_0x5c401a,_0x5cca1a['options']);return db['WhatsappApplication'][_0x4532('0x43')](_0x5c401a)[_0x4532('0x26')](handleEntityNotFound(_0x3d8398,null))['then'](respondWithResult(_0x3d8398,null))['catch'](handleError(_0x3d8398,null));};exports[_0x4532('0x44')]=function(_0x4dfc6f,_0x1447d4){return db[_0x4532('0x2d')][_0x4532('0x44')](_0x4dfc6f[_0x4532('0x45')],{})[_0x4532('0x26')](respondWithResult(_0x1447d4,0xc9))['catch'](handleError(_0x1447d4,null));};exports[_0x4532('0x25')]=function(_0x388583,_0x31501d){if(_0x388583['body']['id']){delete _0x388583[_0x4532('0x45')]['id'];}return db['WhatsappApplication'][_0x4532('0x43')]({'where':{'id':_0x388583['params']['id']}})[_0x4532('0x26')](handleEntityNotFound(_0x31501d,null))[_0x4532('0x26')](saveUpdates(_0x388583[_0x4532('0x45')],null))[_0x4532('0x26')](respondWithResult(_0x31501d,null))[_0x4532('0x41')](handleError(_0x31501d,null));};exports[_0x4532('0x46')]=function(_0x237000,_0x4ac4d4){return db[_0x4532('0x2d')][_0x4532('0x43')]({'where':{'id':_0x237000[_0x4532('0x47')]['id']}})[_0x4532('0x26')](handleEntityNotFound(_0x4ac4d4,null))[_0x4532('0x26')](removeEntity(_0x4ac4d4,null))[_0x4532('0x41')](handleError(_0x4ac4d4,null));}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.model.js b/server/api/whatsappApplication/whatsappApplication.model.js index 7bab43b..69419f9 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 _0xa8eb=['bluebird','request-promise','rimraf','../../config/environment','exports','WhatsappApplication','whatsapp_applications','lodash','../../config/logger','moment'];(function(_0x43fdf8,_0x8426b3){var _0x1160c6=function(_0x281fb6){while(--_0x281fb6){_0x43fdf8['push'](_0x43fdf8['shift']());}};_0x1160c6(++_0x8426b3);}(_0xa8eb,0x179));var _0xba8e=function(_0x9add99,_0x3eda3b){_0x9add99=_0x9add99-0x0;var _0x482653=_0xa8eb[_0x9add99];return _0x482653;};'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 +var _0xeb5d=['../../config/logger','api','moment','path','rimraf','./whatsappApplication.attributes','exports','define','WhatsappApplication','whatsapp_applications','utf8mb4','utf8mb4_unicode_ci','util'];(function(_0x56f2bd,_0x4539b9){var _0x1a3de4=function(_0x2e2629){while(--_0x2e2629){_0x56f2bd['push'](_0x56f2bd['shift']());}};_0x1a3de4(++_0x4539b9);}(_0xeb5d,0x16b));var _0xdeb5=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0xeb5d[_0x2c91e9];return _0x13f0ff;};'use strict';var _=require('lodash');var util=require(_0xdeb5('0x0'));var logger=require(_0xdeb5('0x1'))(_0xdeb5('0x2'));var moment=require(_0xdeb5('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xdeb5('0x4'));var rimraf=require(_0xdeb5('0x5'));var config=require('../../config/environment');var attributes=require(_0xdeb5('0x6'));module[_0xdeb5('0x7')]=function(_0x164ecb,_0x33af72){return _0x164ecb[_0xdeb5('0x8')](_0xdeb5('0x9'),attributes,{'tableName':_0xdeb5('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xdeb5('0xb'),'collate':_0xdeb5('0xc')});}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.rpc.js b/server/api/whatsappApplication/whatsappApplication.rpc.js index 7552889..28e08f4 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 _0x032e=['code','message','result','catch','lodash','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','WhatsappApplication,\x20%s,\x20%s','debug','WhatsappApplication,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x47164f,_0x21161e){var _0x3213f1=function(_0x52b062){while(--_0x52b062){_0x47164f['push'](_0x47164f['shift']());}};_0x3213f1(++_0x21161e);}(_0x032e,0x124));var _0xe032=function(_0x4baae2,_0x487ab6){_0x4baae2=_0x4baae2-0x0;var _0x1a2285=_0x032e[_0x4baae2];return _0x1a2285;};'use strict';var _=require(_0xe032('0x0'));var util=require('util');var moment=require(_0xe032('0x1'));var BPromise=require(_0xe032('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe032('0x3'))['db'];var utils=require(_0xe032('0x4'));var logger=require(_0xe032('0x5'))(_0xe032('0x6'));var config=require(_0xe032('0x7'));var jayson=require(_0xe032('0x8'));var client=jayson[_0xe032('0x9')][_0xe032('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x37432f,_0x1576c8,_0x3289b0){return new BPromise(function(_0xd84027,_0xaf3907){return client[_0xe032('0xb')](_0x37432f,_0x3289b0)[_0xe032('0xc')](function(_0x2d8a14){logger[_0xe032('0xd')](_0xe032('0xe'),_0x1576c8,'request\x20sent');logger[_0xe032('0xf')](_0xe032('0x10'),_0x1576c8,_0xe032('0x11'),JSON[_0xe032('0x12')](_0x2d8a14));if(_0x2d8a14[_0xe032('0x13')]){if(_0x2d8a14[_0xe032('0x13')][_0xe032('0x14')]===0x1f4){logger['error'](_0xe032('0xe'),_0x1576c8,_0x2d8a14[_0xe032('0x13')][_0xe032('0x15')]);return _0xaf3907(_0x2d8a14[_0xe032('0x13')]['message']);}logger[_0xe032('0x13')](_0xe032('0xe'),_0x1576c8,_0x2d8a14[_0xe032('0x13')][_0xe032('0x15')]);return _0xd84027(_0x2d8a14[_0xe032('0x13')][_0xe032('0x15')]);}else{logger[_0xe032('0xd')]('WhatsappApplication,\x20%s,\x20%s',_0x1576c8,_0xe032('0x11'));_0xd84027(_0x2d8a14[_0xe032('0x16')][_0xe032('0x15')]);}})[_0xe032('0x17')](function(_0x1938c4){logger[_0xe032('0x13')]('WhatsappApplication,\x20%s,\x20%s',_0x1576c8,_0x1938c4);_0xaf3907(_0x1938c4);});});} \ No newline at end of file +var _0x81bd=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request','then','info','WhatsappApplication,\x20%s,\x20%s','request\x20sent','debug','WhatsappApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash'];(function(_0x138293,_0x197e7f){var _0x34c4a2=function(_0x20192b){while(--_0x20192b){_0x138293['push'](_0x138293['shift']());}};_0x34c4a2(++_0x197e7f);}(_0x81bd,0x7c));var _0xd81b=function(_0x46e82f,_0x8ff37e){_0x46e82f=_0x46e82f-0x0;var _0x14323c=_0x81bd[_0x46e82f];return _0x14323c;};'use strict';var _=require(_0xd81b('0x0'));var util=require(_0xd81b('0x1'));var moment=require(_0xd81b('0x2'));var BPromise=require(_0xd81b('0x3'));var rs=require(_0xd81b('0x4'));var fs=require('fs');var Redis=require(_0xd81b('0x5'));var db=require(_0xd81b('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xd81b('0x7'))(_0xd81b('0x8'));var config=require(_0xd81b('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xd81b('0xa')][_0xd81b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1f3f2c,_0x562084,_0x5e14e8){return new BPromise(function(_0xa4cf97,_0x5468d5){return client[_0xd81b('0xc')](_0x1f3f2c,_0x5e14e8)[_0xd81b('0xd')](function(_0x3420a7){logger[_0xd81b('0xe')](_0xd81b('0xf'),_0x562084,_0xd81b('0x10'));logger[_0xd81b('0x11')](_0xd81b('0x12'),_0x562084,_0xd81b('0x10'),JSON[_0xd81b('0x13')](_0x3420a7));if(_0x3420a7[_0xd81b('0x14')]){if(_0x3420a7[_0xd81b('0x14')][_0xd81b('0x15')]===0x1f4){logger['error'](_0xd81b('0xf'),_0x562084,_0x3420a7['error'][_0xd81b('0x16')]);return _0x5468d5(_0x3420a7[_0xd81b('0x14')]['message']);}logger[_0xd81b('0x14')]('WhatsappApplication,\x20%s,\x20%s',_0x562084,_0x3420a7[_0xd81b('0x14')][_0xd81b('0x16')]);return _0xa4cf97(_0x3420a7[_0xd81b('0x14')][_0xd81b('0x16')]);}else{logger[_0xd81b('0xe')]('WhatsappApplication,\x20%s,\x20%s',_0x562084,_0xd81b('0x10'));_0xa4cf97(_0x3420a7[_0xd81b('0x17')]['message']);}})[_0xd81b('0x18')](function(_0x26df61){logger[_0xd81b('0x14')](_0xd81b('0xf'),_0x562084,_0x26df61);_0x5468d5(_0x26df61);});});} \ No newline at end of file diff --git a/server/api/whatsappInteraction/index.js b/server/api/whatsappInteraction/index.js index b246878..e327f1e 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 _0x1224=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/messages','getMessages','/:id/download','download','post','create','addMessage','/:id/tags','tracked','whatsapp','addTags','put','whatsappinteraction:update','delete','whatsappinteraction:destroy','destroy','removeTags','exports','multer','util','path'];(function(_0x35f4f8,_0x4f1917){var _0x124deb=function(_0x5cfcc2){while(--_0x5cfcc2){_0x35f4f8['push'](_0x35f4f8['shift']());}};_0x124deb(++_0x4f1917);}(_0x1224,0x10d));var _0x4122=function(_0x1738f8,_0xe22614){_0x1738f8=_0x1738f8-0x0;var _0x4b9080=_0x1224[_0x1738f8];return _0x4b9080;};'use strict';var multer=require(_0x4122('0x0'));var util=require(_0x4122('0x1'));var path=require(_0x4122('0x2'));var timeout=require(_0x4122('0x3'));var express=require(_0x4122('0x4'));var router=express[_0x4122('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x4122('0x6'));var interaction=require(_0x4122('0x7'));var config=require(_0x4122('0x8'));var controller=require('./whatsappInteraction.controller');router[_0x4122('0x9')]('/',auth[_0x4122('0xa')](),controller[_0x4122('0xb')]);router[_0x4122('0x9')](_0x4122('0xc'),auth[_0x4122('0xa')](),controller[_0x4122('0xd')]);router[_0x4122('0x9')](_0x4122('0xe'),auth[_0x4122('0xa')](),controller[_0x4122('0xf')]);router[_0x4122('0x9')](_0x4122('0x10'),auth[_0x4122('0xa')](),controller[_0x4122('0x11')]);router[_0x4122('0x9')](_0x4122('0x12'),auth[_0x4122('0xa')](),controller[_0x4122('0x13')]);router[_0x4122('0x14')]('/',auth[_0x4122('0xa')](),controller[_0x4122('0x15')]);router[_0x4122('0x14')](_0x4122('0x10'),auth[_0x4122('0xa')](),controller[_0x4122('0x16')]);router[_0x4122('0x14')](_0x4122('0x17'),auth[_0x4122('0xa')](),interaction[_0x4122('0x18')](_0x4122('0x19'),'whatsappinteraction:addtags'),controller[_0x4122('0x1a')]);router[_0x4122('0x1b')](_0x4122('0xe'),auth[_0x4122('0xa')](),interaction['tracked'](_0x4122('0x19'),_0x4122('0x1c')),controller['update']);router[_0x4122('0x1d')](_0x4122('0xe'),auth[_0x4122('0xa')](),interaction[_0x4122('0x18')](_0x4122('0x19'),_0x4122('0x1e')),controller[_0x4122('0x1f')]);router['delete']('/:id/tags',auth['isAuthenticated'](),controller[_0x4122('0x20')]);module[_0x4122('0x21')]=router; \ No newline at end of file +var _0x1115=['get','show','download','post','create','/:id/messages','addMessage','/:id/tags','tracked','whatsapp','whatsappinteraction:addtags','addTags','put','/:id','update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','/describe'];(function(_0x4aa2c9,_0x3c74e5){var _0x212e33=function(_0x20f06a){while(--_0x20f06a){_0x4aa2c9['push'](_0x4aa2c9['shift']());}};_0x212e33(++_0x3c74e5);}(_0x1115,0x1b6));var _0x5111=function(_0x51e045,_0x5db996){_0x51e045=_0x51e045-0x0;var _0x1610d5=_0x1115[_0x51e045];return _0x1610d5;};'use strict';var multer=require('multer');var util=require(_0x5111('0x0'));var path=require(_0x5111('0x1'));var timeout=require(_0x5111('0x2'));var express=require(_0x5111('0x3'));var router=express[_0x5111('0x4')]();var fs_extra=require(_0x5111('0x5'));var auth=require(_0x5111('0x6'));var interaction=require(_0x5111('0x7'));var config=require(_0x5111('0x8'));var controller=require('./whatsappInteraction.controller');router['get']('/',auth[_0x5111('0x9')](),controller[_0x5111('0xa')]);router['get'](_0x5111('0xb'),auth[_0x5111('0x9')](),controller['describe']);router[_0x5111('0xc')]('/:id',auth[_0x5111('0x9')](),controller[_0x5111('0xd')]);router['get']('/:id/messages',auth[_0x5111('0x9')](),controller['getMessages']);router[_0x5111('0xc')]('/:id/download',auth[_0x5111('0x9')](),controller[_0x5111('0xe')]);router[_0x5111('0xf')]('/',auth[_0x5111('0x9')](),controller[_0x5111('0x10')]);router[_0x5111('0xf')](_0x5111('0x11'),auth[_0x5111('0x9')](),controller[_0x5111('0x12')]);router[_0x5111('0xf')](_0x5111('0x13'),auth[_0x5111('0x9')](),interaction[_0x5111('0x14')](_0x5111('0x15'),_0x5111('0x16')),controller[_0x5111('0x17')]);router[_0x5111('0x18')](_0x5111('0x19'),auth['isAuthenticated'](),interaction[_0x5111('0x14')]('whatsapp','whatsappinteraction:update'),controller[_0x5111('0x1a')]);router[_0x5111('0x1b')](_0x5111('0x19'),auth['isAuthenticated'](),interaction[_0x5111('0x14')](_0x5111('0x15'),'whatsappinteraction:destroy'),controller[_0x5111('0x1c')]);router[_0x5111('0x1b')](_0x5111('0x13'),auth[_0x5111('0x9')](),controller['removeTags']);module[_0x5111('0x1d')]=router; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.attributes.js b/server/api/whatsappInteraction/whatsappInteraction.attributes.js index 64ca8f5..02bf409 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 _0xf611=['STRING','DATE','ENUM','out','moment','exports','BOOLEAN'];(function(_0x331320,_0xac3c9e){var _0x5afaf2=function(_0x3e8f12){while(--_0x3e8f12){_0x331320['push'](_0x331320['shift']());}};_0x5afaf2(++_0xac3c9e);}(_0xf611,0x7b));var _0x1f61=function(_0x52cbe0,_0x332b2e){_0x52cbe0=_0x52cbe0-0x0;var _0x4bb9da=_0xf611[_0x52cbe0];return _0x4bb9da;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x1f61('0x0'));module[_0x1f61('0x1')]={'closed':{'type':Sequelize[_0x1f61('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x1f61('0x3')]},'note':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0x1f61('0x3')]},'read1stAt':{'type':Sequelize[_0x1f61('0x4')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x1f61('0x4')]},'lastMsgDirection':{'type':Sequelize[_0x1f61('0x5')]('in',_0x1f61('0x6')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x1f61('0x2')],'defaultValue':![]}}; \ No newline at end of file +var _0x8ba0=['moment','exports','BOOLEAN','DATE','STRING','ENUM','out','sequelize'];(function(_0x465a0c,_0x19d4d5){var _0x1e202e=function(_0x27bd8a){while(--_0x27bd8a){_0x465a0c['push'](_0x465a0c['shift']());}};_0x1e202e(++_0x19d4d5);}(_0x8ba0,0x1c7));var _0x08ba=function(_0x2d80af,_0x5d16ff){_0x2d80af=_0x2d80af-0x0;var _0x441e11=_0x8ba0[_0x2d80af];return _0x441e11;};'use strict';var Sequelize=require(_0x08ba('0x0'));var moment=require(_0x08ba('0x1'));module[_0x08ba('0x2')]={'closed':{'type':Sequelize[_0x08ba('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x08ba('0x4')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x08ba('0x5')]},'note':{'type':Sequelize[_0x08ba('0x5')]},'phone':{'type':Sequelize[_0x08ba('0x5')]},'read1stAt':{'type':Sequelize[_0x08ba('0x4')]},'firstMsgDirection':{'type':Sequelize[_0x08ba('0x6')]('in',_0x08ba('0x7')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0x08ba('0x6')]('in',_0x08ba('0x7')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x08ba('0x3')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.controller.js b/server/api/whatsappInteraction/whatsappInteraction.controller.js index ad01b3c..d816c51 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 _0x6d11=['Tags','split','forEach','answered','unmanaged','total','UserId','waiting','closed','talking','WhatsappInteraction','rawAttributes','fieldName','query','keys','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','sort','pick','select','field','from','tools_tags','u.id','u.fullname','ui.WhatsappInteractionId','user_has_whatsapp_interactions','left_join','u.id\x20=\x20ui.UserId','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','users','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','search','sqlOperator','conditions','find','unreadMessages','value','having','`\x20=\x200','operator','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','ContactId','buildExpression','type','text','Tag','union','User','$substring','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','start','body','compact','WhatsappAccountId','where','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','filter','i.id\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','i.id','Sequelize','QueryTypes','SELECT','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','order','contactName','DESC','isEmpty','t.id\x20IN\x20?','resolve','i.WhatsappAccountId\x20IS\x20NOT\x20NULL','user','role','agent','getWhatsappAccounts','i.WhatsappAccountId\x20IS\x20NULL','i.WhatsappAccountId\x20IN\x20?','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.email','c.phone','Contact.phone','c.mobile','c.fax','Contact.fax','o.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.WhatsappInteractionId\x20IN\x20?','groupBy','push','all','rows','catch','show','filters','include','options','create','params','describe','addMessage','ids','getMessages','WhatsappInteractionId','format','WhatsappMessage','includeAll','findAll','addTags','setTags','omit','spread','color','emit','whatsappInteractionTags:save','removeTags','join','root','server','tmp','files','attachments','transcript-%d-%s.zip','CmContact','Contact','firstName','lastName','Attachment','Messages','direction','secret','WhatsappAccount','get','mkdirSync','Whatsapp','Account','Owner','N.A.','YYYY-MM-DD\x20HH:mm:ss','closedAt','existsSync','createReadStream','pipe','createWriteStream','out','renderFile','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','download','log','err','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../components/export/pdf','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./whatsappInteraction.socket','register','sendStatus','status','json','undefined','limit','offset','count','set','Content-Range','apply','reject','save','update','then','destroy','end','error','stack','name','send','Users','map','fullname','TagIds'];(function(_0x33f5c8,_0x5202bb){var _0x4ea43f=function(_0x16be2b){while(--_0x16be2b){_0x33f5c8['push'](_0x33f5c8['shift']());}};_0x4ea43f(++_0x5202bb);}(_0x6d11,0xbf));var _0x16d1=function(_0x5f2116,_0x55c6c4){_0x5f2116=_0x5f2116-0x0;var _0x93adff=_0x6d11[_0x5f2116];return _0x93adff;};'use strict';var emlformat=require(_0x16d1('0x0'));var rimraf=require(_0x16d1('0x1'));var zipdir=require(_0x16d1('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x16d1('0x3'));var moment=require('moment');var BPromise=require(_0x16d1('0x4'));var Mustache=require(_0x16d1('0x5'));var util=require('util');var path=require('path');var sox=require(_0x16d1('0x6'));var csv=require(_0x16d1('0x7'));var ejs=require(_0x16d1('0x8'));var fs=require('fs');var fs_extra=require(_0x16d1('0x9'));var _=require(_0x16d1('0xa'));var squel=require(_0x16d1('0xb'));var crypto=require(_0x16d1('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x16d1('0xd'));var Papa=require(_0x16d1('0xe'));var Redis=require(_0x16d1('0xf'));var authService=require(_0x16d1('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x16d1('0x11'));var pdf=require(_0x16d1('0x12'));var hardwareService=require(_0x16d1('0x13'));var logger=require(_0x16d1('0x14'))(_0x16d1('0x15'));var utils=require(_0x16d1('0x16'));var config=require(_0x16d1('0x17'));var licenseUtil=require(_0x16d1('0x18'));var db=require('../../mysqldb')['db'];config[_0x16d1('0x19')]=_[_0x16d1('0x1a')](config[_0x16d1('0x19')],{'host':_0x16d1('0x1b'),'port':0x18eb});var socket=require(_0x16d1('0x1c'))(new Redis(config['redis']));require(_0x16d1('0x1d'))[_0x16d1('0x1e')](socket);function respondWithStatusCode(_0x29dddb,_0x46fcd0){_0x46fcd0=_0x46fcd0||0xcc;return function(_0x29ebba){if(_0x29ebba){return _0x29dddb[_0x16d1('0x1f')](_0x46fcd0);}return _0x29dddb[_0x16d1('0x20')](_0x46fcd0)['end']();};}function respondWithResult(_0x169e76,_0x2b399c){_0x2b399c=_0x2b399c||0xc8;return function(_0x555b2d){if(_0x555b2d){return _0x169e76['status'](_0x2b399c)[_0x16d1('0x21')](_0x555b2d);}};}function respondWithFilteredResult(_0x47c245,_0x46a25e){return function(_0x4aeff0){if(_0x4aeff0){var _0x1da1b8=typeof _0x46a25e['offset']===_0x16d1('0x22')&&typeof _0x46a25e[_0x16d1('0x23')]==='undefined';var _0x58dfcb=_0x4aeff0['count'];var _0x5b9599=_0x1da1b8?0x0:_0x46a25e[_0x16d1('0x24')];var _0x55a0e0=_0x1da1b8?_0x4aeff0[_0x16d1('0x25')]:_0x46a25e[_0x16d1('0x24')]+_0x46a25e[_0x16d1('0x23')];var _0x50c1da;if(_0x55a0e0>=_0x58dfcb){_0x55a0e0=_0x58dfcb;_0x50c1da=0xc8;}else{_0x50c1da=0xce;}_0x47c245['status'](_0x50c1da);return _0x47c245[_0x16d1('0x26')](_0x16d1('0x27'),_0x5b9599+'-'+_0x55a0e0+'/'+_0x58dfcb)[_0x16d1('0x21')](_0x4aeff0);}return null;};}function patchUpdates(_0x585ce5){return function(_0x3fc99e){try{jsonpatch[_0x16d1('0x28')](_0x3fc99e,_0x585ce5,!![]);}catch(_0x17e038){return BPromise[_0x16d1('0x29')](_0x17e038);}return _0x3fc99e[_0x16d1('0x2a')]();};}function saveUpdates(_0x1448b7,_0x32f362){return function(_0x21e122){if(_0x21e122){return _0x21e122[_0x16d1('0x2b')](_0x1448b7)[_0x16d1('0x2c')](function(_0x4b2b5c){return _0x4b2b5c;});}return null;};}function removeEntity(_0x15203b,_0x9edd96){return function(_0x262f89){if(_0x262f89){return _0x262f89[_0x16d1('0x2d')]()[_0x16d1('0x2c')](function(){_0x15203b['status'](0xcc)[_0x16d1('0x2e')]();});}};}function handleEntityNotFound(_0x440a47,_0x4257f1){return function(_0x49fc1b){if(!_0x49fc1b){_0x440a47[_0x16d1('0x1f')](0x194);}return _0x49fc1b;};}function handleError(_0x1deb1e,_0x364bf7){_0x364bf7=_0x364bf7||0x1f4;return function(_0x22e5b3){logger[_0x16d1('0x2f')](_0x22e5b3[_0x16d1('0x30')]);if(_0x22e5b3[_0x16d1('0x31')]){delete _0x22e5b3['name'];}_0x1deb1e[_0x16d1('0x20')](_0x364bf7)[_0x16d1('0x32')](_0x22e5b3);};}function getInteractionUsers(_0x31c4e9,_0x30cd8f){return new BPromise(function(_0x55c021,_0x4b27f6){try{if(_0x30cd8f[_0x31c4e9['id']]){_0x31c4e9[_0x16d1('0x33')]=_[_0x16d1('0x34')](_0x30cd8f[_0x31c4e9['id']],function(_0x473e97){return{'id':_0x473e97['id'],'fullname':_0x473e97[_0x16d1('0x35')]};});}}catch(_0x22120e){_0x4b27f6(_0x22120e);}_0x55c021(_0x31c4e9);});}function getInteractionTags(_0x2b4dbd,_0x40c6b0){return new BPromise(function(_0x84cadc,_0x266a3f){try{if(_0x2b4dbd[_0x16d1('0x36')]){_0x2b4dbd[_0x16d1('0x37')]=[];_0x2b4dbd[_0x16d1('0x36')][_0x16d1('0x38')](',')[_0x16d1('0x39')](function(_0x5f12a8){_0x2b4dbd[_0x16d1('0x37')]['push'](_0x40c6b0[_0x5f12a8]);});}delete _0x2b4dbd[_0x16d1('0x36')];}catch(_0xb6397f){_0x266a3f(_0xb6397f);}_0x84cadc(_0x2b4dbd);});}function updateWhatsappInteraction(_0x2b9126,_0x3e9bac,_0x7e7861){return new BPromise(function(_0x11e91c,_0x484318){return getInteractionUsers(_0x2b9126,_0x7e7861)['then'](function(_0x58d72d){return getInteractionTags(_0x58d72d,_0x3e9bac);})[_0x16d1('0x2c')](function(_0x407f07){return getStateInteraction(_0x407f07);})[_0x16d1('0x2c')](function(_0x5e89c5){_0x11e91c(_0x5e89c5);})['catch'](function(_0x885454){_0x484318(_0x885454);});});}function getStateInteraction(_0x158782){return new BPromise(function(_0x4cbac1){_0x158782['waiting']=0x0;_0x158782['talking']=0x0;_0x158782[_0x16d1('0x3a')]=0x0;_0x158782[_0x16d1('0x3b')]=0x0;_0x158782[_0x16d1('0x3c')]=0x0;if(!_0x158782['closed']&&!_0x158782[_0x16d1('0x3d')]){_0x158782[_0x16d1('0x3e')]+=0x1;}if(!_0x158782[_0x16d1('0x3f')]&&_0x158782[_0x16d1('0x3d')]){_0x158782[_0x16d1('0x40')]+=0x1;if(_0x158782[_0x16d1('0x3e')]){_0x158782[_0x16d1('0x3e')]-=0x1;}}if(_0x158782['closed']&&_0x158782['UserId']){_0x158782['answered']+=0x1;if(_0x158782[_0x16d1('0x40')]){_0x158782[_0x16d1('0x40')]-=0x1;}}if(_0x158782[_0x16d1('0x3f')]&&!_0x158782[_0x16d1('0x3d')]){_0x158782[_0x16d1('0x3b')]+=0x1;if(_0x158782[_0x16d1('0x3e')]){_0x158782[_0x16d1('0x3e')]-=0x1;}}_0x158782[_0x16d1('0x3c')]+=0x1;_0x4cbac1(_0x158782);});}exports['index']=function(_0x180f55,_0x4eceff){var _0x56b895={},_0x352c5b={},_0x2bec8f={'count':0x0,'rows':[]};var _0x1e54fc=_[_0x16d1('0x34')](db[_0x16d1('0x41')][_0x16d1('0x42')],function(_0x504145){return{'name':_0x504145[_0x16d1('0x43')],'type':_0x504145['type']['key']};});_0x352c5b['model']=_['map'](_0x1e54fc,_0x16d1('0x31'));_0x352c5b[_0x16d1('0x44')]=_[_0x16d1('0x45')](_0x180f55[_0x16d1('0x44')]);_0x352c5b['filters']=_[_0x16d1('0x46')](_0x352c5b['model'],_0x352c5b[_0x16d1('0x44')]);_0x56b895[_0x16d1('0x47')]=_[_0x16d1('0x46')](_0x352c5b[_0x16d1('0x48')],qs[_0x16d1('0x49')](_0x180f55[_0x16d1('0x44')][_0x16d1('0x49')]));_0x56b895[_0x16d1('0x47')]=_0x56b895[_0x16d1('0x47')][_0x16d1('0x4a')]?_0x56b895[_0x16d1('0x47')]:_0x352c5b[_0x16d1('0x48')];if(!_0x180f55[_0x16d1('0x44')][_0x16d1('0x4b')](_0x16d1('0x4c'))){_0x56b895['limit']=qs['limit'](_0x180f55[_0x16d1('0x44')][_0x16d1('0x23')]);_0x56b895[_0x16d1('0x24')]=qs[_0x16d1('0x24')](_0x180f55[_0x16d1('0x44')][_0x16d1('0x24')]);}_0x56b895['order']=qs[_0x16d1('0x4d')](_0x180f55[_0x16d1('0x44')][_0x16d1('0x4d')]);_0x56b895['where']=qs['filters'](_[_0x16d1('0x4e')](_0x180f55[_0x16d1('0x44')],_0x352c5b['filters']),_0x1e54fc);var _0x1cc137=[];var _0x583151=squel[_0x16d1('0x4f')]()[_0x16d1('0x50')]('id')[_0x16d1('0x50')](_0x16d1('0x31'))['field']('color')[_0x16d1('0x51')](_0x16d1('0x52'));var _0x5ba9ce=squel[_0x16d1('0x4f')]()[_0x16d1('0x50')](_0x16d1('0x53'))[_0x16d1('0x50')](_0x16d1('0x54'))['field'](_0x16d1('0x55'))['from'](_0x16d1('0x56'),'ui')[_0x16d1('0x57')]('users','u',_0x16d1('0x58'));var _0xd3a7f8=squel[_0x16d1('0x4f')]()[_0x16d1('0x51')]('whatsapp_interactions','i')['left_join']('cm_contacts','c',_0x16d1('0x59'))[_0x16d1('0x57')](_0x16d1('0x5a'),'o',_0x16d1('0x5b'))['left_join'](_0x16d1('0x5c'),'a',_0x16d1('0x5d'))['left_join'](_0x16d1('0x5e'),'me',_0x16d1('0x5f'))[_0x16d1('0x57')](_0x16d1('0x60'),'it','it.WhatsappInteractionId\x20=\x20i.id')[_0x16d1('0x57')](_0x16d1('0x52'),'t',_0x16d1('0x61'));var _0x5a8e76=squel['expr']();var _0x12e869=[];var _0xfa6ca1=squel['expr']();var _0x2417c5;if(_0x180f55[_0x16d1('0x44')][_0x16d1('0x62')]){_0x2417c5=as['parseSearch'](_0x180f55[_0x16d1('0x44')][_0x16d1('0x62')]);var _0x11209f=_0x2417c5[_0x16d1('0x63')];for(var _0xcd8b72=0x0;_0xcd8b72<_0x2417c5[_0x16d1('0x64')]['length'];_0xcd8b72++){var _0x4260bb=_0x2417c5[_0x16d1('0x64')][_0xcd8b72];var _0x5e9703='i';var _0x3fe2dd=_[_0x16d1('0x65')](_0x1e54fc,[_0x16d1('0x31'),_0x4260bb[_0x16d1('0x50')]]);if(!_0x3fe2dd){switch(_0x4260bb[_0x16d1('0x50')]){case _0x16d1('0x66'):if(_0x4260bb[_0x16d1('0x67')]==0x1){_0xd3a7f8[_0x16d1('0x68')]('`'+_0x4260bb['field']+_0x16d1('0x69'));}else{_0xd3a7f8['having']('`'+_0x4260bb[_0x16d1('0x50')]+'`\x20>\x200');}break;case'Contact':if(_0x4260bb[_0x16d1('0x6a')]==='$substring'){if(_0x4260bb['value'][_0x16d1('0x38')]('\x20')['length']>0x1){_0x5a8e76[_0x11209f](_0x16d1('0x6b'),qs[_0x16d1('0x6c')](_0x4260bb[_0x16d1('0x67')]),null);}else{var _0x2ec502='%'+_0x4260bb[_0x16d1('0x67')]+'%';_0x5a8e76[_0x11209f]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x2ec502,_0x2ec502,_0x2ec502);}}else{_0x3fe2dd=_[_0x16d1('0x65')](_0x1e54fc,['name',_0x16d1('0x6d')]);_0x4260bb[_0x16d1('0x50')]=_0x16d1('0x6d');_0x58f559=as[_0x16d1('0x6e')](_0x5e9703,_0x3fe2dd[_0x16d1('0x6f')],_0x4260bb);_0x5a8e76[_0x11209f](_0x58f559[_0x16d1('0x70')],_0x58f559[_0x16d1('0x67')]['start'],_0x58f559[_0x16d1('0x67')]['end']);}break;case _0x16d1('0x71'):var _0xdd1f09=_0x4260bb[_0x16d1('0x67')][_0x16d1('0x38')](',')['map'](function(_0x1bc276){return Number(_0x1bc276);});_0xdd1f09[_0x16d1('0x39')](function(_0x566192){_0xfa6ca1['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x566192+',%');});_0x12e869=_[_0x16d1('0x72')](_0x12e869,_0xdd1f09);break;case _0x16d1('0x73'):if(_0x4260bb[_0x16d1('0x6a')]===_0x16d1('0x74')){_0x5a8e76[_0x11209f](_0x16d1('0x75'),'%'+_0x4260bb['value']+'%',null);}else{_0x3fe2dd=_[_0x16d1('0x65')](_0x1e54fc,[_0x16d1('0x31'),'UserId']);_0x4260bb[_0x16d1('0x50')]='UserId';_0x58f559=as[_0x16d1('0x6e')](_0x5e9703,_0x3fe2dd[_0x16d1('0x6f')],_0x4260bb);_0x5a8e76[_0x11209f](_0x58f559['text'],_0x58f559[_0x16d1('0x67')][_0x16d1('0x76')],_0x58f559[_0x16d1('0x67')][_0x16d1('0x2e')]);}break;case _0x16d1('0x77'):_0x58f559=as[_0x16d1('0x6e')]('me',null,_0x4260bb);_0x5a8e76[_0x11209f](_0x58f559[_0x16d1('0x70')],_0x58f559[_0x16d1('0x67')][_0x16d1('0x76')],_0x58f559[_0x16d1('0x67')][_0x16d1('0x2e')]);break;}}else{var _0x58f559=as[_0x16d1('0x6e')](_0x5e9703,_0x3fe2dd[_0x16d1('0x6f')],_0x4260bb);_0x5a8e76[_0x11209f](_0x58f559[_0x16d1('0x70')],_0x58f559[_0x16d1('0x67')][_0x16d1('0x76')],_0x58f559['value'][_0x16d1('0x2e')]);}}}else{var _0x16a47a=_(_0x180f55[_0x16d1('0x44')])[_0x16d1('0x45')]()[_0x16d1('0x34')](function(_0x45ca33){return _['some'](_0x1e54fc,[_0x16d1('0x31'),_0x45ca33])?_0x45ca33:undefined;})[_0x16d1('0x78')]()[_0x16d1('0x67')]();if(!_['isEmpty'](_0x16a47a)){_0x16a47a['forEach'](function(_0xe61313){if(_0xe61313===_0x16d1('0x79')){_0xd3a7f8[_0x16d1('0x7a')]('i.WhatsappAccountId\x20IN\x20?',[]['concat'](_0x180f55[_0x16d1('0x44')][_0xe61313]));}else if(_0xe61313===_0x16d1('0x7b')){var _0x5bcfce=JSON[_0x16d1('0x7c')](_0x180f55[_0x16d1('0x44')][_0xe61313])[_0x16d1('0x7d')];var _0x1aeb49=JSON[_0x16d1('0x7c')](_0x180f55[_0x16d1('0x44')][_0xe61313])[_0x16d1('0x7e')];_0xd3a7f8[_0x16d1('0x7a')](_0x16d1('0x7f'),_0x5bcfce,_0x1aeb49);}else{if(_0x180f55['query'][_0xe61313]===_0x16d1('0x80')){_0xd3a7f8[_0x16d1('0x7a')]('i.'+_0xe61313+_0x16d1('0x81'));}else{_0xd3a7f8[_0x16d1('0x7a')]('i.'+_0xe61313+_0x16d1('0x82'),_0x180f55[_0x16d1('0x44')][_0xe61313]);}}});}if(_0x180f55[_0x16d1('0x44')][_0x16d1('0x83')]){if(_0x180f55[_0x16d1('0x44')][_0x16d1('0x83')]==0x1){_0xd3a7f8[_0x16d1('0x68')](_0x16d1('0x84'));}else{_0xd3a7f8['having'](_0x16d1('0x85'));}}if(_0x180f55[_0x16d1('0x44')][_0x16d1('0x86')]){_0x12e869=_['isArray'](_0x180f55['query'][_0x16d1('0x86')])?_0x180f55['query'][_0x16d1('0x86')]:new Array(_0x180f55[_0x16d1('0x44')][_0x16d1('0x86')]);_0x12e869['forEach'](function(_0x288f36){_0xfa6ca1['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x288f36+',%');});}if(_0x180f55['query'][_0x16d1('0x87')]){var _0x3af368=_0x180f55[_0x16d1('0x44')][_0x16d1('0x87')]['replace']('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs['isNumeric'](_0x3af368)){_0x5a8e76['or'](_0x16d1('0x88'),_0x3af368+'%')['or']('i.phone\x20LIKE\x20?',_0x3af368+'%');}else{_0x5a8e76['or'](_0x16d1('0x89'),qs['getFullTextValue'](_0x3af368))['or'](_0x16d1('0x8a'),_0x3af368+'%');}}}_0xd3a7f8['where'](_0x5a8e76);_0xd3a7f8['group'](_0x16d1('0x8b'));var _0x23a436={'type':db[_0x16d1('0x8c')][_0x16d1('0x8d')][_0x16d1('0x8e')],'raw':!![]};var _0x3e2768=_0xd3a7f8['clone']();_0x3e2768[_0x16d1('0x50')](_0x16d1('0x8b'));_0x3e2768[_0x16d1('0x50')](_0x16d1('0x8f'),'unreadMessages');if(_0x56b895[_0x16d1('0x90')]){_0x56b895[_0x16d1('0x90')]['forEach'](function(_0x3ff968){var _0xc0aa2f=_0x3ff968[0x0]===_0x16d1('0x91')?_0x3ff968[0x0]:'i.'+_0x3ff968[0x0];_0xd3a7f8['order'](_0xc0aa2f,_0x3ff968[0x1]===_0x16d1('0x92')?![]:!![]);});}if(!_[_0x16d1('0x93')](_0x12e869)){_0xd3a7f8[_0x16d1('0x68')](_0xfa6ca1);_0x3e2768[_0x16d1('0x7a')](_0x16d1('0x94'),_0x12e869);}BPromise[_0x16d1('0x95')]()[_0x16d1('0x2c')](function(){if(!_0x2417c5){if(_0x180f55[_0x16d1('0x44')][_0x16d1('0x79')])return;_0x3e2768['where'](_0x16d1('0x96'));_0xd3a7f8['where'](_0x16d1('0x96'));return;}if(_0x180f55[_0x16d1('0x97')][_0x16d1('0x98')]!==_0x16d1('0x99'))return;return _0x180f55[_0x16d1('0x97')][_0x16d1('0x9a')]({'attributes':['id'],'raw':!![]})[_0x16d1('0x2c')](function(_0x35f7c2){if(_[_0x16d1('0x93')](_0x35f7c2)){_0x3e2768['where'](_0x16d1('0x9b'));_0xd3a7f8[_0x16d1('0x7a')](_0x16d1('0x9b'));}else{_0x3e2768[_0x16d1('0x7a')]('i.WhatsappAccountId\x20IN\x20?',_['map'](_0x35f7c2,'id'));_0xd3a7f8['where'](_0x16d1('0x9c'),_[_0x16d1('0x34')](_0x35f7c2,'id'));}});})[_0x16d1('0x2c')](function(){if(_0x180f55[_0x16d1('0x97')]['role']==='agent'&&!_0x2417c5&&!_0x180f55[_0x16d1('0x44')][_0x16d1('0x79')])return[];return db[_0x16d1('0x9d')][_0x16d1('0x44')](_0x3e2768[_0x16d1('0x9e')](),_0x23a436);})[_0x16d1('0x2c')](function(_0x12eb3b){_0x2bec8f[_0x16d1('0x25')]=_0x12eb3b[_0x16d1('0x4a')];if(_0x2bec8f[_0x16d1('0x25')]===0x0)return[];return db[_0x16d1('0x9d')][_0x16d1('0x44')](_0x583151['toString'](),_0x23a436)[_0x16d1('0x2c')](function(_0x1c15aa){_0x1cc137=_[_0x16d1('0x9f')](_0x1c15aa,'id');_0x23a436=_[_0x16d1('0xa0')](_0x23a436,{'model':db['WhatsappInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x180f55['query'][_0x16d1('0x49')]){_0x56b895['attributes'][_0x16d1('0x39')](function(_0x3a8985){_0xd3a7f8['field']('i.'+_0x3a8985);});}else{_0xd3a7f8[_0x16d1('0x50')](_0x16d1('0x8f'),_0x16d1('0x66'));_0xd3a7f8[_0x16d1('0x50')]('a.key',_0x16d1('0xa1'));_0xd3a7f8['field'](_0x16d1('0xa2'),_0x16d1('0xa3'));_0xd3a7f8['field'](_0x16d1('0xa4'),'contactName');_0xd3a7f8[_0x16d1('0x50')](_0x16d1('0xa5'));_0xd3a7f8[_0x16d1('0x50')](_0x16d1('0xa6'),_0x16d1('0xa7'));_0xd3a7f8[_0x16d1('0x50')](_0x16d1('0xa8'),_0x16d1('0xa9'));_0xd3a7f8['field'](_0x16d1('0xaa'),'Contact.email');_0xd3a7f8[_0x16d1('0x50')](_0x16d1('0xab'),_0x16d1('0xac'));_0xd3a7f8[_0x16d1('0x50')](_0x16d1('0xad'),'Contact.mobile');_0xd3a7f8['field'](_0x16d1('0xae'),_0x16d1('0xaf'));_0xd3a7f8[_0x16d1('0x50')](_0x16d1('0xb0'),'Owner.fullname');_0xd3a7f8[_0x16d1('0x50')](_0x16d1('0xb1'),_0x16d1('0xb2'));_0xd3a7f8[_0x16d1('0x50')](_0x16d1('0xb3'),_0x16d1('0x36'));}if(_0x56b895[_0x16d1('0x23')])_0xd3a7f8['limit'](_0x56b895['limit']);if(_0x56b895[_0x16d1('0x24')])_0xd3a7f8[_0x16d1('0x24')](_0x56b895[_0x16d1('0x24')]);return db[_0x16d1('0x9d')][_0x16d1('0x44')](_0xd3a7f8[_0x16d1('0x9e')](),_0x23a436);})[_0x16d1('0x2c')](function(_0x34f661){if(_0x34f661[_0x16d1('0x4a')]>0x0)_0x5ba9ce[_0x16d1('0x7a')](_0x16d1('0xb4'),_[_0x16d1('0x34')](_0x34f661,'id'));return db[_0x16d1('0x9d')]['query'](_0x5ba9ce[_0x16d1('0x9e')](),_0x23a436)[_0x16d1('0x2c')](function(_0xc8a769){var _0x2869b2=_[_0x16d1('0xb5')](_0xc8a769,'WhatsappInteractionId');var _0x48f04b=[];_0x34f661['forEach'](function(_0x260bca){_0x48f04b[_0x16d1('0xb6')](updateWhatsappInteraction(_0x260bca,_0x1cc137,_0x2869b2));});return BPromise[_0x16d1('0xb7')](_0x48f04b);});});})[_0x16d1('0x2c')](function(_0x4dd9ec){_0x2bec8f[_0x16d1('0xb8')]=_0x4dd9ec;return _0x2bec8f;})[_0x16d1('0x2c')](respondWithFilteredResult(_0x4eceff,_0x56b895))[_0x16d1('0xb9')](handleError(_0x4eceff,null));};exports[_0x16d1('0xba')]=function(_0x5a88ac,_0x4dbc94){var _0x97b553={'raw':![],'where':{'id':_0x5a88ac['params']['id']}},_0xd7fa0d={};_0xd7fa0d['model']=_[_0x16d1('0x45')](db[_0x16d1('0x41')]['rawAttributes']);_0xd7fa0d[_0x16d1('0x44')]=_[_0x16d1('0x45')](_0x5a88ac[_0x16d1('0x44')]);_0xd7fa0d[_0x16d1('0xbb')]=_[_0x16d1('0x46')](_0xd7fa0d[_0x16d1('0x48')],_0xd7fa0d[_0x16d1('0x44')]);_0x97b553['attributes']=_[_0x16d1('0x46')](_0xd7fa0d[_0x16d1('0x48')],qs[_0x16d1('0x49')](_0x5a88ac[_0x16d1('0x44')][_0x16d1('0x49')]));_0x97b553[_0x16d1('0x47')]=_0x97b553[_0x16d1('0x47')][_0x16d1('0x4a')]?_0x97b553[_0x16d1('0x47')]:_0xd7fa0d[_0x16d1('0x48')];if(_0x5a88ac[_0x16d1('0x44')]['includeAll']){_0x97b553[_0x16d1('0xbc')]=[{'all':!![]}];}_0x97b553=_['merge']({},_0x97b553,_0x5a88ac[_0x16d1('0xbd')]);return db[_0x16d1('0x41')][_0x16d1('0x65')](_0x97b553)[_0x16d1('0x2c')](handleEntityNotFound(_0x4dbc94,null))['then'](respondWithResult(_0x4dbc94,null))[_0x16d1('0xb9')](handleError(_0x4dbc94,null));};exports[_0x16d1('0xbe')]=function(_0x151015,_0x4439a9){return db[_0x16d1('0x41')][_0x16d1('0xbe')](_0x151015[_0x16d1('0x77')],{})[_0x16d1('0x2c')](respondWithResult(_0x4439a9,0xc9))['catch'](handleError(_0x4439a9,null));};exports['update']=function(_0x3363b1,_0x15648b){if(_0x3363b1[_0x16d1('0x77')]['id']){delete _0x3363b1['body']['id'];}return db[_0x16d1('0x41')][_0x16d1('0x65')]({'where':{'id':_0x3363b1[_0x16d1('0xbf')]['id']}})[_0x16d1('0x2c')](handleEntityNotFound(_0x15648b,null))[_0x16d1('0x2c')](saveUpdates(_0x3363b1[_0x16d1('0x77')],null))[_0x16d1('0x2c')](respondWithResult(_0x15648b,null))[_0x16d1('0xb9')](handleError(_0x15648b,null));};exports['destroy']=function(_0x44b949,_0xfedf2c){return db[_0x16d1('0x41')][_0x16d1('0x65')]({'where':{'id':_0x44b949[_0x16d1('0xbf')]['id']}})[_0x16d1('0x2c')](handleEntityNotFound(_0xfedf2c,null))[_0x16d1('0x2c')](removeEntity(_0xfedf2c,null))[_0x16d1('0xb9')](handleError(_0xfedf2c,null));};exports[_0x16d1('0xc0')]=function(_0x58cff8,_0x1b5c96){return db[_0x16d1('0x41')][_0x16d1('0xc0')]()['then'](respondWithResult(_0x1b5c96,null))[_0x16d1('0xb9')](handleError(_0x1b5c96,null));};exports[_0x16d1('0xc1')]=function(_0x1d3dc2,_0x56be49,_0x3d4366){return db['WhatsappMessage'][_0x16d1('0x65')]({'where':{'id':_0x1d3dc2[_0x16d1('0xbf')]['id']}})[_0x16d1('0x2c')](handleEntityNotFound(_0x56be49,null))[_0x16d1('0x2c')](function(_0x267358){if(_0x267358){return _0x267358['addMessage'](_0x1d3dc2[_0x16d1('0x77')][_0x16d1('0xc2')],_['omit'](_0x1d3dc2[_0x16d1('0x77')],[_0x16d1('0xc2'),'id'])||{});}})[_0x16d1('0x2c')](respondWithResult(_0x56be49,null))[_0x16d1('0xb9')](handleError(_0x56be49,null));};exports[_0x16d1('0xc3')]=function(_0x53ee32,_0x2070a2,_0x249ca5){var _0x1c10da={'raw':![],'where':{}};var _0x269386={};var _0x38cb49={'count':0x0,'rows':[]};return db[_0x16d1('0x41')]['findOne']({'where':{'id':_0x53ee32[_0x16d1('0xbf')]['id']}})[_0x16d1('0x2c')](handleEntityNotFound(_0x2070a2,null))['then'](function(_0xf1a91a){if(_0xf1a91a){_0x269386[_0x16d1('0x48')]=_[_0x16d1('0x45')](db['WhatsappMessage']['rawAttributes']);_0x269386[_0x16d1('0x44')]=_[_0x16d1('0x45')](_0x53ee32[_0x16d1('0x44')]);_0x269386[_0x16d1('0xbb')]=_['intersection'](_0x269386['model'],_0x269386[_0x16d1('0x44')]);_0x1c10da[_0x16d1('0x47')]=_[_0x16d1('0x46')](_0x269386['model'],qs[_0x16d1('0x49')](_0x53ee32[_0x16d1('0x44')][_0x16d1('0x49')]));_0x1c10da['attributes']=_0x1c10da[_0x16d1('0x47')][_0x16d1('0x4a')]?_0x1c10da[_0x16d1('0x47')]:_0x269386[_0x16d1('0x48')];if(!_0x53ee32[_0x16d1('0x44')]['hasOwnProperty'](_0x16d1('0x4c'))){_0x1c10da['limit']=qs[_0x16d1('0x23')](_0x53ee32[_0x16d1('0x44')][_0x16d1('0x23')]);_0x1c10da[_0x16d1('0x24')]=qs['offset'](_0x53ee32['query']['offset']);}_0x1c10da['order']=qs[_0x16d1('0x4d')](_0x53ee32[_0x16d1('0x44')][_0x16d1('0x4d')]);_0x1c10da[_0x16d1('0x7a')]=qs[_0x16d1('0xbb')](_[_0x16d1('0x4e')](_0x53ee32[_0x16d1('0x44')],_0x269386['filters']));_0x1c10da['where'][_0x16d1('0xc4')]=_0xf1a91a['id'];if(_0x53ee32[_0x16d1('0x44')][_0x16d1('0x87')]){_0x1c10da['where']=_[_0x16d1('0xa0')](_0x1c10da[_0x16d1('0x7a')],{'$or':_[_0x16d1('0x34')](_0x1c10da['attributes'],function(_0x5b7b88){var _0x1bec2a={};_0x1bec2a[_0x5b7b88]={'$like':'%'+_0x53ee32[_0x16d1('0x44')][_0x16d1('0x87')]+'%'};return _0x1bec2a;})});}if(_0x53ee32['query'][_0x16d1('0x7d')]){var _0x41fd1b=_0x53ee32[_0x16d1('0x44')][_0x16d1('0x7d')][_0x16d1('0x38')](',');var _0x4f5ff0={};_0x4f5ff0[_0x41fd1b[0x0]]={'$gte':moment(_0x41fd1b[0x1])[_0x16d1('0xc5')]('YYYY-MM-DD\x20HH:mm:ss')};_0x1c10da[_0x16d1('0x7a')]=_['merge'](_0x1c10da[_0x16d1('0x7a')],_0x4f5ff0);}_0x1c10da=_['merge']({},_0x1c10da,_0x53ee32[_0x16d1('0xbd')]);return db[_0x16d1('0xc6')][_0x16d1('0x25')]({'where':_0x1c10da[_0x16d1('0x7a')]})[_0x16d1('0x2c')](function(_0x41fbe1){_0x38cb49['count']=_0x41fbe1;if(_0x53ee32[_0x16d1('0x44')][_0x16d1('0xc7')]){_0x1c10da['include']=[{'all':!![]}];}return db[_0x16d1('0xc6')][_0x16d1('0xc8')](_0x1c10da);})[_0x16d1('0x2c')](function(_0x2f4722){_0x38cb49[_0x16d1('0xb8')]=_0x2f4722;return _0x38cb49;});}})['then'](respondWithFilteredResult(_0x2070a2,_0x1c10da))[_0x16d1('0xb9')](handleError(_0x2070a2,null));};exports[_0x16d1('0xc9')]=function(_0x11b7fd,_0x1d3deb,_0x42f874){return db[_0x16d1('0x41')]['find']({'where':{'id':_0x11b7fd[_0x16d1('0xbf')]['id']}})[_0x16d1('0x2c')](handleEntityNotFound(_0x1d3deb,null))['then'](function(_0xace250){if(_0xace250){return _0xace250[_0x16d1('0xca')](_0x11b7fd['body'][_0x16d1('0xc2')],_[_0x16d1('0xcb')](_0x11b7fd[_0x16d1('0x77')],[_0x16d1('0xc2'),'id'])||{})[_0x16d1('0xcc')](function(){return db[_0x16d1('0x71')][_0x16d1('0xc8')]({'attributes':['id',_0x16d1('0x31'),_0x16d1('0xcd')],'where':{'id':_0x11b7fd['body'][_0x16d1('0xc2')]}});})[_0x16d1('0x2c')](function(_0x31b08d){socket[_0x16d1('0xce')](_0x16d1('0xcf'),{'id':Number(_0x11b7fd[_0x16d1('0xbf')]['id']),'tags':_0x31b08d||[]});return{'id':Number(_0x11b7fd[_0x16d1('0xbf')]['id']),'tags':_0x31b08d||[]};});}})[_0x16d1('0x2c')](respondWithResult(_0x1d3deb,null))[_0x16d1('0xb9')](handleError(_0x1d3deb,null));};exports['removeTags']=function(_0x51e417,_0x3be1ad,_0x69d97){return db[_0x16d1('0x41')][_0x16d1('0x65')]({'where':{'id':_0x51e417['params']['id']}})[_0x16d1('0x2c')](handleEntityNotFound(_0x3be1ad,null))['then'](function(_0x284dc7){if(_0x284dc7){return _0x284dc7[_0x16d1('0xd0')](_0x51e417[_0x16d1('0x44')][_0x16d1('0xc2')]);}})['then'](respondWithStatusCode(_0x3be1ad,null))['catch'](handleError(_0x3be1ad,null));};exports['download']=function(_0x40a751,_0x30891e){var _0x461b0a=moment()['unix']()[_0x16d1('0x9e')]();var _0x57a3bb=path[_0x16d1('0xd1')](config[_0x16d1('0xd2')],_0x16d1('0xd3'),'files',_0x16d1('0xd4'));var _0x289123=path[_0x16d1('0xd1')](config[_0x16d1('0xd2')],_0x16d1('0xd3'),_0x16d1('0xd5'),_0x16d1('0xd6'));var _0x3a9cae=path['join'](_0x57a3bb,_0x461b0a);var _0x58dc3d=util[_0x16d1('0xc5')](_0x16d1('0xd7'),_0x40a751[_0x16d1('0xbf')]['id'],_0x461b0a);var _0x3cb957=path['join'](_0x57a3bb,_0x58dc3d);var _0x1ede6d=[];_0x1ede6d[_0x16d1('0xb6')]({'model':db[_0x16d1('0x73')],'as':_0x16d1('0x73'),'attributes':['id','fullname'],'raw':!![]});_0x1ede6d[_0x16d1('0xb6')]({'model':db[_0x16d1('0xd8')],'as':_0x16d1('0xd9'),'attributes':['id',_0x16d1('0xda'),_0x16d1('0xdb')],'raw':!![]});if(_0x40a751[_0x16d1('0x44')][_0x16d1('0xd6')]){_0x1ede6d[_0x16d1('0xb6')]({'model':db[_0x16d1('0xdc')],'as':'Attachment','raw':!![]});}var _0x2a327f=[{'model':db[_0x16d1('0xc6')],'as':_0x16d1('0xdd'),'attributes':['id','body',_0x16d1('0x7b'),_0x16d1('0xde'),_0x16d1('0xdf'),_0x16d1('0x83')],'include':_0x1ede6d}];_0x2a327f[_0x16d1('0xb6')]({'model':db[_0x16d1('0xe0')],'as':'Account','attributes':['id','name']});_0x2a327f[_0x16d1('0xb6')]({'model':db[_0x16d1('0x73')],'as':'Owner','attributes':['id',_0x16d1('0x35')]});return db[_0x16d1('0x41')]['find']({'where':{'id':_0x40a751[_0x16d1('0xbf')]['id']},'include':_0x2a327f})[_0x16d1('0x2c')](handleEntityNotFound(_0x30891e,null))[_0x16d1('0x2c')](function(_0x23673e){if(_0x23673e){var _0x11ef51=_0x23673e[_0x16d1('0xe1')]({'plain':!![]});fs[_0x16d1('0xe2')](_0x3a9cae);var _0x1de5b3={'channel':_0x16d1('0xe3'),'account':_0x11ef51[_0x16d1('0xe4')][_0x16d1('0x31')],'agent':_0x11ef51[_0x16d1('0xe5')]?_0x11ef51['Owner']['fullname']:_0x16d1('0xe6'),'createdAt':moment(_0x11ef51[_0x16d1('0x7b')])['format'](_0x16d1('0xe7'))[_0x16d1('0x9e')](),'closedAt':_0x11ef51['closed']?moment(_0x11ef51[_0x16d1('0xe8')])[_0x16d1('0xc5')](_0x16d1('0xe7'))['toString']():'','disposition':_0x11ef51['disposition'],'messages':_(_0x11ef51[_0x16d1('0xdd')])[_0x16d1('0x87')]({'secret':![]})[_0x16d1('0x34')](function(_0x13b1d8){if(_0x13b1d8['Attachment']){var _0x3f2712=path['join'](_0x289123,_0x13b1d8[_0x16d1('0xdc')]['basename']);if(fs[_0x16d1('0xe9')](_0x3f2712)){fs[_0x16d1('0xea')](_0x3f2712)[_0x16d1('0xeb')](fs[_0x16d1('0xec')](path[_0x16d1('0xd1')](_0x3a9cae,_0x13b1d8[_0x16d1('0xdc')]['basename'])));}}return{'date':moment(_0x13b1d8[_0x16d1('0x7b')])[_0x16d1('0xc5')]('YYYY-MM-DD\x20HH:mm:ss')[_0x16d1('0x9e')](),'sender':_0x13b1d8[_0x16d1('0xde')]==='out'?_0x13b1d8[_0x16d1('0x73')]?_0x13b1d8[_0x16d1('0x73')][_0x16d1('0x35')]:'System':_0x13b1d8[_0x16d1('0xd9')][_0x16d1('0xda')]+(_0x13b1d8['Contact'][_0x16d1('0xdb')]?'\x20'+_0x13b1d8['Contact']['lastName']:''),'body':_0x13b1d8['Attachment']?_0x13b1d8[_0x16d1('0xdc')]['basename']:_0x13b1d8[_0x16d1('0x77')],'direction':_0x13b1d8['direction']===_0x16d1('0xed')?'A':'C','secret':_0x13b1d8[_0x16d1('0xdf')],'read':_0x13b1d8[_0x16d1('0x83')],'attachment':_0x13b1d8[_0x16d1('0xdc')]};})[_0x16d1('0x67')]()};return ejs[_0x16d1('0xee')](path[_0x16d1('0xd1')](config[_0x16d1('0xd2')],_0x16d1('0xd3'),'views',_0x16d1('0xef')),{'interaction':_0x1de5b3})['then'](function(_0x5f4236){var _0x1d71d9=path[_0x16d1('0xd1')](_0x3a9cae,_0x16d1('0xf0')+_0x11ef51['id']+'-'+_0x461b0a+_0x16d1('0xf1'));var _0x48a592={'path':_0x1d71d9,'channel':'Whatsapp','interactionId':_0x11ef51['id']};return pdf[_0x16d1('0xf2')](_0x5f4236,_0x48a592);})['then'](function(){return new BPromise(function(_0x2077d0,_0xe589b){zipdir(_0x3a9cae,{'saveTo':_0x3cb957},function(_0x3bf1da,_0x438b8c){if(_0x3bf1da)return _0xe589b(_0x3bf1da);return _0x2077d0(_0x438b8c);});})['then'](function(){return new BPromise(function(_0x3938cc,_0x1bb6b0){rimraf(_0x3a9cae,function(_0xee1f41){if(_0xee1f41)_0x1bb6b0(_0xee1f41);return _0x3938cc();});});})[_0x16d1('0x2c')](function(){return _0x30891e[_0x16d1('0xf3')](_0x3cb957,_0x58dc3d,function(_0x3b5b98){if(_0x3b5b98){console[_0x16d1('0xf4')](_0x16d1('0xf5'),_0x3b5b98);}else{fs['unlinkSync'](_0x3cb957);}});});});}else{return _0x30891e[_0x16d1('0x1f')](0xc8);}})[_0x16d1('0xb9')](handleError(_0x30891e,null));}; \ No newline at end of file +var _0x4991=['createWriteStream','out','System','lastName','direction','views','downloadInteraction.ejs','transcript-','Whatsapp','createPdfFromHTML','log','err','unlinkSync','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../components/export/pdf','../../config/logger','api','../../mysqldb','redis','defaults','localhost','./whatsappInteraction.socket','sendStatus','end','status','json','limit','undefined','count','offset','set','Content-Range','apply','reject','update','then','destroy','error','stack','name','Users','map','fullname','TagIds','Tags','split','forEach','push','catch','waiting','talking','answered','unmanaged','UserId','closed','total','index','WhatsappInteraction','rawAttributes','fieldName','type','key','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','select','field','color','tools_tags','u.fullname','from','user_has_whatsapp_interactions','left_join','users','u.id\x20=\x20ui.UserId','whatsapp_interactions','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','whatsapp_accounts','whatsapp_messages','whatsapp_interaction_has_tags','it.WhatsappInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','parseSearch','sqlOperator','conditions','unreadMessages','value','having','`\x20>\x200','Contact','operator','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','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?','text','body','some','compact','isEmpty','WhatsappAccountId','i.WhatsappAccountId\x20IN\x20?','concat','parse','$gte','$lte','null','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','isNumeric','i.id\x20LIKE\x20?','getFullTextValue','i.id','Sequelize','QueryTypes','SELECT','clone','DESC','resolve','i.WhatsappAccountId\x20IS\x20NOT\x20NULL','user','role','getWhatsappAccounts','i.WhatsappAccountId\x20IS\x20NULL','agent','sequelize','toString','merge','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','a.key','Account.key','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','contactName','i.*','c.firstName','Contact.firstName','Contact.lastName','c.mobile','Contact.mobile','c.fax','Contact.fax','Owner.fullname','o.internal','ui.WhatsappInteractionId\x20IN\x20?','groupBy','WhatsappInteractionId','all','rows','params','options','create','addMessage','ids','findOne','WhatsappMessage','format','YYYY-MM-DD\x20HH:mm:ss','includeAll','include','findAll','addTags','setTags','spread','emit','whatsappInteractionTags:save','removeTags','download','unix','join','root','server','files','tmp','transcript-%d-%s.zip','CmContact','firstName','attachments','Attachment','Messages','secret','WhatsappAccount','Account','Owner','get','mkdirSync','createdAt','closedAt','disposition','basename','existsSync','createReadStream','pipe'];(function(_0x371ff7,_0x2d7222){var _0x318124=function(_0x150cdd){while(--_0x150cdd){_0x371ff7['push'](_0x371ff7['shift']());}};_0x318124(++_0x2d7222);}(_0x4991,0xf7));var _0x1499=function(_0x14db1e,_0x118e49){_0x14db1e=_0x14db1e-0x0;var _0x4fe0d9=_0x4991[_0x14db1e];return _0x4fe0d9;};'use strict';var emlformat=require(_0x1499('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x1499('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x1499('0x2'));var moment=require(_0x1499('0x3'));var BPromise=require(_0x1499('0x4'));var Mustache=require(_0x1499('0x5'));var util=require(_0x1499('0x6'));var path=require(_0x1499('0x7'));var sox=require(_0x1499('0x8'));var csv=require(_0x1499('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1499('0xa'));var _=require(_0x1499('0xb'));var squel=require(_0x1499('0xc'));var crypto=require(_0x1499('0xd'));var jsforce=require(_0x1499('0xe'));var deskjs=require(_0x1499('0xf'));var toCsv=require(_0x1499('0x9'));var querystring=require(_0x1499('0x10'));var Papa=require('papaparse');var Redis=require(_0x1499('0x11'));var authService=require(_0x1499('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x1499('0x13'));var pdf=require(_0x1499('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x1499('0x15'))(_0x1499('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x1499('0x17'))['db'];config[_0x1499('0x18')]=_[_0x1499('0x19')](config[_0x1499('0x18')],{'host':_0x1499('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x1499('0x1b'))['register'](socket);function respondWithStatusCode(_0x37d99e,_0x12cde0){_0x12cde0=_0x12cde0||0xcc;return function(_0x308318){if(_0x308318){return _0x37d99e[_0x1499('0x1c')](_0x12cde0);}return _0x37d99e['status'](_0x12cde0)[_0x1499('0x1d')]();};}function respondWithResult(_0x373f57,_0x592c27){_0x592c27=_0x592c27||0xc8;return function(_0x25164c){if(_0x25164c){return _0x373f57[_0x1499('0x1e')](_0x592c27)[_0x1499('0x1f')](_0x25164c);}};}function respondWithFilteredResult(_0xc92272,_0x1e45a9){return function(_0x27e533){if(_0x27e533){var _0x5b9859=typeof _0x1e45a9['offset']==='undefined'&&typeof _0x1e45a9[_0x1499('0x20')]===_0x1499('0x21');var _0x4a4e28=_0x27e533[_0x1499('0x22')];var _0x3c13a1=_0x5b9859?0x0:_0x1e45a9[_0x1499('0x23')];var _0x18e4a6=_0x5b9859?_0x27e533[_0x1499('0x22')]:_0x1e45a9[_0x1499('0x23')]+_0x1e45a9[_0x1499('0x20')];var _0x253439;if(_0x18e4a6>=_0x4a4e28){_0x18e4a6=_0x4a4e28;_0x253439=0xc8;}else{_0x253439=0xce;}_0xc92272[_0x1499('0x1e')](_0x253439);return _0xc92272[_0x1499('0x24')](_0x1499('0x25'),_0x3c13a1+'-'+_0x18e4a6+'/'+_0x4a4e28)[_0x1499('0x1f')](_0x27e533);}return null;};}function patchUpdates(_0x223f4c){return function(_0x3b73f6){try{jsonpatch[_0x1499('0x26')](_0x3b73f6,_0x223f4c,!![]);}catch(_0x1e2c51){return BPromise[_0x1499('0x27')](_0x1e2c51);}return _0x3b73f6['save']();};}function saveUpdates(_0x258e9c,_0xc79f69){return function(_0x30f014){if(_0x30f014){return _0x30f014[_0x1499('0x28')](_0x258e9c)[_0x1499('0x29')](function(_0x16d036){return _0x16d036;});}return null;};}function removeEntity(_0x54f3c2,_0x501c0d){return function(_0x12739b){if(_0x12739b){return _0x12739b[_0x1499('0x2a')]()[_0x1499('0x29')](function(){_0x54f3c2[_0x1499('0x1e')](0xcc)[_0x1499('0x1d')]();});}};}function handleEntityNotFound(_0x525d6f,_0x3e5ed1){return function(_0x573b51){if(!_0x573b51){_0x525d6f['sendStatus'](0x194);}return _0x573b51;};}function handleError(_0x516f29,_0x21d204){_0x21d204=_0x21d204||0x1f4;return function(_0x103efa){logger[_0x1499('0x2b')](_0x103efa[_0x1499('0x2c')]);if(_0x103efa[_0x1499('0x2d')]){delete _0x103efa[_0x1499('0x2d')];}_0x516f29[_0x1499('0x1e')](_0x21d204)['send'](_0x103efa);};}function getInteractionUsers(_0x180171,_0x1a2c99){return new BPromise(function(_0x39995b,_0x5b59ea){try{if(_0x1a2c99[_0x180171['id']]){_0x180171[_0x1499('0x2e')]=_[_0x1499('0x2f')](_0x1a2c99[_0x180171['id']],function(_0x5d4cb1){return{'id':_0x5d4cb1['id'],'fullname':_0x5d4cb1[_0x1499('0x30')]};});}}catch(_0x72ad){_0x5b59ea(_0x72ad);}_0x39995b(_0x180171);});}function getInteractionTags(_0x497efd,_0x464c5a){return new BPromise(function(_0x2eda80,_0x15cc57){try{if(_0x497efd[_0x1499('0x31')]){_0x497efd[_0x1499('0x32')]=[];_0x497efd[_0x1499('0x31')][_0x1499('0x33')](',')[_0x1499('0x34')](function(_0x11767f){_0x497efd[_0x1499('0x32')][_0x1499('0x35')](_0x464c5a[_0x11767f]);});}delete _0x497efd[_0x1499('0x31')];}catch(_0xdd10ad){_0x15cc57(_0xdd10ad);}_0x2eda80(_0x497efd);});}function updateWhatsappInteraction(_0x3f4c1a,_0x2764ba,_0x197afc){return new BPromise(function(_0x417dd1,_0x32cd10){return getInteractionUsers(_0x3f4c1a,_0x197afc)[_0x1499('0x29')](function(_0x29e89e){return getInteractionTags(_0x29e89e,_0x2764ba);})['then'](function(_0x3348bc){return getStateInteraction(_0x3348bc);})[_0x1499('0x29')](function(_0x45685c){_0x417dd1(_0x45685c);})[_0x1499('0x36')](function(_0x31251c){_0x32cd10(_0x31251c);});});}function getStateInteraction(_0x136002){return new BPromise(function(_0x351ed3){_0x136002[_0x1499('0x37')]=0x0;_0x136002[_0x1499('0x38')]=0x0;_0x136002[_0x1499('0x39')]=0x0;_0x136002[_0x1499('0x3a')]=0x0;_0x136002['total']=0x0;if(!_0x136002['closed']&&!_0x136002[_0x1499('0x3b')]){_0x136002['waiting']+=0x1;}if(!_0x136002[_0x1499('0x3c')]&&_0x136002['UserId']){_0x136002[_0x1499('0x38')]+=0x1;if(_0x136002[_0x1499('0x37')]){_0x136002[_0x1499('0x37')]-=0x1;}}if(_0x136002[_0x1499('0x3c')]&&_0x136002['UserId']){_0x136002[_0x1499('0x39')]+=0x1;if(_0x136002['talking']){_0x136002[_0x1499('0x38')]-=0x1;}}if(_0x136002[_0x1499('0x3c')]&&!_0x136002[_0x1499('0x3b')]){_0x136002[_0x1499('0x3a')]+=0x1;if(_0x136002['waiting']){_0x136002[_0x1499('0x37')]-=0x1;}}_0x136002[_0x1499('0x3d')]+=0x1;_0x351ed3(_0x136002);});}exports[_0x1499('0x3e')]=function(_0x3b67a7,_0x5c5835){var _0x3fac62={},_0x4cc411={},_0x3770b5={'count':0x0,'rows':[]};var _0x38f449=_[_0x1499('0x2f')](db[_0x1499('0x3f')][_0x1499('0x40')],function(_0x374e11){return{'name':_0x374e11[_0x1499('0x41')],'type':_0x374e11[_0x1499('0x42')][_0x1499('0x43')]};});_0x4cc411[_0x1499('0x44')]=_['map'](_0x38f449,_0x1499('0x2d'));_0x4cc411['query']=_[_0x1499('0x45')](_0x3b67a7[_0x1499('0x46')]);_0x4cc411['filters']=_[_0x1499('0x47')](_0x4cc411[_0x1499('0x44')],_0x4cc411[_0x1499('0x46')]);_0x3fac62[_0x1499('0x48')]=_[_0x1499('0x47')](_0x4cc411['model'],qs['fields'](_0x3b67a7[_0x1499('0x46')][_0x1499('0x49')]));_0x3fac62['attributes']=_0x3fac62[_0x1499('0x48')][_0x1499('0x4a')]?_0x3fac62['attributes']:_0x4cc411['model'];if(!_0x3b67a7[_0x1499('0x46')][_0x1499('0x4b')](_0x1499('0x4c'))){_0x3fac62['limit']=qs[_0x1499('0x20')](_0x3b67a7[_0x1499('0x46')][_0x1499('0x20')]);_0x3fac62[_0x1499('0x23')]=qs['offset'](_0x3b67a7[_0x1499('0x46')][_0x1499('0x23')]);}_0x3fac62[_0x1499('0x4d')]=qs[_0x1499('0x4e')](_0x3b67a7['query'][_0x1499('0x4e')]);_0x3fac62[_0x1499('0x4f')]=qs[_0x1499('0x50')](_['pick'](_0x3b67a7['query'],_0x4cc411[_0x1499('0x50')]),_0x38f449);var _0x491777=[];var _0x7fa101=squel[_0x1499('0x51')]()[_0x1499('0x52')]('id')[_0x1499('0x52')](_0x1499('0x2d'))[_0x1499('0x52')](_0x1499('0x53'))['from'](_0x1499('0x54'));var _0x4c81db=squel[_0x1499('0x51')]()[_0x1499('0x52')]('u.id')[_0x1499('0x52')](_0x1499('0x55'))[_0x1499('0x52')]('ui.WhatsappInteractionId')[_0x1499('0x56')](_0x1499('0x57'),'ui')[_0x1499('0x58')](_0x1499('0x59'),'u',_0x1499('0x5a'));var _0x11aafe=squel[_0x1499('0x51')]()[_0x1499('0x56')](_0x1499('0x5b'),'i')[_0x1499('0x58')]('cm_contacts','c',_0x1499('0x5c'))[_0x1499('0x58')](_0x1499('0x59'),'o','o.id\x20=\x20i.UserId')[_0x1499('0x58')](_0x1499('0x5d'),'a','a.id\x20=\x20i.WhatsappAccountId')[_0x1499('0x58')](_0x1499('0x5e'),'me','me.WhatsappInteractionId\x20=\x20i.id')[_0x1499('0x58')](_0x1499('0x5f'),'it',_0x1499('0x60'))[_0x1499('0x58')](_0x1499('0x54'),'t',_0x1499('0x61'));var _0x10450f=squel['expr']();var _0x21653a=[];var _0x2a9f23=squel[_0x1499('0x62')]();var _0x175b8d;if(_0x3b67a7['query']['search']){_0x175b8d=as[_0x1499('0x63')](_0x3b67a7[_0x1499('0x46')]['search']);var _0x3c3a20=_0x175b8d[_0x1499('0x64')];for(var _0xf09b4c=0x0;_0xf09b4c<_0x175b8d['conditions']['length'];_0xf09b4c++){var _0x5b09a5=_0x175b8d[_0x1499('0x65')][_0xf09b4c];var _0x1f39f3='i';var _0x2d1c32=_['find'](_0x38f449,[_0x1499('0x2d'),_0x5b09a5['field']]);if(!_0x2d1c32){switch(_0x5b09a5[_0x1499('0x52')]){case _0x1499('0x66'):if(_0x5b09a5[_0x1499('0x67')]==0x1){_0x11aafe[_0x1499('0x68')]('`'+_0x5b09a5['field']+'`\x20=\x200');}else{_0x11aafe['having']('`'+_0x5b09a5[_0x1499('0x52')]+_0x1499('0x69'));}break;case _0x1499('0x6a'):if(_0x5b09a5[_0x1499('0x6b')]==='$substring'){if(_0x5b09a5[_0x1499('0x67')][_0x1499('0x33')]('\x20')['length']>0x1){_0x10450f[_0x3c3a20](_0x1499('0x6c'),qs['getFullTextValue'](_0x5b09a5[_0x1499('0x67')]),null);}else{var _0x3122a7='%'+_0x5b09a5[_0x1499('0x67')]+'%';_0x10450f[_0x3c3a20]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x3122a7,_0x3122a7,_0x3122a7);}}else{_0x2d1c32=_[_0x1499('0x6d')](_0x38f449,[_0x1499('0x2d'),_0x1499('0x6e')]);_0x5b09a5['field']=_0x1499('0x6e');_0x41a528=as[_0x1499('0x6f')](_0x1f39f3,_0x2d1c32[_0x1499('0x42')],_0x5b09a5);_0x10450f[_0x3c3a20](_0x41a528['text'],_0x41a528[_0x1499('0x67')][_0x1499('0x70')],_0x41a528[_0x1499('0x67')][_0x1499('0x1d')]);}break;case _0x1499('0x71'):var _0x96a0ed=_0x5b09a5['value'][_0x1499('0x33')](',')[_0x1499('0x2f')](function(_0x4d6165){return Number(_0x4d6165);});_0x96a0ed[_0x1499('0x34')](function(_0x258555){_0x2a9f23['or'](_0x1499('0x72'),'%,'+_0x258555+',%');});_0x21653a=_[_0x1499('0x73')](_0x21653a,_0x96a0ed);break;case _0x1499('0x74'):if(_0x5b09a5[_0x1499('0x6b')]==='$substring'){_0x10450f[_0x3c3a20](_0x1499('0x75'),'%'+_0x5b09a5[_0x1499('0x67')]+'%',null);}else{_0x2d1c32=_[_0x1499('0x6d')](_0x38f449,['name',_0x1499('0x3b')]);_0x5b09a5[_0x1499('0x52')]='UserId';_0x41a528=as[_0x1499('0x6f')](_0x1f39f3,_0x2d1c32[_0x1499('0x42')],_0x5b09a5);_0x10450f[_0x3c3a20](_0x41a528[_0x1499('0x76')],_0x41a528[_0x1499('0x67')][_0x1499('0x70')],_0x41a528['value']['end']);}break;case _0x1499('0x77'):_0x41a528=as['buildExpression']('me',null,_0x5b09a5);_0x10450f[_0x3c3a20](_0x41a528['text'],_0x41a528[_0x1499('0x67')][_0x1499('0x70')],_0x41a528['value'][_0x1499('0x1d')]);break;}}else{var _0x41a528=as[_0x1499('0x6f')](_0x1f39f3,_0x2d1c32['type'],_0x5b09a5);_0x10450f[_0x3c3a20](_0x41a528['text'],_0x41a528[_0x1499('0x67')][_0x1499('0x70')],_0x41a528[_0x1499('0x67')][_0x1499('0x1d')]);}}}else{var _0x2fc244=_(_0x3b67a7['query'])[_0x1499('0x45')]()[_0x1499('0x2f')](function(_0x57bb71){return _[_0x1499('0x78')](_0x38f449,[_0x1499('0x2d'),_0x57bb71])?_0x57bb71:undefined;})[_0x1499('0x79')]()['value']();if(!_[_0x1499('0x7a')](_0x2fc244)){_0x2fc244[_0x1499('0x34')](function(_0x1ee6fe){if(_0x1ee6fe===_0x1499('0x7b')){_0x11aafe['where'](_0x1499('0x7c'),[][_0x1499('0x7d')](_0x3b67a7[_0x1499('0x46')][_0x1ee6fe]));}else if(_0x1ee6fe==='createdAt'){var _0x377ba4=JSON[_0x1499('0x7e')](_0x3b67a7[_0x1499('0x46')][_0x1ee6fe])[_0x1499('0x7f')];var _0x199516=JSON[_0x1499('0x7e')](_0x3b67a7['query'][_0x1ee6fe])[_0x1499('0x80')];_0x11aafe['where']('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x377ba4,_0x199516);}else{if(_0x3b67a7[_0x1499('0x46')][_0x1ee6fe]===_0x1499('0x81')){_0x11aafe[_0x1499('0x4f')]('i.'+_0x1ee6fe+'\x20IS\x20NULL');}else{_0x11aafe['where']('i.'+_0x1ee6fe+_0x1499('0x82'),_0x3b67a7[_0x1499('0x46')][_0x1ee6fe]);}}});}if(_0x3b67a7['query'][_0x1499('0x83')]){if(_0x3b67a7[_0x1499('0x46')][_0x1499('0x83')]==0x1){_0x11aafe[_0x1499('0x68')](_0x1499('0x84'));}else{_0x11aafe[_0x1499('0x68')](_0x1499('0x85'));}}if(_0x3b67a7['query'][_0x1499('0x86')]){_0x21653a=_[_0x1499('0x87')](_0x3b67a7['query'][_0x1499('0x86')])?_0x3b67a7['query'][_0x1499('0x86')]:new Array(_0x3b67a7[_0x1499('0x46')][_0x1499('0x86')]);_0x21653a[_0x1499('0x34')](function(_0x5e8a06){_0x2a9f23['or'](_0x1499('0x72'),'%,'+_0x5e8a06+',%');});}if(_0x3b67a7['query'][_0x1499('0x88')]){var _0x482da0=_0x3b67a7[_0x1499('0x46')][_0x1499('0x88')][_0x1499('0x89')]('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs[_0x1499('0x8a')](_0x482da0)){_0x10450f['or'](_0x1499('0x8b'),_0x482da0+'%')['or']('i.phone\x20LIKE\x20?',_0x482da0+'%');}else{_0x10450f['or']('MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x1499('0x8c')](_0x482da0))['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0x482da0+'%');}}}_0x11aafe[_0x1499('0x4f')](_0x10450f);_0x11aafe['group'](_0x1499('0x8d'));var _0x4e8798={'type':db[_0x1499('0x8e')][_0x1499('0x8f')][_0x1499('0x90')],'raw':!![]};var _0x1c8a8a=_0x11aafe[_0x1499('0x91')]();_0x1c8a8a[_0x1499('0x52')](_0x1499('0x8d'));_0x1c8a8a[_0x1499('0x52')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x1499('0x66'));if(_0x3fac62[_0x1499('0x4d')]){_0x3fac62[_0x1499('0x4d')]['forEach'](function(_0x408399){var _0x428312=_0x408399[0x0]==='contactName'?_0x408399[0x0]:'i.'+_0x408399[0x0];_0x11aafe[_0x1499('0x4d')](_0x428312,_0x408399[0x1]===_0x1499('0x92')?![]:!![]);});}if(!_[_0x1499('0x7a')](_0x21653a)){_0x11aafe[_0x1499('0x68')](_0x2a9f23);_0x1c8a8a[_0x1499('0x4f')]('t.id\x20IN\x20?',_0x21653a);}BPromise[_0x1499('0x93')]()['then'](function(){if(!_0x175b8d){if(_0x3b67a7['query'][_0x1499('0x7b')])return;_0x1c8a8a[_0x1499('0x4f')](_0x1499('0x94'));_0x11aafe[_0x1499('0x4f')](_0x1499('0x94'));return;}if(_0x3b67a7[_0x1499('0x95')][_0x1499('0x96')]!=='agent')return;return _0x3b67a7['user'][_0x1499('0x97')]({'attributes':['id'],'raw':!![]})[_0x1499('0x29')](function(_0x511c3c){if(_[_0x1499('0x7a')](_0x511c3c)){_0x1c8a8a['where'](_0x1499('0x98'));_0x11aafe['where'](_0x1499('0x98'));}else{_0x1c8a8a['where'](_0x1499('0x7c'),_['map'](_0x511c3c,'id'));_0x11aafe[_0x1499('0x4f')](_0x1499('0x7c'),_['map'](_0x511c3c,'id'));}});})[_0x1499('0x29')](function(){if(_0x3b67a7[_0x1499('0x95')]['role']===_0x1499('0x99')&&!_0x175b8d&&!_0x3b67a7[_0x1499('0x46')][_0x1499('0x7b')])return[];return db[_0x1499('0x9a')][_0x1499('0x46')](_0x1c8a8a[_0x1499('0x9b')](),_0x4e8798);})[_0x1499('0x29')](function(_0x5e95ca){_0x3770b5[_0x1499('0x22')]=_0x5e95ca[_0x1499('0x4a')];if(_0x3770b5['count']===0x0)return[];return db[_0x1499('0x9a')][_0x1499('0x46')](_0x7fa101['toString'](),_0x4e8798)[_0x1499('0x29')](function(_0x2d6a31){_0x491777=_['keyBy'](_0x2d6a31,'id');_0x4e8798=_[_0x1499('0x9c')](_0x4e8798,{'model':db[_0x1499('0x3f')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x3b67a7[_0x1499('0x46')][_0x1499('0x49')]){_0x3fac62[_0x1499('0x48')][_0x1499('0x34')](function(_0x1f4794){_0x11aafe[_0x1499('0x52')]('i.'+_0x1f4794);});}else{_0x11aafe['field'](_0x1499('0x9d'),_0x1499('0x66'));_0x11aafe[_0x1499('0x52')](_0x1499('0x9e'),_0x1499('0x9f'));_0x11aafe[_0x1499('0x52')]('a.mandatoryDisposition','Account.mandatoryDisposition');_0x11aafe['field'](_0x1499('0xa0'),_0x1499('0xa1'));_0x11aafe[_0x1499('0x52')](_0x1499('0xa2'));_0x11aafe[_0x1499('0x52')](_0x1499('0xa3'),_0x1499('0xa4'));_0x11aafe[_0x1499('0x52')]('c.lastName',_0x1499('0xa5'));_0x11aafe[_0x1499('0x52')]('c.email','Contact.email');_0x11aafe[_0x1499('0x52')]('c.phone','Contact.phone');_0x11aafe['field'](_0x1499('0xa6'),_0x1499('0xa7'));_0x11aafe[_0x1499('0x52')](_0x1499('0xa8'),_0x1499('0xa9'));_0x11aafe['field']('o.fullname',_0x1499('0xaa'));_0x11aafe[_0x1499('0x52')](_0x1499('0xab'),'Owner.internal');_0x11aafe[_0x1499('0x52')]('GROUP_CONCAT(DISTINCT\x20t.id)','TagIds');}if(_0x3fac62[_0x1499('0x20')])_0x11aafe['limit'](_0x3fac62[_0x1499('0x20')]);if(_0x3fac62['offset'])_0x11aafe[_0x1499('0x23')](_0x3fac62['offset']);return db[_0x1499('0x9a')][_0x1499('0x46')](_0x11aafe['toString'](),_0x4e8798);})[_0x1499('0x29')](function(_0x5c0452){if(_0x5c0452[_0x1499('0x4a')]>0x0)_0x4c81db[_0x1499('0x4f')](_0x1499('0xac'),_[_0x1499('0x2f')](_0x5c0452,'id'));return db[_0x1499('0x9a')][_0x1499('0x46')](_0x4c81db[_0x1499('0x9b')](),_0x4e8798)[_0x1499('0x29')](function(_0x14a97d){var _0x9d41a6=_[_0x1499('0xad')](_0x14a97d,_0x1499('0xae'));var _0x2949af=[];_0x5c0452['forEach'](function(_0x1f0fde){_0x2949af[_0x1499('0x35')](updateWhatsappInteraction(_0x1f0fde,_0x491777,_0x9d41a6));});return BPromise[_0x1499('0xaf')](_0x2949af);});});})[_0x1499('0x29')](function(_0x4f6a5e){_0x3770b5[_0x1499('0xb0')]=_0x4f6a5e;return _0x3770b5;})[_0x1499('0x29')](respondWithFilteredResult(_0x5c5835,_0x3fac62))['catch'](handleError(_0x5c5835,null));};exports['show']=function(_0x13f203,_0x1fbf21){var _0x2d4e5a={'raw':![],'where':{'id':_0x13f203[_0x1499('0xb1')]['id']}},_0x17f528={};_0x17f528[_0x1499('0x44')]=_[_0x1499('0x45')](db[_0x1499('0x3f')][_0x1499('0x40')]);_0x17f528[_0x1499('0x46')]=_['keys'](_0x13f203['query']);_0x17f528['filters']=_[_0x1499('0x47')](_0x17f528[_0x1499('0x44')],_0x17f528[_0x1499('0x46')]);_0x2d4e5a[_0x1499('0x48')]=_[_0x1499('0x47')](_0x17f528[_0x1499('0x44')],qs['fields'](_0x13f203[_0x1499('0x46')][_0x1499('0x49')]));_0x2d4e5a[_0x1499('0x48')]=_0x2d4e5a['attributes']['length']?_0x2d4e5a[_0x1499('0x48')]:_0x17f528[_0x1499('0x44')];if(_0x13f203['query']['includeAll']){_0x2d4e5a['include']=[{'all':!![]}];}_0x2d4e5a=_[_0x1499('0x9c')]({},_0x2d4e5a,_0x13f203[_0x1499('0xb2')]);return db['WhatsappInteraction'][_0x1499('0x6d')](_0x2d4e5a)[_0x1499('0x29')](handleEntityNotFound(_0x1fbf21,null))[_0x1499('0x29')](respondWithResult(_0x1fbf21,null))[_0x1499('0x36')](handleError(_0x1fbf21,null));};exports[_0x1499('0xb3')]=function(_0x512cb6,_0x4f9bb1){return db['WhatsappInteraction']['create'](_0x512cb6[_0x1499('0x77')],{})[_0x1499('0x29')](respondWithResult(_0x4f9bb1,0xc9))[_0x1499('0x36')](handleError(_0x4f9bb1,null));};exports['update']=function(_0x50b927,_0x479936){if(_0x50b927[_0x1499('0x77')]['id']){delete _0x50b927[_0x1499('0x77')]['id'];}return db[_0x1499('0x3f')][_0x1499('0x6d')]({'where':{'id':_0x50b927[_0x1499('0xb1')]['id']}})[_0x1499('0x29')](handleEntityNotFound(_0x479936,null))[_0x1499('0x29')](saveUpdates(_0x50b927[_0x1499('0x77')],null))[_0x1499('0x29')](respondWithResult(_0x479936,null))['catch'](handleError(_0x479936,null));};exports[_0x1499('0x2a')]=function(_0x4d896d,_0x358ee6){return db[_0x1499('0x3f')][_0x1499('0x6d')]({'where':{'id':_0x4d896d[_0x1499('0xb1')]['id']}})[_0x1499('0x29')](handleEntityNotFound(_0x358ee6,null))[_0x1499('0x29')](removeEntity(_0x358ee6,null))[_0x1499('0x36')](handleError(_0x358ee6,null));};exports['describe']=function(_0x56507a,_0x32ec2e){return db[_0x1499('0x3f')]['describe']()[_0x1499('0x29')](respondWithResult(_0x32ec2e,null))[_0x1499('0x36')](handleError(_0x32ec2e,null));};exports[_0x1499('0xb4')]=function(_0x56fb96,_0x4fffd3,_0xa0e494){return db['WhatsappMessage'][_0x1499('0x6d')]({'where':{'id':_0x56fb96[_0x1499('0xb1')]['id']}})[_0x1499('0x29')](handleEntityNotFound(_0x4fffd3,null))['then'](function(_0x583666){if(_0x583666){return _0x583666['addMessage'](_0x56fb96[_0x1499('0x77')][_0x1499('0xb5')],_['omit'](_0x56fb96[_0x1499('0x77')],['ids','id'])||{});}})['then'](respondWithResult(_0x4fffd3,null))[_0x1499('0x36')](handleError(_0x4fffd3,null));};exports['getMessages']=function(_0x580222,_0x52de11,_0x2e39ac){var _0x4a9e81={'raw':![],'where':{}};var _0x316881={};var _0x1897af={'count':0x0,'rows':[]};return db[_0x1499('0x3f')][_0x1499('0xb6')]({'where':{'id':_0x580222[_0x1499('0xb1')]['id']}})['then'](handleEntityNotFound(_0x52de11,null))[_0x1499('0x29')](function(_0x6fca53){if(_0x6fca53){_0x316881[_0x1499('0x44')]=_['keys'](db[_0x1499('0xb7')][_0x1499('0x40')]);_0x316881[_0x1499('0x46')]=_[_0x1499('0x45')](_0x580222[_0x1499('0x46')]);_0x316881[_0x1499('0x50')]=_[_0x1499('0x47')](_0x316881[_0x1499('0x44')],_0x316881['query']);_0x4a9e81[_0x1499('0x48')]=_[_0x1499('0x47')](_0x316881[_0x1499('0x44')],qs['fields'](_0x580222[_0x1499('0x46')][_0x1499('0x49')]));_0x4a9e81[_0x1499('0x48')]=_0x4a9e81[_0x1499('0x48')][_0x1499('0x4a')]?_0x4a9e81[_0x1499('0x48')]:_0x316881['model'];if(!_0x580222[_0x1499('0x46')][_0x1499('0x4b')]('nolimit')){_0x4a9e81[_0x1499('0x20')]=qs[_0x1499('0x20')](_0x580222[_0x1499('0x46')]['limit']);_0x4a9e81['offset']=qs[_0x1499('0x23')](_0x580222[_0x1499('0x46')][_0x1499('0x23')]);}_0x4a9e81[_0x1499('0x4d')]=qs[_0x1499('0x4e')](_0x580222[_0x1499('0x46')][_0x1499('0x4e')]);_0x4a9e81[_0x1499('0x4f')]=qs['filters'](_['pick'](_0x580222['query'],_0x316881[_0x1499('0x50')]));_0x4a9e81[_0x1499('0x4f')]['WhatsappInteractionId']=_0x6fca53['id'];if(_0x580222[_0x1499('0x46')]['filter']){_0x4a9e81[_0x1499('0x4f')]=_[_0x1499('0x9c')](_0x4a9e81['where'],{'$or':_[_0x1499('0x2f')](_0x4a9e81[_0x1499('0x48')],function(_0xf9e791){var _0x4e3bf3={};_0x4e3bf3[_0xf9e791]={'$like':'%'+_0x580222[_0x1499('0x46')][_0x1499('0x88')]+'%'};return _0x4e3bf3;})});}if(_0x580222[_0x1499('0x46')][_0x1499('0x7f')]){var _0x3da005=_0x580222[_0x1499('0x46')][_0x1499('0x7f')][_0x1499('0x33')](',');var _0x22d5f5={};_0x22d5f5[_0x3da005[0x0]]={'$gte':moment(_0x3da005[0x1])[_0x1499('0xb8')](_0x1499('0xb9'))};_0x4a9e81[_0x1499('0x4f')]=_[_0x1499('0x9c')](_0x4a9e81[_0x1499('0x4f')],_0x22d5f5);}_0x4a9e81=_[_0x1499('0x9c')]({},_0x4a9e81,_0x580222[_0x1499('0xb2')]);return db['WhatsappMessage'][_0x1499('0x22')]({'where':_0x4a9e81[_0x1499('0x4f')]})[_0x1499('0x29')](function(_0x9c2620){_0x1897af[_0x1499('0x22')]=_0x9c2620;if(_0x580222[_0x1499('0x46')][_0x1499('0xba')]){_0x4a9e81[_0x1499('0xbb')]=[{'all':!![]}];}return db[_0x1499('0xb7')][_0x1499('0xbc')](_0x4a9e81);})[_0x1499('0x29')](function(_0xc13b1b){_0x1897af[_0x1499('0xb0')]=_0xc13b1b;return _0x1897af;});}})['then'](respondWithFilteredResult(_0x52de11,_0x4a9e81))[_0x1499('0x36')](handleError(_0x52de11,null));};exports[_0x1499('0xbd')]=function(_0x88b620,_0x4f9f1a,_0x3ad0bf){return db[_0x1499('0x3f')][_0x1499('0x6d')]({'where':{'id':_0x88b620[_0x1499('0xb1')]['id']}})[_0x1499('0x29')](handleEntityNotFound(_0x4f9f1a,null))[_0x1499('0x29')](function(_0x753435){if(_0x753435){return _0x753435[_0x1499('0xbe')](_0x88b620['body'][_0x1499('0xb5')],_['omit'](_0x88b620[_0x1499('0x77')],[_0x1499('0xb5'),'id'])||{})[_0x1499('0xbf')](function(){return db[_0x1499('0x71')]['findAll']({'attributes':['id',_0x1499('0x2d'),_0x1499('0x53')],'where':{'id':_0x88b620['body'][_0x1499('0xb5')]}});})['then'](function(_0x4e3f4d){socket[_0x1499('0xc0')](_0x1499('0xc1'),{'id':Number(_0x88b620[_0x1499('0xb1')]['id']),'tags':_0x4e3f4d||[]});return{'id':Number(_0x88b620[_0x1499('0xb1')]['id']),'tags':_0x4e3f4d||[]};});}})['then'](respondWithResult(_0x4f9f1a,null))[_0x1499('0x36')](handleError(_0x4f9f1a,null));};exports[_0x1499('0xc2')]=function(_0x2e00ae,_0x821029,_0x39a45b){return db[_0x1499('0x3f')][_0x1499('0x6d')]({'where':{'id':_0x2e00ae[_0x1499('0xb1')]['id']}})['then'](handleEntityNotFound(_0x821029,null))[_0x1499('0x29')](function(_0x3bc903){if(_0x3bc903){return _0x3bc903['removeTags'](_0x2e00ae['query'][_0x1499('0xb5')]);}})[_0x1499('0x29')](respondWithStatusCode(_0x821029,null))[_0x1499('0x36')](handleError(_0x821029,null));};exports[_0x1499('0xc3')]=function(_0x27e3d5,_0x3bf326){var _0xd77467=moment()[_0x1499('0xc4')]()[_0x1499('0x9b')]();var _0xea4c8f=path[_0x1499('0xc5')](config[_0x1499('0xc6')],_0x1499('0xc7'),_0x1499('0xc8'),_0x1499('0xc9'));var _0x5c4e09=path[_0x1499('0xc5')](config[_0x1499('0xc6')],_0x1499('0xc7'),_0x1499('0xc8'),'attachments');var _0x55737a=path[_0x1499('0xc5')](_0xea4c8f,_0xd77467);var _0x50dd3d=util[_0x1499('0xb8')](_0x1499('0xca'),_0x27e3d5[_0x1499('0xb1')]['id'],_0xd77467);var _0x3a7a82=path[_0x1499('0xc5')](_0xea4c8f,_0x50dd3d);var _0x54195f=[];_0x54195f[_0x1499('0x35')]({'model':db['User'],'as':_0x1499('0x74'),'attributes':['id',_0x1499('0x30')],'raw':!![]});_0x54195f['push']({'model':db[_0x1499('0xcb')],'as':_0x1499('0x6a'),'attributes':['id',_0x1499('0xcc'),'lastName'],'raw':!![]});if(_0x27e3d5[_0x1499('0x46')][_0x1499('0xcd')]){_0x54195f['push']({'model':db[_0x1499('0xce')],'as':_0x1499('0xce'),'raw':!![]});}var _0x37fe53=[{'model':db['WhatsappMessage'],'as':_0x1499('0xcf'),'attributes':['id','body','createdAt','direction',_0x1499('0xd0'),_0x1499('0x83')],'include':_0x54195f}];_0x37fe53[_0x1499('0x35')]({'model':db[_0x1499('0xd1')],'as':_0x1499('0xd2'),'attributes':['id','name']});_0x37fe53[_0x1499('0x35')]({'model':db[_0x1499('0x74')],'as':_0x1499('0xd3'),'attributes':['id','fullname']});return db[_0x1499('0x3f')]['find']({'where':{'id':_0x27e3d5[_0x1499('0xb1')]['id']},'include':_0x37fe53})[_0x1499('0x29')](handleEntityNotFound(_0x3bf326,null))['then'](function(_0x423490){if(_0x423490){var _0x5d5def=_0x423490[_0x1499('0xd4')]({'plain':!![]});fs[_0x1499('0xd5')](_0x55737a);var _0x2f201e={'channel':'Whatsapp','account':_0x5d5def['Account'][_0x1499('0x2d')],'agent':_0x5d5def['Owner']?_0x5d5def[_0x1499('0xd3')][_0x1499('0x30')]:'N.A.','createdAt':moment(_0x5d5def[_0x1499('0xd6')])[_0x1499('0xb8')](_0x1499('0xb9'))[_0x1499('0x9b')](),'closedAt':_0x5d5def['closed']?moment(_0x5d5def[_0x1499('0xd7')])[_0x1499('0xb8')](_0x1499('0xb9'))[_0x1499('0x9b')]():'','disposition':_0x5d5def[_0x1499('0xd8')],'messages':_(_0x5d5def[_0x1499('0xcf')])[_0x1499('0x88')]({'secret':![]})[_0x1499('0x2f')](function(_0x4f23f3){if(_0x4f23f3[_0x1499('0xce')]){var _0x1575f8=path[_0x1499('0xc5')](_0x5c4e09,_0x4f23f3['Attachment'][_0x1499('0xd9')]);if(fs[_0x1499('0xda')](_0x1575f8)){fs[_0x1499('0xdb')](_0x1575f8)[_0x1499('0xdc')](fs[_0x1499('0xdd')](path['join'](_0x55737a,_0x4f23f3['Attachment'][_0x1499('0xd9')])));}}return{'date':moment(_0x4f23f3[_0x1499('0xd6')])['format']('YYYY-MM-DD\x20HH:mm:ss')[_0x1499('0x9b')](),'sender':_0x4f23f3['direction']===_0x1499('0xde')?_0x4f23f3[_0x1499('0x74')]?_0x4f23f3[_0x1499('0x74')][_0x1499('0x30')]:_0x1499('0xdf'):_0x4f23f3['Contact'][_0x1499('0xcc')]+(_0x4f23f3['Contact'][_0x1499('0xe0')]?'\x20'+_0x4f23f3[_0x1499('0x6a')][_0x1499('0xe0')]:''),'body':_0x4f23f3['Attachment']?_0x4f23f3[_0x1499('0xce')][_0x1499('0xd9')]:_0x4f23f3['body'],'direction':_0x4f23f3[_0x1499('0xe1')]==='out'?'A':'C','secret':_0x4f23f3[_0x1499('0xd0')],'read':_0x4f23f3[_0x1499('0x83')],'attachment':_0x4f23f3[_0x1499('0xce')]};})[_0x1499('0x67')]()};return ejs['renderFile'](path[_0x1499('0xc5')](config[_0x1499('0xc6')],'server',_0x1499('0xe2'),_0x1499('0xe3')),{'interaction':_0x2f201e})['then'](function(_0x4a2873){var _0x122242=path['join'](_0x55737a,_0x1499('0xe4')+_0x5d5def['id']+'-'+_0xd77467+'.pdf');var _0xffc748={'path':_0x122242,'channel':_0x1499('0xe5'),'interactionId':_0x5d5def['id']};return pdf[_0x1499('0xe6')](_0x4a2873,_0xffc748);})[_0x1499('0x29')](function(){return new BPromise(function(_0x158c0b,_0x148a4b){zipdir(_0x55737a,{'saveTo':_0x3a7a82},function(_0x1216d7,_0xb99a7a){if(_0x1216d7)return _0x148a4b(_0x1216d7);return _0x158c0b(_0xb99a7a);});})[_0x1499('0x29')](function(){return new BPromise(function(_0x454f48,_0x4e6c88){rimraf(_0x55737a,function(_0x1e793c){if(_0x1e793c)_0x4e6c88(_0x1e793c);return _0x454f48();});});})['then'](function(){return _0x3bf326[_0x1499('0xc3')](_0x3a7a82,_0x50dd3d,function(_0x2237f3){if(_0x2237f3){console[_0x1499('0xe7')](_0x1499('0xe8'),_0x2237f3);}else{fs[_0x1499('0xe9')](_0x3a7a82);}});});});}else{return _0x3bf326['sendStatus'](0xc8);}})[_0x1499('0x36')](handleError(_0x3bf326,null));}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.events.js b/server/api/whatsappInteraction/whatsappInteraction.events.js index 97003b2..948ced1 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 _0xf12a=['WhatsappInteraction','WhatsappMessage','setMaxListeners','save','getUsers','setDataValue','Users','map','findAll','then','unreadMessages','emit','catch','exports','events','../../mysqldb'];(function(_0x169f86,_0xadf81f){var _0x30cced=function(_0x84611b){while(--_0x84611b){_0x169f86['push'](_0x169f86['shift']());}};_0x30cced(++_0xadf81f);}(_0xf12a,0x8e));var _0xaf12=function(_0x158a01,_0x50bcb8){_0x158a01=_0x158a01-0x0;var _0x94b215=_0xf12a[_0x158a01];return _0x94b215;};'use strict';var EventEmitter=require(_0xaf12('0x0'));var WhatsappInteraction=require(_0xaf12('0x1'))['db'][_0xaf12('0x2')];var WhatsappMessage=require(_0xaf12('0x1'))['db'][_0xaf12('0x3')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0xaf12('0x4')](0x0);var events={'afterCreate':_0xaf12('0x5'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x1b1d82){return function(_0x57c2a5,_0x41cea2,_0x581be3){_0x57c2a5[_0xaf12('0x6')]({'attributes':['id'],'raw':!![]})['then'](function(_0x38389d){_0x57c2a5[_0xaf12('0x7')](_0xaf12('0x8'),_0x38389d[_0xaf12('0x9')](function(_0x16e152){return{'id':_0x16e152['id']};}));return WhatsappMessage[_0xaf12('0xa')]({'where':{'WhatsappInteractionId':_0x57c2a5['id'],'direction':'in','read':![]},'raw':!![]});})[_0xaf12('0xb')](function(_0x267cb7){_0x57c2a5['setDataValue'](_0xaf12('0xc'),_0x267cb7['length']);WhatsappInteractionEvents[_0xaf12('0xd')](_0x1b1d82+':'+_0x57c2a5['id'],_0x57c2a5);WhatsappInteractionEvents['emit'](_0x1b1d82,_0x57c2a5);_0x581be3(null);})[_0xaf12('0xe')](_0x581be3(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappInteraction['hook'](e,emitEvent(event));}}module[_0xaf12('0xf')]=WhatsappInteractionEvents; \ No newline at end of file +var _0x24e9=['events','WhatsappInteraction','../../mysqldb','WhatsappMessage','setMaxListeners','save','update','remove','getUsers','then','map','findAll','setDataValue','unreadMessages','emit','catch','hasOwnProperty','hook','exports'];(function(_0x71e0db,_0x5ca642){var _0x15ba8b=function(_0x196c2f){while(--_0x196c2f){_0x71e0db['push'](_0x71e0db['shift']());}};_0x15ba8b(++_0x5ca642);}(_0x24e9,0x85));var _0x924e=function(_0x1992f1,_0x5c61f0){_0x1992f1=_0x1992f1-0x0;var _0x413dfe=_0x24e9[_0x1992f1];return _0x413dfe;};'use strict';var EventEmitter=require(_0x924e('0x0'));var WhatsappInteraction=require('../../mysqldb')['db'][_0x924e('0x1')];var WhatsappMessage=require(_0x924e('0x2'))['db'][_0x924e('0x3')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0x924e('0x4')](0x0);var events={'afterCreate':_0x924e('0x5'),'afterUpdate':_0x924e('0x6'),'afterDestroy':_0x924e('0x7')};function emitEvent(_0x1564ff){return function(_0x4ecdb9,_0x18346f,_0x31f0c3){_0x4ecdb9[_0x924e('0x8')]({'attributes':['id'],'raw':!![]})[_0x924e('0x9')](function(_0xdcafe0){_0x4ecdb9['setDataValue']('Users',_0xdcafe0[_0x924e('0xa')](function(_0x1604a8){return{'id':_0x1604a8['id']};}));return WhatsappMessage[_0x924e('0xb')]({'where':{'WhatsappInteractionId':_0x4ecdb9['id'],'direction':'in','read':![]},'raw':!![]});})[_0x924e('0x9')](function(_0x576c1c){_0x4ecdb9[_0x924e('0xc')](_0x924e('0xd'),_0x576c1c['length']);WhatsappInteractionEvents[_0x924e('0xe')](_0x1564ff+':'+_0x4ecdb9['id'],_0x4ecdb9);WhatsappInteractionEvents['emit'](_0x1564ff,_0x4ecdb9);_0x31f0c3(null);})[_0x924e('0xf')](_0x31f0c3(null));};}for(var e in events){if(events[_0x924e('0x10')](e)){var event=events[e];WhatsappInteraction[_0x924e('0x11')](e,emitEvent(event));}}module[_0x924e('0x12')]=WhatsappInteractionEvents; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.model.js b/server/api/whatsappInteraction/whatsappInteraction.model.js index f99c8a4..f724f43 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 _0xf365=['path','rimraf','../../config/environment','define','WhatsappInteraction','whatsapp_interactions','changed','closed','closedAt','YYYY-MM-DD\x20HH:mm:ss','lodash','api','bluebird','request-promise'];(function(_0x386525,_0xefae6){var _0x14d015=function(_0x4a45c1){while(--_0x4a45c1){_0x386525['push'](_0x386525['shift']());}};_0x14d015(++_0xefae6);}(_0xf365,0x1a0));var _0x5f36=function(_0x180391,_0x55d9ff){_0x180391=_0x180391-0x0;var _0x4ded40=_0xf365[_0x180391];return _0x4ded40;};'use strict';var _=require(_0x5f36('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x5f36('0x1'));var moment=require('moment');var BPromise=require(_0x5f36('0x2'));var rp=require(_0x5f36('0x3'));var fs=require('fs');var path=require(_0x5f36('0x4'));var rimraf=require(_0x5f36('0x5'));var config=require(_0x5f36('0x6'));var attributes=require('./whatsappInteraction.attributes');module['exports']=function(_0xe0f49e,_0x29bf2d){return _0xe0f49e[_0x5f36('0x7')](_0x5f36('0x8'),attributes,{'tableName':_0x5f36('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x5a698e,_0x3c1776,_0x43d67e){if(_0x5a698e[_0x5f36('0xa')](_0x5f36('0xb'))){_0x5a698e[_0x5f36('0xc')]=moment()['format'](_0x5f36('0xd'));}_0x43d67e(null,_0x5a698e);}}});}; \ No newline at end of file +var _0x8742=['./whatsappInteraction.attributes','exports','WhatsappInteraction','whatsapp_interactions','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','moment','path','rimraf','../../config/environment'];(function(_0x4a56a6,_0x5b81b2){var _0x4b7217=function(_0x19e522){while(--_0x19e522){_0x4a56a6['push'](_0x4a56a6['shift']());}};_0x4b7217(++_0x5b81b2);}(_0x8742,0xe9));var _0x2874=function(_0x415273,_0x2034a3){_0x415273=_0x415273-0x0;var _0x1eba2c=_0x8742[_0x415273];return _0x1eba2c;};'use strict';var _=require(_0x2874('0x0'));var util=require(_0x2874('0x1'));var logger=require(_0x2874('0x2'))('api');var moment=require(_0x2874('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x2874('0x4'));var rimraf=require(_0x2874('0x5'));var config=require(_0x2874('0x6'));var attributes=require(_0x2874('0x7'));module[_0x2874('0x8')]=function(_0x28fdb7,_0xb3ba8){return _0x28fdb7['define'](_0x2874('0x9'),attributes,{'tableName':_0x2874('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x56730c,_0x317517,_0x23f55b){if(_0x56730c[_0x2874('0xb')](_0x2874('0xc'))){_0x56730c[_0x2874('0xd')]=moment()[_0x2874('0xe')](_0x2874('0xf'));}_0x23f55b(null,_0x56730c);}}});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.rpc.js b/server/api/whatsappInteraction/whatsappInteraction.rpc.js index c36fdf7..3cff768 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 _0xbed4=['defaults','redis','socket.io-emitter','register','request','then','info','WhatsappInteraction,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','UpdateWhatsappInteraction','WhatsappInteraction','body','raw','options','attributes','debug','catch','AddTagsToWhatsappInteraction','addTags','omit','ids','AddTags','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http'];(function(_0x576266,_0x4002b0){var _0x18234f=function(_0x4e9ad5){while(--_0x4e9ad5){_0x576266['push'](_0x576266['shift']());}};_0x18234f(++_0x4002b0);}(_0xbed4,0x1d6));var _0x4bed=function(_0x1d8d28,_0x4b7740){_0x1d8d28=_0x1d8d28-0x0;var _0x8d05d6=_0xbed4[_0x1d8d28];return _0x8d05d6;};'use strict';var _=require('lodash');var util=require(_0x4bed('0x0'));var moment=require('moment');var BPromise=require(_0x4bed('0x1'));var rs=require(_0x4bed('0x2'));var fs=require('fs');var Redis=require(_0x4bed('0x3'));var db=require(_0x4bed('0x4'))['db'];var utils=require(_0x4bed('0x5'));var logger=require(_0x4bed('0x6'))('rpc');var config=require(_0x4bed('0x7'));var jayson=require(_0x4bed('0x8'));var client=jayson[_0x4bed('0x9')][_0x4bed('0xa')]({'port':0x232a});config['redis']=_[_0x4bed('0xb')](config[_0x4bed('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x4bed('0xd'))(new Redis(config[_0x4bed('0xc')]));require('./whatsappInteraction.socket')[_0x4bed('0xe')](socket);function respondWithRpcPromise(_0x1a8ff3,_0x664110,_0x19340c){return new BPromise(function(_0x52116c,_0x56af45){return client[_0x4bed('0xf')](_0x1a8ff3,_0x19340c)[_0x4bed('0x10')](function(_0x3f62c5){logger[_0x4bed('0x11')](_0x4bed('0x12'),_0x664110,'request\x20sent');logger['debug']('WhatsappInteraction,\x20%s,\x20%s,\x20%s',_0x664110,_0x4bed('0x13'),JSON[_0x4bed('0x14')](_0x3f62c5));if(_0x3f62c5[_0x4bed('0x15')]){if(_0x3f62c5['error'][_0x4bed('0x16')]===0x1f4){logger[_0x4bed('0x15')]('WhatsappInteraction,\x20%s,\x20%s',_0x664110,_0x3f62c5[_0x4bed('0x15')][_0x4bed('0x17')]);return _0x56af45(_0x3f62c5[_0x4bed('0x15')]['message']);}logger['error'](_0x4bed('0x12'),_0x664110,_0x3f62c5[_0x4bed('0x15')][_0x4bed('0x17')]);return _0x52116c(_0x3f62c5['error'][_0x4bed('0x17')]);}else{logger[_0x4bed('0x11')](_0x4bed('0x12'),_0x664110,_0x4bed('0x13'));_0x52116c(_0x3f62c5['result']['message']);}})['catch'](function(_0x21dbd0){logger[_0x4bed('0x15')](_0x4bed('0x12'),_0x664110,_0x21dbd0);_0x56af45(_0x21dbd0);});});}exports[_0x4bed('0x18')]=function(_0x5046ed){var _0x96c627=this;return new Promise(function(_0x2f0166,_0x558998){return db[_0x4bed('0x19')]['update'](_0x5046ed[_0x4bed('0x1a')],{'raw':_0x5046ed['options']?_0x5046ed['options'][_0x4bed('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5046ed[_0x4bed('0x1c')]?_0x5046ed[_0x4bed('0x1c')]['where']||null:null,'attributes':_0x5046ed['options']?_0x5046ed[_0x4bed('0x1c')][_0x4bed('0x1d')]||null:null,'limit':_0x5046ed[_0x4bed('0x1c')]?_0x5046ed[_0x4bed('0x1c')]['limit']||null:null})[_0x4bed('0x10')](function(_0x2e4ccf){logger[_0x4bed('0x11')]('UpdateWhatsappInteraction',_0x5046ed);logger[_0x4bed('0x1e')](_0x4bed('0x18'),_0x5046ed,JSON[_0x4bed('0x14')](_0x2e4ccf));_0x2f0166(_0x2e4ccf);})[_0x4bed('0x1f')](function(_0x34ee4c){logger['error']('UpdateWhatsappInteraction',_0x34ee4c[_0x4bed('0x17')],_0x5046ed);_0x558998(_0x96c627['error'](0x1f4,_0x34ee4c[_0x4bed('0x17')]));});});};exports[_0x4bed('0x20')]=function(_0x219f16){return new Promise(function(_0x109454,_0x4f3a98){return db[_0x4bed('0x19')]['find']({'where':_0x219f16[_0x4bed('0x1c')]?_0x219f16['options']['where']||null:null})[_0x4bed('0x10')](function(_0x4083aa){if(_0x4083aa){return _0x4083aa[_0x4bed('0x21')](_0x219f16[_0x4bed('0x1a')]['ids'],_[_0x4bed('0x22')](_0x219f16[_0x4bed('0x1a')],[_0x4bed('0x23'),'id'])||{});}})['spread'](function(_0x3e3277){logger[_0x4bed('0x11')](_0x4bed('0x24'),_0x219f16);logger[_0x4bed('0x1e')]('AddTags',_0x219f16,JSON[_0x4bed('0x14')](_0x3e3277));_0x109454(_0x3e3277);})[_0x4bed('0x1f')](function(_0x57f1fa){logger['error'](_0x4bed('0x24'),_0x57f1fa[_0x4bed('0x17')],_0x219f16);_0x4f3a98(_this[_0x4bed('0x15')](0x1f4,_0x57f1fa['message']));});});}; \ No newline at end of file +var _0xbfcf=['bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','./whatsappInteraction.socket','request','then','info','request\x20sent','debug','stringify','error','code','WhatsappInteraction,\x20%s,\x20%s','message','catch','UpdateWhatsappInteraction','WhatsappInteraction','update','options','where','limit','AddTagsToWhatsappInteraction','find','body','ids','omit','AddTags','lodash','util','moment'];(function(_0x4692a1,_0x41f54f){var _0x128700=function(_0x2661dc){while(--_0x2661dc){_0x4692a1['push'](_0x4692a1['shift']());}};_0x128700(++_0x41f54f);}(_0xbfcf,0x15c));var _0xfbfc=function(_0x297c55,_0x34fa75){_0x297c55=_0x297c55-0x0;var _0x120389=_0xbfcf[_0x297c55];return _0x120389;};'use strict';var _=require(_0xfbfc('0x0'));var util=require(_0xfbfc('0x1'));var moment=require(_0xfbfc('0x2'));var BPromise=require(_0xfbfc('0x3'));var rs=require(_0xfbfc('0x4'));var fs=require('fs');var Redis=require(_0xfbfc('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xfbfc('0x6'));var logger=require(_0xfbfc('0x7'))(_0xfbfc('0x8'));var config=require(_0xfbfc('0x9'));var jayson=require(_0xfbfc('0xa'));var client=jayson[_0xfbfc('0xb')][_0xfbfc('0xc')]({'port':0x232a});config['redis']=_[_0xfbfc('0xd')](config[_0xfbfc('0xe')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xfbfc('0xe')]));require(_0xfbfc('0xf'))['register'](socket);function respondWithRpcPromise(_0x20d7f9,_0x3a951e,_0xf8cd20){return new BPromise(function(_0x14a66a,_0x5d43e1){return client[_0xfbfc('0x10')](_0x20d7f9,_0xf8cd20)[_0xfbfc('0x11')](function(_0x1133a9){logger[_0xfbfc('0x12')]('WhatsappInteraction,\x20%s,\x20%s',_0x3a951e,_0xfbfc('0x13'));logger[_0xfbfc('0x14')]('WhatsappInteraction,\x20%s,\x20%s,\x20%s',_0x3a951e,'request\x20sent',JSON[_0xfbfc('0x15')](_0x1133a9));if(_0x1133a9[_0xfbfc('0x16')]){if(_0x1133a9['error'][_0xfbfc('0x17')]===0x1f4){logger[_0xfbfc('0x16')](_0xfbfc('0x18'),_0x3a951e,_0x1133a9['error']['message']);return _0x5d43e1(_0x1133a9[_0xfbfc('0x16')]['message']);}logger['error'](_0xfbfc('0x18'),_0x3a951e,_0x1133a9[_0xfbfc('0x16')][_0xfbfc('0x19')]);return _0x14a66a(_0x1133a9[_0xfbfc('0x16')][_0xfbfc('0x19')]);}else{logger['info']('WhatsappInteraction,\x20%s,\x20%s',_0x3a951e,_0xfbfc('0x13'));_0x14a66a(_0x1133a9['result']['message']);}})[_0xfbfc('0x1a')](function(_0x848276){logger[_0xfbfc('0x16')](_0xfbfc('0x18'),_0x3a951e,_0x848276);_0x5d43e1(_0x848276);});});}exports[_0xfbfc('0x1b')]=function(_0x24b946){var _0x249585=this;return new Promise(function(_0x111d64,_0x493024){return db[_0xfbfc('0x1c')][_0xfbfc('0x1d')](_0x24b946['body'],{'raw':_0x24b946['options']?_0x24b946[_0xfbfc('0x1e')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x24b946['options']?_0x24b946[_0xfbfc('0x1e')][_0xfbfc('0x1f')]||null:null,'attributes':_0x24b946[_0xfbfc('0x1e')]?_0x24b946[_0xfbfc('0x1e')]['attributes']||null:null,'limit':_0x24b946['options']?_0x24b946[_0xfbfc('0x1e')][_0xfbfc('0x20')]||null:null})[_0xfbfc('0x11')](function(_0x317545){logger[_0xfbfc('0x12')](_0xfbfc('0x1b'),_0x24b946);logger['debug']('UpdateWhatsappInteraction',_0x24b946,JSON[_0xfbfc('0x15')](_0x317545));_0x111d64(_0x317545);})[_0xfbfc('0x1a')](function(_0x51b327){logger[_0xfbfc('0x16')]('UpdateWhatsappInteraction',_0x51b327[_0xfbfc('0x19')],_0x24b946);_0x493024(_0x249585[_0xfbfc('0x16')](0x1f4,_0x51b327['message']));});});};exports[_0xfbfc('0x21')]=function(_0x3edbf8){return new Promise(function(_0xc77d14,_0xb30ef1){return db[_0xfbfc('0x1c')][_0xfbfc('0x22')]({'where':_0x3edbf8['options']?_0x3edbf8['options'][_0xfbfc('0x1f')]||null:null})[_0xfbfc('0x11')](function(_0x5f02cc){if(_0x5f02cc){return _0x5f02cc['addTags'](_0x3edbf8[_0xfbfc('0x23')][_0xfbfc('0x24')],_[_0xfbfc('0x25')](_0x3edbf8[_0xfbfc('0x23')],[_0xfbfc('0x24'),'id'])||{});}})['spread'](function(_0x17ed4e){logger[_0xfbfc('0x12')](_0xfbfc('0x26'),_0x3edbf8);logger[_0xfbfc('0x14')]('AddTags',_0x3edbf8,JSON['stringify'](_0x17ed4e));_0xc77d14(_0x17ed4e);})['catch'](function(_0x5dd69d){logger[_0xfbfc('0x16')](_0xfbfc('0x26'),_0x5dd69d[_0xfbfc('0x19')],_0x3edbf8);_0xb30ef1(_this['error'](0x1f4,_0x5dd69d['message']));});});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.socket.js b/server/api/whatsappInteraction/whatsappInteraction.socket.js index a118287..332b41d 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 _0x0a54=['register','length','./whatsappInteraction.events','save','remove','update','emit','removeListener'];(function(_0x1c5e7c,_0x3ae11f){var _0x5bcdbf=function(_0x557858){while(--_0x557858){_0x1c5e7c['push'](_0x1c5e7c['shift']());}};_0x5bcdbf(++_0x3ae11f);}(_0x0a54,0x9a));var _0x40a5=function(_0x1b51ea,_0x394fd9){_0x1b51ea=_0x1b51ea-0x0;var _0x18bbdc=_0x0a54[_0x1b51ea];return _0x18bbdc;};'use strict';var WhatsappInteractionEvents=require(_0x40a5('0x0'));var events=[_0x40a5('0x1'),_0x40a5('0x2'),_0x40a5('0x3')];function createListener(_0x37c17d,_0x30b484){return function(_0x5a82ca){_0x30b484[_0x40a5('0x4')](_0x37c17d,_0x5a82ca);};}function removeListener(_0x59bb2c,_0x114e8f){return function(){WhatsappInteractionEvents[_0x40a5('0x5')](_0x59bb2c,_0x114e8f);};}exports[_0x40a5('0x6')]=function(_0xa933f6){for(var _0x448b30=0x0,_0x2f0ca5=events[_0x40a5('0x7')];_0x448b30<_0x2f0ca5;_0x448b30++){var _0x1b2251=events[_0x448b30];var _0x3ba29d=createListener('whatsappInteraction:'+_0x1b2251,_0xa933f6);WhatsappInteractionEvents['on'](_0x1b2251,_0x3ba29d);}}; \ No newline at end of file +var _0x59e7=['register','length','whatsappInteraction:','./whatsappInteraction.events','remove','update','emit','removeListener'];(function(_0x1233d2,_0x5416f4){var _0x22759e=function(_0xb516aa){while(--_0xb516aa){_0x1233d2['push'](_0x1233d2['shift']());}};_0x22759e(++_0x5416f4);}(_0x59e7,0xab));var _0x759e=function(_0x71ac01,_0x4d0e8b){_0x71ac01=_0x71ac01-0x0;var _0xab725d=_0x59e7[_0x71ac01];return _0xab725d;};'use strict';var WhatsappInteractionEvents=require(_0x759e('0x0'));var events=['save',_0x759e('0x1'),_0x759e('0x2')];function createListener(_0x4e7062,_0x5055a4){return function(_0x3bec9b){_0x5055a4[_0x759e('0x3')](_0x4e7062,_0x3bec9b);};}function removeListener(_0xf88253,_0x47595d){return function(){WhatsappInteractionEvents[_0x759e('0x4')](_0xf88253,_0x47595d);};}exports[_0x759e('0x5')]=function(_0x1dd9e7){for(var _0x98aa81=0x0,_0x1fd2ea=events[_0x759e('0x6')];_0x98aa81<_0x1fd2ea;_0x98aa81++){var _0x1d022a=events[_0x98aa81];var _0xd9074=createListener(_0x759e('0x7')+_0x1d022a,_0x1dd9e7);WhatsappInteractionEvents['on'](_0x1d022a,_0xd9074);}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/index.js b/server/api/whatsappMessage/index.js index d35ebea..90e24cb 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 _0xe929=['get','isAuthenticated','index','describe','/:id','show','post','tracked','whatsapp','whatsappmessage:create','put','/:id/accept','accept','/:id/reject','reject','destroy','exports','util','connect-timeout','fs-extra','../../components/interaction/service','./whatsappMessage.controller'];(function(_0x47330e,_0x36c364){var _0x2d82f4=function(_0x43c311){while(--_0x43c311){_0x47330e['push'](_0x47330e['shift']());}};_0x2d82f4(++_0x36c364);}(_0xe929,0x1c9));var _0x9e92=function(_0x3c81b5,_0x3f5ed7){_0x3c81b5=_0x3c81b5-0x0;var _0x5888c4=_0xe929[_0x3c81b5];return _0x5888c4;};'use strict';var multer=require('multer');var util=require(_0x9e92('0x0'));var path=require('path');var timeout=require(_0x9e92('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x9e92('0x2'));var auth=require('../../components/auth/service');var interaction=require(_0x9e92('0x3'));var config=require('../../config/environment');var controller=require(_0x9e92('0x4'));router[_0x9e92('0x5')]('/',auth[_0x9e92('0x6')](),controller[_0x9e92('0x7')]);router[_0x9e92('0x5')]('/describe',auth[_0x9e92('0x6')](),controller[_0x9e92('0x8')]);router[_0x9e92('0x5')](_0x9e92('0x9'),auth[_0x9e92('0x6')](),controller[_0x9e92('0xa')]);router[_0x9e92('0xb')]('/',auth[_0x9e92('0x6')](),interaction[_0x9e92('0xc')](_0x9e92('0xd'),_0x9e92('0xe')),controller['create']);router[_0x9e92('0xb')]('/:id/status',controller['status']);router[_0x9e92('0xf')](_0x9e92('0x9'),auth['isAuthenticated'](),controller['update']);router[_0x9e92('0xf')](_0x9e92('0x10'),auth['isAuthenticated'](),controller[_0x9e92('0x11')]);router[_0x9e92('0xf')](_0x9e92('0x12'),auth[_0x9e92('0x6')](),controller[_0x9e92('0x13')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x9e92('0x14')]);module[_0x9e92('0x15')]=router; \ No newline at end of file +var _0x90db=['util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','describe','/:id','show','tracked','whatsappmessage:create','post','/:id/status','put','/:id/accept','accept','/:id/reject','delete','exports','multer'];(function(_0x297eea,_0x5060be){var _0x1c42d2=function(_0x3afff4){while(--_0x3afff4){_0x297eea['push'](_0x297eea['shift']());}};_0x1c42d2(++_0x5060be);}(_0x90db,0x107));var _0xb90d=function(_0x47a7d0,_0x4e182d){_0x47a7d0=_0x47a7d0-0x0;var _0xb9bd08=_0x90db[_0x47a7d0];return _0xb9bd08;};'use strict';var multer=require(_0xb90d('0x0'));var util=require(_0xb90d('0x1'));var path=require(_0xb90d('0x2'));var timeout=require(_0xb90d('0x3'));var express=require(_0xb90d('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xb90d('0x5'));var interaction=require(_0xb90d('0x6'));var config=require(_0xb90d('0x7'));var controller=require('./whatsappMessage.controller');router['get']('/',auth[_0xb90d('0x8')](),controller[_0xb90d('0x9')]);router[_0xb90d('0xa')]('/describe',auth['isAuthenticated'](),controller[_0xb90d('0xb')]);router['get'](_0xb90d('0xc'),auth[_0xb90d('0x8')](),controller[_0xb90d('0xd')]);router['post']('/',auth[_0xb90d('0x8')](),interaction[_0xb90d('0xe')]('whatsapp',_0xb90d('0xf')),controller['create']);router[_0xb90d('0x10')](_0xb90d('0x11'),controller['status']);router[_0xb90d('0x12')](_0xb90d('0xc'),auth['isAuthenticated'](),controller['update']);router[_0xb90d('0x12')](_0xb90d('0x13'),auth[_0xb90d('0x8')](),controller[_0xb90d('0x14')]);router['put'](_0xb90d('0x15'),auth[_0xb90d('0x8')](),controller['reject']);router[_0xb90d('0x16')](_0xb90d('0xc'),auth[_0xb90d('0x8')](),controller['destroy']);module[_0xb90d('0x17')]=router; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.attributes.js b/server/api/whatsappMessage/whatsappMessage.attributes.js index 1e6e06d..fdac64c 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 _0xa4c2=['DATE','sequelize','TEXT','BOOLEAN','ENUM','STRING'];(function(_0x157ad1,_0x33f17e){var _0xdf4ef6=function(_0x506f44){while(--_0x506f44){_0x157ad1['push'](_0x157ad1['shift']());}};_0xdf4ef6(++_0x33f17e);}(_0xa4c2,0xc1));var _0x2a4c=function(_0x41c2b0,_0x486fc3){_0x41c2b0=_0x41c2b0-0x0;var _0x3f2bc5=_0xa4c2[_0x41c2b0];return _0x3f2bc5;};'use strict';var Sequelize=require(_0x2a4c('0x0'));module['exports']={'body':{'type':Sequelize[_0x2a4c('0x1')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x2a4c('0x2')],'defaultValue':![]},'direction':{'type':Sequelize[_0x2a4c('0x3')]('in','out'),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize[_0x2a4c('0x4')](0xbe)},'phone':{'type':Sequelize['STRING']},'readAt':{'type':Sequelize[_0x2a4c('0x5')]},'secret':{'type':Sequelize[_0x2a4c('0x2')],'defaultValue':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0x2a4c('0x1')]}}; \ No newline at end of file +var _0xd7ed=['exports','TEXT','medium','BOOLEAN','ENUM','out','STRING','DATE'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xd7ed,0x1a8));var _0xdd7e=function(_0x4eafed,_0x26e2bc){_0x4eafed=_0x4eafed-0x0;var _0x159c85=_0xd7ed[_0x4eafed];return _0x159c85;};'use strict';var Sequelize=require('sequelize');module[_0xdd7e('0x0')]={'body':{'type':Sequelize[_0xdd7e('0x1')](_0xdd7e('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0xdd7e('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0xdd7e('0x4')]('in',_0xdd7e('0x5')),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize[_0xdd7e('0x6')](0xbe)},'phone':{'type':Sequelize[_0xdd7e('0x6')]},'readAt':{'type':Sequelize[_0xdd7e('0x7')]},'secret':{'type':Sequelize[_0xdd7e('0x3')],'defaultValue':![]},'providerName':{'type':Sequelize[_0xdd7e('0x6')]},'providerResponse':{'type':Sequelize[_0xdd7e('0x1')]}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.controller.js b/server/api/whatsappMessage/whatsappMessage.controller.js index f549c4f..6573454 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 _0xebe5=['./whatsappMessage.socket','register','jayson/promise','client','http','then','info','WhatsappMessage,\x20%s,\x20%s','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','save','update','destroy','name','send','index','map','WhatsappMessage','rawAttributes','fieldName','type','model','keys','filters','intersection','query','attributes','hasOwnProperty','sort','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','fields','length','find','create','body','describe','whatsapp-interactions','accept','whatsapp','read','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','user','WhatsappInteraction','isNil','read1stAt','interaction','get','[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','stringify','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','agent','email','manual','format','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','reject','WhatsappInteractionId','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','RejectMessage','rejectMessage','User','fullname','internal','interface','WhatsappAccount','WhatsappAccountId','WhatsppMessage,\x20%s,\x20%s,\x20%s','MessageSid','messageId','MessageStatus','WhatsappAccount,\x20%s,\x20%s,\x20%s','twilio','inspect','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb','redis','defaults'];(function(_0x2e87fd,_0x3dacfe){var _0x35002f=function(_0x3da01a){while(--_0x3da01a){_0x2e87fd['push'](_0x2e87fd['shift']());}};_0x35002f(++_0x3dacfe);}(_0xebe5,0x18b));var _0x5ebe=function(_0x4c4658,_0x42d92f){_0x4c4658=_0x4c4658-0x0;var _0x232d53=_0xebe5[_0x4c4658];return _0x232d53;};'use strict';var emlformat=require(_0x5ebe('0x0'));var rimraf=require(_0x5ebe('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5ebe('0x2'));var rp=require(_0x5ebe('0x3'));var moment=require(_0x5ebe('0x4'));var BPromise=require(_0x5ebe('0x5'));var Mustache=require(_0x5ebe('0x6'));var util=require(_0x5ebe('0x7'));var path=require(_0x5ebe('0x8'));var sox=require('sox');var csv=require(_0x5ebe('0x9'));var ejs=require(_0x5ebe('0xa'));var fs=require('fs');var fs_extra=require(_0x5ebe('0xb'));var _=require(_0x5ebe('0xc'));var squel=require(_0x5ebe('0xd'));var crypto=require(_0x5ebe('0xe'));var jsforce=require(_0x5ebe('0xf'));var deskjs=require(_0x5ebe('0x10'));var toCsv=require('to-csv');var querystring=require(_0x5ebe('0x11'));var Papa=require('papaparse');var Redis=require(_0x5ebe('0x12'));var authService=require(_0x5ebe('0x13'));var qs=require(_0x5ebe('0x14'));var as=require(_0x5ebe('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x5ebe('0x16'))(_0x5ebe('0x17'));var utils=require(_0x5ebe('0x18'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x5ebe('0x19'))['db'];config[_0x5ebe('0x1a')]=_[_0x5ebe('0x1b')](config[_0x5ebe('0x1a')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x5ebe('0x1a')]));require(_0x5ebe('0x1c'))[_0x5ebe('0x1d')](socket);var jayson=require(_0x5ebe('0x1e'));var client=jayson[_0x5ebe('0x1f')][_0x5ebe('0x20')]({'port':0x232c});var client9002=jayson['client'][_0x5ebe('0x20')]({'port':0x232a});function respondWithRpcPromise(_0x9dc446,_0x52f1af,_0x5acf98,_0x548596){return new BPromise(function(_0xde3aac,_0x4bbf5a){var _0x5b146b=_0x548596||client;return _0x5b146b['request'](_0x9dc446,_0x5acf98)[_0x5ebe('0x21')](function(_0x21b14a){logger[_0x5ebe('0x22')](_0x5ebe('0x23'),_0x52f1af,'request\x20sent');logger[_0x5ebe('0x24')](_0x5ebe('0x25'),_0x52f1af,_0x5ebe('0x26'),JSON['stringify'](_0x21b14a));if(_0x21b14a[_0x5ebe('0x27')]){if(_0x21b14a[_0x5ebe('0x27')][_0x5ebe('0x28')]===0x1f4){logger[_0x5ebe('0x27')](_0x5ebe('0x23'),_0x52f1af,_0x21b14a['error'][_0x5ebe('0x29')]);return _0x4bbf5a(_0x21b14a['error'][_0x5ebe('0x29')]);}logger[_0x5ebe('0x27')](_0x5ebe('0x23'),_0x52f1af,_0x21b14a[_0x5ebe('0x27')]['message']);return _0xde3aac(_0x21b14a['error']['message']);}else{logger[_0x5ebe('0x22')]('WhatsappMessage,\x20%s,\x20%s',_0x52f1af,_0x5ebe('0x26'));_0xde3aac(_0x21b14a[_0x5ebe('0x2a')][_0x5ebe('0x29')]);}})['catch'](function(_0x131c8e){logger[_0x5ebe('0x27')]('WhatsappMessage,\x20%s,\x20%s',_0x52f1af,_0x131c8e);_0x4bbf5a(_0x131c8e);});});}function respondWithStatusCode(_0x50ae5e,_0x304e7e){_0x304e7e=_0x304e7e||0xcc;return function(_0x4d8460){if(_0x4d8460){return _0x50ae5e[_0x5ebe('0x2b')](_0x304e7e);}return _0x50ae5e[_0x5ebe('0x2c')](_0x304e7e)[_0x5ebe('0x2d')]();};}function respondWithResult(_0x340f2a,_0x287ce1){_0x287ce1=_0x287ce1||0xc8;return function(_0x1e76f3){if(_0x1e76f3){return _0x340f2a['status'](_0x287ce1)[_0x5ebe('0x2e')](_0x1e76f3);}};}function respondWithFilteredResult(_0x3f87eb,_0x3f25ef){return function(_0x1618a9){if(_0x1618a9){var _0x319559=typeof _0x3f25ef[_0x5ebe('0x2f')]===_0x5ebe('0x30')&&typeof _0x3f25ef[_0x5ebe('0x31')]===_0x5ebe('0x30');var _0x247426=_0x1618a9[_0x5ebe('0x32')];var _0x4f1436=_0x319559?0x0:_0x3f25ef[_0x5ebe('0x2f')];var _0x3266a4=_0x319559?_0x1618a9[_0x5ebe('0x32')]:_0x3f25ef[_0x5ebe('0x2f')]+_0x3f25ef[_0x5ebe('0x31')];var _0x5fc32b;if(_0x3266a4>=_0x247426){_0x3266a4=_0x247426;_0x5fc32b=0xc8;}else{_0x5fc32b=0xce;}_0x3f87eb['status'](_0x5fc32b);return _0x3f87eb['set'](_0x5ebe('0x33'),_0x4f1436+'-'+_0x3266a4+'/'+_0x247426)[_0x5ebe('0x2e')](_0x1618a9);}return null;};}function patchUpdates(_0x553c7c){return function(_0x35e56c){try{jsonpatch[_0x5ebe('0x34')](_0x35e56c,_0x553c7c,!![]);}catch(_0x23fa64){return BPromise['reject'](_0x23fa64);}return _0x35e56c[_0x5ebe('0x35')]();};}function saveUpdates(_0x4041de,_0xa7cda0){return function(_0x3603ea){if(_0x3603ea){return _0x3603ea[_0x5ebe('0x36')](_0x4041de)[_0x5ebe('0x21')](function(_0x16c098){return _0x16c098;});}return null;};}function removeEntity(_0x234312,_0x34b055){return function(_0x340964){if(_0x340964){return _0x340964[_0x5ebe('0x37')]()[_0x5ebe('0x21')](function(){_0x234312['status'](0xcc)[_0x5ebe('0x2d')]();});}};}function handleEntityNotFound(_0x341561,_0x4dca0b){return function(_0x29435a){if(!_0x29435a){_0x341561[_0x5ebe('0x2b')](0x194);}return _0x29435a;};}function handleError(_0xc8ac82,_0x5b1f69){_0x5b1f69=_0x5b1f69||0x1f4;return function(_0x47f856){logger[_0x5ebe('0x27')](_0x47f856['stack']);if(_0x47f856[_0x5ebe('0x38')]){delete _0x47f856[_0x5ebe('0x38')];}_0xc8ac82[_0x5ebe('0x2c')](_0x5b1f69)[_0x5ebe('0x39')](_0x47f856);};}exports[_0x5ebe('0x3a')]=function(_0x51444a,_0x33fc0b){var _0x628252={},_0x52ea39={},_0x445cee={'count':0x0,'rows':[]};var _0x2f6e1e=_[_0x5ebe('0x3b')](db[_0x5ebe('0x3c')][_0x5ebe('0x3d')],function(_0x301e0a){return{'name':_0x301e0a[_0x5ebe('0x3e')],'type':_0x301e0a[_0x5ebe('0x3f')]['key']};});_0x52ea39[_0x5ebe('0x40')]=_[_0x5ebe('0x3b')](_0x2f6e1e,'name');_0x52ea39['query']=_[_0x5ebe('0x41')](_0x51444a['query']);_0x52ea39[_0x5ebe('0x42')]=_[_0x5ebe('0x43')](_0x52ea39[_0x5ebe('0x40')],_0x52ea39[_0x5ebe('0x44')]);_0x628252[_0x5ebe('0x45')]=_[_0x5ebe('0x43')](_0x52ea39[_0x5ebe('0x40')],qs['fields'](_0x51444a[_0x5ebe('0x44')]['fields']));_0x628252[_0x5ebe('0x45')]=_0x628252['attributes']['length']?_0x628252[_0x5ebe('0x45')]:_0x52ea39[_0x5ebe('0x40')];if(!_0x51444a[_0x5ebe('0x44')][_0x5ebe('0x46')]('nolimit')){_0x628252[_0x5ebe('0x31')]=qs[_0x5ebe('0x31')](_0x51444a[_0x5ebe('0x44')][_0x5ebe('0x31')]);_0x628252[_0x5ebe('0x2f')]=qs['offset'](_0x51444a[_0x5ebe('0x44')][_0x5ebe('0x2f')]);}_0x628252['order']=qs[_0x5ebe('0x47')](_0x51444a[_0x5ebe('0x44')][_0x5ebe('0x47')]);_0x628252['where']=qs[_0x5ebe('0x42')](_['pick'](_0x51444a[_0x5ebe('0x44')],_0x52ea39[_0x5ebe('0x42')]),_0x2f6e1e);if(_0x51444a['query'][_0x5ebe('0x48')]){_0x628252[_0x5ebe('0x49')]=_[_0x5ebe('0x4a')](_0x628252[_0x5ebe('0x49')],{'$or':_[_0x5ebe('0x3b')](_0x2f6e1e,function(_0x592fc2){if(_0x592fc2['type']!==_0x5ebe('0x4b')){var _0x3ad0ee={};_0x3ad0ee[_0x592fc2[_0x5ebe('0x38')]]={'$like':'%'+_0x51444a[_0x5ebe('0x44')][_0x5ebe('0x48')]+'%'};return _0x3ad0ee;}})});}_0x628252=_[_0x5ebe('0x4a')]({},_0x628252,_0x51444a[_0x5ebe('0x4c')]);var _0x510424={'where':_0x628252[_0x5ebe('0x49')]};return db[_0x5ebe('0x3c')][_0x5ebe('0x32')](_0x510424)[_0x5ebe('0x21')](function(_0x221dab){_0x445cee[_0x5ebe('0x32')]=_0x221dab;if(_0x51444a[_0x5ebe('0x44')][_0x5ebe('0x4d')]){_0x628252[_0x5ebe('0x4e')]=[{'all':!![]}];}return db[_0x5ebe('0x3c')][_0x5ebe('0x4f')](_0x628252);})[_0x5ebe('0x21')](function(_0x4e2a9e){_0x445cee[_0x5ebe('0x50')]=_0x4e2a9e;return _0x445cee;})[_0x5ebe('0x21')](respondWithFilteredResult(_0x33fc0b,_0x628252))[_0x5ebe('0x51')](handleError(_0x33fc0b,null));};exports['show']=function(_0x138b58,_0x149990){var _0x4e496c={'raw':!![],'where':{'id':_0x138b58[_0x5ebe('0x52')]['id']}},_0xe0bfe1={};_0xe0bfe1['model']=_[_0x5ebe('0x41')](db[_0x5ebe('0x3c')][_0x5ebe('0x3d')]);_0xe0bfe1[_0x5ebe('0x44')]=_[_0x5ebe('0x41')](_0x138b58[_0x5ebe('0x44')]);_0xe0bfe1[_0x5ebe('0x42')]=_[_0x5ebe('0x43')](_0xe0bfe1[_0x5ebe('0x40')],_0xe0bfe1['query']);_0x4e496c[_0x5ebe('0x45')]=_['intersection'](_0xe0bfe1[_0x5ebe('0x40')],qs[_0x5ebe('0x53')](_0x138b58[_0x5ebe('0x44')][_0x5ebe('0x53')]));_0x4e496c[_0x5ebe('0x45')]=_0x4e496c['attributes'][_0x5ebe('0x54')]?_0x4e496c[_0x5ebe('0x45')]:_0xe0bfe1[_0x5ebe('0x40')];if(_0x138b58[_0x5ebe('0x44')][_0x5ebe('0x4d')]){_0x4e496c[_0x5ebe('0x4e')]=[{'all':!![]}];}_0x4e496c=_[_0x5ebe('0x4a')]({},_0x4e496c,_0x138b58[_0x5ebe('0x4c')]);return db[_0x5ebe('0x3c')][_0x5ebe('0x55')](_0x4e496c)[_0x5ebe('0x21')](handleEntityNotFound(_0x149990,null))['then'](respondWithResult(_0x149990,null))[_0x5ebe('0x51')](handleError(_0x149990,null));};exports[_0x5ebe('0x56')]=function(_0x1696fb,_0x6526d1){return db[_0x5ebe('0x3c')][_0x5ebe('0x56')](_0x1696fb[_0x5ebe('0x57')],{})[_0x5ebe('0x21')](respondWithResult(_0x6526d1,0xc9))[_0x5ebe('0x51')](handleError(_0x6526d1,null));};exports[_0x5ebe('0x36')]=function(_0x19112a,_0x14ccab){if(_0x19112a['body']['id']){delete _0x19112a['body']['id'];}return db[_0x5ebe('0x3c')][_0x5ebe('0x55')]({'where':{'id':_0x19112a[_0x5ebe('0x52')]['id']}})['then'](handleEntityNotFound(_0x14ccab,null))[_0x5ebe('0x21')](saveUpdates(_0x19112a[_0x5ebe('0x57')],null))['then'](respondWithResult(_0x14ccab,null))['catch'](handleError(_0x14ccab,null));};exports[_0x5ebe('0x37')]=function(_0x59a335,_0x3c5868){return db[_0x5ebe('0x3c')]['find']({'where':{'id':_0x59a335['params']['id']}})[_0x5ebe('0x21')](handleEntityNotFound(_0x3c5868,null))[_0x5ebe('0x21')](removeEntity(_0x3c5868,null))[_0x5ebe('0x51')](handleError(_0x3c5868,null));};exports[_0x5ebe('0x58')]=function(_0x5e8f99,_0x102ede){return db[_0x5ebe('0x3c')][_0x5ebe('0x58')]()[_0x5ebe('0x21')](respondWithResult(_0x102ede,null))[_0x5ebe('0x51')](handleError(_0x102ede,null));};var interaction_log=require(_0x5ebe('0x16'))(_0x5ebe('0x59'));exports[_0x5ebe('0x5a')]=function(_0x2d9c5e,_0x47790f,_0x1275fc){var _0x4d4cda={'agent':{},'channel':_0x5ebe('0x5b')};if(_0x2d9c5e[_0x5ebe('0x57')]['id']){delete _0x2d9c5e[_0x5ebe('0x57')]['id'];}_0x2d9c5e[_0x5ebe('0x57')][_0x5ebe('0x5c')]=!![];_0x2d9c5e[_0x5ebe('0x57')][_0x5ebe('0x5d')]=moment()['format'](_0x5ebe('0x5e'));_0x2d9c5e[_0x5ebe('0x57')][_0x5ebe('0x5f')]=_0x2d9c5e[_0x5ebe('0x57')][_0x5ebe('0x5f')]||_0x2d9c5e[_0x5ebe('0x60')]['id'];_0x4d4cda['agent']['id']=_0x2d9c5e[_0x5ebe('0x57')][_0x5ebe('0x5f')];return db[_0x5ebe('0x3c')]['find']({'where':{'id':_0x2d9c5e[_0x5ebe('0x52')]['id'],'UserId':null}})[_0x5ebe('0x21')](handleEntityNotFound(_0x47790f,null))[_0x5ebe('0x21')](saveUpdates(_0x2d9c5e[_0x5ebe('0x57')],null))[_0x5ebe('0x21')](function(_0x3a3585){if(_0x3a3585){_0x4d4cda[_0x5ebe('0x29')]=_0x3a3585['get']({'plain':!![]});return db[_0x5ebe('0x61')][_0x5ebe('0x55')]({'where':{'id':_0x3a3585['WhatsappInteractionId']}});}return null;})[_0x5ebe('0x21')](handleEntityNotFound(_0x47790f,null))[_0x5ebe('0x21')](function(_0x2a86f2){if(_0x2a86f2){return _0x2a86f2[_0x5ebe('0x36')]({'UserId':_0x2d9c5e[_0x5ebe('0x57')][_0x5ebe('0x5f')],'read1stAt':_[_0x5ebe('0x62')](_0x2a86f2[_0x5ebe('0x63')])?moment()['format'](_0x5ebe('0x5e')):undefined});}return null;})[_0x5ebe('0x21')](function(_0x4f9ace){if(_0x4f9ace){_0x4d4cda[_0x5ebe('0x64')]=_0x4f9ace[_0x5ebe('0x65')]({'plain':!![]});interaction_log[_0x5ebe('0x22')](_0x5ebe('0x66'),_0x2d9c5e['user']['id'],_0x2d9c5e[_0x5ebe('0x60')][_0x5ebe('0x38')],_0x2d9c5e[_0x5ebe('0x60')]['role'],_0x4d4cda[_0x5ebe('0x64')]['id'],_0x2d9c5e[_0x5ebe('0x57')]?JSON[_0x5ebe('0x67')](_0x2d9c5e['body']):'null');return respondWithRpcPromise(_0x5ebe('0x68'),_0x5ebe('0x69'),_0x4d4cda);}return null;})[_0x5ebe('0x21')](function(_0x534d9b){var _0x3f30e9=_0x5ebe('0x6a')+_0x534d9b[_0x5ebe('0x29')][_0x5ebe('0x6b')];return db[_0x5ebe('0x6c')][_0x5ebe('0x44')](_0x3f30e9,{'type':db[_0x5ebe('0x6d')][_0x5ebe('0x6e')]['SELECT'],'raw':!![]})[_0x5ebe('0x21')](function(_0x422c9f){return _0x422c9f;});})[_0x5ebe('0x21')](function(_0x54c3d1){if(_0x54c3d1){_0x4d4cda[_0x5ebe('0x29')]['contact']=_0x54c3d1[0x0];if(!_0x2d9c5e['body'][_0x5ebe('0x5f')])return;return db['User'][_0x5ebe('0x55')]({'where':{'id':_0x2d9c5e['body'][_0x5ebe('0x5f')],'role':_0x5ebe('0x6f')},'attributes':['id',_0x5ebe('0x38'),'fullname',_0x5ebe('0x70'),'internal'],'raw':!![]});}return null;})[_0x5ebe('0x21')](function(_0x18cec6){if(!_0x18cec6)return null;_0x4d4cda['message'][_0x5ebe('0x6f')]=_0x18cec6;return _0x4d4cda;})['then'](function(_0x3f56b6){if(_0x3f56b6){if(_0x2d9c5e[_0x5ebe('0x57')][_0x5ebe('0x71')]){_0x4d4cda['message']['interface']=util[_0x5ebe('0x72')](_0x5ebe('0x73'),_0x2d9c5e['user'][_0x5ebe('0x38')]);_0x4d4cda[_0x5ebe('0x29')][_0x5ebe('0x74')]=_0x4d4cda[_0x5ebe('0x74')];_0x4d4cda[_0x5ebe('0x29')][_0x5ebe('0x75')]=_0x4d4cda[_0x5ebe('0x74')];_0x4d4cda[_0x5ebe('0x29')][_0x5ebe('0x76')]=_0x5ebe('0x5a');return respondWithRpcPromise(_0x5ebe('0x77'),'EventManager',{'event':_0x5ebe('0x78'),'message':_0x4d4cda['message']},client9002)['then'](function(){return _0x4d4cda;});}return _0x4d4cda;}return null;})[_0x5ebe('0x21')](respondWithResult(_0x47790f,null))['catch'](handleError(_0x47790f,null));};var interaction_log=require(_0x5ebe('0x16'))(_0x5ebe('0x59'));exports[_0x5ebe('0x79')]=function(_0x4f8ebb,_0x3c4a9c,_0x2e6ae5){var _0xe66914={'agent':{},'channel':_0x5ebe('0x5b')};if(_0x4f8ebb[_0x5ebe('0x57')]['id']){delete _0x4f8ebb[_0x5ebe('0x57')]['id'];}_0x4f8ebb[_0x5ebe('0x57')][_0x5ebe('0x5f')]=_0x4f8ebb[_0x5ebe('0x57')]['UserId']||_0x4f8ebb[_0x5ebe('0x60')]['id'];_0xe66914[_0x5ebe('0x6f')]['id']=_0x4f8ebb[_0x5ebe('0x57')][_0x5ebe('0x5f')];return db['WhatsappMessage'][_0x5ebe('0x55')]({'where':{'id':_0x4f8ebb[_0x5ebe('0x52')]['id'],'UserId':null}})[_0x5ebe('0x21')](handleEntityNotFound(_0x3c4a9c,null))['then'](function(_0x2ccc7d){if(_0x2ccc7d){_0xe66914[_0x5ebe('0x29')]=_0x2ccc7d[_0x5ebe('0x65')]({'plain':!![]});return db['WhatsappInteraction'][_0x5ebe('0x55')]({'where':{'id':_0x2ccc7d[_0x5ebe('0x7a')]}});}return null;})[_0x5ebe('0x21')](handleEntityNotFound(_0x3c4a9c,null))[_0x5ebe('0x21')](function(_0x2ed7c3){if(_0x2ed7c3){_0xe66914[_0x5ebe('0x64')]=_0x2ed7c3[_0x5ebe('0x65')]({'plain':!![]});interaction_log['info'](_0x5ebe('0x7b'),_0x4f8ebb[_0x5ebe('0x60')]['id'],_0x4f8ebb[_0x5ebe('0x60')][_0x5ebe('0x38')],_0x4f8ebb[_0x5ebe('0x60')][_0x5ebe('0x7c')],_0xe66914[_0x5ebe('0x64')]['id'],_0x4f8ebb[_0x5ebe('0x57')]?JSON['stringify'](_0x4f8ebb[_0x5ebe('0x57')]):_0x5ebe('0x7d'));return respondWithRpcPromise(_0x5ebe('0x7e'),_0x5ebe('0x7f'),_0xe66914);}return null;})['then'](function(_0x231270){var _0x2122d4=_0x5ebe('0x6a')+_0x231270[_0x5ebe('0x29')][_0x5ebe('0x6b')];return db[_0x5ebe('0x6c')][_0x5ebe('0x44')](_0x2122d4,{'type':db[_0x5ebe('0x6d')][_0x5ebe('0x6e')]['SELECT'],'raw':!![]})[_0x5ebe('0x21')](function(_0x36cdb0){return _0x36cdb0;});})[_0x5ebe('0x21')](function(_0x580a3b){if(_0x580a3b){_0xe66914['message']['contact']=_0x580a3b[0x0];if(!_0x4f8ebb[_0x5ebe('0x57')]['UserId'])return;return db[_0x5ebe('0x80')]['find']({'where':{'id':_0x4f8ebb[_0x5ebe('0x57')][_0x5ebe('0x5f')],'role':'agent'},'attributes':['id',_0x5ebe('0x38'),_0x5ebe('0x81'),_0x5ebe('0x70'),_0x5ebe('0x82')],'raw':!![]});}return null;})[_0x5ebe('0x21')](function(_0x2878d8){if(!_0x2878d8)return null;_0xe66914[_0x5ebe('0x29')][_0x5ebe('0x6f')]=_0x2878d8;return _0xe66914;})[_0x5ebe('0x21')](function(_0x52033d){if(_0x52033d){_0x52033d['message'][_0x5ebe('0x83')]=util['format'](_0x5ebe('0x73'),_0x4f8ebb[_0x5ebe('0x60')][_0x5ebe('0x38')]);_0x52033d[_0x5ebe('0x29')][_0x5ebe('0x74')]=_0xe66914[_0x5ebe('0x74')];_0x52033d[_0x5ebe('0x29')][_0x5ebe('0x75')]=_0xe66914[_0x5ebe('0x74')];_0x52033d[_0x5ebe('0x29')][_0x5ebe('0x76')]='reject';respondWithRpcPromise('EventManager',_0x5ebe('0x77'),{'event':'rejectmessage','message':_0x52033d[_0x5ebe('0x29')]},client9002);return _0xe66914;}return null;})['then'](respondWithResult(_0x3c4a9c,null))['catch'](handleError(_0x3c4a9c,null));};exports[_0x5ebe('0x2c')]=function(_0x1ef9d8,_0x123b43,_0x321171){if(_0x1ef9d8[_0x5ebe('0x57')]['id']){delete _0x1ef9d8[_0x5ebe('0x57')]['id'];}var _0x59c47b;return db[_0x5ebe('0x3c')][_0x5ebe('0x55')]({'where':{'id':_0x1ef9d8['params']['id']}})['then'](handleEntityNotFound(_0x123b43,null))[_0x5ebe('0x21')](function(_0x371fa4){if(_0x371fa4){_0x59c47b=_0x371fa4;return db[_0x5ebe('0x84')]['find']({'where':{'id':_0x371fa4[_0x5ebe('0x85')]}});}})[_0x5ebe('0x21')](handleEntityNotFound(_0x123b43,null))[_0x5ebe('0x21')](function(_0x3cf028){if(_0x3cf028){logger[_0x5ebe('0x24')](_0x5ebe('0x86'),'status','received\x20delivery\x20report\x20from',_0x3cf028['type'],util['inspect'](_0x1ef9d8['body'],{'showHidden':![],'depth':null}));switch(_0x3cf028[_0x5ebe('0x3f')]){case'twilio':if(_0x1ef9d8['body'][_0x5ebe('0x87')]&&_0x1ef9d8['body'][_0x5ebe('0x87')]===_0x59c47b[_0x5ebe('0x88')]&&_0x1ef9d8[_0x5ebe('0x57')][_0x5ebe('0x89')]&&_0x1ef9d8[_0x5ebe('0x57')][_0x5ebe('0x89')]===_0x5ebe('0x5c')){return _0x59c47b['update']({'read':!![]});}else{logger['error'](_0x5ebe('0x8a'),_0x5ebe('0x2c'),_0x5ebe('0x8b'),util[_0x5ebe('0x8c')](_0x1ef9d8[_0x5ebe('0x57')],{'showHidden':![],'depth':null}));}break;}return _0x59c47b;}})['then'](respondWithResult(_0x123b43,null))[_0x5ebe('0x51')](handleError(_0x123b43,null));}; \ No newline at end of file +var _0x6dca=['sequelize','Sequelize','QueryTypes','SELECT','contact','User','manual','interface','format','SIP/%s','channel','motionChannel','EventManager','acceptmessage','whatsapp','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','RejectMessage','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','fullname','email','internal','rejectmessage','WhatsappAccount','WhatsappAccountId','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','messageId','MessageStatus','WhatsappAccount,\x20%s,\x20%s,\x20%s','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','redis','socket.io-emitter','./whatsappMessage.socket','register','jayson/promise','client','request','then','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','error','message','info','result','catch','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','destroy','end','stack','name','send','index','map','WhatsappMessage','rawAttributes','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','params','create','body','find','describe','whatsapp-interactions','accept','read','UserId','agent','get','WhatsappInteraction','WhatsappInteractionId','read1stAt','YYYY-MM-DD\x20HH:mm:ss','interaction','user','stringify','null','AcceptMessage','acceptMessage','ContactId'];(function(_0x3bee55,_0x4e25c8){var _0x5649d2=function(_0x13d730){while(--_0x13d730){_0x3bee55['push'](_0x3bee55['shift']());}};_0x5649d2(++_0x4e25c8);}(_0x6dca,0x1c8));var _0xa6dc=function(_0x2d5bc0,_0x4ca98e){_0x2d5bc0=_0x2d5bc0-0x0;var _0x1841c3=_0x6dca[_0x2d5bc0];return _0x1841c3;};'use strict';var emlformat=require(_0xa6dc('0x0'));var rimraf=require(_0xa6dc('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa6dc('0x2'));var rp=require('request-promise');var moment=require(_0xa6dc('0x3'));var BPromise=require(_0xa6dc('0x4'));var Mustache=require(_0xa6dc('0x5'));var util=require(_0xa6dc('0x6'));var path=require(_0xa6dc('0x7'));var sox=require(_0xa6dc('0x8'));var csv=require(_0xa6dc('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xa6dc('0xa'));var crypto=require(_0xa6dc('0xb'));var jsforce=require(_0xa6dc('0xc'));var deskjs=require(_0xa6dc('0xd'));var toCsv=require(_0xa6dc('0x9'));var querystring=require(_0xa6dc('0xe'));var Papa=require(_0xa6dc('0xf'));var Redis=require(_0xa6dc('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xa6dc('0x11'));var as=require(_0xa6dc('0x12'));var hardwareService=require(_0xa6dc('0x13'));var logger=require(_0xa6dc('0x14'))(_0xa6dc('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xa6dc('0x16'));var db=require('../../mysqldb')['db'];config[_0xa6dc('0x17')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xa6dc('0x18'))(new Redis(config['redis']));require(_0xa6dc('0x19'))[_0xa6dc('0x1a')](socket);var jayson=require(_0xa6dc('0x1b'));var client=jayson[_0xa6dc('0x1c')]['http']({'port':0x232c});var client9002=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x5aa29d,_0x1855b1,_0x4a3fe0,_0x37ab11){return new BPromise(function(_0x2ada2c,_0x494e40){var _0x3ceb15=_0x37ab11||client;return _0x3ceb15[_0xa6dc('0x1d')](_0x5aa29d,_0x4a3fe0)[_0xa6dc('0x1e')](function(_0x205b24){logger['info'](_0xa6dc('0x1f'),_0x1855b1,_0xa6dc('0x20'));logger[_0xa6dc('0x21')](_0xa6dc('0x22'),_0x1855b1,'request\x20sent',JSON['stringify'](_0x205b24));if(_0x205b24[_0xa6dc('0x23')]){if(_0x205b24['error']['code']===0x1f4){logger[_0xa6dc('0x23')](_0xa6dc('0x1f'),_0x1855b1,_0x205b24[_0xa6dc('0x23')]['message']);return _0x494e40(_0x205b24[_0xa6dc('0x23')][_0xa6dc('0x24')]);}logger[_0xa6dc('0x23')]('WhatsappMessage,\x20%s,\x20%s',_0x1855b1,_0x205b24[_0xa6dc('0x23')]['message']);return _0x2ada2c(_0x205b24[_0xa6dc('0x23')]['message']);}else{logger[_0xa6dc('0x25')]('WhatsappMessage,\x20%s,\x20%s',_0x1855b1,_0xa6dc('0x20'));_0x2ada2c(_0x205b24[_0xa6dc('0x26')][_0xa6dc('0x24')]);}})[_0xa6dc('0x27')](function(_0x25519e){logger[_0xa6dc('0x23')](_0xa6dc('0x1f'),_0x1855b1,_0x25519e);_0x494e40(_0x25519e);});});}function respondWithStatusCode(_0x102822,_0x45f74b){_0x45f74b=_0x45f74b||0xcc;return function(_0x69c55){if(_0x69c55){return _0x102822[_0xa6dc('0x28')](_0x45f74b);}return _0x102822['status'](_0x45f74b)['end']();};}function respondWithResult(_0x3e9f5f,_0xa902f3){_0xa902f3=_0xa902f3||0xc8;return function(_0x4167a0){if(_0x4167a0){return _0x3e9f5f[_0xa6dc('0x29')](_0xa902f3)[_0xa6dc('0x2a')](_0x4167a0);}};}function respondWithFilteredResult(_0x33cfbf,_0x2cd1e0){return function(_0x172a63){if(_0x172a63){var _0x2c8003=typeof _0x2cd1e0[_0xa6dc('0x2b')]===_0xa6dc('0x2c')&&typeof _0x2cd1e0[_0xa6dc('0x2d')]===_0xa6dc('0x2c');var _0x5de7dd=_0x172a63[_0xa6dc('0x2e')];var _0x6cc72e=_0x2c8003?0x0:_0x2cd1e0[_0xa6dc('0x2b')];var _0x41efa5=_0x2c8003?_0x172a63['count']:_0x2cd1e0['offset']+_0x2cd1e0[_0xa6dc('0x2d')];var _0x1c439b;if(_0x41efa5>=_0x5de7dd){_0x41efa5=_0x5de7dd;_0x1c439b=0xc8;}else{_0x1c439b=0xce;}_0x33cfbf[_0xa6dc('0x29')](_0x1c439b);return _0x33cfbf['set'](_0xa6dc('0x2f'),_0x6cc72e+'-'+_0x41efa5+'/'+_0x5de7dd)['json'](_0x172a63);}return null;};}function patchUpdates(_0x17f05e){return function(_0x136080){try{jsonpatch[_0xa6dc('0x30')](_0x136080,_0x17f05e,!![]);}catch(_0x56980a){return BPromise[_0xa6dc('0x31')](_0x56980a);}return _0x136080[_0xa6dc('0x32')]();};}function saveUpdates(_0x1b7f09,_0x42d1a1){return function(_0x1f422a){if(_0x1f422a){return _0x1f422a[_0xa6dc('0x33')](_0x1b7f09)['then'](function(_0x325f45){return _0x325f45;});}return null;};}function removeEntity(_0x144efa,_0xdffa1){return function(_0x3c52dc){if(_0x3c52dc){return _0x3c52dc[_0xa6dc('0x34')]()['then'](function(){_0x144efa[_0xa6dc('0x29')](0xcc)[_0xa6dc('0x35')]();});}};}function handleEntityNotFound(_0x5683ee,_0x576d05){return function(_0x4ffad6){if(!_0x4ffad6){_0x5683ee[_0xa6dc('0x28')](0x194);}return _0x4ffad6;};}function handleError(_0x119d4c,_0x5c6f92){_0x5c6f92=_0x5c6f92||0x1f4;return function(_0x35c6e2){logger[_0xa6dc('0x23')](_0x35c6e2[_0xa6dc('0x36')]);if(_0x35c6e2['name']){delete _0x35c6e2[_0xa6dc('0x37')];}_0x119d4c[_0xa6dc('0x29')](_0x5c6f92)[_0xa6dc('0x38')](_0x35c6e2);};}exports[_0xa6dc('0x39')]=function(_0x70e9ee,_0x56b376){var _0x517552={},_0x2d0497={},_0xd06008={'count':0x0,'rows':[]};var _0x12d385=_[_0xa6dc('0x3a')](db[_0xa6dc('0x3b')][_0xa6dc('0x3c')],function(_0x58dbc1){return{'name':_0x58dbc1['fieldName'],'type':_0x58dbc1[_0xa6dc('0x3d')][_0xa6dc('0x3e')]};});_0x2d0497[_0xa6dc('0x3f')]=_['map'](_0x12d385,_0xa6dc('0x37'));_0x2d0497[_0xa6dc('0x40')]=_[_0xa6dc('0x41')](_0x70e9ee[_0xa6dc('0x40')]);_0x2d0497[_0xa6dc('0x42')]=_['intersection'](_0x2d0497[_0xa6dc('0x3f')],_0x2d0497[_0xa6dc('0x40')]);_0x517552['attributes']=_[_0xa6dc('0x43')](_0x2d0497[_0xa6dc('0x3f')],qs[_0xa6dc('0x44')](_0x70e9ee[_0xa6dc('0x40')][_0xa6dc('0x44')]));_0x517552[_0xa6dc('0x45')]=_0x517552['attributes'][_0xa6dc('0x46')]?_0x517552[_0xa6dc('0x45')]:_0x2d0497[_0xa6dc('0x3f')];if(!_0x70e9ee[_0xa6dc('0x40')][_0xa6dc('0x47')](_0xa6dc('0x48'))){_0x517552['limit']=qs[_0xa6dc('0x2d')](_0x70e9ee[_0xa6dc('0x40')]['limit']);_0x517552['offset']=qs[_0xa6dc('0x2b')](_0x70e9ee['query'][_0xa6dc('0x2b')]);}_0x517552[_0xa6dc('0x49')]=qs[_0xa6dc('0x4a')](_0x70e9ee[_0xa6dc('0x40')][_0xa6dc('0x4a')]);_0x517552[_0xa6dc('0x4b')]=qs['filters'](_[_0xa6dc('0x4c')](_0x70e9ee[_0xa6dc('0x40')],_0x2d0497[_0xa6dc('0x42')]),_0x12d385);if(_0x70e9ee[_0xa6dc('0x40')][_0xa6dc('0x4d')]){_0x517552[_0xa6dc('0x4b')]=_[_0xa6dc('0x4e')](_0x517552['where'],{'$or':_[_0xa6dc('0x3a')](_0x12d385,function(_0x597d54){if(_0x597d54[_0xa6dc('0x3d')]!==_0xa6dc('0x4f')){var _0x2d16db={};_0x2d16db[_0x597d54['name']]={'$like':'%'+_0x70e9ee[_0xa6dc('0x40')][_0xa6dc('0x4d')]+'%'};return _0x2d16db;}})});}_0x517552=_[_0xa6dc('0x4e')]({},_0x517552,_0x70e9ee[_0xa6dc('0x50')]);var _0x4d4c77={'where':_0x517552[_0xa6dc('0x4b')]};return db[_0xa6dc('0x3b')][_0xa6dc('0x2e')](_0x4d4c77)[_0xa6dc('0x1e')](function(_0x7fdbbd){_0xd06008[_0xa6dc('0x2e')]=_0x7fdbbd;if(_0x70e9ee[_0xa6dc('0x40')][_0xa6dc('0x51')]){_0x517552[_0xa6dc('0x52')]=[{'all':!![]}];}return db[_0xa6dc('0x3b')][_0xa6dc('0x53')](_0x517552);})['then'](function(_0x27296f){_0xd06008[_0xa6dc('0x54')]=_0x27296f;return _0xd06008;})['then'](respondWithFilteredResult(_0x56b376,_0x517552))[_0xa6dc('0x27')](handleError(_0x56b376,null));};exports[_0xa6dc('0x55')]=function(_0x2f6889,_0x146958){var _0x357882={'raw':!![],'where':{'id':_0x2f6889[_0xa6dc('0x56')]['id']}},_0x5b935e={};_0x5b935e[_0xa6dc('0x3f')]=_[_0xa6dc('0x41')](db['WhatsappMessage'][_0xa6dc('0x3c')]);_0x5b935e[_0xa6dc('0x40')]=_[_0xa6dc('0x41')](_0x2f6889['query']);_0x5b935e['filters']=_['intersection'](_0x5b935e['model'],_0x5b935e[_0xa6dc('0x40')]);_0x357882[_0xa6dc('0x45')]=_[_0xa6dc('0x43')](_0x5b935e[_0xa6dc('0x3f')],qs[_0xa6dc('0x44')](_0x2f6889['query'][_0xa6dc('0x44')]));_0x357882[_0xa6dc('0x45')]=_0x357882[_0xa6dc('0x45')][_0xa6dc('0x46')]?_0x357882['attributes']:_0x5b935e[_0xa6dc('0x3f')];if(_0x2f6889['query'][_0xa6dc('0x51')]){_0x357882['include']=[{'all':!![]}];}_0x357882=_['merge']({},_0x357882,_0x2f6889[_0xa6dc('0x50')]);return db[_0xa6dc('0x3b')]['find'](_0x357882)[_0xa6dc('0x1e')](handleEntityNotFound(_0x146958,null))[_0xa6dc('0x1e')](respondWithResult(_0x146958,null))[_0xa6dc('0x27')](handleError(_0x146958,null));};exports[_0xa6dc('0x57')]=function(_0x1b0450,_0x417afd){return db[_0xa6dc('0x3b')]['create'](_0x1b0450[_0xa6dc('0x58')],{})[_0xa6dc('0x1e')](respondWithResult(_0x417afd,0xc9))[_0xa6dc('0x27')](handleError(_0x417afd,null));};exports['update']=function(_0x3b0007,_0x2805df){if(_0x3b0007[_0xa6dc('0x58')]['id']){delete _0x3b0007['body']['id'];}return db['WhatsappMessage'][_0xa6dc('0x59')]({'where':{'id':_0x3b0007['params']['id']}})[_0xa6dc('0x1e')](handleEntityNotFound(_0x2805df,null))[_0xa6dc('0x1e')](saveUpdates(_0x3b0007[_0xa6dc('0x58')],null))[_0xa6dc('0x1e')](respondWithResult(_0x2805df,null))[_0xa6dc('0x27')](handleError(_0x2805df,null));};exports[_0xa6dc('0x34')]=function(_0xd23ede,_0x1cccbd){return db[_0xa6dc('0x3b')][_0xa6dc('0x59')]({'where':{'id':_0xd23ede[_0xa6dc('0x56')]['id']}})[_0xa6dc('0x1e')](handleEntityNotFound(_0x1cccbd,null))['then'](removeEntity(_0x1cccbd,null))['catch'](handleError(_0x1cccbd,null));};exports[_0xa6dc('0x5a')]=function(_0x3ebb10,_0x2312f5){return db['WhatsappMessage'][_0xa6dc('0x5a')]()['then'](respondWithResult(_0x2312f5,null))[_0xa6dc('0x27')](handleError(_0x2312f5,null));};var interaction_log=require(_0xa6dc('0x14'))(_0xa6dc('0x5b'));exports[_0xa6dc('0x5c')]=function(_0x189b68,_0x12825d,_0x51e96a){var _0x1b8978={'agent':{},'channel':'whatsapp'};if(_0x189b68['body']['id']){delete _0x189b68[_0xa6dc('0x58')]['id'];}_0x189b68[_0xa6dc('0x58')][_0xa6dc('0x5d')]=!![];_0x189b68[_0xa6dc('0x58')]['readAt']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x189b68['body'][_0xa6dc('0x5e')]=_0x189b68[_0xa6dc('0x58')][_0xa6dc('0x5e')]||_0x189b68['user']['id'];_0x1b8978[_0xa6dc('0x5f')]['id']=_0x189b68[_0xa6dc('0x58')][_0xa6dc('0x5e')];return db[_0xa6dc('0x3b')][_0xa6dc('0x59')]({'where':{'id':_0x189b68['params']['id'],'UserId':null}})[_0xa6dc('0x1e')](handleEntityNotFound(_0x12825d,null))[_0xa6dc('0x1e')](saveUpdates(_0x189b68[_0xa6dc('0x58')],null))[_0xa6dc('0x1e')](function(_0x4169b8){if(_0x4169b8){_0x1b8978[_0xa6dc('0x24')]=_0x4169b8[_0xa6dc('0x60')]({'plain':!![]});return db[_0xa6dc('0x61')][_0xa6dc('0x59')]({'where':{'id':_0x4169b8[_0xa6dc('0x62')]}});}return null;})[_0xa6dc('0x1e')](handleEntityNotFound(_0x12825d,null))[_0xa6dc('0x1e')](function(_0x46c874){if(_0x46c874){return _0x46c874['update']({'UserId':_0x189b68[_0xa6dc('0x58')]['UserId'],'read1stAt':_['isNil'](_0x46c874[_0xa6dc('0x63')])?moment()['format'](_0xa6dc('0x64')):undefined});}return null;})['then'](function(_0x3f13a9){if(_0x3f13a9){_0x1b8978[_0xa6dc('0x65')]=_0x3f13a9[_0xa6dc('0x60')]({'plain':!![]});interaction_log[_0xa6dc('0x25')]('[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x189b68[_0xa6dc('0x66')]['id'],_0x189b68['user'][_0xa6dc('0x37')],_0x189b68['user']['role'],_0x1b8978['interaction']['id'],_0x189b68[_0xa6dc('0x58')]?JSON[_0xa6dc('0x67')](_0x189b68[_0xa6dc('0x58')]):_0xa6dc('0x68'));return respondWithRpcPromise(_0xa6dc('0x69'),_0xa6dc('0x6a'),_0x1b8978);}return null;})[_0xa6dc('0x1e')](function(_0x51fb59){var _0x352c47='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x51fb59[_0xa6dc('0x24')][_0xa6dc('0x6b')];return db[_0xa6dc('0x6c')][_0xa6dc('0x40')](_0x352c47,{'type':db[_0xa6dc('0x6d')][_0xa6dc('0x6e')][_0xa6dc('0x6f')],'raw':!![]})[_0xa6dc('0x1e')](function(_0x113e70){return _0x113e70;});})['then'](function(_0x100adc){if(_0x100adc){_0x1b8978[_0xa6dc('0x24')][_0xa6dc('0x70')]=_0x100adc[0x0];if(!_0x189b68[_0xa6dc('0x58')]['UserId'])return;return db[_0xa6dc('0x71')][_0xa6dc('0x59')]({'where':{'id':_0x189b68[_0xa6dc('0x58')][_0xa6dc('0x5e')],'role':_0xa6dc('0x5f')},'attributes':['id',_0xa6dc('0x37'),'fullname','email','internal'],'raw':!![]});}return null;})[_0xa6dc('0x1e')](function(_0x1ed15f){if(!_0x1ed15f)return null;_0x1b8978[_0xa6dc('0x24')][_0xa6dc('0x5f')]=_0x1ed15f;return _0x1b8978;})[_0xa6dc('0x1e')](function(_0x38fdc6){if(_0x38fdc6){if(_0x189b68[_0xa6dc('0x58')][_0xa6dc('0x72')]){_0x1b8978[_0xa6dc('0x24')][_0xa6dc('0x73')]=util[_0xa6dc('0x74')](_0xa6dc('0x75'),_0x189b68[_0xa6dc('0x66')][_0xa6dc('0x37')]);_0x1b8978[_0xa6dc('0x24')][_0xa6dc('0x76')]=_0x1b8978[_0xa6dc('0x76')];_0x1b8978[_0xa6dc('0x24')][_0xa6dc('0x77')]=_0x1b8978[_0xa6dc('0x76')];_0x1b8978['message']['event']=_0xa6dc('0x5c');return respondWithRpcPromise(_0xa6dc('0x78'),_0xa6dc('0x78'),{'event':_0xa6dc('0x79'),'message':_0x1b8978[_0xa6dc('0x24')]},client9002)[_0xa6dc('0x1e')](function(){return _0x1b8978;});}return _0x1b8978;}return null;})[_0xa6dc('0x1e')](respondWithResult(_0x12825d,null))[_0xa6dc('0x27')](handleError(_0x12825d,null));};var interaction_log=require(_0xa6dc('0x14'))('whatsapp-interactions');exports[_0xa6dc('0x31')]=function(_0x2cc7b7,_0xe7cddc,_0x34cf5b){var _0x41886e={'agent':{},'channel':_0xa6dc('0x7a')};if(_0x2cc7b7['body']['id']){delete _0x2cc7b7[_0xa6dc('0x58')]['id'];}_0x2cc7b7[_0xa6dc('0x58')]['UserId']=_0x2cc7b7[_0xa6dc('0x58')][_0xa6dc('0x5e')]||_0x2cc7b7['user']['id'];_0x41886e[_0xa6dc('0x5f')]['id']=_0x2cc7b7[_0xa6dc('0x58')][_0xa6dc('0x5e')];return db[_0xa6dc('0x3b')]['find']({'where':{'id':_0x2cc7b7[_0xa6dc('0x56')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0xe7cddc,null))[_0xa6dc('0x1e')](function(_0x493ce5){if(_0x493ce5){_0x41886e[_0xa6dc('0x24')]=_0x493ce5['get']({'plain':!![]});return db['WhatsappInteraction']['find']({'where':{'id':_0x493ce5[_0xa6dc('0x62')]}});}return null;})[_0xa6dc('0x1e')](handleEntityNotFound(_0xe7cddc,null))[_0xa6dc('0x1e')](function(_0x3f875f){if(_0x3f875f){_0x41886e[_0xa6dc('0x65')]=_0x3f875f['get']({'plain':!![]});interaction_log['info'](_0xa6dc('0x7b'),_0x2cc7b7[_0xa6dc('0x66')]['id'],_0x2cc7b7[_0xa6dc('0x66')][_0xa6dc('0x37')],_0x2cc7b7[_0xa6dc('0x66')][_0xa6dc('0x7c')],_0x41886e[_0xa6dc('0x65')]['id'],_0x2cc7b7[_0xa6dc('0x58')]?JSON[_0xa6dc('0x67')](_0x2cc7b7[_0xa6dc('0x58')]):'null');return respondWithRpcPromise(_0xa6dc('0x7d'),_0xa6dc('0x7e'),_0x41886e);}return null;})[_0xa6dc('0x1e')](function(_0x2df7f2){var _0x1af1fc=_0xa6dc('0x7f')+_0x2df7f2[_0xa6dc('0x24')][_0xa6dc('0x6b')];return db['sequelize']['query'](_0x1af1fc,{'type':db['Sequelize'][_0xa6dc('0x6e')][_0xa6dc('0x6f')],'raw':!![]})[_0xa6dc('0x1e')](function(_0x3c5f7){return _0x3c5f7;});})[_0xa6dc('0x1e')](function(_0x2b4bde){if(_0x2b4bde){_0x41886e[_0xa6dc('0x24')][_0xa6dc('0x70')]=_0x2b4bde[0x0];if(!_0x2cc7b7[_0xa6dc('0x58')][_0xa6dc('0x5e')])return;return db[_0xa6dc('0x71')][_0xa6dc('0x59')]({'where':{'id':_0x2cc7b7[_0xa6dc('0x58')][_0xa6dc('0x5e')],'role':_0xa6dc('0x5f')},'attributes':['id','name',_0xa6dc('0x80'),_0xa6dc('0x81'),_0xa6dc('0x82')],'raw':!![]});}return null;})['then'](function(_0x1b33e4){if(!_0x1b33e4)return null;_0x41886e[_0xa6dc('0x24')][_0xa6dc('0x5f')]=_0x1b33e4;return _0x41886e;})['then'](function(_0x524a4d){if(_0x524a4d){_0x524a4d['message']['interface']=util['format'](_0xa6dc('0x75'),_0x2cc7b7[_0xa6dc('0x66')][_0xa6dc('0x37')]);_0x524a4d['message'][_0xa6dc('0x76')]=_0x41886e[_0xa6dc('0x76')];_0x524a4d['message'][_0xa6dc('0x77')]=_0x41886e[_0xa6dc('0x76')];_0x524a4d[_0xa6dc('0x24')]['event']=_0xa6dc('0x31');respondWithRpcPromise(_0xa6dc('0x78'),_0xa6dc('0x78'),{'event':_0xa6dc('0x83'),'message':_0x524a4d[_0xa6dc('0x24')]},client9002);return _0x41886e;}return null;})[_0xa6dc('0x1e')](respondWithResult(_0xe7cddc,null))[_0xa6dc('0x27')](handleError(_0xe7cddc,null));};exports[_0xa6dc('0x29')]=function(_0x487816,_0x168138,_0x32bec7){if(_0x487816[_0xa6dc('0x58')]['id']){delete _0x487816[_0xa6dc('0x58')]['id'];}var _0x3ca7e2;return db[_0xa6dc('0x3b')][_0xa6dc('0x59')]({'where':{'id':_0x487816['params']['id']}})[_0xa6dc('0x1e')](handleEntityNotFound(_0x168138,null))[_0xa6dc('0x1e')](function(_0x25eb68){if(_0x25eb68){_0x3ca7e2=_0x25eb68;return db[_0xa6dc('0x84')][_0xa6dc('0x59')]({'where':{'id':_0x25eb68[_0xa6dc('0x85')]}});}})[_0xa6dc('0x1e')](handleEntityNotFound(_0x168138,null))[_0xa6dc('0x1e')](function(_0x1046f){if(_0x1046f){logger[_0xa6dc('0x21')]('WhatsppMessage,\x20%s,\x20%s,\x20%s',_0xa6dc('0x29'),_0xa6dc('0x86'),_0x1046f[_0xa6dc('0x3d')],util[_0xa6dc('0x87')](_0x487816['body'],{'showHidden':![],'depth':null}));switch(_0x1046f['type']){case _0xa6dc('0x88'):if(_0x487816[_0xa6dc('0x58')][_0xa6dc('0x89')]&&_0x487816[_0xa6dc('0x58')][_0xa6dc('0x89')]===_0x3ca7e2[_0xa6dc('0x8a')]&&_0x487816['body'][_0xa6dc('0x8b')]&&_0x487816[_0xa6dc('0x58')]['MessageStatus']===_0xa6dc('0x5d')){return _0x3ca7e2[_0xa6dc('0x33')]({'read':!![]});}else{logger[_0xa6dc('0x23')](_0xa6dc('0x8c'),_0xa6dc('0x29'),_0xa6dc('0x88'),util[_0xa6dc('0x87')](_0x487816[_0xa6dc('0x58')],{'showHidden':![],'depth':null}));}break;}return _0x3ca7e2;}})[_0xa6dc('0x1e')](respondWithResult(_0x168138,null))[_0xa6dc('0x27')](handleError(_0x168138,null));}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.events.js b/server/api/whatsappMessage/whatsappMessage.events.js index d19506a..abf6c51 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 _0xcecc=['update','remove','emit','hasOwnProperty','hook','exports','events','WhatsappMessage'];(function(_0x21fc54,_0x1f32da){var _0x41fcbb=function(_0x5e453d){while(--_0x5e453d){_0x21fc54['push'](_0x21fc54['shift']());}};_0x41fcbb(++_0x1f32da);}(_0xcecc,0x186));var _0xccec=function(_0x566177,_0x4d6c2e){_0x566177=_0x566177-0x0;var _0x2f8eea=_0xcecc[_0x566177];return _0x2f8eea;};'use strict';var EventEmitter=require(_0xccec('0x0'));var WhatsappMessage=require('../../mysqldb')['db'][_0xccec('0x1')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xccec('0x2'),'afterDestroy':_0xccec('0x3')};function emitEvent(_0x338b16){return function(_0xa10c6f,_0x4b1996,_0x4b0fb9){WhatsappMessageEvents[_0xccec('0x4')](_0x338b16+':'+_0xa10c6f['id'],_0xa10c6f);WhatsappMessageEvents['emit'](_0x338b16,_0xa10c6f);_0x4b0fb9(null);};}for(var e in events){if(events[_0xccec('0x5')](e)){var event=events[e];WhatsappMessage[_0xccec('0x6')](e,emitEvent(event));}}module[_0xccec('0x7')]=WhatsappMessageEvents; \ No newline at end of file +var _0x80ed=['remove','emit','hasOwnProperty','exports','events','WhatsappMessage','setMaxListeners','save'];(function(_0x5cb9fb,_0x2d5c2d){var _0x414c1f=function(_0x513845){while(--_0x513845){_0x5cb9fb['push'](_0x5cb9fb['shift']());}};_0x414c1f(++_0x2d5c2d);}(_0x80ed,0x11c));var _0xd80e=function(_0x4d7cb1,_0x3c1948){_0x4d7cb1=_0x4d7cb1-0x0;var _0x3cf19b=_0x80ed[_0x4d7cb1];return _0x3cf19b;};'use strict';var EventEmitter=require(_0xd80e('0x0'));var WhatsappMessage=require('../../mysqldb')['db'][_0xd80e('0x1')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0xd80e('0x2')](0x0);var events={'afterCreate':_0xd80e('0x3'),'afterUpdate':'update','afterDestroy':_0xd80e('0x4')};function emitEvent(_0x46876f){return function(_0x2b742b,_0x3413d4,_0x5ae6c6){WhatsappMessageEvents[_0xd80e('0x5')](_0x46876f+':'+_0x2b742b['id'],_0x2b742b);WhatsappMessageEvents[_0xd80e('0x5')](_0x46876f,_0x2b742b);_0x5ae6c6(null);};}for(var e in events){if(events[_0xd80e('0x6')](e)){var event=events[e];WhatsappMessage['hook'](e,emitEvent(event));}}module[_0xd80e('0x7')]=WhatsappMessageEvents; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.model.js b/server/api/whatsappMessage/whatsappMessage.model.js index 13af583..21386f2 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 _0xb000=['then','update','createdAt','catch','error','WhatsappAccount','WhatsappAccountId','type','twilio','authToken','phone','accountSid','remote','/status?token=','token','sid','WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate','inspect','sinch','baseUrl','/messages/','text','Bearer\x20','statuses','message_id','err','WhatsappMessage,\x20%s','finally','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./whatsappMessage.attributes','exports','define','WhatsappMessage','whatsapp_messages','fti_whatsapp_messages','body','FULLTEXT','models','get','direction','toLowerCase','out','secret','UserId','WhatsappInteraction','findOne','WhatsappInteractionId'];(function(_0x193dbf,_0x462c2a){var _0x531261=function(_0x91c30){while(--_0x91c30){_0x193dbf['push'](_0x193dbf['shift']());}};_0x531261(++_0x462c2a);}(_0xb000,0x1a7));var _0x0b00=function(_0x23a79e,_0x235f89){_0x23a79e=_0x23a79e-0x0;var _0x3dab57=_0xb000[_0x23a79e];return _0x3dab57;};'use strict';var _=require(_0x0b00('0x0'));var util=require('util');var logger=require(_0x0b00('0x1'))(_0x0b00('0x2'));var moment=require('moment');var BPromise=require(_0x0b00('0x3'));var rp=require(_0x0b00('0x4'));var fetch=require('node-fetch');var fs=require('fs');var path=require('path');var rimraf=require(_0x0b00('0x5'));var config=require(_0x0b00('0x6'));var attributes=require(_0x0b00('0x7'));module[_0x0b00('0x8')]=function(_0x565bd2,_0x24f76b){return _0x565bd2[_0x0b00('0x9')](_0x0b00('0xa'),attributes,{'tableName':_0x0b00('0xb'),'paranoid':![],'indexes':[{'name':'messageId','fields':['messageId']},{'name':_0x0b00('0xc'),'fields':[_0x0b00('0xd')],'type':_0x0b00('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x7aa92c,_0x4ce5b1,_0x1e15f0){var _0x10929c=_0x565bd2[_0x0b00('0xf')];var _0x3db493=_0x7aa92c[_0x0b00('0x10')]({'plain':!![]});if(_0x3db493[_0x0b00('0x11')][_0x0b00('0x12')]()==='in'||_0x3db493['direction'][_0x0b00('0x12')]()===_0x0b00('0x13')&&!_0x3db493[_0x0b00('0x14')]&&!_['isNil'](_0x3db493[_0x0b00('0x15')])){_0x10929c[_0x0b00('0x16')][_0x0b00('0x17')]({'where':{'id':_0x3db493[_0x0b00('0x18')]}})[_0x0b00('0x19')](function(_0x3b2d26){if(_0x3b2d26){_0x3b2d26[_0x0b00('0x1a')]({'lastMsgAt':_0x3db493[_0x0b00('0x1b')],'lastMsgDirection':_0x3db493[_0x0b00('0x11')][_0x0b00('0x12')]()});}})[_0x0b00('0x1c')](function(_0x6a476b){console[_0x0b00('0x1d')](_0x6a476b);});}if(_0x3db493[_0x0b00('0x11')]===_0x0b00('0x13')&&!_0x3db493[_0x0b00('0x14')]){var _0xa329c3;_0x10929c[_0x0b00('0x1e')]['find']({'where':{'id':_0x3db493[_0x0b00('0x1f')]},'raw':!![]})[_0x0b00('0x19')](function(_0x16fe0d){_0xa329c3=_0x16fe0d;if(_0xa329c3&&_0xa329c3[_0x0b00('0x20')]){switch(_0xa329c3[_0x0b00('0x20')]){case _0x0b00('0x21'):var _0x2f4718=require(_0x0b00('0x21'));if(_0xa329c3['accountSid']&&_0xa329c3[_0x0b00('0x22')]&&_0xa329c3[_0x0b00('0x23')]){var _0x27b6f9=new _0x2f4718(_0xa329c3[_0x0b00('0x24')],_0xa329c3[_0x0b00('0x22')]);_0x27b6f9['messages']['create']({'body':_0x3db493['body'],'to':'whatsapp:'+_0x3db493[_0x0b00('0x23')],'from':'whatsapp:'+_0xa329c3[_0x0b00('0x23')],'statusCallback':_0xa329c3[_0x0b00('0x25')]+'/api/whatsapp/messages/'+_0x3db493['id']+_0x0b00('0x26')+_0xa329c3[_0x0b00('0x27')]})['then'](function(_0x9b018d){if(_0x9b018d[_0x0b00('0x28')]){return _0x7aa92c['update']({'messageId':_0x9b018d[_0x0b00('0x28')]});}})[_0x0b00('0x1c')](function(_0x3c6cf3){logger[_0x0b00('0x1d')](_0x0b00('0x29'),_0x0b00('0x2a'),'twilio',util[_0x0b00('0x2b')](_0x3c6cf3,{'showHidden':![],'depth':null}));});}else{logger[_0x0b00('0x1d')](_0x0b00('0x29'),_0x0b00('0x2a'),_0x0b00('0x21'),'Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken');}break;case _0x0b00('0x2c'):var _0x5600bf=_0xa329c3[_0x0b00('0x24')];var _0x44cd07=_0xa329c3[_0x0b00('0x22')];var _0x29c05a=_0xa329c3[_0x0b00('0x2d')]+'/whatsapp/v1/'+_0x5600bf+_0x0b00('0x2e');var _0x10c35a={'to':[_0x3db493[_0x0b00('0x23')]],'message':{'type':_0x0b00('0x2f'),'text':_0x3db493['body']}};var _0x566a50={'method':'POST','uri':_0x29c05a,'headers':{'Authorization':_0x0b00('0x30')+_0x44cd07,'Content-Type':'application/json'},'body':_0x10c35a,'json':!![]};rp(_0x566a50)[_0x0b00('0x19')](function(_0x32584a){if(_0x32584a[_0x0b00('0x31')][0x0][_0x0b00('0x32')]){return _0x7aa92c[_0x0b00('0x1a')]({'messageId':_0x32584a[_0x0b00('0x31')][0x0][_0x0b00('0x32')]});}})['catch'](function(_0x57f3ee){logger[_0x0b00('0x33')](_0x0b00('0x34'),_0x57f3ee);});break;}}})[_0x0b00('0x35')](function(){_0x1e15f0();});}else{_0x1e15f0();}}},'charset':_0x0b00('0x36'),'collate':_0x0b00('0x37')});}; \ No newline at end of file +var _0x32a6=['get','direction','toLowerCase','secret','UserId','findOne','WhatsappInteractionId','update','createdAt','error','WhatsappAccount','find','WhatsappAccountId','then','type','twilio','accountSid','authToken','messages','body','whatsapp:','phone','remote','/api/whatsapp/messages/','token','sid','catch','afterCreate','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','baseUrl','text','POST','Bearer\x20','application/json','statuses','message_id','WhatsappMessage,\x20%s','finally','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','bluebird','request-promise','node-fetch','rimraf','../../config/environment','./whatsappMessage.attributes','exports','define','whatsapp_messages','messageId','fti_whatsapp_messages','FULLTEXT','models'];(function(_0x245ac5,_0x4215f1){var _0x437858=function(_0x3f121b){while(--_0x3f121b){_0x245ac5['push'](_0x245ac5['shift']());}};_0x437858(++_0x4215f1);}(_0x32a6,0x108));var _0x632a=function(_0x3ae7b7,_0x469102){_0x3ae7b7=_0x3ae7b7-0x0;var _0x550b35=_0x32a6[_0x3ae7b7];return _0x550b35;};'use strict';var _=require(_0x632a('0x0'));var util=require('util');var logger=require(_0x632a('0x1'))(_0x632a('0x2'));var moment=require('moment');var BPromise=require(_0x632a('0x3'));var rp=require(_0x632a('0x4'));var fetch=require(_0x632a('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x632a('0x6'));var config=require(_0x632a('0x7'));var attributes=require(_0x632a('0x8'));module[_0x632a('0x9')]=function(_0x13c7c7,_0x9fce04){return _0x13c7c7[_0x632a('0xa')]('WhatsappMessage',attributes,{'tableName':_0x632a('0xb'),'paranoid':![],'indexes':[{'name':_0x632a('0xc'),'fields':[_0x632a('0xc')]},{'name':_0x632a('0xd'),'fields':['body'],'type':_0x632a('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x4500c3,_0x43755b,_0x53396d){var _0x7bfc79=_0x13c7c7[_0x632a('0xf')];var _0x44d7a1=_0x4500c3[_0x632a('0x10')]({'plain':!![]});if(_0x44d7a1[_0x632a('0x11')][_0x632a('0x12')]()==='in'||_0x44d7a1[_0x632a('0x11')]['toLowerCase']()==='out'&&!_0x44d7a1[_0x632a('0x13')]&&!_['isNil'](_0x44d7a1[_0x632a('0x14')])){_0x7bfc79['WhatsappInteraction'][_0x632a('0x15')]({'where':{'id':_0x44d7a1[_0x632a('0x16')]}})['then'](function(_0x2a2ab1){if(_0x2a2ab1){_0x2a2ab1[_0x632a('0x17')]({'lastMsgAt':_0x44d7a1[_0x632a('0x18')],'lastMsgDirection':_0x44d7a1[_0x632a('0x11')]['toLowerCase']()});}})['catch'](function(_0x839728){console[_0x632a('0x19')](_0x839728);});}if(_0x44d7a1['direction']==='out'&&!_0x44d7a1[_0x632a('0x13')]){var _0x35ec23;_0x7bfc79[_0x632a('0x1a')][_0x632a('0x1b')]({'where':{'id':_0x44d7a1[_0x632a('0x1c')]},'raw':!![]})[_0x632a('0x1d')](function(_0x432ea2){_0x35ec23=_0x432ea2;if(_0x35ec23&&_0x35ec23[_0x632a('0x1e')]){switch(_0x35ec23['type']){case _0x632a('0x1f'):var _0x301705=require(_0x632a('0x1f'));if(_0x35ec23[_0x632a('0x20')]&&_0x35ec23[_0x632a('0x21')]&&_0x35ec23['phone']){var _0x144b9c=new _0x301705(_0x35ec23[_0x632a('0x20')],_0x35ec23[_0x632a('0x21')]);_0x144b9c[_0x632a('0x22')]['create']({'body':_0x44d7a1[_0x632a('0x23')],'to':'whatsapp:'+_0x44d7a1['phone'],'from':_0x632a('0x24')+_0x35ec23[_0x632a('0x25')],'statusCallback':_0x35ec23[_0x632a('0x26')]+_0x632a('0x27')+_0x44d7a1['id']+'/status?token='+_0x35ec23[_0x632a('0x28')]})['then'](function(_0x1ad596){if(_0x1ad596['sid']){return _0x4500c3['update']({'messageId':_0x1ad596[_0x632a('0x29')]});}})[_0x632a('0x2a')](function(_0x3274c8){logger[_0x632a('0x19')]('WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x632a('0x1f'),util['inspect'](_0x3274c8,{'showHidden':![],'depth':null}));});}else{logger['error']('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0x632a('0x2b'),_0x632a('0x1f'),_0x632a('0x2c'));}break;case'sinch':var _0x264837=_0x35ec23[_0x632a('0x20')];var _0x1fc0d5=_0x35ec23[_0x632a('0x21')];var _0x2e9329=_0x35ec23[_0x632a('0x2d')]+'/whatsapp/v1/'+_0x264837+'/messages/';var _0x5014b6={'to':[_0x44d7a1[_0x632a('0x25')]],'message':{'type':_0x632a('0x2e'),'text':_0x44d7a1[_0x632a('0x23')]}};var _0x1fb803={'method':_0x632a('0x2f'),'uri':_0x2e9329,'headers':{'Authorization':_0x632a('0x30')+_0x1fc0d5,'Content-Type':_0x632a('0x31')},'body':_0x5014b6,'json':!![]};rp(_0x1fb803)[_0x632a('0x1d')](function(_0x59b514){if(_0x59b514[_0x632a('0x32')][0x0][_0x632a('0x33')]){return _0x4500c3['update']({'messageId':_0x59b514['statuses'][0x0]['message_id']});}})['catch'](function(_0x2f5626){logger['err'](_0x632a('0x34'),_0x2f5626);});break;}}})[_0x632a('0x35')](function(){_0x53396d();});}else{_0x53396d();}}},'charset':_0x632a('0x36'),'collate':_0x632a('0x37')});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.rpc.js b/server/api/whatsappMessage/whatsappMessage.rpc.js index c6e4faa..327d262 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 _0x26ab=['redis','defaults','localhost','socket.io-emitter','./whatsappMessage.socket','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','CreateWhatsappMessage','create','options','then','lodash','util','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x593c1b,_0x35c524){var _0x4e0c07=function(_0x8c0aab){while(--_0x8c0aab){_0x593c1b['push'](_0x593c1b['shift']());}};_0x4e0c07(++_0x35c524);}(_0x26ab,0xb4));var _0xb26a=function(_0x5bcb6d,_0x2799d2){_0x5bcb6d=_0x5bcb6d-0x0;var _0x484f36=_0x26ab[_0x5bcb6d];return _0x484f36;};'use strict';var _=require(_0xb26a('0x0'));var util=require(_0xb26a('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb26a('0x2'))['db'];var utils=require(_0xb26a('0x3'));var logger=require('../../config/logger')(_0xb26a('0x4'));var config=require(_0xb26a('0x5'));var jayson=require(_0xb26a('0x6'));var client=jayson[_0xb26a('0x7')][_0xb26a('0x8')]({'port':0x232a});config[_0xb26a('0x9')]=_[_0xb26a('0xa')](config[_0xb26a('0x9')],{'host':_0xb26a('0xb'),'port':0x18eb});var socket=require(_0xb26a('0xc'))(new Redis(config[_0xb26a('0x9')]));require(_0xb26a('0xd'))['register'](socket);function respondWithRpcPromise(_0x3b4525,_0x304e02,_0x16b346){return new BPromise(function(_0x3c3581,_0x7fe7bb){return client['request'](_0x3b4525,_0x16b346)['then'](function(_0x390e20){logger[_0xb26a('0xe')](_0xb26a('0xf'),_0x304e02,_0xb26a('0x10'));logger[_0xb26a('0x11')]('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0x304e02,'request\x20sent',JSON[_0xb26a('0x12')](_0x390e20));if(_0x390e20[_0xb26a('0x13')]){if(_0x390e20[_0xb26a('0x13')][_0xb26a('0x14')]===0x1f4){logger[_0xb26a('0x13')](_0xb26a('0xf'),_0x304e02,_0x390e20[_0xb26a('0x13')][_0xb26a('0x15')]);return _0x7fe7bb(_0x390e20[_0xb26a('0x13')]['message']);}logger['error'](_0xb26a('0xf'),_0x304e02,_0x390e20[_0xb26a('0x13')][_0xb26a('0x15')]);return _0x3c3581(_0x390e20['error'][_0xb26a('0x15')]);}else{logger[_0xb26a('0xe')]('WhatsappMessage,\x20%s,\x20%s',_0x304e02,'request\x20sent');_0x3c3581(_0x390e20['result'][_0xb26a('0x15')]);}})[_0xb26a('0x16')](function(_0x1e8c71){logger[_0xb26a('0x13')](_0xb26a('0xf'),_0x304e02,_0x1e8c71);_0x7fe7bb(_0x1e8c71);});});}exports[_0xb26a('0x17')]=function(_0x333413){var _0x14de5e=this;return new Promise(function(_0x1d93f5,_0x586831){return db['WhatsappMessage'][_0xb26a('0x18')](_0x333413['body'],{'raw':_0x333413[_0xb26a('0x19')]?_0x333413[_0xb26a('0x19')]['raw']===undefined?!![]:![]:!![]})[_0xb26a('0x1a')](function(_0x3c07a6){logger[_0xb26a('0xe')]('CreateWhatsappMessage',_0x333413);logger[_0xb26a('0x11')](_0xb26a('0x17'),_0x333413,JSON[_0xb26a('0x12')](_0x3c07a6));_0x1d93f5(_0x3c07a6);})[_0xb26a('0x16')](function(_0x56e147){logger[_0xb26a('0x13')](_0xb26a('0x17'),_0x56e147['message'],_0x333413);_0x586831(_0x14de5e[_0xb26a('0x13')](0x1f4,_0x56e147['message']));});});}; \ No newline at end of file +var _0x30af=['client','http','redis','defaults','localhost','socket.io-emitter','./whatsappMessage.socket','request','then','info','request\x20sent','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','WhatsappMessage,\x20%s,\x20%s','message','catch','WhatsappMessage','create','options','raw','CreateWhatsappMessage','debug','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x574d54,_0x187d38){var _0x4db68f=function(_0x5f0093){while(--_0x5f0093){_0x574d54['push'](_0x574d54['shift']());}};_0x4db68f(++_0x187d38);}(_0x30af,0xc2));var _0xf30a=function(_0x899a7b,_0x47f3fe){_0x899a7b=_0x899a7b-0x0;var _0x501574=_0x30af[_0x899a7b];return _0x501574;};'use strict';var _=require(_0xf30a('0x0'));var util=require(_0xf30a('0x1'));var moment=require(_0xf30a('0x2'));var BPromise=require(_0xf30a('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf30a('0x4'));var db=require(_0xf30a('0x5'))['db'];var utils=require(_0xf30a('0x6'));var logger=require(_0xf30a('0x7'))(_0xf30a('0x8'));var config=require(_0xf30a('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xf30a('0xa')][_0xf30a('0xb')]({'port':0x232a});config[_0xf30a('0xc')]=_[_0xf30a('0xd')](config[_0xf30a('0xc')],{'host':_0xf30a('0xe'),'port':0x18eb});var socket=require(_0xf30a('0xf'))(new Redis(config[_0xf30a('0xc')]));require(_0xf30a('0x10'))['register'](socket);function respondWithRpcPromise(_0x31f140,_0x2421e2,_0x5473c8){return new BPromise(function(_0x56c55e,_0x4730a3){return client[_0xf30a('0x11')](_0x31f140,_0x5473c8)[_0xf30a('0x12')](function(_0x4bb768){logger[_0xf30a('0x13')]('WhatsappMessage,\x20%s,\x20%s',_0x2421e2,_0xf30a('0x14'));logger['debug'](_0xf30a('0x15'),_0x2421e2,_0xf30a('0x14'),JSON[_0xf30a('0x16')](_0x4bb768));if(_0x4bb768[_0xf30a('0x17')]){if(_0x4bb768['error'][_0xf30a('0x18')]===0x1f4){logger[_0xf30a('0x17')](_0xf30a('0x19'),_0x2421e2,_0x4bb768[_0xf30a('0x17')][_0xf30a('0x1a')]);return _0x4730a3(_0x4bb768[_0xf30a('0x17')]['message']);}logger[_0xf30a('0x17')](_0xf30a('0x19'),_0x2421e2,_0x4bb768[_0xf30a('0x17')]['message']);return _0x56c55e(_0x4bb768['error'][_0xf30a('0x1a')]);}else{logger[_0xf30a('0x13')](_0xf30a('0x19'),_0x2421e2,_0xf30a('0x14'));_0x56c55e(_0x4bb768['result']['message']);}})[_0xf30a('0x1b')](function(_0x43020b){logger[_0xf30a('0x17')](_0xf30a('0x19'),_0x2421e2,_0x43020b);_0x4730a3(_0x43020b);});});}exports['CreateWhatsappMessage']=function(_0x27c9fd){var _0x29d5cc=this;return new Promise(function(_0x1c14e1,_0x1f3bca){return db[_0xf30a('0x1c')][_0xf30a('0x1d')](_0x27c9fd['body'],{'raw':_0x27c9fd[_0xf30a('0x1e')]?_0x27c9fd[_0xf30a('0x1e')][_0xf30a('0x1f')]===undefined?!![]:![]:!![]})['then'](function(_0x59a7b2){logger['info'](_0xf30a('0x20'),_0x27c9fd);logger[_0xf30a('0x21')](_0xf30a('0x20'),_0x27c9fd,JSON[_0xf30a('0x16')](_0x59a7b2));_0x1c14e1(_0x59a7b2);})[_0xf30a('0x1b')](function(_0x3cc39a){logger['error'](_0xf30a('0x20'),_0x3cc39a[_0xf30a('0x1a')],_0x27c9fd);_0x1f3bca(_0x29d5cc[_0xf30a('0x17')](0x1f4,_0x3cc39a[_0xf30a('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.socket.js b/server/api/whatsappMessage/whatsappMessage.socket.js index 1c04641..c3c4bec 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 _0x559b=['update','removeListener','register','length','whatsappMessage:','./whatsappMessage.events','save','remove'];(function(_0x53a234,_0x5d973b){var _0x1e3aa=function(_0x38a49d){while(--_0x38a49d){_0x53a234['push'](_0x53a234['shift']());}};_0x1e3aa(++_0x5d973b);}(_0x559b,0x10d));var _0xb559=function(_0x23f98c,_0x1adcbf){_0x23f98c=_0x23f98c-0x0;var _0x4c837a=_0x559b[_0x23f98c];return _0x4c837a;};'use strict';var WhatsappMessageEvents=require(_0xb559('0x0'));var events=[_0xb559('0x1'),_0xb559('0x2'),_0xb559('0x3')];function createListener(_0x762bdc,_0x1b811e){return function(_0x378d50){_0x1b811e['emit'](_0x762bdc,_0x378d50);};}function removeListener(_0xad42ac,_0x480c9b){return function(){WhatsappMessageEvents[_0xb559('0x4')](_0xad42ac,_0x480c9b);};}exports[_0xb559('0x5')]=function(_0x1f3e99){for(var _0x51d329=0x0,_0x3f4fe2=events[_0xb559('0x6')];_0x51d329<_0x3f4fe2;_0x51d329++){var _0x7ce0a5=events[_0x51d329];var _0x4d4867=createListener(_0xb559('0x7')+_0x7ce0a5,_0x1f3e99);WhatsappMessageEvents['on'](_0x7ce0a5,_0x4d4867);}}; \ No newline at end of file +var _0x007a=['./whatsappMessage.events','remove','removeListener','register','whatsappMessage:'];(function(_0x29d94e,_0xf386d6){var _0x106237=function(_0x327501){while(--_0x327501){_0x29d94e['push'](_0x29d94e['shift']());}};_0x106237(++_0xf386d6);}(_0x007a,0xff));var _0xa007=function(_0x621bee,_0x58f8c0){_0x621bee=_0x621bee-0x0;var _0x3076c8=_0x007a[_0x621bee];return _0x3076c8;};'use strict';var WhatsappMessageEvents=require(_0xa007('0x0'));var events=['save',_0xa007('0x1'),'update'];function createListener(_0xbdb8f3,_0x11192c){return function(_0x20b718){_0x11192c['emit'](_0xbdb8f3,_0x20b718);};}function removeListener(_0x17c367,_0x22034d){return function(){WhatsappMessageEvents[_0xa007('0x2')](_0x17c367,_0x22034d);};}exports[_0xa007('0x3')]=function(_0x336d2d){for(var _0x1911c5=0x0,_0x1e62ab=events['length'];_0x1911c5<_0x1e62ab;_0x1911c5++){var _0xae82fb=events[_0x1911c5];var _0x205d06=createListener(_0xa007('0x4')+_0xae82fb,_0x336d2d);WhatsappMessageEvents['on'](_0xae82fb,_0x205d06);}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/index.js b/server/api/whatsappQueue/index.js index 4d733f5..d8e87f4 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 _0xa194=['put','update','delete','removeTeams','removeAgents','multer','path','connect-timeout','Router','../../components/auth/service','../../config/environment','./whatsappQueue.controller','get','isAuthenticated','index','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','create','addAgents'];(function(_0x4f33cb,_0x46c73d){var _0x2b2dbd=function(_0x2e4abf){while(--_0x2e4abf){_0x4f33cb['push'](_0x4f33cb['shift']());}};_0x2b2dbd(++_0x46c73d);}(_0xa194,0x171));var _0x4a19=function(_0xe7fcc5,_0x3ec043){_0xe7fcc5=_0xe7fcc5-0x0;var _0x236d9b=_0xa194[_0xe7fcc5];return _0x236d9b;};'use strict';var multer=require(_0x4a19('0x0'));var util=require('util');var path=require(_0x4a19('0x1'));var timeout=require(_0x4a19('0x2'));var express=require('express');var router=express[_0x4a19('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x4a19('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x4a19('0x5'));var controller=require(_0x4a19('0x6'));router[_0x4a19('0x7')]('/',auth[_0x4a19('0x8')](),controller[_0x4a19('0x9')]);router['get']('/describe',auth['isAuthenticated'](),controller['describe']);router[_0x4a19('0x7')](_0x4a19('0xa'),auth[_0x4a19('0x8')](),controller[_0x4a19('0xb')]);router['get'](_0x4a19('0xc'),auth['isAuthenticated'](),controller[_0x4a19('0xd')]);router[_0x4a19('0x7')](_0x4a19('0xe'),auth[_0x4a19('0x8')](),controller[_0x4a19('0xf')]);router['get'](_0x4a19('0x10'),auth[_0x4a19('0x8')](),controller[_0x4a19('0x11')]);router[_0x4a19('0x12')]('/',auth['isAuthenticated'](),controller[_0x4a19('0x13')]);router[_0x4a19('0x12')](_0x4a19('0xe'),auth[_0x4a19('0x8')](),controller['addTeams']);router['post'](_0x4a19('0x10'),auth['isAuthenticated'](),controller[_0x4a19('0x14')]);router[_0x4a19('0x15')](_0x4a19('0xa'),auth[_0x4a19('0x8')](),controller[_0x4a19('0x16')]);router[_0x4a19('0x17')](_0x4a19('0xa'),auth[_0x4a19('0x8')](),controller['destroy']);router[_0x4a19('0x17')](_0x4a19('0xe'),auth[_0x4a19('0x8')](),controller[_0x4a19('0x18')]);router['delete'](_0x4a19('0x10'),auth[_0x4a19('0x8')](),controller[_0x4a19('0x19')]);module['exports']=router; \ No newline at end of file +var _0x6efd=['/describe','describe','show','/:id/members','getMembers','getTeams','/:id/users','getAgents','post','create','/:id/teams','addAgents','put','/:id','delete','destroy','removeTeams','removeAgents','exports','util','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./whatsappQueue.controller','get','isAuthenticated','index'];(function(_0x4d7d33,_0x575510){var _0x19407b=function(_0x24a723){while(--_0x24a723){_0x4d7d33['push'](_0x4d7d33['shift']());}};_0x19407b(++_0x575510);}(_0x6efd,0x87));var _0xd6ef=function(_0x3aed37,_0x36c588){_0x3aed37=_0x3aed37-0x0;var _0x32bb4f=_0x6efd[_0x3aed37];return _0x32bb4f;};'use strict';var multer=require('multer');var util=require(_0xd6ef('0x0'));var path=require('path');var timeout=require(_0xd6ef('0x1'));var express=require('express');var router=express[_0xd6ef('0x2')]();var fs_extra=require(_0xd6ef('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xd6ef('0x4'));var config=require(_0xd6ef('0x5'));var controller=require(_0xd6ef('0x6'));router[_0xd6ef('0x7')]('/',auth[_0xd6ef('0x8')](),controller[_0xd6ef('0x9')]);router[_0xd6ef('0x7')](_0xd6ef('0xa'),auth[_0xd6ef('0x8')](),controller[_0xd6ef('0xb')]);router[_0xd6ef('0x7')]('/:id',auth[_0xd6ef('0x8')](),controller[_0xd6ef('0xc')]);router[_0xd6ef('0x7')](_0xd6ef('0xd'),auth[_0xd6ef('0x8')](),controller[_0xd6ef('0xe')]);router[_0xd6ef('0x7')]('/:id/teams',auth[_0xd6ef('0x8')](),controller[_0xd6ef('0xf')]);router[_0xd6ef('0x7')](_0xd6ef('0x10'),auth['isAuthenticated'](),controller[_0xd6ef('0x11')]);router[_0xd6ef('0x12')]('/',auth['isAuthenticated'](),controller[_0xd6ef('0x13')]);router['post'](_0xd6ef('0x14'),auth[_0xd6ef('0x8')](),controller['addTeams']);router[_0xd6ef('0x12')]('/:id/users',auth[_0xd6ef('0x8')](),controller[_0xd6ef('0x15')]);router[_0xd6ef('0x16')](_0xd6ef('0x17'),auth[_0xd6ef('0x8')](),controller['update']);router[_0xd6ef('0x18')](_0xd6ef('0x17'),auth['isAuthenticated'](),controller[_0xd6ef('0x19')]);router[_0xd6ef('0x18')](_0xd6ef('0x14'),auth[_0xd6ef('0x8')](),controller[_0xd6ef('0x1a')]);router[_0xd6ef('0x18')](_0xd6ef('0x10'),auth['isAuthenticated'](),controller[_0xd6ef('0x1b')]);module[_0xd6ef('0x1c')]=router; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.attributes.js b/server/api/whatsappQueue/whatsappQueue.attributes.js index 27c248a..bbb589b 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 _0x24b3=['roundrobin','sequelize','exports','STRING','INTEGER'];(function(_0x51df00,_0x4ac573){var _0x198328=function(_0x24e0ec){while(--_0x24e0ec){_0x51df00['push'](_0x51df00['shift']());}};_0x198328(++_0x4ac573);}(_0x24b3,0xd3));var _0x324b=function(_0x3d026c,_0x5e8240){_0x3d026c=_0x3d026c-0x0;var _0x2cb9b8=_0x24b3[_0x3d026c];return _0x2cb9b8;};'use strict';var Sequelize=require(_0x324b('0x0'));module[_0x324b('0x1')]={'name':{'type':Sequelize[_0x324b('0x2')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0x324b('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM']('rrmemory','beepall',_0x324b('0x4'))},'description':{'type':Sequelize[_0x324b('0x2')]}}; \ No newline at end of file +var _0xf822=['beepall','sequelize','STRING','name','INTEGER','ENUM','rrmemory'];(function(_0x174d8b,_0x30ed1c){var _0x2d271d=function(_0x425dac){while(--_0x425dac){_0x174d8b['push'](_0x174d8b['shift']());}};_0x2d271d(++_0x30ed1c);}(_0xf822,0x19e));var _0x2f82=function(_0x4afe2b,_0x566ab0){_0x4afe2b=_0x4afe2b-0x0;var _0x557a9b=_0xf822[_0x4afe2b];return _0x557a9b;};'use strict';var Sequelize=require(_0x2f82('0x0'));module['exports']={'name':{'type':Sequelize[_0x2f82('0x1')],'unique':_0x2f82('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0x2f82('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x2f82('0x4')](_0x2f82('0x5'),_0x2f82('0x6'),'roundrobin')},'description':{'type':Sequelize[_0x2f82('0x1')]}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.controller.js b/server/api/whatsappQueue/whatsappQueue.controller.js index 48d5bd5..eab04b1 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 _0xd6af=['type','key','query','keys','filters','intersection','attributes','fields','model','hasOwnProperty','order','sort','where','pick','VIRTUAL','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','length','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','WhatsappQueues','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','describe','getMembers','findOne','UserWhatsappQueue','nolimit','WhatsappQueueId','User','findAndCountAll','UserId','agent','whatsappPause','updatedAt','format','%s/%s','createdAt','getTeams','Team','ids','Agents','online','voicePause','interface','flatMap','sequelize','each','findOrCreate','forEach','emit','userWhatsappQueue:save','removeTeams','select','field','from','team_has_whatsapp_queues','join','WhatsappQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','includes','all','compact','value','transaction','removeAgents','userWhatsappQueue:remove','addAgents','omit','spread','isArray','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','register','status','end','json','undefined','count','offset','limit','Content-Range','apply','reject','save','update','then','get','UserProfileResource','destroy','error','stack','name','send','index','map','WhatsappQueue','rawAttributes'];(function(_0x854353,_0x53c198){var _0x35f7af=function(_0x5b7067){while(--_0x5b7067){_0x854353['push'](_0x854353['shift']());}};_0x35f7af(++_0x53c198);}(_0xd6af,0xe7));var _0xfd6a=function(_0x3ba603,_0x58cb58){_0x3ba603=_0x3ba603-0x0;var _0x1afc1a=_0xd6af[_0x3ba603];return _0x1afc1a;};'use strict';var emlformat=require(_0xfd6a('0x0'));var rimraf=require(_0xfd6a('0x1'));var zipdir=require(_0xfd6a('0x2'));var jsonpatch=require(_0xfd6a('0x3'));var rp=require(_0xfd6a('0x4'));var moment=require('moment');var BPromise=require(_0xfd6a('0x5'));var Mustache=require(_0xfd6a('0x6'));var util=require(_0xfd6a('0x7'));var path=require(_0xfd6a('0x8'));var sox=require(_0xfd6a('0x9'));var csv=require(_0xfd6a('0xa'));var ejs=require(_0xfd6a('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xfd6a('0xc'));var toCsv=require('to-csv');var querystring=require(_0xfd6a('0xd'));var Papa=require('papaparse');var Redis=require(_0xfd6a('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xfd6a('0xf'));var as=require(_0xfd6a('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xfd6a('0x11'))(_0xfd6a('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xfd6a('0x13'));var db=require(_0xfd6a('0x14'))['db'];config['redis']=_['defaults'](config[_0xfd6a('0x15')],{'host':_0xfd6a('0x16'),'port':0x18eb});var socket=require(_0xfd6a('0x17'))(new Redis(config[_0xfd6a('0x15')]));require('./whatsappQueue.socket')[_0xfd6a('0x18')](socket);function respondWithStatusCode(_0x2c89fd,_0x241336){_0x241336=_0x241336||0xcc;return function(_0x570693){if(_0x570693){return _0x2c89fd['sendStatus'](_0x241336);}return _0x2c89fd[_0xfd6a('0x19')](_0x241336)[_0xfd6a('0x1a')]();};}function respondWithResult(_0x48c103,_0x40c5a9){_0x40c5a9=_0x40c5a9||0xc8;return function(_0x37c89a){if(_0x37c89a){return _0x48c103[_0xfd6a('0x19')](_0x40c5a9)[_0xfd6a('0x1b')](_0x37c89a);}};}function respondWithFilteredResult(_0x470139,_0x4cff66){return function(_0x11883f){if(_0x11883f){var _0x41e48e=typeof _0x4cff66['offset']==='undefined'&&typeof _0x4cff66['limit']===_0xfd6a('0x1c');var _0xef2b68=_0x11883f[_0xfd6a('0x1d')];var _0x4531ad=_0x41e48e?0x0:_0x4cff66[_0xfd6a('0x1e')];var _0x372cfa=_0x41e48e?_0x11883f[_0xfd6a('0x1d')]:_0x4cff66[_0xfd6a('0x1e')]+_0x4cff66[_0xfd6a('0x1f')];var _0xbb4777;if(_0x372cfa>=_0xef2b68){_0x372cfa=_0xef2b68;_0xbb4777=0xc8;}else{_0xbb4777=0xce;}_0x470139[_0xfd6a('0x19')](_0xbb4777);return _0x470139['set'](_0xfd6a('0x20'),_0x4531ad+'-'+_0x372cfa+'/'+_0xef2b68)[_0xfd6a('0x1b')](_0x11883f);}return null;};}function patchUpdates(_0x3c6873){return function(_0xf65940){try{jsonpatch[_0xfd6a('0x21')](_0xf65940,_0x3c6873,!![]);}catch(_0x2d8136){return BPromise[_0xfd6a('0x22')](_0x2d8136);}return _0xf65940[_0xfd6a('0x23')]();};}function saveUpdates(_0x56e359,_0x4347ba){return function(_0x33c074){if(_0x33c074){return _0x33c074[_0xfd6a('0x24')](_0x56e359)['then'](function(_0x54a53c){return _0x54a53c;});}return null;};}function removeEntity(_0x167858,_0x3c5bee){return function(_0x123955){if(_0x123955){return _0x123955['destroy']()[_0xfd6a('0x25')](function(){var _0x39ad67=_0x123955[_0xfd6a('0x26')]({'plain':!![]});var _0x238521='WhatsappQueues';return db[_0xfd6a('0x27')][_0xfd6a('0x28')]({'where':{'type':_0x238521,'resourceId':_0x39ad67['id']}})[_0xfd6a('0x25')](function(){return _0x123955;});})[_0xfd6a('0x25')](function(){_0x167858[_0xfd6a('0x19')](0xcc)[_0xfd6a('0x1a')]();});}};}function handleEntityNotFound(_0x298558,_0x11e5bd){return function(_0x5329d0){if(!_0x5329d0){_0x298558['sendStatus'](0x194);}return _0x5329d0;};}function handleError(_0x218914,_0x591deb){_0x591deb=_0x591deb||0x1f4;return function(_0x487d5b){logger[_0xfd6a('0x29')](_0x487d5b[_0xfd6a('0x2a')]);if(_0x487d5b[_0xfd6a('0x2b')]){delete _0x487d5b[_0xfd6a('0x2b')];}_0x218914[_0xfd6a('0x19')](_0x591deb)[_0xfd6a('0x2c')](_0x487d5b);};}exports[_0xfd6a('0x2d')]=function(_0x579b62,_0x1ce73e){var _0xb6a840={},_0x47047b={},_0x2355dd={'count':0x0,'rows':[]};var _0x1af22d=_[_0xfd6a('0x2e')](db[_0xfd6a('0x2f')][_0xfd6a('0x30')],function(_0x131a8e){return{'name':_0x131a8e['fieldName'],'type':_0x131a8e[_0xfd6a('0x31')][_0xfd6a('0x32')]};});_0x47047b['model']=_[_0xfd6a('0x2e')](_0x1af22d,'name');_0x47047b[_0xfd6a('0x33')]=_[_0xfd6a('0x34')](_0x579b62[_0xfd6a('0x33')]);_0x47047b[_0xfd6a('0x35')]=_[_0xfd6a('0x36')](_0x47047b['model'],_0x47047b[_0xfd6a('0x33')]);_0xb6a840[_0xfd6a('0x37')]=_[_0xfd6a('0x36')](_0x47047b['model'],qs[_0xfd6a('0x38')](_0x579b62['query'][_0xfd6a('0x38')]));_0xb6a840[_0xfd6a('0x37')]=_0xb6a840[_0xfd6a('0x37')]['length']?_0xb6a840[_0xfd6a('0x37')]:_0x47047b[_0xfd6a('0x39')];if(!_0x579b62[_0xfd6a('0x33')][_0xfd6a('0x3a')]('nolimit')){_0xb6a840[_0xfd6a('0x1f')]=qs[_0xfd6a('0x1f')](_0x579b62['query'][_0xfd6a('0x1f')]);_0xb6a840[_0xfd6a('0x1e')]=qs[_0xfd6a('0x1e')](_0x579b62[_0xfd6a('0x33')][_0xfd6a('0x1e')]);}_0xb6a840[_0xfd6a('0x3b')]=qs[_0xfd6a('0x3c')](_0x579b62[_0xfd6a('0x33')][_0xfd6a('0x3c')]);_0xb6a840[_0xfd6a('0x3d')]=qs[_0xfd6a('0x35')](_[_0xfd6a('0x3e')](_0x579b62[_0xfd6a('0x33')],_0x47047b[_0xfd6a('0x35')]),_0x1af22d);if(_0x579b62[_0xfd6a('0x33')]['filter']){_0xb6a840[_0xfd6a('0x3d')]=_['merge'](_0xb6a840['where'],{'$or':_[_0xfd6a('0x2e')](_0x1af22d,function(_0x5acad2){if(_0x5acad2[_0xfd6a('0x31')]!==_0xfd6a('0x3f')){var _0xf977e2={};_0xf977e2[_0x5acad2[_0xfd6a('0x2b')]]={'$like':'%'+_0x579b62['query'][_0xfd6a('0x40')]+'%'};return _0xf977e2;}})});}_0xb6a840=_[_0xfd6a('0x41')]({},_0xb6a840,_0x579b62[_0xfd6a('0x42')]);var _0x1f951={'where':_0xb6a840[_0xfd6a('0x3d')]};return db[_0xfd6a('0x2f')][_0xfd6a('0x1d')](_0x1f951)[_0xfd6a('0x25')](function(_0x2c3050){_0x2355dd[_0xfd6a('0x1d')]=_0x2c3050;if(_0x579b62['query'][_0xfd6a('0x43')]){_0xb6a840[_0xfd6a('0x44')]=[{'all':!![]}];}return db[_0xfd6a('0x2f')][_0xfd6a('0x45')](_0xb6a840);})['then'](function(_0x5d6113){_0x2355dd[_0xfd6a('0x46')]=_0x5d6113;return _0x2355dd;})['then'](respondWithFilteredResult(_0x1ce73e,_0xb6a840))[_0xfd6a('0x47')](handleError(_0x1ce73e,null));};exports[_0xfd6a('0x48')]=function(_0x5d0b33,_0x2d3daf){var _0x432ba2={'raw':!![],'where':{'id':_0x5d0b33[_0xfd6a('0x49')]['id']}},_0x3a3905={};_0x3a3905[_0xfd6a('0x39')]=_[_0xfd6a('0x34')](db[_0xfd6a('0x2f')]['rawAttributes']);_0x3a3905[_0xfd6a('0x33')]=_['keys'](_0x5d0b33[_0xfd6a('0x33')]);_0x3a3905[_0xfd6a('0x35')]=_[_0xfd6a('0x36')](_0x3a3905[_0xfd6a('0x39')],_0x3a3905[_0xfd6a('0x33')]);_0x432ba2[_0xfd6a('0x37')]=_[_0xfd6a('0x36')](_0x3a3905[_0xfd6a('0x39')],qs[_0xfd6a('0x38')](_0x5d0b33['query'][_0xfd6a('0x38')]));_0x432ba2['attributes']=_0x432ba2[_0xfd6a('0x37')][_0xfd6a('0x4a')]?_0x432ba2[_0xfd6a('0x37')]:_0x3a3905[_0xfd6a('0x39')];if(_0x5d0b33[_0xfd6a('0x33')][_0xfd6a('0x43')]){_0x432ba2['include']=[{'all':!![]}];}_0x432ba2=_[_0xfd6a('0x41')]({},_0x432ba2,_0x5d0b33[_0xfd6a('0x42')]);return db[_0xfd6a('0x2f')]['find'](_0x432ba2)['then'](handleEntityNotFound(_0x2d3daf,null))['then'](respondWithResult(_0x2d3daf,null))['catch'](handleError(_0x2d3daf,null));};exports[_0xfd6a('0x4b')]=function(_0x162ecd,_0x5aeeb5){return db[_0xfd6a('0x2f')][_0xfd6a('0x4b')](_0x162ecd[_0xfd6a('0x4c')],{})[_0xfd6a('0x25')](function(_0x2ed9a6){var _0x3a2332=_0x162ecd[_0xfd6a('0x4d')]['get']({'plain':!![]});if(!_0x3a2332)throw new Error(_0xfd6a('0x4e'));if(_0x3a2332[_0xfd6a('0x4f')]===_0xfd6a('0x4d')){var _0x5b5204=_0x2ed9a6[_0xfd6a('0x26')]({'plain':!![]});var _0x35fef8=_0xfd6a('0x50');return db[_0xfd6a('0x51')]['find']({'where':{'name':_0x35fef8,'userProfileId':_0x3a2332[_0xfd6a('0x52')]},'raw':!![]})[_0xfd6a('0x25')](function(_0xfea657){if(_0xfea657&&_0xfea657[_0xfd6a('0x53')]===0x0){return db[_0xfd6a('0x27')][_0xfd6a('0x4b')]({'name':_0x5b5204['name'],'resourceId':_0x5b5204['id'],'type':_0xfea657[_0xfd6a('0x2b')],'sectionId':_0xfea657['id']},{})['then'](function(){return _0x2ed9a6;});}else{return _0x2ed9a6;}})['catch'](function(_0x17bf9f){logger[_0xfd6a('0x29')](_0xfd6a('0x54'),_0x17bf9f);throw _0x17bf9f;});}return _0x2ed9a6;})[_0xfd6a('0x25')](respondWithResult(_0x5aeeb5,0xc9))[_0xfd6a('0x47')](handleError(_0x5aeeb5,null));};exports[_0xfd6a('0x24')]=function(_0x47a49e,_0x2b5bdf){if(_0x47a49e[_0xfd6a('0x4c')]['id']){delete _0x47a49e[_0xfd6a('0x4c')]['id'];}return db[_0xfd6a('0x2f')][_0xfd6a('0x55')]({'where':{'id':_0x47a49e[_0xfd6a('0x49')]['id']}})[_0xfd6a('0x25')](handleEntityNotFound(_0x2b5bdf,null))[_0xfd6a('0x25')](saveUpdates(_0x47a49e['body'],null))[_0xfd6a('0x25')](respondWithResult(_0x2b5bdf,null))[_0xfd6a('0x47')](handleError(_0x2b5bdf,null));};exports[_0xfd6a('0x28')]=function(_0x493966,_0x2ff112){return db[_0xfd6a('0x2f')][_0xfd6a('0x55')]({'where':{'id':_0x493966[_0xfd6a('0x49')]['id']}})[_0xfd6a('0x25')](handleEntityNotFound(_0x2ff112,null))[_0xfd6a('0x25')](removeEntity(_0x2ff112,null))[_0xfd6a('0x47')](handleError(_0x2ff112,null));};exports[_0xfd6a('0x56')]=function(_0xe0becc,_0x531ce5){return db[_0xfd6a('0x2f')][_0xfd6a('0x56')]()[_0xfd6a('0x25')](respondWithResult(_0x531ce5,null))[_0xfd6a('0x47')](handleError(_0x531ce5,null));};exports[_0xfd6a('0x57')]=function(_0x12652d,_0x109db2,_0x1c31ac){var _0x5e46d6={'raw':!![],'where':{}},_0x307fd8={},_0x307efb;return db[_0xfd6a('0x2f')][_0xfd6a('0x58')]({'where':{'id':_0x12652d[_0xfd6a('0x49')]['id']}})[_0xfd6a('0x25')](handleEntityNotFound(_0x109db2,null))[_0xfd6a('0x25')](function(_0x5e3899){if(_0x5e3899){_0x307efb=_0x5e3899['get']({'plain':!![]});_0x307fd8[_0xfd6a('0x39')]=_[_0xfd6a('0x34')](db[_0xfd6a('0x59')]['rawAttributes']);_0x307fd8[_0xfd6a('0x33')]=_['keys'](_0x12652d[_0xfd6a('0x33')]);_0x307fd8[_0xfd6a('0x35')]=_[_0xfd6a('0x36')](_0x307fd8['model'],_0x307fd8[_0xfd6a('0x33')]);_0x5e46d6['attributes']=_[_0xfd6a('0x36')](_0x307fd8['model'],qs[_0xfd6a('0x38')](_0x12652d[_0xfd6a('0x33')][_0xfd6a('0x38')]));_0x5e46d6[_0xfd6a('0x37')]=_0x5e46d6[_0xfd6a('0x37')][_0xfd6a('0x4a')]?_0x5e46d6[_0xfd6a('0x37')]:_0x307fd8[_0xfd6a('0x39')];if(!_0x12652d[_0xfd6a('0x33')]['hasOwnProperty'](_0xfd6a('0x5a'))){_0x5e46d6['limit']=qs['limit'](_0x12652d['query'][_0xfd6a('0x1f')]);_0x5e46d6[_0xfd6a('0x1e')]=qs['offset'](_0x12652d[_0xfd6a('0x33')]['offset']);}_0x5e46d6[_0xfd6a('0x3b')]=qs['sort'](_0x12652d['query']['sort']);_0x5e46d6['where']=qs[_0xfd6a('0x35')](_[_0xfd6a('0x3e')](_0x12652d[_0xfd6a('0x33')],_0x307fd8[_0xfd6a('0x35')]));_0x5e46d6[_0xfd6a('0x3d')][_0xfd6a('0x5b')]=_0x5e3899['id'];if(_0x12652d['query'][_0xfd6a('0x40')]){_0x5e46d6[_0xfd6a('0x3d')]=_[_0xfd6a('0x41')](_0x5e46d6[_0xfd6a('0x3d')],{'$or':_[_0xfd6a('0x2e')](_0x5e46d6[_0xfd6a('0x37')],function(_0x2791bb){var _0x396c9c={};_0x396c9c[_0x2791bb]={'$like':'%'+_0x12652d['query']['filter']+'%'};return _0x396c9c;})});}_0x5e46d6=_[_0xfd6a('0x41')]({},_0x5e46d6,_0x12652d['options']);return db[_0xfd6a('0x59')][_0xfd6a('0x45')](_0x5e46d6);}})[_0xfd6a('0x25')](function(_0x365ccb){if(_0x365ccb){return db[_0xfd6a('0x5c')][_0xfd6a('0x5d')]({'where':{'id':_[_0xfd6a('0x2e')](_0x365ccb,_0xfd6a('0x5e')),'role':_0xfd6a('0x5f')},'attributes':['id',_0xfd6a('0x2b'),_0xfd6a('0x60'),_0xfd6a('0x61'),'createdAt']});}})[_0xfd6a('0x25')](function(_0xc00348){if(_0xc00348){return{'count':_0xc00348['count'],'rows':_[_0xfd6a('0x2e')](_0xc00348[_0xfd6a('0x46')],function(_0x436997){return{'membername':_0x436997['name'],'UserId':_0x436997['id'],'queue_name':_0x307efb[_0xfd6a('0x2b')],'WhatsappQueueId':_0x307efb['id'],'interface':util[_0xfd6a('0x62')](_0xfd6a('0x63'),'SIP',_0x436997[_0xfd6a('0x2b')]),'penalty':0x0,'paused':_0x436997['whatsappPause'],'createdAt':_0x436997[_0xfd6a('0x64')],'updatedAt':_0x436997[_0xfd6a('0x61')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x109db2,_0x5e46d6))[_0xfd6a('0x47')](handleError(_0x109db2,null));};exports[_0xfd6a('0x65')]=function(_0x6d4a48,_0x521fd6,_0x380f07){var _0x3fd756={};var _0x1cd466={};var _0x5a3068;var _0x4cf77f;return db[_0xfd6a('0x2f')][_0xfd6a('0x58')]({'where':{'id':_0x6d4a48['params']['id']}})[_0xfd6a('0x25')](handleEntityNotFound(_0x521fd6,null))['then'](function(_0x2e14b8){if(_0x2e14b8){_0x5a3068=_0x2e14b8;_0x1cd466['model']=_[_0xfd6a('0x34')](db[_0xfd6a('0x66')]['rawAttributes']);_0x1cd466['query']=_[_0xfd6a('0x34')](_0x6d4a48['query']);_0x1cd466[_0xfd6a('0x35')]=_[_0xfd6a('0x36')](_0x1cd466[_0xfd6a('0x39')],_0x1cd466[_0xfd6a('0x33')]);_0x3fd756[_0xfd6a('0x37')]=_[_0xfd6a('0x36')](_0x1cd466[_0xfd6a('0x39')],qs[_0xfd6a('0x38')](_0x6d4a48[_0xfd6a('0x33')][_0xfd6a('0x38')]));_0x3fd756['attributes']=_0x3fd756[_0xfd6a('0x37')][_0xfd6a('0x4a')]?_0x3fd756[_0xfd6a('0x37')]:_0x1cd466['model'];_0x3fd756[_0xfd6a('0x3b')]=qs[_0xfd6a('0x3c')](_0x6d4a48[_0xfd6a('0x33')]['sort']);_0x3fd756[_0xfd6a('0x3d')]=qs[_0xfd6a('0x35')](_['pick'](_0x6d4a48[_0xfd6a('0x33')],_0x1cd466['filters']));if(_0x6d4a48['query'][_0xfd6a('0x40')]){_0x3fd756[_0xfd6a('0x3d')]=_[_0xfd6a('0x41')](_0x3fd756[_0xfd6a('0x3d')],{'$or':_['map'](_0x3fd756[_0xfd6a('0x37')],function(_0x400d76){var _0x5dfb8c={};_0x5dfb8c[_0x400d76]={'$like':'%'+_0x6d4a48[_0xfd6a('0x33')]['filter']+'%'};return _0x5dfb8c;})});}_0x3fd756=_[_0xfd6a('0x41')]({},_0x3fd756,_0x6d4a48[_0xfd6a('0x42')]);return _0x5a3068['getTeams'](_0x3fd756);}})[_0xfd6a('0x25')](function(_0x1103da){if(_0x1103da){_0x4cf77f=_0x1103da['length'];if(!_0x6d4a48['query'][_0xfd6a('0x3a')](_0xfd6a('0x5a'))){_0x3fd756[_0xfd6a('0x1f')]=qs[_0xfd6a('0x1f')](_0x6d4a48[_0xfd6a('0x33')]['limit']);_0x3fd756['offset']=qs['offset'](_0x6d4a48[_0xfd6a('0x33')]['offset']);}return _0x5a3068[_0xfd6a('0x65')](_0x3fd756);}})['then'](function(_0x2e304b){if(_0x2e304b){return _0x2e304b?{'count':_0x4cf77f,'rows':_0x2e304b}:null;}})[_0xfd6a('0x25')](respondWithResult(_0x521fd6,null))[_0xfd6a('0x47')](handleError(_0x521fd6,null));};exports['addTeams']=function(_0x4fde29,_0xeda47e,_0x539b75){var _0x3dc243=_0x4fde29[_0xfd6a('0x4c')][_0xfd6a('0x67')];return db[_0xfd6a('0x66')][_0xfd6a('0x45')]({'where':{'id':_0x3dc243},'attributes':['id'],'include':[{'model':db['User'],'as':_0xfd6a('0x68'),'attributes':['id',_0xfd6a('0x2b'),_0xfd6a('0x69'),_0xfd6a('0x6a'),_0xfd6a('0x6b')],'raw':!![]}]})['then'](function(_0x13c8c9){if(_0x13c8c9){var _0x1e8eb2=_[_0xfd6a('0x6c')](_0x13c8c9,function(_0x5aa572){var _0x58709c=_0x5aa572['get']({'plain':!![]});return _0x58709c[_0xfd6a('0x68')];});return db['WhatsappQueue']['find']({'where':{'id':_0x4fde29['params']['id']}})['then'](function(_0x15aff6){return db[_0xfd6a('0x6d')]['transaction'](function(_0x388309){return _0x15aff6['addTeams'](_0x3dc243,{'transaction':_0x388309})[_0xfd6a('0x25')](function(){return BPromise[_0xfd6a('0x6e')](_0x1e8eb2,function(_0x290071){return db[_0xfd6a('0x59')][_0xfd6a('0x6f')]({'where':{'UserId':_0x290071['id'],'WhatsappQueueId':_0x4fde29['params']['id']},'transaction':_0x388309});});})[_0xfd6a('0x25')](function(){_0x1e8eb2[_0xfd6a('0x70')](function(_0x2be70b){socket[_0xfd6a('0x71')](_0xfd6a('0x72'),{'UserId':_0x2be70b['id'],'WhatsappQueueId':_0x15aff6['id']});});});});});}})[_0xfd6a('0x25')](respondWithStatusCode(_0xeda47e,null))[_0xfd6a('0x47')](handleError(_0xeda47e,null));};exports[_0xfd6a('0x73')]=function(_0x5b111b,_0x5338f6,_0x17ee86){return db[_0xfd6a('0x66')][_0xfd6a('0x45')]({'where':{'id':_0x5b111b[_0xfd6a('0x33')]['ids']},'attributes':['id'],'include':[{'model':db[_0xfd6a('0x5c')],'as':_0xfd6a('0x68'),'attributes':['id'],'raw':!![]}]})[_0xfd6a('0x25')](handleEntityNotFound(_0x5338f6,null))[_0xfd6a('0x25')](function(_0x23df31){var _0x545b3b=_[_0xfd6a('0x2e')](_0x23df31,'id');var _0x3c4bf6=[];var _0x2c26bc=[];var _0x2b586e=squel[_0xfd6a('0x74')]();_0x2b586e[_0xfd6a('0x75')]('tq.TeamId')[_0xfd6a('0x76')](_0xfd6a('0x77'),'tq')[_0xfd6a('0x78')]('user_has_teams','ut','ut.TeamId\x20=\x20tq.TeamId')[_0xfd6a('0x3d')](_0xfd6a('0x79'),_0x5b111b[_0xfd6a('0x49')]['id']);for(var _0x5a86b7=0x0;_0x5a86b7<_0x23df31[_0xfd6a('0x4a')];_0x5a86b7+=0x1){let _0x1bc46d=_0x23df31[_0x5a86b7];for(var _0x3253b6=0x0;_0x3253b6<_0x1bc46d['Agents'][_0xfd6a('0x4a')];_0x3253b6+=0x1){let _0x1907d7=_0x1bc46d[_0xfd6a('0x68')][_0x3253b6];var _0x86975a=_0x2b586e[_0xfd6a('0x7a')]();_0x86975a[_0xfd6a('0x3d')](_0xfd6a('0x7b'),_0x1907d7['id']);_0x2c26bc[_0xfd6a('0x7c')](db[_0xfd6a('0x6d')]['query'](_0x86975a[_0xfd6a('0x7d')](),{'type':db[_0xfd6a('0x6d')][_0xfd6a('0x7e')][_0xfd6a('0x7f')]})[_0xfd6a('0x25')](function(_0x5d5307){if(_0x5d5307[_0xfd6a('0x4a')]===0x1){return _0x1907d7['id'];}else{var _0x1d6610=_['every'](_['map'](_0x5d5307,'TeamId'),function(_0x37bdae){return _[_0xfd6a('0x80')](_0x545b3b,_0x37bdae);});if(_0x1d6610){return _0x1907d7['id'];}}}));}}return BPromise[_0xfd6a('0x81')](_0x2c26bc)['then'](function(_0x3ab317){_0x3c4bf6=_(_0x3c4bf6)['union'](_0x3ab317)[_0xfd6a('0x82')]()[_0xfd6a('0x83')]();return db['WhatsappQueue'][_0xfd6a('0x55')]({'where':{'id':_0x5b111b[_0xfd6a('0x49')]['id']}})[_0xfd6a('0x25')](function(_0xe68c45){return db[_0xfd6a('0x6d')][_0xfd6a('0x84')](function(_0x5ad36a){return _0xe68c45[_0xfd6a('0x73')](_0x5b111b[_0xfd6a('0x33')][_0xfd6a('0x67')],{'transaction':_0x5ad36a})[_0xfd6a('0x25')](function(){if(!_['isEmpty'](_0x3c4bf6)){return _0xe68c45[_0xfd6a('0x85')](_0x3c4bf6,{'transaction':_0x5ad36a});}})[_0xfd6a('0x25')](function(){_0x3c4bf6[_0xfd6a('0x70')](function(_0x2b5aff){socket[_0xfd6a('0x71')](_0xfd6a('0x86'),{'UserId':_0x2b5aff,'WhatsappQueueId':_0xe68c45['id']});});});});});});})[_0xfd6a('0x25')](respondWithStatusCode(_0x5338f6,null))[_0xfd6a('0x47')](handleError(_0x5338f6,null));};exports[_0xfd6a('0x87')]=function(_0x245991,_0x430c5d,_0x3b9598){return db[_0xfd6a('0x2f')]['find']({'where':{'id':_0x245991[_0xfd6a('0x49')]['id']}})[_0xfd6a('0x25')](handleEntityNotFound(_0x430c5d,null))[_0xfd6a('0x25')](function(_0x335c97){if(_0x335c97){return _0x335c97[_0xfd6a('0x87')](_0x245991[_0xfd6a('0x4c')][_0xfd6a('0x67')],_[_0xfd6a('0x88')](_0x245991[_0xfd6a('0x4c')],[_0xfd6a('0x67'),'id'])||{})[_0xfd6a('0x89')](function(_0x6937a7){for(var _0x39b6d8=0x0;_0x39b6d8<_0x245991[_0xfd6a('0x4c')][_0xfd6a('0x67')][_0xfd6a('0x4a')];_0x39b6d8+=0x1){socket['emit'](_0xfd6a('0x72'),{'UserId':Number(_0x245991[_0xfd6a('0x4c')][_0xfd6a('0x67')][_0x39b6d8]),'WhatsappQueueId':Number(_0x245991['params']['id'])});}return _0x6937a7;});}})['then'](respondWithResult(_0x430c5d,null))[_0xfd6a('0x47')](handleError(_0x430c5d,null));};exports[_0xfd6a('0x85')]=function(_0x367602,_0x4f5a89,_0x201141){return db[_0xfd6a('0x2f')][_0xfd6a('0x55')]({'where':{'id':_0x367602[_0xfd6a('0x49')]['id']}})[_0xfd6a('0x25')](handleEntityNotFound(_0x4f5a89,null))['then'](function(_0x49ac84){if(_0x49ac84){return _0x49ac84[_0xfd6a('0x85')](_0x367602[_0xfd6a('0x33')]['ids'])[_0xfd6a('0x25')](function(){if(_[_0xfd6a('0x8a')](_0x367602[_0xfd6a('0x33')]['ids'])){for(var _0x5eb9cf=0x0;_0x5eb9cf<_0x367602[_0xfd6a('0x33')]['ids'][_0xfd6a('0x4a')];_0x5eb9cf+=0x1){socket[_0xfd6a('0x71')]('userWhatsappQueue:remove',{'UserId':Number(_0x367602[_0xfd6a('0x33')][_0xfd6a('0x67')][_0x5eb9cf]),'WhatsappQueueId':Number(_0x367602['params']['id'])});}}else{socket[_0xfd6a('0x71')](_0xfd6a('0x86'),{'UserId':Number(_0x367602['query']['ids']),'WhatsappQueueId':Number(_0x367602[_0xfd6a('0x49')]['id'])});}});}})[_0xfd6a('0x25')](respondWithStatusCode(_0x4f5a89,null))['catch'](handleError(_0x4f5a89,null));};exports[_0xfd6a('0x8b')]=function(_0xbc5d9f,_0x4b6ac8,_0x40b591){var _0x4ccc03={};var _0xe44466={};var _0x599d74;var _0x4d570c;return db[_0xfd6a('0x2f')][_0xfd6a('0x58')]({'where':{'id':_0xbc5d9f[_0xfd6a('0x49')]['id']}})[_0xfd6a('0x25')](handleEntityNotFound(_0x4b6ac8,null))[_0xfd6a('0x25')](function(_0xd3af87){if(_0xd3af87){_0x599d74=_0xd3af87;_0xe44466[_0xfd6a('0x39')]=_[_0xfd6a('0x34')](db['User'][_0xfd6a('0x30')]);_0xe44466[_0xfd6a('0x33')]=_['keys'](_0xbc5d9f[_0xfd6a('0x33')]);_0xe44466[_0xfd6a('0x35')]=_[_0xfd6a('0x36')](_0xe44466[_0xfd6a('0x39')],_0xe44466[_0xfd6a('0x33')]);_0x4ccc03[_0xfd6a('0x37')]=_[_0xfd6a('0x36')](_0xe44466[_0xfd6a('0x39')],qs[_0xfd6a('0x38')](_0xbc5d9f[_0xfd6a('0x33')]['fields']));_0x4ccc03[_0xfd6a('0x37')]=_0x4ccc03['attributes']['length']?_0x4ccc03[_0xfd6a('0x37')]:_0xe44466[_0xfd6a('0x39')];_0x4ccc03[_0xfd6a('0x3b')]=qs[_0xfd6a('0x3c')](_0xbc5d9f[_0xfd6a('0x33')][_0xfd6a('0x3c')]);_0x4ccc03['where']=qs[_0xfd6a('0x35')](_[_0xfd6a('0x3e')](_0xbc5d9f[_0xfd6a('0x33')],_0xe44466[_0xfd6a('0x35')]));if(_0xbc5d9f[_0xfd6a('0x33')][_0xfd6a('0x40')]){_0x4ccc03[_0xfd6a('0x3d')]=_[_0xfd6a('0x41')](_0x4ccc03[_0xfd6a('0x3d')],{'$or':_[_0xfd6a('0x2e')](_0x4ccc03[_0xfd6a('0x37')],function(_0x40940f){var _0x17d4f0={};_0x17d4f0[_0x40940f]={'$like':'%'+_0xbc5d9f[_0xfd6a('0x33')]['filter']+'%'};return _0x17d4f0;})});}_0x4ccc03=_['merge']({},_0x4ccc03,_0xbc5d9f['options']);return _0x599d74[_0xfd6a('0x8b')](_0x4ccc03);}})[_0xfd6a('0x25')](function(_0x312d2a){if(_0x312d2a){_0x4d570c=_0x312d2a['length'];if(!_0xbc5d9f[_0xfd6a('0x33')][_0xfd6a('0x3a')](_0xfd6a('0x5a'))){_0x4ccc03[_0xfd6a('0x1f')]=qs[_0xfd6a('0x1f')](_0xbc5d9f[_0xfd6a('0x33')]['limit']);_0x4ccc03[_0xfd6a('0x1e')]=qs['offset'](_0xbc5d9f[_0xfd6a('0x33')][_0xfd6a('0x1e')]);}return _0x599d74['getAgents'](_0x4ccc03);}})[_0xfd6a('0x25')](function(_0x3f65f9){if(_0x3f65f9){return _0x3f65f9?{'count':_0x4d570c,'rows':_0x3f65f9}:null;}})[_0xfd6a('0x25')](respondWithResult(_0x4b6ac8,null))[_0xfd6a('0x47')](handleError(_0x4b6ac8,null));}; \ No newline at end of file +var _0xf5d9=['QueryTypes','SELECT','every','TeamId','includes','all','union','compact','value','isEmpty','removeAgents','userWhatsappQueue:remove','addAgents','omit','spread','isArray','getAgents','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./whatsappQueue.socket','sendStatus','end','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','get','WhatsappQueues','UserProfileResource','name','index','map','WhatsappQueue','fieldName','key','model','keys','filters','intersection','query','attributes','fields','hasOwnProperty','nolimit','order','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','length','find','create','body','user','role','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','findOne','UserWhatsappQueue','rawAttributes','sort','WhatsappQueueId','User','findAndCountAll','UserId','agent','whatsappPause','updatedAt','createdAt','format','%s/%s','SIP','getTeams','Team','ids','Agents','online','interface','flatMap','sequelize','transaction','each','findOrCreate','forEach','emit','userWhatsappQueue:save','removeTeams','select','field','team_has_whatsapp_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','WhatsappQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString'];(function(_0x361801,_0x993729){var _0x174182=function(_0x13094a){while(--_0x13094a){_0x361801['push'](_0x361801['shift']());}};_0x174182(++_0x993729);}(_0xf5d9,0x1c4));var _0x9f5d=function(_0x243217,_0x522951){_0x243217=_0x243217-0x0;var _0x478029=_0xf5d9[_0x243217];return _0x478029;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9f5d('0x0'));var zipdir=require(_0x9f5d('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x9f5d('0x2'));var moment=require(_0x9f5d('0x3'));var BPromise=require(_0x9f5d('0x4'));var Mustache=require(_0x9f5d('0x5'));var util=require('util');var path=require(_0x9f5d('0x6'));var sox=require(_0x9f5d('0x7'));var csv=require(_0x9f5d('0x8'));var ejs=require(_0x9f5d('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x9f5d('0xa'));var squel=require(_0x9f5d('0xb'));var crypto=require(_0x9f5d('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x9f5d('0xd'));var Redis=require(_0x9f5d('0xe'));var authService=require(_0x9f5d('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9f5d('0x10'));var logger=require(_0x9f5d('0x11'))(_0x9f5d('0x12'));var utils=require(_0x9f5d('0x13'));var config=require(_0x9f5d('0x14'));var licenseUtil=require(_0x9f5d('0x15'));var db=require(_0x9f5d('0x16'))['db'];config[_0x9f5d('0x17')]=_[_0x9f5d('0x18')](config['redis'],{'host':_0x9f5d('0x19'),'port':0x18eb});var socket=require(_0x9f5d('0x1a'))(new Redis(config[_0x9f5d('0x17')]));require(_0x9f5d('0x1b'))['register'](socket);function respondWithStatusCode(_0x415581,_0x2d61a1){_0x2d61a1=_0x2d61a1||0xcc;return function(_0x4ffa1e){if(_0x4ffa1e){return _0x415581[_0x9f5d('0x1c')](_0x2d61a1);}return _0x415581['status'](_0x2d61a1)[_0x9f5d('0x1d')]();};}function respondWithResult(_0x58a571,_0x135de0){_0x135de0=_0x135de0||0xc8;return function(_0x547150){if(_0x547150){return _0x58a571[_0x9f5d('0x1e')](_0x135de0)[_0x9f5d('0x1f')](_0x547150);}};}function respondWithFilteredResult(_0x1770d6,_0x418f97){return function(_0x246486){if(_0x246486){var _0x1b09a8=typeof _0x418f97[_0x9f5d('0x20')]===_0x9f5d('0x21')&&typeof _0x418f97[_0x9f5d('0x22')]===_0x9f5d('0x21');var _0x2d97e0=_0x246486[_0x9f5d('0x23')];var _0x104c7b=_0x1b09a8?0x0:_0x418f97[_0x9f5d('0x20')];var _0x5c923d=_0x1b09a8?_0x246486[_0x9f5d('0x23')]:_0x418f97[_0x9f5d('0x20')]+_0x418f97[_0x9f5d('0x22')];var _0x17d34b;if(_0x5c923d>=_0x2d97e0){_0x5c923d=_0x2d97e0;_0x17d34b=0xc8;}else{_0x17d34b=0xce;}_0x1770d6[_0x9f5d('0x1e')](_0x17d34b);return _0x1770d6['set'](_0x9f5d('0x24'),_0x104c7b+'-'+_0x5c923d+'/'+_0x2d97e0)[_0x9f5d('0x1f')](_0x246486);}return null;};}function patchUpdates(_0x5cbfb5){return function(_0x3c713c){try{jsonpatch[_0x9f5d('0x25')](_0x3c713c,_0x5cbfb5,!![]);}catch(_0x452c84){return BPromise[_0x9f5d('0x26')](_0x452c84);}return _0x3c713c[_0x9f5d('0x27')]();};}function saveUpdates(_0x208adf,_0x3578e8){return function(_0x432862){if(_0x432862){return _0x432862[_0x9f5d('0x28')](_0x208adf)[_0x9f5d('0x29')](function(_0x3c1ed6){return _0x3c1ed6;});}return null;};}function removeEntity(_0x40a0aa,_0x250461){return function(_0xd3eb75){if(_0xd3eb75){return _0xd3eb75[_0x9f5d('0x2a')]()[_0x9f5d('0x29')](function(){var _0x1aca36=_0xd3eb75[_0x9f5d('0x2b')]({'plain':!![]});var _0x30a9df=_0x9f5d('0x2c');return db[_0x9f5d('0x2d')][_0x9f5d('0x2a')]({'where':{'type':_0x30a9df,'resourceId':_0x1aca36['id']}})[_0x9f5d('0x29')](function(){return _0xd3eb75;});})['then'](function(){_0x40a0aa[_0x9f5d('0x1e')](0xcc)[_0x9f5d('0x1d')]();});}};}function handleEntityNotFound(_0x2b3704,_0xe75205){return function(_0x16f746){if(!_0x16f746){_0x2b3704['sendStatus'](0x194);}return _0x16f746;};}function handleError(_0x2ef8a2,_0x232b7e){_0x232b7e=_0x232b7e||0x1f4;return function(_0x314814){logger['error'](_0x314814['stack']);if(_0x314814[_0x9f5d('0x2e')]){delete _0x314814[_0x9f5d('0x2e')];}_0x2ef8a2[_0x9f5d('0x1e')](_0x232b7e)['send'](_0x314814);};}exports[_0x9f5d('0x2f')]=function(_0x658591,_0x6d8a33){var _0x5dec7c={},_0x266d68={},_0x48203f={'count':0x0,'rows':[]};var _0x23f4c9=_[_0x9f5d('0x30')](db[_0x9f5d('0x31')]['rawAttributes'],function(_0x3766d1){return{'name':_0x3766d1[_0x9f5d('0x32')],'type':_0x3766d1['type'][_0x9f5d('0x33')]};});_0x266d68[_0x9f5d('0x34')]=_[_0x9f5d('0x30')](_0x23f4c9,'name');_0x266d68['query']=_[_0x9f5d('0x35')](_0x658591['query']);_0x266d68[_0x9f5d('0x36')]=_[_0x9f5d('0x37')](_0x266d68[_0x9f5d('0x34')],_0x266d68[_0x9f5d('0x38')]);_0x5dec7c[_0x9f5d('0x39')]=_[_0x9f5d('0x37')](_0x266d68[_0x9f5d('0x34')],qs['fields'](_0x658591[_0x9f5d('0x38')][_0x9f5d('0x3a')]));_0x5dec7c[_0x9f5d('0x39')]=_0x5dec7c[_0x9f5d('0x39')]['length']?_0x5dec7c['attributes']:_0x266d68['model'];if(!_0x658591[_0x9f5d('0x38')][_0x9f5d('0x3b')](_0x9f5d('0x3c'))){_0x5dec7c[_0x9f5d('0x22')]=qs[_0x9f5d('0x22')](_0x658591[_0x9f5d('0x38')]['limit']);_0x5dec7c[_0x9f5d('0x20')]=qs[_0x9f5d('0x20')](_0x658591['query']['offset']);}_0x5dec7c[_0x9f5d('0x3d')]=qs['sort'](_0x658591['query']['sort']);_0x5dec7c[_0x9f5d('0x3e')]=qs['filters'](_[_0x9f5d('0x3f')](_0x658591[_0x9f5d('0x38')],_0x266d68[_0x9f5d('0x36')]),_0x23f4c9);if(_0x658591[_0x9f5d('0x38')][_0x9f5d('0x40')]){_0x5dec7c[_0x9f5d('0x3e')]=_[_0x9f5d('0x41')](_0x5dec7c[_0x9f5d('0x3e')],{'$or':_['map'](_0x23f4c9,function(_0xf896c3){if(_0xf896c3['type']!==_0x9f5d('0x42')){var _0xa1d5ee={};_0xa1d5ee[_0xf896c3[_0x9f5d('0x2e')]]={'$like':'%'+_0x658591['query'][_0x9f5d('0x40')]+'%'};return _0xa1d5ee;}})});}_0x5dec7c=_[_0x9f5d('0x41')]({},_0x5dec7c,_0x658591[_0x9f5d('0x43')]);var _0x483081={'where':_0x5dec7c[_0x9f5d('0x3e')]};return db[_0x9f5d('0x31')][_0x9f5d('0x23')](_0x483081)[_0x9f5d('0x29')](function(_0x3ca3cd){_0x48203f[_0x9f5d('0x23')]=_0x3ca3cd;if(_0x658591[_0x9f5d('0x38')][_0x9f5d('0x44')]){_0x5dec7c[_0x9f5d('0x45')]=[{'all':!![]}];}return db['WhatsappQueue'][_0x9f5d('0x46')](_0x5dec7c);})[_0x9f5d('0x29')](function(_0x58891c){_0x48203f[_0x9f5d('0x47')]=_0x58891c;return _0x48203f;})[_0x9f5d('0x29')](respondWithFilteredResult(_0x6d8a33,_0x5dec7c))[_0x9f5d('0x48')](handleError(_0x6d8a33,null));};exports[_0x9f5d('0x49')]=function(_0x6c002d,_0x15d186){var _0x1826e1={'raw':!![],'where':{'id':_0x6c002d[_0x9f5d('0x4a')]['id']}},_0xf94992={};_0xf94992[_0x9f5d('0x34')]=_[_0x9f5d('0x35')](db[_0x9f5d('0x31')]['rawAttributes']);_0xf94992[_0x9f5d('0x38')]=_[_0x9f5d('0x35')](_0x6c002d[_0x9f5d('0x38')]);_0xf94992[_0x9f5d('0x36')]=_[_0x9f5d('0x37')](_0xf94992['model'],_0xf94992[_0x9f5d('0x38')]);_0x1826e1['attributes']=_[_0x9f5d('0x37')](_0xf94992['model'],qs['fields'](_0x6c002d['query'][_0x9f5d('0x3a')]));_0x1826e1[_0x9f5d('0x39')]=_0x1826e1[_0x9f5d('0x39')][_0x9f5d('0x4b')]?_0x1826e1['attributes']:_0xf94992[_0x9f5d('0x34')];if(_0x6c002d[_0x9f5d('0x38')]['includeAll']){_0x1826e1['include']=[{'all':!![]}];}_0x1826e1=_[_0x9f5d('0x41')]({},_0x1826e1,_0x6c002d[_0x9f5d('0x43')]);return db[_0x9f5d('0x31')][_0x9f5d('0x4c')](_0x1826e1)['then'](handleEntityNotFound(_0x15d186,null))['then'](respondWithResult(_0x15d186,null))[_0x9f5d('0x48')](handleError(_0x15d186,null));};exports['create']=function(_0x340a41,_0x27b5e1){return db[_0x9f5d('0x31')][_0x9f5d('0x4d')](_0x340a41[_0x9f5d('0x4e')],{})[_0x9f5d('0x29')](function(_0x2c6779){var _0x135bfd=_0x340a41[_0x9f5d('0x4f')][_0x9f5d('0x2b')]({'plain':!![]});if(!_0x135bfd)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x135bfd[_0x9f5d('0x50')]==='user'){var _0x3c65b9=_0x2c6779['get']({'plain':!![]});var _0x29a483='WhatsappQueues';return db[_0x9f5d('0x51')][_0x9f5d('0x4c')]({'where':{'name':_0x29a483,'userProfileId':_0x135bfd[_0x9f5d('0x52')]},'raw':!![]})['then'](function(_0x20a62d){if(_0x20a62d&&_0x20a62d[_0x9f5d('0x53')]===0x0){return db['UserProfileResource']['create']({'name':_0x3c65b9[_0x9f5d('0x2e')],'resourceId':_0x3c65b9['id'],'type':_0x20a62d[_0x9f5d('0x2e')],'sectionId':_0x20a62d['id']},{})[_0x9f5d('0x29')](function(){return _0x2c6779;});}else{return _0x2c6779;}})[_0x9f5d('0x48')](function(_0xcbbd31){logger[_0x9f5d('0x54')](_0x9f5d('0x55'),_0xcbbd31);throw _0xcbbd31;});}return _0x2c6779;})[_0x9f5d('0x29')](respondWithResult(_0x27b5e1,0xc9))[_0x9f5d('0x48')](handleError(_0x27b5e1,null));};exports[_0x9f5d('0x28')]=function(_0x1eb2d5,_0x524e4a){if(_0x1eb2d5['body']['id']){delete _0x1eb2d5[_0x9f5d('0x4e')]['id'];}return db[_0x9f5d('0x31')][_0x9f5d('0x4c')]({'where':{'id':_0x1eb2d5[_0x9f5d('0x4a')]['id']}})[_0x9f5d('0x29')](handleEntityNotFound(_0x524e4a,null))['then'](saveUpdates(_0x1eb2d5[_0x9f5d('0x4e')],null))[_0x9f5d('0x29')](respondWithResult(_0x524e4a,null))[_0x9f5d('0x48')](handleError(_0x524e4a,null));};exports['destroy']=function(_0x514d19,_0x5ca8fe){return db[_0x9f5d('0x31')][_0x9f5d('0x4c')]({'where':{'id':_0x514d19[_0x9f5d('0x4a')]['id']}})[_0x9f5d('0x29')](handleEntityNotFound(_0x5ca8fe,null))[_0x9f5d('0x29')](removeEntity(_0x5ca8fe,null))['catch'](handleError(_0x5ca8fe,null));};exports[_0x9f5d('0x56')]=function(_0x3ab54a,_0x29818d){return db[_0x9f5d('0x31')][_0x9f5d('0x56')]()['then'](respondWithResult(_0x29818d,null))[_0x9f5d('0x48')](handleError(_0x29818d,null));};exports['getMembers']=function(_0x1be6e7,_0x52f77e,_0x372e28){var _0xb0d1b0={'raw':!![],'where':{}},_0x5e10ef={},_0x17ed54;return db[_0x9f5d('0x31')][_0x9f5d('0x57')]({'where':{'id':_0x1be6e7[_0x9f5d('0x4a')]['id']}})[_0x9f5d('0x29')](handleEntityNotFound(_0x52f77e,null))[_0x9f5d('0x29')](function(_0x465413){if(_0x465413){_0x17ed54=_0x465413[_0x9f5d('0x2b')]({'plain':!![]});_0x5e10ef[_0x9f5d('0x34')]=_['keys'](db[_0x9f5d('0x58')][_0x9f5d('0x59')]);_0x5e10ef[_0x9f5d('0x38')]=_[_0x9f5d('0x35')](_0x1be6e7[_0x9f5d('0x38')]);_0x5e10ef[_0x9f5d('0x36')]=_[_0x9f5d('0x37')](_0x5e10ef[_0x9f5d('0x34')],_0x5e10ef[_0x9f5d('0x38')]);_0xb0d1b0['attributes']=_[_0x9f5d('0x37')](_0x5e10ef[_0x9f5d('0x34')],qs[_0x9f5d('0x3a')](_0x1be6e7[_0x9f5d('0x38')]['fields']));_0xb0d1b0[_0x9f5d('0x39')]=_0xb0d1b0[_0x9f5d('0x39')][_0x9f5d('0x4b')]?_0xb0d1b0['attributes']:_0x5e10ef[_0x9f5d('0x34')];if(!_0x1be6e7[_0x9f5d('0x38')][_0x9f5d('0x3b')](_0x9f5d('0x3c'))){_0xb0d1b0[_0x9f5d('0x22')]=qs[_0x9f5d('0x22')](_0x1be6e7[_0x9f5d('0x38')][_0x9f5d('0x22')]);_0xb0d1b0[_0x9f5d('0x20')]=qs[_0x9f5d('0x20')](_0x1be6e7[_0x9f5d('0x38')]['offset']);}_0xb0d1b0['order']=qs['sort'](_0x1be6e7[_0x9f5d('0x38')][_0x9f5d('0x5a')]);_0xb0d1b0[_0x9f5d('0x3e')]=qs[_0x9f5d('0x36')](_['pick'](_0x1be6e7[_0x9f5d('0x38')],_0x5e10ef[_0x9f5d('0x36')]));_0xb0d1b0[_0x9f5d('0x3e')][_0x9f5d('0x5b')]=_0x465413['id'];if(_0x1be6e7[_0x9f5d('0x38')]['filter']){_0xb0d1b0[_0x9f5d('0x3e')]=_['merge'](_0xb0d1b0[_0x9f5d('0x3e')],{'$or':_[_0x9f5d('0x30')](_0xb0d1b0[_0x9f5d('0x39')],function(_0x3754e0){var _0x27dcae={};_0x27dcae[_0x3754e0]={'$like':'%'+_0x1be6e7[_0x9f5d('0x38')]['filter']+'%'};return _0x27dcae;})});}_0xb0d1b0=_[_0x9f5d('0x41')]({},_0xb0d1b0,_0x1be6e7['options']);return db[_0x9f5d('0x58')][_0x9f5d('0x46')](_0xb0d1b0);}})[_0x9f5d('0x29')](function(_0x24a5c8){if(_0x24a5c8){return db[_0x9f5d('0x5c')][_0x9f5d('0x5d')]({'where':{'id':_[_0x9f5d('0x30')](_0x24a5c8,_0x9f5d('0x5e')),'role':_0x9f5d('0x5f')},'attributes':['id',_0x9f5d('0x2e'),_0x9f5d('0x60'),_0x9f5d('0x61'),_0x9f5d('0x62')]});}})['then'](function(_0x27e16f){if(_0x27e16f){return{'count':_0x27e16f[_0x9f5d('0x23')],'rows':_[_0x9f5d('0x30')](_0x27e16f[_0x9f5d('0x47')],function(_0x15d597){return{'membername':_0x15d597['name'],'UserId':_0x15d597['id'],'queue_name':_0x17ed54[_0x9f5d('0x2e')],'WhatsappQueueId':_0x17ed54['id'],'interface':util[_0x9f5d('0x63')](_0x9f5d('0x64'),_0x9f5d('0x65'),_0x15d597[_0x9f5d('0x2e')]),'penalty':0x0,'paused':_0x15d597[_0x9f5d('0x60')],'createdAt':_0x15d597[_0x9f5d('0x62')],'updatedAt':_0x15d597['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x9f5d('0x29')](respondWithFilteredResult(_0x52f77e,_0xb0d1b0))[_0x9f5d('0x48')](handleError(_0x52f77e,null));};exports[_0x9f5d('0x66')]=function(_0x11deee,_0x5329e6,_0x2ea129){var _0x24bf2f={};var _0x5012e2={};var _0x16dddd;var _0x3210a5;return db[_0x9f5d('0x31')]['findOne']({'where':{'id':_0x11deee[_0x9f5d('0x4a')]['id']}})['then'](handleEntityNotFound(_0x5329e6,null))['then'](function(_0x302b88){if(_0x302b88){_0x16dddd=_0x302b88;_0x5012e2[_0x9f5d('0x34')]=_['keys'](db[_0x9f5d('0x67')][_0x9f5d('0x59')]);_0x5012e2[_0x9f5d('0x38')]=_['keys'](_0x11deee[_0x9f5d('0x38')]);_0x5012e2[_0x9f5d('0x36')]=_[_0x9f5d('0x37')](_0x5012e2[_0x9f5d('0x34')],_0x5012e2['query']);_0x24bf2f[_0x9f5d('0x39')]=_[_0x9f5d('0x37')](_0x5012e2[_0x9f5d('0x34')],qs[_0x9f5d('0x3a')](_0x11deee[_0x9f5d('0x38')][_0x9f5d('0x3a')]));_0x24bf2f['attributes']=_0x24bf2f[_0x9f5d('0x39')][_0x9f5d('0x4b')]?_0x24bf2f['attributes']:_0x5012e2[_0x9f5d('0x34')];_0x24bf2f[_0x9f5d('0x3d')]=qs['sort'](_0x11deee[_0x9f5d('0x38')][_0x9f5d('0x5a')]);_0x24bf2f[_0x9f5d('0x3e')]=qs[_0x9f5d('0x36')](_['pick'](_0x11deee['query'],_0x5012e2[_0x9f5d('0x36')]));if(_0x11deee['query'][_0x9f5d('0x40')]){_0x24bf2f['where']=_[_0x9f5d('0x41')](_0x24bf2f[_0x9f5d('0x3e')],{'$or':_[_0x9f5d('0x30')](_0x24bf2f[_0x9f5d('0x39')],function(_0x14377c){var _0x3f9696={};_0x3f9696[_0x14377c]={'$like':'%'+_0x11deee['query'][_0x9f5d('0x40')]+'%'};return _0x3f9696;})});}_0x24bf2f=_[_0x9f5d('0x41')]({},_0x24bf2f,_0x11deee[_0x9f5d('0x43')]);return _0x16dddd[_0x9f5d('0x66')](_0x24bf2f);}})['then'](function(_0x1323e0){if(_0x1323e0){_0x3210a5=_0x1323e0[_0x9f5d('0x4b')];if(!_0x11deee[_0x9f5d('0x38')][_0x9f5d('0x3b')](_0x9f5d('0x3c'))){_0x24bf2f[_0x9f5d('0x22')]=qs[_0x9f5d('0x22')](_0x11deee[_0x9f5d('0x38')][_0x9f5d('0x22')]);_0x24bf2f[_0x9f5d('0x20')]=qs[_0x9f5d('0x20')](_0x11deee['query']['offset']);}return _0x16dddd[_0x9f5d('0x66')](_0x24bf2f);}})['then'](function(_0x3b244f){if(_0x3b244f){return _0x3b244f?{'count':_0x3210a5,'rows':_0x3b244f}:null;}})[_0x9f5d('0x29')](respondWithResult(_0x5329e6,null))[_0x9f5d('0x48')](handleError(_0x5329e6,null));};exports['addTeams']=function(_0x334991,_0x533374,_0x52f3b7){var _0x4ada38=_0x334991[_0x9f5d('0x4e')][_0x9f5d('0x68')];return db[_0x9f5d('0x67')][_0x9f5d('0x46')]({'where':{'id':_0x4ada38},'attributes':['id'],'include':[{'model':db[_0x9f5d('0x5c')],'as':_0x9f5d('0x69'),'attributes':['id',_0x9f5d('0x2e'),_0x9f5d('0x6a'),'voicePause',_0x9f5d('0x6b')],'raw':!![]}]})[_0x9f5d('0x29')](function(_0x391816){if(_0x391816){var _0x522fbc=_[_0x9f5d('0x6c')](_0x391816,function(_0xbfa4eb){var _0x2b827e=_0xbfa4eb['get']({'plain':!![]});return _0x2b827e[_0x9f5d('0x69')];});return db[_0x9f5d('0x31')][_0x9f5d('0x4c')]({'where':{'id':_0x334991[_0x9f5d('0x4a')]['id']}})[_0x9f5d('0x29')](function(_0x165d85){return db[_0x9f5d('0x6d')][_0x9f5d('0x6e')](function(_0x444ea2){return _0x165d85['addTeams'](_0x4ada38,{'transaction':_0x444ea2})[_0x9f5d('0x29')](function(){return BPromise[_0x9f5d('0x6f')](_0x522fbc,function(_0x351488){return db[_0x9f5d('0x58')][_0x9f5d('0x70')]({'where':{'UserId':_0x351488['id'],'WhatsappQueueId':_0x334991[_0x9f5d('0x4a')]['id']},'transaction':_0x444ea2});});})[_0x9f5d('0x29')](function(){_0x522fbc[_0x9f5d('0x71')](function(_0x1cc047){socket[_0x9f5d('0x72')](_0x9f5d('0x73'),{'UserId':_0x1cc047['id'],'WhatsappQueueId':_0x165d85['id']});});});});});}})[_0x9f5d('0x29')](respondWithStatusCode(_0x533374,null))[_0x9f5d('0x48')](handleError(_0x533374,null));};exports[_0x9f5d('0x74')]=function(_0x47830e,_0x5d474f,_0x537cb7){return db['Team'][_0x9f5d('0x46')]({'where':{'id':_0x47830e[_0x9f5d('0x38')][_0x9f5d('0x68')]},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x5d474f,null))['then'](function(_0x452b79){var _0x32a29f=_[_0x9f5d('0x30')](_0x452b79,'id');var _0xc6f52=[];var _0x52a369=[];var _0x442d4c=squel[_0x9f5d('0x75')]();_0x442d4c[_0x9f5d('0x76')]('tq.TeamId')['from'](_0x9f5d('0x77'),'tq')[_0x9f5d('0x78')](_0x9f5d('0x79'),'ut',_0x9f5d('0x7a'))['where'](_0x9f5d('0x7b'),_0x47830e[_0x9f5d('0x4a')]['id']);for(var _0x1b725b=0x0;_0x1b725b<_0x452b79['length'];_0x1b725b+=0x1){let _0x552e21=_0x452b79[_0x1b725b];for(var _0x28d91c=0x0;_0x28d91c<_0x552e21[_0x9f5d('0x69')][_0x9f5d('0x4b')];_0x28d91c+=0x1){let _0x5b06c2=_0x552e21[_0x9f5d('0x69')][_0x28d91c];var _0x92cc93=_0x442d4c[_0x9f5d('0x7c')]();_0x92cc93[_0x9f5d('0x3e')](_0x9f5d('0x7d'),_0x5b06c2['id']);_0x52a369[_0x9f5d('0x7e')](db[_0x9f5d('0x6d')]['query'](_0x92cc93[_0x9f5d('0x7f')](),{'type':db[_0x9f5d('0x6d')][_0x9f5d('0x80')][_0x9f5d('0x81')]})['then'](function(_0x486026){if(_0x486026[_0x9f5d('0x4b')]===0x1){return _0x5b06c2['id'];}else{var _0x194e99=_[_0x9f5d('0x82')](_[_0x9f5d('0x30')](_0x486026,_0x9f5d('0x83')),function(_0x36082b){return _[_0x9f5d('0x84')](_0x32a29f,_0x36082b);});if(_0x194e99){return _0x5b06c2['id'];}}}));}}return BPromise[_0x9f5d('0x85')](_0x52a369)[_0x9f5d('0x29')](function(_0x3f3e43){_0xc6f52=_(_0xc6f52)[_0x9f5d('0x86')](_0x3f3e43)[_0x9f5d('0x87')]()[_0x9f5d('0x88')]();return db[_0x9f5d('0x31')][_0x9f5d('0x4c')]({'where':{'id':_0x47830e[_0x9f5d('0x4a')]['id']}})[_0x9f5d('0x29')](function(_0x158137){return db['sequelize'][_0x9f5d('0x6e')](function(_0x39c43c){return _0x158137[_0x9f5d('0x74')](_0x47830e[_0x9f5d('0x38')][_0x9f5d('0x68')],{'transaction':_0x39c43c})['then'](function(){if(!_[_0x9f5d('0x89')](_0xc6f52)){return _0x158137[_0x9f5d('0x8a')](_0xc6f52,{'transaction':_0x39c43c});}})[_0x9f5d('0x29')](function(){_0xc6f52[_0x9f5d('0x71')](function(_0x517c1f){socket['emit'](_0x9f5d('0x8b'),{'UserId':_0x517c1f,'WhatsappQueueId':_0x158137['id']});});});});});});})[_0x9f5d('0x29')](respondWithStatusCode(_0x5d474f,null))[_0x9f5d('0x48')](handleError(_0x5d474f,null));};exports[_0x9f5d('0x8c')]=function(_0x559250,_0x5ef745,_0x3cd236){return db[_0x9f5d('0x31')][_0x9f5d('0x4c')]({'where':{'id':_0x559250[_0x9f5d('0x4a')]['id']}})[_0x9f5d('0x29')](handleEntityNotFound(_0x5ef745,null))['then'](function(_0x5602db){if(_0x5602db){return _0x5602db[_0x9f5d('0x8c')](_0x559250[_0x9f5d('0x4e')][_0x9f5d('0x68')],_[_0x9f5d('0x8d')](_0x559250[_0x9f5d('0x4e')],[_0x9f5d('0x68'),'id'])||{})[_0x9f5d('0x8e')](function(_0x1ac566){for(var _0x32d066=0x0;_0x32d066<_0x559250[_0x9f5d('0x4e')][_0x9f5d('0x68')][_0x9f5d('0x4b')];_0x32d066+=0x1){socket[_0x9f5d('0x72')]('userWhatsappQueue:save',{'UserId':Number(_0x559250['body'][_0x9f5d('0x68')][_0x32d066]),'WhatsappQueueId':Number(_0x559250['params']['id'])});}return _0x1ac566;});}})[_0x9f5d('0x29')](respondWithResult(_0x5ef745,null))[_0x9f5d('0x48')](handleError(_0x5ef745,null));};exports[_0x9f5d('0x8a')]=function(_0x13646e,_0x2df806,_0x349343){return db[_0x9f5d('0x31')]['find']({'where':{'id':_0x13646e[_0x9f5d('0x4a')]['id']}})[_0x9f5d('0x29')](handleEntityNotFound(_0x2df806,null))['then'](function(_0x395b72){if(_0x395b72){return _0x395b72[_0x9f5d('0x8a')](_0x13646e[_0x9f5d('0x38')][_0x9f5d('0x68')])[_0x9f5d('0x29')](function(){if(_[_0x9f5d('0x8f')](_0x13646e[_0x9f5d('0x38')]['ids'])){for(var _0x51137e=0x0;_0x51137e<_0x13646e[_0x9f5d('0x38')][_0x9f5d('0x68')]['length'];_0x51137e+=0x1){socket['emit'](_0x9f5d('0x8b'),{'UserId':Number(_0x13646e[_0x9f5d('0x38')][_0x9f5d('0x68')][_0x51137e]),'WhatsappQueueId':Number(_0x13646e[_0x9f5d('0x4a')]['id'])});}}else{socket['emit'](_0x9f5d('0x8b'),{'UserId':Number(_0x13646e[_0x9f5d('0x38')][_0x9f5d('0x68')]),'WhatsappQueueId':Number(_0x13646e[_0x9f5d('0x4a')]['id'])});}});}})[_0x9f5d('0x29')](respondWithStatusCode(_0x2df806,null))[_0x9f5d('0x48')](handleError(_0x2df806,null));};exports[_0x9f5d('0x90')]=function(_0x2fdc7d,_0x58c099,_0x2a804b){var _0xd6a5fe={};var _0x3ffa14={};var _0x44a11f;var _0x2f5f4f;return db[_0x9f5d('0x31')][_0x9f5d('0x57')]({'where':{'id':_0x2fdc7d[_0x9f5d('0x4a')]['id']}})['then'](handleEntityNotFound(_0x58c099,null))[_0x9f5d('0x29')](function(_0xe67a72){if(_0xe67a72){_0x44a11f=_0xe67a72;_0x3ffa14['model']=_[_0x9f5d('0x35')](db[_0x9f5d('0x5c')][_0x9f5d('0x59')]);_0x3ffa14[_0x9f5d('0x38')]=_['keys'](_0x2fdc7d['query']);_0x3ffa14[_0x9f5d('0x36')]=_[_0x9f5d('0x37')](_0x3ffa14[_0x9f5d('0x34')],_0x3ffa14[_0x9f5d('0x38')]);_0xd6a5fe['attributes']=_['intersection'](_0x3ffa14[_0x9f5d('0x34')],qs[_0x9f5d('0x3a')](_0x2fdc7d['query'][_0x9f5d('0x3a')]));_0xd6a5fe[_0x9f5d('0x39')]=_0xd6a5fe[_0x9f5d('0x39')][_0x9f5d('0x4b')]?_0xd6a5fe[_0x9f5d('0x39')]:_0x3ffa14['model'];_0xd6a5fe[_0x9f5d('0x3d')]=qs['sort'](_0x2fdc7d[_0x9f5d('0x38')][_0x9f5d('0x5a')]);_0xd6a5fe[_0x9f5d('0x3e')]=qs[_0x9f5d('0x36')](_[_0x9f5d('0x3f')](_0x2fdc7d[_0x9f5d('0x38')],_0x3ffa14['filters']));if(_0x2fdc7d['query'][_0x9f5d('0x40')]){_0xd6a5fe['where']=_[_0x9f5d('0x41')](_0xd6a5fe[_0x9f5d('0x3e')],{'$or':_[_0x9f5d('0x30')](_0xd6a5fe[_0x9f5d('0x39')],function(_0x5c2144){var _0xf53a54={};_0xf53a54[_0x5c2144]={'$like':'%'+_0x2fdc7d[_0x9f5d('0x38')][_0x9f5d('0x40')]+'%'};return _0xf53a54;})});}_0xd6a5fe=_[_0x9f5d('0x41')]({},_0xd6a5fe,_0x2fdc7d[_0x9f5d('0x43')]);return _0x44a11f[_0x9f5d('0x90')](_0xd6a5fe);}})[_0x9f5d('0x29')](function(_0xe2c6df){if(_0xe2c6df){_0x2f5f4f=_0xe2c6df[_0x9f5d('0x4b')];if(!_0x2fdc7d[_0x9f5d('0x38')]['hasOwnProperty'](_0x9f5d('0x3c'))){_0xd6a5fe[_0x9f5d('0x22')]=qs[_0x9f5d('0x22')](_0x2fdc7d[_0x9f5d('0x38')][_0x9f5d('0x22')]);_0xd6a5fe[_0x9f5d('0x20')]=qs['offset'](_0x2fdc7d[_0x9f5d('0x38')][_0x9f5d('0x20')]);}return _0x44a11f[_0x9f5d('0x90')](_0xd6a5fe);}})[_0x9f5d('0x29')](function(_0x199de4){if(_0x199de4){return _0x199de4?{'count':_0x2f5f4f,'rows':_0x199de4}:null;}})[_0x9f5d('0x29')](respondWithResult(_0x58c099,null))['catch'](handleError(_0x58c099,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.events.js b/server/api/whatsappQueue/whatsappQueue.events.js index ab0becb..a0a4fbf 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 _0xfba8=['hasOwnProperty','hook','exports','WhatsappQueue','setMaxListeners','save','update','remove','emit'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xfba8,0x1aa));var _0x8fba=function(_0x38c355,_0x595639){_0x38c355=_0x38c355-0x0;var _0x4dc703=_0xfba8[_0x38c355];return _0x4dc703;};'use strict';var EventEmitter=require('events');var WhatsappQueue=require('../../mysqldb')['db'][_0x8fba('0x0')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0x8fba('0x1')](0x0);var events={'afterCreate':_0x8fba('0x2'),'afterUpdate':_0x8fba('0x3'),'afterDestroy':_0x8fba('0x4')};function emitEvent(_0x1dcdf){return function(_0x4a7b42,_0x10e740,_0x2417d2){WhatsappQueueEvents[_0x8fba('0x5')](_0x1dcdf+':'+_0x4a7b42['id'],_0x4a7b42);WhatsappQueueEvents[_0x8fba('0x5')](_0x1dcdf,_0x4a7b42);_0x2417d2(null);};}for(var e in events){if(events[_0x8fba('0x6')](e)){var event=events[e];WhatsappQueue[_0x8fba('0x7')](e,emitEvent(event));}}module[_0x8fba('0x8')]=WhatsappQueueEvents; \ No newline at end of file +var _0xb3c6=['WhatsappQueue','setMaxListeners','save','remove','emit','hook','../../mysqldb'];(function(_0x5cf3d0,_0x2ba0ad){var _0x65a75b=function(_0x4d6ca7){while(--_0x4d6ca7){_0x5cf3d0['push'](_0x5cf3d0['shift']());}};_0x65a75b(++_0x2ba0ad);}(_0xb3c6,0xdf));var _0x6b3c=function(_0x3e7b59,_0x14a4cd){_0x3e7b59=_0x3e7b59-0x0;var _0x4bd64a=_0xb3c6[_0x3e7b59];return _0x4bd64a;};'use strict';var EventEmitter=require('events');var WhatsappQueue=require(_0x6b3c('0x0'))['db'][_0x6b3c('0x1')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0x6b3c('0x2')](0x0);var events={'afterCreate':_0x6b3c('0x3'),'afterUpdate':'update','afterDestroy':_0x6b3c('0x4')};function emitEvent(_0x1da936){return function(_0x52e44d,_0x2868e5,_0x1dc0cc){WhatsappQueueEvents[_0x6b3c('0x5')](_0x1da936+':'+_0x52e44d['id'],_0x52e44d);WhatsappQueueEvents[_0x6b3c('0x5')](_0x1da936,_0x52e44d);_0x1dc0cc(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappQueue[_0x6b3c('0x6')](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 8aec0ad..2a26ad0 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 _0x6f5c=['path','rimraf','../../config/environment','./whatsappQueue.attributes','exports','define','WhatsappQueue','whatsapp_queues','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x2115f6,_0x4c9826){var _0x291167=function(_0x505b4d){while(--_0x505b4d){_0x2115f6['push'](_0x2115f6['shift']());}};_0x291167(++_0x4c9826);}(_0x6f5c,0x143));var _0xc6f5=function(_0x516755,_0x976165){_0x516755=_0x516755-0x0;var _0x457846=_0x6f5c[_0x516755];return _0x457846;};'use strict';var _=require(_0xc6f5('0x0'));var util=require(_0xc6f5('0x1'));var logger=require(_0xc6f5('0x2'))(_0xc6f5('0x3'));var moment=require(_0xc6f5('0x4'));var BPromise=require(_0xc6f5('0x5'));var rp=require(_0xc6f5('0x6'));var fs=require('fs');var path=require(_0xc6f5('0x7'));var rimraf=require(_0xc6f5('0x8'));var config=require(_0xc6f5('0x9'));var attributes=require(_0xc6f5('0xa'));module[_0xc6f5('0xb')]=function(_0x4681c5,_0x3b5fa2){return _0x4681c5[_0xc6f5('0xc')](_0xc6f5('0xd'),attributes,{'tableName':_0xc6f5('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x02f8=['exports','define','WhatsappQueue','whatsapp_queues','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./whatsappQueue.attributes'];(function(_0x5933f9,_0x419885){var _0x3b8d39=function(_0x308de1){while(--_0x308de1){_0x5933f9['push'](_0x5933f9['shift']());}};_0x3b8d39(++_0x419885);}(_0x02f8,0x1b6));var _0x802f=function(_0x24507a,_0x58e59b){_0x24507a=_0x24507a-0x0;var _0x20ed6a=_0x02f8[_0x24507a];return _0x20ed6a;};'use strict';var _=require(_0x802f('0x0'));var util=require(_0x802f('0x1'));var logger=require(_0x802f('0x2'))(_0x802f('0x3'));var moment=require(_0x802f('0x4'));var BPromise=require(_0x802f('0x5'));var rp=require(_0x802f('0x6'));var fs=require('fs');var path=require(_0x802f('0x7'));var rimraf=require(_0x802f('0x8'));var config=require('../../config/environment');var attributes=require(_0x802f('0x9'));module[_0x802f('0xa')]=function(_0x3bd2d0,_0x394a43){return _0x3bd2d0[_0x802f('0xb')](_0x802f('0xc'),attributes,{'tableName':_0x802f('0xd'),'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 c5628af..e97ea76 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 _0xce84=['register','request','then','request\x20sent','WhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','WhatsappQueue,\x20%s,\x20%s','message','info','catch','GetWhatsappQueue','WhatsappQueue','options','raw','where','attributes','limit','include','map','model','debug','ShowWhatsappQueue','util','moment','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','redis','defaults','socket.io-emitter','./whatsappQueue.socket'];(function(_0x1ad26f,_0x3c451f){var _0x28f74b=function(_0x5f03f5){while(--_0x5f03f5){_0x1ad26f['push'](_0x1ad26f['shift']());}};_0x28f74b(++_0x3c451f);}(_0xce84,0x84));var _0x4ce8=function(_0x30b26a,_0x4b840e){_0x30b26a=_0x30b26a-0x0;var _0x3f17a7=_0xce84[_0x30b26a];return _0x3f17a7;};'use strict';var _=require('lodash');var util=require(_0x4ce8('0x0'));var moment=require(_0x4ce8('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4ce8('0x2'));var db=require(_0x4ce8('0x3'))['db'];var utils=require(_0x4ce8('0x4'));var logger=require('../../config/logger')(_0x4ce8('0x5'));var config=require(_0x4ce8('0x6'));var jayson=require(_0x4ce8('0x7'));var client=jayson['client']['http']({'port':0x232a});config[_0x4ce8('0x8')]=_[_0x4ce8('0x9')](config[_0x4ce8('0x8')],{'host':'localhost','port':0x18eb});var socket=require(_0x4ce8('0xa'))(new Redis(config[_0x4ce8('0x8')]));require(_0x4ce8('0xb'))[_0x4ce8('0xc')](socket);function respondWithRpcPromise(_0x44804e,_0x16a81c,_0x5ef32b){return new BPromise(function(_0x46cc22,_0x5d6c72){return client[_0x4ce8('0xd')](_0x44804e,_0x5ef32b)[_0x4ce8('0xe')](function(_0x489c3f){logger['info']('WhatsappQueue,\x20%s,\x20%s',_0x16a81c,_0x4ce8('0xf'));logger['debug'](_0x4ce8('0x10'),_0x16a81c,_0x4ce8('0xf'),JSON[_0x4ce8('0x11')](_0x489c3f));if(_0x489c3f[_0x4ce8('0x12')]){if(_0x489c3f[_0x4ce8('0x12')][_0x4ce8('0x13')]===0x1f4){logger[_0x4ce8('0x12')](_0x4ce8('0x14'),_0x16a81c,_0x489c3f[_0x4ce8('0x12')][_0x4ce8('0x15')]);return _0x5d6c72(_0x489c3f[_0x4ce8('0x12')][_0x4ce8('0x15')]);}logger[_0x4ce8('0x12')]('WhatsappQueue,\x20%s,\x20%s',_0x16a81c,_0x489c3f[_0x4ce8('0x12')][_0x4ce8('0x15')]);return _0x46cc22(_0x489c3f[_0x4ce8('0x12')][_0x4ce8('0x15')]);}else{logger[_0x4ce8('0x16')]('WhatsappQueue,\x20%s,\x20%s',_0x16a81c,_0x4ce8('0xf'));_0x46cc22(_0x489c3f['result'][_0x4ce8('0x15')]);}})[_0x4ce8('0x17')](function(_0x5a3149){logger[_0x4ce8('0x12')](_0x4ce8('0x14'),_0x16a81c,_0x5a3149);_0x5d6c72(_0x5a3149);});});}exports[_0x4ce8('0x18')]=function(_0x2ac447){var _0x299b02=this;return new Promise(function(_0x1ec847,_0x385077){return db[_0x4ce8('0x19')]['findAll']({'raw':_0x2ac447[_0x4ce8('0x1a')]?_0x2ac447[_0x4ce8('0x1a')][_0x4ce8('0x1b')]===undefined?!![]:![]:!![],'where':_0x2ac447['options']?_0x2ac447[_0x4ce8('0x1a')][_0x4ce8('0x1c')]||null:null,'attributes':_0x2ac447['options']?_0x2ac447[_0x4ce8('0x1a')][_0x4ce8('0x1d')]||null:null,'limit':_0x2ac447['options']?_0x2ac447[_0x4ce8('0x1a')][_0x4ce8('0x1e')]||null:null,'include':_0x2ac447['options']?_0x2ac447['options'][_0x4ce8('0x1f')]?_[_0x4ce8('0x20')](_0x2ac447[_0x4ce8('0x1a')][_0x4ce8('0x1f')],function(_0x6b9749){return{'model':db[_0x6b9749['model']],'as':_0x6b9749['as'],'attributes':_0x6b9749[_0x4ce8('0x1d')],'include':_0x6b9749[_0x4ce8('0x1f')]?_[_0x4ce8('0x20')](_0x6b9749[_0x4ce8('0x1f')],function(_0x31ff67){return{'model':db[_0x31ff67[_0x4ce8('0x21')]],'as':_0x31ff67['as'],'attributes':_0x31ff67[_0x4ce8('0x1d')],'include':_0x31ff67[_0x4ce8('0x1f')]?_[_0x4ce8('0x20')](_0x31ff67[_0x4ce8('0x1f')],function(_0x54c8a8){return{'model':db[_0x54c8a8[_0x4ce8('0x21')]],'as':_0x54c8a8['as'],'attributes':_0x54c8a8['attributes']};}):[]};}):[]};}):[]:[]})[_0x4ce8('0xe')](function(_0x23980e){logger[_0x4ce8('0x16')](_0x4ce8('0x18'),_0x2ac447);logger[_0x4ce8('0x22')]('GetWhatsappQueue',_0x2ac447,JSON['stringify'](_0x23980e));_0x1ec847(_0x23980e);})[_0x4ce8('0x17')](function(_0x311e6e){logger['error'](_0x4ce8('0x18'),_0x311e6e[_0x4ce8('0x15')],_0x2ac447);_0x385077(_0x299b02[_0x4ce8('0x12')](0x1f4,_0x311e6e[_0x4ce8('0x15')]));});});};exports[_0x4ce8('0x23')]=function(_0x4ac56f){var _0x29f8b6=this;return new Promise(function(_0x321684,_0x2cda9a){return db[_0x4ce8('0x19')]['find']({'raw':_0x4ac56f[_0x4ce8('0x1a')]?_0x4ac56f['options'][_0x4ce8('0x1b')]===undefined?!![]:![]:!![],'where':_0x4ac56f[_0x4ce8('0x1a')]?_0x4ac56f[_0x4ce8('0x1a')][_0x4ce8('0x1c')]||null:null,'attributes':_0x4ac56f[_0x4ce8('0x1a')]?_0x4ac56f[_0x4ce8('0x1a')]['attributes']||null:null,'include':_0x4ac56f[_0x4ce8('0x1a')]?_0x4ac56f['options'][_0x4ce8('0x1f')]?_['map'](_0x4ac56f['options'][_0x4ce8('0x1f')],function(_0x24414f){return{'model':db[_0x24414f[_0x4ce8('0x21')]],'as':_0x24414f['as'],'attributes':_0x24414f[_0x4ce8('0x1d')],'include':_0x24414f[_0x4ce8('0x1f')]?_[_0x4ce8('0x20')](_0x24414f[_0x4ce8('0x1f')],function(_0x26fa1c){return{'model':db[_0x26fa1c['model']],'as':_0x26fa1c['as'],'attributes':_0x26fa1c['attributes'],'include':_0x26fa1c['include']?_['map'](_0x26fa1c['include'],function(_0x6520ce){return{'model':db[_0x6520ce[_0x4ce8('0x21')]],'as':_0x6520ce['as'],'attributes':_0x6520ce[_0x4ce8('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x4ce8('0xe')](function(_0x454624){logger[_0x4ce8('0x16')](_0x4ce8('0x23'),_0x4ac56f);logger[_0x4ce8('0x22')](_0x4ce8('0x23'),_0x4ac56f,JSON['stringify'](_0x454624));_0x321684(_0x454624);})[_0x4ce8('0x17')](function(_0x419958){logger[_0x4ce8('0x12')]('ShowWhatsappQueue',_0x419958[_0x4ce8('0x15')],_0x4ac56f);_0x2cda9a(_0x29f8b6[_0x4ce8('0x12')](0x1f4,_0x419958['message']));});});}; \ No newline at end of file +var _0xc878=['info','WhatsappQueue,\x20%s,\x20%s','request\x20sent','error','message','result','catch','GetWhatsappQueue','findAll','options','raw','where','limit','map','include','model','attributes','then','debug','stringify','WhatsappQueue','ShowWhatsappQueue','lodash','util','moment','bluebird','../../config/utils','../../config/logger','jayson/promise','client','http','redis','localhost','socket.io-emitter','./whatsappQueue.socket','register','request'];(function(_0x49e444,_0x1afd8f){var _0x3d578e=function(_0x204e74){while(--_0x204e74){_0x49e444['push'](_0x49e444['shift']());}};_0x3d578e(++_0x1afd8f);}(_0xc878,0x188));var _0x8c87=function(_0x1bd323,_0x1c16ab){_0x1bd323=_0x1bd323-0x0;var _0x13097b=_0xc878[_0x1bd323];return _0x13097b;};'use strict';var _=require(_0x8c87('0x0'));var util=require(_0x8c87('0x1'));var moment=require(_0x8c87('0x2'));var BPromise=require(_0x8c87('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x8c87('0x4'));var logger=require(_0x8c87('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0x8c87('0x6'));var client=jayson[_0x8c87('0x7')][_0x8c87('0x8')]({'port':0x232a});config[_0x8c87('0x9')]=_['defaults'](config[_0x8c87('0x9')],{'host':_0x8c87('0xa'),'port':0x18eb});var socket=require(_0x8c87('0xb'))(new Redis(config['redis']));require(_0x8c87('0xc'))[_0x8c87('0xd')](socket);function respondWithRpcPromise(_0x14602d,_0x3b292c,_0xbf2e8c){return new BPromise(function(_0x5cabac,_0x199e93){return client[_0x8c87('0xe')](_0x14602d,_0xbf2e8c)['then'](function(_0x156c6c){logger[_0x8c87('0xf')](_0x8c87('0x10'),_0x3b292c,'request\x20sent');logger['debug']('WhatsappQueue,\x20%s,\x20%s,\x20%s',_0x3b292c,_0x8c87('0x11'),JSON['stringify'](_0x156c6c));if(_0x156c6c[_0x8c87('0x12')]){if(_0x156c6c[_0x8c87('0x12')]['code']===0x1f4){logger['error'](_0x8c87('0x10'),_0x3b292c,_0x156c6c[_0x8c87('0x12')]['message']);return _0x199e93(_0x156c6c['error'][_0x8c87('0x13')]);}logger[_0x8c87('0x12')](_0x8c87('0x10'),_0x3b292c,_0x156c6c[_0x8c87('0x12')][_0x8c87('0x13')]);return _0x5cabac(_0x156c6c[_0x8c87('0x12')][_0x8c87('0x13')]);}else{logger[_0x8c87('0xf')]('WhatsappQueue,\x20%s,\x20%s',_0x3b292c,'request\x20sent');_0x5cabac(_0x156c6c[_0x8c87('0x14')][_0x8c87('0x13')]);}})[_0x8c87('0x15')](function(_0x2a75d0){logger[_0x8c87('0x12')](_0x8c87('0x10'),_0x3b292c,_0x2a75d0);_0x199e93(_0x2a75d0);});});}exports[_0x8c87('0x16')]=function(_0x298a14){var _0x142506=this;return new Promise(function(_0x3bef57,_0x30332b){return db['WhatsappQueue'][_0x8c87('0x17')]({'raw':_0x298a14[_0x8c87('0x18')]?_0x298a14['options'][_0x8c87('0x19')]===undefined?!![]:![]:!![],'where':_0x298a14['options']?_0x298a14[_0x8c87('0x18')][_0x8c87('0x1a')]||null:null,'attributes':_0x298a14[_0x8c87('0x18')]?_0x298a14[_0x8c87('0x18')]['attributes']||null:null,'limit':_0x298a14[_0x8c87('0x18')]?_0x298a14[_0x8c87('0x18')][_0x8c87('0x1b')]||null:null,'include':_0x298a14[_0x8c87('0x18')]?_0x298a14[_0x8c87('0x18')]['include']?_[_0x8c87('0x1c')](_0x298a14[_0x8c87('0x18')][_0x8c87('0x1d')],function(_0x28c8f7){return{'model':db[_0x28c8f7[_0x8c87('0x1e')]],'as':_0x28c8f7['as'],'attributes':_0x28c8f7[_0x8c87('0x1f')],'include':_0x28c8f7[_0x8c87('0x1d')]?_[_0x8c87('0x1c')](_0x28c8f7[_0x8c87('0x1d')],function(_0x23caf0){return{'model':db[_0x23caf0[_0x8c87('0x1e')]],'as':_0x23caf0['as'],'attributes':_0x23caf0[_0x8c87('0x1f')],'include':_0x23caf0[_0x8c87('0x1d')]?_[_0x8c87('0x1c')](_0x23caf0['include'],function(_0x3481ea){return{'model':db[_0x3481ea[_0x8c87('0x1e')]],'as':_0x3481ea['as'],'attributes':_0x3481ea[_0x8c87('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x8c87('0x20')](function(_0x133bef){logger[_0x8c87('0xf')](_0x8c87('0x16'),_0x298a14);logger[_0x8c87('0x21')](_0x8c87('0x16'),_0x298a14,JSON[_0x8c87('0x22')](_0x133bef));_0x3bef57(_0x133bef);})[_0x8c87('0x15')](function(_0x2334fb){logger[_0x8c87('0x12')](_0x8c87('0x16'),_0x2334fb['message'],_0x298a14);_0x30332b(_0x142506[_0x8c87('0x12')](0x1f4,_0x2334fb[_0x8c87('0x13')]));});});};exports['ShowWhatsappQueue']=function(_0x6e2ad8){var _0x4babf4=this;return new Promise(function(_0x22a047,_0xf1f781){return db[_0x8c87('0x23')]['find']({'raw':_0x6e2ad8[_0x8c87('0x18')]?_0x6e2ad8[_0x8c87('0x18')][_0x8c87('0x19')]===undefined?!![]:![]:!![],'where':_0x6e2ad8[_0x8c87('0x18')]?_0x6e2ad8[_0x8c87('0x18')][_0x8c87('0x1a')]||null:null,'attributes':_0x6e2ad8[_0x8c87('0x18')]?_0x6e2ad8[_0x8c87('0x18')]['attributes']||null:null,'include':_0x6e2ad8[_0x8c87('0x18')]?_0x6e2ad8[_0x8c87('0x18')][_0x8c87('0x1d')]?_[_0x8c87('0x1c')](_0x6e2ad8[_0x8c87('0x18')]['include'],function(_0x4f8d73){return{'model':db[_0x4f8d73[_0x8c87('0x1e')]],'as':_0x4f8d73['as'],'attributes':_0x4f8d73[_0x8c87('0x1f')],'include':_0x4f8d73['include']?_[_0x8c87('0x1c')](_0x4f8d73[_0x8c87('0x1d')],function(_0xaa06e){return{'model':db[_0xaa06e[_0x8c87('0x1e')]],'as':_0xaa06e['as'],'attributes':_0xaa06e['attributes'],'include':_0xaa06e[_0x8c87('0x1d')]?_[_0x8c87('0x1c')](_0xaa06e[_0x8c87('0x1d')],function(_0x5f25e1){return{'model':db[_0x5f25e1[_0x8c87('0x1e')]],'as':_0x5f25e1['as'],'attributes':_0x5f25e1['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x500613){logger[_0x8c87('0xf')]('ShowWhatsappQueue',_0x6e2ad8);logger[_0x8c87('0x21')]('ShowWhatsappQueue',_0x6e2ad8,JSON[_0x8c87('0x22')](_0x500613));_0x22a047(_0x500613);})['catch'](function(_0x53fa40){logger[_0x8c87('0x12')](_0x8c87('0x24'),_0x53fa40[_0x8c87('0x13')],_0x6e2ad8);_0xf1f781(_0x4babf4['error'](0x1f4,_0x53fa40[_0x8c87('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.socket.js b/server/api/whatsappQueue/whatsappQueue.socket.js index 51b4737..c9402e7 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 _0x5194=['./whatsappQueue.events','save','remove','update','emit','removeListener','register','length','whatsappQueue:'];(function(_0x5993f1,_0x281bff){var _0x1786f8=function(_0x3ed4f8){while(--_0x3ed4f8){_0x5993f1['push'](_0x5993f1['shift']());}};_0x1786f8(++_0x281bff);}(_0x5194,0x10e));var _0x4519=function(_0x4b055c,_0x4b870b){_0x4b055c=_0x4b055c-0x0;var _0x4b62bb=_0x5194[_0x4b055c];return _0x4b62bb;};'use strict';var WhatsappQueueEvents=require(_0x4519('0x0'));var events=[_0x4519('0x1'),_0x4519('0x2'),_0x4519('0x3')];function createListener(_0x5e83f9,_0x2dc5f3){return function(_0x1cbfa2){_0x2dc5f3[_0x4519('0x4')](_0x5e83f9,_0x1cbfa2);};}function removeListener(_0x499f64,_0x4c81b8){return function(){WhatsappQueueEvents[_0x4519('0x5')](_0x499f64,_0x4c81b8);};}exports[_0x4519('0x6')]=function(_0x2e926a){for(var _0x261aa9=0x0,_0x5f2f77=events[_0x4519('0x7')];_0x261aa9<_0x5f2f77;_0x261aa9++){var _0x4d3973=events[_0x261aa9];var _0x5bea23=createListener(_0x4519('0x8')+_0x4d3973,_0x2e926a);WhatsappQueueEvents['on'](_0x4d3973,_0x5bea23);}}; \ No newline at end of file +var _0xacb7=['remove','update','register','length','./whatsappQueue.events','save'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xacb7,0x11e));var _0x7acb=function(_0x3c7419,_0x46b3e6){_0x3c7419=_0x3c7419-0x0;var _0x36db54=_0xacb7[_0x3c7419];return _0x36db54;};'use strict';var WhatsappQueueEvents=require(_0x7acb('0x0'));var events=[_0x7acb('0x1'),_0x7acb('0x2'),_0x7acb('0x3')];function createListener(_0x13f4da,_0x3f0842){return function(_0x58f0f1){_0x3f0842['emit'](_0x13f4da,_0x58f0f1);};}function removeListener(_0x4e8ab9,_0x5e8663){return function(){WhatsappQueueEvents['removeListener'](_0x4e8ab9,_0x5e8663);};}exports[_0x7acb('0x4')]=function(_0x2d4629){for(var _0x22c966=0x0,_0x368a42=events[_0x7acb('0x5')];_0x22c966<_0x368a42;_0x22c966++){var _0x5494a9=events[_0x22c966];var _0x1950e2=createListener('whatsappQueue:'+_0x5494a9,_0x2d4629);WhatsappQueueEvents['on'](_0x5494a9,_0x1950e2);}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/index.js b/server/api/whatsappQueueReport/index.js index 222c84d..ff1944f 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 _0x72f0=['describe','show','post','create','put','/:id','update','destroy','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./whatsappQueueReport.controller','isAuthenticated','index','get','/describe'];(function(_0x52a08b,_0x12388d){var _0x2c6670=function(_0x253827){while(--_0x253827){_0x52a08b['push'](_0x52a08b['shift']());}};_0x2c6670(++_0x12388d);}(_0x72f0,0xb3));var _0x072f=function(_0x5a4400,_0xfae3b6){_0x5a4400=_0x5a4400-0x0;var _0xf9b532=_0x72f0[_0x5a4400];return _0xf9b532;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x072f('0x0'));var timeout=require(_0x072f('0x1'));var express=require(_0x072f('0x2'));var router=express['Router']();var fs_extra=require(_0x072f('0x3'));var auth=require(_0x072f('0x4'));var interaction=require(_0x072f('0x5'));var config=require('../../config/environment');var controller=require(_0x072f('0x6'));router['get']('/',auth[_0x072f('0x7')](),controller[_0x072f('0x8')]);router[_0x072f('0x9')](_0x072f('0xa'),auth[_0x072f('0x7')](),controller[_0x072f('0xb')]);router[_0x072f('0x9')]('/:id',auth[_0x072f('0x7')](),controller[_0x072f('0xc')]);router[_0x072f('0xd')]('/',auth['isAuthenticated'](),controller[_0x072f('0xe')]);router[_0x072f('0xf')](_0x072f('0x10'),auth['isAuthenticated'](),controller[_0x072f('0x11')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x072f('0x12')]);module['exports']=router; \ No newline at end of file +var _0x7841=['express','Router','fs-extra','../../components/interaction/service','../../config/environment','./whatsappQueueReport.controller','get','isAuthenticated','/describe','describe','/:id','show','update','destroy','path'];(function(_0x274e0e,_0x3aace4){var _0x4ca356=function(_0x59e7a3){while(--_0x59e7a3){_0x274e0e['push'](_0x274e0e['shift']());}};_0x4ca356(++_0x3aace4);}(_0x7841,0x185));var _0x1784=function(_0x505b9d,_0x14bcf4){_0x505b9d=_0x505b9d-0x0;var _0x491990=_0x7841[_0x505b9d];return _0x491990;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1784('0x0'));var timeout=require('connect-timeout');var express=require(_0x1784('0x1'));var router=express[_0x1784('0x2')]();var fs_extra=require(_0x1784('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x1784('0x4'));var config=require(_0x1784('0x5'));var controller=require(_0x1784('0x6'));router[_0x1784('0x7')]('/',auth[_0x1784('0x8')](),controller['index']);router[_0x1784('0x7')](_0x1784('0x9'),auth[_0x1784('0x8')](),controller[_0x1784('0xa')]);router[_0x1784('0x7')](_0x1784('0xb'),auth[_0x1784('0x8')](),controller[_0x1784('0xc')]);router['post']('/',auth[_0x1784('0x8')](),controller['create']);router['put'](_0x1784('0xb'),auth[_0x1784('0x8')](),controller[_0x1784('0xd')]);router['delete'](_0x1784('0xb'),auth['isAuthenticated'](),controller[_0x1784('0xe')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js b/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js index 0c2cc00..b508ed3 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(_0x1bba5a,_0x23f93c){var _0x2a99b1=function(_0x3bbb3e){while(--_0x3bbb3e){_0x1bba5a['push'](_0x1bba5a['shift']());}};_0x2a99b1(++_0x23f93c);}(_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 +var _0x7a54=['STRING','DATE','sequelize','exports'];(function(_0x217a5e,_0x36511e){var _0x484c2=function(_0x36641a){while(--_0x36641a){_0x217a5e['push'](_0x217a5e['shift']());}};_0x484c2(++_0x36511e);}(_0x7a54,0x106));var _0x47a5=function(_0x3b9f41,_0x853b77){_0x3b9f41=_0x3b9f41-0x0;var _0x4362ab=_0x7a54[_0x3b9f41];return _0x4362ab;};'use strict';var Sequelize=require(_0x47a5('0x0'));module[_0x47a5('0x1')]={'uniqueid':{'type':Sequelize[_0x47a5('0x2')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x47a5('0x3')]},'leaveAt':{'type':Sequelize[_0x47a5('0x3')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x47a5('0x3')]},'reason':{'type':Sequelize[_0x47a5('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.controller.js b/server/api/whatsappQueueReport/whatsappQueueReport.controller.js index c59f4d6..dd806d4 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 _0xed3c=['../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','save','update','then','destroy','end','error','stack','index','map','WhatsappQueueReport','rawAttributes','fieldName','key','model','name','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','pick','filter','merge','where','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs'];(function(_0x61e373,_0x4dc068){var _0x24618f=function(_0x405e2e){while(--_0x405e2e){_0x61e373['push'](_0x61e373['shift']());}};_0x24618f(++_0x4dc068);}(_0xed3c,0x1a6));var _0xced3=function(_0x583907,_0xd2e4b4){_0x583907=_0x583907-0x0;var _0x247526=_0xed3c[_0x583907];return _0x247526;};'use strict';var emlformat=require(_0xced3('0x0'));var rimraf=require(_0xced3('0x1'));var zipdir=require(_0xced3('0x2'));var jsonpatch=require(_0xced3('0x3'));var rp=require('request-promise');var moment=require(_0xced3('0x4'));var BPromise=require(_0xced3('0x5'));var Mustache=require(_0xced3('0x6'));var util=require('util');var path=require('path');var sox=require(_0xced3('0x7'));var csv=require(_0xced3('0x8'));var ejs=require(_0xced3('0x9'));var fs=require('fs');var fs_extra=require(_0xced3('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xced3('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xced3('0xc'));var Redis=require(_0xced3('0xd'));var authService=require(_0xced3('0xe'));var qs=require(_0xced3('0xf'));var as=require(_0xced3('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xced3('0x11'))(_0xced3('0x12'));var utils=require(_0xced3('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0xced3('0x14'));var db=require(_0xced3('0x15'))['db'];function respondWithStatusCode(_0x42d879,_0x3b2ac4){_0x3b2ac4=_0x3b2ac4||0xcc;return function(_0x457caf){if(_0x457caf){return _0x42d879[_0xced3('0x16')](_0x3b2ac4);}return _0x42d879[_0xced3('0x17')](_0x3b2ac4)['end']();};}function respondWithResult(_0x65bb58,_0x5e186e){_0x5e186e=_0x5e186e||0xc8;return function(_0xf2db6f){if(_0xf2db6f){return _0x65bb58[_0xced3('0x17')](_0x5e186e)[_0xced3('0x18')](_0xf2db6f);}};}function respondWithFilteredResult(_0x39e4aa,_0x4dd4c3){return function(_0x146a21){if(_0x146a21){var _0x322c2d=typeof _0x4dd4c3['offset']===_0xced3('0x19')&&typeof _0x4dd4c3[_0xced3('0x1a')]===_0xced3('0x19');var _0x17f611=_0x146a21['count'];var _0x4569af=_0x322c2d?0x0:_0x4dd4c3['offset'];var _0x353580=_0x322c2d?_0x146a21[_0xced3('0x1b')]:_0x4dd4c3[_0xced3('0x1c')]+_0x4dd4c3[_0xced3('0x1a')];var _0x44143f;if(_0x353580>=_0x17f611){_0x353580=_0x17f611;_0x44143f=0xc8;}else{_0x44143f=0xce;}_0x39e4aa[_0xced3('0x17')](_0x44143f);return _0x39e4aa[_0xced3('0x1d')](_0xced3('0x1e'),_0x4569af+'-'+_0x353580+'/'+_0x17f611)[_0xced3('0x18')](_0x146a21);}return null;};}function patchUpdates(_0x17c011){return function(_0x2008f2){try{jsonpatch['apply'](_0x2008f2,_0x17c011,!![]);}catch(_0x5b8b1f){return BPromise['reject'](_0x5b8b1f);}return _0x2008f2[_0xced3('0x1f')]();};}function saveUpdates(_0x342b9e,_0x21e074){return function(_0x4bf915){if(_0x4bf915){return _0x4bf915[_0xced3('0x20')](_0x342b9e)[_0xced3('0x21')](function(_0x526854){return _0x526854;});}return null;};}function removeEntity(_0x559fa2,_0x3adf14){return function(_0x101708){if(_0x101708){return _0x101708[_0xced3('0x22')]()[_0xced3('0x21')](function(){_0x559fa2['status'](0xcc)[_0xced3('0x23')]();});}};}function handleEntityNotFound(_0x23f92b,_0x4fc285){return function(_0x3fb4f9){if(!_0x3fb4f9){_0x23f92b['sendStatus'](0x194);}return _0x3fb4f9;};}function handleError(_0x1dcc52,_0x4123ba){_0x4123ba=_0x4123ba||0x1f4;return function(_0x3b728d){logger[_0xced3('0x24')](_0x3b728d[_0xced3('0x25')]);if(_0x3b728d['name']){delete _0x3b728d['name'];}_0x1dcc52[_0xced3('0x17')](_0x4123ba)['send'](_0x3b728d);};}exports[_0xced3('0x26')]=function(_0x1e6923,_0x4a8e85){var _0x3db664={},_0x4024fa={},_0x196956={'count':0x0,'rows':[]};var _0x1032d6=_[_0xced3('0x27')](db[_0xced3('0x28')][_0xced3('0x29')],function(_0x41d003){return{'name':_0x41d003[_0xced3('0x2a')],'type':_0x41d003['type'][_0xced3('0x2b')]};});_0x4024fa[_0xced3('0x2c')]=_[_0xced3('0x27')](_0x1032d6,_0xced3('0x2d'));_0x4024fa[_0xced3('0x2e')]=_[_0xced3('0x2f')](_0x1e6923[_0xced3('0x2e')]);_0x4024fa[_0xced3('0x30')]=_[_0xced3('0x31')](_0x4024fa[_0xced3('0x2c')],_0x4024fa[_0xced3('0x2e')]);_0x3db664[_0xced3('0x32')]=_[_0xced3('0x31')](_0x4024fa[_0xced3('0x2c')],qs[_0xced3('0x33')](_0x1e6923[_0xced3('0x2e')][_0xced3('0x33')]));_0x3db664[_0xced3('0x32')]=_0x3db664[_0xced3('0x32')][_0xced3('0x34')]?_0x3db664[_0xced3('0x32')]:_0x4024fa['model'];if(!_0x1e6923[_0xced3('0x2e')]['hasOwnProperty'](_0xced3('0x35'))){_0x3db664[_0xced3('0x1a')]=qs[_0xced3('0x1a')](_0x1e6923[_0xced3('0x2e')][_0xced3('0x1a')]);_0x3db664[_0xced3('0x1c')]=qs[_0xced3('0x1c')](_0x1e6923[_0xced3('0x2e')][_0xced3('0x1c')]);}_0x3db664[_0xced3('0x36')]=qs['sort'](_0x1e6923[_0xced3('0x2e')][_0xced3('0x37')]);_0x3db664['where']=qs[_0xced3('0x30')](_[_0xced3('0x38')](_0x1e6923[_0xced3('0x2e')],_0x4024fa['filters']),_0x1032d6);if(_0x1e6923['query'][_0xced3('0x39')]){_0x3db664['where']=_[_0xced3('0x3a')](_0x3db664[_0xced3('0x3b')],{'$or':_['map'](_0x1032d6,function(_0x180b65){if(_0x180b65[_0xced3('0x3c')]!==_0xced3('0x3d')){var _0x58b344={};_0x58b344[_0x180b65[_0xced3('0x2d')]]={'$like':'%'+_0x1e6923['query']['filter']+'%'};return _0x58b344;}})});}_0x3db664=_[_0xced3('0x3a')]({},_0x3db664,_0x1e6923[_0xced3('0x3e')]);var _0x217bff={'where':_0x3db664['where']};return db[_0xced3('0x28')][_0xced3('0x1b')](_0x217bff)[_0xced3('0x21')](function(_0x28626b){_0x196956[_0xced3('0x1b')]=_0x28626b;if(_0x1e6923[_0xced3('0x2e')][_0xced3('0x3f')]){_0x3db664[_0xced3('0x40')]=[{'all':!![]}];}return db[_0xced3('0x28')][_0xced3('0x41')](_0x3db664);})[_0xced3('0x21')](function(_0x38855f){_0x196956[_0xced3('0x42')]=_0x38855f;return _0x196956;})[_0xced3('0x21')](respondWithFilteredResult(_0x4a8e85,_0x3db664))[_0xced3('0x43')](handleError(_0x4a8e85,null));};exports['show']=function(_0x4279a3,_0x2ec0ad){var _0x44ff72={'raw':!![],'where':{'id':_0x4279a3[_0xced3('0x44')]['id']}},_0x1a6c1f={};_0x1a6c1f[_0xced3('0x2c')]=_[_0xced3('0x2f')](db[_0xced3('0x28')][_0xced3('0x29')]);_0x1a6c1f['query']=_[_0xced3('0x2f')](_0x4279a3['query']);_0x1a6c1f[_0xced3('0x30')]=_[_0xced3('0x31')](_0x1a6c1f[_0xced3('0x2c')],_0x1a6c1f['query']);_0x44ff72[_0xced3('0x32')]=_[_0xced3('0x31')](_0x1a6c1f[_0xced3('0x2c')],qs[_0xced3('0x33')](_0x4279a3['query'][_0xced3('0x33')]));_0x44ff72[_0xced3('0x32')]=_0x44ff72[_0xced3('0x32')][_0xced3('0x34')]?_0x44ff72[_0xced3('0x32')]:_0x1a6c1f['model'];if(_0x4279a3[_0xced3('0x2e')][_0xced3('0x3f')]){_0x44ff72[_0xced3('0x40')]=[{'all':!![]}];}_0x44ff72=_[_0xced3('0x3a')]({},_0x44ff72,_0x4279a3[_0xced3('0x3e')]);return db[_0xced3('0x28')][_0xced3('0x45')](_0x44ff72)['then'](handleEntityNotFound(_0x2ec0ad,null))[_0xced3('0x21')](respondWithResult(_0x2ec0ad,null))[_0xced3('0x43')](handleError(_0x2ec0ad,null));};exports['create']=function(_0x569c3d,_0x140df2){return db['WhatsappQueueReport'][_0xced3('0x46')](_0x569c3d[_0xced3('0x47')],{})[_0xced3('0x21')](respondWithResult(_0x140df2,0xc9))[_0xced3('0x43')](handleError(_0x140df2,null));};exports[_0xced3('0x20')]=function(_0x1b3396,_0x3700ed){if(_0x1b3396[_0xced3('0x47')]['id']){delete _0x1b3396[_0xced3('0x47')]['id'];}return db['WhatsappQueueReport'][_0xced3('0x45')]({'where':{'id':_0x1b3396[_0xced3('0x44')]['id']}})[_0xced3('0x21')](handleEntityNotFound(_0x3700ed,null))[_0xced3('0x21')](saveUpdates(_0x1b3396[_0xced3('0x47')],null))[_0xced3('0x21')](respondWithResult(_0x3700ed,null))['catch'](handleError(_0x3700ed,null));};exports[_0xced3('0x22')]=function(_0x629ecf,_0x74f70){return db[_0xced3('0x28')][_0xced3('0x45')]({'where':{'id':_0x629ecf[_0xced3('0x44')]['id']}})[_0xced3('0x21')](handleEntityNotFound(_0x74f70,null))[_0xced3('0x21')](removeEntity(_0x74f70,null))[_0xced3('0x43')](handleError(_0x74f70,null));};exports[_0xced3('0x48')]=function(_0x257ff0,_0x3e2a19){return db['WhatsappQueueReport'][_0xced3('0x48')]()['then'](respondWithResult(_0x3e2a19,null))[_0xced3('0x43')](handleError(_0x3e2a19,null));}; \ No newline at end of file +var _0x0bb5=['attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','merge','where','VIRTUAL','options','findAll','show','params','rawAttributes','includeAll','include','find','catch','create','body','update','describe','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','end','name','send','index','map','WhatsappQueueReport','fieldName','type','key','model','query','keys','filters','intersection'];(function(_0x417645,_0x5c3b55){var _0x3386a2=function(_0x2e13ca){while(--_0x2e13ca){_0x417645['push'](_0x417645['shift']());}};_0x3386a2(++_0x5c3b55);}(_0x0bb5,0x148));var _0x50bb=function(_0x5db124,_0x38ec4e){_0x5db124=_0x5db124-0x0;var _0x2f74f4=_0x0bb5[_0x5db124];return _0x2f74f4;};'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(){_0x1a2a0b[_0x50bb('0x1a')](0xcc)[_0x50bb('0x26')]();});}};}function handleEntityNotFound(_0x284a76,_0x3462c1){return function(_0x5234d7){if(!_0x5234d7){_0x284a76[_0x50bb('0x19')](0x194);}return _0x5234d7;};}function handleError(_0x4d38f7,_0x55e87b){_0x55e87b=_0x55e87b||0x1f4;return function(_0x2befd9){logger['error'](_0x2befd9['stack']);if(_0x2befd9[_0x50bb('0x27')]){delete _0x2befd9[_0x50bb('0x27')];}_0x4d38f7[_0x50bb('0x1a')](_0x55e87b)[_0x50bb('0x28')](_0x2befd9);};}exports[_0x50bb('0x29')]=function(_0x269479,_0x41a8ad){var _0x41d479={},_0x4f7514={},_0x44ce86={'count':0x0,'rows':[]};var _0x461cf3=_[_0x50bb('0x2a')](db[_0x50bb('0x2b')]['rawAttributes'],function(_0x13dc3c){return{'name':_0x13dc3c[_0x50bb('0x2c')],'type':_0x13dc3c[_0x50bb('0x2d')][_0x50bb('0x2e')]};});_0x4f7514[_0x50bb('0x2f')]=_[_0x50bb('0x2a')](_0x461cf3,_0x50bb('0x27'));_0x4f7514[_0x50bb('0x30')]=_[_0x50bb('0x31')](_0x269479[_0x50bb('0x30')]);_0x4f7514[_0x50bb('0x32')]=_[_0x50bb('0x33')](_0x4f7514['model'],_0x4f7514[_0x50bb('0x30')]);_0x41d479[_0x50bb('0x34')]=_[_0x50bb('0x33')](_0x4f7514[_0x50bb('0x2f')],qs[_0x50bb('0x35')](_0x269479[_0x50bb('0x30')][_0x50bb('0x35')]));_0x41d479[_0x50bb('0x34')]=_0x41d479[_0x50bb('0x34')][_0x50bb('0x36')]?_0x41d479[_0x50bb('0x34')]:_0x4f7514['model'];if(!_0x269479[_0x50bb('0x30')][_0x50bb('0x37')](_0x50bb('0x38'))){_0x41d479[_0x50bb('0x39')]=qs[_0x50bb('0x39')](_0x269479[_0x50bb('0x30')]['limit']);_0x41d479['offset']=qs[_0x50bb('0x1c')](_0x269479['query'][_0x50bb('0x1c')]);}_0x41d479[_0x50bb('0x3a')]=qs[_0x50bb('0x3b')](_0x269479[_0x50bb('0x30')][_0x50bb('0x3b')]);_0x41d479['where']=qs[_0x50bb('0x32')](_['pick'](_0x269479[_0x50bb('0x30')],_0x4f7514[_0x50bb('0x32')]),_0x461cf3);if(_0x269479[_0x50bb('0x30')]['filter']){_0x41d479['where']=_[_0x50bb('0x3c')](_0x41d479[_0x50bb('0x3d')],{'$or':_[_0x50bb('0x2a')](_0x461cf3,function(_0x21a180){if(_0x21a180['type']!==_0x50bb('0x3e')){var _0x4b75dc={};_0x4b75dc[_0x21a180['name']]={'$like':'%'+_0x269479[_0x50bb('0x30')]['filter']+'%'};return _0x4b75dc;}})});}_0x41d479=_[_0x50bb('0x3c')]({},_0x41d479,_0x269479[_0x50bb('0x3f')]);var _0x1ef231={'where':_0x41d479[_0x50bb('0x3d')]};return db[_0x50bb('0x2b')][_0x50bb('0x1e')](_0x1ef231)[_0x50bb('0x24')](function(_0x1cf782){_0x44ce86[_0x50bb('0x1e')]=_0x1cf782;if(_0x269479[_0x50bb('0x30')]['includeAll']){_0x41d479['include']=[{'all':!![]}];}return db[_0x50bb('0x2b')][_0x50bb('0x40')](_0x41d479);})[_0x50bb('0x24')](function(_0x1d929d){_0x44ce86['rows']=_0x1d929d;return _0x44ce86;})[_0x50bb('0x24')](respondWithFilteredResult(_0x41a8ad,_0x41d479))['catch'](handleError(_0x41a8ad,null));};exports[_0x50bb('0x41')]=function(_0x473a4c,_0x379944){var _0x40748d={'raw':!![],'where':{'id':_0x473a4c[_0x50bb('0x42')]['id']}},_0x1c438b={};_0x1c438b[_0x50bb('0x2f')]=_[_0x50bb('0x31')](db[_0x50bb('0x2b')][_0x50bb('0x43')]);_0x1c438b[_0x50bb('0x30')]=_[_0x50bb('0x31')](_0x473a4c[_0x50bb('0x30')]);_0x1c438b[_0x50bb('0x32')]=_[_0x50bb('0x33')](_0x1c438b[_0x50bb('0x2f')],_0x1c438b['query']);_0x40748d[_0x50bb('0x34')]=_['intersection'](_0x1c438b[_0x50bb('0x2f')],qs[_0x50bb('0x35')](_0x473a4c[_0x50bb('0x30')][_0x50bb('0x35')]));_0x40748d[_0x50bb('0x34')]=_0x40748d[_0x50bb('0x34')][_0x50bb('0x36')]?_0x40748d[_0x50bb('0x34')]:_0x1c438b[_0x50bb('0x2f')];if(_0x473a4c[_0x50bb('0x30')][_0x50bb('0x44')]){_0x40748d[_0x50bb('0x45')]=[{'all':!![]}];}_0x40748d=_[_0x50bb('0x3c')]({},_0x40748d,_0x473a4c[_0x50bb('0x3f')]);return db['WhatsappQueueReport'][_0x50bb('0x46')](_0x40748d)['then'](handleEntityNotFound(_0x379944,null))[_0x50bb('0x24')](respondWithResult(_0x379944,null))[_0x50bb('0x47')](handleError(_0x379944,null));};exports[_0x50bb('0x48')]=function(_0x35b440,_0x650e91){return db[_0x50bb('0x2b')][_0x50bb('0x48')](_0x35b440[_0x50bb('0x49')],{})['then'](respondWithResult(_0x650e91,0xc9))[_0x50bb('0x47')](handleError(_0x650e91,null));};exports[_0x50bb('0x4a')]=function(_0xf52a22,_0x13afe2){if(_0xf52a22[_0x50bb('0x49')]['id']){delete _0xf52a22['body']['id'];}return db[_0x50bb('0x2b')][_0x50bb('0x46')]({'where':{'id':_0xf52a22[_0x50bb('0x42')]['id']}})[_0x50bb('0x24')](handleEntityNotFound(_0x13afe2,null))[_0x50bb('0x24')](saveUpdates(_0xf52a22['body'],null))['then'](respondWithResult(_0x13afe2,null))[_0x50bb('0x47')](handleError(_0x13afe2,null));};exports['destroy']=function(_0x357d08,_0x57ee0e){return db[_0x50bb('0x2b')][_0x50bb('0x46')]({'where':{'id':_0x357d08[_0x50bb('0x42')]['id']}})['then'](handleEntityNotFound(_0x57ee0e,null))[_0x50bb('0x24')](removeEntity(_0x57ee0e,null))[_0x50bb('0x47')](handleError(_0x57ee0e,null));};exports['describe']=function(_0x184147,_0x1dff6a){return db[_0x50bb('0x2b')][_0x50bb('0x4b')]()['then'](respondWithResult(_0x1dff6a,null))[_0x50bb('0x47')](handleError(_0x1dff6a,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.model.js b/server/api/whatsappQueueReport/whatsappQueueReport.model.js index 411183e..7a2979e 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 _0x89ce=['../../config/environment','./whatsappQueueReport.attributes','exports','define','WhatsappQueueReport','report_whatsapp_queue','uniqueid','lodash','util','api','moment','path','rimraf'];(function(_0x59165b,_0x9d69b6){var _0x394783=function(_0x35958c){while(--_0x35958c){_0x59165b['push'](_0x59165b['shift']());}};_0x394783(++_0x9d69b6);}(_0x89ce,0x13f));var _0xe89c=function(_0x2250f9,_0x38689a){_0x2250f9=_0x2250f9-0x0;var _0x3b0775=_0x89ce[_0x2250f9];return _0x3b0775;};'use strict';var _=require(_0xe89c('0x0'));var util=require(_0xe89c('0x1'));var logger=require('../../config/logger')(_0xe89c('0x2'));var moment=require(_0xe89c('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xe89c('0x4'));var rimraf=require(_0xe89c('0x5'));var config=require(_0xe89c('0x6'));var attributes=require(_0xe89c('0x7'));module[_0xe89c('0x8')]=function(_0xb62fae,_0x19d1c0){return _0xb62fae[_0xe89c('0x9')](_0xe89c('0xa'),attributes,{'tableName':_0xe89c('0xb'),'paranoid':![],'indexes':[{'name':_0xe89c('0xc'),'fields':[_0xe89c('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x795e=['util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./whatsappQueueReport.attributes','define','report_whatsapp_queue','lodash'];(function(_0x4c6d6f,_0x291557){var _0x2d4478=function(_0x106946){while(--_0x106946){_0x4c6d6f['push'](_0x4c6d6f['shift']());}};_0x2d4478(++_0x291557);}(_0x795e,0xe3));var _0xe795=function(_0x493bdf,_0x390870){_0x493bdf=_0x493bdf-0x0;var _0x466e3a=_0x795e[_0x493bdf];return _0x466e3a;};'use strict';var _=require(_0xe795('0x0'));var util=require(_0xe795('0x1'));var logger=require('../../config/logger')(_0xe795('0x2'));var moment=require(_0xe795('0x3'));var BPromise=require(_0xe795('0x4'));var rp=require(_0xe795('0x5'));var fs=require('fs');var path=require(_0xe795('0x6'));var rimraf=require(_0xe795('0x7'));var config=require(_0xe795('0x8'));var attributes=require(_0xe795('0x9'));module['exports']=function(_0x2bbafa,_0x544d3e){return _0x2bbafa[_0xe795('0xa')]('WhatsappQueueReport',attributes,{'tableName':_0xe795('0xb'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js b/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js index 1ae31d1..90de976 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 _0x8989=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','WhatsappQueueReport,\x20%s,\x20%s','request\x20sent','debug','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','options','CreateWhatsappQueueReport','WhatsappQueueReport','update','body','raw','where','attributes','UpdateWhatsappQueueReport','lodash'];(function(_0x136a01,_0x3e0f10){var _0x39ccee=function(_0x1fa530){while(--_0x1fa530){_0x136a01['push'](_0x136a01['shift']());}};_0x39ccee(++_0x3e0f10);}(_0x8989,0x8b));var _0x9898=function(_0xd8693f,_0x4b964a){_0xd8693f=_0xd8693f-0x0;var _0x4608a8=_0x8989[_0xd8693f];return _0x4608a8;};'use strict';var _=require(_0x9898('0x0'));var util=require(_0x9898('0x1'));var moment=require(_0x9898('0x2'));var BPromise=require(_0x9898('0x3'));var rs=require(_0x9898('0x4'));var fs=require('fs');var Redis=require(_0x9898('0x5'));var db=require(_0x9898('0x6'))['db'];var utils=require(_0x9898('0x7'));var logger=require(_0x9898('0x8'))(_0x9898('0x9'));var config=require(_0x9898('0xa'));var jayson=require('jayson/promise');var client=jayson[_0x9898('0xb')][_0x9898('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x337631,_0x560820,_0x589809){return new BPromise(function(_0x4e955c,_0x283e0a){return client[_0x9898('0xd')](_0x337631,_0x589809)[_0x9898('0xe')](function(_0x144aed){logger[_0x9898('0xf')](_0x9898('0x10'),_0x560820,_0x9898('0x11'));logger[_0x9898('0x12')](_0x9898('0x13'),_0x560820,_0x9898('0x11'),JSON[_0x9898('0x14')](_0x144aed));if(_0x144aed[_0x9898('0x15')]){if(_0x144aed[_0x9898('0x15')][_0x9898('0x16')]===0x1f4){logger[_0x9898('0x15')](_0x9898('0x10'),_0x560820,_0x144aed[_0x9898('0x15')][_0x9898('0x17')]);return _0x283e0a(_0x144aed[_0x9898('0x15')][_0x9898('0x17')]);}logger[_0x9898('0x15')]('WhatsappQueueReport,\x20%s,\x20%s',_0x560820,_0x144aed[_0x9898('0x15')]['message']);return _0x4e955c(_0x144aed['error'][_0x9898('0x17')]);}else{logger[_0x9898('0xf')](_0x9898('0x10'),_0x560820,_0x9898('0x11'));_0x4e955c(_0x144aed[_0x9898('0x18')][_0x9898('0x17')]);}})[_0x9898('0x19')](function(_0x2ebd15){logger[_0x9898('0x15')](_0x9898('0x10'),_0x560820,_0x2ebd15);_0x283e0a(_0x2ebd15);});});}exports['CreateWhatsappQueueReport']=function(_0x23756e){var _0x4f56ce=this;return new Promise(function(_0x442ec2,_0x8367c1){return db['WhatsappQueueReport']['create'](_0x23756e['body'],{'raw':_0x23756e['options']?_0x23756e[_0x9898('0x1a')]['raw']===undefined?!![]:![]:!![]})[_0x9898('0xe')](function(_0x1424d7){logger['info'](_0x9898('0x1b'),_0x23756e);logger[_0x9898('0x12')](_0x9898('0x1b'),_0x23756e,JSON['stringify'](_0x1424d7));_0x442ec2(_0x1424d7);})[_0x9898('0x19')](function(_0xa9b160){logger['error'](_0x9898('0x1b'),_0xa9b160[_0x9898('0x17')],_0x23756e);_0x8367c1(_0x4f56ce[_0x9898('0x15')](0x1f4,_0xa9b160[_0x9898('0x17')]));});});};exports['UpdateWhatsappQueueReport']=function(_0x2b874a){var _0x446232=this;return new Promise(function(_0x3c2683,_0x6f3fdc){return db[_0x9898('0x1c')][_0x9898('0x1d')](_0x2b874a[_0x9898('0x1e')],{'raw':_0x2b874a[_0x9898('0x1a')]?_0x2b874a[_0x9898('0x1a')][_0x9898('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2b874a[_0x9898('0x1a')]?_0x2b874a['options'][_0x9898('0x20')]||null:null,'attributes':_0x2b874a[_0x9898('0x1a')]?_0x2b874a[_0x9898('0x1a')][_0x9898('0x21')]||null:null,'limit':_0x2b874a[_0x9898('0x1a')]?_0x2b874a['options']['limit']||null:null})[_0x9898('0xe')](function(_0x1b6504){logger['info'](_0x9898('0x22'),_0x2b874a);logger[_0x9898('0x12')](_0x9898('0x22'),_0x2b874a,JSON[_0x9898('0x14')](_0x1b6504));_0x3c2683(_0x1b6504);})[_0x9898('0x19')](function(_0x3ce130){logger[_0x9898('0x15')](_0x9898('0x22'),_0x3ce130['message'],_0x2b874a);_0x6f3fdc(_0x446232[_0x9898('0x15')](0x1f4,_0x3ce130['message']));});});}; \ No newline at end of file +var _0xac1e=['message','result','catch','CreateWhatsappQueueReport','WhatsappQueueReport','body','options','raw','UpdateWhatsappQueueReport','where','attributes','limit','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','WhatsappQueueReport,\x20%s,\x20%s','debug','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0x19add0,_0x4f9463){var _0xc68315=function(_0x131d81){while(--_0x131d81){_0x19add0['push'](_0x19add0['shift']());}};_0xc68315(++_0x4f9463);}(_0xac1e,0xb1));var _0xeac1=function(_0x22149c,_0x13c8ab){_0x22149c=_0x22149c-0x0;var _0x15f67c=_0xac1e[_0x22149c];return _0x15f67c;};'use strict';var _=require('lodash');var util=require(_0xeac1('0x0'));var moment=require(_0xeac1('0x1'));var BPromise=require(_0xeac1('0x2'));var rs=require(_0xeac1('0x3'));var fs=require('fs');var Redis=require(_0xeac1('0x4'));var db=require(_0xeac1('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xeac1('0x6'))('rpc');var config=require(_0xeac1('0x7'));var jayson=require(_0xeac1('0x8'));var client=jayson[_0xeac1('0x9')][_0xeac1('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2b972a,_0x2e0a35,_0x30e951){return new BPromise(function(_0x504634,_0x35c030){return client[_0xeac1('0xb')](_0x2b972a,_0x30e951)[_0xeac1('0xc')](function(_0x173772){logger[_0xeac1('0xd')](_0xeac1('0xe'),_0x2e0a35,'request\x20sent');logger[_0xeac1('0xf')](_0xeac1('0x10'),_0x2e0a35,_0xeac1('0x11'),JSON[_0xeac1('0x12')](_0x173772));if(_0x173772[_0xeac1('0x13')]){if(_0x173772['error'][_0xeac1('0x14')]===0x1f4){logger[_0xeac1('0x13')]('WhatsappQueueReport,\x20%s,\x20%s',_0x2e0a35,_0x173772[_0xeac1('0x13')][_0xeac1('0x15')]);return _0x35c030(_0x173772['error'][_0xeac1('0x15')]);}logger[_0xeac1('0x13')](_0xeac1('0xe'),_0x2e0a35,_0x173772[_0xeac1('0x13')][_0xeac1('0x15')]);return _0x504634(_0x173772[_0xeac1('0x13')]['message']);}else{logger[_0xeac1('0xd')]('WhatsappQueueReport,\x20%s,\x20%s',_0x2e0a35,_0xeac1('0x11'));_0x504634(_0x173772[_0xeac1('0x16')][_0xeac1('0x15')]);}})[_0xeac1('0x17')](function(_0x4c52e9){logger[_0xeac1('0x13')](_0xeac1('0xe'),_0x2e0a35,_0x4c52e9);_0x35c030(_0x4c52e9);});});}exports[_0xeac1('0x18')]=function(_0x50a6a1){var _0x2e1731=this;return new Promise(function(_0x113954,_0x219847){return db[_0xeac1('0x19')]['create'](_0x50a6a1[_0xeac1('0x1a')],{'raw':_0x50a6a1[_0xeac1('0x1b')]?_0x50a6a1[_0xeac1('0x1b')][_0xeac1('0x1c')]===undefined?!![]:![]:!![]})[_0xeac1('0xc')](function(_0x1971f8){logger[_0xeac1('0xd')]('CreateWhatsappQueueReport',_0x50a6a1);logger['debug'](_0xeac1('0x18'),_0x50a6a1,JSON[_0xeac1('0x12')](_0x1971f8));_0x113954(_0x1971f8);})[_0xeac1('0x17')](function(_0x475c7d){logger[_0xeac1('0x13')](_0xeac1('0x18'),_0x475c7d[_0xeac1('0x15')],_0x50a6a1);_0x219847(_0x2e1731[_0xeac1('0x13')](0x1f4,_0x475c7d[_0xeac1('0x15')]));});});};exports[_0xeac1('0x1d')]=function(_0x183468){var _0x581f40=this;return new Promise(function(_0x11abba,_0x8f1ef){return db['WhatsappQueueReport']['update'](_0x183468[_0xeac1('0x1a')],{'raw':_0x183468[_0xeac1('0x1b')]?_0x183468[_0xeac1('0x1b')][_0xeac1('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x183468[_0xeac1('0x1b')]?_0x183468[_0xeac1('0x1b')][_0xeac1('0x1e')]||null:null,'attributes':_0x183468['options']?_0x183468[_0xeac1('0x1b')][_0xeac1('0x1f')]||null:null,'limit':_0x183468[_0xeac1('0x1b')]?_0x183468[_0xeac1('0x1b')][_0xeac1('0x20')]||null:null})['then'](function(_0x32ddf){logger[_0xeac1('0xd')]('UpdateWhatsappQueueReport',_0x183468);logger[_0xeac1('0xf')](_0xeac1('0x1d'),_0x183468,JSON['stringify'](_0x32ddf));_0x11abba(_0x32ddf);})[_0xeac1('0x17')](function(_0x5d6f3b){logger[_0xeac1('0x13')](_0xeac1('0x1d'),_0x5d6f3b[_0xeac1('0x15')],_0x183468);_0x8f1ef(_0x581f40[_0xeac1('0x13')](0x1f4,_0x5d6f3b[_0xeac1('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/index.js b/server/api/whatsappTransferReport/index.js index 2f4e29a..d12e73c 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 _0x3ba6=['../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappTransferReport.controller','get','/describe','isAuthenticated','/:id','create','put','destroy','multer','util','path','Router'];(function(_0x2cc711,_0x300328){var _0x31a52e=function(_0x588378){while(--_0x588378){_0x2cc711['push'](_0x2cc711['shift']());}};_0x31a52e(++_0x300328);}(_0x3ba6,0x10a));var _0x63ba=function(_0xbc4560,_0x4020b8){_0xbc4560=_0xbc4560-0x0;var _0x298cfb=_0x3ba6[_0xbc4560];return _0x298cfb;};'use strict';var multer=require(_0x63ba('0x0'));var util=require(_0x63ba('0x1'));var path=require(_0x63ba('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x63ba('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x63ba('0x4'));var interaction=require(_0x63ba('0x5'));var config=require(_0x63ba('0x6'));var controller=require(_0x63ba('0x7'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x63ba('0x8')](_0x63ba('0x9'),auth[_0x63ba('0xa')](),controller['describe']);router[_0x63ba('0x8')](_0x63ba('0xb'),auth[_0x63ba('0xa')](),controller['show']);router['post']('/',auth[_0x63ba('0xa')](),controller[_0x63ba('0xc')]);router[_0x63ba('0xd')](_0x63ba('0xb'),auth[_0x63ba('0xa')](),controller['update']);router['delete'](_0x63ba('0xb'),auth['isAuthenticated'](),controller[_0x63ba('0xe')]);module['exports']=router; \ No newline at end of file +var _0xfcef=['exports','multer','path','connect-timeout','express','../../components/interaction/service','../../config/environment','./whatsappTransferReport.controller','isAuthenticated','index','get','describe','/:id','post','create','put','update','delete','destroy'];(function(_0x1adda4,_0x537884){var _0x4f9025=function(_0x1b82eb){while(--_0x1b82eb){_0x1adda4['push'](_0x1adda4['shift']());}};_0x4f9025(++_0x537884);}(_0xfcef,0x190));var _0xffce=function(_0x43a1bd,_0x381580){_0x43a1bd=_0x43a1bd-0x0;var _0x31207f=_0xfcef[_0x43a1bd];return _0x31207f;};'use strict';var multer=require(_0xffce('0x0'));var util=require('util');var path=require(_0xffce('0x1'));var timeout=require(_0xffce('0x2'));var express=require(_0xffce('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xffce('0x4'));var config=require(_0xffce('0x5'));var controller=require(_0xffce('0x6'));router['get']('/',auth[_0xffce('0x7')](),controller[_0xffce('0x8')]);router[_0xffce('0x9')]('/describe',auth[_0xffce('0x7')](),controller[_0xffce('0xa')]);router[_0xffce('0x9')](_0xffce('0xb'),auth[_0xffce('0x7')](),controller['show']);router[_0xffce('0xc')]('/',auth['isAuthenticated'](),controller[_0xffce('0xd')]);router[_0xffce('0xe')](_0xffce('0xb'),auth[_0xffce('0x7')](),controller[_0xffce('0xf')]);router[_0xffce('0x10')](_0xffce('0xb'),auth[_0xffce('0x7')](),controller[_0xffce('0x11')]);module[_0xffce('0x12')]=router; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js b/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js index 5e6491d..d7f07cb 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 _0x13b6=['DATE','sequelize','STRING','ENUM','account','agent'];(function(_0x1b9c08,_0x375d1e){var _0x3c0e37=function(_0x2e24c3){while(--_0x2e24c3){_0x1b9c08['push'](_0x1b9c08['shift']());}};_0x3c0e37(++_0x375d1e);}(_0x13b6,0x97));var _0x613b=function(_0x2f28c8,_0x4f2713){_0x2f28c8=_0x2f28c8-0x0;var _0x5685e7=_0x13b6[_0x2f28c8];return _0x5685e7;};'use strict';var Sequelize=require(_0x613b('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x613b('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x613b('0x2')](_0x613b('0x3'),_0x613b('0x4'),'queue'),'allowNull':![]},'transferredAt':{'type':Sequelize[_0x613b('0x5')]}}; \ No newline at end of file +var _0xa846=['ENUM','account','agent','queue','exports','STRING'];(function(_0x5737e3,_0x56228c){var _0x206724=function(_0x2ab91d){while(--_0x2ab91d){_0x5737e3['push'](_0x5737e3['shift']());}};_0x206724(++_0x56228c);}(_0xa846,0x70));var _0x6a84=function(_0x22e976,_0x3a9adb){_0x22e976=_0x22e976-0x0;var _0x41037d=_0xa846[_0x22e976];return _0x41037d;};'use strict';var Sequelize=require('sequelize');module[_0x6a84('0x0')]={'uniqueid':{'type':Sequelize[_0x6a84('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x6a84('0x2')](_0x6a84('0x3'),_0x6a84('0x4'),_0x6a84('0x5')),'allowNull':![]},'transferredAt':{'type':Sequelize['DATE']}}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.controller.js b/server/api/whatsappTransferReport/whatsappTransferReport.controller.js index 52f4171..6dc1b47 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 _0x9c4a=['bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','map','WhatsappTransferReport','rawAttributes','fieldName','key','name','keys','query','filters','intersection','attributes','model','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','catch','show','fields','find','create','body','params','describe','rimraf','fast-json-patch','request-promise'];(function(_0x32ee8d,_0x1a90f2){var _0x17114=function(_0x3f3627){while(--_0x3f3627){_0x32ee8d['push'](_0x32ee8d['shift']());}};_0x17114(++_0x1a90f2);}(_0x9c4a,0x1dd));var _0xa9c4=function(_0x1d50f2,_0x3c3ec6){_0x1d50f2=_0x1d50f2-0x0;var _0x3769b8=_0x9c4a[_0x1d50f2];return _0x3769b8;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa9c4('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa9c4('0x1'));var rp=require(_0xa9c4('0x2'));var moment=require('moment');var BPromise=require(_0xa9c4('0x3'));var Mustache=require('mustache');var util=require(_0xa9c4('0x4'));var path=require(_0xa9c4('0x5'));var sox=require(_0xa9c4('0x6'));var csv=require(_0xa9c4('0x7'));var ejs=require(_0xa9c4('0x8'));var fs=require('fs');var fs_extra=require(_0xa9c4('0x9'));var _=require(_0xa9c4('0xa'));var squel=require(_0xa9c4('0xb'));var crypto=require(_0xa9c4('0xc'));var jsforce=require(_0xa9c4('0xd'));var deskjs=require(_0xa9c4('0xe'));var toCsv=require(_0xa9c4('0x7'));var querystring=require(_0xa9c4('0xf'));var Papa=require(_0xa9c4('0x10'));var Redis=require(_0xa9c4('0x11'));var authService=require(_0xa9c4('0x12'));var qs=require(_0xa9c4('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa9c4('0x14'));var logger=require(_0xa9c4('0x15'))(_0xa9c4('0x16'));var utils=require(_0xa9c4('0x17'));var config=require(_0xa9c4('0x18'));var licenseUtil=require(_0xa9c4('0x19'));var db=require(_0xa9c4('0x1a'))['db'];function respondWithStatusCode(_0x5c948f,_0xb6f1b8){_0xb6f1b8=_0xb6f1b8||0xcc;return function(_0x3fd036){if(_0x3fd036){return _0x5c948f[_0xa9c4('0x1b')](_0xb6f1b8);}return _0x5c948f[_0xa9c4('0x1c')](_0xb6f1b8)[_0xa9c4('0x1d')]();};}function respondWithResult(_0x1153e6,_0x59bfee){_0x59bfee=_0x59bfee||0xc8;return function(_0x187613){if(_0x187613){return _0x1153e6[_0xa9c4('0x1c')](_0x59bfee)[_0xa9c4('0x1e')](_0x187613);}};}function respondWithFilteredResult(_0x5d4828,_0x2611b3){return function(_0x8402a1){if(_0x8402a1){var _0x548190=typeof _0x2611b3[_0xa9c4('0x1f')]===_0xa9c4('0x20')&&typeof _0x2611b3['limit']===_0xa9c4('0x20');var _0x54d4ae=_0x8402a1[_0xa9c4('0x21')];var _0x4d476d=_0x548190?0x0:_0x2611b3[_0xa9c4('0x1f')];var _0x1375f5=_0x548190?_0x8402a1[_0xa9c4('0x21')]:_0x2611b3['offset']+_0x2611b3[_0xa9c4('0x22')];var _0x209c50;if(_0x1375f5>=_0x54d4ae){_0x1375f5=_0x54d4ae;_0x209c50=0xc8;}else{_0x209c50=0xce;}_0x5d4828[_0xa9c4('0x1c')](_0x209c50);return _0x5d4828[_0xa9c4('0x23')](_0xa9c4('0x24'),_0x4d476d+'-'+_0x1375f5+'/'+_0x54d4ae)['json'](_0x8402a1);}return null;};}function patchUpdates(_0x18bd78){return function(_0x635787){try{jsonpatch[_0xa9c4('0x25')](_0x635787,_0x18bd78,!![]);}catch(_0x416849){return BPromise[_0xa9c4('0x26')](_0x416849);}return _0x635787[_0xa9c4('0x27')]();};}function saveUpdates(_0x516c76,_0x393a36){return function(_0x31fcc5){if(_0x31fcc5){return _0x31fcc5[_0xa9c4('0x28')](_0x516c76)[_0xa9c4('0x29')](function(_0x1e5d12){return _0x1e5d12;});}return null;};}function removeEntity(_0x3afffa,_0x4dad6a){return function(_0x4455bb){if(_0x4455bb){return _0x4455bb[_0xa9c4('0x2a')]()['then'](function(){_0x3afffa['status'](0xcc)[_0xa9c4('0x1d')]();});}};}function handleEntityNotFound(_0x29300f,_0x43c7a7){return function(_0x42f1bd){if(!_0x42f1bd){_0x29300f[_0xa9c4('0x1b')](0x194);}return _0x42f1bd;};}function handleError(_0x4036ee,_0x339575){_0x339575=_0x339575||0x1f4;return function(_0x19aea2){logger[_0xa9c4('0x2b')](_0x19aea2[_0xa9c4('0x2c')]);if(_0x19aea2['name']){delete _0x19aea2['name'];}_0x4036ee[_0xa9c4('0x1c')](_0x339575)['send'](_0x19aea2);};}exports['index']=function(_0x836f56,_0x55b753){var _0x4eb8e1={},_0x42be63={},_0x3a148b={'count':0x0,'rows':[]};var _0xa18b9d=_[_0xa9c4('0x2d')](db[_0xa9c4('0x2e')][_0xa9c4('0x2f')],function(_0x87ba4d){return{'name':_0x87ba4d[_0xa9c4('0x30')],'type':_0x87ba4d['type'][_0xa9c4('0x31')]};});_0x42be63['model']=_['map'](_0xa18b9d,_0xa9c4('0x32'));_0x42be63['query']=_[_0xa9c4('0x33')](_0x836f56[_0xa9c4('0x34')]);_0x42be63[_0xa9c4('0x35')]=_[_0xa9c4('0x36')](_0x42be63['model'],_0x42be63[_0xa9c4('0x34')]);_0x4eb8e1[_0xa9c4('0x37')]=_[_0xa9c4('0x36')](_0x42be63[_0xa9c4('0x38')],qs['fields'](_0x836f56[_0xa9c4('0x34')]['fields']));_0x4eb8e1['attributes']=_0x4eb8e1[_0xa9c4('0x37')][_0xa9c4('0x39')]?_0x4eb8e1[_0xa9c4('0x37')]:_0x42be63['model'];if(!_0x836f56[_0xa9c4('0x34')][_0xa9c4('0x3a')](_0xa9c4('0x3b'))){_0x4eb8e1[_0xa9c4('0x22')]=qs[_0xa9c4('0x22')](_0x836f56[_0xa9c4('0x34')][_0xa9c4('0x22')]);_0x4eb8e1['offset']=qs[_0xa9c4('0x1f')](_0x836f56[_0xa9c4('0x34')][_0xa9c4('0x1f')]);}_0x4eb8e1[_0xa9c4('0x3c')]=qs[_0xa9c4('0x3d')](_0x836f56[_0xa9c4('0x34')]['sort']);_0x4eb8e1[_0xa9c4('0x3e')]=qs[_0xa9c4('0x35')](_[_0xa9c4('0x3f')](_0x836f56[_0xa9c4('0x34')],_0x42be63[_0xa9c4('0x35')]),_0xa18b9d);if(_0x836f56[_0xa9c4('0x34')][_0xa9c4('0x40')]){_0x4eb8e1[_0xa9c4('0x3e')]=_[_0xa9c4('0x41')](_0x4eb8e1[_0xa9c4('0x3e')],{'$or':_[_0xa9c4('0x2d')](_0xa18b9d,function(_0x36f824){if(_0x36f824[_0xa9c4('0x42')]!==_0xa9c4('0x43')){var _0x1e2f1b={};_0x1e2f1b[_0x36f824[_0xa9c4('0x32')]]={'$like':'%'+_0x836f56[_0xa9c4('0x34')]['filter']+'%'};return _0x1e2f1b;}})});}_0x4eb8e1=_['merge']({},_0x4eb8e1,_0x836f56[_0xa9c4('0x44')]);var _0x5c205f={'where':_0x4eb8e1[_0xa9c4('0x3e')]};return db['WhatsappTransferReport'][_0xa9c4('0x21')](_0x5c205f)[_0xa9c4('0x29')](function(_0x187992){_0x3a148b['count']=_0x187992;if(_0x836f56[_0xa9c4('0x34')][_0xa9c4('0x45')]){_0x4eb8e1[_0xa9c4('0x46')]=[{'all':!![]}];}return db[_0xa9c4('0x2e')][_0xa9c4('0x47')](_0x4eb8e1);})['then'](function(_0x1d5504){_0x3a148b['rows']=_0x1d5504;return _0x3a148b;})[_0xa9c4('0x29')](respondWithFilteredResult(_0x55b753,_0x4eb8e1))[_0xa9c4('0x48')](handleError(_0x55b753,null));};exports[_0xa9c4('0x49')]=function(_0x570bdf,_0x3b26e8){var _0x431185={'raw':!![],'where':{'id':_0x570bdf['params']['id']}},_0x46e3b7={};_0x46e3b7['model']=_[_0xa9c4('0x33')](db['WhatsappTransferReport'][_0xa9c4('0x2f')]);_0x46e3b7[_0xa9c4('0x34')]=_[_0xa9c4('0x33')](_0x570bdf['query']);_0x46e3b7[_0xa9c4('0x35')]=_['intersection'](_0x46e3b7['model'],_0x46e3b7[_0xa9c4('0x34')]);_0x431185[_0xa9c4('0x37')]=_[_0xa9c4('0x36')](_0x46e3b7[_0xa9c4('0x38')],qs[_0xa9c4('0x4a')](_0x570bdf[_0xa9c4('0x34')]['fields']));_0x431185[_0xa9c4('0x37')]=_0x431185[_0xa9c4('0x37')][_0xa9c4('0x39')]?_0x431185[_0xa9c4('0x37')]:_0x46e3b7[_0xa9c4('0x38')];if(_0x570bdf[_0xa9c4('0x34')][_0xa9c4('0x45')]){_0x431185[_0xa9c4('0x46')]=[{'all':!![]}];}_0x431185=_[_0xa9c4('0x41')]({},_0x431185,_0x570bdf[_0xa9c4('0x44')]);return db['WhatsappTransferReport'][_0xa9c4('0x4b')](_0x431185)[_0xa9c4('0x29')](handleEntityNotFound(_0x3b26e8,null))[_0xa9c4('0x29')](respondWithResult(_0x3b26e8,null))[_0xa9c4('0x48')](handleError(_0x3b26e8,null));};exports[_0xa9c4('0x4c')]=function(_0x29bcce,_0x352c11){return db[_0xa9c4('0x2e')]['create'](_0x29bcce[_0xa9c4('0x4d')],{})[_0xa9c4('0x29')](respondWithResult(_0x352c11,0xc9))[_0xa9c4('0x48')](handleError(_0x352c11,null));};exports[_0xa9c4('0x28')]=function(_0x48e6af,_0x4cb5be){if(_0x48e6af[_0xa9c4('0x4d')]['id']){delete _0x48e6af[_0xa9c4('0x4d')]['id'];}return db[_0xa9c4('0x2e')][_0xa9c4('0x4b')]({'where':{'id':_0x48e6af[_0xa9c4('0x4e')]['id']}})[_0xa9c4('0x29')](handleEntityNotFound(_0x4cb5be,null))[_0xa9c4('0x29')](saveUpdates(_0x48e6af[_0xa9c4('0x4d')],null))[_0xa9c4('0x29')](respondWithResult(_0x4cb5be,null))[_0xa9c4('0x48')](handleError(_0x4cb5be,null));};exports['destroy']=function(_0x46c0de,_0x1adee6){return db[_0xa9c4('0x2e')][_0xa9c4('0x4b')]({'where':{'id':_0x46c0de[_0xa9c4('0x4e')]['id']}})['then'](handleEntityNotFound(_0x1adee6,null))[_0xa9c4('0x29')](removeEntity(_0x1adee6,null))[_0xa9c4('0x48')](handleError(_0x1adee6,null));};exports[_0xa9c4('0x4f')]=function(_0x111715,_0x1f1888){return db[_0xa9c4('0x2e')][_0xa9c4('0x4f')]()[_0xa9c4('0x29')](respondWithResult(_0x1f1888,null))[_0xa9c4('0x48')](handleError(_0x1f1888,null));}; \ No newline at end of file +var _0xa775=['end','json','offset','limit','undefined','count','status','reject','save','then','error','stack','name','index','map','WhatsappTransferReport','type','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','order','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','rawAttributes','find','create','body','describe','eml-format','zip-dir','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus'];(function(_0x4eb343,_0x3d098a){var _0x2016e7=function(_0x4a910e){while(--_0x4a910e){_0x4eb343['push'](_0x4eb343['shift']());}};_0x2016e7(++_0x3d098a);}(_0xa775,0xf6));var _0x5a77=function(_0xcf3012,_0x4face6){_0xcf3012=_0xcf3012-0x0;var _0xcdd88c=_0xa775[_0xcf3012];return _0xcdd88c;};'use strict';var emlformat=require(_0x5a77('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x5a77('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x5a77('0x2'));var BPromise=require(_0x5a77('0x3'));var Mustache=require(_0x5a77('0x4'));var util=require(_0x5a77('0x5'));var path=require('path');var sox=require(_0x5a77('0x6'));var csv=require(_0x5a77('0x7'));var ejs=require(_0x5a77('0x8'));var fs=require('fs');var fs_extra=require(_0x5a77('0x9'));var _=require(_0x5a77('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x5a77('0x7'));var querystring=require(_0x5a77('0xb'));var Papa=require(_0x5a77('0xc'));var Redis=require(_0x5a77('0xd'));var authService=require(_0x5a77('0xe'));var qs=require(_0x5a77('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5a77('0x10'));var logger=require(_0x5a77('0x11'))('api');var utils=require(_0x5a77('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0x5a77('0x13'));var db=require(_0x5a77('0x14'))['db'];function respondWithStatusCode(_0x1767cf,_0x1c6431){_0x1c6431=_0x1c6431||0xcc;return function(_0x39efe1){if(_0x39efe1){return _0x1767cf[_0x5a77('0x15')](_0x1c6431);}return _0x1767cf['status'](_0x1c6431)[_0x5a77('0x16')]();};}function respondWithResult(_0x426dca,_0x1bce83){_0x1bce83=_0x1bce83||0xc8;return function(_0x20c918){if(_0x20c918){return _0x426dca['status'](_0x1bce83)[_0x5a77('0x17')](_0x20c918);}};}function respondWithFilteredResult(_0x371a14,_0x4fcc0c){return function(_0x8eafae){if(_0x8eafae){var _0x263dfc=typeof _0x4fcc0c[_0x5a77('0x18')]==='undefined'&&typeof _0x4fcc0c[_0x5a77('0x19')]===_0x5a77('0x1a');var _0x1e5737=_0x8eafae[_0x5a77('0x1b')];var _0x5628e2=_0x263dfc?0x0:_0x4fcc0c[_0x5a77('0x18')];var _0x53c754=_0x263dfc?_0x8eafae[_0x5a77('0x1b')]:_0x4fcc0c[_0x5a77('0x18')]+_0x4fcc0c[_0x5a77('0x19')];var _0x1ee993;if(_0x53c754>=_0x1e5737){_0x53c754=_0x1e5737;_0x1ee993=0xc8;}else{_0x1ee993=0xce;}_0x371a14[_0x5a77('0x1c')](_0x1ee993);return _0x371a14['set']('Content-Range',_0x5628e2+'-'+_0x53c754+'/'+_0x1e5737)[_0x5a77('0x17')](_0x8eafae);}return null;};}function patchUpdates(_0x2271c3){return function(_0x1ff5ec){try{jsonpatch['apply'](_0x1ff5ec,_0x2271c3,!![]);}catch(_0x47b333){return BPromise[_0x5a77('0x1d')](_0x47b333);}return _0x1ff5ec[_0x5a77('0x1e')]();};}function saveUpdates(_0x22a9d5,_0x3a4c3b){return function(_0x204a96){if(_0x204a96){return _0x204a96['update'](_0x22a9d5)[_0x5a77('0x1f')](function(_0x3dc430){return _0x3dc430;});}return null;};}function removeEntity(_0x5db7a2,_0x2439d4){return function(_0x179589){if(_0x179589){return _0x179589['destroy']()[_0x5a77('0x1f')](function(){_0x5db7a2[_0x5a77('0x1c')](0xcc)[_0x5a77('0x16')]();});}};}function handleEntityNotFound(_0x49d0d9,_0x24e89d){return function(_0x3fc1c2){if(!_0x3fc1c2){_0x49d0d9[_0x5a77('0x15')](0x194);}return _0x3fc1c2;};}function handleError(_0x1aa032,_0x2b8a3e){_0x2b8a3e=_0x2b8a3e||0x1f4;return function(_0x2cdb03){logger[_0x5a77('0x20')](_0x2cdb03[_0x5a77('0x21')]);if(_0x2cdb03[_0x5a77('0x22')]){delete _0x2cdb03[_0x5a77('0x22')];}_0x1aa032[_0x5a77('0x1c')](_0x2b8a3e)['send'](_0x2cdb03);};}exports[_0x5a77('0x23')]=function(_0x45119e,_0x1dd0b5){var _0x54d317={},_0x48e547={},_0x5dadc7={'count':0x0,'rows':[]};var _0x4cbf4e=_[_0x5a77('0x24')](db[_0x5a77('0x25')]['rawAttributes'],function(_0xfbeef3){return{'name':_0xfbeef3['fieldName'],'type':_0xfbeef3[_0x5a77('0x26')][_0x5a77('0x27')]};});_0x48e547['model']=_['map'](_0x4cbf4e,_0x5a77('0x22'));_0x48e547[_0x5a77('0x28')]=_[_0x5a77('0x29')](_0x45119e[_0x5a77('0x28')]);_0x48e547[_0x5a77('0x2a')]=_[_0x5a77('0x2b')](_0x48e547[_0x5a77('0x2c')],_0x48e547[_0x5a77('0x28')]);_0x54d317['attributes']=_[_0x5a77('0x2b')](_0x48e547[_0x5a77('0x2c')],qs[_0x5a77('0x2d')](_0x45119e['query'][_0x5a77('0x2d')]));_0x54d317[_0x5a77('0x2e')]=_0x54d317['attributes'][_0x5a77('0x2f')]?_0x54d317[_0x5a77('0x2e')]:_0x48e547[_0x5a77('0x2c')];if(!_0x45119e['query'][_0x5a77('0x30')]('nolimit')){_0x54d317[_0x5a77('0x19')]=qs['limit'](_0x45119e[_0x5a77('0x28')][_0x5a77('0x19')]);_0x54d317[_0x5a77('0x18')]=qs[_0x5a77('0x18')](_0x45119e['query'][_0x5a77('0x18')]);}_0x54d317[_0x5a77('0x31')]=qs['sort'](_0x45119e['query']['sort']);_0x54d317['where']=qs[_0x5a77('0x2a')](_[_0x5a77('0x32')](_0x45119e['query'],_0x48e547[_0x5a77('0x2a')]),_0x4cbf4e);if(_0x45119e[_0x5a77('0x28')][_0x5a77('0x33')]){_0x54d317[_0x5a77('0x34')]=_[_0x5a77('0x35')](_0x54d317[_0x5a77('0x34')],{'$or':_[_0x5a77('0x24')](_0x4cbf4e,function(_0x887e8c){if(_0x887e8c[_0x5a77('0x26')]!==_0x5a77('0x36')){var _0x42d4eb={};_0x42d4eb[_0x887e8c[_0x5a77('0x22')]]={'$like':'%'+_0x45119e[_0x5a77('0x28')][_0x5a77('0x33')]+'%'};return _0x42d4eb;}})});}_0x54d317=_[_0x5a77('0x35')]({},_0x54d317,_0x45119e[_0x5a77('0x37')]);var _0x4d8ce9={'where':_0x54d317[_0x5a77('0x34')]};return db[_0x5a77('0x25')][_0x5a77('0x1b')](_0x4d8ce9)['then'](function(_0x1eb4d6){_0x5dadc7[_0x5a77('0x1b')]=_0x1eb4d6;if(_0x45119e[_0x5a77('0x28')][_0x5a77('0x38')]){_0x54d317[_0x5a77('0x39')]=[{'all':!![]}];}return db[_0x5a77('0x25')][_0x5a77('0x3a')](_0x54d317);})[_0x5a77('0x1f')](function(_0xf52b83){_0x5dadc7[_0x5a77('0x3b')]=_0xf52b83;return _0x5dadc7;})['then'](respondWithFilteredResult(_0x1dd0b5,_0x54d317))[_0x5a77('0x3c')](handleError(_0x1dd0b5,null));};exports['show']=function(_0x4269f0,_0x38c6e3){var _0xda875={'raw':!![],'where':{'id':_0x4269f0[_0x5a77('0x3d')]['id']}},_0x27a450={};_0x27a450[_0x5a77('0x2c')]=_['keys'](db['WhatsappTransferReport'][_0x5a77('0x3e')]);_0x27a450[_0x5a77('0x28')]=_['keys'](_0x4269f0['query']);_0x27a450[_0x5a77('0x2a')]=_[_0x5a77('0x2b')](_0x27a450[_0x5a77('0x2c')],_0x27a450[_0x5a77('0x28')]);_0xda875[_0x5a77('0x2e')]=_['intersection'](_0x27a450[_0x5a77('0x2c')],qs[_0x5a77('0x2d')](_0x4269f0[_0x5a77('0x28')][_0x5a77('0x2d')]));_0xda875['attributes']=_0xda875[_0x5a77('0x2e')][_0x5a77('0x2f')]?_0xda875[_0x5a77('0x2e')]:_0x27a450['model'];if(_0x4269f0['query'][_0x5a77('0x38')]){_0xda875['include']=[{'all':!![]}];}_0xda875=_[_0x5a77('0x35')]({},_0xda875,_0x4269f0[_0x5a77('0x37')]);return db[_0x5a77('0x25')][_0x5a77('0x3f')](_0xda875)[_0x5a77('0x1f')](handleEntityNotFound(_0x38c6e3,null))[_0x5a77('0x1f')](respondWithResult(_0x38c6e3,null))[_0x5a77('0x3c')](handleError(_0x38c6e3,null));};exports[_0x5a77('0x40')]=function(_0x35a252,_0x1a15d0){return db[_0x5a77('0x25')]['create'](_0x35a252[_0x5a77('0x41')],{})[_0x5a77('0x1f')](respondWithResult(_0x1a15d0,0xc9))[_0x5a77('0x3c')](handleError(_0x1a15d0,null));};exports['update']=function(_0x3ec766,_0x3db645){if(_0x3ec766[_0x5a77('0x41')]['id']){delete _0x3ec766['body']['id'];}return db[_0x5a77('0x25')]['find']({'where':{'id':_0x3ec766[_0x5a77('0x3d')]['id']}})[_0x5a77('0x1f')](handleEntityNotFound(_0x3db645,null))[_0x5a77('0x1f')](saveUpdates(_0x3ec766[_0x5a77('0x41')],null))[_0x5a77('0x1f')](respondWithResult(_0x3db645,null))[_0x5a77('0x3c')](handleError(_0x3db645,null));};exports['destroy']=function(_0x244c6e,_0x3f3efe){return db[_0x5a77('0x25')][_0x5a77('0x3f')]({'where':{'id':_0x244c6e[_0x5a77('0x3d')]['id']}})[_0x5a77('0x1f')](handleEntityNotFound(_0x3f3efe,null))[_0x5a77('0x1f')](removeEntity(_0x3f3efe,null))[_0x5a77('0x3c')](handleError(_0x3f3efe,null));};exports[_0x5a77('0x42')]=function(_0x54e094,_0x27a3ff){return db[_0x5a77('0x25')][_0x5a77('0x42')]()[_0x5a77('0x1f')](respondWithResult(_0x27a3ff,null))['catch'](handleError(_0x27a3ff,null));}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.model.js b/server/api/whatsappTransferReport/whatsappTransferReport.model.js index 0703379..0ab619d 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 _0xcf86=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./whatsappTransferReport.attributes','define','WhatsappTransferReport','report_whatsapp_transfer','uniqueid','lodash','util','../../config/logger'];(function(_0x31cdfc,_0x1f5504){var _0x3aad21=function(_0x46624f){while(--_0x46624f){_0x31cdfc['push'](_0x31cdfc['shift']());}};_0x3aad21(++_0x1f5504);}(_0xcf86,0x93));var _0x6cf8=function(_0x1e3c16,_0x372caa){_0x1e3c16=_0x1e3c16-0x0;var _0x47a0c9=_0xcf86[_0x1e3c16];return _0x47a0c9;};'use strict';var _=require(_0x6cf8('0x0'));var util=require(_0x6cf8('0x1'));var logger=require(_0x6cf8('0x2'))(_0x6cf8('0x3'));var moment=require(_0x6cf8('0x4'));var BPromise=require(_0x6cf8('0x5'));var rp=require(_0x6cf8('0x6'));var fs=require('fs');var path=require(_0x6cf8('0x7'));var rimraf=require(_0x6cf8('0x8'));var config=require(_0x6cf8('0x9'));var attributes=require(_0x6cf8('0xa'));module['exports']=function(_0x2bee71,_0x5e6a42){return _0x2bee71[_0x6cf8('0xb')](_0x6cf8('0xc'),attributes,{'tableName':_0x6cf8('0xd'),'paranoid':![],'indexes':[{'name':_0x6cf8('0xe'),'fields':[_0x6cf8('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x6ba8=['uniqueid','lodash','util','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','./whatsappTransferReport.attributes','define'];(function(_0x1c1a23,_0x3c2672){var _0x2da98c=function(_0x174da9){while(--_0x174da9){_0x1c1a23['push'](_0x1c1a23['shift']());}};_0x2da98c(++_0x3c2672);}(_0x6ba8,0x1ae));var _0x86ba=function(_0x191fc1,_0x5055b6){_0x191fc1=_0x191fc1-0x0;var _0x4b0db9=_0x6ba8[_0x191fc1];return _0x4b0db9;};'use strict';var _=require(_0x86ba('0x0'));var util=require(_0x86ba('0x1'));var logger=require(_0x86ba('0x2'))('api');var moment=require(_0x86ba('0x3'));var BPromise=require(_0x86ba('0x4'));var rp=require(_0x86ba('0x5'));var fs=require('fs');var path=require(_0x86ba('0x6'));var rimraf=require('rimraf');var config=require(_0x86ba('0x7'));var attributes=require(_0x86ba('0x8'));module['exports']=function(_0x1e6803,_0x20ecf1){return _0x1e6803[_0x86ba('0x9')]('WhatsappTransferReport',attributes,{'tableName':'report_whatsapp_transfer','paranoid':![],'indexes':[{'name':_0x86ba('0xa'),'fields':[_0x86ba('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js b/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js index 97b6bc4..8460cbc 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 _0xe69d=['result','lodash','bluebird','randomstring','../../config/utils','../../config/logger','jayson/promise','client','request','then','info','WhatsappTransferReport,\x20%s,\x20%s','request\x20sent','debug','WhatsappTransferReport,\x20%s,\x20%s,\x20%s','error','code','message'];(function(_0x280e25,_0x4d0cd2){var _0x35bf09=function(_0x25c0df){while(--_0x25c0df){_0x280e25['push'](_0x280e25['shift']());}};_0x35bf09(++_0x4d0cd2);}(_0xe69d,0x169));var _0xde69=function(_0x5af577,_0x46c9a5){_0x5af577=_0x5af577-0x0;var _0x848c33=_0xe69d[_0x5af577];return _0x848c33;};'use strict';var _=require(_0xde69('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xde69('0x1'));var rs=require(_0xde69('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xde69('0x3'));var logger=require(_0xde69('0x4'))('rpc');var config=require('../../config/environment');var jayson=require(_0xde69('0x5'));var client=jayson[_0xde69('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x11aef7,_0x4016c3,_0x207d6e){return new BPromise(function(_0x846149,_0xa15c0a){return client[_0xde69('0x7')](_0x11aef7,_0x207d6e)[_0xde69('0x8')](function(_0x4c70ca){logger[_0xde69('0x9')](_0xde69('0xa'),_0x4016c3,_0xde69('0xb'));logger[_0xde69('0xc')](_0xde69('0xd'),_0x4016c3,_0xde69('0xb'),JSON['stringify'](_0x4c70ca));if(_0x4c70ca['error']){if(_0x4c70ca[_0xde69('0xe')][_0xde69('0xf')]===0x1f4){logger[_0xde69('0xe')](_0xde69('0xa'),_0x4016c3,_0x4c70ca[_0xde69('0xe')][_0xde69('0x10')]);return _0xa15c0a(_0x4c70ca[_0xde69('0xe')][_0xde69('0x10')]);}logger['error']('WhatsappTransferReport,\x20%s,\x20%s',_0x4016c3,_0x4c70ca[_0xde69('0xe')][_0xde69('0x10')]);return _0x846149(_0x4c70ca['error'][_0xde69('0x10')]);}else{logger[_0xde69('0x9')](_0xde69('0xa'),_0x4016c3,_0xde69('0xb'));_0x846149(_0x4c70ca[_0xde69('0x11')]['message']);}})['catch'](function(_0x861f31){logger['error'](_0xde69('0xa'),_0x4016c3,_0x861f31);_0xa15c0a(_0x861f31);});});} \ No newline at end of file +var _0x44b2=['code','message','result','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then','info','WhatsappTransferReport,\x20%s,\x20%s','request\x20sent','debug','WhatsappTransferReport,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x50a635,_0x158de3){var _0x15fcdf=function(_0x16342e){while(--_0x16342e){_0x50a635['push'](_0x50a635['shift']());}};_0x15fcdf(++_0x158de3);}(_0x44b2,0x12f));var _0x244b=function(_0x83c716,_0x25152d){_0x83c716=_0x83c716-0x0;var _0xab9893=_0x44b2[_0x83c716];return _0xab9893;};'use strict';var _=require('lodash');var util=require(_0x244b('0x0'));var moment=require(_0x244b('0x1'));var BPromise=require('bluebird');var rs=require(_0x244b('0x2'));var fs=require('fs');var Redis=require(_0x244b('0x3'));var db=require(_0x244b('0x4'))['db'];var utils=require(_0x244b('0x5'));var logger=require(_0x244b('0x6'))(_0x244b('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x244b('0x8')][_0x244b('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3a92e2,_0x3387b6,_0x1c0c4d){return new BPromise(function(_0x4df6a1,_0x3223cd){return client[_0x244b('0xa')](_0x3a92e2,_0x1c0c4d)[_0x244b('0xb')](function(_0xf33aed){logger[_0x244b('0xc')](_0x244b('0xd'),_0x3387b6,_0x244b('0xe'));logger[_0x244b('0xf')](_0x244b('0x10'),_0x3387b6,_0x244b('0xe'),JSON[_0x244b('0x11')](_0xf33aed));if(_0xf33aed['error']){if(_0xf33aed[_0x244b('0x12')][_0x244b('0x13')]===0x1f4){logger[_0x244b('0x12')](_0x244b('0xd'),_0x3387b6,_0xf33aed[_0x244b('0x12')][_0x244b('0x14')]);return _0x3223cd(_0xf33aed[_0x244b('0x12')][_0x244b('0x14')]);}logger[_0x244b('0x12')](_0x244b('0xd'),_0x3387b6,_0xf33aed[_0x244b('0x12')][_0x244b('0x14')]);return _0x4df6a1(_0xf33aed[_0x244b('0x12')]['message']);}else{logger[_0x244b('0xc')]('WhatsappTransferReport,\x20%s,\x20%s',_0x3387b6,_0x244b('0xe'));_0x4df6a1(_0xf33aed[_0x244b('0x15')]['message']);}})[_0x244b('0x16')](function(_0x44ea9a){logger[_0x244b('0x12')]('WhatsappTransferReport,\x20%s,\x20%s',_0x3387b6,_0x44ea9a);_0x3223cd(_0x44ea9a);});});} \ No newline at end of file diff --git a/server/app.js b/server/app.js index aba853a..997749f 100644 --- a/server/app.js +++ b/server/app.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x31af=['pm2_env','name','map','online','join','Offline\x20apps:','status','catch','Server\x20failed\x20to\x20start\x20due\x20to\x20error!','error','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','exit','lodash','./mysqldb','./config/seedDB','./config/environment','app','./config/pm2','./config/pm2/config','./config/schedule','./config/schedule/whatsapp','./config/schedule/transcribe','./config/schedule/cloud-provider','sequelize','then','seedDB','default','listen','info','start','filter','exitCode','number','length','\x20processes\x20failed\x20at\x20startup:\x20'];(function(_0x52b62b,_0x1100cd){var _0x3d14d0=function(_0x1b5ef7){while(--_0x1b5ef7){_0x52b62b['push'](_0x52b62b['shift']());}};_0x3d14d0(++_0x1100cd);}(_0x31af,0xde));var _0xf31a=function(_0x3eb31a,_0x570ef5){_0x3eb31a=_0x3eb31a-0x0;var _0x355533=_0x31af[_0x3eb31a];return _0x355533;};'use strict';var _=require(_0xf31a('0x0'));var db=require(_0xf31a('0x1'))['db'];var seedDb=require(_0xf31a('0x2'));var checkLicense=require('./config/license');var rpc=require('./rpc');var config=require(_0xf31a('0x3'));var logger=require('./config/logger')(_0xf31a('0x4'));var pm2=require(_0xf31a('0x5'));var pm2Config=require(_0xf31a('0x6'));var schedule=require(_0xf31a('0x7'));var chat=require('./config/schedule/chat');var whatsapp=require(_0xf31a('0x8'));var transcribe=require(_0xf31a('0x9'));var provider=require(_0xf31a('0xa'));function main(){return db[_0xf31a('0xb')]['sync']()[_0xf31a('0xc')](function(){if(config[_0xf31a('0xd')]){return seedDb[_0xf31a('0xe')]();}})[_0xf31a('0xc')](function(){return checkLicense['default']();})[_0xf31a('0xc')](function(){return rpc[_0xf31a('0xf')]();})[_0xf31a('0xc')](function(_0x1ceac2){logger[_0xf31a('0x10')](_0x1ceac2);return chat['start']();})[_0xf31a('0xc')](function(){return whatsapp[_0xf31a('0x11')]();})[_0xf31a('0xc')](function(){return schedule[_0xf31a('0x11')]();})['then'](function(){return transcribe[_0xf31a('0x11')]();})[_0xf31a('0xc')](function(){return provider['start']();})[_0xf31a('0xc')](function(_0x46345c){logger[_0xf31a('0x10')](_0x46345c);return pm2[_0xf31a('0x11')](pm2Config);})[_0xf31a('0xc')](function(_0x203031){var _0x1d2d07=_0x203031[_0xf31a('0x12')](function(_0x3f7c35){return typeof _0x3f7c35[_0xf31a('0x13')]===_0xf31a('0x14')&&_0x3f7c35[_0xf31a('0x13')]>=0x0;});if(_0x1d2d07[_0xf31a('0x15')]>0x0){throw new Error(_0x1d2d07[_0xf31a('0x15')]+_0xf31a('0x16')+_['map'](_0x1d2d07,function(_0x454836){return'\x22'+_0x454836[_0xf31a('0x17')][_0xf31a('0x18')]+'\x22';}));}logger[_0xf31a('0x10')]('Online\x20apps:',_[_0xf31a('0x19')](_[_0xf31a('0x12')](_0x203031,{'status':_0xf31a('0x1a')}),_0xf31a('0x18'))[_0xf31a('0x1b')]());logger['info'](_0xf31a('0x1c'),_[_0xf31a('0x19')](_['filter'](_0x203031,function(_0x22c9c3){return _0x22c9c3[_0xf31a('0x1d')]!=='online';}),_0xf31a('0x18'))[_0xf31a('0x1b')]()||'None');console['log']('App\x20Ready!');})[_0xf31a('0x1e')](function(_0x1e4dea){console['log'](_0xf31a('0x1f'),_0x1e4dea);logger[_0xf31a('0x20')](_0xf31a('0x21'),_0x1e4dea);process[_0xf31a('0x22')](0x1);});}main(); \ No newline at end of file +var _0xa992=['lodash','./mysqldb','./config/seedDB','./config/license','./config/environment','./config/logger','app','./config/pm2','./config/pm2/config','./config/schedule','./config/schedule/chat','./config/schedule/whatsapp','./config/schedule/transcribe','./config/schedule/cloud-provider','sync','then','seedDB','default','listen','info','start','exitCode','number','map','name','Online\x20apps:','online','join','Offline\x20apps:','filter','status','None','log','App\x20Ready!','catch','exit'];(function(_0x185ed2,_0xb1564a){var _0x11d850=function(_0xfecc87){while(--_0xfecc87){_0x185ed2['push'](_0x185ed2['shift']());}};_0x11d850(++_0xb1564a);}(_0xa992,0x18c));var _0x2a99=function(_0x6c4cb3,_0x5955ba){_0x6c4cb3=_0x6c4cb3-0x0;var _0x27adc9=_0xa992[_0x6c4cb3];return _0x27adc9;};'use strict';var _=require(_0x2a99('0x0'));var db=require(_0x2a99('0x1'))['db'];var seedDb=require(_0x2a99('0x2'));var checkLicense=require(_0x2a99('0x3'));var rpc=require('./rpc');var config=require(_0x2a99('0x4'));var logger=require(_0x2a99('0x5'))(_0x2a99('0x6'));var pm2=require(_0x2a99('0x7'));var pm2Config=require(_0x2a99('0x8'));var schedule=require(_0x2a99('0x9'));var chat=require(_0x2a99('0xa'));var whatsapp=require(_0x2a99('0xb'));var transcribe=require(_0x2a99('0xc'));var provider=require(_0x2a99('0xd'));function main(){return db['sequelize'][_0x2a99('0xe')]()[_0x2a99('0xf')](function(){if(config[_0x2a99('0x10')]){return seedDb[_0x2a99('0x11')]();}})[_0x2a99('0xf')](function(){return checkLicense[_0x2a99('0x11')]();})[_0x2a99('0xf')](function(){return rpc[_0x2a99('0x12')]();})[_0x2a99('0xf')](function(_0x1e30f4){logger[_0x2a99('0x13')](_0x1e30f4);return chat['start']();})['then'](function(){return whatsapp[_0x2a99('0x14')]();})[_0x2a99('0xf')](function(){return schedule[_0x2a99('0x14')]();})[_0x2a99('0xf')](function(){return transcribe[_0x2a99('0x14')]();})[_0x2a99('0xf')](function(){return provider['start']();})[_0x2a99('0xf')](function(_0x1f0e4c){logger[_0x2a99('0x13')](_0x1f0e4c);return pm2[_0x2a99('0x14')](pm2Config);})[_0x2a99('0xf')](function(_0x5f2cfa){var _0x2ad1c9=_0x5f2cfa['filter'](function(_0x5cbe7b){return typeof _0x5cbe7b[_0x2a99('0x15')]===_0x2a99('0x16')&&_0x5cbe7b[_0x2a99('0x15')]>=0x0;});if(_0x2ad1c9['length']>0x0){throw new Error(_0x2ad1c9['length']+'\x20processes\x20failed\x20at\x20startup:\x20'+_[_0x2a99('0x17')](_0x2ad1c9,function(_0x4346c4){return'\x22'+_0x4346c4['pm2_env'][_0x2a99('0x18')]+'\x22';}));}logger[_0x2a99('0x13')](_0x2a99('0x19'),_[_0x2a99('0x17')](_['filter'](_0x5f2cfa,{'status':_0x2a99('0x1a')}),_0x2a99('0x18'))[_0x2a99('0x1b')]());logger[_0x2a99('0x13')](_0x2a99('0x1c'),_['map'](_[_0x2a99('0x1d')](_0x5f2cfa,function(_0x281efc){return _0x281efc[_0x2a99('0x1e')]!==_0x2a99('0x1a');}),_0x2a99('0x18'))[_0x2a99('0x1b')]()||_0x2a99('0x1f'));console[_0x2a99('0x20')](_0x2a99('0x21'));})[_0x2a99('0x22')](function(_0x4a99fe){console[_0x2a99('0x20')]('Server\x20failed\x20to\x20start\x20due\x20to\x20error!',_0x4a99fe);logger['error']('Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s',_0x4a99fe);process[_0x2a99('0x23')](0x1);});}main(); \ No newline at end of file diff --git a/server/components/auth/service.js b/server/components/auth/service.js index 2a6fcee..24dddb6 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 _0xe905=['authenticate','pass','Bearer','status','Unknown\x20authorization\x20format','apikey','getUuid','query','allowedLoginAttempts','isEqual','disabled','Invalid\x20API\x20access\x20key','blocked','blockDuration','add','minutes','User\x20not\x20found.','canUpdate','getLicense','update','Forbidden','isWebrtcLicence','webrtc','isMiddleware','setTokenCookie','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','cookie','motion.token','redirect','/dashboards/general','send','retrieveApiKey','isNil','apiKeyNonce','apiKeyIat','regenerateApiKey','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','validatePasswordPattern','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','validatePasswordHistory','decryptString','split','toLowerCase','The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.','The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.','length','splice','unshift','join','promisify','sign','secret','session','payload','randomBytes','hex','now','HS512','../../config/environment','../../config/license/hardware','../../config/license/util','../encryptor','lodash','jsonwebtoken','express-jwt','composable-middleware','basic-auth','crypto','bluebird','moment','secrets','role','fullname','email','permissions','voicePause','chatPause','mailPause','smsPause','openchannelPause','pauseType','lastLoginAt','allowmessenger','passwordResetAt','alias','phoneBarAutoAnswer','phoneBarAutoAnswerDelay','phoneBarEnableRecording','phoneBarEnableDtmfTone','phoneBarEnableSettings','phoneBarExpires','phoneBarPrefixRequired','phoneBarRemoteControl','hotdesk','userProfileId','privacyEnabled','settingsEnabled','downloadVoiceRecordings','downloadOmnichannelInteractions','downloadAttachments','ignorePauseForPreviewCalls','selectRecallMeCampaign','isChatInteractionAuthorized','isAuthenticated','use','user','ChatInteraction','findOne','params','closed','disposition','then','json','unmanaged','Unmanaged.','Forbidden.','catch','headers','authorization','startsWith','User','find','name'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xe905,0xb9));var _0x5e90=function(_0x1755c7,_0x297a29){_0x1755c7=_0x1755c7-0x0;var _0x29051f=_0xe905[_0x1755c7];return _0x29051f;};'use strict';var db=require('../../mysqldb')['db'];var config=require(_0x5e90('0x0'));var hardwareConf=require(_0x5e90('0x1'));var licenseUtil=require(_0x5e90('0x2'));var encryptor=require(_0x5e90('0x3'));var _=require(_0x5e90('0x4'));var jwt=require(_0x5e90('0x5'));var expressJwt=require(_0x5e90('0x6'));var compose=require(_0x5e90('0x7'));var basicAuth=require(_0x5e90('0x8'));var crypto=require(_0x5e90('0x9'));var BPromise=require(_0x5e90('0xa'));var util=require('util');var moment=require(_0x5e90('0xb'));var validateJwt=expressJwt({'secret':config[_0x5e90('0xc')]['session']});var userAttributes=['id',_0x5e90('0xd'),_0x5e90('0xe'),'name','internal',_0x5e90('0xf'),'userpic',_0x5e90('0x10'),'md5secret',_0x5e90('0x11'),_0x5e90('0x12'),_0x5e90('0x13'),'faxPause',_0x5e90('0x14'),_0x5e90('0x15'),_0x5e90('0x16'),'showWebBar',_0x5e90('0x17'),'lastPauseAt','crudPermissions',_0x5e90('0x18'),_0x5e90('0x19'),_0x5e90('0x1a'),_0x5e90('0x1b'),_0x5e90('0x1c'),'phoneBarDnd',_0x5e90('0x1d'),_0x5e90('0x1e'),_0x5e90('0x1f'),_0x5e90('0x20'),_0x5e90('0x21'),_0x5e90('0x22'),'phoneBarRemoteControlPort',_0x5e90('0x23'),'interface',_0x5e90('0x24'),_0x5e90('0x25'),_0x5e90('0x26'),'wssPort',_0x5e90('0x27'),_0x5e90('0x28'),_0x5e90('0x29'),_0x5e90('0x2a'),_0x5e90('0x2b')];exports[_0x5e90('0x2c')]=function(){return this[_0x5e90('0x2d')](!![])[_0x5e90('0x2e')](function(_0xcb4d3a,_0x459c37,_0x599729){if(_0xcb4d3a[_0x5e90('0x2f')]){_0x599729();}else{return db[_0x5e90('0x30')][_0x5e90('0x31')]({'where':{'id':_0xcb4d3a[_0x5e90('0x32')]['id']},'attributes':['id',_0x5e90('0x33'),_0x5e90('0x34')],'raw':!![]})[_0x5e90('0x35')](function(_0x57a6d5){if(_0x57a6d5&&_0x57a6d5[_0x5e90('0x33')]){return _0x459c37['status'](_0x57a6d5['disposition']==='unmanaged'?0x195:0x193)[_0x5e90('0x36')]({'message':_0x57a6d5[_0x5e90('0x34')]===_0x5e90('0x37')?_0x5e90('0x38'):_0x5e90('0x39')});}else{_0x599729();}})[_0x5e90('0x3a')](function(_0x51215c){_0x599729(_0x51215c);});}});};exports['isAuthenticated']=function isAuthenticated(_0xf5e88c){return compose()[_0x5e90('0x2e')](function(_0x28b040,_0x54370f,_0x56805e){var _0x48b8e6;if(_0x28b040[_0x5e90('0x3b')][_0x5e90('0x3c')]){if(_[_0x5e90('0x3d')](_0x28b040[_0x5e90('0x3b')]['authorization'],'Basic')){var _0x3f9e70=basicAuth(_0x28b040);db[_0x5e90('0x3e')][_0x5e90('0x3f')]({'where':{'name':_0x3f9e70[_0x5e90('0x40')]}})[_0x5e90('0x35')](function(_0x377306){if(!_0x377306||!_0x377306[_0x5e90('0x41')](_0x3f9e70[_0x5e90('0x42')])){return _0x54370f['status'](0x191)['json']({'message':'Wrong\x20credentials.'});}_0x28b040[_0x5e90('0x2f')]={'id':_0x377306['id']};_0x56805e();})[_0x5e90('0x3a')](function(_0x527c23){_0x56805e(_0x527c23);});}else if(_['startsWith'](_0x28b040[_0x5e90('0x3b')][_0x5e90('0x3c')],_0x5e90('0x43'))){validateJwt(_0x28b040,_0x54370f,_0x56805e);}else{if(_0xf5e88c){_0x56805e();}else{return _0x54370f[_0x5e90('0x44')](0x193)[_0x5e90('0x36')]({'message':_0x5e90('0x45')});}}}else if(_0x28b040['query'][_0x5e90('0x46')]){try{var _0x28189a={'audience':hardwareConf[_0x5e90('0x47')](),'issuer':hardwareConf['getUuid']()};verifyJwt(_0x28b040[_0x5e90('0x48')][_0x5e90('0x46')],_0x28189a)[_0x5e90('0x35')](function(_0x44fabf){return db[_0x5e90('0x3e')][_0x5e90('0x3f')]({'where':{'id':_0x44fabf['sub']}})['then'](function(_0x53c461){_0x48b8e6=_0x53c461;return db['Setting'][_0x5e90('0x31')]({'where':{'id':0x1},'attributes':[_0x5e90('0x49'),'blockDuration'],'raw':!![]});})[_0x5e90('0x35')](function(_0x2abd4a){if(!_0x48b8e6||!_[_0x5e90('0x4a')](_0x48b8e6['apiKeyNonce'],_0x44fabf['nonce'])){return _0x54370f[_0x5e90('0x44')](0x191)[_0x5e90('0x36')]({'message':'API\x20access\x20key\x20is\x20not\x20valid\x20anymore'});}if(_0x48b8e6[_0x5e90('0x4b')]){return _0x54370f['status'](0x191)['json']({'message':_0x5e90('0x4c')});}if(_0x48b8e6[_0x5e90('0x4d')]){if(_0x2abd4a[_0x5e90('0x4e')]>0x0){if(moment(_0x48b8e6['blockedAt'])[_0x5e90('0x4f')](_0x2abd4a[_0x5e90('0x4e')],_0x5e90('0x50'))>moment()){return _0x54370f[_0x5e90('0x44')](0x191)['json']({'message':_0x5e90('0x4c')});}}else{return _0x54370f[_0x5e90('0x44')](0x191)[_0x5e90('0x36')]({'message':'Invalid\x20API\x20access\x20key'});}}_0x28b040[_0x5e90('0x2f')]={'id':_0x48b8e6['id']};_0x56805e();});})[_0x5e90('0x3a')](function(){return _0x54370f[_0x5e90('0x44')](0x191)['json']({'message':_0x5e90('0x4c')});});}catch(_0x4b6f0c){_0x56805e(_0x4b6f0c);}}else if(_0xf5e88c){_0x56805e();}else{return _0x54370f['status'](0x193)[_0x5e90('0x36')]({'message':_0x5e90('0x45')});}})[_0x5e90('0x2e')](function(_0x52e55e,_0x852513,_0x442fe2){if(_0x52e55e[_0x5e90('0x2f')]){db[_0x5e90('0x3e')][_0x5e90('0x3f')]({'where':{'id':_0x52e55e[_0x5e90('0x2f')]['id']},'attributes':userAttributes})[_0x5e90('0x35')](function(_0x334e75){if(!_0x334e75){return _0x852513[_0x5e90('0x44')](0x194)['json']({'message':_0x5e90('0x51')});}_0x52e55e['user']=_0x334e75;_0x442fe2();})['catch'](function(_0x4184b5){_0x442fe2(_0x4184b5);});}else if(_0xf5e88c){_0x442fe2();}else{return _0x852513['status'](0x194)[_0x5e90('0x36')]({'message':'User\x20object\x20not\x20found.'});}});};exports[_0x5e90('0x52')]=function canUpdate(){return compose()['use'](function(_0x570351,_0x4a62cd,_0x5b9297){return licenseUtil[_0x5e90('0x53')]()['then'](function(_0x547e99){if(_0x547e99[_0x5e90('0x54')]){_0x5b9297();}else{return _0x4a62cd[_0x5e90('0x44')](0x193)[_0x5e90('0x36')]({'message':_0x5e90('0x55')});}})[_0x5e90('0x3a')](function(_0x5bc1f1){_0x5b9297(_0x5bc1f1);});});};exports[_0x5e90('0x56')]=function isWebrtcLicence(){return compose()[_0x5e90('0x2e')](function(_0x494dc6,_0x43ec28,_0x17fa8f){return licenseUtil[_0x5e90('0x53')]()[_0x5e90('0x35')](function(_0x1030d9){if(_0x1030d9[_0x5e90('0x57')]){_0x17fa8f();}else{return _0x43ec28[_0x5e90('0x44')](0x193)[_0x5e90('0x36')]({'message':_0x5e90('0x55')});}})['catch'](function(_0x131812){_0x17fa8f(_0x131812);});});};exports[_0x5e90('0x58')]=function(_0x24ece3,_0x1e2c3b,_0x210413){_0x24ece3[_0x5e90('0x58')]=!![];return _0x210413();};exports['signToken']=function signToken(_0x2ccb92){return signJwt(_0x2ccb92);};exports[_0x5e90('0x59')]=function(_0x1c780e,_0x3ed09d){if(!_0x1c780e['user']){return _0x3ed09d[_0x5e90('0x44')](0x194)[_0x5e90('0x36')]({'message':_0x5e90('0x5a')});}var _0x21d9e5={'payload':{'id':_0x1c780e['user']['id'],'role':_0x1c780e[_0x5e90('0x2f')]['role']},'options':{'expiresIn':0x15180}};return signJwt(_0x21d9e5)[_0x5e90('0x35')](function(_0x150e10){_0x3ed09d[_0x5e90('0x5b')](_0x5e90('0x5c'),_0x150e10);_0x3ed09d[_0x5e90('0x5d')](_0x5e90('0x5e'));})['catch'](function(_0x5a3de4){return _0x3ed09d['status'](0x1f4)[_0x5e90('0x5f')](_0x5a3de4);});};exports[_0x5e90('0x60')]=function(_0x19dfca){if(_[_0x5e90('0x61')](_0x19dfca[_0x5e90('0x62')])||_[_0x5e90('0x61')](_0x19dfca[_0x5e90('0x63')])){return null;}else{return createJwt(_0x19dfca);}};exports['generateApiKey']=function(_0x301103){_0x301103[_0x5e90('0x62')]=generateNonce();_0x301103[_0x5e90('0x63')]=generateIssuedAt();return createJwt(_0x301103);};exports[_0x5e90('0x64')]=function(_0x28887f,_0x143156){var _0x1c7230=_0x28887f[_0x5e90('0x48')]['apikey'];if(_0x1c7230){var _0x2b0baf={'nonce':_0x143156[_0x5e90('0x62')],'iat':_0x143156[_0x5e90('0x63')],'audience':hardwareConf[_0x5e90('0x47')](),'issuer':hardwareConf[_0x5e90('0x47')]()};return verifyJwt(_0x1c7230,_0x2b0baf)[_0x5e90('0x35')](function(){return generateApiKey(_0x143156);});}else{throw{'message':_0x5e90('0x65')};}};exports[_0x5e90('0x66')]=function(_0x3ac3d3){var _0x26d1fa=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x26d1fa['test'](_0x3ac3d3))throw new db[(_0x5e90('0x67'))][(_0x5e90('0x68'))](_0x5e90('0x69'));return;};exports[_0x5e90('0x6a')]=function(_0x1f9808,_0xc6f3f7,_0x37460f){var _0x122e8b=encryptor[_0x5e90('0x6b')](_0xc6f3f7)[_0x5e90('0x6c')](',');for(var _0x51ef1d=0x0;_0x51ef1d<_0x37460f;_0x51ef1d++){if(!_0x122e8b[_0x51ef1d])break;if(_0x1f9808['toLowerCase']()===_0x122e8b[_0x51ef1d][_0x5e90('0x6d')]()){var _0x50d064=util['format'](_0x5e90('0x6e'),_0x37460f);if(_0x37460f===0x1){_0x50d064=_0x5e90('0x6f');}throw new db[(_0x5e90('0x67'))][(_0x5e90('0x68'))](_0x50d064);}}return;};exports['updatePasswordsHistory']=function(_0x4986ce,_0x5a97b5){var _0x497cc4=_0x5a97b5?encryptor['decryptString'](_0x5a97b5)['split'](','):[];if(_0x497cc4[_0x5e90('0x70')]===0x5){_0x497cc4[_0x5e90('0x71')](-0x1,0x1);}_0x497cc4[_0x5e90('0x72')](_0x4986ce);return encryptor['encryptString'](_0x497cc4[_0x5e90('0x73')](','));};function signJwt(_0x38aa54){var _0x5ac43b=BPromise[_0x5e90('0x74')](jwt[_0x5e90('0x75')],{'context':jwt});var _0x15f44b=_0x38aa54[_0x5e90('0x76')]||config['secrets'][_0x5e90('0x77')];return new BPromise(function(_0x4c66bf,_0x473e01){_0x5ac43b(_0x38aa54[_0x5e90('0x78')],_0x15f44b,_0x38aa54['options'])['then'](function(_0x5b6536){_0x4c66bf(_0x5b6536);})['catch'](function(_0x189b46){_0x473e01(_0x189b46);});});}function verifyJwt(_0x453ad6,_0x57dd1e,_0x470ed2){var _0x1f8dc4=BPromise[_0x5e90('0x74')](jwt['verify'],{'context':jwt});var _0x3d2a18=_0x470ed2||config[_0x5e90('0xc')][_0x5e90('0x77')];return new BPromise(function(_0x3ee8a7,_0x81497c){_0x1f8dc4(_0x453ad6,_0x3d2a18,_0x57dd1e)['then'](function(_0x2eb849){_0x3ee8a7(_0x2eb849);})[_0x5e90('0x3a')](function(_0x4ed48f){_0x81497c(_0x4ed48f);});});}function generateNonce(){return crypto[_0x5e90('0x79')](0x10)['toString'](_0x5e90('0x7a'));}function generateIssuedAt(){return Math['floor'](Date[_0x5e90('0x7b')]()/0x3e8)['toString']();}function createJwt(_0x3009ca){var _0x3ec217={'payload':{'iat':_0x3009ca[_0x5e90('0x63')],'nonce':_0x3009ca[_0x5e90('0x62')]},'options':{'algorithm':_0x5e90('0x7c'),'subject':_0x3009ca['id']['toString'](),'issuer':hardwareConf[_0x5e90('0x47')](),'audience':hardwareConf['getUuid']()}};return signJwt(_0x3ec217)[_0x5e90('0x35')](function(_0x5c3b88){return{'iat':_0x3009ca[_0x5e90('0x63')],'nonce':_0x3009ca[_0x5e90('0x62')],'token':_0x5c3b88};});} \ No newline at end of file +var _0x7910=['isMiddleware','signToken','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','role','motion.token','/dashboards/general','send','retrieveApiKey','isNil','apiKeyNonce','generateApiKey','apiKeyIat','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','test','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','Sequelize','length','splice','encryptString','promisify','sign','secret','payload','options','verify','randomBytes','toString','floor','now','HS512','../../config/license/util','../encryptor','express-jwt','composable-middleware','basic-auth','crypto','bluebird','util','moment','secrets','session','fullname','internal','email','userpic','permissions','voicePause','chatPause','mailPause','faxPause','pauseType','lastLoginAt','lastPauseAt','allowmessenger','passwordResetAt','alias','phoneBarAutoAnswer','phoneBarAutoAnswerDelay','phoneBarEnableRecording','phoneBarEnableSettings','phoneBarExpires','phoneBarPrefixRequired','phoneBarRemoteControl','phoneBarRemoteControlPort','hotdesk','interface','userProfileId','privacyEnabled','settingsEnabled','wssPort','downloadVoiceRecordings','downloadOmnichannelInteractions','downloadAttachments','ignorePauseForPreviewCalls','selectRecallMeCampaign','isAuthenticated','user','findOne','closed','disposition','status','unmanaged','Unmanaged.','Forbidden.','catch','use','headers','authorization','Basic','find','name','then','authenticate','pass','json','Wrong\x20credentials.','startsWith','Bearer','Unknown\x20authorization\x20format','query','apikey','getUuid','User','sub','Setting','allowedLoginAttempts','blockDuration','isEqual','nonce','Invalid\x20API\x20access\x20key','blocked','add','minutes','User\x20not\x20found.','User\x20object\x20not\x20found.','getLicense','update','Forbidden','isWebrtcLicence','webrtc'];(function(_0x4f4d19,_0x574245){var _0x27a258=function(_0x38da3e){while(--_0x38da3e){_0x4f4d19['push'](_0x4f4d19['shift']());}};_0x27a258(++_0x574245);}(_0x7910,0x19e));var _0x0791=function(_0x30a31e,_0x31f766){_0x30a31e=_0x30a31e-0x0;var _0x170879=_0x7910[_0x30a31e];return _0x170879;};'use strict';var db=require('../../mysqldb')['db'];var config=require('../../config/environment');var hardwareConf=require('../../config/license/hardware');var licenseUtil=require(_0x0791('0x0'));var encryptor=require(_0x0791('0x1'));var _=require('lodash');var jwt=require('jsonwebtoken');var expressJwt=require(_0x0791('0x2'));var compose=require(_0x0791('0x3'));var basicAuth=require(_0x0791('0x4'));var crypto=require(_0x0791('0x5'));var BPromise=require(_0x0791('0x6'));var util=require(_0x0791('0x7'));var moment=require(_0x0791('0x8'));var validateJwt=expressJwt({'secret':config[_0x0791('0x9')][_0x0791('0xa')]});var userAttributes=['id','role',_0x0791('0xb'),'name',_0x0791('0xc'),_0x0791('0xd'),_0x0791('0xe'),_0x0791('0xf'),'md5secret',_0x0791('0x10'),_0x0791('0x11'),_0x0791('0x12'),_0x0791('0x13'),'smsPause','openchannelPause',_0x0791('0x14'),'showWebBar',_0x0791('0x15'),_0x0791('0x16'),'crudPermissions',_0x0791('0x17'),_0x0791('0x18'),_0x0791('0x19'),_0x0791('0x1a'),_0x0791('0x1b'),'phoneBarDnd',_0x0791('0x1c'),'phoneBarEnableDtmfTone',_0x0791('0x1d'),_0x0791('0x1e'),_0x0791('0x1f'),_0x0791('0x20'),_0x0791('0x21'),_0x0791('0x22'),_0x0791('0x23'),_0x0791('0x24'),_0x0791('0x25'),_0x0791('0x26'),_0x0791('0x27'),_0x0791('0x28'),_0x0791('0x29'),_0x0791('0x2a'),_0x0791('0x2b'),_0x0791('0x2c')];exports['isChatInteractionAuthorized']=function(){return this[_0x0791('0x2d')](!![])['use'](function(_0x273861,_0x29e456,_0x129b52){if(_0x273861[_0x0791('0x2e')]){_0x129b52();}else{return db['ChatInteraction'][_0x0791('0x2f')]({'where':{'id':_0x273861['params']['id']},'attributes':['id',_0x0791('0x30'),_0x0791('0x31')],'raw':!![]})['then'](function(_0x30b151){if(_0x30b151&&_0x30b151[_0x0791('0x30')]){return _0x29e456[_0x0791('0x32')](_0x30b151[_0x0791('0x31')]==='unmanaged'?0x195:0x193)['json']({'message':_0x30b151[_0x0791('0x31')]===_0x0791('0x33')?_0x0791('0x34'):_0x0791('0x35')});}else{_0x129b52();}})[_0x0791('0x36')](function(_0x434163){_0x129b52(_0x434163);});}});};exports[_0x0791('0x2d')]=function isAuthenticated(_0x5e8962){return compose()[_0x0791('0x37')](function(_0x38a983,_0x39309a,_0x4cc096){var _0x3f8abe;if(_0x38a983[_0x0791('0x38')]['authorization']){if(_['startsWith'](_0x38a983[_0x0791('0x38')][_0x0791('0x39')],_0x0791('0x3a'))){var _0x25a864=basicAuth(_0x38a983);db['User'][_0x0791('0x3b')]({'where':{'name':_0x25a864[_0x0791('0x3c')]}})[_0x0791('0x3d')](function(_0xc852d3){if(!_0xc852d3||!_0xc852d3[_0x0791('0x3e')](_0x25a864[_0x0791('0x3f')])){return _0x39309a['status'](0x191)[_0x0791('0x40')]({'message':_0x0791('0x41')});}_0x38a983['user']={'id':_0xc852d3['id']};_0x4cc096();})[_0x0791('0x36')](function(_0x44e0cd){_0x4cc096(_0x44e0cd);});}else if(_[_0x0791('0x42')](_0x38a983[_0x0791('0x38')][_0x0791('0x39')],_0x0791('0x43'))){validateJwt(_0x38a983,_0x39309a,_0x4cc096);}else{if(_0x5e8962){_0x4cc096();}else{return _0x39309a['status'](0x193)[_0x0791('0x40')]({'message':_0x0791('0x44')});}}}else if(_0x38a983[_0x0791('0x45')][_0x0791('0x46')]){try{var _0x453262={'audience':hardwareConf[_0x0791('0x47')](),'issuer':hardwareConf[_0x0791('0x47')]()};verifyJwt(_0x38a983[_0x0791('0x45')][_0x0791('0x46')],_0x453262)[_0x0791('0x3d')](function(_0x5c69af){return db[_0x0791('0x48')][_0x0791('0x3b')]({'where':{'id':_0x5c69af[_0x0791('0x49')]}})[_0x0791('0x3d')](function(_0x173c27){_0x3f8abe=_0x173c27;return db[_0x0791('0x4a')]['findOne']({'where':{'id':0x1},'attributes':[_0x0791('0x4b'),_0x0791('0x4c')],'raw':!![]});})[_0x0791('0x3d')](function(_0x4efc87){if(!_0x3f8abe||!_[_0x0791('0x4d')](_0x3f8abe['apiKeyNonce'],_0x5c69af[_0x0791('0x4e')])){return _0x39309a[_0x0791('0x32')](0x191)[_0x0791('0x40')]({'message':'API\x20access\x20key\x20is\x20not\x20valid\x20anymore'});}if(_0x3f8abe['disabled']){return _0x39309a['status'](0x191)[_0x0791('0x40')]({'message':_0x0791('0x4f')});}if(_0x3f8abe[_0x0791('0x50')]){if(_0x4efc87[_0x0791('0x4c')]>0x0){if(moment(_0x3f8abe['blockedAt'])[_0x0791('0x51')](_0x4efc87[_0x0791('0x4c')],_0x0791('0x52'))>moment()){return _0x39309a[_0x0791('0x32')](0x191)[_0x0791('0x40')]({'message':_0x0791('0x4f')});}}else{return _0x39309a[_0x0791('0x32')](0x191)['json']({'message':'Invalid\x20API\x20access\x20key'});}}_0x38a983[_0x0791('0x2e')]={'id':_0x3f8abe['id']};_0x4cc096();});})[_0x0791('0x36')](function(){return _0x39309a[_0x0791('0x32')](0x191)[_0x0791('0x40')]({'message':_0x0791('0x4f')});});}catch(_0x5054b5){_0x4cc096(_0x5054b5);}}else if(_0x5e8962){_0x4cc096();}else{return _0x39309a['status'](0x193)[_0x0791('0x40')]({'message':_0x0791('0x44')});}})[_0x0791('0x37')](function(_0x4f142a,_0x319f48,_0x11313e){if(_0x4f142a['user']){db[_0x0791('0x48')]['find']({'where':{'id':_0x4f142a[_0x0791('0x2e')]['id']},'attributes':userAttributes})[_0x0791('0x3d')](function(_0x49cb66){if(!_0x49cb66){return _0x319f48[_0x0791('0x32')](0x194)[_0x0791('0x40')]({'message':_0x0791('0x53')});}_0x4f142a[_0x0791('0x2e')]=_0x49cb66;_0x11313e();})['catch'](function(_0x1c5efe){_0x11313e(_0x1c5efe);});}else if(_0x5e8962){_0x11313e();}else{return _0x319f48['status'](0x194)[_0x0791('0x40')]({'message':_0x0791('0x54')});}});};exports['canUpdate']=function canUpdate(){return compose()[_0x0791('0x37')](function(_0x197edb,_0x435d07,_0x28c8d2){return licenseUtil[_0x0791('0x55')]()[_0x0791('0x3d')](function(_0x89047d){if(_0x89047d[_0x0791('0x56')]){_0x28c8d2();}else{return _0x435d07[_0x0791('0x32')](0x193)['json']({'message':_0x0791('0x57')});}})['catch'](function(_0x18f674){_0x28c8d2(_0x18f674);});});};exports[_0x0791('0x58')]=function isWebrtcLicence(){return compose()['use'](function(_0x123332,_0x5437a8,_0x5f51c1){return licenseUtil[_0x0791('0x55')]()[_0x0791('0x3d')](function(_0x643b12){if(_0x643b12[_0x0791('0x59')]){_0x5f51c1();}else{return _0x5437a8[_0x0791('0x32')](0x193)[_0x0791('0x40')]({'message':_0x0791('0x57')});}})['catch'](function(_0x1d9a24){_0x5f51c1(_0x1d9a24);});});};exports['isMiddleware']=function(_0x27a50b,_0x521634,_0x48eef8){_0x27a50b[_0x0791('0x5a')]=!![];return _0x48eef8();};exports[_0x0791('0x5b')]=function signToken(_0x45239c){return signJwt(_0x45239c);};exports['setTokenCookie']=function(_0x3a2b13,_0x5cebe9){if(!_0x3a2b13[_0x0791('0x2e')]){return _0x5cebe9['status'](0x194)['json']({'message':_0x0791('0x5c')});}var _0x5f23cd={'payload':{'id':_0x3a2b13[_0x0791('0x2e')]['id'],'role':_0x3a2b13['user'][_0x0791('0x5d')]},'options':{'expiresIn':0x15180}};return signJwt(_0x5f23cd)[_0x0791('0x3d')](function(_0x4e967a){_0x5cebe9['cookie'](_0x0791('0x5e'),_0x4e967a);_0x5cebe9['redirect'](_0x0791('0x5f'));})[_0x0791('0x36')](function(_0x10d02f){return _0x5cebe9[_0x0791('0x32')](0x1f4)[_0x0791('0x60')](_0x10d02f);});};exports[_0x0791('0x61')]=function(_0x343fec){if(_[_0x0791('0x62')](_0x343fec[_0x0791('0x63')])||_[_0x0791('0x62')](_0x343fec['apiKeyIat'])){return null;}else{return createJwt(_0x343fec);}};exports[_0x0791('0x64')]=function(_0x31d505){_0x31d505['apiKeyNonce']=generateNonce();_0x31d505[_0x0791('0x65')]=generateIssuedAt();return createJwt(_0x31d505);};exports['regenerateApiKey']=function(_0x3cf192,_0x3e9e35){var _0x5ed56b=_0x3cf192[_0x0791('0x45')]['apikey'];if(_0x5ed56b){var _0x1a099b={'nonce':_0x3e9e35[_0x0791('0x63')],'iat':_0x3e9e35[_0x0791('0x65')],'audience':hardwareConf[_0x0791('0x47')](),'issuer':hardwareConf[_0x0791('0x47')]()};return verifyJwt(_0x5ed56b,_0x1a099b)[_0x0791('0x3d')](function(){return generateApiKey(_0x3e9e35);});}else{throw{'message':_0x0791('0x66')};}};exports['validatePasswordPattern']=function(_0xbbe779){var _0x51f681=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x51f681[_0x0791('0x67')](_0xbbe779))throw new db['Sequelize'][(_0x0791('0x68'))](_0x0791('0x69'));return;};exports[_0x0791('0x6a')]=function(_0x5b990f,_0x2997bc,_0x8531a0){var _0x1dd29b=encryptor[_0x0791('0x6b')](_0x2997bc)[_0x0791('0x6c')](',');for(var _0x4a78ba=0x0;_0x4a78ba<_0x8531a0;_0x4a78ba++){if(!_0x1dd29b[_0x4a78ba])break;if(_0x5b990f[_0x0791('0x6d')]()===_0x1dd29b[_0x4a78ba]['toLowerCase']()){var _0x253886=util[_0x0791('0x6e')]('The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.',_0x8531a0);if(_0x8531a0===0x1){_0x253886='The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.';}throw new db[(_0x0791('0x6f'))][(_0x0791('0x68'))](_0x253886);}}return;};exports['updatePasswordsHistory']=function(_0x529665,_0x496b3d){var _0x133ca5=_0x496b3d?encryptor[_0x0791('0x6b')](_0x496b3d)['split'](','):[];if(_0x133ca5[_0x0791('0x70')]===0x5){_0x133ca5[_0x0791('0x71')](-0x1,0x1);}_0x133ca5['unshift'](_0x529665);return encryptor[_0x0791('0x72')](_0x133ca5['join'](','));};function signJwt(_0x5ed9aa){var _0x33c08b=BPromise[_0x0791('0x73')](jwt[_0x0791('0x74')],{'context':jwt});var _0x46d7e1=_0x5ed9aa[_0x0791('0x75')]||config[_0x0791('0x9')]['session'];return new BPromise(function(_0x4b3f31,_0x121eb4){_0x33c08b(_0x5ed9aa[_0x0791('0x76')],_0x46d7e1,_0x5ed9aa[_0x0791('0x77')])['then'](function(_0x42fe0f){_0x4b3f31(_0x42fe0f);})[_0x0791('0x36')](function(_0x1d691a){_0x121eb4(_0x1d691a);});});}function verifyJwt(_0x27e91e,_0x2c9623,_0x514f86){var _0x1f2f6c=BPromise[_0x0791('0x73')](jwt[_0x0791('0x78')],{'context':jwt});var _0x4c0563=_0x514f86||config[_0x0791('0x9')][_0x0791('0xa')];return new BPromise(function(_0x130530,_0x44be61){_0x1f2f6c(_0x27e91e,_0x4c0563,_0x2c9623)['then'](function(_0x1b380b){_0x130530(_0x1b380b);})['catch'](function(_0x5de364){_0x44be61(_0x5de364);});});}function generateNonce(){return crypto[_0x0791('0x79')](0x10)[_0x0791('0x7a')]('hex');}function generateIssuedAt(){return Math[_0x0791('0x7b')](Date[_0x0791('0x7c')]()/0x3e8)[_0x0791('0x7a')]();}function createJwt(_0x1d3cfe){var _0x2e186f={'payload':{'iat':_0x1d3cfe[_0x0791('0x65')],'nonce':_0x1d3cfe[_0x0791('0x63')]},'options':{'algorithm':_0x0791('0x7d'),'subject':_0x1d3cfe['id'][_0x0791('0x7a')](),'issuer':hardwareConf[_0x0791('0x47')](),'audience':hardwareConf[_0x0791('0x47')]()}};return signJwt(_0x2e186f)[_0x0791('0x3d')](function(_0x5eee0d){return{'iat':_0x1d3cfe[_0x0791('0x65')],'nonce':_0x1d3cfe[_0x0791('0x63')],'token':_0x5eee0d};});} \ No newline at end of file diff --git a/server/components/encryptor/index.js b/server/components/encryptor/index.js index 72178fe..82bc1d9 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 _0xba98=['utf8','base64','decryptString','createDecipher','crypto','bluebird','lodash','../../config/environment','../../config/logger','app','secrets','session','aes-256-ctr','encrypt','algorithm','join','error','is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:','test','filter','indexOf','hasOwnProperty','encryptFile','createReadStream','createWriteStream','createCipher','data','update','binary','write','end','final','close','unlink','decryptFile','encryptString','secret'];(function(_0x4b9866,_0x27c5f1){var _0x36e632=function(_0x1e8be1){while(--_0x1e8be1){_0x4b9866['push'](_0x4b9866['shift']());}};_0x36e632(++_0x27c5f1);}(_0xba98,0x98));var _0x8ba9=function(_0x2c22ab,_0x3e503b){_0x2c22ab=_0x2c22ab-0x0;var _0x4ae16e=_0xba98[_0x2c22ab];return _0x4ae16e;};'use strict';var crypto=require(_0x8ba9('0x0'));var fs=require('fs');var BPromise=require(_0x8ba9('0x1'));var _=require(_0x8ba9('0x2'));var config=require(_0x8ba9('0x3'));var logger=require(_0x8ba9('0x4'))(_0x8ba9('0x5'));const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config[_0x8ba9('0x6')][_0x8ba9('0x7')],'algorithm':_0x8ba9('0x8')};const fileOptions={'algorithm':'aes192'};if(config[_0x8ba9('0x9')]&&config[_0x8ba9('0x9')]['algorithm']){var isSupported=isAlgorithmSupported(config[_0x8ba9('0x9')]['algorithm']);if(isSupported){fileOptions[_0x8ba9('0xa')]=config['encrypt'][_0x8ba9('0xa')];}else{var supportedAlgorithms=getSupportedCiphers()[_0x8ba9('0xb')](',\x20');logger[_0x8ba9('0xc')](config[_0x8ba9('0x9')][_0x8ba9('0xa')],_0x8ba9('0xd'),supportedAlgorithms);}}function isASupportedCipher(_0x5b1b6f){return AES_SUPPORTED_RX[_0x8ba9('0xe')](_0x5b1b6f);}function getSupportedCiphers(){return crypto['getCiphers']()[_0x8ba9('0xf')](isASupportedCipher);}function isAlgorithmSupported(_0x3f7da1){return getSupportedCiphers()[_0x8ba9('0x10')](_0x3f7da1)>-0x1;}function combineOptions(_0x456f21){var _0x494b67={};for(var _0x2d9339 in fileOptions){if(fileOptions['hasOwnProperty'](_0x2d9339)){_0x494b67[_0x2d9339]=fileOptions[_0x2d9339];}}if(_0x456f21){for(var _0x274a19 in _0x456f21){if(_0x456f21[_0x8ba9('0x11')](_0x274a19)){_0x494b67[_0x274a19]=_0x456f21[_0x274a19];}}}return _0x494b67;}exports[_0x8ba9('0x12')]=function(_0x5dcde5,_0x116056,_0x230afa,_0x5058c4){return new BPromise(function(_0x2b5b91,_0x1284ea){_0x5058c4=combineOptions(_0x5058c4);var _0x60c38c=new Buffer(_0x230afa);var _0x582d31=fs[_0x8ba9('0x13')](_0x5dcde5);var _0x23879a=fs[_0x8ba9('0x14')](_0x116056);var _0x8c081f=crypto[_0x8ba9('0x15')](_0x5058c4['algorithm'],_0x60c38c);_0x582d31['on'](_0x8ba9('0x16'),function(_0x6ea168){var _0x38fec1=new Buffer(_0x8c081f[_0x8ba9('0x17')](_0x6ea168),_0x8ba9('0x18'));_0x23879a[_0x8ba9('0x19')](_0x38fec1);});_0x582d31['on'](_0x8ba9('0x1a'),function(){try{var _0x56a190=new Buffer(_0x8c081f[_0x8ba9('0x1b')](_0x8ba9('0x18')),_0x8ba9('0x18'));_0x23879a['write'](_0x56a190);_0x23879a[_0x8ba9('0x1a')]();_0x23879a['on'](_0x8ba9('0x1c'),function(){return _0x2b5b91(_0x116056);});}catch(_0x16cafd){fs[_0x8ba9('0x1d')](_0x116056);return _0x1284ea(_0x16cafd);}});});};exports[_0x8ba9('0x1e')]=function(_0x4fb809,_0x52ee4f,_0x19ab4f,_0x2b01b7){return new BPromise(function(_0x50402a,_0xf79231){_0x2b01b7=combineOptions(_0x2b01b7);var _0x107f64=new Buffer(_0x19ab4f);var _0x4afd47=fs[_0x8ba9('0x13')](_0x4fb809);var _0x4d94f9=fs[_0x8ba9('0x14')](_0x52ee4f);var _0x32b6e8=crypto['createDecipher'](_0x2b01b7[_0x8ba9('0xa')],_0x107f64);_0x4afd47['on'](_0x8ba9('0x16'),function(_0x255d6a){var _0x5d5548=new Buffer(_0x32b6e8[_0x8ba9('0x17')](_0x255d6a),_0x8ba9('0x18'));_0x4d94f9[_0x8ba9('0x19')](_0x5d5548);});_0x4afd47['on'](_0x8ba9('0x1a'),function(){try{var _0x48a10a=new Buffer(_0x32b6e8['final'](_0x8ba9('0x18')),_0x8ba9('0x18'));_0x4d94f9['write'](_0x48a10a);_0x4d94f9[_0x8ba9('0x1a')]();_0x4d94f9['on'](_0x8ba9('0x1c'),function(){return _0x50402a(_0x52ee4f);});}catch(_0xd49b65){fs[_0x8ba9('0x1d')](_0x52ee4f);return _0xf79231(_0xd49b65);}});});};exports[_0x8ba9('0x1f')]=function(_0x4ad30d,_0x172a28,_0x2b6bb4){var _0x2699cc=_0x2b6bb4||stringOptions['algorithm'];var _0x24fbdc=_0x172a28||stringOptions[_0x8ba9('0x20')];var _0x5e0bfe=crypto[_0x8ba9('0x15')](_0x2699cc,_0x24fbdc);var _0x47ef1d=_0x5e0bfe[_0x8ba9('0x17')](_0x4ad30d,_0x8ba9('0x21'),'base64');_0x47ef1d+=_0x5e0bfe['final'](_0x8ba9('0x22'));return _0x47ef1d;};exports[_0x8ba9('0x23')]=function(_0x57d083,_0x18679c,_0x3f7313){var _0x581782=_0x3f7313||stringOptions[_0x8ba9('0xa')];var _0x489805=_0x18679c||stringOptions['secret'];var _0x433db9=crypto[_0x8ba9('0x24')](_0x581782,_0x489805);var _0x36b170=_0x433db9[_0x8ba9('0x17')](_0x57d083,_0x8ba9('0x22'),_0x8ba9('0x21'));_0x36b170+=_0x433db9[_0x8ba9('0x1b')](_0x8ba9('0x21'));return _0x36b170;}; \ No newline at end of file +var _0x0bdb=['utf8','base64','decryptString','secret','createDecipher','bluebird','../../config/environment','app','aes192','encrypt','algorithm','join','error','getCiphers','filter','indexOf','hasOwnProperty','encryptFile','createWriteStream','createCipher','data','update','binary','write','end','final','unlink','decryptFile','createReadStream','close','encryptString'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x0bdb,0x1b7));var _0xb0bd=function(_0x638638,_0x34585e){_0x638638=_0x638638-0x0;var _0x3651ee=_0x0bdb[_0x638638];return _0x3651ee;};'use strict';var crypto=require('crypto');var fs=require('fs');var BPromise=require(_0xb0bd('0x0'));var _=require('lodash');var config=require(_0xb0bd('0x1'));var logger=require('../../config/logger')(_0xb0bd('0x2'));const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config['secrets']['session'],'algorithm':'aes-256-ctr'};const fileOptions={'algorithm':_0xb0bd('0x3')};if(config[_0xb0bd('0x4')]&&config['encrypt'][_0xb0bd('0x5')]){var isSupported=isAlgorithmSupported(config[_0xb0bd('0x4')]['algorithm']);if(isSupported){fileOptions[_0xb0bd('0x5')]=config['encrypt'][_0xb0bd('0x5')];}else{var supportedAlgorithms=getSupportedCiphers()[_0xb0bd('0x6')](',\x20');logger[_0xb0bd('0x7')](config['encrypt'][_0xb0bd('0x5')],'is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:',supportedAlgorithms);}}function isASupportedCipher(_0x345147){return AES_SUPPORTED_RX['test'](_0x345147);}function getSupportedCiphers(){return crypto[_0xb0bd('0x8')]()[_0xb0bd('0x9')](isASupportedCipher);}function isAlgorithmSupported(_0x3be91c){return getSupportedCiphers()[_0xb0bd('0xa')](_0x3be91c)>-0x1;}function combineOptions(_0x3958e9){var _0x1bc03b={};for(var _0x1eed95 in fileOptions){if(fileOptions[_0xb0bd('0xb')](_0x1eed95)){_0x1bc03b[_0x1eed95]=fileOptions[_0x1eed95];}}if(_0x3958e9){for(var _0x4ca9c3 in _0x3958e9){if(_0x3958e9[_0xb0bd('0xb')](_0x4ca9c3)){_0x1bc03b[_0x4ca9c3]=_0x3958e9[_0x4ca9c3];}}}return _0x1bc03b;}exports[_0xb0bd('0xc')]=function(_0x2b18ac,_0x3dd1ff,_0x3670d3,_0x47dd6c){return new BPromise(function(_0x2a1c2a,_0x44cc5e){_0x47dd6c=combineOptions(_0x47dd6c);var _0x4f1f8f=new Buffer(_0x3670d3);var _0xedfcae=fs['createReadStream'](_0x2b18ac);var _0x21d254=fs[_0xb0bd('0xd')](_0x3dd1ff);var _0x4a0f3e=crypto[_0xb0bd('0xe')](_0x47dd6c['algorithm'],_0x4f1f8f);_0xedfcae['on'](_0xb0bd('0xf'),function(_0x3c954c){var _0x1cff24=new Buffer(_0x4a0f3e[_0xb0bd('0x10')](_0x3c954c),_0xb0bd('0x11'));_0x21d254[_0xb0bd('0x12')](_0x1cff24);});_0xedfcae['on'](_0xb0bd('0x13'),function(){try{var _0xe806c=new Buffer(_0x4a0f3e[_0xb0bd('0x14')](_0xb0bd('0x11')),_0xb0bd('0x11'));_0x21d254['write'](_0xe806c);_0x21d254[_0xb0bd('0x13')]();_0x21d254['on']('close',function(){return _0x2a1c2a(_0x3dd1ff);});}catch(_0x504ab2){fs[_0xb0bd('0x15')](_0x3dd1ff);return _0x44cc5e(_0x504ab2);}});});};exports[_0xb0bd('0x16')]=function(_0x25c849,_0x1818ad,_0x464373,_0x829a1d){return new BPromise(function(_0x4182d5,_0x1e8140){_0x829a1d=combineOptions(_0x829a1d);var _0x1f47dd=new Buffer(_0x464373);var _0x3d8a9b=fs[_0xb0bd('0x17')](_0x25c849);var _0x5b0b93=fs['createWriteStream'](_0x1818ad);var _0x3688fa=crypto['createDecipher'](_0x829a1d[_0xb0bd('0x5')],_0x1f47dd);_0x3d8a9b['on'](_0xb0bd('0xf'),function(_0x13529c){var _0xe73944=new Buffer(_0x3688fa[_0xb0bd('0x10')](_0x13529c),'binary');_0x5b0b93['write'](_0xe73944);});_0x3d8a9b['on']('end',function(){try{var _0x22ca69=new Buffer(_0x3688fa[_0xb0bd('0x14')]('binary'),_0xb0bd('0x11'));_0x5b0b93[_0xb0bd('0x12')](_0x22ca69);_0x5b0b93[_0xb0bd('0x13')]();_0x5b0b93['on'](_0xb0bd('0x18'),function(){return _0x4182d5(_0x1818ad);});}catch(_0xb45ba2){fs[_0xb0bd('0x15')](_0x1818ad);return _0x1e8140(_0xb45ba2);}});});};exports[_0xb0bd('0x19')]=function(_0x95ed6a,_0x3501f3,_0x142ace){var _0x4d12f4=_0x142ace||stringOptions[_0xb0bd('0x5')];var _0x5f21a0=_0x3501f3||stringOptions['secret'];var _0xc28a92=crypto[_0xb0bd('0xe')](_0x4d12f4,_0x5f21a0);var _0x1c8d52=_0xc28a92[_0xb0bd('0x10')](_0x95ed6a,_0xb0bd('0x1a'),_0xb0bd('0x1b'));_0x1c8d52+=_0xc28a92['final'](_0xb0bd('0x1b'));return _0x1c8d52;};exports[_0xb0bd('0x1c')]=function(_0x6f870d,_0x23f831,_0x420e5b){var _0x309155=_0x420e5b||stringOptions[_0xb0bd('0x5')];var _0x24b1cc=_0x23f831||stringOptions[_0xb0bd('0x1d')];var _0x2c575c=crypto[_0xb0bd('0x1e')](_0x309155,_0x24b1cc);var _0x40fbfc=_0x2c575c[_0xb0bd('0x10')](_0x6f870d,'base64','utf8');_0x40fbfc+=_0x2c575c['final'](_0xb0bd('0x1a'));return _0x40fbfc;}; \ No newline at end of file diff --git a/server/components/export/csv.js b/server/components/export/csv.js index e524f5b..01a50cb 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 _0x90bb=['dirname','basename','.csv','existsSync','join','mkdirSync','each','%s%d.%s','%s.%s','writeFileSync','zip','zip\x20finished','info','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','CSV','Completed','csv','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','finally','exit','util','path','lodash','to-csv','bluebird','rimraf','../../mysqldb','dbH','analytics','argv','savename','AnalyticExtractedReport','update','Setting','find','split','splitSizeCsv','then','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','sequelize','QueryTypes','SELECT','num','Empty','length','range','isInteger','format','%s\x20limit\x20%d\x20OFFSET\x20%d','push'];(function(_0x5c4012,_0x14af86){var _0x15f574=function(_0x4b7d1e){while(--_0x4b7d1e){_0x5c4012['push'](_0x5c4012['shift']());}};_0x15f574(++_0x14af86);}(_0x90bb,0x15b));var _0xb90b=function(_0x520edd,_0x2c22d5){_0x520edd=_0x520edd-0x0;var _0x2f2190=_0x90bb[_0x520edd];return _0x2f2190;};'use strict';var util=require(_0xb90b('0x0'));var path=require(_0xb90b('0x1'));var _=require(_0xb90b('0x2'));var csv=require(_0xb90b('0x3'));var fs=require('fs');var BPromise=require(_0xb90b('0x4'));var zipdir=require('zip-dir');var rimraf=require(_0xb90b('0x5'));var db=require(_0xb90b('0x6'))['db'];var dbH=require('../../mysqldb')[_0xb90b('0x7')];var logger=require('../../config/logger')(_0xb90b('0x8'));var EXTRACTED_REPORT_ID=Number(process[_0xb90b('0x9')][0x2]);var QUERY=process[_0xb90b('0x9')][0x3];var PATH=process['argv'][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x1816ac,_0x5a7874){var _0x172027={'status':_0x1816ac};var _0x31b114={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x5a7874){_0x172027[_0xb90b('0xa')]=_0x5a7874;}return db[_0xb90b('0xb')][_0xb90b('0xc')](_0x172027,_0x31b114);}function main(){var _0x342f28=0x1388;var _0x357211;logger['info'](util['format']('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,'CSV'));return db[_0xb90b('0xd')][_0xb90b('0xe')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xb90b('0xf'),_0xb90b('0x10')]})['then'](function(_0x13b562){if(_0x13b562){_0x357211=_0x13b562;_0x342f28=_0x357211[_0xb90b('0x10')]||0x1388;}})[_0xb90b('0x11')](function(){return dbH['sequelize'][_0xb90b('0x12')](util['format'](_0xb90b('0x13'),QUERY),{'type':dbH[_0xb90b('0x14')][_0xb90b('0x15')][_0xb90b('0x16')]});})[_0xb90b('0x11')](function(_0x2bcd3b){if(!_0x2bcd3b[0x0][_0xb90b('0x17')]){return analyticExtractedReport(_0xb90b('0x18'));}var _0x35ea17=[];var _0x103c18=0x0;if(_0x357211[_0xb90b('0xf')]){if(_0x2bcd3b&&_0x2bcd3b[_0xb90b('0x19')]){var _0x2d1de2=_[_0xb90b('0x1a')](_0x2bcd3b[0x0][_0xb90b('0x17')]/_0x342f28);var _0x1e56e8=Number[_0xb90b('0x1b')](_0x2bcd3b[0x0]['num']/_0x342f28)?_0x2bcd3b[0x0][_0xb90b('0x17')]%_0x342f28:0x0;_0x2d1de2['forEach'](function(_0x230d37){if(_0x230d37>0x0){_0x103c18+=_0x342f28;}_0x35ea17['push'](dbH[_0xb90b('0x14')]['query'](util[_0xb90b('0x1c')](_0xb90b('0x1d'),QUERY,_0x342f28,_0x103c18),{'type':dbH['sequelize'][_0xb90b('0x15')]['SELECT']}));});if(_0x1e56e8>0x0){_0x103c18+=_0x342f28;_0x35ea17[_0xb90b('0x1e')](dbH[_0xb90b('0x14')]['query'](util[_0xb90b('0x1c')](_0xb90b('0x1d'),QUERY,_0x1e56e8,_0x103c18),{'type':dbH['sequelize'][_0xb90b('0x15')][_0xb90b('0x16')]}));}}}else{_0x35ea17['push'](dbH[_0xb90b('0x14')][_0xb90b('0x12')](QUERY,{'type':dbH['sequelize']['QueryTypes'][_0xb90b('0x16')]}));}var _0x39063a=path[_0xb90b('0x1f')](PATH);var _0x56a382=path[_0xb90b('0x20')](PATH,_0xb90b('0x21'));var _0x547ec2=_0x357211[_0xb90b('0xf')]&&_0x35ea17[_0xb90b('0x19')]>0x1;var _0x10e647=[];if(!fs[_0xb90b('0x22')](path[_0xb90b('0x23')](_0x39063a,_0x56a382))&&_0x547ec2){fs[_0xb90b('0x24')](path[_0xb90b('0x23')](_0x39063a,_0x56a382));}return BPromise[_0xb90b('0x25')](_0x35ea17,function(_0x551115){_0x10e647[_0xb90b('0x1e')](_0x551115);})['then'](function(){for(var _0x3f7632=0x0;_0x3f7632<_0x10e647[_0xb90b('0x19')];_0x3f7632+=0x1){var _0xb6610a;var _0x5e7677=_0x10e647[_0x3f7632];if(_0x547ec2){_0xb6610a=path[_0xb90b('0x23')](_0x39063a,_0x56a382,util[_0xb90b('0x1c')](_0xb90b('0x26'),_0x56a382,_0x3f7632,'csv'));}else{_0xb6610a=path['join'](_0x39063a,util[_0xb90b('0x1c')](_0xb90b('0x27'),_0x56a382,'csv'));}fs[_0xb90b('0x28')](_0xb6610a,csv(_0x5e7677));}})[_0xb90b('0x11')](function(){if(_0x547ec2){return new Promise(function(_0x26a84e){zipdir(path[_0xb90b('0x23')](_0x39063a,_0x56a382),{'saveTo':path[_0xb90b('0x23')](_0x39063a,util[_0xb90b('0x1c')](_0xb90b('0x27'),_0x56a382,_0xb90b('0x29')))},function(_0x363ae5,_0x97bb17){rimraf(path[_0xb90b('0x23')](_0x39063a,_0x56a382),function(){});_0x26a84e(_0xb90b('0x2a'));});});}})[_0xb90b('0x11')](function(){logger[_0xb90b('0x2b')](util[_0xb90b('0x1c')](_0xb90b('0x2c'),EXTRACTED_REPORT_ID,_0xb90b('0x2d')));return analyticExtractedReport(_0xb90b('0x2e'),_0x547ec2?util[_0xb90b('0x1c')](_0xb90b('0x27'),_0x56a382,_0x547ec2?_0xb90b('0x29'):_0xb90b('0x2f')):null);});})[_0xb90b('0x30')](function(_0x4e8d4b){logger[_0xb90b('0x2b')](util['format'](_0xb90b('0x31'),EXTRACTED_REPORT_ID,_0xb90b('0x2d')),util[_0xb90b('0x32')](_0x4e8d4b,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0xb90b('0x33'));})[_0xb90b('0x34')](function(){process[_0xb90b('0x35')](EXIT_CODE);});}main(); \ No newline at end of file +var _0xb19a=['lodash','bluebird','rimraf','../../mysqldb','../../config/logger','analytics','argv','savename','AnalyticExtractedReport','update','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','CSV','find','split','splitSizeCsv','then','sequelize','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','SELECT','num','Empty','range','isInteger','forEach','%s\x20limit\x20%d\x20OFFSET\x20%d','push','dirname','basename','.csv','length','mkdirSync','join','csv','%s.%s','zip\x20finished','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','zip','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Failed','finally','exit','util'];(function(_0x23b106,_0x50acec){var _0x3c88e5=function(_0x1fcb42){while(--_0x1fcb42){_0x23b106['push'](_0x23b106['shift']());}};_0x3c88e5(++_0x50acec);}(_0xb19a,0x17f));var _0xab19=function(_0x1b5a8d,_0x371270){_0x1b5a8d=_0x1b5a8d-0x0;var _0x436018=_0xb19a[_0x1b5a8d];return _0x436018;};'use strict';var util=require(_0xab19('0x0'));var path=require('path');var _=require(_0xab19('0x1'));var csv=require('to-csv');var fs=require('fs');var BPromise=require(_0xab19('0x2'));var zipdir=require('zip-dir');var rimraf=require(_0xab19('0x3'));var db=require(_0xab19('0x4'))['db'];var dbH=require(_0xab19('0x4'))['dbH'];var logger=require(_0xab19('0x5'))(_0xab19('0x6'));var EXTRACTED_REPORT_ID=Number(process[_0xab19('0x7')][0x2]);var QUERY=process['argv'][0x3];var PATH=process[_0xab19('0x7')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x57d36e,_0x37e133){var _0xe932fd={'status':_0x57d36e};var _0x224f8f={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x37e133){_0xe932fd[_0xab19('0x8')]=_0x37e133;}return db[_0xab19('0x9')][_0xab19('0xa')](_0xe932fd,_0x224f8f);}function main(){var _0x5503c0=0x1388;var _0x29eb43;logger[_0xab19('0xb')](util[_0xab19('0xc')](_0xab19('0xd'),EXTRACTED_REPORT_ID,_0xab19('0xe')));return db['Setting'][_0xab19('0xf')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xab19('0x10'),_0xab19('0x11')]})[_0xab19('0x12')](function(_0x112799){if(_0x112799){_0x29eb43=_0x112799;_0x5503c0=_0x29eb43[_0xab19('0x11')]||0x1388;}})['then'](function(){return dbH[_0xab19('0x13')][_0xab19('0x14')](util[_0xab19('0xc')](_0xab19('0x15'),QUERY),{'type':dbH[_0xab19('0x13')][_0xab19('0x16')][_0xab19('0x17')]});})[_0xab19('0x12')](function(_0x4d0def){if(!_0x4d0def[0x0][_0xab19('0x18')]){return analyticExtractedReport(_0xab19('0x19'));}var _0x5cabc7=[];var _0x704d59=0x0;if(_0x29eb43[_0xab19('0x10')]){if(_0x4d0def&&_0x4d0def['length']){var _0x430214=_[_0xab19('0x1a')](_0x4d0def[0x0][_0xab19('0x18')]/_0x5503c0);var _0x187b48=Number[_0xab19('0x1b')](_0x4d0def[0x0][_0xab19('0x18')]/_0x5503c0)?_0x4d0def[0x0][_0xab19('0x18')]%_0x5503c0:0x0;_0x430214[_0xab19('0x1c')](function(_0x34196e){if(_0x34196e>0x0){_0x704d59+=_0x5503c0;}_0x5cabc7['push'](dbH[_0xab19('0x13')][_0xab19('0x14')](util[_0xab19('0xc')](_0xab19('0x1d'),QUERY,_0x5503c0,_0x704d59),{'type':dbH[_0xab19('0x13')][_0xab19('0x16')][_0xab19('0x17')]}));});if(_0x187b48>0x0){_0x704d59+=_0x5503c0;_0x5cabc7[_0xab19('0x1e')](dbH[_0xab19('0x13')]['query'](util[_0xab19('0xc')](_0xab19('0x1d'),QUERY,_0x187b48,_0x704d59),{'type':dbH[_0xab19('0x13')]['QueryTypes'][_0xab19('0x17')]}));}}}else{_0x5cabc7[_0xab19('0x1e')](dbH[_0xab19('0x13')][_0xab19('0x14')](QUERY,{'type':dbH[_0xab19('0x13')][_0xab19('0x16')][_0xab19('0x17')]}));}var _0x3e3723=path[_0xab19('0x1f')](PATH);var _0xee2b38=path[_0xab19('0x20')](PATH,_0xab19('0x21'));var _0x42dce0=_0x29eb43[_0xab19('0x10')]&&_0x5cabc7[_0xab19('0x22')]>0x1;var _0xfe49bf=[];if(!fs['existsSync'](path['join'](_0x3e3723,_0xee2b38))&&_0x42dce0){fs[_0xab19('0x23')](path[_0xab19('0x24')](_0x3e3723,_0xee2b38));}return BPromise['each'](_0x5cabc7,function(_0x1be523){_0xfe49bf['push'](_0x1be523);})[_0xab19('0x12')](function(){for(var _0x5f5b54=0x0;_0x5f5b54<_0xfe49bf[_0xab19('0x22')];_0x5f5b54+=0x1){var _0x59381f;var _0x2f9a35=_0xfe49bf[_0x5f5b54];if(_0x42dce0){_0x59381f=path[_0xab19('0x24')](_0x3e3723,_0xee2b38,util['format']('%s%d.%s',_0xee2b38,_0x5f5b54,'csv'));}else{_0x59381f=path[_0xab19('0x24')](_0x3e3723,util[_0xab19('0xc')]('%s.%s',_0xee2b38,_0xab19('0x25')));}fs['writeFileSync'](_0x59381f,csv(_0x2f9a35));}})[_0xab19('0x12')](function(){if(_0x42dce0){return new Promise(function(_0xacbf6e){zipdir(path['join'](_0x3e3723,_0xee2b38),{'saveTo':path[_0xab19('0x24')](_0x3e3723,util['format'](_0xab19('0x26'),_0xee2b38,'zip'))},function(_0x4ae3e9,_0x2890ab){rimraf(path['join'](_0x3e3723,_0xee2b38),function(){});_0xacbf6e(_0xab19('0x27'));});});}})[_0xab19('0x12')](function(){logger[_0xab19('0xb')](util[_0xab19('0xc')](_0xab19('0x28'),EXTRACTED_REPORT_ID,_0xab19('0xe')));return analyticExtractedReport(_0xab19('0x29'),_0x42dce0?util[_0xab19('0xc')](_0xab19('0x26'),_0xee2b38,_0x42dce0?_0xab19('0x2a'):_0xab19('0x25')):null);});})[_0xab19('0x2b')](function(_0x25656e){logger[_0xab19('0xb')](util[_0xab19('0xc')](_0xab19('0x2c'),EXTRACTED_REPORT_ID,'CSV'),util['inspect'](_0x25656e,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0xab19('0x2d'));})[_0xab19('0x2e')](function(){process[_0xab19('0x2f')](EXIT_CODE);});}main(); \ No newline at end of file diff --git a/server/components/export/pdf.js b/server/components/export/pdf.js index 7110937..7acb04f 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 _0x2142=['info','PDF','Completed','zip','findOne','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Failed','finally','/fonts/arial-regular.ttf','/fonts/arial-bold.ttf','/fonts/arial-bold-italic.ttf','%s\x20#%d','channel','interactionId','YYYY-MM-DD','center','\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s','pipe','finish','error','end','createPdfFromHTML','lodash','util','path','moment','html-to-pdfmake','pdfmake/src/printer','zip-dir','rimraf','jsdom','JSDOM','window','bluebird','../../mysqldb','../../config/logger','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','savename','AnalyticExtractedReport','map','tableHeader','pick','value','fill','length','body','push','concat','keys','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','name','startDate','format','pageBreak','before','margin','toString','\x20/\x20','Arial','black','Empty','Setting','splitSizePdf','then','split','range','isInteger','num','forEach','%s\x20limit\x20%d\x20OFFSET\x20%d','sequelize','QueryTypes','SELECT','query','dirname','basename','.pdf','existsSync','mkdirSync','join','flatten','createPdfKitDocument','%s%d.%s','pdf','all','%s.%s','zip\x20finished'];(function(_0x2023e1,_0xeca985){var _0x1fe133=function(_0x526d5f){while(--_0x526d5f){_0x2023e1['push'](_0x2023e1['shift']());}};_0x1fe133(++_0xeca985);}(_0x2142,0x17b));var _0x2214=function(_0x505dcb,_0x3d3646){_0x505dcb=_0x505dcb-0x0;var _0x3f1944=_0x2142[_0x505dcb];return _0x3f1944;};'use strict';var _=require(_0x2214('0x0'));var fs=require('fs');var util=require(_0x2214('0x1'));var path=require(_0x2214('0x2'));var moment=require(_0x2214('0x3'));var htmlToPdfmake=require(_0x2214('0x4'));var PdfPrinter=require(_0x2214('0x5'));var zipdir=require(_0x2214('0x6'));var rimraf=require(_0x2214('0x7'));var JSDOM=require(_0x2214('0x8'))[_0x2214('0x9')];var window=new JSDOM('')[_0x2214('0xa')];var BPromise=require(_0x2214('0xb'));var db=require(_0x2214('0xc'))['db'];var dbH=require(_0x2214('0xc'))['dbH'];var logger=require(_0x2214('0xd'))('analytics');var EXTRACTED_REPORT_ID=Number(process[_0x2214('0xe')][0x2]);var QUERY=process[_0x2214('0xe')][0x3];var PATH=process[_0x2214('0xe')][0x4];var NAME=process[_0x2214('0xe')][0x5];var FORMAT=_0x2214('0xf');var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x594f63,_0x2ef94d){var _0x76345f={'status':_0x594f63};var _0x1ea0b0={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x2ef94d){_0x76345f[_0x2214('0x10')]=_0x2ef94d;}return db[_0x2214('0x11')]['update'](_0x76345f,_0x1ea0b0);}function getHeaders(_0x4072af){return _[_0x2214('0x12')](_0x4072af,function(_0x3ad7cd){return{'text':_0x3ad7cd,'style':_0x2214('0x13')};});}function getRows(_0x2dda6b,_0x9856c1){return _[_0x2214('0x12')](_0x9856c1,function(_0x3af3b8){return _(_0x3af3b8)[_0x2214('0x14')](_0x2dda6b)[_0x2214('0x12')](function(_0x1f907f){return _0x1f907f?_['toString'](_0x1f907f):'';})[_0x2214('0x15')]();});}function createTable(_0x4d9e5f,_0x57efb5){var _0x534d6b={'widths':_[_0x2214('0x16')](Array(_0x4d9e5f[_0x2214('0x17')]),0x91),'heights':function(_0x34166a){return _0x34166a===0x0?'auto':0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0xe2afdb=getHeaders(_0x4d9e5f);_0x534d6b[_0x2214('0x18')][_0x2214('0x19')](_0xe2afdb);var _0x2dc1e8=getRows(_0x4d9e5f,_0x57efb5);_0x534d6b[_0x2214('0x18')]=_0x534d6b['body'][_0x2214('0x1a')](_0x2dc1e8);return _0x534d6b;}function createTables(_0x31f92a){var _0x2cdd2a=[];var _0x584d28=_['chunk'](Object[_0x2214('0x1b')](_0x31f92a[0x0]),0x5);_0x584d28['forEach'](function(_0x419f99){_0x2cdd2a['push'](createTable(_0x419f99,_0x31f92a));});return _0x2cdd2a;}function getPDFDocDefinition(_0xf538cb){var _0x44a41c=util['format'](_0x2214('0x1c'),NAME,EXTRACTED_REPORT[_0x2214('0x1d')],moment(EXTRACTED_REPORT[_0x2214('0x1e')])[_0x2214('0x1f')](FORMAT),moment(EXTRACTED_REPORT['endDate'])[_0x2214('0x1f')](FORMAT));var _0x246470=[];for(var _0x3e68b0=0x0;_0x3e68b0<_0xf538cb[_0x2214('0x17')];_0x3e68b0++){var _0x7a6c98=[];if(_0x3e68b0===0x0){_0x7a6c98['push']({'text':_0x44a41c,'style':'header'});}var _0x31f995={'table':_0xf538cb[_0x3e68b0]};if(_0x3e68b0>0x0){_0x31f995[_0x2214('0x20')]=_0x2214('0x21');_0x31f995[_0x2214('0x22')]=[0x0,0x46,0x0,0x0];}_0x7a6c98[_0x2214('0x19')](_0x31f995);_0x246470[_0x2214('0x19')](_0x7a6c98);}return{'pageSize':'A4','pageOrientation':'landscape','content':_0x246470,'footer':function(_0x1833a4,_0x4cfe0c){return{'text':_0x1833a4[_0x2214('0x23')]()+_0x2214('0x24')+_0x4cfe0c,'style':'footer'};},'defaultStyle':{'font':_0x2214('0x25')},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0x2214('0x26')},'footer':{'alignment':'right','margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x314b31){var _0x66b1f2=0x1388;var _0x7ac600;if(!_0x314b31[0x0]['num']){return analyticExtractedReport(_0x2214('0x27'));}return db[_0x2214('0x28')]['find']({'where':{'id':0x1},'raw':!![],'attributes':['id','split',_0x2214('0x29')]})[_0x2214('0x2a')](function(_0x204e92){if(_0x204e92){_0x7ac600=_0x204e92;_0x66b1f2=_0x7ac600[_0x2214('0x29')]||0x3e8;}})[_0x2214('0x2a')](function(){var _0x507086=[];var _0x56883f=0x0;if(_0x7ac600[_0x2214('0x2b')]){if(_0x314b31&&_0x314b31[_0x2214('0x17')]){var _0x1f05d0=_[_0x2214('0x2c')](_0x314b31[0x0]['num']/_0x66b1f2);var _0x58d796=Number[_0x2214('0x2d')](_0x314b31[0x0]['num']/_0x66b1f2)?_0x314b31[0x0][_0x2214('0x2e')]%_0x66b1f2:0x0;_0x1f05d0[_0x2214('0x2f')](function(_0xe46bf7){if(_0xe46bf7>0x0){_0x56883f+=_0x66b1f2;}_0x507086['push'](dbH['sequelize']['query'](util[_0x2214('0x1f')](_0x2214('0x30'),QUERY,_0x66b1f2,_0x56883f),{'type':dbH[_0x2214('0x31')][_0x2214('0x32')][_0x2214('0x33')]}));});if(_0x58d796>0x0){_0x56883f+=_0x66b1f2;_0x507086[_0x2214('0x19')](dbH['sequelize'][_0x2214('0x34')](util[_0x2214('0x1f')](_0x2214('0x30'),QUERY,_0x58d796,_0x56883f),{'type':dbH[_0x2214('0x31')][_0x2214('0x32')][_0x2214('0x33')]}));}}}else{_0x507086[_0x2214('0x19')](dbH[_0x2214('0x31')][_0x2214('0x34')](QUERY,{'type':dbH[_0x2214('0x31')]['QueryTypes'][_0x2214('0x33')]}));}var _0x3b64bf=path[_0x2214('0x35')](PATH);var _0x5cfe48=path[_0x2214('0x36')](PATH,_0x2214('0x37'));var _0x1c1567=_0x7ac600['split']&&_0x507086['length']>0x1;var _0x394073=[];if(!fs[_0x2214('0x38')](path['join'](_0x3b64bf,_0x5cfe48))&&_0x1c1567){fs[_0x2214('0x39')](path[_0x2214('0x3a')](_0x3b64bf,_0x5cfe48));}return BPromise['each'](_0x507086,function(_0x375d06){_0x394073['push'](_0x375d06);})[_0x2214('0x2a')](function(){var _0x1a4e26=[];for(var _0x35976a=0x0;_0x35976a<_0x394073[_0x2214('0x17')];_0x35976a+=0x1){var _0x141420=_0x394073[_0x35976a];var _0x4cbf0e=createTables(_[_0x2214('0x3b')](_0x141420));var _0xaee4cd;var _0x8183d2=getPDFDocDefinition(_0x4cbf0e);var _0x32e4e2=getPDFPrinter();var _0x8111ef=_0x32e4e2[_0x2214('0x3c')](_0x8183d2);if(_0x1c1567){_0xaee4cd=path[_0x2214('0x3a')](_0x3b64bf,_0x5cfe48,util[_0x2214('0x1f')](_0x2214('0x3d'),_0x5cfe48,_0x35976a,_0x2214('0x3e')));}else{_0xaee4cd=path[_0x2214('0x3a')](_0x3b64bf,util[_0x2214('0x1f')]('%s.%s',_0x5cfe48,_0x2214('0x3e')));}_0x1a4e26[_0x2214('0x19')](writePDFDocument(_0x8111ef,_0xaee4cd));}return Promise[_0x2214('0x3f')](_0x1a4e26);})['then'](function(){if(_0x1c1567){return new Promise(function(_0x163f05){zipdir(path[_0x2214('0x3a')](_0x3b64bf,_0x5cfe48),{'saveTo':path[_0x2214('0x3a')](_0x3b64bf,util[_0x2214('0x1f')](_0x2214('0x40'),_0x5cfe48,'zip'))},function(){rimraf(path[_0x2214('0x3a')](_0x3b64bf,_0x5cfe48),function(){});_0x163f05(_0x2214('0x41'));});});}})[_0x2214('0x2a')](function(){if(!_0x1c1567)return;rimraf(path[_0x2214('0x3a')](_0x3b64bf,_0x5cfe48),function(){});})[_0x2214('0x2a')](function(){logger[_0x2214('0x42')](util[_0x2214('0x1f')]('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,_0x2214('0x43')));return analyticExtractedReport(_0x2214('0x44'),_0x1c1567?util['format']('%s.%s',_0x5cfe48,_0x1c1567?_0x2214('0x45'):_0x2214('0x3e')):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger[_0x2214('0x42')](util[_0x2214('0x1f')]('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0x2214('0x43')));return db['AnalyticExtractedReport'][_0x2214('0x46')]({'where':{'id':EXTRACTED_REPORT_ID}})[_0x2214('0x2a')](function(_0x5724a9){EXTRACTED_REPORT=_0x5724a9;return dbH[_0x2214('0x31')]['query'](util[_0x2214('0x1f')](_0x2214('0x47'),QUERY),{'type':dbH['sequelize'][_0x2214('0x32')][_0x2214('0x33')]});})[_0x2214('0x2a')](extractReport)['catch'](function(_0xda203f){logger[_0x2214('0x42')](util['format'](_0x2214('0x48'),EXTRACTED_REPORT_ID,_0x2214('0x43')),util['inspect'](_0xda203f,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x2214('0x49'));})[_0x2214('0x4a')](function(){process['exit'](EXIT_CODE);});}main();function getPDFPrinter(){var _0x529389=new PdfPrinter({'Arial':{'normal':__dirname+_0x2214('0x4b'),'bold':__dirname+_0x2214('0x4c'),'italics':__dirname+'/fonts/arial-italic.ttf','bolditalics':__dirname+_0x2214('0x4d')}});return _0x529389;}function getPDFDocDefinitionFromHTML(_0xc114c3,_0x28470f){var _0xf77cb1=util[_0x2214('0x1f')](_0x2214('0x4e'),_0x28470f[_0x2214('0x4f')],_0x28470f[_0x2214('0x50')]);var _0x496da4=moment()[_0x2214('0x1f')](_0x2214('0x51'))[_0x2214('0x23')]();var _0x42245e=htmlToPdfmake(_0xc114c3,{'window':window,'tableAutoSize':!![]});return{'content':[_0x42245e],'defaultStyle':{'font':_0x2214('0x25')},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':_0x2214('0x52'),'margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':_0x2214('0x52'),'margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':_0x2214('0x52')}},'header':function(){return[{'text':'Interaction\x20Transcript','style':'header'}];},'footer':function(_0x3c24d9,_0x17195b){return[{'text':util[_0x2214('0x1f')](_0x2214('0x53'),_0xf77cb1,_0x3c24d9,_0x17195b,_0x496da4),'style':'footer'}];}};}function writePDFDocument(_0x5266bc,_0x9285dd){return new Promise(function(_0x121c9f,_0x40b9d9){var _0x5c9ecc=_0x5266bc[_0x2214('0x54')](fs['createWriteStream'](_0x9285dd));_0x5c9ecc['on'](_0x2214('0x55'),function(){_0x121c9f('finish');});_0x5c9ecc['on'](_0x2214('0x56'),function(_0x2fae4e){_0x40b9d9(_0x2fae4e);});_0x5266bc[_0x2214('0x57')]();});}exports[_0x2214('0x58')]=function(_0xfe447,_0x27bcd5){var _0x1bf347=getPDFPrinter();var _0x417e15=getPDFDocDefinitionFromHTML(_0xfe447,_0x27bcd5);var _0x5c4ebd=_0x1bf347[_0x2214('0x3c')](_0x417e15);return writePDFDocument(_0x5c4ebd,_0x27bcd5[_0x2214('0x2')])['catch'](function(_0x47dbfd){throw _0x47dbfd;});}; \ No newline at end of file +var _0x1688=['header','before','margin','landscape','\x20/\x20','Arial','right','num','Empty','splitSizePdf','then','split','range','isInteger','sequelize','QueryTypes','SELECT','query','dirname','basename','.pdf','existsSync','join','mkdirSync','createPdfKitDocument','%s%d.%s','%s.%s','all','zip','zip\x20finished','info','PDF','Completed','pdf','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','finally','/fonts/arial-regular.ttf','/fonts/arial-italic.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','footer','pipe','createWriteStream','finish','end','createPdfFromHTML','catch','util','path','moment','html-to-pdfmake','pdfmake/src/printer','zip-dir','rimraf','jsdom','window','bluebird','dbH','../../config/logger','analytics','argv','savename','AnalyticExtractedReport','update','map','tableHeader','pick','toString','fill','length','auto','body','chunk','keys','forEach','push','format','name'];(function(_0x4226d6,_0x3864ca){var _0x19655b=function(_0x1d43a1){while(--_0x1d43a1){_0x4226d6['push'](_0x4226d6['shift']());}};_0x19655b(++_0x3864ca);}(_0x1688,0xe3));var _0x8168=function(_0x2ed8c8,_0x3a867e){_0x2ed8c8=_0x2ed8c8-0x0;var _0xad96c9=_0x1688[_0x2ed8c8];return _0xad96c9;};'use strict';var _=require('lodash');var fs=require('fs');var util=require(_0x8168('0x0'));var path=require(_0x8168('0x1'));var moment=require(_0x8168('0x2'));var htmlToPdfmake=require(_0x8168('0x3'));var PdfPrinter=require(_0x8168('0x4'));var zipdir=require(_0x8168('0x5'));var rimraf=require(_0x8168('0x6'));var JSDOM=require(_0x8168('0x7'))['JSDOM'];var window=new JSDOM('')[_0x8168('0x8')];var BPromise=require(_0x8168('0x9'));var db=require('../../mysqldb')['db'];var dbH=require('../../mysqldb')[_0x8168('0xa')];var logger=require(_0x8168('0xb'))(_0x8168('0xc'));var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process[_0x8168('0xd')][0x3];var PATH=process[_0x8168('0xd')][0x4];var NAME=process[_0x8168('0xd')][0x5];var FORMAT='MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a';var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x284eed,_0x39ff66){var _0xae0945={'status':_0x284eed};var _0x4e2506={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x39ff66){_0xae0945[_0x8168('0xe')]=_0x39ff66;}return db[_0x8168('0xf')][_0x8168('0x10')](_0xae0945,_0x4e2506);}function getHeaders(_0xfedc05){return _[_0x8168('0x11')](_0xfedc05,function(_0x3bdf79){return{'text':_0x3bdf79,'style':_0x8168('0x12')};});}function getRows(_0x57cec3,_0x46f57a){return _[_0x8168('0x11')](_0x46f57a,function(_0x4cda17){return _(_0x4cda17)[_0x8168('0x13')](_0x57cec3)['map'](function(_0x3996e0){return _0x3996e0?_[_0x8168('0x14')](_0x3996e0):'';})['value']();});}function createTable(_0x1e9dbe,_0x3ed604){var _0x1b4cab={'widths':_[_0x8168('0x15')](Array(_0x1e9dbe[_0x8168('0x16')]),0x91),'heights':function(_0x4ebb6a){return _0x4ebb6a===0x0?_0x8168('0x17'):0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x1819a1=getHeaders(_0x1e9dbe);_0x1b4cab[_0x8168('0x18')]['push'](_0x1819a1);var _0x1f7bf0=getRows(_0x1e9dbe,_0x3ed604);_0x1b4cab[_0x8168('0x18')]=_0x1b4cab[_0x8168('0x18')]['concat'](_0x1f7bf0);return _0x1b4cab;}function createTables(_0x466132){var _0x47f6a3=[];var _0x45fa80=_[_0x8168('0x19')](Object[_0x8168('0x1a')](_0x466132[0x0]),0x5);_0x45fa80[_0x8168('0x1b')](function(_0x3195e0){_0x47f6a3[_0x8168('0x1c')](createTable(_0x3195e0,_0x466132));});return _0x47f6a3;}function getPDFDocDefinition(_0x2be558){var _0x522456=util[_0x8168('0x1d')]('Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s',NAME,EXTRACTED_REPORT[_0x8168('0x1e')],moment(EXTRACTED_REPORT['startDate'])[_0x8168('0x1d')](FORMAT),moment(EXTRACTED_REPORT['endDate'])[_0x8168('0x1d')](FORMAT));var _0x2bbc51=[];for(var _0x5a1d64=0x0;_0x5a1d64<_0x2be558[_0x8168('0x16')];_0x5a1d64++){var _0x3b3257=[];if(_0x5a1d64===0x0){_0x3b3257[_0x8168('0x1c')]({'text':_0x522456,'style':_0x8168('0x1f')});}var _0x5ad360={'table':_0x2be558[_0x5a1d64]};if(_0x5a1d64>0x0){_0x5ad360['pageBreak']=_0x8168('0x20');_0x5ad360[_0x8168('0x21')]=[0x0,0x46,0x0,0x0];}_0x3b3257[_0x8168('0x1c')](_0x5ad360);_0x2bbc51[_0x8168('0x1c')](_0x3b3257);}return{'pageSize':'A4','pageOrientation':_0x8168('0x22'),'content':_0x2bbc51,'footer':function(_0x59a7f0,_0x33a1b3){return{'text':_0x59a7f0[_0x8168('0x14')]()+_0x8168('0x23')+_0x33a1b3,'style':'footer'};},'defaultStyle':{'font':_0x8168('0x24')},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':'black'},'footer':{'alignment':_0x8168('0x25'),'margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x302fb3){var _0x2de95f=0x1388;var _0x37d943;if(!_0x302fb3[0x0][_0x8168('0x26')]){return analyticExtractedReport(_0x8168('0x27'));}return db['Setting']['find']({'where':{'id':0x1},'raw':!![],'attributes':['id','split',_0x8168('0x28')]})['then'](function(_0x486a08){if(_0x486a08){_0x37d943=_0x486a08;_0x2de95f=_0x37d943[_0x8168('0x28')]||0x3e8;}})[_0x8168('0x29')](function(){var _0x32de9c=[];var _0x363e73=0x0;if(_0x37d943[_0x8168('0x2a')]){if(_0x302fb3&&_0x302fb3[_0x8168('0x16')]){var _0x5cae57=_[_0x8168('0x2b')](_0x302fb3[0x0]['num']/_0x2de95f);var _0x1e9dbc=Number[_0x8168('0x2c')](_0x302fb3[0x0][_0x8168('0x26')]/_0x2de95f)?_0x302fb3[0x0]['num']%_0x2de95f:0x0;_0x5cae57[_0x8168('0x1b')](function(_0x3f7950){if(_0x3f7950>0x0){_0x363e73+=_0x2de95f;}_0x32de9c[_0x8168('0x1c')](dbH[_0x8168('0x2d')]['query'](util[_0x8168('0x1d')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x2de95f,_0x363e73),{'type':dbH[_0x8168('0x2d')][_0x8168('0x2e')][_0x8168('0x2f')]}));});if(_0x1e9dbc>0x0){_0x363e73+=_0x2de95f;_0x32de9c[_0x8168('0x1c')](dbH[_0x8168('0x2d')][_0x8168('0x30')](util[_0x8168('0x1d')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x1e9dbc,_0x363e73),{'type':dbH['sequelize'][_0x8168('0x2e')][_0x8168('0x2f')]}));}}}else{_0x32de9c[_0x8168('0x1c')](dbH[_0x8168('0x2d')][_0x8168('0x30')](QUERY,{'type':dbH[_0x8168('0x2d')][_0x8168('0x2e')][_0x8168('0x2f')]}));}var _0x520fc1=path[_0x8168('0x31')](PATH);var _0x22e19e=path[_0x8168('0x32')](PATH,_0x8168('0x33'));var _0x51fd44=_0x37d943[_0x8168('0x2a')]&&_0x32de9c[_0x8168('0x16')]>0x1;var _0x37a1a3=[];if(!fs[_0x8168('0x34')](path[_0x8168('0x35')](_0x520fc1,_0x22e19e))&&_0x51fd44){fs[_0x8168('0x36')](path[_0x8168('0x35')](_0x520fc1,_0x22e19e));}return BPromise['each'](_0x32de9c,function(_0x4186ed){_0x37a1a3['push'](_0x4186ed);})['then'](function(){var _0x2b742b=[];for(var _0x2b18bf=0x0;_0x2b18bf<_0x37a1a3[_0x8168('0x16')];_0x2b18bf+=0x1){var _0x1b371a=_0x37a1a3[_0x2b18bf];var _0x423202=createTables(_['flatten'](_0x1b371a));var _0xe19520;var _0x4b324f=getPDFDocDefinition(_0x423202);var _0x3894f7=getPDFPrinter();var _0x2afa22=_0x3894f7[_0x8168('0x37')](_0x4b324f);if(_0x51fd44){_0xe19520=path[_0x8168('0x35')](_0x520fc1,_0x22e19e,util[_0x8168('0x1d')](_0x8168('0x38'),_0x22e19e,_0x2b18bf,'pdf'));}else{_0xe19520=path[_0x8168('0x35')](_0x520fc1,util['format'](_0x8168('0x39'),_0x22e19e,'pdf'));}_0x2b742b['push'](writePDFDocument(_0x2afa22,_0xe19520));}return Promise[_0x8168('0x3a')](_0x2b742b);})[_0x8168('0x29')](function(){if(_0x51fd44){return new Promise(function(_0x1a2a11){zipdir(path['join'](_0x520fc1,_0x22e19e),{'saveTo':path[_0x8168('0x35')](_0x520fc1,util[_0x8168('0x1d')](_0x8168('0x39'),_0x22e19e,_0x8168('0x3b')))},function(){rimraf(path[_0x8168('0x35')](_0x520fc1,_0x22e19e),function(){});_0x1a2a11(_0x8168('0x3c'));});});}})[_0x8168('0x29')](function(){if(!_0x51fd44)return;rimraf(path[_0x8168('0x35')](_0x520fc1,_0x22e19e),function(){});})[_0x8168('0x29')](function(){logger[_0x8168('0x3d')](util['format']('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,_0x8168('0x3e')));return analyticExtractedReport(_0x8168('0x3f'),_0x51fd44?util[_0x8168('0x1d')](_0x8168('0x39'),_0x22e19e,_0x51fd44?'zip':_0x8168('0x40')):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger['info'](util[_0x8168('0x1d')]('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0x8168('0x3e')));return db['AnalyticExtractedReport']['findOne']({'where':{'id':EXTRACTED_REPORT_ID}})['then'](function(_0x43690f){EXTRACTED_REPORT=_0x43690f;return dbH[_0x8168('0x2d')][_0x8168('0x30')](util[_0x8168('0x1d')](_0x8168('0x41'),QUERY),{'type':dbH[_0x8168('0x2d')][_0x8168('0x2e')][_0x8168('0x2f')]});})[_0x8168('0x29')](extractReport)['catch'](function(_0x32c66f){logger[_0x8168('0x3d')](util[_0x8168('0x1d')](_0x8168('0x42'),EXTRACTED_REPORT_ID,_0x8168('0x3e')),util[_0x8168('0x43')](_0x32c66f,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x8168('0x44'));})[_0x8168('0x45')](function(){process['exit'](EXIT_CODE);});}main();function getPDFPrinter(){var _0x4a2286=new PdfPrinter({'Arial':{'normal':__dirname+_0x8168('0x46'),'bold':__dirname+'/fonts/arial-bold.ttf','italics':__dirname+_0x8168('0x47'),'bolditalics':__dirname+_0x8168('0x48')}});return _0x4a2286;}function getPDFDocDefinitionFromHTML(_0x118c44,_0x148282){var _0x3a7cd0=util[_0x8168('0x1d')](_0x8168('0x49'),_0x148282[_0x8168('0x4a')],_0x148282['interactionId']);var _0x31f366=moment()['format'](_0x8168('0x4b'))[_0x8168('0x14')]();var _0x4490c2=htmlToPdfmake(_0x118c44,{'window':window,'tableAutoSize':!![]});return{'content':[_0x4490c2],'defaultStyle':{'font':_0x8168('0x24')},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':_0x8168('0x4c'),'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':_0x8168('0x4c')}},'header':function(){return[{'text':_0x8168('0x4d'),'style':_0x8168('0x1f')}];},'footer':function(_0x100662,_0x3f660e){return[{'text':util[_0x8168('0x1d')](_0x8168('0x4e'),_0x3a7cd0,_0x100662,_0x3f660e,_0x31f366),'style':_0x8168('0x4f')}];}};}function writePDFDocument(_0x506aad,_0x180efd){return new Promise(function(_0x387ff4,_0x145ce6){var _0x51bdd9=_0x506aad[_0x8168('0x50')](fs[_0x8168('0x51')](_0x180efd));_0x51bdd9['on'](_0x8168('0x52'),function(){_0x387ff4('finish');});_0x51bdd9['on']('error',function(_0x387b1a){_0x145ce6(_0x387b1a);});_0x506aad[_0x8168('0x53')]();});}exports[_0x8168('0x54')]=function(_0x3163ba,_0x856b25){var _0x54cd17=getPDFPrinter();var _0x448c42=getPDFDocDefinitionFromHTML(_0x3163ba,_0x856b25);var _0x2302f1=_0x54cd17['createPdfKitDocument'](_0x448c42);return writePDFDocument(_0x2302f1,_0x856b25['path'])[_0x8168('0x55')](function(_0x1eeeb3){throw _0x1eeeb3;});}; \ No newline at end of file diff --git a/server/components/export/xlsx.js b/server/components/export/xlsx.js index 1834e00..8ad7bea 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 _0xac5f=['XLSX','Completed','catch','inspect','exit','util','json2xls','bluebird','zip-dir','../../mysqldb','analytics','argv','savename','update','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','split','splitSizeXlsx','then','sequelize','query','format','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','SELECT','Empty','length','range','num','forEach','push','%s\x20limit\x20%d\x20OFFSET\x20%d','basename','existsSync','join','mkdirSync','each','%s%d.%s','xlsx','%s.%s','writeFileSync','binary','zip','zip\x20finished','info'];(function(_0x562cd7,_0x5ae8e7){var _0x30f50d=function(_0x43b995){while(--_0x43b995){_0x562cd7['push'](_0x562cd7['shift']());}};_0x30f50d(++_0x5ae8e7);}(_0xac5f,0x139));var _0xfac5=function(_0x1bbdc8,_0x4ae4fd){_0x1bbdc8=_0x1bbdc8-0x0;var _0x9da429=_0xac5f[_0x1bbdc8];return _0x9da429;};'use strict';var util=require(_0xfac5('0x0'));var path=require('path');var _=require('lodash');var fs=require('fs');var json2xls=require(_0xfac5('0x1'));var BPromise=require(_0xfac5('0x2'));var zipdir=require(_0xfac5('0x3'));var rimraf=require('rimraf');var db=require('../../mysqldb')['db'];var dbH=require(_0xfac5('0x4'))['dbH'];var logger=require('../../config/logger')(_0xfac5('0x5'));var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process[_0xfac5('0x6')][0x3];var PATH=process[_0xfac5('0x6')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x423256,_0x1c9428){var _0xf8180e={'status':_0x423256};var _0x8c0259={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x1c9428){_0xf8180e[_0xfac5('0x7')]=_0x1c9428;}return db['AnalyticExtractedReport'][_0xfac5('0x8')](_0xf8180e,_0x8c0259);}function main(){var _0x304614=0x1388;var _0x5c6ad5;logger['info'](util['format'](_0xfac5('0x9'),EXTRACTED_REPORT_ID,'XLSX'));return db['Setting']['find']({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xfac5('0xa'),_0xfac5('0xb')]})['then'](function(_0x2aa29e){if(_0x2aa29e){_0x5c6ad5=_0x2aa29e;_0x304614=_0x5c6ad5[_0xfac5('0xb')]||0x1388;}})[_0xfac5('0xc')](function(){return dbH[_0xfac5('0xd')][_0xfac5('0xe')](util[_0xfac5('0xf')](_0xfac5('0x10'),QUERY),{'type':dbH[_0xfac5('0xd')][_0xfac5('0x11')][_0xfac5('0x12')]});})[_0xfac5('0xc')](function(_0x4daa55){if(!_0x4daa55[0x0]['num']){return analyticExtractedReport(_0xfac5('0x13'));}var _0x53d682=[];var _0x4abf9d=0x0;if(_0x5c6ad5['split']){if(_0x4daa55&&_0x4daa55[_0xfac5('0x14')]){var _0x409584=_[_0xfac5('0x15')](_0x4daa55[0x0][_0xfac5('0x16')]/_0x304614);var _0x40aef4=Number['isInteger'](_0x4daa55[0x0][_0xfac5('0x16')]/_0x304614)?_0x4daa55[0x0][_0xfac5('0x16')]%_0x304614:0x0;_0x409584[_0xfac5('0x17')](function(_0xde10d6){if(_0xde10d6>0x0){_0x4abf9d+=_0x304614;}_0x53d682[_0xfac5('0x18')](dbH[_0xfac5('0xd')][_0xfac5('0xe')](util[_0xfac5('0xf')](_0xfac5('0x19'),QUERY,_0x304614,_0x4abf9d),{'type':dbH[_0xfac5('0xd')]['QueryTypes'][_0xfac5('0x12')]}));});if(_0x40aef4>0x0){_0x4abf9d+=_0x304614;_0x53d682[_0xfac5('0x18')](dbH[_0xfac5('0xd')][_0xfac5('0xe')](util[_0xfac5('0xf')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x40aef4,_0x4abf9d),{'type':dbH[_0xfac5('0xd')][_0xfac5('0x11')][_0xfac5('0x12')]}));}}}else{_0x53d682[_0xfac5('0x18')](dbH[_0xfac5('0xd')]['query'](QUERY,{'type':dbH['sequelize']['QueryTypes'][_0xfac5('0x12')]}));}var _0x27b202=path['dirname'](PATH);var _0x4516bd=path[_0xfac5('0x1a')](PATH,'.xlsx');var _0x45302e=_0x5c6ad5[_0xfac5('0xa')]&&_0x53d682[_0xfac5('0x14')]>0x1;var _0x1ef23d=[];if(!fs[_0xfac5('0x1b')](path[_0xfac5('0x1c')](_0x27b202,_0x4516bd))&&_0x45302e){fs[_0xfac5('0x1d')](path['join'](_0x27b202,_0x4516bd));}return BPromise[_0xfac5('0x1e')](_0x53d682,function(_0x10fbbb){_0x1ef23d[_0xfac5('0x18')](_0x10fbbb);})[_0xfac5('0xc')](function(){for(var _0x453bda=0x0;_0x453bda<_0x1ef23d[_0xfac5('0x14')];_0x453bda+=0x1){var _0x1ac1cc;var _0x19429c=_0x1ef23d[_0x453bda];if(_0x45302e){_0x1ac1cc=path[_0xfac5('0x1c')](_0x27b202,_0x4516bd,util[_0xfac5('0xf')](_0xfac5('0x1f'),_0x4516bd,_0x453bda,_0xfac5('0x20')));}else{_0x1ac1cc=path[_0xfac5('0x1c')](_0x27b202,util[_0xfac5('0xf')](_0xfac5('0x21'),_0x4516bd,_0xfac5('0x20')));}fs[_0xfac5('0x22')](_0x1ac1cc,json2xls(_0x19429c),_0xfac5('0x23'));}})[_0xfac5('0xc')](function(){if(_0x45302e){return new Promise(function(_0x1fe8a7){zipdir(path[_0xfac5('0x1c')](_0x27b202,_0x4516bd),{'saveTo':path[_0xfac5('0x1c')](_0x27b202,util['format'](_0xfac5('0x21'),_0x4516bd,_0xfac5('0x24')))},function(_0x47cf17,_0xbefc82){rimraf(path[_0xfac5('0x1c')](_0x27b202,_0x4516bd),function(){});_0x1fe8a7(_0xfac5('0x25'));});});}})[_0xfac5('0xc')](function(){logger[_0xfac5('0x26')](util[_0xfac5('0xf')]('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,_0xfac5('0x27')));return analyticExtractedReport(_0xfac5('0x28'),_0x45302e?util[_0xfac5('0xf')](_0xfac5('0x21'),_0x4516bd,_0x45302e?_0xfac5('0x24'):_0xfac5('0x20')):null);});})[_0xfac5('0x29')](function(_0x9e2163){logger[_0xfac5('0x26')](util[_0xfac5('0xf')]('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,'XLSX'),util[_0xfac5('0x2a')](_0x9e2163,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport('Failed');})['finally'](function(){process[_0xfac5('0x2b')](EXIT_CODE);});}main(); \ No newline at end of file +var _0x77b5=['each','%s%d.%s','xlsx','%s.%s','writeFileSync','binary','zip','zip\x20finished','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','catch','inspect','exit','path','lodash','json2xls','bluebird','zip-dir','rimraf','../../mysqldb','dbH','../../config/logger','analytics','argv','savename','update','info','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','XLSX','find','split','splitSizeXlsx','then','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','sequelize','QueryTypes','SELECT','num','Empty','length','isInteger','forEach','push','format','%s\x20limit\x20%d\x20OFFSET\x20%d','dirname','.xlsx','join','mkdirSync'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x77b5,0x107));var _0x577b=function(_0x197ed8,_0x11c538){_0x197ed8=_0x197ed8-0x0;var _0x3e0263=_0x77b5[_0x197ed8];return _0x3e0263;};'use strict';var util=require('util');var path=require(_0x577b('0x0'));var _=require(_0x577b('0x1'));var fs=require('fs');var json2xls=require(_0x577b('0x2'));var BPromise=require(_0x577b('0x3'));var zipdir=require(_0x577b('0x4'));var rimraf=require(_0x577b('0x5'));var db=require(_0x577b('0x6'))['db'];var dbH=require(_0x577b('0x6'))[_0x577b('0x7')];var logger=require(_0x577b('0x8'))(_0x577b('0x9'));var EXTRACTED_REPORT_ID=Number(process[_0x577b('0xa')][0x2]);var QUERY=process['argv'][0x3];var PATH=process[_0x577b('0xa')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x59b340,_0x32b301){var _0x1cee86={'status':_0x59b340};var _0x1c0401={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x32b301){_0x1cee86[_0x577b('0xb')]=_0x32b301;}return db['AnalyticExtractedReport'][_0x577b('0xc')](_0x1cee86,_0x1c0401);}function main(){var _0x505e7d=0x1388;var _0x48832f;logger[_0x577b('0xd')](util['format'](_0x577b('0xe'),EXTRACTED_REPORT_ID,_0x577b('0xf')));return db['Setting'][_0x577b('0x10')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x577b('0x11'),_0x577b('0x12')]})[_0x577b('0x13')](function(_0x3188e4){if(_0x3188e4){_0x48832f=_0x3188e4;_0x505e7d=_0x48832f[_0x577b('0x12')]||0x1388;}})['then'](function(){return dbH['sequelize'][_0x577b('0x14')](util['format'](_0x577b('0x15'),QUERY),{'type':dbH[_0x577b('0x16')][_0x577b('0x17')][_0x577b('0x18')]});})[_0x577b('0x13')](function(_0x69ecc2){if(!_0x69ecc2[0x0][_0x577b('0x19')]){return analyticExtractedReport(_0x577b('0x1a'));}var _0xb6e114=[];var _0x10d6bb=0x0;if(_0x48832f[_0x577b('0x11')]){if(_0x69ecc2&&_0x69ecc2[_0x577b('0x1b')]){var _0x7a1054=_['range'](_0x69ecc2[0x0][_0x577b('0x19')]/_0x505e7d);var _0x1902e0=Number[_0x577b('0x1c')](_0x69ecc2[0x0][_0x577b('0x19')]/_0x505e7d)?_0x69ecc2[0x0][_0x577b('0x19')]%_0x505e7d:0x0;_0x7a1054[_0x577b('0x1d')](function(_0x255910){if(_0x255910>0x0){_0x10d6bb+=_0x505e7d;}_0xb6e114[_0x577b('0x1e')](dbH[_0x577b('0x16')][_0x577b('0x14')](util[_0x577b('0x1f')](_0x577b('0x20'),QUERY,_0x505e7d,_0x10d6bb),{'type':dbH[_0x577b('0x16')][_0x577b('0x17')][_0x577b('0x18')]}));});if(_0x1902e0>0x0){_0x10d6bb+=_0x505e7d;_0xb6e114[_0x577b('0x1e')](dbH[_0x577b('0x16')][_0x577b('0x14')](util['format'](_0x577b('0x20'),QUERY,_0x1902e0,_0x10d6bb),{'type':dbH[_0x577b('0x16')][_0x577b('0x17')][_0x577b('0x18')]}));}}}else{_0xb6e114[_0x577b('0x1e')](dbH[_0x577b('0x16')][_0x577b('0x14')](QUERY,{'type':dbH[_0x577b('0x16')][_0x577b('0x17')][_0x577b('0x18')]}));}var _0xa30104=path[_0x577b('0x21')](PATH);var _0x125d04=path['basename'](PATH,_0x577b('0x22'));var _0x57f3bc=_0x48832f['split']&&_0xb6e114[_0x577b('0x1b')]>0x1;var _0xe873be=[];if(!fs['existsSync'](path[_0x577b('0x23')](_0xa30104,_0x125d04))&&_0x57f3bc){fs[_0x577b('0x24')](path[_0x577b('0x23')](_0xa30104,_0x125d04));}return BPromise[_0x577b('0x25')](_0xb6e114,function(_0xfb87c0){_0xe873be[_0x577b('0x1e')](_0xfb87c0);})[_0x577b('0x13')](function(){for(var _0x420cde=0x0;_0x420cde<_0xe873be[_0x577b('0x1b')];_0x420cde+=0x1){var _0x926776;var _0x581786=_0xe873be[_0x420cde];if(_0x57f3bc){_0x926776=path[_0x577b('0x23')](_0xa30104,_0x125d04,util['format'](_0x577b('0x26'),_0x125d04,_0x420cde,_0x577b('0x27')));}else{_0x926776=path[_0x577b('0x23')](_0xa30104,util[_0x577b('0x1f')](_0x577b('0x28'),_0x125d04,_0x577b('0x27')));}fs[_0x577b('0x29')](_0x926776,json2xls(_0x581786),_0x577b('0x2a'));}})['then'](function(){if(_0x57f3bc){return new Promise(function(_0x1d32ad){zipdir(path['join'](_0xa30104,_0x125d04),{'saveTo':path['join'](_0xa30104,util['format'](_0x577b('0x28'),_0x125d04,_0x577b('0x2b')))},function(_0xa87118,_0x55dbc5){rimraf(path[_0x577b('0x23')](_0xa30104,_0x125d04),function(){});_0x1d32ad(_0x577b('0x2c'));});});}})['then'](function(){logger['info'](util['format'](_0x577b('0x2d'),EXTRACTED_REPORT_ID,_0x577b('0xf')));return analyticExtractedReport(_0x577b('0x2e'),_0x57f3bc?util[_0x577b('0x1f')]('%s.%s',_0x125d04,_0x57f3bc?_0x577b('0x2b'):_0x577b('0x27')):null);});})[_0x577b('0x2f')](function(_0x1dfba4){logger[_0x577b('0xd')](util[_0x577b('0x1f')]('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,'XLSX'),util[_0x577b('0x30')](_0x1dfba4,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport('Failed');})['finally'](function(){process[_0x577b('0x31')](EXIT_CODE);});}main(); \ No newline at end of file diff --git a/server/components/extensions/rewrite.js b/server/components/extensions/rewrite.js index fba14e3..b2fd3f8 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 _0xaf81=['VoiceExtension','IntervalId','uniq','map','exten','CAST(priority\x20AS\x20UNSIGNED)','filter','groupBy','hasOwnProperty','priority','extensions','extension','find','push','type','Set','format','CDR(type)=%s','context','CDR(routeid)=','VoiceExtensionId','outbound','CDR(destination)=','${EXTEN:','cutdigits','${EXTEN}','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','outboundrouteid=','recordingFormat','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','length','toLowerCase','createdAt','updatedAt','interval','*,*,*,*','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','app','appType','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice','GotoIfTime',',${EXTEN},','concat','transaction','destroy','error','util','models','Interval','findAll','then','intervals'];(function(_0x26d03c,_0x2ea6f7){var _0xb7ec22=function(_0x37fc22){while(--_0x37fc22){_0x26d03c['push'](_0x26d03c['shift']());}};_0xb7ec22(++_0x2ea6f7);}(_0xaf81,0x192));var _0x1af8=function(_0x1cfa0d,_0x4391f2){_0x1cfa0d=_0x1cfa0d-0x0;var _0xe33279=_0xaf81[_0x1cfa0d];return _0xe33279;};'use strict';var _=require('lodash');var util=require(_0x1af8('0x0'));function rewrite(_0x12f5b6,_0x5a161d){var _0x3464d2=this;return _0x12f5b6[_0x1af8('0x1')][_0x1af8('0x2')][_0x1af8('0x3')]({'raw':!![]})[_0x1af8('0x4')](function(_0x287fa1){_0x3464d2[_0x1af8('0x5')]=_0x287fa1;return _0x12f5b6[_0x1af8('0x1')][_0x1af8('0x6')]['findAll']({'where':{'IntervalId':_0x5a161d[_0x1af8('0x7')]},'raw':!![]});})[_0x1af8('0x4')](function(_0x4ec4f2){return _0x12f5b6['models'][_0x1af8('0x6')]['findAll']({'where':{'exten':{'$in':_[_0x1af8('0x8')](_[_0x1af8('0x9')](_0x4ec4f2,_0x1af8('0xa')))}},'order':[{'raw':_0x1af8('0xb')}],'raw':!![]});})[_0x1af8('0x4')](function(_0x47118d){var _0x2561d7=_['filter'](_0x47118d,{'priority':'1'});var _0x4972e8=_[_0x1af8('0xc')](_0x47118d,{'isApp':0x1});var _0x542c96=_[_0x1af8('0xd')](_0x4972e8,'exten');var _0x428a24=['queue','playback'];var _0x2527ca=[];var _0x54c37c=[];for(var _0x28c1b6 in _0x542c96){if(_0x542c96[_0x1af8('0xe')](_0x28c1b6)){_0x3464d2[_0x1af8('0xf')]=0x2;_0x3464d2[_0x1af8('0x10')]=[];_0x3464d2[_0x1af8('0x11')]=_[_0x1af8('0x12')](_0x2561d7,{'exten':_0x542c96[_0x28c1b6][0x0]['exten']});_0x3464d2[_0x1af8('0x10')][_0x1af8('0x13')]({'type':_0x542c96[_0x28c1b6][0x0][_0x1af8('0x14')],'app':_0x1af8('0x15'),'appdata':util[_0x1af8('0x16')](_0x1af8('0x17'),_0x542c96[_0x28c1b6][0x0][_0x1af8('0x14')]),'context':_0x542c96[_0x28c1b6][0x0][_0x1af8('0x18')],'exten':_0x542c96[_0x28c1b6][0x0]['exten'],'priority':_0x3464d2[_0x1af8('0xf')]++,'VoiceExtensionId':_0x542c96[_0x28c1b6][0x0]['VoiceExtensionId']});if(_0x542c96[_0x28c1b6][0x0]['type']==='inbound'){_0x3464d2['extensions'][_0x1af8('0x13')]({'type':_0x542c96[_0x28c1b6][0x0][_0x1af8('0x14')],'app':_0x1af8('0x15'),'appdata':_0x1af8('0x19')+_0x542c96[_0x28c1b6][0x0][_0x1af8('0x1a')],'context':_0x542c96[_0x28c1b6][0x0]['context'],'exten':_0x542c96[_0x28c1b6][0x0][_0x1af8('0xa')],'priority':_0x3464d2['priority']++,'VoiceExtensionId':_0x542c96[_0x28c1b6][0x0][_0x1af8('0x1a')]});}else if(_0x542c96[_0x28c1b6][0x0]['type']===_0x1af8('0x1b')){if(_0x3464d2[_0x1af8('0x11')]){_0x3464d2[_0x1af8('0x10')][_0x1af8('0x13')]({'type':_0x542c96[_0x28c1b6][0x0][_0x1af8('0x14')],'app':'Set','appdata':_0x1af8('0x1c')+(_0x3464d2[_0x1af8('0x11')]['cutdigits']?_0x1af8('0x1d')+_0x3464d2[_0x1af8('0x11')][_0x1af8('0x1e')]+'}':_0x1af8('0x1f')),'context':_0x542c96[_0x28c1b6][0x0][_0x1af8('0x18')],'exten':_0x542c96[_0x28c1b6][0x0]['exten'],'priority':_0x3464d2['priority']++,'VoiceExtensionId':_0x542c96[_0x28c1b6][0x0]['VoiceExtensionId']});}_0x3464d2[_0x1af8('0x10')]['push']({'type':_0x542c96[_0x28c1b6][0x0]['type'],'app':_0x1af8('0x15'),'appdata':_0x1af8('0x19')+_0x542c96[_0x28c1b6][0x0][_0x1af8('0x1a')],'context':_0x542c96[_0x28c1b6][0x0][_0x1af8('0x18')],'exten':_0x542c96[_0x28c1b6][0x0][_0x1af8('0xa')],'priority':_0x3464d2[_0x1af8('0xf')]++,'VoiceExtensionId':_0x542c96[_0x28c1b6][0x0][_0x1af8('0x1a')]});var _0x14fd3d=_0x3464d2['priority']++;_0x3464d2[_0x1af8('0x10')]['push']({'type':_0x542c96[_0x28c1b6][0x0]['type'],'app':'ExecIf','appdata':_0x1af8('0x20')+(_0x14fd3d+0x2)+'):Goto('+(_0x14fd3d+0x1)+')','context':_0x542c96[_0x28c1b6][0x0]['context'],'exten':_0x542c96[_0x28c1b6][0x0][_0x1af8('0xa')],'priority':_0x14fd3d,'VoiceExtensionId':_0x542c96[_0x28c1b6][0x0][_0x1af8('0x1a')]});if(_0x3464d2[_0x1af8('0x11')]){_0x3464d2[_0x1af8('0x10')][_0x1af8('0x13')]({'type':_0x542c96[_0x28c1b6][0x0][_0x1af8('0x14')],'app':'Set','appdata':_0x3464d2[_0x1af8('0x11')][_0x1af8('0x1e')]?_0x1af8('0x21')+_0x3464d2[_0x1af8('0x11')][_0x1af8('0x1e')]+'}':_0x1af8('0x22'),'context':_0x542c96[_0x28c1b6][0x0]['context'],'exten':_0x542c96[_0x28c1b6][0x0][_0x1af8('0xa')],'priority':_0x3464d2[_0x1af8('0xf')]++,'VoiceExtensionId':_0x542c96[_0x28c1b6][0x0][_0x1af8('0x1a')]});}_0x3464d2[_0x1af8('0x10')][_0x1af8('0x13')]({'type':_0x542c96[_0x28c1b6][0x0][_0x1af8('0x14')],'app':_0x1af8('0x15'),'appdata':_0x1af8('0x23')+_0x542c96[_0x28c1b6][0x0][_0x1af8('0x1a')],'context':_0x542c96[_0x28c1b6][0x0][_0x1af8('0x18')],'exten':_0x542c96[_0x28c1b6][0x0][_0x1af8('0xa')],'priority':_0x3464d2['priority']++,'VoiceExtensionId':_0x542c96[_0x28c1b6][0x0][_0x1af8('0x1a')]});if(_0x3464d2[_0x1af8('0x11')]&&_0x3464d2[_0x1af8('0x11')][_0x1af8('0xe')](_0x1af8('0x24'))&&_0x3464d2[_0x1af8('0x11')][_0x1af8('0x24')]!=='none'){_0x3464d2[_0x1af8('0x10')][_0x1af8('0x13')]({'type':_0x542c96[_0x28c1b6][0x0]['type'],'app':'Set','appdata':_0x1af8('0x25'),'context':_0x542c96[_0x28c1b6][0x0][_0x1af8('0x18')],'exten':_0x542c96[_0x28c1b6][0x0][_0x1af8('0xa')],'priority':_0x3464d2[_0x1af8('0xf')]++,'VoiceExtensionId':_0x542c96[_0x28c1b6][0x0][_0x1af8('0x1a')]});_0x3464d2['extensions'][_0x1af8('0x13')]({'type':_0x542c96[_0x28c1b6][0x0][_0x1af8('0x14')],'app':_0x1af8('0x15'),'appdata':_0x1af8('0x26')+_0x3464d2['extension'][_0x1af8('0x24')]||'wav','context':_0x542c96[_0x28c1b6][0x0][_0x1af8('0x18')],'exten':_0x542c96[_0x28c1b6][0x0][_0x1af8('0xa')],'priority':_0x3464d2[_0x1af8('0xf')]++,'VoiceExtensionId':_0x542c96[_0x28c1b6][0x0]['VoiceExtensionId']});}}_0x3464d2[_0x1af8('0x10')][_0x1af8('0x13')]({'type':_0x542c96[_0x28c1b6][0x0][_0x1af8('0x14')],'app':'Set','appdata':_0x1af8('0x27'),'context':_0x542c96[_0x28c1b6][0x0]['context'],'exten':_0x542c96[_0x28c1b6][0x0][_0x1af8('0xa')],'priority':_0x3464d2[_0x1af8('0xf')]++,'VoiceExtensionId':_0x542c96[_0x28c1b6][0x0][_0x1af8('0x1a')]});_0x3464d2['extensions'][_0x1af8('0x13')]({'type':_0x542c96[_0x28c1b6][0x0][_0x1af8('0x14')],'app':'Set','appdata':_0x1af8('0x28'),'context':_0x542c96[_0x28c1b6][0x0][_0x1af8('0x18')],'exten':_0x542c96[_0x28c1b6][0x0][_0x1af8('0xa')],'priority':_0x3464d2[_0x1af8('0xf')]++,'VoiceExtensionId':_0x542c96[_0x28c1b6][0x0][_0x1af8('0x1a')]});_0x3464d2[_0x1af8('0x10')][_0x1af8('0x13')]({'type':_0x542c96[_0x28c1b6][0x0][_0x1af8('0x14')],'app':_0x1af8('0x15'),'appdata':_0x1af8('0x29'),'context':_0x542c96[_0x28c1b6][0x0][_0x1af8('0x18')],'exten':_0x542c96[_0x28c1b6][0x0][_0x1af8('0xa')],'priority':_0x3464d2[_0x1af8('0xf')]++,'VoiceExtensionId':_0x542c96[_0x28c1b6][0x0][_0x1af8('0x1a')]});for(var _0x414350=0x0,_0xe7f44a=0x0;_0x414350<_0x542c96[_0x28c1b6][_0x1af8('0x2a')];_0x414350+=0x1,_0xe7f44a=0x0){var _0x2a3cef=_0x542c96[_0x28c1b6][_0x414350];if(_0x2a3cef[_0x1af8('0x14')]){_0x2a3cef['type']=_0x2a3cef['type'][_0x1af8('0x2b')]();}var _0x5bcd1d=[];var _0x1e37e2=[];delete _0x2a3cef['id'];delete _0x2a3cef[_0x1af8('0x2c')];delete _0x2a3cef[_0x1af8('0x2d')];var _0x32bd1e=_0x2a3cef[_0x1af8('0x2e')]!==_0x1af8('0x2f')?[_0x2a3cef[_0x1af8('0x2e')]]:_0x2a3cef[_0x1af8('0x7')]?_[_0x1af8('0x9')](_[_0x1af8('0xc')](_0x3464d2['intervals'],{'IntervalId':_0x2a3cef['IntervalId']}),_0x1af8('0x2e')):[];if(_0x2a3cef[_0x1af8('0xe')]('tag')){if(_0x2a3cef[_0x1af8('0x30')]&&_0x2a3cef[_0x1af8('0x30')]!=='--'){_0x5bcd1d[_0x1af8('0x13')]({'type':_0x2a3cef['type'],'app':_0x1af8('0x15'),'appdata':'CDR(tag)='+_0x2a3cef[_0x1af8('0x30')],'context':_0x2a3cef[_0x1af8('0x18')],'exten':_0x2a3cef['exten'],'priority':_0x32bd1e[_0x1af8('0x2a')]+_0x3464d2[_0x1af8('0xf')]+_0xe7f44a++,'VoiceExtensionId':_0x2a3cef[_0x1af8('0x1a')]});}}if(_0x2a3cef[_0x1af8('0x14')]===_0x1af8('0x1b')&&_0x2a3cef[_0x1af8('0xe')](_0x1af8('0x31'))){if(_0x2a3cef[_0x1af8('0x31')]){_0x5bcd1d[_0x1af8('0x13')]({'type':_0x2a3cef['type'],'app':_0x1af8('0x32'),'appdata':_0x1af8('0x33')+_0x2a3cef[_0x1af8('0x31')]+')','context':_0x2a3cef[_0x1af8('0x18')],'exten':_0x2a3cef[_0x1af8('0xa')],'priority':_0x32bd1e[_0x1af8('0x2a')]+_0x3464d2[_0x1af8('0xf')]+_0xe7f44a++,'VoiceExtensionId':_0x2a3cef[_0x1af8('0x1a')]});}else{_0x5bcd1d[_0x1af8('0x13')]({'type':_0x2a3cef[_0x1af8('0x14')],'app':_0x1af8('0x32'),'appdata':_0x1af8('0x34'),'context':_0x2a3cef[_0x1af8('0x18')],'exten':_0x2a3cef[_0x1af8('0xa')],'priority':_0x32bd1e[_0x1af8('0x2a')]+_0x3464d2[_0x1af8('0xf')]+_0xe7f44a++,'VoiceExtensionId':_0x2a3cef[_0x1af8('0x1a')]});}}if(_0x2a3cef['hasOwnProperty'](_0x1af8('0x35'))){if(_0x428a24[_0x1af8('0x36')](_0x2a3cef[_0x1af8('0x37')]['toLowerCase']())>=0x0&&_0x2a3cef[_0x1af8('0x38')]!=='custom'){if(_0x2a3cef[_0x1af8('0x35')]){_0x5bcd1d[_0x1af8('0x13')]({'type':_0x2a3cef[_0x1af8('0x14')],'app':_0x1af8('0x32'),'appdata':_0x1af8('0x39'),'context':_0x2a3cef[_0x1af8('0x18')],'exten':_0x2a3cef[_0x1af8('0xa')],'priority':_0x32bd1e[_0x1af8('0x2a')]+_0x3464d2['priority']+_0xe7f44a++,'VoiceExtensionId':_0x2a3cef['VoiceExtensionId']});_0x5bcd1d[_0x1af8('0x13')]({'type':_0x2a3cef[_0x1af8('0x14')],'app':_0x1af8('0x15'),'appdata':_0x1af8('0x3a'),'context':_0x2a3cef[_0x1af8('0x18')],'exten':_0x2a3cef['exten'],'priority':_0x32bd1e[_0x1af8('0x2a')]+_0x3464d2[_0x1af8('0xf')]+_0xe7f44a++,'VoiceExtensionId':_0x2a3cef[_0x1af8('0x1a')]});}else{_0x5bcd1d['push']({'type':_0x2a3cef['type'],'app':_0x1af8('0x32'),'appdata':_0x1af8('0x3b'),'context':_0x2a3cef[_0x1af8('0x18')],'exten':_0x2a3cef['exten'],'priority':_0x32bd1e['length']+_0x3464d2[_0x1af8('0xf')]+_0xe7f44a++,'VoiceExtensionId':_0x2a3cef[_0x1af8('0x1a')]});_0x5bcd1d[_0x1af8('0x13')]({'type':_0x2a3cef[_0x1af8('0x14')],'app':_0x1af8('0x15'),'appdata':_0x1af8('0x3c'),'context':_0x2a3cef[_0x1af8('0x18')],'exten':_0x2a3cef['exten'],'priority':_0x32bd1e[_0x1af8('0x2a')]+_0x3464d2[_0x1af8('0xf')]+_0xe7f44a++,'VoiceExtensionId':_0x2a3cef[_0x1af8('0x1a')]});}}}for(var _0x47ef03=0x0;_0x47ef03<_0x32bd1e['length'];_0x47ef03+=0x1){var _0x3128d6=_0x3464d2['priority']+_0x32bd1e[_0x1af8('0x2a')];var _0xdc6863=_0x47ef03===_0x32bd1e[_0x1af8('0x2a')]-0x1?_0x3464d2[_0x1af8('0xf')]+_0x5bcd1d[_0x1af8('0x2a')]+_0x1e37e2['length']+0x2:_0x3464d2['priority']+_0x47ef03+0x1;_0x5bcd1d[_0x1af8('0x3d')](_0x47ef03,0x0,{'type':_0x2a3cef[_0x1af8('0x14')],'app':_0x1af8('0x3e'),'appdata':_0x32bd1e[_0x47ef03]+'?'+_0x2a3cef[_0x1af8('0x18')]+_0x1af8('0x3f')+_0x3128d6+':'+_0x2a3cef[_0x1af8('0x18')]+_0x1af8('0x3f')+_0xdc6863,'exten':_0x2a3cef['exten'],'context':_0x2a3cef[_0x1af8('0x18')],'priority':_0x3464d2[_0x1af8('0xf')]+_0x47ef03,'VoiceExtensionId':_0x542c96[_0x28c1b6][0x0][_0x1af8('0x1a')]});}_0x2a3cef[_0x1af8('0xf')]=_0x5bcd1d[_0x1af8('0x2a')]?_['last'](_0x5bcd1d)[_0x1af8('0xf')]+0x1:_0x3464d2['priority'];_0x3464d2['priority']=(_0x1e37e2[_0x1af8('0x2a')]?_['last'](_0x1e37e2)[_0x1af8('0xf')]:_0x2a3cef[_0x1af8('0xf')])+0x1;_0x3464d2[_0x1af8('0x10')]=_[_0x1af8('0x40')](_0x3464d2[_0x1af8('0x10')],_0x5bcd1d,[_0x2a3cef],_0x1e37e2);}_0x3464d2[_0x1af8('0x10')][_0x1af8('0x13')]({'type':_0x542c96[_0x28c1b6][0x0][_0x1af8('0x14')],'app':'Hangup','exten':_0x542c96[_0x28c1b6][0x0]['exten'],'context':_0x542c96[_0x28c1b6][0x0][_0x1af8('0x18')],'priority':_0x3464d2[_0x1af8('0xf')],'VoiceExtensionId':_0x542c96[_0x28c1b6][0x0][_0x1af8('0x1a')]});_0x2527ca[_0x1af8('0x13')](_0x542c96[_0x28c1b6][0x0][_0x1af8('0x1a')]);_0x54c37c=_['concat'](_0x54c37c,_0x3464d2[_0x1af8('0x10')]);}}return _0x12f5b6[_0x1af8('0x41')](function(_0x73a9b3){return _0x12f5b6['models']['VoiceExtension'][_0x1af8('0x42')]({'where':{'VoiceExtensionId':{'$in':_0x2527ca}},'transaction':_0x73a9b3})[_0x1af8('0x4')](function(_0x1d9b73){return _0x12f5b6['models'][_0x1af8('0x6')]['bulkCreate'](_['sortBy'](_0x54c37c,_0x1af8('0xf')),{'transaction':_0x73a9b3});});});})['catch'](function(_0x5b5afa){console[_0x1af8('0x43')](_0x5b5afa);});}exports['rewrite']=rewrite; \ No newline at end of file +var _0xc9a4=['context','VoiceExtensionId','type','inbound','push','outbound','extension','CDR(destination)=','${EXTEN:','cutdigits','${EXTEN}','CDR(routeid)=','ExecIf','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','recordingFormat','none','wav','XCALLY-MOTION-ANSWER=0','MONITOR_OPTIONS=ab','length','toLowerCase','updatedAt','interval','tag','CDR(tag)=','callerID','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)=','answer','indexOf','app','appType','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice',',${EXTEN},','last','concat','Hangup','destroy','bulkCreate','error','rewrite','lodash','util','models','then','intervals','VoiceExtension','findAll','IntervalId','uniq','map','exten','CAST(priority\x20AS\x20UNSIGNED)','filter','queue','playback','hasOwnProperty','priority','extensions','find','Set','format','CDR(type)=%s'];(function(_0x8414fc,_0x4f4b62){var _0xf3fcdb=function(_0x3c0b6b){while(--_0x3c0b6b){_0x8414fc['push'](_0x8414fc['shift']());}};_0xf3fcdb(++_0x4f4b62);}(_0xc9a4,0x70));var _0x4c9a=function(_0x47f089,_0x3eeb82){_0x47f089=_0x47f089-0x0;var _0x125715=_0xc9a4[_0x47f089];return _0x125715;};'use strict';var _=require(_0x4c9a('0x0'));var util=require(_0x4c9a('0x1'));function rewrite(_0x2bcfdc,_0xa10587){var _0x2bdff7=this;return _0x2bcfdc[_0x4c9a('0x2')]['Interval']['findAll']({'raw':!![]})[_0x4c9a('0x3')](function(_0x275c38){_0x2bdff7[_0x4c9a('0x4')]=_0x275c38;return _0x2bcfdc[_0x4c9a('0x2')][_0x4c9a('0x5')][_0x4c9a('0x6')]({'where':{'IntervalId':_0xa10587[_0x4c9a('0x7')]},'raw':!![]});})['then'](function(_0x436581){return _0x2bcfdc[_0x4c9a('0x2')][_0x4c9a('0x5')][_0x4c9a('0x6')]({'where':{'exten':{'$in':_[_0x4c9a('0x8')](_[_0x4c9a('0x9')](_0x436581,_0x4c9a('0xa')))}},'order':[{'raw':_0x4c9a('0xb')}],'raw':!![]});})[_0x4c9a('0x3')](function(_0x30e8ae){var _0x525ad8=_[_0x4c9a('0xc')](_0x30e8ae,{'priority':'1'});var _0x551962=_[_0x4c9a('0xc')](_0x30e8ae,{'isApp':0x1});var _0x2839e6=_['groupBy'](_0x551962,_0x4c9a('0xa'));var _0x1f51fc=[_0x4c9a('0xd'),_0x4c9a('0xe')];var _0x2084cc=[];var _0x108901=[];for(var _0x3ea9aa in _0x2839e6){if(_0x2839e6[_0x4c9a('0xf')](_0x3ea9aa)){_0x2bdff7[_0x4c9a('0x10')]=0x2;_0x2bdff7[_0x4c9a('0x11')]=[];_0x2bdff7['extension']=_[_0x4c9a('0x12')](_0x525ad8,{'exten':_0x2839e6[_0x3ea9aa][0x0][_0x4c9a('0xa')]});_0x2bdff7[_0x4c9a('0x11')]['push']({'type':_0x2839e6[_0x3ea9aa][0x0]['type'],'app':_0x4c9a('0x13'),'appdata':util[_0x4c9a('0x14')](_0x4c9a('0x15'),_0x2839e6[_0x3ea9aa][0x0]['type']),'context':_0x2839e6[_0x3ea9aa][0x0][_0x4c9a('0x16')],'exten':_0x2839e6[_0x3ea9aa][0x0][_0x4c9a('0xa')],'priority':_0x2bdff7[_0x4c9a('0x10')]++,'VoiceExtensionId':_0x2839e6[_0x3ea9aa][0x0][_0x4c9a('0x17')]});if(_0x2839e6[_0x3ea9aa][0x0][_0x4c9a('0x18')]===_0x4c9a('0x19')){_0x2bdff7[_0x4c9a('0x11')][_0x4c9a('0x1a')]({'type':_0x2839e6[_0x3ea9aa][0x0]['type'],'app':'Set','appdata':'CDR(routeid)='+_0x2839e6[_0x3ea9aa][0x0]['VoiceExtensionId'],'context':_0x2839e6[_0x3ea9aa][0x0][_0x4c9a('0x16')],'exten':_0x2839e6[_0x3ea9aa][0x0][_0x4c9a('0xa')],'priority':_0x2bdff7[_0x4c9a('0x10')]++,'VoiceExtensionId':_0x2839e6[_0x3ea9aa][0x0][_0x4c9a('0x17')]});}else if(_0x2839e6[_0x3ea9aa][0x0][_0x4c9a('0x18')]===_0x4c9a('0x1b')){if(_0x2bdff7[_0x4c9a('0x1c')]){_0x2bdff7[_0x4c9a('0x11')][_0x4c9a('0x1a')]({'type':_0x2839e6[_0x3ea9aa][0x0]['type'],'app':_0x4c9a('0x13'),'appdata':_0x4c9a('0x1d')+(_0x2bdff7['extension']['cutdigits']?_0x4c9a('0x1e')+_0x2bdff7['extension'][_0x4c9a('0x1f')]+'}':_0x4c9a('0x20')),'context':_0x2839e6[_0x3ea9aa][0x0][_0x4c9a('0x16')],'exten':_0x2839e6[_0x3ea9aa][0x0][_0x4c9a('0xa')],'priority':_0x2bdff7['priority']++,'VoiceExtensionId':_0x2839e6[_0x3ea9aa][0x0][_0x4c9a('0x17')]});}_0x2bdff7[_0x4c9a('0x11')][_0x4c9a('0x1a')]({'type':_0x2839e6[_0x3ea9aa][0x0][_0x4c9a('0x18')],'app':_0x4c9a('0x13'),'appdata':_0x4c9a('0x21')+_0x2839e6[_0x3ea9aa][0x0][_0x4c9a('0x17')],'context':_0x2839e6[_0x3ea9aa][0x0][_0x4c9a('0x16')],'exten':_0x2839e6[_0x3ea9aa][0x0]['exten'],'priority':_0x2bdff7[_0x4c9a('0x10')]++,'VoiceExtensionId':_0x2839e6[_0x3ea9aa][0x0]['VoiceExtensionId']});var _0x3acc9a=_0x2bdff7[_0x4c9a('0x10')]++;_0x2bdff7[_0x4c9a('0x11')]['push']({'type':_0x2839e6[_0x3ea9aa][0x0][_0x4c9a('0x18')],'app':_0x4c9a('0x22'),'appdata':'$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto('+(_0x3acc9a+0x2)+'):Goto('+(_0x3acc9a+0x1)+')','context':_0x2839e6[_0x3ea9aa][0x0]['context'],'exten':_0x2839e6[_0x3ea9aa][0x0][_0x4c9a('0xa')],'priority':_0x3acc9a,'VoiceExtensionId':_0x2839e6[_0x3ea9aa][0x0]['VoiceExtensionId']});if(_0x2bdff7[_0x4c9a('0x1c')]){_0x2bdff7[_0x4c9a('0x11')][_0x4c9a('0x1a')]({'type':_0x2839e6[_0x3ea9aa][0x0]['type'],'app':_0x4c9a('0x13'),'appdata':_0x2bdff7[_0x4c9a('0x1c')][_0x4c9a('0x1f')]?_0x4c9a('0x23')+_0x2bdff7[_0x4c9a('0x1c')][_0x4c9a('0x1f')]+'}':_0x4c9a('0x24'),'context':_0x2839e6[_0x3ea9aa][0x0][_0x4c9a('0x16')],'exten':_0x2839e6[_0x3ea9aa][0x0][_0x4c9a('0xa')],'priority':_0x2bdff7[_0x4c9a('0x10')]++,'VoiceExtensionId':_0x2839e6[_0x3ea9aa][0x0]['VoiceExtensionId']});}_0x2bdff7[_0x4c9a('0x11')]['push']({'type':_0x2839e6[_0x3ea9aa][0x0][_0x4c9a('0x18')],'app':_0x4c9a('0x13'),'appdata':'outboundrouteid='+_0x2839e6[_0x3ea9aa][0x0]['VoiceExtensionId'],'context':_0x2839e6[_0x3ea9aa][0x0][_0x4c9a('0x16')],'exten':_0x2839e6[_0x3ea9aa][0x0][_0x4c9a('0xa')],'priority':_0x2bdff7[_0x4c9a('0x10')]++,'VoiceExtensionId':_0x2839e6[_0x3ea9aa][0x0][_0x4c9a('0x17')]});if(_0x2bdff7[_0x4c9a('0x1c')]&&_0x2bdff7['extension']['hasOwnProperty'](_0x4c9a('0x25'))&&_0x2bdff7[_0x4c9a('0x1c')][_0x4c9a('0x25')]!==_0x4c9a('0x26')){_0x2bdff7[_0x4c9a('0x11')][_0x4c9a('0x1a')]({'type':_0x2839e6[_0x3ea9aa][0x0]['type'],'app':_0x4c9a('0x13'),'appdata':'_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','context':_0x2839e6[_0x3ea9aa][0x0]['context'],'exten':_0x2839e6[_0x3ea9aa][0x0][_0x4c9a('0xa')],'priority':_0x2bdff7[_0x4c9a('0x10')]++,'VoiceExtensionId':_0x2839e6[_0x3ea9aa][0x0]['VoiceExtensionId']});_0x2bdff7[_0x4c9a('0x11')][_0x4c9a('0x1a')]({'type':_0x2839e6[_0x3ea9aa][0x0]['type'],'app':'Set','appdata':'_XCALLY_MIXMONITOR_FORMAT='+_0x2bdff7[_0x4c9a('0x1c')][_0x4c9a('0x25')]||_0x4c9a('0x27'),'context':_0x2839e6[_0x3ea9aa][0x0][_0x4c9a('0x16')],'exten':_0x2839e6[_0x3ea9aa][0x0]['exten'],'priority':_0x2bdff7[_0x4c9a('0x10')]++,'VoiceExtensionId':_0x2839e6[_0x3ea9aa][0x0][_0x4c9a('0x17')]});}}_0x2bdff7[_0x4c9a('0x11')][_0x4c9a('0x1a')]({'type':_0x2839e6[_0x3ea9aa][0x0]['type'],'app':_0x4c9a('0x13'),'appdata':_0x4c9a('0x28'),'context':_0x2839e6[_0x3ea9aa][0x0][_0x4c9a('0x16')],'exten':_0x2839e6[_0x3ea9aa][0x0][_0x4c9a('0xa')],'priority':_0x2bdff7[_0x4c9a('0x10')]++,'VoiceExtensionId':_0x2839e6[_0x3ea9aa][0x0][_0x4c9a('0x17')]});_0x2bdff7['extensions'][_0x4c9a('0x1a')]({'type':_0x2839e6[_0x3ea9aa][0x0]['type'],'app':_0x4c9a('0x13'),'appdata':'XCALLY-MOTION-PROGRESS=0','context':_0x2839e6[_0x3ea9aa][0x0][_0x4c9a('0x16')],'exten':_0x2839e6[_0x3ea9aa][0x0][_0x4c9a('0xa')],'priority':_0x2bdff7['priority']++,'VoiceExtensionId':_0x2839e6[_0x3ea9aa][0x0][_0x4c9a('0x17')]});_0x2bdff7[_0x4c9a('0x11')]['push']({'type':_0x2839e6[_0x3ea9aa][0x0][_0x4c9a('0x18')],'app':_0x4c9a('0x13'),'appdata':_0x4c9a('0x29'),'context':_0x2839e6[_0x3ea9aa][0x0][_0x4c9a('0x16')],'exten':_0x2839e6[_0x3ea9aa][0x0][_0x4c9a('0xa')],'priority':_0x2bdff7[_0x4c9a('0x10')]++,'VoiceExtensionId':_0x2839e6[_0x3ea9aa][0x0]['VoiceExtensionId']});for(var _0x517684=0x0,_0x2f5fd6=0x0;_0x517684<_0x2839e6[_0x3ea9aa][_0x4c9a('0x2a')];_0x517684+=0x1,_0x2f5fd6=0x0){var _0x102bfa=_0x2839e6[_0x3ea9aa][_0x517684];if(_0x102bfa[_0x4c9a('0x18')]){_0x102bfa[_0x4c9a('0x18')]=_0x102bfa[_0x4c9a('0x18')][_0x4c9a('0x2b')]();}var _0x317223=[];var _0x1ae82e=[];delete _0x102bfa['id'];delete _0x102bfa['createdAt'];delete _0x102bfa[_0x4c9a('0x2c')];var _0x2e7617=_0x102bfa[_0x4c9a('0x2d')]!=='*,*,*,*'?[_0x102bfa['interval']]:_0x102bfa['IntervalId']?_[_0x4c9a('0x9')](_['filter'](_0x2bdff7[_0x4c9a('0x4')],{'IntervalId':_0x102bfa['IntervalId']}),_0x4c9a('0x2d')):[];if(_0x102bfa['hasOwnProperty'](_0x4c9a('0x2e'))){if(_0x102bfa[_0x4c9a('0x2e')]&&_0x102bfa[_0x4c9a('0x2e')]!=='--'){_0x317223['push']({'type':_0x102bfa[_0x4c9a('0x18')],'app':_0x4c9a('0x13'),'appdata':_0x4c9a('0x2f')+_0x102bfa[_0x4c9a('0x2e')],'context':_0x102bfa[_0x4c9a('0x16')],'exten':_0x102bfa[_0x4c9a('0xa')],'priority':_0x2e7617[_0x4c9a('0x2a')]+_0x2bdff7[_0x4c9a('0x10')]+_0x2f5fd6++,'VoiceExtensionId':_0x102bfa[_0x4c9a('0x17')]});}}if(_0x102bfa[_0x4c9a('0x18')]===_0x4c9a('0x1b')&&_0x102bfa[_0x4c9a('0xf')](_0x4c9a('0x30'))){if(_0x102bfa[_0x4c9a('0x30')]){_0x317223[_0x4c9a('0x1a')]({'type':_0x102bfa[_0x4c9a('0x18')],'app':_0x4c9a('0x22'),'appdata':_0x4c9a('0x31')+_0x102bfa[_0x4c9a('0x30')]+')','context':_0x102bfa[_0x4c9a('0x16')],'exten':_0x102bfa[_0x4c9a('0xa')],'priority':_0x2e7617['length']+_0x2bdff7[_0x4c9a('0x10')]+_0x2f5fd6++,'VoiceExtensionId':_0x102bfa[_0x4c9a('0x17')]});}else{_0x317223['push']({'type':_0x102bfa[_0x4c9a('0x18')],'app':'ExecIf','appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','context':_0x102bfa['context'],'exten':_0x102bfa[_0x4c9a('0xa')],'priority':_0x2e7617[_0x4c9a('0x2a')]+_0x2bdff7[_0x4c9a('0x10')]+_0x2f5fd6++,'VoiceExtensionId':_0x102bfa['VoiceExtensionId']});}}if(_0x102bfa['hasOwnProperty'](_0x4c9a('0x32'))){if(_0x1f51fc[_0x4c9a('0x33')](_0x102bfa[_0x4c9a('0x34')][_0x4c9a('0x2b')]())>=0x0&&_0x102bfa[_0x4c9a('0x35')]!=='custom'){if(_0x102bfa[_0x4c9a('0x32')]){_0x317223['push']({'type':_0x102bfa[_0x4c9a('0x18')],'app':_0x4c9a('0x22'),'appdata':_0x4c9a('0x36'),'context':_0x102bfa[_0x4c9a('0x16')],'exten':_0x102bfa[_0x4c9a('0xa')],'priority':_0x2e7617[_0x4c9a('0x2a')]+_0x2bdff7[_0x4c9a('0x10')]+_0x2f5fd6++,'VoiceExtensionId':_0x102bfa[_0x4c9a('0x17')]});_0x317223[_0x4c9a('0x1a')]({'type':_0x102bfa[_0x4c9a('0x18')],'app':_0x4c9a('0x13'),'appdata':_0x4c9a('0x37'),'context':_0x102bfa['context'],'exten':_0x102bfa[_0x4c9a('0xa')],'priority':_0x2e7617[_0x4c9a('0x2a')]+_0x2bdff7[_0x4c9a('0x10')]+_0x2f5fd6++,'VoiceExtensionId':_0x102bfa[_0x4c9a('0x17')]});}else{_0x317223['push']({'type':_0x102bfa[_0x4c9a('0x18')],'app':_0x4c9a('0x22'),'appdata':_0x4c9a('0x38'),'context':_0x102bfa['context'],'exten':_0x102bfa['exten'],'priority':_0x2e7617[_0x4c9a('0x2a')]+_0x2bdff7[_0x4c9a('0x10')]+_0x2f5fd6++,'VoiceExtensionId':_0x102bfa['VoiceExtensionId']});_0x317223[_0x4c9a('0x1a')]({'type':_0x102bfa[_0x4c9a('0x18')],'app':_0x4c9a('0x13'),'appdata':_0x4c9a('0x39'),'context':_0x102bfa['context'],'exten':_0x102bfa[_0x4c9a('0xa')],'priority':_0x2e7617[_0x4c9a('0x2a')]+_0x2bdff7[_0x4c9a('0x10')]+_0x2f5fd6++,'VoiceExtensionId':_0x102bfa[_0x4c9a('0x17')]});}}}for(var _0x6bb884=0x0;_0x6bb884<_0x2e7617[_0x4c9a('0x2a')];_0x6bb884+=0x1){var _0x28a6e7=_0x2bdff7[_0x4c9a('0x10')]+_0x2e7617[_0x4c9a('0x2a')];var _0x236681=_0x6bb884===_0x2e7617[_0x4c9a('0x2a')]-0x1?_0x2bdff7[_0x4c9a('0x10')]+_0x317223[_0x4c9a('0x2a')]+_0x1ae82e['length']+0x2:_0x2bdff7['priority']+_0x6bb884+0x1;_0x317223[_0x4c9a('0x3a')](_0x6bb884,0x0,{'type':_0x102bfa[_0x4c9a('0x18')],'app':'GotoIfTime','appdata':_0x2e7617[_0x6bb884]+'?'+_0x102bfa['context']+_0x4c9a('0x3b')+_0x28a6e7+':'+_0x102bfa['context']+_0x4c9a('0x3b')+_0x236681,'exten':_0x102bfa[_0x4c9a('0xa')],'context':_0x102bfa['context'],'priority':_0x2bdff7[_0x4c9a('0x10')]+_0x6bb884,'VoiceExtensionId':_0x2839e6[_0x3ea9aa][0x0]['VoiceExtensionId']});}_0x102bfa[_0x4c9a('0x10')]=_0x317223[_0x4c9a('0x2a')]?_[_0x4c9a('0x3c')](_0x317223)['priority']+0x1:_0x2bdff7[_0x4c9a('0x10')];_0x2bdff7['priority']=(_0x1ae82e[_0x4c9a('0x2a')]?_[_0x4c9a('0x3c')](_0x1ae82e)['priority']:_0x102bfa['priority'])+0x1;_0x2bdff7[_0x4c9a('0x11')]=_[_0x4c9a('0x3d')](_0x2bdff7[_0x4c9a('0x11')],_0x317223,[_0x102bfa],_0x1ae82e);}_0x2bdff7[_0x4c9a('0x11')][_0x4c9a('0x1a')]({'type':_0x2839e6[_0x3ea9aa][0x0][_0x4c9a('0x18')],'app':_0x4c9a('0x3e'),'exten':_0x2839e6[_0x3ea9aa][0x0][_0x4c9a('0xa')],'context':_0x2839e6[_0x3ea9aa][0x0][_0x4c9a('0x16')],'priority':_0x2bdff7[_0x4c9a('0x10')],'VoiceExtensionId':_0x2839e6[_0x3ea9aa][0x0][_0x4c9a('0x17')]});_0x2084cc['push'](_0x2839e6[_0x3ea9aa][0x0][_0x4c9a('0x17')]);_0x108901=_[_0x4c9a('0x3d')](_0x108901,_0x2bdff7[_0x4c9a('0x11')]);}}return _0x2bcfdc['transaction'](function(_0xce66a6){return _0x2bcfdc['models'][_0x4c9a('0x5')][_0x4c9a('0x3f')]({'where':{'VoiceExtensionId':{'$in':_0x2084cc}},'transaction':_0xce66a6})['then'](function(_0x55bbf9){return _0x2bcfdc[_0x4c9a('0x2')][_0x4c9a('0x5')][_0x4c9a('0x40')](_['sortBy'](_0x108901,'priority'),{'transaction':_0xce66a6});});});})['catch'](function(_0x5f4fac){console[_0x4c9a('0x41')](_0x5f4fac);});}exports[_0x4c9a('0x42')]=rewrite; \ No newline at end of file diff --git a/server/components/import/cm/csv.js b/server/components/import/cm/csv.js index 245b907..25497de 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 _0xe191=['length','find','duplicate','Duplicate\x20Contact','push','catch','Error\x20while\x20creating\x20contact:\x20','cmContact','checkHopper','inspect','insert','into','fromQuery','ContactId','ListId','createdAt','updatedAt','select','field','NOW()','scheduledAt','toString','from','where','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','cm_hopper','cm_contacts','id\x20IN\x20?','calleridnum','\x20=\x20?','str','cm_hopper_black','dialCheckDuplicateType','Lists','then','always','sequelize','query','VoiceQueueId','VoiceQueue','findAll','outbound','CmList','get','all','Campaign','CampaignId','cmContact,\x20%s,\x20%s','generalCheckHopper','Error\x20processing\x20rows\x20block:','stringify','finally','emit','contact:csv_','resume','Unable\x20to\x20delete\x20temp\x20file:','exit','SIGINT','info','CSV\x20import\x20process\x20stopped!','CmContact','createReadStream','parse','pause','CSV\x20parsed\x20correctly!','bluebird','util','lodash','squel','papaparse','../../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','argv','undefined','null','Missing\x20filepath\x20parameter!','split','isNil','error','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','errors','map','message','hasOwnProperty','data','firstName','firstName\x20not\x20specified!','phone','birthDate','YYYY-MM-DD','isValid','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!','email','email\x20format\x20is\x20not\x20valid!'];(function(_0x293e39,_0x34315f){var _0x118450=function(_0x1efd24){while(--_0x1efd24){_0x293e39['push'](_0x293e39['shift']());}};_0x118450(++_0x34315f);}(_0xe191,0xa9));var _0x1e19=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe191[_0x3dd15e];return _0x231fd0;};'use strict';var BPromise=require(_0x1e19('0x0'));var util=require(_0x1e19('0x1'));var _=require(_0x1e19('0x2'));var fs=require('fs');var squel=require(_0x1e19('0x3'));var Papa=require(_0x1e19('0x4'));var Redis=require('ioredis');var db=require(_0x1e19('0x5'))['db'];var config=require('../../../config/environment');var logger=require('../../../config/logger')('api');config[_0x1e19('0x6')]=_[_0x1e19('0x7')](config[_0x1e19('0x6')],{'host':_0x1e19('0x8'),'port':0x18eb});var socket=require(_0x1e19('0x9'))(new Redis(config[_0x1e19('0x6')]));require('../../../api/cmContact/cmContact.socket')[_0x1e19('0xa')](socket);try{if(!process[_0x1e19('0xb')][0x2]||process[_0x1e19('0xb')][0x2]===_0x1e19('0xc')||process[_0x1e19('0xb')][0x2]===_0x1e19('0xd')){throw new Error(_0x1e19('0xe'));}var FILEPATH=process[_0x1e19('0xb')][0x2];if(!process['argv'][0x3]||process[_0x1e19('0xb')][0x3]===_0x1e19('0xc')||process['argv'][0x3]===_0x1e19('0xd')||!process[_0x1e19('0xb')][0x4]||process[_0x1e19('0xb')][0x4]===_0x1e19('0xc')||process[_0x1e19('0xb')][0x4]===_0x1e19('0xd')){throw new Error('Missing\x20binding\x20parameters!');}var FIELDS=_['zipObject'](process[_0x1e19('0xb')][0x3][_0x1e19('0xf')](','),process[_0x1e19('0xb')][0x4][_0x1e19('0xf')](','));if(!process[_0x1e19('0xb')][0x5]||process['argv'][0x5]===_0x1e19('0xc')||process['argv'][0x5]===_0x1e19('0xd')){throw new Error('Missing\x20ListId\x20parameter!');}var LISTID=process['argv'][0x5];var COMPANYID=process[_0x1e19('0xb')][0x6]&&process[_0x1e19('0xb')][0x6]!==_0x1e19('0xc')&&process[_0x1e19('0xb')][0x6]!==_0x1e19('0xd')?process[_0x1e19('0xb')][0x6]:null;var DUPLICATES=process['argv'][0x7]&&process['argv'][0x7]!=='undefined'&&process[_0x1e19('0xb')][0x7]!==_0x1e19('0xd')?process[_0x1e19('0xb')][0x7]:null;if(!process[_0x1e19('0xb')][0x8]||process[_0x1e19('0xb')][0x8]==='undefined'||process[_0x1e19('0xb')][0x8]==='null'){throw new Error('Missing\x20socket_timestamp\x20parameter!');}var SOCKET_TIMESTAMP=process[_0x1e19('0xb')][0x8];}catch(_0x374361){logger['error'](_0x374361);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(_0x43c3f0,_0x36d746,_0x543050,_0x1820c7){var _0x171c76={'message':_0x36d746};_0x171c76[_0x43c3f0]=!![];if(_0x543050){_0x171c76['contact']=_0x543050;}if(_0x1820c7){_0x171c76['index']=_0x1820c7;}return _0x171c76;}function isEmail(_0x2a6773){return/^([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22))*\x40([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d))*$/['test'](_0x2a6773);}function checkRow(_0x5c0bd3,_0x39cf51,_0x2b6095){return new BPromise(function(_0x3877dc,_0x537e65){if(_[_0x1e19('0x10')](_0x5c0bd3)){return _0x537e65(handleCheckRowError(_0x1e19('0x11'),_0x1e19('0x12'),null,_0x2b6095));}if(_0x5c0bd3[_0x1e19('0x13')]&&_0x5c0bd3[_0x1e19('0x13')]['length']){var _0x324ac1=_[_0x1e19('0x14')](_0x5c0bd3[_0x1e19('0x13')],_0x1e19('0x15'))['join'](';');return _0x537e65(handleCheckRowError(_0x1e19('0x11'),_0x324ac1,null,_0x2b6095));}var _0x55585c={};for(var _0x27c998 in FIELDS){if(FIELDS[_0x1e19('0x16')](_0x27c998)&&FIELDS[_0x27c998]){_0x55585c[_0x27c998]=_0x5c0bd3['data'][0x0][FIELDS[_0x27c998]]||_0x5c0bd3[_0x1e19('0x17')][0x0]['\ufeff'+FIELDS[_0x27c998]];}}if(!_0x55585c[_0x1e19('0x18')]){return _0x537e65(handleCheckRowError(_0x1e19('0x11'),_0x1e19('0x19'),null,_0x2b6095));}if(!_0x55585c[_0x1e19('0x1a')]){return _0x537e65(handleCheckRowError('error','phone\x20not\x20specified!',null,_0x2b6095));}if(_0x55585c[_0x1e19('0x1b')]){var _0x501e2a=moment(_0x55585c[_0x1e19('0x1b')],_0x1e19('0x1c'));if(!_0x501e2a[_0x1e19('0x1d')]()){return _0x537e65(handleCheckRowError(_0x1e19('0x11'),_0x1e19('0x1e'),null,_0x2b6095));}}if(_0x55585c[_0x1e19('0x1f')]){if(!isEmail(_0x55585c[_0x1e19('0x1f')])){return _0x537e65(handleCheckRowError(_0x1e19('0x11'),_0x1e19('0x20'),null,_0x2b6095));}}_0x55585c['ListId']=LISTID;_0x55585c['CompanyId']=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES['length']&&_0x39cf51){var _0x5ca90f={};for(var _0x5d9efd=0x0,_0x24dce8=DUPLICATES[_0x1e19('0x21')];_0x5d9efd<_0x24dce8;_0x5d9efd+=0x1){_0x5ca90f[DUPLICATES[_0x5d9efd]]=_0x55585c[DUPLICATES[_0x5d9efd]];}var _0x270b0c=_[_0x1e19('0x22')](_0x39cf51,_0x5ca90f);if(_0x270b0c){return _0x537e65(handleCheckRowError(_0x1e19('0x23'),_0x1e19('0x24'),_0x270b0c,_0x2b6095));}}return db['CmContact']['create'](_0x55585c,{'raw':!![],'hooks':![],'fields':_['keys'](_0x55585c)})['then'](function(_0x4eed88){if(DUPLICATES&&DUPLICATES[_0x1e19('0x21')]&&_0x39cf51){_0x39cf51[_0x1e19('0x25')](_['pick'](_0x55585c,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x4eed88['id'];return _0x3877dc();})[_0x1e19('0x26')](function(_0x2347c8){return _0x537e65(handleCheckRowError(_0x1e19('0x11'),_0x1e19('0x27')+(_0x2347c8[_0x1e19('0x15')]||JSON['stringify'](_0x2347c8)),null,_0x2b6095));});});}function checkHopper(){function _0x2a3f85(){return function(_0x2cd4b3){logger[_0x1e19('0x11')](_0x1e19('0x28'),_0x1e19('0x29'),util[_0x1e19('0x2a')](_0x2cd4b3,{'showHidden':![],'depth':null}));};}var _0x147db4=function(_0x19e9c1,_0xb2c621){var _0xdadcf3=squel[_0x1e19('0x2b')]()[_0x1e19('0x2c')]('cm_hopper')[_0x1e19('0x2d')]([_0x1e19('0x1a'),'scheduledAt',_0x1e19('0x2e'),_0x1e19('0x2f'),_0xb2c621,_0x1e19('0x30'),_0x1e19('0x31')],squel[_0x1e19('0x32')]()['field'](_0x1e19('0x1a'),_0x1e19('0x1a'))[_0x1e19('0x33')](_0x1e19('0x34'),_0x1e19('0x35'))['field']('id',_0x1e19('0x2e'))['field'](LISTID[_0x1e19('0x36')](),_0x1e19('0x2f'))['field'](_0x19e9c1['id']['toString'](),_0xb2c621)['field'](_0x1e19('0x34'),_0x1e19('0x30'))[_0x1e19('0x33')]('NOW()',_0x1e19('0x31'))[_0x1e19('0x37')]('cm_contacts')[_0x1e19('0x38')](_0x1e19('0x39'))[_0x1e19('0x38')](_0x1e19('0x3a'),LISTID[_0x1e19('0x36')]())[_0x1e19('0x38')](_0x1e19('0x3b'))[_0x1e19('0x38')](_0x1e19('0x3c'),squel[_0x1e19('0x32')]()['field']('phone')[_0x1e19('0x37')](_0x1e19('0x3d'))[_0x1e19('0x38')](_0xb2c621+'\x20=\x20?',_0x19e9c1['id'][_0x1e19('0x36')]())))['toString']();return _0xdadcf3;};var _0x4e654d=function(_0x284e92,_0x169af1){var _0x502d08=squel['insert']()[_0x1e19('0x2c')](_0x1e19('0x3d'))[_0x1e19('0x2d')]([_0x1e19('0x1a'),_0x1e19('0x35'),_0x1e19('0x2e'),_0x1e19('0x2f'),_0x169af1,_0x1e19('0x30'),_0x1e19('0x31')],squel[_0x1e19('0x32')]()[_0x1e19('0x33')](_0x1e19('0x1a'),'phone')[_0x1e19('0x33')](_0x1e19('0x34'),_0x1e19('0x35'))['field']('id',_0x1e19('0x2e'))['field'](LISTID['toString'](),'ListId')[_0x1e19('0x33')](_0x284e92['id'][_0x1e19('0x36')](),_0x169af1)[_0x1e19('0x33')](_0x1e19('0x34'),'createdAt')['field'](_0x1e19('0x34'),_0x1e19('0x31'))['from'](_0x1e19('0x3e'))[_0x1e19('0x38')](_0x1e19('0x39'))[_0x1e19('0x38')](_0x1e19('0x3a'),LISTID[_0x1e19('0x36')]())['where'](_0x1e19('0x3f'),squel['str'](hopperContacts))[_0x1e19('0x38')](_0x1e19('0x3b'))[_0x1e19('0x38')]('phone\x20NOT\x20IN\x20(?)',squel['select']()[_0x1e19('0x33')](_0x1e19('0x40'))[_0x1e19('0x37')]('cm_hopper_final')['where'](_0x169af1+_0x1e19('0x41'),_0x284e92['id'][_0x1e19('0x36')]()))['where'](_0x1e19('0x3c'),squel[_0x1e19('0x32')]()[_0x1e19('0x33')]('phone')[_0x1e19('0x37')](_0x1e19('0x3d'))[_0x1e19('0x38')](_0x169af1+_0x1e19('0x41'),_0x284e92['id'][_0x1e19('0x36')]())))[_0x1e19('0x36')]();return _0x502d08;};function _0x102ced(_0x2d54cb,_0x330efd){var _0x23b7e0=squel[_0x1e19('0x2b')]()[_0x1e19('0x2c')](_0x1e19('0x3d'))[_0x1e19('0x2d')]([_0x1e19('0x1a'),_0x1e19('0x35'),'ContactId',_0x1e19('0x2f'),_0x330efd,'createdAt',_0x1e19('0x31')],squel[_0x1e19('0x32')]()['field'](_0x1e19('0x1a'),_0x1e19('0x1a'))[_0x1e19('0x33')]('NOW()',_0x1e19('0x35'))[_0x1e19('0x33')]('id',_0x1e19('0x2e'))[_0x1e19('0x33')](LISTID['toString'](),_0x1e19('0x2f'))[_0x1e19('0x33')](_0x2d54cb['id'][_0x1e19('0x36')](),_0x330efd)[_0x1e19('0x33')]('NOW()',_0x1e19('0x30'))[_0x1e19('0x33')](_0x1e19('0x34'),_0x1e19('0x31'))[_0x1e19('0x37')]('cm_contacts')['where'](_0x1e19('0x39'))[_0x1e19('0x38')]('ListId\x20=\x20?',LISTID[_0x1e19('0x36')]())[_0x1e19('0x38')](_0x1e19('0x3f'),squel[_0x1e19('0x42')](hopperContacts))[_0x1e19('0x38')]('phone\x20IS\x20NOT\x20NULL'))[_0x1e19('0x36')]();return _0x23b7e0;}function _0x4a8ab3(_0x1173fe,_0x538640){var _0x110c1e=squel['insert']()[_0x1e19('0x2c')](_0x1e19('0x43'))['fromQuery'](['phone',_0x1e19('0x2e'),_0x1e19('0x2f'),_0x538640,_0x1e19('0x30'),_0x1e19('0x31')],squel['select']()[_0x1e19('0x33')]('phone',_0x1e19('0x1a'))[_0x1e19('0x33')]('id',_0x1e19('0x2e'))[_0x1e19('0x33')](LISTID[_0x1e19('0x36')](),_0x1e19('0x2f'))[_0x1e19('0x33')](_0x1173fe['id'][_0x1e19('0x36')](),_0x538640)['field'](_0x1e19('0x34'),_0x1e19('0x30'))[_0x1e19('0x33')]('NOW()',_0x1e19('0x31'))['from'](_0x1e19('0x3e'))[_0x1e19('0x38')](_0x1e19('0x39'))[_0x1e19('0x38')](_0x1e19('0x3a'),LISTID['toString']())['where'](_0x1e19('0x3f'),squel[_0x1e19('0x42')](hopperContacts))[_0x1e19('0x38')]('phone\x20IS\x20NOT\x20NULL'))[_0x1e19('0x36')]();return _0x110c1e;}return db['VoiceQueue']['findAll']({'where':{'type':'outbound'},'attributes':['id',_0x1e19('0x44')],'include':[{'model':db['CmList'],'as':_0x1e19('0x45'),'where':{'id':LISTID}}]})[_0x1e19('0x46')](function(_0x3c7cd1){var _0x17966b=[];if(_0x3c7cd1){var _0x157104;for(var _0x43fc41=0x0,_0x299c75;_0x43fc41<_0x3c7cd1[_0x1e19('0x21')];_0x43fc41+=0x1){_0x299c75=_0x3c7cd1[_0x43fc41]['get']({'plain':!![]});switch(_0x299c75['dialCheckDuplicateType']){case _0x1e19('0x47'):_0x17966b[_0x1e19('0x25')](db[_0x1e19('0x48')][_0x1e19('0x49')](_0x4e654d(_0x299c75,_0x1e19('0x4a')))[_0x1e19('0x46')](function(){})[_0x1e19('0x26')](_0x2a3f85()));break;case'onlyIfOpen':_0x17966b[_0x1e19('0x25')](db['sequelize'][_0x1e19('0x49')](_0x147db4(_0x299c75,_0x1e19('0x4a')))[_0x1e19('0x46')](function(){})[_0x1e19('0x26')](_0x2a3f85()));break;default:_0x17966b[_0x1e19('0x25')](db['sequelize'][_0x1e19('0x49')](_0x102ced(_0x299c75,_0x1e19('0x4a')))[_0x1e19('0x46')](function(){})[_0x1e19('0x26')](_0x2a3f85()));}}}return _0x17966b;})['all']()[_0x1e19('0x46')](function(){return db[_0x1e19('0x4b')][_0x1e19('0x4c')]({'where':{'type':_0x1e19('0x4d')},'attributes':['id'],'include':[{'model':db[_0x1e19('0x4e')],'as':'BlackLists','where':{'id':LISTID}}]})['then'](function(_0x5dc159){var _0x13f858=[];if(_0x5dc159){var _0x4c9343;for(var _0x249c70=0x0,_0xffe6cd;_0x249c70<_0x5dc159['length'];_0x249c70+=0x1){_0xffe6cd=_0x5dc159[_0x249c70][_0x1e19('0x4f')]({'plain':!![]});_0x13f858[_0x1e19('0x25')](db[_0x1e19('0x48')][_0x1e19('0x49')](_0x4a8ab3(_0xffe6cd,_0x1e19('0x4a')))['then'](function(){})[_0x1e19('0x26')](_0x2a3f85()));}}return _0x13f858;})[_0x1e19('0x50')]();})['then'](function(){return db[_0x1e19('0x51')][_0x1e19('0x4c')]({'attributes':['id',_0x1e19('0x44')],'include':[{'model':db[_0x1e19('0x4e')],'as':_0x1e19('0x45'),'where':{'id':LISTID}}]})[_0x1e19('0x46')](function(_0x4ded40){var _0x8853cd=[];if(_0x4ded40){for(var _0x527a20=0x0,_0x480727;_0x527a20<_0x4ded40[_0x1e19('0x21')];_0x527a20+=0x1){_0x480727=_0x4ded40[_0x527a20][_0x1e19('0x4f')]({'plain':!![]});switch(_0x480727[_0x1e19('0x44')]){case _0x1e19('0x47'):_0x8853cd['push'](db[_0x1e19('0x48')][_0x1e19('0x49')](_0x4e654d(_0x480727,_0x1e19('0x52')))[_0x1e19('0x46')](function(){})[_0x1e19('0x26')](_0x2a3f85()));break;case'onlyIfOpen':_0x8853cd[_0x1e19('0x25')](db[_0x1e19('0x48')][_0x1e19('0x49')](_0x147db4(_0x480727,_0x1e19('0x52')))['then'](function(){})[_0x1e19('0x26')](_0x2a3f85()));break;default:_0x8853cd[_0x1e19('0x25')](db['sequelize'][_0x1e19('0x49')](_0x102ced(_0x480727,'CampaignId'))[_0x1e19('0x46')](function(){})['catch'](_0x2a3f85()));}}}return _0x8853cd;})['all']();})[_0x1e19('0x46')](function(){return db[_0x1e19('0x51')][_0x1e19('0x4c')]({'attributes':['id'],'include':[{'model':db[_0x1e19('0x4e')],'as':'BlackLists','where':{'id':LISTID}}]})[_0x1e19('0x46')](function(_0x1731cb){var _0x182eff=[];if(_0x1731cb){for(var _0x17f7d0=0x0,_0x5e2ab1;_0x17f7d0<_0x1731cb[_0x1e19('0x21')];_0x17f7d0+=0x1){_0x5e2ab1=_0x1731cb[_0x17f7d0]['get']({'plain':!![]});_0x182eff[_0x1e19('0x25')](db[_0x1e19('0x48')][_0x1e19('0x49')](_0x4a8ab3(_0x5e2ab1,'CampaignId'))[_0x1e19('0x46')](function(){})[_0x1e19('0x26')](_0x2a3f85()));}}return _0x182eff;})[_0x1e19('0x50')]();})[_0x1e19('0x26')](function(_0x29760f){logger[_0x1e19('0x11')](_0x1e19('0x53'),_0x1e19('0x54'),_0x29760f[_0x1e19('0x15')]);});}var processPromises=function(_0x2ca022){return BPromise[_0x1e19('0x50')](promises)[_0x1e19('0x46')](function(_0x1580fb){})['catch'](function(_0x3410bf){logger[_0x1e19('0x11')](_0x1e19('0x55'),JSON[_0x1e19('0x56')](_0x3410bf));})[_0x1e19('0x57')](function(){socket[_0x1e19('0x58')](_0x1e19('0x59')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x2ca022){return _0x2ca022[_0x1e19('0x5a')]();}});};var endCsv=function(){return BPromise['resolve']()['then'](function(){if(hopperContacts){return checkHopper();}})['then'](function(){socket[_0x1e19('0x58')]('contact:csv_'+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs['unlinkSync'](FILEPATH);}catch(_0x3ffc40){logger['error'](_0x1e19('0x5b'),JSON['stringify'](_0x3ffc40));}finally{process[_0x1e19('0x5c')](0x0);}});};process['on'](_0x1e19('0x5d'),function(){logger[_0x1e19('0x5e')](_0x1e19('0x5f'));endCsv();});function main(){return BPromise['resolve']()[_0x1e19('0x46')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES['split'](',');return db[_0x1e19('0x60')]['findAll']({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0x1e19('0x46')](function(_0x5d2f00){var _0x2d7e81=fs[_0x1e19('0x61')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0x1e19('0x62')](_0x2d7e81,{'header':!![],'skipEmptyLines':!![],'step':function(_0x28d1a7,_0x542b0d){total+=0x1;var _0x51c810=total;promises['push'](checkRow(_0x28d1a7,_0x5d2f00,_0x51c810)[_0x1e19('0x46')](function(){success+=0x1;})['catch'](function(_0x1f4d8b){if(_0x1f4d8b['error']){errors+=0x1;delete _0x1f4d8b[_0x1e19('0x11')];}else if(_0x1f4d8b[_0x1e19('0x23')]){duplicates+=0x1;delete _0x1f4d8b[_0x1e19('0x23')];}rows[_0x1e19('0x25')](_0x1f4d8b);}));if(total%0xc8===0x0){_0x542b0d[_0x1e19('0x63')]();return processPromises(_0x542b0d);}},'complete':function(){return processPromises()['then'](function(){logger[_0x1e19('0x5e')](_0x1e19('0x64'));endCsv();});},'error':function(_0x1333cf,_0x358b20){logger['info']('CSV\x20parse\x20error',JSON['stringify'](_0x1333cf));endCsv();}});})[_0x1e19('0x26')](function(_0x2e391e){logger[_0x1e19('0x11')]('Error\x20executing\x20contact\x20csv\x20import:',JSON[_0x1e19('0x56')](_0x2e391e));});}main(); \ No newline at end of file +var _0xccb1=['field','NOW()','ContactId','toString','from','cm_contacts','where','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','select','\x20=\x20?','scheduledAt','updatedAt','id\x20IN\x20?','str','calleridnum','insert','VoiceQueue','findAll','CmList','Lists','then','get','dialCheckDuplicateType','query','VoiceQueueId','sequelize','outbound','BlackLists','all','always','onlyIfOpen','CampaignId','Campaign','cmContact,\x20%s,\x20%s','generalCheckHopper','Error\x20processing\x20rows\x20block:','finally','emit','resume','resolve','contact:csv_','unlinkSync','Unable\x20to\x20delete\x20temp\x20file:','exit','info','parse','CSV\x20parse\x20error','Error\x20executing\x20contact\x20csv\x20import:','bluebird','util','lodash','squel','papaparse','../../../mysqldb','../../../config/environment','../../../config/logger','api','redis','localhost','socket.io-emitter','../../../api/cmContact/cmContact.socket','register','undefined','argv','Missing\x20filepath\x20parameter!','null','Missing\x20binding\x20parameters!','zipObject','split','Missing\x20ListId\x20parameter!','Missing\x20socket_timestamp\x20parameter!','error','contact','index','test','isNil','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','errors','map','message','join','hasOwnProperty','data','firstName','firstName\x20not\x20specified!','phone','birthDate','YYYY-MM-DD','isValid','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!','email','email\x20format\x20is\x20not\x20valid!','ListId','CompanyId','length','find','duplicate','Duplicate\x20Contact','CmContact','create','keys','push','pick','catch','Error\x20while\x20creating\x20contact:\x20','stringify','checkHopper','into','cm_hopper','fromQuery','createdAt'];(function(_0x51bcff,_0x177aa7){var _0x43a2b8=function(_0x3de5e2){while(--_0x3de5e2){_0x51bcff['push'](_0x51bcff['shift']());}};_0x43a2b8(++_0x177aa7);}(_0xccb1,0x189));var _0x1ccb=function(_0xf50820,_0x56f041){_0xf50820=_0xf50820-0x0;var _0x2a9b10=_0xccb1[_0xf50820];return _0x2a9b10;};'use strict';var BPromise=require(_0x1ccb('0x0'));var util=require(_0x1ccb('0x1'));var _=require(_0x1ccb('0x2'));var fs=require('fs');var squel=require(_0x1ccb('0x3'));var Papa=require(_0x1ccb('0x4'));var Redis=require('ioredis');var db=require(_0x1ccb('0x5'))['db'];var config=require(_0x1ccb('0x6'));var logger=require(_0x1ccb('0x7'))(_0x1ccb('0x8'));config['redis']=_['defaults'](config[_0x1ccb('0x9')],{'host':_0x1ccb('0xa'),'port':0x18eb});var socket=require(_0x1ccb('0xb'))(new Redis(config[_0x1ccb('0x9')]));require(_0x1ccb('0xc'))[_0x1ccb('0xd')](socket);try{if(!process['argv'][0x2]||process['argv'][0x2]===_0x1ccb('0xe')||process[_0x1ccb('0xf')][0x2]==='null'){throw new Error(_0x1ccb('0x10'));}var FILEPATH=process[_0x1ccb('0xf')][0x2];if(!process[_0x1ccb('0xf')][0x3]||process[_0x1ccb('0xf')][0x3]===_0x1ccb('0xe')||process[_0x1ccb('0xf')][0x3]===_0x1ccb('0x11')||!process[_0x1ccb('0xf')][0x4]||process[_0x1ccb('0xf')][0x4]==='undefined'||process['argv'][0x4]===_0x1ccb('0x11')){throw new Error(_0x1ccb('0x12'));}var FIELDS=_[_0x1ccb('0x13')](process[_0x1ccb('0xf')][0x3][_0x1ccb('0x14')](','),process['argv'][0x4][_0x1ccb('0x14')](','));if(!process[_0x1ccb('0xf')][0x5]||process[_0x1ccb('0xf')][0x5]==='undefined'||process[_0x1ccb('0xf')][0x5]===_0x1ccb('0x11')){throw new Error(_0x1ccb('0x15'));}var LISTID=process[_0x1ccb('0xf')][0x5];var COMPANYID=process[_0x1ccb('0xf')][0x6]&&process['argv'][0x6]!=='undefined'&&process[_0x1ccb('0xf')][0x6]!==_0x1ccb('0x11')?process[_0x1ccb('0xf')][0x6]:null;var DUPLICATES=process[_0x1ccb('0xf')][0x7]&&process['argv'][0x7]!==_0x1ccb('0xe')&&process[_0x1ccb('0xf')][0x7]!=='null'?process['argv'][0x7]:null;if(!process['argv'][0x8]||process[_0x1ccb('0xf')][0x8]==='undefined'||process[_0x1ccb('0xf')][0x8]==='null'){throw new Error(_0x1ccb('0x16'));}var SOCKET_TIMESTAMP=process[_0x1ccb('0xf')][0x8];}catch(_0x31e7ab){logger[_0x1ccb('0x17')](_0x31e7ab);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(_0x290fb3,_0x2fef0b,_0x7f63ec,_0x4f520b){var _0xf35230={'message':_0x2fef0b};_0xf35230[_0x290fb3]=!![];if(_0x7f63ec){_0xf35230[_0x1ccb('0x18')]=_0x7f63ec;}if(_0x4f520b){_0xf35230[_0x1ccb('0x19')]=_0x4f520b;}return _0xf35230;}function isEmail(_0x47fb7b){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))*$/[_0x1ccb('0x1a')](_0x47fb7b);}function checkRow(_0x2a50ac,_0x52b74c,_0x1214b9){return new BPromise(function(_0x5ba436,_0x3a5cf3){if(_[_0x1ccb('0x1b')](_0x2a50ac)){return _0x3a5cf3(handleCheckRowError(_0x1ccb('0x17'),_0x1ccb('0x1c'),null,_0x1214b9));}if(_0x2a50ac[_0x1ccb('0x1d')]&&_0x2a50ac['errors']['length']){var _0x352e48=_[_0x1ccb('0x1e')](_0x2a50ac[_0x1ccb('0x1d')],_0x1ccb('0x1f'))[_0x1ccb('0x20')](';');return _0x3a5cf3(handleCheckRowError('error',_0x352e48,null,_0x1214b9));}var _0x39f4b5={};for(var _0x40e1d0 in FIELDS){if(FIELDS[_0x1ccb('0x21')](_0x40e1d0)&&FIELDS[_0x40e1d0]){_0x39f4b5[_0x40e1d0]=_0x2a50ac[_0x1ccb('0x22')][0x0][FIELDS[_0x40e1d0]]||_0x2a50ac[_0x1ccb('0x22')][0x0]['\ufeff'+FIELDS[_0x40e1d0]];}}if(!_0x39f4b5[_0x1ccb('0x23')]){return _0x3a5cf3(handleCheckRowError(_0x1ccb('0x17'),_0x1ccb('0x24'),null,_0x1214b9));}if(!_0x39f4b5[_0x1ccb('0x25')]){return _0x3a5cf3(handleCheckRowError(_0x1ccb('0x17'),'phone\x20not\x20specified!',null,_0x1214b9));}if(_0x39f4b5[_0x1ccb('0x26')]){var _0x4a209f=moment(_0x39f4b5['birthDate'],_0x1ccb('0x27'));if(!_0x4a209f[_0x1ccb('0x28')]()){return _0x3a5cf3(handleCheckRowError('error',_0x1ccb('0x29'),null,_0x1214b9));}}if(_0x39f4b5[_0x1ccb('0x2a')]){if(!isEmail(_0x39f4b5[_0x1ccb('0x2a')])){return _0x3a5cf3(handleCheckRowError(_0x1ccb('0x17'),_0x1ccb('0x2b'),null,_0x1214b9));}}_0x39f4b5[_0x1ccb('0x2c')]=LISTID;_0x39f4b5[_0x1ccb('0x2d')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0x1ccb('0x2e')]&&_0x52b74c){var _0x16ad8e={};for(var _0xa6b990=0x0,_0x19e277=DUPLICATES[_0x1ccb('0x2e')];_0xa6b990<_0x19e277;_0xa6b990+=0x1){_0x16ad8e[DUPLICATES[_0xa6b990]]=_0x39f4b5[DUPLICATES[_0xa6b990]];}var _0x2f5426=_[_0x1ccb('0x2f')](_0x52b74c,_0x16ad8e);if(_0x2f5426){return _0x3a5cf3(handleCheckRowError(_0x1ccb('0x30'),_0x1ccb('0x31'),_0x2f5426,_0x1214b9));}}return db[_0x1ccb('0x32')][_0x1ccb('0x33')](_0x39f4b5,{'raw':!![],'hooks':![],'fields':_[_0x1ccb('0x34')](_0x39f4b5)})['then'](function(_0x5a6faf){if(DUPLICATES&&DUPLICATES[_0x1ccb('0x2e')]&&_0x52b74c){_0x52b74c[_0x1ccb('0x35')](_[_0x1ccb('0x36')](_0x39f4b5,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x5a6faf['id'];return _0x5ba436();})[_0x1ccb('0x37')](function(_0x196585){return _0x3a5cf3(handleCheckRowError(_0x1ccb('0x17'),_0x1ccb('0x38')+(_0x196585[_0x1ccb('0x1f')]||JSON[_0x1ccb('0x39')](_0x196585)),null,_0x1214b9));});});}function checkHopper(){function _0x3cc610(){return function(_0x251309){logger[_0x1ccb('0x17')]('cmContact',_0x1ccb('0x3a'),util['inspect'](_0x251309,{'showHidden':![],'depth':null}));};}var _0x471580=function(_0x13fa5f,_0x36b524){var _0x3826e6=squel['insert']()[_0x1ccb('0x3b')](_0x1ccb('0x3c'))[_0x1ccb('0x3d')](['phone','scheduledAt','ContactId',_0x1ccb('0x2c'),_0x36b524,_0x1ccb('0x3e'),'updatedAt'],squel['select']()[_0x1ccb('0x3f')](_0x1ccb('0x25'),_0x1ccb('0x25'))[_0x1ccb('0x3f')](_0x1ccb('0x40'),'scheduledAt')[_0x1ccb('0x3f')]('id',_0x1ccb('0x41'))[_0x1ccb('0x3f')](LISTID[_0x1ccb('0x42')](),_0x1ccb('0x2c'))[_0x1ccb('0x3f')](_0x13fa5f['id'][_0x1ccb('0x42')](),_0x36b524)[_0x1ccb('0x3f')](_0x1ccb('0x40'),_0x1ccb('0x3e'))[_0x1ccb('0x3f')]('NOW()','updatedAt')[_0x1ccb('0x43')](_0x1ccb('0x44'))[_0x1ccb('0x45')](_0x1ccb('0x46'))[_0x1ccb('0x45')](_0x1ccb('0x47'),LISTID[_0x1ccb('0x42')]())['where'](_0x1ccb('0x48'))[_0x1ccb('0x45')](_0x1ccb('0x49'),squel[_0x1ccb('0x4a')]()[_0x1ccb('0x3f')]('phone')[_0x1ccb('0x43')](_0x1ccb('0x3c'))[_0x1ccb('0x45')](_0x36b524+_0x1ccb('0x4b'),_0x13fa5f['id'][_0x1ccb('0x42')]())))[_0x1ccb('0x42')]();return _0x3826e6;};var _0x372b79=function(_0x52b1ac,_0x2ecbf6){var _0x23bf61=squel['insert']()[_0x1ccb('0x3b')](_0x1ccb('0x3c'))[_0x1ccb('0x3d')]([_0x1ccb('0x25'),_0x1ccb('0x4c'),_0x1ccb('0x41'),'ListId',_0x2ecbf6,_0x1ccb('0x3e'),_0x1ccb('0x4d')],squel[_0x1ccb('0x4a')]()[_0x1ccb('0x3f')](_0x1ccb('0x25'),_0x1ccb('0x25'))['field'](_0x1ccb('0x40'),'scheduledAt')[_0x1ccb('0x3f')]('id',_0x1ccb('0x41'))[_0x1ccb('0x3f')](LISTID[_0x1ccb('0x42')](),'ListId')[_0x1ccb('0x3f')](_0x52b1ac['id'][_0x1ccb('0x42')](),_0x2ecbf6)[_0x1ccb('0x3f')]('NOW()',_0x1ccb('0x3e'))[_0x1ccb('0x3f')](_0x1ccb('0x40'),_0x1ccb('0x4d'))[_0x1ccb('0x43')]('cm_contacts')[_0x1ccb('0x45')]('deletedAt\x20IS\x20NULL')['where'](_0x1ccb('0x47'),LISTID['toString']())['where'](_0x1ccb('0x4e'),squel[_0x1ccb('0x4f')](hopperContacts))['where'](_0x1ccb('0x48'))[_0x1ccb('0x45')](_0x1ccb('0x49'),squel[_0x1ccb('0x4a')]()[_0x1ccb('0x3f')](_0x1ccb('0x50'))[_0x1ccb('0x43')]('cm_hopper_final')[_0x1ccb('0x45')](_0x2ecbf6+_0x1ccb('0x4b'),_0x52b1ac['id']['toString']()))['where'](_0x1ccb('0x49'),squel[_0x1ccb('0x4a')]()[_0x1ccb('0x3f')](_0x1ccb('0x25'))['from'](_0x1ccb('0x3c'))[_0x1ccb('0x45')](_0x2ecbf6+_0x1ccb('0x4b'),_0x52b1ac['id'][_0x1ccb('0x42')]())))[_0x1ccb('0x42')]();return _0x23bf61;};function _0x13cfc0(_0x221bd6,_0x30f30e){var _0x2e0aea=squel[_0x1ccb('0x51')]()[_0x1ccb('0x3b')](_0x1ccb('0x3c'))[_0x1ccb('0x3d')]([_0x1ccb('0x25'),_0x1ccb('0x4c'),_0x1ccb('0x41'),_0x1ccb('0x2c'),_0x30f30e,_0x1ccb('0x3e'),'updatedAt'],squel[_0x1ccb('0x4a')]()[_0x1ccb('0x3f')](_0x1ccb('0x25'),'phone')['field'](_0x1ccb('0x40'),_0x1ccb('0x4c'))[_0x1ccb('0x3f')]('id',_0x1ccb('0x41'))[_0x1ccb('0x3f')](LISTID['toString'](),_0x1ccb('0x2c'))[_0x1ccb('0x3f')](_0x221bd6['id'][_0x1ccb('0x42')](),_0x30f30e)[_0x1ccb('0x3f')](_0x1ccb('0x40'),'createdAt')[_0x1ccb('0x3f')](_0x1ccb('0x40'),_0x1ccb('0x4d'))[_0x1ccb('0x43')](_0x1ccb('0x44'))['where']('deletedAt\x20IS\x20NULL')[_0x1ccb('0x45')]('ListId\x20=\x20?',LISTID[_0x1ccb('0x42')]())[_0x1ccb('0x45')]('id\x20IN\x20?',squel[_0x1ccb('0x4f')](hopperContacts))['where'](_0x1ccb('0x48')))[_0x1ccb('0x42')]();return _0x2e0aea;}function _0x53617d(_0x2531db,_0x5ad8b3){var _0x3e6522=squel[_0x1ccb('0x51')]()['into']('cm_hopper_black')[_0x1ccb('0x3d')]([_0x1ccb('0x25'),_0x1ccb('0x41'),_0x1ccb('0x2c'),_0x5ad8b3,'createdAt',_0x1ccb('0x4d')],squel[_0x1ccb('0x4a')]()['field'](_0x1ccb('0x25'),'phone')[_0x1ccb('0x3f')]('id',_0x1ccb('0x41'))[_0x1ccb('0x3f')](LISTID[_0x1ccb('0x42')](),_0x1ccb('0x2c'))[_0x1ccb('0x3f')](_0x2531db['id']['toString'](),_0x5ad8b3)['field'](_0x1ccb('0x40'),_0x1ccb('0x3e'))[_0x1ccb('0x3f')](_0x1ccb('0x40'),_0x1ccb('0x4d'))[_0x1ccb('0x43')](_0x1ccb('0x44'))[_0x1ccb('0x45')](_0x1ccb('0x46'))[_0x1ccb('0x45')](_0x1ccb('0x47'),LISTID[_0x1ccb('0x42')]())[_0x1ccb('0x45')](_0x1ccb('0x4e'),squel['str'](hopperContacts))['where']('phone\x20IS\x20NOT\x20NULL'))[_0x1ccb('0x42')]();return _0x3e6522;}return db[_0x1ccb('0x52')][_0x1ccb('0x53')]({'where':{'type':'outbound'},'attributes':['id','dialCheckDuplicateType'],'include':[{'model':db[_0x1ccb('0x54')],'as':_0x1ccb('0x55'),'where':{'id':LISTID}}]})[_0x1ccb('0x56')](function(_0x175a54){var _0x23341e=[];if(_0x175a54){var _0x2c5300;for(var _0x526a09=0x0,_0x17c931;_0x526a09<_0x175a54[_0x1ccb('0x2e')];_0x526a09+=0x1){_0x17c931=_0x175a54[_0x526a09][_0x1ccb('0x57')]({'plain':!![]});switch(_0x17c931[_0x1ccb('0x58')]){case'always':_0x23341e[_0x1ccb('0x35')](db['sequelize'][_0x1ccb('0x59')](_0x372b79(_0x17c931,_0x1ccb('0x5a')))[_0x1ccb('0x56')](function(){})[_0x1ccb('0x37')](_0x3cc610()));break;case'onlyIfOpen':_0x23341e[_0x1ccb('0x35')](db[_0x1ccb('0x5b')][_0x1ccb('0x59')](_0x471580(_0x17c931,_0x1ccb('0x5a')))[_0x1ccb('0x56')](function(){})[_0x1ccb('0x37')](_0x3cc610()));break;default:_0x23341e[_0x1ccb('0x35')](db[_0x1ccb('0x5b')][_0x1ccb('0x59')](_0x13cfc0(_0x17c931,'VoiceQueueId'))[_0x1ccb('0x56')](function(){})['catch'](_0x3cc610()));}}}return _0x23341e;})['all']()[_0x1ccb('0x56')](function(){return db[_0x1ccb('0x52')]['findAll']({'where':{'type':_0x1ccb('0x5c')},'attributes':['id'],'include':[{'model':db[_0x1ccb('0x54')],'as':_0x1ccb('0x5d'),'where':{'id':LISTID}}]})[_0x1ccb('0x56')](function(_0x40ce64){var _0x1b58f8=[];if(_0x40ce64){var _0x2ae89d;for(var _0x254061=0x0,_0x149452;_0x254061<_0x40ce64[_0x1ccb('0x2e')];_0x254061+=0x1){_0x149452=_0x40ce64[_0x254061][_0x1ccb('0x57')]({'plain':!![]});_0x1b58f8[_0x1ccb('0x35')](db['sequelize'][_0x1ccb('0x59')](_0x53617d(_0x149452,_0x1ccb('0x5a')))['then'](function(){})[_0x1ccb('0x37')](_0x3cc610()));}}return _0x1b58f8;})[_0x1ccb('0x5e')]();})[_0x1ccb('0x56')](function(){return db['Campaign'][_0x1ccb('0x53')]({'attributes':['id',_0x1ccb('0x58')],'include':[{'model':db[_0x1ccb('0x54')],'as':'Lists','where':{'id':LISTID}}]})['then'](function(_0xea3f26){var _0xdd6ff5=[];if(_0xea3f26){for(var _0x555aed=0x0,_0x2e6f49;_0x555aed<_0xea3f26[_0x1ccb('0x2e')];_0x555aed+=0x1){_0x2e6f49=_0xea3f26[_0x555aed]['get']({'plain':!![]});switch(_0x2e6f49[_0x1ccb('0x58')]){case _0x1ccb('0x5f'):_0xdd6ff5['push'](db[_0x1ccb('0x5b')][_0x1ccb('0x59')](_0x372b79(_0x2e6f49,'CampaignId'))[_0x1ccb('0x56')](function(){})[_0x1ccb('0x37')](_0x3cc610()));break;case _0x1ccb('0x60'):_0xdd6ff5[_0x1ccb('0x35')](db[_0x1ccb('0x5b')][_0x1ccb('0x59')](_0x471580(_0x2e6f49,_0x1ccb('0x61')))['then'](function(){})[_0x1ccb('0x37')](_0x3cc610()));break;default:_0xdd6ff5[_0x1ccb('0x35')](db['sequelize'][_0x1ccb('0x59')](_0x13cfc0(_0x2e6f49,'CampaignId'))[_0x1ccb('0x56')](function(){})[_0x1ccb('0x37')](_0x3cc610()));}}}return _0xdd6ff5;})[_0x1ccb('0x5e')]();})[_0x1ccb('0x56')](function(){return db[_0x1ccb('0x62')][_0x1ccb('0x53')]({'attributes':['id'],'include':[{'model':db[_0x1ccb('0x54')],'as':_0x1ccb('0x5d'),'where':{'id':LISTID}}]})[_0x1ccb('0x56')](function(_0x378a0f){var _0x2259bd=[];if(_0x378a0f){for(var _0x1cc5ef=0x0,_0x423d61;_0x1cc5ef<_0x378a0f[_0x1ccb('0x2e')];_0x1cc5ef+=0x1){_0x423d61=_0x378a0f[_0x1cc5ef][_0x1ccb('0x57')]({'plain':!![]});_0x2259bd[_0x1ccb('0x35')](db[_0x1ccb('0x5b')][_0x1ccb('0x59')](_0x53617d(_0x423d61,_0x1ccb('0x61')))[_0x1ccb('0x56')](function(){})[_0x1ccb('0x37')](_0x3cc610()));}}return _0x2259bd;})[_0x1ccb('0x5e')]();})[_0x1ccb('0x37')](function(_0xea9f7a){logger['error'](_0x1ccb('0x63'),_0x1ccb('0x64'),_0xea9f7a[_0x1ccb('0x1f')]);});}var processPromises=function(_0x4c9080){return BPromise['all'](promises)[_0x1ccb('0x56')](function(_0x5a0998){})[_0x1ccb('0x37')](function(_0x5956f3){logger['error'](_0x1ccb('0x65'),JSON[_0x1ccb('0x39')](_0x5956f3));})[_0x1ccb('0x66')](function(){socket[_0x1ccb('0x67')]('contact:csv_'+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x4c9080){return _0x4c9080[_0x1ccb('0x68')]();}});};var endCsv=function(){return BPromise[_0x1ccb('0x69')]()[_0x1ccb('0x56')](function(){if(hopperContacts){return checkHopper();}})['then'](function(){socket[_0x1ccb('0x67')](_0x1ccb('0x6a')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0x1ccb('0x6b')](FILEPATH);}catch(_0xd9059c){logger['error'](_0x1ccb('0x6c'),JSON[_0x1ccb('0x39')](_0xd9059c));}finally{process[_0x1ccb('0x6d')](0x0);}});};process['on']('SIGINT',function(){logger[_0x1ccb('0x6e')]('CSV\x20import\x20process\x20stopped!');endCsv();});function main(){return BPromise['resolve']()[_0x1ccb('0x56')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0x1ccb('0x14')](',');return db[_0x1ccb('0x32')][_0x1ccb('0x53')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0x1ccb('0x56')](function(_0x1bb08f){var _0x4bc861=fs['createReadStream'](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0x1ccb('0x6f')](_0x4bc861,{'header':!![],'skipEmptyLines':!![],'step':function(_0x1be978,_0x5945d7){total+=0x1;var _0x4fc312=total;promises[_0x1ccb('0x35')](checkRow(_0x1be978,_0x1bb08f,_0x4fc312)[_0x1ccb('0x56')](function(){success+=0x1;})['catch'](function(_0x24f0c9){if(_0x24f0c9[_0x1ccb('0x17')]){errors+=0x1;delete _0x24f0c9['error'];}else if(_0x24f0c9[_0x1ccb('0x30')]){duplicates+=0x1;delete _0x24f0c9['duplicate'];}rows[_0x1ccb('0x35')](_0x24f0c9);}));if(total%0xc8===0x0){_0x5945d7['pause']();return processPromises(_0x5945d7);}},'complete':function(){return processPromises()[_0x1ccb('0x56')](function(){logger[_0x1ccb('0x6e')]('CSV\x20parsed\x20correctly!');endCsv();});},'error':function(_0x40067e,_0x49c5e7){logger[_0x1ccb('0x6e')](_0x1ccb('0x70'),JSON[_0x1ccb('0x39')](_0x40067e));endCsv();}});})[_0x1ccb('0x37')](function(_0x60976d){logger[_0x1ccb('0x17')](_0x1ccb('0x71'),JSON['stringify'](_0x60976d));});}main(); \ No newline at end of file diff --git a/server/components/import/cm/csv2.js b/server/components/import/cm/csv2.js index 229b43f..939c915 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 _0x6ec4=['voice_queues','voice_queues_has_cm_lists','voice_queues.id\x20=\x20voice_queues_has_cm_lists.VoiceQueueId','voice_queues_has_cm_lists.CmListId=','length','dialTimezone','isNil','utcOffset','info','main','stringify','start','binding','socket_timestamp','root','server/files/tmp','.csv',',utcOffset','parse','createReadStream','data','rows','hasOwnProperty','trim','isValid','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','isNaN','isNumber','includes','agent\x20not\x20exists','email','dateOfBirth','YYYY-MM-DD','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','timezones','firstName','\x20not\x20specified','SystemRow','appendFileSync','emit','Abort\x20parser','abort','duplicates','cm_contacts_','\x20LIKE\x20cm_contacts;','campaigns_','voice_queues_','CREATE\x20TABLE\x20','(id\x20int,dialTimezone\x20varchar(255),offset\x20int);','each',',\x20scheduledAt\x20=\x20NOW()','DROP\x20TABLE\x20','VoiceQueueId','voice_queues_has_cm_blacklists','CampaignId','campaigns_has_cm_blacklists','finish','affectedRows','contact:import:','unlink','complete','argv','existsSync','phone\x20is\x20mandatory','ListId\x20is\x20mandatory','body\x20id\x20mandatory','No\x20agent\x20available','SIGINT','uncaughtException','lodash','papaparse','bluebird','moment','squel','ioredis','../../../config/environment/shared','../../../config/logger','import','redis','localhost','socket.io-emitter','format','YYYY-MM-DD\x20HH:mm:ss','test','phone','from','join','.id\x20=\x20','where','\x20=\x20','cm_contacts.phone','cm_contacts.id','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.updatedAt','cm_contacts.UserId','insert','into','cm_hopper','ContactId','ListId','createdAt','updatedAt','UserId','recallme','select','cm_contacts','cm_contacts.ListId\x20=\x20','.CmListId','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22onlyIfOpen\x22','\x22always\x22','toString','cm_hopper_black','fromQuery','field','\x20=\x20?','date_add(cm_contacts.scheduledat,interval\x20','.offset-cm_contacts.utcOffset\x20minute)','cm_contacts.priority','scheduledat','priority','fields','ListId\x20=\x20?','concat','keys','CompanyId',')\x20NOT\x20IN\x20?','deletedAt\x20IS\x20NULL','id\x20IN\x20?','MIN(id)','min_id','group','Received\x20SIGINT','message','exit','errors','push','code','sequelize','query','spread','catch','error','campaigns.id','campaigns.dialTimezone','campaigns','campaigns_has_cm_lists','campaigns.id\x20=\x20campaigns_has_cm_lists.CampaignId','campaigns_has_cm_lists.CmListId=','all','then','voice_queues.id','voice_queues.dialTimezone'];(function(_0x4efdbd,_0x123c82){var _0x44b15b=function(_0xe40e2a){while(--_0xe40e2a){_0x4efdbd['push'](_0x4efdbd['shift']());}};_0x44b15b(++_0x123c82);}(_0x6ec4,0xe1));var _0x46ec=function(_0x54ccd7,_0x3bc3ce){_0x54ccd7=_0x54ccd7-0x0;var _0x4e667b=_0x6ec4[_0x54ccd7];return _0x4e667b;};'use strict';var fs=require('fs');var path=require('path');var _=require(_0x46ec('0x0'));var Papa=require(_0x46ec('0x1'));var util=require('util');var BPromise=require(_0x46ec('0x2'));var moment=require(_0x46ec('0x3'));var squel=require(_0x46ec('0x4'));var Redis=require(_0x46ec('0x5'));var db=require('../../../mysqldb')['db'];var config=require('../../../config/environment');var shared=require(_0x46ec('0x6'));var logger=require(_0x46ec('0x7'))(_0x46ec('0x8'));config[_0x46ec('0x9')]=_['defaults'](config[_0x46ec('0x9')],{'host':_0x46ec('0xa'),'port':0x18eb});var socket=require(_0x46ec('0xb'))(new Redis(config[_0x46ec('0x9')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var stopped=![];var tmp_voice_queues;var tmp_campaigns;var tzOffset=0x0;var hasTZ;var NOW=moment()[_0x46ec('0xc')](_0x46ec('0xd'));function isEmail(_0x41a2f0){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))*$/[_0x46ec('0xe')](_0x41a2f0);}function selectNotIn(_0x1637fa,_0x1bbf7b,_0x11ec71,_0x130c0c,_0x38c16a){return squel['select']()['field'](_0x46ec('0xf'))[_0x46ec('0x10')](_0x130c0c)[_0x46ec('0x11')](_0x1bbf7b,null,_0x1bbf7b+_0x46ec('0x12')+_0x130c0c+'.'+_0x11ec71)[_0x46ec('0x13')](_0x130c0c+'.'+_0x11ec71+_0x46ec('0x14')+_0x1637fa+'.'+_0x11ec71)[_0x46ec('0x13')](_0x1bbf7b+'.dialCheckDuplicateType\x20IN\x20('+_0x38c16a[_0x46ec('0x11')]()+')');}function insertCmHopper(_0x4f3fde,_0xbceec8,_0x10faa3,_0x2684ad,_0x5dba60){var _0x3d4eea=[_0x46ec('0x15'),'cm_contacts.scheduledat',_0x46ec('0x16'),_0x46ec('0x17'),_0xbceec8+'.'+_0x2684ad,_0x46ec('0x18'),_0x46ec('0x19'),'cm_contacts.priority',_0x46ec('0x1a'),'\x22'+_0x5dba60+'\x22'];return squel[_0x46ec('0x1b')]()[_0x46ec('0x1c')](_0x46ec('0x1d'))['fromQuery']([_0x46ec('0xf'),'scheduledat',_0x46ec('0x1e'),_0x46ec('0x1f'),_0x2684ad,_0x46ec('0x20'),_0x46ec('0x21'),'priority',_0x46ec('0x22'),_0x46ec('0x23')],squel[_0x46ec('0x24')]()['fields'](_0x3d4eea)[_0x46ec('0x10')](_0xbceec8)[_0x46ec('0x11')](_0x46ec('0x25'),null,_0x46ec('0x26')+_0xbceec8+_0x46ec('0x27'))[_0x46ec('0x11')](_0x10faa3,null,_0x10faa3+'.id\x20=\x20'+_0xbceec8+'.'+_0x2684ad)[_0x46ec('0x13')](_0xbceec8+_0x46ec('0x28'),_0x4f3fde)[_0x46ec('0x13')](_0x46ec('0x29'),NOW)[_0x46ec('0x13')](_0x46ec('0x2a'),selectNotIn(_0xbceec8,_0x10faa3,_0x2684ad,_0x46ec('0x1d'),['\x22always\x22',_0x46ec('0x2b')]))[_0x46ec('0x13')](_0x46ec('0x2a'),selectNotIn(_0xbceec8,_0x10faa3,_0x2684ad,_0x46ec('0x1d'),[_0x46ec('0x2c')])))[_0x46ec('0x2d')]();}function insertCmHopperBlack(_0x40ed84,_0x405bce,_0xa4493f,_0x3a304d){var _0x1b5742=[_0x46ec('0x15'),'cm_contacts.id',_0x46ec('0x17'),_0x405bce+'.'+_0x3a304d,_0x46ec('0x18'),_0x46ec('0x19')];return squel[_0x46ec('0x1b')]()[_0x46ec('0x1c')](_0x46ec('0x2e'))[_0x46ec('0x2f')]([_0x46ec('0xf'),_0x46ec('0x1e'),_0x46ec('0x1f'),_0x3a304d,_0x46ec('0x20'),_0x46ec('0x21')],squel[_0x46ec('0x24')]()['fields'](_0x1b5742)[_0x46ec('0x10')](_0x405bce)[_0x46ec('0x11')](_0x46ec('0x25'),null,'cm_contacts.ListId\x20=\x20'+_0x405bce+_0x46ec('0x27'))[_0x46ec('0x11')](_0xa4493f,null,_0xa4493f+_0x46ec('0x12')+_0x405bce+'.'+_0x3a304d)[_0x46ec('0x13')](_0x405bce+_0x46ec('0x28'),_0x40ed84)[_0x46ec('0x13')](_0x46ec('0x29'),NOW)[_0x46ec('0x13')](_0x46ec('0x2a'),squel['select']()[_0x46ec('0x30')](_0x46ec('0xf'))[_0x46ec('0x10')](_0x46ec('0x2e'))['where']('ListId\x20=\x20?',_0x40ed84)[_0x46ec('0x13')](_0x3a304d+_0x46ec('0x31'),_0x405bce+'.'+_0x3a304d)))[_0x46ec('0x2d')]();}function insertTzCmHopper(_0x3b9d4a,_0x4241ff,_0x5984e3,_0x3ea45a,_0x151622,_0x1bb7c1){var _0x535a20=['cm_contacts.phone',_0x46ec('0x32')+_0x1bb7c1+_0x46ec('0x33'),_0x46ec('0x16'),'cm_contacts.ListId',_0x4241ff+'.'+_0x3ea45a,'cm_contacts.createdAt',_0x46ec('0x19'),_0x46ec('0x34'),_0x46ec('0x1a'),'\x22'+_0x151622+'\x22'];var _0x111694=squel[_0x46ec('0x1b')]()['into'](_0x46ec('0x1d'))[_0x46ec('0x2f')]([_0x46ec('0xf'),_0x46ec('0x35'),_0x46ec('0x1e'),_0x46ec('0x1f'),_0x3ea45a,_0x46ec('0x20'),_0x46ec('0x21'),_0x46ec('0x36'),_0x46ec('0x22'),'recallme'],squel[_0x46ec('0x24')]()[_0x46ec('0x37')](_0x535a20)[_0x46ec('0x10')](_0x4241ff)['join'](_0x46ec('0x25'),null,_0x46ec('0x26')+_0x4241ff+_0x46ec('0x27'))['join'](_0x5984e3,null,_0x5984e3+_0x46ec('0x12')+_0x4241ff+'.'+_0x3ea45a)['join'](_0x1bb7c1,null,_0x1bb7c1+_0x46ec('0x12')+_0x4241ff+'.'+_0x3ea45a)[_0x46ec('0x13')](_0x4241ff+'.CmListId\x20=\x20?',_0x3b9d4a)[_0x46ec('0x13')](_0x46ec('0x29'),NOW)['where'](_0x46ec('0x2a'),selectNotIn(_0x4241ff,_0x5984e3,_0x3ea45a,_0x46ec('0x1d'),[_0x46ec('0x2c'),'\x22onlyIfOpen\x22']))[_0x46ec('0x13')](_0x46ec('0x2a'),selectNotIn(_0x4241ff,_0x5984e3,_0x3ea45a,_0x46ec('0x1d'),['\x22always\x22'])))[_0x46ec('0x2d')]();return _0x111694;}function insertTzCmHopperBlack(_0x37c708,_0x4dacea,_0x187ef4,_0xd27145){var _0x1e12a7=[_0x46ec('0x15'),_0x46ec('0x16'),_0x46ec('0x17'),_0x4dacea+'.'+_0xd27145,_0x46ec('0x18'),_0x46ec('0x19')];return squel[_0x46ec('0x1b')]()[_0x46ec('0x1c')]('cm_hopper_black')[_0x46ec('0x2f')]([_0x46ec('0xf'),_0x46ec('0x1e'),'ListId',_0xd27145,_0x46ec('0x20'),_0x46ec('0x21')],squel[_0x46ec('0x24')]()[_0x46ec('0x37')](_0x1e12a7)[_0x46ec('0x10')](_0x4dacea)[_0x46ec('0x11')](_0x46ec('0x25'),null,_0x46ec('0x26')+_0x4dacea+_0x46ec('0x27'))['join'](_0x187ef4,null,_0x187ef4+_0x46ec('0x12')+_0x4dacea+'.'+_0xd27145)['where'](_0x4dacea+_0x46ec('0x28'),_0x37c708)['where'](_0x46ec('0x29'),NOW)[_0x46ec('0x13')](_0x46ec('0x2a'),squel['select']()[_0x46ec('0x30')](_0x46ec('0xf'))[_0x46ec('0x10')](_0x46ec('0x2e'))[_0x46ec('0x13')](_0x46ec('0x38'),_0x37c708)[_0x46ec('0x13')](_0xd27145+_0x46ec('0x31'),_0x4dacea+'.'+_0xd27145)))['toString']();}function insertCmContact(_0x18affd,_0x39c0b2,_0xe17a4b,_0x35e8cd){var _0x3b0fc=_[_0x46ec('0x39')](_[_0x46ec('0x3a')](_0x35e8cd),['ListId',_0x46ec('0x3b'),_0x46ec('0x20'),'updatedAt']);return squel[_0x46ec('0x1b')]()['into'](_0x46ec('0x25'))[_0x46ec('0x2f')](_0x3b0fc,squel[_0x46ec('0x24')]()[_0x46ec('0x37')](_0x3b0fc)['from'](_0x39c0b2)[_0x46ec('0x13')]('('+_0xe17a4b[_0x46ec('0x11')](',')+_0x46ec('0x3c'),squel['select']()[_0x46ec('0x37')](_0xe17a4b)['from'](_0x46ec('0x25'))['where'](_0x46ec('0x38'),_0x18affd)[_0x46ec('0x13')](_0x46ec('0x3d')))[_0x46ec('0x13')](_0x46ec('0x3e'),squel['select']()['field'](_0x46ec('0x3f'),_0x46ec('0x40'))[_0x46ec('0x10')](_0x39c0b2)[_0x46ec('0x41')](_0xe17a4b['join'](','))))[_0x46ec('0x2d')]();}function handleStop(){logger['info'](_0x46ec('0x42'));stopped=!![];}function handleUncaughtException(_0x51410a){logger['error'](_0x51410a[_0x46ec('0x43')]);process[_0x46ec('0x44')](0x1);}function handleError(_0x2cdb9f,_0xd931e8){stats[_0x46ec('0x45')][_0x46ec('0x46')]({'name':_0xd931e8[_0x46ec('0x47')],'message':_0xd931e8[_0x46ec('0x43')],'row':_0x2cdb9f});}function handleQuery(_0x504263){logger['info'](_0x504263);return db[_0x46ec('0x48')][_0x46ec('0x49')](_0x504263)[_0x46ec('0x4a')](function(_0x2f7619){results['push'](_0x2f7619);})[_0x46ec('0x4b')](function(_0xc905a0){logger[_0x46ec('0x4c')](_0xc905a0[_0x46ec('0x43')]);});}function updateTzCampaigns(_0x4a8796){return new Promise(function(_0x4612ff,_0x5723b1){var _0x36bef0=squel['select']()[_0x46ec('0x37')]([_0x46ec('0x4d'),_0x46ec('0x4e')])[_0x46ec('0x10')](_0x46ec('0x4f'))[_0x46ec('0x11')](_0x46ec('0x50'),null,_0x46ec('0x51'))[_0x46ec('0x13')](_0x46ec('0x52')+_0x4a8796);db[_0x46ec('0x48')][_0x46ec('0x49')](_0x36bef0['toString']())[_0x46ec('0x4a')](function(_0x353d44){var _0x4ba0ee=[];for(var _0x3760a7=0x0;_0x3760a7<_0x353d44['length'];_0x3760a7++){_0x4ba0ee[_0x46ec('0x46')](getTimezoneData(_0x353d44[_0x3760a7],tmp_campaigns));}BPromise[_0x46ec('0x53')](_0x4ba0ee)[_0x46ec('0x54')](function(){_0x4612ff({'val':0x1});});})[_0x46ec('0x4b')](function(_0x2f3ac3){logger[_0x46ec('0x4c')](_0x2f3ac3['message']);_0x4612ff({'val':0x0});});});}function updateTzVoiceQueues(_0x145e93){return new Promise(function(_0x1af8fb,_0x23c07a){var _0x14171a=squel[_0x46ec('0x24')]()[_0x46ec('0x37')]([_0x46ec('0x55'),_0x46ec('0x56')])[_0x46ec('0x10')](_0x46ec('0x57'))[_0x46ec('0x11')](_0x46ec('0x58'),null,_0x46ec('0x59'))['where'](_0x46ec('0x5a')+_0x145e93);db[_0x46ec('0x48')][_0x46ec('0x49')](_0x14171a[_0x46ec('0x2d')]())[_0x46ec('0x4a')](function(_0x346d69){var _0x43ad4c=[];for(var _0x5c1bcb=0x0;_0x5c1bcb<_0x346d69[_0x46ec('0x5b')];_0x5c1bcb++){_0x43ad4c[_0x46ec('0x46')](getTimezoneData(_0x346d69[_0x5c1bcb],tmp_voice_queues));}BPromise[_0x46ec('0x53')](_0x43ad4c)[_0x46ec('0x54')](function(){_0x1af8fb({'val':0x1});});})[_0x46ec('0x4b')](function(_0x1690d9){logger[_0x46ec('0x4c')](_0x1690d9[_0x46ec('0x43')]);_0x1af8fb({'val':0x0});});});}function getTimezoneData(_0x12299c,_0x5a7667){return new Promise(function(_0x1eb2bd,_0x3707a6){var _0x182b47=shared['timezones'];var _0x150cc6=_0x182b47[_0x12299c[_0x46ec('0x5c')]];if(_[_0x46ec('0x5d')](_0x150cc6)){_0x1eb2bd({'ret':0x1});}else{var _0x4b802f=_0x150cc6[_0x46ec('0x5e')];var _0xb5edb4=squel['insert']()[_0x46ec('0x1c')](_0x5a7667)['set']('id',_0x12299c['id'])['set']('offset',_0x4b802f)['set'](_0x46ec('0x5c'),_0x12299c['dialTimezone'])[_0x46ec('0x2d')]();return db[_0x46ec('0x48')]['query'](_0xb5edb4)[_0x46ec('0x4a')](function(_0x252475){_0x1eb2bd({'ret':0x1});})[_0x46ec('0x4b')](function(_0x31e518){logger[_0x46ec('0x4c')](_0x31e518[_0x46ec('0x43')]);_0x3707a6({'ret':0x1});});}});}function handleTZQuery(_0x5f3e57){logger[_0x46ec('0x5f')](_0x5f3e57);return db[_0x46ec('0x48')][_0x46ec('0x49')](_0x5f3e57)[_0x46ec('0x4a')](function(_0x1ced2e){})['catch'](function(_0x226cbd){logger[_0x46ec('0x4c')](_0x226cbd[_0x46ec('0x43')]);});}function main(_0x20ea08,_0xb62b3b,_0x2beb77,_0x2e7d68){logger[_0x46ec('0x5f')](_0x46ec('0x60'),_0x20ea08,JSON[_0x46ec('0x61')](_0xb62b3b));process['send'](_0x46ec('0x62'));var _0xc4a4ae=_0xb62b3b[_0x46ec('0x63')];var _0x1d048c=_0xb62b3b[_0x46ec('0x64')];var _0x15155a=path[_0x46ec('0x11')](config[_0x46ec('0x65')],_0x46ec('0x66'),_0x1d048c+_0x46ec('0x67'));hasTZ=_[_0x46ec('0x3a')](_0xc4a4ae)['includes'](_0x46ec('0x5c'));var _0x128efe=_[_0x46ec('0x3a')](_0xc4a4ae)[_0x46ec('0x11')]();logger[_0x46ec('0x5f')]('header',_0x128efe);if(hasTZ)_0x128efe+=_0x46ec('0x68');fs['writeFileSync'](_0x15155a,_0x128efe+'\x0a');Papa[_0x46ec('0x69')](fs[_0x46ec('0x6a')](_0x20ea08),{'header':!![],'skipEmptyLines':!![],'step':function(_0x31b276,_0x2b7a1c){try{for(var _0x2ac7e0=0x0,_0x22ce9e=[];_0x2ac7e0<_0x31b276[_0x46ec('0x6b')]['length'];_0x2ac7e0++){stats[_0x46ec('0x6c')]+=0x1;if(_0x31b276[_0x46ec('0x45')][_0x2ac7e0]){handleError(_0x31b276[_0x46ec('0x6b')][_0x2ac7e0],_0x31b276[_0x46ec('0x45')][_0x2ac7e0]);}else{var _0x1e6b25=[];for(var _0x421d95 in _0xc4a4ae){if(_0xc4a4ae[_0x46ec('0x6d')](_0x421d95)){if(_0x31b276['data'][_0x2ac7e0][_0xc4a4ae[_0x421d95]]){var _0x3a49df=_[_0x46ec('0x6e')](_0x31b276['data'][_0x2ac7e0][_0xc4a4ae[_0x421d95]]['replace'](/"/g,'\x27'));switch(_0x421d95){case _0x46ec('0x35'):var _0x44f9f5=moment(_0x3a49df,_0x46ec('0xd'),!![]);if(_0x44f9f5[_0x46ec('0x6f')]()){_0x22ce9e[_0x46ec('0x46')]('\x22'+_0x3a49df+'\x22');}else{_0x1e6b25[_0x46ec('0x46')](_0x46ec('0x70'));}break;case _0x46ec('0x36'):var _0x3209e0=parseInt(_0x3a49df);_0x3a49df=_[_0x46ec('0x71')](_0x3209e0)||_0x3209e0<0x0||_0x3209e0>0x4?_0x2e7d68?0x3:0x2:_0x3209e0;_0x22ce9e['push']('\x22'+_0x3a49df+'\x22');break;case _0x46ec('0x22'):var _0x1c17ed=parseInt(_0x3a49df);if(_[_0x46ec('0x72')](_0x1c17ed)&&_[_0x46ec('0x73')](_0x2beb77,_0x1c17ed)){_0x22ce9e[_0x46ec('0x46')]('\x22'+_0x1c17ed+'\x22');}else{_0x1e6b25[_0x46ec('0x46')](_0x46ec('0x74'));}break;case _0x46ec('0x75'):if(isEmail(_0x3a49df)){_0x22ce9e[_0x46ec('0x46')]('\x22'+_0x3a49df+'\x22');}else{_0x1e6b25[_0x46ec('0x46')]('email\x20wrong\x20format');}break;case _0x46ec('0x76'):var _0x5d8cd1=moment(_0x3a49df,_0x46ec('0x77'),!![]);if(_0x5d8cd1[_0x46ec('0x6f')]()){_0x22ce9e[_0x46ec('0x46')]('\x22'+_0x3a49df+'\x22');}else{_0x1e6b25['push'](_0x46ec('0x78'));}break;case _0x46ec('0x5c'):var _0x3cf18a=shared[_0x46ec('0x79')];var _0x3c548a=_0x3cf18a[_0x3a49df];if(!_[_0x46ec('0x5d')](_0x3c548a)){var _0x528752=_0x3c548a[_0x46ec('0x5e')];_0x22ce9e['push']('\x22'+_0x3a49df+'\x22');_0x22ce9e['push']('\x22'+_0x528752+'\x22');}break;default:_0x22ce9e[_0x46ec('0x46')]('\x22'+_0x3a49df+'\x22');}}else{switch(_0x421d95){case _0x46ec('0x7a'):case _0x46ec('0xf'):_0x1e6b25[_0x46ec('0x46')](_0x421d95+_0x46ec('0x7b'));break;default:_0x22ce9e[_0x46ec('0x46')]('\x22\x22');}}}}if(_0x1e6b25[_0x46ec('0x5b')]){handleError(_0x31b276[_0x46ec('0x6b')][_0x2ac7e0],{'code':_0x46ec('0x7c'),'message':_0x1e6b25[_0x46ec('0x11')]()});}else{fs[_0x46ec('0x7d')](_0x15155a,_0x22ce9e[_0x46ec('0x11')]()+'\x0a');}_0x22ce9e=[];}if(!(stats[_0x46ec('0x6c')]%0xc8)){socket[_0x46ec('0x7e')]('contact:import:'+_0x1d048c,stats);stats[_0x46ec('0x45')]=[];}}if(stopped){logger[_0x46ec('0x5f')](_0x46ec('0x7f'));_0x2b7a1c[_0x46ec('0x80')]();}}catch(_0x1c095f){handleError(_0x31b276[_0x46ec('0x6b')][_0x2ac7e0],{'code':'SystemError','message':_0x1c095f[_0x46ec('0x43')]});logger['error']('step',_0x1c095f[_0x46ec('0x43')]);}},'complete':function(){try{var _0x2d1ea4=[];var _0x423066=[];var _0x29d61a=_0x46ec('0x25');if(_0xb62b3b[_0x46ec('0x81')]&&_0xb62b3b[_0x46ec('0x81')]['length']){_0x29d61a=_0x46ec('0x82')+_0x1d048c;_0x2d1ea4[_0x46ec('0x46')]('CREATE\x20TABLE\x20'+_0x29d61a+_0x46ec('0x83'));}tmp_campaigns=_0x46ec('0x84')+_0x1d048c;tmp_voice_queues=_0x46ec('0x85')+_0x1d048c;_0x423066['push'](_0x46ec('0x86')+tmp_campaigns+_0x46ec('0x87'));_0x423066[_0x46ec('0x46')](_0x46ec('0x86')+tmp_voice_queues+'(id\x20int,dialTimezone\x20varchar(255),offset\x20int);');BPromise[_0x46ec('0x88')](_0x423066,handleTZQuery)[_0x46ec('0x54')](function(_0x198f14){updateTzCampaigns(_0xb62b3b['ListId'])['then'](function(_0x1b575b){updateTzVoiceQueues(_0xb62b3b[_0x46ec('0x1f')])[_0x46ec('0x54')](function(_0x5d758a){var _0x127153=util[_0x46ec('0xc')]('LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20id\x20=\x20NULL,\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27',_0x15155a,_0x29d61a,_0x128efe,_0xb62b3b['ListId'],_0xb62b3b[_0x46ec('0x3b')]||null,NOW,NOW);if(_['isNil'](_0xc4a4ae['scheduledat'])){_0x127153+=_0x46ec('0x89');}_0x2d1ea4[_0x46ec('0x46')](_0x127153);if(_0xb62b3b[_0x46ec('0x81')]&&_0xb62b3b['duplicates']['length']){_0x2d1ea4[_0x46ec('0x46')](insertCmContact(_0xb62b3b[_0x46ec('0x1f')],_0x29d61a,_0xb62b3b[_0x46ec('0x81')],_0xc4a4ae));_0x2d1ea4['push'](_0x46ec('0x8a')+_0x29d61a+';');}if(hasTZ){_0x2d1ea4['push'](insertTzCmHopper(_0xb62b3b[_0x46ec('0x1f')],_0x46ec('0x58'),_0x46ec('0x57'),_0x46ec('0x8b'),_0x2e7d68,tmp_voice_queues));_0x2d1ea4[_0x46ec('0x46')](insertTzCmHopperBlack(_0xb62b3b['ListId'],_0x46ec('0x8c'),_0x46ec('0x57'),_0x46ec('0x8b')));_0x2d1ea4[_0x46ec('0x46')](insertTzCmHopper(_0xb62b3b[_0x46ec('0x1f')],_0x46ec('0x50'),'campaigns',_0x46ec('0x8d'),_0x2e7d68,tmp_campaigns));_0x2d1ea4[_0x46ec('0x46')](insertTzCmHopperBlack(_0xb62b3b[_0x46ec('0x1f')],_0x46ec('0x8e'),_0x46ec('0x4f'),_0x46ec('0x8d')));}else{_0x2d1ea4[_0x46ec('0x46')](insertCmHopper(_0xb62b3b[_0x46ec('0x1f')],'voice_queues_has_cm_lists',_0x46ec('0x57'),_0x46ec('0x8b'),_0x2e7d68));_0x2d1ea4[_0x46ec('0x46')](insertCmHopperBlack(_0xb62b3b[_0x46ec('0x1f')],'voice_queues_has_cm_blacklists',_0x46ec('0x57'),_0x46ec('0x8b')));_0x2d1ea4['push'](insertCmHopper(_0xb62b3b['ListId'],_0x46ec('0x50'),_0x46ec('0x4f'),_0x46ec('0x8d'),_0x2e7d68));_0x2d1ea4['push'](insertCmHopperBlack(_0xb62b3b[_0x46ec('0x1f')],_0x46ec('0x8e'),_0x46ec('0x4f'),_0x46ec('0x8d')));}_0x2d1ea4[_0x46ec('0x46')](_0x46ec('0x8a')+tmp_campaigns+';');_0x2d1ea4['push'](_0x46ec('0x8a')+tmp_voice_queues+';');BPromise[_0x46ec('0x88')](_0x2d1ea4,handleQuery)[_0x46ec('0x54')](function(_0x5ae27c){stats[_0x46ec('0x8f')]=!![];stats['affectedRows']=_0xb62b3b[_0x46ec('0x81')]&&_0xb62b3b[_0x46ec('0x81')][_0x46ec('0x5b')]?results[0x2][_0x46ec('0x90')]:results[0x0]['affectedRows'];socket[_0x46ec('0x7e')](_0x46ec('0x91')+_0x1d048c,stats);fs[_0x46ec('0x92')](_0x20ea08);fs['unlink'](_0x15155a);process[_0x46ec('0x44')](0x0);})[_0x46ec('0x4b')](function(_0x43bece){logger['error'](_0x43bece[_0x46ec('0x43')]);process[_0x46ec('0x44')](0x1);});});});});}catch(_0x561b6b){logger['error'](_0x46ec('0x93'),_0x561b6b['message']);process['exit'](0x1);}},'error':function(_0x3d656e,_0x16ccda,_0x452579,_0x366a13){throw new Error(_0x366a13);}});}function validate(){if(process[_0x46ec('0x94')]&&process[_0x46ec('0x94')][_0x46ec('0x5b')]<0x4){throw new Error('arguments\x20\x20\x20');}var _0x274dc2=path[_0x46ec('0x11')](config[_0x46ec('0x65')],_0x46ec('0x66'),process[_0x46ec('0x94')][0x2]);if(!fs[_0x46ec('0x95')](_0x274dc2)){throw new Error('file\x20doesn\x27t\x20exists');}var _0x125b7c={};try{_0x125b7c=JSON[_0x46ec('0x69')](process[_0x46ec('0x94')][0x3]);if(!_0x125b7c[_0x46ec('0x63')]){throw new Error('binding\x20doesn\x27t\x20exists');}if(!_0x125b7c['binding'][_0x46ec('0xf')]){throw new Error(_0x46ec('0x96'));}if(!_0x125b7c[_0x46ec('0x63')][_0x46ec('0x7a')]){throw new Error('firstName\x20is\x20mandatory');}var _0x56a4ef=0x0;if(_0x125b7c[_0x46ec('0x63')][_0x46ec('0x22')]){_0x56a4ef=0x1;}if(!_0x125b7c['ListId']){throw new Error(_0x46ec('0x97'));}}catch(_0xc20047){throw new Error(_0x46ec('0x98'));}var _0x27acc0=[];try{_0x27acc0=_['map'](JSON[_0x46ec('0x69')](process[_0x46ec('0x94')][0x4]),'id');}catch(_0x1356fe){logger['info'](_0x46ec('0x99'));}main(_0x274dc2,_0x125b7c,_0x27acc0,_0x56a4ef);}validate();process['on'](_0x46ec('0x9a'),handleStop);process['on'](_0x46ec('0x9b'),handleUncaughtException); \ No newline at end of file +var _0xbf7f=['cm_contacts.ListId\x20=\x20','.CmListId','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22always\x22','toString','cm_hopper_black','ListId\x20=\x20?','\x20=\x20?','date_add(cm_contacts.scheduledat,interval\x20','.offset-cm_contacts.utcOffset\x20minute)','ListId','UserId','\x22onlyIfOpen\x22','concat','CompanyId','id\x20IN\x20?','MIN(id)','group','info','Received\x20SIGINT','error','message','exit','errors','push','code','sequelize','query','catch','campaigns','campaigns_has_cm_lists','campaigns.id\x20=\x20campaigns_has_cm_lists.CampaignId','campaigns_has_cm_lists.CmListId=','spread','all','voice_queues.id','voice_queues','voice_queues_has_cm_lists','voice_queues.id\x20=\x20voice_queues_has_cm_lists.VoiceQueueId','voice_queues_has_cm_lists.CmListId=','then','timezones','dialTimezone','set','offset','main','stringify','send','binding','socket_timestamp','root','server/files/tmp','.csv','keys','writeFileSync','parse','createReadStream','data','length','rows','trim','replace','isValid','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','isNaN','isNumber','email','email\x20wrong\x20format','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','isNil','utcOffset','firstName','\x20not\x20specified','SystemRow','appendFileSync','emit','contact:import:','Abort\x20parser','abort','SystemError','step','duplicates','cm_contacts_','\x20LIKE\x20cm_contacts;','campaigns_','voice_queues_','(id\x20int,dialTimezone\x20varchar(255),offset\x20int);','CREATE\x20TABLE\x20','each','LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20id\x20=\x20NULL,\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27',',\x20scheduledAt\x20=\x20NOW()','DROP\x20TABLE\x20','VoiceQueueId','voice_queues_has_cm_blacklists','CampaignId','campaigns_has_cm_blacklists','finish','affectedRows','unlink','argv','arguments\x20\x20\x20','existsSync','file\x20doesn\x27t\x20exists','phone\x20is\x20mandatory','firstName\x20is\x20mandatory','ListId\x20is\x20mandatory','body\x20id\x20mandatory','map','No\x20agent\x20available','SIGINT','uncaughtException','path','lodash','papaparse','util','bluebird','moment','squel','../../../mysqldb','../../../config/environment','../../../config/environment/shared','../../../config/logger','redis','defaults','localhost','socket.io-emitter','format','YYYY-MM-DD\x20HH:mm:ss','test','select','field','from','join','.id\x20=\x20','where','\x20=\x20','.dialCheckDuplicateType\x20IN\x20(','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.updatedAt','cm_contacts.priority','cm_contacts.UserId','insert','into','cm_hopper','fromQuery','phone','scheduledat','ContactId','createdAt','updatedAt','priority','recallme','fields','cm_contacts'];(function(_0x23f206,_0x573c48){var _0x3e31d4=function(_0x53c869){while(--_0x53c869){_0x23f206['push'](_0x23f206['shift']());}};_0x3e31d4(++_0x573c48);}(_0xbf7f,0x1b1));var _0xfbf7=function(_0x3ff085,_0x27c92e){_0x3ff085=_0x3ff085-0x0;var _0x2b68c3=_0xbf7f[_0x3ff085];return _0x2b68c3;};'use strict';var fs=require('fs');var path=require(_0xfbf7('0x0'));var _=require(_0xfbf7('0x1'));var Papa=require(_0xfbf7('0x2'));var util=require(_0xfbf7('0x3'));var BPromise=require(_0xfbf7('0x4'));var moment=require(_0xfbf7('0x5'));var squel=require(_0xfbf7('0x6'));var Redis=require('ioredis');var db=require(_0xfbf7('0x7'))['db'];var config=require(_0xfbf7('0x8'));var shared=require(_0xfbf7('0x9'));var logger=require(_0xfbf7('0xa'))('import');config[_0xfbf7('0xb')]=_[_0xfbf7('0xc')](config['redis'],{'host':_0xfbf7('0xd'),'port':0x18eb});var socket=require(_0xfbf7('0xe'))(new Redis(config['redis']));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var stopped=![];var tmp_voice_queues;var tmp_campaigns;var tzOffset=0x0;var hasTZ;var NOW=moment()[_0xfbf7('0xf')](_0xfbf7('0x10'));function isEmail(_0x3b35a8){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))*$/[_0xfbf7('0x11')](_0x3b35a8);}function selectNotIn(_0x319982,_0x1a2efa,_0x444e57,_0x276eb9,_0x418fd2){return squel[_0xfbf7('0x12')]()[_0xfbf7('0x13')]('phone')[_0xfbf7('0x14')](_0x276eb9)[_0xfbf7('0x15')](_0x1a2efa,null,_0x1a2efa+_0xfbf7('0x16')+_0x276eb9+'.'+_0x444e57)[_0xfbf7('0x17')](_0x276eb9+'.'+_0x444e57+_0xfbf7('0x18')+_0x319982+'.'+_0x444e57)[_0xfbf7('0x17')](_0x1a2efa+_0xfbf7('0x19')+_0x418fd2[_0xfbf7('0x15')]()+')');}function insertCmHopper(_0x52677e,_0x2df2b3,_0x1ab60f,_0x42541d,_0x5df6a1){var _0x3fc771=[_0xfbf7('0x1a'),_0xfbf7('0x1b'),_0xfbf7('0x1c'),_0xfbf7('0x1d'),_0x2df2b3+'.'+_0x42541d,_0xfbf7('0x1e'),_0xfbf7('0x1f'),_0xfbf7('0x20'),_0xfbf7('0x21'),'\x22'+_0x5df6a1+'\x22'];return squel[_0xfbf7('0x22')]()[_0xfbf7('0x23')](_0xfbf7('0x24'))[_0xfbf7('0x25')]([_0xfbf7('0x26'),_0xfbf7('0x27'),_0xfbf7('0x28'),'ListId',_0x42541d,_0xfbf7('0x29'),_0xfbf7('0x2a'),_0xfbf7('0x2b'),'UserId',_0xfbf7('0x2c')],squel[_0xfbf7('0x12')]()[_0xfbf7('0x2d')](_0x3fc771)['from'](_0x2df2b3)[_0xfbf7('0x15')](_0xfbf7('0x2e'),null,_0xfbf7('0x2f')+_0x2df2b3+_0xfbf7('0x30'))[_0xfbf7('0x15')](_0x1ab60f,null,_0x1ab60f+_0xfbf7('0x16')+_0x2df2b3+'.'+_0x42541d)[_0xfbf7('0x17')](_0x2df2b3+_0xfbf7('0x31'),_0x52677e)[_0xfbf7('0x17')](_0xfbf7('0x32'),NOW)[_0xfbf7('0x17')](_0xfbf7('0x33'),selectNotIn(_0x2df2b3,_0x1ab60f,_0x42541d,'cm_hopper',['\x22always\x22','\x22onlyIfOpen\x22']))[_0xfbf7('0x17')](_0xfbf7('0x33'),selectNotIn(_0x2df2b3,_0x1ab60f,_0x42541d,_0xfbf7('0x24'),[_0xfbf7('0x34')])))[_0xfbf7('0x35')]();}function insertCmHopperBlack(_0x2c88ac,_0x4d1680,_0x579054,_0xe2b56c){var _0x11a6ae=[_0xfbf7('0x1a'),_0xfbf7('0x1c'),_0xfbf7('0x1d'),_0x4d1680+'.'+_0xe2b56c,'cm_contacts.createdAt',_0xfbf7('0x1f')];return squel['insert']()[_0xfbf7('0x23')](_0xfbf7('0x36'))[_0xfbf7('0x25')]([_0xfbf7('0x26'),_0xfbf7('0x28'),'ListId',_0xe2b56c,'createdAt',_0xfbf7('0x2a')],squel[_0xfbf7('0x12')]()['fields'](_0x11a6ae)[_0xfbf7('0x14')](_0x4d1680)[_0xfbf7('0x15')](_0xfbf7('0x2e'),null,_0xfbf7('0x2f')+_0x4d1680+_0xfbf7('0x30'))[_0xfbf7('0x15')](_0x579054,null,_0x579054+_0xfbf7('0x16')+_0x4d1680+'.'+_0xe2b56c)['where'](_0x4d1680+'.CmListId\x20=\x20?',_0x2c88ac)['where'](_0xfbf7('0x32'),NOW)['where'](_0xfbf7('0x33'),squel[_0xfbf7('0x12')]()['field'](_0xfbf7('0x26'))['from'](_0xfbf7('0x36'))['where'](_0xfbf7('0x37'),_0x2c88ac)[_0xfbf7('0x17')](_0xe2b56c+_0xfbf7('0x38'),_0x4d1680+'.'+_0xe2b56c)))[_0xfbf7('0x35')]();}function insertTzCmHopper(_0x563ba6,_0x34173f,_0x44d967,_0x25f65b,_0x210374,_0x43a146){var _0x3f95a6=['cm_contacts.phone',_0xfbf7('0x39')+_0x43a146+_0xfbf7('0x3a'),_0xfbf7('0x1c'),'cm_contacts.ListId',_0x34173f+'.'+_0x25f65b,_0xfbf7('0x1e'),_0xfbf7('0x1f'),_0xfbf7('0x20'),'cm_contacts.UserId','\x22'+_0x210374+'\x22'];var _0x42475e=squel[_0xfbf7('0x22')]()[_0xfbf7('0x23')](_0xfbf7('0x24'))[_0xfbf7('0x25')](['phone',_0xfbf7('0x27'),_0xfbf7('0x28'),_0xfbf7('0x3b'),_0x25f65b,_0xfbf7('0x29'),_0xfbf7('0x2a'),_0xfbf7('0x2b'),_0xfbf7('0x3c'),_0xfbf7('0x2c')],squel[_0xfbf7('0x12')]()[_0xfbf7('0x2d')](_0x3f95a6)['from'](_0x34173f)[_0xfbf7('0x15')](_0xfbf7('0x2e'),null,_0xfbf7('0x2f')+_0x34173f+_0xfbf7('0x30'))[_0xfbf7('0x15')](_0x44d967,null,_0x44d967+_0xfbf7('0x16')+_0x34173f+'.'+_0x25f65b)[_0xfbf7('0x15')](_0x43a146,null,_0x43a146+_0xfbf7('0x16')+_0x34173f+'.'+_0x25f65b)[_0xfbf7('0x17')](_0x34173f+'.CmListId\x20=\x20?',_0x563ba6)[_0xfbf7('0x17')](_0xfbf7('0x32'),NOW)[_0xfbf7('0x17')](_0xfbf7('0x33'),selectNotIn(_0x34173f,_0x44d967,_0x25f65b,_0xfbf7('0x24'),['\x22always\x22',_0xfbf7('0x3d')]))['where'](_0xfbf7('0x33'),selectNotIn(_0x34173f,_0x44d967,_0x25f65b,_0xfbf7('0x24'),[_0xfbf7('0x34')])))['toString']();return _0x42475e;}function insertTzCmHopperBlack(_0x1a9308,_0x546053,_0x35c5f8,_0x42c357){var _0x4b6eec=[_0xfbf7('0x1a'),_0xfbf7('0x1c'),'cm_contacts.ListId',_0x546053+'.'+_0x42c357,_0xfbf7('0x1e'),'cm_contacts.updatedAt'];return squel[_0xfbf7('0x22')]()[_0xfbf7('0x23')](_0xfbf7('0x36'))['fromQuery'](['phone',_0xfbf7('0x28'),'ListId',_0x42c357,_0xfbf7('0x29'),'updatedAt'],squel['select']()[_0xfbf7('0x2d')](_0x4b6eec)[_0xfbf7('0x14')](_0x546053)['join']('cm_contacts',null,_0xfbf7('0x2f')+_0x546053+_0xfbf7('0x30'))[_0xfbf7('0x15')](_0x35c5f8,null,_0x35c5f8+_0xfbf7('0x16')+_0x546053+'.'+_0x42c357)[_0xfbf7('0x17')](_0x546053+_0xfbf7('0x31'),_0x1a9308)[_0xfbf7('0x17')](_0xfbf7('0x32'),NOW)['where'](_0xfbf7('0x33'),squel[_0xfbf7('0x12')]()[_0xfbf7('0x13')](_0xfbf7('0x26'))['from']('cm_hopper_black')[_0xfbf7('0x17')]('ListId\x20=\x20?',_0x1a9308)[_0xfbf7('0x17')](_0x42c357+'\x20=\x20?',_0x546053+'.'+_0x42c357)))[_0xfbf7('0x35')]();}function insertCmContact(_0x6b267c,_0x23f8e5,_0x4f4f66,_0x3e4833){var _0x1868b2=_[_0xfbf7('0x3e')](_['keys'](_0x3e4833),['ListId',_0xfbf7('0x3f'),_0xfbf7('0x29'),'updatedAt']);return squel[_0xfbf7('0x22')]()[_0xfbf7('0x23')](_0xfbf7('0x2e'))[_0xfbf7('0x25')](_0x1868b2,squel[_0xfbf7('0x12')]()[_0xfbf7('0x2d')](_0x1868b2)[_0xfbf7('0x14')](_0x23f8e5)[_0xfbf7('0x17')]('('+_0x4f4f66[_0xfbf7('0x15')](',')+')\x20NOT\x20IN\x20?',squel[_0xfbf7('0x12')]()[_0xfbf7('0x2d')](_0x4f4f66)[_0xfbf7('0x14')]('cm_contacts')[_0xfbf7('0x17')](_0xfbf7('0x37'),_0x6b267c)[_0xfbf7('0x17')]('deletedAt\x20IS\x20NULL'))[_0xfbf7('0x17')](_0xfbf7('0x40'),squel[_0xfbf7('0x12')]()[_0xfbf7('0x13')](_0xfbf7('0x41'),'min_id')[_0xfbf7('0x14')](_0x23f8e5)[_0xfbf7('0x42')](_0x4f4f66['join'](','))))[_0xfbf7('0x35')]();}function handleStop(){logger[_0xfbf7('0x43')](_0xfbf7('0x44'));stopped=!![];}function handleUncaughtException(_0x497212){logger[_0xfbf7('0x45')](_0x497212[_0xfbf7('0x46')]);process[_0xfbf7('0x47')](0x1);}function handleError(_0x104e0e,_0x564fe9){stats[_0xfbf7('0x48')][_0xfbf7('0x49')]({'name':_0x564fe9[_0xfbf7('0x4a')],'message':_0x564fe9[_0xfbf7('0x46')],'row':_0x104e0e});}function handleQuery(_0x13f2a1){logger['info'](_0x13f2a1);return db[_0xfbf7('0x4b')][_0xfbf7('0x4c')](_0x13f2a1)['spread'](function(_0x20f0f8){results['push'](_0x20f0f8);})[_0xfbf7('0x4d')](function(_0x2db2b9){logger[_0xfbf7('0x45')](_0x2db2b9[_0xfbf7('0x46')]);});}function updateTzCampaigns(_0x5ed5eb){return new Promise(function(_0x1f2eb8,_0x59180d){var _0x5dca77=squel[_0xfbf7('0x12')]()[_0xfbf7('0x2d')](['campaigns.id','campaigns.dialTimezone'])['from'](_0xfbf7('0x4e'))[_0xfbf7('0x15')](_0xfbf7('0x4f'),null,_0xfbf7('0x50'))[_0xfbf7('0x17')](_0xfbf7('0x51')+_0x5ed5eb);db['sequelize'][_0xfbf7('0x4c')](_0x5dca77[_0xfbf7('0x35')]())[_0xfbf7('0x52')](function(_0x143fd4){var _0x3d4b99=[];for(var _0x409191=0x0;_0x409191<_0x143fd4['length'];_0x409191++){_0x3d4b99[_0xfbf7('0x49')](getTimezoneData(_0x143fd4[_0x409191],tmp_campaigns));}BPromise[_0xfbf7('0x53')](_0x3d4b99)['then'](function(){_0x1f2eb8({'val':0x1});});})[_0xfbf7('0x4d')](function(_0x4bf752){logger[_0xfbf7('0x45')](_0x4bf752[_0xfbf7('0x46')]);_0x1f2eb8({'val':0x0});});});}function updateTzVoiceQueues(_0x22b2e4){return new Promise(function(_0xfeb108,_0x2bb34b){var _0x4df1a1=squel[_0xfbf7('0x12')]()[_0xfbf7('0x2d')]([_0xfbf7('0x54'),'voice_queues.dialTimezone'])[_0xfbf7('0x14')](_0xfbf7('0x55'))[_0xfbf7('0x15')](_0xfbf7('0x56'),null,_0xfbf7('0x57'))[_0xfbf7('0x17')](_0xfbf7('0x58')+_0x22b2e4);db['sequelize'][_0xfbf7('0x4c')](_0x4df1a1[_0xfbf7('0x35')]())[_0xfbf7('0x52')](function(_0x4b291d){var _0x126a93=[];for(var _0x94b02c=0x0;_0x94b02c<_0x4b291d['length'];_0x94b02c++){_0x126a93[_0xfbf7('0x49')](getTimezoneData(_0x4b291d[_0x94b02c],tmp_voice_queues));}BPromise[_0xfbf7('0x53')](_0x126a93)[_0xfbf7('0x59')](function(){_0xfeb108({'val':0x1});});})[_0xfbf7('0x4d')](function(_0x533bea){logger['error'](_0x533bea[_0xfbf7('0x46')]);_0xfeb108({'val':0x0});});});}function getTimezoneData(_0x40ba7f,_0x37ae85){return new Promise(function(_0x53c7fe,_0x1997ce){var _0x130c64=shared[_0xfbf7('0x5a')];var _0xd71522=_0x130c64[_0x40ba7f[_0xfbf7('0x5b')]];if(_['isNil'](_0xd71522)){_0x53c7fe({'ret':0x1});}else{var _0x55554f=_0xd71522['utcOffset'];var _0x1aef27=squel[_0xfbf7('0x22')]()[_0xfbf7('0x23')](_0x37ae85)[_0xfbf7('0x5c')]('id',_0x40ba7f['id'])[_0xfbf7('0x5c')](_0xfbf7('0x5d'),_0x55554f)[_0xfbf7('0x5c')](_0xfbf7('0x5b'),_0x40ba7f[_0xfbf7('0x5b')])[_0xfbf7('0x35')]();return db['sequelize'][_0xfbf7('0x4c')](_0x1aef27)[_0xfbf7('0x52')](function(_0x51868a){_0x53c7fe({'ret':0x1});})['catch'](function(_0x472f24){logger[_0xfbf7('0x45')](_0x472f24[_0xfbf7('0x46')]);_0x1997ce({'ret':0x1});});}});}function handleTZQuery(_0x49b5c6){logger['info'](_0x49b5c6);return db[_0xfbf7('0x4b')][_0xfbf7('0x4c')](_0x49b5c6)[_0xfbf7('0x52')](function(_0x4c34b6){})[_0xfbf7('0x4d')](function(_0x3e263f){logger[_0xfbf7('0x45')](_0x3e263f[_0xfbf7('0x46')]);});}function main(_0x1c3c12,_0x267f69,_0x40c0cb,_0x323c9c){logger[_0xfbf7('0x43')](_0xfbf7('0x5e'),_0x1c3c12,JSON[_0xfbf7('0x5f')](_0x267f69));process[_0xfbf7('0x60')]('start');var _0xe9d12b=_0x267f69[_0xfbf7('0x61')];var _0x13b750=_0x267f69[_0xfbf7('0x62')];var _0x3e7110=path[_0xfbf7('0x15')](config[_0xfbf7('0x63')],_0xfbf7('0x64'),_0x13b750+_0xfbf7('0x65'));hasTZ=_[_0xfbf7('0x66')](_0xe9d12b)['includes'](_0xfbf7('0x5b'));var _0x39f34c=_[_0xfbf7('0x66')](_0xe9d12b)[_0xfbf7('0x15')]();logger['info']('header',_0x39f34c);if(hasTZ)_0x39f34c+=',utcOffset';fs[_0xfbf7('0x67')](_0x3e7110,_0x39f34c+'\x0a');Papa[_0xfbf7('0x68')](fs[_0xfbf7('0x69')](_0x1c3c12),{'header':!![],'skipEmptyLines':!![],'step':function(_0x27659a,_0x17751c){try{for(var _0x3aaf83=0x0,_0x48e1ae=[];_0x3aaf83<_0x27659a[_0xfbf7('0x6a')][_0xfbf7('0x6b')];_0x3aaf83++){stats[_0xfbf7('0x6c')]+=0x1;if(_0x27659a['errors'][_0x3aaf83]){handleError(_0x27659a['data'][_0x3aaf83],_0x27659a[_0xfbf7('0x48')][_0x3aaf83]);}else{var _0x5a41bf=[];for(var _0x584cc7 in _0xe9d12b){if(_0xe9d12b['hasOwnProperty'](_0x584cc7)){if(_0x27659a[_0xfbf7('0x6a')][_0x3aaf83][_0xe9d12b[_0x584cc7]]){var _0x3bf0ba=_[_0xfbf7('0x6d')](_0x27659a[_0xfbf7('0x6a')][_0x3aaf83][_0xe9d12b[_0x584cc7]][_0xfbf7('0x6e')](/"/g,'\x27'));switch(_0x584cc7){case _0xfbf7('0x27'):var _0x56dfb1=moment(_0x3bf0ba,'YYYY-MM-DD\x20HH:mm:ss',!![]);if(_0x56dfb1[_0xfbf7('0x6f')]()){_0x48e1ae[_0xfbf7('0x49')]('\x22'+_0x3bf0ba+'\x22');}else{_0x5a41bf['push'](_0xfbf7('0x70'));}break;case'priority':var _0xc705b5=parseInt(_0x3bf0ba);_0x3bf0ba=_[_0xfbf7('0x71')](_0xc705b5)||_0xc705b5<0x0||_0xc705b5>0x4?_0x323c9c?0x3:0x2:_0xc705b5;_0x48e1ae[_0xfbf7('0x49')]('\x22'+_0x3bf0ba+'\x22');break;case _0xfbf7('0x3c'):var _0x5ca721=parseInt(_0x3bf0ba);if(_[_0xfbf7('0x72')](_0x5ca721)&&_['includes'](_0x40c0cb,_0x5ca721)){_0x48e1ae[_0xfbf7('0x49')]('\x22'+_0x5ca721+'\x22');}else{_0x5a41bf[_0xfbf7('0x49')]('agent\x20not\x20exists');}break;case _0xfbf7('0x73'):if(isEmail(_0x3bf0ba)){_0x48e1ae[_0xfbf7('0x49')]('\x22'+_0x3bf0ba+'\x22');}else{_0x5a41bf['push'](_0xfbf7('0x74'));}break;case'dateOfBirth':var _0x1fcd85=moment(_0x3bf0ba,'YYYY-MM-DD',!![]);if(_0x1fcd85[_0xfbf7('0x6f')]()){_0x48e1ae[_0xfbf7('0x49')]('\x22'+_0x3bf0ba+'\x22');}else{_0x5a41bf[_0xfbf7('0x49')](_0xfbf7('0x75'));}break;case'dialTimezone':var _0xbd189d=shared['timezones'];var _0x10d709=_0xbd189d[_0x3bf0ba];if(!_[_0xfbf7('0x76')](_0x10d709)){var _0x56637c=_0x10d709[_0xfbf7('0x77')];_0x48e1ae[_0xfbf7('0x49')]('\x22'+_0x3bf0ba+'\x22');_0x48e1ae[_0xfbf7('0x49')]('\x22'+_0x56637c+'\x22');}break;default:_0x48e1ae[_0xfbf7('0x49')]('\x22'+_0x3bf0ba+'\x22');}}else{switch(_0x584cc7){case _0xfbf7('0x78'):case _0xfbf7('0x26'):_0x5a41bf[_0xfbf7('0x49')](_0x584cc7+_0xfbf7('0x79'));break;default:_0x48e1ae[_0xfbf7('0x49')]('\x22\x22');}}}}if(_0x5a41bf['length']){handleError(_0x27659a[_0xfbf7('0x6a')][_0x3aaf83],{'code':_0xfbf7('0x7a'),'message':_0x5a41bf[_0xfbf7('0x15')]()});}else{fs[_0xfbf7('0x7b')](_0x3e7110,_0x48e1ae[_0xfbf7('0x15')]()+'\x0a');}_0x48e1ae=[];}if(!(stats[_0xfbf7('0x6c')]%0xc8)){socket[_0xfbf7('0x7c')](_0xfbf7('0x7d')+_0x13b750,stats);stats[_0xfbf7('0x48')]=[];}}if(stopped){logger[_0xfbf7('0x43')](_0xfbf7('0x7e'));_0x17751c[_0xfbf7('0x7f')]();}}catch(_0x4d27a3){handleError(_0x27659a['data'][_0x3aaf83],{'code':_0xfbf7('0x80'),'message':_0x4d27a3[_0xfbf7('0x46')]});logger[_0xfbf7('0x45')](_0xfbf7('0x81'),_0x4d27a3[_0xfbf7('0x46')]);}},'complete':function(){try{var _0x28d32a=[];var _0x2d2875=[];var _0x4af6f2=_0xfbf7('0x2e');if(_0x267f69['duplicates']&&_0x267f69[_0xfbf7('0x82')][_0xfbf7('0x6b')]){_0x4af6f2=_0xfbf7('0x83')+_0x13b750;_0x28d32a[_0xfbf7('0x49')]('CREATE\x20TABLE\x20'+_0x4af6f2+_0xfbf7('0x84'));}tmp_campaigns=_0xfbf7('0x85')+_0x13b750;tmp_voice_queues=_0xfbf7('0x86')+_0x13b750;_0x2d2875['push']('CREATE\x20TABLE\x20'+tmp_campaigns+_0xfbf7('0x87'));_0x2d2875['push'](_0xfbf7('0x88')+tmp_voice_queues+'(id\x20int,dialTimezone\x20varchar(255),offset\x20int);');BPromise[_0xfbf7('0x89')](_0x2d2875,handleTZQuery)['then'](function(_0x49ccb2){updateTzCampaigns(_0x267f69[_0xfbf7('0x3b')])[_0xfbf7('0x59')](function(_0x201cdd){updateTzVoiceQueues(_0x267f69[_0xfbf7('0x3b')])['then'](function(_0x526476){var _0x5e7d8c=util['format'](_0xfbf7('0x8a'),_0x3e7110,_0x4af6f2,_0x39f34c,_0x267f69[_0xfbf7('0x3b')],_0x267f69[_0xfbf7('0x3f')]||null,NOW,NOW);if(_[_0xfbf7('0x76')](_0xe9d12b['scheduledat'])){_0x5e7d8c+=_0xfbf7('0x8b');}_0x28d32a[_0xfbf7('0x49')](_0x5e7d8c);if(_0x267f69[_0xfbf7('0x82')]&&_0x267f69[_0xfbf7('0x82')][_0xfbf7('0x6b')]){_0x28d32a[_0xfbf7('0x49')](insertCmContact(_0x267f69[_0xfbf7('0x3b')],_0x4af6f2,_0x267f69[_0xfbf7('0x82')],_0xe9d12b));_0x28d32a[_0xfbf7('0x49')](_0xfbf7('0x8c')+_0x4af6f2+';');}if(hasTZ){_0x28d32a[_0xfbf7('0x49')](insertTzCmHopper(_0x267f69[_0xfbf7('0x3b')],_0xfbf7('0x56'),_0xfbf7('0x55'),_0xfbf7('0x8d'),_0x323c9c,tmp_voice_queues));_0x28d32a[_0xfbf7('0x49')](insertTzCmHopperBlack(_0x267f69['ListId'],_0xfbf7('0x8e'),_0xfbf7('0x55'),_0xfbf7('0x8d')));_0x28d32a['push'](insertTzCmHopper(_0x267f69['ListId'],'campaigns_has_cm_lists',_0xfbf7('0x4e'),_0xfbf7('0x8f'),_0x323c9c,tmp_campaigns));_0x28d32a[_0xfbf7('0x49')](insertTzCmHopperBlack(_0x267f69[_0xfbf7('0x3b')],_0xfbf7('0x90'),_0xfbf7('0x4e'),_0xfbf7('0x8f')));}else{_0x28d32a[_0xfbf7('0x49')](insertCmHopper(_0x267f69['ListId'],_0xfbf7('0x56'),_0xfbf7('0x55'),_0xfbf7('0x8d'),_0x323c9c));_0x28d32a[_0xfbf7('0x49')](insertCmHopperBlack(_0x267f69[_0xfbf7('0x3b')],_0xfbf7('0x8e'),_0xfbf7('0x55'),_0xfbf7('0x8d')));_0x28d32a[_0xfbf7('0x49')](insertCmHopper(_0x267f69[_0xfbf7('0x3b')],_0xfbf7('0x4f'),_0xfbf7('0x4e'),'CampaignId',_0x323c9c));_0x28d32a[_0xfbf7('0x49')](insertCmHopperBlack(_0x267f69[_0xfbf7('0x3b')],'campaigns_has_cm_blacklists',_0xfbf7('0x4e'),'CampaignId'));}_0x28d32a['push'](_0xfbf7('0x8c')+tmp_campaigns+';');_0x28d32a[_0xfbf7('0x49')]('DROP\x20TABLE\x20'+tmp_voice_queues+';');BPromise[_0xfbf7('0x89')](_0x28d32a,handleQuery)['then'](function(_0x5cbab5){stats[_0xfbf7('0x91')]=!![];stats[_0xfbf7('0x92')]=_0x267f69['duplicates']&&_0x267f69['duplicates'][_0xfbf7('0x6b')]?results[0x2][_0xfbf7('0x92')]:results[0x0][_0xfbf7('0x92')];socket[_0xfbf7('0x7c')](_0xfbf7('0x7d')+_0x13b750,stats);fs[_0xfbf7('0x93')](_0x1c3c12);fs[_0xfbf7('0x93')](_0x3e7110);process[_0xfbf7('0x47')](0x0);})[_0xfbf7('0x4d')](function(_0x17da19){logger[_0xfbf7('0x45')](_0x17da19[_0xfbf7('0x46')]);process[_0xfbf7('0x47')](0x1);});});});});}catch(_0x633652){logger['error']('complete',_0x633652[_0xfbf7('0x46')]);process['exit'](0x1);}},'error':function(_0x1233fa,_0x4dcfa2,_0x46de82,_0x295482){throw new Error(_0x295482);}});}function validate(){if(process[_0xfbf7('0x94')]&&process[_0xfbf7('0x94')][_0xfbf7('0x6b')]<0x4){throw new Error(_0xfbf7('0x95'));}var _0x388e87=path[_0xfbf7('0x15')](config[_0xfbf7('0x63')],_0xfbf7('0x64'),process['argv'][0x2]);if(!fs[_0xfbf7('0x96')](_0x388e87)){throw new Error(_0xfbf7('0x97'));}var _0x7ae470={};try{_0x7ae470=JSON[_0xfbf7('0x68')](process[_0xfbf7('0x94')][0x3]);if(!_0x7ae470[_0xfbf7('0x61')]){throw new Error('binding\x20doesn\x27t\x20exists');}if(!_0x7ae470[_0xfbf7('0x61')]['phone']){throw new Error(_0xfbf7('0x98'));}if(!_0x7ae470['binding'][_0xfbf7('0x78')]){throw new Error(_0xfbf7('0x99'));}var _0x2d8724=0x0;if(_0x7ae470[_0xfbf7('0x61')][_0xfbf7('0x3c')]){_0x2d8724=0x1;}if(!_0x7ae470['ListId']){throw new Error(_0xfbf7('0x9a'));}}catch(_0x52096e){throw new Error(_0xfbf7('0x9b'));}var _0x5d32cd=[];try{_0x5d32cd=_[_0xfbf7('0x9c')](JSON['parse'](process['argv'][0x4]),'id');}catch(_0x10e6eb){logger[_0xfbf7('0x43')](_0xfbf7('0x9d'));}main(_0x388e87,_0x7ae470,_0x5d32cd,_0x2d8724);}validate();process['on'](_0xfbf7('0x9e'),handleStop);process['on'](_0xfbf7('0x9f'),handleUncaughtException); \ No newline at end of file diff --git a/server/components/integrations/configuration.js b/server/components/integrations/configuration.js index 1833490..d5bec95 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 _0x0b5b=['Billable\x20Time','[xCALLY\x20Ticket]','toLowerCase','voice','push','variable','calleridnum','outbound','Outbound\x20Call','destcalleridnum','getDescriptions','inbound','string','Caller\x20Number','Caller\x20Name','calleridname','keyValue','Call\x20To','Queue','queue','UniqueId','Date','agentcalledAt','Agent\x20Number','Agent\x20Ring','Agent\x20Connect','agentconnectAt','Agent\x20Complete','agentcompleteAt','Hold\x20Time','holdtime','Talk\x20Time','talktime','***\x20Call\x20Info\x20***','Called\x20Number','Member\x20Name','uniqueid','starttime','***\x20Time\x20Info\x20***','Answer\x20Time','Complete\x20Time','endtime','Duration'];(function(_0x1b52d4,_0x3bcdd8){var _0x3afd2c=function(_0x3e97a8){while(--_0x3e97a8){_0x1b52d4['push'](_0x1b52d4['shift']());}};_0x3afd2c(++_0x3bcdd8);}(_0x0b5b,0x12e));var _0xb0b5=function(_0x4f6ca4,_0x55d534){_0x4f6ca4=_0x4f6ca4-0x0;var _0x5cc60b=_0x0b5b[_0x4f6ca4];return _0x5cc60b;};'use strict';exports['getSubjects']=function(_0x13de53,_0x1c9093){var _0x4e5d72=[{'type':'string','content':_0xb0b5('0x0'),'variableName':null}];switch(_0x13de53[_0xb0b5('0x1')]()){case _0xb0b5('0x2'):switch(_0x1c9093[_0xb0b5('0x1')]()){case'inbound':_0x4e5d72[_0xb0b5('0x3')]({'type':_0xb0b5('0x4'),'content':'','variableName':'queue'});_0x4e5d72[_0xb0b5('0x3')]({'type':'variable','content':'','variableName':_0xb0b5('0x5')});break;case _0xb0b5('0x6'):_0x4e5d72[_0xb0b5('0x3')]({'type':'string','content':_0xb0b5('0x7'),'variableName':null});_0x4e5d72['push']({'type':_0xb0b5('0x4'),'content':'','variableName':_0xb0b5('0x8')});break;}}return _0x4e5d72;};exports[_0xb0b5('0x9')]=function(_0x41abc6,_0x5c2e68){var _0x3a3c9c=[];switch(_0x41abc6[_0xb0b5('0x1')]()){case _0xb0b5('0x2'):switch(_0x5c2e68[_0xb0b5('0x1')]()){case _0xb0b5('0xa'):_0x3a3c9c=[{'type':_0xb0b5('0xb'),'content':'***\x20Call\x20Info\x20***','key':null,'keyType':null,'variableName':null},{'type':'keyValue','content':'','key':_0xb0b5('0xc'),'keyType':_0xb0b5('0x4'),'variableName':'calleridnum'},{'type':'keyValue','content':'','key':_0xb0b5('0xd'),'keyType':'variable','variableName':_0xb0b5('0xe')},{'type':_0xb0b5('0xf'),'content':'','key':_0xb0b5('0x10'),'keyType':_0xb0b5('0x4'),'variableName':'destexten'},{'type':_0xb0b5('0xf'),'content':'','key':_0xb0b5('0x11'),'keyType':_0xb0b5('0x4'),'variableName':_0xb0b5('0x12')},{'type':_0xb0b5('0xf'),'content':'','key':_0xb0b5('0x13'),'keyType':_0xb0b5('0x4'),'variableName':'uniqueid'},{'type':_0xb0b5('0xf'),'content':'','key':_0xb0b5('0x14'),'keyType':_0xb0b5('0x4'),'variableName':_0xb0b5('0x15')},{'type':_0xb0b5('0xb'),'content':'***\x20Agent\x20Info\x20***','key':null,'keyType':null,'variableName':null},{'type':'keyValue','content':'','key':'Agent\x20Name','keyType':'variable','variableName':'destcalleridname'},{'type':_0xb0b5('0xf'),'content':'','key':_0xb0b5('0x16'),'keyType':_0xb0b5('0x4'),'variableName':_0xb0b5('0x8')},{'type':_0xb0b5('0xb'),'content':'***\x20Time\x20Info\x20***','key':null,'keyType':null,'variableName':null},{'type':_0xb0b5('0xf'),'content':'','key':_0xb0b5('0x17'),'keyType':_0xb0b5('0x4'),'variableName':'agentcalledAt'},{'type':_0xb0b5('0xf'),'content':'','key':_0xb0b5('0x18'),'keyType':_0xb0b5('0x4'),'variableName':_0xb0b5('0x19')},{'type':_0xb0b5('0xf'),'content':'','key':_0xb0b5('0x1a'),'keyType':'variable','variableName':_0xb0b5('0x1b')},{'type':_0xb0b5('0xf'),'content':'','key':_0xb0b5('0x1c'),'keyType':_0xb0b5('0x4'),'variableName':_0xb0b5('0x1d')},{'type':_0xb0b5('0xf'),'content':'','key':_0xb0b5('0x1e'),'keyType':_0xb0b5('0x4'),'variableName':_0xb0b5('0x1f')}];break;case _0xb0b5('0x6'):_0x3a3c9c=[{'type':_0xb0b5('0xb'),'content':_0xb0b5('0x20'),'variableName':null},{'type':_0xb0b5('0xf'),'content':'','key':_0xb0b5('0x21'),'keyType':_0xb0b5('0x4'),'keyContent':'','variableName':'destcalleridnum'},{'type':_0xb0b5('0xf'),'content':'','key':_0xb0b5('0x22'),'keyType':'variable','keyContent':'','variableName':'membername'},{'type':'keyValue','content':'','key':_0xb0b5('0x13'),'keyType':_0xb0b5('0x4'),'keyContent':'','variableName':_0xb0b5('0x23')},{'type':'keyValue','content':'','key':'Date','keyType':'variable','keyContent':'','variableName':_0xb0b5('0x24')},{'type':_0xb0b5('0xb'),'content':_0xb0b5('0x25')},{'type':'keyValue','content':'','key':_0xb0b5('0x26'),'keyType':_0xb0b5('0x4'),'keyContent':'','variableName':'answertime'},{'type':_0xb0b5('0xf'),'content':'','key':_0xb0b5('0x27'),'keyType':_0xb0b5('0x4'),'keyContent':'','variableName':_0xb0b5('0x28')},{'type':_0xb0b5('0xf'),'content':'','key':_0xb0b5('0x29'),'keyType':_0xb0b5('0x4'),'keyContent':'','variableName':'duration'},{'type':'keyValue','content':'','key':_0xb0b5('0x2a'),'keyType':_0xb0b5('0x4'),'keyContent':'','variableName':'billableseconds'}];break;}}return _0x3a3c9c;}; \ No newline at end of file +var _0x92c8=['UniqueId','uniqueid','Date','agentcalledAt','***\x20Agent\x20Info\x20***','Agent\x20Name','Agent\x20Number','***\x20Time\x20Info\x20***','Agent\x20Ring','Agent\x20Connect','agentconnectAt','Agent\x20Complete','agentcompleteAt','Talk\x20Time','talktime','Called\x20Number','Member\x20Name','membername','Duration','duration','string','toLowerCase','voice','push','variable','queue','calleridnum','outbound','Outbound\x20Call','destcalleridnum','getDescriptions','inbound','***\x20Call\x20Info\x20***','keyValue','Caller\x20Number','Caller\x20Name','Call\x20To','destexten'];(function(_0x44a08e,_0x58d871){var _0x284fac=function(_0x1ae40f){while(--_0x1ae40f){_0x44a08e['push'](_0x44a08e['shift']());}};_0x284fac(++_0x58d871);}(_0x92c8,0x11e));var _0x892c=function(_0x158cfc,_0x3ff9e0){_0x158cfc=_0x158cfc-0x0;var _0x38baee=_0x92c8[_0x158cfc];return _0x38baee;};'use strict';exports['getSubjects']=function(_0x14489d,_0x46b7a3){var _0x1ff31e=[{'type':_0x892c('0x0'),'content':'[xCALLY\x20Ticket]','variableName':null}];switch(_0x14489d[_0x892c('0x1')]()){case _0x892c('0x2'):switch(_0x46b7a3[_0x892c('0x1')]()){case'inbound':_0x1ff31e[_0x892c('0x3')]({'type':_0x892c('0x4'),'content':'','variableName':_0x892c('0x5')});_0x1ff31e[_0x892c('0x3')]({'type':_0x892c('0x4'),'content':'','variableName':_0x892c('0x6')});break;case _0x892c('0x7'):_0x1ff31e['push']({'type':_0x892c('0x0'),'content':_0x892c('0x8'),'variableName':null});_0x1ff31e[_0x892c('0x3')]({'type':_0x892c('0x4'),'content':'','variableName':_0x892c('0x9')});break;}}return _0x1ff31e;};exports[_0x892c('0xa')]=function(_0x58f196,_0x6190b7){var _0x11cecb=[];switch(_0x58f196[_0x892c('0x1')]()){case _0x892c('0x2'):switch(_0x6190b7['toLowerCase']()){case _0x892c('0xb'):_0x11cecb=[{'type':_0x892c('0x0'),'content':_0x892c('0xc'),'key':null,'keyType':null,'variableName':null},{'type':_0x892c('0xd'),'content':'','key':_0x892c('0xe'),'keyType':_0x892c('0x4'),'variableName':'calleridnum'},{'type':_0x892c('0xd'),'content':'','key':_0x892c('0xf'),'keyType':_0x892c('0x4'),'variableName':'calleridname'},{'type':_0x892c('0xd'),'content':'','key':_0x892c('0x10'),'keyType':'variable','variableName':_0x892c('0x11')},{'type':'keyValue','content':'','key':'Queue','keyType':_0x892c('0x4'),'variableName':'queue'},{'type':_0x892c('0xd'),'content':'','key':_0x892c('0x12'),'keyType':_0x892c('0x4'),'variableName':_0x892c('0x13')},{'type':_0x892c('0xd'),'content':'','key':_0x892c('0x14'),'keyType':_0x892c('0x4'),'variableName':_0x892c('0x15')},{'type':_0x892c('0x0'),'content':_0x892c('0x16'),'key':null,'keyType':null,'variableName':null},{'type':_0x892c('0xd'),'content':'','key':_0x892c('0x17'),'keyType':'variable','variableName':'destcalleridname'},{'type':_0x892c('0xd'),'content':'','key':_0x892c('0x18'),'keyType':'variable','variableName':'destcalleridnum'},{'type':_0x892c('0x0'),'content':_0x892c('0x19'),'key':null,'keyType':null,'variableName':null},{'type':'keyValue','content':'','key':_0x892c('0x1a'),'keyType':_0x892c('0x4'),'variableName':_0x892c('0x15')},{'type':'keyValue','content':'','key':_0x892c('0x1b'),'keyType':'variable','variableName':_0x892c('0x1c')},{'type':_0x892c('0xd'),'content':'','key':_0x892c('0x1d'),'keyType':_0x892c('0x4'),'variableName':_0x892c('0x1e')},{'type':_0x892c('0xd'),'content':'','key':'Hold\x20Time','keyType':'variable','variableName':'holdtime'},{'type':_0x892c('0xd'),'content':'','key':_0x892c('0x1f'),'keyType':'variable','variableName':_0x892c('0x20')}];break;case _0x892c('0x7'):_0x11cecb=[{'type':_0x892c('0x0'),'content':_0x892c('0xc'),'variableName':null},{'type':_0x892c('0xd'),'content':'','key':_0x892c('0x21'),'keyType':_0x892c('0x4'),'keyContent':'','variableName':_0x892c('0x9')},{'type':_0x892c('0xd'),'content':'','key':_0x892c('0x22'),'keyType':_0x892c('0x4'),'keyContent':'','variableName':_0x892c('0x23')},{'type':_0x892c('0xd'),'content':'','key':_0x892c('0x12'),'keyType':_0x892c('0x4'),'keyContent':'','variableName':_0x892c('0x13')},{'type':_0x892c('0xd'),'content':'','key':_0x892c('0x14'),'keyType':_0x892c('0x4'),'keyContent':'','variableName':'starttime'},{'type':_0x892c('0x0'),'content':_0x892c('0x19')},{'type':'keyValue','content':'','key':'Answer\x20Time','keyType':'variable','keyContent':'','variableName':'answertime'},{'type':_0x892c('0xd'),'content':'','key':'Complete\x20Time','keyType':_0x892c('0x4'),'keyContent':'','variableName':'endtime'},{'type':_0x892c('0xd'),'content':'','key':_0x892c('0x24'),'keyType':'variable','keyContent':'','variableName':_0x892c('0x25')},{'type':'keyValue','content':'','key':'Billable\x20Time','keyType':_0x892c('0x4'),'keyContent':'','variableName':'billableseconds'}];break;}}return _0x11cecb;}; \ No newline at end of file diff --git a/server/components/interaction/service.js b/server/components/interaction/service.js index b2f9778..0dccb77 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 _0x75d2=['body','omit','phone','mobile','openchannel-interactions','../../config/logger','mail-interactions','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','role','stringify','null','Interaction','update','then','info','catch','user','query'];(function(_0x4473d9,_0x2800b9){var _0x3306f2=function(_0x40b060){while(--_0x40b060){_0x4473d9['push'](_0x4473d9['shift']());}};_0x3306f2(++_0x2800b9);}(_0x75d2,0x100));var _0x275d=function(_0x562362,_0x5d54f4){_0x562362=_0x562362-0x0;var _0x3a18ce=_0x75d2[_0x562362];return _0x3a18ce;};'use strict';var _=require('lodash');var db=require('../../mysqldb')['db'];var loggers={'openchannel':require('../../config/logger')(_0x275d('0x0')),'mail':require(_0x275d('0x1'))(_0x275d('0x2')),'fax':require('../../config/logger')(_0x275d('0x3')),'sms':require('../../config/logger')(_0x275d('0x4')),'chat':require(_0x275d('0x1'))(_0x275d('0x5')),'whatsapp':require('../../config/logger')(_0x275d('0x6'))};function getInteractionId(_0x1e48c8,_0x54f5c1,_0x1a770a){if(_0x1e48c8&&_0x1e48c8[_[_0x275d('0x7')](_0x1a770a)+_0x275d('0x8')]){return _0x1e48c8[_[_0x275d('0x7')](_0x1a770a)+'InteractionId'];}else if(_0x1e48c8&&_0x1e48c8['id']){return _0x1e48c8['id'];}else if(_0x54f5c1&&_0x54f5c1['id']){return _0x54f5c1['id'];}else{return _0x275d('0x9');}}function log(_0x45305d,_0x1d7c1d,_0x4484f6,_0x4311b0,_0x2709c9,_0x40acc4){loggers[_0x2709c9[_0x275d('0xa')]()][_0x45305d](_0x275d('0xb'),_0x40acc4[_0x275d('0xc')](),_0x1d7c1d?_0x1d7c1d['id']:null,_0x1d7c1d?_0x1d7c1d[_0x275d('0xd')]:null,_0x1d7c1d?_0x1d7c1d[_0x275d('0xe')]:null,getInteractionId(_0x4484f6,_0x4311b0,_0x2709c9),_0x4484f6?JSON[_0x275d('0xf')](_0x4484f6):_0x275d('0x10'));}function updateUser(_0x49df92,_0x316a68,_0x4d7035,_0x430ca1,_0x2cedc6){db[_['upperFirst'](_0x430ca1)+_0x275d('0x11')]['findOne']({'where':{'id':getInteractionId(_0x316a68,_0x4d7035,_0x430ca1)}})['then'](function(_0x878505){if(_0x878505){return _0x878505[_0x275d('0x12')]({'UserId':_0x49df92?_0x49df92['id']:null});}})[_0x275d('0x13')](function(_0x5c56e7){if(_0x5c56e7){log(_0x275d('0x14'),_0x49df92,_0x316a68,_0x4d7035,_0x430ca1,_0x2cedc6);}})[_0x275d('0x15')](function(){log('error',_0x49df92,_0x316a68,_0x4d7035,_0x430ca1,_0x2cedc6);});}exports['tracked']=function(_0x51ffa7,_0xf41ece){return function(_0x2a06ff,_0x9e085e,_0x5cd6e2){var _0x4eced5=_0x2a06ff[_0x275d('0x16')];var _0x5461fd={};var _0x2a5c70=_0x2a06ff[_0x275d('0x17')];if(_0x5461fd){_0x5461fd=_['clone'](_0x2a06ff[_0x275d('0x18')]);_0x5461fd=_[_0x275d('0x19')](_0x5461fd,[_0x275d('0x18'),'html',_0x275d('0x1a'),'fax',_0x275d('0x1b')]);}updateUser(_0x4eced5,_0x5461fd,_0x2a5c70,_0x51ffa7,_0xf41ece);_0x5cd6e2(null);};}; \ No newline at end of file +var _0x1472=['upperFirst','InteractionId','unknown','toLowerCase','toUpperCase','stringify','null','then','update','tracked','user','clone','omit','html','phone','fax','mobile','lodash','../../config/logger','openchannel-interactions','mail-interactions','fax-interactions','chat-interactions','whatsapp-interactions'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x1472,0xe9));var _0x2147=function(_0x1460ab,_0x74d06e){_0x1460ab=_0x1460ab-0x0;var _0x1eeb5c=_0x1472[_0x1460ab];return _0x1eeb5c;};'use strict';var _=require(_0x2147('0x0'));var db=require('../../mysqldb')['db'];var loggers={'openchannel':require(_0x2147('0x1'))(_0x2147('0x2')),'mail':require('../../config/logger')(_0x2147('0x3')),'fax':require(_0x2147('0x1'))(_0x2147('0x4')),'sms':require('../../config/logger')('sms-interactions'),'chat':require('../../config/logger')(_0x2147('0x5')),'whatsapp':require(_0x2147('0x1'))(_0x2147('0x6'))};function getInteractionId(_0x505183,_0x516e4d,_0x244095){if(_0x505183&&_0x505183[_[_0x2147('0x7')](_0x244095)+_0x2147('0x8')]){return _0x505183[_[_0x2147('0x7')](_0x244095)+_0x2147('0x8')];}else if(_0x505183&&_0x505183['id']){return _0x505183['id'];}else if(_0x516e4d&&_0x516e4d['id']){return _0x516e4d['id'];}else{return _0x2147('0x9');}}function log(_0x1fbc7b,_0x3008af,_0x5e8478,_0x3e6477,_0x168cce,_0x3ec3c6){loggers[_0x168cce[_0x2147('0xa')]()][_0x1fbc7b]('[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x3ec3c6[_0x2147('0xb')](),_0x3008af?_0x3008af['id']:null,_0x3008af?_0x3008af['name']:null,_0x3008af?_0x3008af['role']:null,getInteractionId(_0x5e8478,_0x3e6477,_0x168cce),_0x5e8478?JSON[_0x2147('0xc')](_0x5e8478):_0x2147('0xd'));}function updateUser(_0x27ae41,_0x4553c9,_0x168085,_0xffdbc,_0x5125d9){db[_[_0x2147('0x7')](_0xffdbc)+'Interaction']['findOne']({'where':{'id':getInteractionId(_0x4553c9,_0x168085,_0xffdbc)}})[_0x2147('0xe')](function(_0x2d8159){if(_0x2d8159){return _0x2d8159[_0x2147('0xf')]({'UserId':_0x27ae41?_0x27ae41['id']:null});}})[_0x2147('0xe')](function(_0x3a645b){if(_0x3a645b){log('info',_0x27ae41,_0x4553c9,_0x168085,_0xffdbc,_0x5125d9);}})['catch'](function(){log('error',_0x27ae41,_0x4553c9,_0x168085,_0xffdbc,_0x5125d9);});}exports[_0x2147('0x10')]=function(_0x2cb140,_0x57305c){return function(_0x1ecaa5,_0x421cb9,_0x44ed26){var _0x2c3b34=_0x1ecaa5[_0x2147('0x11')];var _0x3420e1={};var _0x2d21bc=_0x1ecaa5['query'];if(_0x3420e1){_0x3420e1=_[_0x2147('0x12')](_0x1ecaa5['body']);_0x3420e1=_[_0x2147('0x13')](_0x3420e1,['body',_0x2147('0x14'),_0x2147('0x15'),_0x2147('0x16'),_0x2147('0x17')]);}updateUser(_0x2c3b34,_0x3420e1,_0x2d21bc,_0x2cb140,_0x57305c);_0x44ed26(null);};}; \ No newline at end of file diff --git a/server/components/license/service.js b/server/components/license/service.js index 9536ca1..c39fb0b 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 _0x95e0=['then','count','status','json','Maximum\x20%s\x20limit\x20have\x20been\x20reached','catch','User','admin','user','isUserLimit','composable-middleware','../../config/environment','data1','license','createDecipher','format','%s:%s:%s','update','base64','utf8','hasOwnProperty','use','findOne'];(function(_0x585e84,_0x1d8489){var _0x39f3c4=function(_0x1855a3){while(--_0x1855a3){_0x585e84['push'](_0x585e84['shift']());}};_0x39f3c4(++_0x1d8489);}(_0x95e0,0x163));var _0x095e=function(_0x278fbe,_0x24c9cc){_0x278fbe=_0x278fbe-0x0;var _0x3a5ce2=_0x95e0[_0x278fbe];return _0x3a5ce2;};'use strict';var crypto=require('crypto');var util=require('util');var compose=require(_0x095e('0x0'));var db=require('../../mysqldb')['db'];var config=require(_0x095e('0x1'));function getValueFromLicense(_0x37b611,_0xf14bad){if(_0x37b611&&_0xf14bad){if(_0xf14bad[_0x095e('0x2')]&&_0xf14bad['license']){var _0x2ac786=_0xf14bad[_0x095e('0x2')];var _0x1da495=_0xf14bad[_0x095e('0x3')];var _0x11f256=_0x2ac786['split']('-')[0x4];var _0x5a463c=_0x2ac786['split']('-')[0x0];var _0x50975c=crypto[_0x095e('0x4')]('aes-256-ctr',util[_0x095e('0x5')](_0x095e('0x6'),_0x11f256,_0x2ac786,_0x5a463c));var _0x293a69=_0x50975c[_0x095e('0x7')](_0x1da495,_0x095e('0x8'),_0x095e('0x9'));_0x293a69+=_0x50975c['final']('utf8');var _0x24be00=JSON['parse'](_0x293a69);return _0x24be00[_0x095e('0xa')](_0x37b611)?_0x24be00[_0x37b611]:null;}}return null;}function isLimit(_0x43a48b,_0x34ac79,_0x29c1b9,_0x124ead){var _0x34c2fa=_0x34ac79;return compose()[_0x095e('0xb')](function(_0xb2d059,_0x251267,_0x22ac20){return db['License'][_0x095e('0xc')]({'where':{'id':0x1},'raw':!![]})[_0x095e('0xd')](function(_0x1d1248){var _0x54e9d3=getValueFromLicense(_0x43a48b,_0x1d1248);return _0x54e9d3?_0x54e9d3:_0x34c2fa;})['then'](function(_0x26f159){_0x34c2fa=_0x26f159;return _0x29c1b9[_0x095e('0xe')](_0x124ead);})[_0x095e('0xd')](function(_0x139b3d){if(_0x139b3d>=_0x34c2fa){return _0x251267[_0x095e('0xf')](0x193)[_0x095e('0x10')]({'message':util[_0x095e('0x5')](_0x095e('0x11'),_0x43a48b)});}_0x22ac20();})[_0x095e('0x12')](function(_0x3d731a){_0x22ac20(_0x3d731a);});});}function isUserLimit(){return isLimit('users',0x1,db[_0x095e('0x13')],{'where':{'$or':[{'role':_0x095e('0x14')},{'role':_0x095e('0x15')}]}});}exports[_0x095e('0x16')]=isUserLimit; \ No newline at end of file +var _0xe754=['then','count','status','Maximum\x20%s\x20limit\x20have\x20been\x20reached','catch','User','admin','user','isUserLimit','util','composable-middleware','../../mysqldb','../../config/environment','license','split','createDecipher','aes-256-ctr','format','update','base64','utf8','final','parse','hasOwnProperty','License','findOne'];(function(_0x2dec70,_0x24aeab){var _0x3ea6af=function(_0x36b4cc){while(--_0x36b4cc){_0x2dec70['push'](_0x2dec70['shift']());}};_0x3ea6af(++_0x24aeab);}(_0xe754,0x127));var _0x4e75=function(_0x100e3a,_0x5dda9d){_0x100e3a=_0x100e3a-0x0;var _0x555eb8=_0xe754[_0x100e3a];return _0x555eb8;};'use strict';var crypto=require('crypto');var util=require(_0x4e75('0x0'));var compose=require(_0x4e75('0x1'));var db=require(_0x4e75('0x2'))['db'];var config=require(_0x4e75('0x3'));function getValueFromLicense(_0x54e34a,_0x120714){if(_0x54e34a&&_0x120714){if(_0x120714['data1']&&_0x120714['license']){var _0x4f6f5c=_0x120714['data1'];var _0x208b6b=_0x120714[_0x4e75('0x4')];var _0x172492=_0x4f6f5c[_0x4e75('0x5')]('-')[0x4];var _0x4a3e95=_0x4f6f5c[_0x4e75('0x5')]('-')[0x0];var _0x4a2f8f=crypto[_0x4e75('0x6')](_0x4e75('0x7'),util[_0x4e75('0x8')]('%s:%s:%s',_0x172492,_0x4f6f5c,_0x4a3e95));var _0x3a3beb=_0x4a2f8f[_0x4e75('0x9')](_0x208b6b,_0x4e75('0xa'),_0x4e75('0xb'));_0x3a3beb+=_0x4a2f8f[_0x4e75('0xc')](_0x4e75('0xb'));var _0x1e5afc=JSON[_0x4e75('0xd')](_0x3a3beb);return _0x1e5afc[_0x4e75('0xe')](_0x54e34a)?_0x1e5afc[_0x54e34a]:null;}}return null;}function isLimit(_0x2fa49f,_0x3b2cac,_0x3465b4,_0xc5860a){var _0x2df819=_0x3b2cac;return compose()['use'](function(_0x2411d5,_0x1abe3d,_0x20e439){return db[_0x4e75('0xf')][_0x4e75('0x10')]({'where':{'id':0x1},'raw':!![]})[_0x4e75('0x11')](function(_0x4d7827){var _0x3070aa=getValueFromLicense(_0x2fa49f,_0x4d7827);return _0x3070aa?_0x3070aa:_0x2df819;})[_0x4e75('0x11')](function(_0x5a3733){_0x2df819=_0x5a3733;return _0x3465b4[_0x4e75('0x12')](_0xc5860a);})['then'](function(_0x4bb235){if(_0x4bb235>=_0x2df819){return _0x1abe3d[_0x4e75('0x13')](0x193)['json']({'message':util[_0x4e75('0x8')](_0x4e75('0x14'),_0x2fa49f)});}_0x20e439();})[_0x4e75('0x15')](function(_0x1ce0e2){_0x20e439(_0x1ce0e2);});});}function isUserLimit(){return isLimit('users',0x1,db[_0x4e75('0x16')],{'where':{'$or':[{'role':_0x4e75('0x17')},{'role':_0x4e75('0x18')}]}});}exports[_0x4e75('0x19')]=isUserLimit; \ No newline at end of file diff --git a/server/components/parsers/advancedSearch.js b/server/components/parsers/advancedSearch.js index 9d66558..1b6173c 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 _0xe23d=['$gt','$lte','<=\x20?','$gte','>=\x20?','start','$endsWith','shift','pop','format','utcOffset','hours','minutes','seconds','lodash','moment','parseSearch','sqlOperator','startsWith','and','replace','[$or]','split','length','slice','forEach','match','filter','indexOf','map','conditions','push','buildExpression','DATE','operator','$eq','$between','value','includes','add','days','castTo','CAST(','text','$ne','$notIn','\x20OR\x20','field','$in','IN\x20?','NOT\x20IN\x20?','=\x20?','<>\x20?','$substring','$startsWith','LIKE\x20?','$lt'];(function(_0x59a6ba,_0x367458){var _0x26a106=function(_0x4eef43){while(--_0x4eef43){_0x59a6ba['push'](_0x59a6ba['shift']());}};_0x26a106(++_0x367458);}(_0xe23d,0x80));var _0xde23=function(_0x114a90,_0x2dc1e8){_0x114a90=_0x114a90-0x0;var _0x4d6a5c=_0xe23d[_0x114a90];return _0x4d6a5c;};'use strict';var _=require(_0xde23('0x0'));var moment=require(_0xde23('0x1'));exports[_0xde23('0x2')]=function(_0x50a711){var _0x11bddf={'conditions':[]};_0x11bddf[_0xde23('0x3')]=_[_0xde23('0x4')](_0x50a711,'[$or]')?'or':_0xde23('0x5');var _0x573f54=_0x50a711['replace']('[$and]','')[_0xde23('0x6')](_0xde23('0x7'),'')[_0xde23('0x8')]('||');for(var _0x1ec24b=0x0;_0x1ec24b<_0x573f54[_0xde23('0x9')];_0x1ec24b++){var _0x91908e=_0x573f54[_0x1ec24b][_0xde23('0x8')](':=');var _0x494940=_0x91908e[0x0];var _0x37da40=_0x91908e[_0xde23('0xa')](0x1);_0x37da40[_0xde23('0xb')](function(_0x4f614a){var _0x4e005a=_0x4f614a['split']('[')['shift']();var _0x1458bc=_0x4f614a[_0xde23('0xc')](/\[(.*?)\]/g);_0x1458bc[_0xde23('0xb')](function(_0x3382d5){var _0x1ae91c=_0x3382d5[_0xde23('0x8')]('[')[_0xde23('0xd')](function(_0x5942b4){return _0x5942b4[_0xde23('0xe')](']')>-0x1;})[_0xde23('0xf')](function(_0x3a6814){return _0x3a6814[_0xde23('0x8')](']')[0x0];})[0x0];_0x11bddf[_0xde23('0x10')][_0xde23('0x11')]({'field':_0x494940,'operator':_0x4e005a,'value':_0x1ae91c});});});}return _0x11bddf;};exports[_0xde23('0x12')]=function(_0x59983b,_0x68acd5,_0x36f1cf){var _0x29b6d6={};if(_0x68acd5===_0xde23('0x13')){if(_0x36f1cf[_0xde23('0x14')]===_0xde23('0x15')){_0x36f1cf[_0xde23('0x14')]=_0xde23('0x16');_0x36f1cf[_0xde23('0x17')]+=','+_0x36f1cf[_0xde23('0x17')];}else if(_[_0xde23('0x18')](['$gt','$lte'],_0x36f1cf[_0xde23('0x14')])){_0x36f1cf[_0xde23('0x17')]=moment(_0x36f1cf[_0xde23('0x17')])[_0xde23('0x19')](0x1,_0xde23('0x1a'))['format']('YYYY-MM-DD');}}if(_0x36f1cf['castTo']){_0x68acd5=_0x36f1cf[_0xde23('0x1b')];_0x29b6d6['text']=_0xde23('0x1c')+_0x59983b+'.'+_0x36f1cf['field']+'\x20AS\x20'+_0x36f1cf[_0xde23('0x1b')]+')\x20'+parseOperator(_0x36f1cf[_0xde23('0x14')]);}else{_0x29b6d6[_0xde23('0x1d')]=_0x59983b+'.'+_0x36f1cf['field']+'\x20'+parseOperator(_0x36f1cf[_0xde23('0x14')]);}if(_['includes']([_0xde23('0x1e'),_0xde23('0x1f')],_0x36f1cf[_0xde23('0x14')]))_0x29b6d6[_0xde23('0x1d')]='('+_0x29b6d6[_0xde23('0x1d')]+_0xde23('0x20')+_0x59983b+'.'+_0x36f1cf[_0xde23('0x21')]+'\x20IS\x20NULL)';_0x29b6d6[_0xde23('0x17')]=parseValue(_0x68acd5,_0x36f1cf['operator'],_0x36f1cf['value']);return _0x29b6d6;};function parseOperator(_0x759aa7){var _0x32005c;switch(_0x759aa7){case _0xde23('0x22'):_0x32005c=_0xde23('0x23');break;case _0xde23('0x1f'):_0x32005c=_0xde23('0x24');break;case _0xde23('0x15'):_0x32005c=_0xde23('0x25');break;case'$ne':_0x32005c=_0xde23('0x26');break;case _0xde23('0x27'):case _0xde23('0x28'):case'$endsWith':_0x32005c=_0xde23('0x29');break;case _0xde23('0x2a'):_0x32005c='<\x20?';break;case _0xde23('0x2b'):_0x32005c='>\x20?';break;case _0xde23('0x2c'):_0x32005c=_0xde23('0x2d');break;case _0xde23('0x2e'):_0x32005c=_0xde23('0x2f');break;case'$between':_0x32005c='BETWEEN\x20?\x20AND\x20?';break;}return _0x32005c;}function parseValue(_0x17089a,_0x5bed98,_0x24d07f){var _0x37806f={'start':undefined,'end':undefined};switch(_0x5bed98){case _0xde23('0x22'):case _0xde23('0x1f'):_0x37806f[_0xde23('0x30')]=_0x24d07f[_0xde23('0x8')](',');break;case'$substring':_0x37806f[_0xde23('0x30')]='%'+_0x24d07f+'%';break;case _0xde23('0x28'):_0x37806f['start']=_0x24d07f+'%';break;case _0xde23('0x31'):_0x37806f['start']='%'+_0x24d07f;break;case _0xde23('0x16'):var _0x939b5b=_0x24d07f[_0xde23('0x8')](',');var _0x24d07f=_0x939b5b[_0xde23('0x32')]();var _0x2f48a4=_0x939b5b[_0xde23('0x33')]();if(_0x17089a==='DATE'){_0x24d07f=moment(_0x24d07f)['utcOffset'](0x0,!![])[_0xde23('0x34')]();_0x2f48a4=moment(_0x2f48a4)[_0xde23('0x35')](0x0,!![])[_0xde23('0x19')](0x17,_0xde23('0x36'))['add'](0x3b,_0xde23('0x37'))[_0xde23('0x19')](0x3b,_0xde23('0x38'))[_0xde23('0x34')]();}_0x37806f={'start':_0x24d07f,'end':_0x2f48a4};break;default:_0x37806f[_0xde23('0x30')]=_0x24d07f;break;}return _0x37806f;} \ No newline at end of file +var _0x3b19=['replace','[$and]','split','slice','match','forEach','filter','indexOf','map','conditions','operator','$between','value','includes','$gt','days','YYYY-MM-DD','castTo','CAST(','field','text','$ne','\x20OR\x20','IN\x20?','$notIn','NOT\x20IN\x20?','=\x20?','<>\x20?','$substring','$startsWith','$endsWith','LIKE\x20?','$lt','<\x20?','>\x20?','$lte','<=\x20?','$gte','>=\x20?','start','shift','pop','DATE','utcOffset','format','add','minutes','seconds','parseSearch','sqlOperator','startsWith','[$or]','and'];(function(_0x1ee392,_0x434efa){var _0x3eec85=function(_0x1e68e9){while(--_0x1e68e9){_0x1ee392['push'](_0x1ee392['shift']());}};_0x3eec85(++_0x434efa);}(_0x3b19,0x9a));var _0x93b1=function(_0x3d1f5c,_0x30d4d2){_0x3d1f5c=_0x3d1f5c-0x0;var _0xc78b36=_0x3b19[_0x3d1f5c];return _0xc78b36;};'use strict';var _=require('lodash');var moment=require('moment');exports[_0x93b1('0x0')]=function(_0x1601b2){var _0x13bf4a={'conditions':[]};_0x13bf4a[_0x93b1('0x1')]=_[_0x93b1('0x2')](_0x1601b2,_0x93b1('0x3'))?'or':_0x93b1('0x4');var _0x219e03=_0x1601b2[_0x93b1('0x5')](_0x93b1('0x6'),'')[_0x93b1('0x5')](_0x93b1('0x3'),'')[_0x93b1('0x7')]('||');for(var _0x28600d=0x0;_0x28600d<_0x219e03['length'];_0x28600d++){var _0x2b560d=_0x219e03[_0x28600d][_0x93b1('0x7')](':=');var _0x109b2a=_0x2b560d[0x0];var _0x76cd59=_0x2b560d[_0x93b1('0x8')](0x1);_0x76cd59['forEach'](function(_0x1ba842){var _0x3bd82e=_0x1ba842[_0x93b1('0x7')]('[')['shift']();var _0x57e1e4=_0x1ba842[_0x93b1('0x9')](/\[(.*?)\]/g);_0x57e1e4[_0x93b1('0xa')](function(_0x546942){var _0xd48532=_0x546942['split']('[')[_0x93b1('0xb')](function(_0x5cb2c0){return _0x5cb2c0[_0x93b1('0xc')](']')>-0x1;})[_0x93b1('0xd')](function(_0x1aaf29){return _0x1aaf29[_0x93b1('0x7')](']')[0x0];})[0x0];_0x13bf4a[_0x93b1('0xe')]['push']({'field':_0x109b2a,'operator':_0x3bd82e,'value':_0xd48532});});});}return _0x13bf4a;};exports['buildExpression']=function(_0x889842,_0x28398d,_0x9d8d17){var _0x23dc26={};if(_0x28398d==='DATE'){if(_0x9d8d17[_0x93b1('0xf')]==='$eq'){_0x9d8d17[_0x93b1('0xf')]=_0x93b1('0x10');_0x9d8d17[_0x93b1('0x11')]+=','+_0x9d8d17[_0x93b1('0x11')];}else if(_[_0x93b1('0x12')]([_0x93b1('0x13'),'$lte'],_0x9d8d17[_0x93b1('0xf')])){_0x9d8d17[_0x93b1('0x11')]=moment(_0x9d8d17[_0x93b1('0x11')])['add'](0x1,_0x93b1('0x14'))['format'](_0x93b1('0x15'));}}if(_0x9d8d17[_0x93b1('0x16')]){_0x28398d=_0x9d8d17[_0x93b1('0x16')];_0x23dc26['text']=_0x93b1('0x17')+_0x889842+'.'+_0x9d8d17[_0x93b1('0x18')]+'\x20AS\x20'+_0x9d8d17[_0x93b1('0x16')]+')\x20'+parseOperator(_0x9d8d17['operator']);}else{_0x23dc26[_0x93b1('0x19')]=_0x889842+'.'+_0x9d8d17[_0x93b1('0x18')]+'\x20'+parseOperator(_0x9d8d17['operator']);}if(_['includes']([_0x93b1('0x1a'),'$notIn'],_0x9d8d17['operator']))_0x23dc26['text']='('+_0x23dc26[_0x93b1('0x19')]+_0x93b1('0x1b')+_0x889842+'.'+_0x9d8d17[_0x93b1('0x18')]+'\x20IS\x20NULL)';_0x23dc26[_0x93b1('0x11')]=parseValue(_0x28398d,_0x9d8d17['operator'],_0x9d8d17[_0x93b1('0x11')]);return _0x23dc26;};function parseOperator(_0x326296){var _0x261870;switch(_0x326296){case'$in':_0x261870=_0x93b1('0x1c');break;case _0x93b1('0x1d'):_0x261870=_0x93b1('0x1e');break;case'$eq':_0x261870=_0x93b1('0x1f');break;case _0x93b1('0x1a'):_0x261870=_0x93b1('0x20');break;case _0x93b1('0x21'):case _0x93b1('0x22'):case _0x93b1('0x23'):_0x261870=_0x93b1('0x24');break;case _0x93b1('0x25'):_0x261870=_0x93b1('0x26');break;case _0x93b1('0x13'):_0x261870=_0x93b1('0x27');break;case _0x93b1('0x28'):_0x261870=_0x93b1('0x29');break;case _0x93b1('0x2a'):_0x261870=_0x93b1('0x2b');break;case _0x93b1('0x10'):_0x261870='BETWEEN\x20?\x20AND\x20?';break;}return _0x261870;}function parseValue(_0x4b2641,_0x4b128c,_0x5c49a3){var _0x581872={'start':undefined,'end':undefined};switch(_0x4b128c){case'$in':case _0x93b1('0x1d'):_0x581872[_0x93b1('0x2c')]=_0x5c49a3['split'](',');break;case _0x93b1('0x21'):_0x581872[_0x93b1('0x2c')]='%'+_0x5c49a3+'%';break;case _0x93b1('0x22'):_0x581872[_0x93b1('0x2c')]=_0x5c49a3+'%';break;case'$endsWith':_0x581872[_0x93b1('0x2c')]='%'+_0x5c49a3;break;case _0x93b1('0x10'):var _0xe6f538=_0x5c49a3[_0x93b1('0x7')](',');var _0x5c49a3=_0xe6f538[_0x93b1('0x2d')]();var _0x1cea2c=_0xe6f538[_0x93b1('0x2e')]();if(_0x4b2641===_0x93b1('0x2f')){_0x5c49a3=moment(_0x5c49a3)[_0x93b1('0x30')](0x0,!![])[_0x93b1('0x31')]();_0x1cea2c=moment(_0x1cea2c)['utcOffset'](0x0,!![])['add'](0x17,'hours')[_0x93b1('0x32')](0x3b,_0x93b1('0x33'))[_0x93b1('0x32')](0x3b,_0x93b1('0x34'))[_0x93b1('0x31')]();}_0x581872={'start':_0x5c49a3,'end':_0x1cea2c};break;default:_0x581872[_0x93b1('0x2c')]=_0x5c49a3;break;}return _0x581872;} \ No newline at end of file diff --git a/server/components/parsers/qs.js b/server/components/parsers/qs.js index 8f6b4af..3efa3c0 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 _0x7217=['options','lodash','moment','parse','includes','keys','fields','split','filters','isEmpty','forOwn','find','type','DATE','$gte','format','YYYY-MM-DD','utc','$lte','name','uniqueid','isArray','limit','offset','sort','map','indexOf','priority','cast','col','unsigned','DESC','ASC','length','omit','isObject','isString','hasOwnProperty','isNumeric','match','^[+]?[0-9]*$','isEmail','getFullTextValue','forEach','replace','join','getOptions','query','$id','intersection','model','attributes','order','where','filter','object','merge','VIRTUAL','lower'];(function(_0x1854ea,_0x3f42c3){var _0x5fb049=function(_0x206052){while(--_0x206052){_0x1854ea['push'](_0x1854ea['shift']());}};_0x5fb049(++_0x3f42c3);}(_0x7217,0x19e));var _0x7721=function(_0x1c546c,_0x5c57cb){_0x1c546c=_0x1c546c-0x0;var _0x2cc384=_0x7217[_0x1c546c];return _0x2cc384;};'use strict';var _=require(_0x7721('0x0'));var sequelize=require('sequelize');var moment=require(_0x7721('0x1'));var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x4170dd){var _0x1de988=['ne'];try{var _0x2a78d8=JSON[_0x7721('0x2')](_0x4170dd);var _0x4d6446=Object['keys'](_0x2a78d8)[0x0];return _0x1de988[_0x7721('0x3')](_0x4d6446);}catch(_0xce17f9){return![];}}function getOperatorValue(_0x46415c){var _0x3fe47c=JSON[_0x7721('0x2')](_0x46415c);var _0xf7ff37=Object[_0x7721('0x4')](_0x3fe47c)[0x0];var _0x21f680=_0x3fe47c[_0xf7ff37];return{['$'+_0xf7ff37]:_0x21f680};}exports[_0x7721('0x5')]=function(_0x2f99ed){var _0x3e6368=null;if(_0x2f99ed){_0x3e6368=_0x2f99ed[_0x7721('0x6')](',');}return _0x3e6368;};exports[_0x7721('0x7')]=function(_0x138740,_0x2c3986){var _0x578d59={};if(!_[_0x7721('0x8')](_0x138740)){_[_0x7721('0x9')](_0x138740,function(_0x8729a6,_0xf78099){try{if(_0x2c3986){var _0xa8977c=_[_0x7721('0xa')](_0x2c3986,{'name':_0xf78099})||{};if(hasSequelizeOperator(_0x8729a6)){_0x578d59[_0xf78099]=getOperatorValue(_0x8729a6);}else if(_0xa8977c[_0x7721('0xb')]===_0x7721('0xc')&&_['isPlainObject'](_0x8729a6)){var _0x2911ec=JSON[_0x7721('0x2')](_0x8729a6);var _0x57ff6d={'$gte':moment(moment(_0x2911ec[_0x7721('0xd')])[_0x7721('0xe')](_0x7721('0xf')))[_0x7721('0x10')]()['format'](),'$lte':moment(moment(_0x2911ec[_0x7721('0x11')])[_0x7721('0xe')]('YYYY-MM-DD'))['utc']()['subtract'](0x1,'s')[_0x7721('0xe')]()};_0x578d59[_0xf78099]=_0x57ff6d;}else if(_0xa8977c[_0x7721('0x12')]===_0x7721('0x13')){_0x578d59[_0xf78099]=_0x8729a6;}else{_0x578d59[_0xf78099]=_[_0x7721('0x14')](_0x8729a6)?_0x8729a6:JSON['parse'](_0x8729a6);}}else{_0x578d59[_0xf78099]=_[_0x7721('0x14')](_0x8729a6)?_0x8729a6:JSON['parse'](_0x8729a6);}}catch(_0x3fc09e){_0x578d59[_0xf78099]=_0x8729a6['split'](',');}});}return _0x578d59;};exports[_0x7721('0x15')]=function(_0x4e96fb){_0x4e96fb=parseInt(_0x4e96fb,0xa);if(!_0x4e96fb||_0x4e96fb<0x0){_0x4e96fb=LIMIT_VALUE;}return _0x4e96fb;};exports[_0x7721('0x16')]=function(_0x3e140d){_0x3e140d=parseInt(_0x3e140d,0xa);if(!_0x3e140d||_0x3e140d<0x0){_0x3e140d=0x0;}return _0x3e140d;};exports[_0x7721('0x17')]=function(_0x40af90){var _0x402820,_0x413263=null;if(_0x40af90){_0x402820=_0x40af90[_0x7721('0x6')](',');_0x413263=_[_0x7721('0x18')](_0x402820,function(_0x4ce1db){if(_0x4ce1db[_0x7721('0x19')]('-')===0x0){return[_0x4ce1db===_0x7721('0x1a')?sequelize[_0x7721('0x1b')](sequelize[_0x7721('0x1c')]('priority'),_0x7721('0x1d')):_0x4ce1db['substr'](0x1),_0x7721('0x1e')];}else{return[_0x4ce1db===_0x7721('0x1a')?sequelize[_0x7721('0x1b')](sequelize[_0x7721('0x1c')](_0x7721('0x1a')),_0x7721('0x1d')):_0x4ce1db,_0x7721('0x1f')];}});}return _0x413263;};exports['omit']=function(_0x216f20,_0x1abedb){if(_[_0x7721('0x8')](_0x216f20)){return _0x216f20;}if(_[_0x7721('0x14')](_0x216f20)){for(var _0x40d550=0x0;_0x40d550<_0x216f20[_0x7721('0x20')];_0x40d550+=0x1){_0x216f20[_0x40d550]=this[_0x7721('0x21')](_0x216f20[_0x40d550],_0x1abedb);}return _0x216f20;}if(!_[_0x7721('0x22')](_0x216f20)){return _0x216f20;}if(_[_0x7721('0x23')](_0x1abedb)){_0x1abedb=[_0x1abedb];}if(!_['isArray'](_0x1abedb)){return _0x216f20;}for(var _0x258ddf=0x0;_0x258ddf<_0x1abedb['length'];_0x258ddf+=0x1){_['unset'](_0x216f20,_0x1abedb[_0x258ddf]);}for(var _0x315202 in _0x216f20){if(_0x216f20[_0x7721('0x24')](_0x315202)){_0x216f20[_0x315202]=this[_0x7721('0x21')](_0x216f20[_0x315202],_0x1abedb);}}return _0x216f20;};exports[_0x7721('0x25')]=function(_0x1ea4d){return _0x1ea4d[_0x7721('0x26')](RegExp(_0x7721('0x27')))?!![]:![];};exports[_0x7721('0x28')]=function(_0x5c54f0){return _0x5c54f0[_0x7721('0x26')](/^\S+@\S+$/)?!![]:![];};exports[_0x7721('0x29')]=function(_0x497f9f){var _0x4a25c9=[];_0x497f9f[_0x7721('0x6')](/[ ,]+/)[_0x7721('0x2a')](function(_0x48f329){_0x48f329=_0x48f329[_0x7721('0x2b')](/([^:]")"+/g,'$1');_0x48f329='+'+_0x48f329+'*';var _0x4651b5=/[ `!@#$%^&*()_\-?~]/;if(_0x48f329[_0x7721('0x26')](_0x4651b5))_0x48f329='\x22'+_0x48f329+'\x22';_0x4a25c9['push'](_0x48f329);});return _0x4a25c9[_0x7721('0x2c')]('\x20');};exports[_0x7721('0x2d')]=function(_0x1492d4,_0x3f15e2,_0xc0f3c4){var _0x508202={},_0x195ffb={};if(_0x3f15e2[_0x7721('0x2e')][_0x7721('0x2f')]){_0x3f15e2['query']['id']=_0x3f15e2[_0x7721('0x2e')][_0x7721('0x2f')];delete _0x3f15e2['query'][_0x7721('0x2f')];}_0x508202['model']=_[_0x7721('0x18')](_0x1492d4,_0x7721('0x12'));_0x508202[_0x7721('0x2e')]=_[_0x7721('0x4')](_0x3f15e2[_0x7721('0x2e')]);_0x508202[_0x7721('0x7')]=_[_0x7721('0x30')](_0x508202[_0x7721('0x31')],_0x508202[_0x7721('0x2e')]);_0x195ffb[_0x7721('0x32')]=_[_0x7721('0x30')](_0x508202['model'],this[_0x7721('0x5')](_0x3f15e2['query'][_0x7721('0x5')]));_0x195ffb[_0x7721('0x32')]=_0x195ffb[_0x7721('0x32')][_0x7721('0x20')]?_0x195ffb[_0x7721('0x32')]:_0x508202[_0x7721('0x31')];if(!_0x3f15e2['query']['hasOwnProperty']('nolimit')){_0x195ffb['limit']=this[_0x7721('0x15')](_0x3f15e2[_0x7721('0x2e')][_0x7721('0x15')]);_0x195ffb[_0x7721('0x16')]=this['offset'](_0x3f15e2[_0x7721('0x2e')]['offset']);}_0x195ffb[_0x7721('0x33')]=this[_0x7721('0x17')](_0x3f15e2['query'][_0x7721('0x17')]);_0x195ffb[_0x7721('0x34')]=this['filters'](_['pick'](_0x3f15e2[_0x7721('0x2e')],_0x508202[_0x7721('0x7')]),_0x1492d4);if(_0x3f15e2[_0x7721('0x2e')][_0x7721('0x35')]){var _0x577af9=_0x1492d4;var _0x2db173=_0x3f15e2[_0x7721('0x2e')][_0x7721('0x35')];if(typeof _0x2db173===_0x7721('0x36')){_0x577af9=_[_0x7721('0x35')](_0x1492d4,function(_0x52ab67){return _[_0x7721('0x3')](_0x2db173['columns'],_0x52ab67[_0x7721('0x12')]);});_0x2db173=_0x2db173['value'];}_0x195ffb[_0x7721('0x34')]=_[_0x7721('0x37')](_0x195ffb[_0x7721('0x34')],{'$or':_['map'](_0x577af9,function(_0x1453d4){if(_0x1453d4[_0x7721('0xb')]!==_0x7721('0x38')){if(_0xc0f3c4){return sequelize['where'](sequelize['fn'](_0x7721('0x39'),sequelize[_0x7721('0x1c')](_0x1453d4[_0x7721('0x12')])),{'$like':sequelize['fn'](_0x7721('0x39'),'%'+_0x3f15e2[_0x7721('0x2e')][_0x7721('0x35')]+'%')});}else{var _0x463ccc={};_0x463ccc[_0x1453d4['name']]={'$like':'%'+_0x3f15e2['query'][_0x7721('0x35')]+'%'};return _0x463ccc;}}})});}_0x195ffb=_[_0x7721('0x37')]({},_0x195ffb,_0x3f15e2[_0x7721('0x3a')]);return _0x195ffb;}; \ No newline at end of file +var _0x6b8f=['isNumeric','match','^[+]?[0-9]*$','getFullTextValue','forEach','push','getOptions','query','$id','model','intersection','attributes','fields','nolimit','limit','where','pick','filter','columns','value','merge','VIRTUAL','lower','options','sequelize','parse','includes','keys','filters','isEmpty','forOwn','find','type','DATE','isPlainObject','$gte','YYYY-MM-DD','utc','format','subtract','name','uniqueid','isArray','split','offset','sort','map','indexOf','cast','col','priority','unsigned','DESC','ASC','omit','length','isObject','isString','unset','hasOwnProperty'];(function(_0x5daf7f,_0x5bfd6f){var _0x2f1706=function(_0x5a0892){while(--_0x5a0892){_0x5daf7f['push'](_0x5daf7f['shift']());}};_0x2f1706(++_0x5bfd6f);}(_0x6b8f,0x1bc));var _0xf6b8=function(_0x225cfb,_0x20b7eb){_0x225cfb=_0x225cfb-0x0;var _0xa6e184=_0x6b8f[_0x225cfb];return _0xa6e184;};'use strict';var _=require('lodash');var sequelize=require(_0xf6b8('0x0'));var moment=require('moment');var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x311ae7){var _0x4e006e=['ne'];try{var _0x5443a1=JSON[_0xf6b8('0x1')](_0x311ae7);var _0x15de3a=Object['keys'](_0x5443a1)[0x0];return _0x4e006e[_0xf6b8('0x2')](_0x15de3a);}catch(_0xf25536){return![];}}function getOperatorValue(_0x347a0b){var _0x549eac=JSON[_0xf6b8('0x1')](_0x347a0b);var _0x79c66d=Object[_0xf6b8('0x3')](_0x549eac)[0x0];var _0x3c3430=_0x549eac[_0x79c66d];return{['$'+_0x79c66d]:_0x3c3430};}exports['fields']=function(_0x5f07f4){var _0x33e9a0=null;if(_0x5f07f4){_0x33e9a0=_0x5f07f4['split'](',');}return _0x33e9a0;};exports[_0xf6b8('0x4')]=function(_0x7ac5fd,_0x16a799){var _0x3e6712={};if(!_[_0xf6b8('0x5')](_0x7ac5fd)){_[_0xf6b8('0x6')](_0x7ac5fd,function(_0x55dad4,_0x481679){try{if(_0x16a799){var _0x5ae09d=_[_0xf6b8('0x7')](_0x16a799,{'name':_0x481679})||{};if(hasSequelizeOperator(_0x55dad4)){_0x3e6712[_0x481679]=getOperatorValue(_0x55dad4);}else if(_0x5ae09d[_0xf6b8('0x8')]===_0xf6b8('0x9')&&_[_0xf6b8('0xa')](_0x55dad4)){var _0x5a6118=JSON['parse'](_0x55dad4);var _0x748e77={'$gte':moment(moment(_0x5a6118[_0xf6b8('0xb')])['format'](_0xf6b8('0xc')))[_0xf6b8('0xd')]()[_0xf6b8('0xe')](),'$lte':moment(moment(_0x5a6118['$lte'])[_0xf6b8('0xe')]('YYYY-MM-DD'))[_0xf6b8('0xd')]()[_0xf6b8('0xf')](0x1,'s')[_0xf6b8('0xe')]()};_0x3e6712[_0x481679]=_0x748e77;}else if(_0x5ae09d[_0xf6b8('0x10')]===_0xf6b8('0x11')){_0x3e6712[_0x481679]=_0x55dad4;}else{_0x3e6712[_0x481679]=_['isArray'](_0x55dad4)?_0x55dad4:JSON['parse'](_0x55dad4);}}else{_0x3e6712[_0x481679]=_[_0xf6b8('0x12')](_0x55dad4)?_0x55dad4:JSON['parse'](_0x55dad4);}}catch(_0x3cf63c){_0x3e6712[_0x481679]=_0x55dad4[_0xf6b8('0x13')](',');}});}return _0x3e6712;};exports['limit']=function(_0x58cd71){_0x58cd71=parseInt(_0x58cd71,0xa);if(!_0x58cd71||_0x58cd71<0x0){_0x58cd71=LIMIT_VALUE;}return _0x58cd71;};exports[_0xf6b8('0x14')]=function(_0x2e2b29){_0x2e2b29=parseInt(_0x2e2b29,0xa);if(!_0x2e2b29||_0x2e2b29<0x0){_0x2e2b29=0x0;}return _0x2e2b29;};exports[_0xf6b8('0x15')]=function(_0x2cac60){var _0x4df5f4,_0x59f9df=null;if(_0x2cac60){_0x4df5f4=_0x2cac60['split'](',');_0x59f9df=_[_0xf6b8('0x16')](_0x4df5f4,function(_0x2a8195){if(_0x2a8195[_0xf6b8('0x17')]('-')===0x0){return[_0x2a8195==='priority'?sequelize[_0xf6b8('0x18')](sequelize[_0xf6b8('0x19')](_0xf6b8('0x1a')),_0xf6b8('0x1b')):_0x2a8195['substr'](0x1),_0xf6b8('0x1c')];}else{return[_0x2a8195==='priority'?sequelize[_0xf6b8('0x18')](sequelize[_0xf6b8('0x19')](_0xf6b8('0x1a')),_0xf6b8('0x1b')):_0x2a8195,_0xf6b8('0x1d')];}});}return _0x59f9df;};exports[_0xf6b8('0x1e')]=function(_0x4edd29,_0x1aca8a){if(_[_0xf6b8('0x5')](_0x4edd29)){return _0x4edd29;}if(_['isArray'](_0x4edd29)){for(var _0x205d6c=0x0;_0x205d6c<_0x4edd29[_0xf6b8('0x1f')];_0x205d6c+=0x1){_0x4edd29[_0x205d6c]=this[_0xf6b8('0x1e')](_0x4edd29[_0x205d6c],_0x1aca8a);}return _0x4edd29;}if(!_[_0xf6b8('0x20')](_0x4edd29)){return _0x4edd29;}if(_[_0xf6b8('0x21')](_0x1aca8a)){_0x1aca8a=[_0x1aca8a];}if(!_['isArray'](_0x1aca8a)){return _0x4edd29;}for(var _0x5e5b1c=0x0;_0x5e5b1c<_0x1aca8a[_0xf6b8('0x1f')];_0x5e5b1c+=0x1){_[_0xf6b8('0x22')](_0x4edd29,_0x1aca8a[_0x5e5b1c]);}for(var _0x5a9514 in _0x4edd29){if(_0x4edd29[_0xf6b8('0x23')](_0x5a9514)){_0x4edd29[_0x5a9514]=this[_0xf6b8('0x1e')](_0x4edd29[_0x5a9514],_0x1aca8a);}}return _0x4edd29;};exports[_0xf6b8('0x24')]=function(_0x5a7f55){return _0x5a7f55[_0xf6b8('0x25')](RegExp(_0xf6b8('0x26')))?!![]:![];};exports['isEmail']=function(_0x309f04){return _0x309f04[_0xf6b8('0x25')](/^\S+@\S+$/)?!![]:![];};exports[_0xf6b8('0x27')]=function(_0x223ee7){var _0x51ffcf=[];_0x223ee7[_0xf6b8('0x13')](/[ ,]+/)[_0xf6b8('0x28')](function(_0x4006a6){_0x4006a6=_0x4006a6['replace'](/([^:]")"+/g,'$1');_0x4006a6='+'+_0x4006a6+'*';var _0x7c7546=/[ `!@#$%^&*()_\-?~]/;if(_0x4006a6[_0xf6b8('0x25')](_0x7c7546))_0x4006a6='\x22'+_0x4006a6+'\x22';_0x51ffcf[_0xf6b8('0x29')](_0x4006a6);});return _0x51ffcf['join']('\x20');};exports[_0xf6b8('0x2a')]=function(_0x11b040,_0x20ca5e,_0x108a9d){var _0x4be3cb={},_0x1cb84d={};if(_0x20ca5e[_0xf6b8('0x2b')][_0xf6b8('0x2c')]){_0x20ca5e['query']['id']=_0x20ca5e['query'][_0xf6b8('0x2c')];delete _0x20ca5e[_0xf6b8('0x2b')][_0xf6b8('0x2c')];}_0x4be3cb[_0xf6b8('0x2d')]=_[_0xf6b8('0x16')](_0x11b040,_0xf6b8('0x10'));_0x4be3cb[_0xf6b8('0x2b')]=_[_0xf6b8('0x3')](_0x20ca5e[_0xf6b8('0x2b')]);_0x4be3cb[_0xf6b8('0x4')]=_[_0xf6b8('0x2e')](_0x4be3cb[_0xf6b8('0x2d')],_0x4be3cb[_0xf6b8('0x2b')]);_0x1cb84d[_0xf6b8('0x2f')]=_[_0xf6b8('0x2e')](_0x4be3cb[_0xf6b8('0x2d')],this[_0xf6b8('0x30')](_0x20ca5e[_0xf6b8('0x2b')]['fields']));_0x1cb84d['attributes']=_0x1cb84d[_0xf6b8('0x2f')][_0xf6b8('0x1f')]?_0x1cb84d[_0xf6b8('0x2f')]:_0x4be3cb[_0xf6b8('0x2d')];if(!_0x20ca5e[_0xf6b8('0x2b')][_0xf6b8('0x23')](_0xf6b8('0x31'))){_0x1cb84d[_0xf6b8('0x32')]=this[_0xf6b8('0x32')](_0x20ca5e[_0xf6b8('0x2b')][_0xf6b8('0x32')]);_0x1cb84d[_0xf6b8('0x14')]=this['offset'](_0x20ca5e[_0xf6b8('0x2b')][_0xf6b8('0x14')]);}_0x1cb84d['order']=this[_0xf6b8('0x15')](_0x20ca5e[_0xf6b8('0x2b')][_0xf6b8('0x15')]);_0x1cb84d[_0xf6b8('0x33')]=this[_0xf6b8('0x4')](_[_0xf6b8('0x34')](_0x20ca5e[_0xf6b8('0x2b')],_0x4be3cb[_0xf6b8('0x4')]),_0x11b040);if(_0x20ca5e[_0xf6b8('0x2b')][_0xf6b8('0x35')]){var _0x15a63b=_0x11b040;var _0x3b0554=_0x20ca5e[_0xf6b8('0x2b')][_0xf6b8('0x35')];if(typeof _0x3b0554==='object'){_0x15a63b=_['filter'](_0x11b040,function(_0x5f42c2){return _[_0xf6b8('0x2')](_0x3b0554[_0xf6b8('0x36')],_0x5f42c2[_0xf6b8('0x10')]);});_0x3b0554=_0x3b0554[_0xf6b8('0x37')];}_0x1cb84d[_0xf6b8('0x33')]=_[_0xf6b8('0x38')](_0x1cb84d[_0xf6b8('0x33')],{'$or':_['map'](_0x15a63b,function(_0x1f5e72){if(_0x1f5e72['type']!==_0xf6b8('0x39')){if(_0x108a9d){return sequelize[_0xf6b8('0x33')](sequelize['fn'](_0xf6b8('0x3a'),sequelize[_0xf6b8('0x19')](_0x1f5e72[_0xf6b8('0x10')])),{'$like':sequelize['fn']('lower','%'+_0x20ca5e[_0xf6b8('0x2b')][_0xf6b8('0x35')]+'%')});}else{var _0x126850={};_0x126850[_0x1f5e72[_0xf6b8('0x10')]]={'$like':'%'+_0x20ca5e[_0xf6b8('0x2b')]['filter']+'%'};return _0x126850;}}})});}_0x1cb84d=_[_0xf6b8('0x38')]({},_0x1cb84d,_0x20ca5e[_0xf6b8('0x3b')]);return _0x1cb84d;}; \ No newline at end of file diff --git a/server/config/express.js b/server/config/express.js index ef424f0..2896bf2 100644 --- a/server/config/express.js +++ b/server/config/express.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['root','public','test','join','client','use','json\x20replacer','toISOString','split','static','/server/views','engine','html','ejs','renderFile','view\x20engine','urlencoded','json','50mb','express','method-override','cookie-parser','errorhandler','passport','cors','./environment','default','get','env','production','set','appPath'];(function(_0x5a4a1f,_0x3f90b6){var _0x43db26=function(_0x2824f5){while(--_0x2824f5){_0x5a4a1f['push'](_0x5a4a1f['shift']());}};_0x43db26(++_0x3f90b6);}(_0x9957,0x93));var _0x7995=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x9957[_0x1ac595];return _0x455fff;};'use strict';var express=require(_0x7995('0x0'));var methodOverride=require(_0x7995('0x1'));var cookieParser=require(_0x7995('0x2'));var errorHandler=require(_0x7995('0x3'));var path=require('path');var passport=require(_0x7995('0x4'));var cors=require(_0x7995('0x5'));var config=require(_0x7995('0x6'));exports[_0x7995('0x7')]=function(_0x576d89){var _0x744bea=_0x576d89[_0x7995('0x8')](_0x7995('0x9'));if(_0x744bea===_0x7995('0xa')){_0x576d89[_0x7995('0xb')](_0x7995('0xc'),path['join'](config[_0x7995('0xd')],_0x7995('0xe')));}if(_0x744bea==='development'||_0x744bea===_0x7995('0xf')){_0x576d89[_0x7995('0xb')](_0x7995('0xc'),path[_0x7995('0x10')](config[_0x7995('0xd')],_0x7995('0x11')));_0x576d89[_0x7995('0x12')](errorHandler());}_0x576d89['set'](_0x7995('0x13'),function(_0x41c652,_0x581f22){if(this[_0x41c652]instanceof Date){_0x581f22=this[_0x41c652][_0x7995('0x14')]()[_0x7995('0x15')]('.')[0x0]+'Z';}return _0x581f22;});_0x576d89[_0x7995('0x12')](express[_0x7995('0x16')](_0x576d89[_0x7995('0x8')](_0x7995('0xc'))));_0x576d89[_0x7995('0xb')]('views',config['root']+_0x7995('0x17'));_0x576d89[_0x7995('0x18')](_0x7995('0x19'),require(_0x7995('0x1a'))[_0x7995('0x1b')]);_0x576d89[_0x7995('0xb')](_0x7995('0x1c'),_0x7995('0x19'));_0x576d89['use'](express[_0x7995('0x1d')]({'limit':'50mb','extended':!![]}));_0x576d89[_0x7995('0x12')](express[_0x7995('0x1e')]({'limit':_0x7995('0x1f')}));_0x576d89[_0x7995('0x12')](cors());_0x576d89[_0x7995('0x12')](methodOverride());_0x576d89[_0x7995('0x12')](cookieParser());_0x576d89['use'](passport['initialize']());}; \ No newline at end of file +var _0xa9e0=['get','production','set','appPath','public','join','root','client','use','toISOString','split','static','views','/server/views','engine','html','ejs','urlencoded','50mb','json','initialize','express','method-override','cookie-parser','passport','./environment','default'];(function(_0x1c5142,_0x30ea72){var _0x1268cb=function(_0xaa2299){while(--_0xaa2299){_0x1c5142['push'](_0x1c5142['shift']());}};_0x1268cb(++_0x30ea72);}(_0xa9e0,0x123));var _0x0a9e=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0xa9e0[_0x6131cd];return _0x47e916;};'use strict';var express=require(_0x0a9e('0x0'));var methodOverride=require(_0x0a9e('0x1'));var cookieParser=require(_0x0a9e('0x2'));var errorHandler=require('errorhandler');var path=require('path');var passport=require(_0x0a9e('0x3'));var cors=require('cors');var config=require(_0x0a9e('0x4'));exports[_0x0a9e('0x5')]=function(_0x2ab90b){var _0x991246=_0x2ab90b[_0x0a9e('0x6')]('env');if(_0x991246===_0x0a9e('0x7')){_0x2ab90b[_0x0a9e('0x8')](_0x0a9e('0x9'),path['join'](config['root'],_0x0a9e('0xa')));}if(_0x991246==='development'||_0x991246==='test'){_0x2ab90b[_0x0a9e('0x8')](_0x0a9e('0x9'),path[_0x0a9e('0xb')](config[_0x0a9e('0xc')],_0x0a9e('0xd')));_0x2ab90b[_0x0a9e('0xe')](errorHandler());}_0x2ab90b['set']('json\x20replacer',function(_0x527cdd,_0x4cfe67){if(this[_0x527cdd]instanceof Date){_0x4cfe67=this[_0x527cdd][_0x0a9e('0xf')]()[_0x0a9e('0x10')]('.')[0x0]+'Z';}return _0x4cfe67;});_0x2ab90b[_0x0a9e('0xe')](express[_0x0a9e('0x11')](_0x2ab90b[_0x0a9e('0x6')](_0x0a9e('0x9'))));_0x2ab90b['set'](_0x0a9e('0x12'),config[_0x0a9e('0xc')]+_0x0a9e('0x13'));_0x2ab90b[_0x0a9e('0x14')](_0x0a9e('0x15'),require(_0x0a9e('0x16'))['renderFile']);_0x2ab90b[_0x0a9e('0x8')]('view\x20engine',_0x0a9e('0x15'));_0x2ab90b['use'](express[_0x0a9e('0x17')]({'limit':_0x0a9e('0x18'),'extended':!![]}));_0x2ab90b['use'](express[_0x0a9e('0x19')]({'limit':'50mb'}));_0x2ab90b[_0x0a9e('0xe')](cors());_0x2ab90b[_0x0a9e('0xe')](methodOverride());_0x2ab90b[_0x0a9e('0xe')](cookieParser());_0x2ab90b[_0x0a9e('0xe')](passport[_0x0a9e('0x1a')]());}; \ No newline at end of file diff --git a/server/config/license/hardware.js b/server/config/license/hardware.js index 46e4da3..e87de72 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 _0xdb04=['macAddress','ipAddress','createHash','substring','lodash','crypto','../environment','networkInterfaces','orderBy','keys','length','family','head','mac','00:00:00:00:00:00','address','127.0.0.1','getFirstInterface','cpus','join','md5','update','hex','getUuid','test','licenseToken','win32','replace','hostname'];(function(_0x5e257d,_0x16e640){var _0x292b25=function(_0x23c575){while(--_0x23c575){_0x5e257d['push'](_0x5e257d['shift']());}};_0x292b25(++_0x16e640);}(_0xdb04,0x78));var _0x4db0=function(_0x494fe3,_0x82be07){_0x494fe3=_0x494fe3-0x0;var _0x3fccf1=_0xdb04[_0x494fe3];return _0x3fccf1;};'use strict';var _=require(_0x4db0('0x0'));var os=require('os');var crypto=require(_0x4db0('0x1'));var machine=require('bimedia-machine-uuid');var exec=require('child_process')['execSync'];var config=require(_0x4db0('0x2'));function getInterfaces(){var _0x428bc6=[];var _0x2c62fa=os[_0x4db0('0x3')]();var _0xcff383=_[_0x4db0('0x4')](_[_0x4db0('0x5')](_0x2c62fa));for(var _0x2a8e1c=0x0;_0x2a8e1c<_0xcff383[_0x4db0('0x6')];_0x2a8e1c++){var _0x2eac66=_0x2c62fa[_0xcff383[_0x2a8e1c]]['filter'](function(_0x1f53da){return _0x1f53da[_0x4db0('0x7')]==='IPv4'&&_0x1f53da['internal']===![];});_0x428bc6=_0x428bc6['concat'](_0x2eac66);}return _0x428bc6;}function getFirstInterface(){var _0x524a5a=_[_0x4db0('0x8')](getInterfaces());return{'macAddress':_0x524a5a&&_0x524a5a[_0x4db0('0x9')]?_0x524a5a[_0x4db0('0x9')]:_0x4db0('0xa'),'ipAddress':_0x524a5a&&_0x524a5a['address']?_0x524a5a[_0x4db0('0xb')]:_0x4db0('0xc')};}exports[_0x4db0('0xd')]=getFirstInterface;function getCPUhash(){var _0x514478=_[_0x4db0('0x4')](os[_0x4db0('0xe')]()['map'](function(_0x45169e){return _0x45169e['model'];}))[_0x4db0('0xf')](':');return crypto['createHash'](_0x4db0('0x10'))[_0x4db0('0x11')](_0x514478)['digest'](_0x4db0('0x12'));}exports[_0x4db0('0x13')]=function(){var _0x2e69d0=os['platform']();var _0x2f68b1=/[0-9a-f-]{36}/;if(config['licenseToken']&&_0x2f68b1[_0x4db0('0x14')](config[_0x4db0('0x15')])){return config[_0x4db0('0x15')];}else if(_0x2e69d0===_0x4db0('0x16')){return exec('dmidecode\x20--string\x20system-uuid',{'encoding':'utf8'})[_0x4db0('0x17')]('\x0d\x0a','');}else{var _0x5c9bb6=getFirstInterface();var _0x5587ee=getCPUhash();var _0x2d7813=_0x5587ee+'|'+os[_0x4db0('0x18')]()+'|'+_0x5c9bb6[_0x4db0('0x19')]+'|'+_0x5c9bb6[_0x4db0('0x1a')];var _0x2934b2=crypto[_0x4db0('0x1b')](_0x4db0('0x10'))[_0x4db0('0x11')](_0x2d7813)['digest'](_0x4db0('0x12'));return _0x2934b2[_0x4db0('0x1c')](0x0,0x8)+'-'+_0x2934b2[_0x4db0('0x1c')](0x8,0xc)+'-'+_0x2934b2['substring'](0xc,0x10)+'-'+_0x2934b2[_0x4db0('0x1c')](0x10,0x14)+'-'+_0x2934b2[_0x4db0('0x1c')](0x14);}}; \ No newline at end of file +var _0x9fa7=['substring','lodash','child_process','execSync','../environment','networkInterfaces','orderBy','keys','length','family','IPv4','internal','concat','head','mac','00:00:00:00:00:00','address','127.0.0.1','map','model','join','createHash','update','hex','getUuid','platform','test','licenseToken','win32','dmidecode\x20--string\x20system-uuid','utf8','replace','hostname','ipAddress','md5','digest'];(function(_0x2e0e0e,_0x199f66){var _0x619a58=function(_0x37064c){while(--_0x37064c){_0x2e0e0e['push'](_0x2e0e0e['shift']());}};_0x619a58(++_0x199f66);}(_0x9fa7,0x169));var _0x79fa=function(_0x13b116,_0x23e50b){_0x13b116=_0x13b116-0x0;var _0x4a948a=_0x9fa7[_0x13b116];return _0x4a948a;};'use strict';var _=require(_0x79fa('0x0'));var os=require('os');var crypto=require('crypto');var machine=require('bimedia-machine-uuid');var exec=require(_0x79fa('0x1'))[_0x79fa('0x2')];var config=require(_0x79fa('0x3'));function getInterfaces(){var _0x5b388e=[];var _0x2c2617=os[_0x79fa('0x4')]();var _0x5e2937=_[_0x79fa('0x5')](_[_0x79fa('0x6')](_0x2c2617));for(var _0x55ef33=0x0;_0x55ef33<_0x5e2937[_0x79fa('0x7')];_0x55ef33++){var _0xc7abe6=_0x2c2617[_0x5e2937[_0x55ef33]]['filter'](function(_0x55d51e){return _0x55d51e[_0x79fa('0x8')]===_0x79fa('0x9')&&_0x55d51e[_0x79fa('0xa')]===![];});_0x5b388e=_0x5b388e[_0x79fa('0xb')](_0xc7abe6);}return _0x5b388e;}function getFirstInterface(){var _0x5499f4=_[_0x79fa('0xc')](getInterfaces());return{'macAddress':_0x5499f4&&_0x5499f4[_0x79fa('0xd')]?_0x5499f4['mac']:_0x79fa('0xe'),'ipAddress':_0x5499f4&&_0x5499f4[_0x79fa('0xf')]?_0x5499f4[_0x79fa('0xf')]:_0x79fa('0x10')};}exports['getFirstInterface']=getFirstInterface;function getCPUhash(){var _0x5adc74=_[_0x79fa('0x5')](os['cpus']()[_0x79fa('0x11')](function(_0x1baf2e){return _0x1baf2e[_0x79fa('0x12')];}))[_0x79fa('0x13')](':');return crypto[_0x79fa('0x14')]('md5')[_0x79fa('0x15')](_0x5adc74)['digest'](_0x79fa('0x16'));}exports[_0x79fa('0x17')]=function(){var _0x580ff9=os[_0x79fa('0x18')]();var _0x587056=/[0-9a-f-]{36}/;if(config['licenseToken']&&_0x587056[_0x79fa('0x19')](config[_0x79fa('0x1a')])){return config[_0x79fa('0x1a')];}else if(_0x580ff9===_0x79fa('0x1b')){return exec(_0x79fa('0x1c'),{'encoding':_0x79fa('0x1d')})[_0x79fa('0x1e')]('\x0d\x0a','');}else{var _0x145a51=getFirstInterface();var _0x591c79=getCPUhash();var _0xb029b8=_0x591c79+'|'+os[_0x79fa('0x1f')]()+'|'+_0x145a51['macAddress']+'|'+_0x145a51[_0x79fa('0x20')];var _0x3729a1=crypto['createHash'](_0x79fa('0x21'))[_0x79fa('0x15')](_0xb029b8)[_0x79fa('0x22')](_0x79fa('0x16'));return _0x3729a1[_0x79fa('0x23')](0x0,0x8)+'-'+_0x3729a1[_0x79fa('0x23')](0x8,0xc)+'-'+_0x3729a1[_0x79fa('0x23')](0xc,0x10)+'-'+_0x3729a1[_0x79fa('0x23')](0x10,0x14)+'-'+_0x3729a1[_0x79fa('0x23')](0x14);}}; \ No newline at end of file diff --git a/server/config/license/index.js b/server/config/license/index.js index c9e1713..d379cf4 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 _0x0025=['License','findOrCreate','spread','SERVICE\x20LICENSE\x20STARTED\x20%s','default','util','request-promise','bluebird','pkginfo','version','../../components/encryptor','./hardware','../logger','license','https://www.xcallymotion.com','format','%s/api/servers/%s/check?version=%s','exports','%s/api/servers/%s/check?version=%s&oldtoken=%s','GET','then','get','data1','data2','info','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','update','Disabled','Changed','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','toUpperCase','YYYY-MM-DD\x20HH:mm','diff','days','DEMO\x20START\x20AT\x20%s','catch','error','message','getUuid'];(function(_0x1b0876,_0x39eeb3){var _0x55c107=function(_0x5017e2){while(--_0x5017e2){_0x1b0876['push'](_0x1b0876['shift']());}};_0x55c107(++_0x39eeb3);}(_0x0025,0x195));var _0x5002=function(_0x55bdc9,_0x3bd575){_0x55bdc9=_0x55bdc9-0x0;var _0xe6060b=_0x0025[_0x55bdc9];return _0xe6060b;};'use strict';var util=require(_0x5002('0x0'));var moment=require('moment');var rp=require(_0x5002('0x1'));var BPromise=require(_0x5002('0x2'));var pkginfo=require(_0x5002('0x3'))(module,_0x5002('0x4'));var db=require('../../mysqldb')['db'];var encryptor=require(_0x5002('0x5'));var hardware=require(_0x5002('0x6'));var logger=require(_0x5002('0x7'))(_0x5002('0x8'));var HOST=_0x5002('0x9');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x4e8ea2){return new BPromise(function(_0xecd87d,_0xf8af89){var _0x372c7f=util[_0x5002('0xa')](_0x5002('0xb'),HOST,_0x4e8ea2,module[_0x5002('0xc')]['version']);if(oldToken){_0x372c7f=util[_0x5002('0xa')](_0x5002('0xd'),HOST,_0x4e8ea2,module[_0x5002('0xc')][_0x5002('0x4')],oldToken);}var _0x5bfd73={'uri':_0x372c7f,'method':_0x5002('0xe'),'timeout':0xea60,'json':!![]};return rp(_0x5bfd73)[_0x5002('0xf')](function(_0x1178e3){_0xecd87d(_0x1178e3);})['catch'](function(_0x1cc865){_0xf8af89(_0x1cc865);});});}function manageLicense(_0x346f1a,_0x2673e4){var _0x1796e5=_0x2673e4[_0x5002('0x10')]({'plain':!![]});if(!isOldTokenSent&&_0x1796e5[_0x5002('0x11')]!==_0x346f1a&&!_0x1796e5[_0x5002('0x12')]){oldToken=_0x1796e5['data1'];}httpRequest(_0x346f1a)[_0x5002('0xf')](function(_0x3c92bc){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x3c92bc['active']){isOldTokenSent=![];if(!_0x1796e5['license']&&_0x1796e5[_0x5002('0x8')]!=_0x3c92bc[_0x5002('0x8')]||_0x1796e5[_0x5002('0x8')]&&_0x1796e5['data2']){logger[_0x5002('0x13')](_0x5002('0x14'));}if(_0x1796e5['license']&&!_0x1796e5['data2']&&_0x1796e5[_0x5002('0x8')]!=_0x3c92bc['license']){logger[_0x5002('0x13')]('THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED');}if(_0x1796e5[_0x5002('0x8')]&&!_0x1796e5[_0x5002('0x12')]&&_0x1796e5[_0x5002('0x8')]==_0x3c92bc[_0x5002('0x8')]){return _0x2673e4;}return _0x2673e4[_0x5002('0x15')]({'data1':_0x346f1a,'data2':null,'license':_0x3c92bc[_0x5002('0x8')]});}else{if(_0x3c92bc['license']||_0x1796e5['license']){if(!_0x1796e5[_0x5002('0x12')]){if(_0x1796e5[_0x5002('0x11')]==_0x346f1a){GRAY_PERIOD_REASON=_0x5002('0x16');logger['info']('THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED');}else{GRAY_PERIOD_REASON=_0x5002('0x17');logger[_0x5002('0x13')](_0x5002('0x18'),_0x1796e5[_0x5002('0x11')],_0x346f1a);}logger[_0x5002('0x13')](_0x5002('0x19'),GRAY_PERIOD_REASON[_0x5002('0x1a')](),moment()[_0x5002('0xa')](_0x5002('0x1b')));return _0x2673e4[_0x5002('0x15')]({'data2':encryptor['encryptString'](moment()['format'](_0x5002('0x1b')))});}else{if(moment()[_0x5002('0x1c')](encryptor['decryptString'](_0x1796e5[_0x5002('0x12')]),_0x5002('0x1d'))>DAYS){logger[_0x5002('0x13')](_0x5002('0x1e'),moment()[_0x5002('0xa')]('YYYY-MM-DD\x20HH:mm'));isOldTokenSent=![];return _0x2673e4[_0x5002('0x15')]({'data1':_0x346f1a,'data2':null,'license':null});}}}else{if(_0x1796e5['data1']!=_0x346f1a){logger[_0x5002('0x13')]('NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s',_0x1796e5[_0x5002('0x11')],_0x346f1a);return _0x2673e4['update']({'data1':_0x346f1a,'data2':null,'license':null});}}}return _0x2673e4;})['then'](function(_0x1b99fd){_0x2673e4=_0x1b99fd;})[_0x5002('0x1f')](function(_0x40e71e){logger[_0x5002('0x20')](_0x40e71e[_0x5002('0x21')]);})['finally'](function(){setTimeout(function(){manageLicense(hardware[_0x5002('0x22')](),_0x2673e4);},TIME);});}function defaultLicense(){var _0x1e6df1=hardware[_0x5002('0x22')]();if(_0x1e6df1){return db[_0x5002('0x23')][_0x5002('0x24')]({'where':{'id':0x1},'defaults':{'data1':_0x1e6df1}})[_0x5002('0x25')](function(_0x924314,_0x3d8800){logger[_0x5002('0x13')](_0x5002('0x26'),_0x1e6df1);manageLicense(_0x1e6df1,_0x924314);})[_0x5002('0x1f')](function(_0x199341){logger[_0x5002('0x20')](_0x199341[_0x5002('0x21')]);});}}exports[_0x5002('0x27')]=defaultLicense; \ No newline at end of file +var _0x51b2=['catch','get','data1','data2','info','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','update','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','Changed','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','toUpperCase','encryptString','YYYY-MM-DD\x20HH:mm','diff','decryptString','days','DEMO\x20START\x20AT\x20%s','error','getUuid','License','findOrCreate','SERVICE\x20LICENSE\x20STARTED\x20%s','message','default','util','moment','request-promise','bluebird','pkginfo','version','../../components/encryptor','./hardware','../logger','license','https://www.xcallymotion.com','format','%s/api/servers/%s/check?version=%s','exports','%s/api/servers/%s/check?version=%s&oldtoken=%s','GET','then'];(function(_0x3d42d8,_0x4cffaa){var _0x27fc41=function(_0x3a363b){while(--_0x3a363b){_0x3d42d8['push'](_0x3d42d8['shift']());}};_0x27fc41(++_0x4cffaa);}(_0x51b2,0x1c8));var _0x251b=function(_0x35f9d4,_0x5dea15){_0x35f9d4=_0x35f9d4-0x0;var _0xfbbb29=_0x51b2[_0x35f9d4];return _0xfbbb29;};'use strict';var util=require(_0x251b('0x0'));var moment=require(_0x251b('0x1'));var rp=require(_0x251b('0x2'));var BPromise=require(_0x251b('0x3'));var pkginfo=require(_0x251b('0x4'))(module,_0x251b('0x5'));var db=require('../../mysqldb')['db'];var encryptor=require(_0x251b('0x6'));var hardware=require(_0x251b('0x7'));var logger=require(_0x251b('0x8'))(_0x251b('0x9'));var HOST=_0x251b('0xa');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x215585){return new BPromise(function(_0x1ff71b,_0x5cf512){var _0x31e412=util[_0x251b('0xb')](_0x251b('0xc'),HOST,_0x215585,module[_0x251b('0xd')][_0x251b('0x5')]);if(oldToken){_0x31e412=util[_0x251b('0xb')](_0x251b('0xe'),HOST,_0x215585,module['exports']['version'],oldToken);}var _0x46792f={'uri':_0x31e412,'method':_0x251b('0xf'),'timeout':0xea60,'json':!![]};return rp(_0x46792f)[_0x251b('0x10')](function(_0x2b02ff){_0x1ff71b(_0x2b02ff);})[_0x251b('0x11')](function(_0x59ddea){_0x5cf512(_0x59ddea);});});}function manageLicense(_0x35cb1c,_0x47e9e9){var _0x5554dd=_0x47e9e9[_0x251b('0x12')]({'plain':!![]});if(!isOldTokenSent&&_0x5554dd[_0x251b('0x13')]!==_0x35cb1c&&!_0x5554dd[_0x251b('0x14')]){oldToken=_0x5554dd['data1'];}httpRequest(_0x35cb1c)[_0x251b('0x10')](function(_0x17ae4f){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x17ae4f['active']){isOldTokenSent=![];if(!_0x5554dd[_0x251b('0x9')]&&_0x5554dd[_0x251b('0x9')]!=_0x17ae4f['license']||_0x5554dd[_0x251b('0x9')]&&_0x5554dd['data2']){logger[_0x251b('0x15')](_0x251b('0x16'));}if(_0x5554dd[_0x251b('0x9')]&&!_0x5554dd['data2']&&_0x5554dd['license']!=_0x17ae4f[_0x251b('0x9')]){logger['info'](_0x251b('0x17'));}if(_0x5554dd[_0x251b('0x9')]&&!_0x5554dd[_0x251b('0x14')]&&_0x5554dd[_0x251b('0x9')]==_0x17ae4f[_0x251b('0x9')]){return _0x47e9e9;}return _0x47e9e9[_0x251b('0x18')]({'data1':_0x35cb1c,'data2':null,'license':_0x17ae4f['license']});}else{if(_0x17ae4f[_0x251b('0x9')]||_0x5554dd['license']){if(!_0x5554dd[_0x251b('0x14')]){if(_0x5554dd[_0x251b('0x13')]==_0x35cb1c){GRAY_PERIOD_REASON='Disabled';logger[_0x251b('0x15')](_0x251b('0x19'));}else{GRAY_PERIOD_REASON=_0x251b('0x1a');logger['info'](_0x251b('0x1b'),_0x5554dd[_0x251b('0x13')],_0x35cb1c);}logger['info'](_0x251b('0x1c'),GRAY_PERIOD_REASON[_0x251b('0x1d')](),moment()[_0x251b('0xb')]('YYYY-MM-DD\x20HH:mm'));return _0x47e9e9['update']({'data2':encryptor[_0x251b('0x1e')](moment()['format'](_0x251b('0x1f')))});}else{if(moment()[_0x251b('0x20')](encryptor[_0x251b('0x21')](_0x5554dd[_0x251b('0x14')]),_0x251b('0x22'))>DAYS){logger[_0x251b('0x15')](_0x251b('0x23'),moment()['format'](_0x251b('0x1f')));isOldTokenSent=![];return _0x47e9e9[_0x251b('0x18')]({'data1':_0x35cb1c,'data2':null,'license':null});}}}else{if(_0x5554dd[_0x251b('0x13')]!=_0x35cb1c){logger[_0x251b('0x15')](_0x251b('0x1b'),_0x5554dd[_0x251b('0x13')],_0x35cb1c);return _0x47e9e9['update']({'data1':_0x35cb1c,'data2':null,'license':null});}}}return _0x47e9e9;})[_0x251b('0x10')](function(_0x3fccae){_0x47e9e9=_0x3fccae;})['catch'](function(_0x38cfd6){logger[_0x251b('0x24')](_0x38cfd6['message']);})['finally'](function(){setTimeout(function(){manageLicense(hardware['getUuid'](),_0x47e9e9);},TIME);});}function defaultLicense(){var _0xdadace=hardware[_0x251b('0x25')]();if(_0xdadace){return db[_0x251b('0x26')][_0x251b('0x27')]({'where':{'id':0x1},'defaults':{'data1':_0xdadace}})['spread'](function(_0x3481d2,_0x6b762e){logger[_0x251b('0x15')](_0x251b('0x28'),_0xdadace);manageLicense(_0xdadace,_0x3481d2);})['catch'](function(_0x4e27ff){logger[_0x251b('0x24')](_0x4e27ff[_0x251b('0x29')]);});}}exports[_0x251b('0x2a')]=defaultLicense; \ No newline at end of file diff --git a/server/config/license/util.js b/server/config/license/util.js index 566d373..c33585b 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 _0x6631=['isEmpty','data2','split','decryptString','format','%s:%s:%s','parse','demo','machineUuid','gray','deadline','days','grayReason','disabled','User','role','sequelize','COUNT','col','count','admin','user','telephone','telephones','pick','countBy','License\x20limit\x20reached\x20for\x20telephones','exports','util','lodash','bluebird','./hardware','../../components/encryptor','2027-01-01T00:00:00.000Z','Breaking\x20license','getUuid','then','catch','uuid','data1'];(function(_0x103183,_0x1876cc){var _0x28a7e6=function(_0x196be1){while(--_0x196be1){_0x103183['push'](_0x103183['shift']());}};_0x28a7e6(++_0x1876cc);}(_0x6631,0xe4));var _0x1663=function(_0x502017,_0x55b02){_0x502017=_0x502017-0x0;var _0xd350fe=_0x6631[_0x502017];return _0xd350fe;};'use strict';var util=require(_0x1663('0x0'));var _=require(_0x1663('0x1'));var moment=require('moment');var BPromise=require(_0x1663('0x2'));var hardware=require(_0x1663('0x3'));var encryptor=require(_0x1663('0x4'));var db=require('../../mysqldb')['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x1663('0x5'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':'Demo\x20license','machineUuid':hardware['getUuid'](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x1663('0x5'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0x1663('0x6'),'machineUuid':hardware[_0x1663('0x7')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x20567a){return new BPromise(function(_0x3baf6c,_0x19b554){return db['License']['find'](_['defaults'](_0x20567a,{'raw':!![],'where':{'id':0x1}}))[_0x1663('0x8')](function(_0x47433f){return checkLicense(_0x47433f,null);})[_0x1663('0x8')](function(_0x3e080b){_0x3baf6c(_0x3e080b);return;})[_0x1663('0x9')](function(_0x54a46c){_0x19b554(_0x54a46c);});});}function checkLicense(_0x35531f,_0x465c6a){if(!_0x35531f){demoLicense[_0x1663('0xa')]=_0x35531f[_0x1663('0xb')];return demoLicense;}try{var _0x2cc978=_0x465c6a||_0x35531f['license'];if(_[_0x1663('0xc')](_0x2cc978)){throw new Error('License\x20key\x20value\x20not\x20found');}var _0x40b1e2=_0x35531f[_0x1663('0xb')];var _0xc4c6fd=_0x35531f[_0x1663('0xd')];var _0x2673b4=_0x40b1e2['split']('-')[0x4];var _0x2c4f67=_0x40b1e2[_0x1663('0xe')]('-')[0x0];var _0x64dcef=encryptor[_0x1663('0xf')](_0x2cc978,util[_0x1663('0x10')](_0x1663('0x11'),_0x2673b4,_0x40b1e2,_0x2c4f67));var _0x18ba8f=JSON[_0x1663('0x12')](_0x64dcef);_0x18ba8f[_0x1663('0x13')]=![];_0x18ba8f['uuid']=_0x40b1e2;_0x18ba8f[_0x1663('0x14')]=hardware[_0x1663('0x7')]();if(_0xc4c6fd){var _0x461fa=encryptor[_0x1663('0xf')](_0xc4c6fd);_0x18ba8f[_0x1663('0x15')]=_0x461fa;_0x18ba8f[_0x1663('0x16')]=moment(_0x461fa)['add'](0x7,_0x1663('0x17'))[_0x1663('0x10')]();_0x18ba8f[_0x1663('0x18')]=_0x18ba8f[_0x1663('0xa')]!=_0x18ba8f[_0x1663('0x14')]?'changed':_0x1663('0x19');}return _0x18ba8f;}catch(_0x28b621){breakingLicense[_0x1663('0xa')]=_0x35531f['data1'];breakingLicense['message']=_0x28b621['message'];return breakingLicense;}}function getLimits(){return new BPromise(function(_0xdb589d,_0x19fe4f){getLicense()[_0x1663('0x8')](function(_0x5d2366){return db[_0x1663('0x1a')]['findAll']({'attributes':[_0x1663('0x1b'),[db[_0x1663('0x1c')]['fn'](_0x1663('0x1d'),db[_0x1663('0x1c')][_0x1663('0x1e')](_0x1663('0x1b'))),_0x1663('0x1f')]],'group':_0x1663('0x1b'),'where':{'role':{'$or':[_0x1663('0x20'),_0x1663('0x21'),_0x1663('0x22')]}},'raw':!![]})[_0x1663('0x8')](function(_0x288af7){var _0x322de7={'user':_0x5d2366['users']||0x0,'telephone':_0x5d2366[_0x1663('0x23')]||0x0};_0x288af7['forEach'](function(_0x1d2eb2){var _0x138159=_0x1d2eb2[_0x1663('0x1b')]==='admin'?_0x1663('0x21'):_0x1d2eb2[_0x1663('0x1b')];_0x322de7[_0x138159]-=_0x1d2eb2[_0x1663('0x1f')];if(_0x322de7[_0x138159]<0x0)_0x322de7[_0x138159]=0x0;});_0xdb589d(_0x322de7);return;});})[_0x1663('0x9')](function(_0x11f0bf){_0x19fe4f(_0x11f0bf);});});}function checkUserLimits(_0x36fc21){return new BPromise(function(_0x5aa0a8,_0x3a8ef5){getLimits()[_0x1663('0x8')](function(_0x14f38c){var _0x45e0a7=_[_0x1663('0x24')](_[_0x1663('0x25')](_0x36fc21,'role'),[_0x1663('0x20'),'user',_0x1663('0x22')]);var _0x5672b4=(_0x45e0a7[_0x1663('0x20')]||0x0)+(_0x45e0a7[_0x1663('0x21')]||0x0);var _0x32d31c=_0x45e0a7[_0x1663('0x22')]||0x0;if(_0x5672b4>_0x14f38c[_0x1663('0x21')])return _0x3a8ef5('License\x20limit\x20reached\x20for\x20users');if(_0x32d31c>_0x14f38c[_0x1663('0x22')])return _0x3a8ef5(_0x1663('0x26'));return _0x5aa0a8();})['catch'](function(_0x26544d){_0x3a8ef5(_0x26544d);});});}module[_0x1663('0x27')]={'checkLicense':checkLicense,'checkUserLimits':checkUserLimits,'getLicense':getLicense}; \ No newline at end of file +var _0x6ab7=['add','days','grayReason','changed','disabled','message','role','sequelize','COUNT','count','admin','telephone','users','telephones','catch','user','License\x20limit\x20reached\x20for\x20users','License\x20limit\x20reached\x20for\x20telephones','exports','util','moment','../../components/encryptor','../../mysqldb','2027-01-01T00:00:00.000Z','Demo\x20license','getUuid','find','defaults','then','isEmpty','License\x20key\x20value\x20not\x20found','data1','data2','split','decryptString','format','%s:%s:%s','parse','uuid','machineUuid','gray'];(function(_0x34d7b3,_0x19f97b){var _0x2e919e=function(_0x26f9d5){while(--_0x26f9d5){_0x34d7b3['push'](_0x34d7b3['shift']());}};_0x2e919e(++_0x19f97b);}(_0x6ab7,0x8e));var _0x76ab=function(_0x2354f2,_0xfd77c6){_0x2354f2=_0x2354f2-0x0;var _0x234886=_0x6ab7[_0x2354f2];return _0x234886;};'use strict';var util=require(_0x76ab('0x0'));var _=require('lodash');var moment=require(_0x76ab('0x1'));var BPromise=require('bluebird');var hardware=require('./hardware');var encryptor=require(_0x76ab('0x2'));var db=require(_0x76ab('0x3'))['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x76ab('0x4'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0x76ab('0x5'),'machineUuid':hardware[_0x76ab('0x6')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x76ab('0x4'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':'Breaking\x20license','machineUuid':hardware[_0x76ab('0x6')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x42cba2){return new BPromise(function(_0x4c0563,_0x23c529){return db['License'][_0x76ab('0x7')](_[_0x76ab('0x8')](_0x42cba2,{'raw':!![],'where':{'id':0x1}}))[_0x76ab('0x9')](function(_0x2a0d9e){return checkLicense(_0x2a0d9e,null);})[_0x76ab('0x9')](function(_0x2dc9d9){_0x4c0563(_0x2dc9d9);return;})['catch'](function(_0x1ac60b){_0x23c529(_0x1ac60b);});});}function checkLicense(_0x31149d,_0x9fae8b){if(!_0x31149d){demoLicense['uuid']=_0x31149d['data1'];return demoLicense;}try{var _0x1e2744=_0x9fae8b||_0x31149d['license'];if(_[_0x76ab('0xa')](_0x1e2744)){throw new Error(_0x76ab('0xb'));}var _0x24c035=_0x31149d[_0x76ab('0xc')];var _0x14a636=_0x31149d[_0x76ab('0xd')];var _0x354ca5=_0x24c035[_0x76ab('0xe')]('-')[0x4];var _0x99114d=_0x24c035[_0x76ab('0xe')]('-')[0x0];var _0x1bb7f9=encryptor[_0x76ab('0xf')](_0x1e2744,util[_0x76ab('0x10')](_0x76ab('0x11'),_0x354ca5,_0x24c035,_0x99114d));var _0x27edc8=JSON[_0x76ab('0x12')](_0x1bb7f9);_0x27edc8['demo']=![];_0x27edc8[_0x76ab('0x13')]=_0x24c035;_0x27edc8[_0x76ab('0x14')]=hardware[_0x76ab('0x6')]();if(_0x14a636){var _0x332d6c=encryptor[_0x76ab('0xf')](_0x14a636);_0x27edc8[_0x76ab('0x15')]=_0x332d6c;_0x27edc8['deadline']=moment(_0x332d6c)[_0x76ab('0x16')](0x7,_0x76ab('0x17'))[_0x76ab('0x10')]();_0x27edc8[_0x76ab('0x18')]=_0x27edc8[_0x76ab('0x13')]!=_0x27edc8[_0x76ab('0x14')]?_0x76ab('0x19'):_0x76ab('0x1a');}return _0x27edc8;}catch(_0x3c8d8a){breakingLicense[_0x76ab('0x13')]=_0x31149d['data1'];breakingLicense[_0x76ab('0x1b')]=_0x3c8d8a[_0x76ab('0x1b')];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x3ff9ce,_0x2a62ed){getLicense()['then'](function(_0x1d1645){return db['User']['findAll']({'attributes':[_0x76ab('0x1c'),[db[_0x76ab('0x1d')]['fn'](_0x76ab('0x1e'),db['sequelize']['col']('role')),_0x76ab('0x1f')]],'group':_0x76ab('0x1c'),'where':{'role':{'$or':[_0x76ab('0x20'),'user',_0x76ab('0x21')]}},'raw':!![]})['then'](function(_0x2803b2){var _0x2134d1={'user':_0x1d1645[_0x76ab('0x22')]||0x0,'telephone':_0x1d1645[_0x76ab('0x23')]||0x0};_0x2803b2['forEach'](function(_0x366d92){var _0x1eaea1=_0x366d92['role']===_0x76ab('0x20')?'user':_0x366d92[_0x76ab('0x1c')];_0x2134d1[_0x1eaea1]-=_0x366d92['count'];if(_0x2134d1[_0x1eaea1]<0x0)_0x2134d1[_0x1eaea1]=0x0;});_0x3ff9ce(_0x2134d1);return;});})[_0x76ab('0x24')](function(_0x2cead1){_0x2a62ed(_0x2cead1);});});}function checkUserLimits(_0x2e41a3){return new BPromise(function(_0x5efbec,_0x3ab08c){getLimits()[_0x76ab('0x9')](function(_0x13ea1b){var _0x1e264d=_['pick'](_['countBy'](_0x2e41a3,_0x76ab('0x1c')),[_0x76ab('0x20'),_0x76ab('0x25'),'telephone']);var _0x4522a4=(_0x1e264d['admin']||0x0)+(_0x1e264d[_0x76ab('0x25')]||0x0);var _0x152351=_0x1e264d[_0x76ab('0x21')]||0x0;if(_0x4522a4>_0x13ea1b['user'])return _0x3ab08c(_0x76ab('0x26'));if(_0x152351>_0x13ea1b[_0x76ab('0x21')])return _0x3ab08c(_0x76ab('0x27'));return _0x5efbec();})[_0x76ab('0x24')](function(_0x5c56d3){_0x3ab08c(_0x5c56d3);});});}module[_0x76ab('0x28')]={'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 fe89e59..7478c31 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 _0x4cf8=['secret','exports','http://localhost:9000','myappanuglar-secret','app-id'];(function(_0x59b079,_0x244a5f){var _0x4dc8b3=function(_0x28e088){while(--_0x28e088){_0x59b079['push'](_0x59b079['shift']());}};_0x4dc8b3(++_0x244a5f);}(_0x4cf8,0x1e1));var _0x84cf=function(_0x525d78,_0x14175d){_0x525d78=_0x525d78-0x0;var _0x4c203d=_0x4cf8[_0x525d78];return _0x4c203d;};'use strict';module[_0x84cf('0x0')]={'DOMAIN':_0x84cf('0x1'),'SESSION_SECRET':_0x84cf('0x2'),'GOOGLE_ID':_0x84cf('0x3'),'GOOGLE_SECRET':_0x84cf('0x4'),'DEBUG':''}; \ No newline at end of file +var _0xb78e=['secret','exports','http://localhost:9000','app-id'];(function(_0x2cde2a,_0x4325c4){var _0x110f55=function(_0x4927f5){while(--_0x4927f5){_0x2cde2a['push'](_0x2cde2a['shift']());}};_0x110f55(++_0x4325c4);}(_0xb78e,0x1c9));var _0xeb78=function(_0xc62a68,_0x43867c){_0xc62a68=_0xc62a68-0x0;var _0x2f6ed2=_0xb78e[_0xc62a68];return _0x2f6ed2;};'use strict';module[_0xeb78('0x0')]={'DOMAIN':_0xeb78('0x1'),'SESSION_SECRET':'myappanuglar-secret','GOOGLE_ID':_0xeb78('0x2'),'GOOGLE_SECRET':_0xeb78('0x3'),'DEBUG':''}; \ No newline at end of file diff --git a/server/config/logger.js b/server/config/logger.js index 8e7f422..cf36b1b 100644 --- a/server/config/logger.js +++ b/server/config/logger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7576=['../utils/loggers','fileLogger','exports'];(function(_0x4090d8,_0x2354e4){var _0x31d33b=function(_0x55cbf4){while(--_0x55cbf4){_0x4090d8['push'](_0x4090d8['shift']());}};_0x31d33b(++_0x2354e4);}(_0x7576,0xba));var _0x6757=function(_0x2d05a2,_0x5c0f27){_0x2d05a2=_0x2d05a2-0x0;var _0x199cc3=_0x7576[_0x2d05a2];return _0x199cc3;};'use strict';var fileLogger=require(_0x6757('0x0'))[_0x6757('0x1')];module[_0x6757('0x2')]=fileLogger; \ No newline at end of file +var _0x46df=['fileLogger','exports','../utils/loggers'];(function(_0x4c0b73,_0xdee80a){var _0x38e5d7=function(_0x5c1308){while(--_0x5c1308){_0x4c0b73['push'](_0x4c0b73['shift']());}};_0x38e5d7(++_0xdee80a);}(_0x46df,0x107));var _0xf46d=function(_0x297fd3,_0x115406){_0x297fd3=_0x297fd3-0x0;var _0x2af381=_0x46df[_0x297fd3];return _0x2af381;};'use strict';var fileLogger=require(_0xf46d('0x0'))[_0xf46d('0x1')];module[_0xf46d('0x2')]=fileLogger; \ No newline at end of file diff --git a/server/config/pm2/config.js b/server/config/pm2/config.js index df36676..f720659 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 _0x0116=['../../services/email/index.js','routing','xdr','../../services/xdr/index.js','exports','join','../../services/ami/index.js','agi'];(function(_0x1ab18f,_0x3675b3){var _0x346265=function(_0x3e06cf){while(--_0x3e06cf){_0x1ab18f['push'](_0x1ab18f['shift']());}};_0x346265(++_0x3675b3);}(_0x0116,0xb5));var _0x6011=function(_0x1203f,_0x554bbc){_0x1203f=_0x1203f-0x0;var _0x365f0a=_0x0116[_0x1203f];return _0x365f0a;};'use strict';var path=require('path');var os=require('os');var config={'apps':[{'name':'express','script':path[_0x6011('0x0')](__dirname,'../../services/express/index.js')},{'name':'ami','script':path[_0x6011('0x0')](__dirname,_0x6011('0x1'))},{'name':_0x6011('0x2'),'script':path['join'](__dirname,'../../services/agi/index.js')},{'name':'email','script':path[_0x6011('0x0')](__dirname,_0x6011('0x3'))},{'name':_0x6011('0x4'),'script':path[_0x6011('0x0')](__dirname,'../../services/routing/index.js')},{'name':_0x6011('0x5'),'script':path['join'](__dirname,_0x6011('0x6'))}]};module[_0x6011('0x7')]=config; \ No newline at end of file +var _0xbf76=['../../services/express/index.js','join','../../services/ami/index.js','../../services/agi/index.js','email','../../services/email/index.js','routing','../../services/routing/index.js','../../services/xdr/index.js','exports','express'];(function(_0x1fa82c,_0x41866b){var _0x156cd6=function(_0x2bdd55){while(--_0x2bdd55){_0x1fa82c['push'](_0x1fa82c['shift']());}};_0x156cd6(++_0x41866b);}(_0xbf76,0x107));var _0x6bf7=function(_0x419f13,_0x10358c){_0x419f13=_0x419f13-0x0;var _0x30f536=_0xbf76[_0x419f13];return _0x30f536;};'use strict';var path=require('path');var os=require('os');var config={'apps':[{'name':_0x6bf7('0x0'),'script':path['join'](__dirname,_0x6bf7('0x1'))},{'name':'ami','script':path[_0x6bf7('0x2')](__dirname,_0x6bf7('0x3'))},{'name':'agi','script':path[_0x6bf7('0x2')](__dirname,_0x6bf7('0x4'))},{'name':_0x6bf7('0x5'),'script':path[_0x6bf7('0x2')](__dirname,_0x6bf7('0x6'))},{'name':_0x6bf7('0x7'),'script':path[_0x6bf7('0x2')](__dirname,_0x6bf7('0x8'))},{'name':'xdr','script':path[_0x6bf7('0x2')](__dirname,_0x6bf7('0x9'))}]};module[_0x6bf7('0xa')]=config; \ No newline at end of file diff --git a/server/config/pm2/index.js b/server/config/pm2/index.js index 0720b5b..bd2ec07 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 _0x071a=['list','describe','delete','dump','bluebird','connect','connected','start','then','disconnect','restart'];(function(_0x53b725,_0x464153){var _0x14e391=function(_0x3aca2d){while(--_0x3aca2d){_0x53b725['push'](_0x53b725['shift']());}};_0x14e391(++_0x464153);}(_0x071a,0x1a6));var _0xa071=function(_0x3185ad,_0x5e5ca2){_0x3185ad=_0x3185ad-0x0;var _0x4f77fb=_0x071a[_0x3185ad];return _0x4f77fb;};'use strict';var pm2=require('pm2');var BPromise=require(_0xa071('0x0'));var config=require('./config');function connect(){return new BPromise(function(_0x19c709,_0x40abc8){return pm2[_0xa071('0x1')](function(_0x947876){if(_0x947876){return _0x40abc8(_0x947876);}return _0x19c709(_0xa071('0x2'));});});};exports['start']=function(_0x3c9f94){return connect()['then'](function(){return new BPromise(function(_0x5324ff,_0x7858c0){return pm2[_0xa071('0x3')](_0x3c9f94,function(_0x33d3c9,_0x1e91fb){if(_0x33d3c9){return _0x7858c0(_0x33d3c9);}pm2['disconnect']();return _0x5324ff(_0x1e91fb);});});});};exports['stop']=function(_0x36b75d){return connect()[_0xa071('0x4')](function(){return new BPromise(function(_0x42cbd8,_0x4f9803){return pm2['stop'](_0x36b75d,function(_0x2fe6c3,_0x4c22c6){if(_0x2fe6c3){return _0x4f9803(_0x2fe6c3);}pm2[_0xa071('0x5')]();return _0x42cbd8(_0x4c22c6);});});});};exports['restart']=function(_0x1df449){return connect()[_0xa071('0x4')](function(){return new BPromise(function(_0x1cfccb,_0x590743){return pm2[_0xa071('0x6')](_0x1df449,function(_0x534e90,_0x179a87){if(_0x534e90){return _0x590743(_0x534e90);}pm2['disconnect']();return _0x1cfccb(_0x179a87);});});});};exports[_0xa071('0x7')]=function(){return connect()[_0xa071('0x4')](function(){return new BPromise(function(_0x528f7f,_0x487758){return pm2['list'](function(_0xe850fc,_0x222a19){if(_0xe850fc){return _0x487758(_0xe850fc);}pm2[_0xa071('0x5')]();return _0x528f7f(_0x222a19);});});});};exports[_0xa071('0x8')]=function(_0x946f86){return connect()[_0xa071('0x4')](function(){return new BPromise(function(_0x36fedd,_0x2da7ba){return pm2[_0xa071('0x8')](_0x946f86,function(_0x1cc276,_0x3fe6f1){if(_0x1cc276){return _0x2da7ba(_0x1cc276);}pm2['disconnect']();return _0x36fedd(_0x3fe6f1);});});});};exports[_0xa071('0x9')]=function(_0x32cb72){return connect()[_0xa071('0x4')](function(){return new BPromise(function(_0x530b0f,_0x178489){return pm2['delete'](_0x32cb72,function(_0x1b0668,_0x309c2f){if(_0x1b0668){return _0x178489(_0x1b0668);}pm2[_0xa071('0x5')]();return _0x530b0f(_0x309c2f);});});});};exports[_0xa071('0xa')]=function(){return connect()[_0xa071('0x4')](function(){return new BPromise(function(_0x487b56,_0x5a1fcb){return pm2['dump'](function(_0x1a9fca){if(_0x1a9fca){return _0x5a1fcb(_0x1a9fca);}return _0x487b56('saved');});});});}; \ No newline at end of file +var _0x5101=['disconnect','stop','restart','list','describe','delete','dump','saved','./config','connect','connected','start','then'];(function(_0x3081c7,_0x4dae35){var _0x50f807=function(_0x149947){while(--_0x149947){_0x3081c7['push'](_0x3081c7['shift']());}};_0x50f807(++_0x4dae35);}(_0x5101,0x140));var _0x1510=function(_0x15b480,_0x32dfc0){_0x15b480=_0x15b480-0x0;var _0x383d5c=_0x5101[_0x15b480];return _0x383d5c;};'use strict';var pm2=require('pm2');var BPromise=require('bluebird');var config=require(_0x1510('0x0'));function connect(){return new BPromise(function(_0x49453b,_0x4a4df6){return pm2[_0x1510('0x1')](function(_0x36a66c){if(_0x36a66c){return _0x4a4df6(_0x36a66c);}return _0x49453b(_0x1510('0x2'));});});};exports[_0x1510('0x3')]=function(_0x5dba48){return connect()[_0x1510('0x4')](function(){return new BPromise(function(_0x439fc8,_0x1e8296){return pm2[_0x1510('0x3')](_0x5dba48,function(_0x2225cd,_0x2bcee5){if(_0x2225cd){return _0x1e8296(_0x2225cd);}pm2[_0x1510('0x5')]();return _0x439fc8(_0x2bcee5);});});});};exports[_0x1510('0x6')]=function(_0x4c26c7){return connect()['then'](function(){return new BPromise(function(_0x14da5c,_0x39d530){return pm2[_0x1510('0x6')](_0x4c26c7,function(_0x255522,_0x19bd2c){if(_0x255522){return _0x39d530(_0x255522);}pm2[_0x1510('0x5')]();return _0x14da5c(_0x19bd2c);});});});};exports[_0x1510('0x7')]=function(_0x159806){return connect()['then'](function(){return new BPromise(function(_0x17f581,_0x162700){return pm2[_0x1510('0x7')](_0x159806,function(_0x106418,_0x17b01d){if(_0x106418){return _0x162700(_0x106418);}pm2[_0x1510('0x5')]();return _0x17f581(_0x17b01d);});});});};exports[_0x1510('0x8')]=function(){return connect()[_0x1510('0x4')](function(){return new BPromise(function(_0x485127,_0x57e6d2){return pm2[_0x1510('0x8')](function(_0x3eb239,_0x35cfa4){if(_0x3eb239){return _0x57e6d2(_0x3eb239);}pm2['disconnect']();return _0x485127(_0x35cfa4);});});});};exports[_0x1510('0x9')]=function(_0x5b79c5){return connect()[_0x1510('0x4')](function(){return new BPromise(function(_0x194dea,_0x1c21e3){return pm2['describe'](_0x5b79c5,function(_0x55b03c,_0x203bff){if(_0x55b03c){return _0x1c21e3(_0x55b03c);}pm2[_0x1510('0x5')]();return _0x194dea(_0x203bff);});});});};exports[_0x1510('0xa')]=function(_0x4ef87b){return connect()[_0x1510('0x4')](function(){return new BPromise(function(_0x28c4b8,_0x4eb2a5){return pm2[_0x1510('0xa')](_0x4ef87b,function(_0x469861,_0x5d14c8){if(_0x469861){return _0x4eb2a5(_0x469861);}pm2[_0x1510('0x5')]();return _0x28c4b8(_0x5d14c8);});});});};exports['dump']=function(){return connect()['then'](function(){return new BPromise(function(_0x461b89,_0xf83bff){return pm2[_0x1510('0xb')](function(_0x38fc89){if(_0x38fc89){return _0xf83bff(_0x38fc89);}return _0x461b89(_0x1510('0xc'));});});});}; \ No newline at end of file diff --git a/server/config/schedule/chat.js b/server/config/schedule/chat.js index 0653e19..f827a99 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 _0x3f4d=['error','[CHAT]\x20Error\x20closing\x20interactions','inspect','start','lodash','moment','util','../../mysqldb','schedule','redis','defaults','localhost','find','chatTimeout','then','ChatInteraction','subtract','minutes','map','[CHAT]\x20Interactions\x20to\x20close:','join','update','system','timeout','YYYY-MM-DD\x20HH:mm:ss','length','info','[CHAT]\x20Sending\x20updates\x20for\x20interactions:','emit','chatInteraction:update','catch'];(function(_0xf9cb7a,_0x155fd9){var _0x337245=function(_0x385c3b){while(--_0x385c3b){_0xf9cb7a['push'](_0xf9cb7a['shift']());}};_0x337245(++_0x155fd9);}(_0x3f4d,0x9f));var _0xd3f4=function(_0xe8ccb9,_0x507176){_0xe8ccb9=_0xe8ccb9-0x0;var _0x2d3b0a=_0x3f4d[_0xe8ccb9];return _0x2d3b0a;};'use strict';var _=require(_0xd3f4('0x0'));var moment=require(_0xd3f4('0x1'));var Redis=require('ioredis');var util=require(_0xd3f4('0x2'));var config=require('../../config/environment');var db=require(_0xd3f4('0x3'))['db'];var logger=require('../logger')(_0xd3f4('0x4'));config[_0xd3f4('0x5')]=_[_0xd3f4('0x6')](config['redis'],{'host':_0xd3f4('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xd3f4('0x5')]));function closeInteractions(){var _0x395453=0x0;var _0x104e6c=[];return db['Setting'][_0xd3f4('0x8')]({'raw':!![],'attributes':['id',_0xd3f4('0x9')],'where':{'id':0x1}})[_0xd3f4('0xa')](function(_0x20e0a9){_0x395453=_0x20e0a9[_0xd3f4('0x9')];if(_0x395453){return db[_0xd3f4('0xb')]['findAll']({'raw':!![],'attributes':['id','lastMsgAt'],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0xd3f4('0xc')](_0x20e0a9[_0xd3f4('0x9')],_0xd3f4('0xd'))}}});}else{return[];}})[_0xd3f4('0xa')](function(_0x3660e2){if(_0x3660e2&&_0x3660e2['length']){_0x104e6c=_[_0xd3f4('0xe')](_0x3660e2||[],'id');logger['info'](_0xd3f4('0xf'),_0x104e6c[_0xd3f4('0x10')]());return db[_0xd3f4('0xb')][_0xd3f4('0x11')]({'closeReason':_0xd3f4('0x12'),'disposition':_0xd3f4('0x13'),'closed':!![],'closedAt':moment()['format'](_0xd3f4('0x14'))},{'where':{'id':_0x104e6c}});}})[_0xd3f4('0xa')](function(){if(_0x104e6c&&_0x104e6c[_0xd3f4('0x15')]){logger[_0xd3f4('0x16')](_0xd3f4('0x17'),_0x104e6c[_0xd3f4('0x10')]());for(var _0x39bf6d=0x0;_0x39bf6d<_0x104e6c[_0xd3f4('0x15')];_0x39bf6d++){io[_0xd3f4('0x18')](_0xd3f4('0x19'),{'id':_0x104e6c[_0x39bf6d],'closed':!![]});}}})[_0xd3f4('0x1a')](function(_0x568b64){logger[_0xd3f4('0x1b')](_0xd3f4('0x1c'),_0x568b64?util[_0xd3f4('0x1d')](_0x568b64,{'showHidden':![],'depth':null}):'');});}exports[_0xd3f4('0x1e')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0xc35f=['then','chatTimeout','ChatInteraction','lastMsgAt','minutes','length','info','[CHAT]\x20Interactions\x20to\x20close:','join','update','system','format','[CHAT]\x20Sending\x20updates\x20for\x20interactions:','chatInteraction:update','catch','error','[CHAT]\x20Error\x20closing\x20interactions','start','moment','util','../../config/environment','../../mysqldb','../logger','schedule','redis','defaults','socket.io-emitter','Setting'];(function(_0x60df74,_0x458e29){var _0x5ee872=function(_0x356888){while(--_0x356888){_0x60df74['push'](_0x60df74['shift']());}};_0x5ee872(++_0x458e29);}(_0xc35f,0x1ee));var _0xfc35=function(_0x5190b7,_0x316467){_0x5190b7=_0x5190b7-0x0;var _0x150498=_0xc35f[_0x5190b7];return _0x150498;};'use strict';var _=require('lodash');var moment=require(_0xfc35('0x0'));var Redis=require('ioredis');var util=require(_0xfc35('0x1'));var config=require(_0xfc35('0x2'));var db=require(_0xfc35('0x3'))['db'];var logger=require(_0xfc35('0x4'))(_0xfc35('0x5'));config[_0xfc35('0x6')]=_[_0xfc35('0x7')](config[_0xfc35('0x6')],{'host':'localhost','port':0x18eb});var io=require(_0xfc35('0x8'))(new Redis(config[_0xfc35('0x6')]));function closeInteractions(){var _0x461329=0x0;var _0x12ea60=[];return db[_0xfc35('0x9')]['find']({'raw':!![],'attributes':['id','chatTimeout'],'where':{'id':0x1}})[_0xfc35('0xa')](function(_0x586116){_0x461329=_0x586116[_0xfc35('0xb')];if(_0x461329){return db[_0xfc35('0xc')]['findAll']({'raw':!![],'attributes':['id',_0xfc35('0xd')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()['subtract'](_0x586116[_0xfc35('0xb')],_0xfc35('0xe'))}}});}else{return[];}})[_0xfc35('0xa')](function(_0x4f47fd){if(_0x4f47fd&&_0x4f47fd[_0xfc35('0xf')]){_0x12ea60=_['map'](_0x4f47fd||[],'id');logger[_0xfc35('0x10')](_0xfc35('0x11'),_0x12ea60[_0xfc35('0x12')]());return db[_0xfc35('0xc')][_0xfc35('0x13')]({'closeReason':_0xfc35('0x14'),'disposition':'timeout','closed':!![],'closedAt':moment()[_0xfc35('0x15')]('YYYY-MM-DD\x20HH:mm:ss')},{'where':{'id':_0x12ea60}});}})['then'](function(){if(_0x12ea60&&_0x12ea60['length']){logger[_0xfc35('0x10')](_0xfc35('0x16'),_0x12ea60['join']());for(var _0x2f7f2d=0x0;_0x2f7f2d<_0x12ea60['length'];_0x2f7f2d++){io['emit'](_0xfc35('0x17'),{'id':_0x12ea60[_0x2f7f2d],'closed':!![]});}}})[_0xfc35('0x18')](function(_0x16befd){logger[_0xfc35('0x19')](_0xfc35('0x1a'),_0x16befd?util['inspect'](_0x16befd,{'showHidden':![],'depth':null}):'');});}exports[_0xfc35('0x1b')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file diff --git a/server/config/schedule/cloud-provider.js b/server/config/schedule/cloud-provider.js index a5300fb..a7be470 100644 --- a/server/config/schedule/cloud-provider.js +++ b/server/config/schedule/cloud-provider.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -'use strict';function start(){var _0x2aed34=require('../../api/cloudProvider/cloudProvider.oauth.js');return _0x2aed34['startAllRefreshIntervals']();}module['exports']={'intervals':{},'start':start}; \ No newline at end of file +var _0xf1fd=['startAllRefreshIntervals'];(function(_0x41df56,_0x5264d5){var _0x4c4d6e=function(_0x4d7775){while(--_0x4d7775){_0x41df56['push'](_0x41df56['shift']());}};_0x4c4d6e(++_0x5264d5);}(_0xf1fd,0x175));var _0xdf1f=function(_0x137f1d,_0x173f64){_0x137f1d=_0x137f1d-0x0;var _0x2188ab=_0xf1fd[_0x137f1d];return _0x2188ab;};'use strict';function start(){var _0x4cb244=require('../../api/cloudProvider/cloudProvider.oauth.js');return _0x4cb244[_0xdf1f('0x0')]();}module['exports']={'intervals':{},'start':start}; \ No newline at end of file diff --git a/server/config/schedule/index.js b/server/config/schedule/index.js index 2d46dc5..4946ac7 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 _0xa9a3=['name','bcc','Report\x20%s\x20last\x20%s\x20%s','subtractNumber','subtractUnit','join','../../files/reports','savename','%s.%s','basename','extname','zip','existsSync','Sent','message','attachments','text','Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a','status','Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','sendIfEmpty','empty\x20file,\x20email\x20not\x20sent','SendMail','then','error\x20mail','stringify','email\x20sent','catch','error','isNil','subtractNumber\x20null\x20or\x20undefined','subtract','YYYY-MM-DD\x20HH:mm:ss','output','DefaultReportId','runReport','exec\x20custom\x20report\x20id:%s','CustomReportId','Schedule','findAll','keys','jobs','map','toString','keyBy','intersection','length','deleteJob','delete\x20cron','resolve','active','startAt','endAt','cron','start','add\x20cron','exists','stop\x20cron','isBetween','update','stop','run','util','path','lodash','moment','cron-job-manager','jayson/promise','../logger','schedule','../../mysqldb','../../api/analyticDefaultReport/analyticDefaultReport.controller','client','http','info','Try\x20to\x20send\x20a\x20mail\x20to','email','MailAccount','Smtp','host','port','secure','authentication','auth','user','pass','format','\x22%s\x22\x20<%s>'];(function(_0x4a252b,_0x49dd47){var _0x4c2883=function(_0xf85466){while(--_0xf85466){_0x4a252b['push'](_0x4a252b['shift']());}};_0x4c2883(++_0x49dd47);}(_0xa9a3,0x19e));var _0x3a9a=function(_0x24061a,_0x1c9f4d){_0x24061a=_0x24061a-0x0;var _0x82054e=_0xa9a3[_0x24061a];return _0x82054e;};'use strict';var fs=require('fs');var util=require(_0x3a9a('0x0'));var path=require(_0x3a9a('0x1'));var _=require(_0x3a9a('0x2'));var moment=require(_0x3a9a('0x3'));var CronJobManager=require(_0x3a9a('0x4'));var jayson=require(_0x3a9a('0x5'));var BPromise=require('bluebird');var logger=require(_0x3a9a('0x6'))(_0x3a9a('0x7'));var db=require(_0x3a9a('0x8'))['db'];var analyticCustomReportController=require('../../api/analyticCustomReport/analyticCustomReport.controller');var analyticDefaultReportController=require(_0x3a9a('0x9'));var client=jayson[_0x3a9a('0xa')][_0x3a9a('0xb')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x412bb4,_0x5c831a){return function(){logger[_0x3a9a('0xc')](_0x3a9a('0xd'),_0x412bb4[_0x3a9a('0xe')]);var _0x99c202=!![];var _0x2b9c9a={'tls':{'rejectUnauthorized':![]}};if(_0x412bb4[_0x3a9a('0xf')][_0x3a9a('0x10')]['service']){_0x2b9c9a['service']=_0x412bb4[_0x3a9a('0xf')][_0x3a9a('0x10')]['service'];}else{_0x2b9c9a[_0x3a9a('0x11')]=_0x412bb4[_0x3a9a('0xf')][_0x3a9a('0x10')][_0x3a9a('0x11')];_0x2b9c9a[_0x3a9a('0x12')]=_0x412bb4[_0x3a9a('0xf')]['Smtp'][_0x3a9a('0x12')];_0x2b9c9a[_0x3a9a('0x13')]=_0x412bb4['MailAccount'][_0x3a9a('0x10')][_0x3a9a('0x13')];}if(_0x412bb4['MailAccount'][_0x3a9a('0x10')][_0x3a9a('0x14')]){_0x2b9c9a[_0x3a9a('0x15')]={'user':_0x412bb4[_0x3a9a('0xf')]['Smtp'][_0x3a9a('0x16')],'pass':_0x412bb4[_0x3a9a('0xf')][_0x3a9a('0x10')][_0x3a9a('0x17')]};}var _0x2f0379={'account':_0x2b9c9a,'message':{'from':util[_0x3a9a('0x18')](_0x3a9a('0x19'),_0x412bb4[_0x3a9a('0xf')][_0x3a9a('0x1a')],_0x412bb4[_0x3a9a('0xf')][_0x3a9a('0xe')]||_0x412bb4[_0x3a9a('0xf')][_0x3a9a('0x10')][_0x3a9a('0x16')]),'to':_0x412bb4['email'],'cc':_0x412bb4['cc'],'bcc':_0x412bb4[_0x3a9a('0x1b')],'subject':util[_0x3a9a('0x18')](_0x3a9a('0x1c'),_0x5c831a[_0x3a9a('0x1a')],_0x412bb4[_0x3a9a('0x1d')],_0x412bb4[_0x3a9a('0x1e')])}};var _0x13c697=path[_0x3a9a('0x1f')](__dirname,_0x3a9a('0x20'));var _0x12d5cc=_0x5c831a[_0x3a9a('0x21')];var _0x5b1ef2=util[_0x3a9a('0x18')](_0x3a9a('0x22'),path[_0x3a9a('0x23')](_0x5c831a[_0x3a9a('0x21')],path[_0x3a9a('0x24')](_0x5c831a[_0x3a9a('0x21')])),_0x3a9a('0x25'));var _0x42fa5c=path[_0x3a9a('0x1f')](_0x13c697,_0x12d5cc);var _0x5825f8=path[_0x3a9a('0x1f')](_0x13c697,_0x5b1ef2);if(fs[_0x3a9a('0x26')](_0x42fa5c)){_0x5c831a['status']=_0x3a9a('0x27');_0x2f0379[_0x3a9a('0x28')][_0x3a9a('0x29')]=[{'filename':_0x12d5cc,'path':_0x42fa5c}];_0x2f0379[_0x3a9a('0x28')][_0x3a9a('0x2a')]=util[_0x3a9a('0x18')](_0x3a9a('0x2b'),JSON['stringify'](_0x5c831a,null,0x2));}else if(fs[_0x3a9a('0x26')](_0x5825f8)){_0x5c831a[_0x3a9a('0x2c')]=_0x3a9a('0x27');_0x2f0379['message'][_0x3a9a('0x29')]=[{'filename':_0x5b1ef2,'path':_0x5825f8}];}else{_0x2f0379[_0x3a9a('0x28')]['text']=_0x3a9a('0x2d');if(!_0x412bb4[_0x3a9a('0x2e')]){_0x99c202=![];logger[_0x3a9a('0xc')](_0x3a9a('0x2f'));}}if(_0x99c202){return client['request'](_0x3a9a('0x30'),_0x2f0379)[_0x3a9a('0x31')](function(_0x1221a7){if(_0x1221a7['error']){return logger['error'](_0x3a9a('0x32'),JSON[_0x3a9a('0x33')](_0x1221a7));}return logger[_0x3a9a('0xc')](_0x3a9a('0x34'));})[_0x3a9a('0x35')](function(_0x54e5b){return logger['error'](_0x3a9a('0x32'),JSON[_0x3a9a('0x33')](_0x54e5b));});}};}function handleError(){return function(_0x593220){return logger[_0x3a9a('0x36')](JSON[_0x3a9a('0x33')](_0x593220));};}function handleResult(_0x81d097){return function(_0x10c2d6){logger[_0x3a9a('0xc')]('data',JSON[_0x3a9a('0x33')](_0x10c2d6));if(_0x81d097['MailAccount']&&_0x81d097[_0x3a9a('0xf')][_0x3a9a('0x10')]&&!_[_0x3a9a('0x37')](_0x81d097[_0x3a9a('0xe')])){setTimeout(handleSendEmail(_0x81d097,_0x10c2d6),0x3c*0x3e8);}};}function handleJob(_0x554af1){return function(){try{if(_[_0x3a9a('0x37')](_0x554af1[_0x3a9a('0x1d')])){return logger[_0x3a9a('0xc')](_0x3a9a('0x38'));}if(_['isNil'](_0x554af1[_0x3a9a('0x1e')])){return logger[_0x3a9a('0xc')]('subtractUnit\x20null\x20or\x20undefined');}var _0x1e90d5={'startDate':moment()[_0x3a9a('0x39')](_0x554af1[_0x3a9a('0x1d')],_0x554af1[_0x3a9a('0x1e')])[_0x3a9a('0x18')](_0x3a9a('0x3a')),'endDate':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'type':'scheduled','output':_0x554af1[_0x3a9a('0x3b')],'name':_0x554af1[_0x3a9a('0x1a')]};if(!_['isNil'](_0x554af1[_0x3a9a('0x3c')])){logger[_0x3a9a('0xc')]('exec\x20defaul\x20report\x20id:%s',_0x554af1[_0x3a9a('0x3c')]);return analyticDefaultReportController[_0x3a9a('0x3d')]({'id':_0x554af1['DefaultReportId']},_0x1e90d5)['then'](handleResult(_0x554af1))['catch'](handleError());}if(!_[_0x3a9a('0x37')](_0x554af1['CustomReportId'])){logger['info'](_0x3a9a('0x3e'),_0x554af1[_0x3a9a('0x3f')]);return analyticCustomReportController[_0x3a9a('0x3d')]({'id':_0x554af1[_0x3a9a('0x3f')]},_0x1e90d5)[_0x3a9a('0x31')](handleResult(_0x554af1))[_0x3a9a('0x35')](handleError());}}catch(_0x2816ee){logger['error'](JSON['stringify'](_0x2816ee));}return logger[_0x3a9a('0xc')]('no\x20report\x20id');};}function getJobs(_0x533eae){var _0x54bd9f={};if(_0x533eae){_0x54bd9f['id']=_0x533eae;}return db[_0x3a9a('0x40')][_0x3a9a('0x41')]({'where':_0x54bd9f,'include':[{'model':db[_0x3a9a('0xf')],'attributes':['id',_0x3a9a('0x1a'),_0x3a9a('0xe')],'include':[{'model':db['MailServerOut'],'as':'Smtp'}]}]})[_0x3a9a('0x31')](function(_0x10c80e){var _0x54a1b4=_[_0x3a9a('0x42')](manager[_0x3a9a('0x43')]);var _0x3097b1=_[_0x3a9a('0x44')](_0x10c80e,function(_0x52eaa1){return _0x52eaa1['id'][_0x3a9a('0x45')]();});var _0x371dda=_[_0x3a9a('0x46')](_0x10c80e,function(_0x157254){return _0x157254['id']['toString']();});var _0x197117=_0x533eae?_0x3097b1:_['difference'](_0x3097b1,_0x54a1b4);var _0x5f20ea=_[_0x3a9a('0x47')](_0x3097b1,_0x54a1b4);var _0x5b9ef1=_['difference'](_0x54a1b4,_0x3097b1);var _0x68f65b;var _0x221042;for(_0x68f65b=0x0;_0x68f65b<_0x5b9ef1[_0x3a9a('0x48')]&&!_0x533eae;_0x68f65b+=0x1){_0x221042=_0x5b9ef1[_0x68f65b]['toString']();if(manager['exists'](_0x221042)){manager['stop'](_0x221042);manager[_0x3a9a('0x49')](_0x221042);logger[_0x3a9a('0xc')](_0x3a9a('0x4a'),_0x221042);}}logger[_0x3a9a('0xc')]('toRun',JSON[_0x3a9a('0x33')](_0x197117));for(_0x68f65b=0x0;_0x68f65b<_0x197117[_0x3a9a('0x48')];_0x68f65b+=0x1){_0x221042=_0x197117[_0x68f65b][_0x3a9a('0x45')]();logger[_0x3a9a('0xc')]('index',_0x221042);if(_0x533eae){logger['info']('my\x20id',_0x533eae);logger[_0x3a9a('0xc')](JSON['stringify'](_0x371dda[_0x221042]));BPromise[_0x3a9a('0x4b')]()[_0x3a9a('0x31')](handleJob(_0x371dda[_0x221042]));logger[_0x3a9a('0xc')]('run\x20job',_0x371dda[_0x221042][_0x3a9a('0x1a')],_0x371dda[_0x221042]['cron']);}else if(_0x371dda[_0x221042]['cron']&&_0x371dda[_0x221042][_0x3a9a('0x4c')]&&moment()['isBetween'](_0x371dda[_0x221042][_0x3a9a('0x4d')],_0x371dda[_0x221042][_0x3a9a('0x4e')])){manager['add'](_0x221042,_0x371dda[_0x221042][_0x3a9a('0x4f')],handleJob(_0x371dda[_0x221042]));manager[_0x3a9a('0x50')](_0x221042);logger[_0x3a9a('0xc')](_0x3a9a('0x51'),_0x371dda[_0x221042]['name'],_0x371dda[_0x221042][_0x3a9a('0x4f')]);}else if(manager[_0x3a9a('0x52')](_0x221042)){manager['stop'](_0x221042);manager[_0x3a9a('0x49')](_0x221042);logger[_0x3a9a('0xc')](_0x3a9a('0x53'),_0x371dda[_0x221042][_0x3a9a('0x1a')],_0x371dda[_0x221042][_0x3a9a('0x4f')]);}}for(_0x68f65b=0x0,_0x221042;_0x68f65b<_0x5f20ea[_0x3a9a('0x48')]&&!_0x533eae;_0x68f65b+=0x1){_0x221042=_0x5f20ea[_0x68f65b][_0x3a9a('0x45')]();if(manager['exists'](_0x221042)){if(_0x371dda[_0x221042]['cron']&&_0x371dda[_0x221042]['active']&&moment()[_0x3a9a('0x54')](_0x371dda[_0x221042][_0x3a9a('0x4d')],_0x371dda[_0x221042][_0x3a9a('0x4e')])){manager[_0x3a9a('0x55')](_0x221042,_0x371dda[_0x221042][_0x3a9a('0x4f')],handleJob(_0x371dda[_0x221042]));logger[_0x3a9a('0xc')]('update\x20cron',_0x371dda[_0x221042]['name'],_0x371dda[_0x221042][_0x3a9a('0x4f')]);}else{manager[_0x3a9a('0x56')](_0x221042);manager[_0x3a9a('0x49')](_0x221042);logger[_0x3a9a('0xc')]('stop\x20cron',_0x371dda[_0x221042][_0x3a9a('0x1a')],_0x371dda[_0x221042][_0x3a9a('0x4f')]);}}}})['catch'](function(_0x17c79f){logger[_0x3a9a('0x36')](JSON[_0x3a9a('0x33')](_0x17c79f));});}exports[_0x3a9a('0x57')]=function(_0x25035c){return getJobs(_0x25035c);};exports['start']=function(){setInterval(function(){return getJobs();},0x3c*0x3e8);return getJobs();}; \ No newline at end of file +var _0x51e9=['email','Smtp','service','MailAccount','host','port','secure','authentication','auth','user','pass','format','\x22%s\x22\x20<%s>','Report\x20%s\x20last\x20%s\x20%s','name','subtractUnit','join','%s.%s','basename','extname','zip','existsSync','status','Sent','attachments','message','text','Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a','stringify','Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','sendIfEmpty','empty\x20file,\x20email\x20not\x20sent','request','SendMail','then','error','error\x20mail','email\x20sent','catch','isNil','subtractNumber\x20null\x20or\x20undefined','subtractUnit\x20null\x20or\x20undefined','subtract','subtractNumber','YYYY-MM-DD\x20HH:mm:ss','output','exec\x20defaul\x20report\x20id:%s','DefaultReportId','runReport','CustomReportId','exec\x20custom\x20report\x20id:%s','no\x20report\x20id','Schedule','jobs','toString','keyBy','length','stop','deleteJob','delete\x20cron','toRun','index','my\x20id','resolve','run\x20job','cron','active','startAt','endAt','add','start','add\x20cron','exists','stop\x20cron','isBetween','update','update\x20cron','run','path','lodash','moment','cron-job-manager','jayson/promise','bluebird','../logger','schedule','../../api/analyticDefaultReport/analyticDefaultReport.controller','client','http','info'];(function(_0x59cb1c,_0x161ddd){var _0x384da7=function(_0x20f3f8){while(--_0x20f3f8){_0x59cb1c['push'](_0x59cb1c['shift']());}};_0x384da7(++_0x161ddd);}(_0x51e9,0x15c));var _0x951e=function(_0x535cb3,_0x5d56a0){_0x535cb3=_0x535cb3-0x0;var _0x359bdf=_0x51e9[_0x535cb3];return _0x359bdf;};'use strict';var fs=require('fs');var util=require('util');var path=require(_0x951e('0x0'));var _=require(_0x951e('0x1'));var moment=require(_0x951e('0x2'));var CronJobManager=require(_0x951e('0x3'));var jayson=require(_0x951e('0x4'));var BPromise=require(_0x951e('0x5'));var logger=require(_0x951e('0x6'))(_0x951e('0x7'));var db=require('../../mysqldb')['db'];var analyticCustomReportController=require('../../api/analyticCustomReport/analyticCustomReport.controller');var analyticDefaultReportController=require(_0x951e('0x8'));var client=jayson[_0x951e('0x9')][_0x951e('0xa')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0xa83f91,_0x5a635c){return function(){logger[_0x951e('0xb')]('Try\x20to\x20send\x20a\x20mail\x20to',_0xa83f91[_0x951e('0xc')]);var _0x3be1db=!![];var _0xde38f1={'tls':{'rejectUnauthorized':![]}};if(_0xa83f91['MailAccount'][_0x951e('0xd')][_0x951e('0xe')]){_0xde38f1[_0x951e('0xe')]=_0xa83f91[_0x951e('0xf')]['Smtp'][_0x951e('0xe')];}else{_0xde38f1[_0x951e('0x10')]=_0xa83f91['MailAccount'][_0x951e('0xd')]['host'];_0xde38f1['port']=_0xa83f91[_0x951e('0xf')][_0x951e('0xd')][_0x951e('0x11')];_0xde38f1[_0x951e('0x12')]=_0xa83f91['MailAccount']['Smtp']['secure'];}if(_0xa83f91[_0x951e('0xf')][_0x951e('0xd')][_0x951e('0x13')]){_0xde38f1[_0x951e('0x14')]={'user':_0xa83f91[_0x951e('0xf')]['Smtp'][_0x951e('0x15')],'pass':_0xa83f91['MailAccount'][_0x951e('0xd')][_0x951e('0x16')]};}var _0xf24448={'account':_0xde38f1,'message':{'from':util[_0x951e('0x17')](_0x951e('0x18'),_0xa83f91[_0x951e('0xf')]['name'],_0xa83f91['MailAccount'][_0x951e('0xc')]||_0xa83f91[_0x951e('0xf')][_0x951e('0xd')][_0x951e('0x15')]),'to':_0xa83f91[_0x951e('0xc')],'cc':_0xa83f91['cc'],'bcc':_0xa83f91['bcc'],'subject':util[_0x951e('0x17')](_0x951e('0x19'),_0x5a635c[_0x951e('0x1a')],_0xa83f91['subtractNumber'],_0xa83f91[_0x951e('0x1b')])}};var _0x3ba49b=path[_0x951e('0x1c')](__dirname,'../../files/reports');var _0x857015=_0x5a635c['savename'];var _0x54f8c3=util[_0x951e('0x17')](_0x951e('0x1d'),path[_0x951e('0x1e')](_0x5a635c['savename'],path[_0x951e('0x1f')](_0x5a635c['savename'])),_0x951e('0x20'));var _0xf6bd89=path[_0x951e('0x1c')](_0x3ba49b,_0x857015);var _0x83b815=path[_0x951e('0x1c')](_0x3ba49b,_0x54f8c3);if(fs[_0x951e('0x21')](_0xf6bd89)){_0x5a635c[_0x951e('0x22')]=_0x951e('0x23');_0xf24448['message'][_0x951e('0x24')]=[{'filename':_0x857015,'path':_0xf6bd89}];_0xf24448[_0x951e('0x25')][_0x951e('0x26')]=util[_0x951e('0x17')](_0x951e('0x27'),JSON[_0x951e('0x28')](_0x5a635c,null,0x2));}else if(fs[_0x951e('0x21')](_0x83b815)){_0x5a635c['status']=_0x951e('0x23');_0xf24448[_0x951e('0x25')]['attachments']=[{'filename':_0x54f8c3,'path':_0x83b815}];}else{_0xf24448[_0x951e('0x25')]['text']=_0x951e('0x29');if(!_0xa83f91[_0x951e('0x2a')]){_0x3be1db=![];logger[_0x951e('0xb')](_0x951e('0x2b'));}}if(_0x3be1db){return client[_0x951e('0x2c')](_0x951e('0x2d'),_0xf24448)[_0x951e('0x2e')](function(_0x58da38){if(_0x58da38[_0x951e('0x2f')]){return logger[_0x951e('0x2f')](_0x951e('0x30'),JSON[_0x951e('0x28')](_0x58da38));}return logger[_0x951e('0xb')](_0x951e('0x31'));})[_0x951e('0x32')](function(_0x892e36){return logger[_0x951e('0x2f')]('error\x20mail',JSON['stringify'](_0x892e36));});}};}function handleError(){return function(_0x315ae5){return logger['error'](JSON[_0x951e('0x28')](_0x315ae5));};}function handleResult(_0x428f1d){return function(_0x14a494){logger[_0x951e('0xb')]('data',JSON['stringify'](_0x14a494));if(_0x428f1d[_0x951e('0xf')]&&_0x428f1d[_0x951e('0xf')]['Smtp']&&!_[_0x951e('0x33')](_0x428f1d[_0x951e('0xc')])){setTimeout(handleSendEmail(_0x428f1d,_0x14a494),0x3c*0x3e8);}};}function handleJob(_0x2745dc){return function(){try{if(_[_0x951e('0x33')](_0x2745dc['subtractNumber'])){return logger[_0x951e('0xb')](_0x951e('0x34'));}if(_['isNil'](_0x2745dc['subtractUnit'])){return logger[_0x951e('0xb')](_0x951e('0x35'));}var _0x1e9b8b={'startDate':moment()[_0x951e('0x36')](_0x2745dc[_0x951e('0x37')],_0x2745dc[_0x951e('0x1b')])['format'](_0x951e('0x38')),'endDate':moment()[_0x951e('0x17')](_0x951e('0x38')),'type':'scheduled','output':_0x2745dc[_0x951e('0x39')],'name':_0x2745dc[_0x951e('0x1a')]};if(!_[_0x951e('0x33')](_0x2745dc['DefaultReportId'])){logger[_0x951e('0xb')](_0x951e('0x3a'),_0x2745dc[_0x951e('0x3b')]);return analyticDefaultReportController[_0x951e('0x3c')]({'id':_0x2745dc['DefaultReportId']},_0x1e9b8b)['then'](handleResult(_0x2745dc))['catch'](handleError());}if(!_['isNil'](_0x2745dc[_0x951e('0x3d')])){logger[_0x951e('0xb')](_0x951e('0x3e'),_0x2745dc[_0x951e('0x3d')]);return analyticCustomReportController[_0x951e('0x3c')]({'id':_0x2745dc['CustomReportId']},_0x1e9b8b)[_0x951e('0x2e')](handleResult(_0x2745dc))['catch'](handleError());}}catch(_0x3c253f){logger[_0x951e('0x2f')](JSON[_0x951e('0x28')](_0x3c253f));}return logger[_0x951e('0xb')](_0x951e('0x3f'));};}function getJobs(_0x1a11f){var _0x3430c6={};if(_0x1a11f){_0x3430c6['id']=_0x1a11f;}return db[_0x951e('0x40')]['findAll']({'where':_0x3430c6,'include':[{'model':db[_0x951e('0xf')],'attributes':['id',_0x951e('0x1a'),_0x951e('0xc')],'include':[{'model':db['MailServerOut'],'as':_0x951e('0xd')}]}]})['then'](function(_0x37644d){var _0x16137b=_['keys'](manager[_0x951e('0x41')]);var _0x4ecd9b=_['map'](_0x37644d,function(_0x2c1b3f){return _0x2c1b3f['id'][_0x951e('0x42')]();});var _0x3fe770=_[_0x951e('0x43')](_0x37644d,function(_0x27a760){return _0x27a760['id']['toString']();});var _0xa8eb3d=_0x1a11f?_0x4ecd9b:_['difference'](_0x4ecd9b,_0x16137b);var _0x4d4b5f=_['intersection'](_0x4ecd9b,_0x16137b);var _0x53464d=_['difference'](_0x16137b,_0x4ecd9b);var _0xc67d20;var _0x5e0136;for(_0xc67d20=0x0;_0xc67d20<_0x53464d[_0x951e('0x44')]&&!_0x1a11f;_0xc67d20+=0x1){_0x5e0136=_0x53464d[_0xc67d20][_0x951e('0x42')]();if(manager['exists'](_0x5e0136)){manager[_0x951e('0x45')](_0x5e0136);manager[_0x951e('0x46')](_0x5e0136);logger[_0x951e('0xb')](_0x951e('0x47'),_0x5e0136);}}logger[_0x951e('0xb')](_0x951e('0x48'),JSON[_0x951e('0x28')](_0xa8eb3d));for(_0xc67d20=0x0;_0xc67d20<_0xa8eb3d[_0x951e('0x44')];_0xc67d20+=0x1){_0x5e0136=_0xa8eb3d[_0xc67d20][_0x951e('0x42')]();logger[_0x951e('0xb')](_0x951e('0x49'),_0x5e0136);if(_0x1a11f){logger[_0x951e('0xb')](_0x951e('0x4a'),_0x1a11f);logger[_0x951e('0xb')](JSON['stringify'](_0x3fe770[_0x5e0136]));BPromise[_0x951e('0x4b')]()[_0x951e('0x2e')](handleJob(_0x3fe770[_0x5e0136]));logger['info'](_0x951e('0x4c'),_0x3fe770[_0x5e0136][_0x951e('0x1a')],_0x3fe770[_0x5e0136][_0x951e('0x4d')]);}else if(_0x3fe770[_0x5e0136]['cron']&&_0x3fe770[_0x5e0136][_0x951e('0x4e')]&&moment()['isBetween'](_0x3fe770[_0x5e0136][_0x951e('0x4f')],_0x3fe770[_0x5e0136][_0x951e('0x50')])){manager[_0x951e('0x51')](_0x5e0136,_0x3fe770[_0x5e0136][_0x951e('0x4d')],handleJob(_0x3fe770[_0x5e0136]));manager[_0x951e('0x52')](_0x5e0136);logger[_0x951e('0xb')](_0x951e('0x53'),_0x3fe770[_0x5e0136]['name'],_0x3fe770[_0x5e0136][_0x951e('0x4d')]);}else if(manager[_0x951e('0x54')](_0x5e0136)){manager[_0x951e('0x45')](_0x5e0136);manager[_0x951e('0x46')](_0x5e0136);logger[_0x951e('0xb')](_0x951e('0x55'),_0x3fe770[_0x5e0136][_0x951e('0x1a')],_0x3fe770[_0x5e0136]['cron']);}}for(_0xc67d20=0x0,_0x5e0136;_0xc67d20<_0x4d4b5f['length']&&!_0x1a11f;_0xc67d20+=0x1){_0x5e0136=_0x4d4b5f[_0xc67d20][_0x951e('0x42')]();if(manager['exists'](_0x5e0136)){if(_0x3fe770[_0x5e0136]['cron']&&_0x3fe770[_0x5e0136][_0x951e('0x4e')]&&moment()[_0x951e('0x56')](_0x3fe770[_0x5e0136][_0x951e('0x4f')],_0x3fe770[_0x5e0136]['endAt'])){manager[_0x951e('0x57')](_0x5e0136,_0x3fe770[_0x5e0136][_0x951e('0x4d')],handleJob(_0x3fe770[_0x5e0136]));logger[_0x951e('0xb')](_0x951e('0x58'),_0x3fe770[_0x5e0136][_0x951e('0x1a')],_0x3fe770[_0x5e0136][_0x951e('0x4d')]);}else{manager['stop'](_0x5e0136);manager[_0x951e('0x46')](_0x5e0136);logger[_0x951e('0xb')](_0x951e('0x55'),_0x3fe770[_0x5e0136][_0x951e('0x1a')],_0x3fe770[_0x5e0136][_0x951e('0x4d')]);}}}})[_0x951e('0x32')](function(_0x12d6ff){logger[_0x951e('0x2f')](JSON[_0x951e('0x28')](_0x12d6ff));});}exports[_0x951e('0x59')]=function(_0x27f35c){return getJobs(_0x27f35c);};exports['start']=function(){setInterval(function(){return getJobs();},0x3c*0x3e8);return getJobs();}; \ No newline at end of file diff --git a/server/config/schedule/transcribe.js b/server/config/schedule/transcribe.js index 50ec5a4..59a0736 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 _0xd547=['TranscriptionJob','fileText','COMPLETED','TranscriptionJobStatus','Transcript','TranscriptFileUri','[RECORDING:%d]\x20Get\x20transcript','then','[RECORDING:%d]\x20Transcript\x20downloaded','results','transcripts','length','update','Sequelize','ValidationError','sentiment','sentimentAccountId','language','bucket','Sentiment\x20Analysis\x20not\x20configured','Transcript\x20not\x20available','findOne','Cloud\x20Provider\x20not\x20available','data1','Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','sentimentRegion','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','SentimentScore','Positive','Negative','Mixed','Neutral','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','FAILED','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','tempSentiment','Sentiment\x20Analysis\x20not\x20requested','CloudProvider','catch','name','SequelizeValidationError','error','inspect','findAll','No\x20transcribe\x20job\x20to\x20check','Setting','Settings\x20not\x20available','transcribe','Transcribe\x20not\x20configured','transcribeAccountId','forEach','all','request-promise','util','bluebird','../../mysqldb','Comprehend','detectSentiment','info','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','transcribeName','data2','transcribeRegion','format','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s'];(function(_0x59d4a0,_0x479290){var _0x1f7c1e=function(_0x176dd7){while(--_0x176dd7){_0x59d4a0['push'](_0x59d4a0['shift']());}};_0x1f7c1e(++_0x479290);}(_0xd547,0x1c1));var _0x7d54=function(_0x5c846d,_0x5c02ce){_0x5c846d=_0x5c846d-0x0;var _0xd064e4=_0xd547[_0x5c846d];return _0xd064e4;};var _=require('lodash');var AWS=require('aws-sdk');var rp=require(_0x7d54('0x0'));var util=require(_0x7d54('0x1'));var BPromise=require(_0x7d54('0x2'));var db=require(_0x7d54('0x3'))['db'];var logger=require('../../config/logger')('transcribe');function getTranscriptionJob(_0x21c23f,_0x5d21c1,_0x22ea09,_0x5b0a2c){return new Promise(function(_0x296dd6,_0x37defc){var _0x1b7fc1=new AWS['TranscribeService']({'accessKeyId':_0x5d21c1,'secretAccessKey':_0x21c23f,'region':_0x22ea09});_0x1b7fc1['getTranscriptionJob']({'TranscriptionJobName':_0x5b0a2c},function(_0x478f9b,_0xb224a9){if(_0x478f9b){return _0x37defc(_0x478f9b);}else{return _0x296dd6(_0xb224a9);}});});}function sentiment(_0x39885d,_0x491ddf,_0xa5b980,_0x48b250,_0x2bede6){return new Promise(function(_0x4d9dc3,_0x1d7ff7){var _0x570460=new AWS[(_0x7d54('0x4'))]({'accessKeyId':_0x491ddf,'secretAccessKey':_0x39885d,'region':_0xa5b980});_0x570460[_0x7d54('0x5')]({'Text':_0x48b250,'LanguageCode':_0x2bede6['substring'](0x0,0x2)},function(_0x4e601d,_0x5864c8){if(_0x4e601d){return _0x1d7ff7(_0x4e601d);}else{return _0x4d9dc3(_0x5864c8);}});});}function checkTranscribeJob(_0x34429f,_0x3e8072,_0x428430){var _0x4be6c5;return new BPromise(function(_0x1db640,_0x4dcb2e){logger[_0x7d54('0x6')](util['format'](_0x7d54('0x7'),_0x34429f['id'],_0x34429f[_0x7d54('0x8')]));return getTranscriptionJob(_0x428430['data1'],_0x428430[_0x7d54('0x9')],_0x3e8072[_0x7d54('0xa')],_0x34429f[_0x7d54('0x8')])['then'](function(_0x2b1b0f){logger[_0x7d54('0x6')](util[_0x7d54('0xb')](_0x7d54('0xc'),_0x34429f['id'],_0x34429f[_0x7d54('0x8')],_0x2b1b0f[_0x7d54('0xd')]['TranscriptionJobStatus']));if(!_0x34429f[_0x7d54('0xe')]){switch(_0x2b1b0f[_0x7d54('0xd')]['TranscriptionJobStatus']){case _0x7d54('0xf'):var _0x4b9caf={'transcribeStatus':_0x2b1b0f['TranscriptionJob'][_0x7d54('0x10')],'fileUri':_0x2b1b0f[_0x7d54('0xd')][_0x7d54('0x11')][_0x7d54('0x12')]};logger['info'](util[_0x7d54('0xb')](_0x7d54('0x13'),_0x34429f['id']));return rp({'uri':_0x2b1b0f['TranscriptionJob'][_0x7d54('0x11')][_0x7d54('0x12')],'json':!![]})[_0x7d54('0x14')](function(_0x6cc88b){logger[_0x7d54('0x6')](util[_0x7d54('0xb')](_0x7d54('0x15'),_0x34429f['id']));if(_0x6cc88b&&_0x6cc88b['results']&&_0x6cc88b['results']['transcripts']&&_0x6cc88b[_0x7d54('0x16')][_0x7d54('0x17')]['length']){_0x4b9caf[_0x7d54('0xe')]='';for(var _0x3990e7=0x0;_0x3990e7<_0x6cc88b[_0x7d54('0x16')][_0x7d54('0x17')][_0x7d54('0x18')];_0x3990e7++){_0x4b9caf[_0x7d54('0xe')]+=_0x6cc88b[_0x7d54('0x16')][_0x7d54('0x17')][_0x3990e7]['transcript']+'';}}return _0x34429f[_0x7d54('0x19')](_0x4b9caf);})[_0x7d54('0x14')](function(){logger['info'](util['format']('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x34429f['id']));if(!_0x34429f['tempSentiment']){throw new db[(_0x7d54('0x1a'))][(_0x7d54('0x1b'))]('Sentiment\x20Analysis\x20not\x20requested');}if(!_0x3e8072[_0x7d54('0x1c')]||!_0x3e8072[_0x7d54('0x1d')]||!_0x3e8072['sentimentRegion']||!_0x3e8072[_0x7d54('0x1e')]||!_0x3e8072[_0x7d54('0x1f')]){throw new db[(_0x7d54('0x1a'))][(_0x7d54('0x1b'))](_0x7d54('0x20'));}if(!_0x4b9caf[_0x7d54('0xe')]){throw new Error(_0x7d54('0x21'));}if(_0x3e8072[_0x7d54('0x1d')]===_0x428430['id']){return _0x428430;}else{return db['CloudProvider'][_0x7d54('0x22')]({'where':{'id':_settings['sentimentAccountId']}});}})['then'](function(_0x2602c2){if(!_0x2602c2){throw new db[(_0x7d54('0x1a'))]['ValidationError'](_0x7d54('0x23'));}if(!_0x2602c2[_0x7d54('0x24')]||!_0x2602c2[_0x7d54('0x9')]){throw new db[(_0x7d54('0x1a'))][(_0x7d54('0x1b'))](_0x7d54('0x25'));}_0x4be6c5=_0x2602c2;logger[_0x7d54('0x6')](util['format'](_0x7d54('0x26'),_0x34429f['id']));return sentiment(_0x4be6c5[_0x7d54('0x24')],_0x4be6c5['data2'],_0x3e8072[_0x7d54('0x27')],_0x4b9caf[_0x7d54('0xe')],_0x3e8072[_0x7d54('0x1e')]);})['then'](function(_0x1b3f17){logger[_0x7d54('0x6')](util[_0x7d54('0xb')](_0x7d54('0x28'),_0x34429f['id']));return _0x34429f[_0x7d54('0x19')]({'sentiment':_0x1b3f17['Sentiment'],'sPositive':_0x1b3f17[_0x7d54('0x29')][_0x7d54('0x2a')],'sNegative':_0x1b3f17['SentimentScore'][_0x7d54('0x2b')],'sMixed':_0x1b3f17[_0x7d54('0x29')][_0x7d54('0x2c')],'sNeutral':_0x1b3f17[_0x7d54('0x29')][_0x7d54('0x2d')]});})[_0x7d54('0x14')](function(){logger[_0x7d54('0x6')](util[_0x7d54('0xb')](_0x7d54('0x2e'),_0x34429f['id']));_0x1db640();});case _0x7d54('0x2f'):return _0x34429f[_0x7d54('0x19')]({'transcribeStatus':_0x7d54('0x2f'),'failureReason':_0x2b1b0f['TranscriptionJob']['FailureReason']})[_0x7d54('0x14')](function(){logger[_0x7d54('0x6')](util[_0x7d54('0xb')](_0x7d54('0x2e'),_0x34429f['id']));_0x1db640();});default:logger['info'](util['format'](_0x7d54('0x30'),_0x34429f['id']));break;}}else{return BPromise['resolve']()[_0x7d54('0x14')](function(){if(!_0x34429f[_0x7d54('0x31')]){throw new db['Sequelize']['ValidationError'](_0x7d54('0x32'));}if(!_0x3e8072[_0x7d54('0x1c')]||!_0x3e8072['sentimentAccountId']||!_0x3e8072[_0x7d54('0x27')]||!_0x3e8072[_0x7d54('0x1e')]||!_0x3e8072['bucket']){throw new db['Sequelize'][(_0x7d54('0x1b'))](_0x7d54('0x20'));}if(!_0x34429f[_0x7d54('0xe')]){throw new Error(_0x7d54('0x21'));}if(_0x3e8072[_0x7d54('0x1d')]===_0x428430['id']){return _0x428430;}else{return db[_0x7d54('0x33')][_0x7d54('0x22')]({'where':{'id':_settings[_0x7d54('0x1d')]}});}})[_0x7d54('0x14')](function(_0x2fbdf7){if(!_0x2fbdf7){throw new db[(_0x7d54('0x1a'))]['ValidationError']('Cloud\x20Provider\x20not\x20available');}if(!_0x2fbdf7[_0x7d54('0x24')]||!_0x2fbdf7[_0x7d54('0x9')]){throw new db[(_0x7d54('0x1a'))][(_0x7d54('0x1b'))](_0x7d54('0x25'));}_0x4be6c5=_0x2fbdf7;logger[_0x7d54('0x6')](util[_0x7d54('0xb')]('[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis',_0x34429f['id']));return sentiment(_0x4be6c5[_0x7d54('0x24')],_0x4be6c5['data2'],_0x3e8072['sentimentRegion'],_0x34429f[_0x7d54('0xe')],_0x3e8072[_0x7d54('0x1e')]);})[_0x7d54('0x14')](function(_0x462583){logger[_0x7d54('0x6')](util['format'](_0x7d54('0x28'),_0x34429f['id']));return _0x34429f[_0x7d54('0x19')]({'sentiment':_0x462583['Sentiment'],'sPositive':_0x462583[_0x7d54('0x29')][_0x7d54('0x2a')],'sNegative':_0x462583[_0x7d54('0x29')][_0x7d54('0x2b')],'sMixed':_0x462583[_0x7d54('0x29')][_0x7d54('0x2c')],'sNeutral':_0x462583['SentimentScore'][_0x7d54('0x2d')],'transcribeStatus':_0x7d54('0xf')});})[_0x7d54('0x14')](function(){logger[_0x7d54('0x6')](util[_0x7d54('0xb')](_0x7d54('0x2e'),_0x34429f['id']));_0x1db640();});}})[_0x7d54('0x34')](function(_0x497899){if(_0x497899){if(!_0x497899[_0x7d54('0x35')]||_0x497899[_0x7d54('0x35')]!==_0x7d54('0x36')){logger[_0x7d54('0x37')](util[_0x7d54('0xb')]('[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis',_0x34429f['id']),util[_0x7d54('0x38')](_0x497899,{'showHidden':![],'depth':null}));}}_0x1db640();});});}function checkTranscribe(){var _0x4e8c02;var _0x15246e;var _0x560b42;return db['VoiceRecording'][_0x7d54('0x39')]({'where':{'transcribeStatus':'IN_PROGRESS'}})['then'](function(_0x418ace){if(!_0x418ace||!_0x418ace[_0x7d54('0x18')]){throw new db['Sequelize'][(_0x7d54('0x1b'))](_0x7d54('0x3a'));}_0x4e8c02=_0x418ace;return db[_0x7d54('0x3b')]['findOne']({'where':{'id':0x1}});})[_0x7d54('0x14')](function(_0x57bb14){if(!_0x57bb14){throw new db[(_0x7d54('0x1a'))][(_0x7d54('0x1b'))](_0x7d54('0x3c'));}_0x15246e=_0x57bb14;if(!_0x15246e[_0x7d54('0x3d')]||!_0x15246e['transcribeAccountId']||!_0x15246e['transcribeRegion']||!_0x15246e[_0x7d54('0x1e')]||!_0x15246e[_0x7d54('0x1f')]){throw new db[(_0x7d54('0x1a'))][(_0x7d54('0x1b'))](_0x7d54('0x3e'));}return db['CloudProvider'][_0x7d54('0x22')]({'where':{'id':_0x15246e[_0x7d54('0x3f')]}});})['then'](function(_0x2e3e08){if(!_0x2e3e08){throw new db[(_0x7d54('0x1a'))][(_0x7d54('0x1b'))](_0x7d54('0x23'));}if(!_0x2e3e08[_0x7d54('0x24')]||!_0x2e3e08[_0x7d54('0x9')]){throw new db[(_0x7d54('0x1a'))][(_0x7d54('0x1b'))]('Cloud\x20Provider\x20not\x20configured');}_0x560b42=_0x2e3e08;var _0x1bd894=[];_0x4e8c02[_0x7d54('0x40')](function(_0x2938ac){_0x1bd894['push'](checkTranscribeJob(_0x2938ac,_0x15246e,_0x560b42));});return BPromise[_0x7d54('0x41')](_0x1bd894);})[_0x7d54('0x34')](function(_0x1209ca){if(_0x1209ca){if(!_0x1209ca[_0x7d54('0x35')]||_0x1209ca['name']!==_0x7d54('0x36')){logger[_0x7d54('0x37')](util[_0x7d54('0x38')](_0x1209ca,{'showHidden':![],'depth':null}));}}});}exports['start']=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();}; \ No newline at end of file +var _0x8efc=['transcript','update','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','Sequelize','ValidationError','sentimentAccountId','language','Sentiment\x20Analysis\x20not\x20configured','CloudProvider','findOne','Cloud\x20Provider\x20not\x20available','Cloud\x20Provider\x20not\x20configured','sentimentRegion','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','SentimentScore','Positive','Mixed','Neutral','FAILED','FailureReason','resolve','tempSentiment','sentiment','Sentiment','catch','name','SequelizeValidationError','error','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','VoiceRecording','findAll','IN_PROGRESS','No\x20transcribe\x20job\x20to\x20check','Setting','bucket','transcribeAccountId','push','all','inspect','aws-sdk','request-promise','util','bluebird','../../config/logger','transcribe','TranscribeService','getTranscriptionJob','Comprehend','detectSentiment','substring','info','format','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','transcribeName','data1','data2','transcribeRegion','then','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJob','TranscriptionJobStatus','fileText','COMPLETED','Transcript','[RECORDING:%d]\x20Get\x20transcript','TranscriptFileUri','[RECORDING:%d]\x20Transcript\x20downloaded','results','transcripts','length'];(function(_0x515629,_0x47a7bc){var _0x47b07d=function(_0xe3fa73){while(--_0xe3fa73){_0x515629['push'](_0x515629['shift']());}};_0x47b07d(++_0x47a7bc);}(_0x8efc,0xb3));var _0xc8ef=function(_0x4206f5,_0x21f338){_0x4206f5=_0x4206f5-0x0;var _0xa29cf3=_0x8efc[_0x4206f5];return _0xa29cf3;};var _=require('lodash');var AWS=require(_0xc8ef('0x0'));var rp=require(_0xc8ef('0x1'));var util=require(_0xc8ef('0x2'));var BPromise=require(_0xc8ef('0x3'));var db=require('../../mysqldb')['db'];var logger=require(_0xc8ef('0x4'))(_0xc8ef('0x5'));function getTranscriptionJob(_0x33b9c9,_0x50d1f6,_0x2910b5,_0x3c6189){return new Promise(function(_0x1cd466,_0x13b433){var _0x576ff9=new AWS[(_0xc8ef('0x6'))]({'accessKeyId':_0x50d1f6,'secretAccessKey':_0x33b9c9,'region':_0x2910b5});_0x576ff9[_0xc8ef('0x7')]({'TranscriptionJobName':_0x3c6189},function(_0x1c8931,_0x489778){if(_0x1c8931){return _0x13b433(_0x1c8931);}else{return _0x1cd466(_0x489778);}});});}function sentiment(_0x11f3ba,_0x443ee3,_0x1a9a5f,_0xcc3c21,_0x56cfb1){return new Promise(function(_0x315d93,_0x574588){var _0x45dbd3=new AWS[(_0xc8ef('0x8'))]({'accessKeyId':_0x443ee3,'secretAccessKey':_0x11f3ba,'region':_0x1a9a5f});_0x45dbd3[_0xc8ef('0x9')]({'Text':_0xcc3c21,'LanguageCode':_0x56cfb1[_0xc8ef('0xa')](0x0,0x2)},function(_0xa76b59,_0x44d7da){if(_0xa76b59){return _0x574588(_0xa76b59);}else{return _0x315d93(_0x44d7da);}});});}function checkTranscribeJob(_0x18213f,_0x1c6744,_0xb90ed0){var _0x15669b;return new BPromise(function(_0x3e7c04,_0x1207d8){logger[_0xc8ef('0xb')](util[_0xc8ef('0xc')](_0xc8ef('0xd'),_0x18213f['id'],_0x18213f[_0xc8ef('0xe')]));return getTranscriptionJob(_0xb90ed0[_0xc8ef('0xf')],_0xb90ed0[_0xc8ef('0x10')],_0x1c6744[_0xc8ef('0x11')],_0x18213f[_0xc8ef('0xe')])[_0xc8ef('0x12')](function(_0x45eb4b){logger['info'](util[_0xc8ef('0xc')](_0xc8ef('0x13'),_0x18213f['id'],_0x18213f[_0xc8ef('0xe')],_0x45eb4b[_0xc8ef('0x14')][_0xc8ef('0x15')]));if(!_0x18213f[_0xc8ef('0x16')]){switch(_0x45eb4b[_0xc8ef('0x14')][_0xc8ef('0x15')]){case _0xc8ef('0x17'):var _0x3591c={'transcribeStatus':_0x45eb4b['TranscriptionJob'][_0xc8ef('0x15')],'fileUri':_0x45eb4b['TranscriptionJob'][_0xc8ef('0x18')]['TranscriptFileUri']};logger[_0xc8ef('0xb')](util['format'](_0xc8ef('0x19'),_0x18213f['id']));return rp({'uri':_0x45eb4b[_0xc8ef('0x14')][_0xc8ef('0x18')][_0xc8ef('0x1a')],'json':!![]})[_0xc8ef('0x12')](function(_0x4c57e3){logger[_0xc8ef('0xb')](util[_0xc8ef('0xc')](_0xc8ef('0x1b'),_0x18213f['id']));if(_0x4c57e3&&_0x4c57e3['results']&&_0x4c57e3[_0xc8ef('0x1c')]['transcripts']&&_0x4c57e3['results']['transcripts']['length']){_0x3591c[_0xc8ef('0x16')]='';for(var _0x128556=0x0;_0x128556<_0x4c57e3[_0xc8ef('0x1c')][_0xc8ef('0x1d')][_0xc8ef('0x1e')];_0x128556++){_0x3591c[_0xc8ef('0x16')]+=_0x4c57e3[_0xc8ef('0x1c')][_0xc8ef('0x1d')][_0x128556][_0xc8ef('0x1f')]+'';}}return _0x18213f[_0xc8ef('0x20')](_0x3591c);})[_0xc8ef('0x12')](function(){logger[_0xc8ef('0xb')](util[_0xc8ef('0xc')](_0xc8ef('0x21'),_0x18213f['id']));if(!_0x18213f['tempSentiment']){throw new db[(_0xc8ef('0x22'))][(_0xc8ef('0x23'))]('Sentiment\x20Analysis\x20not\x20requested');}if(!_0x1c6744['sentiment']||!_0x1c6744[_0xc8ef('0x24')]||!_0x1c6744['sentimentRegion']||!_0x1c6744[_0xc8ef('0x25')]||!_0x1c6744['bucket']){throw new db[(_0xc8ef('0x22'))]['ValidationError'](_0xc8ef('0x26'));}if(!_0x3591c[_0xc8ef('0x16')]){throw new Error('Transcript\x20not\x20available');}if(_0x1c6744['sentimentAccountId']===_0xb90ed0['id']){return _0xb90ed0;}else{return db[_0xc8ef('0x27')][_0xc8ef('0x28')]({'where':{'id':_settings['sentimentAccountId']}});}})[_0xc8ef('0x12')](function(_0x3bde31){if(!_0x3bde31){throw new db[(_0xc8ef('0x22'))][(_0xc8ef('0x23'))](_0xc8ef('0x29'));}if(!_0x3bde31[_0xc8ef('0xf')]||!_0x3bde31[_0xc8ef('0x10')]){throw new db[(_0xc8ef('0x22'))][(_0xc8ef('0x23'))](_0xc8ef('0x2a'));}_0x15669b=_0x3bde31;logger[_0xc8ef('0xb')](util[_0xc8ef('0xc')]('[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis',_0x18213f['id']));return sentiment(_0x15669b[_0xc8ef('0xf')],_0x15669b[_0xc8ef('0x10')],_0x1c6744[_0xc8ef('0x2b')],_0x3591c[_0xc8ef('0x16')],_0x1c6744['language']);})[_0xc8ef('0x12')](function(_0x1890de){logger['info'](util[_0xc8ef('0xc')](_0xc8ef('0x2c'),_0x18213f['id']));return _0x18213f['update']({'sentiment':_0x1890de['Sentiment'],'sPositive':_0x1890de[_0xc8ef('0x2d')][_0xc8ef('0x2e')],'sNegative':_0x1890de[_0xc8ef('0x2d')]['Negative'],'sMixed':_0x1890de['SentimentScore'][_0xc8ef('0x2f')],'sNeutral':_0x1890de[_0xc8ef('0x2d')][_0xc8ef('0x30')]});})[_0xc8ef('0x12')](function(){logger[_0xc8ef('0xb')](util['format'](_0xc8ef('0x21'),_0x18213f['id']));_0x3e7c04();});case _0xc8ef('0x31'):return _0x18213f[_0xc8ef('0x20')]({'transcribeStatus':_0xc8ef('0x31'),'failureReason':_0x45eb4b[_0xc8ef('0x14')][_0xc8ef('0x32')]})['then'](function(){logger[_0xc8ef('0xb')](util[_0xc8ef('0xc')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x18213f['id']));_0x3e7c04();});default:logger['info'](util['format']('[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed',_0x18213f['id']));break;}}else{return BPromise[_0xc8ef('0x33')]()['then'](function(){if(!_0x18213f[_0xc8ef('0x34')]){throw new db[(_0xc8ef('0x22'))][(_0xc8ef('0x23'))]('Sentiment\x20Analysis\x20not\x20requested');}if(!_0x1c6744[_0xc8ef('0x35')]||!_0x1c6744[_0xc8ef('0x24')]||!_0x1c6744[_0xc8ef('0x2b')]||!_0x1c6744[_0xc8ef('0x25')]||!_0x1c6744['bucket']){throw new db[(_0xc8ef('0x22'))][(_0xc8ef('0x23'))](_0xc8ef('0x26'));}if(!_0x18213f[_0xc8ef('0x16')]){throw new Error('Transcript\x20not\x20available');}if(_0x1c6744['sentimentAccountId']===_0xb90ed0['id']){return _0xb90ed0;}else{return db[_0xc8ef('0x27')][_0xc8ef('0x28')]({'where':{'id':_settings[_0xc8ef('0x24')]}});}})[_0xc8ef('0x12')](function(_0x351109){if(!_0x351109){throw new db['Sequelize']['ValidationError'](_0xc8ef('0x29'));}if(!_0x351109['data1']||!_0x351109[_0xc8ef('0x10')]){throw new db[(_0xc8ef('0x22'))][(_0xc8ef('0x23'))]('Cloud\x20Provider\x20not\x20configured');}_0x15669b=_0x351109;logger[_0xc8ef('0xb')](util[_0xc8ef('0xc')]('[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis',_0x18213f['id']));return sentiment(_0x15669b[_0xc8ef('0xf')],_0x15669b['data2'],_0x1c6744[_0xc8ef('0x2b')],_0x18213f[_0xc8ef('0x16')],_0x1c6744[_0xc8ef('0x25')]);})['then'](function(_0x5b1ef1){logger['info'](util[_0xc8ef('0xc')](_0xc8ef('0x2c'),_0x18213f['id']));return _0x18213f[_0xc8ef('0x20')]({'sentiment':_0x5b1ef1[_0xc8ef('0x36')],'sPositive':_0x5b1ef1[_0xc8ef('0x2d')][_0xc8ef('0x2e')],'sNegative':_0x5b1ef1[_0xc8ef('0x2d')]['Negative'],'sMixed':_0x5b1ef1['SentimentScore'][_0xc8ef('0x2f')],'sNeutral':_0x5b1ef1[_0xc8ef('0x2d')][_0xc8ef('0x30')],'transcribeStatus':_0xc8ef('0x17')});})[_0xc8ef('0x12')](function(){logger['info'](util[_0xc8ef('0xc')](_0xc8ef('0x21'),_0x18213f['id']));_0x3e7c04();});}})[_0xc8ef('0x37')](function(_0xc932df){if(_0xc932df){if(!_0xc932df['name']||_0xc932df[_0xc8ef('0x38')]!==_0xc8ef('0x39')){logger[_0xc8ef('0x3a')](util['format'](_0xc8ef('0x3b'),_0x18213f['id']),util['inspect'](_0xc932df,{'showHidden':![],'depth':null}));}}_0x3e7c04();});});}function checkTranscribe(){var _0x7e5c5a;var _0x52eac7;var _0x3dbb7a;return db[_0xc8ef('0x3c')][_0xc8ef('0x3d')]({'where':{'transcribeStatus':_0xc8ef('0x3e')}})[_0xc8ef('0x12')](function(_0x3e0398){if(!_0x3e0398||!_0x3e0398[_0xc8ef('0x1e')]){throw new db[(_0xc8ef('0x22'))]['ValidationError'](_0xc8ef('0x3f'));}_0x7e5c5a=_0x3e0398;return db[_0xc8ef('0x40')]['findOne']({'where':{'id':0x1}});})['then'](function(_0xe997a){if(!_0xe997a){throw new db['Sequelize'][(_0xc8ef('0x23'))]('Settings\x20not\x20available');}_0x52eac7=_0xe997a;if(!_0x52eac7[_0xc8ef('0x5')]||!_0x52eac7['transcribeAccountId']||!_0x52eac7[_0xc8ef('0x11')]||!_0x52eac7[_0xc8ef('0x25')]||!_0x52eac7[_0xc8ef('0x41')]){throw new db[(_0xc8ef('0x22'))][(_0xc8ef('0x23'))]('Transcribe\x20not\x20configured');}return db[_0xc8ef('0x27')][_0xc8ef('0x28')]({'where':{'id':_0x52eac7[_0xc8ef('0x42')]}});})[_0xc8ef('0x12')](function(_0x1b460a){if(!_0x1b460a){throw new db[(_0xc8ef('0x22'))]['ValidationError']('Cloud\x20Provider\x20not\x20available');}if(!_0x1b460a[_0xc8ef('0xf')]||!_0x1b460a[_0xc8ef('0x10')]){throw new db['Sequelize']['ValidationError'](_0xc8ef('0x2a'));}_0x3dbb7a=_0x1b460a;var _0x1cfab1=[];_0x7e5c5a['forEach'](function(_0x479742){_0x1cfab1[_0xc8ef('0x43')](checkTranscribeJob(_0x479742,_0x52eac7,_0x3dbb7a));});return BPromise[_0xc8ef('0x44')](_0x1cfab1);})[_0xc8ef('0x37')](function(_0xb58103){if(_0xb58103){if(!_0xb58103[_0xc8ef('0x38')]||_0xb58103['name']!==_0xc8ef('0x39')){logger[_0xc8ef('0x3a')](util[_0xc8ef('0x45')](_0xb58103,{'showHidden':![],'depth':null}));}}});}exports['start']=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 56b6591..b822dcc 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 _0xc4a7=['defaults','localhost','socket.io-emitter','WhatsappInteraction','findAll','lastMsgAt','subtract','hours','then','info','[WHATSAPP]\x20Interactions\x20to\x20close:','update','system','timeout','format','YYYY-MM-DD\x20HH:mm:ss','length','[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:','join','emit','whatsappInteraction:update','catch','error','inspect','start','lodash','moment','ioredis','util','../../mysqldb','../logger','schedule','redis'];(function(_0x1af6a4,_0x5ccef3){var _0x14b3bd=function(_0x1c361a){while(--_0x1c361a){_0x1af6a4['push'](_0x1af6a4['shift']());}};_0x14b3bd(++_0x5ccef3);}(_0xc4a7,0x163));var _0x7c4a=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc4a7[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x7c4a('0x0'));var moment=require(_0x7c4a('0x1'));var Redis=require(_0x7c4a('0x2'));var util=require(_0x7c4a('0x3'));var config=require('../../config/environment');var db=require(_0x7c4a('0x4'))['db'];var logger=require(_0x7c4a('0x5'))(_0x7c4a('0x6'));config[_0x7c4a('0x7')]=_[_0x7c4a('0x8')](config[_0x7c4a('0x7')],{'host':_0x7c4a('0x9'),'port':0x18eb});var io=require(_0x7c4a('0xa'))(new Redis(config[_0x7c4a('0x7')]));function closeInteractions(){var _0x31fb00=[];return db[_0x7c4a('0xb')][_0x7c4a('0xc')]({'raw':!![],'attributes':['id',_0x7c4a('0xd')],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()[_0x7c4a('0xe')](0x18,_0x7c4a('0xf'))}}})[_0x7c4a('0x10')](function(_0xc66d54){if(_0xc66d54&&_0xc66d54['length']){_0x31fb00=_['map'](_0xc66d54||[],'id');logger[_0x7c4a('0x11')](_0x7c4a('0x12'),_0x31fb00['join']());return db[_0x7c4a('0xb')][_0x7c4a('0x13')]({'closeReason':_0x7c4a('0x14'),'disposition':_0x7c4a('0x15'),'closed':!![],'closedAt':moment()[_0x7c4a('0x16')](_0x7c4a('0x17'))},{'where':{'id':_0x31fb00}});}})[_0x7c4a('0x10')](function(){if(_0x31fb00&&_0x31fb00[_0x7c4a('0x18')]){logger[_0x7c4a('0x11')](_0x7c4a('0x19'),_0x31fb00[_0x7c4a('0x1a')]());for(var _0x2b018c=0x0;_0x2b018c<_0x31fb00['length'];_0x2b018c++){io[_0x7c4a('0x1b')](_0x7c4a('0x1c'),{'id':_0x31fb00[_0x2b018c],'closed':!![]});}}})[_0x7c4a('0x1d')](function(_0x1db558){logger[_0x7c4a('0x1e')]('[WHATSAPP]\x20Error\x20closing\x20interactions',_0x1db558?util[_0x7c4a('0x1f')](_0x1db558,{'showHidden':![],'depth':null}):'');});}exports[_0x7c4a('0x20')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0xb835=['../../mysqldb','../logger','schedule','redis','localhost','socket.io-emitter','WhatsappInteraction','subtract','hours','then','length','map','[WHATSAPP]\x20Interactions\x20to\x20close:','update','timeout','format','YYYY-MM-DD\x20HH:mm:ss','info','join','emit','whatsappInteraction:update','catch','error','inspect','start','lodash','moment','ioredis','util','../../config/environment'];(function(_0x4e1d2d,_0x5a44e1){var _0x520f96=function(_0x432d2d){while(--_0x432d2d){_0x4e1d2d['push'](_0x4e1d2d['shift']());}};_0x520f96(++_0x5a44e1);}(_0xb835,0xcd));var _0x5b83=function(_0x40ced3,_0x54b6e5){_0x40ced3=_0x40ced3-0x0;var _0x78a9ec=_0xb835[_0x40ced3];return _0x78a9ec;};'use strict';var _=require(_0x5b83('0x0'));var moment=require(_0x5b83('0x1'));var Redis=require(_0x5b83('0x2'));var util=require(_0x5b83('0x3'));var config=require(_0x5b83('0x4'));var db=require(_0x5b83('0x5'))['db'];var logger=require(_0x5b83('0x6'))(_0x5b83('0x7'));config[_0x5b83('0x8')]=_['defaults'](config['redis'],{'host':_0x5b83('0x9'),'port':0x18eb});var io=require(_0x5b83('0xa'))(new Redis(config['redis']));function closeInteractions(){var _0x42119b=[];return db[_0x5b83('0xb')]['findAll']({'raw':!![],'attributes':['id','lastMsgAt'],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()[_0x5b83('0xc')](0x18,_0x5b83('0xd'))}}})[_0x5b83('0xe')](function(_0x333220){if(_0x333220&&_0x333220[_0x5b83('0xf')]){_0x42119b=_[_0x5b83('0x10')](_0x333220||[],'id');logger['info'](_0x5b83('0x11'),_0x42119b['join']());return db[_0x5b83('0xb')][_0x5b83('0x12')]({'closeReason':'system','disposition':_0x5b83('0x13'),'closed':!![],'closedAt':moment()[_0x5b83('0x14')](_0x5b83('0x15'))},{'where':{'id':_0x42119b}});}})[_0x5b83('0xe')](function(){if(_0x42119b&&_0x42119b[_0x5b83('0xf')]){logger[_0x5b83('0x16')]('[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:',_0x42119b[_0x5b83('0x17')]());for(var _0x2a8f2a=0x0;_0x2a8f2a<_0x42119b[_0x5b83('0xf')];_0x2a8f2a++){io[_0x5b83('0x18')](_0x5b83('0x19'),{'id':_0x42119b[_0x2a8f2a],'closed':!![]});}}})[_0x5b83('0x1a')](function(_0x425c99){logger[_0x5b83('0x1b')]('[WHATSAPP]\x20Error\x20closing\x20interactions',_0x425c99?util[_0x5b83('0x1c')](_0x425c99,{'showHidden':![],'depth':null}):'');});}exports[_0x5b83('0x1d')]=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 eaa3290..be03f7a 100644 --- a/server/config/seedContact.js +++ b/server/config/seedContact.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x410f=['finished\x20populating','contacts1','hopper1','hopper2','util','push','Innocenzo','Biondo','@xcally.com','now','innocenzo.biondo','CmContact','destroy','bulkCreate','then','log'];(function(_0x3aaf69,_0x318ff9){var _0x4542c6=function(_0x5d1369){while(--_0x5d1369){_0x3aaf69['push'](_0x3aaf69['shift']());}};_0x4542c6(++_0x318ff9);}(_0x410f,0x94));var _0xf410=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x410f[_0x3dd15e];return _0x231fd0;};'use strict';var util=require(_0xf410('0x0'));var db=require('../mysqldb')['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0xf410('0x1')]({'id':i,'firstName':_0xf410('0x2')+i,'lastName':_0xf410('0x3')+i,'phone':0xf879fb460+i,'email':'innocenzo.biondo'+i+_0xf410('0x4')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0xf410('0x1')]({'id':i,'active':![],'scheduledat':Date['now'](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date['now'](),'updatedAt':Date[_0xf410('0x5')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0xf410('0x1')]({'id':i,'firstName':'Innocenzo'+i,'lastName':'Biondo'+i,'phone':0xf879fb460+i,'email':_0xf410('0x6')+i+_0xf410('0x4')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0xf410('0x1')]({'id':i,'active':![],'scheduledat':Date[_0xf410('0x5')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0xf410('0x5')](),'updatedAt':Date[_0xf410('0x5')]()});}db[_0xf410('0x7')][_0xf410('0x8')]({'where':{}})['then'](function(){return db[_0xf410('0x7')][_0xf410('0x9')](contacts);})[_0xf410('0xa')](function(){console[_0xf410('0xb')](_0xf410('0xc'),_0xf410('0xd'));return db['CmHopper'][_0xf410('0x8')]({'where':{}});})['then'](function(){return db['CmHopper']['bulkCreate'](hopper);})[_0xf410('0xa')](function(){console[_0xf410('0xb')](_0xf410('0xc'),_0xf410('0xe'));return db[_0xf410('0x7')]['bulkCreate'](contacts2);})[_0xf410('0xa')](function(){console['log'](_0xf410('0xc'),'contacts2');return db['CmHopper'][_0xf410('0x9')](hopper2);})[_0xf410('0xa')](function(){console[_0xf410('0xb')](_0xf410('0xc'),_0xf410('0xf'));})['catch'](function(_0x9c54ef){console['log'](_0x9c54ef);}); \ No newline at end of file +var _0x2c63=['CmHopper','bulkCreate','log','hopper1','contacts2','hopper2','util','../mysqldb','Biondo','innocenzo.biondo','push','now','Innocenzo','@xcally.com','CmContact','destroy','then','finished\x20populating'];(function(_0x4fbde2,_0x364951){var _0x2bce29=function(_0x3a97c9){while(--_0x3a97c9){_0x4fbde2['push'](_0x4fbde2['shift']());}};_0x2bce29(++_0x364951);}(_0x2c63,0x15c));var _0x32c6=function(_0x465a0c,_0x19d4d5){_0x465a0c=_0x465a0c-0x0;var _0x1e202e=_0x2c63[_0x465a0c];return _0x1e202e;};'use strict';var util=require(_0x32c6('0x0'));var db=require(_0x32c6('0x1'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts['push']({'id':i,'firstName':'Innocenzo'+i,'lastName':_0x32c6('0x2')+i,'phone':0xf879fb460+i,'email':_0x32c6('0x3')+i+'@xcally.com'});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0x32c6('0x4')]({'id':i,'active':![],'scheduledat':Date[_0x32c6('0x5')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x32c6('0x5')](),'updatedAt':Date[_0x32c6('0x5')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0x32c6('0x4')]({'id':i,'firstName':_0x32c6('0x6')+i,'lastName':_0x32c6('0x2')+i,'phone':0xf879fb460+i,'email':_0x32c6('0x3')+i+_0x32c6('0x7')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2['push']({'id':i,'active':![],'scheduledat':Date['now'](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x32c6('0x5')](),'updatedAt':Date['now']()});}db[_0x32c6('0x8')][_0x32c6('0x9')]({'where':{}})['then'](function(){return db[_0x32c6('0x8')]['bulkCreate'](contacts);})[_0x32c6('0xa')](function(){console['log'](_0x32c6('0xb'),'contacts1');return db[_0x32c6('0xc')][_0x32c6('0x9')]({'where':{}});})[_0x32c6('0xa')](function(){return db['CmHopper'][_0x32c6('0xd')](hopper);})[_0x32c6('0xa')](function(){console[_0x32c6('0xe')]('finished\x20populating',_0x32c6('0xf'));return db[_0x32c6('0x8')][_0x32c6('0xd')](contacts2);})[_0x32c6('0xa')](function(){console[_0x32c6('0xe')](_0x32c6('0xb'),_0x32c6('0x10'));return db[_0x32c6('0xc')][_0x32c6('0xd')](hopper2);})['then'](function(){console[_0x32c6('0xe')](_0x32c6('0xb'),_0x32c6('0x11'));})['catch'](function(_0x123518){console[_0x32c6('0xe')](_0x123518);}); \ No newline at end of file diff --git a/server/config/seedUsers.js b/server/config/seedUsers.js index 10f4db1..3e6d2f9 100644 --- a/server/config/seedUsers.js +++ b/server/config/seedUsers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x38a4=['%s%s','agent','format','%s%s@xcally.com','password','friend','wss','ulaw','yes','/etc/pki/tls/certs/motion.crt','actpass','\x22%s\x22\x20<%s>','then','log','add\x20user','catch','util'];(function(_0x2c27ed,_0x5c50f0){var _0x597bd1=function(_0xd6db18){while(--_0xd6db18){_0x2c27ed['push'](_0x2c27ed['shift']());}};_0x597bd1(++_0x5c50f0);}(_0x38a4,0x87));var _0x438a=function(_0x3b1edb,_0x530c5a){_0x3b1edb=_0x3b1edb-0x0;var _0x11559a=_0x38a4[_0x3b1edb];return _0x11559a;};'use strict';var util=require(_0x438a('0x0'));var db=require('../mysqldb')['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users['push']({'name':util['format'](_0x438a('0x1'),_0x438a('0x2'),i),'fullname':util[_0x438a('0x3')]('%s%s',_0x438a('0x2'),i),'email':util[_0x438a('0x3')](_0x438a('0x4'),_0x438a('0x2'),i),'role':'agent','password':_0x438a('0x5'),'internal':0xfa0+i,'type':_0x438a('0x6'),'transport':['udp','ws',_0x438a('0x7')],'disallow':['all'],'allow':[_0x438a('0x8')],'defaultuser':util[_0x438a('0x3')]('%s%s',_0x438a('0x2'),i),'encryption':'yes','avpf':'yes','force_avp':_0x438a('0x9'),'icesupport':_0x438a('0x9'),'dtlsenable':_0x438a('0x9'),'dtlsverify':'no','dtlscertfile':_0x438a('0xa'),'dtlsprivatekey':'/etc/pki/tls/private/motion.key','dtlssetup':_0x438a('0xb'),'callerid':util[_0x438a('0x3')](_0x438a('0xc'),util['format'](_0x438a('0x1'),_0x438a('0x2'),i),0xfa0+i)});}db['User']['bulkCreate'](users)[_0x438a('0xd')](function(){console[_0x438a('0xe')](_0x438a('0xf'));})[_0x438a('0x10')](function(_0x4104e6){console[_0x438a('0xe')](_0x4104e6);}); \ No newline at end of file +var _0x249e=['then','log','add\x20user','catch','util','format','%s%s','%s%s@xcally.com','agent','friend','udp','wss','all','ulaw','yes','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','actpass','\x22%s\x22\x20<%s>','User','bulkCreate'];(function(_0x491d47,_0x469915){var _0x34a394=function(_0x16d9c3){while(--_0x16d9c3){_0x491d47['push'](_0x491d47['shift']());}};_0x34a394(++_0x469915);}(_0x249e,0xc1));var _0xe249=function(_0x303ff8,_0x33f5d){_0x303ff8=_0x303ff8-0x0;var _0x34a3a6=_0x249e[_0x303ff8];return _0x34a3a6;};'use strict';var util=require(_0xe249('0x0'));var db=require('../mysqldb')['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users['push']({'name':util['format']('%s%s','agent',i),'fullname':util[_0xe249('0x1')](_0xe249('0x2'),'agent',i),'email':util['format'](_0xe249('0x3'),_0xe249('0x4'),i),'role':_0xe249('0x4'),'password':'password','internal':0xfa0+i,'type':_0xe249('0x5'),'transport':[_0xe249('0x6'),'ws',_0xe249('0x7')],'disallow':[_0xe249('0x8')],'allow':[_0xe249('0x9')],'defaultuser':util['format'](_0xe249('0x2'),_0xe249('0x4'),i),'encryption':'yes','avpf':_0xe249('0xa'),'force_avp':'yes','icesupport':_0xe249('0xa'),'dtlsenable':_0xe249('0xa'),'dtlsverify':'no','dtlscertfile':_0xe249('0xb'),'dtlsprivatekey':_0xe249('0xc'),'dtlssetup':_0xe249('0xd'),'callerid':util[_0xe249('0x1')](_0xe249('0xe'),util[_0xe249('0x1')](_0xe249('0x2'),_0xe249('0x4'),i),0xfa0+i)});}db[_0xe249('0xf')][_0xe249('0x10')](users)[_0xe249('0x11')](function(){console[_0xe249('0x12')](_0xe249('0x13'));})[_0xe249('0x14')](function(_0x27b371){console[_0xe249('0x12')](_0x27b371);}); \ No newline at end of file diff --git a/server/config/socketio.js b/server/config/socketio.js index 0dafbd8..e311673 100644 --- a/server/config/socketio.js +++ b/server/config/socketio.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x762e=['MailQueue','OpenchannelQueue','Trunk','user','ChatQueues','FaxQueue','OpenchannelQueues','WhatsappQueue','getVoiceQueues','getChatQueues','getFaxQueues','getMailQueues','getOpenchannelQueues','getWhatsappQueues','voice','chat','fax','mail','openchannel','telephone:%s','trunk:%s','leave','removeChatInteractions','emit','user_has_chat_interactions:remove','removeMailInteractions','user_has_mail_interactions:remove','FaxInteractions','removeFaxInteractions','removeSmsInteractions','user_has_sms_interactions:remove','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','WhatsappInteractions','removeWhatsappInteractions','join','connection','address','request','remotePort','log','SocketIO\x20','nsp','disconnect','lodash','../mysqldb','Agents','User','name','agent','telephone','type','ivr','UserProfileSection','findOne','then','autoAssociation','VoiceQueues','FaxQueues','SmsQueues','MailQueues','WhatsappQueues','Telephones','Trunks','findAll','IvrCampaigns','resourceId','map','role','Campaign','where','%s:queue:%s','length','format','handshake','query','find','userProfileId','ChatInteraction','ChatInteractions','MailInteraction','MailInteractions','FaxInteraction','SmsInteractions','OpenchannelInteractions','WhatsappInteraction','user:%s','admin','voice:inbound','voice:outbound','include','push','VoiceQueue','ChatQueue','SmsQueue'];(function(_0x113120,_0x3a0c1f){var _0x353fe0=function(_0xade7d8){while(--_0xade7d8){_0x113120['push'](_0x113120['shift']());}};_0x353fe0(++_0x3a0c1f);}(_0x762e,0xea));var _0xe762=function(_0x36e275,_0x48cd3a){_0x36e275=_0x36e275-0x0;var _0x537f96=_0x762e[_0x36e275];return _0x537f96;};'use strict';var _=require(_0xe762('0x0'));var util=require('util');var BPromise=require('bluebird');var db=require(_0xe762('0x1'))['db'];var config=require('./environment');var queryQueues={'attributes':['id','name'],'include':[{'as':_0xe762('0x2'),'model':db[_0xe762('0x3')],'attributes':['id',_0xe762('0x4'),'role'],'raw':!![],'where':{'role':_0xe762('0x5')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0xe762('0x4')],'where':{'role':_0xe762('0x6')}};var queryTrunks={'raw':!![],'attributes':['id','name']};var queryAgents={'raw':!![],'attributes':['id',_0xe762('0x4')],'where':{'role':_0xe762('0x5')}};var queryCampaigns={'raw':!![],'attributes':['id',_0xe762('0x4'),_0xe762('0x7')],'where':{'type':_0xe762('0x8')}};function getAssociatedResources(_0x38aac7,_0x567750,_0x50dd96){return db[_0xe762('0x9')][_0xe762('0xa')]({'where':{'name':_0x38aac7,'userProfileId':_0x567750},'raw':!![]})[_0xe762('0xb')](function(_0x131d67){if(_0x131d67){if(_0x131d67[_0xe762('0xc')]){switch(_0x38aac7){case _0xe762('0xd'):case'ChatQueues':case _0xe762('0xe'):case _0xe762('0xf'):case _0xe762('0x10'):case'OpenchannelQueues':case _0xe762('0x11'):return db[_0x50dd96]['findAll'](queryQueues);case _0xe762('0x12'):return db[_0x50dd96]['findAll'](queryTelephones);case _0xe762('0x13'):return db[_0x50dd96][_0xe762('0x14')](queryTrunks);case _0xe762('0x15'):return db[_0x50dd96]['findAll'](queryCampaigns);}}else{return db['UserProfileResource'][_0xe762('0x14')]({'attributes':[_0xe762('0x16')],'where':{'sectionId':_0x131d67['id']},'raw':!![]})[_0xe762('0xb')](function(_0x13c27d){if(_0x13c27d){var _0x3e6c1d={'where':{'id':_[_0xe762('0x17')](_0x13c27d,_0xe762('0x16'))},'raw':!![]};switch(_0x50dd96){case _0xe762('0x3'):_0x3e6c1d['where'][_0xe762('0x18')]=_0xe762('0x6');break;case _0xe762('0x19'):_0x3e6c1d[_0xe762('0x1a')]['type']=_0xe762('0x8');break;}return db[_0x50dd96][_0xe762('0x14')](_0x3e6c1d);}else{return[];}});}}else{return[];}})['then'](function(_0x5c6350){return _0x5c6350;});}function joinOrLeaveQueues(_0x52e1de,_0x2cea00,_0x5505b1,_0x428a59){_0x52e1de[_0x2cea00](util['format'](_0xe762('0x1b'),_0x5505b1,_0x428a59['name']));if(_0x428a59[_0xe762('0x2')]){for(var _0x190aa3=0x0;_0x190aa3<_0x428a59[_0xe762('0x2')][_0xe762('0x1c')];_0x190aa3+=0x1){_0x52e1de[_0x2cea00](util[_0xe762('0x1d')]('user:%s',_0x428a59['Agents'][_0x190aa3]['name']));}}}function joinOrLeave(_0x4e938f,_0x413584,_0x14641f){var _0x31ac1a;if(_0x4e938f[_0xe762('0x1e')][_0xe762('0x1f')]['id']){db['User'][_0xe762('0x20')]({'attributes':['id',_0xe762('0x4'),_0xe762('0x18'),_0xe762('0x21')],'where':{'id':_0x4e938f[_0xe762('0x1e')][_0xe762('0x1f')]['id']},'include':[{'model':db[_0xe762('0x22')],'as':_0xe762('0x23'),'attributes':['id'],'raw':!![]},{'model':db[_0xe762('0x24')],'as':_0xe762('0x25'),'attributes':['id'],'raw':!![]},{'model':db[_0xe762('0x26')],'as':'FaxInteractions','attributes':['id'],'raw':!![]},{'model':db['SmsInteraction'],'as':_0xe762('0x27'),'attributes':['id'],'raw':!![]},{'model':db['OpenchannelInteraction'],'as':_0xe762('0x28'),'attributes':['id'],'raw':!![]},{'model':db[_0xe762('0x29')],'as':'WhatsappInteractions','attributes':['id'],'raw':!![]}]})[_0xe762('0xb')](function(_0xa39b64){if(_0xa39b64){_0x31ac1a=_0xa39b64;_0x4e938f[_0x413584](util[_0xe762('0x1d')](_0xe762('0x2a'),_0xa39b64[_0xe762('0x4')]));var _0x35c1a9=[];switch(_0xa39b64[_0xe762('0x18')]){case _0xe762('0x2b'):_0x4e938f[_0x413584](_0xe762('0x2c'));_0x4e938f[_0x413584](_0xe762('0x2d'));if(queryQueues['hasOwnProperty'](_0xe762('0x2e'))){delete queryQueues[_0xe762('0x2e')];}_0x35c1a9[_0xe762('0x2f')](db[_0xe762('0x30')][_0xe762('0x14')](queryQueues));_0x35c1a9[_0xe762('0x2f')](db[_0xe762('0x31')][_0xe762('0x14')](queryQueues));_0x35c1a9['push'](db['FaxQueue'][_0xe762('0x14')](queryQueues));_0x35c1a9[_0xe762('0x2f')](db[_0xe762('0x32')][_0xe762('0x14')](queryQueues));_0x35c1a9[_0xe762('0x2f')](db[_0xe762('0x33')][_0xe762('0x14')](queryQueues));_0x35c1a9['push'](db[_0xe762('0x34')][_0xe762('0x14')](queryQueues));_0x35c1a9[_0xe762('0x2f')](db['WhatsappQueue'][_0xe762('0x14')](queryQueues));_0x35c1a9[_0xe762('0x2f')](db[_0xe762('0x3')][_0xe762('0x14')](queryTelephones));_0x35c1a9[_0xe762('0x2f')](db[_0xe762('0x35')][_0xe762('0x14')](queryTrunks));_0x35c1a9[_0xe762('0x2f')](db[_0xe762('0x19')][_0xe762('0x14')](queryCampaigns));_0x35c1a9['push'](db[_0xe762('0x3')][_0xe762('0x14')](queryAgents));break;case _0xe762('0x36'):_0x4e938f[_0x413584](_0xe762('0x2c'));_0x4e938f[_0x413584](_0xe762('0x2d'));_0x35c1a9[_0xe762('0x2f')](getAssociatedResources(_0xe762('0xd'),_0xa39b64[_0xe762('0x21')],_0xe762('0x30')));_0x35c1a9[_0xe762('0x2f')](getAssociatedResources(_0xe762('0x37'),_0xa39b64[_0xe762('0x21')],_0xe762('0x31')));_0x35c1a9[_0xe762('0x2f')](getAssociatedResources(_0xe762('0xe'),_0xa39b64[_0xe762('0x21')],_0xe762('0x38')));_0x35c1a9[_0xe762('0x2f')](getAssociatedResources(_0xe762('0xf'),_0xa39b64[_0xe762('0x21')],_0xe762('0x32')));_0x35c1a9['push'](getAssociatedResources('MailQueues',_0xa39b64[_0xe762('0x21')],_0xe762('0x33')));_0x35c1a9[_0xe762('0x2f')](getAssociatedResources(_0xe762('0x39'),_0xa39b64[_0xe762('0x21')],_0xe762('0x34')));_0x35c1a9[_0xe762('0x2f')](getAssociatedResources(_0xe762('0x11'),_0xa39b64[_0xe762('0x21')],_0xe762('0x3a')));_0x35c1a9['push'](getAssociatedResources('Telephones',_0xa39b64[_0xe762('0x21')],_0xe762('0x3')));_0x35c1a9['push'](getAssociatedResources(_0xe762('0x13'),_0xa39b64[_0xe762('0x21')],_0xe762('0x35')));_0x35c1a9[_0xe762('0x2f')](getAssociatedResources('IvrCampaigns',_0xa39b64['userProfileId'],_0xe762('0x19')));_0x35c1a9[_0xe762('0x2f')](db['User'][_0xe762('0x14')](queryAgents));break;case _0xe762('0x5'):_0x4e938f[_0x413584](_0xe762('0x2c'));_0x4e938f[_0x413584](_0xe762('0x2d'));_0x35c1a9[_0xe762('0x2f')](_0xa39b64[_0xe762('0x3b')]({'attributes':['id',_0xe762('0x4')]}));_0x35c1a9[_0xe762('0x2f')](_0xa39b64[_0xe762('0x3c')]({'attributes':['id',_0xe762('0x4')]}));_0x35c1a9[_0xe762('0x2f')](_0xa39b64[_0xe762('0x3d')]({'attributes':['id',_0xe762('0x4')]}));_0x35c1a9['push'](_0xa39b64['getSmsQueues']({'attributes':['id','name']}));_0x35c1a9[_0xe762('0x2f')](_0xa39b64[_0xe762('0x3e')]({'attributes':['id',_0xe762('0x4')]}));_0x35c1a9[_0xe762('0x2f')](_0xa39b64[_0xe762('0x3f')]({'attributes':['id','name']}));_0x35c1a9['push'](_0xa39b64[_0xe762('0x40')]({'attributes':['id',_0xe762('0x4')]}));break;}return BPromise['all'](_0x35c1a9);}})[_0xe762('0xb')](function(_0x491529){if(_0x491529&&_0x491529['length']){for(var _0x1e4823=0x0;_0x1e4823<_0x491529[_0xe762('0x1c')];_0x1e4823+=0x1){for(var _0x484fb1=0x0;_0x484fb1<_0x491529[_0x1e4823][_0xe762('0x1c')];_0x484fb1+=0x1){switch(_0x1e4823){case 0x0:joinOrLeaveQueues(_0x4e938f,_0x413584,_0xe762('0x41'),_0x491529[_0x1e4823][_0x484fb1]);break;case 0x1:joinOrLeaveQueues(_0x4e938f,_0x413584,_0xe762('0x42'),_0x491529[_0x1e4823][_0x484fb1]);break;case 0x2:joinOrLeaveQueues(_0x4e938f,_0x413584,_0xe762('0x43'),_0x491529[_0x1e4823][_0x484fb1]);break;case 0x3:joinOrLeaveQueues(_0x4e938f,_0x413584,'sms',_0x491529[_0x1e4823][_0x484fb1]);break;case 0x4:joinOrLeaveQueues(_0x4e938f,_0x413584,_0xe762('0x44'),_0x491529[_0x1e4823][_0x484fb1]);break;case 0x5:joinOrLeaveQueues(_0x4e938f,_0x413584,_0xe762('0x45'),_0x491529[_0x1e4823][_0x484fb1]);break;case 0x6:joinOrLeaveQueues(_0x4e938f,_0x413584,'whatsapp',_0x491529[_0x1e4823][_0x484fb1]);break;case 0x7:if(_0x31ac1a[_0xe762('0x18')]!==_0xe762('0x5'))_0x4e938f[_0x413584](util[_0xe762('0x1d')](_0xe762('0x46'),_0x491529[_0x1e4823][_0x484fb1][_0xe762('0x4')]));break;case 0x8:if(_0x31ac1a[_0xe762('0x18')]!=='agent')_0x4e938f[_0x413584](util[_0xe762('0x1d')](_0xe762('0x47'),_0x491529[_0x1e4823][_0x484fb1][_0xe762('0x4')]));break;case 0x9:if(_0x31ac1a[_0xe762('0x18')]!=='agent')_0x4e938f[_0x413584](util[_0xe762('0x1d')]('campaign:%s:%s',_0x491529[_0x1e4823][_0x484fb1][_0xe762('0x7')],_0x491529[_0x1e4823][_0x484fb1][_0xe762('0x4')]));break;case 0xa:_0x4e938f[_0x413584](util[_0xe762('0x1d')](_0xe762('0x2a'),_0x491529[_0x1e4823][_0x484fb1][_0xe762('0x4')]));break;}}}}})[_0xe762('0xb')](function(){if(_0x413584===_0xe762('0x48')){var _0x11eee8=_[_0xe762('0x17')](_0x31ac1a[_0xe762('0x23')],'id');return _0x31ac1a[_0xe762('0x49')](_0x11eee8)['then'](function(){for(var _0x2c8fcc=0x0;_0x2c8fcc<_0x11eee8[_0xe762('0x1c')];_0x2c8fcc+=0x1){_0x14641f[_0xe762('0x4a')](_0xe762('0x4b'),{'ChatInteractionId':Number(_0x11eee8[_0x2c8fcc]),'UserId':Number(_0x31ac1a['id'])});}});}})['then'](function(){if(_0x413584===_0xe762('0x48')){var _0x12a82b=_[_0xe762('0x17')](_0x31ac1a[_0xe762('0x25')],'id');return _0x31ac1a[_0xe762('0x4c')](_0x12a82b)[_0xe762('0xb')](function(){for(var _0x3346dd=0x0;_0x3346dd<_0x12a82b[_0xe762('0x1c')];_0x3346dd+=0x1){_0x14641f[_0xe762('0x4a')](_0xe762('0x4d'),{'MailInteractionId':Number(_0x12a82b[_0x3346dd]),'UserId':Number(_0x31ac1a['id'])});}});}})['then'](function(){if(_0x413584===_0xe762('0x48')){var _0x5746a5=_[_0xe762('0x17')](_0x31ac1a[_0xe762('0x4e')],'id');return _0x31ac1a[_0xe762('0x4f')](_0x5746a5)[_0xe762('0xb')](function(){for(var _0x3de12d=0x0;_0x3de12d<_0x5746a5[_0xe762('0x1c')];_0x3de12d+=0x1){_0x14641f['emit']('user_has_fax_interactions:remove',{'FaxInteractionId':Number(_0x5746a5[_0x3de12d]),'UserId':Number(_0x31ac1a['id'])});}});}})[_0xe762('0xb')](function(){if(_0x413584===_0xe762('0x48')){var _0x5da9d6=_[_0xe762('0x17')](_0x31ac1a['SmsInteractions'],'id');return _0x31ac1a[_0xe762('0x50')](_0x5da9d6)[_0xe762('0xb')](function(){for(var _0x13513e=0x0;_0x13513e<_0x5da9d6[_0xe762('0x1c')];_0x13513e+=0x1){_0x14641f[_0xe762('0x4a')](_0xe762('0x51'),{'SmsInteractionId':Number(_0x5da9d6[_0x13513e]),'UserId':Number(_0x31ac1a['id'])});}});}})[_0xe762('0xb')](function(){if(_0x413584==='leave'){var _0x5b4bf7=_[_0xe762('0x17')](_0x31ac1a['OpenchannelInteractions'],'id');return _0x31ac1a[_0xe762('0x52')](_0x5b4bf7)[_0xe762('0xb')](function(){for(var _0x5d3a74=0x0;_0x5d3a74<_0x5b4bf7[_0xe762('0x1c')];_0x5d3a74+=0x1){_0x14641f[_0xe762('0x4a')](_0xe762('0x53'),{'OpenchannelInteractionId':Number(_0x5b4bf7[_0x5d3a74]),'UserId':Number(_0x31ac1a['id'])});}});}})[_0xe762('0xb')](function(){if(_0x413584===_0xe762('0x48')){var _0xec3ac3=_['map'](_0x31ac1a[_0xe762('0x54')],'id');return _0x31ac1a[_0xe762('0x55')](_0xec3ac3)['then'](function(){for(var _0x30b946=0x0;_0x30b946<_0xec3ac3[_0xe762('0x1c')];_0x30b946+=0x1){_0x14641f[_0xe762('0x4a')]('user_has_whatsapp_interactions:remove',{'WhatsappInteractionId':Number(_0xec3ac3[_0x30b946]),'UserId':Number(_0x31ac1a['id'])});}});}})['catch'](function(_0x25a891){_0x4e938f['log'](_0x25a891);});}}function onDisconnect(_0x324cf5,_0x294ce4){joinOrLeave(_0x324cf5,_0xe762('0x48'),_0x294ce4);}function onConnect(_0x4d5e6c){joinOrLeave(_0x4d5e6c,_0xe762('0x56'));}exports['default']=function(_0x580c25){_0x580c25['on'](_0xe762('0x57'),function(_0xe03cdb){_0xe03cdb['setMaxListeners'](0x0);_0xe03cdb[_0xe762('0x58')]=_0xe03cdb[_0xe762('0x59')]['connection']['remoteAddress']+':'+_0xe03cdb['request']['connection'][_0xe762('0x5a')];_0xe03cdb['connectedAt']=new Date();_0xe03cdb[_0xe762('0x5b')]=function(_0x468825){console[_0xe762('0x5b')](_0xe762('0x5c')+_0xe03cdb[_0xe762('0x5d')][_0xe762('0x4')]+'['+_0xe03cdb[_0xe762('0x58')]+']',_0x468825);};_0xe03cdb['on'](_0xe762('0x5e'),function(){onDisconnect(_0xe03cdb,_0x580c25);_0xe03cdb[_0xe762('0x5b')]('DISCONNECTED');});onConnect(_0xe03cdb);_0xe03cdb[_0xe762('0x5b')]('CONNECTED');});}; \ No newline at end of file +var _0x534b=['./environment','name','User','role','agent','telephone','type','ivr','findOne','autoAssociation','VoiceQueues','ChatQueues','SmsQueues','MailQueues','WhatsappQueues','findAll','Telephones','Trunks','UserProfileResource','resourceId','then','map','where','Campaign','format','Agents','length','user:%s','handshake','query','find','userProfileId','ChatInteraction','ChatInteractions','MailInteraction','FaxInteraction','FaxInteractions','SmsInteraction','SmsInteractions','OpenchannelInteraction','OpenchannelInteractions','WhatsappInteraction','admin','voice:inbound','voice:outbound','include','VoiceQueue','push','MailQueue','OpenchannelQueue','Trunk','user','FaxQueues','SmsQueue','OpenchannelQueues','getVoiceQueues','getChatQueues','getSmsQueues','getOpenchannelQueues','getWhatsappQueues','all','voice','chat','fax','sms','openchannel','whatsapp','telephone:%s','trunk:%s','campaign:%s:%s','leave','emit','user_has_chat_interactions:remove','MailInteractions','removeMailInteractions','user_has_mail_interactions:remove','user_has_openchannel_interactions:remove','WhatsappInteractions','removeWhatsappInteractions','user_has_whatsapp_interactions:remove','catch','log','default','connection','setMaxListeners','address','request','remoteAddress','connectedAt','SocketIO\x20','nsp','DISCONNECTED','CONNECTED','lodash','util','../mysqldb'];(function(_0x354edb,_0x100e36){var _0xc0c258=function(_0x376136){while(--_0x376136){_0x354edb['push'](_0x354edb['shift']());}};_0xc0c258(++_0x100e36);}(_0x534b,0xbd));var _0xb534=function(_0x3f6d1e,_0x11f23f){_0x3f6d1e=_0x3f6d1e-0x0;var _0x44cbca=_0x534b[_0x3f6d1e];return _0x44cbca;};'use strict';var _=require(_0xb534('0x0'));var util=require(_0xb534('0x1'));var BPromise=require('bluebird');var db=require(_0xb534('0x2'))['db'];var config=require(_0xb534('0x3'));var queryQueues={'attributes':['id',_0xb534('0x4')],'include':[{'as':'Agents','model':db[_0xb534('0x5')],'attributes':['id','name',_0xb534('0x6')],'raw':!![],'where':{'role':_0xb534('0x7')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0xb534('0x4')],'where':{'role':_0xb534('0x8')}};var queryTrunks={'raw':!![],'attributes':['id',_0xb534('0x4')]};var queryAgents={'raw':!![],'attributes':['id','name'],'where':{'role':_0xb534('0x7')}};var queryCampaigns={'raw':!![],'attributes':['id',_0xb534('0x4'),_0xb534('0x9')],'where':{'type':_0xb534('0xa')}};function getAssociatedResources(_0x30df34,_0x331332,_0x43a29e){return db['UserProfileSection'][_0xb534('0xb')]({'where':{'name':_0x30df34,'userProfileId':_0x331332},'raw':!![]})['then'](function(_0x772bdf){if(_0x772bdf){if(_0x772bdf[_0xb534('0xc')]){switch(_0x30df34){case _0xb534('0xd'):case _0xb534('0xe'):case'FaxQueues':case _0xb534('0xf'):case _0xb534('0x10'):case'OpenchannelQueues':case _0xb534('0x11'):return db[_0x43a29e][_0xb534('0x12')](queryQueues);case _0xb534('0x13'):return db[_0x43a29e]['findAll'](queryTelephones);case _0xb534('0x14'):return db[_0x43a29e][_0xb534('0x12')](queryTrunks);case'IvrCampaigns':return db[_0x43a29e]['findAll'](queryCampaigns);}}else{return db[_0xb534('0x15')][_0xb534('0x12')]({'attributes':[_0xb534('0x16')],'where':{'sectionId':_0x772bdf['id']},'raw':!![]})[_0xb534('0x17')](function(_0xfbb070){if(_0xfbb070){var _0x3d9a0d={'where':{'id':_[_0xb534('0x18')](_0xfbb070,_0xb534('0x16'))},'raw':!![]};switch(_0x43a29e){case _0xb534('0x5'):_0x3d9a0d[_0xb534('0x19')]['role']=_0xb534('0x8');break;case _0xb534('0x1a'):_0x3d9a0d[_0xb534('0x19')][_0xb534('0x9')]=_0xb534('0xa');break;}return db[_0x43a29e][_0xb534('0x12')](_0x3d9a0d);}else{return[];}});}}else{return[];}})[_0xb534('0x17')](function(_0x229144){return _0x229144;});}function joinOrLeaveQueues(_0x3e1f5b,_0x5815c4,_0x58fab7,_0x3afad4){_0x3e1f5b[_0x5815c4](util[_0xb534('0x1b')]('%s:queue:%s',_0x58fab7,_0x3afad4[_0xb534('0x4')]));if(_0x3afad4['Agents']){for(var _0x16d7ca=0x0;_0x16d7ca<_0x3afad4[_0xb534('0x1c')][_0xb534('0x1d')];_0x16d7ca+=0x1){_0x3e1f5b[_0x5815c4](util[_0xb534('0x1b')](_0xb534('0x1e'),_0x3afad4[_0xb534('0x1c')][_0x16d7ca][_0xb534('0x4')]));}}}function joinOrLeave(_0x49a903,_0x30fa7e,_0x574b1c){var _0x1a72da;if(_0x49a903[_0xb534('0x1f')][_0xb534('0x20')]['id']){db[_0xb534('0x5')][_0xb534('0x21')]({'attributes':['id',_0xb534('0x4'),_0xb534('0x6'),_0xb534('0x22')],'where':{'id':_0x49a903[_0xb534('0x1f')]['query']['id']},'include':[{'model':db[_0xb534('0x23')],'as':_0xb534('0x24'),'attributes':['id'],'raw':!![]},{'model':db[_0xb534('0x25')],'as':'MailInteractions','attributes':['id'],'raw':!![]},{'model':db[_0xb534('0x26')],'as':_0xb534('0x27'),'attributes':['id'],'raw':!![]},{'model':db[_0xb534('0x28')],'as':_0xb534('0x29'),'attributes':['id'],'raw':!![]},{'model':db[_0xb534('0x2a')],'as':_0xb534('0x2b'),'attributes':['id'],'raw':!![]},{'model':db[_0xb534('0x2c')],'as':'WhatsappInteractions','attributes':['id'],'raw':!![]}]})[_0xb534('0x17')](function(_0x285ee6){if(_0x285ee6){_0x1a72da=_0x285ee6;_0x49a903[_0x30fa7e](util[_0xb534('0x1b')](_0xb534('0x1e'),_0x285ee6[_0xb534('0x4')]));var _0x2dcf82=[];switch(_0x285ee6[_0xb534('0x6')]){case _0xb534('0x2d'):_0x49a903[_0x30fa7e](_0xb534('0x2e'));_0x49a903[_0x30fa7e](_0xb534('0x2f'));if(queryQueues['hasOwnProperty'](_0xb534('0x30'))){delete queryQueues[_0xb534('0x30')];}_0x2dcf82['push'](db[_0xb534('0x31')][_0xb534('0x12')](queryQueues));_0x2dcf82['push'](db['ChatQueue'][_0xb534('0x12')](queryQueues));_0x2dcf82['push'](db['FaxQueue'][_0xb534('0x12')](queryQueues));_0x2dcf82[_0xb534('0x32')](db['SmsQueue'][_0xb534('0x12')](queryQueues));_0x2dcf82[_0xb534('0x32')](db[_0xb534('0x33')][_0xb534('0x12')](queryQueues));_0x2dcf82[_0xb534('0x32')](db[_0xb534('0x34')][_0xb534('0x12')](queryQueues));_0x2dcf82[_0xb534('0x32')](db['WhatsappQueue'][_0xb534('0x12')](queryQueues));_0x2dcf82[_0xb534('0x32')](db['User'][_0xb534('0x12')](queryTelephones));_0x2dcf82[_0xb534('0x32')](db[_0xb534('0x35')][_0xb534('0x12')](queryTrunks));_0x2dcf82[_0xb534('0x32')](db['Campaign'][_0xb534('0x12')](queryCampaigns));_0x2dcf82[_0xb534('0x32')](db[_0xb534('0x5')][_0xb534('0x12')](queryAgents));break;case _0xb534('0x36'):_0x49a903[_0x30fa7e](_0xb534('0x2e'));_0x49a903[_0x30fa7e](_0xb534('0x2f'));_0x2dcf82[_0xb534('0x32')](getAssociatedResources(_0xb534('0xd'),_0x285ee6[_0xb534('0x22')],'VoiceQueue'));_0x2dcf82[_0xb534('0x32')](getAssociatedResources(_0xb534('0xe'),_0x285ee6[_0xb534('0x22')],'ChatQueue'));_0x2dcf82[_0xb534('0x32')](getAssociatedResources(_0xb534('0x37'),_0x285ee6[_0xb534('0x22')],'FaxQueue'));_0x2dcf82[_0xb534('0x32')](getAssociatedResources(_0xb534('0xf'),_0x285ee6[_0xb534('0x22')],_0xb534('0x38')));_0x2dcf82[_0xb534('0x32')](getAssociatedResources(_0xb534('0x10'),_0x285ee6[_0xb534('0x22')],_0xb534('0x33')));_0x2dcf82[_0xb534('0x32')](getAssociatedResources(_0xb534('0x39'),_0x285ee6[_0xb534('0x22')],'OpenchannelQueue'));_0x2dcf82[_0xb534('0x32')](getAssociatedResources(_0xb534('0x11'),_0x285ee6[_0xb534('0x22')],'WhatsappQueue'));_0x2dcf82['push'](getAssociatedResources(_0xb534('0x13'),_0x285ee6[_0xb534('0x22')],'User'));_0x2dcf82[_0xb534('0x32')](getAssociatedResources('Trunks',_0x285ee6[_0xb534('0x22')],_0xb534('0x35')));_0x2dcf82['push'](getAssociatedResources('IvrCampaigns',_0x285ee6['userProfileId'],_0xb534('0x1a')));_0x2dcf82[_0xb534('0x32')](db[_0xb534('0x5')][_0xb534('0x12')](queryAgents));break;case _0xb534('0x7'):_0x49a903[_0x30fa7e](_0xb534('0x2e'));_0x49a903[_0x30fa7e](_0xb534('0x2f'));_0x2dcf82[_0xb534('0x32')](_0x285ee6[_0xb534('0x3a')]({'attributes':['id',_0xb534('0x4')]}));_0x2dcf82[_0xb534('0x32')](_0x285ee6[_0xb534('0x3b')]({'attributes':['id',_0xb534('0x4')]}));_0x2dcf82[_0xb534('0x32')](_0x285ee6['getFaxQueues']({'attributes':['id','name']}));_0x2dcf82[_0xb534('0x32')](_0x285ee6[_0xb534('0x3c')]({'attributes':['id',_0xb534('0x4')]}));_0x2dcf82[_0xb534('0x32')](_0x285ee6['getMailQueues']({'attributes':['id',_0xb534('0x4')]}));_0x2dcf82['push'](_0x285ee6[_0xb534('0x3d')]({'attributes':['id',_0xb534('0x4')]}));_0x2dcf82[_0xb534('0x32')](_0x285ee6[_0xb534('0x3e')]({'attributes':['id',_0xb534('0x4')]}));break;}return BPromise[_0xb534('0x3f')](_0x2dcf82);}})[_0xb534('0x17')](function(_0x45ab63){if(_0x45ab63&&_0x45ab63[_0xb534('0x1d')]){for(var _0x3f5a03=0x0;_0x3f5a03<_0x45ab63[_0xb534('0x1d')];_0x3f5a03+=0x1){for(var _0x6be6a9=0x0;_0x6be6a9<_0x45ab63[_0x3f5a03][_0xb534('0x1d')];_0x6be6a9+=0x1){switch(_0x3f5a03){case 0x0:joinOrLeaveQueues(_0x49a903,_0x30fa7e,_0xb534('0x40'),_0x45ab63[_0x3f5a03][_0x6be6a9]);break;case 0x1:joinOrLeaveQueues(_0x49a903,_0x30fa7e,_0xb534('0x41'),_0x45ab63[_0x3f5a03][_0x6be6a9]);break;case 0x2:joinOrLeaveQueues(_0x49a903,_0x30fa7e,_0xb534('0x42'),_0x45ab63[_0x3f5a03][_0x6be6a9]);break;case 0x3:joinOrLeaveQueues(_0x49a903,_0x30fa7e,_0xb534('0x43'),_0x45ab63[_0x3f5a03][_0x6be6a9]);break;case 0x4:joinOrLeaveQueues(_0x49a903,_0x30fa7e,'mail',_0x45ab63[_0x3f5a03][_0x6be6a9]);break;case 0x5:joinOrLeaveQueues(_0x49a903,_0x30fa7e,_0xb534('0x44'),_0x45ab63[_0x3f5a03][_0x6be6a9]);break;case 0x6:joinOrLeaveQueues(_0x49a903,_0x30fa7e,_0xb534('0x45'),_0x45ab63[_0x3f5a03][_0x6be6a9]);break;case 0x7:if(_0x1a72da['role']!=='agent')_0x49a903[_0x30fa7e](util['format'](_0xb534('0x46'),_0x45ab63[_0x3f5a03][_0x6be6a9][_0xb534('0x4')]));break;case 0x8:if(_0x1a72da['role']!==_0xb534('0x7'))_0x49a903[_0x30fa7e](util[_0xb534('0x1b')](_0xb534('0x47'),_0x45ab63[_0x3f5a03][_0x6be6a9]['name']));break;case 0x9:if(_0x1a72da[_0xb534('0x6')]!==_0xb534('0x7'))_0x49a903[_0x30fa7e](util[_0xb534('0x1b')](_0xb534('0x48'),_0x45ab63[_0x3f5a03][_0x6be6a9][_0xb534('0x9')],_0x45ab63[_0x3f5a03][_0x6be6a9][_0xb534('0x4')]));break;case 0xa:_0x49a903[_0x30fa7e](util[_0xb534('0x1b')](_0xb534('0x1e'),_0x45ab63[_0x3f5a03][_0x6be6a9][_0xb534('0x4')]));break;}}}}})[_0xb534('0x17')](function(){if(_0x30fa7e===_0xb534('0x49')){var _0x25b542=_[_0xb534('0x18')](_0x1a72da[_0xb534('0x24')],'id');return _0x1a72da['removeChatInteractions'](_0x25b542)['then'](function(){for(var _0x226148=0x0;_0x226148<_0x25b542[_0xb534('0x1d')];_0x226148+=0x1){_0x574b1c[_0xb534('0x4a')](_0xb534('0x4b'),{'ChatInteractionId':Number(_0x25b542[_0x226148]),'UserId':Number(_0x1a72da['id'])});}});}})[_0xb534('0x17')](function(){if(_0x30fa7e===_0xb534('0x49')){var _0x10b729=_['map'](_0x1a72da[_0xb534('0x4c')],'id');return _0x1a72da[_0xb534('0x4d')](_0x10b729)[_0xb534('0x17')](function(){for(var _0x26224e=0x0;_0x26224e<_0x10b729['length'];_0x26224e+=0x1){_0x574b1c[_0xb534('0x4a')](_0xb534('0x4e'),{'MailInteractionId':Number(_0x10b729[_0x26224e]),'UserId':Number(_0x1a72da['id'])});}});}})[_0xb534('0x17')](function(){if(_0x30fa7e==='leave'){var _0x548b63=_[_0xb534('0x18')](_0x1a72da['FaxInteractions'],'id');return _0x1a72da['removeFaxInteractions'](_0x548b63)[_0xb534('0x17')](function(){for(var _0x38cb93=0x0;_0x38cb93<_0x548b63[_0xb534('0x1d')];_0x38cb93+=0x1){_0x574b1c[_0xb534('0x4a')]('user_has_fax_interactions:remove',{'FaxInteractionId':Number(_0x548b63[_0x38cb93]),'UserId':Number(_0x1a72da['id'])});}});}})[_0xb534('0x17')](function(){if(_0x30fa7e==='leave'){var _0x2e500b=_['map'](_0x1a72da[_0xb534('0x29')],'id');return _0x1a72da['removeSmsInteractions'](_0x2e500b)[_0xb534('0x17')](function(){for(var _0x695202=0x0;_0x695202<_0x2e500b[_0xb534('0x1d')];_0x695202+=0x1){_0x574b1c[_0xb534('0x4a')]('user_has_sms_interactions:remove',{'SmsInteractionId':Number(_0x2e500b[_0x695202]),'UserId':Number(_0x1a72da['id'])});}});}})[_0xb534('0x17')](function(){if(_0x30fa7e==='leave'){var _0x142e5e=_['map'](_0x1a72da[_0xb534('0x2b')],'id');return _0x1a72da['removeOpenchannelInteractions'](_0x142e5e)[_0xb534('0x17')](function(){for(var _0x5472b0=0x0;_0x5472b0<_0x142e5e['length'];_0x5472b0+=0x1){_0x574b1c['emit'](_0xb534('0x4f'),{'OpenchannelInteractionId':Number(_0x142e5e[_0x5472b0]),'UserId':Number(_0x1a72da['id'])});}});}})[_0xb534('0x17')](function(){if(_0x30fa7e===_0xb534('0x49')){var _0x5a9b53=_[_0xb534('0x18')](_0x1a72da[_0xb534('0x50')],'id');return _0x1a72da[_0xb534('0x51')](_0x5a9b53)['then'](function(){for(var _0x528f3e=0x0;_0x528f3e<_0x5a9b53[_0xb534('0x1d')];_0x528f3e+=0x1){_0x574b1c[_0xb534('0x4a')](_0xb534('0x52'),{'WhatsappInteractionId':Number(_0x5a9b53[_0x528f3e]),'UserId':Number(_0x1a72da['id'])});}});}})[_0xb534('0x53')](function(_0x1ba810){_0x49a903[_0xb534('0x54')](_0x1ba810);});}}function onDisconnect(_0x50df5b,_0x4d3bcd){joinOrLeave(_0x50df5b,'leave',_0x4d3bcd);}function onConnect(_0x33710b){joinOrLeave(_0x33710b,'join');}exports[_0xb534('0x55')]=function(_0x7bd149){_0x7bd149['on'](_0xb534('0x56'),function(_0x642079){_0x642079[_0xb534('0x57')](0x0);_0x642079[_0xb534('0x58')]=_0x642079[_0xb534('0x59')][_0xb534('0x56')][_0xb534('0x5a')]+':'+_0x642079['request']['connection']['remotePort'];_0x642079[_0xb534('0x5b')]=new Date();_0x642079[_0xb534('0x54')]=function(_0xd72c42){console[_0xb534('0x54')](_0xb534('0x5c')+_0x642079[_0xb534('0x5d')]['name']+'['+_0x642079[_0xb534('0x58')]+']',_0xd72c42);};_0x642079['on']('disconnect',function(){onDisconnect(_0x642079,_0x7bd149);_0x642079[_0xb534('0x54')](_0xb534('0x5e'));});onConnect(_0x642079);_0x642079[_0xb534('0x54')](_0xb534('0x5f'));});}; \ No newline at end of file diff --git a/server/config/triggers/index.js b/server/config/triggers/index.js index 260923b..ffc068f 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 _0x26d2=['SELECT','UserId','interface','SIP/%s','name','incomingmessage','outgoingmessage','offlineMessage','opened','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','format','agent','AfterCreate','changed','closed','substatus','contact','AfterUpdate','User','find','email','internal','model','callback','condition','../../mysqldb','../logger','triggers','client','Chat','ChatInteraction','closedinteraction','afterCreate','newmessage','Sms','SmsInteraction','newinteraction','afterUpdate','SmsMessage','Whatsapp','WhatsappInteraction','WhatsappMessage','Fax','FaxInteraction','FaxMessage','Mail','MailInteraction','MailMessage','Openchannel','OpenchannelMessage','request','info','Trigger,\x20%s','EventManager','error','code','catch','get','channel','motionChannel','event','direction','then','ContactId','undefined','query','Sequelize','QueryTypes'];(function(_0x38c9ed,_0x5d9c95){var _0x5bc309=function(_0xb2ec31){while(--_0xb2ec31){_0x38c9ed['push'](_0x38c9ed['shift']());}};_0x5bc309(++_0x5d9c95);}(_0x26d2,0x12e));var _0x226d=function(_0x1d80be,_0x3a60ff){_0x1d80be=_0x1d80be-0x0;var _0xf9a4f3=_0x26d2[_0x1d80be];return _0xf9a4f3;};'use strict';var util=require('util');var db=require(_0x226d('0x0'))['db'];var jayson=require('jayson/promise');var logger=require(_0x226d('0x1'))(_0x226d('0x2'));var client=jayson[_0x226d('0x3')]['http']({'port':0x232a});var triggers=[{'channel':_0x226d('0x4'),'model':_0x226d('0x5'),'event':'afterCreate','condition':'newinteraction','callback':afterCreate},{'channel':'Chat','model':'ChatInteraction','event':'afterUpdate','condition':_0x226d('0x6'),'callback':afterUpdate},{'channel':_0x226d('0x4'),'model':'ChatMessage','event':_0x226d('0x7'),'condition':_0x226d('0x8'),'callback':afterCreateMessage},{'channel':'Chat','model':'ChatOfflineMessage','event':'afterCreate','condition':_0x226d('0x8'),'callback':afterCreateOfflineMessage},{'channel':_0x226d('0x9'),'model':_0x226d('0xa'),'event':_0x226d('0x7'),'condition':_0x226d('0xb'),'callback':afterCreate},{'channel':_0x226d('0x9'),'model':_0x226d('0xa'),'event':_0x226d('0xc'),'condition':'closedinteraction','callback':afterUpdate},{'channel':_0x226d('0x9'),'model':_0x226d('0xd'),'event':_0x226d('0x7'),'condition':_0x226d('0x8'),'callback':afterCreateMessage},{'channel':_0x226d('0xe'),'model':_0x226d('0xf'),'event':_0x226d('0x7'),'condition':_0x226d('0xb'),'callback':afterCreate},{'channel':_0x226d('0xe'),'model':'WhatsappInteraction','event':_0x226d('0xc'),'condition':_0x226d('0x6'),'callback':afterUpdate},{'channel':_0x226d('0xe'),'model':_0x226d('0x10'),'event':'afterCreate','condition':_0x226d('0x8'),'callback':afterCreateMessage},{'channel':_0x226d('0x11'),'model':_0x226d('0x12'),'event':_0x226d('0x7'),'condition':_0x226d('0xb'),'callback':afterCreate},{'channel':'Fax','model':'FaxInteraction','event':_0x226d('0xc'),'condition':_0x226d('0x6'),'callback':afterUpdate},{'channel':'Fax','model':_0x226d('0x13'),'event':_0x226d('0x7'),'condition':_0x226d('0x8'),'callback':afterCreateMessage},{'channel':_0x226d('0x14'),'model':_0x226d('0x15'),'event':_0x226d('0x7'),'condition':_0x226d('0xb'),'callback':afterCreate},{'channel':'Mail','model':_0x226d('0x15'),'event':_0x226d('0xc'),'condition':_0x226d('0x6'),'callback':afterUpdate},{'channel':_0x226d('0x14'),'model':_0x226d('0x16'),'event':_0x226d('0x7'),'condition':'newmessage','callback':afterCreateMessage},{'channel':_0x226d('0x17'),'model':'OpenchannelInteraction','event':'afterCreate','condition':'newinteraction','callback':afterCreate},{'channel':'Openchannel','model':'OpenchannelInteraction','event':_0x226d('0xc'),'condition':'closedinteraction','callback':afterUpdate},{'channel':_0x226d('0x17'),'model':_0x226d('0x18'),'event':_0x226d('0x7'),'condition':'newmessage','callback':afterCreateMessage}];function request(_0x584abe){return client[_0x226d('0x19')]('EventManager',_0x584abe)['then'](function(_0x1c1194){logger[_0x226d('0x1a')](_0x226d('0x1b'),_0x226d('0x1c'),_0x1c1194);if(_0x1c1194['error']){if(_0x1c1194[_0x226d('0x1d')][_0x226d('0x1e')]===0x1f4){logger['error'](_0x226d('0x1b'),_0x226d('0x1c'),_0x1c1194[_0x226d('0x1d')]);}}})[_0x226d('0x1f')](function(_0x431cdb){logger['error']('Trigger,\x20%s',_0x226d('0x1c'),_0x431cdb);});}function afterCreateMessage(_0x3ea138){return function(_0x657d5f){_0x657d5f=_0x657d5f[_0x226d('0x20')]({'plain':!![]});_0x657d5f[_0x226d('0x21')]=_0x3ea138;_0x657d5f[_0x226d('0x22')]=_0x3ea138;_0x657d5f[_0x226d('0x23')]=_0x657d5f[_0x226d('0x24')];Promise['resolve']()[_0x226d('0x25')](function(){if(typeof _0x657d5f[_0x226d('0x26')]===_0x226d('0x27'))return null;var _0x365e44='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x657d5f[_0x226d('0x26')];return db['sequelize'][_0x226d('0x28')](_0x365e44,{'type':db[_0x226d('0x29')][_0x226d('0x2a')][_0x226d('0x2b')],'raw':!![]});})[_0x226d('0x25')](function(_0x171e0e){if(_0x171e0e){_0x657d5f['contact']=_0x171e0e[0x0];}if(typeof _0x657d5f['UserId']===_0x226d('0x27'))return;return getAgent(_0x657d5f[_0x226d('0x2c')]);})['then'](function(_0x5117ae){if(_0x5117ae){_0x657d5f[_0x226d('0x2d')]=util['format'](_0x226d('0x2e'),_0x5117ae[_0x226d('0x2f')]);_0x657d5f['agent']=_0x5117ae;_0x657d5f['channel']=_0x3ea138;return request({'event':_0x226d('0x30'),'message':_0x657d5f});}else{return request({'event':_0x226d('0x31'),'message':_0x657d5f});}})['catch'](function(_0x4c7213){logger[_0x226d('0x1d')](_0x226d('0x1b'),'AfterCreateMessage',_0x4c7213);});};}function afterCreateOfflineMessage(_0x57213e){return function(_0x12322e){_0x12322e=_0x12322e[_0x226d('0x20')]({'plain':!![]});_0x12322e[_0x226d('0x21')]=_0x57213e;_0x12322e[_0x226d('0x22')]=_0x57213e;_0x12322e[_0x226d('0x23')]=_0x226d('0x32');return request({'event':_0x12322e[_0x226d('0x23')],'message':_0x12322e});};}function afterCreate(_0x31c951,_0x42655d){return function(_0x117d98){_0x117d98=_0x117d98[_0x226d('0x20')]({'plain':!![]});_0x117d98[_0x226d('0x21')]=_0x31c951;_0x117d98[_0x226d('0x22')]=_0x31c951;_0x117d98['event']=_0x226d('0x33');Promise['resolve']()['then'](function(){var _0x43b617=_0x226d('0x34')+_0x117d98[_0x226d('0x26')];return db[_0x226d('0x35')][_0x226d('0x28')](_0x43b617,{'type':db[_0x226d('0x29')][_0x226d('0x2a')][_0x226d('0x2b')],'raw':!![]});})[_0x226d('0x25')](function(_0x4b6354){if(_0x4b6354){_0x117d98['contact']=_0x4b6354[0x0];}if(typeof _0x117d98[_0x226d('0x2c')]===_0x226d('0x27'))return;return getAgent(_0x117d98[_0x226d('0x2c')]);})[_0x226d('0x25')](function(_0x4ab626){if(_0x4ab626){_0x117d98[_0x226d('0x2d')]=util[_0x226d('0x36')](_0x226d('0x2e'),_0x4ab626[_0x226d('0x2f')]);_0x117d98[_0x226d('0x37')]=_0x4ab626;}return request({'event':_0x42655d,'message':_0x117d98});})[_0x226d('0x1f')](function(_0x24db29){logger[_0x226d('0x1d')](_0x226d('0x1b'),_0x226d('0x38'),_0x24db29);});};}function afterUpdate(_0x40e3fb){return function(_0x64fc0){var _0x42c651=_0x64fc0[_0x226d('0x39')](_0x226d('0x3a'))&&_0x64fc0['closed'];var _0x10a68e=_0x64fc0[_0x226d('0x39')](_0x226d('0x3b'));if(_0x42c651||_0x10a68e){var _0x132579=_0x42c651?_0x226d('0x6'):_0x226d('0x3b');var _0x253813=_0x64fc0['get']({'plain':!![]});_0x253813['channel']=_0x40e3fb;_0x253813[_0x226d('0x22')]=_0x40e3fb;_0x253813['event']=_0x42c651?_0x226d('0x3a'):_0x226d('0x3b');var _0xb3b020=_0x226d('0x34')+_0x253813[_0x226d('0x26')];return db[_0x226d('0x35')][_0x226d('0x28')](_0xb3b020,{'type':db[_0x226d('0x29')][_0x226d('0x2a')][_0x226d('0x2b')],'raw':!![]})[_0x226d('0x25')](function(_0x33e395){if(_0x33e395){_0x253813[_0x226d('0x3c')]=_0x33e395[0x0];}if(typeof _0x253813[_0x226d('0x2c')]===_0x226d('0x27'))return;return getAgent(_0x253813[_0x226d('0x2c')]);})[_0x226d('0x25')](function(_0x2abe01){if(_0x2abe01){_0x253813['interface']=util[_0x226d('0x36')](_0x226d('0x2e'),_0x2abe01[_0x226d('0x2f')]);_0x253813[_0x226d('0x37')]=_0x2abe01;}return request({'event':_0x132579,'message':_0x253813});})[_0x226d('0x1f')](function(_0x242266){logger[_0x226d('0x1d')](_0x226d('0x1b'),_0x226d('0x3d'),_0x242266);});}};}function getAgent(_0x2773c7){return db[_0x226d('0x3e')][_0x226d('0x3f')]({'where':{'id':_0x2773c7},'attributes':['id',_0x226d('0x2f'),'fullname',_0x226d('0x40'),_0x226d('0x41')],'raw':!![]})[_0x226d('0x25')](function(_0x9bbfbc){return _0x9bbfbc;});}exports['default']=function(){for(var _0x2d2c8a=0x0;_0x2d2c8a=_0x118eb3[_0xa963('0x13')]){throw Error(_0xa963('0x14'));}_0x47d0f2(_0x2c6b57);})['catch'](function(_0x2bddc5){_0x22a5f0(_0x2bddc5);});});}; \ No newline at end of file +var _0xa27b=['Maximum\x20login\x20has\x20been\x20reached','lodash','bluebird','./license/util','voice','mail','fax','sms','whatsapp','getChannels','toLowerCase','includes','clearBlockUser','isUndefined','blockedAt','updateAttributes','role','agent','User','getLicense','then','agents'];(function(_0x546f10,_0x374b9c){var _0x1b6082=function(_0x140705){while(--_0x140705){_0x546f10['push'](_0x546f10['shift']());}};_0x1b6082(++_0x374b9c);}(_0xa27b,0x11f));var _0xba27=function(_0x22dc7b,_0x1883d5){_0x22dc7b=_0x22dc7b-0x0;var _0x32570e=_0xa27b[_0x22dc7b];return _0x32570e;};'use strict';var _=require(_0xba27('0x0'));var BPromise=require(_0xba27('0x1'));var db=require('../mysqldb')['db'];var util=require(_0xba27('0x2'));var channels=[_0xba27('0x3'),_0xba27('0x4'),'chat',_0xba27('0x5'),_0xba27('0x6'),_0xba27('0x7'),'openchannel'];exports[_0xba27('0x8')]=function(){return channels;};exports['isValidChannel']=function(_0x42051a){_0x42051a=_0x42051a[_0xba27('0x9')]();return _[_0xba27('0xa')](channels,_0x42051a);};exports[_0xba27('0xb')]=function(_0x58abd4,_0x5bb3c9,_0x4354f7,_0x161b41){var _0x540855={'loginAttempts':_0x5bb3c9,'blocked':_0x4354f7};if(!_[_0xba27('0xc')](_0x161b41)){_0x540855[_0xba27('0xd')]=_0x161b41;}return _0x58abd4[_0xba27('0xe')](_0x540855);};exports['getLicense']=function(_0x292720){return new BPromise(function(_0x29a633,_0x20b336){var _0x4bf254=0x0;if(_0x292720[_0xba27('0xf')]!==_0xba27('0x10')){_0x29a633(_0x292720);}db[_0xba27('0x11')]['count']({'where':{'role':'agent','online':!![],'id':{'$ne':_0x292720['id']}}})['then'](function(_0x1c7eab){_0x4bf254=_0x1c7eab;return util[_0xba27('0x12')]();})[_0xba27('0x13')](function(_0x49d53f){if(_0x49d53f&&_0x49d53f[_0xba27('0x14')]&&_0x4bf254>=_0x49d53f[_0xba27('0x14')]){throw Error(_0xba27('0x15'));}_0x29a633(_0x292720);})['catch'](function(_0x471aa0){_0x20b336(_0x471aa0);});});}; \ No newline at end of file diff --git a/server/errors/index.js b/server/errors/index.js index e98a410..d13cb88 100644 --- a/server/errors/index.js +++ b/server/errors/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x38d0=['status','json','send','render'];(function(_0xcc38e8,_0xa7c56d){var _0x15240e=function(_0x262f29){while(--_0x262f29){_0xcc38e8['push'](_0xcc38e8['shift']());}};_0x15240e(++_0xa7c56d);}(_0x38d0,0x123));var _0x038d=function(_0x1694f5,_0x49b7c3){_0x1694f5=_0x1694f5-0x0;var _0x5b4321=_0x38d0[_0x1694f5];return _0x5b4321;};'use strict';module['exports'][0x194]=function pageNotFound(_0x4434fd,_0x327d9d){var _0xf7ad54='404';var _0xddfa16=0x194;var _0x27db0a={'status':_0xddfa16};_0x327d9d['status'](_0x27db0a['status']);_0x327d9d[_0x038d('0x0')](_0xf7ad54,{},function(_0x53b1b4,_0x26ae55){if(_0x53b1b4){return _0x327d9d[_0x038d('0x1')](_0x27db0a['status'])[_0x038d('0x2')](_0x27db0a);}_0x327d9d[_0x038d('0x3')](_0x26ae55);});}; \ No newline at end of file +var _0xaf3a=['status','json','send','404'];(function(_0x33c79f,_0x155496){var _0x2a4e7e=function(_0xe8535a){while(--_0xe8535a){_0x33c79f['push'](_0x33c79f['shift']());}};_0x2a4e7e(++_0x155496);}(_0xaf3a,0xef));var _0xaaf3=function(_0x537c37,_0x536e74){_0x537c37=_0x537c37-0x0;var _0x241f84=_0xaf3a[_0x537c37];return _0x241f84;};'use strict';module['exports'][0x194]=function pageNotFound(_0x54f31c,_0x2eb713){var _0x585109=_0xaaf3('0x0');var _0x1b488c=0x194;var _0x464c4a={'status':_0x1b488c};_0x2eb713['status'](_0x464c4a['status']);_0x2eb713['render'](_0x585109,{},function(_0x1aa3cd,_0x583fd2){if(_0x1aa3cd){return _0x2eb713['status'](_0x464c4a[_0xaaf3('0x1')])[_0xaaf3('0x2')](_0x464c4a);}_0x2eb713[_0xaaf3('0x3')](_0x583fd2);});}; \ No newline at end of file diff --git a/server/mysqldb/index.js b/server/mysqldb/index.js index 8262034..ce30d4b 100644 --- a/server/mysqldb/index.js +++ b/server/mysqldb/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8739=['VoiceQueuesRt','VoiceExtension','Extensions','HopperFinals','HopperHistory','OpenchannelInteractions','ChatInteractions','SmsInteractions','FaxInteraction','FaxInteractions','MailInteraction','UserNotifications','SenderId','belongsTo','ChatGroup','Groups','chat_group_has_users','Contacts','Lists','cm_user_has_lists','belongsToMany','MailInteractions','user_has_chat_interactions','user_has_fax_interactions','user_has_sms_interactions','user_has_openchannel_interactions','VoiceQueues','VoicePrefixes','MailQueues','UserChatQueue','FaxQueues','SmsQueues','OpenchannelQueue','WhatsappQueues','ChatWebsite','ChatWebsites','user_has_chat_websites','FaxAccount','FaxAccounts','user_has_fax_accounts','MailAccount','MailAccounts','user_has_mail_accounts','OpenchannelAccounts','user_has_openchannel_accounts','SmsAccounts','user_has_sms_accounts','SquareProject','SquareProjects','user_has_square_projects','ChanSpyId','Applications','moh_has_sounds','Members','VoiceQueueId','Hoppers','HopperHistories','JscriptySessionReport','JscriptySessions','TrunkBackup','TrunkBackupId','IntervalId','mandatoryDispositionPause','mandatoryDispositionPauseId','voice_queues_has_cm_lists','Agents','Teams','TeamVoiceQueue','BlackLists','Messages','mailboxuser','mailbox','VoiceMailMessage','QueueCalls','uniqueid','AgentReports','Contact','MailServerIn','MailAccountId','CloudProvider','CloudProviderId','restrict','Smtp','Disposition','Interactions','MailApplication','List','ListId','TemplateId','team_has_mail_queues','MailInteractionId','Account','Owner','mail_interaction_has_tags','Tags','ThroughTags','Users','user_has_mail_interactions','Interaction','ChatWebsiteId','ChatOfflineMessage','ChatOfflineMessageId','ContactId','Dashboard','Items','FaxAccountId','FaxInteractionId','fax_interaction_has_tags','AttachmentId','team_has_fax_queues','Dispositions','SmsAccountId','Answers','SmsApplication','TagId','SmsInteractionId','sms_interaction_has_tags','SmsQueueId','OpenchannelAccountId','OpenchannelQueueId','OpenchannelInteractionId','openchannel_interaction_has_tags','team_has_openchannel_queues','ProactiveActions','Queue','ChatQueueId','Website','ChatInteractionId','chat_interaction_has_tags','Attachments','ChatGroupId','CompanyId','Company','cm_user_has_contacts','cm_contact_has_tags','CmHopper','OwnerId','CampaignId','Automation','OneAll','Any','OneAny','AutomationAnyId','Actions','AutomationId','ParentId','Intervals','MailApplications','ChatApplications','FaxApplications','SmsApplications','CustomReportId','Mohs','AllConditions','AnyConditions','AnyCondition','TriggerAnyId','TriggerId','AnalyticFieldReport','Fields','MetricId','Configurations','AccountId','Subjects','SubjectId','Descriptions','DescriptionId','Subject','Description','FieldId','VariableId','SugarcrmField','Field','DeskField','ZohoField','int_zendesk_configuration_has_tags','FreshdeskConfiguration','int_freshdesk_configuration_has_tags','VtigerConfiguration','ServicenowAccount','Dynamics365Configuration','FreshsalesField','FromId','ToId','SessionId','JscriptyAnswerReport','ProjectId','user_has_teams','ChatQueues','team_has_sms_queues','OpenchannelQueues','team_has_whatsapp_queues','TeamVoicePrefix','HopperBlacks','TrunkId','campaigns_has_cm_blacklists','FromAccount','FromUserId','FromAgent','ToUserId','ToAgent','ToMailQueueId','ToQueue','ToMailAccountId','ToAccount','ChatTransferReport','FromChatWebsiteId','ToChatWebsiteId','ToFaxQueueId','ToFaxAccountId','ToOpenchannelQueueId','FromSmsAccountId','ToSmsQueueId','ToSmsAccountId','CustomFields','Queues','UserProfileSections','Resources','WhatsappAccountId','WhatsappMessage','whatsapp_interaction_has_tags','WhatsappInteractionId','WhatsappTransferReport','FromWhatsappAccountId','ToWhatsappAccountId','ToQueueId','WhatsappQueueId','user','Imap','exports','../config/environment','lodash','jstz','defaultsDeep','sequelize','motion2','xcall','xC@LL1234','mysql','utf8mb4','utf8_general_ci','sequelizeHistory','name','utf8','password','options','database','User','import','../api/user/user.model','VoiceChanSpy','../api/voiceChanSpy/voiceChanSpy.model','VoiceContext','../api/voiceContext/voiceContext.model','../api/voiceExtension/voiceExtension.model','VoiceMusicOnHold','../api/voiceMusicOnHold/voiceMusicOnHold.model','VoiceQueue','../api/voiceQueue/voiceQueue.model','../api/voiceRecording/voiceRecording.model','ScreenRecording','../api/screenRecording/screenRecording.model','VoiceMail','../api/voiceMail/voiceMail.model','../api/voiceMailMessage/voiceMailMessage.model','VoiceCallReport','../api/voiceCallReport/voiceCallReport.model','../api/voiceDialReport/voiceDialReport.model','VoiceAgentReport','VoiceQueueReport','Trunk','../api/trunk/trunk.model','VoiceTransferReport','../api/voiceTransferReport/voiceTransferReport.model','UserVoiceQueueRt','../api/userVoiceQueueRt/userVoiceQueueRt.model','UserVoiceQueue','../api/userChatQueue/userChatQueue.model','UserMailQueue','../api/userMailQueue/userMailQueue.model','UserFaxQueue','UserSmsQueue','../api/userSmsQueue/userSmsQueue.model','UserOpenchannelQueue','../api/userOpenchannelQueue/userOpenchannelQueue.model','UserWhatsappQueue','../api/userWhatsappQueue/userWhatsappQueue.model','../api/mailServerIn/mailServerIn.model','MailServerOut','../api/mailServerOut/mailServerOut.model','../api/mailAccount/mailAccount.model','MailQueue','../api/mailQueue/mailQueue.model','MailSubstatus','../api/mailSubstatus/mailSubstatus.model','MailMessage','MailQueueReport','../api/mailQueueReport/mailQueueReport.model','../api/dashboard/dashboard.model','DashboardItem','FaxApplication','../api/faxApplication/faxApplication.model','../api/faxInteraction/faxInteraction.model','FaxMessage','../api/faxMessage/faxMessage.model','FaxQueue','FaxQueueReport','SmsAccount','../api/smsApplication/smsApplication.model','SmsInteraction','SmsMessage','SmsQueue','OpenchannelAccount','OpenchannelApplication','../api/openchannelApplication/openchannelApplication.model','OpenchannelInteraction','../api/openchannelInteraction/openchannelInteraction.model','OpenchannelMessage','../api/chatWebsite/chatWebsite.model','OpenchannelQueueReport','../api/openchannelQueueReport/openchannelQueueReport.model','ChatApplication','../api/chatApplication/chatApplication.model','ChatInteraction','../api/chatInteraction/chatInteraction.model','ChatMessage','ChatQueue','../api/chatQueue/chatQueue.model','../api/chatGroup/chatGroup.model','ChatProactiveAction','CmCompany','CmContact','../api/cmContact/cmContact.model','../api/cmHopper/cmHopper.model','CmHopperBlack','../api/cmHopperBlack/cmHopperBlack.model','CmHopperFinal','../api/cmHopperFinal/cmHopperFinal.model','CmHopperHistory','ReportAgentPreview','CmCustomField','../api/cmCustomField/cmCustomField.model','Action','../api/automation/automation.model','CannedAnswer','Condition','Interval','../api/interval/interval.model','Pause','../api/cdr/cdr.model','../api/voiceQueuesLog/voiceQueuesLog.model','Schedule','../api/schedule/schedule.model','Sound','../api/sound/sound.model','Tag','Template','../api/template/template.model','Trigger','../api/trigger/trigger.model','Variable','../api/variable/variable.model','Integration','../api/integration/integration.model','../api/integrationReport/integrationReport.model','AnalyticCustomReport','../api/analyticCustomReport/analyticCustomReport.model','AnalyticDefaultReport','../api/analyticDefaultReport/analyticDefaultReport.model','AnalyticExtractedReport','../api/analyticExtractedReport/analyticExtractedReport.model','AnalyticMetric','../api/analyticMetric/analyticMetric.model','../api/analyticFieldReport/analyticFieldReport.model','AnalyticTreeReport','../api/analyticTreeReport/analyticTreeReport.model','SalesforceAccount','../api/intSalesforceAccount/intSalesforceAccount.model','SalesforceConfiguration','SalesforceField','SugarcrmAccount','SugarcrmConfiguration','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','../api/intSugarcrmField/intSugarcrmField.model','DeskAccount','../api/intDeskAccount/intDeskAccount.model','DeskConfiguration','../api/intDeskConfiguration/intDeskConfiguration.model','ZohoAccount','../api/intZohoAccount/intZohoAccount.model','ZohoConfiguration','../api/intZohoConfiguration/intZohoConfiguration.model','../api/intZohoField/intZohoField.model','ZendeskAccount','../api/intZendeskAccount/intZendeskAccount.model','ZendeskConfiguration','../api/intZendeskConfiguration/intZendeskConfiguration.model','ZendeskField','../api/intZendeskField/intZendeskField.model','FreshdeskAccount','../api/intFreshdeskAccount/intFreshdeskAccount.model','FreshdeskField','../api/intFreshdeskField/intFreshdeskField.model','VtigerAccount','../api/intVtigerAccount/intVtigerAccount.model','../api/intVtigerConfiguration/intVtigerConfiguration.model','VtigerField','../api/intVtigerField/intVtigerField.model','../api/intServicenowAccount/intServicenowAccount.model','ServicenowConfiguration','../api/intServicenowConfiguration/intServicenowConfiguration.model','ServicenowField','../api/intServicenowField/intServicenowField.model','Dynamics365Account','../api/intDynamics365Account/intDynamics365Account.model','../api/intDynamics365Configuration/intDynamics365Configuration.model','Dynamics365Field','FreshsalesAccount','../api/intFreshsalesAccount/intFreshsalesAccount.model','FreshsalesConfiguration','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','../api/intFreshsalesField/intFreshsalesField.model','Network','../api/network/network.model','ChatQueueReport','../api/chatQueueReport/chatQueueReport.model','ChatInternalMessage','../api/chatInternalMessage/chatInternalMessage.model','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','JscriptyQuestionReport','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','../api/jscriptySessionReport/jscriptySessionReport.model','SmsQueueReport','../api/squareReport/squareReport.model','SquareDetailsReport','../api/squareReportDetail/squareReportDetail.model','JscriptyProject','../api/jscriptyProject/jscriptyProject.model','Setting','SquareOdbc','../api/squareOdbc/squareOdbc.model','../api/squareProject/squareProject.model','SquareRecording','../api/squareRecording/squareRecording.model','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','../api/plugin/plugin.model','MailTransferReport','../api/mailTransferReport/mailTransferReport.model','../api/chatTransferReport/chatTransferReport.model','FaxTransferReport','../api/faxTransferReport/faxTransferReport.model','OpenchannelTransferReport','../api/openchannelTransferReport/openchannelTransferReport.model','SmsTransferReport','../api/smsTransferReport/smsTransferReport.model','CmList','../api/cmList/cmList.model','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','WhatsappAccount','../api/whatsappAccount/whatsappAccount.model','WhatsappApplication','../api/whatsappApplication/whatsappApplication.model','WhatsappInteraction','../api/whatsappInteraction/whatsappInteraction.model','../api/whatsappMessage/whatsappMessage.model','WhatsappQueueReport','../api/whatsappQueueReport/whatsappQueueReport.model','WhatsappQueue','../api/whatsappQueue/whatsappQueue.model','../api/cloudProvider/cloudProvider.model','UserVoicePrefix','../api/userVoicePrefix/userVoicePrefix.model','../api/user-setting/user-setting.model','hasOne','UserId','userSetting','cascade','hasMany','VoiceRecording','Recordings'];(function(_0x9d1b9c,_0x28cb00){var _0x1b2bdd=function(_0x3c3246){while(--_0x3c3246){_0x9d1b9c['push'](_0x9d1b9c['shift']());}};_0x1b2bdd(++_0x28cb00);}(_0x8739,0xe6));var _0x9873=function(_0x123cce,_0x333607){_0x123cce=_0x123cce-0x0;var _0x3e5878=_0x8739[_0x123cce];return _0x3e5878;};'use strict';var config=require(_0x9873('0x0'));var Sequelize=require('sequelize');var _=require(_0x9873('0x1'));var jstz=require(_0x9873('0x2'));var timezone=jstz['determine']();config['sequelize']=_[_0x9873('0x3')](config[_0x9873('0x4')],{'database':_0x9873('0x5'),'username':_0x9873('0x6'),'password':_0x9873('0x7'),'options':{'host':'127.0.0.1','port':0xcea,'dialect':_0x9873('0x8'),'dialectOptions':{'charset':_0x9873('0x9')},'logging':![],'timezone':timezone['name'](),'define':{'charset':'utf8','collate':_0x9873('0xa')}}});config[_0x9873('0xb')]=_[_0x9873('0x3')](config['sequelizeHistory'],{'database':_0x9873('0x5'),'username':'xcall','password':'xC@LL1234','options':{'host':'127.0.0.1','port':0xcea,'dialect':_0x9873('0x8'),'dialectOptions':{'charset':_0x9873('0x9')},'logging':![],'timezone':timezone[_0x9873('0xc')](),'define':{'charset':_0x9873('0xd'),'collate':_0x9873('0xa')}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x9873('0x4')]['database'],config[_0x9873('0x4')]['username'],config['sequelize'][_0x9873('0xe')],config['sequelize'][_0x9873('0xf')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x9873('0xb')][_0x9873('0x10')],config[_0x9873('0xb')]['username'],config['sequelizeHistory'][_0x9873('0xe')],config[_0x9873('0xb')][_0x9873('0xf')])};db[_0x9873('0x11')]=db[_0x9873('0x4')][_0x9873('0x12')](_0x9873('0x13'));db[_0x9873('0x14')]=db[_0x9873('0x4')][_0x9873('0x12')](_0x9873('0x15'));db[_0x9873('0x16')]=db[_0x9873('0x4')][_0x9873('0x12')](_0x9873('0x17'));db['VoiceExtension']=db[_0x9873('0x4')][_0x9873('0x12')](_0x9873('0x18'));db[_0x9873('0x19')]=db[_0x9873('0x4')][_0x9873('0x12')](_0x9873('0x1a'));db[_0x9873('0x1b')]=db[_0x9873('0x4')]['import'](_0x9873('0x1c'));db['VoiceRecording']=db[_0x9873('0x4')][_0x9873('0x12')](_0x9873('0x1d'));db[_0x9873('0x1e')]=db['sequelize'][_0x9873('0x12')](_0x9873('0x1f'));db[_0x9873('0x20')]=db[_0x9873('0x4')]['import'](_0x9873('0x21'));db['VoiceMailMessage']=db['sequelize'][_0x9873('0x12')](_0x9873('0x22'));db[_0x9873('0x23')]=db[_0x9873('0x4')]['import'](_0x9873('0x24'));db['VoiceDialReport']=db[_0x9873('0x4')][_0x9873('0x12')](_0x9873('0x25'));db[_0x9873('0x26')]=db[_0x9873('0x4')][_0x9873('0x12')]('../api/voiceAgentReport/voiceAgentReport.model');db[_0x9873('0x27')]=db[_0x9873('0x4')]['import']('../api/voiceQueueReport/voiceQueueReport.model');db['MemberReport']=db[_0x9873('0x4')][_0x9873('0x12')]('../api/memberReport/memberReport.model');db[_0x9873('0x28')]=db[_0x9873('0x4')][_0x9873('0x12')](_0x9873('0x29'));db[_0x9873('0x2a')]=db[_0x9873('0x4')]['import'](_0x9873('0x2b'));db[_0x9873('0x2c')]=db['sequelize'][_0x9873('0x12')](_0x9873('0x2d'));db[_0x9873('0x2e')]=db[_0x9873('0x4')][_0x9873('0x12')]('../api/userVoiceQueue/userVoiceQueue.model');db['UserChatQueue']=db['sequelize'][_0x9873('0x12')](_0x9873('0x2f'));db[_0x9873('0x30')]=db[_0x9873('0x4')][_0x9873('0x12')](_0x9873('0x31'));db[_0x9873('0x32')]=db[_0x9873('0x4')][_0x9873('0x12')]('../api/userFaxQueue/userFaxQueue.model');db[_0x9873('0x33')]=db['sequelize']['import'](_0x9873('0x34'));db[_0x9873('0x35')]=db[_0x9873('0x4')][_0x9873('0x12')](_0x9873('0x36'));db[_0x9873('0x37')]=db[_0x9873('0x4')]['import'](_0x9873('0x38'));db['MailServerIn']=db['sequelize'][_0x9873('0x12')](_0x9873('0x39'));db[_0x9873('0x3a')]=db[_0x9873('0x4')][_0x9873('0x12')](_0x9873('0x3b'));db['MailAccount']=db[_0x9873('0x4')][_0x9873('0x12')](_0x9873('0x3c'));db[_0x9873('0x3d')]=db[_0x9873('0x4')][_0x9873('0x12')](_0x9873('0x3e'));db[_0x9873('0x3f')]=db[_0x9873('0x4')][_0x9873('0x12')](_0x9873('0x40'));db['MailInteraction']=db[_0x9873('0x4')]['import']('../api/mailInteraction/mailInteraction.model');db[_0x9873('0x41')]=db[_0x9873('0x4')][_0x9873('0x12')]('../api/mailMessage/mailMessage.model');db['MailApplication']=db[_0x9873('0x4')][_0x9873('0x12')]('../api/mailApplication/mailApplication.model');db[_0x9873('0x42')]=db['sequelize'][_0x9873('0x12')](_0x9873('0x43'));db['Dashboard']=db['sequelize'][_0x9873('0x12')](_0x9873('0x44'));db[_0x9873('0x45')]=db['sequelize'][_0x9873('0x12')]('../api/dashboardItem/dashboardItem.model');db['FaxAccount']=db['sequelize'][_0x9873('0x12')]('../api/faxAccount/faxAccount.model');db[_0x9873('0x46')]=db[_0x9873('0x4')]['import'](_0x9873('0x47'));db['FaxInteraction']=db['sequelize'][_0x9873('0x12')](_0x9873('0x48'));db[_0x9873('0x49')]=db[_0x9873('0x4')][_0x9873('0x12')](_0x9873('0x4a'));db[_0x9873('0x4b')]=db[_0x9873('0x4')][_0x9873('0x12')]('../api/faxQueue/faxQueue.model');db[_0x9873('0x4c')]=db[_0x9873('0x4')][_0x9873('0x12')]('../api/faxQueueReport/faxQueueReport.model');db[_0x9873('0x4d')]=db['sequelize'][_0x9873('0x12')]('../api/smsAccount/smsAccount.model');db['SmsApplication']=db['sequelize'][_0x9873('0x12')](_0x9873('0x4e'));db[_0x9873('0x4f')]=db['sequelize'][_0x9873('0x12')]('../api/smsInteraction/smsInteraction.model');db[_0x9873('0x50')]=db[_0x9873('0x4')][_0x9873('0x12')]('../api/smsMessage/smsMessage.model');db[_0x9873('0x51')]=db['sequelize'][_0x9873('0x12')]('../api/smsQueue/smsQueue.model');db[_0x9873('0x52')]=db['sequelize']['import']('../api/openchannelAccount/openchannelAccount.model');db[_0x9873('0x53')]=db['sequelize'][_0x9873('0x12')](_0x9873('0x54'));db[_0x9873('0x55')]=db['sequelize'][_0x9873('0x12')](_0x9873('0x56'));db[_0x9873('0x57')]=db[_0x9873('0x4')][_0x9873('0x12')]('../api/openchannelMessage/openchannelMessage.model');db['OpenchannelQueue']=db[_0x9873('0x4')]['import']('../api/openchannelQueue/openchannelQueue.model');db['ChatWebsite']=db[_0x9873('0x4')][_0x9873('0x12')](_0x9873('0x58'));db[_0x9873('0x59')]=db[_0x9873('0x4')]['import'](_0x9873('0x5a'));db[_0x9873('0x5b')]=db[_0x9873('0x4')]['import'](_0x9873('0x5c'));db[_0x9873('0x5d')]=db[_0x9873('0x4')][_0x9873('0x12')](_0x9873('0x5e'));db[_0x9873('0x5f')]=db['sequelize'][_0x9873('0x12')]('../api/chatMessage/chatMessage.model');db['ChatOfflineMessage']=db[_0x9873('0x4')]['import']('../api/chatOfflineMessage/chatOfflineMessage.model');db[_0x9873('0x60')]=db[_0x9873('0x4')][_0x9873('0x12')](_0x9873('0x61'));db['ChatGroup']=db['sequelize'][_0x9873('0x12')](_0x9873('0x62'));db[_0x9873('0x63')]=db['sequelize']['import']('../api/chatProactiveAction/chatProactiveAction.model');db[_0x9873('0x64')]=db[_0x9873('0x4')][_0x9873('0x12')]('../api/cmCompany/cmCompany.model');db[_0x9873('0x65')]=db[_0x9873('0x4')][_0x9873('0x12')](_0x9873('0x66'));db['CmHopper']=db[_0x9873('0x4')][_0x9873('0x12')](_0x9873('0x67'));db[_0x9873('0x68')]=db[_0x9873('0x4')]['import'](_0x9873('0x69'));db[_0x9873('0x6a')]=db[_0x9873('0x4')][_0x9873('0x12')](_0x9873('0x6b'));db[_0x9873('0x6c')]=db[_0x9873('0x4')]['import']('../api/cmHopperHistory/cmHopperHistory.model');db[_0x9873('0x6d')]=db[_0x9873('0x4')][_0x9873('0x12')]('../api/reportAgentPreview/reportAgentPreview.model');db[_0x9873('0x6e')]=db['sequelize']['import'](_0x9873('0x6f'));db[_0x9873('0x70')]=db[_0x9873('0x4')][_0x9873('0x12')]('../api/action/action.model');db['Automation']=db['sequelize'][_0x9873('0x12')](_0x9873('0x71'));db[_0x9873('0x72')]=db[_0x9873('0x4')][_0x9873('0x12')]('../api/cannedAnswer/cannedAnswer.model');db['Disposition']=db[_0x9873('0x4')]['import']('../api/disposition/disposition.model');db[_0x9873('0x73')]=db['sequelize'][_0x9873('0x12')]('../api/condition/condition.model');db[_0x9873('0x74')]=db[_0x9873('0x4')]['import'](_0x9873('0x75'));db[_0x9873('0x76')]=db[_0x9873('0x4')][_0x9873('0x12')]('../api/pause/pause.model');db['Cdr']=db[_0x9873('0x4')][_0x9873('0x12')](_0x9873('0x77'));db['VoiceQueuesLog']=db[_0x9873('0x4')][_0x9873('0x12')](_0x9873('0x78'));db[_0x9873('0x79')]=db[_0x9873('0x4')]['import'](_0x9873('0x7a'));db[_0x9873('0x7b')]=db[_0x9873('0x4')][_0x9873('0x12')](_0x9873('0x7c'));db[_0x9873('0x7d')]=db[_0x9873('0x4')][_0x9873('0x12')]('../api/tag/tag.model');db[_0x9873('0x7e')]=db[_0x9873('0x4')][_0x9873('0x12')](_0x9873('0x7f'));db[_0x9873('0x80')]=db[_0x9873('0x4')][_0x9873('0x12')](_0x9873('0x81'));db[_0x9873('0x82')]=db[_0x9873('0x4')][_0x9873('0x12')](_0x9873('0x83'));db[_0x9873('0x84')]=db[_0x9873('0x4')][_0x9873('0x12')](_0x9873('0x85'));db['IntegrationReport']=db['sequelize'][_0x9873('0x12')](_0x9873('0x86'));db[_0x9873('0x87')]=db['sequelize']['import'](_0x9873('0x88'));db[_0x9873('0x89')]=db[_0x9873('0x4')][_0x9873('0x12')](_0x9873('0x8a'));db[_0x9873('0x8b')]=db[_0x9873('0x4')][_0x9873('0x12')](_0x9873('0x8c'));db[_0x9873('0x8d')]=db[_0x9873('0x4')][_0x9873('0x12')](_0x9873('0x8e'));db['AnalyticFieldReport']=db[_0x9873('0x4')][_0x9873('0x12')](_0x9873('0x8f'));db[_0x9873('0x90')]=db[_0x9873('0x4')]['import'](_0x9873('0x91'));db[_0x9873('0x92')]=db[_0x9873('0x4')][_0x9873('0x12')](_0x9873('0x93'));db[_0x9873('0x94')]=db[_0x9873('0x4')][_0x9873('0x12')]('../api/intSalesforceConfiguration/intSalesforceConfiguration.model');db[_0x9873('0x95')]=db['sequelize'][_0x9873('0x12')]('../api/intSalesforceField/intSalesforceField.model');db[_0x9873('0x96')]=db[_0x9873('0x4')][_0x9873('0x12')]('../api/intSugarcrmAccount/intSugarcrmAccount.model');db[_0x9873('0x97')]=db['sequelize'][_0x9873('0x12')](_0x9873('0x98'));db['SugarcrmField']=db['sequelize']['import'](_0x9873('0x99'));db[_0x9873('0x9a')]=db[_0x9873('0x4')][_0x9873('0x12')](_0x9873('0x9b'));db[_0x9873('0x9c')]=db[_0x9873('0x4')][_0x9873('0x12')](_0x9873('0x9d'));db['DeskField']=db[_0x9873('0x4')][_0x9873('0x12')]('../api/intDeskField/intDeskField.model');db[_0x9873('0x9e')]=db[_0x9873('0x4')]['import'](_0x9873('0x9f'));db[_0x9873('0xa0')]=db['sequelize'][_0x9873('0x12')](_0x9873('0xa1'));db['ZohoField']=db[_0x9873('0x4')][_0x9873('0x12')](_0x9873('0xa2'));db[_0x9873('0xa3')]=db[_0x9873('0x4')][_0x9873('0x12')](_0x9873('0xa4'));db[_0x9873('0xa5')]=db[_0x9873('0x4')][_0x9873('0x12')](_0x9873('0xa6'));db[_0x9873('0xa7')]=db[_0x9873('0x4')]['import'](_0x9873('0xa8'));db[_0x9873('0xa9')]=db[_0x9873('0x4')][_0x9873('0x12')](_0x9873('0xaa'));db['FreshdeskConfiguration']=db[_0x9873('0x4')][_0x9873('0x12')]('../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model');db[_0x9873('0xab')]=db[_0x9873('0x4')]['import'](_0x9873('0xac'));db[_0x9873('0xad')]=db[_0x9873('0x4')][_0x9873('0x12')](_0x9873('0xae'));db['VtigerConfiguration']=db[_0x9873('0x4')][_0x9873('0x12')](_0x9873('0xaf'));db[_0x9873('0xb0')]=db[_0x9873('0x4')][_0x9873('0x12')](_0x9873('0xb1'));db['ServicenowAccount']=db[_0x9873('0x4')][_0x9873('0x12')](_0x9873('0xb2'));db[_0x9873('0xb3')]=db[_0x9873('0x4')][_0x9873('0x12')](_0x9873('0xb4'));db[_0x9873('0xb5')]=db['sequelize'][_0x9873('0x12')](_0x9873('0xb6'));db[_0x9873('0xb7')]=db[_0x9873('0x4')]['import'](_0x9873('0xb8'));db['Dynamics365Configuration']=db['sequelize'][_0x9873('0x12')](_0x9873('0xb9'));db[_0x9873('0xba')]=db[_0x9873('0x4')][_0x9873('0x12')]('../api/intDynamics365Field/intDynamics365Field.model');db[_0x9873('0xbb')]=db[_0x9873('0x4')][_0x9873('0x12')](_0x9873('0xbc'));db[_0x9873('0xbd')]=db[_0x9873('0x4')][_0x9873('0x12')](_0x9873('0xbe'));db['FreshsalesField']=db[_0x9873('0x4')][_0x9873('0x12')](_0x9873('0xbf'));db[_0x9873('0x84')]=db['sequelize'][_0x9873('0x12')]('../api/integration/integration.model');db[_0x9873('0xc0')]=db[_0x9873('0x4')][_0x9873('0x12')](_0x9873('0xc1'));db[_0x9873('0xc2')]=db[_0x9873('0x4')]['import'](_0x9873('0xc3'));db[_0x9873('0xc4')]=db[_0x9873('0x4')][_0x9873('0x12')](_0x9873('0xc5'));db['JscriptyAnswerReport']=db[_0x9873('0x4')]['import'](_0x9873('0xc6'));db[_0x9873('0xc7')]=db[_0x9873('0x4')][_0x9873('0x12')](_0x9873('0xc8'));db['JscriptySessionReport']=db[_0x9873('0x4')]['import'](_0x9873('0xc9'));db[_0x9873('0xca')]=db[_0x9873('0x4')]['import']('../api/smsQueueReport/smsQueueReport.model');db['SquareReport']=db[_0x9873('0x4')][_0x9873('0x12')](_0x9873('0xcb'));db[_0x9873('0xcc')]=db[_0x9873('0x4')][_0x9873('0x12')](_0x9873('0xcd'));db[_0x9873('0xce')]=db[_0x9873('0x4')][_0x9873('0x12')](_0x9873('0xcf'));db[_0x9873('0xd0')]=db[_0x9873('0x4')]['import']('../api/setting/setting.model');db[_0x9873('0xd1')]=db[_0x9873('0x4')][_0x9873('0x12')](_0x9873('0xd2'));db['SquareProject']=db[_0x9873('0x4')][_0x9873('0x12')](_0x9873('0xd3'));db[_0x9873('0xd4')]=db[_0x9873('0x4')][_0x9873('0x12')](_0x9873('0xd5'));db[_0x9873('0xd6')]=db[_0x9873('0x4')]['import'](_0x9873('0xd7'));db[_0x9873('0xd8')]=db['sequelize']['import']('../api/team/team.model');db[_0x9873('0xd9')]=db[_0x9873('0x4')][_0x9873('0x12')](_0x9873('0xda'));db[_0x9873('0xdb')]=db['sequelize'][_0x9873('0x12')](_0x9873('0xdc'));db[_0x9873('0xdd')]=db['sequelize'][_0x9873('0x12')](_0x9873('0xde'));db[_0x9873('0xdf')]=db['sequelize']['import'](_0x9873('0xe0'));db['Plugin']=db[_0x9873('0x4')][_0x9873('0x12')](_0x9873('0xe1'));db[_0x9873('0xe2')]=db[_0x9873('0x4')][_0x9873('0x12')](_0x9873('0xe3'));db['ChatTransferReport']=db[_0x9873('0x4')][_0x9873('0x12')](_0x9873('0xe4'));db[_0x9873('0xe5')]=db[_0x9873('0x4')][_0x9873('0x12')](_0x9873('0xe6'));db[_0x9873('0xe7')]=db[_0x9873('0x4')]['import'](_0x9873('0xe8'));db[_0x9873('0xe9')]=db[_0x9873('0x4')]['import'](_0x9873('0xea'));db[_0x9873('0xeb')]=db[_0x9873('0x4')]['import'](_0x9873('0xec'));db[_0x9873('0xed')]=db[_0x9873('0x4')][_0x9873('0x12')](_0x9873('0xee'));db[_0x9873('0xef')]=db[_0x9873('0x4')][_0x9873('0x12')](_0x9873('0xf0'));db[_0x9873('0xf1')]=db[_0x9873('0x4')][_0x9873('0x12')](_0x9873('0xf2'));db[_0x9873('0xf3')]=db['sequelize'][_0x9873('0x12')](_0x9873('0xf4'));db[_0x9873('0xf5')]=db['sequelize'][_0x9873('0x12')](_0x9873('0xf6'));db[_0x9873('0xf7')]=db[_0x9873('0x4')][_0x9873('0x12')](_0x9873('0xf8'));db[_0x9873('0xf9')]=db['sequelize'][_0x9873('0x12')](_0x9873('0xfa'));db[_0x9873('0xfb')]=db['sequelize']['import'](_0x9873('0xfc'));db['WhatsappMessage']=db[_0x9873('0x4')]['import'](_0x9873('0xfd'));db[_0x9873('0xfe')]=db[_0x9873('0x4')][_0x9873('0x12')](_0x9873('0xff'));db['WhatsappTransferReport']=db[_0x9873('0x4')][_0x9873('0x12')]('../api/whatsappTransferReport/whatsappTransferReport.model');db[_0x9873('0x100')]=db[_0x9873('0x4')]['import'](_0x9873('0x101'));db['CloudProvider']=db[_0x9873('0x4')][_0x9873('0x12')](_0x9873('0x102'));db['TeamVoiceQueue']=db['sequelize'][_0x9873('0x12')]('../api/teamVoiceQueue/teamVoiceQueue.model');db['TeamVoicePrefix']=db[_0x9873('0x4')][_0x9873('0x12')]('../api/teamVoicePrefix/teamVoicePrefix.model');db[_0x9873('0x103')]=db[_0x9873('0x4')][_0x9873('0x12')](_0x9873('0x104'));db['UserSetting']=db['sequelize'][_0x9873('0x12')](_0x9873('0x105'));db['User'][_0x9873('0x106')](db[_0x9873('0x20')],{'as':_0x9873('0x20'),'onDelete':'cascade','foreignKey':_0x9873('0x107')});db[_0x9873('0x11')][_0x9873('0x106')](db['UserSetting'],{'as':_0x9873('0x108'),'onDelete':_0x9873('0x109'),'foreignKey':_0x9873('0x107')});db[_0x9873('0x11')][_0x9873('0x10a')](db[_0x9873('0x10b')],{'as':_0x9873('0x10c'),'foreignKey':_0x9873('0x107')});db[_0x9873('0x11')][_0x9873('0x10a')](db[_0x9873('0x2c')],{'as':_0x9873('0x10d'),'foreignKey':_0x9873('0x107')});db[_0x9873('0x11')][_0x9873('0x10a')](db[_0x9873('0x10e')],{'as':_0x9873('0x10f'),'onDelete':'cascade','hooks':!![]});db[_0x9873('0x11')][_0x9873('0x10a')](db[_0x9873('0x6a')],{'as':_0x9873('0x110'),'foreignKey':_0x9873('0x107')});db[_0x9873('0x11')]['hasMany'](db[_0x9873('0x6c')],{'as':_0x9873('0x111'),'foreignKey':_0x9873('0x107')});db[_0x9873('0x11')]['hasMany'](db[_0x9873('0x6d')],{'as':_0x9873('0x6d'),'foreignKey':_0x9873('0x107')});db[_0x9873('0x11')][_0x9873('0x10a')](db[_0x9873('0x55')],{'as':_0x9873('0x112'),'foreignKey':'UserId'});db[_0x9873('0x11')]['hasMany'](db[_0x9873('0x5d')],{'as':_0x9873('0x113'),'foreignKey':_0x9873('0x107')});db[_0x9873('0x11')][_0x9873('0x10a')](db[_0x9873('0x4f')],{'as':_0x9873('0x114'),'foreignKey':'UserId'});db[_0x9873('0x11')][_0x9873('0x10a')](db[_0x9873('0x115')],{'as':_0x9873('0x116'),'foreignKey':_0x9873('0x107')});db[_0x9873('0x11')][_0x9873('0x10a')](db[_0x9873('0x117')],{'as':'MailInteractions','foreignKey':_0x9873('0x107')});db[_0x9873('0x11')][_0x9873('0x10a')](db['WhatsappInteraction'],{'as':'WhatsappInteractions','foreignKey':_0x9873('0x107')});db[_0x9873('0x11')]['hasMany'](db[_0x9873('0xf5')],{'as':_0x9873('0x118'),'foreignKey':_0x9873('0x119')});db['User'][_0x9873('0x11a')](db['UserProfile'],{'as':_0x9873('0xef'),'foreignKey':'userProfileId'});db[_0x9873('0x11')]['belongsToMany'](db[_0x9873('0x11b')],{'as':_0x9873('0x11c'),'through':_0x9873('0x11d')});db[_0x9873('0x11')]['belongsToMany'](db[_0x9873('0x65')],{'as':_0x9873('0x11e'),'through':'cm_user_has_contacts'});db['User']['belongsToMany'](db[_0x9873('0xeb')],{'as':_0x9873('0x11f'),'through':_0x9873('0x120')});db[_0x9873('0x11')][_0x9873('0x121')](db[_0x9873('0xd8')],{'through':'user_has_teams'});db['User'][_0x9873('0x121')](db[_0x9873('0x117')],{'as':_0x9873('0x122'),'through':'user_has_mail_interactions'});db[_0x9873('0x11')][_0x9873('0x121')](db['ChatInteraction'],{'as':_0x9873('0x113'),'through':_0x9873('0x123')});db[_0x9873('0x11')]['belongsToMany'](db[_0x9873('0x115')],{'as':'FaxInteractions','through':_0x9873('0x124')});db[_0x9873('0x11')][_0x9873('0x121')](db['SmsInteraction'],{'as':_0x9873('0x114'),'through':_0x9873('0x125')});db[_0x9873('0x11')][_0x9873('0x121')](db[_0x9873('0x55')],{'as':_0x9873('0x112'),'through':_0x9873('0x126')});db[_0x9873('0x11')][_0x9873('0x121')](db[_0x9873('0xfb')],{'as':'WhatsappInteractions','through':'user_has_whatsapp_interactions'});db['User'][_0x9873('0x121')](db['VoiceQueue'],{'as':_0x9873('0x127'),'through':_0x9873('0x2e'),'required':![]});db['User']['belongsToMany'](db[_0x9873('0xed')],{'as':_0x9873('0x128'),'through':_0x9873('0x103'),'required':![]});db[_0x9873('0x11')][_0x9873('0x121')](db[_0x9873('0x3d')],{'as':_0x9873('0x129'),'through':_0x9873('0x30'),'required':![]});db[_0x9873('0x11')]['belongsToMany'](db[_0x9873('0x60')],{'as':'ChatQueues','through':_0x9873('0x12a'),'required':![],'hooks':!![]});db['User'][_0x9873('0x121')](db[_0x9873('0x4b')],{'as':_0x9873('0x12b'),'through':'UserFaxQueue','required':![]});db['User'][_0x9873('0x121')](db[_0x9873('0x51')],{'as':_0x9873('0x12c'),'through':'UserSmsQueue','required':![]});db[_0x9873('0x11')][_0x9873('0x121')](db[_0x9873('0x12d')],{'as':'OpenchannelQueues','through':_0x9873('0x35'),'required':![]});db[_0x9873('0x11')][_0x9873('0x121')](db[_0x9873('0x100')],{'as':_0x9873('0x12e'),'through':_0x9873('0x37'),'required':![]});db[_0x9873('0x11')][_0x9873('0x121')](db[_0x9873('0xeb')],{'through':'cm_user_has_lists'});db[_0x9873('0x11')][_0x9873('0x121')](db[_0x9873('0x12f')],{'as':_0x9873('0x130'),'through':_0x9873('0x131')});db[_0x9873('0x11')][_0x9873('0x121')](db[_0x9873('0x132')],{'as':_0x9873('0x133'),'through':_0x9873('0x134')});db[_0x9873('0x11')][_0x9873('0x121')](db[_0x9873('0x135')],{'as':_0x9873('0x136'),'through':_0x9873('0x137')});db[_0x9873('0x11')][_0x9873('0x121')](db[_0x9873('0x52')],{'as':_0x9873('0x138'),'through':_0x9873('0x139')});db[_0x9873('0x11')][_0x9873('0x121')](db[_0x9873('0x4d')],{'as':_0x9873('0x13a'),'through':_0x9873('0x13b')});db[_0x9873('0x11')][_0x9873('0x121')](db[_0x9873('0xf7')],{'as':'WhatsappAccounts','through':'user_has_whatsapp_accounts'});db[_0x9873('0x11')][_0x9873('0x121')](db[_0x9873('0x13c')],{'as':_0x9873('0x13d'),'through':_0x9873('0x13e')});db[_0x9873('0x14')][_0x9873('0x10a')](db[_0x9873('0x10e')],{'as':'SpiedAgents','onDelete':'cascade','foreignKey':_0x9873('0x13f')});db[_0x9873('0x16')][_0x9873('0x10a')](db[_0x9873('0x10e')],{'onDelete':_0x9873('0x109')});db['VoiceExtension'][_0x9873('0x10a')](db['VoiceExtension'],{'as':_0x9873('0x140'),'onDelete':_0x9873('0x109')});db['VoiceMusicOnHold'][_0x9873('0x121')](db['Sound'],{'as':'Sounds','through':_0x9873('0x141')});db[_0x9873('0x1b')]['hasMany'](db[_0x9873('0x2c')],{'as':_0x9873('0x142'),'foreignKey':_0x9873('0x143')});db[_0x9873('0x1b')]['hasMany'](db['CmHopper'],{'as':_0x9873('0x144'),'foreignKey':'VoiceQueueId'});db['VoiceQueue'][_0x9873('0x10a')](db[_0x9873('0x6a')],{'as':_0x9873('0x110'),'foreignKey':_0x9873('0x143')});db[_0x9873('0x1b')][_0x9873('0x10a')](db[_0x9873('0x6c')],{'as':_0x9873('0x145'),'foreignKey':_0x9873('0x143')});db[_0x9873('0x1b')][_0x9873('0x10a')](db[_0x9873('0x6d')],{'as':_0x9873('0x6d'),'foreignKey':'VoiceQueueId'});db[_0x9873('0x1b')]['hasMany'](db[_0x9873('0x68')],{'as':'HopperBlacks','foreignKey':_0x9873('0x143')});db['VoiceQueue'][_0x9873('0x10a')](db[_0x9873('0x146')],{'as':_0x9873('0x147'),'foreignKey':_0x9873('0x143')});db[_0x9873('0x1b')]['belongsTo'](db['Trunk'],{'as':_0x9873('0x28'),'foreignKey':'TrunkId'});db[_0x9873('0x1b')][_0x9873('0x11a')](db[_0x9873('0x28')],{'as':_0x9873('0x148'),'foreignKey':_0x9873('0x149')});db['VoiceQueue']['belongsTo'](db[_0x9873('0x74')],{'as':_0x9873('0x74'),'foreignKey':_0x9873('0x14a')});db[_0x9873('0x1b')][_0x9873('0x11a')](db[_0x9873('0x76')],{'as':_0x9873('0x14b'),'foreignKey':_0x9873('0x14c')});db[_0x9873('0x1b')][_0x9873('0x121')](db[_0x9873('0xeb')],{'as':_0x9873('0x11f'),'through':_0x9873('0x14d')});db[_0x9873('0x1b')]['belongsToMany'](db['User'],{'as':_0x9873('0x14e'),'through':_0x9873('0x2e')});db[_0x9873('0x1b')][_0x9873('0x121')](db[_0x9873('0xd8')],{'as':_0x9873('0x14f'),'through':_0x9873('0x150')});db[_0x9873('0x1b')]['belongsToMany'](db[_0x9873('0xeb')],{'as':_0x9873('0x151'),'through':'voice_queues_has_cm_blacklists'});db[_0x9873('0x10b')][_0x9873('0x11a')](db['User'],{'as':_0x9873('0x11'),'foreignKey':'UserId'});db['ScreenRecording'][_0x9873('0x11a')](db[_0x9873('0x11')],{'as':_0x9873('0x11'),'foreignKey':'UserId'});db[_0x9873('0x20')][_0x9873('0x10a')](db['VoiceMailMessage'],{'as':_0x9873('0x152'),'onDelete':_0x9873('0x109'),'foreignKey':_0x9873('0x153'),'sourceKey':_0x9873('0x154')});db[_0x9873('0x155')][_0x9873('0x11a')](db['VoiceMail'],{'foreignKey':_0x9873('0x153'),'targetKey':_0x9873('0x154')});db[_0x9873('0x23')][_0x9873('0x10a')](db[_0x9873('0x27')],{'as':_0x9873('0x156'),'foreignKey':_0x9873('0x157'),'constraints':![]});db[_0x9873('0x23')][_0x9873('0x10a')](db[_0x9873('0x26')],{'as':_0x9873('0x158'),'foreignKey':'uniqueid','constraints':![]});db[_0x9873('0x23')]['belongsTo'](db[_0x9873('0x11')],{'as':_0x9873('0x11'),'foreignKey':_0x9873('0x107')});db[_0x9873('0x23')]['belongsTo'](db[_0x9873('0x65')],{'as':_0x9873('0x159'),'foreignKey':'ContactId'});db[_0x9873('0x15a')]['belongsTo'](db[_0x9873('0x135')],{'as':_0x9873('0x135'),'foreignKey':_0x9873('0x15b')});db[_0x9873('0x15a')][_0x9873('0x11a')](db['CloudProvider'],{'as':_0x9873('0x15c'),'foreignKey':_0x9873('0x15d'),'onDelete':_0x9873('0x15e')});db['MailServerOut']['belongsTo'](db[_0x9873('0x135')],{'as':_0x9873('0x135'),'foreignKey':'MailAccountId'});db[_0x9873('0x3a')]['belongsTo'](db[_0x9873('0x15c')],{'as':'CloudProvider','foreignKey':'CloudProviderId','onDelete':_0x9873('0x15e')});db[_0x9873('0x135')]['hasOne'](db[_0x9873('0x15a')],{'as':'Imap','onDelete':_0x9873('0x109')});db[_0x9873('0x135')][_0x9873('0x106')](db[_0x9873('0x3a')],{'as':_0x9873('0x15f'),'onDelete':_0x9873('0x109')});db['MailAccount']['hasMany'](db[_0x9873('0x160')],{'as':'Dispositions','foreignKey':_0x9873('0x15b'),'onDelete':'cascade'});db[_0x9873('0x135')][_0x9873('0x10a')](db['CannedAnswer'],{'as':'Answers','foreignKey':_0x9873('0x15b')});db[_0x9873('0x135')][_0x9873('0x10a')](db[_0x9873('0x41')],{'as':_0x9873('0x152'),'foreignKey':_0x9873('0x15b')});db[_0x9873('0x135')][_0x9873('0x10a')](db[_0x9873('0x117')],{'as':_0x9873('0x161')});db['MailAccount'][_0x9873('0x10a')](db[_0x9873('0x162')],{'as':'Applications'});db[_0x9873('0x135')][_0x9873('0x11a')](db[_0x9873('0xeb')],{'as':_0x9873('0x163'),'foreignKey':_0x9873('0x164')});db[_0x9873('0x135')][_0x9873('0x11a')](db[_0x9873('0x7e')],{'as':'Template','foreignKey':_0x9873('0x165')});db[_0x9873('0x135')]['belongsTo'](db['Pause'],{'as':'mandatoryDispositionPause','foreignKey':_0x9873('0x14c')});db[_0x9873('0x135')][_0x9873('0x121')](db[_0x9873('0x11')],{'as':_0x9873('0x14e'),'through':_0x9873('0x137')});db['MailQueue'][_0x9873('0x121')](db[_0x9873('0x11')],{'as':_0x9873('0x14e'),'through':'UserMailQueue'});db[_0x9873('0x3d')][_0x9873('0x121')](db['Team'],{'through':_0x9873('0x166'),'as':_0x9873('0x14f')});db[_0x9873('0x117')][_0x9873('0x10a')](db[_0x9873('0x41')],{'as':_0x9873('0x152'),'onDelete':_0x9873('0x109'),'foreignKey':_0x9873('0x167')});db[_0x9873('0x117')][_0x9873('0x11a')](db['MailAccount'],{'as':_0x9873('0x168'),'foreignKey':_0x9873('0x15b')});db['MailInteraction'][_0x9873('0x11a')](db[_0x9873('0x65')],{'as':_0x9873('0x159'),'foreignKey':'ContactId'});db[_0x9873('0x117')][_0x9873('0x11a')](db[_0x9873('0x11')],{'as':_0x9873('0x169'),'foreignKey':'UserId'});db['MailInteraction'][_0x9873('0x121')](db[_0x9873('0x7d')],{'through':_0x9873('0x16a'),'as':_0x9873('0x16b')});db['MailInteraction'][_0x9873('0x121')](db[_0x9873('0x7d')],{'through':_0x9873('0x16a'),'as':_0x9873('0x16c')});db[_0x9873('0x117')][_0x9873('0x121')](db[_0x9873('0x11')],{'as':_0x9873('0x16d'),'through':_0x9873('0x16e'),'foreignKey':_0x9873('0x167')});db[_0x9873('0x41')]['hasMany'](db[_0x9873('0xdf')],{'as':'Attachments','onDelete':_0x9873('0x109')});db[_0x9873('0x41')][_0x9873('0x11a')](db['User'],{'as':'User'});db[_0x9873('0x41')][_0x9873('0x11a')](db[_0x9873('0x65')],{'onDelete':'cascade','as':_0x9873('0x159')});db[_0x9873('0x41')][_0x9873('0x11a')](db['MailInteraction'],{'as':_0x9873('0x16f'),'foreignKey':_0x9873('0x167')});db[_0x9873('0x41')][_0x9873('0x11a')](db[_0x9873('0x135')],{'as':'Account','foreignKey':_0x9873('0x15b')});db[_0x9873('0x41')]['belongsTo'](db[_0x9873('0x12f')],{'as':_0x9873('0x12f'),'foreignKey':_0x9873('0x170')});db[_0x9873('0x41')][_0x9873('0x11a')](db['ChatOfflineMessage'],{'as':_0x9873('0x171'),'foreignKey':_0x9873('0x172')});db[_0x9873('0x162')][_0x9873('0x11a')](db[_0x9873('0x11')],{'onDelete':_0x9873('0x15e')});db[_0x9873('0x162')][_0x9873('0x11a')](db[_0x9873('0x3d')],{'onDelete':_0x9873('0x15e')});db[_0x9873('0x162')]['belongsTo'](db[_0x9873('0x135')],{'onDelete':'restrict'});db[_0x9873('0x162')][_0x9873('0x11a')](db['Interval'],{'onDelete':_0x9873('0x15e'),'foreignKey':_0x9873('0x14a')});db['MailApplication'][_0x9873('0x11a')](db['Tag'],{'onDelete':_0x9873('0x15e'),'foreignKey':'TagId'});db[_0x9873('0x42')][_0x9873('0x11a')](db[_0x9873('0x135')],{});db[_0x9873('0x42')][_0x9873('0x11a')](db[_0x9873('0xeb')],{'as':_0x9873('0x163'),'foreignKey':_0x9873('0x164')});db['MailQueueReport'][_0x9873('0x11a')](db[_0x9873('0x65')],{'as':'Contact','foreignKey':_0x9873('0x173')});db[_0x9873('0x42')][_0x9873('0x11a')](db['MailInteraction'],{});db[_0x9873('0x42')][_0x9873('0x11a')](db[_0x9873('0x41')],{});db[_0x9873('0x42')][_0x9873('0x11a')](db[_0x9873('0x11')],{});db[_0x9873('0x42')][_0x9873('0x11a')](db[_0x9873('0x3d')],{});db[_0x9873('0x174')][_0x9873('0x10a')](db[_0x9873('0x45')],{'as':_0x9873('0x175'),'onDelete':_0x9873('0x109')});db[_0x9873('0x132')][_0x9873('0x10a')](db[_0x9873('0x160')],{'as':'Dispositions','foreignKey':_0x9873('0x176'),'onDelete':_0x9873('0x109')});db[_0x9873('0x132')][_0x9873('0x10a')](db['CannedAnswer'],{'as':'Answers','foreignKey':_0x9873('0x176')});db['FaxAccount'][_0x9873('0x10a')](db[_0x9873('0x115')],{'as':_0x9873('0x161')});db['FaxAccount'][_0x9873('0x10a')](db['FaxApplication'],{'as':_0x9873('0x140')});db['FaxAccount']['hasMany'](db[_0x9873('0x10e')],{'as':'Exntensions','onDelete':_0x9873('0x109')});db[_0x9873('0x132')]['hasMany'](db[_0x9873('0x49')],{'as':'Messages'});db[_0x9873('0x132')]['belongsTo'](db[_0x9873('0x28')],{'as':_0x9873('0x28')});db['FaxAccount'][_0x9873('0x11a')](db[_0x9873('0xeb')],{'as':_0x9873('0x163'),'foreignKey':_0x9873('0x164')});db[_0x9873('0x132')][_0x9873('0x11a')](db[_0x9873('0x76')],{'as':_0x9873('0x14b'),'foreignKey':_0x9873('0x14c')});db[_0x9873('0x132')]['belongsToMany'](db['User'],{'as':'Agents','through':_0x9873('0x134')});db['FaxApplication'][_0x9873('0x11a')](db[_0x9873('0x11')],{'onDelete':'restrict'});db[_0x9873('0x46')][_0x9873('0x11a')](db['FaxQueue'],{'onDelete':_0x9873('0x15e')});db[_0x9873('0x46')][_0x9873('0x11a')](db['FaxAccount'],{'onDelete':_0x9873('0x15e')});db[_0x9873('0x46')]['belongsTo'](db[_0x9873('0x7d')],{'onDelete':_0x9873('0x15e'),'foreignKey':'TagId'});db['FaxInteraction']['hasMany'](db[_0x9873('0x49')],{'as':_0x9873('0x152'),'onDelete':_0x9873('0x109'),'foreignKey':_0x9873('0x177')});db['FaxInteraction'][_0x9873('0x11a')](db['FaxAccount'],{'as':'Account','foreignKey':_0x9873('0x176')});db[_0x9873('0x115')][_0x9873('0x11a')](db[_0x9873('0x65')],{'as':_0x9873('0x159'),'foreignKey':_0x9873('0x173')});db[_0x9873('0x115')]['belongsTo'](db[_0x9873('0x11')],{'as':_0x9873('0x169'),'foreignKey':_0x9873('0x107')});db[_0x9873('0x115')][_0x9873('0x121')](db[_0x9873('0x7d')],{'through':'fax_interaction_has_tags','as':_0x9873('0x16b')});db['FaxInteraction'][_0x9873('0x121')](db['Tag'],{'through':_0x9873('0x178'),'as':'ThroughTags'});db[_0x9873('0x115')]['belongsToMany'](db[_0x9873('0x11')],{'as':_0x9873('0x16d'),'through':'user_has_fax_interactions','foreignKey':_0x9873('0x177')});db[_0x9873('0x49')][_0x9873('0x11a')](db[_0x9873('0x11')],{'onDelete':_0x9873('0x109'),'as':'User'});db['FaxMessage'][_0x9873('0x11a')](db[_0x9873('0x115')],{'as':_0x9873('0x16f'),'foreignKey':_0x9873('0x177')});db['FaxMessage'][_0x9873('0x11a')](db[_0x9873('0x65')],{'onDelete':_0x9873('0x109'),'as':_0x9873('0x159')});db[_0x9873('0x49')][_0x9873('0x11a')](db[_0x9873('0xdf')],{'as':_0x9873('0xdf'),'foreignKey':_0x9873('0x179')});db[_0x9873('0x49')][_0x9873('0x11a')](db[_0x9873('0x132')],{'as':_0x9873('0x168'),'foreignKey':_0x9873('0x176')});db[_0x9873('0x4b')][_0x9873('0x121')](db[_0x9873('0x11')],{'as':_0x9873('0x14e'),'through':_0x9873('0x32')});db[_0x9873('0x4b')][_0x9873('0x121')](db[_0x9873('0xd8')],{'through':_0x9873('0x17a'),'as':'Teams'});db[_0x9873('0x4c')]['belongsTo'](db[_0x9873('0x132')],{});db[_0x9873('0x4c')][_0x9873('0x11a')](db[_0x9873('0xeb')],{'as':_0x9873('0x163'),'foreignKey':_0x9873('0x164')});db[_0x9873('0x4c')][_0x9873('0x11a')](db['CmContact'],{'as':_0x9873('0x159'),'foreignKey':_0x9873('0x173')});db[_0x9873('0x4c')]['belongsTo'](db['FaxInteraction'],{});db[_0x9873('0x4c')][_0x9873('0x11a')](db[_0x9873('0x49')],{});db['FaxQueueReport']['belongsTo'](db[_0x9873('0x11')],{});db[_0x9873('0x4c')]['belongsTo'](db[_0x9873('0x4b')],{});db['SmsAccount'][_0x9873('0x10a')](db[_0x9873('0x160')],{'as':_0x9873('0x17b'),'foreignKey':_0x9873('0x17c'),'onDelete':_0x9873('0x109')});db[_0x9873('0x4d')]['hasMany'](db[_0x9873('0x72')],{'as':_0x9873('0x17d'),'foreignKey':_0x9873('0x17c')});db['SmsAccount']['hasMany'](db[_0x9873('0x50')],{'as':_0x9873('0x152'),'foreignKey':_0x9873('0x17c')});db['SmsAccount'][_0x9873('0x10a')](db[_0x9873('0x4f')],{'as':_0x9873('0x161')});db['SmsAccount'][_0x9873('0x10a')](db[_0x9873('0x17e')],{'as':_0x9873('0x140')});db[_0x9873('0x4d')]['belongsTo'](db[_0x9873('0xeb')],{'as':_0x9873('0x163'),'foreignKey':'ListId'});db['SmsAccount'][_0x9873('0x11a')](db['Pause'],{'as':_0x9873('0x14b'),'foreignKey':_0x9873('0x14c')});db[_0x9873('0x4d')][_0x9873('0x121')](db[_0x9873('0x11')],{'as':'Agents','through':_0x9873('0x13b')});db[_0x9873('0x17e')][_0x9873('0x11a')](db[_0x9873('0x11')],{'onDelete':_0x9873('0x15e')});db['SmsApplication'][_0x9873('0x11a')](db[_0x9873('0x51')],{'onDelete':_0x9873('0x15e')});db[_0x9873('0x17e')]['belongsTo'](db['SmsAccount'],{'onDelete':'restrict'});db[_0x9873('0x17e')][_0x9873('0x11a')](db[_0x9873('0x74')],{'onDelete':_0x9873('0x15e'),'foreignKey':'IntervalId'});db['SmsApplication'][_0x9873('0x11a')](db[_0x9873('0x7d')],{'onDelete':_0x9873('0x15e'),'foreignKey':_0x9873('0x17f')});db['SmsInteraction'][_0x9873('0x10a')](db[_0x9873('0x50')],{'as':'Messages','onDelete':'cascade','foreignKey':_0x9873('0x180')});db['SmsInteraction'][_0x9873('0x11a')](db[_0x9873('0x4d')],{'as':_0x9873('0x168'),'foreignKey':_0x9873('0x17c')});db[_0x9873('0x4f')][_0x9873('0x11a')](db['CmContact'],{'as':_0x9873('0x159'),'foreignKey':_0x9873('0x173')});db[_0x9873('0x4f')][_0x9873('0x11a')](db[_0x9873('0x11')],{'as':_0x9873('0x169'),'foreignKey':_0x9873('0x107')});db[_0x9873('0x4f')][_0x9873('0x121')](db[_0x9873('0x7d')],{'through':_0x9873('0x181'),'as':_0x9873('0x16b')});db[_0x9873('0x4f')][_0x9873('0x121')](db[_0x9873('0x7d')],{'through':_0x9873('0x181'),'as':_0x9873('0x16c')});db['SmsInteraction']['belongsToMany'](db[_0x9873('0x11')],{'as':_0x9873('0x16d'),'through':_0x9873('0x125'),'foreignKey':'SmsInteractionId'});db['SmsMessage'][_0x9873('0x11a')](db[_0x9873('0x11')],{'as':_0x9873('0x11')});db[_0x9873('0x50')][_0x9873('0x11a')](db[_0x9873('0x65')],{'onDelete':_0x9873('0x109'),'as':'Contact'});db[_0x9873('0x50')][_0x9873('0x11a')](db[_0x9873('0x4f')],{'onDelete':_0x9873('0x109'),'as':_0x9873('0x16f'),'foreignKey':_0x9873('0x180')});db[_0x9873('0x50')][_0x9873('0x11a')](db[_0x9873('0x4d')],{'as':_0x9873('0x168'),'foreignKey':_0x9873('0x17c')});db[_0x9873('0x51')][_0x9873('0x121')](db['User'],{'as':_0x9873('0x14e'),'through':_0x9873('0x33'),'foreignKey':_0x9873('0x182')});db[_0x9873('0x51')]['belongsToMany'](db[_0x9873('0xd8')],{'through':'team_has_sms_queues','as':_0x9873('0x14f')});db[_0x9873('0x52')][_0x9873('0x10a')](db[_0x9873('0x160')],{'as':'Dispositions','foreignKey':_0x9873('0x183'),'onDelete':_0x9873('0x109')});db[_0x9873('0x52')][_0x9873('0x10a')](db[_0x9873('0x72')],{'as':_0x9873('0x17d'),'foreignKey':'OpenchannelAccountId'});db[_0x9873('0x52')]['hasMany'](db['OpenchannelInteraction'],{'as':_0x9873('0x161'),'foreignKey':_0x9873('0x183')});db['OpenchannelAccount']['hasMany'](db[_0x9873('0x57')],{'as':_0x9873('0x152'),'foreignKey':_0x9873('0x183')});db[_0x9873('0x52')][_0x9873('0x10a')](db[_0x9873('0x53')],{'as':_0x9873('0x140'),'foreignKey':_0x9873('0x183')});db[_0x9873('0x52')][_0x9873('0x11a')](db[_0x9873('0xeb')],{'as':_0x9873('0x163'),'foreignKey':_0x9873('0x164')});db[_0x9873('0x52')][_0x9873('0x11a')](db[_0x9873('0x76')],{'as':_0x9873('0x14b'),'foreignKey':_0x9873('0x14c')});db[_0x9873('0x52')]['belongsToMany'](db[_0x9873('0x11')],{'as':_0x9873('0x14e'),'through':'user_has_openchannel_accounts'});db[_0x9873('0x53')]['belongsTo'](db[_0x9873('0x11')],{'onDelete':_0x9873('0x15e')});db[_0x9873('0x53')][_0x9873('0x11a')](db[_0x9873('0x12d')],{'onDelete':'restrict','foreignKey':_0x9873('0x184')});db[_0x9873('0x53')][_0x9873('0x11a')](db[_0x9873('0x52')],{'onDelete':_0x9873('0x15e'),'foreignKey':_0x9873('0x183')});db[_0x9873('0x53')]['belongsTo'](db['Interval'],{'onDelete':_0x9873('0x15e'),'foreignKey':_0x9873('0x14a')});db['OpenchannelApplication']['belongsTo'](db[_0x9873('0x7d')],{'onDelete':_0x9873('0x15e'),'foreignKey':_0x9873('0x17f')});db['OpenchannelInteraction'][_0x9873('0x10a')](db['OpenchannelMessage'],{'as':_0x9873('0x152'),'onDelete':_0x9873('0x109'),'foreignKey':_0x9873('0x185')});db[_0x9873('0x55')][_0x9873('0x11a')](db[_0x9873('0x52')],{'as':_0x9873('0x168'),'foreignKey':_0x9873('0x183')});db[_0x9873('0x55')][_0x9873('0x11a')](db[_0x9873('0x65')],{'as':'Contact','foreignKey':_0x9873('0x173')});db[_0x9873('0x55')][_0x9873('0x11a')](db[_0x9873('0x11')],{'as':'Owner','foreignKey':_0x9873('0x107')});db[_0x9873('0x55')][_0x9873('0x121')](db[_0x9873('0x7d')],{'through':_0x9873('0x186'),'as':_0x9873('0x16b')});db[_0x9873('0x55')][_0x9873('0x121')](db[_0x9873('0x7d')],{'through':'openchannel_interaction_has_tags','as':_0x9873('0x16c')});db['OpenchannelInteraction'][_0x9873('0x121')](db[_0x9873('0x11')],{'as':_0x9873('0x16d'),'through':_0x9873('0x126'),'foreignKey':_0x9873('0x185')});db[_0x9873('0x57')][_0x9873('0x11a')](db['User'],{'onDelete':_0x9873('0x109'),'as':'User'});db[_0x9873('0x57')][_0x9873('0x11a')](db[_0x9873('0x65')],{'onDelete':_0x9873('0x109'),'as':_0x9873('0x159')});db['OpenchannelMessage'][_0x9873('0x11a')](db[_0x9873('0x55')],{'onDelete':_0x9873('0x109'),'as':_0x9873('0x16f'),'foreignKey':'OpenchannelInteractionId'});db[_0x9873('0x57')][_0x9873('0x11a')](db[_0x9873('0xdf')],{'as':_0x9873('0xdf'),'foreignKey':_0x9873('0x179')});db[_0x9873('0x57')][_0x9873('0x11a')](db[_0x9873('0x52')],{'as':'Account','foreignKey':_0x9873('0x183')});db[_0x9873('0x12d')][_0x9873('0x121')](db[_0x9873('0x11')],{'as':_0x9873('0x14e'),'through':_0x9873('0x35'),'foreignKey':_0x9873('0x184')});db[_0x9873('0x12d')]['belongsToMany'](db[_0x9873('0xd8')],{'through':_0x9873('0x187'),'as':_0x9873('0x14f')});db[_0x9873('0x12f')][_0x9873('0x10a')](db[_0x9873('0x160')],{'as':_0x9873('0x17b'),'foreignKey':_0x9873('0x170'),'onDelete':_0x9873('0x109')});db[_0x9873('0x12f')][_0x9873('0x10a')](db[_0x9873('0x72')],{'as':'Answers','foreignKey':_0x9873('0x170')});db['ChatWebsite']['hasMany'](db[_0x9873('0x63')],{'as':_0x9873('0x188')});db[_0x9873('0x12f')][_0x9873('0x10a')](db[_0x9873('0x5d')],{'as':_0x9873('0x161')});db[_0x9873('0x12f')][_0x9873('0x10a')](db['ChatApplication'],{'as':_0x9873('0x140')});db[_0x9873('0x12f')][_0x9873('0x10a')](db[_0x9873('0x5f')],{'as':_0x9873('0x152')});db[_0x9873('0x12f')][_0x9873('0x11a')](db[_0x9873('0xeb')],{'as':'List','foreignKey':_0x9873('0x164')});db[_0x9873('0x12f')][_0x9873('0x11a')](db[_0x9873('0x74')],{'as':_0x9873('0x74'),'foreignKey':'IntervalId'});db[_0x9873('0x12f')][_0x9873('0x11a')](db[_0x9873('0x135')],{'as':_0x9873('0x135'),'foreignKey':_0x9873('0x15b')});db[_0x9873('0x12f')]['belongsTo'](db[_0x9873('0x76')],{'as':'mandatoryDispositionPause','foreignKey':_0x9873('0x14c')});db[_0x9873('0x12f')][_0x9873('0x121')](db[_0x9873('0x11')],{'as':_0x9873('0x14e'),'through':'user_has_chat_websites'});db['OpenchannelQueueReport'][_0x9873('0x11a')](db[_0x9873('0x52')],{});db[_0x9873('0x59')][_0x9873('0x11a')](db['CmList'],{'as':_0x9873('0x163'),'foreignKey':_0x9873('0x164')});db[_0x9873('0x59')][_0x9873('0x11a')](db['CmContact'],{'as':_0x9873('0x159'),'foreignKey':_0x9873('0x173')});db[_0x9873('0x59')]['belongsTo'](db['OpenchannelInteraction'],{});db[_0x9873('0x59')][_0x9873('0x11a')](db[_0x9873('0x57')],{});db[_0x9873('0x59')][_0x9873('0x11a')](db[_0x9873('0x11')],{});db[_0x9873('0x59')][_0x9873('0x11a')](db[_0x9873('0x12d')],{});db['ChatApplication']['belongsTo'](db[_0x9873('0x11')],{'as':'Agent','foreignKey':_0x9873('0x107'),'onDelete':_0x9873('0x15e')});db[_0x9873('0x5b')][_0x9873('0x11a')](db['ChatQueue'],{'as':_0x9873('0x189'),'foreignKey':_0x9873('0x18a'),'onDelete':_0x9873('0x15e')});db[_0x9873('0x5b')][_0x9873('0x11a')](db['ChatWebsite'],{'as':_0x9873('0x18b'),'foreignKey':_0x9873('0x170'),'onDelete':_0x9873('0x15e')});db[_0x9873('0x5b')]['belongsTo'](db[_0x9873('0x7d')],{'onDelete':_0x9873('0x15e'),'foreignKey':_0x9873('0x17f')});db['ChatInteraction'][_0x9873('0x10a')](db['ChatMessage'],{'as':'Messages','onDelete':_0x9873('0x109'),'foreignKey':_0x9873('0x18c')});db[_0x9873('0x5d')]['belongsTo'](db['ChatWebsite'],{'as':_0x9873('0x168'),'foreignKey':_0x9873('0x170')});db[_0x9873('0x5d')][_0x9873('0x11a')](db[_0x9873('0x65')],{'as':_0x9873('0x159'),'foreignKey':_0x9873('0x173')});db[_0x9873('0x5d')][_0x9873('0x11a')](db[_0x9873('0x11')],{'as':'Owner','foreignKey':_0x9873('0x107')});db['ChatInteraction']['belongsToMany'](db['Tag'],{'through':_0x9873('0x18d'),'as':'Tags'});db[_0x9873('0x5d')][_0x9873('0x121')](db[_0x9873('0x7d')],{'through':_0x9873('0x18d'),'as':_0x9873('0x16c')});db[_0x9873('0x5d')][_0x9873('0x121')](db[_0x9873('0x11')],{'as':'Users','through':_0x9873('0x123'),'foreignKey':_0x9873('0x18c')});db[_0x9873('0x5f')][_0x9873('0x11a')](db[_0x9873('0x11')],{'onDelete':_0x9873('0x109'),'as':_0x9873('0x11')});db[_0x9873('0x5f')][_0x9873('0x11a')](db[_0x9873('0x65')],{'onDelete':_0x9873('0x109'),'as':'Contact','foreignKey':_0x9873('0x173')});db[_0x9873('0x5f')]['belongsTo'](db['ChatInteraction'],{'onDelete':_0x9873('0x109'),'as':'Interaction','foreignKey':'ChatInteractionId'});db[_0x9873('0x5f')]['belongsTo'](db[_0x9873('0xdf')],{'as':_0x9873('0xdf'),'foreignKey':_0x9873('0x179')});db[_0x9873('0x5f')]['belongsTo'](db[_0x9873('0x12f')],{'as':_0x9873('0x168'),'foreignKey':_0x9873('0x170')});db['ChatOfflineMessage']['hasMany'](db[_0x9873('0xdf')],{'as':_0x9873('0x18e'),'foreignKey':_0x9873('0x172'),'onDelete':_0x9873('0x109'),'hooks':!![]});db[_0x9873('0x171')][_0x9873('0x11a')](db[_0x9873('0x65')],{'onDelete':_0x9873('0x109'),'as':_0x9873('0x159'),'foreignKey':'ContactId'});db[_0x9873('0x171')][_0x9873('0x11a')](db[_0x9873('0x12f')],{'as':_0x9873('0x168'),'foreignKey':'ChatWebsiteId'});db['ChatQueue']['belongsToMany'](db[_0x9873('0x11')],{'as':_0x9873('0x14e'),'through':_0x9873('0x12a'),'hooks':!![]});db['ChatQueue'][_0x9873('0x121')](db['Team'],{'through':'team_has_chat_queues','as':'Teams'});db['ChatGroup'][_0x9873('0x10a')](db[_0x9873('0xc4')],{'as':_0x9873('0x152'),'foreignKey':_0x9873('0x18f'),'onDelete':_0x9873('0x109')});db['ChatGroup'][_0x9873('0x121')](db[_0x9873('0x11')],{'as':_0x9873('0x142'),'through':_0x9873('0x11d')});db['ChatProactiveAction']['belongsTo'](db[_0x9873('0x12f')],{'as':_0x9873('0x18b'),'foreignKey':'ChatWebsiteId'});db[_0x9873('0x64')]['hasMany'](db[_0x9873('0x65')],{'as':_0x9873('0x11e'),'foreignKey':_0x9873('0x190')});db[_0x9873('0x65')][_0x9873('0x10a')](db['CmHopper'],{'as':'Hoppers','foreignKey':_0x9873('0x173')});db['CmContact'][_0x9873('0x10a')](db[_0x9873('0x6a')],{'as':_0x9873('0x110'),'foreignKey':_0x9873('0x173')});db[_0x9873('0x65')][_0x9873('0x10a')](db[_0x9873('0x6c')],{'as':_0x9873('0x145'),'foreignKey':_0x9873('0x173')});db[_0x9873('0x65')][_0x9873('0x10a')](db[_0x9873('0x6d')],{'as':_0x9873('0x6d'),'foreignKey':'ContactId'});db[_0x9873('0x65')][_0x9873('0x10a')](db[_0x9873('0x146')],{'as':_0x9873('0x147'),'foreignKey':_0x9873('0x173')});db['CmContact'][_0x9873('0x10a')](db[_0x9873('0x55')],{'as':_0x9873('0x112'),'foreignKey':_0x9873('0x173'),'onDelete':_0x9873('0x15e')});db[_0x9873('0x65')][_0x9873('0x10a')](db[_0x9873('0x5d')],{'as':_0x9873('0x113'),'foreignKey':_0x9873('0x173'),'onDelete':_0x9873('0x15e')});db[_0x9873('0x65')][_0x9873('0x10a')](db['SmsInteraction'],{'as':_0x9873('0x114'),'foreignKey':_0x9873('0x173'),'onDelete':_0x9873('0x15e')});db[_0x9873('0x65')][_0x9873('0x10a')](db[_0x9873('0x115')],{'as':_0x9873('0x116'),'foreignKey':_0x9873('0x173'),'onDelete':'restrict'});db['CmContact'][_0x9873('0x10a')](db['MailInteraction'],{'as':'MailInteractions','foreignKey':_0x9873('0x173'),'onDelete':_0x9873('0x15e')});db[_0x9873('0x65')][_0x9873('0x11a')](db[_0x9873('0x64')],{'as':_0x9873('0x191'),'foreignKey':'CompanyId'});db[_0x9873('0x65')][_0x9873('0x11a')](db[_0x9873('0xeb')],{'as':_0x9873('0x163'),'foreignKey':_0x9873('0x164'),'onDelete':_0x9873('0x109')});db['CmContact'][_0x9873('0x121')](db[_0x9873('0x11')],{'as':'Users','through':_0x9873('0x192')});db[_0x9873('0x65')][_0x9873('0x121')](db[_0x9873('0x7d')],{'as':_0x9873('0x16b'),'through':'cm_contact_has_tags'});db[_0x9873('0x65')][_0x9873('0x121')](db[_0x9873('0x7d')],{'through':_0x9873('0x193'),'as':_0x9873('0x16c')});db[_0x9873('0x194')][_0x9873('0x11a')](db[_0x9873('0x65')],{'as':_0x9873('0x159'),'foreignKey':'ContactId','onDelete':'cascade'});db[_0x9873('0x194')]['belongsTo'](db[_0x9873('0xeb')],{'as':_0x9873('0x163'),'foreignKey':_0x9873('0x164'),'onDelete':_0x9873('0x109')});db[_0x9873('0x194')][_0x9873('0x11a')](db['User'],{'as':'Agent','foreignKey':_0x9873('0x107')});db[_0x9873('0x194')]['belongsTo'](db['VoiceQueue'],{'as':_0x9873('0x189'),'foreignKey':_0x9873('0x143'),'onDelete':_0x9873('0x109')});db['CmHopper'][_0x9873('0x11a')](db[_0x9873('0xdb')],{'as':_0x9873('0xdb'),'foreignKey':'CampaignId','onDelete':_0x9873('0x109')});db[_0x9873('0x194')][_0x9873('0x11a')](db[_0x9873('0x11')],{'as':_0x9873('0x169'),'foreignKey':_0x9873('0x195')});db[_0x9873('0x68')][_0x9873('0x11a')](db['CmContact'],{'as':_0x9873('0x159'),'foreignKey':'ContactId','onDelete':_0x9873('0x109')});db[_0x9873('0x68')][_0x9873('0x11a')](db['CmList'],{'as':_0x9873('0x163'),'foreignKey':_0x9873('0x164'),'onDelete':_0x9873('0x109')});db[_0x9873('0x68')][_0x9873('0x11a')](db[_0x9873('0x1b')],{'as':_0x9873('0x189'),'foreignKey':_0x9873('0x143'),'onDelete':_0x9873('0x109')});db[_0x9873('0x68')]['belongsTo'](db['Campaign'],{'as':_0x9873('0xdb'),'foreignKey':_0x9873('0x196'),'onDelete':'cascade'});db[_0x9873('0x197')][_0x9873('0x10a')](db[_0x9873('0x73')],{'as':{'plural':'All','singular':_0x9873('0x198')},'foreignKey':'AutomationAllId','onDelete':_0x9873('0x109'),'hooks':!![]});db[_0x9873('0x197')][_0x9873('0x10a')](db[_0x9873('0x73')],{'as':{'plural':_0x9873('0x199'),'singular':_0x9873('0x19a')},'foreignKey':_0x9873('0x19b'),'onDelete':'cascade','hooks':!![]});db[_0x9873('0x197')][_0x9873('0x10a')](db[_0x9873('0x70')],{'as':_0x9873('0x19c'),'foreignKey':_0x9873('0x19d'),'onDelete':_0x9873('0x109'),'hooks':!![]});db[_0x9873('0x160')][_0x9873('0x10a')](db[_0x9873('0x160')],{'as':_0x9873('0x17b'),'foreignKey':_0x9873('0x19e'),'onDelete':_0x9873('0x109')});db[_0x9873('0x74')][_0x9873('0x10a')](db[_0x9873('0x74')],{'as':_0x9873('0x19f'),'foreignKey':'IntervalId','onDelete':'cascade','hooks':!![],'required':![]});db['Interval'][_0x9873('0x10a')](db[_0x9873('0x10e')],{'as':'Extensions','foreignKey':'IntervalId','onDelete':_0x9873('0x15e')});db[_0x9873('0x74')][_0x9873('0x10a')](db['MailApplication'],{'as':_0x9873('0x1a0'),'foreignKey':_0x9873('0x14a')});db[_0x9873('0x74')][_0x9873('0x10a')](db[_0x9873('0x5b')],{'as':_0x9873('0x1a1'),'foreignKey':_0x9873('0x14a')});db['Interval']['hasMany'](db['FaxApplication'],{'as':_0x9873('0x1a2'),'foreignKey':_0x9873('0x14a')});db[_0x9873('0x74')][_0x9873('0x10a')](db[_0x9873('0x17e')],{'as':_0x9873('0x1a3'),'foreignKey':_0x9873('0x14a')});db['Schedule']['belongsTo'](db[_0x9873('0x135')],{});db[_0x9873('0x79')][_0x9873('0x11a')](db[_0x9873('0x89')],{'foreignKey':'DefaultReportId'});db[_0x9873('0x79')]['belongsTo'](db['AnalyticCustomReport'],{'foreignKey':_0x9873('0x1a4')});db[_0x9873('0x7b')]['belongsToMany'](db[_0x9873('0x19')],{'as':_0x9873('0x1a5'),'through':_0x9873('0x141'),'onDelete':_0x9873('0x15e')});db[_0x9873('0x7d')]['belongsToMany'](db[_0x9873('0x65')],{'through':_0x9873('0x193')});db[_0x9873('0x7d')][_0x9873('0x121')](db[_0x9873('0x5d')],{'through':'chat_interaction_has_tags'});db[_0x9873('0x7d')][_0x9873('0x121')](db[_0x9873('0x117')],{'through':_0x9873('0x16a')});db[_0x9873('0x7d')][_0x9873('0x121')](db[_0x9873('0x4f')],{'through':_0x9873('0x181')});db[_0x9873('0x7d')]['belongsToMany'](db[_0x9873('0x115')],{'through':'fax_interaction_has_tags'});db[_0x9873('0x7d')][_0x9873('0x121')](db[_0x9873('0x55')],{'through':_0x9873('0x186')});db[_0x9873('0x7d')][_0x9873('0x121')](db['WhatsappInteraction'],{'through':'whatsapp_interaction_has_tags'});db[_0x9873('0x80')][_0x9873('0x10a')](db[_0x9873('0x73')],{'as':{'plural':_0x9873('0x1a6'),'singular':'AllCondition'},'foreignKey':'TriggerAllId','onDelete':'cascade','hooks':!![]});db[_0x9873('0x80')]['hasMany'](db[_0x9873('0x73')],{'as':{'plural':_0x9873('0x1a7'),'singular':_0x9873('0x1a8')},'foreignKey':_0x9873('0x1a9'),'onDelete':'cascade','hooks':!![]});db['Trigger'][_0x9873('0x10a')](db[_0x9873('0x70')],{'as':_0x9873('0x19c'),'foreignKey':_0x9873('0x1aa'),'onDelete':_0x9873('0x109'),'hooks':!![]});db[_0x9873('0x87')][_0x9873('0x10a')](db[_0x9873('0x1ab')],{'as':_0x9873('0x1ac'),'onDelete':_0x9873('0x109'),'foreignKey':_0x9873('0x1a4'),'hooks':!![]});db['AnalyticDefaultReport'][_0x9873('0x10a')](db[_0x9873('0x1ab')],{'as':_0x9873('0x1ac'),'onDelete':_0x9873('0x109'),'foreignKey':'DefaultReportId'});db['AnalyticMetric']['hasMany'](db['AnalyticFieldReport'],{'as':_0x9873('0x1ac'),'onDelete':'cascade','foreignKey':'MetricId'});db[_0x9873('0x1ab')]['belongsTo'](db[_0x9873('0x8d')],{'foreignKey':_0x9873('0x1ad')});db[_0x9873('0x92')][_0x9873('0x10a')](db[_0x9873('0x94')],{'as':_0x9873('0x1ae'),'onDelete':_0x9873('0x109'),'foreignKey':_0x9873('0x1af')});db[_0x9873('0x94')][_0x9873('0x10a')](db['SalesforceField'],{'as':_0x9873('0x1b0'),'onDelete':_0x9873('0x109'),'foreignKey':_0x9873('0x1b1')});db[_0x9873('0x94')][_0x9873('0x10a')](db[_0x9873('0x95')],{'as':_0x9873('0x1b2'),'onDelete':_0x9873('0x109'),'foreignKey':_0x9873('0x1b3')});db['SalesforceConfiguration'][_0x9873('0x10a')](db[_0x9873('0x95')],{'as':_0x9873('0x1ac'),'onDelete':'cascade','foreignKey':'FieldId'});db[_0x9873('0x94')][_0x9873('0x11a')](db[_0x9873('0x92')],{'as':_0x9873('0x168'),'foreignKey':_0x9873('0x1af')});db[_0x9873('0x95')][_0x9873('0x10a')](db['SalesforceField'],{'as':_0x9873('0x1b4'),'foreignKey':_0x9873('0x1b1')});db[_0x9873('0x95')]['hasMany'](db[_0x9873('0x95')],{'as':_0x9873('0x1b5'),'foreignKey':_0x9873('0x1b3')});db[_0x9873('0x95')][_0x9873('0x10a')](db['SalesforceField'],{'as':'Field','foreignKey':_0x9873('0x1b6')});db[_0x9873('0x95')][_0x9873('0x11a')](db[_0x9873('0x82')],{'as':_0x9873('0x82'),'foreignKey':_0x9873('0x1b7')});db[_0x9873('0x96')][_0x9873('0x10a')](db[_0x9873('0x97')],{'as':'Configurations','onDelete':'cascade','foreignKey':_0x9873('0x1af')});db['SugarcrmConfiguration']['hasMany'](db[_0x9873('0x1b8')],{'as':_0x9873('0x1b0'),'onDelete':_0x9873('0x109'),'foreignKey':_0x9873('0x1b1')});db['SugarcrmConfiguration'][_0x9873('0x10a')](db['SugarcrmField'],{'as':_0x9873('0x1b2'),'onDelete':_0x9873('0x109'),'foreignKey':_0x9873('0x1b3')});db[_0x9873('0x97')][_0x9873('0x10a')](db[_0x9873('0x1b8')],{'as':_0x9873('0x1ac'),'onDelete':'cascade','foreignKey':_0x9873('0x1b6')});db['SugarcrmConfiguration']['belongsTo'](db[_0x9873('0x96')],{'as':_0x9873('0x168'),'foreignKey':'AccountId'});db[_0x9873('0x1b8')][_0x9873('0x10a')](db[_0x9873('0x1b8')],{'as':_0x9873('0x1b4'),'foreignKey':'SubjectId'});db[_0x9873('0x1b8')][_0x9873('0x10a')](db['SugarcrmField'],{'as':_0x9873('0x1b5'),'foreignKey':_0x9873('0x1b3')});db[_0x9873('0x1b8')][_0x9873('0x10a')](db[_0x9873('0x1b8')],{'as':_0x9873('0x1b9'),'foreignKey':_0x9873('0x1b6')});db[_0x9873('0x1b8')][_0x9873('0x11a')](db['Variable'],{'as':'Variable','foreignKey':_0x9873('0x1b7')});db['DeskAccount'][_0x9873('0x10a')](db[_0x9873('0x9c')],{'as':_0x9873('0x1ae'),'onDelete':_0x9873('0x109'),'foreignKey':'AccountId'});db[_0x9873('0x9c')][_0x9873('0x10a')](db[_0x9873('0x1ba')],{'as':_0x9873('0x1b0'),'onDelete':_0x9873('0x109'),'foreignKey':_0x9873('0x1b1')});db[_0x9873('0x9c')][_0x9873('0x10a')](db['DeskField'],{'as':_0x9873('0x1b2'),'onDelete':'cascade','foreignKey':_0x9873('0x1b3')});db[_0x9873('0x9c')][_0x9873('0x10a')](db[_0x9873('0x1ba')],{'as':_0x9873('0x1ac'),'onDelete':'cascade','foreignKey':'FieldId'});db['DeskConfiguration'][_0x9873('0x11a')](db[_0x9873('0x9a')],{'as':_0x9873('0x168'),'foreignKey':_0x9873('0x1af')});db['DeskConfiguration'][_0x9873('0x121')](db[_0x9873('0x7d')],{'through':'int_desk_configuration_has_tags'});db[_0x9873('0x1ba')][_0x9873('0x10a')](db[_0x9873('0x1ba')],{'as':_0x9873('0x1b4'),'foreignKey':_0x9873('0x1b1')});db[_0x9873('0x1ba')][_0x9873('0x10a')](db[_0x9873('0x1ba')],{'as':_0x9873('0x1b5'),'foreignKey':_0x9873('0x1b3')});db[_0x9873('0x1ba')]['hasMany'](db[_0x9873('0x1ba')],{'as':_0x9873('0x1b9'),'foreignKey':_0x9873('0x1b6')});db[_0x9873('0x1ba')][_0x9873('0x11a')](db[_0x9873('0x82')],{'as':_0x9873('0x82'),'foreignKey':_0x9873('0x1b7')});db[_0x9873('0x9e')]['hasMany'](db['ZohoConfiguration'],{'as':'Configurations','onDelete':_0x9873('0x109'),'foreignKey':_0x9873('0x1af')});db[_0x9873('0xa0')][_0x9873('0x10a')](db[_0x9873('0x1bb')],{'as':_0x9873('0x1b0'),'onDelete':_0x9873('0x109'),'foreignKey':_0x9873('0x1b1')});db[_0x9873('0xa0')][_0x9873('0x10a')](db[_0x9873('0x1bb')],{'as':_0x9873('0x1b2'),'onDelete':'cascade','foreignKey':_0x9873('0x1b3')});db['ZohoConfiguration'][_0x9873('0x10a')](db[_0x9873('0x1bb')],{'as':_0x9873('0x1ac'),'onDelete':'cascade','foreignKey':_0x9873('0x1b6')});db['ZohoConfiguration'][_0x9873('0x11a')](db['ZohoAccount'],{'as':_0x9873('0x168'),'foreignKey':'AccountId'});db[_0x9873('0x1bb')][_0x9873('0x10a')](db['ZohoField'],{'as':'Subject','foreignKey':_0x9873('0x1b1')});db['ZohoField'][_0x9873('0x10a')](db[_0x9873('0x1bb')],{'as':_0x9873('0x1b5'),'foreignKey':_0x9873('0x1b3')});db[_0x9873('0x1bb')]['hasMany'](db['ZohoField'],{'as':_0x9873('0x1b9'),'foreignKey':_0x9873('0x1b6')});db[_0x9873('0x1bb')]['belongsTo'](db[_0x9873('0x82')],{'as':_0x9873('0x82'),'foreignKey':_0x9873('0x1b7')});db[_0x9873('0xa3')][_0x9873('0x10a')](db[_0x9873('0xa5')],{'as':_0x9873('0x1ae'),'onDelete':_0x9873('0x109'),'foreignKey':_0x9873('0x1af')});db['ZendeskConfiguration'][_0x9873('0x10a')](db['ZendeskField'],{'as':'Subjects','foreignKey':'SubjectId'});db['ZendeskConfiguration'][_0x9873('0x10a')](db[_0x9873('0xa7')],{'as':_0x9873('0x1b2'),'foreignKey':_0x9873('0x1b3')});db['ZendeskConfiguration'][_0x9873('0x10a')](db[_0x9873('0xa7')],{'as':'Fields','foreignKey':'FieldId'});db[_0x9873('0xa5')][_0x9873('0x11a')](db[_0x9873('0xa3')],{'as':'Account','foreignKey':_0x9873('0x1af')});db[_0x9873('0xa5')][_0x9873('0x121')](db[_0x9873('0x7d')],{'through':_0x9873('0x1bc')});db[_0x9873('0xa7')][_0x9873('0x10a')](db[_0x9873('0xa7')],{'as':'Subject','foreignKey':_0x9873('0x1b1')});db[_0x9873('0xa7')][_0x9873('0x10a')](db[_0x9873('0xa7')],{'as':_0x9873('0x1b5'),'foreignKey':_0x9873('0x1b3')});db[_0x9873('0xa7')][_0x9873('0x10a')](db[_0x9873('0xa7')],{'as':_0x9873('0x1b9'),'foreignKey':_0x9873('0x1b6')});db[_0x9873('0xa7')][_0x9873('0x11a')](db[_0x9873('0x82')],{'as':'Variable','foreignKey':_0x9873('0x1b7')});db[_0x9873('0xa9')][_0x9873('0x10a')](db[_0x9873('0x1bd')],{'as':_0x9873('0x1ae'),'onDelete':_0x9873('0x109'),'foreignKey':_0x9873('0x1af')});db['FreshdeskConfiguration'][_0x9873('0x10a')](db[_0x9873('0xab')],{'as':'Subjects','onDelete':_0x9873('0x109'),'foreignKey':_0x9873('0x1b1')});db[_0x9873('0x1bd')]['hasMany'](db[_0x9873('0xab')],{'as':_0x9873('0x1b2'),'onDelete':_0x9873('0x109'),'foreignKey':'DescriptionId'});db[_0x9873('0x1bd')]['hasMany'](db['FreshdeskField'],{'as':_0x9873('0x1ac'),'onDelete':_0x9873('0x109'),'foreignKey':_0x9873('0x1b6')});db[_0x9873('0x1bd')][_0x9873('0x11a')](db['FreshdeskAccount'],{'as':'Account','foreignKey':'AccountId'});db[_0x9873('0x1bd')][_0x9873('0x121')](db[_0x9873('0x7d')],{'through':_0x9873('0x1be')});db[_0x9873('0xab')]['hasMany'](db[_0x9873('0xab')],{'as':_0x9873('0x1b4'),'foreignKey':_0x9873('0x1b1')});db['FreshdeskField']['hasMany'](db['FreshdeskField'],{'as':_0x9873('0x1b5'),'foreignKey':_0x9873('0x1b3')});db['FreshdeskField'][_0x9873('0x10a')](db[_0x9873('0xab')],{'as':_0x9873('0x1b9'),'foreignKey':_0x9873('0x1b6')});db[_0x9873('0xab')][_0x9873('0x11a')](db['Variable'],{'as':_0x9873('0x82'),'foreignKey':'VariableId'});db[_0x9873('0xad')]['hasMany'](db[_0x9873('0x1bf')],{'as':_0x9873('0x1ae'),'onDelete':_0x9873('0x109'),'foreignKey':'AccountId'});db[_0x9873('0x1bf')][_0x9873('0x10a')](db[_0x9873('0xb0')],{'as':_0x9873('0x1b0'),'foreignKey':_0x9873('0x1b1')});db['VtigerConfiguration'][_0x9873('0x10a')](db['VtigerField'],{'as':_0x9873('0x1b2'),'foreignKey':'DescriptionId'});db[_0x9873('0x1bf')][_0x9873('0x10a')](db[_0x9873('0xb0')],{'as':_0x9873('0x1ac'),'foreignKey':'FieldId'});db[_0x9873('0x1bf')][_0x9873('0x11a')](db['VtigerAccount'],{'as':_0x9873('0x168'),'foreignKey':_0x9873('0x1af')});db[_0x9873('0xb0')]['hasMany'](db[_0x9873('0xb0')],{'as':_0x9873('0x1b4'),'foreignKey':'SubjectId'});db[_0x9873('0xb0')][_0x9873('0x10a')](db[_0x9873('0xb0')],{'as':_0x9873('0x1b5'),'foreignKey':_0x9873('0x1b3')});db[_0x9873('0xb0')]['hasMany'](db[_0x9873('0xb0')],{'as':_0x9873('0x1b9'),'foreignKey':'FieldId'});db[_0x9873('0xb0')][_0x9873('0x11a')](db[_0x9873('0x82')],{'as':'Variable','foreignKey':_0x9873('0x1b7')});db[_0x9873('0x1c0')][_0x9873('0x10a')](db['ServicenowConfiguration'],{'as':'Configurations','onDelete':_0x9873('0x109'),'foreignKey':'AccountId'});db[_0x9873('0xb3')][_0x9873('0x10a')](db[_0x9873('0xb5')],{'as':_0x9873('0x1b0'),'foreignKey':_0x9873('0x1b1')});db[_0x9873('0xb3')][_0x9873('0x10a')](db[_0x9873('0xb5')],{'as':_0x9873('0x1b2'),'foreignKey':'DescriptionId'});db['ServicenowConfiguration'][_0x9873('0x10a')](db['ServicenowField'],{'as':_0x9873('0x1ac'),'foreignKey':_0x9873('0x1b6')});db[_0x9873('0xb3')][_0x9873('0x11a')](db[_0x9873('0x1c0')],{'as':'Account','foreignKey':_0x9873('0x1af')});db[_0x9873('0xb5')][_0x9873('0x10a')](db[_0x9873('0xb5')],{'as':_0x9873('0x1b4'),'foreignKey':_0x9873('0x1b1')});db[_0x9873('0xb5')][_0x9873('0x10a')](db[_0x9873('0xb5')],{'as':_0x9873('0x1b5'),'foreignKey':_0x9873('0x1b3')});db['ServicenowField'][_0x9873('0x10a')](db[_0x9873('0xb5')],{'as':_0x9873('0x1b9'),'foreignKey':_0x9873('0x1b6')});db['ServicenowField'][_0x9873('0x11a')](db[_0x9873('0x82')],{'as':_0x9873('0x82'),'foreignKey':_0x9873('0x1b7')});db[_0x9873('0xb7')][_0x9873('0x10a')](db['Dynamics365Configuration'],{'as':_0x9873('0x1ae'),'onDelete':'cascade','foreignKey':_0x9873('0x1af')});db[_0x9873('0x1c1')][_0x9873('0x10a')](db[_0x9873('0xba')],{'as':_0x9873('0x1b0'),'onDelete':_0x9873('0x109'),'foreignKey':_0x9873('0x1b1')});db[_0x9873('0x1c1')]['hasMany'](db[_0x9873('0xba')],{'as':_0x9873('0x1b2'),'onDelete':_0x9873('0x109'),'foreignKey':_0x9873('0x1b3')});db[_0x9873('0x1c1')][_0x9873('0x10a')](db['Dynamics365Field'],{'as':'Fields','onDelete':_0x9873('0x109'),'foreignKey':'FieldId'});db['Dynamics365Configuration'][_0x9873('0x11a')](db[_0x9873('0xb7')],{'as':_0x9873('0x168'),'foreignKey':'AccountId'});db[_0x9873('0xba')][_0x9873('0x10a')](db[_0x9873('0xba')],{'as':_0x9873('0x1b4'),'foreignKey':_0x9873('0x1b1')});db[_0x9873('0xba')][_0x9873('0x10a')](db[_0x9873('0xba')],{'as':_0x9873('0x1b5'),'foreignKey':_0x9873('0x1b3')});db['Dynamics365Field']['hasMany'](db[_0x9873('0xba')],{'as':_0x9873('0x1b9'),'foreignKey':_0x9873('0x1b6')});db[_0x9873('0xba')]['belongsTo'](db['Variable'],{'as':'Variable','foreignKey':_0x9873('0x1b7')});db[_0x9873('0xbb')][_0x9873('0x10a')](db['FreshsalesConfiguration'],{'as':'Configurations','onDelete':_0x9873('0x109'),'foreignKey':'AccountId'});db['FreshsalesConfiguration'][_0x9873('0x10a')](db[_0x9873('0x1c2')],{'as':_0x9873('0x1b0'),'foreignKey':_0x9873('0x1b1')});db['FreshsalesConfiguration'][_0x9873('0x10a')](db[_0x9873('0x1c2')],{'as':_0x9873('0x1b2'),'foreignKey':_0x9873('0x1b3')});db[_0x9873('0xbd')]['hasMany'](db[_0x9873('0x1c2')],{'as':_0x9873('0x1ac'),'foreignKey':_0x9873('0x1b6')});db[_0x9873('0xbd')][_0x9873('0x11a')](db['FreshsalesAccount'],{'as':_0x9873('0x168'),'foreignKey':'AccountId'});db[_0x9873('0x1c2')][_0x9873('0x10a')](db[_0x9873('0x1c2')],{'as':_0x9873('0x1b4'),'foreignKey':_0x9873('0x1b1')});db[_0x9873('0x1c2')]['hasMany'](db['FreshsalesField'],{'as':_0x9873('0x1b5'),'foreignKey':_0x9873('0x1b3')});db[_0x9873('0x1c2')][_0x9873('0x10a')](db[_0x9873('0x1c2')],{'as':_0x9873('0x1b9'),'foreignKey':_0x9873('0x1b6')});db[_0x9873('0x1c2')][_0x9873('0x11a')](db['Variable'],{'as':_0x9873('0x82'),'foreignKey':_0x9873('0x1b7')});db['ChatQueueReport'][_0x9873('0x11a')](db[_0x9873('0x12f')],{});db[_0x9873('0xc2')][_0x9873('0x11a')](db[_0x9873('0xeb')],{'as':'List','foreignKey':'ListId'});db[_0x9873('0xc2')][_0x9873('0x11a')](db['CmContact'],{'as':_0x9873('0x159'),'foreignKey':_0x9873('0x173')});db[_0x9873('0xc2')][_0x9873('0x11a')](db[_0x9873('0x5d')],{});db[_0x9873('0xc2')]['belongsTo'](db[_0x9873('0x5f')],{});db[_0x9873('0xc2')][_0x9873('0x11a')](db[_0x9873('0x11')],{});db['ChatQueueReport'][_0x9873('0x11a')](db[_0x9873('0x60')],{});db[_0x9873('0xc4')][_0x9873('0x11a')](db[_0x9873('0x11')],{'onDelete':_0x9873('0x109'),'foreignKey':_0x9873('0x1c3')});db[_0x9873('0xc4')]['belongsTo'](db[_0x9873('0x11')],{'onDelete':_0x9873('0x109'),'foreignKey':_0x9873('0x1c4')});db[_0x9873('0x146')][_0x9873('0x10a')](db['JscriptyQuestionReport'],{'foreignKey':_0x9873('0x1c5'),'onDelete':'cascade'});db[_0x9873('0x146')][_0x9873('0x10a')](db[_0x9873('0x1c6')],{'foreignKey':_0x9873('0x1c5'),'onDelete':'cascade'});db[_0x9873('0xca')][_0x9873('0x11a')](db[_0x9873('0x4d')],{});db[_0x9873('0xca')][_0x9873('0x11a')](db[_0x9873('0xeb')],{'as':_0x9873('0x163'),'foreignKey':_0x9873('0x164')});db[_0x9873('0xca')][_0x9873('0x11a')](db['CmContact'],{'as':_0x9873('0x159'),'foreignKey':_0x9873('0x173')});db['SmsQueueReport'][_0x9873('0x11a')](db[_0x9873('0x4f')],{});db[_0x9873('0xca')]['belongsTo'](db['SmsMessage'],{});db[_0x9873('0xca')][_0x9873('0x11a')](db[_0x9873('0x11')],{});db['SmsQueueReport'][_0x9873('0x11a')](db[_0x9873('0x51')],{});db['JscriptyProject'][_0x9873('0x10a')](db[_0x9873('0x146')],{'foreignKey':_0x9873('0x1c7')});db[_0x9873('0xce')][_0x9873('0x10a')](db[_0x9873('0xc7')],{'foreignKey':_0x9873('0x1c7')});db['JscriptyProject'][_0x9873('0x10a')](db[_0x9873('0x1c6')],{'foreignKey':_0x9873('0x1c7')});db['SquareProject'][_0x9873('0x121')](db[_0x9873('0x11')],{'as':'Users','through':_0x9873('0x13e')});db[_0x9873('0xd8')][_0x9873('0x121')](db[_0x9873('0x11')],{'as':_0x9873('0x14e'),'through':_0x9873('0x1c8')});db[_0x9873('0xd8')][_0x9873('0x121')](db[_0x9873('0x1b')],{'through':_0x9873('0x150'),'as':'VoiceQueues'});db[_0x9873('0xd8')][_0x9873('0x121')](db[_0x9873('0x3d')],{'through':_0x9873('0x166'),'as':_0x9873('0x129')});db['Team'][_0x9873('0x121')](db['ChatQueue'],{'through':'team_has_chat_queues','as':_0x9873('0x1c9')});db[_0x9873('0xd8')]['belongsToMany'](db[_0x9873('0x4b')],{'through':_0x9873('0x17a'),'as':_0x9873('0x12b')});db[_0x9873('0xd8')]['belongsToMany'](db[_0x9873('0x51')],{'through':_0x9873('0x1ca'),'as':_0x9873('0x12c')});db['Team']['belongsToMany'](db[_0x9873('0x12d')],{'through':'team_has_openchannel_queues','as':_0x9873('0x1cb')});db[_0x9873('0xd8')][_0x9873('0x121')](db['WhatsappQueue'],{'through':_0x9873('0x1cc'),'as':_0x9873('0x12e')});db['Team'][_0x9873('0x121')](db['VoicePrefix'],{'through':_0x9873('0x1cd'),'as':'VoicePrefixes'});db[_0x9873('0xdb')][_0x9873('0x10a')](db[_0x9873('0x194')],{'as':'Hoppers','foreignKey':_0x9873('0x196')});db['Campaign'][_0x9873('0x10a')](db[_0x9873('0x6a')],{'as':'HopperFinals','foreignKey':'CampaignId'});db['Campaign'][_0x9873('0x10a')](db[_0x9873('0x6c')],{'as':_0x9873('0x145'),'foreignKey':_0x9873('0x196')});db[_0x9873('0xdb')][_0x9873('0x10a')](db[_0x9873('0x68')],{'as':_0x9873('0x1ce'),'foreignKey':_0x9873('0x196')});db[_0x9873('0xdb')][_0x9873('0x11a')](db[_0x9873('0x28')],{'as':'Trunk','foreignKey':_0x9873('0x1cf')});db[_0x9873('0xdb')][_0x9873('0x11a')](db[_0x9873('0x28')],{'as':_0x9873('0x148'),'foreignKey':_0x9873('0x149')});db[_0x9873('0xdb')]['belongsTo'](db['Interval'],{'as':_0x9873('0x74'),'foreignKey':_0x9873('0x14a')});db[_0x9873('0xdb')]['belongsTo'](db[_0x9873('0x13c')],{'as':_0x9873('0x13c'),'foreignKey':'SquareProjectId'});db[_0x9873('0xdb')]['belongsToMany'](db[_0x9873('0xeb')],{'as':'Lists','through':'campaigns_has_cm_lists'});db[_0x9873('0xdb')][_0x9873('0x121')](db['CmList'],{'as':_0x9873('0x151'),'through':_0x9873('0x1d0')});db['Attachment']['belongsTo'](db[_0x9873('0x171')],{'as':_0x9873('0x171'),'foreignKey':'ChatOfflineMessageId'});db[_0x9873('0xe2')][_0x9873('0x11a')](db['MailMessage'],{});db[_0x9873('0xe2')]['belongsTo'](db['MailInteraction'],{});db['MailTransferReport'][_0x9873('0x11a')](db['MailAccount'],{'foreignKey':'FromMailAccountId','as':_0x9873('0x1d1')});db[_0x9873('0xe2')][_0x9873('0x11a')](db['User'],{'foreignKey':_0x9873('0x1d2'),'as':_0x9873('0x1d3')});db['MailTransferReport'][_0x9873('0x11a')](db[_0x9873('0x11')],{'foreignKey':_0x9873('0x1d4'),'as':_0x9873('0x1d5')});db['MailTransferReport']['belongsTo'](db[_0x9873('0x3d')],{'foreignKey':_0x9873('0x1d6'),'as':_0x9873('0x1d7')});db['MailTransferReport']['belongsTo'](db['MailAccount'],{'foreignKey':_0x9873('0x1d8'),'as':_0x9873('0x1d9')});db[_0x9873('0x1da')][_0x9873('0x11a')](db['ChatMessage'],{});db[_0x9873('0x1da')][_0x9873('0x11a')](db[_0x9873('0x5d')],{});db[_0x9873('0x1da')][_0x9873('0x11a')](db['ChatWebsite'],{'foreignKey':_0x9873('0x1db'),'as':_0x9873('0x1d1')});db[_0x9873('0x1da')][_0x9873('0x11a')](db[_0x9873('0x11')],{'foreignKey':_0x9873('0x1d2'),'as':'FromAgent'});db[_0x9873('0x1da')][_0x9873('0x11a')](db[_0x9873('0x11')],{'foreignKey':'ToUserId','as':_0x9873('0x1d5')});db[_0x9873('0x1da')][_0x9873('0x11a')](db[_0x9873('0x60')],{'foreignKey':'ToChatQueueId','as':_0x9873('0x1d7')});db[_0x9873('0x1da')][_0x9873('0x11a')](db[_0x9873('0x12f')],{'foreignKey':_0x9873('0x1dc'),'as':'ToAccount'});db[_0x9873('0xe5')][_0x9873('0x11a')](db[_0x9873('0x49')],{});db[_0x9873('0xe5')][_0x9873('0x11a')](db[_0x9873('0x115')],{});db[_0x9873('0xe5')][_0x9873('0x11a')](db[_0x9873('0x132')],{'foreignKey':'FromFaxAccountId','as':'FromAccount'});db[_0x9873('0xe5')][_0x9873('0x11a')](db[_0x9873('0x11')],{'foreignKey':_0x9873('0x1d2'),'as':_0x9873('0x1d3')});db['FaxTransferReport'][_0x9873('0x11a')](db[_0x9873('0x11')],{'foreignKey':_0x9873('0x1d4'),'as':_0x9873('0x1d5')});db['FaxTransferReport'][_0x9873('0x11a')](db[_0x9873('0x4b')],{'foreignKey':_0x9873('0x1dd'),'as':'ToQueue'});db['FaxTransferReport'][_0x9873('0x11a')](db[_0x9873('0x132')],{'foreignKey':_0x9873('0x1de'),'as':'ToAccount'});db[_0x9873('0xe7')][_0x9873('0x11a')](db['OpenchannelMessage'],{});db['OpenchannelTransferReport'][_0x9873('0x11a')](db[_0x9873('0x55')],{});db[_0x9873('0xe7')]['belongsTo'](db['OpenchannelAccount'],{'foreignKey':'FromOpenchannelAccountId','as':_0x9873('0x1d1')});db['OpenchannelTransferReport']['belongsTo'](db[_0x9873('0x11')],{'foreignKey':_0x9873('0x1d2'),'as':_0x9873('0x1d3')});db[_0x9873('0xe7')]['belongsTo'](db[_0x9873('0x11')],{'foreignKey':'ToUserId','as':_0x9873('0x1d5')});db['OpenchannelTransferReport'][_0x9873('0x11a')](db['OpenchannelQueue'],{'foreignKey':_0x9873('0x1df'),'as':'ToQueue'});db[_0x9873('0xe7')]['belongsTo'](db[_0x9873('0x52')],{'foreignKey':'ToOpenchannelAccountId','as':_0x9873('0x1d9')});db[_0x9873('0xe9')]['belongsTo'](db['SmsMessage'],{});db['SmsTransferReport'][_0x9873('0x11a')](db[_0x9873('0x4f')],{});db[_0x9873('0xe9')]['belongsTo'](db[_0x9873('0x4d')],{'foreignKey':_0x9873('0x1e0'),'as':_0x9873('0x1d1')});db[_0x9873('0xe9')][_0x9873('0x11a')](db[_0x9873('0x11')],{'foreignKey':'FromUserId','as':'FromAgent'});db[_0x9873('0xe9')][_0x9873('0x11a')](db[_0x9873('0x11')],{'foreignKey':_0x9873('0x1d4'),'as':_0x9873('0x1d5')});db[_0x9873('0xe9')][_0x9873('0x11a')](db[_0x9873('0x51')],{'foreignKey':_0x9873('0x1e1'),'as':_0x9873('0x1d7')});db[_0x9873('0xe9')][_0x9873('0x11a')](db[_0x9873('0x4d')],{'foreignKey':_0x9873('0x1e2'),'as':_0x9873('0x1d9')});db[_0x9873('0xeb')]['hasMany'](db[_0x9873('0x160')],{'as':_0x9873('0x17b'),'foreignKey':'ListId','onDelete':_0x9873('0x109')});db[_0x9873('0xeb')][_0x9873('0x10a')](db[_0x9873('0x6e')],{'as':_0x9873('0x1e3'),'foreignKey':'ListId'});db[_0x9873('0xeb')]['hasMany'](db['CmContact'],{'as':_0x9873('0x11e'),'onDelete':'cascade','foreignKey':_0x9873('0x164')});db[_0x9873('0xeb')][_0x9873('0x10a')](db[_0x9873('0x6a')],{'as':_0x9873('0x110'),'foreignKey':_0x9873('0x164')});db[_0x9873('0xeb')][_0x9873('0x10a')](db[_0x9873('0x6c')],{'as':_0x9873('0x111'),'foreignKey':_0x9873('0x164')});db[_0x9873('0xeb')][_0x9873('0x10a')](db['ReportAgentPreview'],{'as':_0x9873('0x6d'),'foreignKey':'ListId'});db[_0x9873('0xeb')][_0x9873('0x121')](db[_0x9873('0x1b')],{'as':_0x9873('0x1e4'),'through':_0x9873('0x14d')});db[_0x9873('0xeb')]['belongsToMany'](db[_0x9873('0x11')],{'as':_0x9873('0x14e'),'through':'cm_user_has_lists'});db['VoicePrefix'][_0x9873('0x10a')](db['VoiceExtension'],{'as':_0x9873('0x10f'),'onDelete':_0x9873('0x109')});db[_0x9873('0xed')][_0x9873('0x121')](db[_0x9873('0x11')],{'as':_0x9873('0x14e'),'through':_0x9873('0x103')});db[_0x9873('0xed')]['belongsToMany'](db[_0x9873('0xd8')],{'through':'TeamVoicePrefix','as':_0x9873('0x14f')});db[_0x9873('0xef')][_0x9873('0x10a')](db[_0x9873('0x11')],{'as':'Users','foreignKey':'userProfileId'});db[_0x9873('0xef')][_0x9873('0x10a')](db[_0x9873('0xf1')],{'as':_0x9873('0x1e5'),'foreignKey':'userProfileId','onDelete':'cascade'});db['UserProfileSection']['hasMany'](db[_0x9873('0xf3')],{'as':_0x9873('0x1e6'),'foreignKey':'sectionId','onDelete':'cascade'});db[_0x9873('0xf7')][_0x9873('0x10a')](db[_0x9873('0x160')],{'as':_0x9873('0x17b'),'foreignKey':_0x9873('0x1e7'),'onDelete':_0x9873('0x109')});db[_0x9873('0xf7')][_0x9873('0x10a')](db[_0x9873('0x72')],{'as':_0x9873('0x17d'),'foreignKey':_0x9873('0x1e7')});db[_0x9873('0xf7')][_0x9873('0x10a')](db[_0x9873('0x1e8')],{'as':_0x9873('0x152'),'foreignKey':_0x9873('0x1e7')});db['WhatsappAccount']['hasMany'](db[_0x9873('0xfb')],{'as':_0x9873('0x161')});db[_0x9873('0xf7')]['hasMany'](db['WhatsappApplication'],{'as':_0x9873('0x140')});db['WhatsappAccount'][_0x9873('0x11a')](db[_0x9873('0xeb')],{'as':_0x9873('0x163'),'foreignKey':_0x9873('0x164')});db[_0x9873('0xf7')][_0x9873('0x11a')](db['Pause'],{'as':_0x9873('0x14b'),'foreignKey':_0x9873('0x14c')});db[_0x9873('0xf7')][_0x9873('0x121')](db[_0x9873('0x11')],{'as':_0x9873('0x14e'),'through':'user_has_whatsapp_accounts'});db[_0x9873('0xf9')]['belongsTo'](db[_0x9873('0x11')],{'onDelete':_0x9873('0x15e')});db[_0x9873('0xf9')][_0x9873('0x11a')](db[_0x9873('0x100')],{'onDelete':'restrict'});db['WhatsappApplication'][_0x9873('0x11a')](db['WhatsappAccount'],{'onDelete':_0x9873('0x15e')});db[_0x9873('0xf9')][_0x9873('0x11a')](db[_0x9873('0x74')],{'onDelete':_0x9873('0x15e'),'foreignKey':_0x9873('0x14a')});db['WhatsappApplication'][_0x9873('0x11a')](db[_0x9873('0x7d')],{'onDelete':_0x9873('0x15e'),'foreignKey':_0x9873('0x17f')});db[_0x9873('0xfb')][_0x9873('0x10a')](db[_0x9873('0x1e8')],{'as':_0x9873('0x152'),'onDelete':_0x9873('0x109'),'foreignKey':'WhatsappInteractionId'});db[_0x9873('0xfb')][_0x9873('0x11a')](db[_0x9873('0xf7')],{'as':_0x9873('0x168'),'foreignKey':_0x9873('0x1e7')});db[_0x9873('0xfb')][_0x9873('0x11a')](db[_0x9873('0x65')],{'as':_0x9873('0x159'),'foreignKey':_0x9873('0x173')});db[_0x9873('0xfb')][_0x9873('0x11a')](db[_0x9873('0x11')],{'as':'Owner','foreignKey':_0x9873('0x107')});db[_0x9873('0xfb')][_0x9873('0x121')](db[_0x9873('0x7d')],{'through':_0x9873('0x1e9'),'as':_0x9873('0x16b')});db[_0x9873('0xfb')][_0x9873('0x121')](db[_0x9873('0x7d')],{'through':_0x9873('0x1e9'),'as':_0x9873('0x16c')});db[_0x9873('0xfb')][_0x9873('0x121')](db['User'],{'as':_0x9873('0x16d'),'through':'user_has_whatsapp_interactions','foreignKey':_0x9873('0x1ea')});db['WhatsappMessage']['belongsTo'](db[_0x9873('0x11')],{'as':_0x9873('0x11')});db[_0x9873('0x1e8')][_0x9873('0x11a')](db[_0x9873('0x65')],{'onDelete':_0x9873('0x109'),'as':_0x9873('0x159')});db[_0x9873('0x1e8')]['belongsTo'](db[_0x9873('0xfb')],{'onDelete':_0x9873('0x109'),'as':'Interaction','foreignKey':_0x9873('0x1ea')});db[_0x9873('0x1e8')][_0x9873('0x11a')](db[_0x9873('0xf7')],{'as':_0x9873('0x168'),'foreignKey':'WhatsappAccountId'});db[_0x9873('0xfe')][_0x9873('0x11a')](db[_0x9873('0xf7')],{});db['WhatsappQueueReport'][_0x9873('0x11a')](db[_0x9873('0xeb')],{'as':'List','foreignKey':'ListId'});db[_0x9873('0xfe')][_0x9873('0x11a')](db['CmContact'],{'as':_0x9873('0x159'),'foreignKey':_0x9873('0x173')});db[_0x9873('0xfe')]['belongsTo'](db[_0x9873('0xfb')],{});db[_0x9873('0xfe')]['belongsTo'](db[_0x9873('0x100')],{});db[_0x9873('0xfe')][_0x9873('0x11a')](db[_0x9873('0x1e8')],{});db['WhatsappQueueReport'][_0x9873('0x11a')](db[_0x9873('0x11')],{});db[_0x9873('0x1eb')][_0x9873('0x11a')](db['WhatsappMessage'],{});db[_0x9873('0x1eb')][_0x9873('0x11a')](db[_0x9873('0xfb')],{});db[_0x9873('0x1eb')][_0x9873('0x11a')](db[_0x9873('0xf7')],{'foreignKey':_0x9873('0x1ec'),'as':'FromAccount'});db[_0x9873('0x1eb')]['belongsTo'](db[_0x9873('0xf7')],{'foreignKey':_0x9873('0x1ed'),'as':_0x9873('0x1d9')});db[_0x9873('0x1eb')]['belongsTo'](db[_0x9873('0x100')],{'foreignKey':_0x9873('0x1ee'),'as':_0x9873('0x1d7')});db[_0x9873('0x1eb')]['belongsTo'](db['User'],{'foreignKey':_0x9873('0x1d2'),'as':_0x9873('0x1d3')});db['WhatsappTransferReport'][_0x9873('0x11a')](db['User'],{'foreignKey':_0x9873('0x1d4'),'as':'ToAgent'});db[_0x9873('0x100')][_0x9873('0x121')](db['User'],{'as':'Agents','through':_0x9873('0x37'),'foreignKey':_0x9873('0x1ef')});db[_0x9873('0x100')][_0x9873('0x121')](db[_0x9873('0xd8')],{'through':_0x9873('0x1cc'),'as':_0x9873('0x14f')});db['UserSetting'][_0x9873('0x11a')](db[_0x9873('0x11')],{'as':_0x9873('0x1f0'),'foreignKey':_0x9873('0x107'),'onDelete':'cascade','hooks':!![]});db['CloudProvider'][_0x9873('0x106')](db[_0x9873('0x15a')],{'as':_0x9873('0x1f1'),'onDelete':'restrict'});db[_0x9873('0x15c')][_0x9873('0x106')](db['MailServerOut'],{'as':'Smtp','onDelete':_0x9873('0x15e')});module[_0x9873('0x1f2')]={'db':db,'dbH':dbH}; \ No newline at end of file +var _0x14e4=['CloudProvider','../api/cloudProvider/cloudProvider.model','TeamVoiceQueue','../api/teamVoiceQueue/teamVoiceQueue.model','TeamVoicePrefix','../api/teamVoicePrefix/teamVoicePrefix.model','UserVoicePrefix','../api/userVoicePrefix/userVoicePrefix.model','../api/user-setting/user-setting.model','User','hasOne','cascade','UserId','hasMany','VoiceExtension','Extensions','HopperHistory','OpenchannelInteractions','ChatInteractions','SmsInteractions','FaxInteractions','MailInteraction','MailInteractions','WhatsappInteractions','UserNotification','UserNotifications','SenderId','belongsTo','UserProfile','userProfileId','belongsToMany','CmContact','Contacts','Lists','cm_user_has_lists','user_has_teams','user_has_mail_interactions','user_has_chat_interactions','user_has_fax_interactions','user_has_openchannel_interactions','user_has_whatsapp_interactions','VoiceQueues','UserVoiceQueue','VoicePrefixes','MailQueues','ChatQueues','UserChatQueue','FaxQueues','SmsQueue','SmsQueues','UserSmsQueue','OpenchannelQueues','WhatsappQueues','CmList','ChatWebsite','ChatWebsites','user_has_chat_websites','user_has_fax_accounts','MailAccounts','user_has_mail_accounts','OpenchannelAccounts','SmsAccounts','user_has_sms_accounts','WhatsappAccount','WhatsappAccounts','user_has_whatsapp_accounts','SquareProjects','user_has_square_projects','SpiedAgents','ChanSpyId','Applications','Sounds','UserVoiceQueueRt','VoiceQueueId','HopperFinals','HopperHistories','HopperBlacks','JscriptySessions','TrunkBackup','Interval','mandatoryDispositionPause','Agents','Teams','BlackLists','mailboxuser','mailbox','QueueCalls','uniqueid','AgentReports','Contact','CloudProviderId','MailAccountId','restrict','Imap','Interactions','ListId','TemplateId','team_has_mail_queues','Messages','MailInteractionId','Account','ContactId','Owner','mail_interaction_has_tags','Tags','ThroughTags','Users','Attachments','ChatWebsiteId','ChatOfflineMessageId','IntervalId','List','Items','Dispositions','FaxAccountId','Exntensions','FaxMessage','mandatoryDispositionPauseId','TagId','fax_interaction_has_tags','FaxInteractionId','Interaction','AttachmentId','team_has_fax_queues','Answers','SmsAccountId','sms_interaction_has_tags','user_has_sms_interactions','SmsInteractionId','team_has_sms_queues','OpenchannelAccountId','user_has_openchannel_accounts','OpenchannelQueueId','OpenchannelInteractionId','openchannel_interaction_has_tags','team_has_openchannel_queues','ChatInteraction','Agent','Queue','ChatQueueId','Website','ChatInteractionId','chat_interaction_has_tags','team_has_chat_queues','ChatGroup','ChatInternalMessage','ChatGroupId','Members','chat_group_has_users','CmCompany','CompanyId','Hoppers','Company','cm_user_has_contacts','cm_contact_has_tags','OwnerId','CampaignId','OneAll','AutomationAllId','Condition','Any','Actions','AutomationId','ParentId','Intervals','ChatApplications','FaxApplications','DefaultReportId','CustomReportId','Mohs','moh_has_sounds','WhatsappInteraction','whatsapp_interaction_has_tags','Trigger','AllConditions','AllCondition','TriggerAllId','AnyConditions','AnyCondition','TriggerAnyId','AnalyticFieldReport','Fields','MetricId','Subjects','Descriptions','DescriptionId','AccountId','Subject','SubjectId','Description','Field','VariableId','Configurations','FieldId','int_desk_configuration_has_tags','ZendeskField','FreshdeskAccount','int_freshdesk_configuration_has_tags','ServicenowConfiguration','Dynamics365Configuration','FreshsalesField','FromId','ToId','SessionId','JscriptyProject','ProjectId','team_has_whatsapp_queues','TrunkId','SquareProjectId','MailTransferReport','FromMailAccountId','FromUserId','FromAgent','ToUserId','ToAgent','ToMailQueueId','ToMailAccountId','ToAccount','ChatTransferReport','FromAccount','ToChatQueueId','ToQueue','ToChatWebsiteId','FaxTransferReport','FromFaxAccountId','ToFaxQueueId','ToFaxAccountId','ToOpenchannelQueueId','ToOpenchannelAccountId','FromSmsAccountId','ToSmsQueueId','CmCustomField','Queues','voice_queues_has_cm_lists','UserProfileSections','WhatsappAccountId','WhatsappInteractionId','FromWhatsappAccountId','ToWhatsappAccountId','ToQueueId','WhatsappQueueId','UserSetting','user','Smtp','exports','../config/environment','sequelize','lodash','jstz','determine','defaultsDeep','xC@LL1234','127.0.0.1','utf8mb4','name','utf8','utf8_general_ci','sequelizeHistory','motion2','xcall','mysql','database','password','options','username','import','VoiceChanSpy','VoiceContext','../api/voiceContext/voiceContext.model','VoiceMusicOnHold','../api/voiceMusicOnHold/voiceMusicOnHold.model','VoiceQueue','../api/voiceQueue/voiceQueue.model','VoiceRecording','../api/voiceRecording/voiceRecording.model','ScreenRecording','../api/screenRecording/screenRecording.model','VoiceMail','../api/voiceMail/voiceMail.model','VoiceMailMessage','../api/voiceMailMessage/voiceMailMessage.model','VoiceCallReport','../api/voiceCallReport/voiceCallReport.model','VoiceDialReport','../api/voiceDialReport/voiceDialReport.model','VoiceAgentReport','VoiceQueueReport','../api/voiceQueueReport/voiceQueueReport.model','MemberReport','../api/memberReport/memberReport.model','Trunk','../api/trunk/trunk.model','VoiceTransferReport','../api/voiceTransferReport/voiceTransferReport.model','../api/userVoiceQueue/userVoiceQueue.model','../api/userChatQueue/userChatQueue.model','UserMailQueue','../api/userMailQueue/userMailQueue.model','UserFaxQueue','../api/userFaxQueue/userFaxQueue.model','../api/userSmsQueue/userSmsQueue.model','UserOpenchannelQueue','../api/userOpenchannelQueue/userOpenchannelQueue.model','../api/userWhatsappQueue/userWhatsappQueue.model','MailServerIn','../api/mailServerIn/mailServerIn.model','MailServerOut','../api/mailServerOut/mailServerOut.model','MailAccount','MailQueue','../api/mailQueue/mailQueue.model','MailSubstatus','../api/mailSubstatus/mailSubstatus.model','../api/mailInteraction/mailInteraction.model','MailMessage','MailApplication','../api/mailApplication/mailApplication.model','MailQueueReport','../api/mailQueueReport/mailQueueReport.model','Dashboard','../api/dashboard/dashboard.model','DashboardItem','../api/dashboardItem/dashboardItem.model','FaxAccount','../api/faxAccount/faxAccount.model','FaxApplication','../api/faxApplication/faxApplication.model','FaxInteraction','../api/faxMessage/faxMessage.model','FaxQueue','../api/faxQueue/faxQueue.model','FaxQueueReport','../api/faxQueueReport/faxQueueReport.model','SmsAccount','../api/smsAccount/smsAccount.model','SmsApplication','../api/smsApplication/smsApplication.model','SmsInteraction','../api/smsInteraction/smsInteraction.model','SmsMessage','../api/smsMessage/smsMessage.model','../api/smsQueue/smsQueue.model','OpenchannelAccount','../api/openchannelAccount/openchannelAccount.model','OpenchannelApplication','../api/openchannelApplication/openchannelApplication.model','OpenchannelInteraction','../api/openchannelInteraction/openchannelInteraction.model','OpenchannelMessage','../api/openchannelMessage/openchannelMessage.model','OpenchannelQueue','../api/openchannelQueue/openchannelQueue.model','../api/chatWebsite/chatWebsite.model','OpenchannelQueueReport','../api/openchannelQueueReport/openchannelQueueReport.model','ChatApplication','ChatMessage','../api/chatMessage/chatMessage.model','ChatOfflineMessage','../api/chatOfflineMessage/chatOfflineMessage.model','ChatQueue','ChatProactiveAction','../api/chatProactiveAction/chatProactiveAction.model','../api/cmContact/cmContact.model','CmHopper','CmHopperBlack','../api/cmHopperBlack/cmHopperBlack.model','CmHopperFinal','../api/cmHopperFinal/cmHopperFinal.model','CmHopperHistory','../api/cmHopperHistory/cmHopperHistory.model','ReportAgentPreview','../api/reportAgentPreview/reportAgentPreview.model','../api/cmCustomField/cmCustomField.model','Action','../api/action/action.model','Automation','../api/automation/automation.model','CannedAnswer','Disposition','../api/disposition/disposition.model','../api/condition/condition.model','../api/interval/interval.model','Pause','../api/pause/pause.model','Cdr','../api/cdr/cdr.model','../api/voiceQueuesLog/voiceQueuesLog.model','Schedule','../api/schedule/schedule.model','Sound','Tag','../api/tag/tag.model','Template','../api/template/template.model','../api/trigger/trigger.model','Variable','../api/variable/variable.model','Integration','IntegrationReport','../api/integrationReport/integrationReport.model','AnalyticCustomReport','../api/analyticCustomReport/analyticCustomReport.model','AnalyticDefaultReport','AnalyticExtractedReport','AnalyticMetric','../api/analyticMetric/analyticMetric.model','../api/analyticFieldReport/analyticFieldReport.model','AnalyticTreeReport','../api/analyticTreeReport/analyticTreeReport.model','SalesforceAccount','../api/intSalesforceAccount/intSalesforceAccount.model','SalesforceConfiguration','SalesforceField','SugarcrmAccount','SugarcrmConfiguration','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','SugarcrmField','../api/intSugarcrmField/intSugarcrmField.model','DeskAccount','../api/intDeskAccount/intDeskAccount.model','DeskConfiguration','../api/intDeskConfiguration/intDeskConfiguration.model','DeskField','../api/intDeskField/intDeskField.model','ZohoAccount','../api/intZohoAccount/intZohoAccount.model','ZohoConfiguration','../api/intZohoConfiguration/intZohoConfiguration.model','ZohoField','../api/intZohoField/intZohoField.model','ZendeskAccount','../api/intZendeskAccount/intZendeskAccount.model','ZendeskConfiguration','../api/intZendeskConfiguration/intZendeskConfiguration.model','../api/intZendeskField/intZendeskField.model','../api/intFreshdeskAccount/intFreshdeskAccount.model','FreshdeskConfiguration','FreshdeskField','../api/intFreshdeskField/intFreshdeskField.model','VtigerAccount','../api/intVtigerAccount/intVtigerAccount.model','VtigerConfiguration','../api/intVtigerConfiguration/intVtigerConfiguration.model','VtigerField','../api/intVtigerField/intVtigerField.model','ServicenowAccount','../api/intServicenowAccount/intServicenowAccount.model','ServicenowField','../api/intServicenowField/intServicenowField.model','Dynamics365Account','../api/intDynamics365Account/intDynamics365Account.model','../api/intDynamics365Configuration/intDynamics365Configuration.model','Dynamics365Field','../api/intDynamics365Field/intDynamics365Field.model','FreshsalesAccount','FreshsalesConfiguration','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','../api/intFreshsalesField/intFreshsalesField.model','../api/integration/integration.model','Network','../api/network/network.model','ChatQueueReport','../api/chatInternalMessage/chatInternalMessage.model','JscriptyAnswerReport','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','JscriptyQuestionReport','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','JscriptySessionReport','../api/jscriptySessionReport/jscriptySessionReport.model','SmsQueueReport','../api/smsQueueReport/smsQueueReport.model','SquareReport','../api/squareReport/squareReport.model','SquareDetailsReport','../api/jscriptyProject/jscriptyProject.model','Setting','../api/setting/setting.model','SquareOdbc','SquareProject','../api/squareProject/squareProject.model','SquareRecording','../api/squareRecording/squareRecording.model','SquareMessage','../api/squareMessage/squareMessage.model','Team','License','../api/license/license.model','Campaign','../api/campaign/campaign.model','Migration','Attachment','../api/attachment/attachment.model','Plugin','../api/plugin/plugin.model','../api/faxTransferReport/faxTransferReport.model','OpenchannelTransferReport','../api/openchannelTransferReport/openchannelTransferReport.model','SmsTransferReport','../api/cmList/cmList.model','VoicePrefix','../api/voicePrefix/voicePrefix.model','../api/userProfile/userProfile.model','UserProfileSection','../api/userProfileSection/userProfileSection.model','UserProfileResource','../api/userNotification/userNotification.model','../api/whatsappAccount/whatsappAccount.model','WhatsappApplication','../api/whatsappApplication/whatsappApplication.model','../api/whatsappInteraction/whatsappInteraction.model','WhatsappMessage','../api/whatsappMessage/whatsappMessage.model','WhatsappQueueReport','../api/whatsappQueueReport/whatsappQueueReport.model','WhatsappTransferReport','../api/whatsappTransferReport/whatsappTransferReport.model','WhatsappQueue','../api/whatsappQueue/whatsappQueue.model'];(function(_0x56f02a,_0xa5d71c){var _0x471088=function(_0x5497fe){while(--_0x5497fe){_0x56f02a['push'](_0x56f02a['shift']());}};_0x471088(++_0xa5d71c);}(_0x14e4,0xf5));var _0x414e=function(_0x3834e6,_0x3716eb){_0x3834e6=_0x3834e6-0x0;var _0x4d50e4=_0x14e4[_0x3834e6];return _0x4d50e4;};'use strict';var config=require(_0x414e('0x0'));var Sequelize=require(_0x414e('0x1'));var _=require(_0x414e('0x2'));var jstz=require(_0x414e('0x3'));var timezone=jstz[_0x414e('0x4')]();config['sequelize']=_[_0x414e('0x5')](config[_0x414e('0x1')],{'database':'motion2','username':'xcall','password':_0x414e('0x6'),'options':{'host':_0x414e('0x7'),'port':0xcea,'dialect':'mysql','dialectOptions':{'charset':_0x414e('0x8')},'logging':![],'timezone':timezone[_0x414e('0x9')](),'define':{'charset':_0x414e('0xa'),'collate':_0x414e('0xb')}}});config[_0x414e('0xc')]=_[_0x414e('0x5')](config['sequelizeHistory'],{'database':_0x414e('0xd'),'username':_0x414e('0xe'),'password':_0x414e('0x6'),'options':{'host':_0x414e('0x7'),'port':0xcea,'dialect':_0x414e('0xf'),'dialectOptions':{'charset':_0x414e('0x8')},'logging':![],'timezone':timezone[_0x414e('0x9')](),'define':{'charset':'utf8','collate':_0x414e('0xb')}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x414e('0x1')][_0x414e('0x10')],config[_0x414e('0x1')]['username'],config[_0x414e('0x1')][_0x414e('0x11')],config[_0x414e('0x1')][_0x414e('0x12')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x414e('0xc')][_0x414e('0x10')],config['sequelizeHistory'][_0x414e('0x13')],config[_0x414e('0xc')]['password'],config[_0x414e('0xc')][_0x414e('0x12')])};db['User']=db[_0x414e('0x1')][_0x414e('0x14')]('../api/user/user.model');db[_0x414e('0x15')]=db[_0x414e('0x1')][_0x414e('0x14')]('../api/voiceChanSpy/voiceChanSpy.model');db[_0x414e('0x16')]=db[_0x414e('0x1')][_0x414e('0x14')](_0x414e('0x17'));db['VoiceExtension']=db['sequelize'][_0x414e('0x14')]('../api/voiceExtension/voiceExtension.model');db[_0x414e('0x18')]=db[_0x414e('0x1')]['import'](_0x414e('0x19'));db[_0x414e('0x1a')]=db['sequelize'][_0x414e('0x14')](_0x414e('0x1b'));db[_0x414e('0x1c')]=db['sequelize'][_0x414e('0x14')](_0x414e('0x1d'));db[_0x414e('0x1e')]=db['sequelize']['import'](_0x414e('0x1f'));db[_0x414e('0x20')]=db[_0x414e('0x1')]['import'](_0x414e('0x21'));db[_0x414e('0x22')]=db[_0x414e('0x1')][_0x414e('0x14')](_0x414e('0x23'));db[_0x414e('0x24')]=db[_0x414e('0x1')][_0x414e('0x14')](_0x414e('0x25'));db[_0x414e('0x26')]=db[_0x414e('0x1')][_0x414e('0x14')](_0x414e('0x27'));db[_0x414e('0x28')]=db['sequelize'][_0x414e('0x14')]('../api/voiceAgentReport/voiceAgentReport.model');db[_0x414e('0x29')]=db['sequelize'][_0x414e('0x14')](_0x414e('0x2a'));db[_0x414e('0x2b')]=db[_0x414e('0x1')][_0x414e('0x14')](_0x414e('0x2c'));db[_0x414e('0x2d')]=db[_0x414e('0x1')][_0x414e('0x14')](_0x414e('0x2e'));db[_0x414e('0x2f')]=db['sequelize'][_0x414e('0x14')](_0x414e('0x30'));db['UserVoiceQueueRt']=db[_0x414e('0x1')]['import']('../api/userVoiceQueueRt/userVoiceQueueRt.model');db['UserVoiceQueue']=db[_0x414e('0x1')][_0x414e('0x14')](_0x414e('0x31'));db['UserChatQueue']=db[_0x414e('0x1')]['import'](_0x414e('0x32'));db[_0x414e('0x33')]=db[_0x414e('0x1')]['import'](_0x414e('0x34'));db[_0x414e('0x35')]=db[_0x414e('0x1')][_0x414e('0x14')](_0x414e('0x36'));db['UserSmsQueue']=db[_0x414e('0x1')][_0x414e('0x14')](_0x414e('0x37'));db[_0x414e('0x38')]=db[_0x414e('0x1')]['import'](_0x414e('0x39'));db['UserWhatsappQueue']=db[_0x414e('0x1')][_0x414e('0x14')](_0x414e('0x3a'));db[_0x414e('0x3b')]=db[_0x414e('0x1')][_0x414e('0x14')](_0x414e('0x3c'));db[_0x414e('0x3d')]=db['sequelize'][_0x414e('0x14')](_0x414e('0x3e'));db[_0x414e('0x3f')]=db['sequelize'][_0x414e('0x14')]('../api/mailAccount/mailAccount.model');db[_0x414e('0x40')]=db[_0x414e('0x1')]['import'](_0x414e('0x41'));db[_0x414e('0x42')]=db[_0x414e('0x1')]['import'](_0x414e('0x43'));db['MailInteraction']=db[_0x414e('0x1')]['import'](_0x414e('0x44'));db[_0x414e('0x45')]=db['sequelize']['import']('../api/mailMessage/mailMessage.model');db[_0x414e('0x46')]=db[_0x414e('0x1')][_0x414e('0x14')](_0x414e('0x47'));db[_0x414e('0x48')]=db[_0x414e('0x1')][_0x414e('0x14')](_0x414e('0x49'));db[_0x414e('0x4a')]=db[_0x414e('0x1')][_0x414e('0x14')](_0x414e('0x4b'));db[_0x414e('0x4c')]=db['sequelize']['import'](_0x414e('0x4d'));db[_0x414e('0x4e')]=db[_0x414e('0x1')]['import'](_0x414e('0x4f'));db[_0x414e('0x50')]=db[_0x414e('0x1')]['import'](_0x414e('0x51'));db[_0x414e('0x52')]=db[_0x414e('0x1')]['import']('../api/faxInteraction/faxInteraction.model');db['FaxMessage']=db[_0x414e('0x1')][_0x414e('0x14')](_0x414e('0x53'));db[_0x414e('0x54')]=db[_0x414e('0x1')][_0x414e('0x14')](_0x414e('0x55'));db[_0x414e('0x56')]=db[_0x414e('0x1')][_0x414e('0x14')](_0x414e('0x57'));db[_0x414e('0x58')]=db['sequelize'][_0x414e('0x14')](_0x414e('0x59'));db[_0x414e('0x5a')]=db['sequelize'][_0x414e('0x14')](_0x414e('0x5b'));db[_0x414e('0x5c')]=db[_0x414e('0x1')]['import'](_0x414e('0x5d'));db[_0x414e('0x5e')]=db[_0x414e('0x1')]['import'](_0x414e('0x5f'));db['SmsQueue']=db[_0x414e('0x1')][_0x414e('0x14')](_0x414e('0x60'));db[_0x414e('0x61')]=db['sequelize']['import'](_0x414e('0x62'));db[_0x414e('0x63')]=db[_0x414e('0x1')]['import'](_0x414e('0x64'));db[_0x414e('0x65')]=db[_0x414e('0x1')]['import'](_0x414e('0x66'));db[_0x414e('0x67')]=db[_0x414e('0x1')]['import'](_0x414e('0x68'));db[_0x414e('0x69')]=db[_0x414e('0x1')][_0x414e('0x14')](_0x414e('0x6a'));db['ChatWebsite']=db['sequelize'][_0x414e('0x14')](_0x414e('0x6b'));db[_0x414e('0x6c')]=db[_0x414e('0x1')][_0x414e('0x14')](_0x414e('0x6d'));db[_0x414e('0x6e')]=db[_0x414e('0x1')][_0x414e('0x14')]('../api/chatApplication/chatApplication.model');db['ChatInteraction']=db[_0x414e('0x1')][_0x414e('0x14')]('../api/chatInteraction/chatInteraction.model');db[_0x414e('0x6f')]=db[_0x414e('0x1')][_0x414e('0x14')](_0x414e('0x70'));db[_0x414e('0x71')]=db[_0x414e('0x1')][_0x414e('0x14')](_0x414e('0x72'));db[_0x414e('0x73')]=db['sequelize'][_0x414e('0x14')]('../api/chatQueue/chatQueue.model');db['ChatGroup']=db[_0x414e('0x1')][_0x414e('0x14')]('../api/chatGroup/chatGroup.model');db[_0x414e('0x74')]=db[_0x414e('0x1')][_0x414e('0x14')](_0x414e('0x75'));db['CmCompany']=db['sequelize'][_0x414e('0x14')]('../api/cmCompany/cmCompany.model');db['CmContact']=db[_0x414e('0x1')]['import'](_0x414e('0x76'));db[_0x414e('0x77')]=db[_0x414e('0x1')][_0x414e('0x14')]('../api/cmHopper/cmHopper.model');db[_0x414e('0x78')]=db[_0x414e('0x1')][_0x414e('0x14')](_0x414e('0x79'));db[_0x414e('0x7a')]=db[_0x414e('0x1')]['import'](_0x414e('0x7b'));db[_0x414e('0x7c')]=db['sequelize'][_0x414e('0x14')](_0x414e('0x7d'));db[_0x414e('0x7e')]=db['sequelize'][_0x414e('0x14')](_0x414e('0x7f'));db['CmCustomField']=db[_0x414e('0x1')][_0x414e('0x14')](_0x414e('0x80'));db[_0x414e('0x81')]=db[_0x414e('0x1')][_0x414e('0x14')](_0x414e('0x82'));db[_0x414e('0x83')]=db[_0x414e('0x1')]['import'](_0x414e('0x84'));db[_0x414e('0x85')]=db['sequelize']['import']('../api/cannedAnswer/cannedAnswer.model');db[_0x414e('0x86')]=db[_0x414e('0x1')][_0x414e('0x14')](_0x414e('0x87'));db['Condition']=db[_0x414e('0x1')]['import'](_0x414e('0x88'));db['Interval']=db[_0x414e('0x1')][_0x414e('0x14')](_0x414e('0x89'));db[_0x414e('0x8a')]=db['sequelize'][_0x414e('0x14')](_0x414e('0x8b'));db[_0x414e('0x8c')]=db[_0x414e('0x1')][_0x414e('0x14')](_0x414e('0x8d'));db['VoiceQueuesLog']=db[_0x414e('0x1')]['import'](_0x414e('0x8e'));db[_0x414e('0x8f')]=db[_0x414e('0x1')][_0x414e('0x14')](_0x414e('0x90'));db[_0x414e('0x91')]=db[_0x414e('0x1')][_0x414e('0x14')]('../api/sound/sound.model');db[_0x414e('0x92')]=db[_0x414e('0x1')][_0x414e('0x14')](_0x414e('0x93'));db[_0x414e('0x94')]=db[_0x414e('0x1')]['import'](_0x414e('0x95'));db['Trigger']=db[_0x414e('0x1')]['import'](_0x414e('0x96'));db[_0x414e('0x97')]=db['sequelize'][_0x414e('0x14')](_0x414e('0x98'));db[_0x414e('0x99')]=db['sequelize'][_0x414e('0x14')]('../api/integration/integration.model');db[_0x414e('0x9a')]=db['sequelize'][_0x414e('0x14')](_0x414e('0x9b'));db[_0x414e('0x9c')]=db[_0x414e('0x1')][_0x414e('0x14')](_0x414e('0x9d'));db[_0x414e('0x9e')]=db[_0x414e('0x1')][_0x414e('0x14')]('../api/analyticDefaultReport/analyticDefaultReport.model');db[_0x414e('0x9f')]=db[_0x414e('0x1')][_0x414e('0x14')]('../api/analyticExtractedReport/analyticExtractedReport.model');db[_0x414e('0xa0')]=db['sequelize']['import'](_0x414e('0xa1'));db['AnalyticFieldReport']=db['sequelize'][_0x414e('0x14')](_0x414e('0xa2'));db[_0x414e('0xa3')]=db[_0x414e('0x1')][_0x414e('0x14')](_0x414e('0xa4'));db[_0x414e('0xa5')]=db['sequelize']['import'](_0x414e('0xa6'));db[_0x414e('0xa7')]=db[_0x414e('0x1')][_0x414e('0x14')]('../api/intSalesforceConfiguration/intSalesforceConfiguration.model');db[_0x414e('0xa8')]=db[_0x414e('0x1')]['import']('../api/intSalesforceField/intSalesforceField.model');db[_0x414e('0xa9')]=db[_0x414e('0x1')][_0x414e('0x14')]('../api/intSugarcrmAccount/intSugarcrmAccount.model');db[_0x414e('0xaa')]=db[_0x414e('0x1')][_0x414e('0x14')](_0x414e('0xab'));db[_0x414e('0xac')]=db[_0x414e('0x1')]['import'](_0x414e('0xad'));db[_0x414e('0xae')]=db[_0x414e('0x1')][_0x414e('0x14')](_0x414e('0xaf'));db[_0x414e('0xb0')]=db[_0x414e('0x1')][_0x414e('0x14')](_0x414e('0xb1'));db[_0x414e('0xb2')]=db[_0x414e('0x1')][_0x414e('0x14')](_0x414e('0xb3'));db[_0x414e('0xb4')]=db['sequelize']['import'](_0x414e('0xb5'));db[_0x414e('0xb6')]=db[_0x414e('0x1')][_0x414e('0x14')](_0x414e('0xb7'));db[_0x414e('0xb8')]=db['sequelize'][_0x414e('0x14')](_0x414e('0xb9'));db[_0x414e('0xba')]=db[_0x414e('0x1')][_0x414e('0x14')](_0x414e('0xbb'));db[_0x414e('0xbc')]=db[_0x414e('0x1')]['import'](_0x414e('0xbd'));db['ZendeskField']=db[_0x414e('0x1')][_0x414e('0x14')](_0x414e('0xbe'));db['FreshdeskAccount']=db[_0x414e('0x1')][_0x414e('0x14')](_0x414e('0xbf'));db[_0x414e('0xc0')]=db['sequelize'][_0x414e('0x14')]('../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model');db[_0x414e('0xc1')]=db['sequelize'][_0x414e('0x14')](_0x414e('0xc2'));db[_0x414e('0xc3')]=db['sequelize'][_0x414e('0x14')](_0x414e('0xc4'));db[_0x414e('0xc5')]=db['sequelize'][_0x414e('0x14')](_0x414e('0xc6'));db[_0x414e('0xc7')]=db[_0x414e('0x1')][_0x414e('0x14')](_0x414e('0xc8'));db[_0x414e('0xc9')]=db[_0x414e('0x1')]['import'](_0x414e('0xca'));db['ServicenowConfiguration']=db[_0x414e('0x1')][_0x414e('0x14')]('../api/intServicenowConfiguration/intServicenowConfiguration.model');db[_0x414e('0xcb')]=db[_0x414e('0x1')][_0x414e('0x14')](_0x414e('0xcc'));db[_0x414e('0xcd')]=db['sequelize'][_0x414e('0x14')](_0x414e('0xce'));db['Dynamics365Configuration']=db[_0x414e('0x1')]['import'](_0x414e('0xcf'));db[_0x414e('0xd0')]=db[_0x414e('0x1')][_0x414e('0x14')](_0x414e('0xd1'));db[_0x414e('0xd2')]=db['sequelize'][_0x414e('0x14')]('../api/intFreshsalesAccount/intFreshsalesAccount.model');db[_0x414e('0xd3')]=db[_0x414e('0x1')][_0x414e('0x14')](_0x414e('0xd4'));db['FreshsalesField']=db[_0x414e('0x1')]['import'](_0x414e('0xd5'));db[_0x414e('0x99')]=db[_0x414e('0x1')][_0x414e('0x14')](_0x414e('0xd6'));db[_0x414e('0xd7')]=db[_0x414e('0x1')][_0x414e('0x14')](_0x414e('0xd8'));db[_0x414e('0xd9')]=db[_0x414e('0x1')][_0x414e('0x14')]('../api/chatQueueReport/chatQueueReport.model');db['ChatInternalMessage']=db[_0x414e('0x1')]['import'](_0x414e('0xda'));db[_0x414e('0xdb')]=db['sequelize'][_0x414e('0x14')](_0x414e('0xdc'));db[_0x414e('0xdd')]=db[_0x414e('0x1')][_0x414e('0x14')](_0x414e('0xde'));db[_0x414e('0xdf')]=db[_0x414e('0x1')][_0x414e('0x14')](_0x414e('0xe0'));db[_0x414e('0xe1')]=db['sequelize']['import'](_0x414e('0xe2'));db[_0x414e('0xe3')]=db[_0x414e('0x1')][_0x414e('0x14')](_0x414e('0xe4'));db[_0x414e('0xe5')]=db[_0x414e('0x1')][_0x414e('0x14')]('../api/squareReportDetail/squareReportDetail.model');db['JscriptyProject']=db['sequelize'][_0x414e('0x14')](_0x414e('0xe6'));db[_0x414e('0xe7')]=db[_0x414e('0x1')][_0x414e('0x14')](_0x414e('0xe8'));db[_0x414e('0xe9')]=db[_0x414e('0x1')][_0x414e('0x14')]('../api/squareOdbc/squareOdbc.model');db[_0x414e('0xea')]=db[_0x414e('0x1')][_0x414e('0x14')](_0x414e('0xeb'));db[_0x414e('0xec')]=db['sequelize']['import'](_0x414e('0xed'));db[_0x414e('0xee')]=db['sequelize'][_0x414e('0x14')](_0x414e('0xef'));db[_0x414e('0xf0')]=db[_0x414e('0x1')][_0x414e('0x14')]('../api/team/team.model');db[_0x414e('0xf1')]=db['sequelize']['import'](_0x414e('0xf2'));db[_0x414e('0xf3')]=db['sequelize'][_0x414e('0x14')](_0x414e('0xf4'));db[_0x414e('0xf5')]=db['sequelize']['import']('../api/migration/migration.model');db[_0x414e('0xf6')]=db[_0x414e('0x1')][_0x414e('0x14')](_0x414e('0xf7'));db[_0x414e('0xf8')]=db[_0x414e('0x1')]['import'](_0x414e('0xf9'));db['MailTransferReport']=db['sequelize'][_0x414e('0x14')]('../api/mailTransferReport/mailTransferReport.model');db['ChatTransferReport']=db['sequelize'][_0x414e('0x14')]('../api/chatTransferReport/chatTransferReport.model');db['FaxTransferReport']=db['sequelize'][_0x414e('0x14')](_0x414e('0xfa'));db[_0x414e('0xfb')]=db[_0x414e('0x1')][_0x414e('0x14')](_0x414e('0xfc'));db[_0x414e('0xfd')]=db[_0x414e('0x1')][_0x414e('0x14')]('../api/smsTransferReport/smsTransferReport.model');db['CmList']=db[_0x414e('0x1')][_0x414e('0x14')](_0x414e('0xfe'));db[_0x414e('0xff')]=db['sequelize']['import'](_0x414e('0x100'));db['UserProfile']=db[_0x414e('0x1')]['import'](_0x414e('0x101'));db[_0x414e('0x102')]=db['sequelize'][_0x414e('0x14')](_0x414e('0x103'));db[_0x414e('0x104')]=db['sequelize'][_0x414e('0x14')]('../api/userProfileResource/userProfileResource.model');db['UserNotification']=db['sequelize'][_0x414e('0x14')](_0x414e('0x105'));db['WhatsappAccount']=db[_0x414e('0x1')][_0x414e('0x14')](_0x414e('0x106'));db[_0x414e('0x107')]=db[_0x414e('0x1')][_0x414e('0x14')](_0x414e('0x108'));db['WhatsappInteraction']=db[_0x414e('0x1')][_0x414e('0x14')](_0x414e('0x109'));db[_0x414e('0x10a')]=db['sequelize']['import'](_0x414e('0x10b'));db[_0x414e('0x10c')]=db[_0x414e('0x1')][_0x414e('0x14')](_0x414e('0x10d'));db[_0x414e('0x10e')]=db[_0x414e('0x1')][_0x414e('0x14')](_0x414e('0x10f'));db[_0x414e('0x110')]=db[_0x414e('0x1')][_0x414e('0x14')](_0x414e('0x111'));db[_0x414e('0x112')]=db['sequelize'][_0x414e('0x14')](_0x414e('0x113'));db[_0x414e('0x114')]=db['sequelize'][_0x414e('0x14')](_0x414e('0x115'));db[_0x414e('0x116')]=db[_0x414e('0x1')][_0x414e('0x14')](_0x414e('0x117'));db[_0x414e('0x118')]=db[_0x414e('0x1')][_0x414e('0x14')](_0x414e('0x119'));db['UserSetting']=db['sequelize'][_0x414e('0x14')](_0x414e('0x11a'));db[_0x414e('0x11b')][_0x414e('0x11c')](db[_0x414e('0x20')],{'as':_0x414e('0x20'),'onDelete':_0x414e('0x11d'),'foreignKey':_0x414e('0x11e')});db[_0x414e('0x11b')][_0x414e('0x11c')](db['UserSetting'],{'as':'userSetting','onDelete':_0x414e('0x11d'),'foreignKey':_0x414e('0x11e')});db[_0x414e('0x11b')][_0x414e('0x11f')](db[_0x414e('0x1c')],{'as':'Recordings','foreignKey':_0x414e('0x11e')});db['User'][_0x414e('0x11f')](db['UserVoiceQueueRt'],{'as':'VoiceQueuesRt','foreignKey':'UserId'});db[_0x414e('0x11b')][_0x414e('0x11f')](db[_0x414e('0x120')],{'as':_0x414e('0x121'),'onDelete':'cascade','hooks':!![]});db['User'][_0x414e('0x11f')](db['CmHopperFinal'],{'as':'HopperFinals','foreignKey':_0x414e('0x11e')});db['User']['hasMany'](db[_0x414e('0x7c')],{'as':_0x414e('0x122'),'foreignKey':_0x414e('0x11e')});db[_0x414e('0x11b')][_0x414e('0x11f')](db[_0x414e('0x7e')],{'as':_0x414e('0x7e'),'foreignKey':_0x414e('0x11e')});db[_0x414e('0x11b')]['hasMany'](db[_0x414e('0x65')],{'as':_0x414e('0x123'),'foreignKey':_0x414e('0x11e')});db[_0x414e('0x11b')][_0x414e('0x11f')](db['ChatInteraction'],{'as':_0x414e('0x124'),'foreignKey':_0x414e('0x11e')});db[_0x414e('0x11b')][_0x414e('0x11f')](db[_0x414e('0x5c')],{'as':_0x414e('0x125'),'foreignKey':_0x414e('0x11e')});db[_0x414e('0x11b')]['hasMany'](db['FaxInteraction'],{'as':_0x414e('0x126'),'foreignKey':_0x414e('0x11e')});db[_0x414e('0x11b')][_0x414e('0x11f')](db[_0x414e('0x127')],{'as':_0x414e('0x128'),'foreignKey':_0x414e('0x11e')});db[_0x414e('0x11b')][_0x414e('0x11f')](db['WhatsappInteraction'],{'as':_0x414e('0x129'),'foreignKey':_0x414e('0x11e')});db[_0x414e('0x11b')][_0x414e('0x11f')](db[_0x414e('0x12a')],{'as':_0x414e('0x12b'),'foreignKey':_0x414e('0x12c')});db[_0x414e('0x11b')][_0x414e('0x12d')](db[_0x414e('0x12e')],{'as':_0x414e('0x12e'),'foreignKey':_0x414e('0x12f')});db[_0x414e('0x11b')][_0x414e('0x130')](db['ChatGroup'],{'as':'Groups','through':'chat_group_has_users'});db[_0x414e('0x11b')][_0x414e('0x130')](db[_0x414e('0x131')],{'as':_0x414e('0x132'),'through':'cm_user_has_contacts'});db[_0x414e('0x11b')]['belongsToMany'](db['CmList'],{'as':_0x414e('0x133'),'through':_0x414e('0x134')});db[_0x414e('0x11b')][_0x414e('0x130')](db[_0x414e('0xf0')],{'through':_0x414e('0x135')});db[_0x414e('0x11b')][_0x414e('0x130')](db[_0x414e('0x127')],{'as':'MailInteractions','through':_0x414e('0x136')});db[_0x414e('0x11b')][_0x414e('0x130')](db['ChatInteraction'],{'as':_0x414e('0x124'),'through':_0x414e('0x137')});db[_0x414e('0x11b')]['belongsToMany'](db[_0x414e('0x52')],{'as':_0x414e('0x126'),'through':_0x414e('0x138')});db['User']['belongsToMany'](db[_0x414e('0x5c')],{'as':_0x414e('0x125'),'through':'user_has_sms_interactions'});db[_0x414e('0x11b')]['belongsToMany'](db[_0x414e('0x65')],{'as':_0x414e('0x123'),'through':_0x414e('0x139')});db[_0x414e('0x11b')]['belongsToMany'](db['WhatsappInteraction'],{'as':'WhatsappInteractions','through':_0x414e('0x13a')});db[_0x414e('0x11b')][_0x414e('0x130')](db[_0x414e('0x1a')],{'as':_0x414e('0x13b'),'through':_0x414e('0x13c'),'required':![]});db[_0x414e('0x11b')][_0x414e('0x130')](db['VoicePrefix'],{'as':_0x414e('0x13d'),'through':_0x414e('0x118'),'required':![]});db[_0x414e('0x11b')][_0x414e('0x130')](db[_0x414e('0x40')],{'as':_0x414e('0x13e'),'through':_0x414e('0x33'),'required':![]});db[_0x414e('0x11b')][_0x414e('0x130')](db['ChatQueue'],{'as':_0x414e('0x13f'),'through':_0x414e('0x140'),'required':![],'hooks':!![]});db['User'][_0x414e('0x130')](db[_0x414e('0x54')],{'as':_0x414e('0x141'),'through':_0x414e('0x35'),'required':![]});db[_0x414e('0x11b')][_0x414e('0x130')](db[_0x414e('0x142')],{'as':_0x414e('0x143'),'through':_0x414e('0x144'),'required':![]});db['User']['belongsToMany'](db[_0x414e('0x69')],{'as':_0x414e('0x145'),'through':'UserOpenchannelQueue','required':![]});db[_0x414e('0x11b')]['belongsToMany'](db[_0x414e('0x110')],{'as':_0x414e('0x146'),'through':'UserWhatsappQueue','required':![]});db[_0x414e('0x11b')][_0x414e('0x130')](db[_0x414e('0x147')],{'through':'cm_user_has_lists'});db[_0x414e('0x11b')]['belongsToMany'](db[_0x414e('0x148')],{'as':_0x414e('0x149'),'through':_0x414e('0x14a')});db[_0x414e('0x11b')]['belongsToMany'](db['FaxAccount'],{'as':'FaxAccounts','through':_0x414e('0x14b')});db[_0x414e('0x11b')][_0x414e('0x130')](db['MailAccount'],{'as':_0x414e('0x14c'),'through':_0x414e('0x14d')});db['User'][_0x414e('0x130')](db['OpenchannelAccount'],{'as':_0x414e('0x14e'),'through':'user_has_openchannel_accounts'});db['User'][_0x414e('0x130')](db[_0x414e('0x58')],{'as':_0x414e('0x14f'),'through':_0x414e('0x150')});db[_0x414e('0x11b')][_0x414e('0x130')](db[_0x414e('0x151')],{'as':_0x414e('0x152'),'through':_0x414e('0x153')});db[_0x414e('0x11b')][_0x414e('0x130')](db[_0x414e('0xea')],{'as':_0x414e('0x154'),'through':_0x414e('0x155')});db[_0x414e('0x15')]['hasMany'](db[_0x414e('0x120')],{'as':_0x414e('0x156'),'onDelete':'cascade','foreignKey':_0x414e('0x157')});db[_0x414e('0x16')][_0x414e('0x11f')](db[_0x414e('0x120')],{'onDelete':'cascade'});db[_0x414e('0x120')]['hasMany'](db[_0x414e('0x120')],{'as':_0x414e('0x158'),'onDelete':_0x414e('0x11d')});db[_0x414e('0x18')][_0x414e('0x130')](db[_0x414e('0x91')],{'as':_0x414e('0x159'),'through':'moh_has_sounds'});db[_0x414e('0x1a')][_0x414e('0x11f')](db[_0x414e('0x15a')],{'as':'Members','foreignKey':_0x414e('0x15b')});db[_0x414e('0x1a')][_0x414e('0x11f')](db['CmHopper'],{'as':'Hoppers','foreignKey':'VoiceQueueId'});db['VoiceQueue']['hasMany'](db[_0x414e('0x7a')],{'as':_0x414e('0x15c'),'foreignKey':_0x414e('0x15b')});db['VoiceQueue'][_0x414e('0x11f')](db['CmHopperHistory'],{'as':_0x414e('0x15d'),'foreignKey':_0x414e('0x15b')});db[_0x414e('0x1a')][_0x414e('0x11f')](db[_0x414e('0x7e')],{'as':_0x414e('0x7e'),'foreignKey':_0x414e('0x15b')});db['VoiceQueue']['hasMany'](db['CmHopperBlack'],{'as':_0x414e('0x15e'),'foreignKey':_0x414e('0x15b')});db[_0x414e('0x1a')]['hasMany'](db[_0x414e('0xdf')],{'as':_0x414e('0x15f'),'foreignKey':_0x414e('0x15b')});db[_0x414e('0x1a')][_0x414e('0x12d')](db[_0x414e('0x2d')],{'as':_0x414e('0x2d'),'foreignKey':'TrunkId'});db[_0x414e('0x1a')][_0x414e('0x12d')](db[_0x414e('0x2d')],{'as':_0x414e('0x160'),'foreignKey':'TrunkBackupId'});db[_0x414e('0x1a')][_0x414e('0x12d')](db[_0x414e('0x161')],{'as':_0x414e('0x161'),'foreignKey':'IntervalId'});db[_0x414e('0x1a')][_0x414e('0x12d')](db[_0x414e('0x8a')],{'as':_0x414e('0x162'),'foreignKey':'mandatoryDispositionPauseId'});db[_0x414e('0x1a')][_0x414e('0x130')](db[_0x414e('0x147')],{'as':_0x414e('0x133'),'through':'voice_queues_has_cm_lists'});db['VoiceQueue'][_0x414e('0x130')](db[_0x414e('0x11b')],{'as':_0x414e('0x163'),'through':_0x414e('0x13c')});db[_0x414e('0x1a')]['belongsToMany'](db[_0x414e('0xf0')],{'as':_0x414e('0x164'),'through':_0x414e('0x114')});db[_0x414e('0x1a')][_0x414e('0x130')](db['CmList'],{'as':_0x414e('0x165'),'through':'voice_queues_has_cm_blacklists'});db[_0x414e('0x1c')][_0x414e('0x12d')](db[_0x414e('0x11b')],{'as':'User','foreignKey':_0x414e('0x11e')});db[_0x414e('0x1e')][_0x414e('0x12d')](db['User'],{'as':'User','foreignKey':_0x414e('0x11e')});db[_0x414e('0x20')][_0x414e('0x11f')](db[_0x414e('0x22')],{'as':'Messages','onDelete':_0x414e('0x11d'),'foreignKey':_0x414e('0x166'),'sourceKey':_0x414e('0x167')});db[_0x414e('0x22')][_0x414e('0x12d')](db[_0x414e('0x20')],{'foreignKey':_0x414e('0x166'),'targetKey':_0x414e('0x167')});db[_0x414e('0x24')]['hasMany'](db[_0x414e('0x29')],{'as':_0x414e('0x168'),'foreignKey':_0x414e('0x169'),'constraints':![]});db['VoiceCallReport'][_0x414e('0x11f')](db[_0x414e('0x28')],{'as':_0x414e('0x16a'),'foreignKey':_0x414e('0x169'),'constraints':![]});db[_0x414e('0x24')][_0x414e('0x12d')](db['User'],{'as':_0x414e('0x11b'),'foreignKey':_0x414e('0x11e')});db['VoiceCallReport'][_0x414e('0x12d')](db['CmContact'],{'as':_0x414e('0x16b'),'foreignKey':'ContactId'});db['MailServerIn'][_0x414e('0x12d')](db['MailAccount'],{'as':'MailAccount','foreignKey':'MailAccountId'});db[_0x414e('0x3b')][_0x414e('0x12d')](db[_0x414e('0x112')],{'as':'CloudProvider','foreignKey':_0x414e('0x16c'),'onDelete':'restrict'});db[_0x414e('0x3d')]['belongsTo'](db[_0x414e('0x3f')],{'as':_0x414e('0x3f'),'foreignKey':_0x414e('0x16d')});db[_0x414e('0x3d')][_0x414e('0x12d')](db[_0x414e('0x112')],{'as':_0x414e('0x112'),'foreignKey':_0x414e('0x16c'),'onDelete':_0x414e('0x16e')});db[_0x414e('0x3f')]['hasOne'](db[_0x414e('0x3b')],{'as':_0x414e('0x16f'),'onDelete':_0x414e('0x11d')});db[_0x414e('0x3f')][_0x414e('0x11c')](db[_0x414e('0x3d')],{'as':'Smtp','onDelete':_0x414e('0x11d')});db[_0x414e('0x3f')]['hasMany'](db['Disposition'],{'as':'Dispositions','foreignKey':_0x414e('0x16d'),'onDelete':_0x414e('0x11d')});db['MailAccount'][_0x414e('0x11f')](db[_0x414e('0x85')],{'as':'Answers','foreignKey':_0x414e('0x16d')});db['MailAccount'][_0x414e('0x11f')](db[_0x414e('0x45')],{'as':'Messages','foreignKey':'MailAccountId'});db[_0x414e('0x3f')][_0x414e('0x11f')](db[_0x414e('0x127')],{'as':_0x414e('0x170')});db[_0x414e('0x3f')][_0x414e('0x11f')](db[_0x414e('0x46')],{'as':_0x414e('0x158')});db['MailAccount'][_0x414e('0x12d')](db[_0x414e('0x147')],{'as':'List','foreignKey':_0x414e('0x171')});db['MailAccount'][_0x414e('0x12d')](db[_0x414e('0x94')],{'as':_0x414e('0x94'),'foreignKey':_0x414e('0x172')});db[_0x414e('0x3f')][_0x414e('0x12d')](db[_0x414e('0x8a')],{'as':_0x414e('0x162'),'foreignKey':'mandatoryDispositionPauseId'});db[_0x414e('0x3f')][_0x414e('0x130')](db['User'],{'as':_0x414e('0x163'),'through':_0x414e('0x14d')});db['MailQueue'][_0x414e('0x130')](db['User'],{'as':_0x414e('0x163'),'through':_0x414e('0x33')});db[_0x414e('0x40')]['belongsToMany'](db[_0x414e('0xf0')],{'through':_0x414e('0x173'),'as':'Teams'});db[_0x414e('0x127')][_0x414e('0x11f')](db['MailMessage'],{'as':_0x414e('0x174'),'onDelete':_0x414e('0x11d'),'foreignKey':_0x414e('0x175')});db[_0x414e('0x127')]['belongsTo'](db['MailAccount'],{'as':_0x414e('0x176'),'foreignKey':'MailAccountId'});db[_0x414e('0x127')][_0x414e('0x12d')](db[_0x414e('0x131')],{'as':_0x414e('0x16b'),'foreignKey':_0x414e('0x177')});db['MailInteraction'][_0x414e('0x12d')](db[_0x414e('0x11b')],{'as':_0x414e('0x178'),'foreignKey':_0x414e('0x11e')});db[_0x414e('0x127')][_0x414e('0x130')](db[_0x414e('0x92')],{'through':_0x414e('0x179'),'as':_0x414e('0x17a')});db[_0x414e('0x127')]['belongsToMany'](db[_0x414e('0x92')],{'through':_0x414e('0x179'),'as':_0x414e('0x17b')});db[_0x414e('0x127')][_0x414e('0x130')](db[_0x414e('0x11b')],{'as':_0x414e('0x17c'),'through':_0x414e('0x136'),'foreignKey':_0x414e('0x175')});db[_0x414e('0x45')][_0x414e('0x11f')](db[_0x414e('0xf6')],{'as':_0x414e('0x17d'),'onDelete':'cascade'});db[_0x414e('0x45')][_0x414e('0x12d')](db['User'],{'as':_0x414e('0x11b')});db[_0x414e('0x45')][_0x414e('0x12d')](db[_0x414e('0x131')],{'onDelete':_0x414e('0x11d'),'as':'Contact'});db[_0x414e('0x45')][_0x414e('0x12d')](db[_0x414e('0x127')],{'as':'Interaction','foreignKey':_0x414e('0x175')});db[_0x414e('0x45')][_0x414e('0x12d')](db[_0x414e('0x3f')],{'as':_0x414e('0x176'),'foreignKey':_0x414e('0x16d')});db['MailMessage']['belongsTo'](db[_0x414e('0x148')],{'as':_0x414e('0x148'),'foreignKey':_0x414e('0x17e')});db[_0x414e('0x45')]['belongsTo'](db['ChatOfflineMessage'],{'as':'ChatOfflineMessage','foreignKey':_0x414e('0x17f')});db[_0x414e('0x46')][_0x414e('0x12d')](db[_0x414e('0x11b')],{'onDelete':_0x414e('0x16e')});db[_0x414e('0x46')]['belongsTo'](db[_0x414e('0x40')],{'onDelete':_0x414e('0x16e')});db[_0x414e('0x46')][_0x414e('0x12d')](db[_0x414e('0x3f')],{'onDelete':_0x414e('0x16e')});db[_0x414e('0x46')]['belongsTo'](db[_0x414e('0x161')],{'onDelete':'restrict','foreignKey':_0x414e('0x180')});db[_0x414e('0x46')][_0x414e('0x12d')](db[_0x414e('0x92')],{'onDelete':'restrict','foreignKey':'TagId'});db[_0x414e('0x48')]['belongsTo'](db[_0x414e('0x3f')],{});db[_0x414e('0x48')]['belongsTo'](db[_0x414e('0x147')],{'as':_0x414e('0x181'),'foreignKey':'ListId'});db[_0x414e('0x48')]['belongsTo'](db[_0x414e('0x131')],{'as':_0x414e('0x16b'),'foreignKey':_0x414e('0x177')});db['MailQueueReport'][_0x414e('0x12d')](db[_0x414e('0x127')],{});db[_0x414e('0x48')]['belongsTo'](db[_0x414e('0x45')],{});db[_0x414e('0x48')][_0x414e('0x12d')](db[_0x414e('0x11b')],{});db['MailQueueReport'][_0x414e('0x12d')](db[_0x414e('0x40')],{});db[_0x414e('0x4a')][_0x414e('0x11f')](db[_0x414e('0x4c')],{'as':_0x414e('0x182'),'onDelete':'cascade'});db[_0x414e('0x4e')]['hasMany'](db[_0x414e('0x86')],{'as':_0x414e('0x183'),'foreignKey':'FaxAccountId','onDelete':_0x414e('0x11d')});db['FaxAccount'][_0x414e('0x11f')](db[_0x414e('0x85')],{'as':'Answers','foreignKey':_0x414e('0x184')});db[_0x414e('0x4e')][_0x414e('0x11f')](db[_0x414e('0x52')],{'as':_0x414e('0x170')});db[_0x414e('0x4e')][_0x414e('0x11f')](db[_0x414e('0x50')],{'as':_0x414e('0x158')});db[_0x414e('0x4e')][_0x414e('0x11f')](db[_0x414e('0x120')],{'as':_0x414e('0x185'),'onDelete':'cascade'});db[_0x414e('0x4e')][_0x414e('0x11f')](db[_0x414e('0x186')],{'as':'Messages'});db[_0x414e('0x4e')][_0x414e('0x12d')](db[_0x414e('0x2d')],{'as':_0x414e('0x2d')});db['FaxAccount'][_0x414e('0x12d')](db[_0x414e('0x147')],{'as':_0x414e('0x181'),'foreignKey':'ListId'});db[_0x414e('0x4e')][_0x414e('0x12d')](db[_0x414e('0x8a')],{'as':_0x414e('0x162'),'foreignKey':_0x414e('0x187')});db[_0x414e('0x4e')]['belongsToMany'](db[_0x414e('0x11b')],{'as':_0x414e('0x163'),'through':_0x414e('0x14b')});db['FaxApplication']['belongsTo'](db['User'],{'onDelete':'restrict'});db[_0x414e('0x50')][_0x414e('0x12d')](db[_0x414e('0x54')],{'onDelete':_0x414e('0x16e')});db[_0x414e('0x50')][_0x414e('0x12d')](db[_0x414e('0x4e')],{'onDelete':_0x414e('0x16e')});db[_0x414e('0x50')]['belongsTo'](db[_0x414e('0x92')],{'onDelete':'restrict','foreignKey':_0x414e('0x188')});db['FaxInteraction']['hasMany'](db[_0x414e('0x186')],{'as':_0x414e('0x174'),'onDelete':_0x414e('0x11d'),'foreignKey':'FaxInteractionId'});db[_0x414e('0x52')][_0x414e('0x12d')](db[_0x414e('0x4e')],{'as':'Account','foreignKey':_0x414e('0x184')});db[_0x414e('0x52')][_0x414e('0x12d')](db[_0x414e('0x131')],{'as':_0x414e('0x16b'),'foreignKey':_0x414e('0x177')});db[_0x414e('0x52')][_0x414e('0x12d')](db[_0x414e('0x11b')],{'as':_0x414e('0x178'),'foreignKey':_0x414e('0x11e')});db['FaxInteraction'][_0x414e('0x130')](db[_0x414e('0x92')],{'through':_0x414e('0x189'),'as':_0x414e('0x17a')});db['FaxInteraction'][_0x414e('0x130')](db[_0x414e('0x92')],{'through':_0x414e('0x189'),'as':'ThroughTags'});db[_0x414e('0x52')][_0x414e('0x130')](db[_0x414e('0x11b')],{'as':_0x414e('0x17c'),'through':_0x414e('0x138'),'foreignKey':_0x414e('0x18a')});db[_0x414e('0x186')]['belongsTo'](db[_0x414e('0x11b')],{'onDelete':_0x414e('0x11d'),'as':_0x414e('0x11b')});db[_0x414e('0x186')][_0x414e('0x12d')](db[_0x414e('0x52')],{'as':_0x414e('0x18b'),'foreignKey':_0x414e('0x18a')});db[_0x414e('0x186')][_0x414e('0x12d')](db['CmContact'],{'onDelete':_0x414e('0x11d'),'as':_0x414e('0x16b')});db[_0x414e('0x186')][_0x414e('0x12d')](db['Attachment'],{'as':'Attachment','foreignKey':_0x414e('0x18c')});db[_0x414e('0x186')][_0x414e('0x12d')](db['FaxAccount'],{'as':_0x414e('0x176'),'foreignKey':_0x414e('0x184')});db['FaxQueue'][_0x414e('0x130')](db[_0x414e('0x11b')],{'as':_0x414e('0x163'),'through':'UserFaxQueue'});db[_0x414e('0x54')][_0x414e('0x130')](db[_0x414e('0xf0')],{'through':_0x414e('0x18d'),'as':_0x414e('0x164')});db[_0x414e('0x56')][_0x414e('0x12d')](db[_0x414e('0x4e')],{});db[_0x414e('0x56')][_0x414e('0x12d')](db[_0x414e('0x147')],{'as':'List','foreignKey':'ListId'});db[_0x414e('0x56')][_0x414e('0x12d')](db[_0x414e('0x131')],{'as':_0x414e('0x16b'),'foreignKey':_0x414e('0x177')});db[_0x414e('0x56')][_0x414e('0x12d')](db['FaxInteraction'],{});db[_0x414e('0x56')][_0x414e('0x12d')](db['FaxMessage'],{});db[_0x414e('0x56')][_0x414e('0x12d')](db[_0x414e('0x11b')],{});db[_0x414e('0x56')][_0x414e('0x12d')](db[_0x414e('0x54')],{});db[_0x414e('0x58')][_0x414e('0x11f')](db['Disposition'],{'as':_0x414e('0x183'),'foreignKey':'SmsAccountId','onDelete':_0x414e('0x11d')});db['SmsAccount'][_0x414e('0x11f')](db[_0x414e('0x85')],{'as':_0x414e('0x18e'),'foreignKey':_0x414e('0x18f')});db[_0x414e('0x58')]['hasMany'](db[_0x414e('0x5e')],{'as':_0x414e('0x174'),'foreignKey':_0x414e('0x18f')});db[_0x414e('0x58')][_0x414e('0x11f')](db[_0x414e('0x5c')],{'as':_0x414e('0x170')});db[_0x414e('0x58')][_0x414e('0x11f')](db[_0x414e('0x5a')],{'as':_0x414e('0x158')});db[_0x414e('0x58')][_0x414e('0x12d')](db['CmList'],{'as':_0x414e('0x181'),'foreignKey':'ListId'});db['SmsAccount']['belongsTo'](db['Pause'],{'as':_0x414e('0x162'),'foreignKey':'mandatoryDispositionPauseId'});db[_0x414e('0x58')][_0x414e('0x130')](db[_0x414e('0x11b')],{'as':_0x414e('0x163'),'through':_0x414e('0x150')});db[_0x414e('0x5a')][_0x414e('0x12d')](db[_0x414e('0x11b')],{'onDelete':_0x414e('0x16e')});db[_0x414e('0x5a')]['belongsTo'](db[_0x414e('0x142')],{'onDelete':_0x414e('0x16e')});db[_0x414e('0x5a')][_0x414e('0x12d')](db['SmsAccount'],{'onDelete':'restrict'});db[_0x414e('0x5a')]['belongsTo'](db[_0x414e('0x161')],{'onDelete':_0x414e('0x16e'),'foreignKey':_0x414e('0x180')});db['SmsApplication'][_0x414e('0x12d')](db[_0x414e('0x92')],{'onDelete':'restrict','foreignKey':_0x414e('0x188')});db[_0x414e('0x5c')][_0x414e('0x11f')](db['SmsMessage'],{'as':_0x414e('0x174'),'onDelete':_0x414e('0x11d'),'foreignKey':'SmsInteractionId'});db['SmsInteraction'][_0x414e('0x12d')](db[_0x414e('0x58')],{'as':'Account','foreignKey':_0x414e('0x18f')});db[_0x414e('0x5c')][_0x414e('0x12d')](db[_0x414e('0x131')],{'as':_0x414e('0x16b'),'foreignKey':'ContactId'});db['SmsInteraction'][_0x414e('0x12d')](db['User'],{'as':'Owner','foreignKey':_0x414e('0x11e')});db[_0x414e('0x5c')][_0x414e('0x130')](db['Tag'],{'through':_0x414e('0x190'),'as':_0x414e('0x17a')});db[_0x414e('0x5c')]['belongsToMany'](db[_0x414e('0x92')],{'through':_0x414e('0x190'),'as':'ThroughTags'});db[_0x414e('0x5c')][_0x414e('0x130')](db[_0x414e('0x11b')],{'as':_0x414e('0x17c'),'through':_0x414e('0x191'),'foreignKey':_0x414e('0x192')});db['SmsMessage']['belongsTo'](db[_0x414e('0x11b')],{'as':_0x414e('0x11b')});db['SmsMessage'][_0x414e('0x12d')](db[_0x414e('0x131')],{'onDelete':_0x414e('0x11d'),'as':_0x414e('0x16b')});db[_0x414e('0x5e')][_0x414e('0x12d')](db['SmsInteraction'],{'onDelete':_0x414e('0x11d'),'as':_0x414e('0x18b'),'foreignKey':_0x414e('0x192')});db[_0x414e('0x5e')][_0x414e('0x12d')](db['SmsAccount'],{'as':_0x414e('0x176'),'foreignKey':_0x414e('0x18f')});db[_0x414e('0x142')][_0x414e('0x130')](db[_0x414e('0x11b')],{'as':_0x414e('0x163'),'through':'UserSmsQueue','foreignKey':'SmsQueueId'});db[_0x414e('0x142')][_0x414e('0x130')](db['Team'],{'through':_0x414e('0x193'),'as':_0x414e('0x164')});db[_0x414e('0x61')][_0x414e('0x11f')](db['Disposition'],{'as':_0x414e('0x183'),'foreignKey':_0x414e('0x194'),'onDelete':_0x414e('0x11d')});db['OpenchannelAccount'][_0x414e('0x11f')](db['CannedAnswer'],{'as':_0x414e('0x18e'),'foreignKey':_0x414e('0x194')});db[_0x414e('0x61')][_0x414e('0x11f')](db[_0x414e('0x65')],{'as':_0x414e('0x170'),'foreignKey':_0x414e('0x194')});db[_0x414e('0x61')][_0x414e('0x11f')](db[_0x414e('0x67')],{'as':_0x414e('0x174'),'foreignKey':_0x414e('0x194')});db['OpenchannelAccount'][_0x414e('0x11f')](db[_0x414e('0x63')],{'as':'Applications','foreignKey':_0x414e('0x194')});db[_0x414e('0x61')][_0x414e('0x12d')](db['CmList'],{'as':_0x414e('0x181'),'foreignKey':_0x414e('0x171')});db[_0x414e('0x61')][_0x414e('0x12d')](db[_0x414e('0x8a')],{'as':_0x414e('0x162'),'foreignKey':_0x414e('0x187')});db['OpenchannelAccount']['belongsToMany'](db[_0x414e('0x11b')],{'as':_0x414e('0x163'),'through':_0x414e('0x195')});db['OpenchannelApplication']['belongsTo'](db['User'],{'onDelete':_0x414e('0x16e')});db[_0x414e('0x63')][_0x414e('0x12d')](db['OpenchannelQueue'],{'onDelete':'restrict','foreignKey':_0x414e('0x196')});db['OpenchannelApplication'][_0x414e('0x12d')](db['OpenchannelAccount'],{'onDelete':_0x414e('0x16e'),'foreignKey':'OpenchannelAccountId'});db[_0x414e('0x63')][_0x414e('0x12d')](db[_0x414e('0x161')],{'onDelete':'restrict','foreignKey':'IntervalId'});db[_0x414e('0x63')][_0x414e('0x12d')](db[_0x414e('0x92')],{'onDelete':_0x414e('0x16e'),'foreignKey':'TagId'});db[_0x414e('0x65')]['hasMany'](db[_0x414e('0x67')],{'as':_0x414e('0x174'),'onDelete':_0x414e('0x11d'),'foreignKey':_0x414e('0x197')});db['OpenchannelInteraction']['belongsTo'](db['OpenchannelAccount'],{'as':_0x414e('0x176'),'foreignKey':'OpenchannelAccountId'});db[_0x414e('0x65')][_0x414e('0x12d')](db[_0x414e('0x131')],{'as':'Contact','foreignKey':_0x414e('0x177')});db[_0x414e('0x65')][_0x414e('0x12d')](db[_0x414e('0x11b')],{'as':_0x414e('0x178'),'foreignKey':_0x414e('0x11e')});db[_0x414e('0x65')][_0x414e('0x130')](db[_0x414e('0x92')],{'through':_0x414e('0x198'),'as':_0x414e('0x17a')});db[_0x414e('0x65')][_0x414e('0x130')](db['Tag'],{'through':_0x414e('0x198'),'as':_0x414e('0x17b')});db[_0x414e('0x65')][_0x414e('0x130')](db[_0x414e('0x11b')],{'as':_0x414e('0x17c'),'through':'user_has_openchannel_interactions','foreignKey':'OpenchannelInteractionId'});db[_0x414e('0x67')][_0x414e('0x12d')](db[_0x414e('0x11b')],{'onDelete':'cascade','as':'User'});db[_0x414e('0x67')][_0x414e('0x12d')](db[_0x414e('0x131')],{'onDelete':_0x414e('0x11d'),'as':_0x414e('0x16b')});db[_0x414e('0x67')][_0x414e('0x12d')](db[_0x414e('0x65')],{'onDelete':_0x414e('0x11d'),'as':_0x414e('0x18b'),'foreignKey':_0x414e('0x197')});db[_0x414e('0x67')][_0x414e('0x12d')](db['Attachment'],{'as':_0x414e('0xf6'),'foreignKey':'AttachmentId'});db['OpenchannelMessage'][_0x414e('0x12d')](db[_0x414e('0x61')],{'as':_0x414e('0x176'),'foreignKey':_0x414e('0x194')});db[_0x414e('0x69')][_0x414e('0x130')](db[_0x414e('0x11b')],{'as':'Agents','through':_0x414e('0x38'),'foreignKey':_0x414e('0x196')});db[_0x414e('0x69')][_0x414e('0x130')](db[_0x414e('0xf0')],{'through':_0x414e('0x199'),'as':_0x414e('0x164')});db[_0x414e('0x148')][_0x414e('0x11f')](db[_0x414e('0x86')],{'as':'Dispositions','foreignKey':_0x414e('0x17e'),'onDelete':_0x414e('0x11d')});db[_0x414e('0x148')]['hasMany'](db[_0x414e('0x85')],{'as':_0x414e('0x18e'),'foreignKey':'ChatWebsiteId'});db[_0x414e('0x148')][_0x414e('0x11f')](db[_0x414e('0x74')],{'as':'ProactiveActions'});db['ChatWebsite'][_0x414e('0x11f')](db[_0x414e('0x19a')],{'as':'Interactions'});db[_0x414e('0x148')][_0x414e('0x11f')](db[_0x414e('0x6e')],{'as':_0x414e('0x158')});db[_0x414e('0x148')][_0x414e('0x11f')](db[_0x414e('0x6f')],{'as':'Messages'});db[_0x414e('0x148')][_0x414e('0x12d')](db[_0x414e('0x147')],{'as':_0x414e('0x181'),'foreignKey':_0x414e('0x171')});db['ChatWebsite']['belongsTo'](db['Interval'],{'as':_0x414e('0x161'),'foreignKey':_0x414e('0x180')});db['ChatWebsite'][_0x414e('0x12d')](db[_0x414e('0x3f')],{'as':'MailAccount','foreignKey':_0x414e('0x16d')});db['ChatWebsite'][_0x414e('0x12d')](db[_0x414e('0x8a')],{'as':_0x414e('0x162'),'foreignKey':_0x414e('0x187')});db[_0x414e('0x148')]['belongsToMany'](db[_0x414e('0x11b')],{'as':_0x414e('0x163'),'through':_0x414e('0x14a')});db['OpenchannelQueueReport']['belongsTo'](db[_0x414e('0x61')],{});db[_0x414e('0x6c')][_0x414e('0x12d')](db[_0x414e('0x147')],{'as':_0x414e('0x181'),'foreignKey':_0x414e('0x171')});db[_0x414e('0x6c')][_0x414e('0x12d')](db[_0x414e('0x131')],{'as':_0x414e('0x16b'),'foreignKey':_0x414e('0x177')});db[_0x414e('0x6c')][_0x414e('0x12d')](db[_0x414e('0x65')],{});db[_0x414e('0x6c')][_0x414e('0x12d')](db[_0x414e('0x67')],{});db['OpenchannelQueueReport'][_0x414e('0x12d')](db['User'],{});db[_0x414e('0x6c')][_0x414e('0x12d')](db['OpenchannelQueue'],{});db[_0x414e('0x6e')]['belongsTo'](db[_0x414e('0x11b')],{'as':_0x414e('0x19b'),'foreignKey':_0x414e('0x11e'),'onDelete':_0x414e('0x16e')});db[_0x414e('0x6e')][_0x414e('0x12d')](db[_0x414e('0x73')],{'as':_0x414e('0x19c'),'foreignKey':_0x414e('0x19d'),'onDelete':'restrict'});db[_0x414e('0x6e')]['belongsTo'](db['ChatWebsite'],{'as':_0x414e('0x19e'),'foreignKey':'ChatWebsiteId','onDelete':_0x414e('0x16e')});db[_0x414e('0x6e')][_0x414e('0x12d')](db[_0x414e('0x92')],{'onDelete':_0x414e('0x16e'),'foreignKey':_0x414e('0x188')});db[_0x414e('0x19a')][_0x414e('0x11f')](db[_0x414e('0x6f')],{'as':_0x414e('0x174'),'onDelete':_0x414e('0x11d'),'foreignKey':_0x414e('0x19f')});db[_0x414e('0x19a')]['belongsTo'](db[_0x414e('0x148')],{'as':_0x414e('0x176'),'foreignKey':_0x414e('0x17e')});db[_0x414e('0x19a')][_0x414e('0x12d')](db[_0x414e('0x131')],{'as':_0x414e('0x16b'),'foreignKey':_0x414e('0x177')});db[_0x414e('0x19a')][_0x414e('0x12d')](db[_0x414e('0x11b')],{'as':_0x414e('0x178'),'foreignKey':_0x414e('0x11e')});db[_0x414e('0x19a')][_0x414e('0x130')](db[_0x414e('0x92')],{'through':_0x414e('0x1a0'),'as':_0x414e('0x17a')});db[_0x414e('0x19a')][_0x414e('0x130')](db[_0x414e('0x92')],{'through':_0x414e('0x1a0'),'as':_0x414e('0x17b')});db['ChatInteraction'][_0x414e('0x130')](db[_0x414e('0x11b')],{'as':_0x414e('0x17c'),'through':_0x414e('0x137'),'foreignKey':_0x414e('0x19f')});db[_0x414e('0x6f')][_0x414e('0x12d')](db['User'],{'onDelete':_0x414e('0x11d'),'as':_0x414e('0x11b')});db[_0x414e('0x6f')][_0x414e('0x12d')](db['CmContact'],{'onDelete':_0x414e('0x11d'),'as':'Contact','foreignKey':_0x414e('0x177')});db['ChatMessage']['belongsTo'](db[_0x414e('0x19a')],{'onDelete':_0x414e('0x11d'),'as':_0x414e('0x18b'),'foreignKey':_0x414e('0x19f')});db[_0x414e('0x6f')][_0x414e('0x12d')](db[_0x414e('0xf6')],{'as':'Attachment','foreignKey':_0x414e('0x18c')});db[_0x414e('0x6f')][_0x414e('0x12d')](db[_0x414e('0x148')],{'as':_0x414e('0x176'),'foreignKey':_0x414e('0x17e')});db[_0x414e('0x71')][_0x414e('0x11f')](db[_0x414e('0xf6')],{'as':_0x414e('0x17d'),'foreignKey':_0x414e('0x17f'),'onDelete':_0x414e('0x11d'),'hooks':!![]});db[_0x414e('0x71')][_0x414e('0x12d')](db[_0x414e('0x131')],{'onDelete':_0x414e('0x11d'),'as':_0x414e('0x16b'),'foreignKey':'ContactId'});db[_0x414e('0x71')][_0x414e('0x12d')](db['ChatWebsite'],{'as':_0x414e('0x176'),'foreignKey':_0x414e('0x17e')});db['ChatQueue'][_0x414e('0x130')](db[_0x414e('0x11b')],{'as':_0x414e('0x163'),'through':_0x414e('0x140'),'hooks':!![]});db[_0x414e('0x73')][_0x414e('0x130')](db[_0x414e('0xf0')],{'through':_0x414e('0x1a1'),'as':_0x414e('0x164')});db[_0x414e('0x1a2')][_0x414e('0x11f')](db[_0x414e('0x1a3')],{'as':_0x414e('0x174'),'foreignKey':_0x414e('0x1a4'),'onDelete':_0x414e('0x11d')});db[_0x414e('0x1a2')][_0x414e('0x130')](db[_0x414e('0x11b')],{'as':_0x414e('0x1a5'),'through':_0x414e('0x1a6')});db[_0x414e('0x74')][_0x414e('0x12d')](db['ChatWebsite'],{'as':_0x414e('0x19e'),'foreignKey':'ChatWebsiteId'});db[_0x414e('0x1a7')][_0x414e('0x11f')](db['CmContact'],{'as':_0x414e('0x132'),'foreignKey':_0x414e('0x1a8')});db['CmContact'][_0x414e('0x11f')](db[_0x414e('0x77')],{'as':_0x414e('0x1a9'),'foreignKey':_0x414e('0x177')});db['CmContact'][_0x414e('0x11f')](db[_0x414e('0x7a')],{'as':'HopperFinals','foreignKey':_0x414e('0x177')});db[_0x414e('0x131')][_0x414e('0x11f')](db[_0x414e('0x7c')],{'as':'HopperHistories','foreignKey':_0x414e('0x177')});db[_0x414e('0x131')]['hasMany'](db[_0x414e('0x7e')],{'as':_0x414e('0x7e'),'foreignKey':_0x414e('0x177')});db[_0x414e('0x131')][_0x414e('0x11f')](db['JscriptySessionReport'],{'as':'JscriptySessions','foreignKey':_0x414e('0x177')});db[_0x414e('0x131')][_0x414e('0x11f')](db[_0x414e('0x65')],{'as':_0x414e('0x123'),'foreignKey':_0x414e('0x177'),'onDelete':'restrict'});db[_0x414e('0x131')][_0x414e('0x11f')](db['ChatInteraction'],{'as':_0x414e('0x124'),'foreignKey':_0x414e('0x177'),'onDelete':'restrict'});db[_0x414e('0x131')][_0x414e('0x11f')](db[_0x414e('0x5c')],{'as':_0x414e('0x125'),'foreignKey':_0x414e('0x177'),'onDelete':_0x414e('0x16e')});db[_0x414e('0x131')]['hasMany'](db[_0x414e('0x52')],{'as':'FaxInteractions','foreignKey':'ContactId','onDelete':_0x414e('0x16e')});db[_0x414e('0x131')][_0x414e('0x11f')](db[_0x414e('0x127')],{'as':_0x414e('0x128'),'foreignKey':_0x414e('0x177'),'onDelete':_0x414e('0x16e')});db['CmContact']['belongsTo'](db[_0x414e('0x1a7')],{'as':_0x414e('0x1aa'),'foreignKey':_0x414e('0x1a8')});db[_0x414e('0x131')]['belongsTo'](db[_0x414e('0x147')],{'as':'List','foreignKey':_0x414e('0x171'),'onDelete':_0x414e('0x11d')});db['CmContact'][_0x414e('0x130')](db[_0x414e('0x11b')],{'as':_0x414e('0x17c'),'through':_0x414e('0x1ab')});db[_0x414e('0x131')][_0x414e('0x130')](db[_0x414e('0x92')],{'as':_0x414e('0x17a'),'through':_0x414e('0x1ac')});db[_0x414e('0x131')][_0x414e('0x130')](db[_0x414e('0x92')],{'through':_0x414e('0x1ac'),'as':'ThroughTags'});db[_0x414e('0x77')][_0x414e('0x12d')](db[_0x414e('0x131')],{'as':_0x414e('0x16b'),'foreignKey':_0x414e('0x177'),'onDelete':'cascade'});db[_0x414e('0x77')][_0x414e('0x12d')](db['CmList'],{'as':_0x414e('0x181'),'foreignKey':_0x414e('0x171'),'onDelete':'cascade'});db[_0x414e('0x77')]['belongsTo'](db[_0x414e('0x11b')],{'as':_0x414e('0x19b'),'foreignKey':'UserId'});db[_0x414e('0x77')][_0x414e('0x12d')](db[_0x414e('0x1a')],{'as':_0x414e('0x19c'),'foreignKey':'VoiceQueueId','onDelete':_0x414e('0x11d')});db[_0x414e('0x77')][_0x414e('0x12d')](db[_0x414e('0xf3')],{'as':_0x414e('0xf3'),'foreignKey':'CampaignId','onDelete':_0x414e('0x11d')});db[_0x414e('0x77')][_0x414e('0x12d')](db[_0x414e('0x11b')],{'as':'Owner','foreignKey':_0x414e('0x1ad')});db[_0x414e('0x78')]['belongsTo'](db[_0x414e('0x131')],{'as':_0x414e('0x16b'),'foreignKey':_0x414e('0x177'),'onDelete':_0x414e('0x11d')});db[_0x414e('0x78')][_0x414e('0x12d')](db[_0x414e('0x147')],{'as':'List','foreignKey':_0x414e('0x171'),'onDelete':_0x414e('0x11d')});db[_0x414e('0x78')][_0x414e('0x12d')](db[_0x414e('0x1a')],{'as':_0x414e('0x19c'),'foreignKey':_0x414e('0x15b'),'onDelete':_0x414e('0x11d')});db[_0x414e('0x78')][_0x414e('0x12d')](db[_0x414e('0xf3')],{'as':_0x414e('0xf3'),'foreignKey':_0x414e('0x1ae'),'onDelete':_0x414e('0x11d')});db[_0x414e('0x83')][_0x414e('0x11f')](db['Condition'],{'as':{'plural':'All','singular':_0x414e('0x1af')},'foreignKey':_0x414e('0x1b0'),'onDelete':_0x414e('0x11d'),'hooks':!![]});db[_0x414e('0x83')]['hasMany'](db[_0x414e('0x1b1')],{'as':{'plural':_0x414e('0x1b2'),'singular':'OneAny'},'foreignKey':'AutomationAnyId','onDelete':_0x414e('0x11d'),'hooks':!![]});db[_0x414e('0x83')][_0x414e('0x11f')](db[_0x414e('0x81')],{'as':_0x414e('0x1b3'),'foreignKey':_0x414e('0x1b4'),'onDelete':'cascade','hooks':!![]});db[_0x414e('0x86')][_0x414e('0x11f')](db['Disposition'],{'as':'Dispositions','foreignKey':_0x414e('0x1b5'),'onDelete':_0x414e('0x11d')});db[_0x414e('0x161')][_0x414e('0x11f')](db[_0x414e('0x161')],{'as':_0x414e('0x1b6'),'foreignKey':_0x414e('0x180'),'onDelete':_0x414e('0x11d'),'hooks':!![],'required':![]});db['Interval'][_0x414e('0x11f')](db['VoiceExtension'],{'as':'Extensions','foreignKey':_0x414e('0x180'),'onDelete':_0x414e('0x16e')});db[_0x414e('0x161')][_0x414e('0x11f')](db[_0x414e('0x46')],{'as':'MailApplications','foreignKey':_0x414e('0x180')});db[_0x414e('0x161')][_0x414e('0x11f')](db['ChatApplication'],{'as':_0x414e('0x1b7'),'foreignKey':_0x414e('0x180')});db[_0x414e('0x161')]['hasMany'](db['FaxApplication'],{'as':_0x414e('0x1b8'),'foreignKey':_0x414e('0x180')});db[_0x414e('0x161')]['hasMany'](db['SmsApplication'],{'as':'SmsApplications','foreignKey':_0x414e('0x180')});db[_0x414e('0x8f')][_0x414e('0x12d')](db[_0x414e('0x3f')],{});db[_0x414e('0x8f')][_0x414e('0x12d')](db[_0x414e('0x9e')],{'foreignKey':_0x414e('0x1b9')});db[_0x414e('0x8f')][_0x414e('0x12d')](db[_0x414e('0x9c')],{'foreignKey':_0x414e('0x1ba')});db['Sound'][_0x414e('0x130')](db[_0x414e('0x18')],{'as':_0x414e('0x1bb'),'through':_0x414e('0x1bc'),'onDelete':'restrict'});db[_0x414e('0x92')][_0x414e('0x130')](db['CmContact'],{'through':'cm_contact_has_tags'});db[_0x414e('0x92')][_0x414e('0x130')](db[_0x414e('0x19a')],{'through':'chat_interaction_has_tags'});db[_0x414e('0x92')][_0x414e('0x130')](db[_0x414e('0x127')],{'through':_0x414e('0x179')});db[_0x414e('0x92')][_0x414e('0x130')](db[_0x414e('0x5c')],{'through':_0x414e('0x190')});db[_0x414e('0x92')][_0x414e('0x130')](db[_0x414e('0x52')],{'through':_0x414e('0x189')});db['Tag'][_0x414e('0x130')](db['OpenchannelInteraction'],{'through':_0x414e('0x198')});db[_0x414e('0x92')]['belongsToMany'](db[_0x414e('0x1bd')],{'through':_0x414e('0x1be')});db[_0x414e('0x1bf')][_0x414e('0x11f')](db[_0x414e('0x1b1')],{'as':{'plural':_0x414e('0x1c0'),'singular':_0x414e('0x1c1')},'foreignKey':_0x414e('0x1c2'),'onDelete':_0x414e('0x11d'),'hooks':!![]});db[_0x414e('0x1bf')][_0x414e('0x11f')](db[_0x414e('0x1b1')],{'as':{'plural':_0x414e('0x1c3'),'singular':_0x414e('0x1c4')},'foreignKey':_0x414e('0x1c5'),'onDelete':_0x414e('0x11d'),'hooks':!![]});db['Trigger'][_0x414e('0x11f')](db[_0x414e('0x81')],{'as':_0x414e('0x1b3'),'foreignKey':'TriggerId','onDelete':_0x414e('0x11d'),'hooks':!![]});db[_0x414e('0x9c')][_0x414e('0x11f')](db[_0x414e('0x1c6')],{'as':_0x414e('0x1c7'),'onDelete':_0x414e('0x11d'),'foreignKey':'CustomReportId','hooks':!![]});db[_0x414e('0x9e')][_0x414e('0x11f')](db[_0x414e('0x1c6')],{'as':_0x414e('0x1c7'),'onDelete':_0x414e('0x11d'),'foreignKey':_0x414e('0x1b9')});db[_0x414e('0xa0')]['hasMany'](db['AnalyticFieldReport'],{'as':_0x414e('0x1c7'),'onDelete':_0x414e('0x11d'),'foreignKey':_0x414e('0x1c8')});db[_0x414e('0x1c6')]['belongsTo'](db['AnalyticMetric'],{'foreignKey':_0x414e('0x1c8')});db[_0x414e('0xa5')][_0x414e('0x11f')](db[_0x414e('0xa7')],{'as':'Configurations','onDelete':_0x414e('0x11d'),'foreignKey':'AccountId'});db[_0x414e('0xa7')][_0x414e('0x11f')](db[_0x414e('0xa8')],{'as':_0x414e('0x1c9'),'onDelete':_0x414e('0x11d'),'foreignKey':'SubjectId'});db[_0x414e('0xa7')][_0x414e('0x11f')](db[_0x414e('0xa8')],{'as':_0x414e('0x1ca'),'onDelete':_0x414e('0x11d'),'foreignKey':_0x414e('0x1cb')});db[_0x414e('0xa7')]['hasMany'](db[_0x414e('0xa8')],{'as':_0x414e('0x1c7'),'onDelete':_0x414e('0x11d'),'foreignKey':'FieldId'});db[_0x414e('0xa7')][_0x414e('0x12d')](db['SalesforceAccount'],{'as':_0x414e('0x176'),'foreignKey':_0x414e('0x1cc')});db[_0x414e('0xa8')][_0x414e('0x11f')](db['SalesforceField'],{'as':_0x414e('0x1cd'),'foreignKey':_0x414e('0x1ce')});db[_0x414e('0xa8')][_0x414e('0x11f')](db['SalesforceField'],{'as':_0x414e('0x1cf'),'foreignKey':_0x414e('0x1cb')});db[_0x414e('0xa8')]['hasMany'](db['SalesforceField'],{'as':_0x414e('0x1d0'),'foreignKey':'FieldId'});db['SalesforceField'][_0x414e('0x12d')](db[_0x414e('0x97')],{'as':'Variable','foreignKey':_0x414e('0x1d1')});db[_0x414e('0xa9')][_0x414e('0x11f')](db[_0x414e('0xaa')],{'as':_0x414e('0x1d2'),'onDelete':_0x414e('0x11d'),'foreignKey':_0x414e('0x1cc')});db['SugarcrmConfiguration'][_0x414e('0x11f')](db[_0x414e('0xac')],{'as':_0x414e('0x1c9'),'onDelete':_0x414e('0x11d'),'foreignKey':_0x414e('0x1ce')});db[_0x414e('0xaa')][_0x414e('0x11f')](db[_0x414e('0xac')],{'as':_0x414e('0x1ca'),'onDelete':'cascade','foreignKey':_0x414e('0x1cb')});db['SugarcrmConfiguration'][_0x414e('0x11f')](db['SugarcrmField'],{'as':_0x414e('0x1c7'),'onDelete':_0x414e('0x11d'),'foreignKey':_0x414e('0x1d3')});db['SugarcrmConfiguration'][_0x414e('0x12d')](db[_0x414e('0xa9')],{'as':_0x414e('0x176'),'foreignKey':_0x414e('0x1cc')});db['SugarcrmField'][_0x414e('0x11f')](db[_0x414e('0xac')],{'as':_0x414e('0x1cd'),'foreignKey':_0x414e('0x1ce')});db[_0x414e('0xac')]['hasMany'](db['SugarcrmField'],{'as':_0x414e('0x1cf'),'foreignKey':_0x414e('0x1cb')});db[_0x414e('0xac')][_0x414e('0x11f')](db[_0x414e('0xac')],{'as':_0x414e('0x1d0'),'foreignKey':'FieldId'});db['SugarcrmField'][_0x414e('0x12d')](db['Variable'],{'as':'Variable','foreignKey':_0x414e('0x1d1')});db[_0x414e('0xae')]['hasMany'](db['DeskConfiguration'],{'as':_0x414e('0x1d2'),'onDelete':_0x414e('0x11d'),'foreignKey':_0x414e('0x1cc')});db[_0x414e('0xb0')][_0x414e('0x11f')](db['DeskField'],{'as':_0x414e('0x1c9'),'onDelete':_0x414e('0x11d'),'foreignKey':_0x414e('0x1ce')});db['DeskConfiguration'][_0x414e('0x11f')](db[_0x414e('0xb2')],{'as':_0x414e('0x1ca'),'onDelete':_0x414e('0x11d'),'foreignKey':'DescriptionId'});db[_0x414e('0xb0')][_0x414e('0x11f')](db[_0x414e('0xb2')],{'as':_0x414e('0x1c7'),'onDelete':_0x414e('0x11d'),'foreignKey':_0x414e('0x1d3')});db['DeskConfiguration']['belongsTo'](db['DeskAccount'],{'as':'Account','foreignKey':'AccountId'});db[_0x414e('0xb0')][_0x414e('0x130')](db['Tag'],{'through':_0x414e('0x1d4')});db[_0x414e('0xb2')]['hasMany'](db[_0x414e('0xb2')],{'as':'Subject','foreignKey':_0x414e('0x1ce')});db[_0x414e('0xb2')]['hasMany'](db['DeskField'],{'as':_0x414e('0x1cf'),'foreignKey':_0x414e('0x1cb')});db['DeskField']['hasMany'](db[_0x414e('0xb2')],{'as':'Field','foreignKey':_0x414e('0x1d3')});db[_0x414e('0xb2')]['belongsTo'](db[_0x414e('0x97')],{'as':_0x414e('0x97'),'foreignKey':_0x414e('0x1d1')});db[_0x414e('0xb4')][_0x414e('0x11f')](db[_0x414e('0xb6')],{'as':'Configurations','onDelete':_0x414e('0x11d'),'foreignKey':_0x414e('0x1cc')});db[_0x414e('0xb6')]['hasMany'](db['ZohoField'],{'as':_0x414e('0x1c9'),'onDelete':_0x414e('0x11d'),'foreignKey':_0x414e('0x1ce')});db[_0x414e('0xb6')]['hasMany'](db[_0x414e('0xb8')],{'as':_0x414e('0x1ca'),'onDelete':_0x414e('0x11d'),'foreignKey':_0x414e('0x1cb')});db[_0x414e('0xb6')][_0x414e('0x11f')](db['ZohoField'],{'as':_0x414e('0x1c7'),'onDelete':_0x414e('0x11d'),'foreignKey':_0x414e('0x1d3')});db[_0x414e('0xb6')][_0x414e('0x12d')](db[_0x414e('0xb4')],{'as':'Account','foreignKey':_0x414e('0x1cc')});db[_0x414e('0xb8')]['hasMany'](db[_0x414e('0xb8')],{'as':'Subject','foreignKey':_0x414e('0x1ce')});db['ZohoField'][_0x414e('0x11f')](db[_0x414e('0xb8')],{'as':'Description','foreignKey':'DescriptionId'});db[_0x414e('0xb8')][_0x414e('0x11f')](db[_0x414e('0xb8')],{'as':'Field','foreignKey':_0x414e('0x1d3')});db['ZohoField'][_0x414e('0x12d')](db[_0x414e('0x97')],{'as':_0x414e('0x97'),'foreignKey':_0x414e('0x1d1')});db[_0x414e('0xba')][_0x414e('0x11f')](db[_0x414e('0xbc')],{'as':_0x414e('0x1d2'),'onDelete':'cascade','foreignKey':_0x414e('0x1cc')});db[_0x414e('0xbc')][_0x414e('0x11f')](db[_0x414e('0x1d5')],{'as':'Subjects','foreignKey':_0x414e('0x1ce')});db[_0x414e('0xbc')][_0x414e('0x11f')](db[_0x414e('0x1d5')],{'as':_0x414e('0x1ca'),'foreignKey':_0x414e('0x1cb')});db[_0x414e('0xbc')][_0x414e('0x11f')](db['ZendeskField'],{'as':'Fields','foreignKey':'FieldId'});db[_0x414e('0xbc')]['belongsTo'](db[_0x414e('0xba')],{'as':_0x414e('0x176'),'foreignKey':_0x414e('0x1cc')});db['ZendeskConfiguration'][_0x414e('0x130')](db[_0x414e('0x92')],{'through':'int_zendesk_configuration_has_tags'});db['ZendeskField'][_0x414e('0x11f')](db[_0x414e('0x1d5')],{'as':_0x414e('0x1cd'),'foreignKey':_0x414e('0x1ce')});db[_0x414e('0x1d5')][_0x414e('0x11f')](db[_0x414e('0x1d5')],{'as':_0x414e('0x1cf'),'foreignKey':'DescriptionId'});db[_0x414e('0x1d5')][_0x414e('0x11f')](db[_0x414e('0x1d5')],{'as':_0x414e('0x1d0'),'foreignKey':_0x414e('0x1d3')});db[_0x414e('0x1d5')][_0x414e('0x12d')](db[_0x414e('0x97')],{'as':_0x414e('0x97'),'foreignKey':'VariableId'});db[_0x414e('0x1d6')]['hasMany'](db[_0x414e('0xc0')],{'as':_0x414e('0x1d2'),'onDelete':_0x414e('0x11d'),'foreignKey':_0x414e('0x1cc')});db[_0x414e('0xc0')][_0x414e('0x11f')](db['FreshdeskField'],{'as':_0x414e('0x1c9'),'onDelete':_0x414e('0x11d'),'foreignKey':_0x414e('0x1ce')});db[_0x414e('0xc0')]['hasMany'](db['FreshdeskField'],{'as':_0x414e('0x1ca'),'onDelete':_0x414e('0x11d'),'foreignKey':'DescriptionId'});db[_0x414e('0xc0')][_0x414e('0x11f')](db[_0x414e('0xc1')],{'as':_0x414e('0x1c7'),'onDelete':'cascade','foreignKey':_0x414e('0x1d3')});db['FreshdeskConfiguration'][_0x414e('0x12d')](db[_0x414e('0x1d6')],{'as':_0x414e('0x176'),'foreignKey':_0x414e('0x1cc')});db[_0x414e('0xc0')][_0x414e('0x130')](db[_0x414e('0x92')],{'through':_0x414e('0x1d7')});db[_0x414e('0xc1')]['hasMany'](db[_0x414e('0xc1')],{'as':_0x414e('0x1cd'),'foreignKey':'SubjectId'});db['FreshdeskField'][_0x414e('0x11f')](db[_0x414e('0xc1')],{'as':_0x414e('0x1cf'),'foreignKey':_0x414e('0x1cb')});db['FreshdeskField'][_0x414e('0x11f')](db['FreshdeskField'],{'as':_0x414e('0x1d0'),'foreignKey':_0x414e('0x1d3')});db[_0x414e('0xc1')][_0x414e('0x12d')](db['Variable'],{'as':'Variable','foreignKey':'VariableId'});db[_0x414e('0xc3')][_0x414e('0x11f')](db[_0x414e('0xc5')],{'as':_0x414e('0x1d2'),'onDelete':_0x414e('0x11d'),'foreignKey':'AccountId'});db['VtigerConfiguration'][_0x414e('0x11f')](db[_0x414e('0xc7')],{'as':'Subjects','foreignKey':_0x414e('0x1ce')});db[_0x414e('0xc5')][_0x414e('0x11f')](db[_0x414e('0xc7')],{'as':_0x414e('0x1ca'),'foreignKey':_0x414e('0x1cb')});db[_0x414e('0xc5')]['hasMany'](db[_0x414e('0xc7')],{'as':_0x414e('0x1c7'),'foreignKey':_0x414e('0x1d3')});db[_0x414e('0xc5')][_0x414e('0x12d')](db[_0x414e('0xc3')],{'as':_0x414e('0x176'),'foreignKey':_0x414e('0x1cc')});db[_0x414e('0xc7')][_0x414e('0x11f')](db['VtigerField'],{'as':_0x414e('0x1cd'),'foreignKey':_0x414e('0x1ce')});db['VtigerField']['hasMany'](db['VtigerField'],{'as':'Description','foreignKey':'DescriptionId'});db['VtigerField'][_0x414e('0x11f')](db[_0x414e('0xc7')],{'as':_0x414e('0x1d0'),'foreignKey':_0x414e('0x1d3')});db['VtigerField'][_0x414e('0x12d')](db['Variable'],{'as':_0x414e('0x97'),'foreignKey':_0x414e('0x1d1')});db[_0x414e('0xc9')][_0x414e('0x11f')](db[_0x414e('0x1d8')],{'as':'Configurations','onDelete':_0x414e('0x11d'),'foreignKey':'AccountId'});db['ServicenowConfiguration'][_0x414e('0x11f')](db[_0x414e('0xcb')],{'as':_0x414e('0x1c9'),'foreignKey':_0x414e('0x1ce')});db[_0x414e('0x1d8')][_0x414e('0x11f')](db[_0x414e('0xcb')],{'as':_0x414e('0x1ca'),'foreignKey':'DescriptionId'});db[_0x414e('0x1d8')][_0x414e('0x11f')](db[_0x414e('0xcb')],{'as':_0x414e('0x1c7'),'foreignKey':_0x414e('0x1d3')});db[_0x414e('0x1d8')][_0x414e('0x12d')](db[_0x414e('0xc9')],{'as':'Account','foreignKey':_0x414e('0x1cc')});db['ServicenowField'][_0x414e('0x11f')](db[_0x414e('0xcb')],{'as':_0x414e('0x1cd'),'foreignKey':_0x414e('0x1ce')});db[_0x414e('0xcb')]['hasMany'](db[_0x414e('0xcb')],{'as':_0x414e('0x1cf'),'foreignKey':'DescriptionId'});db[_0x414e('0xcb')][_0x414e('0x11f')](db[_0x414e('0xcb')],{'as':_0x414e('0x1d0'),'foreignKey':'FieldId'});db[_0x414e('0xcb')][_0x414e('0x12d')](db['Variable'],{'as':'Variable','foreignKey':_0x414e('0x1d1')});db[_0x414e('0xcd')]['hasMany'](db[_0x414e('0x1d9')],{'as':_0x414e('0x1d2'),'onDelete':_0x414e('0x11d'),'foreignKey':_0x414e('0x1cc')});db[_0x414e('0x1d9')][_0x414e('0x11f')](db[_0x414e('0xd0')],{'as':'Subjects','onDelete':'cascade','foreignKey':_0x414e('0x1ce')});db[_0x414e('0x1d9')]['hasMany'](db[_0x414e('0xd0')],{'as':'Descriptions','onDelete':'cascade','foreignKey':_0x414e('0x1cb')});db[_0x414e('0x1d9')][_0x414e('0x11f')](db['Dynamics365Field'],{'as':'Fields','onDelete':_0x414e('0x11d'),'foreignKey':'FieldId'});db[_0x414e('0x1d9')][_0x414e('0x12d')](db[_0x414e('0xcd')],{'as':'Account','foreignKey':_0x414e('0x1cc')});db['Dynamics365Field']['hasMany'](db['Dynamics365Field'],{'as':'Subject','foreignKey':_0x414e('0x1ce')});db['Dynamics365Field'][_0x414e('0x11f')](db[_0x414e('0xd0')],{'as':_0x414e('0x1cf'),'foreignKey':_0x414e('0x1cb')});db[_0x414e('0xd0')][_0x414e('0x11f')](db[_0x414e('0xd0')],{'as':_0x414e('0x1d0'),'foreignKey':_0x414e('0x1d3')});db[_0x414e('0xd0')][_0x414e('0x12d')](db[_0x414e('0x97')],{'as':_0x414e('0x97'),'foreignKey':_0x414e('0x1d1')});db['FreshsalesAccount']['hasMany'](db[_0x414e('0xd3')],{'as':_0x414e('0x1d2'),'onDelete':'cascade','foreignKey':_0x414e('0x1cc')});db['FreshsalesConfiguration'][_0x414e('0x11f')](db[_0x414e('0x1da')],{'as':_0x414e('0x1c9'),'foreignKey':_0x414e('0x1ce')});db['FreshsalesConfiguration'][_0x414e('0x11f')](db[_0x414e('0x1da')],{'as':_0x414e('0x1ca'),'foreignKey':'DescriptionId'});db['FreshsalesConfiguration'][_0x414e('0x11f')](db['FreshsalesField'],{'as':_0x414e('0x1c7'),'foreignKey':_0x414e('0x1d3')});db[_0x414e('0xd3')][_0x414e('0x12d')](db[_0x414e('0xd2')],{'as':_0x414e('0x176'),'foreignKey':_0x414e('0x1cc')});db[_0x414e('0x1da')][_0x414e('0x11f')](db[_0x414e('0x1da')],{'as':_0x414e('0x1cd'),'foreignKey':'SubjectId'});db[_0x414e('0x1da')][_0x414e('0x11f')](db[_0x414e('0x1da')],{'as':_0x414e('0x1cf'),'foreignKey':_0x414e('0x1cb')});db[_0x414e('0x1da')][_0x414e('0x11f')](db[_0x414e('0x1da')],{'as':'Field','foreignKey':_0x414e('0x1d3')});db[_0x414e('0x1da')][_0x414e('0x12d')](db['Variable'],{'as':_0x414e('0x97'),'foreignKey':_0x414e('0x1d1')});db[_0x414e('0xd9')]['belongsTo'](db[_0x414e('0x148')],{});db['ChatQueueReport'][_0x414e('0x12d')](db[_0x414e('0x147')],{'as':_0x414e('0x181'),'foreignKey':_0x414e('0x171')});db[_0x414e('0xd9')][_0x414e('0x12d')](db[_0x414e('0x131')],{'as':'Contact','foreignKey':'ContactId'});db[_0x414e('0xd9')][_0x414e('0x12d')](db[_0x414e('0x19a')],{});db[_0x414e('0xd9')]['belongsTo'](db[_0x414e('0x6f')],{});db['ChatQueueReport'][_0x414e('0x12d')](db[_0x414e('0x11b')],{});db[_0x414e('0xd9')][_0x414e('0x12d')](db[_0x414e('0x73')],{});db['ChatInternalMessage'][_0x414e('0x12d')](db[_0x414e('0x11b')],{'onDelete':'cascade','foreignKey':_0x414e('0x1db')});db[_0x414e('0x1a3')][_0x414e('0x12d')](db[_0x414e('0x11b')],{'onDelete':_0x414e('0x11d'),'foreignKey':_0x414e('0x1dc')});db[_0x414e('0xdf')][_0x414e('0x11f')](db[_0x414e('0xdd')],{'foreignKey':_0x414e('0x1dd'),'onDelete':_0x414e('0x11d')});db[_0x414e('0xdf')][_0x414e('0x11f')](db['JscriptyAnswerReport'],{'foreignKey':_0x414e('0x1dd'),'onDelete':'cascade'});db[_0x414e('0xe1')]['belongsTo'](db[_0x414e('0x58')],{});db['SmsQueueReport'][_0x414e('0x12d')](db['CmList'],{'as':_0x414e('0x181'),'foreignKey':_0x414e('0x171')});db[_0x414e('0xe1')]['belongsTo'](db['CmContact'],{'as':_0x414e('0x16b'),'foreignKey':_0x414e('0x177')});db[_0x414e('0xe1')][_0x414e('0x12d')](db['SmsInteraction'],{});db[_0x414e('0xe1')][_0x414e('0x12d')](db[_0x414e('0x5e')],{});db[_0x414e('0xe1')][_0x414e('0x12d')](db[_0x414e('0x11b')],{});db[_0x414e('0xe1')][_0x414e('0x12d')](db[_0x414e('0x142')],{});db[_0x414e('0x1de')][_0x414e('0x11f')](db[_0x414e('0xdf')],{'foreignKey':_0x414e('0x1df')});db[_0x414e('0x1de')][_0x414e('0x11f')](db['JscriptyQuestionReport'],{'foreignKey':_0x414e('0x1df')});db[_0x414e('0x1de')][_0x414e('0x11f')](db[_0x414e('0xdb')],{'foreignKey':_0x414e('0x1df')});db[_0x414e('0xea')][_0x414e('0x130')](db['User'],{'as':_0x414e('0x17c'),'through':_0x414e('0x155')});db[_0x414e('0xf0')][_0x414e('0x130')](db['User'],{'as':_0x414e('0x163'),'through':_0x414e('0x135')});db[_0x414e('0xf0')][_0x414e('0x130')](db[_0x414e('0x1a')],{'through':_0x414e('0x114'),'as':_0x414e('0x13b')});db[_0x414e('0xf0')][_0x414e('0x130')](db[_0x414e('0x40')],{'through':'team_has_mail_queues','as':_0x414e('0x13e')});db[_0x414e('0xf0')][_0x414e('0x130')](db[_0x414e('0x73')],{'through':_0x414e('0x1a1'),'as':_0x414e('0x13f')});db['Team'][_0x414e('0x130')](db[_0x414e('0x54')],{'through':_0x414e('0x18d'),'as':_0x414e('0x141')});db[_0x414e('0xf0')][_0x414e('0x130')](db['SmsQueue'],{'through':_0x414e('0x193'),'as':'SmsQueues'});db[_0x414e('0xf0')][_0x414e('0x130')](db[_0x414e('0x69')],{'through':_0x414e('0x199'),'as':_0x414e('0x145')});db[_0x414e('0xf0')]['belongsToMany'](db[_0x414e('0x110')],{'through':_0x414e('0x1e0'),'as':_0x414e('0x146')});db[_0x414e('0xf0')]['belongsToMany'](db[_0x414e('0xff')],{'through':_0x414e('0x116'),'as':'VoicePrefixes'});db[_0x414e('0xf3')][_0x414e('0x11f')](db[_0x414e('0x77')],{'as':'Hoppers','foreignKey':_0x414e('0x1ae')});db[_0x414e('0xf3')]['hasMany'](db[_0x414e('0x7a')],{'as':_0x414e('0x15c'),'foreignKey':'CampaignId'});db[_0x414e('0xf3')][_0x414e('0x11f')](db[_0x414e('0x7c')],{'as':_0x414e('0x15d'),'foreignKey':_0x414e('0x1ae')});db[_0x414e('0xf3')][_0x414e('0x11f')](db[_0x414e('0x78')],{'as':_0x414e('0x15e'),'foreignKey':_0x414e('0x1ae')});db[_0x414e('0xf3')]['belongsTo'](db[_0x414e('0x2d')],{'as':'Trunk','foreignKey':_0x414e('0x1e1')});db['Campaign'][_0x414e('0x12d')](db['Trunk'],{'as':_0x414e('0x160'),'foreignKey':'TrunkBackupId'});db[_0x414e('0xf3')][_0x414e('0x12d')](db['Interval'],{'as':'Interval','foreignKey':_0x414e('0x180')});db[_0x414e('0xf3')][_0x414e('0x12d')](db[_0x414e('0xea')],{'as':_0x414e('0xea'),'foreignKey':_0x414e('0x1e2')});db[_0x414e('0xf3')][_0x414e('0x130')](db['CmList'],{'as':_0x414e('0x133'),'through':'campaigns_has_cm_lists'});db[_0x414e('0xf3')][_0x414e('0x130')](db[_0x414e('0x147')],{'as':_0x414e('0x165'),'through':'campaigns_has_cm_blacklists'});db[_0x414e('0xf6')][_0x414e('0x12d')](db['ChatOfflineMessage'],{'as':_0x414e('0x71'),'foreignKey':_0x414e('0x17f')});db[_0x414e('0x1e3')]['belongsTo'](db['MailMessage'],{});db[_0x414e('0x1e3')][_0x414e('0x12d')](db['MailInteraction'],{});db[_0x414e('0x1e3')][_0x414e('0x12d')](db['MailAccount'],{'foreignKey':_0x414e('0x1e4'),'as':'FromAccount'});db[_0x414e('0x1e3')][_0x414e('0x12d')](db[_0x414e('0x11b')],{'foreignKey':_0x414e('0x1e5'),'as':_0x414e('0x1e6')});db['MailTransferReport']['belongsTo'](db[_0x414e('0x11b')],{'foreignKey':_0x414e('0x1e7'),'as':_0x414e('0x1e8')});db['MailTransferReport'][_0x414e('0x12d')](db['MailQueue'],{'foreignKey':_0x414e('0x1e9'),'as':'ToQueue'});db[_0x414e('0x1e3')]['belongsTo'](db[_0x414e('0x3f')],{'foreignKey':_0x414e('0x1ea'),'as':_0x414e('0x1eb')});db[_0x414e('0x1ec')][_0x414e('0x12d')](db[_0x414e('0x6f')],{});db[_0x414e('0x1ec')][_0x414e('0x12d')](db[_0x414e('0x19a')],{});db[_0x414e('0x1ec')][_0x414e('0x12d')](db[_0x414e('0x148')],{'foreignKey':'FromChatWebsiteId','as':_0x414e('0x1ed')});db[_0x414e('0x1ec')][_0x414e('0x12d')](db[_0x414e('0x11b')],{'foreignKey':_0x414e('0x1e5'),'as':_0x414e('0x1e6')});db['ChatTransferReport'][_0x414e('0x12d')](db[_0x414e('0x11b')],{'foreignKey':_0x414e('0x1e7'),'as':_0x414e('0x1e8')});db[_0x414e('0x1ec')][_0x414e('0x12d')](db[_0x414e('0x73')],{'foreignKey':_0x414e('0x1ee'),'as':_0x414e('0x1ef')});db[_0x414e('0x1ec')][_0x414e('0x12d')](db[_0x414e('0x148')],{'foreignKey':_0x414e('0x1f0'),'as':'ToAccount'});db[_0x414e('0x1f1')][_0x414e('0x12d')](db[_0x414e('0x186')],{});db['FaxTransferReport'][_0x414e('0x12d')](db[_0x414e('0x52')],{});db[_0x414e('0x1f1')][_0x414e('0x12d')](db['FaxAccount'],{'foreignKey':_0x414e('0x1f2'),'as':_0x414e('0x1ed')});db[_0x414e('0x1f1')][_0x414e('0x12d')](db['User'],{'foreignKey':_0x414e('0x1e5'),'as':'FromAgent'});db[_0x414e('0x1f1')]['belongsTo'](db['User'],{'foreignKey':_0x414e('0x1e7'),'as':_0x414e('0x1e8')});db[_0x414e('0x1f1')][_0x414e('0x12d')](db[_0x414e('0x54')],{'foreignKey':_0x414e('0x1f3'),'as':_0x414e('0x1ef')});db[_0x414e('0x1f1')][_0x414e('0x12d')](db[_0x414e('0x4e')],{'foreignKey':_0x414e('0x1f4'),'as':_0x414e('0x1eb')});db['OpenchannelTransferReport'][_0x414e('0x12d')](db[_0x414e('0x67')],{});db[_0x414e('0xfb')][_0x414e('0x12d')](db['OpenchannelInteraction'],{});db[_0x414e('0xfb')]['belongsTo'](db[_0x414e('0x61')],{'foreignKey':'FromOpenchannelAccountId','as':_0x414e('0x1ed')});db[_0x414e('0xfb')]['belongsTo'](db[_0x414e('0x11b')],{'foreignKey':'FromUserId','as':'FromAgent'});db[_0x414e('0xfb')][_0x414e('0x12d')](db[_0x414e('0x11b')],{'foreignKey':_0x414e('0x1e7'),'as':'ToAgent'});db['OpenchannelTransferReport'][_0x414e('0x12d')](db[_0x414e('0x69')],{'foreignKey':_0x414e('0x1f5'),'as':_0x414e('0x1ef')});db[_0x414e('0xfb')][_0x414e('0x12d')](db[_0x414e('0x61')],{'foreignKey':_0x414e('0x1f6'),'as':_0x414e('0x1eb')});db[_0x414e('0xfd')][_0x414e('0x12d')](db[_0x414e('0x5e')],{});db['SmsTransferReport'][_0x414e('0x12d')](db[_0x414e('0x5c')],{});db[_0x414e('0xfd')][_0x414e('0x12d')](db[_0x414e('0x58')],{'foreignKey':_0x414e('0x1f7'),'as':_0x414e('0x1ed')});db[_0x414e('0xfd')][_0x414e('0x12d')](db['User'],{'foreignKey':_0x414e('0x1e5'),'as':'FromAgent'});db[_0x414e('0xfd')][_0x414e('0x12d')](db[_0x414e('0x11b')],{'foreignKey':_0x414e('0x1e7'),'as':_0x414e('0x1e8')});db['SmsTransferReport'][_0x414e('0x12d')](db['SmsQueue'],{'foreignKey':_0x414e('0x1f8'),'as':_0x414e('0x1ef')});db[_0x414e('0xfd')][_0x414e('0x12d')](db['SmsAccount'],{'foreignKey':'ToSmsAccountId','as':_0x414e('0x1eb')});db['CmList'][_0x414e('0x11f')](db[_0x414e('0x86')],{'as':_0x414e('0x183'),'foreignKey':'ListId','onDelete':'cascade'});db['CmList'][_0x414e('0x11f')](db[_0x414e('0x1f9')],{'as':'CustomFields','foreignKey':_0x414e('0x171')});db[_0x414e('0x147')][_0x414e('0x11f')](db[_0x414e('0x131')],{'as':_0x414e('0x132'),'onDelete':'cascade','foreignKey':'ListId'});db[_0x414e('0x147')][_0x414e('0x11f')](db['CmHopperFinal'],{'as':_0x414e('0x15c'),'foreignKey':'ListId'});db['CmList'][_0x414e('0x11f')](db['CmHopperHistory'],{'as':'HopperHistory','foreignKey':_0x414e('0x171')});db[_0x414e('0x147')][_0x414e('0x11f')](db['ReportAgentPreview'],{'as':'ReportAgentPreview','foreignKey':_0x414e('0x171')});db[_0x414e('0x147')][_0x414e('0x130')](db[_0x414e('0x1a')],{'as':_0x414e('0x1fa'),'through':_0x414e('0x1fb')});db[_0x414e('0x147')][_0x414e('0x130')](db['User'],{'as':_0x414e('0x163'),'through':_0x414e('0x134')});db[_0x414e('0xff')][_0x414e('0x11f')](db[_0x414e('0x120')],{'as':_0x414e('0x121'),'onDelete':'cascade'});db[_0x414e('0xff')]['belongsToMany'](db[_0x414e('0x11b')],{'as':_0x414e('0x163'),'through':_0x414e('0x118')});db['VoicePrefix'][_0x414e('0x130')](db['Team'],{'through':'TeamVoicePrefix','as':_0x414e('0x164')});db[_0x414e('0x12e')][_0x414e('0x11f')](db['User'],{'as':_0x414e('0x17c'),'foreignKey':_0x414e('0x12f')});db[_0x414e('0x12e')][_0x414e('0x11f')](db['UserProfileSection'],{'as':_0x414e('0x1fc'),'foreignKey':_0x414e('0x12f'),'onDelete':_0x414e('0x11d')});db[_0x414e('0x102')]['hasMany'](db[_0x414e('0x104')],{'as':'Resources','foreignKey':'sectionId','onDelete':_0x414e('0x11d')});db[_0x414e('0x151')][_0x414e('0x11f')](db[_0x414e('0x86')],{'as':_0x414e('0x183'),'foreignKey':_0x414e('0x1fd'),'onDelete':'cascade'});db[_0x414e('0x151')][_0x414e('0x11f')](db[_0x414e('0x85')],{'as':'Answers','foreignKey':'WhatsappAccountId'});db['WhatsappAccount'][_0x414e('0x11f')](db['WhatsappMessage'],{'as':_0x414e('0x174'),'foreignKey':_0x414e('0x1fd')});db[_0x414e('0x151')][_0x414e('0x11f')](db[_0x414e('0x1bd')],{'as':'Interactions'});db[_0x414e('0x151')][_0x414e('0x11f')](db[_0x414e('0x107')],{'as':'Applications'});db['WhatsappAccount'][_0x414e('0x12d')](db[_0x414e('0x147')],{'as':_0x414e('0x181'),'foreignKey':'ListId'});db[_0x414e('0x151')][_0x414e('0x12d')](db['Pause'],{'as':_0x414e('0x162'),'foreignKey':_0x414e('0x187')});db[_0x414e('0x151')][_0x414e('0x130')](db[_0x414e('0x11b')],{'as':'Agents','through':_0x414e('0x153')});db['WhatsappApplication'][_0x414e('0x12d')](db[_0x414e('0x11b')],{'onDelete':'restrict'});db[_0x414e('0x107')][_0x414e('0x12d')](db[_0x414e('0x110')],{'onDelete':_0x414e('0x16e')});db[_0x414e('0x107')][_0x414e('0x12d')](db['WhatsappAccount'],{'onDelete':_0x414e('0x16e')});db[_0x414e('0x107')]['belongsTo'](db[_0x414e('0x161')],{'onDelete':'restrict','foreignKey':_0x414e('0x180')});db['WhatsappApplication']['belongsTo'](db[_0x414e('0x92')],{'onDelete':_0x414e('0x16e'),'foreignKey':_0x414e('0x188')});db[_0x414e('0x1bd')][_0x414e('0x11f')](db[_0x414e('0x10a')],{'as':'Messages','onDelete':_0x414e('0x11d'),'foreignKey':_0x414e('0x1fe')});db[_0x414e('0x1bd')][_0x414e('0x12d')](db[_0x414e('0x151')],{'as':_0x414e('0x176'),'foreignKey':_0x414e('0x1fd')});db[_0x414e('0x1bd')][_0x414e('0x12d')](db[_0x414e('0x131')],{'as':'Contact','foreignKey':_0x414e('0x177')});db[_0x414e('0x1bd')][_0x414e('0x12d')](db['User'],{'as':'Owner','foreignKey':_0x414e('0x11e')});db[_0x414e('0x1bd')][_0x414e('0x130')](db[_0x414e('0x92')],{'through':'whatsapp_interaction_has_tags','as':_0x414e('0x17a')});db[_0x414e('0x1bd')]['belongsToMany'](db['Tag'],{'through':_0x414e('0x1be'),'as':'ThroughTags'});db['WhatsappInteraction'][_0x414e('0x130')](db[_0x414e('0x11b')],{'as':_0x414e('0x17c'),'through':_0x414e('0x13a'),'foreignKey':_0x414e('0x1fe')});db[_0x414e('0x10a')][_0x414e('0x12d')](db[_0x414e('0x11b')],{'as':'User'});db[_0x414e('0x10a')][_0x414e('0x12d')](db[_0x414e('0x131')],{'onDelete':_0x414e('0x11d'),'as':_0x414e('0x16b')});db[_0x414e('0x10a')][_0x414e('0x12d')](db['WhatsappInteraction'],{'onDelete':_0x414e('0x11d'),'as':_0x414e('0x18b'),'foreignKey':_0x414e('0x1fe')});db[_0x414e('0x10a')][_0x414e('0x12d')](db['WhatsappAccount'],{'as':_0x414e('0x176'),'foreignKey':_0x414e('0x1fd')});db[_0x414e('0x10c')]['belongsTo'](db['WhatsappAccount'],{});db['WhatsappQueueReport'][_0x414e('0x12d')](db[_0x414e('0x147')],{'as':_0x414e('0x181'),'foreignKey':_0x414e('0x171')});db['WhatsappQueueReport'][_0x414e('0x12d')](db[_0x414e('0x131')],{'as':_0x414e('0x16b'),'foreignKey':_0x414e('0x177')});db[_0x414e('0x10c')][_0x414e('0x12d')](db[_0x414e('0x1bd')],{});db['WhatsappQueueReport'][_0x414e('0x12d')](db[_0x414e('0x110')],{});db[_0x414e('0x10c')][_0x414e('0x12d')](db['WhatsappMessage'],{});db['WhatsappQueueReport'][_0x414e('0x12d')](db[_0x414e('0x11b')],{});db[_0x414e('0x10e')]['belongsTo'](db[_0x414e('0x10a')],{});db[_0x414e('0x10e')][_0x414e('0x12d')](db[_0x414e('0x1bd')],{});db[_0x414e('0x10e')][_0x414e('0x12d')](db[_0x414e('0x151')],{'foreignKey':_0x414e('0x1ff'),'as':_0x414e('0x1ed')});db[_0x414e('0x10e')][_0x414e('0x12d')](db[_0x414e('0x151')],{'foreignKey':_0x414e('0x200'),'as':_0x414e('0x1eb')});db[_0x414e('0x10e')][_0x414e('0x12d')](db[_0x414e('0x110')],{'foreignKey':_0x414e('0x201'),'as':'ToQueue'});db[_0x414e('0x10e')][_0x414e('0x12d')](db[_0x414e('0x11b')],{'foreignKey':_0x414e('0x1e5'),'as':_0x414e('0x1e6')});db[_0x414e('0x10e')][_0x414e('0x12d')](db[_0x414e('0x11b')],{'foreignKey':'ToUserId','as':_0x414e('0x1e8')});db[_0x414e('0x110')][_0x414e('0x130')](db['User'],{'as':'Agents','through':'UserWhatsappQueue','foreignKey':_0x414e('0x202')});db[_0x414e('0x110')][_0x414e('0x130')](db['Team'],{'through':_0x414e('0x1e0'),'as':'Teams'});db[_0x414e('0x203')][_0x414e('0x12d')](db[_0x414e('0x11b')],{'as':_0x414e('0x204'),'foreignKey':'UserId','onDelete':_0x414e('0x11d'),'hooks':!![]});db['CloudProvider'][_0x414e('0x11c')](db[_0x414e('0x3b')],{'as':_0x414e('0x16f'),'onDelete':'restrict'});db['CloudProvider'][_0x414e('0x11c')](db[_0x414e('0x3d')],{'as':_0x414e('0x205'),'onDelete':_0x414e('0x16e')});module[_0x414e('0x206')]={'db':db,'dbH':dbH}; \ No newline at end of file diff --git a/server/routes.js b/server/routes.js index bea9ec1..2e305ce 100644 --- a/server/routes.js +++ b/server/routes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2eb2=['/api/analytics/custom_reports','./api/analyticCustomReport','/api/analytics/default_reports','./api/analyticDefaultReport','./api/analyticExtractedReport','./api/analyticMetric','/api/analytics/field_reports','./api/analyticFieldReport','/api/analytics/tree_reports','./api/analyticTreeReport','/api/integrations/salesforce/accounts','./api/intSalesforceAccount','./api/intSalesforceConfiguration','/api/integrations/salesforce/fields','/api/integrations/sugarcrm/accounts','./api/intSugarcrmAccount','/api/integrations/sugarcrm/configurations','/api/integrations/sugarcrm/fields','./api/intSugarcrmField','/api/integrations/desk/accounts','./api/intDeskAccount','/api/integrations/desk/configurations','./api/intDeskConfiguration','/api/integrations/desk/fields','./api/intDeskField','/api/integrations/zoho/accounts','./api/intZohoAccount','/api/integrations/zoho/configurations','./api/intZohoConfiguration','/api/integrations/zoho/fields','./api/intZohoField','/api/integrations/zendesk/accounts','./api/intZendeskAccount','/api/integrations/zendesk/configurations','./api/intZendeskConfiguration','/api/integrations/zendesk/fields','./api/intZendeskField','./api/intFreshdeskAccount','/api/integrations/freshdesk/configurations','./api/intFreshdeskConfiguration','./api/intFreshdeskField','/api/integrations/vtiger/configurations','./api/intVtigerConfiguration','/api/integrations/vtiger/fields','./api/intVtigerField','/api/integrations/servicenow/accounts','./api/intServicenowAccount','/api/integrations/servicenow/configurations','./api/intServicenowConfiguration','/api/integrations/servicenow/fields','/api/integrations/dynamics365/accounts','./api/intDynamics365Account','/api/integrations/dynamics365/configurations','./api/intDynamics365Field','./api/intFreshsalesAccount','/api/integrations/freshsales/fields','./api/intFreshsalesField','/api/networks','./api/network','/api/chat/reports/queue','/api/chat/internal/messages','./api/chatInternalMessage','/api/jscripty/answers/reports','./api/jscriptyAnswerReport','/api/jscripty/questions/reports','./api/jscriptyQuestionReport','./api/jscriptySessionReport','./api/smsQueueReport','/api/square/reports','./api/squareReport','/api/square/details/reports','/api/jscripty/projects','./api/jscriptyProject','./api/setting','/api/square/odbc','./api/squareProject','/api/square/recordings','./api/squareRecording','/api/square/messages','./api/squareMessage','/api/teams','./api/team','/api/license','./api/license','/api/campaigns','./api/campaign','/api/migrations','./api/migration','/api/plugins','/api/mail/reports/transfer','./api/mailTransferReport','/api/chat/reports/transfer','/api/fax/reports/transfer','./api/faxTransferReport','/api/cm/lists','/api/voice/prefixes','./api/voicePrefix','/api/userProfiles','./api/userProfile','./api/userProfileSection','/api/userProfile/resources','./api/userProfileResource','./api/userNotification','/api/whatsapp/accounts','/api/whatsapp/applications','./api/whatsappApplication','./api/whatsappInteraction','/api/whatsapp/messages','/api/whatsapp/reports/transfer','./api/whatsappTransferReport','/api/whatsapp/queues','./api/whatsappQueue','/api/cloudProviders','./api/cloudProvider','/api/realtime','/api/user-settings','./api/user-setting','/api/auth/local','./api/authLocal','/api/auth/google','./api/authGoogle','/api/auth/activedirectory','./api/authActiveDirectory','/api/jira','./api/jira','/api/rpc','./api/rpc','/api/version','/api/system','/api/pm2','./api/pm2','/api/webbar','./api/webbar','/apidoc','root','/www','static','join','/snippet','snippet','3.0.0','/:url(api|auth|components|app|bower_components|assets)/*','get','sendFile','appPath','/index.html','express','./errors','./config/environment','./utils/client-side-logger','setupLoggers','./api/client-side-logs','/api/users','./api/user','use','/api/voice/chanspy','./api/voiceChanSpy','/api/voice/contexts','./api/voiceContext','/api/voice/extensions','./api/voiceExtension','./api/voiceMusicOnHold','./api/voiceQueue','/api/voice/recordings','./api/voiceRecording','./api/screenRecording','/api/voice/mails','./api/voiceMail','./api/voiceMailMessage','/api/voice/calls/reports','/api/voice/dials/reports','./api/voiceAgentReport','./api/voiceQueueReport','./api/memberReport','/api/trunks','./api/trunk','./api/voiceTransferReport','/api/mail/out_servers','./api/mailServerOut','./api/mailAccount','/api/mail/queues','/api/mail/substatuses','./api/mailSubstatus','/api/mail/interactions','./api/mailInteraction','/api/mail/messages','/api/mail/applications','./api/mailApplication','/api/mail/reports/queue','/api/dashboards','./api/dashboard','/api/dashboards/items','./api/dashboardItem','/api/fax/accounts','./api/faxAccount','/api/fax/applications','./api/faxApplication','./api/faxInteraction','/api/fax/messages','./api/faxMessage','/api/fax/queues','./api/faxQueue','/api/fax/reports/queue','./api/faxQueueReport','/api/sms/accounts','./api/smsApplication','/api/sms/interactions','./api/smsInteraction','/api/sms/messages','./api/smsMessage','/api/sms/queues','./api/smsQueue','./api/openchannelAccount','./api/openchannelApplication','/api/openchannel/interactions','./api/openchannelInteraction','/api/openchannel/messages','./api/openchannelMessage','/api/openchannel/queues','./api/openchannelQueue','/api/chat/websites','/api/openchannel/reports/queue','./api/openchannelQueueReport','/api/chat/applications','./api/chatApplication','/api/chat/interactions','./api/chatInteraction','/api/chat/messages','./api/chatMessage','/api/chat/offline_messages','./api/chatOfflineMessage','/api/chat/queues','./api/chatQueue','./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/cmCustomField','/api/actions','./api/action','/api/automations','./api/automation','/api/canned_answers','./api/cannedAnswer','./api/disposition','./api/condition','/api/pauses','./api/pause','./api/cdr','/api/voiceQueuesLog','./api/voiceQueuesLog','/api/schedules','./api/schedule','./api/tag','/api/templates','./api/variable','./api/integration','/api/integrations/reports','./api/integrationReport'];(function(_0x5f09c5,_0x2bfca0){var _0x426ad9=function(_0x18fe5f){while(--_0x18fe5f){_0x5f09c5['push'](_0x5f09c5['shift']());}};_0x426ad9(++_0x2bfca0);}(_0x2eb2,0x19f));var _0x22eb=function(_0x28947d,_0x4cc9c6){_0x28947d=_0x28947d-0x0;var _0x12d2ee=_0x2eb2[_0x28947d];return _0x12d2ee;};'use strict';var path=require('path');var express=require(_0x22eb('0x0'));var errors=require(_0x22eb('0x1'));var config=require(_0x22eb('0x2'));var setupLoggers=require(_0x22eb('0x3'))[_0x22eb('0x4')];var clientSideLogs=require(_0x22eb('0x5'));exports['default']=function(_0x27732f){return setupLoggers(_0x27732f)['then'](function(){_0x27732f['use'](_0x22eb('0x6'),require(_0x22eb('0x7')));_0x27732f[_0x22eb('0x8')](_0x22eb('0x9'),require(_0x22eb('0xa')));_0x27732f[_0x22eb('0x8')](_0x22eb('0xb'),require(_0x22eb('0xc')));_0x27732f[_0x22eb('0x8')](_0x22eb('0xd'),require(_0x22eb('0xe')));_0x27732f[_0x22eb('0x8')]('/api/voice/mohs',require(_0x22eb('0xf')));_0x27732f['use']('/api/voice/queues',require(_0x22eb('0x10')));_0x27732f['use'](_0x22eb('0x11'),require(_0x22eb('0x12')));_0x27732f['use']('/api/screen/recordings',require(_0x22eb('0x13')));_0x27732f[_0x22eb('0x8')](_0x22eb('0x14'),require(_0x22eb('0x15')));_0x27732f[_0x22eb('0x8')]('/api/voice/mails/messages',require(_0x22eb('0x16')));_0x27732f['use'](_0x22eb('0x17'),require('./api/voiceCallReport'));_0x27732f[_0x22eb('0x8')](_0x22eb('0x18'),require('./api/voiceDialReport'));_0x27732f['use']('/api/voice/agents/reports',require(_0x22eb('0x19')));_0x27732f['use']('/api/voice/queues/reports',require(_0x22eb('0x1a')));_0x27732f['use']('/api/members/reports',require(_0x22eb('0x1b')));_0x27732f[_0x22eb('0x8')](_0x22eb('0x1c'),require(_0x22eb('0x1d')));_0x27732f[_0x22eb('0x8')]('/api/voice/transfers/reports',require(_0x22eb('0x1e')));_0x27732f[_0x22eb('0x8')](_0x22eb('0x1f'),require(_0x22eb('0x20')));_0x27732f[_0x22eb('0x8')]('/api/mail/accounts',require(_0x22eb('0x21')));_0x27732f[_0x22eb('0x8')](_0x22eb('0x22'),require('./api/mailQueue'));_0x27732f['use'](_0x22eb('0x23'),require(_0x22eb('0x24')));_0x27732f[_0x22eb('0x8')](_0x22eb('0x25'),require(_0x22eb('0x26')));_0x27732f[_0x22eb('0x8')](_0x22eb('0x27'),require('./api/mailMessage'));_0x27732f[_0x22eb('0x8')](_0x22eb('0x28'),require(_0x22eb('0x29')));_0x27732f[_0x22eb('0x8')](_0x22eb('0x2a'),require('./api/mailQueueReport'));_0x27732f[_0x22eb('0x8')](_0x22eb('0x2b'),require(_0x22eb('0x2c')));_0x27732f['use'](_0x22eb('0x2d'),require(_0x22eb('0x2e')));_0x27732f['use'](_0x22eb('0x2f'),require(_0x22eb('0x30')));_0x27732f[_0x22eb('0x8')](_0x22eb('0x31'),require(_0x22eb('0x32')));_0x27732f['use']('/api/fax/interactions',require(_0x22eb('0x33')));_0x27732f[_0x22eb('0x8')](_0x22eb('0x34'),require(_0x22eb('0x35')));_0x27732f[_0x22eb('0x8')](_0x22eb('0x36'),require(_0x22eb('0x37')));_0x27732f[_0x22eb('0x8')](_0x22eb('0x38'),require(_0x22eb('0x39')));_0x27732f[_0x22eb('0x8')](_0x22eb('0x3a'),require('./api/smsAccount'));_0x27732f[_0x22eb('0x8')]('/api/sms/applications',require(_0x22eb('0x3b')));_0x27732f[_0x22eb('0x8')](_0x22eb('0x3c'),require(_0x22eb('0x3d')));_0x27732f[_0x22eb('0x8')](_0x22eb('0x3e'),require(_0x22eb('0x3f')));_0x27732f[_0x22eb('0x8')](_0x22eb('0x40'),require(_0x22eb('0x41')));_0x27732f['use']('/api/openchannel/accounts',require(_0x22eb('0x42')));_0x27732f['use']('/api/openchannel/applications',require(_0x22eb('0x43')));_0x27732f[_0x22eb('0x8')](_0x22eb('0x44'),require(_0x22eb('0x45')));_0x27732f[_0x22eb('0x8')](_0x22eb('0x46'),require(_0x22eb('0x47')));_0x27732f[_0x22eb('0x8')](_0x22eb('0x48'),require(_0x22eb('0x49')));_0x27732f['use'](_0x22eb('0x4a'),require('./api/chatWebsite'));_0x27732f['use'](_0x22eb('0x4b'),require(_0x22eb('0x4c')));_0x27732f['use'](_0x22eb('0x4d'),require(_0x22eb('0x4e')));_0x27732f[_0x22eb('0x8')](_0x22eb('0x4f'),require(_0x22eb('0x50')));_0x27732f['use'](_0x22eb('0x51'),require(_0x22eb('0x52')));_0x27732f['use'](_0x22eb('0x53'),require(_0x22eb('0x54')));_0x27732f[_0x22eb('0x8')](_0x22eb('0x55'),require(_0x22eb('0x56')));_0x27732f['use']('/api/chat/groups',require(_0x22eb('0x57')));_0x27732f[_0x22eb('0x8')]('/api/chat/proactive_actions',require(_0x22eb('0x58')));_0x27732f[_0x22eb('0x8')](_0x22eb('0x59'),require('./api/cmCompany'));_0x27732f[_0x22eb('0x8')](_0x22eb('0x5a'),require(_0x22eb('0x5b')));_0x27732f[_0x22eb('0x8')](_0x22eb('0x5c'),require(_0x22eb('0x5d')));_0x27732f['use'](_0x22eb('0x5e'),require(_0x22eb('0x5f')));_0x27732f['use'](_0x22eb('0x60'),require(_0x22eb('0x61')));_0x27732f[_0x22eb('0x8')](_0x22eb('0x62'),require(_0x22eb('0x63')));_0x27732f[_0x22eb('0x8')](_0x22eb('0x64'),require(_0x22eb('0x65')));_0x27732f[_0x22eb('0x8')](_0x22eb('0x66'),require(_0x22eb('0x67')));_0x27732f[_0x22eb('0x8')](_0x22eb('0x68'),require(_0x22eb('0x69')));_0x27732f[_0x22eb('0x8')](_0x22eb('0x6a'),require(_0x22eb('0x6b')));_0x27732f[_0x22eb('0x8')]('/api/dispositions',require(_0x22eb('0x6c')));_0x27732f[_0x22eb('0x8')]('/api/conditions',require(_0x22eb('0x6d')));_0x27732f[_0x22eb('0x8')]('/api/intervals',require('./api/interval'));_0x27732f['use'](_0x22eb('0x6e'),require(_0x22eb('0x6f')));_0x27732f['use']('/api/cdr',require(_0x22eb('0x70')));_0x27732f[_0x22eb('0x8')](_0x22eb('0x71'),require(_0x22eb('0x72')));_0x27732f[_0x22eb('0x8')](_0x22eb('0x73'),require(_0x22eb('0x74')));_0x27732f[_0x22eb('0x8')]('/api/sounds',require('./api/sound'));_0x27732f[_0x22eb('0x8')]('/api/tags',require(_0x22eb('0x75')));_0x27732f['use'](_0x22eb('0x76'),require('./api/template'));_0x27732f['use']('/api/triggers',require('./api/trigger'));_0x27732f[_0x22eb('0x8')]('/api/variables',require(_0x22eb('0x77')));_0x27732f[_0x22eb('0x8')]('/api/integrations',require(_0x22eb('0x78')));_0x27732f['use'](_0x22eb('0x79'),require(_0x22eb('0x7a')));_0x27732f[_0x22eb('0x8')](_0x22eb('0x7b'),require(_0x22eb('0x7c')));_0x27732f[_0x22eb('0x8')](_0x22eb('0x7d'),require(_0x22eb('0x7e')));_0x27732f[_0x22eb('0x8')]('/api/analytics/extracted_reports',require(_0x22eb('0x7f')));_0x27732f[_0x22eb('0x8')]('/api/analytics/metrics',require(_0x22eb('0x80')));_0x27732f[_0x22eb('0x8')](_0x22eb('0x81'),require(_0x22eb('0x82')));_0x27732f['use'](_0x22eb('0x83'),require(_0x22eb('0x84')));_0x27732f[_0x22eb('0x8')](_0x22eb('0x85'),require(_0x22eb('0x86')));_0x27732f[_0x22eb('0x8')]('/api/integrations/salesforce/configurations',require(_0x22eb('0x87')));_0x27732f['use'](_0x22eb('0x88'),require('./api/intSalesforceField'));_0x27732f[_0x22eb('0x8')](_0x22eb('0x89'),require(_0x22eb('0x8a')));_0x27732f[_0x22eb('0x8')](_0x22eb('0x8b'),require('./api/intSugarcrmConfiguration'));_0x27732f['use'](_0x22eb('0x8c'),require(_0x22eb('0x8d')));_0x27732f['use'](_0x22eb('0x8e'),require(_0x22eb('0x8f')));_0x27732f[_0x22eb('0x8')](_0x22eb('0x90'),require(_0x22eb('0x91')));_0x27732f[_0x22eb('0x8')](_0x22eb('0x92'),require(_0x22eb('0x93')));_0x27732f[_0x22eb('0x8')](_0x22eb('0x94'),require(_0x22eb('0x95')));_0x27732f['use'](_0x22eb('0x96'),require(_0x22eb('0x97')));_0x27732f[_0x22eb('0x8')](_0x22eb('0x98'),require(_0x22eb('0x99')));_0x27732f[_0x22eb('0x8')](_0x22eb('0x9a'),require(_0x22eb('0x9b')));_0x27732f[_0x22eb('0x8')](_0x22eb('0x9c'),require(_0x22eb('0x9d')));_0x27732f[_0x22eb('0x8')](_0x22eb('0x9e'),require(_0x22eb('0x9f')));_0x27732f['use']('/api/integrations/freshdesk/accounts',require(_0x22eb('0xa0')));_0x27732f[_0x22eb('0x8')](_0x22eb('0xa1'),require(_0x22eb('0xa2')));_0x27732f[_0x22eb('0x8')]('/api/integrations/freshdesk/fields',require(_0x22eb('0xa3')));_0x27732f[_0x22eb('0x8')]('/api/integrations/vtiger/accounts',require('./api/intVtigerAccount'));_0x27732f[_0x22eb('0x8')](_0x22eb('0xa4'),require(_0x22eb('0xa5')));_0x27732f[_0x22eb('0x8')](_0x22eb('0xa6'),require(_0x22eb('0xa7')));_0x27732f[_0x22eb('0x8')](_0x22eb('0xa8'),require(_0x22eb('0xa9')));_0x27732f[_0x22eb('0x8')](_0x22eb('0xaa'),require(_0x22eb('0xab')));_0x27732f[_0x22eb('0x8')](_0x22eb('0xac'),require('./api/intServicenowField'));_0x27732f[_0x22eb('0x8')](_0x22eb('0xad'),require(_0x22eb('0xae')));_0x27732f['use'](_0x22eb('0xaf'),require('./api/intDynamics365Configuration'));_0x27732f[_0x22eb('0x8')]('/api/integrations/dynamics365/fields',require(_0x22eb('0xb0')));_0x27732f[_0x22eb('0x8')]('/api/integrations/freshsales/accounts',require(_0x22eb('0xb1')));_0x27732f[_0x22eb('0x8')]('/api/integrations/freshsales/configurations',require('./api/intFreshsalesConfiguration'));_0x27732f[_0x22eb('0x8')](_0x22eb('0xb2'),require(_0x22eb('0xb3')));_0x27732f[_0x22eb('0x8')](_0x22eb('0xb4'),require(_0x22eb('0xb5')));_0x27732f['use'](_0x22eb('0xb6'),require('./api/chatQueueReport'));_0x27732f['use'](_0x22eb('0xb7'),require(_0x22eb('0xb8')));_0x27732f[_0x22eb('0x8')](_0x22eb('0xb9'),require(_0x22eb('0xba')));_0x27732f[_0x22eb('0x8')](_0x22eb('0xbb'),require(_0x22eb('0xbc')));_0x27732f['use']('/api/jscripty/sessions/reports',require(_0x22eb('0xbd')));_0x27732f[_0x22eb('0x8')]('/api/sms/reports/queue',require(_0x22eb('0xbe')));_0x27732f[_0x22eb('0x8')](_0x22eb('0xbf'),require(_0x22eb('0xc0')));_0x27732f[_0x22eb('0x8')](_0x22eb('0xc1'),require('./api/squareReportDetail'));_0x27732f[_0x22eb('0x8')](_0x22eb('0xc2'),require(_0x22eb('0xc3')));_0x27732f['use']('/api/settings',require(_0x22eb('0xc4')));_0x27732f[_0x22eb('0x8')](_0x22eb('0xc5'),require('./api/squareOdbc'));_0x27732f[_0x22eb('0x8')]('/api/square/projects',require(_0x22eb('0xc6')));_0x27732f[_0x22eb('0x8')](_0x22eb('0xc7'),require(_0x22eb('0xc8')));_0x27732f['use'](_0x22eb('0xc9'),require(_0x22eb('0xca')));_0x27732f[_0x22eb('0x8')](_0x22eb('0xcb'),require(_0x22eb('0xcc')));_0x27732f[_0x22eb('0x8')](_0x22eb('0xcd'),require(_0x22eb('0xce')));_0x27732f[_0x22eb('0x8')](_0x22eb('0xcf'),require(_0x22eb('0xd0')));_0x27732f['use'](_0x22eb('0xd1'),require(_0x22eb('0xd2')));_0x27732f['use']('/api/attachments',require('./api/attachment'));_0x27732f[_0x22eb('0x8')](_0x22eb('0xd3'),require('./api/plugin'));_0x27732f[_0x22eb('0x8')](_0x22eb('0xd4'),require(_0x22eb('0xd5')));_0x27732f[_0x22eb('0x8')](_0x22eb('0xd6'),require('./api/chatTransferReport'));_0x27732f['use'](_0x22eb('0xd7'),require(_0x22eb('0xd8')));_0x27732f[_0x22eb('0x8')]('/api/openchannel/reports/transfer',require('./api/openchannelTransferReport'));_0x27732f[_0x22eb('0x8')]('/api/sms/reports/transfer',require('./api/smsTransferReport'));_0x27732f[_0x22eb('0x8')](_0x22eb('0xd9'),require('./api/cmList'));_0x27732f['use'](_0x22eb('0xda'),require(_0x22eb('0xdb')));_0x27732f['use'](_0x22eb('0xdc'),require(_0x22eb('0xdd')));_0x27732f[_0x22eb('0x8')]('/api/userProfile/sections',require(_0x22eb('0xde')));_0x27732f[_0x22eb('0x8')](_0x22eb('0xdf'),require(_0x22eb('0xe0')));_0x27732f[_0x22eb('0x8')]('/api/userNotifications',require(_0x22eb('0xe1')));_0x27732f[_0x22eb('0x8')](_0x22eb('0xe2'),require('./api/whatsappAccount'));_0x27732f['use'](_0x22eb('0xe3'),require(_0x22eb('0xe4')));_0x27732f[_0x22eb('0x8')]('/api/whatsapp/interactions',require(_0x22eb('0xe5')));_0x27732f[_0x22eb('0x8')](_0x22eb('0xe6'),require('./api/whatsappMessage'));_0x27732f[_0x22eb('0x8')]('/api/whatsapp/reports/queue',require('./api/whatsappQueueReport'));_0x27732f[_0x22eb('0x8')](_0x22eb('0xe7'),require(_0x22eb('0xe8')));_0x27732f['use'](_0x22eb('0xe9'),require(_0x22eb('0xea')));_0x27732f[_0x22eb('0x8')](_0x22eb('0xeb'),require(_0x22eb('0xec')));_0x27732f['use'](_0x22eb('0xed'),require('./api/realtime'));_0x27732f[_0x22eb('0x8')](_0x22eb('0xee'),require(_0x22eb('0xef')));_0x27732f['use'](_0x22eb('0xf0'),require(_0x22eb('0xf1')));_0x27732f[_0x22eb('0x8')](_0x22eb('0xf2'),require(_0x22eb('0xf3')));_0x27732f[_0x22eb('0x8')](_0x22eb('0xf4'),require(_0x22eb('0xf5')));_0x27732f[_0x22eb('0x8')](_0x22eb('0xf6'),require(_0x22eb('0xf7')));_0x27732f['use'](_0x22eb('0xf8'),require(_0x22eb('0xf9')));_0x27732f[_0x22eb('0x8')](_0x22eb('0xfa'),require('./api/version'));_0x27732f[_0x22eb('0x8')](_0x22eb('0xfb'),require('./api/system'));_0x27732f[_0x22eb('0x8')](_0x22eb('0xfc'),require(_0x22eb('0xfd')));_0x27732f[_0x22eb('0x8')](_0x22eb('0xfe'),require(_0x22eb('0xff')));_0x27732f[_0x22eb('0x8')]('/api/logs',clientSideLogs);_0x27732f[_0x22eb('0x8')](_0x22eb('0x100'),express['static'](path['join'](config[_0x22eb('0x101')],_0x22eb('0x100'))));_0x27732f[_0x22eb('0x8')](_0x22eb('0x102'),express[_0x22eb('0x103')](path['join'](config['root'],_0x22eb('0x102'))));_0x27732f[_0x22eb('0x8')]('/demo',express[_0x22eb('0x103')](path[_0x22eb('0x104')](config[_0x22eb('0x101')],'/demo')));_0x27732f[_0x22eb('0x8')](_0x22eb('0x105'),express[_0x22eb('0x103')](path[_0x22eb('0x104')](config[_0x22eb('0x101')],_0x22eb('0x106'),_0x22eb('0x107'))));_0x27732f[_0x22eb('0x8')]('/plugins',express['static'](path['join'](config[_0x22eb('0x101')],'/server/files/plugins')));_0x27732f['route'](_0x22eb('0x108'))[_0x22eb('0x109')](errors[0x194]);_0x27732f['route']('/*')[_0x22eb('0x109')](function(_0x5099fb,_0x210b08){_0x210b08[_0x22eb('0x10a')](path['resolve'](_0x27732f[_0x22eb('0x109')](_0x22eb('0x10b'))+_0x22eb('0x10c')));});return _0x27732f;});}; \ No newline at end of file +var _0xbd50=['./api/intFreshdeskConfiguration','./api/intFreshdeskField','/api/integrations/vtiger/accounts','./api/intVtigerAccount','./api/intVtigerConfiguration','./api/intVtigerField','./api/intServicenowAccount','/api/integrations/servicenow/configurations','./api/intServicenowConfiguration','/api/integrations/servicenow/fields','./api/intServicenowField','/api/integrations/dynamics365/accounts','/api/integrations/dynamics365/configurations','./api/intDynamics365Configuration','./api/intDynamics365Field','/api/integrations/freshsales/accounts','./api/intFreshsalesAccount','/api/integrations/freshsales/configurations','./api/intFreshsalesConfiguration','/api/integrations/freshsales/fields','./api/intFreshsalesField','/api/networks','./api/network','/api/chat/reports/queue','./api/chatQueueReport','/api/chat/internal/messages','/api/jscripty/answers/reports','./api/jscriptyQuestionReport','./api/jscriptySessionReport','/api/sms/reports/queue','./api/smsQueueReport','/api/square/reports','./api/squareReport','/api/square/details/reports','/api/jscripty/projects','/api/settings','/api/square/odbc','./api/squareProject','/api/square/recordings','./api/squareRecording','/api/square/messages','./api/squareMessage','/api/teams','./api/team','/api/license','./api/license','./api/campaign','/api/migrations','./api/migration','/api/attachments','/api/plugins','./api/plugin','/api/mail/reports/transfer','./api/mailTransferReport','/api/fax/reports/transfer','./api/faxTransferReport','/api/openchannel/reports/transfer','./api/openchannelTransferReport','/api/sms/reports/transfer','./api/smsTransferReport','/api/cm/lists','./api/cmList','/api/voice/prefixes','./api/voicePrefix','/api/userProfiles','./api/userProfile','/api/userProfile/sections','./api/userProfileSection','/api/userProfile/resources','./api/userProfileResource','/api/userNotifications','./api/userNotification','/api/whatsapp/accounts','./api/whatsappAccount','/api/whatsapp/applications','./api/whatsappApplication','/api/whatsapp/interactions','./api/whatsappInteraction','/api/whatsapp/messages','./api/whatsappMessage','/api/whatsapp/reports/queue','./api/whatsappQueueReport','/api/whatsapp/reports/transfer','./api/whatsappTransferReport','/api/whatsapp/queues','/api/cloudProviders','./api/cloudProvider','/api/realtime','./api/realtime','/api/user-settings','./api/user-setting','/api/auth/local','./api/authLocal','/api/auth/google','./api/authGoogle','/api/auth/activedirectory','./api/authActiveDirectory','/api/jira','./api/jira','/api/rpc','./api/rpc','/api/version','./api/version','/api/system','./api/system','/api/pm2','./api/pm2','/api/webbar','./api/webbar','/api/logs','/apidoc','static','join','root','/www','/demo','/snippet','snippet','3.0.0','/server/files/plugins','route','/:url(api|auth|components|app|bower_components|assets)/*','resolve','get','appPath','/index.html','path','express','./errors','./utils/client-side-logger','setupLoggers','./api/client-side-logs','default','./api/user','use','/api/voice/chanspy','./api/voiceChanSpy','/api/voice/extensions','./api/voiceExtension','/api/voice/mohs','./api/voiceMusicOnHold','/api/voice/queues','./api/voiceQueue','/api/voice/recordings','./api/voiceRecording','./api/screenRecording','/api/voice/mails','./api/voiceMail','/api/voice/mails/messages','./api/voiceMailMessage','./api/voiceCallReport','./api/voiceDialReport','/api/voice/agents/reports','./api/voiceAgentReport','/api/voice/queues/reports','./api/voiceQueueReport','/api/members/reports','./api/memberReport','/api/trunks','./api/trunk','/api/voice/transfers/reports','./api/voiceTransferReport','/api/mail/out_servers','./api/mailServerOut','./api/mailQueue','/api/mail/substatuses','./api/mailSubstatus','./api/mailInteraction','/api/mail/messages','/api/mail/reports/queue','./api/mailQueueReport','/api/dashboards','/api/dashboards/items','./api/dashboardItem','/api/fax/accounts','./api/faxAccount','/api/fax/applications','./api/faxApplication','/api/fax/interactions','./api/faxInteraction','/api/fax/messages','/api/fax/queues','/api/fax/reports/queue','/api/sms/accounts','./api/smsAccount','./api/smsApplication','/api/sms/interactions','./api/smsInteraction','/api/sms/messages','./api/smsQueue','/api/openchannel/accounts','./api/openchannelAccount','/api/openchannel/applications','./api/openchannelApplication','/api/openchannel/interactions','./api/openchannelInteraction','/api/openchannel/messages','./api/openchannelMessage','/api/openchannel/queues','./api/openchannelQueue','./api/chatWebsite','/api/openchannel/reports/queue','./api/openchannelQueueReport','/api/chat/applications','./api/chatApplication','/api/chat/interactions','./api/chatInteraction','/api/chat/messages','./api/chatMessage','/api/chat/offline_messages','/api/chat/queues','./api/chatQueue','/api/chat/groups','./api/chatGroup','/api/chat/proactive_actions','./api/chatProactiveAction','/api/cm/companies','./api/cmCompany','/api/cm/contacts','./api/cmContact','./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/automations','./api/automation','/api/conditions','/api/intervals','./api/interval','/api/pauses','/api/cdr','./api/cdr','/api/voiceQueuesLog','./api/voiceQueuesLog','/api/schedules','./api/schedule','./api/sound','/api/tags','/api/templates','./api/template','/api/triggers','/api/variables','/api/integrations','./api/integration','/api/integrations/reports','/api/analytics/custom_reports','./api/analyticDefaultReport','/api/analytics/extracted_reports','./api/analyticExtractedReport','/api/analytics/metrics','/api/analytics/field_reports','./api/analyticFieldReport','./api/analyticTreeReport','/api/integrations/salesforce/accounts','./api/intSalesforceAccount','/api/integrations/salesforce/fields','./api/intSalesforceField','./api/intSugarcrmAccount','./api/intSugarcrmConfiguration','./api/intSugarcrmField','/api/integrations/desk/accounts','./api/intDeskAccount','/api/integrations/desk/configurations','./api/intDeskConfiguration','./api/intDeskField','/api/integrations/zoho/accounts','/api/integrations/zoho/configurations','/api/integrations/zoho/fields','./api/intZohoField','/api/integrations/zendesk/accounts','./api/intZendeskAccount','/api/integrations/zendesk/configurations','/api/integrations/zendesk/fields','./api/intZendeskField','/api/integrations/freshdesk/accounts'];(function(_0x1cc8fe,_0x105328){var _0x230054=function(_0x1a1b56){while(--_0x1a1b56){_0x1cc8fe['push'](_0x1cc8fe['shift']());}};_0x230054(++_0x105328);}(_0xbd50,0x196));var _0x0bd5=function(_0x29d86e,_0x4fbf48){_0x29d86e=_0x29d86e-0x0;var _0xca253e=_0xbd50[_0x29d86e];return _0xca253e;};'use strict';var path=require(_0x0bd5('0x0'));var express=require(_0x0bd5('0x1'));var errors=require(_0x0bd5('0x2'));var config=require('./config/environment');var setupLoggers=require(_0x0bd5('0x3'))[_0x0bd5('0x4')];var clientSideLogs=require(_0x0bd5('0x5'));exports[_0x0bd5('0x6')]=function(_0x15620d){return setupLoggers(_0x15620d)['then'](function(){_0x15620d['use']('/api/users',require(_0x0bd5('0x7')));_0x15620d[_0x0bd5('0x8')](_0x0bd5('0x9'),require(_0x0bd5('0xa')));_0x15620d[_0x0bd5('0x8')]('/api/voice/contexts',require('./api/voiceContext'));_0x15620d[_0x0bd5('0x8')](_0x0bd5('0xb'),require(_0x0bd5('0xc')));_0x15620d['use'](_0x0bd5('0xd'),require(_0x0bd5('0xe')));_0x15620d['use'](_0x0bd5('0xf'),require(_0x0bd5('0x10')));_0x15620d['use'](_0x0bd5('0x11'),require(_0x0bd5('0x12')));_0x15620d[_0x0bd5('0x8')]('/api/screen/recordings',require(_0x0bd5('0x13')));_0x15620d[_0x0bd5('0x8')](_0x0bd5('0x14'),require(_0x0bd5('0x15')));_0x15620d[_0x0bd5('0x8')](_0x0bd5('0x16'),require(_0x0bd5('0x17')));_0x15620d[_0x0bd5('0x8')]('/api/voice/calls/reports',require(_0x0bd5('0x18')));_0x15620d[_0x0bd5('0x8')]('/api/voice/dials/reports',require(_0x0bd5('0x19')));_0x15620d[_0x0bd5('0x8')](_0x0bd5('0x1a'),require(_0x0bd5('0x1b')));_0x15620d['use'](_0x0bd5('0x1c'),require(_0x0bd5('0x1d')));_0x15620d[_0x0bd5('0x8')](_0x0bd5('0x1e'),require(_0x0bd5('0x1f')));_0x15620d[_0x0bd5('0x8')](_0x0bd5('0x20'),require(_0x0bd5('0x21')));_0x15620d[_0x0bd5('0x8')](_0x0bd5('0x22'),require(_0x0bd5('0x23')));_0x15620d[_0x0bd5('0x8')](_0x0bd5('0x24'),require(_0x0bd5('0x25')));_0x15620d['use']('/api/mail/accounts',require('./api/mailAccount'));_0x15620d['use']('/api/mail/queues',require(_0x0bd5('0x26')));_0x15620d[_0x0bd5('0x8')](_0x0bd5('0x27'),require(_0x0bd5('0x28')));_0x15620d[_0x0bd5('0x8')]('/api/mail/interactions',require(_0x0bd5('0x29')));_0x15620d[_0x0bd5('0x8')](_0x0bd5('0x2a'),require('./api/mailMessage'));_0x15620d[_0x0bd5('0x8')]('/api/mail/applications',require('./api/mailApplication'));_0x15620d[_0x0bd5('0x8')](_0x0bd5('0x2b'),require(_0x0bd5('0x2c')));_0x15620d['use'](_0x0bd5('0x2d'),require('./api/dashboard'));_0x15620d[_0x0bd5('0x8')](_0x0bd5('0x2e'),require(_0x0bd5('0x2f')));_0x15620d[_0x0bd5('0x8')](_0x0bd5('0x30'),require(_0x0bd5('0x31')));_0x15620d[_0x0bd5('0x8')](_0x0bd5('0x32'),require(_0x0bd5('0x33')));_0x15620d[_0x0bd5('0x8')](_0x0bd5('0x34'),require(_0x0bd5('0x35')));_0x15620d[_0x0bd5('0x8')](_0x0bd5('0x36'),require('./api/faxMessage'));_0x15620d[_0x0bd5('0x8')](_0x0bd5('0x37'),require('./api/faxQueue'));_0x15620d[_0x0bd5('0x8')](_0x0bd5('0x38'),require('./api/faxQueueReport'));_0x15620d[_0x0bd5('0x8')](_0x0bd5('0x39'),require(_0x0bd5('0x3a')));_0x15620d[_0x0bd5('0x8')]('/api/sms/applications',require(_0x0bd5('0x3b')));_0x15620d[_0x0bd5('0x8')](_0x0bd5('0x3c'),require(_0x0bd5('0x3d')));_0x15620d[_0x0bd5('0x8')](_0x0bd5('0x3e'),require('./api/smsMessage'));_0x15620d[_0x0bd5('0x8')]('/api/sms/queues',require(_0x0bd5('0x3f')));_0x15620d[_0x0bd5('0x8')](_0x0bd5('0x40'),require(_0x0bd5('0x41')));_0x15620d[_0x0bd5('0x8')](_0x0bd5('0x42'),require(_0x0bd5('0x43')));_0x15620d[_0x0bd5('0x8')](_0x0bd5('0x44'),require(_0x0bd5('0x45')));_0x15620d[_0x0bd5('0x8')](_0x0bd5('0x46'),require(_0x0bd5('0x47')));_0x15620d['use'](_0x0bd5('0x48'),require(_0x0bd5('0x49')));_0x15620d['use']('/api/chat/websites',require(_0x0bd5('0x4a')));_0x15620d[_0x0bd5('0x8')](_0x0bd5('0x4b'),require(_0x0bd5('0x4c')));_0x15620d[_0x0bd5('0x8')](_0x0bd5('0x4d'),require(_0x0bd5('0x4e')));_0x15620d[_0x0bd5('0x8')](_0x0bd5('0x4f'),require(_0x0bd5('0x50')));_0x15620d[_0x0bd5('0x8')](_0x0bd5('0x51'),require(_0x0bd5('0x52')));_0x15620d['use'](_0x0bd5('0x53'),require('./api/chatOfflineMessage'));_0x15620d[_0x0bd5('0x8')](_0x0bd5('0x54'),require(_0x0bd5('0x55')));_0x15620d[_0x0bd5('0x8')](_0x0bd5('0x56'),require(_0x0bd5('0x57')));_0x15620d['use'](_0x0bd5('0x58'),require(_0x0bd5('0x59')));_0x15620d[_0x0bd5('0x8')](_0x0bd5('0x5a'),require(_0x0bd5('0x5b')));_0x15620d[_0x0bd5('0x8')](_0x0bd5('0x5c'),require(_0x0bd5('0x5d')));_0x15620d[_0x0bd5('0x8')]('/api/cm/hopper',require(_0x0bd5('0x5e')));_0x15620d['use'](_0x0bd5('0x5f'),require(_0x0bd5('0x60')));_0x15620d['use'](_0x0bd5('0x61'),require(_0x0bd5('0x62')));_0x15620d[_0x0bd5('0x8')](_0x0bd5('0x63'),require(_0x0bd5('0x64')));_0x15620d[_0x0bd5('0x8')](_0x0bd5('0x65'),require('./api/cmCustomField'));_0x15620d['use'](_0x0bd5('0x66'),require('./api/action'));_0x15620d['use'](_0x0bd5('0x67'),require(_0x0bd5('0x68')));_0x15620d['use']('/api/canned_answers',require('./api/cannedAnswer'));_0x15620d[_0x0bd5('0x8')]('/api/dispositions',require('./api/disposition'));_0x15620d[_0x0bd5('0x8')](_0x0bd5('0x69'),require('./api/condition'));_0x15620d['use'](_0x0bd5('0x6a'),require(_0x0bd5('0x6b')));_0x15620d[_0x0bd5('0x8')](_0x0bd5('0x6c'),require('./api/pause'));_0x15620d[_0x0bd5('0x8')](_0x0bd5('0x6d'),require(_0x0bd5('0x6e')));_0x15620d[_0x0bd5('0x8')](_0x0bd5('0x6f'),require(_0x0bd5('0x70')));_0x15620d['use'](_0x0bd5('0x71'),require(_0x0bd5('0x72')));_0x15620d[_0x0bd5('0x8')]('/api/sounds',require(_0x0bd5('0x73')));_0x15620d[_0x0bd5('0x8')](_0x0bd5('0x74'),require('./api/tag'));_0x15620d[_0x0bd5('0x8')](_0x0bd5('0x75'),require(_0x0bd5('0x76')));_0x15620d[_0x0bd5('0x8')](_0x0bd5('0x77'),require('./api/trigger'));_0x15620d[_0x0bd5('0x8')](_0x0bd5('0x78'),require('./api/variable'));_0x15620d[_0x0bd5('0x8')](_0x0bd5('0x79'),require(_0x0bd5('0x7a')));_0x15620d[_0x0bd5('0x8')](_0x0bd5('0x7b'),require('./api/integrationReport'));_0x15620d[_0x0bd5('0x8')](_0x0bd5('0x7c'),require('./api/analyticCustomReport'));_0x15620d[_0x0bd5('0x8')]('/api/analytics/default_reports',require(_0x0bd5('0x7d')));_0x15620d[_0x0bd5('0x8')](_0x0bd5('0x7e'),require(_0x0bd5('0x7f')));_0x15620d['use'](_0x0bd5('0x80'),require('./api/analyticMetric'));_0x15620d['use'](_0x0bd5('0x81'),require(_0x0bd5('0x82')));_0x15620d[_0x0bd5('0x8')]('/api/analytics/tree_reports',require(_0x0bd5('0x83')));_0x15620d['use'](_0x0bd5('0x84'),require(_0x0bd5('0x85')));_0x15620d[_0x0bd5('0x8')]('/api/integrations/salesforce/configurations',require('./api/intSalesforceConfiguration'));_0x15620d['use'](_0x0bd5('0x86'),require(_0x0bd5('0x87')));_0x15620d[_0x0bd5('0x8')]('/api/integrations/sugarcrm/accounts',require(_0x0bd5('0x88')));_0x15620d[_0x0bd5('0x8')]('/api/integrations/sugarcrm/configurations',require(_0x0bd5('0x89')));_0x15620d['use']('/api/integrations/sugarcrm/fields',require(_0x0bd5('0x8a')));_0x15620d[_0x0bd5('0x8')](_0x0bd5('0x8b'),require(_0x0bd5('0x8c')));_0x15620d['use'](_0x0bd5('0x8d'),require(_0x0bd5('0x8e')));_0x15620d[_0x0bd5('0x8')]('/api/integrations/desk/fields',require(_0x0bd5('0x8f')));_0x15620d[_0x0bd5('0x8')](_0x0bd5('0x90'),require('./api/intZohoAccount'));_0x15620d['use'](_0x0bd5('0x91'),require('./api/intZohoConfiguration'));_0x15620d[_0x0bd5('0x8')](_0x0bd5('0x92'),require(_0x0bd5('0x93')));_0x15620d['use'](_0x0bd5('0x94'),require(_0x0bd5('0x95')));_0x15620d[_0x0bd5('0x8')](_0x0bd5('0x96'),require('./api/intZendeskConfiguration'));_0x15620d[_0x0bd5('0x8')](_0x0bd5('0x97'),require(_0x0bd5('0x98')));_0x15620d[_0x0bd5('0x8')](_0x0bd5('0x99'),require('./api/intFreshdeskAccount'));_0x15620d[_0x0bd5('0x8')]('/api/integrations/freshdesk/configurations',require(_0x0bd5('0x9a')));_0x15620d['use']('/api/integrations/freshdesk/fields',require(_0x0bd5('0x9b')));_0x15620d['use'](_0x0bd5('0x9c'),require(_0x0bd5('0x9d')));_0x15620d[_0x0bd5('0x8')]('/api/integrations/vtiger/configurations',require(_0x0bd5('0x9e')));_0x15620d[_0x0bd5('0x8')]('/api/integrations/vtiger/fields',require(_0x0bd5('0x9f')));_0x15620d[_0x0bd5('0x8')]('/api/integrations/servicenow/accounts',require(_0x0bd5('0xa0')));_0x15620d['use'](_0x0bd5('0xa1'),require(_0x0bd5('0xa2')));_0x15620d[_0x0bd5('0x8')](_0x0bd5('0xa3'),require(_0x0bd5('0xa4')));_0x15620d[_0x0bd5('0x8')](_0x0bd5('0xa5'),require('./api/intDynamics365Account'));_0x15620d[_0x0bd5('0x8')](_0x0bd5('0xa6'),require(_0x0bd5('0xa7')));_0x15620d['use']('/api/integrations/dynamics365/fields',require(_0x0bd5('0xa8')));_0x15620d[_0x0bd5('0x8')](_0x0bd5('0xa9'),require(_0x0bd5('0xaa')));_0x15620d[_0x0bd5('0x8')](_0x0bd5('0xab'),require(_0x0bd5('0xac')));_0x15620d[_0x0bd5('0x8')](_0x0bd5('0xad'),require(_0x0bd5('0xae')));_0x15620d[_0x0bd5('0x8')](_0x0bd5('0xaf'),require(_0x0bd5('0xb0')));_0x15620d[_0x0bd5('0x8')](_0x0bd5('0xb1'),require(_0x0bd5('0xb2')));_0x15620d[_0x0bd5('0x8')](_0x0bd5('0xb3'),require('./api/chatInternalMessage'));_0x15620d[_0x0bd5('0x8')](_0x0bd5('0xb4'),require('./api/jscriptyAnswerReport'));_0x15620d[_0x0bd5('0x8')]('/api/jscripty/questions/reports',require(_0x0bd5('0xb5')));_0x15620d[_0x0bd5('0x8')]('/api/jscripty/sessions/reports',require(_0x0bd5('0xb6')));_0x15620d[_0x0bd5('0x8')](_0x0bd5('0xb7'),require(_0x0bd5('0xb8')));_0x15620d[_0x0bd5('0x8')](_0x0bd5('0xb9'),require(_0x0bd5('0xba')));_0x15620d[_0x0bd5('0x8')](_0x0bd5('0xbb'),require('./api/squareReportDetail'));_0x15620d[_0x0bd5('0x8')](_0x0bd5('0xbc'),require('./api/jscriptyProject'));_0x15620d[_0x0bd5('0x8')](_0x0bd5('0xbd'),require('./api/setting'));_0x15620d[_0x0bd5('0x8')](_0x0bd5('0xbe'),require('./api/squareOdbc'));_0x15620d[_0x0bd5('0x8')]('/api/square/projects',require(_0x0bd5('0xbf')));_0x15620d[_0x0bd5('0x8')](_0x0bd5('0xc0'),require(_0x0bd5('0xc1')));_0x15620d[_0x0bd5('0x8')](_0x0bd5('0xc2'),require(_0x0bd5('0xc3')));_0x15620d[_0x0bd5('0x8')](_0x0bd5('0xc4'),require(_0x0bd5('0xc5')));_0x15620d[_0x0bd5('0x8')](_0x0bd5('0xc6'),require(_0x0bd5('0xc7')));_0x15620d[_0x0bd5('0x8')]('/api/campaigns',require(_0x0bd5('0xc8')));_0x15620d[_0x0bd5('0x8')](_0x0bd5('0xc9'),require(_0x0bd5('0xca')));_0x15620d[_0x0bd5('0x8')](_0x0bd5('0xcb'),require('./api/attachment'));_0x15620d[_0x0bd5('0x8')](_0x0bd5('0xcc'),require(_0x0bd5('0xcd')));_0x15620d[_0x0bd5('0x8')](_0x0bd5('0xce'),require(_0x0bd5('0xcf')));_0x15620d[_0x0bd5('0x8')]('/api/chat/reports/transfer',require('./api/chatTransferReport'));_0x15620d['use'](_0x0bd5('0xd0'),require(_0x0bd5('0xd1')));_0x15620d[_0x0bd5('0x8')](_0x0bd5('0xd2'),require(_0x0bd5('0xd3')));_0x15620d['use'](_0x0bd5('0xd4'),require(_0x0bd5('0xd5')));_0x15620d['use'](_0x0bd5('0xd6'),require(_0x0bd5('0xd7')));_0x15620d[_0x0bd5('0x8')](_0x0bd5('0xd8'),require(_0x0bd5('0xd9')));_0x15620d[_0x0bd5('0x8')](_0x0bd5('0xda'),require(_0x0bd5('0xdb')));_0x15620d[_0x0bd5('0x8')](_0x0bd5('0xdc'),require(_0x0bd5('0xdd')));_0x15620d['use'](_0x0bd5('0xde'),require(_0x0bd5('0xdf')));_0x15620d[_0x0bd5('0x8')](_0x0bd5('0xe0'),require(_0x0bd5('0xe1')));_0x15620d['use'](_0x0bd5('0xe2'),require(_0x0bd5('0xe3')));_0x15620d[_0x0bd5('0x8')](_0x0bd5('0xe4'),require(_0x0bd5('0xe5')));_0x15620d[_0x0bd5('0x8')](_0x0bd5('0xe6'),require(_0x0bd5('0xe7')));_0x15620d[_0x0bd5('0x8')](_0x0bd5('0xe8'),require(_0x0bd5('0xe9')));_0x15620d[_0x0bd5('0x8')](_0x0bd5('0xea'),require(_0x0bd5('0xeb')));_0x15620d[_0x0bd5('0x8')](_0x0bd5('0xec'),require(_0x0bd5('0xed')));_0x15620d[_0x0bd5('0x8')](_0x0bd5('0xee'),require('./api/whatsappQueue'));_0x15620d['use'](_0x0bd5('0xef'),require(_0x0bd5('0xf0')));_0x15620d[_0x0bd5('0x8')](_0x0bd5('0xf1'),require(_0x0bd5('0xf2')));_0x15620d['use'](_0x0bd5('0xf3'),require(_0x0bd5('0xf4')));_0x15620d[_0x0bd5('0x8')](_0x0bd5('0xf5'),require(_0x0bd5('0xf6')));_0x15620d['use'](_0x0bd5('0xf7'),require(_0x0bd5('0xf8')));_0x15620d[_0x0bd5('0x8')](_0x0bd5('0xf9'),require(_0x0bd5('0xfa')));_0x15620d[_0x0bd5('0x8')](_0x0bd5('0xfb'),require(_0x0bd5('0xfc')));_0x15620d[_0x0bd5('0x8')](_0x0bd5('0xfd'),require(_0x0bd5('0xfe')));_0x15620d['use'](_0x0bd5('0xff'),require(_0x0bd5('0x100')));_0x15620d[_0x0bd5('0x8')](_0x0bd5('0x101'),require(_0x0bd5('0x102')));_0x15620d[_0x0bd5('0x8')](_0x0bd5('0x103'),require(_0x0bd5('0x104')));_0x15620d['use'](_0x0bd5('0x105'),require(_0x0bd5('0x106')));_0x15620d[_0x0bd5('0x8')](_0x0bd5('0x107'),clientSideLogs);_0x15620d[_0x0bd5('0x8')](_0x0bd5('0x108'),express[_0x0bd5('0x109')](path[_0x0bd5('0x10a')](config[_0x0bd5('0x10b')],_0x0bd5('0x108'))));_0x15620d[_0x0bd5('0x8')](_0x0bd5('0x10c'),express[_0x0bd5('0x109')](path[_0x0bd5('0x10a')](config[_0x0bd5('0x10b')],_0x0bd5('0x10c'))));_0x15620d['use'](_0x0bd5('0x10d'),express[_0x0bd5('0x109')](path[_0x0bd5('0x10a')](config[_0x0bd5('0x10b')],_0x0bd5('0x10d'))));_0x15620d[_0x0bd5('0x8')](_0x0bd5('0x10e'),express[_0x0bd5('0x109')](path[_0x0bd5('0x10a')](config['root'],_0x0bd5('0x10f'),_0x0bd5('0x110'))));_0x15620d[_0x0bd5('0x8')]('/plugins',express[_0x0bd5('0x109')](path[_0x0bd5('0x10a')](config[_0x0bd5('0x10b')],_0x0bd5('0x111'))));_0x15620d[_0x0bd5('0x112')](_0x0bd5('0x113'))['get'](errors[0x194]);_0x15620d[_0x0bd5('0x112')]('/*')['get'](function(_0x31427f,_0x527113){_0x527113['sendFile'](path[_0x0bd5('0x114')](_0x15620d[_0x0bd5('0x115')](_0x0bd5('0x116'))+_0x0bd5('0x117')));});return _0x15620d;});}; \ No newline at end of file diff --git a/server/rpc/index.js b/server/rpc/index.js index 1c22560..d9bc046 100644 --- a/server/rpc/index.js +++ b/server/rpc/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x778f=['../api/faxInteraction/faxInteraction.rpc','../api/faxMessage/faxMessage.rpc','../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/openchannelQueue/openchannelQueue.rpc','../api/chatInteraction/chatInteraction.rpc','../api/chatMessage/chatMessage.rpc','../api/chatQueue/chatQueue.rpc','../api/cmContact/cmContact.rpc','../api/cmHopper/cmHopper.rpc','../api/cmHopperBlack/cmHopperBlack.rpc','../api/cmHopperFinal/cmHopperFinal.rpc','../api/cmHopperHistory/cmHopperHistory.rpc','../api/interval/interval.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/intZendeskAccount/intZendeskAccount.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/smsQueueReport/smsQueueReport.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/campaign/campaign.rpc','../api/attachment/attachment.rpc','../api/whatsappAccount/whatsappAccount.rpc','../api/whatsappInteraction/whatsappInteraction.rpc','../api/whatsappMessage/whatsappMessage.rpc','../api/whatsappQueueReport/whatsappQueueReport.rpc','server','http','port','rpc','error','log','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','../config/triggers','default','RPC\x20listening\x20on\x20','jayson/promise','lodash','../config/environment','listen','merge','../api/user/user.rpc','../api/voiceExtension/voiceExtension.rpc','../api/voiceQueue/voiceQueue.rpc','../api/voiceRecording/voiceRecording.rpc','../api/voiceCallReport/voiceCallReport.rpc','../api/voiceDialReport/voiceDialReport.rpc','../api/voiceAgentReport/voiceAgentReport.rpc','../api/voiceQueueReport/voiceQueueReport.rpc','../api/memberReport/memberReport.rpc','../api/trunk/trunk.rpc','../api/voiceTransferReport/voiceTransferReport.rpc','../api/userVoiceQueueRt/userVoiceQueueRt.rpc','../api/mailServerIn/mailServerIn.rpc','../api/mailAccount/mailAccount.rpc','../api/mailQueue/mailQueue.rpc','../api/mailMessage/mailMessage.rpc','../api/mailQueueReport/mailQueueReport.rpc','../api/faxAccount/faxAccount.rpc'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x778f,0x12d));var _0xf778=function(_0x4e676e,_0x2a7c6d){_0x4e676e=_0x4e676e-0x0;var _0x336a3c=_0x778f[_0x4e676e];return _0x336a3c;};'use strict';var jayson=require(_0xf778('0x0'));var _=require(_0xf778('0x1'));var config=require(_0xf778('0x2'));exports[_0xf778('0x3')]=function(){return new Promise(function(_0x1ce678,_0x4ae74a){var _0x130367={};_0x130367=_[_0xf778('0x4')](_0x130367,require(_0xf778('0x5')));_0x130367=_[_0xf778('0x4')](_0x130367,require(_0xf778('0x6')));_0x130367=_[_0xf778('0x4')](_0x130367,require(_0xf778('0x7')));_0x130367=_[_0xf778('0x4')](_0x130367,require(_0xf778('0x8')));_0x130367=_['merge'](_0x130367,require(_0xf778('0x9')));_0x130367=_[_0xf778('0x4')](_0x130367,require(_0xf778('0xa')));_0x130367=_[_0xf778('0x4')](_0x130367,require(_0xf778('0xb')));_0x130367=_[_0xf778('0x4')](_0x130367,require(_0xf778('0xc')));_0x130367=_['merge'](_0x130367,require(_0xf778('0xd')));_0x130367=_[_0xf778('0x4')](_0x130367,require(_0xf778('0xe')));_0x130367=_[_0xf778('0x4')](_0x130367,require(_0xf778('0xf')));_0x130367=_['merge'](_0x130367,require(_0xf778('0x10')));_0x130367=_[_0xf778('0x4')](_0x130367,require(_0xf778('0x11')));_0x130367=_[_0xf778('0x4')](_0x130367,require(_0xf778('0x12')));_0x130367=_[_0xf778('0x4')](_0x130367,require(_0xf778('0x13')));_0x130367=_[_0xf778('0x4')](_0x130367,require('../api/mailInteraction/mailInteraction.rpc'));_0x130367=_[_0xf778('0x4')](_0x130367,require(_0xf778('0x14')));_0x130367=_[_0xf778('0x4')](_0x130367,require('../api/mailApplication/mailApplication.rpc'));_0x130367=_[_0xf778('0x4')](_0x130367,require(_0xf778('0x15')));_0x130367=_['merge'](_0x130367,require(_0xf778('0x16')));_0x130367=_[_0xf778('0x4')](_0x130367,require('../api/faxApplication/faxApplication.rpc'));_0x130367=_['merge'](_0x130367,require(_0xf778('0x17')));_0x130367=_['merge'](_0x130367,require(_0xf778('0x18')));_0x130367=_['merge'](_0x130367,require(_0xf778('0x19')));_0x130367=_[_0xf778('0x4')](_0x130367,require(_0xf778('0x1a')));_0x130367=_[_0xf778('0x4')](_0x130367,require(_0xf778('0x1b')));_0x130367=_[_0xf778('0x4')](_0x130367,require('../api/smsInteraction/smsInteraction.rpc'));_0x130367=_[_0xf778('0x4')](_0x130367,require(_0xf778('0x1c')));_0x130367=_[_0xf778('0x4')](_0x130367,require(_0xf778('0x1d')));_0x130367=_['merge'](_0x130367,require(_0xf778('0x1e')));_0x130367=_[_0xf778('0x4')](_0x130367,require(_0xf778('0x1f')));_0x130367=_[_0xf778('0x4')](_0x130367,require('../api/openchannelMessage/openchannelMessage.rpc'));_0x130367=_[_0xf778('0x4')](_0x130367,require(_0xf778('0x20')));_0x130367=_['merge'](_0x130367,require('../api/openchannelQueueReport/openchannelQueueReport.rpc'));_0x130367=_[_0xf778('0x4')](_0x130367,require(_0xf778('0x21')));_0x130367=_['merge'](_0x130367,require(_0xf778('0x22')));_0x130367=_[_0xf778('0x4')](_0x130367,require(_0xf778('0x23')));_0x130367=_['merge'](_0x130367,require(_0xf778('0x24')));_0x130367=_[_0xf778('0x4')](_0x130367,require(_0xf778('0x25')));_0x130367=_[_0xf778('0x4')](_0x130367,require(_0xf778('0x26')));_0x130367=_['merge'](_0x130367,require(_0xf778('0x27')));_0x130367=_[_0xf778('0x4')](_0x130367,require(_0xf778('0x28')));_0x130367=_[_0xf778('0x4')](_0x130367,require('../api/reportAgentPreview/reportAgentPreview.rpc'));_0x130367=_['merge'](_0x130367,require(_0xf778('0x29')));_0x130367=_[_0xf778('0x4')](_0x130367,require(_0xf778('0x2a')));_0x130367=_[_0xf778('0x4')](_0x130367,require(_0xf778('0x2b')));_0x130367=_[_0xf778('0x4')](_0x130367,require(_0xf778('0x2c')));_0x130367=_[_0xf778('0x4')](_0x130367,require(_0xf778('0x2d')));_0x130367=_[_0xf778('0x4')](_0x130367,require(_0xf778('0x2e')));_0x130367=_['merge'](_0x130367,require(_0xf778('0x2f')));_0x130367=_[_0xf778('0x4')](_0x130367,require(_0xf778('0x30')));_0x130367=_[_0xf778('0x4')](_0x130367,require(_0xf778('0x31')));_0x130367=_[_0xf778('0x4')](_0x130367,require('../api/intZohoAccount/intZohoAccount.rpc'));_0x130367=_[_0xf778('0x4')](_0x130367,require(_0xf778('0x32')));_0x130367=_[_0xf778('0x4')](_0x130367,require(_0xf778('0x33')));_0x130367=_['merge'](_0x130367,require(_0xf778('0x34')));_0x130367=_['merge'](_0x130367,require(_0xf778('0x35')));_0x130367=_[_0xf778('0x4')](_0x130367,require(_0xf778('0x36')));_0x130367=_[_0xf778('0x4')](_0x130367,require(_0xf778('0x37')));_0x130367=_[_0xf778('0x4')](_0x130367,require(_0xf778('0x38')));_0x130367=_[_0xf778('0x4')](_0x130367,require(_0xf778('0x39')));_0x130367=_['merge'](_0x130367,require(_0xf778('0x3a')));_0x130367=_[_0xf778('0x4')](_0x130367,require(_0xf778('0x3b')));_0x130367=_[_0xf778('0x4')](_0x130367,require(_0xf778('0x3c')));_0x130367=_['merge'](_0x130367,require(_0xf778('0x3d')));_0x130367=_[_0xf778('0x4')](_0x130367,require(_0xf778('0x3e')));_0x130367=_[_0xf778('0x4')](_0x130367,require(_0xf778('0x3f')));_0x130367=_[_0xf778('0x4')](_0x130367,require(_0xf778('0x40')));_0x130367=_[_0xf778('0x4')](_0x130367,require(_0xf778('0x41')));_0x130367=_[_0xf778('0x4')](_0x130367,require(_0xf778('0x42')));_0x130367=_[_0xf778('0x4')](_0x130367,require('../api/plugin/plugin.rpc'));_0x130367=_[_0xf778('0x4')](_0x130367,require(_0xf778('0x43')));_0x130367=_[_0xf778('0x4')](_0x130367,require(_0xf778('0x44')));_0x130367=_[_0xf778('0x4')](_0x130367,require(_0xf778('0x45')));_0x130367=_[_0xf778('0x4')](_0x130367,require(_0xf778('0x46')));_0x130367=_[_0xf778('0x4')](_0x130367,require('../api/whatsappQueue/whatsappQueue.rpc'));var _0x448d34=jayson[_0xf778('0x47')](_0x130367)[_0xf778('0x48')]();var _0x3d67da=config['rpc'][_0xf778('0x49')]||config['port']+0x1;var _0x27e60c=config[_0xf778('0x4a')]['ip']||'localhost';_0x448d34['on'](_0xf778('0x4b'),function(_0x272fb9){return _0x4ae74a(_0x272fb9);});_0x448d34[_0xf778('0x3')](_0x3d67da,_0x27e60c,function(){console[_0xf778('0x4c')](_0xf778('0x4d'),_0x27e60c,_0x3d67da);require(_0xf778('0x4e'))[_0xf778('0x4f')]();return _0x1ce678(_0xf778('0x50')+_0x27e60c+':'+_0x3d67da);});});}; \ No newline at end of file +var _0x67e8=['../api/setting/setting.rpc','../api/squareOdbc/squareOdbc.rpc','../api/squareProject/squareProject.rpc','../api/squareRecording/squareRecording.rpc','../api/campaign/campaign.rpc','../api/plugin/plugin.rpc','../api/whatsappAccount/whatsappAccount.rpc','../api/whatsappMessage/whatsappMessage.rpc','../api/whatsappQueue/whatsappQueue.rpc','server','http','rpc','port','localhost','error','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','../config/triggers','default','RPC\x20listening\x20on\x20','jayson/promise','../config/environment','listen','merge','../api/user/user.rpc','../api/voiceExtension/voiceExtension.rpc','../api/voiceQueue/voiceQueue.rpc','../api/voiceRecording/voiceRecording.rpc','../api/voiceCallReport/voiceCallReport.rpc','../api/voiceDialReport/voiceDialReport.rpc','../api/voiceAgentReport/voiceAgentReport.rpc','../api/voiceQueueReport/voiceQueueReport.rpc','../api/memberReport/memberReport.rpc','../api/trunk/trunk.rpc','../api/voiceTransferReport/voiceTransferReport.rpc','../api/userVoiceQueueRt/userVoiceQueueRt.rpc','../api/mailServerIn/mailServerIn.rpc','../api/mailAccount/mailAccount.rpc','../api/mailInteraction/mailInteraction.rpc','../api/mailMessage/mailMessage.rpc','../api/mailApplication/mailApplication.rpc','../api/mailQueueReport/mailQueueReport.rpc','../api/faxAccount/faxAccount.rpc','../api/faxApplication/faxApplication.rpc','../api/faxInteraction/faxInteraction.rpc','../api/faxMessage/faxMessage.rpc','../api/faxQueue/faxQueue.rpc','../api/smsAccount/smsAccount.rpc','../api/smsInteraction/smsInteraction.rpc','../api/smsMessage/smsMessage.rpc','../api/smsQueue/smsQueue.rpc','../api/openchannelApplication/openchannelApplication.rpc','../api/openchannelMessage/openchannelMessage.rpc','../api/openchannelQueue/openchannelQueue.rpc','../api/openchannelQueueReport/openchannelQueueReport.rpc','../api/chatInteraction/chatInteraction.rpc','../api/chatMessage/chatMessage.rpc','../api/chatQueue/chatQueue.rpc','../api/cmHopperBlack/cmHopperBlack.rpc','../api/cmHopperFinal/cmHopperFinal.rpc','../api/cmHopperHistory/cmHopperHistory.rpc','../api/interval/interval.rpc','../api/sound/sound.rpc','../api/template/template.rpc','../api/trigger/trigger.rpc','../api/intSalesforceAccount/intSalesforceAccount.rpc','../api/intSugarcrmAccount/intSugarcrmAccount.rpc','../api/intDeskAccount/intDeskAccount.rpc','../api/intZohoAccount/intZohoAccount.rpc','../api/intZendeskAccount/intZendeskAccount.rpc','../api/intFreshdeskAccount/intFreshdeskAccount.rpc','../api/intVtigerAccount/intVtigerAccount.rpc','../api/intServicenowAccount/intServicenowAccount.rpc','../api/intDynamics365Account/intDynamics365Account.rpc','../api/intFreshsalesAccount/intFreshsalesAccount.rpc','../api/chatQueueReport/chatQueueReport.rpc','../api/smsQueueReport/smsQueueReport.rpc','../api/squareReportDetail/squareReportDetail.rpc'];(function(_0x212348,_0x55415c){var _0x1696e9=function(_0x2b87cb){while(--_0x2b87cb){_0x212348['push'](_0x212348['shift']());}};_0x1696e9(++_0x55415c);}(_0x67e8,0xfa));var _0x867e=function(_0x173e00,_0x368436){_0x173e00=_0x173e00-0x0;var _0x5b0e56=_0x67e8[_0x173e00];return _0x5b0e56;};'use strict';var jayson=require(_0x867e('0x0'));var _=require('lodash');var config=require(_0x867e('0x1'));exports[_0x867e('0x2')]=function(){return new Promise(function(_0x52ea6b,_0xa318b){var _0x41266f={};_0x41266f=_[_0x867e('0x3')](_0x41266f,require(_0x867e('0x4')));_0x41266f=_[_0x867e('0x3')](_0x41266f,require(_0x867e('0x5')));_0x41266f=_[_0x867e('0x3')](_0x41266f,require(_0x867e('0x6')));_0x41266f=_[_0x867e('0x3')](_0x41266f,require(_0x867e('0x7')));_0x41266f=_[_0x867e('0x3')](_0x41266f,require(_0x867e('0x8')));_0x41266f=_[_0x867e('0x3')](_0x41266f,require(_0x867e('0x9')));_0x41266f=_[_0x867e('0x3')](_0x41266f,require(_0x867e('0xa')));_0x41266f=_['merge'](_0x41266f,require(_0x867e('0xb')));_0x41266f=_[_0x867e('0x3')](_0x41266f,require(_0x867e('0xc')));_0x41266f=_[_0x867e('0x3')](_0x41266f,require(_0x867e('0xd')));_0x41266f=_[_0x867e('0x3')](_0x41266f,require(_0x867e('0xe')));_0x41266f=_[_0x867e('0x3')](_0x41266f,require(_0x867e('0xf')));_0x41266f=_['merge'](_0x41266f,require(_0x867e('0x10')));_0x41266f=_[_0x867e('0x3')](_0x41266f,require(_0x867e('0x11')));_0x41266f=_[_0x867e('0x3')](_0x41266f,require('../api/mailQueue/mailQueue.rpc'));_0x41266f=_[_0x867e('0x3')](_0x41266f,require(_0x867e('0x12')));_0x41266f=_[_0x867e('0x3')](_0x41266f,require(_0x867e('0x13')));_0x41266f=_[_0x867e('0x3')](_0x41266f,require(_0x867e('0x14')));_0x41266f=_[_0x867e('0x3')](_0x41266f,require(_0x867e('0x15')));_0x41266f=_[_0x867e('0x3')](_0x41266f,require(_0x867e('0x16')));_0x41266f=_[_0x867e('0x3')](_0x41266f,require(_0x867e('0x17')));_0x41266f=_[_0x867e('0x3')](_0x41266f,require(_0x867e('0x18')));_0x41266f=_['merge'](_0x41266f,require(_0x867e('0x19')));_0x41266f=_['merge'](_0x41266f,require(_0x867e('0x1a')));_0x41266f=_[_0x867e('0x3')](_0x41266f,require('../api/faxQueueReport/faxQueueReport.rpc'));_0x41266f=_[_0x867e('0x3')](_0x41266f,require(_0x867e('0x1b')));_0x41266f=_['merge'](_0x41266f,require(_0x867e('0x1c')));_0x41266f=_['merge'](_0x41266f,require(_0x867e('0x1d')));_0x41266f=_[_0x867e('0x3')](_0x41266f,require(_0x867e('0x1e')));_0x41266f=_[_0x867e('0x3')](_0x41266f,require(_0x867e('0x1f')));_0x41266f=_[_0x867e('0x3')](_0x41266f,require('../api/openchannelInteraction/openchannelInteraction.rpc'));_0x41266f=_[_0x867e('0x3')](_0x41266f,require(_0x867e('0x20')));_0x41266f=_[_0x867e('0x3')](_0x41266f,require(_0x867e('0x21')));_0x41266f=_[_0x867e('0x3')](_0x41266f,require(_0x867e('0x22')));_0x41266f=_[_0x867e('0x3')](_0x41266f,require(_0x867e('0x23')));_0x41266f=_[_0x867e('0x3')](_0x41266f,require(_0x867e('0x24')));_0x41266f=_[_0x867e('0x3')](_0x41266f,require(_0x867e('0x25')));_0x41266f=_[_0x867e('0x3')](_0x41266f,require('../api/cmContact/cmContact.rpc'));_0x41266f=_[_0x867e('0x3')](_0x41266f,require('../api/cmHopper/cmHopper.rpc'));_0x41266f=_[_0x867e('0x3')](_0x41266f,require(_0x867e('0x26')));_0x41266f=_[_0x867e('0x3')](_0x41266f,require(_0x867e('0x27')));_0x41266f=_[_0x867e('0x3')](_0x41266f,require(_0x867e('0x28')));_0x41266f=_[_0x867e('0x3')](_0x41266f,require('../api/reportAgentPreview/reportAgentPreview.rpc'));_0x41266f=_[_0x867e('0x3')](_0x41266f,require(_0x867e('0x29')));_0x41266f=_[_0x867e('0x3')](_0x41266f,require('../api/pause/pause.rpc'));_0x41266f=_[_0x867e('0x3')](_0x41266f,require(_0x867e('0x2a')));_0x41266f=_[_0x867e('0x3')](_0x41266f,require(_0x867e('0x2b')));_0x41266f=_['merge'](_0x41266f,require(_0x867e('0x2c')));_0x41266f=_[_0x867e('0x3')](_0x41266f,require('../api/variable/variable.rpc'));_0x41266f=_[_0x867e('0x3')](_0x41266f,require(_0x867e('0x2d')));_0x41266f=_[_0x867e('0x3')](_0x41266f,require(_0x867e('0x2e')));_0x41266f=_[_0x867e('0x3')](_0x41266f,require(_0x867e('0x2f')));_0x41266f=_[_0x867e('0x3')](_0x41266f,require(_0x867e('0x30')));_0x41266f=_['merge'](_0x41266f,require(_0x867e('0x31')));_0x41266f=_['merge'](_0x41266f,require(_0x867e('0x32')));_0x41266f=_['merge'](_0x41266f,require(_0x867e('0x33')));_0x41266f=_[_0x867e('0x3')](_0x41266f,require(_0x867e('0x34')));_0x41266f=_[_0x867e('0x3')](_0x41266f,require(_0x867e('0x35')));_0x41266f=_[_0x867e('0x3')](_0x41266f,require(_0x867e('0x36')));_0x41266f=_[_0x867e('0x3')](_0x41266f,require(_0x867e('0x37')));_0x41266f=_[_0x867e('0x3')](_0x41266f,require(_0x867e('0x38')));_0x41266f=_[_0x867e('0x3')](_0x41266f,require('../api/squareReport/squareReport.rpc'));_0x41266f=_[_0x867e('0x3')](_0x41266f,require(_0x867e('0x39')));_0x41266f=_['merge'](_0x41266f,require(_0x867e('0x3a')));_0x41266f=_[_0x867e('0x3')](_0x41266f,require(_0x867e('0x3b')));_0x41266f=_[_0x867e('0x3')](_0x41266f,require(_0x867e('0x3c')));_0x41266f=_[_0x867e('0x3')](_0x41266f,require(_0x867e('0x3d')));_0x41266f=_['merge'](_0x41266f,require('../api/squareMessage/squareMessage.rpc'));_0x41266f=_[_0x867e('0x3')](_0x41266f,require(_0x867e('0x3e')));_0x41266f=_[_0x867e('0x3')](_0x41266f,require('../api/attachment/attachment.rpc'));_0x41266f=_[_0x867e('0x3')](_0x41266f,require(_0x867e('0x3f')));_0x41266f=_[_0x867e('0x3')](_0x41266f,require(_0x867e('0x40')));_0x41266f=_['merge'](_0x41266f,require('../api/whatsappInteraction/whatsappInteraction.rpc'));_0x41266f=_[_0x867e('0x3')](_0x41266f,require(_0x867e('0x41')));_0x41266f=_['merge'](_0x41266f,require('../api/whatsappQueueReport/whatsappQueueReport.rpc'));_0x41266f=_[_0x867e('0x3')](_0x41266f,require(_0x867e('0x42')));var _0x202460=jayson[_0x867e('0x43')](_0x41266f)[_0x867e('0x44')]();var _0x520cba=config[_0x867e('0x45')]['port']||config[_0x867e('0x46')]+0x1;var _0x23ab8c=config['rpc']['ip']||_0x867e('0x47');_0x202460['on'](_0x867e('0x48'),function(_0x416531){return _0xa318b(_0x416531);});_0x202460[_0x867e('0x2')](_0x520cba,_0x23ab8c,function(){console['log'](_0x867e('0x49'),_0x23ab8c,_0x520cba);require(_0x867e('0x4a'))[_0x867e('0x4b')]();return _0x52ea6b(_0x867e('0x4c')+_0x23ab8c+':'+_0x520cba);});});}; \ No newline at end of file diff --git a/server/services/agi/channel.js b/server/services/agi/channel.js index d56767e..7fc81ed 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 _0x8ab2=['520\x20End\x20of\x20proper','no\x20code','result=','substr','startsWith','length','match','error','code','close','E_AGI_SOCKET_CLOSE','timeout','destroy','pipe','command','function','write','inherits','sync','prototype','sendRequest','ANSWER','getData','format','noop','NO\x20MESSAGE','exec','EXEC\x20%s\x20%s','join','setContext','SET\x20CONTEXT\x20%s','setExtension','SET\x20EXTENSION\x20%s','setPriority','SET\x20PRIORITY\x20%s','HANGUP','setVariable','isBoolean','SET\x20VARIABLE\x20%s\x20\x22%s\x22','replace','sayNumber','SAY\x20NUMBER\x20%s\x20%s','SAY\x20DIGITS\x20%s\x20%s','sayPhonetic','continueAt','extension','GOTO\x20%s\x20%s\x20%s','getVariable','GET\x20VARIABLE\x20\x22%s\x22','wav','BEEP','RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s','STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22','agi','AGI','wait','WAIT','ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s','label','exports','util','lodash','events','./reply','./error','setEncoding','setTimeout','utf8','headers','ready','line','toLowerCase','hangup','emit','substring','520-Invalid','search'];(function(_0x3ba809,_0xfcdba3){var _0x3621c1=function(_0x54b774){while(--_0x54b774){_0x3ba809['push'](_0x3ba809['shift']());}};_0x3621c1(++_0xfcdba3);}(_0x8ab2,0x89));var _0x28ab=function(_0x46e8c9,_0x2d4284){_0x46e8c9=_0x46e8c9-0x0;var _0x48d225=_0x8ab2[_0x46e8c9];return _0x48d225;};'use strict';var util=require(_0x28ab('0x0'));var _=require(_0x28ab('0x1'));var EventEmitter=require(_0x28ab('0x2'))['EventEmitter'];var AGIReply=require(_0x28ab('0x3'));var AGIError=require(_0x28ab('0x4'));function AGIChannel(_0x45184d){var _0x54fbb4=this,_0x4fe2d3=new AGIReply(),_0x41aeec=![],_0x945a10={};EventEmitter['call'](_0x54fbb4);_0x45184d[_0x28ab('0x5')]('utf8');_0x45184d[_0x28ab('0x6')](0x8*0x3c*0x3c*0x3e8);_0x4fe2d3['setEncoding'](_0x28ab('0x7'));_0x4fe2d3['on'](_0x28ab('0x8'),function(_0x16b9fe){for(var _0x108c1f in _0x16b9fe){_0x54fbb4[_0x108c1f]=_0x16b9fe[_0x108c1f];}_0x54fbb4['emit'](_0x28ab('0x9'));});_0x4fe2d3['on'](_0x28ab('0xa'),function(_0x547ba0){if(_0x547ba0[_0x28ab('0xb')]()==_0x28ab('0xc')){_0x54fbb4[_0x28ab('0xd')](_0x28ab('0xc'));return;}if(_0x547ba0[_0x28ab('0xe')](0x0,0xb)==_0x28ab('0xf')){_0x41aeec=!![];}if(_0x41aeec){_0x945a10['rx']+=_0x547ba0+'\x0a';if(_0x547ba0[_0x28ab('0x10')](_0x28ab('0x11'))!=-0x1){_0x41aeec=![];}}else{_0x945a10['rx']=_0x547ba0;}if(_0x41aeec){return;}if(typeof _0x945a10['cb']=='function'){var _0x576924=_0x945a10['rx']['substring'](0x0,0x3),_0x34a16a=null,_0x286686=null;_0x576924=parseInt(_0x576924);if(isNaN(_0x576924)){_0x945a10['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0x28ab('0x12')});return;}if(_0x576924!=0xc8){_0x945a10['cb'](null,{'code':_0x576924,'result':-0x1,'extra':'KO'});return;}_0x34a16a=_0x945a10['rx'][_0x28ab('0xe')](0x4)['replace'](_0x28ab('0x13'),'');if(_0x34a16a['indexOf']('\x20')!=-0x1){_0x34a16a=_0x34a16a[_0x28ab('0x14')](0x0,_0x34a16a['indexOf']('\x20'));}if(_[_0x28ab('0x15')](_0x34a16a,'-1')){_0x34a16a=parseInt(_0x34a16a);}_0x286686=_0x945a10['rx']['split']('\x20');if(_0x286686['length']==0x3){_0x286686=_0x286686[0x2][_0x28ab('0xe')](0x1,_0x286686[0x2][_0x28ab('0x16')]-0x1);}else if(_0x286686[_0x28ab('0x16')]>0x3){var _0x3b4a7c=/\((.+)\)/;var _0x53179f=_0x945a10['rx'][_0x28ab('0x17')](_0x3b4a7c);if(_0x53179f){_0x286686=_0x53179f[0x1];}else{_0x286686=null;}}else{_0x286686=null;}_0x945a10['cb'](null,{'code':_0x576924,'result':_0x34a16a,'extra':_0x286686});}});_0x45184d['on'](_0x28ab('0x18'),function(_0x4f1bbd){_0x54fbb4[_0x28ab('0xd')](_0x28ab('0x18'),new AGIError('E_AGI_SOCKET_ERROR',_0x4f1bbd[_0x28ab('0x19')]));});_0x45184d['on'](_0x28ab('0x1a'),function(){_0x54fbb4[_0x28ab('0xd')](_0x28ab('0x1a'),new AGIError(_0x28ab('0x1b')));});_0x45184d['on']('timeout',function(){_0x54fbb4[_0x28ab('0xd')](_0x28ab('0x1c'),new AGIError('E_AGI_SOCKET_TIMEOUT'));_0x45184d[_0x28ab('0x1d')]();});_0x45184d[_0x28ab('0x1e')](_0x4fe2d3);this[_0x28ab('0x1f')]=function(_0x17e617,_0x127d64){var _0x17e617=_0x17e617||'',_0x127d64=typeof _0x127d64==_0x28ab('0x20')?_0x127d64:new Function();_0x945a10={'tx':_0x17e617,'rx':'','cb':_0x127d64};_0x45184d[_0x28ab('0x21')](_0x17e617+'\x0a');},this[_0x28ab('0x1a')]=function(){_0x45184d['destroy']();};}util[_0x28ab('0x22')](AGIChannel,EventEmitter);AGIChannel['prototype']['sendRequest']=function(_0x10fc2d){return this[_0x28ab('0x1f')][_0x28ab('0x23')](this,_0x10fc2d);};AGIChannel[_0x28ab('0x24')]['answer']=function(){return this[_0x28ab('0x25')](_0x28ab('0x26'));};AGIChannel[_0x28ab('0x24')][_0x28ab('0x27')]=function(_0x22851a,_0xf5b1ee,_0x505b58){_0x22851a=_0x22851a===undefined?'beep':_0x22851a;_0xf5b1ee=_0xf5b1ee===undefined?'5':_0xf5b1ee;_0x505b58=_0x505b58===undefined?'1':_0x505b58;return this[_0x28ab('0x25')](util[_0x28ab('0x28')]('GET\x20DATA\x20\x22%s\x22\x20%s\x20%s',_0x22851a,_0xf5b1ee*0x3e8,_0x505b58));};AGIChannel[_0x28ab('0x24')][_0x28ab('0x29')]=function(_0x574c53){_0x574c53=_0x574c53||_0x28ab('0x2a');return this[_0x28ab('0x25')](util[_0x28ab('0x28')]('VERBOSE\x20\x22%s\x22',_0x574c53));};AGIChannel['prototype'][_0x28ab('0x2b')]=function(_0x5523f4,_0x43aa9d){if(_['isArray'](_0x43aa9d)){return this[_0x28ab('0x25')](util[_0x28ab('0x28')](_0x28ab('0x2c'),_0x5523f4,_0x43aa9d[_0x28ab('0x2d')](',')));}return this[_0x28ab('0x25')](util['format'](_0x28ab('0x2c'),_0x5523f4,_0x43aa9d));};AGIChannel['prototype'][_0x28ab('0x2e')]=function(_0x171e3b){return this[_0x28ab('0x25')](util[_0x28ab('0x28')](_0x28ab('0x2f'),_0x171e3b));};AGIChannel[_0x28ab('0x24')][_0x28ab('0x30')]=function(_0x142f94){return this[_0x28ab('0x25')](util[_0x28ab('0x28')](_0x28ab('0x31'),_0x142f94));};AGIChannel['prototype'][_0x28ab('0x32')]=function(_0x5abc5a){return this[_0x28ab('0x25')](util['format'](_0x28ab('0x33'),_0x5abc5a));};AGIChannel[_0x28ab('0x24')]['hangup']=function(){return this[_0x28ab('0x25')](_0x28ab('0x34'));};AGIChannel[_0x28ab('0x24')][_0x28ab('0x35')]=function(_0x14c43a,_0xd54176){var _0x51f31a=_[_0x28ab('0x36')](_0xd54176)||_['isNumber'](_0xd54176)?_0xd54176['toString']():_0xd54176;return this[_0x28ab('0x25')](util[_0x28ab('0x28')](_0x28ab('0x37'),_0x14c43a,_0x51f31a?_0x51f31a['toString']()[_0x28ab('0x38')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0x28ab('0x24')][_0x28ab('0x39')]=function(_0x524b6e,_0x34a3b1){return this[_0x28ab('0x25')](util[_0x28ab('0x28')](_0x28ab('0x3a'),_0x524b6e,_0x34a3b1));};AGIChannel[_0x28ab('0x24')]['sayDigits']=function(_0x509d35,_0xda3cb2){return this[_0x28ab('0x25')](util[_0x28ab('0x28')](_0x28ab('0x3b'),_0x509d35,_0xda3cb2));};AGIChannel[_0x28ab('0x24')][_0x28ab('0x3c')]=function(_0xbde569,_0x5523eb){return this[_0x28ab('0x25')](util[_0x28ab('0x28')]('SAY\x20PHONETIC\x20\x22%s\x22\x20%s',_0xbde569,_0x5523eb));};AGIChannel[_0x28ab('0x24')][_0x28ab('0x3d')]=function(_0x225124,_0x263513,_0x4d98fd){_0x263513=_0x263513||this[_0x28ab('0x3e')];_0x4d98fd=_0x4d98fd||0x1;this[_0x28ab('0x2e')](_0x225124);this[_0x28ab('0x30')](_0x263513);this['setPriority'](_0x4d98fd);return this['noop'](util[_0x28ab('0x28')](_0x28ab('0x3f'),_0x225124,_0x263513,_0x4d98fd));};AGIChannel[_0x28ab('0x24')][_0x28ab('0x40')]=function(_0x5df7c3){return this[_0x28ab('0x25')](util[_0x28ab('0x28')](_0x28ab('0x41'),_0x5df7c3));};AGIChannel[_0x28ab('0x24')]['recordFile']=function(_0x1ad67d,_0x3c65db,_0x14c283,_0x371e25,_0x599788,_0x2d19aa){_0x3c65db=_0x3c65db||_0x28ab('0x42');_0x14c283=_0x14c283||'';_0x371e25=_0x371e25===undefined?-0x1:_0x371e25==='-1'?-0x1:_0x371e25*0x3e8;_0x599788=_0x599788===undefined?'':'s='+_0x599788;_0x2d19aa=_0x2d19aa?_0x28ab('0x43'):'';return this['sendRequest'](util[_0x28ab('0x28')](_0x28ab('0x44'),_0x1ad67d,_0x3c65db,_0x14c283,_0x371e25,_0x2d19aa,_0x599788));};AGIChannel[_0x28ab('0x24')]['streamFile']=function(_0x331c46,_0x1d1032){_0x1d1032=_0x1d1032||'';return this[_0x28ab('0x25')](util[_0x28ab('0x28')](_0x28ab('0x45'),_0x331c46,_0x1d1032));};AGIChannel['prototype'][_0x28ab('0x46')]=function(_0x4f8f7e){return this[_0x28ab('0x2b')](_0x28ab('0x47'),_0x4f8f7e);};AGIChannel[_0x28ab('0x24')][_0x28ab('0x48')]=function(_0x54750b){return this['exec'](_0x28ab('0x49'),_0x54750b);};AGIChannel[_0x28ab('0x24')][_0x28ab('0x18')]=function(_0xfb44fa,_0x193426){this[_0x28ab('0x29')](util[_0x28ab('0x28')](_0x28ab('0x4a'),_0xfb44fa['id'],_0xfb44fa[_0x28ab('0x4b')],_0x193426));return{'code':0x1f4,'result':'-1','extra':''};};module[_0x28ab('0x4c')]=AGIChannel; \ No newline at end of file +var _0x13c8=['join','setContext','SET\x20CONTEXT\x20%s','setExtension','setPriority','SET\x20PRIORITY\x20%s','HANGUP','setVariable','isBoolean','isNumber','toString','SAY\x20DIGITS\x20%s\x20%s','continueAt','extension','getVariable','GET\x20VARIABLE\x20\x22%s\x22','recordFile','streamFile','agi','AGI','wait','ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s','label','exports','util','lodash','events','./error','call','setEncoding','utf8','setTimeout','headers','emit','ready','toLowerCase','hangup','substring','520-Invalid','search','520\x20End\x20of\x20proper','function','replace','substr','indexOf','startsWith','length','error','E_AGI_SOCKET_ERROR','code','close','timeout','E_AGI_SOCKET_TIMEOUT','command','destroy','inherits','prototype','sendRequest','ANSWER','getData','beep','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','noop','NO\x20MESSAGE','exec','isArray','format','EXEC\x20%s\x20%s'];(function(_0x313381,_0x4ff5d9){var _0x4ea7ae=function(_0x11fda2){while(--_0x11fda2){_0x313381['push'](_0x313381['shift']());}};_0x4ea7ae(++_0x4ff5d9);}(_0x13c8,0xa0));var _0x813c=function(_0x5471ec,_0x1ce81a){_0x5471ec=_0x5471ec-0x0;var _0x121d4c=_0x13c8[_0x5471ec];return _0x121d4c;};'use strict';var util=require(_0x813c('0x0'));var _=require(_0x813c('0x1'));var EventEmitter=require(_0x813c('0x2'))['EventEmitter'];var AGIReply=require('./reply');var AGIError=require(_0x813c('0x3'));function AGIChannel(_0x1838fc){var _0x193021=this,_0x267c0b=new AGIReply(),_0x542451=![],_0x52f03f={};EventEmitter[_0x813c('0x4')](_0x193021);_0x1838fc[_0x813c('0x5')](_0x813c('0x6'));_0x1838fc[_0x813c('0x7')](0x8*0x3c*0x3c*0x3e8);_0x267c0b[_0x813c('0x5')](_0x813c('0x6'));_0x267c0b['on'](_0x813c('0x8'),function(_0x3b7af0){for(var _0x3d2d16 in _0x3b7af0){_0x193021[_0x3d2d16]=_0x3b7af0[_0x3d2d16];}_0x193021[_0x813c('0x9')](_0x813c('0xa'));});_0x267c0b['on']('line',function(_0x12bfa9){if(_0x12bfa9[_0x813c('0xb')]()==_0x813c('0xc')){_0x193021[_0x813c('0x9')](_0x813c('0xc'));return;}if(_0x12bfa9[_0x813c('0xd')](0x0,0xb)==_0x813c('0xe')){_0x542451=!![];}if(_0x542451){_0x52f03f['rx']+=_0x12bfa9+'\x0a';if(_0x12bfa9[_0x813c('0xf')](_0x813c('0x10'))!=-0x1){_0x542451=![];}}else{_0x52f03f['rx']=_0x12bfa9;}if(_0x542451){return;}if(typeof _0x52f03f['cb']==_0x813c('0x11')){var _0x41de68=_0x52f03f['rx'][_0x813c('0xd')](0x0,0x3),_0x4d5e23=null,_0x3a7ca5=null;_0x41de68=parseInt(_0x41de68);if(isNaN(_0x41de68)){_0x52f03f['cb'](null,{'code':0x1f4,'result':-0x1,'extra':'no\x20code'});return;}if(_0x41de68!=0xc8){_0x52f03f['cb'](null,{'code':_0x41de68,'result':-0x1,'extra':'KO'});return;}_0x4d5e23=_0x52f03f['rx']['substring'](0x4)[_0x813c('0x12')]('result=','');if(_0x4d5e23['indexOf']('\x20')!=-0x1){_0x4d5e23=_0x4d5e23[_0x813c('0x13')](0x0,_0x4d5e23[_0x813c('0x14')]('\x20'));}if(_[_0x813c('0x15')](_0x4d5e23,'-1')){_0x4d5e23=parseInt(_0x4d5e23);}_0x3a7ca5=_0x52f03f['rx']['split']('\x20');if(_0x3a7ca5['length']==0x3){_0x3a7ca5=_0x3a7ca5[0x2][_0x813c('0xd')](0x1,_0x3a7ca5[0x2][_0x813c('0x16')]-0x1);}else if(_0x3a7ca5[_0x813c('0x16')]>0x3){var _0x46e47c=/\((.+)\)/;var _0x1a1f50=_0x52f03f['rx']['match'](_0x46e47c);if(_0x1a1f50){_0x3a7ca5=_0x1a1f50[0x1];}else{_0x3a7ca5=null;}}else{_0x3a7ca5=null;}_0x52f03f['cb'](null,{'code':_0x41de68,'result':_0x4d5e23,'extra':_0x3a7ca5});}});_0x1838fc['on'](_0x813c('0x17'),function(_0x29e2e7){_0x193021[_0x813c('0x9')]('error',new AGIError(_0x813c('0x18'),_0x29e2e7[_0x813c('0x19')]));});_0x1838fc['on'](_0x813c('0x1a'),function(){_0x193021[_0x813c('0x9')](_0x813c('0x1a'),new AGIError('E_AGI_SOCKET_CLOSE'));});_0x1838fc['on'](_0x813c('0x1b'),function(){_0x193021[_0x813c('0x9')](_0x813c('0x1b'),new AGIError(_0x813c('0x1c')));_0x1838fc['destroy']();});_0x1838fc['pipe'](_0x267c0b);this[_0x813c('0x1d')]=function(_0xb8a96d,_0xed31e4){var _0xb8a96d=_0xb8a96d||'',_0xed31e4=typeof _0xed31e4=='function'?_0xed31e4:new Function();_0x52f03f={'tx':_0xb8a96d,'rx':'','cb':_0xed31e4};_0x1838fc['write'](_0xb8a96d+'\x0a');},this[_0x813c('0x1a')]=function(){_0x1838fc[_0x813c('0x1e')]();};}util[_0x813c('0x1f')](AGIChannel,EventEmitter);AGIChannel[_0x813c('0x20')]['sendRequest']=function(_0x23c72f){return this['command']['sync'](this,_0x23c72f);};AGIChannel['prototype']['answer']=function(){return this[_0x813c('0x21')](_0x813c('0x22'));};AGIChannel[_0x813c('0x20')][_0x813c('0x23')]=function(_0x5ddcf4,_0x4e678d,_0x2eaf90){_0x5ddcf4=_0x5ddcf4===undefined?_0x813c('0x24'):_0x5ddcf4;_0x4e678d=_0x4e678d===undefined?'5':_0x4e678d;_0x2eaf90=_0x2eaf90===undefined?'1':_0x2eaf90;return this[_0x813c('0x21')](util['format'](_0x813c('0x25'),_0x5ddcf4,_0x4e678d*0x3e8,_0x2eaf90));};AGIChannel[_0x813c('0x20')][_0x813c('0x26')]=function(_0x2cec99){_0x2cec99=_0x2cec99||_0x813c('0x27');return this[_0x813c('0x21')](util['format']('VERBOSE\x20\x22%s\x22',_0x2cec99));};AGIChannel[_0x813c('0x20')][_0x813c('0x28')]=function(_0x41d8c7,_0x13c4fa){if(_[_0x813c('0x29')](_0x13c4fa)){return this[_0x813c('0x21')](util[_0x813c('0x2a')](_0x813c('0x2b'),_0x41d8c7,_0x13c4fa[_0x813c('0x2c')](',')));}return this[_0x813c('0x21')](util[_0x813c('0x2a')](_0x813c('0x2b'),_0x41d8c7,_0x13c4fa));};AGIChannel[_0x813c('0x20')][_0x813c('0x2d')]=function(_0x3087b1){return this[_0x813c('0x21')](util['format'](_0x813c('0x2e'),_0x3087b1));};AGIChannel[_0x813c('0x20')][_0x813c('0x2f')]=function(_0x5bb74c){return this[_0x813c('0x21')](util['format']('SET\x20EXTENSION\x20%s',_0x5bb74c));};AGIChannel[_0x813c('0x20')][_0x813c('0x30')]=function(_0xbf0657){return this[_0x813c('0x21')](util[_0x813c('0x2a')](_0x813c('0x31'),_0xbf0657));};AGIChannel[_0x813c('0x20')]['hangup']=function(){return this[_0x813c('0x21')](_0x813c('0x32'));};AGIChannel[_0x813c('0x20')][_0x813c('0x33')]=function(_0x41bf9e,_0x11ce0a){var _0x9c8494=_[_0x813c('0x34')](_0x11ce0a)||_[_0x813c('0x35')](_0x11ce0a)?_0x11ce0a[_0x813c('0x36')]():_0x11ce0a;return this[_0x813c('0x21')](util['format']('SET\x20VARIABLE\x20%s\x20\x22%s\x22',_0x41bf9e,_0x9c8494?_0x9c8494[_0x813c('0x36')]()['replace'](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0x813c('0x20')]['sayNumber']=function(_0x2e4331,_0x43592c){return this['sendRequest'](util[_0x813c('0x2a')]('SAY\x20NUMBER\x20%s\x20%s',_0x2e4331,_0x43592c));};AGIChannel['prototype']['sayDigits']=function(_0x2e5cc9,_0x1a9762){return this[_0x813c('0x21')](util[_0x813c('0x2a')](_0x813c('0x37'),_0x2e5cc9,_0x1a9762));};AGIChannel[_0x813c('0x20')]['sayPhonetic']=function(_0x261ecf,_0x41f992){return this[_0x813c('0x21')](util[_0x813c('0x2a')]('SAY\x20PHONETIC\x20\x22%s\x22\x20%s',_0x261ecf,_0x41f992));};AGIChannel[_0x813c('0x20')][_0x813c('0x38')]=function(_0x666ef9,_0x2b4078,_0x4d6cd2){_0x2b4078=_0x2b4078||this[_0x813c('0x39')];_0x4d6cd2=_0x4d6cd2||0x1;this[_0x813c('0x2d')](_0x666ef9);this[_0x813c('0x2f')](_0x2b4078);this['setPriority'](_0x4d6cd2);return this['noop'](util[_0x813c('0x2a')]('GOTO\x20%s\x20%s\x20%s',_0x666ef9,_0x2b4078,_0x4d6cd2));};AGIChannel['prototype'][_0x813c('0x3a')]=function(_0x553a15){return this[_0x813c('0x21')](util[_0x813c('0x2a')](_0x813c('0x3b'),_0x553a15));};AGIChannel[_0x813c('0x20')][_0x813c('0x3c')]=function(_0x61b51a,_0x29efae,_0x56d040,_0x126c4e,_0x1a4be9,_0x5c59aa){_0x29efae=_0x29efae||'wav';_0x56d040=_0x56d040||'';_0x126c4e=_0x126c4e===undefined?-0x1:_0x126c4e==='-1'?-0x1:_0x126c4e*0x3e8;_0x1a4be9=_0x1a4be9===undefined?'':'s='+_0x1a4be9;_0x5c59aa=_0x5c59aa?'BEEP':'';return this[_0x813c('0x21')](util['format']('RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s',_0x61b51a,_0x29efae,_0x56d040,_0x126c4e,_0x5c59aa,_0x1a4be9));};AGIChannel[_0x813c('0x20')][_0x813c('0x3d')]=function(_0x3e40d2,_0x6b9ab4){_0x6b9ab4=_0x6b9ab4||'';return this[_0x813c('0x21')](util[_0x813c('0x2a')]('STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22',_0x3e40d2,_0x6b9ab4));};AGIChannel[_0x813c('0x20')][_0x813c('0x3e')]=function(_0x14b34b){return this[_0x813c('0x28')](_0x813c('0x3f'),_0x14b34b);};AGIChannel[_0x813c('0x20')][_0x813c('0x40')]=function(_0x35c7c4){return this[_0x813c('0x28')]('WAIT',_0x35c7c4);};AGIChannel[_0x813c('0x20')]['error']=function(_0x5df684,_0x5ba577){this['noop'](util[_0x813c('0x2a')](_0x813c('0x41'),_0x5df684['id'],_0x5df684[_0x813c('0x42')],_0x5ba577));return{'code':0x1f4,'result':'-1','extra':''};};module[_0x813c('0x43')]=AGIChannel; \ No newline at end of file diff --git a/server/services/agi/error.js b/server/services/agi/error.js index 9fe22a9..abaedaf 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 _0x818d=['Socket\x20error.\x20Code:\x20%s.','Socket\x20timeout.','Missing\x20\x27ivr.entry\x27\x20menu.','E_AGI_UNDEFINED','format','message','name','exports','util','Undefined\x20error.','Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','Server\x20error.\x20Code:\x20%s.','Server\x20closed.','[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.'];(function(_0x50e5e2,_0x7cc5cd){var _0x29c656=function(_0x2a7eaa){while(--_0x2a7eaa){_0x50e5e2['push'](_0x50e5e2['shift']());}};_0x29c656(++_0x7cc5cd);}(_0x818d,0x1ac));var _0xd818=function(_0x4ce1b9,_0x397a4b){_0x4ce1b9=_0x4ce1b9-0x0;var _0x2bb15d=_0x818d[_0x4ce1b9];return _0x2bb15d;};'use strict';var util=require(_0xd818('0x0'));var error={'E_AGI_UNDEFINED':_0xd818('0x1'),'E_AGI_ARGUMENT_PORT':_0xd818('0x2'),'E_AGI_SERVER_ERROR':_0xd818('0x3'),'E_AGI_SERVER_CLOSE':_0xd818('0x4'),'E_AGI_SERVER_MAXCONNECTION':'[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','E_AGI_SERVER_VOICE_DISABLED':_0xd818('0x5'),'E_AGI_SOCKET_ERROR':_0xd818('0x6'),'E_AGI_SOCKET_CLOSE':'Socket\x20closed.','E_AGI_SOCKET_TIMEOUT':_0xd818('0x7'),'E_AGI_COMMAND_EMPTY':'Empty\x20command.','E_AGI_IVR_AGI_NETWORK_SCRIPT':'Missing\x20\x27ivr.agi_network_script\x27.','E_AGI_IVR_ENTRY':_0xd818('0x8')};function AGIError(_0x35fb0a){var _0x35fb0a=_0x35fb0a||null,_0x37f3a8=_0x37f3a8||[],_0x179425=0x1,_0x2503ac='';if(!error[_0x35fb0a]){_0x35fb0a=_0xd818('0x9');}_0x37f3a8['push'](error[_0x35fb0a]);while(arguments[_0x179425]){_0x37f3a8['push'](arguments[_0x179425]);_0x179425++;}_0x2503ac=util[_0xd818('0xa')]['apply'](util,_0x37f3a8);this[_0xd818('0xb')]=_0x2503ac;this[_0xd818('0xc')]=_0x35fb0a;}module[_0xd818('0xd')]=AGIError; \ No newline at end of file +var _0xff81=['message','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\x20error.\x20Code:\x20%s.','Socket\x20closed.','Empty\x20command.','Missing\x20\x27ivr.agi_network_script\x27.','Missing\x20\x27ivr.entry\x27\x20menu.','push','apply'];(function(_0x3d2c0f,_0x6140ac){var _0x3ec6b4=function(_0x41e1a1){while(--_0x41e1a1){_0x3d2c0f['push'](_0x3d2c0f['shift']());}};_0x3ec6b4(++_0x6140ac);}(_0xff81,0x1b4));var _0x1ff8=function(_0x4c5c97,_0x4f85bf){_0x4c5c97=_0x4c5c97-0x0;var _0xd5d2cb=_0xff81[_0x4c5c97];return _0xd5d2cb;};'use strict';var util=require(_0x1ff8('0x0'));var error={'E_AGI_UNDEFINED':_0x1ff8('0x1'),'E_AGI_ARGUMENT_PORT':_0x1ff8('0x2'),'E_AGI_SERVER_ERROR':_0x1ff8('0x3'),'E_AGI_SERVER_CLOSE':_0x1ff8('0x4'),'E_AGI_SERVER_MAXCONNECTION':_0x1ff8('0x5'),'E_AGI_SERVER_VOICE_DISABLED':_0x1ff8('0x6'),'E_AGI_SOCKET_ERROR':_0x1ff8('0x7'),'E_AGI_SOCKET_CLOSE':_0x1ff8('0x8'),'E_AGI_SOCKET_TIMEOUT':'Socket\x20timeout.','E_AGI_COMMAND_EMPTY':_0x1ff8('0x9'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':_0x1ff8('0xa'),'E_AGI_IVR_ENTRY':_0x1ff8('0xb')};function AGIError(_0x206746){var _0x206746=_0x206746||null,_0x337a88=_0x337a88||[],_0x2a23a2=0x1,_0x10a164='';if(!error[_0x206746]){_0x206746='E_AGI_UNDEFINED';}_0x337a88[_0x1ff8('0xc')](error[_0x206746]);while(arguments[_0x2a23a2]){_0x337a88['push'](arguments[_0x2a23a2]);_0x2a23a2++;}_0x10a164=util['format'][_0x1ff8('0xd')](util,_0x337a88);this[_0x1ff8('0xe')]=_0x10a164;this['name']=_0x206746;}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 9224e45..150364b 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 _0x13ea=['length','no\x20edge/s\x20available','edges','condition','agicommand','target','default','invalid','vswitch','default\x20on\x20switch\x20not\x20found','max\x20retry\x20reach','condition\x20not\x20found','exports','agi','menu','getdigits','vertices','numberOfEdges','addVertex','push','prototype','size','relations','traverseBFS','info','stop\x20traverse'];(function(_0x126558,_0x143c9a){var _0x1f6d14=function(_0x2b0eea){while(--_0x2b0eea){_0x126558['push'](_0x126558['shift']());}};_0x1f6d14(++_0x143c9a);}(_0x13ea,0xa9));var _0xa13e=function(_0x279d37,_0x14de3f){_0x279d37=_0x279d37-0x0;var _0x530173=_0x13ea[_0x279d37];return _0x530173;};'use strict';var _=require('lodash');var logger=require('../../../config/logger')(_0xa13e('0x0'));var verticesWithRetry=[_0xa13e('0x1'),_0xa13e('0x2'),'getsecretdigits'];var Graph=function(){this[_0xa13e('0x3')]={};this['edges']={};this[_0xa13e('0x4')]=0x0;};Graph['prototype'][_0xa13e('0x5')]=function(_0x217218){this['vertices'][_0x217218['id']]=_0x217218;this['edges'][_0x217218['id']]=[];};Graph['prototype']['addEdge']=function(_0x72089,_0x200db4,_0x2f2b68){this['edges'][_0x72089][_0xa13e('0x6')]({'target':_0x200db4,'condition':_0x2f2b68});this[_0xa13e('0x4')]+=0x1;};Graph[_0xa13e('0x7')][_0xa13e('0x8')]=function(){return _[_0xa13e('0x8')](this['vertices']);};Graph[_0xa13e('0x7')][_0xa13e('0x9')]=function(){return this[_0xa13e('0x4')];};Graph[_0xa13e('0x7')]['getVertex']=function(_0x399f14){return this[_0xa13e('0x3')][_0x399f14];};Graph[_0xa13e('0x7')][_0xa13e('0xa')]=function(_0x423688,_0x51bc89){if(!this[_0xa13e('0x3')][_0x423688]){return logger[_0xa13e('0xb')]('no\x20vertex\x20found');}var _0x493010=_0x51bc89(this[_0xa13e('0x3')][_0x423688]);if(!_0x493010){return logger['info'](_0xa13e('0xc'));}if(this['edges'][_0x423688][_0xa13e('0xd')]===0x0){return logger[_0xa13e('0xb')](_0xa13e('0xe'));}for(var _0x35b021=0x0,_0x23d47c=[],_0x4bf720=![];_0x35b021\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','hangup','sync','production','start','omit','[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','traverseBFS','clear','debug','vertex','gotoc','gotoc\x20block\x20stop\x20traverse\x20BFS','context','priority','response','code','isUndefined','result','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','[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','extension','close','Project\x20%s\x20not\x20published','continueAt','Project\x20%s\x20not\x20found','getLicense','callysquare','[LICENSE]\x20CHANNELS:\x20%s','[LICENSE]\x20CHANNELS:\x20UNLIMITED','[LICENSE]\x20VOICE\x20IS\x20DISABLED','[LICENSE]','./server','listening','xml2json','lodash','syncho','util','moment','agi','../../config/license/util','./mailRpc','./graph','./vertices','defaults','127.0.0.1','nextTick','error','stack','port','info','format','name','message','[%s]\x20%s','[ERROR]\x20%s','[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','calleridname','callerid','dnid','uniqueid','[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','evtHangup','root','agicommand','retry','maxRetry','addVertex','mxCell','hasOwnProperty','isArray','length','source','target','getSquareProject','then','createSquareReport','catch','indexOf','agi_','substring','inspect'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x50e2,0x190));var _0x250e=function(_0xee18e4,_0x1835eb){_0xee18e4=_0xee18e4-0x0;var _0x5993a8=_0x50e2[_0xee18e4];return _0x5993a8;};'use strict';var parser=require(_0x250e('0x0'));var _=require(_0x250e('0x1'));var syncho=require(_0x250e('0x2'));var util=require(_0x250e('0x3'));var moment=require(_0x250e('0x4'));var config=require('../../config/environment');var logger=require('../../config/logger')(_0x250e('0x5'));var utilLicense=require(_0x250e('0x6'));var rpc=require('./rpc');var mailRpc=require(_0x250e('0x7'));var Graph=require(_0x250e('0x8'));var Vertices=require(_0x250e('0x9'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;config[_0x250e('0x5')]=_[_0x250e('0xa')](config[_0x250e('0x5')],{'ip':_0x250e('0xb'),'port':0x11dd});function connectionHandler(_0x69d060){process[_0x250e('0xc')](function(){syncho(function(){try{setChannelVariables(_0x69d060);agiHandler(_0x69d060);}catch(_0x1f68c7){logger[_0x250e('0xd')](_0x1f68c7[_0x250e('0xe')]);}});});}function listeningHandler(){console['log']('Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!',config[_0x250e('0x5')][_0x250e('0xf')]);logger[_0x250e('0x10')](util[_0x250e('0x11')]('[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d',config[_0x250e('0x5')]['ip'],config[_0x250e('0x5')][_0x250e('0xf')]));}function errorHandler(_0x51a2de){if(_0x51a2de&&_0x51a2de[_0x250e('0x12')]&&_0x51a2de[_0x250e('0x13')]){logger[_0x250e('0xd')](util[_0x250e('0x11')](_0x250e('0x14'),_0x51a2de[_0x250e('0x12')],_0x51a2de[_0x250e('0x13')]));}else{logger[_0x250e('0xd')](util[_0x250e('0x11')](_0x250e('0x15'),_0x51a2de[_0x250e('0xe')]));}}function closeHandler(){logger['info'](util[_0x250e('0x11')](_0x250e('0x16'),this[_0x250e('0x17')],this[_0x250e('0x18')],this[_0x250e('0x19')],this[_0x250e('0x1a')],this[_0x250e('0x1b')]));try{createSquareReport(this);}catch(_0x4b2c4c){logger[_0x250e('0xd')](_0x4b2c4c['stack']);}}function timeoutHandler(){logger['info'](util[_0x250e('0x11')](_0x250e('0x1c'),this[_0x250e('0x17')],this[_0x250e('0x18')],this[_0x250e('0x19')],this[_0x250e('0x1a')],this[_0x250e('0x1b')]));}function hangupHandler(){logger['info'](util['format'](_0x250e('0x1d'),this[_0x250e('0x17')],this[_0x250e('0x18')],this[_0x250e('0x19')],this[_0x250e('0x1a')],this[_0x250e('0x1b')]));this[_0x250e('0x1e')]=!![];}function getRoot(_0x1bdb40){return parser['toJson'](_0x1bdb40,{'object':!![]})['mxGraphModel'][_0x250e('0x1f')];}function addVertex(_0x1e5f7f,_0x24de8b,_0x47dac6){_0x24de8b[_0x250e('0x20')]=_0x47dac6;if(_0x24de8b['hasOwnProperty'](_0x250e('0x21'))){_0x24de8b[_0x250e('0x22')]=parseInt(_0x24de8b['retry'],0xa);}_0x1e5f7f[_0x250e('0x23')](_['omit'](_0x24de8b,_0x250e('0x24')));}function initGraph(_0x4308b6,_0x48f5ad){var _0x5105ef=new Graph();for(var _0x329b93 in _0x4308b6){if(_0x4308b6[_0x250e('0x25')](_0x329b93)){if(_[_0x250e('0x26')](_0x4308b6[_0x329b93])){for(var _0x1b96e7=0x0;_0x1b96e7<_0x4308b6[_0x329b93][_0x250e('0x27')];_0x1b96e7+=0x1){addVertex(_0x5105ef,_0x4308b6[_0x329b93][_0x1b96e7],_0x329b93);}}else{addVertex(_0x5105ef,_0x4308b6[_0x329b93],_0x329b93);}}}for(var _0x1514d0=0x0;_0x1514d0<_0x48f5ad['length'];_0x1514d0+=0x1){if(_0x48f5ad[_0x1514d0][_0x250e('0x28')]&&_0x48f5ad[_0x1514d0]['target']){_0x5105ef['addEdge'](_0x48f5ad[_0x1514d0][_0x250e('0x28')],_0x48f5ad[_0x1514d0][_0x250e('0x29')],_0x48f5ad[_0x1514d0]['value']);}}return _0x5105ef;}function getSquareProject(_0x4dd758,_0x1453e3){rpc[_0x250e('0x2a')](_0x4dd758)[_0x250e('0x2b')](function(_0x15f9a4){_0x1453e3(null,_0x15f9a4);})['catch'](function(_0x42e2bd){_0x1453e3(null,_0x42e2bd);});}function createSquareReport(_0x563a4e,_0x1de3aa){rpc[_0x250e('0x2c')](_0x563a4e)[_0x250e('0x2b')](function(_0x4381a1){if(_0x1de3aa){_0x1de3aa(null,_0x4381a1);}})[_0x250e('0x2d')](function(_0x3f0f8c){if(_0x1de3aa){_0x1de3aa(null,_0x3f0f8c);}});}function setChannelVariables(_0x4c22ec){for(var _0x3ece12 in _0x4c22ec){if(_0x4c22ec[_0x250e('0x25')](_0x3ece12)){if(_0x3ece12[_0x250e('0x2e')](_0x250e('0x2f'))===0x0){_0x4c22ec[_0x3ece12[_0x250e('0x30')](0x4)]=_0x4c22ec[_0x3ece12];delete _0x4c22ec[_0x3ece12];}}}}function getLogFromObject(_0x4a2581){return util[_0x250e('0x31')](_0x4a2581,{'showHidden':![],'depth':null});}function agiHandler(_0x111c65){var _0x17795f,_0x261cc9,_0x4a2f0a,_0x5cf0c1,_0x36b54e;logger['debug'](_0x250e('0x32'),JSON[_0x250e('0x33')](_0x111c65,null,0x2));logger[_0x250e('0x10')](util[_0x250e('0x11')](_0x250e('0x34'),_0x111c65['arg_1'],_0x111c65['calleridname'],_0x111c65['callerid'],_0x111c65['dnid'],_0x111c65['uniqueid']));_0x111c65['on'](_0x250e('0xd'),errorHandler);_0x111c65['on']('close',closeHandler);_0x111c65['on']('timeout',timeoutHandler);_0x111c65['evtHangup']=![];_0x111c65['on'](_0x250e('0x35'),hangupHandler);var _0x2a4677=getSquareProject[_0x250e('0x36')](null,_0x111c65[_0x250e('0x17')]);if(_0x2a4677){if(_0x2a4677['production']){_0x17795f=getRoot(_0x2a4677[_0x250e('0x37')]);if(_0x17795f&&_0x17795f[_0x250e('0x38')]){logger['debug'](_0x250e('0x1f'),JSON[_0x250e('0x33')](_0x17795f,null,0x2));_0x111c65['joinAt']=moment()[_0x250e('0x11')]('YYYY-MM-DD\x20HH:mm:ss');_0x261cc9=initGraph(_[_0x250e('0x39')](_0x17795f,_0x250e('0x24')),_0x17795f[_0x250e('0x24')]);_0x4a2f0a=new Vertices(_0x111c65,rpc,mailRpc);logger[_0x250e('0x10')](util['format'](_0x250e('0x3a'),_0x111c65[_0x250e('0x17')],_0x111c65[_0x250e('0x18')],_0x111c65[_0x250e('0x19')],_0x111c65['dnid'],_0x111c65[_0x250e('0x1b')]));_0x261cc9[_0x250e('0x3b')](_0x17795f['start']['id'],function(_0x3e9472){try{_0x3e9472=_0x4a2f0a[_0x250e('0x3c')](_0x3e9472);logger[_0x250e('0x3d')](_0x250e('0x3e'),JSON[_0x250e('0x33')](_0x3e9472,null,0x2));if(_0x3e9472[_0x250e('0x20')]===_0x250e('0x3f')){logger[_0x250e('0x10')](_0x250e('0x40'));_0x111c65[_0x250e('0x41')]=_0x3e9472[_0x250e('0x41')]||_0x111c65['context'];_0x111c65['extension']=_0x3e9472['extension'];_0x111c65[_0x250e('0x42')]=_0x3e9472[_0x250e('0x42')]?_0x3e9472['priority']-0x1:0x1;return null;}else if(_0x3e9472&&_0x4a2f0a[_0x3e9472[_0x250e('0x20')]]){_0x36b54e=_0x4a2f0a[_0x3e9472['agicommand']](_0x3e9472);logger[_0x250e('0x10')](_0x250e('0x43'),JSON['stringify'](_0x36b54e,null,0x2));if(_0x36b54e&&_0x36b54e[_0x250e('0x44')]===AGI_CODE_SUCCESS&&_0x36b54e['result']!==AGI_RESULT_ERROR&&!_0x111c65['evtHangup']){logger[_0x250e('0x3d')](_0x250e('0x43'),getLogFromObject(_0x36b54e));return _[_0x250e('0x45')](_0x36b54e['result'])?null:_0x36b54e[_0x250e('0x46')][_0x250e('0x47')]();}else{logger[_0x250e('0xd')]('response',getLogFromObject(_0x36b54e));return null;}}else{logger['error'](_0x250e('0x48'));return null;}}catch(_0x440d18){logger['error'](_0x440d18[_0x250e('0xe')]);return null;}});if(_0x17795f[_0x250e('0x49')]){logger[_0x250e('0x10')](util[_0x250e('0x11')](_0x250e('0x4a'),_0x111c65[_0x250e('0x17')],_0x111c65[_0x250e('0x18')],_0x111c65[_0x250e('0x19')],_0x111c65[_0x250e('0x1a')],_0x111c65[_0x250e('0x1b')]));_0x261cc9[_0x250e('0x3b')](_0x17795f['finally']['id'],function(_0x3d91f7){try{_0x3d91f7=_0x4a2f0a[_0x250e('0x3c')](_0x3d91f7);logger[_0x250e('0x3d')](_0x250e('0x3e'),JSON[_0x250e('0x33')](_0x3d91f7,null,0x2));if(_0x3d91f7&&_0x4a2f0a[_0x3d91f7['agicommand']]){_0x36b54e=_0x4a2f0a[_0x3d91f7[_0x250e('0x20')]](_0x3d91f7);if(_0x36b54e){logger[_0x250e('0x3d')](_0x250e('0x43'),getLogFromObject(_0x36b54e));return _['isUndefined'](_0x36b54e[_0x250e('0x46')])?null:_0x36b54e['result'][_0x250e('0x47')]();}else{logger['error']('response',getLogFromObject(_0x36b54e));return null;}}else{logger[_0x250e('0xd')](_0x250e('0x48'));return null;}}catch(_0x8f6eed){logger['error'](_0x8f6eed[_0x250e('0xe')]);return null;}});}logger[_0x250e('0x10')](util[_0x250e('0x11')](_0x250e('0x4b'),_0x111c65[_0x250e('0x17')],_0x111c65[_0x250e('0x18')],_0x111c65[_0x250e('0x19')],_0x111c65[_0x250e('0x1a')],_0x111c65[_0x250e('0x1b')]));logger[_0x250e('0x10')](util[_0x250e('0x11')](_0x250e('0x4c'),_0x111c65[_0x250e('0x41')],_0x111c65[_0x250e('0x4d')],parseInt(_0x111c65[_0x250e('0x42')],0xa)+0x1));_0x111c65['continueAt'](_0x111c65[_0x250e('0x41')],_0x111c65[_0x250e('0x4d')],parseInt(_0x111c65['priority'],0xa)+0x1);_0x111c65[_0x250e('0x4e')]();}}else{logger['error'](util[_0x250e('0x11')](_0x250e('0x4f'),_0x111c65[_0x250e('0x17')]));_0x111c65[_0x250e('0x50')](_0x111c65[_0x250e('0x41')],_0x111c65[_0x250e('0x4d')],parseInt(_0x111c65['priority'],0xa)+0x1);_0x111c65['close']();}}else{logger[_0x250e('0xd')](util[_0x250e('0x11')](_0x250e('0x51'),_0x111c65['arg_1']));_0x111c65[_0x250e('0x50')](_0x111c65['context'],_0x111c65[_0x250e('0x4d')],parseInt(_0x111c65[_0x250e('0x42')],0xa)+0x1);_0x111c65['close']();}}function main(){var _0x54c622;return utilLicense[_0x250e('0x52')]()[_0x250e('0x2b')](function(_0x10bd17){if(_0x10bd17){if(_0x10bd17['voice']){if(_0x10bd17[_0x250e('0x53')]&&_0x10bd17[_0x250e('0x53')]>0x0){logger[_0x250e('0x10')](util['format'](_0x250e('0x54'),_0x10bd17[_0x250e('0x53')]));_0x54c622=_0x10bd17['callysquare'];}else{logger['info'](_0x250e('0x55'));}}else{logger['info'](_0x250e('0x56'));_0x54c622=-0x1;}}})['catch'](function(_0x28d070){logger['error'](_0x250e('0x57'),_0x28d070[_0x250e('0xe')]);})[_0x250e('0x49')](function(){var _0x38be1c=require(_0x250e('0x58'))(config[_0x250e('0x5')]['port'],config['agi']['ip'],_0x54c622);_0x38be1c['on'](_0x250e('0xd'),errorHandler);_0x38be1c['on'](_0x250e('0x59'),listeningHandler);_0x38be1c['on']('connection',connectionHandler);_0x38be1c['on'](_0x250e('0x4e'),closeHandler);});}main(); \ No newline at end of file +var _0xe64d=['util','moment','../../config/environment','agi','../../config/license/util','./rpc','./mailRpc','./graph','./vertices','defaults','nextTick','error','stack','log','Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!','port','info','format','[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d','name','[%s]\x20%s','message','arg_1','calleridname','callerid','uniqueid','[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','dnid','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','evtHangup','toJson','mxGraphModel','root','hasOwnProperty','retry','maxRetry','omit','mxCell','source','target','addEdge','then','catch','createSquareReport','indexOf','substring','inspect','debug','stringify','close','timeout','hangup','sync','production','start','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','clear','vertex','agicommand','gotoc','gotoc\x20block\x20stop\x20traverse\x20BFS','context','extension','priority','response','code','result','isUndefined','toString','agicommand\x20not\x20found','[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','finally','[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s','continueAt','Project\x20%s\x20not\x20published','voice','callysquare','[LICENSE]\x20CHANNELS:\x20%s','[LICENSE]\x20CHANNELS:\x20UNLIMITED','[LICENSE]','connection','xml2json','lodash'];(function(_0x4ee508,_0xec5ce8){var _0x37981d=function(_0x3b857c){while(--_0x3b857c){_0x4ee508['push'](_0x4ee508['shift']());}};_0x37981d(++_0xec5ce8);}(_0xe64d,0x15a));var _0xde64=function(_0x4cbf20,_0x1bfa66){_0x4cbf20=_0x4cbf20-0x0;var _0x582ae4=_0xe64d[_0x4cbf20];return _0x582ae4;};'use strict';var parser=require(_0xde64('0x0'));var _=require(_0xde64('0x1'));var syncho=require('syncho');var util=require(_0xde64('0x2'));var moment=require(_0xde64('0x3'));var config=require(_0xde64('0x4'));var logger=require('../../config/logger')(_0xde64('0x5'));var utilLicense=require(_0xde64('0x6'));var rpc=require(_0xde64('0x7'));var mailRpc=require(_0xde64('0x8'));var Graph=require(_0xde64('0x9'));var Vertices=require(_0xde64('0xa'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;config[_0xde64('0x5')]=_[_0xde64('0xb')](config[_0xde64('0x5')],{'ip':'127.0.0.1','port':0x11dd});function connectionHandler(_0x41a920){process[_0xde64('0xc')](function(){syncho(function(){try{setChannelVariables(_0x41a920);agiHandler(_0x41a920);}catch(_0x4517d5){logger[_0xde64('0xd')](_0x4517d5[_0xde64('0xe')]);}});});}function listeningHandler(){console[_0xde64('0xf')](_0xde64('0x10'),config[_0xde64('0x5')][_0xde64('0x11')]);logger[_0xde64('0x12')](util[_0xde64('0x13')](_0xde64('0x14'),config[_0xde64('0x5')]['ip'],config[_0xde64('0x5')]['port']));}function errorHandler(_0x4ba85b){if(_0x4ba85b&&_0x4ba85b[_0xde64('0x15')]&&_0x4ba85b['message']){logger[_0xde64('0xd')](util[_0xde64('0x13')](_0xde64('0x16'),_0x4ba85b[_0xde64('0x15')],_0x4ba85b[_0xde64('0x17')]));}else{logger[_0xde64('0xd')](util[_0xde64('0x13')]('[ERROR]\x20%s',_0x4ba85b[_0xde64('0xe')]));}}function closeHandler(){logger['info'](util[_0xde64('0x13')]('[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this[_0xde64('0x18')],this[_0xde64('0x19')],this[_0xde64('0x1a')],this['dnid'],this[_0xde64('0x1b')]));try{createSquareReport(this);}catch(_0xd12e81){logger[_0xde64('0xd')](_0xd12e81[_0xde64('0xe')]);}}function timeoutHandler(){logger['info'](util[_0xde64('0x13')](_0xde64('0x1c'),this[_0xde64('0x18')],this['calleridname'],this[_0xde64('0x1a')],this[_0xde64('0x1d')],this['uniqueid']));}function hangupHandler(){logger['info'](util[_0xde64('0x13')](_0xde64('0x1e'),this[_0xde64('0x18')],this['calleridname'],this['callerid'],this[_0xde64('0x1d')],this[_0xde64('0x1b')]));this[_0xde64('0x1f')]=!![];}function getRoot(_0x315f9b){return parser[_0xde64('0x20')](_0x315f9b,{'object':!![]})[_0xde64('0x21')][_0xde64('0x22')];}function addVertex(_0x2917bb,_0x18b72f,_0x3c8746){_0x18b72f['agicommand']=_0x3c8746;if(_0x18b72f[_0xde64('0x23')](_0xde64('0x24'))){_0x18b72f[_0xde64('0x25')]=parseInt(_0x18b72f[_0xde64('0x24')],0xa);}_0x2917bb['addVertex'](_[_0xde64('0x26')](_0x18b72f,_0xde64('0x27')));}function initGraph(_0x49d665,_0x72cf02){var _0x4eea68=new Graph();for(var _0x5c8ca8 in _0x49d665){if(_0x49d665['hasOwnProperty'](_0x5c8ca8)){if(_['isArray'](_0x49d665[_0x5c8ca8])){for(var _0x558940=0x0;_0x558940<_0x49d665[_0x5c8ca8]['length'];_0x558940+=0x1){addVertex(_0x4eea68,_0x49d665[_0x5c8ca8][_0x558940],_0x5c8ca8);}}else{addVertex(_0x4eea68,_0x49d665[_0x5c8ca8],_0x5c8ca8);}}}for(var _0x517920=0x0;_0x517920<_0x72cf02['length'];_0x517920+=0x1){if(_0x72cf02[_0x517920][_0xde64('0x28')]&&_0x72cf02[_0x517920][_0xde64('0x29')]){_0x4eea68[_0xde64('0x2a')](_0x72cf02[_0x517920][_0xde64('0x28')],_0x72cf02[_0x517920][_0xde64('0x29')],_0x72cf02[_0x517920]['value']);}}return _0x4eea68;}function getSquareProject(_0x23a6b9,_0x437914){rpc['getSquareProject'](_0x23a6b9)[_0xde64('0x2b')](function(_0x4cc596){_0x437914(null,_0x4cc596);})[_0xde64('0x2c')](function(_0x32d6b7){_0x437914(null,_0x32d6b7);});}function createSquareReport(_0x3a5d14,_0x44792f){rpc[_0xde64('0x2d')](_0x3a5d14)['then'](function(_0x465d4a){if(_0x44792f){_0x44792f(null,_0x465d4a);}})[_0xde64('0x2c')](function(_0x1dc47f){if(_0x44792f){_0x44792f(null,_0x1dc47f);}});}function setChannelVariables(_0x4fea35){for(var _0x557700 in _0x4fea35){if(_0x4fea35[_0xde64('0x23')](_0x557700)){if(_0x557700[_0xde64('0x2e')]('agi_')===0x0){_0x4fea35[_0x557700[_0xde64('0x2f')](0x4)]=_0x4fea35[_0x557700];delete _0x4fea35[_0x557700];}}}}function getLogFromObject(_0xab79a3){return util[_0xde64('0x30')](_0xab79a3,{'showHidden':![],'depth':null});}function agiHandler(_0x3b1eaa){var _0xc77e00,_0x183052,_0x5a3dd3,_0x1dbf58,_0x2bed03;logger[_0xde64('0x31')]('variables',JSON[_0xde64('0x32')](_0x3b1eaa,null,0x2));logger[_0xde64('0x12')](util[_0xde64('0x13')]('[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x3b1eaa['arg_1'],_0x3b1eaa[_0xde64('0x19')],_0x3b1eaa['callerid'],_0x3b1eaa['dnid'],_0x3b1eaa[_0xde64('0x1b')]));_0x3b1eaa['on'](_0xde64('0xd'),errorHandler);_0x3b1eaa['on'](_0xde64('0x33'),closeHandler);_0x3b1eaa['on'](_0xde64('0x34'),timeoutHandler);_0x3b1eaa[_0xde64('0x1f')]=![];_0x3b1eaa['on'](_0xde64('0x35'),hangupHandler);var _0xef3b8c=getSquareProject[_0xde64('0x36')](null,_0x3b1eaa[_0xde64('0x18')]);if(_0xef3b8c){if(_0xef3b8c[_0xde64('0x37')]){_0xc77e00=getRoot(_0xef3b8c[_0xde64('0x37')]);if(_0xc77e00&&_0xc77e00[_0xde64('0x38')]){logger['debug'](_0xde64('0x22'),JSON[_0xde64('0x32')](_0xc77e00,null,0x2));_0x3b1eaa[_0xde64('0x39')]=moment()['format'](_0xde64('0x3a'));_0x183052=initGraph(_[_0xde64('0x26')](_0xc77e00,'mxCell'),_0xc77e00['mxCell']);_0x5a3dd3=new Vertices(_0x3b1eaa,rpc,mailRpc);logger['info'](util[_0xde64('0x13')](_0xde64('0x3b'),_0x3b1eaa['arg_1'],_0x3b1eaa['calleridname'],_0x3b1eaa[_0xde64('0x1a')],_0x3b1eaa[_0xde64('0x1d')],_0x3b1eaa['uniqueid']));_0x183052[_0xde64('0x3c')](_0xc77e00[_0xde64('0x38')]['id'],function(_0x27e19a){try{_0x27e19a=_0x5a3dd3[_0xde64('0x3d')](_0x27e19a);logger[_0xde64('0x31')](_0xde64('0x3e'),JSON[_0xde64('0x32')](_0x27e19a,null,0x2));if(_0x27e19a[_0xde64('0x3f')]===_0xde64('0x40')){logger[_0xde64('0x12')](_0xde64('0x41'));_0x3b1eaa['context']=_0x27e19a[_0xde64('0x42')]||_0x3b1eaa['context'];_0x3b1eaa[_0xde64('0x43')]=_0x27e19a[_0xde64('0x43')];_0x3b1eaa[_0xde64('0x44')]=_0x27e19a[_0xde64('0x44')]?_0x27e19a['priority']-0x1:0x1;return null;}else if(_0x27e19a&&_0x5a3dd3[_0x27e19a[_0xde64('0x3f')]]){_0x2bed03=_0x5a3dd3[_0x27e19a[_0xde64('0x3f')]](_0x27e19a);logger[_0xde64('0x12')](_0xde64('0x45'),JSON['stringify'](_0x2bed03,null,0x2));if(_0x2bed03&&_0x2bed03[_0xde64('0x46')]===AGI_CODE_SUCCESS&&_0x2bed03[_0xde64('0x47')]!==AGI_RESULT_ERROR&&!_0x3b1eaa[_0xde64('0x1f')]){logger[_0xde64('0x31')]('response',getLogFromObject(_0x2bed03));return _[_0xde64('0x48')](_0x2bed03[_0xde64('0x47')])?null:_0x2bed03['result'][_0xde64('0x49')]();}else{logger[_0xde64('0xd')](_0xde64('0x45'),getLogFromObject(_0x2bed03));return null;}}else{logger[_0xde64('0xd')](_0xde64('0x4a'));return null;}}catch(_0x372857){logger[_0xde64('0xd')](_0x372857[_0xde64('0xe')]);return null;}});if(_0xc77e00['finally']){logger[_0xde64('0x12')](util['format'](_0xde64('0x4b'),_0x3b1eaa[_0xde64('0x18')],_0x3b1eaa[_0xde64('0x19')],_0x3b1eaa[_0xde64('0x1a')],_0x3b1eaa[_0xde64('0x1d')],_0x3b1eaa[_0xde64('0x1b')]));_0x183052[_0xde64('0x3c')](_0xc77e00[_0xde64('0x4c')]['id'],function(_0x40891e){try{_0x40891e=_0x5a3dd3[_0xde64('0x3d')](_0x40891e);logger[_0xde64('0x31')](_0xde64('0x3e'),JSON[_0xde64('0x32')](_0x40891e,null,0x2));if(_0x40891e&&_0x5a3dd3[_0x40891e[_0xde64('0x3f')]]){_0x2bed03=_0x5a3dd3[_0x40891e[_0xde64('0x3f')]](_0x40891e);if(_0x2bed03){logger[_0xde64('0x31')]('response',getLogFromObject(_0x2bed03));return _['isUndefined'](_0x2bed03[_0xde64('0x47')])?null:_0x2bed03['result']['toString']();}else{logger[_0xde64('0xd')]('response',getLogFromObject(_0x2bed03));return null;}}else{logger[_0xde64('0xd')](_0xde64('0x4a'));return null;}}catch(_0x1efd51){logger[_0xde64('0xd')](_0x1efd51[_0xde64('0xe')]);return null;}});}logger[_0xde64('0x12')](util[_0xde64('0x13')](_0xde64('0x4d'),_0x3b1eaa['arg_1'],_0x3b1eaa[_0xde64('0x19')],_0x3b1eaa['callerid'],_0x3b1eaa['dnid'],_0x3b1eaa[_0xde64('0x1b')]));logger[_0xde64('0x12')](util[_0xde64('0x13')](_0xde64('0x4e'),_0x3b1eaa[_0xde64('0x42')],_0x3b1eaa[_0xde64('0x43')],parseInt(_0x3b1eaa[_0xde64('0x44')],0xa)+0x1));_0x3b1eaa[_0xde64('0x4f')](_0x3b1eaa[_0xde64('0x42')],_0x3b1eaa[_0xde64('0x43')],parseInt(_0x3b1eaa[_0xde64('0x44')],0xa)+0x1);_0x3b1eaa[_0xde64('0x33')]();}}else{logger[_0xde64('0xd')](util['format'](_0xde64('0x50'),_0x3b1eaa['arg_1']));_0x3b1eaa[_0xde64('0x4f')](_0x3b1eaa[_0xde64('0x42')],_0x3b1eaa[_0xde64('0x43')],parseInt(_0x3b1eaa[_0xde64('0x44')],0xa)+0x1);_0x3b1eaa[_0xde64('0x33')]();}}else{logger['error'](util[_0xde64('0x13')]('Project\x20%s\x20not\x20found',_0x3b1eaa[_0xde64('0x18')]));_0x3b1eaa[_0xde64('0x4f')](_0x3b1eaa['context'],_0x3b1eaa[_0xde64('0x43')],parseInt(_0x3b1eaa[_0xde64('0x44')],0xa)+0x1);_0x3b1eaa['close']();}}function main(){var _0x131d04;return utilLicense['getLicense']()['then'](function(_0x4be1a5){if(_0x4be1a5){if(_0x4be1a5[_0xde64('0x51')]){if(_0x4be1a5['callysquare']&&_0x4be1a5[_0xde64('0x52')]>0x0){logger[_0xde64('0x12')](util['format'](_0xde64('0x53'),_0x4be1a5[_0xde64('0x52')]));_0x131d04=_0x4be1a5[_0xde64('0x52')];}else{logger['info'](_0xde64('0x54'));}}else{logger[_0xde64('0x12')]('[LICENSE]\x20VOICE\x20IS\x20DISABLED');_0x131d04=-0x1;}}})['catch'](function(_0x458d4b){logger[_0xde64('0xd')](_0xde64('0x55'),_0x458d4b[_0xde64('0xe')]);})[_0xde64('0x4c')](function(){var _0x1d8b60=require('./server')(config[_0xde64('0x5')][_0xde64('0x11')],config[_0xde64('0x5')]['ip'],_0x131d04);_0x1d8b60['on'](_0xde64('0xd'),errorHandler);_0x1d8b60['on']('listening',listeningHandler);_0x1d8b60['on'](_0xde64('0x56'),connectionHandler);_0x1d8b60['on'](_0xde64('0x33'),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 237d798..39338ee 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 _0xa2be=['then','error','result','catch','sendMailMessage','SendMail','bluebird','jayson/promise','client','request'];(function(_0x31ef37,_0xa37c01){var _0x348d29=function(_0x4b7ca4){while(--_0x4b7ca4){_0x31ef37['push'](_0x31ef37['shift']());}};_0x348d29(++_0xa37c01);}(_0xa2be,0x114));var _0xea2b=function(_0x1fc735,_0x11db60){_0x1fc735=_0x1fc735-0x0;var _0x574095=_0xa2be[_0x1fc735];return _0x574095;};'use strict';var BPromise=require(_0xea2b('0x0'));var jayson=require(_0xea2b('0x1'));var client=jayson[_0xea2b('0x2')]['http']({'port':0x232b});function request(_0x517d60,_0x1a502f){return new BPromise(function(_0x39506c,_0x4e50b4){return client[_0xea2b('0x3')](_0x517d60,_0x1a502f)[_0xea2b('0x4')](function(_0xfab161){if(_0xfab161[_0xea2b('0x5')]){return _0x4e50b4(_0xfab161['error']['message']);}else{return _0x39506c(_0xfab161[_0xea2b('0x6')]);}})[_0xea2b('0x7')](function(_0x56d521){return _0x4e50b4(_0x56d521);});});}exports[_0xea2b('0x8')]=function(_0x298e43,_0x47ac51){return request(_0xea2b('0x9'),{'account':_0x298e43,'message':_0x47ac51});}; \ No newline at end of file +var _0x162a=['error','result','sendMailMessage','SendMail','jayson/promise','http','request'];(function(_0x4ee585,_0x3aa9fa){var _0x561c7a=function(_0x4e16b1){while(--_0x4e16b1){_0x4ee585['push'](_0x4ee585['shift']());}};_0x561c7a(++_0x3aa9fa);}(_0x162a,0xe4));var _0xa162=function(_0x108d21,_0x175cc9){_0x108d21=_0x108d21-0x0;var _0x276df2=_0x162a[_0x108d21];return _0x276df2;};'use strict';var BPromise=require('bluebird');var jayson=require(_0xa162('0x0'));var client=jayson['client'][_0xa162('0x1')]({'port':0x232b});function request(_0x5ce84c,_0x967e9d){return new BPromise(function(_0x278ec0,_0x55c38b){return client[_0xa162('0x2')](_0x5ce84c,_0x967e9d)['then'](function(_0x1b99f9){if(_0x1b99f9['error']){return _0x55c38b(_0x1b99f9[_0xa162('0x3')]['message']);}else{return _0x278ec0(_0x1b99f9[_0xa162('0x4')]);}})['catch'](function(_0x30d3ef){return _0x55c38b(_0x30d3ef);});});}exports[_0xa162('0x5')]=function(_0x58c898,_0xa01029){return request(_0xa162('0x6'),{'account':_0x58c898,'message':_0xa01029});}; \ No newline at end of file diff --git a/server/services/agi/reply.js b/server/services/agi/reply.js index 16c0773..52d0535 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 _0xf8aa=['indexOf','substring','length','split','slice','trim','emit','headers','line','util','_localBuffer','_inBody','inherits','prototype','_transform','\x0d\x0a\x0d\x0a','toString'];(function(_0x439750,_0x23e7bc){var _0x4177c2=function(_0x340cc4){while(--_0x340cc4){_0x439750['push'](_0x439750['shift']());}};_0x4177c2(++_0x23e7bc);}(_0xf8aa,0x13b));var _0xaf8a=function(_0x12fc8d,_0x19ee33){_0x12fc8d=_0x12fc8d-0x0;var _0x3f9d04=_0xf8aa[_0x12fc8d];return _0x3f9d04;};'use strict';var util=require(_0xaf8a('0x0'));var Transform=require('stream')['Transform'];function AGIReply(_0x3b77fb){Transform['call'](this,_0x3b77fb);this[_0xaf8a('0x1')]='';this[_0xaf8a('0x2')]=![];}util[_0xaf8a('0x3')](AGIReply,Transform);AGIReply[_0xaf8a('0x4')][_0xaf8a('0x5')]=function(_0x4309d2,_0x33862d,_0x13e8f2){var _0xc63b84='\x0a',_0x2ce005=['\x0a\x0a',_0xaf8a('0x6')],_0x249266=-0x1,_0x396b5e=-0x1,_0xac1082='',_0x3e667d=0x0,_0x35dcf1='',_0x4f0a62='';this[_0xaf8a('0x1')]+=_0x4309d2[_0xaf8a('0x7')]();_0x35dcf1=this[_0xaf8a('0x1')];if(!this[_0xaf8a('0x2')]){_0x3e667d=0x0;while(_0x2ce005[_0x3e667d]){while((_0x396b5e=_0x35dcf1[_0xaf8a('0x8')](_0x2ce005[_0x3e667d]))!=-0x1){_0xac1082=_0x2ce005[_0x3e667d];_0x4f0a62=_0x35dcf1['substring'](0x0,_0x396b5e);_0x35dcf1=_0x35dcf1[_0xaf8a('0x9')](_0x396b5e+_0xac1082[_0xaf8a('0xa')]);var _0x1eb352=_0x4f0a62[_0xaf8a('0xb')](_0xc63b84),_0x32f6d7=0x0,_0xedd483={},_0x3b3085='',_0x19371b='',_0x1eddc9=-0x1;while(_0x1eb352[_0x32f6d7]){_0x1eddc9=_0x1eb352[_0x32f6d7][_0xaf8a('0x8')](':');if(_0x1eddc9!=-0x1){_0x3b3085=_0x1eb352[_0x32f6d7][_0xaf8a('0xc')](0x0,_0x1eddc9)[_0xaf8a('0xd')]();_0x19371b=_0x1eb352[_0x32f6d7][_0xaf8a('0xc')](_0x1eddc9+0x1)[_0xaf8a('0xd')]();if(_0x3b3085[_0xaf8a('0xa')]>0x0){_0xedd483[_0x3b3085]=_0x19371b;}}else{}_0x32f6d7++;}this[_0xaf8a('0xe')](_0xaf8a('0xf'),_0xedd483);this[_0xaf8a('0x2')]=!![];}_0x3e667d++;}this['_localBuffer']=_0x35dcf1;}else{while((_0x249266=_0x35dcf1[_0xaf8a('0x8')](_0xc63b84))!=-0x1){_0x4f0a62=_0x35dcf1[_0xaf8a('0x9')](0x0,_0x249266);this[_0xaf8a('0xe')](_0xaf8a('0x10'),_0x4f0a62);_0x35dcf1=_0x35dcf1['substring'](_0x249266+_0xc63b84['length']);}this[_0xaf8a('0x1')]=_0x35dcf1;}_0x13e8f2();};module['exports']=AGIReply; \ No newline at end of file +var _0xf0cc=['inherits','\x0d\x0a\x0d\x0a','toString','_localBuffer','indexOf','substring','length','slice','trim','headers','emit','util','_inBody'];(function(_0x5dbb84,_0x1bbce9){var _0x1d6eae=function(_0xd93967){while(--_0xd93967){_0x5dbb84['push'](_0x5dbb84['shift']());}};_0x1d6eae(++_0x1bbce9);}(_0xf0cc,0xa7));var _0xcf0c=function(_0x246c27,_0x2697f6){_0x246c27=_0x246c27-0x0;var _0xcbcb6d=_0xf0cc[_0x246c27];return _0xcbcb6d;};'use strict';var util=require(_0xcf0c('0x0'));var Transform=require('stream')['Transform'];function AGIReply(_0x242eb2){Transform['call'](this,_0x242eb2);this['_localBuffer']='';this[_0xcf0c('0x1')]=![];}util[_0xcf0c('0x2')](AGIReply,Transform);AGIReply['prototype']['_transform']=function(_0x2c4b4a,_0x345773,_0x1a6003){var _0x497363='\x0a',_0x346cb0=['\x0a\x0a',_0xcf0c('0x3')],_0x1503f6=-0x1,_0x2cb15a=-0x1,_0x5d4cdb='',_0x54cef0=0x0,_0x3cf3cb='',_0x53a853='';this['_localBuffer']+=_0x2c4b4a[_0xcf0c('0x4')]();_0x3cf3cb=this[_0xcf0c('0x5')];if(!this[_0xcf0c('0x1')]){_0x54cef0=0x0;while(_0x346cb0[_0x54cef0]){while((_0x2cb15a=_0x3cf3cb[_0xcf0c('0x6')](_0x346cb0[_0x54cef0]))!=-0x1){_0x5d4cdb=_0x346cb0[_0x54cef0];_0x53a853=_0x3cf3cb[_0xcf0c('0x7')](0x0,_0x2cb15a);_0x3cf3cb=_0x3cf3cb[_0xcf0c('0x7')](_0x2cb15a+_0x5d4cdb[_0xcf0c('0x8')]);var _0x47a6c9=_0x53a853['split'](_0x497363),_0xfca99c=0x0,_0x1e9889={},_0x6dde21='',_0x34f74f='',_0x327f65=-0x1;while(_0x47a6c9[_0xfca99c]){_0x327f65=_0x47a6c9[_0xfca99c][_0xcf0c('0x6')](':');if(_0x327f65!=-0x1){_0x6dde21=_0x47a6c9[_0xfca99c][_0xcf0c('0x9')](0x0,_0x327f65)[_0xcf0c('0xa')]();_0x34f74f=_0x47a6c9[_0xfca99c]['slice'](_0x327f65+0x1)['trim']();if(_0x6dde21[_0xcf0c('0x8')]>0x0){_0x1e9889[_0x6dde21]=_0x34f74f;}}else{}_0xfca99c++;}this['emit'](_0xcf0c('0xb'),_0x1e9889);this[_0xcf0c('0x1')]=!![];}_0x54cef0++;}this['_localBuffer']=_0x3cf3cb;}else{while((_0x1503f6=_0x3cf3cb['indexOf'](_0x497363))!=-0x1){_0x53a853=_0x3cf3cb['substring'](0x0,_0x1503f6);this[_0xcf0c('0xc')]('line',_0x53a853);_0x3cf3cb=_0x3cf3cb[_0xcf0c('0x7')](_0x1503f6+_0x497363[_0xcf0c('0x8')]);}this['_localBuffer']=_0x3cf3cb;}_0x1a6003();};module['exports']=AGIReply; \ No newline at end of file diff --git a/server/services/agi/rpc/index.js b/server/services/agi/rpc/index.js index fd67737..dec9be0 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 _0x6108=['email','getSquareProjectById','getVoiceQueueById','ShowVoiceQueue','getVariableById','getSquareOdbcById','ShowUser','getContactByPhone','phone','ShowTrunk','ShowSound','getIntervalById','ShowInterval','Interval','Intervals','getSmsAccountById','ShowSmsAccount','createSmsMessage','CreateSmsMessage','CreateSquareDetailsReport','createSquareReport','CreateSquareReport','format','YYYY-MM-DD\x20HH:mm:ss','createSquareMessage','createCmContact','ShowCmHopper','ListId','CreateCmContact','getPauseById','agentPause','agentUnpause','UnpauseUser','agentLogout','LogoutUser','bluebird','lodash','util','jayson/promise','request','then','error','message','catch','getSquareProject','ShowSquareProject','production','getMailAccountById','ShowMailAccount','MailServerOut','name'];(function(_0x436c76,_0x2c8dcc){var _0x2d517e=function(_0x2e66f4){while(--_0x2e66f4){_0x436c76['push'](_0x436c76['shift']());}};_0x2d517e(++_0x2c8dcc);}(_0x6108,0xbc));var _0x8610=function(_0x43f64b,_0x1205a2){_0x43f64b=_0x43f64b-0x0;var _0x4c49e3=_0x6108[_0x43f64b];return _0x4c49e3;};'use strict';var BPromise=require(_0x8610('0x0'));var moment=require('moment');var _=require(_0x8610('0x1'));var util=require(_0x8610('0x2'));var jayson=require(_0x8610('0x3'));var client=jayson['client']['http']({'port':0x2329});function request(_0x142cb5,_0x42741d){return new BPromise(function(_0x54802f,_0x4aa00f){return client[_0x8610('0x4')](_0x142cb5,_0x42741d)[_0x8610('0x5')](function(_0x28a680){if(_0x28a680[_0x8610('0x6')]){return _0x4aa00f(_0x28a680['error'][_0x8610('0x7')]);}else{return _0x54802f(_0x28a680['result']);}})[_0x8610('0x8')](function(_0x2255a0){return _0x4aa00f(_0x2255a0);});});}exports[_0x8610('0x9')]=function(_0x48d693){return request(_0x8610('0xa'),{'options':{'raw':![],'where':{'name':_0x48d693},'attributes':[_0x8610('0xb')]}});};exports[_0x8610('0xc')]=function(_0x1eb419){return request(_0x8610('0xd'),{'options':{'raw':![],'where':{'id':_0x1eb419},'include':[{'model':_0x8610('0xe'),'as':'Smtp'}],'attributes':['id',_0x8610('0xf'),_0x8610('0x10')]}});};exports[_0x8610('0x11')]=function(_0x4ee6f4){return request(_0x8610('0xa'),{'options':{'where':{'id':_0x4ee6f4},'attributes':['name']}});};exports[_0x8610('0x12')]=function(_0x42e660){return request(_0x8610('0x13'),{'options':{'where':{'id':_0x42e660},'attributes':[_0x8610('0xf')]}});};exports[_0x8610('0x14')]=function(_0x4eacbf){return request('ShowVariable',{'options':{'where':{'id':_0x4eacbf},'attributes':[_0x8610('0xf')]}});};exports[_0x8610('0x15')]=function(_0x214015){return request('ShowSquareOdbc',{'options':{'where':{'id':_0x214015},'attributes':['dsn']}});};exports['getUserById']=function(_0x3d94c2){return request(_0x8610('0x16'),{'options':{'where':{'id':_0x3d94c2},'attributes':[_0x8610('0xf')]}});};exports[_0x8610('0x17')]=function(_0x517a5c){return request('GetContactByPhone',{'options':{'where':{'phone':_0x517a5c[_0x8610('0x18')]},'attributes':['id']}});};exports['getTrunkById']=function(_0x5e945f){return request(_0x8610('0x19'),{'options':{'where':{'id':_0x5e945f},'attributes':['name']}});};exports['getSoundById']=function(_0x11daba){return request(_0x8610('0x1a'),{'options':{'where':{'id':_0x11daba},'attributes':['save_name']}});};exports[_0x8610('0x1b')]=function(_0x327b56){return request(_0x8610('0x1c'),{'options':{'raw':![],'where':{'id':_0x327b56},'include':[{'model':_0x8610('0x1d'),'as':_0x8610('0x1e')}]}});};exports[_0x8610('0x1f')]=function(_0x2e3e69){return request(_0x8610('0x20'),{'options':{'where':{'id':_0x2e3e69},'attributes':['id',_0x8610('0xf')]}});};exports[_0x8610('0x21')]=function(_0x521823){return request(_0x8610('0x22'),{'body':_0x521823});};exports['createSquareDetailsReport']=function(_0x285f1a){return request(_0x8610('0x23'),{'body':_0x285f1a});};exports[_0x8610('0x24')]=function(_0x5103ad){return request(_0x8610('0x25'),{'body':_['merge'](_0x5103ad,{'project_name':_0x5103ad['arg_1'],'prev_project_name':_0x5103ad['arg_2']||'','is_subproject':_0x5103ad['arg_2']?!![]:![],'leaveAt':moment()[_0x8610('0x26')](_0x8610('0x27'))})});};exports['createSquareRecording']=function(_0x3cc4d2){return request('CreateSquareRecording',{'body':_0x3cc4d2});};exports[_0x8610('0x28')]=function(_0x2503bc){return request('CreateSquareMessage',{'body':_0x2503bc});};exports[_0x8610('0x29')]=function(_0x345369){return request(_0x8610('0x2a'),{'options':{'raw':![],'where':{'phone':_0x345369[_0x8610('0x18')],'ListId':_0x345369[_0x8610('0x2b')]}}})[_0x8610('0x5')](function(_0x4e4c16){if(_0x4e4c16){return _0x4e4c16;}return request(_0x8610('0x2c'),{'body':_0x345369});});};exports[_0x8610('0x2d')]=function(_0x10f996){return request('ShowPause',{'options':{'where':{'id':_0x10f996},'attributes':[_0x8610('0xf')]}});};exports['agentLogin']=function(_0x34f169,_0x5c67f6){return request('LoginUser',{'body':{'interface':_0x5c67f6},'options':{'where':_0x34f169}});};exports[_0x8610('0x2e')]=function(_0x1b4064,_0x1de93c,_0x53f7ac){return request('PauseUser',{'body':{'type':_0x1de93c,'uniqueid':_0x53f7ac},'options':{'where':_0x1b4064}});};exports[_0x8610('0x2f')]=function(_0x51e682){return request(_0x8610('0x30'),{'body':{},'options':{'where':_0x51e682}});};exports[_0x8610('0x31')]=function(_0x2699f5){return request(_0x8610('0x32'),{'body':{},'options':{'where':_0x2699f5}});}; \ No newline at end of file +var _0x535f=['getVariableById','ShowVariable','getSquareOdbcById','ShowSquareOdbc','getUserById','ShowUser','getContactByPhone','GetContactByPhone','phone','getTrunkById','getSoundById','ShowSound','getIntervalById','getSmsAccountById','ShowSmsAccount','CreateSmsMessage','createSquareDetailsReport','CreateSquareDetailsReport','createSquareReport','CreateSquareReport','merge','arg_1','arg_2','format','YYYY-MM-DD\x20HH:mm:ss','createSquareRecording','CreateSquareRecording','createSquareMessage','CreateSquareMessage','createCmContact','ShowCmHopper','CreateCmContact','getPauseById','ShowPause','agentLogin','LoginUser','agentPause','PauseUser','UnpauseUser','agentLogout','LogoutUser','moment','lodash','jayson/promise','client','http','request','then','error','result','catch','ShowSquareProject','ShowMailAccount','name','email','getSquareProjectById','getVoiceQueueById','ShowVoiceQueue'];(function(_0x38f186,_0x3f2fe8){var _0x49f6eb=function(_0x4fe511){while(--_0x4fe511){_0x38f186['push'](_0x38f186['shift']());}};_0x49f6eb(++_0x3f2fe8);}(_0x535f,0x111));var _0xf535=function(_0x122e42,_0x222609){_0x122e42=_0x122e42-0x0;var _0x4c019e=_0x535f[_0x122e42];return _0x4c019e;};'use strict';var BPromise=require('bluebird');var moment=require(_0xf535('0x0'));var _=require(_0xf535('0x1'));var util=require('util');var jayson=require(_0xf535('0x2'));var client=jayson[_0xf535('0x3')][_0xf535('0x4')]({'port':0x2329});function request(_0x19ec32,_0x4ff0b3){return new BPromise(function(_0xd1ee93,_0x24a323){return client[_0xf535('0x5')](_0x19ec32,_0x4ff0b3)[_0xf535('0x6')](function(_0x41ca74){if(_0x41ca74[_0xf535('0x7')]){return _0x24a323(_0x41ca74['error']['message']);}else{return _0xd1ee93(_0x41ca74[_0xf535('0x8')]);}})[_0xf535('0x9')](function(_0x13bf04){return _0x24a323(_0x13bf04);});});}exports['getSquareProject']=function(_0x244189){return request(_0xf535('0xa'),{'options':{'raw':![],'where':{'name':_0x244189},'attributes':['production']}});};exports['getMailAccountById']=function(_0x56f05d){return request(_0xf535('0xb'),{'options':{'raw':![],'where':{'id':_0x56f05d},'include':[{'model':'MailServerOut','as':'Smtp'}],'attributes':['id',_0xf535('0xc'),_0xf535('0xd')]}});};exports[_0xf535('0xe')]=function(_0x2e628e){return request(_0xf535('0xa'),{'options':{'where':{'id':_0x2e628e},'attributes':['name']}});};exports[_0xf535('0xf')]=function(_0x27e116){return request(_0xf535('0x10'),{'options':{'where':{'id':_0x27e116},'attributes':[_0xf535('0xc')]}});};exports[_0xf535('0x11')]=function(_0x338f06){return request(_0xf535('0x12'),{'options':{'where':{'id':_0x338f06},'attributes':[_0xf535('0xc')]}});};exports[_0xf535('0x13')]=function(_0xb52d7f){return request(_0xf535('0x14'),{'options':{'where':{'id':_0xb52d7f},'attributes':['dsn']}});};exports[_0xf535('0x15')]=function(_0x1e3500){return request(_0xf535('0x16'),{'options':{'where':{'id':_0x1e3500},'attributes':[_0xf535('0xc')]}});};exports[_0xf535('0x17')]=function(_0x1fb901){return request(_0xf535('0x18'),{'options':{'where':{'phone':_0x1fb901[_0xf535('0x19')]},'attributes':['id']}});};exports[_0xf535('0x1a')]=function(_0x477c1d){return request('ShowTrunk',{'options':{'where':{'id':_0x477c1d},'attributes':[_0xf535('0xc')]}});};exports[_0xf535('0x1b')]=function(_0x6f757f){return request(_0xf535('0x1c'),{'options':{'where':{'id':_0x6f757f},'attributes':['save_name']}});};exports[_0xf535('0x1d')]=function(_0x1990b1){return request('ShowInterval',{'options':{'raw':![],'where':{'id':_0x1990b1},'include':[{'model':'Interval','as':'Intervals'}]}});};exports[_0xf535('0x1e')]=function(_0x141267){return request(_0xf535('0x1f'),{'options':{'where':{'id':_0x141267},'attributes':['id','name']}});};exports['createSmsMessage']=function(_0x438cb1){return request(_0xf535('0x20'),{'body':_0x438cb1});};exports[_0xf535('0x21')]=function(_0x16bd23){return request(_0xf535('0x22'),{'body':_0x16bd23});};exports[_0xf535('0x23')]=function(_0x358c91){return request(_0xf535('0x24'),{'body':_[_0xf535('0x25')](_0x358c91,{'project_name':_0x358c91[_0xf535('0x26')],'prev_project_name':_0x358c91[_0xf535('0x27')]||'','is_subproject':_0x358c91['arg_2']?!![]:![],'leaveAt':moment()[_0xf535('0x28')](_0xf535('0x29'))})});};exports[_0xf535('0x2a')]=function(_0x46ce43){return request(_0xf535('0x2b'),{'body':_0x46ce43});};exports[_0xf535('0x2c')]=function(_0x351b3a){return request(_0xf535('0x2d'),{'body':_0x351b3a});};exports[_0xf535('0x2e')]=function(_0x60cb11){return request(_0xf535('0x2f'),{'options':{'raw':![],'where':{'phone':_0x60cb11[_0xf535('0x19')],'ListId':_0x60cb11['ListId']}}})['then'](function(_0x47151e){if(_0x47151e){return _0x47151e;}return request(_0xf535('0x30'),{'body':_0x60cb11});});};exports[_0xf535('0x31')]=function(_0x2fceb0){return request(_0xf535('0x32'),{'options':{'where':{'id':_0x2fceb0},'attributes':['name']}});};exports[_0xf535('0x33')]=function(_0x51c3fd,_0x508e77){return request(_0xf535('0x34'),{'body':{'interface':_0x508e77},'options':{'where':_0x51c3fd}});};exports[_0xf535('0x35')]=function(_0x1e432d,_0x3463da,_0x4137b2){return request(_0xf535('0x36'),{'body':{'type':_0x3463da,'uniqueid':_0x4137b2},'options':{'where':_0x1e432d}});};exports['agentUnpause']=function(_0x74da53){return request(_0xf535('0x37'),{'body':{},'options':{'where':_0x74da53}});};exports[_0xf535('0x38')]=function(_0x21e225){return request(_0xf535('0x39'),{'body':{},'options':{'where':_0x21e225}});}; \ 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 404031c..d3c0643 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 _0xeff8=['./polly','./lex'];(function(_0x224ace,_0x28ffc4){var _0x11218f=function(_0x14ff6f){while(--_0x14ff6f){_0x224ace['push'](_0x224ace['shift']());}};_0x11218f(++_0x28ffc4);}(_0xeff8,0x186));var _0x8eff=function(_0x1b7368,_0x3286ed){_0x1b7368=_0x1b7368-0x0;var _0x25d54c=_0xeff8[_0x1b7368];return _0x25d54c;};var polly=require(_0x8eff('0x0'));var lex=require(_0x8eff('0x1'));module['exports']={'polly':polly,'lex':lex}; \ No newline at end of file +var _0x4753=['./lex','exports','./polly'];(function(_0x11946c,_0x12152c){var _0x383935=function(_0x61fce2){while(--_0x61fce2){_0x11946c['push'](_0x11946c['shift']());}};_0x383935(++_0x12152c);}(_0x4753,0x1f4));var _0x3475=function(_0x3693dd,_0x74cff6){_0x3693dd=_0x3693dd-0x0;var _0x196bf2=_0x4753[_0x3693dd];return _0x196bf2;};var polly=require(_0x3475('0x0'));var lex=require(_0x3475('0x1'));module[_0x3475('0x2')]={'polly':polly,'lex':lex}; \ No newline at end of file diff --git a/server/services/agi/scripts/aws/lex/index.js b/server/services/agi/scripts/aws/lex/index.js index c72bd41..1053611 100644 --- a/server/services/agi/scripts/aws/lex/index.js +++ b/server/services/agi/scripts/aws/lex/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa571=['exports','./lib/api'];(function(_0x58965a,_0x2e71db){var _0x254efc=function(_0xf14fb4){while(--_0xf14fb4){_0x58965a['push'](_0x58965a['shift']());}};_0x254efc(++_0x2e71db);}(_0xa571,0x107));var _0x1a57=function(_0x5405da,_0x5211a4){_0x5405da=_0x5405da-0x0;var _0x51faee=_0xa571[_0x5405da];return _0x51faee;};'use strict';var lex=require(_0x1a57('0x0'));module[_0x1a57('0x1')]=function(_0x206f1b,_0x1067d9,_0x48485e,_0x1a071f,_0x2eebaa,_0x4d5f7a){return lex(_0x206f1b,_0x1067d9,_0x48485e,_0x1a071f,_0x2eebaa,_0x4d5f7a);}; \ No newline at end of file +var _0xa571=['exports','./lib/api'];(function(_0x9729d7,_0x1b79a8){var _0x3c4ac6=function(_0x401ba6){while(--_0x401ba6){_0x9729d7['push'](_0x9729d7['shift']());}};_0x3c4ac6(++_0x1b79a8);}(_0xa571,0x107));var _0x1a57=function(_0x21816c,_0x880c58){_0x21816c=_0x21816c-0x0;var _0x38c5dd=_0xa571[_0x21816c];return _0x38c5dd;};'use strict';var lex=require(_0x1a57('0x0'));module[_0x1a57('0x1')]=function(_0x206f1b,_0x1067d9,_0x48485e,_0x1a071f,_0x2eebaa,_0x4d5f7a){return lex(_0x206f1b,_0x1067d9,_0x48485e,_0x1a071f,_0x2eebaa,_0x4d5f7a);}; \ No newline at end of file diff --git a/server/services/agi/scripts/aws/lex/lib/api.js b/server/services/agi/scripts/aws/lex/lib/api.js index 8da9d04..0d7e3ab 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(_0x2aaee5,_0x4d0b1a){var _0x3d0431=function(_0x3f5a6b){while(--_0x3f5a6b){_0x2aaee5['push'](_0x2aaee5['shift']());}};_0x3d0431(++_0x4d0b1a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1b828b,_0x344400){_0x1b828b=_0x1b828b-0x0;var _0x98da1a=_0xa9e0[_0x1b828b];return _0x98da1a;};'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(_0xac2e68,_0x425a13){var _0x1cb4a4=function(_0x2fa868){while(--_0x2fa868){_0xac2e68['push'](_0xac2e68['shift']());}};_0x1cb4a4(++_0x425a13);}(_0xa9e0,0x123));var _0x0a9e=function(_0x9aada2,_0xd2d349){_0x9aada2=_0x9aada2-0x0;var _0x196dff=_0xa9e0[_0x9aada2];return _0x196dff;};'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 9e0b537..9c23d7b 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 _0x79ee=['exports'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x79ee,0x153));var _0xe79e=function(_0x199572,_0x33e667){_0x199572=_0x199572-0x0;var _0x13cfa3=_0x79ee[_0x199572];return _0x13cfa3;};'use strict';var polly=require('./lib/api');module[_0xe79e('0x0')]=function(_0x566f5f,_0x3e6c61,_0x5b24bb,_0x3a8c29,_0x1c18c3,_0x48466f,_0x51259b){return polly(_0x566f5f,_0x3e6c61,_0x5b24bb,_0x3a8c29,_0x1c18c3,_0x48466f,_0x51259b);}; \ No newline at end of file +var _0x9dc5=['./lib/api','exports'];(function(_0x456fc1,_0x191e3d){var _0x84fab3=function(_0x22fd2b){while(--_0x22fd2b){_0x456fc1['push'](_0x456fc1['shift']());}};_0x84fab3(++_0x191e3d);}(_0x9dc5,0x1d6));var _0x59dc=function(_0x32dcfd,_0x1ec0f3){_0x32dcfd=_0x32dcfd-0x0;var _0x472ad3=_0x9dc5[_0x32dcfd];return _0x472ad3;};'use strict';var polly=require(_0x59dc('0x0'));module[_0x59dc('0x1')]=function(_0x37c852,_0x13d8ce,_0x34f8e0,_0x55714d,_0x3f6cfb,_0x3d1a8a,_0x5e71d4){return polly(_0x37c852,_0x13d8ce,_0x34f8e0,_0x55714d,_0x3f6cfb,_0x3d1a8a,_0x5e71d4);}; \ 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 32a2aa5..5469347 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 _0x56cd=['aws-sdk','synthesizeSpeech','AudioStream','writeFile','No\x20data\x20response\x20from\x20aws\x20Polly!','exports','Polly','mp3','bluebird','randomstring'];(function(_0x351b46,_0x26b265){var _0x1515df=function(_0x22896a){while(--_0x22896a){_0x351b46['push'](_0x351b46['shift']());}};_0x1515df(++_0x26b265);}(_0x56cd,0x170));var _0xd56c=function(_0x6cf19c,_0x2f3f02){_0x6cf19c=_0x6cf19c-0x0;var _0xce14f3=_0x56cd[_0x6cf19c];return _0xce14f3;};'use strict';var fs=require('fs');var path=require('path');var BPromise=require(_0xd56c('0x0'));var rs=require(_0xd56c('0x1'));var AWS=require(_0xd56c('0x2'));function pollyResult(_0x33531f,_0x4fa226,_0x3f8946){return new BPromise(function(_0x3616e1,_0x5bf31d){_0x33531f[_0xd56c('0x3')](_0x4fa226,function(_0xa1343a,_0x152081){if(_0xa1343a){_0x5bf31d(_0xa1343a);}else if(_0x152081){if(_0x152081[_0xd56c('0x4')]instanceof Buffer){fs[_0xd56c('0x5')](_0x3f8946,_0x152081['AudioStream'],function(_0x514eb6){if(_0x514eb6){_0x5bf31d(_0x514eb6);}else{_0x3616e1();}});}else{_0x5bf31d(new Error('Invalid\x20data\x20response\x20from\x20aws\x20Polly!'));}}else{_0x5bf31d(new Error(_0xd56c('0x6')));}});});}module[_0xd56c('0x7')]=function(_0xa3086,_0x3096c0,_0x40a999,_0x19512d,_0x123342,_0x3b710c,_0x4539da){var _0x5dcc28=new AWS[(_0xd56c('0x8'))]({'accessKeyId':_0xa3086,'secretAccessKey':_0x3096c0,'region':_0x40a999});var _0x8036ea={'Text':_0x123342,'TextType':_0x3b710c||'text','OutputFormat':_0xd56c('0x9'),'VoiceId':_0x19512d};return pollyResult(_0x5dcc28,_0x8036ea,_0x4539da);}; \ No newline at end of file +var _0xc534=['text','mp3','path','bluebird','randomstring','aws-sdk','AudioStream','Invalid\x20data\x20response\x20from\x20aws\x20Polly!','No\x20data\x20response\x20from\x20aws\x20Polly!','exports','Polly'];(function(_0x52ae57,_0xded61){var _0xb59a90=function(_0x1664a1){while(--_0x1664a1){_0x52ae57['push'](_0x52ae57['shift']());}};_0xb59a90(++_0xded61);}(_0xc534,0xe9));var _0x4c53=function(_0x34fe22,_0x4b0faa){_0x34fe22=_0x34fe22-0x0;var _0x126030=_0xc534[_0x34fe22];return _0x126030;};'use strict';var fs=require('fs');var path=require(_0x4c53('0x0'));var BPromise=require(_0x4c53('0x1'));var rs=require(_0x4c53('0x2'));var AWS=require(_0x4c53('0x3'));function pollyResult(_0x4df675,_0x1dcc49,_0x4af986){return new BPromise(function(_0xb6f94c,_0x427c27){_0x4df675['synthesizeSpeech'](_0x1dcc49,function(_0x50c0f9,_0x178d56){if(_0x50c0f9){_0x427c27(_0x50c0f9);}else if(_0x178d56){if(_0x178d56[_0x4c53('0x4')]instanceof Buffer){fs['writeFile'](_0x4af986,_0x178d56[_0x4c53('0x4')],function(_0x1ef61f){if(_0x1ef61f){_0x427c27(_0x1ef61f);}else{_0xb6f94c();}});}else{_0x427c27(new Error(_0x4c53('0x5')));}}else{_0x427c27(new Error(_0x4c53('0x6')));}});});}module[_0x4c53('0x7')]=function(_0x480c6a,_0x47bfa1,_0x3e8c39,_0x277f9f,_0x2ab37f,_0x48c7e3,_0x54f3df){var _0x2184f1=new AWS[(_0x4c53('0x8'))]({'accessKeyId':_0x480c6a,'secretAccessKey':_0x47bfa1,'region':_0x3e8c39});var _0x386f47={'Text':_0x2ab37f,'TextType':_0x48c7e3||_0x4c53('0x9'),'OutputFormat':_0x4c53('0xa'),'VoiceId':_0x277f9f};return pollyResult(_0x2184f1,_0x386f47,_0x54f3df);}; \ 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 d1a10bb..637dc66 100644 --- a/server/services/agi/scripts/google/asr/index.js +++ b/server/services/agi/scripts/google/asr/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd5e6=['./lib/api'];(function(_0x13e91b,_0x599700){var _0x4962e5=function(_0x1de469){while(--_0x1de469){_0x13e91b['push'](_0x13e91b['shift']());}};_0x4962e5(++_0x599700);}(_0xd5e6,0x157));var _0x6d5e=function(_0x49b207,_0x408ade){_0x49b207=_0x49b207-0x0;var _0x2dc8fa=_0xd5e6[_0x49b207];return _0x2dc8fa;};'use strict';var asr=require(_0x6d5e('0x0'));module['exports']=function(_0x663d6a,_0x5ed370,_0x3e8ff2,_0x5c3666){return asr(_0x663d6a,_0x5ed370,_0x3e8ff2);}; \ No newline at end of file +var _0x13a6=['exports'];(function(_0x56d1b5,_0x289333){var _0x4ad91e=function(_0x15f467){while(--_0x15f467){_0x56d1b5['push'](_0x56d1b5['shift']());}};_0x4ad91e(++_0x289333);}(_0x13a6,0x1b3));var _0x613a=function(_0x12067c,_0x44b263){_0x12067c=_0x12067c-0x0;var _0x3643d4=_0x13a6[_0x12067c];return _0x3643d4;};'use strict';var asr=require('./lib/api');module[_0x613a('0x0')]=function(_0x50edc2,_0x248dac,_0x2f0691,_0x569838){return asr(_0x50edc2,_0x248dac,_0x2f0691);}; \ 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 ab3b60e..32488c1 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 _0xcabc=['exports','string','length','filepath\x20should\x20be\x20a\x20string','key\x20should\x20be\x20a\x20string','undefined','lang\x20should\x20be\x20a\x20string','toString','base64','POST','/v1/speech:recognize?key=','bluebird','https://speech.googleapis.com'];(function(_0x14dd10,_0x4900d6){var _0x5cb641=function(_0x499124){while(--_0x499124){_0x14dd10['push'](_0x14dd10['shift']());}};_0x5cb641(++_0x4900d6);}(_0xcabc,0x16a));var _0xccab=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xcabc[_0x321bb2];return _0x9c12ed;};'use strict';var url=require('url');var BPromise=require(_0xccab('0x0'));var fs=require('fs');var host=_0xccab('0x1');module[_0xccab('0x2')]=function(_0x2d8811,_0x313bc9,_0x4cac16){return new BPromise(function(_0x2b1e99,_0x38a3af){var _0x59a105;if(typeof _0x2d8811!==_0xccab('0x3')||_0x2d8811[_0xccab('0x4')]===0x0){return _0x38a3af(_0xccab('0x5'));}if(typeof _0x313bc9!=='string'||_0x313bc9[_0xccab('0x4')]===0x0){return _0x38a3af(_0xccab('0x6'));}if(typeof _0x4cac16!==_0xccab('0x7')&&(typeof _0x4cac16!=='string'||_0x4cac16[_0xccab('0x4')]===0x0)){return _0x38a3af(_0xccab('0x8'));}try{_0x59a105=fs['readFileSync'](_0x2d8811)[_0xccab('0x9')](_0xccab('0xa'));}catch(_0x1186c9){return _0x38a3af(_0x1186c9);}return _0x2b1e99({'method':_0xccab('0xb'),'uri':host+_0xccab('0xc')+_0x313bc9,'body':{'config':{'encoding':'LINEAR16','sampleRateHertz':'8000','languageCode':_0x4cac16},'audio':{'content':_0x59a105}},'json':!![]});});}; \ No newline at end of file +var _0x80df=['https://speech.googleapis.com','exports','string','length','filepath\x20should\x20be\x20a\x20string','undefined','lang\x20should\x20be\x20a\x20string','readFileSync','toString','base64','POST','/v1/speech:recognize?key=','LINEAR16','8000','url','bluebird'];(function(_0x552890,_0x52079b){var _0x3e90e5=function(_0x1bfae1){while(--_0x1bfae1){_0x552890['push'](_0x552890['shift']());}};_0x3e90e5(++_0x52079b);}(_0x80df,0x17e));var _0xf80d=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x80df[_0x20a584];return _0x4b41a8;};'use strict';var url=require(_0xf80d('0x0'));var BPromise=require(_0xf80d('0x1'));var fs=require('fs');var host=_0xf80d('0x2');module[_0xf80d('0x3')]=function(_0x5390c8,_0x3aee0a,_0x216488){return new BPromise(function(_0xfd239e,_0x21365c){var _0x15d302;if(typeof _0x5390c8!==_0xf80d('0x4')||_0x5390c8[_0xf80d('0x5')]===0x0){return _0x21365c(_0xf80d('0x6'));}if(typeof _0x3aee0a!==_0xf80d('0x4')||_0x3aee0a[_0xf80d('0x5')]===0x0){return _0x21365c('key\x20should\x20be\x20a\x20string');}if(typeof _0x216488!==_0xf80d('0x7')&&(typeof _0x216488!==_0xf80d('0x4')||_0x216488[_0xf80d('0x5')]===0x0)){return _0x21365c(_0xf80d('0x8'));}try{_0x15d302=fs[_0xf80d('0x9')](_0x5390c8)[_0xf80d('0xa')](_0xf80d('0xb'));}catch(_0x45d290){return _0x21365c(_0x45d290);}return _0xfd239e({'method':_0xf80d('0xc'),'uri':host+_0xf80d('0xd')+_0x3aee0a,'body':{'config':{'encoding':_0xf80d('0xe'),'sampleRateHertz':_0xf80d('0xf'),'languageCode':_0x216488},'audio':{'content':_0x15d302}},'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 8cab0d6..7033269 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 _0xb7b2=['./asr'];(function(_0x13de68,_0x276afc){var _0x1f2fa2=function(_0x5956e4){while(--_0x5956e4){_0x13de68['push'](_0x13de68['shift']());}};_0x1f2fa2(++_0x276afc);}(_0xb7b2,0x131));var _0x2b7b=function(_0x4a736a,_0x4ff56c){_0x4a736a=_0x4a736a-0x0;var _0x30af5e=_0xb7b2[_0x4a736a];return _0x30af5e;};var asr=require(_0x2b7b('0x0'));module['exports']={'asr':asr}; \ No newline at end of file +var _0x57a5=['exports','./asr'];(function(_0x3885d9,_0x4188f8){var _0x39d60a=function(_0x23e1e7){while(--_0x23e1e7){_0x3885d9['push'](_0x3885d9['shift']());}};_0x39d60a(++_0x4188f8);}(_0x57a5,0xfd));var _0x557a=function(_0x4bbbaf,_0x41dfb8){_0x4bbbaf=_0x4bbbaf-0x0;var _0x31cd96=_0x57a5[_0x4bbbaf];return _0x31cd96;};var asr=require(_0x557a('0x0'));module[_0x557a('0x1')]={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/scripts/index.js b/server/services/agi/scripts/index.js index 2f80624..d187a0a 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 _0x1b04=['null','parse\x20response\x20failed:\x0a','length','lang\x20\x22','goggleTTS\x20path','googleASR','asr','results','alternatives','transcript','join','map','confidence','googleASR\x20transcription','googleASR\x20confidence','catch','[%s]\x20%s:%s','textRequest','result','resolvedQuery','action','actionIncomplete','fulfillment','speech','score','status','metadata','endConversation','googleDialogflowV2','replace','SessionsClient','sessionPath','queryResult','allRequiredParamsPresent','diagnosticInfo','fields','intent','isFallback','queryText','intentDetectionConfidence','fulfillmentText','Tilde\x20ASR\x20confidence','awsPolly','awsLex','lex','format','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','ispeechASR','freeform=3','sestekNDA','nda','channelData','CustomActionData','audiofile','dirName','apiai-promise','dialogflow','http','https','md5','path','request-promise','randomstring','sox','google-tts-api','url','parse','util','./aws','./google','./sestek','./tilde','agi','https://api.ispeech.org/api/rest','protocol','host','WHAT_EVER','get','statusCode','error','request\x20to\x20','\x20failed,\x20status\x20code\x20=\x20','statusMessage','createWriteStream','unlink','download\x20error','pipe','https:','data','end','transcode','wav','error\x20convert','info','finish\x20to\x20convert','resolve','tmp','generate','.wav','writeFileSync','base64','chmodSync','split','readFileSync','toString','googleCloudTTS','https://texttospeech.googleapis.com/v1/','?key=','ssml','input','MP3','POST','then','.mp3','from','audioContent','writeFile','777','googleCloudTTS\x20path','googleTTS','https://translate.google.com/_/TranslateWebserverUi/data/batchexecute','utf8','application/x-www-form-urlencoded','stringify','jQ1olc'];(function(_0x3a7bdf,_0x58bdd8){var _0x35a9a8=function(_0x21da98){while(--_0x21da98){_0x3a7bdf['push'](_0x3a7bdf['shift']());}};_0x35a9a8(++_0x58bdd8);}(_0x1b04,0x1ae));var _0x41b0=function(_0x32897b,_0x21bee8){_0x32897b=_0x32897b-0x0;var _0x4394ce=_0x1b04[_0x32897b];return _0x4394ce;};'use strict';var apiai=require(_0x41b0('0x0'));var BPromise=require('bluebird');var dialogflow=require(_0x41b0('0x1'));var fs=require('fs');var http=require(_0x41b0('0x2'));var https=require(_0x41b0('0x3'));var md5=require(_0x41b0('0x4'));var path=require(_0x41b0('0x5'));var querystring=require('querystring');var rp=require(_0x41b0('0x6'));var rs=require(_0x41b0('0x7'));var sox=require(_0x41b0('0x8'));var tts=require(_0x41b0('0x9'));var urlParse=require(_0x41b0('0xa'))[_0x41b0('0xb')];var util=require(_0x41b0('0xc'));var aws=require(_0x41b0('0xd'));var google=require(_0x41b0('0xe'));var sestek=require(_0x41b0('0xf'));var tilde=require(_0x41b0('0x10'));var logger=require('../../../config/logger')(_0x41b0('0x11'));var ISPEECH_API=_0x41b0('0x12');function downloadFile(_0x59b85d,_0x136f50){return new BPromise(function(_0x4162af,_0x4f428d){var _0x33dda7=urlParse(_0x59b85d);var _0x2e1d84=_0x33dda7[_0x41b0('0x13')]==='https:'?https:http;var _0xc444a8={'host':_0x33dda7[_0x41b0('0x14')],'path':_0x33dda7[_0x41b0('0x5')],'headers':{'user-agent':_0x41b0('0x15')}};_0x2e1d84[_0x41b0('0x16')](_0xc444a8,function(_0x1fbb04){if(_0x1fbb04[_0x41b0('0x17')]!==0xc8){logger[_0x41b0('0x18')](_0x41b0('0x19')+_0x59b85d+_0x41b0('0x1a')+_0x1fbb04[_0x41b0('0x17')]+'\x20('+_0x1fbb04[_0x41b0('0x1b')]+')');_0x4f428d(new Error(_0x41b0('0x19')+_0x59b85d+'\x20failed,\x20status\x20code\x20=\x20'+_0x1fbb04[_0x41b0('0x17')]+'\x20('+_0x1fbb04['statusMessage']+')'));return;}var _0x585f93=fs[_0x41b0('0x1c')](_0x136f50);_0x585f93['on']('finish',function(){logger['info']('finish\x20download\x20file');_0x585f93['close'](_0x4162af);});_0x585f93['on'](_0x41b0('0x18'),function(_0x3b7797){fs[_0x41b0('0x1d')](_0x136f50);logger['error'](_0x41b0('0x1e'),_0x3b7797);_0x4f428d(_0x3b7797);});_0x1fbb04[_0x41b0('0x1f')](_0x585f93);})['on'](_0x41b0('0x18'),function(_0x1b1973){logger['error'](_0x1b1973);_0x4f428d(_0x1b1973);})['end']();});}function uploadFile(_0x6fd99){return new BPromise(function(_0x34e713,_0x5ea6b7){var _0xa11214=urlParse(_0x6fd99);var _0x476bf2=_0xa11214[_0x41b0('0x13')]===_0x41b0('0x20')?https:http;var _0x4269cc={'host':_0xa11214['host'],'path':_0xa11214[_0x41b0('0x5')],'headers':{'user-agent':_0x41b0('0x15')}};_0x476bf2[_0x41b0('0x16')](_0x4269cc,function(_0x305671){if(_0x305671[_0x41b0('0x17')]!==0xc8){_0x5ea6b7(new Error(_0x41b0('0x19')+_0x6fd99+'\x20failed,\x20status\x20code\x20=\x20'+_0x305671['statusCode']+'\x20('+_0x305671[_0x41b0('0x1b')]+')'));return;}var _0x854b38='';_0x305671['on'](_0x41b0('0x21'),function(_0x4446cb){_0x854b38+=_0x4446cb;});_0x305671['on'](_0x41b0('0x22'),function(){_0x34e713(_0x854b38);});})['on']('error',function(_0x18f333){_0x5ea6b7(_0x18f333);})['end']();});}function convertFile(_0x383b18,_0x1a7d68){return new BPromise(function(_0x19d1e4,_0x1f9276){var _0x2d6edb=sox[_0x41b0('0x23')](_0x383b18,_0x1a7d68,{'sampleRate':0x1f40,'format':_0x41b0('0x24'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x2d6edb['on'](_0x41b0('0x18'),function(_0x411267){logger[_0x41b0('0x18')](_0x41b0('0x25'),_0x411267);_0x1f9276(_0x411267);});_0x2d6edb['on'](_0x41b0('0x22'),function(){logger[_0x41b0('0x26')](_0x41b0('0x27'));_0x19d1e4();});_0x2d6edb['start']();});}function base64Decode(_0x2b7c87,_0x203227){var _0x1b1677=path[_0x41b0('0x28')](__dirname,_0x41b0('0x29'),rs[_0x41b0('0x2a')](0x4)+_0x41b0('0x2b'));fs[_0x41b0('0x2c')](_0x1b1677,_0x2b7c87,_0x41b0('0x2d'));return convertFile(_0x1b1677,_0x203227)['then'](function(){try{fs[_0x41b0('0x1d')](_0x1b1677);fs[_0x41b0('0x2e')](_0x203227,'777');}catch(_0x774187){logger['error'](_0x774187);}return _0x203227[_0x41b0('0x2f')]('.')[0x0];});}function base64Encode(_0x2dfc04){var _0x3b0c1f=fs[_0x41b0('0x30')](_0x2dfc04);return new Buffer(_0x3b0c1f)[_0x41b0('0x31')](_0x41b0('0x2d'));}exports[_0x41b0('0x32')]=function(_0x1862bd,_0x416cae,_0x3949cb,_0x41d5ac,_0x5d15c2,_0x92b802){var _0xf6fad5,_0x4374a;var _0x4e601c=_0x41b0('0x33');var _0x21f289=_0x41b0('0x34')+_0x1862bd;var _0x195acd={};if(_0x416cae===_0x41b0('0x35')){_0x195acd['input']={'ssml':_0x3949cb};}else{_0x195acd[_0x41b0('0x36')]={'text':_0x3949cb};};_0x195acd['voice']={'languageCode':_0x41d5ac,'ssmlGender':_0x5d15c2};_0x195acd['audioConfig']={'audioEncoding':_0x41b0('0x37'),'sampleRateHertz':0x1f40};var _0x54a3c4={'url':_0x4e601c+'text:synthesize'+_0x21f289,'method':_0x41b0('0x38'),'json':!![],'body':_0x195acd};return rp(_0x54a3c4)[_0x41b0('0x39')](function(_0x2366b5){return new BPromise(function(_0x150766,_0x3f602f){_0xf6fad5=path['resolve'](__dirname,'tmp',rs[_0x41b0('0x2a')](0x4)+_0x41b0('0x3a'));var _0x42e9d7=Buffer[_0x41b0('0x3b')](_0x2366b5[_0x41b0('0x3c')],'base64');return fs[_0x41b0('0x3d')](_0xf6fad5,_0x42e9d7,function(_0x377b39){_0x3f602f(_0x377b39);},function(_0x4439f6){fs[_0x41b0('0x2e')](_0xf6fad5,'777');_0x150766(_0x4439f6);});});})['then'](function(_0x30f4c1){_0x4374a=path[_0x41b0('0x28')](__dirname,'tmp',rs[_0x41b0('0x2a')](0x4)+_0x41b0('0x2b'));return convertFile(_0xf6fad5,_0x4374a);})[_0x41b0('0x39')](function(){try{fs['unlink'](_0xf6fad5);fs[_0x41b0('0x2e')](_0x4374a,_0x41b0('0x3e'));}catch(_0x104299){logger[_0x41b0('0x18')](_0x104299);}logger[_0x41b0('0x26')](_0x41b0('0x3f'),_0x4374a['split']('.')[0x0]);return _0x4374a[_0x41b0('0x2f')]('.')[0x0];});};exports[_0x41b0('0x40')]=function(_0x31f957,_0x466c00){var _0x459a14=_0x41b0('0x41');var _0x156050,_0xeb0e26;var _0x187458;var _0x8e2f13={'encoding':_0x41b0('0x42'),'method':'POST','timeout':0x2710,'url':_0x459a14,'headers':{'Content-Type':_0x41b0('0x43')},'body':'f.req='+encodeURIComponent(JSON[_0x41b0('0x44')]([[[_0x41b0('0x45'),JSON[_0x41b0('0x44')]([_0x31f957,_0x466c00||'en',![],_0x41b0('0x46')]),null,'generic']]]))};return rp(_0x8e2f13)[_0x41b0('0x39')](function(_0x7c4a5){try{_0x187458=eval(_0x7c4a5['slice'](0x5))[0x0][0x2];}catch(_0x99edbb){throw new Error(_0x41b0('0x47')+_0x7c4a5[_0x41b0('0x21')]);}if(!_0x187458){if(_0x31f957[_0x41b0('0x48')]>0xc8){throw new Error('text\x20length\x20limit\x20reached');}else{throw new Error(_0x41b0('0x49')+_0x466c00+'\x22\x20might\x20not\x20exist');}}try{_0x187458=eval(_0x187458)[0x0];}catch(_0x4e6386){throw new Error('parse\x20response\x20failed:\x0a'+res['data']);}const _0x1dc3c4=_0x187458;_0x156050=path[_0x41b0('0x28')](__dirname,'tmp',rs[_0x41b0('0x2a')](0x4)+'.mp3');fs['writeFileSync'](_0x156050,_0x187458,{'encoding':_0x41b0('0x2d')});_0xeb0e26=path[_0x41b0('0x28')](__dirname,_0x41b0('0x29'),rs[_0x41b0('0x2a')](0x4)+_0x41b0('0x2b'));return convertFile(_0x156050,_0xeb0e26);})[_0x41b0('0x39')](function(){try{fs[_0x41b0('0x1d')](_0x156050);fs['chmodSync'](_0xeb0e26,_0x41b0('0x3e'));}catch(_0x2ca423){logger[_0x41b0('0x18')](_0x2ca423);}logger[_0x41b0('0x26')](_0x41b0('0x4a'),_0xeb0e26[_0x41b0('0x2f')]('.')[0x0]);return _0xeb0e26[_0x41b0('0x2f')]('.')[0x0];});};exports[_0x41b0('0x4b')]=function(_0x1ecf73,_0x6e4643,_0x388cd3){return google[_0x41b0('0x4c')](_0x1ecf73,_0x6e4643,_0x388cd3)[_0x41b0('0x39')](function(_0x2a16fe){logger['info'](_0x2a16fe['uri']);return rp(_0x2a16fe);})[_0x41b0('0x39')](function(_0x3f884a){var _0x17680a='';var _0x28a063=0x0;try{fs[_0x41b0('0x1d')](_0x1ecf73);}catch(_0x590e23){logger[_0x41b0('0x18')](_0x590e23);}if(_0x3f884a&&_0x3f884a[_0x41b0('0x4d')]){_0x17680a=_0x3f884a[_0x41b0('0x4d')]['map'](function(_0x315cf6){return _0x315cf6&&_0x315cf6['alternatives'][0x0]&&_0x315cf6[_0x41b0('0x4e')][0x0][_0x41b0('0x4f')]?_0x315cf6[_0x41b0('0x4e')][0x0][_0x41b0('0x4f')]:'';})[_0x41b0('0x50')]('\x0a');_0x28a063=_0x3f884a['results'][_0x41b0('0x51')](function(_0x310948){return _0x310948&&_0x310948['alternatives'][0x0]&&_0x310948['alternatives'][0x0]['confidence']?_0x310948['alternatives'][0x0][_0x41b0('0x52')]:0x0;})['join']('\x0a');}logger[_0x41b0('0x26')](_0x41b0('0x53'),_0x17680a);logger['info'](_0x41b0('0x54'),_0x28a063);return{'transcript':_0x17680a,'confidence':_0x28a063};})[_0x41b0('0x55')](function(_0x1dbacb){logger[_0x41b0('0x18')](_0x41b0('0x56'),_0x1dbacb[_0x41b0('0x17')],_0x1dbacb['name'],_0x1dbacb['message']);});};exports['googleDialogflow']=function(_0x199970,_0x417eb2,_0x2e6423,_0xe7a094){var _0x299781=apiai(_0x417eb2,{'language':_0xe7a094||'en'});return _0x299781[_0x41b0('0x57')](_0x2e6423,{'sessionId':md5(_0x199970)})[_0x41b0('0x39')](function(_0x4be98d){logger[_0x41b0('0x26')](JSON['stringify'](_0x4be98d));return{'source':_0x4be98d[_0x41b0('0x58')]['source'],'resolvedQuery':_0x4be98d['result'][_0x41b0('0x59')],'action':_0x4be98d[_0x41b0('0x58')][_0x41b0('0x5a')],'actionIncomplete':_0x4be98d['result'][_0x41b0('0x5b')],'speech':_0x4be98d['result'][_0x41b0('0x5c')][_0x41b0('0x5d')],'score':_0x4be98d[_0x41b0('0x58')][_0x41b0('0x5e')],'statusCode':_0x4be98d[_0x41b0('0x5f')]['code'],'endConversation':_0x4be98d[_0x41b0('0x58')][_0x41b0('0x60')][_0x41b0('0x61')]||![],'isFallbackIntent':_0x4be98d[_0x41b0('0x58')][_0x41b0('0x60')]['isFallbackIntent']};});};exports[_0x41b0('0x62')]=function(_0x589c8e,_0x1661a6,_0x4c36a6,_0x4be7c4,_0x54dd09,_0x1f8ea8){var _0xdee921=_0x4be7c4[_0x41b0('0x63')](/\\n/g,'\x0a');var _0x13f546={'credentials':{'private_key':_0xdee921,'client_email':_0x4c36a6}};var _0x4f8841=new dialogflow[(_0x41b0('0x64'))](_0x13f546);var _0xab6bdf=_0x4f8841[_0x41b0('0x65')](_0x1661a6,md5(_0x589c8e));var _0x444e46={'session':_0xab6bdf,'queryInput':{'text':{'text':_0x54dd09,'languageCode':_0x1f8ea8}}};return _0x4f8841['detectIntent'](_0x444e46)[_0x41b0('0x39')](function(_0x596744){if(_0x596744&&_0x596744[_0x41b0('0x48')]){logger['info']('Dialogflow\x20V2\x20response:',JSON[_0x41b0('0x44')](_0x596744));var _0x59755f=_0x596744[0x0];if(_0x59755f){var _0x5d14e0={'action':_0x59755f[_0x41b0('0x66')]['action'],'allRequiredParamsPresent':_0x59755f[_0x41b0('0x66')][_0x41b0('0x67')],'endConversation':_0x59755f[_0x41b0('0x66')][_0x41b0('0x68')]&&_0x59755f['queryResult'][_0x41b0('0x68')]['fields']?_0x59755f[_0x41b0('0x66')][_0x41b0('0x68')][_0x41b0('0x69')]['end_conversation']['boolValue']:![],'fulfillmentText':_0x59755f[_0x41b0('0x66')]['fulfillmentText'],'intentName':_0x59755f[_0x41b0('0x66')][_0x41b0('0x6a')]['name'],'intentDisplayName':_0x59755f['queryResult']['intent']['displayName'],'isFallbackIntent':_0x59755f[_0x41b0('0x66')]['intent'][_0x41b0('0x6b')],'languageCode':_0x59755f['queryResult']['languageCode'],'queryText':_0x59755f[_0x41b0('0x66')][_0x41b0('0x6c')],'responseId':_0x59755f['responseId'],'score':_0x59755f['queryResult'][_0x41b0('0x6d')],'speech':_0x59755f['queryResult'][_0x41b0('0x6e')],'providerResponse':JSON[_0x41b0('0x44')](_0x596744)};return _0x5d14e0;}}});};exports['tildeASR']=function(_0x2294dc,_0x35cfc7,_0x5f5882,_0x122be5){return tilde[_0x41b0('0x4c')](_0x2294dc,_0x35cfc7,_0x5f5882,_0x122be5)[_0x41b0('0x39')](function(_0x31f11d){try{fs[_0x41b0('0x1d')](_0x2294dc);}catch(_0x494c1c){logger['error'](_0x494c1c);}logger[_0x41b0('0x26')]('Tilde\x20ASR\x20transcription',_0x31f11d[_0x41b0('0x4f')]);logger[_0x41b0('0x26')](_0x41b0('0x6f'),_0x31f11d[_0x41b0('0x52')]);return _0x31f11d;});};exports[_0x41b0('0x70')]=function(_0x53d5b1,_0x2d75d5,_0x392665,_0x520032,_0x1b3dd7,_0x5411ce){var _0x10d955=path[_0x41b0('0x28')](__dirname,_0x41b0('0x29'),rs[_0x41b0('0x2a')](0x4)+_0x41b0('0x3a'));var _0x38e514;return aws['polly'](_0x53d5b1,_0x2d75d5,_0x392665,_0x520032,_0x1b3dd7,_0x5411ce,_0x10d955)[_0x41b0('0x39')](function(){_0x38e514=path[_0x41b0('0x28')](__dirname,'tmp',rs['generate'](0x4)+_0x41b0('0x2b'));return convertFile(_0x10d955,_0x38e514);})['then'](function(){try{fs[_0x41b0('0x1d')](_0x10d955);fs[_0x41b0('0x2e')](_0x38e514,_0x41b0('0x3e'));}catch(_0x3b0240){logger[_0x41b0('0x18')](_0x3b0240);}return _0x38e514[_0x41b0('0x2f')]('.')[0x0];});};exports[_0x41b0('0x71')]=function(_0x13e10a,_0x2ffe09,_0x3fe8c6,_0x50b34d,_0x51a783,_0x383adf){return aws[_0x41b0('0x72')](_0x13e10a,_0x2ffe09,_0x3fe8c6,_0x50b34d,_0x51a783,_0x383adf)[_0x41b0('0x39')](function(_0x3c4f7f){logger[_0x41b0('0x26')](JSON[_0x41b0('0x44')](_0x3c4f7f));return _0x3c4f7f;});};exports['ispeechTTS']=function(_0x5d357f,_0x3cfe6d,_0x4ba685,_0x48e964){var _0x1b7b49=util[_0x41b0('0x73')](_0x41b0('0x74'),ISPEECH_API,_0x5d357f,encodeURIComponent(_0x3cfe6d),_0x4ba685,_0x48e964);var _0x1917d6=path[_0x41b0('0x28')](__dirname,_0x41b0('0x29'),rs[_0x41b0('0x2a')](0x4)+_0x41b0('0x3a'));var _0x3d0061;return downloadFile(_0x1b7b49,_0x1917d6)[_0x41b0('0x39')](function(){_0x3d0061=path[_0x41b0('0x28')](__dirname,'tmp',rs[_0x41b0('0x2a')](0x4)+'.wav');return convertFile(_0x1917d6,_0x3d0061);})[_0x41b0('0x39')](function(){try{fs['unlink'](_0x1917d6);fs['chmodSync'](_0x3d0061,_0x41b0('0x3e'));}catch(_0x5072a3){logger[_0x41b0('0x18')](_0x5072a3);}return _0x3d0061['split']('.')[0x0];});};exports[_0x41b0('0x75')]=function(_0x2dbf95,_0x4a78c4,_0x56ad5d,_0x5ca1fa){var _0x1083bb=util[_0x41b0('0x73')]('%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s',ISPEECH_API,_0x4a78c4,_0x56ad5d,base64Encode(_0x2dbf95),_0x5ca1fa?util['format']('model=%s',encodeURIComponent(_0x5ca1fa)):_0x41b0('0x76'));return uploadFile(_0x1083bb)['then'](function(_0xef23c0){return querystring['parse'](_0xef23c0);});};exports[_0x41b0('0x77')]=function(_0x7b47ef,_0x219853){return sestek[_0x41b0('0x78')](_0x7b47ef,_0x219853)[_0x41b0('0x39')](function(_0x276d2f){logger['info'](JSON[_0x41b0('0x44')](_0x276d2f));var _0x12da91={'speech':_0x276d2f['text'],'action':_0x276d2f[_0x41b0('0x79')]?_0x276d2f[_0x41b0('0x79')]['CustomAction']:undefined,'actiondata':_0x276d2f[_0x41b0('0x79')]?_0x276d2f[_0x41b0('0x79')][_0x41b0('0x7a')]:undefined};if(_0x276d2f[_0x41b0('0x79')]&&_0x276d2f[_0x41b0('0x79')]['AudioFromTts']){return base64Decode(_0x276d2f[_0x41b0('0x79')]['AudioFromTts']['Data'],path[_0x41b0('0x28')](__dirname,'tmp',rs['generate'](0x4)+_0x41b0('0x2b')))[_0x41b0('0x39')](function(_0x762be7){_0x12da91[_0x41b0('0x7b')]=_0x762be7;return _0x12da91;});}return _0x12da91;});};exports[_0x41b0('0x7c')]=function(){return __dirname;}; \ No newline at end of file +var _0x4679=['transcript','Tilde\x20ASR\x20confidence','polly','awsLex','lex','ispeechTTS','format','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','https','path','querystring','request-promise','sox','google-tts-api','url','./aws','./google','./tilde','../../../config/logger','https://api.ispeech.org/api/rest','https:','host','WHAT_EVER','get','statusCode','request\x20to\x20','\x20failed,\x20status\x20code\x20=\x20','statusMessage','createWriteStream','finish','info','finish\x20download\x20file','close','error','download\x20error','pipe','end','data','wav','error\x20convert','finish\x20to\x20convert','start','resolve','tmp','writeFileSync','base64','chmodSync','googleCloudTTS','https://texttospeech.googleapis.com/v1/','ssml','input','MP3','POST','generate','.mp3','from','audioContent','writeFile','777','then','.wav','unlink','split','googleTTS','https://translate.google.com/_/TranslateWebserverUi/data/batchexecute','utf8','application/x-www-form-urlencoded','f.req=','stringify','jQ1olc','null','slice','parse\x20response\x20failed:\x0a','length','text\x20length\x20limit\x20reached','\x22\x20might\x20not\x20exist','goggleTTS\x20path','googleASR','asr','uri','results','map','alternatives','join','confidence','googleASR\x20transcription','googleASR\x20confidence','catch','[%s]\x20%s:%s','name','googleDialogflow','textRequest','result','source','resolvedQuery','actionIncomplete','fulfillment','speech','score','metadata','googleDialogflowV2','replace','sessionPath','detectIntent','queryResult','action','allRequiredParamsPresent','diagnosticInfo','fields','end_conversation','boolValue','fulfillmentText','intent','displayName','isFallback','languageCode','responseId','intentDetectionConfidence','Tilde\x20ASR\x20transcription'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x4679,0x9b));var _0x9467=function(_0x5d0dfe,_0x1db853){_0x5d0dfe=_0x5d0dfe-0x0;var _0x259f73=_0x4679[_0x5d0dfe];return _0x259f73;};'use strict';var apiai=require(_0x9467('0x0'));var BPromise=require(_0x9467('0x1'));var dialogflow=require('dialogflow');var fs=require('fs');var http=require('http');var https=require(_0x9467('0x2'));var md5=require('md5');var path=require(_0x9467('0x3'));var querystring=require(_0x9467('0x4'));var rp=require(_0x9467('0x5'));var rs=require('randomstring');var sox=require(_0x9467('0x6'));var tts=require(_0x9467('0x7'));var urlParse=require(_0x9467('0x8'))['parse'];var util=require('util');var aws=require(_0x9467('0x9'));var google=require(_0x9467('0xa'));var sestek=require('./sestek');var tilde=require(_0x9467('0xb'));var logger=require(_0x9467('0xc'))('agi');var ISPEECH_API=_0x9467('0xd');function downloadFile(_0x1f8895,_0x4eecd2){return new BPromise(function(_0x22e8ba,_0x12f2e1){var _0x3c1400=urlParse(_0x1f8895);var _0x21ac69=_0x3c1400['protocol']===_0x9467('0xe')?https:http;var _0x4e429e={'host':_0x3c1400[_0x9467('0xf')],'path':_0x3c1400[_0x9467('0x3')],'headers':{'user-agent':_0x9467('0x10')}};_0x21ac69[_0x9467('0x11')](_0x4e429e,function(_0x4b9c53){if(_0x4b9c53[_0x9467('0x12')]!==0xc8){logger['error'](_0x9467('0x13')+_0x1f8895+_0x9467('0x14')+_0x4b9c53[_0x9467('0x12')]+'\x20('+_0x4b9c53[_0x9467('0x15')]+')');_0x12f2e1(new Error('request\x20to\x20'+_0x1f8895+'\x20failed,\x20status\x20code\x20=\x20'+_0x4b9c53[_0x9467('0x12')]+'\x20('+_0x4b9c53[_0x9467('0x15')]+')'));return;}var _0x38c390=fs[_0x9467('0x16')](_0x4eecd2);_0x38c390['on'](_0x9467('0x17'),function(){logger[_0x9467('0x18')](_0x9467('0x19'));_0x38c390[_0x9467('0x1a')](_0x22e8ba);});_0x38c390['on'](_0x9467('0x1b'),function(_0x123344){fs['unlink'](_0x4eecd2);logger['error'](_0x9467('0x1c'),_0x123344);_0x12f2e1(_0x123344);});_0x4b9c53[_0x9467('0x1d')](_0x38c390);})['on'](_0x9467('0x1b'),function(_0x51d3a0){logger[_0x9467('0x1b')](_0x51d3a0);_0x12f2e1(_0x51d3a0);})[_0x9467('0x1e')]();});}function uploadFile(_0x56d6f0){return new BPromise(function(_0x5b2351,_0x587c61){var _0xa201ae=urlParse(_0x56d6f0);var _0x527a6f=_0xa201ae['protocol']==='https:'?https:http;var _0x2e6e43={'host':_0xa201ae[_0x9467('0xf')],'path':_0xa201ae[_0x9467('0x3')],'headers':{'user-agent':_0x9467('0x10')}};_0x527a6f['get'](_0x2e6e43,function(_0x4d58a9){if(_0x4d58a9[_0x9467('0x12')]!==0xc8){_0x587c61(new Error(_0x9467('0x13')+_0x56d6f0+_0x9467('0x14')+_0x4d58a9['statusCode']+'\x20('+_0x4d58a9[_0x9467('0x15')]+')'));return;}var _0x191fc7='';_0x4d58a9['on'](_0x9467('0x1f'),function(_0x4c59d5){_0x191fc7+=_0x4c59d5;});_0x4d58a9['on']('end',function(){_0x5b2351(_0x191fc7);});})['on'](_0x9467('0x1b'),function(_0x5bd0b8){_0x587c61(_0x5bd0b8);})[_0x9467('0x1e')]();});}function convertFile(_0x3c3af7,_0x47cb15){return new BPromise(function(_0x107787,_0x4ebc80){var _0x5bbb40=sox['transcode'](_0x3c3af7,_0x47cb15,{'sampleRate':0x1f40,'format':_0x9467('0x20'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x5bbb40['on']('error',function(_0x26692e){logger[_0x9467('0x1b')](_0x9467('0x21'),_0x26692e);_0x4ebc80(_0x26692e);});_0x5bbb40['on'](_0x9467('0x1e'),function(){logger[_0x9467('0x18')](_0x9467('0x22'));_0x107787();});_0x5bbb40[_0x9467('0x23')]();});}function base64Decode(_0x2896bc,_0x6b1d13){var _0x70f421=path[_0x9467('0x24')](__dirname,_0x9467('0x25'),rs['generate'](0x4)+'.wav');fs[_0x9467('0x26')](_0x70f421,_0x2896bc,_0x9467('0x27'));return convertFile(_0x70f421,_0x6b1d13)['then'](function(){try{fs['unlink'](_0x70f421);fs[_0x9467('0x28')](_0x6b1d13,'777');}catch(_0x5f4e97){logger[_0x9467('0x1b')](_0x5f4e97);}return _0x6b1d13['split']('.')[0x0];});}function base64Encode(_0x2bd283){var _0x5e0aa5=fs['readFileSync'](_0x2bd283);return new Buffer(_0x5e0aa5)['toString'](_0x9467('0x27'));}exports[_0x9467('0x29')]=function(_0x2da82f,_0x3b35f4,_0xf16ab9,_0x52fc5a,_0x1c00fc,_0x126b22){var _0x1493d4,_0xfce911;var _0x53b2d7=_0x9467('0x2a');var _0x4ef44a='?key='+_0x2da82f;var _0x46e21a={};if(_0x3b35f4===_0x9467('0x2b')){_0x46e21a[_0x9467('0x2c')]={'ssml':_0xf16ab9};}else{_0x46e21a[_0x9467('0x2c')]={'text':_0xf16ab9};};_0x46e21a['voice']={'languageCode':_0x52fc5a,'ssmlGender':_0x1c00fc};_0x46e21a['audioConfig']={'audioEncoding':_0x9467('0x2d'),'sampleRateHertz':0x1f40};var _0x1a125a={'url':_0x53b2d7+'text:synthesize'+_0x4ef44a,'method':_0x9467('0x2e'),'json':!![],'body':_0x46e21a};return rp(_0x1a125a)['then'](function(_0x43b8a7){return new BPromise(function(_0x4f792a,_0x59271f){_0x1493d4=path['resolve'](__dirname,_0x9467('0x25'),rs[_0x9467('0x2f')](0x4)+_0x9467('0x30'));var _0x5a61c8=Buffer[_0x9467('0x31')](_0x43b8a7[_0x9467('0x32')],_0x9467('0x27'));return fs[_0x9467('0x33')](_0x1493d4,_0x5a61c8,function(_0x1cbabf){_0x59271f(_0x1cbabf);},function(_0x25fe44){fs[_0x9467('0x28')](_0x1493d4,_0x9467('0x34'));_0x4f792a(_0x25fe44);});});})[_0x9467('0x35')](function(_0x7f1f73){_0xfce911=path['resolve'](__dirname,'tmp',rs['generate'](0x4)+_0x9467('0x36'));return convertFile(_0x1493d4,_0xfce911);})[_0x9467('0x35')](function(){try{fs[_0x9467('0x37')](_0x1493d4);fs[_0x9467('0x28')](_0xfce911,'777');}catch(_0x2f7be9){logger['error'](_0x2f7be9);}logger[_0x9467('0x18')]('googleCloudTTS\x20path',_0xfce911[_0x9467('0x38')]('.')[0x0]);return _0xfce911[_0x9467('0x38')]('.')[0x0];});};exports[_0x9467('0x39')]=function(_0x3ef637,_0x2ccc67){var _0xe5d40e=_0x9467('0x3a');var _0x41857c,_0x51bfa4;var _0x3dd2ae;var _0xeb45b7={'encoding':_0x9467('0x3b'),'method':_0x9467('0x2e'),'timeout':0x2710,'url':_0xe5d40e,'headers':{'Content-Type':_0x9467('0x3c')},'body':_0x9467('0x3d')+encodeURIComponent(JSON[_0x9467('0x3e')]([[[_0x9467('0x3f'),JSON[_0x9467('0x3e')]([_0x3ef637,_0x2ccc67||'en',![],_0x9467('0x40')]),null,'generic']]]))};return rp(_0xeb45b7)[_0x9467('0x35')](function(_0x952b71){try{_0x3dd2ae=eval(_0x952b71[_0x9467('0x41')](0x5))[0x0][0x2];}catch(_0x4c897f){throw new Error(_0x9467('0x42')+_0x952b71[_0x9467('0x1f')]);}if(!_0x3dd2ae){if(_0x3ef637[_0x9467('0x43')]>0xc8){throw new Error(_0x9467('0x44'));}else{throw new Error('lang\x20\x22'+_0x2ccc67+_0x9467('0x45'));}}try{_0x3dd2ae=eval(_0x3dd2ae)[0x0];}catch(_0x3da549){throw new Error(_0x9467('0x42')+res[_0x9467('0x1f')]);}const _0x3d1cac=_0x3dd2ae;_0x41857c=path[_0x9467('0x24')](__dirname,'tmp',rs[_0x9467('0x2f')](0x4)+'.mp3');fs[_0x9467('0x26')](_0x41857c,_0x3dd2ae,{'encoding':_0x9467('0x27')});_0x51bfa4=path[_0x9467('0x24')](__dirname,_0x9467('0x25'),rs[_0x9467('0x2f')](0x4)+_0x9467('0x36'));return convertFile(_0x41857c,_0x51bfa4);})['then'](function(){try{fs[_0x9467('0x37')](_0x41857c);fs[_0x9467('0x28')](_0x51bfa4,_0x9467('0x34'));}catch(_0x42c962){logger[_0x9467('0x1b')](_0x42c962);}logger[_0x9467('0x18')](_0x9467('0x46'),_0x51bfa4['split']('.')[0x0]);return _0x51bfa4[_0x9467('0x38')]('.')[0x0];});};exports[_0x9467('0x47')]=function(_0x254102,_0x3452e6,_0x301add){return google[_0x9467('0x48')](_0x254102,_0x3452e6,_0x301add)[_0x9467('0x35')](function(_0x414aaa){logger[_0x9467('0x18')](_0x414aaa[_0x9467('0x49')]);return rp(_0x414aaa);})['then'](function(_0x5ba9c2){var _0x40599f='';var _0x68f30f=0x0;try{fs[_0x9467('0x37')](_0x254102);}catch(_0x9d1e13){logger['error'](_0x9d1e13);}if(_0x5ba9c2&&_0x5ba9c2[_0x9467('0x4a')]){_0x40599f=_0x5ba9c2[_0x9467('0x4a')][_0x9467('0x4b')](function(_0x11103b){return _0x11103b&&_0x11103b[_0x9467('0x4c')][0x0]&&_0x11103b[_0x9467('0x4c')][0x0]['transcript']?_0x11103b[_0x9467('0x4c')][0x0]['transcript']:'';})[_0x9467('0x4d')]('\x0a');_0x68f30f=_0x5ba9c2[_0x9467('0x4a')][_0x9467('0x4b')](function(_0x353b39){return _0x353b39&&_0x353b39[_0x9467('0x4c')][0x0]&&_0x353b39['alternatives'][0x0][_0x9467('0x4e')]?_0x353b39[_0x9467('0x4c')][0x0][_0x9467('0x4e')]:0x0;})[_0x9467('0x4d')]('\x0a');}logger[_0x9467('0x18')](_0x9467('0x4f'),_0x40599f);logger['info'](_0x9467('0x50'),_0x68f30f);return{'transcript':_0x40599f,'confidence':_0x68f30f};})[_0x9467('0x51')](function(_0x48dead){logger[_0x9467('0x1b')](_0x9467('0x52'),_0x48dead[_0x9467('0x12')],_0x48dead[_0x9467('0x53')],_0x48dead['message']);});};exports[_0x9467('0x54')]=function(_0x1f3bbc,_0x372a35,_0x1011a7,_0xc3f1ac){var _0x5da1a3=apiai(_0x372a35,{'language':_0xc3f1ac||'en'});return _0x5da1a3[_0x9467('0x55')](_0x1011a7,{'sessionId':md5(_0x1f3bbc)})['then'](function(_0x3cacff){logger[_0x9467('0x18')](JSON[_0x9467('0x3e')](_0x3cacff));return{'source':_0x3cacff[_0x9467('0x56')][_0x9467('0x57')],'resolvedQuery':_0x3cacff[_0x9467('0x56')][_0x9467('0x58')],'action':_0x3cacff[_0x9467('0x56')]['action'],'actionIncomplete':_0x3cacff[_0x9467('0x56')][_0x9467('0x59')],'speech':_0x3cacff[_0x9467('0x56')][_0x9467('0x5a')][_0x9467('0x5b')],'score':_0x3cacff[_0x9467('0x56')][_0x9467('0x5c')],'statusCode':_0x3cacff['status']['code'],'endConversation':_0x3cacff[_0x9467('0x56')][_0x9467('0x5d')]['endConversation']||![],'isFallbackIntent':_0x3cacff[_0x9467('0x56')][_0x9467('0x5d')]['isFallbackIntent']};});};exports[_0x9467('0x5e')]=function(_0x47223c,_0x3f25e1,_0x2f5568,_0x63cdf6,_0x4c7317,_0x51a03d){var _0x51ea0e=_0x63cdf6[_0x9467('0x5f')](/\\n/g,'\x0a');var _0x2a153b={'credentials':{'private_key':_0x51ea0e,'client_email':_0x2f5568}};var _0x34010d=new dialogflow['SessionsClient'](_0x2a153b);var _0x1c1035=_0x34010d[_0x9467('0x60')](_0x3f25e1,md5(_0x47223c));var _0x5a5690={'session':_0x1c1035,'queryInput':{'text':{'text':_0x4c7317,'languageCode':_0x51a03d}}};return _0x34010d[_0x9467('0x61')](_0x5a5690)[_0x9467('0x35')](function(_0x41cbd4){if(_0x41cbd4&&_0x41cbd4[_0x9467('0x43')]){logger['info']('Dialogflow\x20V2\x20response:',JSON[_0x9467('0x3e')](_0x41cbd4));var _0x4c1f33=_0x41cbd4[0x0];if(_0x4c1f33){var _0x3d7459={'action':_0x4c1f33[_0x9467('0x62')][_0x9467('0x63')],'allRequiredParamsPresent':_0x4c1f33[_0x9467('0x62')][_0x9467('0x64')],'endConversation':_0x4c1f33[_0x9467('0x62')][_0x9467('0x65')]&&_0x4c1f33['queryResult']['diagnosticInfo']['fields']?_0x4c1f33[_0x9467('0x62')]['diagnosticInfo'][_0x9467('0x66')][_0x9467('0x67')][_0x9467('0x68')]:![],'fulfillmentText':_0x4c1f33[_0x9467('0x62')][_0x9467('0x69')],'intentName':_0x4c1f33[_0x9467('0x62')][_0x9467('0x6a')][_0x9467('0x53')],'intentDisplayName':_0x4c1f33[_0x9467('0x62')][_0x9467('0x6a')][_0x9467('0x6b')],'isFallbackIntent':_0x4c1f33[_0x9467('0x62')]['intent'][_0x9467('0x6c')],'languageCode':_0x4c1f33[_0x9467('0x62')][_0x9467('0x6d')],'queryText':_0x4c1f33['queryResult']['queryText'],'responseId':_0x4c1f33[_0x9467('0x6e')],'score':_0x4c1f33['queryResult'][_0x9467('0x6f')],'speech':_0x4c1f33[_0x9467('0x62')][_0x9467('0x69')],'providerResponse':JSON[_0x9467('0x3e')](_0x41cbd4)};return _0x3d7459;}}});};exports['tildeASR']=function(_0x449777,_0x2026e4,_0x193257,_0x4de1ef){return tilde[_0x9467('0x48')](_0x449777,_0x2026e4,_0x193257,_0x4de1ef)['then'](function(_0xcf521c){try{fs[_0x9467('0x37')](_0x449777);}catch(_0x1bd148){logger[_0x9467('0x1b')](_0x1bd148);}logger['info'](_0x9467('0x70'),_0xcf521c[_0x9467('0x71')]);logger[_0x9467('0x18')](_0x9467('0x72'),_0xcf521c['confidence']);return _0xcf521c;});};exports['awsPolly']=function(_0x1eebb4,_0x52a45d,_0xf1dfbe,_0x3ce325,_0x5d3131,_0x5d8992){var _0x1d1531=path[_0x9467('0x24')](__dirname,_0x9467('0x25'),rs['generate'](0x4)+'.mp3');var _0x52bfdd;return aws[_0x9467('0x73')](_0x1eebb4,_0x52a45d,_0xf1dfbe,_0x3ce325,_0x5d3131,_0x5d8992,_0x1d1531)[_0x9467('0x35')](function(){_0x52bfdd=path['resolve'](__dirname,_0x9467('0x25'),rs[_0x9467('0x2f')](0x4)+'.wav');return convertFile(_0x1d1531,_0x52bfdd);})[_0x9467('0x35')](function(){try{fs[_0x9467('0x37')](_0x1d1531);fs['chmodSync'](_0x52bfdd,'777');}catch(_0x382711){logger[_0x9467('0x1b')](_0x382711);}return _0x52bfdd['split']('.')[0x0];});};exports[_0x9467('0x74')]=function(_0xa27082,_0x38fe0a,_0x4d5561,_0xb5c9ab,_0x537d6d,_0x823b31){return aws[_0x9467('0x75')](_0xa27082,_0x38fe0a,_0x4d5561,_0xb5c9ab,_0x537d6d,_0x823b31)[_0x9467('0x35')](function(_0x3da870){logger[_0x9467('0x18')](JSON[_0x9467('0x3e')](_0x3da870));return _0x3da870;});};exports[_0x9467('0x76')]=function(_0x18061e,_0x54fe96,_0x44e0a5,_0x32d361){var _0x493bf0=util[_0x9467('0x77')]('%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3',ISPEECH_API,_0x18061e,encodeURIComponent(_0x54fe96),_0x44e0a5,_0x32d361);var _0x265d13=path[_0x9467('0x24')](__dirname,_0x9467('0x25'),rs[_0x9467('0x2f')](0x4)+'.mp3');var _0x3959b1;return downloadFile(_0x493bf0,_0x265d13)[_0x9467('0x35')](function(){_0x3959b1=path['resolve'](__dirname,'tmp',rs[_0x9467('0x2f')](0x4)+_0x9467('0x36'));return convertFile(_0x265d13,_0x3959b1);})['then'](function(){try{fs[_0x9467('0x37')](_0x265d13);fs[_0x9467('0x28')](_0x3959b1,_0x9467('0x34'));}catch(_0x3942cf){logger[_0x9467('0x1b')](_0x3942cf);}return _0x3959b1[_0x9467('0x38')]('.')[0x0];});};exports[_0x9467('0x78')]=function(_0x557599,_0x1f46b1,_0x59fb29,_0x46eed7){var _0xadd841=util['format'](_0x9467('0x79'),ISPEECH_API,_0x1f46b1,_0x59fb29,base64Encode(_0x557599),_0x46eed7?util[_0x9467('0x77')](_0x9467('0x7a'),encodeURIComponent(_0x46eed7)):_0x9467('0x7b'));return uploadFile(_0xadd841)[_0x9467('0x35')](function(_0x3170a9){return querystring[_0x9467('0x7c')](_0x3170a9);});};exports[_0x9467('0x7d')]=function(_0x167b2c,_0x14630f){return sestek[_0x9467('0x7e')](_0x167b2c,_0x14630f)['then'](function(_0x19b1c0){logger[_0x9467('0x18')](JSON['stringify'](_0x19b1c0));var _0x1e6c13={'speech':_0x19b1c0['text'],'action':_0x19b1c0[_0x9467('0x7f')]?_0x19b1c0[_0x9467('0x7f')][_0x9467('0x80')]:undefined,'actiondata':_0x19b1c0[_0x9467('0x7f')]?_0x19b1c0[_0x9467('0x7f')][_0x9467('0x81')]:undefined};if(_0x19b1c0[_0x9467('0x7f')]&&_0x19b1c0[_0x9467('0x7f')][_0x9467('0x82')]){return base64Decode(_0x19b1c0['channelData']['AudioFromTts'][_0x9467('0x83')],path[_0x9467('0x24')](__dirname,_0x9467('0x25'),rs['generate'](0x4)+_0x9467('0x36')))[_0x9467('0x35')](function(_0x26d0d6){_0x1e6c13[_0x9467('0x84')]=_0x26d0d6;return _0x1e6c13;});}return _0x1e6c13;});};exports[_0x9467('0x85')]=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 c5a0863..aad4e95 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 _0x4602=['./nda','exports'];(function(_0x8585ff,_0x9232d){var _0x3ff111=function(_0x1c40bc){while(--_0x1c40bc){_0x8585ff['push'](_0x8585ff['shift']());}};_0x3ff111(++_0x9232d);}(_0x4602,0x98));var _0x2460=function(_0x154fa2,_0x395bf1){_0x154fa2=_0x154fa2-0x0;var _0x58a67b=_0x4602[_0x154fa2];return _0x58a67b;};var nda=require(_0x2460('0x0'));module[_0x2460('0x1')]={'nda':nda}; \ No newline at end of file +var _0x2740=['./nda'];(function(_0x35da54,_0x47e8d6){var _0x19d34d=function(_0x38b602){while(--_0x38b602){_0x35da54['push'](_0x35da54['shift']());}};_0x19d34d(++_0x47e8d6);}(_0x2740,0x13a));var _0x0274=function(_0x24fce3,_0x5ee22f){_0x24fce3=_0x24fce3-0x0;var _0x5a973d=_0x2740[_0x24fce3];return _0x5a973d;};var nda=require(_0x0274('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 695a27b..76b7c01 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 _0xf17f=['resolve','ndauth_url','password','username','then','ndassistant_url','ndaactivity_type','message','Nda','callerid','calleridname','dnid','extension','access_token','project','body','ProjectName','channelData','CustomAction','custom_action','custom_action_data','info','stringify','request-promise','url','../../../../../config/logger','exports','POST'];(function(_0x5bd426,_0x4878e5){var _0x23a7eb=function(_0x594b42){while(--_0x594b42){_0x5bd426['push'](_0x5bd426['shift']());}};_0x23a7eb(++_0x4878e5);}(_0xf17f,0x113));var _0xff17=function(_0x3513e2,_0x26f645){_0x3513e2=_0x3513e2-0x0;var _0x186e8f=_0xf17f[_0x3513e2];return _0x186e8f;};'use strict';var rp=require(_0xff17('0x0'));var url=require(_0xff17('0x1'));var logger=require(_0xff17('0x2'))('agi');module[_0xff17('0x3')]=function(_0x482b13,_0x5bcb25){var _0x2330c4={'method':_0xff17('0x4'),'uri':url[_0xff17('0x5')](_0x5bcb25[_0xff17('0x6')],'/token'),'form':{'grant_type':_0xff17('0x7'),'username':_0x5bcb25[_0xff17('0x8')],'password':_0x5bcb25['password']},'json':!![]};return rp(_0x2330c4)[_0xff17('0x9')](function(_0x3a264d){var _0x58e9f8={'method':_0xff17('0x4'),'uri':url[_0xff17('0x5')](_0x5bcb25[_0xff17('0xa')],'/api/NaturalDialogAssistant/v1/Run'),'body':{'type':_0x5bcb25[_0xff17('0xb')]||_0xff17('0xc'),'channelId':_0xff17('0xd'),'conversation':{'id':_0x482b13['uniqueid']},'from':{'id':_0x482b13[_0xff17('0xe')],'name':_0x482b13[_0xff17('0xf')]},'recipient':{'id':_0x482b13[_0xff17('0x10')],'name':_0x482b13[_0xff17('0x11')]},'text':_0x5bcb25['text'],'channelData':{}},'headers':{'Authorization':'Bearer\x20'+_0x3a264d[_0xff17('0x12')]},'json':!![]};if(_0x5bcb25[_0xff17('0x13')]){_0x58e9f8[_0xff17('0x14')]['channelData'][_0xff17('0x15')]=_0x5bcb25[_0xff17('0x13')];}if(_0x5bcb25['ndagenerate_audio']=='1'){_0x58e9f8[_0xff17('0x14')][_0xff17('0x16')]['AudioOutputSettings']={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':'audio/wav'};}if(_0x5bcb25['custom_action']){_0x58e9f8[_0xff17('0x14')]['channelData'][_0xff17('0x17')]=_0x5bcb25[_0xff17('0x18')];if(_0x5bcb25[_0xff17('0x19')]){_0x58e9f8[_0xff17('0x14')][_0xff17('0x16')]['CustomActionData']=_0x5bcb25[_0xff17('0x19')];}}logger[_0xff17('0x1a')](JSON[_0xff17('0x1b')](_0x58e9f8));return rp(_0x58e9f8);});}; \ No newline at end of file +var _0x23a8=['project','channelData','ndagenerate_audio','body','audio/wav','custom_action','custom_action_data','CustomActionData','info','stringify','url','agi','POST','ndauth_url','/token','password','username','then','resolve','/api/NaturalDialogAssistant/v1/Run','ndaactivity_type','message','Nda','callerid','calleridname','dnid','extension','text','Bearer\x20','access_token'];(function(_0x108c79,_0x39e18a){var _0x44788f=function(_0x489a3e){while(--_0x489a3e){_0x108c79['push'](_0x108c79['shift']());}};_0x44788f(++_0x39e18a);}(_0x23a8,0x172));var _0x823a=function(_0x3684bc,_0x3e7243){_0x3684bc=_0x3684bc-0x0;var _0x33b2c5=_0x23a8[_0x3684bc];return _0x33b2c5;};'use strict';var rp=require('request-promise');var url=require(_0x823a('0x0'));var logger=require('../../../../../config/logger')(_0x823a('0x1'));module['exports']=function(_0x39a117,_0x413513){var _0x5a6cbc={'method':_0x823a('0x2'),'uri':url['resolve'](_0x413513[_0x823a('0x3')],_0x823a('0x4')),'form':{'grant_type':_0x823a('0x5'),'username':_0x413513[_0x823a('0x6')],'password':_0x413513['password']},'json':!![]};return rp(_0x5a6cbc)[_0x823a('0x7')](function(_0x3f35db){var _0x59866f={'method':_0x823a('0x2'),'uri':url[_0x823a('0x8')](_0x413513['ndassistant_url'],_0x823a('0x9')),'body':{'type':_0x413513[_0x823a('0xa')]||_0x823a('0xb'),'channelId':_0x823a('0xc'),'conversation':{'id':_0x39a117['uniqueid']},'from':{'id':_0x39a117[_0x823a('0xd')],'name':_0x39a117[_0x823a('0xe')]},'recipient':{'id':_0x39a117[_0x823a('0xf')],'name':_0x39a117[_0x823a('0x10')]},'text':_0x413513[_0x823a('0x11')],'channelData':{}},'headers':{'Authorization':_0x823a('0x12')+_0x3f35db[_0x823a('0x13')]},'json':!![]};if(_0x413513[_0x823a('0x14')]){_0x59866f['body'][_0x823a('0x15')]['ProjectName']=_0x413513[_0x823a('0x14')];}if(_0x413513[_0x823a('0x16')]=='1'){_0x59866f[_0x823a('0x17')]['channelData']['AudioOutputSettings']={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0x823a('0x18')};}if(_0x413513[_0x823a('0x19')]){_0x59866f[_0x823a('0x17')]['channelData']['CustomAction']=_0x413513['custom_action'];if(_0x413513[_0x823a('0x1a')]){_0x59866f[_0x823a('0x17')][_0x823a('0x15')][_0x823a('0x1b')]=_0x413513[_0x823a('0x1a')];}}logger[_0x823a('0x1c')](JSON[_0x823a('0x1d')](_0x59866f));return rp(_0x59866f);});}; \ 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 9ed0c83..910221d 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 _0x20d4=['./lib/api','exports'];(function(_0x315b8c,_0x57065e){var _0x33a07a=function(_0x39f246){while(--_0x39f246){_0x315b8c['push'](_0x315b8c['shift']());}};_0x33a07a(++_0x57065e);}(_0x20d4,0xe4));var _0x420d=function(_0x215cb0,_0x12ef98){_0x215cb0=_0x215cb0-0x0;var _0x402124=_0x20d4[_0x215cb0];return _0x402124;};'use strict';var asr=require(_0x420d('0x0'));module[_0x420d('0x1')]=function(_0x2ba686,_0x4f5fd5,_0x2138bf,_0x1ce56c){return asr(_0x2ba686,_0x4f5fd5,_0x2138bf,_0x1ce56c);}; \ No newline at end of file +var _0x1b7b=['./lib/api','exports'];(function(_0x4ffa64,_0x271035){var _0x5da001=function(_0x7d1940){while(--_0x7d1940){_0x4ffa64['push'](_0x4ffa64['shift']());}};_0x5da001(++_0x271035);}(_0x1b7b,0x104));var _0xb1b7=function(_0x567308,_0x128b4e){_0x567308=_0x567308-0x0;var _0x10407b=_0x1b7b[_0x567308];return _0x10407b;};'use strict';var asr=require(_0xb1b7('0x0'));module[_0xb1b7('0x1')]=function(_0x43c6ed,_0x11d96e,_0x47c330,_0x211495){return asr(_0x43c6ed,_0x11d96e,_0x47c330,_0x211495);}; \ 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 dbfd4e5..2170615 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 _0xbc73=['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','Open\x20Tilde\x20ASR\x20socket','unix','send','createReadStream','EOS','error','Tilde\x20ASR\x20send\x20error','stringify','parse','status','result','final','Tilde\x20ASR\x20hypoteses','hypotheses','transcript','likelihood','Success.','Not\x20available.\x20Max\x20load\x20limit\x20reached.','Authentication\x20failed.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','Close\x20Tilde\x20ASR\x20socket','Error\x20Tilde\x20ASR\x20socket','isNil','isObject','open','message','bluebird','lodash','moment','crypto','agi','exports','info'];(function(_0xa2c0a3,_0x5bbac0){var _0x52c618=function(_0x20f7fd){while(--_0x20f7fd){_0xa2c0a3['push'](_0xa2c0a3['shift']());}};_0x52c618(++_0x5bbac0);}(_0xbc73,0x74));var _0x3bc7=function(_0x576266,_0x4002b0){_0x576266=_0x576266-0x0;var _0x18234f=_0xbc73[_0x576266];return _0x18234f;};'use strict';var BPromise=require(_0x3bc7('0x0'));var _=require(_0x3bc7('0x1'));var fs=require('fs');var WebSocket=require('ws');var moment=require(_0x3bc7('0x2'));var crypto=require(_0x3bc7('0x3'));var logger=require('../../../../../../config/logger')(_0x3bc7('0x4'));module[_0x3bc7('0x5')]=function(_0x2ab5fc,_0x35cc2f,_0x32de04,_0xbb6993){return new BPromise(function(_0x49c0b9,_0x5efa82){logger[_0x3bc7('0x6')](_0x3bc7('0x7'),_0xbb6993||_0x3bc7('0x8'));var _0x4806b3=new WebSocket(_0xbb6993||_0x3bc7('0x8'),{'perMessageDeflate':![]});var _0x30a78c='';var _0x2d78c7='0';var _0x2b7c7b='1';var _0x8e1112=_0x3bc7('0x9');function _0x35a1bc(_0x8fee4b){var _0x4f8343=crypto[_0x3bc7('0xa')](_0x3bc7('0xb'));_0x4f8343[_0x3bc7('0xc')](_0x8fee4b);return _0x4f8343[_0x3bc7('0xd')](_0x3bc7('0xe'));}function _0x4ea435(){try{logger[_0x3bc7('0x6')](_0x3bc7('0xf'));var _0x59447b=moment()[_0x3bc7('0x10')]();var _0x1a7ed8=_0x35a1bc(_0x59447b+_0x35cc2f+_0x32de04);_0x4806b3[_0x3bc7('0x11')](JSON['stringify']({'appID':_0x35cc2f,'timestamp':_0x59447b,'appKey':_0x1a7ed8}));var _0x5ec11d=fs[_0x3bc7('0x12')](_0x2ab5fc);_0x5ec11d['on']('data',function(_0x176c58){_0x4806b3[_0x3bc7('0x11')](_0x176c58);});_0x5ec11d['on']('close',function(){_0x4806b3['send'](_0x3bc7('0x13'));});}catch(_0x16a307){logger[_0x3bc7('0x14')](_0x3bc7('0x15'),JSON[_0x3bc7('0x16')](_0x16a307));_0x4806b3['terminate']();}}function _0x67446e(_0x56fccb){try{if(_0x56fccb){var _0x347540=JSON[_0x3bc7('0x17')](_0x56fccb);switch(_0x347540[_0x3bc7('0x18')]){case 0x0:if(_0x347540[_0x3bc7('0x19')]){if(_0x347540[_0x3bc7('0x19')][_0x3bc7('0x1a')]){logger[_0x3bc7('0x6')](_0x3bc7('0x1b'),JSON['stringify'](_0x347540[_0x3bc7('0x19')][_0x3bc7('0x1c')]));_0x30a78c=_0x347540[_0x3bc7('0x19')][_0x3bc7('0x1c')][0x0][_0x3bc7('0x1d')];_0x2d78c7=_0x347540[_0x3bc7('0x19')][_0x3bc7('0x1c')][0x0][_0x3bc7('0x1e')];_0x2b7c7b='0';_0x8e1112=_0x3bc7('0x1f');_0x4806b3['terminate']();}}break;case 0x1:logger[_0x3bc7('0x6')](_0x3bc7('0x9'));_0x2b7c7b='1';_0x8e1112=_0x3bc7('0x9');break;case 0x2:logger[_0x3bc7('0x6')]('Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.');_0x2b7c7b='2';_0x8e1112='Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.';break;case 0x9:logger[_0x3bc7('0x6')](_0x3bc7('0x20'));_0x2b7c7b='9';_0x8e1112=_0x3bc7('0x20');break;case 0xa:logger[_0x3bc7('0x6')](_0x3bc7('0x21'));_0x2b7c7b='10';_0x8e1112=_0x3bc7('0x21');break;case 0xb:logger[_0x3bc7('0x6')]('All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.');_0x2b7c7b='11';_0x8e1112=_0x3bc7('0x22');}}}catch(_0x16d9c8){logger[_0x3bc7('0x14')]('Tilde\x20ASR\x20parse\x20error',JSON[_0x3bc7('0x16')](_0x16d9c8));_0x4806b3['terminate']();}}function _0x30edc8(){logger[_0x3bc7('0x6')](_0x3bc7('0x23'));_0x49c0b9({'transcript':_0x30a78c,'confidence':_0x2d78c7,'status':_0x2b7c7b,'status_message':_0x8e1112});}function _0x473990(_0x107442){logger[_0x3bc7('0x14')](_0x3bc7('0x24'));if(!_[_0x3bc7('0x25')](_0x107442)){logger[_0x3bc7('0x14')](_[_0x3bc7('0x26')](_0x107442)?JSON[_0x3bc7('0x16')](_0x107442):_0x107442);}}_0x4806b3['on'](_0x3bc7('0x27'),_0x4ea435);_0x4806b3['on'](_0x3bc7('0x28'),_0x67446e);_0x4806b3['on']('close',_0x30edc8);_0x4806b3['on'](_0x3bc7('0x14'),_0x473990);});}; \ No newline at end of file +var _0xe6f2=['exports','info','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','hex','Open\x20Tilde\x20ASR\x20socket','unix','send','data','close','EOS','error','Tilde\x20ASR\x20send\x20error','stringify','terminate','parse','result','final','Tilde\x20ASR\x20hypoteses','hypotheses','transcript','likelihood','Success.','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Not\x20available.\x20Max\x20load\x20limit\x20reached.','Authentication\x20failed.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','Tilde\x20ASR\x20parse\x20error','Error\x20Tilde\x20ASR\x20socket','isNil','isObject','open','lodash','moment','crypto','agi'];(function(_0x1b2ff7,_0x12a034){var _0x31656a=function(_0x1165a5){while(--_0x1165a5){_0x1b2ff7['push'](_0x1b2ff7['shift']());}};_0x31656a(++_0x12a034);}(_0xe6f2,0xb5));var _0x2e6f=function(_0x2c487c,_0xcb60b5){_0x2c487c=_0x2c487c-0x0;var _0x15cf4b=_0xe6f2[_0x2c487c];return _0x15cf4b;};'use strict';var BPromise=require('bluebird');var _=require(_0x2e6f('0x0'));var fs=require('fs');var WebSocket=require('ws');var moment=require(_0x2e6f('0x1'));var crypto=require(_0x2e6f('0x2'));var logger=require('../../../../../../config/logger')(_0x2e6f('0x3'));module[_0x2e6f('0x4')]=function(_0x109f8e,_0x1ef2c5,_0x292376,_0x202c0d){return new BPromise(function(_0x3b6b63,_0x36ed38){logger[_0x2e6f('0x5')]('Tilde\x20URI',_0x202c0d||_0x2e6f('0x6'));var _0x109573=new WebSocket(_0x202c0d||_0x2e6f('0x6'),{'perMessageDeflate':![]});var _0x3d7dfd='';var _0x47b33b='0';var _0x2fd11d='1';var _0x192feb=_0x2e6f('0x7');function _0x38b1b4(_0x4bcede){var _0x500ea8=crypto[_0x2e6f('0x8')]('sha1');_0x500ea8['update'](_0x4bcede);return _0x500ea8['digest'](_0x2e6f('0x9'));}function _0x1d5f0e(){try{logger[_0x2e6f('0x5')](_0x2e6f('0xa'));var _0x2e24bb=moment()[_0x2e6f('0xb')]();var _0x4a7522=_0x38b1b4(_0x2e24bb+_0x1ef2c5+_0x292376);_0x109573[_0x2e6f('0xc')](JSON['stringify']({'appID':_0x1ef2c5,'timestamp':_0x2e24bb,'appKey':_0x4a7522}));var _0x1e6073=fs['createReadStream'](_0x109f8e);_0x1e6073['on'](_0x2e6f('0xd'),function(_0x3df76b){_0x109573['send'](_0x3df76b);});_0x1e6073['on'](_0x2e6f('0xe'),function(){_0x109573[_0x2e6f('0xc')](_0x2e6f('0xf'));});}catch(_0x121152){logger[_0x2e6f('0x10')](_0x2e6f('0x11'),JSON[_0x2e6f('0x12')](_0x121152));_0x109573[_0x2e6f('0x13')]();}}function _0x438c23(_0xdf62cd){try{if(_0xdf62cd){var _0x54bbcd=JSON[_0x2e6f('0x14')](_0xdf62cd);switch(_0x54bbcd['status']){case 0x0:if(_0x54bbcd[_0x2e6f('0x15')]){if(_0x54bbcd['result'][_0x2e6f('0x16')]){logger['info'](_0x2e6f('0x17'),JSON[_0x2e6f('0x12')](_0x54bbcd['result']['hypotheses']));_0x3d7dfd=_0x54bbcd[_0x2e6f('0x15')][_0x2e6f('0x18')][0x0][_0x2e6f('0x19')];_0x47b33b=_0x54bbcd[_0x2e6f('0x15')][_0x2e6f('0x18')][0x0][_0x2e6f('0x1a')];_0x2fd11d='0';_0x192feb=_0x2e6f('0x1b');_0x109573[_0x2e6f('0x13')]();}}break;case 0x1:logger[_0x2e6f('0x5')]('No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech');_0x2fd11d='1';_0x192feb=_0x2e6f('0x7');break;case 0x2:logger['info'](_0x2e6f('0x1c'));_0x2fd11d='2';_0x192feb=_0x2e6f('0x1c');break;case 0x9:logger[_0x2e6f('0x5')](_0x2e6f('0x1d'));_0x2fd11d='9';_0x192feb=_0x2e6f('0x1d');break;case 0xa:logger[_0x2e6f('0x5')](_0x2e6f('0x1e'));_0x2fd11d='10';_0x192feb=_0x2e6f('0x1e');break;case 0xb:logger[_0x2e6f('0x5')](_0x2e6f('0x1f'));_0x2fd11d='11';_0x192feb='All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.';}}}catch(_0x3a8356){logger[_0x2e6f('0x10')](_0x2e6f('0x20'),JSON[_0x2e6f('0x12')](_0x3a8356));_0x109573[_0x2e6f('0x13')]();}}function _0x4f4ab7(){logger[_0x2e6f('0x5')]('Close\x20Tilde\x20ASR\x20socket');_0x3b6b63({'transcript':_0x3d7dfd,'confidence':_0x47b33b,'status':_0x2fd11d,'status_message':_0x192feb});}function _0x92385d(_0x3c7873){logger[_0x2e6f('0x10')](_0x2e6f('0x21'));if(!_[_0x2e6f('0x22')](_0x3c7873)){logger[_0x2e6f('0x10')](_[_0x2e6f('0x23')](_0x3c7873)?JSON[_0x2e6f('0x12')](_0x3c7873):_0x3c7873);}}_0x109573['on'](_0x2e6f('0x24'),_0x1d5f0e);_0x109573['on']('message',_0x438c23);_0x109573['on'](_0x2e6f('0xe'),_0x4f4ab7);_0x109573['on'](_0x2e6f('0x10'),_0x92385d);});}; \ 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 f0f1647..2afeff4 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 _0x3695=['./asr'];(function(_0x7d5a42,_0x4911e4){var _0x3af564=function(_0x54bd49){while(--_0x54bd49){_0x7d5a42['push'](_0x7d5a42['shift']());}};_0x3af564(++_0x4911e4);}(_0x3695,0x190));var _0x5369=function(_0x47e93,_0x20b70d){_0x47e93=_0x47e93-0x0;var _0x2f20ba=_0x3695[_0x47e93];return _0x2f20ba;};var asr=require(_0x5369('0x0'));module['exports']={'asr':asr}; \ No newline at end of file +var _0x1a68=['exports'];(function(_0x101a9b,_0x12e7d8){var _0x285117=function(_0x190e24){while(--_0x190e24){_0x101a9b['push'](_0x101a9b['shift']());}};_0x285117(++_0x12e7d8);}(_0x1a68,0x18a));var _0x81a6=function(_0x2b0d25,_0x50d3f3){_0x2b0d25=_0x2b0d25-0x0;var _0x47406d=_0x1a68[_0x2b0d25];return _0x47406d;};var asr=require('./asr');module[_0x81a6('0x0')]={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/server.js b/server/services/agi/server.js index f9caf53..0e83dda 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 _0x525f=['close','exports','util','net','events','EventEmitter','./error','./channel','call','emit','error','E_AGI_ARGUMENT_PORT','createServer','listen','listening','connection','getConnections','E_AGI_SERVER_ERROR','destroy','E_AGI_SERVER_MAXCONNECTION','ready'];(function(_0x345ca6,_0x4ca797){var _0x3fd9bc=function(_0x428b18){while(--_0x428b18){_0x345ca6['push'](_0x345ca6['shift']());}};_0x3fd9bc(++_0x4ca797);}(_0x525f,0x1d0));var _0xf525=function(_0x427691,_0x5636a5){_0x427691=_0x427691-0x0;var _0x317cfb=_0x525f[_0x427691];return _0x317cfb;};'use strict';var util=require(_0xf525('0x0'));var net=require(_0xf525('0x1'));var EventEmitter=require(_0xf525('0x2'))[_0xf525('0x3')];var AGIError=require(_0xf525('0x4'));var AGIChannel=require(_0xf525('0x5'));var AGIServer=function(_0x21e28e,_0x1606cd,_0x44a5ab){var _0x1c79b9=this,_0x21e28e=_0x21e28e||0x11dd,_0x1606cd=_0x1606cd||'127.0.0.1',_0x5d9cac=null,_0x526f0d=0x0;EventEmitter[_0xf525('0x6')](_0x1c79b9);function _0xe3df3a(){if(!_0x21e28e){_0x1c79b9[_0xf525('0x7')](_0xf525('0x8'),new AGIError(_0xf525('0x9')));return![];}_0x5d9cac=net[_0xf525('0xa')]();_0x5d9cac[_0xf525('0xb')](_0x21e28e,_0x1606cd);_0x5d9cac['on'](_0xf525('0xc'),function(){_0x1c79b9['emit'](_0xf525('0xc'));});_0x5d9cac['on'](_0xf525('0xd'),function(_0x4d3d29){_0x5d9cac[_0xf525('0xe')](function(_0x33fc35,_0x486fdd){if(_0x33fc35){_0x1c79b9['emit']('error',new AGIError(_0xf525('0xf'),_0x33fc35));}else if(_0x44a5ab&&_0x44a5ab<0x0){_0x1c79b9[_0xf525('0x7')](_0xf525('0x8'),new AGIError('E_AGI_SERVER_VOICE_DISABLED'));_0x4d3d29[_0xf525('0x10')]();}else if(_0x44a5ab&&_0x44a5ab>0x0&&_0x44a5ab<_0x486fdd){_0x526f0d+=0x1;_0x1c79b9[_0xf525('0x7')](_0xf525('0x8'),new AGIError(_0xf525('0x11'),_0x526f0d));_0x4d3d29['destroy']();}else{var _0x1afd48=new AGIChannel(_0x4d3d29);_0x1afd48['on'](_0xf525('0x12'),function(){_0x1c79b9[_0xf525('0x7')](_0xf525('0xd'),_0x1afd48);});}});});_0x5d9cac['on'](_0xf525('0x8'),function(_0x1cd78c){_0x1c79b9['emit']('error',new AGIError(_0xf525('0xf'),_0x1cd78c['code']));});_0x5d9cac['on'](_0xf525('0x13'),function(){_0x1c79b9[_0xf525('0x7')](_0xf525('0x13'),new AGIError('E_AGI_SERVER_CLOSE'));});}process['nextTick'](function(){_0xe3df3a();});};util['inherits'](AGIServer,EventEmitter);module[_0xf525('0x14')]=function(_0x46878c,_0x5378e2,_0x4345bf){return new AGIServer(_0x46878c,_0x5378e2,_0x4345bf);}; \ No newline at end of file +var _0x73da=['call','emit','error','E_AGI_ARGUMENT_PORT','createServer','listen','connection','getConnections','E_AGI_SERVER_ERROR','E_AGI_SERVER_VOICE_DISABLED','destroy','E_AGI_SERVER_MAXCONNECTION','ready','code','close','E_AGI_SERVER_CLOSE','inherits','util','net','events','EventEmitter','./channel','127.0.0.1'];(function(_0x27c77,_0x554973){var _0x2bb21b=function(_0x14f558){while(--_0x14f558){_0x27c77['push'](_0x27c77['shift']());}};_0x2bb21b(++_0x554973);}(_0x73da,0x1af));var _0xa73d=function(_0x1a3634,_0x3a5fe7){_0x1a3634=_0x1a3634-0x0;var _0x2338c7=_0x73da[_0x1a3634];return _0x2338c7;};'use strict';var util=require(_0xa73d('0x0'));var net=require(_0xa73d('0x1'));var EventEmitter=require(_0xa73d('0x2'))[_0xa73d('0x3')];var AGIError=require('./error');var AGIChannel=require(_0xa73d('0x4'));var AGIServer=function(_0x218400,_0x57372e,_0x3e1395){var _0x37b55f=this,_0x218400=_0x218400||0x11dd,_0x57372e=_0x57372e||_0xa73d('0x5'),_0x1eca35=null,_0x3e8523=0x0;EventEmitter[_0xa73d('0x6')](_0x37b55f);function _0xed8a52(){if(!_0x218400){_0x37b55f[_0xa73d('0x7')](_0xa73d('0x8'),new AGIError(_0xa73d('0x9')));return![];}_0x1eca35=net[_0xa73d('0xa')]();_0x1eca35[_0xa73d('0xb')](_0x218400,_0x57372e);_0x1eca35['on']('listening',function(){_0x37b55f[_0xa73d('0x7')]('listening');});_0x1eca35['on'](_0xa73d('0xc'),function(_0x1389a0){_0x1eca35[_0xa73d('0xd')](function(_0x4f59ac,_0x506336){if(_0x4f59ac){_0x37b55f['emit'](_0xa73d('0x8'),new AGIError(_0xa73d('0xe'),_0x4f59ac));}else if(_0x3e1395&&_0x3e1395<0x0){_0x37b55f[_0xa73d('0x7')](_0xa73d('0x8'),new AGIError(_0xa73d('0xf')));_0x1389a0[_0xa73d('0x10')]();}else if(_0x3e1395&&_0x3e1395>0x0&&_0x3e1395<_0x506336){_0x3e8523+=0x1;_0x37b55f[_0xa73d('0x7')]('error',new AGIError(_0xa73d('0x11'),_0x3e8523));_0x1389a0[_0xa73d('0x10')]();}else{var _0x57a8a4=new AGIChannel(_0x1389a0);_0x57a8a4['on'](_0xa73d('0x12'),function(){_0x37b55f[_0xa73d('0x7')](_0xa73d('0xc'),_0x57a8a4);});}});});_0x1eca35['on'](_0xa73d('0x8'),function(_0x5d49aa){_0x37b55f['emit'](_0xa73d('0x8'),new AGIError(_0xa73d('0xe'),_0x5d49aa[_0xa73d('0x13')]));});_0x1eca35['on'](_0xa73d('0x14'),function(){_0x37b55f['emit']('close',new AGIError(_0xa73d('0x15')));});}process['nextTick'](function(){_0xed8a52();});};util[_0xa73d('0x16')](AGIServer,EventEmitter);module['exports']=function(_0x29e23d,_0x48043a,_0x11b7f5){return new AGIServer(_0x29e23d,_0x48043a,_0x11b7f5);}; \ No newline at end of file diff --git a/server/services/agi/vertices.js b/server/services/agi/vertices.js index 36ed85f..dc6f522 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 _0xaba6=['no\x20key\x20configured','bot','DIALOGFLOW_%s','speech','out','Dialogflow\x20Result\x20%s','Dialogflow\x20is\x20unreachable','dialogflowV2','Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block','no\x20project_id\x20configured','client_email','no\x20client_email\x20configured','no\x20private_key\x20configured','Trying\x20DialogflowV2:\x20%s','providerResponse','toUpperCase','DialogflowV2\x20is\x20unreachable','sesteknda','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','ndauth_url','no\x20ndauth\x20url\x20configured','username','password','no\x20password\x20configured','ndassistant_url','Trying\x20SestekNDA:\x20%s','SESTEK_NDA_%s','audiofile','Sestek\x20NDA\x20%s\x20file\x20created','streamFile','.wav','SestekNDA\x20Result\x20%s','SestekNDA\x20is\x20unreachable','end','ext_dial','trunk_id','no\x20trunk\x20selected','no\x20trunk\x20found','trunk_name','finally','getdigits','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','retry','file_id','no\x20file\x20audio\x20found','getData','response','maxdigit','test','mindigit','hiddendigitsnum','generate','substr','goal','Enter\x20in\x20GOAL\x20(%s)\x20block','goalname','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','no\x20bot\x20name\x20configured','Trying\x20Amazon\x20Lex:\x20%s','AWS_LEX_%s','Amazon\x20Lex\x20ready\x20for\x20fulfillment','amazonlex','Amazon\x20Lex\x20Result\x20%s','Amazon\x20Lex\x20is\x20unreachable','googleasr','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','wav','%s/recordings/%s','beep','NOBEEP','recordFile','intKey','google\x20%s\x20file\x20created','GOOGLE_ASR_%s','GoogleASR\x20Result\x20%s','tildeasr','Enter\x20in\x20TILDEASR\x20(%s)\x20block','no\x20appsecret\x20configured','TILDE_ASR_%s','TildeASR\x20Result\x20%s','gotoc','gotoif','Enter\x20in\x20GOTOIF\x20(%s)\x20block','condition','no\x20condition\x20configured','false','EVAL\x20CONDITION\x20%s\x20%s','gotoiftime','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','interval_id','no\x20interval\x20configured','getIntervals','no\x20intervals\x20found','IFTIME\x20%s\x20%s','true','hangup','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','ispeechASR','ISPEECH_ASR_%s','IspeechASR\x20Result\x20%s','ispeechtts','ispeech\x20%s\x20file\x20created','unlink','ispeech\x20TTS\x20is\x20unreachable','Enter\x20in\x20LOGIN\x20(%s)\x20block','findBy','FIND\x20AGENT\x20%s\x20BY\x20%s','AGENT\x20%s\x20FOUND\x20BY','success','no\x20find\x20by\x20configured','AGENT\x20%s\x20NOT\x20FOUND\x20BY','failure','math','operation','no\x20operation\x20configured','math\x20%s','isArray','%s[%s]','variable\x20%s[key]\x20set','no\x20file\x20audio\x20selected','digit','Enter\x20in\x20NOOP\x20(%s)\x20block','output','pause','Enter\x20in\x20PAUSE\x20(%s)\x20block','pause_id','playback','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','getSound','PLAYBACK','Executed\x20command\x20%s\x20%s','Enter\x20in\x20QUEUE\x20(%s)\x20block','no\x20queue\x20selected','queue_id','no\x20queue\x20found','indexOf','toLowerCase','QUEUE','macro','gosub','position','Enter\x20in\x20RECORD\x20(%s)\x20block','%s_%s','RECORDING_SAVENAME','Recording\x20%s\x20%s\x20%s\x20%s','escape_digits','no\x20url\x20configured','restAPI','Response:','inspect','no\x20variable\x20selected\x20for\x20the\x20response','%s_STATUS_CODE','200','%s_STATUS_MESSAGE','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','saydigits','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','sayDigits','digits','sayNumber','sayphonetic','sayPhonetic','sendMail','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','account_id','no\x20mail\x20account\x20configured','Smtp','no\x20mail\x20account\x20found','\x22%s\x22\x20<%s>','bcc','service','host','port','authentication','auth','user','pass','template_id','sendMail\x20message','Trying\x20SendMail\x20with\x20account\x20%s','Mail\x20message\x20added\x20to\x20outgoing\x20process','sendFax','Enter\x20in\x20SENDSMS\x20(%s)\x20block','sms_account_id','no\x20sms\x20account\x20configured','sendSMS\x20message','Trying\x20SendSMS\x20with\x20account\x20%s','Sms\x20message\x20added\x20to\x20outgoing\x20process','Enter\x20in\x20SET\x20(%s)\x20block','start','START\x20CALLY\x20SQUARE','yes','Answer','Skipped\x20Answer','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','project_id','no\x20subproject\x20selected','no\x20subproject\x20found\x20with\x20id\x20%d','project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project','AGI','127.0.0.1','Enter\x20in\x20SYSTEM\x20(%s)\x20block','shellCommand','sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s','sh\x20command:\x20%s\x20result\x20no\x20stored','google_cloud_tts','Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block','Google\x20Cloud\x20TTS\x20%s\x20file\x20created','Google\x20Cloud\x20TTS\x20is\x20unreachable','tts','Trying\x20Google\x20TTS\x20%s','Google\x20TTS\x20is\x20unreachable','unpause','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','voicemail','VOICEMAIL','mailbox','vswitch','no\x20variable\x20selected','join','exports','path','util','moment','mustache','../../config/logger','agi','/var/opt/motion2/server/files','rawBody','menu','getsecretdigits','channel','rpc','mailRpc','prototype','getVariable','getVariableById','then','catch','getVoiceQueue','getVoiceQueueById','getSquareProject','name','getSquareOdbcById','dsn','getUser','getUserById','getTrunk','getTrunkById','getSoundPath','save_name','sendMailMessage','getIntervalById','interval','map','format','%s/sounds/converted/%s','getQueryOdbc','error','info','ODBC\x20connection\x20successfully','query','Error\x20executing\x20query\x20%s','Query\x20executed\x20correctly\x20%s','close','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccount','createSmsMessage','uniqueid','label','agicommand','callerid','createSquareRecording','calleridname','context','extension','priority','accountcode','dnid','arg_1','file','createSquareMessage','isEmpty','isNil','random','lastName','list_id','scheduledAt','callback','callback_priority','has','dialTimezone','CALLERID(dialTimezone)','phone','timezones','utcOffset','scheduledat','add','minutes','insertContact','getPause','getPauseById','agent','agentPause','agentUnpause','agentLogout','agentLogin','internal','%s/%s@from-sip/n','LOCAL','exec','googleCloudTTS','apiKey','google_cloud_tts_text_type','text','ssmlGender','audioEncoding','MP3','googleTTS','google_tts_language','url','method','number','timeout','includes','PUT','body','parse','headers','rawHeaders','An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function','computedVariables','sync','uri','render','stringify','An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function','statusCode','statusMessage','message','500\x20-\x20Internal\x20Server\x20Error','options','googleDialogflow','key','dialogflow_language','googleDialogflowV2','dialogflowV2_project_id','dialogflowV2_language','sestekNDA','ispeechTTS','en-US','speed','ispeech_asr_language','isConfigured','model','awsPolly','aws_access_key_id','aws_secret_access_key','aws_polly_region','aws_polly_voice','awsLex','aws_lex_region','aws_bot_name','googleASR','google_asr_language','tildeASR','appid','appsecret','clear','hasOwnProperty','isString','replaceObjectAllVariables','recursiveNodeIndex','length','replaceAllVariables','saveRestApiResult','isPlainObject','%s.%s','setVariable','split','replaceAll','extra','toString','getAndSetVariable','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','createSquareDetailsReport','maxRetry','mrcpsynth','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','noop','no\x20text\x20configured','result','Executed\x20command\x20MRCPSynth\x20%s','mrcprecog','Enter\x20in\x20MRCPRecog\x20(%s)\x20block','no\x20grammar\x20configured','grammar','MRCPRecog','MRCP_RECOG_CONFIDENCE','RECOG_INPUT()','MRCP_RECOG_TRANSCRIPT','RECOG_INSTANCE()','MRCP_RECOG_INSTANCE','command','args','answer','Enter\x20in\x20ANSWER\x20(%s)\x20block','Wait\x20%s\x20seconds\x20before\x20answer','wait','delay','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','custom_app','application','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','MRCPSynth','sestektts','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','LUMENVOX_ASR_CONFIDENCE','LUMENVOX_ASR_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','Enter\x20in\x20SESTEKASR\x20(%s)\x20block','RECOG_CONFIDENCE()','SESTEK_ASR_CONFIDENCE','SESTEK_ASR_TRANSCRIPT','SESTEK_ASR_INSTANCE','odbc_id','no\x20database\x20selected','getSquareOdbc','no\x20odbc\x20database\x20found','replace','query:\x20%s','variable_id','no\x20variable\x20selected\x20for\x20the\x20result','no\x20variable\x20found','forEach','keys','%s[%s][%s]','%s_ROWS_COUNT','variable\x20%s\x20set','dial','debug','no\x20user\x20selected','sip_id','no\x20user\x20found','DIAL','SIP/%s','opts','Executed\x20command\x20%s','dialogflow'];(function(_0x5bcbe8,_0x261232){var _0x22dfac=function(_0x1f9b0b){while(--_0x1f9b0b){_0x5bcbe8['push'](_0x5bcbe8['shift']());}};_0x22dfac(++_0x261232);}(_0xaba6,0xe2));var _0x6aba=function(_0x1c55f1,_0x3669ca){_0x1c55f1=_0x1c55f1-0x0;var _0x44dd27=_0xaba6[_0x1c55f1];return _0x44dd27;};'use strict';var fs=require('fs');var path=require(_0x6aba('0x0'));var util=require(_0x6aba('0x1'));var _=require('lodash');var sh=require('shelljs');var odbc=require('odbc')();var rs=require('randomstring');var moment=require(_0x6aba('0x2'));var Mustache=require(_0x6aba('0x3'));var rp=require('request-promise');var logger=require(_0x6aba('0x4'))(_0x6aba('0x5'));var config=require('../../config/environment');var shared=require('../../config/environment/shared');var scripts=require('./scripts');var FILES_PATH=_0x6aba('0x6');var recursiveMapAttributes=['rawHeaders',_0x6aba('0x7')];var verticesWithRetry=[_0x6aba('0x8'),'getdigits',_0x6aba('0x9')];var AGIVertices=function(_0x27c8ba,_0x4ea8eb,_0x1114bd){this[_0x6aba('0xa')]=_0x27c8ba;this[_0x6aba('0xb')]=_0x4ea8eb;this[_0x6aba('0xc')]=_0x1114bd;};AGIVertices[_0x6aba('0xd')][_0x6aba('0xe')]=function(_0x181426,_0x55b1b6){this[_0x6aba('0xb')][_0x6aba('0xf')](_0x181426)[_0x6aba('0x10')](function(_0x254007){_0x55b1b6(null,_0x254007?_0x254007['name']:![]);})[_0x6aba('0x11')](function(_0xcb8096){_0x55b1b6(_0xcb8096);});};AGIVertices['prototype'][_0x6aba('0x12')]=function(_0x2934c3,_0x252574){this['rpc'][_0x6aba('0x13')](_0x2934c3)[_0x6aba('0x10')](function(_0x15d236){_0x252574(null,_0x15d236?_0x15d236['name']:![]);})[_0x6aba('0x11')](function(_0xe0c63f){_0x252574(_0xe0c63f);});};AGIVertices[_0x6aba('0xd')][_0x6aba('0x14')]=function(_0x379b17,_0x26c91d){this[_0x6aba('0xb')]['getSquareProjectById'](_0x379b17)[_0x6aba('0x10')](function(_0x448f29){_0x26c91d(null,_0x448f29?_0x448f29[_0x6aba('0x15')]:![]);})['catch'](function(_0x1d6ad4){_0x26c91d(_0x1d6ad4);});};AGIVertices['prototype']['getSquareOdbc']=function(_0x23762e,_0x593bd7){this[_0x6aba('0xb')][_0x6aba('0x16')](_0x23762e)[_0x6aba('0x10')](function(_0xb2f624){_0x593bd7(null,_0xb2f624?_0xb2f624[_0x6aba('0x17')]:![]);})[_0x6aba('0x11')](function(_0x362a10){_0x593bd7(_0x362a10);});};AGIVertices['prototype'][_0x6aba('0x18')]=function(_0x41464f,_0x41744c){this[_0x6aba('0xb')][_0x6aba('0x19')](_0x41464f)[_0x6aba('0x10')](function(_0x44f723){_0x41744c(null,_0x44f723?_0x44f723[_0x6aba('0x15')]:![]);})[_0x6aba('0x11')](function(_0x222ad8){_0x41744c(_0x222ad8);});};AGIVertices[_0x6aba('0xd')][_0x6aba('0x1a')]=function(_0x24d1ad,_0x3aafa3){this[_0x6aba('0xb')][_0x6aba('0x1b')](_0x24d1ad)[_0x6aba('0x10')](function(_0x2f7cdd){_0x3aafa3(null,_0x2f7cdd?_0x2f7cdd[_0x6aba('0x15')]:![]);})['catch'](function(_0x50e864){_0x3aafa3(_0x50e864);});};AGIVertices[_0x6aba('0xd')]['getSound']=function(_0x30ecf9,_0x108ff1){var _0x3ca593=this;this[_0x6aba('0xb')]['getSoundById'](_0x30ecf9)[_0x6aba('0x10')](function(_0x1fcec2){_0x108ff1(null,_0x1fcec2?_0x3ca593[_0x6aba('0x1c')](_0x1fcec2[_0x6aba('0x1d')]):![]);})[_0x6aba('0x11')](function(_0x576799){_0x108ff1(_0x576799);});};AGIVertices[_0x6aba('0xd')]['getMailAccount']=function(_0x6e5f02,_0x3fd125){this['rpc']['getMailAccountById'](_0x6e5f02)[_0x6aba('0x10')](function(_0x21c144){_0x3fd125(null,_0x21c144?_0x21c144:![]);})[_0x6aba('0x11')](function(_0x1ca375){_0x3fd125(_0x1ca375);});};AGIVertices[_0x6aba('0xd')][_0x6aba('0x1e')]=function(_0x39c449,_0x5cdf62,_0x25a2bb){this[_0x6aba('0xc')][_0x6aba('0x1e')](_0x39c449,_0x5cdf62)['then'](function(){_0x25a2bb(null);})[_0x6aba('0x11')](function(_0x6e0941){_0x25a2bb(_0x6e0941);});};AGIVertices[_0x6aba('0xd')]['getIntervals']=function(_0x1b7881,_0x2462ed){this['rpc'][_0x6aba('0x1f')](_0x1b7881)['then'](function(_0x27f4d5){if(_0x27f4d5){if(_0x27f4d5['IntervalId']){_0x2462ed(null,[_0x27f4d5[_0x6aba('0x20')]]);}else{_0x2462ed(null,_[_0x6aba('0x21')](_0x27f4d5['Intervals'],'interval'));}}else{_0x2462ed(null,![]);}})[_0x6aba('0x11')](function(_0x4e9768){_0x2462ed(_0x4e9768);});};AGIVertices[_0x6aba('0xd')][_0x6aba('0x1c')]=function(_0x4b3614){return util[_0x6aba('0x22')](_0x6aba('0x23'),FILES_PATH,_0x4b3614);};AGIVertices[_0x6aba('0xd')][_0x6aba('0x24')]=function(_0x8ca947,_0x19478e,_0x337694){odbc['open'](_0x8ca947,function(_0x52f1e9){if(_0x52f1e9){logger[_0x6aba('0x25')]('Error\x20getting\x20ODBC\x20connection\x20%s',_0x52f1e9);_0x337694(_0x52f1e9);}else{logger[_0x6aba('0x26')](_0x6aba('0x27'));odbc[_0x6aba('0x28')](_0x19478e,function(_0x5332b7,_0x22a62e){if(_0x5332b7){logger[_0x6aba('0x26')](_0x6aba('0x29'),_0x19478e);_0x337694(_0x5332b7);}else{logger[_0x6aba('0x26')](_0x6aba('0x2a'),_0x19478e);odbc[_0x6aba('0x2b')](function(_0x7cc00c){if(_0x7cc00c){logger[_0x6aba('0x25')](_0x6aba('0x2c'),_0x7cc00c);}_0x337694(null,_0x22a62e);});}});}});};AGIVertices['prototype'][_0x6aba('0x2d')]=function(_0x978dcc,_0x3f4d29){this[_0x6aba('0xb')]['getSmsAccountById'](_0x978dcc)[_0x6aba('0x10')](function(_0x4abf0e){_0x3f4d29(null,_0x4abf0e?_0x4abf0e:![]);})[_0x6aba('0x11')](function(_0x547801){_0x3f4d29(_0x547801);});};AGIVertices['prototype']['createSmsMessage']=function(_0x339385,_0x5a8b22){this[_0x6aba('0xb')][_0x6aba('0x2e')](_0x339385)[_0x6aba('0x10')](function(_0xfb89e8){_0x5a8b22(null,_0xfb89e8);})[_0x6aba('0x11')](function(_0x474396){_0x5a8b22(_0x474396);});};AGIVertices[_0x6aba('0xd')]['createSquareDetailsReport']=function(_0x46e693,_0xe75150,_0x44255b){this['rpc']['createSquareDetailsReport']({'uniqueid':this[_0x6aba('0xa')][_0x6aba('0x2f')],'node':_0x46e693[_0x6aba('0x30')],'application':_0x46e693[_0x6aba('0x31')],'data':_0xe75150||null,'project_name':this[_0x6aba('0xa')]['arg_1'],'callerid':this[_0x6aba('0xa')][_0x6aba('0x32')]})[_0x6aba('0x10')](function(_0x3e233d){if(_0x44255b){_0x44255b(null,_0x3e233d);}})[_0x6aba('0x11')](function(_0x367e9a){if(_0x44255b){_0x44255b(_0x367e9a);}});};AGIVertices[_0x6aba('0xd')]['createSquareRecording']=function(_0x3ad708,_0x9ddc9f,_0x293cb6,_0x38e888){this[_0x6aba('0xb')][_0x6aba('0x33')]({'uniqueid':this['channel'][_0x6aba('0x2f')],'callerid':this['channel']['callerid'],'calleridname':this[_0x6aba('0xa')][_0x6aba('0x34')],'context':this[_0x6aba('0xa')][_0x6aba('0x35')],'extension':this[_0x6aba('0xa')][_0x6aba('0x36')],'priority':this[_0x6aba('0xa')][_0x6aba('0x37')],'accountcode':this[_0x6aba('0xa')][_0x6aba('0x38')],'dnid':this['channel'][_0x6aba('0x39')],'projectName':this[_0x6aba('0xa')][_0x6aba('0x3a')],'saveName':_0x9ddc9f,'filename':_0x3ad708[_0x6aba('0x3b')]||_0x9ddc9f,'savePath':_0x293cb6})[_0x6aba('0x10')](function(_0x123a4c){_0x38e888(null,_0x123a4c);})[_0x6aba('0x11')](function(_0x2145f4){_0x38e888(_0x2145f4);});};AGIVertices[_0x6aba('0xd')][_0x6aba('0x3c')]=function(_0x24f87c,_0xd4afa2,_0x3f7003,_0x5bec83,_0x179f1e){this[_0x6aba('0xb')][_0x6aba('0x3c')]({'uniqueid':this['channel'][_0x6aba('0x2f')],'body':_0x24f87c,'direction':_0xd4afa2,'providerName':_0x3f7003,'providerResponse':_0x5bec83})['then'](function(_0x56737e){if(_0x179f1e){_0x179f1e(null,_0x56737e);}})[_0x6aba('0x11')](function(_0x843e49){if(_0x179f1e){_0x179f1e(_0x843e49);}});};AGIVertices[_0x6aba('0xd')]['createCmContact']=function(_0x2dcce1,_0x31cc76){var _0x26a92c=this;var _0x1fbd3e=0x0;var _0x2cd83d={'firstName':_[_0x6aba('0x3d')](_0x2dcce1['name'])||_[_0x6aba('0x3e')](_0x2dcce1[_0x6aba('0x15')])?'callback_'+Math[_0x6aba('0x3f')]():_0x2dcce1[_0x6aba('0x15')],'lastName':_[_0x6aba('0x3d')](_0x2dcce1[_0x6aba('0x40')])||_[_0x6aba('0x3e')](_0x2dcce1[_0x6aba('0x40')])?null:_0x2dcce1['lastName'],'phone':_0x2dcce1['phone'],'ListId':_0x2dcce1[_0x6aba('0x41')],'scheduledat':_0x2dcce1[_0x6aba('0x42')],'callbackUniqueid':this['channel'][_0x6aba('0x2f')],'tags':_0x6aba('0x43'),'description':'Callback\x20scheduled\x20at\x20'+_0x2dcce1[_0x6aba('0x42')]['toString'](),'priority':_0x2dcce1[_0x6aba('0x44')]};if(_[_0x6aba('0x45')](_0x2dcce1,_0x6aba('0x46'))){if(!_['isNil'](_0x2dcce1[_0x6aba('0x46')])){var _0x127f44=_0x2dcce1[_0x6aba('0x46')];if(_0x2dcce1[_0x6aba('0x46')]==_0x6aba('0x47')){this['rpc']['getContactByPhone']({'phone':_0x2dcce1[_0x6aba('0x48')]})[_0x6aba('0x10')](function(_0x585468){if(!_[_0x6aba('0x3e')](_0x585468)){var _0x145903=_0x585468[_0x6aba('0x46')];if(!_[_0x6aba('0x3e')](_0x145903)){var _0x3d0c16=shared[_0x6aba('0x49')][_0x145903];if(!_['isNil'](_0x3d0c16)){var _0x419290=-0x1*_0x3d0c16[_0x6aba('0x4a')];_0x2cd83d[_0x6aba('0x4b')]=moment(_0x2dcce1[_0x6aba('0x4b')])[_0x6aba('0x4c')](_0x419290,_0x6aba('0x4d'));_0x26a92c[_0x6aba('0x4e')](_0x2cd83d,_0x2dcce1,_0x31cc76);}else{_0x26a92c[_0x6aba('0x4e')](_0x2cd83d,_0x2dcce1,_0x31cc76);}}else{_0x26a92c[_0x6aba('0x4e')](_0x2cd83d,_0x2dcce1,_0x31cc76);}}else{_0x26a92c[_0x6aba('0x4e')](_0x2cd83d,_0x2dcce1,_0x31cc76);}});}else{var _0x1fbd3e=shared[_0x6aba('0x49')][_0x127f44];if(!_[_0x6aba('0x3e')](_0x1fbd3e)){var _0x2684bb=-0x1*_0x1fbd3e[_0x6aba('0x4a')];_0x2cd83d[_0x6aba('0x4b')]=moment(_0x2dcce1[_0x6aba('0x4b')])[_0x6aba('0x4c')](_0x2684bb,'minutes');_0x26a92c['insertContact'](_0x2cd83d,_0x2dcce1,_0x31cc76);}else{_0x26a92c[_0x6aba('0x4e')](_0x2cd83d,_0x2dcce1,_0x31cc76);}}}else{_0x26a92c['insertContact'](_0x2cd83d,_0x2dcce1,_0x31cc76);}}else{_0x26a92c[_0x6aba('0x4e')](_0x2cd83d,_0x2dcce1,_0x31cc76);}};AGIVertices[_0x6aba('0xd')][_0x6aba('0x4f')]=function(_0x1432d3,_0x40462e){this[_0x6aba('0xb')][_0x6aba('0x50')](_0x1432d3)[_0x6aba('0x10')](function(_0x66d89b){_0x40462e(null,_0x66d89b?_0x66d89b['name']:![]);})[_0x6aba('0x11')](function(_0x5672ce){_0x40462e(_0x5672ce);});};AGIVertices[_0x6aba('0xd')]['agentPause']=function(_0x36a572,_0x2ca0c3,_0x5e9d71){var _0xdf3c61={'role':_0x6aba('0x51')};_0xdf3c61[_0x36a572]=this[_0x6aba('0xa')][_0x6aba('0x32')];this[_0x6aba('0xb')][_0x6aba('0x52')](_0xdf3c61,_0x2ca0c3,this['channel'][_0x6aba('0x2f')])[_0x6aba('0x10')](function(_0x50633c){_0x5e9d71(null,_[_0x6aba('0x3e')](_0x50633c)?![]:!![]);})[_0x6aba('0x11')](function(_0x4f2ec4){logger[_0x6aba('0x25')](_0x4f2ec4);_0x5e9d71(null,![]);});};AGIVertices[_0x6aba('0xd')]['agentUnpause']=function(_0xf6de1f,_0x3e37df){var _0x59567f={'role':_0x6aba('0x51')};_0x59567f[_0xf6de1f]=this[_0x6aba('0xa')][_0x6aba('0x32')];this[_0x6aba('0xb')][_0x6aba('0x53')](_0x59567f)[_0x6aba('0x10')](function(_0x24d49f){_0x3e37df(null,_[_0x6aba('0x3e')](_0x24d49f)?![]:!![]);})['catch'](function(_0x537230){logger[_0x6aba('0x25')](_0x537230);_0x3e37df(null,![]);});};AGIVertices[_0x6aba('0xd')][_0x6aba('0x54')]=function(_0x3cc68a,_0x117886){var _0x1355e6={'role':_0x6aba('0x51')};_0x1355e6[_0x3cc68a]=this[_0x6aba('0xa')][_0x6aba('0x32')];this[_0x6aba('0xb')][_0x6aba('0x54')](_0x1355e6)['then'](function(_0x1faedb){_0x117886(null,_[_0x6aba('0x3e')](_0x1faedb)?![]:!![]);})[_0x6aba('0x11')](function(_0x1288ec){logger[_0x6aba('0x25')](_0x1288ec);_0x117886(null,![]);});};AGIVertices[_0x6aba('0xd')][_0x6aba('0x55')]=function(_0xa04b42,_0x36c511){var _0x4b920f={'role':'agent'};_0x4b920f[_0xa04b42]=this[_0x6aba('0xa')]['callerid'];var _0x4e4ae7=_0xa04b42!=_0x6aba('0x56')?util[_0x6aba('0x22')](_0x6aba('0x57'),_0x6aba('0x58'),this[_0x6aba('0xa')][_0x6aba('0x32')]):undefined;this[_0x6aba('0xb')][_0x6aba('0x55')](_0x4b920f,_0x4e4ae7)[_0x6aba('0x10')](function(_0x42a7ea){_0x36c511(null,_[_0x6aba('0x3e')](_0x42a7ea)?![]:!![]);})[_0x6aba('0x11')](function(_0x48ed73){logger[_0x6aba('0x25')](_0x48ed73);_0x36c511(null,![]);});};AGIVertices[_0x6aba('0xd')]['shellCommand']=function(_0x10c913,_0x18b73b){sh[_0x6aba('0x59')](_['trim'](_0x10c913),function(_0x34e70c,_0x48ffdb){var _0x4ce189=_0x48ffdb['replace'](/(\r\n|\n|\r)/gm,'');_0x18b73b(null,_0x4ce189);});};AGIVertices[_0x6aba('0xd')][_0x6aba('0x5a')]=function(_0x366bb5,_0x47aec7){scripts[_0x6aba('0x5a')](_0x366bb5[_0x6aba('0x5b')],_0x366bb5[_0x6aba('0x5c')]||_0x6aba('0x5d'),_0x366bb5[_0x6aba('0x5d')],_0x366bb5['languageCode']||'en-US',_0x366bb5[_0x6aba('0x5e')]||'MALE',_0x366bb5[_0x6aba('0x5f')]||_0x6aba('0x60'))[_0x6aba('0x10')](function(_0x1f226c){_0x47aec7(null,_0x1f226c);})[_0x6aba('0x11')](function(_0x39f3c5){_0x47aec7(_0x39f3c5);});};AGIVertices[_0x6aba('0xd')][_0x6aba('0x61')]=function(_0x1fb4d0,_0x5b9b2f){scripts[_0x6aba('0x61')](_0x1fb4d0[_0x6aba('0x5d')],_0x1fb4d0[_0x6aba('0x62')]||'en',0x1)['then'](function(_0x263580){_0x5b9b2f(null,_0x263580);})['catch'](function(_0x5b974){_0x5b9b2f(_0x5b974);});};AGIVertices[_0x6aba('0xd')]['restAPI']=function(_0x1e7cf7,_0x42dd93){var _0x2df0bf={'uri':_0x1e7cf7[_0x6aba('0x63')],'method':_0x1e7cf7[_0x6aba('0x64')],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x1e7cf7['timeout'])===_0x6aba('0x65')&&parseInt(_0x1e7cf7[_0x6aba('0x66')])>=0x1?parseInt(_0x1e7cf7[_0x6aba('0x66')])*0x3e8:0x5*0x3e8};if(_[_0x6aba('0x67')](['POST',_0x6aba('0x68')],_0x2df0bf[_0x6aba('0x64')]['toUpperCase']())){try{_0x2df0bf[_0x6aba('0x69')]=_0x1e7cf7[_0x6aba('0x7')]?JSON[_0x6aba('0x6a')](_0x1e7cf7[_0x6aba('0x7')]):{};}catch(_0x150042){logger[_0x6aba('0x25')]('An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function',_0x150042);}}try{_0x2df0bf[_0x6aba('0x6b')]=_0x1e7cf7[_0x6aba('0x6c')]?JSON[_0x6aba('0x6a')](_0x1e7cf7[_0x6aba('0x6c')]):{};}catch(_0x1054bf){logger['error'](_0x6aba('0x6d'),_0x1054bf);}if(_0x1e7cf7[_0x6aba('0x6e')]){try{var _0x3b4924=require(_0x1e7cf7[_0x6aba('0x6e')])[_0x6aba('0x6f')](this,_0x2df0bf);_0x2df0bf[_0x6aba('0x70')]=Mustache[_0x6aba('0x71')](_0x1e7cf7[_0x6aba('0x63')],_0x3b4924,{},['$$','$$']);if(_0x2df0bf[_0x6aba('0x6b')]){_0x2df0bf['headers']=JSON[_0x6aba('0x6a')](Mustache[_0x6aba('0x71')](JSON[_0x6aba('0x72')](_0x2df0bf[_0x6aba('0x6b')]),_0x3b4924,{},['$$','$$']));}if(_0x2df0bf[_0x6aba('0x69')]){_0x2df0bf[_0x6aba('0x69')]=JSON[_0x6aba('0x6a')](Mustache['render'](JSON['stringify'](_0x2df0bf[_0x6aba('0x69')]),_0x3b4924,{},['$$','$$']));}}catch(_0x27a856){logger[_0x6aba('0x25')](_0x6aba('0x73'),_0x27a856);}}rp(_0x2df0bf)[_0x6aba('0x10')](function(_0x6579e7){var _0x336d70={'statusCode':_0x6579e7[_0x6aba('0x74')]||0xc8,'statusMessage':_0x6579e7[_0x6aba('0x75')]||'OK','headers':_0x6579e7[_0x6aba('0x6b')]||{},'body':_0x6579e7[_0x6aba('0x69')]||{}};_0x42dd93(null,_0x336d70);})[_0x6aba('0x11')](function(_0x24b50e){var _0x328a8b={'statusCode':_0x24b50e[_0x6aba('0x74')]||0x1f4,'statusMessage':_0x24b50e[_0x6aba('0x76')]||_0x6aba('0x77'),'headers':_0x24b50e[_0x6aba('0x78')]['headers']||{},'body':_0x24b50e[_0x6aba('0x78')][_0x6aba('0x69')]||{}};_0x42dd93(null,_0x328a8b);});};AGIVertices[_0x6aba('0xd')][_0x6aba('0x79')]=function(_0x489cde,_0x24f057){scripts['googleDialogflow'](this[_0x6aba('0xa')][_0x6aba('0x2f')],_0x489cde[_0x6aba('0x7a')],_0x489cde['text'],_0x489cde[_0x6aba('0x7b')]||'en')[_0x6aba('0x10')](function(_0x165555){_0x24f057(null,_0x165555);})['catch'](function(_0x438371){_0x24f057(_0x438371);});};AGIVertices[_0x6aba('0xd')]['googleDialogflowV2']=function(_0x8395c1,_0x202adf){scripts[_0x6aba('0x7c')](this[_0x6aba('0xa')]['uniqueid'],_0x8395c1[_0x6aba('0x7d')],_0x8395c1['client_email'],_0x8395c1['private_key'],_0x8395c1[_0x6aba('0x5d')],_0x8395c1[_0x6aba('0x7e')]||'en')['then'](function(_0x30affe){_0x202adf(null,_0x30affe);})['catch'](function(_0x551d5d){_0x202adf(_0x551d5d);});};AGIVertices[_0x6aba('0xd')]['sestekNDA']=function(_0x33f861,_0x1fc80c){scripts[_0x6aba('0x7f')](this[_0x6aba('0xa')],_0x33f861)['then'](function(_0x47b3c7){_0x1fc80c(null,_0x47b3c7);})[_0x6aba('0x11')](function(_0x3060f9){_0x1fc80c(_0x3060f9);});};AGIVertices[_0x6aba('0xd')]['ispeechTTS']=function(_0x16130b,_0x416245){scripts[_0x6aba('0x80')](_0x16130b[_0x6aba('0x7a')],_0x16130b['text'],_0x16130b['ispeech_tts_language']||_0x6aba('0x81'),_0x16130b[_0x6aba('0x82')])[_0x6aba('0x10')](function(_0x1d5f8e){_0x416245(null,_0x1d5f8e);})[_0x6aba('0x11')](function(_0x26d9bc){_0x416245(_0x26d9bc);});};AGIVertices[_0x6aba('0xd')]['ispeechASR']=function(_0x456ae4,_0x1f98ac,_0x4e8dc0){scripts['ispeechASR'](_0x1f98ac,_0x456ae4['key'],_0x456ae4[_0x6aba('0x83')]||_0x6aba('0x81'),this[_0x6aba('0x84')](_0x456ae4[_0x6aba('0x85')])?_0x456ae4['model']:undefined)['then'](function(_0xf92c11){_0x4e8dc0(null,_0xf92c11);})[_0x6aba('0x11')](function(_0x1f2745){_0x4e8dc0(_0x1f2745);});};AGIVertices[_0x6aba('0xd')][_0x6aba('0x86')]=function(_0x3ba3ce,_0x14e6b9){scripts[_0x6aba('0x86')](_0x3ba3ce[_0x6aba('0x87')],_0x3ba3ce[_0x6aba('0x88')],_0x3ba3ce[_0x6aba('0x89')],_0x3ba3ce[_0x6aba('0x8a')]||'Amy',_0x3ba3ce[_0x6aba('0x5d')],_0x3ba3ce['aws_text_type']||_0x6aba('0x5d'))[_0x6aba('0x10')](function(_0x3379f0){_0x14e6b9(null,_0x3379f0);})['catch'](function(_0x2cf899){_0x14e6b9(_0x2cf899);});};AGIVertices[_0x6aba('0xd')][_0x6aba('0x8b')]=function(_0x51806c,_0x2f9106){scripts[_0x6aba('0x8b')](this[_0x6aba('0xa')]['uniqueid'],_0x51806c[_0x6aba('0x87')],_0x51806c[_0x6aba('0x88')],_0x51806c[_0x6aba('0x8c')],_0x51806c[_0x6aba('0x5d')],_0x51806c[_0x6aba('0x8d')])[_0x6aba('0x10')](function(_0x1c0b0e){_0x2f9106(null,_0x1c0b0e);})[_0x6aba('0x11')](function(_0x5e49d9){_0x2f9106(_0x5e49d9);});};AGIVertices[_0x6aba('0xd')]['googleASR']=function(_0x1b9110,_0x3b50e1,_0x222ab4){scripts[_0x6aba('0x8e')](_0x3b50e1,_0x1b9110[_0x6aba('0x7a')],_0x1b9110[_0x6aba('0x8f')]||_0x6aba('0x81'))[_0x6aba('0x10')](function(_0x425d7a){_0x222ab4(null,_0x425d7a);})[_0x6aba('0x11')](function(_0xe8be61){_0x222ab4(_0xe8be61);});};AGIVertices['prototype'][_0x6aba('0x90')]=function(_0x2a85d7,_0xf0771e,_0x799816){scripts[_0x6aba('0x90')](_0xf0771e,_0x2a85d7[_0x6aba('0x91')],_0x2a85d7[_0x6aba('0x92')],_0x2a85d7[_0x6aba('0x70')])[_0x6aba('0x10')](function(_0x3bdd08){_0x799816(null,_0x3bdd08);})[_0x6aba('0x11')](function(_0x285953){_0x799816(_0x285953);});};AGIVertices[_0x6aba('0xd')][_0x6aba('0x93')]=function(_0x17f90b){var _0xda4bab=_[_0x6aba('0x67')](verticesWithRetry,_0x17f90b[_0x6aba('0x31')])?_0x17f90b:_['clone'](_0x17f90b);for(var _0x1aa64f in _0xda4bab){if(_0xda4bab[_0x6aba('0x94')](_0x1aa64f)){if(_0xda4bab[_0x1aa64f]&&_[_0x6aba('0x95')](_0xda4bab[_0x1aa64f])){if(_['includes'](recursiveMapAttributes,_0x1aa64f)){_0xda4bab[_0x1aa64f]=this[_0x6aba('0x96')](_0xda4bab[_0x1aa64f]);}else{_0xda4bab[_0x1aa64f]=this['replaceAllVariables'](_0xda4bab[_0x1aa64f]);}}}}return _0xda4bab;};AGIVertices[_0x6aba('0xd')]['recursiveNodeIndex']=function(_0x244c59){for(var _0x4860dc in _0x244c59){if(_0x244c59['hasOwnProperty'](_0x4860dc)){if(_['isPlainObject'](_0x244c59[_0x4860dc])){this[_0x6aba('0x97')](_0x244c59[_0x4860dc]);}else if(_['isArray'](_0x244c59[_0x4860dc])){for(var _0x4eb466=0x0;_0x4eb466<_0x244c59[_0x4860dc][_0x6aba('0x98')];_0x4eb466++){this['recursiveNodeIndex'](_0x244c59[_0x4860dc][_0x4eb466]);}}else if(_[_0x6aba('0x95')](_0x244c59[_0x4860dc])){_0x244c59[_0x4860dc]=this[_0x6aba('0x99')](_0x244c59[_0x4860dc]);}}}};AGIVertices['prototype'][_0x6aba('0x9a')]=function(_0x3aa68f,_0x543717){for(var _0x2639a3 in _0x3aa68f){if(_0x3aa68f['hasOwnProperty'](_0x2639a3)){if(_[_0x6aba('0x9b')](_0x3aa68f[_0x2639a3])){if(!_['isEmpty'](_0x3aa68f[_0x2639a3])){this['saveRestApiResult'](_0x3aa68f[_0x2639a3],util[_0x6aba('0x22')](_0x6aba('0x9c'),_0x543717,_0x2639a3));}}else if(_['isArray'](_0x3aa68f[_0x2639a3])){for(var _0x21b17b=0x0;_0x21b17b<_0x3aa68f[_0x2639a3][_0x6aba('0x98')];_0x21b17b++){this[_0x6aba('0x9a')](_0x3aa68f[_0x2639a3][_0x21b17b],util['format'](_0x6aba('0x9c'),_0x543717,_0x2639a3+'['+_0x21b17b+']'));}}else{if(!_[_0x6aba('0x3e')](_0x3aa68f[_0x2639a3])){this[_0x6aba('0xa')][_0x6aba('0x9d')](util[_0x6aba('0x22')](_0x6aba('0x9c'),_0x543717,_0x2639a3),_0x3aa68f[_0x2639a3]);}}}}};AGIVertices[_0x6aba('0xd')][_0x6aba('0x96')]=function(_0x1e6b6f){try{var _0x2b8b6f=JSON[_0x6aba('0x6a')](_0x1e6b6f);this[_0x6aba('0x97')](_0x2b8b6f);return JSON['stringify'](_0x2b8b6f);}catch(_0x243306){return this[_0x6aba('0x99')](_0x1e6b6f);}};AGIVertices['prototype'][_0x6aba('0x99')]=function(_0x2274f0){var _0x9acdf6=_0x2274f0['split']('{');for(var _0x5a40e2=0x1;_0x5a40e2<_0x9acdf6[_0x6aba('0x98')];_0x5a40e2+=0x1){var _0x445e1f=_0x9acdf6[_0x5a40e2][_0x6aba('0x9e')]('}');if(_0x445e1f[_0x6aba('0x98')]>0x1){_0x2274f0=_0x2274f0[_0x6aba('0x9f')]('{'+_0x445e1f[0x0]+'}',this[_0x6aba('0xa')][_0x6aba('0xe')](_0x445e1f[0x0])[_0x6aba('0xa0')]||_0x445e1f[0x0]);}}if(_0x9acdf6[_0x6aba('0x98')]===0x1){return _0x2274f0[_0x6aba('0xa1')]();}return this[_0x6aba('0x99')](_0x2274f0);};AGIVertices[_0x6aba('0xd')][_0x6aba('0xa2')]=function(_0x4dfbcf,_0x31ac4c){var _0x3d6818=this[_0x6aba('0xa')]['getVariable'](_0x4dfbcf);if(_0x3d6818['result']===-0x1){return _0x3d6818;}logger['info'](util[_0x6aba('0x22')](_0x6aba('0xa3'),_0x31ac4c,_0x3d6818[_0x6aba('0xa0')]));return this[_0x6aba('0xa')][_0x6aba('0x9d')](_0x31ac4c,_0x3d6818['extra']);};AGIVertices[_0x6aba('0xd')][_0x6aba('0x84')]=function(_0x56f0e7){return _0x56f0e7&&_0x56f0e7!=='0'&&_0x56f0e7!=='-1'&&_0x56f0e7!=='';};AGIVertices[_0x6aba('0xd')]['maxRetry']=function(_0x42ab5f){this[_0x6aba('0xa4')]['sync'](this,_0x42ab5f,'-');_0x42ab5f['retry']=_0x42ab5f[_0x6aba('0xa5')];return{'code':0xc8,'result':'-'};};AGIVertices[_0x6aba('0xd')][_0x6aba('0xa6')]=function(_0x3895a6){logger['info'](util[_0x6aba('0x22')](_0x6aba('0xa7'),_0x3895a6['label']));if(!this[_0x6aba('0x84')](_0x3895a6[_0x6aba('0x5d')])){return this[_0x6aba('0xa')][_0x6aba('0xa8')](_0x6aba('0xa9'));}var _0x2c4f47='\x22'+_0x3895a6[_0x6aba('0x5d')]+'\x22';if(this[_0x6aba('0x84')](_0x3895a6['options'])){_0x2c4f47+=','+_0x3895a6[_0x6aba('0x78')];}var _0x15beea=this[_0x6aba('0xa')][_0x6aba('0x59')]('MRCPSynth',_0x2c4f47);if(_0x15beea[_0x6aba('0xaa')]===-0x1){return _0x15beea;}return this[_0x6aba('0xa')]['noop'](util['format'](_0x6aba('0xab'),_0x2c4f47));};AGIVertices[_0x6aba('0xd')][_0x6aba('0xac')]=function(_0x2b989a){logger[_0x6aba('0x26')](util[_0x6aba('0x22')](_0x6aba('0xad'),_0x2b989a[_0x6aba('0x30')]));if(!this['isConfigured'](_0x2b989a['grammar'])){return this[_0x6aba('0xa')][_0x6aba('0xa8')](_0x6aba('0xae'));}var _0x5ad8ba=_0x2b989a[_0x6aba('0xaf')];if(this[_0x6aba('0x84')](_0x2b989a[_0x6aba('0x78')])){_0x5ad8ba+=','+_0x2b989a[_0x6aba('0x78')];}var _0x4d7b61=this[_0x6aba('0xa')][_0x6aba('0x59')](_0x6aba('0xb0'),_0x5ad8ba);if(_0x4d7b61[_0x6aba('0xaa')]===-0x1){return _0x4d7b61;}var _0x25ca08=this[_0x6aba('0xa2')]('RECOG_CONFIDENCE()',_0x6aba('0xb1'));if(_0x25ca08['result']===-0x1){return _0x25ca08;}var _0x6004d7=this['getAndSetVariable'](_0x6aba('0xb2'),_0x6aba('0xb3'));if(_0x6004d7[_0x6aba('0xaa')]===-0x1){return _0x6004d7;}var _0x6bcdd4=this[_0x6aba('0xa2')](_0x6aba('0xb4'),_0x6aba('0xb5'));if(_0x6bcdd4[_0x6aba('0xaa')]===-0x1){return _0x6bcdd4;}return this[_0x6aba('0xa')][_0x6aba('0xa8')](util[_0x6aba('0x22')]('Executed\x20command\x20MRCPRecog\x20%s',_0x5ad8ba));};AGIVertices[_0x6aba('0xd')][_0x6aba('0x5')]=function(_0x2f3867){logger[_0x6aba('0x26')](util[_0x6aba('0x22')]('Enter\x20in\x20AGI\x20(%s)\x20block',_0x2f3867['label']));return this[_0x6aba('0xa')][_0x6aba('0x5')]([_0x2f3867[_0x6aba('0xb6')],_0x2f3867[_0x6aba('0xb7')]]);};AGIVertices[_0x6aba('0xd')][_0x6aba('0xb8')]=function(_0x41e303){logger['info'](util[_0x6aba('0x22')](_0x6aba('0xb9'),_0x41e303[_0x6aba('0x30')]));if(this[_0x6aba('0x84')](_0x41e303[_0x6aba('0x66')])){logger[_0x6aba('0x26')](util[_0x6aba('0x22')](_0x6aba('0xba'),_0x41e303[_0x6aba('0x66')]));var _0x3d2b3b=this[_0x6aba('0xa')][_0x6aba('0xbb')](_0x41e303[_0x6aba('0x66')]);if(_0x3d2b3b[_0x6aba('0xaa')]===-0x1){return _0x3d2b3b;}}return this[_0x6aba('0xa')][_0x6aba('0xb8')]();};AGIVertices[_0x6aba('0xd')][_0x6aba('0x43')]=function(_0x1604ff){logger[_0x6aba('0x26')](util[_0x6aba('0x22')]('Enter\x20in\x20CALLBACK\x20(%s)\x20block',_0x1604ff['label']));if(!this[_0x6aba('0x84')](_0x1604ff[_0x6aba('0x41')])){return this[_0x6aba('0xa')][_0x6aba('0x25')](_0x1604ff,'no\x20list\x20selected');}_0x1604ff['scheduledAt']=moment();if(this['isConfigured'](_0x1604ff[_0x6aba('0xbc')])){_0x1604ff[_0x6aba('0x42')]=moment()[_0x6aba('0x4c')](_0x1604ff[_0x6aba('0xbc')],_0x6aba('0x4d'));}if(!this[_0x6aba('0x84')](_0x1604ff[_0x6aba('0x44')])){_0x1604ff['callback_priority']=0x2;}this['createCmContact'][_0x6aba('0x6f')](this,_0x1604ff);return this[_0x6aba('0xa')][_0x6aba('0xa8')](util[_0x6aba('0x22')](_0x6aba('0xbd'),_0x1604ff['phone'],_0x1604ff[_0x6aba('0x41')],_0x1604ff[_0x6aba('0x42')]));};AGIVertices[_0x6aba('0xd')][_0x6aba('0xbe')]=function(_0x438154){logger[_0x6aba('0x26')](util['format']('Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block',_0x438154[_0x6aba('0x30')]));var _0x200371=this['channel'][_0x6aba('0x59')](_0x438154['application'],_0x438154[_0x6aba('0x78')]);if(_0x200371[_0x6aba('0xaa')]===-0x1){return _0x200371;}return this[_0x6aba('0xa')][_0x6aba('0xa8')](util['format']('Executed\x20command\x20%s\x20%s',_0x438154[_0x6aba('0xbf')],_0x438154[_0x6aba('0x78')]));};AGIVertices[_0x6aba('0xd')]['lumenvoxtts']=function(_0x40af32){logger[_0x6aba('0x26')](util[_0x6aba('0x22')](_0x6aba('0xc0'),_0x40af32[_0x6aba('0x30')]));if(!this[_0x6aba('0x84')](_0x40af32['text'])){return this['channel']['noop']('no\x20text\x20configured');}var _0x5ee1c9='\x22'+_0x40af32[_0x6aba('0x5d')]+'\x22';if(this[_0x6aba('0x84')](_0x40af32[_0x6aba('0x78')])){_0x5ee1c9+=','+_0x40af32[_0x6aba('0x78')];}var _0x75bfb4=this['channel']['exec'](_0x6aba('0xc1'),_0x5ee1c9);if(_0x75bfb4[_0x6aba('0xaa')]===-0x1){return _0x75bfb4;}return this[_0x6aba('0xa')]['noop'](util[_0x6aba('0x22')](_0x6aba('0xab'),_0x5ee1c9));};AGIVertices['prototype'][_0x6aba('0xc2')]=function(_0x114531){logger[_0x6aba('0x26')](util[_0x6aba('0x22')](_0x6aba('0xc3'),_0x114531['label']));if(!this['isConfigured'](_0x114531['text'])){return this[_0x6aba('0xa')][_0x6aba('0xa8')](_0x6aba('0xa9'));}var _0x377849='\x22'+_0x114531[_0x6aba('0x5d')]+'\x22';if(this[_0x6aba('0x84')](_0x114531[_0x6aba('0x78')])){_0x377849+=','+_0x114531[_0x6aba('0x78')];}var _0x1d8842=this['channel'][_0x6aba('0x59')](_0x6aba('0xc1'),_0x377849);if(_0x1d8842['result']===-0x1){return _0x1d8842;}return this[_0x6aba('0xa')][_0x6aba('0xa8')](util[_0x6aba('0x22')](_0x6aba('0xab'),_0x377849));};AGIVertices['prototype']['lumenvoxasr']=function(_0x293826){logger[_0x6aba('0x26')](util['format'](_0x6aba('0xc4'),_0x293826['label']));if(!this[_0x6aba('0x84')](_0x293826[_0x6aba('0xaf')])){return this[_0x6aba('0xa')][_0x6aba('0xa8')]('no\x20grammar\x20configured');}var _0x43d5b3=_0x293826[_0x6aba('0xaf')];if(this[_0x6aba('0x84')](_0x293826[_0x6aba('0x78')])){_0x43d5b3+=','+_0x293826[_0x6aba('0x78')];}var _0x4bf13f=this[_0x6aba('0xa')]['exec'](_0x6aba('0xb0'),_0x43d5b3);if(_0x4bf13f[_0x6aba('0xaa')]===-0x1){return _0x4bf13f;}var _0x54261d=this['getAndSetVariable']('RECOG_CONFIDENCE()',_0x6aba('0xc5'));if(_0x54261d['result']===-0x1){return _0x54261d;}var _0x2b394f=this[_0x6aba('0xa2')](_0x6aba('0xb2'),'LUMENVOX_ASR_TRANSCRIPT');if(_0x2b394f[_0x6aba('0xaa')]===-0x1){return _0x2b394f;}var _0x232b13=this[_0x6aba('0xa2')](_0x6aba('0xb4'),_0x6aba('0xc6'));if(_0x232b13['result']===-0x1){return _0x232b13;}return this['channel']['noop'](util['format'](_0x6aba('0xc7'),_0x43d5b3));};AGIVertices[_0x6aba('0xd')]['sestekasr']=function(_0x4b0289){logger[_0x6aba('0x26')](util[_0x6aba('0x22')](_0x6aba('0xc8'),_0x4b0289[_0x6aba('0x30')]));if(!this[_0x6aba('0x84')](_0x4b0289[_0x6aba('0xaf')])){return this[_0x6aba('0xa')][_0x6aba('0xa8')](_0x6aba('0xae'));}var _0x3db6ad=_0x4b0289[_0x6aba('0xaf')];if(this[_0x6aba('0x84')](_0x4b0289[_0x6aba('0x78')])){_0x3db6ad+=','+_0x4b0289['options'];}var _0x2a53c5=this[_0x6aba('0xa')][_0x6aba('0x59')]('MRCPRecog',_0x3db6ad);if(_0x2a53c5[_0x6aba('0xaa')]===-0x1){return _0x2a53c5;}var _0x7ea7d4=this[_0x6aba('0xa2')](_0x6aba('0xc9'),_0x6aba('0xca'));if(_0x7ea7d4[_0x6aba('0xaa')]===-0x1){return _0x7ea7d4;}var _0x24f67e=this[_0x6aba('0xa2')](_0x6aba('0xb2'),_0x6aba('0xcb'));if(_0x24f67e[_0x6aba('0xaa')]===-0x1){return _0x24f67e;}var _0x2a334e=this[_0x6aba('0xa2')](_0x6aba('0xb4'),_0x6aba('0xcc'));if(_0x2a334e['result']===-0x1){return _0x2a334e;}return this[_0x6aba('0xa')][_0x6aba('0xa8')](util[_0x6aba('0x22')](_0x6aba('0xc7'),_0x3db6ad));};AGIVertices['prototype']['database']=function(_0xfea53d){logger[_0x6aba('0x26')](util[_0x6aba('0x22')]('Enter\x20in\x20DATABASE\x20(%s)\x20block',_0xfea53d[_0x6aba('0x30')]));if(!this[_0x6aba('0x84')](_0xfea53d[_0x6aba('0xcd')])){return this[_0x6aba('0xa')][_0x6aba('0x25')](_0xfea53d,_0x6aba('0xce'));}var _0x391d27=this[_0x6aba('0xcf')][_0x6aba('0x6f')](this,_0xfea53d[_0x6aba('0xcd')]);if(!_0x391d27){return this['channel']['error'](_0xfea53d,_0x6aba('0xd0'));}if(!this[_0x6aba('0x84')](_0xfea53d[_0x6aba('0x28')])){return this['channel'][_0x6aba('0x25')](_0xfea53d,'no\x20query\x20configured');}var _0x285896=_0xfea53d[_0x6aba('0x28')][_0x6aba('0xd1')](/(\r\n|\n|\r)/gm,'\x20');this[_0x6aba('0xa')]['noop'](util[_0x6aba('0x22')](_0x6aba('0xd2'),_0x285896));var _0x53d232=this[_0x6aba('0x24')]['sync'](this,_0x391d27,_0x285896);this[_0x6aba('0xa4')][_0x6aba('0x6f')](this,_0xfea53d,_0x285896);if(!this[_0x6aba('0x84')](_0xfea53d[_0x6aba('0xd3')])){return this[_0x6aba('0xa')][_0x6aba('0xa8')](_0x6aba('0xd4'));}var _0x38a270=this['getVariable']['sync'](this,_0xfea53d[_0x6aba('0xd3')]);if(!_0x38a270){return this['channel'][_0x6aba('0x25')](_0xfea53d,_0x6aba('0xd5'));}var _0x21e792=this;_0x53d232[_0x6aba('0xd6')](function(_0x411fa4,_0x15c05d){Object[_0x6aba('0xd7')](_0x411fa4)[_0x6aba('0xd6')](function(_0x40c33b){_0x21e792[_0x6aba('0xa')][_0x6aba('0x9d')](util[_0x6aba('0x22')](_0x6aba('0xd8'),_0x38a270,_0x15c05d,_0x40c33b),_0x411fa4[_0x40c33b]);});});this[_0x6aba('0xa')][_0x6aba('0x9d')](util[_0x6aba('0x22')](_0x6aba('0xd9'),_0x38a270),_0x53d232[_0x6aba('0x98')]);return this[_0x6aba('0xa')][_0x6aba('0xa8')](util[_0x6aba('0x22')](_0x6aba('0xda'),_0x38a270));};AGIVertices['prototype'][_0x6aba('0xdb')]=function(_0x275644){logger[_0x6aba('0xdc')](util[_0x6aba('0x22')]('Enter\x20in\x20DIAL\x20(%s)\x20block',_0x275644[_0x6aba('0x30')]));if(!this['isConfigured'](_0x275644['sip_id'])){return this[_0x6aba('0xa')][_0x6aba('0x25')](_0x275644,_0x6aba('0xdd'));}var _0x234ca6=this[_0x6aba('0x18')][_0x6aba('0x6f')](this,_0x275644[_0x6aba('0xde')]);if(!_0x234ca6){return this[_0x6aba('0xa')][_0x6aba('0x25')](_0x275644,_0x6aba('0xdf'));}var _0x59367f=this[_0x6aba('0xa')][_0x6aba('0x59')](_0x6aba('0xe0'),[util[_0x6aba('0x22')](_0x6aba('0xe1'),_0x234ca6),_0x275644['timeout'],_0x275644[_0x6aba('0xe2')],_0x275644[_0x6aba('0x63')]]);if(_0x59367f[_0x6aba('0xaa')]===-0x1){return _0x59367f;}return this[_0x6aba('0xa')][_0x6aba('0xa8')](util['format'](_0x6aba('0xe3'),'DIAL'));};AGIVertices[_0x6aba('0xd')][_0x6aba('0xe4')]=function(_0x236e3e){logger[_0x6aba('0x26')](util[_0x6aba('0x22')]('Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block',_0x236e3e[_0x6aba('0x30')]));if(!this['isConfigured'](_0x236e3e[_0x6aba('0x7a')])){return this[_0x6aba('0xa')]['noop'](_0x6aba('0xe5'));}if(!this[_0x6aba('0x84')](_0x236e3e[_0x6aba('0x5d')])){return this[_0x6aba('0xa')][_0x6aba('0xa8')](_0x6aba('0xa9'));}this[_0x6aba('0xa')][_0x6aba('0xe6')]=!![];this['createSquareDetailsReport'](_0x236e3e);this[_0x6aba('0x3c')](_0x236e3e[_0x6aba('0x5d')],'in','','');this[_0x6aba('0xa')][_0x6aba('0xa8')](util[_0x6aba('0x22')]('Trying\x20Dialogflow:\x20%s',_0x236e3e['text']));var _0x4cfffa=this[_0x6aba('0x79')][_0x6aba('0x6f')](this,_0x236e3e);if(_0x4cfffa){for(var _0x39af3c in _0x4cfffa){if(_0x4cfffa[_0x6aba('0x94')](_0x39af3c)){this[_0x6aba('0xa')][_0x6aba('0x9d')](util[_0x6aba('0x22')](_0x6aba('0xe7'),_0x39af3c['toUpperCase']()),_0x4cfffa[_0x39af3c]);}}this[_0x6aba('0x3c')](_0x4cfffa[_0x6aba('0xe8')],_0x6aba('0xe9'),_0x6aba('0xe4'),'');return this[_0x6aba('0xa')][_0x6aba('0xa8')](util['format'](_0x6aba('0xea'),_0x4cfffa[_0x6aba('0xe8')]));}return this[_0x6aba('0xa')][_0x6aba('0x25')](_0x236e3e,_0x6aba('0xeb'));};AGIVertices['prototype'][_0x6aba('0xec')]=function(_0x353bdf){logger[_0x6aba('0x26')](util[_0x6aba('0x22')](_0x6aba('0xed'),_0x353bdf[_0x6aba('0x30')]));if(!this[_0x6aba('0x84')](_0x353bdf[_0x6aba('0x7d')])){return this[_0x6aba('0xa')]['noop'](_0x6aba('0xee'));}if(!this[_0x6aba('0x84')](_0x353bdf[_0x6aba('0xef')])){return this[_0x6aba('0xa')][_0x6aba('0xa8')](_0x6aba('0xf0'));}if(!this[_0x6aba('0x84')](_0x353bdf['private_key'])){return this[_0x6aba('0xa')][_0x6aba('0xa8')](_0x6aba('0xf1'));}if(!this['isConfigured'](_0x353bdf['dialogflowV2_language'])){return this[_0x6aba('0xa')][_0x6aba('0xa8')]('no\x20anguage\x20configured');}if(!this[_0x6aba('0x84')](_0x353bdf[_0x6aba('0x5d')])){return this[_0x6aba('0xa')]['noop'](_0x6aba('0xa9'));}this[_0x6aba('0xa')][_0x6aba('0xe6')]=!![];this['createSquareDetailsReport'](_0x353bdf);this[_0x6aba('0x3c')](_0x353bdf['text'],'in','','');this['channel'][_0x6aba('0xa8')](util['format'](_0x6aba('0xf2'),_0x353bdf[_0x6aba('0x5d')]));var _0x27dcca=this[_0x6aba('0x7c')][_0x6aba('0x6f')](this,_0x353bdf);if(_0x27dcca){for(var _0x3ef5ce in _0x27dcca){if(_0x27dcca['hasOwnProperty'](_0x3ef5ce)){if(_0x3ef5ce!==_0x6aba('0xf3')){this['channel'][_0x6aba('0x9d')](util[_0x6aba('0x22')]('DIALOGFLOW_%s',_0x3ef5ce[_0x6aba('0xf4')]()),_0x27dcca[_0x3ef5ce]);}}}this['createSquareMessage'](_0x27dcca[_0x6aba('0xe8')],_0x6aba('0xe9'),_0x6aba('0xec'),_0x27dcca['providerResponse']);return this['channel'][_0x6aba('0xa8')](util[_0x6aba('0x22')]('DialogflowV2\x20Result\x20%s',_0x27dcca[_0x6aba('0xe8')]));}return this[_0x6aba('0xa')][_0x6aba('0x25')](_0x353bdf,_0x6aba('0xf5'));};AGIVertices[_0x6aba('0xd')][_0x6aba('0xf6')]=function(_0x38b55d){logger[_0x6aba('0x26')](util['format'](_0x6aba('0xf7'),_0x38b55d['label']));if(!this['isConfigured'](_0x38b55d[_0x6aba('0xf8')])){return this[_0x6aba('0xa')][_0x6aba('0xa8')](_0x6aba('0xf9'));}if(!this[_0x6aba('0x84')](_0x38b55d[_0x6aba('0xfa')])){return this[_0x6aba('0xa')][_0x6aba('0xa8')]('no\x20username\x20configured');}if(!this[_0x6aba('0x84')](_0x38b55d[_0x6aba('0xfb')])){return this['channel']['noop'](_0x6aba('0xfc'));}if(!this[_0x6aba('0x84')](_0x38b55d[_0x6aba('0xfd')])){return this['channel']['noop'](_0x6aba('0xa9'));}this[_0x6aba('0xa')][_0x6aba('0xe6')]=!![];this[_0x6aba('0xa4')](_0x38b55d);this[_0x6aba('0x3c')](_0x38b55d[_0x6aba('0x5d')],'in','','');this[_0x6aba('0xa')][_0x6aba('0xa8')](util['format'](_0x6aba('0xfe'),_0x38b55d[_0x6aba('0x5d')]));var _0xd5f003=this[_0x6aba('0x7f')][_0x6aba('0x6f')](this,_0x38b55d);if(_0xd5f003){for(var _0x1c07ab in _0xd5f003){if(_0xd5f003['hasOwnProperty'](_0x1c07ab)){this['channel'][_0x6aba('0x9d')](util[_0x6aba('0x22')](_0x6aba('0xff'),_0x1c07ab[_0x6aba('0xf4')]()),_0xd5f003[_0x1c07ab]);}}this[_0x6aba('0x3c')](_0xd5f003[_0x6aba('0xe8')],_0x6aba('0xe9'),_0x6aba('0xf6'),'');if(_0xd5f003[_0x6aba('0x100')]){this[_0x6aba('0xa')]['noop'](util[_0x6aba('0x22')](_0x6aba('0x101'),_0xd5f003[_0x6aba('0x100')]));var _0x41cda1=this[_0x6aba('0xa')][_0x6aba('0x102')](_0xd5f003[_0x6aba('0x100')]);try{fs['unlink'](_0xd5f003[_0x6aba('0x100')]+_0x6aba('0x103'));}catch(_0x317a1e){logger[_0x6aba('0x25')](_0x317a1e);}return _0x41cda1;}else{return this[_0x6aba('0xa')][_0x6aba('0xa8')](util['format'](_0x6aba('0x104'),_0xd5f003['speech']));}}return this[_0x6aba('0xa')][_0x6aba('0x25')](_0x38b55d,_0x6aba('0x105'));};AGIVertices[_0x6aba('0xd')]['end']=function(_0x4f62aa){logger['info'](util['format']('Enter\x20in\x20END\x20(%s)\x20block',_0x4f62aa[_0x6aba('0x30')]));return this[_0x6aba('0xa')][_0x6aba('0xa8')](_0x6aba('0x106'));};AGIVertices[_0x6aba('0xd')][_0x6aba('0x107')]=function(_0x27635e){logger['info'](util['format']('Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block',_0x27635e[_0x6aba('0x30')]));var _0x1977c7='';if(_0x27635e[_0x6aba('0x108')]){if(!this[_0x6aba('0x84')](_0x27635e['trunk_id'])){return this[_0x6aba('0xa')][_0x6aba('0x25')](_0x27635e,_0x6aba('0x109'));}else{var _0x527f31=parseInt(_0x27635e[_0x6aba('0x108')],0xa);if(isNaN(_0x527f31)){_0x1977c7=_0x27635e[_0x6aba('0x108')];}else{_0x1977c7=this['getTrunk'][_0x6aba('0x6f')](this,_0x27635e[_0x6aba('0x108')]);if(!_0x1977c7){return this[_0x6aba('0xa')][_0x6aba('0x25')](_0x27635e,_0x6aba('0x10a'));}}}}else if(_0x27635e['trunk_name']){_0x1977c7=_0x27635e[_0x6aba('0x10b')];}else{return this[_0x6aba('0xa')]['error'](_0x27635e,_0x6aba('0x109'));}var _0x3becaa=this[_0x6aba('0xa')][_0x6aba('0x59')](_0x6aba('0xe0'),[util['format']('SIP/%s/%s',_0x1977c7,_0x27635e['phone']),_0x27635e[_0x6aba('0x66')],_0x27635e[_0x6aba('0xe2')],_0x27635e[_0x6aba('0x63')]]);if(_0x3becaa['result']===-0x1){return _0x3becaa;}return this[_0x6aba('0xa')]['noop'](util['format'](_0x6aba('0xe3'),_0x6aba('0xe0')));};AGIVertices['prototype'][_0x6aba('0x10c')]=function(_0x3e6720){logger[_0x6aba('0x26')](util['format']('Enter\x20in\x20FINALLY\x20(%s)\x20block',_0x3e6720[_0x6aba('0x30')]));return this[_0x6aba('0xa')]['noop'](_0x6aba('0x10c'));};AGIVertices['prototype'][_0x6aba('0x10d')]=function(_0x2aeac3){logger[_0x6aba('0x26')](util[_0x6aba('0x22')](_0x6aba('0x10e'),_0x2aeac3['label']));if(_0x2aeac3[_0x6aba('0x10f')]===0x0){return this[_0x6aba('0xa5')](_0x2aeac3);}_0x2aeac3[_0x6aba('0x10f')]-=0x1;if(!this[_0x6aba('0x84')](_0x2aeac3[_0x6aba('0x110')])){return this[_0x6aba('0xa')][_0x6aba('0x25')](_0x2aeac3,'no\x20file\x20audio\x20selected');}var _0x27f970=this['getSound'][_0x6aba('0x6f')](this,_0x2aeac3[_0x6aba('0x110')]);if(!_0x27f970){return this[_0x6aba('0xa')][_0x6aba('0x25')](_0x2aeac3,_0x6aba('0x111'));}if(!this[_0x6aba('0x84')](_0x2aeac3[_0x6aba('0xd3')])){return this['channel']['error'](_0x6aba('0xd4'));}var _0x2c6526=this[_0x6aba('0xa')][_0x6aba('0x112')](_0x27f970,_0x2aeac3[_0x6aba('0x113')],_0x2aeac3[_0x6aba('0x114')]);var _0x3aa555=_0x2c6526[_0x6aba('0xaa')]?_0x2c6526['result'][_0x6aba('0xa1')]():'';logger[_0x6aba('0x26')](_0x6aba('0x115'),JSON[_0x6aba('0x72')](_0x2c6526));if(_0x2c6526[_0x6aba('0xaa')]===-0x1){this['createSquareDetailsReport'][_0x6aba('0x6f')](this,_0x2aeac3,_0x3aa555);return _0x2c6526;}else if(_0x2c6526[_0x6aba('0xa0')]===_0x6aba('0x66')){_0x2c6526[_0x6aba('0xaa')]=_0x3aa555[_0x6aba('0x98')]>=parseInt(_0x2aeac3[_0x6aba('0x116')])?'x':'i';}else{_0x2c6526['result']=_0x3aa555['length']>=parseInt(_0x2aeac3[_0x6aba('0x116')])&&_0x3aa555[_0x6aba('0x98')]<=parseInt(_0x2aeac3[_0x6aba('0x114')])?'x':'i';}var _0x2548f2=this[_0x6aba('0xe')][_0x6aba('0x6f')](this,_0x2aeac3[_0x6aba('0xd3')]);if(!_0x2548f2){return this['channel'][_0x6aba('0x25')](_0x2aeac3,_0x6aba('0xd5'));}this[_0x6aba('0xa')][_0x6aba('0x9d')](_0x2548f2,_0x3aa555);if(this[_0x6aba('0x84')](_0x2aeac3[_0x6aba('0x117')])){var _0x37e8b4=parseInt(_0x2aeac3[_0x6aba('0x117')],0xa);var _0x20e16d=rs[_0x6aba('0x118')]({'charset':'*','length':_0x37e8b4});var _0x4fe948=_0x3aa555['length'];if(_0x4fe948>0x0){if(_0x4fe948>_0x37e8b4){this[_0x6aba('0xa4')]['sync'](this,_0x2aeac3,_0x2aeac3['hiddendigitspos']==='first'?_0x20e16d+_0x3aa555[_0x6aba('0x119')](_0x37e8b4):_0x3aa555[_0x6aba('0x119')](0x0,_0x4fe948-_0x37e8b4)+_0x20e16d);}else{this[_0x6aba('0xa4')][_0x6aba('0x6f')](this,_0x2aeac3,rs[_0x6aba('0x118')]({'charset':'*','length':_0x4fe948}));}}else{this[_0x6aba('0xa4')]['sync'](this,_0x2aeac3,'');}}else{this['createSquareDetailsReport']['sync'](this,_0x2aeac3,_0x3aa555);}return _0x2c6526;};AGIVertices['prototype']['getsecretdigits']=function(_0x300bfd){logger['info'](util[_0x6aba('0x22')]('Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block',_0x300bfd['label']));return this['getdigits'](_0x300bfd);};AGIVertices[_0x6aba('0xd')][_0x6aba('0x11a')]=function(_0x4ff8fd){logger['info'](util['format'](_0x6aba('0x11b'),_0x4ff8fd['label']));this[_0x6aba('0xa4')][_0x6aba('0x6f')](this,_0x4ff8fd,_0x4ff8fd[_0x6aba('0x11c')]);return this['channel'][_0x6aba('0xa8')](util[_0x6aba('0x22')]('GOAL\x20%s',_0x4ff8fd[_0x6aba('0x11c')]));};AGIVertices[_0x6aba('0xd')]['awspolly']=function(_0x4b144e){logger[_0x6aba('0x26')](util[_0x6aba('0x22')]('[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block',_0x4b144e[_0x6aba('0x30')]));if(!this[_0x6aba('0x84')](_0x4b144e['aws_access_key_id'])||!this['isConfigured'](_0x4b144e[_0x6aba('0x88')])){return this[_0x6aba('0xa')][_0x6aba('0xa8')](_0x6aba('0x11d'));}if(!this[_0x6aba('0x84')](_0x4b144e['text'])){return this[_0x6aba('0xa')][_0x6aba('0xa8')](_0x6aba('0xa9'));}this['channel'][_0x6aba('0xa8')](util[_0x6aba('0x22')](_0x6aba('0x11e'),_0x4b144e[_0x6aba('0x5d')]));var _0x46dfa6=this[_0x6aba('0x86')][_0x6aba('0x6f')](this,_0x4b144e);if(_0x46dfa6){this[_0x6aba('0xa')][_0x6aba('0xa8')](util[_0x6aba('0x22')](_0x6aba('0x11f'),_0x46dfa6));var _0xb5f5d5=this[_0x6aba('0xa')][_0x6aba('0x102')](_0x46dfa6);try{fs['unlink'](_0x46dfa6+'.wav');}catch(_0x1827fd){logger[_0x6aba('0x25')](_0x1827fd);}return _0xb5f5d5;}return this[_0x6aba('0xa')]['error'](_0x4b144e,_0x6aba('0x120'));};AGIVertices[_0x6aba('0xd')][_0x6aba('0x121')]=function(_0x32b271){logger[_0x6aba('0x26')](util[_0x6aba('0x22')](_0x6aba('0x122'),_0x32b271[_0x6aba('0x30')]));if(!this[_0x6aba('0x84')](_0x32b271[_0x6aba('0x87')])||!this[_0x6aba('0x84')](_0x32b271['aws_secret_access_key'])){return this['channel'][_0x6aba('0xa8')](_0x6aba('0x11d'));}if(!this['isConfigured'](_0x32b271[_0x6aba('0x8d')])){return this['channel']['noop'](_0x6aba('0x123'));}if(!this[_0x6aba('0x84')](_0x32b271[_0x6aba('0x5d')])){return this[_0x6aba('0xa')]['noop'](_0x6aba('0xa9'));}this[_0x6aba('0xa')]['bot']=!![];this[_0x6aba('0xa4')](_0x32b271);this[_0x6aba('0x3c')](_0x32b271['text'],'in','','');this['channel'][_0x6aba('0xa8')](util[_0x6aba('0x22')](_0x6aba('0x124'),_0x32b271['text']));var _0xd296aa=this[_0x6aba('0x8b')]['sync'](this,_0x32b271);if(_0xd296aa){for(var _0x1ba63d in _0xd296aa){if(_0xd296aa[_0x6aba('0x94')](_0x1ba63d)&&_[_0x6aba('0x95')](_0xd296aa[_0x1ba63d])){this[_0x6aba('0xa')]['setVariable'](util[_0x6aba('0x22')](_0x6aba('0x125'),_0x1ba63d[_0x6aba('0xf4')]()),_0xd296aa[_0x1ba63d]);}}if(_[_0x6aba('0x3e')](_0xd296aa[_0x6aba('0x76')])){return this['channel'][_0x6aba('0xa8')](_0x6aba('0x126'));}else{this['createSquareMessage'](_0xd296aa[_0x6aba('0x76')],'out',_0x6aba('0x127'),'');return this[_0x6aba('0xa')]['noop'](util[_0x6aba('0x22')](_0x6aba('0x128'),_0xd296aa[_0x6aba('0x76')]));}}return this[_0x6aba('0xa')][_0x6aba('0x25')](_0x32b271,_0x6aba('0x129'));};AGIVertices[_0x6aba('0xd')][_0x6aba('0x12a')]=function(_0x4d0bbc){logger[_0x6aba('0x26')](util[_0x6aba('0x22')](_0x6aba('0x12b'),_0x4d0bbc[_0x6aba('0x30')],_0x4d0bbc['timeout']));if(!this[_0x6aba('0x84')](_0x4d0bbc['key'])){return this[_0x6aba('0xa')][_0x6aba('0xa8')](_0x6aba('0xe5'));}var _0x302c0f=_0x6aba('0x12c');var _0x28f796=util['format'](_0x6aba('0x12d'),FILES_PATH,rs[_0x6aba('0x118')](0x4));var _0x43a0b1=util[_0x6aba('0x22')](_0x6aba('0x9c'),_0x28f796,_0x302c0f);var _0x345a32=!![];if(_0x4d0bbc[_0x6aba('0x12e')]===_0x6aba('0x12f')){_0x345a32=![];}var _0x1a04dc=this[_0x6aba('0xa')][_0x6aba('0x130')](_0x28f796,_0x302c0f,_0x4d0bbc[_0x6aba('0x131')],_0x4d0bbc[_0x6aba('0x66')],undefined,_0x345a32);if(_0x1a04dc['result']!==-0x1){this[_0x6aba('0xa')][_0x6aba('0xa8')](util[_0x6aba('0x22')](_0x6aba('0x132'),_0x43a0b1));var _0x3cfaee=this['googleASR']['sync'](this,_0x4d0bbc,_0x43a0b1);if(_0x3cfaee){for(var _0x99bd11 in _0x3cfaee){if(_0x3cfaee[_0x6aba('0x94')](_0x99bd11)){this[_0x6aba('0xa')][_0x6aba('0x9d')](util['format'](_0x6aba('0x133'),_0x99bd11['toUpperCase']()),_0x3cfaee[_0x99bd11]);}}return this['channel']['noop'](util['format'](_0x6aba('0x134'),JSON['stringify'](_0x3cfaee)));}}return _0x1a04dc;};AGIVertices['prototype'][_0x6aba('0x135')]=function(_0x366972){logger[_0x6aba('0x26')](util['format'](_0x6aba('0x136'),_0x366972[_0x6aba('0x30')]));if(!this[_0x6aba('0x84')](_0x366972['appid'])){return this['channel'][_0x6aba('0xa8')]('no\x20appid\x20configured');}if(!this['isConfigured'](_0x366972['appsecret'])){return this[_0x6aba('0xa')][_0x6aba('0xa8')](_0x6aba('0x137'));}var _0x343cc6=_0x6aba('0x12c');var _0x1aa9d7=util[_0x6aba('0x22')]('%s/recordings/%s',FILES_PATH,rs['generate'](0x4));var _0x3e0715=util[_0x6aba('0x22')](_0x6aba('0x9c'),_0x1aa9d7,_0x343cc6);var _0x4cad45=!![];if(_0x366972[_0x6aba('0x12e')]===_0x6aba('0x12f')){_0x4cad45=![];}var _0x464c74=this[_0x6aba('0xa')][_0x6aba('0x130')](_0x1aa9d7,_0x343cc6,_0x366972['intKey'],_0x366972[_0x6aba('0x66')],undefined,_0x4cad45);if(_0x464c74[_0x6aba('0xaa')]!==-0x1){this[_0x6aba('0xa')][_0x6aba('0xa8')](util[_0x6aba('0x22')]('tilde\x20%s\x20file\x20created',_0x3e0715));var _0xf39d77=this['tildeASR']['sync'](this,_0x366972,_0x3e0715);if(_0xf39d77){for(var _0x1d4284 in _0xf39d77){if(_0xf39d77[_0x6aba('0x94')](_0x1d4284)){this[_0x6aba('0xa')][_0x6aba('0x9d')](util[_0x6aba('0x22')](_0x6aba('0x138'),_0x1d4284[_0x6aba('0xf4')]()),_0xf39d77[_0x1d4284]);}}return this[_0x6aba('0xa')][_0x6aba('0xa8')](util['format'](_0x6aba('0x139'),JSON['stringify'](_0xf39d77)));}}return _0x464c74;};AGIVertices[_0x6aba('0xd')][_0x6aba('0x13a')]=function(_0x4d766e){logger[_0x6aba('0x26')](util[_0x6aba('0x22')]('Enter\x20in\x20GOTO\x20(%s)\x20block',_0x4d766e['label']));return this[_0x6aba('0xa')]['continueAt'](_0x4d766e[_0x6aba('0x35')],_0x4d766e[_0x6aba('0x36')],_0x4d766e[_0x6aba('0x37')]);};AGIVertices[_0x6aba('0xd')][_0x6aba('0x13b')]=function(_0x10622c){logger[_0x6aba('0x26')](util[_0x6aba('0x22')](_0x6aba('0x13c'),_0x10622c[_0x6aba('0x30')]));if(!this['isConfigured'](_0x10622c[_0x6aba('0x13d')])){return this[_0x6aba('0xa')][_0x6aba('0x25')](_0x10622c,_0x6aba('0x13e'));}try{var _0x1d6c43=eval(_0x10622c[_0x6aba('0x13d')])?'true':_0x6aba('0x13f');this['channel'][_0x6aba('0xa8')](util['format'](_0x6aba('0x140'),_0x10622c[_0x6aba('0x13d')],_0x1d6c43));return{'code':0xc8,'result':_0x1d6c43};}catch(_0x10c807){return{'code':0xc8,'result':_0x6aba('0x13f')};}};AGIVertices[_0x6aba('0xd')][_0x6aba('0x141')]=function(_0x3257e7){logger[_0x6aba('0x26')](util[_0x6aba('0x22')](_0x6aba('0x142'),_0x3257e7[_0x6aba('0x30')]));if(!this[_0x6aba('0x84')](_0x3257e7[_0x6aba('0x143')])){return this[_0x6aba('0xa')]['error'](_0x3257e7,_0x6aba('0x144'));}var _0x5e2752=this[_0x6aba('0x145')][_0x6aba('0x6f')](this,_0x3257e7[_0x6aba('0x143')]);if(!_0x5e2752){return this[_0x6aba('0xa')][_0x6aba('0x25')](_0x3257e7,_0x6aba('0x146'));}for(var _0x1358fa=0x0;_0x1358fa<_0x5e2752[_0x6aba('0x98')];_0x1358fa+=0x1){var _0x4e9fe5=this[_0x6aba('0xa')]['getVariable'](util['format']('IFTIME(%s?true:false)',_0x5e2752[_0x1358fa]));if(_0x4e9fe5[_0x6aba('0xaa')]===-0x1){return _0x4e9fe5;}logger[_0x6aba('0x26')](util['format'](_0x6aba('0x147'),_0x5e2752[_0x1358fa],_0x4e9fe5['extra']));if(_0x4e9fe5[_0x6aba('0xa0')]===_0x6aba('0x148')){logger[_0x6aba('0x26')](util['format'](_0x6aba('0x147'),_0x5e2752[_0x1358fa],_0x6aba('0x148')));this['channel']['noop'](util['format'](_0x6aba('0x147'),_0x5e2752[_0x1358fa],_0x6aba('0x148')));return{'code':0xc8,'result':_0x6aba('0x148')};}else{logger['info'](util[_0x6aba('0x22')](_0x6aba('0x147'),_0x5e2752[_0x1358fa],'false'));this[_0x6aba('0xa')][_0x6aba('0xa8')](util[_0x6aba('0x22')](_0x6aba('0x147'),_0x5e2752[_0x1358fa],_0x6aba('0x13f')));}}return{'code':0xc8,'result':'false'};};AGIVertices[_0x6aba('0xd')][_0x6aba('0x149')]=function(_0xf80f64){logger['info'](util['format']('Enter\x20in\x20HANGUP\x20(%s)\x20block',_0xf80f64[_0x6aba('0x30')]));return this[_0x6aba('0xa')][_0x6aba('0x149')]();};AGIVertices['prototype']['ispeechasr']=function(_0xf27709){logger[_0x6aba('0x26')](util[_0x6aba('0x22')](_0x6aba('0x14a'),_0xf27709[_0x6aba('0x30')]));if(!this[_0x6aba('0x84')](_0xf27709[_0x6aba('0x7a')])){return this['channel'][_0x6aba('0xa8')](_0x6aba('0xe5'));}var _0x2a991e=_0x6aba('0x12c');var _0xa82376=util[_0x6aba('0x22')]('%s/recordings/%s',FILES_PATH,rs[_0x6aba('0x118')](0x4));var _0x164f68=util['format'](_0x6aba('0x9c'),_0xa82376,_0x2a991e);var _0x16651a=!![];if(_0xf27709[_0x6aba('0x12e')]===_0x6aba('0x12f')){_0x16651a=![];}var _0x24c9fe=this[_0x6aba('0xa')][_0x6aba('0x130')](_0xa82376,_0x2a991e,_0xf27709[_0x6aba('0x131')],_0xf27709['timeout'],undefined,_0x16651a);if(_0x24c9fe[_0x6aba('0xaa')]!==-0x1){this['channel'][_0x6aba('0xa8')](util[_0x6aba('0x22')]('ispeech\x20%s\x20file\x20created',_0x164f68));var _0x437489=this[_0x6aba('0x14b')][_0x6aba('0x6f')](this,_0xf27709,_0x164f68);if(_0x437489){for(var _0x1cb18f in _0x437489){if(_0x437489[_0x6aba('0x94')](_0x1cb18f)){this[_0x6aba('0xa')][_0x6aba('0x9d')](util[_0x6aba('0x22')](_0x6aba('0x14c'),_0x1cb18f[_0x6aba('0xf4')]()),_0x437489[_0x1cb18f]);}}return this[_0x6aba('0xa')][_0x6aba('0xa8')](util['format'](_0x6aba('0x14d'),JSON[_0x6aba('0x72')](_0x437489)));}}return _0x24c9fe;};AGIVertices[_0x6aba('0xd')][_0x6aba('0x14e')]=function(_0x489ce4){logger['info'](util[_0x6aba('0x22')]('Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block',_0x489ce4[_0x6aba('0x30')]));if(!this['isConfigured'](_0x489ce4['key'])){return this[_0x6aba('0xa')]['noop'](_0x6aba('0xe5'));}if(!this[_0x6aba('0x84')](_0x489ce4['text'])){return this[_0x6aba('0xa')][_0x6aba('0xa8')](_0x6aba('0xa9'));}this['channel'][_0x6aba('0xa8')](util[_0x6aba('0x22')]('Trying\x20ispeech\x20TTS\x20%s',_0x489ce4['text']));var _0x537d86=this[_0x6aba('0x80')]['sync'](this,_0x489ce4);if(_0x537d86){this['channel'][_0x6aba('0xa8')](util[_0x6aba('0x22')](_0x6aba('0x14f'),_0x537d86));var _0x3b2803=this[_0x6aba('0xa')][_0x6aba('0x102')](_0x537d86,_0x489ce4[_0x6aba('0x131')]);try{fs[_0x6aba('0x150')](_0x537d86+_0x6aba('0x103'));}catch(_0x4bff42){logger[_0x6aba('0x25')](_0x4bff42);}return _0x3b2803;}return this[_0x6aba('0xa')][_0x6aba('0x25')](_0x489ce4,_0x6aba('0x151'));};AGIVertices['prototype']['login']=function(_0x514235){logger[_0x6aba('0x26')](util[_0x6aba('0x22')](_0x6aba('0x152'),_0x514235[_0x6aba('0x30')]));if(!this[_0x6aba('0x84')](_0x514235[_0x6aba('0x153')])){return this[_0x6aba('0xa')][_0x6aba('0x25')](_0x514235,'no\x20find\x20by\x20configured');}logger[_0x6aba('0x26')](util['format'](_0x6aba('0x154'),this[_0x6aba('0xa')][_0x6aba('0x32')],_0x514235[_0x6aba('0x153')]));var _0x21e00b=this[_0x6aba('0x55')][_0x6aba('0x6f')](this,_0x514235[_0x6aba('0x153')]);if(_0x21e00b){logger['info'](util[_0x6aba('0x22')](_0x6aba('0x155'),this[_0x6aba('0xa')]['callerid'],_0x514235[_0x6aba('0x153')]));this[_0x6aba('0xa')][_0x6aba('0xa8')](util[_0x6aba('0x22')](_0x6aba('0x155'),this[_0x6aba('0xa')][_0x6aba('0x32')],_0x514235[_0x6aba('0x153')]));return{'code':0xc8,'result':_0x6aba('0x156')};}else{logger[_0x6aba('0x26')](util[_0x6aba('0x22')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x6aba('0xa')][_0x6aba('0x32')],_0x514235['findBy']));this[_0x6aba('0xa')][_0x6aba('0xa8')](util[_0x6aba('0x22')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x6aba('0xa')]['callerid'],_0x514235[_0x6aba('0x153')]));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0x6aba('0xd')]['logout']=function(_0x509924){logger[_0x6aba('0x26')](util['format']('Enter\x20in\x20LOGOUT\x20(%s)\x20block',_0x509924['label']));if(!this[_0x6aba('0x84')](_0x509924[_0x6aba('0x153')])){return this[_0x6aba('0xa')][_0x6aba('0x25')](_0x509924,_0x6aba('0x157'));}logger[_0x6aba('0x26')](util[_0x6aba('0x22')](_0x6aba('0x154'),this[_0x6aba('0xa')][_0x6aba('0x32')],_0x509924[_0x6aba('0x153')]));var _0x2a3780=this['agentLogout']['sync'](this,_0x509924['findBy']);if(_0x2a3780){logger[_0x6aba('0x26')](util[_0x6aba('0x22')](_0x6aba('0x155'),this[_0x6aba('0xa')][_0x6aba('0x32')],_0x509924['findBy']));this['channel']['noop'](util[_0x6aba('0x22')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x6aba('0xa')][_0x6aba('0x32')],_0x509924['findBy']));return{'code':0xc8,'result':_0x6aba('0x156')};}else{logger[_0x6aba('0x26')](util['format'](_0x6aba('0x158'),this['channel'][_0x6aba('0x32')],_0x509924[_0x6aba('0x153')]));this[_0x6aba('0xa')][_0x6aba('0xa8')](util[_0x6aba('0x22')](_0x6aba('0x158'),this[_0x6aba('0xa')][_0x6aba('0x32')],_0x509924[_0x6aba('0x153')]));return{'code':0xc8,'result':_0x6aba('0x159')};}};AGIVertices[_0x6aba('0xd')][_0x6aba('0x15a')]=function(_0x342c5d){logger['info'](util[_0x6aba('0x22')]('Enter\x20in\x20MATH\x20(%s)\x20block',_0x342c5d[_0x6aba('0x30')]));if(!this['isConfigured'](_0x342c5d[_0x6aba('0x15b')])){return this[_0x6aba('0xa')]['error'](_0x342c5d,_0x6aba('0x15c'));}this[_0x6aba('0xa')][_0x6aba('0xa8')](util[_0x6aba('0x22')](_0x6aba('0x15d'),_0x342c5d[_0x6aba('0x15b')]));var _0x12df8b=eval(_0x342c5d[_0x6aba('0x15b')]);if(!this[_0x6aba('0x84')](_0x342c5d['variable_id'])){return this[_0x6aba('0xa')][_0x6aba('0xa8')](_0x6aba('0xd4'));}var _0x1fdeb4=this['getVariable'][_0x6aba('0x6f')](this,_0x342c5d['variable_id']);if(!_0x1fdeb4){return this[_0x6aba('0xa')][_0x6aba('0x25')](_0x342c5d,_0x6aba('0xd5'));}if(_[_0x6aba('0x15e')](_0x12df8b)){var _0x352891=this;_0x12df8b[_0x6aba('0xd6')](function(_0x274231,_0x19cad1){_0x352891[_0x6aba('0xa')][_0x6aba('0x9d')](util[_0x6aba('0x22')](_0x6aba('0x15f'),_0x1fdeb4,_0x19cad1),_0x274231);});return this[_0x6aba('0xa')][_0x6aba('0xa8')](util[_0x6aba('0x22')](_0x6aba('0x160'),_0x1fdeb4));}else{return this['channel'][_0x6aba('0x9d')](_0x1fdeb4,_0x12df8b);}};AGIVertices[_0x6aba('0xd')]['menu']=function(_0x2e82fc){logger[_0x6aba('0x26')](util[_0x6aba('0x22')]('Enter\x20in\x20MENU\x20(%s)\x20block',_0x2e82fc[_0x6aba('0x30')]));if(_0x2e82fc[_0x6aba('0x10f')]===0x0){return this[_0x6aba('0xa5')](_0x2e82fc);}_0x2e82fc[_0x6aba('0x10f')]-=0x1;if(!this[_0x6aba('0x84')](_0x2e82fc['file_id'])){return this[_0x6aba('0xa')]['error'](_0x2e82fc,_0x6aba('0x161'));}var _0x1c8a68=this['getSound']['sync'](this,_0x2e82fc[_0x6aba('0x110')]);if(!_0x1c8a68){return this[_0x6aba('0xa')][_0x6aba('0x25')](_0x2e82fc,'no\x20file\x20audio\x20found');}var _0xb7ed36=this[_0x6aba('0xa')][_0x6aba('0x112')](_0x1c8a68,_0x2e82fc['response'],_0x2e82fc[_0x6aba('0x162')]);var _0x37f32e=_0xb7ed36['result'];if(_0xb7ed36['result']===-0x1){this[_0x6aba('0xa4')][_0x6aba('0x6f')](this,_0x2e82fc,'-1');return _0xb7ed36;}else if(_0xb7ed36[_0x6aba('0xa0')]===_0x6aba('0x66')){_0xb7ed36[_0x6aba('0xaa')]=_0xb7ed36[_0x6aba('0xaa')][_0x6aba('0x98')]>0x0?_0xb7ed36[_0x6aba('0xaa')]:'t';}else if(_[_0x6aba('0x3d')](_0xb7ed36['result'])){_0xb7ed36[_0x6aba('0xaa')]='#';_0x37f32e='#';}if(!this['isConfigured'](_0x2e82fc[_0x6aba('0xd3')])){this[_0x6aba('0xa')][_0x6aba('0xa8')](_0x6aba('0xd4'));}else{var _0x37a75b=this['getVariable'][_0x6aba('0x6f')](this,_0x2e82fc['variable_id']);if(!_0x37a75b){return this['channel'][_0x6aba('0x25')](_0x2e82fc,_0x6aba('0xd5'));}this[_0x6aba('0xa')][_0x6aba('0x9d')](_0x37a75b,_0x37f32e);}this[_0x6aba('0xa4')][_0x6aba('0x6f')](this,_0x2e82fc,_0x37f32e);return _0xb7ed36;};AGIVertices[_0x6aba('0xd')]['noop']=function(_0x4eada3){logger[_0x6aba('0x26')](util[_0x6aba('0x22')](_0x6aba('0x163'),_0x4eada3[_0x6aba('0x30')]));return this['channel'][_0x6aba('0xa8')](_0x4eada3[_0x6aba('0x164')]||_0x4eada3[_0x6aba('0x30')]);};AGIVertices[_0x6aba('0xd')][_0x6aba('0x165')]=function(_0x4e4821){logger[_0x6aba('0x26')](util['format'](_0x6aba('0x166'),_0x4e4821[_0x6aba('0x30')]));if(!this[_0x6aba('0x84')](_0x4e4821[_0x6aba('0x153')])){return this[_0x6aba('0xa')]['error'](_0x4e4821,_0x6aba('0x157'));}logger[_0x6aba('0x26')](util['format'](_0x6aba('0x154'),this['channel'][_0x6aba('0x32')],_0x4e4821['findBy']));var _0x53563d=this['getPause']['sync'](this,_0x4e4821[_0x6aba('0x167')]);var _0x286a1a=this[_0x6aba('0x52')]['sync'](this,_0x4e4821[_0x6aba('0x153')],_0x53563d);if(_0x286a1a){logger[_0x6aba('0x26')](util[_0x6aba('0x22')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x6aba('0xa')][_0x6aba('0x32')],_0x4e4821[_0x6aba('0x153')]));this['channel'][_0x6aba('0xa8')](util[_0x6aba('0x22')](_0x6aba('0x155'),this[_0x6aba('0xa')][_0x6aba('0x32')],_0x4e4821[_0x6aba('0x153')]));return{'code':0xc8,'result':'success'};}else{logger['info'](util[_0x6aba('0x22')](_0x6aba('0x158'),this[_0x6aba('0xa')]['callerid'],_0x4e4821[_0x6aba('0x153')]));this[_0x6aba('0xa')][_0x6aba('0xa8')](util[_0x6aba('0x22')](_0x6aba('0x155'),this[_0x6aba('0xa')]['callerid'],_0x4e4821[_0x6aba('0x153')]));return{'code':0xc8,'result':_0x6aba('0x159')};}};AGIVertices[_0x6aba('0xd')][_0x6aba('0x168')]=function(_0x48807f){logger[_0x6aba('0x26')](util[_0x6aba('0x22')](_0x6aba('0x169'),_0x48807f[_0x6aba('0x30')]));if(!this[_0x6aba('0x84')](_0x48807f['file_id'])){return this[_0x6aba('0xa')][_0x6aba('0x25')](_0x48807f,'no\x20file\x20audio\x20selected');}var _0x5869c4=this[_0x6aba('0x16a')][_0x6aba('0x6f')](this,_0x48807f[_0x6aba('0x110')]);if(!_0x5869c4){return this[_0x6aba('0xa')][_0x6aba('0x25')](_0x48807f,_0x6aba('0x111'));}var _0x1feb4f=this['channel'][_0x6aba('0x59')](_0x6aba('0x16b'),[_0x5869c4,_0x48807f['opts']]);if(_0x1feb4f[_0x6aba('0xaa')]===-0x1){return _0x1feb4f;}return this[_0x6aba('0xa')][_0x6aba('0xa8')](util['format'](_0x6aba('0x16c'),_0x6aba('0x16b'),_0x5869c4));};AGIVertices[_0x6aba('0xd')]['queue']=function(_0x15dd51){logger[_0x6aba('0x26')](util[_0x6aba('0x22')](_0x6aba('0x16d'),_0x15dd51['label']));if(!this[_0x6aba('0x84')](_0x15dd51['queue_id'])){return this['channel']['error'](_0x15dd51,_0x6aba('0x16e'));}var _0x2f3e6d='';var _0x446d48=parseInt(_0x15dd51[_0x6aba('0x16f')],0xa);if(isNaN(_0x446d48)){_0x2f3e6d=_0x15dd51[_0x6aba('0x16f')];}else{_0x2f3e6d=this['getVoiceQueue'][_0x6aba('0x6f')](this,_0x15dd51[_0x6aba('0x16f')]);if(!_0x2f3e6d){return this[_0x6aba('0xa')][_0x6aba('0x25')](_0x15dd51,_0x6aba('0x170'));}}var _0x27d717='';if(this[_0x6aba('0x84')](_0x15dd51['file_id'])){var _0x4ce5d5=this[_0x6aba('0x16a')][_0x6aba('0x6f')](this,_0x15dd51[_0x6aba('0x110')]);if(_0x4ce5d5){_0x27d717=_0x4ce5d5;}}this[_0x6aba('0xa4')][_0x6aba('0x6f')](this,_0x15dd51,_0x2f3e6d);if(_0x15dd51[_0x6aba('0xe2')][_0x6aba('0x171')]('x')<0x0){_0x15dd51[_0x6aba('0xe2')]+='x';}if(_0x15dd51[_0x6aba('0xe2')][_0x6aba('0x171')]('X')<0x0){_0x15dd51[_0x6aba('0xe2')]+='X';}this[_0x6aba('0xa')][_0x6aba('0x9d')]('XMCS-QUEUE',_0x2f3e6d?_0x2f3e6d[_0x6aba('0x172')]():'');var _0x3eac35=this[_0x6aba('0xa')]['exec'](_0x6aba('0x173'),[_0x2f3e6d,_0x15dd51[_0x6aba('0xe2')],_0x15dd51[_0x6aba('0x63')],_0x27d717,_0x15dd51['timeout'],_0x15dd51[_0x6aba('0x5')],_0x15dd51[_0x6aba('0x174')],_0x15dd51[_0x6aba('0x175')],'',_0x15dd51[_0x6aba('0x176')]]);if(_0x3eac35[_0x6aba('0xaa')]===-0x1){return _0x3eac35;}return this[_0x6aba('0xa')][_0x6aba('0xa8')](util['format'](_0x6aba('0x16c'),_0x6aba('0x173'),_0x2f3e6d));};AGIVertices[_0x6aba('0xd')]['record']=function(_0x192837){logger['info'](util['format'](_0x6aba('0x177'),_0x192837[_0x6aba('0x30')]));var _0x3cc2b0=_0x192837['recordingFormat']||_0x6aba('0x12c');var _0x1dd47c=util[_0x6aba('0x22')](_0x6aba('0x178'),this[_0x6aba('0xa')][_0x6aba('0x2f')],rs[_0x6aba('0x118')](0x5));var _0x36a590=util['format']('%s/recordings/%s.%s',FILES_PATH,_0x1dd47c,_0x3cc2b0);var _0x55169f=util[_0x6aba('0x22')]('%s/recordings/%s',FILES_PATH,_0x1dd47c);this[_0x6aba('0x33')][_0x6aba('0x6f')](this,_0x192837,_0x1dd47c,_0x36a590);this[_0x6aba('0xa')][_0x6aba('0x9d')](_0x6aba('0x179'),_0x1dd47c);logger[_0x6aba('0x26')](_0x6aba('0x17a'),_0x55169f,_0x3cc2b0,_0x192837[_0x6aba('0x17b')],_0x192837[_0x6aba('0x66')]);return this[_0x6aba('0xa')][_0x6aba('0x130')](_0x55169f,_0x3cc2b0,_0x192837['escape_digits'],_0x192837[_0x6aba('0x66')],undefined,!![]);};AGIVertices[_0x6aba('0xd')]['restapi']=function(_0x1e8340){logger[_0x6aba('0x26')](util['format']('Enter\x20in\x20RESTAPI\x20(%s)\x20block',_0x1e8340[_0x6aba('0x30')]));if(!this[_0x6aba('0x84')](_0x1e8340['url'])){return this[_0x6aba('0xa')][_0x6aba('0xa8')](_0x6aba('0x17c'));}var _0x5bdd54=this[_0x6aba('0x17d')][_0x6aba('0x6f')](this,_0x1e8340);logger[_0x6aba('0x26')](util['format'](_0x6aba('0x17e'),util[_0x6aba('0x17f')](_0x5bdd54,{'showHidden':![],'depth':null})));if(!this['isConfigured'](_0x1e8340[_0x6aba('0xd3')])){return this[_0x6aba('0xa')][_0x6aba('0xa8')](_0x6aba('0x180'));}var _0xde5291=this[_0x6aba('0xe')][_0x6aba('0x6f')](this,_0x1e8340[_0x6aba('0xd3')]);if(!_0xde5291){return this[_0x6aba('0xa')]['error'](_0x1e8340,_0x6aba('0xd5'));}this[_0x6aba('0xa')][_0x6aba('0x9d')](util[_0x6aba('0x22')](_0x6aba('0x181'),_0xde5291),_0x5bdd54['statusCode']?_0x5bdd54[_0x6aba('0x74')]:_0x6aba('0x182'));this[_0x6aba('0xa')][_0x6aba('0x9d')](util[_0x6aba('0x22')](_0x6aba('0x183'),_0xde5291),_0x5bdd54[_0x6aba('0x75')]?_0x5bdd54[_0x6aba('0x75')]:'OK');if(_0x5bdd54[_0x6aba('0x69')]){try{this[_0x6aba('0x9a')](_0x5bdd54['body'],_0xde5291);}catch(_0x404ed9){logger[_0x6aba('0x25')](util['format'](_0x6aba('0x184'),_0xde5291));}}return this[_0x6aba('0xa')][_0x6aba('0xa8')](util[_0x6aba('0x22')](_0x6aba('0xda'),_0xde5291));};AGIVertices[_0x6aba('0xd')][_0x6aba('0x185')]=function(_0x13a057){logger[_0x6aba('0x26')](util[_0x6aba('0x22')](_0x6aba('0x186'),_0x13a057[_0x6aba('0x30')]));return this[_0x6aba('0xa')][_0x6aba('0x187')](_0x13a057[_0x6aba('0x188')][_0x6aba('0xd1')](/\s+/g,''),_0x13a057[_0x6aba('0x17b')]);};AGIVertices[_0x6aba('0xd')]['saynumber']=function(_0x12d9a3){logger[_0x6aba('0x26')](util[_0x6aba('0x22')]('Enter\x20in\x20SAYNUMBER\x20(%s)\x20block',_0x12d9a3[_0x6aba('0x30')]));return this['channel'][_0x6aba('0x189')](_0x12d9a3['number'][_0x6aba('0xd1')](/\s+/g,''),_0x12d9a3[_0x6aba('0x17b')]);};AGIVertices[_0x6aba('0xd')][_0x6aba('0x18a')]=function(_0x2f11cf){logger[_0x6aba('0x26')](util['format']('Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block',_0x2f11cf[_0x6aba('0x30')]));return this['channel'][_0x6aba('0x18b')](_0x2f11cf[_0x6aba('0x5d')],_0x2f11cf['escape_digits']);};AGIVertices[_0x6aba('0xd')][_0x6aba('0x18c')]=function(_0x535c91){logger['info'](util[_0x6aba('0x22')](_0x6aba('0x18d'),_0x535c91[_0x6aba('0x30')]));if(!this['isConfigured'](_0x535c91[_0x6aba('0x18e')])){return this['channel']['noop'](_0x6aba('0x18f'));}var _0x1b71a1=this['getMailAccount']['sync'](this,_0x535c91[_0x6aba('0x18e')]);if(!_0x1b71a1||!_0x1b71a1[_0x6aba('0x190')]){return this['channel']['error'](_0x535c91,_0x6aba('0x191'));}var _0x18e302={'from':util[_0x6aba('0x22')](_0x6aba('0x192'),_0x1b71a1[_0x6aba('0x15')],_0x1b71a1['email']||_0x1b71a1[_0x6aba('0x190')]['user']),'to':_0x535c91['to']||'','cc':_0x535c91['cc']||'','bcc':_0x535c91[_0x6aba('0x193')]||'','subject':_0x535c91['subject'],'html':_0x535c91[_0x6aba('0x5d')],'text':_0x535c91[_0x6aba('0x5d')]};var _0x46c27b={'tls':{'rejectUnauthorized':![]}};if(_0x1b71a1[_0x6aba('0x190')]['service']){_0x46c27b['service']=_0x1b71a1[_0x6aba('0x190')][_0x6aba('0x194')];}else{_0x46c27b[_0x6aba('0x195')]=_0x1b71a1[_0x6aba('0x190')]['host'];_0x46c27b[_0x6aba('0x196')]=_0x1b71a1['Smtp'][_0x6aba('0x196')];_0x46c27b['secure']=_0x1b71a1[_0x6aba('0x190')]['secure'];}if(_0x1b71a1[_0x6aba('0x190')][_0x6aba('0x197')]){_0x46c27b[_0x6aba('0x198')]={'user':_0x1b71a1[_0x6aba('0x190')][_0x6aba('0x199')],'pass':_0x1b71a1['Smtp'][_0x6aba('0x19a')]};}if(this['isConfigured'](_0x535c91[_0x6aba('0x19b')])){}logger[_0x6aba('0xdc')](_0x6aba('0x19c'),JSON['stringify'](_0x18e302));this[_0x6aba('0xa4')][_0x6aba('0x6f')](this,_0x535c91,_0x535c91[_0x6aba('0x18e')]);this[_0x6aba('0xa')][_0x6aba('0xa8')](util['format'](_0x6aba('0x19d'),_0x1b71a1[_0x6aba('0x15')]));this[_0x6aba('0x1e')][_0x6aba('0x6f')](this,_0x46c27b,_0x18e302);return this['channel'][_0x6aba('0xa8')](_0x6aba('0x19e'));};AGIVertices[_0x6aba('0xd')][_0x6aba('0x19f')]=function(_0x556340){logger[_0x6aba('0x26')](util['format']('Enter\x20in\x20SENDFAX\x20(%s)\x20block',_0x556340[_0x6aba('0x30')]));return this['channel'][_0x6aba('0xa8')]('SENDFAX\x20block\x20not\x20implemented');};AGIVertices[_0x6aba('0xd')]['sendSMS']=function(_0x239f1d){logger[_0x6aba('0x26')](util[_0x6aba('0x22')](_0x6aba('0x1a0'),_0x239f1d['label']));if(!this[_0x6aba('0x84')](_0x239f1d[_0x6aba('0x1a1')])){return this[_0x6aba('0xa')]['noop'](_0x6aba('0x1a2'));}var _0x368977=this[_0x6aba('0x2d')][_0x6aba('0x6f')](this,_0x239f1d['sms_account_id']);if(!_0x368977){return this[_0x6aba('0xa')][_0x6aba('0x25')](_0x239f1d,'no\x20sms\x20account\x20found');}var _0xaca2eb={'body':_0x239f1d['sms_text'],'phone':_0x239f1d['to']||'','SmsAccountId':_0x368977['id']};logger[_0x6aba('0xdc')](_0x6aba('0x1a3'),JSON[_0x6aba('0x72')](_0xaca2eb));this['createSquareDetailsReport'][_0x6aba('0x6f')](this,_0x239f1d,_0x239f1d['sms_account_id']);this[_0x6aba('0xa')][_0x6aba('0xa8')](util[_0x6aba('0x22')](_0x6aba('0x1a4'),_0x368977[_0x6aba('0x15')]));this['createSmsMessage'][_0x6aba('0x6f')](this,_0xaca2eb);return this[_0x6aba('0xa')]['noop'](_0x6aba('0x1a5'));};AGIVertices['prototype']['set']=function(_0xa33780){logger[_0x6aba('0x26')](util[_0x6aba('0x22')](_0x6aba('0x1a6'),_0xa33780[_0x6aba('0x30')]));if(!this[_0x6aba('0x84')](_0xa33780[_0x6aba('0xd3')])){return this['channel'][_0x6aba('0x25')](_0xa33780,'no\x20variable\x20selected');}var _0x5b072f=this[_0x6aba('0xe')][_0x6aba('0x6f')](this,_0xa33780[_0x6aba('0xd3')]);if(!_0x5b072f){return this['channel'][_0x6aba('0x25')](_0xa33780,'no\x20variable\x20found');}return this['channel']['setVariable'](_0x5b072f,_0xa33780['variable_value']);};AGIVertices[_0x6aba('0xd')][_0x6aba('0x1a7')]=function(_0x4df85f){logger[_0x6aba('0x26')](util[_0x6aba('0x22')]('Enter\x20in\x20START\x20(%s)\x20block',_0x4df85f[_0x6aba('0x30')]));this[_0x6aba('0xa')]['noop'](_0x6aba('0x1a8'));if(_0x4df85f[_0x6aba('0xb8')]===_0x6aba('0x1a9')){this[_0x6aba('0xa')][_0x6aba('0xa8')](_0x6aba('0x1aa'));return this[_0x6aba('0xa')][_0x6aba('0xb8')]();}return this['channel'][_0x6aba('0xa8')](_0x6aba('0x1ab'));};AGIVertices[_0x6aba('0xd')]['subproject']=function(_0x37ef14){logger[_0x6aba('0x26')](util[_0x6aba('0x22')](_0x6aba('0x1ac'),_0x37ef14['label']));if(!this[_0x6aba('0x84')](_0x37ef14[_0x6aba('0x1ad')])){return this[_0x6aba('0xa')]['error'](_0x37ef14,_0x6aba('0x1ae'));}var _0x2f6f8a=this[_0x6aba('0x14')][_0x6aba('0x6f')](this,_0x37ef14[_0x6aba('0x1ad')]);if(!this['isConfigured'](_0x2f6f8a)){return this[_0x6aba('0xa')][_0x6aba('0x25')](_0x37ef14,util[_0x6aba('0x22')](_0x6aba('0x1af'),_0x37ef14[_0x6aba('0x1ad')]));}if(_0x2f6f8a===this[_0x6aba('0xa')][_0x6aba('0x3a')]){return this[_0x6aba('0xa')][_0x6aba('0x25')](_0x37ef14,_0x6aba('0x1b0'));}this[_0x6aba('0xa4')]['sync'](this,_0x37ef14,_0x2f6f8a);var _0x45a4a7=this[_0x6aba('0xa')]['exec'](_0x6aba('0x1b1'),util[_0x6aba('0x22')]('agi://%s/square,\x22%s\x22,\x22%s\x22',config[_0x6aba('0x5')][_0x6aba('0x195')]||_0x6aba('0x1b2'),_0x2f6f8a,this[_0x6aba('0xa')][_0x6aba('0x3a')]));if(_0x45a4a7[_0x6aba('0xaa')]===-0x1){return _0x45a4a7;}return this[_0x6aba('0xa')][_0x6aba('0xa8')](util['format'](_0x6aba('0x16c'),_0x6aba('0x1b1'),_0x2f6f8a));};AGIVertices[_0x6aba('0xd')]['system']=function(_0x5b2aaf){logger[_0x6aba('0x26')](util[_0x6aba('0x22')](_0x6aba('0x1b3'),_0x5b2aaf[_0x6aba('0x30')]));var _0x58c773=this[_0x6aba('0x1b4')]['sync'](this,_0x5b2aaf[_0x6aba('0xb6')]);this[_0x6aba('0xa4')][_0x6aba('0x6f')](this,_0x5b2aaf,_0x5b2aaf[_0x6aba('0xb6')]);if(this['isConfigured'](_0x5b2aaf[_0x6aba('0xd3')])){var _0x57821e=this['getVariable'][_0x6aba('0x6f')](this,_0x5b2aaf['variable_id']);if(_0x57821e){this[_0x6aba('0xa')]['setVariable'](_0x57821e,_0x58c773);return this[_0x6aba('0xa')]['noop'](util[_0x6aba('0x22')](_0x6aba('0x1b5'),_0x5b2aaf[_0x6aba('0xb6')],_0x57821e));}}return this[_0x6aba('0xa')][_0x6aba('0xa8')](util[_0x6aba('0x22')](_0x6aba('0x1b6'),_0x5b2aaf[_0x6aba('0xb6')]));};AGIVertices[_0x6aba('0xd')][_0x6aba('0x1b7')]=function(_0x4383bb){logger['info'](util['format'](_0x6aba('0x1b8'),_0x4383bb[_0x6aba('0x30')]));_0x4383bb[_0x6aba('0x5d')]=_0x4383bb[_0x6aba('0x5d')]['replace'](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x6aba('0x84')](_0x4383bb[_0x6aba('0x5b')])){return this[_0x6aba('0xa')]['noop']('no\x20apiKey\x20configured');}if(!this['isConfigured'](_0x4383bb[_0x6aba('0x5d')])){return this['channel'][_0x6aba('0xa8')](_0x6aba('0xa9'));}this['channel'][_0x6aba('0xa8')](util[_0x6aba('0x22')]('Trying\x20Google\x20Cloud\x20TTS\x20%s',_0x4383bb[_0x6aba('0x5d')]));var _0x2ab81b=this['googleCloudTTS'][_0x6aba('0x6f')](this,_0x4383bb);if(_0x2ab81b){this['channel'][_0x6aba('0xa8')](util[_0x6aba('0x22')](_0x6aba('0x1b9'),_0x2ab81b));var _0x10fcf1=this[_0x6aba('0xa')][_0x6aba('0x102')](_0x2ab81b);try{fs[_0x6aba('0x150')](_0x2ab81b+_0x6aba('0x103'));}catch(_0x5c0c9e){logger[_0x6aba('0x25')](_0x5c0c9e);}return _0x10fcf1;}return this[_0x6aba('0xa')]['error'](_0x4383bb,_0x6aba('0x1ba'));};AGIVertices[_0x6aba('0xd')][_0x6aba('0x1bb')]=function(_0x528a65){logger[_0x6aba('0x26')](util[_0x6aba('0x22')]('Enter\x20in\x20GOOGLETTS\x20(%s)\x20block',_0x528a65[_0x6aba('0x30')]));_0x528a65[_0x6aba('0x5d')]=_0x528a65[_0x6aba('0x5d')][_0x6aba('0xd1')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x6aba('0x84')](_0x528a65[_0x6aba('0x5d')])){return this[_0x6aba('0xa')]['noop'](_0x6aba('0xa9'));}this[_0x6aba('0xa')][_0x6aba('0xa8')](util['format'](_0x6aba('0x1bc'),_0x528a65[_0x6aba('0x5d')]));var _0x20b3d0=this[_0x6aba('0x61')][_0x6aba('0x6f')](this,_0x528a65);if(_0x20b3d0){this[_0x6aba('0xa')][_0x6aba('0xa8')](util[_0x6aba('0x22')]('Google\x20TTS\x20%s\x20file\x20created',_0x20b3d0));var _0x408eee=this[_0x6aba('0xa')][_0x6aba('0x102')](_0x20b3d0);try{fs[_0x6aba('0x150')](_0x20b3d0+_0x6aba('0x103'));}catch(_0x308858){logger[_0x6aba('0x25')](_0x308858);}return _0x408eee;}return this[_0x6aba('0xa')][_0x6aba('0x25')](_0x528a65,_0x6aba('0x1bd'));};AGIVertices[_0x6aba('0xd')][_0x6aba('0x1be')]=function(_0x3bf9e7){logger['info'](util[_0x6aba('0x22')](_0x6aba('0x1bf'),_0x3bf9e7[_0x6aba('0x30')]));if(!this[_0x6aba('0x84')](_0x3bf9e7[_0x6aba('0x153')])){return this[_0x6aba('0xa')][_0x6aba('0x25')](_0x3bf9e7,_0x6aba('0x157'));}logger['info'](util[_0x6aba('0x22')](_0x6aba('0x154'),this[_0x6aba('0xa')][_0x6aba('0x32')],_0x3bf9e7[_0x6aba('0x153')]));var _0x28c437=this['agentUnpause'][_0x6aba('0x6f')](this,_0x3bf9e7[_0x6aba('0x153')]);if(_0x28c437){logger[_0x6aba('0x26')](util[_0x6aba('0x22')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x6aba('0xa')][_0x6aba('0x32')],_0x3bf9e7[_0x6aba('0x153')]));this[_0x6aba('0xa')][_0x6aba('0xa8')](util[_0x6aba('0x22')](_0x6aba('0x155'),this['channel']['callerid'],_0x3bf9e7[_0x6aba('0x153')]));return{'code':0xc8,'result':'success'};}else{logger[_0x6aba('0x26')](util[_0x6aba('0x22')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this['channel'][_0x6aba('0x32')],_0x3bf9e7[_0x6aba('0x153')]));this[_0x6aba('0xa')][_0x6aba('0xa8')](util['format'](_0x6aba('0x158'),this[_0x6aba('0xa')][_0x6aba('0x32')],_0x3bf9e7[_0x6aba('0x153')]));return{'code':0xc8,'result':_0x6aba('0x159')};}};AGIVertices[_0x6aba('0xd')][_0x6aba('0x1c0')]=function(_0x47cda8){logger[_0x6aba('0x26')](util['format']('Enter\x20in\x20VOICEMAIL\x20(%s)\x20block',_0x47cda8[_0x6aba('0x30')]));var _0xbf2cc1=this[_0x6aba('0xa')][_0x6aba('0x59')](_0x6aba('0x1c1'),[_0x47cda8[_0x6aba('0x1c2')],_0x47cda8['options']]);if(_0xbf2cc1[_0x6aba('0xaa')]===-0x1){return _0xbf2cc1;}return this[_0x6aba('0xa')][_0x6aba('0xa8')](util[_0x6aba('0x22')]('Executed\x20command\x20%s\x20%s',_0x6aba('0x1c1'),_0x47cda8['mailbox']));};AGIVertices[_0x6aba('0xd')][_0x6aba('0x1c3')]=function(_0x914f7){logger[_0x6aba('0x26')](util[_0x6aba('0x22')]('Enter\x20in\x20SWITCH\x20(%s)\x20block',_0x914f7['label']));if(!this[_0x6aba('0x84')](_0x914f7[_0x6aba('0xd3')])){return this[_0x6aba('0xa')][_0x6aba('0x25')](_0x914f7,_0x6aba('0x1c4'));}var _0x3b4c87=this['getVariable'][_0x6aba('0x6f')](this,_0x914f7[_0x6aba('0xd3')]);if(!_0x3b4c87){return this[_0x6aba('0xa')][_0x6aba('0x25')](_0x914f7,'no\x20variable\x20found');}var _0x56c70b=this['channel'][_0x6aba('0xe')](_0x3b4c87);return{'code':0xc8,'result':_0x56c70b[_0x6aba('0xa0')]?_0x56c70b[_0x6aba('0xa0')]:'-'};};String['prototype']['replaceAll']=function(_0x3ba7e9,_0x1e28bf){return this[_0x6aba('0x9e')](_0x3ba7e9)[_0x6aba('0x1c5')](_0x1e28bf);};module[_0x6aba('0x1c6')]=AGIVertices; \ No newline at end of file +var _0x6fad=['agentPause','agent','agentLogout','agentLogin','internal','%s/%s@from-sip/n','LOCAL','shellCommand','exec','trim','replace','googleCloudTTS','apiKey','google_cloud_tts_text_type','text','languageCode','en-US','ssmlGender','MALE','audioEncoding','MP3','googleTTS','google_tts_language','restAPI','url','timeout','number','POST','PUT','method','toUpperCase','body','rawBody','parse','headers','An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function','computedVariables','sync','uri','render','stringify','statusCode','message','500\x20-\x20Internal\x20Server\x20Error','options','googleDialogflow','key','dialogflow_language','googleDialogflowV2','dialogflowV2_project_id','client_email','dialogflowV2_language','sestekNDA','ispeechTTS','ispeech_tts_language','speed','ispeechASR','isConfigured','model','awsPolly','aws_access_key_id','aws_secret_access_key','aws_polly_voice','Amy','aws_text_type','awsLex','aws_lex_region','aws_bot_name','googleASR','tildeASR','clear','includes','clone','hasOwnProperty','isString','replaceObjectAllVariables','replaceAllVariables','recursiveNodeIndex','isPlainObject','isArray','length','saveRestApiResult','%s.%s','setVariable','split','replaceAll','extra','toString','getAndSetVariable','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','maxRetry','retry','noop','result','Executed\x20command\x20MRCPSynth\x20%s','mrcprecog','grammar','no\x20grammar\x20configured','MRCPRecog','MRCP_RECOG_CONFIDENCE','MRCP_RECOG_TRANSCRIPT','RECOG_INSTANCE()','MRCP_RECOG_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','Enter\x20in\x20AGI\x20(%s)\x20block','command','answer','Enter\x20in\x20ANSWER\x20(%s)\x20block','wait','delay','scheduledAt','custom_app','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','application','Executed\x20command\x20%s\x20%s','lumenvoxtts','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','no\x20text\x20configured','sestektts','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','MRCPSynth','lumenvoxasr','RECOG_CONFIDENCE()','RECOG_INPUT()','LUMENVOX_ASR_TRANSCRIPT','LUMENVOX_ASR_INSTANCE','Enter\x20in\x20SESTEKASR\x20(%s)\x20block','SESTEK_ASR_CONFIDENCE','SESTEK_ASR_INSTANCE','database','Enter\x20in\x20DATABASE\x20(%s)\x20block','odbc_id','no\x20database\x20selected','no\x20odbc\x20database\x20found','variable_id','forEach','%s[%s][%s]','%s_ROWS_COUNT','variable\x20%s\x20set','dial','debug','Enter\x20in\x20DIAL\x20(%s)\x20block','sip_id','SIP/%s','dialogflow','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','no\x20key\x20configured','bot','Trying\x20Dialogflow:\x20%s','DIALOGFLOW_%s','out','speech','Dialogflow\x20is\x20unreachable','dialogflowV2','Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block','no\x20project_id\x20configured','no\x20client_email\x20configured','private_key','Trying\x20DialogflowV2:\x20%s','providerResponse','DialogflowV2\x20Result\x20%s','DialogflowV2\x20is\x20unreachable','sesteknda','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','ndauth_url','no\x20ndauth\x20url\x20configured','username','no\x20username\x20configured','password','ndassistant_url','Trying\x20SestekNDA:\x20%s','SESTEK_NDA_%s','audiofile','streamFile','unlink','.wav','SestekNDA\x20Result\x20%s','end','Enter\x20in\x20END\x20(%s)\x20block','Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block','trunk_id','trunk_name','SIP/%s/%s','opts','Executed\x20command\x20%s','DIAL','finally','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','no\x20file\x20audio\x20selected','getSound','file_id','no\x20file\x20audio\x20found','no\x20variable\x20selected\x20for\x20the\x20result','getData','response','maxdigit','test','mindigit','hiddendigitsnum','generate','hiddendigitspos','first','substr','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','getdigits','goal','Enter\x20in\x20GOAL\x20(%s)\x20block','GOAL\x20%s','no\x20valid\x20credentials\x20configured','Trying\x20aws\x20Polly\x20%s','aws\x20Polly\x20%s\x20file\x20created','awslex','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','no\x20bot\x20name\x20configured','AWS_LEX_%s','Amazon\x20Lex\x20ready\x20for\x20fulfillment','amazonlex','Amazon\x20Lex\x20Result\x20%s','Amazon\x20Lex\x20is\x20unreachable','googleasr','wav','%s/recordings/%s','beep','NOBEEP','recordFile','intKey','google\x20%s\x20file\x20created','GOOGLE_ASR_%s','GoogleASR\x20Result\x20%s','tildeasr','appid','appsecret','tilde\x20%s\x20file\x20created','TILDE_ASR_%s','gotoc','Enter\x20in\x20GOTO\x20(%s)\x20block','gotoif','condition','no\x20condition\x20configured','true','EVAL\x20CONDITION\x20%s\x20%s','false','gotoiftime','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','no\x20interval\x20configured','no\x20intervals\x20found','IFTIME(%s?true:false)','IFTIME\x20%s\x20%s','hangup','Enter\x20in\x20HANGUP\x20(%s)\x20block','ispeechasr','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','ispeechtts','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','Trying\x20ispeech\x20TTS\x20%s','ispeech\x20%s\x20file\x20created','ispeech\x20TTS\x20is\x20unreachable','login','Enter\x20in\x20LOGIN\x20(%s)\x20block','FIND\x20AGENT\x20%s\x20BY\x20%s','findBy','AGENT\x20%s\x20FOUND\x20BY','success','AGENT\x20%s\x20NOT\x20FOUND\x20BY','failure','Enter\x20in\x20LOGOUT\x20(%s)\x20block','no\x20find\x20by\x20configured','Enter\x20in\x20MATH\x20(%s)\x20block','operation','math\x20%s','no\x20variable\x20found','variable\x20%s[key]\x20set','Enter\x20in\x20MENU\x20(%s)\x20block','digit','Enter\x20in\x20NOOP\x20(%s)\x20block','output','Enter\x20in\x20PAUSE\x20(%s)\x20block','pause_id','playback','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','PLAYBACK','queue','Enter\x20in\x20QUEUE\x20(%s)\x20block','queue_id','no\x20queue\x20found','indexOf','XMCS-QUEUE','toLowerCase','macro','position','QUEUE','record','Enter\x20in\x20RECORD\x20(%s)\x20block','recordingFormat','%s_%s','escape_digits','restapi','Enter\x20in\x20RESTAPI\x20(%s)\x20block','%s_STATUS_CODE','200','%s_STATUS_MESSAGE','statusMessage','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','saydigits','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','sayDigits','digits','saynumber','sayphonetic','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sayPhonetic','sendMail','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','account_id','no\x20mail\x20account\x20configured','getMailAccount','Smtp','no\x20mail\x20account\x20found','\x22%s\x22\x20<%s>','user','bcc','subject','service','host','port','secure','authentication','auth','pass','sendFax','Enter\x20in\x20SENDFAX\x20(%s)\x20block','SENDFAX\x20block\x20not\x20implemented','sendSMS','Enter\x20in\x20SENDSMS\x20(%s)\x20block','sms_account_id','no\x20sms\x20account\x20configured','no\x20sms\x20account\x20found','sms_text','Sms\x20message\x20added\x20to\x20outgoing\x20process','set','no\x20variable\x20selected','variable_value','yes','Answer','subproject','project_id','no\x20subproject\x20found\x20with\x20id\x20%d','AGI','agi://%s/square,\x22%s\x22,\x22%s\x22','system','Enter\x20in\x20SYSTEM\x20(%s)\x20block','sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s','sh\x20command:\x20%s\x20result\x20no\x20stored','google_cloud_tts','Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block','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','Trying\x20Google\x20TTS\x20%s','Google\x20TTS\x20%s\x20file\x20created','unpause','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','voicemail','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','VOICEMAIL','mailbox','vswitch','Enter\x20in\x20SWITCH\x20(%s)\x20block','join','exports','path','util','lodash','shelljs','randomstring','mustache','request-promise','../../config/logger','agi','../../config/environment/shared','./scripts','/var/opt/motion2/server/files','rawHeaders','menu','getsecretdigits','channel','prototype','getVariable','rpc','getVoiceQueue','getVoiceQueueById','then','catch','getSquareProject','getSquareOdbc','getSquareOdbcById','dsn','getUser','getUserById','getTrunk','getSoundById','save_name','getMailAccountById','mailRpc','sendMailMessage','getIntervals','getIntervalById','interval','Intervals','getSoundPath','format','getQueryOdbc','open','error','Error\x20getting\x20ODBC\x20connection\x20%s','info','ODBC\x20connection\x20successfully','query','Error\x20executing\x20query\x20%s','Query\x20executed\x20correctly\x20%s','close','getSmsAccount','getSmsAccountById','createSmsMessage','createSquareDetailsReport','uniqueid','label','arg_1','callerid','createSquareRecording','context','extension','priority','accountcode','dnid','file','createSquareMessage','createCmContact','isEmpty','isNil','random','name','lastName','list_id','callback','callback_priority','has','dialTimezone','getContactByPhone','phone','timezones','utcOffset','scheduledat','minutes','insertContact','add','getPause','getPauseById'];(function(_0x1ff2e7,_0x32cf1b){var _0x3cb987=function(_0x1b7a21){while(--_0x1b7a21){_0x1ff2e7['push'](_0x1ff2e7['shift']());}};_0x3cb987(++_0x32cf1b);}(_0x6fad,0x174));var _0xd6fa=function(_0x2a1dc3,_0x2bcbcc){_0x2a1dc3=_0x2a1dc3-0x0;var _0x4f0d17=_0x6fad[_0x2a1dc3];return _0x4f0d17;};'use strict';var fs=require('fs');var path=require(_0xd6fa('0x0'));var util=require(_0xd6fa('0x1'));var _=require(_0xd6fa('0x2'));var sh=require(_0xd6fa('0x3'));var odbc=require('odbc')();var rs=require(_0xd6fa('0x4'));var moment=require('moment');var Mustache=require(_0xd6fa('0x5'));var rp=require(_0xd6fa('0x6'));var logger=require(_0xd6fa('0x7'))(_0xd6fa('0x8'));var config=require('../../config/environment');var shared=require(_0xd6fa('0x9'));var scripts=require(_0xd6fa('0xa'));var FILES_PATH=_0xd6fa('0xb');var recursiveMapAttributes=[_0xd6fa('0xc'),'rawBody'];var verticesWithRetry=[_0xd6fa('0xd'),'getdigits',_0xd6fa('0xe')];var AGIVertices=function(_0x45d73f,_0xeb17d2,_0x18b286){this[_0xd6fa('0xf')]=_0x45d73f;this['rpc']=_0xeb17d2;this['mailRpc']=_0x18b286;};AGIVertices[_0xd6fa('0x10')][_0xd6fa('0x11')]=function(_0x4e91f4,_0x410494){this[_0xd6fa('0x12')]['getVariableById'](_0x4e91f4)['then'](function(_0xd7341e){_0x410494(null,_0xd7341e?_0xd7341e['name']:![]);})['catch'](function(_0x33ee61){_0x410494(_0x33ee61);});};AGIVertices[_0xd6fa('0x10')][_0xd6fa('0x13')]=function(_0x40df7f,_0x3cd6fa){this[_0xd6fa('0x12')][_0xd6fa('0x14')](_0x40df7f)[_0xd6fa('0x15')](function(_0x45f777){_0x3cd6fa(null,_0x45f777?_0x45f777['name']:![]);})[_0xd6fa('0x16')](function(_0x4082c5){_0x3cd6fa(_0x4082c5);});};AGIVertices[_0xd6fa('0x10')][_0xd6fa('0x17')]=function(_0x47e70a,_0x497945){this['rpc']['getSquareProjectById'](_0x47e70a)['then'](function(_0xe458aa){_0x497945(null,_0xe458aa?_0xe458aa['name']:![]);})[_0xd6fa('0x16')](function(_0x4bf723){_0x497945(_0x4bf723);});};AGIVertices[_0xd6fa('0x10')][_0xd6fa('0x18')]=function(_0x2ee97a,_0x379e57){this[_0xd6fa('0x12')][_0xd6fa('0x19')](_0x2ee97a)[_0xd6fa('0x15')](function(_0x42f984){_0x379e57(null,_0x42f984?_0x42f984[_0xd6fa('0x1a')]:![]);})[_0xd6fa('0x16')](function(_0x20159f){_0x379e57(_0x20159f);});};AGIVertices[_0xd6fa('0x10')][_0xd6fa('0x1b')]=function(_0x26c329,_0x2f1f4e){this[_0xd6fa('0x12')][_0xd6fa('0x1c')](_0x26c329)[_0xd6fa('0x15')](function(_0x3fbab3){_0x2f1f4e(null,_0x3fbab3?_0x3fbab3['name']:![]);})['catch'](function(_0x3d3d7b){_0x2f1f4e(_0x3d3d7b);});};AGIVertices[_0xd6fa('0x10')][_0xd6fa('0x1d')]=function(_0x1eaf9a,_0x1c5af3){this[_0xd6fa('0x12')]['getTrunkById'](_0x1eaf9a)[_0xd6fa('0x15')](function(_0x1af27c){_0x1c5af3(null,_0x1af27c?_0x1af27c['name']:![]);})[_0xd6fa('0x16')](function(_0xdac7e1){_0x1c5af3(_0xdac7e1);});};AGIVertices[_0xd6fa('0x10')]['getSound']=function(_0x242294,_0x1be5fd){var _0x22e6db=this;this[_0xd6fa('0x12')][_0xd6fa('0x1e')](_0x242294)[_0xd6fa('0x15')](function(_0x42f145){_0x1be5fd(null,_0x42f145?_0x22e6db['getSoundPath'](_0x42f145[_0xd6fa('0x1f')]):![]);})['catch'](function(_0x2eaaef){_0x1be5fd(_0x2eaaef);});};AGIVertices[_0xd6fa('0x10')]['getMailAccount']=function(_0x3fc7f5,_0x2caae7){this[_0xd6fa('0x12')][_0xd6fa('0x20')](_0x3fc7f5)[_0xd6fa('0x15')](function(_0x3b0bab){_0x2caae7(null,_0x3b0bab?_0x3b0bab:![]);})[_0xd6fa('0x16')](function(_0x1e3de4){_0x2caae7(_0x1e3de4);});};AGIVertices[_0xd6fa('0x10')]['sendMailMessage']=function(_0x168269,_0x1072ec,_0x581bf2){this[_0xd6fa('0x21')][_0xd6fa('0x22')](_0x168269,_0x1072ec)[_0xd6fa('0x15')](function(){_0x581bf2(null);})[_0xd6fa('0x16')](function(_0x11bc59){_0x581bf2(_0x11bc59);});};AGIVertices[_0xd6fa('0x10')][_0xd6fa('0x23')]=function(_0x3ee42b,_0x2d6058){this[_0xd6fa('0x12')][_0xd6fa('0x24')](_0x3ee42b)['then'](function(_0x2d934d){if(_0x2d934d){if(_0x2d934d['IntervalId']){_0x2d6058(null,[_0x2d934d[_0xd6fa('0x25')]]);}else{_0x2d6058(null,_['map'](_0x2d934d[_0xd6fa('0x26')],_0xd6fa('0x25')));}}else{_0x2d6058(null,![]);}})['catch'](function(_0x84e6d4){_0x2d6058(_0x84e6d4);});};AGIVertices['prototype'][_0xd6fa('0x27')]=function(_0x1e7f70){return util[_0xd6fa('0x28')]('%s/sounds/converted/%s',FILES_PATH,_0x1e7f70);};AGIVertices['prototype'][_0xd6fa('0x29')]=function(_0x1bab9d,_0x25cdfb,_0x56e721){odbc[_0xd6fa('0x2a')](_0x1bab9d,function(_0x3feb5e){if(_0x3feb5e){logger[_0xd6fa('0x2b')](_0xd6fa('0x2c'),_0x3feb5e);_0x56e721(_0x3feb5e);}else{logger[_0xd6fa('0x2d')](_0xd6fa('0x2e'));odbc[_0xd6fa('0x2f')](_0x25cdfb,function(_0x534748,_0x465dbd){if(_0x534748){logger[_0xd6fa('0x2d')](_0xd6fa('0x30'),_0x25cdfb);_0x56e721(_0x534748);}else{logger[_0xd6fa('0x2d')](_0xd6fa('0x31'),_0x25cdfb);odbc[_0xd6fa('0x32')](function(_0x12e6b9){if(_0x12e6b9){logger[_0xd6fa('0x2b')]('Error\x20closing\x20connection\x20to\x20odbc\x20%s',_0x12e6b9);}_0x56e721(null,_0x465dbd);});}});}});};AGIVertices[_0xd6fa('0x10')][_0xd6fa('0x33')]=function(_0x3816c3,_0x28c35b){this[_0xd6fa('0x12')][_0xd6fa('0x34')](_0x3816c3)[_0xd6fa('0x15')](function(_0x22ab6c){_0x28c35b(null,_0x22ab6c?_0x22ab6c:![]);})[_0xd6fa('0x16')](function(_0x4cc9b1){_0x28c35b(_0x4cc9b1);});};AGIVertices[_0xd6fa('0x10')][_0xd6fa('0x35')]=function(_0x2e4beb,_0x2f384f){this['rpc'][_0xd6fa('0x35')](_0x2e4beb)[_0xd6fa('0x15')](function(_0x12f652){_0x2f384f(null,_0x12f652);})[_0xd6fa('0x16')](function(_0x32ac34){_0x2f384f(_0x32ac34);});};AGIVertices[_0xd6fa('0x10')][_0xd6fa('0x36')]=function(_0x3af46b,_0x259715,_0x24c6a3){this[_0xd6fa('0x12')][_0xd6fa('0x36')]({'uniqueid':this[_0xd6fa('0xf')][_0xd6fa('0x37')],'node':_0x3af46b[_0xd6fa('0x38')],'application':_0x3af46b['agicommand'],'data':_0x259715||null,'project_name':this[_0xd6fa('0xf')][_0xd6fa('0x39')],'callerid':this['channel'][_0xd6fa('0x3a')]})[_0xd6fa('0x15')](function(_0x3ba8ac){if(_0x24c6a3){_0x24c6a3(null,_0x3ba8ac);}})[_0xd6fa('0x16')](function(_0xb92ea2){if(_0x24c6a3){_0x24c6a3(_0xb92ea2);}});};AGIVertices['prototype'][_0xd6fa('0x3b')]=function(_0x25bb88,_0x2790cf,_0x4e8a7b,_0x141897){this[_0xd6fa('0x12')][_0xd6fa('0x3b')]({'uniqueid':this['channel']['uniqueid'],'callerid':this[_0xd6fa('0xf')][_0xd6fa('0x3a')],'calleridname':this[_0xd6fa('0xf')]['calleridname'],'context':this['channel'][_0xd6fa('0x3c')],'extension':this[_0xd6fa('0xf')][_0xd6fa('0x3d')],'priority':this[_0xd6fa('0xf')][_0xd6fa('0x3e')],'accountcode':this[_0xd6fa('0xf')][_0xd6fa('0x3f')],'dnid':this[_0xd6fa('0xf')][_0xd6fa('0x40')],'projectName':this[_0xd6fa('0xf')][_0xd6fa('0x39')],'saveName':_0x2790cf,'filename':_0x25bb88[_0xd6fa('0x41')]||_0x2790cf,'savePath':_0x4e8a7b})[_0xd6fa('0x15')](function(_0xb7bf80){_0x141897(null,_0xb7bf80);})[_0xd6fa('0x16')](function(_0x177c27){_0x141897(_0x177c27);});};AGIVertices['prototype'][_0xd6fa('0x42')]=function(_0x5e8ff2,_0x127c0a,_0x1a1fcb,_0x4b4668,_0x4fa3ce){this[_0xd6fa('0x12')][_0xd6fa('0x42')]({'uniqueid':this['channel'][_0xd6fa('0x37')],'body':_0x5e8ff2,'direction':_0x127c0a,'providerName':_0x1a1fcb,'providerResponse':_0x4b4668})[_0xd6fa('0x15')](function(_0x1abd98){if(_0x4fa3ce){_0x4fa3ce(null,_0x1abd98);}})[_0xd6fa('0x16')](function(_0x3472e3){if(_0x4fa3ce){_0x4fa3ce(_0x3472e3);}});};AGIVertices[_0xd6fa('0x10')][_0xd6fa('0x43')]=function(_0x480ca6,_0xcf7583){var _0x2f55ff=this;var _0x39c8cf=0x0;var _0x304438={'firstName':_[_0xd6fa('0x44')](_0x480ca6['name'])||_[_0xd6fa('0x45')](_0x480ca6['name'])?'callback_'+Math[_0xd6fa('0x46')]():_0x480ca6[_0xd6fa('0x47')],'lastName':_[_0xd6fa('0x44')](_0x480ca6['lastName'])||_[_0xd6fa('0x45')](_0x480ca6[_0xd6fa('0x48')])?null:_0x480ca6['lastName'],'phone':_0x480ca6['phone'],'ListId':_0x480ca6[_0xd6fa('0x49')],'scheduledat':_0x480ca6['scheduledAt'],'callbackUniqueid':this[_0xd6fa('0xf')][_0xd6fa('0x37')],'tags':_0xd6fa('0x4a'),'description':'Callback\x20scheduled\x20at\x20'+_0x480ca6['scheduledAt']['toString'](),'priority':_0x480ca6[_0xd6fa('0x4b')]};if(_[_0xd6fa('0x4c')](_0x480ca6,_0xd6fa('0x4d'))){if(!_['isNil'](_0x480ca6['dialTimezone'])){var _0x215bd7=_0x480ca6[_0xd6fa('0x4d')];if(_0x480ca6[_0xd6fa('0x4d')]=='CALLERID(dialTimezone)'){this['rpc'][_0xd6fa('0x4e')]({'phone':_0x480ca6[_0xd6fa('0x4f')]})[_0xd6fa('0x15')](function(_0x180f99){if(!_[_0xd6fa('0x45')](_0x180f99)){var _0x1ad593=_0x180f99['dialTimezone'];if(!_['isNil'](_0x1ad593)){var _0x20b713=shared[_0xd6fa('0x50')][_0x1ad593];if(!_[_0xd6fa('0x45')](_0x20b713)){var _0x50d54b=-0x1*_0x20b713[_0xd6fa('0x51')];_0x304438['scheduledat']=moment(_0x480ca6[_0xd6fa('0x52')])['add'](_0x50d54b,_0xd6fa('0x53'));_0x2f55ff['insertContact'](_0x304438,_0x480ca6,_0xcf7583);}else{_0x2f55ff['insertContact'](_0x304438,_0x480ca6,_0xcf7583);}}else{_0x2f55ff[_0xd6fa('0x54')](_0x304438,_0x480ca6,_0xcf7583);}}else{_0x2f55ff[_0xd6fa('0x54')](_0x304438,_0x480ca6,_0xcf7583);}});}else{var _0x39c8cf=shared[_0xd6fa('0x50')][_0x215bd7];if(!_['isNil'](_0x39c8cf)){var _0x5bcb18=-0x1*_0x39c8cf[_0xd6fa('0x51')];_0x304438['scheduledat']=moment(_0x480ca6[_0xd6fa('0x52')])[_0xd6fa('0x55')](_0x5bcb18,_0xd6fa('0x53'));_0x2f55ff[_0xd6fa('0x54')](_0x304438,_0x480ca6,_0xcf7583);}else{_0x2f55ff[_0xd6fa('0x54')](_0x304438,_0x480ca6,_0xcf7583);}}}else{_0x2f55ff[_0xd6fa('0x54')](_0x304438,_0x480ca6,_0xcf7583);}}else{_0x2f55ff[_0xd6fa('0x54')](_0x304438,_0x480ca6,_0xcf7583);}};AGIVertices[_0xd6fa('0x10')][_0xd6fa('0x56')]=function(_0x5e5b55,_0x153a13){this[_0xd6fa('0x12')][_0xd6fa('0x57')](_0x5e5b55)[_0xd6fa('0x15')](function(_0x292eb5){_0x153a13(null,_0x292eb5?_0x292eb5[_0xd6fa('0x47')]:![]);})[_0xd6fa('0x16')](function(_0x53e634){_0x153a13(_0x53e634);});};AGIVertices[_0xd6fa('0x10')][_0xd6fa('0x58')]=function(_0x3e6a28,_0x5bea05,_0x5976df){var _0x4e6faf={'role':_0xd6fa('0x59')};_0x4e6faf[_0x3e6a28]=this['channel']['callerid'];this[_0xd6fa('0x12')][_0xd6fa('0x58')](_0x4e6faf,_0x5bea05,this[_0xd6fa('0xf')]['uniqueid'])['then'](function(_0xb0be17){_0x5976df(null,_['isNil'](_0xb0be17)?![]:!![]);})[_0xd6fa('0x16')](function(_0x369eaf){logger[_0xd6fa('0x2b')](_0x369eaf);_0x5976df(null,![]);});};AGIVertices[_0xd6fa('0x10')]['agentUnpause']=function(_0x2be821,_0x33934d){var _0x4736f0={'role':_0xd6fa('0x59')};_0x4736f0[_0x2be821]=this[_0xd6fa('0xf')][_0xd6fa('0x3a')];this[_0xd6fa('0x12')]['agentUnpause'](_0x4736f0)[_0xd6fa('0x15')](function(_0x2c5a19){_0x33934d(null,_[_0xd6fa('0x45')](_0x2c5a19)?![]:!![]);})[_0xd6fa('0x16')](function(_0x11a5e2){logger[_0xd6fa('0x2b')](_0x11a5e2);_0x33934d(null,![]);});};AGIVertices['prototype'][_0xd6fa('0x5a')]=function(_0x351147,_0x304600){var _0x4878de={'role':_0xd6fa('0x59')};_0x4878de[_0x351147]=this[_0xd6fa('0xf')][_0xd6fa('0x3a')];this[_0xd6fa('0x12')][_0xd6fa('0x5a')](_0x4878de)[_0xd6fa('0x15')](function(_0x16f284){_0x304600(null,_[_0xd6fa('0x45')](_0x16f284)?![]:!![]);})[_0xd6fa('0x16')](function(_0x533989){logger['error'](_0x533989);_0x304600(null,![]);});};AGIVertices[_0xd6fa('0x10')][_0xd6fa('0x5b')]=function(_0x476130,_0x3855b0){var _0x14007f={'role':_0xd6fa('0x59')};_0x14007f[_0x476130]=this[_0xd6fa('0xf')][_0xd6fa('0x3a')];var _0x4b3dc9=_0x476130!=_0xd6fa('0x5c')?util[_0xd6fa('0x28')](_0xd6fa('0x5d'),_0xd6fa('0x5e'),this['channel'][_0xd6fa('0x3a')]):undefined;this[_0xd6fa('0x12')][_0xd6fa('0x5b')](_0x14007f,_0x4b3dc9)[_0xd6fa('0x15')](function(_0x2add4e){_0x3855b0(null,_[_0xd6fa('0x45')](_0x2add4e)?![]:!![]);})[_0xd6fa('0x16')](function(_0x556042){logger[_0xd6fa('0x2b')](_0x556042);_0x3855b0(null,![]);});};AGIVertices[_0xd6fa('0x10')][_0xd6fa('0x5f')]=function(_0xa9f575,_0x141423){sh[_0xd6fa('0x60')](_[_0xd6fa('0x61')](_0xa9f575),function(_0x57f11a,_0x27fcdb){var _0x8b9ddb=_0x27fcdb[_0xd6fa('0x62')](/(\r\n|\n|\r)/gm,'');_0x141423(null,_0x8b9ddb);});};AGIVertices[_0xd6fa('0x10')][_0xd6fa('0x63')]=function(_0x18340d,_0xa52894){scripts[_0xd6fa('0x63')](_0x18340d[_0xd6fa('0x64')],_0x18340d[_0xd6fa('0x65')]||_0xd6fa('0x66'),_0x18340d['text'],_0x18340d[_0xd6fa('0x67')]||_0xd6fa('0x68'),_0x18340d[_0xd6fa('0x69')]||_0xd6fa('0x6a'),_0x18340d[_0xd6fa('0x6b')]||_0xd6fa('0x6c'))['then'](function(_0x5e6ee1){_0xa52894(null,_0x5e6ee1);})[_0xd6fa('0x16')](function(_0x57b4b2){_0xa52894(_0x57b4b2);});};AGIVertices['prototype'][_0xd6fa('0x6d')]=function(_0x5a5a22,_0x253ba8){scripts[_0xd6fa('0x6d')](_0x5a5a22[_0xd6fa('0x66')],_0x5a5a22[_0xd6fa('0x6e')]||'en',0x1)['then'](function(_0x4f4972){_0x253ba8(null,_0x4f4972);})['catch'](function(_0x2229b4){_0x253ba8(_0x2229b4);});};AGIVertices[_0xd6fa('0x10')][_0xd6fa('0x6f')]=function(_0x163dc7,_0x76f6ab){var _0x299041={'uri':_0x163dc7[_0xd6fa('0x70')],'method':_0x163dc7['method'],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x163dc7[_0xd6fa('0x71')])===_0xd6fa('0x72')&&parseInt(_0x163dc7[_0xd6fa('0x71')])>=0x1?parseInt(_0x163dc7[_0xd6fa('0x71')])*0x3e8:0x5*0x3e8};if(_['includes']([_0xd6fa('0x73'),_0xd6fa('0x74')],_0x299041[_0xd6fa('0x75')][_0xd6fa('0x76')]())){try{_0x299041[_0xd6fa('0x77')]=_0x163dc7[_0xd6fa('0x78')]?JSON[_0xd6fa('0x79')](_0x163dc7[_0xd6fa('0x78')]):{};}catch(_0x3eb4bc){logger[_0xd6fa('0x2b')]('An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function',_0x3eb4bc);}}try{_0x299041[_0xd6fa('0x7a')]=_0x163dc7[_0xd6fa('0xc')]?JSON[_0xd6fa('0x79')](_0x163dc7[_0xd6fa('0xc')]):{};}catch(_0x15c9dd){logger['error'](_0xd6fa('0x7b'),_0x15c9dd);}if(_0x163dc7[_0xd6fa('0x7c')]){try{var _0x2863dd=require(_0x163dc7['computedVariables'])[_0xd6fa('0x7d')](this,_0x299041);_0x299041[_0xd6fa('0x7e')]=Mustache[_0xd6fa('0x7f')](_0x163dc7[_0xd6fa('0x70')],_0x2863dd,{},['$$','$$']);if(_0x299041[_0xd6fa('0x7a')]){_0x299041[_0xd6fa('0x7a')]=JSON[_0xd6fa('0x79')](Mustache[_0xd6fa('0x7f')](JSON[_0xd6fa('0x80')](_0x299041[_0xd6fa('0x7a')]),_0x2863dd,{},['$$','$$']));}if(_0x299041['body']){_0x299041[_0xd6fa('0x77')]=JSON[_0xd6fa('0x79')](Mustache['render'](JSON[_0xd6fa('0x80')](_0x299041[_0xd6fa('0x77')]),_0x2863dd,{},['$$','$$']));}}catch(_0x3a2c34){logger[_0xd6fa('0x2b')]('An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function',_0x3a2c34);}}rp(_0x299041)[_0xd6fa('0x15')](function(_0x41aafe){var _0x1481f7={'statusCode':_0x41aafe[_0xd6fa('0x81')]||0xc8,'statusMessage':_0x41aafe['statusMessage']||'OK','headers':_0x41aafe['headers']||{},'body':_0x41aafe['body']||{}};_0x76f6ab(null,_0x1481f7);})[_0xd6fa('0x16')](function(_0x56e1a8){var _0x257f48={'statusCode':_0x56e1a8['statusCode']||0x1f4,'statusMessage':_0x56e1a8[_0xd6fa('0x82')]||_0xd6fa('0x83'),'headers':_0x56e1a8[_0xd6fa('0x84')][_0xd6fa('0x7a')]||{},'body':_0x56e1a8['options']['body']||{}};_0x76f6ab(null,_0x257f48);});};AGIVertices[_0xd6fa('0x10')][_0xd6fa('0x85')]=function(_0x2fa40a,_0x726995){scripts[_0xd6fa('0x85')](this[_0xd6fa('0xf')]['uniqueid'],_0x2fa40a[_0xd6fa('0x86')],_0x2fa40a[_0xd6fa('0x66')],_0x2fa40a[_0xd6fa('0x87')]||'en')[_0xd6fa('0x15')](function(_0x5ee16f){_0x726995(null,_0x5ee16f);})['catch'](function(_0x1ea6d1){_0x726995(_0x1ea6d1);});};AGIVertices['prototype'][_0xd6fa('0x88')]=function(_0x515899,_0x2374cc){scripts[_0xd6fa('0x88')](this[_0xd6fa('0xf')]['uniqueid'],_0x515899[_0xd6fa('0x89')],_0x515899[_0xd6fa('0x8a')],_0x515899['private_key'],_0x515899[_0xd6fa('0x66')],_0x515899[_0xd6fa('0x8b')]||'en')[_0xd6fa('0x15')](function(_0xa85029){_0x2374cc(null,_0xa85029);})[_0xd6fa('0x16')](function(_0x2e6b50){_0x2374cc(_0x2e6b50);});};AGIVertices[_0xd6fa('0x10')][_0xd6fa('0x8c')]=function(_0x5ed17d,_0x17254b){scripts[_0xd6fa('0x8c')](this[_0xd6fa('0xf')],_0x5ed17d)[_0xd6fa('0x15')](function(_0x2fb1f1){_0x17254b(null,_0x2fb1f1);})[_0xd6fa('0x16')](function(_0xcc6bbb){_0x17254b(_0xcc6bbb);});};AGIVertices['prototype'][_0xd6fa('0x8d')]=function(_0x4d2fe3,_0x26c038){scripts[_0xd6fa('0x8d')](_0x4d2fe3[_0xd6fa('0x86')],_0x4d2fe3[_0xd6fa('0x66')],_0x4d2fe3[_0xd6fa('0x8e')]||_0xd6fa('0x68'),_0x4d2fe3[_0xd6fa('0x8f')])[_0xd6fa('0x15')](function(_0x1ca6c7){_0x26c038(null,_0x1ca6c7);})[_0xd6fa('0x16')](function(_0x1c7f75){_0x26c038(_0x1c7f75);});};AGIVertices[_0xd6fa('0x10')][_0xd6fa('0x90')]=function(_0x1eac4e,_0x220ac3,_0x5ebdfe){scripts[_0xd6fa('0x90')](_0x220ac3,_0x1eac4e[_0xd6fa('0x86')],_0x1eac4e['ispeech_asr_language']||_0xd6fa('0x68'),this[_0xd6fa('0x91')](_0x1eac4e[_0xd6fa('0x92')])?_0x1eac4e[_0xd6fa('0x92')]:undefined)[_0xd6fa('0x15')](function(_0x40f632){_0x5ebdfe(null,_0x40f632);})[_0xd6fa('0x16')](function(_0x51f615){_0x5ebdfe(_0x51f615);});};AGIVertices[_0xd6fa('0x10')]['awsPolly']=function(_0x3a82b2,_0x128183){scripts[_0xd6fa('0x93')](_0x3a82b2[_0xd6fa('0x94')],_0x3a82b2[_0xd6fa('0x95')],_0x3a82b2['aws_polly_region'],_0x3a82b2[_0xd6fa('0x96')]||_0xd6fa('0x97'),_0x3a82b2['text'],_0x3a82b2[_0xd6fa('0x98')]||_0xd6fa('0x66'))['then'](function(_0xd1c0fb){_0x128183(null,_0xd1c0fb);})[_0xd6fa('0x16')](function(_0x4514d7){_0x128183(_0x4514d7);});};AGIVertices[_0xd6fa('0x10')][_0xd6fa('0x99')]=function(_0x116b44,_0x584eb5){scripts['awsLex'](this[_0xd6fa('0xf')][_0xd6fa('0x37')],_0x116b44[_0xd6fa('0x94')],_0x116b44[_0xd6fa('0x95')],_0x116b44[_0xd6fa('0x9a')],_0x116b44[_0xd6fa('0x66')],_0x116b44[_0xd6fa('0x9b')])[_0xd6fa('0x15')](function(_0x2b5b11){_0x584eb5(null,_0x2b5b11);})[_0xd6fa('0x16')](function(_0x29451f){_0x584eb5(_0x29451f);});};AGIVertices[_0xd6fa('0x10')]['googleASR']=function(_0x49f582,_0x22f991,_0x293ca6){scripts[_0xd6fa('0x9c')](_0x22f991,_0x49f582[_0xd6fa('0x86')],_0x49f582['google_asr_language']||_0xd6fa('0x68'))['then'](function(_0x4b5cfd){_0x293ca6(null,_0x4b5cfd);})['catch'](function(_0x2798de){_0x293ca6(_0x2798de);});};AGIVertices[_0xd6fa('0x10')]['tildeASR']=function(_0x401a16,_0x1a0ce6,_0x17f299){scripts[_0xd6fa('0x9d')](_0x1a0ce6,_0x401a16['appid'],_0x401a16['appsecret'],_0x401a16[_0xd6fa('0x7e')])[_0xd6fa('0x15')](function(_0x2489df){_0x17f299(null,_0x2489df);})[_0xd6fa('0x16')](function(_0x260909){_0x17f299(_0x260909);});};AGIVertices[_0xd6fa('0x10')][_0xd6fa('0x9e')]=function(_0x10b779){var _0x125d78=_[_0xd6fa('0x9f')](verticesWithRetry,_0x10b779['agicommand'])?_0x10b779:_[_0xd6fa('0xa0')](_0x10b779);for(var _0x4a7030 in _0x125d78){if(_0x125d78[_0xd6fa('0xa1')](_0x4a7030)){if(_0x125d78[_0x4a7030]&&_[_0xd6fa('0xa2')](_0x125d78[_0x4a7030])){if(_[_0xd6fa('0x9f')](recursiveMapAttributes,_0x4a7030)){_0x125d78[_0x4a7030]=this[_0xd6fa('0xa3')](_0x125d78[_0x4a7030]);}else{_0x125d78[_0x4a7030]=this[_0xd6fa('0xa4')](_0x125d78[_0x4a7030]);}}}}return _0x125d78;};AGIVertices[_0xd6fa('0x10')][_0xd6fa('0xa5')]=function(_0x5014bf){for(var _0x537706 in _0x5014bf){if(_0x5014bf['hasOwnProperty'](_0x537706)){if(_[_0xd6fa('0xa6')](_0x5014bf[_0x537706])){this['recursiveNodeIndex'](_0x5014bf[_0x537706]);}else if(_[_0xd6fa('0xa7')](_0x5014bf[_0x537706])){for(var _0x2c7d94=0x0;_0x2c7d94<_0x5014bf[_0x537706][_0xd6fa('0xa8')];_0x2c7d94++){this[_0xd6fa('0xa5')](_0x5014bf[_0x537706][_0x2c7d94]);}}else if(_[_0xd6fa('0xa2')](_0x5014bf[_0x537706])){_0x5014bf[_0x537706]=this[_0xd6fa('0xa4')](_0x5014bf[_0x537706]);}}}};AGIVertices[_0xd6fa('0x10')]['saveRestApiResult']=function(_0x512dce,_0x27dfaf){for(var _0x2ed230 in _0x512dce){if(_0x512dce['hasOwnProperty'](_0x2ed230)){if(_[_0xd6fa('0xa6')](_0x512dce[_0x2ed230])){if(!_[_0xd6fa('0x44')](_0x512dce[_0x2ed230])){this[_0xd6fa('0xa9')](_0x512dce[_0x2ed230],util[_0xd6fa('0x28')]('%s.%s',_0x27dfaf,_0x2ed230));}}else if(_['isArray'](_0x512dce[_0x2ed230])){for(var _0x55beab=0x0;_0x55beab<_0x512dce[_0x2ed230]['length'];_0x55beab++){this[_0xd6fa('0xa9')](_0x512dce[_0x2ed230][_0x55beab],util['format'](_0xd6fa('0xaa'),_0x27dfaf,_0x2ed230+'['+_0x55beab+']'));}}else{if(!_['isNil'](_0x512dce[_0x2ed230])){this[_0xd6fa('0xf')][_0xd6fa('0xab')](util[_0xd6fa('0x28')](_0xd6fa('0xaa'),_0x27dfaf,_0x2ed230),_0x512dce[_0x2ed230]);}}}}};AGIVertices['prototype'][_0xd6fa('0xa3')]=function(_0x8d847b){try{var _0x5631fa=JSON['parse'](_0x8d847b);this['recursiveNodeIndex'](_0x5631fa);return JSON['stringify'](_0x5631fa);}catch(_0x5b2f13){return this['replaceAllVariables'](_0x8d847b);}};AGIVertices[_0xd6fa('0x10')]['replaceAllVariables']=function(_0x47ab0c){var _0x3fe8fe=_0x47ab0c[_0xd6fa('0xac')]('{');for(var _0x46f292=0x1;_0x46f292<_0x3fe8fe[_0xd6fa('0xa8')];_0x46f292+=0x1){var _0x22c919=_0x3fe8fe[_0x46f292][_0xd6fa('0xac')]('}');if(_0x22c919['length']>0x1){_0x47ab0c=_0x47ab0c[_0xd6fa('0xad')]('{'+_0x22c919[0x0]+'}',this['channel'][_0xd6fa('0x11')](_0x22c919[0x0])[_0xd6fa('0xae')]||_0x22c919[0x0]);}}if(_0x3fe8fe[_0xd6fa('0xa8')]===0x1){return _0x47ab0c[_0xd6fa('0xaf')]();}return this[_0xd6fa('0xa4')](_0x47ab0c);};AGIVertices['prototype'][_0xd6fa('0xb0')]=function(_0x2cfdf3,_0x1da141){var _0x420717=this[_0xd6fa('0xf')][_0xd6fa('0x11')](_0x2cfdf3);if(_0x420717['result']===-0x1){return _0x420717;}logger[_0xd6fa('0x2d')](util[_0xd6fa('0x28')](_0xd6fa('0xb1'),_0x1da141,_0x420717['extra']));return this['channel'][_0xd6fa('0xab')](_0x1da141,_0x420717[_0xd6fa('0xae')]);};AGIVertices[_0xd6fa('0x10')]['isConfigured']=function(_0x2b4c7b){return _0x2b4c7b&&_0x2b4c7b!=='0'&&_0x2b4c7b!=='-1'&&_0x2b4c7b!=='';};AGIVertices[_0xd6fa('0x10')][_0xd6fa('0xb2')]=function(_0x23c79c){this[_0xd6fa('0x36')][_0xd6fa('0x7d')](this,_0x23c79c,'-');_0x23c79c[_0xd6fa('0xb3')]=_0x23c79c['maxRetry'];return{'code':0xc8,'result':'-'};};AGIVertices['prototype']['mrcpsynth']=function(_0x397cda){logger['info'](util[_0xd6fa('0x28')]('Enter\x20in\x20MRCPSynth\x20(%s)\x20block',_0x397cda['label']));if(!this[_0xd6fa('0x91')](_0x397cda[_0xd6fa('0x66')])){return this['channel'][_0xd6fa('0xb4')]('no\x20text\x20configured');}var _0x1b0634='\x22'+_0x397cda['text']+'\x22';if(this['isConfigured'](_0x397cda[_0xd6fa('0x84')])){_0x1b0634+=','+_0x397cda[_0xd6fa('0x84')];}var _0x126ef0=this[_0xd6fa('0xf')]['exec']('MRCPSynth',_0x1b0634);if(_0x126ef0[_0xd6fa('0xb5')]===-0x1){return _0x126ef0;}return this[_0xd6fa('0xf')][_0xd6fa('0xb4')](util['format'](_0xd6fa('0xb6'),_0x1b0634));};AGIVertices[_0xd6fa('0x10')][_0xd6fa('0xb7')]=function(_0x2af09e){logger['info'](util[_0xd6fa('0x28')]('Enter\x20in\x20MRCPRecog\x20(%s)\x20block',_0x2af09e[_0xd6fa('0x38')]));if(!this[_0xd6fa('0x91')](_0x2af09e[_0xd6fa('0xb8')])){return this[_0xd6fa('0xf')]['noop'](_0xd6fa('0xb9'));}var _0x31b69e=_0x2af09e[_0xd6fa('0xb8')];if(this[_0xd6fa('0x91')](_0x2af09e[_0xd6fa('0x84')])){_0x31b69e+=','+_0x2af09e[_0xd6fa('0x84')];}var _0x5a1cdb=this['channel'][_0xd6fa('0x60')](_0xd6fa('0xba'),_0x31b69e);if(_0x5a1cdb[_0xd6fa('0xb5')]===-0x1){return _0x5a1cdb;}var _0x2ed5c3=this[_0xd6fa('0xb0')]('RECOG_CONFIDENCE()',_0xd6fa('0xbb'));if(_0x2ed5c3[_0xd6fa('0xb5')]===-0x1){return _0x2ed5c3;}var _0x531dd7=this['getAndSetVariable']('RECOG_INPUT()',_0xd6fa('0xbc'));if(_0x531dd7['result']===-0x1){return _0x531dd7;}var _0x26bc5e=this[_0xd6fa('0xb0')](_0xd6fa('0xbd'),_0xd6fa('0xbe'));if(_0x26bc5e[_0xd6fa('0xb5')]===-0x1){return _0x26bc5e;}return this['channel']['noop'](util[_0xd6fa('0x28')](_0xd6fa('0xbf'),_0x31b69e));};AGIVertices[_0xd6fa('0x10')][_0xd6fa('0x8')]=function(_0x46c077){logger[_0xd6fa('0x2d')](util[_0xd6fa('0x28')](_0xd6fa('0xc0'),_0x46c077[_0xd6fa('0x38')]));return this[_0xd6fa('0xf')]['agi']([_0x46c077[_0xd6fa('0xc1')],_0x46c077['args']]);};AGIVertices[_0xd6fa('0x10')][_0xd6fa('0xc2')]=function(_0x35f9a5){logger[_0xd6fa('0x2d')](util[_0xd6fa('0x28')](_0xd6fa('0xc3'),_0x35f9a5[_0xd6fa('0x38')]));if(this[_0xd6fa('0x91')](_0x35f9a5['timeout'])){logger['info'](util['format']('Wait\x20%s\x20seconds\x20before\x20answer',_0x35f9a5[_0xd6fa('0x71')]));var _0x11afa9=this[_0xd6fa('0xf')][_0xd6fa('0xc4')](_0x35f9a5[_0xd6fa('0x71')]);if(_0x11afa9['result']===-0x1){return _0x11afa9;}}return this['channel'][_0xd6fa('0xc2')]();};AGIVertices[_0xd6fa('0x10')][_0xd6fa('0x4a')]=function(_0x5d7e25){logger['info'](util[_0xd6fa('0x28')]('Enter\x20in\x20CALLBACK\x20(%s)\x20block',_0x5d7e25[_0xd6fa('0x38')]));if(!this['isConfigured'](_0x5d7e25[_0xd6fa('0x49')])){return this[_0xd6fa('0xf')][_0xd6fa('0x2b')](_0x5d7e25,'no\x20list\x20selected');}_0x5d7e25['scheduledAt']=moment();if(this[_0xd6fa('0x91')](_0x5d7e25[_0xd6fa('0xc5')])){_0x5d7e25['scheduledAt']=moment()['add'](_0x5d7e25['delay'],_0xd6fa('0x53'));}if(!this[_0xd6fa('0x91')](_0x5d7e25[_0xd6fa('0x4b')])){_0x5d7e25[_0xd6fa('0x4b')]=0x2;}this[_0xd6fa('0x43')][_0xd6fa('0x7d')](this,_0x5d7e25);return this[_0xd6fa('0xf')][_0xd6fa('0xb4')](util[_0xd6fa('0x28')]('CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s',_0x5d7e25[_0xd6fa('0x4f')],_0x5d7e25[_0xd6fa('0x49')],_0x5d7e25[_0xd6fa('0xc6')]));};AGIVertices[_0xd6fa('0x10')][_0xd6fa('0xc7')]=function(_0x4adddd){logger[_0xd6fa('0x2d')](util[_0xd6fa('0x28')](_0xd6fa('0xc8'),_0x4adddd['label']));var _0x376c4d=this[_0xd6fa('0xf')]['exec'](_0x4adddd[_0xd6fa('0xc9')],_0x4adddd[_0xd6fa('0x84')]);if(_0x376c4d[_0xd6fa('0xb5')]===-0x1){return _0x376c4d;}return this[_0xd6fa('0xf')]['noop'](util['format'](_0xd6fa('0xca'),_0x4adddd[_0xd6fa('0xc9')],_0x4adddd['options']));};AGIVertices[_0xd6fa('0x10')][_0xd6fa('0xcb')]=function(_0x2ba79e){logger[_0xd6fa('0x2d')](util[_0xd6fa('0x28')](_0xd6fa('0xcc'),_0x2ba79e[_0xd6fa('0x38')]));if(!this[_0xd6fa('0x91')](_0x2ba79e['text'])){return this[_0xd6fa('0xf')][_0xd6fa('0xb4')](_0xd6fa('0xcd'));}var _0x34a35b='\x22'+_0x2ba79e[_0xd6fa('0x66')]+'\x22';if(this[_0xd6fa('0x91')](_0x2ba79e['options'])){_0x34a35b+=','+_0x2ba79e[_0xd6fa('0x84')];}var _0x5a0cd8=this[_0xd6fa('0xf')][_0xd6fa('0x60')]('MRCPSynth',_0x34a35b);if(_0x5a0cd8[_0xd6fa('0xb5')]===-0x1){return _0x5a0cd8;}return this['channel'][_0xd6fa('0xb4')](util['format']('Executed\x20command\x20MRCPSynth\x20%s',_0x34a35b));};AGIVertices[_0xd6fa('0x10')][_0xd6fa('0xce')]=function(_0x4ac692){logger[_0xd6fa('0x2d')](util[_0xd6fa('0x28')](_0xd6fa('0xcf'),_0x4ac692[_0xd6fa('0x38')]));if(!this['isConfigured'](_0x4ac692[_0xd6fa('0x66')])){return this[_0xd6fa('0xf')][_0xd6fa('0xb4')](_0xd6fa('0xcd'));}var _0x32cfe2='\x22'+_0x4ac692[_0xd6fa('0x66')]+'\x22';if(this[_0xd6fa('0x91')](_0x4ac692[_0xd6fa('0x84')])){_0x32cfe2+=','+_0x4ac692['options'];}var _0x45c84e=this['channel'][_0xd6fa('0x60')](_0xd6fa('0xd0'),_0x32cfe2);if(_0x45c84e['result']===-0x1){return _0x45c84e;}return this['channel'][_0xd6fa('0xb4')](util[_0xd6fa('0x28')](_0xd6fa('0xb6'),_0x32cfe2));};AGIVertices[_0xd6fa('0x10')][_0xd6fa('0xd1')]=function(_0x41ad4f){logger[_0xd6fa('0x2d')](util[_0xd6fa('0x28')]('Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block',_0x41ad4f[_0xd6fa('0x38')]));if(!this[_0xd6fa('0x91')](_0x41ad4f[_0xd6fa('0xb8')])){return this['channel']['noop'](_0xd6fa('0xb9'));}var _0x52eb00=_0x41ad4f[_0xd6fa('0xb8')];if(this[_0xd6fa('0x91')](_0x41ad4f[_0xd6fa('0x84')])){_0x52eb00+=','+_0x41ad4f[_0xd6fa('0x84')];}var _0x4938a9=this[_0xd6fa('0xf')][_0xd6fa('0x60')](_0xd6fa('0xba'),_0x52eb00);if(_0x4938a9[_0xd6fa('0xb5')]===-0x1){return _0x4938a9;}var _0x6c1ffd=this['getAndSetVariable'](_0xd6fa('0xd2'),'LUMENVOX_ASR_CONFIDENCE');if(_0x6c1ffd[_0xd6fa('0xb5')]===-0x1){return _0x6c1ffd;}var _0x14f816=this[_0xd6fa('0xb0')](_0xd6fa('0xd3'),_0xd6fa('0xd4'));if(_0x14f816[_0xd6fa('0xb5')]===-0x1){return _0x14f816;}var _0x3ab46e=this[_0xd6fa('0xb0')](_0xd6fa('0xbd'),_0xd6fa('0xd5'));if(_0x3ab46e['result']===-0x1){return _0x3ab46e;}return this[_0xd6fa('0xf')][_0xd6fa('0xb4')](util[_0xd6fa('0x28')](_0xd6fa('0xbf'),_0x52eb00));};AGIVertices[_0xd6fa('0x10')]['sestekasr']=function(_0x5e8e90){logger['info'](util[_0xd6fa('0x28')](_0xd6fa('0xd6'),_0x5e8e90[_0xd6fa('0x38')]));if(!this['isConfigured'](_0x5e8e90[_0xd6fa('0xb8')])){return this[_0xd6fa('0xf')]['noop'](_0xd6fa('0xb9'));}var _0x4003ee=_0x5e8e90[_0xd6fa('0xb8')];if(this[_0xd6fa('0x91')](_0x5e8e90['options'])){_0x4003ee+=','+_0x5e8e90[_0xd6fa('0x84')];}var _0xee99a=this[_0xd6fa('0xf')][_0xd6fa('0x60')]('MRCPRecog',_0x4003ee);if(_0xee99a[_0xd6fa('0xb5')]===-0x1){return _0xee99a;}var _0x4fa9e3=this['getAndSetVariable'](_0xd6fa('0xd2'),_0xd6fa('0xd7'));if(_0x4fa9e3[_0xd6fa('0xb5')]===-0x1){return _0x4fa9e3;}var _0x546640=this[_0xd6fa('0xb0')]('RECOG_INPUT()','SESTEK_ASR_TRANSCRIPT');if(_0x546640[_0xd6fa('0xb5')]===-0x1){return _0x546640;}var _0x3c550f=this['getAndSetVariable'](_0xd6fa('0xbd'),_0xd6fa('0xd8'));if(_0x3c550f[_0xd6fa('0xb5')]===-0x1){return _0x3c550f;}return this[_0xd6fa('0xf')][_0xd6fa('0xb4')](util['format'](_0xd6fa('0xbf'),_0x4003ee));};AGIVertices[_0xd6fa('0x10')][_0xd6fa('0xd9')]=function(_0x52d1a1){logger[_0xd6fa('0x2d')](util[_0xd6fa('0x28')](_0xd6fa('0xda'),_0x52d1a1[_0xd6fa('0x38')]));if(!this[_0xd6fa('0x91')](_0x52d1a1[_0xd6fa('0xdb')])){return this['channel'][_0xd6fa('0x2b')](_0x52d1a1,_0xd6fa('0xdc'));}var _0x9a3c8e=this[_0xd6fa('0x18')][_0xd6fa('0x7d')](this,_0x52d1a1['odbc_id']);if(!_0x9a3c8e){return this['channel'][_0xd6fa('0x2b')](_0x52d1a1,_0xd6fa('0xdd'));}if(!this[_0xd6fa('0x91')](_0x52d1a1[_0xd6fa('0x2f')])){return this[_0xd6fa('0xf')]['error'](_0x52d1a1,'no\x20query\x20configured');}var _0x4d6bc4=_0x52d1a1[_0xd6fa('0x2f')][_0xd6fa('0x62')](/(\r\n|\n|\r)/gm,'\x20');this['channel'][_0xd6fa('0xb4')](util[_0xd6fa('0x28')]('query:\x20%s',_0x4d6bc4));var _0x4c89f7=this[_0xd6fa('0x29')][_0xd6fa('0x7d')](this,_0x9a3c8e,_0x4d6bc4);this[_0xd6fa('0x36')]['sync'](this,_0x52d1a1,_0x4d6bc4);if(!this['isConfigured'](_0x52d1a1[_0xd6fa('0xde')])){return this[_0xd6fa('0xf')][_0xd6fa('0xb4')]('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x192976=this[_0xd6fa('0x11')][_0xd6fa('0x7d')](this,_0x52d1a1[_0xd6fa('0xde')]);if(!_0x192976){return this[_0xd6fa('0xf')][_0xd6fa('0x2b')](_0x52d1a1,'no\x20variable\x20found');}var _0x109bcc=this;_0x4c89f7[_0xd6fa('0xdf')](function(_0x1bffb4,_0x18d4a2){Object['keys'](_0x1bffb4)['forEach'](function(_0x231cf1){_0x109bcc['channel'][_0xd6fa('0xab')](util['format'](_0xd6fa('0xe0'),_0x192976,_0x18d4a2,_0x231cf1),_0x1bffb4[_0x231cf1]);});});this[_0xd6fa('0xf')][_0xd6fa('0xab')](util[_0xd6fa('0x28')](_0xd6fa('0xe1'),_0x192976),_0x4c89f7[_0xd6fa('0xa8')]);return this[_0xd6fa('0xf')]['noop'](util['format'](_0xd6fa('0xe2'),_0x192976));};AGIVertices[_0xd6fa('0x10')][_0xd6fa('0xe3')]=function(_0x2db0b3){logger[_0xd6fa('0xe4')](util[_0xd6fa('0x28')](_0xd6fa('0xe5'),_0x2db0b3['label']));if(!this['isConfigured'](_0x2db0b3[_0xd6fa('0xe6')])){return this['channel'][_0xd6fa('0x2b')](_0x2db0b3,'no\x20user\x20selected');}var _0x1365d9=this['getUser']['sync'](this,_0x2db0b3[_0xd6fa('0xe6')]);if(!_0x1365d9){return this[_0xd6fa('0xf')][_0xd6fa('0x2b')](_0x2db0b3,'no\x20user\x20found');}var _0x358867=this[_0xd6fa('0xf')][_0xd6fa('0x60')]('DIAL',[util[_0xd6fa('0x28')](_0xd6fa('0xe7'),_0x1365d9),_0x2db0b3[_0xd6fa('0x71')],_0x2db0b3['opts'],_0x2db0b3[_0xd6fa('0x70')]]);if(_0x358867[_0xd6fa('0xb5')]===-0x1){return _0x358867;}return this[_0xd6fa('0xf')][_0xd6fa('0xb4')](util[_0xd6fa('0x28')]('Executed\x20command\x20%s','DIAL'));};AGIVertices[_0xd6fa('0x10')][_0xd6fa('0xe8')]=function(_0x3386c8){logger[_0xd6fa('0x2d')](util[_0xd6fa('0x28')](_0xd6fa('0xe9'),_0x3386c8[_0xd6fa('0x38')]));if(!this[_0xd6fa('0x91')](_0x3386c8[_0xd6fa('0x86')])){return this[_0xd6fa('0xf')][_0xd6fa('0xb4')](_0xd6fa('0xea'));}if(!this[_0xd6fa('0x91')](_0x3386c8['text'])){return this[_0xd6fa('0xf')][_0xd6fa('0xb4')](_0xd6fa('0xcd'));}this[_0xd6fa('0xf')][_0xd6fa('0xeb')]=!![];this[_0xd6fa('0x36')](_0x3386c8);this[_0xd6fa('0x42')](_0x3386c8[_0xd6fa('0x66')],'in','','');this[_0xd6fa('0xf')][_0xd6fa('0xb4')](util[_0xd6fa('0x28')](_0xd6fa('0xec'),_0x3386c8['text']));var _0x59c9ca=this[_0xd6fa('0x85')][_0xd6fa('0x7d')](this,_0x3386c8);if(_0x59c9ca){for(var _0x4127c2 in _0x59c9ca){if(_0x59c9ca[_0xd6fa('0xa1')](_0x4127c2)){this[_0xd6fa('0xf')][_0xd6fa('0xab')](util[_0xd6fa('0x28')](_0xd6fa('0xed'),_0x4127c2['toUpperCase']()),_0x59c9ca[_0x4127c2]);}}this[_0xd6fa('0x42')](_0x59c9ca['speech'],_0xd6fa('0xee'),_0xd6fa('0xe8'),'');return this[_0xd6fa('0xf')]['noop'](util[_0xd6fa('0x28')]('Dialogflow\x20Result\x20%s',_0x59c9ca[_0xd6fa('0xef')]));}return this[_0xd6fa('0xf')]['error'](_0x3386c8,_0xd6fa('0xf0'));};AGIVertices[_0xd6fa('0x10')][_0xd6fa('0xf1')]=function(_0x12413b){logger[_0xd6fa('0x2d')](util[_0xd6fa('0x28')](_0xd6fa('0xf2'),_0x12413b['label']));if(!this[_0xd6fa('0x91')](_0x12413b[_0xd6fa('0x89')])){return this[_0xd6fa('0xf')][_0xd6fa('0xb4')](_0xd6fa('0xf3'));}if(!this['isConfigured'](_0x12413b['client_email'])){return this[_0xd6fa('0xf')][_0xd6fa('0xb4')](_0xd6fa('0xf4'));}if(!this[_0xd6fa('0x91')](_0x12413b[_0xd6fa('0xf5')])){return this['channel'][_0xd6fa('0xb4')]('no\x20private_key\x20configured');}if(!this['isConfigured'](_0x12413b[_0xd6fa('0x8b')])){return this[_0xd6fa('0xf')][_0xd6fa('0xb4')]('no\x20anguage\x20configured');}if(!this['isConfigured'](_0x12413b['text'])){return this[_0xd6fa('0xf')][_0xd6fa('0xb4')]('no\x20text\x20configured');}this[_0xd6fa('0xf')][_0xd6fa('0xeb')]=!![];this['createSquareDetailsReport'](_0x12413b);this[_0xd6fa('0x42')](_0x12413b[_0xd6fa('0x66')],'in','','');this[_0xd6fa('0xf')][_0xd6fa('0xb4')](util[_0xd6fa('0x28')](_0xd6fa('0xf6'),_0x12413b[_0xd6fa('0x66')]));var _0x2ceb10=this[_0xd6fa('0x88')]['sync'](this,_0x12413b);if(_0x2ceb10){for(var _0x5395c5 in _0x2ceb10){if(_0x2ceb10['hasOwnProperty'](_0x5395c5)){if(_0x5395c5!==_0xd6fa('0xf7')){this['channel']['setVariable'](util[_0xd6fa('0x28')](_0xd6fa('0xed'),_0x5395c5[_0xd6fa('0x76')]()),_0x2ceb10[_0x5395c5]);}}}this[_0xd6fa('0x42')](_0x2ceb10['speech'],'out',_0xd6fa('0xf1'),_0x2ceb10[_0xd6fa('0xf7')]);return this[_0xd6fa('0xf')]['noop'](util[_0xd6fa('0x28')](_0xd6fa('0xf8'),_0x2ceb10[_0xd6fa('0xef')]));}return this[_0xd6fa('0xf')]['error'](_0x12413b,_0xd6fa('0xf9'));};AGIVertices['prototype'][_0xd6fa('0xfa')]=function(_0x1cc4e1){logger[_0xd6fa('0x2d')](util['format'](_0xd6fa('0xfb'),_0x1cc4e1[_0xd6fa('0x38')]));if(!this[_0xd6fa('0x91')](_0x1cc4e1[_0xd6fa('0xfc')])){return this[_0xd6fa('0xf')][_0xd6fa('0xb4')](_0xd6fa('0xfd'));}if(!this[_0xd6fa('0x91')](_0x1cc4e1[_0xd6fa('0xfe')])){return this[_0xd6fa('0xf')]['noop'](_0xd6fa('0xff'));}if(!this['isConfigured'](_0x1cc4e1[_0xd6fa('0x100')])){return this[_0xd6fa('0xf')][_0xd6fa('0xb4')]('no\x20password\x20configured');}if(!this[_0xd6fa('0x91')](_0x1cc4e1[_0xd6fa('0x101')])){return this['channel'][_0xd6fa('0xb4')](_0xd6fa('0xcd'));}this[_0xd6fa('0xf')][_0xd6fa('0xeb')]=!![];this[_0xd6fa('0x36')](_0x1cc4e1);this[_0xd6fa('0x42')](_0x1cc4e1[_0xd6fa('0x66')],'in','','');this[_0xd6fa('0xf')][_0xd6fa('0xb4')](util[_0xd6fa('0x28')](_0xd6fa('0x102'),_0x1cc4e1[_0xd6fa('0x66')]));var _0x31dd9d=this[_0xd6fa('0x8c')][_0xd6fa('0x7d')](this,_0x1cc4e1);if(_0x31dd9d){for(var _0x225d55 in _0x31dd9d){if(_0x31dd9d['hasOwnProperty'](_0x225d55)){this['channel'][_0xd6fa('0xab')](util['format'](_0xd6fa('0x103'),_0x225d55[_0xd6fa('0x76')]()),_0x31dd9d[_0x225d55]);}}this[_0xd6fa('0x42')](_0x31dd9d['speech'],_0xd6fa('0xee'),_0xd6fa('0xfa'),'');if(_0x31dd9d[_0xd6fa('0x104')]){this[_0xd6fa('0xf')]['noop'](util[_0xd6fa('0x28')]('Sestek\x20NDA\x20%s\x20file\x20created',_0x31dd9d['audiofile']));var _0x5de579=this[_0xd6fa('0xf')][_0xd6fa('0x105')](_0x31dd9d[_0xd6fa('0x104')]);try{fs[_0xd6fa('0x106')](_0x31dd9d[_0xd6fa('0x104')]+_0xd6fa('0x107'));}catch(_0x2b6819){logger[_0xd6fa('0x2b')](_0x2b6819);}return _0x5de579;}else{return this['channel'][_0xd6fa('0xb4')](util[_0xd6fa('0x28')](_0xd6fa('0x108'),_0x31dd9d[_0xd6fa('0xef')]));}}return this['channel']['error'](_0x1cc4e1,'SestekNDA\x20is\x20unreachable');};AGIVertices[_0xd6fa('0x10')][_0xd6fa('0x109')]=function(_0x5a4245){logger[_0xd6fa('0x2d')](util[_0xd6fa('0x28')](_0xd6fa('0x10a'),_0x5a4245[_0xd6fa('0x38')]));return this[_0xd6fa('0xf')][_0xd6fa('0xb4')](_0xd6fa('0x109'));};AGIVertices['prototype']['ext_dial']=function(_0xa21f6){logger[_0xd6fa('0x2d')](util[_0xd6fa('0x28')](_0xd6fa('0x10b'),_0xa21f6[_0xd6fa('0x38')]));var _0x4c0647='';if(_0xa21f6[_0xd6fa('0x10c')]){if(!this[_0xd6fa('0x91')](_0xa21f6[_0xd6fa('0x10c')])){return this[_0xd6fa('0xf')][_0xd6fa('0x2b')](_0xa21f6,'no\x20trunk\x20selected');}else{var _0x3d0361=parseInt(_0xa21f6[_0xd6fa('0x10c')],0xa);if(isNaN(_0x3d0361)){_0x4c0647=_0xa21f6['trunk_id'];}else{_0x4c0647=this[_0xd6fa('0x1d')][_0xd6fa('0x7d')](this,_0xa21f6[_0xd6fa('0x10c')]);if(!_0x4c0647){return this[_0xd6fa('0xf')]['error'](_0xa21f6,'no\x20trunk\x20found');}}}}else if(_0xa21f6[_0xd6fa('0x10d')]){_0x4c0647=_0xa21f6[_0xd6fa('0x10d')];}else{return this[_0xd6fa('0xf')][_0xd6fa('0x2b')](_0xa21f6,'no\x20trunk\x20selected');}var _0x227954=this[_0xd6fa('0xf')][_0xd6fa('0x60')]('DIAL',[util[_0xd6fa('0x28')](_0xd6fa('0x10e'),_0x4c0647,_0xa21f6['phone']),_0xa21f6['timeout'],_0xa21f6[_0xd6fa('0x10f')],_0xa21f6[_0xd6fa('0x70')]]);if(_0x227954[_0xd6fa('0xb5')]===-0x1){return _0x227954;}return this['channel'][_0xd6fa('0xb4')](util['format'](_0xd6fa('0x110'),_0xd6fa('0x111')));};AGIVertices[_0xd6fa('0x10')][_0xd6fa('0x112')]=function(_0x121911){logger['info'](util[_0xd6fa('0x28')]('Enter\x20in\x20FINALLY\x20(%s)\x20block',_0x121911[_0xd6fa('0x38')]));return this[_0xd6fa('0xf')]['noop'](_0xd6fa('0x112'));};AGIVertices['prototype']['getdigits']=function(_0x42bc0a){logger['info'](util[_0xd6fa('0x28')](_0xd6fa('0x113'),_0x42bc0a[_0xd6fa('0x38')]));if(_0x42bc0a[_0xd6fa('0xb3')]===0x0){return this[_0xd6fa('0xb2')](_0x42bc0a);}_0x42bc0a['retry']-=0x1;if(!this['isConfigured'](_0x42bc0a['file_id'])){return this[_0xd6fa('0xf')][_0xd6fa('0x2b')](_0x42bc0a,_0xd6fa('0x114'));}var _0x1a90bd=this[_0xd6fa('0x115')]['sync'](this,_0x42bc0a[_0xd6fa('0x116')]);if(!_0x1a90bd){return this['channel'][_0xd6fa('0x2b')](_0x42bc0a,_0xd6fa('0x117'));}if(!this[_0xd6fa('0x91')](_0x42bc0a[_0xd6fa('0xde')])){return this[_0xd6fa('0xf')][_0xd6fa('0x2b')](_0xd6fa('0x118'));}var _0xdf0b7b=this['channel'][_0xd6fa('0x119')](_0x1a90bd,_0x42bc0a[_0xd6fa('0x11a')],_0x42bc0a[_0xd6fa('0x11b')]);var _0x3459f0=_0xdf0b7b[_0xd6fa('0xb5')]?_0xdf0b7b[_0xd6fa('0xb5')][_0xd6fa('0xaf')]():'';logger[_0xd6fa('0x2d')](_0xd6fa('0x11c'),JSON[_0xd6fa('0x80')](_0xdf0b7b));if(_0xdf0b7b[_0xd6fa('0xb5')]===-0x1){this[_0xd6fa('0x36')][_0xd6fa('0x7d')](this,_0x42bc0a,_0x3459f0);return _0xdf0b7b;}else if(_0xdf0b7b[_0xd6fa('0xae')]===_0xd6fa('0x71')){_0xdf0b7b['result']=_0x3459f0[_0xd6fa('0xa8')]>=parseInt(_0x42bc0a[_0xd6fa('0x11d')])?'x':'i';}else{_0xdf0b7b[_0xd6fa('0xb5')]=_0x3459f0[_0xd6fa('0xa8')]>=parseInt(_0x42bc0a[_0xd6fa('0x11d')])&&_0x3459f0['length']<=parseInt(_0x42bc0a[_0xd6fa('0x11b')])?'x':'i';}var _0x3396a2=this['getVariable'][_0xd6fa('0x7d')](this,_0x42bc0a[_0xd6fa('0xde')]);if(!_0x3396a2){return this[_0xd6fa('0xf')][_0xd6fa('0x2b')](_0x42bc0a,'no\x20variable\x20found');}this[_0xd6fa('0xf')][_0xd6fa('0xab')](_0x3396a2,_0x3459f0);if(this[_0xd6fa('0x91')](_0x42bc0a[_0xd6fa('0x11e')])){var _0x2aac08=parseInt(_0x42bc0a['hiddendigitsnum'],0xa);var _0x158b31=rs[_0xd6fa('0x11f')]({'charset':'*','length':_0x2aac08});var _0x259c88=_0x3459f0[_0xd6fa('0xa8')];if(_0x259c88>0x0){if(_0x259c88>_0x2aac08){this['createSquareDetailsReport']['sync'](this,_0x42bc0a,_0x42bc0a[_0xd6fa('0x120')]===_0xd6fa('0x121')?_0x158b31+_0x3459f0[_0xd6fa('0x122')](_0x2aac08):_0x3459f0[_0xd6fa('0x122')](0x0,_0x259c88-_0x2aac08)+_0x158b31);}else{this[_0xd6fa('0x36')]['sync'](this,_0x42bc0a,rs[_0xd6fa('0x11f')]({'charset':'*','length':_0x259c88}));}}else{this[_0xd6fa('0x36')][_0xd6fa('0x7d')](this,_0x42bc0a,'');}}else{this[_0xd6fa('0x36')][_0xd6fa('0x7d')](this,_0x42bc0a,_0x3459f0);}return _0xdf0b7b;};AGIVertices[_0xd6fa('0x10')]['getsecretdigits']=function(_0x432f56){logger[_0xd6fa('0x2d')](util[_0xd6fa('0x28')](_0xd6fa('0x123'),_0x432f56['label']));return this[_0xd6fa('0x124')](_0x432f56);};AGIVertices['prototype'][_0xd6fa('0x125')]=function(_0x1b1f17){logger[_0xd6fa('0x2d')](util[_0xd6fa('0x28')](_0xd6fa('0x126'),_0x1b1f17[_0xd6fa('0x38')]));this[_0xd6fa('0x36')][_0xd6fa('0x7d')](this,_0x1b1f17,_0x1b1f17['goalname']);return this[_0xd6fa('0xf')][_0xd6fa('0xb4')](util['format'](_0xd6fa('0x127'),_0x1b1f17['goalname']));};AGIVertices[_0xd6fa('0x10')]['awspolly']=function(_0x31fde5){logger['info'](util[_0xd6fa('0x28')]('[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block',_0x31fde5[_0xd6fa('0x38')]));if(!this[_0xd6fa('0x91')](_0x31fde5[_0xd6fa('0x94')])||!this[_0xd6fa('0x91')](_0x31fde5[_0xd6fa('0x95')])){return this[_0xd6fa('0xf')][_0xd6fa('0xb4')](_0xd6fa('0x128'));}if(!this['isConfigured'](_0x31fde5[_0xd6fa('0x66')])){return this[_0xd6fa('0xf')][_0xd6fa('0xb4')]('no\x20text\x20configured');}this['channel'][_0xd6fa('0xb4')](util[_0xd6fa('0x28')](_0xd6fa('0x129'),_0x31fde5[_0xd6fa('0x66')]));var _0x34df1e=this[_0xd6fa('0x93')]['sync'](this,_0x31fde5);if(_0x34df1e){this[_0xd6fa('0xf')][_0xd6fa('0xb4')](util[_0xd6fa('0x28')](_0xd6fa('0x12a'),_0x34df1e));var _0x5a5ed8=this[_0xd6fa('0xf')][_0xd6fa('0x105')](_0x34df1e);try{fs[_0xd6fa('0x106')](_0x34df1e+'.wav');}catch(_0x559f17){logger[_0xd6fa('0x2b')](_0x559f17);}return _0x5a5ed8;}return this[_0xd6fa('0xf')][_0xd6fa('0x2b')](_0x31fde5,'aws\x20Polly\x20is\x20unreachable');};AGIVertices[_0xd6fa('0x10')][_0xd6fa('0x12b')]=function(_0x2d0f76){logger[_0xd6fa('0x2d')](util['format'](_0xd6fa('0x12c'),_0x2d0f76['label']));if(!this[_0xd6fa('0x91')](_0x2d0f76[_0xd6fa('0x94')])||!this[_0xd6fa('0x91')](_0x2d0f76[_0xd6fa('0x95')])){return this['channel'][_0xd6fa('0xb4')](_0xd6fa('0x128'));}if(!this[_0xd6fa('0x91')](_0x2d0f76[_0xd6fa('0x9b')])){return this[_0xd6fa('0xf')][_0xd6fa('0xb4')](_0xd6fa('0x12d'));}if(!this[_0xd6fa('0x91')](_0x2d0f76['text'])){return this['channel'][_0xd6fa('0xb4')](_0xd6fa('0xcd'));}this[_0xd6fa('0xf')]['bot']=!![];this[_0xd6fa('0x36')](_0x2d0f76);this['createSquareMessage'](_0x2d0f76[_0xd6fa('0x66')],'in','','');this['channel'][_0xd6fa('0xb4')](util[_0xd6fa('0x28')]('Trying\x20Amazon\x20Lex:\x20%s',_0x2d0f76['text']));var _0x125794=this[_0xd6fa('0x99')][_0xd6fa('0x7d')](this,_0x2d0f76);if(_0x125794){for(var _0x4e9b95 in _0x125794){if(_0x125794[_0xd6fa('0xa1')](_0x4e9b95)&&_[_0xd6fa('0xa2')](_0x125794[_0x4e9b95])){this['channel'][_0xd6fa('0xab')](util[_0xd6fa('0x28')](_0xd6fa('0x12e'),_0x4e9b95[_0xd6fa('0x76')]()),_0x125794[_0x4e9b95]);}}if(_[_0xd6fa('0x45')](_0x125794['message'])){return this['channel'][_0xd6fa('0xb4')](_0xd6fa('0x12f'));}else{this['createSquareMessage'](_0x125794['message'],'out',_0xd6fa('0x130'),'');return this['channel'][_0xd6fa('0xb4')](util['format'](_0xd6fa('0x131'),_0x125794[_0xd6fa('0x82')]));}}return this[_0xd6fa('0xf')][_0xd6fa('0x2b')](_0x2d0f76,_0xd6fa('0x132'));};AGIVertices[_0xd6fa('0x10')][_0xd6fa('0x133')]=function(_0x59847c){logger['info'](util[_0xd6fa('0x28')]('Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s',_0x59847c[_0xd6fa('0x38')],_0x59847c[_0xd6fa('0x71')]));if(!this[_0xd6fa('0x91')](_0x59847c['key'])){return this['channel'][_0xd6fa('0xb4')]('no\x20key\x20configured');}var _0x4d4092=_0xd6fa('0x134');var _0x3bc2f6=util[_0xd6fa('0x28')](_0xd6fa('0x135'),FILES_PATH,rs[_0xd6fa('0x11f')](0x4));var _0x3b5751=util[_0xd6fa('0x28')](_0xd6fa('0xaa'),_0x3bc2f6,_0x4d4092);var _0xbdce1c=!![];if(_0x59847c[_0xd6fa('0x136')]===_0xd6fa('0x137')){_0xbdce1c=![];}var _0x3f8548=this['channel'][_0xd6fa('0x138')](_0x3bc2f6,_0x4d4092,_0x59847c[_0xd6fa('0x139')],_0x59847c[_0xd6fa('0x71')],undefined,_0xbdce1c);if(_0x3f8548['result']!==-0x1){this['channel'][_0xd6fa('0xb4')](util[_0xd6fa('0x28')](_0xd6fa('0x13a'),_0x3b5751));var _0x560e14=this[_0xd6fa('0x9c')][_0xd6fa('0x7d')](this,_0x59847c,_0x3b5751);if(_0x560e14){for(var _0x34b4ab in _0x560e14){if(_0x560e14[_0xd6fa('0xa1')](_0x34b4ab)){this[_0xd6fa('0xf')][_0xd6fa('0xab')](util[_0xd6fa('0x28')](_0xd6fa('0x13b'),_0x34b4ab['toUpperCase']()),_0x560e14[_0x34b4ab]);}}return this['channel'][_0xd6fa('0xb4')](util[_0xd6fa('0x28')](_0xd6fa('0x13c'),JSON['stringify'](_0x560e14)));}}return _0x3f8548;};AGIVertices['prototype'][_0xd6fa('0x13d')]=function(_0x33d851){logger[_0xd6fa('0x2d')](util[_0xd6fa('0x28')]('Enter\x20in\x20TILDEASR\x20(%s)\x20block',_0x33d851['label']));if(!this[_0xd6fa('0x91')](_0x33d851[_0xd6fa('0x13e')])){return this[_0xd6fa('0xf')][_0xd6fa('0xb4')]('no\x20appid\x20configured');}if(!this[_0xd6fa('0x91')](_0x33d851[_0xd6fa('0x13f')])){return this[_0xd6fa('0xf')][_0xd6fa('0xb4')]('no\x20appsecret\x20configured');}var _0xa89cc7='wav';var _0x358f9e=util[_0xd6fa('0x28')]('%s/recordings/%s',FILES_PATH,rs[_0xd6fa('0x11f')](0x4));var _0x470eb8=util[_0xd6fa('0x28')](_0xd6fa('0xaa'),_0x358f9e,_0xa89cc7);var _0x22d8c7=!![];if(_0x33d851[_0xd6fa('0x136')]===_0xd6fa('0x137')){_0x22d8c7=![];}var _0x494e3a=this[_0xd6fa('0xf')][_0xd6fa('0x138')](_0x358f9e,_0xa89cc7,_0x33d851[_0xd6fa('0x139')],_0x33d851['timeout'],undefined,_0x22d8c7);if(_0x494e3a['result']!==-0x1){this[_0xd6fa('0xf')][_0xd6fa('0xb4')](util['format'](_0xd6fa('0x140'),_0x470eb8));var _0xc4e2e0=this['tildeASR']['sync'](this,_0x33d851,_0x470eb8);if(_0xc4e2e0){for(var _0x4aead4 in _0xc4e2e0){if(_0xc4e2e0[_0xd6fa('0xa1')](_0x4aead4)){this[_0xd6fa('0xf')][_0xd6fa('0xab')](util[_0xd6fa('0x28')](_0xd6fa('0x141'),_0x4aead4[_0xd6fa('0x76')]()),_0xc4e2e0[_0x4aead4]);}}return this[_0xd6fa('0xf')][_0xd6fa('0xb4')](util[_0xd6fa('0x28')]('TildeASR\x20Result\x20%s',JSON[_0xd6fa('0x80')](_0xc4e2e0)));}}return _0x494e3a;};AGIVertices[_0xd6fa('0x10')][_0xd6fa('0x142')]=function(_0x30e9e4){logger['info'](util['format'](_0xd6fa('0x143'),_0x30e9e4[_0xd6fa('0x38')]));return this[_0xd6fa('0xf')]['continueAt'](_0x30e9e4['context'],_0x30e9e4[_0xd6fa('0x3d')],_0x30e9e4[_0xd6fa('0x3e')]);};AGIVertices[_0xd6fa('0x10')][_0xd6fa('0x144')]=function(_0x2ad67f){logger['info'](util['format']('Enter\x20in\x20GOTOIF\x20(%s)\x20block',_0x2ad67f[_0xd6fa('0x38')]));if(!this[_0xd6fa('0x91')](_0x2ad67f[_0xd6fa('0x145')])){return this[_0xd6fa('0xf')]['error'](_0x2ad67f,_0xd6fa('0x146'));}try{var _0x267ad3=eval(_0x2ad67f[_0xd6fa('0x145')])?_0xd6fa('0x147'):'false';this[_0xd6fa('0xf')]['noop'](util[_0xd6fa('0x28')](_0xd6fa('0x148'),_0x2ad67f[_0xd6fa('0x145')],_0x267ad3));return{'code':0xc8,'result':_0x267ad3};}catch(_0x128a40){return{'code':0xc8,'result':_0xd6fa('0x149')};}};AGIVertices[_0xd6fa('0x10')][_0xd6fa('0x14a')]=function(_0x3eb866){logger[_0xd6fa('0x2d')](util[_0xd6fa('0x28')](_0xd6fa('0x14b'),_0x3eb866[_0xd6fa('0x38')]));if(!this['isConfigured'](_0x3eb866['interval_id'])){return this[_0xd6fa('0xf')]['error'](_0x3eb866,_0xd6fa('0x14c'));}var _0x262046=this[_0xd6fa('0x23')][_0xd6fa('0x7d')](this,_0x3eb866['interval_id']);if(!_0x262046){return this[_0xd6fa('0xf')][_0xd6fa('0x2b')](_0x3eb866,_0xd6fa('0x14d'));}for(var _0x52df30=0x0;_0x52df30<_0x262046[_0xd6fa('0xa8')];_0x52df30+=0x1){var _0x1acbe9=this[_0xd6fa('0xf')][_0xd6fa('0x11')](util['format'](_0xd6fa('0x14e'),_0x262046[_0x52df30]));if(_0x1acbe9[_0xd6fa('0xb5')]===-0x1){return _0x1acbe9;}logger[_0xd6fa('0x2d')](util[_0xd6fa('0x28')]('IFTIME\x20%s\x20%s',_0x262046[_0x52df30],_0x1acbe9[_0xd6fa('0xae')]));if(_0x1acbe9['extra']===_0xd6fa('0x147')){logger[_0xd6fa('0x2d')](util[_0xd6fa('0x28')](_0xd6fa('0x14f'),_0x262046[_0x52df30],'true'));this[_0xd6fa('0xf')][_0xd6fa('0xb4')](util[_0xd6fa('0x28')]('IFTIME\x20%s\x20%s',_0x262046[_0x52df30],'true'));return{'code':0xc8,'result':_0xd6fa('0x147')};}else{logger[_0xd6fa('0x2d')](util[_0xd6fa('0x28')](_0xd6fa('0x14f'),_0x262046[_0x52df30],'false'));this[_0xd6fa('0xf')][_0xd6fa('0xb4')](util['format'](_0xd6fa('0x14f'),_0x262046[_0x52df30],'false'));}}return{'code':0xc8,'result':_0xd6fa('0x149')};};AGIVertices['prototype'][_0xd6fa('0x150')]=function(_0x453476){logger[_0xd6fa('0x2d')](util[_0xd6fa('0x28')](_0xd6fa('0x151'),_0x453476['label']));return this['channel']['hangup']();};AGIVertices['prototype'][_0xd6fa('0x152')]=function(_0x11f4f6){logger['info'](util[_0xd6fa('0x28')](_0xd6fa('0x153'),_0x11f4f6[_0xd6fa('0x38')]));if(!this[_0xd6fa('0x91')](_0x11f4f6[_0xd6fa('0x86')])){return this[_0xd6fa('0xf')][_0xd6fa('0xb4')]('no\x20key\x20configured');}var _0x853417=_0xd6fa('0x134');var _0x5ce1c9=util[_0xd6fa('0x28')](_0xd6fa('0x135'),FILES_PATH,rs['generate'](0x4));var _0x55fbfb=util['format'](_0xd6fa('0xaa'),_0x5ce1c9,_0x853417);var _0x217379=!![];if(_0x11f4f6[_0xd6fa('0x136')]===_0xd6fa('0x137')){_0x217379=![];}var _0x3d7d70=this[_0xd6fa('0xf')][_0xd6fa('0x138')](_0x5ce1c9,_0x853417,_0x11f4f6[_0xd6fa('0x139')],_0x11f4f6[_0xd6fa('0x71')],undefined,_0x217379);if(_0x3d7d70[_0xd6fa('0xb5')]!==-0x1){this[_0xd6fa('0xf')][_0xd6fa('0xb4')](util[_0xd6fa('0x28')]('ispeech\x20%s\x20file\x20created',_0x55fbfb));var _0x32915b=this[_0xd6fa('0x90')]['sync'](this,_0x11f4f6,_0x55fbfb);if(_0x32915b){for(var _0x3ca32f in _0x32915b){if(_0x32915b[_0xd6fa('0xa1')](_0x3ca32f)){this[_0xd6fa('0xf')][_0xd6fa('0xab')](util[_0xd6fa('0x28')]('ISPEECH_ASR_%s',_0x3ca32f['toUpperCase']()),_0x32915b[_0x3ca32f]);}}return this[_0xd6fa('0xf')][_0xd6fa('0xb4')](util['format']('IspeechASR\x20Result\x20%s',JSON[_0xd6fa('0x80')](_0x32915b)));}}return _0x3d7d70;};AGIVertices[_0xd6fa('0x10')][_0xd6fa('0x154')]=function(_0x5d7995){logger['info'](util[_0xd6fa('0x28')](_0xd6fa('0x155'),_0x5d7995[_0xd6fa('0x38')]));if(!this[_0xd6fa('0x91')](_0x5d7995[_0xd6fa('0x86')])){return this[_0xd6fa('0xf')]['noop'](_0xd6fa('0xea'));}if(!this['isConfigured'](_0x5d7995[_0xd6fa('0x66')])){return this[_0xd6fa('0xf')]['noop'](_0xd6fa('0xcd'));}this['channel']['noop'](util['format'](_0xd6fa('0x156'),_0x5d7995[_0xd6fa('0x66')]));var _0x48634e=this[_0xd6fa('0x8d')][_0xd6fa('0x7d')](this,_0x5d7995);if(_0x48634e){this[_0xd6fa('0xf')][_0xd6fa('0xb4')](util[_0xd6fa('0x28')](_0xd6fa('0x157'),_0x48634e));var _0x192cd2=this[_0xd6fa('0xf')]['streamFile'](_0x48634e,_0x5d7995[_0xd6fa('0x139')]);try{fs[_0xd6fa('0x106')](_0x48634e+_0xd6fa('0x107'));}catch(_0xa9b49){logger[_0xd6fa('0x2b')](_0xa9b49);}return _0x192cd2;}return this[_0xd6fa('0xf')][_0xd6fa('0x2b')](_0x5d7995,_0xd6fa('0x158'));};AGIVertices[_0xd6fa('0x10')][_0xd6fa('0x159')]=function(_0x363fd9){logger[_0xd6fa('0x2d')](util[_0xd6fa('0x28')](_0xd6fa('0x15a'),_0x363fd9['label']));if(!this[_0xd6fa('0x91')](_0x363fd9['findBy'])){return this[_0xd6fa('0xf')]['error'](_0x363fd9,'no\x20find\x20by\x20configured');}logger['info'](util[_0xd6fa('0x28')](_0xd6fa('0x15b'),this[_0xd6fa('0xf')][_0xd6fa('0x3a')],_0x363fd9[_0xd6fa('0x15c')]));var _0xe3d161=this[_0xd6fa('0x5b')]['sync'](this,_0x363fd9['findBy']);if(_0xe3d161){logger[_0xd6fa('0x2d')](util['format'](_0xd6fa('0x15d'),this[_0xd6fa('0xf')]['callerid'],_0x363fd9[_0xd6fa('0x15c')]));this[_0xd6fa('0xf')]['noop'](util[_0xd6fa('0x28')](_0xd6fa('0x15d'),this['channel']['callerid'],_0x363fd9[_0xd6fa('0x15c')]));return{'code':0xc8,'result':_0xd6fa('0x15e')};}else{logger[_0xd6fa('0x2d')](util[_0xd6fa('0x28')](_0xd6fa('0x15f'),this[_0xd6fa('0xf')][_0xd6fa('0x3a')],_0x363fd9[_0xd6fa('0x15c')]));this[_0xd6fa('0xf')][_0xd6fa('0xb4')](util[_0xd6fa('0x28')](_0xd6fa('0x15f'),this['channel']['callerid'],_0x363fd9[_0xd6fa('0x15c')]));return{'code':0xc8,'result':_0xd6fa('0x160')};}};AGIVertices[_0xd6fa('0x10')]['logout']=function(_0x14c837){logger[_0xd6fa('0x2d')](util[_0xd6fa('0x28')](_0xd6fa('0x161'),_0x14c837[_0xd6fa('0x38')]));if(!this[_0xd6fa('0x91')](_0x14c837[_0xd6fa('0x15c')])){return this[_0xd6fa('0xf')][_0xd6fa('0x2b')](_0x14c837,_0xd6fa('0x162'));}logger[_0xd6fa('0x2d')](util[_0xd6fa('0x28')](_0xd6fa('0x15b'),this[_0xd6fa('0xf')][_0xd6fa('0x3a')],_0x14c837[_0xd6fa('0x15c')]));var _0x453196=this[_0xd6fa('0x5a')][_0xd6fa('0x7d')](this,_0x14c837['findBy']);if(_0x453196){logger['info'](util[_0xd6fa('0x28')](_0xd6fa('0x15d'),this[_0xd6fa('0xf')][_0xd6fa('0x3a')],_0x14c837[_0xd6fa('0x15c')]));this[_0xd6fa('0xf')][_0xd6fa('0xb4')](util[_0xd6fa('0x28')](_0xd6fa('0x15d'),this[_0xd6fa('0xf')][_0xd6fa('0x3a')],_0x14c837['findBy']));return{'code':0xc8,'result':_0xd6fa('0x15e')};}else{logger['info'](util[_0xd6fa('0x28')](_0xd6fa('0x15f'),this['channel']['callerid'],_0x14c837[_0xd6fa('0x15c')]));this[_0xd6fa('0xf')]['noop'](util[_0xd6fa('0x28')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0xd6fa('0xf')][_0xd6fa('0x3a')],_0x14c837[_0xd6fa('0x15c')]));return{'code':0xc8,'result':_0xd6fa('0x160')};}};AGIVertices[_0xd6fa('0x10')]['math']=function(_0x5dc004){logger[_0xd6fa('0x2d')](util[_0xd6fa('0x28')](_0xd6fa('0x163'),_0x5dc004[_0xd6fa('0x38')]));if(!this[_0xd6fa('0x91')](_0x5dc004[_0xd6fa('0x164')])){return this[_0xd6fa('0xf')][_0xd6fa('0x2b')](_0x5dc004,'no\x20operation\x20configured');}this[_0xd6fa('0xf')][_0xd6fa('0xb4')](util[_0xd6fa('0x28')](_0xd6fa('0x165'),_0x5dc004[_0xd6fa('0x164')]));var _0x3ab03b=eval(_0x5dc004[_0xd6fa('0x164')]);if(!this[_0xd6fa('0x91')](_0x5dc004[_0xd6fa('0xde')])){return this[_0xd6fa('0xf')]['noop'](_0xd6fa('0x118'));}var _0x1effe2=this[_0xd6fa('0x11')]['sync'](this,_0x5dc004[_0xd6fa('0xde')]);if(!_0x1effe2){return this['channel'][_0xd6fa('0x2b')](_0x5dc004,_0xd6fa('0x166'));}if(_[_0xd6fa('0xa7')](_0x3ab03b)){var _0x335d2a=this;_0x3ab03b['forEach'](function(_0x29bf9a,_0x332ec8){_0x335d2a[_0xd6fa('0xf')][_0xd6fa('0xab')](util[_0xd6fa('0x28')]('%s[%s]',_0x1effe2,_0x332ec8),_0x29bf9a);});return this[_0xd6fa('0xf')]['noop'](util[_0xd6fa('0x28')](_0xd6fa('0x167'),_0x1effe2));}else{return this[_0xd6fa('0xf')]['setVariable'](_0x1effe2,_0x3ab03b);}};AGIVertices['prototype'][_0xd6fa('0xd')]=function(_0x4cf618){logger[_0xd6fa('0x2d')](util[_0xd6fa('0x28')](_0xd6fa('0x168'),_0x4cf618[_0xd6fa('0x38')]));if(_0x4cf618[_0xd6fa('0xb3')]===0x0){return this['maxRetry'](_0x4cf618);}_0x4cf618['retry']-=0x1;if(!this[_0xd6fa('0x91')](_0x4cf618[_0xd6fa('0x116')])){return this[_0xd6fa('0xf')][_0xd6fa('0x2b')](_0x4cf618,_0xd6fa('0x114'));}var _0x1bf803=this['getSound'][_0xd6fa('0x7d')](this,_0x4cf618[_0xd6fa('0x116')]);if(!_0x1bf803){return this[_0xd6fa('0xf')][_0xd6fa('0x2b')](_0x4cf618,_0xd6fa('0x117'));}var _0x5f3660=this[_0xd6fa('0xf')]['getData'](_0x1bf803,_0x4cf618[_0xd6fa('0x11a')],_0x4cf618[_0xd6fa('0x169')]);var _0x26bdc=_0x5f3660[_0xd6fa('0xb5')];if(_0x5f3660['result']===-0x1){this['createSquareDetailsReport'][_0xd6fa('0x7d')](this,_0x4cf618,'-1');return _0x5f3660;}else if(_0x5f3660[_0xd6fa('0xae')]===_0xd6fa('0x71')){_0x5f3660[_0xd6fa('0xb5')]=_0x5f3660[_0xd6fa('0xb5')][_0xd6fa('0xa8')]>0x0?_0x5f3660['result']:'t';}else if(_['isEmpty'](_0x5f3660[_0xd6fa('0xb5')])){_0x5f3660[_0xd6fa('0xb5')]='#';_0x26bdc='#';}if(!this[_0xd6fa('0x91')](_0x4cf618[_0xd6fa('0xde')])){this[_0xd6fa('0xf')][_0xd6fa('0xb4')]('no\x20variable\x20selected\x20for\x20the\x20result');}else{var _0x205a7f=this[_0xd6fa('0x11')][_0xd6fa('0x7d')](this,_0x4cf618[_0xd6fa('0xde')]);if(!_0x205a7f){return this[_0xd6fa('0xf')]['error'](_0x4cf618,_0xd6fa('0x166'));}this['channel'][_0xd6fa('0xab')](_0x205a7f,_0x26bdc);}this[_0xd6fa('0x36')]['sync'](this,_0x4cf618,_0x26bdc);return _0x5f3660;};AGIVertices[_0xd6fa('0x10')]['noop']=function(_0x18ed47){logger[_0xd6fa('0x2d')](util[_0xd6fa('0x28')](_0xd6fa('0x16a'),_0x18ed47[_0xd6fa('0x38')]));return this[_0xd6fa('0xf')]['noop'](_0x18ed47[_0xd6fa('0x16b')]||_0x18ed47[_0xd6fa('0x38')]);};AGIVertices[_0xd6fa('0x10')]['pause']=function(_0x5c9f20){logger[_0xd6fa('0x2d')](util[_0xd6fa('0x28')](_0xd6fa('0x16c'),_0x5c9f20[_0xd6fa('0x38')]));if(!this[_0xd6fa('0x91')](_0x5c9f20[_0xd6fa('0x15c')])){return this['channel'][_0xd6fa('0x2b')](_0x5c9f20,_0xd6fa('0x162'));}logger['info'](util['format']('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0xd6fa('0xf')]['callerid'],_0x5c9f20[_0xd6fa('0x15c')]));var _0x13e637=this['getPause'][_0xd6fa('0x7d')](this,_0x5c9f20[_0xd6fa('0x16d')]);var _0x558be2=this['agentPause'][_0xd6fa('0x7d')](this,_0x5c9f20['findBy'],_0x13e637);if(_0x558be2){logger[_0xd6fa('0x2d')](util[_0xd6fa('0x28')]('AGENT\x20%s\x20FOUND\x20BY',this[_0xd6fa('0xf')][_0xd6fa('0x3a')],_0x5c9f20['findBy']));this[_0xd6fa('0xf')][_0xd6fa('0xb4')](util[_0xd6fa('0x28')](_0xd6fa('0x15d'),this['channel'][_0xd6fa('0x3a')],_0x5c9f20['findBy']));return{'code':0xc8,'result':_0xd6fa('0x15e')};}else{logger[_0xd6fa('0x2d')](util[_0xd6fa('0x28')](_0xd6fa('0x15f'),this[_0xd6fa('0xf')][_0xd6fa('0x3a')],_0x5c9f20['findBy']));this[_0xd6fa('0xf')][_0xd6fa('0xb4')](util[_0xd6fa('0x28')](_0xd6fa('0x15d'),this['channel'][_0xd6fa('0x3a')],_0x5c9f20[_0xd6fa('0x15c')]));return{'code':0xc8,'result':_0xd6fa('0x160')};}};AGIVertices[_0xd6fa('0x10')][_0xd6fa('0x16e')]=function(_0x4df2fd){logger[_0xd6fa('0x2d')](util[_0xd6fa('0x28')](_0xd6fa('0x16f'),_0x4df2fd['label']));if(!this[_0xd6fa('0x91')](_0x4df2fd[_0xd6fa('0x116')])){return this[_0xd6fa('0xf')][_0xd6fa('0x2b')](_0x4df2fd,_0xd6fa('0x114'));}var _0x24658e=this[_0xd6fa('0x115')][_0xd6fa('0x7d')](this,_0x4df2fd[_0xd6fa('0x116')]);if(!_0x24658e){return this[_0xd6fa('0xf')]['error'](_0x4df2fd,'no\x20file\x20audio\x20found');}var _0x2a54be=this['channel'][_0xd6fa('0x60')](_0xd6fa('0x170'),[_0x24658e,_0x4df2fd[_0xd6fa('0x10f')]]);if(_0x2a54be['result']===-0x1){return _0x2a54be;}return this[_0xd6fa('0xf')][_0xd6fa('0xb4')](util[_0xd6fa('0x28')]('Executed\x20command\x20%s\x20%s','PLAYBACK',_0x24658e));};AGIVertices[_0xd6fa('0x10')][_0xd6fa('0x171')]=function(_0x56ab7a){logger[_0xd6fa('0x2d')](util['format'](_0xd6fa('0x172'),_0x56ab7a['label']));if(!this[_0xd6fa('0x91')](_0x56ab7a['queue_id'])){return this[_0xd6fa('0xf')][_0xd6fa('0x2b')](_0x56ab7a,'no\x20queue\x20selected');}var _0x40a129='';var _0x32f495=parseInt(_0x56ab7a['queue_id'],0xa);if(isNaN(_0x32f495)){_0x40a129=_0x56ab7a[_0xd6fa('0x173')];}else{_0x40a129=this[_0xd6fa('0x13')][_0xd6fa('0x7d')](this,_0x56ab7a['queue_id']);if(!_0x40a129){return this[_0xd6fa('0xf')][_0xd6fa('0x2b')](_0x56ab7a,_0xd6fa('0x174'));}}var _0x65c348='';if(this['isConfigured'](_0x56ab7a[_0xd6fa('0x116')])){var _0x1ed0b1=this[_0xd6fa('0x115')][_0xd6fa('0x7d')](this,_0x56ab7a[_0xd6fa('0x116')]);if(_0x1ed0b1){_0x65c348=_0x1ed0b1;}}this[_0xd6fa('0x36')]['sync'](this,_0x56ab7a,_0x40a129);if(_0x56ab7a['opts'][_0xd6fa('0x175')]('x')<0x0){_0x56ab7a['opts']+='x';}if(_0x56ab7a[_0xd6fa('0x10f')][_0xd6fa('0x175')]('X')<0x0){_0x56ab7a[_0xd6fa('0x10f')]+='X';}this['channel'][_0xd6fa('0xab')](_0xd6fa('0x176'),_0x40a129?_0x40a129[_0xd6fa('0x177')]():'');var _0x342a4b=this[_0xd6fa('0xf')]['exec']('QUEUE',[_0x40a129,_0x56ab7a[_0xd6fa('0x10f')],_0x56ab7a[_0xd6fa('0x70')],_0x65c348,_0x56ab7a[_0xd6fa('0x71')],_0x56ab7a[_0xd6fa('0x8')],_0x56ab7a[_0xd6fa('0x178')],_0x56ab7a['gosub'],'',_0x56ab7a[_0xd6fa('0x179')]]);if(_0x342a4b['result']===-0x1){return _0x342a4b;}return this['channel'][_0xd6fa('0xb4')](util[_0xd6fa('0x28')](_0xd6fa('0xca'),_0xd6fa('0x17a'),_0x40a129));};AGIVertices['prototype'][_0xd6fa('0x17b')]=function(_0x52d9f5){logger[_0xd6fa('0x2d')](util[_0xd6fa('0x28')](_0xd6fa('0x17c'),_0x52d9f5['label']));var _0x41fdad=_0x52d9f5[_0xd6fa('0x17d')]||_0xd6fa('0x134');var _0x10d8c7=util[_0xd6fa('0x28')](_0xd6fa('0x17e'),this[_0xd6fa('0xf')]['uniqueid'],rs[_0xd6fa('0x11f')](0x5));var _0x3eba9f=util[_0xd6fa('0x28')]('%s/recordings/%s.%s',FILES_PATH,_0x10d8c7,_0x41fdad);var _0x354a37=util[_0xd6fa('0x28')](_0xd6fa('0x135'),FILES_PATH,_0x10d8c7);this['createSquareRecording'][_0xd6fa('0x7d')](this,_0x52d9f5,_0x10d8c7,_0x3eba9f);this['channel']['setVariable']('RECORDING_SAVENAME',_0x10d8c7);logger[_0xd6fa('0x2d')]('Recording\x20%s\x20%s\x20%s\x20%s',_0x354a37,_0x41fdad,_0x52d9f5[_0xd6fa('0x17f')],_0x52d9f5[_0xd6fa('0x71')]);return this['channel']['recordFile'](_0x354a37,_0x41fdad,_0x52d9f5['escape_digits'],_0x52d9f5[_0xd6fa('0x71')],undefined,!![]);};AGIVertices[_0xd6fa('0x10')][_0xd6fa('0x180')]=function(_0x1266b8){logger['info'](util[_0xd6fa('0x28')](_0xd6fa('0x181'),_0x1266b8[_0xd6fa('0x38')]));if(!this[_0xd6fa('0x91')](_0x1266b8[_0xd6fa('0x70')])){return this[_0xd6fa('0xf')]['noop']('no\x20url\x20configured');}var _0xa7b3f6=this[_0xd6fa('0x6f')]['sync'](this,_0x1266b8);logger['info'](util[_0xd6fa('0x28')]('Response:',util['inspect'](_0xa7b3f6,{'showHidden':![],'depth':null})));if(!this[_0xd6fa('0x91')](_0x1266b8[_0xd6fa('0xde')])){return this['channel']['noop']('no\x20variable\x20selected\x20for\x20the\x20response');}var _0x256a0d=this['getVariable']['sync'](this,_0x1266b8[_0xd6fa('0xde')]);if(!_0x256a0d){return this['channel'][_0xd6fa('0x2b')](_0x1266b8,'no\x20variable\x20found');}this[_0xd6fa('0xf')]['setVariable'](util[_0xd6fa('0x28')](_0xd6fa('0x182'),_0x256a0d),_0xa7b3f6[_0xd6fa('0x81')]?_0xa7b3f6[_0xd6fa('0x81')]:_0xd6fa('0x183'));this['channel'][_0xd6fa('0xab')](util[_0xd6fa('0x28')](_0xd6fa('0x184'),_0x256a0d),_0xa7b3f6[_0xd6fa('0x185')]?_0xa7b3f6[_0xd6fa('0x185')]:'OK');if(_0xa7b3f6['body']){try{this[_0xd6fa('0xa9')](_0xa7b3f6[_0xd6fa('0x77')],_0x256a0d);}catch(_0x555782){logger[_0xd6fa('0x2b')](util[_0xd6fa('0x28')](_0xd6fa('0x186'),_0x256a0d));}}return this[_0xd6fa('0xf')][_0xd6fa('0xb4')](util['format'](_0xd6fa('0xe2'),_0x256a0d));};AGIVertices['prototype'][_0xd6fa('0x187')]=function(_0x246044){logger[_0xd6fa('0x2d')](util[_0xd6fa('0x28')](_0xd6fa('0x188'),_0x246044['label']));return this[_0xd6fa('0xf')][_0xd6fa('0x189')](_0x246044[_0xd6fa('0x18a')][_0xd6fa('0x62')](/\s+/g,''),_0x246044[_0xd6fa('0x17f')]);};AGIVertices[_0xd6fa('0x10')][_0xd6fa('0x18b')]=function(_0x2bb3c2){logger['info'](util['format']('Enter\x20in\x20SAYNUMBER\x20(%s)\x20block',_0x2bb3c2['label']));return this[_0xd6fa('0xf')]['sayNumber'](_0x2bb3c2['number']['replace'](/\s+/g,''),_0x2bb3c2[_0xd6fa('0x17f')]);};AGIVertices['prototype'][_0xd6fa('0x18c')]=function(_0x3227aa){logger[_0xd6fa('0x2d')](util[_0xd6fa('0x28')](_0xd6fa('0x18d'),_0x3227aa[_0xd6fa('0x38')]));return this['channel'][_0xd6fa('0x18e')](_0x3227aa['text'],_0x3227aa[_0xd6fa('0x17f')]);};AGIVertices['prototype'][_0xd6fa('0x18f')]=function(_0x11688d){logger[_0xd6fa('0x2d')](util[_0xd6fa('0x28')](_0xd6fa('0x190'),_0x11688d[_0xd6fa('0x38')]));if(!this[_0xd6fa('0x91')](_0x11688d[_0xd6fa('0x191')])){return this['channel']['noop'](_0xd6fa('0x192'));}var _0x212566=this[_0xd6fa('0x193')]['sync'](this,_0x11688d['account_id']);if(!_0x212566||!_0x212566[_0xd6fa('0x194')]){return this[_0xd6fa('0xf')][_0xd6fa('0x2b')](_0x11688d,_0xd6fa('0x195'));}var _0x3c214d={'from':util[_0xd6fa('0x28')](_0xd6fa('0x196'),_0x212566[_0xd6fa('0x47')],_0x212566['email']||_0x212566[_0xd6fa('0x194')][_0xd6fa('0x197')]),'to':_0x11688d['to']||'','cc':_0x11688d['cc']||'','bcc':_0x11688d[_0xd6fa('0x198')]||'','subject':_0x11688d[_0xd6fa('0x199')],'html':_0x11688d[_0xd6fa('0x66')],'text':_0x11688d[_0xd6fa('0x66')]};var _0x278964={'tls':{'rejectUnauthorized':![]}};if(_0x212566[_0xd6fa('0x194')][_0xd6fa('0x19a')]){_0x278964[_0xd6fa('0x19a')]=_0x212566[_0xd6fa('0x194')]['service'];}else{_0x278964[_0xd6fa('0x19b')]=_0x212566[_0xd6fa('0x194')][_0xd6fa('0x19b')];_0x278964[_0xd6fa('0x19c')]=_0x212566[_0xd6fa('0x194')][_0xd6fa('0x19c')];_0x278964[_0xd6fa('0x19d')]=_0x212566[_0xd6fa('0x194')][_0xd6fa('0x19d')];}if(_0x212566[_0xd6fa('0x194')][_0xd6fa('0x19e')]){_0x278964[_0xd6fa('0x19f')]={'user':_0x212566[_0xd6fa('0x194')][_0xd6fa('0x197')],'pass':_0x212566[_0xd6fa('0x194')][_0xd6fa('0x1a0')]};}if(this[_0xd6fa('0x91')](_0x11688d['template_id'])){}logger[_0xd6fa('0xe4')]('sendMail\x20message',JSON[_0xd6fa('0x80')](_0x3c214d));this['createSquareDetailsReport'][_0xd6fa('0x7d')](this,_0x11688d,_0x11688d[_0xd6fa('0x191')]);this[_0xd6fa('0xf')]['noop'](util[_0xd6fa('0x28')]('Trying\x20SendMail\x20with\x20account\x20%s',_0x212566[_0xd6fa('0x47')]));this[_0xd6fa('0x22')][_0xd6fa('0x7d')](this,_0x278964,_0x3c214d);return this[_0xd6fa('0xf')][_0xd6fa('0xb4')]('Mail\x20message\x20added\x20to\x20outgoing\x20process');};AGIVertices[_0xd6fa('0x10')][_0xd6fa('0x1a1')]=function(_0x37b56c){logger['info'](util['format'](_0xd6fa('0x1a2'),_0x37b56c[_0xd6fa('0x38')]));return this['channel']['noop'](_0xd6fa('0x1a3'));};AGIVertices[_0xd6fa('0x10')][_0xd6fa('0x1a4')]=function(_0x9d08ba){logger['info'](util[_0xd6fa('0x28')](_0xd6fa('0x1a5'),_0x9d08ba[_0xd6fa('0x38')]));if(!this[_0xd6fa('0x91')](_0x9d08ba[_0xd6fa('0x1a6')])){return this[_0xd6fa('0xf')][_0xd6fa('0xb4')](_0xd6fa('0x1a7'));}var _0xac6b9=this[_0xd6fa('0x33')][_0xd6fa('0x7d')](this,_0x9d08ba['sms_account_id']);if(!_0xac6b9){return this[_0xd6fa('0xf')][_0xd6fa('0x2b')](_0x9d08ba,_0xd6fa('0x1a8'));}var _0x5ee2ef={'body':_0x9d08ba[_0xd6fa('0x1a9')],'phone':_0x9d08ba['to']||'','SmsAccountId':_0xac6b9['id']};logger[_0xd6fa('0xe4')]('sendSMS\x20message',JSON[_0xd6fa('0x80')](_0x5ee2ef));this[_0xd6fa('0x36')][_0xd6fa('0x7d')](this,_0x9d08ba,_0x9d08ba['sms_account_id']);this[_0xd6fa('0xf')][_0xd6fa('0xb4')](util[_0xd6fa('0x28')]('Trying\x20SendSMS\x20with\x20account\x20%s',_0xac6b9['name']));this['createSmsMessage']['sync'](this,_0x5ee2ef);return this[_0xd6fa('0xf')][_0xd6fa('0xb4')](_0xd6fa('0x1aa'));};AGIVertices[_0xd6fa('0x10')][_0xd6fa('0x1ab')]=function(_0x4b7ad4){logger['info'](util['format']('Enter\x20in\x20SET\x20(%s)\x20block',_0x4b7ad4[_0xd6fa('0x38')]));if(!this[_0xd6fa('0x91')](_0x4b7ad4[_0xd6fa('0xde')])){return this[_0xd6fa('0xf')][_0xd6fa('0x2b')](_0x4b7ad4,_0xd6fa('0x1ac'));}var _0x35fc41=this[_0xd6fa('0x11')][_0xd6fa('0x7d')](this,_0x4b7ad4['variable_id']);if(!_0x35fc41){return this[_0xd6fa('0xf')][_0xd6fa('0x2b')](_0x4b7ad4,_0xd6fa('0x166'));}return this[_0xd6fa('0xf')]['setVariable'](_0x35fc41,_0x4b7ad4[_0xd6fa('0x1ad')]);};AGIVertices['prototype']['start']=function(_0x486b76){logger['info'](util['format']('Enter\x20in\x20START\x20(%s)\x20block',_0x486b76['label']));this[_0xd6fa('0xf')][_0xd6fa('0xb4')]('START\x20CALLY\x20SQUARE');if(_0x486b76[_0xd6fa('0xc2')]===_0xd6fa('0x1ae')){this[_0xd6fa('0xf')][_0xd6fa('0xb4')](_0xd6fa('0x1af'));return this[_0xd6fa('0xf')][_0xd6fa('0xc2')]();}return this[_0xd6fa('0xf')][_0xd6fa('0xb4')]('Skipped\x20Answer');};AGIVertices[_0xd6fa('0x10')][_0xd6fa('0x1b0')]=function(_0x430dca){logger[_0xd6fa('0x2d')](util[_0xd6fa('0x28')]('Enter\x20in\x20SUBPROJECT\x20(%s)\x20block',_0x430dca['label']));if(!this[_0xd6fa('0x91')](_0x430dca[_0xd6fa('0x1b1')])){return this[_0xd6fa('0xf')][_0xd6fa('0x2b')](_0x430dca,'no\x20subproject\x20selected');}var _0x12baf8=this[_0xd6fa('0x17')]['sync'](this,_0x430dca[_0xd6fa('0x1b1')]);if(!this[_0xd6fa('0x91')](_0x12baf8)){return this[_0xd6fa('0xf')][_0xd6fa('0x2b')](_0x430dca,util['format'](_0xd6fa('0x1b2'),_0x430dca[_0xd6fa('0x1b1')]));}if(_0x12baf8===this[_0xd6fa('0xf')][_0xd6fa('0x39')]){return this[_0xd6fa('0xf')][_0xd6fa('0x2b')](_0x430dca,'project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project');}this[_0xd6fa('0x36')]['sync'](this,_0x430dca,_0x12baf8);var _0x5c7525=this['channel'][_0xd6fa('0x60')](_0xd6fa('0x1b3'),util[_0xd6fa('0x28')](_0xd6fa('0x1b4'),config[_0xd6fa('0x8')]['host']||'127.0.0.1',_0x12baf8,this[_0xd6fa('0xf')]['arg_1']));if(_0x5c7525['result']===-0x1){return _0x5c7525;}return this[_0xd6fa('0xf')][_0xd6fa('0xb4')](util['format']('Executed\x20command\x20%s\x20%s',_0xd6fa('0x1b3'),_0x12baf8));};AGIVertices[_0xd6fa('0x10')][_0xd6fa('0x1b5')]=function(_0x748f4c){logger[_0xd6fa('0x2d')](util[_0xd6fa('0x28')](_0xd6fa('0x1b6'),_0x748f4c['label']));var _0xc3764e=this['shellCommand'][_0xd6fa('0x7d')](this,_0x748f4c[_0xd6fa('0xc1')]);this[_0xd6fa('0x36')][_0xd6fa('0x7d')](this,_0x748f4c,_0x748f4c[_0xd6fa('0xc1')]);if(this[_0xd6fa('0x91')](_0x748f4c['variable_id'])){var _0x50d412=this[_0xd6fa('0x11')][_0xd6fa('0x7d')](this,_0x748f4c[_0xd6fa('0xde')]);if(_0x50d412){this[_0xd6fa('0xf')][_0xd6fa('0xab')](_0x50d412,_0xc3764e);return this[_0xd6fa('0xf')][_0xd6fa('0xb4')](util['format'](_0xd6fa('0x1b7'),_0x748f4c[_0xd6fa('0xc1')],_0x50d412));}}return this['channel'][_0xd6fa('0xb4')](util[_0xd6fa('0x28')](_0xd6fa('0x1b8'),_0x748f4c['command']));};AGIVertices[_0xd6fa('0x10')][_0xd6fa('0x1b9')]=function(_0x5d0df9){logger[_0xd6fa('0x2d')](util[_0xd6fa('0x28')](_0xd6fa('0x1ba'),_0x5d0df9['label']));_0x5d0df9[_0xd6fa('0x66')]=_0x5d0df9[_0xd6fa('0x66')][_0xd6fa('0x62')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0xd6fa('0x91')](_0x5d0df9[_0xd6fa('0x64')])){return this[_0xd6fa('0xf')]['noop']('no\x20apiKey\x20configured');}if(!this['isConfigured'](_0x5d0df9[_0xd6fa('0x66')])){return this[_0xd6fa('0xf')][_0xd6fa('0xb4')](_0xd6fa('0xcd'));}this[_0xd6fa('0xf')][_0xd6fa('0xb4')](util[_0xd6fa('0x28')](_0xd6fa('0x1bb'),_0x5d0df9['text']));var _0x48b5da=this[_0xd6fa('0x63')][_0xd6fa('0x7d')](this,_0x5d0df9);if(_0x48b5da){this[_0xd6fa('0xf')][_0xd6fa('0xb4')](util[_0xd6fa('0x28')](_0xd6fa('0x1bc'),_0x48b5da));var _0x3649f5=this[_0xd6fa('0xf')][_0xd6fa('0x105')](_0x48b5da);try{fs[_0xd6fa('0x106')](_0x48b5da+_0xd6fa('0x107'));}catch(_0x251089){logger[_0xd6fa('0x2b')](_0x251089);}return _0x3649f5;}return this[_0xd6fa('0xf')]['error'](_0x5d0df9,_0xd6fa('0x1bd'));};AGIVertices['prototype'][_0xd6fa('0x1be')]=function(_0x1c9110){logger[_0xd6fa('0x2d')](util[_0xd6fa('0x28')](_0xd6fa('0x1bf'),_0x1c9110[_0xd6fa('0x38')]));_0x1c9110[_0xd6fa('0x66')]=_0x1c9110[_0xd6fa('0x66')][_0xd6fa('0x62')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0xd6fa('0x91')](_0x1c9110[_0xd6fa('0x66')])){return this['channel'][_0xd6fa('0xb4')](_0xd6fa('0xcd'));}this[_0xd6fa('0xf')][_0xd6fa('0xb4')](util[_0xd6fa('0x28')](_0xd6fa('0x1c0'),_0x1c9110[_0xd6fa('0x66')]));var _0xc371a=this[_0xd6fa('0x6d')][_0xd6fa('0x7d')](this,_0x1c9110);if(_0xc371a){this[_0xd6fa('0xf')][_0xd6fa('0xb4')](util[_0xd6fa('0x28')](_0xd6fa('0x1c1'),_0xc371a));var _0xaa7af1=this[_0xd6fa('0xf')][_0xd6fa('0x105')](_0xc371a);try{fs[_0xd6fa('0x106')](_0xc371a+'.wav');}catch(_0x302a12){logger[_0xd6fa('0x2b')](_0x302a12);}return _0xaa7af1;}return this[_0xd6fa('0xf')][_0xd6fa('0x2b')](_0x1c9110,'Google\x20TTS\x20is\x20unreachable');};AGIVertices[_0xd6fa('0x10')][_0xd6fa('0x1c2')]=function(_0x28024f){logger[_0xd6fa('0x2d')](util['format'](_0xd6fa('0x1c3'),_0x28024f[_0xd6fa('0x38')]));if(!this[_0xd6fa('0x91')](_0x28024f[_0xd6fa('0x15c')])){return this['channel']['error'](_0x28024f,_0xd6fa('0x162'));}logger[_0xd6fa('0x2d')](util[_0xd6fa('0x28')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0xd6fa('0xf')][_0xd6fa('0x3a')],_0x28024f['findBy']));var _0x2d67d7=this['agentUnpause'][_0xd6fa('0x7d')](this,_0x28024f[_0xd6fa('0x15c')]);if(_0x2d67d7){logger[_0xd6fa('0x2d')](util[_0xd6fa('0x28')](_0xd6fa('0x15d'),this['channel']['callerid'],_0x28024f[_0xd6fa('0x15c')]));this[_0xd6fa('0xf')][_0xd6fa('0xb4')](util[_0xd6fa('0x28')](_0xd6fa('0x15d'),this[_0xd6fa('0xf')][_0xd6fa('0x3a')],_0x28024f[_0xd6fa('0x15c')]));return{'code':0xc8,'result':_0xd6fa('0x15e')};}else{logger[_0xd6fa('0x2d')](util[_0xd6fa('0x28')](_0xd6fa('0x15f'),this[_0xd6fa('0xf')][_0xd6fa('0x3a')],_0x28024f['findBy']));this[_0xd6fa('0xf')][_0xd6fa('0xb4')](util[_0xd6fa('0x28')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0xd6fa('0xf')]['callerid'],_0x28024f['findBy']));return{'code':0xc8,'result':_0xd6fa('0x160')};}};AGIVertices[_0xd6fa('0x10')][_0xd6fa('0x1c4')]=function(_0x8ebfd1){logger['info'](util[_0xd6fa('0x28')](_0xd6fa('0x1c5'),_0x8ebfd1[_0xd6fa('0x38')]));var _0x95ce69=this[_0xd6fa('0xf')][_0xd6fa('0x60')](_0xd6fa('0x1c6'),[_0x8ebfd1[_0xd6fa('0x1c7')],_0x8ebfd1['options']]);if(_0x95ce69[_0xd6fa('0xb5')]===-0x1){return _0x95ce69;}return this['channel'][_0xd6fa('0xb4')](util['format'](_0xd6fa('0xca'),_0xd6fa('0x1c6'),_0x8ebfd1[_0xd6fa('0x1c7')]));};AGIVertices['prototype'][_0xd6fa('0x1c8')]=function(_0x452f87){logger[_0xd6fa('0x2d')](util[_0xd6fa('0x28')](_0xd6fa('0x1c9'),_0x452f87['label']));if(!this[_0xd6fa('0x91')](_0x452f87[_0xd6fa('0xde')])){return this[_0xd6fa('0xf')][_0xd6fa('0x2b')](_0x452f87,_0xd6fa('0x1ac'));}var _0x356670=this['getVariable'][_0xd6fa('0x7d')](this,_0x452f87[_0xd6fa('0xde')]);if(!_0x356670){return this[_0xd6fa('0xf')]['error'](_0x452f87,'no\x20variable\x20found');}var _0x3237c4=this[_0xd6fa('0xf')][_0xd6fa('0x11')](_0x356670);return{'code':0xc8,'result':_0x3237c4[_0xd6fa('0xae')]?_0x3237c4['extra']:'-'};};String['prototype'][_0xd6fa('0xad')]=function(_0x5ad4ef,_0x61facb){return this['split'](_0x5ad4ef)[_0xd6fa('0x1ca')](_0x61facb);};module[_0xd6fa('0x1cb')]=AGIVertices; \ No newline at end of file diff --git a/server/services/ami/acw/index.js b/server/services/ami/acw/index.js index a1bd320..932ae6e 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 _0xa9f4=['syncAgentRingNoAnswer','attendedtransfer','custom:agentConnectPreview','syncAgentConnectPreview','milliseconds','diff','prototype','startAcw','ACW','mandatoryDisposition','mandatoryDispositionPause','name','QueuePause','then','getAgent','voicePause','info','[%s][START][AGENT:%s][QUEUE:%s]','attended','destlinkedid','savePause','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','acwTimeout','timer','stopAcw','lastPauseAt','updateAcw','[%s][UPDATE][ACWTIME:%s]','catch','error','[%s][UPDATE][ERRORS:%s]','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','finally','[ACW][START]\x20%s','uniqueid','[%s][TIMER][STOP][AGENT:%s]','saveUnpause','[ACW][TIMERS]','stringify','[ACW][STOP]\x20%s','message','queue','interface','[ACW][syncAgentConnectPreview]\x20%s','isUndefined','[%s][HANGUP:UNIQUEID]','linkedid','[%s][HANGUP:LINKEDID]','[ACW][syncHangupRequest]\x20%s','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','[%s][HANGUPATTENDEDTRANSFER:LINKEDID]','[ACW][syncHangup]\x20%s','isNil','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','syncBlindTransfer','transfereruniqueid','[%s][BLINDTRANSFER:UNIQUEID]','transfererlinkedid','[%s][BLINDTRANSFER:LINKEDID]','[ACW][syncBlindTransfer]\x20%s','autopause','Auto-Pause','exports','util','lodash','moment','acw','../rpc/user','voiceQueues','agents','timers','channels','agentconnect','hanguprequest','syncHangupRequest','bind','syncHangup'];(function(_0x2cfcff,_0x3eb570){var _0x15512e=function(_0x40d98d){while(--_0x40d98d){_0x2cfcff['push'](_0x2cfcff['shift']());}};_0x15512e(++_0x3eb570);}(_0xa9f4,0xe2));var _0x4a9f=function(_0x298806,_0x56a532){_0x298806=_0x298806-0x0;var _0x58ca43=_0xa9f4[_0x298806];return _0x58ca43;};'use strict';var util=require(_0x4a9f('0x0'));var _=require(_0x4a9f('0x1'));var moment=require(_0x4a9f('0x2'));var ami=require('../ami');var logger=require('../../../config/logger')(_0x4a9f('0x3'));var RpcUser=require(_0x4a9f('0x4'));var RpcVoiceAgentReport=require('../rpc/voiceAgentReport');function Acw(_0x5abc29){this[_0x4a9f('0x5')]=_0x5abc29[_0x4a9f('0x5')];this[_0x4a9f('0x6')]=_0x5abc29[_0x4a9f('0x6')];this[_0x4a9f('0x7')]=_0x5abc29[_0x4a9f('0x7')];this[_0x4a9f('0x8')]={};ami['on'](_0x4a9f('0x9'),this['syncAgentConnect']['bind'](this));ami['on'](_0x4a9f('0xa'),this[_0x4a9f('0xb')][_0x4a9f('0xc')](this));ami['on']('hangup',this[_0x4a9f('0xd')]['bind'](this));ami['on']('agentringnoanswer',this[_0x4a9f('0xe')][_0x4a9f('0xc')](this));ami['on'](_0x4a9f('0xf'),this['syncAttendedTransfer'][_0x4a9f('0xc')](this));ami['on']('blindtransfer',this['syncBlindTransfer'][_0x4a9f('0xc')](this));ami['on'](_0x4a9f('0x10'),this[_0x4a9f('0x11')][_0x4a9f('0xc')](this));}function getDiff(_0x919b00){var _0x67930=moment()[_0x4a9f('0x12')](0x0);var _0x819c91=moment(_0x919b00)[_0x4a9f('0x12')](0x0);return _0x67930[_0x4a9f('0x13')](_0x819c91,'seconds');}Acw[_0x4a9f('0x14')][_0x4a9f('0x15')]=function(_0x2dccef){try{var _0x24f970=this;var _0x5a30d4=this[_0x4a9f('0x8')][_0x2dccef]['interface'];var _0x4a570e=this[_0x4a9f('0x8')][_0x2dccef]['queue'];var _0x1f81d4=this[_0x4a9f('0x5')][_0x4a570e];var _0x43f7ef=![];var _0x3fb30d=_0x4a9f('0x16');if(_0x1f81d4[_0x4a9f('0x17')]){if(_0x1f81d4[_0x4a9f('0x18')][_0x4a9f('0x19')]){_0x43f7ef=!![];_0x3fb30d=_0x1f81d4[_0x4a9f('0x18')][_0x4a9f('0x19')];}}ami['Action']({'action':_0x4a9f('0x1a'),'interface':_0x5a30d4,'paused':!![],'reason':_0x3fb30d})[_0x4a9f('0x1b')](function(_0x4a4c70){if(_0x24f970[_0x4a9f('0x6')][_0x5a30d4]){return RpcUser[_0x4a9f('0x1c')](_0x24f970[_0x4a9f('0x6')][_0x5a30d4]['id'])['then'](function(_0x3ecdeb){if(_0x3ecdeb&&!_0x3ecdeb[_0x4a9f('0x1d')]){logger[_0x4a9f('0x1e')](_0x4a9f('0x1f'),_0x2dccef,_0x5a30d4,_0x4a570e);var _0xacf7f3=_0x24f970[_0x4a9f('0x8')][_0x2dccef][_0x4a9f('0x20')]&&_0x24f970[_0x4a9f('0x8')][_0x2dccef]['destlinkedid']?_0x24f970[_0x4a9f('0x8')][_0x2dccef][_0x4a9f('0x21')]:_0x2dccef;return RpcUser[_0x4a9f('0x22')](_0x24f970[_0x4a9f('0x6')][_0x5a30d4],_0x3fb30d,_0xacf7f3)[_0x4a9f('0x1b')](function(_0x221b61){if(!_0x43f7ef){_0x24f970[_0x4a9f('0x7')][_0x5a30d4]={};logger[_0x4a9f('0x1e')](_0x4a9f('0x23'),_0x2dccef,_0x24f970[_0x4a9f('0x5')][_0x4a570e][_0x4a9f('0x24')],_0x5a30d4,_0x4a570e);_0x24f970[_0x4a9f('0x7')][_0x5a30d4][_0x4a9f('0x25')]=setTimeout(_0x24f970[_0x4a9f('0x26')][_0x4a9f('0xc')](_0x24f970,_0x5a30d4),_0x24f970['voiceQueues'][_0x4a570e][_0x4a9f('0x24')]*0x3e8);_0x24f970['timers'][_0x5a30d4][_0x4a9f('0x27')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x24f970[_0x4a9f('0x7')][_0x5a30d4]['uniqueid']=_0x2dccef;_0x24f970[_0x4a9f('0x7')][_0x5a30d4]['queue']=_0x4a570e;_0x24f970[_0x4a9f('0x7')][_0x5a30d4][_0x4a9f('0x28')]=function(){var _0x5793af=getDiff(_0x24f970['timers'][_0x5a30d4][_0x4a9f('0x27')]);clearTimeout(_0x24f970[_0x4a9f('0x7')][_0x5a30d4][_0x4a9f('0x25')]);_0x24f970[_0x4a9f('0x7')][_0x5a30d4][_0x4a9f('0x25')]=![];RpcVoiceAgentReport['update']({'acwtime':_0x5793af},_0x24f970[_0x4a9f('0x7')][_0x5a30d4]['uniqueid'],_0x5a30d4)[_0x4a9f('0x1b')](function(_0x3c5f17){logger['info'](_0x4a9f('0x29'),_0x2dccef,_0x5793af,_0x3c5f17);})[_0x4a9f('0x2a')](function(_0x48db39){logger[_0x4a9f('0x2b')](_0x4a9f('0x2c'),_0x2dccef,_0x48db39);});delete _0x24f970[_0x4a9f('0x7')][_0x5a30d4];};}});}else{logger[_0x4a9f('0x1e')](_0x4a9f('0x2d'),_0x2dccef,_0x5a30d4,_0x4a570e);}});}})[_0x4a9f('0x2a')](function(_0x22613c){logger[_0x4a9f('0x2b')](_0x4a9f('0x23'),_0x2dccef,_0x24f970[_0x4a9f('0x5')][_0x4a570e][_0x4a9f('0x24')],_0x5a30d4,_0x4a570e);})[_0x4a9f('0x2e')](function(){delete _0x24f970[_0x4a9f('0x8')][_0x2dccef];});}catch(_0x4f1aae){logger['error'](_0x4a9f('0x2f'),_0x4f1aae['message']);}};Acw[_0x4a9f('0x14')][_0x4a9f('0x26')]=function(_0x7b77b3){try{var _0x1b6bb9=this;if(_0x1b6bb9[_0x4a9f('0x7')][_0x7b77b3]){_0x1b6bb9[_0x4a9f('0x7')][_0x7b77b3][_0x4a9f('0x25')]=![];var _0x5e65ee=_0x1b6bb9[_0x4a9f('0x7')][_0x7b77b3][_0x4a9f('0x30')];var _0x3120e7=_0x1b6bb9[_0x4a9f('0x7')][_0x7b77b3]['queue'];var _0x21683e=_0x1b6bb9['voiceQueues'][_0x3120e7]['acwTimeout'];logger['info'](_0x4a9f('0x31'),_0x5e65ee,_0x7b77b3);RpcUser[_0x4a9f('0x32')](this[_0x4a9f('0x6')][_0x7b77b3]);RpcVoiceAgentReport['update']({'acwtime':_0x21683e,'agentacw':!![]},_0x5e65ee,_0x7b77b3)[_0x4a9f('0x1b')](function(_0x377430){logger[_0x4a9f('0x1e')](_0x4a9f('0x29'),_0x5e65ee,_0x21683e,_0x377430);})['catch'](function(_0x573d0f){logger['error'](_0x4a9f('0x2c'),_0x5e65ee,_0x573d0f);});}else{logger[_0x4a9f('0x2b')]('[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer',_0x7b77b3);if(_0x1b6bb9['timers']){logger[_0x4a9f('0x1e')](_0x4a9f('0x33'),JSON[_0x4a9f('0x34')](_0x1b6bb9['timers']));}}}catch(_0xdcf90){logger[_0x4a9f('0x2b')](_0x4a9f('0x35'),_0xdcf90[_0x4a9f('0x36')]);}};Acw[_0x4a9f('0x14')]['syncAgentConnect']=function(_0x82ad09){try{if(this[_0x4a9f('0x5')][_0x82ad09[_0x4a9f('0x37')]]&&(this['voiceQueues'][_0x82ad09[_0x4a9f('0x37')]][_0x4a9f('0x3')]||this['voiceQueues'][_0x82ad09[_0x4a9f('0x37')]][_0x4a9f('0x17')])){if(this[_0x4a9f('0x6')][_0x82ad09['interface']]){this[_0x4a9f('0x8')][_0x82ad09['uniqueid']]={'queue':_0x82ad09[_0x4a9f('0x37')],'interface':_0x82ad09[_0x4a9f('0x38')],'destlinkedid':_0x82ad09['destlinkedid']};}}}catch(_0x2e9791){logger[_0x4a9f('0x2b')]('[ACW][syncAgentConnect]\x20%s',_0x2e9791[_0x4a9f('0x36')]);}};Acw['prototype'][_0x4a9f('0x11')]=function(_0x2953c1){try{if(this[_0x4a9f('0x5')][_0x2953c1[_0x4a9f('0x37')]]&&(this[_0x4a9f('0x5')][_0x2953c1['queue']][_0x4a9f('0x3')]||this[_0x4a9f('0x5')][_0x2953c1[_0x4a9f('0x37')]][_0x4a9f('0x17')])){if(this[_0x4a9f('0x6')][_0x2953c1[_0x4a9f('0x38')]]){this['channels'][_0x2953c1['uniqueid']]={'queue':_0x2953c1[_0x4a9f('0x37')],'interface':_0x2953c1['interface']};}}}catch(_0xf4db17){logger[_0x4a9f('0x2b')](_0x4a9f('0x39'),_0xf4db17['message']);}};Acw[_0x4a9f('0x14')][_0x4a9f('0xb')]=function(_0x2758ac){try{if(this['channels'][_0x2758ac[_0x4a9f('0x30')]]&&_[_0x4a9f('0x3a')](this['channels'][_0x2758ac[_0x4a9f('0x30')]][_0x4a9f('0x20')])){logger[_0x4a9f('0x1e')](_0x4a9f('0x3b'),_0x2758ac[_0x4a9f('0x30')]);this['startAcw'](_0x2758ac[_0x4a9f('0x30')]);}else if(this['channels'][_0x2758ac[_0x4a9f('0x3c')]]&&_[_0x4a9f('0x3a')](this[_0x4a9f('0x8')][_0x2758ac[_0x4a9f('0x3c')]][_0x4a9f('0x20')])){logger[_0x4a9f('0x1e')](_0x4a9f('0x3d'),_0x2758ac[_0x4a9f('0x3c')]);this[_0x4a9f('0x15')](_0x2758ac[_0x4a9f('0x3c')]);}}catch(_0x54f712){logger[_0x4a9f('0x2b')](_0x4a9f('0x3e'),_0x54f712[_0x4a9f('0x36')]);}};Acw[_0x4a9f('0x14')]['syncHangup']=function(_0x843e8f){try{if(this[_0x4a9f('0x8')][_0x843e8f['uniqueid']]&&this[_0x4a9f('0x8')][_0x843e8f[_0x4a9f('0x30')]][_0x4a9f('0x20')]){logger[_0x4a9f('0x1e')](_0x4a9f('0x3f'),_0x843e8f['uniqueid']);this[_0x4a9f('0x15')](_0x843e8f[_0x4a9f('0x30')]);}else if(this[_0x4a9f('0x8')][_0x843e8f[_0x4a9f('0x3c')]]&&this['channels'][_0x843e8f['linkedid']][_0x4a9f('0x20')]){logger['info'](_0x4a9f('0x40'),_0x843e8f[_0x4a9f('0x3c')]);this[_0x4a9f('0x15')](_0x843e8f[_0x4a9f('0x3c')]);}}catch(_0x57bb9f){logger['error'](_0x4a9f('0x41'),_0x57bb9f[_0x4a9f('0x36')]);}};Acw['prototype']['syncAttendedTransfer']=function(_0x4ebb30){try{if(!_[_0x4a9f('0x42')](this[_0x4a9f('0x8')][_0x4ebb30['transfereeuniqueid']])){this[_0x4a9f('0x15')](_0x4ebb30[_0x4a9f('0x43')]);if(this['channels'][_0x4ebb30[_0x4a9f('0x44')]]){this['channels'][_0x4ebb30[_0x4a9f('0x44')]][_0x4a9f('0x20')]=!![];this[_0x4a9f('0x8')][_0x4ebb30['transfertargetuniqueid']]=this[_0x4a9f('0x8')][_0x4ebb30[_0x4a9f('0x44')]];delete this[_0x4a9f('0x8')][_0x4ebb30[_0x4a9f('0x44')]];}}else if(!_[_0x4a9f('0x42')](this['channels'][_0x4ebb30[_0x4a9f('0x45')]])){this['startAcw'](_0x4ebb30['transfertargetuniqueid']);if(this['channels'][_0x4ebb30['origtransfereruniqueid']]){this[_0x4a9f('0x8')][_0x4ebb30[_0x4a9f('0x46')]][_0x4a9f('0x20')]=!![];this['channels'][_0x4ebb30[_0x4a9f('0x43')]]=this['channels'][_0x4ebb30[_0x4a9f('0x46')]];delete this[_0x4a9f('0x8')][_0x4ebb30['origtransfereruniqueid']];}}}catch(_0x1452ab){logger[_0x4a9f('0x2b')]('[ACW][syncAttendedTransfer]\x20%s',_0x1452ab[_0x4a9f('0x36')]);}};Acw['prototype'][_0x4a9f('0x47')]=function(_0x112bd3){try{if(this[_0x4a9f('0x8')][_0x112bd3[_0x4a9f('0x48')]]){logger[_0x4a9f('0x1e')](_0x4a9f('0x49'),JSON[_0x4a9f('0x34')](_0x112bd3[_0x4a9f('0x48')]));this['startAcw'](_0x112bd3[_0x4a9f('0x48')]);}else if(this[_0x4a9f('0x8')][_0x112bd3[_0x4a9f('0x4a')]]){logger[_0x4a9f('0x1e')](_0x4a9f('0x4b'),JSON[_0x4a9f('0x34')](_0x112bd3[_0x4a9f('0x4a')]));this['startAcw'](_0x112bd3[_0x4a9f('0x4a')]);}}catch(_0x2c3fb5){logger['error'](_0x4a9f('0x4c'),_0x2c3fb5[_0x4a9f('0x36')]);}};Acw[_0x4a9f('0x14')][_0x4a9f('0xe')]=function(_0x16fb32){try{if(this['voiceQueues'][_0x16fb32[_0x4a9f('0x37')]]&&this[_0x4a9f('0x5')][_0x16fb32[_0x4a9f('0x37')]][_0x4a9f('0x4d')]==='all'){if(this[_0x4a9f('0x6')][_0x16fb32[_0x4a9f('0x38')]]){logger[_0x4a9f('0x1e')]('[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]',_0x16fb32[_0x4a9f('0x30')],_0x16fb32[_0x4a9f('0x38')],_0x16fb32[_0x4a9f('0x37')]);return RpcUser['savePause'](this[_0x4a9f('0x6')][_0x16fb32['interface']],_0x4a9f('0x4e'),_0x16fb32['uniqueid']);}}}catch(_0x3f72bc){logger['error']('[ACW][syncAgentRingNoAnswer]\x20%s',_0x3f72bc['message']);}};module[_0x4a9f('0x4f')]=Acw; \ No newline at end of file +var _0xc8ff=['syncHangupRequest','syncHangup','agentringnoanswer','blindtransfer','syncAgentConnectPreview','milliseconds','diff','seconds','prototype','startAcw','interface','ACW','mandatoryDisposition','mandatoryDispositionPause','name','Action','QueuePause','then','getAgent','voicePause','info','[%s][START][AGENT:%s][QUEUE:%s]','attended','destlinkedid','savePause','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','timer','acwTimeout','lastPauseAt','format','YYYY-MM-DD\x20HH:mm:ss','uniqueid','queue','updateAcw','update','catch','error','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','finally','[ACW][START]\x20%s','message','saveUnpause','[%s][UPDATE][ERRORS:%s]','[ACW][TIMERS]','stringify','[ACW][STOP]\x20%s','syncAgentConnect','[ACW][syncAgentConnectPreview]\x20%s','isUndefined','[%s][HANGUP:UNIQUEID]','linkedid','[%s][HANGUP:LINKEDID]','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','[%s][HANGUPATTENDEDTRANSFER:LINKEDID]','[ACW][syncHangup]\x20%s','syncAttendedTransfer','isNil','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s','transfereruniqueid','[%s][BLINDTRANSFER:UNIQUEID]','[%s][BLINDTRANSFER:LINKEDID]','transfererlinkedid','all','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','Auto-Pause','[ACW][syncAgentRingNoAnswer]\x20%s','moment','../../../config/logger','acw','../rpc/user','voiceQueues','agents','timers','channels','bind','hanguprequest'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xc8ff,0x96));var _0xfc8f=function(_0xb0f7c3,_0x4eae95){_0xb0f7c3=_0xb0f7c3-0x0;var _0x28ea68=_0xc8ff[_0xb0f7c3];return _0x28ea68;};'use strict';var util=require('util');var _=require('lodash');var moment=require(_0xfc8f('0x0'));var ami=require('../ami');var logger=require(_0xfc8f('0x1'))(_0xfc8f('0x2'));var RpcUser=require(_0xfc8f('0x3'));var RpcVoiceAgentReport=require('../rpc/voiceAgentReport');function Acw(_0x2a1dd6){this[_0xfc8f('0x4')]=_0x2a1dd6['voiceQueues'];this['agents']=_0x2a1dd6[_0xfc8f('0x5')];this[_0xfc8f('0x6')]=_0x2a1dd6[_0xfc8f('0x6')];this[_0xfc8f('0x7')]={};ami['on']('agentconnect',this['syncAgentConnect'][_0xfc8f('0x8')](this));ami['on'](_0xfc8f('0x9'),this[_0xfc8f('0xa')][_0xfc8f('0x8')](this));ami['on']('hangup',this[_0xfc8f('0xb')]['bind'](this));ami['on'](_0xfc8f('0xc'),this['syncAgentRingNoAnswer'][_0xfc8f('0x8')](this));ami['on']('attendedtransfer',this['syncAttendedTransfer']['bind'](this));ami['on'](_0xfc8f('0xd'),this['syncBlindTransfer'][_0xfc8f('0x8')](this));ami['on']('custom:agentConnectPreview',this[_0xfc8f('0xe')][_0xfc8f('0x8')](this));}function getDiff(_0x5cd89c){var _0x19763c=moment()[_0xfc8f('0xf')](0x0);var _0xce9bec=moment(_0x5cd89c)[_0xfc8f('0xf')](0x0);return _0x19763c[_0xfc8f('0x10')](_0xce9bec,_0xfc8f('0x11'));}Acw[_0xfc8f('0x12')][_0xfc8f('0x13')]=function(_0x521327){try{var _0x52dfa3=this;var _0x1dd0d5=this[_0xfc8f('0x7')][_0x521327][_0xfc8f('0x14')];var _0x3950a9=this[_0xfc8f('0x7')][_0x521327]['queue'];var _0x4ddd56=this[_0xfc8f('0x4')][_0x3950a9];var _0x3d3e90=![];var _0x1f0c75=_0xfc8f('0x15');if(_0x4ddd56[_0xfc8f('0x16')]){if(_0x4ddd56[_0xfc8f('0x17')][_0xfc8f('0x18')]){_0x3d3e90=!![];_0x1f0c75=_0x4ddd56[_0xfc8f('0x17')]['name'];}}ami[_0xfc8f('0x19')]({'action':_0xfc8f('0x1a'),'interface':_0x1dd0d5,'paused':!![],'reason':_0x1f0c75})[_0xfc8f('0x1b')](function(_0x461d1c){if(_0x52dfa3[_0xfc8f('0x5')][_0x1dd0d5]){return RpcUser[_0xfc8f('0x1c')](_0x52dfa3['agents'][_0x1dd0d5]['id'])[_0xfc8f('0x1b')](function(_0x36afef){if(_0x36afef&&!_0x36afef[_0xfc8f('0x1d')]){logger[_0xfc8f('0x1e')](_0xfc8f('0x1f'),_0x521327,_0x1dd0d5,_0x3950a9);var _0x159904=_0x52dfa3['channels'][_0x521327][_0xfc8f('0x20')]&&_0x52dfa3[_0xfc8f('0x7')][_0x521327]['destlinkedid']?_0x52dfa3[_0xfc8f('0x7')][_0x521327][_0xfc8f('0x21')]:_0x521327;return RpcUser[_0xfc8f('0x22')](_0x52dfa3[_0xfc8f('0x5')][_0x1dd0d5],_0x1f0c75,_0x159904)['then'](function(_0xb80f91){if(!_0x3d3e90){_0x52dfa3[_0xfc8f('0x6')][_0x1dd0d5]={};logger['info'](_0xfc8f('0x23'),_0x521327,_0x52dfa3[_0xfc8f('0x4')][_0x3950a9]['acwTimeout'],_0x1dd0d5,_0x3950a9);_0x52dfa3[_0xfc8f('0x6')][_0x1dd0d5][_0xfc8f('0x24')]=setTimeout(_0x52dfa3['stopAcw']['bind'](_0x52dfa3,_0x1dd0d5),_0x52dfa3[_0xfc8f('0x4')][_0x3950a9][_0xfc8f('0x25')]*0x3e8);_0x52dfa3[_0xfc8f('0x6')][_0x1dd0d5][_0xfc8f('0x26')]=moment()[_0xfc8f('0x27')](_0xfc8f('0x28'));_0x52dfa3[_0xfc8f('0x6')][_0x1dd0d5][_0xfc8f('0x29')]=_0x521327;_0x52dfa3[_0xfc8f('0x6')][_0x1dd0d5][_0xfc8f('0x2a')]=_0x3950a9;_0x52dfa3[_0xfc8f('0x6')][_0x1dd0d5][_0xfc8f('0x2b')]=function(){var _0x40fe57=getDiff(_0x52dfa3['timers'][_0x1dd0d5][_0xfc8f('0x26')]);clearTimeout(_0x52dfa3[_0xfc8f('0x6')][_0x1dd0d5][_0xfc8f('0x24')]);_0x52dfa3['timers'][_0x1dd0d5][_0xfc8f('0x24')]=![];RpcVoiceAgentReport[_0xfc8f('0x2c')]({'acwtime':_0x40fe57},_0x52dfa3[_0xfc8f('0x6')][_0x1dd0d5][_0xfc8f('0x29')],_0x1dd0d5)[_0xfc8f('0x1b')](function(_0x4a858c){logger['info']('[%s][UPDATE][ACWTIME:%s]',_0x521327,_0x40fe57,_0x4a858c);})[_0xfc8f('0x2d')](function(_0x554b98){logger[_0xfc8f('0x2e')]('[%s][UPDATE][ERRORS:%s]',_0x521327,_0x554b98);});delete _0x52dfa3['timers'][_0x1dd0d5];};}});}else{logger['info'](_0xfc8f('0x2f'),_0x521327,_0x1dd0d5,_0x3950a9);}});}})['catch'](function(_0x370cb5){logger[_0xfc8f('0x2e')](_0xfc8f('0x23'),_0x521327,_0x52dfa3['voiceQueues'][_0x3950a9][_0xfc8f('0x25')],_0x1dd0d5,_0x3950a9);})[_0xfc8f('0x30')](function(){delete _0x52dfa3[_0xfc8f('0x7')][_0x521327];});}catch(_0xeec715){logger[_0xfc8f('0x2e')](_0xfc8f('0x31'),_0xeec715[_0xfc8f('0x32')]);}};Acw[_0xfc8f('0x12')]['stopAcw']=function(_0x37db16){try{var _0x346dfa=this;if(_0x346dfa[_0xfc8f('0x6')][_0x37db16]){_0x346dfa[_0xfc8f('0x6')][_0x37db16]['timer']=![];var _0x2c74fe=_0x346dfa[_0xfc8f('0x6')][_0x37db16][_0xfc8f('0x29')];var _0x52966a=_0x346dfa[_0xfc8f('0x6')][_0x37db16][_0xfc8f('0x2a')];var _0x1d90d8=_0x346dfa[_0xfc8f('0x4')][_0x52966a][_0xfc8f('0x25')];logger['info']('[%s][TIMER][STOP][AGENT:%s]',_0x2c74fe,_0x37db16);RpcUser[_0xfc8f('0x33')](this['agents'][_0x37db16]);RpcVoiceAgentReport[_0xfc8f('0x2c')]({'acwtime':_0x1d90d8,'agentacw':!![]},_0x2c74fe,_0x37db16)[_0xfc8f('0x1b')](function(_0x1b407e){logger[_0xfc8f('0x1e')]('[%s][UPDATE][ACWTIME:%s]',_0x2c74fe,_0x1d90d8,_0x1b407e);})[_0xfc8f('0x2d')](function(_0x5f29e7){logger[_0xfc8f('0x2e')](_0xfc8f('0x34'),_0x2c74fe,_0x5f29e7);});}else{logger['error']('[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer',_0x37db16);if(_0x346dfa[_0xfc8f('0x6')]){logger[_0xfc8f('0x1e')](_0xfc8f('0x35'),JSON[_0xfc8f('0x36')](_0x346dfa[_0xfc8f('0x6')]));}}}catch(_0x1c3d6f){logger['error'](_0xfc8f('0x37'),_0x1c3d6f['message']);}};Acw[_0xfc8f('0x12')][_0xfc8f('0x38')]=function(_0x411a00){try{if(this['voiceQueues'][_0x411a00['queue']]&&(this[_0xfc8f('0x4')][_0x411a00[_0xfc8f('0x2a')]][_0xfc8f('0x2')]||this['voiceQueues'][_0x411a00[_0xfc8f('0x2a')]][_0xfc8f('0x16')])){if(this[_0xfc8f('0x5')][_0x411a00[_0xfc8f('0x14')]]){this[_0xfc8f('0x7')][_0x411a00[_0xfc8f('0x29')]]={'queue':_0x411a00[_0xfc8f('0x2a')],'interface':_0x411a00[_0xfc8f('0x14')],'destlinkedid':_0x411a00['destlinkedid']};}}}catch(_0x33596f){logger[_0xfc8f('0x2e')]('[ACW][syncAgentConnect]\x20%s',_0x33596f['message']);}};Acw[_0xfc8f('0x12')][_0xfc8f('0xe')]=function(_0x37014b){try{if(this[_0xfc8f('0x4')][_0x37014b[_0xfc8f('0x2a')]]&&(this['voiceQueues'][_0x37014b[_0xfc8f('0x2a')]]['acw']||this[_0xfc8f('0x4')][_0x37014b[_0xfc8f('0x2a')]][_0xfc8f('0x16')])){if(this[_0xfc8f('0x5')][_0x37014b[_0xfc8f('0x14')]]){this[_0xfc8f('0x7')][_0x37014b['uniqueid']]={'queue':_0x37014b['queue'],'interface':_0x37014b[_0xfc8f('0x14')]};}}}catch(_0x26d04b){logger[_0xfc8f('0x2e')](_0xfc8f('0x39'),_0x26d04b['message']);}};Acw[_0xfc8f('0x12')][_0xfc8f('0xa')]=function(_0x5e2de6){try{if(this[_0xfc8f('0x7')][_0x5e2de6[_0xfc8f('0x29')]]&&_[_0xfc8f('0x3a')](this[_0xfc8f('0x7')][_0x5e2de6[_0xfc8f('0x29')]][_0xfc8f('0x20')])){logger[_0xfc8f('0x1e')](_0xfc8f('0x3b'),_0x5e2de6[_0xfc8f('0x29')]);this['startAcw'](_0x5e2de6[_0xfc8f('0x29')]);}else if(this[_0xfc8f('0x7')][_0x5e2de6[_0xfc8f('0x3c')]]&&_[_0xfc8f('0x3a')](this[_0xfc8f('0x7')][_0x5e2de6[_0xfc8f('0x3c')]][_0xfc8f('0x20')])){logger['info'](_0xfc8f('0x3d'),_0x5e2de6[_0xfc8f('0x3c')]);this[_0xfc8f('0x13')](_0x5e2de6[_0xfc8f('0x3c')]);}}catch(_0x1c573a){logger[_0xfc8f('0x2e')]('[ACW][syncHangupRequest]\x20%s',_0x1c573a[_0xfc8f('0x32')]);}};Acw[_0xfc8f('0x12')][_0xfc8f('0xb')]=function(_0x47d9ce){try{if(this[_0xfc8f('0x7')][_0x47d9ce[_0xfc8f('0x29')]]&&this[_0xfc8f('0x7')][_0x47d9ce['uniqueid']]['attended']){logger[_0xfc8f('0x1e')](_0xfc8f('0x3e'),_0x47d9ce[_0xfc8f('0x29')]);this[_0xfc8f('0x13')](_0x47d9ce[_0xfc8f('0x29')]);}else if(this[_0xfc8f('0x7')][_0x47d9ce['linkedid']]&&this[_0xfc8f('0x7')][_0x47d9ce['linkedid']][_0xfc8f('0x20')]){logger[_0xfc8f('0x1e')](_0xfc8f('0x3f'),_0x47d9ce['linkedid']);this[_0xfc8f('0x13')](_0x47d9ce['linkedid']);}}catch(_0x53a6cf){logger['error'](_0xfc8f('0x40'),_0x53a6cf[_0xfc8f('0x32')]);}};Acw['prototype'][_0xfc8f('0x41')]=function(_0x12972a){try{if(!_[_0xfc8f('0x42')](this[_0xfc8f('0x7')][_0x12972a['transfereeuniqueid']])){this[_0xfc8f('0x13')](_0x12972a[_0xfc8f('0x43')]);if(this[_0xfc8f('0x7')][_0x12972a[_0xfc8f('0x44')]]){this[_0xfc8f('0x7')][_0x12972a[_0xfc8f('0x44')]]['attended']=!![];this[_0xfc8f('0x7')][_0x12972a[_0xfc8f('0x45')]]=this['channels'][_0x12972a[_0xfc8f('0x44')]];delete this[_0xfc8f('0x7')][_0x12972a[_0xfc8f('0x44')]];}}else if(!_[_0xfc8f('0x42')](this['channels'][_0x12972a[_0xfc8f('0x45')]])){this['startAcw'](_0x12972a[_0xfc8f('0x45')]);if(this['channels'][_0x12972a[_0xfc8f('0x46')]]){this[_0xfc8f('0x7')][_0x12972a[_0xfc8f('0x46')]]['attended']=!![];this[_0xfc8f('0x7')][_0x12972a[_0xfc8f('0x43')]]=this[_0xfc8f('0x7')][_0x12972a['origtransfereruniqueid']];delete this[_0xfc8f('0x7')][_0x12972a[_0xfc8f('0x46')]];}}}catch(_0x59faf9){logger[_0xfc8f('0x2e')](_0xfc8f('0x47'),_0x59faf9[_0xfc8f('0x32')]);}};Acw[_0xfc8f('0x12')]['syncBlindTransfer']=function(_0xa97b59){try{if(this['channels'][_0xa97b59[_0xfc8f('0x48')]]){logger[_0xfc8f('0x1e')](_0xfc8f('0x49'),JSON[_0xfc8f('0x36')](_0xa97b59[_0xfc8f('0x48')]));this[_0xfc8f('0x13')](_0xa97b59[_0xfc8f('0x48')]);}else if(this[_0xfc8f('0x7')][_0xa97b59['transfererlinkedid']]){logger[_0xfc8f('0x1e')](_0xfc8f('0x4a'),JSON['stringify'](_0xa97b59['transfererlinkedid']));this[_0xfc8f('0x13')](_0xa97b59[_0xfc8f('0x4b')]);}}catch(_0x5d7af0){logger[_0xfc8f('0x2e')]('[ACW][syncBlindTransfer]\x20%s',_0x5d7af0[_0xfc8f('0x32')]);}};Acw[_0xfc8f('0x12')]['syncAgentRingNoAnswer']=function(_0x1bc166){try{if(this[_0xfc8f('0x4')][_0x1bc166[_0xfc8f('0x2a')]]&&this[_0xfc8f('0x4')][_0x1bc166[_0xfc8f('0x2a')]]['autopause']===_0xfc8f('0x4c')){if(this[_0xfc8f('0x5')][_0x1bc166[_0xfc8f('0x14')]]){logger['info'](_0xfc8f('0x4d'),_0x1bc166[_0xfc8f('0x29')],_0x1bc166[_0xfc8f('0x14')],_0x1bc166[_0xfc8f('0x2a')]);return RpcUser['savePause'](this[_0xfc8f('0x5')][_0x1bc166[_0xfc8f('0x14')]],_0xfc8f('0x4e'),_0x1bc166[_0xfc8f('0x29')]);}}}catch(_0x19f19b){logger[_0xfc8f('0x2e')](_0xfc8f('0x4f'),_0x19f19b[_0xfc8f('0x32')]);}};module['exports']=Acw; \ No newline at end of file diff --git a/server/services/ami/ami.js b/server/services/ami/ami.js index 575d781..c34d9f1 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 _0x2032=['exports','bluebird','moment','util','../../config/logger','ami','asterisk','port','username','password','keepConnected','Action','promisify','action','format','error','Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s','devicestatelist','actionSipPeerStatus','sippeerstatus','actionQueueSummary','queuesummary','actionCoreShowChannels','info','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s','once','close','connect','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','Fullybooted\x20\x22%s\x22\x20to\x20%s:%s','resolve','then','actionSipShowRegistry','actionDeviceStateList','catch','inspect'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x2032,0xd9));var _0x2203=function(_0x879448,_0x556c79){_0x879448=_0x879448-0x0;var _0x55564d=_0x2032[_0x879448];return _0x55564d;};'use strict';var Manager=require('asterisk-manager');var BPromise=require(_0x2203('0x0'));var moment=require(_0x2203('0x1'));var util=require(_0x2203('0x2'));var _=require('lodash');var logger=require(_0x2203('0x3'))(_0x2203('0x4'));var config=require('../../config/environment');var ami=new Manager(config[_0x2203('0x5')][_0x2203('0x6')],config[_0x2203('0x5')]['ip'],config[_0x2203('0x5')][_0x2203('0x7')],config[_0x2203('0x5')][_0x2203('0x8')],!![]);ami[_0x2203('0x9')]();ami[_0x2203('0xa')]=BPromise[_0x2203('0xb')](ami[_0x2203('0xc')]);function error(_0x5ecf9e){logger['error'](util[_0x2203('0xd')]('Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s',config[_0x2203('0x5')][_0x2203('0x7')],config[_0x2203('0x5')]['ip'],config['asterisk'][_0x2203('0x6')],util['inspect'](_0x5ecf9e,![],null)));}function close(){logger[_0x2203('0xe')](util['format'](_0x2203('0xf'),config[_0x2203('0x5')]['username'],config['asterisk']['ip'],config['asterisk']['port']));}ami['actionSipShowRegistry']=function(){return function(){return ami[_0x2203('0xa')]({'action':'sipshowregistry'});};};ami['actionDeviceStateList']=function(){return function(){return ami[_0x2203('0xa')]({'action':_0x2203('0x10')});};};ami[_0x2203('0x11')]=function(){return function(){return ami[_0x2203('0xa')]({'action':_0x2203('0x12')});};};ami[_0x2203('0x13')]=function(){return function(){return ami[_0x2203('0xa')]({'action':_0x2203('0x14')});};};ami[_0x2203('0x15')]=function(){return function(){return ami[_0x2203('0xa')]({'action':'coreshowchannels'});};};function connect(_0x280eda){logger[_0x2203('0x16')](util['format'](_0x2203('0x17'),config[_0x2203('0x5')]['username'],config[_0x2203('0x5')]['ip'],config['asterisk'][_0x2203('0x6')]));ami[_0x2203('0x18')](_0x2203('0xe'),error);ami[_0x2203('0x18')](_0x2203('0x19'),close);}ami['on'](_0x2203('0x1a'),connect);ami['on']('shutdown',function(_0x13d3f7){logger['info'](util['format'](_0x2203('0x1b'),config['asterisk'][_0x2203('0x7')],config[_0x2203('0x5')]['ip'],config['asterisk'][_0x2203('0x6')],util['inspect'](_0x13d3f7,![],null)));});ami['on']('fullybooted',function(_0x226374){logger[_0x2203('0x16')](util[_0x2203('0xd')](_0x2203('0x1c'),config[_0x2203('0x5')][_0x2203('0x7')],config[_0x2203('0x5')]['ip'],config[_0x2203('0x5')]['port']));return BPromise[_0x2203('0x1d')]()[_0x2203('0x1e')](ami[_0x2203('0x1f')]())['then'](ami[_0x2203('0x20')]())[_0x2203('0x1e')](ami['actionSipPeerStatus']())[_0x2203('0x1e')](ami[_0x2203('0x13')]())[_0x2203('0x1e')](ami[_0x2203('0x15')]())[_0x2203('0x21')](function(_0x1df508){logger[_0x2203('0xe')]('[ami.js][fullybooted]',util[_0x2203('0x22')](_0x1df508,{'showHidden':![],'depth':null}));});});ami[_0x2203('0x18')](_0x2203('0xe'),error);ami[_0x2203('0x18')]('close',close);module[_0x2203('0x23')]=ami; \ No newline at end of file +var _0xb7e7=['username','Action','devicestatelist','actionSipPeerStatus','sippeerstatus','queuesummary','actionCoreShowChannels','coreshowchannels','info','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s','once','close','shutdown','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','fullybooted','Fullybooted\x20\x22%s\x22\x20to\x20%s:%s','resolve','then','actionSipShowRegistry','actionDeviceStateList','catch','[ami.js][fullybooted]','exports','asterisk-manager','moment','lodash','ami','asterisk','port','password','keepConnected','promisify','action','error','format','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','inspect','Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s'];(function(_0x9e3314,_0x5f330c){var _0xf5f5d6=function(_0x1f82ff){while(--_0x1f82ff){_0x9e3314['push'](_0x9e3314['shift']());}};_0xf5f5d6(++_0x5f330c);}(_0xb7e7,0x121));var _0x7b7e=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xb7e7[_0x20a584];return _0x4b41a8;};'use strict';var Manager=require(_0x7b7e('0x0'));var BPromise=require('bluebird');var moment=require(_0x7b7e('0x1'));var util=require('util');var _=require(_0x7b7e('0x2'));var logger=require('../../config/logger')(_0x7b7e('0x3'));var config=require('../../config/environment');var ami=new Manager(config[_0x7b7e('0x4')][_0x7b7e('0x5')],config[_0x7b7e('0x4')]['ip'],config['asterisk']['username'],config[_0x7b7e('0x4')][_0x7b7e('0x6')],!![]);ami[_0x7b7e('0x7')]();ami['Action']=BPromise[_0x7b7e('0x8')](ami[_0x7b7e('0x9')]);function error(_0x2917f9){logger[_0x7b7e('0xa')](util[_0x7b7e('0xb')](_0x7b7e('0xc'),config[_0x7b7e('0x4')]['username'],config[_0x7b7e('0x4')]['ip'],config[_0x7b7e('0x4')][_0x7b7e('0x5')],util[_0x7b7e('0xd')](_0x2917f9,![],null)));}function close(){logger[_0x7b7e('0xa')](util[_0x7b7e('0xb')](_0x7b7e('0xe'),config[_0x7b7e('0x4')][_0x7b7e('0xf')],config['asterisk']['ip'],config[_0x7b7e('0x4')][_0x7b7e('0x5')]));}ami['actionSipShowRegistry']=function(){return function(){return ami[_0x7b7e('0x10')]({'action':'sipshowregistry'});};};ami['actionDeviceStateList']=function(){return function(){return ami[_0x7b7e('0x10')]({'action':_0x7b7e('0x11')});};};ami[_0x7b7e('0x12')]=function(){return function(){return ami[_0x7b7e('0x10')]({'action':_0x7b7e('0x13')});};};ami['actionQueueSummary']=function(){return function(){return ami['Action']({'action':_0x7b7e('0x14')});};};ami[_0x7b7e('0x15')]=function(){return function(){return ami[_0x7b7e('0x10')]({'action':_0x7b7e('0x16')});};};function connect(_0x2cc400){logger[_0x7b7e('0x17')](util[_0x7b7e('0xb')](_0x7b7e('0x18'),config[_0x7b7e('0x4')][_0x7b7e('0xf')],config[_0x7b7e('0x4')]['ip'],config[_0x7b7e('0x4')][_0x7b7e('0x5')]));ami[_0x7b7e('0x19')](_0x7b7e('0xa'),error);ami[_0x7b7e('0x19')](_0x7b7e('0x1a'),close);}ami['on']('connect',connect);ami['on'](_0x7b7e('0x1b'),function(_0x43db4f){logger[_0x7b7e('0x17')](util['format'](_0x7b7e('0x1c'),config[_0x7b7e('0x4')][_0x7b7e('0xf')],config[_0x7b7e('0x4')]['ip'],config[_0x7b7e('0x4')][_0x7b7e('0x5')],util[_0x7b7e('0xd')](_0x43db4f,![],null)));});ami['on'](_0x7b7e('0x1d'),function(_0x53bbb3){logger['info'](util['format'](_0x7b7e('0x1e'),config[_0x7b7e('0x4')][_0x7b7e('0xf')],config['asterisk']['ip'],config['asterisk']['port']));return BPromise[_0x7b7e('0x1f')]()[_0x7b7e('0x20')](ami[_0x7b7e('0x21')]())[_0x7b7e('0x20')](ami[_0x7b7e('0x22')]())['then'](ami[_0x7b7e('0x12')]())[_0x7b7e('0x20')](ami['actionQueueSummary']())['then'](ami['actionCoreShowChannels']())[_0x7b7e('0x23')](function(_0x423832){logger['error'](_0x7b7e('0x24'),util['inspect'](_0x423832,{'showHidden':![],'depth':null}));});});ami[_0x7b7e('0x19')](_0x7b7e('0xa'),error);ami[_0x7b7e('0x19')]('close',close);module[_0x7b7e('0x25')]=ami; \ No newline at end of file diff --git a/server/services/ami/client.js b/server/services/ami/client.js index dfd4b01..d9a6284 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 _0xb43b=['catch','exports','jayson/promise','bluebird','ami','client','http','rpc','memberReport','error','message','result'];(function(_0x3362e5,_0x5091d1){var _0x228031=function(_0x57d88c){while(--_0x57d88c){_0x3362e5['push'](_0x3362e5['shift']());}};_0x228031(++_0x5091d1);}(_0xb43b,0x1b2));var _0xbb43=function(_0x36ce28,_0x2e0009){_0x36ce28=_0x36ce28-0x0;var _0x29dd5a=_0xb43b[_0x36ce28];return _0x29dd5a;};'use strict';var jayson=require(_0xbb43('0x0'));var BPromise=require(_0xbb43('0x1'));var logger=require('../../config/logger')(_0xbb43('0x2'));var client=jayson[_0xbb43('0x3')][_0xbb43('0x4')]({'port':0x2329});client['Request']=function(_0x131e9e,_0x41aff6){return new BPromise(function(_0x351254,_0x16432a){return client['request'](_0x131e9e,_0x41aff6)['then'](function(_0x378df5){logger['debug'](_0xbb43('0x5'),_0xbb43('0x6'),_0x131e9e,_0x41aff6,_0x378df5);if(_0x378df5[_0xbb43('0x7')]){logger[_0xbb43('0x7')](_0xbb43('0x5'),'memberReport',_0x131e9e,_0x378df5[_0xbb43('0x7')][_0xbb43('0x8')],_0x41aff6);return _0x16432a(_0x378df5['error'][_0xbb43('0x8')]);}else{return _0x351254(_0x378df5[_0xbb43('0x9')]);}})[_0xbb43('0xa')](function(_0x5e3611){logger[_0xbb43('0x7')](_0xbb43('0x5'),'memberReport',_0x131e9e,_0x5e3611,_0x41aff6);return _0x16432a(_0x5e3611);});});};module[_0xbb43('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(_0x2f2360,_0x151089){var _0x1cc8d3=function(_0x5e356f){while(--_0x5e356f){_0x2f2360['push'](_0x2f2360['shift']());}};_0x1cc8d3(++_0x151089);}(_0xe706,0xa3));var _0x6e70=function(_0x160248,_0x2a57e6){_0x160248=_0x160248-0x0;var _0x4e589d=_0xe706[_0x160248];return _0x4e589d;};'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 180c806..2327999 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 _0xf265=['moment','isNil','string','voiceQueue','uniqueid','Contact','phone','firstName','lastName','number','queue','name','active','type','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ListId','UserId','VoiceQueueId','CampaignId','idHopper','starttime','YYYY-MM-DD\x20HH:mm:ss','callback','callbackuniqueid','callbackat','recallme','originatecalleridnum','originatecalleridname','prototype','getCaller','\x22%s\x22\x20<%s>','dialCutDigit','exports','util','lodash'];(function(_0x259d17,_0x220710){var _0x407535=function(_0x49bc38){while(--_0x49bc38){_0x259d17['push'](_0x259d17['shift']());}};_0x407535(++_0x220710);}(_0xf265,0x181));var _0x5f26=function(_0x30be39,_0xfb49ad){_0x30be39=_0x30be39-0x0;var _0x4d99d6=_0xf265[_0x30be39];return _0x4d99d6;};'use strict';var util=require(_0x5f26('0x0'));var _=require(_0x5f26('0x1'));var moment=require(_0x5f26('0x2'));function checkNameSurname(_0x230da2,_0x1f3364,_0x5b80ad){var _0x540a6f='';if(!_[_0x5f26('0x3')](_0x1f3364)&&'string'===typeof _0x1f3364){_0x540a6f+=_0x1f3364;}if(!_[_0x5f26('0x3')](_0x5b80ad)&&_0x5f26('0x4')===typeof _0x5b80ad){_0x540a6f+='\x20'+_0x5b80ad;}if(_0x540a6f!==''){return _0x540a6f;}return _0x230da2;}function Action(_0x4e3bc7,_0x1d0fe4,_0x366f74){this[_0x5f26('0x5')]=_0x4e3bc7;this[_0x5f26('0x6')]=_0x366f74||undefined;this['name']=checkNameSurname(_0x1d0fe4[_0x5f26('0x7')][_0x5f26('0x8')],_0x1d0fe4['Contact'][_0x5f26('0x9')],_0x1d0fe4[_0x5f26('0x7')][_0x5f26('0xa')]);this[_0x5f26('0xb')]=_0x1d0fe4['Contact'][_0x5f26('0x8')];this[_0x5f26('0xc')]=_0x4e3bc7[_0x5f26('0xd')];this[_0x5f26('0xe')]=_0x1d0fe4[_0x5f26('0xe')]||![];this['type']=_0x4e3bc7[_0x5f26('0xf')];this['dialQueueTimeout']=_0x4e3bc7['dialQueueTimeout']||0x3;this[_0x5f26('0x10')]=_0x1d0fe4[_0x5f26('0x10')];this[_0x5f26('0x11')]=_0x1d0fe4[_0x5f26('0x11')];this[_0x5f26('0x12')]=_0x1d0fe4['countcongestionretry'];this[_0x5f26('0x13')]=_0x1d0fe4[_0x5f26('0x13')];this[_0x5f26('0x14')]=_0x1d0fe4['countnosuchnumberretry'];this[_0x5f26('0x15')]=_0x1d0fe4[_0x5f26('0x15')];this[_0x5f26('0x16')]=_0x1d0fe4[_0x5f26('0x16')];this[_0x5f26('0x17')]=_0x1d0fe4[_0x5f26('0x17')];this['countagentrejectretry']=_0x1d0fe4[_0x5f26('0x18')];this['ContactId']=_0x1d0fe4['ContactId'];this['ListId']=_0x1d0fe4[_0x5f26('0x19')];this[_0x5f26('0x1a')]=_0x1d0fe4['UserId'];this['VoiceQueueId']=_0x1d0fe4[_0x5f26('0x1b')];this[_0x5f26('0x1c')]=_0x1d0fe4[_0x5f26('0x1c')];this[_0x5f26('0x1d')]=_0x1d0fe4['id'];this['ContactFirstName']=_0x1d0fe4[_0x5f26('0x7')][_0x5f26('0x9')]||'';this[_0x5f26('0x1e')]=moment()['format'](_0x5f26('0x1f'));this[_0x5f26('0x20')]=_0x1d0fe4['callback'];this['callbackuniqueid']=_0x1d0fe4[_0x5f26('0x21')];this[_0x5f26('0x22')]=_0x1d0fe4[_0x5f26('0x22')];this[_0x5f26('0x23')]=_0x1d0fe4[_0x5f26('0x23')];this[_0x5f26('0x24')]='';this[_0x5f26('0x25')]='';}Action[_0x5f26('0x26')][_0x5f26('0x27')]=function(){return util['format'](_0x5f26('0x28'),this[_0x5f26('0xd')],this[_0x5f26('0x5')][_0x5f26('0x29')]>0x0?this[_0x5f26('0xb')]['substring'](this['voiceQueue'][_0x5f26('0x29')]):this[_0x5f26('0xb')]);};Action[_0x5f26('0x26')]['getQueue']=function(){return this['queue'];};module[_0x5f26('0x2a')]=Action; \ No newline at end of file +var _0x2716=['idHopper','ContactFirstName','firstName','starttime','YYYY-MM-DD\x20HH:mm:ss','callback','callbackuniqueid','callbackat','recallme','originatecalleridnum','originatecalleridname','prototype','format','\x22%s\x22\x20<%s>','dialCutDigit','substring','exports','util','lodash','moment','isNil','string','voiceQueue','name','Contact','number','phone','queue','active','type','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ContactId','ListId','UserId','VoiceQueueId','CampaignId'];(function(_0x4939b4,_0x2a61ce){var _0x423676=function(_0x16105a){while(--_0x16105a){_0x4939b4['push'](_0x4939b4['shift']());}};_0x423676(++_0x2a61ce);}(_0x2716,0xc5));var _0x6271=function(_0x4d04d6,_0x38ae19){_0x4d04d6=_0x4d04d6-0x0;var _0x2e937a=_0x2716[_0x4d04d6];return _0x2e937a;};'use strict';var util=require(_0x6271('0x0'));var _=require(_0x6271('0x1'));var moment=require(_0x6271('0x2'));function checkNameSurname(_0x35c983,_0x1c9c00,_0x5c9e5b){var _0x33aaa6='';if(!_[_0x6271('0x3')](_0x1c9c00)&&'string'===typeof _0x1c9c00){_0x33aaa6+=_0x1c9c00;}if(!_[_0x6271('0x3')](_0x5c9e5b)&&_0x6271('0x4')===typeof _0x5c9e5b){_0x33aaa6+='\x20'+_0x5c9e5b;}if(_0x33aaa6!==''){return _0x33aaa6;}return _0x35c983;}function Action(_0x12fbe1,_0x3d6e8d,_0x4bc37f){this[_0x6271('0x5')]=_0x12fbe1;this['uniqueid']=_0x4bc37f||undefined;this[_0x6271('0x6')]=checkNameSurname(_0x3d6e8d['Contact']['phone'],_0x3d6e8d[_0x6271('0x7')]['firstName'],_0x3d6e8d['Contact']['lastName']);this[_0x6271('0x8')]=_0x3d6e8d[_0x6271('0x7')][_0x6271('0x9')];this[_0x6271('0xa')]=_0x12fbe1[_0x6271('0x6')];this['active']=_0x3d6e8d[_0x6271('0xb')]||![];this[_0x6271('0xc')]=_0x12fbe1['type'];this[_0x6271('0xd')]=_0x12fbe1['dialQueueTimeout']||0x3;this[_0x6271('0xe')]=_0x3d6e8d['scheduledat'];this[_0x6271('0xf')]=_0x3d6e8d[_0x6271('0xf')];this[_0x6271('0x10')]=_0x3d6e8d[_0x6271('0x10')];this[_0x6271('0x11')]=_0x3d6e8d[_0x6271('0x11')];this[_0x6271('0x12')]=_0x3d6e8d[_0x6271('0x12')];this[_0x6271('0x13')]=_0x3d6e8d[_0x6271('0x13')];this[_0x6271('0x14')]=_0x3d6e8d[_0x6271('0x14')];this['countmachineretry']=_0x3d6e8d[_0x6271('0x15')];this['countagentrejectretry']=_0x3d6e8d[_0x6271('0x16')];this[_0x6271('0x17')]=_0x3d6e8d['ContactId'];this['ListId']=_0x3d6e8d[_0x6271('0x18')];this[_0x6271('0x19')]=_0x3d6e8d['UserId'];this[_0x6271('0x1a')]=_0x3d6e8d[_0x6271('0x1a')];this[_0x6271('0x1b')]=_0x3d6e8d['CampaignId'];this[_0x6271('0x1c')]=_0x3d6e8d['id'];this[_0x6271('0x1d')]=_0x3d6e8d[_0x6271('0x7')][_0x6271('0x1e')]||'';this[_0x6271('0x1f')]=moment()['format'](_0x6271('0x20'));this[_0x6271('0x21')]=_0x3d6e8d[_0x6271('0x21')];this['callbackuniqueid']=_0x3d6e8d[_0x6271('0x22')];this[_0x6271('0x23')]=_0x3d6e8d[_0x6271('0x23')];this[_0x6271('0x24')]=_0x3d6e8d[_0x6271('0x24')];this[_0x6271('0x25')]='';this[_0x6271('0x26')]='';}Action[_0x6271('0x27')]['getCaller']=function(){return util[_0x6271('0x28')](_0x6271('0x29'),this[_0x6271('0x6')],this[_0x6271('0x5')][_0x6271('0x2a')]>0x0?this[_0x6271('0x8')][_0x6271('0x2b')](this['voiceQueue'][_0x6271('0x2a')]):this['number']);};Action[_0x6271('0x27')]['getQueue']=function(){return this[_0x6271('0xa')];};module[_0x6271('0x2c')]=Action; \ No newline at end of file diff --git a/server/services/ami/dialer/agentComplete.js b/server/services/ami/dialer/agentComplete.js index fb89d6c..a1de9f1 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 _0x27b7=['endtime','format','ringtime','holdtime','talktime','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment','milliseconds','diff','seconds','state','statedesc','scheduledat','type','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countabandonedretry','countdropretry','countmachineretry','countagentrejectretry','calleridname','name','number','starttime','responsetime','answertime'];(function(_0x563c98,_0x2f8da9){var _0xa66272=function(_0x514fcf){while(--_0x514fcf){_0x563c98['push'](_0x563c98['shift']());}};_0xa66272(++_0x2f8da9);}(_0x27b7,0x6c));var _0x727b=function(_0x5819b7,_0xa2276c){_0x5819b7=_0x5819b7-0x0;var _0x41b79a=_0x27b7[_0x5819b7];return _0x41b79a;};'use strict';var util=require(_0x727b('0x0'));var _=require(_0x727b('0x1'));var moment=require(_0x727b('0x2'));function getSeconds(_0x55a8cf,_0x45bcd9){var _0x312001=moment(_0x55a8cf)[_0x727b('0x3')](0x0);var _0x8563fd=moment(_0x45bcd9)[_0x727b('0x3')](0x0);return _0x312001[_0x727b('0x4')](_0x8563fd,_0x727b('0x5'));}function AgentComplete(_0x4cadee,_0xa6c942){this[_0x727b('0x6')]=0x4;this[_0x727b('0x7')]='Answer';this[_0x727b('0x8')]=_0x4cadee['scheduledat'];this[_0x727b('0x9')]=_0x4cadee[_0x727b('0x9')];this['campaigntype']=_0x4cadee[_0x727b('0x9')]===_0x727b('0xa')?_0x727b('0xb'):_0x4cadee[_0x727b('0x9')];this[_0x727b('0xc')]=_0x4cadee['countbusyretry'];this[_0x727b('0xd')]=_0x4cadee[_0x727b('0xd')];this['countnoanswerretry']=_0x4cadee[_0x727b('0xe')];this[_0x727b('0xf')]=_0x4cadee['countbusyretry']+_0x4cadee[_0x727b('0xd')]+_0x4cadee[_0x727b('0xe')]+_0x4cadee[_0x727b('0x10')]+_0x4cadee['countdropretry']+_0x4cadee[_0x727b('0x11')]+_0x4cadee['countmachineretry']+_0x4cadee['countagentrejectretry'];this[_0x727b('0x10')]=_0x4cadee[_0x727b('0x10')];this[_0x727b('0x12')]=_0x4cadee[_0x727b('0x12')];this['countabandonedretry']=_0x4cadee[_0x727b('0x11')];this['countmachineretry']=_0x4cadee[_0x727b('0x13')];this[_0x727b('0x14')]=_0x4cadee[_0x727b('0x14')];this['uniqueid']=_0xa6c942['uniqueid'];this[_0x727b('0x15')]=_0x4cadee[_0x727b('0x16')];this['calleridnum']=_0x4cadee[_0x727b('0x17')];this[_0x727b('0x18')]=_0x4cadee['starttime'];this['responsetime']=_0x4cadee[_0x727b('0x19')];this['answertime']=_0x4cadee[_0x727b('0x1a')];this[_0x727b('0x1b')]=moment()[_0x727b('0x1c')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x727b('0x1d')]=getSeconds(_0x4cadee[_0x727b('0x19')],_0x4cadee[_0x727b('0x18')]);this[_0x727b('0x1e')]=getSeconds(_0x4cadee['answertime'],_0x4cadee[_0x727b('0x19')]);this[_0x727b('0x1f')]=getSeconds(this[_0x727b('0x1b')],_0x4cadee[_0x727b('0x1a')]);this[_0x727b('0xb')]=_0xa6c942[_0x727b('0xb')];this['membername']=_0xa6c942['membername'];this['reason']=_0xa6c942[_0x727b('0x20')];this[_0x727b('0x21')]=_0x4cadee['callback'];this[_0x727b('0x22')]=_0x4cadee['callbackuniqueid'];this[_0x727b('0x23')]=_0x4cadee[_0x727b('0x23')];this[_0x727b('0x24')]=_0x4cadee['recallme'];this[_0x727b('0x25')]=_0x4cadee[_0x727b('0x25')];this['ListId']=_0x4cadee[_0x727b('0x26')];this[_0x727b('0x27')]=_0x4cadee[_0x727b('0x27')];this[_0x727b('0x28')]=_0x4cadee['VoiceQueueId'];this[_0x727b('0x29')]=_0x4cadee['CampaignId'];this[_0x727b('0x2a')]=_0x4cadee[_0x727b('0x2a')]||'';this[_0x727b('0x2b')]=_0x4cadee[_0x727b('0x2b')]||'';}module[_0x727b('0x2c')]=AgentComplete; \ No newline at end of file +var _0x7752=['responsetime','answertime','endtime','format','ringtime','holdtime','talktime','reason','callbackuniqueid','callbackat','recallme','ContactId','ListId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','util','lodash','milliseconds','diff','seconds','Answer','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','name','calleridnum','number','starttime'];(function(_0x202c61,_0x3673e0){var _0x540691=function(_0x409610){while(--_0x409610){_0x202c61['push'](_0x202c61['shift']());}};_0x540691(++_0x3673e0);}(_0x7752,0x92));var _0x2775=function(_0x23fb5b,_0x1b20ce){_0x23fb5b=_0x23fb5b-0x0;var _0x5630c0=_0x7752[_0x23fb5b];return _0x5630c0;};'use strict';var util=require(_0x2775('0x0'));var _=require(_0x2775('0x1'));var moment=require('moment');function getSeconds(_0x2d01a2,_0x205003){var _0x110e43=moment(_0x2d01a2)[_0x2775('0x2')](0x0);var _0x363e68=moment(_0x205003)[_0x2775('0x2')](0x0);return _0x110e43[_0x2775('0x3')](_0x363e68,_0x2775('0x4'));}function AgentComplete(_0x4066bc,_0x17792b){this['state']=0x4;this['statedesc']=_0x2775('0x5');this[_0x2775('0x6')]=_0x4066bc[_0x2775('0x6')];this[_0x2775('0x7')]=_0x4066bc[_0x2775('0x7')];this[_0x2775('0x8')]=_0x4066bc[_0x2775('0x7')]===_0x2775('0x9')?_0x2775('0xa'):_0x4066bc[_0x2775('0x7')];this[_0x2775('0xb')]=_0x4066bc[_0x2775('0xb')];this['countcongestionretry']=_0x4066bc[_0x2775('0xc')];this[_0x2775('0xd')]=_0x4066bc[_0x2775('0xd')];this[_0x2775('0xe')]=_0x4066bc['countbusyretry']+_0x4066bc[_0x2775('0xc')]+_0x4066bc[_0x2775('0xd')]+_0x4066bc[_0x2775('0xf')]+_0x4066bc[_0x2775('0x10')]+_0x4066bc[_0x2775('0x11')]+_0x4066bc[_0x2775('0x12')]+_0x4066bc[_0x2775('0x13')];this['countnosuchnumberretry']=_0x4066bc[_0x2775('0xf')];this[_0x2775('0x10')]=_0x4066bc[_0x2775('0x10')];this[_0x2775('0x11')]=_0x4066bc[_0x2775('0x11')];this[_0x2775('0x12')]=_0x4066bc[_0x2775('0x12')];this['countagentrejectretry']=_0x4066bc['countagentrejectretry'];this['uniqueid']=_0x17792b[_0x2775('0x14')];this[_0x2775('0x15')]=_0x4066bc[_0x2775('0x16')];this[_0x2775('0x17')]=_0x4066bc[_0x2775('0x18')];this[_0x2775('0x19')]=_0x4066bc[_0x2775('0x19')];this['responsetime']=_0x4066bc[_0x2775('0x1a')];this[_0x2775('0x1b')]=_0x4066bc[_0x2775('0x1b')];this[_0x2775('0x1c')]=moment()[_0x2775('0x1d')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x2775('0x1e')]=getSeconds(_0x4066bc['responsetime'],_0x4066bc[_0x2775('0x19')]);this[_0x2775('0x1f')]=getSeconds(_0x4066bc[_0x2775('0x1b')],_0x4066bc[_0x2775('0x1a')]);this[_0x2775('0x20')]=getSeconds(this[_0x2775('0x1c')],_0x4066bc['answertime']);this['queue']=_0x17792b[_0x2775('0xa')];this['membername']=_0x17792b['membername'];this['reason']=_0x17792b[_0x2775('0x21')];this['callback']=_0x4066bc['callback'];this[_0x2775('0x22')]=_0x4066bc['callbackuniqueid'];this[_0x2775('0x23')]=_0x4066bc[_0x2775('0x23')];this['recallme']=_0x4066bc[_0x2775('0x24')];this[_0x2775('0x25')]=_0x4066bc[_0x2775('0x25')];this[_0x2775('0x26')]=_0x4066bc['ListId'];this['UserId']=_0x4066bc['UserId'];this[_0x2775('0x27')]=_0x4066bc['VoiceQueueId'];this['CampaignId']=_0x4066bc[_0x2775('0x28')];this[_0x2775('0x29')]=_0x4066bc[_0x2775('0x29')]||'';this['originatecalleridname']=_0x4066bc[_0x2775('0x2a')]||'';}module['exports']=AgentComplete; \ No newline at end of file diff --git a/server/services/ami/dialer/final.js b/server/services/ami/dialer/final.js index 6f9fe8f..7e8f89c 100644 --- a/server/services/ami/dialer/final.js +++ b/server/services/ami/dialer/final.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5075=['seconds','uniqueid','scheduledat','type','campaigntype','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','calleridname','calleridnum','starttime','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment','milliseconds','diff'];(function(_0x19c051,_0x1330ab){var _0x29995b=function(_0x11455e){while(--_0x11455e){_0x19c051['push'](_0x19c051['shift']());}};_0x29995b(++_0x1330ab);}(_0x5075,0x73));var _0x5507=function(_0x33a47b,_0x25022a){_0x33a47b=_0x33a47b-0x0;var _0x3164d0=_0x5075[_0x33a47b];return _0x3164d0;};'use strict';var util=require(_0x5507('0x0'));var _=require(_0x5507('0x1'));var moment=require(_0x5507('0x2'));function getSeconds(_0x1a552a,_0x3ec62f){var _0x2b444e=moment(_0x1a552a)[_0x5507('0x3')](0x0);var _0x518ca7=moment(_0x3ec62f)[_0x5507('0x3')](0x0);return _0x2b444e[_0x5507('0x4')](_0x518ca7,_0x5507('0x5'));}function Final(_0x54267f){this['uniqueid']=_0x54267f[_0x5507('0x6')];this[_0x5507('0x7')]=_0x54267f['scheduledat'];this[_0x5507('0x8')]=_0x54267f[_0x5507('0x8')];this[_0x5507('0x9')]=_0x54267f['type']==='outbound'?_0x5507('0xa'):_0x54267f[_0x5507('0x8')];this[_0x5507('0xb')]=_0x54267f[_0x5507('0xb')];this['countcongestionretry']=_0x54267f[_0x5507('0xc')];this[_0x5507('0xd')]=_0x54267f['countnoanswerretry'];this[_0x5507('0xe')]=_0x54267f[_0x5507('0xb')]+_0x54267f['countcongestionretry']+_0x54267f[_0x5507('0xd')]+_0x54267f[_0x5507('0xf')]+_0x54267f[_0x5507('0x10')]+_0x54267f[_0x5507('0x11')]+_0x54267f[_0x5507('0x12')]+_0x54267f[_0x5507('0x13')];this['countnosuchnumberretry']=_0x54267f[_0x5507('0xf')];this[_0x5507('0x10')]=_0x54267f[_0x5507('0x10')];this[_0x5507('0x11')]=_0x54267f['countabandonedretry'];this[_0x5507('0x12')]=_0x54267f[_0x5507('0x12')];this[_0x5507('0x13')]=_0x54267f[_0x5507('0x13')];this[_0x5507('0xa')]=_0x54267f[_0x5507('0xa')];this[_0x5507('0x14')]=_0x54267f[_0x5507('0x14')];this[_0x5507('0x15')]=_0x54267f[_0x5507('0x15')];this[_0x5507('0x16')]=_0x54267f[_0x5507('0x16')];this[_0x5507('0x17')]=_0x54267f['responsetime'];this[_0x5507('0x18')]=_0x54267f[_0x5507('0x17')];this[_0x5507('0x19')]=_0x54267f[_0x5507('0x19')]||0x0;this['holdtime']=_0x54267f[_0x5507('0x1a')]||0x0;this[_0x5507('0x1b')]=_0x54267f[_0x5507('0x1b')]||0x0;this[_0x5507('0x1c')]=_0x54267f[_0x5507('0x1c')];this[_0x5507('0x1d')]=_0x54267f['callbackuniqueid'];this[_0x5507('0x1e')]=_0x54267f[_0x5507('0x1e')];this[_0x5507('0x1f')]=_0x54267f[_0x5507('0x1f')];this[_0x5507('0x20')]=_0x54267f[_0x5507('0x20')];this[_0x5507('0x21')]=_0x54267f[_0x5507('0x21')];this[_0x5507('0x22')]=_0x54267f[_0x5507('0x22')];this[_0x5507('0x23')]=_0x54267f[_0x5507('0x23')];this[_0x5507('0x24')]=_0x54267f[_0x5507('0x24')];this[_0x5507('0x25')]=_0x54267f['originatecalleridnum']||'';this[_0x5507('0x26')]=_0x54267f['originatecalleridname']||'';}module[_0x5507('0x27')]=Final; \ No newline at end of file +var _0xed95=['UserId','VoiceQueueId','CampaignId','originatecalleridnum','exports','util','lodash','moment','milliseconds','diff','seconds','scheduledat','type','campaigntype','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','queue','calleridname','calleridnum','responsetime','endtime','ringtime','holdtime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId'];(function(_0xfb0cfd,_0x500179){var _0x2fd8aa=function(_0xccb501){while(--_0xccb501){_0xfb0cfd['push'](_0xfb0cfd['shift']());}};_0x2fd8aa(++_0x500179);}(_0xed95,0xb9));var _0x5ed9=function(_0x1a756e,_0x52cae9){_0x1a756e=_0x1a756e-0x0;var _0x51baa3=_0xed95[_0x1a756e];return _0x51baa3;};'use strict';var util=require(_0x5ed9('0x0'));var _=require(_0x5ed9('0x1'));var moment=require(_0x5ed9('0x2'));function getSeconds(_0x1f8d72,_0x43e62c){var _0x7b6960=moment(_0x1f8d72)[_0x5ed9('0x3')](0x0);var _0x3e2272=moment(_0x43e62c)[_0x5ed9('0x3')](0x0);return _0x7b6960[_0x5ed9('0x4')](_0x3e2272,_0x5ed9('0x5'));}function Final(_0x15b734){this['uniqueid']=_0x15b734['uniqueid'];this[_0x5ed9('0x6')]=_0x15b734[_0x5ed9('0x6')];this[_0x5ed9('0x7')]=_0x15b734[_0x5ed9('0x7')];this[_0x5ed9('0x8')]=_0x15b734[_0x5ed9('0x7')]==='outbound'?'queue':_0x15b734[_0x5ed9('0x7')];this[_0x5ed9('0x9')]=_0x15b734[_0x5ed9('0x9')];this[_0x5ed9('0xa')]=_0x15b734['countcongestionretry'];this['countnoanswerretry']=_0x15b734[_0x5ed9('0xb')];this[_0x5ed9('0xc')]=_0x15b734[_0x5ed9('0x9')]+_0x15b734[_0x5ed9('0xa')]+_0x15b734['countnoanswerretry']+_0x15b734[_0x5ed9('0xd')]+_0x15b734[_0x5ed9('0xe')]+_0x15b734[_0x5ed9('0xf')]+_0x15b734['countmachineretry']+_0x15b734['countagentrejectretry'];this[_0x5ed9('0xd')]=_0x15b734[_0x5ed9('0xd')];this['countdropretry']=_0x15b734[_0x5ed9('0xe')];this[_0x5ed9('0xf')]=_0x15b734['countabandonedretry'];this['countmachineretry']=_0x15b734[_0x5ed9('0x10')];this[_0x5ed9('0x11')]=_0x15b734['countagentrejectretry'];this[_0x5ed9('0x12')]=_0x15b734[_0x5ed9('0x12')];this['calleridname']=_0x15b734[_0x5ed9('0x13')];this[_0x5ed9('0x14')]=_0x15b734['calleridnum'];this['starttime']=_0x15b734['starttime'];this['responsetime']=_0x15b734[_0x5ed9('0x15')];this[_0x5ed9('0x16')]=_0x15b734[_0x5ed9('0x15')];this[_0x5ed9('0x17')]=_0x15b734['ringtime']||0x0;this[_0x5ed9('0x18')]=_0x15b734[_0x5ed9('0x18')]||0x0;this['talktime']=_0x15b734['talktime']||0x0;this['callback']=_0x15b734[_0x5ed9('0x19')];this[_0x5ed9('0x1a')]=_0x15b734['callbackuniqueid'];this[_0x5ed9('0x1b')]=_0x15b734[_0x5ed9('0x1b')];this[_0x5ed9('0x1c')]=_0x15b734[_0x5ed9('0x1c')];this['ContactId']=_0x15b734[_0x5ed9('0x1d')];this[_0x5ed9('0x1e')]=_0x15b734[_0x5ed9('0x1e')];this[_0x5ed9('0x1f')]=_0x15b734[_0x5ed9('0x1f')];this[_0x5ed9('0x20')]=_0x15b734['VoiceQueueId'];this['CampaignId']=_0x15b734[_0x5ed9('0x21')];this[_0x5ed9('0x22')]=_0x15b734[_0x5ed9('0x22')]||'';this['originatecalleridname']=_0x15b734['originatecalleridname']||'';}module[_0x5ed9('0x23')]=Final; \ No newline at end of file diff --git a/server/services/ami/dialer/hangup.js b/server/services/ami/dialer/hangup.js index bfe07d9..e05a63b 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 _0xa064=['countmachineretry','countagentrejectretry','countnosuchnumberretry','uniqueid','calleridname','calleridnum','number','starttime','responsetime','format','YYYY-MM-DD\x20HH:mm:ss','membername','IVR','reason','cause-txt','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','exports','util','lodash','milliseconds','diff','seconds','state','Answer','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countdropretry','countabandonedretry'];(function(_0x318054,_0x516efd){var _0x19a6ae=function(_0x4a35f2){while(--_0x4a35f2){_0x318054['push'](_0x318054['shift']());}};_0x19a6ae(++_0x516efd);}(_0xa064,0x1f2));var _0x4a06=function(_0x31dde9,_0x12e816){_0x31dde9=_0x31dde9-0x0;var _0x1fbf2d=_0xa064[_0x31dde9];return _0x1fbf2d;};'use strict';var util=require(_0x4a06('0x0'));var _=require(_0x4a06('0x1'));var moment=require('moment');function getSeconds(_0x3ffc7d,_0x495939){var _0x13a025=moment(_0x3ffc7d)[_0x4a06('0x2')](0x0);var _0x44d1d7=moment(_0x495939)[_0x4a06('0x2')](0x0);return _0x13a025[_0x4a06('0x3')](_0x44d1d7,_0x4a06('0x4'));}function Hangup(_0xac10f7,_0x3b064b){this[_0x4a06('0x5')]=0x4;this['statedesc']=_0x4a06('0x6');this['scheduledat']=_0xac10f7[_0x4a06('0x7')];this[_0x4a06('0x8')]=_0xac10f7[_0x4a06('0x8')];this[_0x4a06('0x9')]=_0xac10f7[_0x4a06('0x8')]===_0x4a06('0xa')?_0x4a06('0xb'):_0xac10f7[_0x4a06('0x8')];this[_0x4a06('0xc')]=_0xac10f7['countbusyretry'];this[_0x4a06('0xd')]=_0xac10f7[_0x4a06('0xd')];this[_0x4a06('0xe')]=_0xac10f7[_0x4a06('0xe')];this[_0x4a06('0xf')]=_0xac10f7[_0x4a06('0xc')]+_0xac10f7[_0x4a06('0xd')]+_0xac10f7[_0x4a06('0xe')]+_0xac10f7['countnosuchnumberretry']+_0xac10f7[_0x4a06('0x10')]+_0xac10f7[_0x4a06('0x11')]+_0xac10f7[_0x4a06('0x12')]+_0xac10f7[_0x4a06('0x13')];this[_0x4a06('0x14')]=_0xac10f7[_0x4a06('0x14')];this[_0x4a06('0x10')]=_0xac10f7[_0x4a06('0x10')];this[_0x4a06('0x11')]=_0xac10f7[_0x4a06('0x11')];this[_0x4a06('0x12')]=_0xac10f7['countmachineretry'];this[_0x4a06('0x13')]=_0xac10f7[_0x4a06('0x13')];this[_0x4a06('0x15')]=_0x3b064b[_0x4a06('0x15')];this[_0x4a06('0x16')]=_0xac10f7['name'];this[_0x4a06('0x17')]=_0xac10f7[_0x4a06('0x18')];this[_0x4a06('0x19')]=_0xac10f7[_0x4a06('0x19')];this['responsetime']=_0xac10f7[_0x4a06('0x1a')];this['endtime']=moment()[_0x4a06('0x1b')](_0x4a06('0x1c'));this['ringtime']=getSeconds(_0xac10f7[_0x4a06('0x1a')],_0xac10f7[_0x4a06('0x19')]);this['holdtime']=0x0;this['talktime']=getSeconds(this['endtime'],_0xac10f7[_0x4a06('0x1a')]);this['queue']=_0xac10f7['queue'];this[_0x4a06('0x1d')]=_0x4a06('0x1e');this[_0x4a06('0x1f')]=_0x3b064b[_0x4a06('0x20')];this['callback']=_0xac10f7[_0x4a06('0x21')];this[_0x4a06('0x22')]=_0xac10f7[_0x4a06('0x22')];this[_0x4a06('0x23')]=_0xac10f7[_0x4a06('0x23')];this['recallme']=_0xac10f7[_0x4a06('0x24')];this[_0x4a06('0x25')]=_0xac10f7[_0x4a06('0x25')];this[_0x4a06('0x26')]=_0xac10f7[_0x4a06('0x26')];this[_0x4a06('0x27')]=_0xac10f7[_0x4a06('0x27')];this[_0x4a06('0x28')]=_0xac10f7[_0x4a06('0x28')];this[_0x4a06('0x29')]=_0xac10f7[_0x4a06('0x29')];}module[_0x4a06('0x2a')]=Hangup; \ No newline at end of file +var _0x7c8f=['Answer','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','holdtime','talktime','IVR','reason','cause-txt','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','exports','util','lodash','moment','seconds','state','statedesc'];(function(_0x3f82bf,_0x56aea4){var _0x289395=function(_0x4efb38){while(--_0x4efb38){_0x3f82bf['push'](_0x3f82bf['shift']());}};_0x289395(++_0x56aea4);}(_0x7c8f,0x114));var _0xf7c8=function(_0x27c152,_0xfaae26){_0x27c152=_0x27c152-0x0;var _0x1fafa1=_0x7c8f[_0x27c152];return _0x1fafa1;};'use strict';var util=require(_0xf7c8('0x0'));var _=require(_0xf7c8('0x1'));var moment=require(_0xf7c8('0x2'));function getSeconds(_0x456371,_0x2f47c0){var _0x49ed38=moment(_0x456371)['milliseconds'](0x0);var _0x58d8f0=moment(_0x2f47c0)['milliseconds'](0x0);return _0x49ed38['diff'](_0x58d8f0,_0xf7c8('0x3'));}function Hangup(_0x312ca8,_0x392565){this[_0xf7c8('0x4')]=0x4;this[_0xf7c8('0x5')]=_0xf7c8('0x6');this['scheduledat']=_0x312ca8[_0xf7c8('0x7')];this[_0xf7c8('0x8')]=_0x312ca8[_0xf7c8('0x8')];this[_0xf7c8('0x9')]=_0x312ca8['type']===_0xf7c8('0xa')?_0xf7c8('0xb'):_0x312ca8[_0xf7c8('0x8')];this[_0xf7c8('0xc')]=_0x312ca8[_0xf7c8('0xc')];this[_0xf7c8('0xd')]=_0x312ca8[_0xf7c8('0xd')];this[_0xf7c8('0xe')]=_0x312ca8[_0xf7c8('0xe')];this[_0xf7c8('0xf')]=_0x312ca8[_0xf7c8('0xc')]+_0x312ca8[_0xf7c8('0xd')]+_0x312ca8['countnoanswerretry']+_0x312ca8[_0xf7c8('0x10')]+_0x312ca8[_0xf7c8('0x11')]+_0x312ca8[_0xf7c8('0x12')]+_0x312ca8[_0xf7c8('0x13')]+_0x312ca8[_0xf7c8('0x14')];this['countnosuchnumberretry']=_0x312ca8['countnosuchnumberretry'];this[_0xf7c8('0x11')]=_0x312ca8[_0xf7c8('0x11')];this['countabandonedretry']=_0x312ca8[_0xf7c8('0x12')];this[_0xf7c8('0x13')]=_0x312ca8[_0xf7c8('0x13')];this['countagentrejectretry']=_0x312ca8['countagentrejectretry'];this[_0xf7c8('0x15')]=_0x392565['uniqueid'];this[_0xf7c8('0x16')]=_0x312ca8[_0xf7c8('0x17')];this[_0xf7c8('0x18')]=_0x312ca8[_0xf7c8('0x19')];this[_0xf7c8('0x1a')]=_0x312ca8[_0xf7c8('0x1a')];this[_0xf7c8('0x1b')]=_0x312ca8[_0xf7c8('0x1b')];this[_0xf7c8('0x1c')]=moment()[_0xf7c8('0x1d')](_0xf7c8('0x1e'));this[_0xf7c8('0x1f')]=getSeconds(_0x312ca8[_0xf7c8('0x1b')],_0x312ca8[_0xf7c8('0x1a')]);this[_0xf7c8('0x20')]=0x0;this[_0xf7c8('0x21')]=getSeconds(this[_0xf7c8('0x1c')],_0x312ca8[_0xf7c8('0x1b')]);this['queue']=_0x312ca8[_0xf7c8('0xb')];this['membername']=_0xf7c8('0x22');this[_0xf7c8('0x23')]=_0x392565[_0xf7c8('0x24')];this[_0xf7c8('0x25')]=_0x312ca8[_0xf7c8('0x25')];this[_0xf7c8('0x26')]=_0x312ca8[_0xf7c8('0x26')];this[_0xf7c8('0x27')]=_0x312ca8[_0xf7c8('0x27')];this[_0xf7c8('0x28')]=_0x312ca8[_0xf7c8('0x28')];this[_0xf7c8('0x29')]=_0x312ca8[_0xf7c8('0x29')];this[_0xf7c8('0x2a')]=_0x312ca8[_0xf7c8('0x2a')];this[_0xf7c8('0x2b')]=_0x312ca8[_0xf7c8('0x2b')];this[_0xf7c8('0x2c')]=_0x312ca8[_0xf7c8('0x2c')];this[_0xf7c8('0x2d')]=_0x312ca8['CampaignId'];}module[_0xf7c8('0x2e')]=Hangup; \ No newline at end of file diff --git a/server/services/ami/dialer/history.js b/server/services/ami/dialer/history.js index f986ef8..c8f1be9 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 _0x0e12=['VoiceQueueId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment','milliseconds','diff','seconds','uniqueid','scheduledat','type','outbound','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countmachineretry','countagentrejectretry','countdropretry','countabandonedretry','queue','name','number','starttime','responsetime','endtime','ringtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId'];(function(_0x531431,_0x1824e6){var _0x2f2a2c=function(_0x51464d){while(--_0x51464d){_0x531431['push'](_0x531431['shift']());}};_0x2f2a2c(++_0x1824e6);}(_0x0e12,0x180));var _0x20e1=function(_0x9d639c,_0x524dbe){_0x9d639c=_0x9d639c-0x0;var _0x1671de=_0x0e12[_0x9d639c];return _0x1671de;};'use strict';var util=require(_0x20e1('0x0'));var _=require(_0x20e1('0x1'));var moment=require(_0x20e1('0x2'));function getSeconds(_0x36d92b,_0x1a4c6c){var _0x2f49ab=moment(_0x36d92b)[_0x20e1('0x3')](0x0);var _0x5555ce=moment(_0x1a4c6c)[_0x20e1('0x3')](0x0);return _0x2f49ab[_0x20e1('0x4')](_0x5555ce,_0x20e1('0x5'));}function History(_0x5d0164){this[_0x20e1('0x6')]=_0x5d0164[_0x20e1('0x6')];this['scheduledat']=_0x5d0164[_0x20e1('0x7')]||undefined;this['type']=_0x5d0164[_0x20e1('0x8')];this['campaigntype']=_0x5d0164[_0x20e1('0x8')]===_0x20e1('0x9')?'queue':_0x5d0164[_0x20e1('0x8')];this[_0x20e1('0xa')]=_0x5d0164[_0x20e1('0xa')];this[_0x20e1('0xb')]=_0x5d0164[_0x20e1('0xb')];this[_0x20e1('0xc')]=_0x5d0164[_0x20e1('0xc')];this[_0x20e1('0xd')]=_0x5d0164[_0x20e1('0xa')]+_0x5d0164['countcongestionretry']+_0x5d0164[_0x20e1('0xc')]+_0x5d0164[_0x20e1('0xe')]+_0x5d0164['countdropretry']+_0x5d0164['countabandonedretry']+_0x5d0164[_0x20e1('0xf')]+_0x5d0164[_0x20e1('0x10')];this[_0x20e1('0xe')]=_0x5d0164[_0x20e1('0xe')];this[_0x20e1('0x11')]=_0x5d0164[_0x20e1('0x11')];this[_0x20e1('0x12')]=_0x5d0164[_0x20e1('0x12')];this['countmachineretry']=_0x5d0164[_0x20e1('0xf')];this[_0x20e1('0x10')]=_0x5d0164[_0x20e1('0x10')];this[_0x20e1('0x13')]=_0x5d0164[_0x20e1('0x13')];this['calleridname']=_0x5d0164[_0x20e1('0x14')];this['calleridnum']=_0x5d0164[_0x20e1('0x15')];this['starttime']=_0x5d0164[_0x20e1('0x16')];this['responsetime']=_0x5d0164[_0x20e1('0x17')];this[_0x20e1('0x18')]=_0x5d0164['responsetime'];this[_0x20e1('0x19')]=getSeconds(_0x5d0164[_0x20e1('0x17')],_0x5d0164[_0x20e1('0x16')]);this['holdtime']=0x0;this[_0x20e1('0x1a')]=0x0;this[_0x20e1('0x1b')]=_0x5d0164[_0x20e1('0x1b')];this[_0x20e1('0x1c')]=_0x5d0164[_0x20e1('0x1c')];this['callbackat']=_0x5d0164[_0x20e1('0x1d')];this['recallme']=_0x5d0164[_0x20e1('0x1e')];this[_0x20e1('0x1f')]=_0x5d0164['ContactId'];this[_0x20e1('0x20')]=_0x5d0164[_0x20e1('0x20')];this[_0x20e1('0x21')]=_0x5d0164[_0x20e1('0x21')];this['VoiceQueueId']=_0x5d0164[_0x20e1('0x22')];this['CampaignId']=_0x5d0164['CampaignId'];this[_0x20e1('0x23')]=_0x5d0164[_0x20e1('0x23')]||'';this[_0x20e1('0x24')]=_0x5d0164[_0x20e1('0x24')]||'';}module[_0x20e1('0x25')]=History; \ No newline at end of file +var _0xb935=['UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','lodash','moment','milliseconds','diff','seconds','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countmachineretry','countagentrejectretry','calleridname','calleridnum','starttime','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId'];(function(_0x125092,_0x20b0ab){var _0x879f3e=function(_0x43232a){while(--_0x43232a){_0x125092['push'](_0x125092['shift']());}};_0x879f3e(++_0x20b0ab);}(_0xb935,0x1da));var _0x5b93=function(_0x1ef230,_0x24bdeb){_0x1ef230=_0x1ef230-0x0;var _0x2d57ba=_0xb935[_0x1ef230];return _0x2d57ba;};'use strict';var util=require('util');var _=require(_0x5b93('0x0'));var moment=require(_0x5b93('0x1'));function getSeconds(_0x2b556b,_0x9f4d66){var _0x1be7f=moment(_0x2b556b)[_0x5b93('0x2')](0x0);var _0x1a34f3=moment(_0x9f4d66)[_0x5b93('0x2')](0x0);return _0x1be7f[_0x5b93('0x3')](_0x1a34f3,_0x5b93('0x4'));}function History(_0x1f3157){this['uniqueid']=_0x1f3157['uniqueid'];this[_0x5b93('0x5')]=_0x1f3157['scheduledat']||undefined;this[_0x5b93('0x6')]=_0x1f3157[_0x5b93('0x6')];this[_0x5b93('0x7')]=_0x1f3157[_0x5b93('0x6')]===_0x5b93('0x8')?_0x5b93('0x9'):_0x1f3157[_0x5b93('0x6')];this[_0x5b93('0xa')]=_0x1f3157[_0x5b93('0xa')];this[_0x5b93('0xb')]=_0x1f3157[_0x5b93('0xb')];this['countnoanswerretry']=_0x1f3157[_0x5b93('0xc')];this['countglobal']=_0x1f3157['countbusyretry']+_0x1f3157[_0x5b93('0xb')]+_0x1f3157[_0x5b93('0xc')]+_0x1f3157[_0x5b93('0xd')]+_0x1f3157[_0x5b93('0xe')]+_0x1f3157['countabandonedretry']+_0x1f3157['countmachineretry']+_0x1f3157['countagentrejectretry'];this[_0x5b93('0xd')]=_0x1f3157[_0x5b93('0xd')];this[_0x5b93('0xe')]=_0x1f3157['countdropretry'];this['countabandonedretry']=_0x1f3157['countabandonedretry'];this[_0x5b93('0xf')]=_0x1f3157['countmachineretry'];this[_0x5b93('0x10')]=_0x1f3157[_0x5b93('0x10')];this[_0x5b93('0x9')]=_0x1f3157[_0x5b93('0x9')];this[_0x5b93('0x11')]=_0x1f3157['name'];this[_0x5b93('0x12')]=_0x1f3157['number'];this[_0x5b93('0x13')]=_0x1f3157[_0x5b93('0x13')];this[_0x5b93('0x14')]=_0x1f3157['responsetime'];this[_0x5b93('0x15')]=_0x1f3157['responsetime'];this[_0x5b93('0x16')]=getSeconds(_0x1f3157[_0x5b93('0x14')],_0x1f3157[_0x5b93('0x13')]);this[_0x5b93('0x17')]=0x0;this[_0x5b93('0x18')]=0x0;this['callback']=_0x1f3157[_0x5b93('0x19')];this['callbackuniqueid']=_0x1f3157[_0x5b93('0x1a')];this[_0x5b93('0x1b')]=_0x1f3157[_0x5b93('0x1b')];this[_0x5b93('0x1c')]=_0x1f3157[_0x5b93('0x1c')];this[_0x5b93('0x1d')]=_0x1f3157[_0x5b93('0x1d')];this['ListId']=_0x1f3157['ListId'];this['UserId']=_0x1f3157[_0x5b93('0x1e')];this[_0x5b93('0x1f')]=_0x1f3157[_0x5b93('0x1f')];this[_0x5b93('0x20')]=_0x1f3157[_0x5b93('0x20')];this[_0x5b93('0x21')]=_0x1f3157[_0x5b93('0x21')]||'';this[_0x5b93('0x22')]=_0x1f3157[_0x5b93('0x22')]||'';}module[_0x5b93('0x23')]=History; \ No newline at end of file diff --git a/server/services/ami/dialer/index.js b/server/services/ami/dialer/index.js index 185bbd5..5998c02 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 _0x2095=['tags','createdAt','updatedAt','%s%s','XMD-','dialRandomLastDigitCallerIdNumber','TrunkBackup','XMD-ORIGINATECALLERIDNAME','originatecalleridname','XMD-ORIGINATECALLERIDNUM','dialPrefix','trim','dialCutDigit','substring','from-sip','dialOriginateTimeout','[originateError]:\x20%s','OriginateError','[originate][error]','Error','originate\x20action\x20Error','getQueue','response','callProgressDetecting','[callProgressDetecting]\x20','checkRetriveMax','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','[rescheduleContact][NoAnswer]','dialBusyMaxRetry','dialBusyRetryFrequency','[rescheduleContact]\x20[Busy]','dialCongestionMaxRetry','dialCongestionRetryFrequency','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberRetryFrequency','[rescheduleContact][NoSuchNumber]','[rescheduleContact][Machine]','dialAgentRejectMaxRetry','[rescheduleContact][AgentReject]','[callProgressDetecting]','evt\x20is\x20undefine','reason','outboundNoSuchCallsDay','NoSuchNumber','custom:agentnosuchnumber','nosuchnumber','dialNoSuchNumberMaxRetry','reason\x200\x20no\x20such\x20number....','NoAnswer','custom:agentnoanswer','noanswer','[syncAgentComplete][createHistory][3]','reason\x203\x20ringing\x20no\x20answer','Busy','custom:agentbusy','[syncAgentComplete][createHistory][5]','reason\x205\x20busy','outboundCongestionCallsDay','Congestion','custom:agentcongestion','congestion','[syncAgentComplete][createHistory][8]','reason\x208\x20congestion','reason\x2011\x20abandoned','outboundRejectCallsDay','AgentReject','custom:agentreject','agentreject','reason\x2020\x20agentreject','[syncAgentComplete][createHistory][?]','Global','[moveContactManagedDialer][0]','dialPredictiveOptimizationPercentage','round','predictiveIntervalMinThreshold','floor','predictiveIntervalMultiplicativeFactor','[startMethodPredictive][StartProgressive]','check\x20handlePredictive\x20is\x20not\x20undefine','collection\x20data\x20in\x20progressive\x20at','dialPredictiveInterval','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','dialPredictiveOptimization','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Max\x20Drop\x20','started\x20in\x20predictive\x20at','getDataPredictive','Predictive\x20after\x20first\x20interval','recalculate\x20predictive\x20at','averageHandleTime','Predictive\x20for\x20every\x20interval','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20more\x20than\x20threshold\x20(','abandonmentRate','agentBusyFactor','[getDataPredictive]','Unknown\x20Predictive','check\x20failure','getDataPredictiveOld','outboundQueuePauses','[CatchErlangB]','busyFactor','startMethodPredictive','one\x20call\x20every:','[handlePredictive]','fail\x20to\x20scheduled\x20calls','recallme','[booked][checkContactBlack]','queueStatusComplete:\x20','Queue:\x20','[unlockOriginate][syncQueueStatusComplete]','[booked][checkContactBlack][else]','dialRecallMeTimeout','voicePause','dialRecallInQueue','[rescheduleContact][dialRecallInQueue]','RECALLINQUEUE','RecallInQueue','[Originate][HistoryDialRecallInQueue][historyCatch]','RECALLFAILEDTIMEOUT','RecallFailedTimeout','[Originate][HistoryRecallClose][historyCatch]','[Originate][HistoryRecallClose]','BLACKLIST','Blacklist','[Originate][historyBlacklist]','[Originate][MoveBlacklist]','inBlackList','handleIvr','limitCalls','maxNumberOriginate','[getContactCampaign2][Empty]','RUNNING','[actionOriginateIvr]\x20','[getContactCampaign2]','dialLimitQueue','dialOrderByScheduledAt','ACTIVE','[actionOriginate]\x20','checkContactBlack','loggerHandler','[getContactDialer2]','tryOriginatePredictive','[handlePredictive][limitChannel]','not_inuse','Contact.phone','[actionOriginatePredictive]\x20','[getContactDialerPredictive]','--------\x20Drop\x20Rate\x20--------','M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Ts:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[abandonmentRate]','m\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]','Ts\x20=\x20','Umin\x20=\x20','util','lodash','uuid','moment','md5','ioredis','../../../config/logger','dialer','predictive','predictiveCalls','syncQueueSummary','redis','defaults','socket.io-emitter','../rpc/cmHopper','../rpc/cmHopperBlack','./action','./history','./agentComplete','./queueCallerAbandon','env','XCALLY_IP_AGI','127.0.0.1','rrmemory','roundrobin','prototype','tail','finally','preview','voiceQueues','campaigns','agents','trunks','channels','actions','contactsId','uniqueId','optionPredictive','startPredictive','ivrOriginated','queueBooked','agentconnect','syncAgentConnect','bind','queuecallerabandon','originateresponse','syncOriginateResponse','agentcomplete','syncAgentComplete','custom:queuesummary','hangup','syncHangup','newexten','syncNewExten','varset','queuestatuscomplete','loopClearZombieChannels','getSettings','previewRecallmeReminderInterval','isUndefined','message','AGENTS_NOT_LOGGED','name','NOT_ACTIVE','\x20NOT\x20Active','Interval','INTERVAL_IS_NULL','\x20INTERVAL_IS_NULL','Intervals','[ifTime][Action]','milliseconds','diff','emit','type','outbound','strategy','answered','available','loggedIn','pTalking','sumBillable','total','unmanaged','abandoned','waiting','loggedInDb','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundOriginateFailureCallsDay','outboundReCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalHitRate','predictiveIntervalPauses','predictiveIntervalAvailable','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','Trunk','active','callerid','voice_queue:save','ivr','campaign:save','isEmpty','info','Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalTotalCalls','Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAvgTalktime','---------------------------','Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive','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','Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20','merge','seconds','startProgressive','clearing\x20variable\x20start\x20progressive','clearing\x20variable\x20start\x20predictive','handlePredictive','clearing\x20variable\x20handle\x20predictive','string','\x22%s\x22\x20<%s>','format','\x22\x22\x20<>','error','inspect','stack','originated','undefined','[decremetOriginate]\x20object\x20originated\x20is\x20negative','[decremetOriginate]\x20is\x20null\x20or\x20undefined','RESCHEDULED_CONTACTS','[getContactDialer2][ReScheduled]','contactsRescheduled','AVAILABLE_CONTACTS_FINISHED','[getContactDialer2][Empty]','sendMessageOneNotActive','talking','[syncQueueSummary]\x20Campaign\x20Queue:\x20','is\x20not\x20active','is\x20disactive','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','state','statedesc','endtime','starttime','clearZombieChannels','[uniqueid]','[actions]','sequence','enqueue','isNil','Action','channel','catch','No\x20such\x20channel','updateOriginated','queue','[Dialer][checkChannel]','[Dialer][checkChannel][ivr]','countReScheduled','resolve','then','[countReScheduled]\x20','checkIsBlackList','[checkIsBlackList]\x20','checkIsBlackListIvr','avgHandleTime','[averageHandleTime]\x20','rescheduleContact','[rescheduleContact]\x20','unlockContact','[unlockContact]\x20','getContactDialer','temp','getContactDialerIvr','[getContactDialerIvr]\x20','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','moveContactManagedDialer','[moveContactManagedDialer]\x20','createHistory','[createHistory]\x20','emptyContact','notFound','pick','ContactId','ListId','UserId','VoiceQueueId','CampaignId','[emptyContact][createHistory]','[emptyContact]','isSuccess','Success','isTrunkReachable','SIP/%s','status','reachable','unmonitored','saveInDb','uniqueid','amdstatus','exten','xcally-motion-dialer','value','HANGUP','HangupInAMD','membername','AMD','amd','[syncHangupInAMD][createHistory]','[syncHangupInAMD]','dialAMDActive','countmachineretry','custom:amd','buildObj','[syncAgentComplete][createHistory][0]','countbusyretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','dialGlobalMaxRetry','stateGlobal','reason19\x20machine....','createStateFinal','reason\x2019\x20machine....','add','dialMachineRetryFrequency','minutes','[syncHangupInAMDIvr]','MACHINE','countglobal','countcongestionretry','dialMachineMaxRetry','YYYY-MM-DD\x20HH:mm:ss','ivrAnswerCallsDay','[syncHangupIvr]','dialQueueProject','AnswerAGI','AGI','[syncHangupIvr][createHistory]','outboundUnknownCallsDay','cause-txt','Unknow','agent','agiafterat','dialQueueProject2','dialAgiAfterHangupAgent','[syncAgentComplete][createHistory]','[syncAgentComplete]','queueCallerAbandonCreateState','[syncQueueCallerAbandon]\x20[Drop]','droptime','responsetime','dialQueueTimeout','predictiveIntervalErlangCallsDroppedCalls','Drop','dropreason','TIMEOUT','dialDropRetryFrequency','[rescheduleContact][Drop]','calleridname','calleridnum','[syncAgentComplete][createHistory][10]','CALLEREXIT','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','[rescheduleContact][Abandoned]','[syncAgentComplete][createHistory][11]','actionid','stateinterface','locked','push','idHopper','paused','queueStatusComplete','[unlockQueueStatus][undefined]','[booked][unlockQueueStatus]','[unlock][syncQueueStatusComplete]','queueBookedRR','_rr','length','unlockRR','[booked][RR]','Agent:\x20','stringify','contactAgent-idHopper:\x20','run','[booked][unlock2]','[unlock2][syncQueueStatusComplete]','[unlock3][syncQueueStatusComplete]','loopCampaigns','resetActiveCalls','syncCampaigns','checkIsTrunkReachable','TRUNK_IS_NOT_REACHABLE','\x20trunk\x20is\x20not\x20reachable','checkIfTime','ifTime','Failure','\x20Intervals\x20is\x20null\x20','INTERVAL_IS_EMPTY','\x20Intervals\x20is\x20empty\x20','timezones','TIMEZONE_UNKNOW','\x20Timezone\x20unknow\x20','isArray','command','iftime\x20%s,%s','interval','content','indexOf','true','all','some','GLOBAL_INTERVAL_IS_OVERTIME','[ifTime][promiseAll]','Global:\x20','\x20Interval\x20is\x20overtime:\x20','Timezone:\x20','checkDialMethod','handlePower','power','booked','Queue','method\x20not\x20recognized','throttle','handlePreviewRecallNotifications','Agent','user:%s','user:dialPreviewRecallReminder','checkPreviewRecallReminder','launchHandleIvr','dialActive','dialGlobalInterval','checkIfTimeIntervals','dialTimezone','[syncQueueSummary]','dialPreviewRecallmeReminder','\x5cw{0,','pow','replace','random','match','actionOriginate','object','originate','voiceQueue\x20is\x20undefine','Contact','phone','getCaller','NONE','\x22agi://%s/square,%s\x22','\x22%s,%s%s,,,%s\x22','dialQueueOptions','dialAMDInitialSilence','XMD-AMDGREETING','XMD-AMDAFTERGREETINGSILENCE','dialAMDAfterGreetingSilence','XMD-AMDTOTALANALYSISTIME','dialAMDTotalAnalysisTime','XMD-AMDMINWORDLENGTH','dialAMDMinWordLength','XMD-AMDBETWEENWORDSSILENCE','dialAMDBetweenWordsSilence','XMD-AMDMAXIMUMNUMBEROFWORDS','dialAMDSilenceThreshold','XMD-AMDMAXIMUMWORDLENGTH','dialAMDMaximumWordLength','XMD-VOICEQUEUEID'];(function(_0x68c979,_0x431cff){var _0x4f0001=function(_0xa7595d){while(--_0xa7595d){_0x68c979['push'](_0x68c979['shift']());}};_0x4f0001(++_0x431cff);}(_0x2095,0xa4));var _0x5209=function(_0x2e56ab,_0x2c5393){_0x2e56ab=_0x2e56ab-0x0;var _0x18a01e=_0x2095[_0x2e56ab];return _0x18a01e;};'use strict';var util=require(_0x5209('0x0'));var _=require(_0x5209('0x1'));var BPromise=require('bluebird');var uuid=require(_0x5209('0x2'));var moment=require(_0x5209('0x3'));var rr=require('rr');var md5=require(_0x5209('0x4'));var Redis=require(_0x5209('0x5'));var ut=require('../preview/util/util');var config=require('../../../config/environment/');var logger=require(_0x5209('0x6'))(_0x5209('0x7'));var loggerBooked=require(_0x5209('0x6'))('booked');var loggerPredictive=require('../../../config/logger')(_0x5209('0x8'));var loggerPredictiveCalls=require('../../../config/logger')(_0x5209('0x9'));var loggerSyncQueueSummary=require(_0x5209('0x6'))(_0x5209('0xa'));var ami=require('../ami');config[_0x5209('0xb')]=_[_0x5209('0xc')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x5209('0xd'))(new Redis(config[_0x5209('0xb')]));var cmHopper=require(_0x5209('0xe'));var cmHopperHistory=require('../rpc/cmHopperHistory');var cmHopperBlack=require(_0x5209('0xf'));var voiceQueueRt=require('../rpc/voiceQueueRt');var RpcSetting=require('../rpc/setting');var Action=require(_0x5209('0x10'));var History=require(_0x5209('0x11'));var Final=require('./final');var AgentComplete=require(_0x5209('0x12'));var QueueCallerAbandon=require(_0x5209('0x13'));var Hangup=require('./hangup');var ipAgi=process[_0x5209('0x14')][_0x5209('0x15')]||_0x5209('0x16');var strategy={'rrmemory':_0x5209('0x17'),'roundrobin':_0x5209('0x18')};var previewRecallmeReminderInterval=0x1;var Sequence=function(){};Sequence[_0x5209('0x19')]['enqueue']=function(_0x2f3ea6){this[_0x5209('0x1a')]=this[_0x5209('0x1a')]?this[_0x5209('0x1a')][_0x5209('0x1b')](_0x2f3ea6):_0x2f3ea6();};function Dialer(_0x320542,_0x3602aa){this['sequence']=new Sequence();this[_0x5209('0x1c')]=_0x3602aa;this[_0x5209('0x1d')]=_0x320542[_0x5209('0x1d')];this[_0x5209('0x1e')]=_0x320542[_0x5209('0x1e')];this[_0x5209('0x1f')]=_0x320542[_0x5209('0x1f')];this[_0x5209('0x20')]=_0x320542[_0x5209('0x20')];this['maxNumberOriginate']=config['maxNumberOriginate']||0x2;this[_0x5209('0x21')]={};this[_0x5209('0x22')]={};this[_0x5209('0x23')]={};this[_0x5209('0x24')]={};this[_0x5209('0x25')]={};this[_0x5209('0x26')]={};this['startProgressive']={};this[_0x5209('0x27')]={};this[_0x5209('0x28')]={};this['queueBookedRR']={};ami['on'](_0x5209('0x29'),this[_0x5209('0x2a')][_0x5209('0x2b')](this));ami['on'](_0x5209('0x2c'),this['syncQueueCallerAbandon'][_0x5209('0x2b')](this));ami['on'](_0x5209('0x2d'),this[_0x5209('0x2e')][_0x5209('0x2b')](this));ami['on'](_0x5209('0x2f'),this[_0x5209('0x30')][_0x5209('0x2b')](this));ami['on'](_0x5209('0x31'),this[_0x5209('0xa')]['bind'](this));ami['on'](_0x5209('0x32'),this[_0x5209('0x33')]['bind'](this));ami['on'](_0x5209('0x34'),this[_0x5209('0x35')][_0x5209('0x2b')](this));ami['on'](_0x5209('0x36'),this['syncVarSet']['bind'](this));ami['on']('queuemember',this['syncQueueMember'][_0x5209('0x2b')](this));ami['on'](_0x5209('0x37'),this['syncQueueStatusComplete'][_0x5209('0x2b')](this));this['loopCampaigns']();this[_0x5209('0x38')]();RpcSetting[_0x5209('0x39')]()['then'](function(_0x3ea313){previewRecallmeReminderInterval=_0x3ea313[_0x5209('0x3a')];});}function isNotNull(_0x28b2ed){return _0x28b2ed!==null&&!_[_0x5209('0x3b')](_0x28b2ed);}function checkIsLoggedIn(_0x360e69,_0xdeb1cc){return function(){if(_0xdeb1cc<=0x0){_0x360e69[_0x5209('0x3c')]=_0x5209('0x3d');throw _0x360e69[_0x5209('0x3e')]+'\x20AGENTS\x20NOT\x20LOGGED';}};}function isActive(_0x272a9d){return _0x272a9d;}function checkIsActive(_0x29817e,_0xad91b1){return function(){if(!isActive(_0xad91b1)){_0x29817e[_0x5209('0x3c')]=_0x5209('0x3f');throw _0x29817e[_0x5209('0x3e')]+_0x5209('0x40');}};}function checkInterval(_0x4b9c94){return function(){if(!isNotNull(_0x4b9c94[_0x5209('0x41')])){_0x4b9c94[_0x5209('0x3c')]=_0x5209('0x42');throw _0x4b9c94['name']+_0x5209('0x43');}if(!isNotNull(_0x4b9c94[_0x5209('0x41')][_0x5209('0x44')])){_0x4b9c94[_0x5209('0x3c')]='INTERVAL_IS_NULL';throw _0x4b9c94['name']+_0x5209('0x43');}if(!isNotNull(_['isEmpty'](_0x4b9c94['Interval']['Intervals']))){_0x4b9c94['message']=_0x5209('0x42');throw _0x4b9c94[_0x5209('0x3e')]+_0x5209('0x43');}};}function msgResponse(_0x4f8d54,_0x229d23,_0x2e3a24){return{'action':_0x4f8d54,'response':_0x229d23,'message':_0x2e3a24,'stack':_0x2e3a24};}function myreject(_0x2798c7){return function(_0x5f5cf4){return _0x2798c7(msgResponse(_0x5209('0x45'),'Error',JSON['stringify'](_0x5f5cf4)));};}function getSeconds(_0x34e222,_0x8d045d){var _0xfb3775=moment(_0x34e222)[_0x5209('0x46')](0x0);var _0x14e25a=moment(_0x8d045d)[_0x5209('0x46')](0x0);return _0xfb3775[_0x5209('0x47')](_0x14e25a,'seconds');}function emit(_0x1515b9,_0x320ac9,_0x72d5ea){io['to'](_0x1515b9)[_0x5209('0x48')](_0x320ac9,_0x72d5ea);}function emitVoiceQueueSummary(_0x57cec0){if(_0x57cec0[_0x5209('0x49')]===_0x5209('0x4a')){var _0x543bec={'id':_0x57cec0['id'],'name':_0x57cec0[_0x5209('0x3e')],'strategy':_0x57cec0[_0x5209('0x4b')],'answered':_0x57cec0[_0x5209('0x4c')],'available':_0x57cec0[_0x5209('0x4d')],'loggedIn':_0x57cec0[_0x5209('0x4e')],'pTalking':_0x57cec0[_0x5209('0x4f')],'sumBillable':_0x57cec0[_0x5209('0x50')],'sumDuration':_0x57cec0['sumDuration'],'sumHoldTime':_0x57cec0['sumHoldTime']||0x0,'talking':_0x57cec0['talking'],'total':_0x57cec0[_0x5209('0x51')],'type':_0x57cec0['type'],'unmanaged':_0x57cec0[_0x5209('0x52')],'abandoned':_0x57cec0[_0x5209('0x53')],'waiting':_0x57cec0[_0x5209('0x54')],'loggedInDb':_0x57cec0[_0x5209('0x55')],'dialActive':_0x57cec0['dialActive'],'dialMethod':_0x57cec0[_0x5209('0x56')],'dialOriginateCallerIdName':_0x57cec0[_0x5209('0x57')],'dialOriginateCallerIdNumber':_0x57cec0[_0x5209('0x58')],'dialOriginateTimeout':_0x57cec0['dialOriginateTimeout'],'dialPrefix':_0x57cec0['dialPrefix'],'outboundAnswerAgiCallsDay':_0x57cec0[_0x5209('0x59')],'outboundAnswerCallsDay':_0x57cec0[_0x5209('0x5a')],'outboundBlacklistCallsDay':_0x57cec0[_0x5209('0x5b')],'outboundBusyCallsDay':_0x57cec0[_0x5209('0x5c')],'outboundCongestionCallsDay':_0x57cec0['outboundCongestionCallsDay'],'outboundDropCallsDayACS':_0x57cec0[_0x5209('0x5d')],'outboundDropCallsDayCallersExit':_0x57cec0[_0x5209('0x5e')],'outboundDropCallsDayTimeout':_0x57cec0[_0x5209('0x5f')],'outboundNoAnswerCallsDay':_0x57cec0['outboundNoAnswerCallsDay'],'outboundNoSuchCallsDay':_0x57cec0['outboundNoSuchCallsDay'],'outboundOriginateFailureCallsDay':_0x57cec0[_0x5209('0x60')],'outboundReCallsDay':_0x57cec0[_0x5209('0x61')],'outboundRejectCallsDay':_0x57cec0['outboundRejectCallsDay'],'outboundUnknownCallsDay':_0x57cec0['outboundUnknownCallsDay'],'predictiveIntervalAnsweredCalls':_0x57cec0[_0x5209('0x62')],'predictiveIntervalAvgHoldtime':_0x57cec0[_0x5209('0x63')],'predictiveIntervalAvgTalktime':_0x57cec0['predictiveIntervalAvgTalktime'],'predictiveIntervalDroppedCallsCallersExit':_0x57cec0[_0x5209('0x64')],'predictiveIntervalDroppedCallsTimeout':_0x57cec0[_0x5209('0x65')],'predictiveIntervalErlangCalls':_0x57cec0[_0x5209('0x66')],'predictiveIntervalErlangCallsDroppedCalls':_0x57cec0['predictiveIntervalErlangCallsDroppedCalls'],'predictiveIntervalHitRate':_0x57cec0[_0x5209('0x67')],'predictiveIntervalMultiplicativeFactor':_0x57cec0['predictiveIntervalMultiplicativeFactor'],'predictiveIntervalPauses':_0x57cec0[_0x5209('0x68')],'predictiveIntervalAvailable':_0x57cec0[_0x5209('0x69')],'predictiveIntervalTotalCalls':_0x57cec0['predictiveIntervalTotalCalls'],'message':_0x57cec0[_0x5209('0x3c')],'originated':_0x57cec0['originated'],'erlangCalls':_0x57cec0[_0x5209('0x6a')],'erlangCallToSecond':_0x57cec0[_0x5209('0x6b')],'erlangAbandonmentRate':_0x57cec0[_0x5209('0x6c')],'erlangBusyFactor':_0x57cec0[_0x5209('0x6d')],'startPredictive':_0x57cec0[_0x5209('0x26')],'startProgressive':_0x57cec0['startProgressive']};if(_0x57cec0['Trunk']){_0x543bec[_0x5209('0x6e')]={'id':_0x57cec0[_0x5209('0x6e')]['id'],'name':_0x57cec0[_0x5209('0x6e')][_0x5209('0x3e')],'active':_0x57cec0[_0x5209('0x6e')][_0x5209('0x6f')],'callerid':_0x57cec0[_0x5209('0x6e')][_0x5209('0x70')]};}if(_0x57cec0[_0x5209('0x41')]){_0x543bec[_0x5209('0x41')]={'id':_0x57cec0[_0x5209('0x41')]['id'],'name':_0x57cec0[_0x5209('0x41')]['name']};}var _0xfd8b01=md5(JSON['stringify'](_0x543bec));if(_0x57cec0[_0x5209('0x4')]!==_0xfd8b01){_0x57cec0[_0x5209('0x4')]=_0xfd8b01;emit(util['format']('voice:queue:%s',_0x543bec[_0x5209('0x3e')]),_0x5209('0x71'),_0x543bec);}}}function emitCampaignSummary(_0x154911){if(_0x154911[_0x5209('0x49')]===_0x5209('0x72')){emit(util['format']('campaign:ivr:%s',_0x154911[_0x5209('0x3e')]),_0x5209('0x73'),_0x154911);}}function checkGetDataPredictive(_0x3d9d38){if(isNotNull(_0x3d9d38)&&!_[_0x5209('0x74')](_0x3d9d38)){loggerPredictive[_0x5209('0x75')]('-----\x20Stats\x20Predictive\x20---');loggerPredictive['info'](_0x5209('0x76'),_0x3d9d38[_0x5209('0x77')]);loggerPredictive[_0x5209('0x75')](_0x5209('0x78'),_0x3d9d38[_0x5209('0x62')]);loggerPredictive[_0x5209('0x75')]('Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x3d9d38[_0x5209('0x65')]);loggerPredictive[_0x5209('0x75')](_0x5209('0x79'),_0x3d9d38[_0x5209('0x64')]);loggerPredictive['info']('AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x3d9d38[_0x5209('0x63')]);loggerPredictive[_0x5209('0x75')]('AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x3d9d38[_0x5209('0x7a')]);loggerPredictive[_0x5209('0x75')](_0x5209('0x7b'));if(_0x3d9d38[_0x5209('0x77')]>0x0){if(!_[_0x5209('0x3b')](_0x3d9d38[_0x5209('0x7a')])&&_0x3d9d38[_0x5209('0x7a')]>0x0){return!![];}loggerPredictive['info']('Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive');if(!_[_0x5209('0x3b')](_0x3d9d38[_0x5209('0x63')])&&_0x3d9d38[_0x5209('0x63')]>0x0){return!![];}loggerPredictive[_0x5209('0x75')](_0x5209('0x7c'));}else{loggerPredictive[_0x5209('0x75')](_0x5209('0x7d'));}}else{loggerPredictive[_0x5209('0x75')](_0x5209('0x7e'));}return![];}function mergeDataErlangB(_0x30a3f4){return function(_0x2c1b70){loggerPredictive[_0x5209('0x75')](_0x5209('0x7f'));loggerPredictive['info']('Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x2c1b70[_0x5209('0x6a')]);loggerPredictive[_0x5209('0x75')](_0x5209('0x80'),_0x2c1b70[_0x5209('0x6b')]);loggerPredictive['info'](_0x5209('0x81'),_0x2c1b70['erlangAbandonmentRate']);loggerPredictive[_0x5209('0x75')](_0x5209('0x82'),_0x2c1b70[_0x5209('0x6d')]);loggerPredictive['info']('Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x2c1b70['erlangAbandonmentRate']);loggerPredictive['info'](_0x5209('0x7b'));_[_0x5209('0x83')](_0x30a3f4,_0x2c1b70);};}function getDiff(_0x57dda7){var _0x1a2e01=moment()[_0x5209('0x46')](0x0);var _0x6e956f=moment(_0x57dda7)[_0x5209('0x46')](0x0);return _0x1a2e01[_0x5209('0x47')](_0x6e956f,_0x5209('0x84'));}function ifInterval(_0x368ffb,_0x2afc10){if(_[_0x5209('0x3b')](_0x2afc10)){return![];}return getDiff(_0x2afc10)<_0x368ffb*0x3c;}function freeVariablesPredictive(_0x2d78d1){if(isNotNull(_0x2d78d1)){if(!_[_0x5209('0x3b')](_0x2d78d1[_0x5209('0x85')])){_0x2d78d1[_0x5209('0x85')]=undefined;loggerPredictive[_0x5209('0x75')](_0x2d78d1[_0x5209('0x3e')],_0x5209('0x86'));}if(!_['isUndefined'](_0x2d78d1[_0x5209('0x26')])){_0x2d78d1['startPredictive']=undefined;loggerPredictive[_0x5209('0x75')](_0x2d78d1['name'],_0x5209('0x87'));}if(!_[_0x5209('0x3b')](_0x2d78d1['handlePredictive'])){clearInterval(_0x2d78d1[_0x5209('0x88')]);_0x2d78d1[_0x5209('0x88')]=undefined;loggerPredictive[_0x5209('0x75')](_0x2d78d1['name'],_0x5209('0x89'));}}}function erlangb(_0x4f5478,_0x22a6b8){if(_0x22a6b8===0x0){return 0x0;}var _0xd4ce52=0x1;for(var _0x3675de=0x1;_0x3675de<=_0x22a6b8;_0x3675de+=0x1){_0xd4ce52=0x1+_0xd4ce52*_0x3675de/_0x4f5478;}return 0x1/_0xd4ce52;}function isVoiceQueueOutbound(_0x3b7d46){return _0x3b7d46===_0x5209('0x4a');}function isNotPreview(_0x375358){return _0x375358!=='preview';}function isCampaignIvr(_0x525fbd){return _0x525fbd===_0x5209('0x72');}function getCallerId(_0xbfbfe0,_0x1ee998,_0xf698f4){if(!_['isUndefined'](_0xf698f4)&&typeof _0xf698f4===_0x5209('0x8a')&&!_[_0x5209('0x74')](_0xf698f4)){if(!_[_0x5209('0x3b')](_0x1ee998)&&typeof _0x1ee998===_0x5209('0x8a')&&!_['isEmpty'](_0x1ee998)){return util['format'](_0x5209('0x8b'),_0x1ee998,_0xf698f4);}return util[_0x5209('0x8c')](_0x5209('0x8b'),_0xf698f4,_0xf698f4);}if(!_[_0x5209('0x3b')](_0xbfbfe0)&&typeof _0xbfbfe0===_0x5209('0x8a')&&!_[_0x5209('0x74')](_0xbfbfe0)){return _0xbfbfe0;}return _0x5209('0x8d');}function loggerCatchQueueSummary(_0x2f8696,_0x4aee94){return function(_0x2af569){freeVariablesPredictive(_0x4aee94);emitVoiceQueueSummary(_0x4aee94);emitCampaignSummary(_0x4aee94);loggerSyncQueueSummary[_0x5209('0x8e')](_0x2f8696,util[_0x5209('0x8f')](_0x2af569,{'showHidden':![],'depth':null}));};}function loggerCatchPredictive(_0x34598a,_0x1e2f35){return function(_0x5315d0){loggerPredictive[_0x5209('0x8e')](_0x1e2f35['name'],_0x34598a);loggerPredictive[_0x5209('0x8e')](_0x5315d0[_0x5209('0x90')]);freeVariablesPredictive(_0x1e2f35);};}function loggerCatch(_0xa17c71){return function(_0x567642){logger[_0x5209('0x8e')](_0xa17c71,util[_0x5209('0x8f')](_0x567642,{'showHidden':![],'depth':null}));};}function checkContactEmpty(_0x59766e){return _0x59766e&&!_[_0x5209('0x3b')](_0x59766e)&&_0x59766e['length']>0x0;}function decremetOriginate(_0x5c34e5){if(!_[_0x5209('0x3b')](_0x5c34e5)&&_0x5c34e5!==null){if(typeof _0x5c34e5[_0x5209('0x91')]!==_0x5209('0x92')){if(_0x5c34e5[_0x5209('0x91')]>0x0){_0x5c34e5['originated']-=0x1;}else{logger['error'](_0x5209('0x93'));}}}else{logger['error'](_0x5209('0x94'));}}function checkContactLowerLimitOriginate(_0x310398,_0x5b66bf,_0x49369b){if(_0x5b66bf>_0x49369b){for(var _0x3a011f=0x0;_0x3a011f<_0x5b66bf-_0x49369b;_0x3a011f+=0x1){decremetOriginate(_0x310398);}}}function loggerGetContactDialer(_0x5d3c23,_0x4d66e7,_0x3e0032){return function(_0x567a53){checkContactLowerLimitOriginate(_0x4d66e7,_0x3e0032,0x0);logger[_0x5209('0x8e')](_0x5d3c23,util['inspect'](_0x567a53,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x29c080){return function(_0x26b16d){if(isNotNull(_0x26b16d)&&isNotNull(_0x26b16d[0x0])){if(_0x26b16d[0x0]['contactsRescheduled']>0x0){_0x29c080['message']=_0x5209('0x95');logger['info'](_0x5209('0x96')+_0x29c080[_0x5209('0x3e')],_0x26b16d[0x0][_0x5209('0x97')],'contacts');}else{_0x29c080[_0x5209('0x3c')]=_0x5209('0x98');logger[_0x5209('0x75')](_0x5209('0x99')+_0x29c080['name']);}}};}function notSendMessagesQueue(_0x4a7f09){if(_0x4a7f09[_0x5209('0x9a')]){freeVariablesPredictive(_0x4a7f09);if(_0x4a7f09[_0x5209('0x91')]===0x0&&_0x4a7f09[_0x5209('0x9b')]===0x0&&_0x4a7f09['waiting']===0x0&&(_0x4a7f09[_0x5209('0x4f')]||0x0)===0x0){_0x4a7f09[_0x5209('0x9a')]=![];_0x4a7f09['available']=0x0;_0x4a7f09[_0x5209('0x3c')]=_0x5209('0x3f');loggerSyncQueueSummary[_0x5209('0x8e')](_0x5209('0x9c'),_0x4a7f09[_0x5209('0x3e')],_0x5209('0x9d'));}else{_0x4a7f09[_0x5209('0x3c')]='IS_DISACTIVED';loggerSyncQueueSummary[_0x5209('0x8e')](_0x5209('0x9c'),_0x4a7f09['name'],_0x5209('0x9e'));}emitVoiceQueueSummary(_0x4a7f09);}}function notSendMessagesCampaign(_0x3ab191){if(_0x3ab191[_0x5209('0x9a')]){if(_0x3ab191[_0x5209('0x91')]===0x0){_0x3ab191['sendMessageOneNotActive']=![];_0x3ab191[_0x5209('0x3c')]='NOT_ACTIVE';loggerSyncQueueSummary['error'](_0x5209('0x9f'),_0x3ab191[_0x5209('0x3e')],'is\x20not\x20active');}else{_0x3ab191['message']='IS_DISACTIVED';loggerSyncQueueSummary['error']('[syncQueueSummary]\x20Campaign\x20Ivr:\x20',_0x3ab191['name'],'is\x20disactive');}emitCampaignSummary(_0x3ab191);}}function createObjHistory(_0x2f0eb7,_0x373877,_0x52a7f8,_0x3ebb80,_0x57cce){_0x2f0eb7[_0x5209('0x3c')]=_0x52a7f8;var _0x39c98f=new Action(_0x2f0eb7,_0x373877);var _0x5a551f=new History(_0x39c98f);_0x5a551f[_0x5209('0xa0')]=_0x3ebb80;_0x5a551f[_0x5209('0xa1')]=_0x57cce;_0x5a551f[_0x5209('0xa2')]=_0x39c98f[_0x5209('0xa3')];return _0x5a551f;}Dialer[_0x5209('0x19')][_0x5209('0x38')]=function(){var _0x113049=this;setInterval(function(){_0x113049[_0x5209('0xa4')](_0x113049[_0x5209('0x24')],_0x5209('0xa5'));_0x113049[_0x5209('0xa4')](_0x113049[_0x5209('0x22')],_0x5209('0xa6'));},0x32c8);};Dialer[_0x5209('0x19')][_0x5209('0xa4')]=function(_0x4cbf79,_0x24eae2){var _0x15f8bb=this;for(var _0x2f6466 in _0x4cbf79){if(typeof _0x4cbf79[_0x2f6466]!=='undefined'){this[_0x5209('0xa7')][_0x5209('0xa8')](function(){if(!_[_0x5209('0xa9')](_0x4cbf79[_0x2f6466])){return ami[_0x5209('0xaa')]({'action':'status','channel':_0x4cbf79[_0x2f6466][_0x5209('0xab')]})[_0x5209('0xac')](function(_0x347ee7){if(_0x347ee7[_0x5209('0x3c')]===_0x5209('0xad')){setTimeout(function(){if(_0x4cbf79[_0x2f6466]&&_0x4cbf79[_0x2f6466][_0x5209('0x49')]!=='ivr'){_0x15f8bb[_0x5209('0xae')](_0x15f8bb[_0x5209('0x1d')][_0x4cbf79[_0x2f6466][_0x5209('0xaf')]]);logger['error'](_0x5209('0xb0'),_0x24eae2,_0x2f6466,_0x4cbf79[_0x2f6466][_0x5209('0xaf')]);delete _0x4cbf79[_0x2f6466];}if(_0x4cbf79[_0x2f6466]&&_0x4cbf79[_0x2f6466]['type']==='ivr'){_0x15f8bb[_0x5209('0xae')](_0x15f8bb[_0x5209('0x1e')][_0x4cbf79[_0x2f6466][_0x5209('0xaf')]]);logger['error'](_0x5209('0xb1'),_0x24eae2,_0x2f6466,_0x4cbf79[_0x2f6466][_0x5209('0xaf')]);delete _0x4cbf79[_0x2f6466];}},0x2328);}});}});}}};Dialer[_0x5209('0x19')][_0x5209('0xb2')]=function(_0x41d138){return BPromise[_0x5209('0xb3')]()[_0x5209('0xb4')](cmHopper['countReScheduled'](_0x41d138))[_0x5209('0xac')](loggerCatch(_0x5209('0xb5')));};Dialer[_0x5209('0x19')][_0x5209('0xb6')]=function(_0x6656f3){return BPromise[_0x5209('0xb3')]()[_0x5209('0xb4')](cmHopperBlack[_0x5209('0xb6')](_0x6656f3))[_0x5209('0xac')](loggerCatch(_0x5209('0xb7')));};Dialer['prototype'][_0x5209('0xb8')]=function(_0x226f41){return BPromise[_0x5209('0xb3')]()[_0x5209('0xb4')](cmHopperBlack['checkIsBlackListIvr'](_0x226f41))[_0x5209('0xac')](loggerCatch('[checkIsBlackListIvr]\x20'));};Dialer[_0x5209('0x19')]['averageHandleTime']=function(_0x4a8a3){return BPromise[_0x5209('0xb3')]()[_0x5209('0xb4')](cmHopperHistory[_0x5209('0xb9')](_0x4a8a3))['catch'](loggerCatch(_0x5209('0xba')));};Dialer[_0x5209('0x19')]['rescheduleContact']=function(_0x1a0075){return BPromise['resolve']()['then'](cmHopper[_0x5209('0xbb')](_0x1a0075))[_0x5209('0xac')](loggerCatch(_0x5209('0xbc')));};Dialer[_0x5209('0x19')][_0x5209('0xbd')]=function(_0x33fccb,_0x3e4921,_0x1ee1e6){return BPromise[_0x5209('0xb3')]()['then'](cmHopper['unlockContact'](_0x33fccb,_0x3e4921,_0x1ee1e6))[_0x5209('0xac')](loggerCatch(_0x5209('0xbe')));};Dialer[_0x5209('0x19')][_0x5209('0xbf')]=function(_0x170948,_0x4a9bdb,_0x2c7b77,_0x1be679,_0x296eb1){return BPromise[_0x5209('0xb3')]()[_0x5209('0xb4')](cmHopper[_0x5209('0xbf')](_0x170948,_0x4a9bdb,_0x2c7b77,_0x1be679))[_0x5209('0xac')](function(_0x531dc7){_0x296eb1['temp']-=_0x2c7b77;_0x296eb1[_0x5209('0xc0')]=_0x296eb1[_0x5209('0xc0')]>0x0?_0x296eb1['temp']:0x0;loggerCatch('[getContactDialer]\x20')(_0x531dc7);});};Dialer[_0x5209('0x19')][_0x5209('0xc1')]=function(_0x38f9ce,_0x3a784d,_0x109083,_0x258da6){return BPromise[_0x5209('0xb3')]()[_0x5209('0xb4')](cmHopper[_0x5209('0xc1')](_0x38f9ce,_0x3a784d,_0x109083))[_0x5209('0xac')](function(_0x514fa5){_0x258da6[_0x5209('0xc0')]-=_0x3a784d;_0x258da6[_0x5209('0xc0')]=_0x258da6[_0x5209('0xc0')]>0x0?_0x258da6[_0x5209('0xc0')]:0x0;loggerCatch(_0x5209('0xc2'))(_0x514fa5);});};Dialer[_0x5209('0x19')][_0x5209('0xc3')]=function(_0x3716ef){return BPromise['resolve']()[_0x5209('0xb4')](voiceQueueRt[_0x5209('0xc3')](_0x3716ef))[_0x5209('0xac')](loggerCatch(_0x5209('0xc4')));};Dialer[_0x5209('0x19')][_0x5209('0xc5')]=function(_0x40dc98){return BPromise[_0x5209('0xb3')]()[_0x5209('0xb4')](cmHopper[_0x5209('0xc5')](_0x40dc98))['catch'](loggerCatch(_0x5209('0xc6')));};Dialer[_0x5209('0x19')][_0x5209('0xc7')]=function(_0x263fab){return BPromise[_0x5209('0xb3')]()[_0x5209('0xb4')](cmHopperHistory[_0x5209('0xc7')](_0x263fab))[_0x5209('0xac')](loggerCatch(_0x5209('0xc8')));};Dialer[_0x5209('0x19')][_0x5209('0xae')]=function(_0x592f62){if(!_[_0x5209('0x3b')](_0x592f62)&&_0x592f62!==null){if(typeof _0x592f62[_0x5209('0x91')]!==_0x5209('0x92')){if(_0x592f62['originated']>0x0){_0x592f62['originated']-=0x1;}else{logger[_0x5209('0x8e')]('[updateOriginated]\x20object\x20originated\x20is\x20negative');}}}else{logger[_0x5209('0x8e')]('[updateOriginated]\x20is\x20null\x20or\x20undefined');}};Dialer['prototype']['loggerHandler']=function(_0x41c2b9,_0xd98a0f){var _0x55ed30=this;return function(_0xdcc5da){_0x55ed30[_0x5209('0xae')](_0xd98a0f);logger[_0x5209('0x8e')](_0x41c2b9,util[_0x5209('0x8f')](_0xdcc5da,{'showHidden':![],'depth':null}));};};Dialer[_0x5209('0x19')][_0x5209('0xc9')]=function(_0x5728de,_0x3e67b4,_0x52e59d){var _0x2cbc32={'state':0x19,'statedesc':_0x5209('0xca')};this[_0x5209('0xae')](_0x3e67b4);this['saveInDb'](_[_0x5209('0x83')](_0x2cbc32,_[_0x5209('0xcb')](_0x52e59d,[_0x5209('0xcc'),_0x5209('0xcd'),_0x5209('0xce'),_0x5209('0xcf'),_0x5209('0xd0')])),_0x5209('0xd1'),_0x5209('0xd2'));logger[_0x5209('0x8e')](_0x5728de);};Dialer[_0x5209('0x19')][_0x5209('0xd3')]=function(_0x4daea){return _0x4daea===_0x5209('0xd4');};Dialer[_0x5209('0x19')][_0x5209('0xd5')]=function(_0x330b24){return!_['isUndefined'](_0x330b24)&&_0x330b24&&!_[_0x5209('0x3b')](_0x330b24[_0x5209('0x3e')])&&!_[_0x5209('0x3b')](_0x330b24[_0x5209('0x6f')])&&_0x330b24[_0x5209('0x6f')]&&(this[_0x5209('0x20')][util[_0x5209('0x8c')](_0x5209('0xd6'),_0x330b24['name'])][_0x5209('0xd7')]===_0x5209('0xd8')||this['trunks'][util[_0x5209('0x8c')](_0x5209('0xd6'),_0x330b24[_0x5209('0x3e')])][_0x5209('0xd7')]===_0x5209('0xd9'));};Dialer[_0x5209('0x19')][_0x5209('0xda')]=function(_0x421c5d,_0x56937a,_0x3d4f51){this[_0x5209('0xc7')](_0x421c5d)['catch'](loggerCatch(_0x56937a));this[_0x5209('0xc5')](_0x421c5d)[_0x5209('0xac')](loggerCatch(_0x3d4f51));};Dialer[_0x5209('0x19')]['syncVarSet']=function(_0x5c0711){var _0x24c053=this['uniqueId'][_0x5c0711[_0x5209('0xdb')]];var _0x2f5ef0;if(!_['isNil'](_0x5c0711)&&!_[_0x5209('0xa9')](_0x5c0711['variable'])&&!_[_0x5209('0xa9')](_0x5c0711['variable'][_0x5209('0xdc')])&&_0x5c0711[_0x5209('0xdd')]===_0x5209('0xde')&&_0x24c053){if(_0x24c053[_0x5209('0x49')]!==_0x5209('0x72')&&this[_0x5209('0x1d')][_0x24c053[_0x5209('0xaf')]]['dialAMDActive']&&_0x5c0711[_0x5209('0xdf')]===_0x5209('0xe0')){delete this[_0x5209('0x24')][_0x5c0711[_0x5209('0xdb')]];this[_0x5209('0xae')](this['voiceQueues'][_0x24c053['queue']]);this[_0x5209('0x1d')][_0x24c053['queue']][_0x5209('0x5a')]+=0x1;this[_0x5209('0x1d')][_0x24c053[_0x5209('0xaf')]][_0x5209('0x59')]+=0x1;_0x2f5ef0=new Hangup(_0x24c053,_0x5c0711);_0x2f5ef0[_0x5209('0xa0')]=0x12;_0x2f5ef0[_0x5209('0xa1')]=_0x5209('0xe1');_0x2f5ef0[_0x5209('0xe2')]=_0x5209('0xe3');ami[_0x5209('0x48')]('custom:amd',ut['buildObj'](_0x2f5ef0,_0x5209('0xe4')));this['saveInDb'](_0x2f5ef0,_0x5209('0xe5'),_0x5209('0xe6'));}if(_0x24c053[_0x5209('0x49')]!=='ivr'&&this[_0x5209('0x1d')][_0x24c053[_0x5209('0xaf')]][_0x5209('0xe7')]&&_0x5c0711[_0x5209('0xdf')]==='MACHINE'){var _0x591142=this;return new BPromise(function(_0x2830b5,_0x28fd25){delete _0x591142[_0x5209('0x24')][_0x5c0711[_0x5209('0xdb')]];_0x591142[_0x5209('0xae')](_0x591142[_0x5209('0x1d')][_0x24c053[_0x5209('0xaf')]]);_0x591142[_0x5209('0x1d')][_0x24c053[_0x5209('0xaf')]][_0x5209('0x5a')]+=0x1;_0x591142[_0x5209('0x1d')][_0x24c053[_0x5209('0xaf')]]['outboundAnswerAgiCallsDay']+=0x1;var _0x2affe7=_0x591142[_0x5209('0x1d')][_0x24c053[_0x5209('0xaf')]];var _0x3c7ba9=new Hangup(_0x24c053,_0x5c0711);_0x3c7ba9[_0x5209('0xa0')]=0x13;_0x3c7ba9['statedesc']='Machine';_0x3c7ba9[_0x5209('0xe2')]=_0x5209('0xe3');_0x3c7ba9[_0x5209('0xe8')]+=0x1;_0x3c7ba9['countglobal']+=0x1;_0x3c7ba9[_0x5209('0xe4')]=!![];ami[_0x5209('0x48')](_0x5209('0xe9'),ut[_0x5209('0xea')](_0x3c7ba9,_0x5209('0xe4')));_0x591142['createHistory'](_0x3c7ba9)[_0x5209('0xac')](loggerCatch(_0x5209('0xeb')));if(_0x3c7ba9[_0x5209('0xec')]+_0x3c7ba9['countcongestionretry']+_0x3c7ba9[_0x5209('0xed')]+_0x3c7ba9[_0x5209('0xee')]+_0x3c7ba9[_0x5209('0xef')]+_0x3c7ba9[_0x5209('0xf0')]+_0x3c7ba9[_0x5209('0xe8')]+_0x3c7ba9[_0x5209('0xf1')]>=_0x2affe7[_0x5209('0xf2')]){_0x591142[_0x5209('0xf3')](_0x3c7ba9,_0x2830b5,_0x28fd25,_0x5209('0xf4'));}else{if(_0x3c7ba9[_0x5209('0xe8')]>=_0x2affe7['dialMachineMaxRetry']){_0x591142[_0x5209('0xf5')](_0x3c7ba9,_0x2830b5,_0x28fd25,_0x5209('0xf6'));}else{_0x591142[_0x5209('0xbb')]({'active':![],'countmachineretry':_0x3c7ba9[_0x5209('0xe8')],'scheduledat':moment()[_0x5209('0xf7')](_0x2affe7[_0x5209('0xf8')],_0x5209('0xf9'))[_0x5209('0x8c')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x3c7ba9[_0x5209('0xcc')],'ListId':_0x3c7ba9[_0x5209('0xcd')],'VoiceQueueId':_0x3c7ba9['VoiceQueueId']||undefined,'CampaignId':_0x3c7ba9[_0x5209('0xd0')]||undefined})[_0x5209('0xac')](loggerCatch('[rescheduleContact][Machine]'));_0x2830b5({'reschedule':0x1});}}});}if(_0x24c053['type']===_0x5209('0x72')&&this['campaigns'][_0x24c053[_0x5209('0xaf')]][_0x5209('0xe7')]&&_0x5c0711[_0x5209('0xdf')]===_0x5209('0xe0')){delete this[_0x5209('0x24')][_0x5c0711['uniqueid']];this['updateOriginated'](this['campaigns'][_0x24c053[_0x5209('0xaf')]]);_0x2f5ef0=new Hangup(_0x24c053,_0x5c0711);_0x2f5ef0[_0x5209('0xa0')]=0x12;_0x2f5ef0[_0x5209('0xa1')]='HangupInAMD';_0x2f5ef0[_0x5209('0xe2')]=_0x5209('0xe3');ami[_0x5209('0x48')](_0x5209('0xe9'),ut[_0x5209('0xea')](_0x2f5ef0,'amd'));this[_0x5209('0xda')](_0x2f5ef0,'[syncHangupInAMDIvr][createHistory]',_0x5209('0xfa'));}if(_0x24c053[_0x5209('0x49')]===_0x5209('0x72')&&this[_0x5209('0x1e')][_0x24c053[_0x5209('0xaf')]][_0x5209('0xe7')]&&_0x5c0711[_0x5209('0xdf')]===_0x5209('0xfb')){var _0x591142=this;return new BPromise(function(_0x1f6521,_0x5dc436){delete _0x591142[_0x5209('0x24')][_0x5c0711[_0x5209('0xdb')]];_0x591142[_0x5209('0xae')](_0x591142[_0x5209('0x1e')][_0x24c053[_0x5209('0xaf')]]);_0x591142[_0x5209('0x1e')][_0x24c053['queue']][_0x5209('0x5a')]+=0x1;_0x591142[_0x5209('0x1e')][_0x24c053[_0x5209('0xaf')]][_0x5209('0x59')]+=0x1;var _0x2f257b=_0x591142[_0x5209('0x1e')][_0x24c053[_0x5209('0xaf')]];var _0x321bba=new Hangup(_0x24c053,_0x5c0711);_0x321bba[_0x5209('0xa0')]=0x13;_0x321bba['statedesc']='Machine';_0x321bba['membername']=_0x5209('0xe3');_0x321bba[_0x5209('0xe8')]+=0x1;_0x321bba[_0x5209('0xfc')]+=0x1;_0x321bba['amd']=!![];ami[_0x5209('0x48')](_0x5209('0xe9'),ut[_0x5209('0xea')](_0x321bba,_0x5209('0xe4')));_0x591142[_0x5209('0xc7')](_0x321bba)['catch'](loggerCatch(_0x5209('0xeb')));if(_0x321bba['countbusyretry']+_0x321bba[_0x5209('0xfd')]+_0x321bba[_0x5209('0xed')]+_0x321bba[_0x5209('0xee')]+_0x321bba['countdropretry']+_0x321bba[_0x5209('0xf0')]+_0x321bba[_0x5209('0xe8')]+_0x321bba[_0x5209('0xf1')]>=_0x2f257b[_0x5209('0xf2')]){_0x591142[_0x5209('0xf3')](_0x321bba,_0x1f6521,_0x5dc436,_0x5209('0xf4'));}else{if(_0x321bba[_0x5209('0xe8')]>=_0x2f257b[_0x5209('0xfe')]){_0x591142[_0x5209('0xf5')](_0x321bba,_0x1f6521,_0x5dc436,'reason\x2019\x20machine....');}else{_0x591142[_0x5209('0xbb')]({'active':![],'countmachineretry':_0x321bba[_0x5209('0xe8')],'scheduledat':moment()['add'](_0x2f257b[_0x5209('0xf8')],_0x5209('0xf9'))['format'](_0x5209('0xff')),'ContactId':_0x321bba[_0x5209('0xcc')],'ListId':_0x321bba[_0x5209('0xcd')],'VoiceQueueId':_0x321bba['VoiceQueueId']||undefined,'CampaignId':_0x321bba[_0x5209('0xd0')]||undefined})[_0x5209('0xac')](loggerCatch('[rescheduleContact][Machine]'));_0x1f6521({'reschedule':0x1});}}});}}};Dialer[_0x5209('0x19')][_0x5209('0x33')]=function(_0x15e27e){var _0xee7eb8=this[_0x5209('0x24')][_0x15e27e['uniqueid']];var _0x319d3a=this;var _0x308fd9;if(_0xee7eb8&&_0xee7eb8[_0x5209('0x49')]===_0x5209('0x72')){delete this[_0x5209('0x24')][_0x15e27e[_0x5209('0xdb')]];this[_0x5209('0xae')](this[_0x5209('0x1e')][_0xee7eb8[_0x5209('0xaf')]]);this[_0x5209('0x1e')][_0xee7eb8[_0x5209('0xaf')]][_0x5209('0x100')]+=0x1;_0x308fd9=new Hangup(_0xee7eb8,_0x15e27e);this['createHistory'](_0x308fd9)[_0x5209('0xac')](loggerCatch('[syncHangupIvr][createHistory]'));this[_0x5209('0xc5')](_0x308fd9)[_0x5209('0xac')](loggerCatch(_0x5209('0x101')));}if(_0xee7eb8&&_0xee7eb8[_0x5209('0x49')]!==_0x5209('0x72')&&isNotNull(this['voiceQueues'][_0xee7eb8['queue']][_0x5209('0x102')])){delete this[_0x5209('0x24')][_0x15e27e[_0x5209('0xdb')]];this['updateOriginated'](this[_0x5209('0x1d')][_0xee7eb8[_0x5209('0xaf')]]);this[_0x5209('0x1d')][_0xee7eb8[_0x5209('0xaf')]][_0x5209('0x5a')]+=0x1;this[_0x5209('0x1d')][_0xee7eb8['queue']][_0x5209('0x59')]+=0x1;_0x308fd9=new Hangup(_0xee7eb8,_0x15e27e);_0x308fd9[_0x5209('0xa0')]=0x10;_0x308fd9[_0x5209('0xa1')]=_0x5209('0x103');_0x308fd9['membername']=_0x5209('0x104');this[_0x5209('0xc7')](_0x308fd9)[_0x5209('0xac')](loggerCatch(_0x5209('0x105')));this[_0x5209('0xc5')](_0x308fd9)[_0x5209('0xac')](loggerCatch(_0x5209('0x101')));}if(_0xee7eb8&&_0xee7eb8[_0x5209('0x49')]!==_0x5209('0x72')&&!isNotNull(this['voiceQueues'][_0xee7eb8[_0x5209('0xaf')]][_0x5209('0x102')])){delete this[_0x5209('0x24')][_0x15e27e['uniqueid']];this[_0x5209('0xae')](this['voiceQueues'][_0xee7eb8[_0x5209('0xaf')]]);this[_0x5209('0x1d')][_0xee7eb8[_0x5209('0xaf')]][_0x5209('0x106')]+=0x1;_0x308fd9=new Hangup(_0xee7eb8,_0x15e27e);_0x308fd9[_0x5209('0xa0')]=0xc;_0x308fd9[_0x5209('0xa1')]=_0x15e27e[_0x5209('0x107')];_0x308fd9[_0x5209('0xe2')]=_0x5209('0x108');this[_0x5209('0xc7')](_0x308fd9)[_0x5209('0xac')](loggerCatch(_0x5209('0x105')));this[_0x5209('0xc5')](_0x308fd9)[_0x5209('0xac')](loggerCatch(_0x5209('0x101')));}};Dialer[_0x5209('0x19')][_0x5209('0x30')]=function(_0x123aa5){var _0x4e99ec=this[_0x5209('0x24')][_0x123aa5[_0x5209('0xdb')]];var _0x1377e6=this;if(this['voiceQueues'][_0x123aa5[_0x5209('0xaf')]]){if(_0x4e99ec&&_0x4e99ec['type']!==_0x5209('0x72')){delete this['uniqueId'][_0x123aa5[_0x5209('0xdb')]];this[_0x5209('0x1d')][_0x123aa5[_0x5209('0xaf')]][_0x5209('0x5a')]+=0x1;var _0x3efe7a=new AgentComplete(_0x4e99ec,_0x123aa5);if(_0x123aa5['reason']===_0x5209('0x109')){_0x3efe7a[_0x5209('0x10a')]=this[_0x5209('0x1d')][_0x123aa5[_0x5209('0xaf')]][_0x5209('0x10b')]&&this['voiceQueues'][_0x123aa5['queue']][_0x5209('0x10c')]?moment()[_0x5209('0x8c')](_0x5209('0xff')):undefined;}this[_0x5209('0xc7')](_0x3efe7a)[_0x5209('0xac')](loggerCatch(_0x5209('0x10d')));this[_0x5209('0xc5')](_0x3efe7a)[_0x5209('0xac')](loggerCatch(_0x5209('0x10e')));}}};Dialer[_0x5209('0x19')]['syncAgentConnect']=function(_0x2f9afe){if(this[_0x5209('0x1d')][_0x2f9afe[_0x5209('0xaf')]]){if(this[_0x5209('0x24')][_0x2f9afe[_0x5209('0xdb')]]&&this[_0x5209('0x24')][_0x2f9afe[_0x5209('0xdb')]][_0x5209('0x49')]!==_0x5209('0x72')){this[_0x5209('0xae')](this['voiceQueues'][_0x2f9afe[_0x5209('0xaf')]]);this[_0x5209('0x24')][_0x2f9afe[_0x5209('0xdb')]]['answertime']=moment()[_0x5209('0x8c')]('YYYY-MM-DD\x20HH:mm:ss');}}};Dialer[_0x5209('0x19')][_0x5209('0x10f')]=function(_0x2112d5){this[_0x5209('0xc7')](_0x2112d5)['catch'](loggerCatch(_0x5209('0x10d')));this[_0x5209('0xc5')](_0x2112d5)[_0x5209('0xac')](loggerCatch(_0x5209('0x110')));};Dialer[_0x5209('0x19')]['syncQueueCallerAbandon']=function(_0x44bd3d){var _0x1de462=this['uniqueId'][_0x44bd3d[_0x5209('0xdb')]];var _0x551c2e=this;if(this[_0x5209('0x1d')][_0x44bd3d[_0x5209('0xaf')]]){if(_0x1de462&&_0x1de462[_0x5209('0x49')]!==_0x5209('0x72')){delete this[_0x5209('0x24')][_0x44bd3d[_0x5209('0xdb')]];this[_0x5209('0xae')](this[_0x5209('0x1d')][_0x44bd3d['queue']]);_0x1de462[_0x5209('0x111')]=moment()[_0x5209('0x8c')]('YYYY-MM-DD\x20HH:mm:ss');var _0x1b68a5=new QueueCallerAbandon(_0x1de462,_0x44bd3d);if(getSeconds(_0x1de462[_0x5209('0x111')],_0x1de462[_0x5209('0x112')])>=_0x1de462[_0x5209('0x113')]){this[_0x5209('0x1d')][_0x44bd3d[_0x5209('0xaf')]][_0x5209('0x65')]+=0x1;this[_0x5209('0x1d')][_0x44bd3d[_0x5209('0xaf')]][_0x5209('0x5f')]+=0x1;this['voiceQueues'][_0x44bd3d[_0x5209('0xaf')]][_0x5209('0x114')]+=0x1;_0x1b68a5[_0x5209('0xa0')]=0xa;_0x1b68a5[_0x5209('0xa1')]=_0x5209('0x115');_0x1b68a5[_0x5209('0x116')]=_0x5209('0x117');_0x1b68a5[_0x5209('0x10a')]=this[_0x5209('0x1d')][_0x44bd3d[_0x5209('0xaf')]][_0x5209('0x10b')]?moment()['format'](_0x5209('0xff')):undefined;_0x1b68a5[_0x5209('0xef')]+=0x1;_0x1b68a5[_0x5209('0xfc')]+=0x1;if(_0x1b68a5[_0x5209('0xef')]>=this[_0x5209('0x1d')][_0x44bd3d['queue']]['dialDropMaxRetry']){this[_0x5209('0x10f')](_0x1b68a5);}else{this[_0x5209('0xbb')]({'active':![],'countdropretry':_0x1b68a5[_0x5209('0xef')],'scheduledat':moment()['add'](this[_0x5209('0x1d')][_0x44bd3d[_0x5209('0xaf')]][_0x5209('0x118')],_0x5209('0xf9'))[_0x5209('0x8c')](_0x5209('0xff')),'ContactId':_0x1de462[_0x5209('0xcc')],'ListId':_0x1de462[_0x5209('0xcd')],'VoiceQueueId':_0x1de462['VoiceQueueId']||undefined,'CampaignId':_0x1de462['CampaignId']||undefined})['catch'](loggerCatch(_0x5209('0x119')));var _0x332f85=new History(_0x1b68a5);_0x332f85[_0x5209('0xa0')]=0xa;_0x332f85['statedesc']=_0x5209('0x115');_0x332f85['starttime']=moment()[_0x5209('0x8c')](_0x5209('0xff'));_0x332f85[_0x5209('0xa2')]=_0x332f85[_0x5209('0xa3')];_0x332f85[_0x5209('0x11a')]=_0x1b68a5[_0x5209('0x11a')];_0x332f85['calleridnum']=_0x1b68a5[_0x5209('0x11b')];this[_0x5209('0xc7')](_0x332f85)['catch'](loggerCatch(_0x5209('0x11c')));}}else{this[_0x5209('0x1d')][_0x44bd3d[_0x5209('0xaf')]][_0x5209('0x64')]+=0x1;this[_0x5209('0x1d')][_0x44bd3d['queue']][_0x5209('0x5e')]+=0x1;_0x1b68a5[_0x5209('0xa0')]=0xb;_0x1b68a5[_0x5209('0xa1')]='Abandoned';_0x1b68a5[_0x5209('0x116')]=_0x5209('0x11d');_0x1b68a5[_0x5209('0xf0')]+=0x1;_0x1b68a5[_0x5209('0xfc')]+=0x1;if(_0x1b68a5['countabandonedretry']>=this[_0x5209('0x1d')][_0x44bd3d[_0x5209('0xaf')]][_0x5209('0x11e')]){this['queueCallerAbandonCreateState'](_0x1b68a5);}else{this['rescheduleContact']({'active':![],'countabandonedretry':_0x1b68a5['countabandonedretry'],'scheduledat':moment()['add'](this[_0x5209('0x1d')][_0x44bd3d[_0x5209('0xaf')]][_0x5209('0x11f')],_0x5209('0xf9'))['format'](_0x5209('0xff')),'ContactId':_0x1de462['ContactId'],'ListId':_0x1de462[_0x5209('0xcd')],'VoiceQueueId':_0x1de462[_0x5209('0xcf')]||undefined,'CampaignId':_0x1de462[_0x5209('0xd0')]||undefined})[_0x5209('0xac')](loggerCatch(_0x5209('0x120')));var _0x332f85=new History(_0x1b68a5);_0x332f85[_0x5209('0xa0')]=0xb;_0x332f85['statedesc']='Abandoned';_0x332f85['starttime']=moment()[_0x5209('0x8c')](_0x5209('0xff'));_0x332f85[_0x5209('0xa2')]=_0x332f85[_0x5209('0xa3')];_0x332f85['calleridname']=_0x1b68a5[_0x5209('0x11a')];_0x332f85[_0x5209('0x11b')]=_0x1b68a5[_0x5209('0x11b')];this[_0x5209('0xc7')](_0x332f85)[_0x5209('0xac')](loggerCatch(_0x5209('0x121')));}}}}};Dialer['prototype'][_0x5209('0x35')]=function(_0x232888){if(this[_0x5209('0x22')][_0x232888[_0x5209('0xdb')]]){this['actions'][_0x232888[_0x5209('0xdb')]][_0x5209('0xab')]=_0x232888[_0x5209('0xab')];}if(this[_0x5209('0x24')][_0x232888[_0x5209('0xdb')]]){this[_0x5209('0x24')][_0x232888[_0x5209('0xdb')]][_0x5209('0xab')]=_0x232888['channel'];}};Dialer['prototype']['syncQueueMember']=function(_0x2583ce){if(strategy[this['voiceQueues'][this[_0x5209('0x22')][_0x2583ce[_0x5209('0x122')]][_0x5209('0xaf')]][_0x5209('0x4b')]]===_0x5209('0x18')){if(this['actions'][_0x2583ce[_0x5209('0x122')]]&&_['isNil'](this[_0x5209('0x22')][_0x2583ce['actionid']]['locked'])&&_0x2583ce['status']==='1'&&_0x2583ce['paused']==='0'){if(this[_0x5209('0x1f')][_0x2583ce['stateinterface']]){if(!this[_0x5209('0x1f')][_0x2583ce[_0x5209('0x123')]][_0x5209('0x124')]){this[_0x5209('0x1f')][_0x2583ce[_0x5209('0x123')]][_0x5209('0x124')]=!![];this[_0x5209('0x22')][_0x2583ce[_0x5209('0x122')]][_0x5209('0x124')]=!![];this[_0x5209('0x22')][_0x2583ce[_0x5209('0x122')]][_0x5209('0x123')]=_0x2583ce[_0x5209('0x123')];}}}}else if((strategy[this[_0x5209('0x1d')][this[_0x5209('0x22')][_0x2583ce[_0x5209('0x122')]][_0x5209('0xaf')]]['strategy']]||_0x5209('0x17'))===_0x5209('0x17')){if(this[_0x5209('0x22')][_0x2583ce[_0x5209('0x122')]]){if(this[_0x5209('0x1f')][_0x2583ce[_0x5209('0x123')]]){this[_0x5209('0x22')][_0x2583ce[_0x5209('0x122')]][_0x5209('0x123')]=_0x2583ce[_0x5209('0x123')];if(_[_0x5209('0xa9')](this['queueBooked'][this[_0x5209('0x22')][_0x2583ce[_0x5209('0x122')]]['queue']])){this[_0x5209('0x28')][this[_0x5209('0x22')][_0x2583ce[_0x5209('0x122')]][_0x5209('0xaf')]]=[];}this[_0x5209('0x28')][this['actions'][_0x2583ce[_0x5209('0x122')]][_0x5209('0xaf')]][_0x5209('0x125')](_['merge'](_[_0x5209('0xcb')](this['actions'][_0x2583ce[_0x5209('0x122')]],[_0x5209('0x126'),'stateinterface']),{'status':_0x2583ce['status'],'paused':_0x2583ce[_0x5209('0x127')]}));}}}};function unlockQueueStatus(_0x48041f,_0x5514c8){setTimeout(function(){if(_[_0x5209('0x3b')](_0x48041f[_0x5209('0x128')])){loggerBooked['error'](_0x5209('0x129'),_0x5514c8);}_0x48041f['queueStatusComplete']=!![];loggerBooked[_0x5209('0x75')](_0x5209('0x12a'),_0x5514c8,JSON['stringify'](_[_0x5209('0xcb')](_0x48041f,[_0x5209('0x3e'),'queueStatusComplete'])));},0x1f3);}Dialer['prototype']['syncQueueStatusComplete']=function(_0x2d176a){var _0x157d34=this;var _0x6dc33d=_0x157d34[_0x5209('0x1d')][_0x157d34[_0x5209('0x22')][_0x2d176a[_0x5209('0x122')]][_0x5209('0xaf')]];if(strategy[this[_0x5209('0x1d')][this['actions'][_0x2d176a[_0x5209('0x122')]][_0x5209('0xaf')]]['strategy']]==='roundrobin'){if(this[_0x5209('0x22')][_0x2d176a['actionid']]&&this[_0x5209('0x22')][_0x2d176a[_0x5209('0x122')]][_0x5209('0x123')]){this[_0x5209('0x1c')]['run'](this[_0x5209('0x22')][_0x2d176a[_0x5209('0x122')]][_0x5209('0x126')],this[_0x5209('0x22')][_0x2d176a[_0x5209('0x122')]][_0x5209('0x123')])['catch'](function(_0x4367ce){logger[_0x5209('0x8e')]('[Catch][Preview][syncQueueStatusComplete]',util['inspect'](_0x4367ce,{'showHidden':![],'depth':null}));})[_0x5209('0x1b')](function(){_0x157d34[_0x5209('0xae')](_0x157d34['voiceQueues'][_0x157d34[_0x5209('0x22')][_0x2d176a[_0x5209('0x122')]][_0x5209('0xaf')]]);_0x157d34[_0x5209('0x1f')][_0x157d34['actions'][_0x2d176a[_0x5209('0x122')]][_0x5209('0x123')]][_0x5209('0x124')]=![];delete _0x157d34[_0x5209('0x22')][_0x2d176a['actionid']];unlockQueueStatus(_0x6dc33d);});}else{this[_0x5209('0xae')](this[_0x5209('0x1d')][this[_0x5209('0x22')][_0x2d176a[_0x5209('0x122')]][_0x5209('0xaf')]]);this[_0x5209('0xbb')]({'active':![],'ContactId':this[_0x5209('0x22')][_0x2d176a['actionid']][_0x5209('0xcc')],'ListId':this[_0x5209('0x22')][_0x2d176a[_0x5209('0x122')]]['ListId'],'VoiceQueueId':this[_0x5209('0x22')][_0x2d176a['actionid']][_0x5209('0xcf')]||undefined,'CampaignId':this['actions'][_0x2d176a[_0x5209('0x122')]]['CampaignId']||undefined})[_0x5209('0xac')](loggerCatch(_0x5209('0x12b')));delete this[_0x5209('0x22')][_0x2d176a[_0x5209('0x122')]];unlockQueueStatus(_0x6dc33d);}}else if((strategy[this[_0x5209('0x1d')][this[_0x5209('0x22')][_0x2d176a[_0x5209('0x122')]][_0x5209('0xaf')]][_0x5209('0x4b')]]||'rrmemory')===_0x5209('0x17')){var _0x2594cb;if(this[_0x5209('0x22')][_0x2d176a[_0x5209('0x122')]]&&!_[_0x5209('0x74')](this[_0x5209('0x28')][this[_0x5209('0x22')][_0x2d176a['actionid']]['queue']])){if(this[_0x5209('0x12c')][_0x157d34[_0x5209('0x22')][_0x2d176a[_0x5209('0x122')]]['queue']]){this[_0x5209('0x12c')][_0x157d34['actions'][_0x2d176a[_0x5209('0x122')]]['queue']]=this[_0x5209('0x12c')][this['actions'][_0x2d176a[_0x5209('0x122')]][_0x5209('0xaf')]]?this[_0x5209('0x12c')][this['actions'][_0x2d176a[_0x5209('0x122')]][_0x5209('0xaf')]]:this['queueBooked'][this['actions'][_0x2d176a[_0x5209('0x122')]][_0x5209('0xaf')]]?this[_0x5209('0x28')][this['actions'][_0x2d176a[_0x5209('0x122')]][_0x5209('0xaf')]][_0x5209('0x12d')]||0x0:0x0;}this[_0x5209('0x28')][this['actions'][_0x2d176a[_0x5209('0x122')]]['queue']][_0x5209('0x12d')]=this[_0x5209('0x12c')][this[_0x5209('0x22')][_0x2d176a[_0x5209('0x122')]][_0x5209('0xaf')]];for(var _0x503cd4=0x0;_0x503cd4=0x0;})['catch'](myreject(_0x5b23ab)));}}else{_0x1f4448[_0x5209('0x125')](ami['Action']({'action':_0x5209('0x148'),'command':util['format'](_0x5209('0x149'),_0x46787b,!_['isUndefined'](config[_0x5209('0x144')][_0x1fb027])?_0x1fb027:'')})['then'](function(_0xc0cf29){return _0xc0cf29[_0x5209('0x14b')]['indexOf'](_0x5209('0x14d'))>=0x0;})[_0x5209('0xac')](myreject(_0x5b23ab)));}BPromise[_0x5209('0x14e')](_0x1f4448)['then'](function(_0x1ca664){var _0x2b95d5=_[_0x5209('0x14f')](_0x1ca664);if(_0x2b95d5){return _0x1c6b7a(_0x2b95d5);}else{_0x4817b4[_0x5209('0x3c')]=_0x161721?_0x5209('0x150'):'INTERVAL_IS_OVERTIME';return _0x5b23ab(msgResponse(_0x5209('0x151'),_0x5209('0x140'),_0x5209('0x152')+_0x161721+'\x20'+_0x21a86b+_0x5209('0x153')+util[_0x5209('0x8f')](_0x46787b,{'showHidden':![],'depth':null})+_0x5209('0x154')+_0x1fb027));}})[_0x5209('0xac')](function(_0x4fcfe3){return _0x5b23ab(msgResponse(_0x5209('0x13f'),_0x5209('0x140'),JSON[_0x5209('0x132')](_0x4fcfe3)));});});};Dialer[_0x5209('0x19')][_0x5209('0x155')]=function(_0x4ad627){var _0x4d2487=this;return function(){switch(_0x4ad627[_0x5209('0x56')]){case'progressive':freeVariablesPredictive(_0x4ad627);_0x4d2487[_0x5209('0x156')](_0x4ad627,0x1);break;case _0x5209('0x157'):freeVariablesPredictive(_0x4ad627);_0x4d2487[_0x5209('0x156')](_0x4ad627,_0x4ad627['dialPowerLevel']);break;case _0x5209('0x8'):_0x4d2487[_0x5209('0x8')](_0x4ad627);break;case _0x5209('0x158'):freeVariablesPredictive(_0x4ad627);_0x4d2487[_0x5209('0x156')](_0x4ad627,0x1);break;default:freeVariablesPredictive(_0x4ad627);logger[_0x5209('0x8e')](_0x5209('0x159'),_0x4ad627[_0x5209('0x3e')],_0x5209('0x15a'));}};};Dialer['prototype']['checkPreviewRecallReminder']=_[_0x5209('0x15b')](function(_0x3a278d){return BPromise['resolve']()[_0x5209('0xb4')](cmHopper[_0x5209('0x15c')](_0x3a278d['id'],previewRecallmeReminderInterval))[_0x5209('0xb4')](function(_0x88e1b9){for(var _0x23220d=0x0;_0x23220d<_0x88e1b9[_0x5209('0x12e')];_0x23220d++){var _0x460b9f=_0x88e1b9[_0x23220d][_0x5209('0x15d')][_0x5209('0x3e')];if(_0x460b9f)io['to'](util[_0x5209('0x8c')](_0x5209('0x15e'),_0x460b9f))[_0x5209('0x48')](_0x5209('0x15f'),{'hopper':_0x88e1b9[_0x23220d]});}})['catch'](function(_0x2569c4){logger[_0x5209('0x8e')](_0x5209('0x160'),_0x2569c4);});},0x3c*0x3e8,{'leading':!![]});Dialer[_0x5209('0x19')][_0x5209('0x161')]=function(_0x1c2a19){var _0x327c4d=this;return function(){_0x327c4d['handleIvr'](_0x1c2a19);};};Dialer[_0x5209('0x19')][_0x5209('0xa')]=function(_0x38ddef){var _0x4704dc=this;if(isNotPreview(_0x38ddef['dialMethod'])){if(isVoiceQueueOutbound(_0x38ddef[_0x5209('0x49')])&&isActive(_0x38ddef['dialActive'])){_0x38ddef[_0x5209('0x9a')]=!![];BPromise['resolve']()[_0x5209('0xb4')](checkIsLoggedIn(_0x38ddef,_0x38ddef[_0x5209('0x4e')]))[_0x5209('0xb4')](checkIsActive(_0x38ddef,_0x38ddef[_0x5209('0x162')]))['then'](checkInterval(_0x38ddef))[_0x5209('0xb4')](_0x4704dc[_0x5209('0x13b')](_0x38ddef))[_0x5209('0xb4')](_0x4704dc['checkIfTime'](_0x38ddef[_0x5209('0x163')],_0x38ddef['dialTimezone'],_0x38ddef[_0x5209('0x3e')],_0x38ddef))['then'](_0x4704dc[_0x5209('0x164')](_0x38ddef[_0x5209('0x41')],_0x38ddef[_0x5209('0x165')],_0x38ddef[_0x5209('0x3e')],_0x38ddef))['then'](_0x4704dc[_0x5209('0x155')](_0x38ddef))['catch'](loggerCatchQueueSummary(_0x5209('0x166'),_0x38ddef));}else{notSendMessagesQueue(_0x38ddef);}}else{freeVariablesPredictive(_0x38ddef);if(_0x38ddef[_0x5209('0x167')]){_0x4704dc['checkPreviewRecallReminder'](_0x38ddef);}}};Dialer[_0x5209('0x19')]['syncCampaigns']=function(){var _0x4ad089=this;var _0x4e3d87;for(var _0x434091 in this[_0x5209('0x1e')]){if(typeof this[_0x5209('0x1e')][_0x434091]!==_0x5209('0x92')){_0x4e3d87=this[_0x5209('0x1e')][_0x434091];if(isCampaignIvr(_0x4e3d87[_0x5209('0x49')])&&isActive(_0x4e3d87[_0x5209('0x6f')])){_0x4e3d87[_0x5209('0x9a')]=!![];BPromise[_0x5209('0xb3')]()[_0x5209('0xb4')](checkIsActive(_0x4e3d87,_0x4e3d87[_0x5209('0x6f')]))[_0x5209('0xb4')](checkInterval(_0x4e3d87))[_0x5209('0xb4')](_0x4ad089[_0x5209('0x13b')](_0x4e3d87))['then'](_0x4ad089['checkIfTime'](_0x4e3d87[_0x5209('0x163')],_0x4e3d87[_0x5209('0x165')],_0x4e3d87[_0x5209('0x3e')],_0x4e3d87))['then'](_0x4ad089[_0x5209('0x164')](_0x4e3d87[_0x5209('0x41')],_0x4e3d87[_0x5209('0x165')],_0x4e3d87['name'],_0x4e3d87))[_0x5209('0xb4')](_0x4ad089[_0x5209('0x161')](_0x4e3d87))[_0x5209('0xac')](loggerCatchQueueSummary('[syncCampaigns]',_0x4e3d87));}else{notSendMessagesCampaign(_0x4e3d87);}}}};function getCallerIdRandom(_0x39d648,_0x497683){var _0x31ed9c;var _0x2781c8;var _0x497352;if(_0x497683<=0x0){_0x497683=0x1;}_0x31ed9c=new RegExp(_0x5209('0x168')+_0x497683+'}$');_0x2781c8=Math[_0x5209('0x169')](0xa,_0x497683-0x1);_0x497352=Math[_0x5209('0x169')](0xa,_0x497683)-0x1;return util[_0x5209('0x8c')]('%s',_[_0x5209('0x16a')](_0x39d648,_0x31ed9c,_[_0x5209('0x16b')](_0x2781c8,_0x497352)));}function extractCalleridName(_0x632344){var _0x2d9d78=_0x632344[_0x5209('0x16c')](/"(.*?)"/);return _0x2d9d78?_0x2d9d78[0x1]:_0x632344;}function extractCalleridNumber(_0x200016){var _0x244fa8=_0x200016[_0x5209('0x16c')](/<(.*?)>/);return _0x244fa8?_0x244fa8[0x1]:_0x200016;}Dialer[_0x5209('0x19')][_0x5209('0x16d')]=function(_0xcf14ee,_0x59a22b){var _0x2a70c0=this;var _0x130436=uuid['v4']();this[_0x5209('0x22')][_0x130436]=new Action(_0xcf14ee,_0x59a22b,_0x130436);return new BPromise(function(_0x3e3f9c,_0x416ad5){if(_['isUndefined'](_0xcf14ee)&&typeof _0xcf14ee!==_0x5209('0x16e')){return _0x416ad5(msgResponse(_0x5209('0x16f'),_0x5209('0x140'),_0x5209('0x170')));}if(_[_0x5209('0x3b')](_0x59a22b[_0x5209('0x171')][_0x5209('0x172')])||_0x59a22b[_0x5209('0x171')]['phone']===null){return _0x416ad5(msgResponse(_0x5209('0x16f'),_0x5209('0x140'),'contact\x20is\x20undefine'));}var _0xf9560c={'XMD-CALLERID':_0x2a70c0['actions'][_0x130436][_0x5209('0x173')](),'XMD-AGI':_0xcf14ee[_0x5209('0x102')]?util['format']('\x22agi://%s/square,%s\x22',ipAgi,_0xcf14ee[_0x5209('0x102')]):_0x5209('0x174'),'XMD-AGIAFTER':_0xcf14ee[_0x5209('0x10b')]?util[_0x5209('0x8c')](_0x5209('0x175'),ipAgi,_0xcf14ee[_0x5209('0x10b')]):_0x5209('0x174'),'XMD-QUEUE':_0xcf14ee[_0x5209('0x49')]==='outbound'?util[_0x5209('0x8c')](_0x5209('0x176'),_0xcf14ee[_0x5209('0x3e')],_0xcf14ee[_0x5209('0x177')]||'',_0xcf14ee[_0x5209('0x10c')]?'c':'',_0xcf14ee[_0x5209('0x113')]||0x3):'NONE','XMD-CONTACTID':_0x59a22b[_0x5209('0xcc')],'XMD-CDRTYPE':_0x5209('0x7'),'CALLERID(all)':_0x2a70c0[_0x5209('0x22')][_0x130436][_0x5209('0x173')](),'XMD-AMD':_0xcf14ee[_0x5209('0xe7')]?'ACTIVE':_0x5209('0x174'),'XMD-DESTINATION':_0x5209('0xde')};if(_0xcf14ee['dialAMDActive']){_0xf9560c['XMD-AMDINITIALSILENCE']=_0xcf14ee[_0x5209('0x178')]||0x9c4;_0xf9560c[_0x5209('0x179')]=_0xcf14ee['dialAMDGreeting']||0x5dc;_0xf9560c[_0x5209('0x17a')]=_0xcf14ee[_0x5209('0x17b')]||0x320;_0xf9560c[_0x5209('0x17c')]=_0xcf14ee[_0x5209('0x17d')]||0x1388;_0xf9560c[_0x5209('0x17e')]=_0xcf14ee[_0x5209('0x17f')]||0x64;_0xf9560c[_0x5209('0x180')]=_0xcf14ee[_0x5209('0x181')]||0x32;_0xf9560c[_0x5209('0x182')]=_0xcf14ee['dialAMDMaximumNumberOfWords']||0x3;_0xf9560c['XMD-AMDSILENCETHRESHOLD']=_0xcf14ee[_0x5209('0x183')]||0x100;_0xf9560c[_0x5209('0x184')]=_0xcf14ee[_0x5209('0x185')]||0x1388;}if(_0xcf14ee['type']===_0x5209('0x4a')){_0xf9560c[_0x5209('0x186')]=_0x59a22b[_0x5209('0xcf')];}else{_0xf9560c['XMD-CAMPAIGNID']=_0x59a22b['CampaignId'];}for(var _0x3dde19 in _0x59a22b[_0x5209('0x171')]){if(typeof _0x59a22b[_0x5209('0x171')][_0x3dde19]!==_0x5209('0x92')){if(isNotNull(_0x59a22b[_0x5209('0x171')][_0x3dde19])&&_0x3dde19!=='id'&&_0x3dde19!==_0x5209('0x187')&&_0x3dde19!==_0x5209('0x188')&&_0x3dde19!==_0x5209('0x189')){_0xf9560c[util['format'](_0x5209('0x18a'),_0x5209('0x18b'),_['toUpper'](_0x3dde19))]=_0x59a22b['Contact'][_0x3dde19];}}}var _0x360e9b=_0x2a70c0[_0x5209('0xd5')](_0xcf14ee['Trunk'])?getCallerId(_0xcf14ee[_0x5209('0x6e')][_0x5209('0x70')],_0xcf14ee[_0x5209('0x57')],_0xcf14ee[_0x5209('0x18c')]>0x0?getCallerIdRandom(_0xcf14ee[_0x5209('0x58')],_0xcf14ee['dialRandomLastDigitCallerIdNumber']):_0xcf14ee[_0x5209('0x58')]):getCallerId(_[_0x5209('0xa9')](_0xcf14ee[_0x5209('0x18d')])?_0xcf14ee['Trunk'][_0x5209('0x70')]:_0xcf14ee[_0x5209('0x18d')][_0x5209('0x70')],_0xcf14ee[_0x5209('0x57')],_0xcf14ee[_0x5209('0x18c')]>0x0?getCallerIdRandom(_0xcf14ee[_0x5209('0x58')],_0xcf14ee['dialRandomLastDigitCallerIdNumber']):_0xcf14ee[_0x5209('0x58')]);if(_0x360e9b){_0xf9560c[_0x5209('0x18e')]=_0x2a70c0[_0x5209('0x22')][_0x130436][_0x5209('0x18f')]=extractCalleridName(_0x360e9b);_0xf9560c[_0x5209('0x190')]=_0x2a70c0[_0x5209('0x22')][_0x130436]['originatecalleridnum']=extractCalleridNumber(_0x360e9b);}return ami[_0x5209('0xaa')]({'actionid':_0x130436,'action':_0x5209('0x16f'),'channel':_0x2a70c0['isTrunkReachable'](_0xcf14ee['Trunk'])?util[_0x5209('0x8c')]('SIP/%s/%s%s',_0xcf14ee['Trunk']['name'],isNotNull(_0xcf14ee['dialPrefix'])?_0xcf14ee[_0x5209('0x191')][_0x5209('0x192')]()||'':'',_0xcf14ee[_0x5209('0x193')]>0x0?_0x59a22b[_0x5209('0x171')][_0x5209('0x172')][_0x5209('0x194')](_0xcf14ee[_0x5209('0x193')]):_0x59a22b[_0x5209('0x171')][_0x5209('0x172')]):util[_0x5209('0x8c')]('SIP/%s/%s%s',_['isNil'](_0xcf14ee['TrunkBackup'])?_0xcf14ee[_0x5209('0x6e')][_0x5209('0x3e')]:_0xcf14ee[_0x5209('0x18d')][_0x5209('0x3e')],isNotNull(_0xcf14ee['dialPrefix'])?_0xcf14ee[_0x5209('0x191')][_0x5209('0x192')]()||'':'',_0xcf14ee[_0x5209('0x193')]>0x0?_0x59a22b['Contact'][_0x5209('0x172')][_0x5209('0x194')](_0xcf14ee[_0x5209('0x193')]):_0x59a22b['Contact'][_0x5209('0x172')]),'callerid':_0x360e9b,'Exten':_0x5209('0xde'),'Context':_0x5209('0x195'),'Priority':'1','variable':_0xf9560c,'timeout':(_0xcf14ee[_0x5209('0x196')]||0x1e)*0x3e8,'async':!![],'channelid':_0x130436})['then'](function(_0x48ae02){return _0x3e3f9c(_0x48ae02);})[_0x5209('0xac')](function(_0x33458f){_0xcf14ee[_0x5209('0x60')]+=0x1;var _0x58db38=new History(_0x2a70c0[_0x5209('0x22')][_0x130436]);logger['error'](util[_0x5209('0x8c')](_0x5209('0x197'),JSON[_0x5209('0x132')](_0x33458f)));_0x58db38[_0x5209('0xa0')]=0xe;_0x58db38[_0x5209('0xa1')]=_0x5209('0x198');_0x58db38['starttime']=moment()[_0x5209('0x8c')](_0x5209('0xff'));_0x58db38[_0x5209('0xa2')]=_0x58db38[_0x5209('0xa3')];_0x2a70c0['createHistory'](_0x58db38)[_0x5209('0xac')](loggerCatch(_0x5209('0x199')));_0x2a70c0[_0x5209('0xc5')](_0x58db38)['catch'](loggerCatch(_0x5209('0x199')))[_0x5209('0x1b')](function(){delete _0x2a70c0[_0x5209('0x22')][_0x130436];return _0x416ad5(msgResponse('originate',_0x5209('0x19a'),_0x5209('0x19b')));});});});};Dialer[_0x5209('0x19')][_0x5209('0x2e')]=function(_0x3af30e){var _0x2e88b7=this[_0x5209('0x22')][_0x3af30e['actionid']];if(_0x2e88b7){delete this[_0x5209('0x22')][_0x3af30e[_0x5209('0x122')]];_0x2e88b7[_0x5209('0x112')]=moment()['format'](_0x5209('0xff'));var _0x5b2165=_0x2e88b7[_0x5209('0x49')]===_0x5209('0x72')?this[_0x5209('0x1e')][_0x2e88b7[_0x5209('0xaf')]]:this[_0x5209('0x1d')][_0x2e88b7[_0x5209('0x19c')]()];if(!this[_0x5209('0xd3')](_0x3af30e[_0x5209('0x19d')])){this[_0x5209('0xae')](_0x5b2165);return this[_0x5209('0x19e')](_0x2e88b7,_0x5b2165,_0x3af30e)[_0x5209('0xac')](loggerCatch(_0x5209('0x19f')));}this[_0x5209('0x24')][_0x3af30e['uniqueid']]=_0x2e88b7;}};Dialer['prototype'][_0x5209('0x1a0')]=function(_0xec9d6a,_0x5cdc52,_0x34f457){var _0xe9317c=new History(_0x5cdc52);if(_0xe9317c[_0x5209('0xec')]+_0xe9317c[_0x5209('0xfd')]+_0xe9317c[_0x5209('0xed')]+_0xe9317c[_0x5209('0xee')]+_0xe9317c['countdropretry']+_0xe9317c[_0x5209('0xf0')]+_0xe9317c['countmachineretry']+_0xe9317c['countagentrejectretry']>=_0x34f457[_0x5209('0xf2')]-0x1){return!![];}switch(_0xec9d6a){case 0x3:if(_0xe9317c[_0x5209('0xed')]>=_0x34f457[_0x5209('0x1a1')]-0x1){return!![];}this[_0x5209('0xbb')]({'active':![],'countnoanswerretry':_0xe9317c[_0x5209('0xed')]+=0x1,'scheduledat':moment()[_0x5209('0xf7')](_0x34f457[_0x5209('0x1a2')],'minutes')['format'](_0x5209('0xff')),'ContactId':_0xe9317c[_0x5209('0xcc')],'ListId':_0xe9317c[_0x5209('0xcd')],'VoiceQueueId':_0xe9317c[_0x5209('0xcf')]||undefined,'CampaignId':_0xe9317c[_0x5209('0xd0')]||undefined})[_0x5209('0xac')](loggerCatch(_0x5209('0x1a3')));break;case 0x5:if(_0xe9317c[_0x5209('0xec')]>=_0x34f457[_0x5209('0x1a4')]-0x1){return!![];}this['rescheduleContact']({'active':![],'countbusyretry':_0xe9317c['countbusyretry']+=0x1,'scheduledat':moment()[_0x5209('0xf7')](_0x34f457[_0x5209('0x1a5')],_0x5209('0xf9'))['format'](_0x5209('0xff')),'ContactId':_0xe9317c[_0x5209('0xcc')],'ListId':_0xe9317c[_0x5209('0xcd')],'VoiceQueueId':_0xe9317c[_0x5209('0xcf')]||undefined,'CampaignId':_0xe9317c[_0x5209('0xd0')]||undefined})['catch'](loggerCatch(_0x5209('0x1a6')));break;case 0x8:if(_0xe9317c[_0x5209('0xfd')]>=_0x34f457[_0x5209('0x1a7')]-0x1){return!![];}this[_0x5209('0xbb')]({'active':![],'countcongestionretry':_0xe9317c['countcongestionretry']+=0x1,'scheduledat':moment()['add'](_0x34f457[_0x5209('0x1a8')],_0x5209('0xf9'))['format'](_0x5209('0xff')),'ContactId':_0xe9317c[_0x5209('0xcc')],'ListId':_0xe9317c['ListId'],'VoiceQueueId':_0xe9317c[_0x5209('0xcf')]||undefined,'CampaignId':_0xe9317c[_0x5209('0xd0')]||undefined})[_0x5209('0xac')](loggerCatch(_0x5209('0x1a9')));break;case 0x0:if(_0xe9317c[_0x5209('0xee')]>=_0x34f457['dialNoSuchNumberMaxRetry']-0x1){return!![];}else{this[_0x5209('0xbb')]({'active':![],'countnosuchnumberretry':_0xe9317c[_0x5209('0xee')]+=0x1,'scheduledat':moment()['add'](_0x34f457[_0x5209('0x1aa')],'minutes')[_0x5209('0x8c')](_0x5209('0xff')),'ContactId':_0xe9317c[_0x5209('0xcc')],'ListId':_0xe9317c[_0x5209('0xcd')],'VoiceQueueId':_0xe9317c['VoiceQueueId']||undefined,'CampaignId':_0xe9317c['CampaignId']||undefined})[_0x5209('0xac')](loggerCatch(_0x5209('0x1ab')));}break;case 0xa:if(_0xe9317c[_0x5209('0xef')]>=_0x34f457['dialDropMaxRetry']-0x1){return!![];}this[_0x5209('0xbb')]({'active':![],'countdropretry':_0xe9317c[_0x5209('0xef')]+=0x1,'scheduledat':moment()[_0x5209('0xf7')](_0x34f457[_0x5209('0x118')],'minutes')[_0x5209('0x8c')](_0x5209('0xff')),'ContactId':_0xe9317c['ContactId'],'ListId':_0xe9317c[_0x5209('0xcd')],'VoiceQueueId':_0xe9317c[_0x5209('0xcf')]||undefined,'CampaignId':_0xe9317c[_0x5209('0xd0')]||undefined})[_0x5209('0xac')](loggerCatch(_0x5209('0x119')));break;case 0xb:if(_0xe9317c['countabandonedretry']>=_0x34f457['dialAbandonedMaxRetry']-0x1){return!![];}this[_0x5209('0xbb')]({'active':![],'countabandonedretry':_0xe9317c[_0x5209('0xf0')]+=0x1,'scheduledat':moment()[_0x5209('0xf7')](_0x34f457[_0x5209('0x11f')],'minutes')[_0x5209('0x8c')](_0x5209('0xff')),'ContactId':_0xe9317c['ContactId'],'ListId':_0xe9317c[_0x5209('0xcd')],'VoiceQueueId':_0xe9317c[_0x5209('0xcf')]||undefined,'CampaignId':_0xe9317c[_0x5209('0xd0')]||undefined})['catch'](loggerCatch(_0x5209('0x120')));break;case 0x13:if(_0xe9317c[_0x5209('0xe8')]>=_0x34f457[_0x5209('0xfe')]-0x1){return!![];}this[_0x5209('0xbb')]({'active':![],'countmachineretry':_0xe9317c['countmachineretry']+=0x1,'scheduledat':moment()[_0x5209('0xf7')](_0x34f457[_0x5209('0xf8')],'minutes')['format'](_0x5209('0xff')),'ContactId':_0xe9317c[_0x5209('0xcc')],'ListId':_0xe9317c[_0x5209('0xcd')],'VoiceQueueId':_0xe9317c[_0x5209('0xcf')]||undefined,'CampaignId':_0xe9317c[_0x5209('0xd0')]||undefined})[_0x5209('0xac')](loggerCatch(_0x5209('0x1ac')));break;case 0x14:if(_0xe9317c[_0x5209('0xf1')]>=_0x34f457[_0x5209('0x1ad')]-0x1){return!![];}this['rescheduleContact']({'active':![],'countagentrejectretry':_0xe9317c[_0x5209('0xf1')]+=0x1,'scheduledat':moment()[_0x5209('0xf7')](_0x34f457['dialAgentRejectRetryFrequency'],_0x5209('0xf9'))[_0x5209('0x8c')](_0x5209('0xff')),'ContactId':_0xe9317c['ContactId'],'ListId':_0xe9317c[_0x5209('0xcd')],'VoiceQueueId':_0xe9317c[_0x5209('0xcf')]||undefined,'CampaignId':_0xe9317c[_0x5209('0xd0')]||undefined})['catch'](loggerCatch(_0x5209('0x1ae')));break;default:return!![];}};Dialer[_0x5209('0x19')][_0x5209('0x19e')]=function(_0x42462e,_0x5e404e,_0x7e9489){var _0x49c547=this;var _0x2bbd63=new History(_0x42462e);return new BPromise(function(_0x1fc328,_0x4506ee){if(_[_0x5209('0x3b')](_0x5e404e)&&typeof _0x5e404e!==_0x5209('0x16e')){return _0x4506ee(msgResponse(_0x5209('0x1af'),_0x5209('0x140'),'entity\x20is\x20undefine'));}if(_[_0x5209('0x3b')](_0x7e9489)&&typeof _0x7e9489!==_0x5209('0x16e')){return _0x4506ee(msgResponse(_0x5209('0x1af'),_0x5209('0x140'),_0x5209('0x1b0')));}switch(_0x7e9489[_0x5209('0x1b1')]){case'0':_0x5e404e[_0x5209('0x1b2')]+=0x1;_0x2bbd63[_0x5209('0xa0')]=0x0;_0x2bbd63[_0x5209('0xa1')]=_0x5209('0x1b3');_0x2bbd63[_0x5209('0xee')]+=0x1;_0x2bbd63[_0x5209('0xfc')]+=0x1;ami[_0x5209('0x48')](_0x5209('0x1b4'),ut[_0x5209('0xea')](_0x42462e,_0x5209('0x1b5')));_0x49c547['createHistory'](_0x2bbd63)[_0x5209('0xac')](loggerCatch(_0x5209('0xeb')));if(_0x49c547[_0x5209('0x1a0')](0x0,_0x42462e,_0x5e404e)){if(_0x2bbd63[_0x5209('0xee')]>=_0x5e404e[_0x5209('0x1b6')]){_0x49c547[_0x5209('0xf5')](_0x2bbd63,_0x1fc328,_0x4506ee,_0x5209('0x1b7'));}else{_0x49c547['stateGlobal'](_0x2bbd63,_0x1fc328,_0x4506ee,_0x5209('0x1b7'));}}break;case'3':_0x5e404e['outboundNoAnswerCallsDay']+=0x1;_0x2bbd63[_0x5209('0xa0')]=0x3;_0x2bbd63[_0x5209('0xa1')]=_0x5209('0x1b8');_0x2bbd63[_0x5209('0xed')]+=0x1;_0x2bbd63[_0x5209('0xfc')]+=0x1;ami[_0x5209('0x48')](_0x5209('0x1b9'),ut[_0x5209('0xea')](_0x42462e,_0x5209('0x1ba')));_0x49c547[_0x5209('0xc7')](_0x2bbd63)['catch'](loggerCatch(_0x5209('0x1bb')));if(_0x49c547[_0x5209('0x1a0')](0x3,_0x42462e,_0x5e404e)){if(_0x2bbd63[_0x5209('0xed')]>=_0x5e404e['dialNoAnswerMaxRetry']){_0x49c547[_0x5209('0xf5')](_0x2bbd63,_0x1fc328,_0x4506ee,'reason\x203\x20ringing\x20no\x20answer');}else{_0x49c547[_0x5209('0xf3')](_0x2bbd63,_0x1fc328,_0x4506ee,_0x5209('0x1bc'));}}break;case'5':_0x5e404e[_0x5209('0x5c')]+=0x1;_0x2bbd63[_0x5209('0xa0')]=0x5;_0x2bbd63[_0x5209('0xa1')]=_0x5209('0x1bd');_0x2bbd63['countbusyretry']+=0x1;_0x2bbd63[_0x5209('0xfc')]+=0x1;ami['emit'](_0x5209('0x1be'),ut[_0x5209('0xea')](_0x42462e,'busy'));_0x49c547[_0x5209('0xc7')](_0x2bbd63)[_0x5209('0xac')](loggerCatch(_0x5209('0x1bf')));if(_0x49c547[_0x5209('0x1a0')](0x5,_0x42462e,_0x5e404e)){if(_0x2bbd63[_0x5209('0xec')]>=_0x5e404e[_0x5209('0x1a4')]){_0x49c547[_0x5209('0xf5')](_0x2bbd63,_0x1fc328,_0x4506ee,_0x5209('0x1c0'));}else{_0x49c547['stateGlobal'](_0x2bbd63,_0x1fc328,_0x4506ee,'reason\x205\x20busy');}}break;case'8':_0x5e404e[_0x5209('0x1c1')]+=0x1;_0x2bbd63[_0x5209('0xa0')]=0x8;_0x2bbd63[_0x5209('0xa1')]=_0x5209('0x1c2');_0x2bbd63['countcongestionretry']+=0x1;_0x2bbd63['countglobal']+=0x1;ami[_0x5209('0x48')](_0x5209('0x1c3'),ut['buildObj'](_0x42462e,_0x5209('0x1c4')));_0x49c547[_0x5209('0xc7')](_0x2bbd63)[_0x5209('0xac')](loggerCatch(_0x5209('0x1c5')));if(_0x49c547['checkRetriveMax'](0x8,_0x42462e,_0x5e404e)){if(_0x2bbd63[_0x5209('0xfd')]>=_0x5e404e['dialCongestionMaxRetry']){_0x49c547[_0x5209('0xf5')](_0x2bbd63,_0x1fc328,_0x4506ee,'reason\x208\x20congestion');}else{_0x49c547[_0x5209('0xf3')](_0x2bbd63,_0x1fc328,_0x4506ee,_0x5209('0x1c6'));}}break;case'11':_0x5e404e['outboundAbandonedCallsDay']+=0x1;_0x2bbd63['state']=0xb;_0x2bbd63[_0x5209('0xa1')]='Abandoned';_0x2bbd63[_0x5209('0xf0')]+=0x1;_0x2bbd63[_0x5209('0xfc')]+=0x1;_0x49c547[_0x5209('0xc7')](_0x2bbd63)[_0x5209('0xac')](loggerCatch(_0x5209('0x121')));if(_0x49c547[_0x5209('0x1a0')](0xb,_0x42462e,_0x5e404e)){if(_0x2bbd63[_0x5209('0xf0')]>=_0x5e404e[_0x5209('0x11e')]){_0x49c547['createStateFinal'](_0x2bbd63,_0x1fc328,_0x4506ee,_0x5209('0x1c7'));}else{_0x49c547[_0x5209('0xf3')](_0x2bbd63,_0x1fc328,_0x4506ee,_0x5209('0x1c7'));}}break;case'20':_0x5e404e[_0x5209('0x1c8')]+=0x1;_0x2bbd63[_0x5209('0xa0')]=0x14;_0x2bbd63[_0x5209('0xa1')]=_0x5209('0x1c9');_0x2bbd63['countagentrejectretry']+=0x1;_0x2bbd63[_0x5209('0xfc')]+=0x1;ami[_0x5209('0x48')](_0x5209('0x1ca'),ut[_0x5209('0xea')](_0x42462e,_0x5209('0x1cb')));_0x49c547[_0x5209('0xc7')](_0x2bbd63)['catch'](loggerCatch('[syncAgentComplete][createHistory][20]'));if(_0x49c547['checkRetriveMax'](0x14,_0x42462e,_0x5e404e)){if(_0x2bbd63[_0x5209('0xf1')]>=_0x5e404e['dialAgentRejectMaxRetry']){_0x49c547['createStateFinal'](_0x2bbd63,_0x1fc328,_0x4506ee,_0x5209('0x1cc'));}else{_0x49c547[_0x5209('0xf3')](_0x2bbd63,_0x1fc328,_0x4506ee,_0x5209('0x1cc'));}}break;default:_0x5e404e[_0x5209('0x106')]+=0x1;_0x2bbd63[_0x5209('0xa0')]=0xc;_0x2bbd63[_0x5209('0xa1')]=_0x7e9489[_0x5209('0x1b1')];_0x49c547['createHistory'](_0x2bbd63)[_0x5209('0xac')](loggerCatch(_0x5209('0x1cd')));if(_0x49c547[_0x5209('0x1a0')](_0x7e9489['reason'],_0x42462e,_0x5e404e)){if(_0x2bbd63['countbusyretry']+_0x2bbd63[_0x5209('0xfd')]+_0x2bbd63[_0x5209('0xed')]+_0x2bbd63[_0x5209('0xee')]+_0x2bbd63[_0x5209('0xef')]+_0x2bbd63[_0x5209('0xf0')]+_0x2bbd63[_0x5209('0xe8')]+_0x2bbd63[_0x5209('0xf1')]>=_0x5e404e[_0x5209('0xf2')]){_0x49c547[_0x5209('0xf3')](_0x2bbd63,_0x1fc328,_0x4506ee,_0x7e9489[_0x5209('0x1b1')]);}else{_0x49c547[_0x5209('0xf5')](_0x2bbd63,_0x1fc328,_0x4506ee,_0x7e9489[_0x5209('0x1b1')]);}}}});};Dialer[_0x5209('0x19')][_0x5209('0xf3')]=function(_0x4377c0,_0x2968e1,_0x3b9447,_0xeb0bb0){var _0x4c8c30=new Final(_0x4377c0);_0x4c8c30[_0x5209('0xa0')]=0xf;_0x4c8c30[_0x5209('0xa1')]=_0x5209('0x1ce');this[_0x5209('0xf5')](_0x4c8c30,_0x2968e1,_0x3b9447,_0xeb0bb0);};Dialer[_0x5209('0x19')]['createStateFinal']=function(_0x835a5e,_0x30a12d,_0x287b23,_0xa9ab8e){this['moveContactManagedDialer'](_0x835a5e)['then'](function(){return _0x30a12d(msgResponse('[callProgressDetecting]',_0x5209('0xd4'),_0xa9ab8e));})[_0x5209('0xac')](function(){return _0x287b23(msgResponse(_0x5209('0x1cf'),_0x5209('0x140'),'contact\x20not\x20moved'));});};Dialer[_0x5209('0x19')][_0x5209('0x8')]=function(_0x5cf7d7){var _0x58a865=_0x5cf7d7[_0x5209('0x1d0')]/0x64;var _0x57b461=_0x5cf7d7[_0x5209('0x5f')]/(_0x5cf7d7[_0x5209('0x5f')]+_0x5cf7d7['outboundAnswerCallsDay']);var _0x2b3c1e=Math[_0x5209('0x1d1')](_0x5cf7d7['predictiveIntervalAvailable']*(_0x5cf7d7['predictiveIntervalMaxThreshold']/0x64));var _0x25539b=Math[_0x5209('0x1d1')](_0x5cf7d7[_0x5209('0x69')]*(_0x5cf7d7[_0x5209('0x1d2')]/0x64));var _0x2a4417=_0x5cf7d7[_0x5209('0x4d')]+_0x5cf7d7[_0x5209('0x9b')];var _0x2b24a7=Math[_0x5209('0x1d3')](_0x5cf7d7[_0x5209('0x6a')]*_0x5cf7d7[_0x5209('0x6c')]*_0x5cf7d7[_0x5209('0x67')]*_0x5cf7d7[_0x5209('0x1d4')]);if(_[_0x5209('0x3b')](_0x5cf7d7['startProgressive'])){if(!_[_0x5209('0x3b')](_0x5cf7d7[_0x5209('0x26')])){_0x5cf7d7[_0x5209('0x26')]=undefined;loggerPredictive[_0x5209('0x8e')](_0x5209('0x1d5'),'check\x20predictive\x20is\x20not\x20undefine');}if(!_[_0x5209('0x3b')](_0x5cf7d7[_0x5209('0x88')])){loggerPredictive[_0x5209('0x8e')](_0x5209('0x1d5'),_0x5209('0x1d6'));clearInterval(_0x5cf7d7[_0x5209('0x88')]);_0x5cf7d7[_0x5209('0x88')]=undefined;}_0x5cf7d7[_0x5209('0x85')]=moment()['format'](_0x5209('0xff'));loggerPredictive[_0x5209('0x75')](_0x5cf7d7[_0x5209('0x3e')],_0x5209('0x1d7'),_0x5cf7d7[_0x5209('0x85')]);this[_0x5209('0x156')](_0x5cf7d7,0x1);}else if(ifInterval(_0x5cf7d7[_0x5209('0x1d8')],_0x5cf7d7[_0x5209('0x85')])){this[_0x5209('0x156')](_0x5cf7d7,0x1);loggerPredictiveCalls['info']('[startMethodPredictive][StartProgressive][Loop]',_0x5cf7d7[_0x5209('0x85')],_0x5cf7d7[_0x5209('0x3e')]);_0x5cf7d7[_0x5209('0x6a')]=0x0;_0x5cf7d7[_0x5209('0x114')]=0x0;}else if(_0x58a865<_0x57b461&&_0x5cf7d7['dialPredictiveOptimization']===_0x5209('0x1d9')){freeVariablesPredictive(_0x5cf7d7);loggerPredictive['info'](_0x5209('0x1da'),'Dropped\x20calls\x20day',_0x57b461,'startProgressive',_0x5cf7d7[_0x5209('0x3e')]);}else if(_0x2b24a7<_0x5cf7d7['predictiveIntervalErlangCallsDroppedCalls']&&_0x5cf7d7[_0x5209('0x1db')]===_0x5209('0x1d9')){freeVariablesPredictive(_0x5cf7d7);loggerPredictive[_0x5209('0x75')](_0x5209('0x1dc'),_0x5209('0x1dd'),_0x2b24a7,'Drop\x20in\x20this\x20interval',_0x5cf7d7[_0x5209('0x114')],_0x5209('0x85'),_0x5cf7d7[_0x5209('0x3e')]);}else if(!ifInterval(_0x5cf7d7['dialPredictiveInterval'],_0x5cf7d7[_0x5209('0x85')])&&_[_0x5209('0x3b')](_0x5cf7d7[_0x5209('0x26')])&&!_[_0x5209('0x3b')](_0x5cf7d7[_0x5209('0x85')])){_0x5cf7d7['startPredictive']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive['info'](_0x5cf7d7['name'],_0x5209('0x1de'),_0x5cf7d7[_0x5209('0x26')]);this['averageHandleTime'](_0x5cf7d7[_0x5209('0x1d8')])[_0x5209('0xb4')](this[_0x5209('0x1df')](_0x5cf7d7))[_0x5209('0xb4')](mergeDataErlangB(_0x5cf7d7))[_0x5209('0xb4')](this['startMethodPredictive'](_0x5cf7d7))[_0x5209('0xac')](loggerCatchPredictive(_0x5209('0x1e0'),_0x5cf7d7));}else if(!ifInterval(_0x5cf7d7[_0x5209('0x1d8')],_0x5cf7d7['startPredictive'])){_0x5cf7d7['predictiveIntervalErlangCallsDroppedCalls']=0x0;_0x5cf7d7['startPredictive']=moment()['format'](_0x5209('0xff'));loggerPredictive[_0x5209('0x75')](_0x5cf7d7[_0x5209('0x3e')],_0x5209('0x1e1'),_0x5cf7d7['startPredictive']);clearInterval(_0x5cf7d7[_0x5209('0x88')]);_0x5cf7d7[_0x5209('0x88')]=undefined;this[_0x5209('0x1e2')](_0x5cf7d7['dialPredictiveInterval'])[_0x5209('0xb4')](this['getDataPredictive'](_0x5cf7d7))[_0x5209('0xb4')](mergeDataErlangB(_0x5cf7d7))[_0x5209('0xb4')](this['startMethodPredictive'](_0x5cf7d7))[_0x5209('0xac')](loggerCatchPredictive(_0x5209('0x1e3'),_0x5cf7d7));}else if(_0x5cf7d7[_0x5209('0x69')]&&_0x2a4417<_0x5cf7d7[_0x5209('0x69')]-_0x25539b){freeVariablesPredictive(_0x5cf7d7);loggerPredictive['info'](_0x5cf7d7['name'],'switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',_0x2a4417,')\x20are\x20less\x20than\x20threshold\x20(',_0x5cf7d7['predictiveIntervalAvailable'],'-',_0x25539b,'=',_0x5cf7d7['predictiveIntervalAvailable']-_0x25539b,')');}else if(_0x5cf7d7[_0x5209('0x69')]&&_0x2a4417>_0x5cf7d7[_0x5209('0x69')]+_0x2b3c1e){freeVariablesPredictive(_0x5cf7d7);loggerPredictive[_0x5209('0x75')](_0x5cf7d7[_0x5209('0x3e')],_0x5209('0x1e4'),_0x2a4417,_0x5209('0x1e5'),_0x5cf7d7[_0x5209('0x69')],'+',_0x2b3c1e,'=',_0x5cf7d7[_0x5209('0x69')]+_0x2b3c1e,')');}};Dialer[_0x5209('0x19')][_0x5209('0x1df')]=function(_0x2daccd){var _0x5df5f6=this;return function(_0xced56a){return new BPromise(function(_0x2243f9,_0x3156d7){_['merge'](_0x2daccd,_0xced56a[0x0]);if(checkGetDataPredictive(_0xced56a[0x0])){var _0x14737e=_0x2daccd['predictiveIntervalAvailable']=_0x2daccd[_0x5209('0x9b')]+_0x2daccd[_0x5209('0x4d')];var _0x25a08d=_0x2daccd[_0x5209('0x1d8')]*0x3c;var _0x23da9b=_0xced56a[0x0][_0x5209('0x7a')]+_0xced56a[0x0][_0x5209('0x63')];var _0x2d4692=(_0xced56a[0x0]['predictiveIntervalAnsweredCalls']+_0xced56a[0x0][_0x5209('0x65')]+_0xced56a[0x0][_0x5209('0x64')])/_0xced56a[0x0]['predictiveIntervalTotalCalls'];_0x2daccd[_0x5209('0x67')]=_0x2d4692>0x0?_0x2d4692:0x1;switch(_0x2daccd[_0x5209('0x1db')]){case'dropRate':var _0x3fdc07=_0x2daccd[_0x5209('0x1d0')]/0x64;return _0x5df5f6[_0x5209('0x1e6')](_0x14737e,_0x25a08d,_0x23da9b,_0x2d4692,_0x3fdc07)[_0x5209('0xb4')](function(_0x15bd2a){return _0x2243f9(_0x15bd2a);});case _0x5209('0x1e7'):var _0x6b8c60=_0x2daccd[_0x5209('0x1d0')]/0x64;return _0x5df5f6['busyFactor'](_0x14737e,_0x25a08d,_0x23da9b,_0x2d4692,_0x6b8c60)[_0x5209('0xb4')](function(_0x503ede){return _0x2243f9(_0x503ede);});default:return _0x3156d7(msgResponse(_0x5209('0x1e8'),_0x5209('0x140'),_0x5209('0x1e9')));}}else{return _0x3156d7(msgResponse(_0x5209('0x1e8'),_0x5209('0x140'),_0x5209('0x1ea')));}});};};Dialer['prototype'][_0x5209('0x1eb')]=function(_0x5250a5){var _0x3f08dc=this;return function(_0x3bf9f5){return new BPromise(function(_0x40006c,_0x5aa7f5){_[_0x5209('0x83')](_0x5250a5,_0x3bf9f5[0x0]);if(checkGetDataPredictive(_0x3bf9f5[0x0])){loggerPredictive[_0x5209('0x75')](JSON[_0x5209('0x132')](_0x3bf9f5[0x0]));if(_0x5250a5[_0x5209('0x1db')]===_0x5209('0x1d9')){return _0x3f08dc[_0x5209('0xc3')](_0x5250a5['id'])[_0x5209('0xb4')](function(_0x431d98){var _0x4f7396=_0x5250a5[_0x5209('0x4e')]-_0x431d98[0x0][_0x5209('0x1ec')];var _0x5d87b6=_0x5250a5['dialPredictiveInterval']*0x3c;var _0x567b6a=_0x3bf9f5[0x0][_0x5209('0x7a')]+_0x3bf9f5[0x0][_0x5209('0x63')];var _0x5470d0=(_0x3bf9f5[0x0]['predictiveIntervalAnsweredCalls']+_0x3bf9f5[0x0][_0x5209('0x65')]+_0x3bf9f5[0x0][_0x5209('0x64')])/_0x3bf9f5[0x0][_0x5209('0x77')];var _0x1d9ce5=_0x5250a5[_0x5209('0x1d0')]/0x64;_0x5250a5['predictiveIntervalPauses']=_0x431d98[0x0]['outboundQueuePauses']||0x0;_0x5250a5[_0x5209('0x67')]=_0x5470d0>0x0?_0x5470d0:0x1;return _0x3f08dc['abandonmentRate'](_0x4f7396,_0x5d87b6,_0x567b6a,_0x5470d0,_0x1d9ce5);})['then'](function(_0x5ec489){return _0x40006c(_0x5ec489);})[_0x5209('0xac')](function(_0x16815e){return _0x5aa7f5(msgResponse(_0x5209('0x1ed'),_0x5209('0x140'),JSON[_0x5209('0x132')](_0x16815e)));});}if(_0x5250a5[_0x5209('0x1db')]===_0x5209('0x1e7')){return _0x3f08dc[_0x5209('0xc3')](_0x5250a5['id'])['then'](function(_0x55bef4){var _0x37e6b8=_0x5250a5['loggedIn']-_0x55bef4[0x0][_0x5209('0x1ec')];var _0x8ab518=_0x5250a5[_0x5209('0x1d8')]*0x3c;var _0x1af6c8=_0x3bf9f5[0x0][_0x5209('0x7a')]+_0x3bf9f5[0x0]['predictiveIntervalAvgHoldtime'];var _0x485f0b=(_0x3bf9f5[0x0][_0x5209('0x62')]+_0x3bf9f5[0x0][_0x5209('0x65')]+_0x3bf9f5[0x0][_0x5209('0x64')])/_0x3bf9f5[0x0]['predictiveIntervalTotalCalls'];var _0x4592aa=_0x5250a5[_0x5209('0x1d0')]/0x64;_0x5250a5[_0x5209('0x68')]=_0x55bef4[0x0][_0x5209('0x1ec')]||0x0;_0x5250a5[_0x5209('0x67')]=_0x485f0b>0x0?_0x485f0b:0x1;return _0x3f08dc[_0x5209('0x1ee')](_0x37e6b8,_0x8ab518,_0x1af6c8,_0x485f0b,_0x4592aa);})[_0x5209('0xb4')](function(_0xf639a3){return _0x40006c(_0xf639a3);})[_0x5209('0xac')](function(_0x4bd177){return _0x5aa7f5(msgResponse(_0x5209('0x1ed'),'Failure',JSON['stringify'](_0x4bd177)));});}}else{return _0x5aa7f5(msgResponse('[getDataPredictive]',_0x5209('0x140'),'check\x20failure'));}});};};Dialer[_0x5209('0x19')][_0x5209('0x1ef')]=function(_0x10c21e){var _0x2e7574=this;return function(){var _0x43f380=0x0;var _0x27dadc=Math[_0x5209('0x1d3')](_0x10c21e[_0x5209('0x6b')]*0x3e8);if(_0x27dadc>0x0){_0x27dadc=_0x27dadc<0x64?0x64:_0x27dadc;loggerPredictive[_0x5209('0x75')](_0x10c21e[_0x5209('0x3e')],_0x5209('0x1f0'),_0x27dadc,_0x5209('0x46'));_0x10c21e['handlePredictive']=setInterval(function(){_0x2e7574[_0x5209('0x88')](_0x10c21e);loggerPredictiveCalls[_0x5209('0x75')](_0x5209('0x1f1'),_0x43f380+=0x1);},_0x27dadc);}else{loggerPredictive['info'](_0x10c21e[_0x5209('0x3e')],_0x5209('0x1f2'));}};};Dialer['prototype']['checkContactBlack']=function(_0x2de1f8,_0x445459){var _0x53dace=this;return function(_0x3c3302){if(_[_0x5209('0x74')](_0x3c3302)){if(_['isNil'](_0x445459[_0x5209('0xce')])||!_0x445459[_0x5209('0x1f3')]){if(_0x2de1f8[_0x5209('0x56')]==='booked'){_0x2de1f8[_0x5209('0x128')]=_['isUndefined'](_0x2de1f8['queueStatusComplete'])?!![]:_0x2de1f8[_0x5209('0x128')];var _0x35cafe=uuid['v4']();_0x53dace[_0x5209('0x22')][_0x35cafe]=new Action(_0x2de1f8,_0x445459,_0x35cafe);loggerBooked[_0x5209('0x75')](_0x5209('0x1f4'),_0x35cafe,_0x5209('0x1f5'),JSON['stringify'](_0x2de1f8[_0x5209('0x128')]),_0x5209('0x1f6'),_0x2de1f8[_0x5209('0x3e')]);if(_0x2de1f8[_0x5209('0x128')]){_0x2de1f8[_0x5209('0x128')]=![];_0x53dace[_0x5209('0x28')][_0x53dace[_0x5209('0x22')][_0x35cafe]['queue']]=[];ami[_0x5209('0xaa')]({'actionid':_0x35cafe,'action':'queuestatus','queue':_0x2de1f8[_0x5209('0x3e')]})[_0x5209('0xac')](function(){_0x53dace['updateOriginated'](_0x2de1f8);_0x53dace[_0x5209('0xbb')]({'active':![],'ContactId':_0x53dace[_0x5209('0x22')][_0x35cafe]['ContactId'],'ListId':_0x53dace[_0x5209('0x22')][_0x35cafe][_0x5209('0xcd')],'VoiceQueueId':_0x53dace[_0x5209('0x22')][_0x35cafe][_0x5209('0xcf')]||undefined,'CampaignId':_0x53dace[_0x5209('0x22')][_0x35cafe][_0x5209('0xd0')]||undefined})[_0x5209('0xac')](loggerCatch(_0x5209('0x1f7')));delete _0x53dace[_0x5209('0x22')][_0x35cafe];});}else{loggerBooked[_0x5209('0x75')](_0x5209('0x1f8'),JSON['stringify'](_0x2de1f8[_0x5209('0x128')]),_0x5209('0x1f6'),_0x2de1f8[_0x5209('0x3e')]);_0x53dace[_0x5209('0xae')](_0x2de1f8);_0x53dace[_0x5209('0xbb')]({'active':![],'ContactId':_0x53dace[_0x5209('0x22')][_0x35cafe][_0x5209('0xcc')],'ListId':_0x53dace['actions'][_0x35cafe]['ListId'],'VoiceQueueId':_0x53dace[_0x5209('0x22')][_0x35cafe][_0x5209('0xcf')]||undefined,'CampaignId':_0x53dace[_0x5209('0x22')][_0x35cafe][_0x5209('0xd0')]||undefined})[_0x5209('0xac')](loggerCatch(_0x5209('0x1f7')));delete _0x53dace['actions'][_0x35cafe];}}else{return _0x53dace['actionOriginate'](_0x2de1f8,_0x445459);}}else{if(getDiff(_0x445459['scheduledat'])<_0x2de1f8[_0x5209('0x1f9')]*0x3c){if(_0x445459[_0x5209('0x15d')]&&!_0x445459[_0x5209('0x15d')][_0x5209('0x1fa')]){_0x53dace['preview'][_0x5209('0x134')](_0x445459['id'])['finally'](function(){_0x53dace['updateOriginated'](_0x2de1f8);});}else{_0x53dace[_0x5209('0xbd')]({'active':![]},_0x445459['id'],0x1)[_0x5209('0x1b')](function(){_0x53dace[_0x5209('0xae')](_0x2de1f8);});}}else{_0x2de1f8[_0x5209('0x61')]+=0x1;_0x53dace[_0x5209('0xae')](_0x2de1f8);if(_0x2de1f8[_0x5209('0x1fb')]){_0x53dace[_0x5209('0xbb')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0x445459[_0x5209('0xcc')],'ListId':_0x445459[_0x5209('0xcd')],'VoiceQueueId':_0x445459[_0x5209('0xcf')]||undefined,'CampaignId':_0x445459['CampaignId']||undefined})['catch'](loggerCatch(_0x5209('0x1fc')));_0x53dace['createHistory'](createObjHistory(_0x2de1f8,_0x445459,_0x5209('0x1fd'),0x17,_0x5209('0x1fe')))['catch'](loggerCatch(_0x5209('0x1ff')));}else{_0x53dace[_0x5209('0xda')](createObjHistory(_0x2de1f8,_0x445459,_0x5209('0x200'),0x16,_0x5209('0x201')),_0x5209('0x202'),_0x5209('0x203'));}}}}else{_0x2de1f8[_0x5209('0x5b')]+=0x1;_0x53dace['saveInDb'](createObjHistory(_0x2de1f8,_0x445459,_0x5209('0x204'),0xd,_0x5209('0x205')),_0x5209('0x206'),_0x5209('0x207'));throw _0x5209('0x208');}};};Dialer[_0x5209('0x19')][_0x5209('0x209')]=function(_0x358c59){var _0x48aaa3=this;var _0x44af27=_0x358c59[_0x5209('0x20a')]-_0x358c59[_0x5209('0x91')]-_0x358c59['temp'];emitCampaignSummary(_0x358c59);if(_0x44af27>0x0){if(_0x44af27>this[_0x5209('0x20b')]){_0x44af27=this['maxNumberOriginate'];}_0x358c59['temp']+=_0x44af27;this[_0x5209('0xc1')](_0x358c59['id'],_0x44af27,_0x358c59['dialOrderByScheduledAt'],_0x358c59)[_0x5209('0xb4')](function(_0x36fcf9){_0x358c59['temp']-=_0x44af27;_0x358c59[_0x5209('0xc0')]=_0x358c59[_0x5209('0xc0')]>0x0?_0x358c59['temp']:0x0;if(!checkContactEmpty(_0x36fcf9)){_0x358c59[_0x5209('0x3c')]=_0x5209('0x98');logger[_0x5209('0x75')](_0x5209('0x20c')+_0x358c59[_0x5209('0x3e')]);}else{_0x358c59['originated']+=_0x36fcf9[_0x5209('0x12e')];_0x358c59[_0x5209('0x3c')]=_0x5209('0x20d');for(var _0x403bdc=0x0;_0x403bdc<_0x36fcf9[_0x5209('0x12e')];_0x403bdc+=0x1){_0x358c59['ivrTotalCallsDays']+=0x1;if(_['isNil'](_0x36fcf9[_0x403bdc])||_[_0x5209('0xa9')](_0x36fcf9[_0x403bdc][_0x5209('0x171')])||_['isNil'](_0x36fcf9[_0x403bdc][_0x5209('0x171')]['phone'])){_0x48aaa3[_0x5209('0xc9')]('[actionOriginate]\x20',_0x358c59,_0x36fcf9[_0x403bdc]);}else{_0x48aaa3['checkIsBlackListIvr'](_[_0x5209('0xcb')](_0x36fcf9[_0x403bdc],['CampaignId','Contact.phone']))[_0x5209('0xb4')](_0x48aaa3['checkContactBlack'](_0x358c59,_0x36fcf9[_0x403bdc]))[_0x5209('0xac')](_0x48aaa3['loggerHandler'](_0x5209('0x20e'),_0x358c59));}}}})[_0x5209('0xac')](loggerGetContactDialer(_0x5209('0x20f'),_0x358c59,_0x44af27));}};Dialer['prototype'][_0x5209('0x156')]=function(_0x383b64,_0x4cbb48){var _0x5c0512=this;var _0x4a0f61=[];var _0x1d54a8=_0x4cbb48>=0x1?_0x4cbb48:0x1;if(_0x383b64[_0x5209('0x56')]===_0x5209('0x158')){_0x1d54a8=0x1;}var _0x4eb715=Math['floor'](_0x383b64['available']*_0x1d54a8)-_0x383b64[_0x5209('0x91')]-_0x383b64[_0x5209('0xc0')];emitVoiceQueueSummary(_0x383b64);if(_0x383b64[_0x5209('0x210')]>0x0){var _0x1397c6=_0x383b64[_0x5209('0x210')]-_0x383b64[_0x5209('0x91')]-_0x383b64[_0x5209('0x9b')]-_0x383b64[_0x5209('0xc0')]-_0x383b64[_0x5209('0x4f')];if(_0x4eb715>_0x1397c6){_0x4eb715=_0x1397c6;}}if(_0x4eb715>0x0){if(_0x383b64[_0x5209('0x56')]===_0x5209('0x158')){_0x4eb715=0x1;}if(_0x4eb715>this[_0x5209('0x20b')]){_0x4eb715=this[_0x5209('0x20b')];}_0x383b64['temp']+=_0x4eb715;for(var _0xb83967 in this['agents']){if(typeof this[_0x5209('0x1f')][_0xb83967]!==_0x5209('0x92')){if(this[_0x5209('0x1f')][_0xb83967][_0x5209('0xa0')]==='not_inuse'&&this[_0x5209('0x1f')][_0xb83967]['status']==='reachable'){_0x4a0f61['push'](this['agents'][_0xb83967]['id']);}}}this[_0x5209('0xbf')](_0x383b64['id'],_0x4a0f61,_0x4eb715,_0x383b64[_0x5209('0x211')],_0x383b64)[_0x5209('0xb4')](function(_0x1df8dd){_0x383b64[_0x5209('0xc0')]-=_0x4eb715;_0x383b64[_0x5209('0xc0')]=_0x383b64[_0x5209('0xc0')]>0x0?_0x383b64[_0x5209('0xc0')]:0x0;if(!checkContactEmpty(_0x1df8dd)){_0x5c0512[_0x5209('0xb2')](_0x383b64)[_0x5209('0xb4')](sendMessageReschedule(_0x383b64))['catch'](loggerCatch(_0x5209('0xb5')));}else{_0x383b64[_0x5209('0x91')]+=_0x1df8dd[_0x5209('0x12e')];_0x383b64[_0x5209('0x3c')]=_0x383b64[_0x5209('0x56')]==='booked'?_0x5209('0x212'):_0x5209('0x20d');for(var _0x1880bc=0x0;_0x1880bc<_0x1df8dd[_0x5209('0x12e')];_0x1880bc+=0x1){if(_[_0x5209('0xa9')](_0x1df8dd[_0x1880bc])||_[_0x5209('0xa9')](_0x1df8dd[_0x1880bc][_0x5209('0x171')])||_[_0x5209('0xa9')](_0x1df8dd[_0x1880bc][_0x5209('0x171')][_0x5209('0x172')])){_0x5c0512[_0x5209('0xc9')](_0x5209('0x213'),_0x383b64,_0x1df8dd[_0x1880bc]);}else{_0x5c0512['checkIsBlackList'](_[_0x5209('0xcb')](_0x1df8dd[_0x1880bc],[_0x5209('0xcf'),'Contact.phone']))[_0x5209('0xb4')](_0x5c0512[_0x5209('0x214')](_0x383b64,_0x1df8dd[_0x1880bc]))['catch'](_0x5c0512[_0x5209('0x215')](_0x5209('0x213'),_0x383b64));}}}})['catch'](loggerGetContactDialer(_0x5209('0x216'),_0x383b64,_0x4eb715));}};Dialer[_0x5209('0x19')][_0x5209('0x88')]=function(_0xecb846){if(_0xecb846[_0x5209('0x210')]>0x0){var _0xabf9c4=_0xecb846[_0x5209('0x210')]-_0xecb846[_0x5209('0x91')]-_0xecb846[_0x5209('0x9b')];if(_0xabf9c4>0x0){this[_0x5209('0x217')](_0xecb846);}else{loggerPredictiveCalls['info'](_0x5209('0x218'));}}else{this[_0x5209('0x217')](_0xecb846);}};Dialer[_0x5209('0x19')][_0x5209('0x217')]=function(_0x5f3ccf){var _0xd0e243=this;var _0x12872a=[];_0x5f3ccf[_0x5209('0x91')]+=0x1;for(var _0x3a1617 in this[_0x5209('0x1f')]){if(typeof this['agents'][_0x3a1617]!==_0x5209('0x92')){if(this[_0x5209('0x1f')][_0x3a1617]['state']===_0x5209('0x219')&&this[_0x5209('0x1f')][_0x3a1617][_0x5209('0xd7')]===_0x5209('0xd8')){_0x12872a[_0x5209('0x125')](this['agents'][_0x3a1617]['id']);}}}this[_0x5209('0xbf')](_0x5f3ccf['id'],_0x12872a,0x1,_0x5f3ccf['dialOrderByScheduledAt'],_0x5f3ccf)[_0x5209('0xb4')](function(_0x3a0e68){if(!checkContactEmpty(_0x3a0e68)){checkContactLowerLimitOriginate(_0x5f3ccf,0x1,0x0);_0xd0e243[_0x5209('0xb2')](_0x5f3ccf)[_0x5209('0xb4')](sendMessageReschedule(_0x5f3ccf))[_0x5209('0xac')](loggerCatch(_0x5209('0xb5')));}else{_0x5f3ccf[_0x5209('0x3c')]=_0x5209('0x20d');if(_['isNil'](_0x3a0e68[0x0])||_[_0x5209('0xa9')](_0x3a0e68[0x0][_0x5209('0x171')])||_[_0x5209('0xa9')](_0x3a0e68[0x0][_0x5209('0x171')][_0x5209('0x172')])){_0xd0e243['emptyContact'](_0x5209('0x213'),_0x5f3ccf,_0x3a0e68[0x0]);}else{_0xd0e243[_0x5209('0xb6')](_[_0x5209('0xcb')](_0x3a0e68[0x0],[_0x5209('0xcf'),_0x5209('0x21a')]))[_0x5209('0xb4')](_0xd0e243[_0x5209('0x214')](_0x5f3ccf,_0x3a0e68[0x0]))['catch'](_0xd0e243[_0x5209('0x215')](_0x5209('0x21b'),_0x5f3ccf));}}})['catch'](loggerGetContactDialer(_0x5209('0x21c'),_0x5f3ccf,0x1));emitVoiceQueueSummary(_0x5f3ccf);};Dialer[_0x5209('0x19')]['abandonmentRate']=function(_0x5873f9,_0x5e5fe9,_0xe909f6,_0x3d1a97,_0x2074c2,_0x58a9a7){loggerPredictive[_0x5209('0x75')](_0x5209('0x21d'));loggerPredictive[_0x5209('0x75')](_0x5209('0x21e'),_0x5873f9);loggerPredictive[_0x5209('0x75')](_0x5209('0x21f'),_0x5e5fe9);loggerPredictive['info'](_0x5209('0x220'),_0xe909f6);loggerPredictive[_0x5209('0x75')]('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',_0x3d1a97);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',_0x2074c2);loggerPredictive[_0x5209('0x75')](_0x5209('0x7b'));return new BPromise(function(_0x3100f5,_0x669ab4){if(_0x5873f9<=0x0||isNaN(_0x5873f9)){return _0x669ab4(msgResponse(_0x5209('0x221'),_0x5209('0x19a'),_0x5209('0x222')+_0x5873f9));}if(_0xe909f6<=0x0||isNaN(_0xe909f6)){return _0x669ab4(msgResponse(_0x5209('0x221'),_0x5209('0x19a'),'Ts\x20=\x20'+_0xe909f6));}if(_0x3d1a97<=0x0||isNaN(_0x3d1a97)){return _0x669ab4(msgResponse(_0x5209('0x221'),'Error',_0x5209('0x223')+_0x3d1a97));}if(_0x5e5fe9<=0x0||isNaN(_0x5e5fe9)){return _0x669ab4(msgResponse('[abandonmentRate]',_0x5209('0x19a'),_0x5209('0x224')+_0x5e5fe9));}if(_0x2074c2<=0x0||isNaN(_0x2074c2)){return _0x669ab4(msgResponse(_0x5209('0x221'),_0x5209('0x19a'),_0x5209('0x225')+_0x2074c2));}_0x58a9a7=_0x58a9a7||0x0;var _0x488e09=0x1/_0xe909f6;var _0x1dd5fa=0x0;var _0x4d5202=0x0;var _0x4c4d34=0x0;var _0x3422a3=0x0;for(var _0x47803c=0x0;_0x4c4d34<_0x2074c2;_0x47803c+=0x1){_0x4d5202=_0x47803c/_0x5e5fe9;_0x1dd5fa=(_0x3d1a97*_0x4d5202+_0x58a9a7)/_0x488e09;_0x4c4d34=erlangb(_0x1dd5fa,_0x5873f9);_0x3422a3=_0x1dd5fa/_0x5873f9*(0x1-erlangb(_0x1dd5fa,_0x5873f9));}return _0x3100f5({'erlangCalls':_0x47803c,'erlangCallToSecond':_0x5e5fe9/_0x47803c,'erlangAbandonmentRate':_0x4c4d34,'erlangBusyFactor':_0x3422a3});});};Dialer['prototype'][_0x5209('0x1ee')]=function(_0x1e61b5,_0x5704d4,_0x5e191e,_0x5096d3,_0x118ff0,_0x4b8524){loggerPredictive['info'](_0x5209('0x226'));loggerPredictive[_0x5209('0x75')](_0x5209('0x21e'),_0x1e61b5);loggerPredictive[_0x5209('0x75')]('Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x5704d4);loggerPredictive[_0x5209('0x75')]('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',_0x5e191e);loggerPredictive['info']('P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x5096d3);loggerPredictive[_0x5209('0x75')](_0x5209('0x227'),_0x118ff0);loggerPredictive[_0x5209('0x75')]('---------------------------');return new BPromise(function(_0x1ad494,_0xa3b003){if(_0x1e61b5<=0x0||isNaN(_0x1e61b5)){return _0xa3b003(msgResponse(_0x5209('0x228'),_0x5209('0x19a'),_0x5209('0x222')+_0x1e61b5));}if(_0x5e191e<=0x0||isNaN(_0x5e191e)){return _0xa3b003(msgResponse(_0x5209('0x228'),_0x5209('0x19a'),_0x5209('0x229')+_0x5e191e));}if(_0x5096d3<=0x0||isNaN(_0x5096d3)){return _0xa3b003(msgResponse(_0x5209('0x228'),_0x5209('0x19a'),_0x5209('0x223')+_0x5096d3));}if(_0x5704d4<=0x0||isNaN(_0x5704d4)){return _0xa3b003(msgResponse(_0x5209('0x228'),_0x5209('0x19a'),'interval\x20=\x20'+_0x5704d4));}if(_0x118ff0<=0x0||isNaN(_0x118ff0)){return _0xa3b003(msgResponse(_0x5209('0x228'),_0x5209('0x19a'),_0x5209('0x22a')+_0x118ff0));}_0x4b8524=_0x4b8524||0x0;var _0x228030=0x1/_0x5e191e;var _0x352c9b=0x0;var _0x5207f4=0x0;var _0x1992d2=0x0;var _0x4f936f=0x0;for(var _0x255e35=0x0;_0x4f936f<_0x118ff0;_0x255e35+=0x1){_0x5207f4=_0x255e35/_0x5704d4;_0x352c9b=(_0x5096d3*_0x5207f4+_0x4b8524)/_0x228030;_0x1992d2=erlangb(_0x352c9b,_0x1e61b5);_0x4f936f=_0x352c9b/_0x1e61b5*(0x1-erlangb(_0x352c9b,_0x1e61b5));}return _0x1ad494({'erlangCalls':_0x255e35,'erlangCallToSecond':_0x5704d4/_0x255e35,'erlangAbandonmentRate':_0x1992d2,'erlangBusyFactor':_0x4f936f});});};module['exports']=Dialer; \ No newline at end of file +var _0x0930=['emptyContact','notFound','saveInDb','pick','ContactId','ListId','UserId','VoiceQueueId','[emptyContact][createHistory]','[emptyContact]','isSuccess','Success','isTrunkReachable','SIP/%s','unmonitored','uniqueid','isNil','variable','amdstatus','exten','xcally-motion-dialer','dialAMDActive','value','HANGUP','membername','AMD','custom:amd','buildObj','[syncHangupInAMD][createHistory]','[syncHangupInAMD]','MACHINE','statedesc','Machine','countglobal','amd','[syncAgentComplete][createHistory][0]','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countabandonedretry','countmachineretry','countagentrejectretry','dialGlobalMaxRetry','stateGlobal','reason19\x20machine....','reason\x2019\x20machine....','dialMachineRetryFrequency','YYYY-MM-DD\x20HH:mm:ss','CampaignId','[rescheduleContact][Machine]','HangupInAMD','[syncHangupInAMDIvr][createHistory]','[syncHangupInAMDIvr]','countbusyretry','createStateFinal','add','minutes','syncHangup','ivrAnswerCallsDay','[syncHangupIvr][createHistory]','[syncHangupIvr]','dialQueueProject','AGI','cause-txt','Unknow','reason','agent','agiafterat','dialQueueProject2','dialAgiAfterHangupAgent','[syncAgentComplete][createHistory]','[syncAgentComplete]','answertime','queueCallerAbandonCreateState','[syncQueueCallerAbandon]\x20[Drop]','droptime','responsetime','dialQueueTimeout','Drop','dropreason','TIMEOUT','countdropretry','dialDropRetryFrequency','starttime','endtime','calleridname','calleridnum','[syncAgentComplete][createHistory][10]','outboundDropCallsDayCallersExit','Abandoned','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','actionid','strategy','locked','paused','stateinterface','push','idHopper','queueStatusComplete','[booked][unlockQueueStatus]','run','_rr','unlockRR','[booked][RR]','Agent:\x20','[Catch][Preview][syncQueueStatusComplete]','contactAgent-idHopper:\x20','[booked][unlock]','[booked][unlock2]','[unlock2][syncQueueStatusComplete]','[booked][unlock3]','[unlock3][syncQueueStatusComplete]','syncCampaigns','TrunkBackup','TRUNK_IS_NOT_REACHABLE','\x20trunk\x20is\x20not\x20reachable','checkIfTime','ifTime','Failure','\x20Intervals\x20is\x20null\x20','INTERVAL_IS_EMPTY','timezones','\x20Timezone\x20unknow\x20','isArray','command','iftime\x20%s,%s','interval','content','indexOf','true','all','some','GLOBAL_INTERVAL_IS_OVERTIME','INTERVAL_IS_OVERTIME','[ifTime][promiseAll]','Global:\x20','Timezone:\x20','checkDialMethod','dialMethod','power','handlePower','predictive','Queue','method\x20not\x20recognized','checkPreviewRecallReminder','handlePreviewRecallNotifications','user:dialPreviewRecallReminder','launchHandleIvr','handleIvr','checkIsTrunkReachable','dialGlobalInterval','dialTimezone','checkIfTimeIntervals','[syncQueueSummary]','dialPreviewRecallmeReminder','[syncCampaigns]','\x5cw{0,','pow','replace','random','match','actionOriginate','object','originate','Contact','phone','contact\x20is\x20undefine','getCaller','NONE','\x22agi://%s/square,%s\x22','\x22%s,%s%s,,,%s\x22','dialQueueOptions','XMD-AMDINITIALSILENCE','dialAMDInitialSilence','XMD-AMDGREETING','XMD-AMDAFTERGREETINGSILENCE','XMD-AMDTOTALANALYSISTIME','dialAMDTotalAnalysisTime','dialAMDBetweenWordsSilence','XMD-AMDMAXIMUMNUMBEROFWORDS','dialAMDMaximumNumberOfWords','XMD-AMDSILENCETHRESHOLD','dialAMDSilenceThreshold','XMD-AMDMAXIMUMWORDLENGTH','dialAMDMaximumWordLength','XMD-VOICEQUEUEID','createdAt','updatedAt','%s%s','dialOriginateCallerIdNumber','dialRandomLastDigitCallerIdNumber','XMD-ORIGINATECALLERIDNAME','XMD-ORIGINATECALLERIDNUM','originatecalleridnum','SIP/%s/%s%s','trim','dialCutDigit','substring','outboundOriginateFailureCallsDay','[originateError]:\x20%s','OriginateError','[originate][error]','response','callProgressDetecting','[callProgressDetecting]\x20','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','[rescheduleContact][NoAnswer]','[rescheduleContact]\x20[Busy]','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','[rescheduleContact][NoSuchNumber]','dialDropMaxRetry','[rescheduleContact][Drop]','[rescheduleContact][Abandoned]','dialMachineMaxRetry','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','[callProgressDetecting]','entity\x20is\x20undefine','evt\x20is\x20undefine','NoSuchNumber','custom:agentnosuchnumber','reason\x200\x20no\x20such\x20number....','NoAnswer','checkRetriveMax','reason\x203\x20ringing\x20no\x20answer','Busy','custom:agentbusy','busy','[syncAgentComplete][createHistory][5]','dialBusyMaxRetry','reason\x205\x20busy','congestion','[syncAgentComplete][createHistory][8]','reason\x208\x20congestion','outboundAbandonedCallsDay','[syncAgentComplete][createHistory][11]','reason\x2011\x20abandoned','outboundRejectCallsDay','AgentReject','custom:agentreject','agentreject','reason\x2020\x20agentreject','[syncAgentComplete][createHistory][?]','Global','[moveContactManagedDialer][0]','dialPredictiveOptimizationPercentage','round','predictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','[startMethodPredictive][StartProgressive]','check\x20predictive\x20is\x20not\x20undefine','check\x20handlePredictive\x20is\x20not\x20undefine','collection\x20data\x20in\x20progressive\x20at','dialPredictiveInterval','[startMethodPredictive][StartProgressive][Loop]','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','Dropped\x20calls\x20day','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Max\x20Drop\x20','Drop\x20in\x20this\x20interval','getDataPredictive','startMethodPredictive','Predictive\x20after\x20first\x20interval','recalculate\x20predictive\x20at',')\x20are\x20less\x20than\x20threshold\x20(','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20more\x20than\x20threshold\x20(','dialPredictiveOptimization','abandonmentRate','agentBusyFactor','busyFactor','[getDataPredictive]','Unknown\x20Predictive','check\x20failure','outboundQueuePauses','[CatchErlangB]','floor','one\x20call\x20every:','fail\x20to\x20scheduled\x20calls','checkContactBlack','recallme','queueStatusComplete:\x20','queuestatus','[unlockOriginate][syncQueueStatusComplete]','scheduledat','Agent','voicePause','dialRecallInQueue','[rescheduleContact][dialRecallInQueue]','RecallInQueue','[Originate][HistoryDialRecallInQueue][historyCatch]','RECALLFAILEDTIMEOUT','RecallFailedTimeout','[Originate][HistoryRecallClose][historyCatch]','[Originate][HistoryRecallClose]','Blacklist','[Originate][historyBlacklist]','[Originate][MoveBlacklist]','inBlackList','dialOrderByScheduledAt','[getContactCampaign2][Empty]','RUNNING','ivrTotalCallsDays','[actionOriginate]\x20','[actionOriginateIvr]\x20','[getContactCampaign2]','dialLimitQueue','not_inuse','Contact.phone','loggerHandler','[getContactDialer2]','tryOriginatePredictive','[handlePredictive][limitChannel]','reachable','M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Ts:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[abandonmentRate]','m\x20=\x20','Ts\x20=\x20','p\x20=\x20','interval\x20=\x20','Amax\x20=\x20','----\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','uuid','moment','../preview/util/util','../../../config/logger','dialer','booked','predictiveCalls','syncQueueSummary','../ami','redis','localhost','../rpc/cmHopper','../rpc/cmHopperBlack','../rpc/voiceQueueRt','../rpc/setting','./action','./history','./final','./agentComplete','./queueCallerAbandon','./hangup','XCALLY_IP_AGI','127.0.0.1','rrmemory','roundrobin','prototype','enqueue','tail','finally','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','contactsId','uniqueId','optionPredictive','startPredictive','startProgressive','queueBooked','queueBookedRR','syncAgentConnect','bind','queuecallerabandon','originateresponse','syncOriginateResponse','agentcomplete','syncAgentComplete','custom:queuesummary','newexten','syncNewExten','varset','syncVarSet','queuemember','syncQueueMember','queuestatuscomplete','syncQueueStatusComplete','loopCampaigns','getSettings','then','isUndefined','AGENTS_NOT_LOGGED','name','\x20AGENTS\x20NOT\x20LOGGED','NOT_ACTIVE','\x20NOT\x20Active','Interval','message','INTERVAL_IS_NULL','Intervals','\x20INTERVAL_IS_NULL','isEmpty','Error','stringify','milliseconds','diff','emit','type','outbound','answered','available','loggedIn','pTalking','sumBillable','sumDuration','unmanaged','waiting','loggedInDb','dialActive','dialOriginateCallerIdName','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundReCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangAbandonmentRate','erlangBusyFactor','Trunk','active','callerid','md5','format','voice:queue:%s','ivr','campaign:ivr:%s','info','-----\x20Stats\x20Predictive\x20---','Total\x20Calls:\x20\x20\x20\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','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','---------------------------','predictiveIntervalAvgHoldtime','Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive','History\x20information\x20are\x20empty','Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','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','clearing\x20variable\x20start\x20progressive','clearing\x20variable\x20start\x20predictive','handlePredictive','clearing\x20variable\x20handle\x20predictive','preview','string','\x22%s\x22\x20<%s>','\x22\x22\x20<>','inspect','error','length','undefined','[decremetOriginate]\x20object\x20originated\x20is\x20negative','contactsRescheduled','[getContactDialer2][ReScheduled]','contacts','AVAILABLE_CONTACTS_FINISHED','[getContactDialer2][Empty]','sendMessageOneNotActive','talking','[syncQueueSummary]\x20Campaign\x20Queue:\x20','IS_DISACTIVED','is\x20disactive','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','is\x20not\x20active','state','loopClearZombieChannels','clearZombieChannels','[uniqueid]','actions','sequence','Action','status','channel','No\x20such\x20channel','updateOriginated','queue','[Dialer][checkChannel]','resolve','countReScheduled','catch','[countReScheduled]\x20','checkIsBlackList','[checkIsBlackList]\x20','checkIsBlackListIvr','[checkIsBlackListIvr]\x20','averageHandleTime','avgHandleTime','[averageHandleTime]\x20','rescheduleContact','unlockContact','[unlockContact]\x20','getContactDialer','temp','getContactDialerIvr','[getContactDialerIvr]\x20','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','moveContactManagedDialer','createHistory','[updateOriginated]\x20object\x20originated\x20is\x20negative'];(function(_0x5341ff,_0x1de6df){var _0x53be58=function(_0x4da0da){while(--_0x4da0da){_0x5341ff['push'](_0x5341ff['shift']());}};_0x53be58(++_0x1de6df);}(_0x0930,0x14f));var _0x0093=function(_0xfd084b,_0x26977e){_0xfd084b=_0xfd084b-0x0;var _0x375d60=_0x0930[_0xfd084b];return _0x375d60;};'use strict';var util=require(_0x0093('0x0'));var _=require('lodash');var BPromise=require('bluebird');var uuid=require(_0x0093('0x1'));var moment=require(_0x0093('0x2'));var rr=require('rr');var md5=require('md5');var Redis=require('ioredis');var ut=require(_0x0093('0x3'));var config=require('../../../config/environment/');var logger=require(_0x0093('0x4'))(_0x0093('0x5'));var loggerBooked=require(_0x0093('0x4'))(_0x0093('0x6'));var loggerPredictive=require(_0x0093('0x4'))('predictive');var loggerPredictiveCalls=require(_0x0093('0x4'))(_0x0093('0x7'));var loggerSyncQueueSummary=require('../../../config/logger')(_0x0093('0x8'));var ami=require(_0x0093('0x9'));config[_0x0093('0xa')]=_['defaults'](config[_0x0093('0xa')],{'host':_0x0093('0xb'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x0093('0xa')]));var cmHopper=require(_0x0093('0xc'));var cmHopperHistory=require('../rpc/cmHopperHistory');var cmHopperBlack=require(_0x0093('0xd'));var voiceQueueRt=require(_0x0093('0xe'));var RpcSetting=require(_0x0093('0xf'));var Action=require(_0x0093('0x10'));var History=require(_0x0093('0x11'));var Final=require(_0x0093('0x12'));var AgentComplete=require(_0x0093('0x13'));var QueueCallerAbandon=require(_0x0093('0x14'));var Hangup=require(_0x0093('0x15'));var ipAgi=process['env'][_0x0093('0x16')]||_0x0093('0x17');var strategy={'rrmemory':_0x0093('0x18'),'roundrobin':_0x0093('0x19')};var previewRecallmeReminderInterval=0x1;var Sequence=function(){};Sequence[_0x0093('0x1a')][_0x0093('0x1b')]=function(_0x31973b){this[_0x0093('0x1c')]=this[_0x0093('0x1c')]?this[_0x0093('0x1c')][_0x0093('0x1d')](_0x31973b):_0x31973b();};function Dialer(_0x367e9d,_0x2c461e){this['sequence']=new Sequence();this['preview']=_0x2c461e;this[_0x0093('0x1e')]=_0x367e9d['voiceQueues'];this[_0x0093('0x1f')]=_0x367e9d['campaigns'];this[_0x0093('0x20')]=_0x367e9d[_0x0093('0x20')];this['trunks']=_0x367e9d[_0x0093('0x21')];this[_0x0093('0x22')]=config['maxNumberOriginate']||0x2;this['channels']={};this['actions']={};this[_0x0093('0x23')]={};this[_0x0093('0x24')]={};this[_0x0093('0x25')]={};this[_0x0093('0x26')]={};this[_0x0093('0x27')]={};this['ivrOriginated']={};this[_0x0093('0x28')]={};this[_0x0093('0x29')]={};ami['on']('agentconnect',this[_0x0093('0x2a')][_0x0093('0x2b')](this));ami['on'](_0x0093('0x2c'),this['syncQueueCallerAbandon']['bind'](this));ami['on'](_0x0093('0x2d'),this[_0x0093('0x2e')][_0x0093('0x2b')](this));ami['on'](_0x0093('0x2f'),this[_0x0093('0x30')][_0x0093('0x2b')](this));ami['on'](_0x0093('0x31'),this[_0x0093('0x8')][_0x0093('0x2b')](this));ami['on']('hangup',this['syncHangup'][_0x0093('0x2b')](this));ami['on'](_0x0093('0x32'),this[_0x0093('0x33')]['bind'](this));ami['on'](_0x0093('0x34'),this[_0x0093('0x35')][_0x0093('0x2b')](this));ami['on'](_0x0093('0x36'),this[_0x0093('0x37')][_0x0093('0x2b')](this));ami['on'](_0x0093('0x38'),this[_0x0093('0x39')][_0x0093('0x2b')](this));this[_0x0093('0x3a')]();this['loopClearZombieChannels']();RpcSetting[_0x0093('0x3b')]()[_0x0093('0x3c')](function(_0x38c420){previewRecallmeReminderInterval=_0x38c420['previewRecallmeReminderInterval'];});}function isNotNull(_0x26436a){return _0x26436a!==null&&!_[_0x0093('0x3d')](_0x26436a);}function checkIsLoggedIn(_0xf95836,_0x39af61){return function(){if(_0x39af61<=0x0){_0xf95836['message']=_0x0093('0x3e');throw _0xf95836[_0x0093('0x3f')]+_0x0093('0x40');}};}function isActive(_0x110183){return _0x110183;}function checkIsActive(_0x30f205,_0x57baae){return function(){if(!isActive(_0x57baae)){_0x30f205['message']=_0x0093('0x41');throw _0x30f205[_0x0093('0x3f')]+_0x0093('0x42');}};}function checkInterval(_0x12492f){return function(){if(!isNotNull(_0x12492f[_0x0093('0x43')])){_0x12492f[_0x0093('0x44')]=_0x0093('0x45');throw _0x12492f['name']+'\x20INTERVAL_IS_NULL';}if(!isNotNull(_0x12492f['Interval'][_0x0093('0x46')])){_0x12492f[_0x0093('0x44')]=_0x0093('0x45');throw _0x12492f[_0x0093('0x3f')]+_0x0093('0x47');}if(!isNotNull(_[_0x0093('0x48')](_0x12492f[_0x0093('0x43')][_0x0093('0x46')]))){_0x12492f[_0x0093('0x44')]=_0x0093('0x45');throw _0x12492f[_0x0093('0x3f')]+_0x0093('0x47');}};}function msgResponse(_0x125949,_0x911341,_0x3085b0){return{'action':_0x125949,'response':_0x911341,'message':_0x3085b0,'stack':_0x3085b0};}function myreject(_0x56ba4e){return function(_0x357ddf){return _0x56ba4e(msgResponse('[ifTime][Action]',_0x0093('0x49'),JSON[_0x0093('0x4a')](_0x357ddf)));};}function getSeconds(_0x4af369,_0x2a226d){var _0x2d87b6=moment(_0x4af369)['milliseconds'](0x0);var _0x760b63=moment(_0x2a226d)[_0x0093('0x4b')](0x0);return _0x2d87b6[_0x0093('0x4c')](_0x760b63,'seconds');}function emit(_0x25be71,_0x371e3c,_0x581edb){io['to'](_0x25be71)[_0x0093('0x4d')](_0x371e3c,_0x581edb);}function emitVoiceQueueSummary(_0x5cff36){if(_0x5cff36[_0x0093('0x4e')]===_0x0093('0x4f')){var _0x1479cb={'id':_0x5cff36['id'],'name':_0x5cff36[_0x0093('0x3f')],'strategy':_0x5cff36['strategy'],'answered':_0x5cff36[_0x0093('0x50')],'available':_0x5cff36[_0x0093('0x51')],'loggedIn':_0x5cff36[_0x0093('0x52')],'pTalking':_0x5cff36[_0x0093('0x53')],'sumBillable':_0x5cff36[_0x0093('0x54')],'sumDuration':_0x5cff36[_0x0093('0x55')],'sumHoldTime':_0x5cff36['sumHoldTime']||0x0,'talking':_0x5cff36['talking'],'total':_0x5cff36['total'],'type':_0x5cff36['type'],'unmanaged':_0x5cff36[_0x0093('0x56')],'abandoned':_0x5cff36['abandoned'],'waiting':_0x5cff36[_0x0093('0x57')],'loggedInDb':_0x5cff36[_0x0093('0x58')],'dialActive':_0x5cff36[_0x0093('0x59')],'dialMethod':_0x5cff36['dialMethod'],'dialOriginateCallerIdName':_0x5cff36[_0x0093('0x5a')],'dialOriginateCallerIdNumber':_0x5cff36['dialOriginateCallerIdNumber'],'dialOriginateTimeout':_0x5cff36[_0x0093('0x5b')],'dialPrefix':_0x5cff36[_0x0093('0x5c')],'outboundAnswerAgiCallsDay':_0x5cff36[_0x0093('0x5d')],'outboundAnswerCallsDay':_0x5cff36[_0x0093('0x5e')],'outboundBlacklistCallsDay':_0x5cff36[_0x0093('0x5f')],'outboundBusyCallsDay':_0x5cff36[_0x0093('0x60')],'outboundCongestionCallsDay':_0x5cff36[_0x0093('0x61')],'outboundDropCallsDayACS':_0x5cff36[_0x0093('0x62')],'outboundDropCallsDayCallersExit':_0x5cff36['outboundDropCallsDayCallersExit'],'outboundDropCallsDayTimeout':_0x5cff36[_0x0093('0x63')],'outboundNoAnswerCallsDay':_0x5cff36[_0x0093('0x64')],'outboundNoSuchCallsDay':_0x5cff36[_0x0093('0x65')],'outboundOriginateFailureCallsDay':_0x5cff36['outboundOriginateFailureCallsDay'],'outboundReCallsDay':_0x5cff36[_0x0093('0x66')],'outboundRejectCallsDay':_0x5cff36['outboundRejectCallsDay'],'outboundUnknownCallsDay':_0x5cff36[_0x0093('0x67')],'predictiveIntervalAnsweredCalls':_0x5cff36[_0x0093('0x68')],'predictiveIntervalAvgHoldtime':_0x5cff36['predictiveIntervalAvgHoldtime'],'predictiveIntervalAvgTalktime':_0x5cff36[_0x0093('0x69')],'predictiveIntervalDroppedCallsCallersExit':_0x5cff36[_0x0093('0x6a')],'predictiveIntervalDroppedCallsTimeout':_0x5cff36[_0x0093('0x6b')],'predictiveIntervalErlangCalls':_0x5cff36['predictiveIntervalErlangCalls'],'predictiveIntervalErlangCallsDroppedCalls':_0x5cff36[_0x0093('0x6c')],'predictiveIntervalHitRate':_0x5cff36[_0x0093('0x6d')],'predictiveIntervalMultiplicativeFactor':_0x5cff36[_0x0093('0x6e')],'predictiveIntervalPauses':_0x5cff36[_0x0093('0x6f')],'predictiveIntervalAvailable':_0x5cff36[_0x0093('0x70')],'predictiveIntervalTotalCalls':_0x5cff36[_0x0093('0x71')],'message':_0x5cff36[_0x0093('0x44')],'originated':_0x5cff36[_0x0093('0x72')],'erlangCalls':_0x5cff36[_0x0093('0x73')],'erlangCallToSecond':_0x5cff36['erlangCallToSecond'],'erlangAbandonmentRate':_0x5cff36[_0x0093('0x74')],'erlangBusyFactor':_0x5cff36[_0x0093('0x75')],'startPredictive':_0x5cff36['startPredictive'],'startProgressive':_0x5cff36['startProgressive']};if(_0x5cff36[_0x0093('0x76')]){_0x1479cb[_0x0093('0x76')]={'id':_0x5cff36[_0x0093('0x76')]['id'],'name':_0x5cff36[_0x0093('0x76')][_0x0093('0x3f')],'active':_0x5cff36[_0x0093('0x76')][_0x0093('0x77')],'callerid':_0x5cff36[_0x0093('0x76')][_0x0093('0x78')]};}if(_0x5cff36['Interval']){_0x1479cb[_0x0093('0x43')]={'id':_0x5cff36[_0x0093('0x43')]['id'],'name':_0x5cff36['Interval'][_0x0093('0x3f')]};}var _0x57de61=md5(JSON[_0x0093('0x4a')](_0x1479cb));if(_0x5cff36[_0x0093('0x79')]!==_0x57de61){_0x5cff36[_0x0093('0x79')]=_0x57de61;emit(util[_0x0093('0x7a')](_0x0093('0x7b'),_0x1479cb[_0x0093('0x3f')]),'voice_queue:save',_0x1479cb);}}}function emitCampaignSummary(_0x2f6ebc){if(_0x2f6ebc[_0x0093('0x4e')]===_0x0093('0x7c')){emit(util[_0x0093('0x7a')](_0x0093('0x7d'),_0x2f6ebc[_0x0093('0x3f')]),'campaign:save',_0x2f6ebc);}}function checkGetDataPredictive(_0x3378ef){if(isNotNull(_0x3378ef)&&!_[_0x0093('0x48')](_0x3378ef)){loggerPredictive[_0x0093('0x7e')](_0x0093('0x7f'));loggerPredictive[_0x0093('0x7e')](_0x0093('0x80'),_0x3378ef['predictiveIntervalTotalCalls']);loggerPredictive[_0x0093('0x7e')]('Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x3378ef[_0x0093('0x68')]);loggerPredictive[_0x0093('0x7e')]('Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x3378ef[_0x0093('0x6b')]);loggerPredictive[_0x0093('0x7e')](_0x0093('0x81'),_0x3378ef[_0x0093('0x6a')]);loggerPredictive[_0x0093('0x7e')](_0x0093('0x82'),_0x3378ef['predictiveIntervalAvgHoldtime']);loggerPredictive[_0x0093('0x7e')](_0x0093('0x83'),_0x3378ef['predictiveIntervalAvgTalktime']);loggerPredictive[_0x0093('0x7e')](_0x0093('0x84'));if(_0x3378ef[_0x0093('0x71')]>0x0){if(!_[_0x0093('0x3d')](_0x3378ef[_0x0093('0x69')])&&_0x3378ef[_0x0093('0x69')]>0x0){return!![];}loggerPredictive[_0x0093('0x7e')]('Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive');if(!_[_0x0093('0x3d')](_0x3378ef[_0x0093('0x85')])&&_0x3378ef['predictiveIntervalAvgHoldtime']>0x0){return!![];}loggerPredictive[_0x0093('0x7e')](_0x0093('0x86'));}else{loggerPredictive[_0x0093('0x7e')](_0x0093('0x87'));}}else{loggerPredictive['info'](_0x0093('0x88'));}return![];}function mergeDataErlangB(_0x1934e3){return function(_0x521bcb){loggerPredictive['info']('---------\x20ErlangB\x20---------');loggerPredictive['info'](_0x0093('0x89'),_0x521bcb[_0x0093('0x73')]);loggerPredictive[_0x0093('0x7e')](_0x0093('0x8a'),_0x521bcb[_0x0093('0x8b')]);loggerPredictive[_0x0093('0x7e')](_0x0093('0x8c'),_0x521bcb[_0x0093('0x74')]);loggerPredictive[_0x0093('0x7e')](_0x0093('0x8d'),_0x521bcb[_0x0093('0x75')]);loggerPredictive[_0x0093('0x7e')](_0x0093('0x8c'),_0x521bcb[_0x0093('0x74')]);loggerPredictive[_0x0093('0x7e')](_0x0093('0x84'));_[_0x0093('0x8e')](_0x1934e3,_0x521bcb);};}function getDiff(_0x54d301){var _0x2cd8c0=moment()['milliseconds'](0x0);var _0x377826=moment(_0x54d301)[_0x0093('0x4b')](0x0);return _0x2cd8c0[_0x0093('0x4c')](_0x377826,'seconds');}function ifInterval(_0x295876,_0x56ba51){if(_[_0x0093('0x3d')](_0x56ba51)){return![];}return getDiff(_0x56ba51)<_0x295876*0x3c;}function freeVariablesPredictive(_0x1d5bd0){if(isNotNull(_0x1d5bd0)){if(!_[_0x0093('0x3d')](_0x1d5bd0[_0x0093('0x27')])){_0x1d5bd0['startProgressive']=undefined;loggerPredictive['info'](_0x1d5bd0['name'],_0x0093('0x8f'));}if(!_['isUndefined'](_0x1d5bd0[_0x0093('0x26')])){_0x1d5bd0[_0x0093('0x26')]=undefined;loggerPredictive[_0x0093('0x7e')](_0x1d5bd0[_0x0093('0x3f')],_0x0093('0x90'));}if(!_[_0x0093('0x3d')](_0x1d5bd0['handlePredictive'])){clearInterval(_0x1d5bd0[_0x0093('0x91')]);_0x1d5bd0['handlePredictive']=undefined;loggerPredictive[_0x0093('0x7e')](_0x1d5bd0[_0x0093('0x3f')],_0x0093('0x92'));}}}function erlangb(_0x22f434,_0x50069b){if(_0x50069b===0x0){return 0x0;}var _0x3f4dfc=0x1;for(var _0x290962=0x1;_0x290962<=_0x50069b;_0x290962+=0x1){_0x3f4dfc=0x1+_0x3f4dfc*_0x290962/_0x22f434;}return 0x1/_0x3f4dfc;}function isVoiceQueueOutbound(_0x2075b0){return _0x2075b0===_0x0093('0x4f');}function isNotPreview(_0x5c977b){return _0x5c977b!==_0x0093('0x93');}function isCampaignIvr(_0x342835){return _0x342835===_0x0093('0x7c');}function getCallerId(_0x2e7942,_0x4d51a4,_0x1afb7e){if(!_[_0x0093('0x3d')](_0x1afb7e)&&typeof _0x1afb7e===_0x0093('0x94')&&!_[_0x0093('0x48')](_0x1afb7e)){if(!_[_0x0093('0x3d')](_0x4d51a4)&&typeof _0x4d51a4===_0x0093('0x94')&&!_[_0x0093('0x48')](_0x4d51a4)){return util[_0x0093('0x7a')](_0x0093('0x95'),_0x4d51a4,_0x1afb7e);}return util['format'](_0x0093('0x95'),_0x1afb7e,_0x1afb7e);}if(!_[_0x0093('0x3d')](_0x2e7942)&&typeof _0x2e7942===_0x0093('0x94')&&!_[_0x0093('0x48')](_0x2e7942)){return _0x2e7942;}return _0x0093('0x96');}function loggerCatchQueueSummary(_0x33edca,_0x1f876f){return function(_0x366fee){freeVariablesPredictive(_0x1f876f);emitVoiceQueueSummary(_0x1f876f);emitCampaignSummary(_0x1f876f);loggerSyncQueueSummary['error'](_0x33edca,util[_0x0093('0x97')](_0x366fee,{'showHidden':![],'depth':null}));};}function loggerCatchPredictive(_0x191a2a,_0x72b425){return function(_0x596092){loggerPredictive[_0x0093('0x98')](_0x72b425['name'],_0x191a2a);loggerPredictive['error'](_0x596092['stack']);freeVariablesPredictive(_0x72b425);};}function loggerCatch(_0x5bfb6b){return function(_0x56032e){logger[_0x0093('0x98')](_0x5bfb6b,util[_0x0093('0x97')](_0x56032e,{'showHidden':![],'depth':null}));};}function checkContactEmpty(_0x52b674){return _0x52b674&&!_[_0x0093('0x3d')](_0x52b674)&&_0x52b674[_0x0093('0x99')]>0x0;}function decremetOriginate(_0x226d00){if(!_['isUndefined'](_0x226d00)&&_0x226d00!==null){if(typeof _0x226d00[_0x0093('0x72')]!==_0x0093('0x9a')){if(_0x226d00[_0x0093('0x72')]>0x0){_0x226d00[_0x0093('0x72')]-=0x1;}else{logger[_0x0093('0x98')](_0x0093('0x9b'));}}}else{logger[_0x0093('0x98')]('[decremetOriginate]\x20is\x20null\x20or\x20undefined');}}function checkContactLowerLimitOriginate(_0x1977cd,_0x2de4e4,_0x1995d5){if(_0x2de4e4>_0x1995d5){for(var _0x139074=0x0;_0x139074<_0x2de4e4-_0x1995d5;_0x139074+=0x1){decremetOriginate(_0x1977cd);}}}function loggerGetContactDialer(_0x9f8cee,_0x4cfe0d,_0xe424a2){return function(_0x57f11b){checkContactLowerLimitOriginate(_0x4cfe0d,_0xe424a2,0x0);logger[_0x0093('0x98')](_0x9f8cee,util[_0x0093('0x97')](_0x57f11b,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x15c929){return function(_0xe03e97){if(isNotNull(_0xe03e97)&&isNotNull(_0xe03e97[0x0])){if(_0xe03e97[0x0][_0x0093('0x9c')]>0x0){_0x15c929['message']='RESCHEDULED_CONTACTS';logger['info'](_0x0093('0x9d')+_0x15c929[_0x0093('0x3f')],_0xe03e97[0x0]['contactsRescheduled'],_0x0093('0x9e'));}else{_0x15c929['message']=_0x0093('0x9f');logger[_0x0093('0x7e')](_0x0093('0xa0')+_0x15c929[_0x0093('0x3f')]);}}};}function notSendMessagesQueue(_0x58a075){if(_0x58a075[_0x0093('0xa1')]){freeVariablesPredictive(_0x58a075);if(_0x58a075[_0x0093('0x72')]===0x0&&_0x58a075[_0x0093('0xa2')]===0x0&&_0x58a075[_0x0093('0x57')]===0x0&&(_0x58a075[_0x0093('0x53')]||0x0)===0x0){_0x58a075['sendMessageOneNotActive']=![];_0x58a075[_0x0093('0x51')]=0x0;_0x58a075['message']='NOT_ACTIVE';loggerSyncQueueSummary[_0x0093('0x98')](_0x0093('0xa3'),_0x58a075[_0x0093('0x3f')],'is\x20not\x20active');}else{_0x58a075[_0x0093('0x44')]=_0x0093('0xa4');loggerSyncQueueSummary[_0x0093('0x98')](_0x0093('0xa3'),_0x58a075[_0x0093('0x3f')],_0x0093('0xa5'));}emitVoiceQueueSummary(_0x58a075);}}function notSendMessagesCampaign(_0x59c191){if(_0x59c191[_0x0093('0xa1')]){if(_0x59c191[_0x0093('0x72')]===0x0){_0x59c191[_0x0093('0xa1')]=![];_0x59c191[_0x0093('0x44')]=_0x0093('0x41');loggerSyncQueueSummary[_0x0093('0x98')](_0x0093('0xa6'),_0x59c191[_0x0093('0x3f')],_0x0093('0xa7'));}else{_0x59c191[_0x0093('0x44')]='IS_DISACTIVED';loggerSyncQueueSummary['error']('[syncQueueSummary]\x20Campaign\x20Ivr:\x20',_0x59c191[_0x0093('0x3f')],'is\x20disactive');}emitCampaignSummary(_0x59c191);}}function createObjHistory(_0x4f6e6f,_0x55be2d,_0x430516,_0x28593f,_0x4580e4){_0x4f6e6f[_0x0093('0x44')]=_0x430516;var _0x47917d=new Action(_0x4f6e6f,_0x55be2d);var _0x4ab844=new History(_0x47917d);_0x4ab844[_0x0093('0xa8')]=_0x28593f;_0x4ab844['statedesc']=_0x4580e4;_0x4ab844['endtime']=_0x47917d['starttime'];return _0x4ab844;}Dialer[_0x0093('0x1a')][_0x0093('0xa9')]=function(){var _0x1a14ca=this;setInterval(function(){_0x1a14ca[_0x0093('0xaa')](_0x1a14ca['uniqueId'],_0x0093('0xab'));_0x1a14ca[_0x0093('0xaa')](_0x1a14ca[_0x0093('0xac')],'[actions]');},0x32c8);};Dialer[_0x0093('0x1a')]['clearZombieChannels']=function(_0x178a89,_0x4f3e5a){var _0xb01e82=this;for(var _0x794ed7 in _0x178a89){if(typeof _0x178a89[_0x794ed7]!==_0x0093('0x9a')){this[_0x0093('0xad')][_0x0093('0x1b')](function(){if(!_['isNil'](_0x178a89[_0x794ed7])){return ami[_0x0093('0xae')]({'action':_0x0093('0xaf'),'channel':_0x178a89[_0x794ed7][_0x0093('0xb0')]})['catch'](function(_0x23791e){if(_0x23791e[_0x0093('0x44')]===_0x0093('0xb1')){setTimeout(function(){if(_0x178a89[_0x794ed7]&&_0x178a89[_0x794ed7][_0x0093('0x4e')]!==_0x0093('0x7c')){_0xb01e82[_0x0093('0xb2')](_0xb01e82['voiceQueues'][_0x178a89[_0x794ed7][_0x0093('0xb3')]]);logger[_0x0093('0x98')](_0x0093('0xb4'),_0x4f3e5a,_0x794ed7,_0x178a89[_0x794ed7][_0x0093('0xb3')]);delete _0x178a89[_0x794ed7];}if(_0x178a89[_0x794ed7]&&_0x178a89[_0x794ed7]['type']==='ivr'){_0xb01e82[_0x0093('0xb2')](_0xb01e82[_0x0093('0x1f')][_0x178a89[_0x794ed7][_0x0093('0xb3')]]);logger[_0x0093('0x98')]('[Dialer][checkChannel][ivr]',_0x4f3e5a,_0x794ed7,_0x178a89[_0x794ed7]['queue']);delete _0x178a89[_0x794ed7];}},0x2328);}});}});}}};Dialer['prototype']['countReScheduled']=function(_0x40233c){return BPromise[_0x0093('0xb5')]()[_0x0093('0x3c')](cmHopper[_0x0093('0xb6')](_0x40233c))[_0x0093('0xb7')](loggerCatch(_0x0093('0xb8')));};Dialer[_0x0093('0x1a')]['checkIsBlackList']=function(_0x1c1481){return BPromise['resolve']()[_0x0093('0x3c')](cmHopperBlack[_0x0093('0xb9')](_0x1c1481))[_0x0093('0xb7')](loggerCatch(_0x0093('0xba')));};Dialer[_0x0093('0x1a')][_0x0093('0xbb')]=function(_0x246a73){return BPromise[_0x0093('0xb5')]()[_0x0093('0x3c')](cmHopperBlack[_0x0093('0xbb')](_0x246a73))[_0x0093('0xb7')](loggerCatch(_0x0093('0xbc')));};Dialer[_0x0093('0x1a')][_0x0093('0xbd')]=function(_0x4380bb){return BPromise[_0x0093('0xb5')]()[_0x0093('0x3c')](cmHopperHistory[_0x0093('0xbe')](_0x4380bb))[_0x0093('0xb7')](loggerCatch(_0x0093('0xbf')));};Dialer[_0x0093('0x1a')][_0x0093('0xc0')]=function(_0x21af9b){return BPromise[_0x0093('0xb5')]()[_0x0093('0x3c')](cmHopper[_0x0093('0xc0')](_0x21af9b))[_0x0093('0xb7')](loggerCatch('[rescheduleContact]\x20'));};Dialer['prototype'][_0x0093('0xc1')]=function(_0x264952,_0x52a952,_0x4d3166){return BPromise['resolve']()[_0x0093('0x3c')](cmHopper[_0x0093('0xc1')](_0x264952,_0x52a952,_0x4d3166))['catch'](loggerCatch(_0x0093('0xc2')));};Dialer[_0x0093('0x1a')][_0x0093('0xc3')]=function(_0x37d7d6,_0x102841,_0x47d84a,_0xf3260d,_0x1c0104){return BPromise[_0x0093('0xb5')]()[_0x0093('0x3c')](cmHopper[_0x0093('0xc3')](_0x37d7d6,_0x102841,_0x47d84a,_0xf3260d))[_0x0093('0xb7')](function(_0x558c55){_0x1c0104[_0x0093('0xc4')]-=_0x47d84a;_0x1c0104[_0x0093('0xc4')]=_0x1c0104['temp']>0x0?_0x1c0104[_0x0093('0xc4')]:0x0;loggerCatch('[getContactDialer]\x20')(_0x558c55);});};Dialer[_0x0093('0x1a')][_0x0093('0xc5')]=function(_0x9c9681,_0x2c45cf,_0x17b900,_0x325613){return BPromise['resolve']()[_0x0093('0x3c')](cmHopper[_0x0093('0xc5')](_0x9c9681,_0x2c45cf,_0x17b900))['catch'](function(_0x43a2a9){_0x325613[_0x0093('0xc4')]-=_0x2c45cf;_0x325613[_0x0093('0xc4')]=_0x325613[_0x0093('0xc4')]>0x0?_0x325613[_0x0093('0xc4')]:0x0;loggerCatch(_0x0093('0xc6'))(_0x43a2a9);});};Dialer[_0x0093('0x1a')][_0x0093('0xc7')]=function(_0x163f10){return BPromise['resolve']()[_0x0093('0x3c')](voiceQueueRt['getVoiceQueueRtPauses'](_0x163f10))[_0x0093('0xb7')](loggerCatch(_0x0093('0xc8')));};Dialer[_0x0093('0x1a')][_0x0093('0xc9')]=function(_0x2ffbd4){return BPromise[_0x0093('0xb5')]()['then'](cmHopper['moveContactManagedDialer'](_0x2ffbd4))['catch'](loggerCatch('[moveContactManagedDialer]\x20'));};Dialer[_0x0093('0x1a')]['createHistory']=function(_0xe6dafc){return BPromise['resolve']()['then'](cmHopperHistory[_0x0093('0xca')](_0xe6dafc))[_0x0093('0xb7')](loggerCatch('[createHistory]\x20'));};Dialer[_0x0093('0x1a')]['updateOriginated']=function(_0x1fc188){if(!_[_0x0093('0x3d')](_0x1fc188)&&_0x1fc188!==null){if(typeof _0x1fc188[_0x0093('0x72')]!==_0x0093('0x9a')){if(_0x1fc188[_0x0093('0x72')]>0x0){_0x1fc188[_0x0093('0x72')]-=0x1;}else{logger[_0x0093('0x98')](_0x0093('0xcb'));}}}else{logger['error']('[updateOriginated]\x20is\x20null\x20or\x20undefined');}};Dialer[_0x0093('0x1a')]['loggerHandler']=function(_0x318b19,_0x261472){var _0x2e7899=this;return function(_0x34308b){_0x2e7899['updateOriginated'](_0x261472);logger['error'](_0x318b19,util['inspect'](_0x34308b,{'showHidden':![],'depth':null}));};};Dialer[_0x0093('0x1a')][_0x0093('0xcc')]=function(_0x15f4df,_0x1b5332,_0x456065){var _0x1316aa={'state':0x19,'statedesc':_0x0093('0xcd')};this[_0x0093('0xb2')](_0x1b5332);this[_0x0093('0xce')](_['merge'](_0x1316aa,_[_0x0093('0xcf')](_0x456065,[_0x0093('0xd0'),_0x0093('0xd1'),_0x0093('0xd2'),_0x0093('0xd3'),'CampaignId'])),_0x0093('0xd4'),_0x0093('0xd5'));logger[_0x0093('0x98')](_0x15f4df);};Dialer[_0x0093('0x1a')][_0x0093('0xd6')]=function(_0x424762){return _0x424762===_0x0093('0xd7');};Dialer[_0x0093('0x1a')][_0x0093('0xd8')]=function(_0x4e6b0b){return!_[_0x0093('0x3d')](_0x4e6b0b)&&_0x4e6b0b&&!_[_0x0093('0x3d')](_0x4e6b0b[_0x0093('0x3f')])&&!_[_0x0093('0x3d')](_0x4e6b0b['active'])&&_0x4e6b0b[_0x0093('0x77')]&&(this[_0x0093('0x21')][util[_0x0093('0x7a')](_0x0093('0xd9'),_0x4e6b0b[_0x0093('0x3f')])][_0x0093('0xaf')]==='reachable'||this['trunks'][util[_0x0093('0x7a')](_0x0093('0xd9'),_0x4e6b0b[_0x0093('0x3f')])][_0x0093('0xaf')]===_0x0093('0xda'));};Dialer['prototype'][_0x0093('0xce')]=function(_0x4264ea,_0x51100f,_0x56da31){this['createHistory'](_0x4264ea)[_0x0093('0xb7')](loggerCatch(_0x51100f));this[_0x0093('0xc9')](_0x4264ea)[_0x0093('0xb7')](loggerCatch(_0x56da31));};Dialer[_0x0093('0x1a')][_0x0093('0x35')]=function(_0x25be60){var _0x2ce6c2=this['uniqueId'][_0x25be60[_0x0093('0xdb')]];var _0x97b01f;if(!_[_0x0093('0xdc')](_0x25be60)&&!_[_0x0093('0xdc')](_0x25be60[_0x0093('0xdd')])&&!_[_0x0093('0xdc')](_0x25be60[_0x0093('0xdd')][_0x0093('0xde')])&&_0x25be60[_0x0093('0xdf')]===_0x0093('0xe0')&&_0x2ce6c2){if(_0x2ce6c2['type']!=='ivr'&&this[_0x0093('0x1e')][_0x2ce6c2[_0x0093('0xb3')]][_0x0093('0xe1')]&&_0x25be60[_0x0093('0xe2')]===_0x0093('0xe3')){delete this[_0x0093('0x24')][_0x25be60[_0x0093('0xdb')]];this[_0x0093('0xb2')](this[_0x0093('0x1e')][_0x2ce6c2[_0x0093('0xb3')]]);this[_0x0093('0x1e')][_0x2ce6c2[_0x0093('0xb3')]]['outboundAnswerCallsDay']+=0x1;this[_0x0093('0x1e')][_0x2ce6c2[_0x0093('0xb3')]][_0x0093('0x5d')]+=0x1;_0x97b01f=new Hangup(_0x2ce6c2,_0x25be60);_0x97b01f[_0x0093('0xa8')]=0x12;_0x97b01f['statedesc']='HangupInAMD';_0x97b01f[_0x0093('0xe4')]=_0x0093('0xe5');ami['emit'](_0x0093('0xe6'),ut[_0x0093('0xe7')](_0x97b01f,'amd'));this[_0x0093('0xce')](_0x97b01f,_0x0093('0xe8'),_0x0093('0xe9'));}if(_0x2ce6c2['type']!==_0x0093('0x7c')&&this[_0x0093('0x1e')][_0x2ce6c2['queue']][_0x0093('0xe1')]&&_0x25be60[_0x0093('0xe2')]===_0x0093('0xea')){var _0x4c8bec=this;return new BPromise(function(_0x499c6b,_0x13446c){delete _0x4c8bec[_0x0093('0x24')][_0x25be60['uniqueid']];_0x4c8bec[_0x0093('0xb2')](_0x4c8bec[_0x0093('0x1e')][_0x2ce6c2['queue']]);_0x4c8bec[_0x0093('0x1e')][_0x2ce6c2['queue']][_0x0093('0x5e')]+=0x1;_0x4c8bec[_0x0093('0x1e')][_0x2ce6c2[_0x0093('0xb3')]]['outboundAnswerAgiCallsDay']+=0x1;var _0x306c45=_0x4c8bec['voiceQueues'][_0x2ce6c2[_0x0093('0xb3')]];var _0x23e2e4=new Hangup(_0x2ce6c2,_0x25be60);_0x23e2e4[_0x0093('0xa8')]=0x13;_0x23e2e4[_0x0093('0xeb')]=_0x0093('0xec');_0x23e2e4[_0x0093('0xe4')]=_0x0093('0xe5');_0x23e2e4['countmachineretry']+=0x1;_0x23e2e4[_0x0093('0xed')]+=0x1;_0x23e2e4['amd']=!![];ami[_0x0093('0x4d')](_0x0093('0xe6'),ut['buildObj'](_0x23e2e4,_0x0093('0xee')));_0x4c8bec[_0x0093('0xca')](_0x23e2e4)[_0x0093('0xb7')](loggerCatch(_0x0093('0xef')));if(_0x23e2e4['countbusyretry']+_0x23e2e4[_0x0093('0xf0')]+_0x23e2e4[_0x0093('0xf1')]+_0x23e2e4[_0x0093('0xf2')]+_0x23e2e4['countdropretry']+_0x23e2e4[_0x0093('0xf3')]+_0x23e2e4[_0x0093('0xf4')]+_0x23e2e4[_0x0093('0xf5')]>=_0x306c45[_0x0093('0xf6')]){_0x4c8bec[_0x0093('0xf7')](_0x23e2e4,_0x499c6b,_0x13446c,_0x0093('0xf8'));}else{if(_0x23e2e4['countmachineretry']>=_0x306c45['dialMachineMaxRetry']){_0x4c8bec['createStateFinal'](_0x23e2e4,_0x499c6b,_0x13446c,_0x0093('0xf9'));}else{_0x4c8bec[_0x0093('0xc0')]({'active':![],'countmachineretry':_0x23e2e4['countmachineretry'],'scheduledat':moment()['add'](_0x306c45[_0x0093('0xfa')],'minutes')['format'](_0x0093('0xfb')),'ContactId':_0x23e2e4[_0x0093('0xd0')],'ListId':_0x23e2e4[_0x0093('0xd1')],'VoiceQueueId':_0x23e2e4[_0x0093('0xd3')]||undefined,'CampaignId':_0x23e2e4[_0x0093('0xfc')]||undefined})['catch'](loggerCatch(_0x0093('0xfd')));_0x499c6b({'reschedule':0x1});}}});}if(_0x2ce6c2[_0x0093('0x4e')]===_0x0093('0x7c')&&this[_0x0093('0x1f')][_0x2ce6c2[_0x0093('0xb3')]]['dialAMDActive']&&_0x25be60[_0x0093('0xe2')]==='HANGUP'){delete this['uniqueId'][_0x25be60[_0x0093('0xdb')]];this[_0x0093('0xb2')](this['campaigns'][_0x2ce6c2[_0x0093('0xb3')]]);_0x97b01f=new Hangup(_0x2ce6c2,_0x25be60);_0x97b01f['state']=0x12;_0x97b01f['statedesc']=_0x0093('0xfe');_0x97b01f[_0x0093('0xe4')]='AMD';ami[_0x0093('0x4d')]('custom:amd',ut['buildObj'](_0x97b01f,'amd'));this[_0x0093('0xce')](_0x97b01f,_0x0093('0xff'),_0x0093('0x100'));}if(_0x2ce6c2[_0x0093('0x4e')]===_0x0093('0x7c')&&this[_0x0093('0x1f')][_0x2ce6c2[_0x0093('0xb3')]][_0x0093('0xe1')]&&_0x25be60[_0x0093('0xe2')]===_0x0093('0xea')){var _0x4c8bec=this;return new BPromise(function(_0x2bda70,_0x4545fa){delete _0x4c8bec[_0x0093('0x24')][_0x25be60[_0x0093('0xdb')]];_0x4c8bec['updateOriginated'](_0x4c8bec['campaigns'][_0x2ce6c2['queue']]);_0x4c8bec['campaigns'][_0x2ce6c2[_0x0093('0xb3')]][_0x0093('0x5e')]+=0x1;_0x4c8bec[_0x0093('0x1f')][_0x2ce6c2['queue']][_0x0093('0x5d')]+=0x1;var _0x3b5288=_0x4c8bec[_0x0093('0x1f')][_0x2ce6c2[_0x0093('0xb3')]];var _0x6c8da1=new Hangup(_0x2ce6c2,_0x25be60);_0x6c8da1[_0x0093('0xa8')]=0x13;_0x6c8da1[_0x0093('0xeb')]='Machine';_0x6c8da1[_0x0093('0xe4')]=_0x0093('0xe5');_0x6c8da1[_0x0093('0xf4')]+=0x1;_0x6c8da1[_0x0093('0xed')]+=0x1;_0x6c8da1['amd']=!![];ami['emit']('custom:amd',ut[_0x0093('0xe7')](_0x6c8da1,_0x0093('0xee')));_0x4c8bec[_0x0093('0xca')](_0x6c8da1)[_0x0093('0xb7')](loggerCatch(_0x0093('0xef')));if(_0x6c8da1[_0x0093('0x101')]+_0x6c8da1['countcongestionretry']+_0x6c8da1['countnoanswerretry']+_0x6c8da1[_0x0093('0xf2')]+_0x6c8da1['countdropretry']+_0x6c8da1['countabandonedretry']+_0x6c8da1[_0x0093('0xf4')]+_0x6c8da1[_0x0093('0xf5')]>=_0x3b5288['dialGlobalMaxRetry']){_0x4c8bec['stateGlobal'](_0x6c8da1,_0x2bda70,_0x4545fa,_0x0093('0xf8'));}else{if(_0x6c8da1[_0x0093('0xf4')]>=_0x3b5288['dialMachineMaxRetry']){_0x4c8bec[_0x0093('0x102')](_0x6c8da1,_0x2bda70,_0x4545fa,_0x0093('0xf9'));}else{_0x4c8bec['rescheduleContact']({'active':![],'countmachineretry':_0x6c8da1[_0x0093('0xf4')],'scheduledat':moment()[_0x0093('0x103')](_0x3b5288[_0x0093('0xfa')],_0x0093('0x104'))[_0x0093('0x7a')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x6c8da1[_0x0093('0xd0')],'ListId':_0x6c8da1[_0x0093('0xd1')],'VoiceQueueId':_0x6c8da1['VoiceQueueId']||undefined,'CampaignId':_0x6c8da1[_0x0093('0xfc')]||undefined})['catch'](loggerCatch('[rescheduleContact][Machine]'));_0x2bda70({'reschedule':0x1});}}});}}};Dialer['prototype'][_0x0093('0x105')]=function(_0x15e8bf){var _0xdaa549=this['uniqueId'][_0x15e8bf['uniqueid']];var _0x473b5a=this;var _0x201426;if(_0xdaa549&&_0xdaa549[_0x0093('0x4e')]===_0x0093('0x7c')){delete this[_0x0093('0x24')][_0x15e8bf['uniqueid']];this[_0x0093('0xb2')](this[_0x0093('0x1f')][_0xdaa549[_0x0093('0xb3')]]);this[_0x0093('0x1f')][_0xdaa549[_0x0093('0xb3')]][_0x0093('0x106')]+=0x1;_0x201426=new Hangup(_0xdaa549,_0x15e8bf);this['createHistory'](_0x201426)[_0x0093('0xb7')](loggerCatch(_0x0093('0x107')));this[_0x0093('0xc9')](_0x201426)[_0x0093('0xb7')](loggerCatch(_0x0093('0x108')));}if(_0xdaa549&&_0xdaa549[_0x0093('0x4e')]!=='ivr'&&isNotNull(this['voiceQueues'][_0xdaa549[_0x0093('0xb3')]][_0x0093('0x109')])){delete this[_0x0093('0x24')][_0x15e8bf[_0x0093('0xdb')]];this[_0x0093('0xb2')](this['voiceQueues'][_0xdaa549[_0x0093('0xb3')]]);this[_0x0093('0x1e')][_0xdaa549[_0x0093('0xb3')]][_0x0093('0x5e')]+=0x1;this[_0x0093('0x1e')][_0xdaa549['queue']][_0x0093('0x5d')]+=0x1;_0x201426=new Hangup(_0xdaa549,_0x15e8bf);_0x201426['state']=0x10;_0x201426['statedesc']='AnswerAGI';_0x201426[_0x0093('0xe4')]=_0x0093('0x10a');this[_0x0093('0xca')](_0x201426)['catch'](loggerCatch(_0x0093('0x107')));this[_0x0093('0xc9')](_0x201426)['catch'](loggerCatch('[syncHangupIvr]'));}if(_0xdaa549&&_0xdaa549[_0x0093('0x4e')]!==_0x0093('0x7c')&&!isNotNull(this[_0x0093('0x1e')][_0xdaa549[_0x0093('0xb3')]][_0x0093('0x109')])){delete this[_0x0093('0x24')][_0x15e8bf[_0x0093('0xdb')]];this[_0x0093('0xb2')](this['voiceQueues'][_0xdaa549[_0x0093('0xb3')]]);this['voiceQueues'][_0xdaa549['queue']]['outboundUnknownCallsDay']+=0x1;_0x201426=new Hangup(_0xdaa549,_0x15e8bf);_0x201426[_0x0093('0xa8')]=0xc;_0x201426['statedesc']=_0x15e8bf[_0x0093('0x10b')];_0x201426[_0x0093('0xe4')]=_0x0093('0x10c');this['createHistory'](_0x201426)[_0x0093('0xb7')](loggerCatch(_0x0093('0x107')));this[_0x0093('0xc9')](_0x201426)[_0x0093('0xb7')](loggerCatch(_0x0093('0x108')));}};Dialer[_0x0093('0x1a')]['syncAgentComplete']=function(_0x19a719){var _0x20a3fe=this[_0x0093('0x24')][_0x19a719[_0x0093('0xdb')]];var _0x19d8d9=this;if(this[_0x0093('0x1e')][_0x19a719[_0x0093('0xb3')]]){if(_0x20a3fe&&_0x20a3fe[_0x0093('0x4e')]!==_0x0093('0x7c')){delete this[_0x0093('0x24')][_0x19a719[_0x0093('0xdb')]];this[_0x0093('0x1e')][_0x19a719[_0x0093('0xb3')]][_0x0093('0x5e')]+=0x1;var _0x486916=new AgentComplete(_0x20a3fe,_0x19a719);if(_0x19a719[_0x0093('0x10d')]===_0x0093('0x10e')){_0x486916[_0x0093('0x10f')]=this[_0x0093('0x1e')][_0x19a719[_0x0093('0xb3')]][_0x0093('0x110')]&&this[_0x0093('0x1e')][_0x19a719[_0x0093('0xb3')]][_0x0093('0x111')]?moment()[_0x0093('0x7a')](_0x0093('0xfb')):undefined;}this[_0x0093('0xca')](_0x486916)['catch'](loggerCatch(_0x0093('0x112')));this['moveContactManagedDialer'](_0x486916)[_0x0093('0xb7')](loggerCatch(_0x0093('0x113')));}}};Dialer['prototype'][_0x0093('0x2a')]=function(_0x5313bd){if(this[_0x0093('0x1e')][_0x5313bd[_0x0093('0xb3')]]){if(this[_0x0093('0x24')][_0x5313bd[_0x0093('0xdb')]]&&this[_0x0093('0x24')][_0x5313bd[_0x0093('0xdb')]]['type']!==_0x0093('0x7c')){this[_0x0093('0xb2')](this[_0x0093('0x1e')][_0x5313bd[_0x0093('0xb3')]]);this['uniqueId'][_0x5313bd[_0x0093('0xdb')]][_0x0093('0x114')]=moment()['format'](_0x0093('0xfb'));}}};Dialer[_0x0093('0x1a')][_0x0093('0x115')]=function(_0x2f6061){this['createHistory'](_0x2f6061)[_0x0093('0xb7')](loggerCatch(_0x0093('0x112')));this[_0x0093('0xc9')](_0x2f6061)[_0x0093('0xb7')](loggerCatch(_0x0093('0x116')));};Dialer[_0x0093('0x1a')]['syncQueueCallerAbandon']=function(_0x1831aa){var _0x14a186=this[_0x0093('0x24')][_0x1831aa[_0x0093('0xdb')]];var _0x3f9a95=this;if(this[_0x0093('0x1e')][_0x1831aa[_0x0093('0xb3')]]){if(_0x14a186&&_0x14a186[_0x0093('0x4e')]!==_0x0093('0x7c')){delete this[_0x0093('0x24')][_0x1831aa[_0x0093('0xdb')]];this[_0x0093('0xb2')](this[_0x0093('0x1e')][_0x1831aa['queue']]);_0x14a186[_0x0093('0x117')]=moment()[_0x0093('0x7a')](_0x0093('0xfb'));var _0x3ef1a1=new QueueCallerAbandon(_0x14a186,_0x1831aa);if(getSeconds(_0x14a186[_0x0093('0x117')],_0x14a186[_0x0093('0x118')])>=_0x14a186[_0x0093('0x119')]){this[_0x0093('0x1e')][_0x1831aa[_0x0093('0xb3')]][_0x0093('0x6b')]+=0x1;this['voiceQueues'][_0x1831aa[_0x0093('0xb3')]][_0x0093('0x63')]+=0x1;this[_0x0093('0x1e')][_0x1831aa[_0x0093('0xb3')]][_0x0093('0x6c')]+=0x1;_0x3ef1a1[_0x0093('0xa8')]=0xa;_0x3ef1a1[_0x0093('0xeb')]=_0x0093('0x11a');_0x3ef1a1[_0x0093('0x11b')]=_0x0093('0x11c');_0x3ef1a1[_0x0093('0x10f')]=this['voiceQueues'][_0x1831aa[_0x0093('0xb3')]]['dialQueueProject2']?moment()[_0x0093('0x7a')](_0x0093('0xfb')):undefined;_0x3ef1a1['countdropretry']+=0x1;_0x3ef1a1[_0x0093('0xed')]+=0x1;if(_0x3ef1a1[_0x0093('0x11d')]>=this['voiceQueues'][_0x1831aa[_0x0093('0xb3')]]['dialDropMaxRetry']){this[_0x0093('0x115')](_0x3ef1a1);}else{this[_0x0093('0xc0')]({'active':![],'countdropretry':_0x3ef1a1[_0x0093('0x11d')],'scheduledat':moment()[_0x0093('0x103')](this[_0x0093('0x1e')][_0x1831aa[_0x0093('0xb3')]][_0x0093('0x11e')],'minutes')[_0x0093('0x7a')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x14a186['ContactId'],'ListId':_0x14a186[_0x0093('0xd1')],'VoiceQueueId':_0x14a186['VoiceQueueId']||undefined,'CampaignId':_0x14a186['CampaignId']||undefined})[_0x0093('0xb7')](loggerCatch('[rescheduleContact][Drop]'));var _0x4bfa41=new History(_0x3ef1a1);_0x4bfa41[_0x0093('0xa8')]=0xa;_0x4bfa41[_0x0093('0xeb')]='Drop';_0x4bfa41[_0x0093('0x11f')]=moment()['format'](_0x0093('0xfb'));_0x4bfa41[_0x0093('0x120')]=_0x4bfa41[_0x0093('0x11f')];_0x4bfa41[_0x0093('0x121')]=_0x3ef1a1['calleridname'];_0x4bfa41['calleridnum']=_0x3ef1a1[_0x0093('0x122')];this[_0x0093('0xca')](_0x4bfa41)[_0x0093('0xb7')](loggerCatch(_0x0093('0x123')));}}else{this[_0x0093('0x1e')][_0x1831aa[_0x0093('0xb3')]][_0x0093('0x6a')]+=0x1;this[_0x0093('0x1e')][_0x1831aa['queue']][_0x0093('0x124')]+=0x1;_0x3ef1a1[_0x0093('0xa8')]=0xb;_0x3ef1a1[_0x0093('0xeb')]=_0x0093('0x125');_0x3ef1a1[_0x0093('0x11b')]='CALLEREXIT';_0x3ef1a1[_0x0093('0xf3')]+=0x1;_0x3ef1a1[_0x0093('0xed')]+=0x1;if(_0x3ef1a1[_0x0093('0xf3')]>=this[_0x0093('0x1e')][_0x1831aa[_0x0093('0xb3')]][_0x0093('0x126')]){this[_0x0093('0x115')](_0x3ef1a1);}else{this['rescheduleContact']({'active':![],'countabandonedretry':_0x3ef1a1['countabandonedretry'],'scheduledat':moment()[_0x0093('0x103')](this[_0x0093('0x1e')][_0x1831aa[_0x0093('0xb3')]][_0x0093('0x127')],_0x0093('0x104'))[_0x0093('0x7a')](_0x0093('0xfb')),'ContactId':_0x14a186['ContactId'],'ListId':_0x14a186[_0x0093('0xd1')],'VoiceQueueId':_0x14a186[_0x0093('0xd3')]||undefined,'CampaignId':_0x14a186[_0x0093('0xfc')]||undefined})[_0x0093('0xb7')](loggerCatch('[rescheduleContact][Abandoned]'));var _0x4bfa41=new History(_0x3ef1a1);_0x4bfa41['state']=0xb;_0x4bfa41[_0x0093('0xeb')]=_0x0093('0x125');_0x4bfa41[_0x0093('0x11f')]=moment()[_0x0093('0x7a')](_0x0093('0xfb'));_0x4bfa41[_0x0093('0x120')]=_0x4bfa41[_0x0093('0x11f')];_0x4bfa41['calleridname']=_0x3ef1a1['calleridname'];_0x4bfa41[_0x0093('0x122')]=_0x3ef1a1[_0x0093('0x122')];this[_0x0093('0xca')](_0x4bfa41)[_0x0093('0xb7')](loggerCatch('[syncAgentComplete][createHistory][11]'));}}}}};Dialer[_0x0093('0x1a')][_0x0093('0x33')]=function(_0x43ebbe){if(this[_0x0093('0xac')][_0x43ebbe['uniqueid']]){this['actions'][_0x43ebbe['uniqueid']][_0x0093('0xb0')]=_0x43ebbe[_0x0093('0xb0')];}if(this[_0x0093('0x24')][_0x43ebbe[_0x0093('0xdb')]]){this['uniqueId'][_0x43ebbe[_0x0093('0xdb')]][_0x0093('0xb0')]=_0x43ebbe[_0x0093('0xb0')];}};Dialer[_0x0093('0x1a')][_0x0093('0x37')]=function(_0x2ba78b){if(strategy[this[_0x0093('0x1e')][this[_0x0093('0xac')][_0x2ba78b[_0x0093('0x128')]][_0x0093('0xb3')]][_0x0093('0x129')]]===_0x0093('0x19')){if(this[_0x0093('0xac')][_0x2ba78b[_0x0093('0x128')]]&&_[_0x0093('0xdc')](this['actions'][_0x2ba78b[_0x0093('0x128')]][_0x0093('0x12a')])&&_0x2ba78b[_0x0093('0xaf')]==='1'&&_0x2ba78b[_0x0093('0x12b')]==='0'){if(this[_0x0093('0x20')][_0x2ba78b[_0x0093('0x12c')]]){if(!this[_0x0093('0x20')][_0x2ba78b[_0x0093('0x12c')]][_0x0093('0x12a')]){this[_0x0093('0x20')][_0x2ba78b['stateinterface']][_0x0093('0x12a')]=!![];this[_0x0093('0xac')][_0x2ba78b['actionid']][_0x0093('0x12a')]=!![];this[_0x0093('0xac')][_0x2ba78b['actionid']][_0x0093('0x12c')]=_0x2ba78b[_0x0093('0x12c')];}}}}else if((strategy[this[_0x0093('0x1e')][this[_0x0093('0xac')][_0x2ba78b['actionid']][_0x0093('0xb3')]][_0x0093('0x129')]]||_0x0093('0x18'))==='rrmemory'){if(this[_0x0093('0xac')][_0x2ba78b[_0x0093('0x128')]]){if(this[_0x0093('0x20')][_0x2ba78b['stateinterface']]){this['actions'][_0x2ba78b[_0x0093('0x128')]]['stateinterface']=_0x2ba78b['stateinterface'];if(_[_0x0093('0xdc')](this[_0x0093('0x28')][this[_0x0093('0xac')][_0x2ba78b[_0x0093('0x128')]]['queue']])){this['queueBooked'][this[_0x0093('0xac')][_0x2ba78b[_0x0093('0x128')]][_0x0093('0xb3')]]=[];}this[_0x0093('0x28')][this[_0x0093('0xac')][_0x2ba78b[_0x0093('0x128')]][_0x0093('0xb3')]][_0x0093('0x12d')](_[_0x0093('0x8e')](_[_0x0093('0xcf')](this[_0x0093('0xac')][_0x2ba78b[_0x0093('0x128')]],[_0x0093('0x12e'),_0x0093('0x12c')]),{'status':_0x2ba78b[_0x0093('0xaf')],'paused':_0x2ba78b['paused']}));}}}};function unlockQueueStatus(_0x175396,_0x302a0f){setTimeout(function(){if(_[_0x0093('0x3d')](_0x175396[_0x0093('0x12f')])){loggerBooked[_0x0093('0x98')]('[unlockQueueStatus][undefined]',_0x302a0f);}_0x175396[_0x0093('0x12f')]=!![];loggerBooked[_0x0093('0x7e')](_0x0093('0x130'),_0x302a0f,JSON[_0x0093('0x4a')](_[_0x0093('0xcf')](_0x175396,[_0x0093('0x3f'),_0x0093('0x12f')])));},0x1f3);}Dialer[_0x0093('0x1a')]['syncQueueStatusComplete']=function(_0x3468ca){var _0x3b63de=this;var _0x622911=_0x3b63de[_0x0093('0x1e')][_0x3b63de[_0x0093('0xac')][_0x3468ca['actionid']]['queue']];if(strategy[this[_0x0093('0x1e')][this[_0x0093('0xac')][_0x3468ca[_0x0093('0x128')]]['queue']]['strategy']]==='roundrobin'){if(this[_0x0093('0xac')][_0x3468ca[_0x0093('0x128')]]&&this[_0x0093('0xac')][_0x3468ca[_0x0093('0x128')]][_0x0093('0x12c')]){this['preview'][_0x0093('0x131')](this[_0x0093('0xac')][_0x3468ca[_0x0093('0x128')]]['idHopper'],this[_0x0093('0xac')][_0x3468ca[_0x0093('0x128')]][_0x0093('0x12c')])[_0x0093('0xb7')](function(_0x890fd5){logger[_0x0093('0x98')]('[Catch][Preview][syncQueueStatusComplete]',util[_0x0093('0x97')](_0x890fd5,{'showHidden':![],'depth':null}));})['finally'](function(){_0x3b63de[_0x0093('0xb2')](_0x3b63de[_0x0093('0x1e')][_0x3b63de[_0x0093('0xac')][_0x3468ca[_0x0093('0x128')]][_0x0093('0xb3')]]);_0x3b63de[_0x0093('0x20')][_0x3b63de[_0x0093('0xac')][_0x3468ca[_0x0093('0x128')]]['stateinterface']]['locked']=![];delete _0x3b63de['actions'][_0x3468ca[_0x0093('0x128')]];unlockQueueStatus(_0x622911);});}else{this[_0x0093('0xb2')](this[_0x0093('0x1e')][this[_0x0093('0xac')][_0x3468ca[_0x0093('0x128')]]['queue']]);this[_0x0093('0xc0')]({'active':![],'ContactId':this[_0x0093('0xac')][_0x3468ca[_0x0093('0x128')]][_0x0093('0xd0')],'ListId':this['actions'][_0x3468ca[_0x0093('0x128')]][_0x0093('0xd1')],'VoiceQueueId':this['actions'][_0x3468ca[_0x0093('0x128')]]['VoiceQueueId']||undefined,'CampaignId':this[_0x0093('0xac')][_0x3468ca['actionid']][_0x0093('0xfc')]||undefined})[_0x0093('0xb7')](loggerCatch('[unlock][syncQueueStatusComplete]'));delete this[_0x0093('0xac')][_0x3468ca[_0x0093('0x128')]];unlockQueueStatus(_0x622911);}}else if((strategy[this[_0x0093('0x1e')][this['actions'][_0x3468ca['actionid']][_0x0093('0xb3')]][_0x0093('0x129')]]||_0x0093('0x18'))===_0x0093('0x18')){var _0x244715;if(this[_0x0093('0xac')][_0x3468ca[_0x0093('0x128')]]&&!_['isEmpty'](this[_0x0093('0x28')][this[_0x0093('0xac')][_0x3468ca[_0x0093('0x128')]][_0x0093('0xb3')]])){if(this[_0x0093('0x29')][_0x3b63de['actions'][_0x3468ca[_0x0093('0x128')]][_0x0093('0xb3')]]){this[_0x0093('0x29')][_0x3b63de[_0x0093('0xac')][_0x3468ca['actionid']]['queue']]=this['queueBookedRR'][this[_0x0093('0xac')][_0x3468ca[_0x0093('0x128')]][_0x0093('0xb3')]]?this[_0x0093('0x29')][this[_0x0093('0xac')][_0x3468ca[_0x0093('0x128')]]['queue']]:this[_0x0093('0x28')][this[_0x0093('0xac')][_0x3468ca[_0x0093('0x128')]][_0x0093('0xb3')]]?this['queueBooked'][this[_0x0093('0xac')][_0x3468ca[_0x0093('0x128')]][_0x0093('0xb3')]][_0x0093('0x132')]||0x0:0x0;}this[_0x0093('0x28')][this[_0x0093('0xac')][_0x3468ca[_0x0093('0x128')]][_0x0093('0xb3')]][_0x0093('0x132')]=this['queueBookedRR'][this[_0x0093('0xac')][_0x3468ca[_0x0093('0x128')]][_0x0093('0xb3')]];for(var _0x4bd22a=0x0;_0x4bd22a=0x0;})['catch'](myreject(_0x343252)));}}else{_0x180d9f[_0x0093('0x12d')](ami[_0x0093('0xae')]({'action':_0x0093('0x149'),'command':util['format'](_0x0093('0x14a'),_0x4c887a,!_[_0x0093('0x3d')](config['timezones'][_0x31feb3])?_0x31feb3:'')})['then'](function(_0x223582){return _0x223582['content'][_0x0093('0x14d')](_0x0093('0x14e'))>=0x0;})[_0x0093('0xb7')](myreject(_0x343252)));}BPromise[_0x0093('0x14f')](_0x180d9f)[_0x0093('0x3c')](function(_0x20586c){var _0x1227b5=_[_0x0093('0x150')](_0x20586c);if(_0x1227b5){return _0x34141e(_0x1227b5);}else{_0xc19dd6['message']=_0x5f1dcc?_0x0093('0x151'):_0x0093('0x152');return _0x343252(msgResponse(_0x0093('0x153'),_0x0093('0x143'),_0x0093('0x154')+_0x5f1dcc+'\x20'+_0x12ae1c+'\x20Interval\x20is\x20overtime:\x20'+util[_0x0093('0x97')](_0x4c887a,{'showHidden':![],'depth':null})+_0x0093('0x155')+_0x31feb3));}})[_0x0093('0xb7')](function(_0x51e300){return _0x343252(msgResponse(_0x0093('0x142'),_0x0093('0x143'),JSON[_0x0093('0x4a')](_0x51e300)));});});};Dialer[_0x0093('0x1a')][_0x0093('0x156')]=function(_0x4e4e0f){var _0x3a6363=this;return function(){switch(_0x4e4e0f[_0x0093('0x157')]){case'progressive':freeVariablesPredictive(_0x4e4e0f);_0x3a6363['handlePower'](_0x4e4e0f,0x1);break;case _0x0093('0x158'):freeVariablesPredictive(_0x4e4e0f);_0x3a6363[_0x0093('0x159')](_0x4e4e0f,_0x4e4e0f['dialPowerLevel']);break;case _0x0093('0x15a'):_0x3a6363[_0x0093('0x15a')](_0x4e4e0f);break;case _0x0093('0x6'):freeVariablesPredictive(_0x4e4e0f);_0x3a6363['handlePower'](_0x4e4e0f,0x1);break;default:freeVariablesPredictive(_0x4e4e0f);logger[_0x0093('0x98')](_0x0093('0x15b'),_0x4e4e0f[_0x0093('0x3f')],_0x0093('0x15c'));}};};Dialer['prototype'][_0x0093('0x15d')]=_['throttle'](function(_0x4c82b4){return BPromise['resolve']()[_0x0093('0x3c')](cmHopper[_0x0093('0x15e')](_0x4c82b4['id'],previewRecallmeReminderInterval))[_0x0093('0x3c')](function(_0x3e8273){for(var _0x533074=0x0;_0x533074<_0x3e8273['length'];_0x533074++){var _0x3ed365=_0x3e8273[_0x533074]['Agent']['name'];if(_0x3ed365)io['to'](util[_0x0093('0x7a')]('user:%s',_0x3ed365))[_0x0093('0x4d')](_0x0093('0x15f'),{'hopper':_0x3e8273[_0x533074]});}})[_0x0093('0xb7')](function(_0x13adf2){logger[_0x0093('0x98')](_0x0093('0x15d'),_0x13adf2);});},0x3c*0x3e8,{'leading':!![]});Dialer['prototype'][_0x0093('0x160')]=function(_0x286beb){var _0x419c7d=this;return function(){_0x419c7d[_0x0093('0x161')](_0x286beb);};};Dialer[_0x0093('0x1a')][_0x0093('0x8')]=function(_0x5a1649){var _0x58468e=this;if(isNotPreview(_0x5a1649[_0x0093('0x157')])){if(isVoiceQueueOutbound(_0x5a1649['type'])&&isActive(_0x5a1649[_0x0093('0x59')])){_0x5a1649['sendMessageOneNotActive']=!![];BPromise['resolve']()[_0x0093('0x3c')](checkIsLoggedIn(_0x5a1649,_0x5a1649['loggedIn']))['then'](checkIsActive(_0x5a1649,_0x5a1649['dialActive']))[_0x0093('0x3c')](checkInterval(_0x5a1649))[_0x0093('0x3c')](_0x58468e[_0x0093('0x162')](_0x5a1649))[_0x0093('0x3c')](_0x58468e[_0x0093('0x141')](_0x5a1649[_0x0093('0x163')],_0x5a1649[_0x0093('0x164')],_0x5a1649['name'],_0x5a1649))['then'](_0x58468e[_0x0093('0x165')](_0x5a1649[_0x0093('0x43')],_0x5a1649[_0x0093('0x164')],_0x5a1649[_0x0093('0x3f')],_0x5a1649))[_0x0093('0x3c')](_0x58468e[_0x0093('0x156')](_0x5a1649))[_0x0093('0xb7')](loggerCatchQueueSummary(_0x0093('0x166'),_0x5a1649));}else{notSendMessagesQueue(_0x5a1649);}}else{freeVariablesPredictive(_0x5a1649);if(_0x5a1649[_0x0093('0x167')]){_0x58468e['checkPreviewRecallReminder'](_0x5a1649);}}};Dialer['prototype'][_0x0093('0x13d')]=function(){var _0x48c811=this;var _0x164dbd;for(var _0x1c9b14 in this['campaigns']){if(typeof this[_0x0093('0x1f')][_0x1c9b14]!==_0x0093('0x9a')){_0x164dbd=this[_0x0093('0x1f')][_0x1c9b14];if(isCampaignIvr(_0x164dbd[_0x0093('0x4e')])&&isActive(_0x164dbd[_0x0093('0x77')])){_0x164dbd[_0x0093('0xa1')]=!![];BPromise['resolve']()['then'](checkIsActive(_0x164dbd,_0x164dbd[_0x0093('0x77')]))['then'](checkInterval(_0x164dbd))[_0x0093('0x3c')](_0x48c811[_0x0093('0x162')](_0x164dbd))['then'](_0x48c811[_0x0093('0x141')](_0x164dbd['dialGlobalInterval'],_0x164dbd['dialTimezone'],_0x164dbd[_0x0093('0x3f')],_0x164dbd))['then'](_0x48c811[_0x0093('0x165')](_0x164dbd[_0x0093('0x43')],_0x164dbd['dialTimezone'],_0x164dbd[_0x0093('0x3f')],_0x164dbd))['then'](_0x48c811['launchHandleIvr'](_0x164dbd))[_0x0093('0xb7')](loggerCatchQueueSummary(_0x0093('0x168'),_0x164dbd));}else{notSendMessagesCampaign(_0x164dbd);}}}};function getCallerIdRandom(_0x378725,_0x5a3b54){var _0x49c3ec;var _0x1c8fe0;var _0x1fbb3d;if(_0x5a3b54<=0x0){_0x5a3b54=0x1;}_0x49c3ec=new RegExp(_0x0093('0x169')+_0x5a3b54+'}$');_0x1c8fe0=Math[_0x0093('0x16a')](0xa,_0x5a3b54-0x1);_0x1fbb3d=Math[_0x0093('0x16a')](0xa,_0x5a3b54)-0x1;return util[_0x0093('0x7a')]('%s',_[_0x0093('0x16b')](_0x378725,_0x49c3ec,_[_0x0093('0x16c')](_0x1c8fe0,_0x1fbb3d)));}function extractCalleridName(_0xf09e69){var _0x16b322=_0xf09e69[_0x0093('0x16d')](/"(.*?)"/);return _0x16b322?_0x16b322[0x1]:_0xf09e69;}function extractCalleridNumber(_0xade30a){var _0x30627e=_0xade30a[_0x0093('0x16d')](/<(.*?)>/);return _0x30627e?_0x30627e[0x1]:_0xade30a;}Dialer['prototype'][_0x0093('0x16e')]=function(_0x41c767,_0x4e448a){var _0x51a037=this;var _0x3c90e0=uuid['v4']();this[_0x0093('0xac')][_0x3c90e0]=new Action(_0x41c767,_0x4e448a,_0x3c90e0);return new BPromise(function(_0x42e634,_0x4fd3c3){if(_[_0x0093('0x3d')](_0x41c767)&&typeof _0x41c767!==_0x0093('0x16f')){return _0x4fd3c3(msgResponse(_0x0093('0x170'),_0x0093('0x143'),'voiceQueue\x20is\x20undefine'));}if(_['isUndefined'](_0x4e448a['Contact']['phone'])||_0x4e448a[_0x0093('0x171')][_0x0093('0x172')]===null){return _0x4fd3c3(msgResponse(_0x0093('0x170'),_0x0093('0x143'),_0x0093('0x173')));}var _0x1fb447={'XMD-CALLERID':_0x51a037[_0x0093('0xac')][_0x3c90e0][_0x0093('0x174')](),'XMD-AGI':_0x41c767[_0x0093('0x109')]?util[_0x0093('0x7a')]('\x22agi://%s/square,%s\x22',ipAgi,_0x41c767[_0x0093('0x109')]):_0x0093('0x175'),'XMD-AGIAFTER':_0x41c767[_0x0093('0x110')]?util[_0x0093('0x7a')](_0x0093('0x176'),ipAgi,_0x41c767[_0x0093('0x110')]):_0x0093('0x175'),'XMD-QUEUE':_0x41c767[_0x0093('0x4e')]===_0x0093('0x4f')?util[_0x0093('0x7a')](_0x0093('0x177'),_0x41c767[_0x0093('0x3f')],_0x41c767[_0x0093('0x178')]||'',_0x41c767[_0x0093('0x111')]?'c':'',_0x41c767[_0x0093('0x119')]||0x3):'NONE','XMD-CONTACTID':_0x4e448a[_0x0093('0xd0')],'XMD-CDRTYPE':_0x0093('0x5'),'CALLERID(all)':_0x51a037['actions'][_0x3c90e0][_0x0093('0x174')](),'XMD-AMD':_0x41c767[_0x0093('0xe1')]?'ACTIVE':_0x0093('0x175'),'XMD-DESTINATION':_0x0093('0xe0')};if(_0x41c767[_0x0093('0xe1')]){_0x1fb447[_0x0093('0x179')]=_0x41c767[_0x0093('0x17a')]||0x9c4;_0x1fb447[_0x0093('0x17b')]=_0x41c767['dialAMDGreeting']||0x5dc;_0x1fb447[_0x0093('0x17c')]=_0x41c767['dialAMDAfterGreetingSilence']||0x320;_0x1fb447[_0x0093('0x17d')]=_0x41c767[_0x0093('0x17e')]||0x1388;_0x1fb447['XMD-AMDMINWORDLENGTH']=_0x41c767['dialAMDMinWordLength']||0x64;_0x1fb447['XMD-AMDBETWEENWORDSSILENCE']=_0x41c767[_0x0093('0x17f')]||0x32;_0x1fb447[_0x0093('0x180')]=_0x41c767[_0x0093('0x181')]||0x3;_0x1fb447[_0x0093('0x182')]=_0x41c767[_0x0093('0x183')]||0x100;_0x1fb447[_0x0093('0x184')]=_0x41c767[_0x0093('0x185')]||0x1388;}if(_0x41c767[_0x0093('0x4e')]===_0x0093('0x4f')){_0x1fb447[_0x0093('0x186')]=_0x4e448a[_0x0093('0xd3')];}else{_0x1fb447['XMD-CAMPAIGNID']=_0x4e448a[_0x0093('0xfc')];}for(var _0x1cb2dc in _0x4e448a[_0x0093('0x171')]){if(typeof _0x4e448a[_0x0093('0x171')][_0x1cb2dc]!==_0x0093('0x9a')){if(isNotNull(_0x4e448a['Contact'][_0x1cb2dc])&&_0x1cb2dc!=='id'&&_0x1cb2dc!=='tags'&&_0x1cb2dc!==_0x0093('0x187')&&_0x1cb2dc!==_0x0093('0x188')){_0x1fb447[util['format'](_0x0093('0x189'),'XMD-',_['toUpper'](_0x1cb2dc))]=_0x4e448a[_0x0093('0x171')][_0x1cb2dc];}}}var _0x3fe79b=_0x51a037['isTrunkReachable'](_0x41c767[_0x0093('0x76')])?getCallerId(_0x41c767[_0x0093('0x76')]['callerid'],_0x41c767[_0x0093('0x5a')],_0x41c767['dialRandomLastDigitCallerIdNumber']>0x0?getCallerIdRandom(_0x41c767[_0x0093('0x18a')],_0x41c767['dialRandomLastDigitCallerIdNumber']):_0x41c767[_0x0093('0x18a')]):getCallerId(_[_0x0093('0xdc')](_0x41c767[_0x0093('0x13e')])?_0x41c767[_0x0093('0x76')][_0x0093('0x78')]:_0x41c767[_0x0093('0x13e')][_0x0093('0x78')],_0x41c767[_0x0093('0x5a')],_0x41c767[_0x0093('0x18b')]>0x0?getCallerIdRandom(_0x41c767['dialOriginateCallerIdNumber'],_0x41c767['dialRandomLastDigitCallerIdNumber']):_0x41c767[_0x0093('0x18a')]);if(_0x3fe79b){_0x1fb447[_0x0093('0x18c')]=_0x51a037['actions'][_0x3c90e0]['originatecalleridname']=extractCalleridName(_0x3fe79b);_0x1fb447[_0x0093('0x18d')]=_0x51a037[_0x0093('0xac')][_0x3c90e0][_0x0093('0x18e')]=extractCalleridNumber(_0x3fe79b);}return ami[_0x0093('0xae')]({'actionid':_0x3c90e0,'action':_0x0093('0x170'),'channel':_0x51a037[_0x0093('0xd8')](_0x41c767[_0x0093('0x76')])?util['format'](_0x0093('0x18f'),_0x41c767[_0x0093('0x76')][_0x0093('0x3f')],isNotNull(_0x41c767[_0x0093('0x5c')])?_0x41c767[_0x0093('0x5c')][_0x0093('0x190')]()||'':'',_0x41c767[_0x0093('0x191')]>0x0?_0x4e448a[_0x0093('0x171')][_0x0093('0x172')][_0x0093('0x192')](_0x41c767[_0x0093('0x191')]):_0x4e448a['Contact'][_0x0093('0x172')]):util[_0x0093('0x7a')]('SIP/%s/%s%s',_['isNil'](_0x41c767[_0x0093('0x13e')])?_0x41c767['Trunk'][_0x0093('0x3f')]:_0x41c767[_0x0093('0x13e')][_0x0093('0x3f')],isNotNull(_0x41c767[_0x0093('0x5c')])?_0x41c767['dialPrefix'][_0x0093('0x190')]()||'':'',_0x41c767[_0x0093('0x191')]>0x0?_0x4e448a[_0x0093('0x171')]['phone']['substring'](_0x41c767[_0x0093('0x191')]):_0x4e448a['Contact'][_0x0093('0x172')]),'callerid':_0x3fe79b,'Exten':'xcally-motion-dialer','Context':'from-sip','Priority':'1','variable':_0x1fb447,'timeout':(_0x41c767['dialOriginateTimeout']||0x1e)*0x3e8,'async':!![],'channelid':_0x3c90e0})[_0x0093('0x3c')](function(_0x470bfc){return _0x42e634(_0x470bfc);})[_0x0093('0xb7')](function(_0x4ec80b){_0x41c767[_0x0093('0x193')]+=0x1;var _0x59b5c1=new History(_0x51a037[_0x0093('0xac')][_0x3c90e0]);logger[_0x0093('0x98')](util[_0x0093('0x7a')](_0x0093('0x194'),JSON[_0x0093('0x4a')](_0x4ec80b)));_0x59b5c1['state']=0xe;_0x59b5c1['statedesc']=_0x0093('0x195');_0x59b5c1['starttime']=moment()[_0x0093('0x7a')](_0x0093('0xfb'));_0x59b5c1[_0x0093('0x120')]=_0x59b5c1[_0x0093('0x11f')];_0x51a037[_0x0093('0xca')](_0x59b5c1)[_0x0093('0xb7')](loggerCatch(_0x0093('0x196')));_0x51a037[_0x0093('0xc9')](_0x59b5c1)['catch'](loggerCatch(_0x0093('0x196')))[_0x0093('0x1d')](function(){delete _0x51a037[_0x0093('0xac')][_0x3c90e0];return _0x4fd3c3(msgResponse(_0x0093('0x170'),'Error','originate\x20action\x20Error'));});});});};Dialer[_0x0093('0x1a')][_0x0093('0x2e')]=function(_0x449425){var _0x1d5c41=this[_0x0093('0xac')][_0x449425['actionid']];if(_0x1d5c41){delete this[_0x0093('0xac')][_0x449425[_0x0093('0x128')]];_0x1d5c41['responsetime']=moment()[_0x0093('0x7a')]('YYYY-MM-DD\x20HH:mm:ss');var _0x2b6199=_0x1d5c41[_0x0093('0x4e')]==='ivr'?this[_0x0093('0x1f')][_0x1d5c41[_0x0093('0xb3')]]:this[_0x0093('0x1e')][_0x1d5c41['getQueue']()];if(!this[_0x0093('0xd6')](_0x449425[_0x0093('0x197')])){this[_0x0093('0xb2')](_0x2b6199);return this[_0x0093('0x198')](_0x1d5c41,_0x2b6199,_0x449425)[_0x0093('0xb7')](loggerCatch(_0x0093('0x199')));}this[_0x0093('0x24')][_0x449425[_0x0093('0xdb')]]=_0x1d5c41;}};Dialer['prototype']['checkRetriveMax']=function(_0x30ca2a,_0x20ce02,_0x51215a){var _0x256a11=new History(_0x20ce02);if(_0x256a11[_0x0093('0x101')]+_0x256a11[_0x0093('0xf0')]+_0x256a11['countnoanswerretry']+_0x256a11['countnosuchnumberretry']+_0x256a11[_0x0093('0x11d')]+_0x256a11['countabandonedretry']+_0x256a11['countmachineretry']+_0x256a11['countagentrejectretry']>=_0x51215a['dialGlobalMaxRetry']-0x1){return!![];}switch(_0x30ca2a){case 0x3:if(_0x256a11[_0x0093('0xf1')]>=_0x51215a[_0x0093('0x19a')]-0x1){return!![];}this[_0x0093('0xc0')]({'active':![],'countnoanswerretry':_0x256a11[_0x0093('0xf1')]+=0x1,'scheduledat':moment()[_0x0093('0x103')](_0x51215a[_0x0093('0x19b')],_0x0093('0x104'))[_0x0093('0x7a')](_0x0093('0xfb')),'ContactId':_0x256a11['ContactId'],'ListId':_0x256a11['ListId'],'VoiceQueueId':_0x256a11['VoiceQueueId']||undefined,'CampaignId':_0x256a11['CampaignId']||undefined})['catch'](loggerCatch(_0x0093('0x19c')));break;case 0x5:if(_0x256a11[_0x0093('0x101')]>=_0x51215a['dialBusyMaxRetry']-0x1){return!![];}this[_0x0093('0xc0')]({'active':![],'countbusyretry':_0x256a11[_0x0093('0x101')]+=0x1,'scheduledat':moment()[_0x0093('0x103')](_0x51215a['dialBusyRetryFrequency'],_0x0093('0x104'))[_0x0093('0x7a')](_0x0093('0xfb')),'ContactId':_0x256a11[_0x0093('0xd0')],'ListId':_0x256a11[_0x0093('0xd1')],'VoiceQueueId':_0x256a11[_0x0093('0xd3')]||undefined,'CampaignId':_0x256a11[_0x0093('0xfc')]||undefined})[_0x0093('0xb7')](loggerCatch(_0x0093('0x19d')));break;case 0x8:if(_0x256a11['countcongestionretry']>=_0x51215a[_0x0093('0x19e')]-0x1){return!![];}this[_0x0093('0xc0')]({'active':![],'countcongestionretry':_0x256a11['countcongestionretry']+=0x1,'scheduledat':moment()['add'](_0x51215a[_0x0093('0x19f')],_0x0093('0x104'))[_0x0093('0x7a')](_0x0093('0xfb')),'ContactId':_0x256a11['ContactId'],'ListId':_0x256a11[_0x0093('0xd1')],'VoiceQueueId':_0x256a11[_0x0093('0xd3')]||undefined,'CampaignId':_0x256a11['CampaignId']||undefined})[_0x0093('0xb7')](loggerCatch('[rescheduleContact]\x20[Congestion]'));break;case 0x0:if(_0x256a11[_0x0093('0xf2')]>=_0x51215a[_0x0093('0x1a0')]-0x1){return!![];}else{this[_0x0093('0xc0')]({'active':![],'countnosuchnumberretry':_0x256a11[_0x0093('0xf2')]+=0x1,'scheduledat':moment()[_0x0093('0x103')](_0x51215a[_0x0093('0x1a1')],_0x0093('0x104'))[_0x0093('0x7a')](_0x0093('0xfb')),'ContactId':_0x256a11[_0x0093('0xd0')],'ListId':_0x256a11[_0x0093('0xd1')],'VoiceQueueId':_0x256a11[_0x0093('0xd3')]||undefined,'CampaignId':_0x256a11[_0x0093('0xfc')]||undefined})[_0x0093('0xb7')](loggerCatch(_0x0093('0x1a2')));}break;case 0xa:if(_0x256a11[_0x0093('0x11d')]>=_0x51215a[_0x0093('0x1a3')]-0x1){return!![];}this[_0x0093('0xc0')]({'active':![],'countdropretry':_0x256a11[_0x0093('0x11d')]+=0x1,'scheduledat':moment()[_0x0093('0x103')](_0x51215a['dialDropRetryFrequency'],_0x0093('0x104'))['format'](_0x0093('0xfb')),'ContactId':_0x256a11[_0x0093('0xd0')],'ListId':_0x256a11[_0x0093('0xd1')],'VoiceQueueId':_0x256a11[_0x0093('0xd3')]||undefined,'CampaignId':_0x256a11[_0x0093('0xfc')]||undefined})[_0x0093('0xb7')](loggerCatch(_0x0093('0x1a4')));break;case 0xb:if(_0x256a11['countabandonedretry']>=_0x51215a[_0x0093('0x126')]-0x1){return!![];}this[_0x0093('0xc0')]({'active':![],'countabandonedretry':_0x256a11[_0x0093('0xf3')]+=0x1,'scheduledat':moment()['add'](_0x51215a[_0x0093('0x127')],_0x0093('0x104'))['format'](_0x0093('0xfb')),'ContactId':_0x256a11[_0x0093('0xd0')],'ListId':_0x256a11[_0x0093('0xd1')],'VoiceQueueId':_0x256a11[_0x0093('0xd3')]||undefined,'CampaignId':_0x256a11[_0x0093('0xfc')]||undefined})[_0x0093('0xb7')](loggerCatch(_0x0093('0x1a5')));break;case 0x13:if(_0x256a11[_0x0093('0xf4')]>=_0x51215a[_0x0093('0x1a6')]-0x1){return!![];}this[_0x0093('0xc0')]({'active':![],'countmachineretry':_0x256a11[_0x0093('0xf4')]+=0x1,'scheduledat':moment()['add'](_0x51215a[_0x0093('0xfa')],'minutes')[_0x0093('0x7a')](_0x0093('0xfb')),'ContactId':_0x256a11['ContactId'],'ListId':_0x256a11[_0x0093('0xd1')],'VoiceQueueId':_0x256a11[_0x0093('0xd3')]||undefined,'CampaignId':_0x256a11['CampaignId']||undefined})[_0x0093('0xb7')](loggerCatch(_0x0093('0xfd')));break;case 0x14:if(_0x256a11[_0x0093('0xf5')]>=_0x51215a[_0x0093('0x1a7')]-0x1){return!![];}this[_0x0093('0xc0')]({'active':![],'countagentrejectretry':_0x256a11[_0x0093('0xf5')]+=0x1,'scheduledat':moment()['add'](_0x51215a[_0x0093('0x1a8')],_0x0093('0x104'))[_0x0093('0x7a')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x256a11[_0x0093('0xd0')],'ListId':_0x256a11['ListId'],'VoiceQueueId':_0x256a11[_0x0093('0xd3')]||undefined,'CampaignId':_0x256a11[_0x0093('0xfc')]||undefined})[_0x0093('0xb7')](loggerCatch('[rescheduleContact][AgentReject]'));break;default:return!![];}};Dialer[_0x0093('0x1a')][_0x0093('0x198')]=function(_0x52c67f,_0x3b4cfe,_0x4ce741){var _0x47eb1c=this;var _0x49557a=new History(_0x52c67f);return new BPromise(function(_0x4d30f2,_0x3071ba){if(_[_0x0093('0x3d')](_0x3b4cfe)&&typeof _0x3b4cfe!=='object'){return _0x3071ba(msgResponse(_0x0093('0x1a9'),_0x0093('0x143'),_0x0093('0x1aa')));}if(_[_0x0093('0x3d')](_0x4ce741)&&typeof _0x4ce741!==_0x0093('0x16f')){return _0x3071ba(msgResponse(_0x0093('0x1a9'),_0x0093('0x143'),_0x0093('0x1ab')));}switch(_0x4ce741[_0x0093('0x10d')]){case'0':_0x3b4cfe[_0x0093('0x65')]+=0x1;_0x49557a[_0x0093('0xa8')]=0x0;_0x49557a[_0x0093('0xeb')]=_0x0093('0x1ac');_0x49557a[_0x0093('0xf2')]+=0x1;_0x49557a[_0x0093('0xed')]+=0x1;ami['emit'](_0x0093('0x1ad'),ut[_0x0093('0xe7')](_0x52c67f,'nosuchnumber'));_0x47eb1c[_0x0093('0xca')](_0x49557a)[_0x0093('0xb7')](loggerCatch(_0x0093('0xef')));if(_0x47eb1c['checkRetriveMax'](0x0,_0x52c67f,_0x3b4cfe)){if(_0x49557a[_0x0093('0xf2')]>=_0x3b4cfe[_0x0093('0x1a0')]){_0x47eb1c[_0x0093('0x102')](_0x49557a,_0x4d30f2,_0x3071ba,_0x0093('0x1ae'));}else{_0x47eb1c[_0x0093('0xf7')](_0x49557a,_0x4d30f2,_0x3071ba,_0x0093('0x1ae'));}}break;case'3':_0x3b4cfe[_0x0093('0x64')]+=0x1;_0x49557a[_0x0093('0xa8')]=0x3;_0x49557a[_0x0093('0xeb')]=_0x0093('0x1af');_0x49557a['countnoanswerretry']+=0x1;_0x49557a[_0x0093('0xed')]+=0x1;ami[_0x0093('0x4d')]('custom:agentnoanswer',ut[_0x0093('0xe7')](_0x52c67f,'noanswer'));_0x47eb1c['createHistory'](_0x49557a)[_0x0093('0xb7')](loggerCatch('[syncAgentComplete][createHistory][3]'));if(_0x47eb1c[_0x0093('0x1b0')](0x3,_0x52c67f,_0x3b4cfe)){if(_0x49557a[_0x0093('0xf1')]>=_0x3b4cfe[_0x0093('0x19a')]){_0x47eb1c[_0x0093('0x102')](_0x49557a,_0x4d30f2,_0x3071ba,_0x0093('0x1b1'));}else{_0x47eb1c[_0x0093('0xf7')](_0x49557a,_0x4d30f2,_0x3071ba,_0x0093('0x1b1'));}}break;case'5':_0x3b4cfe[_0x0093('0x60')]+=0x1;_0x49557a[_0x0093('0xa8')]=0x5;_0x49557a[_0x0093('0xeb')]=_0x0093('0x1b2');_0x49557a[_0x0093('0x101')]+=0x1;_0x49557a[_0x0093('0xed')]+=0x1;ami[_0x0093('0x4d')](_0x0093('0x1b3'),ut[_0x0093('0xe7')](_0x52c67f,_0x0093('0x1b4')));_0x47eb1c[_0x0093('0xca')](_0x49557a)['catch'](loggerCatch(_0x0093('0x1b5')));if(_0x47eb1c[_0x0093('0x1b0')](0x5,_0x52c67f,_0x3b4cfe)){if(_0x49557a[_0x0093('0x101')]>=_0x3b4cfe[_0x0093('0x1b6')]){_0x47eb1c['createStateFinal'](_0x49557a,_0x4d30f2,_0x3071ba,'reason\x205\x20busy');}else{_0x47eb1c['stateGlobal'](_0x49557a,_0x4d30f2,_0x3071ba,_0x0093('0x1b7'));}}break;case'8':_0x3b4cfe[_0x0093('0x61')]+=0x1;_0x49557a[_0x0093('0xa8')]=0x8;_0x49557a[_0x0093('0xeb')]='Congestion';_0x49557a['countcongestionretry']+=0x1;_0x49557a[_0x0093('0xed')]+=0x1;ami[_0x0093('0x4d')]('custom:agentcongestion',ut[_0x0093('0xe7')](_0x52c67f,_0x0093('0x1b8')));_0x47eb1c[_0x0093('0xca')](_0x49557a)['catch'](loggerCatch(_0x0093('0x1b9')));if(_0x47eb1c['checkRetriveMax'](0x8,_0x52c67f,_0x3b4cfe)){if(_0x49557a['countcongestionretry']>=_0x3b4cfe['dialCongestionMaxRetry']){_0x47eb1c[_0x0093('0x102')](_0x49557a,_0x4d30f2,_0x3071ba,_0x0093('0x1ba'));}else{_0x47eb1c[_0x0093('0xf7')](_0x49557a,_0x4d30f2,_0x3071ba,_0x0093('0x1ba'));}}break;case'11':_0x3b4cfe[_0x0093('0x1bb')]+=0x1;_0x49557a[_0x0093('0xa8')]=0xb;_0x49557a[_0x0093('0xeb')]='Abandoned';_0x49557a[_0x0093('0xf3')]+=0x1;_0x49557a[_0x0093('0xed')]+=0x1;_0x47eb1c[_0x0093('0xca')](_0x49557a)['catch'](loggerCatch(_0x0093('0x1bc')));if(_0x47eb1c[_0x0093('0x1b0')](0xb,_0x52c67f,_0x3b4cfe)){if(_0x49557a[_0x0093('0xf3')]>=_0x3b4cfe['dialAbandonedMaxRetry']){_0x47eb1c[_0x0093('0x102')](_0x49557a,_0x4d30f2,_0x3071ba,_0x0093('0x1bd'));}else{_0x47eb1c[_0x0093('0xf7')](_0x49557a,_0x4d30f2,_0x3071ba,_0x0093('0x1bd'));}}break;case'20':_0x3b4cfe[_0x0093('0x1be')]+=0x1;_0x49557a[_0x0093('0xa8')]=0x14;_0x49557a[_0x0093('0xeb')]=_0x0093('0x1bf');_0x49557a[_0x0093('0xf5')]+=0x1;_0x49557a[_0x0093('0xed')]+=0x1;ami[_0x0093('0x4d')](_0x0093('0x1c0'),ut[_0x0093('0xe7')](_0x52c67f,_0x0093('0x1c1')));_0x47eb1c['createHistory'](_0x49557a)[_0x0093('0xb7')](loggerCatch('[syncAgentComplete][createHistory][20]'));if(_0x47eb1c[_0x0093('0x1b0')](0x14,_0x52c67f,_0x3b4cfe)){if(_0x49557a[_0x0093('0xf5')]>=_0x3b4cfe[_0x0093('0x1a7')]){_0x47eb1c[_0x0093('0x102')](_0x49557a,_0x4d30f2,_0x3071ba,_0x0093('0x1c2'));}else{_0x47eb1c[_0x0093('0xf7')](_0x49557a,_0x4d30f2,_0x3071ba,_0x0093('0x1c2'));}}break;default:_0x3b4cfe[_0x0093('0x67')]+=0x1;_0x49557a[_0x0093('0xa8')]=0xc;_0x49557a[_0x0093('0xeb')]=_0x4ce741['reason'];_0x47eb1c['createHistory'](_0x49557a)[_0x0093('0xb7')](loggerCatch(_0x0093('0x1c3')));if(_0x47eb1c[_0x0093('0x1b0')](_0x4ce741[_0x0093('0x10d')],_0x52c67f,_0x3b4cfe)){if(_0x49557a[_0x0093('0x101')]+_0x49557a['countcongestionretry']+_0x49557a[_0x0093('0xf1')]+_0x49557a[_0x0093('0xf2')]+_0x49557a['countdropretry']+_0x49557a[_0x0093('0xf3')]+_0x49557a[_0x0093('0xf4')]+_0x49557a[_0x0093('0xf5')]>=_0x3b4cfe[_0x0093('0xf6')]){_0x47eb1c[_0x0093('0xf7')](_0x49557a,_0x4d30f2,_0x3071ba,_0x4ce741[_0x0093('0x10d')]);}else{_0x47eb1c[_0x0093('0x102')](_0x49557a,_0x4d30f2,_0x3071ba,_0x4ce741[_0x0093('0x10d')]);}}}});};Dialer[_0x0093('0x1a')]['stateGlobal']=function(_0xffbb22,_0x587fef,_0x5b1945,_0x204441){var _0x6b2d18=new Final(_0xffbb22);_0x6b2d18[_0x0093('0xa8')]=0xf;_0x6b2d18['statedesc']=_0x0093('0x1c4');this['createStateFinal'](_0x6b2d18,_0x587fef,_0x5b1945,_0x204441);};Dialer['prototype']['createStateFinal']=function(_0x440569,_0x2b9a0c,_0x18cda8,_0x1b5c9b){this[_0x0093('0xc9')](_0x440569)[_0x0093('0x3c')](function(){return _0x2b9a0c(msgResponse(_0x0093('0x1a9'),_0x0093('0xd7'),_0x1b5c9b));})[_0x0093('0xb7')](function(){return _0x18cda8(msgResponse(_0x0093('0x1c5'),_0x0093('0x143'),'contact\x20not\x20moved'));});};Dialer[_0x0093('0x1a')][_0x0093('0x15a')]=function(_0x3ebef5){var _0x579d66=_0x3ebef5[_0x0093('0x1c6')]/0x64;var _0x599d24=_0x3ebef5[_0x0093('0x63')]/(_0x3ebef5[_0x0093('0x63')]+_0x3ebef5[_0x0093('0x5e')]);var _0x5cd93a=Math[_0x0093('0x1c7')](_0x3ebef5[_0x0093('0x70')]*(_0x3ebef5[_0x0093('0x1c8')]/0x64));var _0x496b48=Math['round'](_0x3ebef5['predictiveIntervalAvailable']*(_0x3ebef5[_0x0093('0x1c9')]/0x64));var _0x18351c=_0x3ebef5[_0x0093('0x51')]+_0x3ebef5[_0x0093('0xa2')];var _0x153c6e=Math['floor'](_0x3ebef5[_0x0093('0x73')]*_0x3ebef5[_0x0093('0x74')]*_0x3ebef5[_0x0093('0x6d')]*_0x3ebef5[_0x0093('0x6e')]);if(_[_0x0093('0x3d')](_0x3ebef5['startProgressive'])){if(!_[_0x0093('0x3d')](_0x3ebef5['startPredictive'])){_0x3ebef5[_0x0093('0x26')]=undefined;loggerPredictive[_0x0093('0x98')](_0x0093('0x1ca'),_0x0093('0x1cb'));}if(!_[_0x0093('0x3d')](_0x3ebef5[_0x0093('0x91')])){loggerPredictive[_0x0093('0x98')]('[startMethodPredictive][StartProgressive]',_0x0093('0x1cc'));clearInterval(_0x3ebef5['handlePredictive']);_0x3ebef5['handlePredictive']=undefined;}_0x3ebef5[_0x0093('0x27')]=moment()[_0x0093('0x7a')](_0x0093('0xfb'));loggerPredictive['info'](_0x3ebef5[_0x0093('0x3f')],_0x0093('0x1cd'),_0x3ebef5[_0x0093('0x27')]);this['handlePower'](_0x3ebef5,0x1);}else if(ifInterval(_0x3ebef5[_0x0093('0x1ce')],_0x3ebef5[_0x0093('0x27')])){this[_0x0093('0x159')](_0x3ebef5,0x1);loggerPredictiveCalls[_0x0093('0x7e')](_0x0093('0x1cf'),_0x3ebef5['startProgressive'],_0x3ebef5[_0x0093('0x3f')]);_0x3ebef5[_0x0093('0x73')]=0x0;_0x3ebef5[_0x0093('0x6c')]=0x0;}else if(_0x579d66<_0x599d24&&_0x3ebef5['dialPredictiveOptimization']===_0x0093('0x1d0')){freeVariablesPredictive(_0x3ebef5);loggerPredictive[_0x0093('0x7e')](_0x0093('0x1d1'),_0x0093('0x1d2'),_0x599d24,'startProgressive',_0x3ebef5[_0x0093('0x3f')]);}else if(_0x153c6e<_0x3ebef5[_0x0093('0x6c')]&&_0x3ebef5['dialPredictiveOptimization']===_0x0093('0x1d0')){freeVariablesPredictive(_0x3ebef5);loggerPredictive['info'](_0x0093('0x1d3'),_0x0093('0x1d4'),_0x153c6e,_0x0093('0x1d5'),_0x3ebef5[_0x0093('0x6c')],'startProgressive',_0x3ebef5[_0x0093('0x3f')]);}else if(!ifInterval(_0x3ebef5[_0x0093('0x1ce')],_0x3ebef5[_0x0093('0x27')])&&_['isUndefined'](_0x3ebef5[_0x0093('0x26')])&&!_[_0x0093('0x3d')](_0x3ebef5[_0x0093('0x27')])){_0x3ebef5[_0x0093('0x26')]=moment()[_0x0093('0x7a')](_0x0093('0xfb'));loggerPredictive[_0x0093('0x7e')](_0x3ebef5[_0x0093('0x3f')],'started\x20in\x20predictive\x20at',_0x3ebef5[_0x0093('0x26')]);this['averageHandleTime'](_0x3ebef5[_0x0093('0x1ce')])[_0x0093('0x3c')](this[_0x0093('0x1d6')](_0x3ebef5))[_0x0093('0x3c')](mergeDataErlangB(_0x3ebef5))[_0x0093('0x3c')](this[_0x0093('0x1d7')](_0x3ebef5))[_0x0093('0xb7')](loggerCatchPredictive(_0x0093('0x1d8'),_0x3ebef5));}else if(!ifInterval(_0x3ebef5[_0x0093('0x1ce')],_0x3ebef5[_0x0093('0x26')])){_0x3ebef5[_0x0093('0x6c')]=0x0;_0x3ebef5[_0x0093('0x26')]=moment()['format'](_0x0093('0xfb'));loggerPredictive[_0x0093('0x7e')](_0x3ebef5[_0x0093('0x3f')],_0x0093('0x1d9'),_0x3ebef5[_0x0093('0x26')]);clearInterval(_0x3ebef5[_0x0093('0x91')]);_0x3ebef5['handlePredictive']=undefined;this[_0x0093('0xbd')](_0x3ebef5[_0x0093('0x1ce')])[_0x0093('0x3c')](this['getDataPredictive'](_0x3ebef5))[_0x0093('0x3c')](mergeDataErlangB(_0x3ebef5))[_0x0093('0x3c')](this[_0x0093('0x1d7')](_0x3ebef5))[_0x0093('0xb7')](loggerCatchPredictive('Predictive\x20for\x20every\x20interval',_0x3ebef5));}else if(_0x3ebef5[_0x0093('0x70')]&&_0x18351c<_0x3ebef5[_0x0093('0x70')]-_0x496b48){freeVariablesPredictive(_0x3ebef5);loggerPredictive[_0x0093('0x7e')](_0x3ebef5[_0x0093('0x3f')],'switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',_0x18351c,_0x0093('0x1da'),_0x3ebef5[_0x0093('0x70')],'-',_0x496b48,'=',_0x3ebef5[_0x0093('0x70')]-_0x496b48,')');}else if(_0x3ebef5[_0x0093('0x70')]&&_0x18351c>_0x3ebef5['predictiveIntervalAvailable']+_0x5cd93a){freeVariablesPredictive(_0x3ebef5);loggerPredictive['info'](_0x3ebef5[_0x0093('0x3f')],_0x0093('0x1db'),_0x18351c,_0x0093('0x1dc'),_0x3ebef5['predictiveIntervalAvailable'],'+',_0x5cd93a,'=',_0x3ebef5['predictiveIntervalAvailable']+_0x5cd93a,')');}};Dialer[_0x0093('0x1a')][_0x0093('0x1d6')]=function(_0x16ce4a){var _0x1398da=this;return function(_0x57a052){return new BPromise(function(_0x389b48,_0x194c53){_[_0x0093('0x8e')](_0x16ce4a,_0x57a052[0x0]);if(checkGetDataPredictive(_0x57a052[0x0])){var _0x36c5f0=_0x16ce4a[_0x0093('0x70')]=_0x16ce4a[_0x0093('0xa2')]+_0x16ce4a[_0x0093('0x51')];var _0x5cd0b1=_0x16ce4a[_0x0093('0x1ce')]*0x3c;var _0x5322a1=_0x57a052[0x0][_0x0093('0x69')]+_0x57a052[0x0][_0x0093('0x85')];var _0x173fde=(_0x57a052[0x0][_0x0093('0x68')]+_0x57a052[0x0][_0x0093('0x6b')]+_0x57a052[0x0][_0x0093('0x6a')])/_0x57a052[0x0][_0x0093('0x71')];_0x16ce4a[_0x0093('0x6d')]=_0x173fde>0x0?_0x173fde:0x1;switch(_0x16ce4a[_0x0093('0x1dd')]){case _0x0093('0x1d0'):var _0x3a99df=_0x16ce4a['dialPredictiveOptimizationPercentage']/0x64;return _0x1398da[_0x0093('0x1de')](_0x36c5f0,_0x5cd0b1,_0x5322a1,_0x173fde,_0x3a99df)[_0x0093('0x3c')](function(_0x480285){return _0x389b48(_0x480285);});case _0x0093('0x1df'):var _0x456275=_0x16ce4a['dialPredictiveOptimizationPercentage']/0x64;return _0x1398da[_0x0093('0x1e0')](_0x36c5f0,_0x5cd0b1,_0x5322a1,_0x173fde,_0x456275)['then'](function(_0x27f480){return _0x389b48(_0x27f480);});default:return _0x194c53(msgResponse(_0x0093('0x1e1'),_0x0093('0x143'),_0x0093('0x1e2')));}}else{return _0x194c53(msgResponse(_0x0093('0x1e1'),'Failure',_0x0093('0x1e3')));}});};};Dialer[_0x0093('0x1a')]['getDataPredictiveOld']=function(_0x5f4f5b){var _0x385c32=this;return function(_0x37974d){return new BPromise(function(_0x23b696,_0x3a94d8){_[_0x0093('0x8e')](_0x5f4f5b,_0x37974d[0x0]);if(checkGetDataPredictive(_0x37974d[0x0])){loggerPredictive[_0x0093('0x7e')](JSON[_0x0093('0x4a')](_0x37974d[0x0]));if(_0x5f4f5b['dialPredictiveOptimization']===_0x0093('0x1d0')){return _0x385c32[_0x0093('0xc7')](_0x5f4f5b['id'])[_0x0093('0x3c')](function(_0x19e6e7){var _0x47a2df=_0x5f4f5b[_0x0093('0x52')]-_0x19e6e7[0x0][_0x0093('0x1e4')];var _0xfd04d2=_0x5f4f5b[_0x0093('0x1ce')]*0x3c;var _0x495794=_0x37974d[0x0][_0x0093('0x69')]+_0x37974d[0x0][_0x0093('0x85')];var _0x47d075=(_0x37974d[0x0][_0x0093('0x68')]+_0x37974d[0x0]['predictiveIntervalDroppedCallsTimeout']+_0x37974d[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x37974d[0x0]['predictiveIntervalTotalCalls'];var _0x141bf9=_0x5f4f5b[_0x0093('0x1c6')]/0x64;_0x5f4f5b[_0x0093('0x6f')]=_0x19e6e7[0x0][_0x0093('0x1e4')]||0x0;_0x5f4f5b[_0x0093('0x6d')]=_0x47d075>0x0?_0x47d075:0x1;return _0x385c32['abandonmentRate'](_0x47a2df,_0xfd04d2,_0x495794,_0x47d075,_0x141bf9);})[_0x0093('0x3c')](function(_0x377526){return _0x23b696(_0x377526);})[_0x0093('0xb7')](function(_0x377ca9){return _0x3a94d8(msgResponse(_0x0093('0x1e5'),_0x0093('0x143'),JSON['stringify'](_0x377ca9)));});}if(_0x5f4f5b[_0x0093('0x1dd')]===_0x0093('0x1df')){return _0x385c32[_0x0093('0xc7')](_0x5f4f5b['id'])[_0x0093('0x3c')](function(_0x5e5c03){var _0x1aebf9=_0x5f4f5b[_0x0093('0x52')]-_0x5e5c03[0x0]['outboundQueuePauses'];var _0x42dd27=_0x5f4f5b[_0x0093('0x1ce')]*0x3c;var _0x53b6c8=_0x37974d[0x0]['predictiveIntervalAvgTalktime']+_0x37974d[0x0][_0x0093('0x85')];var _0x4e432c=(_0x37974d[0x0]['predictiveIntervalAnsweredCalls']+_0x37974d[0x0][_0x0093('0x6b')]+_0x37974d[0x0][_0x0093('0x6a')])/_0x37974d[0x0][_0x0093('0x71')];var _0x4ea546=_0x5f4f5b[_0x0093('0x1c6')]/0x64;_0x5f4f5b[_0x0093('0x6f')]=_0x5e5c03[0x0][_0x0093('0x1e4')]||0x0;_0x5f4f5b[_0x0093('0x6d')]=_0x4e432c>0x0?_0x4e432c:0x1;return _0x385c32[_0x0093('0x1e0')](_0x1aebf9,_0x42dd27,_0x53b6c8,_0x4e432c,_0x4ea546);})[_0x0093('0x3c')](function(_0x317e80){return _0x23b696(_0x317e80);})[_0x0093('0xb7')](function(_0x404917){return _0x3a94d8(msgResponse(_0x0093('0x1e5'),_0x0093('0x143'),JSON[_0x0093('0x4a')](_0x404917)));});}}else{return _0x3a94d8(msgResponse(_0x0093('0x1e1'),_0x0093('0x143'),_0x0093('0x1e3')));}});};};Dialer['prototype']['startMethodPredictive']=function(_0x38245d){var _0x1c48a6=this;return function(){var _0x593d57=0x0;var _0x1c3069=Math[_0x0093('0x1e6')](_0x38245d[_0x0093('0x8b')]*0x3e8);if(_0x1c3069>0x0){_0x1c3069=_0x1c3069<0x64?0x64:_0x1c3069;loggerPredictive['info'](_0x38245d[_0x0093('0x3f')],_0x0093('0x1e7'),_0x1c3069,_0x0093('0x4b'));_0x38245d[_0x0093('0x91')]=setInterval(function(){_0x1c48a6[_0x0093('0x91')](_0x38245d);loggerPredictiveCalls[_0x0093('0x7e')]('[handlePredictive]',_0x593d57+=0x1);},_0x1c3069);}else{loggerPredictive[_0x0093('0x7e')](_0x38245d['name'],_0x0093('0x1e8'));}};};Dialer[_0x0093('0x1a')][_0x0093('0x1e9')]=function(_0x1ec1ef,_0x14ddf7){var _0x1e9963=this;return function(_0x589a88){if(_[_0x0093('0x48')](_0x589a88)){if(_[_0x0093('0xdc')](_0x14ddf7[_0x0093('0xd2')])||!_0x14ddf7[_0x0093('0x1ea')]){if(_0x1ec1ef[_0x0093('0x157')]===_0x0093('0x6')){_0x1ec1ef[_0x0093('0x12f')]=_[_0x0093('0x3d')](_0x1ec1ef[_0x0093('0x12f')])?!![]:_0x1ec1ef['queueStatusComplete'];var _0x478191=uuid['v4']();_0x1e9963[_0x0093('0xac')][_0x478191]=new Action(_0x1ec1ef,_0x14ddf7,_0x478191);loggerBooked[_0x0093('0x7e')]('[booked][checkContactBlack]',_0x478191,_0x0093('0x1eb'),JSON['stringify'](_0x1ec1ef[_0x0093('0x12f')]),'Queue:\x20',_0x1ec1ef[_0x0093('0x3f')]);if(_0x1ec1ef['queueStatusComplete']){_0x1ec1ef[_0x0093('0x12f')]=![];_0x1e9963[_0x0093('0x28')][_0x1e9963['actions'][_0x478191][_0x0093('0xb3')]]=[];ami[_0x0093('0xae')]({'actionid':_0x478191,'action':_0x0093('0x1ec'),'queue':_0x1ec1ef[_0x0093('0x3f')]})[_0x0093('0xb7')](function(){_0x1e9963[_0x0093('0xb2')](_0x1ec1ef);_0x1e9963[_0x0093('0xc0')]({'active':![],'ContactId':_0x1e9963[_0x0093('0xac')][_0x478191][_0x0093('0xd0')],'ListId':_0x1e9963[_0x0093('0xac')][_0x478191][_0x0093('0xd1')],'VoiceQueueId':_0x1e9963[_0x0093('0xac')][_0x478191]['VoiceQueueId']||undefined,'CampaignId':_0x1e9963['actions'][_0x478191][_0x0093('0xfc')]||undefined})['catch'](loggerCatch('[unlockOriginate][syncQueueStatusComplete]'));delete _0x1e9963['actions'][_0x478191];});}else{loggerBooked[_0x0093('0x7e')]('[booked][checkContactBlack][else]',JSON[_0x0093('0x4a')](_0x1ec1ef[_0x0093('0x12f')]),'Queue:\x20',_0x1ec1ef[_0x0093('0x3f')]);_0x1e9963[_0x0093('0xb2')](_0x1ec1ef);_0x1e9963[_0x0093('0xc0')]({'active':![],'ContactId':_0x1e9963[_0x0093('0xac')][_0x478191][_0x0093('0xd0')],'ListId':_0x1e9963['actions'][_0x478191][_0x0093('0xd1')],'VoiceQueueId':_0x1e9963[_0x0093('0xac')][_0x478191][_0x0093('0xd3')]||undefined,'CampaignId':_0x1e9963[_0x0093('0xac')][_0x478191][_0x0093('0xfc')]||undefined})['catch'](loggerCatch(_0x0093('0x1ed')));delete _0x1e9963[_0x0093('0xac')][_0x478191];}}else{return _0x1e9963[_0x0093('0x16e')](_0x1ec1ef,_0x14ddf7);}}else{if(getDiff(_0x14ddf7[_0x0093('0x1ee')])<_0x1ec1ef['dialRecallMeTimeout']*0x3c){if(_0x14ddf7[_0x0093('0x1ef')]&&!_0x14ddf7[_0x0093('0x1ef')][_0x0093('0x1f0')]){_0x1e9963['preview'][_0x0093('0x131')](_0x14ddf7['id'])[_0x0093('0x1d')](function(){_0x1e9963[_0x0093('0xb2')](_0x1ec1ef);});}else{_0x1e9963[_0x0093('0xc1')]({'active':![]},_0x14ddf7['id'],0x1)[_0x0093('0x1d')](function(){_0x1e9963[_0x0093('0xb2')](_0x1ec1ef);});}}else{_0x1ec1ef[_0x0093('0x66')]+=0x1;_0x1e9963[_0x0093('0xb2')](_0x1ec1ef);if(_0x1ec1ef[_0x0093('0x1f1')]){_0x1e9963['rescheduleContact']({'active':![],'recallme':![],'UserId':null,'ContactId':_0x14ddf7[_0x0093('0xd0')],'ListId':_0x14ddf7[_0x0093('0xd1')],'VoiceQueueId':_0x14ddf7[_0x0093('0xd3')]||undefined,'CampaignId':_0x14ddf7[_0x0093('0xfc')]||undefined})[_0x0093('0xb7')](loggerCatch(_0x0093('0x1f2')));_0x1e9963[_0x0093('0xca')](createObjHistory(_0x1ec1ef,_0x14ddf7,'RECALLINQUEUE',0x17,_0x0093('0x1f3')))['catch'](loggerCatch(_0x0093('0x1f4')));}else{_0x1e9963['saveInDb'](createObjHistory(_0x1ec1ef,_0x14ddf7,_0x0093('0x1f5'),0x16,_0x0093('0x1f6')),_0x0093('0x1f7'),_0x0093('0x1f8'));}}}}else{_0x1ec1ef['outboundBlacklistCallsDay']+=0x1;_0x1e9963['saveInDb'](createObjHistory(_0x1ec1ef,_0x14ddf7,'BLACKLIST',0xd,_0x0093('0x1f9')),_0x0093('0x1fa'),_0x0093('0x1fb'));throw _0x0093('0x1fc');}};};Dialer[_0x0093('0x1a')][_0x0093('0x161')]=function(_0x3edd06){var _0x16e37e=this;var _0x13dd72=_0x3edd06['limitCalls']-_0x3edd06[_0x0093('0x72')]-_0x3edd06[_0x0093('0xc4')];emitCampaignSummary(_0x3edd06);if(_0x13dd72>0x0){if(_0x13dd72>this[_0x0093('0x22')]){_0x13dd72=this[_0x0093('0x22')];}_0x3edd06[_0x0093('0xc4')]+=_0x13dd72;this[_0x0093('0xc5')](_0x3edd06['id'],_0x13dd72,_0x3edd06[_0x0093('0x1fd')],_0x3edd06)[_0x0093('0x3c')](function(_0x3c69d3){_0x3edd06[_0x0093('0xc4')]-=_0x13dd72;_0x3edd06[_0x0093('0xc4')]=_0x3edd06[_0x0093('0xc4')]>0x0?_0x3edd06[_0x0093('0xc4')]:0x0;if(!checkContactEmpty(_0x3c69d3)){_0x3edd06['message']=_0x0093('0x9f');logger[_0x0093('0x7e')](_0x0093('0x1fe')+_0x3edd06[_0x0093('0x3f')]);}else{_0x3edd06[_0x0093('0x72')]+=_0x3c69d3[_0x0093('0x99')];_0x3edd06['message']=_0x0093('0x1ff');for(var _0x3f0e52=0x0;_0x3f0e52<_0x3c69d3[_0x0093('0x99')];_0x3f0e52+=0x1){_0x3edd06[_0x0093('0x200')]+=0x1;if(_[_0x0093('0xdc')](_0x3c69d3[_0x3f0e52])||_[_0x0093('0xdc')](_0x3c69d3[_0x3f0e52][_0x0093('0x171')])||_[_0x0093('0xdc')](_0x3c69d3[_0x3f0e52][_0x0093('0x171')][_0x0093('0x172')])){_0x16e37e['emptyContact'](_0x0093('0x201'),_0x3edd06,_0x3c69d3[_0x3f0e52]);}else{_0x16e37e[_0x0093('0xbb')](_[_0x0093('0xcf')](_0x3c69d3[_0x3f0e52],[_0x0093('0xfc'),'Contact.phone']))[_0x0093('0x3c')](_0x16e37e[_0x0093('0x1e9')](_0x3edd06,_0x3c69d3[_0x3f0e52]))[_0x0093('0xb7')](_0x16e37e['loggerHandler'](_0x0093('0x202'),_0x3edd06));}}}})[_0x0093('0xb7')](loggerGetContactDialer(_0x0093('0x203'),_0x3edd06,_0x13dd72));}};Dialer['prototype'][_0x0093('0x159')]=function(_0x32356a,_0x19fbcf){var _0x30d2f7=this;var _0x35e1a7=[];var _0x5974c0=_0x19fbcf>=0x1?_0x19fbcf:0x1;if(_0x32356a[_0x0093('0x157')]==='booked'){_0x5974c0=0x1;}var _0x5cdd6c=Math[_0x0093('0x1e6')](_0x32356a['available']*_0x5974c0)-_0x32356a[_0x0093('0x72')]-_0x32356a[_0x0093('0xc4')];emitVoiceQueueSummary(_0x32356a);if(_0x32356a[_0x0093('0x204')]>0x0){var _0x3bc1f1=_0x32356a[_0x0093('0x204')]-_0x32356a[_0x0093('0x72')]-_0x32356a['talking']-_0x32356a[_0x0093('0xc4')]-_0x32356a['pTalking'];if(_0x5cdd6c>_0x3bc1f1){_0x5cdd6c=_0x3bc1f1;}}if(_0x5cdd6c>0x0){if(_0x32356a['dialMethod']===_0x0093('0x6')){_0x5cdd6c=0x1;}if(_0x5cdd6c>this[_0x0093('0x22')]){_0x5cdd6c=this[_0x0093('0x22')];}_0x32356a[_0x0093('0xc4')]+=_0x5cdd6c;for(var _0xf14772 in this[_0x0093('0x20')]){if(typeof this[_0x0093('0x20')][_0xf14772]!=='undefined'){if(this[_0x0093('0x20')][_0xf14772]['state']===_0x0093('0x205')&&this[_0x0093('0x20')][_0xf14772][_0x0093('0xaf')]==='reachable'){_0x35e1a7[_0x0093('0x12d')](this['agents'][_0xf14772]['id']);}}}this[_0x0093('0xc3')](_0x32356a['id'],_0x35e1a7,_0x5cdd6c,_0x32356a[_0x0093('0x1fd')],_0x32356a)[_0x0093('0x3c')](function(_0x53e2df){_0x32356a['temp']-=_0x5cdd6c;_0x32356a[_0x0093('0xc4')]=_0x32356a[_0x0093('0xc4')]>0x0?_0x32356a['temp']:0x0;if(!checkContactEmpty(_0x53e2df)){_0x30d2f7[_0x0093('0xb6')](_0x32356a)[_0x0093('0x3c')](sendMessageReschedule(_0x32356a))['catch'](loggerCatch(_0x0093('0xb8')));}else{_0x32356a['originated']+=_0x53e2df[_0x0093('0x99')];_0x32356a[_0x0093('0x44')]=_0x32356a[_0x0093('0x157')]===_0x0093('0x6')?'ACTIVE':'RUNNING';for(var _0x4db2bc=0x0;_0x4db2bc<_0x53e2df[_0x0093('0x99')];_0x4db2bc+=0x1){if(_[_0x0093('0xdc')](_0x53e2df[_0x4db2bc])||_[_0x0093('0xdc')](_0x53e2df[_0x4db2bc][_0x0093('0x171')])||_['isNil'](_0x53e2df[_0x4db2bc][_0x0093('0x171')][_0x0093('0x172')])){_0x30d2f7[_0x0093('0xcc')](_0x0093('0x201'),_0x32356a,_0x53e2df[_0x4db2bc]);}else{_0x30d2f7[_0x0093('0xb9')](_[_0x0093('0xcf')](_0x53e2df[_0x4db2bc],['VoiceQueueId',_0x0093('0x206')]))['then'](_0x30d2f7[_0x0093('0x1e9')](_0x32356a,_0x53e2df[_0x4db2bc]))[_0x0093('0xb7')](_0x30d2f7[_0x0093('0x207')](_0x0093('0x201'),_0x32356a));}}}})['catch'](loggerGetContactDialer(_0x0093('0x208'),_0x32356a,_0x5cdd6c));}};Dialer[_0x0093('0x1a')][_0x0093('0x91')]=function(_0x380a4d){if(_0x380a4d[_0x0093('0x204')]>0x0){var _0x2a392b=_0x380a4d[_0x0093('0x204')]-_0x380a4d[_0x0093('0x72')]-_0x380a4d['talking'];if(_0x2a392b>0x0){this[_0x0093('0x209')](_0x380a4d);}else{loggerPredictiveCalls['info'](_0x0093('0x20a'));}}else{this[_0x0093('0x209')](_0x380a4d);}};Dialer[_0x0093('0x1a')][_0x0093('0x209')]=function(_0x5ba575){var _0x483180=this;var _0x27bb64=[];_0x5ba575[_0x0093('0x72')]+=0x1;for(var _0x2de3ba in this['agents']){if(typeof this[_0x0093('0x20')][_0x2de3ba]!==_0x0093('0x9a')){if(this[_0x0093('0x20')][_0x2de3ba][_0x0093('0xa8')]===_0x0093('0x205')&&this[_0x0093('0x20')][_0x2de3ba][_0x0093('0xaf')]===_0x0093('0x20b')){_0x27bb64[_0x0093('0x12d')](this[_0x0093('0x20')][_0x2de3ba]['id']);}}}this[_0x0093('0xc3')](_0x5ba575['id'],_0x27bb64,0x1,_0x5ba575[_0x0093('0x1fd')],_0x5ba575)[_0x0093('0x3c')](function(_0x44d474){if(!checkContactEmpty(_0x44d474)){checkContactLowerLimitOriginate(_0x5ba575,0x1,0x0);_0x483180[_0x0093('0xb6')](_0x5ba575)[_0x0093('0x3c')](sendMessageReschedule(_0x5ba575))[_0x0093('0xb7')](loggerCatch(_0x0093('0xb8')));}else{_0x5ba575[_0x0093('0x44')]=_0x0093('0x1ff');if(_[_0x0093('0xdc')](_0x44d474[0x0])||_[_0x0093('0xdc')](_0x44d474[0x0]['Contact'])||_[_0x0093('0xdc')](_0x44d474[0x0]['Contact'][_0x0093('0x172')])){_0x483180[_0x0093('0xcc')](_0x0093('0x201'),_0x5ba575,_0x44d474[0x0]);}else{_0x483180['checkIsBlackList'](_[_0x0093('0xcf')](_0x44d474[0x0],[_0x0093('0xd3'),_0x0093('0x206')]))['then'](_0x483180[_0x0093('0x1e9')](_0x5ba575,_0x44d474[0x0]))['catch'](_0x483180['loggerHandler']('[actionOriginatePredictive]\x20',_0x5ba575));}}})['catch'](loggerGetContactDialer('[getContactDialerPredictive]',_0x5ba575,0x1));emitVoiceQueueSummary(_0x5ba575);};Dialer['prototype'][_0x0093('0x1de')]=function(_0x2bebdb,_0x3521fd,_0x24ec93,_0x54dcf7,_0x359859,_0x43ee5e){loggerPredictive[_0x0093('0x7e')]('--------\x20Drop\x20Rate\x20--------');loggerPredictive[_0x0093('0x7e')](_0x0093('0x20c'),_0x2bebdb);loggerPredictive[_0x0093('0x7e')](_0x0093('0x20d'),_0x3521fd);loggerPredictive[_0x0093('0x7e')](_0x0093('0x20e'),_0x24ec93);loggerPredictive['info']('P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x54dcf7);loggerPredictive['info'](_0x0093('0x20f'),_0x359859);loggerPredictive[_0x0093('0x7e')](_0x0093('0x84'));return new BPromise(function(_0x3191cd,_0x2bb82b){if(_0x2bebdb<=0x0||isNaN(_0x2bebdb)){return _0x2bb82b(msgResponse(_0x0093('0x210'),'Error',_0x0093('0x211')+_0x2bebdb));}if(_0x24ec93<=0x0||isNaN(_0x24ec93)){return _0x2bb82b(msgResponse(_0x0093('0x210'),_0x0093('0x49'),_0x0093('0x212')+_0x24ec93));}if(_0x54dcf7<=0x0||isNaN(_0x54dcf7)){return _0x2bb82b(msgResponse('[abandonmentRate]',_0x0093('0x49'),_0x0093('0x213')+_0x54dcf7));}if(_0x3521fd<=0x0||isNaN(_0x3521fd)){return _0x2bb82b(msgResponse(_0x0093('0x210'),_0x0093('0x49'),_0x0093('0x214')+_0x3521fd));}if(_0x359859<=0x0||isNaN(_0x359859)){return _0x2bb82b(msgResponse(_0x0093('0x210'),'Error',_0x0093('0x215')+_0x359859));}_0x43ee5e=_0x43ee5e||0x0;var _0x1077d7=0x1/_0x24ec93;var _0x368662=0x0;var _0x280474=0x0;var _0x2bb050=0x0;var _0x4c9509=0x0;for(var _0x3ad330=0x0;_0x2bb050<_0x359859;_0x3ad330+=0x1){_0x280474=_0x3ad330/_0x3521fd;_0x368662=(_0x54dcf7*_0x280474+_0x43ee5e)/_0x1077d7;_0x2bb050=erlangb(_0x368662,_0x2bebdb);_0x4c9509=_0x368662/_0x2bebdb*(0x1-erlangb(_0x368662,_0x2bebdb));}return _0x3191cd({'erlangCalls':_0x3ad330,'erlangCallToSecond':_0x3521fd/_0x3ad330,'erlangAbandonmentRate':_0x2bb050,'erlangBusyFactor':_0x4c9509});});};Dialer[_0x0093('0x1a')]['busyFactor']=function(_0x6719e7,_0x1df92e,_0x8b3ae1,_0x5f215f,_0x6162fe,_0x3b1556){loggerPredictive[_0x0093('0x7e')](_0x0093('0x216'));loggerPredictive[_0x0093('0x7e')]('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',_0x6719e7);loggerPredictive[_0x0093('0x7e')](_0x0093('0x20d'),_0x1df92e);loggerPredictive['info'](_0x0093('0x20e'),_0x8b3ae1);loggerPredictive['info']('P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x5f215f);loggerPredictive['info'](_0x0093('0x217'),_0x6162fe);loggerPredictive[_0x0093('0x7e')]('---------------------------');return new BPromise(function(_0x66b048,_0x181d10){if(_0x6719e7<=0x0||isNaN(_0x6719e7)){return _0x181d10(msgResponse(_0x0093('0x218'),_0x0093('0x49'),'m\x20=\x20'+_0x6719e7));}if(_0x8b3ae1<=0x0||isNaN(_0x8b3ae1)){return _0x181d10(msgResponse('[busyFactor]','Error','Ts\x20=\x20'+_0x8b3ae1));}if(_0x5f215f<=0x0||isNaN(_0x5f215f)){return _0x181d10(msgResponse(_0x0093('0x218'),_0x0093('0x49'),_0x0093('0x213')+_0x5f215f));}if(_0x1df92e<=0x0||isNaN(_0x1df92e)){return _0x181d10(msgResponse(_0x0093('0x218'),_0x0093('0x49'),'interval\x20=\x20'+_0x1df92e));}if(_0x6162fe<=0x0||isNaN(_0x6162fe)){return _0x181d10(msgResponse('[busyFactor]',_0x0093('0x49'),_0x0093('0x219')+_0x6162fe));}_0x3b1556=_0x3b1556||0x0;var _0x3fbe8d=0x1/_0x8b3ae1;var _0x5da2de=0x0;var _0x1f74a9=0x0;var _0x1bf802=0x0;var _0xecc871=0x0;for(var _0x476cdd=0x0;_0xecc871<_0x6162fe;_0x476cdd+=0x1){_0x1f74a9=_0x476cdd/_0x1df92e;_0x5da2de=(_0x5f215f*_0x1f74a9+_0x3b1556)/_0x3fbe8d;_0x1bf802=erlangb(_0x5da2de,_0x6719e7);_0xecc871=_0x5da2de/_0x6719e7*(0x1-erlangb(_0x5da2de,_0x6719e7));}return _0x66b048({'erlangCalls':_0x476cdd,'erlangCallToSecond':_0x1df92e/_0x476cdd,'erlangAbandonmentRate':_0x1bf802,'erlangBusyFactor':_0xecc871});});};module[_0x0093('0x21a')]=Dialer; \ No newline at end of file diff --git a/server/services/ami/dialer/queueCallerAbandon.js b/server/services/ami/dialer/queueCallerAbandon.js index 9ed9f8f..f5b321e 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 _0x8483=['type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridnum','number','starttime','responsetime','droptime','endtime','ringtime','holdtime','membername','connectedlinename','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment','seconds','scheduledat'];(function(_0x45163b,_0x44aee2){var _0x18f1d2=function(_0x5424a2){while(--_0x5424a2){_0x45163b['push'](_0x45163b['shift']());}};_0x18f1d2(++_0x44aee2);}(_0x8483,0x1c9));var _0x3848=function(_0x5e9efd,_0x39844c){_0x5e9efd=_0x5e9efd-0x0;var _0x2126ae=_0x8483[_0x5e9efd];return _0x2126ae;};'use strict';var util=require(_0x3848('0x0'));var _=require(_0x3848('0x1'));var moment=require(_0x3848('0x2'));function getSeconds(_0xcafbd7,_0x24a8da){var _0x1fe025=moment(_0xcafbd7)['milliseconds'](0x0);var _0x55a485=moment(_0x24a8da)['milliseconds'](0x0);return _0x1fe025['diff'](_0x55a485,_0x3848('0x3'));}function QueueCallerAbandon(_0x5a614a,_0x118222){this['scheduledat']=_0x5a614a[_0x3848('0x4')];this[_0x3848('0x5')]=_0x5a614a[_0x3848('0x5')];this[_0x3848('0x6')]=_0x5a614a[_0x3848('0x5')]===_0x3848('0x7')?_0x3848('0x8'):_0x5a614a[_0x3848('0x5')];this[_0x3848('0x9')]=_0x5a614a[_0x3848('0x9')];this[_0x3848('0xa')]=_0x5a614a['countcongestionretry'];this[_0x3848('0xb')]=_0x5a614a[_0x3848('0xb')];this[_0x3848('0xc')]=_0x5a614a[_0x3848('0x9')]+_0x5a614a[_0x3848('0xa')]+_0x5a614a[_0x3848('0xb')]+_0x5a614a[_0x3848('0xd')]+_0x5a614a[_0x3848('0xe')]+_0x5a614a[_0x3848('0xf')]+_0x5a614a[_0x3848('0x10')]+_0x5a614a[_0x3848('0x11')];this[_0x3848('0xd')]=_0x5a614a['countnosuchnumberretry'];this['countdropretry']=_0x5a614a[_0x3848('0xe')];this[_0x3848('0xf')]=_0x5a614a[_0x3848('0xf')];this[_0x3848('0x10')]=_0x5a614a[_0x3848('0x10')];this[_0x3848('0x11')]=_0x5a614a['countagentrejectretry'];this[_0x3848('0x12')]=_0x118222['uniqueid'];this['calleridname']=_0x5a614a['name'];this[_0x3848('0x13')]=_0x5a614a[_0x3848('0x14')];this[_0x3848('0x15')]=_0x5a614a['starttime'];this['responsetime']=_0x5a614a[_0x3848('0x16')];this[_0x3848('0x17')]=_0x5a614a['droptime'];this[_0x3848('0x18')]=this[_0x3848('0x17')];this[_0x3848('0x19')]=getSeconds(_0x5a614a['responsetime'],_0x5a614a[_0x3848('0x15')]);this[_0x3848('0x1a')]=getSeconds(this[_0x3848('0x17')],_0x5a614a[_0x3848('0x16')]);this['talktime']=0x0;this[_0x3848('0x8')]=_0x118222[_0x3848('0x8')];this[_0x3848('0x1b')]=_0x118222[_0x3848('0x1c')];this[_0x3848('0x1d')]=_0x118222[_0x3848('0x1d')];this[_0x3848('0x1e')]=_0x5a614a[_0x3848('0x1e')];this[_0x3848('0x1f')]=_0x5a614a[_0x3848('0x1f')];this[_0x3848('0x20')]=_0x5a614a[_0x3848('0x20')];this['recallme']=_0x5a614a[_0x3848('0x21')];this[_0x3848('0x22')]=_0x5a614a[_0x3848('0x22')];this[_0x3848('0x23')]=_0x5a614a[_0x3848('0x23')];this[_0x3848('0x24')]=_0x5a614a['UserId'];this[_0x3848('0x25')]=_0x5a614a[_0x3848('0x25')];this[_0x3848('0x26')]=_0x5a614a[_0x3848('0x26')];this['originatecalleridnum']=_0x5a614a[_0x3848('0x27')]||'';this[_0x3848('0x28')]=_0x5a614a[_0x3848('0x28')]||'';}module[_0x3848('0x29')]=QueueCallerAbandon; \ No newline at end of file +var _0x8c40=['countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','uniqueid','calleridname','name','number','starttime','responsetime','droptime','endtime','ringtime','holdtime','queue','membername','connectedlinename','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','milliseconds','diff','scheduledat','type','campaigntype','outbound','countbusyretry','countcongestionretry','countnoanswerretry','countglobal'];(function(_0x1758bb,_0x12cd7b){var _0x4c0054=function(_0x2f0c0f){while(--_0x2f0c0f){_0x1758bb['push'](_0x1758bb['shift']());}};_0x4c0054(++_0x12cd7b);}(_0x8c40,0x1a2));var _0x08c4=function(_0x4cf912,_0x576b18){_0x4cf912=_0x4cf912-0x0;var _0x19fdeb=_0x8c40[_0x4cf912];return _0x19fdeb;};'use strict';var util=require(_0x08c4('0x0'));var _=require(_0x08c4('0x1'));var moment=require('moment');function getSeconds(_0x309092,_0x574ad7){var _0x3a2ac9=moment(_0x309092)[_0x08c4('0x2')](0x0);var _0x37d9fe=moment(_0x574ad7)[_0x08c4('0x2')](0x0);return _0x3a2ac9[_0x08c4('0x3')](_0x37d9fe,'seconds');}function QueueCallerAbandon(_0x3e56d4,_0x27f1f3){this[_0x08c4('0x4')]=_0x3e56d4[_0x08c4('0x4')];this[_0x08c4('0x5')]=_0x3e56d4['type'];this[_0x08c4('0x6')]=_0x3e56d4['type']===_0x08c4('0x7')?'queue':_0x3e56d4[_0x08c4('0x5')];this['countbusyretry']=_0x3e56d4[_0x08c4('0x8')];this[_0x08c4('0x9')]=_0x3e56d4[_0x08c4('0x9')];this[_0x08c4('0xa')]=_0x3e56d4[_0x08c4('0xa')];this[_0x08c4('0xb')]=_0x3e56d4[_0x08c4('0x8')]+_0x3e56d4[_0x08c4('0x9')]+_0x3e56d4['countnoanswerretry']+_0x3e56d4['countnosuchnumberretry']+_0x3e56d4[_0x08c4('0xc')]+_0x3e56d4[_0x08c4('0xd')]+_0x3e56d4[_0x08c4('0xe')]+_0x3e56d4[_0x08c4('0xf')];this[_0x08c4('0x10')]=_0x3e56d4[_0x08c4('0x10')];this[_0x08c4('0xc')]=_0x3e56d4[_0x08c4('0xc')];this[_0x08c4('0xd')]=_0x3e56d4[_0x08c4('0xd')];this[_0x08c4('0xe')]=_0x3e56d4[_0x08c4('0xe')];this[_0x08c4('0xf')]=_0x3e56d4[_0x08c4('0xf')];this['uniqueid']=_0x27f1f3[_0x08c4('0x11')];this[_0x08c4('0x12')]=_0x3e56d4[_0x08c4('0x13')];this['calleridnum']=_0x3e56d4[_0x08c4('0x14')];this[_0x08c4('0x15')]=_0x3e56d4[_0x08c4('0x15')];this[_0x08c4('0x16')]=_0x3e56d4[_0x08c4('0x16')];this[_0x08c4('0x17')]=_0x3e56d4[_0x08c4('0x17')];this[_0x08c4('0x18')]=this['droptime'];this[_0x08c4('0x19')]=getSeconds(_0x3e56d4[_0x08c4('0x16')],_0x3e56d4[_0x08c4('0x15')]);this[_0x08c4('0x1a')]=getSeconds(this[_0x08c4('0x17')],_0x3e56d4[_0x08c4('0x16')]);this['talktime']=0x0;this[_0x08c4('0x1b')]=_0x27f1f3[_0x08c4('0x1b')];this[_0x08c4('0x1c')]=_0x27f1f3[_0x08c4('0x1d')];this[_0x08c4('0x1e')]=_0x27f1f3[_0x08c4('0x1e')];this['callback']=_0x3e56d4[_0x08c4('0x1f')];this[_0x08c4('0x20')]=_0x3e56d4[_0x08c4('0x20')];this[_0x08c4('0x21')]=_0x3e56d4[_0x08c4('0x21')];this[_0x08c4('0x22')]=_0x3e56d4[_0x08c4('0x22')];this[_0x08c4('0x23')]=_0x3e56d4[_0x08c4('0x23')];this['ListId']=_0x3e56d4[_0x08c4('0x24')];this[_0x08c4('0x25')]=_0x3e56d4[_0x08c4('0x25')];this[_0x08c4('0x26')]=_0x3e56d4[_0x08c4('0x26')];this[_0x08c4('0x27')]=_0x3e56d4[_0x08c4('0x27')];this['originatecalleridnum']=_0x3e56d4[_0x08c4('0x28')]||'';this[_0x08c4('0x29')]=_0x3e56d4[_0x08c4('0x29')]||'';}module[_0x08c4('0x2a')]=QueueCallerAbandon; \ No newline at end of file diff --git a/server/services/ami/fax/action.js b/server/services/ami/fax/action.js index adfaa12..baa283c 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(_0x5e5094,_0x3c6479){var _0x5e6c9c=function(_0xe8b703){while(--_0xe8b703){_0x5e5094['push'](_0x5e5094['shift']());}};_0x5e6c9c(++_0x3c6479);}(_0xa9e0,0x123));var _0x0a9e=function(_0x36dfbd,_0x5bfe2d){_0x36dfbd=_0x36dfbd-0x0;var _0x4ecad9=_0xa9e0[_0x36dfbd];return _0x4ecad9;};'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(_0x5b95f2,_0x2adb49){var _0x376b33=function(_0x57c21b){while(--_0x57c21b){_0x5b95f2['push'](_0x5b95f2['shift']());}};_0x376b33(++_0x2adb49);}(_0xa9e0,0x123));var _0x0a9e=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xa9e0[_0x19e35c];return _0x3e1fe8;};'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 39716e1..d808518 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 _0x2f68=['reason','AttachmentId','update','logger','[Fax][Message][Error][NoUpdate2]','updateStatus','[Fax][Message][Updated]','[Fax][Message][NoUpdate1]','finally','[Fax][Message][NoUpdate2]','\x20hangup\x20sendFile\x20','\x20hangup\x20faxRiceive\x20','SUCCESS','faxstatusstring','SENDING\x20FAILED:\x20','SENDING\x20FAILED','send','execOriginate','Fax\x20received','[Fax][execOriginate][failure]','Fax\x20failed','checkAfterSend','checkTrunk','FaxAccountId','isValid','Trunk\x20Reachable','gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit','path','execute','format','%s/%s.tif','dir','XMF-PATH','Convert\x20pdf\x20to\x20tif','Action','addVariables','isTrunkReachable','isNil','active','SIP/%s','unmonitored','\x20Trunk\x20is\x20not\x20active','[Fax][checkTrunk][Empty\x20Fax]','Empty\x20Fax','exports','lodash','bluebird','uuid','moment','tiff2pdf','../../../config/logger','fax','./rpcDb','./channel','../rpc/faxAccount','channels','faxAccounts','trunks','newchannel','syncNewchannel','bind','varset','syncVarSet','syncNewState','syncNewExten','faxstatus','syncFaxStatus','receivefax','syncReceiveFax','hangup','syncOriginateResponse','prototype','context','from-voip-provider','hasOwnProperty','exten','localstationid','uniqueid','channel','name','\x20syncNewchannel\x20','actions','variable','value','channelstate','channelstatedesc','operation','status','filename','info','remotestationid','pagestransferred','resolution','transferrate','calleridnum','/var/opt/motion2/server/files/attachments/','\x20result\x20conversion\x20file\x20','message','create','parse','.pdf','application/pdf','then','catch','\x20notify\x20','error','\x20receiveFax\x20','stringify','pick'];(function(_0x5c005f,_0x4da3d6){var _0xde5bbc=function(_0x5a6054){while(--_0x5a6054){_0x5c005f['push'](_0x5c005f['shift']());}};_0xde5bbc(++_0x4da3d6);}(_0x2f68,0x9a));var _0x82f6=function(_0x2096b1,_0x140684){_0x2096b1=_0x2096b1-0x0;var _0x26a56b=_0x2f68[_0x2096b1];return _0x26a56b;};'use strict';var util=require('util');var _=require(_0x82f6('0x0'));var BPromise=require(_0x82f6('0x1'));var uuid=require(_0x82f6('0x2'));var moment=require(_0x82f6('0x3'));var path=require('path');var tiff2pdf=require(_0x82f6('0x4'));var gs=require('./util/gs');var logger=require(_0x82f6('0x5'))(_0x82f6('0x6'));var ami=require('../ami');var rpcDb=require(_0x82f6('0x7'));var Channel=require(_0x82f6('0x8'));var ut=require('./util/util');var Action=require('./action');var faxAccount=require(_0x82f6('0x9'));var attachment=require('../rpc/attachment');var faxMessage=require('../rpc/faxMessage');function Fax(_0x864400){this[_0x82f6('0xa')]={};this[_0x82f6('0xb')]=_0x864400['faxAccounts'];this[_0x82f6('0xc')]=_0x864400[_0x82f6('0xc')];this['actions']={};ami['on'](_0x82f6('0xd'),this[_0x82f6('0xe')][_0x82f6('0xf')](this));ami['on'](_0x82f6('0x10'),this[_0x82f6('0x11')][_0x82f6('0xf')](this));ami['on']('newstate',this[_0x82f6('0x12')][_0x82f6('0xf')](this));ami['on']('newexten',this[_0x82f6('0x13')][_0x82f6('0xf')](this));ami['on'](_0x82f6('0x14'),this[_0x82f6('0x15')][_0x82f6('0xf')](this));ami['on'](_0x82f6('0x16'),this[_0x82f6('0x17')][_0x82f6('0xf')](this));ami['on'](_0x82f6('0x18'),this['syncHangup'][_0x82f6('0xf')](this));ami['on']('originateresponse',this[_0x82f6('0x19')][_0x82f6('0xf')](this));}Fax[_0x82f6('0x1a')][_0x82f6('0xe')]=function(_0x18e8dd){if(_0x18e8dd[_0x82f6('0x1b')]===_0x82f6('0x1c')){for(var _0xcbc95f in this[_0x82f6('0xb')]){if(this[_0x82f6('0xb')][_0x82f6('0x1d')](_0xcbc95f)){if(_0x18e8dd[_0x82f6('0x1e')]===this[_0x82f6('0xb')][_0xcbc95f][_0x82f6('0x1f')]){this[_0x82f6('0xa')][_0x18e8dd['uniqueid']]={};this[_0x82f6('0xa')][_0x18e8dd[_0x82f6('0x20')]]['channel']=_0x18e8dd[_0x82f6('0x21')];this[_0x82f6('0xa')][_0x18e8dd[_0x82f6('0x20')]]['id']=this[_0x82f6('0xb')][_0xcbc95f]['id'];this['channels'][_0x18e8dd[_0x82f6('0x20')]]['name']=this[_0x82f6('0xb')][_0xcbc95f][_0x82f6('0x22')];logger['info'](_0x18e8dd['uniqueid'],_0x82f6('0x23'));}}}}if(this[_0x82f6('0x24')][_0x18e8dd['uniqueid']]){this['channels'][_0x18e8dd[_0x82f6('0x20')]]={};this[_0x82f6('0xa')][_0x18e8dd['uniqueid']][_0x82f6('0x21')]=_0x18e8dd[_0x82f6('0x21')];logger['info'](_0x18e8dd['uniqueid'],_0x82f6('0x23'));}};Fax['prototype'][_0x82f6('0x11')]=function(_0x5a6d69){if(this['channels'][_0x5a6d69[_0x82f6('0x20')]]){for(var _0x15c9b7 in _0x5a6d69[_0x82f6('0x25')]){if(_0x5a6d69[_0x82f6('0x25')]['hasOwnProperty'](_0x15c9b7)){this[_0x82f6('0xa')][_0x5a6d69[_0x82f6('0x20')]][_0x15c9b7]=_0x5a6d69[_0x82f6('0x26')];}}}};Fax[_0x82f6('0x1a')][_0x82f6('0x12')]=function(_0x328707){if(this[_0x82f6('0xa')][_0x328707[_0x82f6('0x20')]]){this[_0x82f6('0xa')][_0x328707[_0x82f6('0x20')]][_0x82f6('0x27')]=_0x328707[_0x82f6('0x27')];this[_0x82f6('0xa')][_0x328707[_0x82f6('0x20')]]['channelstatedesc']=_0x328707[_0x82f6('0x28')];}};Fax[_0x82f6('0x1a')][_0x82f6('0x13')]=function(_0x5a51b4){if(this[_0x82f6('0xa')][_0x5a51b4[_0x82f6('0x20')]]){for(var _0x831131 in _0x5a51b4[_0x82f6('0x25')]){if(_0x5a51b4[_0x82f6('0x25')][_0x82f6('0x1d')](_0x831131)){this[_0x82f6('0xa')][_0x5a51b4[_0x82f6('0x20')]][_0x831131]=_0x5a51b4[_0x82f6('0x26')];}}}};Fax[_0x82f6('0x1a')][_0x82f6('0x15')]=function(_0x31df71){if(this[_0x82f6('0xa')][_0x31df71[_0x82f6('0x20')]]){this['channels'][_0x31df71[_0x82f6('0x20')]][_0x82f6('0x29')]=_0x31df71[_0x82f6('0x29')];this[_0x82f6('0xa')][_0x31df71[_0x82f6('0x20')]][_0x82f6('0x2a')]=_0x31df71[_0x82f6('0x2a')];this[_0x82f6('0xa')][_0x31df71[_0x82f6('0x20')]][_0x82f6('0x1f')]=_0x31df71[_0x82f6('0x1f')];this[_0x82f6('0xa')][_0x31df71[_0x82f6('0x20')]][_0x82f6('0x2b')]=_0x31df71['filename'];logger[_0x82f6('0x2c')](_0x31df71['uniqueid'],'\x20syncFaxStatus\x20');}};Fax[_0x82f6('0x1a')][_0x82f6('0x17')]=function(_0x5e8828){var _0x249cae=this;if(this[_0x82f6('0xa')][_0x5e8828[_0x82f6('0x20')]]){var _0x56e5f1=this[_0x82f6('0xa')][_0x5e8828['uniqueid']]['id'];this[_0x82f6('0xa')][_0x5e8828['uniqueid']][_0x82f6('0x2d')]=_0x5e8828['remotestationid'];this[_0x82f6('0xa')][_0x5e8828[_0x82f6('0x20')]]['pagestransferred']=_0x5e8828[_0x82f6('0x2e')];this[_0x82f6('0xa')][_0x5e8828[_0x82f6('0x20')]][_0x82f6('0x1f')]=_0x5e8828['localstationid'];this[_0x82f6('0xa')][_0x5e8828[_0x82f6('0x20')]][_0x82f6('0x2f')]=_0x5e8828[_0x82f6('0x2f')];this['channels'][_0x5e8828[_0x82f6('0x20')]][_0x82f6('0x30')]=_0x5e8828['transferrate'];this[_0x82f6('0xa')][_0x5e8828[_0x82f6('0x20')]][_0x82f6('0x2b')]=_0x5e8828[_0x82f6('0x2b')];this[_0x82f6('0xa')][_0x5e8828['uniqueid']][_0x82f6('0x31')]=_0x5e8828['calleridnum'];if(this[_0x82f6('0xa')][_0x5e8828[_0x82f6('0x20')]][_0x82f6('0x2e')]>0x0){tiff2pdf(_0x5e8828[_0x82f6('0x2b')],_0x82f6('0x32'),function(_0x293002){logger[_0x82f6('0x2c')](_0x5e8828['uniqueid'],_0x82f6('0x33'),_0x293002[_0x82f6('0x34')]);attachment[_0x82f6('0x35')]({'name':path[_0x82f6('0x36')](_0x5e8828['filename'])[_0x82f6('0x22')],'basename':path['parse'](_0x5e8828[_0x82f6('0x2b')])[_0x82f6('0x22')]+_0x82f6('0x37'),'type':_0x82f6('0x38')})[_0x82f6('0x39')](function(_0xa8b529){faxAccount['notify'](_0x56e5f1,{'from':_0x5e8828[_0x82f6('0x31')],'mapKey':_0x82f6('0x6'),'body':path[_0x82f6('0x36')](_0x5e8828[_0x82f6('0x2b')])[_0x82f6('0x22')]+_0x82f6('0x37'),'AttachmentId':_0xa8b529['id']})[_0x82f6('0x3a')](function(_0x33e630){logger['error'](_0x5e8828[_0x82f6('0x20')],_0x82f6('0x3b'),JSON['stringify'](_0x33e630));});})[_0x82f6('0x3a')](function(_0x5cc23b){logger[_0x82f6('0x3c')](_0x5e8828['uniqueid'],_0x82f6('0x3d'),JSON[_0x82f6('0x3e')](_0x5cc23b));});});}logger[_0x82f6('0x2c')](_0x5e8828[_0x82f6('0x20')],_0x82f6('0x3d'));}};Fax[_0x82f6('0x1a')]['syncOriginateResponse']=function(_0x3cb1f0){if(this[_0x82f6('0x24')][_0x3cb1f0['uniqueid']]){_['merge'](this[_0x82f6('0xa')][_0x3cb1f0[_0x82f6('0x20')]],_[_0x82f6('0x3f')](_0x3cb1f0,['response',_0x82f6('0x40')]));}};function updateStatus(_0x7614da){if(_0x7614da[_0x82f6('0x41')]){faxMessage[_0x82f6('0x42')](_0x7614da['AttachmentId'],{'failMessage':'SENDING\x20FAILED\x20'})[_0x82f6('0x39')](function(_0x1d56e7){ut[_0x82f6('0x43')]('[Fax][Message][Error][Updated]',_0x1d56e7);})[_0x82f6('0x3a')](function(_0x26194c){ut['logger']('[Fax][Message][Error][NoUpdate1]',_0x26194c);});}else{ut['logger'](_0x82f6('0x44'));}}Fax['prototype'][_0x82f6('0x45')]=function(_0x57c023,_0x33c359,_0x4f69de){var _0x9fae5a=this;var _0x58f89b={};if(_0x33c359){_0x58f89b={'read':_0x33c359};}else{_0x58f89b={'failMessage':_0x4f69de};}if(this[_0x82f6('0x24')][_0x57c023][_0x82f6('0x41')]){faxMessage[_0x82f6('0x42')](this[_0x82f6('0x24')][_0x57c023][_0x82f6('0x41')],_0x58f89b)[_0x82f6('0x39')](function(_0x597844){ut[_0x82f6('0x43')](_0x82f6('0x46'),_0x597844);})[_0x82f6('0x3a')](function(_0x5bd7c4){ut['logger'](_0x82f6('0x47'),_0x5bd7c4);})[_0x82f6('0x48')](function(){delete _0x9fae5a[_0x82f6('0xa')][_0x57c023];delete _0x9fae5a[_0x82f6('0x24')][_0x57c023];});}else{ut['logger'](_0x82f6('0x49'));delete this[_0x82f6('0xa')][_0x57c023];delete this[_0x82f6('0x24')][_0x57c023];}};Fax['prototype']['syncHangup']=function(_0x5f0801){var _0x44218c=this;if(this[_0x82f6('0xa')][_0x5f0801[_0x82f6('0x20')]]){if(this[_0x82f6('0x24')][_0x5f0801[_0x82f6('0x20')]]){this[_0x82f6('0xa')][_0x5f0801[_0x82f6('0x20')]]['id']=this[_0x82f6('0x24')][_0x5f0801['uniqueid']]['id'];this[_0x82f6('0xa')][_0x5f0801[_0x82f6('0x20')]][_0x82f6('0x22')]=this[_0x82f6('0x24')][_0x5f0801['uniqueid']]['name'];}logger[_0x82f6('0x2c')](_0x5f0801[_0x82f6('0x20')],this['actions'][_0x5f0801[_0x82f6('0x20')]]?_0x82f6('0x4a'):_0x82f6('0x4b'),JSON['stringify'](this[_0x82f6('0xa')][_0x5f0801[_0x82f6('0x20')]]));if(this[_0x82f6('0x24')][_0x5f0801[_0x82f6('0x20')]]){if(this[_0x82f6('0xa')][_0x5f0801[_0x82f6('0x20')]]['faxpages']>0x0&&this[_0x82f6('0xa')][_0x5f0801[_0x82f6('0x20')]][_0x82f6('0x14')]===_0x82f6('0x4c')){this[_0x82f6('0x45')](_0x5f0801['uniqueid'],!![]);}else{this[_0x82f6('0x45')](_0x5f0801[_0x82f6('0x20')],![],this[_0x82f6('0xa')][_0x5f0801[_0x82f6('0x20')]][_0x82f6('0x4d')]?_0x82f6('0x4e')+this[_0x82f6('0xa')][_0x5f0801[_0x82f6('0x20')]]['faxstatusstring']:_0x82f6('0x4f'));}}}};Fax['prototype'][_0x82f6('0x50')]=function(_0x85ea2e){var _0x4e51a6=this;return new BPromise(function(_0x843458,_0x32e43d){_0x4e51a6[_0x82f6('0x51')](_0x85ea2e,_0x4e51a6['faxAccounts'][_0x85ea2e['FaxAccountId']])[_0x82f6('0x39')](function(_0x31f3cc){ut['logger']('[Fax][execOriginate][success]',_0x31f3cc);_0x843458(ut[_0x82f6('0x34')](_0x82f6('0x52')));})[_0x82f6('0x3a')](function(_0x3b3712){ut[_0x82f6('0x43')](_0x82f6('0x53'),_0x3b3712);updateStatus(_0x85ea2e);_0x32e43d(ut[_0x82f6('0x34')](_0x82f6('0x54')));});});};Fax[_0x82f6('0x1a')][_0x82f6('0x55')]=function(_0x385902){var _0x41354f=this;return new BPromise(function(_0x53d931,_0xeade13){var _0x16776e=_0x41354f[_0x82f6('0x56')](_0x41354f[_0x82f6('0xb')][_0x385902[_0x82f6('0x57')]]['Trunk'],_0x385902);if(_0x16776e[_0x82f6('0x58')]){_0x53d931(ut[_0x82f6('0x34')](_0x82f6('0x59')));}else{_0xeade13(ut['message'](_0x16776e[_0x82f6('0x34')]));}});};function originate(_0x192dc7,_0x17924d,_0x27a79c){return new BPromise(function(_0xeec407,_0x39a4b3){if(_0x27a79c){var _0x2c6e37=util['format'](_0x82f6('0x5a'),path['parse'](_0x192dc7[_0x82f6('0x5b')])[_0x82f6('0x22')],_0x192dc7[_0x82f6('0x5b')]);gs[_0x82f6('0x5c')](_0x2c6e37)[_0x82f6('0x39')](function(){_0x192dc7[_0x82f6('0x5b')]=util[_0x82f6('0x5d')](_0x82f6('0x5e'),path[_0x82f6('0x36')](_0x192dc7['path'])[_0x82f6('0x5f')],path[_0x82f6('0x36')](_0x192dc7[_0x82f6('0x5b')])[_0x82f6('0x22')]);_0x17924d[_0x82f6('0x60')]=_0x192dc7[_0x82f6('0x5b')];ut['logger'](_0x82f6('0x61'),'');ami[_0x82f6('0x62')](ut['variablesAction'](_0x192dc7,_0x17924d))['then'](function(_0x983983){_0xeec407(_0x983983);})[_0x82f6('0x3a')](function(_0xa8c047){_0x39a4b3(_0xa8c047);});})[_0x82f6('0x3a')](function(_0x3cef94){_0x39a4b3(_0x3cef94);});}else{ami[_0x82f6('0x62')](ut['variablesAction'](_0x192dc7,_0x17924d))[_0x82f6('0x39')](function(_0x5a325f){_0xeec407(_0x5a325f);})[_0x82f6('0x3a')](function(_0x483442){_0x39a4b3(_0x483442);});}});}Fax[_0x82f6('0x1a')]['execOriginate']=function(_0xa7bd08,_0xc21e55){var _0x203168=this;return new BPromise(function(_0x584f76,_0x18fb4c){var _0x5e8d8e=uuid['v4']();var _0xcd5dcd=ut[_0x82f6('0x63')](_0xa7bd08,_0xc21e55);_0x203168[_0x82f6('0x24')][_0x5e8d8e]=new Action(_0x5e8d8e,_0xc21e55,_0xa7bd08);var _0x4d1bfd=_0x203168[_0x82f6('0x24')][_0x5e8d8e];if(path[_0x82f6('0x36')](_0xa7bd08[_0x82f6('0x5b')])['ext']==='.pdf'){originate(_0x4d1bfd,_0xcd5dcd,!![])[_0x82f6('0x39')](function(_0x30327a){_0x584f76(_0x30327a);})[_0x82f6('0x3a')](function(_0x1a1082){_0x18fb4c(_0x1a1082);});}else{originate(_0x4d1bfd,_0xcd5dcd,![])[_0x82f6('0x39')](function(_0xf822a6){_0x584f76(_0xf822a6);})[_0x82f6('0x3a')](function(_0x286f4e){_0x18fb4c(_0x286f4e);});}});};Fax['prototype'][_0x82f6('0x64')]=function(_0x34de40){return!_['isNil'](_0x34de40)&&!_[_0x82f6('0x65')](_0x34de40[_0x82f6('0x22')])&&!_[_0x82f6('0x65')](_0x34de40['active'])&&_0x34de40[_0x82f6('0x66')]&&!_[_0x82f6('0x65')](this[_0x82f6('0xc')][util[_0x82f6('0x5d')]('SIP/%s',_0x34de40[_0x82f6('0x22')])])&&!_[_0x82f6('0x65')](this[_0x82f6('0xc')][util[_0x82f6('0x5d')](_0x82f6('0x67'),_0x34de40[_0x82f6('0x22')])]['status'])&&(this[_0x82f6('0xc')][util[_0x82f6('0x5d')](_0x82f6('0x67'),_0x34de40[_0x82f6('0x22')])][_0x82f6('0x2a')]==='reachable'||this[_0x82f6('0xc')][util['format'](_0x82f6('0x67'),_0x34de40[_0x82f6('0x22')])][_0x82f6('0x2a')]===_0x82f6('0x68'));};Fax[_0x82f6('0x1a')][_0x82f6('0x56')]=function(_0x199740,_0x4d7198){if(!this[_0x82f6('0x64')](_0x199740)){ut[_0x82f6('0x43')]('[Fax][checkTrunk][Trunk\x20not\x20work]',_[_0x82f6('0x65')](_0x199740)?'':_0x199740[_0x82f6('0x22')]+_0x82f6('0x69'));return{'isValid':![],'message':'Trunk\x20not\x20working'};}if(_[_0x82f6('0x65')](_0x4d7198['fax'])){ut[_0x82f6('0x43')](_0x82f6('0x6a'),JSON['stringify'](_0x4d7198));return{'isValid':![],'message':_0x82f6('0x6b')};}if(_[_0x82f6('0x65')](_0x4d7198[_0x82f6('0x5b')])){ut[_0x82f6('0x43')]('[Fax][checkTrunk][Empty\x20path]',JSON[_0x82f6('0x3e')](_0x4d7198));return{'isValid':![],'message':'Empty\x20path'};}return{'isValid':!![],'message':'Is\x20Valid'};};module[_0x82f6('0x6c')]=Fax; \ No newline at end of file +var _0x8603=['filename','calleridnum','message','create','parse','.pdf','application/pdf','then','notify','fax','catch','error','\x20notify\x20','stringify','\x20receiveFax\x20','pick','reason','AttachmentId','SENDING\x20FAILED\x20','[Fax][Message][Error][Updated]','logger','[Fax][Message][Error][NoUpdate2]','updateStatus','update','[Fax][Message][Updated]','[Fax][Message][NoUpdate1]','finally','\x20hangup\x20sendFile\x20','\x20hangup\x20faxRiceive\x20','faxpages','SUCCESS','faxstatusstring','SENDING\x20FAILED:\x20','SENDING\x20FAILED','execOriginate','[Fax][execOriginate][success]','Fax\x20received','Fax\x20failed','checkAfterSend','checkTrunk','Trunk','isValid','Trunk\x20Reachable','format','path','Action','variablesAction','addVariables','ext','isTrunkReachable','active','SIP/%s','reachable','unmonitored','[Fax][checkTrunk][Trunk\x20not\x20work]','isNil','Trunk\x20not\x20working','[Fax][checkTrunk][Empty\x20Fax]','[Fax][checkTrunk][Empty\x20path]','Empty\x20path','Is\x20Valid','lodash','bluebird','uuid','tiff2pdf','./util/gs','../../../config/logger','../ami','./channel','./util/util','./action','../rpc/faxAccount','../rpc/attachment','faxAccounts','trunks','actions','syncNewchannel','bind','syncVarSet','syncNewState','newexten','syncNewExten','faxstatus','syncFaxStatus','receivefax','syncReceiveFax','hangup','syncHangup','originateresponse','syncOriginateResponse','prototype','context','from-voip-provider','hasOwnProperty','exten','channels','uniqueid','channel','name','info','\x20syncNewchannel\x20','variable','value','channelstate','channelstatedesc','operation','status','localstationid','\x20syncFaxStatus\x20','remotestationid','pagestransferred','resolution','transferrate'];(function(_0xefd70,_0x443899){var _0x4d9a13=function(_0xd0ff0e){while(--_0xd0ff0e){_0xefd70['push'](_0xefd70['shift']());}};_0x4d9a13(++_0x443899);}(_0x8603,0x190));var _0x3860=function(_0x277fbc,_0x133abf){_0x277fbc=_0x277fbc-0x0;var _0x9e7117=_0x8603[_0x277fbc];return _0x9e7117;};'use strict';var util=require('util');var _=require(_0x3860('0x0'));var BPromise=require(_0x3860('0x1'));var uuid=require(_0x3860('0x2'));var moment=require('moment');var path=require('path');var tiff2pdf=require(_0x3860('0x3'));var gs=require(_0x3860('0x4'));var logger=require(_0x3860('0x5'))('fax');var ami=require(_0x3860('0x6'));var rpcDb=require('./rpcDb');var Channel=require(_0x3860('0x7'));var ut=require(_0x3860('0x8'));var Action=require(_0x3860('0x9'));var faxAccount=require(_0x3860('0xa'));var attachment=require(_0x3860('0xb'));var faxMessage=require('../rpc/faxMessage');function Fax(_0x5c7350){this['channels']={};this[_0x3860('0xc')]=_0x5c7350[_0x3860('0xc')];this['trunks']=_0x5c7350[_0x3860('0xd')];this[_0x3860('0xe')]={};ami['on']('newchannel',this[_0x3860('0xf')][_0x3860('0x10')](this));ami['on']('varset',this[_0x3860('0x11')][_0x3860('0x10')](this));ami['on']('newstate',this[_0x3860('0x12')][_0x3860('0x10')](this));ami['on'](_0x3860('0x13'),this[_0x3860('0x14')][_0x3860('0x10')](this));ami['on'](_0x3860('0x15'),this[_0x3860('0x16')][_0x3860('0x10')](this));ami['on'](_0x3860('0x17'),this[_0x3860('0x18')]['bind'](this));ami['on'](_0x3860('0x19'),this[_0x3860('0x1a')][_0x3860('0x10')](this));ami['on'](_0x3860('0x1b'),this[_0x3860('0x1c')][_0x3860('0x10')](this));}Fax[_0x3860('0x1d')][_0x3860('0xf')]=function(_0x311fdb){if(_0x311fdb[_0x3860('0x1e')]===_0x3860('0x1f')){for(var _0x45b799 in this['faxAccounts']){if(this['faxAccounts'][_0x3860('0x20')](_0x45b799)){if(_0x311fdb[_0x3860('0x21')]===this[_0x3860('0xc')][_0x45b799]['localstationid']){this[_0x3860('0x22')][_0x311fdb[_0x3860('0x23')]]={};this[_0x3860('0x22')][_0x311fdb[_0x3860('0x23')]][_0x3860('0x24')]=_0x311fdb[_0x3860('0x24')];this[_0x3860('0x22')][_0x311fdb[_0x3860('0x23')]]['id']=this[_0x3860('0xc')][_0x45b799]['id'];this[_0x3860('0x22')][_0x311fdb[_0x3860('0x23')]][_0x3860('0x25')]=this[_0x3860('0xc')][_0x45b799][_0x3860('0x25')];logger[_0x3860('0x26')](_0x311fdb['uniqueid'],_0x3860('0x27'));}}}}if(this[_0x3860('0xe')][_0x311fdb[_0x3860('0x23')]]){this[_0x3860('0x22')][_0x311fdb[_0x3860('0x23')]]={};this['channels'][_0x311fdb[_0x3860('0x23')]]['channel']=_0x311fdb['channel'];logger[_0x3860('0x26')](_0x311fdb[_0x3860('0x23')],'\x20syncNewchannel\x20');}};Fax['prototype']['syncVarSet']=function(_0x1b2e4d){if(this[_0x3860('0x22')][_0x1b2e4d[_0x3860('0x23')]]){for(var _0x371f3a in _0x1b2e4d[_0x3860('0x28')]){if(_0x1b2e4d[_0x3860('0x28')]['hasOwnProperty'](_0x371f3a)){this['channels'][_0x1b2e4d[_0x3860('0x23')]][_0x371f3a]=_0x1b2e4d[_0x3860('0x29')];}}}};Fax['prototype'][_0x3860('0x12')]=function(_0x3d5143){if(this[_0x3860('0x22')][_0x3d5143[_0x3860('0x23')]]){this[_0x3860('0x22')][_0x3d5143['uniqueid']][_0x3860('0x2a')]=_0x3d5143[_0x3860('0x2a')];this[_0x3860('0x22')][_0x3d5143['uniqueid']][_0x3860('0x2b')]=_0x3d5143['channelstatedesc'];}};Fax[_0x3860('0x1d')]['syncNewExten']=function(_0x1c498c){if(this[_0x3860('0x22')][_0x1c498c[_0x3860('0x23')]]){for(var _0x47e350 in _0x1c498c[_0x3860('0x28')]){if(_0x1c498c[_0x3860('0x28')]['hasOwnProperty'](_0x47e350)){this[_0x3860('0x22')][_0x1c498c['uniqueid']][_0x47e350]=_0x1c498c[_0x3860('0x29')];}}}};Fax[_0x3860('0x1d')][_0x3860('0x16')]=function(_0x2fc231){if(this[_0x3860('0x22')][_0x2fc231[_0x3860('0x23')]]){this[_0x3860('0x22')][_0x2fc231['uniqueid']][_0x3860('0x2c')]=_0x2fc231[_0x3860('0x2c')];this['channels'][_0x2fc231[_0x3860('0x23')]][_0x3860('0x2d')]=_0x2fc231[_0x3860('0x2d')];this['channels'][_0x2fc231['uniqueid']][_0x3860('0x2e')]=_0x2fc231[_0x3860('0x2e')];this[_0x3860('0x22')][_0x2fc231[_0x3860('0x23')]]['filename']=_0x2fc231['filename'];logger[_0x3860('0x26')](_0x2fc231[_0x3860('0x23')],_0x3860('0x2f'));}};Fax[_0x3860('0x1d')][_0x3860('0x18')]=function(_0x4df2a9){var _0x424424=this;if(this[_0x3860('0x22')][_0x4df2a9['uniqueid']]){var _0x59c662=this[_0x3860('0x22')][_0x4df2a9[_0x3860('0x23')]]['id'];this[_0x3860('0x22')][_0x4df2a9[_0x3860('0x23')]][_0x3860('0x30')]=_0x4df2a9['remotestationid'];this[_0x3860('0x22')][_0x4df2a9['uniqueid']][_0x3860('0x31')]=_0x4df2a9[_0x3860('0x31')];this['channels'][_0x4df2a9[_0x3860('0x23')]][_0x3860('0x2e')]=_0x4df2a9['localstationid'];this[_0x3860('0x22')][_0x4df2a9[_0x3860('0x23')]][_0x3860('0x32')]=_0x4df2a9[_0x3860('0x32')];this['channels'][_0x4df2a9[_0x3860('0x23')]][_0x3860('0x33')]=_0x4df2a9[_0x3860('0x33')];this['channels'][_0x4df2a9[_0x3860('0x23')]]['filename']=_0x4df2a9[_0x3860('0x34')];this[_0x3860('0x22')][_0x4df2a9[_0x3860('0x23')]][_0x3860('0x35')]=_0x4df2a9[_0x3860('0x35')];if(this[_0x3860('0x22')][_0x4df2a9['uniqueid']][_0x3860('0x31')]>0x0){tiff2pdf(_0x4df2a9[_0x3860('0x34')],'/var/opt/motion2/server/files/attachments/',function(_0x531402){logger[_0x3860('0x26')](_0x4df2a9[_0x3860('0x23')],'\x20result\x20conversion\x20file\x20',_0x531402[_0x3860('0x36')]);attachment[_0x3860('0x37')]({'name':path['parse'](_0x4df2a9[_0x3860('0x34')])[_0x3860('0x25')],'basename':path[_0x3860('0x38')](_0x4df2a9[_0x3860('0x34')])[_0x3860('0x25')]+_0x3860('0x39'),'type':_0x3860('0x3a')})[_0x3860('0x3b')](function(_0x1a3f39){faxAccount[_0x3860('0x3c')](_0x59c662,{'from':_0x4df2a9[_0x3860('0x35')],'mapKey':_0x3860('0x3d'),'body':path[_0x3860('0x38')](_0x4df2a9['filename'])[_0x3860('0x25')]+'.pdf','AttachmentId':_0x1a3f39['id']})[_0x3860('0x3e')](function(_0x770334){logger[_0x3860('0x3f')](_0x4df2a9[_0x3860('0x23')],_0x3860('0x40'),JSON[_0x3860('0x41')](_0x770334));});})[_0x3860('0x3e')](function(_0x27ef92){logger['error'](_0x4df2a9[_0x3860('0x23')],_0x3860('0x42'),JSON[_0x3860('0x41')](_0x27ef92));});});}logger['info'](_0x4df2a9[_0x3860('0x23')],_0x3860('0x42'));}};Fax[_0x3860('0x1d')][_0x3860('0x1c')]=function(_0x5ed2db){if(this['actions'][_0x5ed2db[_0x3860('0x23')]]){_['merge'](this[_0x3860('0x22')][_0x5ed2db[_0x3860('0x23')]],_[_0x3860('0x43')](_0x5ed2db,['response',_0x3860('0x44')]));}};function updateStatus(_0x5a019a){if(_0x5a019a[_0x3860('0x45')]){faxMessage['update'](_0x5a019a[_0x3860('0x45')],{'failMessage':_0x3860('0x46')})[_0x3860('0x3b')](function(_0x4b5790){ut['logger'](_0x3860('0x47'),_0x4b5790);})[_0x3860('0x3e')](function(_0x478dd9){ut[_0x3860('0x48')]('[Fax][Message][Error][NoUpdate1]',_0x478dd9);});}else{ut[_0x3860('0x48')](_0x3860('0x49'));}}Fax[_0x3860('0x1d')][_0x3860('0x4a')]=function(_0x426497,_0xe93a04,_0x3fad85){var _0x5a9987=this;var _0x2fb762={};if(_0xe93a04){_0x2fb762={'read':_0xe93a04};}else{_0x2fb762={'failMessage':_0x3fad85};}if(this[_0x3860('0xe')][_0x426497][_0x3860('0x45')]){faxMessage[_0x3860('0x4b')](this[_0x3860('0xe')][_0x426497][_0x3860('0x45')],_0x2fb762)['then'](function(_0x2cf48c){ut[_0x3860('0x48')](_0x3860('0x4c'),_0x2cf48c);})[_0x3860('0x3e')](function(_0x3a55e7){ut[_0x3860('0x48')](_0x3860('0x4d'),_0x3a55e7);})[_0x3860('0x4e')](function(){delete _0x5a9987['channels'][_0x426497];delete _0x5a9987[_0x3860('0xe')][_0x426497];});}else{ut[_0x3860('0x48')]('[Fax][Message][NoUpdate2]');delete this[_0x3860('0x22')][_0x426497];delete this[_0x3860('0xe')][_0x426497];}};Fax[_0x3860('0x1d')]['syncHangup']=function(_0x17d2df){var _0x5f4b87=this;if(this[_0x3860('0x22')][_0x17d2df[_0x3860('0x23')]]){if(this[_0x3860('0xe')][_0x17d2df[_0x3860('0x23')]]){this[_0x3860('0x22')][_0x17d2df[_0x3860('0x23')]]['id']=this[_0x3860('0xe')][_0x17d2df[_0x3860('0x23')]]['id'];this[_0x3860('0x22')][_0x17d2df[_0x3860('0x23')]][_0x3860('0x25')]=this[_0x3860('0xe')][_0x17d2df['uniqueid']]['name'];}logger['info'](_0x17d2df[_0x3860('0x23')],this['actions'][_0x17d2df['uniqueid']]?_0x3860('0x4f'):_0x3860('0x50'),JSON[_0x3860('0x41')](this[_0x3860('0x22')][_0x17d2df[_0x3860('0x23')]]));if(this[_0x3860('0xe')][_0x17d2df['uniqueid']]){if(this['channels'][_0x17d2df['uniqueid']][_0x3860('0x51')]>0x0&&this[_0x3860('0x22')][_0x17d2df[_0x3860('0x23')]]['faxstatus']===_0x3860('0x52')){this['updateStatus'](_0x17d2df[_0x3860('0x23')],!![]);}else{this[_0x3860('0x4a')](_0x17d2df['uniqueid'],![],this[_0x3860('0x22')][_0x17d2df[_0x3860('0x23')]][_0x3860('0x53')]?_0x3860('0x54')+this['channels'][_0x17d2df[_0x3860('0x23')]][_0x3860('0x53')]:_0x3860('0x55'));}}}};Fax['prototype']['send']=function(_0x26e54b){var _0x2ba958=this;return new BPromise(function(_0xe67023,_0x1ca0e7){_0x2ba958[_0x3860('0x56')](_0x26e54b,_0x2ba958[_0x3860('0xc')][_0x26e54b['FaxAccountId']])[_0x3860('0x3b')](function(_0x4fe4e8){ut['logger'](_0x3860('0x57'),_0x4fe4e8);_0xe67023(ut[_0x3860('0x36')](_0x3860('0x58')));})[_0x3860('0x3e')](function(_0x36431e){ut[_0x3860('0x48')]('[Fax][execOriginate][failure]',_0x36431e);updateStatus(_0x26e54b);_0x1ca0e7(ut[_0x3860('0x36')](_0x3860('0x59')));});});};Fax[_0x3860('0x1d')][_0x3860('0x5a')]=function(_0x1478d9){var _0x2a5c06=this;return new BPromise(function(_0x5f2c66,_0x1ae31b){var _0x81010b=_0x2a5c06[_0x3860('0x5b')](_0x2a5c06['faxAccounts'][_0x1478d9['FaxAccountId']][_0x3860('0x5c')],_0x1478d9);if(_0x81010b[_0x3860('0x5d')]){_0x5f2c66(ut[_0x3860('0x36')](_0x3860('0x5e')));}else{_0x1ae31b(ut[_0x3860('0x36')](_0x81010b['message']));}});};function originate(_0x48ade7,_0x2db53f,_0x393bc4){return new BPromise(function(_0x47e144,_0x5d9416){if(_0x393bc4){var _0x2fd2ec=util[_0x3860('0x5f')]('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[_0x3860('0x38')](_0x48ade7[_0x3860('0x60')])[_0x3860('0x25')],_0x48ade7[_0x3860('0x60')]);gs['execute'](_0x2fd2ec)[_0x3860('0x3b')](function(){_0x48ade7[_0x3860('0x60')]=util['format']('%s/%s.tif',path[_0x3860('0x38')](_0x48ade7[_0x3860('0x60')])['dir'],path[_0x3860('0x38')](_0x48ade7['path'])[_0x3860('0x25')]);_0x2db53f['XMF-PATH']=_0x48ade7['path'];ut[_0x3860('0x48')]('Convert\x20pdf\x20to\x20tif','');ami[_0x3860('0x61')](ut[_0x3860('0x62')](_0x48ade7,_0x2db53f))[_0x3860('0x3b')](function(_0x2fd2f4){_0x47e144(_0x2fd2f4);})[_0x3860('0x3e')](function(_0x43c5a1){_0x5d9416(_0x43c5a1);});})['catch'](function(_0x3756b3){_0x5d9416(_0x3756b3);});}else{ami[_0x3860('0x61')](ut[_0x3860('0x62')](_0x48ade7,_0x2db53f))['then'](function(_0x352a44){_0x47e144(_0x352a44);})['catch'](function(_0x30e093){_0x5d9416(_0x30e093);});}});}Fax[_0x3860('0x1d')]['execOriginate']=function(_0x73732c,_0x2cd731){var _0x1e94c4=this;return new BPromise(function(_0x5e3276,_0x572707){var _0x5a282a=uuid['v4']();var _0x4c0914=ut[_0x3860('0x63')](_0x73732c,_0x2cd731);_0x1e94c4[_0x3860('0xe')][_0x5a282a]=new Action(_0x5a282a,_0x2cd731,_0x73732c);var _0x3f8b7c=_0x1e94c4[_0x3860('0xe')][_0x5a282a];if(path['parse'](_0x73732c['path'])[_0x3860('0x64')]===_0x3860('0x39')){originate(_0x3f8b7c,_0x4c0914,!![])[_0x3860('0x3b')](function(_0x61798b){_0x5e3276(_0x61798b);})['catch'](function(_0x3a7c0c){_0x572707(_0x3a7c0c);});}else{originate(_0x3f8b7c,_0x4c0914,![])[_0x3860('0x3b')](function(_0x49a4e6){_0x5e3276(_0x49a4e6);})['catch'](function(_0x32cbe8){_0x572707(_0x32cbe8);});}});};Fax[_0x3860('0x1d')][_0x3860('0x65')]=function(_0x27894f){return!_['isNil'](_0x27894f)&&!_['isNil'](_0x27894f[_0x3860('0x25')])&&!_['isNil'](_0x27894f[_0x3860('0x66')])&&_0x27894f[_0x3860('0x66')]&&!_['isNil'](this['trunks'][util['format'](_0x3860('0x67'),_0x27894f[_0x3860('0x25')])])&&!_['isNil'](this[_0x3860('0xd')][util[_0x3860('0x5f')](_0x3860('0x67'),_0x27894f[_0x3860('0x25')])][_0x3860('0x2d')])&&(this['trunks'][util[_0x3860('0x5f')](_0x3860('0x67'),_0x27894f[_0x3860('0x25')])][_0x3860('0x2d')]===_0x3860('0x68')||this['trunks'][util[_0x3860('0x5f')](_0x3860('0x67'),_0x27894f[_0x3860('0x25')])][_0x3860('0x2d')]===_0x3860('0x69'));};Fax['prototype']['checkTrunk']=function(_0x196c50,_0x2f3eb6){if(!this[_0x3860('0x65')](_0x196c50)){ut[_0x3860('0x48')](_0x3860('0x6a'),_[_0x3860('0x6b')](_0x196c50)?'':_0x196c50[_0x3860('0x25')]+'\x20Trunk\x20is\x20not\x20active');return{'isValid':![],'message':_0x3860('0x6c')};}if(_[_0x3860('0x6b')](_0x2f3eb6['fax'])){ut[_0x3860('0x48')](_0x3860('0x6d'),JSON[_0x3860('0x41')](_0x2f3eb6));return{'isValid':![],'message':'Empty\x20Fax'};}if(_[_0x3860('0x6b')](_0x2f3eb6[_0x3860('0x60')])){ut['logger'](_0x3860('0x6e'),JSON['stringify'](_0x2f3eb6));return{'isValid':![],'message':_0x3860('0x6f')};}return{'isValid':!![],'message':_0x3860('0x70')};};module['exports']=Fax; \ No newline at end of file diff --git a/server/services/ami/fax/rpcDb.js b/server/services/ami/fax/rpcDb.js index 1849e0a..e77c885 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 _0xf5e7=['error','notify','resolve','then','[Notify]\x20','util','../../../config/logger','lodash'];(function(_0x10a96c,_0xd8e7f2){var _0x53e738=function(_0x17009d){while(--_0x17009d){_0x10a96c['push'](_0x10a96c['shift']());}};_0x53e738(++_0xd8e7f2);}(_0xf5e7,0x195));var _0x7f5e=function(_0x5d660b,_0x2b6023){_0x5d660b=_0x5d660b-0x0;var _0x29263a=_0xf5e7[_0x5d660b];return _0x29263a;};'use strict';var util=require(_0x7f5e('0x0'));var BPromise=require('bluebird');var logger=require(_0x7f5e('0x1'))('preview');var _=require(_0x7f5e('0x2'));var faxAccount=require('../rpc/faxAccount');function loggerCatch(_0x4b9476){return function(_0x174434){logger[_0x7f5e('0x3')](_0x4b9476,util['inspect'](_0x174434,{'showHidden':![],'depth':null}));};}exports[_0x7f5e('0x4')]=function(_0x396f96,_0x59b70c){return BPromise[_0x7f5e('0x5')]()[_0x7f5e('0x6')](faxAccount[_0x7f5e('0x4')](_0x396f96,_0x59b70c))['catch'](loggerCatch(_0x7f5e('0x7')));}; \ No newline at end of file +var _0xcb5f=['[Notify]\x20','util','bluebird','../../../config/logger','lodash','../rpc/faxAccount','resolve','then','notify','catch'];(function(_0x1bd3dd,_0x40a78a){var _0xe1a1d4=function(_0x24f68d){while(--_0x24f68d){_0x1bd3dd['push'](_0x1bd3dd['shift']());}};_0xe1a1d4(++_0x40a78a);}(_0xcb5f,0x169));var _0xfcb5=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0xcb5f[_0x19950b];return _0x3c6b41;};'use strict';var util=require(_0xfcb5('0x0'));var BPromise=require(_0xfcb5('0x1'));var logger=require(_0xfcb5('0x2'))('preview');var _=require(_0xfcb5('0x3'));var faxAccount=require(_0xfcb5('0x4'));function loggerCatch(_0x24f57b){return function(_0x582fc3){logger['error'](_0x24f57b,util['inspect'](_0x582fc3,{'showHidden':![],'depth':null}));};}exports['notify']=function(_0x10a4ca,_0x2abb5d){return BPromise[_0xfcb5('0x5')]()[_0xfcb5('0x6')](faxAccount[_0xfcb5('0x7')](_0x10a4ca,_0x2abb5d))[_0xfcb5('0x8')](loggerCatch(_0xfcb5('0x9')));}; \ No newline at end of file diff --git a/server/services/ami/fax/util/gs.js b/server/services/ami/fax/util/gs.js index 180bd4d..9c0faac 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 _0xebab=['inspect','util','../../../../config/logger','fax','child_process','exec','execute','info','Exec\x20gs','\x20Error\x20:'];(function(_0x45dc8c,_0x9fe602){var _0x1cebd3=function(_0x2c6720){while(--_0x2c6720){_0x45dc8c['push'](_0x45dc8c['shift']());}};_0x1cebd3(++_0x9fe602);}(_0xebab,0x1eb));var _0xbeba=function(_0x2b4a7d,_0xa488aa){_0x2b4a7d=_0x2b4a7d-0x0;var _0x50d85e=_0xebab[_0x2b4a7d];return _0x50d85e;};'use strict';var util=require(_0xbeba('0x0'));var logger=require(_0xbeba('0x1'))(_0xbeba('0x2'));var BPromise=require('bluebird');var exec=require(_0xbeba('0x3'))[_0xbeba('0x4')];exports[_0xbeba('0x5')]=function(_0x5e1c6d){return new BPromise(function(_0x4e0690,_0x362be4){exec(_0x5e1c6d,function(_0x3dbf4f,_0x36f94c,_0x4a2771){logger[_0xbeba('0x6')]('Exec\x20gs',_0x36f94c);if(_0x3dbf4f){logger['info'](_0xbeba('0x7'),_0xbeba('0x8'),util[_0xbeba('0x9')](_0x3dbf4f,{'showHidden':![],'depth':null}),_0x36f94c,_0x4a2771);_0x362be4(_0x3dbf4f);}_0x4e0690(_0x36f94c);});});}; \ No newline at end of file +var _0xb1b9=['Exec\x20gs','\x20Error\x20:','../../../../config/logger','exec','execute','info'];(function(_0x4852ff,_0x35118d){var _0x3ee92e=function(_0x37de82){while(--_0x37de82){_0x4852ff['push'](_0x4852ff['shift']());}};_0x3ee92e(++_0x35118d);}(_0xb1b9,0x122));var _0x9b1b=function(_0x5cb15d,_0x420dee){_0x5cb15d=_0x5cb15d-0x0;var _0x12d95d=_0xb1b9[_0x5cb15d];return _0x12d95d;};'use strict';var util=require('util');var logger=require(_0x9b1b('0x0'))('fax');var BPromise=require('bluebird');var exec=require('child_process')[_0x9b1b('0x1')];exports[_0x9b1b('0x2')]=function(_0x26ee1c){return new BPromise(function(_0x20d28e,_0x940c6c){exec(_0x26ee1c,function(_0x41db27,_0x45b268,_0x3583f3){logger[_0x9b1b('0x3')](_0x9b1b('0x4'),_0x45b268);if(_0x41db27){logger[_0x9b1b('0x3')](_0x9b1b('0x4'),_0x9b1b('0x5'),util['inspect'](_0x41db27,{'showHidden':![],'depth':null}),_0x45b268,_0x3583f3);_0x940c6c(_0x41db27);}_0x20d28e(_0x45b268);});});}; \ 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 f1479e8..b0490c7 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 _0x75bd=['\x22%s\x22\x20<%s>','util','lodash','../../../../config/logger','message','info','inspect','addVariables','headerinfo','format','\x22%s\x22','modem','gateway','faxdetect','localstationid','path','variablesAction','uniqueid','originate','channel','xcally-motion-fax','from-sip'];(function(_0x446186,_0x116e31){var _0x63b564=function(_0x590a14){while(--_0x590a14){_0x446186['push'](_0x446186['shift']());}};_0x63b564(++_0x116e31);}(_0x75bd,0x14b));var _0xd75b=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x75bd[_0x14add3];return _0x4a174f;};'use strict';var util=require(_0xd75b('0x0'));var _=require(_0xd75b('0x1'));var moment=require('moment');var logger=require(_0xd75b('0x2'))('fax');exports[_0xd75b('0x3')]=function(_0x5ca5fa){return{'message':_0x5ca5fa};};exports['logger']=function(_0x1c6f63,_0xa16ac8){logger[_0xd75b('0x4')](_0x1c6f63,util[_0xd75b('0x5')](_0xa16ac8,{'showHidden':![],'depth':null}));};exports[_0xd75b('0x6')]=function(_0x51c437,_0x3110cf){var _0xfc6587={'XMF-ECM':_0x3110cf['ecm'],'XMF-HEADERINFO':_0x3110cf[_0xd75b('0x7')],'XMF-MINRATE':_0x3110cf['minrate'],'XMF-MAXRATE':_0x3110cf['maxrate'],'XMF-MODEM':util[_0xd75b('0x8')](_0xd75b('0x9'),_0x3110cf[_0xd75b('0xa')]),'XMF-GATEWAY':_0x3110cf[_0xd75b('0xb')],'XMF-FAXDETECT':_0x3110cf[_0xd75b('0xc')],'XMF-T38TIMEOUT':_0x3110cf['t38timeout'],'XMF-LOCALSTATIONID':_0x3110cf[_0xd75b('0xd')],'XMF-PATH':_0x51c437[_0xd75b('0xe')]};return _0xfc6587;};exports[_0xd75b('0xf')]=function(_0x1b711a,_0x796c20){return{'actionid':_0x1b711a[_0xd75b('0x10')],'action':_0xd75b('0x11'),'channel':_0x1b711a[_0xd75b('0x12')],'Exten':_0xd75b('0x13'),'Context':_0xd75b('0x14'),'Priority':'1','callerid':util[_0xd75b('0x8')](_0xd75b('0x15'),_0x1b711a[_0xd75b('0x7')]?_0x1b711a[_0xd75b('0x7')]:'',_0x1b711a[_0xd75b('0xd')]),'variable':_0x796c20,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x1b711a[_0xd75b('0x10')]};}; \ No newline at end of file +var _0x8f87=['inspect','addVariables','ecm','headerinfo','minrate','maxrate','\x22%s\x22','modem','faxdetect','t38timeout','localstationid','path','variablesAction','uniqueid','originate','channel','from-sip','format','\x22%s\x22\x20<%s>','lodash','../../../../config/logger','fax','message','logger'];(function(_0x26462c,_0xd20a35){var _0x509a42=function(_0x1b22c9){while(--_0x1b22c9){_0x26462c['push'](_0x26462c['shift']());}};_0x509a42(++_0xd20a35);}(_0x8f87,0x17b));var _0x78f8=function(_0xbc2974,_0xec3342){_0xbc2974=_0xbc2974-0x0;var _0x3a5b4f=_0x8f87[_0xbc2974];return _0x3a5b4f;};'use strict';var util=require('util');var _=require(_0x78f8('0x0'));var moment=require('moment');var logger=require(_0x78f8('0x1'))(_0x78f8('0x2'));exports[_0x78f8('0x3')]=function(_0x15bfc8){return{'message':_0x15bfc8};};exports[_0x78f8('0x4')]=function(_0x230a15,_0x546f8f){logger['info'](_0x230a15,util[_0x78f8('0x5')](_0x546f8f,{'showHidden':![],'depth':null}));};exports[_0x78f8('0x6')]=function(_0x3d9d7e,_0x536bba){var _0x251382={'XMF-ECM':_0x536bba[_0x78f8('0x7')],'XMF-HEADERINFO':_0x536bba[_0x78f8('0x8')],'XMF-MINRATE':_0x536bba[_0x78f8('0x9')],'XMF-MAXRATE':_0x536bba[_0x78f8('0xa')],'XMF-MODEM':util['format'](_0x78f8('0xb'),_0x536bba[_0x78f8('0xc')]),'XMF-GATEWAY':_0x536bba['gateway'],'XMF-FAXDETECT':_0x536bba[_0x78f8('0xd')],'XMF-T38TIMEOUT':_0x536bba[_0x78f8('0xe')],'XMF-LOCALSTATIONID':_0x536bba[_0x78f8('0xf')],'XMF-PATH':_0x3d9d7e[_0x78f8('0x10')]};return _0x251382;};exports[_0x78f8('0x11')]=function(_0x4eff1f,_0x3cba22){return{'actionid':_0x4eff1f[_0x78f8('0x12')],'action':_0x78f8('0x13'),'channel':_0x4eff1f[_0x78f8('0x14')],'Exten':'xcally-motion-fax','Context':_0x78f8('0x15'),'Priority':'1','callerid':util[_0x78f8('0x16')](_0x78f8('0x17'),_0x4eff1f[_0x78f8('0x8')]?_0x4eff1f['headerinfo']:'',_0x4eff1f['localstationid']),'variable':_0x3cba22,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x4eff1f[_0x78f8('0x12')]};}; \ No newline at end of file diff --git a/server/services/ami/index.js b/server/services/ami/index.js index da1768d..f2b73ec 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 _0xffe4=['./rpc/integrations/desk','./rpc/integrations/zoho','./rpc/integrations/vtiger','./rpc/integrations/freshsales','ami','get','hour','resolve','getAgents','then','initAgents','initTelephones','getTrunks','getVoiceQueues','getTriggers','initTriggers','getTemplates','initTemplates','getZendeskAccounts','initZendeskAccounts','getSalesforceAccounts','initSalesforceAccounts','getFreshdeskAccounts','initFreshdeskAccounts','getDeskAccounts','initDeskAccounts','getZohoAccounts','initZohoAccounts','getVtigerAccounts','getFreshsalesAccounts','initFreshsalesAccounts','getServicenowAccounts','initServicenowAccounts','getDynamics365Accounts','initDynamics365Accounts','getCampaigns','getVoiceExtensions','initVoiceExtensions','getFaxAccounts','initFaxAccounts','getVoiceQueueReports','getVoiceQueueHopperHistory','initVoiceQueueHopperHistory','getCampaignHopperHistory','initCampaignHopperHistory','getVoiceCallReports','initVoiceCallReports','catch','error','[index.js][initParams]','inspect','sync','util','moment','./server','./realtime','./report','./acw','./preview','./fax','./rpc/voiceQueue','./rpc/voiceQueueReport','./rpc/voiceCallReport','./rpc/trigger','./rpc/template','./rpc/cmHopperHistory','./rpc/integrations/zendesk','./rpc/integrations/salesforce','./rpc/integrations/sugarcrm','./rpc/integrations/freshdesk'];(function(_0x20a52f,_0x14f2e6){var _0x4ac92a=function(_0x1119a3){while(--_0x1119a3){_0x20a52f['push'](_0x20a52f['shift']());}};_0x4ac92a(++_0x14f2e6);}(_0xffe4,0x192));var _0x4ffe=function(_0x108783,_0x5f3b58){_0x108783=_0x108783-0x0;var _0xc4ae54=_0xffe4[_0x108783];return _0xc4ae54;};'use strict';var BPromise=require('bluebird');var util=require(_0x4ffe('0x0'));var moment=require(_0x4ffe('0x1'));var server=require(_0x4ffe('0x2'));var Realtime=require(_0x4ffe('0x3'));var Report=require(_0x4ffe('0x4'));var Acw=require(_0x4ffe('0x5'));var Trigger=require('./trigger');var Dialer=require('./dialer');var Preview=require(_0x4ffe('0x6'));var Fax=require(_0x4ffe('0x7'));var user=require('./rpc/user');var voiceQueue=require(_0x4ffe('0x8'));var voiceQueueReport=require(_0x4ffe('0x9'));var voiceCallReport=require(_0x4ffe('0xa'));var trunk=require('./rpc/trunk');var trigger=require(_0x4ffe('0xb'));var template=require(_0x4ffe('0xc'));var cmHopperHistory=require(_0x4ffe('0xd'));var campaign=require('./rpc/campaign');var voiceExtension=require('./rpc/voiceExtension');var faxAccount=require('./rpc/faxAccount');var zendesk=require(_0x4ffe('0xe'));var salesforce=require(_0x4ffe('0xf'));var sugarcrm=require(_0x4ffe('0x10'));var freshdesk=require(_0x4ffe('0x11'));var desk=require(_0x4ffe('0x12'));var zoho=require(_0x4ffe('0x13'));var vtiger=require(_0x4ffe('0x14'));var freshsales=require(_0x4ffe('0x15'));var servicenow=require('./rpc/integrations/servicenow');var dynamics365=require('./rpc/integrations/dynamics365');var realtime=new Realtime();var report=new Report(realtime);var acw=new Acw(realtime);var channelTrigger=new Trigger(realtime);var preview=new Preview(realtime);var dialer=new Dialer(realtime,preview);var fax=new Fax(realtime);var logger=require('../../config/logger')(_0x4ffe('0x16'));var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()[_0x4ffe('0x17')](_0x4ffe('0x18'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0x4ffe('0x17')](_0x4ffe('0x18'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return BPromise[_0x4ffe('0x19')]()['then'](user[_0x4ffe('0x1a')]())[_0x4ffe('0x1b')](realtime[_0x4ffe('0x1c')]())[_0x4ffe('0x1b')](user['getTelephones']())[_0x4ffe('0x1b')](realtime[_0x4ffe('0x1d')]())[_0x4ffe('0x1b')](trunk[_0x4ffe('0x1e')]())['then'](realtime['initTrunks']())[_0x4ffe('0x1b')](voiceQueue[_0x4ffe('0x1f')]())[_0x4ffe('0x1b')](realtime['initVoiceQueues']())[_0x4ffe('0x1b')](trigger[_0x4ffe('0x20')]())[_0x4ffe('0x1b')](realtime[_0x4ffe('0x21')]())[_0x4ffe('0x1b')](template[_0x4ffe('0x22')]())[_0x4ffe('0x1b')](realtime[_0x4ffe('0x23')]())[_0x4ffe('0x1b')](zendesk[_0x4ffe('0x24')]())[_0x4ffe('0x1b')](realtime[_0x4ffe('0x25')]())[_0x4ffe('0x1b')](salesforce[_0x4ffe('0x26')]())[_0x4ffe('0x1b')](realtime[_0x4ffe('0x27')]())['then'](sugarcrm['getSugarcrmAccounts']())['then'](realtime['initSugarcrmAccounts']())[_0x4ffe('0x1b')](freshdesk[_0x4ffe('0x28')]())['then'](realtime[_0x4ffe('0x29')]())['then'](desk[_0x4ffe('0x2a')]())['then'](realtime[_0x4ffe('0x2b')]())[_0x4ffe('0x1b')](zoho[_0x4ffe('0x2c')]())[_0x4ffe('0x1b')](realtime[_0x4ffe('0x2d')]())[_0x4ffe('0x1b')](vtiger[_0x4ffe('0x2e')]())[_0x4ffe('0x1b')](realtime['initVtigerAccounts']())[_0x4ffe('0x1b')](freshsales[_0x4ffe('0x2f')]())[_0x4ffe('0x1b')](realtime[_0x4ffe('0x30')]())[_0x4ffe('0x1b')](servicenow[_0x4ffe('0x31')]())['then'](realtime[_0x4ffe('0x32')]())[_0x4ffe('0x1b')](dynamics365[_0x4ffe('0x33')]())[_0x4ffe('0x1b')](realtime[_0x4ffe('0x34')]())[_0x4ffe('0x1b')](campaign[_0x4ffe('0x35')]())[_0x4ffe('0x1b')](realtime['initCampaigns']())['then'](voiceExtension[_0x4ffe('0x36')]())['then'](realtime[_0x4ffe('0x37')]())['then'](faxAccount[_0x4ffe('0x38')]())[_0x4ffe('0x1b')](realtime[_0x4ffe('0x39')]())[_0x4ffe('0x1b')](function(){return realtime;});}function initParams(){return BPromise[_0x4ffe('0x19')]()[_0x4ffe('0x1b')](voiceQueueReport[_0x4ffe('0x3a')]())[_0x4ffe('0x1b')](realtime['initVoiceQueueReports']())[_0x4ffe('0x1b')](cmHopperHistory[_0x4ffe('0x3b')]())[_0x4ffe('0x1b')](realtime[_0x4ffe('0x3c')]())['then'](cmHopperHistory[_0x4ffe('0x3d')]())[_0x4ffe('0x1b')](realtime[_0x4ffe('0x3e')]())['then'](voiceCallReport[_0x4ffe('0x3f')]())['then'](realtime[_0x4ffe('0x40')]())[_0x4ffe('0x41')](function(_0x185790){logger[_0x4ffe('0x42')](_0x4ffe('0x43'),util[_0x4ffe('0x44')](_0x185790,{'showHidden':![],'depth':null}));});}function main(){return server['listen'](realtime,preview,fax)[_0x4ffe('0x1b')](function(_0x9d1df3){return initRealtime();})['then'](function(){return initParams();})[_0x4ffe('0x1b')](function(){report[_0x4ffe('0x45')]();setInterval(initRealtime,0x1388);})[_0x4ffe('0x41')](function(_0x4da9cb){logger[_0x4ffe('0x42')]('[index.js][main]',util[_0x4ffe('0x44')](_0x4da9cb,{'showHidden':![],'depth':null}));});}main(); \ No newline at end of file +var _0xb870=['./rpc/integrations/dynamics365','../../config/logger','ami','get','hour','resolve','then','initAgents','getTelephones','initTelephones','getTrunks','initTrunks','getVoiceQueues','initVoiceQueues','getTriggers','initTriggers','initTemplates','getZendeskAccounts','initZendeskAccounts','getSalesforceAccounts','initSalesforceAccounts','getSugarcrmAccounts','initSugarcrmAccounts','getFreshdeskAccounts','initFreshdeskAccounts','getDeskAccounts','initDeskAccounts','getZohoAccounts','initFreshsalesAccounts','getDynamics365Accounts','initDynamics365Accounts','getCampaigns','initCampaigns','initVoiceExtensions','getFaxAccounts','initFaxAccounts','initVoiceQueueReports','getVoiceQueueHopperHistory','getCampaignHopperHistory','initCampaignHopperHistory','getVoiceCallReports','initVoiceCallReports','catch','error','[index.js][initParams]','inspect','listen','sync','[index.js][main]','bluebird','moment','./server','./realtime','./report','./trigger','./dialer','./preview','./rpc/user','./rpc/voiceQueue','./rpc/voiceQueueReport','./rpc/voiceCallReport','./rpc/trunk','./rpc/trigger','./rpc/cmHopperHistory','./rpc/campaign','./rpc/voiceExtension','./rpc/integrations/zendesk','./rpc/integrations/salesforce','./rpc/integrations/sugarcrm','./rpc/integrations/freshdesk','./rpc/integrations/zoho','./rpc/integrations/vtiger','./rpc/integrations/freshsales'];(function(_0x7634ab,_0x3ce0af){var _0x108d1d=function(_0x37887c){while(--_0x37887c){_0x7634ab['push'](_0x7634ab['shift']());}};_0x108d1d(++_0x3ce0af);}(_0xb870,0x7a));var _0x0b87=function(_0x23c02b,_0x411b4d){_0x23c02b=_0x23c02b-0x0;var _0x25efc5=_0xb870[_0x23c02b];return _0x25efc5;};'use strict';var BPromise=require(_0x0b87('0x0'));var util=require('util');var moment=require(_0x0b87('0x1'));var server=require(_0x0b87('0x2'));var Realtime=require(_0x0b87('0x3'));var Report=require(_0x0b87('0x4'));var Acw=require('./acw');var Trigger=require(_0x0b87('0x5'));var Dialer=require(_0x0b87('0x6'));var Preview=require(_0x0b87('0x7'));var Fax=require('./fax');var user=require(_0x0b87('0x8'));var voiceQueue=require(_0x0b87('0x9'));var voiceQueueReport=require(_0x0b87('0xa'));var voiceCallReport=require(_0x0b87('0xb'));var trunk=require(_0x0b87('0xc'));var trigger=require(_0x0b87('0xd'));var template=require('./rpc/template');var cmHopperHistory=require(_0x0b87('0xe'));var campaign=require(_0x0b87('0xf'));var voiceExtension=require(_0x0b87('0x10'));var faxAccount=require('./rpc/faxAccount');var zendesk=require(_0x0b87('0x11'));var salesforce=require(_0x0b87('0x12'));var sugarcrm=require(_0x0b87('0x13'));var freshdesk=require(_0x0b87('0x14'));var desk=require('./rpc/integrations/desk');var zoho=require(_0x0b87('0x15'));var vtiger=require(_0x0b87('0x16'));var freshsales=require(_0x0b87('0x17'));var servicenow=require('./rpc/integrations/servicenow');var dynamics365=require(_0x0b87('0x18'));var realtime=new Realtime();var report=new Report(realtime);var acw=new Acw(realtime);var channelTrigger=new Trigger(realtime);var preview=new Preview(realtime);var dialer=new Dialer(realtime,preview);var fax=new Fax(realtime);var logger=require(_0x0b87('0x19'))(_0x0b87('0x1a'));var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()[_0x0b87('0x1b')](_0x0b87('0x1c'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0x0b87('0x1b')](_0x0b87('0x1c'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return BPromise[_0x0b87('0x1d')]()[_0x0b87('0x1e')](user['getAgents']())['then'](realtime[_0x0b87('0x1f')]())[_0x0b87('0x1e')](user[_0x0b87('0x20')]())[_0x0b87('0x1e')](realtime[_0x0b87('0x21')]())[_0x0b87('0x1e')](trunk[_0x0b87('0x22')]())[_0x0b87('0x1e')](realtime[_0x0b87('0x23')]())['then'](voiceQueue[_0x0b87('0x24')]())['then'](realtime[_0x0b87('0x25')]())[_0x0b87('0x1e')](trigger[_0x0b87('0x26')]())[_0x0b87('0x1e')](realtime[_0x0b87('0x27')]())[_0x0b87('0x1e')](template['getTemplates']())[_0x0b87('0x1e')](realtime[_0x0b87('0x28')]())[_0x0b87('0x1e')](zendesk[_0x0b87('0x29')]())[_0x0b87('0x1e')](realtime[_0x0b87('0x2a')]())[_0x0b87('0x1e')](salesforce[_0x0b87('0x2b')]())['then'](realtime[_0x0b87('0x2c')]())[_0x0b87('0x1e')](sugarcrm[_0x0b87('0x2d')]())[_0x0b87('0x1e')](realtime[_0x0b87('0x2e')]())[_0x0b87('0x1e')](freshdesk[_0x0b87('0x2f')]())['then'](realtime[_0x0b87('0x30')]())['then'](desk[_0x0b87('0x31')]())[_0x0b87('0x1e')](realtime[_0x0b87('0x32')]())[_0x0b87('0x1e')](zoho[_0x0b87('0x33')]())['then'](realtime['initZohoAccounts']())['then'](vtiger['getVtigerAccounts']())[_0x0b87('0x1e')](realtime['initVtigerAccounts']())[_0x0b87('0x1e')](freshsales['getFreshsalesAccounts']())[_0x0b87('0x1e')](realtime[_0x0b87('0x34')]())[_0x0b87('0x1e')](servicenow['getServicenowAccounts']())[_0x0b87('0x1e')](realtime['initServicenowAccounts']())[_0x0b87('0x1e')](dynamics365[_0x0b87('0x35')]())[_0x0b87('0x1e')](realtime[_0x0b87('0x36')]())[_0x0b87('0x1e')](campaign[_0x0b87('0x37')]())[_0x0b87('0x1e')](realtime[_0x0b87('0x38')]())['then'](voiceExtension['getVoiceExtensions']())['then'](realtime[_0x0b87('0x39')]())[_0x0b87('0x1e')](faxAccount[_0x0b87('0x3a')]())[_0x0b87('0x1e')](realtime[_0x0b87('0x3b')]())[_0x0b87('0x1e')](function(){return realtime;});}function initParams(){return BPromise[_0x0b87('0x1d')]()[_0x0b87('0x1e')](voiceQueueReport['getVoiceQueueReports']())[_0x0b87('0x1e')](realtime[_0x0b87('0x3c')]())['then'](cmHopperHistory[_0x0b87('0x3d')]())['then'](realtime['initVoiceQueueHopperHistory']())['then'](cmHopperHistory[_0x0b87('0x3e')]())[_0x0b87('0x1e')](realtime[_0x0b87('0x3f')]())[_0x0b87('0x1e')](voiceCallReport[_0x0b87('0x40')]())[_0x0b87('0x1e')](realtime[_0x0b87('0x41')]())[_0x0b87('0x42')](function(_0x3d49c3){logger[_0x0b87('0x43')](_0x0b87('0x44'),util[_0x0b87('0x45')](_0x3d49c3,{'showHidden':![],'depth':null}));});}function main(){return server[_0x0b87('0x46')](realtime,preview,fax)[_0x0b87('0x1e')](function(_0x249641){return initRealtime();})[_0x0b87('0x1e')](function(){return initParams();})[_0x0b87('0x1e')](function(){report[_0x0b87('0x47')]();setInterval(initRealtime,0x1388);})['catch'](function(_0x25d4a0){logger[_0x0b87('0x43')](_0x0b87('0x48'),util[_0x0b87('0x45')](_0x25d4a0,{'showHidden':![],'depth':null}));});}main(); \ No newline at end of file diff --git a/server/services/ami/model/agent.js b/server/services/ami/model/agent.js index 44f3b97..8f3d05a 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 _0x0713=['idle','inuse','talking','voiceStatusTime','toNumber','format','voiceStatusQueue','stringify','user:%s','emit','user:save','user:presence','exports','moment','md5','ioredis','../../../config/environment','redis','localhost','socket.io-emitter','name','email','accountcode','fullname','unknown','stateTime','status','address','mobile','interface','online','voiceStatus','voiceStatusCallerIdNumber','onhold','local','prototype','state','toLowerCase','not_inuse'];(function(_0x21303e,_0x114e55){var _0x37c253=function(_0x1dea1d){while(--_0x1dea1d){_0x21303e['push'](_0x21303e['shift']());}};_0x37c253(++_0x114e55);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x3071('0x0'));var md5=require(_0x3071('0x1'));var Redis=require(_0x3071('0x2'));var config=require(_0x3071('0x3'));config[_0x3071('0x4')]=_['defaults'](config[_0x3071('0x4')],{'host':_0x3071('0x5'),'port':0x18eb});var io=require(_0x3071('0x6'))(new Redis(config[_0x3071('0x4')]));function Agent(_0xabd7b6){this['id']=_0xabd7b6['id']||0x0;this[_0x3071('0x7')]=_0xabd7b6[_0x3071('0x7')]||'';this[_0x3071('0x8')]=_0xabd7b6[_0x3071('0x8')]||'';this[_0x3071('0x9')]=_0xabd7b6[_0x3071('0x9')]||'';this[_0x3071('0xa')]=_0xabd7b6[_0x3071('0xa')]||'';this['state']=_0x3071('0xb');this[_0x3071('0xc')]=0x0;this[_0x3071('0xd')]=_0x3071('0xb');this[_0x3071('0xe')]='';this['phone']='';this[_0x3071('0xf')]='';this[_0x3071('0x10')]='';this[_0x3071('0x11')]=_0xabd7b6[_0x3071('0x11')]||![];this[_0x3071('0x12')]='unknown';this['voiceStatusTime']=0x0;this[_0x3071('0x13')]='';this['voiceStatusQueue']='';this[_0x3071('0x14')]=![];this[_0x3071('0x15')]=![];this['md5']='';}Agent[_0x3071('0x16')]['updateStatusRealtime']=function(_0x2fc15d){var _0x45c93b;if(_0x2fc15d&&_0x2fc15d[_0x3071('0x17')]){_0x45c93b=_0x2fc15d[_0x3071('0x17')][_0x3071('0x18')]();switch(_0x45c93b){case _0x3071('0x19'):_0x45c93b=_0x3071('0x1a');break;case _0x3071('0x1b'):_0x45c93b=_0x3071('0x1c');break;}}if(_0x45c93b&&this[_0x3071('0x12')]!==_0x45c93b||_0x2fc15d['statePause']){this[_0x3071('0x1d')]=_[_0x3071('0x1e')](moment()[_0x3071('0x1f')]('x'));}if(_0x45c93b){this[_0x3071('0x12')]=_0x45c93b;}var _0x3acf0e={'id':this['id'],'name':this[_0x3071('0x7')],'email':this[_0x3071('0x8')],'accountcode':this[_0x3071('0x9')],'fullname':this['fullname'],'state':this[_0x3071('0x17')],'stateTime':this[_0x3071('0xc')],'status':this[_0x3071('0xd')],'address':this['address'],'online':this[_0x3071('0x11')],'voiceStatus':this['voiceStatus'],'voiceStatusTime':this[_0x3071('0x1d')],'voiceStatusCallerIdNumber':this[_0x3071('0x13')],'voiceStatusQueue':this[_0x3071('0x20')],'interface':this[_0x3071('0x10')],'onhold':this[_0x3071('0x14')]};var _0x34c50e=md5(JSON[_0x3071('0x21')](_0x3acf0e));if(this[_0x3071('0x1')]!==_0x34c50e){this['md5']=_0x34c50e;io['to'](util['format'](_0x3071('0x22'),_0x3acf0e[_0x3071('0x7')]))[_0x3071('0x23')](_0x3071('0x24'),_0x3acf0e);io[_0x3071('0x23')](_0x3071('0x25'),_0x3acf0e);}};module[_0x3071('0x26')]=Agent; \ No newline at end of file +var _0x0713=['idle','inuse','talking','voiceStatusTime','toNumber','format','voiceStatusQueue','stringify','user:%s','emit','user:save','user:presence','exports','moment','md5','ioredis','../../../config/environment','redis','localhost','socket.io-emitter','name','email','accountcode','fullname','unknown','stateTime','status','address','mobile','interface','online','voiceStatus','voiceStatusCallerIdNumber','onhold','local','prototype','state','toLowerCase','not_inuse'];(function(_0x59b136,_0x36a76b){var _0x15c993=function(_0x48b403){while(--_0x48b403){_0x59b136['push'](_0x59b136['shift']());}};_0x15c993(++_0x36a76b);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x3071('0x0'));var md5=require(_0x3071('0x1'));var Redis=require(_0x3071('0x2'));var config=require(_0x3071('0x3'));config[_0x3071('0x4')]=_['defaults'](config[_0x3071('0x4')],{'host':_0x3071('0x5'),'port':0x18eb});var io=require(_0x3071('0x6'))(new Redis(config[_0x3071('0x4')]));function Agent(_0xabd7b6){this['id']=_0xabd7b6['id']||0x0;this[_0x3071('0x7')]=_0xabd7b6[_0x3071('0x7')]||'';this[_0x3071('0x8')]=_0xabd7b6[_0x3071('0x8')]||'';this[_0x3071('0x9')]=_0xabd7b6[_0x3071('0x9')]||'';this[_0x3071('0xa')]=_0xabd7b6[_0x3071('0xa')]||'';this['state']=_0x3071('0xb');this[_0x3071('0xc')]=0x0;this[_0x3071('0xd')]=_0x3071('0xb');this[_0x3071('0xe')]='';this['phone']='';this[_0x3071('0xf')]='';this[_0x3071('0x10')]='';this[_0x3071('0x11')]=_0xabd7b6[_0x3071('0x11')]||![];this[_0x3071('0x12')]='unknown';this['voiceStatusTime']=0x0;this[_0x3071('0x13')]='';this['voiceStatusQueue']='';this[_0x3071('0x14')]=![];this[_0x3071('0x15')]=![];this['md5']='';}Agent[_0x3071('0x16')]['updateStatusRealtime']=function(_0x2fc15d){var _0x45c93b;if(_0x2fc15d&&_0x2fc15d[_0x3071('0x17')]){_0x45c93b=_0x2fc15d[_0x3071('0x17')][_0x3071('0x18')]();switch(_0x45c93b){case _0x3071('0x19'):_0x45c93b=_0x3071('0x1a');break;case _0x3071('0x1b'):_0x45c93b=_0x3071('0x1c');break;}}if(_0x45c93b&&this[_0x3071('0x12')]!==_0x45c93b||_0x2fc15d['statePause']){this[_0x3071('0x1d')]=_[_0x3071('0x1e')](moment()[_0x3071('0x1f')]('x'));}if(_0x45c93b){this[_0x3071('0x12')]=_0x45c93b;}var _0x3acf0e={'id':this['id'],'name':this[_0x3071('0x7')],'email':this[_0x3071('0x8')],'accountcode':this[_0x3071('0x9')],'fullname':this['fullname'],'state':this[_0x3071('0x17')],'stateTime':this[_0x3071('0xc')],'status':this[_0x3071('0xd')],'address':this['address'],'online':this[_0x3071('0x11')],'voiceStatus':this['voiceStatus'],'voiceStatusTime':this[_0x3071('0x1d')],'voiceStatusCallerIdNumber':this[_0x3071('0x13')],'voiceStatusQueue':this[_0x3071('0x20')],'interface':this[_0x3071('0x10')],'onhold':this[_0x3071('0x14')]};var _0x34c50e=md5(JSON[_0x3071('0x21')](_0x3acf0e));if(this[_0x3071('0x1')]!==_0x34c50e){this['md5']=_0x34c50e;io['to'](util['format'](_0x3071('0x22'),_0x3acf0e[_0x3071('0x7')]))[_0x3071('0x23')](_0x3071('0x24'),_0x3acf0e);io[_0x3071('0x23')](_0x3071('0x25'),_0x3acf0e);}};module[_0x3071('0x26')]=Agent; \ No newline at end of file diff --git a/server/services/ami/model/campaign.js b/server/services/ami/model/campaign.js index 0ee6e36..35c606d 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 _0xf62e=['dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialQueueProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','exports','name','type','campaign','originated','temp','ivrAnswerCallsDay','ivrTotalCallsDays','message','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency'];(function(_0x16fc32,_0xeca7e0){var _0x5b9a26=function(_0x4b3a33){while(--_0x4b3a33){_0x16fc32['push'](_0x16fc32['shift']());}};_0x5b9a26(++_0xeca7e0);}(_0xf62e,0xb9));var _0xef62=function(_0x214275,_0x4b59df){_0x214275=_0x214275-0x0;var _0x4d81d4=_0xf62e[_0x214275];return _0x4d81d4;};'use strict';function Campaign(_0x58558a){this['id']=_0x58558a['id']||0x0;this[_0xef62('0x0')]=_0x58558a[_0xef62('0x0')]||'';this[_0xef62('0x1')]=_0x58558a[_0xef62('0x1')]||_0xef62('0x2');this[_0xef62('0x3')]=0x0;this[_0xef62('0x4')]=0x0;this[_0xef62('0x5')]=0x0;this[_0xef62('0x6')]=0x0;this[_0xef62('0x7')]='';this['sendMessageOneNotActive']=!![];this[_0xef62('0x8')]=_0x58558a[_0xef62('0x8')];this[_0xef62('0x9')]=_0x58558a['limitCalls'];this[_0xef62('0xa')]=_0x58558a['dialTimezone']||null;this[_0xef62('0xb')]=_0x58558a[_0xef62('0xb')]?_0x58558a[_0xef62('0xb')]:null;this[_0xef62('0xc')]=_0x58558a[_0xef62('0xc')];this[_0xef62('0xd')]=_0x58558a[_0xef62('0xd')];this['dialOriginateTimeout']=_0x58558a[_0xef62('0xe')]||0x1e;this['dialCongestionMaxRetry']=_0x58558a[_0xef62('0xf')];this[_0xef62('0x10')]=_0x58558a[_0xef62('0x10')];this[_0xef62('0x11')]=_0x58558a[_0xef62('0x11')];this[_0xef62('0x12')]=_0x58558a[_0xef62('0x12')];this[_0xef62('0x13')]=_0x58558a[_0xef62('0x13')];this[_0xef62('0x14')]=_0x58558a['dialNoAnswerRetryFrequency'];this[_0xef62('0x15')]=_0x58558a[_0xef62('0x15')];this['dialNoSuchNumberMaxRetry']=_0x58558a['dialNoSuchNumberMaxRetry']||0x3;this['dialNoSuchNumberRetryFrequency']=_0x58558a[_0xef62('0x16')]||0x96;this['dialDropMaxRetry']=_0x58558a[_0xef62('0x17')]||0x3;this['dialDropRetryFrequency']=_0x58558a[_0xef62('0x18')]||0x96;this[_0xef62('0x19')]=_0x58558a[_0xef62('0x19')]||0x3;this['dialAbandonedRetryFrequency']=_0x58558a[_0xef62('0x1a')]||0x96;this[_0xef62('0x1b')]=_0x58558a['dialMachineMaxRetry']||0x3;this[_0xef62('0x1c')]=_0x58558a[_0xef62('0x1c')]||0x96;this[_0xef62('0x1d')]=_0x58558a[_0xef62('0x1d')]||0x3;this['dialAgentRejectRetryFrequency']=_0x58558a[_0xef62('0x1e')]||0x96;this[_0xef62('0x1f')]=_0x58558a[_0xef62('0x1f')]||'DESC';this['dialPrefix']=_0x58558a[_0xef62('0x20')]||undefined;this['dialRandomLastDigitCallerIdNumber']=_0x58558a[_0xef62('0x21')]||undefined;this[_0xef62('0x22')]=_0x58558a[_0xef62('0x22')]||undefined;this['TrunkBackup']=_0x58558a[_0xef62('0x23')]?_0x58558a[_0xef62('0x23')]:undefined;this[_0xef62('0x24')]=_0x58558a['Trunk']?_0x58558a[_0xef62('0x24')]:undefined;this[_0xef62('0x25')]=_0x58558a['Interval']?_0x58558a[_0xef62('0x25')]:undefined;this[_0xef62('0x26')]=_0x58558a['SquareProject']?_0x58558a[_0xef62('0x26')]:undefined;this[_0xef62('0x27')]=_0x58558a[_0xef62('0x26')]?_0x58558a['SquareProject'][_0xef62('0x0')]:undefined;this[_0xef62('0x28')]=_0x58558a['dialAMDActive']||![];this[_0xef62('0x29')]=_0x58558a[_0xef62('0x29')];this[_0xef62('0x2a')]=_0x58558a['dialAMDGreeting'];this['dialAMDAfterGreetingSilence']=_0x58558a[_0xef62('0x2b')];this[_0xef62('0x2c')]=_0x58558a['dialAMDTotalAnalysisTime'];this[_0xef62('0x2d')]=_0x58558a[_0xef62('0x2d')];this['dialAMDBetweenWordsSilence']=_0x58558a[_0xef62('0x2e')];this[_0xef62('0x2f')]=_0x58558a['dialAMDMaximumNumberOfWords'];this[_0xef62('0x30')]=_0x58558a[_0xef62('0x30')];this[_0xef62('0x31')]=_0x58558a['dialAMDMaximumWordLength'];}module[_0xef62('0x32')]=Campaign; \ No newline at end of file +var _0xd1b6=['dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','DESC','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialQueueProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','exports','name','type','originated','temp','ivrTotalCallsDays','sendMessageOneNotActive','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry'];(function(_0x103c4c,_0x285348){var _0x3fc15e=function(_0x40e0e6){while(--_0x40e0e6){_0x103c4c['push'](_0x103c4c['shift']());}};_0x3fc15e(++_0x285348);}(_0xd1b6,0xb4));var _0x6d1b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd1b6[_0x3dd15e];return _0x231fd0;};'use strict';function Campaign(_0x4062ff){this['id']=_0x4062ff['id']||0x0;this[_0x6d1b('0x0')]=_0x4062ff[_0x6d1b('0x0')]||'';this['type']=_0x4062ff[_0x6d1b('0x1')]||'campaign';this[_0x6d1b('0x2')]=0x0;this[_0x6d1b('0x3')]=0x0;this['ivrAnswerCallsDay']=0x0;this[_0x6d1b('0x4')]=0x0;this['message']='';this[_0x6d1b('0x5')]=!![];this[_0x6d1b('0x6')]=_0x4062ff[_0x6d1b('0x6')];this[_0x6d1b('0x7')]=_0x4062ff[_0x6d1b('0x7')];this[_0x6d1b('0x8')]=_0x4062ff['dialTimezone']||null;this[_0x6d1b('0x9')]=_0x4062ff['dialGlobalInterval']?_0x4062ff[_0x6d1b('0x9')]:null;this[_0x6d1b('0xa')]=_0x4062ff['dialOriginateCallerIdName'];this[_0x6d1b('0xb')]=_0x4062ff[_0x6d1b('0xb')];this['dialOriginateTimeout']=_0x4062ff[_0x6d1b('0xc')]||0x1e;this[_0x6d1b('0xd')]=_0x4062ff[_0x6d1b('0xd')];this['dialCongestionRetryFrequency']=_0x4062ff[_0x6d1b('0xe')];this[_0x6d1b('0xf')]=_0x4062ff[_0x6d1b('0xf')];this[_0x6d1b('0x10')]=_0x4062ff[_0x6d1b('0x10')];this[_0x6d1b('0x11')]=_0x4062ff['dialNoAnswerMaxRetry'];this['dialNoAnswerRetryFrequency']=_0x4062ff['dialNoAnswerRetryFrequency'];this[_0x6d1b('0x12')]=_0x4062ff[_0x6d1b('0x12')];this[_0x6d1b('0x13')]=_0x4062ff[_0x6d1b('0x13')]||0x3;this[_0x6d1b('0x14')]=_0x4062ff['dialNoSuchNumberRetryFrequency']||0x96;this[_0x6d1b('0x15')]=_0x4062ff[_0x6d1b('0x15')]||0x3;this['dialDropRetryFrequency']=_0x4062ff[_0x6d1b('0x16')]||0x96;this[_0x6d1b('0x17')]=_0x4062ff[_0x6d1b('0x17')]||0x3;this[_0x6d1b('0x18')]=_0x4062ff['dialAbandonedRetryFrequency']||0x96;this['dialMachineMaxRetry']=_0x4062ff[_0x6d1b('0x19')]||0x3;this[_0x6d1b('0x1a')]=_0x4062ff[_0x6d1b('0x1a')]||0x96;this[_0x6d1b('0x1b')]=_0x4062ff[_0x6d1b('0x1b')]||0x3;this[_0x6d1b('0x1c')]=_0x4062ff['dialAgentRejectRetryFrequency']||0x96;this[_0x6d1b('0x1d')]=_0x4062ff[_0x6d1b('0x1d')]||_0x6d1b('0x1e');this['dialPrefix']=_0x4062ff[_0x6d1b('0x1f')]||undefined;this[_0x6d1b('0x20')]=_0x4062ff[_0x6d1b('0x20')]||undefined;this[_0x6d1b('0x21')]=_0x4062ff[_0x6d1b('0x21')]||undefined;this['TrunkBackup']=_0x4062ff[_0x6d1b('0x22')]?_0x4062ff[_0x6d1b('0x22')]:undefined;this[_0x6d1b('0x23')]=_0x4062ff['Trunk']?_0x4062ff['Trunk']:undefined;this[_0x6d1b('0x24')]=_0x4062ff[_0x6d1b('0x24')]?_0x4062ff['Interval']:undefined;this[_0x6d1b('0x25')]=_0x4062ff[_0x6d1b('0x25')]?_0x4062ff[_0x6d1b('0x25')]:undefined;this[_0x6d1b('0x26')]=_0x4062ff[_0x6d1b('0x25')]?_0x4062ff['SquareProject'][_0x6d1b('0x0')]:undefined;this[_0x6d1b('0x27')]=_0x4062ff[_0x6d1b('0x27')]||![];this['dialAMDInitialSilence']=_0x4062ff[_0x6d1b('0x28')];this[_0x6d1b('0x29')]=_0x4062ff[_0x6d1b('0x29')];this[_0x6d1b('0x2a')]=_0x4062ff[_0x6d1b('0x2a')];this[_0x6d1b('0x2b')]=_0x4062ff['dialAMDTotalAnalysisTime'];this[_0x6d1b('0x2c')]=_0x4062ff[_0x6d1b('0x2c')];this['dialAMDBetweenWordsSilence']=_0x4062ff['dialAMDBetweenWordsSilence'];this[_0x6d1b('0x2d')]=_0x4062ff['dialAMDMaximumNumberOfWords'];this[_0x6d1b('0x2e')]=_0x4062ff['dialAMDSilenceThreshold'];this[_0x6d1b('0x2f')]=_0x4062ff['dialAMDMaximumWordLength'];}module[_0x6d1b('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 693a6c8..5a59adf 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 _0x8863=['exports','channel','destinationchannel','calleridnum','calleridname','uniqueid','linkedid','answered','answertime','unmanaged','abandoned','lastapplication','lastdata','billableseconds','holdtime','type','tag','disposition','monitorFilename','queue','monitors','transferType','mohtime'];(function(_0x292427,_0x5dc5d1){var _0x1e5629=function(_0xeb9913){while(--_0xeb9913){_0x292427['push'](_0x292427['shift']());}};_0x1e5629(++_0x5dc5d1);}(_0x8863,0x1b6));var _0x3886=function(_0x2f452c,_0x45498e){_0x2f452c=_0x2f452c-0x0;var _0x5130ff=_0x8863[_0x2f452c];return _0x5130ff;};'use strict';function Channel(){this['starttime']=null;this[_0x3886('0x0')]='';this[_0x3886('0x1')]='';this[_0x3886('0x2')]=0x0;this[_0x3886('0x3')]='';this['connectedlinenum']=undefined;this['connectedlinename']=undefined;this['accountcode']=0x0;this['context']='';this[_0x3886('0x4')]=0x0;this[_0x3886('0x5')]=0x0;this['exten']=0x0;this[_0x3886('0x6')]=![];this[_0x3886('0x7')]=null;this['endtime']=null;this[_0x3886('0x8')]=![];this[_0x3886('0x9')]=![];this[_0x3886('0xa')]='';this[_0x3886('0xb')]='';this['duration']=0x0;this[_0x3886('0xc')]=0x0;this[_0x3886('0xd')]=0x0;this[_0x3886('0xe')]=null;this[_0x3886('0xf')]=null;this[_0x3886('0x10')]=null;this['monitor']=![];this[_0x3886('0x11')]=null;this[_0x3886('0x12')]=null;this[_0x3886('0x13')]=[];this['transfercalleridnum']=undefined;this['transferconnectedlinenum']=undefined;this[_0x3886('0x14')]=undefined;this[_0x3886('0x15')]=0x0;}module[_0x3886('0x16')]=Channel; \ No newline at end of file +var _0x3264=['lastapplication','lastdata','duration','billableseconds','holdtime','disposition','monitor','monitorFilename','queue','transferconnectedlinenum','mohtime','exports','channel','destinationchannel','calleridnum','calleridname','accountcode','linkedid','exten','answered','answertime','unmanaged','abandoned'];(function(_0x1c1a0e,_0x4b070e){var _0x14f996=function(_0x484653){while(--_0x484653){_0x1c1a0e['push'](_0x1c1a0e['shift']());}};_0x14f996(++_0x4b070e);}(_0x3264,0x7f));var _0x4326=function(_0x2261ce,_0x9ed8b6){_0x2261ce=_0x2261ce-0x0;var _0x524640=_0x3264[_0x2261ce];return _0x524640;};'use strict';function Channel(){this['starttime']=null;this[_0x4326('0x0')]='';this[_0x4326('0x1')]='';this[_0x4326('0x2')]=0x0;this[_0x4326('0x3')]='';this['connectedlinenum']=undefined;this['connectedlinename']=undefined;this[_0x4326('0x4')]=0x0;this['context']='';this['uniqueid']=0x0;this[_0x4326('0x5')]=0x0;this[_0x4326('0x6')]=0x0;this[_0x4326('0x7')]=![];this[_0x4326('0x8')]=null;this['endtime']=null;this[_0x4326('0x9')]=![];this[_0x4326('0xa')]=![];this[_0x4326('0xb')]='';this[_0x4326('0xc')]='';this[_0x4326('0xd')]=0x0;this[_0x4326('0xe')]=0x0;this[_0x4326('0xf')]=0x0;this['type']=null;this['tag']=null;this[_0x4326('0x10')]=null;this[_0x4326('0x11')]=![];this[_0x4326('0x12')]=null;this[_0x4326('0x13')]=null;this['monitors']=[];this['transfercalleridnum']=undefined;this[_0x4326('0x14')]=undefined;this['transferType']=undefined;this[_0x4326('0x15')]=0x0;}module[_0x4326('0x16')]=Channel; \ No newline at end of file diff --git a/server/services/ami/model/deskAccount.js b/server/services/ami/model/deskAccount.js index c909b43..c677d5c 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 _0x4b78=['password','consumerKey','consumerSecret','token','tokenSecret','type','serverUrl','Configurations','exports','name','username','remoteUri','authType'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x4b78,0xcc));var _0x84b7=function(_0x15df3c,_0xe1509f){_0x15df3c=_0x15df3c-0x0;var _0x3d9c85=_0x4b78[_0x15df3c];return _0x3d9c85;};'use strict';function DeskAccount(_0x347227){this['id']=_0x347227['id']||0x0;this[_0x84b7('0x0')]=_0x347227['name']||'';this[_0x84b7('0x1')]=_0x347227[_0x84b7('0x1')]||'';this[_0x84b7('0x2')]=_0x347227[_0x84b7('0x2')]||'';this[_0x84b7('0x3')]=_0x347227[_0x84b7('0x3')]||'';this[_0x84b7('0x4')]=_0x347227[_0x84b7('0x4')]||'';this[_0x84b7('0x5')]=_0x347227[_0x84b7('0x5')]||'';this[_0x84b7('0x6')]=_0x347227[_0x84b7('0x6')]||'';this[_0x84b7('0x7')]=_0x347227[_0x84b7('0x7')]||'';this[_0x84b7('0x8')]=_0x347227[_0x84b7('0x8')]||'';this[_0x84b7('0x9')]=_0x347227[_0x84b7('0x9')]||'';this['serverUrl']=_0x347227[_0x84b7('0xa')]||'';this[_0x84b7('0xb')]=_0x347227['Configurations']||{};}module[_0x84b7('0xc')]=DeskAccount; \ No newline at end of file +var _0xa501=['Configurations','exports','name','username','remoteUri','authType','password','consumerKey','consumerSecret','token','tokenSecret','type','serverUrl'];(function(_0x4dba04,_0x4a4987){var _0x5d6f61=function(_0x128619){while(--_0x128619){_0x4dba04['push'](_0x4dba04['shift']());}};_0x5d6f61(++_0x4a4987);}(_0xa501,0x13a));var _0x1a50=function(_0x5e66c2,_0x3a3783){_0x5e66c2=_0x5e66c2-0x0;var _0x322e0d=_0xa501[_0x5e66c2];return _0x322e0d;};'use strict';function DeskAccount(_0x399f74){this['id']=_0x399f74['id']||0x0;this[_0x1a50('0x0')]=_0x399f74[_0x1a50('0x0')]||'';this[_0x1a50('0x1')]=_0x399f74[_0x1a50('0x1')]||'';this[_0x1a50('0x2')]=_0x399f74[_0x1a50('0x2')]||'';this['authType']=_0x399f74[_0x1a50('0x3')]||'';this[_0x1a50('0x4')]=_0x399f74[_0x1a50('0x4')]||'';this['consumerKey']=_0x399f74[_0x1a50('0x5')]||'';this[_0x1a50('0x6')]=_0x399f74['consumerSecret']||'';this['token']=_0x399f74[_0x1a50('0x7')]||'';this['tokenSecret']=_0x399f74[_0x1a50('0x8')]||'';this[_0x1a50('0x9')]=_0x399f74[_0x1a50('0x9')]||'';this[_0x1a50('0xa')]=_0x399f74[_0x1a50('0xa')]||'';this[_0x1a50('0xb')]=_0x399f74[_0x1a50('0xb')]||{};}module[_0x1a50('0xc')]=DeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/dynamics365Account.js b/server/services/ami/model/dynamics365Account.js index c2c9b55..0ae5e26 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 _0x2dae=['clientId','clientSecret','serverUrl','Configurations','exports','name','username','password','remoteUri','tenantId'];(function(_0x12e6dc,_0x56c555){var _0x1743c0=function(_0x18af8a){while(--_0x18af8a){_0x12e6dc['push'](_0x12e6dc['shift']());}};_0x1743c0(++_0x56c555);}(_0x2dae,0xc3));var _0xe2da=function(_0x2a0183,_0x3fc93c){_0x2a0183=_0x2a0183-0x0;var _0x158c3a=_0x2dae[_0x2a0183];return _0x158c3a;};'use strict';function Dynamics365Account(_0x463a36){this['id']=_0x463a36['id']||0x0;this['name']=_0x463a36[_0xe2da('0x0')]||'';this[_0xe2da('0x1')]=_0x463a36[_0xe2da('0x1')]||'';this[_0xe2da('0x2')]=_0x463a36[_0xe2da('0x2')]||'';this['remoteUri']=_0x463a36[_0xe2da('0x3')]||'';this[_0xe2da('0x4')]=_0x463a36[_0xe2da('0x4')]||'';this[_0xe2da('0x5')]=_0x463a36['clientId']||'';this[_0xe2da('0x6')]=_0x463a36[_0xe2da('0x6')]||{};this[_0xe2da('0x7')]=_0x463a36[_0xe2da('0x7')]||'';this[_0xe2da('0x8')]=_0x463a36[_0xe2da('0x8')]||{};}module[_0xe2da('0x9')]=Dynamics365Account; \ No newline at end of file +var _0xa9e0=['clientSecret','serverUrl','Configurations','name','password','remoteUri','tenantId','clientId'];(function(_0xc3c429,_0x5903f3){var _0x3d3670=function(_0x52501a){while(--_0x52501a){_0xc3c429['push'](_0xc3c429['shift']());}};_0x3d3670(++_0x5903f3);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4c7fb5,_0x2548ef){_0x4c7fb5=_0x4c7fb5-0x0;var _0x2e10ac=_0xa9e0[_0x4c7fb5];return _0x2e10ac;};'use strict';function Dynamics365Account(_0x1f0015){this['id']=_0x1f0015['id']||0x0;this[_0x0a9e('0x0')]=_0x1f0015[_0x0a9e('0x0')]||'';this['username']=_0x1f0015['username']||'';this[_0x0a9e('0x1')]=_0x1f0015['password']||'';this[_0x0a9e('0x2')]=_0x1f0015[_0x0a9e('0x2')]||'';this[_0x0a9e('0x3')]=_0x1f0015[_0x0a9e('0x3')]||'';this[_0x0a9e('0x4')]=_0x1f0015['clientId']||'';this[_0x0a9e('0x5')]=_0x1f0015[_0x0a9e('0x5')]||{};this[_0x0a9e('0x6')]=_0x1f0015['serverUrl']||'';this['Configurations']=_0x1f0015[_0x0a9e('0x7')]||{};}module['exports']=Dynamics365Account; \ No newline at end of file diff --git a/server/services/ami/model/faxAccount.js b/server/services/ami/model/faxAccount.js index 289555f..a7b56d2 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 _0xb858=['Trunk','ListId','key','exports','name','description','ecm','headerinfo','localstationid','minrate','maxrate','modem','v17,v27,v29','gateway','faxdetect','t38timeout','tech','SIP'];(function(_0x55abd9,_0x1148af){var _0x3e5669=function(_0x6f2105){while(--_0x6f2105){_0x55abd9['push'](_0x55abd9['shift']());}};_0x3e5669(++_0x1148af);}(_0xb858,0x124));var _0x8b85=function(_0x1c8ea8,_0x537b7c){_0x1c8ea8=_0x1c8ea8-0x0;var _0x2830d5=_0xb858[_0x1c8ea8];return _0x2830d5;};'use strict';function FaxAccount(_0x1a7f44){this['id']=_0x1a7f44['id']||0x0;this['name']=_0x1a7f44[_0x8b85('0x0')]||'';this[_0x8b85('0x1')]=_0x1a7f44[_0x8b85('0x1')];this[_0x8b85('0x2')]=_0x1a7f44[_0x8b85('0x2')];this[_0x8b85('0x3')]=_0x1a7f44[_0x8b85('0x3')];this[_0x8b85('0x4')]=_0x1a7f44[_0x8b85('0x4')];this[_0x8b85('0x5')]=_0x1a7f44['minrate']||0x960;this[_0x8b85('0x6')]=_0x1a7f44[_0x8b85('0x6')]||0x3840;this[_0x8b85('0x7')]=_0x1a7f44[_0x8b85('0x7')]||_0x8b85('0x8');this['gateway']=_0x1a7f44[_0x8b85('0x9')]||'no';this[_0x8b85('0xa')]=_0x1a7f44[_0x8b85('0xa')]||'no';this[_0x8b85('0xb')]=_0x1a7f44[_0x8b85('0xb')]||0x1388;this[_0x8b85('0xc')]=_0x1a7f44[_0x8b85('0xc')]||_0x8b85('0xd');this[_0x8b85('0xe')]=_0x1a7f44[_0x8b85('0xe')]?_0x1a7f44[_0x8b85('0xe')]:undefined;this[_0x8b85('0xf')]=_0x1a7f44[_0x8b85('0xf')];this[_0x8b85('0x10')]=_0x1a7f44[_0x8b85('0x10')];}module[_0x8b85('0x11')]=FaxAccount; \ No newline at end of file +var _0xa363=['gateway','faxdetect','t38timeout','tech','SIP','Trunk','ListId','key','exports','name','description','ecm','headerinfo','localstationid','maxrate','modem','v17,v27,v29'];(function(_0x415242,_0x7806ef){var _0x49bb9b=function(_0x27ba20){while(--_0x27ba20){_0x415242['push'](_0x415242['shift']());}};_0x49bb9b(++_0x7806ef);}(_0xa363,0x1e5));var _0x3a36=function(_0x35a470,_0x1820a1){_0x35a470=_0x35a470-0x0;var _0x7349ff=_0xa363[_0x35a470];return _0x7349ff;};'use strict';function FaxAccount(_0xa2e3a5){this['id']=_0xa2e3a5['id']||0x0;this['name']=_0xa2e3a5[_0x3a36('0x0')]||'';this[_0x3a36('0x1')]=_0xa2e3a5[_0x3a36('0x1')];this[_0x3a36('0x2')]=_0xa2e3a5['ecm'];this[_0x3a36('0x3')]=_0xa2e3a5[_0x3a36('0x3')];this[_0x3a36('0x4')]=_0xa2e3a5['localstationid'];this['minrate']=_0xa2e3a5['minrate']||0x960;this['maxrate']=_0xa2e3a5[_0x3a36('0x5')]||0x3840;this['modem']=_0xa2e3a5[_0x3a36('0x6')]||_0x3a36('0x7');this[_0x3a36('0x8')]=_0xa2e3a5[_0x3a36('0x8')]||'no';this[_0x3a36('0x9')]=_0xa2e3a5[_0x3a36('0x9')]||'no';this[_0x3a36('0xa')]=_0xa2e3a5['t38timeout']||0x1388;this[_0x3a36('0xb')]=_0xa2e3a5['tech']||_0x3a36('0xc');this['Trunk']=_0xa2e3a5[_0x3a36('0xd')]?_0xa2e3a5[_0x3a36('0xd')]:undefined;this[_0x3a36('0xe')]=_0xa2e3a5[_0x3a36('0xe')];this[_0x3a36('0xf')]=_0xa2e3a5[_0x3a36('0xf')];}module[_0x3a36('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 4d61525..67f11b9 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 _0xe95b=['name','username','apiKey','remoteUri','serverUrl','Configurations','exports'];(function(_0x542468,_0x237c82){var _0x3731b8=function(_0x62353a){while(--_0x62353a){_0x542468['push'](_0x542468['shift']());}};_0x3731b8(++_0x237c82);}(_0xe95b,0x1b2));var _0xbe95=function(_0x16c3fa,_0x1e02f6){_0x16c3fa=_0x16c3fa-0x0;var _0x35a668=_0xe95b[_0x16c3fa];return _0x35a668;};'use strict';function FreshdeskAccount(_0x24125f){this['id']=_0x24125f['id']||0x0;this[_0xbe95('0x0')]=_0x24125f[_0xbe95('0x0')]||'';this[_0xbe95('0x1')]=_0x24125f[_0xbe95('0x1')]||'';this[_0xbe95('0x2')]=_0x24125f['token']||'';this[_0xbe95('0x3')]=_0x24125f[_0xbe95('0x3')]||'';this[_0xbe95('0x4')]=_0x24125f[_0xbe95('0x4')]||'';this[_0xbe95('0x5')]=_0x24125f[_0xbe95('0x5')]||{};}module[_0xbe95('0x6')]=FreshdeskAccount; \ No newline at end of file +var _0x6e09=['token','remoteUri','serverUrl','Configurations','exports','name','username','apiKey'];(function(_0x300fa4,_0x4758df){var _0x4c352b=function(_0x26ed31){while(--_0x26ed31){_0x300fa4['push'](_0x300fa4['shift']());}};_0x4c352b(++_0x4758df);}(_0x6e09,0x1ad));var _0x96e0=function(_0x2c61a2,_0x40fe37){_0x2c61a2=_0x2c61a2-0x0;var _0x28bf7c=_0x6e09[_0x2c61a2];return _0x28bf7c;};'use strict';function FreshdeskAccount(_0x354005){this['id']=_0x354005['id']||0x0;this['name']=_0x354005[_0x96e0('0x0')]||'';this[_0x96e0('0x1')]=_0x354005['username']||'';this[_0x96e0('0x2')]=_0x354005[_0x96e0('0x3')]||'';this[_0x96e0('0x4')]=_0x354005['remoteUri']||'';this[_0x96e0('0x5')]=_0x354005[_0x96e0('0x5')]||'';this[_0x96e0('0x6')]=_0x354005[_0x96e0('0x6')]||{};}module[_0x96e0('0x7')]=FreshdeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshsalesAccount.js b/server/services/ami/model/freshsalesAccount.js index d621021..7d4e314 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 _0xed1f=['Configurations','exports','name','username','apiKey','token','remoteUri','serverUrl'];(function(_0x468481,_0x3d8b88){var _0x363252=function(_0x32e2a9){while(--_0x32e2a9){_0x468481['push'](_0x468481['shift']());}};_0x363252(++_0x3d8b88);}(_0xed1f,0x6a));var _0xfed1=function(_0x725b8e,_0xc22b48){_0x725b8e=_0x725b8e-0x0;var _0x43ac45=_0xed1f[_0x725b8e];return _0x43ac45;};'use strict';function FreshsalesAccount(_0x47d976){this['id']=_0x47d976['id']||0x0;this[_0xfed1('0x0')]=_0x47d976[_0xfed1('0x0')]||'';this[_0xfed1('0x1')]=_0x47d976[_0xfed1('0x1')]||'';this[_0xfed1('0x2')]=_0x47d976[_0xfed1('0x3')]||'';this[_0xfed1('0x4')]=_0x47d976[_0xfed1('0x4')]||'';this[_0xfed1('0x5')]=_0x47d976[_0xfed1('0x5')]||'';this[_0xfed1('0x6')]=_0x47d976[_0xfed1('0x6')]||{};}module[_0xfed1('0x7')]=FreshsalesAccount; \ No newline at end of file +var _0x539d=['exports','name','username','token','remoteUri','serverUrl','Configurations'];(function(_0x5dbeab,_0x5a482f){var _0x223051=function(_0x550265){while(--_0x550265){_0x5dbeab['push'](_0x5dbeab['shift']());}};_0x223051(++_0x5a482f);}(_0x539d,0x17b));var _0xd539=function(_0x368587,_0x1b6554){_0x368587=_0x368587-0x0;var _0x42d33c=_0x539d[_0x368587];return _0x42d33c;};'use strict';function FreshsalesAccount(_0x2df0ff){this['id']=_0x2df0ff['id']||0x0;this['name']=_0x2df0ff[_0xd539('0x0')]||'';this[_0xd539('0x1')]=_0x2df0ff['username']||'';this['apiKey']=_0x2df0ff[_0xd539('0x2')]||'';this[_0xd539('0x3')]=_0x2df0ff[_0xd539('0x3')]||'';this[_0xd539('0x4')]=_0x2df0ff[_0xd539('0x4')]||'';this['Configurations']=_0x2df0ff[_0xd539('0x5')]||{};}module[_0xd539('0x6')]=FreshsalesAccount; \ No newline at end of file diff --git a/server/services/ami/model/queueReport.js b/server/services/ami/model/queueReport.js index c11d55a..e9921a0 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 _0x6c1e=['voice','mohtime','variables','exports','inbound','uniqueid','calleridnum','calleridname','queuecallerjoinAt','queuecallerleaveAt','queuecallerabandon','queuecallerabandonAt','queuecallercomplete','queuecallercompleteAt','queuecallerexit','queuecallerexitAt','originalposition','channel','connectedlinename','accountcode','exten','holdtime','assigned','lastAssignedTo','motionChannel'];(function(_0xb39e49,_0x4f5639){var _0x3a938e=function(_0x5a9284){while(--_0x5a9284){_0xb39e49['push'](_0xb39e49['shift']());}};_0x3a938e(++_0x4f5639);}(_0x6c1e,0x68));var _0xe6c1=function(_0x5a3e69,_0x346f71){_0x5a3e69=_0x5a3e69-0x0;var _0x27073b=_0x6c1e[_0x5a3e69];return _0x27073b;};'use strict';function QueueReport(){this['type']=_0xe6c1('0x0');this[_0xe6c1('0x1')]='';this[_0xe6c1('0x2')]='';this[_0xe6c1('0x3')]='';this['queue']='';this[_0xe6c1('0x4')]=null;this[_0xe6c1('0x5')]=null;this['position']=0x1;this['count']=0x1;this[_0xe6c1('0x6')]=![];this[_0xe6c1('0x7')]=null;this[_0xe6c1('0x8')]=![];this[_0xe6c1('0x9')]=null;this[_0xe6c1('0xa')]=![];this[_0xe6c1('0xb')]=null;this[_0xe6c1('0xc')]=0x1;this[_0xe6c1('0xd')]='';this['connectedlinenum']='';this[_0xe6c1('0xe')]='';this[_0xe6c1('0xf')]='';this['context']='';this[_0xe6c1('0x10')]='';this['priority']='';this[_0xe6c1('0x11')]=0x0;this[_0xe6c1('0x12')]=![];this[_0xe6c1('0x13')]='';this[_0xe6c1('0x14')]=_0xe6c1('0x15');this[_0xe6c1('0x16')]=0x0;this[_0xe6c1('0x17')]={};}module[_0xe6c1('0x18')]=QueueReport; \ No newline at end of file +var _0x6246=['assigned','motionChannel','mohtime','variables','exports','inbound','calleridname','queue','queuecallerjoinAt','position','count','queuecallerabandonAt','queuecallercomplete','queuecallerexit','queuecallerexitAt','originalposition','channel','context','priority'];(function(_0xdea41a,_0x552987){var _0x15d0d8=function(_0x1e0d0b){while(--_0x1e0d0b){_0xdea41a['push'](_0xdea41a['shift']());}};_0x15d0d8(++_0x552987);}(_0x6246,0x181));var _0x6624=function(_0x1ed671,_0x67b18c){_0x1ed671=_0x1ed671-0x0;var _0x31b2d5=_0x6246[_0x1ed671];return _0x31b2d5;};'use strict';function QueueReport(){this['type']=_0x6624('0x0');this['uniqueid']='';this['calleridnum']='';this[_0x6624('0x1')]='';this[_0x6624('0x2')]='';this[_0x6624('0x3')]=null;this['queuecallerleaveAt']=null;this[_0x6624('0x4')]=0x1;this[_0x6624('0x5')]=0x1;this['queuecallerabandon']=![];this[_0x6624('0x6')]=null;this[_0x6624('0x7')]=![];this['queuecallercompleteAt']=null;this[_0x6624('0x8')]=![];this[_0x6624('0x9')]=null;this[_0x6624('0xa')]=0x1;this[_0x6624('0xb')]='';this['connectedlinenum']='';this['connectedlinename']='';this['accountcode']='';this[_0x6624('0xc')]='';this['exten']='';this[_0x6624('0xd')]='';this['holdtime']=0x0;this[_0x6624('0xe')]=![];this['lastAssignedTo']='';this[_0x6624('0xf')]='voice';this[_0x6624('0x10')]=0x0;this[_0x6624('0x11')]={};}module[_0x6624('0x12')]=QueueReport; \ No newline at end of file diff --git a/server/services/ami/model/salesforceAccount.js b/server/services/ami/model/salesforceAccount.js index bf1cce9..1415949 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 _0x2431=['password','clientId','clientSecret','securityToken','type','integrationTab','serverUrl','Configurations','exports','name','username','remoteUri'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x2431,0xc9));var _0x1243=function(_0x4e676e,_0x2a7c6d){_0x4e676e=_0x4e676e-0x0;var _0x336a3c=_0x2431[_0x4e676e];return _0x336a3c;};'use strict';function SalesforceAccount(_0x2c154c){this['id']=_0x2c154c['id']||0x0;this[_0x1243('0x0')]=_0x2c154c['name']||'';this[_0x1243('0x1')]=_0x2c154c[_0x1243('0x1')]||'';this['remoteUri']=_0x2c154c[_0x1243('0x2')]||'';this[_0x1243('0x3')]=_0x2c154c[_0x1243('0x3')]||'';this[_0x1243('0x4')]=_0x2c154c[_0x1243('0x4')]||'';this[_0x1243('0x5')]=_0x2c154c[_0x1243('0x5')]||'';this[_0x1243('0x6')]=_0x2c154c[_0x1243('0x6')]||'';this[_0x1243('0x7')]=_0x2c154c[_0x1243('0x7')]||_0x1243('0x8');this[_0x1243('0x9')]=_0x2c154c[_0x1243('0x9')]||'';this['Configurations']=_0x2c154c[_0x1243('0xa')]||{};}module[_0x1243('0xb')]=SalesforceAccount; \ No newline at end of file +var _0x8fc9=['Configurations','exports','name','username','remoteUri','password','clientId','clientSecret','securityToken','type','integrationTab'];(function(_0x1992f1,_0x5c61f0){var _0x413dfe=function(_0x2136e5){while(--_0x2136e5){_0x1992f1['push'](_0x1992f1['shift']());}};_0x413dfe(++_0x5c61f0);}(_0x8fc9,0xde));var _0x98fc=function(_0x874cf1,_0x2a4954){_0x874cf1=_0x874cf1-0x0;var _0x233579=_0x8fc9[_0x874cf1];return _0x233579;};'use strict';function SalesforceAccount(_0x2cdcfc){this['id']=_0x2cdcfc['id']||0x0;this['name']=_0x2cdcfc[_0x98fc('0x0')]||'';this[_0x98fc('0x1')]=_0x2cdcfc['username']||'';this[_0x98fc('0x2')]=_0x2cdcfc[_0x98fc('0x2')]||'';this[_0x98fc('0x3')]=_0x2cdcfc[_0x98fc('0x3')]||'';this['clientId']=_0x2cdcfc[_0x98fc('0x4')]||'';this[_0x98fc('0x5')]=_0x2cdcfc[_0x98fc('0x5')]||'';this[_0x98fc('0x6')]=_0x2cdcfc[_0x98fc('0x6')]||'';this[_0x98fc('0x7')]=_0x2cdcfc[_0x98fc('0x7')]||_0x98fc('0x8');this['serverUrl']=_0x2cdcfc['serverUrl']||'';this[_0x98fc('0x9')]=_0x2cdcfc[_0x98fc('0x9')]||{};}module[_0x98fc('0xa')]=SalesforceAccount; \ No newline at end of file diff --git a/server/services/ami/model/servicenowAccount.js b/server/services/ami/model/servicenowAccount.js index 1476f0c..61609bf 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 _0x7f4a=['username','password','remoteUri','serverUrl','Configurations','exports','name'];(function(_0x3c48bd,_0x404dde){var _0x3ef6ae=function(_0x3d4beb){while(--_0x3d4beb){_0x3c48bd['push'](_0x3c48bd['shift']());}};_0x3ef6ae(++_0x404dde);}(_0x7f4a,0xd8));var _0xa7f4=function(_0x4f4fb9,_0x3798bc){_0x4f4fb9=_0x4f4fb9-0x0;var _0x1d9828=_0x7f4a[_0x4f4fb9];return _0x1d9828;};'use strict';function ServicenowAccount(_0x4cecf0){this['id']=_0x4cecf0['id']||0x0;this[_0xa7f4('0x0')]=_0x4cecf0[_0xa7f4('0x0')]||'';this[_0xa7f4('0x1')]=_0x4cecf0[_0xa7f4('0x1')]||'';this['password']=_0x4cecf0[_0xa7f4('0x2')]||'';this['remoteUri']=_0x4cecf0[_0xa7f4('0x3')]||'';this[_0xa7f4('0x4')]=_0x4cecf0[_0xa7f4('0x4')]||'';this[_0xa7f4('0x5')]=_0x4cecf0['Configurations']||{};}module[_0xa7f4('0x6')]=ServicenowAccount; \ No newline at end of file +var _0x3cdd=['password','remoteUri','serverUrl','exports','name','username'];(function(_0x57ff59,_0x4b9327){var _0x58e63f=function(_0x3b1072){while(--_0x3b1072){_0x57ff59['push'](_0x57ff59['shift']());}};_0x58e63f(++_0x4b9327);}(_0x3cdd,0x16c));var _0xd3cd=function(_0x77989a,_0x5eed53){_0x77989a=_0x77989a-0x0;var _0x551469=_0x3cdd[_0x77989a];return _0x551469;};'use strict';function ServicenowAccount(_0x2d0bcc){this['id']=_0x2d0bcc['id']||0x0;this[_0xd3cd('0x0')]=_0x2d0bcc[_0xd3cd('0x0')]||'';this[_0xd3cd('0x1')]=_0x2d0bcc[_0xd3cd('0x1')]||'';this[_0xd3cd('0x2')]=_0x2d0bcc[_0xd3cd('0x2')]||'';this[_0xd3cd('0x3')]=_0x2d0bcc[_0xd3cd('0x3')]||'';this[_0xd3cd('0x4')]=_0x2d0bcc[_0xd3cd('0x4')]||'';this['Configurations']=_0x2d0bcc['Configurations']||{};}module[_0xd3cd('0x5')]=ServicenowAccount; \ No newline at end of file diff --git a/server/services/ami/model/sugarcrmAccount.js b/server/services/ami/model/sugarcrmAccount.js index 4ca42c9..29c7a4c 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 _0xd0e0=['username','password','remoteUri','serverUrl','Configurations','name'];(function(_0x14768c,_0x25cd51){var _0x5071a0=function(_0xa50cbf){while(--_0xa50cbf){_0x14768c['push'](_0x14768c['shift']());}};_0x5071a0(++_0x25cd51);}(_0xd0e0,0xa7));var _0x0d0e=function(_0x4f1c67,_0x4ad07d){_0x4f1c67=_0x4f1c67-0x0;var _0x265097=_0xd0e0[_0x4f1c67];return _0x265097;};'use strict';function SugarcrmAccount(_0x2c06da){this['id']=_0x2c06da['id']||0x0;this['name']=_0x2c06da[_0x0d0e('0x0')]||'';this['username']=_0x2c06da[_0x0d0e('0x1')]||'';this[_0x0d0e('0x2')]=_0x2c06da[_0x0d0e('0x2')]||'';this['remoteUri']=_0x2c06da[_0x0d0e('0x3')]||'';this[_0x0d0e('0x4')]=_0x2c06da[_0x0d0e('0x4')]||'';this[_0x0d0e('0x5')]=_0x2c06da['Configurations']||{};}module['exports']=SugarcrmAccount; \ No newline at end of file +var _0x7331=['serverUrl','Configurations','exports','name','username','password','remoteUri'];(function(_0x49ee2f,_0x5dd891){var _0x5ce606=function(_0x8e926c){while(--_0x8e926c){_0x49ee2f['push'](_0x49ee2f['shift']());}};_0x5ce606(++_0x5dd891);}(_0x7331,0xe3));var _0x1733=function(_0x12a590,_0x597436){_0x12a590=_0x12a590-0x0;var _0x2cfcce=_0x7331[_0x12a590];return _0x2cfcce;};'use strict';function SugarcrmAccount(_0x2b00ca){this['id']=_0x2b00ca['id']||0x0;this['name']=_0x2b00ca[_0x1733('0x0')]||'';this[_0x1733('0x1')]=_0x2b00ca['username']||'';this[_0x1733('0x2')]=_0x2b00ca['password']||'';this[_0x1733('0x3')]=_0x2b00ca[_0x1733('0x3')]||'';this[_0x1733('0x4')]=_0x2b00ca[_0x1733('0x4')]||'';this[_0x1733('0x5')]=_0x2b00ca[_0x1733('0x5')]||{};}module[_0x1733('0x6')]=SugarcrmAccount; \ No newline at end of file diff --git a/server/services/ami/model/telephone.js b/server/services/ami/model/telephone.js index a24ad1b..92fe891 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 _0x8623=['status','address','name','state','unknown','stateTime'];(function(_0x53e3de,_0x13da7b){var _0x7b905b=function(_0x29b56a){while(--_0x29b56a){_0x53e3de['push'](_0x53e3de['shift']());}};_0x7b905b(++_0x13da7b);}(_0x8623,0x194));var _0x3862=function(_0x26d4bd,_0x25b068){_0x26d4bd=_0x26d4bd-0x0;var _0x1b37ef=_0x8623[_0x26d4bd];return _0x1b37ef;};'use strict';function Telephone(_0x3f6243){this['id']=_0x3f6243['id']||0x0;this['name']=_0x3f6243[_0x3862('0x0')]||'';this['accountcode']=_0x3f6243['accountcode']||'';this[_0x3862('0x1')]=_0x3862('0x2');this[_0x3862('0x3')]=0x0;this[_0x3862('0x4')]=_0x3862('0x2');this[_0x3862('0x5')]='';}module['exports']=Telephone; \ No newline at end of file +var _0xdcfc=['exports','name','state','unknown','stateTime','status','address'];(function(_0x4a419a,_0xba7cdd){var _0x4fac3e=function(_0x581cd4){while(--_0x581cd4){_0x4a419a['push'](_0x4a419a['shift']());}};_0x4fac3e(++_0xba7cdd);}(_0xdcfc,0x1c8));var _0xcdcf=function(_0x388550,_0x3fd74b){_0x388550=_0x388550-0x0;var _0x735860=_0xdcfc[_0x388550];return _0x735860;};'use strict';function Telephone(_0x4c5db7){this['id']=_0x4c5db7['id']||0x0;this[_0xcdcf('0x0')]=_0x4c5db7['name']||'';this['accountcode']=_0x4c5db7['accountcode']||'';this[_0xcdcf('0x1')]=_0xcdcf('0x2');this[_0xcdcf('0x3')]=0x0;this[_0xcdcf('0x4')]='unknown';this[_0xcdcf('0x5')]='';}module[_0xcdcf('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 134cda7..bea919d 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(_0x2b9753,_0x17f296){var _0x2d7cdf=function(_0x428ad0){while(--_0x428ad0){_0x2b9753['push'](_0x2b9753['shift']());}};_0x2d7cdf(++_0x17f296);}(_0xb10b,0x12a));var _0xbb10=function(_0x249e96,_0x3ea39d){_0x249e96=_0x249e96-0x0;var _0x17444c=_0xb10b[_0x249e96];return _0x17444c;};'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(_0x3e31e1,_0x241407){var _0x1f2f21=function(_0x5f04a7){while(--_0x5f04a7){_0x3e31e1['push'](_0x3e31e1['shift']());}};_0x1f2f21(++_0x241407);}(_0xb10b,0x12a));var _0xbb10=function(_0xdcca54,_0x4b2b61){_0xdcca54=_0xdcca54-0x0;var _0x453197=_0xb10b[_0xdcca54];return _0x453197;};'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 aea4bb8..3be7d51 100644 --- a/server/services/ami/model/trigger.js +++ b/server/services/ami/model/trigger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9ffd=['Actions','exports','name','channel','voice','status','AllConditions','AnyConditions'];(function(_0x50dc2a,_0x45e504){var _0x4ef073=function(_0x114273){while(--_0x114273){_0x50dc2a['push'](_0x50dc2a['shift']());}};_0x4ef073(++_0x45e504);}(_0x9ffd,0xaa));var _0xd9ff=function(_0x36e5e8,_0x4116d2){_0x36e5e8=_0x36e5e8-0x0;var _0x5aaf4e=_0x9ffd[_0x36e5e8];return _0x5aaf4e;};'use strict';function Trigger(_0x4c26a1){this['id']=_0x4c26a1['id']||0x0;this[_0xd9ff('0x0')]=_0x4c26a1[_0xd9ff('0x0')]||'';this['channel']=_0x4c26a1[_0xd9ff('0x1')]||_0xd9ff('0x2');this[_0xd9ff('0x3')]=_0x4c26a1[_0xd9ff('0x3')]||![];this['AllConditions']=_0x4c26a1[_0xd9ff('0x4')]||[];this[_0xd9ff('0x5')]=_0x4c26a1['AnyConditions']||[];this[_0xd9ff('0x6')]=_0x4c26a1[_0xd9ff('0x6')]||[];}module[_0xd9ff('0x7')]=Trigger; \ No newline at end of file +var _0x9ffd=['Actions','exports','name','channel','voice','status','AllConditions','AnyConditions'];(function(_0x1b75ae,_0x223979){var _0x4832b7=function(_0xdbc46b){while(--_0xdbc46b){_0x1b75ae['push'](_0x1b75ae['shift']());}};_0x4832b7(++_0x223979);}(_0x9ffd,0xaa));var _0xd9ff=function(_0x2d2766,_0x1fa172){_0x2d2766=_0x2d2766-0x0;var _0x25f785=_0x9ffd[_0x2d2766];return _0x25f785;};'use strict';function Trigger(_0x4c26a1){this['id']=_0x4c26a1['id']||0x0;this[_0xd9ff('0x0')]=_0x4c26a1[_0xd9ff('0x0')]||'';this['channel']=_0x4c26a1[_0xd9ff('0x1')]||_0xd9ff('0x2');this[_0xd9ff('0x3')]=_0x4c26a1[_0xd9ff('0x3')]||![];this['AllConditions']=_0x4c26a1[_0xd9ff('0x4')]||[];this[_0xd9ff('0x5')]=_0x4c26a1['AnyConditions']||[];this[_0xd9ff('0x6')]=_0x4c26a1[_0xd9ff('0x6')]||[];}module[_0xd9ff('0x7')]=Trigger; \ No newline at end of file diff --git a/server/services/ami/model/trunk.js b/server/services/ami/model/trunk.js index 7780c1b..c8ab2b7 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 _0xc507=['domain','domainport','refresh','stateRegistry','registrationtime','address','defaultuser','active','name','state','unknown','stateTime','registry','indexOf','host','port'];(function(_0x16d163,_0x193f3b){var _0x440a6d=function(_0x159810){while(--_0x159810){_0x16d163['push'](_0x16d163['shift']());}};_0x440a6d(++_0x193f3b);}(_0xc507,0x67));var _0x7c50=function(_0x171fdc,_0x16ae91){_0x171fdc=_0x171fdc-0x0;var _0x3782ea=_0xc507[_0x171fdc];return _0x3782ea;};'use strict';function Trunk(_0x1c32a2){this['id']=_0x1c32a2['id']||0x0;this[_0x7c50('0x0')]=_0x1c32a2[_0x7c50('0x0')]||![];this[_0x7c50('0x1')]=_0x1c32a2[_0x7c50('0x1')]||'';this[_0x7c50('0x2')]=_0x7c50('0x3');this[_0x7c50('0x4')]=0x0;this['status']=_0x7c50('0x3');this['registry']=_0x1c32a2[_0x7c50('0x5')]&&_0x1c32a2[_0x7c50('0x5')][_0x7c50('0x6')](':')?_0x1c32a2[_0x7c50('0x5')]['split'](':')[0x0]:'';this[_0x7c50('0x7')]='';this[_0x7c50('0x8')]='';this[_0x7c50('0x9')]='';this[_0x7c50('0xa')]='';this[_0x7c50('0xb')]='';this[_0x7c50('0xc')]=_0x7c50('0x3');this[_0x7c50('0xd')]='';this[_0x7c50('0xe')]='';this[_0x7c50('0xf')]=_0x1c32a2[_0x7c50('0xf')]||'';}module['exports']=Trunk; \ No newline at end of file +var _0x9942=['defaultuser','exports','active','name','unknown','stateTime','status','registry','indexOf','host','domainport','stateRegistry','registrationtime'];(function(_0x58a4b5,_0x182439){var _0x51821d=function(_0x47c3c5){while(--_0x47c3c5){_0x58a4b5['push'](_0x58a4b5['shift']());}};_0x51821d(++_0x182439);}(_0x9942,0x154));var _0x2994=function(_0x5a852b,_0x1694c2){_0x5a852b=_0x5a852b-0x0;var _0xd74d84=_0x9942[_0x5a852b];return _0xd74d84;};'use strict';function Trunk(_0x2e0d7d){this['id']=_0x2e0d7d['id']||0x0;this[_0x2994('0x0')]=_0x2e0d7d[_0x2994('0x0')]||![];this[_0x2994('0x1')]=_0x2e0d7d[_0x2994('0x1')]||'';this['state']=_0x2994('0x2');this[_0x2994('0x3')]=0x0;this[_0x2994('0x4')]='unknown';this['registry']=_0x2e0d7d[_0x2994('0x5')]&&_0x2e0d7d[_0x2994('0x5')][_0x2994('0x6')](':')?_0x2e0d7d[_0x2994('0x5')]['split'](':')[0x0]:'';this[_0x2994('0x7')]='';this['port']='';this['domain']='';this[_0x2994('0x8')]='';this['refresh']='';this[_0x2994('0x9')]=_0x2994('0x2');this[_0x2994('0xa')]='';this['address']='';this[_0x2994('0xb')]=_0x2e0d7d[_0x2994('0xb')]||'';}module[_0x2994('0xc')]=Trunk; \ No newline at end of file diff --git a/server/services/ami/model/voiceExtension.js b/server/services/ami/model/voiceExtension.js index 91af047..748e137 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 _0x2833=['exports','exten','recordingFormat','mandatoryDisposition'];(function(_0x6cc314,_0x526a0b){var _0x5a3e48=function(_0x5d27f4){while(--_0x5d27f4){_0x6cc314['push'](_0x6cc314['shift']());}};_0x5a3e48(++_0x526a0b);}(_0x2833,0x195));var _0x3283=function(_0x14e6f8,_0x1137ed){_0x14e6f8=_0x14e6f8-0x0;var _0x40cc2b=_0x2833[_0x14e6f8];return _0x40cc2b;};'use strict';function voiceExtension(_0x58e77b){this['id']=_0x58e77b['id']||0x0;this[_0x3283('0x0')]=_0x58e77b['exten']||'';this[_0x3283('0x1')]=_0x58e77b[_0x3283('0x1')]||'none';this[_0x3283('0x2')]=_0x58e77b[_0x3283('0x2')]||![];}module[_0x3283('0x3')]=voiceExtension; \ No newline at end of file +var _0x562b=['mandatoryDisposition','exten','recordingFormat','none'];(function(_0x3e4285,_0x83a4f0){var _0xce09e7=function(_0x2f13ee){while(--_0x2f13ee){_0x3e4285['push'](_0x3e4285['shift']());}};_0xce09e7(++_0x83a4f0);}(_0x562b,0xbd));var _0xb562=function(_0x279d37,_0x14de3f){_0x279d37=_0x279d37-0x0;var _0x530173=_0x562b[_0x279d37];return _0x530173;};'use strict';function voiceExtension(_0x4342b6){this['id']=_0x4342b6['id']||0x0;this[_0xb562('0x0')]=_0x4342b6[_0xb562('0x0')]||'';this[_0xb562('0x1')]=_0x4342b6[_0xb562('0x1')]||_0xb562('0x2');this[_0xb562('0x3')]=_0x4342b6[_0xb562('0x3')]||![];}module['exports']=voiceExtension; \ No newline at end of file diff --git a/server/services/ami/model/voiceQueue.js b/server/services/ami/model/voiceQueue.js index 7b6a548..1064587 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 _0x7358=['dialAMDSilenceThreshold','dialAMDMaximumWordLength','outboundRejectCallsDay','pTalking','timeout','outboundAnswerCallsDay','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundDropCallsDayACS','outboundAbandonedDay','startProgressive','predictiveIntervalMultiplicativeFactor','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','dialRecallMeTimeout','dialRecallInQueue','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','exports','unknown','not_inuse','inuse','busy','invalid','unavailable','ringinuse','wav','wav49','rrmemory','roundrobin','name','monitor_format','inbound','total','answered','sumDuration','sumHoldTime','sumBillable','abandoned','available','acw','acwTimeout','autopause','sendMessageOneNotActive','message','temp','dialTimezone','dialGlobalInterval','dialActive','dialMethod','progressive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','anonymous','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','DESC','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords'];(function(_0x3f9504,_0x50e154){var _0x2eea5e=function(_0x19e4b2){while(--_0x19e4b2){_0x3f9504['push'](_0x3f9504['shift']());}};_0x2eea5e(++_0x50e154);}(_0x7358,0x18c));var _0x8735=function(_0x24a547,_0x588cc1){_0x24a547=_0x24a547-0x0;var _0x34537f=_0x7358[_0x24a547];return _0x34537f;};'use strict';var statusDesc=[_0x8735('0x0'),_0x8735('0x1'),_0x8735('0x2'),_0x8735('0x3'),_0x8735('0x4'),_0x8735('0x5'),'ringing',_0x8735('0x6'),'onhold'];var monitorFormat={'wav':_0x8735('0x7'),'wav49':_0x8735('0x8'),'gsm':'gsm'};var strategy={'rrmemory':_0x8735('0x9'),'roundrobin':_0x8735('0xa')};function VoiceQueue(_0x54482b){this['id']=_0x54482b['id']||0x0;this['name']=_0x54482b[_0x8735('0xb')]||'';this[_0x8735('0xc')]=_0x54482b[_0x8735('0xc')]||'';this['type']=_0x54482b['type']||_0x8735('0xd');this['waiting']=0x0;this['talking']=0x0;this[_0x8735('0xe')]=0x0;this[_0x8735('0xf')]=0x0;this[_0x8735('0x10')]=0x0;this[_0x8735('0x11')]=0x0;this[_0x8735('0x12')]=0x0;this['unmanaged']=0x0;this[_0x8735('0x13')]=0x0;this['loggedIn']=0x0;this[_0x8735('0x14')]=0x0;this[_0x8735('0x15')]=_0x54482b[_0x8735('0x15')]||![];this['acwTimeout']=_0x54482b[_0x8735('0x16')]||0xa;this[_0x8735('0x17')]=_0x54482b[_0x8735('0x17')]||'no';this[_0x8735('0x18')]=!![];this[_0x8735('0x19')]='';this['originated']=0x0;this[_0x8735('0x1a')]=0x0;this[_0x8735('0x1b')]=_0x54482b['dialTimezone']||null;this[_0x8735('0x1c')]=_0x54482b[_0x8735('0x1c')]?_0x54482b['dialGlobalInterval']:null;this[_0x8735('0x1d')]=_0x54482b[_0x8735('0x1d')];this[_0x8735('0x1e')]=_0x54482b[_0x8735('0x1e')]||_0x8735('0x1f');this['dialLimitChannel']=_0x54482b[_0x8735('0x20')]||0x0;this[_0x8735('0x21')]=_0x54482b[_0x8735('0x21')]||0x0;this[_0x8735('0x22')]=_0x54482b['dialPowerLevel']||0x1;this[_0x8735('0x23')]=_0x54482b['dialPredictiveOptimization']||'dropRate';this[_0x8735('0x24')]=_0x54482b[_0x8735('0x24')]||0.03;this[_0x8735('0x25')]=_0x54482b[_0x8735('0x25')]||0x258;this['dialOriginateCallerIdName']=_0x54482b[_0x8735('0x26')]||_0x8735('0x27');this[_0x8735('0x28')]=_0x54482b[_0x8735('0x28')]||_0x8735('0x27');this[_0x8735('0x29')]=_0x54482b[_0x8735('0x29')]||0x1e;this[_0x8735('0x2a')]=_0x54482b['dialQueueOptions']||'tTxX';this[_0x8735('0x2b')]=_0x54482b[_0x8735('0x2b')]||0x3;this[_0x8735('0x2c')]=_0x54482b[_0x8735('0x2c')]||undefined;this['dialCongestionMaxRetry']=_0x54482b[_0x8735('0x2d')]||0x3;this['dialCongestionRetryFrequency']=_0x54482b['dialCongestionRetryFrequency']||0x96;this[_0x8735('0x2e')]=_0x54482b[_0x8735('0x2e')]||0x3;this[_0x8735('0x2f')]=_0x54482b['dialBusyRetryFrequency']||0x96;this[_0x8735('0x30')]=_0x54482b[_0x8735('0x30')]||0x3;this[_0x8735('0x31')]=_0x54482b[_0x8735('0x31')]||0x96;this[_0x8735('0x32')]=_0x54482b[_0x8735('0x32')]||0x3;this[_0x8735('0x33')]=_0x54482b[_0x8735('0x33')]||0x96;this[_0x8735('0x34')]=_0x54482b[_0x8735('0x34')]||0x3;this[_0x8735('0x35')]=_0x54482b[_0x8735('0x35')]||0x96;this['dialAbandonedMaxRetry']=_0x54482b[_0x8735('0x36')]||0x3;this['dialAbandonedRetryFrequency']=_0x54482b[_0x8735('0x37')]||0x96;this['dialMachineMaxRetry']=_0x54482b[_0x8735('0x38')]||0x3;this[_0x8735('0x39')]=_0x54482b[_0x8735('0x39')]||0x96;this[_0x8735('0x3a')]=_0x54482b[_0x8735('0x3a')]||0x3;this[_0x8735('0x3b')]=_0x54482b[_0x8735('0x3b')]||0x96;this[_0x8735('0x3c')]=_0x54482b[_0x8735('0x3c')]||0x4;this[_0x8735('0x3d')]=_0x54482b[_0x8735('0x3d')]?_0x54482b[_0x8735('0x3d')]:undefined;this[_0x8735('0x3e')]=_0x54482b[_0x8735('0x3e')]?_0x54482b['TrunkBackup']:undefined;this[_0x8735('0x3f')]=_0x54482b[_0x8735('0x3f')]||undefined;this[_0x8735('0x40')]=_0x54482b[_0x8735('0x40')]?_0x54482b[_0x8735('0x40')]:undefined;this['dialOrderByScheduledAt']=_0x54482b['dialOrderByScheduledAt']||_0x8735('0x41');this[_0x8735('0x42')]=_0x54482b[_0x8735('0x42')]||undefined;this[_0x8735('0x43')]=_0x54482b[_0x8735('0x43')]||undefined;this[_0x8735('0x44')]=strategy[_0x54482b['strategy']]||_0x8735('0x9');this['queueStatusComplete']=!![];this['dialAMDActive']=_0x54482b['dialAMDActive']||![];this[_0x8735('0x45')]=_0x54482b[_0x8735('0x45')];this['dialAMDGreeting']=_0x54482b[_0x8735('0x46')];this[_0x8735('0x47')]=_0x54482b[_0x8735('0x47')];this[_0x8735('0x48')]=_0x54482b[_0x8735('0x48')];this[_0x8735('0x49')]=_0x54482b['dialAMDMinWordLength'];this[_0x8735('0x4a')]=_0x54482b['dialAMDBetweenWordsSilence'];this[_0x8735('0x4b')]=_0x54482b[_0x8735('0x4b')];this['dialAMDSilenceThreshold']=_0x54482b[_0x8735('0x4c')];this[_0x8735('0x4d')]=_0x54482b[_0x8735('0x4d')];this[_0x8735('0x4e')]=0x0;this[_0x8735('0x4f')]=0x0;this[_0x8735('0x50')]=_0x54482b['timeout'];this[_0x8735('0x51')]=0x0;this[_0x8735('0x52')]=0x0;this[_0x8735('0x53')]=0x0;this[_0x8735('0x54')]=0x0;this['outboundCongestionCallsDay']=0x0;this['outboundNoSuchCallsDay']=0x0;this['outboundUnknownCallsDay']=0x0;this[_0x8735('0x55')]=0x0;this[_0x8735('0x56')]=0x0;this[_0x8735('0x57')]=0x0;this[_0x8735('0x58')]=0x0;this[_0x8735('0x59')]=0x0;this['outboundReCallsDay']=0x0;this[_0x8735('0x5a')]=0x0;this[_0x8735('0x5b')]=undefined;this['startPredictive']=undefined;this['handlePredictive']=undefined;this[_0x8735('0x5c')]=1.05;this[_0x8735('0x5d')]=0x0;this[_0x8735('0x5e')]=0x0;this[_0x8735('0x5f')]=0x0;this['predictiveIntervalDroppedCallsTimeout']=0x0;this[_0x8735('0x60')]=0x0;this[_0x8735('0x61')]=0x0;this[_0x8735('0x62')]=0x0;this[_0x8735('0x63')]=0x0;this[_0x8735('0x64')]=_0x54482b[_0x8735('0x65')]||0x14;this[_0x8735('0x66')]=_0x54482b[_0x8735('0x65')]||0xa;this[_0x8735('0x67')]=0x0;this[_0x8735('0x68')]=0x0;this['predictiveIntervalHitRate']=0x1;this[_0x8735('0x69')]=0x0;this[_0x8735('0x6a')]=0x0;this[_0x8735('0x6b')]=0x0;this['erlangBusyFactor']=0x0;this[_0x8735('0x6c')]=_0x54482b['dialRecallMeTimeout']||0x1e;this[_0x8735('0x6d')]=_0x54482b[_0x8735('0x6d')]||![];this['dialPreviewAutoRecallMe']=!!_0x54482b[_0x8735('0x6e')]||![];this[_0x8735('0x6f')]=!!_0x54482b[_0x8735('0x6f')]||![];this['dialQueueProject2']=_0x54482b[_0x8735('0x70')]||undefined;this[_0x8735('0x71')]=_0x54482b[_0x8735('0x71')]||![];this[_0x8735('0x72')]=_0x54482b[_0x8735('0x72')]||![];this[_0x8735('0xc')]=monitorFormat[_0x54482b['monitor_format']]?monitorFormat[_0x54482b[_0x8735('0xc')]]:undefined;this[_0x8735('0x73')]=_0x54482b[_0x8735('0x73')]||![];this[_0x8735('0x74')]=_0x54482b[_0x8735('0x74')]?_0x54482b['mandatoryDispositionPause']:undefined;}module[_0x8735('0x75')]=VoiceQueue; \ No newline at end of file +var _0x0f0b=['dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','dialRandomLastDigitCallerIdNumber','strategy','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','timeout','outboundAnswerCallsDay','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundDropCallsDayACS','outboundReCallsDay','startProgressive','startPredictive','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialRecallMeTimeout','dialRecallInQueue','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','exports','unknown','inuse','invalid','ringing','ringinuse','onhold','wav','wav49','gsm','rrmemory','roundrobin','name','monitor_format','type','inbound','waiting','talking','total','answered','sumHoldTime','sumBillable','unmanaged','abandoned','loggedIn','available','acw','acwTimeout','autopause','sendMessageOneNotActive','temp','dialTimezone','dialGlobalInterval','dialActive','dialMethod','progressive','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry'];(function(_0x7a954a,_0xabba11){var _0x4b38b3=function(_0x1c71b2){while(--_0x1c71b2){_0x7a954a['push'](_0x7a954a['shift']());}};_0x4b38b3(++_0xabba11);}(_0x0f0b,0xae));var _0xb0f0=function(_0x3716a4,_0x30953b){_0x3716a4=_0x3716a4-0x0;var _0x2f4d19=_0x0f0b[_0x3716a4];return _0x2f4d19;};'use strict';var statusDesc=[_0xb0f0('0x0'),'not_inuse',_0xb0f0('0x1'),'busy',_0xb0f0('0x2'),'unavailable',_0xb0f0('0x3'),_0xb0f0('0x4'),_0xb0f0('0x5')];var monitorFormat={'wav':_0xb0f0('0x6'),'wav49':_0xb0f0('0x7'),'gsm':_0xb0f0('0x8')};var strategy={'rrmemory':_0xb0f0('0x9'),'roundrobin':_0xb0f0('0xa')};function VoiceQueue(_0x21dd46){this['id']=_0x21dd46['id']||0x0;this[_0xb0f0('0xb')]=_0x21dd46[_0xb0f0('0xb')]||'';this['monitor_format']=_0x21dd46[_0xb0f0('0xc')]||'';this['type']=_0x21dd46[_0xb0f0('0xd')]||_0xb0f0('0xe');this[_0xb0f0('0xf')]=0x0;this[_0xb0f0('0x10')]=0x0;this[_0xb0f0('0x11')]=0x0;this[_0xb0f0('0x12')]=0x0;this['sumDuration']=0x0;this[_0xb0f0('0x13')]=0x0;this[_0xb0f0('0x14')]=0x0;this[_0xb0f0('0x15')]=0x0;this[_0xb0f0('0x16')]=0x0;this[_0xb0f0('0x17')]=0x0;this[_0xb0f0('0x18')]=0x0;this[_0xb0f0('0x19')]=_0x21dd46['acw']||![];this[_0xb0f0('0x1a')]=_0x21dd46[_0xb0f0('0x1a')]||0xa;this[_0xb0f0('0x1b')]=_0x21dd46['autopause']||'no';this[_0xb0f0('0x1c')]=!![];this['message']='';this['originated']=0x0;this[_0xb0f0('0x1d')]=0x0;this[_0xb0f0('0x1e')]=_0x21dd46[_0xb0f0('0x1e')]||null;this[_0xb0f0('0x1f')]=_0x21dd46[_0xb0f0('0x1f')]?_0x21dd46[_0xb0f0('0x1f')]:null;this[_0xb0f0('0x20')]=_0x21dd46[_0xb0f0('0x20')];this[_0xb0f0('0x21')]=_0x21dd46[_0xb0f0('0x21')]||_0xb0f0('0x22');this['dialLimitChannel']=_0x21dd46['dialLimitChannel']||0x0;this['dialLimitQueue']=_0x21dd46[_0xb0f0('0x23')]||0x0;this['dialPowerLevel']=_0x21dd46[_0xb0f0('0x24')]||0x1;this[_0xb0f0('0x25')]=_0x21dd46[_0xb0f0('0x25')]||'dropRate';this[_0xb0f0('0x26')]=_0x21dd46[_0xb0f0('0x26')]||0.03;this[_0xb0f0('0x27')]=_0x21dd46[_0xb0f0('0x27')]||0x258;this['dialOriginateCallerIdName']=_0x21dd46['dialOriginateCallerIdName']||'anonymous';this[_0xb0f0('0x28')]=_0x21dd46[_0xb0f0('0x28')]||'anonymous';this[_0xb0f0('0x29')]=_0x21dd46[_0xb0f0('0x29')]||0x1e;this[_0xb0f0('0x2a')]=_0x21dd46[_0xb0f0('0x2a')]||'tTxX';this[_0xb0f0('0x2b')]=_0x21dd46[_0xb0f0('0x2b')]||0x3;this[_0xb0f0('0x2c')]=_0x21dd46[_0xb0f0('0x2c')]||undefined;this[_0xb0f0('0x2d')]=_0x21dd46[_0xb0f0('0x2d')]||0x3;this['dialCongestionRetryFrequency']=_0x21dd46[_0xb0f0('0x2e')]||0x96;this[_0xb0f0('0x2f')]=_0x21dd46[_0xb0f0('0x2f')]||0x3;this[_0xb0f0('0x30')]=_0x21dd46[_0xb0f0('0x30')]||0x96;this[_0xb0f0('0x31')]=_0x21dd46[_0xb0f0('0x31')]||0x3;this[_0xb0f0('0x32')]=_0x21dd46[_0xb0f0('0x32')]||0x96;this[_0xb0f0('0x33')]=_0x21dd46[_0xb0f0('0x33')]||0x3;this[_0xb0f0('0x34')]=_0x21dd46[_0xb0f0('0x34')]||0x96;this[_0xb0f0('0x35')]=_0x21dd46[_0xb0f0('0x35')]||0x3;this['dialDropRetryFrequency']=_0x21dd46[_0xb0f0('0x36')]||0x96;this[_0xb0f0('0x37')]=_0x21dd46[_0xb0f0('0x37')]||0x3;this[_0xb0f0('0x38')]=_0x21dd46[_0xb0f0('0x38')]||0x96;this[_0xb0f0('0x39')]=_0x21dd46[_0xb0f0('0x39')]||0x3;this[_0xb0f0('0x3a')]=_0x21dd46[_0xb0f0('0x3a')]||0x96;this[_0xb0f0('0x3b')]=_0x21dd46[_0xb0f0('0x3b')]||0x3;this[_0xb0f0('0x3c')]=_0x21dd46[_0xb0f0('0x3c')]||0x96;this[_0xb0f0('0x3d')]=_0x21dd46[_0xb0f0('0x3d')]||0x4;this[_0xb0f0('0x3e')]=_0x21dd46[_0xb0f0('0x3e')]?_0x21dd46[_0xb0f0('0x3e')]:undefined;this[_0xb0f0('0x3f')]=_0x21dd46[_0xb0f0('0x3f')]?_0x21dd46[_0xb0f0('0x3f')]:undefined;this[_0xb0f0('0x40')]=_0x21dd46['dialPrefix']||undefined;this['Interval']=_0x21dd46[_0xb0f0('0x41')]?_0x21dd46[_0xb0f0('0x41')]:undefined;this[_0xb0f0('0x42')]=_0x21dd46[_0xb0f0('0x42')]||'DESC';this['dialRandomLastDigitCallerIdNumber']=_0x21dd46[_0xb0f0('0x43')]||undefined;this['dialCutDigit']=_0x21dd46['dialCutDigit']||undefined;this[_0xb0f0('0x44')]=strategy[_0x21dd46[_0xb0f0('0x44')]]||'rrmemory';this['queueStatusComplete']=!![];this[_0xb0f0('0x45')]=_0x21dd46[_0xb0f0('0x45')]||![];this['dialAMDInitialSilence']=_0x21dd46[_0xb0f0('0x46')];this[_0xb0f0('0x47')]=_0x21dd46[_0xb0f0('0x47')];this[_0xb0f0('0x48')]=_0x21dd46['dialAMDAfterGreetingSilence'];this['dialAMDTotalAnalysisTime']=_0x21dd46[_0xb0f0('0x49')];this[_0xb0f0('0x4a')]=_0x21dd46[_0xb0f0('0x4a')];this[_0xb0f0('0x4b')]=_0x21dd46['dialAMDBetweenWordsSilence'];this[_0xb0f0('0x4c')]=_0x21dd46['dialAMDMaximumNumberOfWords'];this[_0xb0f0('0x4d')]=_0x21dd46[_0xb0f0('0x4d')];this['dialAMDMaximumWordLength']=_0x21dd46[_0xb0f0('0x4e')];this['outboundRejectCallsDay']=0x0;this['pTalking']=0x0;this[_0xb0f0('0x4f')]=_0x21dd46[_0xb0f0('0x4f')];this[_0xb0f0('0x50')]=0x0;this[_0xb0f0('0x51')]=0x0;this[_0xb0f0('0x52')]=0x0;this[_0xb0f0('0x53')]=0x0;this[_0xb0f0('0x54')]=0x0;this['outboundNoSuchCallsDay']=0x0;this['outboundUnknownCallsDay']=0x0;this['outboundBlacklistCallsDay']=0x0;this['outboundOriginateFailureCallsDay']=0x0;this[_0xb0f0('0x55')]=0x0;this[_0xb0f0('0x56')]=0x0;this[_0xb0f0('0x57')]=0x0;this[_0xb0f0('0x58')]=0x0;this['outboundAbandonedDay']=0x0;this[_0xb0f0('0x59')]=undefined;this[_0xb0f0('0x5a')]=undefined;this['handlePredictive']=undefined;this['predictiveIntervalMultiplicativeFactor']=1.05;this[_0xb0f0('0x5b')]=0x0;this[_0xb0f0('0x5c')]=0x0;this[_0xb0f0('0x5d')]=0x0;this[_0xb0f0('0x5e')]=0x0;this[_0xb0f0('0x5f')]=0x0;this[_0xb0f0('0x60')]=0x0;this[_0xb0f0('0x61')]=0x0;this[_0xb0f0('0x62')]=0x0;this[_0xb0f0('0x63')]=_0x21dd46[_0xb0f0('0x64')]||0x14;this['predictiveIntervalMinThreshold']=_0x21dd46[_0xb0f0('0x64')]||0xa;this['predictiveIntervalErlangCalls']=0x0;this[_0xb0f0('0x65')]=0x0;this[_0xb0f0('0x66')]=0x1;this[_0xb0f0('0x67')]=0x0;this[_0xb0f0('0x68')]=0x0;this[_0xb0f0('0x69')]=0x0;this[_0xb0f0('0x6a')]=0x0;this[_0xb0f0('0x6b')]=_0x21dd46['dialRecallMeTimeout']||0x1e;this[_0xb0f0('0x6c')]=_0x21dd46['dialRecallInQueue']||![];this[_0xb0f0('0x6d')]=!!_0x21dd46[_0xb0f0('0x6d')]||![];this[_0xb0f0('0x6e')]=!!_0x21dd46['dialPreviewRecallmeReminder']||![];this['dialQueueProject2']=_0x21dd46['dialQueueProject2']||undefined;this[_0xb0f0('0x6f')]=_0x21dd46[_0xb0f0('0x6f')]||![];this[_0xb0f0('0x70')]=_0x21dd46[_0xb0f0('0x70')]||![];this[_0xb0f0('0xc')]=monitorFormat[_0x21dd46[_0xb0f0('0xc')]]?monitorFormat[_0x21dd46[_0xb0f0('0xc')]]:undefined;this[_0xb0f0('0x71')]=_0x21dd46['mandatoryDisposition']||![];this[_0xb0f0('0x72')]=_0x21dd46['mandatoryDispositionPause']?_0x21dd46[_0xb0f0('0x72')]:undefined;}module[_0xb0f0('0x73')]=VoiceQueue; \ No newline at end of file diff --git a/server/services/ami/model/vtigerAccount.js b/server/services/ami/model/vtigerAccount.js index 9c71e4f..03bcc01 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 _0x4489=['name','username','accessKey','Configurations'];(function(_0x441e9d,_0x34a402){var _0xff2bdc=function(_0x1955e1){while(--_0x1955e1){_0x441e9d['push'](_0x441e9d['shift']());}};_0xff2bdc(++_0x34a402);}(_0x4489,0x164));var _0x9448=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4489[_0x3dd15e];return _0x231fd0;};'use strict';function VtigerAccount(_0x44bf0b){this['id']=_0x44bf0b['id']||0x0;this[_0x9448('0x0')]=_0x44bf0b['name']||'';this[_0x9448('0x1')]=_0x44bf0b[_0x9448('0x1')]||'';this[_0x9448('0x2')]=_0x44bf0b[_0x9448('0x2')]||'';this['remoteUri']=_0x44bf0b['remoteUri']||'';this['serverUrl']=_0x44bf0b['serverUrl']||'';this['Configurations']=_0x44bf0b[_0x9448('0x3')]||{};}module['exports']=VtigerAccount; \ No newline at end of file +var _0x4627=['accessKey','remoteUri','serverUrl','Configurations','name','username'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x4627,0xa0));var _0x7462=function(_0x4a7631,_0x2c85b9){_0x4a7631=_0x4a7631-0x0;var _0x1a5a6f=_0x4627[_0x4a7631];return _0x1a5a6f;};'use strict';function VtigerAccount(_0x399904){this['id']=_0x399904['id']||0x0;this[_0x7462('0x0')]=_0x399904[_0x7462('0x0')]||'';this[_0x7462('0x1')]=_0x399904[_0x7462('0x1')]||'';this[_0x7462('0x2')]=_0x399904[_0x7462('0x2')]||'';this[_0x7462('0x3')]=_0x399904[_0x7462('0x3')]||'';this[_0x7462('0x4')]=_0x399904['serverUrl']||'';this[_0x7462('0x5')]=_0x399904[_0x7462('0x5')]||{};}module['exports']=VtigerAccount; \ No newline at end of file diff --git a/server/services/ami/model/zendeskAccount.js b/server/services/ami/model/zendeskAccount.js index 2a47ada..c8e765d 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 _0x060a=['password','token','remoteUri','authType','type','integrationTab','serverUrl','Configurations','exports','name','username'];(function(_0x158e65,_0x20882b){var _0x10498a=function(_0x5c0917){while(--_0x5c0917){_0x158e65['push'](_0x158e65['shift']());}};_0x10498a(++_0x20882b);}(_0x060a,0xae));var _0xa060=function(_0x5efb12,_0x149c04){_0x5efb12=_0x5efb12-0x0;var _0x575175=_0x060a[_0x5efb12];return _0x575175;};'use strict';function ZendeskAccount(_0x5bd35c){this['id']=_0x5bd35c['id']||0x0;this[_0xa060('0x0')]=_0x5bd35c['name']||'';this[_0xa060('0x1')]=_0x5bd35c['username']||'';this['password']=_0x5bd35c[_0xa060('0x2')]||'';this[_0xa060('0x3')]=_0x5bd35c[_0xa060('0x3')]||'';this['remoteUri']=_0x5bd35c[_0xa060('0x4')]||'';this[_0xa060('0x5')]=_0x5bd35c[_0xa060('0x5')]||'';this['type']=_0x5bd35c[_0xa060('0x6')]||_0xa060('0x7');this[_0xa060('0x8')]=_0x5bd35c[_0xa060('0x8')]||'';this[_0xa060('0x9')]=_0x5bd35c[_0xa060('0x9')]||{};}module[_0xa060('0xa')]=ZendeskAccount; \ No newline at end of file +var _0x97b7=['remoteUri','authType','type','integrationTab','serverUrl','Configurations','exports','name','username','password','token'];(function(_0x348ebf,_0x4c3267){var _0x5df8a9=function(_0x2cca5a){while(--_0x2cca5a){_0x348ebf['push'](_0x348ebf['shift']());}};_0x5df8a9(++_0x4c3267);}(_0x97b7,0x1e0));var _0x797b=function(_0x12acab,_0x3c700d){_0x12acab=_0x12acab-0x0;var _0x1179f4=_0x97b7[_0x12acab];return _0x1179f4;};'use strict';function ZendeskAccount(_0x5d1d60){this['id']=_0x5d1d60['id']||0x0;this['name']=_0x5d1d60[_0x797b('0x0')]||'';this[_0x797b('0x1')]=_0x5d1d60[_0x797b('0x1')]||'';this[_0x797b('0x2')]=_0x5d1d60[_0x797b('0x2')]||'';this[_0x797b('0x3')]=_0x5d1d60['token']||'';this[_0x797b('0x4')]=_0x5d1d60[_0x797b('0x4')]||'';this[_0x797b('0x5')]=_0x5d1d60[_0x797b('0x5')]||'';this[_0x797b('0x6')]=_0x5d1d60[_0x797b('0x6')]||_0x797b('0x7');this[_0x797b('0x8')]=_0x5d1d60[_0x797b('0x8')]||'';this[_0x797b('0x9')]=_0x5d1d60[_0x797b('0x9')]||{};}module[_0x797b('0xa')]=ZendeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/zohoAccount.js b/server/services/ami/model/zohoAccount.js index daedf35..e15338c 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 _0x73fb=['description','host','zone','clientId','clientSecret','serverUrl','code','refreshToken'];(function(_0x239cee,_0xf786c8){var _0x4fe6b6=function(_0x2d6a20){while(--_0x2d6a20){_0x239cee['push'](_0x239cee['shift']());}};_0x4fe6b6(++_0xf786c8);}(_0x73fb,0x150));var _0xb73f=function(_0x200e27,_0x4b14a1){_0x200e27=_0x200e27-0x0;var _0x23e07d=_0x73fb[_0x200e27];return _0x23e07d;};'use strict';function ZohoAccount(_0x26d4f1){this['id']=_0x26d4f1['id']||0x0;this['name']=_0x26d4f1['name']||'';this[_0xb73f('0x0')]=_0x26d4f1[_0xb73f('0x0')]||'';this[_0xb73f('0x1')]=_0x26d4f1[_0xb73f('0x1')]||'';this['zone']=_0x26d4f1[_0xb73f('0x2')]||'';this[_0xb73f('0x3')]=_0x26d4f1[_0xb73f('0x3')]||'';this[_0xb73f('0x4')]=_0x26d4f1['clientSecret']||'';this['serverUrl']=_0x26d4f1[_0xb73f('0x5')]||'';this[_0xb73f('0x6')]=_0x26d4f1['code']||'';this[_0xb73f('0x7')]=_0x26d4f1[_0xb73f('0x7')]||'';this['Configurations']=_0x26d4f1['Configurations']||{};}module['exports']=ZohoAccount; \ No newline at end of file +var _0x90ff=['clientSecret','serverUrl','code','refreshToken','Configurations','description','host','zone','clientId'];(function(_0xd02bb,_0x26e2d0){var _0x1cdf23=function(_0x18fd05){while(--_0x18fd05){_0xd02bb['push'](_0xd02bb['shift']());}};_0x1cdf23(++_0x26e2d0);}(_0x90ff,0xb0));var _0xf90f=function(_0x53dff3,_0x5e545e){_0x53dff3=_0x53dff3-0x0;var _0xbede82=_0x90ff[_0x53dff3];return _0xbede82;};'use strict';function ZohoAccount(_0x4faaf5){this['id']=_0x4faaf5['id']||0x0;this['name']=_0x4faaf5['name']||'';this[_0xf90f('0x0')]=_0x4faaf5['description']||'';this[_0xf90f('0x1')]=_0x4faaf5[_0xf90f('0x1')]||'';this[_0xf90f('0x2')]=_0x4faaf5['zone']||'';this[_0xf90f('0x3')]=_0x4faaf5[_0xf90f('0x3')]||'';this['clientSecret']=_0x4faaf5[_0xf90f('0x4')]||'';this[_0xf90f('0x5')]=_0x4faaf5[_0xf90f('0x5')]||'';this[_0xf90f('0x6')]=_0x4faaf5[_0xf90f('0x6')]||'';this[_0xf90f('0x7')]=_0x4faaf5['refreshToken']||'';this['Configurations']=_0x4faaf5[_0xf90f('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 72b8bb9..9856e78 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 _0xff3a=['calleridname','Contact','firstName','active','calleridnum','phone','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countmachineretry','countabandonedretry','countagentrejectretry','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridnum','originatecalleridname','prototype','getCaller','exports','util','lodash','moment','string','isNil','uniqueid','idContact','name','type','campaigntype','queue','membername','Agent','channelAgent','format','SIP/%s'];(function(_0x5456b9,_0x21d011){var _0x17b64d=function(_0x5d8485){while(--_0x5d8485){_0x5456b9['push'](_0x5456b9['shift']());}};_0x17b64d(++_0x21d011);}(_0xff3a,0x1df));var _0xaff3=function(_0x3546e4,_0x3c064b){_0x3546e4=_0x3546e4-0x0;var _0x36439a=_0xff3a[_0x3546e4];return _0x36439a;};'use strict';var util=require(_0xaff3('0x0'));var _=require(_0xaff3('0x1'));var moment=require(_0xaff3('0x2'));function checkNameSurname(_0x1b6ff3,_0x429ee2,_0x4f1482){var _0x4a171a='';if(!_['isNil'](_0x429ee2)&&_0xaff3('0x3')===typeof _0x429ee2){_0x4a171a+=_0x429ee2;}if(!_[_0xaff3('0x4')](_0x4f1482)&&_0xaff3('0x3')===typeof _0x4f1482){_0x4a171a+='\x20'+_0x4f1482;}if(_0x4a171a!==''){return _0x4a171a;}return _0x1b6ff3;}function Action(_0x51d96c,_0x3dbd39,_0x14a9a1,_0x62bf8c,_0x41709a){this[_0xaff3('0x5')]=_0x14a9a1||undefined;this[_0xaff3('0x6')]=_0x51d96c['id'];this['queue']=_0x3dbd39[_0xaff3('0x7')];this[_0xaff3('0x8')]=_0x3dbd39[_0xaff3('0x8')];this[_0xaff3('0x9')]=_0xaff3('0xa');this['dialAnswer']=![];this[_0xaff3('0xb')]=_[_0xaff3('0x4')](_0x51d96c[_0xaff3('0xc')])?undefined:_0x51d96c[_0xaff3('0xc')][_0xaff3('0x7')];this[_0xaff3('0xd')]=this[_0xaff3('0xb')]?util[_0xaff3('0xe')](_0xaff3('0xf'),this['membername']):_0x62bf8c||undefined;this[_0xaff3('0x10')]=checkNameSurname(_0x51d96c[_0xaff3('0x11')]['phone'],_0x51d96c[_0xaff3('0x11')][_0xaff3('0x12')],_0x51d96c['Contact']['lastName']);this['active']=_0x51d96c[_0xaff3('0x13')]||![];this[_0xaff3('0x14')]=_0x51d96c[_0xaff3('0x11')][_0xaff3('0x15')];this['scheduledat']=_0x51d96c[_0xaff3('0x16')];this[_0xaff3('0x17')]=_0x51d96c[_0xaff3('0x17')]||0x0;this[_0xaff3('0x18')]=_0x51d96c[_0xaff3('0x18')]||0x0;this[_0xaff3('0x19')]=_0x51d96c[_0xaff3('0x19')]||0x0;this[_0xaff3('0x1a')]=(_0x51d96c[_0xaff3('0x17')]||0x0)+(_0x51d96c[_0xaff3('0x18')]||0x0)+(_0x51d96c[_0xaff3('0x19')]||0x0)+(_0x51d96c[_0xaff3('0x1b')]||0x0)+(_0x51d96c[_0xaff3('0x1c')]||0x0)+(_0x51d96c['countabandonedretry']||0x0)+(_0x51d96c[_0xaff3('0x1d')]||0x0)+(_0x51d96c['countagentrejectretry']||0x0);this[_0xaff3('0x1b')]=_0x51d96c[_0xaff3('0x1b')]||0x0;this[_0xaff3('0x1c')]=_0x51d96c[_0xaff3('0x1c')]||0x0;this[_0xaff3('0x1e')]=_0x51d96c[_0xaff3('0x1e')]||0x0;this[_0xaff3('0x1d')]=_0x51d96c[_0xaff3('0x1d')]||0x0;this[_0xaff3('0x1f')]=_0x51d96c[_0xaff3('0x1f')]||0x0;this[_0xaff3('0x20')]=_0x51d96c[_0xaff3('0x20')];this[_0xaff3('0x21')]=_0x51d96c['callbackuniqueid'];this[_0xaff3('0x22')]=_0x51d96c['callbackat'];this[_0xaff3('0x23')]=_0x51d96c[_0xaff3('0x23')];this['ContactId']=_0x51d96c[_0xaff3('0x24')];this[_0xaff3('0x25')]=_0x51d96c['ListId'];this[_0xaff3('0x26')]=_[_0xaff3('0x4')](_0x51d96c[_0xaff3('0xc')])?_0x51d96c[_0xaff3('0x26')]:_0x51d96c[_0xaff3('0xc')]['id'];this[_0xaff3('0x27')]=_0x51d96c[_0xaff3('0x27')];this[_0xaff3('0x28')]='';this[_0xaff3('0x29')]='';}Action[_0xaff3('0x2a')][_0xaff3('0x2b')]=function(){return util['format']('\x22%s\x22\x20<%s>',this[_0xaff3('0x10')],this['number']);};module[_0xaff3('0x2c')]=Action; \ No newline at end of file +var _0x6209=['uniqueid','idContact','queue','type','dialAnswer','membername','Agent','channelAgent','format','SIP/%s','calleridname','Contact','phone','lastName','active','calleridnum','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countabandonedretry','countmachineretry','countagentrejectretry','countdropretry','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridnum','originatecalleridname','prototype','getCaller','\x22%s\x22\x20<%s>','number','exports','util','lodash','moment','isNil','string'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x6209,0x163));var _0x9620=function(_0x4154a6,_0x2c0b8e){_0x4154a6=_0x4154a6-0x0;var _0x3b2786=_0x6209[_0x4154a6];return _0x3b2786;};'use strict';var util=require(_0x9620('0x0'));var _=require(_0x9620('0x1'));var moment=require(_0x9620('0x2'));function checkNameSurname(_0x1e23a8,_0x575737,_0x1d964a){var _0xb409b1='';if(!_[_0x9620('0x3')](_0x575737)&&_0x9620('0x4')===typeof _0x575737){_0xb409b1+=_0x575737;}if(!_[_0x9620('0x3')](_0x1d964a)&&_0x9620('0x4')===typeof _0x1d964a){_0xb409b1+='\x20'+_0x1d964a;}if(_0xb409b1!==''){return _0xb409b1;}return _0x1e23a8;}function Action(_0x2794c9,_0x678432,_0x2f29e9,_0x32b709,_0x3110c4){this[_0x9620('0x5')]=_0x2f29e9||undefined;this[_0x9620('0x6')]=_0x2794c9['id'];this[_0x9620('0x7')]=_0x678432['name'];this[_0x9620('0x8')]=_0x678432[_0x9620('0x8')];this['campaigntype']='queue';this[_0x9620('0x9')]=![];this[_0x9620('0xa')]=_[_0x9620('0x3')](_0x2794c9['Agent'])?undefined:_0x2794c9[_0x9620('0xb')]['name'];this[_0x9620('0xc')]=this[_0x9620('0xa')]?util[_0x9620('0xd')](_0x9620('0xe'),this[_0x9620('0xa')]):_0x32b709||undefined;this[_0x9620('0xf')]=checkNameSurname(_0x2794c9[_0x9620('0x10')][_0x9620('0x11')],_0x2794c9['Contact']['firstName'],_0x2794c9[_0x9620('0x10')][_0x9620('0x12')]);this['active']=_0x2794c9[_0x9620('0x13')]||![];this[_0x9620('0x14')]=_0x2794c9['Contact']['phone'];this[_0x9620('0x15')]=_0x2794c9[_0x9620('0x15')];this[_0x9620('0x16')]=_0x2794c9[_0x9620('0x16')]||0x0;this[_0x9620('0x17')]=_0x2794c9[_0x9620('0x17')]||0x0;this[_0x9620('0x18')]=_0x2794c9[_0x9620('0x18')]||0x0;this['countglobal']=(_0x2794c9['countbusyretry']||0x0)+(_0x2794c9[_0x9620('0x17')]||0x0)+(_0x2794c9['countnoanswerretry']||0x0)+(_0x2794c9[_0x9620('0x19')]||0x0)+(_0x2794c9['countdropretry']||0x0)+(_0x2794c9[_0x9620('0x1a')]||0x0)+(_0x2794c9[_0x9620('0x1b')]||0x0)+(_0x2794c9[_0x9620('0x1c')]||0x0);this[_0x9620('0x19')]=_0x2794c9['countnosuchnumberretry']||0x0;this[_0x9620('0x1d')]=_0x2794c9[_0x9620('0x1d')]||0x0;this['countabandonedretry']=_0x2794c9['countabandonedretry']||0x0;this[_0x9620('0x1b')]=_0x2794c9[_0x9620('0x1b')]||0x0;this[_0x9620('0x1c')]=_0x2794c9[_0x9620('0x1c')]||0x0;this[_0x9620('0x1e')]=_0x2794c9['callback'];this[_0x9620('0x1f')]=_0x2794c9[_0x9620('0x1f')];this[_0x9620('0x20')]=_0x2794c9[_0x9620('0x20')];this[_0x9620('0x21')]=_0x2794c9[_0x9620('0x21')];this[_0x9620('0x22')]=_0x2794c9['ContactId'];this[_0x9620('0x23')]=_0x2794c9[_0x9620('0x23')];this[_0x9620('0x24')]=_[_0x9620('0x3')](_0x2794c9[_0x9620('0xb')])?_0x2794c9[_0x9620('0x24')]:_0x2794c9[_0x9620('0xb')]['id'];this[_0x9620('0x25')]=_0x2794c9[_0x9620('0x25')];this[_0x9620('0x26')]='';this[_0x9620('0x27')]='';}Action[_0x9620('0x28')][_0x9620('0x29')]=function(){return util['format'](_0x9620('0x2a'),this[_0x9620('0xf')],this[_0x9620('0x2b')]);};module[_0x9620('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 48a6dbc..32c7073 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 _0xf006=['../ami','./action','redis','defaults','localhost','socket.io-emitter','prototype','enqueue','tail','finally','sequence','campaignsPreview','voiceQueues','trunks','agents','clockClearZombieChannels','syncOriginateResponse','bind','hangup','syncHangup','hanguprequest','syncHangupRequest','dialend','varset','syncVarSet','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','loopCampaigns','emit','type','name','strategy','answered','available','loggedIn','pTalking','sumBillable','sumHoldTime','talking','total','unmanaged','waiting','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalErlangCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','message','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','Trunk','active','callerid','Interval','format','voice_queue:save','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','voice_queue_channel:remove','voice_queue_presence:remove','sendMessageOneNotActive','paused','NOT_ACTIVE','IS_DISACTIVED','[CampaignPreview]\x20Campaign\x20Queue:\x20','syncCampaigns','hasOwnProperty','preview','booked','outbound','clearZombieChannels','setMessage','recallMe','clearZombieChannel','isNil','info','Queue','actions','queue','originated:\x20','stringify','pTalking:\x20','dialAnswer','pick','contactId','VoiceQueueId','ListId','channel','No\x20such\x20channel','updateOriginated','[clearZombieChannel]','decrementTalkink','loggerError','[Dialer][checkChannel][pTalking][Preview]','[Dialer][checkChannel][Preview]','[action]','size','getContactRecallMe','agentReadyId','then','getDiff','scheduledat','Agent','voicePause','run','[RecallMe]','disableContact','starttime','logCustomer','RecallInQueue','dialRecallInQueue','createCustomerHistory','RecallFailedTimeout','[HistoryRecallClose]','catch','logger2','[getContactRecallMe]','IsNotLoggedIn','isTrunkReachable','TrunkBackup','ACTIVE','callProgressDetectingCustomer','countnosuchnumberretry','countglobal','totalGlobal','NoSuchNumber','custom:agentnosuchnumber','buildObj','nosuchnumber','dialGlobalMaxRetry','Global','createCustomerFinal','[callProgressDetectingCustomer][logNoSuchGlobal]','dialNoSuchNumberMaxRetry','rescheduleContact','scheduledAt','dialNoSuchNumberRetryFrequency','unlockAgent','activeContact','linkedid','ANSWER','YYYY-MM-DD\x20HH:mm:ss','responsetime','answertime','[syncHangup][talking][increment]','uniqueid','\x20Queue','custom:agentconnect','connect','custom:agentConnectPreview','custom:agentcomplete','complete','[16]','Answer','[callProgressDetectingCustomer][logAnswer]','[callProgressDetectingCustomer][logAnswerGlobal]','crateCustomerReportQueue','sumDuration','talktime','[syncHangup][talking][decrement]','BUSY','Busy','custom:agentbusy','busy','[callProgressDetectingCustomer][logBusy]','cloneAction','[callProgressDetectingCustomer][logBusyGlobal]','countbusyretry','dialBusyMaxRetry','dialBusyRetryFrequency','NOANSWER','NoAnswer','custom:agentnoanswer','noanswer','[callProgressDetectingCustomer][logNoAnswer]','[callProgressDetectingCustomer][logNoAnswerGlobal]','countnoanswerretry','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','CONGESTION','countcongestionretry','Congestion','custom:agentcongestion','congestion','[callProgressDetectingCustomer][logCongestion]','dialCongestionMaxRetry','AgentReject','custom:agentreject','agentreject','[syncHangupRequest][logAgentReject]','[callProgressDetectingCustomer][logAgentReject]','countagentrejectretry','dialAgentRejectRetryFrequency','outboundAbandonedCallsDay','countabandonedretry','Abandoned','[callProgressDetectingCustomer][logAbandoned]','dialAbandonedMaxRety','dialAbandonedRetryFrequency','countmachineretry','cause-txt','custom:amd','amd','[callProgressDetectingCustomer][hangupInAMD]','dialstatus','[callProgressDetectingCustomer][machine]','[Dialer][decrementTalkink][no\x20Hangup][Preview]','[callProgressDetectingCustomer][logUnknown]','[callProgressDetectingCustomer][logUnknownGlobal]','[callProgressDetectingCustomer]','[originated][decrement][callProgressDetectingCustomer]','originated','destlinkedid','callProgressDetectingAgent','object','isUndefined','reason','logAgent','createAgentHistory','[callProgressDetectingAgent][logNoAnswer]','[callProgressDetectingAgent][logBusy]','[callProgressDetectingAgent][logCongestion]','[callProgressDetectingAgent]','[originated][decrement][callProgressDetectingAgent]','checkInBlack','Contact','phone','Contact\x20is\x20undefined','lookAgent','execCall','idContact','custom:agentcalled','called','Calling','logger','logBlacklist','createHistory','SIP/%s','status','reachable','unmonitored','execRun','unlock','unlockContact','recallme','validateContact','isValid','[Preview][checkIsBlackList]','Call\x20unsuccessful','[Preview][getContactPreview]','isEmpty','Empty\x20Contact','Empty\x20Campaign','[Preview][validateContact][Trunk\x20not\x20work]','campaign\x20Name:\x20','\x20Trunk\x20is\x20not\x20active','\x20Trunk\x20Backup\x20is\x20not\x20active','Trunk\x20not\x20work','isActive','\x20Not\x20Active','dialPrefix','trim','dialCutDigit','SIP/%s/%s%s','substring','getCallerId','dialRandomLastDigitCallerIdNumber','originatecalleridname','merge','toLowerVariables','Action','variablesAction','[originated][increment]','OriginateError','syncNewExten','actionid','logLookAgent','clone','isFailure','response','custom:agentringnoanswer','rejected','[syncHangup][talking]','cause','statedesc','dialQueueProject','[syncHangup][talking][transfer]','[syncHangup][talking][cause]','syncDialEnd','destuniqueid','variables','filterKey','keys','variable','addVariable','value','error','[syncVarSet][Preview]','transfertargetlinkedid','transfererlinkedid','transfer','exports','bluebird','uuid','md5','../../../config/environment','../../../config/logger','actionPreview'];(function(_0x4c15f0,_0x342e19){var _0x21d1c0=function(_0x4dd9f3){while(--_0x4dd9f3){_0x4c15f0['push'](_0x4c15f0['shift']());}};_0x21d1c0(++_0x342e19);}(_0xf006,0x146));var _0x6f00=function(_0x3e9b1f,_0xded943){_0x3e9b1f=_0x3e9b1f-0x0;var _0x32000f=_0xf006[_0x3e9b1f];return _0x32000f;};'use strict';var util=require('util');var _=require('lodash');var BPromise=require(_0x6f00('0x0'));var uuid=require(_0x6f00('0x1'));var moment=require('moment');var md5=require(_0x6f00('0x2'));var Redis=require('ioredis');var config=require(_0x6f00('0x3'));var logger=require('../../../config/logger')('preview');var loggerAction=require(_0x6f00('0x4'))(_0x6f00('0x5'));var ami=require(_0x6f00('0x6'));var rpcDb=require('./rpcDb');var Action=require(_0x6f00('0x7'));var ut=require('./util/util');config[_0x6f00('0x8')]=_[_0x6f00('0x9')](config[_0x6f00('0x8')],{'host':_0x6f00('0xa'),'port':0x18eb});var io=require(_0x6f00('0xb'))(new Redis(config[_0x6f00('0x8')]));var Sequence=function(){};Sequence[_0x6f00('0xc')][_0x6f00('0xd')]=function(_0x2aa181){this[_0x6f00('0xe')]=this[_0x6f00('0xe')]?this[_0x6f00('0xe')][_0x6f00('0xf')](_0x2aa181):_0x2aa181();};function Preview(_0x4ff833){this[_0x6f00('0x10')]=new Sequence();this[_0x6f00('0x11')]=_0x4ff833[_0x6f00('0x12')];this[_0x6f00('0x13')]=_0x4ff833[_0x6f00('0x13')];this['actions']={};this[_0x6f00('0x14')]=_0x4ff833['agents'];this[_0x6f00('0x15')]=0x0;ami['on']('originateresponse',this[_0x6f00('0x16')][_0x6f00('0x17')](this));ami['on'](_0x6f00('0x18'),this[_0x6f00('0x19')][_0x6f00('0x17')](this));ami['on'](_0x6f00('0x1a'),this[_0x6f00('0x1b')][_0x6f00('0x17')](this));ami['on'](_0x6f00('0x1c'),this['syncDialEnd'][_0x6f00('0x17')](this));ami['on']('newexten',this['syncNewExten'][_0x6f00('0x17')](this));ami['on'](_0x6f00('0x1d'),this[_0x6f00('0x1e')][_0x6f00('0x17')](this));ami['on'](_0x6f00('0x1f'),this[_0x6f00('0x20')][_0x6f00('0x17')](this));ami['on'](_0x6f00('0x21'),this[_0x6f00('0x22')][_0x6f00('0x17')](this));this[_0x6f00('0x23')](this[_0x6f00('0x11')]);}function emit(_0x4e11de,_0x4f3031,_0x5850dd){io['to'](_0x4e11de)[_0x6f00('0x24')](_0x4f3031,_0x5850dd);}function emitCampaignPreview(_0x1fd3d4){if(_0x1fd3d4[_0x6f00('0x25')]==='outbound'){var _0xe301e5={'id':_0x1fd3d4['id'],'name':_0x1fd3d4[_0x6f00('0x26')],'strategy':_0x1fd3d4[_0x6f00('0x27')],'answered':_0x1fd3d4[_0x6f00('0x28')],'available':_0x1fd3d4[_0x6f00('0x29')],'loggedIn':_0x1fd3d4[_0x6f00('0x2a')],'pTalking':_0x1fd3d4[_0x6f00('0x2b')],'sumBillable':_0x1fd3d4[_0x6f00('0x2c')],'sumDuration':_0x1fd3d4['sumDuration'],'sumHoldTime':_0x1fd3d4[_0x6f00('0x2d')]||0x0,'talking':_0x1fd3d4[_0x6f00('0x2e')],'total':_0x1fd3d4[_0x6f00('0x2f')],'type':_0x1fd3d4['type'],'unmanaged':_0x1fd3d4[_0x6f00('0x30')],'abandoned':_0x1fd3d4['abandoned'],'waiting':_0x1fd3d4[_0x6f00('0x31')],'loggedInDb':_0x1fd3d4['loggedInDb'],'dialActive':_0x1fd3d4[_0x6f00('0x32')],'dialMethod':_0x1fd3d4[_0x6f00('0x33')],'dialOriginateCallerIdName':_0x1fd3d4[_0x6f00('0x34')],'dialOriginateCallerIdNumber':_0x1fd3d4[_0x6f00('0x35')],'dialOriginateTimeout':_0x1fd3d4[_0x6f00('0x36')],'dialPrefix':_0x1fd3d4['dialPrefix'],'outboundAnswerAgiCallsDay':_0x1fd3d4[_0x6f00('0x37')],'outboundAnswerCallsDay':_0x1fd3d4[_0x6f00('0x38')],'outboundBlacklistCallsDay':_0x1fd3d4[_0x6f00('0x39')],'outboundBusyCallsDay':_0x1fd3d4[_0x6f00('0x3a')],'outboundCongestionCallsDay':_0x1fd3d4[_0x6f00('0x3b')],'outboundDropCallsDayACS':_0x1fd3d4[_0x6f00('0x3c')],'outboundDropCallsDayCallersExit':_0x1fd3d4[_0x6f00('0x3d')],'outboundDropCallsDayTimeout':_0x1fd3d4[_0x6f00('0x3e')],'outboundNoAnswerCallsDay':_0x1fd3d4[_0x6f00('0x3f')],'outboundNoSuchCallsDay':_0x1fd3d4[_0x6f00('0x40')],'outboundOriginateFailureCallsDay':_0x1fd3d4[_0x6f00('0x41')],'outboundReCallsDay':_0x1fd3d4[_0x6f00('0x42')],'outboundRejectCallsDay':_0x1fd3d4[_0x6f00('0x43')],'outboundUnknownCallsDay':_0x1fd3d4[_0x6f00('0x44')],'outboundAbandonedCallsDay':_0x1fd3d4['outboundAbandonedCallsDay'],'predictiveIntervalAnsweredCalls':_0x1fd3d4['predictiveIntervalAnsweredCalls'],'predictiveIntervalAvgHoldtime':_0x1fd3d4['predictiveIntervalAvgHoldtime'],'predictiveIntervalAvgTalktime':_0x1fd3d4['predictiveIntervalAvgTalktime'],'predictiveIntervalDroppedCallsCallersExit':_0x1fd3d4['predictiveIntervalDroppedCallsCallersExit'],'predictiveIntervalDroppedCallsTimeout':_0x1fd3d4['predictiveIntervalDroppedCallsTimeout'],'predictiveIntervalErlangCalls':_0x1fd3d4[_0x6f00('0x45')],'predictiveIntervalErlangCallsDroppedCalls':_0x1fd3d4['predictiveIntervalErlangCallsDroppedCalls'],'predictiveIntervalHitRate':_0x1fd3d4[_0x6f00('0x46')],'predictiveIntervalMultiplicativeFactor':_0x1fd3d4[_0x6f00('0x47')],'predictiveIntervalPauses':_0x1fd3d4[_0x6f00('0x48')],'predictiveIntervalAvailable':_0x1fd3d4[_0x6f00('0x49')],'predictiveIntervalTotalCalls':_0x1fd3d4[_0x6f00('0x4a')],'message':_0x1fd3d4[_0x6f00('0x4b')],'originated':_0x1fd3d4['originated'],'erlangCalls':_0x1fd3d4[_0x6f00('0x4c')],'erlangCallToSecond':_0x1fd3d4[_0x6f00('0x4d')],'erlangAbandonmentRate':_0x1fd3d4[_0x6f00('0x4e')],'erlangBusyFactor':_0x1fd3d4[_0x6f00('0x4f')],'startPredictive':_0x1fd3d4[_0x6f00('0x50')],'startProgressive':_0x1fd3d4['startProgressive']};if(_0x1fd3d4['Trunk']){_0xe301e5['Trunk']={'id':_0x1fd3d4[_0x6f00('0x51')]['id'],'name':_0x1fd3d4[_0x6f00('0x51')][_0x6f00('0x26')],'active':_0x1fd3d4[_0x6f00('0x51')][_0x6f00('0x52')],'callerid':_0x1fd3d4['Trunk'][_0x6f00('0x53')]};}if(_0x1fd3d4[_0x6f00('0x54')]){_0xe301e5[_0x6f00('0x54')]={'id':_0x1fd3d4[_0x6f00('0x54')]['id'],'name':_0x1fd3d4[_0x6f00('0x54')][_0x6f00('0x26')]};}var _0xc9f2b5=md5(JSON['stringify'](_0xe301e5));if(_0x1fd3d4[_0x6f00('0x2')]!==_0xc9f2b5){_0x1fd3d4[_0x6f00('0x2')]=_0xc9f2b5;emit(util[_0x6f00('0x55')]('voice:queue:%s',_0xe301e5[_0x6f00('0x26')]),_0x6f00('0x56'),_0xe301e5);}}}function emitVoiceQueueChannelRemove(_0x2da2e7){logger['info'](_0x6f00('0x57'),JSON['stringify'](_0x2da2e7));emit(util[_0x6f00('0x55')]('voice:queue:%s',_0x2da2e7[_0x6f00('0x26')]),_0x6f00('0x58'),_0x2da2e7);io[_0x6f00('0x24')](_0x6f00('0x59'),_0x2da2e7);}function notSendMessagesQueue(_0x57c13a){if(_0x57c13a[_0x6f00('0x5a')]){if(_0x57c13a['originated']===0x0&&_0x57c13a[_0x6f00('0x2b')]===0x0){_0x57c13a['sendMessageOneNotActive']=![];_0x57c13a[_0x6f00('0x29')]=0x0;_0x57c13a[_0x6f00('0x5b')]=0x0;_0x57c13a[_0x6f00('0x4b')]=_0x6f00('0x5c');ut['logger']('[CampaignPreview]\x20Campaign\x20Queue:\x20',_0x57c13a[_0x6f00('0x26')]+'\x20is\x20not\x20active');}else{_0x57c13a[_0x6f00('0x4b')]=_0x6f00('0x5d');ut['logger'](_0x6f00('0x5e'),_0x57c13a['name']+'\x20is\x20disactive');}emitCampaignPreview(_0x57c13a);}}Preview[_0x6f00('0xc')][_0x6f00('0x23')]=function(){var _0x1a9f4c=this;setInterval(function(){_0x1a9f4c[_0x6f00('0x5f')]();},0x7cf);};Preview['prototype'][_0x6f00('0x5f')]=function(){var _0x4523f2=this[_0x6f00('0x11')];this[_0x6f00('0x15')]+=0x1;for(var _0x2788ad in _0x4523f2){if(_0x4523f2[_0x6f00('0x60')](_0x2788ad)&&(_0x4523f2[_0x2788ad]['dialMethod']===_0x6f00('0x61')||_0x4523f2[_0x2788ad][_0x6f00('0x33')]===_0x6f00('0x62'))&&_0x4523f2[_0x2788ad][_0x6f00('0x25')]===_0x6f00('0x63')){if(this[_0x6f00('0x15')]>0x7){this['clockClearZombieChannels']=0x0;this[_0x6f00('0x64')]();}}if(_0x4523f2[_0x6f00('0x60')](_0x2788ad)&&_0x4523f2[_0x2788ad][_0x6f00('0x33')]==='preview'&&_0x4523f2[_0x2788ad][_0x6f00('0x25')]==='outbound'){if(_0x4523f2[_0x2788ad][_0x6f00('0x32')]){this[_0x6f00('0x65')](_0x4523f2[_0x2788ad]);if(_0x4523f2[_0x2788ad]['dialPreviewAutoRecallMe'])this[_0x6f00('0x66')](_0x4523f2[_0x2788ad]);}else{notSendMessagesQueue(_0x4523f2[_0x2788ad]);}}}};Preview['prototype'][_0x6f00('0x67')]=function(_0x3d4158){var _0x310a27=this;this[_0x6f00('0x10')]['enqueue'](function(){if(!_[_0x6f00('0x68')](_0x310a27['actions'][_0x3d4158])){loggerAction[_0x6f00('0x69')]('[clearZombieChannels][talking]',_0x3d4158,_0x6f00('0x6a'),_0x310a27[_0x6f00('0x6b')][_0x3d4158][_0x6f00('0x6c')],_0x6f00('0x6d'),JSON[_0x6f00('0x6e')](_0x310a27[_0x6f00('0x11')][_0x310a27[_0x6f00('0x6b')][_0x3d4158][_0x6f00('0x6c')]]['originated']),_0x6f00('0x6f'),JSON['stringify'](_0x310a27[_0x6f00('0x11')][_0x310a27[_0x6f00('0x6b')][_0x3d4158][_0x6f00('0x6c')]]['pTalking']),JSON['stringify'](_0x310a27[_0x6f00('0x6b')][_0x3d4158][_0x6f00('0x70')]),JSON['stringify'](_[_0x6f00('0x71')](_0x310a27['actions'][_0x3d4158],[_0x6f00('0x72'),'UserId',_0x6f00('0x73'),_0x6f00('0x74')])));return ami['Action']({'action':'status','channel':_0x310a27[_0x6f00('0x6b')][_0x3d4158][_0x6f00('0x75')]})['catch'](function(_0x1f2f76){if(_0x1f2f76['message']===_0x6f00('0x76')){setTimeout(function(){if(_0x310a27[_0x6f00('0x6b')][_0x3d4158]){ut[_0x6f00('0x77')](_0x310a27[_0x6f00('0x11')][_0x310a27[_0x6f00('0x6b')][_0x3d4158][_0x6f00('0x6c')]],_0x6f00('0x78'));if(_0x310a27[_0x6f00('0x6b')][_0x3d4158][_0x6f00('0x70')]===!![]){ut[_0x6f00('0x79')](_0x310a27[_0x6f00('0x11')][_0x310a27[_0x6f00('0x6b')][_0x3d4158][_0x6f00('0x6c')]],_0x6f00('0x78'));ut[_0x6f00('0x7a')](_0x6f00('0x7b')+_0x3d4158,_0x310a27[_0x6f00('0x6b')][_0x3d4158][_0x6f00('0x6c')]);}ut[_0x6f00('0x7a')](_0x6f00('0x7c')+_0x3d4158,_0x310a27['actions'][_0x3d4158]['queue']);delete _0x310a27[_0x6f00('0x6b')][_0x3d4158];}},0x2328);}});}});};Preview['prototype'][_0x6f00('0x64')]=function(){var _0xd0bf75=this;loggerAction['info'](_0x6f00('0x7d'),_[_0x6f00('0x7e')](this[_0x6f00('0x6b')]));for(var _0x4e2ddb in this[_0x6f00('0x6b')]){if(_0xd0bf75['actions'][_0x6f00('0x60')](_0x4e2ddb)){_0xd0bf75[_0x6f00('0x67')](_0x4e2ddb);}}};Preview['prototype'][_0x6f00('0x66')]=function(_0x28677d){var _0xd2e139=this;rpcDb[_0x6f00('0x7f')](_0x28677d['id'],ut[_0x6f00('0x80')](this[_0x6f00('0x14')]))[_0x6f00('0x81')](function(_0x4a4905){if(!_['isNil'](_0x4a4905)){for(var _0x5bd485=0x0;_0x5bd485<_0x4a4905['length'];_0x5bd485+=0x1){if(ut[_0x6f00('0x82')](_0x4a4905[_0x5bd485][_0x6f00('0x83')])<_0x28677d['dialRecallMeTimeout']*0x3c){if(_0x4a4905[_0x5bd485]['Agent']&&!_0x4a4905[_0x5bd485][_0x6f00('0x84')][_0x6f00('0x85')]){_0xd2e139[_0x6f00('0x86')](_0x4a4905[_0x5bd485]['id'])[_0x6f00('0x81')](ut['logger2'](_0x6f00('0x87')))['catch'](ut['logger2'](_0x6f00('0x87')));}else{rpcDb[_0x6f00('0x88')](_0x4a4905[_0x5bd485]['id']);}}else{var _0x754f94=new Action(_0x4a4905[_0x5bd485],_0x28677d);_0x754f94[_0x6f00('0x89')]=moment()[_0x6f00('0x55')]('YYYY-MM-DD\x20HH:mm:ss');_0x28677d[_0x6f00('0x42')]+=0x1;ut[_0x6f00('0x8a')](_0x754f94,0x17,_0x6f00('0x8b'));if(_0x28677d[_0x6f00('0x8c')]){rpcDb['rescheduleContactInQueue'](ut['createBody'](_0x4a4905[_0x5bd485]));rpcDb[_0x6f00('0x8d')](_0x754f94,'[HistoryDialRecallInQueue][historyCatch]');}else{ut[_0x6f00('0x8a')](_0x754f94,0x16,_0x6f00('0x8e'));rpcDb[_0x6f00('0x8d')](_0x754f94,_0x6f00('0x8f'));rpcDb['createCustomerFinal'](_0x754f94,'[HistoryRecallClose]');}}}}})[_0x6f00('0x90')](ut[_0x6f00('0x91')](_0x6f00('0x92')));};Preview[_0x6f00('0xc')]['setMessage']=function(_0x14554c){_0x14554c[_0x6f00('0x5a')]=!![];if(ut[_0x6f00('0x93')](_0x14554c[_0x6f00('0x2a')])){_0x14554c[_0x6f00('0x4b')]='AGENTS_NOT_LOGGED';}else if(!ut['isActive'](_0x14554c['dialActive'])){_0x14554c[_0x6f00('0x4b')]=_0x6f00('0x5c');}else if(!this['isTrunkReachable'](_0x14554c['Trunk'])){if(!this[_0x6f00('0x94')](_0x14554c[_0x6f00('0x95')])){_0x14554c['message']='TRUNK_IS_NOT_REACHABLE';}else{_0x14554c[_0x6f00('0x4b')]=_0x6f00('0x96');}}else{_0x14554c[_0x6f00('0x4b')]=_0x6f00('0x96');}emitCampaignPreview(_0x14554c);};Preview[_0x6f00('0xc')][_0x6f00('0x97')]=function(_0x303ccc,_0xd5e8e2,_0x5ee0b6){var _0x5b16e6=this;var _0x38471c=this[_0x6f00('0x6b')][_0xd5e8e2];var _0x193bfd=this[_0x6f00('0x11')][_0x38471c[_0x6f00('0x6c')]];var _0xe1ea4e;if(_0x193bfd){switch(_0x5ee0b6){case'1':_0x193bfd[_0x6f00('0x40')]+=0x1;_0x38471c[_0x6f00('0x98')]+=0x1;_0x38471c[_0x6f00('0x99')]=ut[_0x6f00('0x9a')](_0x38471c);ut[_0x6f00('0x8a')](_0x38471c,0x0,_0x6f00('0x9b'));ami[_0x6f00('0x24')](_0x6f00('0x9c'),ut[_0x6f00('0x9d')](_0x38471c,_0x6f00('0x9e')));rpcDb[_0x6f00('0x8d')](_0x38471c,'[callProgressDetectingCustomer][logNoSuch]');if(ut['totalGlobal'](_0x38471c)>=_0x193bfd[_0x6f00('0x9f')]){_0xe1ea4e=ut['cloneAction'](_0x38471c,0xf,_0x6f00('0xa0'));rpcDb[_0x6f00('0xa1')](_0xe1ea4e,_0x6f00('0xa2'));}else{if(_0x38471c[_0x6f00('0x98')]>=_0x193bfd[_0x6f00('0xa3')]){rpcDb['createCustomerFinal'](_0x38471c,_0x6f00('0xa2'));}else{rpcDb[_0x6f00('0xa4')](ut[_0x6f00('0xa5')](_0x38471c,_0x6f00('0x98'),_0x193bfd[_0x6f00('0xa6')]),_0x38471c[_0x6f00('0xa7')],_0x38471c[_0x6f00('0xa8')]);}}delete this[_0x6f00('0x6b')][_0x303ccc[_0x6f00('0xa9')]];break;case _0x6f00('0xaa'):var _0x19b5eb=moment()['format'](_0x6f00('0xab'));_0x38471c[_0x6f00('0xac')]=_0x19b5eb;_0x38471c[_0x6f00('0xad')]=_0x19b5eb;_0x38471c['dialAnswer']=!![];_0x193bfd['pTalking']+=0x1;logger[_0x6f00('0x69')](_0x6f00('0xae'),_0x38471c[_0x6f00('0xaf')],_0x6f00('0xb0'),_0x193bfd['name'],'pTalking:\x20',_0x193bfd['pTalking']);ami['emit'](_0x6f00('0xb1'),ut[_0x6f00('0x9d')](_0x38471c,_0x6f00('0xb2'),this[_0x6f00('0x11')][_0x38471c[_0x6f00('0x6c')]]));if(_0x193bfd['acw']){ami[_0x6f00('0x24')](_0x6f00('0xb3'),ut['buildAcw'](_0x38471c));}break;case'16':ami[_0x6f00('0x24')](_0x6f00('0xb4'),ut[_0x6f00('0x9d')](_0x38471c,_0x6f00('0xb5'),this[_0x6f00('0x11')][_0x38471c[_0x6f00('0x6c')]]));emitVoiceQueueChannelRemove(ut[_0x6f00('0x9d')](_0x38471c,_0x6f00('0xb5')));_0x193bfd['outboundAnswerCallsDay']+=0x1;_0x193bfd[_0x6f00('0x2f')]+=0x1;_0x193bfd['answered']+=0x1;ut[_0x6f00('0x79')](_0x193bfd,_0x6f00('0xb6'));_0x38471c[_0x6f00('0x99')]=ut[_0x6f00('0x9a')](_0x38471c);ut[_0x6f00('0x8a')](_0x38471c,0x4,_0x6f00('0xb7'));rpcDb[_0x6f00('0x8d')](_0x38471c,_0x6f00('0xb8'));rpcDb[_0x6f00('0xa1')](_0x38471c,_0x6f00('0xb9'));rpcDb[_0x6f00('0xba')](_0x38471c);_0x193bfd[_0x6f00('0xbb')]+=_0x38471c[_0x6f00('0xbc')];_0x193bfd[_0x6f00('0x2c')]+=_0x38471c['talktime'];logger[_0x6f00('0x69')](_0x6f00('0xbd'),_0x38471c[_0x6f00('0xaf')],'\x20Queue',_0x193bfd[_0x6f00('0x26')],_0x6f00('0x6f'),_0x193bfd['pTalking']);delete this[_0x6f00('0x6b')][_0x303ccc[_0x6f00('0xa9')]];break;case _0x6f00('0xbe'):_0x193bfd[_0x6f00('0x3a')]+=0x1;_0x38471c['countbusyretry']+=0x1;_0x38471c['countglobal']=ut['totalGlobal'](_0x38471c);ut[_0x6f00('0x8a')](_0x38471c,0x5,_0x6f00('0xbf'));ami[_0x6f00('0x24')](_0x6f00('0xc0'),ut['buildObj'](_0x38471c,_0x6f00('0xc1')));rpcDb[_0x6f00('0x8d')](_0x38471c,_0x6f00('0xc2'));if(ut[_0x6f00('0x9a')](_0x38471c)>=_0x193bfd[_0x6f00('0x9f')]){_0xe1ea4e=ut[_0x6f00('0xc3')](_0x38471c,0xf,'Global');rpcDb['createCustomerFinal'](_0xe1ea4e,_0x6f00('0xc4'));}else{if(_0x38471c[_0x6f00('0xc5')]>=_0x193bfd[_0x6f00('0xc6')]){rpcDb[_0x6f00('0xa1')](_0x38471c,_0x6f00('0xc2'));}else{rpcDb[_0x6f00('0xa4')](ut[_0x6f00('0xa5')](_0x38471c,'countbusyretry',_0x193bfd[_0x6f00('0xc7')]),_0x38471c[_0x6f00('0xa7')],_0x38471c['activeContact']);}}break;case _0x6f00('0xc8'):_0x193bfd[_0x6f00('0x3f')]+=0x1;_0x38471c['countnoanswerretry']+=0x1;_0x38471c['countglobal']=ut[_0x6f00('0x9a')](_0x38471c);ut[_0x6f00('0x8a')](_0x38471c,0x3,_0x6f00('0xc9'));ami[_0x6f00('0x24')](_0x6f00('0xca'),ut[_0x6f00('0x9d')](_0x38471c,_0x6f00('0xcb')));rpcDb['createCustomerHistory'](_0x38471c,_0x6f00('0xcc'));if(ut[_0x6f00('0x9a')](_0x38471c)>=_0x193bfd[_0x6f00('0x9f')]){_0xe1ea4e=ut[_0x6f00('0xc3')](_0x38471c,0xf,_0x6f00('0xa0'));rpcDb[_0x6f00('0xa1')](_0xe1ea4e,_0x6f00('0xcd'));}else{if(_0x38471c[_0x6f00('0xce')]>=_0x193bfd[_0x6f00('0xcf')]){rpcDb[_0x6f00('0xa1')](_0x38471c,_0x6f00('0xcc'));}else{rpcDb[_0x6f00('0xa4')](ut[_0x6f00('0xa5')](_0x38471c,_0x6f00('0xce'),_0x193bfd[_0x6f00('0xd0')]),_0x38471c['unlockAgent'],_0x38471c[_0x6f00('0xa8')]);}}break;case _0x6f00('0xd1'):_0x193bfd[_0x6f00('0x3b')]+=0x1;_0x38471c[_0x6f00('0xd2')]+=0x1;_0x38471c['countglobal']=ut[_0x6f00('0x9a')](_0x38471c);ut[_0x6f00('0x8a')](_0x38471c,0x8,_0x6f00('0xd3'));ami[_0x6f00('0x24')](_0x6f00('0xd4'),ut[_0x6f00('0x9d')](_0x38471c,_0x6f00('0xd5')));rpcDb[_0x6f00('0x8d')](_0x38471c,_0x6f00('0xd6'));if(ut[_0x6f00('0x9a')](_0x38471c)>=_0x193bfd[_0x6f00('0x9f')]){_0xe1ea4e=ut[_0x6f00('0xc3')](_0x38471c,0xf,_0x6f00('0xa0'));rpcDb[_0x6f00('0xa1')](_0xe1ea4e,'[callProgressDetectingCustomer][logCongestionGlobal]');}else{if(_0x38471c[_0x6f00('0xd2')]>=_0x193bfd[_0x6f00('0xd7')]){rpcDb[_0x6f00('0xa1')](_0x38471c,'[callProgressDetectingCustomer][logCongestion]');}else{rpcDb['rescheduleContact'](ut['scheduledAt'](_0x38471c,_0x6f00('0xd2'),_0x193bfd[_0x6f00('0xc7')]),_0x38471c[_0x6f00('0xa7')],_0x38471c[_0x6f00('0xa8')]);}}break;case'CANCEL':_0x193bfd[_0x6f00('0x43')]+=0x1;_0x38471c['countagentrejectretry']+=0x1;_0x38471c['countglobal']=ut[_0x6f00('0x9a')](_0x38471c);ut[_0x6f00('0x8a')](_0x38471c,0x14,_0x6f00('0xd8'));ami[_0x6f00('0x24')](_0x6f00('0xd9'),ut[_0x6f00('0x9d')](_0x38471c,_0x6f00('0xda')));rpcDb[_0x6f00('0x8d')](_0x38471c,_0x6f00('0xdb'));if(ut[_0x6f00('0x9a')](_0x38471c)>=_0x193bfd[_0x6f00('0x9f')]){_0xe1ea4e=ut['cloneAction'](_0x38471c,0x14,_0x6f00('0xd8'));rpcDb[_0x6f00('0xa1')](_0xe1ea4e,_0x6f00('0xdc'));}else{if(_0x38471c['countagentrejectretry']>=_0x193bfd['dialAgentRejectMaxRetry']){rpcDb[_0x6f00('0xa1')](_0x38471c,_0x6f00('0xdc'));}else{rpcDb[_0x6f00('0xa4')](ut[_0x6f00('0xa5')](_0x38471c,_0x6f00('0xdd'),_0x193bfd[_0x6f00('0xde')]),_0x38471c[_0x6f00('0xa7')],_0x38471c[_0x6f00('0xa8')]);}}break;case'ABANDONED':_0x193bfd[_0x6f00('0xdf')]+=0x1;_0x38471c[_0x6f00('0xe0')]+=0x1;_0x38471c[_0x6f00('0x99')]=ut[_0x6f00('0x9a')](_0x38471c);ut[_0x6f00('0x8a')](_0x38471c,0xb,_0x6f00('0xe1'));rpcDb[_0x6f00('0x8d')](_0x38471c,_0x6f00('0xe2'));if(ut[_0x6f00('0x9a')](_0x38471c)>=_0x193bfd[_0x6f00('0x9f')]){_0xe1ea4e=ut[_0x6f00('0xc3')](_0x38471c,0xf,'Global');rpcDb[_0x6f00('0xa1')](_0xe1ea4e,_0x6f00('0xe2'));}else{if(_0x38471c['countabandonedetry']>=_0x193bfd[_0x6f00('0xe3')]){rpcDb[_0x6f00('0xa1')](_0x38471c,_0x6f00('0xe2'));}else{rpcDb['rescheduleContact'](ut[_0x6f00('0xa5')](_0x38471c,_0x6f00('0xe0'),_0x193bfd[_0x6f00('0xe4')]),_0x38471c[_0x6f00('0xa7')],_0x38471c['activeContact']);}}break;case'18':_0x193bfd[_0x6f00('0x44')]+=0x1;_0x38471c[_0x6f00('0xe5')]+=0x1;_0x38471c[_0x6f00('0x99')]=ut[_0x6f00('0x9a')](_0x38471c);ut[_0x6f00('0x8a')](_0x38471c,0x12,_0x303ccc[_0x6f00('0xe6')]||_0x303ccc['dialstatus']);ami[_0x6f00('0x24')](_0x6f00('0xe7'),ut[_0x6f00('0x9d')](_0x38471c,_0x6f00('0xe8')));rpcDb[_0x6f00('0x8d')](_0x38471c,'[callProgressDetectingCustomer][hangupInAMD]');if(ut[_0x6f00('0x9a')](_0x38471c)>=_0x193bfd['dialGlobalMaxRetry']){_0xe1ea4e=ut[_0x6f00('0xc3')](_0x38471c,0xf,_0x6f00('0xa0'));rpcDb[_0x6f00('0xa1')](_0xe1ea4e,_0x6f00('0xe9'));}else{rpcDb['createCustomerFinal'](_0x38471c,_0x6f00('0xe9'));}delete this[_0x6f00('0x6b')][_0x303ccc['linkedid']];break;case'19':_0x193bfd[_0x6f00('0x44')]+=0x1;_0x38471c[_0x6f00('0x99')]=ut['totalGlobal'](_0x38471c);ut[_0x6f00('0x8a')](_0x38471c,0x13,_0x303ccc[_0x6f00('0xe6')]||_0x303ccc[_0x6f00('0xea')]);ami[_0x6f00('0x24')]('custom:amd',ut[_0x6f00('0x9d')](_0x38471c,_0x6f00('0xe8')));rpcDb[_0x6f00('0x8d')](_0x38471c,_0x6f00('0xeb'));if(ut[_0x6f00('0x9a')](_0x38471c)>=_0x193bfd[_0x6f00('0x9f')]){_0xe1ea4e=ut[_0x6f00('0xc3')](_0x38471c,0xf,_0x6f00('0xa0'));rpcDb[_0x6f00('0xa1')](_0xe1ea4e,_0x6f00('0xeb'));}else{rpcDb[_0x6f00('0xa1')](_0x38471c,'[callProgressDetectingCustomer][machine]');}delete this[_0x6f00('0x6b')][_0x303ccc[_0x6f00('0xa9')]];break;default:if(_0x38471c[_0x6f00('0x70')]){ut[_0x6f00('0x79')](_0x193bfd,'[default]');ut[_0x6f00('0x7a')](_0x6f00('0xec')+_0x193bfd['name'],_0x303ccc);}_0x193bfd[_0x6f00('0x44')]+=0x1;_0x38471c['countglobal']=ut[_0x6f00('0x9a')](_0x38471c);ut['logCustomer'](_0x38471c,0xc,_0x303ccc[_0x6f00('0xe6')]||_0x303ccc['dialstatus']);rpcDb[_0x6f00('0x8d')](_0x38471c,_0x6f00('0xed'));if(ut['totalGlobal'](_0x38471c)>=_0x193bfd[_0x6f00('0x9f')]){_0xe1ea4e=ut[_0x6f00('0xc3')](_0x38471c,0xf,'Global');rpcDb[_0x6f00('0xa1')](_0xe1ea4e,_0x6f00('0xee'));}else{rpcDb['createCustomerFinal'](_0x38471c,_0x6f00('0xee'));}delete this[_0x6f00('0x6b')][_0x303ccc[_0x6f00('0xa9')]];}if(!(_0x38471c[_0x6f00('0x70')]&&_0x5ee0b6==='16')){ut['updateOriginated'](_0x193bfd,_0x6f00('0xef'));logger[_0x6f00('0x69')](_0x6f00('0xf0'),_0x38471c['uniqueid'],'\x20Queue',_0x193bfd[_0x6f00('0x26')],_0x6f00('0x6d'),_0x193bfd[_0x6f00('0xf1')]);}if(_0x5ee0b6!==_0x6f00('0xaa')){delete this[_0x6f00('0x6b')][_0x303ccc['linkedid']];delete this[_0x6f00('0x6b')][_0x303ccc[_0x6f00('0xf2')]];}}};Preview['prototype'][_0x6f00('0xf3')]=function(_0x2c00d2,_0x50dd5c,_0x93fbc0){if(_['isUndefined'](_0x50dd5c)&&_0x6f00('0xf4')!==typeof _0x50dd5c){return;}if(_[_0x6f00('0xf5')](_0x93fbc0)&&_0x6f00('0xf4')!==typeof _0x93fbc0){return;}switch(_0x93fbc0[_0x6f00('0xf6')]){case'0':ut[_0x6f00('0xf7')](_0x2c00d2,0x0,_0x6f00('0x9b'));rpcDb[_0x6f00('0xf8')](_0x2c00d2,'[callProgressDetectingAgent][logNoSuch]');break;case'3':ut[_0x6f00('0xf7')](_0x2c00d2,0x3,_0x6f00('0xc9'));rpcDb['createAgentHistory'](_0x2c00d2,_0x6f00('0xf9'));break;case'5':ut[_0x6f00('0xf7')](_0x2c00d2,0x5,_0x6f00('0xbf'));rpcDb[_0x6f00('0xf8')](_0x2c00d2,_0x6f00('0xfa'));break;case'8':ut[_0x6f00('0xf7')](_0x2c00d2,0x8,_0x6f00('0xd3'));rpcDb[_0x6f00('0xf8')](_0x2c00d2,'[callProgressDetectingAgent][logCongestion]');break;case'22':ut[_0x6f00('0xf7')](_0x2c00d2,0x16,'AnswerAGI');rpcDb[_0x6f00('0xf8')](_0x2c00d2,'[callProgressDetectingAgent][logAnswerAGI]');break;default:ut[_0x6f00('0xf7')](_0x2c00d2,0xc,_0x93fbc0[_0x6f00('0xf6')]);rpcDb[_0x6f00('0xf8')](_0x2c00d2,_0x6f00('0xfb'));}ut[_0x6f00('0x77')](_0x50dd5c,_0x6f00('0xfc'));logger[_0x6f00('0x69')](_0x6f00('0xfd'),_0x2c00d2[_0x6f00('0xaf')],_0x6f00('0xb0'),_0x50dd5c[_0x6f00('0x26')],'originated:\x20',_0x50dd5c[_0x6f00('0xf1')]);delete this[_0x6f00('0x6b')][_0x2c00d2[_0x6f00('0xaf')]];};Preview[_0x6f00('0xc')][_0x6f00('0xfe')]=function(_0x49046f,_0x2f9c08,_0x19deb7,_0x893058,_0x5ad14c){var _0x483178=this;return new BPromise(function(_0x1ea084,_0x326127){if(_['isNil'](_0x2f9c08)||_[_0x6f00('0x68')](_0x2f9c08[_0x6f00('0xff')])||_['isNil'](_0x2f9c08[_0x6f00('0xff')][_0x6f00('0x100')])||_[_0x6f00('0x68')](_0x2f9c08[_0x6f00('0x73')])){_0x326127(ut[_0x6f00('0x4b')](_0x6f00('0x101'),_0x893058,_0x5ad14c));return;}var _0xf69c5a=uuid['v4']();var _0x25bac8=_0x483178[_0x6f00('0x11')][_0x2f9c08[_0x6f00('0x6a')][_0x6f00('0x26')]];var _0xfd9dcb=_0x19deb7?_0x483178['agents'][_0x19deb7]['id']:undefined;_0x483178[_0x6f00('0x6b')][_0xf69c5a]=new Action(_0x2f9c08,_0x25bac8,_0xf69c5a,_0x19deb7,_0xfd9dcb);var _0x2c6131=_0x483178['actions'][_0xf69c5a];_0x2c6131[_0x6f00('0xa7')]=_0x893058;_0x2c6131[_0x6f00('0xa8')]=_0x5ad14c;_0x2c6131[_0x6f00('0x102')]=_0x19deb7;if(_['isEmpty'](_0x49046f)){_0x483178[_0x6f00('0x103')](_0x2c6131,_0x25bac8,_0x2f9c08,_0x19deb7)[_0x6f00('0x81')](function(_0x56477a){logger[_0x6f00('0x69')]('[Preview][execCall][success]','Queue:\x20'+_0x2c6131[_0x6f00('0x6c')]+'\x20IdHopper:\x20'+_0x2c6131[_0x6f00('0x104')],JSON[_0x6f00('0x6e')](_0x56477a));ami[_0x6f00('0x24')](_0x6f00('0x105'),ut['buildObj'](_0x2c6131,_0x6f00('0x106'),_0x483178['campaignsPreview'][_0x2c6131['queue']]));_0x1ea084(ut[_0x6f00('0x4b')](_0x6f00('0x107')));})[_0x6f00('0x90')](function(_0x4d08da){ut[_0x6f00('0x108')]('[Preview][execCall][failure]',_0x4d08da);_0x326127(ut[_0x6f00('0x4b')]('Call\x20failed',_0x893058,_0x5ad14c));});}else{_0x25bac8[_0x6f00('0x39')]+=0x1;ut[_0x6f00('0x109')](_0x2c6131);rpcDb[_0x6f00('0x10a')](_0x2c6131,'[Blacklist][error]');delete _0x483178['actions'][_0xf69c5a];_0x326127(ut[_0x6f00('0x4b')]('Contact\x20in\x20black\x20List',_0x893058,_0x5ad14c));}});};Preview[_0x6f00('0xc')][_0x6f00('0x94')]=function(_0x2dcf25){return!_[_0x6f00('0x68')](_0x2dcf25)&&!_[_0x6f00('0x68')](_0x2dcf25[_0x6f00('0x26')])&&!_[_0x6f00('0x68')](_0x2dcf25['active'])&&_0x2dcf25['active']&&!_[_0x6f00('0x68')](this[_0x6f00('0x13')][util[_0x6f00('0x55')](_0x6f00('0x10b'),_0x2dcf25['name'])])&&!_[_0x6f00('0x68')](this[_0x6f00('0x13')][util['format'](_0x6f00('0x10b'),_0x2dcf25['name'])][_0x6f00('0x10c')])&&(this[_0x6f00('0x13')][util[_0x6f00('0x55')]('SIP/%s',_0x2dcf25[_0x6f00('0x26')])][_0x6f00('0x10c')]===_0x6f00('0x10d')||this[_0x6f00('0x13')][util['format'](_0x6f00('0x10b'),_0x2dcf25[_0x6f00('0x26')])]['status']===_0x6f00('0x10e'));};Preview['prototype'][_0x6f00('0x86')]=function(_0x4a0183,_0xd401c7){var _0x41c338=this;return new BPromise(function(_0x4a997e,_0x6b8782){_0x41c338[_0x6f00('0x10f')](_0x4a0183,_0xd401c7)[_0x6f00('0x81')](function(_0x4a89c8){_0x4a997e(_['pick'](_0x4a89c8,[_0x6f00('0x4b')]));})[_0x6f00('0x90')](function(_0x176863){if(_0x176863[_0x6f00('0x110')]){rpcDb[_0x6f00('0x111')](_0x4a0183);}if(_0x176863[_0x6f00('0x52')]){rpcDb['disableContact'](_0x4a0183);}_0x6b8782(_[_0x6f00('0x71')](_0x176863,['message']));});});};Preview[_0x6f00('0xc')][_0x6f00('0x10f')]=function(_0x319eea,_0x21afbe){var _0x3b2071=this;return new BPromise(function(_0x4ae8d2,_0x59f2b3){var _0x33f67d,_0x244034;rpcDb['getContactPreview'](_0x319eea)[_0x6f00('0x81')](function(_0x28ad96){if(!_['isNil'](_0x28ad96[0x0])){_0x244034=_0x28ad96[0x0][_0x6f00('0x112')]?![]:!![];_0x33f67d=_0x28ad96[0x0]['recallme']?!![]:![];_0x33f67d=_0x21afbe?!![]:_0x33f67d;}var _0x383d69=_0x3b2071[_0x6f00('0x113')](_0x28ad96);if(_0x383d69[_0x6f00('0x114')]){rpcDb['checkIsBlackList'](_['pick'](_0x28ad96[0x0],[_0x6f00('0x73'),'Contact.phone']))['then'](function(_0x10ac9c){_0x3b2071[_0x6f00('0xfe')](_0x10ac9c,_0x28ad96[0x0],_0x21afbe,_0x244034,_0x33f67d)['then'](function(_0x34023c){_0x4ae8d2(_0x34023c);})[_0x6f00('0x90')](function(_0x5d7859){_0x59f2b3(_0x5d7859);});})['catch'](function(_0x360f44){ut['logger'](_0x6f00('0x115'),_0x360f44);_0x59f2b3(ut[_0x6f00('0x4b')](_0x6f00('0x116'),_0x244034,_0x33f67d));});}else{_0x59f2b3(ut[_0x6f00('0x4b')](_0x383d69[_0x6f00('0x4b')],_0x244034,_0x33f67d));}})[_0x6f00('0x90')](function(_0x4c810b){ut['logger'](_0x6f00('0x117'),_0x4c810b);_0x59f2b3(ut[_0x6f00('0x4b')]('Call\x20unsuccessful',![],!![]));});});};Preview[_0x6f00('0xc')][_0x6f00('0x113')]=function(_0x1846a4){if(_[_0x6f00('0x68')](_0x1846a4)||_[_0x6f00('0x118')](_0x1846a4)||!_[_0x6f00('0x68')](_0x1846a4[0x0][_0x6f00('0x84')])&&_[_0x6f00('0x68')](_0x1846a4[0x0]['Agent'][_0x6f00('0x26')])){ut[_0x6f00('0x108')]('[Preview][validateContact][Empty\x20Contact]',_0x1846a4);return{'isValid':![],'message':_0x6f00('0x119')};}var _0x1fef89=this[_0x6f00('0x11')][_0x1846a4[0x0][_0x6f00('0x6a')][_0x6f00('0x26')]];_0x1fef89[_0x6f00('0x4b')]=_0x6f00('0x96');if(_[_0x6f00('0x68')](_0x1fef89)){ut[_0x6f00('0x108')]('[Preview][validateContact][Empty\x20Campaign]',_0x1fef89);return{'isValid':![],'message':_0x6f00('0x11a')};}if(!this[_0x6f00('0x94')](_0x1fef89['Trunk'])){ut[_0x6f00('0x108')](_0x6f00('0x11b'),_0x6f00('0x11c')+_0x1fef89[_0x6f00('0x26')]+_0x6f00('0x11d'));if(!this[_0x6f00('0x94')](_0x1fef89[_0x6f00('0x95')])){ut[_0x6f00('0x108')](_0x6f00('0x11b'),_0x1fef89[_0x6f00('0x26')]+_0x6f00('0x11e'));return{'isValid':![],'message':_0x6f00('0x11f')};}}if(!ut[_0x6f00('0x120')](_0x1fef89[_0x6f00('0x32')])){ut['logger']('[Preview][validateContact][Campaign\x20Active]',_0x1fef89[_0x6f00('0x26')]+_0x6f00('0x121'));return{'isValid':![],'message':_0x6f00('0x11c')+_0x1fef89['name']+_0x6f00('0x121')};}return{'isValid':!![],'message':'Is\x20Valid'};};Preview[_0x6f00('0xc')][_0x6f00('0x103')]=function(_0x482aef,_0x143a93,_0x4cb850,_0x580f15){var _0x294a63=this;return new BPromise(function(_0x49a8ce,_0x4fc25e){var _0x3e0831=_0x482aef[_0x6f00('0xaf')];var _0x3b46e5=_0x294a63[_0x6f00('0x94')](_0x143a93['Trunk'])?util[_0x6f00('0x55')]('SIP/%s/%s%s',_0x143a93[_0x6f00('0x51')]['name'],_[_0x6f00('0x68')](_0x143a93[_0x6f00('0x122')])?'':_0x143a93[_0x6f00('0x122')][_0x6f00('0x123')]()||'',_0x143a93['dialCutDigit']>0x0?_0x4cb850[_0x6f00('0xff')]['phone']['substring'](_0x143a93[_0x6f00('0x124')]):_0x4cb850[_0x6f00('0xff')][_0x6f00('0x100')]):util['format'](_0x6f00('0x125'),_[_0x6f00('0x68')](_0x143a93[_0x6f00('0x95')])?_0x143a93[_0x6f00('0x51')][_0x6f00('0x26')]:_0x143a93[_0x6f00('0x95')]['name'],_[_0x6f00('0x68')](_0x143a93[_0x6f00('0x122')])?'':_0x143a93['dialPrefix']['trim']()||'',_0x143a93['dialCutDigit']>0x0?_0x4cb850[_0x6f00('0xff')][_0x6f00('0x100')][_0x6f00('0x126')](_0x143a93[_0x6f00('0x124')]):_0x4cb850['Contact'][_0x6f00('0x100')]);var _0x14ba05=_0x294a63[_0x6f00('0x94')](_0x143a93[_0x6f00('0x51')])?ut[_0x6f00('0x127')](_0x143a93['Trunk'][_0x6f00('0x53')],_0x143a93[_0x6f00('0x34')],_0x143a93['dialRandomLastDigitCallerIdNumber']>0x0?ut['getCallerIdRandom'](_0x143a93['dialOriginateCallerIdNumber'],_0x143a93[_0x6f00('0x128')]):_0x143a93['dialOriginateCallerIdNumber']):ut['getCallerId'](_[_0x6f00('0x68')](_0x143a93[_0x6f00('0x95')])?_0x143a93[_0x6f00('0x51')][_0x6f00('0x53')]:_0x143a93[_0x6f00('0x95')][_0x6f00('0x53')],_0x143a93[_0x6f00('0x34')],_0x143a93['dialRandomLastDigitCallerIdNumber']>0x0?ut['getCallerIdRandom'](_0x143a93[_0x6f00('0x35')],_0x143a93[_0x6f00('0x128')]):_0x143a93[_0x6f00('0x35')]);if(_0x14ba05){_0x482aef[_0x6f00('0x129')]=ut['extractCalleridName'](_0x14ba05);_0x482aef['originatecalleridnum']=ut['extractCalleridNumber'](_0x14ba05);}var _0x17e8c3=ut['addVariables'](_0x143a93,_0x4cb850,_0x3b46e5,_0x14ba05,_0x3e0831,_0x482aef);_[_0x6f00('0x12a')](_0x482aef,ut[_0x6f00('0x12b')](_0x17e8c3));_0x482aef[_0x6f00('0x89')]=moment()[_0x6f00('0x55')](_0x6f00('0xab'));ami[_0x6f00('0x12c')](ut[_0x6f00('0x12d')](_0x482aef,_0x143a93,_0x17e8c3,_0x482aef[_0x6f00('0xa8')],_0x580f15))[_0x6f00('0x81')](function(_0x1b5d91){_0x143a93[_0x6f00('0xf1')]+=0x1;logger[_0x6f00('0x69')](_0x6f00('0x12e'),_0x3e0831,_0x6f00('0xb0'),_0x143a93[_0x6f00('0x26')],'originated:\x20',_0x143a93[_0x6f00('0xf1')]);_0x49a8ce(_0x1b5d91);})['catch'](function(_0x3845fe){ut[_0x6f00('0xf7')](_0x482aef,0xe,_0x6f00('0x12f'));rpcDb['createAgentHistory'](_0x482aef,'[originateFailure][logOriginateFailure]');_0x4fc25e(_0x3845fe);});});};Preview[_0x6f00('0xc')][_0x6f00('0x130')]=function(_0x47ca93){if(this[_0x6f00('0x6b')][_0x47ca93[_0x6f00('0xa9')]]){this[_0x6f00('0x6b')][_0x47ca93[_0x6f00('0xa9')]][_0x6f00('0x75')]=_0x47ca93[_0x6f00('0x75')];}};Preview[_0x6f00('0xc')][_0x6f00('0x16')]=function(_0x787be0){var _0x1c52dc=this;var _0x171a96=this['actions'][_0x787be0[_0x6f00('0x131')]];if(_0x171a96){if(_0x171a96['lookAgent']&&this[_0x6f00('0x14')][_0x171a96[_0x6f00('0x102')]]){ut[_0x6f00('0x132')](_0x171a96,this['agents'][_0x171a96[_0x6f00('0x102')]][_0x6f00('0x26')],this[_0x6f00('0x14')][_0x171a96[_0x6f00('0x102')]]['id']);}var _0x7b672e=_[_0x6f00('0x133')](_0x171a96);_0x7b672e[_0x6f00('0xac')]=moment()[_0x6f00('0x55')]('YYYY-MM-DD\x20HH:mm:ss');var _0x12f90c=_0x1c52dc['campaignsPreview'][_0x171a96['queue']];if(ut[_0x6f00('0x134')](_0x787be0[_0x6f00('0x135')])){if(_0x171a96[_0x6f00('0xa7')]){rpcDb[_0x6f00('0x111')](_0x171a96[_0x6f00('0x104')]);}if(_0x171a96['activeContact']){rpcDb[_0x6f00('0x88')](_0x171a96['idContact']);}ami[_0x6f00('0x24')](_0x6f00('0x136'),ut[_0x6f00('0x9d')](_0x171a96,_0x6f00('0x137'),this['campaignsPreview'][_0x171a96[_0x6f00('0x6c')]]));this['callProgressDetectingAgent'](_0x7b672e,_0x12f90c,_0x787be0);}else{_0x171a96[_0x6f00('0x89')]=moment()[_0x6f00('0x55')]('YYYY-MM-DD\x20HH:mm:ss');ut[_0x6f00('0xf7')](_0x7b672e,0x4,_0x6f00('0xb7'));rpcDb['createAgentHistory'](_0x7b672e,'[callProgressDetectingAgent][logAnswer]');}}};Preview[_0x6f00('0xc')][_0x6f00('0x19')]=function(_0x4608bf){var _0x4aebd8=this;var _0xd0b930=this[_0x6f00('0x6b')][_0x4608bf['linkedid']];var _0x178680;if(_0xd0b930){_0x178680=this[_0x6f00('0x11')][_0xd0b930['queue']];logger[_0x6f00('0x69')](_0x6f00('0x138'),_0x4608bf['linkedid'],'\x20Queue',_0x178680[_0x6f00('0x26')],_0x6f00('0x6f'),_0x178680[_0x6f00('0x2b')]);}if(this[_0x6f00('0x6b')][_0x4608bf['linkedid']]&&_0x4608bf['linkedid']!==_0x4608bf['uniqueid']){if(_0x4608bf[_0x6f00('0x139')]==='16'&&this[_0x6f00('0x6b')][_0x4608bf['linkedid']][_0x6f00('0x70')]){this[_0x6f00('0x97')](_0x4608bf,_0x4608bf[_0x6f00('0xa9')],_0x4608bf[_0x6f00('0x139')]);}else if(this[_0x6f00('0x6b')][_0x4608bf['linkedid']]['dialAnswer']){logger[_0x6f00('0x69')]('[syncHangup][talking][cause]',_0x4608bf['linkedid'],_0x4608bf[_0x6f00('0x139')],_0x6f00('0xb0'),_0x178680[_0x6f00('0x26')],'pTalking:\x20',_0x178680[_0x6f00('0x2b')]);this[_0x6f00('0x97')](_0x4608bf,_0x4608bf[_0x6f00('0xa9')],_0x4608bf[_0x6f00('0x139')]);}}else if(_0xd0b930&&_[_0x6f00('0x68')](_0xd0b930[_0x6f00('0x13a')])&&_0x178680[_0x6f00('0x13b')]&&_0x4608bf[_0x6f00('0xa9')]===_0x4608bf[_0x6f00('0xaf')]&&_['isNil'](_0x4608bf[_0x6f00('0xf6')])&&_0x4608bf['cause']==='16'&&_0x4608bf['channelstate']==='6'&&_[_0x6f00('0xf5')](_0xd0b930['transfer'])){if(_0xd0b930['unlockAgent']){rpcDb[_0x6f00('0x111')](_0xd0b930[_0x6f00('0x104')]);}if(_0xd0b930[_0x6f00('0xa8')]){rpcDb['disableContact'](_0xd0b930[_0x6f00('0x104')]);}_0x4608bf[_0x6f00('0xf6')]='22';this['callProgressDetectingAgent'](_0xd0b930,_0x178680,_0x4608bf);}else if(_0xd0b930&&_0xd0b930['transfer']){if(_0x4608bf['cause']==='16'&&this[_0x6f00('0x6b')][_0x4608bf[_0x6f00('0xa9')]][_0x6f00('0x70')]){logger[_0x6f00('0x69')](_0x6f00('0x13c'),_0x4608bf['linkedid'],_0x4608bf[_0x6f00('0x139')],_0x6f00('0xb0'),_0x178680[_0x6f00('0x26')],_0x6f00('0x6f'),_0x178680[_0x6f00('0x2b')]);this[_0x6f00('0x97')](_0x4608bf,_0x4608bf[_0x6f00('0xa9')],_0x4608bf[_0x6f00('0x139')]);}else if(this[_0x6f00('0x6b')][_0x4608bf['linkedid']][_0x6f00('0x70')]){logger[_0x6f00('0x69')](_0x6f00('0x13d'),_0x4608bf[_0x6f00('0xa9')],_0x4608bf[_0x6f00('0x139')],_0x6f00('0xb0'),_0x178680[_0x6f00('0x26')],_0x6f00('0x6f'),_0x178680[_0x6f00('0x2b')]);this[_0x6f00('0x97')](_0x4608bf,_0x4608bf[_0x6f00('0xa9')],_0x4608bf[_0x6f00('0x139')]);}}};Preview[_0x6f00('0xc')][_0x6f00('0x13e')]=function(_0x134816){if(this[_0x6f00('0x6b')][_0x134816[_0x6f00('0xf2')]]&&_0x134816[_0x6f00('0xf2')]!==_0x134816[_0x6f00('0x13f')]){this[_0x6f00('0x97')](_0x134816,_0x134816[_0x6f00('0xf2')],_0x134816[_0x6f00('0xea')]);}};Preview[_0x6f00('0xc')][_0x6f00('0x1b')]=function(_0xae8f2){if(this['actions'][_0xae8f2['linkedid']]&&_0xae8f2['linkedid']!==_0xae8f2[_0x6f00('0xaf')]&&!this['actions'][_0xae8f2[_0x6f00('0xa9')]][_0x6f00('0x70')]){if(_0xae8f2['cause']==='1'){this['callProgressDetectingCustomer'](_0xae8f2,_0xae8f2[_0x6f00('0xa9')],_0xae8f2[_0x6f00('0x139')]);}}};Preview['prototype']['addVariable']=function(_0x28ff25,_0x118589,_0x357318){if(this[_0x6f00('0x6b')][_0x28ff25]){if(_[_0x6f00('0x68')](this['actions'][_0x28ff25][_0x6f00('0x140')])){this[_0x6f00('0x6b')][_0x28ff25][_0x6f00('0x140')]={};}this[_0x6f00('0x6b')][_0x28ff25][_0x6f00('0x140')][_0x118589]=_0x357318;}};Preview[_0x6f00('0xc')][_0x6f00('0x1e')]=function(_0x933e4){try{if(!_[_0x6f00('0x68')](_0x933e4)){if(ut[_0x6f00('0x141')](_[_0x6f00('0x142')](_0x933e4[_0x6f00('0x143')])[0x0])){this[_0x6f00('0x144')](_0x933e4['uniqueid'],_['keys'](_0x933e4['variable'])[0x0],_0x933e4[_0x6f00('0x145')]);}}}catch(_0x15bcd1){logger[_0x6f00('0x146')](_0x6f00('0x147'),util['inspect'](_0x15bcd1,{'showHidden':![],'depth':null}));}};Preview[_0x6f00('0xc')][_0x6f00('0x20')]=function(_0x5e468c){if(_0x5e468c){if(this[_0x6f00('0x6b')][_0x5e468c[_0x6f00('0x148')]]){this[_0x6f00('0x6b')][_0x5e468c[_0x6f00('0x148')]]['transfer']=!![];}}};Preview['prototype'][_0x6f00('0x22')]=function(_0x3e5e75){if(_0x3e5e75){if(this[_0x6f00('0x6b')][_0x3e5e75[_0x6f00('0x149')]]){this[_0x6f00('0x6b')][_0x3e5e75['transfererlinkedid']][_0x6f00('0x14a')]=!![];}}};module[_0x6f00('0x14b')]=Preview; \ No newline at end of file +var _0xe0ae=['activeContact','linkedid','ANSWER','answertime','uniqueid','\x20Queue','connect','acw','custom:agentConnectPreview','buildAcw','custom:agentcomplete','complete','[16]','[callProgressDetectingCustomer][logAnswerGlobal]','talktime','[syncHangup][talking][decrement]','BUSY','countbusyretry','Busy','busy','[callProgressDetectingCustomer][logBusy]','[callProgressDetectingCustomer][logBusyGlobal]','dialBusyMaxRetry','dialBusyRetryFrequency','unlockAgent','NOANSWER','countnoanswerretry','NoAnswer','custom:agentnoanswer','noanswer','dialNoAnswerMaxRetry','[callProgressDetectingCustomer][logNoAnswer]','dialNoAnswerRetryFrequency','CONGESTION','countcongestionretry','Congestion','custom:agentcongestion','congestion','cloneAction','[callProgressDetectingCustomer][logCongestionGlobal]','dialCongestionMaxRetry','[callProgressDetectingCustomer][logCongestion]','CANCEL','countagentrejectretry','AgentReject','custom:agentreject','[syncHangupRequest][logAgentReject]','dialAgentRejectMaxRetry','[callProgressDetectingCustomer][logAgentReject]','dialAgentRejectRetryFrequency','ABANDONED','Abandoned','[callProgressDetectingCustomer][logAbandoned]','countabandonedetry','dialAbandonedMaxRety','countabandonedretry','countmachineretry','cause-txt','dialstatus','amd','[callProgressDetectingCustomer][hangupInAMD]','custom:amd','[callProgressDetectingCustomer][machine]','[Dialer][decrementTalkink][no\x20Hangup][Preview]','[callProgressDetectingCustomer][logUnknown]','[callProgressDetectingCustomer][logUnknownGlobal]','[originated][decrement][callProgressDetectingCustomer]','originated:\x20','callProgressDetectingAgent','object','isUndefined','logAgent','createAgentHistory','[callProgressDetectingAgent][logBusy]','[callProgressDetectingAgent][logCongestion]','AnswerAGI','[callProgressDetectingAgent][logAnswerAGI]','[callProgressDetectingAgent]','checkInBlack','Contact','phone','lookAgent','isEmpty','execCall','[Preview][execCall][success]','Queue:\x20','\x20IdHopper:\x20','idContact','custom:agentcalled','called','Calling','[Preview][execCall][failure]','Call\x20failed','logBlacklist','Contact\x20in\x20black\x20List','SIP/%s','reachable','unmonitored','execRun','unlock','unlockContact','recallme','validateContact','isValid','checkIsBlackList','Contact.phone','[Preview][checkIsBlackList]','Call\x20unsuccessful','[Preview][getContactPreview]','Empty\x20Contact','[Preview][validateContact][Empty\x20Campaign]','[Preview][validateContact][Trunk\x20not\x20work]','campaign\x20Name:\x20','\x20Trunk\x20is\x20not\x20active','Trunk\x20not\x20work','isActive','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','Is\x20Valid','SIP/%s/%s%s','trim','dialCutDigit','substring','callerid','getCallerIdRandom','getCallerId','dialRandomLastDigitCallerIdNumber','originatecalleridname','originatecalleridnum','extractCalleridNumber','addVariables','variablesAction','[originated][increment]','OriginateError','[originateFailure][logOriginateFailure]','syncNewExten','actionid','logLookAgent','clone','responsetime','custom:agentringnoanswer','rejected','[callProgressDetectingAgent][logAnswer]','[syncHangup][talking]','cause','[syncHangup][talking][cause]','statedesc','transfer','disableContact','[syncHangup][talking][transfer]','destlinkedid','variables','filterKey','keys','variable','value','error','[syncVarSet][Preview]','transfertargetlinkedid','transfererlinkedid','exports','bluebird','uuid','md5','../../../config/environment','../../../config/logger','./rpcDb','./action','./util/util','redis','prototype','enqueue','tail','finally','sequence','campaignsPreview','trunks','actions','agents','originateresponse','syncOriginateResponse','bind','hangup','syncHangup','hanguprequest','syncHangupRequest','dialend','syncDialEnd','newexten','varset','syncVarSet','attendedtransfer','syncAttendedTransfer','blindtransfer','loopCampaigns','emit','type','outbound','name','answered','available','loggedIn','pTalking','sumDuration','sumHoldTime','talking','total','waiting','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','outboundAbandonedCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalHitRate','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','message','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','startPredictive','startProgressive','Trunk','active','Interval','stringify','format','voice:queue:%s','voice_queue:save','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','voice_queue_presence:remove','sendMessageOneNotActive','paused','NOT_ACTIVE','logger','[CampaignPreview]\x20Campaign\x20Queue:\x20','IS_DISACTIVED','\x20is\x20disactive','syncCampaigns','clockClearZombieChannels','hasOwnProperty','preview','booked','clearZombieChannels','clearZombieChannel','[clearZombieChannels][talking]','Queue','queue','pTalking:\x20','dialAnswer','pick','contactId','UserId','VoiceQueueId','ListId','status','channel','catch','No\x20such\x20channel','updateOriginated','[clearZombieChannel]','decrementTalkink','loggerError','[Dialer][checkChannel][pTalking][Preview]','[Dialer][checkChannel][Preview]','info','[action]','size','getContactRecallMe','agentReadyId','then','isNil','length','getDiff','scheduledat','dialRecallMeTimeout','Agent','voicePause','run','logger2','[RecallMe]','starttime','YYYY-MM-DD\x20HH:mm:ss','logCustomer','createBody','createCustomerHistory','[HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','[HistoryRecallClose]','createCustomerFinal','setMessage','IsNotLoggedIn','AGENTS_NOT_LOGGED','dialActive','isTrunkReachable','TrunkBackup','ACTIVE','callProgressDetectingCustomer','outboundNoSuchCallsDay','countnosuchnumberretry','countglobal','totalGlobal','NoSuchNumber','custom:agentnosuchnumber','buildObj','nosuchnumber','[callProgressDetectingCustomer][logNoSuch]','dialGlobalMaxRetry','Global','dialNoSuchNumberMaxRetry','[callProgressDetectingCustomer][logNoSuchGlobal]','rescheduleContact','scheduledAt','dialNoSuchNumberRetryFrequency'];(function(_0x380b14,_0x5ef1b6){var _0x2d3de8=function(_0x43303e){while(--_0x43303e){_0x380b14['push'](_0x380b14['shift']());}};_0x2d3de8(++_0x5ef1b6);}(_0xe0ae,0xa1));var _0xee0a=function(_0xd0a847,_0x72562b){_0xd0a847=_0xd0a847-0x0;var _0x2536ec=_0xe0ae[_0xd0a847];return _0x2536ec;};'use strict';var util=require('util');var _=require('lodash');var BPromise=require(_0xee0a('0x0'));var uuid=require(_0xee0a('0x1'));var moment=require('moment');var md5=require(_0xee0a('0x2'));var Redis=require('ioredis');var config=require(_0xee0a('0x3'));var logger=require(_0xee0a('0x4'))('preview');var loggerAction=require(_0xee0a('0x4'))('actionPreview');var ami=require('../ami');var rpcDb=require(_0xee0a('0x5'));var Action=require(_0xee0a('0x6'));var ut=require(_0xee0a('0x7'));config[_0xee0a('0x8')]=_['defaults'](config[_0xee0a('0x8')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xee0a('0x8')]));var Sequence=function(){};Sequence[_0xee0a('0x9')][_0xee0a('0xa')]=function(_0x57d190){this[_0xee0a('0xb')]=this[_0xee0a('0xb')]?this['tail'][_0xee0a('0xc')](_0x57d190):_0x57d190();};function Preview(_0x4b3e49){this[_0xee0a('0xd')]=new Sequence();this[_0xee0a('0xe')]=_0x4b3e49['voiceQueues'];this[_0xee0a('0xf')]=_0x4b3e49['trunks'];this[_0xee0a('0x10')]={};this[_0xee0a('0x11')]=_0x4b3e49['agents'];this['clockClearZombieChannels']=0x0;ami['on'](_0xee0a('0x12'),this[_0xee0a('0x13')][_0xee0a('0x14')](this));ami['on'](_0xee0a('0x15'),this[_0xee0a('0x16')]['bind'](this));ami['on'](_0xee0a('0x17'),this[_0xee0a('0x18')]['bind'](this));ami['on'](_0xee0a('0x19'),this[_0xee0a('0x1a')][_0xee0a('0x14')](this));ami['on'](_0xee0a('0x1b'),this['syncNewExten'][_0xee0a('0x14')](this));ami['on'](_0xee0a('0x1c'),this[_0xee0a('0x1d')]['bind'](this));ami['on'](_0xee0a('0x1e'),this[_0xee0a('0x1f')][_0xee0a('0x14')](this));ami['on'](_0xee0a('0x20'),this['syncBlindTransfer'][_0xee0a('0x14')](this));this[_0xee0a('0x21')](this[_0xee0a('0xe')]);}function emit(_0x201d32,_0x5c981e,_0x2abfbd){io['to'](_0x201d32)[_0xee0a('0x22')](_0x5c981e,_0x2abfbd);}function emitCampaignPreview(_0x31e98a){if(_0x31e98a[_0xee0a('0x23')]===_0xee0a('0x24')){var _0x1eb176={'id':_0x31e98a['id'],'name':_0x31e98a[_0xee0a('0x25')],'strategy':_0x31e98a['strategy'],'answered':_0x31e98a[_0xee0a('0x26')],'available':_0x31e98a[_0xee0a('0x27')],'loggedIn':_0x31e98a[_0xee0a('0x28')],'pTalking':_0x31e98a[_0xee0a('0x29')],'sumBillable':_0x31e98a['sumBillable'],'sumDuration':_0x31e98a[_0xee0a('0x2a')],'sumHoldTime':_0x31e98a[_0xee0a('0x2b')]||0x0,'talking':_0x31e98a[_0xee0a('0x2c')],'total':_0x31e98a[_0xee0a('0x2d')],'type':_0x31e98a['type'],'unmanaged':_0x31e98a['unmanaged'],'abandoned':_0x31e98a['abandoned'],'waiting':_0x31e98a[_0xee0a('0x2e')],'loggedInDb':_0x31e98a['loggedInDb'],'dialActive':_0x31e98a['dialActive'],'dialMethod':_0x31e98a[_0xee0a('0x2f')],'dialOriginateCallerIdName':_0x31e98a[_0xee0a('0x30')],'dialOriginateCallerIdNumber':_0x31e98a[_0xee0a('0x31')],'dialOriginateTimeout':_0x31e98a['dialOriginateTimeout'],'dialPrefix':_0x31e98a[_0xee0a('0x32')],'outboundAnswerAgiCallsDay':_0x31e98a[_0xee0a('0x33')],'outboundAnswerCallsDay':_0x31e98a[_0xee0a('0x34')],'outboundBlacklistCallsDay':_0x31e98a[_0xee0a('0x35')],'outboundBusyCallsDay':_0x31e98a[_0xee0a('0x36')],'outboundCongestionCallsDay':_0x31e98a[_0xee0a('0x37')],'outboundDropCallsDayACS':_0x31e98a[_0xee0a('0x38')],'outboundDropCallsDayCallersExit':_0x31e98a[_0xee0a('0x39')],'outboundDropCallsDayTimeout':_0x31e98a[_0xee0a('0x3a')],'outboundNoAnswerCallsDay':_0x31e98a[_0xee0a('0x3b')],'outboundNoSuchCallsDay':_0x31e98a['outboundNoSuchCallsDay'],'outboundOriginateFailureCallsDay':_0x31e98a[_0xee0a('0x3c')],'outboundReCallsDay':_0x31e98a[_0xee0a('0x3d')],'outboundRejectCallsDay':_0x31e98a[_0xee0a('0x3e')],'outboundUnknownCallsDay':_0x31e98a[_0xee0a('0x3f')],'outboundAbandonedCallsDay':_0x31e98a[_0xee0a('0x40')],'predictiveIntervalAnsweredCalls':_0x31e98a[_0xee0a('0x41')],'predictiveIntervalAvgHoldtime':_0x31e98a['predictiveIntervalAvgHoldtime'],'predictiveIntervalAvgTalktime':_0x31e98a[_0xee0a('0x42')],'predictiveIntervalDroppedCallsCallersExit':_0x31e98a[_0xee0a('0x43')],'predictiveIntervalDroppedCallsTimeout':_0x31e98a[_0xee0a('0x44')],'predictiveIntervalErlangCalls':_0x31e98a[_0xee0a('0x45')],'predictiveIntervalErlangCallsDroppedCalls':_0x31e98a['predictiveIntervalErlangCallsDroppedCalls'],'predictiveIntervalHitRate':_0x31e98a[_0xee0a('0x46')],'predictiveIntervalMultiplicativeFactor':_0x31e98a['predictiveIntervalMultiplicativeFactor'],'predictiveIntervalPauses':_0x31e98a[_0xee0a('0x47')],'predictiveIntervalAvailable':_0x31e98a[_0xee0a('0x48')],'predictiveIntervalTotalCalls':_0x31e98a[_0xee0a('0x49')],'message':_0x31e98a[_0xee0a('0x4a')],'originated':_0x31e98a[_0xee0a('0x4b')],'erlangCalls':_0x31e98a[_0xee0a('0x4c')],'erlangCallToSecond':_0x31e98a[_0xee0a('0x4d')],'erlangAbandonmentRate':_0x31e98a[_0xee0a('0x4e')],'erlangBusyFactor':_0x31e98a['erlangBusyFactor'],'startPredictive':_0x31e98a[_0xee0a('0x4f')],'startProgressive':_0x31e98a[_0xee0a('0x50')]};if(_0x31e98a['Trunk']){_0x1eb176[_0xee0a('0x51')]={'id':_0x31e98a[_0xee0a('0x51')]['id'],'name':_0x31e98a[_0xee0a('0x51')]['name'],'active':_0x31e98a[_0xee0a('0x51')][_0xee0a('0x52')],'callerid':_0x31e98a[_0xee0a('0x51')]['callerid']};}if(_0x31e98a[_0xee0a('0x53')]){_0x1eb176[_0xee0a('0x53')]={'id':_0x31e98a[_0xee0a('0x53')]['id'],'name':_0x31e98a['Interval']['name']};}var _0x7db483=md5(JSON[_0xee0a('0x54')](_0x1eb176));if(_0x31e98a[_0xee0a('0x2')]!==_0x7db483){_0x31e98a[_0xee0a('0x2')]=_0x7db483;emit(util[_0xee0a('0x55')](_0xee0a('0x56'),_0x1eb176[_0xee0a('0x25')]),_0xee0a('0x57'),_0x1eb176);}}}function emitVoiceQueueChannelRemove(_0x22d505){logger['info'](_0xee0a('0x58'),JSON[_0xee0a('0x54')](_0x22d505));emit(util['format'](_0xee0a('0x56'),_0x22d505[_0xee0a('0x25')]),'voice_queue_channel:remove',_0x22d505);io[_0xee0a('0x22')](_0xee0a('0x59'),_0x22d505);}function notSendMessagesQueue(_0x3a825e){if(_0x3a825e[_0xee0a('0x5a')]){if(_0x3a825e[_0xee0a('0x4b')]===0x0&&_0x3a825e[_0xee0a('0x29')]===0x0){_0x3a825e[_0xee0a('0x5a')]=![];_0x3a825e[_0xee0a('0x27')]=0x0;_0x3a825e[_0xee0a('0x5b')]=0x0;_0x3a825e['message']=_0xee0a('0x5c');ut[_0xee0a('0x5d')](_0xee0a('0x5e'),_0x3a825e[_0xee0a('0x25')]+'\x20is\x20not\x20active');}else{_0x3a825e['message']=_0xee0a('0x5f');ut[_0xee0a('0x5d')](_0xee0a('0x5e'),_0x3a825e[_0xee0a('0x25')]+_0xee0a('0x60'));}emitCampaignPreview(_0x3a825e);}}Preview[_0xee0a('0x9')][_0xee0a('0x21')]=function(){var _0x4c398c=this;setInterval(function(){_0x4c398c['syncCampaigns']();},0x7cf);};Preview[_0xee0a('0x9')][_0xee0a('0x61')]=function(){var _0x587ee3=this[_0xee0a('0xe')];this[_0xee0a('0x62')]+=0x1;for(var _0x5f2071 in _0x587ee3){if(_0x587ee3[_0xee0a('0x63')](_0x5f2071)&&(_0x587ee3[_0x5f2071][_0xee0a('0x2f')]===_0xee0a('0x64')||_0x587ee3[_0x5f2071][_0xee0a('0x2f')]===_0xee0a('0x65'))&&_0x587ee3[_0x5f2071][_0xee0a('0x23')]===_0xee0a('0x24')){if(this['clockClearZombieChannels']>0x7){this['clockClearZombieChannels']=0x0;this[_0xee0a('0x66')]();}}if(_0x587ee3['hasOwnProperty'](_0x5f2071)&&_0x587ee3[_0x5f2071]['dialMethod']==='preview'&&_0x587ee3[_0x5f2071][_0xee0a('0x23')]===_0xee0a('0x24')){if(_0x587ee3[_0x5f2071]['dialActive']){this['setMessage'](_0x587ee3[_0x5f2071]);if(_0x587ee3[_0x5f2071]['dialPreviewAutoRecallMe'])this['recallMe'](_0x587ee3[_0x5f2071]);}else{notSendMessagesQueue(_0x587ee3[_0x5f2071]);}}}};Preview[_0xee0a('0x9')][_0xee0a('0x67')]=function(_0x32fd2d){var _0x384986=this;this[_0xee0a('0xd')][_0xee0a('0xa')](function(){if(!_['isNil'](_0x384986[_0xee0a('0x10')][_0x32fd2d])){loggerAction['info'](_0xee0a('0x68'),_0x32fd2d,_0xee0a('0x69'),_0x384986[_0xee0a('0x10')][_0x32fd2d][_0xee0a('0x6a')],'originated:\x20',JSON[_0xee0a('0x54')](_0x384986[_0xee0a('0xe')][_0x384986[_0xee0a('0x10')][_0x32fd2d][_0xee0a('0x6a')]][_0xee0a('0x4b')]),_0xee0a('0x6b'),JSON[_0xee0a('0x54')](_0x384986['campaignsPreview'][_0x384986['actions'][_0x32fd2d][_0xee0a('0x6a')]][_0xee0a('0x29')]),JSON[_0xee0a('0x54')](_0x384986[_0xee0a('0x10')][_0x32fd2d][_0xee0a('0x6c')]),JSON[_0xee0a('0x54')](_[_0xee0a('0x6d')](_0x384986[_0xee0a('0x10')][_0x32fd2d],[_0xee0a('0x6e'),_0xee0a('0x6f'),_0xee0a('0x70'),_0xee0a('0x71')])));return ami['Action']({'action':_0xee0a('0x72'),'channel':_0x384986[_0xee0a('0x10')][_0x32fd2d][_0xee0a('0x73')]})[_0xee0a('0x74')](function(_0x29e137){if(_0x29e137['message']===_0xee0a('0x75')){setTimeout(function(){if(_0x384986[_0xee0a('0x10')][_0x32fd2d]){ut[_0xee0a('0x76')](_0x384986[_0xee0a('0xe')][_0x384986[_0xee0a('0x10')][_0x32fd2d]['queue']],_0xee0a('0x77'));if(_0x384986[_0xee0a('0x10')][_0x32fd2d][_0xee0a('0x6c')]===!![]){ut[_0xee0a('0x78')](_0x384986[_0xee0a('0xe')][_0x384986['actions'][_0x32fd2d][_0xee0a('0x6a')]],_0xee0a('0x77'));ut[_0xee0a('0x79')](_0xee0a('0x7a')+_0x32fd2d,_0x384986[_0xee0a('0x10')][_0x32fd2d][_0xee0a('0x6a')]);}ut[_0xee0a('0x79')](_0xee0a('0x7b')+_0x32fd2d,_0x384986[_0xee0a('0x10')][_0x32fd2d][_0xee0a('0x6a')]);delete _0x384986[_0xee0a('0x10')][_0x32fd2d];}},0x2328);}});}});};Preview[_0xee0a('0x9')][_0xee0a('0x66')]=function(){var _0x341f43=this;loggerAction[_0xee0a('0x7c')](_0xee0a('0x7d'),_[_0xee0a('0x7e')](this[_0xee0a('0x10')]));for(var _0x20d44a in this[_0xee0a('0x10')]){if(_0x341f43[_0xee0a('0x10')][_0xee0a('0x63')](_0x20d44a)){_0x341f43['clearZombieChannel'](_0x20d44a);}}};Preview['prototype']['recallMe']=function(_0x35eb93){var _0x557690=this;rpcDb[_0xee0a('0x7f')](_0x35eb93['id'],ut[_0xee0a('0x80')](this[_0xee0a('0x11')]))[_0xee0a('0x81')](function(_0x5d3b09){if(!_[_0xee0a('0x82')](_0x5d3b09)){for(var _0x27ae33=0x0;_0x27ae33<_0x5d3b09[_0xee0a('0x83')];_0x27ae33+=0x1){if(ut[_0xee0a('0x84')](_0x5d3b09[_0x27ae33][_0xee0a('0x85')])<_0x35eb93[_0xee0a('0x86')]*0x3c){if(_0x5d3b09[_0x27ae33][_0xee0a('0x87')]&&!_0x5d3b09[_0x27ae33][_0xee0a('0x87')][_0xee0a('0x88')]){_0x557690[_0xee0a('0x89')](_0x5d3b09[_0x27ae33]['id'])[_0xee0a('0x81')](ut[_0xee0a('0x8a')](_0xee0a('0x8b')))[_0xee0a('0x74')](ut['logger2'](_0xee0a('0x8b')));}else{rpcDb['disableContact'](_0x5d3b09[_0x27ae33]['id']);}}else{var _0x2dcfc5=new Action(_0x5d3b09[_0x27ae33],_0x35eb93);_0x2dcfc5[_0xee0a('0x8c')]=moment()['format'](_0xee0a('0x8d'));_0x35eb93['outboundReCallsDay']+=0x1;ut[_0xee0a('0x8e')](_0x2dcfc5,0x17,'RecallInQueue');if(_0x35eb93['dialRecallInQueue']){rpcDb['rescheduleContactInQueue'](ut[_0xee0a('0x8f')](_0x5d3b09[_0x27ae33]));rpcDb[_0xee0a('0x90')](_0x2dcfc5,_0xee0a('0x91'));}else{ut[_0xee0a('0x8e')](_0x2dcfc5,0x16,_0xee0a('0x92'));rpcDb[_0xee0a('0x90')](_0x2dcfc5,_0xee0a('0x93'));rpcDb[_0xee0a('0x94')](_0x2dcfc5,'[HistoryRecallClose]');}}}}})[_0xee0a('0x74')](ut['logger2']('[getContactRecallMe]'));};Preview[_0xee0a('0x9')][_0xee0a('0x95')]=function(_0x2aa5d3){_0x2aa5d3[_0xee0a('0x5a')]=!![];if(ut[_0xee0a('0x96')](_0x2aa5d3[_0xee0a('0x28')])){_0x2aa5d3[_0xee0a('0x4a')]=_0xee0a('0x97');}else if(!ut['isActive'](_0x2aa5d3[_0xee0a('0x98')])){_0x2aa5d3['message']=_0xee0a('0x5c');}else if(!this[_0xee0a('0x99')](_0x2aa5d3[_0xee0a('0x51')])){if(!this[_0xee0a('0x99')](_0x2aa5d3[_0xee0a('0x9a')])){_0x2aa5d3[_0xee0a('0x4a')]='TRUNK_IS_NOT_REACHABLE';}else{_0x2aa5d3[_0xee0a('0x4a')]=_0xee0a('0x9b');}}else{_0x2aa5d3[_0xee0a('0x4a')]='ACTIVE';}emitCampaignPreview(_0x2aa5d3);};Preview[_0xee0a('0x9')][_0xee0a('0x9c')]=function(_0x4d5c5b,_0x46e0b1,_0x4b76b9){var _0x491ea3=this;var _0x4d6583=this['actions'][_0x46e0b1];var _0x35e9f1=this['campaignsPreview'][_0x4d6583[_0xee0a('0x6a')]];var _0x5caa55;if(_0x35e9f1){switch(_0x4b76b9){case'1':_0x35e9f1[_0xee0a('0x9d')]+=0x1;_0x4d6583[_0xee0a('0x9e')]+=0x1;_0x4d6583[_0xee0a('0x9f')]=ut[_0xee0a('0xa0')](_0x4d6583);ut['logCustomer'](_0x4d6583,0x0,_0xee0a('0xa1'));ami[_0xee0a('0x22')](_0xee0a('0xa2'),ut[_0xee0a('0xa3')](_0x4d6583,_0xee0a('0xa4')));rpcDb['createCustomerHistory'](_0x4d6583,_0xee0a('0xa5'));if(ut[_0xee0a('0xa0')](_0x4d6583)>=_0x35e9f1[_0xee0a('0xa6')]){_0x5caa55=ut['cloneAction'](_0x4d6583,0xf,_0xee0a('0xa7'));rpcDb[_0xee0a('0x94')](_0x5caa55,'[callProgressDetectingCustomer][logNoSuchGlobal]');}else{if(_0x4d6583[_0xee0a('0x9e')]>=_0x35e9f1[_0xee0a('0xa8')]){rpcDb[_0xee0a('0x94')](_0x4d6583,_0xee0a('0xa9'));}else{rpcDb[_0xee0a('0xaa')](ut[_0xee0a('0xab')](_0x4d6583,_0xee0a('0x9e'),_0x35e9f1[_0xee0a('0xac')]),_0x4d6583['unlockAgent'],_0x4d6583[_0xee0a('0xad')]);}}delete this[_0xee0a('0x10')][_0x4d5c5b[_0xee0a('0xae')]];break;case _0xee0a('0xaf'):var _0x8da3af=moment()[_0xee0a('0x55')](_0xee0a('0x8d'));_0x4d6583['responsetime']=_0x8da3af;_0x4d6583[_0xee0a('0xb0')]=_0x8da3af;_0x4d6583[_0xee0a('0x6c')]=!![];_0x35e9f1[_0xee0a('0x29')]+=0x1;logger[_0xee0a('0x7c')]('[syncHangup][talking][increment]',_0x4d6583[_0xee0a('0xb1')],_0xee0a('0xb2'),_0x35e9f1[_0xee0a('0x25')],_0xee0a('0x6b'),_0x35e9f1[_0xee0a('0x29')]);ami['emit']('custom:agentconnect',ut[_0xee0a('0xa3')](_0x4d6583,_0xee0a('0xb3'),this[_0xee0a('0xe')][_0x4d6583['queue']]));if(_0x35e9f1[_0xee0a('0xb4')]){ami[_0xee0a('0x22')](_0xee0a('0xb5'),ut[_0xee0a('0xb6')](_0x4d6583));}break;case'16':ami[_0xee0a('0x22')](_0xee0a('0xb7'),ut[_0xee0a('0xa3')](_0x4d6583,_0xee0a('0xb8'),this['campaignsPreview'][_0x4d6583[_0xee0a('0x6a')]]));emitVoiceQueueChannelRemove(ut[_0xee0a('0xa3')](_0x4d6583,_0xee0a('0xb8')));_0x35e9f1[_0xee0a('0x34')]+=0x1;_0x35e9f1[_0xee0a('0x2d')]+=0x1;_0x35e9f1['answered']+=0x1;ut[_0xee0a('0x78')](_0x35e9f1,_0xee0a('0xb9'));_0x4d6583[_0xee0a('0x9f')]=ut[_0xee0a('0xa0')](_0x4d6583);ut[_0xee0a('0x8e')](_0x4d6583,0x4,'Answer');rpcDb['createCustomerHistory'](_0x4d6583,'[callProgressDetectingCustomer][logAnswer]');rpcDb['createCustomerFinal'](_0x4d6583,_0xee0a('0xba'));rpcDb['crateCustomerReportQueue'](_0x4d6583);_0x35e9f1[_0xee0a('0x2a')]+=_0x4d6583[_0xee0a('0xbb')];_0x35e9f1['sumBillable']+=_0x4d6583[_0xee0a('0xbb')];logger['info'](_0xee0a('0xbc'),_0x4d6583[_0xee0a('0xb1')],_0xee0a('0xb2'),_0x35e9f1[_0xee0a('0x25')],'pTalking:\x20',_0x35e9f1[_0xee0a('0x29')]);delete this[_0xee0a('0x10')][_0x4d5c5b[_0xee0a('0xae')]];break;case _0xee0a('0xbd'):_0x35e9f1['outboundBusyCallsDay']+=0x1;_0x4d6583[_0xee0a('0xbe')]+=0x1;_0x4d6583[_0xee0a('0x9f')]=ut[_0xee0a('0xa0')](_0x4d6583);ut[_0xee0a('0x8e')](_0x4d6583,0x5,_0xee0a('0xbf'));ami[_0xee0a('0x22')]('custom:agentbusy',ut[_0xee0a('0xa3')](_0x4d6583,_0xee0a('0xc0')));rpcDb[_0xee0a('0x90')](_0x4d6583,_0xee0a('0xc1'));if(ut[_0xee0a('0xa0')](_0x4d6583)>=_0x35e9f1[_0xee0a('0xa6')]){_0x5caa55=ut['cloneAction'](_0x4d6583,0xf,_0xee0a('0xa7'));rpcDb[_0xee0a('0x94')](_0x5caa55,_0xee0a('0xc2'));}else{if(_0x4d6583[_0xee0a('0xbe')]>=_0x35e9f1[_0xee0a('0xc3')]){rpcDb[_0xee0a('0x94')](_0x4d6583,'[callProgressDetectingCustomer][logBusy]');}else{rpcDb[_0xee0a('0xaa')](ut[_0xee0a('0xab')](_0x4d6583,_0xee0a('0xbe'),_0x35e9f1[_0xee0a('0xc4')]),_0x4d6583[_0xee0a('0xc5')],_0x4d6583[_0xee0a('0xad')]);}}break;case _0xee0a('0xc6'):_0x35e9f1[_0xee0a('0x3b')]+=0x1;_0x4d6583[_0xee0a('0xc7')]+=0x1;_0x4d6583[_0xee0a('0x9f')]=ut[_0xee0a('0xa0')](_0x4d6583);ut[_0xee0a('0x8e')](_0x4d6583,0x3,_0xee0a('0xc8'));ami[_0xee0a('0x22')](_0xee0a('0xc9'),ut['buildObj'](_0x4d6583,_0xee0a('0xca')));rpcDb[_0xee0a('0x90')](_0x4d6583,'[callProgressDetectingCustomer][logNoAnswer]');if(ut[_0xee0a('0xa0')](_0x4d6583)>=_0x35e9f1[_0xee0a('0xa6')]){_0x5caa55=ut['cloneAction'](_0x4d6583,0xf,'Global');rpcDb[_0xee0a('0x94')](_0x5caa55,'[callProgressDetectingCustomer][logNoAnswerGlobal]');}else{if(_0x4d6583[_0xee0a('0xc7')]>=_0x35e9f1[_0xee0a('0xcb')]){rpcDb['createCustomerFinal'](_0x4d6583,_0xee0a('0xcc'));}else{rpcDb[_0xee0a('0xaa')](ut[_0xee0a('0xab')](_0x4d6583,_0xee0a('0xc7'),_0x35e9f1[_0xee0a('0xcd')]),_0x4d6583['unlockAgent'],_0x4d6583[_0xee0a('0xad')]);}}break;case _0xee0a('0xce'):_0x35e9f1[_0xee0a('0x37')]+=0x1;_0x4d6583[_0xee0a('0xcf')]+=0x1;_0x4d6583[_0xee0a('0x9f')]=ut[_0xee0a('0xa0')](_0x4d6583);ut[_0xee0a('0x8e')](_0x4d6583,0x8,_0xee0a('0xd0'));ami[_0xee0a('0x22')](_0xee0a('0xd1'),ut[_0xee0a('0xa3')](_0x4d6583,_0xee0a('0xd2')));rpcDb[_0xee0a('0x90')](_0x4d6583,'[callProgressDetectingCustomer][logCongestion]');if(ut[_0xee0a('0xa0')](_0x4d6583)>=_0x35e9f1['dialGlobalMaxRetry']){_0x5caa55=ut[_0xee0a('0xd3')](_0x4d6583,0xf,_0xee0a('0xa7'));rpcDb[_0xee0a('0x94')](_0x5caa55,_0xee0a('0xd4'));}else{if(_0x4d6583['countcongestionretry']>=_0x35e9f1[_0xee0a('0xd5')]){rpcDb['createCustomerFinal'](_0x4d6583,_0xee0a('0xd6'));}else{rpcDb[_0xee0a('0xaa')](ut['scheduledAt'](_0x4d6583,_0xee0a('0xcf'),_0x35e9f1[_0xee0a('0xc4')]),_0x4d6583[_0xee0a('0xc5')],_0x4d6583[_0xee0a('0xad')]);}}break;case _0xee0a('0xd7'):_0x35e9f1[_0xee0a('0x3e')]+=0x1;_0x4d6583[_0xee0a('0xd8')]+=0x1;_0x4d6583[_0xee0a('0x9f')]=ut['totalGlobal'](_0x4d6583);ut['logCustomer'](_0x4d6583,0x14,_0xee0a('0xd9'));ami[_0xee0a('0x22')](_0xee0a('0xda'),ut[_0xee0a('0xa3')](_0x4d6583,'agentreject'));rpcDb[_0xee0a('0x90')](_0x4d6583,_0xee0a('0xdb'));if(ut[_0xee0a('0xa0')](_0x4d6583)>=_0x35e9f1[_0xee0a('0xa6')]){_0x5caa55=ut[_0xee0a('0xd3')](_0x4d6583,0x14,_0xee0a('0xd9'));rpcDb['createCustomerFinal'](_0x5caa55,'[callProgressDetectingCustomer][logAgentReject]');}else{if(_0x4d6583[_0xee0a('0xd8')]>=_0x35e9f1[_0xee0a('0xdc')]){rpcDb[_0xee0a('0x94')](_0x4d6583,_0xee0a('0xdd'));}else{rpcDb[_0xee0a('0xaa')](ut[_0xee0a('0xab')](_0x4d6583,_0xee0a('0xd8'),_0x35e9f1[_0xee0a('0xde')]),_0x4d6583['unlockAgent'],_0x4d6583[_0xee0a('0xad')]);}}break;case _0xee0a('0xdf'):_0x35e9f1['outboundAbandonedCallsDay']+=0x1;_0x4d6583['countabandonedretry']+=0x1;_0x4d6583[_0xee0a('0x9f')]=ut[_0xee0a('0xa0')](_0x4d6583);ut[_0xee0a('0x8e')](_0x4d6583,0xb,_0xee0a('0xe0'));rpcDb[_0xee0a('0x90')](_0x4d6583,'[callProgressDetectingCustomer][logAbandoned]');if(ut[_0xee0a('0xa0')](_0x4d6583)>=_0x35e9f1[_0xee0a('0xa6')]){_0x5caa55=ut['cloneAction'](_0x4d6583,0xf,_0xee0a('0xa7'));rpcDb['createCustomerFinal'](_0x5caa55,_0xee0a('0xe1'));}else{if(_0x4d6583[_0xee0a('0xe2')]>=_0x35e9f1[_0xee0a('0xe3')]){rpcDb['createCustomerFinal'](_0x4d6583,_0xee0a('0xe1'));}else{rpcDb[_0xee0a('0xaa')](ut[_0xee0a('0xab')](_0x4d6583,_0xee0a('0xe4'),_0x35e9f1['dialAbandonedRetryFrequency']),_0x4d6583['unlockAgent'],_0x4d6583['activeContact']);}}break;case'18':_0x35e9f1[_0xee0a('0x3f')]+=0x1;_0x4d6583[_0xee0a('0xe5')]+=0x1;_0x4d6583[_0xee0a('0x9f')]=ut['totalGlobal'](_0x4d6583);ut['logCustomer'](_0x4d6583,0x12,_0x4d5c5b[_0xee0a('0xe6')]||_0x4d5c5b[_0xee0a('0xe7')]);ami[_0xee0a('0x22')]('custom:amd',ut['buildObj'](_0x4d6583,_0xee0a('0xe8')));rpcDb['createCustomerHistory'](_0x4d6583,_0xee0a('0xe9'));if(ut[_0xee0a('0xa0')](_0x4d6583)>=_0x35e9f1[_0xee0a('0xa6')]){_0x5caa55=ut[_0xee0a('0xd3')](_0x4d6583,0xf,'Global');rpcDb[_0xee0a('0x94')](_0x5caa55,_0xee0a('0xe9'));}else{rpcDb[_0xee0a('0x94')](_0x4d6583,_0xee0a('0xe9'));}delete this[_0xee0a('0x10')][_0x4d5c5b[_0xee0a('0xae')]];break;case'19':_0x35e9f1[_0xee0a('0x3f')]+=0x1;_0x4d6583[_0xee0a('0x9f')]=ut[_0xee0a('0xa0')](_0x4d6583);ut[_0xee0a('0x8e')](_0x4d6583,0x13,_0x4d5c5b[_0xee0a('0xe6')]||_0x4d5c5b[_0xee0a('0xe7')]);ami['emit'](_0xee0a('0xea'),ut['buildObj'](_0x4d6583,_0xee0a('0xe8')));rpcDb[_0xee0a('0x90')](_0x4d6583,_0xee0a('0xeb'));if(ut[_0xee0a('0xa0')](_0x4d6583)>=_0x35e9f1[_0xee0a('0xa6')]){_0x5caa55=ut['cloneAction'](_0x4d6583,0xf,_0xee0a('0xa7'));rpcDb[_0xee0a('0x94')](_0x5caa55,'[callProgressDetectingCustomer][machine]');}else{rpcDb[_0xee0a('0x94')](_0x4d6583,_0xee0a('0xeb'));}delete this[_0xee0a('0x10')][_0x4d5c5b[_0xee0a('0xae')]];break;default:if(_0x4d6583[_0xee0a('0x6c')]){ut[_0xee0a('0x78')](_0x35e9f1,'[default]');ut[_0xee0a('0x79')](_0xee0a('0xec')+_0x35e9f1[_0xee0a('0x25')],_0x4d5c5b);}_0x35e9f1[_0xee0a('0x3f')]+=0x1;_0x4d6583[_0xee0a('0x9f')]=ut['totalGlobal'](_0x4d6583);ut[_0xee0a('0x8e')](_0x4d6583,0xc,_0x4d5c5b[_0xee0a('0xe6')]||_0x4d5c5b[_0xee0a('0xe7')]);rpcDb[_0xee0a('0x90')](_0x4d6583,_0xee0a('0xed'));if(ut[_0xee0a('0xa0')](_0x4d6583)>=_0x35e9f1['dialGlobalMaxRetry']){_0x5caa55=ut['cloneAction'](_0x4d6583,0xf,_0xee0a('0xa7'));rpcDb['createCustomerFinal'](_0x5caa55,_0xee0a('0xee'));}else{rpcDb[_0xee0a('0x94')](_0x4d6583,_0xee0a('0xee'));}delete this[_0xee0a('0x10')][_0x4d5c5b[_0xee0a('0xae')]];}if(!(_0x4d6583['dialAnswer']&&_0x4b76b9==='16')){ut[_0xee0a('0x76')](_0x35e9f1,'[callProgressDetectingCustomer]');logger[_0xee0a('0x7c')](_0xee0a('0xef'),_0x4d6583['uniqueid'],_0xee0a('0xb2'),_0x35e9f1[_0xee0a('0x25')],_0xee0a('0xf0'),_0x35e9f1['originated']);}if(_0x4b76b9!==_0xee0a('0xaf')){delete this[_0xee0a('0x10')][_0x4d5c5b[_0xee0a('0xae')]];delete this[_0xee0a('0x10')][_0x4d5c5b['destlinkedid']];}}};Preview[_0xee0a('0x9')][_0xee0a('0xf1')]=function(_0x5d64e4,_0x4f8c4e,_0x1991a3){if(_['isUndefined'](_0x4f8c4e)&&_0xee0a('0xf2')!==typeof _0x4f8c4e){return;}if(_[_0xee0a('0xf3')](_0x1991a3)&&_0xee0a('0xf2')!==typeof _0x1991a3){return;}switch(_0x1991a3['reason']){case'0':ut[_0xee0a('0xf4')](_0x5d64e4,0x0,_0xee0a('0xa1'));rpcDb[_0xee0a('0xf5')](_0x5d64e4,'[callProgressDetectingAgent][logNoSuch]');break;case'3':ut['logAgent'](_0x5d64e4,0x3,_0xee0a('0xc8'));rpcDb[_0xee0a('0xf5')](_0x5d64e4,'[callProgressDetectingAgent][logNoAnswer]');break;case'5':ut[_0xee0a('0xf4')](_0x5d64e4,0x5,_0xee0a('0xbf'));rpcDb[_0xee0a('0xf5')](_0x5d64e4,_0xee0a('0xf6'));break;case'8':ut['logAgent'](_0x5d64e4,0x8,'Congestion');rpcDb[_0xee0a('0xf5')](_0x5d64e4,_0xee0a('0xf7'));break;case'22':ut[_0xee0a('0xf4')](_0x5d64e4,0x16,_0xee0a('0xf8'));rpcDb[_0xee0a('0xf5')](_0x5d64e4,_0xee0a('0xf9'));break;default:ut[_0xee0a('0xf4')](_0x5d64e4,0xc,_0x1991a3['reason']);rpcDb[_0xee0a('0xf5')](_0x5d64e4,'[callProgressDetectingAgent][logCongestion]');}ut[_0xee0a('0x76')](_0x4f8c4e,_0xee0a('0xfa'));logger[_0xee0a('0x7c')]('[originated][decrement][callProgressDetectingAgent]',_0x5d64e4[_0xee0a('0xb1')],_0xee0a('0xb2'),_0x4f8c4e[_0xee0a('0x25')],_0xee0a('0xf0'),_0x4f8c4e['originated']);delete this[_0xee0a('0x10')][_0x5d64e4[_0xee0a('0xb1')]];};Preview['prototype'][_0xee0a('0xfb')]=function(_0x42785e,_0x43eee5,_0x5afce7,_0x310487,_0x2c546f){var _0x27c900=this;return new BPromise(function(_0x323dca,_0x168ac6){if(_[_0xee0a('0x82')](_0x43eee5)||_[_0xee0a('0x82')](_0x43eee5[_0xee0a('0xfc')])||_[_0xee0a('0x82')](_0x43eee5[_0xee0a('0xfc')][_0xee0a('0xfd')])||_[_0xee0a('0x82')](_0x43eee5[_0xee0a('0x70')])){_0x168ac6(ut[_0xee0a('0x4a')]('Contact\x20is\x20undefined',_0x310487,_0x2c546f));return;}var _0x94eb26=uuid['v4']();var _0x33d0ad=_0x27c900['campaignsPreview'][_0x43eee5[_0xee0a('0x69')][_0xee0a('0x25')]];var _0x368678=_0x5afce7?_0x27c900['agents'][_0x5afce7]['id']:undefined;_0x27c900[_0xee0a('0x10')][_0x94eb26]=new Action(_0x43eee5,_0x33d0ad,_0x94eb26,_0x5afce7,_0x368678);var _0x15a09a=_0x27c900[_0xee0a('0x10')][_0x94eb26];_0x15a09a[_0xee0a('0xc5')]=_0x310487;_0x15a09a['activeContact']=_0x2c546f;_0x15a09a[_0xee0a('0xfe')]=_0x5afce7;if(_[_0xee0a('0xff')](_0x42785e)){_0x27c900[_0xee0a('0x100')](_0x15a09a,_0x33d0ad,_0x43eee5,_0x5afce7)['then'](function(_0x48d951){logger[_0xee0a('0x7c')](_0xee0a('0x101'),_0xee0a('0x102')+_0x15a09a[_0xee0a('0x6a')]+_0xee0a('0x103')+_0x15a09a[_0xee0a('0x104')],JSON[_0xee0a('0x54')](_0x48d951));ami[_0xee0a('0x22')](_0xee0a('0x105'),ut[_0xee0a('0xa3')](_0x15a09a,_0xee0a('0x106'),_0x27c900[_0xee0a('0xe')][_0x15a09a[_0xee0a('0x6a')]]));_0x323dca(ut[_0xee0a('0x4a')](_0xee0a('0x107')));})['catch'](function(_0x4db028){ut['logger'](_0xee0a('0x108'),_0x4db028);_0x168ac6(ut[_0xee0a('0x4a')](_0xee0a('0x109'),_0x310487,_0x2c546f));});}else{_0x33d0ad[_0xee0a('0x35')]+=0x1;ut[_0xee0a('0x10a')](_0x15a09a);rpcDb['createHistory'](_0x15a09a,'[Blacklist][error]');delete _0x27c900[_0xee0a('0x10')][_0x94eb26];_0x168ac6(ut['message'](_0xee0a('0x10b'),_0x310487,_0x2c546f));}});};Preview['prototype'][_0xee0a('0x99')]=function(_0x49cf8a){return!_[_0xee0a('0x82')](_0x49cf8a)&&!_[_0xee0a('0x82')](_0x49cf8a[_0xee0a('0x25')])&&!_[_0xee0a('0x82')](_0x49cf8a[_0xee0a('0x52')])&&_0x49cf8a[_0xee0a('0x52')]&&!_[_0xee0a('0x82')](this['trunks'][util[_0xee0a('0x55')](_0xee0a('0x10c'),_0x49cf8a[_0xee0a('0x25')])])&&!_[_0xee0a('0x82')](this[_0xee0a('0xf')][util['format'](_0xee0a('0x10c'),_0x49cf8a['name'])]['status'])&&(this[_0xee0a('0xf')][util[_0xee0a('0x55')]('SIP/%s',_0x49cf8a[_0xee0a('0x25')])][_0xee0a('0x72')]===_0xee0a('0x10d')||this['trunks'][util[_0xee0a('0x55')](_0xee0a('0x10c'),_0x49cf8a[_0xee0a('0x25')])]['status']===_0xee0a('0x10e'));};Preview[_0xee0a('0x9')]['run']=function(_0x55536a,_0x1ebc56){var _0x5c6b26=this;return new BPromise(function(_0x10f7c6,_0xbb16c5){_0x5c6b26[_0xee0a('0x10f')](_0x55536a,_0x1ebc56)[_0xee0a('0x81')](function(_0xc5c619){_0x10f7c6(_[_0xee0a('0x6d')](_0xc5c619,[_0xee0a('0x4a')]));})[_0xee0a('0x74')](function(_0x343ee3){if(_0x343ee3[_0xee0a('0x110')]){rpcDb[_0xee0a('0x111')](_0x55536a);}if(_0x343ee3[_0xee0a('0x52')]){rpcDb['disableContact'](_0x55536a);}_0xbb16c5(_[_0xee0a('0x6d')](_0x343ee3,[_0xee0a('0x4a')]));});});};Preview[_0xee0a('0x9')][_0xee0a('0x10f')]=function(_0x5ed20b,_0x2b330e){var _0x4379ad=this;return new BPromise(function(_0x10c3f4,_0x1b8053){var _0x1ce389,_0xc27a48;rpcDb['getContactPreview'](_0x5ed20b)['then'](function(_0x325c16){if(!_['isNil'](_0x325c16[0x0])){_0xc27a48=_0x325c16[0x0][_0xee0a('0x112')]?![]:!![];_0x1ce389=_0x325c16[0x0][_0xee0a('0x112')]?!![]:![];_0x1ce389=_0x2b330e?!![]:_0x1ce389;}var _0x2d6018=_0x4379ad[_0xee0a('0x113')](_0x325c16);if(_0x2d6018[_0xee0a('0x114')]){rpcDb[_0xee0a('0x115')](_[_0xee0a('0x6d')](_0x325c16[0x0],['VoiceQueueId',_0xee0a('0x116')]))[_0xee0a('0x81')](function(_0x2a1075){_0x4379ad[_0xee0a('0xfb')](_0x2a1075,_0x325c16[0x0],_0x2b330e,_0xc27a48,_0x1ce389)[_0xee0a('0x81')](function(_0x3d72f5){_0x10c3f4(_0x3d72f5);})['catch'](function(_0x435f72){_0x1b8053(_0x435f72);});})['catch'](function(_0x5ec2c7){ut[_0xee0a('0x5d')](_0xee0a('0x117'),_0x5ec2c7);_0x1b8053(ut[_0xee0a('0x4a')](_0xee0a('0x118'),_0xc27a48,_0x1ce389));});}else{_0x1b8053(ut[_0xee0a('0x4a')](_0x2d6018['message'],_0xc27a48,_0x1ce389));}})[_0xee0a('0x74')](function(_0x44b3eb){ut[_0xee0a('0x5d')](_0xee0a('0x119'),_0x44b3eb);_0x1b8053(ut[_0xee0a('0x4a')]('Call\x20unsuccessful',![],!![]));});});};Preview[_0xee0a('0x9')][_0xee0a('0x113')]=function(_0x150b6f){if(_['isNil'](_0x150b6f)||_['isEmpty'](_0x150b6f)||!_[_0xee0a('0x82')](_0x150b6f[0x0][_0xee0a('0x87')])&&_[_0xee0a('0x82')](_0x150b6f[0x0][_0xee0a('0x87')][_0xee0a('0x25')])){ut[_0xee0a('0x5d')]('[Preview][validateContact][Empty\x20Contact]',_0x150b6f);return{'isValid':![],'message':_0xee0a('0x11a')};}var _0x746b58=this[_0xee0a('0xe')][_0x150b6f[0x0]['Queue'][_0xee0a('0x25')]];_0x746b58[_0xee0a('0x4a')]=_0xee0a('0x9b');if(_['isNil'](_0x746b58)){ut[_0xee0a('0x5d')](_0xee0a('0x11b'),_0x746b58);return{'isValid':![],'message':'Empty\x20Campaign'};}if(!this[_0xee0a('0x99')](_0x746b58[_0xee0a('0x51')])){ut['logger'](_0xee0a('0x11c'),_0xee0a('0x11d')+_0x746b58[_0xee0a('0x25')]+_0xee0a('0x11e'));if(!this['isTrunkReachable'](_0x746b58[_0xee0a('0x9a')])){ut['logger'](_0xee0a('0x11c'),_0x746b58[_0xee0a('0x25')]+'\x20Trunk\x20Backup\x20is\x20not\x20active');return{'isValid':![],'message':_0xee0a('0x11f')};}}if(!ut[_0xee0a('0x120')](_0x746b58[_0xee0a('0x98')])){ut[_0xee0a('0x5d')](_0xee0a('0x121'),_0x746b58[_0xee0a('0x25')]+_0xee0a('0x122'));return{'isValid':![],'message':_0xee0a('0x11d')+_0x746b58[_0xee0a('0x25')]+_0xee0a('0x122')};}return{'isValid':!![],'message':_0xee0a('0x123')};};Preview['prototype'][_0xee0a('0x100')]=function(_0x384edc,_0x59b741,_0x15bb10,_0x509e7b){var _0xb7969d=this;return new BPromise(function(_0x314337,_0x5bf973){var _0x2277af=_0x384edc[_0xee0a('0xb1')];var _0x2d9c2e=_0xb7969d[_0xee0a('0x99')](_0x59b741[_0xee0a('0x51')])?util[_0xee0a('0x55')](_0xee0a('0x124'),_0x59b741[_0xee0a('0x51')][_0xee0a('0x25')],_[_0xee0a('0x82')](_0x59b741[_0xee0a('0x32')])?'':_0x59b741['dialPrefix'][_0xee0a('0x125')]()||'',_0x59b741[_0xee0a('0x126')]>0x0?_0x15bb10[_0xee0a('0xfc')][_0xee0a('0xfd')]['substring'](_0x59b741[_0xee0a('0x126')]):_0x15bb10[_0xee0a('0xfc')]['phone']):util[_0xee0a('0x55')](_0xee0a('0x124'),_[_0xee0a('0x82')](_0x59b741[_0xee0a('0x9a')])?_0x59b741['Trunk'][_0xee0a('0x25')]:_0x59b741[_0xee0a('0x9a')][_0xee0a('0x25')],_['isNil'](_0x59b741[_0xee0a('0x32')])?'':_0x59b741[_0xee0a('0x32')][_0xee0a('0x125')]()||'',_0x59b741['dialCutDigit']>0x0?_0x15bb10[_0xee0a('0xfc')]['phone'][_0xee0a('0x127')](_0x59b741[_0xee0a('0x126')]):_0x15bb10[_0xee0a('0xfc')][_0xee0a('0xfd')]);var _0x196a40=_0xb7969d[_0xee0a('0x99')](_0x59b741['Trunk'])?ut['getCallerId'](_0x59b741['Trunk'][_0xee0a('0x128')],_0x59b741[_0xee0a('0x30')],_0x59b741['dialRandomLastDigitCallerIdNumber']>0x0?ut[_0xee0a('0x129')](_0x59b741[_0xee0a('0x31')],_0x59b741['dialRandomLastDigitCallerIdNumber']):_0x59b741[_0xee0a('0x31')]):ut[_0xee0a('0x12a')](_[_0xee0a('0x82')](_0x59b741[_0xee0a('0x9a')])?_0x59b741['Trunk'][_0xee0a('0x128')]:_0x59b741[_0xee0a('0x9a')][_0xee0a('0x128')],_0x59b741[_0xee0a('0x30')],_0x59b741[_0xee0a('0x12b')]>0x0?ut[_0xee0a('0x129')](_0x59b741['dialOriginateCallerIdNumber'],_0x59b741['dialRandomLastDigitCallerIdNumber']):_0x59b741[_0xee0a('0x31')]);if(_0x196a40){_0x384edc[_0xee0a('0x12c')]=ut['extractCalleridName'](_0x196a40);_0x384edc[_0xee0a('0x12d')]=ut[_0xee0a('0x12e')](_0x196a40);}var _0x23ad5f=ut[_0xee0a('0x12f')](_0x59b741,_0x15bb10,_0x2d9c2e,_0x196a40,_0x2277af,_0x384edc);_['merge'](_0x384edc,ut['toLowerVariables'](_0x23ad5f));_0x384edc[_0xee0a('0x8c')]=moment()[_0xee0a('0x55')](_0xee0a('0x8d'));ami['Action'](ut[_0xee0a('0x130')](_0x384edc,_0x59b741,_0x23ad5f,_0x384edc['activeContact'],_0x509e7b))[_0xee0a('0x81')](function(_0x2dada9){_0x59b741[_0xee0a('0x4b')]+=0x1;logger[_0xee0a('0x7c')](_0xee0a('0x131'),_0x2277af,_0xee0a('0xb2'),_0x59b741[_0xee0a('0x25')],_0xee0a('0xf0'),_0x59b741[_0xee0a('0x4b')]);_0x314337(_0x2dada9);})[_0xee0a('0x74')](function(_0x5e3794){ut[_0xee0a('0xf4')](_0x384edc,0xe,_0xee0a('0x132'));rpcDb['createAgentHistory'](_0x384edc,_0xee0a('0x133'));_0x5bf973(_0x5e3794);});});};Preview[_0xee0a('0x9')][_0xee0a('0x134')]=function(_0x1ab4b6){if(this[_0xee0a('0x10')][_0x1ab4b6[_0xee0a('0xae')]]){this[_0xee0a('0x10')][_0x1ab4b6['linkedid']][_0xee0a('0x73')]=_0x1ab4b6[_0xee0a('0x73')];}};Preview[_0xee0a('0x9')]['syncOriginateResponse']=function(_0x5d430f){var _0x15308d=this;var _0x309582=this[_0xee0a('0x10')][_0x5d430f[_0xee0a('0x135')]];if(_0x309582){if(_0x309582['lookAgent']&&this[_0xee0a('0x11')][_0x309582[_0xee0a('0xfe')]]){ut[_0xee0a('0x136')](_0x309582,this[_0xee0a('0x11')][_0x309582['lookAgent']][_0xee0a('0x25')],this[_0xee0a('0x11')][_0x309582[_0xee0a('0xfe')]]['id']);}var _0xe89b7f=_[_0xee0a('0x137')](_0x309582);_0xe89b7f[_0xee0a('0x138')]=moment()[_0xee0a('0x55')]('YYYY-MM-DD\x20HH:mm:ss');var _0x532c59=_0x15308d[_0xee0a('0xe')][_0x309582['queue']];if(ut['isFailure'](_0x5d430f['response'])){if(_0x309582[_0xee0a('0xc5')]){rpcDb[_0xee0a('0x111')](_0x309582['idContact']);}if(_0x309582[_0xee0a('0xad')]){rpcDb['disableContact'](_0x309582['idContact']);}ami['emit'](_0xee0a('0x139'),ut[_0xee0a('0xa3')](_0x309582,_0xee0a('0x13a'),this[_0xee0a('0xe')][_0x309582[_0xee0a('0x6a')]]));this[_0xee0a('0xf1')](_0xe89b7f,_0x532c59,_0x5d430f);}else{_0x309582['starttime']=moment()[_0xee0a('0x55')](_0xee0a('0x8d'));ut[_0xee0a('0xf4')](_0xe89b7f,0x4,'Answer');rpcDb[_0xee0a('0xf5')](_0xe89b7f,_0xee0a('0x13b'));}}};Preview[_0xee0a('0x9')]['syncHangup']=function(_0x3e9cc7){var _0x54f144=this;var _0x31c277=this['actions'][_0x3e9cc7[_0xee0a('0xae')]];var _0x32d8c5;if(_0x31c277){_0x32d8c5=this['campaignsPreview'][_0x31c277[_0xee0a('0x6a')]];logger[_0xee0a('0x7c')](_0xee0a('0x13c'),_0x3e9cc7[_0xee0a('0xae')],'\x20Queue',_0x32d8c5[_0xee0a('0x25')],_0xee0a('0x6b'),_0x32d8c5['pTalking']);}if(this[_0xee0a('0x10')][_0x3e9cc7[_0xee0a('0xae')]]&&_0x3e9cc7[_0xee0a('0xae')]!==_0x3e9cc7[_0xee0a('0xb1')]){if(_0x3e9cc7[_0xee0a('0x13d')]==='16'&&this['actions'][_0x3e9cc7['linkedid']][_0xee0a('0x6c')]){this[_0xee0a('0x9c')](_0x3e9cc7,_0x3e9cc7[_0xee0a('0xae')],_0x3e9cc7[_0xee0a('0x13d')]);}else if(this[_0xee0a('0x10')][_0x3e9cc7[_0xee0a('0xae')]]['dialAnswer']){logger[_0xee0a('0x7c')](_0xee0a('0x13e'),_0x3e9cc7[_0xee0a('0xae')],_0x3e9cc7['cause'],_0xee0a('0xb2'),_0x32d8c5[_0xee0a('0x25')],_0xee0a('0x6b'),_0x32d8c5[_0xee0a('0x29')]);this['callProgressDetectingCustomer'](_0x3e9cc7,_0x3e9cc7[_0xee0a('0xae')],_0x3e9cc7[_0xee0a('0x13d')]);}}else if(_0x31c277&&_['isNil'](_0x31c277[_0xee0a('0x13f')])&&_0x32d8c5['dialQueueProject']&&_0x3e9cc7['linkedid']===_0x3e9cc7[_0xee0a('0xb1')]&&_['isNil'](_0x3e9cc7['reason'])&&_0x3e9cc7[_0xee0a('0x13d')]==='16'&&_0x3e9cc7['channelstate']==='6'&&_[_0xee0a('0xf3')](_0x31c277[_0xee0a('0x140')])){if(_0x31c277[_0xee0a('0xc5')]){rpcDb[_0xee0a('0x111')](_0x31c277[_0xee0a('0x104')]);}if(_0x31c277[_0xee0a('0xad')]){rpcDb[_0xee0a('0x141')](_0x31c277[_0xee0a('0x104')]);}_0x3e9cc7['reason']='22';this['callProgressDetectingAgent'](_0x31c277,_0x32d8c5,_0x3e9cc7);}else if(_0x31c277&&_0x31c277['transfer']){if(_0x3e9cc7[_0xee0a('0x13d')]==='16'&&this[_0xee0a('0x10')][_0x3e9cc7[_0xee0a('0xae')]][_0xee0a('0x6c')]){logger[_0xee0a('0x7c')](_0xee0a('0x142'),_0x3e9cc7[_0xee0a('0xae')],_0x3e9cc7[_0xee0a('0x13d')],_0xee0a('0xb2'),_0x32d8c5[_0xee0a('0x25')],_0xee0a('0x6b'),_0x32d8c5['pTalking']);this['callProgressDetectingCustomer'](_0x3e9cc7,_0x3e9cc7[_0xee0a('0xae')],_0x3e9cc7[_0xee0a('0x13d')]);}else if(this[_0xee0a('0x10')][_0x3e9cc7[_0xee0a('0xae')]][_0xee0a('0x6c')]){logger['info']('[syncHangup][talking][cause]',_0x3e9cc7[_0xee0a('0xae')],_0x3e9cc7['cause'],_0xee0a('0xb2'),_0x32d8c5[_0xee0a('0x25')],_0xee0a('0x6b'),_0x32d8c5[_0xee0a('0x29')]);this['callProgressDetectingCustomer'](_0x3e9cc7,_0x3e9cc7[_0xee0a('0xae')],_0x3e9cc7['cause']);}}};Preview[_0xee0a('0x9')][_0xee0a('0x1a')]=function(_0xd0001e){if(this[_0xee0a('0x10')][_0xd0001e[_0xee0a('0x143')]]&&_0xd0001e[_0xee0a('0x143')]!==_0xd0001e['destuniqueid']){this[_0xee0a('0x9c')](_0xd0001e,_0xd0001e[_0xee0a('0x143')],_0xd0001e[_0xee0a('0xe7')]);}};Preview['prototype'][_0xee0a('0x18')]=function(_0x5bebad){if(this[_0xee0a('0x10')][_0x5bebad[_0xee0a('0xae')]]&&_0x5bebad[_0xee0a('0xae')]!==_0x5bebad['uniqueid']&&!this[_0xee0a('0x10')][_0x5bebad[_0xee0a('0xae')]][_0xee0a('0x6c')]){if(_0x5bebad[_0xee0a('0x13d')]==='1'){this[_0xee0a('0x9c')](_0x5bebad,_0x5bebad[_0xee0a('0xae')],_0x5bebad[_0xee0a('0x13d')]);}}};Preview[_0xee0a('0x9')]['addVariable']=function(_0xcd80be,_0x4a00dd,_0x3faf3e){if(this['actions'][_0xcd80be]){if(_['isNil'](this[_0xee0a('0x10')][_0xcd80be]['variables'])){this[_0xee0a('0x10')][_0xcd80be][_0xee0a('0x144')]={};}this[_0xee0a('0x10')][_0xcd80be][_0xee0a('0x144')][_0x4a00dd]=_0x3faf3e;}};Preview[_0xee0a('0x9')][_0xee0a('0x1d')]=function(_0x339bd3){try{if(!_[_0xee0a('0x82')](_0x339bd3)){if(ut[_0xee0a('0x145')](_[_0xee0a('0x146')](_0x339bd3['variable'])[0x0])){this['addVariable'](_0x339bd3[_0xee0a('0xb1')],_[_0xee0a('0x146')](_0x339bd3[_0xee0a('0x147')])[0x0],_0x339bd3[_0xee0a('0x148')]);}}}catch(_0x1247ea){logger[_0xee0a('0x149')](_0xee0a('0x14a'),util['inspect'](_0x1247ea,{'showHidden':![],'depth':null}));}};Preview[_0xee0a('0x9')]['syncAttendedTransfer']=function(_0x560016){if(_0x560016){if(this[_0xee0a('0x10')][_0x560016[_0xee0a('0x14b')]]){this[_0xee0a('0x10')][_0x560016[_0xee0a('0x14b')]][_0xee0a('0x140')]=!![];}}};Preview[_0xee0a('0x9')]['syncBlindTransfer']=function(_0x200cd2){if(_0x200cd2){if(this['actions'][_0x200cd2[_0xee0a('0x14c')]]){this[_0xee0a('0x10')][_0x200cd2[_0xee0a('0x14c')]][_0xee0a('0x140')]=!![];}}};module[_0xee0a('0x14d')]=Preview; \ No newline at end of file diff --git a/server/services/ami/preview/rpcDb.js b/server/services/ami/preview/rpcDb.js index e1c0090..38d2de3 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 _0x20ba=['../rpc/cmHopperHistory','../rpc/voiceQueueRt','../rpc/agentReportPreview','../rpc/voiceQueueReport','resolve','then','createHistory','catch','[createHistory]\x20','moveContactManagedDialer','checkIsBlackList','[checkIsBlackList]\x20','getContactPreview','[getContactPreview]\x20','createAgentHistory','createCustomerFinal','rescheduleContact','active','[rescheduleContact]\x20','countReScheduled','[countReScheduled]\x20','unlockContact','[activeContact]\x20','crateCustomerReportQueue','type','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','answertime','queuecallerleaveAt','connectedlinename','membername','context','from-sip','exten','xcally-motion-preview','holdtime','assigned','lastAssignedTo','COMPLETED','create','[voiceQueueReport]\x20','getContactRecallMe','[GetContactRecallMe]\x20','rescheduleContactInQueue','util','bluebird','../../../config/logger','lodash','../rpc/cmHopper'];(function(_0x11309c,_0xe18a74){var _0x3fea9c=function(_0xeb11c3){while(--_0xeb11c3){_0x11309c['push'](_0x11309c['shift']());}};_0x3fea9c(++_0xe18a74);}(_0x20ba,0x19b));var _0xa20b=function(_0x2a7b50,_0x545d55){_0x2a7b50=_0x2a7b50-0x0;var _0x4224c9=_0x20ba[_0x2a7b50];return _0x4224c9;};'use strict';var util=require(_0xa20b('0x0'));var BPromise=require(_0xa20b('0x1'));var logger=require(_0xa20b('0x2'))('preview');var _=require(_0xa20b('0x3'));var cmHopper=require(_0xa20b('0x4'));var cmHopperFinal=require('../rpc/cmHopperFinal');var cmHopperHistory=require(_0xa20b('0x5'));var cmHopperBlack=require('../rpc/cmHopperBlack');var voiceQueueRt=require(_0xa20b('0x6'));var agentReportPreview=require(_0xa20b('0x7'));var voiceQueueReport=require(_0xa20b('0x8'));function loggerCatch(_0x28131d){return function(_0x17eb50){logger['error'](_0x28131d,util['inspect'](_0x17eb50,{'showHidden':![],'depth':null}));};}function create(_0x120aaf){return BPromise[_0xa20b('0x9')]()[_0xa20b('0xa')](cmHopperHistory[_0xa20b('0xb')](_0x120aaf))['catch'](loggerCatch('[createHistory]\x20'));}function createAgent(_0x9a549e){return BPromise[_0xa20b('0x9')]()[_0xa20b('0xa')](agentReportPreview[_0xa20b('0xb')](_0x9a549e))[_0xa20b('0xc')](loggerCatch(_0xa20b('0xd')));}function moveContact(_0xd0eb3a){return BPromise[_0xa20b('0x9')]()[_0xa20b('0xa')](cmHopper[_0xa20b('0xe')](_0xd0eb3a,!![]))[_0xa20b('0xc')](loggerCatch('[moveContactManagedDialer]\x20'));}exports[_0xa20b('0xf')]=function(_0x39d0a5){return BPromise[_0xa20b('0x9')]()[_0xa20b('0xa')](cmHopperBlack[_0xa20b('0xf')](_0x39d0a5))[_0xa20b('0xc')](loggerCatch(_0xa20b('0x10')));};exports[_0xa20b('0x11')]=function(_0x2ab854){return BPromise[_0xa20b('0x9')]()[_0xa20b('0xa')](cmHopper[_0xa20b('0x11')](_0x2ab854))['catch'](loggerCatch(_0xa20b('0x12')));};exports[_0xa20b('0xb')]=function(_0x53b172,_0x4d078a){create(_0x53b172)[_0xa20b('0xc')](loggerCatch(_0x4d078a));moveContact(_0x53b172)[_0xa20b('0xc')](loggerCatch(_0x4d078a));};exports[_0xa20b('0x13')]=function(_0x266395,_0x2eb3c1){createAgent(_0x266395)[_0xa20b('0xc')](loggerCatch(_0x2eb3c1));};exports['createCustomerHistory']=function(_0x115bc5,_0x544a11){create(_0x115bc5)[_0xa20b('0xc')](loggerCatch(_0x544a11));};exports[_0xa20b('0x14')]=function(_0x37598a,_0x932a51){moveContact(_0x37598a)[_0xa20b('0xc')](loggerCatch(_0x932a51));};exports[_0xa20b('0x15')]=function(_0x232f34,_0x36913c,_0x55da28){if(_0x36913c){_0x232f34['UserId']=null;}if(_0x55da28){_0x232f34[_0xa20b('0x16')]=![];}return BPromise['resolve']()[_0xa20b('0xa')](cmHopper[_0xa20b('0x15')](_0x232f34))['catch'](loggerCatch(_0xa20b('0x17')));};exports['countReScheduled']=function(_0x20e6fa){return BPromise['resolve']()[_0xa20b('0xa')](cmHopper[_0xa20b('0x18')](_0x20e6fa))['catch'](loggerCatch(_0xa20b('0x19')));};exports[_0xa20b('0x1a')]=function(_0x64605e){return BPromise[_0xa20b('0x9')]()[_0xa20b('0xa')](cmHopper[_0xa20b('0x1a')]({'UserId':null},_0x64605e,0x1))[_0xa20b('0xc')](loggerCatch('[unlockContact]\x20'));};exports['disableContact']=function(_0x58f79c){return BPromise[_0xa20b('0x9')]()[_0xa20b('0xa')](cmHopper[_0xa20b('0x1a')]({'active':![]},_0x58f79c,0x1))[_0xa20b('0xc')](loggerCatch(_0xa20b('0x1b')));};exports[_0xa20b('0x1c')]=function(_0x43a980){var _0xbb6b74={};_0xbb6b74[_0xa20b('0x1d')]=_0x43a980[_0xa20b('0x1d')];_0xbb6b74[_0xa20b('0x1e')]=_0x43a980[_0xa20b('0x1e')];_0xbb6b74[_0xa20b('0x1f')]=_0x43a980[_0xa20b('0x1f')];_0xbb6b74[_0xa20b('0x20')]=_0x43a980[_0xa20b('0x20')];_0xbb6b74[_0xa20b('0x21')]=_0x43a980[_0xa20b('0x21')];_0xbb6b74[_0xa20b('0x22')]=_0x43a980[_0xa20b('0x23')];_0xbb6b74[_0xa20b('0x24')]=_0x43a980[_0xa20b('0x23')];_0xbb6b74['queuecallercomplete']=0x1;_0xbb6b74['queuecallercompleteAt']=_0x43a980['endtime'];_0xbb6b74[_0xa20b('0x25')]=_0x43a980[_0xa20b('0x26')];_0xbb6b74[_0xa20b('0x27')]=_0xa20b('0x28');_0xbb6b74[_0xa20b('0x29')]=_0xa20b('0x2a');_0xbb6b74[_0xa20b('0x2b')]=0x0;_0xbb6b74[_0xa20b('0x2c')]=0x1;_0xbb6b74[_0xa20b('0x2d')]=_0x43a980['membername'];_0xbb6b74['queuecallerexitreason']=_0xa20b('0x2e');return BPromise[_0xa20b('0x9')]()['then'](voiceQueueReport[_0xa20b('0x2f')](_0xbb6b74))[_0xa20b('0xc')](loggerCatch(_0xa20b('0x30')));};exports[_0xa20b('0x31')]=function(_0xbfdf32,_0x8a0734){return BPromise[_0xa20b('0x9')]()['then'](cmHopper[_0xa20b('0x31')](_0xbfdf32,_0x8a0734))[_0xa20b('0xc')](loggerCatch(_0xa20b('0x32')));};exports[_0xa20b('0x33')]=function(_0x6cd416){return BPromise[_0xa20b('0x9')]()['then'](cmHopper[_0xa20b('0x15')](_0x6cd416,!![],!![]))['catch'](loggerCatch('[rescheduleContactInQueue]\x20'));}; \ No newline at end of file +var _0xb86b=['queuecallerleaveAt','queuecallercomplete','endtime','membername','context','from-sip','exten','holdtime','assigned','lastAssignedTo','COMPLETED','create','getContactRecallMe','[GetContactRecallMe]\x20','[rescheduleContactInQueue]\x20','util','bluebird','../../../config/logger','preview','lodash','../rpc/cmHopper','../rpc/cmHopperFinal','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/agentReportPreview','../rpc/voiceQueueReport','error','inspect','then','createHistory','catch','[createHistory]\x20','resolve','moveContactManagedDialer','[moveContactManagedDialer]\x20','checkIsBlackList','[checkIsBlackList]\x20','createAgentHistory','createCustomerFinal','rescheduleContact','UserId','active','countReScheduled','[countReScheduled]\x20','unlockContact','[unlockContact]\x20','disableContact','[activeContact]\x20','crateCustomerReportQueue','type','uniqueid','calleridnum','queue','queuecallerjoinAt','answertime'];(function(_0x499668,_0x101569){var _0x499bb7=function(_0x71c7f1){while(--_0x71c7f1){_0x499668['push'](_0x499668['shift']());}};_0x499bb7(++_0x101569);}(_0xb86b,0xb4));var _0xbb86=function(_0x552fce,_0x3f24bc){_0x552fce=_0x552fce-0x0;var _0x3e27a2=_0xb86b[_0x552fce];return _0x3e27a2;};'use strict';var util=require(_0xbb86('0x0'));var BPromise=require(_0xbb86('0x1'));var logger=require(_0xbb86('0x2'))(_0xbb86('0x3'));var _=require(_0xbb86('0x4'));var cmHopper=require(_0xbb86('0x5'));var cmHopperFinal=require(_0xbb86('0x6'));var cmHopperHistory=require(_0xbb86('0x7'));var cmHopperBlack=require(_0xbb86('0x8'));var voiceQueueRt=require('../rpc/voiceQueueRt');var agentReportPreview=require(_0xbb86('0x9'));var voiceQueueReport=require(_0xbb86('0xa'));function loggerCatch(_0x472466){return function(_0x1d315b){logger[_0xbb86('0xb')](_0x472466,util[_0xbb86('0xc')](_0x1d315b,{'showHidden':![],'depth':null}));};}function create(_0x222d37){return BPromise['resolve']()[_0xbb86('0xd')](cmHopperHistory[_0xbb86('0xe')](_0x222d37))[_0xbb86('0xf')](loggerCatch(_0xbb86('0x10')));}function createAgent(_0x313e31){return BPromise['resolve']()[_0xbb86('0xd')](agentReportPreview[_0xbb86('0xe')](_0x313e31))[_0xbb86('0xf')](loggerCatch(_0xbb86('0x10')));}function moveContact(_0x54b87f){return BPromise[_0xbb86('0x11')]()[_0xbb86('0xd')](cmHopper[_0xbb86('0x12')](_0x54b87f,!![]))[_0xbb86('0xf')](loggerCatch(_0xbb86('0x13')));}exports[_0xbb86('0x14')]=function(_0x268fe6){return BPromise[_0xbb86('0x11')]()['then'](cmHopperBlack[_0xbb86('0x14')](_0x268fe6))[_0xbb86('0xf')](loggerCatch(_0xbb86('0x15')));};exports['getContactPreview']=function(_0x2f383d){return BPromise['resolve']()[_0xbb86('0xd')](cmHopper['getContactPreview'](_0x2f383d))[_0xbb86('0xf')](loggerCatch('[getContactPreview]\x20'));};exports[_0xbb86('0xe')]=function(_0x2e7840,_0x58371b){create(_0x2e7840)['catch'](loggerCatch(_0x58371b));moveContact(_0x2e7840)[_0xbb86('0xf')](loggerCatch(_0x58371b));};exports[_0xbb86('0x16')]=function(_0x50eed6,_0x5588c8){createAgent(_0x50eed6)[_0xbb86('0xf')](loggerCatch(_0x5588c8));};exports['createCustomerHistory']=function(_0x179030,_0x317d58){create(_0x179030)['catch'](loggerCatch(_0x317d58));};exports[_0xbb86('0x17')]=function(_0x1c36b3,_0x8d9221){moveContact(_0x1c36b3)[_0xbb86('0xf')](loggerCatch(_0x8d9221));};exports[_0xbb86('0x18')]=function(_0x1b88dc,_0x367ec2,_0x410a8e){if(_0x367ec2){_0x1b88dc[_0xbb86('0x19')]=null;}if(_0x410a8e){_0x1b88dc[_0xbb86('0x1a')]=![];}return BPromise[_0xbb86('0x11')]()[_0xbb86('0xd')](cmHopper[_0xbb86('0x18')](_0x1b88dc))['catch'](loggerCatch('[rescheduleContact]\x20'));};exports[_0xbb86('0x1b')]=function(_0x24abcc){return BPromise[_0xbb86('0x11')]()['then'](cmHopper[_0xbb86('0x1b')](_0x24abcc))['catch'](loggerCatch(_0xbb86('0x1c')));};exports[_0xbb86('0x1d')]=function(_0xb7ae7c){return BPromise[_0xbb86('0x11')]()['then'](cmHopper[_0xbb86('0x1d')]({'UserId':null},_0xb7ae7c,0x1))[_0xbb86('0xf')](loggerCatch(_0xbb86('0x1e')));};exports[_0xbb86('0x1f')]=function(_0x39c087){return BPromise[_0xbb86('0x11')]()[_0xbb86('0xd')](cmHopper['unlockContact']({'active':![]},_0x39c087,0x1))[_0xbb86('0xf')](loggerCatch(_0xbb86('0x20')));};exports[_0xbb86('0x21')]=function(_0x444dc3){var _0x2a09aa={};_0x2a09aa['type']=_0x444dc3[_0xbb86('0x22')];_0x2a09aa['uniqueid']=_0x444dc3[_0xbb86('0x23')];_0x2a09aa[_0xbb86('0x24')]=_0x444dc3[_0xbb86('0x24')];_0x2a09aa['calleridname']=_0x444dc3['calleridname'];_0x2a09aa[_0xbb86('0x25')]=_0x444dc3[_0xbb86('0x25')];_0x2a09aa[_0xbb86('0x26')]=_0x444dc3[_0xbb86('0x27')];_0x2a09aa[_0xbb86('0x28')]=_0x444dc3[_0xbb86('0x27')];_0x2a09aa[_0xbb86('0x29')]=0x1;_0x2a09aa['queuecallercompleteAt']=_0x444dc3[_0xbb86('0x2a')];_0x2a09aa['connectedlinename']=_0x444dc3[_0xbb86('0x2b')];_0x2a09aa[_0xbb86('0x2c')]=_0xbb86('0x2d');_0x2a09aa[_0xbb86('0x2e')]='xcally-motion-preview';_0x2a09aa[_0xbb86('0x2f')]=0x0;_0x2a09aa[_0xbb86('0x30')]=0x1;_0x2a09aa[_0xbb86('0x31')]=_0x444dc3[_0xbb86('0x2b')];_0x2a09aa['queuecallerexitreason']=_0xbb86('0x32');return BPromise['resolve']()[_0xbb86('0xd')](voiceQueueReport[_0xbb86('0x33')](_0x2a09aa))[_0xbb86('0xf')](loggerCatch('[voiceQueueReport]\x20'));};exports['getContactRecallMe']=function(_0x5ac266,_0x36213c){return BPromise['resolve']()['then'](cmHopper[_0xbb86('0x34')](_0x5ac266,_0x36213c))[_0xbb86('0xf')](loggerCatch(_0xbb86('0x35')));};exports['rescheduleContactInQueue']=function(_0x1e5738){return BPromise['resolve']()[_0xbb86('0xd')](cmHopper[_0xbb86('0x18')](_0x1e5738,!![],!![]))[_0xbb86('0xf')](loggerCatch(_0xbb86('0x36')));}; \ 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 4fcafd5..ea8e4b2 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 _0xe003=['toLower','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','YYYY-MM-DD\x20HH:mm:ss','state','statedesc','Blacklist','starttime','responsetime','endtime','logAgent','ringtime','logLookAgent','UserId','logCustomer','talktime','answertime','variablesAction','RECALL','uniqueid','originate','from-sip','timeout','totalGlobal','countbusyretry','countcongestionretry','countnoanswerretry','countagentrejectretry','countnosuchnumberretry','cloneAction','clone','Global','scheduledAt','active','scheduledat','add','ContactId','ListId','pTalking','[decrementTalkink]\x20object\x20talking\x20is\x20negative','[decrementTalkink]\x20is\x20null\x20or\x20undefined','buildObj','lastevent','queue','interface','channelAgent','motionChannel','mandatoryDisposition','buildAcw','not_inuse','status','reachable','getDiff','createBody','filterKey','idContact','type','campaigntype','dialAnswer','countglobal','callback','callbackuniqueid','callbackat','recallme','sipcallid','xmd-voicequeueid','xmd-queue','xmd-listid','xmd-dialurl','xmd-dialtimeout','xmd-dialid','xmd-dialchannel','xmd-contactid','xmd-cdrtype','xmd-callerid','xmd-agiafter','xmd-agi','rtpaudioqos','rtpaudioqosjitter','rtpaudioqosloss','rtpaudioqosrttbridged','rtpaudioqosbridged','rtpaudioqosjitterbridged','rtpaudioqoslossbridged','rtpaudioqosrtt','bridgepeer','bridgepvtcallid','pow','replace','random','extractCalleridName','match','extractCalleridNumber','util','lodash','moment','env','127.0.0.1','milliseconds','diff','seconds','loggerCatch','error','inspect','logger','info','loggerError','getCallerId','isUndefined','string','isEmpty','\x22%s\x22\x20<%s>','format','\x22\x22\x20<>','isActive','isNil','addVariables','Queue','name','calleridname','calleridnum','dialer','VoiceQueueId','\x22rtTxX%s%s\x22','dialQueueProject2','monitor_format','U(xcally-mixmonitor-context)','dialPreviewUrl','dialQueueProject','\x22agi://%s/square,%s\x22','NONE','originatecalleridnum','originatecalleridname','xcally-motion-preview','Call-Type:\x20PREVIEW','_XCALLY_MIXMONITOR_FORMAT','_XCALLY_MIXMONITOR_UNIQUEID','Contact','hasOwnProperty','tags','createdAt','updatedAt','%s%s','XMD-','toUpper','toLowerVariables'];(function(_0x380a27,_0x59ce81){var _0x19d7a7=function(_0x3932bd){while(--_0x3932bd){_0x380a27['push'](_0x380a27['shift']());}};_0x19d7a7(++_0x59ce81);}(_0xe003,0xef));var _0x3e00=function(_0x1e627b,_0x1a7a46){_0x1e627b=_0x1e627b-0x0;var _0x6f4c24=_0xe003[_0x1e627b];return _0x6f4c24;};'use strict';var util=require(_0x3e00('0x0'));var _=require(_0x3e00('0x1'));var moment=require(_0x3e00('0x2'));var logger=require('../../../../config/logger')('preview');var ipAgi=process[_0x3e00('0x3')]['XCALLY_IP_AGI']||_0x3e00('0x4');function getSeconds(_0x447338,_0x10b625){var _0x2b32bd=moment(_0x447338)[_0x3e00('0x5')](0x0);var _0x56a80f=moment(_0x10b625)[_0x3e00('0x5')](0x0);return _0x2b32bd[_0x3e00('0x6')](_0x56a80f,_0x3e00('0x7'));}exports[_0x3e00('0x8')]=function(_0x322d64){return function(_0x8da1c0){logger[_0x3e00('0x9')](_0x322d64,util[_0x3e00('0xa')](_0x8da1c0,{'showHidden':![],'depth':null}));};};exports[_0x3e00('0xb')]=function(_0x43d7b5,_0x5d5828){logger[_0x3e00('0xc')](_0x43d7b5,util[_0x3e00('0xa')](_0x5d5828,{'showHidden':![],'depth':null}));};exports[_0x3e00('0xd')]=function(_0x34da3d,_0x36504a){logger['error'](_0x34da3d,util[_0x3e00('0xa')](_0x36504a,{'showHidden':![],'depth':null}));};exports['logger2']=function(_0x2cb703){return function(_0x16ebbe){logger[_0x3e00('0xc')](_0x2cb703,util[_0x3e00('0xa')](_0x16ebbe,{'showHidden':![],'depth':null}));};};exports['message']=function(_0x532acb,_0x3491fb,_0x1c8f44){return{'message':_0x532acb,'unlock':_0x3491fb,'active':_0x1c8f44};};exports[_0x3e00('0xe')]=function(_0xd6485d,_0x1f6ed9,_0x2117ae){if(!_[_0x3e00('0xf')](_0x2117ae)&&_0x3e00('0x10')===typeof _0x2117ae&&!_['isEmpty'](_0x2117ae)){if(!_[_0x3e00('0xf')](_0x1f6ed9)&&_0x3e00('0x10')===typeof _0x1f6ed9&&!_[_0x3e00('0x11')](_0x1f6ed9)){return util['format'](_0x3e00('0x12'),_0x1f6ed9,_0x2117ae);}return util[_0x3e00('0x13')](_0x3e00('0x12'),_0x2117ae,_0x2117ae);}if(!_[_0x3e00('0xf')](_0xd6485d)&&_0x3e00('0x10')===typeof _0xd6485d&&!_[_0x3e00('0x11')](_0xd6485d)){return _0xd6485d;}return _0x3e00('0x14');};exports[_0x3e00('0x15')]=function(_0x8a90ff){if(_[_0x3e00('0x16')](_0x8a90ff)){return![];}return _0x8a90ff;};exports[_0x3e00('0x17')]=function(_0x3e8b2f,_0x5b23ec,_0x5162f9,_0x2d6458,_0x467671,_0x44a999){var _0x38fd82={'XMD-QUEUE':_0x5b23ec['Queue']?_0x5b23ec[_0x3e00('0x18')][_0x3e00('0x19')]:'','XMD-CALLERID':_0x2d6458,'XMD-CALLERID-PREVIEW':_0x44a999?util['format']('\x22%s\x22\x20<%s>',_0x44a999[_0x3e00('0x1a')],_0x44a999[_0x3e00('0x1b')]):_0x2d6458,'XMD-DIALID':_0x467671,'XMD-CONTACTID':_0x5b23ec['ContactId'],'XMD-CDRTYPE':_0x3e00('0x1c'),'CALLERID(all)':_0x2d6458,'XMD-VOICEQUEUEID':_0x5b23ec[_0x3e00('0x1d')],'XMD-DIALCHANNEL':_0x5162f9,'XMD-DIALTIMEOUT':_0x3e8b2f['dialOriginateTimeout']||0x1e,'XMD-DIALOPTIONS':util['format'](_0x3e00('0x1e'),_0x3e8b2f[_0x3e00('0x1f')]?'g':'',_[_0x3e00('0x11')](_0x3e8b2f[_0x3e00('0x20')])?'':_0x3e00('0x21')),'XMD-DIALURL':_0x3e8b2f[_0x3e00('0x22')]||'','XMD-AGI':_0x3e8b2f[_0x3e00('0x23')]?util[_0x3e00('0x13')](_0x3e00('0x24'),ipAgi,_0x3e8b2f['dialQueueProject']):'NONE','XMD-AGIAFTER':_0x3e8b2f[_0x3e00('0x1f')]?util[_0x3e00('0x13')](_0x3e00('0x24'),ipAgi,_0x3e8b2f['dialQueueProject2']):_0x3e00('0x25'),'XMD-ORIGINATECALLERIDNUM':_0x44a999?_0x44a999[_0x3e00('0x26')]:'','XMD-ORIGINATECALLERIDNAME':_0x44a999?_0x44a999[_0x3e00('0x27')]:'','XMD-DESTINATION':_0x3e00('0x28'),'SIPADDHEADER':_0x3e00('0x29')};if(!_['isEmpty'](_0x3e8b2f[_0x3e00('0x20')])){_0x38fd82[util[_0x3e00('0x13')]('%s',_0x3e00('0x2a'))]=_0x3e8b2f[_0x3e00('0x20')];_0x38fd82[util[_0x3e00('0x13')]('%s',_0x3e00('0x2b'))]=_0x467671;}if(_0x5b23ec&&_0x5b23ec[_0x3e00('0x2c')]){for(var _0x1a7bd9 in _0x5b23ec[_0x3e00('0x2c')]){if(_0x5b23ec[_0x3e00('0x2c')][_0x3e00('0x2d')](_0x1a7bd9)){if(!_['isNil'](_0x5b23ec[_0x3e00('0x2c')][_0x1a7bd9])&&_0x1a7bd9!=='id'&&_0x1a7bd9!==_0x3e00('0x2e')&&_0x1a7bd9!==_0x3e00('0x2f')&&_0x1a7bd9!==_0x3e00('0x30')){_0x38fd82[util[_0x3e00('0x13')](_0x3e00('0x31'),_0x3e00('0x32'),_[_0x3e00('0x33')](_0x1a7bd9))]=_0x5b23ec[_0x3e00('0x2c')][_0x1a7bd9];}}}}return _0x38fd82;};exports[_0x3e00('0x34')]=function(_0x23c970){var _0x3430bd={};for(var _0x4e41a1 in _0x23c970){if(_0x23c970[_0x3e00('0x2d')](_0x4e41a1)){_0x3430bd[util['format']('%s',_[_0x3e00('0x35')](_0x4e41a1))]=_0x23c970[_0x4e41a1];}}return{'variables':_0x3430bd};};exports['updateOriginated']=function(_0x48e758,_0x104192){if(!_[_0x3e00('0x16')](_0x48e758)){if(_0x48e758[_0x3e00('0x2d')](_0x3e00('0x36'))){if(_0x48e758['originated']>0x0){_0x48e758[_0x3e00('0x36')]-=0x1;}else{logger[_0x3e00('0x9')](_0x3e00('0x37'),_0x104192);}}}else{logger[_0x3e00('0x9')]('[updateOriginated]\x20is\x20null\x20or\x20undefined',_0x104192);}};exports['logBlacklist']=function(_0x2d5235){var _0x49857f=moment()[_0x3e00('0x13')](_0x3e00('0x38'));_0x2d5235[_0x3e00('0x39')]=0xd;_0x2d5235[_0x3e00('0x3a')]=_0x3e00('0x3b');_0x2d5235[_0x3e00('0x3c')]=_0x49857f;_0x2d5235[_0x3e00('0x3d')]=_0x49857f;_0x2d5235[_0x3e00('0x3e')]=_0x49857f;};exports[_0x3e00('0x3f')]=function(_0x150dc2,_0x47b86b,_0x4ca628){var _0x53eda2=moment()['format'](_0x3e00('0x38'));_0x150dc2['state']=_0x47b86b;_0x150dc2[_0x3e00('0x3a')]=_0x4ca628;_0x150dc2[_0x3e00('0x3d')]=_0x53eda2;_0x150dc2[_0x3e00('0x40')]=getSeconds(_0x150dc2[_0x3e00('0x3d')],_0x150dc2[_0x3e00('0x3c')]);};exports[_0x3e00('0x41')]=function(_0x3fdb14,_0x481f5b,_0x9d0954){_0x3fdb14['membername']=_0x481f5b;_0x3fdb14[_0x3e00('0x42')]=_0x9d0954;};exports[_0x3e00('0x43')]=function(_0x1540b4,_0x57ee73,_0x18f60c){var _0x126a8c=moment()[_0x3e00('0x13')](_0x3e00('0x38'));_0x1540b4['state']=_0x57ee73;_0x1540b4[_0x3e00('0x3a')]=_0x18f60c;_0x1540b4[_0x3e00('0x3d')]=_0x1540b4[_0x3e00('0x3d')]?_0x1540b4[_0x3e00('0x3d')]:_0x126a8c;_0x1540b4[_0x3e00('0x3e')]=_0x1540b4[_0x3e00('0x3e')]?_0x1540b4[_0x3e00('0x3e')]:_0x126a8c;_0x1540b4[_0x3e00('0x40')]=getSeconds(_0x1540b4[_0x3e00('0x3d')]||0x0,_0x1540b4[_0x3e00('0x3c')]||0x0);_0x1540b4[_0x3e00('0x44')]=_0x1540b4[_0x3e00('0x45')]?getSeconds(_0x1540b4[_0x3e00('0x3e')],_0x1540b4[_0x3e00('0x45')]):0x0;};exports['isFailure']=function(_0x1fbade){return _0x1fbade==='Failure';};exports[_0x3e00('0x46')]=function(_0x55a170,_0x2fcd6a,_0x1a745c,_0x1c8a5b,_0x8a883c){var _0x18bfe4=_0x1c8a5b?_0x3e00('0x47'):_0x55a170['calleridname'];_0x18bfe4=_0x8a883c?'BOOKED':_0x18bfe4;return{'actionid':_0x55a170[_0x3e00('0x48')],'action':_0x3e00('0x49'),'channel':_0x55a170['channelAgent'],'callerid':util[_0x3e00('0x13')](_0x3e00('0x12'),_0x18bfe4,_0x55a170[_0x3e00('0x1b')]),'Exten':'xcally-motion-preview','Context':_0x3e00('0x4a'),'Priority':'1','variable':_0x1a745c,'timeout':(_0x2fcd6a[_0x3e00('0x4b')]||0x1e)*0x3e8,'async':!![],'channelid':_0x55a170['uniqueid']};};exports[_0x3e00('0x4c')]=function(_0x1b29bd){return _0x1b29bd[_0x3e00('0x4d')]+_0x1b29bd[_0x3e00('0x4e')]+_0x1b29bd[_0x3e00('0x4f')]+_0x1b29bd[_0x3e00('0x50')]+_0x1b29bd[_0x3e00('0x51')];};exports[_0x3e00('0x52')]=function(_0x27ecac){var _0x2a0f05=_[_0x3e00('0x53')](_0x27ecac);_0x2a0f05[_0x3e00('0x39')]=0xf;_0x2a0f05[_0x3e00('0x3a')]=_0x3e00('0x54');return _0x2a0f05;};exports[_0x3e00('0x55')]=function(_0x31b05a,_0xe43d1f,_0x56c23a){var _0x3d9d28={};_0x3d9d28[_0xe43d1f]=_0x31b05a[_0xe43d1f];_0x3d9d28[_0x3e00('0x56')]=![];_0x3d9d28[_0x3e00('0x57')]=moment()[_0x3e00('0x58')](_0x56c23a,'minutes')[_0x3e00('0x13')](_0x3e00('0x38'));_0x3d9d28[_0x3e00('0x59')]=_0x31b05a[_0x3e00('0x59')];_0x3d9d28[_0x3e00('0x5a')]=_0x31b05a[_0x3e00('0x5a')];_0x3d9d28[_0x3e00('0x1d')]=_0x31b05a[_0x3e00('0x1d')]||undefined;return _0x3d9d28;};exports['decrementTalkink']=function(_0x4b97d9,_0x31fed4){if(!_[_0x3e00('0x16')](_0x4b97d9)){if(_0x4b97d9[_0x3e00('0x5b')]>0x0){_0x4b97d9[_0x3e00('0x5b')]-=0x1;}else{logger[_0x3e00('0x9')](_0x31fed4,_0x3e00('0x5c'));}}else{logger['error'](_0x31fed4,_0x3e00('0x5d'));}};exports['IsNotLoggedIn']=function(_0x4be6a3){if(_0x4be6a3<=0x0){return!![];}return![];};exports[_0x3e00('0x5e')]=function(_0x1f2927,_0x4ae56a,_0x19536a){_0x1f2927[_0x3e00('0x5f')]=_0x4ae56a;_0x1f2927[_0x3e00('0x19')]=_0x1f2927[_0x3e00('0x60')];_0x1f2927[_0x3e00('0x61')]=_0x1f2927[_0x3e00('0x62')];_0x1f2927[_0x3e00('0x63')]='voice';if(_0x19536a){_0x1f2927['mandatoryDisposition']=_0x19536a[_0x3e00('0x64')];}return _0x1f2927;};exports[_0x3e00('0x65')]=function(_0x376301){var _0x82b42b={};_0x82b42b['queue']=_0x376301[_0x3e00('0x60')];_0x82b42b[_0x3e00('0x61')]=_0x376301[_0x3e00('0x62')];_0x82b42b[_0x3e00('0x48')]=_0x376301[_0x3e00('0x48')];return _0x82b42b;};exports['agentReadyId']=function(_0x5df822){var _0x25c502=[];for(var _0x383fe2 in _0x5df822){if(_0x5df822[_0x3e00('0x2d')](_0x383fe2)){if(!_[_0x3e00('0x16')](_0x5df822[_0x383fe2])&&_0x5df822[_0x383fe2]['state']===_0x3e00('0x66')&&_0x5df822[_0x383fe2][_0x3e00('0x67')]===_0x3e00('0x68')){_0x25c502['push'](_0x5df822[_0x383fe2]['id']);}}}return _0x25c502;};exports[_0x3e00('0x69')]=function(_0x5cae03){var _0x103361=moment()[_0x3e00('0x5')](0x0);var _0xe0b497=moment(_0x5cae03)[_0x3e00('0x5')](0x0);return _0x103361[_0x3e00('0x6')](_0xe0b497,'seconds');};exports[_0x3e00('0x6a')]=function(_0x159fee){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x159fee[_0x3e00('0x59')],'ListId':_0x159fee[_0x3e00('0x5a')],'VoiceQueueId':_0x159fee[_0x3e00('0x1d')]||undefined,'CampaignId':_0x159fee['CampaignId']||undefined};};exports[_0x3e00('0x6b')]=function(_0x2c7da9){if(_0x2c7da9==='uniqueid'||_0x2c7da9===_0x3e00('0x6c')||_0x2c7da9===_0x3e00('0x60')||_0x2c7da9===_0x3e00('0x6d')||_0x2c7da9===_0x3e00('0x6e')||_0x2c7da9===_0x3e00('0x6f')||_0x2c7da9==='membername'||_0x2c7da9===_0x3e00('0x62')||_0x2c7da9===_0x3e00('0x1a')||_0x2c7da9===_0x3e00('0x56')||_0x2c7da9===_0x3e00('0x1b')||_0x2c7da9===_0x3e00('0x57')||_0x2c7da9===_0x3e00('0x4d')||_0x2c7da9===_0x3e00('0x4e')||_0x2c7da9==='countnoanswerretry'||_0x2c7da9===_0x3e00('0x70')||_0x2c7da9===_0x3e00('0x71')||_0x2c7da9===_0x3e00('0x72')||_0x2c7da9===_0x3e00('0x73')||_0x2c7da9===_0x3e00('0x74')||_0x2c7da9===_0x3e00('0x59')||_0x2c7da9==='ListId'||_0x2c7da9===_0x3e00('0x42')||_0x2c7da9===_0x3e00('0x1d')||_0x2c7da9===_0x3e00('0x75')||_0x2c7da9===_0x3e00('0x76')||_0x2c7da9===_0x3e00('0x77')||_0x2c7da9==='xmd-phone'||_0x2c7da9===_0x3e00('0x78')||_0x2c7da9===_0x3e00('0x79')||_0x2c7da9===_0x3e00('0x7a')||_0x2c7da9==='xmd-dialoptions'||_0x2c7da9===_0x3e00('0x7b')||_0x2c7da9===_0x3e00('0x7c')||_0x2c7da9===_0x3e00('0x7d')||_0x2c7da9===_0x3e00('0x7e')||_0x2c7da9===_0x3e00('0x7f')||_0x2c7da9===_0x3e00('0x80')||_0x2c7da9===_0x3e00('0x81')||_0x2c7da9===_0x3e00('0x82')||_0x2c7da9==='rtpaudioqosbridged'||_0x2c7da9===_0x3e00('0x83')||_0x2c7da9==='rtpaudioqosjitterbridged'||_0x2c7da9===_0x3e00('0x84')||_0x2c7da9==='rtpaudioqoslossbridged'||_0x2c7da9==='rtpaudioqosrtt'||_0x2c7da9===_0x3e00('0x85')||_0x2c7da9==='rtpaudioqos'||_0x2c7da9===_0x3e00('0x86')||_0x2c7da9===_0x3e00('0x83')||_0x2c7da9===_0x3e00('0x87')||_0x2c7da9===_0x3e00('0x84')||_0x2c7da9===_0x3e00('0x88')||_0x2c7da9===_0x3e00('0x89')||_0x2c7da9===_0x3e00('0x85')||_0x2c7da9===_0x3e00('0x8a')||_0x2c7da9===_0x3e00('0x8b')||_0x2c7da9===_0x3e00('0x39')||_0x2c7da9==='statedesc'){return![];}return!![];};exports['getCallerIdRandom']=function(_0x56bb59,_0x1f0e91){var _0x5748a2,_0x4cbcbe,_0x3e32ec;if(_0x1f0e91<=0x0){_0x1f0e91=0x1;}_0x5748a2=new RegExp('\x5cw{0,'+_0x1f0e91+'}$');_0x4cbcbe=Math[_0x3e00('0x8c')](0xa,_0x1f0e91-0x1);_0x3e32ec=Math[_0x3e00('0x8c')](0xa,_0x1f0e91)-0x1;return util[_0x3e00('0x13')]('%s',_[_0x3e00('0x8d')](_0x56bb59,_0x5748a2,_[_0x3e00('0x8e')](_0x4cbcbe,_0x3e32ec)));};exports[_0x3e00('0x8f')]=function(_0x42d712){var _0x40094a=_0x42d712[_0x3e00('0x90')](/"(.*?)"/);return _0x40094a?_0x40094a[0x1]:_0x42d712;};exports[_0x3e00('0x91')]=function(_0x4caabf){var _0x592b5b=_0x4caabf[_0x3e00('0x90')](/<(.*?)>/);return _0x592b5b?_0x592b5b[0x1]:_0x4caabf;}; \ No newline at end of file +var _0x18c1=['buildAcw','agentReadyId','status','reachable','push','getDiff','milliseconds','seconds','createBody','CampaignId','filterKey','idContact','type','campaigntype','dialAnswer','active','countglobal','callbackat','recallme','sipcallid','xmd-voicequeueid','xmd-queue','xmd-dialurl','xmd-dialoptions','xmd-dialid','xmd-dialchannel','xmd-agiafter','xmd-agi','rtpaudioqos','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','rtpaudioqosbridged','rtpaudioqosloss','bridgepeer','bridgepvtcallid','getCallerIdRandom','\x5cw{0,','random','extractCalleridName','match','extractCalleridNumber','util','lodash','moment','../../../../config/logger','preview','XCALLY_IP_AGI','diff','loggerCatch','inspect','logger','info','loggerError','logger2','message','getCallerId','isUndefined','string','format','\x22%s\x22\x20<%s>','isEmpty','\x22\x22\x20<>','isActive','addVariables','Queue','dialer','VoiceQueueId','dialOriginateTimeout','\x22rtTxX%s%s\x22','dialQueueProject2','monitor_format','U(xcally-mixmonitor-context)','dialPreviewUrl','dialQueueProject','NONE','originatecalleridname','Call-Type:\x20PREVIEW','_XCALLY_MIXMONITOR_FORMAT','_XCALLY_MIXMONITOR_UNIQUEID','Contact','isNil','tags','createdAt','updatedAt','%s%s','XMD-','toUpper','toLowerVariables','toLower','updateOriginated','hasOwnProperty','originated','error','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','logBlacklist','YYYY-MM-DD\x20HH:mm:ss','statedesc','Blacklist','responsetime','endtime','ringtime','starttime','logLookAgent','membername','UserId','logCustomer','state','talktime','answertime','isFailure','Failure','variablesAction','RECALL','calleridname','BOOKED','uniqueid','originate','calleridnum','xcally-motion-preview','from-sip','totalGlobal','countbusyretry','countcongestionretry','countnoanswerretry','countagentrejectretry','cloneAction','clone','scheduledAt','scheduledat','add','minutes','ContactId','ListId','decrementTalkink','pTalking','[decrementTalkink]\x20object\x20talking\x20is\x20negative','[decrementTalkink]\x20is\x20null\x20or\x20undefined','IsNotLoggedIn','buildObj','lastevent','name','queue','interface','channelAgent','voice','mandatoryDisposition'];(function(_0x32b122,_0x1ad490){var _0x4ad25a=function(_0x590ee6){while(--_0x590ee6){_0x32b122['push'](_0x32b122['shift']());}};_0x4ad25a(++_0x1ad490);}(_0x18c1,0x1ee));var _0x118c=function(_0x1dbb6e,_0x4e6a3f){_0x1dbb6e=_0x1dbb6e-0x0;var _0x89b7a1=_0x18c1[_0x1dbb6e];return _0x89b7a1;};'use strict';var util=require(_0x118c('0x0'));var _=require(_0x118c('0x1'));var moment=require(_0x118c('0x2'));var logger=require(_0x118c('0x3'))(_0x118c('0x4'));var ipAgi=process['env'][_0x118c('0x5')]||'127.0.0.1';function getSeconds(_0x518ba4,_0x394557){var _0x589c84=moment(_0x518ba4)['milliseconds'](0x0);var _0x3bcec1=moment(_0x394557)['milliseconds'](0x0);return _0x589c84[_0x118c('0x6')](_0x3bcec1,'seconds');}exports[_0x118c('0x7')]=function(_0xff7cde){return function(_0x2d15c5){logger['error'](_0xff7cde,util[_0x118c('0x8')](_0x2d15c5,{'showHidden':![],'depth':null}));};};exports[_0x118c('0x9')]=function(_0x2bf856,_0x254ba7){logger[_0x118c('0xa')](_0x2bf856,util[_0x118c('0x8')](_0x254ba7,{'showHidden':![],'depth':null}));};exports[_0x118c('0xb')]=function(_0x51872c,_0x40d7bd){logger['error'](_0x51872c,util['inspect'](_0x40d7bd,{'showHidden':![],'depth':null}));};exports[_0x118c('0xc')]=function(_0x7bb6fe){return function(_0x5136fd){logger['info'](_0x7bb6fe,util['inspect'](_0x5136fd,{'showHidden':![],'depth':null}));};};exports[_0x118c('0xd')]=function(_0x12f0a1,_0x3504a1,_0x23c7f6){return{'message':_0x12f0a1,'unlock':_0x3504a1,'active':_0x23c7f6};};exports[_0x118c('0xe')]=function(_0xf7b936,_0x1a5c57,_0x50e923){if(!_[_0x118c('0xf')](_0x50e923)&&_0x118c('0x10')===typeof _0x50e923&&!_['isEmpty'](_0x50e923)){if(!_[_0x118c('0xf')](_0x1a5c57)&&_0x118c('0x10')===typeof _0x1a5c57&&!_['isEmpty'](_0x1a5c57)){return util[_0x118c('0x11')](_0x118c('0x12'),_0x1a5c57,_0x50e923);}return util[_0x118c('0x11')](_0x118c('0x12'),_0x50e923,_0x50e923);}if(!_['isUndefined'](_0xf7b936)&&_0x118c('0x10')===typeof _0xf7b936&&!_[_0x118c('0x13')](_0xf7b936)){return _0xf7b936;}return _0x118c('0x14');};exports[_0x118c('0x15')]=function(_0x41ed7c){if(_['isNil'](_0x41ed7c)){return![];}return _0x41ed7c;};exports[_0x118c('0x16')]=function(_0x1d52df,_0x45ec9f,_0x153e03,_0x496dec,_0xef6f53,_0x3704e8){var _0x15d9c8={'XMD-QUEUE':_0x45ec9f[_0x118c('0x17')]?_0x45ec9f[_0x118c('0x17')]['name']:'','XMD-CALLERID':_0x496dec,'XMD-CALLERID-PREVIEW':_0x3704e8?util[_0x118c('0x11')]('\x22%s\x22\x20<%s>',_0x3704e8['calleridname'],_0x3704e8['calleridnum']):_0x496dec,'XMD-DIALID':_0xef6f53,'XMD-CONTACTID':_0x45ec9f['ContactId'],'XMD-CDRTYPE':_0x118c('0x18'),'CALLERID(all)':_0x496dec,'XMD-VOICEQUEUEID':_0x45ec9f[_0x118c('0x19')],'XMD-DIALCHANNEL':_0x153e03,'XMD-DIALTIMEOUT':_0x1d52df[_0x118c('0x1a')]||0x1e,'XMD-DIALOPTIONS':util[_0x118c('0x11')](_0x118c('0x1b'),_0x1d52df[_0x118c('0x1c')]?'g':'',_[_0x118c('0x13')](_0x1d52df[_0x118c('0x1d')])?'':_0x118c('0x1e')),'XMD-DIALURL':_0x1d52df[_0x118c('0x1f')]||'','XMD-AGI':_0x1d52df[_0x118c('0x20')]?util[_0x118c('0x11')]('\x22agi://%s/square,%s\x22',ipAgi,_0x1d52df[_0x118c('0x20')]):_0x118c('0x21'),'XMD-AGIAFTER':_0x1d52df[_0x118c('0x1c')]?util[_0x118c('0x11')]('\x22agi://%s/square,%s\x22',ipAgi,_0x1d52df[_0x118c('0x1c')]):_0x118c('0x21'),'XMD-ORIGINATECALLERIDNUM':_0x3704e8?_0x3704e8['originatecalleridnum']:'','XMD-ORIGINATECALLERIDNAME':_0x3704e8?_0x3704e8[_0x118c('0x22')]:'','XMD-DESTINATION':'xcally-motion-preview','SIPADDHEADER':_0x118c('0x23')};if(!_['isEmpty'](_0x1d52df['monitor_format'])){_0x15d9c8[util[_0x118c('0x11')]('%s',_0x118c('0x24'))]=_0x1d52df[_0x118c('0x1d')];_0x15d9c8[util[_0x118c('0x11')]('%s',_0x118c('0x25'))]=_0xef6f53;}if(_0x45ec9f&&_0x45ec9f[_0x118c('0x26')]){for(var _0x4e3130 in _0x45ec9f[_0x118c('0x26')]){if(_0x45ec9f[_0x118c('0x26')]['hasOwnProperty'](_0x4e3130)){if(!_[_0x118c('0x27')](_0x45ec9f[_0x118c('0x26')][_0x4e3130])&&_0x4e3130!=='id'&&_0x4e3130!==_0x118c('0x28')&&_0x4e3130!==_0x118c('0x29')&&_0x4e3130!==_0x118c('0x2a')){_0x15d9c8[util[_0x118c('0x11')](_0x118c('0x2b'),_0x118c('0x2c'),_[_0x118c('0x2d')](_0x4e3130))]=_0x45ec9f[_0x118c('0x26')][_0x4e3130];}}}}return _0x15d9c8;};exports[_0x118c('0x2e')]=function(_0x34ffe1){var _0x17c4e4={};for(var _0xfe8c40 in _0x34ffe1){if(_0x34ffe1['hasOwnProperty'](_0xfe8c40)){_0x17c4e4[util[_0x118c('0x11')]('%s',_[_0x118c('0x2f')](_0xfe8c40))]=_0x34ffe1[_0xfe8c40];}}return{'variables':_0x17c4e4};};exports[_0x118c('0x30')]=function(_0x146eba,_0x40ebb9){if(!_['isNil'](_0x146eba)){if(_0x146eba[_0x118c('0x31')](_0x118c('0x32'))){if(_0x146eba['originated']>0x0){_0x146eba['originated']-=0x1;}else{logger[_0x118c('0x33')](_0x118c('0x34'),_0x40ebb9);}}}else{logger[_0x118c('0x33')](_0x118c('0x35'),_0x40ebb9);}};exports[_0x118c('0x36')]=function(_0x17983e){var _0x229679=moment()[_0x118c('0x11')](_0x118c('0x37'));_0x17983e['state']=0xd;_0x17983e[_0x118c('0x38')]=_0x118c('0x39');_0x17983e['starttime']=_0x229679;_0x17983e[_0x118c('0x3a')]=_0x229679;_0x17983e[_0x118c('0x3b')]=_0x229679;};exports['logAgent']=function(_0x1bc06c,_0x587303,_0x404ebc){var _0x1087e1=moment()[_0x118c('0x11')](_0x118c('0x37'));_0x1bc06c['state']=_0x587303;_0x1bc06c[_0x118c('0x38')]=_0x404ebc;_0x1bc06c[_0x118c('0x3a')]=_0x1087e1;_0x1bc06c[_0x118c('0x3c')]=getSeconds(_0x1bc06c[_0x118c('0x3a')],_0x1bc06c[_0x118c('0x3d')]);};exports[_0x118c('0x3e')]=function(_0xdfb7fd,_0x4531cf,_0x3505f1){_0xdfb7fd[_0x118c('0x3f')]=_0x4531cf;_0xdfb7fd[_0x118c('0x40')]=_0x3505f1;};exports[_0x118c('0x41')]=function(_0x4926e1,_0x4181e6,_0x141b2b){var _0x97c2bc=moment()[_0x118c('0x11')](_0x118c('0x37'));_0x4926e1[_0x118c('0x42')]=_0x4181e6;_0x4926e1[_0x118c('0x38')]=_0x141b2b;_0x4926e1[_0x118c('0x3a')]=_0x4926e1['responsetime']?_0x4926e1['responsetime']:_0x97c2bc;_0x4926e1[_0x118c('0x3b')]=_0x4926e1['endtime']?_0x4926e1[_0x118c('0x3b')]:_0x97c2bc;_0x4926e1[_0x118c('0x3c')]=getSeconds(_0x4926e1[_0x118c('0x3a')]||0x0,_0x4926e1[_0x118c('0x3d')]||0x0);_0x4926e1[_0x118c('0x43')]=_0x4926e1['answertime']?getSeconds(_0x4926e1[_0x118c('0x3b')],_0x4926e1[_0x118c('0x44')]):0x0;};exports[_0x118c('0x45')]=function(_0x1dd0c4){return _0x1dd0c4===_0x118c('0x46');};exports[_0x118c('0x47')]=function(_0x4a8d48,_0x536f39,_0xfed96,_0x33ca3e,_0x48c60f){var _0x1f1aa3=_0x33ca3e?_0x118c('0x48'):_0x4a8d48[_0x118c('0x49')];_0x1f1aa3=_0x48c60f?_0x118c('0x4a'):_0x1f1aa3;return{'actionid':_0x4a8d48[_0x118c('0x4b')],'action':_0x118c('0x4c'),'channel':_0x4a8d48['channelAgent'],'callerid':util[_0x118c('0x11')]('\x22%s\x22\x20<%s>',_0x1f1aa3,_0x4a8d48[_0x118c('0x4d')]),'Exten':_0x118c('0x4e'),'Context':_0x118c('0x4f'),'Priority':'1','variable':_0xfed96,'timeout':(_0x536f39['timeout']||0x1e)*0x3e8,'async':!![],'channelid':_0x4a8d48['uniqueid']};};exports[_0x118c('0x50')]=function(_0x4779b6){return _0x4779b6[_0x118c('0x51')]+_0x4779b6[_0x118c('0x52')]+_0x4779b6[_0x118c('0x53')]+_0x4779b6[_0x118c('0x54')]+_0x4779b6['countnosuchnumberretry'];};exports[_0x118c('0x55')]=function(_0x35e482){var _0x1300c5=_[_0x118c('0x56')](_0x35e482);_0x1300c5[_0x118c('0x42')]=0xf;_0x1300c5[_0x118c('0x38')]='Global';return _0x1300c5;};exports[_0x118c('0x57')]=function(_0x16b1a8,_0x187bb5,_0x1373e0){var _0x4f1df6={};_0x4f1df6[_0x187bb5]=_0x16b1a8[_0x187bb5];_0x4f1df6['active']=![];_0x4f1df6[_0x118c('0x58')]=moment()[_0x118c('0x59')](_0x1373e0,_0x118c('0x5a'))[_0x118c('0x11')](_0x118c('0x37'));_0x4f1df6[_0x118c('0x5b')]=_0x16b1a8[_0x118c('0x5b')];_0x4f1df6['ListId']=_0x16b1a8[_0x118c('0x5c')];_0x4f1df6[_0x118c('0x19')]=_0x16b1a8[_0x118c('0x19')]||undefined;return _0x4f1df6;};exports[_0x118c('0x5d')]=function(_0x1e5004,_0x1b1037){if(!_[_0x118c('0x27')](_0x1e5004)){if(_0x1e5004[_0x118c('0x5e')]>0x0){_0x1e5004[_0x118c('0x5e')]-=0x1;}else{logger[_0x118c('0x33')](_0x1b1037,_0x118c('0x5f'));}}else{logger[_0x118c('0x33')](_0x1b1037,_0x118c('0x60'));}};exports[_0x118c('0x61')]=function(_0x1ac102){if(_0x1ac102<=0x0){return!![];}return![];};exports[_0x118c('0x62')]=function(_0xa1a29e,_0x466306,_0x5aa3de){_0xa1a29e[_0x118c('0x63')]=_0x466306;_0xa1a29e[_0x118c('0x64')]=_0xa1a29e[_0x118c('0x65')];_0xa1a29e[_0x118c('0x66')]=_0xa1a29e[_0x118c('0x67')];_0xa1a29e['motionChannel']=_0x118c('0x68');if(_0x5aa3de){_0xa1a29e[_0x118c('0x69')]=_0x5aa3de[_0x118c('0x69')];}return _0xa1a29e;};exports[_0x118c('0x6a')]=function(_0x366398){var _0x407326={};_0x407326[_0x118c('0x65')]=_0x366398['queue'];_0x407326[_0x118c('0x66')]=_0x366398['channelAgent'];_0x407326[_0x118c('0x4b')]=_0x366398[_0x118c('0x4b')];return _0x407326;};exports[_0x118c('0x6b')]=function(_0x1536c8){var _0x35b62c=[];for(var _0x11a33e in _0x1536c8){if(_0x1536c8[_0x118c('0x31')](_0x11a33e)){if(!_[_0x118c('0x27')](_0x1536c8[_0x11a33e])&&_0x1536c8[_0x11a33e][_0x118c('0x42')]==='not_inuse'&&_0x1536c8[_0x11a33e][_0x118c('0x6c')]===_0x118c('0x6d')){_0x35b62c[_0x118c('0x6e')](_0x1536c8[_0x11a33e]['id']);}}}return _0x35b62c;};exports[_0x118c('0x6f')]=function(_0x3a2f39){var _0x32195b=moment()[_0x118c('0x70')](0x0);var _0x4fb325=moment(_0x3a2f39)[_0x118c('0x70')](0x0);return _0x32195b[_0x118c('0x6')](_0x4fb325,_0x118c('0x71'));};exports[_0x118c('0x72')]=function(_0xe76579){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0xe76579['ContactId'],'ListId':_0xe76579[_0x118c('0x5c')],'VoiceQueueId':_0xe76579[_0x118c('0x19')]||undefined,'CampaignId':_0xe76579[_0x118c('0x73')]||undefined};};exports[_0x118c('0x74')]=function(_0x18d37b){if(_0x18d37b===_0x118c('0x4b')||_0x18d37b===_0x118c('0x75')||_0x18d37b===_0x118c('0x65')||_0x18d37b===_0x118c('0x76')||_0x18d37b===_0x118c('0x77')||_0x18d37b===_0x118c('0x78')||_0x18d37b==='membername'||_0x18d37b==='channelAgent'||_0x18d37b===_0x118c('0x49')||_0x18d37b===_0x118c('0x79')||_0x18d37b===_0x118c('0x4d')||_0x18d37b===_0x118c('0x58')||_0x18d37b===_0x118c('0x51')||_0x18d37b===_0x118c('0x52')||_0x18d37b===_0x118c('0x53')||_0x18d37b===_0x118c('0x7a')||_0x18d37b==='callback'||_0x18d37b==='callbackuniqueid'||_0x18d37b===_0x118c('0x7b')||_0x18d37b===_0x118c('0x7c')||_0x18d37b===_0x118c('0x5b')||_0x18d37b===_0x118c('0x5c')||_0x18d37b==='UserId'||_0x18d37b===_0x118c('0x19')||_0x18d37b===_0x118c('0x7d')||_0x18d37b===_0x118c('0x7e')||_0x18d37b===_0x118c('0x7f')||_0x18d37b==='xmd-phone'||_0x18d37b==='xmd-listid'||_0x18d37b===_0x118c('0x80')||_0x18d37b==='xmd-dialtimeout'||_0x18d37b===_0x118c('0x81')||_0x18d37b===_0x118c('0x82')||_0x18d37b===_0x118c('0x83')||_0x18d37b==='xmd-contactid'||_0x18d37b==='xmd-cdrtype'||_0x18d37b==='xmd-callerid'||_0x18d37b===_0x118c('0x84')||_0x18d37b===_0x118c('0x85')||_0x18d37b===_0x118c('0x86')||_0x18d37b==='rtpaudioqosbridged'||_0x18d37b===_0x118c('0x87')||_0x18d37b===_0x118c('0x88')||_0x18d37b==='rtpaudioqosloss'||_0x18d37b===_0x118c('0x89')||_0x18d37b===_0x118c('0x8a')||_0x18d37b===_0x118c('0x8b')||_0x18d37b===_0x118c('0x86')||_0x18d37b===_0x118c('0x8c')||_0x18d37b===_0x118c('0x87')||_0x18d37b===_0x118c('0x88')||_0x18d37b===_0x118c('0x8d')||_0x18d37b==='rtpaudioqoslossbridged'||_0x18d37b===_0x118c('0x8a')||_0x18d37b===_0x118c('0x8b')||_0x18d37b===_0x118c('0x8e')||_0x18d37b===_0x118c('0x8f')||_0x18d37b===_0x118c('0x42')||_0x18d37b===_0x118c('0x38')){return![];}return!![];};exports[_0x118c('0x90')]=function(_0x54e0ce,_0x398c5b){var _0x3a46cc,_0x566db7,_0x21dbf1;if(_0x398c5b<=0x0){_0x398c5b=0x1;}_0x3a46cc=new RegExp(_0x118c('0x91')+_0x398c5b+'}$');_0x566db7=Math['pow'](0xa,_0x398c5b-0x1);_0x21dbf1=Math['pow'](0xa,_0x398c5b)-0x1;return util[_0x118c('0x11')]('%s',_['replace'](_0x54e0ce,_0x3a46cc,_[_0x118c('0x92')](_0x566db7,_0x21dbf1)));};exports[_0x118c('0x93')]=function(_0x18b8a9){var _0x14cce5=_0x18b8a9[_0x118c('0x94')](/"(.*?)"/);return _0x14cce5?_0x14cce5[0x1]:_0x18b8a9;};exports[_0x118c('0x95')]=function(_0x387235){var _0x4b0266=_0x387235['match'](/<(.*?)>/);return _0x4b0266?_0x4b0266[0x1]:_0x387235;}; \ No newline at end of file diff --git a/server/services/ami/properties.js b/server/services/ami/properties.js index 51c3516..ed2493d 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 _0x882f=['string','number','queueremove','queuepause','boolean','reload','voicequeuechannel','voicechannel','voicequeuechannelhangup','queueadd'];(function(_0x2e5ea9,_0x4d280a){var _0x228844=function(_0x2b3707){while(--_0x2b3707){_0x2e5ea9['push'](_0x2e5ea9['shift']());}};_0x228844(++_0x4d280a);}(_0x882f,0x10d));var _0xf882=function(_0x556bca,_0x573fb9){_0x556bca=_0x556bca-0x0;var _0x16c8fd=_0x882f[_0x556bca];return _0x16c8fd;};'use strict';exports[_0xf882('0x0')]={'queue':{'type':_0xf882('0x1'),'required':!![]},'interface':{'type':_0xf882('0x1'),'required':!![]},'membername':{'type':_0xf882('0x1'),'required':!![]},'penalty':{'type':_0xf882('0x2'),'required':![]},'paused':{'type':'boolean','required':![]}};exports[_0xf882('0x3')]={'queue':{'type':_0xf882('0x1'),'required':!![]},'interface':{'type':_0xf882('0x1'),'required':!![]}};exports[_0xf882('0x4')]={'interface':{'type':_0xf882('0x1'),'required':!![]},'paused':{'type':_0xf882('0x5')},'reason':{'type':_0xf882('0x1'),'required':![]}};exports[_0xf882('0x6')]={'module':{'type':_0xf882('0x1'),'required':![]}};exports[_0xf882('0x7')]={'uniqueid':{'type':'string','required':!![]}};exports[_0xf882('0x8')]={'uniqueid':{'type':_0xf882('0x1'),'required':!![]},'filename':{'type':_0xf882('0x1')},'format':{'type':_0xf882('0x1')},'mixmonitorid':{'type':'string'}};exports[_0xf882('0x9')]={'uniqueid':{'type':'string','required':!![]}};exports['voicequeuechannelredirect']={'uniqueid':{'type':_0xf882('0x1'),'required':!![]},'exten':{'type':_0xf882('0x1'),'required':!![]},'context':{'type':_0xf882('0x1')}}; \ No newline at end of file +var _0x30da=['queueremove','queuepause','reload','voicechannel','voicequeuechannelhangup','voicequeuechannelredirect','string','number','boolean'];(function(_0x4c12ec,_0x2e9103){var _0x3ae42c=function(_0x5a728f){while(--_0x5a728f){_0x4c12ec['push'](_0x4c12ec['shift']());}};_0x3ae42c(++_0x2e9103);}(_0x30da,0x180));var _0xa30d=function(_0x4769cf,_0x260108){_0x4769cf=_0x4769cf-0x0;var _0x4405cc=_0x30da[_0x4769cf];return _0x4405cc;};'use strict';exports['queueadd']={'queue':{'type':_0xa30d('0x0'),'required':!![]},'interface':{'type':_0xa30d('0x0'),'required':!![]},'membername':{'type':_0xa30d('0x0'),'required':!![]},'penalty':{'type':_0xa30d('0x1'),'required':![]},'paused':{'type':_0xa30d('0x2'),'required':![]}};exports[_0xa30d('0x3')]={'queue':{'type':_0xa30d('0x0'),'required':!![]},'interface':{'type':'string','required':!![]}};exports[_0xa30d('0x4')]={'interface':{'type':'string','required':!![]},'paused':{'type':_0xa30d('0x2')},'reason':{'type':_0xa30d('0x0'),'required':![]}};exports[_0xa30d('0x5')]={'module':{'type':_0xa30d('0x0'),'required':![]}};exports['voicequeuechannel']={'uniqueid':{'type':_0xa30d('0x0'),'required':!![]}};exports[_0xa30d('0x6')]={'uniqueid':{'type':_0xa30d('0x0'),'required':!![]},'filename':{'type':_0xa30d('0x0')},'format':{'type':_0xa30d('0x0')},'mixmonitorid':{'type':_0xa30d('0x0')}};exports[_0xa30d('0x7')]={'uniqueid':{'type':_0xa30d('0x0'),'required':!![]}};exports[_0xa30d('0x8')]={'uniqueid':{'type':'string','required':!![]},'exten':{'type':_0xa30d('0x0'),'required':!![]},'context':{'type':_0xa30d('0x0')}}; \ No newline at end of file diff --git a/server/services/ami/realtime/index.js b/server/services/ami/realtime/index.js index b25d755..4ee6dad 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 _0x7c7d=['queue','queuecallerexit','unmanaged','queuecallerabandon','queuecallerleaveAt','diff','seconds','queuecallercompleteAt','queuecallerabandonAt','queuecallerexitAt','queuecallercomplete','initVoiceCallReports','duration','disposition','ANSWERED','initCampaigns','SquareProject','initVoiceExtensions','initCampaignHopperHistory','initFaxAccounts','exports','bluebird','util','lodash','moment','../model/agent','../model/telephone','../model/trunk','../model/trigger','../model/template','../model/campaign','../model/voiceExtension','../model/zendeskAccount','../model/salesforceAccount','../model/sugarcrmAccount','../model/zohoAccount','../model/deskAccount','../model/vtigerAccount','../model/servicenowAccount','../model/dynamics365Account','../model/faxAccount','agents','telephones','trunks','triggers','campaigns','templates','outbound','voiceExtensions','channels','outboundChannels','settings','zendeskAccounts','sugarcrmAccounts','freshdeskAccounts','zohoAccounts','vtigerAccounts','servicenowAccounts','freshsalesAccounts','faxAccounts','mapKeys','hasOwnProperty','SIP/%s','name','isNil','interface','format','total','answered','sumDuration','sumBillable','isEmpty','ivrTotalCallsDays','ivrAnswerCallsDay','abandoned','sumHoldTime','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundAnswerCallsDay','queueStatusComplete','prototype','mergeFromDatabase','initAgents','isUndefined','length','initTrunks','initVoiceQueues','voiceQueues','initTriggers','initTemplates','initZendeskAccounts','initSalesforceAccounts','salesforceAccounts','initFreshdeskAccounts','initDeskAccounts','deskAccounts','initSugarcrmAccounts','initVtigerAccounts','initDynamics365Accounts','dynamics365Accounts','initVoiceQueueHopperHistory','merge','groupBy','uniqueid'];(function(_0x8b8564,_0x162976){var _0x360c61=function(_0x164cc9){while(--_0x164cc9){_0x8b8564['push'](_0x8b8564['shift']());}};_0x360c61(++_0x162976);}(_0x7c7d,0x165));var _0xd7c7=function(_0x4a9c12,_0x17312a){_0x4a9c12=_0x4a9c12-0x0;var _0xc22aaf=_0x7c7d[_0x4a9c12];return _0xc22aaf;};'use strict';var BPromise=require(_0xd7c7('0x0'));var util=require(_0xd7c7('0x1'));var _=require(_0xd7c7('0x2'));var moment=require(_0xd7c7('0x3'));var Agent=require(_0xd7c7('0x4'));var Telephone=require(_0xd7c7('0x5'));var Trunk=require(_0xd7c7('0x6'));var VoiceQueue=require('../model/voiceQueue');var Trigger=require(_0xd7c7('0x7'));var Template=require(_0xd7c7('0x8'));var Campaign=require(_0xd7c7('0x9'));var VoiceExtension=require(_0xd7c7('0xa'));var ZendeskAccount=require(_0xd7c7('0xb'));var SalesforceAccount=require(_0xd7c7('0xc'));var FreshdeskAccount=require('../model/freshdeskAccount');var SugarcrmAccount=require(_0xd7c7('0xd'));var ZohoAccount=require(_0xd7c7('0xe'));var DeskAccount=require(_0xd7c7('0xf'));var VtigerAccount=require(_0xd7c7('0x10'));var ServicenowAccount=require(_0xd7c7('0x11'));var Dynamics365Account=require(_0xd7c7('0x12'));var FreshsalesAccount=require('../model/freshsalesAccount');var FaxAccount=require(_0xd7c7('0x13'));var Realtime=function(){this[_0xd7c7('0x14')]={};this[_0xd7c7('0x15')]={};this[_0xd7c7('0x16')]={};this['voiceQueues']={};this[_0xd7c7('0x17')]={};this[_0xd7c7('0x18')]={};this[_0xd7c7('0x19')]={};this[_0xd7c7('0x1a')]={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this[_0xd7c7('0x1b')]={};this[_0xd7c7('0x1c')]={};this['queueChannels']={};this[_0xd7c7('0x1d')]={};this['timers']={};this[_0xd7c7('0x1e')]={};this[_0xd7c7('0x1f')]={};this['salesforceAccounts']={};this[_0xd7c7('0x20')]={};this[_0xd7c7('0x21')]={};this[_0xd7c7('0x22')]={};this['deskAccounts']={};this[_0xd7c7('0x23')]={};this[_0xd7c7('0x24')]={};this['dynamics365Accounts']={};this[_0xd7c7('0x25')]={};this[_0xd7c7('0x26')]={};};function freeIsNotKey(_0x262639,_0x3be0b1,_0x5be00b){var _0x497ed8=_[_0xd7c7('0x27')](_0x262639,function(_0x5a4c6b,_0x5024b7){return _0x5a4c6b[_0x5be00b];});for(var _0x1fc3d9 in _0x3be0b1){if(_0x3be0b1[_0xd7c7('0x28')](_0x1fc3d9)){if(!_0x497ed8[_0x1fc3d9]){delete _0x3be0b1[_0x1fc3d9];}}}}function freeIsNotKeySip(_0x2d0f21,_0x2c6281){var _0x2a42db=_[_0xd7c7('0x27')](_0x2d0f21,function(_0x50439f,_0x2fec89){return util['format'](_0xd7c7('0x29'),_0x50439f[_0xd7c7('0x2a')]);});for(var _0x42ccc8 in _0x2c6281){if(_0x2c6281[_0xd7c7('0x28')](_0x42ccc8)){if(!_0x2a42db[_0x42ccc8]){delete _0x2c6281[_0x42ccc8];}}}}function freeIsNotKeyAgent(_0xeb5f2a,_0x6537ef){var _0x29845e=_['mapKeys'](_0xeb5f2a,function(_0x5dd84f,_0x55b17d){var _0x236701=_[_0xd7c7('0x2b')](_0x5dd84f[_0xd7c7('0x2c')])?util[_0xd7c7('0x2d')](_0xd7c7('0x29'),_0x5dd84f['name']):_0x5dd84f['interface'];return _0x236701;});for(var _0x1040bc in _0x6537ef){if(_0x6537ef[_0xd7c7('0x28')](_0x1040bc)){if(!_0x29845e[_0x1040bc]){delete _0x6537ef[_0x1040bc];}}}}function clearVoiceCallReports(_0x4fe386){_0x4fe386[_0xd7c7('0x2e')]=0x0;_0x4fe386[_0xd7c7('0x2f')]=0x0;_0x4fe386['sumHoldTime']=0x0;_0x4fe386[_0xd7c7('0x30')]=0x0;_0x4fe386[_0xd7c7('0x31')]=0x0;}function clearCampaigns(_0x5704cf){if(!_[_0xd7c7('0x32')](_0x5704cf)){for(var _0x194fca in _0x5704cf){if(_0x5704cf[_0xd7c7('0x28')](_0x194fca)){_0x5704cf[_0x194fca][_0xd7c7('0x33')]=0x0;_0x5704cf[_0x194fca][_0xd7c7('0x34')]=0x0;}}}}function clearVoiceQueues(_0x121b80){if(!_[_0xd7c7('0x32')](_0x121b80)){for(var _0x1046e3 in _0x121b80){if(_0x121b80[_0xd7c7('0x28')](_0x1046e3)){_0x121b80[_0x1046e3][_0xd7c7('0x2e')]=0x0;_0x121b80[_0x1046e3][_0xd7c7('0x2f')]=0x0;_0x121b80[_0x1046e3]['unmanaged']=0x0;_0x121b80[_0x1046e3][_0xd7c7('0x35')]=0x0;_0x121b80[_0x1046e3][_0xd7c7('0x36')]=0x0;_0x121b80[_0x1046e3][_0xd7c7('0x30')]=0x0;_0x121b80[_0x1046e3][_0xd7c7('0x31')]=0x0;_0x121b80[_0x1046e3][_0xd7c7('0x37')]=0x0;_0x121b80[_0x1046e3][_0xd7c7('0x38')]=0x0;_0x121b80[_0x1046e3]['outboundBusyCallsDay']=0x0;_0x121b80[_0x1046e3][_0xd7c7('0x39')]=0x0;_0x121b80[_0x1046e3][_0xd7c7('0x3a')]=0x0;_0x121b80[_0x1046e3][_0xd7c7('0x3b')]=0x0;_0x121b80[_0x1046e3][_0xd7c7('0x3c')]=0x0;_0x121b80[_0x1046e3][_0xd7c7('0x3d')]=0x0;_0x121b80[_0x1046e3][_0xd7c7('0x3e')]=0x0;_0x121b80[_0x1046e3][_0xd7c7('0x3f')]=0x0;_0x121b80[_0x1046e3][_0xd7c7('0x40')]=0x0;_0x121b80[_0x1046e3]['outboundReCallsDay']=0x0;_0x121b80[_0x1046e3]['outboundAnswerAgiCallsDay']=0x0;_0x121b80[_0x1046e3][_0xd7c7('0x41')]=0x0;_0x121b80[_0x1046e3][_0xd7c7('0x42')]=!![];}}}}Realtime[_0xd7c7('0x43')][_0xd7c7('0x44')]=function(_0x5bd0c0,_0x5675ea){for(var _0x43662f in _0x5675ea){if(_0x5bd0c0[_0xd7c7('0x28')](_0x43662f)){_0x5bd0c0[_0x43662f]=_0x5675ea[_0x43662f];}}};Realtime['prototype'][_0xd7c7('0x45')]=function(){var _0x2f85e4=this;return function(_0x33dbba){if(_0x33dbba){freeIsNotKeyAgent(_0x33dbba,_0x2f85e4['agents']);for(var _0x2994de=0x0,_0x4ade7b={},_0x1b6062={};_0x2994de<_0x33dbba['length'];_0x2994de+=0x1){_0x4ade7b=_0x33dbba[_0x2994de];var _0x181a05=_[_0xd7c7('0x2b')](_0x4ade7b['interface'])?util[_0xd7c7('0x2d')]('SIP/%s',_0x4ade7b[_0xd7c7('0x2a')]):_0x4ade7b[_0xd7c7('0x2c')];if(_[_0xd7c7('0x46')](_0x2f85e4['agents'][_0x181a05])){_0x2f85e4[_0xd7c7('0x14')][_0x181a05]=new Agent(_0x4ade7b);}else{_0x2f85e4[_0xd7c7('0x44')](_0x2f85e4[_0xd7c7('0x14')][_0x181a05],_0x4ade7b);}}}return _0x2f85e4[_0xd7c7('0x14')];};};Realtime[_0xd7c7('0x43')]['initTelephones']=function(){var _0x5e0a07=this;return function(_0x59db8e){if(_0x59db8e){freeIsNotKeySip(_0x59db8e,_0x5e0a07[_0xd7c7('0x15')]);for(var _0x2abdff=0x0,_0x566d48={},_0x1b00cc={};_0x2abdff<_0x59db8e[_0xd7c7('0x47')];_0x2abdff+=0x1){_0x566d48=_0x59db8e[_0x2abdff];if(_[_0xd7c7('0x46')](_0x5e0a07[_0xd7c7('0x15')][util[_0xd7c7('0x2d')]('SIP/%s',_0x566d48[_0xd7c7('0x2a')])])){_0x5e0a07[_0xd7c7('0x15')][util[_0xd7c7('0x2d')](_0xd7c7('0x29'),_0x566d48[_0xd7c7('0x2a')])]=new Telephone(_0x566d48);}else{_0x5e0a07[_0xd7c7('0x44')](_0x5e0a07[_0xd7c7('0x15')][util[_0xd7c7('0x2d')]('SIP/%s',_0x566d48[_0xd7c7('0x2a')])],_0x566d48);}}}return _0x5e0a07[_0xd7c7('0x15')];};};Realtime['prototype'][_0xd7c7('0x48')]=function(){var _0x2965f9=this;return function(_0x4b0eeb){if(_0x4b0eeb){freeIsNotKeySip(_0x4b0eeb,_0x2965f9[_0xd7c7('0x16')]);for(var _0x5cfb42=0x0,_0x2f0058={},_0x342074={};_0x5cfb42<_0x4b0eeb[_0xd7c7('0x47')];_0x5cfb42+=0x1){_0x2f0058=_0x4b0eeb[_0x5cfb42];if(_[_0xd7c7('0x46')](_0x2965f9[_0xd7c7('0x16')][util[_0xd7c7('0x2d')](_0xd7c7('0x29'),_0x2f0058[_0xd7c7('0x2a')])])){_0x2965f9[_0xd7c7('0x16')][util[_0xd7c7('0x2d')](_0xd7c7('0x29'),_0x2f0058[_0xd7c7('0x2a')])]=new Trunk(_0x2f0058);}else{_0x2965f9[_0xd7c7('0x44')](_0x2965f9[_0xd7c7('0x16')][util['format'](_0xd7c7('0x29'),_0x2f0058[_0xd7c7('0x2a')])],_0x2f0058);}}}return _0x2965f9[_0xd7c7('0x16')];};};Realtime[_0xd7c7('0x43')][_0xd7c7('0x49')]=function(){var _0x3b840d=this;return function(_0x145fdd){if(_0x145fdd){freeIsNotKey(_0x145fdd,_0x3b840d[_0xd7c7('0x4a')],_0xd7c7('0x2a'));for(var _0xa3fd30=0x0,_0x52fb6e={},_0xac43a1={};_0xa3fd30<_0x145fdd['length'];_0xa3fd30+=0x1){_0x52fb6e=_0x145fdd[_0xa3fd30];if(_['isUndefined'](_0x3b840d[_0xd7c7('0x4a')][_0x52fb6e[_0xd7c7('0x2a')]])){_0x3b840d[_0xd7c7('0x4a')][_0x52fb6e[_0xd7c7('0x2a')]]=new VoiceQueue(_0x52fb6e);}else{_0x3b840d[_0xd7c7('0x44')](_0x3b840d[_0xd7c7('0x4a')][_0x52fb6e[_0xd7c7('0x2a')]],_0x52fb6e);}}}return _0x3b840d[_0xd7c7('0x4a')];};};Realtime[_0xd7c7('0x43')][_0xd7c7('0x4b')]=function(){var _0x45abf1=this;return function(_0x361c7f){if(_0x361c7f){freeIsNotKey(_0x361c7f,_0x45abf1['triggers'],'id');for(var _0x463bd4=0x0,_0x53651e={},_0x2fc943={};_0x463bd4<_0x361c7f[_0xd7c7('0x47')];_0x463bd4+=0x1){_0x53651e=_0x361c7f[_0x463bd4];if(_[_0xd7c7('0x46')](_0x45abf1[_0xd7c7('0x17')][_0x53651e['id']])){_0x45abf1[_0xd7c7('0x17')][_0x53651e['id']]=new Trigger(_0x53651e);}else{_0x45abf1['mergeFromDatabase'](_0x45abf1[_0xd7c7('0x17')][_0x53651e['id']],_0x53651e);}}}return _0x45abf1[_0xd7c7('0x17')];};};Realtime['prototype'][_0xd7c7('0x4c')]=function(){var _0x42927c=this;return function(_0x2080c2){if(_0x2080c2){freeIsNotKey(_0x2080c2,_0x42927c[_0xd7c7('0x19')],'id');for(var _0xce3fd6=0x0,_0x49bebd={},_0xb983b9={};_0xce3fd6<_0x2080c2['length'];_0xce3fd6+=0x1){_0x49bebd=_0x2080c2[_0xce3fd6];if(_[_0xd7c7('0x46')](_0x42927c[_0xd7c7('0x19')][_0x49bebd['id']])){_0x42927c['templates'][_0x49bebd['id']]=new Template(_0x49bebd);}else{_0x42927c[_0xd7c7('0x44')](_0x42927c[_0xd7c7('0x19')][_0x49bebd['id']],_0x49bebd);}}}return _0x42927c[_0xd7c7('0x19')];};};Realtime[_0xd7c7('0x43')][_0xd7c7('0x4d')]=function(){var _0x4fecad=this;return function(_0x490b1c){if(_0x490b1c){freeIsNotKey(_0x490b1c,_0x4fecad[_0xd7c7('0x1f')],'id');for(var _0x3e912d=0x0,_0xdc5aa={},_0x2476c9={};_0x3e912d<_0x490b1c[_0xd7c7('0x47')];_0x3e912d+=0x1){_0xdc5aa=_0x490b1c[_0x3e912d];if(_[_0xd7c7('0x46')](_0x4fecad[_0xd7c7('0x1f')][_0xdc5aa['id']])){_0x4fecad[_0xd7c7('0x1f')][_0xdc5aa['id']]=new ZendeskAccount(_0xdc5aa);}else{_0x4fecad['mergeFromDatabase'](_0x4fecad[_0xd7c7('0x1f')][_0xdc5aa['id']],_0xdc5aa);}}}return _0x4fecad[_0xd7c7('0x1f')];};};Realtime['prototype'][_0xd7c7('0x4e')]=function(){var _0x5c5b0c=this;return function(_0x11903d){if(_0x11903d){freeIsNotKey(_0x11903d,_0x5c5b0c['salesforceAccounts'],'id');for(var _0x157769=0x0,_0x301b9c={},_0x55003e={};_0x157769<_0x11903d['length'];_0x157769+=0x1){_0x301b9c=_0x11903d[_0x157769];if(_[_0xd7c7('0x46')](_0x5c5b0c[_0xd7c7('0x4f')][_0x301b9c['id']])){_0x5c5b0c[_0xd7c7('0x4f')][_0x301b9c['id']]=new SalesforceAccount(_0x301b9c);}else{_0x5c5b0c[_0xd7c7('0x44')](_0x5c5b0c[_0xd7c7('0x4f')][_0x301b9c['id']],_0x301b9c);}}}return _0x5c5b0c['salesforceAccounts'];};};Realtime[_0xd7c7('0x43')][_0xd7c7('0x50')]=function(){var _0x3cddc4=this;return function(_0x4dfe2b){if(_0x4dfe2b){freeIsNotKey(_0x4dfe2b,_0x3cddc4[_0xd7c7('0x21')],'id');for(var _0xd8c480=0x0,_0x5bc426={},_0x5dff7a={};_0xd8c480<_0x4dfe2b[_0xd7c7('0x47')];_0xd8c480+=0x1){_0x5bc426=_0x4dfe2b[_0xd8c480];if(_[_0xd7c7('0x46')](_0x3cddc4[_0xd7c7('0x21')][_0x5bc426['id']])){_0x3cddc4['freshdeskAccounts'][_0x5bc426['id']]=new FreshdeskAccount(_0x5bc426);}else{_0x3cddc4[_0xd7c7('0x44')](_0x3cddc4['freshdeskAccounts'][_0x5bc426['id']],_0x5bc426);}}}return _0x3cddc4[_0xd7c7('0x21')];};};Realtime[_0xd7c7('0x43')]['initZohoAccounts']=function(){var _0x39b8a8=this;return function(_0x292eac){if(_0x292eac){freeIsNotKey(_0x292eac,_0x39b8a8[_0xd7c7('0x22')],'id');for(var _0x5d0eae=0x0,_0x520fd3={},_0x33ef39={};_0x5d0eae<_0x292eac[_0xd7c7('0x47')];_0x5d0eae+=0x1){_0x520fd3=_0x292eac[_0x5d0eae];if(_[_0xd7c7('0x46')](_0x39b8a8[_0xd7c7('0x22')][_0x520fd3['id']])){_0x39b8a8['zohoAccounts'][_0x520fd3['id']]=new ZohoAccount(_0x520fd3);}else{_0x39b8a8[_0xd7c7('0x44')](_0x39b8a8['zohoAccounts'][_0x520fd3['id']],_0x520fd3);}}}return _0x39b8a8[_0xd7c7('0x22')];};};Realtime[_0xd7c7('0x43')][_0xd7c7('0x51')]=function(){var _0x983634=this;return function(_0x74499b){if(_0x74499b){freeIsNotKey(_0x74499b,_0x983634[_0xd7c7('0x52')],'id');for(var _0x31d2d5=0x0,_0x2d2cb1={},_0x4a39c7={};_0x31d2d5<_0x74499b[_0xd7c7('0x47')];_0x31d2d5+=0x1){_0x2d2cb1=_0x74499b[_0x31d2d5];if(_[_0xd7c7('0x46')](_0x983634[_0xd7c7('0x52')][_0x2d2cb1['id']])){_0x983634[_0xd7c7('0x52')][_0x2d2cb1['id']]=new DeskAccount(_0x2d2cb1);}else{_0x983634[_0xd7c7('0x44')](_0x983634[_0xd7c7('0x52')][_0x2d2cb1['id']],_0x2d2cb1);}}}return _0x983634[_0xd7c7('0x52')];};};Realtime[_0xd7c7('0x43')][_0xd7c7('0x53')]=function(){var _0x52925e=this;return function(_0x4e77fa){if(_0x4e77fa){freeIsNotKey(_0x4e77fa,_0x52925e[_0xd7c7('0x20')],'id');for(var _0x41a50e=0x0,_0x358b94={},_0x4bd86e={};_0x41a50e<_0x4e77fa[_0xd7c7('0x47')];_0x41a50e+=0x1){_0x358b94=_0x4e77fa[_0x41a50e];if(_[_0xd7c7('0x46')](_0x52925e[_0xd7c7('0x20')][_0x358b94['id']])){_0x52925e['sugarcrmAccounts'][_0x358b94['id']]=new SugarcrmAccount(_0x358b94);}else{_0x52925e[_0xd7c7('0x44')](_0x52925e[_0xd7c7('0x20')][_0x358b94['id']],_0x358b94);}}}return _0x52925e[_0xd7c7('0x20')];};};Realtime[_0xd7c7('0x43')][_0xd7c7('0x54')]=function(){var _0xe02a5b=this;return function(_0x10f126){if(_0x10f126){freeIsNotKey(_0x10f126,_0xe02a5b[_0xd7c7('0x23')],'id');for(var _0x57a40b=0x0,_0x19ec37={},_0x282200={};_0x57a40b<_0x10f126[_0xd7c7('0x47')];_0x57a40b+=0x1){_0x19ec37=_0x10f126[_0x57a40b];if(_[_0xd7c7('0x46')](_0xe02a5b[_0xd7c7('0x23')][_0x19ec37['id']])){_0xe02a5b[_0xd7c7('0x23')][_0x19ec37['id']]=new VtigerAccount(_0x19ec37);}else{_0xe02a5b[_0xd7c7('0x44')](_0xe02a5b[_0xd7c7('0x23')][_0x19ec37['id']],_0x19ec37);}}}return _0xe02a5b[_0xd7c7('0x23')];};};Realtime[_0xd7c7('0x43')]['initServicenowAccounts']=function(){var _0x4cf9d3=this;return function(_0x4d25ba){if(_0x4d25ba){freeIsNotKey(_0x4d25ba,_0x4cf9d3[_0xd7c7('0x24')],'id');for(var _0x363463=0x0,_0x16f943={},_0x500745={};_0x363463<_0x4d25ba[_0xd7c7('0x47')];_0x363463+=0x1){_0x16f943=_0x4d25ba[_0x363463];if(_[_0xd7c7('0x46')](_0x4cf9d3['servicenowAccounts'][_0x16f943['id']])){_0x4cf9d3[_0xd7c7('0x24')][_0x16f943['id']]=new ServicenowAccount(_0x16f943);}else{_0x4cf9d3[_0xd7c7('0x44')](_0x4cf9d3[_0xd7c7('0x24')][_0x16f943['id']],_0x16f943);}}}return _0x4cf9d3[_0xd7c7('0x24')];};};Realtime[_0xd7c7('0x43')][_0xd7c7('0x55')]=function(){var _0x2acf29=this;return function(_0x38137a){if(_0x38137a){freeIsNotKey(_0x38137a,_0x2acf29[_0xd7c7('0x56')],'id');for(var _0x3a9815=0x0,_0x17e13d={},_0x4fc0fb={};_0x3a9815<_0x38137a[_0xd7c7('0x47')];_0x3a9815+=0x1){_0x17e13d=_0x38137a[_0x3a9815];if(_[_0xd7c7('0x46')](_0x2acf29[_0xd7c7('0x56')][_0x17e13d['id']])){_0x2acf29[_0xd7c7('0x56')][_0x17e13d['id']]=new Dynamics365Account(_0x17e13d);}else{_0x2acf29[_0xd7c7('0x44')](_0x2acf29['dynamics365Accounts'][_0x17e13d['id']],_0x17e13d);}}}return _0x2acf29[_0xd7c7('0x56')];};};Realtime['prototype']['initFreshsalesAccounts']=function(){var _0x416765=this;return function(_0x4ccd6a){if(_0x4ccd6a){freeIsNotKey(_0x4ccd6a,_0x416765[_0xd7c7('0x25')],'id');for(var _0x3ebaac=0x0,_0x3e1713={},_0x43b4e9={};_0x3ebaac<_0x4ccd6a[_0xd7c7('0x47')];_0x3ebaac+=0x1){_0x3e1713=_0x4ccd6a[_0x3ebaac];if(_[_0xd7c7('0x46')](_0x416765[_0xd7c7('0x25')][_0x3e1713['id']])){_0x416765[_0xd7c7('0x25')][_0x3e1713['id']]=new FreshsalesAccount(_0x3e1713);}else{_0x416765[_0xd7c7('0x44')](_0x416765['freshsalesAccounts'][_0x3e1713['id']],_0x3e1713);}}}return _0x416765[_0xd7c7('0x25')];};};Realtime[_0xd7c7('0x43')][_0xd7c7('0x57')]=function(){var _0x3e7384=this;return function(_0x22779b){for(var _0xf7f6d8=0x0;_0xf7f6d8<_0x22779b['length'];_0xf7f6d8+=0x1){_[_0xd7c7('0x58')](_0x3e7384['voiceQueues'][_0x22779b[_0xf7f6d8][_0xd7c7('0x2a')]],_0x22779b[_0xf7f6d8]);}return _0x3e7384[_0xd7c7('0x4a')];};};Realtime[_0xd7c7('0x43')]['initVoiceQueueReports']=function(){var _0x5a8827=this;return function(_0x531376){clearVoiceQueues(_0x5a8827[_0xd7c7('0x4a')]);if(_0x531376){_0x531376=_[_0xd7c7('0x59')](_0x531376,_0xd7c7('0x5a'));for(var _0x4598f7 in _0x531376){if(_0x531376[_0xd7c7('0x28')](_0x4598f7)){var _0xd0f5ad={};for(var _0xa12034=0x0;_0xa12034<_0x531376[_0x4598f7][_0xd7c7('0x47')];_0xa12034+=0x1){var _0x2ee380=_0x531376[_0x4598f7][_0xa12034][_0xd7c7('0x5b')];if(_0x5a8827['voiceQueues'][_0x2ee380]){if(_0x531376[_0x4598f7][_0xa12034][_0xd7c7('0x5c')]){_0x5a8827[_0xd7c7('0x4a')][_0x2ee380][_0xd7c7('0x5d')]+=0x1;}if(_0x531376[_0x4598f7][_0xa12034][_0xd7c7('0x5e')]){_0x5a8827[_0xd7c7('0x4a')][_0x2ee380]['abandoned']+=0x1;}_0x5a8827[_0xd7c7('0x4a')][_0x2ee380]['sumHoldTime']+=moment(_0x531376[_0x4598f7][_0xa12034][_0xd7c7('0x5f')])[_0xd7c7('0x60')](moment(_0x531376[_0x4598f7][_0xa12034]['queuecallerjoinAt']),_0xd7c7('0x61'))||0x0;if(_0xa12034===_0x531376[_0x4598f7][_0xd7c7('0x47')]-0x1){_0x5a8827[_0xd7c7('0x4a')][_0x2ee380][_0xd7c7('0x30')]+=moment(_0x531376[_0x4598f7][_0xa12034][_0xd7c7('0x62')]||_0x531376[_0x4598f7][_0xa12034][_0xd7c7('0x63')]||_0x531376[_0x4598f7][_0xa12034][_0xd7c7('0x64')])[_0xd7c7('0x60')](moment(_0x531376[_0x4598f7][_0xa12034]['queuecallerjoinAt']),_0xd7c7('0x61'))||0x0;_0x5a8827['voiceQueues'][_0x2ee380][_0xd7c7('0x2e')]+=0x1;if(_0x531376[_0x4598f7][_0xa12034][_0xd7c7('0x65')]){_0x5a8827[_0xd7c7('0x4a')][_0x2ee380][_0xd7c7('0x2f')]+=0x1;_0x5a8827[_0xd7c7('0x4a')][_0x2ee380][_0xd7c7('0x31')]+=moment(_0x531376[_0x4598f7][_0xa12034]['queuecallercompleteAt'])[_0xd7c7('0x60')](moment(_0x531376[_0x4598f7][_0xa12034]['queuecallerleaveAt']),_0xd7c7('0x61'))||0x0;}}else{_0x5a8827[_0xd7c7('0x4a')][_0x2ee380][_0xd7c7('0x30')]+=_0x5a8827[_0xd7c7('0x4a')][_0x2ee380][_0xd7c7('0x36')]||0x0;}}}}}}return _0x5a8827[_0xd7c7('0x4a')];};};Realtime[_0xd7c7('0x43')][_0xd7c7('0x66')]=function(){var _0x47850f=this;return function(_0x5f2bce){clearVoiceCallReports(_0x47850f['outbound']);if(_0x5f2bce){for(var _0x3d7948=0x0;_0x3d7948<_0x5f2bce[_0xd7c7('0x47')];_0x3d7948+=0x1){_0x47850f[_0xd7c7('0x1a')]['total']+=0x1;_0x47850f[_0xd7c7('0x1a')]['sumDuration']+=_0x5f2bce[_0x3d7948][_0xd7c7('0x67')];if(_0x5f2bce[_0x3d7948][_0xd7c7('0x68')]===_0xd7c7('0x69')){_0x47850f[_0xd7c7('0x1a')][_0xd7c7('0x2f')]+=0x1;_0x47850f[_0xd7c7('0x1a')][_0xd7c7('0x36')]+=_0x5f2bce[_0x3d7948][_0xd7c7('0x67')]-_0x5f2bce[_0x3d7948]['billableseconds']||0x0;_0x47850f[_0xd7c7('0x1a')][_0xd7c7('0x31')]+=_0x5f2bce[_0x3d7948]['billableseconds'];}}}return _0x47850f[_0xd7c7('0x1a')];};};Realtime[_0xd7c7('0x43')][_0xd7c7('0x6a')]=function(){var _0x100794=this;return function(_0x36f5e5){if(_0x36f5e5){freeIsNotKey(_0x36f5e5,_0x100794['campaigns'],_0xd7c7('0x2a'));for(var _0x5d76ef=0x0,_0x1ffd9f={};_0x5d76ef<_0x36f5e5[_0xd7c7('0x47')];_0x5d76ef+=0x1){_0x1ffd9f=_0x36f5e5[_0x5d76ef];if(_[_0xd7c7('0x46')](_0x100794['campaigns'][_0x1ffd9f[_0xd7c7('0x2a')]])){_0x100794['campaigns'][_0x1ffd9f[_0xd7c7('0x2a')]]=new Campaign(_0x1ffd9f);}else{_0x100794[_0xd7c7('0x44')](_0x100794[_0xd7c7('0x18')][_0x1ffd9f[_0xd7c7('0x2a')]],_0x1ffd9f);_0x100794[_0xd7c7('0x18')][_0x1ffd9f['name']]['dialQueueProject']=_0x1ffd9f['SquareProject']?_0x1ffd9f[_0xd7c7('0x6b')]['name']:undefined;}}}return _0x100794[_0xd7c7('0x18')];};};Realtime[_0xd7c7('0x43')][_0xd7c7('0x6c')]=function(){var _0x26c51b=this;return function(_0x4c5032){if(_0x4c5032){freeIsNotKey(_0x4c5032,_0x26c51b[_0xd7c7('0x1b')],'id');for(var _0x1156f9=0x0,_0x467fd7={};_0x1156f9<_0x4c5032[_0xd7c7('0x47')];_0x1156f9+=0x1){_0x467fd7=_0x4c5032[_0x1156f9];if(_['isUndefined'](_0x26c51b['voiceExtensions'][_0x467fd7['id']])){_0x26c51b[_0xd7c7('0x1b')][_0x467fd7['id']]=new VoiceExtension(_0x467fd7);}else{_0x26c51b[_0xd7c7('0x44')](_0x26c51b[_0xd7c7('0x1b')][_0x467fd7['id']],_0x467fd7);}}}return _0x26c51b[_0xd7c7('0x1b')];};};Realtime['prototype'][_0xd7c7('0x6d')]=function(){var _0x351e3b=this;return function(_0x46572c){clearCampaigns(_0x351e3b[_0xd7c7('0x18')]);for(var _0x3fe84c=0x0;_0x3fe84c<_0x46572c[_0xd7c7('0x47')];_0x3fe84c+=0x1){_[_0xd7c7('0x58')](_0x351e3b[_0xd7c7('0x18')][_0x46572c[_0x3fe84c][_0xd7c7('0x2a')]],_0x46572c[_0x3fe84c]);}return _0x351e3b['campaigns'];};};Realtime[_0xd7c7('0x43')][_0xd7c7('0x6e')]=function(){var _0x57a848=this;return function(_0x3aab4f){if(_0x3aab4f){freeIsNotKey(_0x3aab4f,_0x57a848[_0xd7c7('0x26')],'id');for(var _0x3f10a7=0x0,_0x24ff8f={},_0x2ed552={};_0x3f10a7<_0x3aab4f[_0xd7c7('0x47')];_0x3f10a7+=0x1){_0x24ff8f=_0x3aab4f[_0x3f10a7];if(_[_0xd7c7('0x46')](_0x57a848[_0xd7c7('0x26')][_0x24ff8f['id']])){_0x57a848['faxAccounts'][_0x24ff8f['id']]=new FaxAccount(_0x24ff8f);}else{_0x57a848[_0xd7c7('0x44')](_0x57a848[_0xd7c7('0x26')][_0x24ff8f['id']],_0x24ff8f);}}}return _0x57a848[_0xd7c7('0x26')];};};module[_0xd7c7('0x6f')]=Realtime; \ No newline at end of file +var _0x2aa2=['initFreshdeskAccounts','zohoAccounts','initDeskAccounts','initSugarcrmAccounts','initVtigerAccounts','initServicenowAccounts','servicenowAccounts','initDynamics365Accounts','freshsalesAccounts','initVoiceQueueHopperHistory','merge','groupBy','queue','queuecallerexit','queuecallerleaveAt','diff','queuecallerjoinAt','queuecallercompleteAt','queuecallerabandonAt','queuecallerexitAt','queuecallercomplete','seconds','initVoiceCallReports','duration','disposition','ANSWERED','billableseconds','initCampaigns','dialQueueProject','SquareProject','initCampaignHopperHistory','initFaxAccounts','bluebird','lodash','moment','../model/agent','../model/telephone','../model/trunk','../model/voiceQueue','../model/trigger','../model/voiceExtension','../model/zendeskAccount','../model/salesforceAccount','../model/freshdeskAccount','../model/zohoAccount','../model/deskAccount','../model/vtigerAccount','../model/servicenowAccount','../model/freshsalesAccount','../model/faxAccount','agents','telephones','trunks','voiceQueues','triggers','campaigns','templates','outbound','voiceExtensions','channels','outboundChannels','timers','settings','zendeskAccounts','salesforceAccounts','sugarcrmAccounts','freshdeskAccounts','deskAccounts','vtigerAccounts','dynamics365Accounts','faxAccounts','mapKeys','hasOwnProperty','format','name','isNil','interface','SIP/%s','total','answered','sumHoldTime','sumDuration','sumBillable','ivrTotalCallsDays','ivrAnswerCallsDay','isEmpty','unmanaged','abandoned','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundDropCallsDayTimeout','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','queueStatusComplete','prototype','mergeFromDatabase','initAgents','length','isUndefined','initTelephones','initVoiceQueues','initTriggers','initTemplates','initZendeskAccounts','initSalesforceAccounts'];(function(_0x41bc2a,_0x5d16b8){var _0xe0e3d9=function(_0x28ebf6){while(--_0x28ebf6){_0x41bc2a['push'](_0x41bc2a['shift']());}};_0xe0e3d9(++_0x5d16b8);}(_0x2aa2,0x1d4));var _0x22aa=function(_0x5887f2,_0x23a73c){_0x5887f2=_0x5887f2-0x0;var _0x489c62=_0x2aa2[_0x5887f2];return _0x489c62;};'use strict';var BPromise=require(_0x22aa('0x0'));var util=require('util');var _=require(_0x22aa('0x1'));var moment=require(_0x22aa('0x2'));var Agent=require(_0x22aa('0x3'));var Telephone=require(_0x22aa('0x4'));var Trunk=require(_0x22aa('0x5'));var VoiceQueue=require(_0x22aa('0x6'));var Trigger=require(_0x22aa('0x7'));var Template=require('../model/template');var Campaign=require('../model/campaign');var VoiceExtension=require(_0x22aa('0x8'));var ZendeskAccount=require(_0x22aa('0x9'));var SalesforceAccount=require(_0x22aa('0xa'));var FreshdeskAccount=require(_0x22aa('0xb'));var SugarcrmAccount=require('../model/sugarcrmAccount');var ZohoAccount=require(_0x22aa('0xc'));var DeskAccount=require(_0x22aa('0xd'));var VtigerAccount=require(_0x22aa('0xe'));var ServicenowAccount=require(_0x22aa('0xf'));var Dynamics365Account=require('../model/dynamics365Account');var FreshsalesAccount=require(_0x22aa('0x10'));var FaxAccount=require(_0x22aa('0x11'));var Realtime=function(){this[_0x22aa('0x12')]={};this[_0x22aa('0x13')]={};this[_0x22aa('0x14')]={};this[_0x22aa('0x15')]={};this[_0x22aa('0x16')]={};this[_0x22aa('0x17')]={};this[_0x22aa('0x18')]={};this[_0x22aa('0x19')]={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this[_0x22aa('0x1a')]={};this[_0x22aa('0x1b')]={};this['queueChannels']={};this[_0x22aa('0x1c')]={};this[_0x22aa('0x1d')]={};this[_0x22aa('0x1e')]={};this[_0x22aa('0x1f')]={};this[_0x22aa('0x20')]={};this[_0x22aa('0x21')]={};this[_0x22aa('0x22')]={};this['zohoAccounts']={};this[_0x22aa('0x23')]={};this[_0x22aa('0x24')]={};this['servicenowAccounts']={};this[_0x22aa('0x25')]={};this['freshsalesAccounts']={};this[_0x22aa('0x26')]={};};function freeIsNotKey(_0x45e450,_0x118d20,_0x27e164){var _0x4ea031=_[_0x22aa('0x27')](_0x45e450,function(_0x21e4ea,_0x2865d2){return _0x21e4ea[_0x27e164];});for(var _0xb4fa64 in _0x118d20){if(_0x118d20[_0x22aa('0x28')](_0xb4fa64)){if(!_0x4ea031[_0xb4fa64]){delete _0x118d20[_0xb4fa64];}}}}function freeIsNotKeySip(_0x569110,_0x5acdae){var _0x9b6fcb=_['mapKeys'](_0x569110,function(_0x590a4d,_0x5b5d92){return util[_0x22aa('0x29')]('SIP/%s',_0x590a4d[_0x22aa('0x2a')]);});for(var _0x29caf5 in _0x5acdae){if(_0x5acdae[_0x22aa('0x28')](_0x29caf5)){if(!_0x9b6fcb[_0x29caf5]){delete _0x5acdae[_0x29caf5];}}}}function freeIsNotKeyAgent(_0x18bf3e,_0x4f80bc){var _0x1a74fb=_[_0x22aa('0x27')](_0x18bf3e,function(_0x348775,_0x51070b){var _0x1e9ce3=_[_0x22aa('0x2b')](_0x348775[_0x22aa('0x2c')])?util[_0x22aa('0x29')](_0x22aa('0x2d'),_0x348775['name']):_0x348775[_0x22aa('0x2c')];return _0x1e9ce3;});for(var _0x623922 in _0x4f80bc){if(_0x4f80bc[_0x22aa('0x28')](_0x623922)){if(!_0x1a74fb[_0x623922]){delete _0x4f80bc[_0x623922];}}}}function clearVoiceCallReports(_0x527f18){_0x527f18[_0x22aa('0x2e')]=0x0;_0x527f18[_0x22aa('0x2f')]=0x0;_0x527f18[_0x22aa('0x30')]=0x0;_0x527f18[_0x22aa('0x31')]=0x0;_0x527f18[_0x22aa('0x32')]=0x0;}function clearCampaigns(_0x212e93){if(!_['isEmpty'](_0x212e93)){for(var _0x43cf87 in _0x212e93){if(_0x212e93[_0x22aa('0x28')](_0x43cf87)){_0x212e93[_0x43cf87][_0x22aa('0x33')]=0x0;_0x212e93[_0x43cf87][_0x22aa('0x34')]=0x0;}}}}function clearVoiceQueues(_0x3db982){if(!_[_0x22aa('0x35')](_0x3db982)){for(var _0x29a396 in _0x3db982){if(_0x3db982['hasOwnProperty'](_0x29a396)){_0x3db982[_0x29a396][_0x22aa('0x2e')]=0x0;_0x3db982[_0x29a396][_0x22aa('0x2f')]=0x0;_0x3db982[_0x29a396][_0x22aa('0x36')]=0x0;_0x3db982[_0x29a396][_0x22aa('0x37')]=0x0;_0x3db982[_0x29a396][_0x22aa('0x30')]=0x0;_0x3db982[_0x29a396][_0x22aa('0x31')]=0x0;_0x3db982[_0x29a396][_0x22aa('0x32')]=0x0;_0x3db982[_0x29a396][_0x22aa('0x38')]=0x0;_0x3db982[_0x29a396][_0x22aa('0x39')]=0x0;_0x3db982[_0x29a396]['outboundBusyCallsDay']=0x0;_0x3db982[_0x29a396][_0x22aa('0x3a')]=0x0;_0x3db982[_0x29a396][_0x22aa('0x3b')]=0x0;_0x3db982[_0x29a396][_0x22aa('0x3c')]=0x0;_0x3db982[_0x29a396][_0x22aa('0x3d')]=0x0;_0x3db982[_0x29a396]['outboundDropCallsDayCallersExit']=0x0;_0x3db982[_0x29a396][_0x22aa('0x3e')]=0x0;_0x3db982[_0x29a396][_0x22aa('0x3f')]=0x0;_0x3db982[_0x29a396]['outboundRejectCallsDay']=0x0;_0x3db982[_0x29a396][_0x22aa('0x40')]=0x0;_0x3db982[_0x29a396]['outboundAnswerAgiCallsDay']=0x0;_0x3db982[_0x29a396]['outboundAnswerCallsDay']=0x0;_0x3db982[_0x29a396][_0x22aa('0x41')]=!![];}}}}Realtime[_0x22aa('0x42')][_0x22aa('0x43')]=function(_0x1b8937,_0x5e0188){for(var _0x4d9c74 in _0x5e0188){if(_0x1b8937['hasOwnProperty'](_0x4d9c74)){_0x1b8937[_0x4d9c74]=_0x5e0188[_0x4d9c74];}}};Realtime[_0x22aa('0x42')][_0x22aa('0x44')]=function(){var _0x1df347=this;return function(_0x37f834){if(_0x37f834){freeIsNotKeyAgent(_0x37f834,_0x1df347[_0x22aa('0x12')]);for(var _0x28cb8b=0x0,_0xbe1b8f={},_0x384752={};_0x28cb8b<_0x37f834[_0x22aa('0x45')];_0x28cb8b+=0x1){_0xbe1b8f=_0x37f834[_0x28cb8b];var _0x425904=_['isNil'](_0xbe1b8f['interface'])?util[_0x22aa('0x29')](_0x22aa('0x2d'),_0xbe1b8f[_0x22aa('0x2a')]):_0xbe1b8f[_0x22aa('0x2c')];if(_[_0x22aa('0x46')](_0x1df347[_0x22aa('0x12')][_0x425904])){_0x1df347[_0x22aa('0x12')][_0x425904]=new Agent(_0xbe1b8f);}else{_0x1df347[_0x22aa('0x43')](_0x1df347[_0x22aa('0x12')][_0x425904],_0xbe1b8f);}}}return _0x1df347[_0x22aa('0x12')];};};Realtime['prototype'][_0x22aa('0x47')]=function(){var _0x15fb9e=this;return function(_0x2b3d8b){if(_0x2b3d8b){freeIsNotKeySip(_0x2b3d8b,_0x15fb9e[_0x22aa('0x13')]);for(var _0x465f9e=0x0,_0x196d61={},_0x2fabbd={};_0x465f9e<_0x2b3d8b['length'];_0x465f9e+=0x1){_0x196d61=_0x2b3d8b[_0x465f9e];if(_[_0x22aa('0x46')](_0x15fb9e[_0x22aa('0x13')][util['format']('SIP/%s',_0x196d61[_0x22aa('0x2a')])])){_0x15fb9e['telephones'][util['format']('SIP/%s',_0x196d61[_0x22aa('0x2a')])]=new Telephone(_0x196d61);}else{_0x15fb9e[_0x22aa('0x43')](_0x15fb9e[_0x22aa('0x13')][util[_0x22aa('0x29')](_0x22aa('0x2d'),_0x196d61[_0x22aa('0x2a')])],_0x196d61);}}}return _0x15fb9e[_0x22aa('0x13')];};};Realtime[_0x22aa('0x42')]['initTrunks']=function(){var _0x3b4a07=this;return function(_0x283ff8){if(_0x283ff8){freeIsNotKeySip(_0x283ff8,_0x3b4a07['trunks']);for(var _0x4bb373=0x0,_0x795771={},_0x41203b={};_0x4bb373<_0x283ff8['length'];_0x4bb373+=0x1){_0x795771=_0x283ff8[_0x4bb373];if(_[_0x22aa('0x46')](_0x3b4a07[_0x22aa('0x14')][util[_0x22aa('0x29')](_0x22aa('0x2d'),_0x795771[_0x22aa('0x2a')])])){_0x3b4a07[_0x22aa('0x14')][util[_0x22aa('0x29')](_0x22aa('0x2d'),_0x795771[_0x22aa('0x2a')])]=new Trunk(_0x795771);}else{_0x3b4a07['mergeFromDatabase'](_0x3b4a07[_0x22aa('0x14')][util[_0x22aa('0x29')]('SIP/%s',_0x795771[_0x22aa('0x2a')])],_0x795771);}}}return _0x3b4a07[_0x22aa('0x14')];};};Realtime[_0x22aa('0x42')][_0x22aa('0x48')]=function(){var _0x5a36fc=this;return function(_0x5165ba){if(_0x5165ba){freeIsNotKey(_0x5165ba,_0x5a36fc[_0x22aa('0x15')],_0x22aa('0x2a'));for(var _0x4b1969=0x0,_0x5768ee={},_0x3ab141={};_0x4b1969<_0x5165ba[_0x22aa('0x45')];_0x4b1969+=0x1){_0x5768ee=_0x5165ba[_0x4b1969];if(_[_0x22aa('0x46')](_0x5a36fc['voiceQueues'][_0x5768ee[_0x22aa('0x2a')]])){_0x5a36fc[_0x22aa('0x15')][_0x5768ee[_0x22aa('0x2a')]]=new VoiceQueue(_0x5768ee);}else{_0x5a36fc['mergeFromDatabase'](_0x5a36fc[_0x22aa('0x15')][_0x5768ee[_0x22aa('0x2a')]],_0x5768ee);}}}return _0x5a36fc[_0x22aa('0x15')];};};Realtime[_0x22aa('0x42')][_0x22aa('0x49')]=function(){var _0x512768=this;return function(_0x4b3aff){if(_0x4b3aff){freeIsNotKey(_0x4b3aff,_0x512768['triggers'],'id');for(var _0x203fdd=0x0,_0x50ee04={},_0x67bb85={};_0x203fdd<_0x4b3aff[_0x22aa('0x45')];_0x203fdd+=0x1){_0x50ee04=_0x4b3aff[_0x203fdd];if(_[_0x22aa('0x46')](_0x512768[_0x22aa('0x16')][_0x50ee04['id']])){_0x512768['triggers'][_0x50ee04['id']]=new Trigger(_0x50ee04);}else{_0x512768[_0x22aa('0x43')](_0x512768['triggers'][_0x50ee04['id']],_0x50ee04);}}}return _0x512768[_0x22aa('0x16')];};};Realtime[_0x22aa('0x42')][_0x22aa('0x4a')]=function(){var _0x2ecfa0=this;return function(_0x47da52){if(_0x47da52){freeIsNotKey(_0x47da52,_0x2ecfa0['templates'],'id');for(var _0x361d4b=0x0,_0x36a5d8={},_0x12648a={};_0x361d4b<_0x47da52['length'];_0x361d4b+=0x1){_0x36a5d8=_0x47da52[_0x361d4b];if(_[_0x22aa('0x46')](_0x2ecfa0['templates'][_0x36a5d8['id']])){_0x2ecfa0['templates'][_0x36a5d8['id']]=new Template(_0x36a5d8);}else{_0x2ecfa0['mergeFromDatabase'](_0x2ecfa0[_0x22aa('0x18')][_0x36a5d8['id']],_0x36a5d8);}}}return _0x2ecfa0['templates'];};};Realtime['prototype'][_0x22aa('0x4b')]=function(){var _0x349a1e=this;return function(_0x4b536f){if(_0x4b536f){freeIsNotKey(_0x4b536f,_0x349a1e[_0x22aa('0x1f')],'id');for(var _0x75702d=0x0,_0x6debdb={},_0x6726cf={};_0x75702d<_0x4b536f[_0x22aa('0x45')];_0x75702d+=0x1){_0x6debdb=_0x4b536f[_0x75702d];if(_[_0x22aa('0x46')](_0x349a1e[_0x22aa('0x1f')][_0x6debdb['id']])){_0x349a1e[_0x22aa('0x1f')][_0x6debdb['id']]=new ZendeskAccount(_0x6debdb);}else{_0x349a1e[_0x22aa('0x43')](_0x349a1e[_0x22aa('0x1f')][_0x6debdb['id']],_0x6debdb);}}}return _0x349a1e['zendeskAccounts'];};};Realtime[_0x22aa('0x42')][_0x22aa('0x4c')]=function(){var _0x45b1b6=this;return function(_0x40b88c){if(_0x40b88c){freeIsNotKey(_0x40b88c,_0x45b1b6[_0x22aa('0x20')],'id');for(var _0x46fd39=0x0,_0x212e09={},_0x586fc7={};_0x46fd39<_0x40b88c[_0x22aa('0x45')];_0x46fd39+=0x1){_0x212e09=_0x40b88c[_0x46fd39];if(_[_0x22aa('0x46')](_0x45b1b6[_0x22aa('0x20')][_0x212e09['id']])){_0x45b1b6[_0x22aa('0x20')][_0x212e09['id']]=new SalesforceAccount(_0x212e09);}else{_0x45b1b6['mergeFromDatabase'](_0x45b1b6[_0x22aa('0x20')][_0x212e09['id']],_0x212e09);}}}return _0x45b1b6['salesforceAccounts'];};};Realtime[_0x22aa('0x42')][_0x22aa('0x4d')]=function(){var _0x21ce6d=this;return function(_0x1afca8){if(_0x1afca8){freeIsNotKey(_0x1afca8,_0x21ce6d[_0x22aa('0x22')],'id');for(var _0x50e7d8=0x0,_0x58d2ef={},_0x188106={};_0x50e7d8<_0x1afca8[_0x22aa('0x45')];_0x50e7d8+=0x1){_0x58d2ef=_0x1afca8[_0x50e7d8];if(_[_0x22aa('0x46')](_0x21ce6d[_0x22aa('0x22')][_0x58d2ef['id']])){_0x21ce6d[_0x22aa('0x22')][_0x58d2ef['id']]=new FreshdeskAccount(_0x58d2ef);}else{_0x21ce6d[_0x22aa('0x43')](_0x21ce6d[_0x22aa('0x22')][_0x58d2ef['id']],_0x58d2ef);}}}return _0x21ce6d[_0x22aa('0x22')];};};Realtime[_0x22aa('0x42')]['initZohoAccounts']=function(){var _0xc8988c=this;return function(_0xc73d5){if(_0xc73d5){freeIsNotKey(_0xc73d5,_0xc8988c['zohoAccounts'],'id');for(var _0x172856=0x0,_0x55218e={},_0x135fba={};_0x172856<_0xc73d5['length'];_0x172856+=0x1){_0x55218e=_0xc73d5[_0x172856];if(_[_0x22aa('0x46')](_0xc8988c['zohoAccounts'][_0x55218e['id']])){_0xc8988c[_0x22aa('0x4e')][_0x55218e['id']]=new ZohoAccount(_0x55218e);}else{_0xc8988c['mergeFromDatabase'](_0xc8988c['zohoAccounts'][_0x55218e['id']],_0x55218e);}}}return _0xc8988c['zohoAccounts'];};};Realtime[_0x22aa('0x42')][_0x22aa('0x4f')]=function(){var _0x6078e8=this;return function(_0x2d9468){if(_0x2d9468){freeIsNotKey(_0x2d9468,_0x6078e8[_0x22aa('0x23')],'id');for(var _0x4a7fd5=0x0,_0x327e9f={},_0x38a4d3={};_0x4a7fd5<_0x2d9468['length'];_0x4a7fd5+=0x1){_0x327e9f=_0x2d9468[_0x4a7fd5];if(_['isUndefined'](_0x6078e8[_0x22aa('0x23')][_0x327e9f['id']])){_0x6078e8[_0x22aa('0x23')][_0x327e9f['id']]=new DeskAccount(_0x327e9f);}else{_0x6078e8[_0x22aa('0x43')](_0x6078e8['deskAccounts'][_0x327e9f['id']],_0x327e9f);}}}return _0x6078e8[_0x22aa('0x23')];};};Realtime[_0x22aa('0x42')][_0x22aa('0x50')]=function(){var _0x500b2a=this;return function(_0x52bd40){if(_0x52bd40){freeIsNotKey(_0x52bd40,_0x500b2a['sugarcrmAccounts'],'id');for(var _0x1d1b64=0x0,_0x1cc678={},_0x2a7d99={};_0x1d1b64<_0x52bd40[_0x22aa('0x45')];_0x1d1b64+=0x1){_0x1cc678=_0x52bd40[_0x1d1b64];if(_[_0x22aa('0x46')](_0x500b2a['sugarcrmAccounts'][_0x1cc678['id']])){_0x500b2a['sugarcrmAccounts'][_0x1cc678['id']]=new SugarcrmAccount(_0x1cc678);}else{_0x500b2a[_0x22aa('0x43')](_0x500b2a[_0x22aa('0x21')][_0x1cc678['id']],_0x1cc678);}}}return _0x500b2a[_0x22aa('0x21')];};};Realtime[_0x22aa('0x42')][_0x22aa('0x51')]=function(){var _0x5bc078=this;return function(_0x4aff6b){if(_0x4aff6b){freeIsNotKey(_0x4aff6b,_0x5bc078['vtigerAccounts'],'id');for(var _0x2c99e7=0x0,_0x19a742={},_0x2e3bb1={};_0x2c99e7<_0x4aff6b['length'];_0x2c99e7+=0x1){_0x19a742=_0x4aff6b[_0x2c99e7];if(_[_0x22aa('0x46')](_0x5bc078[_0x22aa('0x24')][_0x19a742['id']])){_0x5bc078[_0x22aa('0x24')][_0x19a742['id']]=new VtigerAccount(_0x19a742);}else{_0x5bc078['mergeFromDatabase'](_0x5bc078[_0x22aa('0x24')][_0x19a742['id']],_0x19a742);}}}return _0x5bc078[_0x22aa('0x24')];};};Realtime['prototype'][_0x22aa('0x52')]=function(){var _0x96066b=this;return function(_0x385e9d){if(_0x385e9d){freeIsNotKey(_0x385e9d,_0x96066b['servicenowAccounts'],'id');for(var _0x4a72c6=0x0,_0x2aa78e={},_0x3c0ac={};_0x4a72c6<_0x385e9d[_0x22aa('0x45')];_0x4a72c6+=0x1){_0x2aa78e=_0x385e9d[_0x4a72c6];if(_['isUndefined'](_0x96066b['servicenowAccounts'][_0x2aa78e['id']])){_0x96066b['servicenowAccounts'][_0x2aa78e['id']]=new ServicenowAccount(_0x2aa78e);}else{_0x96066b['mergeFromDatabase'](_0x96066b[_0x22aa('0x53')][_0x2aa78e['id']],_0x2aa78e);}}}return _0x96066b[_0x22aa('0x53')];};};Realtime[_0x22aa('0x42')][_0x22aa('0x54')]=function(){var _0x39f715=this;return function(_0x4bb2cd){if(_0x4bb2cd){freeIsNotKey(_0x4bb2cd,_0x39f715[_0x22aa('0x25')],'id');for(var _0x2d4291=0x0,_0x1defe6={},_0x572802={};_0x2d4291<_0x4bb2cd['length'];_0x2d4291+=0x1){_0x1defe6=_0x4bb2cd[_0x2d4291];if(_[_0x22aa('0x46')](_0x39f715['dynamics365Accounts'][_0x1defe6['id']])){_0x39f715[_0x22aa('0x25')][_0x1defe6['id']]=new Dynamics365Account(_0x1defe6);}else{_0x39f715[_0x22aa('0x43')](_0x39f715['dynamics365Accounts'][_0x1defe6['id']],_0x1defe6);}}}return _0x39f715['dynamics365Accounts'];};};Realtime[_0x22aa('0x42')]['initFreshsalesAccounts']=function(){var _0x26ab37=this;return function(_0x505025){if(_0x505025){freeIsNotKey(_0x505025,_0x26ab37['freshsalesAccounts'],'id');for(var _0x4add0d=0x0,_0x2bc5fe={},_0x250766={};_0x4add0d<_0x505025[_0x22aa('0x45')];_0x4add0d+=0x1){_0x2bc5fe=_0x505025[_0x4add0d];if(_[_0x22aa('0x46')](_0x26ab37[_0x22aa('0x55')][_0x2bc5fe['id']])){_0x26ab37[_0x22aa('0x55')][_0x2bc5fe['id']]=new FreshsalesAccount(_0x2bc5fe);}else{_0x26ab37['mergeFromDatabase'](_0x26ab37[_0x22aa('0x55')][_0x2bc5fe['id']],_0x2bc5fe);}}}return _0x26ab37[_0x22aa('0x55')];};};Realtime[_0x22aa('0x42')][_0x22aa('0x56')]=function(){var _0x3f1ac3=this;return function(_0xc68499){for(var _0xc3ec8f=0x0;_0xc3ec8f<_0xc68499['length'];_0xc3ec8f+=0x1){_[_0x22aa('0x57')](_0x3f1ac3[_0x22aa('0x15')][_0xc68499[_0xc3ec8f][_0x22aa('0x2a')]],_0xc68499[_0xc3ec8f]);}return _0x3f1ac3[_0x22aa('0x15')];};};Realtime[_0x22aa('0x42')]['initVoiceQueueReports']=function(){var _0x4bed91=this;return function(_0x317bf4){clearVoiceQueues(_0x4bed91[_0x22aa('0x15')]);if(_0x317bf4){_0x317bf4=_[_0x22aa('0x58')](_0x317bf4,'uniqueid');for(var _0x5130d5 in _0x317bf4){if(_0x317bf4[_0x22aa('0x28')](_0x5130d5)){var _0x11ca86={};for(var _0x1ea0ca=0x0;_0x1ea0ca<_0x317bf4[_0x5130d5][_0x22aa('0x45')];_0x1ea0ca+=0x1){var _0xb9a9dd=_0x317bf4[_0x5130d5][_0x1ea0ca][_0x22aa('0x59')];if(_0x4bed91['voiceQueues'][_0xb9a9dd]){if(_0x317bf4[_0x5130d5][_0x1ea0ca][_0x22aa('0x5a')]){_0x4bed91['voiceQueues'][_0xb9a9dd]['unmanaged']+=0x1;}if(_0x317bf4[_0x5130d5][_0x1ea0ca]['queuecallerabandon']){_0x4bed91['voiceQueues'][_0xb9a9dd][_0x22aa('0x37')]+=0x1;}_0x4bed91[_0x22aa('0x15')][_0xb9a9dd]['sumHoldTime']+=moment(_0x317bf4[_0x5130d5][_0x1ea0ca][_0x22aa('0x5b')])[_0x22aa('0x5c')](moment(_0x317bf4[_0x5130d5][_0x1ea0ca][_0x22aa('0x5d')]),'seconds')||0x0;if(_0x1ea0ca===_0x317bf4[_0x5130d5][_0x22aa('0x45')]-0x1){_0x4bed91[_0x22aa('0x15')][_0xb9a9dd][_0x22aa('0x31')]+=moment(_0x317bf4[_0x5130d5][_0x1ea0ca][_0x22aa('0x5e')]||_0x317bf4[_0x5130d5][_0x1ea0ca][_0x22aa('0x5f')]||_0x317bf4[_0x5130d5][_0x1ea0ca][_0x22aa('0x60')])[_0x22aa('0x5c')](moment(_0x317bf4[_0x5130d5][_0x1ea0ca][_0x22aa('0x5d')]),'seconds')||0x0;_0x4bed91[_0x22aa('0x15')][_0xb9a9dd][_0x22aa('0x2e')]+=0x1;if(_0x317bf4[_0x5130d5][_0x1ea0ca][_0x22aa('0x61')]){_0x4bed91[_0x22aa('0x15')][_0xb9a9dd]['answered']+=0x1;_0x4bed91['voiceQueues'][_0xb9a9dd]['sumBillable']+=moment(_0x317bf4[_0x5130d5][_0x1ea0ca][_0x22aa('0x5e')])[_0x22aa('0x5c')](moment(_0x317bf4[_0x5130d5][_0x1ea0ca][_0x22aa('0x5b')]),_0x22aa('0x62'))||0x0;}}else{_0x4bed91[_0x22aa('0x15')][_0xb9a9dd][_0x22aa('0x31')]+=_0x4bed91['voiceQueues'][_0xb9a9dd][_0x22aa('0x30')]||0x0;}}}}}}return _0x4bed91['voiceQueues'];};};Realtime[_0x22aa('0x42')][_0x22aa('0x63')]=function(){var _0x5f4e3b=this;return function(_0x58d97d){clearVoiceCallReports(_0x5f4e3b['outbound']);if(_0x58d97d){for(var _0x299e0b=0x0;_0x299e0b<_0x58d97d[_0x22aa('0x45')];_0x299e0b+=0x1){_0x5f4e3b[_0x22aa('0x19')]['total']+=0x1;_0x5f4e3b[_0x22aa('0x19')][_0x22aa('0x31')]+=_0x58d97d[_0x299e0b][_0x22aa('0x64')];if(_0x58d97d[_0x299e0b][_0x22aa('0x65')]===_0x22aa('0x66')){_0x5f4e3b['outbound'][_0x22aa('0x2f')]+=0x1;_0x5f4e3b['outbound']['sumHoldTime']+=_0x58d97d[_0x299e0b][_0x22aa('0x64')]-_0x58d97d[_0x299e0b][_0x22aa('0x67')]||0x0;_0x5f4e3b[_0x22aa('0x19')][_0x22aa('0x32')]+=_0x58d97d[_0x299e0b][_0x22aa('0x67')];}}}return _0x5f4e3b[_0x22aa('0x19')];};};Realtime[_0x22aa('0x42')][_0x22aa('0x68')]=function(){var _0x592bdb=this;return function(_0x3cb444){if(_0x3cb444){freeIsNotKey(_0x3cb444,_0x592bdb['campaigns'],_0x22aa('0x2a'));for(var _0x5916a8=0x0,_0x40d87a={};_0x5916a8<_0x3cb444['length'];_0x5916a8+=0x1){_0x40d87a=_0x3cb444[_0x5916a8];if(_['isUndefined'](_0x592bdb['campaigns'][_0x40d87a[_0x22aa('0x2a')]])){_0x592bdb[_0x22aa('0x17')][_0x40d87a[_0x22aa('0x2a')]]=new Campaign(_0x40d87a);}else{_0x592bdb['mergeFromDatabase'](_0x592bdb['campaigns'][_0x40d87a['name']],_0x40d87a);_0x592bdb[_0x22aa('0x17')][_0x40d87a[_0x22aa('0x2a')]][_0x22aa('0x69')]=_0x40d87a[_0x22aa('0x6a')]?_0x40d87a[_0x22aa('0x6a')][_0x22aa('0x2a')]:undefined;}}}return _0x592bdb[_0x22aa('0x17')];};};Realtime['prototype']['initVoiceExtensions']=function(){var _0x322f27=this;return function(_0x702659){if(_0x702659){freeIsNotKey(_0x702659,_0x322f27[_0x22aa('0x1a')],'id');for(var _0x1eb78c=0x0,_0x20a01a={};_0x1eb78c<_0x702659['length'];_0x1eb78c+=0x1){_0x20a01a=_0x702659[_0x1eb78c];if(_['isUndefined'](_0x322f27[_0x22aa('0x1a')][_0x20a01a['id']])){_0x322f27[_0x22aa('0x1a')][_0x20a01a['id']]=new VoiceExtension(_0x20a01a);}else{_0x322f27['mergeFromDatabase'](_0x322f27['voiceExtensions'][_0x20a01a['id']],_0x20a01a);}}}return _0x322f27[_0x22aa('0x1a')];};};Realtime[_0x22aa('0x42')][_0x22aa('0x6b')]=function(){var _0x449412=this;return function(_0x4bf963){clearCampaigns(_0x449412[_0x22aa('0x17')]);for(var _0xb3a253=0x0;_0xb3a253<_0x4bf963['length'];_0xb3a253+=0x1){_[_0x22aa('0x57')](_0x449412['campaigns'][_0x4bf963[_0xb3a253][_0x22aa('0x2a')]],_0x4bf963[_0xb3a253]);}return _0x449412['campaigns'];};};Realtime[_0x22aa('0x42')][_0x22aa('0x6c')]=function(){var _0x4900df=this;return function(_0x4656a3){if(_0x4656a3){freeIsNotKey(_0x4656a3,_0x4900df[_0x22aa('0x26')],'id');for(var _0x48b0ea=0x0,_0x46ed96={},_0x3249fb={};_0x48b0ea<_0x4656a3[_0x22aa('0x45')];_0x48b0ea+=0x1){_0x46ed96=_0x4656a3[_0x48b0ea];if(_[_0x22aa('0x46')](_0x4900df[_0x22aa('0x26')][_0x46ed96['id']])){_0x4900df['faxAccounts'][_0x46ed96['id']]=new FaxAccount(_0x46ed96);}else{_0x4900df[_0x22aa('0x43')](_0x4900df[_0x22aa('0x26')][_0x46ed96['id']],_0x46ed96);}}}return _0x4900df[_0x22aa('0x26')];};};module['exports']=Realtime; \ No newline at end of file diff --git a/server/services/ami/report/index.js b/server/services/ami/report/index.js index e4195ff..5a93857 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 _0xa8ae=['mobile','substring','lastIndexOf','transfererlinkedid','exports','lodash','util','../../../config/environment','../ami','../rpc/voiceAgentReport','../rpc/voiceDialReport','../rpc/memberReport','../rpc/voiceQueueReport','../rpc/voiceRecording','./voiceCallReport','./voiceDialReport','./userReport','realtime','agents','telephones','prototype','xdr','disabled','custom:voiceQueueReport','voiceQueueReport','custom:voiceCallReport','voiceCallReport','bind','voiceAgentReport','custom:voiceDialReport','blindtransfer','blindTransfer','attendedtransfer','attendedTransfer','find','accountcode','name','format','SIP/%s','findAgent','connectedlinenum','lastAssignedTo','interface','queuecallercomplete','YYYY-MM-DD\x20HH:mm:ss','queuecallerexit','queuecallerexitAt','create','match','getAgentByInternal','keys','length','getCallType','channel','outbound','internal','destination','exten','type','dialer','lastapplication','queue','lastdata','context','from-voip-provider','callerid','calleridpreview','calleridnum','originatecalleridnum','destinationchannel','disposition','ANSWERED','calleridname','transfers','linkedid','transfereelinkedid','uniqueid','isNil','UserId','membername','monitor','monitorFilename','monitors','createdAt','connectedlinename','forEach','voiceDialReport','Local','indexOf'];(function(_0x2bbc7b,_0x1a3a09){var _0x34d09b=function(_0x644839){while(--_0x644839){_0x2bbc7b['push'](_0x2bbc7b['shift']());}};_0x34d09b(++_0x1a3a09);}(_0xa8ae,0xb7));var _0xea8a=function(_0x2f3f88,_0x3305b3){_0x2f3f88=_0x2f3f88-0x0;var _0x33cce4=_0xa8ae[_0x2f3f88];return _0x33cce4;};'use strict';var _=require(_0xea8a('0x0'));var moment=require('moment');var util=require(_0xea8a('0x1'));var config=require(_0xea8a('0x2'));var ami=require(_0xea8a('0x3'));var RpcVoiceAgentReport=require(_0xea8a('0x4'));var RpcVoiceCallReport=require('../rpc/voiceCallReport');var RpcVoiceDialReport=require(_0xea8a('0x5'));var RpcMemberReport=require(_0xea8a('0x6'));var RpcVoiceQueueReport=require(_0xea8a('0x7'));var RpcVoiceRecording=require(_0xea8a('0x8'));var RpcVoiceTransferReport=require('../rpc/voiceTransferReport');var VoiceQueueReport=require('./voiceQueueReport');var VoiceCallReport=require(_0xea8a('0x9'));var VoiceAgentReport=require('./voiceAgentReport');var VoiceDialReport=require(_0xea8a('0xa'));var UserReport=require(_0xea8a('0xb'));function Report(_0x1b6f31){this[_0xea8a('0xc')]=_0x1b6f31;this['agents']=_0x1b6f31[_0xea8a('0xd')];this[_0xea8a('0xe')]=_0x1b6f31[_0xea8a('0xe')];}Report[_0xea8a('0xf')]['sync']=function(_0x2ed841){var _0x4969e1=new VoiceQueueReport(this[_0xea8a('0xc')]);var _0x5eddff=new VoiceAgentReport(this['realtime']);var _0x540642=new VoiceDialReport(this[_0xea8a('0xc')]);var _0x5bd6f3=new VoiceCallReport(this[_0xea8a('0xc')]);var _0x4926da=new UserReport(this[_0xea8a('0xc')]);if(config[_0xea8a('0x10')]&&config[_0xea8a('0x10')][_0xea8a('0x11')]){ami['on'](_0xea8a('0x12'),this[_0xea8a('0x13')]['bind'](this));ami['on'](_0xea8a('0x14'),this[_0xea8a('0x15')][_0xea8a('0x16')](this));ami['on']('custom:voiceAgentReport',this[_0xea8a('0x17')][_0xea8a('0x16')](this));ami['on'](_0xea8a('0x18'),this['voiceDialReport'][_0xea8a('0x16')](this));ami['on'](_0xea8a('0x19'),this[_0xea8a('0x1a')][_0xea8a('0x16')](this));ami['on'](_0xea8a('0x1b'),this[_0xea8a('0x1c')]['bind'](this));}};Report[_0xea8a('0xf')]['findAgent']=function(_0x162764){var _0x5a01d2;_0x5a01d2=_[_0xea8a('0x1d')](this[_0xea8a('0xd')],function(_0x19b194){return _0x19b194[_0xea8a('0x1e')]==_0x162764||_0x19b194['name']==_0x162764;});if(_['isNil'](_0x5a01d2)){var _0x3cf1d4=_[_0xea8a('0x1d')](this['telephones'],function(_0x148f02){return _0x148f02[_0xea8a('0x1e')]==_0x162764||_0x148f02[_0xea8a('0x1f')]==_0x162764;});if(_0x3cf1d4){_0x5a01d2=_['find'](this['agents'],function(_0x52b48e){return _0x52b48e['interface']==util[_0xea8a('0x20')](_0xea8a('0x21'),_0x3cf1d4[_0xea8a('0x1f')]);});}}return _0x5a01d2;};Report[_0xea8a('0xf')][_0xea8a('0x13')]=function(_0x3ffb4f){for(var _0x52c3f5=0x0;_0x52c3f5<_0x3ffb4f['length'];_0x52c3f5+=0x1){var _0x13b615=this[_0xea8a('0x22')](_0x3ffb4f[_0x52c3f5][_0xea8a('0x23')]);if(_0x13b615){_0x3ffb4f[_0x52c3f5][_0xea8a('0x1e')]=_0x13b615[_0xea8a('0x1e')];_0x3ffb4f[_0x52c3f5]['assigned']=!![];_0x3ffb4f[_0x52c3f5][_0xea8a('0x24')]=_0x13b615['name'];_0x3ffb4f[_0x52c3f5][_0xea8a('0x25')]=_['isNil'](_0x13b615[_0xea8a('0x25')])?util[_0xea8a('0x20')](_0xea8a('0x21'),_0x13b615[_0xea8a('0x1f')]):_0x13b615[_0xea8a('0x25')];if(_0x3ffb4f[_0x52c3f5][_0xea8a('0x26')]){_0x3ffb4f[_0x52c3f5]['queuecallercompleteAt']=moment()[_0xea8a('0x20')](_0xea8a('0x27'));}if(_0x3ffb4f[_0x52c3f5][_0xea8a('0x28')]){_0x3ffb4f[_0x52c3f5][_0xea8a('0x29')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}RpcMemberReport[_0xea8a('0x13')](_0x3ffb4f[_0x52c3f5]);}RpcVoiceQueueReport[_0xea8a('0x2a')](_0x3ffb4f[_0x52c3f5]);}};function extractCalleridNumber(_0x1638d3){var _0x23ee1b=_0x1638d3[_0xea8a('0x2b')](/<(.*?)>/);return _0x23ee1b?_0x23ee1b[0x1]:_0x1638d3;}Report['prototype'][_0xea8a('0x2c')]=function(_0x167309){for(var _0x13a7f1=0x0;_0x13a7f1',_0x18d3aa[_0xea8a('0x43')],_0x18d3aa[_0xea8a('0x3e')]);}if(RpcVoiceTransferReport[_0xea8a('0x44')][_0x18d3aa[_0xea8a('0x45')]]){var _0x517569=RpcVoiceTransferReport[_0xea8a('0x44')][_0x18d3aa['linkedid']];_0x517569[_0xea8a('0x46')]=_0x18d3aa[_0xea8a('0x47')];RpcVoiceTransferReport[_0xea8a('0x1a')](_0x517569);delete RpcVoiceTransferReport['transfers'][_0x18d3aa[_0xea8a('0x45')]];}if(_[_0xea8a('0x48')](_0x18d3aa[_0xea8a('0x35')])){_0x18d3aa[_0xea8a('0x35')]=this['getCallType'](_0x18d3aa);}if(_[_0xea8a('0x48')](_0x18d3aa[_0xea8a('0x49')])){var _0x563da7=_0x18d3aa['channel']['split']('-')[0x0];var _0x2962c9=this['agents'][_0x563da7];if(!_0x2962c9)_0x2962c9=this['getAgentByInternal'](_0x18d3aa['accountcode']);if(_0x2962c9){_0x18d3aa[_0xea8a('0x49')]=_0x2962c9['id'];_0x18d3aa[_0xea8a('0x4a')]=_0x2962c9['name'];}}RpcVoiceCallReport[_0xea8a('0x2a')](_0x18d3aa);if(_0x18d3aa[_0xea8a('0x4b')]){for(var _0x7c9e4b=0x0;_0x7c9e4b<_0x18d3aa['monitors'][_0xea8a('0x2e')];_0x7c9e4b+=0x1){_0x18d3aa[_0xea8a('0x4c')]=_0x18d3aa[_0xea8a('0x4d')][_0x7c9e4b]['filename'];_0x18d3aa[_0xea8a('0x4e')]=_0x18d3aa[_0xea8a('0x4d')][_0x7c9e4b][_0xea8a('0x4e')];if(_0x18d3aa['exten']=='xcally-motion-preview'){_0x18d3aa[_0xea8a('0x3e')]=_0x18d3aa['connectedlinenum'];_0x18d3aa[_0xea8a('0x43')]=_0x18d3aa[_0xea8a('0x4f')];_0x18d3aa['connectedlinenum']=_0x18d3aa['accountcode'];_0x18d3aa[_0xea8a('0x4f')]=_0x18d3aa['membername'];_0x18d3aa[_0xea8a('0x34')]=_0x18d3aa[_0xea8a('0x3f')];}else if(_0x18d3aa[_0xea8a('0x34')]=='xcally-motion-dialer'){_0x18d3aa[_0xea8a('0x3e')]=_0x18d3aa[_0xea8a('0x33')];_0x18d3aa[_0xea8a('0x34')]=_0x18d3aa[_0xea8a('0x3f')];}RpcVoiceRecording[_0xea8a('0x2a')](_0x18d3aa);}}};Report[_0xea8a('0xf')]['voiceAgentReport']=function(_0xecce3e){if(_['isArray'](_0xecce3e)){_0xecce3e[_0xea8a('0x50')](function(_0x1c22e9){RpcVoiceAgentReport[_0xea8a('0x2a')](_0x1c22e9);});}else{RpcVoiceAgentReport['create'](_0xecce3e);}};Report['prototype'][_0xea8a('0x51')]=function(_0x26f373){RpcVoiceDialReport[_0xea8a('0x2a')](_0x26f373);var _0x3e491c;var _0x14c66c;var _0x2cadf1=_0x26f373[_0xea8a('0x30')];if(_['startsWith'](_0x2cadf1,_0xea8a('0x52'))){_0x14c66c=_0x2cadf1['substring'](_0x2cadf1[_0xea8a('0x53')]('/')+0x1,_0x2cadf1['indexOf']('@'));_0x3e491c=_[_0xea8a('0x1d')](this[_0xea8a('0xd')],function(_0x410301){return _0x410301[_0xea8a('0x54')]==_0x14c66c||_0x410301['phone']==_0x14c66c||_0x410301[_0xea8a('0x1e')]==_0x14c66c;});}else{_0x14c66c=_0x2cadf1[_0xea8a('0x55')](_0x2cadf1[_0xea8a('0x53')]('/')+0x1,_0x2cadf1[_0xea8a('0x56')]('-'));_0x3e491c=this[_0xea8a('0x22')](_0x14c66c);}if(_0x3e491c){_0x26f373['interface']=_[_0xea8a('0x48')](_0x3e491c[_0xea8a('0x25')])?util[_0xea8a('0x20')](_0xea8a('0x21'),_0x3e491c[_0xea8a('0x1f')]):_0x3e491c[_0xea8a('0x25')];_0x26f373[_0xea8a('0x4a')]=_0x3e491c[_0xea8a('0x1f')];_0x26f373[_0xea8a('0x1e')]=_0x3e491c[_0xea8a('0x1e')];RpcMemberReport[_0xea8a('0x51')](_0x26f373);}};Report[_0xea8a('0xf')][_0xea8a('0x1a')]=function(_0x3a4696){RpcVoiceTransferReport['transfers'][_0x3a4696[_0xea8a('0x57')]]=_0x3a4696;};Report[_0xea8a('0xf')][_0xea8a('0x1c')]=function(_0x8e6ec){RpcVoiceTransferReport[_0xea8a('0x1c')](_0x8e6ec);};module[_0xea8a('0x58')]=Report; \ No newline at end of file +var _0x0429=['custom:voiceAgentReport','voiceAgentReport','custom:voiceDialReport','blindTransfer','attendedtransfer','findAgent','find','accountcode','name','interface','format','SIP/%s','length','connectedlinenum','assigned','lastAssignedTo','isNil','queuecallercompleteAt','YYYY-MM-DD\x20HH:mm:ss','queuecallerexit','queuecallerexitAt','create','match','getAgentByInternal','keys','getCallType','channel','split','destination','exten','type','lastapplication','queue','lastdata','context','from-voip-provider','callerid','from-sip','originatecalleridnum','destinationchannel','calleridpreview','calleridnum','disposition','calleridname','transfers','linkedid','transfereelinkedid','uniqueid','UserId','monitor','monitors','filename','createdAt','connectedlinename','membername','voiceDialReport','Local','substring','indexOf','mobile','lastIndexOf','transfererlinkedid','attendedTransfer','exports','moment','util','../../../config/environment','../ami','../rpc/voiceCallReport','../rpc/voiceDialReport','../rpc/voiceQueueReport','../rpc/voiceRecording','./voiceCallReport','./voiceAgentReport','./userReport','realtime','agents','telephones','prototype','sync','xdr','disabled','custom:voiceQueueReport','voiceQueueReport','bind','custom:voiceCallReport'];(function(_0xdec230,_0x4b3c25){var _0x2fe253=function(_0xeacc88){while(--_0xeacc88){_0xdec230['push'](_0xdec230['shift']());}};_0x2fe253(++_0x4b3c25);}(_0x0429,0xec));var _0x9042=function(_0x94a6d2,_0x426b40){_0x94a6d2=_0x94a6d2-0x0;var _0xbf55c3=_0x0429[_0x94a6d2];return _0xbf55c3;};'use strict';var _=require('lodash');var moment=require(_0x9042('0x0'));var util=require(_0x9042('0x1'));var config=require(_0x9042('0x2'));var ami=require(_0x9042('0x3'));var RpcVoiceAgentReport=require('../rpc/voiceAgentReport');var RpcVoiceCallReport=require(_0x9042('0x4'));var RpcVoiceDialReport=require(_0x9042('0x5'));var RpcMemberReport=require('../rpc/memberReport');var RpcVoiceQueueReport=require(_0x9042('0x6'));var RpcVoiceRecording=require(_0x9042('0x7'));var RpcVoiceTransferReport=require('../rpc/voiceTransferReport');var VoiceQueueReport=require('./voiceQueueReport');var VoiceCallReport=require(_0x9042('0x8'));var VoiceAgentReport=require(_0x9042('0x9'));var VoiceDialReport=require('./voiceDialReport');var UserReport=require(_0x9042('0xa'));function Report(_0x130275){this[_0x9042('0xb')]=_0x130275;this[_0x9042('0xc')]=_0x130275[_0x9042('0xc')];this[_0x9042('0xd')]=_0x130275[_0x9042('0xd')];}Report[_0x9042('0xe')][_0x9042('0xf')]=function(_0x5e94e3){var _0x2376df=new VoiceQueueReport(this[_0x9042('0xb')]);var _0xcad992=new VoiceAgentReport(this[_0x9042('0xb')]);var _0x1867f9=new VoiceDialReport(this['realtime']);var _0x58ca71=new VoiceCallReport(this['realtime']);var _0x44c737=new UserReport(this[_0x9042('0xb')]);if(config[_0x9042('0x10')]&&config[_0x9042('0x10')][_0x9042('0x11')]){ami['on'](_0x9042('0x12'),this[_0x9042('0x13')][_0x9042('0x14')](this));ami['on'](_0x9042('0x15'),this['voiceCallReport'][_0x9042('0x14')](this));ami['on'](_0x9042('0x16'),this[_0x9042('0x17')][_0x9042('0x14')](this));ami['on'](_0x9042('0x18'),this['voiceDialReport'][_0x9042('0x14')](this));ami['on']('blindtransfer',this[_0x9042('0x19')]['bind'](this));ami['on'](_0x9042('0x1a'),this['attendedTransfer']['bind'](this));}};Report[_0x9042('0xe')][_0x9042('0x1b')]=function(_0x23d021){var _0x3fcec9;_0x3fcec9=_[_0x9042('0x1c')](this[_0x9042('0xc')],function(_0x519e7f){return _0x519e7f[_0x9042('0x1d')]==_0x23d021||_0x519e7f[_0x9042('0x1e')]==_0x23d021;});if(_['isNil'](_0x3fcec9)){var _0x532dd1=_[_0x9042('0x1c')](this[_0x9042('0xd')],function(_0x1371b9){return _0x1371b9['accountcode']==_0x23d021||_0x1371b9[_0x9042('0x1e')]==_0x23d021;});if(_0x532dd1){_0x3fcec9=_[_0x9042('0x1c')](this[_0x9042('0xc')],function(_0xe34b4d){return _0xe34b4d[_0x9042('0x1f')]==util[_0x9042('0x20')](_0x9042('0x21'),_0x532dd1[_0x9042('0x1e')]);});}}return _0x3fcec9;};Report[_0x9042('0xe')]['voiceQueueReport']=function(_0x37114e){for(var _0x1a6780=0x0;_0x1a6780<_0x37114e[_0x9042('0x22')];_0x1a6780+=0x1){var _0x35c3f=this[_0x9042('0x1b')](_0x37114e[_0x1a6780][_0x9042('0x23')]);if(_0x35c3f){_0x37114e[_0x1a6780]['accountcode']=_0x35c3f[_0x9042('0x1d')];_0x37114e[_0x1a6780][_0x9042('0x24')]=!![];_0x37114e[_0x1a6780][_0x9042('0x25')]=_0x35c3f[_0x9042('0x1e')];_0x37114e[_0x1a6780]['interface']=_[_0x9042('0x26')](_0x35c3f[_0x9042('0x1f')])?util['format'](_0x9042('0x21'),_0x35c3f[_0x9042('0x1e')]):_0x35c3f[_0x9042('0x1f')];if(_0x37114e[_0x1a6780]['queuecallercomplete']){_0x37114e[_0x1a6780][_0x9042('0x27')]=moment()[_0x9042('0x20')](_0x9042('0x28'));}if(_0x37114e[_0x1a6780][_0x9042('0x29')]){_0x37114e[_0x1a6780][_0x9042('0x2a')]=moment()['format'](_0x9042('0x28'));}RpcMemberReport[_0x9042('0x13')](_0x37114e[_0x1a6780]);}RpcVoiceQueueReport[_0x9042('0x2b')](_0x37114e[_0x1a6780]);}};function extractCalleridNumber(_0x5bbaaf){var _0x575428=_0x5bbaaf[_0x9042('0x2c')](/<(.*?)>/);return _0x575428?_0x575428[0x1]:_0x5bbaaf;}Report[_0x9042('0xe')][_0x9042('0x2d')]=function(_0x5dc992){for(var _0x9fd390=0x0;_0x9fd390',_0x5516ff[_0x9042('0x41')],_0x5516ff[_0x9042('0x3f')]);}if(RpcVoiceTransferReport[_0x9042('0x42')][_0x5516ff[_0x9042('0x43')]]){var _0x38a21e=RpcVoiceTransferReport[_0x9042('0x42')][_0x5516ff[_0x9042('0x43')]];_0x38a21e[_0x9042('0x44')]=_0x5516ff[_0x9042('0x45')];RpcVoiceTransferReport[_0x9042('0x19')](_0x38a21e);delete RpcVoiceTransferReport[_0x9042('0x42')][_0x5516ff[_0x9042('0x43')]];}if(_[_0x9042('0x26')](_0x5516ff['type'])){_0x5516ff['type']=this[_0x9042('0x2f')](_0x5516ff);}if(_['isNil'](_0x5516ff[_0x9042('0x46')])){var _0x2b41a5=_0x5516ff[_0x9042('0x30')][_0x9042('0x31')]('-')[0x0];var _0x2aa2da=this[_0x9042('0xc')][_0x2b41a5];if(!_0x2aa2da)_0x2aa2da=this['getAgentByInternal'](_0x5516ff[_0x9042('0x1d')]);if(_0x2aa2da){_0x5516ff['UserId']=_0x2aa2da['id'];_0x5516ff['membername']=_0x2aa2da[_0x9042('0x1e')];}}RpcVoiceCallReport['create'](_0x5516ff);if(_0x5516ff[_0x9042('0x47')]){for(var _0x6c75cf=0x0;_0x6c75cf<_0x5516ff[_0x9042('0x48')][_0x9042('0x22')];_0x6c75cf+=0x1){_0x5516ff['monitorFilename']=_0x5516ff['monitors'][_0x6c75cf][_0x9042('0x49')];_0x5516ff[_0x9042('0x4a')]=_0x5516ff[_0x9042('0x48')][_0x6c75cf][_0x9042('0x4a')];if(_0x5516ff['exten']=='xcally-motion-preview'){_0x5516ff['calleridnum']=_0x5516ff[_0x9042('0x23')];_0x5516ff[_0x9042('0x41')]=_0x5516ff['connectedlinename'];_0x5516ff[_0x9042('0x23')]=_0x5516ff[_0x9042('0x1d')];_0x5516ff[_0x9042('0x4b')]=_0x5516ff[_0x9042('0x4c')];_0x5516ff['exten']=_0x5516ff['originatecalleridnum'];}else if(_0x5516ff[_0x9042('0x33')]=='xcally-motion-dialer'){_0x5516ff[_0x9042('0x3f')]=_0x5516ff[_0x9042('0x32')];_0x5516ff[_0x9042('0x33')]=_0x5516ff[_0x9042('0x3c')];}RpcVoiceRecording[_0x9042('0x2b')](_0x5516ff);}}};Report[_0x9042('0xe')][_0x9042('0x17')]=function(_0x329fe5){if(_['isArray'](_0x329fe5)){_0x329fe5['forEach'](function(_0x56068f){RpcVoiceAgentReport[_0x9042('0x2b')](_0x56068f);});}else{RpcVoiceAgentReport['create'](_0x329fe5);}};Report['prototype'][_0x9042('0x4d')]=function(_0xaa5323){RpcVoiceDialReport['create'](_0xaa5323);var _0x351105;var _0x44c91f;var _0x313f54=_0xaa5323[_0x9042('0x30')];if(_['startsWith'](_0x313f54,_0x9042('0x4e'))){_0x44c91f=_0x313f54[_0x9042('0x4f')](_0x313f54[_0x9042('0x50')]('/')+0x1,_0x313f54[_0x9042('0x50')]('@'));_0x351105=_[_0x9042('0x1c')](this[_0x9042('0xc')],function(_0x1c2c7a){return _0x1c2c7a[_0x9042('0x51')]==_0x44c91f||_0x1c2c7a['phone']==_0x44c91f||_0x1c2c7a[_0x9042('0x1d')]==_0x44c91f;});}else{_0x44c91f=_0x313f54[_0x9042('0x4f')](_0x313f54[_0x9042('0x50')]('/')+0x1,_0x313f54[_0x9042('0x52')]('-'));_0x351105=this[_0x9042('0x1b')](_0x44c91f);}if(_0x351105){_0xaa5323[_0x9042('0x1f')]=_[_0x9042('0x26')](_0x351105[_0x9042('0x1f')])?util['format'](_0x9042('0x21'),_0x351105[_0x9042('0x1e')]):_0x351105[_0x9042('0x1f')];_0xaa5323[_0x9042('0x4c')]=_0x351105[_0x9042('0x1e')];_0xaa5323['accountcode']=_0x351105[_0x9042('0x1d')];RpcMemberReport[_0x9042('0x4d')](_0xaa5323);}};Report[_0x9042('0xe')]['blindTransfer']=function(_0x54d196){RpcVoiceTransferReport[_0x9042('0x42')][_0x54d196[_0x9042('0x53')]]=_0x54d196;};Report[_0x9042('0xe')][_0x9042('0x54')]=function(_0x1003b8){RpcVoiceTransferReport[_0x9042('0x54')](_0x1003b8);};module[_0x9042('0x55')]=Report; \ No newline at end of file diff --git a/server/services/ami/report/userReport.js b/server/services/ami/report/userReport.js index f84a789..b79d213 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 _0x1af1=['startsWith','Local','substring','indexOf','mobile','phone','updateStatusRealtime','peer','address','registered','status','[userReport][peerstatus]\x20sending\x20telephone:save\x20event:','[userReport][peerstatus]\x20sending\x20trunk:save\x20event:','trunk:save','[userReport][peerstatus]','exports','lodash','moment','bluebird','../../../config/logger','ami','../ami','redis','defaults','localhost','socket.io-emitter','trunks','agents','telephones','syncRegistry','bind','registry','devicestatechange','syncDeviceState','peerstatus','syncPeerStatus','error','[userReport][sipshowregistry]','inspect','resolve','then','actionDeviceStateList','catch','actionSipPeerStatus','prototype','syncRealtimeShow','isNotNull','isUndefined','emit','info','[userReport][registry]\x20registry:%s\x20state:%s','username','state','debug','[userReport][registry]','find','stateRegistry','merge','omit','event','[userReport][registry]\x20sending\x20trunk:save\x20event:','format','trunk:%s','name','[userReport][devicestatechange]\x20device:%s\x20state:%s','device','[userReport][devicestatechange]','local','toLowerCase','stateTime','toNumber','telephone:save','[userReport][devicestatechange]\x20sending\x20trunk:save\x20event:'];(function(_0x2788b7,_0x23d221){var _0x498473=function(_0x415d7c){while(--_0x415d7c){_0x2788b7['push'](_0x2788b7['shift']());}};_0x498473(++_0x23d221);}(_0x1af1,0x1c6));var _0x11af=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1af1[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x11af('0x0'));var moment=require(_0x11af('0x1'));var util=require('util');var Redis=require('ioredis');var BPromise=require(_0x11af('0x2'));var config=require('../../../config/environment');var logger=require(_0x11af('0x3'))(_0x11af('0x4'));var ami=require(_0x11af('0x5'));config[_0x11af('0x6')]=_[_0x11af('0x7')](config['redis'],{'host':_0x11af('0x8'),'port':0x18eb});var io=require(_0x11af('0x9'))(new Redis(config[_0x11af('0x6')]));function UserReport(_0x1a055f){this[_0x11af('0xa')]=_0x1a055f[_0x11af('0xa')];this[_0x11af('0xb')]=_0x1a055f[_0x11af('0xb')];this[_0x11af('0xc')]=_0x1a055f[_0x11af('0xc')];ami['on']('registryentry',this[_0x11af('0xd')][_0x11af('0xe')](this));ami['on'](_0x11af('0xf'),this[_0x11af('0xd')][_0x11af('0xe')](this));ami['on'](_0x11af('0x10'),this[_0x11af('0x11')]['bind'](this));ami['on'](_0x11af('0x12'),this[_0x11af('0x13')]['bind'](this));return this['syncRealtimeShow']();}function showSipRegistrations(){Promise['resolve']()['then'](ami['actionSipShowRegistry']())['catch'](function(_0x4e49cf){logger[_0x11af('0x14')](_0x11af('0x15'),util[_0x11af('0x16')](_0x4e49cf,{'showHidden':![],'depth':null}));});}function listDeviceStates(){Promise[_0x11af('0x17')]()[_0x11af('0x18')](ami[_0x11af('0x19')]())[_0x11af('0x1a')](function(_0x56dcbf){logger[_0x11af('0x14')]('[userReport][devicestatelist]',util['inspect'](_0x56dcbf,{'showHidden':![],'depth':null}));});}function showPeersStatus(){Promise[_0x11af('0x17')]()['then'](ami[_0x11af('0x1b')]())[_0x11af('0x1a')](function(_0x155461){logger[_0x11af('0x14')]('[userReport][sippeerstatus]',util[_0x11af('0x16')](_0x155461,{'showHidden':![],'depth':null}));});}UserReport[_0x11af('0x1c')][_0x11af('0x1d')]=function(){setInterval(function(){BPromise[_0x11af('0x17')]()[_0x11af('0x18')](showSipRegistrations())['then'](listDeviceStates())['then'](showPeersStatus());},0x32c8);};UserReport[_0x11af('0x1c')][_0x11af('0x1e')]=function(_0x34e4c0){return _0x34e4c0!==null&&!_[_0x11af('0x1f')](_0x34e4c0);};UserReport[_0x11af('0x1c')][_0x11af('0x20')]=function(_0x3bcf60,_0x330e68,_0x54857c){io['to'](_0x3bcf60)[_0x11af('0x20')](_0x330e68,_0x54857c);};UserReport[_0x11af('0x1c')][_0x11af('0xd')]=function(_0x1143c4){try{if(this['isNotNull'](_0x1143c4)){logger[_0x11af('0x21')](_0x11af('0x22'),_0x1143c4[_0x11af('0x23')],_0x1143c4[_0x11af('0x24')]);logger[_0x11af('0x25')](_0x11af('0x26'),util[_0x11af('0x16')](_0x1143c4,{'showHidden':![],'depth':null}));var _0x58f22b=_[_0x11af('0x27')](this[_0x11af('0xa')],{'defaultuser':_0x1143c4['username']});if(_0x58f22b){_0x1143c4[_0x11af('0x28')]=_0x1143c4[_0x11af('0x24')];_[_0x11af('0x29')](_0x58f22b,_[_0x11af('0x2a')](_0x1143c4,[_0x11af('0x2b'),'actionid',_0x11af('0x23'),_0x11af('0x24')]));logger[_0x11af('0x25')](_0x11af('0x2c'),util[_0x11af('0x16')](_0x58f22b,{'showHidden':![],'depth':null}));this[_0x11af('0x20')](util[_0x11af('0x2d')](_0x11af('0x2e'),_0x58f22b[_0x11af('0x2f')]),'trunk:save',_0x58f22b);}}}catch(_0x1d61cf){logger['error'](_0x11af('0x26'),util[_0x11af('0x16')](_0x1d61cf,{'showHidden':![],'depth':null}));}};UserReport[_0x11af('0x1c')][_0x11af('0x11')]=function(_0x4d1abd){try{if(this['isNotNull'](_0x4d1abd)){logger[_0x11af('0x21')](_0x11af('0x30'),_0x4d1abd[_0x11af('0x31')],_0x4d1abd[_0x11af('0x24')]);logger['debug'](_0x11af('0x32'),util['inspect'](_0x4d1abd,{'showHidden':![],'depth':null}));if(this[_0x11af('0xb')][_0x4d1abd[_0x11af('0x31')]]){if(!this[_0x11af('0xb')][_0x4d1abd[_0x11af('0x31')]][_0x11af('0x33')]||_0x4d1abd[_0x11af('0x24')][_0x11af('0x34')]()=='inuse'){this[_0x11af('0xb')][_0x4d1abd[_0x11af('0x31')]][_0x11af('0x33')]=![];if(this[_0x11af('0xb')][_0x4d1abd[_0x11af('0x31')]][_0x11af('0x24')]!==_0x4d1abd[_0x11af('0x24')][_0x11af('0x34')]()){this[_0x11af('0xb')][_0x4d1abd[_0x11af('0x31')]][_0x11af('0x35')]=_[_0x11af('0x36')](moment()[_0x11af('0x2d')]('x'));}this[_0x11af('0xb')][_0x4d1abd[_0x11af('0x31')]][_0x11af('0x24')]=_0x4d1abd[_0x11af('0x24')][_0x11af('0x34')]();this[_0x11af('0xb')][_0x4d1abd[_0x11af('0x31')]]['updateStatusRealtime'](_0x4d1abd);}}else if(this['telephones'][_0x4d1abd[_0x11af('0x31')]]){if(this[_0x11af('0xc')][_0x4d1abd[_0x11af('0x31')]]['state']!==_0x4d1abd[_0x11af('0x24')][_0x11af('0x34')]()){this[_0x11af('0xc')][_0x4d1abd[_0x11af('0x31')]][_0x11af('0x35')]=_['toNumber'](moment()[_0x11af('0x2d')]('x'));}this['telephones'][_0x4d1abd[_0x11af('0x31')]][_0x11af('0x24')]=_0x4d1abd[_0x11af('0x24')][_0x11af('0x34')]();logger[_0x11af('0x25')]('[userReport][devicestatechange]\x20sending\x20telephone:save\x20event:',util['inspect'](this[_0x11af('0xc')][_0x4d1abd[_0x11af('0x31')]],{'showHidden':![],'depth':null}));this['emit'](util['format']('telephone:%s',this[_0x11af('0xc')][_0x4d1abd[_0x11af('0x31')]][_0x11af('0x2f')]),_0x11af('0x37'),this[_0x11af('0xc')][_0x4d1abd[_0x11af('0x31')]]);}else if(this[_0x11af('0xa')][_0x4d1abd[_0x11af('0x31')]]){if(this[_0x11af('0xa')][_0x4d1abd[_0x11af('0x31')]][_0x11af('0x24')]!==_0x4d1abd[_0x11af('0x24')][_0x11af('0x34')]()){this[_0x11af('0xa')][_0x4d1abd[_0x11af('0x31')]][_0x11af('0x35')]=_[_0x11af('0x36')](moment()[_0x11af('0x2d')]('x'));}this[_0x11af('0xa')][_0x4d1abd[_0x11af('0x31')]][_0x11af('0x24')]=_0x4d1abd[_0x11af('0x24')][_0x11af('0x34')]();logger['debug'](_0x11af('0x38'),util[_0x11af('0x16')](this['trunks'][_0x4d1abd[_0x11af('0x31')]],{'showHidden':![],'depth':null}));this[_0x11af('0x20')](util[_0x11af('0x2d')](_0x11af('0x2e'),this[_0x11af('0xa')][_0x4d1abd['device']][_0x11af('0x2f')]),'trunk:save',this[_0x11af('0xa')][_0x4d1abd['device']]);}else if(_[_0x11af('0x39')](_0x4d1abd[_0x11af('0x31')],_0x11af('0x3a'))){var _0x345807=_0x4d1abd[_0x11af('0x31')];var _0x2d8c15=_0x345807[_0x11af('0x3b')](_0x345807[_0x11af('0x3c')]('/')+0x1,_0x345807[_0x11af('0x3c')]('@'));var _0x2bb564=_[_0x11af('0x27')](this[_0x11af('0xb')],function(_0x2d4304){return _0x2d4304[_0x11af('0x3d')]==_0x2d8c15||_0x2d4304[_0x11af('0x3e')]==_0x2d8c15||_0x2d4304['accountcode']==_0x2d8c15;});if(_0x2bb564){if(_0x2bb564['state']!==_0x4d1abd[_0x11af('0x24')][_0x11af('0x34')]()){_0x2bb564['stateTime']=_[_0x11af('0x36')](moment()[_0x11af('0x2d')]('x'));}_0x2bb564[_0x11af('0x24')]=_0x4d1abd[_0x11af('0x24')][_0x11af('0x34')]();_0x2bb564[_0x11af('0x33')]=!![];_0x2bb564[_0x11af('0x3f')](_0x4d1abd);}}}}catch(_0x15aa0d){logger[_0x11af('0x14')]('[userReport][devicestatechange]',util[_0x11af('0x16')](_0x15aa0d,{'showHidden':![],'depth':null}));}};UserReport[_0x11af('0x1c')]['syncPeerStatus']=function(_0x15f22e){try{if(this['isNotNull'](_0x15f22e)&&this[_0x11af('0x1e')](_0x15f22e[_0x11af('0x12')])){logger[_0x11af('0x21')]('[userReport][peerstatus]\x20peer:%s\x20address:%s\x20status:%s',_0x15f22e[_0x11af('0x40')],_0x15f22e[_0x11af('0x41')],_0x15f22e['peerstatus']);logger['debug']('[userReport][peerstatus]',util[_0x11af('0x16')](_0x15f22e,{'showHidden':![],'depth':null}));if(this['agents'][_0x15f22e['peer']]){if(!this[_0x11af('0xb')][_0x15f22e[_0x11af('0x40')]][_0x11af('0x33')]||_0x15f22e[_0x11af('0x12')]['toLowerCase']()==_0x11af('0x42')){this[_0x11af('0xb')][_0x15f22e[_0x11af('0x40')]][_0x11af('0x33')]=![];this['agents'][_0x15f22e[_0x11af('0x40')]][_0x11af('0x43')]=_0x15f22e['peerstatus'][_0x11af('0x34')]();this[_0x11af('0xb')][_0x15f22e[_0x11af('0x40')]][_0x11af('0x41')]=_0x15f22e[_0x11af('0x41')];this['agents'][_0x15f22e[_0x11af('0x40')]][_0x11af('0x3f')](_0x15f22e);}}else if(this[_0x11af('0xc')][_0x15f22e[_0x11af('0x40')]]){this[_0x11af('0xc')][_0x15f22e[_0x11af('0x40')]][_0x11af('0x43')]=_0x15f22e[_0x11af('0x12')]['toLowerCase']();this['telephones'][_0x15f22e['peer']][_0x11af('0x41')]=_0x15f22e[_0x11af('0x41')];logger[_0x11af('0x25')](_0x11af('0x44'),util['inspect'](this[_0x11af('0xc')][_0x15f22e[_0x11af('0x40')]],{'showHidden':![],'depth':null}));this['emit'](util[_0x11af('0x2d')]('telephone:%s',this[_0x11af('0xc')][_0x15f22e['peer']][_0x11af('0x2f')]),'telephone:save',this[_0x11af('0xc')][_0x15f22e[_0x11af('0x40')]]);}else if(this[_0x11af('0xa')][_0x15f22e[_0x11af('0x40')]]){this[_0x11af('0xa')][_0x15f22e[_0x11af('0x40')]][_0x11af('0x43')]=_0x15f22e[_0x11af('0x12')][_0x11af('0x34')]();this[_0x11af('0xa')][_0x15f22e[_0x11af('0x40')]]['address']=_0x15f22e[_0x11af('0x41')];logger[_0x11af('0x25')](_0x11af('0x45'),util[_0x11af('0x16')](this['trunks'][_0x15f22e[_0x11af('0x40')]],{'showHidden':![],'depth':null}));this['emit'](util[_0x11af('0x2d')](_0x11af('0x2e'),this[_0x11af('0xa')][_0x15f22e[_0x11af('0x40')]]['name']),_0x11af('0x46'),this[_0x11af('0xa')][_0x15f22e[_0x11af('0x40')]]);}}}catch(_0x1ab31d){logger[_0x11af('0x14')](_0x11af('0x47'),util[_0x11af('0x16')](_0x1ab31d,{'showHidden':![],'depth':null}));}};module[_0x11af('0x48')]=UserReport; \ No newline at end of file +var _0x1a1b=['defaults','redis','localhost','socket.io-emitter','trunks','agents','telephones','registryentry','bind','syncRegistry','devicestatechange','syncDeviceState','syncRealtimeShow','resolve','actionSipShowRegistry','catch','error','[userReport][sipshowregistry]','inspect','then','actionDeviceStateList','[userReport][devicestatelist]','actionSipPeerStatus','prototype','isNotNull','isUndefined','emit','[userReport][registry]\x20registry:%s\x20state:%s','username','debug','[userReport][registry]','find','stateRegistry','merge','omit','event','state','[userReport][registry]\x20sending\x20trunk:save\x20event:','format','trunk:%s','name','trunk:save','info','[userReport][devicestatechange]\x20device:%s\x20state:%s','device','local','inuse','toLowerCase','stateTime','toNumber','updateStatusRealtime','[userReport][devicestatechange]\x20sending\x20telephone:save\x20event:','telephone:%s','[userReport][devicestatechange]\x20sending\x20trunk:save\x20event:','Local','indexOf','mobile','phone','accountcode','syncPeerStatus','peerstatus','peer','address','[userReport][peerstatus]','status','[userReport][peerstatus]\x20sending\x20telephone:save\x20event:','telephone:save','[userReport][peerstatus]\x20sending\x20trunk:save\x20event:','exports','lodash','ioredis','bluebird','../../../config/environment','../../../config/logger','ami','../ami'];(function(_0x1c4c24,_0x154c79){var _0x1c033d=function(_0x155415){while(--_0x155415){_0x1c4c24['push'](_0x1c4c24['shift']());}};_0x1c033d(++_0x154c79);}(_0x1a1b,0x1c1));var _0xb1a1=function(_0x401936,_0x4acf75){_0x401936=_0x401936-0x0;var _0x350b85=_0x1a1b[_0x401936];return _0x350b85;};'use strict';var _=require(_0xb1a1('0x0'));var moment=require('moment');var util=require('util');var Redis=require(_0xb1a1('0x1'));var BPromise=require(_0xb1a1('0x2'));var config=require(_0xb1a1('0x3'));var logger=require(_0xb1a1('0x4'))(_0xb1a1('0x5'));var ami=require(_0xb1a1('0x6'));config['redis']=_[_0xb1a1('0x7')](config[_0xb1a1('0x8')],{'host':_0xb1a1('0x9'),'port':0x18eb});var io=require(_0xb1a1('0xa'))(new Redis(config[_0xb1a1('0x8')]));function UserReport(_0x3e37eb){this[_0xb1a1('0xb')]=_0x3e37eb[_0xb1a1('0xb')];this['agents']=_0x3e37eb[_0xb1a1('0xc')];this[_0xb1a1('0xd')]=_0x3e37eb[_0xb1a1('0xd')];ami['on'](_0xb1a1('0xe'),this['syncRegistry'][_0xb1a1('0xf')](this));ami['on']('registry',this[_0xb1a1('0x10')]['bind'](this));ami['on'](_0xb1a1('0x11'),this[_0xb1a1('0x12')][_0xb1a1('0xf')](this));ami['on']('peerstatus',this['syncPeerStatus'][_0xb1a1('0xf')](this));return this[_0xb1a1('0x13')]();}function showSipRegistrations(){Promise[_0xb1a1('0x14')]()['then'](ami[_0xb1a1('0x15')]())[_0xb1a1('0x16')](function(_0x29be97){logger[_0xb1a1('0x17')](_0xb1a1('0x18'),util[_0xb1a1('0x19')](_0x29be97,{'showHidden':![],'depth':null}));});}function listDeviceStates(){Promise['resolve']()[_0xb1a1('0x1a')](ami[_0xb1a1('0x1b')]())[_0xb1a1('0x16')](function(_0x23ac29){logger[_0xb1a1('0x17')](_0xb1a1('0x1c'),util[_0xb1a1('0x19')](_0x23ac29,{'showHidden':![],'depth':null}));});}function showPeersStatus(){Promise[_0xb1a1('0x14')]()[_0xb1a1('0x1a')](ami[_0xb1a1('0x1d')]())['catch'](function(_0x55c968){logger[_0xb1a1('0x17')]('[userReport][sippeerstatus]',util[_0xb1a1('0x19')](_0x55c968,{'showHidden':![],'depth':null}));});}UserReport[_0xb1a1('0x1e')][_0xb1a1('0x13')]=function(){setInterval(function(){BPromise['resolve']()[_0xb1a1('0x1a')](showSipRegistrations())[_0xb1a1('0x1a')](listDeviceStates())[_0xb1a1('0x1a')](showPeersStatus());},0x32c8);};UserReport[_0xb1a1('0x1e')][_0xb1a1('0x1f')]=function(_0x224b6d){return _0x224b6d!==null&&!_[_0xb1a1('0x20')](_0x224b6d);};UserReport[_0xb1a1('0x1e')][_0xb1a1('0x21')]=function(_0x2fbbaa,_0x396ce4,_0x1020fe){io['to'](_0x2fbbaa)['emit'](_0x396ce4,_0x1020fe);};UserReport[_0xb1a1('0x1e')][_0xb1a1('0x10')]=function(_0x562ff1){try{if(this[_0xb1a1('0x1f')](_0x562ff1)){logger['info'](_0xb1a1('0x22'),_0x562ff1[_0xb1a1('0x23')],_0x562ff1['state']);logger[_0xb1a1('0x24')](_0xb1a1('0x25'),util[_0xb1a1('0x19')](_0x562ff1,{'showHidden':![],'depth':null}));var _0x578169=_[_0xb1a1('0x26')](this[_0xb1a1('0xb')],{'defaultuser':_0x562ff1[_0xb1a1('0x23')]});if(_0x578169){_0x562ff1[_0xb1a1('0x27')]=_0x562ff1['state'];_[_0xb1a1('0x28')](_0x578169,_[_0xb1a1('0x29')](_0x562ff1,[_0xb1a1('0x2a'),'actionid',_0xb1a1('0x23'),_0xb1a1('0x2b')]));logger[_0xb1a1('0x24')](_0xb1a1('0x2c'),util[_0xb1a1('0x19')](_0x578169,{'showHidden':![],'depth':null}));this[_0xb1a1('0x21')](util[_0xb1a1('0x2d')](_0xb1a1('0x2e'),_0x578169[_0xb1a1('0x2f')]),_0xb1a1('0x30'),_0x578169);}}}catch(_0x1070a8){logger[_0xb1a1('0x17')](_0xb1a1('0x25'),util[_0xb1a1('0x19')](_0x1070a8,{'showHidden':![],'depth':null}));}};UserReport[_0xb1a1('0x1e')][_0xb1a1('0x12')]=function(_0x26046e){try{if(this[_0xb1a1('0x1f')](_0x26046e)){logger[_0xb1a1('0x31')](_0xb1a1('0x32'),_0x26046e[_0xb1a1('0x33')],_0x26046e[_0xb1a1('0x2b')]);logger[_0xb1a1('0x24')]('[userReport][devicestatechange]',util['inspect'](_0x26046e,{'showHidden':![],'depth':null}));if(this['agents'][_0x26046e[_0xb1a1('0x33')]]){if(!this[_0xb1a1('0xc')][_0x26046e[_0xb1a1('0x33')]][_0xb1a1('0x34')]||_0x26046e[_0xb1a1('0x2b')]['toLowerCase']()==_0xb1a1('0x35')){this[_0xb1a1('0xc')][_0x26046e[_0xb1a1('0x33')]]['local']=![];if(this[_0xb1a1('0xc')][_0x26046e[_0xb1a1('0x33')]][_0xb1a1('0x2b')]!==_0x26046e['state'][_0xb1a1('0x36')]()){this[_0xb1a1('0xc')][_0x26046e['device']][_0xb1a1('0x37')]=_[_0xb1a1('0x38')](moment()[_0xb1a1('0x2d')]('x'));}this[_0xb1a1('0xc')][_0x26046e[_0xb1a1('0x33')]]['state']=_0x26046e[_0xb1a1('0x2b')][_0xb1a1('0x36')]();this[_0xb1a1('0xc')][_0x26046e[_0xb1a1('0x33')]][_0xb1a1('0x39')](_0x26046e);}}else if(this[_0xb1a1('0xd')][_0x26046e[_0xb1a1('0x33')]]){if(this[_0xb1a1('0xd')][_0x26046e['device']]['state']!==_0x26046e[_0xb1a1('0x2b')][_0xb1a1('0x36')]()){this['telephones'][_0x26046e[_0xb1a1('0x33')]][_0xb1a1('0x37')]=_[_0xb1a1('0x38')](moment()['format']('x'));}this[_0xb1a1('0xd')][_0x26046e[_0xb1a1('0x33')]][_0xb1a1('0x2b')]=_0x26046e[_0xb1a1('0x2b')]['toLowerCase']();logger[_0xb1a1('0x24')](_0xb1a1('0x3a'),util['inspect'](this[_0xb1a1('0xd')][_0x26046e[_0xb1a1('0x33')]],{'showHidden':![],'depth':null}));this['emit'](util[_0xb1a1('0x2d')](_0xb1a1('0x3b'),this[_0xb1a1('0xd')][_0x26046e['device']]['name']),'telephone:save',this[_0xb1a1('0xd')][_0x26046e['device']]);}else if(this['trunks'][_0x26046e[_0xb1a1('0x33')]]){if(this['trunks'][_0x26046e[_0xb1a1('0x33')]][_0xb1a1('0x2b')]!==_0x26046e[_0xb1a1('0x2b')][_0xb1a1('0x36')]()){this[_0xb1a1('0xb')][_0x26046e[_0xb1a1('0x33')]][_0xb1a1('0x37')]=_[_0xb1a1('0x38')](moment()['format']('x'));}this[_0xb1a1('0xb')][_0x26046e[_0xb1a1('0x33')]]['state']=_0x26046e[_0xb1a1('0x2b')]['toLowerCase']();logger['debug'](_0xb1a1('0x3c'),util[_0xb1a1('0x19')](this[_0xb1a1('0xb')][_0x26046e['device']],{'showHidden':![],'depth':null}));this['emit'](util[_0xb1a1('0x2d')](_0xb1a1('0x2e'),this[_0xb1a1('0xb')][_0x26046e[_0xb1a1('0x33')]][_0xb1a1('0x2f')]),'trunk:save',this[_0xb1a1('0xb')][_0x26046e['device']]);}else if(_['startsWith'](_0x26046e['device'],_0xb1a1('0x3d'))){var _0x554e51=_0x26046e[_0xb1a1('0x33')];var _0x3fae03=_0x554e51['substring'](_0x554e51[_0xb1a1('0x3e')]('/')+0x1,_0x554e51['indexOf']('@'));var _0x1836cf=_[_0xb1a1('0x26')](this['agents'],function(_0x118fbb){return _0x118fbb[_0xb1a1('0x3f')]==_0x3fae03||_0x118fbb[_0xb1a1('0x40')]==_0x3fae03||_0x118fbb[_0xb1a1('0x41')]==_0x3fae03;});if(_0x1836cf){if(_0x1836cf[_0xb1a1('0x2b')]!==_0x26046e[_0xb1a1('0x2b')][_0xb1a1('0x36')]()){_0x1836cf['stateTime']=_[_0xb1a1('0x38')](moment()[_0xb1a1('0x2d')]('x'));}_0x1836cf[_0xb1a1('0x2b')]=_0x26046e['state'][_0xb1a1('0x36')]();_0x1836cf['local']=!![];_0x1836cf[_0xb1a1('0x39')](_0x26046e);}}}}catch(_0x12ad34){logger[_0xb1a1('0x17')]('[userReport][devicestatechange]',util['inspect'](_0x12ad34,{'showHidden':![],'depth':null}));}};UserReport[_0xb1a1('0x1e')][_0xb1a1('0x42')]=function(_0x3ba354){try{if(this['isNotNull'](_0x3ba354)&&this[_0xb1a1('0x1f')](_0x3ba354[_0xb1a1('0x43')])){logger[_0xb1a1('0x31')]('[userReport][peerstatus]\x20peer:%s\x20address:%s\x20status:%s',_0x3ba354[_0xb1a1('0x44')],_0x3ba354[_0xb1a1('0x45')],_0x3ba354[_0xb1a1('0x43')]);logger[_0xb1a1('0x24')](_0xb1a1('0x46'),util['inspect'](_0x3ba354,{'showHidden':![],'depth':null}));if(this['agents'][_0x3ba354[_0xb1a1('0x44')]]){if(!this[_0xb1a1('0xc')][_0x3ba354['peer']]['local']||_0x3ba354[_0xb1a1('0x43')][_0xb1a1('0x36')]()=='registered'){this['agents'][_0x3ba354[_0xb1a1('0x44')]]['local']=![];this[_0xb1a1('0xc')][_0x3ba354[_0xb1a1('0x44')]][_0xb1a1('0x47')]=_0x3ba354['peerstatus'][_0xb1a1('0x36')]();this[_0xb1a1('0xc')][_0x3ba354[_0xb1a1('0x44')]][_0xb1a1('0x45')]=_0x3ba354[_0xb1a1('0x45')];this[_0xb1a1('0xc')][_0x3ba354['peer']][_0xb1a1('0x39')](_0x3ba354);}}else if(this['telephones'][_0x3ba354[_0xb1a1('0x44')]]){this['telephones'][_0x3ba354['peer']][_0xb1a1('0x47')]=_0x3ba354[_0xb1a1('0x43')][_0xb1a1('0x36')]();this[_0xb1a1('0xd')][_0x3ba354['peer']][_0xb1a1('0x45')]=_0x3ba354[_0xb1a1('0x45')];logger[_0xb1a1('0x24')](_0xb1a1('0x48'),util['inspect'](this[_0xb1a1('0xd')][_0x3ba354[_0xb1a1('0x44')]],{'showHidden':![],'depth':null}));this[_0xb1a1('0x21')](util['format'](_0xb1a1('0x3b'),this[_0xb1a1('0xd')][_0x3ba354[_0xb1a1('0x44')]][_0xb1a1('0x2f')]),_0xb1a1('0x49'),this[_0xb1a1('0xd')][_0x3ba354[_0xb1a1('0x44')]]);}else if(this[_0xb1a1('0xb')][_0x3ba354[_0xb1a1('0x44')]]){this[_0xb1a1('0xb')][_0x3ba354[_0xb1a1('0x44')]]['status']=_0x3ba354[_0xb1a1('0x43')][_0xb1a1('0x36')]();this['trunks'][_0x3ba354[_0xb1a1('0x44')]][_0xb1a1('0x45')]=_0x3ba354[_0xb1a1('0x45')];logger[_0xb1a1('0x24')](_0xb1a1('0x4a'),util['inspect'](this[_0xb1a1('0xb')][_0x3ba354[_0xb1a1('0x44')]],{'showHidden':![],'depth':null}));this[_0xb1a1('0x21')](util[_0xb1a1('0x2d')](_0xb1a1('0x2e'),this['trunks'][_0x3ba354[_0xb1a1('0x44')]][_0xb1a1('0x2f')]),_0xb1a1('0x30'),this[_0xb1a1('0xb')][_0x3ba354[_0xb1a1('0x44')]]);}}}catch(_0x24dc37){logger[_0xb1a1('0x17')](_0xb1a1('0x46'),util[_0xb1a1('0x19')](_0x24dc37,{'showHidden':![],'depth':null}));}};module[_0xb1a1('0x4b')]=UserReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceAgentReport.js b/server/services/ami/report/voiceAgentReport.js index 0df8adb..7953462 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=['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','voice','omit','event','privilege','[%s][voiceAgentReport][agentcalled]\x20sending\x20agentcalled\x20event:','custom:agentcalled','interface','calleridnum','extravar','format','user:%s','error','[%s][voiceAgentReport][agentcalled]','syncAgentConnect','[%s][voiceAgentReport][agentconnect]\x20event:','[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','connectedlinename','connectedlinenum','destchannelstate','destchannelstatedesc','holdtime','connect','voiceChannels','routealias','merge','pick','destconnectedlinenum','[%s][voiceAgentReport][agentconnect]\x20sending\x20agentconnect\x20event:','custom:agentconnect','user:agentconnect','agentringnoanswer','agentringnoanswerAt','answered_elsewhere','reason','[%s][voiceAgentReport][agentconnect]\x20sending\x20agentansweredelsewhere\x20event:','custom:agentansweredelsewhere','syncAgentRingNoAnswer','[%s][voiceAgentReport][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:rejected','lastevent','rejected','custom:agentringnoanswer','[%s][voiceAgentReport][agentringnoanswer]','[%s][voiceAgentReport][queuecallerabandon]\x20event:','hasOwnProperty','[%s][voiceAgentReport][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','abandoned','[%s][voiceAgentReport][queuecallerabandon]\x20sending\x20agentqueuecallerabandon\x20event:','custom:agentqueuecallerabandon','[%s][voiceAgentReport][queuecallerabandon]','[%s][voiceAgentReport][agentcomplete]\x20event:','agentcompleteAt','complete','agent','talktime','acw','acwtime','acwTimeout','custom:agentcomplete','[%s][voiceAgentReport][agentcomplete]\x20sending\x20user:agentcomplete\x20event:','destaccountcode','user:agentcomplete','[%s][voiceAgentReport][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','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','sipcallid','bridgepeer','bridgepvtcallid','membercalls','memberdynamic','memberinterface','memberpenalty','memberrealtime','isNil','includes','[%s][voiceAgentReport][hangup]\x20event:','transfer','[%s][voiceAgentReport][hangup]\x20sending\x20voiceAgentReport\x20event:','values','custom:voiceAgentReport','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:','[%s][voiceAgentReport][blindtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','[%s][voiceAgentReport][blindtransfer]','[%s][voiceAgentReport][musiconholdstart]\x20event:','channel','substring','[%s][voiceAgentReport][musiconholdstart]\x20interface:%s','onhold','[%s][voiceAgentReport][musiconholdstart]','syncMusicOnHoldStop','lastIndexOf','[%s][voiceAgentReport][musiconholdstop]\x20interface:%s','exports','lodash','moment','util','../../../config/logger','../ami','redis','defaults','localhost','channels','voiceQueues','agents','variables','agentcalled','syncAgentCalled','bind','agentconnect','queuecallerabandon','syncQueueCallerAbandon','agentcomplete','syncAgentComplete','varset','syncVarSet','hangup','syncHangup','syncMusicOnHoldStart'];(function(_0x271ebd,_0x1c24ac){var _0x313e1d=function(_0x2ae8ac){while(--_0x2ae8ac){_0x271ebd['push'](_0x271ebd['shift']());}};_0x313e1d(++_0x1c24ac);}(_0xa9e0,0x123));var _0x0a9e=function(_0x30ae5e,_0x391fc4){_0x30ae5e=_0x30ae5e-0x0;var _0x1f2e93=_0xa9e0[_0x30ae5e];return _0x1f2e93;};'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')]],'motionChannel':_0x0a9e('0x2c')};}_['merge'](this[_0x0a9e('0x8')][_0x155cce[_0x0a9e('0x26')]][_0x155cce[_0x0a9e('0x22')]],_[_0x0a9e('0x2d')](_0x155cce,[_0x0a9e('0x2e'),_0x0a9e('0x2f')]));logger[_0x0a9e('0x23')](_0x0a9e('0x30'),_0x155cce[_0x0a9e('0x26')],util['inspect'](this[_0x0a9e('0x8')][_0x155cce['uniqueid']][_0x155cce[_0x0a9e('0x22')]],{'showHidden':![],'depth':null}));ami[_0x0a9e('0x1d')](_0x0a9e('0x31'),this[_0x0a9e('0x8')][_0x155cce[_0x0a9e('0x26')]][_0x155cce['destuniqueid']]);var _0x66c1d2={'id':this[_0x0a9e('0xa')][_0x155cce[_0x0a9e('0x32')]]['id'],'calleridnum':this[_0x0a9e('0x8')][_0x155cce[_0x0a9e('0x26')]][_0x155cce[_0x0a9e('0x22')]][_0x0a9e('0x33')],'queue':this[_0x0a9e('0x8')][_0x155cce['uniqueid']][_0x155cce[_0x0a9e('0x22')]]['queue'],'extravar':this[_0x0a9e('0x8')][_0x155cce[_0x0a9e('0x26')]][_0x155cce[_0x0a9e('0x22')]][_0x0a9e('0xb')]?this['channels'][_0x155cce[_0x0a9e('0x26')]][_0x155cce[_0x0a9e('0x22')]][_0x0a9e('0xb')][_0x0a9e('0x34')]:undefined};logger['debug']('[%s][voiceAgentReport][agentcalled]\x20sending\x20user:called\x20event:',_0x155cce[_0x0a9e('0x26')],util['inspect'](_0x66c1d2,{'showHidden':![],'depth':null}));this[_0x0a9e('0x1d')](util[_0x0a9e('0x35')](_0x0a9e('0x36'),_0x155cce[_0x0a9e('0x21')]),'user:called',_0x66c1d2);}}catch(_0x31916f){logger[_0x0a9e('0x37')](_0x0a9e('0x38'),_0x155cce['uniqueid'],util[_0x0a9e('0x25')](_0x31916f,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0a9e('0x1c')][_0x0a9e('0x39')]=function(_0x4c1c0e){try{if(this['isNotNull'](_0x4c1c0e)){if(this[_0x0a9e('0x8')][_0x4c1c0e[_0x0a9e('0x26')]]){logger['debug'](_0x0a9e('0x3a'),_0x4c1c0e[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x4c1c0e,{'showHidden':![],'depth':null}));for(var _0x148f55 in this['channels'][_0x4c1c0e['uniqueid']]){if(this[_0x0a9e('0x8')][_0x4c1c0e[_0x0a9e('0x26')]]['hasOwnProperty'](_0x148f55)){if(_0x4c1c0e[_0x0a9e('0x22')]===_0x148f55){logger[_0x0a9e('0x20')](_0x0a9e('0x3b'),_0x4c1c0e['uniqueid'],_0x4c1c0e[_0x0a9e('0x21')],_0x4c1c0e[_0x0a9e('0x22')]);this[_0x0a9e('0x8')][_0x4c1c0e[_0x0a9e('0x26')]][_0x148f55][_0x0a9e('0x3c')]=moment()[_0x0a9e('0x35')](_0x0a9e('0x27'));this[_0x0a9e('0x8')][_0x4c1c0e[_0x0a9e('0x26')]][_0x148f55][_0x0a9e('0x3d')]=_0x4c1c0e[_0x0a9e('0x3d')];this[_0x0a9e('0x8')][_0x4c1c0e[_0x0a9e('0x26')]][_0x148f55][_0x0a9e('0x3e')]=_0x4c1c0e[_0x0a9e('0x3e')];this['channels'][_0x4c1c0e['uniqueid']][_0x148f55][_0x0a9e('0x3f')]=_0x4c1c0e[_0x0a9e('0x3f')];this[_0x0a9e('0x8')][_0x4c1c0e[_0x0a9e('0x26')]][_0x148f55][_0x0a9e('0x40')]=_0x4c1c0e[_0x0a9e('0x40')];this[_0x0a9e('0x8')][_0x4c1c0e[_0x0a9e('0x26')]][_0x148f55][_0x0a9e('0x41')]=_0x4c1c0e[_0x0a9e('0x41')];this[_0x0a9e('0x8')][_0x4c1c0e[_0x0a9e('0x26')]][_0x148f55]['lastevent']=_0x0a9e('0x42');if(this[_0x0a9e('0x43')][this[_0x0a9e('0x8')][_0x4c1c0e[_0x0a9e('0x26')]][_0x148f55][_0x0a9e('0x26')]]){var _0xbe9d19=this[_0x0a9e('0x43')][this[_0x0a9e('0x8')][_0x4c1c0e['uniqueid']][_0x148f55][_0x0a9e('0x26')]]['routealias'];this[_0x0a9e('0x8')][_0x4c1c0e[_0x0a9e('0x26')]][_0x148f55][_0x0a9e('0x44')]=_0xbe9d19;_0x4c1c0e['routealias']=_0xbe9d19;}_[_0x0a9e('0x45')](this[_0x0a9e('0xa')][_0x4c1c0e[_0x0a9e('0x32')]],_[_0x0a9e('0x46')](_0x4c1c0e,[_0x0a9e('0x28'),_0x0a9e('0x47'),_0x0a9e('0x44')]));logger['debug'](_0x0a9e('0x48'),_0x4c1c0e[_0x0a9e('0x26')],util[_0x0a9e('0x25')](this[_0x0a9e('0x8')][_0x4c1c0e[_0x0a9e('0x26')]][_0x4c1c0e[_0x0a9e('0x22')]],{'showHidden':![],'depth':null}));ami[_0x0a9e('0x1d')](_0x0a9e('0x49'),this[_0x0a9e('0x8')][_0x4c1c0e['uniqueid']][_0x4c1c0e[_0x0a9e('0x22')]]);logger[_0x0a9e('0x23')]('[%s][voiceAgentReport][agentcalled]\x20sending\x20user:agentconnect\x20event:',_0x4c1c0e['uniqueid'],util['inspect'](this[_0x0a9e('0x8')][_0x4c1c0e[_0x0a9e('0x26')]][_0x4c1c0e[_0x0a9e('0x22')]],{'showHidden':![],'depth':null}));this[_0x0a9e('0x1d')](util[_0x0a9e('0x35')](_0x0a9e('0x36'),_0x4c1c0e[_0x0a9e('0x21')]),_0x0a9e('0x4a'),this['channels'][_0x4c1c0e['uniqueid']][_0x4c1c0e['destuniqueid']]);}else if(!this[_0x0a9e('0x8')][_0x4c1c0e[_0x0a9e('0x26')]][_0x148f55][_0x0a9e('0x4b')]&&!this['channels'][_0x4c1c0e[_0x0a9e('0x26')]][_0x148f55][_0x0a9e('0x12')]){logger['info']('[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:answered_elsewhere',_0x4c1c0e[_0x0a9e('0x26')],this['channels'][_0x4c1c0e[_0x0a9e('0x26')]][_0x148f55]['membername'],_0x148f55);this[_0x0a9e('0x8')][_0x4c1c0e[_0x0a9e('0x26')]][_0x148f55][_0x0a9e('0x4b')]=!![];this['channels'][_0x4c1c0e[_0x0a9e('0x26')]][_0x148f55][_0x0a9e('0x4c')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this[_0x0a9e('0x8')][_0x4c1c0e[_0x0a9e('0x26')]][_0x148f55]['answeredelsewheredestinationuniqueid']=_0x4c1c0e[_0x0a9e('0x22')];this['channels'][_0x4c1c0e[_0x0a9e('0x26')]][_0x148f55]['answeredelsewheremembername']=_0x4c1c0e[_0x0a9e('0x21')];this['channels'][_0x4c1c0e['uniqueid']][_0x148f55]['lastevent']=_0x0a9e('0x4d');this['channels'][_0x4c1c0e[_0x0a9e('0x26')]][_0x148f55][_0x0a9e('0x4e')]=_0x0a9e('0x4d');logger[_0x0a9e('0x23')](_0x0a9e('0x4f'),_0x4c1c0e[_0x0a9e('0x26')],util[_0x0a9e('0x25')](this[_0x0a9e('0x8')][_0x4c1c0e['uniqueid']][_0x148f55],{'showHidden':![],'depth':null}));ami[_0x0a9e('0x1d')](_0x0a9e('0x50'),this[_0x0a9e('0x8')][_0x4c1c0e[_0x0a9e('0x26')]][_0x148f55]);}}}}}}catch(_0xb83dfd){logger[_0x0a9e('0x37')]('[%s][voiceAgentReport][agentconnect]',_0x4c1c0e[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0xb83dfd,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x0a9e('0x51')]=function(_0x5cc8fb){try{if(this[_0x0a9e('0x1e')](_0x5cc8fb)){logger['debug']('[%s][voiceAgentReport][agentringnoanswer]\x20event:',_0x5cc8fb['uniqueid'],util[_0x0a9e('0x25')](_0x5cc8fb,{'showHidden':![],'depth':null}));if(this['channels'][_0x5cc8fb[_0x0a9e('0x26')]]&&this[_0x0a9e('0x8')][_0x5cc8fb[_0x0a9e('0x26')]][_0x5cc8fb[_0x0a9e('0x22')]]){logger[_0x0a9e('0x20')](_0x0a9e('0x52'),_0x5cc8fb['uniqueid'],_0x5cc8fb[_0x0a9e('0x21')],_0x5cc8fb['destuniqueid']);this[_0x0a9e('0x8')][_0x5cc8fb[_0x0a9e('0x26')]][_0x5cc8fb[_0x0a9e('0x22')]]['agentringnoanswer']=!![];this[_0x0a9e('0x8')][_0x5cc8fb[_0x0a9e('0x26')]][_0x5cc8fb[_0x0a9e('0x22')]][_0x0a9e('0x4c')]=moment()['format'](_0x0a9e('0x27'));this[_0x0a9e('0x8')][_0x5cc8fb['uniqueid']][_0x5cc8fb[_0x0a9e('0x22')]][_0x0a9e('0x53')]=_0x0a9e('0x54');this[_0x0a9e('0x8')][_0x5cc8fb[_0x0a9e('0x26')]][_0x5cc8fb['destuniqueid']][_0x0a9e('0x4e')]=_0x0a9e('0x54');logger[_0x0a9e('0x23')]('[%s][voiceAgentReport][agentringnoanswer]\x20sending\x20agentringnoanswer\x20event:',_0x5cc8fb[_0x0a9e('0x26')],util['inspect'](this['channels'][_0x5cc8fb[_0x0a9e('0x26')]][_0x5cc8fb[_0x0a9e('0x22')]],{'showHidden':![],'depth':null}));ami[_0x0a9e('0x1d')](_0x0a9e('0x55'),this[_0x0a9e('0x8')][_0x5cc8fb[_0x0a9e('0x26')]][_0x5cc8fb[_0x0a9e('0x22')]]);}}}catch(_0x54a37d){logger[_0x0a9e('0x37')](_0x0a9e('0x56'),_0x5cc8fb[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x54a37d,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0a9e('0x1c')][_0x0a9e('0x11')]=function(_0x320898){try{if(this[_0x0a9e('0x1e')](_0x320898)){logger[_0x0a9e('0x23')](_0x0a9e('0x57'),_0x320898['uniqueid'],util[_0x0a9e('0x25')](_0x320898,{'showHidden':![],'depth':null}));if(this[_0x0a9e('0x8')][_0x320898[_0x0a9e('0x26')]]){for(var _0x4edbb0 in this[_0x0a9e('0x8')][_0x320898[_0x0a9e('0x26')]]){if(this['channels'][_0x320898[_0x0a9e('0x26')]][_0x0a9e('0x58')](_0x4edbb0)&&!this[_0x0a9e('0x8')][_0x320898[_0x0a9e('0x26')]][_0x4edbb0][_0x0a9e('0x4b')]&&!this['channels'][_0x320898['uniqueid']][_0x4edbb0]['agentcomplete']){logger[_0x0a9e('0x20')](_0x0a9e('0x59'),_0x320898[_0x0a9e('0x26')],this[_0x0a9e('0x8')][_0x320898[_0x0a9e('0x26')]][_0x4edbb0][_0x0a9e('0x21')],_0x4edbb0);this[_0x0a9e('0x8')][_0x320898[_0x0a9e('0x26')]][_0x4edbb0]['agentringnoanswer']=!![];this[_0x0a9e('0x8')][_0x320898[_0x0a9e('0x26')]][_0x4edbb0][_0x0a9e('0x4c')]=moment()['format'](_0x0a9e('0x27'));this['channels'][_0x320898[_0x0a9e('0x26')]][_0x4edbb0][_0x0a9e('0x53')]='abandoned';this[_0x0a9e('0x8')][_0x320898[_0x0a9e('0x26')]][_0x4edbb0][_0x0a9e('0x4e')]=_0x0a9e('0x5a');logger['debug'](_0x0a9e('0x5b'),_0x320898[_0x0a9e('0x26')],util[_0x0a9e('0x25')](this[_0x0a9e('0x8')][_0x320898['uniqueid']][_0x4edbb0],{'showHidden':![],'depth':null}));ami[_0x0a9e('0x1d')](_0x0a9e('0x5c'),this[_0x0a9e('0x8')][_0x320898[_0x0a9e('0x26')]][_0x4edbb0]);}}}}}catch(_0x4abc8f){logger[_0x0a9e('0x37')](_0x0a9e('0x5d'),_0x320898[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x4abc8f,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0a9e('0x1c')][_0x0a9e('0x13')]=function(_0x40fc56){try{if(this[_0x0a9e('0x1e')](_0x40fc56)){logger[_0x0a9e('0x23')](_0x0a9e('0x5e'),_0x40fc56[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x40fc56,{'showHidden':![],'depth':null}));if(this[_0x0a9e('0x8')][_0x40fc56[_0x0a9e('0x26')]]){for(var _0x5b35db in this[_0x0a9e('0x8')][_0x40fc56[_0x0a9e('0x26')]]){if(this[_0x0a9e('0x8')][_0x40fc56['uniqueid']][_0x0a9e('0x58')](_0x5b35db)){if(this[_0x0a9e('0x8')][_0x40fc56[_0x0a9e('0x26')]][_0x5b35db][_0x0a9e('0x3c')]&&!this['channels'][_0x40fc56['uniqueid']][_0x5b35db][_0x0a9e('0x12')]){logger[_0x0a9e('0x20')]('[%s][voiceAgentReport][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete',_0x40fc56[_0x0a9e('0x26')],this['channels'][_0x40fc56[_0x0a9e('0x26')]][_0x5b35db][_0x0a9e('0x21')],_0x5b35db);this['channels'][_0x40fc56[_0x0a9e('0x26')]][_0x5b35db][_0x0a9e('0x12')]=!![];this[_0x0a9e('0x8')][_0x40fc56[_0x0a9e('0x26')]][_0x5b35db][_0x0a9e('0x5f')]=moment()[_0x0a9e('0x35')](_0x0a9e('0x27'));this['channels'][_0x40fc56[_0x0a9e('0x26')]][_0x5b35db][_0x0a9e('0x53')]=_0x0a9e('0x60');this[_0x0a9e('0x8')][_0x40fc56['uniqueid']][_0x5b35db][_0x0a9e('0x4e')]=_0x40fc56[_0x0a9e('0x4e')]=='transfer'?_0x0a9e('0x61'):_0x40fc56['reason'];this[_0x0a9e('0x8')][_0x40fc56[_0x0a9e('0x26')]][_0x5b35db][_0x0a9e('0x62')]=_0x40fc56[_0x0a9e('0x62')];if(this['voiceQueues'][_0x40fc56['queue']]&&this[_0x0a9e('0x9')][_0x40fc56[_0x0a9e('0x28')]][_0x0a9e('0x63')]){this['channels'][_0x40fc56[_0x0a9e('0x26')]][_0x5b35db][_0x0a9e('0x64')]=this['voiceQueues'][_0x40fc56['queue']][_0x0a9e('0x65')];this['channels'][_0x40fc56['uniqueid']][_0x5b35db]['agentacw']=!![];}this[_0x0a9e('0xa')][_0x40fc56[_0x0a9e('0x32')]]=_[_0x0a9e('0x2d')](this[_0x0a9e('0xa')][_0x40fc56[_0x0a9e('0x32')]],[_0x0a9e('0x28'),'destconnectedlinenum']);logger[_0x0a9e('0x23')]('[%s][voiceAgentReport][agentcomplete]\x20sending\x20agentcomplete\x20event:',_0x40fc56[_0x0a9e('0x26')],util[_0x0a9e('0x25')](this[_0x0a9e('0x8')][_0x40fc56[_0x0a9e('0x26')]][_0x5b35db],{'showHidden':![],'depth':null}));ami['emit'](_0x0a9e('0x66'),this[_0x0a9e('0x8')][_0x40fc56[_0x0a9e('0x26')]][_0x5b35db]);logger['debug'](_0x0a9e('0x67'),_0x40fc56[_0x0a9e('0x26')],util[_0x0a9e('0x25')]({'id':this[_0x0a9e('0xa')][_0x40fc56[_0x0a9e('0x32')]]['id'],'destaccountcode':_0x40fc56[_0x0a9e('0x68')]},{'showHidden':![],'depth':null}));this[_0x0a9e('0x1d')](util[_0x0a9e('0x35')]('user:%s',_0x40fc56[_0x0a9e('0x21')]),_0x0a9e('0x69'),{'id':this['agents'][_0x40fc56[_0x0a9e('0x32')]]['id'],'destaccountcode':_0x40fc56[_0x0a9e('0x68')]});}}}}}}catch(_0x3a1974){logger['error'](_0x0a9e('0x6a'),_0x40fc56['uniqueid'],util[_0x0a9e('0x25')](_0x3a1974,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0a9e('0x1c')][_0x0a9e('0x15')]=function(_0x1f29bd){try{if(this[_0x0a9e('0x1e')](_0x1f29bd)){logger[_0x0a9e('0x23')](_0x0a9e('0x6b'),_0x1f29bd[_0x0a9e('0x26')],util['inspect'](_0x1f29bd,{'showHidden':![],'depth':null}));this[_0x0a9e('0x6c')](_0x1f29bd[_0x0a9e('0x26')],_[_0x0a9e('0x6d')](_0x1f29bd[_0x0a9e('0x6e')])[0x0],_0x1f29bd[_0x0a9e('0x6f')]);if(this[_0x0a9e('0x8')][_0x1f29bd[_0x0a9e('0x26')]]){for(var _0x33f0c9 in this[_0x0a9e('0x8')][_0x1f29bd[_0x0a9e('0x26')]]){if(this[_0x0a9e('0x8')][_0x1f29bd[_0x0a9e('0x26')]][_0x0a9e('0x58')](_0x33f0c9)){logger['info'](_0x0a9e('0x70'),_0x1f29bd[_0x0a9e('0x26')],_0x33f0c9,_[_0x0a9e('0x6d')](_0x1f29bd[_0x0a9e('0x6e')])[0x0],_0x1f29bd[_0x0a9e('0x6f')]);if(_['isUndefined'](this[_0x0a9e('0x8')][_0x1f29bd[_0x0a9e('0x26')]][_0x33f0c9]['variables'])){this[_0x0a9e('0x8')][_0x1f29bd['uniqueid']][_0x33f0c9][_0x0a9e('0xb')]={};}this[_0x0a9e('0x8')][_0x1f29bd[_0x0a9e('0x26')]][_0x33f0c9][_0x0a9e('0xb')]=this['variables'][_0x1f29bd[_0x0a9e('0x26')]];}}}}}catch(_0x4cf72d){logger[_0x0a9e('0x37')](_0x0a9e('0x71'),_0x1f29bd['uniqueid'],util[_0x0a9e('0x25')](_0x4cf72d,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0a9e('0x1c')][_0x0a9e('0x6c')]=function(_0x4ab276,_0x4c788f,_0x1b82b7){var _0x6ba2be=[_0x0a9e('0x72'),_0x0a9e('0x73'),_0x0a9e('0x74'),_0x0a9e('0x75'),_0x0a9e('0x76'),_0x0a9e('0x77'),_0x0a9e('0x78'),'rtpaudioqosrttbridged',_0x0a9e('0x79'),'sipuri',_0x0a9e('0x7a'),_0x0a9e('0x7b'),_0x0a9e('0x7c'),_0x0a9e('0x7d'),_0x0a9e('0x7e'),'memberlastcall',_0x0a9e('0x21'),_0x0a9e('0x7f'),_0x0a9e('0x80')];if(!_[_0x0a9e('0x81')](_0x4c788f)&&!_[_0x0a9e('0x82')](_0x6ba2be,_0x4c788f)){if(_['isUndefined'](this['variables'][_0x4ab276])){this[_0x0a9e('0xb')][_0x4ab276]={};}this['variables'][_0x4ab276][_0x4c788f]=_0x1b82b7;}};VoiceAgentReport[_0x0a9e('0x1c')][_0x0a9e('0x17')]=function(_0x4672e1){try{if(this[_0x0a9e('0x1e')](_0x4672e1)){logger[_0x0a9e('0x23')](_0x0a9e('0x83'),_0x4672e1['uniqueid'],util['inspect'](_0x4672e1,{'showHidden':![],'depth':null}));if(this[_0x0a9e('0x8')][_0x4672e1['uniqueid']]){for(var _0x2469d1 in this['channels'][_0x4672e1[_0x0a9e('0x26')]]){if(this['channels'][_0x4672e1['uniqueid']][_0x0a9e('0x58')](_0x2469d1)){if(this[_0x0a9e('0x8')][_0x4672e1['uniqueid']][_0x2469d1][_0x0a9e('0x4e')]==_0x0a9e('0x84')&&this[_0x0a9e('0x8')][_0x4672e1[_0x0a9e('0x26')]][_0x2469d1][_0x0a9e('0x12')]){logger['info']('[%s][voiceAgentReport][hangup]\x20destuniqueid:%s',_0x4672e1[_0x0a9e('0x26')],_0x2469d1);this[_0x0a9e('0x8')][_0x4672e1[_0x0a9e('0x26')]][_0x2469d1][_0x0a9e('0x5f')]=moment()[_0x0a9e('0x35')]('YYYY-MM-DD\x20HH:mm:ss');}}}logger[_0x0a9e('0x23')](_0x0a9e('0x85'),_0x4672e1['uniqueid'],util[_0x0a9e('0x25')](_[_0x0a9e('0x86')](this[_0x0a9e('0x8')][_0x4672e1[_0x0a9e('0x26')]]),{'showHidden':![],'depth':null}));ami[_0x0a9e('0x1d')](_0x0a9e('0x87'),_[_0x0a9e('0x86')](this[_0x0a9e('0x8')][_0x4672e1[_0x0a9e('0x26')]]));delete this[_0x0a9e('0x8')][_0x4672e1['uniqueid']];}if(this[_0x0a9e('0xb')][_0x4672e1[_0x0a9e('0x26')]]){delete this[_0x0a9e('0xb')][_0x4672e1[_0x0a9e('0x26')]];}}}catch(_0x1d0b02){logger['error']('[%s][voiceAgentReport][hangup]',_0x4672e1[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x1d0b02,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0a9e('0x1c')][_0x0a9e('0x88')]=function(_0x34f7b5){try{if(this['isNotNull'](_0x34f7b5)){logger[_0x0a9e('0x23')](_0x0a9e('0x89'),_0x34f7b5[_0x0a9e('0x26')],util['inspect'](_0x34f7b5,{'showHidden':![],'depth':null}));if(this[_0x0a9e('0x8')][_0x34f7b5['transfereeuniqueid']]){for(var _0x2144ca in this['channels'][_0x34f7b5[_0x0a9e('0x8a')]]){if(this[_0x0a9e('0x8')][_0x34f7b5[_0x0a9e('0x8a')]]['hasOwnProperty'](_0x2144ca)){if(_0x34f7b5[_0x0a9e('0x8b')]===_0x2144ca){logger['info'](_0x0a9e('0x8c'),_0x34f7b5[_0x0a9e('0x26')],this[_0x0a9e('0x8')][_0x34f7b5[_0x0a9e('0x8a')]][_0x2144ca][_0x0a9e('0x21')],_0x2144ca);var _0x1bee04=moment();this[_0x0a9e('0x8')][_0x34f7b5[_0x0a9e('0x8a')]][_0x2144ca][_0x0a9e('0x12')]=!![];this[_0x0a9e('0x8')][_0x34f7b5[_0x0a9e('0x8a')]][_0x2144ca][_0x0a9e('0x5f')]=moment()[_0x0a9e('0x35')](_0x0a9e('0x27'));this[_0x0a9e('0x8')][_0x34f7b5[_0x0a9e('0x8a')]][_0x2144ca]['lastevent']='complete';this[_0x0a9e('0x8')][_0x34f7b5['transfereeuniqueid']][_0x2144ca][_0x0a9e('0x4e')]=_0x0a9e('0x84');this['channels'][_0x34f7b5[_0x0a9e('0x8a')]][_0x2144ca][_0x0a9e('0x62')]=_0x1bee04[_0x0a9e('0x8d')](this[_0x0a9e('0x8')][_0x34f7b5['transfereeuniqueid']][_0x2144ca][_0x0a9e('0x3c')],_0x0a9e('0x8e'));}}}}if(this[_0x0a9e('0x8')][_0x34f7b5[_0x0a9e('0x8f')]]){var _0x5d0e1f=this[_0x0a9e('0x8')][_0x34f7b5[_0x0a9e('0x8f')]];this[_0x0a9e('0x8')][_0x34f7b5['secondtransfereruniqueid']]=this[_0x0a9e('0x8')][_0x34f7b5[_0x0a9e('0x8a')]];this[_0x0a9e('0x8')][_0x34f7b5['transfereeuniqueid']]=_0x5d0e1f;}}}catch(_0x303f75){logger[_0x0a9e('0x37')](_0x0a9e('0x90'),_0x34f7b5[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x303f75,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x0a9e('0x1b')]=function(_0x289e65){try{if(this['isNotNull'](_0x289e65)){logger[_0x0a9e('0x23')](_0x0a9e('0x91'),_0x289e65[_0x0a9e('0x26')],util['inspect'](_0x289e65,{'showHidden':![],'depth':null}));if(this['channels'][_0x289e65['transfereeuniqueid']]){for(var _0x1015aa in this[_0x0a9e('0x8')][_0x289e65['transfereeuniqueid']]){if(this[_0x0a9e('0x8')][_0x289e65[_0x0a9e('0x8a')]][_0x0a9e('0x58')](_0x1015aa)){if(_0x289e65['transfereruniqueid']===_0x1015aa){logger[_0x0a9e('0x20')](_0x0a9e('0x92'),_0x289e65[_0x0a9e('0x26')],this[_0x0a9e('0x8')][_0x289e65[_0x0a9e('0x8a')]][_0x1015aa][_0x0a9e('0x21')],_0x1015aa);var _0x40e6e7=moment();this[_0x0a9e('0x8')][_0x289e65[_0x0a9e('0x8a')]][_0x1015aa]['agentcomplete']=!![];this[_0x0a9e('0x8')][_0x289e65['transfereeuniqueid']][_0x1015aa][_0x0a9e('0x5f')]=_0x40e6e7;this[_0x0a9e('0x8')][_0x289e65[_0x0a9e('0x8a')]][_0x1015aa][_0x0a9e('0x53')]=_0x0a9e('0x60');this[_0x0a9e('0x8')][_0x289e65['transfereeuniqueid']][_0x1015aa][_0x0a9e('0x4e')]=_0x0a9e('0x84');this[_0x0a9e('0x8')][_0x289e65[_0x0a9e('0x8a')]][_0x1015aa]['talktime']=_0x40e6e7[_0x0a9e('0x8d')](this[_0x0a9e('0x8')][_0x289e65[_0x0a9e('0x8a')]][_0x1015aa][_0x0a9e('0x3c')],_0x0a9e('0x8e'));}}}}}}catch(_0x2be526){logger[_0x0a9e('0x37')](_0x0a9e('0x93'),_0x289e65[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x2be526,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x0a9e('0x18')]=function(_0x88b25f){var _0x2ff265='';try{if(this[_0x0a9e('0x1e')](_0x88b25f)){logger[_0x0a9e('0x23')](_0x0a9e('0x94'),_0x88b25f[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x88b25f,{'showHidden':![],'depth':null}));if(_0x88b25f['channel']){_0x2ff265=_0x88b25f[_0x0a9e('0x95')][_0x0a9e('0x96')](0x0,_0x88b25f[_0x0a9e('0x95')]['lastIndexOf']('-'));if(this[_0x0a9e('0xa')][_0x2ff265]){logger[_0x0a9e('0x20')](_0x0a9e('0x97'),_0x88b25f[_0x0a9e('0x26')],_0x2ff265);this[_0x0a9e('0xa')][_0x2ff265][_0x0a9e('0x98')]=!![];}}}}catch(_0x424f1b){logger[_0x0a9e('0x37')](_0x0a9e('0x99'),_0x88b25f[_0x0a9e('0x26')],util['inspect'](_0x424f1b,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0a9e('0x1c')][_0x0a9e('0x9a')]=function(_0x15a9ed){var _0x3db98f='';try{if(this[_0x0a9e('0x1e')](_0x15a9ed)){logger[_0x0a9e('0x23')]('[%s][voiceAgentReport][musiconholdstop]\x20event:',_0x15a9ed[_0x0a9e('0x26')],util['inspect'](_0x15a9ed,{'showHidden':![],'depth':null}));if(_0x15a9ed['channel']){_0x3db98f=_0x15a9ed['channel'][_0x0a9e('0x96')](0x0,_0x15a9ed[_0x0a9e('0x95')][_0x0a9e('0x9b')]('-'));if(this[_0x0a9e('0xa')][_0x3db98f]){logger['info'](_0x0a9e('0x9c'),_0x15a9ed[_0x0a9e('0x26')],_0x3db98f);this[_0x0a9e('0xa')][_0x3db98f][_0x0a9e('0x98')]=![];}}}}catch(_0x2c8d1d){logger['error']('[%s][voiceAgentReport][musiconholdstop]',_0x15a9ed[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x2c8d1d,{'showHidden':![],'depth':null}));}};module[_0x0a9e('0x9d')]=VoiceAgentReport; \ No newline at end of file +var _0xa9e0=['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','voice','omit','event','privilege','[%s][voiceAgentReport][agentcalled]\x20sending\x20agentcalled\x20event:','custom:agentcalled','interface','calleridnum','extravar','format','user:%s','error','[%s][voiceAgentReport][agentcalled]','syncAgentConnect','[%s][voiceAgentReport][agentconnect]\x20event:','[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','connectedlinename','connectedlinenum','destchannelstate','destchannelstatedesc','holdtime','connect','voiceChannels','routealias','merge','pick','destconnectedlinenum','[%s][voiceAgentReport][agentconnect]\x20sending\x20agentconnect\x20event:','custom:agentconnect','user:agentconnect','agentringnoanswer','agentringnoanswerAt','answered_elsewhere','reason','[%s][voiceAgentReport][agentconnect]\x20sending\x20agentansweredelsewhere\x20event:','custom:agentansweredelsewhere','syncAgentRingNoAnswer','[%s][voiceAgentReport][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:rejected','lastevent','rejected','custom:agentringnoanswer','[%s][voiceAgentReport][agentringnoanswer]','[%s][voiceAgentReport][queuecallerabandon]\x20event:','hasOwnProperty','[%s][voiceAgentReport][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','abandoned','[%s][voiceAgentReport][queuecallerabandon]\x20sending\x20agentqueuecallerabandon\x20event:','custom:agentqueuecallerabandon','[%s][voiceAgentReport][queuecallerabandon]','[%s][voiceAgentReport][agentcomplete]\x20event:','agentcompleteAt','complete','agent','talktime','acw','acwtime','acwTimeout','custom:agentcomplete','[%s][voiceAgentReport][agentcomplete]\x20sending\x20user:agentcomplete\x20event:','destaccountcode','user:agentcomplete','[%s][voiceAgentReport][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','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','sipcallid','bridgepeer','bridgepvtcallid','membercalls','memberdynamic','memberinterface','memberpenalty','memberrealtime','isNil','includes','[%s][voiceAgentReport][hangup]\x20event:','transfer','[%s][voiceAgentReport][hangup]\x20sending\x20voiceAgentReport\x20event:','values','custom:voiceAgentReport','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:','[%s][voiceAgentReport][blindtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','[%s][voiceAgentReport][blindtransfer]','[%s][voiceAgentReport][musiconholdstart]\x20event:','channel','substring','[%s][voiceAgentReport][musiconholdstart]\x20interface:%s','onhold','[%s][voiceAgentReport][musiconholdstart]','syncMusicOnHoldStop','lastIndexOf','[%s][voiceAgentReport][musiconholdstop]\x20interface:%s','exports','lodash','moment','util','../../../config/logger','../ami','redis','defaults','localhost','channels','voiceQueues','agents','variables','agentcalled','syncAgentCalled','bind','agentconnect','queuecallerabandon','syncQueueCallerAbandon','agentcomplete','syncAgentComplete','varset','syncVarSet','hangup','syncHangup','syncMusicOnHoldStart'];(function(_0x29b90d,_0x1f5a49){var _0x38ef15=function(_0x46c617){while(--_0x46c617){_0x29b90d['push'](_0x29b90d['shift']());}};_0x38ef15(++_0x1f5a49);}(_0xa9e0,0x123));var _0x0a9e=function(_0x491a7f,_0x28bb80){_0x491a7f=_0x491a7f-0x0;var _0x3d8f44=_0xa9e0[_0x491a7f];return _0x3d8f44;};'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')]],'motionChannel':_0x0a9e('0x2c')};}_['merge'](this[_0x0a9e('0x8')][_0x155cce[_0x0a9e('0x26')]][_0x155cce[_0x0a9e('0x22')]],_[_0x0a9e('0x2d')](_0x155cce,[_0x0a9e('0x2e'),_0x0a9e('0x2f')]));logger[_0x0a9e('0x23')](_0x0a9e('0x30'),_0x155cce[_0x0a9e('0x26')],util['inspect'](this[_0x0a9e('0x8')][_0x155cce['uniqueid']][_0x155cce[_0x0a9e('0x22')]],{'showHidden':![],'depth':null}));ami[_0x0a9e('0x1d')](_0x0a9e('0x31'),this[_0x0a9e('0x8')][_0x155cce[_0x0a9e('0x26')]][_0x155cce['destuniqueid']]);var _0x66c1d2={'id':this[_0x0a9e('0xa')][_0x155cce[_0x0a9e('0x32')]]['id'],'calleridnum':this[_0x0a9e('0x8')][_0x155cce[_0x0a9e('0x26')]][_0x155cce[_0x0a9e('0x22')]][_0x0a9e('0x33')],'queue':this[_0x0a9e('0x8')][_0x155cce['uniqueid']][_0x155cce[_0x0a9e('0x22')]]['queue'],'extravar':this[_0x0a9e('0x8')][_0x155cce[_0x0a9e('0x26')]][_0x155cce[_0x0a9e('0x22')]][_0x0a9e('0xb')]?this['channels'][_0x155cce[_0x0a9e('0x26')]][_0x155cce[_0x0a9e('0x22')]][_0x0a9e('0xb')][_0x0a9e('0x34')]:undefined};logger['debug']('[%s][voiceAgentReport][agentcalled]\x20sending\x20user:called\x20event:',_0x155cce[_0x0a9e('0x26')],util['inspect'](_0x66c1d2,{'showHidden':![],'depth':null}));this[_0x0a9e('0x1d')](util[_0x0a9e('0x35')](_0x0a9e('0x36'),_0x155cce[_0x0a9e('0x21')]),'user:called',_0x66c1d2);}}catch(_0x31916f){logger[_0x0a9e('0x37')](_0x0a9e('0x38'),_0x155cce['uniqueid'],util[_0x0a9e('0x25')](_0x31916f,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0a9e('0x1c')][_0x0a9e('0x39')]=function(_0x4c1c0e){try{if(this['isNotNull'](_0x4c1c0e)){if(this[_0x0a9e('0x8')][_0x4c1c0e[_0x0a9e('0x26')]]){logger['debug'](_0x0a9e('0x3a'),_0x4c1c0e[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x4c1c0e,{'showHidden':![],'depth':null}));for(var _0x148f55 in this['channels'][_0x4c1c0e['uniqueid']]){if(this[_0x0a9e('0x8')][_0x4c1c0e[_0x0a9e('0x26')]]['hasOwnProperty'](_0x148f55)){if(_0x4c1c0e[_0x0a9e('0x22')]===_0x148f55){logger[_0x0a9e('0x20')](_0x0a9e('0x3b'),_0x4c1c0e['uniqueid'],_0x4c1c0e[_0x0a9e('0x21')],_0x4c1c0e[_0x0a9e('0x22')]);this[_0x0a9e('0x8')][_0x4c1c0e[_0x0a9e('0x26')]][_0x148f55][_0x0a9e('0x3c')]=moment()[_0x0a9e('0x35')](_0x0a9e('0x27'));this[_0x0a9e('0x8')][_0x4c1c0e[_0x0a9e('0x26')]][_0x148f55][_0x0a9e('0x3d')]=_0x4c1c0e[_0x0a9e('0x3d')];this[_0x0a9e('0x8')][_0x4c1c0e[_0x0a9e('0x26')]][_0x148f55][_0x0a9e('0x3e')]=_0x4c1c0e[_0x0a9e('0x3e')];this['channels'][_0x4c1c0e['uniqueid']][_0x148f55][_0x0a9e('0x3f')]=_0x4c1c0e[_0x0a9e('0x3f')];this[_0x0a9e('0x8')][_0x4c1c0e[_0x0a9e('0x26')]][_0x148f55][_0x0a9e('0x40')]=_0x4c1c0e[_0x0a9e('0x40')];this[_0x0a9e('0x8')][_0x4c1c0e[_0x0a9e('0x26')]][_0x148f55][_0x0a9e('0x41')]=_0x4c1c0e[_0x0a9e('0x41')];this[_0x0a9e('0x8')][_0x4c1c0e[_0x0a9e('0x26')]][_0x148f55]['lastevent']=_0x0a9e('0x42');if(this[_0x0a9e('0x43')][this[_0x0a9e('0x8')][_0x4c1c0e[_0x0a9e('0x26')]][_0x148f55][_0x0a9e('0x26')]]){var _0xbe9d19=this[_0x0a9e('0x43')][this[_0x0a9e('0x8')][_0x4c1c0e['uniqueid']][_0x148f55][_0x0a9e('0x26')]]['routealias'];this[_0x0a9e('0x8')][_0x4c1c0e[_0x0a9e('0x26')]][_0x148f55][_0x0a9e('0x44')]=_0xbe9d19;_0x4c1c0e['routealias']=_0xbe9d19;}_[_0x0a9e('0x45')](this[_0x0a9e('0xa')][_0x4c1c0e[_0x0a9e('0x32')]],_[_0x0a9e('0x46')](_0x4c1c0e,[_0x0a9e('0x28'),_0x0a9e('0x47'),_0x0a9e('0x44')]));logger['debug'](_0x0a9e('0x48'),_0x4c1c0e[_0x0a9e('0x26')],util[_0x0a9e('0x25')](this[_0x0a9e('0x8')][_0x4c1c0e[_0x0a9e('0x26')]][_0x4c1c0e[_0x0a9e('0x22')]],{'showHidden':![],'depth':null}));ami[_0x0a9e('0x1d')](_0x0a9e('0x49'),this[_0x0a9e('0x8')][_0x4c1c0e['uniqueid']][_0x4c1c0e[_0x0a9e('0x22')]]);logger[_0x0a9e('0x23')]('[%s][voiceAgentReport][agentcalled]\x20sending\x20user:agentconnect\x20event:',_0x4c1c0e['uniqueid'],util['inspect'](this[_0x0a9e('0x8')][_0x4c1c0e[_0x0a9e('0x26')]][_0x4c1c0e[_0x0a9e('0x22')]],{'showHidden':![],'depth':null}));this[_0x0a9e('0x1d')](util[_0x0a9e('0x35')](_0x0a9e('0x36'),_0x4c1c0e[_0x0a9e('0x21')]),_0x0a9e('0x4a'),this['channels'][_0x4c1c0e['uniqueid']][_0x4c1c0e['destuniqueid']]);}else if(!this[_0x0a9e('0x8')][_0x4c1c0e[_0x0a9e('0x26')]][_0x148f55][_0x0a9e('0x4b')]&&!this['channels'][_0x4c1c0e[_0x0a9e('0x26')]][_0x148f55][_0x0a9e('0x12')]){logger['info']('[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:answered_elsewhere',_0x4c1c0e[_0x0a9e('0x26')],this['channels'][_0x4c1c0e[_0x0a9e('0x26')]][_0x148f55]['membername'],_0x148f55);this[_0x0a9e('0x8')][_0x4c1c0e[_0x0a9e('0x26')]][_0x148f55][_0x0a9e('0x4b')]=!![];this['channels'][_0x4c1c0e[_0x0a9e('0x26')]][_0x148f55][_0x0a9e('0x4c')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this[_0x0a9e('0x8')][_0x4c1c0e[_0x0a9e('0x26')]][_0x148f55]['answeredelsewheredestinationuniqueid']=_0x4c1c0e[_0x0a9e('0x22')];this['channels'][_0x4c1c0e[_0x0a9e('0x26')]][_0x148f55]['answeredelsewheremembername']=_0x4c1c0e[_0x0a9e('0x21')];this['channels'][_0x4c1c0e['uniqueid']][_0x148f55]['lastevent']=_0x0a9e('0x4d');this['channels'][_0x4c1c0e[_0x0a9e('0x26')]][_0x148f55][_0x0a9e('0x4e')]=_0x0a9e('0x4d');logger[_0x0a9e('0x23')](_0x0a9e('0x4f'),_0x4c1c0e[_0x0a9e('0x26')],util[_0x0a9e('0x25')](this[_0x0a9e('0x8')][_0x4c1c0e['uniqueid']][_0x148f55],{'showHidden':![],'depth':null}));ami[_0x0a9e('0x1d')](_0x0a9e('0x50'),this[_0x0a9e('0x8')][_0x4c1c0e[_0x0a9e('0x26')]][_0x148f55]);}}}}}}catch(_0xb83dfd){logger[_0x0a9e('0x37')]('[%s][voiceAgentReport][agentconnect]',_0x4c1c0e[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0xb83dfd,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x0a9e('0x51')]=function(_0x5cc8fb){try{if(this[_0x0a9e('0x1e')](_0x5cc8fb)){logger['debug']('[%s][voiceAgentReport][agentringnoanswer]\x20event:',_0x5cc8fb['uniqueid'],util[_0x0a9e('0x25')](_0x5cc8fb,{'showHidden':![],'depth':null}));if(this['channels'][_0x5cc8fb[_0x0a9e('0x26')]]&&this[_0x0a9e('0x8')][_0x5cc8fb[_0x0a9e('0x26')]][_0x5cc8fb[_0x0a9e('0x22')]]){logger[_0x0a9e('0x20')](_0x0a9e('0x52'),_0x5cc8fb['uniqueid'],_0x5cc8fb[_0x0a9e('0x21')],_0x5cc8fb['destuniqueid']);this[_0x0a9e('0x8')][_0x5cc8fb[_0x0a9e('0x26')]][_0x5cc8fb[_0x0a9e('0x22')]]['agentringnoanswer']=!![];this[_0x0a9e('0x8')][_0x5cc8fb[_0x0a9e('0x26')]][_0x5cc8fb[_0x0a9e('0x22')]][_0x0a9e('0x4c')]=moment()['format'](_0x0a9e('0x27'));this[_0x0a9e('0x8')][_0x5cc8fb['uniqueid']][_0x5cc8fb[_0x0a9e('0x22')]][_0x0a9e('0x53')]=_0x0a9e('0x54');this[_0x0a9e('0x8')][_0x5cc8fb[_0x0a9e('0x26')]][_0x5cc8fb['destuniqueid']][_0x0a9e('0x4e')]=_0x0a9e('0x54');logger[_0x0a9e('0x23')]('[%s][voiceAgentReport][agentringnoanswer]\x20sending\x20agentringnoanswer\x20event:',_0x5cc8fb[_0x0a9e('0x26')],util['inspect'](this['channels'][_0x5cc8fb[_0x0a9e('0x26')]][_0x5cc8fb[_0x0a9e('0x22')]],{'showHidden':![],'depth':null}));ami[_0x0a9e('0x1d')](_0x0a9e('0x55'),this[_0x0a9e('0x8')][_0x5cc8fb[_0x0a9e('0x26')]][_0x5cc8fb[_0x0a9e('0x22')]]);}}}catch(_0x54a37d){logger[_0x0a9e('0x37')](_0x0a9e('0x56'),_0x5cc8fb[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x54a37d,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0a9e('0x1c')][_0x0a9e('0x11')]=function(_0x320898){try{if(this[_0x0a9e('0x1e')](_0x320898)){logger[_0x0a9e('0x23')](_0x0a9e('0x57'),_0x320898['uniqueid'],util[_0x0a9e('0x25')](_0x320898,{'showHidden':![],'depth':null}));if(this[_0x0a9e('0x8')][_0x320898[_0x0a9e('0x26')]]){for(var _0x4edbb0 in this[_0x0a9e('0x8')][_0x320898[_0x0a9e('0x26')]]){if(this['channels'][_0x320898[_0x0a9e('0x26')]][_0x0a9e('0x58')](_0x4edbb0)&&!this[_0x0a9e('0x8')][_0x320898[_0x0a9e('0x26')]][_0x4edbb0][_0x0a9e('0x4b')]&&!this['channels'][_0x320898['uniqueid']][_0x4edbb0]['agentcomplete']){logger[_0x0a9e('0x20')](_0x0a9e('0x59'),_0x320898[_0x0a9e('0x26')],this[_0x0a9e('0x8')][_0x320898[_0x0a9e('0x26')]][_0x4edbb0][_0x0a9e('0x21')],_0x4edbb0);this[_0x0a9e('0x8')][_0x320898[_0x0a9e('0x26')]][_0x4edbb0]['agentringnoanswer']=!![];this[_0x0a9e('0x8')][_0x320898[_0x0a9e('0x26')]][_0x4edbb0][_0x0a9e('0x4c')]=moment()['format'](_0x0a9e('0x27'));this['channels'][_0x320898[_0x0a9e('0x26')]][_0x4edbb0][_0x0a9e('0x53')]='abandoned';this[_0x0a9e('0x8')][_0x320898[_0x0a9e('0x26')]][_0x4edbb0][_0x0a9e('0x4e')]=_0x0a9e('0x5a');logger['debug'](_0x0a9e('0x5b'),_0x320898[_0x0a9e('0x26')],util[_0x0a9e('0x25')](this[_0x0a9e('0x8')][_0x320898['uniqueid']][_0x4edbb0],{'showHidden':![],'depth':null}));ami[_0x0a9e('0x1d')](_0x0a9e('0x5c'),this[_0x0a9e('0x8')][_0x320898[_0x0a9e('0x26')]][_0x4edbb0]);}}}}}catch(_0x4abc8f){logger[_0x0a9e('0x37')](_0x0a9e('0x5d'),_0x320898[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x4abc8f,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0a9e('0x1c')][_0x0a9e('0x13')]=function(_0x40fc56){try{if(this[_0x0a9e('0x1e')](_0x40fc56)){logger[_0x0a9e('0x23')](_0x0a9e('0x5e'),_0x40fc56[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x40fc56,{'showHidden':![],'depth':null}));if(this[_0x0a9e('0x8')][_0x40fc56[_0x0a9e('0x26')]]){for(var _0x5b35db in this[_0x0a9e('0x8')][_0x40fc56[_0x0a9e('0x26')]]){if(this[_0x0a9e('0x8')][_0x40fc56['uniqueid']][_0x0a9e('0x58')](_0x5b35db)){if(this[_0x0a9e('0x8')][_0x40fc56[_0x0a9e('0x26')]][_0x5b35db][_0x0a9e('0x3c')]&&!this['channels'][_0x40fc56['uniqueid']][_0x5b35db][_0x0a9e('0x12')]){logger[_0x0a9e('0x20')]('[%s][voiceAgentReport][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete',_0x40fc56[_0x0a9e('0x26')],this['channels'][_0x40fc56[_0x0a9e('0x26')]][_0x5b35db][_0x0a9e('0x21')],_0x5b35db);this['channels'][_0x40fc56[_0x0a9e('0x26')]][_0x5b35db][_0x0a9e('0x12')]=!![];this[_0x0a9e('0x8')][_0x40fc56[_0x0a9e('0x26')]][_0x5b35db][_0x0a9e('0x5f')]=moment()[_0x0a9e('0x35')](_0x0a9e('0x27'));this['channels'][_0x40fc56[_0x0a9e('0x26')]][_0x5b35db][_0x0a9e('0x53')]=_0x0a9e('0x60');this[_0x0a9e('0x8')][_0x40fc56['uniqueid']][_0x5b35db][_0x0a9e('0x4e')]=_0x40fc56[_0x0a9e('0x4e')]=='transfer'?_0x0a9e('0x61'):_0x40fc56['reason'];this[_0x0a9e('0x8')][_0x40fc56[_0x0a9e('0x26')]][_0x5b35db][_0x0a9e('0x62')]=_0x40fc56[_0x0a9e('0x62')];if(this['voiceQueues'][_0x40fc56['queue']]&&this[_0x0a9e('0x9')][_0x40fc56[_0x0a9e('0x28')]][_0x0a9e('0x63')]){this['channels'][_0x40fc56[_0x0a9e('0x26')]][_0x5b35db][_0x0a9e('0x64')]=this['voiceQueues'][_0x40fc56['queue']][_0x0a9e('0x65')];this['channels'][_0x40fc56['uniqueid']][_0x5b35db]['agentacw']=!![];}this[_0x0a9e('0xa')][_0x40fc56[_0x0a9e('0x32')]]=_[_0x0a9e('0x2d')](this[_0x0a9e('0xa')][_0x40fc56[_0x0a9e('0x32')]],[_0x0a9e('0x28'),'destconnectedlinenum']);logger[_0x0a9e('0x23')]('[%s][voiceAgentReport][agentcomplete]\x20sending\x20agentcomplete\x20event:',_0x40fc56[_0x0a9e('0x26')],util[_0x0a9e('0x25')](this[_0x0a9e('0x8')][_0x40fc56[_0x0a9e('0x26')]][_0x5b35db],{'showHidden':![],'depth':null}));ami['emit'](_0x0a9e('0x66'),this[_0x0a9e('0x8')][_0x40fc56[_0x0a9e('0x26')]][_0x5b35db]);logger['debug'](_0x0a9e('0x67'),_0x40fc56[_0x0a9e('0x26')],util[_0x0a9e('0x25')]({'id':this[_0x0a9e('0xa')][_0x40fc56[_0x0a9e('0x32')]]['id'],'destaccountcode':_0x40fc56[_0x0a9e('0x68')]},{'showHidden':![],'depth':null}));this[_0x0a9e('0x1d')](util[_0x0a9e('0x35')]('user:%s',_0x40fc56[_0x0a9e('0x21')]),_0x0a9e('0x69'),{'id':this['agents'][_0x40fc56[_0x0a9e('0x32')]]['id'],'destaccountcode':_0x40fc56[_0x0a9e('0x68')]});}}}}}}catch(_0x3a1974){logger['error'](_0x0a9e('0x6a'),_0x40fc56['uniqueid'],util[_0x0a9e('0x25')](_0x3a1974,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0a9e('0x1c')][_0x0a9e('0x15')]=function(_0x1f29bd){try{if(this[_0x0a9e('0x1e')](_0x1f29bd)){logger[_0x0a9e('0x23')](_0x0a9e('0x6b'),_0x1f29bd[_0x0a9e('0x26')],util['inspect'](_0x1f29bd,{'showHidden':![],'depth':null}));this[_0x0a9e('0x6c')](_0x1f29bd[_0x0a9e('0x26')],_[_0x0a9e('0x6d')](_0x1f29bd[_0x0a9e('0x6e')])[0x0],_0x1f29bd[_0x0a9e('0x6f')]);if(this[_0x0a9e('0x8')][_0x1f29bd[_0x0a9e('0x26')]]){for(var _0x33f0c9 in this[_0x0a9e('0x8')][_0x1f29bd[_0x0a9e('0x26')]]){if(this[_0x0a9e('0x8')][_0x1f29bd[_0x0a9e('0x26')]][_0x0a9e('0x58')](_0x33f0c9)){logger['info'](_0x0a9e('0x70'),_0x1f29bd[_0x0a9e('0x26')],_0x33f0c9,_[_0x0a9e('0x6d')](_0x1f29bd[_0x0a9e('0x6e')])[0x0],_0x1f29bd[_0x0a9e('0x6f')]);if(_['isUndefined'](this[_0x0a9e('0x8')][_0x1f29bd[_0x0a9e('0x26')]][_0x33f0c9]['variables'])){this[_0x0a9e('0x8')][_0x1f29bd['uniqueid']][_0x33f0c9][_0x0a9e('0xb')]={};}this[_0x0a9e('0x8')][_0x1f29bd[_0x0a9e('0x26')]][_0x33f0c9][_0x0a9e('0xb')]=this['variables'][_0x1f29bd[_0x0a9e('0x26')]];}}}}}catch(_0x4cf72d){logger[_0x0a9e('0x37')](_0x0a9e('0x71'),_0x1f29bd['uniqueid'],util[_0x0a9e('0x25')](_0x4cf72d,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0a9e('0x1c')][_0x0a9e('0x6c')]=function(_0x4ab276,_0x4c788f,_0x1b82b7){var _0x6ba2be=[_0x0a9e('0x72'),_0x0a9e('0x73'),_0x0a9e('0x74'),_0x0a9e('0x75'),_0x0a9e('0x76'),_0x0a9e('0x77'),_0x0a9e('0x78'),'rtpaudioqosrttbridged',_0x0a9e('0x79'),'sipuri',_0x0a9e('0x7a'),_0x0a9e('0x7b'),_0x0a9e('0x7c'),_0x0a9e('0x7d'),_0x0a9e('0x7e'),'memberlastcall',_0x0a9e('0x21'),_0x0a9e('0x7f'),_0x0a9e('0x80')];if(!_[_0x0a9e('0x81')](_0x4c788f)&&!_[_0x0a9e('0x82')](_0x6ba2be,_0x4c788f)){if(_['isUndefined'](this['variables'][_0x4ab276])){this[_0x0a9e('0xb')][_0x4ab276]={};}this['variables'][_0x4ab276][_0x4c788f]=_0x1b82b7;}};VoiceAgentReport[_0x0a9e('0x1c')][_0x0a9e('0x17')]=function(_0x4672e1){try{if(this[_0x0a9e('0x1e')](_0x4672e1)){logger[_0x0a9e('0x23')](_0x0a9e('0x83'),_0x4672e1['uniqueid'],util['inspect'](_0x4672e1,{'showHidden':![],'depth':null}));if(this[_0x0a9e('0x8')][_0x4672e1['uniqueid']]){for(var _0x2469d1 in this['channels'][_0x4672e1[_0x0a9e('0x26')]]){if(this['channels'][_0x4672e1['uniqueid']][_0x0a9e('0x58')](_0x2469d1)){if(this[_0x0a9e('0x8')][_0x4672e1['uniqueid']][_0x2469d1][_0x0a9e('0x4e')]==_0x0a9e('0x84')&&this[_0x0a9e('0x8')][_0x4672e1[_0x0a9e('0x26')]][_0x2469d1][_0x0a9e('0x12')]){logger['info']('[%s][voiceAgentReport][hangup]\x20destuniqueid:%s',_0x4672e1[_0x0a9e('0x26')],_0x2469d1);this[_0x0a9e('0x8')][_0x4672e1[_0x0a9e('0x26')]][_0x2469d1][_0x0a9e('0x5f')]=moment()[_0x0a9e('0x35')]('YYYY-MM-DD\x20HH:mm:ss');}}}logger[_0x0a9e('0x23')](_0x0a9e('0x85'),_0x4672e1['uniqueid'],util[_0x0a9e('0x25')](_[_0x0a9e('0x86')](this[_0x0a9e('0x8')][_0x4672e1[_0x0a9e('0x26')]]),{'showHidden':![],'depth':null}));ami[_0x0a9e('0x1d')](_0x0a9e('0x87'),_[_0x0a9e('0x86')](this[_0x0a9e('0x8')][_0x4672e1[_0x0a9e('0x26')]]));delete this[_0x0a9e('0x8')][_0x4672e1['uniqueid']];}if(this[_0x0a9e('0xb')][_0x4672e1[_0x0a9e('0x26')]]){delete this[_0x0a9e('0xb')][_0x4672e1[_0x0a9e('0x26')]];}}}catch(_0x1d0b02){logger['error']('[%s][voiceAgentReport][hangup]',_0x4672e1[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x1d0b02,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0a9e('0x1c')][_0x0a9e('0x88')]=function(_0x34f7b5){try{if(this['isNotNull'](_0x34f7b5)){logger[_0x0a9e('0x23')](_0x0a9e('0x89'),_0x34f7b5[_0x0a9e('0x26')],util['inspect'](_0x34f7b5,{'showHidden':![],'depth':null}));if(this[_0x0a9e('0x8')][_0x34f7b5['transfereeuniqueid']]){for(var _0x2144ca in this['channels'][_0x34f7b5[_0x0a9e('0x8a')]]){if(this[_0x0a9e('0x8')][_0x34f7b5[_0x0a9e('0x8a')]]['hasOwnProperty'](_0x2144ca)){if(_0x34f7b5[_0x0a9e('0x8b')]===_0x2144ca){logger['info'](_0x0a9e('0x8c'),_0x34f7b5[_0x0a9e('0x26')],this[_0x0a9e('0x8')][_0x34f7b5[_0x0a9e('0x8a')]][_0x2144ca][_0x0a9e('0x21')],_0x2144ca);var _0x1bee04=moment();this[_0x0a9e('0x8')][_0x34f7b5[_0x0a9e('0x8a')]][_0x2144ca][_0x0a9e('0x12')]=!![];this[_0x0a9e('0x8')][_0x34f7b5[_0x0a9e('0x8a')]][_0x2144ca][_0x0a9e('0x5f')]=moment()[_0x0a9e('0x35')](_0x0a9e('0x27'));this[_0x0a9e('0x8')][_0x34f7b5[_0x0a9e('0x8a')]][_0x2144ca]['lastevent']='complete';this[_0x0a9e('0x8')][_0x34f7b5['transfereeuniqueid']][_0x2144ca][_0x0a9e('0x4e')]=_0x0a9e('0x84');this['channels'][_0x34f7b5[_0x0a9e('0x8a')]][_0x2144ca][_0x0a9e('0x62')]=_0x1bee04[_0x0a9e('0x8d')](this[_0x0a9e('0x8')][_0x34f7b5['transfereeuniqueid']][_0x2144ca][_0x0a9e('0x3c')],_0x0a9e('0x8e'));}}}}if(this[_0x0a9e('0x8')][_0x34f7b5[_0x0a9e('0x8f')]]){var _0x5d0e1f=this[_0x0a9e('0x8')][_0x34f7b5[_0x0a9e('0x8f')]];this[_0x0a9e('0x8')][_0x34f7b5['secondtransfereruniqueid']]=this[_0x0a9e('0x8')][_0x34f7b5[_0x0a9e('0x8a')]];this[_0x0a9e('0x8')][_0x34f7b5['transfereeuniqueid']]=_0x5d0e1f;}}}catch(_0x303f75){logger[_0x0a9e('0x37')](_0x0a9e('0x90'),_0x34f7b5[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x303f75,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x0a9e('0x1b')]=function(_0x289e65){try{if(this['isNotNull'](_0x289e65)){logger[_0x0a9e('0x23')](_0x0a9e('0x91'),_0x289e65[_0x0a9e('0x26')],util['inspect'](_0x289e65,{'showHidden':![],'depth':null}));if(this['channels'][_0x289e65['transfereeuniqueid']]){for(var _0x1015aa in this[_0x0a9e('0x8')][_0x289e65['transfereeuniqueid']]){if(this[_0x0a9e('0x8')][_0x289e65[_0x0a9e('0x8a')]][_0x0a9e('0x58')](_0x1015aa)){if(_0x289e65['transfereruniqueid']===_0x1015aa){logger[_0x0a9e('0x20')](_0x0a9e('0x92'),_0x289e65[_0x0a9e('0x26')],this[_0x0a9e('0x8')][_0x289e65[_0x0a9e('0x8a')]][_0x1015aa][_0x0a9e('0x21')],_0x1015aa);var _0x40e6e7=moment();this[_0x0a9e('0x8')][_0x289e65[_0x0a9e('0x8a')]][_0x1015aa]['agentcomplete']=!![];this[_0x0a9e('0x8')][_0x289e65['transfereeuniqueid']][_0x1015aa][_0x0a9e('0x5f')]=_0x40e6e7;this[_0x0a9e('0x8')][_0x289e65[_0x0a9e('0x8a')]][_0x1015aa][_0x0a9e('0x53')]=_0x0a9e('0x60');this[_0x0a9e('0x8')][_0x289e65['transfereeuniqueid']][_0x1015aa][_0x0a9e('0x4e')]=_0x0a9e('0x84');this[_0x0a9e('0x8')][_0x289e65[_0x0a9e('0x8a')]][_0x1015aa]['talktime']=_0x40e6e7[_0x0a9e('0x8d')](this[_0x0a9e('0x8')][_0x289e65[_0x0a9e('0x8a')]][_0x1015aa][_0x0a9e('0x3c')],_0x0a9e('0x8e'));}}}}}}catch(_0x2be526){logger[_0x0a9e('0x37')](_0x0a9e('0x93'),_0x289e65[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x2be526,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x0a9e('0x18')]=function(_0x88b25f){var _0x2ff265='';try{if(this[_0x0a9e('0x1e')](_0x88b25f)){logger[_0x0a9e('0x23')](_0x0a9e('0x94'),_0x88b25f[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x88b25f,{'showHidden':![],'depth':null}));if(_0x88b25f['channel']){_0x2ff265=_0x88b25f[_0x0a9e('0x95')][_0x0a9e('0x96')](0x0,_0x88b25f[_0x0a9e('0x95')]['lastIndexOf']('-'));if(this[_0x0a9e('0xa')][_0x2ff265]){logger[_0x0a9e('0x20')](_0x0a9e('0x97'),_0x88b25f[_0x0a9e('0x26')],_0x2ff265);this[_0x0a9e('0xa')][_0x2ff265][_0x0a9e('0x98')]=!![];}}}}catch(_0x424f1b){logger[_0x0a9e('0x37')](_0x0a9e('0x99'),_0x88b25f[_0x0a9e('0x26')],util['inspect'](_0x424f1b,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0a9e('0x1c')][_0x0a9e('0x9a')]=function(_0x15a9ed){var _0x3db98f='';try{if(this[_0x0a9e('0x1e')](_0x15a9ed)){logger[_0x0a9e('0x23')]('[%s][voiceAgentReport][musiconholdstop]\x20event:',_0x15a9ed[_0x0a9e('0x26')],util['inspect'](_0x15a9ed,{'showHidden':![],'depth':null}));if(_0x15a9ed['channel']){_0x3db98f=_0x15a9ed['channel'][_0x0a9e('0x96')](0x0,_0x15a9ed[_0x0a9e('0x95')][_0x0a9e('0x9b')]('-'));if(this[_0x0a9e('0xa')][_0x3db98f]){logger['info'](_0x0a9e('0x9c'),_0x15a9ed[_0x0a9e('0x26')],_0x3db98f);this[_0x0a9e('0xa')][_0x3db98f][_0x0a9e('0x98')]=![];}}}}catch(_0x2c8d1d){logger['error']('[%s][voiceAgentReport][musiconholdstop]',_0x15a9ed[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x2c8d1d,{'showHidden':![],'depth':null}));}};module[_0x0a9e('0x9d')]=VoiceAgentReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceCallReport.js b/server/services/ami/report/voiceCallReport.js index bd2fb83..19b3940 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 _0x10ce=['error','[voiceCallReport][coreshowchannels]','inspect','prototype','isNotNull','isUndefined','emit','[%s][voiceCallReport][newcallerid]\x20calleridname:%s\x20calleridnum:%s','uniqueid','calleridname','calleridnum','[%s][voiceCallReport][newcallerid]\x20event:','merge','pick','keys','context','from-sip','split','channel','destconnectedlinenum','connectedlinenum','format','user:%s','name','user:agentconnect','debug','[%s][voiceCallReport][newchannel]\x20event:','OutgoingSpoolFailed','linkedid','[%s][voiceCallReport][newchannel]\x20context:%s\x20exten:%s','exten','starttime','YYYY-MM-DD\x20HH:mm:ss','disposition','channelstate','accountcode','[%s][voiceCallReport][newexten]\x20event:','application','toLowerCase','applicationdata','appdata','startsWith','[%s][voiceCallReport][newexten]\x20application:%s\x20appdata:%s','duration','seconds','includes','lastapplication','lastdata','cdr(','match','type','[%s][voiceCallReport][newexten]','[%s][voiceCallReport][newstate]\x20event:','answered','answertime','holdtime','destinationchannel','toNumber','UserId','membername','diff','xcally-motion-preview','connectedlinename','[%s][voiceCallReport][newstate]\x20sending\x20user:agentconnect\x20event:','[%s][voiceCallReport][mixMonitorFilename]\x20monitorFilename:%s','monitor','endsWith','replace','.WAV','monitorFilename','isNil','monitors','push','[%s][voiceCallReport][varset]\x20event:','variable','mixmonitor_filename','[%s][voiceCallReport][varset]\x20variable:mixmonitor_filename\x20value:%s','value','syncMixMonitorFilename','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','xmd-queue','[%s][voiceCallReport][varset]\x20variable:xmd-queue\x20value:%s','xmd-originatecalleridnum','[%s][voiceCallReport][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','originatecalleridnum','xmd-destination','[%s][voiceCallReport][varset]\x20variable:xmd-destination\x20value:%s','destination','[%s][voiceCallReport][varset]\x20variable:xmd-callerid-preview\x20value:%s','calleridpreview','xmcs-queue','[%s][voiceCallReport][varset]\x20variable:xmcs-queue\x20value:%s','[%s][voiceCallReport][varset]\x20variable:sipcallid\x20value:%s','sipcalluniqueid','parse','sipcalllinkedid','[%s][voiceCallReport][hangup]\x20event:','[%s][voiceCallReport][hangup]\x20reason:%s','cause-txt','endtime','billableseconds','omit','length','user:agentcomplete','transferType','then','undefined','isEmpty','getSettings','resolve','StopMixMonitor','catch','finally','webbar:stopmonitors','BlindTransfer','outbound','[%s][voiceCallReport][hangup]\x20sending\x20hangup\x20event:','custom:voiceCallReport','[%s][voiceCallReport][hangup]','syncAttendedTransfer','[%s][voiceCallReport][attendedtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s','origtransferercalleridnum','transfertargetcalleridnum','[%s][voiceCallReport][attendedtransfer]\x20event:','transfereeuniqueid','transfercalleridnum','transferconnectedlinenum','secondtransfereruniqueid','ATTENDED','transfertargetuniqueid','origtransfereruniqueid','origtransfererlinkedid','[%s][voiceCallReport][attendedtransfer]','transfereecalleridnum','extension','[%s][voiceCallReport][blindtransfer]\x20event:','BLIND','syncHangup','transfereruniqueid','transfererchannel','[%s][voiceCallReport][blindtransfer]','[%s][voiceCallReport][musiconholdstart]\x20event:','mohstarttime','[%s][voiceCallReport][musiconholdstart]\x20mohstarttime:%s','[%s][voiceCallReport][musiconholdstart]','syncMusicOnHoldStop','[%s][voiceCallReport][musiconholdstop]\x20event:','mohtime','milliseconds','[%s][voiceCallReport][musiconholdstop]\x20mohtime:%s','[%s][voiceCallReport][musiconholdstop]','exports','moment','util','ioredis','../../../config/logger','ami','../model/channel','../rpc/setting','set','queue','agi','voicemail','FAILED','NO\x20ANSWER','ANSWERED','BUSY','redis','defaults','localhost','channels','agents','blindTransfers','coreshowchannel','syncNewExten','bind','newexten','newchannel','syncNewChannel','newstate','syncNewState','varset','syncVarSet','hangup','newcallerid','syncNewCallerId','attendedtransfer','blindtransfer','musiconholdstart','syncMusicOnHoldStart','musiconholdstop','info','[voiceCallReport][coreshowchannels]\x20started','actionCoreShowChannels'];(function(_0x4c4719,_0x367735){var _0xff0de7=function(_0x35bc34){while(--_0x35bc34){_0x4c4719['push'](_0x4c4719['shift']());}};_0xff0de7(++_0x367735);}(_0x10ce,0x9e));var _0xe10c=function(_0x318174,_0x2004a1){_0x318174=_0x318174-0x0;var _0x1ff433=_0x10ce[_0x318174];return _0x1ff433;};'use strict';var _=require('lodash');var moment=require(_0xe10c('0x0'));var util=require(_0xe10c('0x1'));var path=require('path');var Redis=require(_0xe10c('0x2'));var config=require('../../../config/environment');var logger=require(_0xe10c('0x3'))(_0xe10c('0x4'));var ami=require('../ami');var Channel=require(_0xe10c('0x5'));var RpcSetting=require(_0xe10c('0x6'));var applications=[_0xe10c('0x7'),_0xe10c('0x8'),_0xe10c('0x9'),'dial','playback',_0xe10c('0xa')];var dispositions=['NO\x20ANSWER',_0xe10c('0xb'),_0xe10c('0xb'),_0xe10c('0xc'),_0xe10c('0xc'),_0xe10c('0xc'),_0xe10c('0xd'),_0xe10c('0xe'),_0xe10c('0xb'),_0xe10c('0xb'),_0xe10c('0xb')];config[_0xe10c('0xf')]=_[_0xe10c('0x10')](config[_0xe10c('0xf')],{'host':_0xe10c('0x11'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xe10c('0xf')]));function VoiceCallReport(_0x4251ea){this[_0xe10c('0x12')]=_0x4251ea['channels'];this[_0xe10c('0x13')]=_0x4251ea[_0xe10c('0x13')];this[_0xe10c('0x14')]={};ami['on'](_0xe10c('0x15'),this[_0xe10c('0x16')][_0xe10c('0x17')](this));ami['on'](_0xe10c('0x18'),this['syncNewExten'][_0xe10c('0x17')](this));ami['on'](_0xe10c('0x19'),this[_0xe10c('0x1a')][_0xe10c('0x17')](this));ami['on'](_0xe10c('0x1b'),this[_0xe10c('0x1c')][_0xe10c('0x17')](this));ami['on'](_0xe10c('0x1d'),this[_0xe10c('0x1e')]['bind'](this));ami['on'](_0xe10c('0x1f'),this['syncHangup'][_0xe10c('0x17')](this));ami['on'](_0xe10c('0x20'),this[_0xe10c('0x21')][_0xe10c('0x17')](this));ami['on'](_0xe10c('0x22'),this['syncAttendedTransfer'][_0xe10c('0x17')](this));ami['on'](_0xe10c('0x23'),this['syncBlindTransfer'][_0xe10c('0x17')](this));ami['on'](_0xe10c('0x24'),this[_0xe10c('0x25')][_0xe10c('0x17')](this));ami['on'](_0xe10c('0x26'),this['syncMusicOnHoldStop'][_0xe10c('0x17')](this));try{logger[_0xe10c('0x27')](_0xe10c('0x28'));ami[_0xe10c('0x29')]();}catch(_0x2e4754){logger[_0xe10c('0x2a')](_0xe10c('0x2b'),util[_0xe10c('0x2c')](_0x2e4754,{'showHidden':![],'depth':null}));}}VoiceCallReport[_0xe10c('0x2d')][_0xe10c('0x2e')]=function(_0x599890){return _0x599890!==null&&!_[_0xe10c('0x2f')](_0x599890);};VoiceCallReport[_0xe10c('0x2d')][_0xe10c('0x30')]=function(_0x37840e,_0x449b39,_0x2a4ad6){io['to'](_0x37840e)['emit'](_0x449b39,_0x2a4ad6);};VoiceCallReport[_0xe10c('0x2d')][_0xe10c('0x21')]=function(_0xbf9e3){try{if(this[_0xe10c('0x2e')](_0xbf9e3)){logger['info'](_0xe10c('0x31'),_0xbf9e3[_0xe10c('0x32')],_0xbf9e3[_0xe10c('0x33')],_0xbf9e3[_0xe10c('0x34')]);logger['debug'](_0xe10c('0x35'),_0xbf9e3['uniqueid'],util['inspect'](_0xbf9e3,{'showHidden':![],'depth':null}));if(_0xbf9e3[_0xe10c('0x32')]===_0xbf9e3['linkedid']){if(!_[_0xe10c('0x2f')](this['channels'][_0xbf9e3[_0xe10c('0x32')]])){_[_0xe10c('0x36')](this[_0xe10c('0x12')][_0xbf9e3[_0xe10c('0x32')]],_[_0xe10c('0x37')](_0xbf9e3,_[_0xe10c('0x38')](this[_0xe10c('0x12')][_0xbf9e3['uniqueid']])));}}if(_0xbf9e3[_0xe10c('0x39')]===_0xe10c('0x3a')){if(this[_0xe10c('0x13')][_0xbf9e3['channel'][_0xe10c('0x3b')]('-')[0x0]]){if(_0xbf9e3['exten']=='xcally-motion-preview'){this[_0xe10c('0x13')][_0xbf9e3[_0xe10c('0x3c')]['split']('-')[0x0]][_0xe10c('0x3d')]=_0xbf9e3[_0xe10c('0x3e')];this[_0xe10c('0x30')](util[_0xe10c('0x3f')](_0xe10c('0x40'),this[_0xe10c('0x13')][_0xbf9e3[_0xe10c('0x3c')][_0xe10c('0x3b')]('-')[0x0]][_0xe10c('0x41')]),_0xe10c('0x42'),{'destaccountcode':this['agents'][_0xbf9e3[_0xe10c('0x3c')][_0xe10c('0x3b')]('-')[0x0]]['accountcode'],'destconnectedlinenum':_0xbf9e3['connectedlinenum']});}}}}}catch(_0x225821){logger['error']('[%s][voiceCallReport][newcallerid]',_0xbf9e3[_0xe10c('0x32')],util[_0xe10c('0x2c')](_0x225821,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xe10c('0x2d')][_0xe10c('0x1a')]=function(_0x2240e3){try{if(this[_0xe10c('0x2e')](_0x2240e3)){logger[_0xe10c('0x43')](_0xe10c('0x44'),_0x2240e3[_0xe10c('0x32')],util[_0xe10c('0x2c')](_0x2240e3,{'showHidden':![],'depth':null}));if(this['channels'][_0x2240e3[_0xe10c('0x32')]])return;if(_0x2240e3['channel']===_0xe10c('0x45'))return;if(_0x2240e3[_0xe10c('0x32')]!==_0x2240e3[_0xe10c('0x46')]&&!this['blindTransfers'][_0x2240e3['linkedid']])return;logger['info'](_0xe10c('0x47'),_0x2240e3[_0xe10c('0x32')],_0x2240e3[_0xe10c('0x39')],_0x2240e3[_0xe10c('0x48')]);this[_0xe10c('0x12')][_0x2240e3[_0xe10c('0x32')]]=new Channel();this[_0xe10c('0x12')][_0x2240e3[_0xe10c('0x32')]][_0xe10c('0x49')]=moment()['format'](_0xe10c('0x4a'));this['channels'][_0x2240e3[_0xe10c('0x32')]][_0xe10c('0x4b')]=dispositions[_['toNumber'](_0x2240e3[_0xe10c('0x4c')])];_['merge'](this[_0xe10c('0x12')][_0x2240e3[_0xe10c('0x32')]],_['pick'](_0x2240e3,_[_0xe10c('0x38')](this['channels'][_0x2240e3['uniqueid']])));if(_0x2240e3[_0xe10c('0x39')]===_0xe10c('0x3a')){if(this['agents'][_0x2240e3[_0xe10c('0x3c')][_0xe10c('0x3b')]('-')[0x0]]){if(_[_0xe10c('0x2f')](this['agents'][_0x2240e3['channel'][_0xe10c('0x3b')]('-')[0x0]][_0xe10c('0x3d')])){this[_0xe10c('0x13')][_0x2240e3[_0xe10c('0x3c')][_0xe10c('0x3b')]('-')[0x0]][_0xe10c('0x3d')]=_0x2240e3['exten'];logger[_0xe10c('0x43')]('[%s][voiceCallReport][newchannel]\x20sending\x20user:agentconnect\x20event:',_0x2240e3[_0xe10c('0x32')],util[_0xe10c('0x2c')]({'id':this[_0xe10c('0x13')][_0x2240e3[_0xe10c('0x3c')][_0xe10c('0x3b')]('-')[0x0]]['id'],'destaccountcode':this[_0xe10c('0x13')][_0x2240e3[_0xe10c('0x3c')][_0xe10c('0x3b')]('-')[0x0]]['accountcode'],'destconnectedlinenum':_0x2240e3[_0xe10c('0x48')]},{'showHidden':![],'depth':null}));this[_0xe10c('0x30')](util[_0xe10c('0x3f')](_0xe10c('0x40'),this[_0xe10c('0x13')][_0x2240e3[_0xe10c('0x3c')][_0xe10c('0x3b')]('-')[0x0]][_0xe10c('0x41')]),_0xe10c('0x42'),{'id':this['agents'][_0x2240e3[_0xe10c('0x3c')]['split']('-')[0x0]]['id'],'destaccountcode':this[_0xe10c('0x13')][_0x2240e3[_0xe10c('0x3c')][_0xe10c('0x3b')]('-')[0x0]][_0xe10c('0x4d')],'destconnectedlinenum':_0x2240e3[_0xe10c('0x48')]});}}}}}catch(_0x317ee3){logger[_0xe10c('0x2a')]('[%s][voiceCallReport][newchannel]',_0x2240e3[_0xe10c('0x32')],util[_0xe10c('0x2c')](_0x317ee3,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xe10c('0x2d')]['syncNewExten']=function(_0x3b2690){try{if(this[_0xe10c('0x2e')](_0x3b2690)){logger[_0xe10c('0x43')](_0xe10c('0x4e'),_0x3b2690[_0xe10c('0x32')],util[_0xe10c('0x2c')](_0x3b2690,{'showHidden':![],'depth':null}));if(_0x3b2690[_0xe10c('0x3c')]===_0xe10c('0x45')||_0x3b2690[_0xe10c('0x48')]==='h')return;if(_0x3b2690[_0xe10c('0x32')]===_0x3b2690['linkedid']||this['blindTransfers'][_0x3b2690[_0xe10c('0x46')]]){_0x3b2690[_0xe10c('0x4f')]=_0x3b2690[_0xe10c('0x4f')][_0xe10c('0x50')]();_0x3b2690[_0xe10c('0x51')]=_0x3b2690['appdata']&&_0x3b2690[_0xe10c('0x52')][_0xe10c('0x53')]('CDR(routeAlias)')?_0x3b2690[_0xe10c('0x52')]:(_0x3b2690[_0xe10c('0x52')]||_0x3b2690[_0xe10c('0x51')])['toLowerCase']();logger['info'](_0xe10c('0x54'),_0x3b2690[_0xe10c('0x32')],_0x3b2690[_0xe10c('0x4f')],_0x3b2690[_0xe10c('0x51')]);if(_[_0xe10c('0x2f')](this[_0xe10c('0x12')][_0x3b2690['uniqueid']])){this[_0xe10c('0x12')][_0x3b2690[_0xe10c('0x32')]]=new Channel();this['channels'][_0x3b2690[_0xe10c('0x32')]][_0xe10c('0x49')]=_0x3b2690[_0xe10c('0x55')]?moment()['subtract'](moment[_0xe10c('0x55')](_0x3b2690[_0xe10c('0x55')])[_0xe10c('0x56')](),_0xe10c('0x56'))[_0xe10c('0x3f')](_0xe10c('0x4a')):moment()['format'](_0xe10c('0x4a'));this['channels'][_0x3b2690['uniqueid']][_0xe10c('0x4b')]=_0xe10c('0xc');}_['merge'](this[_0xe10c('0x12')][_0x3b2690[_0xe10c('0x32')]],_['pick'](_0x3b2690,_[_0xe10c('0x38')](this[_0xe10c('0x12')][_0x3b2690[_0xe10c('0x32')]])));if(_[_0xe10c('0x57')](applications,_0x3b2690[_0xe10c('0x4f')])){this[_0xe10c('0x12')][_0x3b2690['uniqueid']][_0xe10c('0x58')]=_0x3b2690[_0xe10c('0x4f')];this['channels'][_0x3b2690[_0xe10c('0x32')]][_0xe10c('0x59')]=_0x3b2690[_0xe10c('0x51')];if(_0x3b2690[_0xe10c('0x4f')]===_0xe10c('0x7')&&_['startsWith'](_0x3b2690[_0xe10c('0x51')][_0xe10c('0x50')](),_0xe10c('0x5a'))){var _0x31f73e=_0x3b2690['applicationdata'][_0xe10c('0x3b')]('=');var _0x2c7860=_0x31f73e[0x0][_0xe10c('0x50')]()[_0xe10c('0x5b')](/cdr\((.*)\)/);if(_0x2c7860){if(_0x2c7860[0x1]===_0xe10c('0x5c')&&!_['isNil'](this[_0xe10c('0x12')][_0x3b2690[_0xe10c('0x32')]][_0x2c7860[0x1]]))return;this[_0xe10c('0x12')][_0x3b2690[_0xe10c('0x32')]][_0x2c7860[0x1]]=_0x31f73e[0x1];}}else if(_0x3b2690[_0xe10c('0x4f')]==='queue'){this[_0xe10c('0x12')][_0x3b2690[_0xe10c('0x32')]][_0xe10c('0x8')]=_0x3b2690[_0xe10c('0x51')][_0xe10c('0x3b')](',')[0x0];}}}}}catch(_0x31c869){logger['error'](_0xe10c('0x5d'),_0x3b2690[_0xe10c('0x32')],util[_0xe10c('0x2c')](_0x31c869,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0xe10c('0x1c')]=function(_0x236b6f){try{if(this[_0xe10c('0x2e')](_0x236b6f)){logger[_0xe10c('0x27')]('[%s][voiceCallReport][newstate]\x20linkedid:%s\x20calleridname:%s\x20calleridnum:%s',_0x236b6f['uniqueid'],_0x236b6f['linkedid'],_0x236b6f[_0xe10c('0x33')],_0x236b6f[_0xe10c('0x34')]);logger[_0xe10c('0x43')](_0xe10c('0x5e'),_0x236b6f['uniqueid'],util[_0xe10c('0x2c')](_0x236b6f,{'showHidden':![],'depth':null}));if(_0x236b6f[_0xe10c('0x4c')]!=='6')return;if(_0x236b6f[_0xe10c('0x32')]!==_0x236b6f[_0xe10c('0x46')]){var _0x585299=moment();if(this[_0xe10c('0x12')][_0x236b6f[_0xe10c('0x46')]]){if(!this[_0xe10c('0x12')][_0x236b6f[_0xe10c('0x46')]][_0xe10c('0x5f')]){this[_0xe10c('0x12')][_0x236b6f[_0xe10c('0x46')]]['answered']=!![];this['channels'][_0x236b6f[_0xe10c('0x46')]][_0xe10c('0x60')]=_0x585299[_0xe10c('0x3f')](_0xe10c('0x4a'));if(this[_0xe10c('0x12')][_0x236b6f[_0xe10c('0x46')]][_0xe10c('0x49')]){this[_0xe10c('0x12')][_0x236b6f[_0xe10c('0x46')]][_0xe10c('0x61')]=_0x585299['diff'](this['channels'][_0x236b6f[_0xe10c('0x46')]]['starttime'],_0xe10c('0x56'));}}this[_0xe10c('0x12')][_0x236b6f[_0xe10c('0x46')]][_0xe10c('0x46')]=_0x236b6f[_0xe10c('0x32')];if(_0x236b6f[_0xe10c('0x34')]!=='xcally-motion-preview'){this['channels'][_0x236b6f[_0xe10c('0x46')]][_0xe10c('0x3e')]=_0x236b6f[_0xe10c('0x34')];}this[_0xe10c('0x12')][_0x236b6f[_0xe10c('0x46')]]['connectedlinename']=_0x236b6f[_0xe10c('0x33')];this['channels'][_0x236b6f[_0xe10c('0x46')]][_0xe10c('0x62')]=_0x236b6f[_0xe10c('0x3c')];this[_0xe10c('0x12')][_0x236b6f['linkedid']]['disposition']=dispositions[_[_0xe10c('0x63')](_0x236b6f[_0xe10c('0x4c')])];if(this[_0xe10c('0x13')][_0x236b6f[_0xe10c('0x3c')]['split']('-')[0x0]]){this[_0xe10c('0x12')][_0x236b6f['linkedid']][_0xe10c('0x64')]=this[_0xe10c('0x13')][_0x236b6f[_0xe10c('0x3c')][_0xe10c('0x3b')]('-')[0x0]]['id'];this[_0xe10c('0x12')][_0x236b6f[_0xe10c('0x46')]][_0xe10c('0x65')]=this['agents'][_0x236b6f[_0xe10c('0x3c')][_0xe10c('0x3b')]('-')[0x0]][_0xe10c('0x41')];}}if(this[_0xe10c('0x12')][_0x236b6f['uniqueid']]){if(!this['channels'][_0x236b6f['uniqueid']][_0xe10c('0x5f')]){this[_0xe10c('0x12')][_0x236b6f[_0xe10c('0x32')]][_0xe10c('0x5f')]=!![];this['channels'][_0x236b6f[_0xe10c('0x32')]][_0xe10c('0x60')]=_0x585299[_0xe10c('0x3f')](_0xe10c('0x4a'));if(this[_0xe10c('0x12')][_0x236b6f['uniqueid']][_0xe10c('0x49')]){this[_0xe10c('0x12')][_0x236b6f['uniqueid']][_0xe10c('0x61')]=_0x585299[_0xe10c('0x66')](this['channels'][_0x236b6f[_0xe10c('0x32')]][_0xe10c('0x49')],_0xe10c('0x56'));}}if(_0x236b6f['calleridnum']!==_0xe10c('0x67')){this[_0xe10c('0x12')][_0x236b6f[_0xe10c('0x32')]][_0xe10c('0x3e')]=_0x236b6f[_0xe10c('0x34')];}this[_0xe10c('0x12')][_0x236b6f['uniqueid']][_0xe10c('0x68')]=_0x236b6f[_0xe10c('0x33')];this[_0xe10c('0x12')][_0x236b6f[_0xe10c('0x32')]][_0xe10c('0x62')]=_0x236b6f[_0xe10c('0x3c')];this['channels'][_0x236b6f[_0xe10c('0x32')]]['disposition']=dispositions[_[_0xe10c('0x63')](_0x236b6f[_0xe10c('0x4c')])];}}else{if(this[_0xe10c('0x12')][_0x236b6f[_0xe10c('0x32')]]){if(this['agents'][_0x236b6f[_0xe10c('0x3c')][_0xe10c('0x3b')]('-')[0x0]]){this[_0xe10c('0x12')][_0x236b6f['uniqueid']]['UserId']=this[_0xe10c('0x13')][_0x236b6f[_0xe10c('0x3c')][_0xe10c('0x3b')]('-')[0x0]]['id'];this[_0xe10c('0x12')][_0x236b6f[_0xe10c('0x32')]][_0xe10c('0x65')]=this['agents'][_0x236b6f[_0xe10c('0x3c')]['split']('-')[0x0]][_0xe10c('0x41')];}}}if(_0x236b6f['context']===_0xe10c('0x3a')){if(this[_0xe10c('0x13')][_0x236b6f['channel'][_0xe10c('0x3b')]('-')[0x0]]){this[_0xe10c('0x13')][_0x236b6f[_0xe10c('0x3c')][_0xe10c('0x3b')]('-')[0x0]][_0xe10c('0x3d')]=_0x236b6f[_0xe10c('0x48')];var _0x3e147c,_0x298ce9;if(this['channels'][_0x236b6f['uniqueid']]){_0x3e147c=this['channels'][_0x236b6f[_0xe10c('0x32')]]['routealias'];_0x298ce9=this['channels'][_0x236b6f['uniqueid']][_0xe10c('0x8')];}else if(this[_0xe10c('0x12')][_0x236b6f['linkedid']]){_0x3e147c=this[_0xe10c('0x12')][_0x236b6f[_0xe10c('0x46')]]['routealias'];_0x298ce9=this[_0xe10c('0x12')][_0x236b6f[_0xe10c('0x46')]][_0xe10c('0x8')];}logger[_0xe10c('0x43')](_0xe10c('0x69'),_0x236b6f['uniqueid'],util[_0xe10c('0x2c')]({'id':this[_0xe10c('0x13')][_0x236b6f[_0xe10c('0x3c')]['split']('-')[0x0]]['id'],'destaccountcode':this[_0xe10c('0x13')][_0x236b6f[_0xe10c('0x3c')]['split']('-')[0x0]]['accountcode'],'destconnectedlinenum':_0x236b6f['exten'],'routealias':_0x3e147c,'queue':_0x298ce9||undefined},{'showHidden':![],'depth':null}));this['emit'](util[_0xe10c('0x3f')](_0xe10c('0x40'),this[_0xe10c('0x13')][_0x236b6f[_0xe10c('0x3c')][_0xe10c('0x3b')]('-')[0x0]]['name']),_0xe10c('0x42'),{'id':this['agents'][_0x236b6f[_0xe10c('0x3c')][_0xe10c('0x3b')]('-')[0x0]]['id'],'agentconnected':!![],'destaccountcode':this[_0xe10c('0x13')][_0x236b6f['channel'][_0xe10c('0x3b')]('-')[0x0]]['accountcode'],'destconnectedlinenum':_0x236b6f[_0xe10c('0x48')],'routealias':_0x3e147c,'queue':_0x298ce9||undefined});}}}}catch(_0x50682e){logger[_0xe10c('0x2a')]('[%s][voiceCallReport][newstate]',_0x236b6f['uniqueid'],util[_0xe10c('0x2c')](_0x50682e,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xe10c('0x2d')]['syncMixMonitorFilename']=function(_0x239c33,_0x3653b3){try{if(this['channels'][_0x239c33]){logger[_0xe10c('0x27')](_0xe10c('0x6a'),_0x239c33,_0x3653b3);this[_0xe10c('0x12')][_0x239c33][_0xe10c('0x6b')]=!![];if(_[_0xe10c('0x6c')](_0x3653b3,'.wav49')){_0x3653b3=_0x3653b3[_0xe10c('0x6d')]('.wav49',_0xe10c('0x6e'));}this[_0xe10c('0x12')][_0x239c33][_0xe10c('0x6f')]=_0x3653b3;var _0xbf21c1=_['find'](this[_0xe10c('0x12')][_0x239c33]['monitors'],{'filename':_0x3653b3});if(_[_0xe10c('0x70')](_0xbf21c1)){this[_0xe10c('0x12')][_0x239c33][_0xe10c('0x71')][_0xe10c('0x72')]({'filename':_0x3653b3,'createdAt':moment()['format'](_0xe10c('0x4a')),'mixmonitorid':'','status':'rec'});}}}catch(_0x1703fd){logger[_0xe10c('0x2a')]('[%s][voiceCallReport][mixMonitorFilename]',_0x239c33,util[_0xe10c('0x2c')](_0x1703fd,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xe10c('0x2d')][_0xe10c('0x1e')]=function(_0x24a0d5){try{if(this['isNotNull'](_0x24a0d5)){logger[_0xe10c('0x43')](_0xe10c('0x73'),_0x24a0d5[_0xe10c('0x32')],util['inspect'](_0x24a0d5,{'showHidden':![],'depth':null}));if(this['channels'][_0x24a0d5[_0xe10c('0x32')]]&&_0x24a0d5[_0xe10c('0x3c')]!=_0xe10c('0x45')){if(this[_0xe10c('0x2e')](_0x24a0d5[_0xe10c('0x74')])){if(this[_0xe10c('0x2e')](_0x24a0d5[_0xe10c('0x74')][_0xe10c('0x75')])){logger[_0xe10c('0x27')](_0xe10c('0x76'),_0x24a0d5['uniqueid'],_0x24a0d5[_0xe10c('0x77')]);this[_0xe10c('0x78')](_0x24a0d5[_0xe10c('0x32')],_0x24a0d5['value']);}else if(this[_0xe10c('0x2e')](_0x24a0d5[_0xe10c('0x74')][_0xe10c('0x79')])){logger['info'](_0xe10c('0x7a'),_0x24a0d5[_0xe10c('0x32')],_0x24a0d5[_0xe10c('0x77')]);this[_0xe10c('0x12')][_0x24a0d5['uniqueid']][_0xe10c('0x34')]=_0x24a0d5[_0xe10c('0x77')];}else if(this[_0xe10c('0x2e')](_0x24a0d5['variable'][_0xe10c('0x7b')])){logger[_0xe10c('0x27')](_0xe10c('0x7c'),_0x24a0d5['uniqueid'],_0x24a0d5[_0xe10c('0x77')]);this[_0xe10c('0x12')][_0x24a0d5['uniqueid']][_0xe10c('0x7d')]=_0x24a0d5[_0xe10c('0x77')];}else if(this[_0xe10c('0x2e')](_0x24a0d5[_0xe10c('0x74')][_0xe10c('0x7e')])){logger[_0xe10c('0x27')](_0xe10c('0x7f'),_0x24a0d5[_0xe10c('0x32')],_0x24a0d5['value']);this['channels'][_0x24a0d5[_0xe10c('0x32')]][_0xe10c('0x5c')]=_0x24a0d5[_0xe10c('0x77')];}else if(this[_0xe10c('0x2e')](_0x24a0d5[_0xe10c('0x74')][_0xe10c('0x80')])){logger[_0xe10c('0x27')](_0xe10c('0x81'),_0x24a0d5['uniqueid'],_0x24a0d5[_0xe10c('0x77')][_0xe10c('0x3b')](',')[0x0]);this['channels'][_0x24a0d5[_0xe10c('0x32')]][_0xe10c('0x8')]=_0x24a0d5[_0xe10c('0x77')][_0xe10c('0x3b')](',')[0x0];}else if(this[_0xe10c('0x2e')](_0x24a0d5[_0xe10c('0x74')][_0xe10c('0x82')])){logger['info'](_0xe10c('0x83'),_0x24a0d5[_0xe10c('0x32')],_0x24a0d5['value']);this[_0xe10c('0x12')][_0x24a0d5[_0xe10c('0x32')]][_0xe10c('0x84')]=_0x24a0d5[_0xe10c('0x77')];}else if(this[_0xe10c('0x2e')](_0x24a0d5['variable'][_0xe10c('0x85')])){logger[_0xe10c('0x27')](_0xe10c('0x86'),_0x24a0d5[_0xe10c('0x32')],_0x24a0d5[_0xe10c('0x77')]);this[_0xe10c('0x12')][_0x24a0d5[_0xe10c('0x32')]][_0xe10c('0x87')]=_0x24a0d5[_0xe10c('0x77')];}else if(this['isNotNull'](_0x24a0d5[_0xe10c('0x74')]['xmd-callerid-preview'])){logger['info'](_0xe10c('0x88'),_0x24a0d5[_0xe10c('0x32')],_0x24a0d5[_0xe10c('0x77')]);this[_0xe10c('0x12')][_0x24a0d5[_0xe10c('0x32')]][_0xe10c('0x89')]=_0x24a0d5[_0xe10c('0x77')];}else if(this[_0xe10c('0x2e')](_0x24a0d5[_0xe10c('0x74')][_0xe10c('0x8a')])){logger[_0xe10c('0x27')](_0xe10c('0x8b'),_0x24a0d5[_0xe10c('0x32')],_0x24a0d5[_0xe10c('0x77')]);this[_0xe10c('0x12')][_0x24a0d5[_0xe10c('0x32')]][_0xe10c('0x8')]=_0x24a0d5[_0xe10c('0x77')];}else if(this[_0xe10c('0x2e')](_0x24a0d5[_0xe10c('0x74')]['sipcallid'])){logger['info'](_0xe10c('0x8c'),_0x24a0d5[_0xe10c('0x32')],_0x24a0d5[_0xe10c('0x77')]);this[_0xe10c('0x12')][_0x24a0d5[_0xe10c('0x32')]][_0xe10c('0x8d')]=_0x24a0d5['value'];}}}else if(this['isNotNull'](_0x24a0d5[_0xe10c('0x74')]['mixmonitor_filename'])){if(_0x24a0d5[_0xe10c('0x77')]){var _0x546162=path[_0xe10c('0x8e')](_0x24a0d5[_0xe10c('0x77')])[_0xe10c('0x41')];logger[_0xe10c('0x27')](_0xe10c('0x76'),_0x546162,_0x24a0d5[_0xe10c('0x77')]);this['syncMixMonitorFilename'](_0x546162,_0x24a0d5[_0xe10c('0x77')]);}}else if(this[_0xe10c('0x12')][_0x24a0d5[_0xe10c('0x46')]]){if(this[_0xe10c('0x2e')](_0x24a0d5['variable'])){if(this[_0xe10c('0x2e')](_0x24a0d5[_0xe10c('0x74')]['sipcallid'])){logger[_0xe10c('0x27')](_0xe10c('0x8c'),_0x24a0d5[_0xe10c('0x46')],_0x24a0d5[_0xe10c('0x77')]);this['channels'][_0x24a0d5[_0xe10c('0x46')]][_0xe10c('0x8f')]=_0x24a0d5['value'];}}}}}catch(_0xf07a9b){logger['error']('[%s][voiceCallReport][varset]',_0x24a0d5['uniqueid'],util[_0xe10c('0x2c')](_0xf07a9b,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xe10c('0x2d')]['syncHangup']=function(_0x1ef46a){try{if(this['isNotNull'](_0x1ef46a)){logger[_0xe10c('0x43')](_0xe10c('0x90'),_0x1ef46a['uniqueid'],util[_0xe10c('0x2c')](_0x1ef46a,{'showHidden':![],'depth':null}));if(this[_0xe10c('0x14')][_0x1ef46a['linkedid']]){if(this[_0xe10c('0x12')][this['blindTransfers'][_0x1ef46a['linkedid']][_0xe10c('0x46')]]){this['channels'][this[_0xe10c('0x14')][_0x1ef46a[_0xe10c('0x46')]][_0xe10c('0x46')]][_0xe10c('0x32')]=_0x1ef46a[_0xe10c('0x32')];this[_0xe10c('0x12')][this[_0xe10c('0x14')][_0x1ef46a['linkedid']][_0xe10c('0x46')]][_0xe10c('0x5f')]=this[_0xe10c('0x12')][_0x1ef46a[_0xe10c('0x32')]][_0xe10c('0x5f')];this['channels'][this[_0xe10c('0x14')][_0x1ef46a[_0xe10c('0x46')]][_0xe10c('0x46')]][_0xe10c('0x60')]=this['channels'][_0x1ef46a['uniqueid']][_0xe10c('0x60')];this[_0xe10c('0x12')][this[_0xe10c('0x14')][_0x1ef46a[_0xe10c('0x46')]][_0xe10c('0x46')]][_0xe10c('0x62')]=this[_0xe10c('0x12')][this[_0xe10c('0x14')][_0x1ef46a[_0xe10c('0x46')]]['linkedid']][_0xe10c('0x3c')];this['channels'][this[_0xe10c('0x14')][_0x1ef46a[_0xe10c('0x46')]][_0xe10c('0x46')]][_0xe10c('0x4b')]=this['channels'][_0x1ef46a[_0xe10c('0x32')]][_0xe10c('0x4b')];this[_0xe10c('0x12')][_0x1ef46a[_0xe10c('0x32')]]=this['channels'][this[_0xe10c('0x14')][_0x1ef46a[_0xe10c('0x46')]][_0xe10c('0x46')]];delete this[_0xe10c('0x12')][this[_0xe10c('0x14')][_0x1ef46a['linkedid']][_0xe10c('0x46')]];}else if(this[_0xe10c('0x12')][this[_0xe10c('0x14')][_0x1ef46a[_0xe10c('0x46')]][_0xe10c('0x32')]]){this[_0xe10c('0x12')][this[_0xe10c('0x14')][_0x1ef46a[_0xe10c('0x46')]][_0xe10c('0x32')]][_0xe10c('0x32')]=[this['channels'][this[_0xe10c('0x14')][_0x1ef46a['linkedid']]['uniqueid']][_0xe10c('0x46')],this[_0xe10c('0x12')][this[_0xe10c('0x14')][_0x1ef46a[_0xe10c('0x46')]]['uniqueid']]['linkedid']=this[_0xe10c('0x12')][this['blindTransfers'][_0x1ef46a[_0xe10c('0x46')]]['uniqueid']]['uniqueid']][0x0];this[_0xe10c('0x12')][this['blindTransfers'][_0x1ef46a['linkedid']]['uniqueid']][_0xe10c('0x5f')]=this[_0xe10c('0x12')][_0x1ef46a[_0xe10c('0x32')]]['answered'];this[_0xe10c('0x12')][this[_0xe10c('0x14')][_0x1ef46a[_0xe10c('0x46')]][_0xe10c('0x32')]][_0xe10c('0x60')]=this['channels'][_0x1ef46a[_0xe10c('0x32')]]['answertime'];this['channels'][this[_0xe10c('0x14')][_0x1ef46a[_0xe10c('0x46')]][_0xe10c('0x32')]]['destinationchannel']=this[_0xe10c('0x12')][this[_0xe10c('0x14')][_0x1ef46a['linkedid']]['uniqueid']][_0xe10c('0x3c')];this[_0xe10c('0x12')][this[_0xe10c('0x14')][_0x1ef46a[_0xe10c('0x46')]]['uniqueid']][_0xe10c('0x4b')]=this[_0xe10c('0x12')][_0x1ef46a[_0xe10c('0x32')]][_0xe10c('0x4b')];this[_0xe10c('0x12')][_0x1ef46a['uniqueid']]=this['channels'][this[_0xe10c('0x14')][_0x1ef46a[_0xe10c('0x46')]][_0xe10c('0x32')]];delete this[_0xe10c('0x12')][this['blindTransfers'][_0x1ef46a[_0xe10c('0x46')]][_0xe10c('0x32')]];}}if(this['channels'][_0x1ef46a[_0xe10c('0x32')]]){logger[_0xe10c('0x27')](_0xe10c('0x91'),_0x1ef46a[_0xe10c('0x32')],_0x1ef46a[_0xe10c('0x92')]);var _0x3fdc3a=moment();this[_0xe10c('0x12')][_0x1ef46a[_0xe10c('0x32')]][_0xe10c('0x93')]=_0x3fdc3a[_0xe10c('0x3f')]('YYYY-MM-DD\x20HH:mm:ss');this['channels'][_0x1ef46a['uniqueid']][_0xe10c('0x55')]=_0x3fdc3a[_0xe10c('0x66')](this[_0xe10c('0x12')][_0x1ef46a[_0xe10c('0x32')]]['starttime'],_0xe10c('0x56'));if(this[_0xe10c('0x12')][_0x1ef46a[_0xe10c('0x32')]][_0xe10c('0x5f')]){this[_0xe10c('0x12')][_0x1ef46a[_0xe10c('0x32')]][_0xe10c('0x94')]=_0x3fdc3a[_0xe10c('0x66')](this['channels'][_0x1ef46a['uniqueid']]['answertime'],_0xe10c('0x56'));this[_0xe10c('0x12')][_0x1ef46a[_0xe10c('0x32')]]['holdtime']=this['channels'][_0x1ef46a['uniqueid']][_0xe10c('0x55')]-this[_0xe10c('0x12')][_0x1ef46a['uniqueid']][_0xe10c('0x94')];}if(_0x1ef46a['context']===_0xe10c('0x3a')){if(this[_0xe10c('0x13')][_0x1ef46a['channel'][_0xe10c('0x3b')]('-')[0x0]]){this[_0xe10c('0x13')][_0x1ef46a[_0xe10c('0x3c')][_0xe10c('0x3b')]('-')[0x0]]=_[_0xe10c('0x95')](this[_0xe10c('0x13')][_0x1ef46a[_0xe10c('0x3c')][_0xe10c('0x3b')]('-')[0x0]],['destconnectedlinenum']);logger[_0xe10c('0x43')]('[%s][voiceCallReport][hangup]\x20sending\x20user:agentcomplete\x20event:',_0x1ef46a['uniqueid'],util[_0xe10c('0x2c')]({'id':this['agents'][_0x1ef46a['channel'][_0xe10c('0x3b')]('-')[0x0]]['id'],'destaccountcode':this['agents'][_0x1ef46a[_0xe10c('0x3c')][_0xe10c('0x3b')]('-')[0x0]][_0xe10c('0x4d')]},{'showHidden':![],'depth':null}));this[_0xe10c('0x30')](util['format']('user:%s',this[_0xe10c('0x13')][_0x1ef46a[_0xe10c('0x3c')]['split']('-')[0x0]][_0xe10c('0x41')]),'user:agentcomplete',{'id':this['agents'][_0x1ef46a[_0xe10c('0x3c')][_0xe10c('0x3b')]('-')[0x0]]['id'],'destaccountcode':this[_0xe10c('0x13')][_0x1ef46a[_0xe10c('0x3c')][_0xe10c('0x3b')]('-')[0x0]][_0xe10c('0x4d')]});for(var _0x3724e9=0x0;_0x3724e90x0?_0x37a488:0x0;this['voiceQueues'][_0x1b8773['queue']][_0x37f1('0x36')]=this[_0x37f1('0x14')][_0x1b8773[_0x37f1('0x66')]][_0x37f1('0x36')]>_['toNumber'](_0x1b8773['loggedin'])?_[_0x37f1('0x6d')](_0x1b8773[_0x37f1('0x6e')]):this[_0x37f1('0x14')][_0x1b8773['queue']][_0x37f1('0x36')];this['emitVoiceQueueSummary'](this[_0x37f1('0x14')][_0x1b8773[_0x37f1('0x66')]],'queuesummary');}logger[_0x37f1('0x47')](_0x37f1('0x6f'),util['inspect'](this[_0x37f1('0x14')][_0x1b8773[_0x37f1('0x66')]],{'showHidden':![],'depth':null}));ami[_0x37f1('0x45')](_0x37f1('0x70'),this[_0x37f1('0x14')][_0x1b8773[_0x37f1('0x66')]]);}}}catch(_0x406839){logger[_0x37f1('0x3f')](_0x37f1('0x71'),util[_0x37f1('0x3e')](_0x406839,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x37f1('0xb')][_0x37f1('0x1c')]=function(_0x4fc57b){logger[_0x37f1('0x47')](_0x37f1('0x72'),util[_0x37f1('0x3e')](_0x4fc57b,{'showHidden':![],'depth':null}));this[_0x37f1('0x15')]=!![];};VoiceQueueReport['prototype'][_0x37f1('0x1e')]=function(_0x172aa4){try{if(this['isNotNull'](_0x172aa4)){logger[_0x37f1('0x47')](_0x37f1('0x73'),_0x172aa4[_0x37f1('0x4a')],util[_0x37f1('0x3e')](_0x172aa4,{'showHidden':![],'depth':null}));if(_[_0x37f1('0x61')](this['queueReports'][_0x172aa4[_0x37f1('0x4a')]]))this['queueReports'][_0x172aa4[_0x37f1('0x4a')]]=[];if(_[_0x37f1('0x61')](this[_0x37f1('0x12')][_0x172aa4[_0x37f1('0x4a')]]))this[_0x37f1('0x12')][_0x172aa4[_0x37f1('0x4a')]]={};var _0x12a32c=new QueueReport();_0x12a32c[_0x37f1('0x4e')]=_0x172aa4[_0x37f1('0x66')];_0x12a32c[_0x37f1('0x51')]=this['voiceQueues'][_0x12a32c[_0x37f1('0x4e')]]&&this[_0x37f1('0x14')][_0x12a32c[_0x37f1('0x4e')]][_0x37f1('0x51')]?this['voiceQueues'][_0x12a32c['name']][_0x37f1('0x51')]||_0x37f1('0x52'):_0x37f1('0x52');_0x12a32c[_0x37f1('0x66')]=_0x172aa4[_0x37f1('0x66')];_0x12a32c['queuecallerjoinAt']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x12a32c[_0x37f1('0x74')]=_0x172aa4[_0x37f1('0x74')];_0x12a32c[_0x37f1('0x75')]=_0x172aa4[_0x37f1('0x75')];_0x12a32c[_0x37f1('0x4a')]=_0x172aa4[_0x37f1('0x4a')];_0x12a32c[_0x37f1('0x76')]=this[_0x37f1('0x12')][_0x172aa4['uniqueid']][_0x37f1('0x76')];logger['info'](_0x37f1('0x77'),_0x12a32c[_0x37f1('0x4e')],_0x12a32c[_0x37f1('0x51')]);_[_0x37f1('0x78')](_0x12a32c,_['pick'](_0x172aa4,_[_0x37f1('0x79')](_0x12a32c)));this[_0x37f1('0x10')][_0x172aa4[_0x37f1('0x4a')]][_0x37f1('0x7a')](_0x12a32c);this['channels'][_0x172aa4[_0x37f1('0x4a')]]=_0x12a32c;this[_0x37f1('0x46')](_0x12a32c,_0x37f1('0x1d'));}}catch(_0x58c7b6){logger['error'](_0x37f1('0x73'),_0x172aa4['uniqueid'],util[_0x37f1('0x3e')](_0x58c7b6,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x37f1('0xb')]['syncQueueCallerAbandon']=function(_0x444ab4){try{if(this[_0x37f1('0x60')](_0x444ab4)){logger['debug'](_0x37f1('0x7b'),_0x444ab4[_0x37f1('0x4a')],util[_0x37f1('0x3e')](_0x444ab4,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x444ab4[_0x37f1('0x4a')]]){var _0x383f6e=_[_0x37f1('0x7c')](this[_0x37f1('0x10')][_0x444ab4[_0x37f1('0x4a')]]);_0x383f6e['queuecallercomplete']=![];_0x383f6e[_0x37f1('0x7d')]=null;_0x383f6e[_0x37f1('0x7e')]=_0x444ab4[_0x37f1('0x7e')];_0x383f6e['originalposition']=_0x444ab4[_0x37f1('0x7f')];_0x383f6e['queuecallerabandon']=!![];_0x383f6e[_0x37f1('0x80')]=moment()[_0x37f1('0x5e')](_0x37f1('0x81'));_0x383f6e[_0x37f1('0x82')]=_0x37f1('0x83');_0x383f6e['lastAssignedTo']=null;logger[_0x37f1('0x68')](_0x37f1('0x84'),_0x383f6e[_0x37f1('0x4e')],_0x383f6e['type']);this[_0x37f1('0x12')][_0x444ab4[_0x37f1('0x4a')]]=_0x383f6e;this[_0x37f1('0x43')](_0x383f6e,_0x37f1('0x1f'));}}}catch(_0x217300){logger[_0x37f1('0x3f')](_0x37f1('0x7b'),_0x444ab4['uniqueid'],util[_0x37f1('0x3e')](_0x217300,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x37f1('0xb')][_0x37f1('0x21')]=function(_0x3fef57){try{if(this[_0x37f1('0x60')](_0x3fef57)){logger[_0x37f1('0x47')](_0x37f1('0x85'),_0x3fef57[_0x37f1('0x4a')],util['inspect'](_0x3fef57,{'showHidden':![],'depth':null}));if(this[_0x37f1('0x10')][_0x3fef57[_0x37f1('0x4a')]]){var _0x48357b=_[_0x37f1('0x7c')](this['queueReports'][_0x3fef57['uniqueid']]);_0x48357b[_0x37f1('0x86')]=moment()['format'](_0x37f1('0x81'));_0x48357b['connectedlinenum']=_0x3fef57[_0x37f1('0x87')];_0x48357b['connectedlinename']=_0x3fef57[_0x37f1('0x88')];logger[_0x37f1('0x68')](_0x37f1('0x89'),_0x48357b['name'],_0x48357b[_0x37f1('0x51')],_0x3fef57['connectedlinenum'],_0x3fef57['connectedlinename']);this[_0x37f1('0x12')][_0x3fef57[_0x37f1('0x4a')]]=_0x48357b;this['emitVoiceQueueChannelSave'](_0x48357b,_0x37f1('0x20'));}}}catch(_0x27f6d4){logger[_0x37f1('0x3f')](_0x37f1('0x85'),_0x3fef57[_0x37f1('0x4a')],util[_0x37f1('0x3e')](_0x27f6d4,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x37f1('0xb')]['syncAgentConnect']=function(_0x3c4d17){try{if(this[_0x37f1('0x60')](_0x3c4d17)){logger[_0x37f1('0x47')](_0x37f1('0x8a'),_0x3c4d17['uniqueid'],util['inspect'](_0x3c4d17,{'showHidden':![],'depth':null}));if(this[_0x37f1('0x10')][_0x3c4d17['uniqueid']]){var _0x35b6f6=_[_0x37f1('0x7c')](this[_0x37f1('0x10')][_0x3c4d17['uniqueid']]);_0x35b6f6['queuecallercomplete']=!![];_0x35b6f6[_0x37f1('0x82')]=_0x37f1('0x8b');logger[_0x37f1('0x68')](_0x37f1('0x8c'),_0x35b6f6[_0x37f1('0x4e')],_0x35b6f6[_0x37f1('0x51')]);}}}catch(_0x1a9bce){logger[_0x37f1('0x3f')](_0x37f1('0x8a'),_0x3c4d17['uniqueid'],util[_0x37f1('0x3e')](_0x1a9bce,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x37f1('0x23')]=function(_0x1ebefe){try{if(this[_0x37f1('0x60')](_0x1ebefe)){logger[_0x37f1('0x47')](_0x37f1('0x8d'),_0x1ebefe[_0x37f1('0x4a')],util[_0x37f1('0x3e')](_0x1ebefe,{'showHidden':![],'depth':null}));if(this[_0x37f1('0x10')][_0x1ebefe[_0x37f1('0x4a')]]){var _0x331bb7=_['last'](this['queueReports'][_0x1ebefe['uniqueid']]);_0x331bb7[_0x37f1('0x1f')]=![];_0x331bb7['queuecallerabandonAt']=null;_0x331bb7[_0x37f1('0x8e')]=!![];_0x331bb7[_0x37f1('0x8f')]=_0x1ebefe[_0x37f1('0x90')];_0x331bb7[_0x37f1('0x7e')]=_0x1ebefe['holdtime'];_0x331bb7[_0x37f1('0x91')]=!![];_0x331bb7['queuecallerexit']=![];_0x331bb7['queuecallerexitAt']=null;if(!_0x331bb7[_0x37f1('0x92')]){if(_0x1ebefe[_0x37f1('0x93')]=='transfer'){_0x331bb7[_0x37f1('0x82')]=_0x37f1('0x94');logger['info']('[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETED',_0x331bb7['name'],_0x331bb7[_0x37f1('0x51')]);}else{if(_[_0x37f1('0x95')](_0x1ebefe[_0x37f1('0x3b')]['toLowerCase'](),_0x37f1('0x96'))){if(this[_0x37f1('0x10')][_0x1ebefe[_0x37f1('0x97')]]){var _0x2d2822=_[_0x37f1('0x7c')](this[_0x37f1('0x10')][_0x1ebefe['linkedid']]);_0x2d2822[_0x37f1('0x91')]=![];_0x2d2822['queuecallerexit']=!![];_0x2d2822[_0x37f1('0x98')]=moment(_0x331bb7[_0x37f1('0x99')])['add'](_0x1ebefe['holdtime'],'seconds')[_0x37f1('0x5e')]('YYYY-MM-DD\x20HH:mm:ss');_0x2d2822['queuecallerexitreason']=_0x37f1('0x9a');_0x2d2822[_0x37f1('0x92')]=!![];_0x2d2822[_0x37f1('0x9b')]=_0x37f1('0x9c');_0x2d2822[_0x37f1('0x9d')]=_0x1ebefe[_0x37f1('0x9e')];_0x2d2822[_0x37f1('0x9f')]=_0x1ebefe[_0x37f1('0x4a')];logger[_0x37f1('0x68')](_0x37f1('0xa0'),_0x2d2822['name'],_0x2d2822[_0x37f1('0x51')]);var _0x188088=this[_0x37f1('0x10')][_0x1ebefe[_0x37f1('0x97')]];this[_0x37f1('0x10')][_0x1ebefe['linkedid']]=this[_0x37f1('0x10')][_0x1ebefe['uniqueid']];this[_0x37f1('0x10')][_0x1ebefe['uniqueid']]=_0x188088;}}else{_0x331bb7[_0x37f1('0x82')]='COMPLETEDBY'+_0x1ebefe['reason']['toUpperCase']();logger[_0x37f1('0x68')]('[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:%s',_0x331bb7[_0x37f1('0x4e')],_0x331bb7[_0x37f1('0x51')],_0x331bb7[_0x37f1('0x82')]);}}}this[_0x37f1('0x12')][_0x1ebefe['uniqueid']]=_0x331bb7;this[_0x37f1('0x43')](_0x331bb7,_0x37f1('0x22'));}}}catch(_0x32ab50){logger[_0x37f1('0x3f')](_0x37f1('0x8d'),_0x1ebefe['uniqueid'],util['inspect'](_0x32ab50,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x37f1('0xb')][_0x37f1('0x26')]=function(_0x2933be){try{if(this[_0x37f1('0x60')](_0x2933be)){logger[_0x37f1('0x47')]('[%s][voiceQueueReport][varset]',_0x2933be[_0x37f1('0x4a')],util['inspect'](_0x2933be,{'showHidden':![],'depth':null}));this[_0x37f1('0xa1')](_0x2933be[_0x37f1('0x4a')],_[_0x37f1('0x79')](_0x2933be[_0x37f1('0xa2')])[0x0],_0x2933be[_0x37f1('0xa3')]);if(this['queueReports'][_0x2933be['uniqueid']]){var _0x5c8116=_[_0x37f1('0x7c')](this[_0x37f1('0x10')][_0x2933be[_0x37f1('0x4a')]]);if(_0x5c8116){if(this[_0x37f1('0x60')](_0x2933be[_0x37f1('0xa2')])&&this['isNotNull'](_0x2933be[_0x37f1('0xa2')][_0x37f1('0xa4')])){switch(_0x2933be[_0x37f1('0xa3')]){case'CONTINUE':_0x5c8116[_0x37f1('0xa5')]=![];_0x5c8116[_0x37f1('0x98')]=null;break;case _0x37f1('0xa6'):_0x5c8116['lastevent']=_0x37f1('0xa7');_0x5c8116['queuecallerexit']=!![];_0x5c8116[_0x37f1('0x98')]=moment()[_0x37f1('0x5e')](_0x37f1('0x81'));_0x5c8116[_0x37f1('0x86')]=moment()['format'](_0x37f1('0x81'));logger[_0x37f1('0x47')](_0x37f1('0xa8'),_0x2933be[_0x37f1('0x4a')],util['inspect'](_0x5c8116,{'showHidden':![],'depth':null}));ami[_0x37f1('0x45')]('custom:timeout',_0x5c8116);break;default:_0x5c8116[_0x37f1('0xa5')]=!![];_0x5c8116[_0x37f1('0x98')]=moment()[_0x37f1('0x5e')](_0x37f1('0x81'));_0x5c8116['queuecallerleaveAt']=moment()[_0x37f1('0x5e')](_0x37f1('0x81'));}_0x5c8116['queuecallerabandon']=![];_0x5c8116['queuecallerabandonAt']=null;_0x5c8116['queuecallerexitreason']=_0x2933be['value'];this[_0x37f1('0x12')][_0x2933be[_0x37f1('0x4a')]]=_0x5c8116;this['emitVoiceQueueChannelRemove'](_0x5c8116,_0x37f1('0x25'));}else if(this['isNotNull'](_0x2933be[_0x37f1('0xa2')])&&this['isNotNull'](_0x2933be[_0x37f1('0xa2')][_0x37f1('0xa9')])){if(!_0x5c8116['queuecallerabandon']){_0x5c8116[_0x37f1('0xa5')]=!![];_0x5c8116[_0x37f1('0x98')]=moment()[_0x37f1('0x5e')](_0x37f1('0x81'));_0x5c8116[_0x37f1('0x82')]=_0x37f1('0xaa');_0x5c8116[_0x37f1('0x86')]=moment()[_0x37f1('0x5e')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x37f1('0x12')][_0x2933be['uniqueid']]=_0x5c8116;}}logger[_0x37f1('0x68')]('[%s][voiceQueueReport][varset]\x20name:%s\x20type:%s\x20variable:%s\x20value:%s',_0x2933be['uniqueid'],_0x5c8116[_0x37f1('0x4e')],_0x5c8116[_0x37f1('0x51')],_['keys'](_0x2933be[_0x37f1('0xa2')])[0x0],_0x2933be[_0x37f1('0xa3')]);_0x5c8116[_0x37f1('0x17')]=this[_0x37f1('0x17')][_0x2933be[_0x37f1('0x4a')]];}}}}catch(_0x9cbc07){logger[_0x37f1('0x3f')](_0x37f1('0xab'),_0x2933be[_0x37f1('0x4a')],util[_0x37f1('0x3e')](_0x9cbc07,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x37f1('0xa1')]=function(_0x4caf60,_0x28270d,_0x560a9f){var _0x1a936e=[_0x37f1('0xac'),_0x37f1('0xad'),'rtpaudioqosjitter',_0x37f1('0xae'),_0x37f1('0xaf'),_0x37f1('0xb0'),_0x37f1('0xb1'),_0x37f1('0xb2'),_0x37f1('0xb3'),'sipuri',_0x37f1('0xb4'),_0x37f1('0xb5'),_0x37f1('0xb6'),_0x37f1('0xb7'),_0x37f1('0xb8'),_0x37f1('0xb9'),_0x37f1('0x90'),_0x37f1('0xba'),'memberrealtime'];if(!_[_0x37f1('0xbb')](_0x28270d)&&!_[_0x37f1('0xbc')](_0x1a936e,_0x28270d)){if(_[_0x37f1('0x61')](this[_0x37f1('0x17')][_0x4caf60])){this[_0x37f1('0x17')][_0x4caf60]={};}this[_0x37f1('0x17')][_0x4caf60][_0x28270d]=_0x560a9f;}};VoiceQueueReport['prototype'][_0x37f1('0xbd')]=function(_0x5474fb){try{if(this[_0x37f1('0x60')](_0x5474fb)){logger[_0x37f1('0x47')](_0x37f1('0xbe'),_0x5474fb[_0x37f1('0x4a')],util['inspect'](_0x5474fb,{'showHidden':![],'depth':null}));if(this[_0x37f1('0x10')][_0x5474fb[_0x37f1('0x4a')]]){for(var _0x2ad484=0x0,_0x36f739={};_0x2ad4840x0?_0x54e856:0x0;this[_0xa24c('0x10')][_0x133567['queue']][_0xa24c('0x6a')]=this[_0xa24c('0x10')][_0x133567[_0xa24c('0x62')]]['talking']>_[_0xa24c('0x68')](_0x133567['loggedin'])?_[_0xa24c('0x68')](_0x133567[_0xa24c('0x6b')]):this[_0xa24c('0x10')][_0x133567['queue']][_0xa24c('0x6a')];this['emitVoiceQueueSummary'](this[_0xa24c('0x10')][_0x133567[_0xa24c('0x62')]],'queuesummary');}logger[_0xa24c('0x42')](_0xa24c('0x6c'),util['inspect'](this[_0xa24c('0x10')][_0x133567[_0xa24c('0x62')]],{'showHidden':![],'depth':null}));ami[_0xa24c('0x40')](_0xa24c('0x6d'),this[_0xa24c('0x10')][_0x133567[_0xa24c('0x62')]]);}}}catch(_0x3c98bb){logger[_0xa24c('0x37')]('[voiceQueueReport][queuesummary]',util['inspect'](_0x3c98bb,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xa24c('0x2d')]['syncQueueSummaryComplete']=function(_0x3d0174){logger[_0xa24c('0x42')]('[voiceQueueReport][queuesummarycomplete]\x20event:',util['inspect'](_0x3d0174,{'showHidden':![],'depth':null}));this['flagQueueSummary']=!![];};VoiceQueueReport[_0xa24c('0x2d')][_0xa24c('0x19')]=function(_0x3e3898){try{if(this[_0xa24c('0x61')](_0x3e3898)){logger[_0xa24c('0x42')](_0xa24c('0x6e'),_0x3e3898[_0xa24c('0x45')],util[_0xa24c('0x38')](_0x3e3898,{'showHidden':![],'depth':null}));if(_[_0xa24c('0x5e')](this['queueReports'][_0x3e3898['uniqueid']]))this['queueReports'][_0x3e3898[_0xa24c('0x45')]]=[];if(_['isUndefined'](this[_0xa24c('0xe')][_0x3e3898['uniqueid']]))this[_0xa24c('0xe')][_0x3e3898[_0xa24c('0x45')]]={};var _0x4d57e3=new QueueReport();_0x4d57e3[_0xa24c('0x47')]=_0x3e3898[_0xa24c('0x62')];_0x4d57e3[_0xa24c('0x4e')]=this[_0xa24c('0x10')][_0x4d57e3['name']]&&this[_0xa24c('0x10')][_0x4d57e3[_0xa24c('0x47')]][_0xa24c('0x4e')]?this[_0xa24c('0x10')][_0x4d57e3[_0xa24c('0x47')]][_0xa24c('0x4e')]||'inbound':'inbound';_0x4d57e3[_0xa24c('0x62')]=_0x3e3898[_0xa24c('0x62')];_0x4d57e3[_0xa24c('0x6f')]=moment()[_0xa24c('0x46')](_0xa24c('0x70'));_0x4d57e3[_0xa24c('0x71')]=_0x3e3898[_0xa24c('0x71')];_0x4d57e3['count']=_0x3e3898[_0xa24c('0x72')];_0x4d57e3['uniqueid']=_0x3e3898[_0xa24c('0x45')];_0x4d57e3['routealias']=this[_0xa24c('0xe')][_0x3e3898[_0xa24c('0x45')]][_0xa24c('0x73')];logger[_0xa24c('0x64')](_0xa24c('0x74'),_0x4d57e3[_0xa24c('0x47')],_0x4d57e3[_0xa24c('0x4e')]);_[_0xa24c('0x75')](_0x4d57e3,_[_0xa24c('0x76')](_0x3e3898,_[_0xa24c('0x77')](_0x4d57e3)));this[_0xa24c('0xc')][_0x3e3898[_0xa24c('0x45')]][_0xa24c('0x78')](_0x4d57e3);this[_0xa24c('0xe')][_0x3e3898[_0xa24c('0x45')]]=_0x4d57e3;this[_0xa24c('0x41')](_0x4d57e3,_0xa24c('0x18'));}}catch(_0x3215af){logger[_0xa24c('0x37')](_0xa24c('0x6e'),_0x3e3898[_0xa24c('0x45')],util[_0xa24c('0x38')](_0x3215af,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xa24c('0x2d')][_0xa24c('0x79')]=function(_0x387296){try{if(this[_0xa24c('0x61')](_0x387296)){logger[_0xa24c('0x42')](_0xa24c('0x7a'),_0x387296[_0xa24c('0x45')],util['inspect'](_0x387296,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x387296[_0xa24c('0x45')]]){var _0x5806d6=_['last'](this[_0xa24c('0xc')][_0x387296[_0xa24c('0x45')]]);_0x5806d6[_0xa24c('0x7b')]=![];_0x5806d6['queuecallercompleteAt']=null;_0x5806d6[_0xa24c('0x7c')]=_0x387296[_0xa24c('0x7c')];_0x5806d6['originalposition']=_0x387296['originalposition'];_0x5806d6[_0xa24c('0x1a')]=!![];_0x5806d6[_0xa24c('0x7d')]=moment()[_0xa24c('0x46')]('YYYY-MM-DD\x20HH:mm:ss');_0x5806d6['queuecallerexitreason']=_0xa24c('0x7e');_0x5806d6[_0xa24c('0x7f')]=null;logger['info'](_0xa24c('0x80'),_0x5806d6['name'],_0x5806d6[_0xa24c('0x4e')]);this[_0xa24c('0xe')][_0x387296[_0xa24c('0x45')]]=_0x5806d6;this[_0xa24c('0x3e')](_0x5806d6,'queuecallerabandon');}}}catch(_0x23b61f){logger[_0xa24c('0x37')]('[%s][voiceQueueReport][queuecallerabandon]',_0x387296[_0xa24c('0x45')],util[_0xa24c('0x38')](_0x23b61f,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xa24c('0x2d')]['syncQueueCallerLeave']=function(_0x6cd71f){try{if(this[_0xa24c('0x61')](_0x6cd71f)){logger[_0xa24c('0x42')](_0xa24c('0x81'),_0x6cd71f['uniqueid'],util['inspect'](_0x6cd71f,{'showHidden':![],'depth':null}));if(this[_0xa24c('0xc')][_0x6cd71f[_0xa24c('0x45')]]){var _0x26df19=_[_0xa24c('0x82')](this[_0xa24c('0xc')][_0x6cd71f[_0xa24c('0x45')]]);_0x26df19['queuecallerleaveAt']=moment()[_0xa24c('0x46')](_0xa24c('0x70'));_0x26df19['connectedlinenum']=_0x6cd71f[_0xa24c('0x83')];_0x26df19['connectedlinename']=_0x6cd71f['connectedlinename'];logger[_0xa24c('0x64')]('[voiceQueueReport][queuecallerleave]\x20name:%s\x20type:%s\x20connectedlinenum:%s\x20connectedlinename:%s',_0x26df19[_0xa24c('0x47')],_0x26df19[_0xa24c('0x4e')],_0x6cd71f[_0xa24c('0x83')],_0x6cd71f[_0xa24c('0x84')]);this[_0xa24c('0xe')][_0x6cd71f[_0xa24c('0x45')]]=_0x26df19;this[_0xa24c('0x41')](_0x26df19,'queuecallerleave');}}}catch(_0x2a7598){logger[_0xa24c('0x37')]('[%s][voiceQueueReport][queuecallerleave]',_0x6cd71f[_0xa24c('0x45')],util[_0xa24c('0x38')](_0x2a7598,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xa24c('0x2d')][_0xa24c('0x85')]=function(_0x3025f4){try{if(this[_0xa24c('0x61')](_0x3025f4)){logger[_0xa24c('0x42')](_0xa24c('0x86'),_0x3025f4[_0xa24c('0x45')],util[_0xa24c('0x38')](_0x3025f4,{'showHidden':![],'depth':null}));if(this[_0xa24c('0xc')][_0x3025f4[_0xa24c('0x45')]]){var _0x237aae=_['last'](this[_0xa24c('0xc')][_0x3025f4[_0xa24c('0x45')]]);_0x237aae['queuecallercomplete']=!![];_0x237aae['queuecallerexitreason']=_0xa24c('0x87');logger['info']('[voiceQueueReport][agentconnect]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETEDBYAGENT',_0x237aae[_0xa24c('0x47')],_0x237aae['type']);}}}catch(_0x5100ed){logger[_0xa24c('0x37')](_0xa24c('0x86'),_0x3025f4[_0xa24c('0x45')],util[_0xa24c('0x38')](_0x5100ed,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xa24c('0x2d')][_0xa24c('0x88')]=function(_0x4eef23){try{if(this[_0xa24c('0x61')](_0x4eef23)){logger[_0xa24c('0x42')](_0xa24c('0x89'),_0x4eef23[_0xa24c('0x45')],util[_0xa24c('0x38')](_0x4eef23,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x4eef23[_0xa24c('0x45')]]){var _0x960fe3=_['last'](this[_0xa24c('0xc')][_0x4eef23[_0xa24c('0x45')]]);_0x960fe3[_0xa24c('0x1a')]=![];_0x960fe3[_0xa24c('0x7d')]=null;_0x960fe3[_0xa24c('0x8a')]=!![];_0x960fe3[_0xa24c('0x7f')]=_0x4eef23[_0xa24c('0x8b')];_0x960fe3[_0xa24c('0x7c')]=_0x4eef23[_0xa24c('0x7c')];_0x960fe3['queuecallercomplete']=!![];_0x960fe3[_0xa24c('0x8c')]=![];_0x960fe3['queuecallerexitAt']=null;if(!_0x960fe3[_0xa24c('0x8d')]){if(_0x4eef23['reason']==_0xa24c('0x8d')){_0x960fe3[_0xa24c('0x8e')]='COMPLETED';logger['info'](_0xa24c('0x8f'),_0x960fe3[_0xa24c('0x47')],_0x960fe3[_0xa24c('0x4e')]);}else{if(_[_0xa24c('0x90')](_0x4eef23[_0xa24c('0x33')][_0xa24c('0x91')](),_0xa24c('0x92'))){if(this[_0xa24c('0xc')][_0x4eef23['linkedid']]){var _0xafd6=_['last'](this['queueReports'][_0x4eef23[_0xa24c('0x93')]]);_0xafd6[_0xa24c('0x7b')]=![];_0xafd6[_0xa24c('0x8c')]=!![];_0xafd6[_0xa24c('0x94')]=moment(_0x960fe3[_0xa24c('0x6f')])[_0xa24c('0x95')](_0x4eef23[_0xa24c('0x7c')],_0xa24c('0x96'))[_0xa24c('0x46')](_0xa24c('0x70'));_0xafd6[_0xa24c('0x8e')]=_0xa24c('0x97');_0xafd6[_0xa24c('0x8d')]=!![];_0xafd6[_0xa24c('0x98')]=_0xa24c('0x99');_0xafd6[_0xa24c('0x9a')]=_0x4eef23[_0xa24c('0x9b')];_0xafd6[_0xa24c('0x9c')]=_0x4eef23[_0xa24c('0x45')];logger[_0xa24c('0x64')]('[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:FORWARDTRANSFER',_0xafd6[_0xa24c('0x47')],_0xafd6[_0xa24c('0x4e')]);var _0x17850a=this[_0xa24c('0xc')][_0x4eef23[_0xa24c('0x93')]];this[_0xa24c('0xc')][_0x4eef23[_0xa24c('0x93')]]=this[_0xa24c('0xc')][_0x4eef23[_0xa24c('0x45')]];this[_0xa24c('0xc')][_0x4eef23[_0xa24c('0x45')]]=_0x17850a;}}else{_0x960fe3[_0xa24c('0x8e')]=_0xa24c('0x9d')+_0x4eef23[_0xa24c('0x9e')][_0xa24c('0x9f')]();logger[_0xa24c('0x64')](_0xa24c('0xa0'),_0x960fe3[_0xa24c('0x47')],_0x960fe3[_0xa24c('0x4e')],_0x960fe3[_0xa24c('0x8e')]);}}}this['channels'][_0x4eef23[_0xa24c('0x45')]]=_0x960fe3;this[_0xa24c('0x3e')](_0x960fe3,_0xa24c('0x1c'));}}}catch(_0x4d3e75){logger[_0xa24c('0x37')](_0xa24c('0x89'),_0x4eef23['uniqueid'],util['inspect'](_0x4d3e75,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xa24c('0x2d')][_0xa24c('0x1e')]=function(_0x11107a){try{if(this[_0xa24c('0x61')](_0x11107a)){logger[_0xa24c('0x42')]('[%s][voiceQueueReport][varset]',_0x11107a[_0xa24c('0x45')],util[_0xa24c('0x38')](_0x11107a,{'showHidden':![],'depth':null}));this[_0xa24c('0xa1')](_0x11107a[_0xa24c('0x45')],_['keys'](_0x11107a['variable'])[0x0],_0x11107a['value']);if(this[_0xa24c('0xc')][_0x11107a[_0xa24c('0x45')]]){var _0x49a71b=_[_0xa24c('0x82')](this['queueReports'][_0x11107a[_0xa24c('0x45')]]);if(_0x49a71b){if(this['isNotNull'](_0x11107a[_0xa24c('0xa2')])&&this[_0xa24c('0x61')](_0x11107a[_0xa24c('0xa2')][_0xa24c('0xa3')])){switch(_0x11107a['value']){case _0xa24c('0xa4'):_0x49a71b[_0xa24c('0x8c')]=![];_0x49a71b[_0xa24c('0x94')]=null;break;case _0xa24c('0xa5'):_0x49a71b['lastevent']=_0xa24c('0xa6');_0x49a71b['queuecallerexit']=!![];_0x49a71b[_0xa24c('0x94')]=moment()['format'](_0xa24c('0x70'));_0x49a71b[_0xa24c('0xa7')]=moment()[_0xa24c('0x46')](_0xa24c('0x70'));logger[_0xa24c('0x42')](_0xa24c('0xa8'),_0x11107a[_0xa24c('0x45')],util[_0xa24c('0x38')](_0x49a71b,{'showHidden':![],'depth':null}));ami[_0xa24c('0x40')]('custom:timeout',_0x49a71b);break;default:_0x49a71b[_0xa24c('0x8c')]=!![];_0x49a71b[_0xa24c('0x94')]=moment()['format'](_0xa24c('0x70'));_0x49a71b[_0xa24c('0xa7')]=moment()[_0xa24c('0x46')](_0xa24c('0x70'));}_0x49a71b[_0xa24c('0x1a')]=![];_0x49a71b['queuecallerabandonAt']=null;_0x49a71b[_0xa24c('0x8e')]=_0x11107a[_0xa24c('0xa9')];this[_0xa24c('0xe')][_0x11107a[_0xa24c('0x45')]]=_0x49a71b;this[_0xa24c('0x3e')](_0x49a71b,_0xa24c('0xaa'));}else if(this[_0xa24c('0x61')](_0x11107a[_0xa24c('0xa2')])&&this[_0xa24c('0x61')](_0x11107a[_0xa24c('0xa2')]['queueposition'])){if(!_0x49a71b[_0xa24c('0x1a')]){_0x49a71b[_0xa24c('0x8c')]=!![];_0x49a71b['queuecallerexitAt']=moment()[_0xa24c('0x46')](_0xa24c('0x70'));_0x49a71b['queuecallerexitreason']=_0xa24c('0xab');_0x49a71b[_0xa24c('0xa7')]=moment()['format'](_0xa24c('0x70'));this['channels'][_0x11107a[_0xa24c('0x45')]]=_0x49a71b;}}logger[_0xa24c('0x64')](_0xa24c('0xac'),_0x11107a[_0xa24c('0x45')],_0x49a71b['name'],_0x49a71b[_0xa24c('0x4e')],_[_0xa24c('0x77')](_0x11107a['variable'])[0x0],_0x11107a[_0xa24c('0xa9')]);_0x49a71b['variables']=this['variables'][_0x11107a[_0xa24c('0x45')]];}}}}catch(_0x534472){logger[_0xa24c('0x37')](_0xa24c('0xad'),_0x11107a[_0xa24c('0x45')],util[_0xa24c('0x38')](_0x534472,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xa24c('0x2d')]['addVariable']=function(_0x5b3317,_0x212b92,_0xd20364){var _0x363d79=['rtpaudioqos','rtpaudioqosbridged',_0xa24c('0xae'),_0xa24c('0xaf'),_0xa24c('0xb0'),_0xa24c('0xb1'),'rtpaudioqosrtt',_0xa24c('0xb2'),_0xa24c('0xb3'),_0xa24c('0xb4'),_0xa24c('0xb5'),_0xa24c('0xb6'),_0xa24c('0xb7'),'memberdynamic',_0xa24c('0xb8'),_0xa24c('0xb9'),'membername','memberpenalty',_0xa24c('0xba')];if(!_[_0xa24c('0x30')](_0x212b92)&&!_[_0xa24c('0xbb')](_0x363d79,_0x212b92)){if(_[_0xa24c('0x5e')](this[_0xa24c('0x3a')][_0x5b3317])){this[_0xa24c('0x3a')][_0x5b3317]={};}this[_0xa24c('0x3a')][_0x5b3317][_0x212b92]=_0xd20364;}};VoiceQueueReport[_0xa24c('0x2d')][_0xa24c('0x20')]=function(_0x12eb9e){try{if(this[_0xa24c('0x61')](_0x12eb9e)){logger[_0xa24c('0x42')](_0xa24c('0xbc'),_0x12eb9e['uniqueid'],util[_0xa24c('0x38')](_0x12eb9e,{'showHidden':![],'depth':null}));if(this[_0xa24c('0xc')][_0x12eb9e[_0xa24c('0x45')]]){for(var _0x31ee65=0x0,_0x8473a0={};_0x31ee65=0x0?moment(_0x1b03d9[_0xa6d6('0x1b')])[_0xa6d6('0x10')](_0x1b03d9[_0xa6d6('0x1a')],_0xa6d6('0x11')):null,'data1':_0xa6d6('0x1c'),'data2':_0x1b03d9[_0xa6d6('0x16')],'data3':_0x1b03d9[_0xa6d6('0x14')],'data4':_0x1b03d9['dialstring']||null,'role':'agent','internal':_0x1b03d9[_0xa6d6('0x16')]?_[_0xa6d6('0x1d')](_0x1b03d9[_0xa6d6('0x16')]):undefined,'uniqueid':_0x1b03d9[_0xa6d6('0x17')]},'log':_0xa6d6('0x7')});}; \ No newline at end of file +var _0xf0ff=['queue','agent','accountcode','voiceDialReport','voice','starttime','endtime','diff','uniqueid','lodash','util','../client','voiceQueueReport','queuecallercompleteAt','queuecallerexitAt','Request','CreateMemberReport','interface','format','TALKING','queuecallerleaveAt','seconds','inbound','calleridnum'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf0ff,0x1e9));var _0xff0f=function(_0x4894eb,_0x17f870){_0x4894eb=_0x4894eb-0x0;var _0x4ea63a=_0xf0ff[_0x4894eb];return _0x4ea63a;};'use strict';var moment=require('moment');var _=require(_0xff0f('0x0'));var util=require(_0xff0f('0x1'));var client=require(_0xff0f('0x2'));exports[_0xff0f('0x3')]=function(_0x5e7507){var _0x61fbe8=_0x5e7507[_0xff0f('0x4')]||_0x5e7507[_0xff0f('0x5')];return client[_0xff0f('0x6')](_0xff0f('0x7'),{'body':{'channel':'voice','membername':_0x5e7507['lastAssignedTo'],'interface':_['isNil'](_0x5e7507[_0xff0f('0x8')])?util[_0xff0f('0x9')]('SIP/%s',_0x5e7507['lastAssignedTo']):_0x5e7507[_0xff0f('0x8')],'type':_0xff0f('0xa'),'enterAt':_0x5e7507[_0xff0f('0xb')],'exitAt':_0x61fbe8,'duration':moment(_0x61fbe8)['diff'](_0x5e7507[_0xff0f('0xb')],_0xff0f('0xc')),'data1':_0xff0f('0xd'),'data2':_0x5e7507[_0xff0f('0xe')],'data3':_0x5e7507['exten'],'data4':null,'data5':_0x5e7507[_0xff0f('0xf')],'role':_0xff0f('0x10'),'internal':_0x5e7507[_0xff0f('0x11')]?_['toNumber'](_0x5e7507[_0xff0f('0x11')]):undefined,'uniqueid':_0x5e7507['uniqueid']},'log':_0xff0f('0x7')});};exports[_0xff0f('0x12')]=function(_0x399e49){return client[_0xff0f('0x6')](_0xff0f('0x7'),{'body':{'channel':_0xff0f('0x13'),'membername':_0x399e49['membername'],'interface':_0x399e49[_0xff0f('0x8')],'type':_0xff0f('0xa'),'enterAt':_0x399e49[_0xff0f('0x14')],'exitAt':_0x399e49['endtime'],'duration':moment(_0x399e49[_0xff0f('0x15')])[_0xff0f('0x16')](_0x399e49[_0xff0f('0x14')],_0xff0f('0xc'))>=0x0?moment(_0x399e49[_0xff0f('0x15')])['diff'](_0x399e49[_0xff0f('0x14')],_0xff0f('0xc')):null,'data1':'outbound','data2':_0x399e49[_0xff0f('0x11')],'data3':_0x399e49['exten'],'data4':_0x399e49['dialstring']||null,'role':_0xff0f('0x10'),'internal':_0x399e49[_0xff0f('0x11')]?_['toNumber'](_0x399e49[_0xff0f('0x11')]):undefined,'uniqueid':_0x399e49[_0xff0f('0x17')]},'log':'CreateMemberReport'});}; \ No newline at end of file diff --git a/server/services/ami/rpc/setting.js b/server/services/ami/rpc/setting.js index b7ef726..f1464e3 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 _0xe547=['GetSettings','Request','ShowSetting','stopRecordingOnTransfer','previewRecallmeReminderInterval'];(function(_0x50a0c2,_0x4befab){var _0x5ebadd=function(_0x3a3342){while(--_0x3a3342){_0x50a0c2['push'](_0x50a0c2['shift']());}};_0x5ebadd(++_0x4befab);}(_0xe547,0x191));var _0x7e54=function(_0x16458e,_0x582d57){_0x16458e=_0x16458e-0x0;var _0x25ded1=_0xe547[_0x16458e];return _0x25ded1;};'use strict';var client=require('../client');exports['getSettings']=function(){return client[_0x7e54('0x0')](_0x7e54('0x1'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x7e54('0x2'),_0x7e54('0x3')]},'log':_0x7e54('0x4')});}; \ No newline at end of file +var _0x8048=['ShowSetting','previewRecallmeReminderInterval','GetSettings','getSettings','Request'];(function(_0x50c4eb,_0x5a3123){var _0x1bfa43=function(_0x78880){while(--_0x78880){_0x50c4eb['push'](_0x50c4eb['shift']());}};_0x1bfa43(++_0x5a3123);}(_0x8048,0x166));var _0x8804=function(_0x3554de,_0x1c1680){_0x3554de=_0x3554de-0x0;var _0x469d4b=_0x8048[_0x3554de];return _0x469d4b;};'use strict';var client=require('../client');exports[_0x8804('0x0')]=function(){return client[_0x8804('0x1')](_0x8804('0x2'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':['stopRecordingOnTransfer',_0x8804('0x3')]},'log':_0x8804('0x4')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/template.js b/server/services/ami/rpc/template.js index 541e361..6dfa9a1 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 _0x699c=['html','../client','getTemplates','Request','GetTemplate'];(function(_0x2f6c91,_0x2c5974){var _0x4db01f=function(_0x4ac374){while(--_0x4ac374){_0x2f6c91['push'](_0x2f6c91['shift']());}};_0x4db01f(++_0x2c5974);}(_0x699c,0xdd));var _0xc699=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x699c[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0xc699('0x0'));exports[_0xc699('0x1')]=function(_0x1e9f8a){return function(_0x32d376){return client[_0xc699('0x2')](_0xc699('0x3'),{'options':{'raw':!![],'attributes':['id','name',_0xc699('0x4')]},'log':_0xc699('0x3')});};}; \ No newline at end of file +var _0x8286=['../client','getTemplates','Request','GetTemplate','name','html'];(function(_0x3f9b16,_0x2e96ee){var _0x10354c=function(_0x2025da){while(--_0x2025da){_0x3f9b16['push'](_0x3f9b16['shift']());}};_0x10354c(++_0x2e96ee);}(_0x8286,0x66));var _0x6828=function(_0x1f0842,_0x24d1f8){_0x1f0842=_0x1f0842-0x0;var _0x5dd60f=_0x8286[_0x1f0842];return _0x5dd60f;};'use strict';var client=require(_0x6828('0x0'));exports[_0x6828('0x1')]=function(_0x3859e1){return function(_0x24e248){return client[_0x6828('0x2')](_0x6828('0x3'),{'options':{'raw':!![],'attributes':['id',_0x6828('0x4'),_0x6828('0x5')]},'log':_0x6828('0x3')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trigger.js b/server/services/ami/rpc/trigger.js index 0bb11b6..2e63b06 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 _0x0c72=['operator','value','AnyConditions','Action','Actions','data2','data3','data4','data5','data6','GetTrigger','../client','getTriggers','name','channel','status','Condition','AllConditions','field'];(function(_0x13ed6f,_0x515c3c){var _0x3b42dd=function(_0x570416){while(--_0x570416){_0x13ed6f['push'](_0x13ed6f['shift']());}};_0x3b42dd(++_0x515c3c);}(_0x0c72,0x90));var _0x20c7=function(_0x10a3f9,_0x111203){_0x10a3f9=_0x10a3f9-0x0;var _0x3f68e3=_0x0c72[_0x10a3f9];return _0x3f68e3;};'use strict';var client=require(_0x20c7('0x0'));exports[_0x20c7('0x1')]=function(_0x41e03f){return function(_0x407b2){return client['Request']('GetTrigger',{'options':{'raw':![],'attributes':['id',_0x20c7('0x2'),_0x20c7('0x3'),_0x20c7('0x4')],'include':[{'model':_0x20c7('0x5'),'as':_0x20c7('0x6'),'attributes':['id',_0x20c7('0x7'),_0x20c7('0x8'),_0x20c7('0x9')]},{'model':_0x20c7('0x5'),'as':_0x20c7('0xa'),'attributes':['id',_0x20c7('0x7'),_0x20c7('0x8'),'value']},{'model':_0x20c7('0xb'),'as':_0x20c7('0xc'),'attributes':['id','action','data1',_0x20c7('0xd'),_0x20c7('0xe'),_0x20c7('0xf'),_0x20c7('0x10'),_0x20c7('0x11'),'data7']}]},'log':_0x20c7('0x12')});};}; \ No newline at end of file +var _0x56d6=['Condition','AnyConditions','Action','data1','data2','data3','data5','data7','../client','getTriggers','Request','GetTrigger','name','channel','AllConditions','field','operator','value'];(function(_0x7d0219,_0x407576){var _0xb10a40=function(_0x17fd47){while(--_0x17fd47){_0x7d0219['push'](_0x7d0219['shift']());}};_0xb10a40(++_0x407576);}(_0x56d6,0xf2));var _0x656d=function(_0x44db18,_0x3e9447){_0x44db18=_0x44db18-0x0;var _0x4d4496=_0x56d6[_0x44db18];return _0x4d4496;};'use strict';var client=require(_0x656d('0x0'));exports[_0x656d('0x1')]=function(_0x587681){return function(_0xea740f){return client[_0x656d('0x2')](_0x656d('0x3'),{'options':{'raw':![],'attributes':['id',_0x656d('0x4'),_0x656d('0x5'),'status'],'include':[{'model':'Condition','as':_0x656d('0x6'),'attributes':['id',_0x656d('0x7'),_0x656d('0x8'),_0x656d('0x9')]},{'model':_0x656d('0xa'),'as':_0x656d('0xb'),'attributes':['id',_0x656d('0x7'),'operator',_0x656d('0x9')]},{'model':_0x656d('0xc'),'as':'Actions','attributes':['id','action',_0x656d('0xd'),_0x656d('0xe'),_0x656d('0xf'),'data4',_0x656d('0x10'),'data6',_0x656d('0x11')]}]},'log':_0x656d('0x3')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trunk.js b/server/services/ami/rpc/trunk.js index 37efe83..d0390a1 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 _0xa329=['Request','GetTrunk','name','registry','../client','getTrunks'];(function(_0x47e7cb,_0x4c1b8d){var _0x2a8874=function(_0x36498f){while(--_0x36498f){_0x47e7cb['push'](_0x47e7cb['shift']());}};_0x2a8874(++_0x4c1b8d);}(_0xa329,0x1cc));var _0x9a32=function(_0x26e895,_0x4d25e0){_0x26e895=_0x26e895-0x0;var _0x3dfcf1=_0xa329[_0x26e895];return _0x3dfcf1;};'use strict';var client=require(_0x9a32('0x0'));exports[_0x9a32('0x1')]=function(_0x453268){return function(_0x5ec7fb){return client[_0x9a32('0x2')](_0x9a32('0x3'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0x9a32('0x4'),_0x9a32('0x5'),'defaultuser']},'log':_0x9a32('0x3')});};}; \ No newline at end of file +var _0x34e8=['../client','getTrunks','GetTrunk','name','registry','defaultuser'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x34e8,0x12c));var _0x834e=function(_0x3f809a,_0x7dba1a){_0x3f809a=_0x3f809a-0x0;var _0x10aaa8=_0x34e8[_0x3f809a];return _0x10aaa8;};'use strict';var client=require(_0x834e('0x0'));exports[_0x834e('0x1')]=function(_0x8b339){return function(_0x35e6fb){return client['Request'](_0x834e('0x2'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0x834e('0x3'),_0x834e('0x4'),_0x834e('0x5')]},'log':_0x834e('0x2')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/user.js b/server/services/ami/rpc/user.js index 8468958..33c6454 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 _0x0713=['getAgent','Request','GetUser','agent','name','email','fullname','online','lastLoginAt','pauseType','lastPauseAt','voicePause','phone','mobile','interface','getAgents','getTelephones','accountcode','internal','savePause','PauseUser'];(function(_0x31f99a,_0x60b739){var _0x243036=function(_0x3721f4){while(--_0x3721f4){_0x31f99a['push'](_0x31f99a['shift']());}};_0x243036(++_0x60b739);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var client=require('../client');exports['getAgents']=function(){return function(){return client[_0x3071('0x0')](_0x3071('0x1'),{'options':{'raw':![],'where':{'role':_0x3071('0x2')},'attributes':['id',_0x3071('0x3'),_0x3071('0x4'),'accountcode',_0x3071('0x5'),_0x3071('0x6'),_0x3071('0x7'),_0x3071('0x8'),_0x3071('0x9'),_0x3071('0xa'),_0x3071('0xb'),_0x3071('0xc'),_0x3071('0xd')]},'log':_0x3071('0xe')});};};exports[_0x3071('0xf')]=function(){return function(){return client[_0x3071('0x0')](_0x3071('0x1'),{'options':{'raw':!![],'where':{'role':'telephone'},'attributes':['id',_0x3071('0x3'),_0x3071('0x10'),_0x3071('0x11')]},'log':_0x3071('0xf')});};};exports[_0x3071('0x12')]=function(_0x4a470a,_0x2ace21,_0x11a7ee){return client[_0x3071('0x0')](_0x3071('0x13'),{'body':{'type':_0x2ace21,'uniqueid':_0x11a7ee},'options':{'where':{'id':_0x4a470a['id']}},'log':_0x3071('0x12')});};exports['saveUnpause']=function(_0x5330a8){return client[_0x3071('0x0')]('UnpauseUser',{'body':{},'options':{'where':{'id':_0x5330a8['id']}},'log':_0x3071('0x12')});};exports[_0x3071('0x14')]=function(_0x5d4883){return client[_0x3071('0x0')]('ShowUser',{'options':{'raw':![],'where':{'role':_0x3071('0x2'),'id':_0x5d4883},'attributes':['id',_0x3071('0x3'),_0x3071('0x4'),_0x3071('0x10'),_0x3071('0x5'),_0x3071('0x6'),_0x3071('0x7'),_0x3071('0x8'),_0x3071('0x9'),_0x3071('0xa'),'interface']},'log':_0x3071('0x14')});}; \ No newline at end of file +var _0xa9e0=['agent','lastPauseAt','interface','../client','getAgents','Request','name','accountcode','fullname','online','lastLoginAt','pauseType','voicePause','phone','mobile','getTelephones','telephone','internal','savePause','PauseUser','saveUnpause','UnpauseUser','getAgent','ShowUser'];(function(_0x4b055c,_0x4b870b){var _0x4b62bb=function(_0x4884c2){while(--_0x4884c2){_0x4b055c['push'](_0x4b055c['shift']());}};_0x4b62bb(++_0x4b870b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3e112d,_0x2bb132){_0x3e112d=_0x3e112d-0x0;var _0x531c31=_0xa9e0[_0x3e112d];return _0x531c31;};'use strict';var client=require(_0x0a9e('0x0'));exports[_0x0a9e('0x1')]=function(){return function(){return client[_0x0a9e('0x2')]('GetUser',{'options':{'raw':![],'where':{'role':'agent'},'attributes':['id',_0x0a9e('0x3'),'email',_0x0a9e('0x4'),_0x0a9e('0x5'),_0x0a9e('0x6'),_0x0a9e('0x7'),_0x0a9e('0x8'),'lastPauseAt',_0x0a9e('0x9'),_0x0a9e('0xa'),_0x0a9e('0xb'),'interface']},'log':'getAgents'});};};exports[_0x0a9e('0xc')]=function(){return function(){return client['Request']('GetUser',{'options':{'raw':!![],'where':{'role':_0x0a9e('0xd')},'attributes':['id',_0x0a9e('0x3'),_0x0a9e('0x4'),_0x0a9e('0xe')]},'log':_0x0a9e('0xc')});};};exports[_0x0a9e('0xf')]=function(_0x4a4c56,_0x50dfb2,_0x527cdd){return client['Request'](_0x0a9e('0x10'),{'body':{'type':_0x50dfb2,'uniqueid':_0x527cdd},'options':{'where':{'id':_0x4a4c56['id']}},'log':_0x0a9e('0xf')});};exports[_0x0a9e('0x11')]=function(_0x26d672){return client[_0x0a9e('0x2')](_0x0a9e('0x12'),{'body':{},'options':{'where':{'id':_0x26d672['id']}},'log':'savePause'});};exports[_0x0a9e('0x13')]=function(_0x239b12){return client[_0x0a9e('0x2')](_0x0a9e('0x14'),{'options':{'raw':![],'where':{'role':_0x0a9e('0x15'),'id':_0x239b12},'attributes':['id',_0x0a9e('0x3'),'email',_0x0a9e('0x4'),'fullname',_0x0a9e('0x6'),'lastLoginAt',_0x0a9e('0x8'),_0x0a9e('0x16'),'voicePause',_0x0a9e('0x17')]},'log':'getAgent'});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceAgentReport.js b/server/services/ami/rpc/voiceAgentReport.js index f61456b..d96206d 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 _0x953f=['UpdateVoiceAgentReport','create','Request','CreateVoiceAgentReport','update'];(function(_0x565e84,_0x8321a0){var _0x204b8e=function(_0x3a463a){while(--_0x3a463a){_0x565e84['push'](_0x565e84['shift']());}};_0x204b8e(++_0x8321a0);}(_0x953f,0x155));var _0xf953=function(_0x5c2e3e,_0x26ecd3){_0x5c2e3e=_0x5c2e3e-0x0;var _0x53f64a=_0x953f[_0x5c2e3e];return _0x53f64a;};'use strict';var client=require('../client');exports[_0xf953('0x0')]=function(_0x26f0a4){return client[_0xf953('0x1')](_0xf953('0x2'),{'body':_0x26f0a4,'log':_0xf953('0x2')});};exports[_0xf953('0x3')]=function(_0x5a64c1,_0x3330a3,_0x127b9c){return client[_0xf953('0x1')](_0xf953('0x4'),{'body':_0x5a64c1,'options':{'where':{'uniqueid':_0x3330a3,'interface':_0x127b9c,'agentcomplete':!![]}},'log':_0xf953('0x4')});}; \ No newline at end of file +var _0xceaf=['../client','create','Request','CreateVoiceAgentReport','update','UpdateVoiceAgentReport'];(function(_0x4dab14,_0x164ea0){var _0xf41aa=function(_0x305d50){while(--_0x305d50){_0x4dab14['push'](_0x4dab14['shift']());}};_0xf41aa(++_0x164ea0);}(_0xceaf,0x72));var _0xfcea=function(_0x562197,_0x194fcf){_0x562197=_0x562197-0x0;var _0x2a57be=_0xceaf[_0x562197];return _0x2a57be;};'use strict';var client=require(_0xfcea('0x0'));exports[_0xfcea('0x1')]=function(_0x3ae9e0){return client[_0xfcea('0x2')](_0xfcea('0x3'),{'body':_0x3ae9e0,'log':_0xfcea('0x3')});};exports[_0xfcea('0x4')]=function(_0x14d984,_0x13286f,_0x2049a6){return client[_0xfcea('0x2')](_0xfcea('0x5'),{'body':_0x14d984,'options':{'where':{'uniqueid':_0x13286f,'interface':_0x2049a6,'agentcomplete':!![]}},'log':_0xfcea('0x5')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceCallReport.js b/server/services/ami/rpc/voiceCallReport.js index 7aa01fa..c90ed32 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 _0x590d=['YYYY-MM-DD\x20HH:mm:ss','endOf','type','duration','GetVoiceCallReports','moment','util','lodash','../client','create','CreateVoiceCallReport','merge','calleridnum','context','callerid','DOCUMENTATION','getVoiceCallReports','GetVoiceCallReport','format'];(function(_0xd5f8b7,_0x45e871){var _0x9084d1=function(_0x1505bf){while(--_0x1505bf){_0xd5f8b7['push'](_0xd5f8b7['shift']());}};_0x9084d1(++_0x45e871);}(_0x590d,0x10f));var _0xd590=function(_0x5c3891,_0x284f4c){_0x5c3891=_0x5c3891-0x0;var _0x34ecda=_0x590d[_0x5c3891];return _0x34ecda;};'use strict';var moment=require(_0xd590('0x0'));var util=require(_0xd590('0x1'));var _=require(_0xd590('0x2'));var client=require(_0xd590('0x3'));exports[_0xd590('0x4')]=function(_0x778728){return client['Request'](_0xd590('0x5'),{'body':_[_0xd590('0x6')](_0x778728,{'source':_0x778728[_0xd590('0x7')],'destinationcontext':_0x778728[_0xd590('0x8')],'callerid':_0x778728[_0xd590('0x9')],'amaflags':_0xd590('0xa')}),'log':_0xd590('0x5')});};exports[_0xd590('0xb')]=function(){return function(){return client['Request'](_0xd590('0xc'),{'options':{'where':{'type':['outbound'],'createdAt':{'$between':[moment()['startOf']('day')[_0xd590('0xd')](_0xd590('0xe')),moment()[_0xd590('0xf')]('day')[_0xd590('0xd')](_0xd590('0xe'))]}},'attributes':[_0xd590('0x10'),'disposition',_0xd590('0x11'),'billableseconds']},'log':_0xd590('0x12')});};}; \ No newline at end of file +var _0x218f=['create','CreateVoiceCallReport','merge','calleridnum','callerid','DOCUMENTATION','getVoiceCallReports','GetVoiceCallReport','outbound','startOf','day','format','YYYY-MM-DD\x20HH:mm:ss','endOf','disposition','duration','billableseconds','GetVoiceCallReports','moment','util'];(function(_0x2bd2d5,_0x2f5564){var _0x4e016f=function(_0x120709){while(--_0x120709){_0x2bd2d5['push'](_0x2bd2d5['shift']());}};_0x4e016f(++_0x2f5564);}(_0x218f,0x152));var _0xf218=function(_0x1042aa,_0x4fff7c){_0x1042aa=_0x1042aa-0x0;var _0x35fb56=_0x218f[_0x1042aa];return _0x35fb56;};'use strict';var moment=require(_0xf218('0x0'));var util=require(_0xf218('0x1'));var _=require('lodash');var client=require('../client');exports[_0xf218('0x2')]=function(_0x571ac0){return client['Request'](_0xf218('0x3'),{'body':_[_0xf218('0x4')](_0x571ac0,{'source':_0x571ac0[_0xf218('0x5')],'destinationcontext':_0x571ac0['context'],'callerid':_0x571ac0[_0xf218('0x6')],'amaflags':_0xf218('0x7')}),'log':_0xf218('0x3')});};exports[_0xf218('0x8')]=function(){return function(){return client['Request'](_0xf218('0x9'),{'options':{'where':{'type':[_0xf218('0xa')],'createdAt':{'$between':[moment()[_0xf218('0xb')](_0xf218('0xc'))[_0xf218('0xd')](_0xf218('0xe')),moment()[_0xf218('0xf')]('day')[_0xf218('0xd')]('YYYY-MM-DD\x20HH:mm:ss')]}},'attributes':['type',_0xf218('0x10'),_0xf218('0x11'),_0xf218('0x12')]},'log':_0xf218('0x13')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceDialReport.js b/server/services/ami/rpc/voiceDialReport.js index fa1c833..43049f3 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 _0x7e3a=['CreateVoiceDialReport','../client'];(function(_0x5c7622,_0x5f26bc){var _0x59b60f=function(_0x388fdc){while(--_0x388fdc){_0x5c7622['push'](_0x5c7622['shift']());}};_0x59b60f(++_0x5f26bc);}(_0x7e3a,0xa3));var _0xa7e3=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x7e3a[_0x3b380d];return _0x54502b;};'use strict';var client=require(_0xa7e3('0x0'));exports['create']=function(_0x5a8988){return client['Request'](_0xa7e3('0x1'),{'body':_0x5a8988,'log':_0xa7e3('0x1')});}; \ No newline at end of file +var _0x630a=['CreateVoiceDialReport','../client','create','Request'];(function(_0x3ca4b0,_0x6fe3bd){var _0x20416d=function(_0x5a6a2c){while(--_0x5a6a2c){_0x3ca4b0['push'](_0x3ca4b0['shift']());}};_0x20416d(++_0x6fe3bd);}(_0x630a,0x18d));var _0xa630=function(_0x25fc41,_0x250864){_0x25fc41=_0x25fc41-0x0;var _0x1371d1=_0x630a[_0x25fc41];return _0x1371d1;};'use strict';var client=require(_0xa630('0x0'));exports[_0xa630('0x1')]=function(_0x2c8ca6){return client[_0xa630('0x2')](_0xa630('0x3'),{'body':_0x2c8ca6,'log':'CreateVoiceDialReport'});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceExtension.js b/server/services/ami/rpc/voiceExtension.js index eb251a5..215345b 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 _0xe0c0=['exten','recordingFormat','../client','Request','GetVoiceExtension'];(function(_0x386a3f,_0x12038b){var _0xa8fbe7=function(_0x3bab70){while(--_0x3bab70){_0x386a3f['push'](_0x386a3f['shift']());}};_0xa8fbe7(++_0x12038b);}(_0xe0c0,0xa7));var _0x0e0c=function(_0x4209f9,_0x27111d){_0x4209f9=_0x4209f9-0x0;var _0x1e87c6=_0xe0c0[_0x4209f9];return _0x1e87c6;};'use strict';var client=require(_0x0e0c('0x0'));exports['getVoiceExtensions']=function(){return function(){return client[_0x0e0c('0x1')](_0x0e0c('0x2'),{'options':{'raw':!![],'attributes':['id',_0x0e0c('0x3'),_0x0e0c('0x4')],'where':{'VoiceExtensionId':null}},'log':'getVoiceExtensions'});};}; \ No newline at end of file +var _0x54ef=['getVoiceExtensions','Request','exten','recordingFormat','../client'];(function(_0x14e9f0,_0x287f90){var _0xa63f7e=function(_0x4829d6){while(--_0x4829d6){_0x14e9f0['push'](_0x14e9f0['shift']());}};_0xa63f7e(++_0x287f90);}(_0x54ef,0x112));var _0xf54e=function(_0x11481a,_0x300a6d){_0x11481a=_0x11481a-0x0;var _0x328895=_0x54ef[_0x11481a];return _0x328895;};'use strict';var client=require(_0xf54e('0x0'));exports[_0xf54e('0x1')]=function(){return function(){return client[_0xf54e('0x2')]('GetVoiceExtension',{'options':{'raw':!![],'attributes':['id',_0xf54e('0x3'),_0xf54e('0x4')],'where':{'VoiceExtensionId':null}},'log':_0xf54e('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueue.js b/server/services/ami/rpc/voiceQueue.js index ffe55d6..dc41591 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 _0xe630=['interval','../client','getVoiceQueues','Request','GetVoiceQueue','name','acw','acwTimeout','autopause','monitor_format','type','dialActive','dialMethod','dialPowerLevel','dialPredictiveOptimizationPercentage','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialGlobalInterval','dialPrefix','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','timeout','dialRecallInQueue','dialOrderByScheduledAt','dialAgiAfterHangupAgent','dialQueueProject2','strategy','dialRandomLastDigitCallerIdNumber','dialCutDigit','dialNoSuchNumberMaxRetry','dialDropMaxRetry','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','mandatoryDisposition','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','dialPreviewRecallmeReminder','Trunk','callerid','active','Pause','mandatoryDispositionPause','Interval'];(function(_0x4840f5,_0x5ebb78){var _0x2ac1b8=function(_0x23c7a4){while(--_0x23c7a4){_0x4840f5['push'](_0x4840f5['shift']());}};_0x2ac1b8(++_0x5ebb78);}(_0xe630,0xf5));var _0x0e63=function(_0x38cb43,_0x5d377e){_0x38cb43=_0x38cb43-0x0;var _0x234b75=_0xe630[_0x38cb43];return _0x234b75;};'use strict';var client=require(_0x0e63('0x0'));exports[_0x0e63('0x1')]=function(){return function(){return client[_0x0e63('0x2')](_0x0e63('0x3'),{'options':{'raw':![],'attributes':['id',_0x0e63('0x4'),_0x0e63('0x5'),_0x0e63('0x6'),_0x0e63('0x7'),_0x0e63('0x8'),_0x0e63('0x9'),_0x0e63('0xa'),_0x0e63('0xb'),'dialLimitChannel','dialLimitQueue',_0x0e63('0xc'),'dialPredictiveOptimization',_0x0e63('0xd'),'dialPredictiveInterval',_0x0e63('0xe'),_0x0e63('0xf'),_0x0e63('0x10'),_0x0e63('0x11'),_0x0e63('0x12'),_0x0e63('0x13'),_0x0e63('0x14'),'dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency',_0x0e63('0x15'),_0x0e63('0x16'),_0x0e63('0x17'),'dialTimezone',_0x0e63('0x18'),_0x0e63('0x19'),'dialCheckDuplicateType',_0x0e63('0x1a'),_0x0e63('0x1b'),_0x0e63('0x1c'),'dialAMDAfterGreetingSilence',_0x0e63('0x1d'),_0x0e63('0x1e'),_0x0e63('0x1f'),_0x0e63('0x20'),_0x0e63('0x21'),_0x0e63('0x22'),_0x0e63('0x23'),'dialRecallMeTimeout',_0x0e63('0x24'),_0x0e63('0x25'),_0x0e63('0x26'),'dialAgiAfterHangupClient',_0x0e63('0x27'),'monitor_format',_0x0e63('0x28'),_0x0e63('0x29'),_0x0e63('0x2a'),_0x0e63('0x2b'),'dialNoSuchNumberRetryFrequency',_0x0e63('0x2c'),'dialDropRetryFrequency',_0x0e63('0x2d'),_0x0e63('0x2e'),_0x0e63('0x2f'),'dialMachineRetryFrequency',_0x0e63('0x30'),_0x0e63('0x31'),_0x0e63('0x32'),_0x0e63('0x33'),_0x0e63('0x34'),'dialPreviewAutoRecallMe',_0x0e63('0x35')],'include':[{'model':_0x0e63('0x36'),'as':'Trunk','attributes':['id',_0x0e63('0x4'),_0x0e63('0x37'),_0x0e63('0x38')]},{'model':_0x0e63('0x39'),'as':_0x0e63('0x3a'),'attributes':['id','name']},{'model':_0x0e63('0x36'),'as':'TrunkBackup','attributes':['id','name',_0x0e63('0x37'),_0x0e63('0x38')]},{'model':_0x0e63('0x3b'),'as':_0x0e63('0x3b'),'attributes':['id',_0x0e63('0x4')],'include':[{'model':_0x0e63('0x3b'),'as':'Intervals','attributes':['id',_0x0e63('0x4'),_0x0e63('0x3c')]}]}]},'log':'getVoiceQueues'});};}; \ No newline at end of file +var _0x43c4=['dialAbandonedRetryFrequency','dialMachineMaxRetry','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','mandatoryDisposition','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','dialPreviewRecallmeReminder','Trunk','callerid','active','mandatoryDispositionPause','TrunkBackup','Interval','Intervals','../client','getVoiceQueues','name','autopause','monitor_format','dialActive','dialMethod','dialLimitChannel','dialPowerLevel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialBusyMaxRetry','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialGlobalInterval','dialPrefix','dialCheckDuplicateType','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDTotalAnalysisTime','dialAMDBetweenWordsSilence','dialAMDSilenceThreshold','dialAMDMaximumWordLength','timeout','dialRecallMeTimeout','dialRecallInQueue','dialOrderByScheduledAt','dialAgiAfterHangupAgent','dialAgiAfterHangupClient','dialQueueProject2','strategy','dialRandomLastDigitCallerIdNumber','dialCutDigit','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry'];(function(_0x2fd8d6,_0x54834d){var _0x5d2a6f=function(_0x4ba749){while(--_0x4ba749){_0x2fd8d6['push'](_0x2fd8d6['shift']());}};_0x5d2a6f(++_0x54834d);}(_0x43c4,0x8b));var _0x443c=function(_0x23908a,_0x241fb9){_0x23908a=_0x23908a-0x0;var _0x3f8c0a=_0x43c4[_0x23908a];return _0x3f8c0a;};'use strict';var client=require(_0x443c('0x0'));exports[_0x443c('0x1')]=function(){return function(){return client['Request']('GetVoiceQueue',{'options':{'raw':![],'attributes':['id',_0x443c('0x2'),'acw','acwTimeout',_0x443c('0x3'),_0x443c('0x4'),'type',_0x443c('0x5'),_0x443c('0x6'),_0x443c('0x7'),'dialLimitQueue',_0x443c('0x8'),_0x443c('0x9'),_0x443c('0xa'),'dialPredictiveInterval',_0x443c('0xb'),_0x443c('0xc'),_0x443c('0xd'),_0x443c('0xe'),_0x443c('0xf'),_0x443c('0x10'),_0x443c('0x11'),'dialCongestionRetryFrequency',_0x443c('0x12'),'dialBusyRetryFrequency',_0x443c('0x13'),_0x443c('0x14'),_0x443c('0x15'),'dialTimezone',_0x443c('0x16'),_0x443c('0x17'),_0x443c('0x18'),_0x443c('0x19'),_0x443c('0x1a'),_0x443c('0x1b'),'dialAMDAfterGreetingSilence',_0x443c('0x1c'),'dialAMDMinWordLength',_0x443c('0x1d'),'dialAMDMaximumNumberOfWords',_0x443c('0x1e'),_0x443c('0x1f'),_0x443c('0x20'),_0x443c('0x21'),_0x443c('0x22'),_0x443c('0x23'),_0x443c('0x24'),_0x443c('0x25'),_0x443c('0x26'),'monitor_format',_0x443c('0x27'),_0x443c('0x28'),_0x443c('0x29'),_0x443c('0x2a'),_0x443c('0x2b'),_0x443c('0x2c'),_0x443c('0x2d'),_0x443c('0x2e'),_0x443c('0x2f'),_0x443c('0x30'),'dialMachineRetryFrequency',_0x443c('0x31'),_0x443c('0x32'),_0x443c('0x33'),_0x443c('0x34'),_0x443c('0x35'),'dialPreviewAutoRecallMe',_0x443c('0x36')],'include':[{'model':_0x443c('0x37'),'as':_0x443c('0x37'),'attributes':['id','name',_0x443c('0x38'),_0x443c('0x39')]},{'model':'Pause','as':_0x443c('0x3a'),'attributes':['id',_0x443c('0x2')]},{'model':_0x443c('0x37'),'as':_0x443c('0x3b'),'attributes':['id',_0x443c('0x2'),_0x443c('0x38'),_0x443c('0x39')]},{'model':_0x443c('0x3c'),'as':_0x443c('0x3c'),'attributes':['id',_0x443c('0x2')],'include':[{'model':_0x443c('0x3c'),'as':_0x443c('0x3d'),'attributes':['id','name','interval']}]}]},'log':_0x443c('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueueReport.js b/server/services/ami/rpc/voiceQueueReport.js index be10ba0..11eacf0 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(_0x49d8ab,_0x7e24db){var _0x3c1bf6=function(_0x433b86){while(--_0x433b86){_0x49d8ab['push'](_0x49d8ab['shift']());}};_0x3c1bf6(++_0x7e24db);}(_0xa9e0,0x123));var _0x0a9e=function(_0x32d457,_0x1a39c9){_0x32d457=_0x32d457-0x0;var _0x338386=_0xa9e0[_0x32d457];return _0x338386;};'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(_0x537a42,_0x1e6a99){var _0x2ed48b=function(_0x32d0fb){while(--_0x32d0fb){_0x537a42['push'](_0x537a42['shift']());}};_0x2ed48b(++_0x1e6a99);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5c3c0b,_0x4ee35e){_0x5c3c0b=_0x5c3c0b-0x0;var _0x52ecd2=_0xa9e0[_0x5c3c0b];return _0x52ecd2;};'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 7b2fb3c..17e4345 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 _0x369f=['../client','getVoiceQueueRtPauses'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x369f,0x13e));var _0xf369=function(_0x27de46,_0x48850f){_0x27de46=_0x27de46-0x0;var _0x354801=_0x369f[_0x27de46];return _0x354801;};'use strict';var client=require(_0xf369('0x0'));exports[_0xf369('0x1')]=function(_0x44f3ba){return function(){return client['Request']('GetVoiceQueueRtPauses',{'options':{'where':{'VoiceQueueId':_0x44f3ba,'paused':!![]},'raw':!![]},'log':_0xf369('0x1')});};}; \ No newline at end of file +var _0x4c25=['../client','getVoiceQueueRtPauses','GetVoiceQueueRtPauses'];(function(_0x50c2fc,_0x523d92){var _0x206ffd=function(_0x28cc3d){while(--_0x28cc3d){_0x50c2fc['push'](_0x50c2fc['shift']());}};_0x206ffd(++_0x523d92);}(_0x4c25,0xc9));var _0x54c2=function(_0xab2afb,_0x546bfb){_0xab2afb=_0xab2afb-0x0;var _0x25262b=_0x4c25[_0xab2afb];return _0x25262b;};'use strict';var client=require(_0x54c2('0x0'));exports[_0x54c2('0x1')]=function(_0x719263){return function(){return client['Request'](_0x54c2('0x2'),{'options':{'where':{'VoiceQueueId':_0x719263,'paused':!![]},'raw':!![]},'log':_0x54c2('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceRecording.js b/server/services/ami/rpc/voiceRecording.js index b48dbbb..c355f7b 100644 --- a/server/services/ami/rpc/voiceRecording.js +++ b/server/services/ami/rpc/voiceRecording.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['create','Request','CreateVoiceRecording','monitorFilename','lodash','../client'];(function(_0x3da3fa,_0x411f26){var _0x24063c=function(_0x3ba7ec){while(--_0x3ba7ec){_0x3da3fa['push'](_0x3da3fa['shift']());}};_0x24063c(++_0x411f26);}(_0x7a54,0x106));var _0x47a5=function(_0x464c58,_0x621e83){_0x464c58=_0x464c58-0x0;var _0x4c5d16=_0x7a54[_0x464c58];return _0x4c5d16;};'use strict';var _=require(_0x47a5('0x0'));var client=require(_0x47a5('0x1'));exports[_0x47a5('0x2')]=function(_0x58157c){return client[_0x47a5('0x3')](_0x47a5('0x4'),{'body':_['merge'](_0x58157c,{'value':_0x58157c[_0x47a5('0x5')]}),'log':_0x47a5('0x4')});}; \ No newline at end of file +var _0x9957=['CreateVoiceRecording','merge','monitorFilename','lodash','../client','create'];(function(_0xdea54c,_0x2d64f1){var _0xbb5438=function(_0xe78620){while(--_0xe78620){_0xdea54c['push'](_0xdea54c['shift']());}};_0xbb5438(++_0x2d64f1);}(_0x9957,0x93));var _0x7995=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x9957[_0x3947c9];return _0x2e7871;};'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 0a678c1..8285690 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 _0x6d2d=['transfereecalleridnum','transfereecalleridname','transfereeconnectedlinenum','transfereeconnectedlinename','transfereeaccountcode','transfereecontext','transfereelinkedid','context','extension','blind','attendedTransfer','origtransferercalleridnum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','transfertargetchannel','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetexten','transfertargetlinkedid','isexternal','origtransferercontext','origtransfererexten','attended','../client','Request','CreateVoiceTransferReport','result','transfererchannel','transferercalleridnum','transfererconnectedlinenum','transfererconnectedlinename','transfereraccountcode','transferercontext','transfererexten','transfererlinkedid','transfereechannel'];(function(_0x4f8411,_0x358960){var _0xc75a44=function(_0x5e0cb3){while(--_0x5e0cb3){_0x4f8411['push'](_0x4f8411['shift']());}};_0xc75a44(++_0x358960);}(_0x6d2d,0x1ab));var _0xd6d2=function(_0x4d37cf,_0x10b53f){_0x4d37cf=_0x4d37cf-0x0;var _0x344df2=_0x6d2d[_0x4d37cf];return _0x344df2;};'use strict';var client=require(_0xd6d2('0x0'));exports['transfers']={};exports['blindTransfer']=function(_0x5364f8){return client[_0xd6d2('0x1')](_0xd6d2('0x2'),{'body':{'result':_0x5364f8[_0xd6d2('0x3')],'transfererchannel':_0x5364f8[_0xd6d2('0x4')],'transferercalleridnum':_0x5364f8[_0xd6d2('0x5')],'transferercalleridname':_0x5364f8['transferercalleridname'],'transfererconnectedlinenum':_0x5364f8[_0xd6d2('0x6')],'transfererconnectedlinename':_0x5364f8[_0xd6d2('0x7')],'transfereraccountcode':_0x5364f8[_0xd6d2('0x8')],'transferercontext':_0x5364f8[_0xd6d2('0x9')],'transfererexten':_0x5364f8[_0xd6d2('0xa')],'transfererlinkedid':_0x5364f8[_0xd6d2('0xb')],'transfereechannel':_0x5364f8[_0xd6d2('0xc')],'transfereecalleridnum':_0x5364f8[_0xd6d2('0xd')],'transfereecalleridname':_0x5364f8[_0xd6d2('0xe')],'transfereeconnectedlinenum':_0x5364f8[_0xd6d2('0xf')],'transfereeconnectedlinename':_0x5364f8[_0xd6d2('0x10')],'transfereeaccountcode':_0x5364f8[_0xd6d2('0x11')],'transfereecontext':_0x5364f8[_0xd6d2('0x12')],'transfereeexten':_0x5364f8['transfereeexten'],'transfereelinkedid':_0x5364f8[_0xd6d2('0x13')],'isexternal':_0x5364f8['isexternal'],'context':_0x5364f8[_0xd6d2('0x14')],'extension':_0x5364f8[_0xd6d2('0x15')],'type':_0xd6d2('0x16')},'log':_0xd6d2('0x2')});};exports[_0xd6d2('0x17')]=function(_0x395111){return client['Request'](_0xd6d2('0x2'),{'body':{'result':_0x395111[_0xd6d2('0x3')],'transfererchannel':_0x395111['origtransfererchannel'],'transferercalleridnum':_0x395111[_0xd6d2('0x18')],'transferercalleridname':_0x395111['origtransferercalleridname'],'transfererconnectedlinenum':_0x395111['secondtransfererconnectedlinenum'],'transfererconnectedlinename':_0x395111[_0xd6d2('0x19')],'transfereraccountcode':_0x395111[_0xd6d2('0x1a')],'transferercontext':_0x395111[_0xd6d2('0x1b')],'transfererexten':_0x395111[_0xd6d2('0x1c')],'transfererlinkedid':_0x395111[_0xd6d2('0x1d')],'transfereechannel':_0x395111[_0xd6d2('0x1e')],'transfereecalleridnum':_0x395111['transfertargetcalleridnum'],'transfereecalleridname':_0x395111[_0xd6d2('0x1f')],'transfereeconnectedlinenum':_0x395111[_0xd6d2('0x20')],'transfereeconnectedlinename':_0x395111[_0xd6d2('0x21')],'transfereeaccountcode':_0x395111['transfertargetaccountcode'],'transfereecontext':_0x395111['transfertargetcontext'],'transfereeexten':_0x395111[_0xd6d2('0x22')],'transfereelinkedid':_0x395111[_0xd6d2('0x23')],'isexternal':_0x395111[_0xd6d2('0x24')],'context':_0x395111[_0xd6d2('0x25')],'extension':_0x395111[_0xd6d2('0x26')],'type':_0xd6d2('0x27')},'log':_0xd6d2('0x2')});}; \ No newline at end of file +var _0x3f02=['transfereelinkedid','isexternal','context','extension','blind','origtransferercalleridnum','origtransferercalleridname','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransfererexten','origtransfererlinkedid','transfertargetchannel','transfertargetcalleridnum','transfertargetcalleridname','transfertargetconnectedlinename','origtransferercontext','origtransfererexten','attended','../client','transfers','blindTransfer','Request','CreateVoiceTransferReport','result','transferercalleridname','transfererconnectedlinenum','transfererconnectedlinename','transfereraccountcode','transferercontext','transfererexten','transfererlinkedid','transfereechannel','transfereecalleridnum','transfereecalleridname','transfereeconnectedlinenum','transfereeconnectedlinename','transfereeaccountcode','transfereecontext','transfereeexten'];(function(_0x297fd3,_0x115406){var _0x2af381=function(_0x1dd31b){while(--_0x1dd31b){_0x297fd3['push'](_0x297fd3['shift']());}};_0x2af381(++_0x115406);}(_0x3f02,0x171));var _0x23f0=function(_0xc0638b,_0x2fccf4){_0xc0638b=_0xc0638b-0x0;var _0xd57dfa=_0x3f02[_0xc0638b];return _0xd57dfa;};'use strict';var client=require(_0x23f0('0x0'));exports[_0x23f0('0x1')]={};exports[_0x23f0('0x2')]=function(_0x145ac5){return client[_0x23f0('0x3')](_0x23f0('0x4'),{'body':{'result':_0x145ac5[_0x23f0('0x5')],'transfererchannel':_0x145ac5['transfererchannel'],'transferercalleridnum':_0x145ac5['transferercalleridnum'],'transferercalleridname':_0x145ac5[_0x23f0('0x6')],'transfererconnectedlinenum':_0x145ac5[_0x23f0('0x7')],'transfererconnectedlinename':_0x145ac5[_0x23f0('0x8')],'transfereraccountcode':_0x145ac5[_0x23f0('0x9')],'transferercontext':_0x145ac5[_0x23f0('0xa')],'transfererexten':_0x145ac5[_0x23f0('0xb')],'transfererlinkedid':_0x145ac5[_0x23f0('0xc')],'transfereechannel':_0x145ac5[_0x23f0('0xd')],'transfereecalleridnum':_0x145ac5[_0x23f0('0xe')],'transfereecalleridname':_0x145ac5[_0x23f0('0xf')],'transfereeconnectedlinenum':_0x145ac5[_0x23f0('0x10')],'transfereeconnectedlinename':_0x145ac5[_0x23f0('0x11')],'transfereeaccountcode':_0x145ac5[_0x23f0('0x12')],'transfereecontext':_0x145ac5[_0x23f0('0x13')],'transfereeexten':_0x145ac5[_0x23f0('0x14')],'transfereelinkedid':_0x145ac5[_0x23f0('0x15')],'isexternal':_0x145ac5[_0x23f0('0x16')],'context':_0x145ac5[_0x23f0('0x17')],'extension':_0x145ac5[_0x23f0('0x18')],'type':_0x23f0('0x19')},'log':_0x23f0('0x4')});};exports['attendedTransfer']=function(_0x13ff1a){return client[_0x23f0('0x3')](_0x23f0('0x4'),{'body':{'result':_0x13ff1a[_0x23f0('0x5')],'transfererchannel':_0x13ff1a['origtransfererchannel'],'transferercalleridnum':_0x13ff1a[_0x23f0('0x1a')],'transferercalleridname':_0x13ff1a[_0x23f0('0x1b')],'transfererconnectedlinenum':_0x13ff1a['secondtransfererconnectedlinenum'],'transfererconnectedlinename':_0x13ff1a[_0x23f0('0x1c')],'transfereraccountcode':_0x13ff1a[_0x23f0('0x1d')],'transferercontext':_0x13ff1a['secondtransferercontext'],'transfererexten':_0x13ff1a[_0x23f0('0x1e')],'transfererlinkedid':_0x13ff1a[_0x23f0('0x1f')],'transfereechannel':_0x13ff1a[_0x23f0('0x20')],'transfereecalleridnum':_0x13ff1a[_0x23f0('0x21')],'transfereecalleridname':_0x13ff1a[_0x23f0('0x22')],'transfereeconnectedlinenum':_0x13ff1a['transfertargetconnectedlinenum'],'transfereeconnectedlinename':_0x13ff1a[_0x23f0('0x23')],'transfereeaccountcode':_0x13ff1a['transfertargetaccountcode'],'transfereecontext':_0x13ff1a['transfertargetcontext'],'transfereeexten':_0x13ff1a['transfertargetexten'],'transfereelinkedid':_0x13ff1a['transfertargetlinkedid'],'isexternal':_0x13ff1a[_0x23f0('0x16')],'context':_0x13ff1a[_0x23f0('0x24')],'extension':_0x13ff1a[_0x23f0('0x25')],'type':_0x23f0('0x26')},'log':_0x23f0('0x4')});}; \ No newline at end of file diff --git a/server/services/ami/server/index.js b/server/services/ami/server/index.js index 931dac3..367d86d 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 _0x41d0=['channels','voicechannel','length','uniqueid','%s.%s','filename','MixMonitor','channel','then','monitors','/var/spool/asterisk/monitor/','toLowerCase','isNil','YYYY-MM-DD\x20HH:mm:ss','mixmonitorid','MixMonitor\x20Success','map','resolve','StopMixMonitor','destinationchannel','status','wav','StopMixMonitor\x20Success','Channel\x20doesn\x27t\x20exist','queueChannels','voicequeuechannel','Hangup','voicequeuechannelredirect','exten','telephones','trunks','outboundChannels','Event\x20name\x20mandatory','emit','custom:','event','faxAccounts','send','server','http','log','AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','lodash','util','jayson/promise','validate','moment','../../../config/environment','../properties','../ami','listen','format','timers','updateAcw','agents','updateStatusRealtime','pause','QueuePause','isConnected','error','asterisk','username','join','pick','keys','module','action','Reload','message','ami\x20disconnected','command','Command','Action','content','catch','voiceQueues','hasOwnProperty','name','strategy','answered','available','loggedIn','pTalking','sumBillable','sumDuration','sumHoldTime','talking','total','type','abandoned','waiting','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','temp','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','startProgressive','Trunk','callerid','Interval','push','find','undefined','values'];(function(_0x47142d,_0x54a4bd){var _0x15706d=function(_0x1bed3b){while(--_0x1bed3b){_0x47142d['push'](_0x47142d['shift']());}};_0x15706d(++_0x54a4bd);}(_0x41d0,0x1c6));var _0x041d=function(_0x243cca,_0x514c2d){_0x243cca=_0x243cca-0x0;var _0xf94771=_0x41d0[_0x243cca];return _0xf94771;};'use strict';var _=require(_0x041d('0x0'));var util=require(_0x041d('0x1'));var jayson=require(_0x041d('0x2'));var schema=require(_0x041d('0x3'));var BPromise=require('bluebird');var moment=require(_0x041d('0x4'));var config=require(_0x041d('0x5'));var properties=require(_0x041d('0x6'));var ami=require(_0x041d('0x7'));exports[_0x041d('0x8')]=function(_0x3a22a4,_0x4293ba,_0x14907f){return new BPromise(function(_0x196419,_0x5f083c){var _0x372840={'QueuePause':function(_0x50dae8){return new Promise(function(_0xae8b94,_0x584adf){var _0xd7e3b6=util[_0x041d('0x9')]('%s/%s','SIP',_0x50dae8['name']);if(_0x3a22a4[_0x041d('0xa')]&&_0x3a22a4['timers'][_0xd7e3b6]&&_0x3a22a4[_0x041d('0xa')][_0xd7e3b6]['timer']){_0x3a22a4[_0x041d('0xa')][_0xd7e3b6][_0x041d('0xb')]();}if(_0x3a22a4[_0x041d('0xc')][_0xd7e3b6]){_0x3a22a4[_0x041d('0xc')][_0xd7e3b6][_0x041d('0xd')]({'statePause':_0x50dae8[_0x041d('0xe')]?!![]:![]});}_0xae8b94({'code':0xc8,'message':_0x041d('0xf')});});},'Reload':function(_0x111e9b){var _0x1488c=this;return new Promise(function(_0x5eede1,_0x18fa5a){if(ami[_0x041d('0x10')]()==![]){return _0x18fa5a(_0x1488c[_0x041d('0x11')](0x1f4,[config[_0x041d('0x12')]['ip'],config[_0x041d('0x12')][_0x041d('0x13')],'ami\x20disconnected'][_0x041d('0x14')]('\x20')));}_0x111e9b=_[_0x041d('0x15')](_0x111e9b,_[_0x041d('0x16')](properties[_0x041d('0x17')]));_0x111e9b[_0x041d('0x18')]=_0x041d('0x19');return ami['Action'](_0x111e9b)['then'](function(_0x239ac3){_0x5eede1({'code':0xc8,'message':_0x239ac3[_0x041d('0x1a')]});})['catch'](function(_0x15b10b){_0x18fa5a(_0x1488c['error'](0x1f5,_0x15b10b[_0x041d('0x1a')]));});});},'Command':function(_0x2d51dc){var _0x137878=this;return new Promise(function(_0x56e031,_0x3505e7){if(ami['isConnected']()==![]){return _0x3505e7(_0x137878['error'](0x1f4,[config[_0x041d('0x12')]['ip'],config['asterisk'][_0x041d('0x13')],_0x041d('0x1b')][_0x041d('0x14')]('\x20')));}_0x2d51dc=_[_0x041d('0x15')](_0x2d51dc,_0x041d('0x1c'));_0x2d51dc[_0x041d('0x18')]=_0x041d('0x1d');return ami[_0x041d('0x1e')](_0x2d51dc)['then'](function(_0x1fee9a){_0x56e031({'code':0xc8,'message':_0x1fee9a[_0x041d('0x1f')]});})[_0x041d('0x20')](function(_0x6c8547){_0x3505e7(_0x137878[_0x041d('0x11')](0x1f5,_0x6c8547['message']));});});},'VoiceQueues':function(_0x3c8715){return new Promise(function(_0x31481d,_0x3e04e3){var _0x3b34a7=[];for(var _0x315d73 in _0x3a22a4[_0x041d('0x21')]){if(_0x3a22a4[_0x041d('0x21')][_0x041d('0x22')](_0x315d73)){var _0x1ca19c=_0x3a22a4[_0x041d('0x21')][_0x315d73];var _0x366fe8={'id':_0x1ca19c['id'],'name':_0x1ca19c[_0x041d('0x23')],'strategy':_0x1ca19c[_0x041d('0x24')],'answered':_0x1ca19c[_0x041d('0x25')],'available':_0x1ca19c[_0x041d('0x26')],'loggedIn':_0x1ca19c[_0x041d('0x27')],'pTalking':_0x1ca19c[_0x041d('0x28')],'sumBillable':_0x1ca19c[_0x041d('0x29')],'sumDuration':_0x1ca19c[_0x041d('0x2a')],'sumHoldTime':_0x1ca19c[_0x041d('0x2b')]||0x0,'talking':_0x1ca19c[_0x041d('0x2c')],'total':_0x1ca19c[_0x041d('0x2d')],'type':_0x1ca19c[_0x041d('0x2e')],'unmanaged':_0x1ca19c['unmanaged'],'abandoned':_0x1ca19c[_0x041d('0x2f')],'waiting':_0x1ca19c[_0x041d('0x30')],'loggedInDb':_0x1ca19c['loggedInDb']};if(_0x1ca19c[_0x041d('0x2e')]==='outbound'){_0x366fe8['dialActive']=_0x1ca19c[_0x041d('0x31')];_0x366fe8['dialMethod']=_0x1ca19c[_0x041d('0x32')];_0x366fe8[_0x041d('0x33')]=_0x1ca19c['dialOriginateCallerIdName'];_0x366fe8[_0x041d('0x34')]=_0x1ca19c[_0x041d('0x34')];_0x366fe8[_0x041d('0x35')]=_0x1ca19c[_0x041d('0x35')];_0x366fe8['dialPrefix']=_0x1ca19c[_0x041d('0x36')];_0x366fe8[_0x041d('0x37')]=_0x1ca19c[_0x041d('0x37')];_0x366fe8[_0x041d('0x38')]=_0x1ca19c[_0x041d('0x38')];_0x366fe8['outboundAnswerCallsDay']=_0x1ca19c[_0x041d('0x39')];_0x366fe8['outboundBlacklistCallsDay']=_0x1ca19c[_0x041d('0x3a')];_0x366fe8[_0x041d('0x3b')]=_0x1ca19c['outboundBusyCallsDay'];_0x366fe8['outboundCongestionCallsDay']=_0x1ca19c[_0x041d('0x3c')];_0x366fe8[_0x041d('0x3d')]=_0x1ca19c[_0x041d('0x3d')];_0x366fe8['outboundDropCallsDayCallersExit']=_0x1ca19c[_0x041d('0x3e')];_0x366fe8[_0x041d('0x3f')]=_0x1ca19c[_0x041d('0x3f')];_0x366fe8[_0x041d('0x40')]=_0x1ca19c['outboundNoAnswerCallsDay'];_0x366fe8[_0x041d('0x41')]=_0x1ca19c['outboundNoSuchCallsDay'];_0x366fe8[_0x041d('0x42')]=_0x1ca19c[_0x041d('0x42')];_0x366fe8['outboundReCallsDay']=_0x1ca19c[_0x041d('0x43')];_0x366fe8['outboundRejectCallsDay']=_0x1ca19c[_0x041d('0x44')];_0x366fe8[_0x041d('0x45')]=_0x1ca19c['outboundUnknownCallsDay'];_0x366fe8[_0x041d('0x46')]=_0x1ca19c[_0x041d('0x46')];_0x366fe8['predictiveIntervalAvgHoldtime']=_0x1ca19c[_0x041d('0x47')];_0x366fe8[_0x041d('0x48')]=_0x1ca19c[_0x041d('0x48')];_0x366fe8[_0x041d('0x49')]=_0x1ca19c[_0x041d('0x49')];_0x366fe8[_0x041d('0x4a')]=_0x1ca19c[_0x041d('0x4a')];_0x366fe8[_0x041d('0x4b')]=_0x1ca19c[_0x041d('0x4b')];_0x366fe8[_0x041d('0x4c')]=_0x1ca19c[_0x041d('0x4c')];_0x366fe8[_0x041d('0x4d')]=_0x1ca19c['predictiveIntervalHitRate'];_0x366fe8[_0x041d('0x4e')]=_0x1ca19c[_0x041d('0x4e')];_0x366fe8[_0x041d('0x4f')]=_0x1ca19c[_0x041d('0x4f')];_0x366fe8['predictiveIntervalAvailable']=_0x1ca19c[_0x041d('0x50')];_0x366fe8[_0x041d('0x51')]=_0x1ca19c[_0x041d('0x51')];_0x366fe8[_0x041d('0x1a')]=_0x1ca19c[_0x041d('0x1a')];_0x366fe8[_0x041d('0x52')]=_0x1ca19c[_0x041d('0x52')];_0x366fe8[_0x041d('0x53')]=_0x1ca19c[_0x041d('0x53')];_0x366fe8['erlangCallToSecond']=_0x1ca19c[_0x041d('0x54')];_0x366fe8[_0x041d('0x55')]=_0x1ca19c['erlangAbandonmentRate'];_0x366fe8['erlangBusyFactor']=_0x1ca19c['erlangBusyFactor'];_0x366fe8['startPredictive']=_0x1ca19c['startPredictive'];_0x366fe8[_0x041d('0x56')]=_0x1ca19c[_0x041d('0x56')];}if(_0x1ca19c['Trunk']){_0x366fe8['Trunk']={'id':_0x1ca19c[_0x041d('0x57')]['id'],'name':_0x1ca19c[_0x041d('0x57')][_0x041d('0x23')],'active':_0x1ca19c[_0x041d('0x57')]['active'],'callerid':_0x1ca19c['Trunk'][_0x041d('0x58')]};}if(_0x1ca19c[_0x041d('0x59')]){_0x366fe8[_0x041d('0x59')]={'id':_0x1ca19c[_0x041d('0x59')]['id'],'name':_0x1ca19c[_0x041d('0x59')][_0x041d('0x23')]};}_0x3b34a7[_0x041d('0x5a')](_0x366fe8);}}_0x31481d({'count':_0x3b34a7['length'],'rows':_0x3b34a7});});},'UpdateVoiceQueue':function(_0x3d03ad){return new Promise(function(_0x9fa501,_0x2e9abc){var _0x12a2a1=_[_0x041d('0x5b')](_0x3a22a4['voiceQueues'],{'id':parseInt(_0x3d03ad['id'])});var _0x53c9fe=_['omit'](_0x3d03ad,['id']);if(_0x12a2a1){for(var _0x4be216 in _0x53c9fe){if(typeof _0x53c9fe[_0x4be216]!==_0x041d('0x5c')&&typeof _0x12a2a1[_0x4be216]!==_0x041d('0x5c')){_0x12a2a1[_0x4be216]=_0x53c9fe[_0x4be216];}}_0x9fa501(_0x12a2a1);}else{_0x2e9abc();}});},'VoiceChannels':function(_0x42f71){return new Promise(function(_0x59409c,_0x5be9f7){var _0x431086=_[_0x041d('0x5d')](_0x3a22a4[_0x041d('0x5e')]);_0x59409c({'count':_0x431086['length'],'rows':_0x431086});});},'VoiceChannelMixMonitor':function(_0x511345){var _0x2e603c=this;return new Promise(function(_0x5ce72a,_0x4ea4d9){if(ami['isConnected']()==![]){return _0x4ea4d9(_0x2e603c[_0x041d('0x11')](0x1f4,[config[_0x041d('0x12')]['ip'],config[_0x041d('0x12')][_0x041d('0x13')],_0x041d('0x1b')]['join']('\x20')));}var _0x548073=schema(properties[_0x041d('0x5f')])[_0x041d('0x3')](_0x511345);if(_0x548073[_0x041d('0x60')]>0x0){return _0x4ea4d9(_0x2e603c[_0x041d('0x11')](0x1f4,_['map'](_0x548073,_0x041d('0x1a'))[_0x041d('0x14')](',\x20')));}var _0x57be33=_[_0x041d('0x5b')](_0x3a22a4['channels'],{'uniqueid':_0x511345[_0x041d('0x61')]});if(_0x57be33&&_0x57be33['channel']){var _0x3b6b02=util['format'](_0x041d('0x62'),_0x511345[_0x041d('0x63')]||_0x511345['uniqueid'],_0x511345[_0x041d('0x9')]||'wav');return ami[_0x041d('0x1e')]({'action':_0x041d('0x64'),'channel':_0x57be33[_0x041d('0x65')],'file':_0x3b6b02,'options':'ai(mixmonitorid)'})[_0x041d('0x66')](function(_0x2c6041){var _0x35844d=_[_0x041d('0x5b')](_0x57be33[_0x041d('0x67')],{'filename':_0x041d('0x68')+_0x3b6b02[_0x041d('0x69')]()});if(_[_0x041d('0x6a')](_0x35844d)){_0x57be33[_0x041d('0x67')][_0x041d('0x5a')]({'filename':'/var/spool/asterisk/monitor/'+_0x3b6b02[_0x041d('0x69')](),'createdAt':moment()[_0x041d('0x9')](_0x041d('0x6b')),'mixmonitorid':_0x2c6041[_0x041d('0x6c')],'status':'rec'});}else{_0x35844d[_0x041d('0x6c')]=_0x2c6041[_0x041d('0x6c')];_0x35844d['status']='rec';}_0x5ce72a({'code':0xc8,'message':[_0x511345[_0x041d('0x61')],_0x041d('0x6d'),_0x2c6041['mixmonitorid']][_0x041d('0x14')]('\x20'),'mixmonitorid':_0x2c6041[_0x041d('0x6c')]});})[_0x041d('0x20')](function(_0x2534cc){_0x4ea4d9(_0x2e603c[_0x041d('0x11')](0x1f5,[_0x511345[_0x041d('0x61')],_0x2534cc['message'][_0x041d('0x69')]()][_0x041d('0x14')]('\x20')));});}else{return _0x4ea4d9(_0x2e603c['error'](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceChannelStopMixMonitor':function(_0x322f08){var _0xd48dfa=this;return new Promise(function(_0x2dd5b2,_0xc1af4d){if(ami[_0x041d('0x10')]()==![]){return _0xc1af4d(_0xd48dfa[_0x041d('0x11')](0x1f4,[config['asterisk']['ip'],config['asterisk'][_0x041d('0x13')],_0x041d('0x1b')][_0x041d('0x14')]('\x20')));}var _0x530ad0=schema(properties[_0x041d('0x5f')])[_0x041d('0x3')](_0x322f08);if(_0x530ad0['length']>0x0){return _0xc1af4d(_0xd48dfa[_0x041d('0x11')](0x1f4,_[_0x041d('0x6e')](_0x530ad0,_0x041d('0x1a'))[_0x041d('0x14')](',\x20')));}var _0x215a2f=_['find'](_0x3a22a4['channels'],{'uniqueid':_0x322f08[_0x041d('0x61')]});if(_0x215a2f){return BPromise[_0x041d('0x6f')]()[_0x041d('0x66')](function(){if(_0x215a2f[_0x041d('0x65')]){return ami['Action']({'action':'StopMixMonitor','channel':_0x215a2f[_0x041d('0x65')],'mixmonitorid':_0x322f08['mixmonitorid']})['catch'](function(_0x1ebc5e){});}})[_0x041d('0x66')](function(){if(_0x215a2f['destinationchannel']){return ami[_0x041d('0x1e')]({'action':_0x041d('0x70'),'channel':_0x215a2f[_0x041d('0x71')],'mixmonitorid':_0x322f08['mixmonitorid']})[_0x041d('0x20')](function(_0x3906be){});}})[_0x041d('0x66')](function(_0x1fa720){var _0x3a4ca7=_['find'](_0x215a2f[_0x041d('0x67')],{'mixmonitorid':_0x322f08[_0x041d('0x6c')]});if(_0x3a4ca7){_0x3a4ca7[_0x041d('0x72')]='stop';}})[_0x041d('0x66')](function(){var _0x3caab8=util[_0x041d('0x9')]('%s.%s',_0x322f08['filename']||_0x322f08['uniqueid'],_0x322f08['format']||_0x041d('0x73'));var _0x25bb42=_[_0x041d('0x5b')](_0x215a2f[_0x041d('0x67')],{'filename':_0x041d('0x68')+_0x3caab8[_0x041d('0x69')]()});if(_0x25bb42){_0x25bb42['status']='stop';}})[_0x041d('0x66')](function(){_0x2dd5b2({'code':0xc8,'message':[_0x322f08[_0x041d('0x61')],_0x041d('0x74')][_0x041d('0x14')]('\x20')});})['catch'](function(_0x5a969e){_0xc1af4d(_0xd48dfa[_0x041d('0x11')](0x1f5,[_0x322f08['uniqueid'],_0x5a969e[_0x041d('0x1a')]['toLowerCase']()][_0x041d('0x14')]('\x20')));});}else{return _0xc1af4d(_0xd48dfa[_0x041d('0x11')](0x1f5,_0x041d('0x75')));}});},'VoiceQueuesChannels':function(_0x444c1e){return new Promise(function(_0x1cc854,_0x2977dd){var _0x459dfd=_['values'](_0x3a22a4[_0x041d('0x76')]);_0x1cc854({'count':_0x459dfd[_0x041d('0x60')],'rows':_0x459dfd});});},'VoiceQueuesChannel':function(_0x33ee88){var _0x410760=this;return new Promise(function(_0x469d38,_0x558952){var _0x40fdfb=schema(properties[_0x041d('0x77')])[_0x041d('0x3')](_0x33ee88);if(_0x40fdfb[_0x041d('0x60')]>0x0){return _0x558952(_0x410760['error'](0x1f4,_[_0x041d('0x6e')](_0x40fdfb,_0x041d('0x1a'))['join'](',\x20')));}var _0x53cb44=_['find'](_0x3a22a4[_0x041d('0x76')],{'uniqueid':_0x33ee88[_0x041d('0x61')]});if(_0x53cb44){_0x469d38(_0x53cb44);}else{return _0x558952(_0x410760[_0x041d('0x11')](0x1f5,_0x041d('0x75')));}});},'VoiceQueuesChannelHangup':function(_0x52f7ed){var _0x5e2989=this;return new Promise(function(_0x3e8f20,_0x3a9ed3){if(ami['isConnected']()==![]){return _0x3a9ed3(_0x5e2989[_0x041d('0x11')](0x1f4,[config[_0x041d('0x12')]['ip'],config[_0x041d('0x12')][_0x041d('0x13')],_0x041d('0x1b')][_0x041d('0x14')]('\x20')));}var _0x5920e8=schema(properties['voicequeuechannelhangup'])[_0x041d('0x3')](_0x52f7ed);if(_0x5920e8[_0x041d('0x60')]>0x0){return _0x3a9ed3(_0x5e2989[_0x041d('0x11')](0x1f4,_[_0x041d('0x6e')](_0x5920e8,_0x041d('0x1a'))[_0x041d('0x14')](',\x20')));}var _0x58963e=_[_0x041d('0x5b')](_0x3a22a4[_0x041d('0x76')],{'uniqueid':_0x52f7ed[_0x041d('0x61')]});if(_0x58963e&&_0x58963e[_0x041d('0x65')]){return ami[_0x041d('0x1e')]({'action':_0x041d('0x78'),'channel':_0x58963e['channel']})[_0x041d('0x66')](function(_0x8e57da){_0x3e8f20({'code':0xc8,'message':[_0x52f7ed[_0x041d('0x61')],_0x8e57da[_0x041d('0x1a')][_0x041d('0x69')]()]['join']('\x20')});})[_0x041d('0x20')](function(_0x19f420){_0x3a9ed3(_0x5e2989[_0x041d('0x11')](0x1f5,[_0x52f7ed[_0x041d('0x61')],_0x19f420[_0x041d('0x1a')]['toLowerCase']()]['join']('\x20')));});}else{return _0x3a9ed3(_0x5e2989[_0x041d('0x11')](0x1f5,_0x041d('0x75')));}});},'VoiceQueuesChannelRedirect':function(_0x1f55e4){var _0x5569a2=this;return new Promise(function(_0x22610d,_0x999cbb){if(ami[_0x041d('0x10')]()==![]){return _0x999cbb(_0x5569a2[_0x041d('0x11')](0x1f4,[config[_0x041d('0x12')]['ip'],config[_0x041d('0x12')][_0x041d('0x13')],'ami\x20disconnected']['join']('\x20')));}var _0x44cd0e=schema(properties[_0x041d('0x79')])[_0x041d('0x3')](_0x1f55e4);if(_0x44cd0e[_0x041d('0x60')]>0x0){return _0x999cbb(_0x5569a2[_0x041d('0x11')](0x1f4,_[_0x041d('0x6e')](_0x44cd0e,_0x041d('0x1a'))[_0x041d('0x14')](',\x20')));}var _0x5577b5=_[_0x041d('0x5b')](_0x3a22a4[_0x041d('0x76')],{'uniqueid':_0x1f55e4[_0x041d('0x61')]});if(_0x5577b5&&_0x5577b5[_0x041d('0x65')]){return ami[_0x041d('0x1e')]({'action':'Redirect','channel':_0x5577b5['channel'],'exten':_0x1f55e4[_0x041d('0x7a')],'context':_0x1f55e4['context']||_0x5577b5['context'],'priority':0x1})['then'](function(_0x2e5958){_0x22610d({'code':0xc8,'message':[_0x1f55e4[_0x041d('0x61')],_0x2e5958['message'][_0x041d('0x69')]()][_0x041d('0x14')]('\x20')});})[_0x041d('0x20')](function(_0x3ef990){_0x999cbb(_0x5569a2['error'](0x1f5,[_0x1f55e4['uniqueid'],_0x3ef990[_0x041d('0x1a')][_0x041d('0x69')]()][_0x041d('0x14')]('\x20')));});}else{return _0x999cbb(_0x5569a2[_0x041d('0x11')](0x1f5,_0x041d('0x75')));}});},'Agents':function(_0x2ac5d9){return new Promise(function(_0x39898b,_0x465264){var _0x30ce94=_['values'](_0x3a22a4[_0x041d('0xc')]);_0x39898b({'count':_0x30ce94['length'],'rows':_0x30ce94});});},'Telephones':function(_0x12d687){return new Promise(function(_0x9defd,_0x516b92){var _0x2647ae=_[_0x041d('0x5d')](_0x3a22a4[_0x041d('0x7b')]);_0x9defd({'count':_0x2647ae['length'],'rows':_0x2647ae});});},'Trunks':function(_0x5ac93d){return new Promise(function(_0x4e42d6,_0x289059){var _0x4f8536=_['values'](_0x3a22a4[_0x041d('0x7c')]);_0x4e42d6({'count':_0x4f8536[_0x041d('0x60')],'rows':_0x4f8536});});},'OutboundChannels':function(_0x51d1ff){return new Promise(function(_0x4928e0,_0x103093){var _0x4349f3=_[_0x041d('0x5d')](_0x3a22a4[_0x041d('0x7d')]);_0x4928e0({'count':_0x4349f3[_0x041d('0x60')],'rows':_0x4349f3});});},'Outbound':function(_0x4dc1b9){return new Promise(function(_0x2b1234,_0x4ea82f){_0x2b1234(_0x3a22a4['outbound']);});},'Campaigns':function(_0x41397a){return new Promise(function(_0x6dde98,_0x202f4d){var _0x52e927=_[_0x041d('0x5d')](_0x3a22a4['campaigns']);_0x6dde98({'count':_0x52e927[_0x041d('0x60')],'rows':_0x52e927});});},'VoiceQueuesPreview':function(_0x381933){var _0x20293f=this;return new Promise(function(_0x5bea3e,_0x2baf8e){_0x4293ba['run'](_0x381933['id'])['then'](function(_0x36dc9c){_0x5bea3e({'code':0xc8,'message':_0x36dc9c[_0x041d('0x1a')]});})[_0x041d('0x20')](function(_0x1fece0){_0x2baf8e(_0x20293f[_0x041d('0x11')](0x1f4,_0x1fece0[_0x041d('0x1a')]));});});},'EventManager':function(_0x39140a){var _0x277a56=this;return new Promise(function(_0x47577f,_0x262952){if(!_0x39140a['event']){return _0x262952(_0x277a56[_0x041d('0x11')](0x1f4,_0x041d('0x7e')));}ami[_0x041d('0x7f')](_0x041d('0x80')+_0x39140a[_0x041d('0x81')],_0x39140a['message']);_0x47577f({'code':0xc8,'message':_0x39140a});});},'FaxAccounts':function(_0xd062d7){return new Promise(function(_0x48cfc6,_0x1e32ae){var _0x16d553=_[_0x041d('0x5d')](_0x3a22a4[_0x041d('0x82')]);_0x48cfc6({'count':_0x16d553[_0x041d('0x60')],'rows':_0x16d553});});},'SendFax':function(_0x1be9ae){var _0x16cc7d=this;return new Promise(function(_0x5ba3f5,_0x187223){_0x14907f[_0x041d('0x83')](_0x1be9ae)['then'](function(_0x33acbd){_0x5ba3f5({'code':0xc8,'message':_0x33acbd[_0x041d('0x1a')]});})[_0x041d('0x20')](function(_0x370f5c){_0x187223(_0x16cc7d[_0x041d('0x11')](0x1f4,_0x370f5c[_0x041d('0x1a')]));});});},'CheckAfterSend':function(_0x269866){var _0x256de8=this;return new Promise(function(_0x310417,_0x34d4da){_0x14907f['checkAfterSend'](_0x269866)['then'](function(_0x984cf){_0x310417({'code':0xc8,'message':_0x984cf['message']});})[_0x041d('0x20')](function(_0x5676db){_0x34d4da(_0x256de8[_0x041d('0x11')](0x1f4,_0x5676db[_0x041d('0x1a')]));});});}};var _0x4a097e=jayson[_0x041d('0x84')](_0x372840)[_0x041d('0x85')]();_0x4a097e['on'](_0x041d('0x11'),function(_0x2c90aa){return _0x5f083c(_0x2c90aa);});_0x4a097e[_0x041d('0x8')](0x232a,'127.0.0.1',function(){console[_0x041d('0x86')](_0x041d('0x87'),0x232a);return _0x196419(_0x041d('0x88')+0x232a);});});}; \ No newline at end of file +var _0x13f5=['predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','Trunk','active','Interval','push','length','find','undefined','channels','uniqueid','channel','format','%s.%s','filename','wav','MixMonitor','ai(mixmonitorid)','/var/spool/asterisk/monitor/','toLowerCase','YYYY-MM-DD\x20HH:mm:ss','mixmonitorid','rec','status','MixMonitor\x20Success','Channel\x20doesn\x27t\x20exist','voicechannel','map','resolve','StopMixMonitor','catch','destinationchannel','monitors','stop','StopMixMonitor\x20Success','values','queueChannels','voicequeuechannel','exten','context','telephones','outbound','campaigns','run','emit','event','faxAccounts','send','checkAfterSend','server','http','127.0.0.1','log','AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','lodash','util','jayson/promise','validate','moment','../ami','listen','%s/%s','SIP','name','timers','timer','agents','updateStatusRealtime','pause','QueuePause','isConnected','error','asterisk','username','join','keys','module','action','Reload','Action','message','ami\x20disconnected','command','Command','then','voiceQueues','answered','available','pTalking','sumHoldTime','talking','total','type','abandoned','waiting','loggedInDb','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateTimeout','temp','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate'];(function(_0x5e5ae4,_0xb1052d){var _0x230242=function(_0x1ac4ae){while(--_0x1ac4ae){_0x5e5ae4['push'](_0x5e5ae4['shift']());}};_0x230242(++_0xb1052d);}(_0x13f5,0xc3));var _0x513f=function(_0x46e363,_0x45d7e2){_0x46e363=_0x46e363-0x0;var _0x3fb059=_0x13f5[_0x46e363];return _0x3fb059;};'use strict';var _=require(_0x513f('0x0'));var util=require(_0x513f('0x1'));var jayson=require(_0x513f('0x2'));var schema=require(_0x513f('0x3'));var BPromise=require('bluebird');var moment=require(_0x513f('0x4'));var config=require('../../../config/environment');var properties=require('../properties');var ami=require(_0x513f('0x5'));exports[_0x513f('0x6')]=function(_0x3a9531,_0x3a6320,_0x8d019b){return new BPromise(function(_0x579681,_0x2be368){var _0x6e5b15={'QueuePause':function(_0x2c75a3){return new Promise(function(_0x42951f,_0x1975b5){var _0x4755cb=util['format'](_0x513f('0x7'),_0x513f('0x8'),_0x2c75a3[_0x513f('0x9')]);if(_0x3a9531[_0x513f('0xa')]&&_0x3a9531[_0x513f('0xa')][_0x4755cb]&&_0x3a9531['timers'][_0x4755cb][_0x513f('0xb')]){_0x3a9531[_0x513f('0xa')][_0x4755cb]['updateAcw']();}if(_0x3a9531[_0x513f('0xc')][_0x4755cb]){_0x3a9531[_0x513f('0xc')][_0x4755cb][_0x513f('0xd')]({'statePause':_0x2c75a3[_0x513f('0xe')]?!![]:![]});}_0x42951f({'code':0xc8,'message':_0x513f('0xf')});});},'Reload':function(_0xfb8469){var _0x2a0e99=this;return new Promise(function(_0x265cd7,_0x23153b){if(ami[_0x513f('0x10')]()==![]){return _0x23153b(_0x2a0e99[_0x513f('0x11')](0x1f4,[config[_0x513f('0x12')]['ip'],config[_0x513f('0x12')][_0x513f('0x13')],'ami\x20disconnected'][_0x513f('0x14')]('\x20')));}_0xfb8469=_['pick'](_0xfb8469,_[_0x513f('0x15')](properties[_0x513f('0x16')]));_0xfb8469[_0x513f('0x17')]=_0x513f('0x18');return ami[_0x513f('0x19')](_0xfb8469)['then'](function(_0x4e7dd3){_0x265cd7({'code':0xc8,'message':_0x4e7dd3[_0x513f('0x1a')]});})['catch'](function(_0x186121){_0x23153b(_0x2a0e99['error'](0x1f5,_0x186121[_0x513f('0x1a')]));});});},'Command':function(_0x1d4462){var _0x511ae0=this;return new Promise(function(_0x2a461f,_0x37ccea){if(ami[_0x513f('0x10')]()==![]){return _0x37ccea(_0x511ae0[_0x513f('0x11')](0x1f4,[config[_0x513f('0x12')]['ip'],config[_0x513f('0x12')]['username'],_0x513f('0x1b')][_0x513f('0x14')]('\x20')));}_0x1d4462=_['pick'](_0x1d4462,_0x513f('0x1c'));_0x1d4462[_0x513f('0x17')]=_0x513f('0x1d');return ami[_0x513f('0x19')](_0x1d4462)[_0x513f('0x1e')](function(_0x1eb0f4){_0x2a461f({'code':0xc8,'message':_0x1eb0f4['content']});})['catch'](function(_0x59de20){_0x37ccea(_0x511ae0[_0x513f('0x11')](0x1f5,_0x59de20[_0x513f('0x1a')]));});});},'VoiceQueues':function(_0xc3fa6f){return new Promise(function(_0x1069d4,_0x2191d4){var _0xabb40b=[];for(var _0x1624d2 in _0x3a9531[_0x513f('0x1f')]){if(_0x3a9531[_0x513f('0x1f')]['hasOwnProperty'](_0x1624d2)){var _0x509e63=_0x3a9531[_0x513f('0x1f')][_0x1624d2];var _0x27136f={'id':_0x509e63['id'],'name':_0x509e63[_0x513f('0x9')],'strategy':_0x509e63['strategy'],'answered':_0x509e63[_0x513f('0x20')],'available':_0x509e63[_0x513f('0x21')],'loggedIn':_0x509e63['loggedIn'],'pTalking':_0x509e63[_0x513f('0x22')],'sumBillable':_0x509e63['sumBillable'],'sumDuration':_0x509e63['sumDuration'],'sumHoldTime':_0x509e63[_0x513f('0x23')]||0x0,'talking':_0x509e63[_0x513f('0x24')],'total':_0x509e63[_0x513f('0x25')],'type':_0x509e63[_0x513f('0x26')],'unmanaged':_0x509e63['unmanaged'],'abandoned':_0x509e63[_0x513f('0x27')],'waiting':_0x509e63[_0x513f('0x28')],'loggedInDb':_0x509e63[_0x513f('0x29')]};if(_0x509e63[_0x513f('0x26')]==='outbound'){_0x27136f[_0x513f('0x2a')]=_0x509e63[_0x513f('0x2a')];_0x27136f[_0x513f('0x2b')]=_0x509e63[_0x513f('0x2b')];_0x27136f[_0x513f('0x2c')]=_0x509e63[_0x513f('0x2c')];_0x27136f['dialOriginateCallerIdNumber']=_0x509e63['dialOriginateCallerIdNumber'];_0x27136f[_0x513f('0x2d')]=_0x509e63[_0x513f('0x2d')];_0x27136f['dialPrefix']=_0x509e63['dialPrefix'];_0x27136f[_0x513f('0x2e')]=_0x509e63[_0x513f('0x2e')];_0x27136f[_0x513f('0x2f')]=_0x509e63['outboundAnswerAgiCallsDay'];_0x27136f[_0x513f('0x30')]=_0x509e63[_0x513f('0x30')];_0x27136f['outboundBlacklistCallsDay']=_0x509e63[_0x513f('0x31')];_0x27136f[_0x513f('0x32')]=_0x509e63[_0x513f('0x32')];_0x27136f[_0x513f('0x33')]=_0x509e63[_0x513f('0x33')];_0x27136f[_0x513f('0x34')]=_0x509e63[_0x513f('0x34')];_0x27136f[_0x513f('0x35')]=_0x509e63[_0x513f('0x35')];_0x27136f['outboundDropCallsDayTimeout']=_0x509e63[_0x513f('0x36')];_0x27136f['outboundNoAnswerCallsDay']=_0x509e63['outboundNoAnswerCallsDay'];_0x27136f[_0x513f('0x37')]=_0x509e63['outboundNoSuchCallsDay'];_0x27136f[_0x513f('0x38')]=_0x509e63[_0x513f('0x38')];_0x27136f['outboundReCallsDay']=_0x509e63[_0x513f('0x39')];_0x27136f['outboundRejectCallsDay']=_0x509e63['outboundRejectCallsDay'];_0x27136f[_0x513f('0x3a')]=_0x509e63[_0x513f('0x3a')];_0x27136f[_0x513f('0x3b')]=_0x509e63[_0x513f('0x3b')];_0x27136f[_0x513f('0x3c')]=_0x509e63['predictiveIntervalAvgHoldtime'];_0x27136f[_0x513f('0x3d')]=_0x509e63[_0x513f('0x3d')];_0x27136f['predictiveIntervalDroppedCallsCallersExit']=_0x509e63[_0x513f('0x3e')];_0x27136f[_0x513f('0x3f')]=_0x509e63[_0x513f('0x3f')];_0x27136f[_0x513f('0x40')]=_0x509e63[_0x513f('0x40')];_0x27136f['predictiveIntervalErlangCallsDroppedCalls']=_0x509e63[_0x513f('0x41')];_0x27136f[_0x513f('0x42')]=_0x509e63[_0x513f('0x42')];_0x27136f[_0x513f('0x43')]=_0x509e63['predictiveIntervalMultiplicativeFactor'];_0x27136f['predictiveIntervalPauses']=_0x509e63[_0x513f('0x44')];_0x27136f[_0x513f('0x45')]=_0x509e63[_0x513f('0x45')];_0x27136f[_0x513f('0x46')]=_0x509e63['predictiveIntervalTotalCalls'];_0x27136f['message']=_0x509e63[_0x513f('0x1a')];_0x27136f[_0x513f('0x47')]=_0x509e63[_0x513f('0x47')];_0x27136f[_0x513f('0x48')]=_0x509e63[_0x513f('0x48')];_0x27136f['erlangCallToSecond']=_0x509e63[_0x513f('0x49')];_0x27136f[_0x513f('0x4a')]=_0x509e63[_0x513f('0x4a')];_0x27136f['erlangBusyFactor']=_0x509e63[_0x513f('0x4b')];_0x27136f[_0x513f('0x4c')]=_0x509e63['startPredictive'];_0x27136f[_0x513f('0x4d')]=_0x509e63[_0x513f('0x4d')];}if(_0x509e63[_0x513f('0x4e')]){_0x27136f[_0x513f('0x4e')]={'id':_0x509e63[_0x513f('0x4e')]['id'],'name':_0x509e63['Trunk'][_0x513f('0x9')],'active':_0x509e63[_0x513f('0x4e')][_0x513f('0x4f')],'callerid':_0x509e63[_0x513f('0x4e')]['callerid']};}if(_0x509e63['Interval']){_0x27136f[_0x513f('0x50')]={'id':_0x509e63[_0x513f('0x50')]['id'],'name':_0x509e63[_0x513f('0x50')][_0x513f('0x9')]};}_0xabb40b[_0x513f('0x51')](_0x27136f);}}_0x1069d4({'count':_0xabb40b[_0x513f('0x52')],'rows':_0xabb40b});});},'UpdateVoiceQueue':function(_0x25b71b){return new Promise(function(_0x5a8988,_0x3dc022){var _0xa06dcb=_[_0x513f('0x53')](_0x3a9531['voiceQueues'],{'id':parseInt(_0x25b71b['id'])});var _0x1f21d2=_['omit'](_0x25b71b,['id']);if(_0xa06dcb){for(var _0x45263f in _0x1f21d2){if(typeof _0x1f21d2[_0x45263f]!=='undefined'&&typeof _0xa06dcb[_0x45263f]!==_0x513f('0x54')){_0xa06dcb[_0x45263f]=_0x1f21d2[_0x45263f];}}_0x5a8988(_0xa06dcb);}else{_0x3dc022();}});},'VoiceChannels':function(_0x4d2489){return new Promise(function(_0x202fa4,_0x43be3e){var _0x5e1076=_['values'](_0x3a9531[_0x513f('0x55')]);_0x202fa4({'count':_0x5e1076['length'],'rows':_0x5e1076});});},'VoiceChannelMixMonitor':function(_0x3495b2){var _0x216cb4=this;return new Promise(function(_0x52af64,_0x236ae6){if(ami[_0x513f('0x10')]()==![]){return _0x236ae6(_0x216cb4['error'](0x1f4,[config[_0x513f('0x12')]['ip'],config[_0x513f('0x12')]['username'],_0x513f('0x1b')]['join']('\x20')));}var _0x1a3d47=schema(properties['voicechannel'])[_0x513f('0x3')](_0x3495b2);if(_0x1a3d47['length']>0x0){return _0x236ae6(_0x216cb4[_0x513f('0x11')](0x1f4,_['map'](_0x1a3d47,_0x513f('0x1a'))['join'](',\x20')));}var _0xd7cf8=_['find'](_0x3a9531['channels'],{'uniqueid':_0x3495b2[_0x513f('0x56')]});if(_0xd7cf8&&_0xd7cf8[_0x513f('0x57')]){var _0x4a3b48=util[_0x513f('0x58')](_0x513f('0x59'),_0x3495b2[_0x513f('0x5a')]||_0x3495b2['uniqueid'],_0x3495b2[_0x513f('0x58')]||_0x513f('0x5b'));return ami[_0x513f('0x19')]({'action':_0x513f('0x5c'),'channel':_0xd7cf8['channel'],'file':_0x4a3b48,'options':_0x513f('0x5d')})[_0x513f('0x1e')](function(_0x4e8fe1){var _0x3d8649=_[_0x513f('0x53')](_0xd7cf8['monitors'],{'filename':_0x513f('0x5e')+_0x4a3b48[_0x513f('0x5f')]()});if(_['isNil'](_0x3d8649)){_0xd7cf8['monitors']['push']({'filename':_0x513f('0x5e')+_0x4a3b48['toLowerCase'](),'createdAt':moment()['format'](_0x513f('0x60')),'mixmonitorid':_0x4e8fe1[_0x513f('0x61')],'status':_0x513f('0x62')});}else{_0x3d8649[_0x513f('0x61')]=_0x4e8fe1[_0x513f('0x61')];_0x3d8649[_0x513f('0x63')]=_0x513f('0x62');}_0x52af64({'code':0xc8,'message':[_0x3495b2['uniqueid'],_0x513f('0x64'),_0x4e8fe1[_0x513f('0x61')]][_0x513f('0x14')]('\x20'),'mixmonitorid':_0x4e8fe1['mixmonitorid']});})['catch'](function(_0x1b273b){_0x236ae6(_0x216cb4[_0x513f('0x11')](0x1f5,[_0x3495b2[_0x513f('0x56')],_0x1b273b[_0x513f('0x1a')][_0x513f('0x5f')]()]['join']('\x20')));});}else{return _0x236ae6(_0x216cb4[_0x513f('0x11')](0x1f5,_0x513f('0x65')));}});},'VoiceChannelStopMixMonitor':function(_0x13b307){var _0xbbd05e=this;return new Promise(function(_0x17e9e1,_0x4dc7e8){if(ami['isConnected']()==![]){return _0x4dc7e8(_0xbbd05e[_0x513f('0x11')](0x1f4,[config[_0x513f('0x12')]['ip'],config[_0x513f('0x12')][_0x513f('0x13')],_0x513f('0x1b')]['join']('\x20')));}var _0x265cd9=schema(properties[_0x513f('0x66')])['validate'](_0x13b307);if(_0x265cd9[_0x513f('0x52')]>0x0){return _0x4dc7e8(_0xbbd05e[_0x513f('0x11')](0x1f4,_[_0x513f('0x67')](_0x265cd9,_0x513f('0x1a'))[_0x513f('0x14')](',\x20')));}var _0x5cedfb=_['find'](_0x3a9531[_0x513f('0x55')],{'uniqueid':_0x13b307[_0x513f('0x56')]});if(_0x5cedfb){return BPromise[_0x513f('0x68')]()[_0x513f('0x1e')](function(){if(_0x5cedfb[_0x513f('0x57')]){return ami[_0x513f('0x19')]({'action':_0x513f('0x69'),'channel':_0x5cedfb[_0x513f('0x57')],'mixmonitorid':_0x13b307[_0x513f('0x61')]})[_0x513f('0x6a')](function(_0x38b746){});}})[_0x513f('0x1e')](function(){if(_0x5cedfb[_0x513f('0x6b')]){return ami[_0x513f('0x19')]({'action':_0x513f('0x69'),'channel':_0x5cedfb[_0x513f('0x6b')],'mixmonitorid':_0x13b307[_0x513f('0x61')]})[_0x513f('0x6a')](function(_0x4a6122){});}})[_0x513f('0x1e')](function(_0xfaa42f){var _0x31ef24=_[_0x513f('0x53')](_0x5cedfb['monitors'],{'mixmonitorid':_0x13b307[_0x513f('0x61')]});if(_0x31ef24){_0x31ef24[_0x513f('0x63')]='stop';}})[_0x513f('0x1e')](function(){var _0x2c238b=util['format']('%s.%s',_0x13b307[_0x513f('0x5a')]||_0x13b307['uniqueid'],_0x13b307[_0x513f('0x58')]||'wav');var _0x20ee10=_[_0x513f('0x53')](_0x5cedfb[_0x513f('0x6c')],{'filename':_0x513f('0x5e')+_0x2c238b[_0x513f('0x5f')]()});if(_0x20ee10){_0x20ee10['status']=_0x513f('0x6d');}})['then'](function(){_0x17e9e1({'code':0xc8,'message':[_0x13b307[_0x513f('0x56')],_0x513f('0x6e')]['join']('\x20')});})[_0x513f('0x6a')](function(_0x13352b){_0x4dc7e8(_0xbbd05e[_0x513f('0x11')](0x1f5,[_0x13b307[_0x513f('0x56')],_0x13352b['message']['toLowerCase']()][_0x513f('0x14')]('\x20')));});}else{return _0x4dc7e8(_0xbbd05e['error'](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceQueuesChannels':function(_0x2f025b){return new Promise(function(_0x5c2352,_0x235daa){var _0x3d8012=_[_0x513f('0x6f')](_0x3a9531[_0x513f('0x70')]);_0x5c2352({'count':_0x3d8012[_0x513f('0x52')],'rows':_0x3d8012});});},'VoiceQueuesChannel':function(_0x1fdb84){var _0x1c56e4=this;return new Promise(function(_0x23cf6c,_0x4e6af3){var _0x135337=schema(properties[_0x513f('0x71')])[_0x513f('0x3')](_0x1fdb84);if(_0x135337[_0x513f('0x52')]>0x0){return _0x4e6af3(_0x1c56e4['error'](0x1f4,_[_0x513f('0x67')](_0x135337,_0x513f('0x1a'))[_0x513f('0x14')](',\x20')));}var _0x17de07=_[_0x513f('0x53')](_0x3a9531[_0x513f('0x70')],{'uniqueid':_0x1fdb84[_0x513f('0x56')]});if(_0x17de07){_0x23cf6c(_0x17de07);}else{return _0x4e6af3(_0x1c56e4[_0x513f('0x11')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceQueuesChannelHangup':function(_0x2be7cc){var _0x167620=this;return new Promise(function(_0x1eb9af,_0x33c93b){if(ami['isConnected']()==![]){return _0x33c93b(_0x167620[_0x513f('0x11')](0x1f4,[config[_0x513f('0x12')]['ip'],config[_0x513f('0x12')][_0x513f('0x13')],_0x513f('0x1b')][_0x513f('0x14')]('\x20')));}var _0x29e93e=schema(properties['voicequeuechannelhangup'])['validate'](_0x2be7cc);if(_0x29e93e[_0x513f('0x52')]>0x0){return _0x33c93b(_0x167620['error'](0x1f4,_[_0x513f('0x67')](_0x29e93e,_0x513f('0x1a'))[_0x513f('0x14')](',\x20')));}var _0xfdf4b2=_[_0x513f('0x53')](_0x3a9531[_0x513f('0x70')],{'uniqueid':_0x2be7cc[_0x513f('0x56')]});if(_0xfdf4b2&&_0xfdf4b2[_0x513f('0x57')]){return ami[_0x513f('0x19')]({'action':'Hangup','channel':_0xfdf4b2[_0x513f('0x57')]})[_0x513f('0x1e')](function(_0x2a30e7){_0x1eb9af({'code':0xc8,'message':[_0x2be7cc[_0x513f('0x56')],_0x2a30e7[_0x513f('0x1a')][_0x513f('0x5f')]()][_0x513f('0x14')]('\x20')});})['catch'](function(_0x183894){_0x33c93b(_0x167620[_0x513f('0x11')](0x1f5,[_0x2be7cc[_0x513f('0x56')],_0x183894[_0x513f('0x1a')][_0x513f('0x5f')]()][_0x513f('0x14')]('\x20')));});}else{return _0x33c93b(_0x167620[_0x513f('0x11')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceQueuesChannelRedirect':function(_0x5d570e){var _0x218d01=this;return new Promise(function(_0x471969,_0x42f6f2){if(ami['isConnected']()==![]){return _0x42f6f2(_0x218d01['error'](0x1f4,[config[_0x513f('0x12')]['ip'],config[_0x513f('0x12')]['username'],_0x513f('0x1b')][_0x513f('0x14')]('\x20')));}var _0x4ca855=schema(properties['voicequeuechannelredirect'])[_0x513f('0x3')](_0x5d570e);if(_0x4ca855['length']>0x0){return _0x42f6f2(_0x218d01[_0x513f('0x11')](0x1f4,_[_0x513f('0x67')](_0x4ca855,_0x513f('0x1a'))[_0x513f('0x14')](',\x20')));}var _0x46e1ea=_[_0x513f('0x53')](_0x3a9531[_0x513f('0x70')],{'uniqueid':_0x5d570e[_0x513f('0x56')]});if(_0x46e1ea&&_0x46e1ea[_0x513f('0x57')]){return ami[_0x513f('0x19')]({'action':'Redirect','channel':_0x46e1ea['channel'],'exten':_0x5d570e[_0x513f('0x72')],'context':_0x5d570e[_0x513f('0x73')]||_0x46e1ea[_0x513f('0x73')],'priority':0x1})[_0x513f('0x1e')](function(_0x5f3307){_0x471969({'code':0xc8,'message':[_0x5d570e[_0x513f('0x56')],_0x5f3307['message']['toLowerCase']()][_0x513f('0x14')]('\x20')});})[_0x513f('0x6a')](function(_0x573dc8){_0x42f6f2(_0x218d01[_0x513f('0x11')](0x1f5,[_0x5d570e[_0x513f('0x56')],_0x573dc8[_0x513f('0x1a')][_0x513f('0x5f')]()][_0x513f('0x14')]('\x20')));});}else{return _0x42f6f2(_0x218d01[_0x513f('0x11')](0x1f5,_0x513f('0x65')));}});},'Agents':function(_0xf66559){return new Promise(function(_0x334569,_0x46bd24){var _0x1f5eab=_['values'](_0x3a9531[_0x513f('0xc')]);_0x334569({'count':_0x1f5eab[_0x513f('0x52')],'rows':_0x1f5eab});});},'Telephones':function(_0x2b8579){return new Promise(function(_0x5d9981,_0x4b420d){var _0xc6403a=_['values'](_0x3a9531[_0x513f('0x74')]);_0x5d9981({'count':_0xc6403a['length'],'rows':_0xc6403a});});},'Trunks':function(_0x285f0c){return new Promise(function(_0x57f9a9,_0x51c5b9){var _0x335d82=_['values'](_0x3a9531['trunks']);_0x57f9a9({'count':_0x335d82['length'],'rows':_0x335d82});});},'OutboundChannels':function(_0x58f4e7){return new Promise(function(_0x3c81c5,_0x1788cc){var _0x58f6fb=_[_0x513f('0x6f')](_0x3a9531['outboundChannels']);_0x3c81c5({'count':_0x58f6fb['length'],'rows':_0x58f6fb});});},'Outbound':function(_0x5f3368){return new Promise(function(_0x3aee80,_0x4b7351){_0x3aee80(_0x3a9531[_0x513f('0x75')]);});},'Campaigns':function(_0x22675c){return new Promise(function(_0x5289f8,_0xb7657f){var _0x2cfac4=_[_0x513f('0x6f')](_0x3a9531[_0x513f('0x76')]);_0x5289f8({'count':_0x2cfac4[_0x513f('0x52')],'rows':_0x2cfac4});});},'VoiceQueuesPreview':function(_0x491a06){var _0x3a8797=this;return new Promise(function(_0x58918c,_0x5bc9cf){_0x3a6320[_0x513f('0x77')](_0x491a06['id'])[_0x513f('0x1e')](function(_0xa08bac){_0x58918c({'code':0xc8,'message':_0xa08bac[_0x513f('0x1a')]});})['catch'](function(_0x11aafc){_0x5bc9cf(_0x3a8797[_0x513f('0x11')](0x1f4,_0x11aafc['message']));});});},'EventManager':function(_0x3075f2){var _0xa64988=this;return new Promise(function(_0x1b0f54,_0x251911){if(!_0x3075f2['event']){return _0x251911(_0xa64988[_0x513f('0x11')](0x1f4,'Event\x20name\x20mandatory'));}ami[_0x513f('0x78')]('custom:'+_0x3075f2[_0x513f('0x79')],_0x3075f2[_0x513f('0x1a')]);_0x1b0f54({'code':0xc8,'message':_0x3075f2});});},'FaxAccounts':function(_0x7b6de1){return new Promise(function(_0x40d7ba,_0x20b2f5){var _0x791c0a=_[_0x513f('0x6f')](_0x3a9531[_0x513f('0x7a')]);_0x40d7ba({'count':_0x791c0a[_0x513f('0x52')],'rows':_0x791c0a});});},'SendFax':function(_0x21bae1){var _0x4735e9=this;return new Promise(function(_0x3eae3d,_0x5dd87c){_0x8d019b[_0x513f('0x7b')](_0x21bae1)[_0x513f('0x1e')](function(_0x4efad6){_0x3eae3d({'code':0xc8,'message':_0x4efad6[_0x513f('0x1a')]});})[_0x513f('0x6a')](function(_0x10671f){_0x5dd87c(_0x4735e9[_0x513f('0x11')](0x1f4,_0x10671f[_0x513f('0x1a')]));});});},'CheckAfterSend':function(_0x1d91fc){var _0x5d558a=this;return new Promise(function(_0x162786,_0xd42fe0){_0x8d019b[_0x513f('0x7c')](_0x1d91fc)[_0x513f('0x1e')](function(_0x2834a2){_0x162786({'code':0xc8,'message':_0x2834a2[_0x513f('0x1a')]});})[_0x513f('0x6a')](function(_0x42267c){_0xd42fe0(_0x5d558a[_0x513f('0x11')](0x1f4,_0x42267c[_0x513f('0x1a')]));});});}};var _0x46b4b8=jayson[_0x513f('0x7d')](_0x6e5b15)[_0x513f('0x7e')]();_0x46b4b8['on'](_0x513f('0x11'),function(_0x220ff4){return _0x2be368(_0x220ff4);});_0x46b4b8[_0x513f('0x6')](0x232a,_0x513f('0x7f'),function(){console[_0x513f('0x80')](_0x513f('0x81'),0x232a);return _0x579681(_0x513f('0x82')+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 e814664..4dc84ef 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 _0x9957=['updatedAt','resolve','then','getContacts','isEmpty','info','[CM][%s][%s]\x20Contact\x20found:%s','uniqueid','[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]','map','join','[CM][%s][%s]\x20Contact\x20not\x20found','data4','[CM][%s][%s]\x20Autocreate\x20enabled','isNil','firstName','calleridname','destcalleridname','','Unknown','createContact','push','[CM][%s][%s]\x20Contact\x20created:%s','[CM][%s][%s]\x20Autocreate\x20disabled','format','user:%s','name','trigger:%s','action','toLowerCase','merge','lodash','bluebird','ioredis','util','../../../../config/logger','trigger','../../rpc/cmContact','redis','localhost','socket.io-emitter','[CM][%s][%s]','stringify','emit','exec','data1','data2','data5','xmd-contactid','ListId','data3','split','$or','routeId','destcalleridnum','calleridnum','phone','createdAt'];(function(_0x4c98b9,_0x1ad11b){var _0x3a257a=function(_0x147857){while(--_0x147857){_0x4c98b9['push'](_0x4c98b9['shift']());}};_0x3a257a(++_0x1ad11b);}(_0x9957,0x93));var _0x7995=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x9957[_0x6131cd];return _0x47e916;};'use strict';var _=require(_0x7995('0x0'));var BPromise=require(_0x7995('0x1'));var Redis=require(_0x7995('0x2'));var util=require(_0x7995('0x3'));var config=require('../../../../config/environment');var logger=require(_0x7995('0x4'))(_0x7995('0x5'));var cmContactRpc=require(_0x7995('0x6'));config[_0x7995('0x7')]=_['defaults'](config[_0x7995('0x7')],{'host':_0x7995('0x8'),'port':0x18eb});var io=require(_0x7995('0x9'))(new Redis(config[_0x7995('0x7')]));function emit(_0xbda126,_0x326741,_0x4996ca,_0x465276,_0x1cad37){logger['info'](_0x7995('0xa'),_0xbda126,_0x326741['id'],_0x4996ca,_0x465276,JSON[_0x7995('0xb')](_0x1cad37));io['to'](_0x4996ca)[_0x7995('0xc')](_0x465276,_0x1cad37);}exports[_0x7995('0xd')]=function(_0x3c1d19,_0x1e400a,_0x341672,_0x524f7b){var _0x245143,_0x41c652;var _0x581f22={};var _0xb0c872=Number(_0x341672[_0x7995('0xe')]);var _0x19a27e=_0x341672[_0x7995('0xf')]?Boolean(Number(_0x341672[_0x7995('0xf')])):![];var _0x23999f;var _0x2bbe7a=![];if(!_['isNil'](_0x341672['data5'])){if(_0x341672[_0x7995('0x10')]=='1')_0x2bbe7a=!![];}if(!_0x2bbe7a){if(_0x524f7b[_0x7995('0x11')]){_0x581f22['id']=_0x524f7b[_0x7995('0x11')];}}if(!_0x581f22['id']){_0x581f22[_0x7995('0x12')]=_0xb0c872;_0x23999f=_0x341672[_0x7995('0x13')]&&_0x341672[_0x7995('0x13')]!=='0'?_0x341672[_0x7995('0x13')][_0x7995('0x14')](','):['phone'];_0x581f22[_0x7995('0x15')]=_['map'](_0x23999f,function(_0x2f832e){var _0x37f297={};_0x37f297[_0x2f832e]=_0x524f7b[_0x7995('0x16')]?_0x524f7b[_0x7995('0x17')]:_0x524f7b[_0x7995('0x18')];return _0x37f297;});}var _0x37a7d4=['id','firstName','lastName',_0x7995('0x19'),'mobile','fax',_0x7995('0x12'),_0x7995('0x1a'),'scheduledAt',_0x7995('0x1b')];var _0x51f276=_['union'](_0x37a7d4,_0x23999f);BPromise[_0x7995('0x1c')]()[_0x7995('0x1d')](cmContactRpc[_0x7995('0x1e')]({'attributes':_0x51f276,'where':_0x581f22}))[_0x7995('0x1d')](function(_0x460924){_0x41c652=_0x460924;if(!_[_0x7995('0x1f')](_0x41c652)){if(_0x41c652['length']===0x1){_0x245143=_0x41c652[0x0];logger[_0x7995('0x20')](_0x7995('0x21'),_0x524f7b[_0x7995('0x22')],_0x1e400a['id'],_0x245143['id']);}else{logger[_0x7995('0x20')](_0x7995('0x23'),_0x524f7b[_0x7995('0x22')],_0x1e400a['id'],_[_0x7995('0x24')](_0x41c652,'id')[_0x7995('0x25')](','));}return;}else{logger['info'](_0x7995('0x26'),_0x524f7b[_0x7995('0x22')],_0x1e400a['id']);var _0x401dc3={'ListId':_0xb0c872};var _0x268ce7=_0x341672[_0x7995('0x27')]&&_0x341672[_0x7995('0x27')]!=='0'?_0x341672['data4']:_0x7995('0x19');if(_0x19a27e){logger['info'](_0x7995('0x28'),_0x524f7b[_0x7995('0x22')],_0x1e400a['id']);_0x401dc3[_0x268ce7]=_[_0x7995('0x29')](_0x524f7b[_0x7995('0x16')])?_0x524f7b[_0x7995('0x18')]:_0x524f7b['destcalleridnum'];if(_[_0x7995('0x29')](_0x524f7b['routeId'])){_0x401dc3[_0x7995('0x2a')]=_0x524f7b[_0x7995('0x2b')]&&_0x524f7b[_0x7995('0x2b')]!==''?_0x524f7b['calleridname']:'Unknown';}else{_0x401dc3[_0x7995('0x2a')]=_0x524f7b[_0x7995('0x2c')]&&_0x524f7b[_0x7995('0x2c')]!==_0x7995('0x2d')?_0x524f7b[_0x7995('0x2c')]:_0x7995('0x2e');}return BPromise['resolve']()['then'](cmContactRpc[_0x7995('0x2f')](_0x401dc3))['then'](function(_0x553671){_0x245143=_0x553671;_0x41c652[_0x7995('0x30')](_0x553671);if(_0x245143){logger[_0x7995('0x20')](_0x7995('0x31'),_0x524f7b[_0x7995('0x22')],_0x1e400a['id'],_0x245143['id']);}return;});}else{logger['info'](_0x7995('0x32'),_0x524f7b[_0x7995('0x22')],_0x1e400a['id']);_0x401dc3[_0x268ce7]=_['isNil'](_0x524f7b['routeId'])?_0x524f7b['calleridnum']:_0x524f7b[_0x7995('0x17')];if(_[_0x7995('0x29')](_0x524f7b['routeId'])){_0x401dc3[_0x7995('0x2a')]=_0x524f7b['calleridname']&&_0x524f7b[_0x7995('0x2b')]!==_0x7995('0x2d')?_0x524f7b[_0x7995('0x2b')]:'Unknown';}else{_0x401dc3['firstName']=_0x524f7b[_0x7995('0x2c')]&&_0x524f7b['destcalleridname']!==''?_0x524f7b[_0x7995('0x2c')]:_0x7995('0x2e');}_0x245143=_0x401dc3;_0x41c652['push'](_0x401dc3);return;}}})[_0x7995('0x1d')](function(){if(_0x3c1d19){emit(_0x524f7b[_0x7995('0x22')],_0x1e400a,util[_0x7995('0x33')](_0x7995('0x34'),_0x3c1d19[_0x7995('0x35')]),util['format'](_0x7995('0x36'),_0x341672[_0x7995('0x37')][_0x7995('0x38')]()),{'evt':_[_0x7995('0x39')](_0x524f7b,{'autoCreate':_0x19a27e}),'contact':_0x245143===undefined?{}:_0x245143,'contacts':_0x41c652['length']===0x0?undefined:_0x41c652});}});}; \ No newline at end of file +var _0xeec6=['destcalleridnum','calleridnum','lastName','phone','mobile','fax','createdAt','updatedAt','union','resolve','then','getContacts','isEmpty','length','info','[CM][%s][%s]\x20Contact\x20found:%s','uniqueid','[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]','map','join','[CM][%s][%s]\x20Contact\x20not\x20found','data4','routeId','firstName','calleridname','','Unknown','destcalleridname','createContact','[CM][%s][%s]\x20Contact\x20created:%s','[CM][%s][%s]\x20Autocreate\x20disabled','push','name','format','trigger:%s','action','toLowerCase','lodash','bluebird','ioredis','util','../../../../config/logger','trigger','../../rpc/cmContact','redis','defaults','socket.io-emitter','[CM][%s][%s]','stringify','emit','data1','data2','isNil','data5','xmd-contactid','ListId','data3','split','$or'];(function(_0x2e584e,_0xfb1ab8){var _0x44e53a=function(_0xed31d2){while(--_0xed31d2){_0x2e584e['push'](_0x2e584e['shift']());}};_0x44e53a(++_0xfb1ab8);}(_0xeec6,0x1c2));var _0x6eec=function(_0x279368,_0x41c002){_0x279368=_0x279368-0x0;var _0x40b6d0=_0xeec6[_0x279368];return _0x40b6d0;};'use strict';var _=require(_0x6eec('0x0'));var BPromise=require(_0x6eec('0x1'));var Redis=require(_0x6eec('0x2'));var util=require(_0x6eec('0x3'));var config=require('../../../../config/environment');var logger=require(_0x6eec('0x4'))(_0x6eec('0x5'));var cmContactRpc=require(_0x6eec('0x6'));config[_0x6eec('0x7')]=_[_0x6eec('0x8')](config[_0x6eec('0x7')],{'host':'localhost','port':0x18eb});var io=require(_0x6eec('0x9'))(new Redis(config[_0x6eec('0x7')]));function emit(_0x48064a,_0x5a5e47,_0x1c810e,_0x3443c2,_0x834c2){logger['info'](_0x6eec('0xa'),_0x48064a,_0x5a5e47['id'],_0x1c810e,_0x3443c2,JSON[_0x6eec('0xb')](_0x834c2));io['to'](_0x1c810e)[_0x6eec('0xc')](_0x3443c2,_0x834c2);}exports['exec']=function(_0x595dd4,_0x5e8aba,_0x295cae,_0xfbcfa1){var _0x51a9e3,_0x4b8de1;var _0x1cc8d3={};var _0x485b5b=Number(_0x295cae[_0x6eec('0xd')]);var _0x3387c2=_0x295cae[_0x6eec('0xe')]?Boolean(Number(_0x295cae[_0x6eec('0xe')])):![];var _0x3fe3bc;var _0x49fccb=![];if(!_[_0x6eec('0xf')](_0x295cae[_0x6eec('0x10')])){if(_0x295cae[_0x6eec('0x10')]=='1')_0x49fccb=!![];}if(!_0x49fccb){if(_0xfbcfa1[_0x6eec('0x11')]){_0x1cc8d3['id']=_0xfbcfa1[_0x6eec('0x11')];}}if(!_0x1cc8d3['id']){_0x1cc8d3[_0x6eec('0x12')]=_0x485b5b;_0x3fe3bc=_0x295cae[_0x6eec('0x13')]&&_0x295cae[_0x6eec('0x13')]!=='0'?_0x295cae[_0x6eec('0x13')][_0x6eec('0x14')](','):['phone'];_0x1cc8d3[_0x6eec('0x15')]=_['map'](_0x3fe3bc,function(_0x38c9a4){var _0x45aa3f={};_0x45aa3f[_0x38c9a4]=_0xfbcfa1['routeId']?_0xfbcfa1[_0x6eec('0x16')]:_0xfbcfa1[_0x6eec('0x17')];return _0x45aa3f;});}var _0xb1eab7=['id','firstName',_0x6eec('0x18'),_0x6eec('0x19'),_0x6eec('0x1a'),_0x6eec('0x1b'),_0x6eec('0x12'),_0x6eec('0x1c'),'scheduledAt',_0x6eec('0x1d')];var _0x2f843e=_[_0x6eec('0x1e')](_0xb1eab7,_0x3fe3bc);BPromise[_0x6eec('0x1f')]()[_0x6eec('0x20')](cmContactRpc[_0x6eec('0x21')]({'attributes':_0x2f843e,'where':_0x1cc8d3}))['then'](function(_0x6e40b3){_0x4b8de1=_0x6e40b3;if(!_[_0x6eec('0x22')](_0x4b8de1)){if(_0x4b8de1[_0x6eec('0x23')]===0x1){_0x51a9e3=_0x4b8de1[0x0];logger[_0x6eec('0x24')](_0x6eec('0x25'),_0xfbcfa1[_0x6eec('0x26')],_0x5e8aba['id'],_0x51a9e3['id']);}else{logger['info'](_0x6eec('0x27'),_0xfbcfa1[_0x6eec('0x26')],_0x5e8aba['id'],_[_0x6eec('0x28')](_0x4b8de1,'id')[_0x6eec('0x29')](','));}return;}else{logger[_0x6eec('0x24')](_0x6eec('0x2a'),_0xfbcfa1[_0x6eec('0x26')],_0x5e8aba['id']);var _0x20bed3={'ListId':_0x485b5b};var _0x316317=_0x295cae['data4']&&_0x295cae[_0x6eec('0x2b')]!=='0'?_0x295cae[_0x6eec('0x2b')]:_0x6eec('0x19');if(_0x3387c2){logger[_0x6eec('0x24')]('[CM][%s][%s]\x20Autocreate\x20enabled',_0xfbcfa1[_0x6eec('0x26')],_0x5e8aba['id']);_0x20bed3[_0x316317]=_[_0x6eec('0xf')](_0xfbcfa1['routeId'])?_0xfbcfa1['calleridnum']:_0xfbcfa1[_0x6eec('0x16')];if(_['isNil'](_0xfbcfa1[_0x6eec('0x2c')])){_0x20bed3[_0x6eec('0x2d')]=_0xfbcfa1[_0x6eec('0x2e')]&&_0xfbcfa1[_0x6eec('0x2e')]!==_0x6eec('0x2f')?_0xfbcfa1[_0x6eec('0x2e')]:_0x6eec('0x30');}else{_0x20bed3[_0x6eec('0x2d')]=_0xfbcfa1[_0x6eec('0x31')]&&_0xfbcfa1[_0x6eec('0x31')]!==''?_0xfbcfa1[_0x6eec('0x31')]:'Unknown';}return BPromise[_0x6eec('0x1f')]()[_0x6eec('0x20')](cmContactRpc[_0x6eec('0x32')](_0x20bed3))['then'](function(_0x57b40b){_0x51a9e3=_0x57b40b;_0x4b8de1['push'](_0x57b40b);if(_0x51a9e3){logger[_0x6eec('0x24')](_0x6eec('0x33'),_0xfbcfa1[_0x6eec('0x26')],_0x5e8aba['id'],_0x51a9e3['id']);}return;});}else{logger[_0x6eec('0x24')](_0x6eec('0x34'),_0xfbcfa1[_0x6eec('0x26')],_0x5e8aba['id']);_0x20bed3[_0x316317]=_[_0x6eec('0xf')](_0xfbcfa1[_0x6eec('0x2c')])?_0xfbcfa1[_0x6eec('0x17')]:_0xfbcfa1[_0x6eec('0x16')];if(_[_0x6eec('0xf')](_0xfbcfa1[_0x6eec('0x2c')])){_0x20bed3['firstName']=_0xfbcfa1[_0x6eec('0x2e')]&&_0xfbcfa1[_0x6eec('0x2e')]!==_0x6eec('0x2f')?_0xfbcfa1['calleridname']:_0x6eec('0x30');}else{_0x20bed3[_0x6eec('0x2d')]=_0xfbcfa1[_0x6eec('0x31')]&&_0xfbcfa1[_0x6eec('0x31')]!==_0x6eec('0x2f')?_0xfbcfa1[_0x6eec('0x31')]:'Unknown';}_0x51a9e3=_0x20bed3;_0x4b8de1[_0x6eec('0x35')](_0x20bed3);return;}}})[_0x6eec('0x20')](function(){if(_0x595dd4){emit(_0xfbcfa1[_0x6eec('0x26')],_0x5e8aba,util['format']('user:%s',_0x595dd4[_0x6eec('0x36')]),util[_0x6eec('0x37')](_0x6eec('0x38'),_0x295cae[_0x6eec('0x39')][_0x6eec('0x3a')]()),{'evt':_['merge'](_0xfbcfa1,{'autoCreate':_0x3387c2}),'contact':_0x51a9e3===undefined?{}:_0x51a9e3,'contacts':_0x4b8de1[_0x6eec('0x23')]===0x0?undefined:_0x4b8de1});}});}; \ No newline at end of file diff --git a/server/services/ami/trigger/index.js b/server/services/ami/trigger/index.js index 8ce8ff0..c2f5971 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 _0xcf54=['800','data5','data6','600','winApplication','format','user:%s','trigger:%s:%s','jscripty','name','trigger:%s','integration','exec','queue','routeId','script','parse','query','search','replace','channel','AllConditions','AnyConditions','checkConditions','account','chat','ChatWebsiteId','operator','value','upperFirst','AccountId','interaction','event','agent','membername','lastevent','mailSubstatus','null','undefined','offlineMessage','created','equals','exports','lodash','url','mustache','ioredis','./urlforward','./integration','./cmContact','../../../config/environment','../../../config/logger','trigger','../ami','redis','localhost','winapp','agents','voiceQueues','voiceExtensions','zendeskAccounts','freshdeskAccounts','salesforceAccounts','sugarcrmAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','accounts','custom:agentcalled','syncCustomEvent','bind','custom:agentconnect','custom:agentringnoanswer','custom:agentcomplete','custom:agentnosuchnumber','custom:agentnoanswer','custom:agentbusy','custom:agentcongestion','custom:agentreject','custom:amd','custom:timeout','custom:dialconnect','custom:dialend','custom:closedinteraction','custom:substatus','custom:incomingmessage','custom:outgoingmessage','custom:rejectmessage','prototype','info','stringify','emit','clone','motionChannel','syncAgentDial','interface','triggers','hasOwnProperty','status','checkTrigger','merge','variables','Actions','length','action','toLowerCase','motionbar','browser','data1','popup','TemplateId','data2','templates','render','template\x20not\x20found','uri','buildUri','isNil','data3','data4','uriLocation','windowWidth'];(function(_0x6bb70,_0x15de47){var _0x7fee08=function(_0x1e3df7){while(--_0x1e3df7){_0x6bb70['push'](_0x6bb70['shift']());}};_0x7fee08(++_0x15de47);}(_0xcf54,0x125));var _0x4cf5=function(_0x3358ba,_0x24c5fc){_0x3358ba=_0x3358ba-0x0;var _0x296e73=_0xcf54[_0x3358ba];return _0x296e73;};'use strict';var util=require('util');var _=require(_0x4cf5('0x0'));var url=require(_0x4cf5('0x1'));var Mustache=require(_0x4cf5('0x2'));var Redis=require(_0x4cf5('0x3'));var urlforward=require(_0x4cf5('0x4'));var integration=require(_0x4cf5('0x5'));var cmContact=require(_0x4cf5('0x6'));var script=require('./script');var config=require(_0x4cf5('0x7'));var logger=require(_0x4cf5('0x8'))(_0x4cf5('0x9'));var ami=require(_0x4cf5('0xa'));config[_0x4cf5('0xb')]=_['defaults'](config[_0x4cf5('0xb')],{'host':_0x4cf5('0xc'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));var operators={'equals':function(_0x16a089,_0x4f33e6){return _0x16a089==_0x4f33e6;},'not_equals':function(_0x3c7c38,_0xe25cc7){return _0x3c7c38!=_0xe25cc7;}};var barAndWebActions=['popup',_0x4cf5('0x1'),_0x4cf5('0xd')];function Trigger(_0x399a47){this['triggers']=_0x399a47['triggers'];this['agents']=_0x399a47[_0x4cf5('0xe')];this[_0x4cf5('0xf')]=_0x399a47[_0x4cf5('0xf')];this['templates']=_0x399a47['templates'];this[_0x4cf5('0x10')]=_0x399a47[_0x4cf5('0x10')];this[_0x4cf5('0x11')]=_0x399a47[_0x4cf5('0x11')];this[_0x4cf5('0x12')]=_0x399a47[_0x4cf5('0x12')];this[_0x4cf5('0x13')]=_0x399a47[_0x4cf5('0x13')];this[_0x4cf5('0x14')]=_0x399a47[_0x4cf5('0x14')];this[_0x4cf5('0x15')]=_0x399a47['zohoAccounts'];this[_0x4cf5('0x16')]=_0x399a47[_0x4cf5('0x16')];this['vtigerAccounts']=_0x399a47[_0x4cf5('0x17')];this[_0x4cf5('0x18')]=_0x399a47[_0x4cf5('0x18')];this[_0x4cf5('0x19')]=_0x399a47[_0x4cf5('0x19')];this[_0x4cf5('0x1a')]=_0x399a47['freshsalesAccounts'];this[_0x4cf5('0x1b')]={'zendesk':this[_0x4cf5('0x11')],'salesforce':this[_0x4cf5('0x13')],'freshdesk':this['freshdeskAccounts'],'sugarcrm':this[_0x4cf5('0x14')],'zoho':this['zohoAccounts'],'desk':this[_0x4cf5('0x16')],'vtiger':this['vtigerAccounts'],'dynamics365':this[_0x4cf5('0x19')],'freshsales':this[_0x4cf5('0x1a')],'servicenow':this[_0x4cf5('0x18')]};ami['on'](_0x4cf5('0x1c'),this[_0x4cf5('0x1d')][_0x4cf5('0x1e')](this));ami['on'](_0x4cf5('0x1f'),this[_0x4cf5('0x1d')]['bind'](this));ami['on'](_0x4cf5('0x20'),this['syncCustomEvent'][_0x4cf5('0x1e')](this));ami['on'](_0x4cf5('0x21'),this[_0x4cf5('0x1d')][_0x4cf5('0x1e')](this));ami['on'](_0x4cf5('0x22'),this[_0x4cf5('0x1d')][_0x4cf5('0x1e')](this));ami['on'](_0x4cf5('0x23'),this[_0x4cf5('0x1d')][_0x4cf5('0x1e')](this));ami['on'](_0x4cf5('0x24'),this['syncCustomEvent'][_0x4cf5('0x1e')](this));ami['on'](_0x4cf5('0x25'),this[_0x4cf5('0x1d')][_0x4cf5('0x1e')](this));ami['on'](_0x4cf5('0x26'),this[_0x4cf5('0x1d')][_0x4cf5('0x1e')](this));ami['on'](_0x4cf5('0x27'),this[_0x4cf5('0x1d')][_0x4cf5('0x1e')](this));ami['on']('custom:queuecallerabandon',this[_0x4cf5('0x1d')][_0x4cf5('0x1e')](this));ami['on'](_0x4cf5('0x28'),this[_0x4cf5('0x1d')]['bind'](this));ami['on']('custom:dialbegin',this['syncAgentDial']['bind'](this));ami['on'](_0x4cf5('0x29'),this['syncAgentDial'][_0x4cf5('0x1e')](this));ami['on'](_0x4cf5('0x2a'),this['syncAgentDial'][_0x4cf5('0x1e')](this));ami['on']('custom:newinteraction',this[_0x4cf5('0x1d')][_0x4cf5('0x1e')](this));ami['on'](_0x4cf5('0x2b'),this[_0x4cf5('0x1d')]['bind'](this));ami['on'](_0x4cf5('0x2c'),this[_0x4cf5('0x1d')][_0x4cf5('0x1e')](this));ami['on'](_0x4cf5('0x2d'),this[_0x4cf5('0x1d')][_0x4cf5('0x1e')](this));ami['on'](_0x4cf5('0x2e'),this[_0x4cf5('0x1d')][_0x4cf5('0x1e')](this));ami['on']('custom:acceptmessage',this[_0x4cf5('0x1d')]['bind'](this));ami['on'](_0x4cf5('0x2f'),this[_0x4cf5('0x1d')]['bind'](this));ami['on']('custom:offlineMessage',this[_0x4cf5('0x1d')][_0x4cf5('0x1e')](this));}Trigger[_0x4cf5('0x30')]['emit']=function(_0x573dc7,_0x4d919c,_0x10b7cb){logger[_0x4cf5('0x31')](_0x573dc7,_0x4d919c,JSON[_0x4cf5('0x32')](_0x10b7cb));io['to'](_0x573dc7)[_0x4cf5('0x33')](_0x4d919c,_0x10b7cb);};Trigger['prototype'][_0x4cf5('0x1d')]=function(_0x56af03){var _0x1d7580=_[_0x4cf5('0x34')](_0x56af03);if(typeof _0x1d7580['motionChannel']==='undefined'){_0x1d7580[_0x4cf5('0x35')]='voice';}this['checkTriggers'](_0x1d7580);};Trigger['prototype'][_0x4cf5('0x36')]=function(_0x6013f1){if(this[_0x4cf5('0xe')][_0x6013f1[_0x4cf5('0x37')]]){this['syncCustomEvent'](_0x6013f1);}};Trigger['prototype']['checkTriggers']=function(_0x3f9233){var _0x1c753f;for(var _0x237bf6 in this[_0x4cf5('0x38')]){if(this[_0x4cf5('0x38')][_0x4cf5('0x39')](_0x237bf6)){if(this[_0x4cf5('0x38')][_0x237bf6][_0x4cf5('0x3a')]){_0x1c753f=this[_0x4cf5('0x3b')](this[_0x4cf5('0x38')][_0x237bf6],_0x3f9233);if(_0x1c753f){_[_0x4cf5('0x3c')](_0x3f9233,_0x3f9233[_0x4cf5('0x3d')]);for(var _0x424188=0x0,_0x4887b3,_0x4f908d,_0x315ce5;_0x4241880x0){_0x1c9f6b=_['map'](_0x430d55,_0x28814f);}return _0x1c9f6b;}function getCustomFields(_0x1377b0,_0x22f6b6){var _0x1b8388=[];var _0x201941={'custom_fields':{}};if(_0x1377b0[_0xa55c('0x28')]>0x0){_[_0xa55c('0x29')](_0x1377b0,function(_0x52d37f){if(_[_0xa55c('0x2a')](['string',_0xa55c('0x2b')],_0x52d37f[_0xa55c('0x2c')])&&_0x52d37f[_0xa55c('0x2d')]&&!_0x52d37f[_0xa55c('0x2e')]){_0x201941[_0x52d37f['nameField'][_0xa55c('0x2f')]()]=_0x52d37f[_0xa55c('0x30')][_0xa55c('0x1f')]();}else if(_[_0xa55c('0x2a')]([_0xa55c('0x31'),_0xa55c('0x2b')],_0x52d37f[_0xa55c('0x2c')])&&_0x52d37f[_0xa55c('0x32')]&&_0x52d37f[_0xa55c('0x2e')]){_0x201941[_0xa55c('0x33')][_0x52d37f[_0xa55c('0x32')]]=_0x52d37f['content']['toString']();}else if(_0x52d37f[_0xa55c('0x2c')]===_0xa55c('0x34')&&_0x52d37f['variableName']&&_0x52d37f[_0xa55c('0x32')]&&_0x52d37f[_0xa55c('0x2e')]){_0x22f6b6[_0x52d37f[_0xa55c('0x35')]]&&(_0x201941[_0xa55c('0x33')][_0x52d37f[_0xa55c('0x32')]]=_0x22f6b6[_0x52d37f[_0xa55c('0x35')]][_0xa55c('0x1f')]());}else if(_0x52d37f[_0xa55c('0x2c')]===_0xa55c('0x36')&&_0x52d37f['Variable']&&_0x52d37f['Variable']['name']&&_0x52d37f[_0xa55c('0x32')]&&_0x52d37f[_0xa55c('0x2e')]){_0x22f6b6[_0x52d37f[_0xa55c('0x37')]['name'][_0xa55c('0x2f')]()]&&(_0x201941['custom_fields'][_0x52d37f[_0xa55c('0x32')]]=_0x22f6b6[_0x52d37f['Variable'][_0xa55c('0x38')][_0xa55c('0x2f')]()][_0xa55c('0x1f')]());}});}if(_0x201941['priority']){_0x201941[_0xa55c('0x39')]=Number(_0x201941[_0xa55c('0x39')]);}return _0x201941;}function getTicket(_0x47e93c,_0x6f9c4c,_0x194e78,_0x4d9083,_0x529ff8){logger[_0xa55c('0xb')]('Creating\x20new\x20ticket...');var _0x1e75dc=_[_0xa55c('0x3a')]({'subject':intUtil['getString'](_0x4d9083['Subjects'],_0x529ff8,'\x20'),'type':'phone','status':'new','labels':[_0xa55c('0x3b'),_0xa55c('0x3c'),_0xa55c('0x3d')][_0xa55c('0x3e')](getTags(_0x4d9083[_0xa55c('0x3f')],'name')),'description':intUtil[_0xa55c('0x40')](_0x4d9083[_0xa55c('0x41')],_0x529ff8,'\x0a'),'_links':{'assigned_user':{'href':util[_0xa55c('0xd')](_0xa55c('0x42'),_0x6f9c4c['id']),'class':_0xa55c('0x43')}},'message':{'direction':'in','body':intUtil[_0xa55c('0x40')](_0x4d9083['Descriptions'],_0x529ff8,'\x0a')}},getCustomFields(_0x4d9083[_0xa55c('0x44')],_0x529ff8));return request({'uri':util['format']('%s/customers/%d/cases',_0x47e93c[_0xa55c('0xf')],_0x194e78['id']),'method':_0xa55c('0x27'),'body':_0x1e75dc});}exports['queue']=function(_0x2bd98b,_0x508bd3,_0x5f25f7,_0x2f8449,_0x3fea03,_0x1630ac){var _0x540337,_0x1b2708;_0x1630ac[_0xa55c('0xf')]=intUtil['stripTrailingSlash'](_0x1630ac[_0xa55c('0xf')]);_0x1630ac['serverUrl']=intUtil[_0xa55c('0x45')](_0x1630ac[_0xa55c('0x46')]);if(_0x3fea03&&_0x3fea03['monitor_format']){logger[_0xa55c('0xb')](_0xa55c('0x47'),'Recording\x20is\x20enabled!');_0x508bd3[_0xa55c('0x48')]=util[_0xa55c('0xd')](_0xa55c('0x49'),_0x1630ac['serverUrl'],_0x508bd3[_0xa55c('0x4a')],md5(_0x508bd3['uniqueid']));}else{_0x508bd3[_0xa55c('0x48')]='';}headers[_0xa55c('0x4b')]=getAuth(_0x1630ac);return getUser(_0x1630ac,_0x2f8449[_0xa55c('0x4c')])['then'](function(_0x41eab1){_0x540337=_0x41eab1;logger[_0xa55c('0xb')]('The\x20User\x20ID\x20is:',_0x540337['id']);return getEndUser(_0x1630ac,_0x508bd3[_0xa55c('0x4d')],_0x508bd3[_0xa55c('0x4e')]);})['then'](function(_0x11ff1d){_0x1b2708=_0x11ff1d;logger[_0xa55c('0xb')]('The\x20Enduser\x20ID\x20is:',_0x1b2708['id']);return getTicket(_0x1630ac,_0x540337,_0x1b2708,_0x5f25f7,_0x508bd3);})[_0xa55c('0x10')](function(_0x81cee8){if(_0x81cee8){logger[_0xa55c('0xb')](_0xa55c('0x4f'));logger['info'](_0xa55c('0x50'),_0x81cee8['id']);switch(_0x1630ac['type']){case _0xa55c('0x51'):logger[_0xa55c('0xb')](_0xa55c('0x47'),'Displaying\x20ticket\x20to\x20agent...');emit(util[_0xa55c('0xd')](_0xa55c('0x52'),_0x2f8449['name']),_0xa55c('0x53'),{'recordId':_0x81cee8['id']});break;case _0xa55c('0x54'):logger[_0xa55c('0xb')](_0xa55c('0x47'),_0xa55c('0x55'));emit(util[_0xa55c('0xd')](_0xa55c('0x52'),_0x2f8449[_0xa55c('0x38')]),_0xa55c('0x56'),{'uri':util[_0xa55c('0xd')]('https://xcally.desk.com/web/agent/case/%d',_0x81cee8['id'])});break;default:logger[_0xa55c('0x57')](_0xa55c('0x47'),_0xa55c('0x58'));}}})['catch'](function(_0x4c3095){console[_0xa55c('0x57')](_0x4c3095);logger['error'](_0xa55c('0x47'),JSON['stringify'](_0x4c3095));});};exports[_0xa55c('0x59')]=function(_0x228df4,_0x181802,_0x3f9313,_0x2ecf79,_0x5b1cf3,_0x44b7c1,_0x4607ca){var _0x4b85cc,_0x3929a6;_0x44b7c1[_0xa55c('0xf')]=intUtil[_0xa55c('0x45')](_0x44b7c1[_0xa55c('0xf')]);_0x44b7c1['serverUrl']=intUtil['stripTrailingSlash'](_0x44b7c1[_0xa55c('0x46')]);if(_0x4607ca&&_0x4607ca[_0xa55c('0x5a')]&&_0x4607ca[_0xa55c('0x5a')]!==_0xa55c('0x5b')){logger['info'](_0xa55c('0x5c'),'Recording\x20is\x20enabled!');_0x181802[_0xa55c('0x48')]=util[_0xa55c('0xd')](_0xa55c('0x49'),_0x44b7c1[_0xa55c('0x46')],_0x181802[_0xa55c('0x4a')],md5(_0x181802['uniqueid']));}headers[_0xa55c('0x4b')]=getAuth(_0x44b7c1);return getUser(_0x44b7c1,_0x2ecf79['email'])[_0xa55c('0x10')](function(_0x157afe){_0x4b85cc=_0x157afe;logger[_0xa55c('0xb')](_0xa55c('0x5d'),_0x4b85cc['id']);return getEndUser(_0x44b7c1,_0x181802[_0xa55c('0x5e')],_0x181802[_0xa55c('0x5f')]);})[_0xa55c('0x10')](function(_0x53e2be){_0x3929a6=_0x53e2be;logger[_0xa55c('0xb')](_0xa55c('0x60'),_0x3929a6['id']);return getTicket(_0x44b7c1,_0x4b85cc,_0x3929a6,_0x3f9313,_0x181802);})[_0xa55c('0x10')](function(_0x23a30e){if(_0x23a30e){logger[_0xa55c('0xb')]('Ticket\x20created!');logger[_0xa55c('0xb')](_0xa55c('0x50'),_0x23a30e['id']);switch(_0x44b7c1[_0xa55c('0x2c')]){case _0xa55c('0x51'):logger[_0xa55c('0xb')]('[QUEUE]',_0xa55c('0x61'));emit(util[_0xa55c('0xd')](_0xa55c('0x52'),_0x2ecf79[_0xa55c('0x38')]),_0xa55c('0x53'),{'recordId':_0x23a30e['id']});break;case'newTab':logger[_0xa55c('0xb')]('[QUEUE]',_0xa55c('0x55'));emit(util['format'](_0xa55c('0x52'),_0x2ecf79['name']),_0xa55c('0x56'),{'uri':util[_0xa55c('0xd')](_0xa55c('0x62'),_0x44b7c1[_0xa55c('0xf')],_0x23a30e['id'])});break;default:logger[_0xa55c('0x57')](_0xa55c('0x5c'),_0xa55c('0x58'));}}})[_0xa55c('0x63')](function(_0x14b515){logger[_0xa55c('0x57')]('[OUTBOUND]',JSON[_0xa55c('0x17')](_0x14b515));});};exports[_0xa55c('0x64')]=function(_0x4ef914,_0x18b928,_0x2b8b88,_0x3e3b4b,_0x9fe234,_0x1b8b06){var _0xa38271,_0x3cef1f;_0x1b8b06[_0xa55c('0xf')]=intUtil['stripTrailingSlash'](_0x1b8b06[_0xa55c('0xf')]);_0x1b8b06[_0xa55c('0x46')]=intUtil[_0xa55c('0x45')](_0x1b8b06[_0xa55c('0x46')]);if(_0x9fe234&&_0x9fe234[_0xa55c('0x65')]){logger[_0xa55c('0xb')]('['+_0x18b928[_0xa55c('0x66')][_0xa55c('0x67')]()+']',_0xa55c('0x68'));_0x18b928['recordingURL']=util[_0xa55c('0xd')](_0xa55c('0x49'),_0x1b8b06[_0xa55c('0x46')],_0x18b928[_0xa55c('0x4a')],md5(_0x18b928[_0xa55c('0x4a')]));}else{_0x18b928[_0xa55c('0x48')]='';}headers[_0xa55c('0x4b')]=getAuth(_0x1b8b06);return getUser(_0x1b8b06)[_0xa55c('0x10')](function(_0x2e4cf7){_0xa38271=_0x2e4cf7;logger[_0xa55c('0xb')](_0xa55c('0x5d'),_0xa38271['id']);return getEndUser(_0x1b8b06,_0x18b928['calleridname'],_0x18b928[_0xa55c('0x4e')]);})['then'](function(_0x1228a4){_0x3cef1f=_0x1228a4;logger[_0xa55c('0xb')](_0xa55c('0x60'),_0x3cef1f['id']);return getTicket(_0x1b8b06,_0xa38271,_0x3cef1f,_0x2b8b88,_0x18b928);})['then'](function(_0x4d9722){if(_0x4d9722){logger[_0xa55c('0xb')](_0xa55c('0x4f'));logger[_0xa55c('0xb')](_0xa55c('0x50'),_0x4d9722['id']);}})['catch'](function(_0x149cb9){logger[_0xa55c('0x57')]('['+_0x18b928[_0xa55c('0x66')][_0xa55c('0x67')]()+']',JSON[_0xa55c('0x17')](_0x149cb9));});}; \ No newline at end of file +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(_0x3511d3,_0x4107ae){var _0x5d6321=function(_0x1a23da){while(--_0x1a23da){_0x3511d3['push'](_0x3511d3['shift']());}};_0x5d6321(++_0x4107ae);}(_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 0aee5b9..c72398a 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 _0xe1cb=['catch','error',']\x20Wrong\x20credentials!','message','systemusers?$select=internalemailaddress,isdisabled,systemuserid','Bearer\x20','4.0','value','isNil','email','length','info','toUpperCase',']\x20Agent\x20found\x20','systemuserid','userId',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','username','toLowerCase','outbound','destcalleridnum','calleridnum','contacts','headers','odata-entityid','substring','lastIndexOf','enduserId','GET','contacts?$select=telephone1&$filter=telephone1\x20eq\x20\x27','replace','%2b','nothing',']\x20Enduser\x20created!','forEach','type','nameField','idField','indexOf','content','ticketType','incidents','assign','getString','Subjects','Descriptions','/contacts(','/systemusers(','Fields','callDirection','queue','ticketId','format','user:%s','emit','stripTrailingSlash','serverUrl','unmanaged','%s/api/data/v9.0/','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none',']\x20The\x20User\x20email\x20is:','userEmail','moduleCreate',']\x20The\x20Enduser\x20ID\x20is:',']\x20The\x20Enduser\x20phone\x20is:',']\x20The\x20%s\x20ID\x20is:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...','name','lodash','bluebird','request-promise','./util','md5','ioredis','../../../../config/logger','dynamics365','../../../../config/environment','redis','defaults','localhost','POST','clientId','remoteUri','password','clientSecret','then','access_token'];(function(_0x5d2152,_0x27cb8d){var _0x4f01e2=function(_0x22c097){while(--_0x22c097){_0x5d2152['push'](_0x5d2152['shift']());}};_0x4f01e2(++_0x27cb8d);}(_0xe1cb,0x1c3));var _0xbe1c=function(_0x521b9a,_0x217b1c){_0x521b9a=_0x521b9a-0x0;var _0x5786aa=_0xe1cb[_0x521b9a];return _0x5786aa;};'use strict';var _=require(_0xbe1c('0x0'));var BPromise=require(_0xbe1c('0x1'));var rp=require(_0xbe1c('0x2'));var util=require('util');var intUtil=require(_0xbe1c('0x3'));var md5=require(_0xbe1c('0x4'));var Redis=require(_0xbe1c('0x5'));var logger=require(_0xbe1c('0x6'))(_0xbe1c('0x7'));var config=require(_0xbe1c('0x8'));config[_0xbe1c('0x9')]=_[_0xbe1c('0xa')](config[_0xbe1c('0x9')],{'host':_0xbe1c('0xb'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xbe1c('0x9')]));function getAuthToken(_0xb85ac,_0x5cae65,_0x599bc7){var _0x2a5b39={'method':_0xbe1c('0xc'),'uri':_0x5cae65,'form':{'client_id':_0xb85ac[_0xbe1c('0xd')],'resource':_0xb85ac[_0xbe1c('0xe')],'username':_0xb85ac['username'],'password':_0xb85ac[_0xbe1c('0xf')],'grant_type':_0xbe1c('0xf'),'client_secret':_0xb85ac[_0xbe1c('0x10')]},'json':!![]};return rp(_0x2a5b39)[_0xbe1c('0x11')](function(_0x2804c7){return _0x2804c7[_0xbe1c('0x12')];})[_0xbe1c('0x13')](function(_0x2393a0){logger[_0xbe1c('0x14')]('['+[_0x599bc7['toUpperCase']()]+_0xbe1c('0x15'));return _0x2393a0[_0xbe1c('0x16')];});}function getUser(_0x3e4922,_0x23ffed,_0x216acf,_0x5963e3,_0x20e455,_0xf74783){return new BPromise(function(_0x455727,_0x8f0665){return getAuthToken(_0x23ffed,_0x5963e3,_0xf74783)[_0xbe1c('0x11')](function(_0x2e75f4){var _0x17cd2b={'method':'GET','uri':_0x20e455+_0xbe1c('0x17'),'headers':{'Authorization':_0xbe1c('0x18')+_0x2e75f4,'OData-Version':_0xbe1c('0x19')},'json':!![]};return rp(_0x17cd2b);})[_0xbe1c('0x11')](function(_0x58b86a){var _0x527c71=_0x58b86a[_0xbe1c('0x1a')];var _0x5d170c=![];var _0x200add=null;if(!_[_0xbe1c('0x1b')](_0x216acf)){if(intUtil['validateEmail'](_0x216acf[_0xbe1c('0x1c')])){_0x3e4922['userEmail']=_0x216acf[_0xbe1c('0x1c')];for(_0x200add=0x0;_0x200add<_0x527c71[_0xbe1c('0x1d')];_0x200add++){if(_0x527c71[_0x200add]['internalemailaddress']===_0x216acf[_0xbe1c('0x1c')]&&!_0x527c71[_0x200add]['isdisabled']){_0x5d170c=!![];logger[_0xbe1c('0x1e')]('['+[_0xf74783[_0xbe1c('0x1f')]()]+_0xbe1c('0x20')+_0x527c71[_0x200add][_0xbe1c('0x21')]+'!');_0x3e4922[_0xbe1c('0x22')]=_0x527c71[_0x200add][_0xbe1c('0x21')];}}}}if(!_0x5d170c){logger[_0xbe1c('0x1e')]('['+[_0xf74783[_0xbe1c('0x1f')]()]+_0xbe1c('0x23'));_0x3e4922['userEmail']=_0x23ffed['username'];for(_0x200add=0x0;_0x200add<_0x527c71['length'];_0x200add++){if(_0x527c71[_0x200add]['internalemailaddress']===_0x23ffed[_0xbe1c('0x24')]){_0x3e4922[_0xbe1c('0x22')]=_0x527c71[_0x200add][_0xbe1c('0x21')];}}}_0x455727(_0x3e4922);})[_0xbe1c('0x13')](function(_0x22fe74){_0x8f0665(_0x22fe74[_0xbe1c('0x16')]);});});}function createEndUser(_0x5cc5ba,_0x9902f6,_0x2c7e9e,_0x326b3f,_0x2b6be4,_0x473873){return new BPromise(function(_0x3e1ec6,_0x48a3b2){return getAuthToken(_0x9902f6,_0x2c7e9e,_0x473873)['then'](function(_0x16fd41){var _0x208bd9=_0x473873[_0xbe1c('0x25')]()===_0xbe1c('0x26')?_0x2b6be4[_0xbe1c('0x27')]:_0x2b6be4[_0xbe1c('0x28')];var _0x2b5009={'method':_0xbe1c('0xc'),'uri':_0x326b3f+_0xbe1c('0x29'),'body':{'telephone1':_0x208bd9,'fullname':_0x208bd9,'firstname':_0x208bd9,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':'/systemusers('+_0x5cc5ba[_0xbe1c('0x22')]+')'},'headers':{'Authorization':_0xbe1c('0x18')+_0x16fd41,'OData-Version':_0xbe1c('0x19')},'json':!![],'resolveWithFullResponse':!![]};return rp(_0x2b5009);})[_0xbe1c('0x11')](function(_0x3827ae){var _0x2d0eec=_0x3827ae[_0xbe1c('0x2a')][_0xbe1c('0x2b')];var _0x479b57=_0x2d0eec[_0xbe1c('0x2c')](_0x2d0eec['lastIndexOf']('(')+0x1,_0x2d0eec[_0xbe1c('0x2d')](')'));_0x5cc5ba[_0xbe1c('0x2e')]=_0x479b57;_0x3e1ec6(_0x5cc5ba);})[_0xbe1c('0x13')](function(_0xd87427){_0x48a3b2(_0xd87427[_0xbe1c('0x16')]);});});}function getEndUser(_0x1e84de,_0x21ad6b,_0x145552,_0x1be71b,_0x429be8,_0x360c2e,_0x17f30f){var _0x467c28=_0x360c2e[_0xbe1c('0x25')]()==='outbound'?_0x429be8['destcalleridnum']:_0x429be8[_0xbe1c('0x28')];return getAuthToken(_0x21ad6b,_0x145552,_0x360c2e)[_0xbe1c('0x11')](function(_0x255b40){var _0x2fa8b1={'method':_0xbe1c('0x2f'),'uri':_0x1be71b+_0xbe1c('0x30')+_0x467c28[_0xbe1c('0x31')]('+',_0xbe1c('0x32'))+'\x27','headers':{'Authorization':_0xbe1c('0x18')+_0x255b40,'If-None-Match':null,'OData-Version':_0xbe1c('0x19')},'json':!![]};return rp(_0x2fa8b1);})['then'](function(_0x51d0d9){var _0x4b9d66=![];if(!_0x51d0d9)return _0x4b9d66;var _0x320c58=_0x51d0d9['value'];for(var _0x3bfc06=0x0;_0x3bfc06<_0x320c58['length'];_0x3bfc06++){if(_0x320c58[_0x3bfc06]['telephone1']===_0x467c28){_0x4b9d66=!![];_0x1e84de[_0xbe1c('0x2e')]=_0x320c58[_0x3bfc06]['contactid'];}}return _0x4b9d66;})['then'](function(_0x369291){if(_0x369291)return _0x1e84de;if(_0x17f30f===_0xbe1c('0x33')){logger[_0xbe1c('0x1e')]('['+[_0x360c2e['toUpperCase']()]+']\x20Enduser\x20NOT\x20Created\x20-\x20ModuleCreate\x20=\x20Nothing');return _0x1e84de;}return createEndUser(_0x1e84de,_0x21ad6b,_0x145552,_0x1be71b,_0x429be8,_0x360c2e)[_0xbe1c('0x11')](function(_0x11f347){logger[_0xbe1c('0x1e')]('['+[_0x360c2e[_0xbe1c('0x1f')]()]+_0xbe1c('0x34'),_0x11f347[_0xbe1c('0x2e')]);return _0x11f347;});});}function getCustomFields(_0x388d6a,_0x119773,_0x3473a3){var _0x5f3367={};if(_0x388d6a[_0xbe1c('0x1d')]>0x0){_[_0xbe1c('0x35')](_0x388d6a,function(_0x2a6e50){if(_['includes'](['string','picklist'],_0x2a6e50[_0xbe1c('0x36')])&&_0x2a6e50[_0xbe1c('0x37')]&&!_0x2a6e50['customField']){var _0x468c6a=_0x2a6e50[_0xbe1c('0x38')][_0xbe1c('0x25')]();var _0x55b1fa=_0x468c6a[_0xbe1c('0x2c')](0x0,_0x468c6a[_0xbe1c('0x39')]('_'));var _0x19a2f8=_0x468c6a[_0xbe1c('0x2c')](_0x468c6a[_0xbe1c('0x39')]('_')+0x1);if(_0x55b1fa===_0x3473a3){_0x5f3367[_0x19a2f8]=_0x2a6e50[_0xbe1c('0x3a')];}}});}return _0x5f3367;}function getTicket(_0x26853e,_0xb5446f,_0x326554,_0x41ad1d,_0x2f847e,_0x55e1fa,_0x496320){return new BPromise(function(_0x1c08fc,_0x286abe){var _0x30b96f;return getAuthToken(_0xb5446f,_0x326554,_0x496320)['then'](function(_0x162d9e){if(_0x55e1fa[_0xbe1c('0x3b')]==='incident'){_0x30b96f={'method':'POST','uri':_0x41ad1d+_0xbe1c('0x3c'),'body':Object[_0xbe1c('0x3d')]({},{'title':intUtil[_0xbe1c('0x3e')](_0x55e1fa[_0xbe1c('0x3f')],_0x2f847e,'\x20'),'description':intUtil['getString'](_0x55e1fa[_0xbe1c('0x40')],_0x2f847e,'\x0a'),'customerid_contact@odata.bind':_0x26853e[_0xbe1c('0x2e')]?_0xbe1c('0x41')+_0x26853e[_0xbe1c('0x2e')]+')':undefined,'ownerid@odata.bind':_0xbe1c('0x42')+_0x26853e[_0xbe1c('0x22')]+')','caseorigincode':'1'},getCustomFields(_0x55e1fa[_0xbe1c('0x43')],_0x2f847e,_0x55e1fa[_0xbe1c('0x3b')])),'headers':{'Authorization':_0xbe1c('0x18')+_0x162d9e,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};}if(_0x55e1fa['ticketType']==='phonecall'){var _0xbb1c67=_0x26853e[_0xbe1c('0x2e')]?[{'partyid_systemuser@odata.bind':_0xbe1c('0x42')+_0x26853e['userId']+')','participationtypemask':_0x26853e[_0xbe1c('0x44')]==='queue'?0x2:0x1},{'partyid_contact@odata.bind':_0xbe1c('0x41')+_0x26853e[_0xbe1c('0x2e')]+')','participationtypemask':_0x26853e['callDirection']===_0xbe1c('0x45')?0x1:0x2}]:[{'partyid_systemuser@odata.bind':'/systemusers('+_0x26853e[_0xbe1c('0x22')]+')','participationtypemask':_0x26853e[_0xbe1c('0x44')]==='queue'?0x2:0x1}];_0x30b96f={'method':_0xbe1c('0xc'),'uri':_0x41ad1d+'phonecalls','body':Object[_0xbe1c('0x3d')]({},{'subject':intUtil['getString'](_0x55e1fa[_0xbe1c('0x3f')],_0x2f847e,'\x20'),'phonenumber':String(_0x2f847e['calleridnum']),'description':intUtil['getString'](_0x55e1fa[_0xbe1c('0x40')],_0x2f847e,'\x0a'),'regardingobjectid_contact@odata.bind':_0x26853e[_0xbe1c('0x2e')]?'/contacts('+_0x26853e['enduserId']+')':undefined,'ownerid@odata.bind':_0xbe1c('0x42')+_0x26853e[_0xbe1c('0x22')]+')','directioncode':_0x26853e['callDirection']===_0xbe1c('0x45')?![]:!![],'phonecall_activity_parties':_0xbb1c67},getCustomFields(_0x55e1fa[_0xbe1c('0x43')],_0x2f847e,_0x55e1fa[_0xbe1c('0x3b')])),'headers':{'Authorization':_0xbe1c('0x18')+_0x162d9e,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x30b96f);})[_0xbe1c('0x11')](function(_0x14daa3){var _0x1e2ee4=_0x14daa3[_0xbe1c('0x2a')][_0xbe1c('0x2b')];var _0x1054d3=_0x1e2ee4[_0xbe1c('0x2c')](_0x1e2ee4[_0xbe1c('0x2d')]('(')+0x1,_0x1e2ee4[_0xbe1c('0x2d')](')'));_0x26853e[_0xbe1c('0x46')]=_0x1054d3;_0x1c08fc(_0x26853e);})[_0xbe1c('0x13')](function(_0x4ab540){_0x286abe(_0x4ab540[_0xbe1c('0x16')]);});});}function emit(_0x272278,_0x2bc5fc,_0x51dd3b,_0x4196d4){var _0x4d6b92={'uri':util['format']('%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s',_0x272278,_0x51dd3b,_0x4196d4)};io['to'](util[_0xbe1c('0x47')](_0xbe1c('0x48'),_0x2bc5fc))[_0xbe1c('0x49')]('trigger:browser:url',_0x4d6b92);}exports['cs']=function(_0x517921,_0x34f309,_0xfdfb76,_0x357b00,_0x46e608,_0xcdc541,_0x7cdfee,_0x483420){var _0x2f981a={};_0xcdc541[_0xbe1c('0xe')]=intUtil[_0xbe1c('0x4a')](_0xcdc541[_0xbe1c('0xe')]);_0xcdc541[_0xbe1c('0x4b')]=intUtil[_0xbe1c('0x4a')](_0xcdc541[_0xbe1c('0x4b')]);_0x2f981a[_0xbe1c('0x44')]=_0x483420===_0xbe1c('0x45')||_0x483420===_0xbe1c('0x4c')?'queue':_0xbe1c('0x26');var _0x4002d4=util[_0xbe1c('0x47')](_0xbe1c('0x4d'),_0xcdc541[_0xbe1c('0xe')]);var _0x1a0d75=util[_0xbe1c('0x47')]('https://login.microsoftonline.com/%s/oauth2/token',_0xcdc541['tenantId']);var _0x195c5d=util['format'](_0xbe1c('0x4e'),_0xcdc541[_0xbe1c('0x4b')],_0x34f309[_0xbe1c('0x4f')],md5(_0x34f309[_0xbe1c('0x4f')]));if(_0x46e608&&_0x46e608[_0xbe1c('0x50')]){logger[_0xbe1c('0x1e')](_0xbe1c('0x51'),_0xbe1c('0x52'));_0x34f309[_0xbe1c('0x53')]=_0x195c5d;}else if(_0x7cdfee&&_0x7cdfee[_0xbe1c('0x54')]&&_0x7cdfee[_0xbe1c('0x54')]!==_0xbe1c('0x55')){logger[_0xbe1c('0x1e')]('[OUTBOUND]','Recording\x20is\x20enabled!');_0x34f309[_0xbe1c('0x53')]=_0x195c5d;}else{_0x34f309[_0xbe1c('0x53')]='';}return getUser(_0x2f981a,_0xcdc541,_0x357b00,_0x1a0d75,_0x4002d4,_0x483420)[_0xbe1c('0x11')](function(_0x569cf8){logger[_0xbe1c('0x1e')]('['+_0x483420['toUpperCase']()+']\x20The\x20User\x20ID\x20is:',_0x569cf8['userId']);logger[_0xbe1c('0x1e')]('['+_0x483420[_0xbe1c('0x1f')]()+_0xbe1c('0x56'),_0x569cf8[_0xbe1c('0x57')]);return getEndUser(_0x569cf8,_0xcdc541,_0x1a0d75,_0x4002d4,_0x34f309,_0x483420,_0xfdfb76[_0xbe1c('0x58')]);})[_0xbe1c('0x11')](function(_0xaac2d3){logger[_0xbe1c('0x1e')]('['+_0x483420[_0xbe1c('0x1f')]()+_0xbe1c('0x59'),_0xaac2d3[_0xbe1c('0x2e')]);logger[_0xbe1c('0x1e')]('['+_0x483420['toUpperCase']()+_0xbe1c('0x5a'),_0x34f309[_0xbe1c('0x28')]);return getTicket(_0xaac2d3,_0xcdc541,_0x1a0d75,_0x4002d4,_0x34f309,_0xfdfb76,_0x483420);})[_0xbe1c('0x11')](function(_0x30237a){logger[_0xbe1c('0x1e')](util[_0xbe1c('0x47')]('['+_0x483420[_0xbe1c('0x1f')]()+_0xbe1c('0x5b'),_0xfdfb76[_0xbe1c('0x3b')],_0x30237a[_0xbe1c('0x46')]));logger['info'](util[_0xbe1c('0x47')]('['+_0x483420[_0xbe1c('0x1f')]()+']\x20Call\x20direction:\x20%s',_0x483420));if(_0x483420!==_0xbe1c('0x4c')){logger['info']('['+_0x483420[_0xbe1c('0x1f')]()+']',_0xbe1c('0x5c'));emit(_0xcdc541['remoteUri'],_0x357b00[_0xbe1c('0x5d')],_0xfdfb76[_0xbe1c('0x3b')],_0x30237a[_0xbe1c('0x46')]);}})['catch'](function(_0x384098){logger[_0xbe1c('0x14')]('['+_0x483420[_0xbe1c('0x1f')]()+']\x20Error\x20running\x20Dynamics365\x20integration',util['inspect'](_0x384098,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x665c=['format',']\x20The\x20%s\x20ID\x20is:\x20%s','unmanaged','Displaying\x20call\x20in\x20a\x20new\x20tab...','name','lodash','bluebird','request-promise','util','./util','md5','ioredis','../../../../config/logger','dynamics365','../../../../config/environment','localhost','socket.io-emitter','redis','POST','clientId','remoteUri','username','password','then','access_token','catch','error','toUpperCase',']\x20Wrong\x20credentials!','message','systemusers?$select=internalemailaddress,isdisabled,systemuserid','4.0','value','isNil','validateEmail','email','userEmail','length','isdisabled','info',']\x20Agent\x20found\x20','userId','systemuserid',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','internalemailaddress','toLowerCase','outbound','destcalleridnum','calleridnum','contacts','/systemusers(','Bearer\x20','headers','odata-entityid','substring','lastIndexOf','enduserId','GET','contacts?$select=telephone1&$filter=telephone1\x20eq\x20\x27','replace','%2b','telephone1','contactid','nothing',']\x20Enduser\x20NOT\x20Created\x20-\x20ModuleCreate\x20=\x20Nothing','forEach','includes','string','picklist','type','nameField','customField','idField','indexOf','ticketType','incident','getString','Subjects','Descriptions','/contacts(','phonecall','callDirection','queue','phonecalls','assign','Fields','ticketId','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','user:%s','emit','stripTrailingSlash','serverUrl','https://login.microsoftonline.com/%s/oauth2/token','tenantId','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','Recording\x20is\x20enabled!','recordingFormat','[OUTBOUND]','recordingURL',']\x20The\x20User\x20ID\x20is:',']\x20The\x20User\x20email\x20is:','moduleCreate',']\x20The\x20Enduser\x20ID\x20is:'];(function(_0x52f66c,_0xf5eb54){var _0x36e755=function(_0x269e4e){while(--_0x269e4e){_0x52f66c['push'](_0x52f66c['shift']());}};_0x36e755(++_0xf5eb54);}(_0x665c,0x1a9));var _0xc665=function(_0x68efb,_0xa385ec){_0x68efb=_0x68efb-0x0;var _0xdabd2a=_0x665c[_0x68efb];return _0xdabd2a;};'use strict';var _=require(_0xc665('0x0'));var BPromise=require(_0xc665('0x1'));var rp=require(_0xc665('0x2'));var util=require(_0xc665('0x3'));var intUtil=require(_0xc665('0x4'));var md5=require(_0xc665('0x5'));var Redis=require(_0xc665('0x6'));var logger=require(_0xc665('0x7'))(_0xc665('0x8'));var config=require(_0xc665('0x9'));config['redis']=_['defaults'](config['redis'],{'host':_0xc665('0xa'),'port':0x18eb});var io=require(_0xc665('0xb'))(new Redis(config[_0xc665('0xc')]));function getAuthToken(_0x5d7ef4,_0x5cf283,_0x3acce4){var _0x189ad9={'method':_0xc665('0xd'),'uri':_0x5cf283,'form':{'client_id':_0x5d7ef4[_0xc665('0xe')],'resource':_0x5d7ef4[_0xc665('0xf')],'username':_0x5d7ef4[_0xc665('0x10')],'password':_0x5d7ef4[_0xc665('0x11')],'grant_type':_0xc665('0x11'),'client_secret':_0x5d7ef4['clientSecret']},'json':!![]};return rp(_0x189ad9)[_0xc665('0x12')](function(_0x5a305d){return _0x5a305d[_0xc665('0x13')];})[_0xc665('0x14')](function(_0x15c749){logger[_0xc665('0x15')]('['+[_0x3acce4[_0xc665('0x16')]()]+_0xc665('0x17'));return _0x15c749[_0xc665('0x18')];});}function getUser(_0x5a5f19,_0xf60e4d,_0x452dcf,_0x33d93d,_0x4b4884,_0x17adf7){return new BPromise(function(_0x1d9d9,_0x2ef898){return getAuthToken(_0xf60e4d,_0x33d93d,_0x17adf7)[_0xc665('0x12')](function(_0x25e33a){var _0x104a82={'method':'GET','uri':_0x4b4884+_0xc665('0x19'),'headers':{'Authorization':'Bearer\x20'+_0x25e33a,'OData-Version':_0xc665('0x1a')},'json':!![]};return rp(_0x104a82);})[_0xc665('0x12')](function(_0xc64d3b){var _0x55433a=_0xc64d3b[_0xc665('0x1b')];var _0x41aede=![];var _0x3cc5c8=null;if(!_[_0xc665('0x1c')](_0x452dcf)){if(intUtil[_0xc665('0x1d')](_0x452dcf[_0xc665('0x1e')])){_0x5a5f19[_0xc665('0x1f')]=_0x452dcf[_0xc665('0x1e')];for(_0x3cc5c8=0x0;_0x3cc5c8<_0x55433a[_0xc665('0x20')];_0x3cc5c8++){if(_0x55433a[_0x3cc5c8]['internalemailaddress']===_0x452dcf['email']&&!_0x55433a[_0x3cc5c8][_0xc665('0x21')]){_0x41aede=!![];logger[_0xc665('0x22')]('['+[_0x17adf7[_0xc665('0x16')]()]+_0xc665('0x23')+_0x55433a[_0x3cc5c8]['systemuserid']+'!');_0x5a5f19[_0xc665('0x24')]=_0x55433a[_0x3cc5c8][_0xc665('0x25')];}}}}if(!_0x41aede){logger['info']('['+[_0x17adf7[_0xc665('0x16')]()]+_0xc665('0x26'));_0x5a5f19[_0xc665('0x1f')]=_0xf60e4d[_0xc665('0x10')];for(_0x3cc5c8=0x0;_0x3cc5c8<_0x55433a[_0xc665('0x20')];_0x3cc5c8++){if(_0x55433a[_0x3cc5c8][_0xc665('0x27')]===_0xf60e4d[_0xc665('0x10')]){_0x5a5f19[_0xc665('0x24')]=_0x55433a[_0x3cc5c8]['systemuserid'];}}}_0x1d9d9(_0x5a5f19);})['catch'](function(_0x48faf0){_0x2ef898(_0x48faf0['message']);});});}function createEndUser(_0xc6c59f,_0x1a08db,_0x183b8e,_0x2bd5fb,_0x33b2d0,_0x2a7ca4){return new BPromise(function(_0x2d07fb,_0x3d23d4){return getAuthToken(_0x1a08db,_0x183b8e,_0x2a7ca4)['then'](function(_0x3ef750){var _0x52f140=_0x2a7ca4[_0xc665('0x28')]()===_0xc665('0x29')?_0x33b2d0[_0xc665('0x2a')]:_0x33b2d0[_0xc665('0x2b')];var _0x1ea57f={'method':_0xc665('0xd'),'uri':_0x2bd5fb+_0xc665('0x2c'),'body':{'telephone1':_0x52f140,'fullname':_0x52f140,'firstname':_0x52f140,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0xc665('0x2d')+_0xc6c59f['userId']+')'},'headers':{'Authorization':_0xc665('0x2e')+_0x3ef750,'OData-Version':_0xc665('0x1a')},'json':!![],'resolveWithFullResponse':!![]};return rp(_0x1ea57f);})[_0xc665('0x12')](function(_0x342aa9){var _0x22df26=_0x342aa9[_0xc665('0x2f')][_0xc665('0x30')];var _0x3c4ade=_0x22df26[_0xc665('0x31')](_0x22df26[_0xc665('0x32')]('(')+0x1,_0x22df26[_0xc665('0x32')](')'));_0xc6c59f[_0xc665('0x33')]=_0x3c4ade;_0x2d07fb(_0xc6c59f);})['catch'](function(_0x5b3d43){_0x3d23d4(_0x5b3d43['message']);});});}function getEndUser(_0x239350,_0x5958ad,_0x542428,_0x2bd58a,_0x3bb1e0,_0x26459f,_0x110974){var _0x50f740=_0x26459f['toLowerCase']()===_0xc665('0x29')?_0x3bb1e0[_0xc665('0x2a')]:_0x3bb1e0[_0xc665('0x2b')];return getAuthToken(_0x5958ad,_0x542428,_0x26459f)['then'](function(_0x542300){var _0x2a9a9e={'method':_0xc665('0x34'),'uri':_0x2bd58a+_0xc665('0x35')+_0x50f740[_0xc665('0x36')]('+',_0xc665('0x37'))+'\x27','headers':{'Authorization':_0xc665('0x2e')+_0x542300,'If-None-Match':null,'OData-Version':_0xc665('0x1a')},'json':!![]};return rp(_0x2a9a9e);})[_0xc665('0x12')](function(_0x2be6bd){var _0x8d8705=![];if(!_0x2be6bd)return _0x8d8705;var _0x539ca1=_0x2be6bd[_0xc665('0x1b')];for(var _0x3e5707=0x0;_0x3e5707<_0x539ca1['length'];_0x3e5707++){if(_0x539ca1[_0x3e5707][_0xc665('0x38')]===_0x50f740){_0x8d8705=!![];_0x239350[_0xc665('0x33')]=_0x539ca1[_0x3e5707][_0xc665('0x39')];}}return _0x8d8705;})[_0xc665('0x12')](function(_0x35b05a){if(_0x35b05a)return _0x239350;if(_0x110974===_0xc665('0x3a')){logger['info']('['+[_0x26459f[_0xc665('0x16')]()]+_0xc665('0x3b'));return _0x239350;}return createEndUser(_0x239350,_0x5958ad,_0x542428,_0x2bd58a,_0x3bb1e0,_0x26459f)[_0xc665('0x12')](function(_0x5e4560){logger['info']('['+[_0x26459f[_0xc665('0x16')]()]+']\x20Enduser\x20created!',_0x5e4560[_0xc665('0x33')]);return _0x5e4560;});});}function getCustomFields(_0x457940,_0x1ff995,_0xcbafcc){var _0x41abcc={};if(_0x457940[_0xc665('0x20')]>0x0){_[_0xc665('0x3c')](_0x457940,function(_0x2f4e54){if(_[_0xc665('0x3d')]([_0xc665('0x3e'),_0xc665('0x3f')],_0x2f4e54[_0xc665('0x40')])&&_0x2f4e54[_0xc665('0x41')]&&!_0x2f4e54[_0xc665('0x42')]){var _0x34bda7=_0x2f4e54[_0xc665('0x43')][_0xc665('0x28')]();var _0x5d229c=_0x34bda7[_0xc665('0x31')](0x0,_0x34bda7[_0xc665('0x44')]('_'));var _0x7adbb4=_0x34bda7[_0xc665('0x31')](_0x34bda7['indexOf']('_')+0x1);if(_0x5d229c===_0xcbafcc){_0x41abcc[_0x7adbb4]=_0x2f4e54['content'];}}});}return _0x41abcc;}function getTicket(_0x2ba2e5,_0x1d422a,_0x170a20,_0x3584a4,_0x58d464,_0x2885f4,_0x2259b1){return new BPromise(function(_0x2e5087,_0x1f96da){var _0x1acc39;return getAuthToken(_0x1d422a,_0x170a20,_0x2259b1)[_0xc665('0x12')](function(_0x3f964f){if(_0x2885f4[_0xc665('0x45')]===_0xc665('0x46')){_0x1acc39={'method':_0xc665('0xd'),'uri':_0x3584a4+'incidents','body':Object['assign']({},{'title':intUtil[_0xc665('0x47')](_0x2885f4[_0xc665('0x48')],_0x58d464,'\x20'),'description':intUtil[_0xc665('0x47')](_0x2885f4[_0xc665('0x49')],_0x58d464,'\x0a'),'customerid_contact@odata.bind':_0x2ba2e5['enduserId']?_0xc665('0x4a')+_0x2ba2e5[_0xc665('0x33')]+')':undefined,'ownerid@odata.bind':'/systemusers('+_0x2ba2e5['userId']+')','caseorigincode':'1'},getCustomFields(_0x2885f4['Fields'],_0x58d464,_0x2885f4[_0xc665('0x45')])),'headers':{'Authorization':'Bearer\x20'+_0x3f964f,'OData-Version':_0xc665('0x1a')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x2885f4[_0xc665('0x45')]===_0xc665('0x4b')){var _0x44b431=_0x2ba2e5[_0xc665('0x33')]?[{'partyid_systemuser@odata.bind':_0xc665('0x2d')+_0x2ba2e5['userId']+')','participationtypemask':_0x2ba2e5[_0xc665('0x4c')]===_0xc665('0x4d')?0x2:0x1},{'partyid_contact@odata.bind':_0xc665('0x4a')+_0x2ba2e5[_0xc665('0x33')]+')','participationtypemask':_0x2ba2e5[_0xc665('0x4c')]==='queue'?0x1:0x2}]:[{'partyid_systemuser@odata.bind':'/systemusers('+_0x2ba2e5[_0xc665('0x24')]+')','participationtypemask':_0x2ba2e5[_0xc665('0x4c')]==='queue'?0x2:0x1}];_0x1acc39={'method':_0xc665('0xd'),'uri':_0x3584a4+_0xc665('0x4e'),'body':Object[_0xc665('0x4f')]({},{'subject':intUtil[_0xc665('0x47')](_0x2885f4[_0xc665('0x48')],_0x58d464,'\x20'),'phonenumber':String(_0x58d464[_0xc665('0x2b')]),'description':intUtil['getString'](_0x2885f4['Descriptions'],_0x58d464,'\x0a'),'regardingobjectid_contact@odata.bind':_0x2ba2e5[_0xc665('0x33')]?_0xc665('0x4a')+_0x2ba2e5['enduserId']+')':undefined,'ownerid@odata.bind':_0xc665('0x2d')+_0x2ba2e5['userId']+')','directioncode':_0x2ba2e5[_0xc665('0x4c')]===_0xc665('0x4d')?![]:!![],'phonecall_activity_parties':_0x44b431},getCustomFields(_0x2885f4[_0xc665('0x50')],_0x58d464,_0x2885f4[_0xc665('0x45')])),'headers':{'Authorization':_0xc665('0x2e')+_0x3f964f,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x1acc39);})[_0xc665('0x12')](function(_0x3aefd2){var _0x2332f9=_0x3aefd2[_0xc665('0x2f')]['odata-entityid'];var _0x1a128a=_0x2332f9['substring'](_0x2332f9[_0xc665('0x32')]('(')+0x1,_0x2332f9['lastIndexOf'](')'));_0x2ba2e5[_0xc665('0x51')]=_0x1a128a;_0x2e5087(_0x2ba2e5);})[_0xc665('0x14')](function(_0x1d229f){_0x1f96da(_0x1d229f[_0xc665('0x18')]);});});}function emit(_0x2e0f2b,_0x6aff3f,_0x2dab0d,_0x91ce96){var _0x39ef5d={'uri':util['format'](_0xc665('0x52'),_0x2e0f2b,_0x2dab0d,_0x91ce96)};io['to'](util['format'](_0xc665('0x53'),_0x6aff3f))[_0xc665('0x54')]('trigger:browser:url',_0x39ef5d);}exports['cs']=function(_0x1b9902,_0x2d2145,_0x9825ca,_0x64efbf,_0x15b8fa,_0x1a8f25,_0xa4be2a,_0x2d1fee){var _0x2c3d49={};_0x1a8f25[_0xc665('0xf')]=intUtil[_0xc665('0x55')](_0x1a8f25['remoteUri']);_0x1a8f25[_0xc665('0x56')]=intUtil[_0xc665('0x55')](_0x1a8f25['serverUrl']);_0x2c3d49[_0xc665('0x4c')]=_0x2d1fee===_0xc665('0x4d')||_0x2d1fee==='unmanaged'?_0xc665('0x4d'):_0xc665('0x29');var _0x473ee0=util['format']('%s/api/data/v9.0/',_0x1a8f25[_0xc665('0xf')]);var _0x5082fa=util['format'](_0xc665('0x57'),_0x1a8f25[_0xc665('0x58')]);var _0x492bc3=util['format'](_0xc665('0x59'),_0x1a8f25[_0xc665('0x56')],_0x2d2145[_0xc665('0x5a')],md5(_0x2d2145[_0xc665('0x5a')]));if(_0x15b8fa&&_0x15b8fa[_0xc665('0x5b')]){logger[_0xc665('0x22')]('[QUEUE]',_0xc665('0x5c'));_0x2d2145['recordingURL']=_0x492bc3;}else if(_0xa4be2a&&_0xa4be2a[_0xc665('0x5d')]&&_0xa4be2a['recordingFormat']!=='none'){logger['info'](_0xc665('0x5e'),'Recording\x20is\x20enabled!');_0x2d2145[_0xc665('0x5f')]=_0x492bc3;}else{_0x2d2145['recordingURL']='';}return getUser(_0x2c3d49,_0x1a8f25,_0x64efbf,_0x5082fa,_0x473ee0,_0x2d1fee)[_0xc665('0x12')](function(_0x3b0933){logger[_0xc665('0x22')]('['+_0x2d1fee[_0xc665('0x16')]()+_0xc665('0x60'),_0x3b0933[_0xc665('0x24')]);logger[_0xc665('0x22')]('['+_0x2d1fee['toUpperCase']()+_0xc665('0x61'),_0x3b0933[_0xc665('0x1f')]);return getEndUser(_0x3b0933,_0x1a8f25,_0x5082fa,_0x473ee0,_0x2d2145,_0x2d1fee,_0x9825ca[_0xc665('0x62')]);})['then'](function(_0x1d61ee){logger[_0xc665('0x22')]('['+_0x2d1fee[_0xc665('0x16')]()+_0xc665('0x63'),_0x1d61ee['enduserId']);logger[_0xc665('0x22')]('['+_0x2d1fee[_0xc665('0x16')]()+']\x20The\x20Enduser\x20phone\x20is:',_0x2d2145[_0xc665('0x2b')]);return getTicket(_0x1d61ee,_0x1a8f25,_0x5082fa,_0x473ee0,_0x2d2145,_0x9825ca,_0x2d1fee);})[_0xc665('0x12')](function(_0x36a5ca){logger[_0xc665('0x22')](util[_0xc665('0x64')]('['+_0x2d1fee[_0xc665('0x16')]()+_0xc665('0x65'),_0x9825ca[_0xc665('0x45')],_0x36a5ca[_0xc665('0x51')]));logger[_0xc665('0x22')](util[_0xc665('0x64')]('['+_0x2d1fee[_0xc665('0x16')]()+']\x20Call\x20direction:\x20%s',_0x2d1fee));if(_0x2d1fee!==_0xc665('0x66')){logger[_0xc665('0x22')]('['+_0x2d1fee[_0xc665('0x16')]()+']',_0xc665('0x67'));emit(_0x1a8f25['remoteUri'],_0x64efbf[_0xc665('0x68')],_0x9825ca[_0xc665('0x45')],_0x36a5ca[_0xc665('0x51')]);}})[_0xc665('0x14')](function(_0x17acfc){logger[_0xc665('0x15')]('['+_0x2d1fee[_0xc665('0x16')]()+']\x20Error\x20running\x20Dynamics365\x20integration',util['inspect'](_0x17acfc,{'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 92ca2d5..38b5b22 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 _0x6409=['validateEmail','then','length','Agent\x20found!','%s/api/v2/agents/me','Admin\x20account\x20selected.','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/api/v2/contacts','Enduser\x20created.','apiKey','toString','base64','debug','[HTTP]','GET','map','string','picklist','type','nameField','customField','toLowerCase','content','push','idField','variable','variableName','customVariable','Variable','queue','stripTrailingSlash','serverUrl','monitor_format','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','The\x20User\x20ID\x20is:','calleridnum','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','%s/helpdesk/tickets/%d','catch','error','[QUEUE]','stringify','outbound','recordingFormat','none','email','destcalleridname','[OUTBOUND]','trigger:browser:url','unmanaged','toUpperCase','recordingURL','lastevent','md5','util','./util','../../../../config/logger','freshdesk','redis','defaults','localhost','socket.io-emitter','application/json','emit','info','Creating\x20new\x20ticket...','format','Caller\x20-\x20%s','calleridname','getString','Descriptions','Tags','name','Fields','mapValues','keyBy','custom_fields','value','%s/api/v2/tickets','remoteUri','POST','Ticket\x20created!'];(function(_0x2444a6,_0x4210e4){var _0x1e2a06=function(_0x328fa6){while(--_0x328fa6){_0x2444a6['push'](_0x2444a6['shift']());}};_0x1e2a06(++_0x4210e4);}(_0x6409,0x14f));var _0x9640=function(_0x6d3f6b,_0x7b596f){_0x6d3f6b=_0x6d3f6b-0x0;var _0xf50da4=_0x6409[_0x6d3f6b];return _0xf50da4;};'use strict';var _=require('lodash');var rp=require('request-promise');var md5=require(_0x9640('0x0'));var util=require(_0x9640('0x1'));var Redis=require('ioredis');var intUtil=require(_0x9640('0x2'));var config=require('../../../../config/environment');var logger=require(_0x9640('0x3'))(_0x9640('0x4'));config[_0x9640('0x5')]=_[_0x9640('0x6')](config[_0x9640('0x5')],{'host':_0x9640('0x7'),'port':0x18eb});var io=require(_0x9640('0x8'))(new Redis(config[_0x9640('0x5')]));var headers={'Content-Type':_0x9640('0x9'),'Accept':_0x9640('0x9')};function emit(_0x1c54ed,_0x3b1df5,_0x368880){io['to'](_0x1c54ed)[_0x9640('0xa')](_0x3b1df5,_0x368880);}function getTicket(_0x1afbfa,_0x26191c,_0x168a19,_0x5a72d7,_0x54b8dd){logger[_0x9640('0xb')](_0x9640('0xc'));var _0x295412=_['merge']({'responder_id':_0x26191c['id'],'requester_id':_0x168a19['id'],'name':util[_0x9640('0xd')](_0x9640('0xe'),_0x54b8dd[_0x9640('0xf')]),'phone':_0x54b8dd['calleridnum'],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0x9640('0x10')](_0x5a72d7['Subjects'],_0x54b8dd,'\x20'),'description':intUtil[_0x9640('0x10')](_0x5a72d7[_0x9640('0x11')],_0x54b8dd,'
'),'tags':getTags(_0x5a72d7[_0x9640('0x12')],_0x9640('0x13'))},getCustomFields(_0x5a72d7[_0x9640('0x14')],_0x54b8dd));_0x295412['custom_fields']=_[_0x9640('0x15')](_[_0x9640('0x16')](_0x295412[_0x9640('0x17')],'id'),_0x9640('0x18'));return request({'uri':util[_0x9640('0xd')](_0x9640('0x19'),_0x1afbfa[_0x9640('0x1a')]),'method':_0x9640('0x1b'),'body':_0x295412})['then'](function(_0x4aea85){logger[_0x9640('0xb')](_0x9640('0x1c'));return _0x4aea85;});}function getUser(_0x5791b4,_0xa87612){if(intUtil[_0x9640('0x1d')](_0xa87612)){return request({'uri':util['format']('%s/api/v2/agents',_0x5791b4[_0x9640('0x1a')]),'qs':{'email':_0xa87612}})[_0x9640('0x1e')](function(_0x2dfc08){if(_0x2dfc08[_0x9640('0x1f')]){logger[_0x9640('0xb')](_0x9640('0x20'));return _['find'](_0x2dfc08,function(_0x4a202a){return _0x4a202a['contact']['email']===_0xa87612;});}else{logger[_0x9640('0xb')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0x9640('0xd')](_0x9640('0x21'),_0x5791b4[_0x9640('0x1a')])})['then'](function(_0x156baf){logger[_0x9640('0xb')](_0x9640('0x22'));return _0x156baf;});}});}else{logger['info'](_0x9640('0x23'));return request({'uri':util['format']('%s/api/v2/agents/me',_0x5791b4['remoteUri'])})[_0x9640('0x1e')](function(_0x265e38){logger[_0x9640('0xb')](_0x9640('0x22'));return _0x265e38;});}}function getEndUser(_0x6d6f87,_0x1caa9f,_0x5f5040){logger[_0x9640('0xb')](_0x9640('0x24'),_0x5f5040);return request({'uri':util['format']('%s/api/v2/contacts',_0x6d6f87[_0x9640('0x1a')]),'qs':{'phone':_0x5f5040}})[_0x9640('0x1e')](function(_0x5b0bc2){if(_0x5b0bc2[_0x9640('0x1f')]){logger['info'](_0x9640('0x25'));return _['find'](_0x5b0bc2,{'phone':_0x5f5040});}else{logger[_0x9640('0xb')](_0x9640('0x26'));return request({'uri':util[_0x9640('0xd')](_0x9640('0x27'),_0x6d6f87['remoteUri']),'method':_0x9640('0x1b'),'body':{'name':_0x1caa9f,'phone':_0x5f5040}})[_0x9640('0x1e')](function(_0x3fff64){logger[_0x9640('0xb')](_0x9640('0x28'));return _0x3fff64;});}});}function getAuth(_0x51f0d5){return util[_0x9640('0xd')]('Basic\x20%s',new Buffer(_0x51f0d5[_0x9640('0x29')]+':X')[_0x9640('0x2a')](_0x9640('0x2b')));}function request(_0x2ed5ed){logger[_0x9640('0x2c')](_0x9640('0x2d'),JSON['stringify'](_0x2ed5ed));return rp(_['defaults'](_0x2ed5ed,{'method':_0x9640('0x2e'),'headers':headers,'json':!![]}));}function getTags(_0x239094,_0x2c90d1){var _0x5e776b=[];if(_0x239094&&_0x239094[_0x9640('0x1f')]>0x0){_0x5e776b=_[_0x9640('0x2f')](_0x239094,_0x2c90d1);}return _0x5e776b;}function getCustomFields(_0x1ce881,_0x25f169){var _0x49b777=[];var _0x4c08c3={'custom_fields':[]};if(_0x1ce881[_0x9640('0x1f')]>0x0){_['forEach'](_0x1ce881,function(_0x3171c9){if(_['includes']([_0x9640('0x30'),_0x9640('0x31')],_0x3171c9[_0x9640('0x32')])&&_0x3171c9[_0x9640('0x33')]&&!_0x3171c9[_0x9640('0x34')]){_0x4c08c3[_0x3171c9[_0x9640('0x33')][_0x9640('0x35')]()]=_0x3171c9[_0x9640('0x36')][_0x9640('0x2a')]();}else if(_['includes']([_0x9640('0x30'),'picklist'],_0x3171c9[_0x9640('0x32')])&&_0x3171c9['idField']&&_0x3171c9[_0x9640('0x34')]){_0x4c08c3['custom_fields'][_0x9640('0x37')]({'id':_0x3171c9[_0x9640('0x38')],'value':_0x3171c9[_0x9640('0x36')][_0x9640('0x2a')]()});}else if(_0x3171c9[_0x9640('0x32')]===_0x9640('0x39')&&_0x3171c9[_0x9640('0x3a')]&&_0x3171c9['idField']&&_0x3171c9[_0x9640('0x34')]){_0x25f169[_0x3171c9[_0x9640('0x3a')]]&&_0x4c08c3[_0x9640('0x17')][_0x9640('0x37')]({'id':_0x3171c9[_0x9640('0x38')],'value':_0x25f169[_0x3171c9[_0x9640('0x3a')]]['toString']()});}else if(_0x3171c9['type']===_0x9640('0x3b')&&_0x3171c9['Variable']&&_0x3171c9['Variable']['name']&&_0x3171c9['idField']&&_0x3171c9[_0x9640('0x34')]){_0x25f169[_0x3171c9[_0x9640('0x3c')][_0x9640('0x13')][_0x9640('0x35')]()]&&_0x4c08c3[_0x9640('0x17')][_0x9640('0x37')]({'id':_0x3171c9[_0x9640('0x38')],'value':_0x25f169[_0x3171c9['Variable']['name']['toLowerCase']()][_0x9640('0x2a')]()});}});}return _0x4c08c3;}exports[_0x9640('0x3d')]=function(_0x37c5e4,_0x174707,_0x3ace19,_0x22abbd,_0x2cbf0a,_0x5b4b84){var _0x5a9e53,_0x5c8fc2;_0x5b4b84[_0x9640('0x1a')]=intUtil[_0x9640('0x3e')](_0x5b4b84['remoteUri']);_0x5b4b84['serverUrl']=intUtil[_0x9640('0x3e')](_0x5b4b84[_0x9640('0x3f')]);if(_0x2cbf0a&&_0x2cbf0a[_0x9640('0x40')]){logger[_0x9640('0xb')]('[QUEUE]',_0x9640('0x41'));_0x174707['recordingURL']=util['format'](_0x9640('0x42'),_0x5b4b84[_0x9640('0x3f')],_0x174707[_0x9640('0x43')],md5(_0x174707[_0x9640('0x43')]));}else{_0x174707['recordingURL']='';}headers[_0x9640('0x44')]=getAuth(_0x5b4b84);return getUser(_0x5b4b84,_0x22abbd['email'])['then'](function(_0x2297f3){_0x5a9e53=_0x2297f3;logger[_0x9640('0xb')](_0x9640('0x45'),_0x5a9e53['id']);return getEndUser(_0x5b4b84,_0x174707[_0x9640('0xf')],_0x174707[_0x9640('0x46')]);})['then'](function(_0x213f93){_0x5c8fc2=_0x213f93;logger['info'](_0x9640('0x47'),_0x5c8fc2['id']);return getTicket(_0x5b4b84,_0x5a9e53,_0x5c8fc2,_0x3ace19,_0x174707);})[_0x9640('0x1e')](function(_0x403525){if(_0x403525&&_0x403525['id']){logger[_0x9640('0xb')](_0x9640('0x1c'));logger[_0x9640('0xb')](_0x9640('0x48'),_0x403525['id']);logger[_0x9640('0xb')]('[QUEUE]',_0x9640('0x49'));emit(util[_0x9640('0xd')](_0x9640('0x4a'),_0x22abbd['name']),'trigger:browser:url',{'uri':util[_0x9640('0xd')](_0x9640('0x4b'),_0x5b4b84['remoteUri'],_0x403525['id'])});}})[_0x9640('0x4c')](function(_0x1b1a26){logger[_0x9640('0x4d')](_0x9640('0x4e'),JSON[_0x9640('0x4f')](_0x1b1a26));});};exports[_0x9640('0x50')]=function(_0x675627,_0x2ac838,_0x1648e8,_0x2c180d,_0x555388,_0x222390,_0x2b4372){var _0x227a42,_0x5fba3a;_0x222390[_0x9640('0x1a')]=intUtil[_0x9640('0x3e')](_0x222390[_0x9640('0x1a')]);_0x222390[_0x9640('0x3f')]=intUtil[_0x9640('0x3e')](_0x222390[_0x9640('0x3f')]);if(_0x2b4372&&_0x2b4372[_0x9640('0x51')]&&_0x2b4372[_0x9640('0x51')]!==_0x9640('0x52')){logger[_0x9640('0xb')]('[OUTBOUND]','Recording\x20is\x20enabled!');_0x2ac838['recordingURL']=util[_0x9640('0xd')](_0x9640('0x42'),_0x222390[_0x9640('0x3f')],_0x2ac838[_0x9640('0x43')],md5(_0x2ac838[_0x9640('0x43')]));}headers[_0x9640('0x44')]=getAuth(_0x222390);return getUser(_0x222390,_0x2c180d[_0x9640('0x53')])['then'](function(_0x516efb){_0x227a42=_0x516efb;logger['info']('The\x20User\x20ID\x20is:',_0x227a42['id']);return getEndUser(_0x222390,_0x2ac838[_0x9640('0x54')],_0x2ac838['destcalleridnum']);})[_0x9640('0x1e')](function(_0x2a3f99){_0x5fba3a=_0x2a3f99;logger[_0x9640('0xb')](_0x9640('0x47'),_0x5fba3a['id']);return getTicket(_0x222390,_0x227a42,_0x5fba3a,_0x1648e8,_0x2ac838);})[_0x9640('0x1e')](function(_0xfd3af7){if(_0xfd3af7&&_0xfd3af7['id']){logger[_0x9640('0xb')]('Ticket\x20created!');logger[_0x9640('0xb')]('The\x20Ticket\x20ID\x20is:',_0xfd3af7['id']);logger['info'](_0x9640('0x55'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x9640('0xd')](_0x9640('0x4a'),_0x2c180d[_0x9640('0x13')]),_0x9640('0x56'),{'uri':util[_0x9640('0xd')](_0x9640('0x4b'),_0x222390['remoteUri'],_0xfd3af7['id'])});}})[_0x9640('0x4c')](function(_0x1fe312){logger[_0x9640('0x4d')](_0x9640('0x55'),JSON[_0x9640('0x4f')](_0x1fe312));});};exports[_0x9640('0x57')]=function(_0x365ed6,_0x3fdd5c,_0x15ed60,_0xb3c6e,_0xa3c29d,_0x1aeac9){var _0x4c68f5,_0xcafa12;_0x1aeac9[_0x9640('0x1a')]=intUtil[_0x9640('0x3e')](_0x1aeac9[_0x9640('0x1a')]);_0x1aeac9['serverUrl']=intUtil['stripTrailingSlash'](_0x1aeac9['serverUrl']);if(_0xa3c29d&&_0xa3c29d[_0x9640('0x40')]){logger[_0x9640('0xb')]('['+_0x3fdd5c['lastevent'][_0x9640('0x58')]()+']',_0x9640('0x41'));_0x3fdd5c[_0x9640('0x59')]=util['format'](_0x9640('0x42'),_0x1aeac9[_0x9640('0x3f')],_0x3fdd5c['uniqueid'],md5(_0x3fdd5c[_0x9640('0x43')]));}else{_0x3fdd5c[_0x9640('0x59')]='';}headers[_0x9640('0x44')]=getAuth(_0x1aeac9);return getUser(_0x1aeac9,'')[_0x9640('0x1e')](function(_0x2ab05d){_0x4c68f5=_0x2ab05d;logger['info'](_0x9640('0x45'),_0x4c68f5['id']);return getEndUser(_0x1aeac9,_0x3fdd5c[_0x9640('0xf')],_0x3fdd5c[_0x9640('0x46')]);})[_0x9640('0x1e')](function(_0x4756dc){_0xcafa12=_0x4756dc;logger[_0x9640('0xb')]('The\x20Enduser\x20ID\x20is:',_0xcafa12['id']);return getTicket(_0x1aeac9,_0x4c68f5,_0xcafa12,_0x15ed60,_0x3fdd5c);})[_0x9640('0x1e')](function(_0x3b8710){if(_0x3b8710){logger['info']('Ticket\x20created!');logger['info'](_0x9640('0x48'),_0x3b8710['id']);}})[_0x9640('0x4c')](function(_0x5aacd9){logger[_0x9640('0x4d')]('['+_0x3fdd5c[_0x9640('0x5a')]['toUpperCase']()+']',JSON['stringify'](_0x5aacd9));});}; \ No newline at end of file +var _0x75e8=['POST','then','Ticket\x20created!','validateEmail','length','find','contact','email','%s/api/v2/agents/me','Admin\x20account\x20selected.','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/api/v2/contacts','Basic\x20%s','apiKey','toString','base64','[HTTP]','stringify','defaults','GET','map','includes','string','picklist','type','customField','nameField','toLowerCase','content','idField','push','variable','variableName','customVariable','Variable','queue','stripTrailingSlash','serverUrl','monitor_format','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','The\x20User\x20ID\x20is:','calleridname','The\x20Ticket\x20ID\x20is:','[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','error','outbound','none','[OUTBOUND]','destcalleridname','destcalleridnum','The\x20Enduser\x20ID\x20is:','%s/helpdesk/tickets/%d','catch','unmanaged','toUpperCase','lodash','request-promise','md5','util','ioredis','./util','../../../../config/environment','../../../../config/logger','freshdesk','redis','localhost','socket.io-emitter','application/json','emit','info','Creating\x20new\x20ticket...','merge','format','Caller\x20-\x20%s','calleridnum','getString','Descriptions','
','name','Fields','custom_fields','mapValues','value','%s/api/v2/tickets','remoteUri'];(function(_0x2678ff,_0x34838b){var _0x23a374=function(_0x104387){while(--_0x104387){_0x2678ff['push'](_0x2678ff['shift']());}};_0x23a374(++_0x34838b);}(_0x75e8,0x9e));var _0x875e=function(_0x44d258,_0x325a85){_0x44d258=_0x44d258-0x0;var _0x3baac9=_0x75e8[_0x44d258];return _0x3baac9;};'use strict';var _=require(_0x875e('0x0'));var rp=require(_0x875e('0x1'));var md5=require(_0x875e('0x2'));var util=require(_0x875e('0x3'));var Redis=require(_0x875e('0x4'));var intUtil=require(_0x875e('0x5'));var config=require(_0x875e('0x6'));var logger=require(_0x875e('0x7'))(_0x875e('0x8'));config[_0x875e('0x9')]=_['defaults'](config[_0x875e('0x9')],{'host':_0x875e('0xa'),'port':0x18eb});var io=require(_0x875e('0xb'))(new Redis(config[_0x875e('0x9')]));var headers={'Content-Type':_0x875e('0xc'),'Accept':_0x875e('0xc')};function emit(_0xd241fb,_0x5437ea,_0x1943ba){io['to'](_0xd241fb)[_0x875e('0xd')](_0x5437ea,_0x1943ba);}function getTicket(_0x19d01f,_0x4ca0f2,_0xc31358,_0x59f2b9,_0x1eecc8){logger[_0x875e('0xe')](_0x875e('0xf'));var _0x14508f=_[_0x875e('0x10')]({'responder_id':_0x4ca0f2['id'],'requester_id':_0xc31358['id'],'name':util[_0x875e('0x11')](_0x875e('0x12'),_0x1eecc8['calleridname']),'phone':_0x1eecc8[_0x875e('0x13')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil['getString'](_0x59f2b9['Subjects'],_0x1eecc8,'\x20'),'description':intUtil[_0x875e('0x14')](_0x59f2b9[_0x875e('0x15')],_0x1eecc8,_0x875e('0x16')),'tags':getTags(_0x59f2b9['Tags'],_0x875e('0x17'))},getCustomFields(_0x59f2b9[_0x875e('0x18')],_0x1eecc8));_0x14508f[_0x875e('0x19')]=_[_0x875e('0x1a')](_['keyBy'](_0x14508f[_0x875e('0x19')],'id'),_0x875e('0x1b'));return request({'uri':util['format'](_0x875e('0x1c'),_0x19d01f[_0x875e('0x1d')]),'method':_0x875e('0x1e'),'body':_0x14508f})[_0x875e('0x1f')](function(_0x3cbda7){logger[_0x875e('0xe')](_0x875e('0x20'));return _0x3cbda7;});}function getUser(_0x4ff5b3,_0x1f3419){if(intUtil[_0x875e('0x21')](_0x1f3419)){return request({'uri':util[_0x875e('0x11')]('%s/api/v2/agents',_0x4ff5b3[_0x875e('0x1d')]),'qs':{'email':_0x1f3419}})[_0x875e('0x1f')](function(_0x3d8266){if(_0x3d8266[_0x875e('0x22')]){logger['info']('Agent\x20found!');return _[_0x875e('0x23')](_0x3d8266,function(_0x45fd90){return _0x45fd90[_0x875e('0x24')][_0x875e('0x25')]===_0x1f3419;});}else{logger['info']('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0x875e('0x11')](_0x875e('0x26'),_0x4ff5b3[_0x875e('0x1d')])})[_0x875e('0x1f')](function(_0x2e7daa){logger['info'](_0x875e('0x27'));return _0x2e7daa;});}});}else{logger[_0x875e('0xe')](_0x875e('0x28'));return request({'uri':util[_0x875e('0x11')](_0x875e('0x26'),_0x4ff5b3[_0x875e('0x1d')])})[_0x875e('0x1f')](function(_0x51db62){logger[_0x875e('0xe')](_0x875e('0x27'));return _0x51db62;});}}function getEndUser(_0x285d0c,_0x499e09,_0x2f3f7f){logger[_0x875e('0xe')](_0x875e('0x29'),_0x2f3f7f);return request({'uri':util['format']('%s/api/v2/contacts',_0x285d0c[_0x875e('0x1d')]),'qs':{'phone':_0x2f3f7f}})[_0x875e('0x1f')](function(_0x450a75){if(_0x450a75['length']){logger[_0x875e('0xe')](_0x875e('0x2a'));return _['find'](_0x450a75,{'phone':_0x2f3f7f});}else{logger['info'](_0x875e('0x2b'));return request({'uri':util[_0x875e('0x11')](_0x875e('0x2c'),_0x285d0c['remoteUri']),'method':_0x875e('0x1e'),'body':{'name':_0x499e09,'phone':_0x2f3f7f}})['then'](function(_0xcb24d1){logger[_0x875e('0xe')]('Enduser\x20created.');return _0xcb24d1;});}});}function getAuth(_0x3cf255){return util[_0x875e('0x11')](_0x875e('0x2d'),new Buffer(_0x3cf255[_0x875e('0x2e')]+':X')[_0x875e('0x2f')](_0x875e('0x30')));}function request(_0x24abc8){logger['debug'](_0x875e('0x31'),JSON[_0x875e('0x32')](_0x24abc8));return rp(_[_0x875e('0x33')](_0x24abc8,{'method':_0x875e('0x34'),'headers':headers,'json':!![]}));}function getTags(_0x3448ae,_0x2e320c){var _0x4dee0e=[];if(_0x3448ae&&_0x3448ae['length']>0x0){_0x4dee0e=_[_0x875e('0x35')](_0x3448ae,_0x2e320c);}return _0x4dee0e;}function getCustomFields(_0x2ef49f,_0x28f7d5){var _0xd302a5=[];var _0x16cbe3={'custom_fields':[]};if(_0x2ef49f[_0x875e('0x22')]>0x0){_['forEach'](_0x2ef49f,function(_0x5a347f){if(_[_0x875e('0x36')]([_0x875e('0x37'),_0x875e('0x38')],_0x5a347f[_0x875e('0x39')])&&_0x5a347f['nameField']&&!_0x5a347f[_0x875e('0x3a')]){_0x16cbe3[_0x5a347f[_0x875e('0x3b')][_0x875e('0x3c')]()]=_0x5a347f[_0x875e('0x3d')]['toString']();}else if(_[_0x875e('0x36')]([_0x875e('0x37'),_0x875e('0x38')],_0x5a347f[_0x875e('0x39')])&&_0x5a347f[_0x875e('0x3e')]&&_0x5a347f['customField']){_0x16cbe3['custom_fields'][_0x875e('0x3f')]({'id':_0x5a347f[_0x875e('0x3e')],'value':_0x5a347f[_0x875e('0x3d')][_0x875e('0x2f')]()});}else if(_0x5a347f[_0x875e('0x39')]===_0x875e('0x40')&&_0x5a347f[_0x875e('0x41')]&&_0x5a347f[_0x875e('0x3e')]&&_0x5a347f[_0x875e('0x3a')]){_0x28f7d5[_0x5a347f[_0x875e('0x41')]]&&_0x16cbe3[_0x875e('0x19')]['push']({'id':_0x5a347f['idField'],'value':_0x28f7d5[_0x5a347f[_0x875e('0x41')]][_0x875e('0x2f')]()});}else if(_0x5a347f['type']===_0x875e('0x42')&&_0x5a347f[_0x875e('0x43')]&&_0x5a347f[_0x875e('0x43')][_0x875e('0x17')]&&_0x5a347f[_0x875e('0x3e')]&&_0x5a347f[_0x875e('0x3a')]){_0x28f7d5[_0x5a347f[_0x875e('0x43')]['name']['toLowerCase']()]&&_0x16cbe3[_0x875e('0x19')][_0x875e('0x3f')]({'id':_0x5a347f[_0x875e('0x3e')],'value':_0x28f7d5[_0x5a347f[_0x875e('0x43')][_0x875e('0x17')][_0x875e('0x3c')]()][_0x875e('0x2f')]()});}});}return _0x16cbe3;}exports[_0x875e('0x44')]=function(_0x2f5944,_0xe5aec9,_0x550860,_0x35e398,_0x45a5d4,_0x47f421){var _0x46ea98,_0x1edaf6;_0x47f421[_0x875e('0x1d')]=intUtil[_0x875e('0x45')](_0x47f421['remoteUri']);_0x47f421[_0x875e('0x46')]=intUtil[_0x875e('0x45')](_0x47f421['serverUrl']);if(_0x45a5d4&&_0x45a5d4[_0x875e('0x47')]){logger[_0x875e('0xe')]('[QUEUE]',_0x875e('0x48'));_0xe5aec9[_0x875e('0x49')]=util[_0x875e('0x11')](_0x875e('0x4a'),_0x47f421['serverUrl'],_0xe5aec9[_0x875e('0x4b')],md5(_0xe5aec9[_0x875e('0x4b')]));}else{_0xe5aec9[_0x875e('0x49')]='';}headers['Authorization']=getAuth(_0x47f421);return getUser(_0x47f421,_0x35e398[_0x875e('0x25')])['then'](function(_0x395b96){_0x46ea98=_0x395b96;logger[_0x875e('0xe')](_0x875e('0x4c'),_0x46ea98['id']);return getEndUser(_0x47f421,_0xe5aec9[_0x875e('0x4d')],_0xe5aec9['calleridnum']);})['then'](function(_0x8656e4){_0x1edaf6=_0x8656e4;logger[_0x875e('0xe')]('The\x20Enduser\x20ID\x20is:',_0x1edaf6['id']);return getTicket(_0x47f421,_0x46ea98,_0x1edaf6,_0x550860,_0xe5aec9);})[_0x875e('0x1f')](function(_0x2154ac){if(_0x2154ac&&_0x2154ac['id']){logger[_0x875e('0xe')](_0x875e('0x20'));logger[_0x875e('0xe')](_0x875e('0x4e'),_0x2154ac['id']);logger[_0x875e('0xe')](_0x875e('0x4f'),_0x875e('0x50'));emit(util[_0x875e('0x11')](_0x875e('0x51'),_0x35e398[_0x875e('0x17')]),_0x875e('0x52'),{'uri':util['format']('%s/helpdesk/tickets/%d',_0x47f421[_0x875e('0x1d')],_0x2154ac['id'])});}})['catch'](function(_0x5b6493){logger[_0x875e('0x53')]('[QUEUE]',JSON[_0x875e('0x32')](_0x5b6493));});};exports[_0x875e('0x54')]=function(_0x3b04f0,_0x56c682,_0x5b8cbd,_0x348d6a,_0x455d18,_0x104dcf,_0x4d5b81){var _0x493463,_0x9487fc;_0x104dcf[_0x875e('0x1d')]=intUtil[_0x875e('0x45')](_0x104dcf['remoteUri']);_0x104dcf['serverUrl']=intUtil[_0x875e('0x45')](_0x104dcf['serverUrl']);if(_0x4d5b81&&_0x4d5b81['recordingFormat']&&_0x4d5b81['recordingFormat']!==_0x875e('0x55')){logger[_0x875e('0xe')](_0x875e('0x56'),'Recording\x20is\x20enabled!');_0x56c682[_0x875e('0x49')]=util[_0x875e('0x11')](_0x875e('0x4a'),_0x104dcf['serverUrl'],_0x56c682[_0x875e('0x4b')],md5(_0x56c682[_0x875e('0x4b')]));}headers['Authorization']=getAuth(_0x104dcf);return getUser(_0x104dcf,_0x348d6a[_0x875e('0x25')])[_0x875e('0x1f')](function(_0x5194bf){_0x493463=_0x5194bf;logger[_0x875e('0xe')]('The\x20User\x20ID\x20is:',_0x493463['id']);return getEndUser(_0x104dcf,_0x56c682[_0x875e('0x57')],_0x56c682[_0x875e('0x58')]);})[_0x875e('0x1f')](function(_0x4d810){_0x9487fc=_0x4d810;logger[_0x875e('0xe')](_0x875e('0x59'),_0x9487fc['id']);return getTicket(_0x104dcf,_0x493463,_0x9487fc,_0x5b8cbd,_0x56c682);})[_0x875e('0x1f')](function(_0x8a83d0){if(_0x8a83d0&&_0x8a83d0['id']){logger[_0x875e('0xe')](_0x875e('0x20'));logger[_0x875e('0xe')](_0x875e('0x4e'),_0x8a83d0['id']);logger[_0x875e('0xe')](_0x875e('0x56'),_0x875e('0x50'));emit(util[_0x875e('0x11')](_0x875e('0x51'),_0x348d6a[_0x875e('0x17')]),_0x875e('0x52'),{'uri':util[_0x875e('0x11')](_0x875e('0x5a'),_0x104dcf[_0x875e('0x1d')],_0x8a83d0['id'])});}})[_0x875e('0x5b')](function(_0x1cbeab){logger[_0x875e('0x53')]('[OUTBOUND]',JSON[_0x875e('0x32')](_0x1cbeab));});};exports[_0x875e('0x5c')]=function(_0x4b6bc7,_0x457350,_0x5abd61,_0x211b24,_0x3dc1a3,_0x2973e7){var _0x15cceb,_0x5c40de;_0x2973e7[_0x875e('0x1d')]=intUtil[_0x875e('0x45')](_0x2973e7[_0x875e('0x1d')]);_0x2973e7[_0x875e('0x46')]=intUtil[_0x875e('0x45')](_0x2973e7['serverUrl']);if(_0x3dc1a3&&_0x3dc1a3[_0x875e('0x47')]){logger['info']('['+_0x457350['lastevent'][_0x875e('0x5d')]()+']','Recording\x20is\x20enabled!');_0x457350['recordingURL']=util[_0x875e('0x11')](_0x875e('0x4a'),_0x2973e7['serverUrl'],_0x457350['uniqueid'],md5(_0x457350[_0x875e('0x4b')]));}else{_0x457350[_0x875e('0x49')]='';}headers['Authorization']=getAuth(_0x2973e7);return getUser(_0x2973e7,'')['then'](function(_0x54423d){_0x15cceb=_0x54423d;logger['info'](_0x875e('0x4c'),_0x15cceb['id']);return getEndUser(_0x2973e7,_0x457350['calleridname'],_0x457350[_0x875e('0x13')]);})['then'](function(_0x1ce4a5){_0x5c40de=_0x1ce4a5;logger[_0x875e('0xe')]('The\x20Enduser\x20ID\x20is:',_0x5c40de['id']);return getTicket(_0x2973e7,_0x15cceb,_0x5c40de,_0x5abd61,_0x457350);})[_0x875e('0x1f')](function(_0x244679){if(_0x244679){logger[_0x875e('0xe')](_0x875e('0x20'));logger[_0x875e('0xe')](_0x875e('0x4e'),_0x244679['id']);}})[_0x875e('0x5b')](function(_0x68eef9){logger['error']('['+_0x457350['lastevent']['toUpperCase']()+']',JSON['stringify'](_0x68eef9));});}; \ 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 b539768..2d5348e 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 _0x28ea=['toLowerCase','outbound','calleridnum','callDirection','queue','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]','The\x20ticket\x20ID\x20is:\x20%s','Displaying\x20task\x20in\x20a\x20new\x20tab...','name','error',']\x20Error\x20running\x20Freshsales\x20integration','inspect','request-promise','md5','util','moment','bluebird','ioredis','./util','../../../../config/environment','../../../../config/logger','redis','localhost','socket.io-emitter','GET','/api/selector/owners','headers','info','Getting\x20admin\x20information','then','users','length','email','adminEmail','adminId','Admin\x20found:','Requested\x20Resource\x20not\x20Found','message','agentEmail','Getting\x20user\x20with\x20email','userEmail','userId','User\x20found:','Admin\x20selected','toUpperCase','/api/lookup?q=','&f=','&entities=contact','find','contacts','catch','format','mobile_number','contactNumber','endUserId','Contact\x20found\x20mobile_number:','work_number','POST','/api/contacts','YYYY-MM-DDTHH:mm:ss','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','contact','Creating\x20new\x20task','/api/tasks','getString','Subjects','Descriptions','Contact','add','ticketId','Task\x20created:','/contacts/','user:%s','emit','trigger:browser:url','Token\x20token=','apiKey','remoteUri','serverUrl','username'];(function(_0x4510f6,_0x2a6430){var _0x5e2489=function(_0x7c3af1){while(--_0x7c3af1){_0x4510f6['push'](_0x4510f6['shift']());}};_0x5e2489(++_0x2a6430);}(_0x28ea,0xc4));var _0xa28e=function(_0x5adaad,_0xd3bd98){_0x5adaad=_0x5adaad-0x0;var _0x3605b1=_0x28ea[_0x5adaad];return _0x3605b1;};'use strict';var _=require('lodash');var rp=require(_0xa28e('0x0'));var md5=require(_0xa28e('0x1'));var util=require(_0xa28e('0x2'));var moment=require(_0xa28e('0x3'));var Promise=require(_0xa28e('0x4'));var Redis=require(_0xa28e('0x5'));var intUtil=require(_0xa28e('0x6'));var config=require(_0xa28e('0x7'));var logger=require(_0xa28e('0x8'))('freshsales');config[_0xa28e('0x9')]=_['defaults'](config[_0xa28e('0x9')],{'host':_0xa28e('0xa'),'port':0x18eb});var io=require(_0xa28e('0xb'))(new Redis(config[_0xa28e('0x9')]));function getAdminId(_0x4ae4fd,_0x410acb,_0x4149d0,_0x61bcd7){return new Promise(function(_0x35a56d,_0x170c60){var _0x40d3bd=![];var _0x5ffcbd={'method':_0xa28e('0xc'),'uri':_0x61bcd7+_0xa28e('0xd'),'json':!![]};_0x5ffcbd[_0xa28e('0xe')]=_0x4149d0;logger[_0xa28e('0xf')](_0xa28e('0x10'));return rp(_0x5ffcbd)[_0xa28e('0x11')](function(_0x33864c){if(_0x33864c){var _0x41d587=_0x33864c[_0xa28e('0x12')];var _0x2cda92=null;for(_0x2cda92=0x0;_0x2cda92<_0x41d587[_0xa28e('0x13')];_0x2cda92++){if(_0x41d587[_0x2cda92][_0xa28e('0x14')]===_0x4ae4fd[_0xa28e('0x15')]){_0x4ae4fd[_0xa28e('0x16')]=_0x41d587[_0x2cda92]['id'];_0x40d3bd=!![];}}if(_0x40d3bd){logger[_0xa28e('0xf')](_0xa28e('0x17'),_0x4ae4fd['adminId']);_0x35a56d(_0x4ae4fd);}else{_0x170c60({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}else{_0x170c60({'statusCode':0x194,'message':_0xa28e('0x18')});}})['catch'](function(_0x1c3d93){logger['error']('['+[_0x410acb['toUpperCase']()]+']',_0x1c3d93[_0xa28e('0x19')]);_0x170c60(_0x1c3d93);});});}function getUser(_0x252271,_0x468427,_0x4d2ae3){return function(_0x14d423){return new Promise(function(_0x20d7d4,_0x23acf3){var _0x1ff425={'method':_0xa28e('0xc'),'uri':_0x4d2ae3+_0xa28e('0xd'),'json':!![]};_0x1ff425['headers']=_0x468427;logger[_0xa28e('0xf')]('Getting\x20user\x20list');return rp(_0x1ff425)[_0xa28e('0x11')](function(_0x18f671){if(_0x18f671){var _0x37d9cf=_0x18f671[_0xa28e('0x12')];var _0x1240fd=![];var _0x187800=null;if(_0x14d423[_0xa28e('0x1a')]!==null){logger['info'](_0xa28e('0x1b'),_0x14d423[_0xa28e('0x1a')]);_0x14d423[_0xa28e('0x1c')]=_0x14d423['agentEmail'];for(_0x187800=0x0;_0x187800<_0x37d9cf[_0xa28e('0x13')];_0x187800++){if(_0x37d9cf[_0x187800][_0xa28e('0x14')]===_0x14d423[_0xa28e('0x1a')]){_0x1240fd=!![];_0x14d423[_0xa28e('0x1d')]=_0x37d9cf[_0x187800]['id'];logger[_0xa28e('0xf')](_0xa28e('0x1e'),_0x14d423['userId']);}}}if(!_0x1240fd){logger[_0xa28e('0xf')](_0xa28e('0x1f'));_0x14d423[_0xa28e('0x1c')]=_0x14d423[_0xa28e('0x15')];_0x14d423[_0xa28e('0x1d')]=_0x14d423[_0xa28e('0x16')];_0x1240fd=!![];}if(_0x1240fd){_0x20d7d4(_0x14d423);}else{_0x23acf3({'statusCode':0x194,'message':_0xa28e('0x18')});}}else{_0x23acf3({'statusCode':0x194,'message':_0xa28e('0x18')});}})['catch'](function(_0xad85ea){logger['error']('['+[_0x252271[_0xa28e('0x20')]()]+']',_0xad85ea['message']);_0x23acf3(_0xad85ea);});});};}function searchContact(_0x441025,_0x211040,_0x41404a,_0x4fd7de){return new Promise(function(_0x4631bd,_0x5daf25){var _0x4e6537={'method':_0xa28e('0xc'),'headers':_0x211040,'uri':_0x441025+_0xa28e('0x21')+_0x4fd7de+_0xa28e('0x22')+_0x41404a+_0xa28e('0x23'),'json':!![]};rp(_0x4e6537)[_0xa28e('0x11')](function(_0x1b7ae4){var _0x2fa284=_[_0xa28e('0x24')](_0x1b7ae4['contacts'][_0xa28e('0x25')],[_0x41404a,_0x4fd7de]);_0x4631bd(_0x2fa284);})[_0xa28e('0x26')](function(_0x45be55){_0x5daf25(_0x45be55);});});}function getEndUser(_0x29ced5,_0x3de1be,_0x4c65a0){return function(_0x1a5b46){return new Promise(function(_0x400455,_0x5516a5){logger['info'](util[_0xa28e('0x27')]('Searching\x20contact\x20with\x20phone\x20%s',_0x1a5b46['contactNumber']));searchContact(_0x4c65a0,_0x3de1be,_0xa28e('0x28'),_0x1a5b46[_0xa28e('0x29')])[_0xa28e('0x11')](function(_0x45dbd2){if(_0x45dbd2){_0x1a5b46[_0xa28e('0x2a')]=_0x45dbd2['id'];logger[_0xa28e('0xf')](_0xa28e('0x2b'),_0x1a5b46[_0xa28e('0x2a')]);return _0x400455(_0x1a5b46);}searchContact(_0x4c65a0,_0x3de1be,_0xa28e('0x2c'),_0x1a5b46['contactNumber'])['then'](function(_0x56c00d){if(_0x56c00d){_0x1a5b46[_0xa28e('0x2a')]=_0x56c00d['id'];logger[_0xa28e('0xf')]('Contact\x20found\x20work_number:',_0x1a5b46[_0xa28e('0x2a')]);return _0x400455(_0x1a5b46);}createEndUser(_0x1a5b46,_0x29ced5,_0x3de1be,_0x4c65a0)[_0xa28e('0x11')](function(_0x2ad814){logger['info']('Contact\x20created:',_0x2ad814['endUserId']);return _0x400455(_0x2ad814);});});})['catch'](function(_0x30cf22){_0x5516a5(_0x30cf22);});});};}function createEndUser(_0x45ff03,_0x2c84ac,_0x2dcc84,_0x2cc448){return new Promise(function(_0x33bcf8,_0x1cf67e){var _0x4a9983=moment();var _0x45ed0a={'method':_0xa28e('0x2d'),'uri':_0x2cc448+_0xa28e('0x2e'),'body':{'contact':{'last_name':_0x45ff03[_0xa28e('0x29')],'work_number':_0x45ff03[_0xa28e('0x29')],'mobile_number':_0x45ff03[_0xa28e('0x29')],'owner_id':_0x45ff03[_0xa28e('0x1d')],'created_at':_0x4a9983[_0xa28e('0x27')](_0xa28e('0x2f'))}},'json':!![]};_0x45ed0a['headers']=_0x2dcc84;logger[_0xa28e('0xf')](_0xa28e('0x30'));return rp(_0x45ed0a)[_0xa28e('0x11')](function(_0x470f7f){_0x45ff03['endUserId']=_0x470f7f[_0xa28e('0x31')]['id'];_0x33bcf8(_0x45ff03);})['catch'](function(_0x49f0aa){logger['error']('['+[_0x2c84ac['toUpperCase']()]+']',_0x49f0aa[_0xa28e('0x19')]);_0x1cf67e(_0x49f0aa[_0xa28e('0x19')]);});});}function getTicket(_0x4897e4,_0x435336,_0x51fad8,_0x26bdd8,_0x2ebd5d){return function(_0x40720d){logger[_0xa28e('0xf')](_0xa28e('0x32'));return new Promise(function(_0x571079,_0x2f7be8){var _0x199cb0=moment();var _0x495667={'method':_0xa28e('0x2d'),'uri':_0x51fad8+_0xa28e('0x33'),'body':{'title':intUtil[_0xa28e('0x34')](_0x26bdd8[_0xa28e('0x35')],_0x2ebd5d,'\x20'),'description':intUtil[_0xa28e('0x34')](_0x26bdd8[_0xa28e('0x36')],_0x2ebd5d,'\x0a'),'owner_id':_0x40720d[_0xa28e('0x1d')],'creater_id':_0x40720d[_0xa28e('0x16')],'targetable_id':_0x40720d['endUserId'],'targetable_type':_0xa28e('0x37'),'created_at':_0x199cb0[_0xa28e('0x27')](_0xa28e('0x2f')),'due_date':_0x199cb0[_0xa28e('0x38')](0x1e,'m')[_0xa28e('0x27')](_0xa28e('0x2f'))},'json':!![]};_0x495667[_0xa28e('0xe')]=_0x435336;return rp(_0x495667)[_0xa28e('0x11')](function(_0x3db8d9){_0x40720d[_0xa28e('0x39')]=_0x3db8d9['task']['id'];logger['info'](_0xa28e('0x3a'),_0x40720d['ticketId']);_0x571079(_0x40720d);})[_0xa28e('0x26')](function(_0x5315a0){logger['error']('['+[_0x4897e4['toUpperCase']()]+']',_0x5315a0[_0xa28e('0x19')]);_0x2f7be8(_0x5315a0[_0xa28e('0x19')]);});});};}function emit(_0x349b10,_0x14d3f2,_0x356ecf){var _0x33ba52={'uri':_0x349b10+_0xa28e('0x3b')+_0x356ecf};io['to'](util[_0xa28e('0x27')](_0xa28e('0x3c'),_0x14d3f2))[_0xa28e('0x3d')](_0xa28e('0x3e'),_0x33ba52);}exports['cs']=function(_0x2d9c14,_0x1bac2b,_0x8cc838,_0x5d4c42,_0x34ae4f,_0x435168,_0x124473,_0x4ace9d){var _0x5295eb={};var _0x5b9e0c={'Authorization':_0xa28e('0x3f')+_0x435168[_0xa28e('0x40')]};_0x435168[_0xa28e('0x41')]=intUtil['stripTrailingSlash'](_0x435168[_0xa28e('0x41')]);_0x435168[_0xa28e('0x42')]=intUtil['stripTrailingSlash'](_0x435168[_0xa28e('0x42')]);var _0x398178=_0x435168[_0xa28e('0x41')];_0x5295eb[_0xa28e('0x15')]=_0x435168[_0xa28e('0x43')];_0x5295eb[_0xa28e('0x29')]=_0x4ace9d[_0xa28e('0x44')]()===_0xa28e('0x45')?_0x1bac2b['destcalleridnum']:_0x1bac2b[_0xa28e('0x46')];_0x5295eb[_0xa28e('0x47')]=_0x4ace9d==='queue'||_0x4ace9d==='unmanaged'?_0xa28e('0x48'):'outbound';if(_0x5d4c42){_0x5295eb['agentEmail']=_0x5d4c42[_0xa28e('0x14')];}var _0x17d6e3=util[_0xa28e('0x27')](_0xa28e('0x49'),_0x435168[_0xa28e('0x42')],_0x1bac2b[_0xa28e('0x4a')],md5(_0x1bac2b[_0xa28e('0x4a')]));if(_0x34ae4f&&_0x34ae4f[_0xa28e('0x4b')]){logger[_0xa28e('0xf')](_0xa28e('0x4c'),_0xa28e('0x4d'));_0x1bac2b[_0xa28e('0x4e')]=_0x17d6e3;}else if(_0x124473&&_0x124473[_0xa28e('0x4f')]&&_0x124473[_0xa28e('0x4f')]!==_0xa28e('0x50')){logger[_0xa28e('0xf')](_0xa28e('0x51'),_0xa28e('0x4d'));_0x1bac2b[_0xa28e('0x4e')]=_0x17d6e3;}else{_0x1bac2b[_0xa28e('0x4e')]='';}return getAdminId(_0x5295eb,_0x4ace9d,_0x5b9e0c,_0x398178)['then'](getUser(_0x4ace9d,_0x5b9e0c,_0x398178))[_0xa28e('0x11')](getEndUser(_0x4ace9d,_0x5b9e0c,_0x398178))[_0xa28e('0x11')](getTicket(_0x4ace9d,_0x5b9e0c,_0x398178,_0x8cc838,_0x1bac2b))[_0xa28e('0x11')](function(_0x1dea0d){logger[_0xa28e('0xf')](util[_0xa28e('0x27')](_0xa28e('0x52'),_0x1dea0d[_0xa28e('0x39')]));if(_0x4ace9d!=='unmanaged'){logger[_0xa28e('0xf')]('['+[_0x4ace9d[_0xa28e('0x20')]()]+']',_0xa28e('0x53'));emit(_0x398178,_0x5d4c42[_0xa28e('0x54')],_0x1dea0d[_0xa28e('0x2a')]);}})[_0xa28e('0x26')](function(_0x398fd0){logger[_0xa28e('0x55')]('['+[_0x4ace9d[_0xa28e('0x20')]()]+_0xa28e('0x56'),util[_0xa28e('0x57')](_0x398fd0,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0xdc04=['remoteUri','stripTrailingSlash','serverUrl','username','toLowerCase','outbound','destcalleridnum','callDirection','queue','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingFormat','none','[OUTBOUND]','recordingURL','name','inspect','lodash','request-promise','md5','util','moment','bluebird','./util','../../../../config/environment','../../../../config/logger','freshsales','localhost','GET','/api/selector/owners','info','users','length','adminEmail','Admin\x20found:','adminId','Requested\x20Resource\x20not\x20Found','catch','error','toUpperCase','message','headers','agentEmail','Getting\x20user\x20with\x20email','email','userId','userEmail','&f=','&entities=contact','then','contacts','format','contactNumber','mobile_number','Contact\x20found\x20mobile_number:','Contact\x20found\x20work_number:','POST','/api/contacts','endUserId','contact','Creating\x20new\x20task','/api/tasks','getString','Subjects','Descriptions','YYYY-MM-DDTHH:mm:ss','add','ticketId','task','Task\x20created:','/contacts/','user:%s','emit','trigger:browser:url','apiKey'];(function(_0x52b3f5,_0x46609e){var _0x3d52aa=function(_0x523ac5){while(--_0x523ac5){_0x52b3f5['push'](_0x52b3f5['shift']());}};_0x3d52aa(++_0x46609e);}(_0xdc04,0x64));var _0x4dc0=function(_0x5456c5,_0x1c0f4b){_0x5456c5=_0x5456c5-0x0;var _0x45cd5b=_0xdc04[_0x5456c5];return _0x45cd5b;};'use strict';var _=require(_0x4dc0('0x0'));var rp=require(_0x4dc0('0x1'));var md5=require(_0x4dc0('0x2'));var util=require(_0x4dc0('0x3'));var moment=require(_0x4dc0('0x4'));var Promise=require(_0x4dc0('0x5'));var Redis=require('ioredis');var intUtil=require(_0x4dc0('0x6'));var config=require(_0x4dc0('0x7'));var logger=require(_0x4dc0('0x8'))(_0x4dc0('0x9'));config['redis']=_['defaults'](config['redis'],{'host':_0x4dc0('0xa'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function getAdminId(_0x15a06b,_0x10edb2,_0x5ad8cd,_0x3f5996){return new Promise(function(_0x3adeee,_0x2ca6f0){var _0x58b116=![];var _0x13d336={'method':_0x4dc0('0xb'),'uri':_0x3f5996+_0x4dc0('0xc'),'json':!![]};_0x13d336['headers']=_0x5ad8cd;logger[_0x4dc0('0xd')]('Getting\x20admin\x20information');return rp(_0x13d336)['then'](function(_0x5a23c3){if(_0x5a23c3){var _0x4ed909=_0x5a23c3[_0x4dc0('0xe')];var _0x27b91c=null;for(_0x27b91c=0x0;_0x27b91c<_0x4ed909[_0x4dc0('0xf')];_0x27b91c++){if(_0x4ed909[_0x27b91c]['email']===_0x15a06b[_0x4dc0('0x10')]){_0x15a06b['adminId']=_0x4ed909[_0x27b91c]['id'];_0x58b116=!![];}}if(_0x58b116){logger[_0x4dc0('0xd')](_0x4dc0('0x11'),_0x15a06b[_0x4dc0('0x12')]);_0x3adeee(_0x15a06b);}else{_0x2ca6f0({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}else{_0x2ca6f0({'statusCode':0x194,'message':_0x4dc0('0x13')});}})[_0x4dc0('0x14')](function(_0xdb23b9){logger[_0x4dc0('0x15')]('['+[_0x10edb2[_0x4dc0('0x16')]()]+']',_0xdb23b9[_0x4dc0('0x17')]);_0x2ca6f0(_0xdb23b9);});});}function getUser(_0x2c5adb,_0x2e8940,_0x24d35a){return function(_0x4d86ec){return new Promise(function(_0x3ce759,_0x43e449){var _0x169e32={'method':_0x4dc0('0xb'),'uri':_0x24d35a+_0x4dc0('0xc'),'json':!![]};_0x169e32[_0x4dc0('0x18')]=_0x2e8940;logger['info']('Getting\x20user\x20list');return rp(_0x169e32)['then'](function(_0x516ab0){if(_0x516ab0){var _0x318d12=_0x516ab0['users'];var _0x163269=![];var _0x5f2a30=null;if(_0x4d86ec[_0x4dc0('0x19')]!==null){logger['info'](_0x4dc0('0x1a'),_0x4d86ec[_0x4dc0('0x19')]);_0x4d86ec['userEmail']=_0x4d86ec[_0x4dc0('0x19')];for(_0x5f2a30=0x0;_0x5f2a30<_0x318d12[_0x4dc0('0xf')];_0x5f2a30++){if(_0x318d12[_0x5f2a30][_0x4dc0('0x1b')]===_0x4d86ec[_0x4dc0('0x19')]){_0x163269=!![];_0x4d86ec['userId']=_0x318d12[_0x5f2a30]['id'];logger['info']('User\x20found:',_0x4d86ec[_0x4dc0('0x1c')]);}}}if(!_0x163269){logger[_0x4dc0('0xd')]('Admin\x20selected');_0x4d86ec[_0x4dc0('0x1d')]=_0x4d86ec[_0x4dc0('0x10')];_0x4d86ec['userId']=_0x4d86ec['adminId'];_0x163269=!![];}if(_0x163269){_0x3ce759(_0x4d86ec);}else{_0x43e449({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}else{_0x43e449({'statusCode':0x194,'message':_0x4dc0('0x13')});}})[_0x4dc0('0x14')](function(_0x4e0772){logger[_0x4dc0('0x15')]('['+[_0x2c5adb[_0x4dc0('0x16')]()]+']',_0x4e0772['message']);_0x43e449(_0x4e0772);});});};}function searchContact(_0x9e6436,_0x5d6bcd,_0x47e969,_0x1bf1d6){return new Promise(function(_0x269f0e,_0x5a5edd){var _0x38a2e0={'method':_0x4dc0('0xb'),'headers':_0x5d6bcd,'uri':_0x9e6436+'/api/lookup?q='+_0x1bf1d6+_0x4dc0('0x1e')+_0x47e969+_0x4dc0('0x1f'),'json':!![]};rp(_0x38a2e0)[_0x4dc0('0x20')](function(_0x33993e){var _0x500220=_['find'](_0x33993e[_0x4dc0('0x21')][_0x4dc0('0x21')],[_0x47e969,_0x1bf1d6]);_0x269f0e(_0x500220);})[_0x4dc0('0x14')](function(_0x473a90){_0x5a5edd(_0x473a90);});});}function getEndUser(_0x3fd790,_0x55f984,_0x315c88){return function(_0x5324fc){return new Promise(function(_0x17be45,_0x210109){logger[_0x4dc0('0xd')](util[_0x4dc0('0x22')]('Searching\x20contact\x20with\x20phone\x20%s',_0x5324fc[_0x4dc0('0x23')]));searchContact(_0x315c88,_0x55f984,_0x4dc0('0x24'),_0x5324fc[_0x4dc0('0x23')])[_0x4dc0('0x20')](function(_0x448ec7){if(_0x448ec7){_0x5324fc['endUserId']=_0x448ec7['id'];logger[_0x4dc0('0xd')](_0x4dc0('0x25'),_0x5324fc['endUserId']);return _0x17be45(_0x5324fc);}searchContact(_0x315c88,_0x55f984,'work_number',_0x5324fc[_0x4dc0('0x23')])['then'](function(_0x34a753){if(_0x34a753){_0x5324fc['endUserId']=_0x34a753['id'];logger['info'](_0x4dc0('0x26'),_0x5324fc['endUserId']);return _0x17be45(_0x5324fc);}createEndUser(_0x5324fc,_0x3fd790,_0x55f984,_0x315c88)[_0x4dc0('0x20')](function(_0x3a15db){logger[_0x4dc0('0xd')]('Contact\x20created:',_0x3a15db['endUserId']);return _0x17be45(_0x3a15db);});});})['catch'](function(_0x2717d5){_0x210109(_0x2717d5);});});};}function createEndUser(_0xa5e2e4,_0x1eca07,_0x33a973,_0x14bdc2){return new Promise(function(_0x3258be,_0x1b3ab6){var _0x34afdc=moment();var _0x1fa5ce={'method':_0x4dc0('0x27'),'uri':_0x14bdc2+_0x4dc0('0x28'),'body':{'contact':{'last_name':_0xa5e2e4[_0x4dc0('0x23')],'work_number':_0xa5e2e4[_0x4dc0('0x23')],'mobile_number':_0xa5e2e4[_0x4dc0('0x23')],'owner_id':_0xa5e2e4['userId'],'created_at':_0x34afdc['format']('YYYY-MM-DDTHH:mm:ss')}},'json':!![]};_0x1fa5ce[_0x4dc0('0x18')]=_0x33a973;logger[_0x4dc0('0xd')]('Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact');return rp(_0x1fa5ce)[_0x4dc0('0x20')](function(_0x56be13){_0xa5e2e4[_0x4dc0('0x29')]=_0x56be13[_0x4dc0('0x2a')]['id'];_0x3258be(_0xa5e2e4);})[_0x4dc0('0x14')](function(_0x357992){logger['error']('['+[_0x1eca07['toUpperCase']()]+']',_0x357992[_0x4dc0('0x17')]);_0x1b3ab6(_0x357992[_0x4dc0('0x17')]);});});}function getTicket(_0x398b00,_0xeeef1c,_0x1287c5,_0x43dd78,_0x195172){return function(_0x270115){logger['info'](_0x4dc0('0x2b'));return new Promise(function(_0x51a062,_0x557229){var _0x175506=moment();var _0x188e53={'method':_0x4dc0('0x27'),'uri':_0x1287c5+_0x4dc0('0x2c'),'body':{'title':intUtil[_0x4dc0('0x2d')](_0x43dd78[_0x4dc0('0x2e')],_0x195172,'\x20'),'description':intUtil[_0x4dc0('0x2d')](_0x43dd78[_0x4dc0('0x2f')],_0x195172,'\x0a'),'owner_id':_0x270115[_0x4dc0('0x1c')],'creater_id':_0x270115[_0x4dc0('0x12')],'targetable_id':_0x270115[_0x4dc0('0x29')],'targetable_type':'Contact','created_at':_0x175506['format'](_0x4dc0('0x30')),'due_date':_0x175506[_0x4dc0('0x31')](0x1e,'m')['format'](_0x4dc0('0x30'))},'json':!![]};_0x188e53['headers']=_0xeeef1c;return rp(_0x188e53)['then'](function(_0x175e1f){_0x270115[_0x4dc0('0x32')]=_0x175e1f[_0x4dc0('0x33')]['id'];logger[_0x4dc0('0xd')](_0x4dc0('0x34'),_0x270115['ticketId']);_0x51a062(_0x270115);})[_0x4dc0('0x14')](function(_0x391717){logger['error']('['+[_0x398b00[_0x4dc0('0x16')]()]+']',_0x391717[_0x4dc0('0x17')]);_0x557229(_0x391717[_0x4dc0('0x17')]);});});};}function emit(_0x4fc19d,_0x633001,_0x56a163){var _0x5ac47d={'uri':_0x4fc19d+_0x4dc0('0x35')+_0x56a163};io['to'](util[_0x4dc0('0x22')](_0x4dc0('0x36'),_0x633001))[_0x4dc0('0x37')](_0x4dc0('0x38'),_0x5ac47d);}exports['cs']=function(_0x35edac,_0x3daf49,_0x286401,_0x1124da,_0x30fc97,_0x51dc9e,_0x29b437,_0x2fec34){var _0x3d27c7={};var _0xc0a3e0={'Authorization':'Token\x20token='+_0x51dc9e[_0x4dc0('0x39')]};_0x51dc9e['remoteUri']=intUtil['stripTrailingSlash'](_0x51dc9e[_0x4dc0('0x3a')]);_0x51dc9e['serverUrl']=intUtil[_0x4dc0('0x3b')](_0x51dc9e[_0x4dc0('0x3c')]);var _0x4be2b3=_0x51dc9e[_0x4dc0('0x3a')];_0x3d27c7[_0x4dc0('0x10')]=_0x51dc9e[_0x4dc0('0x3d')];_0x3d27c7['contactNumber']=_0x2fec34[_0x4dc0('0x3e')]()===_0x4dc0('0x3f')?_0x3daf49[_0x4dc0('0x40')]:_0x3daf49['calleridnum'];_0x3d27c7[_0x4dc0('0x41')]=_0x2fec34===_0x4dc0('0x42')||_0x2fec34===_0x4dc0('0x43')?_0x4dc0('0x42'):_0x4dc0('0x3f');if(_0x1124da){_0x3d27c7[_0x4dc0('0x19')]=_0x1124da[_0x4dc0('0x1b')];}var _0x4ec45e=util['format'](_0x4dc0('0x44'),_0x51dc9e[_0x4dc0('0x3c')],_0x3daf49[_0x4dc0('0x45')],md5(_0x3daf49['uniqueid']));if(_0x30fc97&&_0x30fc97[_0x4dc0('0x46')]){logger[_0x4dc0('0xd')](_0x4dc0('0x47'),_0x4dc0('0x48'));_0x3daf49['recordingURL']=_0x4ec45e;}else if(_0x29b437&&_0x29b437['recordingFormat']&&_0x29b437[_0x4dc0('0x49')]!==_0x4dc0('0x4a')){logger[_0x4dc0('0xd')](_0x4dc0('0x4b'),_0x4dc0('0x48'));_0x3daf49[_0x4dc0('0x4c')]=_0x4ec45e;}else{_0x3daf49[_0x4dc0('0x4c')]='';}return getAdminId(_0x3d27c7,_0x2fec34,_0xc0a3e0,_0x4be2b3)['then'](getUser(_0x2fec34,_0xc0a3e0,_0x4be2b3))['then'](getEndUser(_0x2fec34,_0xc0a3e0,_0x4be2b3))['then'](getTicket(_0x2fec34,_0xc0a3e0,_0x4be2b3,_0x286401,_0x3daf49))[_0x4dc0('0x20')](function(_0x2d2a70){logger[_0x4dc0('0xd')](util['format']('The\x20ticket\x20ID\x20is:\x20%s',_0x2d2a70[_0x4dc0('0x32')]));if(_0x2fec34!==_0x4dc0('0x43')){logger[_0x4dc0('0xd')]('['+[_0x2fec34[_0x4dc0('0x16')]()]+']','Displaying\x20task\x20in\x20a\x20new\x20tab...');emit(_0x4be2b3,_0x1124da[_0x4dc0('0x4d')],_0x2d2a70['endUserId']);}})['catch'](function(_0x22e2b0){logger['error']('['+[_0x2fec34[_0x4dc0('0x16')]()]+']\x20Error\x20running\x20Freshsales\x20integration',util[_0x4dc0('0x4e')](_0x22e2b0,{'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 e9c58b7..cf60f1c 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 _0x5156=['data3','queue','routeId','outbound','log','EVENT\x20UNKNOWN','salesforce','vtiger','unknown\x20integration','../../../../config/logger','error','[EXEC]','%s\x20configuration\x20#%s\x20not\x20found','%s\x20account\x20#%s\x20not\x20found','data2','lodash','util','./sugarcrm','./freshdesk','./desk','./servicenow','./dynamics365','./freshsales','freshdesk','zoho','desk','dynamics365','freshsales','servicenow','exec','includes','toLowerCase','data1','find','Configurations'];(function(_0x54d6db,_0x3ae2c8){var _0x531e3d=function(_0x4fa7fc){while(--_0x4fa7fc){_0x54d6db['push'](_0x54d6db['shift']());}};_0x531e3d(++_0x3ae2c8);}(_0x5156,0x104));var _0x6515=function(_0x1945a5,_0x50de54){_0x1945a5=_0x1945a5-0x0;var _0x5817a5=_0x5156[_0x1945a5];return _0x5817a5;};'use strict';var _=require(_0x6515('0x0'));var util=require(_0x6515('0x1'));var zendesk=require('./zendesk');var salesforce=require('./salesforce');var sugarcrm=require(_0x6515('0x2'));var freshdesk=require(_0x6515('0x3'));var zoho=require('./zoho');var desk=require(_0x6515('0x4'));var vtiger=require('./vtiger');var servicenow=require(_0x6515('0x5'));var dynamics365=require(_0x6515('0x6'));var freshsales=require(_0x6515('0x7'));var integrations=['zendesk','salesforce','sugarcrm',_0x6515('0x8'),_0x6515('0x9'),_0x6515('0xa'),'vtiger',_0x6515('0xb'),_0x6515('0xc'),_0x6515('0xd')];exports[_0x6515('0xe')]=function(_0x21203f,_0x2493bc,_0x22e754,_0x5c4739,_0xe369c,_0x3630a){if(_0x22e754){if(_[_0x6515('0xf')](integrations,_0x21203f['data1'][_0x6515('0x10')]())){try{var _0x42c7c9=null;var _0x4e02b6='';var _0x3e08bf=_0x22e754[_0x21203f[_0x6515('0x11')][_0x6515('0x10')]()];if(_0x3e08bf){var _0x21283f=_0x3e08bf[_0x21203f['data2']];if(_0x21283f){var _0x17a2db=_[_0x6515('0x12')](_0x21283f[_0x6515('0x13')],{'id':parseInt(_0x21203f[_0x6515('0x14')],0xa)});if(_0x17a2db){if(_0x5c4739){if(_0xe369c&&_0x2493bc[_0x6515('0x15')]){_0x4e02b6='queue';}else if(_0x2493bc[_0x6515('0x16')]){_0x4e02b6=_0x6515('0x17');}else{console[_0x6515('0x18')](_0x6515('0x19'),_0x2493bc);}}else{_0x4e02b6='unmanaged';}switch(_0x21203f['data1'][_0x6515('0x10')]()){case'zendesk':zendesk[_0x4e02b6](_0x21203f,_0x2493bc,_0x17a2db,_0x5c4739,_0xe369c,_0x21283f,_0x3630a);break;case _0x6515('0x1a'):salesforce[_0x4e02b6](_0x21203f,_0x2493bc,_0x17a2db,_0x5c4739,_0xe369c,_0x21283f,_0x3630a);break;case'sugarcrm':sugarcrm[_0x4e02b6](_0x21203f,_0x2493bc,_0x17a2db,_0x5c4739,_0xe369c,_0x21283f,_0x3630a);break;case _0x6515('0x8'):freshdesk[_0x4e02b6](_0x21203f,_0x2493bc,_0x17a2db,_0x5c4739,_0xe369c,_0x21283f,_0x3630a);break;case _0x6515('0x9'):zoho[_0x4e02b6](_0x21203f,_0x2493bc,_0x17a2db,_0x5c4739,_0xe369c,_0x21283f,_0x3630a);break;case'desk':desk[_0x4e02b6](_0x21203f,_0x2493bc,_0x17a2db,_0x5c4739,_0xe369c,_0x21283f,_0x3630a);break;case _0x6515('0x1b'):vtiger[_0x4e02b6](_0x21203f,_0x2493bc,_0x17a2db,_0x5c4739,_0xe369c,_0x21283f,_0x3630a);break;case'freshsales':freshsales['cs'](_0x21203f,_0x2493bc,_0x17a2db,_0x5c4739,_0xe369c,_0x21283f,_0x3630a,_0x4e02b6);break;case _0x6515('0xd'):servicenow['cs'](_0x21203f,_0x2493bc,_0x17a2db,_0x5c4739,_0xe369c,_0x21283f,_0x3630a,_0x4e02b6);break;case _0x6515('0xb'):dynamics365['cs'](_0x21203f,_0x2493bc,_0x17a2db,_0x5c4739,_0xe369c,_0x21283f,_0x3630a,_0x4e02b6);break;default:console[_0x6515('0x18')](_0x6515('0x1c'));}}else{_0x42c7c9=require(_0x6515('0x1d'))(_0x21203f[_0x6515('0x11')][_0x6515('0x10')]());_0x42c7c9[_0x6515('0x1e')](_0x6515('0x1f'),util['format'](_0x6515('0x20'),_0x21203f[_0x6515('0x11')][_0x6515('0x10')](),_0x21203f['data3']));}}else{_0x42c7c9=require(_0x6515('0x1d'))(_0x21203f[_0x6515('0x11')][_0x6515('0x10')]());_0x42c7c9['error']('[EXEC]',util['format'](_0x6515('0x21'),_0x21203f[_0x6515('0x11')][_0x6515('0x10')](),_0x21203f[_0x6515('0x22')]));}}else{}}catch(_0x4e550b){console[_0x6515('0x1e')](_0x4e550b);}}}}; \ No newline at end of file +var _0x7185=['[EXEC]','%s\x20configuration\x20#%s\x20not\x20found','error','format','%s\x20account\x20#%s\x20not\x20found','lodash','./zendesk','./salesforce','./zoho','./desk','./vtiger','./servicenow','./dynamics365','zendesk','salesforce','freshdesk','zoho','vtiger','dynamics365','freshsales','servicenow','exec','includes','data1','toLowerCase','data2','find','Configurations','data3','queue','routeId','log','EVENT\x20UNKNOWN','unmanaged','sugarcrm','desk','unknown\x20integration','../../../../config/logger'];(function(_0x127530,_0x54a9be){var _0x405622=function(_0x36210c){while(--_0x36210c){_0x127530['push'](_0x127530['shift']());}};_0x405622(++_0x54a9be);}(_0x7185,0x9d));var _0x5718=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x7185[_0x57b54c];return _0x59cc19;};'use strict';var _=require(_0x5718('0x0'));var util=require('util');var zendesk=require(_0x5718('0x1'));var salesforce=require(_0x5718('0x2'));var sugarcrm=require('./sugarcrm');var freshdesk=require('./freshdesk');var zoho=require(_0x5718('0x3'));var desk=require(_0x5718('0x4'));var vtiger=require(_0x5718('0x5'));var servicenow=require(_0x5718('0x6'));var dynamics365=require(_0x5718('0x7'));var freshsales=require('./freshsales');var integrations=[_0x5718('0x8'),_0x5718('0x9'),'sugarcrm',_0x5718('0xa'),_0x5718('0xb'),'desk',_0x5718('0xc'),_0x5718('0xd'),_0x5718('0xe'),_0x5718('0xf')];exports[_0x5718('0x10')]=function(_0x149e42,_0x1e4e01,_0x2e1e12,_0x335594,_0x1f552c,_0x5a3618){if(_0x2e1e12){if(_[_0x5718('0x11')](integrations,_0x149e42[_0x5718('0x12')][_0x5718('0x13')]())){try{var _0x30a930=null;var _0x1f6aa3='';var _0x27d6a5=_0x2e1e12[_0x149e42[_0x5718('0x12')][_0x5718('0x13')]()];if(_0x27d6a5){var _0x29d10a=_0x27d6a5[_0x149e42[_0x5718('0x14')]];if(_0x29d10a){var _0x9027af=_[_0x5718('0x15')](_0x29d10a[_0x5718('0x16')],{'id':parseInt(_0x149e42[_0x5718('0x17')],0xa)});if(_0x9027af){if(_0x335594){if(_0x1f552c&&_0x1e4e01['queue']){_0x1f6aa3=_0x5718('0x18');}else if(_0x1e4e01[_0x5718('0x19')]){_0x1f6aa3='outbound';}else{console[_0x5718('0x1a')](_0x5718('0x1b'),_0x1e4e01);}}else{_0x1f6aa3=_0x5718('0x1c');}switch(_0x149e42[_0x5718('0x12')][_0x5718('0x13')]()){case _0x5718('0x8'):zendesk[_0x1f6aa3](_0x149e42,_0x1e4e01,_0x9027af,_0x335594,_0x1f552c,_0x29d10a,_0x5a3618);break;case _0x5718('0x9'):salesforce[_0x1f6aa3](_0x149e42,_0x1e4e01,_0x9027af,_0x335594,_0x1f552c,_0x29d10a,_0x5a3618);break;case _0x5718('0x1d'):sugarcrm[_0x1f6aa3](_0x149e42,_0x1e4e01,_0x9027af,_0x335594,_0x1f552c,_0x29d10a,_0x5a3618);break;case _0x5718('0xa'):freshdesk[_0x1f6aa3](_0x149e42,_0x1e4e01,_0x9027af,_0x335594,_0x1f552c,_0x29d10a,_0x5a3618);break;case _0x5718('0xb'):zoho[_0x1f6aa3](_0x149e42,_0x1e4e01,_0x9027af,_0x335594,_0x1f552c,_0x29d10a,_0x5a3618);break;case _0x5718('0x1e'):desk[_0x1f6aa3](_0x149e42,_0x1e4e01,_0x9027af,_0x335594,_0x1f552c,_0x29d10a,_0x5a3618);break;case'vtiger':vtiger[_0x1f6aa3](_0x149e42,_0x1e4e01,_0x9027af,_0x335594,_0x1f552c,_0x29d10a,_0x5a3618);break;case'freshsales':freshsales['cs'](_0x149e42,_0x1e4e01,_0x9027af,_0x335594,_0x1f552c,_0x29d10a,_0x5a3618,_0x1f6aa3);break;case _0x5718('0xf'):servicenow['cs'](_0x149e42,_0x1e4e01,_0x9027af,_0x335594,_0x1f552c,_0x29d10a,_0x5a3618,_0x1f6aa3);break;case _0x5718('0xd'):dynamics365['cs'](_0x149e42,_0x1e4e01,_0x9027af,_0x335594,_0x1f552c,_0x29d10a,_0x5a3618,_0x1f6aa3);break;default:console[_0x5718('0x1a')](_0x5718('0x1f'));}}else{_0x30a930=require(_0x5718('0x20'))(_0x149e42[_0x5718('0x12')]['toLowerCase']());_0x30a930['error'](_0x5718('0x21'),util['format'](_0x5718('0x22'),_0x149e42[_0x5718('0x12')][_0x5718('0x13')](),_0x149e42[_0x5718('0x17')]));}}else{_0x30a930=require('../../../../config/logger')(_0x149e42[_0x5718('0x12')][_0x5718('0x13')]());_0x30a930[_0x5718('0x23')](_0x5718('0x21'),util[_0x5718('0x24')](_0x5718('0x25'),_0x149e42[_0x5718('0x12')][_0x5718('0x13')](),_0x149e42[_0x5718('0x14')]));}}else{}}catch(_0x57969d){console['error'](_0x57969d);}}}}; \ 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 5aa9065..2ff3bfb 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 _0x322b=['Lead','account_contact_lead','additionalSearchAccount','Account','first','Phone','attributes','toLowerCase','Enduser\x20(%s)\x20with\x20phone\x20%s\x20found','Enduser\x20with\x20phone\x20%s\x20not\x20found','moduleCreate','LastName','','format','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','No\x20Company','upperFirst','forEach','picklist','type','idField','content','toString','variableName','customVariable','Variable','name','password','concat','securityToken','Connection','remoteUri','https://login.salesforce.com','clientId','clientSecret','login','username','Connection\x20established.','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','email','calleridnum','[QUEUE]\x20Ticket\x20%s\x20created','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','integrationTab','user:%s','newTab','%s/%s/e','error','catch','outbound','recordingFormat','[OUTBOUND]','destcalleridnum','Fields','[OUTBOUND]\x20Ticket\x20%s\x20created.','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','trigger:salesforce:display','trigger:browser:url','instanceUrl','lastevent','toUpperCase','isNil','calleridname',']\x20Ticket\x20%s\x20created.',']\x20Integration\x20account\x20type\x20%s.','lodash','request-promise','moment','bluebird','jsforce','util','ioredis','./util','../../../../config/environment','../../../../config/logger','salesforce','redis','defaults','localhost','socket.io-emitter','emit','assign','Subjects','getString','utc','IsReminderSet','IsRecurrence','contact','WhoId','account','WhatId','ticketType','Case','endUserType','ContactId','AccountId','lead','leadId','info','Association\x20between\x20Case\x20and\x20Lead\x20skipped','sobject','create','validateEmail','User','find','execute','then','length','Email','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'];(function(_0x130601,_0x38dec1){var _0x4f08e8=function(_0x11ae5a){while(--_0x11ae5a){_0x130601['push'](_0x130601['shift']());}};_0x4f08e8(++_0x38dec1);}(_0x322b,0x1d4));var _0xb322=function(_0x3600aa,_0x30af7a){_0x3600aa=_0x3600aa-0x0;var _0x52e3b8=_0x322b[_0x3600aa];return _0x52e3b8;};'use strict';var _=require(_0xb322('0x0'));var rp=require(_0xb322('0x1'));var moment=require(_0xb322('0x2'));var BPromise=require(_0xb322('0x3'));var md5=require('md5');var jsforce=require(_0xb322('0x4'));var util=require(_0xb322('0x5'));var Redis=require(_0xb322('0x6'));var intUtil=require(_0xb322('0x7'));var config=require(_0xb322('0x8'));var logger=require(_0xb322('0x9'))(_0xb322('0xa'));config[_0xb322('0xb')]=_[_0xb322('0xc')](config[_0xb322('0xb')],{'host':_0xb322('0xd'),'port':0x18eb});var io=require(_0xb322('0xe'))(new Redis(config['redis']));function emit(_0x1e6882,_0x569b08,_0x370eca){io['to'](_0x1e6882)[_0xb322('0xf')](_0x569b08,_0x370eca);}function getTicket(_0xb6af85,_0x45a921,_0x4f181a,_0x64c3c6,_0x3cf520,_0x865514,_0x43a77e,_0x13c0dd){var _0x41354b=Object[_0xb322('0x10')]({},{'OwnerId':_0x45a921['id'],'Subject':intUtil['getString'](_0x64c3c6[_0xb322('0x11')],_0x3cf520,'\x20'),'Description':intUtil[_0xb322('0x12')](_0x64c3c6['Descriptions'],_0x3cf520,'\x0a')},getCustomFields(_0x865514,_0x3cf520));if(_0x4f181a){if(_0x64c3c6['ticketType']==='Task'){_0x41354b['ActivityDate']=moment[_0xb322('0x13')]();_0x41354b[_0xb322('0x14')]=![];_0x41354b[_0xb322('0x15')]=![];if(_0x4f181a['endUserType']===_0xb322('0x16')||_0x4f181a['endUserType']==='lead'){_0x41354b[_0xb322('0x17')]=_0x4f181a['id'];}else if(_0x4f181a['endUserType']===_0xb322('0x18')){_0x41354b[_0xb322('0x19')]=_0x4f181a['id'];}}else if(_0x64c3c6[_0xb322('0x1a')]===_0xb322('0x1b')){if(_0x4f181a[_0xb322('0x1c')]===_0xb322('0x16')){_0x41354b[_0xb322('0x1d')]=_0x4f181a['id'];}else if(_0x4f181a[_0xb322('0x1c')]==='account'){_0x41354b[_0xb322('0x1e')]=_0x4f181a['id'];}else if(_0x4f181a['endUserType']===_0xb322('0x1f')&&_0x64c3c6[_0xb322('0x20')]){_0x41354b[_0x64c3c6[_0xb322('0x20')]]=_0x4f181a['id'];}else{logger[_0xb322('0x21')](_0xb322('0x22'));}}}return _0x43a77e[_0xb322('0x23')](_0x64c3c6[_0xb322('0x1a')])[_0xb322('0x24')](_0x41354b);}function getUser(_0x313e06,_0x26bf31,_0x31d073){if(!_['isNil'](_0x26bf31)&&intUtil[_0xb322('0x25')](_0x26bf31)){var _0x264a5d={'Email':_0x26bf31};var _0x1deea1={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x31d073[_0xb322('0x23')](_0xb322('0x26'))[_0xb322('0x27')](_0x264a5d,_0x1deea1)[_0xb322('0x28')]()[_0xb322('0x29')](function(_0x50e587){if(_0x50e587[_0xb322('0x2a')]){var _0x98e16d=_[_0xb322('0x27')](_0x50e587,function(_0x3418f5){return _0x3418f5[_0xb322('0x2b')]===_0x26bf31;});if(_0x98e16d){logger[_0xb322('0x21')](_0xb322('0x2c'),_0x26bf31);return BPromise[_0xb322('0x2d')]({'id':_0x98e16d['Id'],'name':_0x98e16d[_0xb322('0x2e')]});}}else{logger['info'](_0xb322('0x2f'),_0x26bf31);return _0x31d073[_0xb322('0x30')]()[_0xb322('0x29')](function(_0x5614b7){return BPromise[_0xb322('0x2d')]({'id':_0x5614b7[_0xb322('0x31')],'name':_0x5614b7[_0xb322('0x32')]});});}});}else{logger[_0xb322('0x21')](_0xb322('0x2f'),_0x26bf31);return _0x31d073[_0xb322('0x30')]()[_0xb322('0x29')](function(_0x325d73){return BPromise[_0xb322('0x2d')]({'id':_0x325d73[_0xb322('0x31')],'name':_0x325d73['display_name']});});}}function getEndUser(_0x64b19d,_0x580d01,_0x34bb53,_0x570579,_0x475aeb){var _0x235a3e={'$or':{'Phone':_0x570579}};var _0xc89b81={'Id':!![],'Name':!![],'Phone':!![]};return BPromise['resolve']()[_0xb322('0x29')](function(){logger['info'](_0xb322('0x33'),_0x570579,_0x580d01[_0xb322('0x34')]);switch(_0x580d01['moduleSearch']){case _0xb322('0x35'):var _0x39ef49=_[_0xb322('0x36')](_0x235a3e);if(_0x580d01[_0xb322('0x37')]){var _0x4607d1={};_0x4607d1[_0x580d01[_0xb322('0x37')]]=_0x570579;_[_0xb322('0x38')](_0x39ef49[_0xb322('0x39')],_0x4607d1);}return _0x475aeb[_0xb322('0x23')](_0xb322('0x3a'))['find'](_0x39ef49,_0xc89b81)[_0xb322('0x28')]()[_0xb322('0x29')](function(_0x10aa65){if(_0x10aa65&&_0x10aa65['length']){return _0x10aa65;}else{var _0x231663=_['cloneDeep'](_0x235a3e);if(_0x580d01[_0xb322('0x3b')]){var _0xe34392={};_0xe34392[_0x580d01[_0xb322('0x3b')]]=_0x570579;_[_0xb322('0x38')](_0x231663['$or'],_0xe34392);}return _0x475aeb[_0xb322('0x23')](_0xb322('0x3c'))[_0xb322('0x27')](_0x231663,_0xc89b81);}});case _0xb322('0x3d'):var _0x29fc28=_[_0xb322('0x36')](_0x235a3e);if(_0x580d01[_0xb322('0x3e')]){var _0x4607d1={};_0x4607d1[_0x580d01[_0xb322('0x3e')]]=_0x570579;_[_0xb322('0x38')](_0x29fc28['$or'],_0x4607d1);}return _0x475aeb[_0xb322('0x23')]('Account')[_0xb322('0x27')](_0x29fc28,_0xc89b81)[_0xb322('0x28')]()[_0xb322('0x29')](function(_0x5d58b7){if(_0x5d58b7&&_0x5d58b7[_0xb322('0x2a')]){return _0x5d58b7;}else{var _0x226555=_[_0xb322('0x36')](_0x235a3e);if(_0x580d01[_0xb322('0x37')]){var _0x3b9757={};_0x3b9757[_0x580d01[_0xb322('0x37')]]=_0x570579;_[_0xb322('0x38')](_0x226555[_0xb322('0x39')],_0x3b9757);}return _0x475aeb[_0xb322('0x23')](_0xb322('0x3a'))[_0xb322('0x27')](_0x226555,_0xc89b81)['then'](function(_0x14532d){if(_0x14532d&&_0x14532d['length']){return _0x14532d;}else{var _0xa8c751=_[_0xb322('0x36')](_0x235a3e);if(_0x580d01[_0xb322('0x3b')]){var _0x48253f={};_0x48253f[_0x580d01[_0xb322('0x3b')]]=_0x570579;_['merge'](_0xa8c751[_0xb322('0x39')],_0x48253f);}return _0x475aeb['sobject'](_0xb322('0x3c'))[_0xb322('0x27')](_0xa8c751,_0xc89b81);}});}});case _0xb322('0x16'):var _0x39ef49=_[_0xb322('0x36')](_0x235a3e);if(_0x580d01[_0xb322('0x37')]){var _0x4607d1={};_0x4607d1[_0x580d01[_0xb322('0x37')]]=_0x570579;_[_0xb322('0x38')](_0x39ef49['$or'],_0x4607d1);}return _0x475aeb[_0xb322('0x23')](_0xb322('0x3a'))['find'](_0x39ef49,_0xc89b81)[_0xb322('0x28')]();case _0xb322('0x1f'):var _0x176f5d=_[_0xb322('0x36')](_0x235a3e);if(_0x580d01['additionalSearchLead']){var _0x4607d1={};_0x4607d1[_0x580d01[_0xb322('0x3b')]]=_0x570579;_[_0xb322('0x38')](_0x176f5d[_0xb322('0x39')],_0x4607d1);}return _0x475aeb[_0xb322('0x23')](_0xb322('0x3c'))[_0xb322('0x27')](_0x176f5d,_0xc89b81);case _0xb322('0x18'):var _0x29fc28=_[_0xb322('0x36')](_0x235a3e);if(_0x580d01[_0xb322('0x3e')]){var _0x4607d1={};_0x4607d1[_0x580d01[_0xb322('0x3e')]]=_0x570579;_[_0xb322('0x38')](_0x29fc28[_0xb322('0x39')],_0x4607d1);}return _0x475aeb['sobject'](_0xb322('0x3f'))[_0xb322('0x27')](_0x29fc28,_0xc89b81);default:return null;}})[_0xb322('0x29')](function(_0x150342){if(_0x150342&&_0x150342['length']){var _0x4afb63=_[_0xb322('0x40')](_0x150342);if(_0x4afb63){return BPromise[_0xb322('0x2d')]({'id':_0x4afb63['Id'],'name':_0x4afb63[_0xb322('0x2e')],'phone':_0x4afb63[_0xb322('0x41')],'endUserType':_0x4afb63[_0xb322('0x42')]['type'][_0xb322('0x43')]()});}}})[_0xb322('0x29')](function(_0x16ef07){if(_0x16ef07){logger[_0xb322('0x21')](_0xb322('0x44'),_0x16ef07['endUserType'],_0x570579);return BPromise[_0xb322('0x2d')](_0x16ef07);}else{logger[_0xb322('0x21')](_0xb322('0x45'),_0x570579);var _0x254af1={'Phone':_0x570579};if(_0x580d01[_0xb322('0x46')]){if(_0x580d01['moduleCreate']===_0xb322('0x16')){logger[_0xb322('0x21')]('Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.',_0x570579,_0x580d01['moduleCreate']);_0x254af1[_0xb322('0x47')]=_0x34bb53!==_0xb322('0x48')?_0x34bb53:util[_0xb322('0x49')]('Caller\x20-\x20%s',_0x570579);}else if(_0x580d01[_0xb322('0x46')]===_0xb322('0x1f')){logger[_0xb322('0x21')](_0xb322('0x4a'),_0x570579,_0x580d01['moduleCreate']);_0x254af1[_0xb322('0x47')]=_0x34bb53!==_0xb322('0x48')?_0x34bb53:util[_0xb322('0x49')]('Caller\x20-\x20%s',_0x570579);_0x254af1['Company']=_0xb322('0x4b');}else if(_0x580d01['moduleCreate']==='account'){logger['info']('Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.',_0x570579,_0x580d01['moduleCreate']);_0x254af1[_0xb322('0x2e')]=_0x34bb53!==_0xb322('0x48')?_0x34bb53:util[_0xb322('0x49')]('Caller\x20-\x20%s',_0x570579);}else{return null;}}return _0x475aeb[_0xb322('0x23')](_[_0xb322('0x4c')](_0x580d01['moduleCreate']))[_0xb322('0x24')](_0x254af1)[_0xb322('0x29')](function(_0x19a2a0){return BPromise['resolve']({'id':_0x19a2a0['id'],'endUserType':_0x580d01[_0xb322('0x46')]});});}});}function getCustomFields(_0x708908,_0xb3bc20){var _0x477af6={};if(_0x708908[_0xb322('0x2a')]>0x0){_[_0xb322('0x4d')](_0x708908,function(_0x33aacf){if(_['includes'](['string',_0xb322('0x4e')],_0x33aacf[_0xb322('0x4f')])&&_0x33aacf[_0xb322('0x50')]){_0x477af6[_0x33aacf[_0xb322('0x50')]]=_0x33aacf[_0xb322('0x51')][_0xb322('0x52')]();}else if(_0x33aacf[_0xb322('0x4f')]==='variable'&&_0x33aacf[_0xb322('0x53')]&&_0x33aacf['idField']){_0xb3bc20[_0x33aacf[_0xb322('0x53')]]&&(_0x477af6[_0x33aacf[_0xb322('0x50')]]=_0xb3bc20[_0x33aacf['variableName']][_0xb322('0x52')]());}else if(_0x33aacf[_0xb322('0x4f')]===_0xb322('0x54')&&_0x33aacf['Variable']&&_0x33aacf[_0xb322('0x55')][_0xb322('0x56')]&&_0x33aacf[_0xb322('0x50')]){_0xb3bc20[_0x33aacf[_0xb322('0x55')]['name'][_0xb322('0x43')]()]&&(_0x477af6[_0x33aacf[_0xb322('0x50')]]=_0xb3bc20[_0x33aacf[_0xb322('0x55')][_0xb322('0x56')][_0xb322('0x43')]()][_0xb322('0x52')]());}});}return _0x477af6;}function getConnection(_0x3c5405){var _0x3f68ac=_0x3c5405[_0xb322('0x57')][_0xb322('0x58')](_0x3c5405[_0xb322('0x59')]);var _0x12e409=new jsforce[(_0xb322('0x5a'))]({'oauth2':{'loginUrl':_0x3c5405[_0xb322('0x5b')]||_0xb322('0x5c'),'clientId':_0x3c5405[_0xb322('0x5d')],'clientSecret':_0x3c5405[_0xb322('0x5e')]}});return _0x12e409[_0xb322('0x5f')](_0x3c5405[_0xb322('0x60')],_0x3f68ac)['then'](function(){logger['info'](_0xb322('0x61'));return _0x12e409;});}exports[_0xb322('0x62')]=function(_0x1312b4,_0x12650d,_0x14eb3a,_0x44edbe,_0x212fc3,_0x2daf97){var _0x1107c7,_0x129a0f,_0x5e6bd0,_0x54125e;_0x2daf97['serverUrl']=intUtil[_0xb322('0x63')](_0x2daf97[_0xb322('0x64')]);_0x2daf97[_0xb322('0x5b')]=intUtil[_0xb322('0x63')](_0x2daf97[_0xb322('0x5b')]);if(_0x212fc3&&_0x212fc3[_0xb322('0x65')]){logger[_0xb322('0x21')](_0xb322('0x66'),'Recording\x20is\x20enabled!');_0x12650d[_0xb322('0x67')]=util[_0xb322('0x49')](_0xb322('0x68'),_0x2daf97[_0xb322('0x64')],_0x12650d['uniqueid'],md5(_0x12650d[_0xb322('0x69')]));}else{_0x12650d[_0xb322('0x67')]='';}return getConnection(_0x2daf97)[_0xb322('0x29')](function(_0x2d9812){_0x54125e=_0x2d9812;return getUser(_0x2daf97,_0x44edbe[_0xb322('0x6a')],_0x54125e);})[_0xb322('0x29')](function(_0xa06e03){_0x1107c7=_0xa06e03;return getEndUser(_0x2daf97,_0x14eb3a,_0x12650d['calleridname'],_0x12650d[_0xb322('0x6b')],_0x54125e);})[_0xb322('0x29')](function(_0x4299e1){_0x129a0f=_0x4299e1;return getTicket(_0x2daf97,_0x1107c7,_0x129a0f,_0x14eb3a,_0x12650d,_0x14eb3a['Fields'],_0x54125e,_0xb322('0x62'));})[_0xb322('0x29')](function(_0x572028){_0x5e6bd0=_0x572028;logger[_0xb322('0x21')](_0xb322('0x6c'),_0x5e6bd0['id']);logger['info'](_0xb322('0x6d'),_0x5e6bd0['id'],_0x44edbe['name'],_0x2daf97[_0xb322('0x4f')]);switch(_0x2daf97[_0xb322('0x4f')]){case _0xb322('0x6e'):emit(util[_0xb322('0x49')](_0xb322('0x6f'),_0x44edbe[_0xb322('0x56')]),'trigger:salesforce:display',{'recordId':_0x5e6bd0['id']});break;case _0xb322('0x70'):emit(util[_0xb322('0x49')](_0xb322('0x6f'),_0x44edbe[_0xb322('0x56')]),'trigger:browser:url',{'uri':util[_0xb322('0x49')](_0xb322('0x71'),_0x54125e['instanceUrl'],_0x5e6bd0['id'])});break;default:logger[_0xb322('0x72')]('[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.');}})[_0xb322('0x73')](function(_0x5755b1){logger[_0xb322('0x72')]('[QUEUE]',_0x5755b1);});};exports[_0xb322('0x74')]=function(_0x54525b,_0x58be27,_0x3ab3ed,_0x2a1ec1,_0x92633c,_0x2c3360,_0x3c4aa7){var _0x5192bd,_0x2ae708,_0x335282,_0x2f45c0;_0x2c3360['serverUrl']=intUtil[_0xb322('0x63')](_0x2c3360[_0xb322('0x64')]);_0x2c3360[_0xb322('0x5b')]=intUtil[_0xb322('0x63')](_0x2c3360[_0xb322('0x5b')]);if(_0x3c4aa7&&_0x3c4aa7[_0xb322('0x75')]&&_0x3c4aa7['recordingFormat']!=='none'){logger[_0xb322('0x21')](_0xb322('0x76'),'Recording\x20is\x20enabled!');_0x58be27['recordingURL']=util['format'](_0xb322('0x68'),_0x2c3360[_0xb322('0x64')],_0x58be27['uniqueid'],md5(_0x58be27[_0xb322('0x69')]));}return getConnection(_0x2c3360)['then'](function(_0x34903f){_0x2f45c0=_0x34903f;return getUser(_0x2c3360,_0x2a1ec1[_0xb322('0x6a')],_0x2f45c0);})['then'](function(_0x54c04e){_0x5192bd=_0x54c04e;return getEndUser(_0x2c3360,_0x3ab3ed,_0x58be27['destcalleridname'],_0x58be27[_0xb322('0x77')],_0x2f45c0);})['then'](function(_0x5a2715){_0x2ae708=_0x5a2715;return getTicket(_0x2c3360,_0x5192bd,_0x2ae708,_0x3ab3ed,_0x58be27,_0x3ab3ed[_0xb322('0x78')],_0x2f45c0,_0xb322('0x74'));})[_0xb322('0x29')](function(_0x573778){_0x335282=_0x573778;logger[_0xb322('0x21')](_0xb322('0x79'),_0x335282['id']);logger['info'](_0xb322('0x7a'),_0x335282['id'],_0x2a1ec1['name'],_0x2c3360[_0xb322('0x4f')]);switch(_0x2c3360[_0xb322('0x4f')]){case _0xb322('0x6e'):emit(util[_0xb322('0x49')](_0xb322('0x6f'),_0x2a1ec1[_0xb322('0x56')]),_0xb322('0x7b'),{'recordId':_0x335282['id']});break;case'newTab':emit(util[_0xb322('0x49')](_0xb322('0x6f'),_0x2a1ec1[_0xb322('0x56')]),_0xb322('0x7c'),{'uri':util['format'](_0xb322('0x71'),_0x2f45c0[_0xb322('0x7d')],_0x335282['id'])});break;default:logger[_0xb322('0x72')](_0xb322('0x76'),'Salesforce\x20account\x20type\x20not\x20recognized');}})[_0xb322('0x73')](function(_0x9543ff){logger[_0xb322('0x72')](_0xb322('0x76'),_0x9543ff);});};exports['unmanaged']=function(_0x294551,_0x4a5378,_0x5ab4dd,_0x60065c,_0x6fb01,_0x38e17a){var _0x5bc5ec,_0x3f1f96,_0x13a647,_0x284353;_0x38e17a['serverUrl']=intUtil[_0xb322('0x63')](_0x38e17a[_0xb322('0x64')]);_0x38e17a[_0xb322('0x5b')]=intUtil[_0xb322('0x63')](_0x38e17a[_0xb322('0x5b')]);if(_0x6fb01&&_0x6fb01[_0xb322('0x65')]){logger[_0xb322('0x21')]('['+_0x4a5378[_0xb322('0x7e')][_0xb322('0x7f')]()+']','Recording\x20is\x20enabled!');_0x4a5378[_0xb322('0x67')]=util[_0xb322('0x49')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x38e17a[_0xb322('0x64')],_0x4a5378['uniqueid'],md5(_0x4a5378[_0xb322('0x69')]));}else{_0x4a5378[_0xb322('0x67')]='';}return getConnection(_0x38e17a)[_0xb322('0x29')](function(_0x5f0cf1){_0x284353=_0x5f0cf1;if(!_[_0xb322('0x80')](_0x60065c)){return getUser(_0x38e17a,_0x60065c['name'],_0x284353);}else{return getUser(_0x38e17a,null,_0x284353);}})[_0xb322('0x29')](function(_0x2d4f57){_0x5bc5ec=_0x2d4f57;return getEndUser(_0x38e17a,_0x5ab4dd,_0x4a5378[_0xb322('0x81')],_0x4a5378['calleridnum'],_0x284353);})[_0xb322('0x29')](function(_0x1e0b1a){_0x3f1f96=_0x1e0b1a;return getTicket(_0x38e17a,_0x5bc5ec,_0x3f1f96,_0x5ab4dd,_0x4a5378,_0x5ab4dd[_0xb322('0x78')],_0x284353);})[_0xb322('0x29')](function(_0x458c60){_0x13a647=_0x458c60;logger['info']('['+_0x4a5378[_0xb322('0x7e')][_0xb322('0x7f')]()+_0xb322('0x82'),_0x13a647['id']);logger[_0xb322('0x21')]('['+_0x4a5378['lastevent'][_0xb322('0x7f')]()+_0xb322('0x83'),_0x38e17a[_0xb322('0x4f')]);})[_0xb322('0x73')](function(_0x3ffccd){logger['error']('['+_0x4a5378[_0xb322('0x7e')][_0xb322('0x7f')]()+']',_0x3ffccd);});}; \ No newline at end of file +var _0xb879=['[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','name','integrationTab','newTab','user:%s','trigger:browser:url','instanceUrl','error','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','outbound','recordingFormat','none','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','destcalleridname','Fields','[OUTBOUND]\x20Ticket\x20%s\x20created.','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','trigger:salesforce:display','[OUTBOUND]','Salesforce\x20account\x20type\x20not\x20recognized','unmanaged','lastevent','toUpperCase',']\x20Ticket\x20%s\x20created.',']\x20Integration\x20account\x20type\x20%s.','request-promise','md5','util','ioredis','./util','../../../../config/environment','../../../../config/logger','salesforce','redis','localhost','socket.io-emitter','emit','getString','Subjects','Descriptions','ticketType','Task','ActivityDate','IsRecurrence','endUserType','lead','account','WhatId','Case','contact','AccountId','info','create','isNil','validateEmail','sobject','User','find','execute','then','Email','resolve','identity','user_id','display_name','contact_lead','cloneDeep','additionalSearchContact','merge','$or','length','additionalSearchLead','Lead','account_contact_lead','additionalSearchAccount','Account','Contact','first','Name','Phone','attributes','type','toLowerCase','Enduser\x20(%s)\x20with\x20phone\x20%s\x20found','Enduser\x20with\x20phone\x20%s\x20not\x20found','moduleCreate','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','LastName','','format','Caller\x20-\x20%s','No\x20Company','upperFirst','forEach','includes','string','picklist','idField','content','variable','variableName','toString','customVariable','Variable','password','securityToken','Connection','https://login.salesforce.com','clientSecret','Connection\x20established.','queue','serverUrl','stripTrailingSlash','remoteUri','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','uniqueid','email','calleridname','calleridnum','[QUEUE]\x20Ticket\x20%s\x20created'];(function(_0x115534,_0x45f40c){var _0x1f53c2=function(_0x36f0b1){while(--_0x36f0b1){_0x115534['push'](_0x115534['shift']());}};_0x1f53c2(++_0x45f40c);}(_0xb879,0x10f));var _0x9b87=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0xb879[_0xfae23b];return _0x200640;};'use strict';var _=require('lodash');var rp=require(_0x9b87('0x0'));var moment=require('moment');var BPromise=require('bluebird');var md5=require(_0x9b87('0x1'));var jsforce=require('jsforce');var util=require(_0x9b87('0x2'));var Redis=require(_0x9b87('0x3'));var intUtil=require(_0x9b87('0x4'));var config=require(_0x9b87('0x5'));var logger=require(_0x9b87('0x6'))(_0x9b87('0x7'));config[_0x9b87('0x8')]=_['defaults'](config[_0x9b87('0x8')],{'host':_0x9b87('0x9'),'port':0x18eb});var io=require(_0x9b87('0xa'))(new Redis(config['redis']));function emit(_0x2cb2ad,_0x22c1b8,_0x3116d0){io['to'](_0x2cb2ad)[_0x9b87('0xb')](_0x22c1b8,_0x3116d0);}function getTicket(_0x44135a,_0x5de2f8,_0x8cb399,_0x92c530,_0x47e584,_0x11ffc6,_0x17396e,_0x47c844){var _0x3524e2=Object['assign']({},{'OwnerId':_0x5de2f8['id'],'Subject':intUtil[_0x9b87('0xc')](_0x92c530[_0x9b87('0xd')],_0x47e584,'\x20'),'Description':intUtil[_0x9b87('0xc')](_0x92c530[_0x9b87('0xe')],_0x47e584,'\x0a')},getCustomFields(_0x11ffc6,_0x47e584));if(_0x8cb399){if(_0x92c530[_0x9b87('0xf')]===_0x9b87('0x10')){_0x3524e2[_0x9b87('0x11')]=moment['utc']();_0x3524e2['IsReminderSet']=![];_0x3524e2[_0x9b87('0x12')]=![];if(_0x8cb399['endUserType']==='contact'||_0x8cb399[_0x9b87('0x13')]===_0x9b87('0x14')){_0x3524e2['WhoId']=_0x8cb399['id'];}else if(_0x8cb399[_0x9b87('0x13')]===_0x9b87('0x15')){_0x3524e2[_0x9b87('0x16')]=_0x8cb399['id'];}}else if(_0x92c530['ticketType']===_0x9b87('0x17')){if(_0x8cb399['endUserType']===_0x9b87('0x18')){_0x3524e2['ContactId']=_0x8cb399['id'];}else if(_0x8cb399[_0x9b87('0x13')]===_0x9b87('0x15')){_0x3524e2[_0x9b87('0x19')]=_0x8cb399['id'];}else if(_0x8cb399[_0x9b87('0x13')]===_0x9b87('0x14')&&_0x92c530['leadId']){_0x3524e2[_0x92c530['leadId']]=_0x8cb399['id'];}else{logger[_0x9b87('0x1a')]('Association\x20between\x20Case\x20and\x20Lead\x20skipped');}}}return _0x17396e['sobject'](_0x92c530[_0x9b87('0xf')])[_0x9b87('0x1b')](_0x3524e2);}function getUser(_0x9e4830,_0x1991a2,_0x203fb4){if(!_[_0x9b87('0x1c')](_0x1991a2)&&intUtil[_0x9b87('0x1d')](_0x1991a2)){var _0x388f11={'Email':_0x1991a2};var _0x2d43a2={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x203fb4[_0x9b87('0x1e')](_0x9b87('0x1f'))[_0x9b87('0x20')](_0x388f11,_0x2d43a2)[_0x9b87('0x21')]()[_0x9b87('0x22')](function(_0xb89a0e){if(_0xb89a0e['length']){var _0x2a66e5=_[_0x9b87('0x20')](_0xb89a0e,function(_0x52b3ec){return _0x52b3ec[_0x9b87('0x23')]===_0x1991a2;});if(_0x2a66e5){logger[_0x9b87('0x1a')]('Agent\x20%s\x20found.',_0x1991a2);return BPromise[_0x9b87('0x24')]({'id':_0x2a66e5['Id'],'name':_0x2a66e5['Name']});}}else{logger[_0x9b87('0x1a')]('Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.',_0x1991a2);return _0x203fb4[_0x9b87('0x25')]()[_0x9b87('0x22')](function(_0x5d1eef){return BPromise['resolve']({'id':_0x5d1eef[_0x9b87('0x26')],'name':_0x5d1eef['display_name']});});}});}else{logger[_0x9b87('0x1a')]('Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.',_0x1991a2);return _0x203fb4[_0x9b87('0x25')]()[_0x9b87('0x22')](function(_0x404058){return BPromise[_0x9b87('0x24')]({'id':_0x404058[_0x9b87('0x26')],'name':_0x404058[_0x9b87('0x27')]});});}}function getEndUser(_0x2c6f7e,_0x5bea0d,_0x4b1e34,_0x50d490,_0xb766cf){var _0x5811fb={'$or':{'Phone':_0x50d490}};var _0x1b6101={'Id':!![],'Name':!![],'Phone':!![]};return BPromise['resolve']()[_0x9b87('0x22')](function(){logger[_0x9b87('0x1a')]('Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.',_0x50d490,_0x5bea0d['moduleSearch']);switch(_0x5bea0d['moduleSearch']){case _0x9b87('0x28'):var _0x44d592=_[_0x9b87('0x29')](_0x5811fb);if(_0x5bea0d['additionalSearchContact']){var _0x550e69={};_0x550e69[_0x5bea0d[_0x9b87('0x2a')]]=_0x50d490;_[_0x9b87('0x2b')](_0x44d592[_0x9b87('0x2c')],_0x550e69);}return _0xb766cf[_0x9b87('0x1e')]('Contact')['find'](_0x44d592,_0x1b6101)[_0x9b87('0x21')]()[_0x9b87('0x22')](function(_0x299096){if(_0x299096&&_0x299096[_0x9b87('0x2d')]){return _0x299096;}else{var _0x9be764=_['cloneDeep'](_0x5811fb);if(_0x5bea0d['additionalSearchLead']){var _0x3857ab={};_0x3857ab[_0x5bea0d[_0x9b87('0x2e')]]=_0x50d490;_[_0x9b87('0x2b')](_0x9be764['$or'],_0x3857ab);}return _0xb766cf[_0x9b87('0x1e')](_0x9b87('0x2f'))[_0x9b87('0x20')](_0x9be764,_0x1b6101);}});case _0x9b87('0x30'):var _0x3259b2=_[_0x9b87('0x29')](_0x5811fb);if(_0x5bea0d[_0x9b87('0x31')]){var _0x550e69={};_0x550e69[_0x5bea0d[_0x9b87('0x31')]]=_0x50d490;_[_0x9b87('0x2b')](_0x3259b2[_0x9b87('0x2c')],_0x550e69);}return _0xb766cf[_0x9b87('0x1e')](_0x9b87('0x32'))[_0x9b87('0x20')](_0x3259b2,_0x1b6101)[_0x9b87('0x21')]()['then'](function(_0x1676e1){if(_0x1676e1&&_0x1676e1[_0x9b87('0x2d')]){return _0x1676e1;}else{var _0x3e5f94=_[_0x9b87('0x29')](_0x5811fb);if(_0x5bea0d[_0x9b87('0x2a')]){var _0x2bb5e4={};_0x2bb5e4[_0x5bea0d[_0x9b87('0x2a')]]=_0x50d490;_[_0x9b87('0x2b')](_0x3e5f94['$or'],_0x2bb5e4);}return _0xb766cf[_0x9b87('0x1e')](_0x9b87('0x33'))['find'](_0x3e5f94,_0x1b6101)[_0x9b87('0x22')](function(_0x5b66e5){if(_0x5b66e5&&_0x5b66e5[_0x9b87('0x2d')]){return _0x5b66e5;}else{var _0x160dd0=_[_0x9b87('0x29')](_0x5811fb);if(_0x5bea0d[_0x9b87('0x2e')]){var _0x4c0511={};_0x4c0511[_0x5bea0d[_0x9b87('0x2e')]]=_0x50d490;_['merge'](_0x160dd0['$or'],_0x4c0511);}return _0xb766cf[_0x9b87('0x1e')](_0x9b87('0x2f'))['find'](_0x160dd0,_0x1b6101);}});}});case _0x9b87('0x18'):var _0x44d592=_[_0x9b87('0x29')](_0x5811fb);if(_0x5bea0d['additionalSearchContact']){var _0x550e69={};_0x550e69[_0x5bea0d[_0x9b87('0x2a')]]=_0x50d490;_[_0x9b87('0x2b')](_0x44d592['$or'],_0x550e69);}return _0xb766cf[_0x9b87('0x1e')]('Contact')['find'](_0x44d592,_0x1b6101)[_0x9b87('0x21')]();case _0x9b87('0x14'):var _0x402bda=_[_0x9b87('0x29')](_0x5811fb);if(_0x5bea0d[_0x9b87('0x2e')]){var _0x550e69={};_0x550e69[_0x5bea0d[_0x9b87('0x2e')]]=_0x50d490;_[_0x9b87('0x2b')](_0x402bda['$or'],_0x550e69);}return _0xb766cf[_0x9b87('0x1e')](_0x9b87('0x2f'))[_0x9b87('0x20')](_0x402bda,_0x1b6101);case _0x9b87('0x15'):var _0x3259b2=_['cloneDeep'](_0x5811fb);if(_0x5bea0d[_0x9b87('0x31')]){var _0x550e69={};_0x550e69[_0x5bea0d[_0x9b87('0x31')]]=_0x50d490;_['merge'](_0x3259b2[_0x9b87('0x2c')],_0x550e69);}return _0xb766cf['sobject'](_0x9b87('0x32'))['find'](_0x3259b2,_0x1b6101);default:return null;}})['then'](function(_0x17b594){if(_0x17b594&&_0x17b594[_0x9b87('0x2d')]){var _0x126d45=_[_0x9b87('0x34')](_0x17b594);if(_0x126d45){return BPromise[_0x9b87('0x24')]({'id':_0x126d45['Id'],'name':_0x126d45[_0x9b87('0x35')],'phone':_0x126d45[_0x9b87('0x36')],'endUserType':_0x126d45[_0x9b87('0x37')][_0x9b87('0x38')][_0x9b87('0x39')]()});}}})[_0x9b87('0x22')](function(_0x5ad700){if(_0x5ad700){logger['info'](_0x9b87('0x3a'),_0x5ad700['endUserType'],_0x50d490);return BPromise[_0x9b87('0x24')](_0x5ad700);}else{logger[_0x9b87('0x1a')](_0x9b87('0x3b'),_0x50d490);var _0x5c799a={'Phone':_0x50d490};if(_0x5bea0d['moduleCreate']){if(_0x5bea0d[_0x9b87('0x3c')]===_0x9b87('0x18')){logger[_0x9b87('0x1a')](_0x9b87('0x3d'),_0x50d490,_0x5bea0d[_0x9b87('0x3c')]);_0x5c799a[_0x9b87('0x3e')]=_0x4b1e34!==_0x9b87('0x3f')?_0x4b1e34:util[_0x9b87('0x40')](_0x9b87('0x41'),_0x50d490);}else if(_0x5bea0d['moduleCreate']===_0x9b87('0x14')){logger[_0x9b87('0x1a')](_0x9b87('0x3d'),_0x50d490,_0x5bea0d[_0x9b87('0x3c')]);_0x5c799a[_0x9b87('0x3e')]=_0x4b1e34!==_0x9b87('0x3f')?_0x4b1e34:util['format']('Caller\x20-\x20%s',_0x50d490);_0x5c799a['Company']=_0x9b87('0x42');}else if(_0x5bea0d[_0x9b87('0x3c')]===_0x9b87('0x15')){logger[_0x9b87('0x1a')]('Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.',_0x50d490,_0x5bea0d[_0x9b87('0x3c')]);_0x5c799a[_0x9b87('0x35')]=_0x4b1e34!==_0x9b87('0x3f')?_0x4b1e34:util[_0x9b87('0x40')](_0x9b87('0x41'),_0x50d490);}else{return null;}}return _0xb766cf[_0x9b87('0x1e')](_[_0x9b87('0x43')](_0x5bea0d[_0x9b87('0x3c')]))[_0x9b87('0x1b')](_0x5c799a)['then'](function(_0x170e1f){return BPromise[_0x9b87('0x24')]({'id':_0x170e1f['id'],'endUserType':_0x5bea0d[_0x9b87('0x3c')]});});}});}function getCustomFields(_0x586fdd,_0x2ac281){var _0x343ae5={};if(_0x586fdd[_0x9b87('0x2d')]>0x0){_[_0x9b87('0x44')](_0x586fdd,function(_0x2ee83f){if(_[_0x9b87('0x45')]([_0x9b87('0x46'),_0x9b87('0x47')],_0x2ee83f[_0x9b87('0x38')])&&_0x2ee83f['idField']){_0x343ae5[_0x2ee83f[_0x9b87('0x48')]]=_0x2ee83f[_0x9b87('0x49')]['toString']();}else if(_0x2ee83f['type']===_0x9b87('0x4a')&&_0x2ee83f['variableName']&&_0x2ee83f[_0x9b87('0x48')]){_0x2ac281[_0x2ee83f[_0x9b87('0x4b')]]&&(_0x343ae5[_0x2ee83f[_0x9b87('0x48')]]=_0x2ac281[_0x2ee83f[_0x9b87('0x4b')]][_0x9b87('0x4c')]());}else if(_0x2ee83f[_0x9b87('0x38')]===_0x9b87('0x4d')&&_0x2ee83f[_0x9b87('0x4e')]&&_0x2ee83f['Variable']['name']&&_0x2ee83f[_0x9b87('0x48')]){_0x2ac281[_0x2ee83f[_0x9b87('0x4e')]['name'][_0x9b87('0x39')]()]&&(_0x343ae5[_0x2ee83f[_0x9b87('0x48')]]=_0x2ac281[_0x2ee83f[_0x9b87('0x4e')]['name'][_0x9b87('0x39')]()][_0x9b87('0x4c')]());}});}return _0x343ae5;}function getConnection(_0xb3ef7d){var _0x327981=_0xb3ef7d[_0x9b87('0x4f')]['concat'](_0xb3ef7d[_0x9b87('0x50')]);var _0x46e8ef=new jsforce[(_0x9b87('0x51'))]({'oauth2':{'loginUrl':_0xb3ef7d['remoteUri']||_0x9b87('0x52'),'clientId':_0xb3ef7d['clientId'],'clientSecret':_0xb3ef7d[_0x9b87('0x53')]}});return _0x46e8ef['login'](_0xb3ef7d['username'],_0x327981)[_0x9b87('0x22')](function(){logger[_0x9b87('0x1a')](_0x9b87('0x54'));return _0x46e8ef;});}exports[_0x9b87('0x55')]=function(_0x1b2b5c,_0x3326c5,_0x432957,_0x5195c7,_0x42f0b0,_0x4d1726){var _0x5243b3,_0x156c3e,_0x4ee825,_0x459ca5;_0x4d1726[_0x9b87('0x56')]=intUtil[_0x9b87('0x57')](_0x4d1726['serverUrl']);_0x4d1726[_0x9b87('0x58')]=intUtil[_0x9b87('0x57')](_0x4d1726[_0x9b87('0x58')]);if(_0x42f0b0&&_0x42f0b0[_0x9b87('0x59')]){logger[_0x9b87('0x1a')](_0x9b87('0x5a'),_0x9b87('0x5b'));_0x3326c5[_0x9b87('0x5c')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x4d1726[_0x9b87('0x56')],_0x3326c5[_0x9b87('0x5d')],md5(_0x3326c5[_0x9b87('0x5d')]));}else{_0x3326c5['recordingURL']='';}return getConnection(_0x4d1726)[_0x9b87('0x22')](function(_0xca9377){_0x459ca5=_0xca9377;return getUser(_0x4d1726,_0x5195c7[_0x9b87('0x5e')],_0x459ca5);})[_0x9b87('0x22')](function(_0x355f89){_0x5243b3=_0x355f89;return getEndUser(_0x4d1726,_0x432957,_0x3326c5[_0x9b87('0x5f')],_0x3326c5[_0x9b87('0x60')],_0x459ca5);})[_0x9b87('0x22')](function(_0x31eba6){_0x156c3e=_0x31eba6;return getTicket(_0x4d1726,_0x5243b3,_0x156c3e,_0x432957,_0x3326c5,_0x432957['Fields'],_0x459ca5,_0x9b87('0x55'));})['then'](function(_0x30e13d){_0x4ee825=_0x30e13d;logger['info'](_0x9b87('0x61'),_0x4ee825['id']);logger[_0x9b87('0x1a')](_0x9b87('0x62'),_0x4ee825['id'],_0x5195c7[_0x9b87('0x63')],_0x4d1726['type']);switch(_0x4d1726[_0x9b87('0x38')]){case _0x9b87('0x64'):emit(util['format']('user:%s',_0x5195c7[_0x9b87('0x63')]),'trigger:salesforce:display',{'recordId':_0x4ee825['id']});break;case _0x9b87('0x65'):emit(util['format'](_0x9b87('0x66'),_0x5195c7[_0x9b87('0x63')]),_0x9b87('0x67'),{'uri':util['format']('%s/%s/e',_0x459ca5[_0x9b87('0x68')],_0x4ee825['id'])});break;default:logger[_0x9b87('0x69')](_0x9b87('0x6a'));}})['catch'](function(_0x5104a8){logger['error']('[QUEUE]',_0x5104a8);});};exports[_0x9b87('0x6b')]=function(_0x1c3878,_0x4ba091,_0x26bae5,_0x44eae7,_0x2be918,_0x61666,_0x5ab20c){var _0x548abc,_0x59187c,_0x55dbf2,_0xaee312;_0x61666[_0x9b87('0x56')]=intUtil[_0x9b87('0x57')](_0x61666['serverUrl']);_0x61666['remoteUri']=intUtil[_0x9b87('0x57')](_0x61666[_0x9b87('0x58')]);if(_0x5ab20c&&_0x5ab20c[_0x9b87('0x6c')]&&_0x5ab20c['recordingFormat']!==_0x9b87('0x6d')){logger['info']('[OUTBOUND]',_0x9b87('0x5b'));_0x4ba091[_0x9b87('0x5c')]=util[_0x9b87('0x40')](_0x9b87('0x6e'),_0x61666[_0x9b87('0x56')],_0x4ba091[_0x9b87('0x5d')],md5(_0x4ba091[_0x9b87('0x5d')]));}return getConnection(_0x61666)[_0x9b87('0x22')](function(_0x379acc){_0xaee312=_0x379acc;return getUser(_0x61666,_0x44eae7[_0x9b87('0x5e')],_0xaee312);})[_0x9b87('0x22')](function(_0x5f3037){_0x548abc=_0x5f3037;return getEndUser(_0x61666,_0x26bae5,_0x4ba091[_0x9b87('0x6f')],_0x4ba091['destcalleridnum'],_0xaee312);})[_0x9b87('0x22')](function(_0x44a13a){_0x59187c=_0x44a13a;return getTicket(_0x61666,_0x548abc,_0x59187c,_0x26bae5,_0x4ba091,_0x26bae5[_0x9b87('0x70')],_0xaee312,_0x9b87('0x6b'));})[_0x9b87('0x22')](function(_0x2da21c){_0x55dbf2=_0x2da21c;logger[_0x9b87('0x1a')](_0x9b87('0x71'),_0x55dbf2['id']);logger[_0x9b87('0x1a')](_0x9b87('0x72'),_0x55dbf2['id'],_0x44eae7['name'],_0x61666[_0x9b87('0x38')]);switch(_0x61666[_0x9b87('0x38')]){case'integrationTab':emit(util[_0x9b87('0x40')](_0x9b87('0x66'),_0x44eae7[_0x9b87('0x63')]),_0x9b87('0x73'),{'recordId':_0x55dbf2['id']});break;case _0x9b87('0x65'):emit(util[_0x9b87('0x40')]('user:%s',_0x44eae7['name']),_0x9b87('0x67'),{'uri':util[_0x9b87('0x40')]('%s/%s/e',_0xaee312[_0x9b87('0x68')],_0x55dbf2['id'])});break;default:logger[_0x9b87('0x69')](_0x9b87('0x74'),_0x9b87('0x75'));}})['catch'](function(_0x11bf7f){logger['error']('[OUTBOUND]',_0x11bf7f);});};exports[_0x9b87('0x76')]=function(_0x50ea6a,_0xafbf5d,_0x144570,_0x3aa3d1,_0x3752aa,_0x24a856){var _0x172675,_0x4bf38b,_0x5bfa98,_0x3c24ac;_0x24a856[_0x9b87('0x56')]=intUtil['stripTrailingSlash'](_0x24a856[_0x9b87('0x56')]);_0x24a856[_0x9b87('0x58')]=intUtil[_0x9b87('0x57')](_0x24a856[_0x9b87('0x58')]);if(_0x3752aa&&_0x3752aa[_0x9b87('0x59')]){logger[_0x9b87('0x1a')]('['+_0xafbf5d[_0x9b87('0x77')][_0x9b87('0x78')]()+']',_0x9b87('0x5b'));_0xafbf5d['recordingURL']=util[_0x9b87('0x40')](_0x9b87('0x6e'),_0x24a856['serverUrl'],_0xafbf5d[_0x9b87('0x5d')],md5(_0xafbf5d[_0x9b87('0x5d')]));}else{_0xafbf5d[_0x9b87('0x5c')]='';}return getConnection(_0x24a856)[_0x9b87('0x22')](function(_0x2482da){_0x3c24ac=_0x2482da;if(!_[_0x9b87('0x1c')](_0x3aa3d1)){return getUser(_0x24a856,_0x3aa3d1[_0x9b87('0x63')],_0x3c24ac);}else{return getUser(_0x24a856,null,_0x3c24ac);}})['then'](function(_0xf8b6d4){_0x172675=_0xf8b6d4;return getEndUser(_0x24a856,_0x144570,_0xafbf5d['calleridname'],_0xafbf5d[_0x9b87('0x60')],_0x3c24ac);})[_0x9b87('0x22')](function(_0x43c8db){_0x4bf38b=_0x43c8db;return getTicket(_0x24a856,_0x172675,_0x4bf38b,_0x144570,_0xafbf5d,_0x144570[_0x9b87('0x70')],_0x3c24ac);})[_0x9b87('0x22')](function(_0xd3fcce){_0x5bfa98=_0xd3fcce;logger[_0x9b87('0x1a')]('['+_0xafbf5d[_0x9b87('0x77')][_0x9b87('0x78')]()+_0x9b87('0x79'),_0x5bfa98['id']);logger[_0x9b87('0x1a')]('['+_0xafbf5d[_0x9b87('0x77')][_0x9b87('0x78')]()+_0x9b87('0x7a'),_0x24a856[_0x9b87('0x38')]);})['catch'](function(_0x2e3969){logger[_0x9b87('0x69')]('['+_0xafbf5d[_0x9b87('0x77')]['toUpperCase']()+']',_0x2e3969);});}; \ 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 d1b7ca4..7bf7f92 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 _0x4176=['%26sysparm_record_list%3Dactive%253Dtrue','%255EORDERBYDESCnumber','/nav_to.do?uri=incident.do?sys_id%3D','format','user:%s','username','sysparm_limit=1','sysparm_display_value=true','remoteUri','stripTrailingSlash','serverUrl','%s/api/now/table/','isNil','email','outbound','calleridnum','callDirection','unmanaged','queue','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingFormat','none','[OUTBOUND]','recordingURL','The\x20ticket\x20ID\x20is:\x20%s','call\x20direction:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...','name','bluebird','request-promise','util','md5','ioredis','./util','../../../../config/environment','../../../../config/logger','redis','defaults','socket.io-emitter','GET','sys_user?sysparm_query=user_name%3Dadmin','result','length','adminId','info','toUpperCase','catch','validateEmail','userEmail','],\x20getUser\x20rp\x20obj','],\x20getUser\x20entity','userId','sys_id','adminEmail','],\x20getUser\x20crm','error','message','],\x20createEndUser\x20input\x20crm','POST','endUserNumber','user','true','endUserId','],\x20getEndUser\x20input\x20crm','sys_user?sysparm_query=phone%3D','then','includes','picklist','nameField','customField','toLowerCase','content','toString','string','idField','type','variableName','customVariable','Variable','incident','getString','Subjects','Descriptions','Fields',']\x20POST\x20incident\x20entity\x20schema','ticketId','ticketNumber','number',']\x20getTicket\x20crm','label','?sysparm_query=name%3D','label_entry','Incident','Incident\x20-\x20','forEach','push','all',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','Tags','map','%26sysparm_record_row%3D1%26sysparm_record_rows%3D39'];(function(_0x3bed8e,_0x2fcfdd){var _0x5e71a7=function(_0x19fbc8){while(--_0x19fbc8){_0x3bed8e['push'](_0x3bed8e['shift']());}};_0x5e71a7(++_0x2fcfdd);}(_0x4176,0x15b));var _0x6417=function(_0x1cbcf1,_0x3f9fd9){_0x1cbcf1=_0x1cbcf1-0x0;var _0x3a06f0=_0x4176[_0x1cbcf1];return _0x3a06f0;};'use strict';var _=require('lodash');var Promise=require(_0x6417('0x0'));var rp=require(_0x6417('0x1'));var util=require(_0x6417('0x2'));var md5=require(_0x6417('0x3'));var Redis=require(_0x6417('0x4'));var intUtil=require(_0x6417('0x5'));var config=require(_0x6417('0x6'));var logger=require(_0x6417('0x7'))('servicenow');config[_0x6417('0x8')]=_[_0x6417('0x9')](config[_0x6417('0x8')],{'host':'localhost','port':0x18eb});var io=require(_0x6417('0xa'))(new Redis(config[_0x6417('0x8')]));function getAdminUser(_0x1fa2a1,_0x144388,_0x1249b3,_0xe2b15,_0x5c728c,_0x481552){return new Promise(function(_0x398b69,_0x3aa691){var _0x16c44e={'method':_0x6417('0xb'),'uri':_0xe2b15+_0x6417('0xc')+'&'+_0x5c728c+'&'+_0x481552,'auth':_0x144388,'json':!![]};return rp(_0x16c44e)['then'](function(_0x27b2f2){if(_0x27b2f2[_0x6417('0xd')][_0x6417('0xe')]>0x0){_0x1249b3[_0x6417('0xf')]=_0x27b2f2[_0x6417('0xd')][0x0]['sys_id'];}logger[_0x6417('0x10')]('['+[_0x1fa2a1[_0x6417('0x11')]()]+'],\x20getAdminUser\x20crm',_0x1249b3);_0x398b69(_0x1249b3);})[_0x6417('0x12')](function(_0x335c6f){logger['error']('['+[_0x1fa2a1[_0x6417('0x11')]()]+']',_0x335c6f['message']);_0x3aa691(_0x335c6f['message']);});});}function getUser(_0x54724e,_0x547cd5,_0x4c8c22,_0x5a8cd1,_0xe8141b){return function(_0x35d3a9){logger[_0x6417('0x10')]('['+[_0x54724e[_0x6417('0x11')]()]+'],\x20getUser\x20input\x20crm',_0x35d3a9);return new Promise(function(_0x22c0ea,_0x3fe850){if(intUtil[_0x6417('0x13')](_0x35d3a9['userEmail'])){var _0x4e107b={'method':_0x6417('0xb'),'uri':_0x4c8c22+'sys_user?sysparm_query=email%3D'+_0x35d3a9[_0x6417('0x14')]+'&'+_0x5a8cd1+'&'+_0xe8141b,'auth':_0x547cd5,'json':!![]};logger['info']('['+[_0x54724e[_0x6417('0x11')]()]+_0x6417('0x15'),_0x4e107b);return rp(_0x4e107b)['then'](function(_0xf6ad1c){logger[_0x6417('0x10')]('['+[_0x54724e[_0x6417('0x11')]()]+_0x6417('0x16'),_0xf6ad1c);if(_0xf6ad1c[_0x6417('0xd')][_0x6417('0xe')]>0x0&&String(_0xf6ad1c[_0x6417('0xd')][0x0]['active'])==='true'){_0x35d3a9[_0x6417('0x17')]=_0xf6ad1c[_0x6417('0xd')][0x0][_0x6417('0x18')];}else{_0x35d3a9[_0x6417('0x17')]=_0x35d3a9[_0x6417('0xf')];_0x35d3a9['userEmail']=_0x35d3a9[_0x6417('0x19')];}logger[_0x6417('0x10')]('['+[_0x54724e[_0x6417('0x11')]()]+_0x6417('0x1a'),_0x35d3a9);_0x22c0ea(_0x35d3a9);})[_0x6417('0x12')](function(_0x403ee1){logger[_0x6417('0x1b')]('['+[_0x54724e[_0x6417('0x11')]()]+']',_0x403ee1[_0x6417('0x1c')]);_0x3fe850(_0x403ee1['message']);});}else{logger[_0x6417('0x10')]('['+[_0x54724e[_0x6417('0x11')]()]+']\x20using\x20admin\x20profile');_0x35d3a9[_0x6417('0x17')]=_0x35d3a9[_0x6417('0xf')];_0x35d3a9[_0x6417('0x14')]=_0x35d3a9[_0x6417('0x19')];_0x22c0ea(_0x35d3a9);}});};}function createEndUser(_0xa85241,_0x73dcb3,_0xa2ff1,_0x519838,_0xc99a48){logger[_0x6417('0x10')]('['+[_0xa85241[_0x6417('0x11')]()]+_0x6417('0x1d'),_0xa2ff1);return new Promise(function(_0x21fee1,_0x51ec0c){var _0x46b755={'method':_0x6417('0x1e'),'uri':_0x519838+'sys_user?'+_0xc99a48,'body':{'user_name':_0xa2ff1[_0x6417('0x1f')],'roles':_0x6417('0x20'),'first_name':_0xa2ff1[_0x6417('0x1f')],'active':_0x6417('0x21'),'date_format':'System','phone':_0xa2ff1[_0x6417('0x1f')]},'auth':_0x73dcb3,'json':!![]};return rp(_0x46b755)['then'](function(_0x4fdcdb){logger['info']('['+[_0xa85241['toUpperCase']()]+'],\x20EndUser\x20schema',_0x4fdcdb[_0x6417('0xd')]);_0xa2ff1[_0x6417('0x22')]=_0x4fdcdb[_0x6417('0xd')][_0x6417('0x18')];_0x21fee1(_0xa2ff1);})[_0x6417('0x12')](function(_0x3e9efa){logger['error']('['+[_0xa85241['toUpperCase']()]+']',_0x3e9efa[_0x6417('0x1c')]);_0x51ec0c(_0x3e9efa[_0x6417('0x1c')]);});});}function getEndUser(_0x3e33d9,_0x51f0d7,_0x865c97,_0xfbe66f,_0x39a26d){return function(_0x52acf2){logger[_0x6417('0x10')]('['+[_0x3e33d9[_0x6417('0x11')]()]+_0x6417('0x23'),_0x52acf2);return new Promise(function(_0x2f3b3b,_0x5afc37){var _0xd155ab={'method':_0x6417('0xb'),'uri':_0x865c97+_0x6417('0x24')+_0x52acf2[_0x6417('0x1f')]+'&'+_0xfbe66f+'&'+_0x39a26d,'auth':_0x51f0d7,'json':!![]};return rp(_0xd155ab)[_0x6417('0x25')](function(_0x3679d4){if(_0x3679d4[_0x6417('0xd')][_0x6417('0xe')]>0x0){_0x52acf2[_0x6417('0x22')]=_0x3679d4[_0x6417('0xd')][0x0][_0x6417('0x18')];logger['info']('['+[_0x3e33d9['toUpperCase']()]+'],\x20getEndUser\x20crm',_0x52acf2);_0x2f3b3b(_0x52acf2);}else{return createEndUser(_0x3e33d9,_0x51f0d7,_0x52acf2,_0x865c97,_0xfbe66f)['then'](function(_0x400d78){logger[_0x6417('0x10')]('['+[_0x3e33d9['toUpperCase']()]+'],\x20createEndUser\x20crm',_0x400d78);_0x2f3b3b(_0x400d78);});}})[_0x6417('0x12')](function(_0x32979e){logger[_0x6417('0x1b')]('['+[_0x3e33d9[_0x6417('0x11')]()]+']',_0x32979e[_0x6417('0x1c')]);_0x5afc37(_0x32979e[_0x6417('0x1c')]);});});};}function getCustomFields(_0x410eae,_0x43f75b){var _0xef313e={};if(_0x410eae[_0x6417('0xe')]>0x0){_['forEach'](_0x410eae,function(_0x3274e7){if(_[_0x6417('0x26')](['string',_0x6417('0x27')],_0x3274e7['type'])&&_0x3274e7[_0x6417('0x28')]&&!_0x3274e7[_0x6417('0x29')]){_0xef313e[_0x3274e7[_0x6417('0x28')][_0x6417('0x2a')]()]=_0x3274e7[_0x6417('0x2b')][_0x6417('0x2c')]();}else if(_[_0x6417('0x26')]([_0x6417('0x2d'),'picklist'],_0x3274e7['type'])&&_0x3274e7[_0x6417('0x2e')]&&_0x3274e7[_0x6417('0x29')]){_0xef313e[_0x3274e7['idField']['toLowerCase']()]=_0x3274e7[_0x6417('0x2b')][_0x6417('0x2c')]();}else if(_0x3274e7[_0x6417('0x2f')]==='variable'&&_0x3274e7[_0x6417('0x30')]&&_0x3274e7['idField']&&_0x3274e7[_0x6417('0x29')]){_0xef313e[_0x3274e7[_0x6417('0x2e')][_0x6417('0x2a')]()]=_0x43f75b[_0x3274e7['variableName']][_0x6417('0x2c')]();}else if(_0x3274e7[_0x6417('0x2f')]===_0x6417('0x31')&&_0x3274e7[_0x6417('0x32')]&&_0x3274e7[_0x6417('0x32')]['name']&&_0x3274e7['idField']&&_0x3274e7['customField']){_0xef313e[_0x3274e7['idField'][_0x6417('0x2a')]()]=_0x43f75b[_0x3274e7['Variable']['name'][_0x6417('0x2a')]()][_0x6417('0x2c')]();}});}return _0xef313e;}function getTicket(_0x19a9e8,_0x24dcd4,_0x5e140e,_0x54aa66,_0x3aaf50,_0x49c995){return function(_0x5443f8){logger[_0x6417('0x10')]('['+[_0x19a9e8[_0x6417('0x11')]()]+']\x20getTicket\x20input\x20crm',_0x5443f8);return new Promise(function(_0x189555,_0x511abb){var _0x3defeb=_0x19a9e8[_0x6417('0x2a')]()==='outbound'?_0x5443f8[_0x6417('0x17')]:_0x5443f8[_0x6417('0x22')];var _0x350443={'method':_0x6417('0x1e'),'uri':_0x5e140e+_0x6417('0x33')+'?'+_0x49c995,'body':Object['assign']({},{'active':_0x6417('0x21'),'caller_id':_0x3defeb,'assigned_to':_0x5443f8[_0x6417('0x17')],'short_description':intUtil[_0x6417('0x34')](_0x54aa66[_0x6417('0x35')],_0x3aaf50,'\x20'),'description':intUtil[_0x6417('0x34')](_0x54aa66[_0x6417('0x36')],_0x3aaf50,'\x0a')},getCustomFields(_0x54aa66[_0x6417('0x37')],_0x3aaf50)),'auth':_0x24dcd4,'json':!![]};return rp(_0x350443)[_0x6417('0x25')](function(_0x14f0b5){logger[_0x6417('0x10')]('['+[_0x19a9e8['toUpperCase']()]+_0x6417('0x38'),_0x14f0b5[_0x6417('0xd')]);_0x5443f8[_0x6417('0x39')]=_0x14f0b5['result'][_0x6417('0x18')];_0x5443f8[_0x6417('0x3a')]=_0x14f0b5[_0x6417('0xd')][_0x6417('0x3b')];logger[_0x6417('0x10')]('['+[_0x19a9e8[_0x6417('0x11')]()]+_0x6417('0x3c'),_0x5443f8);_0x189555(_0x5443f8);})['catch'](function(_0x1e5f2a){logger[_0x6417('0x1b')]('['+[_0x19a9e8['toUpperCase']()]+']',_0x1e5f2a[_0x6417('0x1c')]);_0x511abb(_0x1e5f2a[_0x6417('0x1c')]);});});};}function createRemoteTag(_0x4d227a,_0x28b52a,_0x2e36c0,_0xa0caef){return new Promise(function(_0x148598,_0x487bb3){var _0x5a1406={'method':_0x6417('0x1e'),'uri':_0x2e36c0+_0x6417('0x3d')+'?'+_0xa0caef,'body':{'short_description':_0x4d227a,'global':!![],'active':!![],'name':_0x4d227a},'auth':_0x28b52a,'json':!![]};return rp(_0x5a1406)[_0x6417('0x25')](function(_0x42412e){var _0x3c4739=_0x42412e[_0x6417('0xd')]['sys_id'];_0x148598(_0x3c4739);});});}function getRemoteTag(_0x1b61bd,_0x5f4eb5,_0x4cc2f2,_0x567402,_0xe61fb){return new Promise(function(_0x4141d0,_0x23794f){var _0x4c63b5={'method':_0x6417('0xb'),'uri':_0x4cc2f2+_0x6417('0x3d')+_0x6417('0x3e')+_0x1b61bd+'&'+_0x567402,'auth':_0x5f4eb5,'json':!![]};return rp(_0x4c63b5)[_0x6417('0x25')](function(_0x58d675){if(_0x58d675[_0x6417('0xd')][_0x6417('0xe')]>0x0){var _0x5c6cdb=_0x58d675[_0x6417('0xd')][0x0][_0x6417('0x18')];_0x4141d0(_0x5c6cdb);}else{return createRemoteTag(_0x1b61bd,_0x5f4eb5,_0x4cc2f2,_0x567402)[_0x6417('0x25')](function(_0x42a669){_0x4141d0(_0x42a669);});}});});}function assignTagToIncident(_0x34eb36,_0x359fe4,_0x320383,_0x23d703,_0x1f5cda){return new Promise(function(_0x207fb5,_0x4e434a){var _0x21f73d={'method':_0x6417('0x1e'),'uri':_0x320383+_0x6417('0x3f')+'?'+_0x1f5cda,'body':{'label':_0x34eb36,'table':_0x6417('0x33'),'id_type':_0x6417('0x40'),'table_key':_0x23d703[_0x6417('0x39')],'title':_0x6417('0x41')+_0x23d703['ticketNumber'],'id_display':_0x23d703[_0x6417('0x3a')]},'auth':_0x359fe4,'json':!![]};return rp(_0x21f73d)['then'](function(_0x142959){_0x207fb5();})[_0x6417('0x12')](function(){_0x207fb5();});});}function manageTags(_0x5dafd5,_0x315094,_0xe22274,_0x341c57,_0x38b1cf,_0x3774c2,_0x586a94){return new Promise(function(_0x50884a,_0x2d9532){var _0x463415=[];_0x315094[_0x6417('0x42')](function(_0x17825e){_0x463415[_0x6417('0x43')](getRemoteTag(_0x17825e,_0xe22274,_0x341c57,_0x3774c2,_0x586a94));});return Promise[_0x6417('0x44')](_0x463415)[_0x6417('0x25')](function(_0x42fa53){if(_0x42fa53['length']){logger[_0x6417('0x10')]('['+[_0x5dafd5['toUpperCase']()]+_0x6417('0x45'),_0x42fa53);var _0xd029e8=[];_0x42fa53['forEach'](function(_0x2d5577){_0xd029e8[_0x6417('0x43')](assignTagToIncident(_0x2d5577,_0xe22274,_0x341c57,_0x38b1cf,_0x3774c2));});return Promise['all'](_0xd029e8)[_0x6417('0x25')](function(){_0x50884a();})[_0x6417('0x12')](function(){_0x50884a();});}else{_0x50884a();}});});}function getTags(_0x2d4639,_0x16fe71,_0x3b7005,_0x2c1306,_0x36ef8a,_0x4a6929){return function(_0x1b9bc3){return new Promise(function(_0x26c38d,_0x4970ef){var _0x509f3a=[];var _0x419632=_0x2c1306[_0x6417('0x46')];if(_0x419632&&_0x419632[_0x6417('0xe')]>0x0){_0x509f3a=_[_0x6417('0x47')](_0x419632,'name');}if(_0x509f3a[_0x6417('0xe')]>0x0){return manageTags(_0x2d4639,_0x509f3a,_0x16fe71,_0x3b7005,_0x1b9bc3,_0x36ef8a,_0x4a6929)['then'](function(){_0x26c38d(_0x1b9bc3);});}else{_0x26c38d(_0x1b9bc3);}});};}function emit(_0xc3d633,_0x3d9b3c,_0x5397b3){var _0x2ab23f='%26sysparm_record_target%3Dincident'+_0x6417('0x48')+_0x6417('0x49')+_0x6417('0x4a');var _0xd817cd={'uri':_0xc3d633+_0x6417('0x4b')+_0x5397b3+_0x2ab23f};io['to'](util[_0x6417('0x4c')](_0x6417('0x4d'),_0x3d9b3c))['emit']('trigger:browser:url',_0xd817cd);}exports['cs']=function(_0xb3d512,_0xaaf376,_0x2ad03e,_0x24a5c3,_0x38ff54,_0x9eca2,_0x1ef2a2,_0x43bed7){var _0x158a2b={};var _0x1a3177={'user':_0x9eca2[_0x6417('0x4e')],'pass':_0x9eca2['password']};var _0x29c456=_0x6417('0x4f');var _0x3ac35c=_0x6417('0x50');_0x9eca2[_0x6417('0x51')]=intUtil[_0x6417('0x52')](_0x9eca2['remoteUri']);_0x9eca2[_0x6417('0x53')]=intUtil[_0x6417('0x52')](_0x9eca2['serverUrl']);var _0x521a04=util[_0x6417('0x4c')](_0x6417('0x54'),_0x9eca2[_0x6417('0x51')]);_0x158a2b[_0x6417('0x14')]=!_[_0x6417('0x55')](_0x24a5c3)?_0x24a5c3[_0x6417('0x56')]:null;_0x158a2b[_0x6417('0x19')]=_0x9eca2[_0x6417('0x56')];_0x158a2b['endUserNumber']=_0x43bed7['toLowerCase']()===_0x6417('0x57')?_0xaaf376['destcalleridnum']:_0xaaf376[_0x6417('0x58')];_0x158a2b[_0x6417('0x59')]=_0x43bed7==='queue'||_0x43bed7===_0x6417('0x5a')?_0x6417('0x5b'):'outbound';var _0x5e6bd7=util['format'](_0x6417('0x5c'),_0x9eca2[_0x6417('0x53')],_0xaaf376[_0x6417('0x5d')],md5(_0xaaf376[_0x6417('0x5d')]));if(_0x38ff54&&_0x38ff54[_0x6417('0x5e')]){logger[_0x6417('0x10')](_0x6417('0x5f'),_0x6417('0x60'));_0xaaf376['recordingURL']=_0x5e6bd7;}else if(_0x1ef2a2&&_0x1ef2a2[_0x6417('0x61')]&&_0x1ef2a2[_0x6417('0x61')]!==_0x6417('0x62')){logger[_0x6417('0x10')](_0x6417('0x63'),'Recording\x20is\x20enabled!');_0xaaf376[_0x6417('0x64')]=_0x5e6bd7;}else{_0xaaf376[_0x6417('0x64')]='';}return getAdminUser(_0x43bed7,_0x1a3177,_0x158a2b,_0x521a04,_0x3ac35c,_0x29c456)[_0x6417('0x25')](getUser(_0x43bed7,_0x1a3177,_0x521a04,_0x3ac35c,_0x29c456))[_0x6417('0x25')](getEndUser(_0x43bed7,_0x1a3177,_0x521a04,_0x3ac35c,_0x29c456))['then'](getTicket(_0x43bed7,_0x1a3177,_0x521a04,_0x2ad03e,_0xaaf376,_0x3ac35c))['then'](function(_0x5a59ce){logger['info'](util[_0x6417('0x4c')](_0x6417('0x65'),_0x5a59ce[_0x6417('0x39')]));logger[_0x6417('0x10')](util[_0x6417('0x4c')](_0x6417('0x66'),_0x43bed7));if(_0x43bed7!=='unmanaged'){logger['info']('['+[_0x43bed7[_0x6417('0x11')]()]+']',_0x6417('0x67'));emit(_0x9eca2[_0x6417('0x51')],_0x24a5c3[_0x6417('0x68')],_0x5a59ce[_0x6417('0x39')]);}})[_0x6417('0x12')](function(_0x5a5408){logger[_0x6417('0x1b')]('['+[_0x43bed7['toUpperCase']()]+']\x20Error\x20running\x20ServiceNow\x20integration',util['inspect'](_0x5a5408,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x8311=['Incident\x20-\x20','ticketNumber','all',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','push','Tags','map','%26sysparm_record_target%3Dincident','%26sysparm_record_list%3Dactive%253Dtrue','%255EORDERBYDESCnumber','/nav_to.do?uri=incident.do?sys_id%3D','format','user:%s','emit','password','sysparm_limit=1','sysparm_display_value=true','remoteUri','stripTrailingSlash','serverUrl','email','destcalleridnum','calleridnum','callDirection','queue','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','none','call\x20direction:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20ServiceNow\x20integration','inspect','bluebird','util','md5','ioredis','./util','../../../../config/environment','../../../../config/logger','servicenow','redis','defaults','localhost','socket.io-emitter','GET','result','adminId','sys_id','info','toUpperCase','],\x20getAdminUser\x20crm','catch','error','message','],\x20getUser\x20input\x20crm','validateEmail','userEmail','sys_user?sysparm_query=email%3D','],\x20getUser\x20rp\x20obj','then','true','userId','adminEmail',']\x20using\x20admin\x20profile','sys_user?','endUserNumber','user','System','],\x20EndUser\x20schema','],\x20getEndUser\x20input\x20crm','sys_user?sysparm_query=phone%3D','length','],\x20getEndUser\x20crm','],\x20createEndUser\x20crm','forEach','type','customField','nameField','toLowerCase','content','toString','includes','idField','variableName','customVariable','Variable','name',']\x20getTicket\x20input\x20crm','outbound','endUserId','POST','incident','assign','getString','Subjects','Descriptions','Fields',']\x20POST\x20incident\x20entity\x20schema','ticketId','number',']\x20getTicket\x20crm','label','label_entry'];(function(_0x46ad9e,_0x138238){var _0x2e05eb=function(_0x4dc108){while(--_0x4dc108){_0x46ad9e['push'](_0x46ad9e['shift']());}};_0x2e05eb(++_0x138238);}(_0x8311,0x169));var _0x1831=function(_0x43644b,_0xeee395){_0x43644b=_0x43644b-0x0;var _0x46627c=_0x8311[_0x43644b];return _0x46627c;};'use strict';var _=require('lodash');var Promise=require(_0x1831('0x0'));var rp=require('request-promise');var util=require(_0x1831('0x1'));var md5=require(_0x1831('0x2'));var Redis=require(_0x1831('0x3'));var intUtil=require(_0x1831('0x4'));var config=require(_0x1831('0x5'));var logger=require(_0x1831('0x6'))(_0x1831('0x7'));config[_0x1831('0x8')]=_[_0x1831('0x9')](config[_0x1831('0x8')],{'host':_0x1831('0xa'),'port':0x18eb});var io=require(_0x1831('0xb'))(new Redis(config['redis']));function getAdminUser(_0x410648,_0x2497e1,_0x5cb345,_0x421d10,_0x109696,_0x46bfbf){return new Promise(function(_0x46dce3,_0x31b722){var _0x34cf52={'method':_0x1831('0xc'),'uri':_0x421d10+'sys_user?sysparm_query=user_name%3Dadmin'+'&'+_0x109696+'&'+_0x46bfbf,'auth':_0x2497e1,'json':!![]};return rp(_0x34cf52)['then'](function(_0x5abc0f){if(_0x5abc0f[_0x1831('0xd')]['length']>0x0){_0x5cb345[_0x1831('0xe')]=_0x5abc0f[_0x1831('0xd')][0x0][_0x1831('0xf')];}logger[_0x1831('0x10')]('['+[_0x410648[_0x1831('0x11')]()]+_0x1831('0x12'),_0x5cb345);_0x46dce3(_0x5cb345);})[_0x1831('0x13')](function(_0x2860fe){logger[_0x1831('0x14')]('['+[_0x410648[_0x1831('0x11')]()]+']',_0x2860fe[_0x1831('0x15')]);_0x31b722(_0x2860fe[_0x1831('0x15')]);});});}function getUser(_0x463668,_0x5b95ac,_0x3d35d6,_0x46027d,_0x4aa73e){return function(_0x583091){logger[_0x1831('0x10')]('['+[_0x463668[_0x1831('0x11')]()]+_0x1831('0x16'),_0x583091);return new Promise(function(_0x56dde2,_0x111026){if(intUtil[_0x1831('0x17')](_0x583091[_0x1831('0x18')])){var _0xea5a73={'method':_0x1831('0xc'),'uri':_0x3d35d6+_0x1831('0x19')+_0x583091['userEmail']+'&'+_0x46027d+'&'+_0x4aa73e,'auth':_0x5b95ac,'json':!![]};logger[_0x1831('0x10')]('['+[_0x463668[_0x1831('0x11')]()]+_0x1831('0x1a'),_0xea5a73);return rp(_0xea5a73)[_0x1831('0x1b')](function(_0x3e18bf){logger[_0x1831('0x10')]('['+[_0x463668[_0x1831('0x11')]()]+'],\x20getUser\x20entity',_0x3e18bf);if(_0x3e18bf[_0x1831('0xd')]['length']>0x0&&String(_0x3e18bf[_0x1831('0xd')][0x0]['active'])===_0x1831('0x1c')){_0x583091[_0x1831('0x1d')]=_0x3e18bf[_0x1831('0xd')][0x0][_0x1831('0xf')];}else{_0x583091['userId']=_0x583091['adminId'];_0x583091[_0x1831('0x18')]=_0x583091[_0x1831('0x1e')];}logger[_0x1831('0x10')]('['+[_0x463668[_0x1831('0x11')]()]+'],\x20getUser\x20crm',_0x583091);_0x56dde2(_0x583091);})['catch'](function(_0x1c0f16){logger[_0x1831('0x14')]('['+[_0x463668['toUpperCase']()]+']',_0x1c0f16[_0x1831('0x15')]);_0x111026(_0x1c0f16['message']);});}else{logger[_0x1831('0x10')]('['+[_0x463668[_0x1831('0x11')]()]+_0x1831('0x1f'));_0x583091['userId']=_0x583091[_0x1831('0xe')];_0x583091['userEmail']=_0x583091[_0x1831('0x1e')];_0x56dde2(_0x583091);}});};}function createEndUser(_0xa4a993,_0x149f48,_0x58d0a4,_0x280877,_0x4458c8){logger[_0x1831('0x10')]('['+[_0xa4a993[_0x1831('0x11')]()]+'],\x20createEndUser\x20input\x20crm',_0x58d0a4);return new Promise(function(_0x51491d,_0x3b58a3){var _0xdfd579={'method':'POST','uri':_0x280877+_0x1831('0x20')+_0x4458c8,'body':{'user_name':_0x58d0a4[_0x1831('0x21')],'roles':_0x1831('0x22'),'first_name':_0x58d0a4['endUserNumber'],'active':_0x1831('0x1c'),'date_format':_0x1831('0x23'),'phone':_0x58d0a4[_0x1831('0x21')]},'auth':_0x149f48,'json':!![]};return rp(_0xdfd579)[_0x1831('0x1b')](function(_0x296259){logger[_0x1831('0x10')]('['+[_0xa4a993[_0x1831('0x11')]()]+_0x1831('0x24'),_0x296259[_0x1831('0xd')]);_0x58d0a4['endUserId']=_0x296259[_0x1831('0xd')]['sys_id'];_0x51491d(_0x58d0a4);})[_0x1831('0x13')](function(_0x1d4ca1){logger['error']('['+[_0xa4a993[_0x1831('0x11')]()]+']',_0x1d4ca1[_0x1831('0x15')]);_0x3b58a3(_0x1d4ca1[_0x1831('0x15')]);});});}function getEndUser(_0x114443,_0x1ac35a,_0x35784f,_0x2e7eba,_0x398db6){return function(_0x4ac3d2){logger[_0x1831('0x10')]('['+[_0x114443[_0x1831('0x11')]()]+_0x1831('0x25'),_0x4ac3d2);return new Promise(function(_0x77f511,_0x263c88){var _0x4ff5b1={'method':_0x1831('0xc'),'uri':_0x35784f+_0x1831('0x26')+_0x4ac3d2['endUserNumber']+'&'+_0x2e7eba+'&'+_0x398db6,'auth':_0x1ac35a,'json':!![]};return rp(_0x4ff5b1)['then'](function(_0x4ddd67){if(_0x4ddd67['result'][_0x1831('0x27')]>0x0){_0x4ac3d2['endUserId']=_0x4ddd67[_0x1831('0xd')][0x0][_0x1831('0xf')];logger[_0x1831('0x10')]('['+[_0x114443[_0x1831('0x11')]()]+_0x1831('0x28'),_0x4ac3d2);_0x77f511(_0x4ac3d2);}else{return createEndUser(_0x114443,_0x1ac35a,_0x4ac3d2,_0x35784f,_0x2e7eba)[_0x1831('0x1b')](function(_0x55bd78){logger[_0x1831('0x10')]('['+[_0x114443['toUpperCase']()]+_0x1831('0x29'),_0x55bd78);_0x77f511(_0x55bd78);});}})[_0x1831('0x13')](function(_0x137b0e){logger['error']('['+[_0x114443[_0x1831('0x11')]()]+']',_0x137b0e[_0x1831('0x15')]);_0x263c88(_0x137b0e[_0x1831('0x15')]);});});};}function getCustomFields(_0x4da33b,_0x522a86){var _0x4d4e8b={};if(_0x4da33b['length']>0x0){_[_0x1831('0x2a')](_0x4da33b,function(_0x3fe380){if(_['includes'](['string','picklist'],_0x3fe380[_0x1831('0x2b')])&&_0x3fe380['nameField']&&!_0x3fe380[_0x1831('0x2c')]){_0x4d4e8b[_0x3fe380[_0x1831('0x2d')][_0x1831('0x2e')]()]=_0x3fe380[_0x1831('0x2f')][_0x1831('0x30')]();}else if(_[_0x1831('0x31')](['string','picklist'],_0x3fe380[_0x1831('0x2b')])&&_0x3fe380[_0x1831('0x32')]&&_0x3fe380['customField']){_0x4d4e8b[_0x3fe380[_0x1831('0x32')][_0x1831('0x2e')]()]=_0x3fe380['content'][_0x1831('0x30')]();}else if(_0x3fe380[_0x1831('0x2b')]==='variable'&&_0x3fe380['variableName']&&_0x3fe380[_0x1831('0x32')]&&_0x3fe380[_0x1831('0x2c')]){_0x4d4e8b[_0x3fe380[_0x1831('0x32')][_0x1831('0x2e')]()]=_0x522a86[_0x3fe380[_0x1831('0x33')]]['toString']();}else if(_0x3fe380['type']===_0x1831('0x34')&&_0x3fe380[_0x1831('0x35')]&&_0x3fe380['Variable']['name']&&_0x3fe380[_0x1831('0x32')]&&_0x3fe380['customField']){_0x4d4e8b[_0x3fe380[_0x1831('0x32')][_0x1831('0x2e')]()]=_0x522a86[_0x3fe380[_0x1831('0x35')][_0x1831('0x36')][_0x1831('0x2e')]()][_0x1831('0x30')]();}});}return _0x4d4e8b;}function getTicket(_0xcfb06c,_0x532747,_0x3319b2,_0x201660,_0x3b459c,_0x58864d){return function(_0x465bec){logger[_0x1831('0x10')]('['+[_0xcfb06c[_0x1831('0x11')]()]+_0x1831('0x37'),_0x465bec);return new Promise(function(_0x10243d,_0x203829){var _0x2f2afa=_0xcfb06c[_0x1831('0x2e')]()===_0x1831('0x38')?_0x465bec[_0x1831('0x1d')]:_0x465bec[_0x1831('0x39')];var _0x185235={'method':_0x1831('0x3a'),'uri':_0x3319b2+_0x1831('0x3b')+'?'+_0x58864d,'body':Object[_0x1831('0x3c')]({},{'active':_0x1831('0x1c'),'caller_id':_0x2f2afa,'assigned_to':_0x465bec['userId'],'short_description':intUtil[_0x1831('0x3d')](_0x201660[_0x1831('0x3e')],_0x3b459c,'\x20'),'description':intUtil[_0x1831('0x3d')](_0x201660[_0x1831('0x3f')],_0x3b459c,'\x0a')},getCustomFields(_0x201660[_0x1831('0x40')],_0x3b459c)),'auth':_0x532747,'json':!![]};return rp(_0x185235)[_0x1831('0x1b')](function(_0x4f8a2b){logger[_0x1831('0x10')]('['+[_0xcfb06c[_0x1831('0x11')]()]+_0x1831('0x41'),_0x4f8a2b[_0x1831('0xd')]);_0x465bec[_0x1831('0x42')]=_0x4f8a2b[_0x1831('0xd')][_0x1831('0xf')];_0x465bec['ticketNumber']=_0x4f8a2b['result'][_0x1831('0x43')];logger[_0x1831('0x10')]('['+[_0xcfb06c[_0x1831('0x11')]()]+_0x1831('0x44'),_0x465bec);_0x10243d(_0x465bec);})[_0x1831('0x13')](function(_0x278a86){logger[_0x1831('0x14')]('['+[_0xcfb06c[_0x1831('0x11')]()]+']',_0x278a86['message']);_0x203829(_0x278a86[_0x1831('0x15')]);});});};}function createRemoteTag(_0x3f6b46,_0x42a627,_0x48e924,_0x1317b4){return new Promise(function(_0x15f6f8,_0x488cdc){var _0x1e7f83={'method':_0x1831('0x3a'),'uri':_0x48e924+'label'+'?'+_0x1317b4,'body':{'short_description':_0x3f6b46,'global':!![],'active':!![],'name':_0x3f6b46},'auth':_0x42a627,'json':!![]};return rp(_0x1e7f83)[_0x1831('0x1b')](function(_0x2afd1f){var _0x5b8800=_0x2afd1f['result'][_0x1831('0xf')];_0x15f6f8(_0x5b8800);});});}function getRemoteTag(_0x18fa52,_0x1acf77,_0x58c25b,_0x1ca668,_0x587b22){return new Promise(function(_0x375b08,_0x2ad6b1){var _0x38b781={'method':_0x1831('0xc'),'uri':_0x58c25b+_0x1831('0x45')+'?sysparm_query=name%3D'+_0x18fa52+'&'+_0x1ca668,'auth':_0x1acf77,'json':!![]};return rp(_0x38b781)[_0x1831('0x1b')](function(_0x279a10){if(_0x279a10[_0x1831('0xd')][_0x1831('0x27')]>0x0){var _0x2f6706=_0x279a10[_0x1831('0xd')][0x0][_0x1831('0xf')];_0x375b08(_0x2f6706);}else{return createRemoteTag(_0x18fa52,_0x1acf77,_0x58c25b,_0x1ca668)[_0x1831('0x1b')](function(_0x4f267e){_0x375b08(_0x4f267e);});}});});}function assignTagToIncident(_0xa6e7ab,_0x550c71,_0x18c21e,_0xa96305,_0x40ef89){return new Promise(function(_0x59dab5,_0xca712){var _0x406221={'method':_0x1831('0x3a'),'uri':_0x18c21e+_0x1831('0x46')+'?'+_0x40ef89,'body':{'label':_0xa6e7ab,'table':_0x1831('0x3b'),'id_type':'Incident','table_key':_0xa96305[_0x1831('0x42')],'title':_0x1831('0x47')+_0xa96305[_0x1831('0x48')],'id_display':_0xa96305[_0x1831('0x48')]},'auth':_0x550c71,'json':!![]};return rp(_0x406221)[_0x1831('0x1b')](function(_0x22f507){_0x59dab5();})['catch'](function(){_0x59dab5();});});}function manageTags(_0x2c6dd3,_0x5b7657,_0x5e1326,_0x4ad8a4,_0x44f776,_0x71c605,_0x12ee8d){return new Promise(function(_0x563267,_0x270858){var _0x1dc7b1=[];_0x5b7657['forEach'](function(_0x2a1ab8){_0x1dc7b1['push'](getRemoteTag(_0x2a1ab8,_0x5e1326,_0x4ad8a4,_0x71c605,_0x12ee8d));});return Promise[_0x1831('0x49')](_0x1dc7b1)['then'](function(_0x1923b8){if(_0x1923b8[_0x1831('0x27')]){logger['info']('['+[_0x2c6dd3[_0x1831('0x11')]()]+_0x1831('0x4a'),_0x1923b8);var _0x3b209a=[];_0x1923b8[_0x1831('0x2a')](function(_0x70aa05){_0x3b209a[_0x1831('0x4b')](assignTagToIncident(_0x70aa05,_0x5e1326,_0x4ad8a4,_0x44f776,_0x71c605));});return Promise[_0x1831('0x49')](_0x3b209a)[_0x1831('0x1b')](function(){_0x563267();})[_0x1831('0x13')](function(){_0x563267();});}else{_0x563267();}});});}function getTags(_0x20452d,_0x256258,_0x2a1628,_0x269b43,_0x40a24c,_0x408987){return function(_0x40b6ae){return new Promise(function(_0x3d6c9c,_0x295059){var _0x3d0a11=[];var _0x4958da=_0x269b43[_0x1831('0x4c')];if(_0x4958da&&_0x4958da['length']>0x0){_0x3d0a11=_[_0x1831('0x4d')](_0x4958da,_0x1831('0x36'));}if(_0x3d0a11['length']>0x0){return manageTags(_0x20452d,_0x3d0a11,_0x256258,_0x2a1628,_0x40b6ae,_0x40a24c,_0x408987)['then'](function(){_0x3d6c9c(_0x40b6ae);});}else{_0x3d6c9c(_0x40b6ae);}});};}function emit(_0x1864d3,_0x4ae0de,_0x461a97){var _0x4e786f=_0x1831('0x4e')+'%26sysparm_record_row%3D1%26sysparm_record_rows%3D39'+_0x1831('0x4f')+_0x1831('0x50');var _0x2e59c5={'uri':_0x1864d3+_0x1831('0x51')+_0x461a97+_0x4e786f};io['to'](util[_0x1831('0x52')](_0x1831('0x53'),_0x4ae0de))[_0x1831('0x54')]('trigger:browser:url',_0x2e59c5);}exports['cs']=function(_0x2c9f3f,_0x1cd68e,_0x24d121,_0xe987ac,_0x2276e0,_0x71acb0,_0x8ba13e,_0x54f7be){var _0xf0e49a={};var _0x2626dd={'user':_0x71acb0['username'],'pass':_0x71acb0[_0x1831('0x55')]};var _0x21ffcd=_0x1831('0x56');var _0x1284a0=_0x1831('0x57');_0x71acb0[_0x1831('0x58')]=intUtil[_0x1831('0x59')](_0x71acb0['remoteUri']);_0x71acb0['serverUrl']=intUtil['stripTrailingSlash'](_0x71acb0[_0x1831('0x5a')]);var _0x28d25d=util[_0x1831('0x52')]('%s/api/now/table/',_0x71acb0[_0x1831('0x58')]);_0xf0e49a[_0x1831('0x18')]=!_['isNil'](_0xe987ac)?_0xe987ac[_0x1831('0x5b')]:null;_0xf0e49a[_0x1831('0x1e')]=_0x71acb0[_0x1831('0x5b')];_0xf0e49a[_0x1831('0x21')]=_0x54f7be[_0x1831('0x2e')]()===_0x1831('0x38')?_0x1cd68e[_0x1831('0x5c')]:_0x1cd68e[_0x1831('0x5d')];_0xf0e49a[_0x1831('0x5e')]=_0x54f7be===_0x1831('0x5f')||_0x54f7be===_0x1831('0x60')?_0x1831('0x5f'):_0x1831('0x38');var _0x56cd33=util[_0x1831('0x52')](_0x1831('0x61'),_0x71acb0['serverUrl'],_0x1cd68e[_0x1831('0x62')],md5(_0x1cd68e['uniqueid']));if(_0x2276e0&&_0x2276e0[_0x1831('0x63')]){logger[_0x1831('0x10')](_0x1831('0x64'),_0x1831('0x65'));_0x1cd68e[_0x1831('0x66')]=_0x56cd33;}else if(_0x8ba13e&&_0x8ba13e['recordingFormat']&&_0x8ba13e['recordingFormat']!==_0x1831('0x67')){logger[_0x1831('0x10')]('[OUTBOUND]',_0x1831('0x65'));_0x1cd68e[_0x1831('0x66')]=_0x56cd33;}else{_0x1cd68e[_0x1831('0x66')]='';}return getAdminUser(_0x54f7be,_0x2626dd,_0xf0e49a,_0x28d25d,_0x1284a0,_0x21ffcd)['then'](getUser(_0x54f7be,_0x2626dd,_0x28d25d,_0x1284a0,_0x21ffcd))['then'](getEndUser(_0x54f7be,_0x2626dd,_0x28d25d,_0x1284a0,_0x21ffcd))['then'](getTicket(_0x54f7be,_0x2626dd,_0x28d25d,_0x24d121,_0x1cd68e,_0x1284a0))['then'](function(_0x341b44){logger[_0x1831('0x10')](util['format']('The\x20ticket\x20ID\x20is:\x20%s',_0x341b44['ticketId']));logger[_0x1831('0x10')](util[_0x1831('0x52')](_0x1831('0x68'),_0x54f7be));if(_0x54f7be!==_0x1831('0x60')){logger['info']('['+[_0x54f7be['toUpperCase']()]+']',_0x1831('0x69'));emit(_0x71acb0[_0x1831('0x58')],_0xe987ac['name'],_0x341b44[_0x1831('0x42')]);}})[_0x1831('0x13')](function(_0x51fa93){logger['error']('['+[_0x54f7be[_0x1831('0x11')]()]+_0x1831('0x6a'),util[_0x1831('0x6b')](_0x51fa93,{'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 22ad10b..9643a42 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 _0x7a94=['users','contacts','version','[OUTBOUND]','unmanaged','lastevent','toUpperCase','Inbound','lodash','request-promise','bluebird','md5','util','./util','../../../../config/logger','sugarcrm','defaults','redis','localhost','POST','emit','info','Creating\x20new\x20ticket...','getString','Subjects','assigned_user_id','created_by','Descriptions','toISOString','replace','duration_hours','duration_minutes','parent_id','parent_type','Contacts','parent_name','name','length','variableName','push','idField','set_entry','JSON','Calls','Basic\x20%s','get_server_info','stringify','isNil','Getting\x20agent\x20with\x20name','get_entry_list','Employees','format','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','user_name','then','find','Agent\x20found!','resolve','name_value_list','value','user_id','Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','contacts.phone_home\x20=\x20\x22%s\x22','phone_home','entry_list','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','','Caller\x20-\x20%s','Enduser\x20created.','first_name','debug','[HTTP]','merge','map','forEach','type','string','customField','toLowerCase','content','toString','custom_fields','variable','customVariable','Variable','login','username','password','PLAIN','sessionID','set_relationship','queue','remoteUri','stripTrailingSlash','serverUrl','uri','%s/service/v4_1/rest.php','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','charAt','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','catch','error','outbound','recordingFormat','none','The\x20User\x20ID\x20is:','destcalleridnum'];(function(_0x126558,_0x143c9a){var _0x1f6d14=function(_0x2b0eea){while(--_0x2b0eea){_0x126558['push'](_0x126558['shift']());}};_0x1f6d14(++_0x143c9a);}(_0x7a94,0x1f0));var _0x47a9=function(_0x29a683,_0x155289){_0x29a683=_0x29a683-0x0;var _0xe3b80d=_0x7a94[_0x29a683];return _0xe3b80d;};'use strict';var _=require(_0x47a9('0x0'));var rp=require(_0x47a9('0x1'));var BPromise=require(_0x47a9('0x2'));var md5=require(_0x47a9('0x3'));var util=require(_0x47a9('0x4'));var Redis=require('ioredis');var intUtil=require(_0x47a9('0x5'));var config=require('../../../../config/environment');var logger=require(_0x47a9('0x6'))(_0x47a9('0x7'));config['redis']=_[_0x47a9('0x8')](config[_0x47a9('0x9')],{'host':_0x47a9('0xa'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x47a9('0x9')]));var def={'method':_0x47a9('0xb'),'json':!![]};function emit(_0x387e83,_0xdae82c,_0xda9e82){io['to'](_0x387e83)[_0x47a9('0xc')](_0xdae82c,_0xda9e82);}function getTicket(_0x1219f,_0x419e0c,_0x1a06cc,_0x41a9e6,_0x2d49f3,_0x4d852a,_0x4c474a,_0x47b9b9){logger[_0x47a9('0xd')](_0x47a9('0xe'));var _0x3eb9f1=new Date();var _0x28ef66=[{'name':'name','value':intUtil[_0x47a9('0xf')](_0x41a9e6[_0x47a9('0x10')],_0x2d49f3,'\x20')},{'name':_0x47a9('0x11'),'value':_0x419e0c['id']},{'name':_0x47a9('0x12'),'value':_0x419e0c['id']},{'name':'description','value':intUtil[_0x47a9('0xf')](_0x41a9e6[_0x47a9('0x13')],_0x2d49f3,'\x0a')},{'name':'date_start','value':_0x3eb9f1[_0x47a9('0x14')]()['slice'](0x0,0x13)[_0x47a9('0x15')]('T','\x20')},{'name':_0x47a9('0x16'),'value':'0'},{'name':_0x47a9('0x17'),'value':'15'},{'name':_0x47a9('0x18'),'value':_0x1a06cc['id']},{'name':_0x47a9('0x19'),'value':_0x47a9('0x1a')},{'name':_0x47a9('0x1b'),'value':_0x1a06cc[_0x47a9('0x1c')]},{'name':'direction','value':_0x47b9b9}];if(_0x4d852a[_0x47a9('0x1d')]){_['forEach'](_0x4d852a,function(_0x50c272){if(_0x2d49f3[_0x50c272[_0x47a9('0x1e')]]){_0x28ef66[_0x47a9('0x1f')]({'name':_0x50c272[_0x47a9('0x20')],'value':_0x2d49f3[_0x50c272[_0x47a9('0x1e')]]});}});}return request({'form':{'method':_0x47a9('0x21'),'input_type':_0x47a9('0x22'),'response_type':_0x47a9('0x22'),'rest_data':JSON['stringify']({'session':_0x4c474a['id'],'module_name':_0x47a9('0x23'),'name_value_list':_0x28ef66})}});}function getAuth(_0x4ede90){return util['format'](_0x47a9('0x24'),new Buffer(_0x4ede90['apiKey']+':X')['toString']('base64'));}function getServerInfo(_0x536ccd){return request({'form':{'method':_0x47a9('0x25'),'input_type':_0x47a9('0x22'),'response_type':_0x47a9('0x22'),'rest_data':JSON[_0x47a9('0x26')]({'session':_0x536ccd['id']})}});}function getUser(_0x527f3e,_0x41404d,_0x6c0621){if(!_[_0x47a9('0x27')](_0x41404d)){logger[_0x47a9('0xd')](_0x47a9('0x28'),_0x41404d);return request({'form':{'method':_0x47a9('0x29'),'input_type':_0x47a9('0x22'),'response_type':_0x47a9('0x22'),'rest_data':JSON[_0x47a9('0x26')]({'session':_0x6c0621['id'],'module_name':_0x47a9('0x2a'),'query':util[_0x47a9('0x2b')](_0x47a9('0x2c'),_0x41404d),'order_by':'','offset':'0','select_fields':['id',_0x47a9('0x1c'),_0x47a9('0x2d')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x47a9('0x2e')](function(_0x47206e){if(_0x47206e['entry_list'][_0x47a9('0x1d')]){var _0x16707f=_[_0x47a9('0x2f')](_0x47206e['entry_list'],function(_0x3979c7){return _0x3979c7['name_value_list']['user_name']['value']===_0x41404d;});if(_0x16707f){logger[_0x47a9('0xd')](_0x47a9('0x30'));return BPromise[_0x47a9('0x31')]({'id':_0x16707f[_0x47a9('0x32')]['id'][_0x47a9('0x33')],'name':_0x16707f[_0x47a9('0x32')][_0x47a9('0x1c')][_0x47a9('0x33')]});}}logger[_0x47a9('0xd')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise[_0x47a9('0x31')]({'id':_0x6c0621[_0x47a9('0x32')][_0x47a9('0x34')][_0x47a9('0x33')],'name':_0x6c0621[_0x47a9('0x32')][_0x47a9('0x2d')][_0x47a9('0x33')]});});}else{logger['info'](_0x47a9('0x35'));return BPromise[_0x47a9('0x31')]({'id':_0x6c0621[_0x47a9('0x32')]['user_id']['value'],'name':_0x6c0621[_0x47a9('0x32')]['user_name'][_0x47a9('0x33')]});}}function getEndUser(_0xd06c64,_0x5ec98f,_0x28f442,_0x2386f4){logger[_0x47a9('0xd')](_0x47a9('0x36'),_0x28f442);return request({'form':{'method':_0x47a9('0x29'),'input_type':_0x47a9('0x22'),'response_type':_0x47a9('0x22'),'rest_data':JSON[_0x47a9('0x26')]({'session':_0x2386f4['id'],'module_name':'Contacts','query':util[_0x47a9('0x2b')](_0x47a9('0x37'),_0x28f442),'order_by':'','offset':'0','select_fields':['id',_0x47a9('0x1c'),_0x47a9('0x38')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x47a9('0x2e')](function(_0x1ee5c7){if(_0x1ee5c7[_0x47a9('0x39')]['length']){var _0x7acf48=_[_0x47a9('0x2f')](_0x1ee5c7[_0x47a9('0x39')],function(_0xb10bb4){return _0xb10bb4['name_value_list']['phone_home']['value']===_0x28f442;});if(_0x7acf48){logger['info']('Enduser\x20found!');return BPromise[_0x47a9('0x31')]({'id':_0x7acf48[_0x47a9('0x32')]['id'][_0x47a9('0x33')],'name':_0x7acf48[_0x47a9('0x32')][_0x47a9('0x1c')][_0x47a9('0x33')],'phone':_0x7acf48[_0x47a9('0x32')][_0x47a9('0x38')][_0x47a9('0x33')]});}}else{logger['info'](_0x47a9('0x3a'));return request({'form':{'method':'set_entry','input_type':'JSON','response_type':_0x47a9('0x22'),'rest_data':JSON[_0x47a9('0x26')]({'session':_0x2386f4['id'],'module_name':_0x47a9('0x1a'),'name_value_list':[{'name':'first_name','value':_0x5ec98f!==_0x47a9('0x3b')?_0x5ec98f:util[_0x47a9('0x2b')](_0x47a9('0x3c'),_0x28f442)},{'name':_0x47a9('0x38'),'value':_0x28f442}]})}})[_0x47a9('0x2e')](function(_0x575be0){logger[_0x47a9('0xd')](_0x47a9('0x3d'));return BPromise[_0x47a9('0x31')]({'id':_0x575be0['id'],'name':_0x575be0[_0x47a9('0x39')][_0x47a9('0x3e')][_0x47a9('0x33')],'phone':_0x575be0[_0x47a9('0x39')]['phone_home'][_0x47a9('0x33')]});});}});}function request(_0x961aa6){logger[_0x47a9('0x3f')](_0x47a9('0x40'),JSON[_0x47a9('0x26')](_0x961aa6));return rp(_[_0x47a9('0x41')](def,_0x961aa6));}function getTags(_0x5ca470,_0x3226b3){var _0x37e3d7=[];if(_0x5ca470&&_0x5ca470[_0x47a9('0x1d')]>0x0){_0x37e3d7=_[_0x47a9('0x42')](_0x5ca470,_0x3226b3);}return _0x37e3d7;}function getCustomFields(_0x4151bb,_0x5bf1b0){var _0x3f9711=[];var _0x99fcba={'custom_fields':[]};if(_0x4151bb[_0x47a9('0x1d')]>0x0){_[_0x47a9('0x43')](_0x4151bb,function(_0x4226b5){if(_0x4226b5[_0x47a9('0x44')]===_0x47a9('0x45')&&_0x4226b5['nameField']&&!_0x4226b5[_0x47a9('0x46')]){_0x99fcba[_0x4226b5['nameField'][_0x47a9('0x47')]()]=_0x4226b5[_0x47a9('0x48')][_0x47a9('0x49')]();}else if(_0x4226b5[_0x47a9('0x44')]===_0x47a9('0x45')&&_0x4226b5['idField']&&_0x4226b5['customField']){_0x99fcba[_0x47a9('0x4a')][_0x47a9('0x1f')]({'id':_0x4226b5[_0x47a9('0x20')],'value':_0x4226b5[_0x47a9('0x48')][_0x47a9('0x49')]()});}else if(_0x4226b5[_0x47a9('0x44')]===_0x47a9('0x4b')&&_0x4226b5[_0x47a9('0x1e')]&&_0x4226b5[_0x47a9('0x20')]&&_0x4226b5['customField']){_0x5bf1b0[_0x4226b5[_0x47a9('0x1e')]]&&_0x99fcba['custom_fields']['push']({'id':_0x4226b5[_0x47a9('0x20')],'value':_0x5bf1b0[_0x4226b5[_0x47a9('0x1e')]]['toString']()});}else if(_0x4226b5[_0x47a9('0x44')]===_0x47a9('0x4c')&&_0x4226b5[_0x47a9('0x4d')]&&_0x4226b5[_0x47a9('0x4d')][_0x47a9('0x1c')]&&_0x4226b5[_0x47a9('0x20')]&&_0x4226b5['customField']){_0x5bf1b0[_0x4226b5[_0x47a9('0x4d')][_0x47a9('0x1c')][_0x47a9('0x47')]()]&&_0x99fcba['custom_fields'][_0x47a9('0x1f')]({'id':_0x4226b5[_0x47a9('0x20')],'value':_0x5bf1b0[_0x4226b5[_0x47a9('0x4d')][_0x47a9('0x1c')][_0x47a9('0x47')]()]['toString']()});}});}return _0x99fcba;}function getConnection(_0x271b1a){return request({'method':_0x47a9('0xb'),'form':{'method':_0x47a9('0x4e'),'input_type':'JSON','response_type':_0x47a9('0x22'),'rest_data':JSON[_0x47a9('0x26')]({'user_auth':{'user_name':_0x271b1a[_0x47a9('0x4f')],'password':_0x271b1a[_0x47a9('0x50')],'encryption':_0x47a9('0x51')},'application':'xCALLY\x20Motion\x20integration'})}})[_0x47a9('0x2e')](function(_0x2d6288){var _0x466f3d=_0x2d6288;if(_0x466f3d['id']){def[_0x47a9('0x52')]=_0x466f3d['id'];return BPromise[_0x47a9('0x31')](_0x466f3d);}else{throw new Error(util[_0x47a9('0x2b')]('Account\x20%d\x20is\x20not\x20valid',_0x271b1a['id']));}});}function setRelationship(_0x3423f3,_0x104131,_0x970281,_0x369bbe){return request({'form':{'method':_0x47a9('0x53'),'input_type':_0x47a9('0x22'),'response_type':'JSON','rest_data':JSON[_0x47a9('0x26')]({'session':_0x3423f3['id'],'module_name':_0x47a9('0x23'),'module_id':_0x970281['id'],'link_field_name':_0x369bbe,'related_ids':[_0x104131['id']],'name_value_list':[],'delete':0x0})}});}exports[_0x47a9('0x54')]=function(_0x54c0c7,_0x78ff92,_0x12703f,_0x5ec438,_0x368591,_0x285190){var _0x2f9f56,_0x1eb1e5,_0x340c45,_0x3d3c82;_0x285190[_0x47a9('0x55')]=intUtil[_0x47a9('0x56')](_0x285190[_0x47a9('0x55')]);_0x285190[_0x47a9('0x57')]=intUtil[_0x47a9('0x56')](_0x285190[_0x47a9('0x57')]);def[_0x47a9('0x58')]=util[_0x47a9('0x2b')](_0x47a9('0x59'),_0x285190['remoteUri']);if(_0x368591&&_0x368591[_0x47a9('0x5a')]){logger[_0x47a9('0xd')](_0x47a9('0x5b'),_0x47a9('0x5c'));_0x78ff92[_0x47a9('0x5d')]=util['format'](_0x47a9('0x5e'),_0x285190[_0x47a9('0x57')],_0x78ff92['uniqueid'],md5(_0x78ff92[_0x47a9('0x5f')]));}else{_0x78ff92['recordingURL']='';}return getConnection(_0x285190)[_0x47a9('0x2e')](function(_0x4101fc){_0x3d3c82=_0x4101fc;return getUser(_0x285190,_0x5ec438['name'],_0x3d3c82);})[_0x47a9('0x2e')](function(_0x1d6941){_0x2f9f56=_0x1d6941;logger['info']('The\x20User\x20ID\x20is:',_0x2f9f56['id']);return getEndUser(_0x285190,_0x78ff92['calleridname'],_0x78ff92[_0x47a9('0x60')],_0x3d3c82);})['then'](function(_0x108f76){_0x1eb1e5=_0x108f76;logger['info'](_0x47a9('0x61'),_0x1eb1e5['id']);return getTicket(_0x285190,_0x2f9f56,_0x1eb1e5,_0x12703f,_0x78ff92,_0x12703f[_0x47a9('0x62')],_0x3d3c82,'Inbound');})[_0x47a9('0x2e')](function(_0x204eac){_0x340c45=_0x204eac;logger[_0x47a9('0xd')](_0x47a9('0x63'));logger[_0x47a9('0xd')](_0x47a9('0x64'),_0x340c45['id']);return setRelationship(_0x3d3c82,_0x2f9f56,_0x340c45,'users');})['then'](function(){return setRelationship(_0x3d3c82,_0x1eb1e5,_0x340c45,'contacts');})[_0x47a9('0x2e')](function(){return getServerInfo(_0x3d3c82);})[_0x47a9('0x2e')](function(_0x29c4bb){var _0x4a34b2=parseInt(_0x29c4bb['version'][_0x47a9('0x65')](0x0));var _0x5af5d4=util['format'](_0x47a9('0x66'),_0x285190[_0x47a9('0x55')],_0x340c45['id']);if(_0x4a34b2>0x6){_0x5af5d4=util[_0x47a9('0x2b')](_0x47a9('0x67'),_0x285190['remoteUri'],_0x340c45['id']);}logger['info'](_0x47a9('0x5b'),_0x47a9('0x68'));emit(util[_0x47a9('0x2b')](_0x47a9('0x69'),_0x5ec438[_0x47a9('0x1c')]),_0x47a9('0x6a'),{'uri':_0x5af5d4});})[_0x47a9('0x6b')](function(_0x275d38){logger[_0x47a9('0x6c')]('[QUEUE]',JSON['stringify'](_0x275d38));});};exports[_0x47a9('0x6d')]=function(_0x27b845,_0x30d179,_0x59c24e,_0x37ab31,_0x5aa606,_0x2a3d5c,_0x151826){var _0x322b7c,_0x1a2adb,_0x2f862e,_0x5a294c;_0x2a3d5c[_0x47a9('0x55')]=intUtil['stripTrailingSlash'](_0x2a3d5c[_0x47a9('0x55')]);_0x2a3d5c[_0x47a9('0x57')]=intUtil[_0x47a9('0x56')](_0x2a3d5c[_0x47a9('0x57')]);def['uri']=util[_0x47a9('0x2b')](_0x47a9('0x59'),_0x2a3d5c[_0x47a9('0x55')]);if(_0x151826&&_0x151826[_0x47a9('0x6e')]&&_0x151826[_0x47a9('0x6e')]!==_0x47a9('0x6f')){logger['info']('[OUTBOUND]',_0x47a9('0x5c'));_0x30d179[_0x47a9('0x5d')]=util[_0x47a9('0x2b')](_0x47a9('0x5e'),_0x2a3d5c[_0x47a9('0x57')],_0x30d179['uniqueid'],md5(_0x30d179[_0x47a9('0x5f')]));}return getConnection(_0x2a3d5c)[_0x47a9('0x2e')](function(_0xbbaa52){_0x5a294c=_0xbbaa52;return getUser(_0x2a3d5c,_0x37ab31[_0x47a9('0x1c')],_0x5a294c);})['then'](function(_0x35c88e){_0x322b7c=_0x35c88e;logger['info'](_0x47a9('0x70'),_0x322b7c['id']);return getEndUser(_0x2a3d5c,_0x30d179['destcalleridname'],_0x30d179[_0x47a9('0x71')],_0x5a294c);})[_0x47a9('0x2e')](function(_0x3cad0f){_0x1a2adb=_0x3cad0f;logger[_0x47a9('0xd')](_0x47a9('0x61'),_0x1a2adb['id']);return getTicket(_0x2a3d5c,_0x322b7c,_0x1a2adb,_0x59c24e,_0x30d179,_0x59c24e['Fields'],_0x5a294c,'Outbound');})[_0x47a9('0x2e')](function(_0x51f04a){_0x2f862e=_0x51f04a;logger[_0x47a9('0xd')]('Ticket\x20created!');logger[_0x47a9('0xd')](_0x47a9('0x64'),_0x2f862e['id']);return setRelationship(_0x5a294c,_0x322b7c,_0x2f862e,_0x47a9('0x72'));})[_0x47a9('0x2e')](function(){return setRelationship(_0x5a294c,_0x1a2adb,_0x2f862e,_0x47a9('0x73'));})['then'](function(){return getServerInfo(_0x5a294c);})['then'](function(_0x36c80d){var _0x261e8c=parseInt(_0x36c80d[_0x47a9('0x74')]['charAt'](0x0));var _0x217e6c=util[_0x47a9('0x2b')](_0x47a9('0x66'),_0x2a3d5c[_0x47a9('0x55')],_0x2f862e['id']);if(_0x261e8c>0x6){_0x217e6c=util[_0x47a9('0x2b')](_0x47a9('0x67'),_0x2a3d5c['remoteUri'],_0x2f862e['id']);}logger[_0x47a9('0xd')]('[OUTBOUND]',_0x47a9('0x68'));emit(util[_0x47a9('0x2b')](_0x47a9('0x69'),_0x37ab31[_0x47a9('0x1c')]),_0x47a9('0x6a'),{'uri':_0x217e6c});})[_0x47a9('0x6b')](function(_0xeba28b){logger[_0x47a9('0x6c')](_0x47a9('0x75'),JSON[_0x47a9('0x26')](_0xeba28b));});};exports[_0x47a9('0x76')]=function(_0x2791a1,_0x224f8e,_0x3de9e6,_0x427b8d,_0x88b536,_0x2974b4){var _0x94b205,_0x46eb72,_0x228f68,_0x4049c0;_0x2974b4['remoteUri']=intUtil['stripTrailingSlash'](_0x2974b4[_0x47a9('0x55')]);_0x2974b4[_0x47a9('0x57')]=intUtil[_0x47a9('0x56')](_0x2974b4['serverUrl']);def['uri']=util[_0x47a9('0x2b')]('%s/service/v4_1/rest.php',_0x2974b4[_0x47a9('0x55')]);if(_0x88b536&&_0x88b536[_0x47a9('0x5a')]){logger['info']('['+_0x224f8e[_0x47a9('0x77')][_0x47a9('0x78')]()+']','Recording\x20is\x20enabled!');_0x224f8e[_0x47a9('0x5d')]=util[_0x47a9('0x2b')](_0x47a9('0x5e'),_0x2974b4[_0x47a9('0x57')],_0x224f8e[_0x47a9('0x5f')],md5(_0x224f8e[_0x47a9('0x5f')]));}else{_0x224f8e['recordingURL']='';}return getConnection(_0x2974b4)[_0x47a9('0x2e')](function(_0x501a9b){_0x4049c0=_0x501a9b;if(!_[_0x47a9('0x27')](_0x427b8d)){return getUser(_0x2974b4,_0x427b8d[_0x47a9('0x1c')],_0x4049c0);}else{return getUser(_0x2974b4,null,_0x4049c0);}})[_0x47a9('0x2e')](function(_0x5ca19f){_0x94b205=_0x5ca19f;logger[_0x47a9('0xd')](_0x47a9('0x70'),_0x94b205['id']);return getEndUser(_0x2974b4,_0x224f8e['calleridname'],_0x224f8e[_0x47a9('0x60')],_0x4049c0);})[_0x47a9('0x2e')](function(_0x57e1ec){_0x46eb72=_0x57e1ec;logger['info'](_0x47a9('0x61'),_0x46eb72['id']);return getTicket(_0x2974b4,_0x94b205,_0x46eb72,_0x3de9e6,_0x224f8e,_0x3de9e6[_0x47a9('0x62')],_0x4049c0,_0x47a9('0x79'));})[_0x47a9('0x2e')](function(_0x1b5959){_0x228f68=_0x1b5959;logger[_0x47a9('0xd')]('Ticket\x20created!');logger[_0x47a9('0xd')]('The\x20Ticket\x20ID\x20is:',_0x228f68['id']);return setRelationship(_0x4049c0,_0x94b205,_0x228f68,_0x47a9('0x72'));})[_0x47a9('0x2e')](function(){return setRelationship(_0x4049c0,_0x46eb72,_0x228f68,_0x47a9('0x73'));})[_0x47a9('0x2e')](function(){return getServerInfo(_0x4049c0);})[_0x47a9('0x6b')](function(_0x15769e){logger[_0x47a9('0x6c')]('['+_0x224f8e[_0x47a9('0x77')][_0x47a9('0x78')]()+']',JSON[_0x47a9('0x26')](_0x15769e));});}; \ No newline at end of file +var _0x94da=['Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','error','outbound','recordingFormat','[OUTBOUND]','uniqueid','destcalleridname','destcalleridnum','Outbound','catch','unmanaged','uri','lastevent','toUpperCase','recordingURL','calleridname','lodash','request-promise','bluebird','util','ioredis','./util','../../../../config/environment','sugarcrm','redis','defaults','localhost','socket.io-emitter','POST','emit','info','name','getString','assigned_user_id','created_by','description','Descriptions','date_start','slice','replace','duration_hours','parent_id','parent_type','Contacts','direction','length','forEach','variableName','push','idField','JSON','stringify','Calls','format','Basic\x20%s','toString','base64','isNil','get_entry_list','Employees','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','then','entry_list','find','name_value_list','user_name','value','Agent\x20found!','user_id','Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','contacts.phone_home\x20=\x20\x22%s\x22','phone_home','Enduser\x20found!','resolve','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','set_entry','first_name','','Caller\x20-\x20%s','Enduser\x20created.','debug','[HTTP]','merge','map','type','string','toLowerCase','content','custom_fields','variable','customField','customVariable','Variable','login','username','password','PLAIN','Account\x20%d\x20is\x20not\x20valid','set_relationship','queue','stripTrailingSlash','remoteUri','serverUrl','%s/service/v4_1/rest.php','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','The\x20User\x20ID\x20is:','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','Inbound','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','users','contacts','version','charAt','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','%s/#bwc/index.php?module=Calls&action=EditView&record=%s'];(function(_0x273200,_0x44d899){var _0x2a9ca4=function(_0x3e3edf){while(--_0x3e3edf){_0x273200['push'](_0x273200['shift']());}};_0x2a9ca4(++_0x44d899);}(_0x94da,0x10a));var _0xa94d=function(_0xaa0309,_0x1c8008){_0xaa0309=_0xaa0309-0x0;var _0x5de7ce=_0x94da[_0xaa0309];return _0x5de7ce;};'use strict';var _=require(_0xa94d('0x0'));var rp=require(_0xa94d('0x1'));var BPromise=require(_0xa94d('0x2'));var md5=require('md5');var util=require(_0xa94d('0x3'));var Redis=require(_0xa94d('0x4'));var intUtil=require(_0xa94d('0x5'));var config=require(_0xa94d('0x6'));var logger=require('../../../../config/logger')(_0xa94d('0x7'));config[_0xa94d('0x8')]=_[_0xa94d('0x9')](config[_0xa94d('0x8')],{'host':_0xa94d('0xa'),'port':0x18eb});var io=require(_0xa94d('0xb'))(new Redis(config[_0xa94d('0x8')]));var def={'method':_0xa94d('0xc'),'json':!![]};function emit(_0x1fa0c4,_0x759f3b,_0x5b34fd){io['to'](_0x1fa0c4)[_0xa94d('0xd')](_0x759f3b,_0x5b34fd);}function getTicket(_0x357ba4,_0x5533a5,_0x134582,_0x462c22,_0xdcfcdd,_0x52d5ba,_0x4f475f,_0x401d2d){logger[_0xa94d('0xe')]('Creating\x20new\x20ticket...');var _0x201e15=new Date();var _0x16399b=[{'name':_0xa94d('0xf'),'value':intUtil[_0xa94d('0x10')](_0x462c22['Subjects'],_0xdcfcdd,'\x20')},{'name':_0xa94d('0x11'),'value':_0x5533a5['id']},{'name':_0xa94d('0x12'),'value':_0x5533a5['id']},{'name':_0xa94d('0x13'),'value':intUtil['getString'](_0x462c22[_0xa94d('0x14')],_0xdcfcdd,'\x0a')},{'name':_0xa94d('0x15'),'value':_0x201e15['toISOString']()[_0xa94d('0x16')](0x0,0x13)[_0xa94d('0x17')]('T','\x20')},{'name':_0xa94d('0x18'),'value':'0'},{'name':'duration_minutes','value':'15'},{'name':_0xa94d('0x19'),'value':_0x134582['id']},{'name':_0xa94d('0x1a'),'value':_0xa94d('0x1b')},{'name':'parent_name','value':_0x134582[_0xa94d('0xf')]},{'name':_0xa94d('0x1c'),'value':_0x401d2d}];if(_0x52d5ba[_0xa94d('0x1d')]){_[_0xa94d('0x1e')](_0x52d5ba,function(_0x36555a){if(_0xdcfcdd[_0x36555a[_0xa94d('0x1f')]]){_0x16399b[_0xa94d('0x20')]({'name':_0x36555a[_0xa94d('0x21')],'value':_0xdcfcdd[_0x36555a[_0xa94d('0x1f')]]});}});}return request({'form':{'method':'set_entry','input_type':_0xa94d('0x22'),'response_type':'JSON','rest_data':JSON[_0xa94d('0x23')]({'session':_0x4f475f['id'],'module_name':_0xa94d('0x24'),'name_value_list':_0x16399b})}});}function getAuth(_0x8cd1b8){return util[_0xa94d('0x25')](_0xa94d('0x26'),new Buffer(_0x8cd1b8['apiKey']+':X')[_0xa94d('0x27')](_0xa94d('0x28')));}function getServerInfo(_0x34090f){return request({'form':{'method':'get_server_info','input_type':_0xa94d('0x22'),'response_type':_0xa94d('0x22'),'rest_data':JSON[_0xa94d('0x23')]({'session':_0x34090f['id']})}});}function getUser(_0x3db3af,_0x2a4d40,_0x2a1bab){if(!_[_0xa94d('0x29')](_0x2a4d40)){logger[_0xa94d('0xe')]('Getting\x20agent\x20with\x20name',_0x2a4d40);return request({'form':{'method':_0xa94d('0x2a'),'input_type':_0xa94d('0x22'),'response_type':_0xa94d('0x22'),'rest_data':JSON[_0xa94d('0x23')]({'session':_0x2a1bab['id'],'module_name':_0xa94d('0x2b'),'query':util['format'](_0xa94d('0x2c'),_0x2a4d40),'order_by':'','offset':'0','select_fields':['id','name','user_name'],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0xa94d('0x2d')](function(_0x2662fc){if(_0x2662fc[_0xa94d('0x2e')]['length']){var _0xff15ee=_[_0xa94d('0x2f')](_0x2662fc['entry_list'],function(_0x1913ae){return _0x1913ae[_0xa94d('0x30')][_0xa94d('0x31')][_0xa94d('0x32')]===_0x2a4d40;});if(_0xff15ee){logger[_0xa94d('0xe')](_0xa94d('0x33'));return BPromise['resolve']({'id':_0xff15ee[_0xa94d('0x30')]['id'][_0xa94d('0x32')],'name':_0xff15ee[_0xa94d('0x30')][_0xa94d('0xf')][_0xa94d('0x32')]});}}logger['info']('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise['resolve']({'id':_0x2a1bab[_0xa94d('0x30')][_0xa94d('0x34')]['value'],'name':_0x2a1bab['name_value_list'][_0xa94d('0x31')][_0xa94d('0x32')]});});}else{logger[_0xa94d('0xe')](_0xa94d('0x35'));return BPromise['resolve']({'id':_0x2a1bab[_0xa94d('0x30')][_0xa94d('0x34')][_0xa94d('0x32')],'name':_0x2a1bab[_0xa94d('0x30')][_0xa94d('0x31')][_0xa94d('0x32')]});}}function getEndUser(_0x131bf4,_0x54c207,_0x429e6c,_0x4e39c5){logger[_0xa94d('0xe')](_0xa94d('0x36'),_0x429e6c);return request({'form':{'method':_0xa94d('0x2a'),'input_type':_0xa94d('0x22'),'response_type':'JSON','rest_data':JSON[_0xa94d('0x23')]({'session':_0x4e39c5['id'],'module_name':_0xa94d('0x1b'),'query':util['format'](_0xa94d('0x37'),_0x429e6c),'order_by':'','offset':'0','select_fields':['id',_0xa94d('0xf'),'phone_home'],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0xa94d('0x2d')](function(_0x5f290c){if(_0x5f290c[_0xa94d('0x2e')]['length']){var _0x356ba9=_['find'](_0x5f290c[_0xa94d('0x2e')],function(_0x223454){return _0x223454[_0xa94d('0x30')][_0xa94d('0x38')][_0xa94d('0x32')]===_0x429e6c;});if(_0x356ba9){logger[_0xa94d('0xe')](_0xa94d('0x39'));return BPromise[_0xa94d('0x3a')]({'id':_0x356ba9['name_value_list']['id'][_0xa94d('0x32')],'name':_0x356ba9[_0xa94d('0x30')][_0xa94d('0xf')][_0xa94d('0x32')],'phone':_0x356ba9[_0xa94d('0x30')]['phone_home'][_0xa94d('0x32')]});}}else{logger['info'](_0xa94d('0x3b'));return request({'form':{'method':_0xa94d('0x3c'),'input_type':_0xa94d('0x22'),'response_type':'JSON','rest_data':JSON[_0xa94d('0x23')]({'session':_0x4e39c5['id'],'module_name':_0xa94d('0x1b'),'name_value_list':[{'name':_0xa94d('0x3d'),'value':_0x54c207!==_0xa94d('0x3e')?_0x54c207:util[_0xa94d('0x25')](_0xa94d('0x3f'),_0x429e6c)},{'name':'phone_home','value':_0x429e6c}]})}})[_0xa94d('0x2d')](function(_0x119c72){logger[_0xa94d('0xe')](_0xa94d('0x40'));return BPromise[_0xa94d('0x3a')]({'id':_0x119c72['id'],'name':_0x119c72[_0xa94d('0x2e')][_0xa94d('0x3d')][_0xa94d('0x32')],'phone':_0x119c72[_0xa94d('0x2e')]['phone_home'][_0xa94d('0x32')]});});}});}function request(_0xb3f3bc){logger[_0xa94d('0x41')](_0xa94d('0x42'),JSON[_0xa94d('0x23')](_0xb3f3bc));return rp(_[_0xa94d('0x43')](def,_0xb3f3bc));}function getTags(_0x539f22,_0x37d4e0){var _0x20eb51=[];if(_0x539f22&&_0x539f22[_0xa94d('0x1d')]>0x0){_0x20eb51=_[_0xa94d('0x44')](_0x539f22,_0x37d4e0);}return _0x20eb51;}function getCustomFields(_0x2afd3d,_0x93cb8){var _0x64b821=[];var _0x42ce27={'custom_fields':[]};if(_0x2afd3d[_0xa94d('0x1d')]>0x0){_[_0xa94d('0x1e')](_0x2afd3d,function(_0x765e64){if(_0x765e64[_0xa94d('0x45')]===_0xa94d('0x46')&&_0x765e64['nameField']&&!_0x765e64['customField']){_0x42ce27[_0x765e64['nameField'][_0xa94d('0x47')]()]=_0x765e64[_0xa94d('0x48')]['toString']();}else if(_0x765e64[_0xa94d('0x45')]==='string'&&_0x765e64[_0xa94d('0x21')]&&_0x765e64['customField']){_0x42ce27[_0xa94d('0x49')][_0xa94d('0x20')]({'id':_0x765e64[_0xa94d('0x21')],'value':_0x765e64[_0xa94d('0x48')][_0xa94d('0x27')]()});}else if(_0x765e64[_0xa94d('0x45')]===_0xa94d('0x4a')&&_0x765e64[_0xa94d('0x1f')]&&_0x765e64['idField']&&_0x765e64[_0xa94d('0x4b')]){_0x93cb8[_0x765e64['variableName']]&&_0x42ce27[_0xa94d('0x49')][_0xa94d('0x20')]({'id':_0x765e64[_0xa94d('0x21')],'value':_0x93cb8[_0x765e64[_0xa94d('0x1f')]][_0xa94d('0x27')]()});}else if(_0x765e64['type']===_0xa94d('0x4c')&&_0x765e64[_0xa94d('0x4d')]&&_0x765e64[_0xa94d('0x4d')]['name']&&_0x765e64['idField']&&_0x765e64['customField']){_0x93cb8[_0x765e64[_0xa94d('0x4d')][_0xa94d('0xf')][_0xa94d('0x47')]()]&&_0x42ce27[_0xa94d('0x49')]['push']({'id':_0x765e64[_0xa94d('0x21')],'value':_0x93cb8[_0x765e64[_0xa94d('0x4d')][_0xa94d('0xf')][_0xa94d('0x47')]()][_0xa94d('0x27')]()});}});}return _0x42ce27;}function getConnection(_0x25ab58){return request({'method':_0xa94d('0xc'),'form':{'method':_0xa94d('0x4e'),'input_type':'JSON','response_type':_0xa94d('0x22'),'rest_data':JSON[_0xa94d('0x23')]({'user_auth':{'user_name':_0x25ab58[_0xa94d('0x4f')],'password':_0x25ab58[_0xa94d('0x50')],'encryption':_0xa94d('0x51')},'application':'xCALLY\x20Motion\x20integration'})}})[_0xa94d('0x2d')](function(_0x18d2a8){var _0x3106be=_0x18d2a8;if(_0x3106be['id']){def['sessionID']=_0x3106be['id'];return BPromise[_0xa94d('0x3a')](_0x3106be);}else{throw new Error(util[_0xa94d('0x25')](_0xa94d('0x52'),_0x25ab58['id']));}});}function setRelationship(_0x13b2c9,_0x51f2c9,_0x2283c3,_0x335e03){return request({'form':{'method':_0xa94d('0x53'),'input_type':_0xa94d('0x22'),'response_type':_0xa94d('0x22'),'rest_data':JSON[_0xa94d('0x23')]({'session':_0x13b2c9['id'],'module_name':'Calls','module_id':_0x2283c3['id'],'link_field_name':_0x335e03,'related_ids':[_0x51f2c9['id']],'name_value_list':[],'delete':0x0})}});}exports[_0xa94d('0x54')]=function(_0x2e5223,_0x37be37,_0x402d19,_0x218d6f,_0x4afe29,_0x248e98){var _0x5f4c2e,_0x4a476c,_0x371b74,_0x3042b0;_0x248e98['remoteUri']=intUtil[_0xa94d('0x55')](_0x248e98[_0xa94d('0x56')]);_0x248e98[_0xa94d('0x57')]=intUtil[_0xa94d('0x55')](_0x248e98['serverUrl']);def['uri']=util['format'](_0xa94d('0x58'),_0x248e98[_0xa94d('0x56')]);if(_0x4afe29&&_0x4afe29[_0xa94d('0x59')]){logger[_0xa94d('0xe')](_0xa94d('0x5a'),_0xa94d('0x5b'));_0x37be37['recordingURL']=util[_0xa94d('0x25')](_0xa94d('0x5c'),_0x248e98[_0xa94d('0x57')],_0x37be37['uniqueid'],md5(_0x37be37['uniqueid']));}else{_0x37be37['recordingURL']='';}return getConnection(_0x248e98)[_0xa94d('0x2d')](function(_0x379a36){_0x3042b0=_0x379a36;return getUser(_0x248e98,_0x218d6f[_0xa94d('0xf')],_0x3042b0);})[_0xa94d('0x2d')](function(_0x383191){_0x5f4c2e=_0x383191;logger[_0xa94d('0xe')](_0xa94d('0x5d'),_0x5f4c2e['id']);return getEndUser(_0x248e98,_0x37be37['calleridname'],_0x37be37[_0xa94d('0x5e')],_0x3042b0);})[_0xa94d('0x2d')](function(_0x55e10f){_0x4a476c=_0x55e10f;logger[_0xa94d('0xe')](_0xa94d('0x5f'),_0x4a476c['id']);return getTicket(_0x248e98,_0x5f4c2e,_0x4a476c,_0x402d19,_0x37be37,_0x402d19[_0xa94d('0x60')],_0x3042b0,_0xa94d('0x61'));})['then'](function(_0x3c6e77){_0x371b74=_0x3c6e77;logger['info'](_0xa94d('0x62'));logger[_0xa94d('0xe')](_0xa94d('0x63'),_0x371b74['id']);return setRelationship(_0x3042b0,_0x5f4c2e,_0x371b74,_0xa94d('0x64'));})[_0xa94d('0x2d')](function(){return setRelationship(_0x3042b0,_0x4a476c,_0x371b74,_0xa94d('0x65'));})[_0xa94d('0x2d')](function(){return getServerInfo(_0x3042b0);})['then'](function(_0xc9c9d7){var _0x3ae6fd=parseInt(_0xc9c9d7[_0xa94d('0x66')][_0xa94d('0x67')](0x0));var _0x3c80ca=util['format'](_0xa94d('0x68'),_0x248e98[_0xa94d('0x56')],_0x371b74['id']);if(_0x3ae6fd>0x6){_0x3c80ca=util[_0xa94d('0x25')](_0xa94d('0x69'),_0x248e98[_0xa94d('0x56')],_0x371b74['id']);}logger[_0xa94d('0xe')](_0xa94d('0x5a'),_0xa94d('0x6a'));emit(util[_0xa94d('0x25')](_0xa94d('0x6b'),_0x218d6f[_0xa94d('0xf')]),_0xa94d('0x6c'),{'uri':_0x3c80ca});})['catch'](function(_0x3e550c){logger[_0xa94d('0x6d')](_0xa94d('0x5a'),JSON['stringify'](_0x3e550c));});};exports[_0xa94d('0x6e')]=function(_0x49fd84,_0x1f2437,_0x5815ff,_0x2f20e5,_0x44fe1c,_0x3e5f8f,_0x4a12d5){var _0xdf2a9,_0x521bc2,_0x21c3ae,_0x469b09;_0x3e5f8f[_0xa94d('0x56')]=intUtil['stripTrailingSlash'](_0x3e5f8f[_0xa94d('0x56')]);_0x3e5f8f['serverUrl']=intUtil[_0xa94d('0x55')](_0x3e5f8f[_0xa94d('0x57')]);def['uri']=util[_0xa94d('0x25')](_0xa94d('0x58'),_0x3e5f8f[_0xa94d('0x56')]);if(_0x4a12d5&&_0x4a12d5[_0xa94d('0x6f')]&&_0x4a12d5['recordingFormat']!=='none'){logger[_0xa94d('0xe')](_0xa94d('0x70'),'Recording\x20is\x20enabled!');_0x1f2437['recordingURL']=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x3e5f8f['serverUrl'],_0x1f2437['uniqueid'],md5(_0x1f2437[_0xa94d('0x71')]));}return getConnection(_0x3e5f8f)[_0xa94d('0x2d')](function(_0xc006ad){_0x469b09=_0xc006ad;return getUser(_0x3e5f8f,_0x2f20e5[_0xa94d('0xf')],_0x469b09);})['then'](function(_0x322957){_0xdf2a9=_0x322957;logger[_0xa94d('0xe')](_0xa94d('0x5d'),_0xdf2a9['id']);return getEndUser(_0x3e5f8f,_0x1f2437[_0xa94d('0x72')],_0x1f2437[_0xa94d('0x73')],_0x469b09);})['then'](function(_0x1be6a7){_0x521bc2=_0x1be6a7;logger[_0xa94d('0xe')]('The\x20Enduser\x20ID\x20is:',_0x521bc2['id']);return getTicket(_0x3e5f8f,_0xdf2a9,_0x521bc2,_0x5815ff,_0x1f2437,_0x5815ff['Fields'],_0x469b09,_0xa94d('0x74'));})['then'](function(_0x511d6){_0x21c3ae=_0x511d6;logger[_0xa94d('0xe')](_0xa94d('0x62'));logger[_0xa94d('0xe')]('The\x20Ticket\x20ID\x20is:',_0x21c3ae['id']);return setRelationship(_0x469b09,_0xdf2a9,_0x21c3ae,_0xa94d('0x64'));})[_0xa94d('0x2d')](function(){return setRelationship(_0x469b09,_0x521bc2,_0x21c3ae,'contacts');})[_0xa94d('0x2d')](function(){return getServerInfo(_0x469b09);})[_0xa94d('0x2d')](function(_0x401368){var _0x51811d=parseInt(_0x401368[_0xa94d('0x66')][_0xa94d('0x67')](0x0));var _0x706597=util['format'](_0xa94d('0x68'),_0x3e5f8f['remoteUri'],_0x21c3ae['id']);if(_0x51811d>0x6){_0x706597=util[_0xa94d('0x25')](_0xa94d('0x69'),_0x3e5f8f[_0xa94d('0x56')],_0x21c3ae['id']);}logger['info'](_0xa94d('0x70'),_0xa94d('0x6a'));emit(util[_0xa94d('0x25')](_0xa94d('0x6b'),_0x2f20e5[_0xa94d('0xf')]),'trigger:browser:url',{'uri':_0x706597});})[_0xa94d('0x75')](function(_0x21efb9){logger['error']('[OUTBOUND]',JSON[_0xa94d('0x23')](_0x21efb9));});};exports[_0xa94d('0x76')]=function(_0xe2f15c,_0x596d5,_0x3ad57a,_0x5984e7,_0x2d12d9,_0x5d79ec){var _0x2215db,_0x14731e,_0x339bf8,_0x45fbf5;_0x5d79ec[_0xa94d('0x56')]=intUtil[_0xa94d('0x55')](_0x5d79ec[_0xa94d('0x56')]);_0x5d79ec['serverUrl']=intUtil[_0xa94d('0x55')](_0x5d79ec['serverUrl']);def[_0xa94d('0x77')]=util['format'](_0xa94d('0x58'),_0x5d79ec['remoteUri']);if(_0x2d12d9&&_0x2d12d9[_0xa94d('0x59')]){logger['info']('['+_0x596d5[_0xa94d('0x78')][_0xa94d('0x79')]()+']','Recording\x20is\x20enabled!');_0x596d5[_0xa94d('0x7a')]=util[_0xa94d('0x25')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x5d79ec[_0xa94d('0x57')],_0x596d5[_0xa94d('0x71')],md5(_0x596d5[_0xa94d('0x71')]));}else{_0x596d5[_0xa94d('0x7a')]='';}return getConnection(_0x5d79ec)[_0xa94d('0x2d')](function(_0x3cde7e){_0x45fbf5=_0x3cde7e;if(!_[_0xa94d('0x29')](_0x5984e7)){return getUser(_0x5d79ec,_0x5984e7[_0xa94d('0xf')],_0x45fbf5);}else{return getUser(_0x5d79ec,null,_0x45fbf5);}})[_0xa94d('0x2d')](function(_0x40fe91){_0x2215db=_0x40fe91;logger[_0xa94d('0xe')]('The\x20User\x20ID\x20is:',_0x2215db['id']);return getEndUser(_0x5d79ec,_0x596d5[_0xa94d('0x7b')],_0x596d5[_0xa94d('0x5e')],_0x45fbf5);})[_0xa94d('0x2d')](function(_0x2c417f){_0x14731e=_0x2c417f;logger['info'](_0xa94d('0x5f'),_0x14731e['id']);return getTicket(_0x5d79ec,_0x2215db,_0x14731e,_0x3ad57a,_0x596d5,_0x3ad57a[_0xa94d('0x60')],_0x45fbf5,_0xa94d('0x61'));})[_0xa94d('0x2d')](function(_0x570ae1){_0x339bf8=_0x570ae1;logger[_0xa94d('0xe')]('Ticket\x20created!');logger[_0xa94d('0xe')](_0xa94d('0x63'),_0x339bf8['id']);return setRelationship(_0x45fbf5,_0x2215db,_0x339bf8,_0xa94d('0x64'));})[_0xa94d('0x2d')](function(){return setRelationship(_0x45fbf5,_0x14731e,_0x339bf8,_0xa94d('0x65'));})[_0xa94d('0x2d')](function(){return getServerInfo(_0x45fbf5);})[_0xa94d('0x75')](function(_0x4c4399){logger[_0xa94d('0x6d')]('['+_0x596d5[_0xa94d('0x78')][_0xa94d('0x79')]()+']',JSON[_0xa94d('0x23')](_0x4c4399));});}; \ 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 967ff0d..52b7299 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 _0x7ec4=['format','%s:\x20%s','join','stripTrailingSlash','slice','substring','lastIndexOf','validateEmail','isNil','test','lodash','util','getString','length','sortBy','type','string','push','content','variable','variableName','toString','customVariable','name','Variable','toLowerCase','keyType','key'];(function(_0x45addf,_0x562443){var _0x5124d9=function(_0x315190){while(--_0x315190){_0x45addf['push'](_0x45addf['shift']());}};_0x5124d9(++_0x562443);}(_0x7ec4,0x15a));var _0x47ec=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x7ec4[_0x17d9e3];return _0x14192d;};'use strict';var _=require(_0x47ec('0x0'));var util=require(_0x47ec('0x1'));exports[_0x47ec('0x2')]=function(_0x5cb8d0,_0x5cfd06,_0x185e3b){var _0x53920a=[];if(_0x5cb8d0[_0x47ec('0x3')]>0x0){var _0x3fcd5c=_[_0x47ec('0x4')](_0x5cb8d0,['id']);for(var _0x1ddae0=0x0;_0x1ddae0<_0x3fcd5c[_0x47ec('0x3')];_0x1ddae0++){var _0x4f6970=_0x3fcd5c[_0x1ddae0];if(_0x4f6970[_0x47ec('0x5')]===_0x47ec('0x6')){_0x53920a[_0x47ec('0x7')](_0x4f6970[_0x47ec('0x8')]);}else if(_0x4f6970[_0x47ec('0x5')]===_0x47ec('0x9')&&_0x4f6970[_0x47ec('0xa')]){_0x5cfd06[_0x4f6970[_0x47ec('0xa')]]&&_0x53920a['push'](_0x5cfd06[_0x4f6970[_0x47ec('0xa')]][_0x47ec('0xb')]());}else if(_0x4f6970[_0x47ec('0x5')]===_0x47ec('0xc')&&_0x4f6970['Variable']&&_0x4f6970['Variable'][_0x47ec('0xd')]){_0x5cfd06[_0x4f6970[_0x47ec('0xe')][_0x47ec('0xd')][_0x47ec('0xf')]()]&&_0x53920a[_0x47ec('0x7')](_0x5cfd06[_0x4f6970[_0x47ec('0xe')][_0x47ec('0xd')][_0x47ec('0xf')]()][_0x47ec('0xb')]());}else if(_0x4f6970[_0x47ec('0x5')]==='keyValue'){if(_0x4f6970[_0x47ec('0x10')]===_0x47ec('0x6')&&_0x4f6970[_0x47ec('0x11')]){_0x53920a[_0x47ec('0x7')](util[_0x47ec('0x12')]('%s:\x20%s',_0x4f6970[_0x47ec('0x11')],_0x4f6970['keyContent']));}else if(_0x4f6970[_0x47ec('0x10')]==='variable'&&_0x4f6970[_0x47ec('0xa')]&&_0x4f6970[_0x47ec('0x11')]){_0x5cfd06[_0x4f6970[_0x47ec('0xa')]]&&_0x53920a[_0x47ec('0x7')](util[_0x47ec('0x12')](_0x47ec('0x13'),_0x4f6970['key'],_0x5cfd06[_0x4f6970[_0x47ec('0xa')]]));}else if(_0x4f6970[_0x47ec('0x10')]===_0x47ec('0xc')&&_0x4f6970['Variable']&&_0x4f6970[_0x47ec('0xe')][_0x47ec('0xd')]&&_0x4f6970[_0x47ec('0x11')]){_0x5cfd06[_0x4f6970[_0x47ec('0xe')][_0x47ec('0xd')][_0x47ec('0xf')]()]&&_0x53920a[_0x47ec('0x7')](util[_0x47ec('0x12')](_0x47ec('0x13'),_0x4f6970['key'],_0x5cfd06[_0x4f6970[_0x47ec('0xe')]['name'][_0x47ec('0xf')]()]));}}}}return _0x53920a[_0x47ec('0x14')](_0x185e3b);};exports[_0x47ec('0x15')]=function(_0x13a4f8){var _0x997933=_0x13a4f8[_0x47ec('0x16')](-0x1);if(_0x997933==='/'){_0x13a4f8=_0x13a4f8[_0x47ec('0x17')](0x0,_0x13a4f8[_0x47ec('0x18')](_0x997933));}return _0x13a4f8;};exports[_0x47ec('0x19')]=function(_0x11c9eb){if(!_[_0x47ec('0x1a')](_0x11c9eb)&&_0x11c9eb!==''){var _0x2ef941=/^(([^<>()\[\]\\.,;:\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 _0x2ef941[_0x47ec('0x1b')](String(_0x11c9eb)[_0x47ec('0xf')]());}else{return![];}}; \ No newline at end of file +var _0xfeae=['%s:\x20%s','keyContent','customVariable','join','stripTrailingSlash','slice','substring','isNil','test','lodash','util','getString','sortBy','length','type','string','push','variable','variableName','Variable','name','toLowerCase','toString','keyValue','keyType','key','format'];(function(_0x269e00,_0x5ed8d3){var _0x47e11a=function(_0x5c5a27){while(--_0x5c5a27){_0x269e00['push'](_0x269e00['shift']());}};_0x47e11a(++_0x5ed8d3);}(_0xfeae,0x132));var _0xefea=function(_0x20e4ac,_0x5f52c2){_0x20e4ac=_0x20e4ac-0x0;var _0x1548ce=_0xfeae[_0x20e4ac];return _0x1548ce;};'use strict';var _=require(_0xefea('0x0'));var util=require(_0xefea('0x1'));exports[_0xefea('0x2')]=function(_0x1899c6,_0x4dd396,_0x36f0b0){var _0x9e3197=[];if(_0x1899c6['length']>0x0){var _0x17c87f=_[_0xefea('0x3')](_0x1899c6,['id']);for(var _0x3a4f1c=0x0;_0x3a4f1c<_0x17c87f[_0xefea('0x4')];_0x3a4f1c++){var _0x5bd5b2=_0x17c87f[_0x3a4f1c];if(_0x5bd5b2[_0xefea('0x5')]===_0xefea('0x6')){_0x9e3197[_0xefea('0x7')](_0x5bd5b2['content']);}else if(_0x5bd5b2[_0xefea('0x5')]===_0xefea('0x8')&&_0x5bd5b2[_0xefea('0x9')]){_0x4dd396[_0x5bd5b2[_0xefea('0x9')]]&&_0x9e3197['push'](_0x4dd396[_0x5bd5b2[_0xefea('0x9')]]['toString']());}else if(_0x5bd5b2[_0xefea('0x5')]==='customVariable'&&_0x5bd5b2[_0xefea('0xa')]&&_0x5bd5b2[_0xefea('0xa')]['name']){_0x4dd396[_0x5bd5b2['Variable'][_0xefea('0xb')][_0xefea('0xc')]()]&&_0x9e3197[_0xefea('0x7')](_0x4dd396[_0x5bd5b2[_0xefea('0xa')][_0xefea('0xb')][_0xefea('0xc')]()][_0xefea('0xd')]());}else if(_0x5bd5b2['type']===_0xefea('0xe')){if(_0x5bd5b2[_0xefea('0xf')]===_0xefea('0x6')&&_0x5bd5b2[_0xefea('0x10')]){_0x9e3197[_0xefea('0x7')](util[_0xefea('0x11')](_0xefea('0x12'),_0x5bd5b2[_0xefea('0x10')],_0x5bd5b2[_0xefea('0x13')]));}else if(_0x5bd5b2['keyType']===_0xefea('0x8')&&_0x5bd5b2['variableName']&&_0x5bd5b2[_0xefea('0x10')]){_0x4dd396[_0x5bd5b2[_0xefea('0x9')]]&&_0x9e3197[_0xefea('0x7')](util[_0xefea('0x11')]('%s:\x20%s',_0x5bd5b2[_0xefea('0x10')],_0x4dd396[_0x5bd5b2['variableName']]));}else if(_0x5bd5b2[_0xefea('0xf')]===_0xefea('0x14')&&_0x5bd5b2[_0xefea('0xa')]&&_0x5bd5b2[_0xefea('0xa')][_0xefea('0xb')]&&_0x5bd5b2[_0xefea('0x10')]){_0x4dd396[_0x5bd5b2[_0xefea('0xa')][_0xefea('0xb')][_0xefea('0xc')]()]&&_0x9e3197['push'](util[_0xefea('0x11')](_0xefea('0x12'),_0x5bd5b2['key'],_0x4dd396[_0x5bd5b2['Variable'][_0xefea('0xb')]['toLowerCase']()]));}}}}return _0x9e3197[_0xefea('0x15')](_0x36f0b0);};exports[_0xefea('0x16')]=function(_0x1905b2){var _0x26e84b=_0x1905b2[_0xefea('0x17')](-0x1);if(_0x26e84b==='/'){_0x1905b2=_0x1905b2[_0xefea('0x18')](0x0,_0x1905b2['lastIndexOf'](_0x26e84b));}return _0x1905b2;};exports['validateEmail']=function(_0x5b4edf){if(!_[_0xefea('0x19')](_0x5b4edf)&&_0x5b4edf!==''){var _0x50a1a3=/^(([^<>()\[\]\\.,;:\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 _0x50a1a3[_0xefea('0x1a')](String(_0x5b4edf)['toLowerCase']());}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 dbbda7b..9064fcf 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 _0xd8b0=['info','Creating\x20new\x20ticket...','merge','Normal','Subjects','POST','format','%s/webservice.php','remoteUri','create','username','sessionName','HelpDesk','stringify','success','result','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','error','statusCode','[vTiger],\x20%s,\x20%s,\x20%s','validateEmail','Getting\x20agent\x20with\x20email','then','Agent\x20found!','resolve','email1','first_name','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','admin','catch','userId','getUser','Searching\x20end\x20user\x20with\x20phone','GET','query','Enduser\x20found!','firstname','Enduser\x20created.','lastname','phone','accessKey','getchallenge','login','token','getConnection','stripTrailingSlash','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','recordingURL','email','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','Ticket\x20created!','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','split','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','outbound','recordingFormat','none','[OUTBOUND]','uniqueid','The\x20User\x20ID\x20is:','destcalleridname','destcalleridnum','The\x20Ticket\x20ID\x20is:','user:%s','lastevent','toUpperCase','lodash','request-promise','ioredis','./util','../../../../config/environment','../../../../config/logger','vTiger','redis','localhost','socket.io-emitter','emit','length','forEach','includes','picklist','idField','content','toString','type','variable','variableName','customVariable','Variable','name','toLowerCase'];(function(_0x5cc3d4,_0xbcbf9b){var _0x17ca31=function(_0x5dbd6d){while(--_0x5dbd6d){_0x5cc3d4['push'](_0x5cc3d4['shift']());}};_0x17ca31(++_0xbcbf9b);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0x0d8b('0x0'));var rp=require(_0x0d8b('0x1'));var BPromise=require('bluebird');var md5=require('md5');var util=require('util');var Redis=require(_0x0d8b('0x2'));var intUtil=require(_0x0d8b('0x3'));var config=require(_0x0d8b('0x4'));var logger=require(_0x0d8b('0x5'))(_0x0d8b('0x6'));config['redis']=_['defaults'](config[_0x0d8b('0x7')],{'host':_0x0d8b('0x8'),'port':0x18eb});var io=require(_0x0d8b('0x9'))(new Redis(config['redis']));function emit(_0x413284,_0x284169,_0x58e4e2){io['to'](_0x413284)[_0x0d8b('0xa')](_0x284169,_0x58e4e2);}function getCustomFields(_0x348e65,_0x3b027f){var _0x1f4800={};if(_0x348e65[_0x0d8b('0xb')]>0x0){_[_0x0d8b('0xc')](_0x348e65,function(_0x2c5e9e){if(_[_0x0d8b('0xd')](['string',_0x0d8b('0xe')],_0x2c5e9e['type'])&&_0x2c5e9e[_0x0d8b('0xf')]){_0x1f4800[_0x2c5e9e[_0x0d8b('0xf')]]=_0x2c5e9e[_0x0d8b('0x10')][_0x0d8b('0x11')]();}else if(_0x2c5e9e[_0x0d8b('0x12')]===_0x0d8b('0x13')&&_0x2c5e9e[_0x0d8b('0x14')]&&_0x2c5e9e[_0x0d8b('0xf')]&&_0x3b027f[_0x2c5e9e[_0x0d8b('0x14')]]){_0x1f4800[_0x2c5e9e[_0x0d8b('0xf')]]=_0x3b027f[_0x2c5e9e[_0x0d8b('0x14')]][_0x0d8b('0x11')]();}else if(_0x2c5e9e[_0x0d8b('0x12')]===_0x0d8b('0x15')&&_0x2c5e9e['Variable']&&_0x2c5e9e[_0x0d8b('0x16')][_0x0d8b('0x17')]&&_0x2c5e9e[_0x0d8b('0xf')]&&_0x3b027f[_0x2c5e9e[_0x0d8b('0x16')][_0x0d8b('0x17')]['toLowerCase']()]){_0x1f4800[_0x2c5e9e[_0x0d8b('0xf')]]=_0x3b027f[_0x2c5e9e[_0x0d8b('0x16')][_0x0d8b('0x17')][_0x0d8b('0x18')]()][_0x0d8b('0x11')]();}});}return _0x1f4800;}function createTicket(_0x18dd2d,_0x264b39,_0xa3612a,_0x4a15bf,_0x27512e,_0x23d58f,_0x196c0a){logger[_0x0d8b('0x19')](_0x0d8b('0x1a'));var _0x5b709c=_[_0x0d8b('0x1b')]({'parent_id':'','assigned_user_id':_0x264b39['id'],'ticketpriorities':_0x0d8b('0x1c'),'ticketstatus':'Open','ticket_title':intUtil['getString'](_0x4a15bf[_0x0d8b('0x1d')],_0x27512e,'\x20'),'description':intUtil['getString'](_0x4a15bf['Descriptions'],_0x27512e,'\x0a'),'contact_id':_0xa3612a['id']},getCustomFields(_0x23d58f,_0x27512e));var _0x5527d8={'method':_0x0d8b('0x1e'),'uri':util[_0x0d8b('0x1f')](_0x0d8b('0x20'),_0x18dd2d[_0x0d8b('0x21')]),'form':{'operation':_0x0d8b('0x22'),'username':_0x18dd2d[_0x0d8b('0x23')],'sessionName':_0x196c0a[_0x0d8b('0x24')],'elementType':_0x0d8b('0x25'),'element':JSON[_0x0d8b('0x26')](_0x5b709c)},'json':!![]};return request(_0x5527d8)['then'](function(_0xe8bbee){if(_0xe8bbee[_0x0d8b('0x27')]){return BPromise['resolve']({'id':_0xe8bbee[_0x0d8b('0x28')]['id']});}else{throw new Error(util['format'](_0x0d8b('0x29'),JSON[_0x0d8b('0x26')](_0xe8bbee[_0x0d8b('0x2a')])));}})['catch'](function(_0x59a905){var _0x28f639=_0x59a905[_0x0d8b('0x2b')]||0x1f4;logger['error'](_0x0d8b('0x2c'),'createTicket',_0x28f639,JSON[_0x0d8b('0x26')](_0x59a905));});}function getUser(_0x4b59e5,_0x97050a,_0x48f24f){if(intUtil[_0x0d8b('0x2d')](_0x97050a)){logger['info'](_0x0d8b('0x2e'),_0x97050a);return request({'method':'GET','uri':util[_0x0d8b('0x1f')](_0x0d8b('0x20'),_0x4b59e5[_0x0d8b('0x21')]),'qs':{'operation':'query','username':_0x4b59e5['username'],'sessionName':_0x48f24f['sessionName'],'query':util[_0x0d8b('0x1f')]('SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;',_0x97050a)},'json':!![]})[_0x0d8b('0x2f')](function(_0x54f6f3){if(_0x54f6f3['success']&&_0x54f6f3[_0x0d8b('0x28')][_0x0d8b('0xb')]){logger[_0x0d8b('0x19')](_0x0d8b('0x30'));return BPromise[_0x0d8b('0x31')]({'id':_0x54f6f3[_0x0d8b('0x28')][0x0]['id'],'email':_0x54f6f3[_0x0d8b('0x28')][0x0][_0x0d8b('0x32')],'name':_0x54f6f3['result'][0x0][_0x0d8b('0x33')]+'\x20'+_0x54f6f3[_0x0d8b('0x28')]['last_name']});}else{logger[_0x0d8b('0x19')](_0x0d8b('0x34'));return BPromise[_0x0d8b('0x31')]({'id':_0x48f24f['userId'],'email':_0x4b59e5[_0x0d8b('0x23')],'name':_0x0d8b('0x35')});}})[_0x0d8b('0x36')](function(_0x31ceba){var _0x933e01=_0x31ceba['statusCode']||0x1f4;logger[_0x0d8b('0x2a')](_0x0d8b('0x2c'),'getUser',_0x933e01,JSON[_0x0d8b('0x26')](_0x31ceba));});}else{logger[_0x0d8b('0x19')](_0x0d8b('0x34'));return BPromise[_0x0d8b('0x31')]({'id':_0x48f24f[_0x0d8b('0x37')],'email':_0x4b59e5['username'],'name':'admin'})[_0x0d8b('0x36')](function(_0x5c2c04){var _0x531c55=_0x5c2c04[_0x0d8b('0x2b')]||0x1f4;logger[_0x0d8b('0x2a')](_0x0d8b('0x2c'),_0x0d8b('0x38'),_0x531c55,JSON[_0x0d8b('0x26')](_0x5c2c04));});}}function getEndUser(_0x24c789,_0x579324,_0x6e5bab,_0x6a02ad){logger[_0x0d8b('0x19')](_0x0d8b('0x39'),_0x6e5bab);return request({'method':_0x0d8b('0x3a'),'uri':util[_0x0d8b('0x1f')](_0x0d8b('0x20'),_0x24c789['remoteUri']),'qs':{'operation':_0x0d8b('0x3b'),'username':_0x24c789[_0x0d8b('0x23')],'sessionName':_0x6a02ad[_0x0d8b('0x24')],'query':util[_0x0d8b('0x1f')]('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;',_0x6e5bab,_0x6e5bab,_0x6e5bab,_0x6e5bab,_0x6e5bab)},'json':!![]})[_0x0d8b('0x2f')](function(_0x4b4bde){if(_0x4b4bde[_0x0d8b('0x27')]&&_0x4b4bde[_0x0d8b('0x28')][_0x0d8b('0xb')]){logger[_0x0d8b('0x19')](_0x0d8b('0x3c'));return BPromise[_0x0d8b('0x31')]({'id':_0x4b4bde[_0x0d8b('0x28')][0x0]['id'],'name':_0x4b4bde[_0x0d8b('0x28')][0x0][_0x0d8b('0x3d')]+'\x20'+_0x4b4bde[_0x0d8b('0x28')][0x0]['lastname'],'phone':_0x6e5bab});}else{logger['info']('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'method':'POST','uri':util['format'](_0x0d8b('0x20'),_0x24c789[_0x0d8b('0x21')]),'form':{'operation':_0x0d8b('0x22'),'sessionName':_0x6a02ad['sessionName'],'elementType':'Contacts','element':JSON[_0x0d8b('0x26')]({'lastname':_0x579324,'phone':_0x6e5bab,'assigned_user_id':'\x20'})},'json':!![]})[_0x0d8b('0x2f')](function(_0x344278){logger['info'](_0x0d8b('0x3e'));return BPromise[_0x0d8b('0x31')]({'id':_0x344278['result']['id'],'name':_0x344278['result'][_0x0d8b('0x3f')],'phone':_0x344278['result'][_0x0d8b('0x40')]});})['catch'](function(_0x53f643){var _0x30ccee=_0x53f643[_0x0d8b('0x2b')]||0x1f4;logger['error']('[vTiger],\x20%s,\x20%s,\x20%s','getEndUser',_0x30ccee,JSON['stringify'](_0x53f643));});}});}function getConnection(_0x374d40){var _0x1e0498=_0x374d40[_0x0d8b('0x23')];var _0x490eda=_0x374d40[_0x0d8b('0x41')];return request({'method':_0x0d8b('0x3a'),'uri':util[_0x0d8b('0x1f')](_0x0d8b('0x20'),_0x374d40[_0x0d8b('0x21')]),'qs':{'operation':_0x0d8b('0x42'),'username':_0x1e0498},'json':!![]})[_0x0d8b('0x2f')](function(_0x1d5067){if(_0x1d5067[_0x0d8b('0x27')]){return request({'method':_0x0d8b('0x1e'),'uri':util[_0x0d8b('0x1f')](_0x0d8b('0x20'),_0x374d40[_0x0d8b('0x21')]),'form':{'operation':_0x0d8b('0x43'),'username':_0x1e0498,'accessKey':md5(_0x1d5067[_0x0d8b('0x28')][_0x0d8b('0x44')]+_0x490eda)},'json':!![]});}})[_0x0d8b('0x2f')](function(_0x1e162c){if(_0x1e162c[_0x0d8b('0x27')]){return BPromise['resolve'](_0x1e162c[_0x0d8b('0x28')]);}else{throw new Error(util['format']('Account\x20%d\x20is\x20not\x20valid',_0x374d40['id']));}})[_0x0d8b('0x36')](function(_0x113fb7){var _0x3f943a=_0x113fb7[_0x0d8b('0x2b')]||0x1f4;logger['error'](_0x0d8b('0x2c'),_0x0d8b('0x45'),_0x3f943a,JSON[_0x0d8b('0x26')](_0x113fb7));});}function request(_0x241587){logger[_0x0d8b('0x19')]('[HTTP]',JSON['stringify'](_0x241587));return rp(_0x241587);}exports['queue']=function(_0x573f4f,_0x368ede,_0xf22c3c,_0x5e3bb4,_0x4950a8,_0x44c5c1){var _0x3d3cb6,_0x5c5bd7,_0x5ef6c3,_0x900906;_0x44c5c1[_0x0d8b('0x21')]=intUtil[_0x0d8b('0x46')](_0x44c5c1[_0x0d8b('0x21')]);if(_0x4950a8&&_0x4950a8[_0x0d8b('0x47')]){logger['info'](_0x0d8b('0x48'),_0x0d8b('0x49'));_0x368ede['recordingURL']=util['format'](_0x0d8b('0x4a'),_0x44c5c1[_0x0d8b('0x4b')],_0x368ede['uniqueid'],md5(_0x368ede['uniqueid']));}else{_0x368ede[_0x0d8b('0x4c')]='';}return getConnection(_0x44c5c1)[_0x0d8b('0x2f')](function(_0x377027){_0x900906=_0x377027;return getUser(_0x44c5c1,_0x5e3bb4[_0x0d8b('0x4d')],_0x900906);})['then'](function(_0x356b3d){_0x3d3cb6=_0x356b3d;logger['info']('The\x20User\x20ID\x20is:',_0x3d3cb6['id']);return getEndUser(_0x44c5c1,_0x368ede[_0x0d8b('0x4e')],_0x368ede[_0x0d8b('0x4f')],_0x900906);})['then'](function(_0x4a8f33){_0x5c5bd7=_0x4a8f33;logger[_0x0d8b('0x19')](_0x0d8b('0x50'),_0x5c5bd7['id']);return createTicket(_0x44c5c1,_0x3d3cb6,_0x5c5bd7,_0xf22c3c,_0x368ede,_0xf22c3c[_0x0d8b('0x51')],_0x900906);})[_0x0d8b('0x2f')](function(_0x3afc3a){_0x5ef6c3=_0x3afc3a;logger[_0x0d8b('0x19')](_0x0d8b('0x52'));logger[_0x0d8b('0x19')]('The\x20Ticket\x20ID\x20is:',_0x5ef6c3['id']);var _0x24a859=util[_0x0d8b('0x1f')](_0x0d8b('0x53'),_0x44c5c1[_0x0d8b('0x21')],_[_0x0d8b('0x54')](_0x5ef6c3['id'],'x')[0x1]);logger[_0x0d8b('0x19')](_0x0d8b('0x48'),_0x0d8b('0x55'));emit(util[_0x0d8b('0x1f')]('user:%s',_0x5e3bb4[_0x0d8b('0x17')]),_0x0d8b('0x56'),{'uri':_0x24a859});})[_0x0d8b('0x36')](function(_0x23de9e){logger[_0x0d8b('0x2a')]('[QUEUE]',JSON[_0x0d8b('0x26')](_0x23de9e));});};exports[_0x0d8b('0x57')]=function(_0x181d49,_0x17a87f,_0x1d6cd4,_0x59ada2,_0x4d0e7c,_0x3b1166,_0x291b83){var _0x3e4a41,_0xbbb520,_0x5a70bd,_0x199122;_0x3b1166[_0x0d8b('0x21')]=intUtil[_0x0d8b('0x46')](_0x3b1166['remoteUri']);_0x3b1166[_0x0d8b('0x4b')]=intUtil['stripTrailingSlash'](_0x3b1166[_0x0d8b('0x4b')]);if(_0x291b83&&_0x291b83[_0x0d8b('0x58')]&&_0x291b83[_0x0d8b('0x58')]!==_0x0d8b('0x59')){logger[_0x0d8b('0x19')](_0x0d8b('0x5a'),'Recording\x20is\x20enabled!');_0x17a87f[_0x0d8b('0x4c')]=util['format'](_0x0d8b('0x4a'),_0x3b1166[_0x0d8b('0x4b')],_0x17a87f[_0x0d8b('0x5b')],md5(_0x17a87f[_0x0d8b('0x5b')]));}return getConnection(_0x3b1166)['then'](function(_0x19e097){_0x199122=_0x19e097;return getUser(_0x3b1166,_0x59ada2[_0x0d8b('0x4d')],_0x199122);})[_0x0d8b('0x2f')](function(_0x2332fc){_0x3e4a41=_0x2332fc;logger[_0x0d8b('0x19')](_0x0d8b('0x5c'),_0x3e4a41['id']);return getEndUser(_0x3b1166,_0x17a87f[_0x0d8b('0x5d')],_0x17a87f[_0x0d8b('0x5e')],_0x199122);})[_0x0d8b('0x2f')](function(_0x34affb){_0xbbb520=_0x34affb;logger['info']('The\x20Enduser\x20ID\x20is:',_0xbbb520['id']);return createTicket(_0x3b1166,_0x3e4a41,_0xbbb520,_0x1d6cd4,_0x17a87f,_0x1d6cd4[_0x0d8b('0x51')],_0x199122);})[_0x0d8b('0x2f')](function(_0x53e399){_0x5a70bd=_0x53e399;logger[_0x0d8b('0x19')]('Ticket\x20created!');logger['info'](_0x0d8b('0x5f'),_0x5a70bd['id']);var _0x1c4e96=util['format']('%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT',_0x3b1166[_0x0d8b('0x21')],_[_0x0d8b('0x54')](_0x5a70bd['id'],'x')[0x1]);logger[_0x0d8b('0x19')](_0x0d8b('0x5a'),_0x0d8b('0x55'));emit(util[_0x0d8b('0x1f')](_0x0d8b('0x60'),_0x59ada2['name']),_0x0d8b('0x56'),{'uri':_0x1c4e96});})['catch'](function(_0x1a203e){logger[_0x0d8b('0x2a')](_0x0d8b('0x5a'),JSON[_0x0d8b('0x26')](_0x1a203e));});};exports['unmanaged']=function(_0x3fe47d,_0x4a1c4a,_0x3a356b,_0x2c6c5f,_0x1c5fe2,_0x2ebea3){var _0xc5c35f,_0x2b44e5,_0x3e927c,_0x91aa89;_0x2ebea3[_0x0d8b('0x21')]=intUtil[_0x0d8b('0x46')](_0x2ebea3['remoteUri']);_0x2ebea3[_0x0d8b('0x4b')]=intUtil['stripTrailingSlash'](_0x2ebea3[_0x0d8b('0x4b')]);if(_0x1c5fe2&&_0x1c5fe2[_0x0d8b('0x47')]){logger['info']('['+_0x4a1c4a[_0x0d8b('0x61')]['toUpperCase']()+']',_0x0d8b('0x49'));_0x4a1c4a[_0x0d8b('0x4c')]=util[_0x0d8b('0x1f')](_0x0d8b('0x4a'),_0x2ebea3[_0x0d8b('0x4b')],_0x4a1c4a[_0x0d8b('0x5b')],md5(_0x4a1c4a[_0x0d8b('0x5b')]));}else{_0x4a1c4a[_0x0d8b('0x4c')]='';}return getConnection(_0x2ebea3)['then'](function(_0x10eca6){_0x91aa89=_0x10eca6;return getUser(_0x2ebea3,'',_0x91aa89);})[_0x0d8b('0x2f')](function(_0x5b2916){_0xc5c35f=_0x5b2916;logger[_0x0d8b('0x19')](_0x0d8b('0x5c'),_0xc5c35f['id']);return getEndUser(_0x2ebea3,_0x4a1c4a[_0x0d8b('0x4e')],_0x4a1c4a[_0x0d8b('0x4f')],_0x91aa89);})[_0x0d8b('0x2f')](function(_0x9e44b4){_0x2b44e5=_0x9e44b4;logger[_0x0d8b('0x19')](_0x0d8b('0x50'),_0x2b44e5['id']);return createTicket(_0x2ebea3,_0xc5c35f,_0x2b44e5,_0x3a356b,_0x4a1c4a,_0x3a356b[_0x0d8b('0x51')],_0x91aa89);})[_0x0d8b('0x2f')](function(_0xe35028){_0x3e927c=_0xe35028;logger[_0x0d8b('0x19')]('Ticket\x20created!');logger[_0x0d8b('0x19')](_0x0d8b('0x5f'),_0x3e927c['id']);})[_0x0d8b('0x36')](function(_0x58525c){logger['error']('['+_0x4a1c4a[_0x0d8b('0x61')][_0x0d8b('0x62')]()+']',JSON[_0x0d8b('0x26')](_0x58525c));});}; \ 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(_0x36c8a8,_0x261777){var _0x4d5838=function(_0x13a2b0){while(--_0x13a2b0){_0x36c8a8['push'](_0x36c8a8['shift']());}};_0x4d5838(++_0x261777);}(_0x9c44,0x178));var _0x49c4=function(_0x17b6e3,_0x4522ed){_0x17b6e3=_0x17b6e3-0x0;var _0x3906f3=_0x9c44[_0x17b6e3];return _0x3906f3;};'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 e257b44..738dcc9 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 _0x8ef4=['GET','includes','string','type','nameField','customField','toLowerCase','content','idField','custom_fields','push','variableName','customVariable','Variable','queue','serverUrl','stripTrailingSlash','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','email','calleridname','The\x20Ticket\x20ID\x20is:','%s/channels/voice/agents/%d/tickets/%d/display.json','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','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','outbound','recordingFormat','none','[OUTBOUND]','The\x20User\x20ID\x20is:','destcalleridname','destcalleridnum','The\x20Enduser\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent...','newTab','catch','inspect','monitor_format','lastevent','calleridnum','toUpperCase','lodash','request-promise','md5','util','ioredis','./util','../../../../config/environment','../../../../config/logger','zendesk','redis','defaults','localhost','socket.io-emitter','emit','application/json','Creating\x20new\x20ticket...','format','remoteUri','POST','merge','Tags','name','getString','Descriptions','Fields','then','info','Ticket\x20created!','validateEmail','Getting\x20agent\x20with\x20email','%s/search.json','type:user\x20role:agent\x20email:%s','count','Agent\x20found!','find','agent','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me.json','Admin\x20account\x20selected.','user','results','length','filter','end-user','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/users.json','authType','password','%s:%s','username','token','%s/token:%s','Basic\x20%s','toString','base64','debug','[HTTP]'];(function(_0x387d3e,_0x34786){var _0x2b5c92=function(_0x341576){while(--_0x341576){_0x387d3e['push'](_0x387d3e['shift']());}};_0x2b5c92(++_0x34786);}(_0x8ef4,0x110));var _0x48ef=function(_0x503cd5,_0x57774a){_0x503cd5=_0x503cd5-0x0;var _0x1fdf1e=_0x8ef4[_0x503cd5];return _0x1fdf1e;};'use strict';var _=require(_0x48ef('0x0'));var rp=require(_0x48ef('0x1'));var md5=require(_0x48ef('0x2'));var util=require(_0x48ef('0x3'));var Redis=require(_0x48ef('0x4'));var intUtil=require(_0x48ef('0x5'));var config=require(_0x48ef('0x6'));var logger=require(_0x48ef('0x7'))(_0x48ef('0x8'));config[_0x48ef('0x9')]=_[_0x48ef('0xa')](config[_0x48ef('0x9')],{'host':_0x48ef('0xb'),'port':0x18eb});var io=require(_0x48ef('0xc'))(new Redis(config[_0x48ef('0x9')]));function emit(_0xdd310a,_0x48a2d7,_0x9cb90){io['to'](_0xdd310a)[_0x48ef('0xd')](_0x48a2d7,_0x9cb90);}var headers={'Content-Type':_0x48ef('0xe'),'Accept':_0x48ef('0xe')};function getTicket(_0x5858af,_0x1a7091,_0x4d519a,_0x4c476a,_0x659eea){logger['info'](_0x48ef('0xf'));return request({'uri':util[_0x48ef('0x10')]('%s/tickets.json',_0x5858af[_0x48ef('0x11')]),'method':_0x48ef('0x12'),'body':{'ticket':_[_0x48ef('0x13')]({'requester_id':_0x4d519a['id'],'submitter_id':_0x1a7091?_0x1a7091['id']:undefined,'assignee_id':_0x1a7091?_0x1a7091['id']:undefined,'tags':getTags(_0x4c476a[_0x48ef('0x14')],_0x48ef('0x15')),'subject':intUtil['getString'](_0x4c476a['Subjects'],_0x659eea,'\x20'),'description':intUtil[_0x48ef('0x16')](_0x4c476a['Descriptions'],_0x659eea,'\x0a'),'comment':{'public':![],'body':intUtil[_0x48ef('0x16')](_0x4c476a[_0x48ef('0x17')],_0x659eea,'\x0a')}},getCustomFields(_0x4c476a[_0x48ef('0x18')],_0x659eea))}})[_0x48ef('0x19')](function(_0x4809cc){logger[_0x48ef('0x1a')](_0x48ef('0x1b'));return _0x4809cc['ticket'];});}function getUser(_0x404628,_0x12cf75){if(intUtil[_0x48ef('0x1c')](_0x12cf75)){logger[_0x48ef('0x1a')](_0x48ef('0x1d'),_0x12cf75);return request({'uri':util[_0x48ef('0x10')](_0x48ef('0x1e'),_0x404628[_0x48ef('0x11')]),'qs':{'query':util[_0x48ef('0x10')](_0x48ef('0x1f'),_0x12cf75)}})['then'](function(_0x2e5cda){if(_0x2e5cda[_0x48ef('0x20')]){logger[_0x48ef('0x1a')](_0x48ef('0x21'));return _[_0x48ef('0x22')](_0x2e5cda['results'],{'email':_0x12cf75,'role':_0x48ef('0x23')});}else{logger[_0x48ef('0x1a')](_0x48ef('0x24'));return request({'uri':util[_0x48ef('0x10')](_0x48ef('0x25'),_0x404628[_0x48ef('0x11')])})[_0x48ef('0x19')](function(_0x2e9ae9){logger['info'](_0x48ef('0x26'));return _0x2e9ae9[_0x48ef('0x27')];});}});}else{logger[_0x48ef('0x1a')](_0x48ef('0x24'));return request({'uri':util[_0x48ef('0x10')](_0x48ef('0x25'),_0x404628[_0x48ef('0x11')])})['then'](function(_0x3812da){logger['info'](_0x48ef('0x26'));return _0x3812da[_0x48ef('0x27')];});}}function getEndUser(_0x1fe82f,_0x3021a5,_0x4ed500){logger[_0x48ef('0x1a')]('Searching\x20enduser\x20with\x20phone',_0x4ed500);return request({'uri':util[_0x48ef('0x10')]('%s/search.json',_0x1fe82f[_0x48ef('0x11')]),'qs':{'query':util['format']('type:user\x20role:end-user\x20phone:%s',_0x4ed500)}})[_0x48ef('0x19')](function(_0xc0d192){var _0x239f8b;if(_0xc0d192[_0x48ef('0x28')][_0x48ef('0x29')]){_0xc0d192[_0x48ef('0x28')]=_[_0x48ef('0x2a')](_0xc0d192['results'],{'suspended':![],'role':_0x48ef('0x2b')});if(_0xc0d192[_0x48ef('0x28')][_0x48ef('0x29')]){_0x239f8b=_['first'](_0xc0d192[_0x48ef('0x28')]);}}if(_0x239f8b){logger[_0x48ef('0x1a')](_0x48ef('0x2c'));return _0x239f8b;}else{logger[_0x48ef('0x1a')](_0x48ef('0x2d'));return request({'uri':util[_0x48ef('0x10')](_0x48ef('0x2e'),_0x1fe82f[_0x48ef('0x11')]),'method':'POST','body':{'user':{'role':_0x48ef('0x2b'),'name':util[_0x48ef('0x10')]('Caller\x20-\x20%s',_0x3021a5||_0x4ed500),'phone':_0x4ed500}}})[_0x48ef('0x19')](function(_0x47c209){logger[_0x48ef('0x1a')]('Enduser\x20created.');return _0x47c209['user'];});}});}function getAuth(_0x42d765){var _0x180dec;if(_0x42d765[_0x48ef('0x2f')]===_0x48ef('0x30')){_0x180dec=util[_0x48ef('0x10')](_0x48ef('0x31'),_0x42d765[_0x48ef('0x32')],_0x42d765[_0x48ef('0x30')]);}else if(_0x42d765[_0x48ef('0x2f')]===_0x48ef('0x33')){_0x180dec=util[_0x48ef('0x10')](_0x48ef('0x34'),_0x42d765[_0x48ef('0x32')],_0x42d765['token']);}return util[_0x48ef('0x10')](_0x48ef('0x35'),new Buffer(_0x180dec)[_0x48ef('0x36')](_0x48ef('0x37')));}function request(_0x456ef4){logger[_0x48ef('0x38')](_0x48ef('0x39'),JSON['stringify'](_0x456ef4));return rp(_[_0x48ef('0xa')](_0x456ef4,{'method':_0x48ef('0x3a'),'headers':headers,'json':!![]}));}function getTags(_0xcdc92b,_0xec7f42){var _0x3d58e6=[];if(_0xcdc92b&&_0xcdc92b['length']>0x0){_0x3d58e6=_['map'](_0xcdc92b,_0xec7f42);}return _0x3d58e6;}function getCustomFields(_0x364bd6,_0x44de3e){var _0x5752f2=[];var _0x38820b={'custom_fields':[]};if(_0x364bd6['length']>0x0){_['forEach'](_0x364bd6,function(_0x29f2d1){if(_[_0x48ef('0x3b')]([_0x48ef('0x3c'),'picklist'],_0x29f2d1[_0x48ef('0x3d')])&&_0x29f2d1[_0x48ef('0x3e')]&&!_0x29f2d1[_0x48ef('0x3f')]){_0x38820b[_0x29f2d1[_0x48ef('0x3e')][_0x48ef('0x40')]()]=_0x29f2d1[_0x48ef('0x41')][_0x48ef('0x36')]();}else if(_['includes'](['string','picklist'],_0x29f2d1[_0x48ef('0x3d')])&&_0x29f2d1[_0x48ef('0x42')]&&_0x29f2d1['customField']){_0x38820b[_0x48ef('0x43')][_0x48ef('0x44')]({'id':_0x29f2d1[_0x48ef('0x42')],'value':_0x29f2d1[_0x48ef('0x41')][_0x48ef('0x36')]()});}else if(_0x29f2d1['type']==='variable'&&_0x29f2d1['variableName']&&_0x29f2d1['idField']&&_0x29f2d1['customField']){_0x44de3e[_0x29f2d1[_0x48ef('0x45')]]&&_0x38820b[_0x48ef('0x43')][_0x48ef('0x44')]({'id':_0x29f2d1[_0x48ef('0x42')],'value':_0x44de3e[_0x29f2d1[_0x48ef('0x45')]][_0x48ef('0x36')]()});}else if(_0x29f2d1[_0x48ef('0x3d')]===_0x48ef('0x46')&&_0x29f2d1['Variable']&&_0x29f2d1[_0x48ef('0x47')][_0x48ef('0x15')]&&_0x29f2d1[_0x48ef('0x42')]&&_0x29f2d1[_0x48ef('0x3f')]){_0x44de3e[_0x29f2d1[_0x48ef('0x47')][_0x48ef('0x15')][_0x48ef('0x40')]()]&&_0x38820b[_0x48ef('0x43')][_0x48ef('0x44')]({'id':_0x29f2d1[_0x48ef('0x42')],'value':_0x44de3e[_0x29f2d1[_0x48ef('0x47')][_0x48ef('0x15')]['toLowerCase']()][_0x48ef('0x36')]()});}});}return _0x38820b;}exports[_0x48ef('0x48')]=function(_0x548251,_0x52e138,_0x2e8f61,_0x5d807d,_0x3f4860,_0x1e42e3){var _0x566aef,_0x3400bb;_0x1e42e3[_0x48ef('0x11')]=intUtil['stripTrailingSlash'](_0x1e42e3['remoteUri']);_0x1e42e3[_0x48ef('0x49')]=intUtil[_0x48ef('0x4a')](_0x1e42e3[_0x48ef('0x49')]);if(_0x3f4860&&_0x3f4860['monitor_format']){logger[_0x48ef('0x1a')](_0x48ef('0x4b'),_0x48ef('0x4c'));_0x52e138[_0x48ef('0x4d')]=util['format'](_0x48ef('0x4e'),_0x1e42e3['serverUrl'],_0x52e138[_0x48ef('0x4f')],md5(_0x52e138[_0x48ef('0x4f')]));}else{_0x52e138['recordingURL']='';}headers[_0x48ef('0x50')]=getAuth(_0x1e42e3);return getUser(_0x1e42e3,_0x5d807d[_0x48ef('0x51')])['then'](function(_0x1ff0b3){_0x566aef=_0x1ff0b3;logger[_0x48ef('0x1a')]('The\x20User\x20ID\x20is:',_0x566aef['id']);return getEndUser(_0x1e42e3,_0x52e138[_0x48ef('0x52')],_0x52e138['calleridnum']);})[_0x48ef('0x19')](function(_0x46f423){_0x3400bb=_0x46f423;logger[_0x48ef('0x1a')]('The\x20Enduser\x20ID\x20is:',_0x3400bb['id']);return getTicket(_0x1e42e3,_0x566aef,_0x3400bb,_0x2e8f61,_0x52e138);})['then'](function(_0x316d12){if(_0x316d12){logger[_0x48ef('0x1a')](_0x48ef('0x53'),_0x316d12['id']);switch(_0x1e42e3['type']){case'integrationTab':logger[_0x48ef('0x1a')](_0x48ef('0x4b'),'Displaying\x20ticket\x20to\x20agent...');return request({'uri':util['format'](_0x48ef('0x54'),_0x1e42e3[_0x48ef('0x11')],_0x566aef['id'],_0x316d12['id']),'method':_0x48ef('0x12')});case'newTab':logger[_0x48ef('0x1a')](_0x48ef('0x4b'),_0x48ef('0x55'));emit(util['format'](_0x48ef('0x56'),_0x5d807d[_0x48ef('0x15')]),_0x48ef('0x57'),{'uri':util[_0x48ef('0x10')](_0x48ef('0x58'),_0x1e42e3[_0x48ef('0x11')][_0x48ef('0x59')](_0x48ef('0x5a'),''),_0x316d12['id'])});break;default:logger[_0x48ef('0x5b')](_0x48ef('0x4b'),_0x48ef('0x5c'));}}})['catch'](function(_0x3b47c1){logger[_0x48ef('0x5b')](_0x48ef('0x5d'),util['inspect'](_0x3b47c1,{'showHidden':!![],'depth':null}));});};exports[_0x48ef('0x5e')]=function(_0x5da82e,_0x479945,_0x2aded7,_0x43d536,_0x580ef0,_0x57e99f,_0x1935f1){var _0x568e83,_0x2be442;_0x57e99f['remoteUri']=intUtil[_0x48ef('0x4a')](_0x57e99f[_0x48ef('0x11')]);_0x57e99f[_0x48ef('0x49')]=intUtil[_0x48ef('0x4a')](_0x57e99f[_0x48ef('0x49')]);if(_0x1935f1&&_0x1935f1[_0x48ef('0x5f')]&&_0x1935f1[_0x48ef('0x5f')]!==_0x48ef('0x60')){logger['info'](_0x48ef('0x61'),'Recording\x20is\x20enabled!');_0x479945['recordingURL']=util[_0x48ef('0x10')](_0x48ef('0x4e'),_0x57e99f[_0x48ef('0x49')],_0x479945[_0x48ef('0x4f')],md5(_0x479945[_0x48ef('0x4f')]));}headers[_0x48ef('0x50')]=getAuth(_0x57e99f);return getUser(_0x57e99f,_0x43d536['email'])['then'](function(_0x127f73){_0x568e83=_0x127f73;logger[_0x48ef('0x1a')](_0x48ef('0x62'),_0x568e83['id']);return getEndUser(_0x57e99f,_0x479945[_0x48ef('0x63')],_0x479945[_0x48ef('0x64')]);})['then'](function(_0x41bba6){_0x2be442=_0x41bba6;logger[_0x48ef('0x1a')](_0x48ef('0x65'),_0x2be442['id']);return getTicket(_0x57e99f,_0x568e83,_0x2be442,_0x2aded7,_0x479945);})[_0x48ef('0x19')](function(_0x12fe6c){if(_0x12fe6c){logger[_0x48ef('0x1a')]('The\x20Ticket\x20ID\x20is:',_0x12fe6c['id']);switch(_0x57e99f[_0x48ef('0x3d')]){case'integrationTab':logger[_0x48ef('0x1a')](_0x48ef('0x61'),_0x48ef('0x66'));return request({'uri':util[_0x48ef('0x10')](_0x48ef('0x54'),_0x57e99f['remoteUri'],_0x568e83['id'],_0x12fe6c['id']),'method':_0x48ef('0x12')});case _0x48ef('0x67'):logger['info'](_0x48ef('0x61'),_0x48ef('0x55'));emit(util[_0x48ef('0x10')](_0x48ef('0x56'),_0x43d536[_0x48ef('0x15')]),_0x48ef('0x57'),{'uri':util['format'](_0x48ef('0x58'),_0x57e99f['remoteUri'][_0x48ef('0x59')]('/api/v2',''),_0x12fe6c['id'])});break;default:logger['error']('[OUTBOUND]',_0x48ef('0x5c'));}}})[_0x48ef('0x68')](function(_0x58053c){logger[_0x48ef('0x5b')]('[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration',util[_0x48ef('0x69')](_0x58053c,{'showHidden':!![],'depth':null}));});};exports['unmanaged']=function(_0x201823,_0x1e0b6d,_0x2c890b,_0x430107,_0xa82e6f,_0x5db77a){var _0x2d9765,_0x8b1822;_0x5db77a[_0x48ef('0x11')]=intUtil[_0x48ef('0x4a')](_0x5db77a[_0x48ef('0x11')]);_0x5db77a[_0x48ef('0x49')]=intUtil['stripTrailingSlash'](_0x5db77a['serverUrl']);if(_0xa82e6f&&_0xa82e6f[_0x48ef('0x6a')]){logger['info']('['+_0x1e0b6d[_0x48ef('0x6b')]['toUpperCase']()+']',_0x48ef('0x4c'));_0x1e0b6d[_0x48ef('0x4d')]=util[_0x48ef('0x10')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x5db77a[_0x48ef('0x49')],_0x1e0b6d[_0x48ef('0x4f')],md5(_0x1e0b6d[_0x48ef('0x4f')]));}else{_0x1e0b6d[_0x48ef('0x4d')]='';}headers[_0x48ef('0x50')]=getAuth(_0x5db77a);return getUser(_0x5db77a)[_0x48ef('0x19')](function(_0x2193cd){_0x2d9765=_0x2193cd;logger['info'](_0x48ef('0x62'),_0x2d9765['id']);return getEndUser(_0x5db77a,_0x1e0b6d[_0x48ef('0x52')],_0x1e0b6d[_0x48ef('0x6c')]);})[_0x48ef('0x19')](function(_0x4c8cd8){_0x8b1822=_0x4c8cd8;logger['info'](_0x48ef('0x65'),_0x8b1822['id']);return getTicket(_0x5db77a,_0x2d9765,_0x8b1822,_0x2c890b,_0x1e0b6d);})[_0x48ef('0x19')](function(_0xe0a402){if(_0xe0a402){logger[_0x48ef('0x1a')](_0x48ef('0x53'),_0xe0a402['id']);}})['catch'](function(_0xa468cd){logger[_0x48ef('0x5b')]('['+_0x1e0b6d[_0x48ef('0x6b')][_0x48ef('0x6d')]()+']'+'\x20Error\x20running\x20Zendesk\x20integration',util[_0x48ef('0x69')](_0xa468cd,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0xc865=['The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent...','%s/channels/voice/agents/%d/tickets/%d/display.json','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','%s/agent/tickets/%s','replace','/api/v2','catch','error','inspect','outbound','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','email','destcalleridname','destcalleridnum','The\x20Ticket\x20ID\x20is:','integrationTab','newTab','trigger:browser:url','Zendesk\x20account\x20type\x20not\x20recognized','unmanaged','lastevent','toUpperCase','\x20Error\x20running\x20Zendesk\x20integration','request-promise','md5','util','ioredis','../../../../config/environment','../../../../config/logger','zendesk','redis','defaults','localhost','socket.io-emitter','emit','application/json','info','Creating\x20new\x20ticket...','format','%s/tickets.json','remoteUri','POST','Tags','name','getString','Subjects','Descriptions','Fields','Ticket\x20created!','ticket','Getting\x20agent\x20with\x20email','%s/search.json','type:user\x20role:agent\x20email:%s','count','find','agent','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me.json','then','Admin\x20account\x20selected.','user','Searching\x20enduser\x20with\x20phone','results','filter','end-user','first','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/users.json','Enduser\x20created.','authType','password','%s:%s','username','token','%s/token:%s','Basic\x20%s','toString','[HTTP]','stringify','length','map','includes','picklist','type','nameField','customField','toLowerCase','idField','custom_fields','content','variable','variableName','Variable','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization'];(function(_0x348548,_0x56bd89){var _0xb529e5=function(_0x3420c2){while(--_0x3420c2){_0x348548['push'](_0x348548['shift']());}};_0xb529e5(++_0x56bd89);}(_0xc865,0xf9));var _0x5c86=function(_0x334562,_0x1ff5d8){_0x334562=_0x334562-0x0;var _0x2c1d2b=_0xc865[_0x334562];return _0x2c1d2b;};'use strict';var _=require('lodash');var rp=require(_0x5c86('0x0'));var md5=require(_0x5c86('0x1'));var util=require(_0x5c86('0x2'));var Redis=require(_0x5c86('0x3'));var intUtil=require('./util');var config=require(_0x5c86('0x4'));var logger=require(_0x5c86('0x5'))(_0x5c86('0x6'));config[_0x5c86('0x7')]=_[_0x5c86('0x8')](config[_0x5c86('0x7')],{'host':_0x5c86('0x9'),'port':0x18eb});var io=require(_0x5c86('0xa'))(new Redis(config[_0x5c86('0x7')]));function emit(_0x20c499,_0x4df25c,_0x497cf9){io['to'](_0x20c499)[_0x5c86('0xb')](_0x4df25c,_0x497cf9);}var headers={'Content-Type':_0x5c86('0xc'),'Accept':_0x5c86('0xc')};function getTicket(_0x15b53f,_0x13633f,_0x26eca6,_0x17793f,_0x19d3f2){logger[_0x5c86('0xd')](_0x5c86('0xe'));return request({'uri':util[_0x5c86('0xf')](_0x5c86('0x10'),_0x15b53f[_0x5c86('0x11')]),'method':_0x5c86('0x12'),'body':{'ticket':_['merge']({'requester_id':_0x26eca6['id'],'submitter_id':_0x13633f?_0x13633f['id']:undefined,'assignee_id':_0x13633f?_0x13633f['id']:undefined,'tags':getTags(_0x17793f[_0x5c86('0x13')],_0x5c86('0x14')),'subject':intUtil[_0x5c86('0x15')](_0x17793f[_0x5c86('0x16')],_0x19d3f2,'\x20'),'description':intUtil['getString'](_0x17793f[_0x5c86('0x17')],_0x19d3f2,'\x0a'),'comment':{'public':![],'body':intUtil[_0x5c86('0x15')](_0x17793f['Descriptions'],_0x19d3f2,'\x0a')}},getCustomFields(_0x17793f[_0x5c86('0x18')],_0x19d3f2))}})['then'](function(_0x3bb9f1){logger['info'](_0x5c86('0x19'));return _0x3bb9f1[_0x5c86('0x1a')];});}function getUser(_0x40f6dc,_0xe5e2b){if(intUtil['validateEmail'](_0xe5e2b)){logger['info'](_0x5c86('0x1b'),_0xe5e2b);return request({'uri':util[_0x5c86('0xf')](_0x5c86('0x1c'),_0x40f6dc[_0x5c86('0x11')]),'qs':{'query':util[_0x5c86('0xf')](_0x5c86('0x1d'),_0xe5e2b)}})['then'](function(_0x24dde6){if(_0x24dde6[_0x5c86('0x1e')]){logger['info']('Agent\x20found!');return _[_0x5c86('0x1f')](_0x24dde6['results'],{'email':_0xe5e2b,'role':_0x5c86('0x20')});}else{logger[_0x5c86('0xd')](_0x5c86('0x21'));return request({'uri':util[_0x5c86('0xf')](_0x5c86('0x22'),_0x40f6dc[_0x5c86('0x11')])})[_0x5c86('0x23')](function(_0xb201a3){logger[_0x5c86('0xd')](_0x5c86('0x24'));return _0xb201a3[_0x5c86('0x25')];});}});}else{logger[_0x5c86('0xd')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0x5c86('0xf')](_0x5c86('0x22'),_0x40f6dc[_0x5c86('0x11')])})[_0x5c86('0x23')](function(_0x178e95){logger['info'](_0x5c86('0x24'));return _0x178e95['user'];});}}function getEndUser(_0x5129c0,_0x32666b,_0x4afde7){logger[_0x5c86('0xd')](_0x5c86('0x26'),_0x4afde7);return request({'uri':util[_0x5c86('0xf')](_0x5c86('0x1c'),_0x5129c0[_0x5c86('0x11')]),'qs':{'query':util[_0x5c86('0xf')]('type:user\x20role:end-user\x20phone:%s',_0x4afde7)}})[_0x5c86('0x23')](function(_0x581641){var _0xfd19f6;if(_0x581641['results']['length']){_0x581641[_0x5c86('0x27')]=_[_0x5c86('0x28')](_0x581641[_0x5c86('0x27')],{'suspended':![],'role':_0x5c86('0x29')});if(_0x581641[_0x5c86('0x27')]['length']){_0xfd19f6=_[_0x5c86('0x2a')](_0x581641[_0x5c86('0x27')]);}}if(_0xfd19f6){logger['info']('Enduser\x20found!');return _0xfd19f6;}else{logger[_0x5c86('0xd')](_0x5c86('0x2b'));return request({'uri':util[_0x5c86('0xf')](_0x5c86('0x2c'),_0x5129c0['remoteUri']),'method':_0x5c86('0x12'),'body':{'user':{'role':_0x5c86('0x29'),'name':util[_0x5c86('0xf')]('Caller\x20-\x20%s',_0x32666b||_0x4afde7),'phone':_0x4afde7}}})['then'](function(_0x5147af){logger[_0x5c86('0xd')](_0x5c86('0x2d'));return _0x5147af[_0x5c86('0x25')];});}});}function getAuth(_0x22afc1){var _0x32ce05;if(_0x22afc1[_0x5c86('0x2e')]===_0x5c86('0x2f')){_0x32ce05=util[_0x5c86('0xf')](_0x5c86('0x30'),_0x22afc1[_0x5c86('0x31')],_0x22afc1['password']);}else if(_0x22afc1[_0x5c86('0x2e')]===_0x5c86('0x32')){_0x32ce05=util[_0x5c86('0xf')](_0x5c86('0x33'),_0x22afc1[_0x5c86('0x31')],_0x22afc1[_0x5c86('0x32')]);}return util[_0x5c86('0xf')](_0x5c86('0x34'),new Buffer(_0x32ce05)[_0x5c86('0x35')]('base64'));}function request(_0x1cd515){logger['debug'](_0x5c86('0x36'),JSON[_0x5c86('0x37')](_0x1cd515));return rp(_['defaults'](_0x1cd515,{'method':'GET','headers':headers,'json':!![]}));}function getTags(_0x49f6e0,_0x12118c){var _0x439b14=[];if(_0x49f6e0&&_0x49f6e0[_0x5c86('0x38')]>0x0){_0x439b14=_[_0x5c86('0x39')](_0x49f6e0,_0x12118c);}return _0x439b14;}function getCustomFields(_0x46faf1,_0x310fd7){var _0x353369=[];var _0x89136b={'custom_fields':[]};if(_0x46faf1[_0x5c86('0x38')]>0x0){_['forEach'](_0x46faf1,function(_0x2e8489){if(_[_0x5c86('0x3a')](['string',_0x5c86('0x3b')],_0x2e8489[_0x5c86('0x3c')])&&_0x2e8489[_0x5c86('0x3d')]&&!_0x2e8489[_0x5c86('0x3e')]){_0x89136b[_0x2e8489[_0x5c86('0x3d')][_0x5c86('0x3f')]()]=_0x2e8489['content'][_0x5c86('0x35')]();}else if(_[_0x5c86('0x3a')](['string',_0x5c86('0x3b')],_0x2e8489[_0x5c86('0x3c')])&&_0x2e8489[_0x5c86('0x40')]&&_0x2e8489['customField']){_0x89136b[_0x5c86('0x41')]['push']({'id':_0x2e8489['idField'],'value':_0x2e8489[_0x5c86('0x42')][_0x5c86('0x35')]()});}else if(_0x2e8489[_0x5c86('0x3c')]===_0x5c86('0x43')&&_0x2e8489[_0x5c86('0x44')]&&_0x2e8489[_0x5c86('0x40')]&&_0x2e8489['customField']){_0x310fd7[_0x2e8489['variableName']]&&_0x89136b[_0x5c86('0x41')]['push']({'id':_0x2e8489[_0x5c86('0x40')],'value':_0x310fd7[_0x2e8489[_0x5c86('0x44')]]['toString']()});}else if(_0x2e8489['type']==='customVariable'&&_0x2e8489[_0x5c86('0x45')]&&_0x2e8489[_0x5c86('0x45')][_0x5c86('0x14')]&&_0x2e8489[_0x5c86('0x40')]&&_0x2e8489[_0x5c86('0x3e')]){_0x310fd7[_0x2e8489['Variable']['name'][_0x5c86('0x3f')]()]&&_0x89136b[_0x5c86('0x41')]['push']({'id':_0x2e8489[_0x5c86('0x40')],'value':_0x310fd7[_0x2e8489['Variable'][_0x5c86('0x14')][_0x5c86('0x3f')]()]['toString']()});}});}return _0x89136b;}exports['queue']=function(_0x4c832a,_0x379f9b,_0xe639d5,_0x4aff0b,_0x481736,_0x5d0ed9){var _0x4e7e0b,_0x3e2fc6;_0x5d0ed9[_0x5c86('0x11')]=intUtil[_0x5c86('0x46')](_0x5d0ed9['remoteUri']);_0x5d0ed9[_0x5c86('0x47')]=intUtil[_0x5c86('0x46')](_0x5d0ed9[_0x5c86('0x47')]);if(_0x481736&&_0x481736[_0x5c86('0x48')]){logger[_0x5c86('0xd')](_0x5c86('0x49'),'Recording\x20is\x20enabled!');_0x379f9b[_0x5c86('0x4a')]=util['format'](_0x5c86('0x4b'),_0x5d0ed9[_0x5c86('0x47')],_0x379f9b[_0x5c86('0x4c')],md5(_0x379f9b[_0x5c86('0x4c')]));}else{_0x379f9b['recordingURL']='';}headers[_0x5c86('0x4d')]=getAuth(_0x5d0ed9);return getUser(_0x5d0ed9,_0x4aff0b['email'])[_0x5c86('0x23')](function(_0x1d2e60){_0x4e7e0b=_0x1d2e60;logger[_0x5c86('0xd')](_0x5c86('0x4e'),_0x4e7e0b['id']);return getEndUser(_0x5d0ed9,_0x379f9b[_0x5c86('0x4f')],_0x379f9b[_0x5c86('0x50')]);})[_0x5c86('0x23')](function(_0x2a10c7){_0x3e2fc6=_0x2a10c7;logger[_0x5c86('0xd')](_0x5c86('0x51'),_0x3e2fc6['id']);return getTicket(_0x5d0ed9,_0x4e7e0b,_0x3e2fc6,_0xe639d5,_0x379f9b);})['then'](function(_0x51e15a){if(_0x51e15a){logger[_0x5c86('0xd')]('The\x20Ticket\x20ID\x20is:',_0x51e15a['id']);switch(_0x5d0ed9[_0x5c86('0x3c')]){case'integrationTab':logger[_0x5c86('0xd')]('[QUEUE]',_0x5c86('0x52'));return request({'uri':util[_0x5c86('0xf')](_0x5c86('0x53'),_0x5d0ed9[_0x5c86('0x11')],_0x4e7e0b['id'],_0x51e15a['id']),'method':_0x5c86('0x12')});case'newTab':logger[_0x5c86('0xd')](_0x5c86('0x49'),_0x5c86('0x54'));emit(util[_0x5c86('0xf')](_0x5c86('0x55'),_0x4aff0b[_0x5c86('0x14')]),'trigger:browser:url',{'uri':util[_0x5c86('0xf')](_0x5c86('0x56'),_0x5d0ed9[_0x5c86('0x11')][_0x5c86('0x57')](_0x5c86('0x58'),''),_0x51e15a['id'])});break;default:logger['error'](_0x5c86('0x49'),'Zendesk\x20account\x20type\x20not\x20recognized');}}})[_0x5c86('0x59')](function(_0x36f91d){logger[_0x5c86('0x5a')]('[QUEUE]\x20Error\x20running\x20Zendesk\x20integration',util[_0x5c86('0x5b')](_0x36f91d,{'showHidden':!![],'depth':null}));});};exports[_0x5c86('0x5c')]=function(_0x25566d,_0x3dc10c,_0x2bf9a3,_0x44ef86,_0x2d6291,_0xaedd44,_0x440551){var _0x771ded,_0x48858f;_0xaedd44[_0x5c86('0x11')]=intUtil['stripTrailingSlash'](_0xaedd44[_0x5c86('0x11')]);_0xaedd44[_0x5c86('0x47')]=intUtil[_0x5c86('0x46')](_0xaedd44[_0x5c86('0x47')]);if(_0x440551&&_0x440551[_0x5c86('0x5d')]&&_0x440551[_0x5c86('0x5d')]!==_0x5c86('0x5e')){logger[_0x5c86('0xd')](_0x5c86('0x5f'),_0x5c86('0x60'));_0x3dc10c[_0x5c86('0x4a')]=util['format'](_0x5c86('0x4b'),_0xaedd44[_0x5c86('0x47')],_0x3dc10c[_0x5c86('0x4c')],md5(_0x3dc10c[_0x5c86('0x4c')]));}headers[_0x5c86('0x4d')]=getAuth(_0xaedd44);return getUser(_0xaedd44,_0x44ef86[_0x5c86('0x61')])['then'](function(_0xed888c){_0x771ded=_0xed888c;logger[_0x5c86('0xd')]('The\x20User\x20ID\x20is:',_0x771ded['id']);return getEndUser(_0xaedd44,_0x3dc10c[_0x5c86('0x62')],_0x3dc10c[_0x5c86('0x63')]);})[_0x5c86('0x23')](function(_0x439f2b){_0x48858f=_0x439f2b;logger['info']('The\x20Enduser\x20ID\x20is:',_0x48858f['id']);return getTicket(_0xaedd44,_0x771ded,_0x48858f,_0x2bf9a3,_0x3dc10c);})[_0x5c86('0x23')](function(_0x8f0392){if(_0x8f0392){logger[_0x5c86('0xd')](_0x5c86('0x64'),_0x8f0392['id']);switch(_0xaedd44[_0x5c86('0x3c')]){case _0x5c86('0x65'):logger[_0x5c86('0xd')]('[OUTBOUND]',_0x5c86('0x52'));return request({'uri':util[_0x5c86('0xf')](_0x5c86('0x53'),_0xaedd44[_0x5c86('0x11')],_0x771ded['id'],_0x8f0392['id']),'method':_0x5c86('0x12')});case _0x5c86('0x66'):logger[_0x5c86('0xd')](_0x5c86('0x5f'),_0x5c86('0x54'));emit(util[_0x5c86('0xf')](_0x5c86('0x55'),_0x44ef86[_0x5c86('0x14')]),_0x5c86('0x67'),{'uri':util[_0x5c86('0xf')]('%s/agent/tickets/%s',_0xaedd44[_0x5c86('0x11')][_0x5c86('0x57')](_0x5c86('0x58'),''),_0x8f0392['id'])});break;default:logger[_0x5c86('0x5a')](_0x5c86('0x5f'),_0x5c86('0x68'));}}})[_0x5c86('0x59')](function(_0x3d655a){logger[_0x5c86('0x5a')]('[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration',util['inspect'](_0x3d655a,{'showHidden':!![],'depth':null}));});};exports[_0x5c86('0x69')]=function(_0x2d0f7f,_0x2c5195,_0x293684,_0x576e44,_0x58cbe5,_0x35e2d7){var _0x3a0209,_0x575962;_0x35e2d7[_0x5c86('0x11')]=intUtil['stripTrailingSlash'](_0x35e2d7[_0x5c86('0x11')]);_0x35e2d7[_0x5c86('0x47')]=intUtil[_0x5c86('0x46')](_0x35e2d7[_0x5c86('0x47')]);if(_0x58cbe5&&_0x58cbe5['monitor_format']){logger[_0x5c86('0xd')]('['+_0x2c5195[_0x5c86('0x6a')][_0x5c86('0x6b')]()+']','Recording\x20is\x20enabled!');_0x2c5195[_0x5c86('0x4a')]=util[_0x5c86('0xf')](_0x5c86('0x4b'),_0x35e2d7[_0x5c86('0x47')],_0x2c5195[_0x5c86('0x4c')],md5(_0x2c5195['uniqueid']));}else{_0x2c5195[_0x5c86('0x4a')]='';}headers['Authorization']=getAuth(_0x35e2d7);return getUser(_0x35e2d7)[_0x5c86('0x23')](function(_0x1697d5){_0x3a0209=_0x1697d5;logger[_0x5c86('0xd')](_0x5c86('0x4e'),_0x3a0209['id']);return getEndUser(_0x35e2d7,_0x2c5195[_0x5c86('0x4f')],_0x2c5195[_0x5c86('0x50')]);})[_0x5c86('0x23')](function(_0x4b7302){_0x575962=_0x4b7302;logger[_0x5c86('0xd')](_0x5c86('0x51'),_0x575962['id']);return getTicket(_0x35e2d7,_0x3a0209,_0x575962,_0x293684,_0x2c5195);})[_0x5c86('0x23')](function(_0x281bf5){if(_0x281bf5){logger[_0x5c86('0xd')](_0x5c86('0x64'),_0x281bf5['id']);}})['catch'](function(_0x410046){logger[_0x5c86('0x5a')]('['+_0x2c5195['lastevent']['toUpperCase']()+']'+_0x5c86('0x6c'),util['inspect'](_0x410046,{'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 d2c4235..1800962 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 _0x7c21=['request-promise','md5','./util','moment','bluebird','../../../../config/environment','../../../../config/logger','zoho','defaults','socket.io-emitter','redis','emit','[HTTP]','length','forEach','picklist','idField','content','toString','variable','variableName','type','customVariable','Variable','name','toLowerCase','indexOf','split','isBefore','expires_in','access_token','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','/oauth/v2/token','refreshToken','clientSecret','refresh_token','add','seconds','catch','error','Failing\x20creating\x20the\x20access_token','stack','info','Search\x20user','format','https://www.zohoapis.%s/crm/v2/users','ActiveUsers','Zoho-oauthtoken\x20','users','isArrayLikeObject','isNil','findIndex','Agent\x20found!','Using\x20the\x20admin\x20account!','user','Administrator','stringify','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','then','data','enduserType','https://www.zohoapis.','/crm/v2/','startCase','moduleCreate','role','first_name','last_name','code','SUCCESS','The\x20failing\x20result\x20is','Error:\x20','log','CREATE\x20ERROR','moduleSearch','contact_lead','uri','/crm/v2/Contacts/search?criteria=((Phone:equals:','Leads','Contacts','lead','/crm/v2/Leads/search?criteria=((Phone:equals:','nothing','Creating\x20new\x20call...','Owner','profile','administrator','Subject','Subjects','Description','getString','Descriptions','Who_Id','Full_Name','First_Name','Last_Name','What_Id','$se_module','talktime','Call_Duration','utc','mm:ss','endtime','YYYY-MM-DDTHH:mm:ss','starttime','lastevent','called','Called','complete','Call_Result','rejected','Rejected','abandoned','Abandoned','timeout','Timeout','Call_Start_Time','outbound','agentcalledAt','Inbound','merge','Fields','/crm/v2/Calls','Call\x20created!','err','host','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','/api/voice/recordings/','uniqueid','zoho.eu','com','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Call\x20ID\x20is:','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','/crm/EntityInfo.do?module=Calls&id=','recordingFormat','none','[OUTBOUND]','/downloads?type=uniqueid&token=','destcalleridname','Outbound','https://crm.','unmanaged','toUpperCase','lodash'];(function(_0x9ceec7,_0x188cb9){var _0x454a47=function(_0x20cdde){while(--_0x20cdde){_0x9ceec7['push'](_0x9ceec7['shift']());}};_0x454a47(++_0x188cb9);}(_0x7c21,0x1e2));var _0x17c2=function(_0x37379d,_0x4115c0){_0x37379d=_0x37379d-0x0;var _0x5d0f31=_0x7c21[_0x37379d];return _0x5d0f31;};'use strict';var _=require(_0x17c2('0x0'));var rp=require(_0x17c2('0x1'));var md5=require(_0x17c2('0x2'));var util=require('util');var intUtil=require(_0x17c2('0x3'));var moment=require(_0x17c2('0x4'));var Redis=require('ioredis');var BPromise=require(_0x17c2('0x5'));var config=require(_0x17c2('0x6'));var logger=require(_0x17c2('0x7'))(_0x17c2('0x8'));config['redis']=_[_0x17c2('0x9')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x17c2('0xa'))(new Redis(config[_0x17c2('0xb')]));function emit(_0x3c354d,_0x43e027,_0x184ad8){io['to'](_0x3c354d)[_0x17c2('0xc')](_0x43e027,_0x184ad8);}function request(_0x3422f2){logger['debug'](_0x17c2('0xd'),JSON['stringify'](_0x3422f2));return rp(_0x3422f2);}function getCustomFields(_0x529c25,_0x379390){var _0x4aae90={};if(_0x529c25[_0x17c2('0xe')]>0x0){_[_0x17c2('0xf')](_0x529c25,function(_0x45f224){if(_['includes'](['string',_0x17c2('0x10')],_0x45f224['type'])&&_0x45f224[_0x17c2('0x11')]){_0x4aae90[_0x45f224[_0x17c2('0x11')]]=_0x45f224[_0x17c2('0x12')][_0x17c2('0x13')]();}else if(_0x45f224['type']===_0x17c2('0x14')&&_0x45f224[_0x17c2('0x15')]&&_0x45f224[_0x17c2('0x11')]&&_0x379390[_0x45f224[_0x17c2('0x15')]]){_0x4aae90[_0x45f224[_0x17c2('0x11')]]=_0x379390[_0x45f224['variableName']][_0x17c2('0x13')]();}else if(_0x45f224[_0x17c2('0x16')]===_0x17c2('0x17')&&_0x45f224[_0x17c2('0x18')]&&_0x45f224[_0x17c2('0x18')][_0x17c2('0x19')]&&_0x45f224[_0x17c2('0x11')]&&_0x379390[_0x45f224['Variable'][_0x17c2('0x19')][_0x17c2('0x1a')]()]){_0x4aae90[_0x45f224[_0x17c2('0x11')]]=_0x379390[_0x45f224[_0x17c2('0x18')][_0x17c2('0x19')][_0x17c2('0x1a')]()][_0x17c2('0x13')]();}});}return _0x4aae90;}function getName(_0x30b706){if(_0x30b706[_0x17c2('0x1b')]('\x20')>0x0){var _0x34f08b=_0x30b706[_0x17c2('0x1c')](/ (.+)/);if(_0x34f08b[0x1]){return _0x34f08b;}}return[_0x30b706,_0x30b706];}var accountsTokens={};function getAccessToken(_0x1d8c62){return new Promise(function(_0xcb05e7,_0x460ac4){if(!_['isNil'](accountsTokens[_0x1d8c62['id']])&&!_['isNil'](accountsTokens[_0x1d8c62['id']]['access_token'])){if(moment()[_0x17c2('0x1d')](accountsTokens[_0x1d8c62['id']][_0x17c2('0x1e')])){_0xcb05e7(accountsTokens[_0x1d8c62['id']][_0x17c2('0x1f')]);}}var _0xdcd5ca;switch(_0x1d8c62[_0x17c2('0x20')]){case'US':_0xdcd5ca=_0x17c2('0x21');break;case'AU':_0xdcd5ca=_0x17c2('0x22');break;case'EU':_0xdcd5ca=_0x17c2('0x23');break;case'IN':_0xdcd5ca=_0x17c2('0x24');break;case'CN':_0xdcd5ca=_0x17c2('0x25');break;default:_0xdcd5ca=_0x17c2('0x23');break;}var _0x1d21a7={'method':_0x17c2('0x26'),'uri':_0xdcd5ca+_0x17c2('0x27'),'qs':{'refresh_token':_0x1d8c62[_0x17c2('0x28')],'client_id':_0x1d8c62['clientId'],'client_secret':_0x1d8c62[_0x17c2('0x29')],'grant_type':_0x17c2('0x2a')},'json':!![]};return rp(_0x1d21a7)['then'](function(_0x349b46){accountsTokens[_0x1d8c62['id']]={'access_token':_0x349b46[_0x17c2('0x1f')],'expires_in':moment()[_0x17c2('0x2b')](_0x349b46[_0x17c2('0x1e')],_0x17c2('0x2c'))};_0xcb05e7(_0x349b46['access_token']);})[_0x17c2('0x2d')](function(_0x57f96d){logger[_0x17c2('0x2e')](_0x17c2('0x2f'),_0x57f96d[_0x17c2('0x30')]);_0x460ac4(_0x57f96d);});});}function getUser(_0x1dc99a,_0x2bbbc0,_0x5ba5e7,_0x1b69f2){logger[_0x17c2('0x31')](_0x17c2('0x32'));return request({'method':'GET','uri':util[_0x17c2('0x33')](_0x17c2('0x34'),_0x2bbbc0),'qs':{'type':_0x17c2('0x35')},'headers':{'Authorization':_0x17c2('0x36')+_0x1dc99a},'json':!![]})['then'](function(_0x3b32a3){if(_0x3b32a3[_0x17c2('0x37')]){var _0x583a72=-0x1;if(_[_0x17c2('0x38')](_0x3b32a3['users'])){if(!_[_0x17c2('0x39')](_0x1b69f2)){_0x583a72=_[_0x17c2('0x3a')](_0x3b32a3[_0x17c2('0x37')],function(_0x4aa0d1){return _0x4aa0d1['email']===_0x1b69f2;});}if(_0x583a72>=0x0){logger[_0x17c2('0x31')](_0x17c2('0x3b'));}else{logger[_0x17c2('0x31')](_0x17c2('0x3c'));_0x583a72=_['findIndex'](_0x3b32a3[_0x17c2('0x37')],function(_0xd978a0){return _0xd978a0['profile'][_0x17c2('0x19')]==='Administrator';});}return _0x3b32a3['users'][_0x583a72];}else{if(_0x3b32a3[_0x17c2('0x3d')]['profile'][_0x17c2('0x19')]===_0x17c2('0x3e')){logger['info'](_0x17c2('0x3c'));user=_0x3b32a3[_0x17c2('0x3d')];return user;}else{logger[_0x17c2('0x2e')]('The\x20failing\x20result\x20is',JSON[_0x17c2('0x3f')](_0x3b32a3));throw new Error(_0x17c2('0x40')+JSON['stringify'](_0x3b32a3));}}}else{logger[_0x17c2('0x2e')]('The\x20failing\x20result\x20is',JSON['stringify'](_0x3b32a3));throw new Error('Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20'+JSON['stringify'](_0x3b32a3));}})[_0x17c2('0x2d')](function(_0x294dd3){console[_0x17c2('0x2e')](_0x294dd3);});}function getZohoUser(_0x5a4335,_0x1658ec){return new BPromise(function(_0x48e793,_0x9ddc3b){request(_0x5a4335)[_0x17c2('0x41')](function(_0x2b5a70){var _0xd1c3f3=null;if(_0x2b5a70){_0xd1c3f3=_0x2b5a70[_0x17c2('0x42')][0x0];_0xd1c3f3[_0x17c2('0x43')]=_0x1658ec;}_0x48e793(_0xd1c3f3);})[_0x17c2('0x2d')](function(_0x4f3e3b){_0x9ddc3b(_0x4f3e3b);});});}function createEndUser(_0x50e740,_0x3b2605,_0x426b13,_0x3ae4ee,_0x3b8669,_0x5e4067){var _0x426b13=getName(_0x426b13);return request({'method':'POST','uri':_0x17c2('0x44')+_0x3b2605+_0x17c2('0x45')+_[_0x17c2('0x46')](_0x5e4067[_0x17c2('0x47')])+'s','body':{'data':[{'Last_Name':_0x426b13[0x1],'First_Name':_0x426b13[0x0],'Phone':_0x3ae4ee,'Owner':{'name':!_[_0x17c2('0x39')](_0x3b8669[_0x17c2('0x48')]['name'])?_0x3b8669['role'][_0x17c2('0x19')]:!_['isNil'](_0x3b8669['first_name'])?_0x3b8669[_0x17c2('0x49')]+'\x20'+_0x3b8669[_0x17c2('0x4a')]:_0x3b8669['last_name'],'id':_0x3b8669['id']}}]},'headers':{'Authorization':_0x17c2('0x36')+_0x50e740},'json':!![]})[_0x17c2('0x41')](function(_0x3095fd){if(_0x3095fd&&_0x3095fd['data'][0x0][_0x17c2('0x4b')]===_0x17c2('0x4c')){var _0x3b0d12=_0x3095fd['data'][0x0]['details'];_0x3b0d12[_0x17c2('0x43')]=_[_0x17c2('0x46')](_0x5e4067['moduleCreate'])+'s';return _0x3b0d12;}logger[_0x17c2('0x2e')](_0x17c2('0x4d'),JSON[_0x17c2('0x3f')](data));throw new Error(_0x17c2('0x4e')+JSON[_0x17c2('0x3f')](data));})[_0x17c2('0x2d')](function(_0x27ce41){console[_0x17c2('0x4f')](_0x17c2('0x50'),_0x27ce41);});}function getEndUser(_0x3a9e60,_0x3c80fd,_0x36a3b5,_0x23c895,_0x4dc2c3,_0x4d494f,_0x145a05){var _0x1df510={'method':'GET','uri':'','headers':{'Authorization':_0x17c2('0x36')+_0x3a9e60},'json':!![]};switch(_0x145a05[_0x17c2('0x51')]){case _0x17c2('0x52'):_0x1df510[_0x17c2('0x53')]=_0x17c2('0x44')+_0x3c80fd+_0x17c2('0x54')+_0x4dc2c3+'))';return getZohoUser(_0x1df510,'Contacts')[_0x17c2('0x41')](function(_0x5d0861){if(_0x5d0861)return _0x5d0861;_0x1df510[_0x17c2('0x53')]='https://www.zohoapis.'+_0x3c80fd+'/crm/v2/Leads/search?criteria=((Phone:equals:'+_0x4dc2c3+'))';return getZohoUser(_0x1df510,_0x17c2('0x55'))[_0x17c2('0x41')](function(_0x4fbb51){if(_0x4fbb51)return _0x4fbb51;if(_0x145a05[_0x17c2('0x47')]!='nothing'){return createEndUser(_0x3a9e60,_0x3c80fd,_0x23c895,_0x4dc2c3,_0x4d494f,_0x145a05);}else{return{};}});});break;case'contact':_0x1df510[_0x17c2('0x53')]=_0x17c2('0x44')+_0x3c80fd+_0x17c2('0x54')+_0x4dc2c3+'))';return getZohoUser(_0x1df510,_0x17c2('0x56'))[_0x17c2('0x41')](function(_0x26cf1c){if(_0x26cf1c)return _0x26cf1c;if(_0x145a05[_0x17c2('0x47')]!='nothing'){return createEndUser(_0x3a9e60,_0x3c80fd,_0x23c895,_0x4dc2c3,_0x4d494f,_0x145a05);}else{return{};}});break;case _0x17c2('0x57'):_0x1df510['uri']=_0x17c2('0x44')+_0x3c80fd+_0x17c2('0x58')+_0x4dc2c3+'))';return getZohoUser(_0x1df510,_0x17c2('0x55'))[_0x17c2('0x41')](function(_0x36b101){if(_0x36b101)return _0x36b101;if(_0x145a05['moduleCreate']!=_0x17c2('0x59')){return createEndUser(_0x3a9e60,_0x3c80fd,_0x23c895,_0x4dc2c3,_0x4d494f,_0x145a05);}else{return{};}});break;}}function getCall(_0x4a5997,_0x48f6a4,_0x553918,_0x10a67c,_0x5a0ffe,_0x1258ca,_0x5eb474,_0x5335e4){logger['info'](_0x17c2('0x5a'));var _0x4958ca={};_0x4958ca[_0x17c2('0x5b')]={'name':!_[_0x17c2('0x39')](_0x10a67c['role'][_0x17c2('0x19')])&&!_['isNil'](_0x10a67c['profile'][_0x17c2('0x19')])&&_0x10a67c[_0x17c2('0x5c')]['name']===_0x17c2('0x5d')?_0x10a67c[_0x17c2('0x48')]['name']:!_[_0x17c2('0x39')](_0x10a67c[_0x17c2('0x49')])?_0x10a67c['first_name']+'\x20'+_0x10a67c[_0x17c2('0x4a')]:_0x10a67c['last_name'],'id':_0x10a67c['id']};_0x4958ca[_0x17c2('0x5e')]=intUtil['getString'](_0x1258ca[_0x17c2('0x5f')],_0x5eb474,'\x20');_0x4958ca[_0x17c2('0x60')]=intUtil[_0x17c2('0x61')](_0x1258ca[_0x17c2('0x62')],_0x5eb474,'\x0a');if(_0x5a0ffe['enduserType']===_0x17c2('0x56')){_0x4958ca[_0x17c2('0x63')]={'name':!_['isNil'](_0x5a0ffe[_0x17c2('0x64')])?_0x5a0ffe[_0x17c2('0x64')]:!_[_0x17c2('0x39')](_0x5a0ffe[_0x17c2('0x65')])?_0x5a0ffe['First_Name']+'\x20'+_0x5a0ffe[_0x17c2('0x66')]:_0x5a0ffe[_0x17c2('0x66')],'id':_0x5a0ffe['id']};}if(_0x5a0ffe['enduserType']===_0x17c2('0x55')){_0x4958ca[_0x17c2('0x67')]={'name':!_[_0x17c2('0x39')](_0x5a0ffe['Full_Name'])?_0x5a0ffe['Full_Name']:!_[_0x17c2('0x39')](_0x5a0ffe['First_Name'])?_0x5a0ffe[_0x17c2('0x65')]+'\x20'+_0x5a0ffe[_0x17c2('0x66')]:_0x5a0ffe[_0x17c2('0x66')],'id':_0x5a0ffe['id']};_0x4958ca[_0x17c2('0x68')]=_[_0x17c2('0x46')](_0x5a0ffe[_0x17c2('0x43')]);}if(_0x5eb474[_0x17c2('0x69')]){_0x4958ca[_0x17c2('0x6a')]=moment[_0x17c2('0x6b')](parseInt(_0x5eb474[_0x17c2('0x69')])*0x3e8)[_0x17c2('0x33')](_0x17c2('0x6c'));}else if(_0x5eb474['answertime']&&_0x5eb474['endtime']){_0x4958ca[_0x17c2('0x6a')]=moment['utc'](moment(_0x5eb474[_0x17c2('0x6d')],_0x17c2('0x6e'))['diff'](moment(_0x5eb474[_0x17c2('0x6f')],_0x17c2('0x6e'))))[_0x17c2('0x33')](_0x17c2('0x6c'));}switch(_0x5eb474[_0x17c2('0x70')]){case _0x17c2('0x71'):_0x4958ca['Call_Result']=_0x17c2('0x72');break;case _0x17c2('0x73'):case'connect':_0x4958ca[_0x17c2('0x74')]='Answered';break;case _0x17c2('0x75'):_0x4958ca[_0x17c2('0x74')]=_0x17c2('0x76');break;case _0x17c2('0x77'):_0x4958ca[_0x17c2('0x74')]=_0x17c2('0x78');break;case _0x17c2('0x79'):_0x4958ca[_0x17c2('0x74')]=_0x17c2('0x7a');default:}_0x4958ca[_0x17c2('0x7b')]=(_0x5335e4===_0x17c2('0x7c')?moment(_0x5eb474['starttime'])['format']('YYYY-MM-DDTHH:mm:ss'):moment(_0x5eb474[_0x17c2('0x7d')])[_0x17c2('0x33')]('YYYY-MM-DDTHH:mm:ss'))||moment()[_0x17c2('0x33')]('YYYY-MM-DDTHH:mm:ss');_0x4958ca['Call_Type']=_0x5335e4||_0x17c2('0x7e');_0x4958ca=_[_0x17c2('0x7f')](_0x4958ca,getCustomFields(_0x1258ca[_0x17c2('0x80')],_0x5eb474));return request({'method':'POST','uri':_0x17c2('0x44')+_0x48f6a4+_0x17c2('0x81'),'headers':{'Authorization':_0x17c2('0x36')+_0x4a5997},'body':{'data':[_0x4958ca]},'json':!![]})[_0x17c2('0x41')](function(_0xe4d2c3){if(_0xe4d2c3&&_0xe4d2c3[_0x17c2('0x42')][0x0]['code']===_0x17c2('0x4c')){logger[_0x17c2('0x31')](_0x17c2('0x82'));return{'id':_0xe4d2c3[_0x17c2('0x42')][0x0]['details']['id']};}})[_0x17c2('0x2d')](function(_0x5914c0){logger[_0x17c2('0x31')](_0x17c2('0x83'),_0x5914c0[_0x17c2('0x30')]);console[_0x17c2('0x4f')](_0x17c2('0x83'),_0x5914c0);});}exports['queue']=function(_0x420c83,_0xd73fbb,_0x3d6d6a,_0x28a4ef,_0x217c33,_0x43e614){var _0x1a41f6,_0x4f5722,_0xa57522;_0x43e614[_0x17c2('0x84')]=intUtil[_0x17c2('0x85')](_0x43e614['host']);_0x43e614[_0x17c2('0x86')]=intUtil['stripTrailingSlash'](_0x43e614[_0x17c2('0x86')]);if(_0x217c33&&_0x217c33[_0x17c2('0x87')]){logger[_0x17c2('0x31')](_0x17c2('0x88'),_0x17c2('0x89'));_0xd73fbb[_0x17c2('0x8a')]=_0x43e614[_0x17c2('0x86')]+_0x17c2('0x8b')+_0xd73fbb[_0x17c2('0x8c')]+'/downloads?type=uniqueid&token='+md5(_0xd73fbb[_0x17c2('0x8c')]);}else{_0xd73fbb[_0x17c2('0x8a')]='';}var _0x1cfd3e=_0x43e614[_0x17c2('0x84')]===_0x17c2('0x8d')?'eu':_0x17c2('0x8e');return getAccessToken(_0x43e614)[_0x17c2('0x41')](function(_0x453395){_0xa57522=_0x453395;return getUser(_0xa57522,_0x1cfd3e,_0x43e614,_0x28a4ef[_0x17c2('0x8f')]);})[_0x17c2('0x41')](function(_0x1ffa71){_0x1a41f6=_0x1ffa71;logger['info'](_0x17c2('0x90'),_0x1a41f6['id']);return getEndUser(_0xa57522,_0x1cfd3e,_0x43e614,_0xd73fbb[_0x17c2('0x91')],_0xd73fbb[_0x17c2('0x92')],_0x1a41f6,_0x3d6d6a);})[_0x17c2('0x41')](function(_0x2b948c){_0x4f5722=_0x2b948c;return getCall(_0xa57522,_0x1cfd3e,_0x43e614,_0x1a41f6,_0x4f5722,_0x3d6d6a,_0xd73fbb,_0x17c2('0x7e'));})[_0x17c2('0x41')](function(_0xe05d6e){if(_0xe05d6e){logger[_0x17c2('0x31')](_0x17c2('0x93'),_0xe05d6e['id']);logger[_0x17c2('0x31')]('[QUEUE]',_0x17c2('0x94'));emit(util[_0x17c2('0x33')](_0x17c2('0x95'),_0x28a4ef[_0x17c2('0x19')]),_0x17c2('0x96'),{'uri':'https://crm.'+_0x43e614[_0x17c2('0x84')]+_0x17c2('0x97')+_0xe05d6e['id']});}})[_0x17c2('0x2d')](function(_0x1fecd8){logger[_0x17c2('0x2e')](_0x17c2('0x88'),JSON[_0x17c2('0x3f')](_0x1fecd8));});};exports[_0x17c2('0x7c')]=function(_0x6b5937,_0x3a9299,_0x39ef92,_0x2650cf,_0x145d2c,_0x360671,_0x3585b1){var _0x5b715e,_0x1d86bc,_0x44d334;_0x360671['host']=intUtil[_0x17c2('0x85')](_0x360671['host']);_0x360671[_0x17c2('0x86')]=intUtil[_0x17c2('0x85')](_0x360671[_0x17c2('0x86')]);if(_0x3585b1&&_0x3585b1[_0x17c2('0x98')]&&_0x3585b1[_0x17c2('0x98')]!==_0x17c2('0x99')){logger[_0x17c2('0x31')](_0x17c2('0x9a'),_0x17c2('0x89'));_0x3a9299['recordingURL']=_0x360671['serverUrl']+_0x17c2('0x8b')+_0x3a9299[_0x17c2('0x8c')]+_0x17c2('0x9b')+md5(_0x3a9299[_0x17c2('0x8c')]);}var _0x3bfba1=_0x360671['host']==='zoho.eu'?'eu':_0x17c2('0x8e');return getAccessToken(_0x360671)[_0x17c2('0x41')](function(_0x5dd353){_0x44d334=_0x5dd353;return getUser(_0x44d334,_0x3bfba1,_0x360671,_0x2650cf[_0x17c2('0x8f')]);})['then'](function(_0x172d19){_0x5b715e=_0x172d19;logger[_0x17c2('0x31')](_0x17c2('0x90'),_0x5b715e['id']);return getEndUser(_0x44d334,_0x3bfba1,_0x360671,_0x3a9299[_0x17c2('0x9c')],_0x3a9299['destcalleridnum'],_0x5b715e,_0x39ef92);})[_0x17c2('0x41')](function(_0x58ed71){_0x1d86bc=_0x58ed71;return getCall(_0x44d334,_0x3bfba1,_0x360671,_0x5b715e,_0x1d86bc,_0x39ef92,_0x3a9299,_0x17c2('0x9d'));})[_0x17c2('0x41')](function(_0x46bf9e){if(_0x46bf9e){logger[_0x17c2('0x31')](_0x17c2('0x93'),_0x46bf9e['id']);logger['info']('[OUTBOUND]',_0x17c2('0x94'));emit(util['format'](_0x17c2('0x95'),_0x2650cf[_0x17c2('0x19')]),_0x17c2('0x96'),{'uri':_0x17c2('0x9e')+_0x360671[_0x17c2('0x84')]+'/crm/EntityInfo.do?module=Calls&id='+_0x46bf9e['id']});}})[_0x17c2('0x2d')](function(_0x4dfed3){logger[_0x17c2('0x2e')](_0x17c2('0x9a'),JSON['stringify'](_0x4dfed3));});};exports[_0x17c2('0x9f')]=function(_0x14840d,_0x41447d,_0x487797,_0x606d7b,_0xda9b7d,_0x59b67b){var _0x3802d3,_0x42d2f9,_0x290d5b;_0x59b67b[_0x17c2('0x84')]=intUtil[_0x17c2('0x85')](_0x59b67b[_0x17c2('0x84')]);_0x59b67b[_0x17c2('0x86')]=intUtil[_0x17c2('0x85')](_0x59b67b[_0x17c2('0x86')]);if(_0xda9b7d&&_0xda9b7d['monitor_format']){logger[_0x17c2('0x31')]('['+_0x41447d[_0x17c2('0x70')][_0x17c2('0xa0')]()+']',_0x17c2('0x89'));_0x41447d[_0x17c2('0x8a')]=_0x59b67b[_0x17c2('0x86')]+_0x17c2('0x8b')+_0x41447d[_0x17c2('0x8c')]+_0x17c2('0x9b')+md5(_0x41447d[_0x17c2('0x8c')]);}else{_0x41447d['recordingURL']='';}var _0x1d2e33=_0x59b67b[_0x17c2('0x84')]===_0x17c2('0x8d')?'eu':_0x17c2('0x8e');return getAccessToken(_0x59b67b)['then'](function(_0x1df710){_0x290d5b=_0x1df710;return getUser(_0x290d5b,_0x1d2e33,_0x59b67b);})[_0x17c2('0x41')](function(_0x55bae5){_0x3802d3=_0x55bae5;logger[_0x17c2('0x31')](_0x17c2('0x90'),_0x3802d3['id']);return getEndUser(_0x290d5b,_0x1d2e33,_0x59b67b,_0x41447d[_0x17c2('0x91')],_0x41447d[_0x17c2('0x92')],_0x3802d3,_0x487797);})[_0x17c2('0x41')](function(_0x3139d5){_0x42d2f9=_0x3139d5;return getCall(_0x290d5b,_0x1d2e33,_0x59b67b,_0x3802d3,_0x42d2f9,_0x487797,_0x41447d,_0x17c2('0x7e'));})[_0x17c2('0x41')](function(_0x15eb92){if(_0x15eb92){logger['info'](_0x17c2('0x93'),_0x15eb92['id']);}})['catch'](function(_0x65f027){logger[_0x17c2('0x2e')]('['+_0x41447d[_0x17c2('0x70')]['toUpperCase']()+']',JSON['stringify'](_0x65f027));});}; \ No newline at end of file +var _0x3b36=['contact','lead','Creating\x20new\x20call...','Owner','first_name','Subject','getString','Description','Descriptions','Who_Id','First_Name','Last_Name','What_Id','Full_Name','$se_module','Call_Duration','utc','mm:ss','answertime','endtime','YYYY-MM-DDTHH:mm:ss','starttime','format','lastevent','called','Call_Result','Called','complete','Answered','rejected','Rejected','abandoned','Abandoned','timeout','Timeout','Call_Start_Time','outbound','agentcalledAt','Call_Type','Inbound','merge','Fields','/crm/v2/Calls','SUCCESS','err','log','queue','host','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','recordingURL','/api/voice/recordings/','uniqueid','com','The\x20User\x20ID\x20is:','calleridnum','The\x20Call\x20ID\x20is:','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','https://crm.','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','/downloads?type=uniqueid&token=','zoho.eu','destcalleridname','destcalleridnum','Outbound','unmanaged','toUpperCase','calleridname','request-promise','util','./util','moment','ioredis','bluebird','../../../../config/environment','../../../../config/logger','zoho','redis','defaults','localhost','socket.io-emitter','emit','[HTTP]','length','includes','string','type','idField','content','variableName','toString','Variable','name','toLowerCase','indexOf','isNil','access_token','isBefore','expires_in','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','POST','refreshToken','clientSecret','refresh_token','then','add','seconds','catch','error','Failing\x20creating\x20the\x20access_token','stack','info','https://www.zohoapis.%s/crm/v2/users','ActiveUsers','Zoho-oauthtoken\x20','users','isArrayLikeObject','findIndex','email','Agent\x20found!','Using\x20the\x20admin\x20account!','profile','Administrator','user','The\x20failing\x20result\x20is','stringify','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','data','enduserType','https://www.zohoapis.','startCase','moduleCreate','role','last_name','Error:\x20','CREATE\x20ERROR','GET','contact_lead','uri','/crm/v2/Contacts/search?criteria=((Phone:equals:','Contacts','/crm/v2/Leads/search?criteria=((Phone:equals:','Leads','nothing'];(function(_0x13bc3a,_0x417a75){var _0x505b02=function(_0x840a26){while(--_0x840a26){_0x13bc3a['push'](_0x13bc3a['shift']());}};_0x505b02(++_0x417a75);}(_0x3b36,0x181));var _0x63b3=function(_0x256abf,_0x629a07){_0x256abf=_0x256abf-0x0;var _0x1dfc9e=_0x3b36[_0x256abf];return _0x1dfc9e;};'use strict';var _=require('lodash');var rp=require(_0x63b3('0x0'));var md5=require('md5');var util=require(_0x63b3('0x1'));var intUtil=require(_0x63b3('0x2'));var moment=require(_0x63b3('0x3'));var Redis=require(_0x63b3('0x4'));var BPromise=require(_0x63b3('0x5'));var config=require(_0x63b3('0x6'));var logger=require(_0x63b3('0x7'))(_0x63b3('0x8'));config[_0x63b3('0x9')]=_[_0x63b3('0xa')](config[_0x63b3('0x9')],{'host':_0x63b3('0xb'),'port':0x18eb});var io=require(_0x63b3('0xc'))(new Redis(config[_0x63b3('0x9')]));function emit(_0x408454,_0x284f41,_0x446aea){io['to'](_0x408454)[_0x63b3('0xd')](_0x284f41,_0x446aea);}function request(_0xb1016){logger['debug'](_0x63b3('0xe'),JSON['stringify'](_0xb1016));return rp(_0xb1016);}function getCustomFields(_0x2eff4b,_0x1da9d7){var _0x2ad7ef={};if(_0x2eff4b[_0x63b3('0xf')]>0x0){_['forEach'](_0x2eff4b,function(_0x53a0a6){if(_[_0x63b3('0x10')]([_0x63b3('0x11'),'picklist'],_0x53a0a6[_0x63b3('0x12')])&&_0x53a0a6[_0x63b3('0x13')]){_0x2ad7ef[_0x53a0a6[_0x63b3('0x13')]]=_0x53a0a6[_0x63b3('0x14')]['toString']();}else if(_0x53a0a6[_0x63b3('0x12')]==='variable'&&_0x53a0a6[_0x63b3('0x15')]&&_0x53a0a6[_0x63b3('0x13')]&&_0x1da9d7[_0x53a0a6[_0x63b3('0x15')]]){_0x2ad7ef[_0x53a0a6[_0x63b3('0x13')]]=_0x1da9d7[_0x53a0a6[_0x63b3('0x15')]][_0x63b3('0x16')]();}else if(_0x53a0a6['type']==='customVariable'&&_0x53a0a6[_0x63b3('0x17')]&&_0x53a0a6['Variable'][_0x63b3('0x18')]&&_0x53a0a6[_0x63b3('0x13')]&&_0x1da9d7[_0x53a0a6['Variable'][_0x63b3('0x18')][_0x63b3('0x19')]()]){_0x2ad7ef[_0x53a0a6[_0x63b3('0x13')]]=_0x1da9d7[_0x53a0a6[_0x63b3('0x17')][_0x63b3('0x18')][_0x63b3('0x19')]()][_0x63b3('0x16')]();}});}return _0x2ad7ef;}function getName(_0x5950b6){if(_0x5950b6[_0x63b3('0x1a')]('\x20')>0x0){var _0x2206c7=_0x5950b6['split'](/ (.+)/);if(_0x2206c7[0x1]){return _0x2206c7;}}return[_0x5950b6,_0x5950b6];}var accountsTokens={};function getAccessToken(_0x33c02f){return new Promise(function(_0x18fedd,_0x372004){if(!_[_0x63b3('0x1b')](accountsTokens[_0x33c02f['id']])&&!_[_0x63b3('0x1b')](accountsTokens[_0x33c02f['id']][_0x63b3('0x1c')])){if(moment()[_0x63b3('0x1d')](accountsTokens[_0x33c02f['id']][_0x63b3('0x1e')])){_0x18fedd(accountsTokens[_0x33c02f['id']]['access_token']);}}var _0x328fc1;switch(_0x33c02f[_0x63b3('0x1f')]){case'US':_0x328fc1=_0x63b3('0x20');break;case'AU':_0x328fc1=_0x63b3('0x21');break;case'EU':_0x328fc1=_0x63b3('0x22');break;case'IN':_0x328fc1=_0x63b3('0x23');break;case'CN':_0x328fc1='https://accounts.zoho.com.cn';break;default:_0x328fc1=_0x63b3('0x22');break;}var _0xfd34ae={'method':_0x63b3('0x24'),'uri':_0x328fc1+'/oauth/v2/token','qs':{'refresh_token':_0x33c02f[_0x63b3('0x25')],'client_id':_0x33c02f['clientId'],'client_secret':_0x33c02f[_0x63b3('0x26')],'grant_type':_0x63b3('0x27')},'json':!![]};return rp(_0xfd34ae)[_0x63b3('0x28')](function(_0x130451){accountsTokens[_0x33c02f['id']]={'access_token':_0x130451[_0x63b3('0x1c')],'expires_in':moment()[_0x63b3('0x29')](_0x130451[_0x63b3('0x1e')],_0x63b3('0x2a'))};_0x18fedd(_0x130451['access_token']);})[_0x63b3('0x2b')](function(_0x1e1518){logger[_0x63b3('0x2c')](_0x63b3('0x2d'),_0x1e1518[_0x63b3('0x2e')]);_0x372004(_0x1e1518);});});}function getUser(_0x28518e,_0x3a6de7,_0xcf2b8d,_0x1c0d0d){logger[_0x63b3('0x2f')]('Search\x20user');return request({'method':'GET','uri':util['format'](_0x63b3('0x30'),_0x3a6de7),'qs':{'type':_0x63b3('0x31')},'headers':{'Authorization':_0x63b3('0x32')+_0x28518e},'json':!![]})[_0x63b3('0x28')](function(_0x210a7d){if(_0x210a7d[_0x63b3('0x33')]){var _0xf878c2=-0x1;if(_[_0x63b3('0x34')](_0x210a7d[_0x63b3('0x33')])){if(!_[_0x63b3('0x1b')](_0x1c0d0d)){_0xf878c2=_[_0x63b3('0x35')](_0x210a7d[_0x63b3('0x33')],function(_0x3843d4){return _0x3843d4[_0x63b3('0x36')]===_0x1c0d0d;});}if(_0xf878c2>=0x0){logger[_0x63b3('0x2f')](_0x63b3('0x37'));}else{logger[_0x63b3('0x2f')](_0x63b3('0x38'));_0xf878c2=_['findIndex'](_0x210a7d[_0x63b3('0x33')],function(_0xd56332){return _0xd56332[_0x63b3('0x39')][_0x63b3('0x18')]===_0x63b3('0x3a');});}return _0x210a7d[_0x63b3('0x33')][_0xf878c2];}else{if(_0x210a7d[_0x63b3('0x3b')][_0x63b3('0x39')][_0x63b3('0x18')]==='Administrator'){logger['info'](_0x63b3('0x38'));user=_0x210a7d['user'];return user;}else{logger[_0x63b3('0x2c')](_0x63b3('0x3c'),JSON[_0x63b3('0x3d')](_0x210a7d));throw new Error(_0x63b3('0x3e')+JSON[_0x63b3('0x3d')](_0x210a7d));}}}else{logger[_0x63b3('0x2c')](_0x63b3('0x3c'),JSON[_0x63b3('0x3d')](_0x210a7d));throw new Error('Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20'+JSON[_0x63b3('0x3d')](_0x210a7d));}})[_0x63b3('0x2b')](function(_0x19bc68){console[_0x63b3('0x2c')](_0x19bc68);});}function getZohoUser(_0x482e91,_0x3f8cb7){return new BPromise(function(_0x1a17d3,_0x4a1dc2){request(_0x482e91)[_0x63b3('0x28')](function(_0x449bd8){var _0x13fdea=null;if(_0x449bd8){_0x13fdea=_0x449bd8[_0x63b3('0x3f')][0x0];_0x13fdea[_0x63b3('0x40')]=_0x3f8cb7;}_0x1a17d3(_0x13fdea);})[_0x63b3('0x2b')](function(_0x342044){_0x4a1dc2(_0x342044);});});}function createEndUser(_0x396bf3,_0x52efcb,_0x29ed23,_0x345718,_0x396a27,_0x24ef58){var _0x29ed23=getName(_0x29ed23);return request({'method':_0x63b3('0x24'),'uri':_0x63b3('0x41')+_0x52efcb+'/crm/v2/'+_[_0x63b3('0x42')](_0x24ef58[_0x63b3('0x43')])+'s','body':{'data':[{'Last_Name':_0x29ed23[0x1],'First_Name':_0x29ed23[0x0],'Phone':_0x345718,'Owner':{'name':!_['isNil'](_0x396a27['role'][_0x63b3('0x18')])?_0x396a27[_0x63b3('0x44')][_0x63b3('0x18')]:!_['isNil'](_0x396a27['first_name'])?_0x396a27['first_name']+'\x20'+_0x396a27[_0x63b3('0x45')]:_0x396a27[_0x63b3('0x45')],'id':_0x396a27['id']}}]},'headers':{'Authorization':_0x63b3('0x32')+_0x396bf3},'json':!![]})['then'](function(_0x1d8c74){if(_0x1d8c74&&_0x1d8c74[_0x63b3('0x3f')][0x0]['code']==='SUCCESS'){var _0x5f0e66=_0x1d8c74[_0x63b3('0x3f')][0x0]['details'];_0x5f0e66[_0x63b3('0x40')]=_[_0x63b3('0x42')](_0x24ef58[_0x63b3('0x43')])+'s';return _0x5f0e66;}logger['error']('The\x20failing\x20result\x20is',JSON[_0x63b3('0x3d')](data));throw new Error(_0x63b3('0x46')+JSON[_0x63b3('0x3d')](data));})[_0x63b3('0x2b')](function(_0x34c6bd){console['log'](_0x63b3('0x47'),_0x34c6bd);});}function getEndUser(_0x26f09d,_0x3c7769,_0x1695ed,_0x3c8170,_0x1f28d4,_0x5b6a39,_0x5fad0c){var _0xefea1e={'method':_0x63b3('0x48'),'uri':'','headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x26f09d},'json':!![]};switch(_0x5fad0c['moduleSearch']){case _0x63b3('0x49'):_0xefea1e[_0x63b3('0x4a')]='https://www.zohoapis.'+_0x3c7769+_0x63b3('0x4b')+_0x1f28d4+'))';return getZohoUser(_0xefea1e,_0x63b3('0x4c'))[_0x63b3('0x28')](function(_0x27fce7){if(_0x27fce7)return _0x27fce7;_0xefea1e[_0x63b3('0x4a')]='https://www.zohoapis.'+_0x3c7769+_0x63b3('0x4d')+_0x1f28d4+'))';return getZohoUser(_0xefea1e,_0x63b3('0x4e'))[_0x63b3('0x28')](function(_0x7e8064){if(_0x7e8064)return _0x7e8064;if(_0x5fad0c[_0x63b3('0x43')]!=_0x63b3('0x4f')){return createEndUser(_0x26f09d,_0x3c7769,_0x3c8170,_0x1f28d4,_0x5b6a39,_0x5fad0c);}else{return{};}});});break;case _0x63b3('0x50'):_0xefea1e[_0x63b3('0x4a')]=_0x63b3('0x41')+_0x3c7769+_0x63b3('0x4b')+_0x1f28d4+'))';return getZohoUser(_0xefea1e,'Contacts')['then'](function(_0x41dc85){if(_0x41dc85)return _0x41dc85;if(_0x5fad0c['moduleCreate']!='nothing'){return createEndUser(_0x26f09d,_0x3c7769,_0x3c8170,_0x1f28d4,_0x5b6a39,_0x5fad0c);}else{return{};}});break;case _0x63b3('0x51'):_0xefea1e[_0x63b3('0x4a')]=_0x63b3('0x41')+_0x3c7769+_0x63b3('0x4d')+_0x1f28d4+'))';return getZohoUser(_0xefea1e,_0x63b3('0x4e'))[_0x63b3('0x28')](function(_0x102a7f){if(_0x102a7f)return _0x102a7f;if(_0x5fad0c[_0x63b3('0x43')]!=_0x63b3('0x4f')){return createEndUser(_0x26f09d,_0x3c7769,_0x3c8170,_0x1f28d4,_0x5b6a39,_0x5fad0c);}else{return{};}});break;}}function getCall(_0x47b0d1,_0x520fa8,_0x4ac9e5,_0x5f1e98,_0x2adbfd,_0x45ed34,_0x1a4bfc,_0x3d1ea0){logger[_0x63b3('0x2f')](_0x63b3('0x52'));var _0x43d4e7={};_0x43d4e7[_0x63b3('0x53')]={'name':!_['isNil'](_0x5f1e98[_0x63b3('0x44')]['name'])&&!_['isNil'](_0x5f1e98[_0x63b3('0x39')][_0x63b3('0x18')])&&_0x5f1e98['profile'][_0x63b3('0x18')]==='administrator'?_0x5f1e98[_0x63b3('0x44')][_0x63b3('0x18')]:!_[_0x63b3('0x1b')](_0x5f1e98[_0x63b3('0x54')])?_0x5f1e98['first_name']+'\x20'+_0x5f1e98[_0x63b3('0x45')]:_0x5f1e98[_0x63b3('0x45')],'id':_0x5f1e98['id']};_0x43d4e7[_0x63b3('0x55')]=intUtil[_0x63b3('0x56')](_0x45ed34['Subjects'],_0x1a4bfc,'\x20');_0x43d4e7[_0x63b3('0x57')]=intUtil[_0x63b3('0x56')](_0x45ed34[_0x63b3('0x58')],_0x1a4bfc,'\x0a');if(_0x2adbfd[_0x63b3('0x40')]===_0x63b3('0x4c')){_0x43d4e7[_0x63b3('0x59')]={'name':!_['isNil'](_0x2adbfd['Full_Name'])?_0x2adbfd['Full_Name']:!_[_0x63b3('0x1b')](_0x2adbfd[_0x63b3('0x5a')])?_0x2adbfd[_0x63b3('0x5a')]+'\x20'+_0x2adbfd[_0x63b3('0x5b')]:_0x2adbfd[_0x63b3('0x5b')],'id':_0x2adbfd['id']};}if(_0x2adbfd[_0x63b3('0x40')]===_0x63b3('0x4e')){_0x43d4e7[_0x63b3('0x5c')]={'name':!_[_0x63b3('0x1b')](_0x2adbfd[_0x63b3('0x5d')])?_0x2adbfd[_0x63b3('0x5d')]:!_[_0x63b3('0x1b')](_0x2adbfd[_0x63b3('0x5a')])?_0x2adbfd[_0x63b3('0x5a')]+'\x20'+_0x2adbfd['Last_Name']:_0x2adbfd[_0x63b3('0x5b')],'id':_0x2adbfd['id']};_0x43d4e7[_0x63b3('0x5e')]=_[_0x63b3('0x42')](_0x2adbfd[_0x63b3('0x40')]);}if(_0x1a4bfc['talktime']){_0x43d4e7[_0x63b3('0x5f')]=moment[_0x63b3('0x60')](parseInt(_0x1a4bfc['talktime'])*0x3e8)['format'](_0x63b3('0x61'));}else if(_0x1a4bfc[_0x63b3('0x62')]&&_0x1a4bfc[_0x63b3('0x63')]){_0x43d4e7[_0x63b3('0x5f')]=moment[_0x63b3('0x60')](moment(_0x1a4bfc[_0x63b3('0x63')],_0x63b3('0x64'))['diff'](moment(_0x1a4bfc[_0x63b3('0x65')],_0x63b3('0x64'))))[_0x63b3('0x66')](_0x63b3('0x61'));}switch(_0x1a4bfc[_0x63b3('0x67')]){case _0x63b3('0x68'):_0x43d4e7[_0x63b3('0x69')]=_0x63b3('0x6a');break;case _0x63b3('0x6b'):case'connect':_0x43d4e7[_0x63b3('0x69')]=_0x63b3('0x6c');break;case _0x63b3('0x6d'):_0x43d4e7['Call_Result']=_0x63b3('0x6e');break;case _0x63b3('0x6f'):_0x43d4e7[_0x63b3('0x69')]=_0x63b3('0x70');break;case _0x63b3('0x71'):_0x43d4e7[_0x63b3('0x69')]=_0x63b3('0x72');default:}_0x43d4e7[_0x63b3('0x73')]=(_0x3d1ea0===_0x63b3('0x74')?moment(_0x1a4bfc[_0x63b3('0x65')])[_0x63b3('0x66')]('YYYY-MM-DDTHH:mm:ss'):moment(_0x1a4bfc[_0x63b3('0x75')])[_0x63b3('0x66')](_0x63b3('0x64')))||moment()[_0x63b3('0x66')](_0x63b3('0x64'));_0x43d4e7[_0x63b3('0x76')]=_0x3d1ea0||_0x63b3('0x77');_0x43d4e7=_[_0x63b3('0x78')](_0x43d4e7,getCustomFields(_0x45ed34[_0x63b3('0x79')],_0x1a4bfc));return request({'method':_0x63b3('0x24'),'uri':_0x63b3('0x41')+_0x520fa8+_0x63b3('0x7a'),'headers':{'Authorization':_0x63b3('0x32')+_0x47b0d1},'body':{'data':[_0x43d4e7]},'json':!![]})['then'](function(_0x5c66b8){if(_0x5c66b8&&_0x5c66b8[_0x63b3('0x3f')][0x0]['code']===_0x63b3('0x7b')){logger['info']('Call\x20created!');return{'id':_0x5c66b8[_0x63b3('0x3f')][0x0]['details']['id']};}})['catch'](function(_0x59ef97){logger[_0x63b3('0x2f')](_0x63b3('0x7c'),_0x59ef97[_0x63b3('0x2e')]);console[_0x63b3('0x7d')]('err',_0x59ef97);});}exports[_0x63b3('0x7e')]=function(_0x1fc499,_0x15948e,_0x5f4c2e,_0x2368e9,_0x545707,_0x2f4cd7){var _0xac2fd1,_0x25fe32,_0x10278f;_0x2f4cd7[_0x63b3('0x7f')]=intUtil[_0x63b3('0x80')](_0x2f4cd7['host']);_0x2f4cd7['serverUrl']=intUtil['stripTrailingSlash'](_0x2f4cd7[_0x63b3('0x81')]);if(_0x545707&&_0x545707[_0x63b3('0x82')]){logger[_0x63b3('0x2f')](_0x63b3('0x83'),'Recording\x20is\x20enabled!');_0x15948e[_0x63b3('0x84')]=_0x2f4cd7[_0x63b3('0x81')]+_0x63b3('0x85')+_0x15948e['uniqueid']+'/downloads?type=uniqueid&token='+md5(_0x15948e[_0x63b3('0x86')]);}else{_0x15948e[_0x63b3('0x84')]='';}var _0x27b1fe=_0x2f4cd7[_0x63b3('0x7f')]==='zoho.eu'?'eu':_0x63b3('0x87');return getAccessToken(_0x2f4cd7)[_0x63b3('0x28')](function(_0x4dfe21){_0x10278f=_0x4dfe21;return getUser(_0x10278f,_0x27b1fe,_0x2f4cd7,_0x2368e9[_0x63b3('0x36')]);})[_0x63b3('0x28')](function(_0x5a444f){_0xac2fd1=_0x5a444f;logger[_0x63b3('0x2f')](_0x63b3('0x88'),_0xac2fd1['id']);return getEndUser(_0x10278f,_0x27b1fe,_0x2f4cd7,_0x15948e['calleridname'],_0x15948e[_0x63b3('0x89')],_0xac2fd1,_0x5f4c2e);})['then'](function(_0x449141){_0x25fe32=_0x449141;return getCall(_0x10278f,_0x27b1fe,_0x2f4cd7,_0xac2fd1,_0x25fe32,_0x5f4c2e,_0x15948e,_0x63b3('0x77'));})[_0x63b3('0x28')](function(_0x5759ca){if(_0x5759ca){logger[_0x63b3('0x2f')](_0x63b3('0x8a'),_0x5759ca['id']);logger[_0x63b3('0x2f')]('[QUEUE]',_0x63b3('0x8b'));emit(util[_0x63b3('0x66')](_0x63b3('0x8c'),_0x2368e9[_0x63b3('0x18')]),_0x63b3('0x8d'),{'uri':_0x63b3('0x8e')+_0x2f4cd7[_0x63b3('0x7f')]+'/crm/EntityInfo.do?module=Calls&id='+_0x5759ca['id']});}})[_0x63b3('0x2b')](function(_0x592195){logger['error'](_0x63b3('0x83'),JSON[_0x63b3('0x3d')](_0x592195));});};exports[_0x63b3('0x74')]=function(_0x5216a3,_0x474389,_0x5d8533,_0x253203,_0x36e279,_0x351d81,_0x1716e8){var _0x42775f,_0x364e2b,_0x31668e;_0x351d81['host']=intUtil[_0x63b3('0x80')](_0x351d81[_0x63b3('0x7f')]);_0x351d81['serverUrl']=intUtil[_0x63b3('0x80')](_0x351d81[_0x63b3('0x81')]);if(_0x1716e8&&_0x1716e8['recordingFormat']&&_0x1716e8[_0x63b3('0x8f')]!==_0x63b3('0x90')){logger[_0x63b3('0x2f')](_0x63b3('0x91'),_0x63b3('0x92'));_0x474389[_0x63b3('0x84')]=_0x351d81[_0x63b3('0x81')]+_0x63b3('0x85')+_0x474389[_0x63b3('0x86')]+_0x63b3('0x93')+md5(_0x474389[_0x63b3('0x86')]);}var _0x350662=_0x351d81[_0x63b3('0x7f')]===_0x63b3('0x94')?'eu':_0x63b3('0x87');return getAccessToken(_0x351d81)[_0x63b3('0x28')](function(_0x5765f5){_0x31668e=_0x5765f5;return getUser(_0x31668e,_0x350662,_0x351d81,_0x253203['email']);})[_0x63b3('0x28')](function(_0x182d28){_0x42775f=_0x182d28;logger[_0x63b3('0x2f')](_0x63b3('0x88'),_0x42775f['id']);return getEndUser(_0x31668e,_0x350662,_0x351d81,_0x474389[_0x63b3('0x95')],_0x474389[_0x63b3('0x96')],_0x42775f,_0x5d8533);})[_0x63b3('0x28')](function(_0x1170b9){_0x364e2b=_0x1170b9;return getCall(_0x31668e,_0x350662,_0x351d81,_0x42775f,_0x364e2b,_0x5d8533,_0x474389,_0x63b3('0x97'));})[_0x63b3('0x28')](function(_0x412d94){if(_0x412d94){logger[_0x63b3('0x2f')](_0x63b3('0x8a'),_0x412d94['id']);logger[_0x63b3('0x2f')](_0x63b3('0x91'),_0x63b3('0x8b'));emit(util[_0x63b3('0x66')](_0x63b3('0x8c'),_0x253203['name']),_0x63b3('0x8d'),{'uri':_0x63b3('0x8e')+_0x351d81[_0x63b3('0x7f')]+'/crm/EntityInfo.do?module=Calls&id='+_0x412d94['id']});}})[_0x63b3('0x2b')](function(_0x50b965){logger['error'](_0x63b3('0x91'),JSON['stringify'](_0x50b965));});};exports[_0x63b3('0x98')]=function(_0x19cccd,_0x2adf78,_0x5207e0,_0x5dd783,_0x3d435d,_0xcd8e8f){var _0x248559,_0x1f465c,_0x59eae4;_0xcd8e8f[_0x63b3('0x7f')]=intUtil[_0x63b3('0x80')](_0xcd8e8f[_0x63b3('0x7f')]);_0xcd8e8f[_0x63b3('0x81')]=intUtil[_0x63b3('0x80')](_0xcd8e8f[_0x63b3('0x81')]);if(_0x3d435d&&_0x3d435d[_0x63b3('0x82')]){logger['info']('['+_0x2adf78[_0x63b3('0x67')][_0x63b3('0x99')]()+']','Recording\x20is\x20enabled!');_0x2adf78['recordingURL']=_0xcd8e8f['serverUrl']+_0x63b3('0x85')+_0x2adf78[_0x63b3('0x86')]+_0x63b3('0x93')+md5(_0x2adf78[_0x63b3('0x86')]);}else{_0x2adf78[_0x63b3('0x84')]='';}var _0x4d8de3=_0xcd8e8f[_0x63b3('0x7f')]===_0x63b3('0x94')?'eu':_0x63b3('0x87');return getAccessToken(_0xcd8e8f)[_0x63b3('0x28')](function(_0x5579da){_0x59eae4=_0x5579da;return getUser(_0x59eae4,_0x4d8de3,_0xcd8e8f);})[_0x63b3('0x28')](function(_0xb69f62){_0x248559=_0xb69f62;logger['info'](_0x63b3('0x88'),_0x248559['id']);return getEndUser(_0x59eae4,_0x4d8de3,_0xcd8e8f,_0x2adf78[_0x63b3('0x9a')],_0x2adf78[_0x63b3('0x89')],_0x248559,_0x5207e0);})[_0x63b3('0x28')](function(_0xe710af){_0x1f465c=_0xe710af;return getCall(_0x59eae4,_0x4d8de3,_0xcd8e8f,_0x248559,_0x1f465c,_0x5207e0,_0x2adf78,'Inbound');})['then'](function(_0xddd026){if(_0xddd026){logger[_0x63b3('0x2f')](_0x63b3('0x8a'),_0xddd026['id']);}})['catch'](function(_0x32139f){logger[_0x63b3('0x2c')]('['+_0x2adf78[_0x63b3('0x67')][_0x63b3('0x99')]()+']',JSON[_0x63b3('0x3d')](_0x32139f));});}; \ 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 b0aec4d..b32aa8b 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 _0x5c39=['util','shelljs','../../../../config/logger','trigger','data2','data3','render','error','format','%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s','info','%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s'];(function(_0x28c1aa,_0x580bf9){var _0x48e727=function(_0x179f38){while(--_0x179f38){_0x28c1aa['push'](_0x28c1aa['shift']());}};_0x48e727(++_0x580bf9);}(_0x5c39,0x78));var _0x95c3=function(_0x51f1d6,_0x1f1ad2){_0x51f1d6=_0x51f1d6-0x0;var _0x5c680b=_0x5c39[_0x51f1d6];return _0x5c680b;};'use strict';var util=require(_0x95c3('0x0'));var sh=require(_0x95c3('0x1'));var Mustache=require('mustache');var logger=require(_0x95c3('0x2'))(_0x95c3('0x3'));exports['exec']=function(_0x1d345a,_0x3ad106){var _0x17e43b=_0x1d345a[_0x95c3('0x4')]?_0x1d345a[_0x95c3('0x4')]:'Script';var _0x5a8a62=_0x1d345a[_0x95c3('0x5')]?Mustache[_0x95c3('0x6')](_0x1d345a[_0x95c3('0x5')],_0x3ad106):_0x3ad106;sh['exec'](_0x5a8a62,function(_0x262ecb,_0x20b5a4,_0x124822){if(_0x262ecb!==0x0){logger[_0x95c3('0x7')](util[_0x95c3('0x8')](_0x95c3('0x9'),_0x17e43b,_0x5a8a62,_0x262ecb,_0x124822));}else{logger[_0x95c3('0xa')](util[_0x95c3('0x8')](_0x95c3('0xb'),_0x17e43b,_0x5a8a62,_0x20b5a4));}});}; \ No newline at end of file +var _0x0f7b=['data3','error','format','%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s','info','%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s','util','shelljs','mustache','../../../../config/logger','exec','data2'];(function(_0xa656ef,_0x3d31df){var _0x20e81=function(_0x128119){while(--_0x128119){_0xa656ef['push'](_0xa656ef['shift']());}};_0x20e81(++_0x3d31df);}(_0x0f7b,0x66));var _0xb0f7=function(_0x307d86,_0x9264f2){_0x307d86=_0x307d86-0x0;var _0x361745=_0x0f7b[_0x307d86];return _0x361745;};'use strict';var util=require(_0xb0f7('0x0'));var sh=require(_0xb0f7('0x1'));var Mustache=require(_0xb0f7('0x2'));var logger=require(_0xb0f7('0x3'))('trigger');exports[_0xb0f7('0x4')]=function(_0x5c81b1,_0x6e430a){var _0x37f33b=_0x5c81b1[_0xb0f7('0x5')]?_0x5c81b1[_0xb0f7('0x5')]:'Script';var _0x21d1cd=_0x5c81b1['data3']?Mustache['render'](_0x5c81b1[_0xb0f7('0x6')],_0x6e430a):_0x6e430a;sh['exec'](_0x21d1cd,function(_0x7c2568,_0x8d48b2,_0xa1ca36){if(_0x7c2568!==0x0){logger[_0xb0f7('0x7')](util[_0xb0f7('0x8')](_0xb0f7('0x9'),_0x37f33b,_0x21d1cd,_0x7c2568,_0xa1ca36));}else{logger[_0xb0f7('0xa')](util[_0xb0f7('0x8')](_0xb0f7('0xb'),_0x37f33b,_0x21d1cd,_0x8d48b2));}});}; \ 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 68b256e..0948096 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 _0x9e18=['render','data2','data5','number','headers','data6','parse','error','stack','GET','POST','PUT','data7','body','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','stringify','then','isNil',',\x20request\x20body:\x20','object','info','%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s','catch','format','name','message','util','lodash','mustache','trigger','exec','data1','toUpperCase'];(function(_0x32b542,_0x4512fa){var _0x554d54=function(_0x35cdfc){while(--_0x35cdfc){_0x32b542['push'](_0x32b542['shift']());}};_0x554d54(++_0x4512fa);}(_0x9e18,0x101));var _0x89e1=function(_0x39ec06,_0xa5e032){_0x39ec06=_0x39ec06-0x0;var _0x43c12f=_0x9e18[_0x39ec06];return _0x43c12f;};'use strict';var rp=require('request-promise');var util=require(_0x89e1('0x0'));var _=require(_0x89e1('0x1'));var Mustache=require(_0x89e1('0x2'));var logger=require('../../../../config/logger')(_0x89e1('0x3'));exports[_0x89e1('0x4')]=function(_0x22f680,_0xc739d9){var _0x162df8,_0x4f4be9;var _0x2ee090={'method':_0x22f680[_0x89e1('0x5')][_0x89e1('0x6')](),'uri':Mustache[_0x89e1('0x7')](_0x22f680[_0x89e1('0x8')],_0xc739d9),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x22f680[_0x89e1('0x9')])===_0x89e1('0xa')&&parseInt(_0x22f680['data5'])>=0x1&&parseInt(_0x22f680['data5'])<=0xa?parseInt(_0x22f680['data5'])*0x3e8:0x5*0x3e8};try{_0x2ee090[_0x89e1('0xb')]=_0x22f680[_0x89e1('0xc')]?JSON[_0x89e1('0xd')](Mustache[_0x89e1('0x7')](_0x22f680['data6'],_0xc739d9)):{};}catch(_0x87437a){logger[_0x89e1('0xe')](_0x87437a[_0x89e1('0xf')]);}switch(_0x22f680[_0x89e1('0x5')][_0x89e1('0x6')]()){case _0x89e1('0x10'):case'DELETE':_0x162df8=null;_0x2ee090['qs']=_0xc739d9;break;case _0x89e1('0x11'):case _0x89e1('0x12'):if(_0x22f680[_0x89e1('0x13')]){try{_0x162df8=JSON[_0x89e1('0xd')](Mustache['render'](_0x22f680[_0x89e1('0x13')],_0xc739d9));_0x2ee090[_0x89e1('0x14')]=_0x162df8;}catch(_0xbb7e44){logger['error'](_0xbb7e44['stack']);logger[_0x89e1('0xe')]('body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format');}}else{_0x162df8=_0xc739d9;_0x2ee090[_0x89e1('0x14')]=_0x162df8;}break;}logger['info'](util['format'](_0x89e1('0x15'),_0x22f680[_0x89e1('0x5')],_0x22f680[_0x89e1('0x8')],JSON[_0x89e1('0x16')](_0x2ee090)));rp(_0x2ee090)[_0x89e1('0x17')](function(_0x504f54){_0x162df8=!_[_0x89e1('0x18')](_0x162df8)?_0x89e1('0x19')+_0x162df8:'';_0x4f4be9=typeof _0x504f54[_0x89e1('0x14')]===_0x89e1('0x1a')?JSON[_0x89e1('0x16')](_0x504f54['body']):_0x504f54['body'];logger[_0x89e1('0x1b')](util['format'](_0x89e1('0x1c'),_0x22f680[_0x89e1('0x5')],_0x22f680[_0x89e1('0x8')],_0x504f54['statusCode'],_0x4f4be9));})[_0x89e1('0x1d')](function(_0x301172){logger[_0x89e1('0xe')](util[_0x89e1('0x1e')]('%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s',_0x22f680['data1'],_0x22f680['data2'],_0x301172['statusCode'],_0x301172[_0x89e1('0x1f')],_0x301172[_0x89e1('0x20')]));});}; \ No newline at end of file +var _0xc1b2=['name','message','request-promise','util','lodash','trigger','exec','toUpperCase','render','data2','number','data5','data6','error','stack','data1','GET','DELETE','POST','PUT','data7','parse','body','body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format','format','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','then',',\x20request\x20body:\x20','object','stringify','info','%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s','catch','statusCode'];(function(_0x18e5fc,_0x3cdb1e){var _0x5ada80=function(_0x372019){while(--_0x372019){_0x18e5fc['push'](_0x18e5fc['shift']());}};_0x5ada80(++_0x3cdb1e);}(_0xc1b2,0x1bc));var _0x2c1b=function(_0x4b5b2c,_0x356dc3){_0x4b5b2c=_0x4b5b2c-0x0;var _0x32f5b4=_0xc1b2[_0x4b5b2c];return _0x32f5b4;};'use strict';var rp=require(_0x2c1b('0x0'));var util=require(_0x2c1b('0x1'));var _=require(_0x2c1b('0x2'));var Mustache=require('mustache');var logger=require('../../../../config/logger')(_0x2c1b('0x3'));exports[_0x2c1b('0x4')]=function(_0x5a796c,_0x408190){var _0x821006,_0x4a4534;var _0x2a04cb={'method':_0x5a796c['data1'][_0x2c1b('0x5')](),'uri':Mustache[_0x2c1b('0x6')](_0x5a796c[_0x2c1b('0x7')],_0x408190),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x5a796c['data5'])===_0x2c1b('0x8')&&parseInt(_0x5a796c['data5'])>=0x1&&parseInt(_0x5a796c[_0x2c1b('0x9')])<=0xa?parseInt(_0x5a796c['data5'])*0x3e8:0x5*0x3e8};try{_0x2a04cb['headers']=_0x5a796c[_0x2c1b('0xa')]?JSON['parse'](Mustache[_0x2c1b('0x6')](_0x5a796c[_0x2c1b('0xa')],_0x408190)):{};}catch(_0x1204a8){logger[_0x2c1b('0xb')](_0x1204a8[_0x2c1b('0xc')]);}switch(_0x5a796c[_0x2c1b('0xd')][_0x2c1b('0x5')]()){case _0x2c1b('0xe'):case _0x2c1b('0xf'):_0x821006=null;_0x2a04cb['qs']=_0x408190;break;case _0x2c1b('0x10'):case _0x2c1b('0x11'):if(_0x5a796c[_0x2c1b('0x12')]){try{_0x821006=JSON[_0x2c1b('0x13')](Mustache[_0x2c1b('0x6')](_0x5a796c[_0x2c1b('0x12')],_0x408190));_0x2a04cb[_0x2c1b('0x14')]=_0x821006;}catch(_0x497321){logger[_0x2c1b('0xb')](_0x497321[_0x2c1b('0xc')]);logger[_0x2c1b('0xb')](_0x2c1b('0x15'));}}else{_0x821006=_0x408190;_0x2a04cb[_0x2c1b('0x14')]=_0x821006;}break;}logger['info'](util[_0x2c1b('0x16')](_0x2c1b('0x17'),_0x5a796c['data1'],_0x5a796c[_0x2c1b('0x7')],JSON['stringify'](_0x2a04cb)));rp(_0x2a04cb)[_0x2c1b('0x18')](function(_0x117d4a){_0x821006=!_['isNil'](_0x821006)?_0x2c1b('0x19')+_0x821006:'';_0x4a4534=typeof _0x117d4a[_0x2c1b('0x14')]===_0x2c1b('0x1a')?JSON[_0x2c1b('0x1b')](_0x117d4a[_0x2c1b('0x14')]):_0x117d4a[_0x2c1b('0x14')];logger[_0x2c1b('0x1c')](util['format'](_0x2c1b('0x1d'),_0x5a796c[_0x2c1b('0xd')],_0x5a796c[_0x2c1b('0x7')],_0x117d4a['statusCode'],_0x4a4534));})[_0x2c1b('0x1e')](function(_0x1fb00d){logger[_0x2c1b('0xb')](util[_0x2c1b('0x16')]('%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s',_0x5a796c[_0x2c1b('0xd')],_0x5a796c[_0x2c1b('0x7')],_0x1fb00d[_0x2c1b('0x1f')],_0x1fb00d[_0x2c1b('0x20')],_0x1fb00d[_0x2c1b('0x21')]));});}; \ No newline at end of file diff --git a/server/services/email/client.js b/server/services/email/client.js index efbc51e..4eba4b8 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 _0x3c9c=['error','message','result','exports','../../config/logger','routing','client','http','Request','request','debug','rpc'];(function(_0x5c9ae2,_0x1b4d6b){var _0x5d20e1=function(_0x5a0695){while(--_0x5a0695){_0x5c9ae2['push'](_0x5c9ae2['shift']());}};_0x5d20e1(++_0x1b4d6b);}(_0x3c9c,0x64));var _0xc3c9=function(_0x2a114b,_0x249344){_0x2a114b=_0x2a114b-0x0;var _0x108ba8=_0x3c9c[_0x2a114b];return _0x108ba8;};'use strict';var jayson=require('jayson/promise');var BPromise=require('bluebird');var logger=require(_0xc3c9('0x0'))(_0xc3c9('0x1'));var client=jayson[_0xc3c9('0x2')][_0xc3c9('0x3')]({'port':0x2329});client[_0xc3c9('0x4')]=function(_0x5d9c28,_0xbd7ec6){return new BPromise(function(_0x4e7bdc,_0x4a8fc6){return client[_0xc3c9('0x5')](_0x5d9c28,_0xbd7ec6)['then'](function(_0x132da6){logger[_0xc3c9('0x6')](_0xc3c9('0x7'),_0xc3c9('0x1'),_0x5d9c28,_0xbd7ec6,_0x132da6);if(_0x132da6[_0xc3c9('0x8')]){logger['error'](_0xc3c9('0x7'),_0xc3c9('0x1'),_0x5d9c28,_0x132da6[_0xc3c9('0x8')]['message'],_0xbd7ec6);return _0x4a8fc6(_0x132da6[_0xc3c9('0x8')][_0xc3c9('0x9')]);}else{return _0x4e7bdc(_0x132da6[_0xc3c9('0xa')]);}})['catch'](function(_0x4a8f2a){logger[_0xc3c9('0x8')](_0xc3c9('0x7'),'routing',_0x5d9c28,_0x4a8f2a,_0xbd7ec6);return _0x4a8fc6(_0x4a8f2a);});});};module[_0xc3c9('0xb')]=client; \ No newline at end of file +var _0x9c05=['catch','jayson/promise','bluebird','../../config/logger','routing','client','Request','request','debug','rpc','error','message','result'];(function(_0x502051,_0x22f68e){var _0x948075=function(_0x311dd0){while(--_0x311dd0){_0x502051['push'](_0x502051['shift']());}};_0x948075(++_0x22f68e);}(_0x9c05,0x1ae));var _0x59c0=function(_0x5591ff,_0x2236d2){_0x5591ff=_0x5591ff-0x0;var _0x2b7c7e=_0x9c05[_0x5591ff];return _0x2b7c7e;};'use strict';var jayson=require(_0x59c0('0x0'));var BPromise=require(_0x59c0('0x1'));var logger=require(_0x59c0('0x2'))(_0x59c0('0x3'));var client=jayson[_0x59c0('0x4')]['http']({'port':0x2329});client[_0x59c0('0x5')]=function(_0x3ebba1,_0x3ad0a3){return new BPromise(function(_0x1c2812,_0x409794){return client[_0x59c0('0x6')](_0x3ebba1,_0x3ad0a3)['then'](function(_0x11f1c3){logger[_0x59c0('0x7')](_0x59c0('0x8'),_0x59c0('0x3'),_0x3ebba1,_0x3ad0a3,_0x11f1c3);if(_0x11f1c3['error']){logger[_0x59c0('0x9')]('rpc',_0x59c0('0x3'),_0x3ebba1,_0x11f1c3[_0x59c0('0x9')]['message'],_0x3ad0a3);return _0x409794(_0x11f1c3[_0x59c0('0x9')][_0x59c0('0xa')]);}else{return _0x1c2812(_0x11f1c3[_0x59c0('0xb')]);}})[_0x59c0('0xc')](function(_0x3b5b95){logger[_0x59c0('0x9')]('rpc',_0x59c0('0x3'),_0x3ebba1,_0x3b5b95,_0x3ad0a3);return _0x409794(_0x3b5b95);});});};module['exports']=client; \ No newline at end of file diff --git a/server/services/email/index.js b/server/services/email/index.js index 2f8092a..6160b7b 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 _0x715e=['email','resolve','then','getMailAccounts','mailAccounts','listen','getSettings','loginMailFrequency','error','Email\x20service\x20initialization','./server','./realtime','./lib/email','./rpc/setting','../../config/logger'];(function(_0x3bfe42,_0x1208f8){var _0x4848cd=function(_0x42e3a0){while(--_0x42e3a0){_0x3bfe42['push'](_0x3bfe42['shift']());}};_0x4848cd(++_0x1208f8);}(_0x715e,0x109));var _0xe715=function(_0x53ccf2,_0x13cb67){_0x53ccf2=_0x53ccf2-0x0;var _0x5a2964=_0x715e[_0x53ccf2];return _0x5a2964;};'use strict';var server=require(_0xe715('0x0'));var Realtime=require(_0xe715('0x1'));var EmailChannel=require(_0xe715('0x2'));var mailAccount=require('./rpc/mailAccount');var setting=require(_0xe715('0x3'));var logger=require(_0xe715('0x4'))(_0xe715('0x5'));var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return Promise[_0xe715('0x6')]()[_0xe715('0x7')](mailAccount[_0xe715('0x8')]())['then'](realtime['initMailAccounts']())[_0xe715('0x7')](function(){email['refresh'](realtime[_0xe715('0x9')]);return realtime;});}function main(){return server[_0xe715('0xa')](realtime,email)[_0xe715('0x7')](function(){return initRealtime();})[_0xe715('0x7')](function(){return setting[_0xe715('0xb')]();})['then'](function(_0x51ad4c){return setInterval(initRealtime,_0x51ad4c[_0xe715('0xc')]*0x3e8);})['catch'](function(_0x5ac0b8){logger[_0xe715('0xd')](_0xe715('0xe'),_0x5ac0b8);});}main(); \ No newline at end of file +var _0xc6b7=['email','resolve','then','getMailAccounts','initMailAccounts','refresh','mailAccounts','getSettings','loginMailFrequency','error','Email\x20service\x20initialization','./server','./realtime','./lib/email','./rpc/mailAccount'];(function(_0x366ca4,_0x2f8bd6){var _0x5c025d=function(_0x658e4a){while(--_0x658e4a){_0x366ca4['push'](_0x366ca4['shift']());}};_0x5c025d(++_0x2f8bd6);}(_0xc6b7,0x1cd));var _0x7c6b=function(_0x279ab4,_0x68df8c){_0x279ab4=_0x279ab4-0x0;var _0x6952f8=_0xc6b7[_0x279ab4];return _0x6952f8;};'use strict';var server=require(_0x7c6b('0x0'));var Realtime=require(_0x7c6b('0x1'));var EmailChannel=require(_0x7c6b('0x2'));var mailAccount=require(_0x7c6b('0x3'));var setting=require('./rpc/setting');var logger=require('../../config/logger')(_0x7c6b('0x4'));var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return Promise[_0x7c6b('0x5')]()[_0x7c6b('0x6')](mailAccount[_0x7c6b('0x7')]())[_0x7c6b('0x6')](realtime[_0x7c6b('0x8')]())['then'](function(){email[_0x7c6b('0x9')](realtime[_0x7c6b('0xa')]);return realtime;});}function main(){return server['listen'](realtime,email)[_0x7c6b('0x6')](function(){return initRealtime();})[_0x7c6b('0x6')](function(){return setting[_0x7c6b('0xb')]();})['then'](function(_0x43a305){return setInterval(initRealtime,_0x43a305[_0x7c6b('0xc')]*0x3e8);})['catch'](function(_0x100651){logger[_0x7c6b('0xd')](_0x7c6b('0xe'),_0x100651);});}main(); \ No newline at end of file diff --git a/server/services/email/lib/email.js b/server/services/email/lib/email.js index e57f7fe..a776e38 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 _0x9691=['prototype','name','key','active','Imap','status','messageStatus','total','isNil','stringify','mailAccount:update','refresh','hasOwnProperty','service','provider','custom','imapAccounts','email','box','handleImapBox','handleImapEmail','bind','end','error','handleImapError','disabled','emit','connected','messages','info','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','firstName','lastName','from','notify','Mail\x20accepted\x20from\x20routing','catch','handleImapEnd','lastSync','sendMail','send','verifySmtp','Smtp','verify','verified','exports','moment','bluebird','md5','ioredis','../../../config/environment','../../../config/logger','redis','defaults','localhost','./smtp','../rpc/mailAccount','mailAccounts','smtp'];(function(_0x2816b7,_0x5a22e1){var _0x5ad1d2=function(_0x5aeb12){while(--_0x5aeb12){_0x2816b7['push'](_0x2816b7['shift']());}};_0x5ad1d2(++_0x5a22e1);}(_0x9691,0xa4));var _0x1969=function(_0x10591f,_0xd9c1a5){_0x10591f=_0x10591f-0x0;var _0x404629=_0x9691[_0x10591f];return _0x404629;};'use strict';var _=require('lodash');var moment=require(_0x1969('0x0'));var BPromise=require(_0x1969('0x1'));var md5=require(_0x1969('0x2'));var Redis=require(_0x1969('0x3'));var config=require(_0x1969('0x4'));var logger=require(_0x1969('0x5'))('email');config[_0x1969('0x6')]=_[_0x1969('0x7')](config[_0x1969('0x6')],{'host':_0x1969('0x8'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));var EmailImap=require('./imap');var EmailSmtp=require(_0x1969('0x9'));var mailAccount=require(_0x1969('0xa'));var md5Accounts={};function EmailChannel(_0x5ede60){logger['info']('start\x20email\x20channel');this[_0x1969('0xb')]=_0x5ede60[_0x1969('0xb')];this['imapAccounts']={};this[_0x1969('0xc')]=new EmailSmtp();}EmailChannel[_0x1969('0xd')]['emit']=function(_0x525795){var _0x42d089=this[_0x1969('0xb')][_0x525795];var _0x29abea={'id':_0x42d089['id'],'name':_0x42d089[_0x1969('0xe')],'key':_0x42d089[_0x1969('0xf')],'active':_0x42d089[_0x1969('0x10')],'Imap':{'status':_0x42d089[_0x1969('0x11')][_0x1969('0x12')],'messageStatus':_0x42d089[_0x1969('0x11')][_0x1969('0x13')],'total':_0x42d089['Imap'][_0x1969('0x14')]}};if(_[_0x1969('0x15')](md5Accounts[_0x525795])){md5Accounts[_0x525795]={};}var _0x5d75b6=md5(JSON[_0x1969('0x16')](_0x29abea));if(md5Accounts[_0x525795]['md5']!==_0x5d75b6){md5Accounts[_0x525795][_0x1969('0x2')]=_0x5d75b6;io['emit'](_0x1969('0x17'),_0x29abea);}};EmailChannel[_0x1969('0xd')][_0x1969('0x18')]=function(_0x305ab7){for(var _0xf3d3e in _0x305ab7){if(_0x305ab7[_0x1969('0x19')](_0xf3d3e)){if(_0x305ab7[_0xf3d3e]['Imap']&&_0x305ab7[_0xf3d3e][_0x1969('0x10')]){var _0xa2b6f7=_0x305ab7[_0xf3d3e][_0x1969('0x11')];if(!_0xa2b6f7[_0x1969('0x1a')]&&_0x305ab7[_0xf3d3e][_0x1969('0x1b')]!==_0x1969('0x1c'))_0xa2b6f7['service']=_0x305ab7[_0xf3d3e][_0x1969('0x1b')];if(!this[_0x1969('0x1d')][_0x1969('0x19')](_0xa2b6f7['id'])){this[_0x1969('0x1d')][_0xa2b6f7['id']]=new EmailImap(_0xa2b6f7,_0x305ab7[_0xf3d3e][_0x1969('0x1e')]);this[_0x1969('0x1d')][_0xa2b6f7['id']]['on'](_0x1969('0x1f'),this[_0x1969('0x20')]['bind'](this,_0xf3d3e));this[_0x1969('0x1d')][_0xa2b6f7['id']]['on'](_0x1969('0x1e'),this[_0x1969('0x21')][_0x1969('0x22')](this,_0xf3d3e));this[_0x1969('0x1d')][_0xa2b6f7['id']]['on'](_0x1969('0x23'),this['handleImapEnd'][_0x1969('0x22')](this,_0xf3d3e));this['imapAccounts'][_0xa2b6f7['id']]['on'](_0x1969('0x24'),this[_0x1969('0x25')][_0x1969('0x22')](this,_0xf3d3e));}}else{if(_[_0x1969('0x15')](this[_0x1969('0xb')][_0xf3d3e]['Imap'])){this['mailAccounts'][_0xf3d3e][_0x1969('0x11')]={};}this['mailAccounts'][_0xf3d3e][_0x1969('0x11')][_0x1969('0x12')]=_0x1969('0x26');this[_0x1969('0xb')][_0xf3d3e][_0x1969('0x11')][_0x1969('0x13')]='';this[_0x1969('0x27')](_0xf3d3e);}}}};EmailChannel[_0x1969('0xd')][_0x1969('0x20')]=function(_0x47ea3f,_0x43f516){if(this['mailAccounts'][_0x47ea3f]){this[_0x1969('0xb')][_0x47ea3f][_0x1969('0x11')][_0x1969('0x12')]=_0x1969('0x28');this[_0x1969('0xb')][_0x47ea3f][_0x1969('0x11')]['messageStatus']=_0x43f516['name'];if(_0x43f516['messages']){this[_0x1969('0xb')][_0x47ea3f][_0x1969('0x11')]['total']=_0x43f516[_0x1969('0x29')]['total'];}return this['emit'](_0x47ea3f);}};EmailChannel['prototype'][_0x1969('0x21')]=function(_0x1d6ee5,_0x218877){logger[_0x1969('0x2a')](_0x1969('0x2b'),_0x218877[_0x1969('0x2c')],_0x218877[_0x1969('0x2d')],_0x218877[_0x1969('0x2e')],_0x1d6ee5);if(this[_0x1969('0xb')][_0x1d6ee5]){return mailAccount[_0x1969('0x2f')](_0x1d6ee5,_0x218877)['then'](function(_0xb9884b){if(_0xb9884b){logger[_0x1969('0x2a')](_0x1969('0x30'));}})[_0x1969('0x31')](function(_0x28464d){logger[_0x1969('0x24')]('Mail\x20not\x20accepted\x20from\x20routing\x20%s',JSON[_0x1969('0x16')](_0x28464d));});}};EmailChannel[_0x1969('0xd')][_0x1969('0x32')]=function(_0x637538){if(this['mailAccounts'][_0x637538]&&this['mailAccounts'][_0x637538][_0x1969('0x11')]){if(this['imapAccounts'][this[_0x1969('0xb')][_0x637538][_0x1969('0x11')]['id']]){delete this[_0x1969('0x1d')][this[_0x1969('0xb')][_0x637538][_0x1969('0x11')]['id']];}this[_0x1969('0xb')][_0x637538][_0x1969('0x11')][_0x1969('0x33')]=moment();this['emit'](_0x637538);}};EmailChannel[_0x1969('0xd')][_0x1969('0x25')]=function(_0x49af2b,_0x1c9bf6){if(this['mailAccounts'][_0x49af2b]){this['mailAccounts'][_0x49af2b][_0x1969('0x11')]['status']=_0x1969('0x24');this[_0x1969('0xb')][_0x49af2b]['Imap'][_0x1969('0x13')]=_0x1c9bf6;return this[_0x1969('0x27')](_0x49af2b);}};EmailChannel[_0x1969('0xd')][_0x1969('0x34')]=function(_0x18660a,_0x546a26){return this[_0x1969('0xc')][_0x1969('0x35')](_0x18660a,_0x546a26);};EmailChannel[_0x1969('0xd')][_0x1969('0x36')]=function(_0x1d60a7){var _0x1215da=this;if(this['mailAccounts'][_0x1d60a7['id']]){if(_[_0x1969('0x15')](this[_0x1969('0xb')][_0x1d60a7['id']][_0x1969('0x37')])){this[_0x1969('0xb')][_0x1d60a7['id']]['Smtp']={};}this['mailAccounts'][_0x1d60a7['id']]['Smtp'][_0x1969('0x33')]=moment();return new BPromise(function(_0x5a6d2a,_0x5bfe24){return _0x1215da[_0x1969('0xc')][_0x1969('0x38')](_0x1d60a7)['then'](function(_0x5a56d0){_0x1215da[_0x1969('0xb')][_0x1d60a7['id']]['Smtp'][_0x1969('0x12')]=_0x1969('0x39');_0x1215da[_0x1969('0xb')][_0x1d60a7['id']][_0x1969('0x37')][_0x1969('0x13')]='';_0x1215da[_0x1969('0x27')](_0x1d60a7['id']);_0x5a6d2a(_0x5a56d0);})[_0x1969('0x31')](function(_0x2bf359){_0x1215da[_0x1969('0xb')][_0x1d60a7['id']][_0x1969('0x37')][_0x1969('0x12')]=_0x1969('0x24');_0x1215da[_0x1969('0xb')][_0x1d60a7['id']]['Smtp'][_0x1969('0x13')]=_0x2bf359;_0x1215da[_0x1969('0x27')](_0x1d60a7['id']);_0x5bfe24(_0x2bf359);});});}return this['smtp'][_0x1969('0x38')](_0x1d60a7);};module[_0x1969('0x3a')]=EmailChannel; \ No newline at end of file +var _0xcc5e=['email','defaults','redis','localhost','socket.io-emitter','./imap','./smtp','../rpc/mailAccount','info','start\x20email\x20channel','mailAccounts','imapAccounts','prototype','emit','name','key','active','Imap','status','messageStatus','total','isNil','mailAccount:update','service','custom','provider','hasOwnProperty','box','handleImapBox','bind','handleImapEmail','end','handleImapEnd','error','disabled','connected','messages','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','firstName','lastName','from','notify','then','catch','Mail\x20not\x20accepted\x20from\x20routing\x20%s','stringify','lastSync','handleImapError','sendMail','smtp','send','verifySmtp','Smtp','verify','exports','lodash','bluebird','md5','ioredis','../../../config/environment','../../../config/logger'];(function(_0x4ff09b,_0x53f67d){var _0x3f5c2e=function(_0x124592){while(--_0x124592){_0x4ff09b['push'](_0x4ff09b['shift']());}};_0x3f5c2e(++_0x53f67d);}(_0xcc5e,0x12b));var _0xecc5=function(_0x40348a,_0x5c0bb3){_0x40348a=_0x40348a-0x0;var _0x290d46=_0xcc5e[_0x40348a];return _0x290d46;};'use strict';var _=require(_0xecc5('0x0'));var moment=require('moment');var BPromise=require(_0xecc5('0x1'));var md5=require(_0xecc5('0x2'));var Redis=require(_0xecc5('0x3'));var config=require(_0xecc5('0x4'));var logger=require(_0xecc5('0x5'))(_0xecc5('0x6'));config['redis']=_[_0xecc5('0x7')](config[_0xecc5('0x8')],{'host':_0xecc5('0x9'),'port':0x18eb});var io=require(_0xecc5('0xa'))(new Redis(config[_0xecc5('0x8')]));var EmailImap=require(_0xecc5('0xb'));var EmailSmtp=require(_0xecc5('0xc'));var mailAccount=require(_0xecc5('0xd'));var md5Accounts={};function EmailChannel(_0x3ab37f){logger[_0xecc5('0xe')](_0xecc5('0xf'));this['mailAccounts']=_0x3ab37f[_0xecc5('0x10')];this[_0xecc5('0x11')]={};this['smtp']=new EmailSmtp();}EmailChannel[_0xecc5('0x12')][_0xecc5('0x13')]=function(_0x9945e6){var _0x330a8c=this[_0xecc5('0x10')][_0x9945e6];var _0x6e64a5={'id':_0x330a8c['id'],'name':_0x330a8c[_0xecc5('0x14')],'key':_0x330a8c[_0xecc5('0x15')],'active':_0x330a8c[_0xecc5('0x16')],'Imap':{'status':_0x330a8c[_0xecc5('0x17')][_0xecc5('0x18')],'messageStatus':_0x330a8c[_0xecc5('0x17')][_0xecc5('0x19')],'total':_0x330a8c[_0xecc5('0x17')][_0xecc5('0x1a')]}};if(_[_0xecc5('0x1b')](md5Accounts[_0x9945e6])){md5Accounts[_0x9945e6]={};}var _0x17610c=md5(JSON['stringify'](_0x6e64a5));if(md5Accounts[_0x9945e6]['md5']!==_0x17610c){md5Accounts[_0x9945e6]['md5']=_0x17610c;io[_0xecc5('0x13')](_0xecc5('0x1c'),_0x6e64a5);}};EmailChannel[_0xecc5('0x12')]['refresh']=function(_0xdbf347){for(var _0x30cee1 in _0xdbf347){if(_0xdbf347['hasOwnProperty'](_0x30cee1)){if(_0xdbf347[_0x30cee1][_0xecc5('0x17')]&&_0xdbf347[_0x30cee1]['active']){var _0x168019=_0xdbf347[_0x30cee1][_0xecc5('0x17')];if(!_0x168019[_0xecc5('0x1d')]&&_0xdbf347[_0x30cee1]['provider']!==_0xecc5('0x1e'))_0x168019['service']=_0xdbf347[_0x30cee1][_0xecc5('0x1f')];if(!this[_0xecc5('0x11')][_0xecc5('0x20')](_0x168019['id'])){this[_0xecc5('0x11')][_0x168019['id']]=new EmailImap(_0x168019,_0xdbf347[_0x30cee1][_0xecc5('0x6')]);this[_0xecc5('0x11')][_0x168019['id']]['on'](_0xecc5('0x21'),this[_0xecc5('0x22')][_0xecc5('0x23')](this,_0x30cee1));this[_0xecc5('0x11')][_0x168019['id']]['on'](_0xecc5('0x6'),this[_0xecc5('0x24')][_0xecc5('0x23')](this,_0x30cee1));this[_0xecc5('0x11')][_0x168019['id']]['on'](_0xecc5('0x25'),this[_0xecc5('0x26')][_0xecc5('0x23')](this,_0x30cee1));this['imapAccounts'][_0x168019['id']]['on'](_0xecc5('0x27'),this['handleImapError'][_0xecc5('0x23')](this,_0x30cee1));}}else{if(_['isNil'](this[_0xecc5('0x10')][_0x30cee1][_0xecc5('0x17')])){this['mailAccounts'][_0x30cee1]['Imap']={};}this[_0xecc5('0x10')][_0x30cee1]['Imap']['status']=_0xecc5('0x28');this[_0xecc5('0x10')][_0x30cee1]['Imap']['messageStatus']='';this[_0xecc5('0x13')](_0x30cee1);}}}};EmailChannel[_0xecc5('0x12')][_0xecc5('0x22')]=function(_0x345f02,_0x194a31){if(this[_0xecc5('0x10')][_0x345f02]){this[_0xecc5('0x10')][_0x345f02]['Imap'][_0xecc5('0x18')]=_0xecc5('0x29');this['mailAccounts'][_0x345f02][_0xecc5('0x17')][_0xecc5('0x19')]=_0x194a31['name'];if(_0x194a31[_0xecc5('0x2a')]){this[_0xecc5('0x10')][_0x345f02]['Imap'][_0xecc5('0x1a')]=_0x194a31[_0xecc5('0x2a')][_0xecc5('0x1a')];}return this[_0xecc5('0x13')](_0x345f02);}};EmailChannel['prototype'][_0xecc5('0x24')]=function(_0x5c8ae5,_0x572d74){logger[_0xecc5('0xe')](_0xecc5('0x2b'),_0x572d74[_0xecc5('0x2c')],_0x572d74[_0xecc5('0x2d')],_0x572d74[_0xecc5('0x2e')],_0x5c8ae5);if(this[_0xecc5('0x10')][_0x5c8ae5]){return mailAccount[_0xecc5('0x2f')](_0x5c8ae5,_0x572d74)[_0xecc5('0x30')](function(_0xd3f219){if(_0xd3f219){logger[_0xecc5('0xe')]('Mail\x20accepted\x20from\x20routing');}})[_0xecc5('0x31')](function(_0x4f6e21){logger['error'](_0xecc5('0x32'),JSON[_0xecc5('0x33')](_0x4f6e21));});}};EmailChannel['prototype'][_0xecc5('0x26')]=function(_0x1b90c1){if(this['mailAccounts'][_0x1b90c1]&&this['mailAccounts'][_0x1b90c1]['Imap']){if(this[_0xecc5('0x11')][this[_0xecc5('0x10')][_0x1b90c1]['Imap']['id']]){delete this[_0xecc5('0x11')][this['mailAccounts'][_0x1b90c1][_0xecc5('0x17')]['id']];}this[_0xecc5('0x10')][_0x1b90c1][_0xecc5('0x17')][_0xecc5('0x34')]=moment();this[_0xecc5('0x13')](_0x1b90c1);}};EmailChannel['prototype'][_0xecc5('0x35')]=function(_0x2ee4dc,_0x1fa3a4){if(this[_0xecc5('0x10')][_0x2ee4dc]){this['mailAccounts'][_0x2ee4dc][_0xecc5('0x17')][_0xecc5('0x18')]=_0xecc5('0x27');this['mailAccounts'][_0x2ee4dc]['Imap'][_0xecc5('0x19')]=_0x1fa3a4;return this[_0xecc5('0x13')](_0x2ee4dc);}};EmailChannel[_0xecc5('0x12')][_0xecc5('0x36')]=function(_0x5ba115,_0x58cf98){return this[_0xecc5('0x37')][_0xecc5('0x38')](_0x5ba115,_0x58cf98);};EmailChannel['prototype'][_0xecc5('0x39')]=function(_0x4bd25c){var _0xd28549=this;if(this[_0xecc5('0x10')][_0x4bd25c['id']]){if(_[_0xecc5('0x1b')](this[_0xecc5('0x10')][_0x4bd25c['id']][_0xecc5('0x3a')])){this[_0xecc5('0x10')][_0x4bd25c['id']][_0xecc5('0x3a')]={};}this[_0xecc5('0x10')][_0x4bd25c['id']][_0xecc5('0x3a')][_0xecc5('0x34')]=moment();return new BPromise(function(_0x1de791,_0x1d8414){return _0xd28549['smtp']['verify'](_0x4bd25c)[_0xecc5('0x30')](function(_0x1af099){_0xd28549[_0xecc5('0x10')][_0x4bd25c['id']][_0xecc5('0x3a')]['status']='verified';_0xd28549[_0xecc5('0x10')][_0x4bd25c['id']][_0xecc5('0x3a')][_0xecc5('0x19')]='';_0xd28549[_0xecc5('0x13')](_0x4bd25c['id']);_0x1de791(_0x1af099);})[_0xecc5('0x31')](function(_0x7902aa){_0xd28549['mailAccounts'][_0x4bd25c['id']][_0xecc5('0x3a')][_0xecc5('0x18')]=_0xecc5('0x27');_0xd28549[_0xecc5('0x10')][_0x4bd25c['id']][_0xecc5('0x3a')]['messageStatus']=_0x7902aa;_0xd28549[_0xecc5('0x13')](_0x4bd25c['id']);_0x1d8414(_0x7902aa);});});}return this[_0xecc5('0x37')][_0xecc5('0x3b')](_0x4bd25c);};module[_0xecc5('0x3c')]=EmailChannel; \ No newline at end of file diff --git a/server/services/email/lib/imap.js b/server/services/email/lib/imap.js index 3dc320a..2ad79db 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 _0x7a54=['once','handleFetchError','closeBox','body','attributes','handleMessageAttributes','handleMessageEnd','handleMessageBody','handleSimpleParser','handleFetchEnd','stringify','textCode','hasOwnProperty','exports','lodash','util','imap','simpleParser','iconv','events','EventEmitter','./utils','../../../config/logger','email','INBOX','account','ready','handleReady','handleEnd','bind','error','handleError','inherits','prototype','getAccount','connTimeout','authTimeout','isNil','service','authentication','user','password','port','tls','autotls','required','modernAuthentication','xoauth2','CloudProvider','data5','host','getHost','anonymous@xcally.com','handleOpenBox','emit','box','readUnseen','handleCloseBox','end','UNSEEN','handleReadUnseen','fetch'];(function(_0x31acc7,_0x168431){var _0x10d549=function(_0x4b5412){while(--_0x4b5412){_0x31acc7['push'](_0x31acc7['shift']());}};_0x10d549(++_0x168431);}(_0x7a54,0x106));var _0x47a5=function(_0x4cd14a,_0x25d74f){_0x4cd14a=_0x4cd14a-0x0;var _0xddeea4=_0x7a54[_0x4cd14a];return _0xddeea4;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var Imap=require(_0x47a5('0x2'));var simpleParser=require('mailparser')[_0x47a5('0x3')];var Iconv=require(_0x47a5('0x4'))['Iconv'];var EventEmitter=require(_0x47a5('0x5'))[_0x47a5('0x6')];var utils=require(_0x47a5('0x7'));var logger=require(_0x47a5('0x8'))(_0x47a5('0x9'));function EmailImap(_0x545a97,_0x3d5629){this['mailbox']=_0x47a5('0xa');this[_0x47a5('0xb')]=this['getAccount'](_0x545a97,_0x3d5629);this[_0x47a5('0x2')]=new Imap(this['account']);this['imap']['once'](_0x47a5('0xc'),this[_0x47a5('0xd')]['bind'](this));this[_0x47a5('0x2')]['once']('end',this[_0x47a5('0xe')][_0x47a5('0xf')](this));this[_0x47a5('0x2')]['on'](_0x47a5('0x10'),this[_0x47a5('0x11')][_0x47a5('0xf')](this));this[_0x47a5('0x2')]['connect']();}util[_0x47a5('0x12')](EmailImap,EventEmitter);EmailImap[_0x47a5('0x13')][_0x47a5('0x14')]=function(_0x711793,_0x139f25){var _0x620ee9={'connTimeout':_0x711793[_0x47a5('0x15')]?_0x711793[_0x47a5('0x15')]*0x3e8:0x2710,'authTimeout':_0x711793['authTimeout']?_0x711793[_0x47a5('0x16')]*0x3e8:0x1388};if(_[_0x47a5('0x17')](_0x711793[_0x47a5('0x18')])){if(_0x711793[_0x47a5('0x19')]){_0x620ee9[_0x47a5('0x1a')]=_0x711793['user'];_0x620ee9['password']=_0x711793[_0x47a5('0x1b')];}_0x620ee9['host']=_0x711793['host'];_0x620ee9[_0x47a5('0x1c')]=_0x711793[_0x47a5('0x1c')]||0x3e1;if(_0x711793[_0x47a5('0x1d')]){_0x620ee9[_0x47a5('0x1d')]=!![];}else{_0x620ee9[_0x47a5('0x1d')]=![];_0x620ee9[_0x47a5('0x1e')]=_0x47a5('0x1f');}}else{if(_0x711793[_0x47a5('0x20')]){_0x620ee9[_0x47a5('0x21')]=utils['generateXOAuth2Token'](_0x711793[_0x47a5('0x22')][_0x47a5('0x23')],_0x711793['user']);_0x620ee9[_0x47a5('0x1a')]=_0x711793[_0x47a5('0x1a')];}else{_0x620ee9[_0x47a5('0x1a')]=_0x711793['user'];_0x620ee9[_0x47a5('0x1b')]=_0x711793[_0x47a5('0x1b')];}_0x620ee9[_0x47a5('0x24')]=utils[_0x47a5('0x25')](_0x711793['service']);_0x620ee9[_0x47a5('0x1c')]=0x3e1;_0x620ee9[_0x47a5('0x1d')]=!![];}_0x620ee9['email']=_0x139f25||_0x711793[_0x47a5('0x1a')]||_0x47a5('0x26');return _0x620ee9;};EmailImap[_0x47a5('0x13')][_0x47a5('0xd')]=function(){this[_0x47a5('0x2')]['openBox'](this['mailbox'],![],this[_0x47a5('0x27')]['bind'](this));};EmailImap[_0x47a5('0x13')]['handleOpenBox']=function(_0x23cb77,_0x378208){if(_0x23cb77){this[_0x47a5('0x11')](_0x23cb77,!![]);}else{this[_0x47a5('0x28')](_0x47a5('0x29'),_0x378208);this[_0x47a5('0x2a')]();}};EmailImap[_0x47a5('0x13')][_0x47a5('0x2b')]=function(_0x16631f){if(_0x16631f){this[_0x47a5('0x11')](_0x16631f,!![]);}else{this[_0x47a5('0x2')][_0x47a5('0x2c')]();}};EmailImap[_0x47a5('0x13')]['readUnseen']=function(){this[_0x47a5('0x2')]['search']([_0x47a5('0x2d')],this[_0x47a5('0x2e')][_0x47a5('0xf')](this));};EmailImap['prototype'][_0x47a5('0x2e')]=function(_0x625952,_0x39b50b){if(_0x625952){this[_0x47a5('0x11')](_0x625952,!![]);}else{if(_0x39b50b['length']){try{var _0x50d875=this[_0x47a5('0x2')][_0x47a5('0x2f')](_0x39b50b,{'bodies':'','markSeen':!![]});_0x50d875['on']('message',this['handleFetchMessage'][_0x47a5('0xf')](this));_0x50d875[_0x47a5('0x30')]('error',this[_0x47a5('0x31')]['bind'](this));_0x50d875[_0x47a5('0x30')](_0x47a5('0x2c'),this['handleFetchEnd']['bind'](this));}catch(_0x274e34){logger['error'](_0x274e34);}}else{this[_0x47a5('0x2')][_0x47a5('0x32')](!![],this[_0x47a5('0x2b')]['bind'](this));}}};EmailImap[_0x47a5('0x13')]['handleFetchMessage']=function(_0x53c754){_0x53c754['on'](_0x47a5('0x33'),this['handleMessageBody'][_0x47a5('0xf')](this));_0x53c754['once'](_0x47a5('0x34'),this[_0x47a5('0x35')][_0x47a5('0xf')](this));_0x53c754[_0x47a5('0x30')](_0x47a5('0x2c'),this[_0x47a5('0x36')][_0x47a5('0xf')](this));};EmailImap[_0x47a5('0x13')][_0x47a5('0x37')]=function(_0x4caed5){simpleParser(_0x4caed5,{'Iconv':Iconv},this[_0x47a5('0x38')][_0x47a5('0xf')](this));};EmailImap['prototype'][_0x47a5('0x35')]=function(){};EmailImap[_0x47a5('0x13')][_0x47a5('0x36')]=function(){};EmailImap['prototype'][_0x47a5('0x38')]=function(_0x10f660,_0x596097){if(_0x10f660){logger[_0x47a5('0x10')](_0x10f660);}else{var _0x19218a=this;utils['parser'](this['account'],_0x596097,function(_0x5ebd8c){_0x19218a[_0x47a5('0x28')]('email',_0x5ebd8c);});}};EmailImap[_0x47a5('0x13')][_0x47a5('0x39')]=function(){this[_0x47a5('0x2')][_0x47a5('0x32')](!![],this[_0x47a5('0x2b')][_0x47a5('0xf')](this));};EmailImap[_0x47a5('0x13')][_0x47a5('0x31')]=function(_0x3fa2a8){this[_0x47a5('0x11')](_0x3fa2a8);this[_0x47a5('0x2')][_0x47a5('0x32')](!![],this[_0x47a5('0x2b')]['bind'](this));};EmailImap[_0x47a5('0x13')][_0x47a5('0xe')]=function(){this[_0x47a5('0x28')](_0x47a5('0x2c'));};EmailImap['prototype'][_0x47a5('0x11')]=function(_0x528ef3,_0x47c7a2){logger['error']('handleError',this[_0x47a5('0xb')]['email'],JSON[_0x47a5('0x3a')](_0x528ef3));var _0x3a740b='';if(_0x528ef3){if(_0x528ef3[_0x47a5('0x3b')]){_0x3a740b=_0x528ef3['textCode'];}else{for(var _0x3805fd in _0x528ef3){if(_0x528ef3[_0x47a5('0x3c')](_0x3805fd)){_0x3a740b+=_['upperFirst'](_0x3805fd)+':\x20'+_0x528ef3[_0x3805fd]+'\x0a';}}}}if(_0x47c7a2){this['imap'][_0x47a5('0x2c')]();}else{this['emit'](_0x47a5('0x10'),_0x3a740b);this[_0x47a5('0x28')](_0x47a5('0x2c'));}};module[_0x47a5('0x3d')]=EmailImap; \ No newline at end of file +var _0x31f0=['end','handleEnd','error','handleError','connect','inherits','connTimeout','authTimeout','isNil','service','authentication','user','password','host','port','tls','autotls','required','modernAuthentication','xoauth2','generateXOAuth2Token','CloudProvider','email','anonymous@xcally.com','openBox','handleOpenBox','prototype','emit','readUnseen','handleCloseBox','search','UNSEEN','handleReadUnseen','length','fetch','message','handleFetchMessage','handleFetchError','closeBox','attributes','handleMessageAttributes','handleMessageEnd','handleMessageBody','handleSimpleParser','parser','handleFetchEnd','stringify','textCode','hasOwnProperty','upperFirst','exports','lodash','imap','simpleParser','iconv','Iconv','events','./utils','../../../config/logger','mailbox','account','getAccount','once','ready','handleReady','bind'];(function(_0x311765,_0x58201f){var _0x266f3b=function(_0x451b59){while(--_0x451b59){_0x311765['push'](_0x311765['shift']());}};_0x266f3b(++_0x58201f);}(_0x31f0,0xb7));var _0x031f=function(_0x260fe8,_0x515021){_0x260fe8=_0x260fe8-0x0;var _0x1a8321=_0x31f0[_0x260fe8];return _0x1a8321;};'use strict';var _=require(_0x031f('0x0'));var util=require('util');var Imap=require(_0x031f('0x1'));var simpleParser=require('mailparser')[_0x031f('0x2')];var Iconv=require(_0x031f('0x3'))[_0x031f('0x4')];var EventEmitter=require(_0x031f('0x5'))['EventEmitter'];var utils=require(_0x031f('0x6'));var logger=require(_0x031f('0x7'))('email');function EmailImap(_0x4c0f94,_0x56328c){this[_0x031f('0x8')]='INBOX';this[_0x031f('0x9')]=this[_0x031f('0xa')](_0x4c0f94,_0x56328c);this[_0x031f('0x1')]=new Imap(this[_0x031f('0x9')]);this['imap'][_0x031f('0xb')](_0x031f('0xc'),this[_0x031f('0xd')][_0x031f('0xe')](this));this[_0x031f('0x1')][_0x031f('0xb')](_0x031f('0xf'),this[_0x031f('0x10')]['bind'](this));this[_0x031f('0x1')]['on'](_0x031f('0x11'),this[_0x031f('0x12')][_0x031f('0xe')](this));this[_0x031f('0x1')][_0x031f('0x13')]();}util[_0x031f('0x14')](EmailImap,EventEmitter);EmailImap['prototype'][_0x031f('0xa')]=function(_0x23b40c,_0x17a699){var _0x2e3dfe={'connTimeout':_0x23b40c[_0x031f('0x15')]?_0x23b40c['connTimeout']*0x3e8:0x2710,'authTimeout':_0x23b40c['authTimeout']?_0x23b40c[_0x031f('0x16')]*0x3e8:0x1388};if(_[_0x031f('0x17')](_0x23b40c[_0x031f('0x18')])){if(_0x23b40c[_0x031f('0x19')]){_0x2e3dfe['user']=_0x23b40c[_0x031f('0x1a')];_0x2e3dfe[_0x031f('0x1b')]=_0x23b40c['password'];}_0x2e3dfe[_0x031f('0x1c')]=_0x23b40c['host'];_0x2e3dfe[_0x031f('0x1d')]=_0x23b40c[_0x031f('0x1d')]||0x3e1;if(_0x23b40c[_0x031f('0x1e')]){_0x2e3dfe[_0x031f('0x1e')]=!![];}else{_0x2e3dfe[_0x031f('0x1e')]=![];_0x2e3dfe[_0x031f('0x1f')]=_0x031f('0x20');}}else{if(_0x23b40c[_0x031f('0x21')]){_0x2e3dfe[_0x031f('0x22')]=utils[_0x031f('0x23')](_0x23b40c[_0x031f('0x24')]['data5'],_0x23b40c[_0x031f('0x1a')]);_0x2e3dfe[_0x031f('0x1a')]=_0x23b40c[_0x031f('0x1a')];}else{_0x2e3dfe['user']=_0x23b40c['user'];_0x2e3dfe[_0x031f('0x1b')]=_0x23b40c['password'];}_0x2e3dfe[_0x031f('0x1c')]=utils['getHost'](_0x23b40c['service']);_0x2e3dfe['port']=0x3e1;_0x2e3dfe[_0x031f('0x1e')]=!![];}_0x2e3dfe[_0x031f('0x25')]=_0x17a699||_0x23b40c[_0x031f('0x1a')]||_0x031f('0x26');return _0x2e3dfe;};EmailImap['prototype'][_0x031f('0xd')]=function(){this['imap'][_0x031f('0x27')](this[_0x031f('0x8')],![],this[_0x031f('0x28')]['bind'](this));};EmailImap[_0x031f('0x29')][_0x031f('0x28')]=function(_0x54b44e,_0x3847b2){if(_0x54b44e){this[_0x031f('0x12')](_0x54b44e,!![]);}else{this[_0x031f('0x2a')]('box',_0x3847b2);this[_0x031f('0x2b')]();}};EmailImap[_0x031f('0x29')][_0x031f('0x2c')]=function(_0xaf5bea){if(_0xaf5bea){this[_0x031f('0x12')](_0xaf5bea,!![]);}else{this[_0x031f('0x1')]['end']();}};EmailImap[_0x031f('0x29')][_0x031f('0x2b')]=function(){this[_0x031f('0x1')][_0x031f('0x2d')]([_0x031f('0x2e')],this[_0x031f('0x2f')][_0x031f('0xe')](this));};EmailImap[_0x031f('0x29')][_0x031f('0x2f')]=function(_0xfc4a89,_0x2cf3a8){if(_0xfc4a89){this['handleError'](_0xfc4a89,!![]);}else{if(_0x2cf3a8[_0x031f('0x30')]){try{var _0xe5f11c=this[_0x031f('0x1')][_0x031f('0x31')](_0x2cf3a8,{'bodies':'','markSeen':!![]});_0xe5f11c['on'](_0x031f('0x32'),this[_0x031f('0x33')][_0x031f('0xe')](this));_0xe5f11c[_0x031f('0xb')](_0x031f('0x11'),this[_0x031f('0x34')][_0x031f('0xe')](this));_0xe5f11c[_0x031f('0xb')](_0x031f('0xf'),this['handleFetchEnd'][_0x031f('0xe')](this));}catch(_0xd0ce3b){logger['error'](_0xd0ce3b);}}else{this[_0x031f('0x1')][_0x031f('0x35')](!![],this['handleCloseBox'][_0x031f('0xe')](this));}}};EmailImap[_0x031f('0x29')][_0x031f('0x33')]=function(_0x3ef166){_0x3ef166['on']('body',this['handleMessageBody'][_0x031f('0xe')](this));_0x3ef166['once'](_0x031f('0x36'),this[_0x031f('0x37')][_0x031f('0xe')](this));_0x3ef166['once']('end',this[_0x031f('0x38')]['bind'](this));};EmailImap['prototype'][_0x031f('0x39')]=function(_0x45e3a4){simpleParser(_0x45e3a4,{'Iconv':Iconv},this[_0x031f('0x3a')][_0x031f('0xe')](this));};EmailImap[_0x031f('0x29')][_0x031f('0x37')]=function(){};EmailImap[_0x031f('0x29')]['handleMessageEnd']=function(){};EmailImap[_0x031f('0x29')][_0x031f('0x3a')]=function(_0xb3b188,_0x1e9302){if(_0xb3b188){logger['error'](_0xb3b188);}else{var _0x2be5d1=this;utils[_0x031f('0x3b')](this[_0x031f('0x9')],_0x1e9302,function(_0x5895f6){_0x2be5d1[_0x031f('0x2a')](_0x031f('0x25'),_0x5895f6);});}};EmailImap['prototype'][_0x031f('0x3c')]=function(){this[_0x031f('0x1')]['closeBox'](!![],this['handleCloseBox'][_0x031f('0xe')](this));};EmailImap[_0x031f('0x29')][_0x031f('0x34')]=function(_0x46885f){this[_0x031f('0x12')](_0x46885f);this[_0x031f('0x1')][_0x031f('0x35')](!![],this['handleCloseBox'][_0x031f('0xe')](this));};EmailImap[_0x031f('0x29')]['handleEnd']=function(){this[_0x031f('0x2a')]('end');};EmailImap[_0x031f('0x29')][_0x031f('0x12')]=function(_0x56dd24,_0x1b9b2e){logger[_0x031f('0x11')](_0x031f('0x12'),this['account'][_0x031f('0x25')],JSON[_0x031f('0x3d')](_0x56dd24));var _0x1d3324='';if(_0x56dd24){if(_0x56dd24[_0x031f('0x3e')]){_0x1d3324=_0x56dd24[_0x031f('0x3e')];}else{for(var _0x193b8f in _0x56dd24){if(_0x56dd24[_0x031f('0x3f')](_0x193b8f)){_0x1d3324+=_[_0x031f('0x40')](_0x193b8f)+':\x20'+_0x56dd24[_0x193b8f]+'\x0a';}}}}if(_0x1b9b2e){this[_0x031f('0x1')]['end']();}else{this[_0x031f('0x2a')](_0x031f('0x11'),_0x1d3324);this[_0x031f('0x2a')](_0x031f('0xf'));}};module[_0x031f('0x41')]=EmailImap; \ No newline at end of file diff --git a/server/services/email/lib/smtp.js b/server/services/email/lib/smtp.js index 2693e60..8b05b1e 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 _0x655c=['compile','sendMail','toString','verify','createTransport','nodemailer','prototype','send'];(function(_0x46361e,_0x243aaf){var _0x14e302=function(_0x9ebecf){while(--_0x9ebecf){_0x46361e['push'](_0x46361e['shift']());}};_0x14e302(++_0x243aaf);}(_0x655c,0x1c5));var _0xc655=function(_0x36dcee,_0x3dc487){_0x36dcee=_0x36dcee-0x0;var _0x205d95=_0x655c[_0x36dcee];return _0x205d95;};'use strict';var nodemailer=require(_0xc655('0x0'));var inlineBase64=require('nodemailer-plugin-inline-base64');function EmailSmtp(){}EmailSmtp[_0xc655('0x1')][_0xc655('0x2')]=function(_0x46898e,_0x428dd6){return new Promise(function(_0x539611,_0x40cc22){var _0x5ad384=nodemailer['createTransport'](_0x46898e);_0x5ad384['use'](_0xc655('0x3'),inlineBase64());_0x5ad384[_0xc655('0x4')](_0x428dd6,function(_0x2a9759,_0x4756ea){if(_0x2a9759){_0x40cc22(_0x2a9759[_0xc655('0x5')]());}else{_0x539611(_0x4756ea);}});});};EmailSmtp[_0xc655('0x1')][_0xc655('0x6')]=function(_0x20493b){return new Promise(function(_0xa30e5c,_0x2324ba){var _0x3aeb90=nodemailer[_0xc655('0x7')](_0x20493b);_0x3aeb90[_0xc655('0x6')](function(_0xe532e9,_0x4e5d02){if(_0xe532e9){_0x2324ba(_0xe532e9['toString']());}else{if(_0x4e5d02){_0xa30e5c(_0x4e5d02);}else{_0x2324ba('Not\x20verifired');}}});});};module['exports']=EmailSmtp; \ No newline at end of file +var _0x23f9=['verify','Not\x20verifired','exports','nodemailer','nodemailer-plugin-inline-base64','send','createTransport','use','compile','toString','prototype'];(function(_0x28dc07,_0xc7cbe5){var _0x4ce5e6=function(_0x43e93d){while(--_0x43e93d){_0x28dc07['push'](_0x28dc07['shift']());}};_0x4ce5e6(++_0xc7cbe5);}(_0x23f9,0x14d));var _0x923f=function(_0x1a6f19,_0x2ac3d3){_0x1a6f19=_0x1a6f19-0x0;var _0x5d07e9=_0x23f9[_0x1a6f19];return _0x5d07e9;};'use strict';var nodemailer=require(_0x923f('0x0'));var inlineBase64=require(_0x923f('0x1'));function EmailSmtp(){}EmailSmtp['prototype'][_0x923f('0x2')]=function(_0x9e4d13,_0x152854){return new Promise(function(_0x88d3ae,_0x5a8dfa){var _0x158deb=nodemailer[_0x923f('0x3')](_0x9e4d13);_0x158deb[_0x923f('0x4')](_0x923f('0x5'),inlineBase64());_0x158deb['sendMail'](_0x152854,function(_0x2cce6a,_0x16d117){if(_0x2cce6a){_0x5a8dfa(_0x2cce6a[_0x923f('0x6')]());}else{_0x88d3ae(_0x16d117);}});});};EmailSmtp[_0x923f('0x7')][_0x923f('0x8')]=function(_0x47c05b){return new Promise(function(_0x2fdaf8,_0x2af579){var _0x48e2f1=nodemailer[_0x923f('0x3')](_0x47c05b);_0x48e2f1[_0x923f('0x8')](function(_0x230e9d,_0x13726f){if(_0x230e9d){_0x2af579(_0x230e9d['toString']());}else{if(_0x13726f){_0x2fdaf8(_0x13726f);}else{_0x2af579(_0x923f('0x9'));}}});});};module[_0x923f('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 f7b97b6..ba2a63f 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 _0xda2f=['getHost','gmail','imap.gmail.com','imap.mail.yahoo.com','hotmail','outlook365','outlook.office365.com','127.0.0.1','generateXOAuth2Token','user=','auth=Bearer\x20','utf-8','toString','base64','lodash','moment','randomstring','path','util','node-tnef','../../../config/logger','email','head','address','generate','value','name','substring','indexOf','split','length','slice','Anonymous','pop','isEmpty','anonymous','@xcally.com','test','html','replace','includes','\x20[Attachment:\x20','\x20]','body','Empty\x20message

','Attachments','Data'];(function(_0x23fae9,_0xd56b66){var _0x1f8825=function(_0x4514fd){while(--_0x4514fd){_0x23fae9['push'](_0x23fae9['shift']());}};_0x1f8825(++_0xd56b66);}(_0xda2f,0x1c1));var _0xfda2=function(_0x4d1d36,_0x11a8a9){_0x4d1d36=_0x4d1d36-0x0;var _0x53bfc8=_0xda2f[_0x4d1d36];return _0x53bfc8;};'use strict';var _=require(_0xfda2('0x0'));var moment=require(_0xfda2('0x1'));var random=require(_0xfda2('0x2'));var fs=require('fs');var path=require(_0xfda2('0x3'));var util=require(_0xfda2('0x4'));var tnef=require(_0xfda2('0x5'));var logger=require(_0xfda2('0x6'))(_0xfda2('0x7'));var config=require('../../../config/environment');function getAddress(_0x3ddda1){var _0xc65cf8=_[_0xfda2('0x8')](_0x3ddda1['value']);return _0xc65cf8&&_0xc65cf8[_0xfda2('0x9')]?_0xc65cf8[_0xfda2('0x9')]:'anonymous'+random[_0xfda2('0xa')](0x6)+'@xcally.com';}function getFirstName(_0x1e9cd9){var _0x4db9be=_['head'](_0x1e9cd9[_0xfda2('0xb')]);if(_0x4db9be&&_0x4db9be[_0xfda2('0xc')]){if(_0x4db9be[_0xfda2('0xc')]==_0x4db9be[_0xfda2('0x9')]){return _0x4db9be[_0xfda2('0xc')][_0xfda2('0xd')](0x0,_0x4db9be[_0xfda2('0xc')][_0xfda2('0xe')]('@'));}var _0x3b2363=_0x4db9be['name'][_0xfda2('0xf')](/\s+/);return _0x3b2363[_0xfda2('0x10')]>0x1?_0x3b2363[_0xfda2('0x11')](0x0,-0x1)['join']('\x20'):_0x4db9be[_0xfda2('0xc')];}return _0xfda2('0x12');}function getLastName(_0x1766de){var _0x5ff4a2=_['head'](_0x1766de[_0xfda2('0xb')]);if(_0x5ff4a2&&_0x5ff4a2['name']){var _0x2c5a50=_0x5ff4a2[_0xfda2('0xc')][_0xfda2('0xf')](/\s+/);return _0x2c5a50[_0xfda2('0x10')]>0x1?_0x2c5a50[_0xfda2('0x13')]():'';}return'';}function getMails(_0x28b6ca,_0x16ca2a){var _0x2718b2='';for(var _0x53195d=0x0;_0x53195d<_0x16ca2a[_0xfda2('0xb')][_0xfda2('0x10')];_0x53195d+=0x1){if(_0x16ca2a[_0xfda2('0xb')][_0x53195d][_0xfda2('0x9')]!==_0x28b6ca){if(!_[_0xfda2('0x14')](_0x2718b2)){_0x2718b2+=',';}_0x2718b2+=_0x16ca2a[_0xfda2('0xb')][_0x53195d][_0xfda2('0xc')]||_0x16ca2a[_0xfda2('0xb')][_0x53195d][_0xfda2('0x9')]||'';_0x2718b2+='\x20<';_0x2718b2+=_0x16ca2a[_0xfda2('0xb')][_0x53195d][_0xfda2('0x9')]?_0x16ca2a[_0xfda2('0xb')][_0x53195d][_0xfda2('0x9')]:_0xfda2('0x15')+random['generate'](0x6)+_0xfda2('0x16');_0x2718b2+='>';}}return _0x2718b2;}function parseEmail(_0x367c13,_0x1dfca1,_0x417610){if(_0x1dfca1['html']){var _0x5c85d6=/)<[^<]*)*<\/script>/gi;while(_0x5c85d6[_0xfda2('0x17')](_0x1dfca1[_0xfda2('0x18')])){_0x1dfca1[_0xfda2('0x18')]=_0x1dfca1[_0xfda2('0x18')][_0xfda2('0x19')](_0x5c85d6,'');}if(_0x1dfca1[_0xfda2('0x18')][_0xfda2('0x1a')](_0xfda2('0x1b'))){var _0x1cf392=[];_0x1dfca1[_0xfda2('0x1c')][_0xfda2('0x1d')](_0x4e2a35=>{_0x1cf392[_0xfda2('0x1e')](_0x4e2a35[_0xfda2('0x1f')]);});var _0x11111a=/]+>/g;var _0x46fadc=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0x473bb5=_0x1dfca1[_0xfda2('0x18')][_0xfda2('0x19')](_0x46fadc,_0xfda2('0x20'));var _0x479c12=_0x473bb5[_0xfda2('0x19')](_0x11111a,_0xfda2('0x21'));for(let _0x4bc3b1=0x0;_0x4bc3b1<_0x1cf392[_0xfda2('0x10')];_0x4bc3b1++){var _0x26d75d=_0x479c12[_0xfda2('0x19')](_0xfda2('0x21'),_0xfda2('0x22')+_0x1cf392[_0x4bc3b1]+_0xfda2('0x23'));_0x479c12=_0x26d75d;}_0x1dfca1[_0xfda2('0x18')]=_0x479c12;}_0x417610[_0xfda2('0x24')]=_0x1dfca1[_0xfda2('0x18')];}else{_0x417610['body']=_0x1dfca1['textAsHtml'];}if(_0x417610[_0xfda2('0x24')]){_0x417610['body']=_0x417610['body']['replace'](/0x0){var _0x3402cc=[_0xfda2('0x35'),_0xfda2('0x36'),'Precedence:\x20auto_reply'];for(var _0x2364a2=0x0;_0x2364a2<_0x1dfca1[_0xfda2('0x34')][_0xfda2('0x10')];_0x2364a2++){var _0x537dc2=_['indexOf'](_0x3402cc,_0x1dfca1[_0xfda2('0x34')][_0x2364a2][_0xfda2('0x37')]);if(_0x537dc2>=0x0){_0x417610[_0xfda2('0x38')]=!![];}}}return _0x417610;}exports[_0xfda2('0x39')]=function(_0x1b3886,_0x3b2518,_0x2d3bb5){var _0x498408={'from':getAddress(_0x3b2518[_0xfda2('0x3a')]),'firstName':getFirstName(_0x3b2518[_0xfda2('0x3a')]),'lastName':getLastName(_0x3b2518[_0xfda2('0x3a')]),'mapKey':_0xfda2('0x7'),'message':{'from':getMails(_0x1b3886[_0xfda2('0x7')],_0x3b2518[_0xfda2('0x3a')]),'to':_0x1b3886[_0xfda2('0x7')],'cc':'','subject':_0x3b2518[_0xfda2('0x3b')]||'','messageId':_0x3b2518[_0xfda2('0x3c')],'inReplyTo':_0x3b2518[_0xfda2('0x3d')],'sentAt':moment(_0x3b2518['date'])['format'](_0xfda2('0x3e')),'attach':![],'attachments':[]}};if(!_0x3b2518[_0xfda2('0x18')]&&!_0x3b2518[_0xfda2('0x3f')]){var _0x5ef387=_['filter'](_0x3b2518[_0xfda2('0x1c')],{'contentType':'application/ms-tnef'});if(_0x5ef387[_0xfda2('0x10')]){logger[_0xfda2('0x40')](util['format'](_0xfda2('0x41'),_0x3b2518[_0xfda2('0x3c')]));tnef[_0xfda2('0x42')](_[_0xfda2('0x43')](_0x5ef387)[_0xfda2('0x44')],function(_0x404a00,_0x3ce3a3){if(_0x3ce3a3){_0x3b2518[_0xfda2('0x18')]=_0x3ce3a3[_0xfda2('0x45')]||_0xfda2('0x46');if(_0x3ce3a3[_0xfda2('0x47')]){for(var _0x1c514b=0x0;_0x1c514b<_0x3ce3a3['Attachments'][_0xfda2('0x10')];_0x1c514b++){var _0x239014=_0x3ce3a3[_0xfda2('0x47')][_0x1c514b];_0x498408[_0xfda2('0x26')][_0xfda2('0x1c')][_0xfda2('0x1e')]({'filename':_0x239014['Title'],'content':Buffer[_0xfda2('0x3a')](_0x239014[_0xfda2('0x48')])});}}}_0x2d3bb5(parseEmail(_0x1b3886,_0x3b2518,_0x498408));});}else{_0x3b2518[_0xfda2('0x18')]='

Empty\x20message

';_0x2d3bb5(parseEmail(_0x1b3886,_0x3b2518,_0x498408));}}else{_0x2d3bb5(parseEmail(_0x1b3886,_0x3b2518,_0x498408));}};exports[_0xfda2('0x49')]=function(_0x3c04b2){switch(_0x3c04b2){case _0xfda2('0x4a'):return _0xfda2('0x4b');case'yahoo':return _0xfda2('0x4c');case _0xfda2('0x4d'):return'imap-mail.outlook.com';case _0xfda2('0x4e'):return _0xfda2('0x4f');}return _0xfda2('0x50');};exports[_0xfda2('0x51')]=function(_0x576896,_0x1eff5c){var _0x2cdc85=[_0xfda2('0x52')+(_0x1eff5c||''),_0xfda2('0x53')+_0x576896,'',''];return Buffer[_0xfda2('0x3a')](_0x2cdc85[_0xfda2('0x2f')](''),_0xfda2('0x54'))[_0xfda2('0x55')](_0xfda2('0x56'));}; \ No newline at end of file +var _0x9319=['pop','@xcally.com','html','test','replace','includes','\x20[Attachment:\x20','\x20]','body','textAsHtml','Empty\x20message

','Attachments','Title','Data','getHost','gmail','yahoo','imap.mail.yahoo.com','hotmail','outlook365','127.0.0.1','generateXOAuth2Token','user=','auth=Bearer\x20','utf-8','toString','base64','lodash','moment','path','util','node-tnef','email','../../../config/environment','head','value','address','anonymous','generate','name','substring','indexOf','split','slice','join','Anonymous','length'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x9319,0xee));var _0x9931=function(_0x58e86c,_0x54691f){_0x58e86c=_0x58e86c-0x0;var _0x6720d7=_0x9319[_0x58e86c];return _0x6720d7;};'use strict';var _=require(_0x9931('0x0'));var moment=require(_0x9931('0x1'));var random=require('randomstring');var fs=require('fs');var path=require(_0x9931('0x2'));var util=require(_0x9931('0x3'));var tnef=require(_0x9931('0x4'));var logger=require('../../../config/logger')(_0x9931('0x5'));var config=require(_0x9931('0x6'));function getAddress(_0xd26ac){var _0x365376=_[_0x9931('0x7')](_0xd26ac[_0x9931('0x8')]);return _0x365376&&_0x365376[_0x9931('0x9')]?_0x365376[_0x9931('0x9')]:_0x9931('0xa')+random[_0x9931('0xb')](0x6)+'@xcally.com';}function getFirstName(_0x438221){var _0x3a7331=_['head'](_0x438221[_0x9931('0x8')]);if(_0x3a7331&&_0x3a7331[_0x9931('0xc')]){if(_0x3a7331[_0x9931('0xc')]==_0x3a7331[_0x9931('0x9')]){return _0x3a7331[_0x9931('0xc')][_0x9931('0xd')](0x0,_0x3a7331[_0x9931('0xc')][_0x9931('0xe')]('@'));}var _0x17538e=_0x3a7331[_0x9931('0xc')][_0x9931('0xf')](/\s+/);return _0x17538e['length']>0x1?_0x17538e[_0x9931('0x10')](0x0,-0x1)[_0x9931('0x11')]('\x20'):_0x3a7331[_0x9931('0xc')];}return _0x9931('0x12');}function getLastName(_0x34fe86){var _0x5b78ac=_['head'](_0x34fe86['value']);if(_0x5b78ac&&_0x5b78ac[_0x9931('0xc')]){var _0x47314d=_0x5b78ac[_0x9931('0xc')][_0x9931('0xf')](/\s+/);return _0x47314d[_0x9931('0x13')]>0x1?_0x47314d[_0x9931('0x14')]():'';}return'';}function getMails(_0x53bb4c,_0x210802){var _0x78d5b3='';for(var _0x522a25=0x0;_0x522a25<_0x210802['value'][_0x9931('0x13')];_0x522a25+=0x1){if(_0x210802[_0x9931('0x8')][_0x522a25][_0x9931('0x9')]!==_0x53bb4c){if(!_['isEmpty'](_0x78d5b3)){_0x78d5b3+=',';}_0x78d5b3+=_0x210802[_0x9931('0x8')][_0x522a25]['name']||_0x210802['value'][_0x522a25][_0x9931('0x9')]||'';_0x78d5b3+='\x20<';_0x78d5b3+=_0x210802[_0x9931('0x8')][_0x522a25][_0x9931('0x9')]?_0x210802['value'][_0x522a25][_0x9931('0x9')]:_0x9931('0xa')+random['generate'](0x6)+_0x9931('0x15');_0x78d5b3+='>';}}return _0x78d5b3;}function parseEmail(_0x1b6dd7,_0x529094,_0x4fb464){if(_0x529094[_0x9931('0x16')]){var _0x215cfb=/)<[^<]*)*<\/script>/gi;while(_0x215cfb[_0x9931('0x17')](_0x529094[_0x9931('0x16')])){_0x529094[_0x9931('0x16')]=_0x529094[_0x9931('0x16')][_0x9931('0x18')](_0x215cfb,'');}if(_0x529094[_0x9931('0x16')][_0x9931('0x19')](_0x9931('0x1a'))){var _0x269a55=[];_0x529094[_0x9931('0x1b')]['forEach'](_0x480c0e=>{_0x269a55[_0x9931('0x1c')](_0x480c0e['filename']);});var _0x3ceea2=/]+>/g;var _0x5c157f=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0x47b4a2=_0x529094['html'][_0x9931('0x18')](_0x5c157f,_0x9931('0x1d'));var _0x16f86a=_0x47b4a2[_0x9931('0x18')](_0x3ceea2,_0x9931('0x1e'));for(let _0x969f04=0x0;_0x969f04<_0x269a55[_0x9931('0x13')];_0x969f04++){var _0x4d65b6=_0x16f86a[_0x9931('0x18')](_0x9931('0x1e'),_0x9931('0x1f')+_0x269a55[_0x969f04]+_0x9931('0x20'));_0x16f86a=_0x4d65b6;}_0x529094['html']=_0x16f86a;}_0x4fb464['body']=_0x529094[_0x9931('0x16')];}else{_0x4fb464[_0x9931('0x21')]=_0x529094[_0x9931('0x22')];}if(_0x4fb464['body']){_0x4fb464['body']=_0x4fb464[_0x9931('0x21')][_0x9931('0x18')](/0x0){var _0x496d0b=[_0x9931('0x34'),'X-Auto-Response-Suppress:\x20All',_0x9931('0x35')];for(var _0x5a5c13=0x0;_0x5a5c13<_0x529094['headerLines'][_0x9931('0x13')];_0x5a5c13++){var _0x2a2263=_[_0x9931('0xe')](_0x496d0b,_0x529094[_0x9931('0x33')][_0x5a5c13][_0x9931('0x36')]);if(_0x2a2263>=0x0){_0x4fb464['isAutoreply']=!![];}}}return _0x4fb464;}exports[_0x9931('0x37')]=function(_0x28b392,_0x2580bf,_0x240dbc){var _0x47d924={'from':getAddress(_0x2580bf[_0x9931('0x38')]),'firstName':getFirstName(_0x2580bf[_0x9931('0x38')]),'lastName':getLastName(_0x2580bf[_0x9931('0x38')]),'mapKey':_0x9931('0x5'),'message':{'from':getMails(_0x28b392[_0x9931('0x5')],_0x2580bf[_0x9931('0x38')]),'to':_0x28b392[_0x9931('0x5')],'cc':'','subject':_0x2580bf[_0x9931('0x39')]||'','messageId':_0x2580bf[_0x9931('0x3a')],'inReplyTo':_0x2580bf[_0x9931('0x3b')],'sentAt':moment(_0x2580bf[_0x9931('0x3c')])[_0x9931('0x2e')](_0x9931('0x3d')),'attach':![],'attachments':[]}};if(!_0x2580bf[_0x9931('0x16')]&&!_0x2580bf[_0x9931('0x22')]){var _0x227e77=_[_0x9931('0x3e')](_0x2580bf[_0x9931('0x1b')],{'contentType':_0x9931('0x3f')});if(_0x227e77[_0x9931('0x13')]){logger[_0x9931('0x40')](util[_0x9931('0x2e')](_0x9931('0x41'),_0x2580bf[_0x9931('0x3a')]));tnef[_0x9931('0x42')](_[_0x9931('0x43')](_0x227e77)[_0x9931('0x31')],function(_0x5b5e6e,_0xb1832b){if(_0xb1832b){_0x2580bf[_0x9931('0x16')]=_0xb1832b[_0x9931('0x44')]||_0x9931('0x45');if(_0xb1832b[_0x9931('0x46')]){for(var _0x3db1ac=0x0;_0x3db1ac<_0xb1832b[_0x9931('0x46')]['length'];_0x3db1ac++){var _0x5ebdc5=_0xb1832b[_0x9931('0x46')][_0x3db1ac];_0x47d924[_0x9931('0x24')][_0x9931('0x1b')][_0x9931('0x1c')]({'filename':_0x5ebdc5[_0x9931('0x47')],'content':Buffer[_0x9931('0x38')](_0x5ebdc5[_0x9931('0x48')])});}}}_0x240dbc(parseEmail(_0x28b392,_0x2580bf,_0x47d924));});}else{_0x2580bf[_0x9931('0x16')]=_0x9931('0x45');_0x240dbc(parseEmail(_0x28b392,_0x2580bf,_0x47d924));}}else{_0x240dbc(parseEmail(_0x28b392,_0x2580bf,_0x47d924));}};exports[_0x9931('0x49')]=function(_0x36b133){switch(_0x36b133){case _0x9931('0x4a'):return'imap.gmail.com';case _0x9931('0x4b'):return _0x9931('0x4c');case _0x9931('0x4d'):return'imap-mail.outlook.com';case _0x9931('0x4e'):return'outlook.office365.com';}return _0x9931('0x4f');};exports[_0x9931('0x50')]=function(_0x353655,_0xdebb8d){var _0x4d5bc8=[_0x9931('0x51')+(_0xdebb8d||''),_0x9931('0x52')+_0x353655,'',''];return Buffer['from'](_0x4d5bc8['join'](''),_0x9931('0x53'))[_0x9931('0x54')](_0x9931('0x55'));}; \ No newline at end of file diff --git a/server/services/email/model/mailAccount.js b/server/services/email/model/mailAccount.js index a1a0853..e8ea532 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 _0xb67c=['exports','lodash','name','key','SERV','active','Imap','Smtp'];(function(_0x138adb,_0x193fee){var _0x1b27f2=function(_0x5e97a2){while(--_0x5e97a2){_0x138adb['push'](_0x138adb['shift']());}};_0x1b27f2(++_0x193fee);}(_0xb67c,0x129));var _0xcb67=function(_0x4888e0,_0x35f563){_0x4888e0=_0x4888e0-0x0;var _0x346fee=_0xb67c[_0x4888e0];return _0x346fee;};'use strict';var _=require(_0xcb67('0x0'));function MailAccount(_0x281181){this['id']=_0x281181['id']||0x0;this[_0xcb67('0x1')]=_0x281181[_0xcb67('0x1')]||'Service';this[_0xcb67('0x2')]=_0x281181['key']||_0xcb67('0x3');this[_0xcb67('0x4')]=_0x281181['active']||![];this['Imap']=_0x281181[_0xcb67('0x5')]||[];this[_0xcb67('0x6')]=_0x281181[_0xcb67('0x6')]||[];}module[_0xcb67('0x7')]=MailAccount; \ No newline at end of file +var _0x3413=['exports','lodash','name','Service','key','SERV','active','Imap','Smtp'];(function(_0x334841,_0x2bbc4c){var _0x5beb4b=function(_0x4bea72){while(--_0x4bea72){_0x334841['push'](_0x334841['shift']());}};_0x5beb4b(++_0x2bbc4c);}(_0x3413,0x145));var _0x3341=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3413[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x3341('0x0'));function MailAccount(_0x27e8b4){this['id']=_0x27e8b4['id']||0x0;this[_0x3341('0x1')]=_0x27e8b4[_0x3341('0x1')]||_0x3341('0x2');this['key']=_0x27e8b4[_0x3341('0x3')]||_0x3341('0x4');this[_0x3341('0x5')]=_0x27e8b4[_0x3341('0x5')]||![];this[_0x3341('0x6')]=_0x27e8b4[_0x3341('0x6')]||[];this[_0x3341('0x7')]=_0x27e8b4[_0x3341('0x7')]||[];}module[_0x3341('0x8')]=MailAccount; \ No newline at end of file diff --git a/server/services/email/realtime/index.js b/server/services/email/realtime/index.js index 43a256c..3d30d5e 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 _0x11c6=['merge','exports','../model/mailAccount','mailAccounts','hasOwnProperty','prototype','initMailAccounts','isUndefined'];(function(_0xe66cf2,_0x32ba5f){var _0x2d84e7=function(_0x58a7d8){while(--_0x58a7d8){_0xe66cf2['push'](_0xe66cf2['shift']());}};_0x2d84e7(++_0x32ba5f);}(_0x11c6,0xc2));var _0x611c=function(_0x4811fb,_0x347444){_0x4811fb=_0x4811fb-0x0;var _0x5405b7=_0x11c6[_0x4811fb];return _0x5405b7;};'use strict';var _=require('lodash');var MailAccount=require(_0x611c('0x0'));var Realtime=function(){this[_0x611c('0x1')]={};};function freeIsNotKey(_0x298fa5,_0x4a6e87,_0x5039d6){var _0x1c2ac1=_['mapKeys'](_0x298fa5,function(_0x5e7c3a,_0x5d693a){return _0x5e7c3a[_0x5039d6];});for(var _0x170bf9 in _0x4a6e87){if(_0x4a6e87[_0x611c('0x2')](_0x170bf9)){if(!_0x1c2ac1[_0x170bf9]){delete _0x4a6e87[_0x170bf9];}}}}Realtime['prototype']['mergeFromDatabase']=function(_0x4ce594,_0x3b7641){for(var _0x3b9c05 in _0x3b7641){if(_0x4ce594['hasOwnProperty'](_0x3b9c05)){_0x4ce594[_0x3b9c05]=_0x3b7641[_0x3b9c05];}}};Realtime[_0x611c('0x3')][_0x611c('0x4')]=function(){var _0x4e1968=this;return function(_0x576534){if(_0x576534){freeIsNotKey(_0x576534,_0x4e1968[_0x611c('0x1')],'id');for(var _0x4da984=0x0,_0x372b82={},_0x1a5961={};_0x4da984<_0x576534['length'];_0x4da984+=0x1){_0x372b82=_0x576534[_0x4da984];if(_[_0x611c('0x5')](_0x4e1968[_0x611c('0x1')][_0x372b82['id']])){_0x4e1968[_0x611c('0x1')][_0x372b82['id']]=new MailAccount(_0x372b82);}else{_[_0x611c('0x6')](_0x4e1968[_0x611c('0x1')][_0x372b82['id']],_0x372b82);}}}return _0x4e1968[_0x611c('0x1')];};};module[_0x611c('0x7')]=Realtime; \ No newline at end of file +var _0x4ca2=['mergeFromDatabase','initMailAccounts','isUndefined','mailAccounts','merge','exports','lodash','mapKeys','hasOwnProperty'];(function(_0x243b2f,_0x30aa15){var _0xcb3c2d=function(_0x213bb2){while(--_0x213bb2){_0x243b2f['push'](_0x243b2f['shift']());}};_0xcb3c2d(++_0x30aa15);}(_0x4ca2,0x16e));var _0x24ca=function(_0xc3127b,_0x44dbe7){_0xc3127b=_0xc3127b-0x0;var _0x50de6b=_0x4ca2[_0xc3127b];return _0x50de6b;};'use strict';var _=require(_0x24ca('0x0'));var MailAccount=require('../model/mailAccount');var Realtime=function(){this['mailAccounts']={};};function freeIsNotKey(_0x3da6d3,_0x25865c,_0x62928d){var _0x2a8ac5=_[_0x24ca('0x1')](_0x3da6d3,function(_0x573f12,_0x3db31a){return _0x573f12[_0x62928d];});for(var _0x39084f in _0x25865c){if(_0x25865c[_0x24ca('0x2')](_0x39084f)){if(!_0x2a8ac5[_0x39084f]){delete _0x25865c[_0x39084f];}}}}Realtime['prototype'][_0x24ca('0x3')]=function(_0x15f0da,_0x52d86b){for(var _0x4523dd in _0x52d86b){if(_0x15f0da[_0x24ca('0x2')](_0x4523dd)){_0x15f0da[_0x4523dd]=_0x52d86b[_0x4523dd];}}};Realtime['prototype'][_0x24ca('0x4')]=function(){var _0x3fd7bf=this;return function(_0x3d4e99){if(_0x3d4e99){freeIsNotKey(_0x3d4e99,_0x3fd7bf['mailAccounts'],'id');for(var _0x28e317=0x0,_0x1486de={},_0x18e57f={};_0x28e317<_0x3d4e99['length'];_0x28e317+=0x1){_0x1486de=_0x3d4e99[_0x28e317];if(_[_0x24ca('0x5')](_0x3fd7bf[_0x24ca('0x6')][_0x1486de['id']])){_0x3fd7bf[_0x24ca('0x6')][_0x1486de['id']]=new MailAccount(_0x1486de);}else{_[_0x24ca('0x7')](_0x3fd7bf[_0x24ca('0x6')][_0x1486de['id']],_0x1486de);}}}return _0x3fd7bf[_0x24ca('0x6')];};};module[_0x24ca('0x8')]=Realtime; \ No newline at end of file diff --git a/server/services/email/rpc/mailAccount.js b/server/services/email/rpc/mailAccount.js index c9f3442..d9176d9 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 _0x124a=['service','type','data5','MailServerOut','Smtp','getMailAccount','notify','NotifyMailAccount','../client','getMailAccounts','Request','GetMailAccount','name','email','active','ListId','TemplateId','MailServerIn','CloudProvider'];(function(_0x41cc4e,_0x19fc5c){var _0x4a335f=function(_0x28d4f3){while(--_0x28d4f3){_0x41cc4e['push'](_0x41cc4e['shift']());}};_0x4a335f(++_0x19fc5c);}(_0x124a,0x171));var _0xa124=function(_0x44fc33,_0x480283){_0x44fc33=_0x44fc33-0x0;var _0x1e64a1=_0x124a[_0x44fc33];return _0x1e64a1;};'use strict';var client=require(_0xa124('0x0'));exports[_0xa124('0x1')]=function(){return function(){return client[_0xa124('0x2')](_0xa124('0x3'),{'options':{'attributes':['id',_0xa124('0x4'),'provider','service',_0xa124('0x5'),_0xa124('0x6'),'key',_0xa124('0x7'),_0xa124('0x8')],'raw':![],'include':[{'model':_0xa124('0x9'),'as':'Imap','include':[{'model':_0xa124('0xa'),'attributes':['id','name',_0xa124('0xb'),_0xa124('0xc'),_0xa124('0xd')],'as':_0xa124('0xa')}]},{'model':_0xa124('0xe'),'as':_0xa124('0xf'),'include':[{'model':_0xa124('0xa'),'attributes':['id',_0xa124('0x4'),_0xa124('0xb'),_0xa124('0xc'),'data5'],'as':_0xa124('0xa')}]}]},'log':_0xa124('0x10')});};};exports[_0xa124('0x11')]=function(_0x3ddd10,_0x51376b){return client['Request'](_0xa124('0x12'),{'account':{'id':_0x3ddd10},'body':_0x51376b,'log':_0xa124('0x12')});}; \ No newline at end of file +var _0x1f2d=['TemplateId','MailServerIn','Imap','CloudProvider','name','type','data5','MailServerOut','Smtp','getMailAccount','notify','NotifyMailAccount','../client','getMailAccounts','Request','GetMailAccount','provider','service','email','active','key','ListId'];(function(_0x1e33c2,_0x450f43){var _0x3a19f0=function(_0x11cd7f){while(--_0x11cd7f){_0x1e33c2['push'](_0x1e33c2['shift']());}};_0x3a19f0(++_0x450f43);}(_0x1f2d,0x1c4));var _0xd1f2=function(_0x3fa296,_0x2bd315){_0x3fa296=_0x3fa296-0x0;var _0x10b19f=_0x1f2d[_0x3fa296];return _0x10b19f;};'use strict';var client=require(_0xd1f2('0x0'));exports[_0xd1f2('0x1')]=function(){return function(){return client[_0xd1f2('0x2')](_0xd1f2('0x3'),{'options':{'attributes':['id','name',_0xd1f2('0x4'),_0xd1f2('0x5'),_0xd1f2('0x6'),_0xd1f2('0x7'),_0xd1f2('0x8'),_0xd1f2('0x9'),_0xd1f2('0xa')],'raw':![],'include':[{'model':_0xd1f2('0xb'),'as':_0xd1f2('0xc'),'include':[{'model':_0xd1f2('0xd'),'attributes':['id',_0xd1f2('0xe'),_0xd1f2('0x5'),_0xd1f2('0xf'),_0xd1f2('0x10')],'as':_0xd1f2('0xd')}]},{'model':_0xd1f2('0x11'),'as':_0xd1f2('0x12'),'include':[{'model':'CloudProvider','attributes':['id',_0xd1f2('0xe'),_0xd1f2('0x5'),_0xd1f2('0xf'),_0xd1f2('0x10')],'as':'CloudProvider'}]}]},'log':_0xd1f2('0x13')});};};exports[_0xd1f2('0x14')]=function(_0x9b89e1,_0x57bc60){return client[_0xd1f2('0x2')](_0xd1f2('0x15'),{'account':{'id':_0x9b89e1},'body':_0x57bc60,'log':_0xd1f2('0x15')});}; \ No newline at end of file diff --git a/server/services/email/rpc/setting.js b/server/services/email/rpc/setting.js index 9a5c464..e98e725 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 _0x109f=['loginMailFrequency','GetSettings','getSettings','Request','ShowSetting'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x109f,0x1ce));var _0xf109=function(_0x56fd76,_0x54dc38){_0x56fd76=_0x56fd76-0x0;var _0x108057=_0x109f[_0x56fd76];return _0x108057;};'use strict';var client=require('../client');exports[_0xf109('0x0')]=function(){return client[_0xf109('0x1')](_0xf109('0x2'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0xf109('0x3')]},'log':_0xf109('0x4')});}; \ No newline at end of file +var _0x1dc2=['getSettings','Request','ShowSetting','loginMailFrequency','GetSettings'];(function(_0x288237,_0x242392){var _0x23c6d0=function(_0x2d4efc){while(--_0x2d4efc){_0x288237['push'](_0x288237['shift']());}};_0x23c6d0(++_0x242392);}(_0x1dc2,0x19f));var _0x21dc=function(_0x15c8be,_0xff590c){_0x15c8be=_0x15c8be-0x0;var _0x1ecfdf=_0x1dc2[_0x15c8be];return _0x1ecfdf;};'use strict';var client=require('../client');exports[_0x21dc('0x0')]=function(){return client[_0x21dc('0x1')](_0x21dc('0x2'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x21dc('0x3')]},'log':_0x21dc('0x4')});}; \ No newline at end of file diff --git a/server/services/email/server/index.js b/server/services/email/server/index.js index 1da3b28..26e6c11 100644 --- a/server/services/email/server/index.js +++ b/server/services/email/server/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['catch','values','mailAccounts','length','Imap','password','Smtp','pass','server','http','stringify','127.0.0.1','log','Email\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','jayson/promise','bluebird','lodash','listen','sendMail','then','error','Verified'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0xa9e0,0x123));var _0x0a9e=function(_0x220dbb,_0x99328d){_0x220dbb=_0x220dbb-0x0;var _0x2b77de=_0xa9e0[_0x220dbb];return _0x2b77de;};'use strict';var jayson=require(_0x0a9e('0x0'));var BPromise=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var logger=require('../../../config/logger')('email');exports[_0x0a9e('0x3')]=function(_0x4ce2f1,_0x333808){return new BPromise(function(_0x432180,_0x2ab90b){var _0x991246={'SendMail':function(_0x981158){var _0x57b080=this;return new Promise(function(_0x219af0,_0x441e3a){_0x333808[_0x0a9e('0x4')](_0x981158['account'],_0x981158['message'])[_0x0a9e('0x5')](function(_0x56465b){_0x219af0({'code':0xc8,'message':_0x56465b});})['catch'](function(_0x39753a){_0x441e3a(_0x57b080[_0x0a9e('0x6')](0x1f4,_0x39753a));});});},'VerifySmtp':function(_0x307b3e){var _0x3ab53f=this;return new Promise(function(_0xfeb75b,_0xbd1168){_0x333808['verifySmtp'](_0x307b3e['account'])['then'](function(_0x4cfe67){_0xfeb75b({'code':0xc8,'message':_0x0a9e('0x7')});})[_0x0a9e('0x8')](function(_0xd5b662){_0xbd1168(_0x3ab53f[_0x0a9e('0x6')](0x1f4,_0xd5b662));});});},'MailAccounts':function(_0x32d742){return new Promise(function(_0x69aeb7,_0x5db4b0){var _0x4283ce=_[_0x0a9e('0x9')](_0x4ce2f1[_0x0a9e('0xa')]);for(var _0x281129=0x0;_0x281129<_0x4283ce[_0x0a9e('0xb')];_0x281129+=0x1){if(_0x4283ce[_0x281129][_0x0a9e('0xc')]&&_0x4283ce[_0x281129]['Imap'][_0x0a9e('0xd')]){delete _0x4283ce[_0x281129]['Imap'][_0x0a9e('0xd')];}if(_0x4283ce[_0x281129]['Smtp']&&_0x4283ce[_0x281129][_0x0a9e('0xe')][_0x0a9e('0xf')]){delete _0x4283ce[_0x281129]['Smtp'][_0x0a9e('0xf')];}}_0x69aeb7({'count':_0x4283ce['length'],'rows':_0x4283ce});});}};var _0x459eb1=jayson[_0x0a9e('0x10')](_0x991246)[_0x0a9e('0x11')]();_0x459eb1['on'](_0x0a9e('0x6'),function(_0x31b1ca){logger[_0x0a9e('0x6')](JSON[_0x0a9e('0x12')](_0x31b1ca));return _0x2ab90b(_0x31b1ca);});_0x459eb1[_0x0a9e('0x3')](0x232b,_0x0a9e('0x13'),function(){console[_0x0a9e('0x14')](_0x0a9e('0x15'),0x232b);return _0x432180(_0x0a9e('0x16')+0x232b);});});}; \ No newline at end of file +var _0xa9e0=['catch','values','mailAccounts','length','Imap','password','Smtp','pass','server','http','stringify','127.0.0.1','log','Email\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','jayson/promise','bluebird','lodash','listen','sendMail','then','error','Verified'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2160a9,_0x3cbd9e){_0x2160a9=_0x2160a9-0x0;var _0xa88cf7=_0xa9e0[_0x2160a9];return _0xa88cf7;};'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 e69e92e..f953850 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 _0x7aec=['../../config/environment','createServer','timeout','socket.io','redis','localhost','adapter','../../config/triggers','default','../../config/socketio','listening','log','port','exports','lodash','http','express','sticky-session','ioredis'];(function(_0x1a8396,_0x280126){var _0x29ce3=function(_0x2a205a){while(--_0x2a205a){_0x1a8396['push'](_0x1a8396['shift']());}};_0x29ce3(++_0x280126);}(_0x7aec,0x93));var _0xc7ae=function(_0x4c445a,_0x4ee80f){_0x4c445a=_0x4c445a-0x0;var _0x2f611c=_0x7aec[_0x4c445a];return _0x2f611c;};'use strict';var _=require(_0xc7ae('0x0'));var http=require(_0xc7ae('0x1'));var express=require(_0xc7ae('0x2'));var sticky=require(_0xc7ae('0x3'));var Redis=require(_0xc7ae('0x4'));var config=require(_0xc7ae('0x5'));var app=express();var server=http[_0xc7ae('0x6')](app);server[_0xc7ae('0x7')]=0xdbba0;if(sticky['listen'](server,config['port'])){var socketio=require(_0xc7ae('0x8'))(server,{'transports':['websocket','polling']});config[_0xc7ae('0x9')]=_['defaults'](config[_0xc7ae('0x9')],{'host':_0xc7ae('0xa'),'port':0x18eb});socketio[_0xc7ae('0xb')](require('socket.io-redis')({'pubClient':new Redis(config[_0xc7ae('0x9')]),'subClient':new Redis(config[_0xc7ae('0x9')])}));require(_0xc7ae('0xc'))[_0xc7ae('0xd')]();require(_0xc7ae('0xe'))[_0xc7ae('0xd')](socketio);require('../../config/express')['default'](app);require('../../routes')[_0xc7ae('0xd')](app);}else{server['once'](_0xc7ae('0xf'),function(){console[_0xc7ae('0x10')]('Express\x20server\x20listening\x20on\x20port\x20%d!',config[_0xc7ae('0x11')]);});}exports=module[_0xc7ae('0x12')]=app; \ No newline at end of file +var _0x9a1b=['listening','log','Express\x20server\x20listening\x20on\x20port\x20%d!','exports','lodash','express','sticky-session','ioredis','../../config/environment','timeout','listen','port','socket.io','websocket','polling','redis','localhost','../../config/triggers','default','../../config/socketio'];(function(_0x1f5887,_0x2fa1f1){var _0x21774b=function(_0x48a7e5){while(--_0x48a7e5){_0x1f5887['push'](_0x1f5887['shift']());}};_0x21774b(++_0x2fa1f1);}(_0x9a1b,0x194));var _0xb9a1=function(_0x4cabed,_0x4e8a8c){_0x4cabed=_0x4cabed-0x0;var _0x369697=_0x9a1b[_0x4cabed];return _0x369697;};'use strict';var _=require(_0xb9a1('0x0'));var http=require('http');var express=require(_0xb9a1('0x1'));var sticky=require(_0xb9a1('0x2'));var Redis=require(_0xb9a1('0x3'));var config=require(_0xb9a1('0x4'));var app=express();var server=http['createServer'](app);server[_0xb9a1('0x5')]=0xdbba0;if(sticky[_0xb9a1('0x6')](server,config[_0xb9a1('0x7')])){var socketio=require(_0xb9a1('0x8'))(server,{'transports':[_0xb9a1('0x9'),_0xb9a1('0xa')]});config['redis']=_['defaults'](config[_0xb9a1('0xb')],{'host':_0xb9a1('0xc'),'port':0x18eb});socketio['adapter'](require('socket.io-redis')({'pubClient':new Redis(config['redis']),'subClient':new Redis(config[_0xb9a1('0xb')])}));require(_0xb9a1('0xd'))[_0xb9a1('0xe')]();require(_0xb9a1('0xf'))[_0xb9a1('0xe')](socketio);require('../../config/express')[_0xb9a1('0xe')](app);require('../../routes')[_0xb9a1('0xe')](app);}else{server['once'](_0xb9a1('0x10'),function(){console[_0xb9a1('0x11')](_0xb9a1('0x12'),config['port']);});}exports=module[_0xb9a1('0x13')]=app; \ No newline at end of file diff --git a/server/services/routing/client.js b/server/services/routing/client.js index 455b799..e9d05ca 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 _0xff27=['catch','exports','bluebird','../../config/logger','routing','client','http','Request','request','rpc','error','message','result'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xff27,0x161));var _0x7ff2=function(_0x3c8832,_0x16e93e){_0x3c8832=_0x3c8832-0x0;var _0xacf303=_0xff27[_0x3c8832];return _0xacf303;};'use strict';var jayson=require('jayson/promise');var BPromise=require(_0x7ff2('0x0'));var logger=require(_0x7ff2('0x1'))(_0x7ff2('0x2'));var client=jayson[_0x7ff2('0x3')][_0x7ff2('0x4')]({'port':0x2329});client[_0x7ff2('0x5')]=function(_0x6b7291,_0x1194c3){return new BPromise(function(_0x3ab591,_0x4b1398){return client[_0x7ff2('0x6')](_0x6b7291,_0x1194c3)['then'](function(_0x283984){logger['debug'](_0x7ff2('0x7'),'routing',_0x6b7291,_0x1194c3,_0x283984);if(_0x283984[_0x7ff2('0x8')]){logger[_0x7ff2('0x8')](_0x7ff2('0x7'),'routing',_0x6b7291,_0x283984[_0x7ff2('0x8')][_0x7ff2('0x9')],_0x1194c3);return _0x4b1398(_0x283984[_0x7ff2('0x8')][_0x7ff2('0x9')]);}else{return _0x3ab591(_0x283984[_0x7ff2('0xa')]);}})[_0x7ff2('0xb')](function(_0x86ce98){logger[_0x7ff2('0x8')](_0x7ff2('0x7'),_0x7ff2('0x2'),_0x6b7291,_0x86ce98,_0x1194c3);return _0x4b1398(_0x86ce98);});});};module[_0x7ff2('0xc')]=client; \ No newline at end of file +var _0x25c3=['error','message','result','catch','exports','bluebird','../../config/logger','routing','http','Request','then','debug','rpc'];(function(_0xf1f37e,_0x159a20){var _0x2e3a6d=function(_0x4163cd){while(--_0x4163cd){_0xf1f37e['push'](_0xf1f37e['shift']());}};_0x2e3a6d(++_0x159a20);}(_0x25c3,0xd5));var _0x325c=function(_0x4b80de,_0x163b7d){_0x4b80de=_0x4b80de-0x0;var _0x27756b=_0x25c3[_0x4b80de];return _0x27756b;};'use strict';var jayson=require('jayson/promise');var BPromise=require(_0x325c('0x0'));var logger=require(_0x325c('0x1'))(_0x325c('0x2'));var client=jayson['client'][_0x325c('0x3')]({'port':0x2329});client[_0x325c('0x4')]=function(_0x351bc7,_0x7bb49c){return new BPromise(function(_0x2b5b14,_0x31ba16){return client['request'](_0x351bc7,_0x7bb49c)[_0x325c('0x5')](function(_0x2b592e){logger[_0x325c('0x6')](_0x325c('0x7'),'routing',_0x351bc7,_0x7bb49c,_0x2b592e);if(_0x2b592e[_0x325c('0x8')]){logger['error'](_0x325c('0x7'),_0x325c('0x2'),_0x351bc7,_0x2b592e[_0x325c('0x8')][_0x325c('0x9')],_0x7bb49c);return _0x31ba16(_0x2b592e[_0x325c('0x8')][_0x325c('0x9')]);}else{return _0x2b5b14(_0x2b592e[_0x325c('0xa')]);}})[_0x325c('0xb')](function(_0x29016c){logger[_0x325c('0x8')]('rpc',_0x325c('0x2'),_0x351bc7,_0x29016c,_0x7bb49c);return _0x31ba16(_0x29016c);});});};module[_0x325c('0xc')]=client; \ No newline at end of file diff --git a/server/services/routing/index.js b/server/services/routing/index.js index 6693a7a..4e0cd89 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 _0x2812=['./rpc/whatsappQueue','resolve','then','initAgents','getIntervals','initIntervals','getOpenchannelQueues','initOpenchannelQueues','getChatQueues','initChatQueues','getSmsQueues','initSmsQueues','initMailQueues','initFaxQueues','getWhatsappQueues','initWhatsappQueues','listen','log','./server','./realtime','./rpc/interval','./rpc/openchannelQueue','./rpc/chatQueue','./rpc/smsQueue','./rpc/mailQueue'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x2812,0x170));var _0x2281=function(_0x259d17,_0x220710){_0x259d17=_0x259d17-0x0;var _0x407535=_0x2812[_0x259d17];return _0x407535;};'use strict';var BPromise=require('bluebird');var server=require(_0x2281('0x0'));var Realtime=require(_0x2281('0x1'));var user=require('./rpc/user');var interval=require(_0x2281('0x2'));var openchannelQueue=require(_0x2281('0x3'));var chatQueue=require(_0x2281('0x4'));var smsQueue=require(_0x2281('0x5'));var mailQueue=require(_0x2281('0x6'));var faxQueue=require('./rpc/faxQueue');var whatsappQueue=require(_0x2281('0x7'));var realtime=new Realtime();function initRealtime(){return BPromise[_0x2281('0x8')]()[_0x2281('0x9')](user['getAgents']())[_0x2281('0x9')](realtime[_0x2281('0xa')]())[_0x2281('0x9')](interval[_0x2281('0xb')]())[_0x2281('0x9')](realtime[_0x2281('0xc')]())[_0x2281('0x9')](openchannelQueue[_0x2281('0xd')]())[_0x2281('0x9')](realtime[_0x2281('0xe')]())[_0x2281('0x9')](chatQueue[_0x2281('0xf')]())[_0x2281('0x9')](realtime[_0x2281('0x10')]())[_0x2281('0x9')](smsQueue[_0x2281('0x11')]())[_0x2281('0x9')](realtime[_0x2281('0x12')]())[_0x2281('0x9')](mailQueue['getMailQueues']())[_0x2281('0x9')](realtime[_0x2281('0x13')]())['then'](faxQueue['getFaxQueues']())[_0x2281('0x9')](realtime[_0x2281('0x14')]())['then'](whatsappQueue[_0x2281('0x15')]())['then'](realtime[_0x2281('0x16')]())[_0x2281('0x9')](function(){return realtime;});}function main(){return server[_0x2281('0x17')](realtime)[_0x2281('0x9')](function(_0x48af13){return initRealtime();})[_0x2281('0x9')](function(_0x515035){return setInterval(initRealtime,0x1388);})['catch'](function(_0x17a6e3){console[_0x2281('0x18')](_0x17a6e3);});}main(); \ No newline at end of file +var _0x8a93=['./rpc/smsQueue','./rpc/mailQueue','./rpc/faxQueue','./rpc/whatsappQueue','then','initAgents','getIntervals','initIntervals','initOpenchannelQueues','initChatQueues','getSmsQueues','initSmsQueues','getMailQueues','initFaxQueues','getWhatsappQueues','initWhatsappQueues','listen','catch','log','bluebird','./server','./rpc/user','./rpc/interval','./rpc/openchannelQueue','./rpc/chatQueue'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x8a93,0xdb));var _0x38a9=function(_0x2fe5a8,_0x36dfc3){_0x2fe5a8=_0x2fe5a8-0x0;var _0x5cf27c=_0x8a93[_0x2fe5a8];return _0x5cf27c;};'use strict';var BPromise=require(_0x38a9('0x0'));var server=require(_0x38a9('0x1'));var Realtime=require('./realtime');var user=require(_0x38a9('0x2'));var interval=require(_0x38a9('0x3'));var openchannelQueue=require(_0x38a9('0x4'));var chatQueue=require(_0x38a9('0x5'));var smsQueue=require(_0x38a9('0x6'));var mailQueue=require(_0x38a9('0x7'));var faxQueue=require(_0x38a9('0x8'));var whatsappQueue=require(_0x38a9('0x9'));var realtime=new Realtime();function initRealtime(){return BPromise['resolve']()[_0x38a9('0xa')](user['getAgents']())[_0x38a9('0xa')](realtime[_0x38a9('0xb')]())[_0x38a9('0xa')](interval[_0x38a9('0xc')]())[_0x38a9('0xa')](realtime[_0x38a9('0xd')]())[_0x38a9('0xa')](openchannelQueue['getOpenchannelQueues']())['then'](realtime[_0x38a9('0xe')]())['then'](chatQueue['getChatQueues']())[_0x38a9('0xa')](realtime[_0x38a9('0xf')]())[_0x38a9('0xa')](smsQueue[_0x38a9('0x10')]())[_0x38a9('0xa')](realtime[_0x38a9('0x11')]())[_0x38a9('0xa')](mailQueue[_0x38a9('0x12')]())[_0x38a9('0xa')](realtime['initMailQueues']())[_0x38a9('0xa')](faxQueue['getFaxQueues']())[_0x38a9('0xa')](realtime[_0x38a9('0x13')]())[_0x38a9('0xa')](whatsappQueue[_0x38a9('0x14')]())[_0x38a9('0xa')](realtime[_0x38a9('0x15')]())[_0x38a9('0xa')](function(){return realtime;});}function main(){return server[_0x38a9('0x16')](realtime)[_0x38a9('0xa')](function(_0x375f2a){return initRealtime();})[_0x38a9('0xa')](function(_0x5a6c76){return setInterval(initRealtime,0x1388);})[_0x38a9('0x17')](function(_0x1f9f1c){console[_0x38a9('0x18')](_0x1f9f1c);});}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 1ca05c8..f44ac7c 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 _0x2ef3=['next','isEqual','restart','condition','matches','filter','turn','prioritize','findRules','length','priority','toJSON','map','toString','fromJSON','parse','object','exports','lodash','util','events','EventEmitter','isNil','register','ignoreFactChanges','inherits','rules','activeRules','prototype','isArray','concat','push','sync','orderBy','result','clone','consequence','name','index_','nextTick','ruleRef','call'];(function(_0x4cd15c,_0x5c5ea6){var _0xfc1781=function(_0x516142){while(--_0x516142){_0x4cd15c['push'](_0x4cd15c['shift']());}};_0xfc1781(++_0x5c5ea6);}(_0x2ef3,0xba));var _0x32ef=function(_0x47127a,_0x3e8e7b){_0x47127a=_0x47127a-0x0;var _0x39332f=_0x2ef3[_0x47127a];return _0x39332f;};'use strict';var _=require(_0x32ef('0x0'));var util=require(_0x32ef('0x1'));var EventEmitter=require(_0x32ef('0x2'))[_0x32ef('0x3')];function RuleEngine(_0x3944df,_0x38047b){this['init']();if(!_[_0x32ef('0x4')](_0x3944df)){this[_0x32ef('0x5')](_0x3944df);}if(_0x38047b){this['ignoreFactChanges']=_0x38047b[_0x32ef('0x6')];}return this;}util[_0x32ef('0x7')](RuleEngine,EventEmitter);RuleEngine['prototype']['init']=function(_0x2c0089){this[_0x32ef('0x8')]=[];this[_0x32ef('0x9')]=[];};RuleEngine[_0x32ef('0xa')][_0x32ef('0x5')]=function(_0x298066){if(Array[_0x32ef('0xb')](_0x298066)){this[_0x32ef('0x8')]=this[_0x32ef('0x8')][_0x32ef('0xc')](_0x298066);}else if(_0x298066!==null&&_['isObject'](_0x298066)){this['rules'][_0x32ef('0xd')](_0x298066);}this[_0x32ef('0xe')]();};RuleEngine[_0x32ef('0xa')][_0x32ef('0xe')]=function(){this['activeRules']=this[_0x32ef('0x8')]['filter'](function(_0x1a5106){if(_['isNil'](_0x1a5106['on'])){_0x1a5106['on']=!![];}if(_0x1a5106['on']===!![]){return _0x1a5106;}});this[_0x32ef('0x9')]=_[_0x32ef('0xf')](this['activeRules'],['p'],['asc']);};RuleEngine[_0x32ef('0xa')]['execute']=function(_0x326fce,_0x40a6e6){var _0x93d492=![];_0x326fce[_0x32ef('0x10')]=!![];var _0x57aff1=_['clone'](_0x326fce);var _0x531e30=_[_0x32ef('0x11')](_0x326fce);var _0x3950e6=this[_0x32ef('0x9')];var _0x53a5ca=[];var _0x5d559b=this[_0x32ef('0x6')];(function FnRuleLoop(_0x1a9476){var _0x286bfb={'rules':function(){return _0x3950e6;},'rule':function(){return _0x3950e6[_0x1a9476];},'when':function(_0x57863c){if(_0x57863c){var _0xbe37f6=_0x3950e6[_0x1a9476][_0x32ef('0x12')];_0xbe37f6['ruleRef']=_0x3950e6[_0x1a9476]['id']||_0x3950e6[_0x1a9476][_0x32ef('0x13')]||_0x32ef('0x14')+_0x1a9476;process[_0x32ef('0x15')](function(){_0x53a5ca[_0x32ef('0xd')](_0xbe37f6[_0x32ef('0x16')]);_0xbe37f6[_0x32ef('0x17')](_0x57aff1,_0x286bfb);});}else{process['nextTick'](function(){_0x286bfb[_0x32ef('0x18')]();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x93d492=!![];return FnRuleLoop(0x0);},'next':function(_0x5cc3ef){if(!_0x5d559b&&!_[_0x32ef('0x19')](_0x531e30,_0x57aff1)){_0x531e30=_[_0x32ef('0x11')](_0x57aff1);process['nextTick'](function(){_0x286bfb[_0x32ef('0x1a')]();});}else{process[_0x32ef('0x15')](function(){if(_[_0x32ef('0x4')](_0x5cc3ef)){return FnRuleLoop(_0x1a9476+0x1);}else{return FnRuleLoop(_0x5cc3ef);}});}}};if(_0x1a9476<_0x3950e6['length']&&_0x93d492===![]){var _0x57f5e5=_0x3950e6[_0x1a9476][_0x32ef('0x1b')];_0x57f5e5[_0x32ef('0x17')](_0x57aff1,_0x286bfb);}else{process[_0x32ef('0x15')](function(){_0x57aff1['matchPath']=_0x53a5ca;return _0x40a6e6?_0x40a6e6(_0x57aff1):_['noop']();});}}(0x0));};RuleEngine[_0x32ef('0xa')]['findRules']=function(_0x51a412){if(_[_0x32ef('0x4')](_0x51a412)){return this[_0x32ef('0x8')];}else{var _0x371540=_[_0x32ef('0x1c')](_0x51a412);return _[_0x32ef('0x1d')](this[_0x32ef('0x8')],_0x371540);}};RuleEngine[_0x32ef('0xa')][_0x32ef('0x1e')]=function(_0x338f19,_0x2f52d7){var _0x1335e2=_0x338f19==='on'||_0x338f19==='ON'?!![]:![];var _0xba4b3f=this['findRules'](_0x2f52d7);for(var _0xd65fde=0x0,_0x2f5d06=_0xba4b3f['length'];_0xd65fde<_0x2f5d06;_0xd65fde+=0x1){_0xba4b3f[_0xd65fde]['on']=_0x1335e2;}this[_0x32ef('0xe')]();};RuleEngine[_0x32ef('0xa')][_0x32ef('0x1f')]=function(_0x26e207,_0x50a95b){_0x26e207=parseInt(_0x26e207,0xa);var _0x10e38c=this[_0x32ef('0x20')](_0x50a95b);for(var _0x31dbc3=0x0,_0x2ac686=_0x10e38c[_0x32ef('0x21')];_0x31dbc3<_0x2ac686;_0x31dbc3+=0x1){_0x10e38c[_0x31dbc3][_0x32ef('0x22')]=_0x26e207;}this[_0x32ef('0xe')]();};RuleEngine['prototype'][_0x32ef('0x23')]=function(){var _0x537214=this[_0x32ef('0x8')];if(_0x537214 instanceof Array){_0x537214=_0x537214[_0x32ef('0x24')](function(_0x5a9565){_0x5a9565[_0x32ef('0x1b')]=_0x5a9565[_0x32ef('0x1b')][_0x32ef('0x25')]();_0x5a9565[_0x32ef('0x12')]=_0x5a9565[_0x32ef('0x12')]['toString']();return _0x5a9565;});}else if(!_['isNil'](_0x537214)){_0x537214[_0x32ef('0x1b')]=_0x537214['condition'][_0x32ef('0x25')]();_0x537214[_0x32ef('0x12')]=_0x537214[_0x32ef('0x12')][_0x32ef('0x25')]();}return _0x537214;};RuleEngine[_0x32ef('0xa')][_0x32ef('0x26')]=function(_0x566b56){this['init']();if(_['isString'](_0x566b56)){_0x566b56=JSON[_0x32ef('0x27')](_0x566b56);}if(_0x566b56 instanceof Array){_0x566b56=_0x566b56[_0x32ef('0x24')](function(_0x136b02){_0x136b02['condition']=eval('('+_0x136b02['condition']+')');_0x136b02[_0x32ef('0x12')]=eval('('+_0x136b02[_0x32ef('0x12')]+')');return _0x136b02;});}else if(_0x566b56!==null&&typeof _0x566b56==_0x32ef('0x28')){_0x566b56['condition']=eval('('+_0x566b56['condition']+')');_0x566b56[_0x32ef('0x12')]=eval('('+_0x566b56[_0x32ef('0x12')]+')');}this[_0x32ef('0x5')](_0x566b56);};module[_0x32ef('0x29')]=RuleEngine; \ No newline at end of file +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(_0x3af0d0,_0xee84f9){var _0x5533a7=function(_0xe0d1c7){while(--_0xe0d1c7){_0x3af0d0['push'](_0x3af0d0['shift']());}};_0x5533a7(++_0xee84f9);}(_0x5fc3,0xa8));var _0x35fc=function(_0x3511d3,_0x4107ae){_0x3511d3=_0x3511d3-0x0;var _0x5d6321=_0x5fc3[_0x3511d3];return _0x5d6321;};'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 diff --git a/server/services/routing/mailRpc/index.js b/server/services/routing/mailRpc/index.js index 79bce4e..a5b82c0 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 _0x6354=['sendMailMessage','bluebird','client','http','request','then','error','result'];(function(_0x25fd9e,_0x32c7b9){var _0x359d49=function(_0x1de2ef){while(--_0x1de2ef){_0x25fd9e['push'](_0x25fd9e['shift']());}};_0x359d49(++_0x32c7b9);}(_0x6354,0xe9));var _0x4635=function(_0x489e4a,_0x3d214d){_0x489e4a=_0x489e4a-0x0;var _0x463ccc=_0x6354[_0x489e4a];return _0x463ccc;};'use strict';var BPromise=require(_0x4635('0x0'));var jayson=require('jayson/promise');var client=jayson[_0x4635('0x1')][_0x4635('0x2')]({'port':0x232b});function request(_0x1d27b3,_0x20a81e){return new BPromise(function(_0x480c43,_0xf930b2){return client[_0x4635('0x3')](_0x1d27b3,_0x20a81e)[_0x4635('0x4')](function(_0x2666f5){if(_0x2666f5['error']){return _0xf930b2(_0x2666f5[_0x4635('0x5')]['message']);}else{return _0x480c43(_0x2666f5[_0x4635('0x6')]);}})['catch'](function(_0x9f86c5){return _0xf930b2(_0x9f86c5);});});}exports[_0x4635('0x7')]=function(_0x52a235,_0x2526f9){return request('SendMail',{'account':_0x52a235,'message':_0x2526f9});}; \ No newline at end of file +var _0x791e=['result','catch','sendMailMessage','SendMail','jayson/promise','client','http','then','error','message'];(function(_0x512136,_0x2ec76d){var _0x255195=function(_0x20ea61){while(--_0x20ea61){_0x512136['push'](_0x512136['shift']());}};_0x255195(++_0x2ec76d);}(_0x791e,0xae));var _0xe791=function(_0x5934f1,_0x597286){_0x5934f1=_0x5934f1-0x0;var _0x194a46=_0x791e[_0x5934f1];return _0x194a46;};'use strict';var BPromise=require('bluebird');var jayson=require(_0xe791('0x0'));var client=jayson[_0xe791('0x1')][_0xe791('0x2')]({'port':0x232b});function request(_0x4f35e4,_0x30cf2b){return new BPromise(function(_0x4aa8d7,_0x4819ea){return client['request'](_0x4f35e4,_0x30cf2b)[_0xe791('0x3')](function(_0x36488b){if(_0x36488b[_0xe791('0x4')]){return _0x4819ea(_0x36488b['error'][_0xe791('0x5')]);}else{return _0x4aa8d7(_0x36488b[_0xe791('0x6')]);}})[_0xe791('0x7')](function(_0x4fe48e){return _0x4819ea(_0x4fe48e);});});}exports[_0xe791('0x8')]=function(_0xfe288a,_0x453f9a){return request(_0xe791('0x9'),{'account':_0xfe288a,'message':_0x453f9a});}; \ No newline at end of file diff --git a/server/services/routing/model/agent.js b/server/services/routing/model/agent.js index a43906f..868c067 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 _0x59ee=['name','online','voicePause','mailPause','faxPause','smsPause','openchannelPause','chatStatus','unknown','chatStatusTime','chatCapacity','chatCurrentCapacity','mailStatusTime','mailCapacity','faxStatus','faxCapacity','faxCurrentCapacity','smsCapacity','smsCurrentCapacity','whatsappStatus','whatsappStatusTime','whatsappCapacity','whatsappCurrentCapacity','openchannelStatus','openchannelStatusTime','openchannelCapacity','openchannelCurrentCapacity','busy','busyQueue','updateRealtime','CurrentCapacity','Capacity','maxcapacity','working','idle','prototype','chat','fax','sms','whatsapp','length','getChannelStatus','Status','toNumber','format','chatPause','mailStatus','mailCurrentCapacity','faxStatusTime','smsStatus','emit','user:save','lodash','moment','md5','ioredis','../../../config/environment','defaults','localhost','socket.io-emitter','redis'];(function(_0x33e1bb,_0xada0f2){var _0x3a0c10=function(_0x4c553a){while(--_0x4c553a){_0x33e1bb['push'](_0x33e1bb['shift']());}};_0x3a0c10(++_0xada0f2);}(_0x59ee,0x165));var _0xe59e=function(_0x1301aa,_0x4da5c4){_0x1301aa=_0x1301aa-0x0;var _0x5146a1=_0x59ee[_0x1301aa];return _0x5146a1;};'use strict';var _=require(_0xe59e('0x0'));var moment=require(_0xe59e('0x1'));var md5=require(_0xe59e('0x2'));var Redis=require(_0xe59e('0x3'));var config=require(_0xe59e('0x4'));config['redis']=_[_0xe59e('0x5')](config['redis'],{'host':_0xe59e('0x6'),'port':0x18eb});var io=require(_0xe59e('0x7'))(new Redis(config[_0xe59e('0x8')]));function Agent(_0x312fbc){this['id']=_0x312fbc['id']||0x0;this[_0xe59e('0x9')]=_0x312fbc[_0xe59e('0x9')]||'';this[_0xe59e('0xa')]=_0x312fbc[_0xe59e('0xa')]||!![];this[_0xe59e('0xb')]=_0x312fbc[_0xe59e('0xb')]||![];this['chatPause']=_0x312fbc['chatPause']||![];this[_0xe59e('0xc')]=_0x312fbc[_0xe59e('0xc')]||![];this['faxPause']=_0x312fbc[_0xe59e('0xd')]||![];this[_0xe59e('0xe')]=_0x312fbc['smsPause']||![];this[_0xe59e('0xf')]=_0x312fbc[_0xe59e('0xf')]||![];this[_0xe59e('0x10')]=_0xe59e('0x11');this[_0xe59e('0x12')]=0x0;this[_0xe59e('0x13')]=_0x312fbc['chatCapacity']||0x0;this[_0xe59e('0x14')]=0x0;this['mailStatus']=_0xe59e('0x11');this[_0xe59e('0x15')]=0x0;this['mailCapacity']=_0x312fbc[_0xe59e('0x16')]||0x0;this['mailCurrentCapacity']=0x0;this[_0xe59e('0x17')]=_0xe59e('0x11');this['faxStatusTime']=0x0;this[_0xe59e('0x18')]=_0x312fbc[_0xe59e('0x18')]||0x0;this[_0xe59e('0x19')]=0x0;this['smsStatus']=_0xe59e('0x11');this['smsStatusTime']=0x0;this[_0xe59e('0x1a')]=_0x312fbc[_0xe59e('0x1a')]||0x0;this[_0xe59e('0x1b')]=0x0;this[_0xe59e('0x1c')]=_0xe59e('0x11');this[_0xe59e('0x1d')]=0x0;this[_0xe59e('0x1e')]=_0x312fbc[_0xe59e('0x1e')]||0x0;this[_0xe59e('0x1f')]=0x0;this[_0xe59e('0x20')]=_0xe59e('0x11');this[_0xe59e('0x21')]=0x0;this[_0xe59e('0x22')]=_0x312fbc['openchannelCapacity']||0x0;this[_0xe59e('0x23')]=0x0;this[_0xe59e('0x24')]=![];this[_0xe59e('0x25')]=undefined;this[_0xe59e('0x2')]='';this[_0xe59e('0x26')]();}Agent['prototype']['getChannelStatus']=function(_0x34489b){if(this[_0x34489b+_0xe59e('0x27')]>0x0){if(this[_0x34489b+_0xe59e('0x28')]>0x0&&this[_0x34489b+_0xe59e('0x27')]>=this[_0x34489b+'Capacity']){return _0xe59e('0x29');}else{return _0xe59e('0x2a');}}else{return _0xe59e('0x2b');}};Agent[_0xe59e('0x2c')][_0xe59e('0x26')]=function(){var _0x450ff5=['mail',_0xe59e('0x2d'),'openchannel',_0xe59e('0x2e'),_0xe59e('0x2f'),_0xe59e('0x30')];for(var _0x431dd1=0x0;_0x431dd1<_0x450ff5[_0xe59e('0x31')];_0x431dd1+=0x1){var _0x5d6c69=this[_0xe59e('0x32')](_0x450ff5[_0x431dd1]);if(this[_0x450ff5[_0x431dd1]+_0xe59e('0x33')]!==_0x5d6c69){this[_0x450ff5[_0x431dd1]+'StatusTime']=_[_0xe59e('0x34')](moment()[_0xe59e('0x35')]('x'));}this[_0x450ff5[_0x431dd1]+_0xe59e('0x33')]=_0x5d6c69;}var _0x5e433c={'id':this['id'],'name':this[_0xe59e('0x9')],'online':this[_0xe59e('0xa')],'voicePause':this['voicePause'],'chatPause':this[_0xe59e('0x36')],'mailPause':this['mailPause'],'smsPause':this[_0xe59e('0xe')],'faxPause':this['faxPause'],'openchannelPause':this['openchannelPause'],'chatStatus':this[_0xe59e('0x10')],'chatStatusTime':this[_0xe59e('0x12')],'chatCapacity':this['chatCapacity'],'chatCurrentCapacity':this[_0xe59e('0x14')],'mailStatus':this[_0xe59e('0x37')],'mailStatusTime':this[_0xe59e('0x15')],'mailCapacity':this[_0xe59e('0x16')],'mailCurrentCapacity':this[_0xe59e('0x38')],'faxStatus':this[_0xe59e('0x17')],'faxStatusTime':this[_0xe59e('0x39')],'faxCapacity':this['faxCapacity'],'faxCurrentCapacity':this[_0xe59e('0x19')],'smsStatus':this[_0xe59e('0x3a')],'smsStatusTime':this['smsStatusTime'],'smsCapacity':this['smsCapacity'],'smsCurrentCapacity':this[_0xe59e('0x1b')],'whatsappStatus':this[_0xe59e('0x1c')],'whatsappStatusTime':this[_0xe59e('0x1d')],'whatsappCapacity':this['whatsappCapacity'],'whatsappCurrentCapacity':this[_0xe59e('0x1f')],'openchannelStatus':this[_0xe59e('0x20')],'openchannelStatusTime':this[_0xe59e('0x21')],'openchannelCapacity':this[_0xe59e('0x22')],'openchannelCurrentCapacity':this[_0xe59e('0x23')],'busy':this['busy'],'busyQueue':this[_0xe59e('0x25')]};var _0x53a054=md5(JSON['stringify'](_0x5e433c));if(this[_0xe59e('0x2')]!==_0x53a054){this['md5']=_0x53a054;io[_0xe59e('0x3b')](_0xe59e('0x3c'),_0x5e433c);}};module['exports']=Agent; \ No newline at end of file +var _0x6a27=['faxCapacity','faxCurrentCapacity','smsStatus','smsStatusTime','smsCapacity','smsCurrentCapacity','whatsappStatus','whatsappStatusTime','whatsappCapacity','openchannelCapacity','openchannelCurrentCapacity','busyQueue','md5','updateRealtime','prototype','Capacity','CurrentCapacity','maxcapacity','working','idle','chat','openchannel','length','StatusTime','toNumber','format','Status','voicePause','faxStatusTime','whatsappCurrentCapacity','openchannelStatusTime','busy','stringify','emit','user:save','lodash','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','online','chatPause','mailPause','faxPause','smsPause','openchannelPause','chatStatus','unknown','chatStatusTime','chatCapacity','chatCurrentCapacity','mailStatus','mailCapacity','mailCurrentCapacity','faxStatus'];(function(_0x4c9f6a,_0xcb2cb2){var _0x5df5b9=function(_0x303cf2){while(--_0x303cf2){_0x4c9f6a['push'](_0x4c9f6a['shift']());}};_0x5df5b9(++_0xcb2cb2);}(_0x6a27,0x97));var _0x76a2=function(_0x523ed5,_0x2e9c31){_0x523ed5=_0x523ed5-0x0;var _0x2e0f40=_0x6a27[_0x523ed5];return _0x2e0f40;};'use strict';var _=require(_0x76a2('0x0'));var moment=require('moment');var md5=require('md5');var Redis=require(_0x76a2('0x1'));var config=require(_0x76a2('0x2'));config[_0x76a2('0x3')]=_[_0x76a2('0x4')](config[_0x76a2('0x3')],{'host':_0x76a2('0x5'),'port':0x18eb});var io=require(_0x76a2('0x6'))(new Redis(config[_0x76a2('0x3')]));function Agent(_0x9cf6db){this['id']=_0x9cf6db['id']||0x0;this[_0x76a2('0x7')]=_0x9cf6db[_0x76a2('0x7')]||'';this[_0x76a2('0x8')]=_0x9cf6db[_0x76a2('0x8')]||!![];this['voicePause']=_0x9cf6db['voicePause']||![];this['chatPause']=_0x9cf6db[_0x76a2('0x9')]||![];this[_0x76a2('0xa')]=_0x9cf6db['mailPause']||![];this[_0x76a2('0xb')]=_0x9cf6db[_0x76a2('0xb')]||![];this[_0x76a2('0xc')]=_0x9cf6db['smsPause']||![];this[_0x76a2('0xd')]=_0x9cf6db[_0x76a2('0xd')]||![];this[_0x76a2('0xe')]=_0x76a2('0xf');this[_0x76a2('0x10')]=0x0;this[_0x76a2('0x11')]=_0x9cf6db['chatCapacity']||0x0;this[_0x76a2('0x12')]=0x0;this[_0x76a2('0x13')]=_0x76a2('0xf');this['mailStatusTime']=0x0;this[_0x76a2('0x14')]=_0x9cf6db[_0x76a2('0x14')]||0x0;this[_0x76a2('0x15')]=0x0;this[_0x76a2('0x16')]=_0x76a2('0xf');this['faxStatusTime']=0x0;this['faxCapacity']=_0x9cf6db[_0x76a2('0x17')]||0x0;this[_0x76a2('0x18')]=0x0;this[_0x76a2('0x19')]='unknown';this[_0x76a2('0x1a')]=0x0;this[_0x76a2('0x1b')]=_0x9cf6db[_0x76a2('0x1b')]||0x0;this[_0x76a2('0x1c')]=0x0;this[_0x76a2('0x1d')]=_0x76a2('0xf');this[_0x76a2('0x1e')]=0x0;this[_0x76a2('0x1f')]=_0x9cf6db['whatsappCapacity']||0x0;this['whatsappCurrentCapacity']=0x0;this['openchannelStatus']=_0x76a2('0xf');this['openchannelStatusTime']=0x0;this[_0x76a2('0x20')]=_0x9cf6db[_0x76a2('0x20')]||0x0;this[_0x76a2('0x21')]=0x0;this['busy']=![];this[_0x76a2('0x22')]=undefined;this[_0x76a2('0x23')]='';this[_0x76a2('0x24')]();}Agent[_0x76a2('0x25')]['getChannelStatus']=function(_0x1e389d){if(this[_0x1e389d+'CurrentCapacity']>0x0){if(this[_0x1e389d+_0x76a2('0x26')]>0x0&&this[_0x1e389d+_0x76a2('0x27')]>=this[_0x1e389d+_0x76a2('0x26')]){return _0x76a2('0x28');}else{return _0x76a2('0x29');}}else{return _0x76a2('0x2a');}};Agent['prototype'][_0x76a2('0x24')]=function(){var _0x4773c2=['mail',_0x76a2('0x2b'),_0x76a2('0x2c'),'fax','sms','whatsapp'];for(var _0x19d658=0x0;_0x19d658<_0x4773c2[_0x76a2('0x2d')];_0x19d658+=0x1){var _0x4c6931=this['getChannelStatus'](_0x4773c2[_0x19d658]);if(this[_0x4773c2[_0x19d658]+'Status']!==_0x4c6931){this[_0x4773c2[_0x19d658]+_0x76a2('0x2e')]=_[_0x76a2('0x2f')](moment()[_0x76a2('0x30')]('x'));}this[_0x4773c2[_0x19d658]+_0x76a2('0x31')]=_0x4c6931;}var _0x1f4999={'id':this['id'],'name':this['name'],'online':this[_0x76a2('0x8')],'voicePause':this[_0x76a2('0x32')],'chatPause':this['chatPause'],'mailPause':this[_0x76a2('0xa')],'smsPause':this['smsPause'],'faxPause':this[_0x76a2('0xb')],'openchannelPause':this['openchannelPause'],'chatStatus':this['chatStatus'],'chatStatusTime':this[_0x76a2('0x10')],'chatCapacity':this[_0x76a2('0x11')],'chatCurrentCapacity':this['chatCurrentCapacity'],'mailStatus':this[_0x76a2('0x13')],'mailStatusTime':this['mailStatusTime'],'mailCapacity':this[_0x76a2('0x14')],'mailCurrentCapacity':this[_0x76a2('0x15')],'faxStatus':this[_0x76a2('0x16')],'faxStatusTime':this[_0x76a2('0x33')],'faxCapacity':this[_0x76a2('0x17')],'faxCurrentCapacity':this[_0x76a2('0x18')],'smsStatus':this['smsStatus'],'smsStatusTime':this[_0x76a2('0x1a')],'smsCapacity':this[_0x76a2('0x1b')],'smsCurrentCapacity':this[_0x76a2('0x1c')],'whatsappStatus':this[_0x76a2('0x1d')],'whatsappStatusTime':this[_0x76a2('0x1e')],'whatsappCapacity':this[_0x76a2('0x1f')],'whatsappCurrentCapacity':this[_0x76a2('0x34')],'openchannelStatus':this['openchannelStatus'],'openchannelStatusTime':this[_0x76a2('0x35')],'openchannelCapacity':this[_0x76a2('0x20')],'openchannelCurrentCapacity':this[_0x76a2('0x21')],'busy':this[_0x76a2('0x36')],'busyQueue':this[_0x76a2('0x22')]};var _0x59a50a=md5(JSON[_0x76a2('0x37')](_0x1f4999));if(this[_0x76a2('0x23')]!==_0x59a50a){this['md5']=_0x59a50a;io[_0x76a2('0x38')](_0x76a2('0x39'),_0x1f4999);}};module['exports']=Agent; \ No newline at end of file diff --git a/server/services/routing/model/chatQueue.js b/server/services/routing/model/chatQueue.js index debc3d8..bb7da9e 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 _0xc1aa=['beepall','Agents','mapAgentsId','updateRouting','updateRealtime','prototype','_rr','loggedIn','paused','chatPause','available','waiting','stringify','format','chat:queue:%s','emit','chat_queue:save','exports','md5','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy'];(function(_0x5a9c0c,_0x4ec485){var _0x53c77d=function(_0x1cf384){while(--_0x1cf384){_0x5a9c0c['push'](_0x5a9c0c['shift']());}};_0x53c77d(++_0x4ec485);}(_0xc1aa,0x164));var _0xac1a=function(_0x15b8e5,_0xd6bbb0){_0x15b8e5=_0x15b8e5-0x0;var _0x48bece=_0xc1aa[_0x15b8e5];return _0x48bece;};'use strict';var _=require('lodash');var md5=require(_0xac1a('0x0'));var util=require('util');var Redis=require('ioredis');var config=require('../../../config/environment');config[_0xac1a('0x1')]=_[_0xac1a('0x2')](config['redis'],{'host':_0xac1a('0x3'),'port':0x18eb});var io=require(_0xac1a('0x4'))(new Redis(config[_0xac1a('0x1')]));function ChatQueue(_0x462e68){this['id']=_0x462e68['id']||0x0;this[_0xac1a('0x5')]=_0x462e68[_0xac1a('0x5')]||'';this[_0xac1a('0x6')]=_0x462e68[_0xac1a('0x6')]||0xa;this[_0xac1a('0x7')]=_0x462e68[_0xac1a('0x7')]||_0xac1a('0x8');this[_0xac1a('0x9')]=_0x462e68[_0xac1a('0x9')];this[_0xac1a('0xa')]={};this['waiting']=0x0;this[_0xac1a('0x0')]='';this[_0xac1a('0xb')]();this[_0xac1a('0xc')]();}ChatQueue[_0xac1a('0xd')]['updateRouting']=function(){var _0x22c55d=this[_0xac1a('0xa')][_0xac1a('0xe')];this[_0xac1a('0xa')]=_['map'](this['Agents'],'id');this['mapAgentsId']['_rr']=_0x22c55d;};ChatQueue['prototype'][_0xac1a('0xc')]=function(){this[_0xac1a('0xf')]=0x0;this[_0xac1a('0x10')]=0x0;for(var _0x25439b=0x0;_0x25439b=0x0?this[_0xac1a('0x12')]:0x0;var _0xf1fba3={'id':this['id'],'available':this[_0xac1a('0x12')],'loggedIn':this[_0xac1a('0xf')],'name':this['name'],'paused':this['paused'],'waiting':this[_0xac1a('0x13')]};var _0x43c43c=md5(JSON[_0xac1a('0x14')](_0xf1fba3));if(this[_0xac1a('0x0')]!==_0x43c43c){this[_0xac1a('0x0')]=_0x43c43c;io['to'](util[_0xac1a('0x15')](_0xac1a('0x16'),_0xf1fba3[_0xac1a('0x5')]))[_0xac1a('0x17')](_0xac1a('0x18'),_0xf1fba3);}};module[_0xac1a('0x19')]=ChatQueue; \ No newline at end of file +var _0x6218=['paused','length','online','chatPause','available','stringify','md5','emit','chat_queue:save','exports','lodash','util','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','waiting','prototype','updateRouting','mapAgentsId','_rr','map','updateRealtime','loggedIn'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x6218,0x136));var _0x8621=function(_0x2c4d22,_0x4ca120){_0x2c4d22=_0x2c4d22-0x0;var _0x1f0537=_0x6218[_0x2c4d22];return _0x1f0537;};'use strict';var _=require(_0x8621('0x0'));var md5=require('md5');var util=require(_0x8621('0x1'));var Redis=require('ioredis');var config=require(_0x8621('0x2'));config[_0x8621('0x3')]=_[_0x8621('0x4')](config[_0x8621('0x3')],{'host':_0x8621('0x5'),'port':0x18eb});var io=require(_0x8621('0x6'))(new Redis(config[_0x8621('0x3')]));function ChatQueue(_0x1e2961){this['id']=_0x1e2961['id']||0x0;this['name']=_0x1e2961[_0x8621('0x7')]||'';this[_0x8621('0x8')]=_0x1e2961['timeout']||0xa;this[_0x8621('0x9')]=_0x1e2961[_0x8621('0x9')]||_0x8621('0xa');this[_0x8621('0xb')]=_0x1e2961[_0x8621('0xb')];this['mapAgentsId']={};this[_0x8621('0xc')]=0x0;this['md5']='';this['updateRouting']();this['updateRealtime']();}ChatQueue[_0x8621('0xd')][_0x8621('0xe')]=function(){var _0x11ec92=this[_0x8621('0xf')][_0x8621('0x10')];this['mapAgentsId']=_[_0x8621('0x11')](this[_0x8621('0xb')],'id');this[_0x8621('0xf')][_0x8621('0x10')]=_0x11ec92;};ChatQueue['prototype'][_0x8621('0x12')]=function(){this[_0x8621('0x13')]=0x0;this[_0x8621('0x14')]=0x0;for(var _0x512b3d=0x0;_0x512b3d=0x0?this[_0x8621('0x18')]:0x0;var _0x3fe5a9={'id':this['id'],'available':this[_0x8621('0x18')],'loggedIn':this[_0x8621('0x13')],'name':this[_0x8621('0x7')],'paused':this[_0x8621('0x14')],'waiting':this['waiting']};var _0x180e12=md5(JSON[_0x8621('0x19')](_0x3fe5a9));if(this[_0x8621('0x1a')]!==_0x180e12){this[_0x8621('0x1a')]=_0x180e12;io['to'](util['format']('chat:queue:%s',_0x3fe5a9['name']))[_0x8621('0x1b')](_0x8621('0x1c'),_0x3fe5a9);}};module[_0x8621('0x1d')]=ChatQueue; \ No newline at end of file diff --git a/server/services/routing/model/faxQueue.js b/server/services/routing/model/faxQueue.js index 41d1616..cb29606 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 _0xca13=['map','updateRealtime','loggedIn','paused','length','online','faxPause','available','format','emit','fax_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','prototype','_rr'];(function(_0x3d1c76,_0x26a7cb){var _0x1b7abc=function(_0x5e9878){while(--_0x5e9878){_0x3d1c76['push'](_0x3d1c76['shift']());}};_0x1b7abc(++_0x26a7cb);}(_0xca13,0x194));var _0x3ca1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xca13[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x3ca1('0x0'));var md5=require(_0x3ca1('0x1'));var util=require(_0x3ca1('0x2'));var Redis=require(_0x3ca1('0x3'));var config=require(_0x3ca1('0x4'));config['redis']=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x3ca1('0x5'))(new Redis(config['redis']));function FaxQueue(_0x5824b0){this['id']=_0x5824b0['id']||0x0;this[_0x3ca1('0x6')]=_0x5824b0[_0x3ca1('0x6')]||'';this[_0x3ca1('0x7')]=_0x5824b0[_0x3ca1('0x7')]||0xa;this['strategy']=_0x5824b0[_0x3ca1('0x8')]||_0x3ca1('0x9');this['Agents']=_0x5824b0[_0x3ca1('0xa')];this[_0x3ca1('0xb')]={};this[_0x3ca1('0xc')]=0x0;this['md5']='';this[_0x3ca1('0xd')]();this['updateRealtime']();}FaxQueue[_0x3ca1('0xe')][_0x3ca1('0xd')]=function(){var _0x2e9ca7=this['mapAgentsId'][_0x3ca1('0xf')];this[_0x3ca1('0xb')]=_[_0x3ca1('0x10')](this[_0x3ca1('0xa')],'id');this[_0x3ca1('0xb')][_0x3ca1('0xf')]=_0x2e9ca7;};FaxQueue[_0x3ca1('0xe')][_0x3ca1('0x11')]=function(){this[_0x3ca1('0x12')]=0x0;this[_0x3ca1('0x13')]=0x0;for(var _0x5b78ca=0x0;_0x5b78ca=0x0?this[_0x3ca1('0x17')]:0x0;var _0x792619={'id':this['id'],'available':this['available'],'loggedIn':this[_0x3ca1('0x12')],'name':this[_0x3ca1('0x6')],'paused':this[_0x3ca1('0x13')],'waiting':this[_0x3ca1('0xc')]};var _0x31a1d4=md5(JSON['stringify'](_0x792619));if(this[_0x3ca1('0x1')]!==_0x31a1d4){this['md5']=_0x31a1d4;io['to'](util[_0x3ca1('0x18')]('fax:queue:%s',_0x792619[_0x3ca1('0x6')]))[_0x3ca1('0x19')](_0x3ca1('0x1a'),_0x792619);}};module[_0x3ca1('0x1b')]=FaxQueue; \ No newline at end of file +var _0x4188=['defaults','localhost','socket.io-emitter','redis','name','timeout','strategy','beepall','Agents','md5','updateRouting','updateRealtime','prototype','mapAgentsId','_rr','loggedIn','paused','length','online','available','waiting','stringify','format','fax:queue:%s','emit','fax_queue:save','exports','lodash','util','../../../config/environment'];(function(_0xfb48e9,_0x3a7f94){var _0x464d11=function(_0x1e7103){while(--_0x1e7103){_0xfb48e9['push'](_0xfb48e9['shift']());}};_0x464d11(++_0x3a7f94);}(_0x4188,0x129));var _0x8418=function(_0x1b2a37,_0x57efe9){_0x1b2a37=_0x1b2a37-0x0;var _0x48baf6=_0x4188[_0x1b2a37];return _0x48baf6;};'use strict';var _=require(_0x8418('0x0'));var md5=require('md5');var util=require(_0x8418('0x1'));var Redis=require('ioredis');var config=require(_0x8418('0x2'));config['redis']=_[_0x8418('0x3')](config['redis'],{'host':_0x8418('0x4'),'port':0x18eb});var io=require(_0x8418('0x5'))(new Redis(config[_0x8418('0x6')]));function FaxQueue(_0x5de662){this['id']=_0x5de662['id']||0x0;this[_0x8418('0x7')]=_0x5de662[_0x8418('0x7')]||'';this[_0x8418('0x8')]=_0x5de662[_0x8418('0x8')]||0xa;this[_0x8418('0x9')]=_0x5de662[_0x8418('0x9')]||_0x8418('0xa');this[_0x8418('0xb')]=_0x5de662[_0x8418('0xb')];this['mapAgentsId']={};this['waiting']=0x0;this[_0x8418('0xc')]='';this[_0x8418('0xd')]();this[_0x8418('0xe')]();}FaxQueue[_0x8418('0xf')]['updateRouting']=function(){var _0x111f18=this[_0x8418('0x10')][_0x8418('0x11')];this[_0x8418('0x10')]=_['map'](this[_0x8418('0xb')],'id');this[_0x8418('0x10')][_0x8418('0x11')]=_0x111f18;};FaxQueue[_0x8418('0xf')][_0x8418('0xe')]=function(){this[_0x8418('0x12')]=0x0;this[_0x8418('0x13')]=0x0;for(var _0x10cc6f=0x0;_0x10cc6f=0x0?this[_0x8418('0x16')]:0x0;var _0x213f68={'id':this['id'],'available':this[_0x8418('0x16')],'loggedIn':this[_0x8418('0x12')],'name':this[_0x8418('0x7')],'paused':this[_0x8418('0x13')],'waiting':this[_0x8418('0x17')]};var _0x2f27d3=md5(JSON[_0x8418('0x18')](_0x213f68));if(this[_0x8418('0xc')]!==_0x2f27d3){this[_0x8418('0xc')]=_0x2f27d3;io['to'](util[_0x8418('0x19')](_0x8418('0x1a'),_0x213f68['name']))[_0x8418('0x1b')](_0x8418('0x1c'),_0x213f68);}};module[_0x8418('0x1d')]=FaxQueue; \ No newline at end of file diff --git a/server/services/routing/model/interval.js b/server/services/routing/model/interval.js index 592b70f..66a5d94 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 _0x1d9e=['Intervals','exports'];(function(_0x24d362,_0x55d2d0){var _0x5569c5=function(_0x1d4c35){while(--_0x1d4c35){_0x24d362['push'](_0x24d362['shift']());}};_0x5569c5(++_0x55d2d0);}(_0x1d9e,0xd8));var _0xe1d9=function(_0x8d5423,_0x4059cd){_0x8d5423=_0x8d5423-0x0;var _0x19c714=_0x1d9e[_0x8d5423];return _0x19c714;};'use strict';function Interval(_0x294b15){this['id']=_0x294b15['id']||0x0;this['name']=_0x294b15['name']||'';this[_0xe1d9('0x0')]=_0x294b15[_0xe1d9('0x0')]||{};}module[_0xe1d9('0x1')]=Interval; \ No newline at end of file +var _0xde20=['Intervals','exports','name'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xde20,0x7d));var _0x0de2=function(_0x4a5930,_0x584884){_0x4a5930=_0x4a5930-0x0;var _0x3d93d5=_0xde20[_0x4a5930];return _0x3d93d5;};'use strict';function Interval(_0x37f077){this['id']=_0x37f077['id']||0x0;this[_0x0de2('0x0')]=_0x37f077[_0x0de2('0x0')]||'';this[_0x0de2('0x1')]=_0x37f077['Intervals']||{};}module[_0x0de2('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 9ce2b81..9dcb961 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 _0x0e4a=['socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','_rr','map','loggedIn','paused','available','stringify','format','mail:queue:%s','emit','exports','lodash','md5','../../../config/environment','defaults','redis','localhost'];(function(_0x22d728,_0x498c86){var _0x4fa902=function(_0x3aec28){while(--_0x3aec28){_0x22d728['push'](_0x22d728['shift']());}};_0x4fa902(++_0x498c86);}(_0x0e4a,0x66));var _0xa0e4=function(_0x3f6cbd,_0x56d890){_0x3f6cbd=_0x3f6cbd-0x0;var _0x20b3cf=_0x0e4a[_0x3f6cbd];return _0x20b3cf;};'use strict';var _=require(_0xa0e4('0x0'));var md5=require(_0xa0e4('0x1'));var util=require('util');var Redis=require('ioredis');var config=require(_0xa0e4('0x2'));config['redis']=_[_0xa0e4('0x3')](config[_0xa0e4('0x4')],{'host':_0xa0e4('0x5'),'port':0x18eb});var io=require(_0xa0e4('0x6'))(new Redis(config[_0xa0e4('0x4')]));function MailQueue(_0x5cf030){this['id']=_0x5cf030['id']||0x0;this[_0xa0e4('0x7')]=_0x5cf030['name']||'';this[_0xa0e4('0x8')]=_0x5cf030[_0xa0e4('0x8')]||0xa;this[_0xa0e4('0x9')]=_0x5cf030[_0xa0e4('0x9')]||_0xa0e4('0xa');this[_0xa0e4('0xb')]=_0x5cf030['Agents'];this[_0xa0e4('0xc')]={};this[_0xa0e4('0xd')]=0x0;this[_0xa0e4('0x1')]='';this[_0xa0e4('0xe')]();this[_0xa0e4('0xf')]();}MailQueue[_0xa0e4('0x10')][_0xa0e4('0xe')]=function(){var _0x5b41db=this[_0xa0e4('0xc')][_0xa0e4('0x11')];this['mapAgentsId']=_[_0xa0e4('0x12')](this['Agents'],'id');this[_0xa0e4('0xc')]['_rr']=_0x5b41db;};MailQueue[_0xa0e4('0x10')]['updateRealtime']=function(){this[_0xa0e4('0x13')]=0x0;this[_0xa0e4('0x14')]=0x0;for(var _0x43043c=0x0;_0x43043c=0x0?this[_0xa0e4('0x15')]:0x0;var _0x5b6c2f={'id':this['id'],'available':this[_0xa0e4('0x15')],'loggedIn':this[_0xa0e4('0x13')],'name':this[_0xa0e4('0x7')],'paused':this[_0xa0e4('0x14')],'waiting':this['waiting']};var _0x3db0ed=md5(JSON[_0xa0e4('0x16')](_0x5b6c2f));if(this['md5']!==_0x3db0ed){this['md5']=_0x3db0ed;io['to'](util[_0xa0e4('0x17')](_0xa0e4('0x18'),_0x5b6c2f[_0xa0e4('0x7')]))[_0xa0e4('0x19')]('mail_queue:save',_0x5b6c2f);}};module[_0xa0e4('0x1a')]=MailQueue; \ No newline at end of file +var _0x8ef2=['socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','md5','updateRouting','updateRealtime','map','_rr','prototype','loggedIn','length','paused','available','format','mail:queue:%s','mail_queue:save','exports','util','redis','defaults','localhost'];(function(_0x5c351c,_0x2046d8){var _0x26f3b3=function(_0x47ac18){while(--_0x47ac18){_0x5c351c['push'](_0x5c351c['shift']());}};_0x26f3b3(++_0x2046d8);}(_0x8ef2,0x1b6));var _0x28ef=function(_0x113982,_0x597be2){_0x113982=_0x113982-0x0;var _0x13ff92=_0x8ef2[_0x113982];return _0x13ff92;};'use strict';var _=require('lodash');var md5=require('md5');var util=require(_0x28ef('0x0'));var Redis=require('ioredis');var config=require('../../../config/environment');config[_0x28ef('0x1')]=_[_0x28ef('0x2')](config[_0x28ef('0x1')],{'host':_0x28ef('0x3'),'port':0x18eb});var io=require(_0x28ef('0x4'))(new Redis(config[_0x28ef('0x1')]));function MailQueue(_0x2271e9){this['id']=_0x2271e9['id']||0x0;this['name']=_0x2271e9[_0x28ef('0x5')]||'';this['timeout']=_0x2271e9[_0x28ef('0x6')]||0xa;this[_0x28ef('0x7')]=_0x2271e9[_0x28ef('0x7')]||_0x28ef('0x8');this['Agents']=_0x2271e9[_0x28ef('0x9')];this[_0x28ef('0xa')]={};this[_0x28ef('0xb')]=0x0;this[_0x28ef('0xc')]='';this[_0x28ef('0xd')]();this[_0x28ef('0xe')]();}MailQueue['prototype'][_0x28ef('0xd')]=function(){var _0x4b386d=this[_0x28ef('0xa')]['_rr'];this[_0x28ef('0xa')]=_[_0x28ef('0xf')](this['Agents'],'id');this[_0x28ef('0xa')][_0x28ef('0x10')]=_0x4b386d;};MailQueue[_0x28ef('0x11')][_0x28ef('0xe')]=function(){this[_0x28ef('0x12')]=0x0;this['paused']=0x0;for(var _0xcee79d=0x0;_0xcee79d=0x0?this[_0x28ef('0x15')]:0x0;var _0x36c461={'id':this['id'],'available':this[_0x28ef('0x15')],'loggedIn':this['loggedIn'],'name':this['name'],'paused':this[_0x28ef('0x14')],'waiting':this[_0x28ef('0xb')]};var _0x4cd7cd=md5(JSON['stringify'](_0x36c461));if(this['md5']!==_0x4cd7cd){this[_0x28ef('0xc')]=_0x4cd7cd;io['to'](util[_0x28ef('0x16')](_0x28ef('0x17'),_0x36c461[_0x28ef('0x5')]))['emit'](_0x28ef('0x18'),_0x36c461);}};module[_0x28ef('0x19')]=MailQueue; \ No newline at end of file diff --git a/server/services/routing/model/openchannelQueue.js b/server/services/routing/model/openchannelQueue.js index f4a0ee5..e2f1ebc 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 _0x1261=['available','stringify','openchannel:queue:%s','openchannel_queue:save','exports','md5','util','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','waiting','updateRouting','prototype','mapAgentsId','map','_rr','updateRealtime','loggedIn','paused','length','online'];(function(_0x3d42d8,_0x4cffaa){var _0x27fc41=function(_0x3a363b){while(--_0x3a363b){_0x3d42d8['push'](_0x3d42d8['shift']());}};_0x27fc41(++_0x4cffaa);}(_0x1261,0x144));var _0x1126=function(_0x53fe97,_0x544271){_0x53fe97=_0x53fe97-0x0;var _0x5c49a2=_0x1261[_0x53fe97];return _0x5c49a2;};'use strict';var _=require('lodash');var md5=require(_0x1126('0x0'));var util=require(_0x1126('0x1'));var Redis=require(_0x1126('0x2'));var config=require(_0x1126('0x3'));config[_0x1126('0x4')]=_[_0x1126('0x5')](config[_0x1126('0x4')],{'host':_0x1126('0x6'),'port':0x18eb});var io=require(_0x1126('0x7'))(new Redis(config[_0x1126('0x4')]));function OpenchannelQueue(_0x5a2189){this['id']=_0x5a2189['id']||0x0;this['name']=_0x5a2189[_0x1126('0x8')]||'';this[_0x1126('0x9')]=_0x5a2189['timeout']||0xa;this[_0x1126('0xa')]=_0x5a2189[_0x1126('0xa')]||_0x1126('0xb');this[_0x1126('0xc')]=_0x5a2189[_0x1126('0xc')];this['mapAgentsId']={};this[_0x1126('0xd')]=0x0;this[_0x1126('0x0')]='';this[_0x1126('0xe')]();this['updateRealtime']();}OpenchannelQueue[_0x1126('0xf')]['updateRouting']=function(){var _0x52ef15=this[_0x1126('0x10')]['_rr'];this[_0x1126('0x10')]=_[_0x1126('0x11')](this[_0x1126('0xc')],'id');this[_0x1126('0x10')][_0x1126('0x12')]=_0x52ef15;};OpenchannelQueue[_0x1126('0xf')][_0x1126('0x13')]=function(){this[_0x1126('0x14')]=0x0;this[_0x1126('0x15')]=0x0;for(var _0x53a8f0=0x0;_0x53a8f0=0x0?this['available']:0x0;var _0x4d2b38={'id':this['id'],'available':this[_0x1126('0x18')],'loggedIn':this[_0x1126('0x14')],'name':this['name'],'paused':this['paused'],'waiting':this[_0x1126('0xd')]};var _0x58b109=md5(JSON[_0x1126('0x19')](_0x4d2b38));if(this[_0x1126('0x0')]!==_0x58b109){this[_0x1126('0x0')]=_0x58b109;io['to'](util['format'](_0x1126('0x1a'),_0x4d2b38['name']))['emit'](_0x1126('0x1b'),_0x4d2b38);}};module[_0x1126('0x1c')]=OpenchannelQueue; \ No newline at end of file +var _0x7a54=['exports','lodash','md5','util','../../../config/environment','redis','localhost','socket.io-emitter','name','timeout','strategy','beepall','waiting','updateRealtime','mapAgentsId','_rr','map','Agents','prototype','loggedIn','paused','length','openchannelPause','available','stringify','format','openchannel:queue:%s','emit','openchannel_queue:save'];(function(_0x39e84d,_0x11931d){var _0x1991bc=function(_0xc81e32){while(--_0xc81e32){_0x39e84d['push'](_0x39e84d['shift']());}};_0x1991bc(++_0x11931d);}(_0x7a54,0x106));var _0x47a5=function(_0x3c3e4d,_0x31ec80){_0x3c3e4d=_0x3c3e4d-0x0;var _0x464fc0=_0x7a54[_0x3c3e4d];return _0x464fc0;};'use strict';var _=require(_0x47a5('0x0'));var md5=require(_0x47a5('0x1'));var util=require(_0x47a5('0x2'));var Redis=require('ioredis');var config=require(_0x47a5('0x3'));config[_0x47a5('0x4')]=_['defaults'](config[_0x47a5('0x4')],{'host':_0x47a5('0x5'),'port':0x18eb});var io=require(_0x47a5('0x6'))(new Redis(config[_0x47a5('0x4')]));function OpenchannelQueue(_0xfdf934){this['id']=_0xfdf934['id']||0x0;this['name']=_0xfdf934[_0x47a5('0x7')]||'';this['timeout']=_0xfdf934[_0x47a5('0x8')]||0xa;this[_0x47a5('0x9')]=_0xfdf934['strategy']||_0x47a5('0xa');this['Agents']=_0xfdf934['Agents'];this['mapAgentsId']={};this[_0x47a5('0xb')]=0x0;this[_0x47a5('0x1')]='';this['updateRouting']();this[_0x47a5('0xc')]();}OpenchannelQueue['prototype']['updateRouting']=function(){var _0x1f47f4=this[_0x47a5('0xd')][_0x47a5('0xe')];this[_0x47a5('0xd')]=_[_0x47a5('0xf')](this[_0x47a5('0x10')],'id');this[_0x47a5('0xd')]['_rr']=_0x1f47f4;};OpenchannelQueue[_0x47a5('0x11')][_0x47a5('0xc')]=function(){this[_0x47a5('0x12')]=0x0;this[_0x47a5('0x13')]=0x0;for(var _0x139f25=0x0;_0x139f25=0x0?this['available']:0x0;var _0x423a81={'id':this['id'],'available':this[_0x47a5('0x16')],'loggedIn':this[_0x47a5('0x12')],'name':this[_0x47a5('0x7')],'paused':this[_0x47a5('0x13')],'waiting':this[_0x47a5('0xb')]};var _0x2763d6=md5(JSON[_0x47a5('0x17')](_0x423a81));if(this[_0x47a5('0x1')]!==_0x2763d6){this['md5']=_0x2763d6;io['to'](util[_0x47a5('0x18')](_0x47a5('0x19'),_0x423a81['name']))[_0x47a5('0x1a')](_0x47a5('0x1b'),_0x423a81);}};module[_0x47a5('0x1c')]=OpenchannelQueue; \ No newline at end of file diff --git a/server/services/routing/model/smsQueue.js b/server/services/routing/model/smsQueue.js index ba41d77..5e578b3 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 _0xda55=['timeout','strategy','beepall','Agents','mapAgentsId','updateRouting','updateRealtime','prototype','map','_rr','loggedIn','paused','online','smsPause','available','waiting','stringify','format','sms:queue:%s','emit','sms_queue:save','exports','lodash','md5','../../../config/environment','redis','defaults','localhost','name'];(function(_0x55d829,_0x43f06c){var _0x52163b=function(_0x493cd8){while(--_0x493cd8){_0x55d829['push'](_0x55d829['shift']());}};_0x52163b(++_0x43f06c);}(_0xda55,0x6d));var _0x5da5=function(_0x430953,_0x4b6180){_0x430953=_0x430953-0x0;var _0x2945b=_0xda55[_0x430953];return _0x2945b;};'use strict';var _=require(_0x5da5('0x0'));var md5=require(_0x5da5('0x1'));var util=require('util');var Redis=require('ioredis');var config=require(_0x5da5('0x2'));config[_0x5da5('0x3')]=_[_0x5da5('0x4')](config[_0x5da5('0x3')],{'host':_0x5da5('0x5'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x5da5('0x3')]));function SmsQueue(_0x4b4010){this['id']=_0x4b4010['id']||0x0;this[_0x5da5('0x6')]=_0x4b4010['name']||'';this[_0x5da5('0x7')]=_0x4b4010[_0x5da5('0x7')]||0xa;this[_0x5da5('0x8')]=_0x4b4010[_0x5da5('0x8')]||_0x5da5('0x9');this[_0x5da5('0xa')]=_0x4b4010[_0x5da5('0xa')];this[_0x5da5('0xb')]={};this['waiting']=0x0;this[_0x5da5('0x1')]='';this[_0x5da5('0xc')]();this[_0x5da5('0xd')]();}SmsQueue[_0x5da5('0xe')][_0x5da5('0xc')]=function(){var _0x2a361c=this[_0x5da5('0xb')]['_rr'];this[_0x5da5('0xb')]=_[_0x5da5('0xf')](this['Agents'],'id');this[_0x5da5('0xb')][_0x5da5('0x10')]=_0x2a361c;};SmsQueue[_0x5da5('0xe')][_0x5da5('0xd')]=function(){this[_0x5da5('0x11')]=0x0;this[_0x5da5('0x12')]=0x0;for(var _0x481562=0x0;_0x481562=0x0?this[_0x5da5('0x15')]:0x0;var _0x3f7e98={'id':this['id'],'available':this[_0x5da5('0x15')],'loggedIn':this['loggedIn'],'name':this[_0x5da5('0x6')],'paused':this[_0x5da5('0x12')],'waiting':this[_0x5da5('0x16')]};var _0x30cde5=md5(JSON[_0x5da5('0x17')](_0x3f7e98));if(this['md5']!==_0x30cde5){this[_0x5da5('0x1')]=_0x30cde5;io['to'](util[_0x5da5('0x18')](_0x5da5('0x19'),_0x3f7e98['name']))[_0x5da5('0x1a')](_0x5da5('0x1b'),_0x3f7e98);}};module[_0x5da5('0x1c')]=SmsQueue; \ No newline at end of file +var _0x0a9a=['length','online','smsPause','paused','available','waiting','stringify','sms:queue:%s','emit','exports','md5','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','updateRouting','_rr','map','prototype','updateRealtime','loggedIn'];(function(_0x48370b,_0x5f332f){var _0x5d0b13=function(_0x8adbe8){while(--_0x8adbe8){_0x48370b['push'](_0x48370b['shift']());}};_0x5d0b13(++_0x5f332f);}(_0x0a9a,0x183));var _0xa0a9=function(_0x5e07d0,_0x5dc185){_0x5e07d0=_0x5e07d0-0x0;var _0x54ba76=_0x0a9a[_0x5e07d0];return _0x54ba76;};'use strict';var _=require('lodash');var md5=require(_0xa0a9('0x0'));var util=require('util');var Redis=require(_0xa0a9('0x1'));var config=require(_0xa0a9('0x2'));config[_0xa0a9('0x3')]=_[_0xa0a9('0x4')](config['redis'],{'host':_0xa0a9('0x5'),'port':0x18eb});var io=require(_0xa0a9('0x6'))(new Redis(config['redis']));function SmsQueue(_0x425c3c){this['id']=_0x425c3c['id']||0x0;this[_0xa0a9('0x7')]=_0x425c3c[_0xa0a9('0x7')]||'';this[_0xa0a9('0x8')]=_0x425c3c['timeout']||0xa;this[_0xa0a9('0x9')]=_0x425c3c['strategy']||_0xa0a9('0xa');this[_0xa0a9('0xb')]=_0x425c3c[_0xa0a9('0xb')];this[_0xa0a9('0xc')]={};this['waiting']=0x0;this[_0xa0a9('0x0')]='';this[_0xa0a9('0xd')]();this['updateRealtime']();}SmsQueue['prototype'][_0xa0a9('0xd')]=function(){var _0x33f54f=this['mapAgentsId'][_0xa0a9('0xe')];this['mapAgentsId']=_[_0xa0a9('0xf')](this['Agents'],'id');this[_0xa0a9('0xc')][_0xa0a9('0xe')]=_0x33f54f;};SmsQueue[_0xa0a9('0x10')][_0xa0a9('0x11')]=function(){this[_0xa0a9('0x12')]=0x0;this['paused']=0x0;for(var _0x1f3f23=0x0;_0x1f3f23=0x0?this['available']:0x0;var _0x320735={'id':this['id'],'available':this[_0xa0a9('0x17')],'loggedIn':this[_0xa0a9('0x12')],'name':this[_0xa0a9('0x7')],'paused':this[_0xa0a9('0x16')],'waiting':this[_0xa0a9('0x18')]};var _0x5c82ed=md5(JSON[_0xa0a9('0x19')](_0x320735));if(this[_0xa0a9('0x0')]!==_0x5c82ed){this['md5']=_0x5c82ed;io['to'](util['format'](_0xa0a9('0x1a'),_0x320735[_0xa0a9('0x7')]))[_0xa0a9('0x1b')]('sms_queue:save',_0x320735);}};module[_0xa0a9('0x1c')]=SmsQueue; \ No newline at end of file diff --git a/server/services/routing/model/whatsappQueue.js b/server/services/routing/model/whatsappQueue.js index 220233f..f5bd893 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 _0xf034=['stringify','whatsapp:queue:%s','whatsapp_queue:save','exports','lodash','md5','util','../../../config/environment','redis','defaults','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRealtime','prototype','_rr','map','loggedIn','length','online','whatsappPause','paused','available'];(function(_0x32d330,_0xe907c8){var _0xe81a43=function(_0x322e56){while(--_0x322e56){_0x32d330['push'](_0x32d330['shift']());}};_0xe81a43(++_0xe907c8);}(_0xf034,0x1e0));var _0x4f03=function(_0x55fb0b,_0x26af18){_0x55fb0b=_0x55fb0b-0x0;var _0x27ff58=_0xf034[_0x55fb0b];return _0x27ff58;};'use strict';var _=require(_0x4f03('0x0'));var md5=require(_0x4f03('0x1'));var util=require(_0x4f03('0x2'));var Redis=require('ioredis');var config=require(_0x4f03('0x3'));config[_0x4f03('0x4')]=_[_0x4f03('0x5')](config[_0x4f03('0x4')],{'host':'localhost','port':0x18eb});var io=require(_0x4f03('0x6'))(new Redis(config[_0x4f03('0x4')]));function WhatsappQueue(_0x1e4b21){this['id']=_0x1e4b21['id']||0x0;this[_0x4f03('0x7')]=_0x1e4b21[_0x4f03('0x7')]||'';this[_0x4f03('0x8')]=_0x1e4b21[_0x4f03('0x8')]||0xa;this[_0x4f03('0x9')]=_0x1e4b21[_0x4f03('0x9')]||_0x4f03('0xa');this[_0x4f03('0xb')]=_0x1e4b21['Agents'];this[_0x4f03('0xc')]={};this[_0x4f03('0xd')]=0x0;this['md5']='';this['updateRouting']();this[_0x4f03('0xe')]();}WhatsappQueue[_0x4f03('0xf')]['updateRouting']=function(){var _0x504014=this[_0x4f03('0xc')][_0x4f03('0x10')];this[_0x4f03('0xc')]=_[_0x4f03('0x11')](this['Agents'],'id');this[_0x4f03('0xc')][_0x4f03('0x10')]=_0x504014;};WhatsappQueue[_0x4f03('0xf')][_0x4f03('0xe')]=function(){this[_0x4f03('0x12')]=0x0;this['paused']=0x0;for(var _0x4e52df=0x0;_0x4e52df=0x0?this['available']:0x0;var _0x215026={'id':this['id'],'available':this['available'],'loggedIn':this[_0x4f03('0x12')],'name':this['name'],'paused':this[_0x4f03('0x16')],'waiting':this[_0x4f03('0xd')]};var _0x30e551=md5(JSON[_0x4f03('0x18')](_0x215026));if(this[_0x4f03('0x1')]!==_0x30e551){this[_0x4f03('0x1')]=_0x30e551;io['to'](util['format'](_0x4f03('0x19'),_0x215026[_0x4f03('0x7')]))['emit'](_0x4f03('0x1a'),_0x215026);}};module[_0x4f03('0x1b')]=WhatsappQueue; \ No newline at end of file +var _0x3114=['util','ioredis','../../../config/environment','defaults','redis','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','_rr','loggedIn','paused','length','whatsappPause','available','format','whatsapp:queue:%s','emit','whatsapp_queue:save','exports','md5'];(function(_0x975abb,_0x6fae6a){var _0x5a15ae=function(_0x9d069b){while(--_0x9d069b){_0x975abb['push'](_0x975abb['shift']());}};_0x5a15ae(++_0x6fae6a);}(_0x3114,0x73));var _0x4311=function(_0xa0f637,_0x5581e1){_0xa0f637=_0xa0f637-0x0;var _0x58d57a=_0x3114[_0xa0f637];return _0x58d57a;};'use strict';var _=require('lodash');var md5=require(_0x4311('0x0'));var util=require(_0x4311('0x1'));var Redis=require(_0x4311('0x2'));var config=require(_0x4311('0x3'));config['redis']=_[_0x4311('0x4')](config[_0x4311('0x5')],{'host':_0x4311('0x6'),'port':0x18eb});var io=require(_0x4311('0x7'))(new Redis(config[_0x4311('0x5')]));function WhatsappQueue(_0x18b436){this['id']=_0x18b436['id']||0x0;this['name']=_0x18b436[_0x4311('0x8')]||'';this[_0x4311('0x9')]=_0x18b436[_0x4311('0x9')]||0xa;this[_0x4311('0xa')]=_0x18b436[_0x4311('0xa')]||_0x4311('0xb');this[_0x4311('0xc')]=_0x18b436[_0x4311('0xc')];this[_0x4311('0xd')]={};this[_0x4311('0xe')]=0x0;this[_0x4311('0x0')]='';this[_0x4311('0xf')]();this[_0x4311('0x10')]();}WhatsappQueue[_0x4311('0x11')]['updateRouting']=function(){var _0x2f1466=this['mapAgentsId'][_0x4311('0x12')];this[_0x4311('0xd')]=_['map'](this[_0x4311('0xc')],'id');this[_0x4311('0xd')][_0x4311('0x12')]=_0x2f1466;};WhatsappQueue[_0x4311('0x11')]['updateRealtime']=function(){this[_0x4311('0x13')]=0x0;this[_0x4311('0x14')]=0x0;for(var _0x502672=0x0;_0x502672=0x0?this['available']:0x0;var _0x5d7bd7={'id':this['id'],'available':this[_0x4311('0x17')],'loggedIn':this['loggedIn'],'name':this[_0x4311('0x8')],'paused':this[_0x4311('0x14')],'waiting':this[_0x4311('0xe')]};var _0x3002e=md5(JSON['stringify'](_0x5d7bd7));if(this[_0x4311('0x0')]!==_0x3002e){this[_0x4311('0x0')]=_0x3002e;io['to'](util[_0x4311('0x18')](_0x4311('0x19'),_0x5d7bd7['name']))[_0x4311('0x1a')](_0x4311('0x1b'),_0x5d7bd7);}};module[_0x4311('0x1c')]=WhatsappQueue; \ No newline at end of file diff --git a/server/services/routing/realtime/index.js b/server/services/routing/realtime/index.js index 7a27590..ee602ae 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(_0x4cf48c,_0x467a97){var _0x367fbe=function(_0x283b82){while(--_0x283b82){_0x4cf48c['push'](_0x4cf48c['shift']());}};_0x367fbe(++_0x467a97);}(_0xb10b,0x12a));var _0xbb10=function(_0x295a5c,_0xfd0b5){_0x295a5c=_0x295a5c-0x0;var _0x53339e=_0xb10b[_0x295a5c];return _0x53339e;};'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 _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(_0x49919e,_0x24529e){var _0x35cf00=function(_0x2d19b1){while(--_0x2d19b1){_0x49919e['push'](_0x49919e['shift']());}};_0x35cf00(++_0x24529e);}(_0xb10b,0x12a));var _0xbb10=function(_0x2f0811,_0x589ce){_0x2f0811=_0x2f0811-0x0;var _0x18ff83=_0xb10b[_0x2f0811];return _0x18ff83;};'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 diff --git a/server/services/routing/rpc/chatInteraction.js b/server/services/routing/rpc/chatInteraction.js index f3ce4bd..0b44aed 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 _0x580a=['UpdateChatInteraction','updateChatInteraction','addTags','addTagsToChatInteraction','../client','update','Request'];(function(_0x261a2d,_0x1f9194){var _0x52763f=function(_0x3699f2){while(--_0x3699f2){_0x261a2d['push'](_0x261a2d['shift']());}};_0x52763f(++_0x1f9194);}(_0x580a,0xe4));var _0xa580=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x580a[_0x14add3];return _0x4a174f;};'use strict';var client=require(_0xa580('0x0'));exports[_0xa580('0x1')]=function(_0x10bc42,_0x4b3554){return client[_0xa580('0x2')](_0xa580('0x3'),{'body':_0x4b3554,'options':{'where':{'id':_0x10bc42}},'log':_0xa580('0x4')});};exports[_0xa580('0x5')]=function(_0x2d9b0f,_0x35a213){return client[_0xa580('0x2')]('AddTagsToChatInteraction',{'body':_0x35a213,'options':{'where':{'id':_0x2d9b0f}},'log':_0xa580('0x6')});}; \ No newline at end of file +var _0xf0ce=['../client','update','Request','UpdateChatInteraction','updateChatInteraction','addTags','AddTagsToChatInteraction'];(function(_0x2c7618,_0x26be9c){var _0x5ce3f0=function(_0x1837b3){while(--_0x1837b3){_0x2c7618['push'](_0x2c7618['shift']());}};_0x5ce3f0(++_0x26be9c);}(_0xf0ce,0x1ea));var _0xef0c=function(_0x3baccd,_0x3ad79b){_0x3baccd=_0x3baccd-0x0;var _0x3d6d65=_0xf0ce[_0x3baccd];return _0x3d6d65;};'use strict';var client=require(_0xef0c('0x0'));exports[_0xef0c('0x1')]=function(_0x201153,_0x3a61b1){return client[_0xef0c('0x2')](_0xef0c('0x3'),{'body':_0x3a61b1,'options':{'where':{'id':_0x201153}},'log':_0xef0c('0x4')});};exports[_0xef0c('0x5')]=function(_0x15cdf2,_0xd8e9f7){return client[_0xef0c('0x2')](_0xef0c('0x6'),{'body':_0xd8e9f7,'options':{'where':{'id':_0x15cdf2}},'log':'addTagsToChatInteraction'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatMessage.js b/server/services/routing/rpc/chatMessage.js index afd37a8..f4b9445 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 _0x7bf6=['CreateChatMessage','../client','create'];(function(_0x1d4720,_0x4d051c){var _0x2ac38d=function(_0x40985d){while(--_0x40985d){_0x1d4720['push'](_0x1d4720['shift']());}};_0x2ac38d(++_0x4d051c);}(_0x7bf6,0x118));var _0x67bf=function(_0x35e4eb,_0x164bb3){_0x35e4eb=_0x35e4eb-0x0;var _0x7211ce=_0x7bf6[_0x35e4eb];return _0x7211ce;};'use strict';var client=require(_0x67bf('0x0'));exports[_0x67bf('0x1')]=function(_0x33b7d9){return client['Request'](_0x67bf('0x2'),{'body':_0x33b7d9,'log':'createChatMessage'});}; \ No newline at end of file +var _0xb643=['createChatMessage','Request'];(function(_0x437147,_0x133044){var _0x335ae4=function(_0x379257){while(--_0x379257){_0x437147['push'](_0x437147['shift']());}};_0x335ae4(++_0x133044);}(_0xb643,0xa9));var _0x3b64=function(_0x1f3e80,_0x19e38f){_0x1f3e80=_0x1f3e80-0x0;var _0x4455a2=_0xb643[_0x1f3e80];return _0x4455a2;};'use strict';var client=require('../client');exports['create']=function(_0x28ba73){return client[_0x3b64('0x0')]('CreateChatMessage',{'body':_0x28ba73,'log':_0x3b64('0x1')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueue.js b/server/services/routing/rpc/chatQueue.js index af1c8fc..5f0bae2 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 _0x5419=['User','Agents','chatPause','../client','getChatQueues','Request','GetChatQueue','name','timeout','strategy'];(function(_0x4809f1,_0x44933e){var _0x289ff9=function(_0x31c4b0){while(--_0x31c4b0){_0x4809f1['push'](_0x4809f1['shift']());}};_0x289ff9(++_0x44933e);}(_0x5419,0x175));var _0x9541=function(_0x2ce00f,_0x41d23a){_0x2ce00f=_0x2ce00f-0x0;var _0x47f2f7=_0x5419[_0x2ce00f];return _0x47f2f7;};'use strict';var client=require(_0x9541('0x0'));exports[_0x9541('0x1')]=function(){return function(){return client[_0x9541('0x2')](_0x9541('0x3'),{'options':{'raw':![],'attributes':['id',_0x9541('0x4'),_0x9541('0x5'),_0x9541('0x6')],'include':[{'model':_0x9541('0x7'),'as':_0x9541('0x8'),'attributes':['id',_0x9541('0x4'),'online',_0x9541('0x9')]}]},'log':_0x9541('0x1')});};}; \ No newline at end of file +var _0x6bdc=['strategy','User','Agents','chatPause','../client','getChatQueues','Request','GetChatQueue','name','timeout'];(function(_0x40930d,_0x2aa5d9){var _0x284643=function(_0x3c1a75){while(--_0x3c1a75){_0x40930d['push'](_0x40930d['shift']());}};_0x284643(++_0x2aa5d9);}(_0x6bdc,0x14e));var _0xc6bd=function(_0x56fd2b,_0x5bf542){_0x56fd2b=_0x56fd2b-0x0;var _0x2ec76c=_0x6bdc[_0x56fd2b];return _0x2ec76c;};'use strict';var client=require(_0xc6bd('0x0'));exports[_0xc6bd('0x1')]=function(){return function(){return client[_0xc6bd('0x2')](_0xc6bd('0x3'),{'options':{'raw':![],'attributes':['id',_0xc6bd('0x4'),_0xc6bd('0x5'),_0xc6bd('0x6')],'include':[{'model':_0xc6bd('0x7'),'as':_0xc6bd('0x8'),'attributes':['id',_0xc6bd('0x4'),'online',_0xc6bd('0x9')]}]},'log':_0xc6bd('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueueReport.js b/server/services/routing/rpc/chatQueueReport.js index 5531ff7..dfc9923 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 _0x3613=['UpdateChatQueueReport','DESC','../client','create','Request','CreateChatQueueReport','update'];(function(_0x13d07a,_0x41efc3){var _0x5ee0ee=function(_0x4ca94a){while(--_0x4ca94a){_0x13d07a['push'](_0x13d07a['shift']());}};_0x5ee0ee(++_0x41efc3);}(_0x3613,0x198));var _0x3361=function(_0x598624,_0x2055a3){_0x598624=_0x598624-0x0;var _0x2483f0=_0x3613[_0x598624];return _0x2483f0;};'use strict';var client=require(_0x3361('0x0'));exports[_0x3361('0x1')]=function(_0x2469ba){return client[_0x3361('0x2')](_0x3361('0x3'),{'body':_0x2469ba,'log':_0x3361('0x3')});};exports[_0x3361('0x4')]=function(_0x56bafb,_0xe6f993){return client['Request'](_0x3361('0x5'),{'body':_0xe6f993,'options':{'where':{'uniqueid':_0x56bafb},'order':[['id',_0x3361('0x6')]],'limit':0x1},'log':_0x3361('0x5')});}; \ No newline at end of file +var _0x6c4b=['update','Request','UpdateChatQueueReport','../client','create','CreateChatQueueReport'];(function(_0x24f43a,_0x24a465){var _0x576af7=function(_0x5aad0a){while(--_0x5aad0a){_0x24f43a['push'](_0x24f43a['shift']());}};_0x576af7(++_0x24a465);}(_0x6c4b,0x93));var _0xb6c4=function(_0xf29840,_0x5071a6){_0xf29840=_0xf29840-0x0;var _0x1c5935=_0x6c4b[_0xf29840];return _0x1c5935;};'use strict';var client=require(_0xb6c4('0x0'));exports[_0xb6c4('0x1')]=function(_0x18a0e2){return client['Request'](_0xb6c4('0x2'),{'body':_0x18a0e2,'log':_0xb6c4('0x2')});};exports[_0xb6c4('0x3')]=function(_0x794568,_0x459ef7){return client[_0xb6c4('0x4')]('UpdateChatQueueReport',{'body':_0x459ef7,'options':{'where':{'uniqueid':_0x794568},'order':[['id','DESC']],'limit':0x1},'log':_0xb6c4('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxInteraction.js b/server/services/routing/rpc/faxInteraction.js index 759af72..bccc4de 100644 --- a/server/services/routing/rpc/faxInteraction.js +++ b/server/services/routing/rpc/faxInteraction.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['Request','UpdateFaxInteraction','addTags','AddTagsToFaxInteraction','../client','update'];(function(_0x30ae5e,_0x391fc4){var _0x1f2e93=function(_0x60307d){while(--_0x60307d){_0x30ae5e['push'](_0x30ae5e['shift']());}};_0x1f2e93(++_0x391fc4);}(_0x7a54,0x106));var _0x47a5=function(_0x520cf5,_0x44f110){_0x520cf5=_0x520cf5-0x0;var _0x589bb5=_0x7a54[_0x520cf5];return _0x589bb5;};'use strict';var client=require(_0x47a5('0x0'));exports[_0x47a5('0x1')]=function(_0x44b31e,_0x58157c){return client[_0x47a5('0x2')](_0x47a5('0x3'),{'body':_0x58157c,'options':{'where':{'id':_0x44b31e}},'log':'updateFaxInteraction'});};exports[_0x47a5('0x4')]=function(_0x11bf85,_0x2a1a7e){return client[_0x47a5('0x2')](_0x47a5('0x5'),{'body':_0x2a1a7e,'options':{'where':{'id':_0x11bf85}},'log':'addTagsToFaxInteraction'});}; \ No newline at end of file +var _0x7a54=['Request','UpdateFaxInteraction','addTags','AddTagsToFaxInteraction','../client','update'];(function(_0x152678,_0x11e0ac){var _0x311a9=function(_0x4f5291){while(--_0x4f5291){_0x152678['push'](_0x152678['shift']());}};_0x311a9(++_0x11e0ac);}(_0x7a54,0x106));var _0x47a5=function(_0x4464dd,_0x1cf76){_0x4464dd=_0x4464dd-0x0;var _0x3fd6d=_0x7a54[_0x4464dd];return _0x3fd6d;};'use strict';var client=require(_0x47a5('0x0'));exports[_0x47a5('0x1')]=function(_0x44b31e,_0x58157c){return client[_0x47a5('0x2')](_0x47a5('0x3'),{'body':_0x58157c,'options':{'where':{'id':_0x44b31e}},'log':'updateFaxInteraction'});};exports[_0x47a5('0x4')]=function(_0x11bf85,_0x2a1a7e){return client[_0x47a5('0x2')](_0x47a5('0x5'),{'body':_0x2a1a7e,'options':{'where':{'id':_0x11bf85}},'log':'addTagsToFaxInteraction'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxMessage.js b/server/services/routing/rpc/faxMessage.js index 7c51c78..3712597 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 _0xa2fb=['createFaxMessage','../client','create','Request','CreateFaxMessage'];(function(_0x30c15b,_0x9b16a7){var _0x151243=function(_0x1c5746){while(--_0x1c5746){_0x30c15b['push'](_0x30c15b['shift']());}};_0x151243(++_0x9b16a7);}(_0xa2fb,0x88));var _0xba2f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa2fb[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0xba2f('0x0'));exports[_0xba2f('0x1')]=function(_0x5510a1){return client[_0xba2f('0x2')](_0xba2f('0x3'),{'body':_0x5510a1,'log':_0xba2f('0x4')});}; \ No newline at end of file +var _0x89e8=['createFaxMessage','../client','create','Request'];(function(_0x3a7462,_0x148a42){var _0x3547fd=function(_0x3a6bd3){while(--_0x3a6bd3){_0x3a7462['push'](_0x3a7462['shift']());}};_0x3547fd(++_0x148a42);}(_0x89e8,0x1cd));var _0x889e=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x89e8[_0x3b380d];return _0x54502b;};'use strict';var client=require(_0x889e('0x0'));exports[_0x889e('0x1')]=function(_0x15e355){return client[_0x889e('0x2')]('CreateFaxMessage',{'body':_0x15e355,'log':_0x889e('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueue.js b/server/services/routing/rpc/faxQueue.js index 5a07123..62266fb 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 _0x7e9d=['strategy','Agents','../client','getFaxQueues','GetFaxQueue','name','timeout'];(function(_0x48bdeb,_0x3ec80c){var _0x3d7ef1=function(_0x20058b){while(--_0x20058b){_0x48bdeb['push'](_0x48bdeb['shift']());}};_0x3d7ef1(++_0x3ec80c);}(_0x7e9d,0x72));var _0xd7e9=function(_0x3b3bc7,_0x189879){_0x3b3bc7=_0x3b3bc7-0x0;var _0x12ed08=_0x7e9d[_0x3b3bc7];return _0x12ed08;};'use strict';var client=require(_0xd7e9('0x0'));exports[_0xd7e9('0x1')]=function(){return function(){return client['Request'](_0xd7e9('0x2'),{'options':{'raw':![],'attributes':['id',_0xd7e9('0x3'),_0xd7e9('0x4'),_0xd7e9('0x5')],'include':[{'model':'User','as':_0xd7e9('0x6'),'attributes':['id','name','online','faxPause']}]},'log':_0xd7e9('0x1')});};}; \ No newline at end of file +var _0xd0f4=['Request','name','timeout','strategy','User','Agents','online','faxPause','../client','getFaxQueues'];(function(_0x1928c9,_0x13a6d1){var _0x51b5fb=function(_0x24cf70){while(--_0x24cf70){_0x1928c9['push'](_0x1928c9['shift']());}};_0x51b5fb(++_0x13a6d1);}(_0xd0f4,0xbc));var _0x4d0f=function(_0x305eaf,_0x127ed7){_0x305eaf=_0x305eaf-0x0;var _0x3dd10f=_0xd0f4[_0x305eaf];return _0x3dd10f;};'use strict';var client=require(_0x4d0f('0x0'));exports[_0x4d0f('0x1')]=function(){return function(){return client[_0x4d0f('0x2')]('GetFaxQueue',{'options':{'raw':![],'attributes':['id',_0x4d0f('0x3'),_0x4d0f('0x4'),_0x4d0f('0x5')],'include':[{'model':_0x4d0f('0x6'),'as':_0x4d0f('0x7'),'attributes':['id',_0x4d0f('0x3'),_0x4d0f('0x8'),_0x4d0f('0x9')]}]},'log':_0x4d0f('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueueReport.js b/server/services/routing/rpc/faxQueueReport.js index f8ddfb9..3c11767 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 _0x4472=['update','UpdateFaxQueueReport','DESC','create','Request','CreateFaxQueueReport'];(function(_0x5a776b,_0x46f785){var _0xbbef59=function(_0x38313e){while(--_0x38313e){_0x5a776b['push'](_0x5a776b['shift']());}};_0xbbef59(++_0x46f785);}(_0x4472,0x13b));var _0x2447=function(_0x525e4f,_0x54bfbb){_0x525e4f=_0x525e4f-0x0;var _0x45a511=_0x4472[_0x525e4f];return _0x45a511;};'use strict';var client=require('../client');exports[_0x2447('0x0')]=function(_0x402507){return client[_0x2447('0x1')](_0x2447('0x2'),{'body':_0x402507,'log':_0x2447('0x2')});};exports[_0x2447('0x3')]=function(_0x4314ee,_0x1d83f5){return client[_0x2447('0x1')](_0x2447('0x4'),{'body':_0x1d83f5,'options':{'where':{'uniqueid':_0x4314ee},'order':[['id',_0x2447('0x5')]],'limit':0x1},'log':'UpdateFaxQueueReport'});}; \ No newline at end of file +var _0x31db=['CreateFaxQueueReport','Request','DESC','UpdateFaxQueueReport','../client','create'];(function(_0x8ffd8,_0x54631e){var _0x12f8c7=function(_0x553676){while(--_0x553676){_0x8ffd8['push'](_0x8ffd8['shift']());}};_0x12f8c7(++_0x54631e);}(_0x31db,0x16c));var _0xb31d=function(_0x17b6e3,_0x4522ed){_0x17b6e3=_0x17b6e3-0x0;var _0x3906f3=_0x31db[_0x17b6e3];return _0x3906f3;};'use strict';var client=require(_0xb31d('0x0'));exports[_0xb31d('0x1')]=function(_0x772fed){return client['Request'](_0xb31d('0x2'),{'body':_0x772fed,'log':'CreateFaxQueueReport'});};exports['update']=function(_0xc85dfa,_0x2be8ce){return client[_0xb31d('0x3')]('UpdateFaxQueueReport',{'body':_0x2be8ce,'options':{'where':{'uniqueid':_0xc85dfa},'order':[['id',_0xb31d('0x4')]],'limit':0x1},'log':_0xb31d('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/interval.js b/server/services/routing/rpc/interval.js index 598a30f..ef4f6ab 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 _0xe204=['Interval','Intervals','interval','getIntervals','GetInterval','name'];(function(_0x38a4b2,_0x48c805){var _0x15d864=function(_0x13d6b0){while(--_0x13d6b0){_0x38a4b2['push'](_0x38a4b2['shift']());}};_0x15d864(++_0x48c805);}(_0xe204,0x12f));var _0x4e20=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0xe204[_0x19950b];return _0x3c6b41;};'use strict';var client=require('../client');exports[_0x4e20('0x0')]=function(){return function(){return client['Request'](_0x4e20('0x1'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0x4e20('0x2')],'include':[{'model':_0x4e20('0x3'),'as':_0x4e20('0x4'),'attributes':['id',_0x4e20('0x2'),_0x4e20('0x5')]}]},'log':_0x4e20('0x0')});};}; \ No newline at end of file +var _0x50a0=['GetInterval','name','Interval','Intervals','../client','getIntervals'];(function(_0x52f2c8,_0x36a14c){var _0x41a0f1=function(_0x32f813){while(--_0x32f813){_0x52f2c8['push'](_0x52f2c8['shift']());}};_0x41a0f1(++_0x36a14c);}(_0x50a0,0x1ba));var _0x050a=function(_0x14684a,_0x5cbf9a){_0x14684a=_0x14684a-0x0;var _0x3749b4=_0x50a0[_0x14684a];return _0x3749b4;};'use strict';var client=require(_0x050a('0x0'));exports[_0x050a('0x1')]=function(){return function(){return client['Request'](_0x050a('0x2'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0x050a('0x3')],'include':[{'model':_0x050a('0x4'),'as':_0x050a('0x5'),'attributes':['id',_0x050a('0x3'),'interval']}]},'log':_0x050a('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailInteraction.js b/server/services/routing/rpc/mailInteraction.js index 7f849c9..62301e6 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 _0xcf2f=['update','Request','updateMailInteraction','addTags','AddTagsToMailInteraction','addTagsToChatInteraction','../client'];(function(_0x4a2265,_0xbf8f8a){var _0x2e0091=function(_0x265c60){while(--_0x265c60){_0x4a2265['push'](_0x4a2265['shift']());}};_0x2e0091(++_0xbf8f8a);}(_0xcf2f,0xa7));var _0xfcf2=function(_0x2f8347,_0x1ecb0b){_0x2f8347=_0x2f8347-0x0;var _0x35ede2=_0xcf2f[_0x2f8347];return _0x35ede2;};'use strict';var client=require(_0xfcf2('0x0'));exports[_0xfcf2('0x1')]=function(_0xe6b3a5,_0x3165cf){return client[_0xfcf2('0x2')]('UpdateMailInteraction',{'body':_0x3165cf,'options':{'where':{'id':_0xe6b3a5}},'log':_0xfcf2('0x3')});};exports[_0xfcf2('0x4')]=function(_0x1e3661,_0x34bcaf){return client[_0xfcf2('0x2')](_0xfcf2('0x5'),{'body':_0x34bcaf,'options':{'where':{'id':_0x1e3661}},'log':_0xfcf2('0x6')});}; \ No newline at end of file +var _0x4213=['../client','update','Request','UpdateMailInteraction','updateMailInteraction','AddTagsToMailInteraction','addTagsToChatInteraction'];(function(_0x4a7a6a,_0x58d67c){var _0x16a207=function(_0x198f07){while(--_0x198f07){_0x4a7a6a['push'](_0x4a7a6a['shift']());}};_0x16a207(++_0x58d67c);}(_0x4213,0x77));var _0x3421=function(_0x1471d1,_0x4aca3a){_0x1471d1=_0x1471d1-0x0;var _0x2940f6=_0x4213[_0x1471d1];return _0x2940f6;};'use strict';var client=require(_0x3421('0x0'));exports[_0x3421('0x1')]=function(_0x324515,_0x7870a4){return client[_0x3421('0x2')](_0x3421('0x3'),{'body':_0x7870a4,'options':{'where':{'id':_0x324515}},'log':_0x3421('0x4')});};exports['addTags']=function(_0xdbd54e,_0x5c3719){return client[_0x3421('0x2')](_0x3421('0x5'),{'body':_0x5c3719,'options':{'where':{'id':_0xdbd54e}},'log':_0x3421('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailMessage.js b/server/services/routing/rpc/mailMessage.js index a1afa55..40f528d 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 _0xffb6=['createMailMessage','Request'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xffb6,0x1e3));var _0x6ffb=function(_0x5e24f1,_0x427899){_0x5e24f1=_0x5e24f1-0x0;var _0x344349=_0xffb6[_0x5e24f1];return _0x344349;};'use strict';var client=require('../client');exports['create']=function(_0x43ade8){return client[_0x6ffb('0x0')]('CreateMailMessage',{'body':_0x43ade8,'log':_0x6ffb('0x1')});}; \ No newline at end of file +var _0xcf88=['Request','createMailMessage','../client','create'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xcf88,0x9e));var _0x8cf8=function(_0x33032e,_0x31411a){_0x33032e=_0x33032e-0x0;var _0x13316b=_0xcf88[_0x33032e];return _0x13316b;};'use strict';var client=require(_0x8cf8('0x0'));exports[_0x8cf8('0x1')]=function(_0x4e95bf){return client[_0x8cf8('0x2')]('CreateMailMessage',{'body':_0x4e95bf,'log':_0x8cf8('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueue.js b/server/services/routing/rpc/mailQueue.js index 069ff8c..c2fdc19 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 _0x88a7=['mailPause','../client','getMailQueues','Request','GetMailQueue','timeout','strategy','User','Agents','name'];(function(_0x22ae57,_0xfc3947){var _0xa49cce=function(_0x323a1d){while(--_0x323a1d){_0x22ae57['push'](_0x22ae57['shift']());}};_0xa49cce(++_0xfc3947);}(_0x88a7,0xab));var _0x788a=function(_0x1e2aae,_0x2349e3){_0x1e2aae=_0x1e2aae-0x0;var _0x4d8a43=_0x88a7[_0x1e2aae];return _0x4d8a43;};'use strict';var client=require(_0x788a('0x0'));exports[_0x788a('0x1')]=function(){return function(){return client[_0x788a('0x2')](_0x788a('0x3'),{'options':{'raw':![],'attributes':['id','name',_0x788a('0x4'),_0x788a('0x5')],'include':[{'model':_0x788a('0x6'),'as':_0x788a('0x7'),'attributes':['id',_0x788a('0x8'),'online',_0x788a('0x9')]}]},'log':_0x788a('0x1')});};}; \ No newline at end of file +var _0xe208=['name','online','mailPause','../client','getMailQueues','Request','GetMailQueue','timeout','strategy','User','Agents'];(function(_0x255d5b,_0x4f6f35){var _0x3e141a=function(_0x249ee2){while(--_0x249ee2){_0x255d5b['push'](_0x255d5b['shift']());}};_0x3e141a(++_0x4f6f35);}(_0xe208,0xa8));var _0x8e20=function(_0x5d80de,_0x2cf15d){_0x5d80de=_0x5d80de-0x0;var _0x1c7556=_0xe208[_0x5d80de];return _0x1c7556;};'use strict';var client=require(_0x8e20('0x0'));exports[_0x8e20('0x1')]=function(){return function(){return client[_0x8e20('0x2')](_0x8e20('0x3'),{'options':{'raw':![],'attributes':['id','name',_0x8e20('0x4'),_0x8e20('0x5')],'include':[{'model':_0x8e20('0x6'),'as':_0x8e20('0x7'),'attributes':['id',_0x8e20('0x8'),_0x8e20('0x9'),_0x8e20('0xa')]}]},'log':_0x8e20('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueueReport.js b/server/services/routing/rpc/mailQueueReport.js index 292260e..f7a65d6 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 _0xb6e9=['CreateMailQueueReport','update','DESC','UpdateMailQueueReport','../client','create','Request'];(function(_0x20589d,_0x55d5bf){var _0x422de9=function(_0x44cbbb){while(--_0x44cbbb){_0x20589d['push'](_0x20589d['shift']());}};_0x422de9(++_0x55d5bf);}(_0xb6e9,0x170));var _0x9b6e=function(_0x3354be,_0x5ba886){_0x3354be=_0x3354be-0x0;var _0x5745cc=_0xb6e9[_0x3354be];return _0x5745cc;};'use strict';var client=require(_0x9b6e('0x0'));exports[_0x9b6e('0x1')]=function(_0x47e39c){return client[_0x9b6e('0x2')](_0x9b6e('0x3'),{'body':_0x47e39c,'log':_0x9b6e('0x3')});};exports[_0x9b6e('0x4')]=function(_0x3f4b78,_0x2529cf){return client[_0x9b6e('0x2')]('UpdateMailQueueReport',{'body':_0x2529cf,'options':{'where':{'uniqueid':_0x3f4b78},'order':[['id',_0x9b6e('0x5')]],'limit':0x1},'log':_0x9b6e('0x6')});}; \ No newline at end of file +var _0xe6a8=['UpdateMailQueueReport','create','Request','CreateMailQueueReport','update'];(function(_0x42b808,_0x3db04e){var _0x1f9dad=function(_0x35cc36){while(--_0x35cc36){_0x42b808['push'](_0x42b808['shift']());}};_0x1f9dad(++_0x3db04e);}(_0xe6a8,0xf1));var _0x8e6a=function(_0x1c567a,_0x5301c9){_0x1c567a=_0x1c567a-0x0;var _0x50e362=_0xe6a8[_0x1c567a];return _0x50e362;};'use strict';var client=require('../client');exports[_0x8e6a('0x0')]=function(_0x2ade1f){return client[_0x8e6a('0x1')](_0x8e6a('0x2'),{'body':_0x2ade1f,'log':_0x8e6a('0x2')});};exports[_0x8e6a('0x3')]=function(_0x121ea1,_0x1f9ff1){return client[_0x8e6a('0x1')](_0x8e6a('0x4'),{'body':_0x1f9ff1,'options':{'where':{'uniqueid':_0x121ea1},'order':[['id','DESC']],'limit':0x1},'log':'UpdateMailQueueReport'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelInteraction.js b/server/services/routing/rpc/openchannelInteraction.js index bfd5921..6380a08 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 _0x1f17=['updateOpenchannelInteraction','addTags','addTagsToChatInteraction','../client','update','Request','UpdateOpenchannelInteraction'];(function(_0x31e29a,_0x349c9b){var _0x32d892=function(_0x41cc86){while(--_0x41cc86){_0x31e29a['push'](_0x31e29a['shift']());}};_0x32d892(++_0x349c9b);}(_0x1f17,0x17d));var _0x71f1=function(_0x581249,_0x483f03){_0x581249=_0x581249-0x0;var _0x284bae=_0x1f17[_0x581249];return _0x284bae;};'use strict';var client=require(_0x71f1('0x0'));exports[_0x71f1('0x1')]=function(_0x4d61ad,_0x2a645c){return client[_0x71f1('0x2')](_0x71f1('0x3'),{'body':_0x2a645c,'options':{'where':{'id':_0x4d61ad}},'log':_0x71f1('0x4')});};exports[_0x71f1('0x5')]=function(_0x2777a3,_0xd48012){return client[_0x71f1('0x2')]('AddTagsToOpenchannelInteraction',{'body':_0xd48012,'options':{'where':{'id':_0x2777a3}},'log':_0x71f1('0x6')});}; \ No newline at end of file +var _0xe9a8=['updateOpenchannelInteraction','addTags','AddTagsToOpenchannelInteraction','addTagsToChatInteraction','../client','update','Request','UpdateOpenchannelInteraction'];(function(_0x52ed25,_0x308ecb){var _0x13f8c8=function(_0x36f53c){while(--_0x36f53c){_0x52ed25['push'](_0x52ed25['shift']());}};_0x13f8c8(++_0x308ecb);}(_0xe9a8,0x194));var _0x8e9a=function(_0x43ee7e,_0x78e09b){_0x43ee7e=_0x43ee7e-0x0;var _0x22d326=_0xe9a8[_0x43ee7e];return _0x22d326;};'use strict';var client=require(_0x8e9a('0x0'));exports[_0x8e9a('0x1')]=function(_0x58c392,_0x2135c8){return client[_0x8e9a('0x2')](_0x8e9a('0x3'),{'body':_0x2135c8,'options':{'where':{'id':_0x58c392}},'log':_0x8e9a('0x4')});};exports[_0x8e9a('0x5')]=function(_0x198184,_0x5dce81){return client[_0x8e9a('0x2')](_0x8e9a('0x6'),{'body':_0x5dce81,'options':{'where':{'id':_0x198184}},'log':_0x8e9a('0x7')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelMessage.js b/server/services/routing/rpc/openchannelMessage.js index fbe8513..f945afd 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 _0xdb5d=['create','createOpenchannelMessage'];(function(_0x172ed7,_0x3d08fd){var _0xfa8f61=function(_0xe07a21){while(--_0xe07a21){_0x172ed7['push'](_0x172ed7['shift']());}};_0xfa8f61(++_0x3d08fd);}(_0xdb5d,0xec));var _0xddb5=function(_0x5c7a25,_0x19e63c){_0x5c7a25=_0x5c7a25-0x0;var _0x1a86a9=_0xdb5d[_0x5c7a25];return _0x1a86a9;};'use strict';var client=require('../client');exports[_0xddb5('0x0')]=function(_0x2f5204){return client['Request']('CreateOpenchannelMessage',{'body':_0x2f5204,'log':_0xddb5('0x1')});}; \ No newline at end of file +var _0x1604=['Request','createOpenchannelMessage','../client','create'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1604,0xbe));var _0x4160=function(_0x35d77b,_0x31b9ee){_0x35d77b=_0x35d77b-0x0;var _0x59a4bc=_0x1604[_0x35d77b];return _0x59a4bc;};'use strict';var client=require(_0x4160('0x0'));exports[_0x4160('0x1')]=function(_0x796f27){return client[_0x4160('0x2')]('CreateOpenchannelMessage',{'body':_0x796f27,'log':_0x4160('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueue.js b/server/services/routing/rpc/openchannelQueue.js index c2c8e65..5199344 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 _0x6c55=['openchannelPause','getOpenchannelQueues','Request','GetOpenchannelQueue','name','timeout','strategy','Agents'];(function(_0xd7134b,_0x93eb64){var _0x2960fc=function(_0x314b16){while(--_0x314b16){_0xd7134b['push'](_0xd7134b['shift']());}};_0x2960fc(++_0x93eb64);}(_0x6c55,0x101));var _0x56c5=function(_0x587783,_0x6296e6){_0x587783=_0x587783-0x0;var _0x1cca44=_0x6c55[_0x587783];return _0x1cca44;};'use strict';var client=require('../client');exports[_0x56c5('0x0')]=function(){return function(){return client[_0x56c5('0x1')](_0x56c5('0x2'),{'options':{'raw':![],'attributes':['id',_0x56c5('0x3'),_0x56c5('0x4'),_0x56c5('0x5')],'include':[{'model':'User','as':_0x56c5('0x6'),'attributes':['id','name','online',_0x56c5('0x7')]}]},'log':_0x56c5('0x0')});};}; \ No newline at end of file +var _0x5cd8=['GetOpenchannelQueue','name','timeout','User','online','openchannelPause','getOpenchannelQueues','../client','Request'];(function(_0x256452,_0x1e36a3){var _0x3bcfee=function(_0x3efd00){while(--_0x3efd00){_0x256452['push'](_0x256452['shift']());}};_0x3bcfee(++_0x1e36a3);}(_0x5cd8,0x1d2));var _0x85cd=function(_0x26f0ad,_0x2fc7c2){_0x26f0ad=_0x26f0ad-0x0;var _0x118efb=_0x5cd8[_0x26f0ad];return _0x118efb;};'use strict';var client=require(_0x85cd('0x0'));exports['getOpenchannelQueues']=function(){return function(){return client[_0x85cd('0x1')](_0x85cd('0x2'),{'options':{'raw':![],'attributes':['id',_0x85cd('0x3'),_0x85cd('0x4'),'strategy'],'include':[{'model':_0x85cd('0x5'),'as':'Agents','attributes':['id',_0x85cd('0x3'),_0x85cd('0x6'),_0x85cd('0x7')]}]},'log':_0x85cd('0x8')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueueReport.js b/server/services/routing/rpc/openchannelQueueReport.js index 41f3cb4..381b3d9 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 _0xde7f=['DESC','create','Request','CreateOpenchannelQueueReport','update','UpdateOpenchannelQueueReport'];(function(_0x35e6db,_0x53779d){var _0x249409=function(_0x72785d){while(--_0x72785d){_0x35e6db['push'](_0x35e6db['shift']());}};_0x249409(++_0x53779d);}(_0xde7f,0x18d));var _0xfde7=function(_0x41bde4,_0x256f0c){_0x41bde4=_0x41bde4-0x0;var _0x37fa9e=_0xde7f[_0x41bde4];return _0x37fa9e;};'use strict';var client=require('../client');exports[_0xfde7('0x0')]=function(_0x31b27d){return client[_0xfde7('0x1')]('CreateOpenchannelQueueReport',{'body':_0x31b27d,'log':_0xfde7('0x2')});};exports[_0xfde7('0x3')]=function(_0x44c430,_0x85f1f5){return client['Request'](_0xfde7('0x4'),{'body':_0x85f1f5,'options':{'where':{'uniqueid':_0x44c430},'order':[['id',_0xfde7('0x5')]],'limit':0x1},'log':_0xfde7('0x4')});}; \ No newline at end of file +var _0x56e5=['../client','create','Request','CreateOpenchannelQueueReport','update','UpdateOpenchannelQueueReport','DESC'];(function(_0x51fc96,_0x17134c){var _0x50d2fa=function(_0x1b825e){while(--_0x1b825e){_0x51fc96['push'](_0x51fc96['shift']());}};_0x50d2fa(++_0x17134c);}(_0x56e5,0x18f));var _0x556e=function(_0x4c67e1,_0xbfa4f){_0x4c67e1=_0x4c67e1-0x0;var _0x53ef74=_0x56e5[_0x4c67e1];return _0x53ef74;};'use strict';var client=require(_0x556e('0x0'));exports[_0x556e('0x1')]=function(_0x9e5252){return client[_0x556e('0x2')](_0x556e('0x3'),{'body':_0x9e5252,'log':_0x556e('0x3')});};exports[_0x556e('0x4')]=function(_0x9b3412,_0x367309){return client['Request'](_0x556e('0x5'),{'body':_0x367309,'options':{'where':{'uniqueid':_0x9b3412},'order':[['id',_0x556e('0x6')]],'limit':0x1},'log':_0x556e('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsInteraction.js b/server/services/routing/rpc/smsInteraction.js index 1bce61a..bd5b9c9 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 _0xe64a=['UpdateSmsInteraction','updateSmsInteraction','addTags','addTagsToSmsInteraction','../client','update','Request'];(function(_0x39772f,_0x5605cb){var _0xc9edbf=function(_0x106a39){while(--_0x106a39){_0x39772f['push'](_0x39772f['shift']());}};_0xc9edbf(++_0x5605cb);}(_0xe64a,0x1e0));var _0xae64=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0xe64a[_0x42cae2];return _0x5f256f;};'use strict';var client=require(_0xae64('0x0'));exports[_0xae64('0x1')]=function(_0x37e50f,_0x2e403d){return client[_0xae64('0x2')](_0xae64('0x3'),{'body':_0x2e403d,'options':{'where':{'id':_0x37e50f}},'log':_0xae64('0x4')});};exports[_0xae64('0x5')]=function(_0x5c8e95,_0x4a2982){return client['Request']('AddTagsToSmsInteraction',{'body':_0x4a2982,'options':{'where':{'id':_0x5c8e95}},'log':_0xae64('0x6')});}; \ No newline at end of file +var _0x4016=['updateSmsInteraction','addTagsToSmsInteraction','update'];(function(_0x5c351c,_0x2046d8){var _0x26f3b3=function(_0x47ac18){while(--_0x47ac18){_0x5c351c['push'](_0x5c351c['shift']());}};_0x26f3b3(++_0x2046d8);}(_0x4016,0x131));var _0x6401=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x4016[_0x6c993a];return _0x27f547;};'use strict';var client=require('../client');exports[_0x6401('0x0')]=function(_0x40f99f,_0x48c66b){return client['Request']('UpdateSmsInteraction',{'body':_0x48c66b,'options':{'where':{'id':_0x40f99f}},'log':_0x6401('0x1')});};exports['addTags']=function(_0x4fc38,_0x27c82a){return client['Request']('AddTagsToSmsInteraction',{'body':_0x27c82a,'options':{'where':{'id':_0x4fc38}},'log':_0x6401('0x2')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsMessage.js b/server/services/routing/rpc/smsMessage.js index ef5fa1f..c36e536 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 _0x4841=['../client','create','Request','CreateSmsMessage','createSmsMessage'];(function(_0x5b36bd,_0x4dfb36){var _0x1614fe=function(_0x559b7c){while(--_0x559b7c){_0x5b36bd['push'](_0x5b36bd['shift']());}};_0x1614fe(++_0x4dfb36);}(_0x4841,0x154));var _0x1484=function(_0x4a3f82,_0x5cb0f5){_0x4a3f82=_0x4a3f82-0x0;var _0x53afd8=_0x4841[_0x4a3f82];return _0x53afd8;};'use strict';var client=require(_0x1484('0x0'));exports[_0x1484('0x1')]=function(_0xf6d7bd){return client[_0x1484('0x2')](_0x1484('0x3'),{'body':_0xf6d7bd,'log':_0x1484('0x4')});}; \ No newline at end of file +var _0x5801=['Request','createSmsMessage','../client'];(function(_0xdd6f49,_0x3eaf21){var _0x27a8f7=function(_0x99d5c6){while(--_0x99d5c6){_0xdd6f49['push'](_0xdd6f49['shift']());}};_0x27a8f7(++_0x3eaf21);}(_0x5801,0x7a));var _0x1580=function(_0x107a8d,_0x2045d7){_0x107a8d=_0x107a8d-0x0;var _0x2db916=_0x5801[_0x107a8d];return _0x2db916;};'use strict';var client=require(_0x1580('0x0'));exports['create']=function(_0x262e47){return client[_0x1580('0x1')]('CreateSmsMessage',{'body':_0x262e47,'log':_0x1580('0x2')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueue.js b/server/services/routing/rpc/smsQueue.js index 3a79bd1..2ddc42b 100644 --- a/server/services/routing/rpc/smsQueue.js +++ b/server/services/routing/rpc/smsQueue.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb7e7=['online','../client','Request','name','strategy','Agents'];(function(_0x550eb6,_0x3771fd){var _0x13a91e=function(_0xc75f60){while(--_0xc75f60){_0x550eb6['push'](_0x550eb6['shift']());}};_0x13a91e(++_0x3771fd);}(_0xb7e7,0x121));var _0x7b7e=function(_0x1fc122,_0x5e2c17){_0x1fc122=_0x1fc122-0x0;var _0xa2cb13=_0xb7e7[_0x1fc122];return _0xa2cb13;};'use strict';var client=require(_0x7b7e('0x0'));exports['getSmsQueues']=function(){return function(){return client[_0x7b7e('0x1')]('GetSmsQueue',{'options':{'raw':![],'attributes':['id',_0x7b7e('0x2'),'timeout',_0x7b7e('0x3')],'include':[{'model':'User','as':_0x7b7e('0x4'),'attributes':['id',_0x7b7e('0x2'),_0x7b7e('0x5'),'smsPause']}]},'log':'getSmsQueues'});};}; \ No newline at end of file +var _0xd8b0=['timeout','strategy','User','Agents','name','../client','getSmsQueues'];(function(_0x101539,_0x1cddcd){var _0x42446f=function(_0x1435a5){while(--_0x1435a5){_0x101539['push'](_0x101539['shift']());}};_0x42446f(++_0x1cddcd);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'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 c37705f..9f4d1b2 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(_0x350508,_0x3e32ae){var _0x3ff5d9=function(_0x1e1081){while(--_0x1e1081){_0x350508['push'](_0x350508['shift']());}};_0x3ff5d9(++_0x3e32ae);}(_0x34e8,0x12c));var _0x834e=function(_0x5dccc5,_0x2ba719){_0x5dccc5=_0x5dccc5-0x0;var _0x44d285=_0x34e8[_0x5dccc5];return _0x44d285;};'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 _0x008c=['../client','create','Request','CreateSmsQueueReport','update','UpdateSmsQueueReport','DESC'];(function(_0x2f16e5,_0x2e75e0){var _0x5d082a=function(_0x13873b){while(--_0x13873b){_0x2f16e5['push'](_0x2f16e5['shift']());}};_0x5d082a(++_0x2e75e0);}(_0x008c,0x188));var _0xc008=function(_0x1f063b,_0x321a3c){_0x1f063b=_0x1f063b-0x0;var _0x4d864b=_0x008c[_0x1f063b];return _0x4d864b;};'use strict';var client=require(_0xc008('0x0'));exports[_0xc008('0x1')]=function(_0x15aadc){return client[_0xc008('0x2')](_0xc008('0x3'),{'body':_0x15aadc,'log':'CreateSmsQueueReport'});};exports[_0xc008('0x4')]=function(_0x47063f,_0x10b33c){return client[_0xc008('0x2')](_0xc008('0x5'),{'body':_0x10b33c,'options':{'where':{'uniqueid':_0x47063f},'order':[['id',_0xc008('0x6')]],'limit':0x1},'log':_0xc008('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/user.js b/server/services/routing/rpc/user.js index 0ed581d..3cfe0fa 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(_0x2de4d1,_0x37938d){var _0x430aa0=function(_0x3c20ec){while(--_0x3c20ec){_0x2de4d1['push'](_0x2de4d1['shift']());}};_0x430aa0(++_0x37938d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0xa9e0[_0x2f5ac5];return _0x37c9a8;};'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(_0x3bc15e,_0x872aff){var _0x49087c=function(_0x3dbf7a){while(--_0x3dbf7a){_0x3bc15e['push'](_0x3bc15e['shift']());}};_0x49087c(++_0x872aff);}(_0xa9e0,0x123));var _0x0a9e=function(_0x173d7e,_0x3242fd){_0x173d7e=_0x173d7e-0x0;var _0x2220d6=_0xa9e0[_0x173d7e];return _0x2220d6;};'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 1e177e9..8e58f71 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 _0x53ec=['../client','update','Request','UpdateWhatsappInteraction','addTags','addTagsToWhatsappInteraction'];(function(_0x1c4b31,_0x2540e6){var _0x2be0c3=function(_0x512529){while(--_0x512529){_0x1c4b31['push'](_0x1c4b31['shift']());}};_0x2be0c3(++_0x2540e6);}(_0x53ec,0x192));var _0xc53e=function(_0x55c8e3,_0x4addd4){_0x55c8e3=_0x55c8e3-0x0;var _0x7e6c2c=_0x53ec[_0x55c8e3];return _0x7e6c2c;};'use strict';var client=require(_0xc53e('0x0'));exports[_0xc53e('0x1')]=function(_0x2d5f51,_0x476d3a){return client[_0xc53e('0x2')](_0xc53e('0x3'),{'body':_0x476d3a,'options':{'where':{'id':_0x2d5f51}},'log':'updateWhatsappInteraction'});};exports[_0xc53e('0x4')]=function(_0x4e954a,_0x2b90f6){return client[_0xc53e('0x2')]('AddTagsToWhatsappInteraction',{'body':_0x2b90f6,'options':{'where':{'id':_0x4e954a}},'log':_0xc53e('0x5')});}; \ No newline at end of file +var _0xbd0a=['Request','AddTagsToWhatsappInteraction','addTagsToWhatsappInteraction','../client','updateWhatsappInteraction','addTags'];(function(_0x19ad35,_0x145d41){var _0x3327c9=function(_0x306f9d){while(--_0x306f9d){_0x19ad35['push'](_0x19ad35['shift']());}};_0x3327c9(++_0x145d41);}(_0xbd0a,0x1b9));var _0xabd0=function(_0x666779,_0x5d9927){_0x666779=_0x666779-0x0;var _0x482d9d=_0xbd0a[_0x666779];return _0x482d9d;};'use strict';var client=require(_0xabd0('0x0'));exports['update']=function(_0x3b0fc0,_0x48c569){return client['Request']('UpdateWhatsappInteraction',{'body':_0x48c569,'options':{'where':{'id':_0x3b0fc0}},'log':_0xabd0('0x1')});};exports[_0xabd0('0x2')]=function(_0x41e52b,_0x3d1138){return client[_0xabd0('0x3')](_0xabd0('0x4'),{'body':_0x3d1138,'options':{'where':{'id':_0x41e52b}},'log':_0xabd0('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappMessage.js b/server/services/routing/rpc/whatsappMessage.js index 137605a..037868e 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 _0x051e=['create','Request','CreateWhatsappMessage','createWhatsappMessage','../client'];(function(_0x2f9cbc,_0x42cf1b){var _0xd91e8=function(_0x183a29){while(--_0x183a29){_0x2f9cbc['push'](_0x2f9cbc['shift']());}};_0xd91e8(++_0x42cf1b);}(_0x051e,0x95));var _0xe051=function(_0xb6e2f9,_0x30daf5){_0xb6e2f9=_0xb6e2f9-0x0;var _0x44e6e7=_0x051e[_0xb6e2f9];return _0x44e6e7;};'use strict';var client=require(_0xe051('0x0'));exports[_0xe051('0x1')]=function(_0x7356b){return client[_0xe051('0x2')](_0xe051('0x3'),{'body':_0x7356b,'log':_0xe051('0x4')});}; \ No newline at end of file +var _0x8cf0=['createWhatsappMessage','../client','create','Request','CreateWhatsappMessage'];(function(_0x36f243,_0x188505){var _0x426436=function(_0x1c8622){while(--_0x1c8622){_0x36f243['push'](_0x36f243['shift']());}};_0x426436(++_0x188505);}(_0x8cf0,0xa1));var _0x08cf=function(_0x430658,_0x4d42e3){_0x430658=_0x430658-0x0;var _0x3507cc=_0x8cf0[_0x430658];return _0x3507cc;};'use strict';var client=require(_0x08cf('0x0'));exports[_0x08cf('0x1')]=function(_0x18a922){return client[_0x08cf('0x2')](_0x08cf('0x3'),{'body':_0x18a922,'log':_0x08cf('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueue.js b/server/services/routing/rpc/whatsappQueue.js index d24ea58..7ecb58c 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 _0x7c84=['online','getWhatsappQueues','Request','GetWhatsappQueue','timeout','User','Agents','name'];(function(_0x122096,_0x60c295){var _0x3d1966=function(_0x3d569e){while(--_0x3d569e){_0x122096['push'](_0x122096['shift']());}};_0x3d1966(++_0x60c295);}(_0x7c84,0x139));var _0x47c8=function(_0x2a33a5,_0x565be9){_0x2a33a5=_0x2a33a5-0x0;var _0x448379=_0x7c84[_0x2a33a5];return _0x448379;};'use strict';var client=require('../client');exports[_0x47c8('0x0')]=function(){return function(){return client[_0x47c8('0x1')](_0x47c8('0x2'),{'options':{'raw':![],'attributes':['id','name',_0x47c8('0x3'),'strategy'],'include':[{'model':_0x47c8('0x4'),'as':_0x47c8('0x5'),'attributes':['id',_0x47c8('0x6'),_0x47c8('0x7'),'whatsappPause']}]},'log':'getWhatsappQueues'});};}; \ No newline at end of file +var _0x3c41=['strategy','Agents','online','getWhatsappQueues','../client','Request','GetWhatsappQueue','name','timeout'];(function(_0x2ab802,_0x5ee80e){var _0x31fa4a=function(_0x2d6ec5){while(--_0x2d6ec5){_0x2ab802['push'](_0x2ab802['shift']());}};_0x31fa4a(++_0x5ee80e);}(_0x3c41,0x190));var _0x13c4=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x3c41[_0x397e5f];return _0x5302b8;};'use strict';var client=require(_0x13c4('0x0'));exports['getWhatsappQueues']=function(){return function(){return client[_0x13c4('0x1')](_0x13c4('0x2'),{'options':{'raw':![],'attributes':['id',_0x13c4('0x3'),_0x13c4('0x4'),_0x13c4('0x5')],'include':[{'model':'User','as':_0x13c4('0x6'),'attributes':['id','name',_0x13c4('0x7'),'whatsappPause']}]},'log':_0x13c4('0x8')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueueReport.js b/server/services/routing/rpc/whatsappQueueReport.js index a15251f..d26c083 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 _0x706c=['update','UpdateWhatsappQueueReport','DESC','../client','create','Request','CreateWhatsappQueueReport'];(function(_0x24b852,_0x2bad67){var _0x180ad2=function(_0x454562){while(--_0x454562){_0x24b852['push'](_0x24b852['shift']());}};_0x180ad2(++_0x2bad67);}(_0x706c,0xc0));var _0xc706=function(_0x4aac5a,_0x15b04c){_0x4aac5a=_0x4aac5a-0x0;var _0x42e7bc=_0x706c[_0x4aac5a];return _0x42e7bc;};'use strict';var client=require(_0xc706('0x0'));exports[_0xc706('0x1')]=function(_0x48efbc){return client[_0xc706('0x2')]('CreateWhatsappQueueReport',{'body':_0x48efbc,'log':_0xc706('0x3')});};exports[_0xc706('0x4')]=function(_0x5499e0,_0x555ff7){return client[_0xc706('0x2')](_0xc706('0x5'),{'body':_0x555ff7,'options':{'where':{'uniqueid':_0x5499e0},'order':[['id',_0xc706('0x6')]],'limit':0x1},'log':'UpdateWhatsappQueueReport'});}; \ No newline at end of file +var _0xa8c6=['CreateWhatsappQueueReport','UpdateWhatsappQueueReport','DESC','create','Request'];(function(_0x1303f6,_0x35ba3d){var _0x412b46=function(_0x508bc0){while(--_0x508bc0){_0x1303f6['push'](_0x1303f6['shift']());}};_0x412b46(++_0x35ba3d);}(_0xa8c6,0x9e));var _0x6a8c=function(_0x3998ff,_0x58f511){_0x3998ff=_0x3998ff-0x0;var _0xfd997d=_0xa8c6[_0x3998ff];return _0xfd997d;};'use strict';var client=require('../client');exports[_0x6a8c('0x0')]=function(_0x337f7c){return client[_0x6a8c('0x1')](_0x6a8c('0x2'),{'body':_0x337f7c,'log':_0x6a8c('0x2')});};exports['update']=function(_0x1a975b,_0x40a2be){return client[_0x6a8c('0x1')](_0x6a8c('0x3'),{'body':_0x40a2be,'options':{'where':{'uniqueid':_0x1a975b},'order':[['id',_0x6a8c('0x4')]],'limit':0x1},'log':_0x6a8c('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 0c0e81f..bd60550 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 _0x0651=['stop','find','agents','timeout','atimeout','channel','START:%s','rules','end','info','[%s][AGENT]\x20ROUTING\x20STOPPED','complete','[%s][AGENT]\x20ROUTING\x20END','close','next','[%s][AGENT]\x20agent\x20not\x20found\x20%s','log','validate','lodash','util','seq-queue','../../../../config/logger','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','format','[%s][AGENT][NAME:%s][STATUS:%s]','name','toLowerCase','consequence','error','[%s][AGENT]\x20%s','map','message','join'];(function(_0xf9902f,_0x4c4134){var _0x2b7edd=function(_0x17822e){while(--_0x17822e){_0xf9902f['push'](_0xf9902f['shift']());}};_0x2b7edd(++_0x4c4134);}(_0x0651,0x1d8));var _0x1065=function(_0x36a754,_0x413940){_0x36a754=_0x36a754-0x0;var _0x4abbad=_0x0651[_0x36a754];return _0x4abbad;};'use strict';var schema=require(_0x1065('0x0'));var _=require(_0x1065('0x1'));var util=require(_0x1065('0x2'));var seqqueue=require(_0x1065('0x3'));var logger=require(_0x1065('0x4'))('routing');var strategy=require('./strategy');var queue=schema({'name':{'type':_0x1065('0x5'),'required':!![],'message':_0x1065('0x6')},'timeout':{'type':_0x1065('0x7'),'message':'timeout\x20is\x20a\x20number'}});function writeLog(_0x415a17,_0xa3b0e9,_0x1373f2){return logger['info'](util[_0x1065('0x8')](_0x1065('0x9'),_0x415a17,_0xa3b0e9[_0x1065('0xa')],_0x1373f2));}function handleFindAgent(_0x29e2f9){return function(_0x443d47){return _0x443d47['name'][_0x1065('0xb')]()===_0x29e2f9[_0x1065('0xb')]();};}exports[_0x1065('0xc')]=function(_0x3165df,_0x49648b,_0x111140,_0x2d4ecb){return function(_0x2f988a){try{var _0x3f6537={'name':_0x49648b[0x0],'timeout':_0x49648b[0x1]};var _0x2653f7=queue[_0x1065('0x0')](_0x3f6537,{'typecast':!![]});if(_0x2653f7['length']){logger[_0x1065('0xd')](_0x1065('0xe'),_0x3165df,_[_0x1065('0xf')](_0x2653f7,_0x1065('0x10'))[_0x1065('0x11')](',\x20'));_0x2f988a[_0x1065('0x12')]();}else{var _0x5662ad=_[_0x1065('0x13')](_0x111140[_0x1065('0x14')],handleFindAgent(_0x3f6537[_0x1065('0xa')]));if(_0x5662ad){var _0x2ff18b=(_0x3f6537[_0x1065('0x15')]||0xa)*0x3e8;var _0x55dfdf,_0x314070;var _0x437fb6=seqqueue['createQueue'](_0x2ff18b);_0x437fb6['id']=_0x3165df;_0x437fb6[_0x1065('0x16')]=_0x2ff18b;_0x437fb6['channel']=_0x2d4ecb[_0x1065('0x17')];writeLog(_0x3165df,_0x5662ad,util[_0x1065('0x8')](_0x1065('0x18'),_0x2ff18b));_0x111140[_0x1065('0x19')][_0x3165df]['on'](_0x1065('0x1a'),function(){logger[_0x1065('0x1b')](_0x1065('0x1c'),_0x3165df);clearTimeout(_0x314070);_0x314070=undefined;_0x437fb6['close']();if(_0x111140[_0x1065('0x19')][_0x3165df]){delete _0x111140['rules'][_0x3165df];}_0x2f988a['stop']();});_0x111140[_0x1065('0x19')][_0x3165df]['on'](_0x1065('0x1d'),function(){if(_0x111140[_0x1065('0x19')][_0x3165df]){delete _0x111140[_0x1065('0x19')][_0x3165df];}});_0x314070=setTimeout(function(){logger[_0x1065('0x1b')](_0x1065('0x1e'),_0x3165df);clearTimeout(_0x314070);_0x437fb6[_0x1065('0x1f')]();_0x2f988a[_0x1065('0x20')]();},_0x2ff18b);strategy['agent'](_0x437fb6,_0x5662ad,_0x111140,_0x2d4ecb);}else{logger['error'](_0x1065('0x21'),_0x3165df,_0x3f6537['name']);_0x2f988a[_0x1065('0x12')]();}}}catch(_0x4332f1){console[_0x1065('0x22')](_0x4332f1);logger[_0x1065('0xd')]('[%s][QUEUE]\x20%s',_0x3165df,_0x4332f1['stack']);_0x2f988a['stop']();}};}; \ No newline at end of file +var _0xfd09=['info','[%s][AGENT]\x20ROUTING\x20STOPPED','stop','complete','close','next','agent','log','[%s][QUEUE]\x20%s','stack','lodash','util','seq-queue','../../../../config/logger','routing','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','format','[%s][AGENT][NAME:%s][STATUS:%s]','name','toLowerCase','consequence','validate','length','error','[%s][AGENT]\x20%s','map','join','find','agents','createQueue','atimeout','channel','rules','end'];(function(_0x1fdeac,_0x337b01){var _0x3b45ec=function(_0x8b0e74){while(--_0x8b0e74){_0x1fdeac['push'](_0x1fdeac['shift']());}};_0x3b45ec(++_0x337b01);}(_0xfd09,0x9a));var _0x9fd0=function(_0x3e8930,_0x154364){_0x3e8930=_0x3e8930-0x0;var _0x15b38f=_0xfd09[_0x3e8930];return _0x15b38f;};'use strict';var schema=require('validate');var _=require(_0x9fd0('0x0'));var util=require(_0x9fd0('0x1'));var seqqueue=require(_0x9fd0('0x2'));var logger=require(_0x9fd0('0x3'))(_0x9fd0('0x4'));var strategy=require('./strategy');var queue=schema({'name':{'type':_0x9fd0('0x5'),'required':!![],'message':_0x9fd0('0x6')},'timeout':{'type':_0x9fd0('0x7'),'message':'timeout\x20is\x20a\x20number'}});function writeLog(_0x284be1,_0x180032,_0x52e65b){return logger['info'](util[_0x9fd0('0x8')](_0x9fd0('0x9'),_0x284be1,_0x180032[_0x9fd0('0xa')],_0x52e65b));}function handleFindAgent(_0x1d8988){return function(_0x79ca54){return _0x79ca54[_0x9fd0('0xa')][_0x9fd0('0xb')]()===_0x1d8988[_0x9fd0('0xb')]();};}exports[_0x9fd0('0xc')]=function(_0x334ccd,_0x7fc714,_0x3dde79,_0x43a439){return function(_0x4424da){try{var _0x5a5b33={'name':_0x7fc714[0x0],'timeout':_0x7fc714[0x1]};var _0x51bb26=queue[_0x9fd0('0xd')](_0x5a5b33,{'typecast':!![]});if(_0x51bb26[_0x9fd0('0xe')]){logger[_0x9fd0('0xf')](_0x9fd0('0x10'),_0x334ccd,_[_0x9fd0('0x11')](_0x51bb26,'message')[_0x9fd0('0x12')](',\x20'));_0x4424da['stop']();}else{var _0x438b76=_[_0x9fd0('0x13')](_0x3dde79[_0x9fd0('0x14')],handleFindAgent(_0x5a5b33[_0x9fd0('0xa')]));if(_0x438b76){var _0x1a79ba=(_0x5a5b33['timeout']||0xa)*0x3e8;var _0x34a5bc,_0x2cc48;var _0x206753=seqqueue[_0x9fd0('0x15')](_0x1a79ba);_0x206753['id']=_0x334ccd;_0x206753[_0x9fd0('0x16')]=_0x1a79ba;_0x206753[_0x9fd0('0x17')]=_0x43a439[_0x9fd0('0x17')];writeLog(_0x334ccd,_0x438b76,util[_0x9fd0('0x8')]('START:%s',_0x1a79ba));_0x3dde79[_0x9fd0('0x18')][_0x334ccd]['on'](_0x9fd0('0x19'),function(){logger[_0x9fd0('0x1a')](_0x9fd0('0x1b'),_0x334ccd);clearTimeout(_0x2cc48);_0x2cc48=undefined;_0x206753['close']();if(_0x3dde79[_0x9fd0('0x18')][_0x334ccd]){delete _0x3dde79[_0x9fd0('0x18')][_0x334ccd];}_0x4424da[_0x9fd0('0x1c')]();});_0x3dde79[_0x9fd0('0x18')][_0x334ccd]['on'](_0x9fd0('0x1d'),function(){if(_0x3dde79[_0x9fd0('0x18')][_0x334ccd]){delete _0x3dde79[_0x9fd0('0x18')][_0x334ccd];}});_0x2cc48=setTimeout(function(){logger[_0x9fd0('0x1a')]('[%s][AGENT]\x20ROUTING\x20END',_0x334ccd);clearTimeout(_0x2cc48);_0x206753[_0x9fd0('0x1e')]();_0x4424da[_0x9fd0('0x1f')]();},_0x1a79ba);strategy[_0x9fd0('0x20')](_0x206753,_0x438b76,_0x3dde79,_0x43a439);}else{logger[_0x9fd0('0xf')]('[%s][AGENT]\x20agent\x20not\x20found\x20%s',_0x334ccd,_0x5a5b33[_0x9fd0('0xa')]);_0x4424da[_0x9fd0('0x1c')]();}}}catch(_0x2276ec){console[_0x9fd0('0x21')](_0x2276ec);logger[_0x9fd0('0xf')](_0x9fd0('0x22'),_0x334ccd,_0x2276ec[_0x9fd0('0x23')]);_0x4424da[_0x9fd0('0x1c')]();}};}; \ 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 38de7f5..d0dd426 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 _0x6651=['then','info','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','postText','next','amazonlex','providerName','providerResponse','Message','Failed','catch','lodash','aws-sdk','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','interaction','[%s][AMAZONLEX]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','sms','channel','whatsapp','phone','chat','upperFirst','account','InteractionId','isEmpty','body','getMustacheRender','create'];(function(_0x6cf19c,_0x2f3f02){var _0xce14f3=function(_0x474587){while(--_0x474587){_0x6cf19c['push'](_0x6cf19c['shift']());}};_0xce14f3(++_0x2f3f02);}(_0x6651,0x1b1));var _0x1665=function(_0x43ff6d,_0x1e6695){_0x43ff6d=_0x43ff6d-0x0;var _0x7fd481=_0x6651[_0x43ff6d];return _0x7fd481;};'use strict';var _=require(_0x1665('0x0'));var moment=require('moment');var AWS=require(_0x1665('0x1'));var utils=require('./utils');var logger=require(_0x1665('0x2'))(_0x1665('0x3'));var rpc={'chatMessage':require(_0x1665('0x4')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0x1665('0x5')),'faxMessage':require(_0x1665('0x6')),'whatsappMessage':require(_0x1665('0x7'))};exports['consequence']=function(_0x584401,_0x4bf6cd){return function(_0x1c0329){try{if(!_['isNil'](this[_0x1665('0x8')]['UserId'])){logger['info'](_0x1665('0x9'),_0x584401,_0x1665('0xa'));return _0x1c0329['next']();}var _0x1fc83d={'ContactId':this[_0x1665('0xb')]['id'],'sentAt':moment()[_0x1665('0xc')](_0x1665('0xd')),'direction':_0x1665('0xe')};if(this['channel']===_0x1665('0xf')||this[_0x1665('0x10')]===_0x1665('0x11')){_0x1fc83d['phone']=this['interaction'][_0x1665('0x12')];}var _0x267e59=this[_0x1665('0x10')];if(_0x267e59===_0x1665('0x13')){_0x1fc83d['ChatWebsiteId']=this['account']['id'];}else{_0x1fc83d[_[_0x1665('0x14')](_0x267e59)+'AccountId']=this[_0x1665('0x15')]['id'];}_0x1fc83d[_[_0x1665('0x14')](_0x267e59)+_0x1665('0x16')]=this['interaction']['id'];if(this[_0x1665('0x8')]['created']){var _0x2ba40e=_0x4bf6cd[0x4];if(!_[_0x1665('0x17')](_0x2ba40e)){_0x1fc83d[_0x1665('0x18')]=utils[_0x1665('0x19')](_0x2ba40e,this);return rpc[_0x267e59+'Message'][_0x1665('0x1a')](_0x1fc83d)[_0x1665('0x1b')](function(_0x44af44){logger[_0x1665('0x1c')](_0x1665('0x9'),_0x584401,_0x1fc83d[_0x1665('0x18')]);})['catch'](function(_0x59ab66){logger[_0x1665('0x1d')](_0x1665('0x9'),_0x584401,JSON[_0x1665('0x1e')](_0x59ab66));})[_0x1665('0x1f')](function(){logger[_0x1665('0x1c')](_0x1665('0x20'),_0x584401);_0x1c0329[_0x1665('0x21')]();});}else{logger[_0x1665('0x1c')](_0x1665('0x22'),_0x584401);_0x1c0329[_0x1665('0x21')]();}}else{var _0x483cd8=this;var _0x19ee29=new AWS[(_0x1665('0x23'))]({'accessKeyId':_0x4bf6cd[0x0],'secretAccessKey':_0x4bf6cd[0x1],'region':_0x4bf6cd[0x2]});var _0x52f0d0={'botAlias':_0x1665('0x24'),'botName':_0x4bf6cd[0x3],'inputText':this[_0x1665('0x25')]['body'],'userId':this['channel']+':'+this[_0x1665('0x8')]['id']['toString']()};_0x19ee29[_0x1665('0x26')](_0x52f0d0,function(_0x34c33b,_0x5bdf3b){if(_0x34c33b){logger[_0x1665('0x1d')](_0x1665('0x9'),_0x584401,_0x34c33b['message']);_0x1c0329[_0x1665('0x27')]();}else if(_0x5bdf3b&&_0x5bdf3b[_0x1665('0x25')]){_0x483cd8[_0x1665('0x18')][_0x1665('0x28')]=_0x5bdf3b;_0x1fc83d[_0x1665('0x18')]=_0x5bdf3b[_0x1665('0x25')];_0x1fc83d[_0x1665('0x29')]=_0x1665('0x28');_0x1fc83d[_0x1665('0x2a')]=JSON[_0x1665('0x1e')](_0x5bdf3b);return rpc[_0x267e59+_0x1665('0x2b')][_0x1665('0x1a')](_0x1fc83d)[_0x1665('0x1b')](function(_0x2e8cc9){logger[_0x1665('0x1c')]('[%s][AMAZONLEX]\x20%s',_0x584401,_0x1fc83d[_0x1665('0x18')]);if(_0x5bdf3b['dialogState']==_0x1665('0x2c')){_0x1c0329[_0x1665('0x27')]();}else{_0x1c0329[_0x1665('0x21')]();}})[_0x1665('0x2d')](function(_0x271fdb){logger[_0x1665('0x1d')](_0x1665('0x9'),_0x584401,JSON['stringify'](_0x271fdb));_0x1c0329[_0x1665('0x27')]();});}else{_0x1c0329['next']();}});}}catch(_0x3c2c83){logger[_0x1665('0x1d')](_0x1665('0x9'),_0x584401,JSON[_0x1665('0x1e')](_0x3c2c83));_0x1c0329[_0x1665('0x21')]();}};}; \ No newline at end of file +var _0xeca0=['moment','aws-sdk','./utils','../../../../config/logger','../../rpc/smsMessage','../../rpc/whatsappMessage','consequence','isNil','[%s][AMAZONLEX]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','YYYY-MM-DD\x20HH:mm:ss','channel','sms','whatsapp','phone','interaction','chat','upperFirst','account','InteractionId','created','isEmpty','getMustacheRender','Message','create','then','info','body','catch','error','stringify','finally','stop','[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','LexRuntime','message','toString','postText','amazonlex','providerName','providerResponse','dialogState','Failed','lodash'];(function(_0x3740fe,_0x6c543c){var _0x55492b=function(_0x1f851f){while(--_0x1f851f){_0x3740fe['push'](_0x3740fe['shift']());}};_0x55492b(++_0x6c543c);}(_0xeca0,0xb7));var _0x0eca=function(_0x2160a9,_0x3cbd9e){_0x2160a9=_0x2160a9-0x0;var _0xa88cf7=_0xeca0[_0x2160a9];return _0xa88cf7;};'use strict';var _=require(_0x0eca('0x0'));var moment=require(_0x0eca('0x1'));var AWS=require(_0x0eca('0x2'));var utils=require(_0x0eca('0x3'));var logger=require(_0x0eca('0x4'))('routing');var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0x0eca('0x5')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0x0eca('0x6'))};exports[_0x0eca('0x7')]=function(_0x41c806,_0x1c22d6){return function(_0x5ab227){try{if(!_[_0x0eca('0x8')](this['interaction']['UserId'])){logger['info'](_0x0eca('0x9'),_0x41c806,_0x0eca('0xa'));return _0x5ab227[_0x0eca('0xb')]();}var _0x1dd235={'ContactId':this[_0x0eca('0xc')]['id'],'sentAt':moment()['format'](_0x0eca('0xd')),'direction':'out'};if(this[_0x0eca('0xe')]===_0x0eca('0xf')||this['channel']===_0x0eca('0x10')){_0x1dd235[_0x0eca('0x11')]=this[_0x0eca('0x12')][_0x0eca('0x11')];}var _0x66bcb4=this[_0x0eca('0xe')];if(_0x66bcb4===_0x0eca('0x13')){_0x1dd235['ChatWebsiteId']=this['account']['id'];}else{_0x1dd235[_[_0x0eca('0x14')](_0x66bcb4)+'AccountId']=this[_0x0eca('0x15')]['id'];}_0x1dd235[_[_0x0eca('0x14')](_0x66bcb4)+_0x0eca('0x16')]=this[_0x0eca('0x12')]['id'];if(this[_0x0eca('0x12')][_0x0eca('0x17')]){var _0x308c1e=_0x1c22d6[0x4];if(!_[_0x0eca('0x18')](_0x308c1e)){_0x1dd235['body']=utils[_0x0eca('0x19')](_0x308c1e,this);return rpc[_0x66bcb4+_0x0eca('0x1a')][_0x0eca('0x1b')](_0x1dd235)[_0x0eca('0x1c')](function(_0x5bf633){logger[_0x0eca('0x1d')](_0x0eca('0x9'),_0x41c806,_0x1dd235[_0x0eca('0x1e')]);})[_0x0eca('0x1f')](function(_0xbafde0){logger[_0x0eca('0x20')]('[%s][AMAZONLEX]\x20%s',_0x41c806,JSON[_0x0eca('0x21')](_0xbafde0));})[_0x0eca('0x22')](function(){logger[_0x0eca('0x1d')]('[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!',_0x41c806);_0x5ab227[_0x0eca('0x23')]();});}else{logger[_0x0eca('0x1d')](_0x0eca('0x24'),_0x41c806);_0x5ab227[_0x0eca('0x23')]();}}else{var _0x3c518d=this;var _0x717ba9=new AWS[(_0x0eca('0x25'))]({'accessKeyId':_0x1c22d6[0x0],'secretAccessKey':_0x1c22d6[0x1],'region':_0x1c22d6[0x2]});var _0x8b7421={'botAlias':'$LATEST','botName':_0x1c22d6[0x3],'inputText':this[_0x0eca('0x26')]['body'],'userId':this[_0x0eca('0xe')]+':'+this[_0x0eca('0x12')]['id'][_0x0eca('0x27')]()};_0x717ba9[_0x0eca('0x28')](_0x8b7421,function(_0x34d372,_0x472986){if(_0x34d372){logger[_0x0eca('0x20')](_0x0eca('0x9'),_0x41c806,_0x34d372['message']);_0x5ab227[_0x0eca('0xb')]();}else if(_0x472986&&_0x472986[_0x0eca('0x26')]){_0x3c518d['body'][_0x0eca('0x29')]=_0x472986;_0x1dd235[_0x0eca('0x1e')]=_0x472986['message'];_0x1dd235[_0x0eca('0x2a')]=_0x0eca('0x29');_0x1dd235[_0x0eca('0x2b')]=JSON[_0x0eca('0x21')](_0x472986);return rpc[_0x66bcb4+_0x0eca('0x1a')][_0x0eca('0x1b')](_0x1dd235)[_0x0eca('0x1c')](function(_0x1a5d4a){logger[_0x0eca('0x1d')](_0x0eca('0x9'),_0x41c806,_0x1dd235[_0x0eca('0x1e')]);if(_0x472986[_0x0eca('0x2c')]==_0x0eca('0x2d')){_0x5ab227[_0x0eca('0xb')]();}else{_0x5ab227[_0x0eca('0x23')]();}})[_0x0eca('0x1f')](function(_0x2aef37){logger[_0x0eca('0x20')](_0x0eca('0x9'),_0x41c806,JSON[_0x0eca('0x21')](_0x2aef37));_0x5ab227['next']();});}else{_0x5ab227[_0x0eca('0xb')]();}});}}catch(_0xc251ef){logger[_0x0eca('0x20')](_0x0eca('0x9'),_0x41c806,JSON[_0x0eca('0x21')](_0xc251ef));_0x5ab227['stop']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/autoreply.js b/server/services/routing/server/applications/autoreply.js index 98fc3a0..61e2c29 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 _0x2b6b=['then','[%s][AUTOREPLY]\x20SMTP\x20SENT','Message','create','stringify','catch','[RPC][%s][AUTOREPLY]\x20%s','finally','resolve','Interaction','[%s][AUTOREPLY][autoreplyExecuted]\x20%s','error','[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s','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','../../mailRpc','consequence','channel','mail','body','isAutoreply','info','next','isNil','interaction','created','[%s][AUTOREPLY]\x20%s','Autoreply\x20already\x20sent','autoreplyExecuted','One\x20Time\x20already\x20sent','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','getMustacheRender','message','from','phone','subject','startsWith','Re:','Re:\x20','chat','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','Smtp','service','host','port','secure','auth','user','pass','messageId','html','','replace','';_0x3c043b[_0xb2b6('0x3f')]={'Auto-Submitted':'auto-replied','X-Auto-Response-Suppress':_0xb2b6('0x40'),'Precedence':_0xb2b6('0x41')};return mailRpc[_0xb2b6('0x42')](_0x253ba8,_0x3c043b)[_0xb2b6('0x43')](function(_0x5219f4){logger[_0xb2b6('0x17')](_0xb2b6('0x44'),_0x488393);_0x3c043b[_0xb2b6('0x3a')]=_0x5219f4[_0xb2b6('0x25')][_0xb2b6('0x3a')];return rpc[_0x427bb2+_0xb2b6('0x45')][_0xb2b6('0x46')](_0x3c043b);})[_0xb2b6('0x43')](function(_0x15e10a){logger[_0xb2b6('0x17')](_0xb2b6('0x1c'),_0x488393,JSON[_0xb2b6('0x47')](_0x15e10a));})[_0xb2b6('0x48')](function(_0x35669d){logger['error'](_0xb2b6('0x49'),_0x488393,JSON['stringify'](_0x35669d));})[_0xb2b6('0x4a')](function(){Promise[_0xb2b6('0x4b')]()[_0xb2b6('0x43')](function(){if(_0x254a07[0x0]!=='2'||_0x34748f['autoreplyExecuted'])return;return rpc[_0x427bb2+_0xb2b6('0x4c')]['update'](_0x34748f['id'],{'autoreplyExecuted':!![]})[_0xb2b6('0x43')](function(_0x211bb0){logger['info'](_0xb2b6('0x4d'),_0x488393,JSON[_0xb2b6('0x47')](_0x211bb0));})['catch'](function(_0x5a746a){logger[_0xb2b6('0x4e')](_0xb2b6('0x4f'),_0x488393,JSON[_0xb2b6('0x47')](_0x5a746a));});})['then'](function(){_0xc7d50[_0xb2b6('0x18')]();});});}else{return rpc[this[_0xb2b6('0x13')]+_0xb2b6('0x45')][_0xb2b6('0x46')](_0x3c043b)[_0xb2b6('0x43')](function(_0x10c75e){logger['info'](_0xb2b6('0x1c'),_0x488393,_0x3c043b['body']);})[_0xb2b6('0x48')](function(_0x13211e){logger[_0xb2b6('0x4e')](_0xb2b6('0x1c'),_0x488393,JSON[_0xb2b6('0x47')](_0x13211e));})[_0xb2b6('0x4a')](function(){Promise[_0xb2b6('0x4b')]()['then'](function(){if(_0x254a07[0x0]!=='2'||_0x34748f[_0xb2b6('0x1e')])return;return rpc[_0x427bb2+_0xb2b6('0x4c')]['update'](_0x34748f['id'],{'autoreplyExecuted':!![]})[_0xb2b6('0x43')](function(_0xc87d1){logger[_0xb2b6('0x17')](_0xb2b6('0x4d'),_0x488393,JSON['stringify'](_0xc87d1));})[_0xb2b6('0x48')](function(_0x4b153c){logger[_0xb2b6('0x4e')](_0xb2b6('0x4f'),_0x488393,JSON[_0xb2b6('0x47')](_0x4b153c));});})['then'](function(){_0xc7d50[_0xb2b6('0x18')]();});});}}}catch(_0x2f0314){logger[_0xb2b6('0x4e')]('[%s][AUTOREPLY]\x20%s',_0x488393,JSON[_0xb2b6('0x47')](_0x2f0314));_0xc7d50[_0xb2b6('0x50')]();}};}; \ No newline at end of file +var _0xf75c=['then','[%s][AUTOREPLY]\x20SMTP\x20SENT','[%s][AUTOREPLY]\x20%s','stringify','catch','error','[RPC][%s][AUTOREPLY]\x20%s','resolve','update','finally','Interaction','[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s','moment','./utils','../../../../config/logger','routing','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/whatsappMessage','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/mailInteraction','../../rpc/smsInteraction','../../rpc/faxInteraction','../../mailRpc','consequence','channel','mail','info','Autoreply\x20not\x20executed\x20(message\x20is\x20autoreply)','next','isNil','created','interaction','Autoreply\x20already\x20sent','autoreplyExecuted','[%s][AUTOREPLY][autoreplyExecuted]\x20%s','format','out','body','getMustacheRender','message','from','phone','subject','startsWith','Re:','Re:\x20','ChatWebsiteId','account','upperFirst','AccountId','Message','Smtp','service','host','port','secure','auth','user','pass','messageId','html','','replace','','headers','All','auto_reply','sendMailMessage'];(function(_0x24392f,_0x15a3e5){var _0x591e33=function(_0xe0ccea){while(--_0xe0ccea){_0x24392f['push'](_0x24392f['shift']());}};_0x591e33(++_0x15a3e5);}(_0xf75c,0x16f));var _0xcf75=function(_0x251120,_0x553a5d){_0x251120=_0x251120-0x0;var _0x5d9b42=_0xf75c[_0x251120];return _0x5d9b42;};'use strict';var _=require('lodash');var moment=require(_0xcf75('0x0'));var utils=require(_0xcf75('0x1'));var logger=require(_0xcf75('0x2'))(_0xcf75('0x3'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0xcf75('0x4')),'mailMessage':require(_0xcf75('0x5')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0xcf75('0x6')),'chatInteraction':require(_0xcf75('0x7')),'openchannelInteraction':require(_0xcf75('0x8')),'mailInteraction':require(_0xcf75('0x9')),'smsInteraction':require(_0xcf75('0xa')),'faxInteraction':require(_0xcf75('0xb')),'whatsappInteraction':require('../../rpc/whatsappInteraction')};var mailRpc=require(_0xcf75('0xc'));exports[_0xcf75('0xd')]=function(_0x59cc5d,_0x1c8dc7,_0x544bca,_0x2ec9b3){return function(_0x5666b8){try{var _0x508223=this[_0xcf75('0xe')];if(_0x508223===_0xcf75('0xf')&&_0x2ec9b3['body']['isAutoreply']){logger[_0xcf75('0x10')]('[%s][AUTOREPLY]\x20%s',_0x59cc5d,_0xcf75('0x11'));return _0x5666b8[_0xcf75('0x12')]();}if(_0x1c8dc7[0x0]==='1'&&(_[_0xcf75('0x13')](this['interaction'][_0xcf75('0x14')])||!this[_0xcf75('0x15')][_0xcf75('0x14')])){logger[_0xcf75('0x10')]('[%s][AUTOREPLY]\x20%s',_0x59cc5d,_0xcf75('0x16'));return _0x5666b8[_0xcf75('0x12')]();}if(_0x1c8dc7[0x0]==='2'&&this['interaction'][_0xcf75('0x17')]){logger['info'](_0xcf75('0x18'),_0x59cc5d,'One\x20Time\x20already\x20sent');return _0x5666b8[_0xcf75('0x12')]();}var _0xbb47d6={'ContactId':this['contact']['id'],'sentAt':moment()[_0xcf75('0x19')]('YYYY-MM-DD\x20HH:mm:ss'),'direction':_0xcf75('0x1a')};if(this['channel']===_0xcf75('0xf')){_0xbb47d6[_0xcf75('0x1b')]=utils[_0xcf75('0x1c')](_0x1c8dc7[0x2],this);}else{_0xbb47d6['body']=utils[_0xcf75('0x1c')](_0x1c8dc7[0x1],this);}if(this[_0xcf75('0x1d')]){_0xbb47d6['to']=this[_0xcf75('0x1d')]['from']||'';if(this[_0xcf75('0xe')]==='mail'&&_0x1c8dc7[0x1]==='1'){_0xbb47d6['cc']=this[_0xcf75('0x1d')]['cc']||'';}_0xbb47d6[_0xcf75('0x1e')]=this['message']['to']||'';_0xbb47d6[_0xcf75('0x1f')]=this[_0xcf75('0x1d')][_0xcf75('0x1f')]||'';_0xbb47d6['read']=!![];if(this[_0xcf75('0x1d')][_0xcf75('0x20')]){_0xbb47d6[_0xcf75('0x20')]='';_0xbb47d6[_0xcf75('0x20')]+=_[_0xcf75('0x21')](this[_0xcf75('0x1d')][_0xcf75('0x20')],_0xcf75('0x22'))?'':_0xcf75('0x23');_0xbb47d6[_0xcf75('0x20')]+=this[_0xcf75('0x1d')][_0xcf75('0x20')];}}if(this[_0xcf75('0xe')]==='chat'){_0xbb47d6[_0xcf75('0x24')]=this[_0xcf75('0x25')]['id'];}else{_0xbb47d6[_[_0xcf75('0x26')](this['channel'])+_0xcf75('0x27')]=this[_0xcf75('0x25')]['id'];}_0xbb47d6[_[_0xcf75('0x26')](this[_0xcf75('0xe')])+'InteractionId']=this[_0xcf75('0x15')]['id'];var _0x2f8431=this[_0xcf75('0x15')];if(rpc[this[_0xcf75('0xe')]+_0xcf75('0x28')]){if(this[_0xcf75('0xe')]===_0xcf75('0xf')){var _0x296e78={'tls':{'rejectUnauthorized':![]}};if(this[_0xcf75('0x25')][_0xcf75('0x29')][_0xcf75('0x2a')]){_0x296e78[_0xcf75('0x2a')]=this[_0xcf75('0x25')][_0xcf75('0x29')]['service'];}else{_0x296e78[_0xcf75('0x2b')]=this[_0xcf75('0x25')][_0xcf75('0x29')][_0xcf75('0x2b')];_0x296e78[_0xcf75('0x2c')]=this['account'][_0xcf75('0x29')][_0xcf75('0x2c')];_0x296e78[_0xcf75('0x2d')]=this['account'][_0xcf75('0x29')][_0xcf75('0x2d')];}if(this[_0xcf75('0x25')][_0xcf75('0x29')]['authentication']){_0x296e78[_0xcf75('0x2e')]={'user':this['account']['Smtp'][_0xcf75('0x2f')],'pass':this[_0xcf75('0x25')][_0xcf75('0x29')][_0xcf75('0x30')]};}_0xbb47d6['inReplyTo']=this[_0xcf75('0x1d')][_0xcf75('0x31')];_0xbb47d6[_0xcf75('0x32')]=_0xcf75('0x33')+_[_0xcf75('0x34')](_0xbb47d6['body'],_0xcf75('0x35'),']+(>|$)/g,''),'priorityTrue':_0x240af0[0x1],'priorityFalse':_0x240af0[0x2]};var _0x3acbec=gotoif[_0x45b9('0x0')](_0x51492d,{'typecast':!![]});if(_0x3acbec[_0x45b9('0xc')]){logger[_0x45b9('0xd')]('[%s][GOTOIF]\x20%s',_0x4c50cb,_['map'](_0x3acbec,_0x45b9('0xe'))[_0x45b9('0xf')](',\x20'));_0x27d823[_0x45b9('0x10')]();}else{try{var _0x53e201=eval('('+_0x51492d[_0x45b9('0x11')]+')');var _0x4b8d0b=_0x53e201?_0x51492d[_0x45b9('0x12')]:_0x51492d[_0x45b9('0x13')];logger[_0x45b9('0x14')](_0x45b9('0x15'),_0x4c50cb,_0x51492d[_0x45b9('0x11')],_0x53e201,_0x4b8d0b||_0x45b9('0x16'));if(_0x4b8d0b){var _0x561488=_['findIndex'](_0x27d823[_0x45b9('0x17')](),{'p':_0x4b8d0b});if(_0x561488>=0x0){logger[_0x45b9('0x14')](_0x45b9('0x18'),_0x4c50cb,_0x4b8d0b||_0x45b9('0x16'),_0x561488);_0x27d823[_0x45b9('0x16')](_0x561488);}else{logger['info'](_0x45b9('0x19'),_0x4c50cb,_0x4b8d0b||_0x45b9('0x16'));_0x27d823[_0x45b9('0x10')]();}}else{_0x27d823[_0x45b9('0x16')]();}}catch(_0x5cde45){logger['error'](_0x45b9('0x1a'),_0x4c50cb,_0x5cde45[_0x45b9('0xe')]);_0x27d823[_0x45b9('0x10')]();}}}catch(_0x1e6bec){logger[_0x45b9('0xd')](_0x45b9('0x1b'),_0x4c50cb,JSON['stringify'](_0x1e6bec));_0x27d823[_0x45b9('0x10')]();}};}; \ No newline at end of file +var _0xb9cd=['info','condition','next','rules','[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','[%s][GOTOIF]\x20priority\x20%s\x20not\x20found','[%s][GOTOIF]\x20eval\x20error:\x20%s','stringify','validate','lodash','html-to-text','./utils','../../../../config/logger','routing','string','condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','priority\x20true\x20is\x20a\x20number','priority\x20false\x20is\x20a\x20number','getMustacheRender','replace','length','error','[%s][GOTOIF]\x20%s','message','stop','priorityTrue','priorityFalse'];(function(_0x47c69c,_0x2e2aae){var _0x5ecbec=function(_0x187776){while(--_0x187776){_0x47c69c['push'](_0x47c69c['shift']());}};_0x5ecbec(++_0x2e2aae);}(_0xb9cd,0x78));var _0xdb9c=function(_0x1fa841,_0x37a70c){_0x1fa841=_0x1fa841-0x0;var _0x384b67=_0xb9cd[_0x1fa841];return _0x384b67;};'use strict';var schema=require(_0xdb9c('0x0'));var _=require(_0xdb9c('0x1'));var htmlToText=require(_0xdb9c('0x2'));var utils=require(_0xdb9c('0x3'));var logger=require(_0xdb9c('0x4'))(_0xdb9c('0x5'));var gotoif=schema({'condition':{'type':_0xdb9c('0x6'),'required':!![],'message':_0xdb9c('0x7')},'priorityTrue':{'type':_0xdb9c('0x8'),'message':_0xdb9c('0x9')},'priorityFalse':{'type':'number','message':_0xdb9c('0xa')}});exports['consequence']=function(_0x426852,_0xbcb542){return function(_0x3cf7a3){try{var _0x2eb027={'condition':htmlToText['fromString'](utils[_0xdb9c('0xb')](_0xbcb542[0x0],this),{'wordwrap':![]})[_0xdb9c('0xc')](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0xbcb542[0x1],'priorityFalse':_0xbcb542[0x2]};var _0x11d261=gotoif[_0xdb9c('0x0')](_0x2eb027,{'typecast':!![]});if(_0x11d261[_0xdb9c('0xd')]){logger[_0xdb9c('0xe')](_0xdb9c('0xf'),_0x426852,_['map'](_0x11d261,_0xdb9c('0x10'))['join'](',\x20'));_0x3cf7a3[_0xdb9c('0x11')]();}else{try{var _0x48670f=eval('('+_0x2eb027['condition']+')');var _0x23b36f=_0x48670f?_0x2eb027[_0xdb9c('0x12')]:_0x2eb027[_0xdb9c('0x13')];logger[_0xdb9c('0x14')]('[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s',_0x426852,_0x2eb027[_0xdb9c('0x15')],_0x48670f,_0x23b36f||_0xdb9c('0x16'));if(_0x23b36f){var _0x5c325b=_['findIndex'](_0x3cf7a3[_0xdb9c('0x17')](),{'p':_0x23b36f});if(_0x5c325b>=0x0){logger[_0xdb9c('0x14')](_0xdb9c('0x18'),_0x426852,_0x23b36f||_0xdb9c('0x16'),_0x5c325b);_0x3cf7a3[_0xdb9c('0x16')](_0x5c325b);}else{logger[_0xdb9c('0x14')](_0xdb9c('0x19'),_0x426852,_0x23b36f||_0xdb9c('0x16'));_0x3cf7a3[_0xdb9c('0x11')]();}}else{_0x3cf7a3['next']();}}catch(_0x172a61){logger['error'](_0xdb9c('0x1a'),_0x426852,_0x172a61[_0xdb9c('0x10')]);_0x3cf7a3['stop']();}}}catch(_0x47af0c){logger[_0xdb9c('0xe')](_0xdb9c('0xf'),_0x426852,JSON[_0xdb9c('0x1b')](_0x47af0c));_0x3cf7a3['stop']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/gotop.js b/server/services/routing/server/applications/gotop.js index abdae5d..606dd3f 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 _0x8a23=['lodash','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','consequence','error','[%s][GOTOP]\x20%s','map','message','join','stop','[%s][GOTOP]\x20priority\x20%s','priority','findIndex','rules','info','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','validate'];(function(_0x68f4a6,_0x164b76){var _0x4e4c74=function(_0xf3fe90){while(--_0xf3fe90){_0x68f4a6['push'](_0x68f4a6['shift']());}};_0x4e4c74(++_0x164b76);}(_0x8a23,0xe9));var _0x38a2=function(_0x122096,_0x60c295){_0x122096=_0x122096-0x0;var _0x3d1966=_0x8a23[_0x122096];return _0x3d1966;};'use strict';var schema=require(_0x38a2('0x0'));var _=require(_0x38a2('0x1'));var logger=require('../../../../config/logger')('routing');var gotop=schema({'priority':{'type':'number','required':!![],'message':_0x38a2('0x2')}});exports[_0x38a2('0x3')]=function(_0x314aca,_0xc2065b){return function(_0x210e85){try{var _0x5c905e={'priority':_0xc2065b[0x0]};var _0x3b7a73=gotop[_0x38a2('0x0')](_0x5c905e,{'typecast':!![]});if(_0x3b7a73['length']){logger[_0x38a2('0x4')](_0x38a2('0x5'),_0x314aca,_[_0x38a2('0x6')](_0x3b7a73,_0x38a2('0x7'))[_0x38a2('0x8')](',\x20'));_0x210e85[_0x38a2('0x9')]();}else{logger['info'](_0x38a2('0xa'),_0x314aca,_0x5c905e[_0x38a2('0xb')]);if(_0x5c905e[_0x38a2('0xb')]){var _0xf3a36a=_[_0x38a2('0xc')](_0x210e85[_0x38a2('0xd')](),{'p':_0x5c905e[_0x38a2('0xb')]});if(_0xf3a36a>=0x0){logger[_0x38a2('0xe')](_0x38a2('0xf'),_0x314aca,_0x5c905e['priority']||_0x38a2('0x10'),_0xf3a36a);_0x210e85['next'](_0xf3a36a);}else{logger[_0x38a2('0xe')](_0x38a2('0x11'),_0x314aca,_0x5c905e[_0x38a2('0xb')]||'next');_0x210e85[_0x38a2('0x9')]();}}else{_0x210e85[_0x38a2('0x10')]();}}}catch(_0x2467ec){logger[_0x38a2('0x4')](_0x38a2('0x5'),_0x314aca,JSON['stringify'](_0x2467ec));_0x210e85[_0x38a2('0x9')]();}};}; \ No newline at end of file +var _0x1e23=['[%s][GOTOP]\x20priority\x20%s\x20not\x20found','stringify','validate','lodash','../../../../config/logger','number','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','consequence','length','error','[%s][GOTOP]\x20%s','map','message','join','stop','info','[%s][GOTOP]\x20priority\x20%s','priority','findIndex','rules','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next'];(function(_0x199e9d,_0x1a119c){var _0x594ef1=function(_0x572fd0){while(--_0x572fd0){_0x199e9d['push'](_0x199e9d['shift']());}};_0x594ef1(++_0x1a119c);}(_0x1e23,0x178));var _0x31e2=function(_0x38b607,_0x20b1ad){_0x38b607=_0x38b607-0x0;var _0x4c6de7=_0x1e23[_0x38b607];return _0x4c6de7;};'use strict';var schema=require(_0x31e2('0x0'));var _=require(_0x31e2('0x1'));var logger=require(_0x31e2('0x2'))('routing');var gotop=schema({'priority':{'type':_0x31e2('0x3'),'required':!![],'message':_0x31e2('0x4')}});exports[_0x31e2('0x5')]=function(_0x3311b3,_0x45e9b8){return function(_0x501170){try{var _0x221a55={'priority':_0x45e9b8[0x0]};var _0x23e8af=gotop['validate'](_0x221a55,{'typecast':!![]});if(_0x23e8af[_0x31e2('0x6')]){logger[_0x31e2('0x7')](_0x31e2('0x8'),_0x3311b3,_[_0x31e2('0x9')](_0x23e8af,_0x31e2('0xa'))[_0x31e2('0xb')](',\x20'));_0x501170[_0x31e2('0xc')]();}else{logger[_0x31e2('0xd')](_0x31e2('0xe'),_0x3311b3,_0x221a55[_0x31e2('0xf')]);if(_0x221a55[_0x31e2('0xf')]){var _0xe9ba7d=_[_0x31e2('0x10')](_0x501170[_0x31e2('0x11')](),{'p':_0x221a55[_0x31e2('0xf')]});if(_0xe9ba7d>=0x0){logger['info'](_0x31e2('0x12'),_0x3311b3,_0x221a55[_0x31e2('0xf')]||_0x31e2('0x13'),_0xe9ba7d);_0x501170[_0x31e2('0x13')](_0xe9ba7d);}else{logger[_0x31e2('0xd')](_0x31e2('0x14'),_0x3311b3,_0x221a55[_0x31e2('0xf')]||_0x31e2('0x13'));_0x501170[_0x31e2('0xc')]();}}else{_0x501170[_0x31e2('0x13')]();}}}catch(_0x53d27b){logger[_0x31e2('0x7')](_0x31e2('0x8'),_0x3311b3,JSON[_0x31e2('0x15')](_0x53d27b));_0x501170[_0x31e2('0xc')]();}};}; \ 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 ea12fd6..169b3b8 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 _0xda54=['create','then','info','[%s][MESSAGE]\x20%s','next','catch','error','stringify','stop','lodash','./utils','../../../../config/logger','routing','../../rpc/mailMessage','../../rpc/faxMessage','getMustacheRender','channel','chat','ChatWebsiteId','AccountId','InteractionId','Message'];(function(_0x1e8cba,_0x29a703){var _0x214cfb=function(_0x1fcf30){while(--_0x1fcf30){_0x1e8cba['push'](_0x1e8cba['shift']());}};_0x214cfb(++_0x29a703);}(_0xda54,0xa3));var _0x4da5=function(_0x46ae5a,_0x2a38d0){_0x46ae5a=_0x46ae5a-0x0;var _0x434986=_0xda54[_0x46ae5a];return _0x434986;};'use strict';var _=require(_0x4da5('0x0'));var utils=require(_0x4da5('0x1'));var logger=require(_0x4da5('0x2'))(_0x4da5('0x3'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0x4da5('0x4')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0x4da5('0x5')),'whatsappMessage':require('../../rpc/whatsappMessage')};exports['consequence']=function(_0x4e7506,_0x419789){return function(_0x5bbbcb){try{var _0x411ab8={'body':utils[_0x4da5('0x6')](_0x419789[0x0],this),'ContactId':this['contact']['id']};if(this[_0x4da5('0x7')]===_0x4da5('0x8')){_0x411ab8[_0x4da5('0x9')]=this['account']['id'];}else{_0x411ab8[_['upperFirst'](this[_0x4da5('0x7')])+_0x4da5('0xa')]=this['account']['id'];}_0x411ab8[_['upperFirst'](this[_0x4da5('0x7')])+_0x4da5('0xb')]=this['interaction']['id'];if(rpc[this[_0x4da5('0x7')]+_0x4da5('0xc')]){return rpc[this[_0x4da5('0x7')]+_0x4da5('0xc')][_0x4da5('0xd')](_0x411ab8)[_0x4da5('0xe')](function(_0x23eb0d){logger[_0x4da5('0xf')](_0x4da5('0x10'),_0x4e7506,_0x411ab8['body']);_0x5bbbcb[_0x4da5('0x11')]();})[_0x4da5('0x12')](function(_0x29fd10){logger[_0x4da5('0x13')]('[%s][MESSAGE]\x20%s',_0x4e7506,JSON[_0x4da5('0x14')](_0x29fd10));_0x5bbbcb['stop']();});}}catch(_0xa91b0c){logger[_0x4da5('0x13')](_0x4da5('0x10'),_0x4e7506,JSON[_0x4da5('0x14')](_0xa91b0c));_0x5bbbcb[_0x4da5('0x15')]();}};}; \ No newline at end of file +var _0xf29f=['../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','getMustacheRender','channel','chat','ChatWebsiteId','account','upperFirst','InteractionId','interaction','Message','create','then','info','[%s][MESSAGE]\x20%s','body','next','error','stringify','stop','./utils','../../../../config/logger','routing'];(function(_0x48588f,_0x53557c){var _0x180303=function(_0x4efda0){while(--_0x4efda0){_0x48588f['push'](_0x48588f['shift']());}};_0x180303(++_0x53557c);}(_0xf29f,0x18d));var _0xff29=function(_0x4a016a,_0x255608){_0x4a016a=_0x4a016a-0x0;var _0x1cd33a=_0xf29f[_0x4a016a];return _0x1cd33a;};'use strict';var _=require('lodash');var utils=require(_0xff29('0x0'));var logger=require(_0xff29('0x1'))(_0xff29('0x2'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0xff29('0x3')),'mailMessage':require(_0xff29('0x4')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0xff29('0x5')),'whatsappMessage':require(_0xff29('0x6'))};exports['consequence']=function(_0x3c5aa4,_0xbbe36b){return function(_0x4c814b){try{var _0x566021={'body':utils[_0xff29('0x7')](_0xbbe36b[0x0],this),'ContactId':this['contact']['id']};if(this[_0xff29('0x8')]===_0xff29('0x9')){_0x566021[_0xff29('0xa')]=this[_0xff29('0xb')]['id'];}else{_0x566021[_[_0xff29('0xc')](this[_0xff29('0x8')])+'AccountId']=this['account']['id'];}_0x566021[_[_0xff29('0xc')](this[_0xff29('0x8')])+_0xff29('0xd')]=this[_0xff29('0xe')]['id'];if(rpc[this[_0xff29('0x8')]+_0xff29('0xf')]){return rpc[this[_0xff29('0x8')]+_0xff29('0xf')][_0xff29('0x10')](_0x566021)[_0xff29('0x11')](function(_0xf67040){logger[_0xff29('0x12')](_0xff29('0x13'),_0x3c5aa4,_0x566021[_0xff29('0x14')]);_0x4c814b[_0xff29('0x15')]();})['catch'](function(_0x1ff15e){logger[_0xff29('0x16')]('[%s][MESSAGE]\x20%s',_0x3c5aa4,JSON[_0xff29('0x17')](_0x1ff15e));_0x4c814b[_0xff29('0x18')]();});}}catch(_0x24567d){logger[_0xff29('0x16')](_0xff29('0x13'),_0x3c5aa4,JSON[_0xff29('0x17')](_0x24567d));_0x4c814b[_0xff29('0x18')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/noop.js b/server/services/routing/server/applications/noop.js index 541e1b9..692d814 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 _0xb164=['getMustacheRender','next','error','stringify','stop','routing','consequence','info','[%s][NOOP]\x20%s'];(function(_0x4f4c2a,_0x5f5a28){var _0xd15be6=function(_0x1bc725){while(--_0x1bc725){_0x4f4c2a['push'](_0x4f4c2a['shift']());}};_0xd15be6(++_0x5f5a28);}(_0xb164,0x188));var _0x4b16=function(_0x10a952,_0x35961d){_0x10a952=_0x10a952-0x0;var _0x4d09bb=_0xb164[_0x10a952];return _0x4d09bb;};'use strict';var utils=require('./utils');var logger=require('../../../../config/logger')(_0x4b16('0x0'));exports[_0x4b16('0x1')]=function(_0xcc814a,_0x35b92f){return function(_0x15993e){try{logger[_0x4b16('0x2')](_0x4b16('0x3'),_0xcc814a,utils[_0x4b16('0x4')](_0x35b92f[0x0],this));_0x15993e[_0x4b16('0x5')]();}catch(_0x59dabc){logger[_0x4b16('0x6')](_0x4b16('0x3'),_0xcc814a,JSON[_0x4b16('0x7')](_0x59dabc));_0x15993e[_0x4b16('0x8')]();}};}; \ No newline at end of file +var _0x24d6=['error','[%s][NOOP]\x20%s','stringify','stop','routing','consequence','getMustacheRender','next'];(function(_0x5328dd,_0x15180f){var _0x57b966=function(_0x5f2014){while(--_0x5f2014){_0x5328dd['push'](_0x5328dd['shift']());}};_0x57b966(++_0x15180f);}(_0x24d6,0x19c));var _0x624d=function(_0x516927,_0xb4aad0){_0x516927=_0x516927-0x0;var _0x30749b=_0x24d6[_0x516927];return _0x30749b;};'use strict';var utils=require('./utils');var logger=require('../../../../config/logger')(_0x624d('0x0'));exports[_0x624d('0x1')]=function(_0x3f27db,_0x4a01e2){return function(_0x3d25ff){try{logger['info']('[%s][NOOP]\x20%s',_0x3f27db,utils[_0x624d('0x2')](_0x4a01e2[0x0],this));_0x3d25ff[_0x624d('0x3')]();}catch(_0x463583){logger[_0x624d('0x4')](_0x624d('0x5'),_0x3f27db,JSON[_0x624d('0x6')](_0x463583));_0x3d25ff[_0x624d('0x7')]();}};}; \ 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 eb4a9f9..c3be98f 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 _0x6017=['[%s][END:QUEUE][NAME:%s]','toLowerCase','consequence','join','stop','find','Queues','createQueue','qtimeout','rules','end','[%s][QUEUE]\x20ROUTING\x20STOPPED','complete','[%s][QUEUE]\x20APPLICATION\x20END','close','strategy','beepall','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','[%s][QUEUE]\x20%s','stack','validate','lodash','util','moment','ioredis','../../../../config/logger','./strategy','redis','localhost','socket.io-emitter','queue_id','account','from','joinAt','emit','clone','queue','format','pick','%sQueuesWaitingInteractions','%s:queue:%s','%s_queue_waiting_interaction:%s','save','remove','../../rpc/openchannelQueueReport','../../rpc/mailQueueReport','../../rpc/smsQueueReport','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','waiting','body','YYYY-MM-DD\x20HH:mm:ss','contact','list','upperFirst','channel','QueueId','interaction','MessageId','chat','AccountId','WebsiteId','[%s][START:QUEUE][NAME:%s]','name','message','QueueReport','create','catch','error','create\x20queue\x20report','info','[%s][STOP:QUEUE][NAME:%s]','update','update\x20queue\x20report','timeout'];(function(_0x393d69,_0x3a8c83){var _0x3cee37=function(_0x462682){while(--_0x462682){_0x393d69['push'](_0x393d69['shift']());}};_0x3cee37(++_0x3a8c83);}(_0x6017,0xae));var _0x7601=function(_0x2d1b5e,_0x56f997){_0x2d1b5e=_0x2d1b5e-0x0;var _0x453440=_0x6017[_0x2d1b5e];return _0x453440;};'use strict';var schema=require(_0x7601('0x0'));var _=require(_0x7601('0x1'));var util=require(_0x7601('0x2'));var seqqueue=require('seq-queue');var moment=require(_0x7601('0x3'));var Redis=require(_0x7601('0x4'));var config=require('../../../../config/environment');var logger=require(_0x7601('0x5'))('routing');var strategy=require(_0x7601('0x6'));config['redis']=_['defaults'](config[_0x7601('0x7')],{'host':_0x7601('0x8'),'port':0x18eb});var io=require(_0x7601('0x9'))(new Redis(config[_0x7601('0x7')]));var attributes=['id',_0x7601('0xa'),_0x7601('0xb'),'queue',_0x7601('0xc'),_0x7601('0xd')];function emit(_0xd3a338,_0x4fffbd,_0x13ecd4){io['to'](_0xd3a338)[_0x7601('0xe')](_0x4fffbd,_0x13ecd4);}function emitChannelQueueInteraction(_0x3e5a62,_0x4924e7,_0x169106,_0x127104,_0x26a58d,_0x349618,_0x33658f,_0x35c6dc){var _0x4001af=_[_0x7601('0xf')](_0x169106);_0x4001af[_0x7601('0xa')]=_0x35c6dc;_0x4001af[_0x7601('0x10')]=_0x4924e7;_0x4001af['account']=_0x127104;_0x4001af['id']=_0x26a58d;if(_0x349618){_0x33658f[util[_0x7601('0x11')]('%sQueuesWaitingInteractions',_0x3e5a62)][_0x26a58d]=_[_0x7601('0x12')](_0x4001af,attributes);}else{delete _0x33658f[util[_0x7601('0x11')](_0x7601('0x13'),_0x3e5a62)][_0x26a58d];}emit(util[_0x7601('0x11')](_0x7601('0x14'),_0x3e5a62,_0x4924e7),util[_0x7601('0x11')](_0x7601('0x15'),_0x3e5a62,_0x349618?_0x7601('0x16'):_0x7601('0x17')),_['pick'](_0x4001af,attributes));}var rpc={'openchannelQueueReport':require(_0x7601('0x18')),'mailQueueReport':require(_0x7601('0x19')),'chatQueueReport':require('../../rpc/chatQueueReport'),'smsQueueReport':require(_0x7601('0x1a')),'faxQueueReport':require('../../rpc/faxQueueReport'),'whatsappQueueReport':require('../../rpc/whatsappQueueReport')};var queue=schema({'name':{'type':_0x7601('0x1b'),'required':!![],'message':_0x7601('0x1c')},'timeout':{'type':_0x7601('0x1d'),'message':_0x7601('0x1e')}});function startRouting(_0x26f1b8,_0x3cb152,_0x1e99c5,_0x594b4e){if(_0x26f1b8&&_0x3cb152&&_0x1e99c5){_0x3cb152[_0x7601('0x1f')]+=0x1;var _0x1d58c0={'uniqueid':_0x26f1b8,'from':_0x1e99c5['body']?_0x1e99c5[_0x7601('0x20')][_0x7601('0xc')]:'','joinAt':moment()[_0x7601('0x11')](_0x7601('0x21')),'ContactId':_0x1e99c5[_0x7601('0x22')]?_0x1e99c5[_0x7601('0x22')]['id']:null,'ListId':_0x1e99c5['list']?_0x1e99c5[_0x7601('0x23')]['id']:null};_0x1d58c0[_[_0x7601('0x24')](_0x1e99c5[_0x7601('0x25')])+_0x7601('0x26')]=_0x3cb152['id']||null;_0x1d58c0[_['upperFirst'](_0x1e99c5[_0x7601('0x25')])+'InteractionId']=_0x1e99c5[_0x7601('0x27')]?_0x1e99c5['interaction']['id']:null;_0x1d58c0[_['upperFirst'](_0x1e99c5[_0x7601('0x25')])+_0x7601('0x28')]=_0x1e99c5['message']?_0x1e99c5['message']['id']:null;_0x1d58c0[_[_0x7601('0x24')](_0x1e99c5['channel'])+(_0x1e99c5['channel']!==_0x7601('0x29')?_0x7601('0x2a'):_0x7601('0x2b'))]=_0x1e99c5['account']?_0x1e99c5[_0x7601('0xb')]['id']:null;logger['info'](util[_0x7601('0x11')](_0x7601('0x2c'),_0x26f1b8,_0x3cb152['name']));emitChannelQueueInteraction(_0x1e99c5['channel'],_0x3cb152[_0x7601('0x2d')],_0x1d58c0,_0x1e99c5[_0x7601('0xb')][_0x7601('0x2d')],_0x1e99c5[_0x7601('0x2e')]['id'],!![],_0x594b4e,_0x3cb152['id']);if(rpc[_0x1e99c5[_0x7601('0x25')]+_0x7601('0x2f')]){return rpc[_0x1e99c5['channel']+'QueueReport'][_0x7601('0x30')](_0x1d58c0)[_0x7601('0x31')](function(_0xa483c4){logger[_0x7601('0x32')](_0x7601('0x33'));});}}}function stopRouting(_0x5eead0,_0x5ceb46,_0xfdb5e3,_0x27862b){if(_0x5eead0&&_0x5ceb46){_0x5ceb46[_0x7601('0x1f')]-=0x1;var _0xa551cb={'leaveAt':moment()[_0x7601('0x11')]('YYYY-MM-DD\x20HH:mm:ss'),'acceptAt':moment()[_0x7601('0x11')](_0x7601('0x21')),'reason':'accepted'};logger[_0x7601('0x34')](util[_0x7601('0x11')](_0x7601('0x35'),_0x5eead0,_0x5ceb46[_0x7601('0x2d')]));emitChannelQueueInteraction(_0xfdb5e3[_0x7601('0x25')],_0x5ceb46['name'],_0xfdb5e3[_0x7601('0x20')],_0xfdb5e3[_0x7601('0xb')][_0x7601('0x2d')],_0xfdb5e3[_0x7601('0x2e')]['id'],![],_0x27862b,_0x5ceb46['id']);if(rpc[_0xfdb5e3['channel']+_0x7601('0x2f')]){return rpc[_0xfdb5e3['channel']+'QueueReport'][_0x7601('0x36')](_0x5eead0,_0xa551cb)[_0x7601('0x31')](function(_0x46d013){logger[_0x7601('0x32')](_0x7601('0x37'));});}}}function endRouting(_0xa486a,_0x259fd1,_0x202459,_0x3a596b){if(_0xa486a&&_0x259fd1){_0x259fd1[_0x7601('0x1f')]-=0x1;var _0x190821={'leaveAt':moment()[_0x7601('0x11')](_0x7601('0x21')),'exitAt':moment()[_0x7601('0x11')]('YYYY-MM-DD\x20HH:mm:ss'),'reason':_0x7601('0x38')};logger[_0x7601('0x34')](util[_0x7601('0x11')](_0x7601('0x39'),_0xa486a,_0x259fd1[_0x7601('0x2d')]));emitChannelQueueInteraction(_0x202459[_0x7601('0x25')],_0x259fd1['name'],_0x202459[_0x7601('0x20')],_0x202459[_0x7601('0xb')]['name'],_0x202459[_0x7601('0x2e')]['id'],![],_0x3a596b);if(rpc[_0x202459['channel']+_0x7601('0x2f')]){return rpc[_0x202459['channel']+'QueueReport']['update'](_0xa486a,_0x190821)[_0x7601('0x31')](function(_0x2a5cea){logger[_0x7601('0x32')](_0x7601('0x37'));});}}}function handleFindQueue(_0x537c94){return function(_0x2c46a5){return _0x2c46a5['name'][_0x7601('0x3a')]()===_0x537c94[_0x7601('0x3a')]();};}exports[_0x7601('0x3b')]=function(_0xdf4ed,_0x40f210,_0x25f348,_0x5c2215){return function(_0x472fb8){try{var _0x5c2f8e={'name':_0x40f210[0x0],'timeout':_0x40f210[0x1]};var _0x81b852=queue[_0x7601('0x0')](_0x5c2f8e,{'typecast':!![]});if(_0x81b852['length']){logger['error']('[%s][QUEUE]\x20%s',_0xdf4ed,_['map'](_0x81b852,_0x7601('0x2e'))[_0x7601('0x3c')](',\x20'));_0x472fb8[_0x7601('0x3d')]();}else{var _0x458a4e=_[_0x7601('0x3e')](_0x25f348[_0x5c2215[_0x7601('0x25')]+_0x7601('0x3f')],handleFindQueue(_0x5c2f8e[_0x7601('0x2d')]));if(_0x458a4e){startRouting(_0xdf4ed,_0x458a4e,_0x5c2215,_0x25f348);var _0x3065df=(_0x458a4e[_0x7601('0x38')]||0xa)*0x3e8;var _0x18f7d8=(_0x5c2f8e[_0x7601('0x38')]||0x14)*0x3e8;var _0xdd398b,_0xc9be4;if(_0x3065df>_0x18f7d8){_0x18f7d8=_0x3065df;}var _0x36fa7c=seqqueue[_0x7601('0x40')](_0x3065df);_0x36fa7c['id']=_0xdf4ed;_0x36fa7c['atimeout']=_0x3065df;_0x36fa7c[_0x7601('0x41')]=_0x18f7d8;_0x36fa7c[_0x7601('0x25')]=_0x5c2215[_0x7601('0x25')];_0x25f348[_0x7601('0x42')][_0xdf4ed]['on'](_0x7601('0x43'),function(){logger['info'](_0x7601('0x44'),_0xdf4ed);stopRouting(_0xdf4ed,_0x458a4e,_0x5c2215,_0x25f348);clearTimeout(_0xdd398b);_0xdd398b=undefined;_0x36fa7c['close'](!![]);if(_0x25f348[_0x7601('0x42')][_0xdf4ed]){delete _0x25f348[_0x7601('0x42')][_0xdf4ed];}_0x472fb8['stop']();});_0x25f348['rules'][_0xdf4ed]['on'](_0x7601('0x45'),function(){if(_0x25f348[_0x7601('0x42')][_0xdf4ed]){delete _0x25f348[_0x7601('0x42')][_0xdf4ed];}});_0xdd398b=setTimeout(function(){logger[_0x7601('0x34')](_0x7601('0x46'),_0xdf4ed);endRouting(_0xdf4ed,_0x458a4e,_0x5c2215,_0x25f348);clearTimeout(_0xdd398b);_0x36fa7c[_0x7601('0x47')](!![]);_0x472fb8['next']();},_0x18f7d8);switch(_0x458a4e[_0x7601('0x48')]){case'rrmemory':strategy['rrmemory'](_0x36fa7c,_0x458a4e,_0x25f348,_0x5c2215);break;default:strategy[_0x7601('0x49')](_0x36fa7c,_0x458a4e,_0x25f348,_0x5c2215);}}else{logger[_0x7601('0x32')](_0x7601('0x4a'),_0xdf4ed,_0x5c2f8e['name']);_0x472fb8[_0x7601('0x3d')]();}}}catch(_0x244614){console['log'](_0x244614);logger[_0x7601('0x32')](_0x7601('0x4b'),_0xdf4ed,_0x244614[_0x7601('0x4c')]);_0x472fb8[_0x7601('0x3d')]();}};}; \ No newline at end of file +var _0x691a=['[%s][QUEUE]\x20ROUTING\x20STOPPED','close','rules','stop','[%s][QUEUE]\x20APPLICATION\x20END','next','rrmemory','beepall','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','log','stack','validate','lodash','util','seq-queue','moment','../../../../config/environment','../../../../config/logger','./strategy','defaults','redis','localhost','queue_id','account','queue','from','joinAt','clone','format','%sQueuesWaitingInteractions','pick','%s:queue:%s','%s_queue_waiting_interaction:%s','save','remove','../../rpc/openchannelQueueReport','../../rpc/chatQueueReport','../../rpc/smsQueueReport','../../rpc/whatsappQueueReport','string','number','timeout\x20is\x20a\x20number','waiting','body','YYYY-MM-DD\x20HH:mm:ss','list','upperFirst','channel','QueueId','InteractionId','interaction','MessageId','message','chat','AccountId','WebsiteId','info','[%s][START:QUEUE][NAME:%s]','name','QueueReport','create','catch','error','create\x20queue\x20report','accepted','[%s][STOP:QUEUE][NAME:%s]','update','update\x20queue\x20report','timeout','[%s][END:QUEUE][NAME:%s]','toLowerCase','consequence','[%s][QUEUE]\x20%s','map','join','Queues','createQueue','atimeout','qtimeout','end'];(function(_0x3b7f94,_0x4815db){var _0x5ba12f=function(_0x380d2f){while(--_0x380d2f){_0x3b7f94['push'](_0x3b7f94['shift']());}};_0x5ba12f(++_0x4815db);}(_0x691a,0xfb));var _0xa691=function(_0x3e277e,_0x2ca76c){_0x3e277e=_0x3e277e-0x0;var _0x383619=_0x691a[_0x3e277e];return _0x383619;};'use strict';var schema=require(_0xa691('0x0'));var _=require(_0xa691('0x1'));var util=require(_0xa691('0x2'));var seqqueue=require(_0xa691('0x3'));var moment=require(_0xa691('0x4'));var Redis=require('ioredis');var config=require(_0xa691('0x5'));var logger=require(_0xa691('0x6'))('routing');var strategy=require(_0xa691('0x7'));config['redis']=_[_0xa691('0x8')](config[_0xa691('0x9')],{'host':_0xa691('0xa'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xa691('0x9')]));var attributes=['id',_0xa691('0xb'),_0xa691('0xc'),_0xa691('0xd'),_0xa691('0xe'),_0xa691('0xf')];function emit(_0x41a061,_0xa0d2d7,_0x2bed93){io['to'](_0x41a061)['emit'](_0xa0d2d7,_0x2bed93);}function emitChannelQueueInteraction(_0x5d485d,_0x41a438,_0x378dd2,_0x1ae17f,_0x5c712a,_0x4ae99a,_0x17d983,_0x4273b8){var _0x46e416=_[_0xa691('0x10')](_0x378dd2);_0x46e416[_0xa691('0xb')]=_0x4273b8;_0x46e416[_0xa691('0xd')]=_0x41a438;_0x46e416[_0xa691('0xc')]=_0x1ae17f;_0x46e416['id']=_0x5c712a;if(_0x4ae99a){_0x17d983[util[_0xa691('0x11')](_0xa691('0x12'),_0x5d485d)][_0x5c712a]=_[_0xa691('0x13')](_0x46e416,attributes);}else{delete _0x17d983[util[_0xa691('0x11')](_0xa691('0x12'),_0x5d485d)][_0x5c712a];}emit(util[_0xa691('0x11')](_0xa691('0x14'),_0x5d485d,_0x41a438),util[_0xa691('0x11')](_0xa691('0x15'),_0x5d485d,_0x4ae99a?_0xa691('0x16'):_0xa691('0x17')),_[_0xa691('0x13')](_0x46e416,attributes));}var rpc={'openchannelQueueReport':require(_0xa691('0x18')),'mailQueueReport':require('../../rpc/mailQueueReport'),'chatQueueReport':require(_0xa691('0x19')),'smsQueueReport':require(_0xa691('0x1a')),'faxQueueReport':require('../../rpc/faxQueueReport'),'whatsappQueueReport':require(_0xa691('0x1b'))};var queue=schema({'name':{'type':_0xa691('0x1c'),'required':!![],'message':'name\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'timeout':{'type':_0xa691('0x1d'),'message':_0xa691('0x1e')}});function startRouting(_0x19d173,_0x7d3302,_0x107710,_0x26361a){if(_0x19d173&&_0x7d3302&&_0x107710){_0x7d3302[_0xa691('0x1f')]+=0x1;var _0x263802={'uniqueid':_0x19d173,'from':_0x107710[_0xa691('0x20')]?_0x107710['body'][_0xa691('0xe')]:'','joinAt':moment()[_0xa691('0x11')](_0xa691('0x21')),'ContactId':_0x107710['contact']?_0x107710['contact']['id']:null,'ListId':_0x107710[_0xa691('0x22')]?_0x107710[_0xa691('0x22')]['id']:null};_0x263802[_[_0xa691('0x23')](_0x107710[_0xa691('0x24')])+_0xa691('0x25')]=_0x7d3302['id']||null;_0x263802[_['upperFirst'](_0x107710[_0xa691('0x24')])+_0xa691('0x26')]=_0x107710['interaction']?_0x107710[_0xa691('0x27')]['id']:null;_0x263802[_['upperFirst'](_0x107710[_0xa691('0x24')])+_0xa691('0x28')]=_0x107710['message']?_0x107710[_0xa691('0x29')]['id']:null;_0x263802[_[_0xa691('0x23')](_0x107710[_0xa691('0x24')])+(_0x107710[_0xa691('0x24')]!==_0xa691('0x2a')?_0xa691('0x2b'):_0xa691('0x2c'))]=_0x107710[_0xa691('0xc')]?_0x107710[_0xa691('0xc')]['id']:null;logger[_0xa691('0x2d')](util[_0xa691('0x11')](_0xa691('0x2e'),_0x19d173,_0x7d3302[_0xa691('0x2f')]));emitChannelQueueInteraction(_0x107710[_0xa691('0x24')],_0x7d3302[_0xa691('0x2f')],_0x263802,_0x107710[_0xa691('0xc')][_0xa691('0x2f')],_0x107710[_0xa691('0x29')]['id'],!![],_0x26361a,_0x7d3302['id']);if(rpc[_0x107710['channel']+_0xa691('0x30')]){return rpc[_0x107710['channel']+_0xa691('0x30')][_0xa691('0x31')](_0x263802)[_0xa691('0x32')](function(_0x15f6a7){logger[_0xa691('0x33')](_0xa691('0x34'));});}}}function stopRouting(_0x92ef7d,_0x1e1f15,_0xaa4a07,_0x9aa10b){if(_0x92ef7d&&_0x1e1f15){_0x1e1f15[_0xa691('0x1f')]-=0x1;var _0x576ddf={'leaveAt':moment()['format'](_0xa691('0x21')),'acceptAt':moment()[_0xa691('0x11')]('YYYY-MM-DD\x20HH:mm:ss'),'reason':_0xa691('0x35')};logger['info'](util[_0xa691('0x11')](_0xa691('0x36'),_0x92ef7d,_0x1e1f15[_0xa691('0x2f')]));emitChannelQueueInteraction(_0xaa4a07[_0xa691('0x24')],_0x1e1f15[_0xa691('0x2f')],_0xaa4a07['body'],_0xaa4a07[_0xa691('0xc')][_0xa691('0x2f')],_0xaa4a07[_0xa691('0x29')]['id'],![],_0x9aa10b,_0x1e1f15['id']);if(rpc[_0xaa4a07[_0xa691('0x24')]+_0xa691('0x30')]){return rpc[_0xaa4a07[_0xa691('0x24')]+_0xa691('0x30')][_0xa691('0x37')](_0x92ef7d,_0x576ddf)['catch'](function(_0x39a4d1){logger[_0xa691('0x33')](_0xa691('0x38'));});}}}function endRouting(_0x49f671,_0x5c4028,_0x5086fa,_0x29cfa9){if(_0x49f671&&_0x5c4028){_0x5c4028[_0xa691('0x1f')]-=0x1;var _0x209f7c={'leaveAt':moment()[_0xa691('0x11')](_0xa691('0x21')),'exitAt':moment()[_0xa691('0x11')]('YYYY-MM-DD\x20HH:mm:ss'),'reason':_0xa691('0x39')};logger[_0xa691('0x2d')](util['format'](_0xa691('0x3a'),_0x49f671,_0x5c4028['name']));emitChannelQueueInteraction(_0x5086fa['channel'],_0x5c4028['name'],_0x5086fa['body'],_0x5086fa[_0xa691('0xc')][_0xa691('0x2f')],_0x5086fa[_0xa691('0x29')]['id'],![],_0x29cfa9);if(rpc[_0x5086fa['channel']+_0xa691('0x30')]){return rpc[_0x5086fa[_0xa691('0x24')]+'QueueReport']['update'](_0x49f671,_0x209f7c)['catch'](function(_0xff44dd){logger['error']('update\x20queue\x20report');});}}}function handleFindQueue(_0x513a51){return function(_0x142b24){return _0x142b24[_0xa691('0x2f')][_0xa691('0x3b')]()===_0x513a51[_0xa691('0x3b')]();};}exports[_0xa691('0x3c')]=function(_0x43a017,_0x40d6c8,_0x4f1459,_0x1e200b){return function(_0x27fb2a){try{var _0x17b15f={'name':_0x40d6c8[0x0],'timeout':_0x40d6c8[0x1]};var _0x48bb04=queue[_0xa691('0x0')](_0x17b15f,{'typecast':!![]});if(_0x48bb04['length']){logger['error'](_0xa691('0x3d'),_0x43a017,_[_0xa691('0x3e')](_0x48bb04,_0xa691('0x29'))[_0xa691('0x3f')](',\x20'));_0x27fb2a['stop']();}else{var _0x2d3727=_['find'](_0x4f1459[_0x1e200b['channel']+_0xa691('0x40')],handleFindQueue(_0x17b15f[_0xa691('0x2f')]));if(_0x2d3727){startRouting(_0x43a017,_0x2d3727,_0x1e200b,_0x4f1459);var _0x45542d=(_0x2d3727[_0xa691('0x39')]||0xa)*0x3e8;var _0x4439ef=(_0x17b15f[_0xa691('0x39')]||0x14)*0x3e8;var _0x356a7a,_0x10153b;if(_0x45542d>_0x4439ef){_0x4439ef=_0x45542d;}var _0x153620=seqqueue[_0xa691('0x41')](_0x45542d);_0x153620['id']=_0x43a017;_0x153620[_0xa691('0x42')]=_0x45542d;_0x153620[_0xa691('0x43')]=_0x4439ef;_0x153620[_0xa691('0x24')]=_0x1e200b[_0xa691('0x24')];_0x4f1459['rules'][_0x43a017]['on'](_0xa691('0x44'),function(){logger[_0xa691('0x2d')](_0xa691('0x45'),_0x43a017);stopRouting(_0x43a017,_0x2d3727,_0x1e200b,_0x4f1459);clearTimeout(_0x356a7a);_0x356a7a=undefined;_0x153620[_0xa691('0x46')](!![]);if(_0x4f1459[_0xa691('0x47')][_0x43a017]){delete _0x4f1459[_0xa691('0x47')][_0x43a017];}_0x27fb2a[_0xa691('0x48')]();});_0x4f1459[_0xa691('0x47')][_0x43a017]['on']('complete',function(){if(_0x4f1459['rules'][_0x43a017]){delete _0x4f1459['rules'][_0x43a017];}});_0x356a7a=setTimeout(function(){logger['info'](_0xa691('0x49'),_0x43a017);endRouting(_0x43a017,_0x2d3727,_0x1e200b,_0x4f1459);clearTimeout(_0x356a7a);_0x153620['close'](!![]);_0x27fb2a[_0xa691('0x4a')]();},_0x4439ef);switch(_0x2d3727['strategy']){case _0xa691('0x4b'):strategy[_0xa691('0x4b')](_0x153620,_0x2d3727,_0x4f1459,_0x1e200b);break;default:strategy[_0xa691('0x4c')](_0x153620,_0x2d3727,_0x4f1459,_0x1e200b);}}else{logger['error'](_0xa691('0x4d'),_0x43a017,_0x17b15f[_0xa691('0x2f')]);_0x27fb2a[_0xa691('0x48')]();}}}catch(_0x8392bf){console[_0xa691('0x4e')](_0x8392bf);logger[_0xa691('0x33')](_0xa691('0x3d'),_0x43a017,_0x8392bf[_0xa691('0x4f')]);_0x27fb2a['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 b013f61..c9cffdf 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 _0xe63a=['bind','handleTimeout','timeout','drained','prototype','handleDrained','info','[%s][AGENT]\x20try\x20with\x20%s','agents','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','forcedOwnership','isAgentAvailable','channel','busyQueue','showNotification','notificationId','writeLog','RINGING',':FORCED','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','isNil','hideNotification','busy','STOP','TIMEOUT','lodash','uuid','../../../../../config/logger','routing','squeue','agent','realtime','push','handleRun'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xe63a,0x18f));var _0xae63=function(_0x3c239f,_0x397fc8){_0x3c239f=_0x3c239f-0x0;var _0x180d60=_0xe63a[_0x3c239f];return _0x180d60;};'use strict';var _=require(_0xae63('0x0'));var uuid=require(_0xae63('0x1'));var util=require('./util');var logger=require(_0xae63('0x2'))(_0xae63('0x3'));var Agent=function(_0x191ab6,_0xe6cb1f,_0x10e330,_0x3821d7){this['notificationId']=uuid['v4']();this[_0xae63('0x4')]=_0x191ab6;this[_0xae63('0x5')]=_0xe6cb1f;this[_0xae63('0x6')]=_0x10e330;this[_0xae63('0x3')]=_0x3821d7;this[_0xae63('0x4')][_0xae63('0x7')](this[_0xae63('0x8')][_0xae63('0x9')](this),this[_0xae63('0xa')][_0xae63('0x9')](this));this[_0xae63('0x4')]['on'](_0xae63('0xb'),this[_0xae63('0xa')][_0xae63('0x9')](this));this[_0xae63('0x4')]['on'](_0xae63('0xc'),this['handleDrained'][_0xae63('0x9')](this));};Agent[_0xae63('0xd')][_0xae63('0x7')]=function(){this[_0xae63('0x4')][_0xae63('0x7')](this[_0xae63('0x8')]['bind'](this),this['handleTimeout'][_0xae63('0x9')](this));};Agent['prototype'][_0xae63('0xe')]=function(){this['handleTimeout'](!![]);};Agent['prototype'][_0xae63('0x8')]=function(_0xb9d306){logger[_0xae63('0xf')](_0xae63('0x10'),this['squeue']['id'],this[_0xae63('0x5')]['id']);if(_['isNil'](this[_0xae63('0x6')][_0xae63('0x11')][this[_0xae63('0x5')]['id']])){logger[_0xae63('0xf')](_0xae63('0x12'),this[_0xae63('0x4')]['id'],this['agent']['id']);setTimeout(this[_0xae63('0x7')]['bind'](this),0x3e8);}else{if(this[_0xae63('0x3')][_0xae63('0x13')]||util[_0xae63('0x14')](this['squeue']['id'],this[_0xae63('0x6')][_0xae63('0x11')][this[_0xae63('0x5')]['id']],this['squeue'][_0xae63('0x15')],![])){this['realtime'][_0xae63('0x11')][this[_0xae63('0x5')]['id']]['busy']=!![];this[_0xae63('0x6')]['agents'][this['agent']['id']][_0xae63('0x16')]=undefined;util[_0xae63('0x17')](this[_0xae63('0x18')],this['squeue']['id'],this[_0xae63('0x6')][_0xae63('0x11')][this[_0xae63('0x5')]['id']],null,this[_0xae63('0x3')]);util[_0xae63('0x19')](this[_0xae63('0x4')]['id'],this['realtime'][_0xae63('0x11')][this[_0xae63('0x5')]['id']],_0xae63('0x1a')+(this['routing']['forcedOwnership']?_0xae63('0x1b'):''));}else{logger['info'](_0xae63('0x1c'),this[_0xae63('0x4')]['id'],this['agent']['id']);setTimeout(this[_0xae63('0x7')][_0xae63('0x9')](this),0x3e8);}}};Agent[_0xae63('0xd')][_0xae63('0xa')]=function(_0x2e3640){if(_[_0xae63('0x1d')](this['realtime'][_0xae63('0x11')][this[_0xae63('0x5')]['id']])){return logger[_0xae63('0xf')]('[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s',this[_0xae63('0x4')]['id'],this[_0xae63('0x5')]['id']);}else{logger['info']('[%s][AGENT]\x20timeout\x20with\x20%s',this[_0xae63('0x4')]['id'],this[_0xae63('0x5')]['id']);util[_0xae63('0x1e')](this[_0xae63('0x18')],this['squeue']['id'],this[_0xae63('0x6')]['agents'][this['agent']['id']],null,this[_0xae63('0x3')]);this[_0xae63('0x6')][_0xae63('0x11')][this[_0xae63('0x5')]['id']][_0xae63('0x1f')]=![];this[_0xae63('0x6')][_0xae63('0x11')][this[_0xae63('0x5')]['id']]['busyQueue']=undefined;util[_0xae63('0x19')](this[_0xae63('0x4')]['id'],this[_0xae63('0x6')]['agents'][this[_0xae63('0x5')]['id']],_0x2e3640?_0xae63('0x20'):_0xae63('0x21'));}if(!_0x2e3640){setTimeout(this[_0xae63('0x7')][_0xae63('0x9')](this),0x3e8);}};function agent(_0x390a5d,_0x2e3547,_0xc29c1b,_0x5e9c15){return new Agent(_0x390a5d,_0x2e3547,_0xc29c1b,_0x5e9c15);}module['exports']=agent; \ No newline at end of file +var _0xe570=['busyQueue','showNotification','writeLog','hideNotification','busy','STOP','TIMEOUT','uuid','../../../../../config/logger','routing','notificationId','squeue','push','handleRun','handleTimeout','timeout','bind','drained','prototype','handleDrained','info','[%s][AGENT]\x20try\x20with\x20%s','isNil','realtime','agents','agent','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','forcedOwnership','isAgentAvailable','channel'];(function(_0x50a561,_0x268a0e){var _0x15407e=function(_0x2a1442){while(--_0x2a1442){_0x50a561['push'](_0x50a561['shift']());}};_0x15407e(++_0x268a0e);}(_0xe570,0x1ab));var _0x0e57=function(_0x176845,_0x58f338){_0x176845=_0x176845-0x0;var _0x289308=_0xe570[_0x176845];return _0x289308;};'use strict';var _=require('lodash');var uuid=require(_0x0e57('0x0'));var util=require('./util');var logger=require(_0x0e57('0x1'))(_0x0e57('0x2'));var Agent=function(_0x2f2726,_0x38ed05,_0x448f42,_0x3155ee){this[_0x0e57('0x3')]=uuid['v4']();this[_0x0e57('0x4')]=_0x2f2726;this['agent']=_0x38ed05;this['realtime']=_0x448f42;this[_0x0e57('0x2')]=_0x3155ee;this[_0x0e57('0x4')][_0x0e57('0x5')](this[_0x0e57('0x6')]['bind'](this),this[_0x0e57('0x7')]['bind'](this));this[_0x0e57('0x4')]['on'](_0x0e57('0x8'),this[_0x0e57('0x7')][_0x0e57('0x9')](this));this[_0x0e57('0x4')]['on'](_0x0e57('0xa'),this['handleDrained'][_0x0e57('0x9')](this));};Agent[_0x0e57('0xb')]['push']=function(){this[_0x0e57('0x4')][_0x0e57('0x5')](this['handleRun'][_0x0e57('0x9')](this),this['handleTimeout']['bind'](this));};Agent[_0x0e57('0xb')][_0x0e57('0xc')]=function(){this[_0x0e57('0x7')](!![]);};Agent[_0x0e57('0xb')]['handleRun']=function(_0x1af835){logger[_0x0e57('0xd')](_0x0e57('0xe'),this[_0x0e57('0x4')]['id'],this['agent']['id']);if(_[_0x0e57('0xf')](this[_0x0e57('0x10')][_0x0e57('0x11')][this[_0x0e57('0x12')]['id']])){logger['info'](_0x0e57('0x13'),this['squeue']['id'],this[_0x0e57('0x12')]['id']);setTimeout(this[_0x0e57('0x5')][_0x0e57('0x9')](this),0x3e8);}else{if(this[_0x0e57('0x2')][_0x0e57('0x14')]||util[_0x0e57('0x15')](this['squeue']['id'],this['realtime'][_0x0e57('0x11')][this[_0x0e57('0x12')]['id']],this[_0x0e57('0x4')][_0x0e57('0x16')],![])){this[_0x0e57('0x10')][_0x0e57('0x11')][this['agent']['id']]['busy']=!![];this[_0x0e57('0x10')]['agents'][this[_0x0e57('0x12')]['id']][_0x0e57('0x17')]=undefined;util[_0x0e57('0x18')](this[_0x0e57('0x3')],this[_0x0e57('0x4')]['id'],this['realtime'][_0x0e57('0x11')][this['agent']['id']],null,this[_0x0e57('0x2')]);util[_0x0e57('0x19')](this[_0x0e57('0x4')]['id'],this[_0x0e57('0x10')]['agents'][this[_0x0e57('0x12')]['id']],'RINGING'+(this[_0x0e57('0x2')]['forcedOwnership']?':FORCED':''));}else{logger['info']('[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available',this[_0x0e57('0x4')]['id'],this[_0x0e57('0x12')]['id']);setTimeout(this[_0x0e57('0x5')]['bind'](this),0x3e8);}}};Agent[_0x0e57('0xb')][_0x0e57('0x7')]=function(_0x36ef07){if(_['isNil'](this[_0x0e57('0x10')][_0x0e57('0x11')][this[_0x0e57('0x12')]['id']])){return logger[_0x0e57('0xd')](_0x0e57('0x13'),this[_0x0e57('0x4')]['id'],this['agent']['id']);}else{logger[_0x0e57('0xd')]('[%s][AGENT]\x20timeout\x20with\x20%s',this['squeue']['id'],this[_0x0e57('0x12')]['id']);util[_0x0e57('0x1a')](this[_0x0e57('0x3')],this[_0x0e57('0x4')]['id'],this[_0x0e57('0x10')][_0x0e57('0x11')][this['agent']['id']],null,this[_0x0e57('0x2')]);this['realtime']['agents'][this[_0x0e57('0x12')]['id']][_0x0e57('0x1b')]=![];this[_0x0e57('0x10')][_0x0e57('0x11')][this[_0x0e57('0x12')]['id']][_0x0e57('0x17')]=undefined;util['writeLog'](this[_0x0e57('0x4')]['id'],this[_0x0e57('0x10')][_0x0e57('0x11')][this[_0x0e57('0x12')]['id']],_0x36ef07?_0x0e57('0x1c'):_0x0e57('0x1d'));}if(!_0x36ef07){setTimeout(this['push']['bind'](this),0x3e8);}};function agent(_0x1730a0,_0x3fa477,_0xb01085,_0x1b5cb5){return new Agent(_0x1730a0,_0x3fa477,_0xb01085,_0x1b5cb5);}module['exports']=agent; \ No newline at end of file diff --git a/server/services/routing/server/applications/strategy/beepall.js b/server/services/routing/server/applications/strategy/beepall.js index 2b9ddfb..38525cd 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 _0x1cb9=['realtime','push','bind','timeout','handleTimeout','drained','handleDrained','prototype','handleRun','isNil','Agents','[%s][QUEUE]\x20agent\x20skipped,\x20unknown\x20id\x20%s','agents','channel','writeLog','RINGING','busy','busyQueue','name','showNotification','notificationId','info','[%s][QUEUE]\x20ALL\x20AGENTS\x20ARE\x20BUSY','[%s][QUEUE]\x20EMPTY','length','hideNotification','TIMEOUT','exports','lodash','./util','../../../../../config/logger','routing','squeue','queue'];(function(_0x2ae0a1,_0x11d577){var _0x3806ba=function(_0x5f3256){while(--_0x5f3256){_0x2ae0a1['push'](_0x2ae0a1['shift']());}};_0x3806ba(++_0x11d577);}(_0x1cb9,0x14e));var _0x91cb=function(_0x203d52,_0x2646b1){_0x203d52=_0x203d52-0x0;var _0x5071a8=_0x1cb9[_0x203d52];return _0x5071a8;};'use strict';var _=require(_0x91cb('0x0'));var uuid=require('uuid');var util=require(_0x91cb('0x1'));var logger=require(_0x91cb('0x2'))(_0x91cb('0x3'));var Beepall=function(_0x351bdb,_0x57ea48,_0x42910d,_0x2b7314){this['notificationId']=uuid['v4']();this[_0x91cb('0x4')]=_0x351bdb;this[_0x91cb('0x5')]=_0x57ea48;this[_0x91cb('0x6')]=_0x42910d;this[_0x91cb('0x3')]=_0x2b7314;this[_0x91cb('0x4')][_0x91cb('0x7')](this['handleRun'][_0x91cb('0x8')](this),this['handleTimeout'][_0x91cb('0x8')](this));this['squeue']['on'](_0x91cb('0x9'),this[_0x91cb('0xa')][_0x91cb('0x8')](this));this[_0x91cb('0x4')]['on'](_0x91cb('0xb'),this[_0x91cb('0xc')][_0x91cb('0x8')](this));};Beepall[_0x91cb('0xd')][_0x91cb('0x7')]=function(){this[_0x91cb('0x4')]['push'](this[_0x91cb('0xe')][_0x91cb('0x8')](this),this['handleTimeout'][_0x91cb('0x8')](this));};Beepall[_0x91cb('0xd')][_0x91cb('0xc')]=function(_0x2c7d40){this['handleTimeout'](!![]);};Beepall['prototype'][_0x91cb('0xe')]=function(_0x3d22b7){var _0x585470=!![];if(!_['isNil'](this[_0x91cb('0x5')])&&!_[_0x91cb('0xf')](this[_0x91cb('0x5')]['Agents'])&&this[_0x91cb('0x5')][_0x91cb('0x10')]['length']>0x0){for(var _0xc594e3=0x0,_0x139f4b;_0xc594e30x0){for(var _0x5d34b2=0x0,_0x27ed41;_0x5d34b20x0&&_0x34b353[_0x3e075c+_0xc583('0x24')]>=_0x34b353[_0x3e075c+_0xc583('0x23')]){writeLog(_0x542256,_0x34b353,_0x3e075c[_0xc583('0x25')]()+_0xc583('0x26'));return![];}}return!![];};exports['showNotification']=function(_0x2dafb4,_0x44f76a,_0x4adde3,_0x162c85,_0x483357){return sendNotification(!![],_0x2dafb4,_0x44f76a,_0x4adde3,_0x162c85,_0x483357);};exports[_0xc583('0x27')]=function(_0x8d4ecb,_0x1c80b1,_0x3ed083,_0x1b2b49,_0x19079b){return sendNotification(![],_0x8d4ecb,_0x1c80b1,_0x3ed083,_0x1b2b49,_0x19079b);};exports[_0xc583('0x28')]=writeLog; \ No newline at end of file +var _0xc6ac=['user:%s','name','split','account','notificationSound','body','queue','notificationTemplate','msg','I\x20can\x27t\x20render\x20your\x20template','error','format','[%s][QUEUE]\x20%s','message','notification:%s','save','remove','info','[%s][QUEUE][AGENT:%s][STATUS:%s]','isAgentAvailable','BUSY','online','OFFLINE','Pause','PAUSE','hasOwnProperty','CurrentCapacity','Capacity','toUpperCase','showNotification','hideNotification','writeLog','lodash','util','../utils','mustache','ioredis','../../../../../config/environment','../../../../../config/logger','routing','redis','defaults','localhost','socket.io-emitter','emit'];(function(_0x3d9d1c,_0x1900d3){var _0x24d06d=function(_0x32ff05){while(--_0x32ff05){_0x3d9d1c['push'](_0x3d9d1c['shift']());}};_0x24d06d(++_0x1900d3);}(_0xc6ac,0x15b));var _0xcc6a=function(_0x308ed2,_0x27d6ef){_0x308ed2=_0x308ed2-0x0;var _0x3be7e1=_0xc6ac[_0x308ed2];return _0x3be7e1;};'use strict';var _=require(_0xcc6a('0x0'));var util=require(_0xcc6a('0x1'));var utils=require(_0xcc6a('0x2'));var Mustache=require(_0xcc6a('0x3'));var Redis=require(_0xcc6a('0x4'));var config=require(_0xcc6a('0x5'));var logger=require(_0xcc6a('0x6'))(_0xcc6a('0x7'));config[_0xcc6a('0x8')]=_[_0xcc6a('0x9')](config[_0xcc6a('0x8')],{'host':_0xcc6a('0xa'),'port':0x18eb});var io=require(_0xcc6a('0xb'))(new Redis(config[_0xcc6a('0x8')]));function emit(_0x5f3887,_0x3dd497,_0x11b919){io['to'](_0x5f3887)[_0xcc6a('0xc')](_0x3dd497,_0x11b919);}function sendNotification(_0x560cc4,_0x43e3bf,_0x210f63,_0x7806a0,_0x463ebb,_0x3eb04a){io['to'](util['format'](_0xcc6a('0xd'),_0x7806a0[_0xcc6a('0xe')]))[_0xcc6a('0xc')]('user:save',_0x7806a0);var _0x1d91a5=_0x3eb04a||{};var _0x9e9a63=_0x210f63[_0xcc6a('0xf')]('.');var _0x55af93={'uniqueid':_0x43e3bf,'channel':_0x9e9a63[0x0],'id':_0x9e9a63[0x1],'title':_0x9e9a63[0x0]+'\x20interaction','interactionId':_0x9e9a63[0x2],'queue':_0x463ebb?_0x463ebb[_0xcc6a('0xe')]:null,'sound':_0x1d91a5[_0xcc6a('0x10')][_0xcc6a('0x11')],'shake':_0x1d91a5['account']['notificationShake']};try{if(!_0x1d91a5[_0xcc6a('0x12')]){_0x1d91a5[_0xcc6a('0x12')]={};}if(_0x463ebb){_0x1d91a5[_0xcc6a('0x12')][_0xcc6a('0x13')]=_0x463ebb;}else if(_0x1d91a5[_0xcc6a('0x12')][_0xcc6a('0x13')]){delete _0x1d91a5[_0xcc6a('0x12')][_0xcc6a('0x13')];}_0x55af93['msg']=utils['getMustacheRender'](_0x1d91a5['account'][_0xcc6a('0x14')],_0x1d91a5);}catch(_0x44910f){_0x55af93[_0xcc6a('0x15')]=_0xcc6a('0x16');logger[_0xcc6a('0x17')](util[_0xcc6a('0x18')](_0xcc6a('0x19'),_0x43e3bf,_0x44910f[_0xcc6a('0x1a')]));}io['to'](util[_0xcc6a('0x18')](_0xcc6a('0xd'),_0x7806a0[_0xcc6a('0xe')]))['emit'](util[_0xcc6a('0x18')](_0xcc6a('0x1b'),_0x560cc4?_0xcc6a('0x1c'):_0xcc6a('0x1d')),_0x55af93);}function writeLog(_0x1495d8,_0x30b8ed,_0x36c80f){return logger[_0xcc6a('0x1e')](util[_0xcc6a('0x18')](_0xcc6a('0x1f'),_0x1495d8,_0x30b8ed[_0xcc6a('0xe')],_0x36c80f));}exports[_0xcc6a('0x20')]=function(_0x51be9a,_0x41c4c8,_0x3a081e,_0x38f812){if(_0x41c4c8['busy']){writeLog(_0x51be9a,_0x41c4c8,_0xcc6a('0x21'));return![];}if(!_0x41c4c8[_0xcc6a('0x22')]){writeLog(_0x51be9a,_0x41c4c8,_0xcc6a('0x23'));return![];}if(_0x41c4c8[_0x3a081e+_0xcc6a('0x24')]){writeLog(_0x51be9a,_0x41c4c8,_0xcc6a('0x25'));return![];}if(_0x38f812&&_0x41c4c8[_0xcc6a('0x26')](_0x3a081e+'Capacity')&&_0x41c4c8[_0xcc6a('0x26')](_0x3a081e+_0xcc6a('0x27'))){if(_0x41c4c8[_0x3a081e+_0xcc6a('0x28')]>0x0&&_0x41c4c8[_0x3a081e+'CurrentCapacity']>=_0x41c4c8[_0x3a081e+_0xcc6a('0x28')]){writeLog(_0x51be9a,_0x41c4c8,_0x3a081e[_0xcc6a('0x29')]()+'\x20MAXCAPACITY');return![];}}return!![];};exports[_0xcc6a('0x2a')]=function(_0x8b1b2b,_0x3233d1,_0x473f88,_0x5d7399,_0x194aab){return sendNotification(!![],_0x8b1b2b,_0x3233d1,_0x473f88,_0x5d7399,_0x194aab);};exports[_0xcc6a('0x2b')]=function(_0x2c6d88,_0x4f176b,_0x2590a2,_0x5308d4,_0x4f67d3){return sendNotification(![],_0x2c6d88,_0x4f176b,_0x2590a2,_0x5308d4,_0x4f67d3);};exports[_0xcc6a('0x2c')]=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 8de1026..4afc1e7 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 _0xbf40=['lodash','./utils','../../../../config/logger','routing','string','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length','[%s][SYSTEM]\x20%s','map','join','info','next','[%s][SYSTEM]\x20commnad:\x20%s','exec','trim','[%s][SYSTEM]\x20result\x20code:\x20%s','replace','isEmpty','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','body','error','isObject','validate','shelljs'];(function(_0x1216dd,_0x3ae021){var _0x405658=function(_0x22e8c7){while(--_0x22e8c7){_0x1216dd['push'](_0x1216dd['shift']());}};_0x405658(++_0x3ae021);}(_0xbf40,0xad));var _0x0bf4=function(_0x172747,_0x1732bd){_0x172747=_0x172747-0x0;var _0x509692=_0xbf40[_0x172747];return _0x509692;};'use strict';var schema=require(_0x0bf4('0x0'));var sh=require(_0x0bf4('0x1'));var _=require(_0x0bf4('0x2'));var utils=require(_0x0bf4('0x3'));var logger=require(_0x0bf4('0x4'))(_0x0bf4('0x5'));var system=schema({'command':{'type':_0x0bf4('0x6'),'required':!![],'message':_0x0bf4('0x7')}});exports[_0x0bf4('0x8')]=function(_0x2779d2,_0x5dd80a){return function(_0x487968){try{var _0x575dd9={'command':_0x5dd80a[0x0]};var _0x3595c3=system['validate'](_0x575dd9,{'typecast':!![]});if(_0x3595c3[_0x0bf4('0x9')]){logger['error'](_0x0bf4('0xa'),_0x2779d2,_[_0x0bf4('0xb')](_0x3595c3,'message')[_0x0bf4('0xc')](',\x20'));logger[_0x0bf4('0xd')]('[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next',_0x2779d2);_0x487968[_0x0bf4('0xe')]();}else{var _0x43a4ff=this;var _0x2d3559=utils['getMustacheRender'](_0x5dd80a[0x0],this);logger[_0x0bf4('0xd')](_0x0bf4('0xf'),_0x2779d2,_0x2d3559);sh[_0x0bf4('0x10')](_[_0x0bf4('0x11')](_0x2d3559),function(_0x1e20cb,_0x1ee183){logger['info'](_0x0bf4('0x12'),_0x2779d2,_0x1e20cb);if(_0x1e20cb==0x0){var _0x18eb16=_0x1ee183[_0x0bf4('0x13')](/(\r\n|\n|\r)/gm,'');if(_['isNil'](_0x5dd80a[0x1])||_[_0x0bf4('0x14')](_0x5dd80a[0x1])){logger[_0x0bf4('0xd')]('[%s][SYSTEM]\x20no\x20variable',_0x2779d2);_0x43a4ff['body'][_0x5dd80a[0x1]]=_0x18eb16;}else{logger[_0x0bf4('0xd')](_0x0bf4('0x15'),_0x2779d2,_0x5dd80a[0x1],_0x18eb16);_0x43a4ff[_0x0bf4('0x16')][_0x5dd80a[0x1]]=_0x18eb16;}}_0x487968[_0x0bf4('0xe')]();});}}catch(_0x217a4e){logger[_0x0bf4('0x17')](_0x0bf4('0xa'),_0x2779d2,_[_0x0bf4('0x18')](_0x217a4e)?JSON['stringify'](_0x217a4e):_0x217a4e);logger[_0x0bf4('0xd')]('[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next',_0x2779d2);_0x487968[_0x0bf4('0xe')]();}};}; \ No newline at end of file +var _0x1b6d=['isEmpty','[%s][SYSTEM]\x20no\x20variable','body','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','isObject','stringify','validate','lodash','../../../../config/logger','routing','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length','error','message','join','info','next','getMustacheRender','exec','trim','[%s][SYSTEM]\x20result\x20code:\x20%s','replace','isNil'];(function(_0x53b4dc,_0x51f549){var _0x3b2b68=function(_0x532722){while(--_0x532722){_0x53b4dc['push'](_0x53b4dc['shift']());}};_0x3b2b68(++_0x51f549);}(_0x1b6d,0x1e6));var _0xd1b6=function(_0x27af45,_0x1b57aa){_0x27af45=_0x27af45-0x0;var _0x18df21=_0x1b6d[_0x27af45];return _0x18df21;};'use strict';var schema=require(_0xd1b6('0x0'));var sh=require('shelljs');var _=require(_0xd1b6('0x1'));var utils=require('./utils');var logger=require(_0xd1b6('0x2'))(_0xd1b6('0x3'));var system=schema({'command':{'type':'string','required':!![],'message':_0xd1b6('0x4')}});exports[_0xd1b6('0x5')]=function(_0x1b5bbd,_0x2752c3){return function(_0x48a273){try{var _0x206666={'command':_0x2752c3[0x0]};var _0x4c053c=system['validate'](_0x206666,{'typecast':!![]});if(_0x4c053c[_0xd1b6('0x6')]){logger[_0xd1b6('0x7')]('[%s][SYSTEM]\x20%s',_0x1b5bbd,_['map'](_0x4c053c,_0xd1b6('0x8'))[_0xd1b6('0x9')](',\x20'));logger[_0xd1b6('0xa')]('[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next',_0x1b5bbd);_0x48a273[_0xd1b6('0xb')]();}else{var _0x12149b=this;var _0x20cef7=utils[_0xd1b6('0xc')](_0x2752c3[0x0],this);logger[_0xd1b6('0xa')]('[%s][SYSTEM]\x20commnad:\x20%s',_0x1b5bbd,_0x20cef7);sh[_0xd1b6('0xd')](_[_0xd1b6('0xe')](_0x20cef7),function(_0x55068d,_0x5d0e08){logger['info'](_0xd1b6('0xf'),_0x1b5bbd,_0x55068d);if(_0x55068d==0x0){var _0x3359a7=_0x5d0e08[_0xd1b6('0x10')](/(\r\n|\n|\r)/gm,'');if(_[_0xd1b6('0x11')](_0x2752c3[0x1])||_[_0xd1b6('0x12')](_0x2752c3[0x1])){logger[_0xd1b6('0xa')](_0xd1b6('0x13'),_0x1b5bbd);_0x12149b[_0xd1b6('0x14')][_0x2752c3[0x1]]=_0x3359a7;}else{logger[_0xd1b6('0xa')](_0xd1b6('0x15'),_0x1b5bbd,_0x2752c3[0x1],_0x3359a7);_0x12149b[_0xd1b6('0x14')][_0x2752c3[0x1]]=_0x3359a7;}}_0x48a273[_0xd1b6('0xb')]();});}}catch(_0x1ceb0f){logger['error']('[%s][SYSTEM]\x20%s',_0x1b5bbd,_[_0xd1b6('0x16')](_0x1ceb0f)?JSON[_0xd1b6('0x17')](_0x1ceb0f):_0x1ceb0f);logger[_0xd1b6('0xa')]('[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next',_0x1b5bbd);_0x48a273[_0xd1b6('0xb')]();}};}; \ 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 f7a61c1..4553ca5 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 _0x204d=['stringify','validate','lodash','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','../../../../config/logger','routing','number','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','channel','Interaction','interaction','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','isObject'];(function(_0x18ab2a,_0x4debcd){var _0x16dcee=function(_0x10107a){while(--_0x10107a){_0x18ab2a['push'](_0x18ab2a['shift']());}};_0x16dcee(++_0x4debcd);}(_0x204d,0x119));var _0xd204=function(_0x2067e9,_0x5e6a97){_0x2067e9=_0x2067e9-0x0;var _0x280ce4=_0x204d[_0x2067e9];return _0x280ce4;};'use strict';var schema=require(_0xd204('0x0'));var _=require(_0xd204('0x1'));var rpc={'chatInteraction':require(_0xd204('0x2')),'openchannelInteraction':require(_0xd204('0x3')),'smsInteraction':require(_0xd204('0x4')),'mailInteraction':require(_0xd204('0x5')),'faxInteraction':require(_0xd204('0x6')),'whatsappInteraction':require(_0xd204('0x7'))};var logger=require(_0xd204('0x8'))(_0xd204('0x9'));var tag=schema({'tag':{'type':_0xd204('0xa'),'required':!![],'message':_0xd204('0xb')}});exports[_0xd204('0xc')]=function(_0x37229b,_0x18da9e,_0x4f2824,_0x33dcf2){return function(_0x43f18c){try{var _0xf21e3d={'tag':_0x18da9e[0x0]};var _0x5e28a0=tag[_0xd204('0x0')](_0xf21e3d,{'typecast':!![]});if(_0x5e28a0[_0xd204('0xd')]){logger[_0xd204('0xe')](_0xd204('0xf'),_0x37229b,_[_0xd204('0x10')](_0x5e28a0,_0xd204('0x11'))[_0xd204('0x12')](',\x20'));logger[_0xd204('0x13')](_0xd204('0x14'),_0x37229b);_0x43f18c[_0xd204('0x15')]();}else{var _0x2a6996={'ids':[_0x18da9e[0x0]]};if(rpc[_0x33dcf2[_0xd204('0x16')]+'Interaction']){rpc[_0x33dcf2[_0xd204('0x16')]+_0xd204('0x17')]['addTags'](_0x33dcf2[_0xd204('0x18')]['id'],_0x2a6996)['then'](function(_0x16bbf4){logger[_0xd204('0x13')](_0xd204('0x19'),_0x37229b,_0x18da9e[0x1],_0x33dcf2['channel'],_0x33dcf2[_0xd204('0x18')]['id']);})['catch'](function(_0x45413c){logger[_0xd204('0xe')](_0xd204('0xf'),_0x37229b,JSON['stringify'](_0x45413c));logger[_0xd204('0x13')]('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x37229b);})['finally'](function(){_0x43f18c[_0xd204('0x15')]();});}}}catch(_0x4faf40){logger[_0xd204('0xe')](_0xd204('0xf'),_0x37229b,_[_0xd204('0x1a')](_0x4faf40)?JSON[_0xd204('0x1b')](_0x4faf40):_0x4faf40);logger['info'](_0xd204('0x14'),_0x37229b);_0x43f18c[_0xd204('0x15')]();}};}; \ No newline at end of file +var _0x93d3=['lodash','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/mailInteraction','../../rpc/whatsappInteraction','../../../../config/logger','routing','number','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length','[%s][TAG]\x20%s','map','message','info','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','next','channel','Interaction','interaction','then','catch','stringify','finally','error','isObject','validate'];(function(_0x631a3c,_0x1b61b6){var _0x2bdfa3=function(_0x21711b){while(--_0x21711b){_0x631a3c['push'](_0x631a3c['shift']());}};_0x2bdfa3(++_0x1b61b6);}(_0x93d3,0xbc));var _0x393d=function(_0x8c43de,_0x90ff31){_0x8c43de=_0x8c43de-0x0;var _0xa6591b=_0x93d3[_0x8c43de];return _0xa6591b;};'use strict';var schema=require(_0x393d('0x0'));var _=require(_0x393d('0x1'));var rpc={'chatInteraction':require(_0x393d('0x2')),'openchannelInteraction':require(_0x393d('0x3')),'smsInteraction':require('../../rpc/smsInteraction'),'mailInteraction':require(_0x393d('0x4')),'faxInteraction':require('../../rpc/faxInteraction'),'whatsappInteraction':require(_0x393d('0x5'))};var logger=require(_0x393d('0x6'))(_0x393d('0x7'));var tag=schema({'tag':{'type':_0x393d('0x8'),'required':!![],'message':_0x393d('0x9')}});exports[_0x393d('0xa')]=function(_0x6f953c,_0x38581a,_0xdb8504,_0x1e8084){return function(_0x5ef543){try{var _0x31a79c={'tag':_0x38581a[0x0]};var _0x4978f9=tag['validate'](_0x31a79c,{'typecast':!![]});if(_0x4978f9[_0x393d('0xb')]){logger['error'](_0x393d('0xc'),_0x6f953c,_[_0x393d('0xd')](_0x4978f9,_0x393d('0xe'))['join'](',\x20'));logger[_0x393d('0xf')](_0x393d('0x10'),_0x6f953c);_0x5ef543[_0x393d('0x11')]();}else{var _0x113f60={'ids':[_0x38581a[0x0]]};if(rpc[_0x1e8084[_0x393d('0x12')]+_0x393d('0x13')]){rpc[_0x1e8084[_0x393d('0x12')]+'Interaction']['addTags'](_0x1e8084[_0x393d('0x14')]['id'],_0x113f60)[_0x393d('0x15')](function(_0xe61e96){logger[_0x393d('0xf')]('[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s',_0x6f953c,_0x38581a[0x1],_0x1e8084[_0x393d('0x12')],_0x1e8084[_0x393d('0x14')]['id']);})[_0x393d('0x16')](function(_0x59e43f){logger['error'](_0x393d('0xc'),_0x6f953c,JSON[_0x393d('0x17')](_0x59e43f));logger['info'](_0x393d('0x10'),_0x6f953c);})[_0x393d('0x18')](function(){_0x5ef543[_0x393d('0x11')]();});}}}catch(_0x14c8a9){logger[_0x393d('0x19')](_0x393d('0xc'),_0x6f953c,_[_0x393d('0x1a')](_0x14c8a9)?JSON['stringify'](_0x14c8a9):_0x14c8a9);logger[_0x393d('0xf')](_0x393d('0x10'),_0x6f953c);_0x5ef543[_0x393d('0x11')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/tvox.js b/server/services/routing/server/applications/tvox.js index bebe3a4..32e2295 100644 --- a/server/services/routing/server/applications/tvox.js +++ b/server/services/routing/server/applications/tvox.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x28d0=['login','push','params','utf8','POST','application/json-rpc','result','logged','Unable\x20to\x20login\x20with\x20TVox\x20application','channelId=','&serviceId=','&sessionId=','&data=','stringify','info','[%s][TVOX]\x20Request\x20sent\x20to\x20TVox:\x20%s','stop','catch','[%s][TVOX]\x20%s','[%s][TVOX]\x20Application\x20already\x20executed\x20for\x20the\x20current\x20session,\x20force\x20next','request-promise','../../../../config/logger','routing','lodash','consequence','replace','\x20-\x20','includes','urlOnAnswer','urlOnRing','title','2.0','method'];(function(_0x40818c,_0x5c32a8){var _0x43b29b=function(_0x163b85){while(--_0x163b85){_0x40818c['push'](_0x40818c['shift']());}};_0x43b29b(++_0x5c32a8);}(_0x28d0,0xb9));var _0x028d=function(_0x4533fc,_0x142599){_0x4533fc=_0x4533fc-0x0;var _0x2960cd=_0x28d0[_0x4533fc];return _0x2960cd;};'use strict';var rp=require(_0x028d('0x0'));var logger=require(_0x028d('0x1'))(_0x028d('0x2'));var _=require(_0x028d('0x3'));var arr=[];exports[_0x028d('0x4')]=function(_0x5c8f8a,_0x27cfa2){return function(_0x436a2d){var _0x1fb004=_0x27cfa2[0xa];var _0x50f015=_0x27cfa2[0xb];var _0x4bbeba=_0x27cfa2[0xc];var _0x4841d1=_0x27cfa2[0xd];var _0x14b1b0=_0x27cfa2[0xe];var _0x33e15e=_0x27cfa2[0xf][_0x028d('0x5')](/\n/g,_0x028d('0x6'));var _0x5861c9=_0x27cfa2[0x10]['replace'](/\n/g,'\x20');if(!arr[_0x028d('0x7')](_0x50f015)){arr['push'](_0x50f015);var _0x37a483=_0x27cfa2[0x3];var _0xc95386=_0x27cfa2[0x4];var _0x1bed7f=_0x27cfa2[0x1];var _0x105ab5=_0x27cfa2[0x0];var _0x56e056={};_0x56e056[_0x028d('0x8')]=_0x27cfa2[0x8]+'?params='+_0x4bbeba+'|'+_0x1fb004+'|'+_0x4841d1+'|'+_0x50f015+'|'+_0x14b1b0;_0x56e056[_0x028d('0x9')]=_0x27cfa2[0x7]+'?params='+_0x4bbeba+'|'+_0x1fb004+'|'+_0x4841d1+'|'+_0x50f015+'|'+_0x14b1b0+'|'+_0x33e15e+'|'+_0x5861c9;_0x56e056[_0x028d('0xa')]=_0x27cfa2[0x9];var _0x1c1552={};_0x1c1552['jsonrpc']=_0x028d('0xb');_0x1c1552[_0x028d('0xc')]=_0x028d('0xd');var _0x32217d=[];_0x32217d['push'](_0x27cfa2[0x2]);_0x32217d[_0x028d('0xe')](_0x27cfa2[0x5]);_0x32217d[_0x028d('0xe')](_0x27cfa2[0x6]);_0x1c1552[_0x028d('0xf')]=_0x32217d;_0x1c1552['id']=0x1;var _0x48ac10=JSON['stringify'](_0x1c1552);var _0x4893dd={'encoding':_0x028d('0x10'),'method':_0x028d('0x11'),'timeout':0x2710,'url':_0x37a483,'headers':{'Content-Type':_0x028d('0x12')},'body':_0x48ac10};return rp(_0x4893dd)['then'](function(_0x590d1f){const _0x1dee58=JSON['parse'](_0x590d1f);if(!_0x1dee58[_0x028d('0x13')][_0x028d('0x14')]){throw new Error(_0x028d('0x15'));}var _0x214081=_0x50f015;var _0x4a802c=_0x028d('0x16')+_0x1bed7f+_0x028d('0x17')+_0x105ab5+_0x028d('0x18')+_0x214081+_0x028d('0x19')+JSON[_0x028d('0x1a')](_0x56e056);var _0x42db9c=_0xc95386+'?'+_0x4a802c;return rp(_0x42db9c);})['then'](function(_0x198e9a){logger[_0x028d('0x1b')](_0x028d('0x1c'),_0x5c8f8a,_0x198e9a);_0x436a2d[_0x028d('0x1d')]();})[_0x028d('0x1e')](function(_0x375024){logger['error'](_0x028d('0x1f'),_0x5c8f8a,_['isObject'](_0x375024)?JSON['stringify'](_0x375024):_0x375024);_0x436a2d['stop']();});}else{logger['info'](_0x028d('0x20'),_0x5c8f8a);_0x436a2d['next']();}};}; \ No newline at end of file +var _0xaa09=['info','[%s][TVOX]\x20Request\x20sent\x20to\x20TVox:\x20%s','stop','catch','error','[%s][TVOX]\x20%s','[%s][TVOX]\x20Application\x20already\x20executed\x20for\x20the\x20current\x20session,\x20force\x20next','next','request-promise','routing','lodash','consequence','replace','\x20-\x20','includes','push','?params=','urlOnRing','title','2.0','method','params','stringify','utf8','POST','application/json-rpc','then','parse','result','logged','Unable\x20to\x20login\x20with\x20TVox\x20application','channelId=','&sessionId=','&data='];(function(_0x11e05d,_0x3a4491){var _0x335588=function(_0x35ec3f){while(--_0x35ec3f){_0x11e05d['push'](_0x11e05d['shift']());}};_0x335588(++_0x3a4491);}(_0xaa09,0x118));var _0x9aa0=function(_0x443259,_0x3b87aa){_0x443259=_0x443259-0x0;var _0x4c8af9=_0xaa09[_0x443259];return _0x4c8af9;};'use strict';var rp=require(_0x9aa0('0x0'));var logger=require('../../../../config/logger')(_0x9aa0('0x1'));var _=require(_0x9aa0('0x2'));var arr=[];exports[_0x9aa0('0x3')]=function(_0x181314,_0x3d134e){return function(_0x7e052){var _0x48677f=_0x3d134e[0xa];var _0x1914e7=_0x3d134e[0xb];var _0x13eae6=_0x3d134e[0xc];var _0x4c5e5e=_0x3d134e[0xd];var _0x4dc623=_0x3d134e[0xe];var _0x547538=_0x3d134e[0xf][_0x9aa0('0x4')](/\n/g,_0x9aa0('0x5'));var _0x367628=_0x3d134e[0x10][_0x9aa0('0x4')](/\n/g,'\x20');if(!arr[_0x9aa0('0x6')](_0x1914e7)){arr[_0x9aa0('0x7')](_0x1914e7);var _0x11f488=_0x3d134e[0x3];var _0x3bd33c=_0x3d134e[0x4];var _0x1b4b22=_0x3d134e[0x1];var _0x488ef7=_0x3d134e[0x0];var _0xedd1db={};_0xedd1db['urlOnAnswer']=_0x3d134e[0x8]+_0x9aa0('0x8')+_0x13eae6+'|'+_0x48677f+'|'+_0x4c5e5e+'|'+_0x1914e7+'|'+_0x4dc623;_0xedd1db[_0x9aa0('0x9')]=_0x3d134e[0x7]+'?params='+_0x13eae6+'|'+_0x48677f+'|'+_0x4c5e5e+'|'+_0x1914e7+'|'+_0x4dc623+'|'+_0x547538+'|'+_0x367628;_0xedd1db[_0x9aa0('0xa')]=_0x3d134e[0x9];var _0x230f6f={};_0x230f6f['jsonrpc']=_0x9aa0('0xb');_0x230f6f[_0x9aa0('0xc')]='login';var _0x5a1ee9=[];_0x5a1ee9[_0x9aa0('0x7')](_0x3d134e[0x2]);_0x5a1ee9[_0x9aa0('0x7')](_0x3d134e[0x5]);_0x5a1ee9[_0x9aa0('0x7')](_0x3d134e[0x6]);_0x230f6f[_0x9aa0('0xd')]=_0x5a1ee9;_0x230f6f['id']=0x1;var _0x33dc07=JSON[_0x9aa0('0xe')](_0x230f6f);var _0x3d4f90={'encoding':_0x9aa0('0xf'),'method':_0x9aa0('0x10'),'timeout':0x2710,'url':_0x11f488,'headers':{'Content-Type':_0x9aa0('0x11')},'body':_0x33dc07};return rp(_0x3d4f90)[_0x9aa0('0x12')](function(_0x19260e){const _0x58ce70=JSON[_0x9aa0('0x13')](_0x19260e);if(!_0x58ce70[_0x9aa0('0x14')][_0x9aa0('0x15')]){throw new Error(_0x9aa0('0x16'));}var _0x2582de=_0x1914e7;var _0x157e1d=_0x9aa0('0x17')+_0x1b4b22+'&serviceId='+_0x488ef7+_0x9aa0('0x18')+_0x2582de+_0x9aa0('0x19')+JSON[_0x9aa0('0xe')](_0xedd1db);var _0x5a2508=_0x3bd33c+'?'+_0x157e1d;return rp(_0x5a2508);})['then'](function(_0x5c0e70){logger[_0x9aa0('0x1a')](_0x9aa0('0x1b'),_0x181314,_0x5c0e70);_0x7e052[_0x9aa0('0x1c')]();})[_0x9aa0('0x1d')](function(_0x2e16a1){logger[_0x9aa0('0x1e')](_0x9aa0('0x1f'),_0x181314,_['isObject'](_0x2e16a1)?JSON[_0x9aa0('0xe')](_0x2e16a1):_0x2e16a1);_0x7e052[_0x9aa0('0x1c')]();});}else{logger[_0x9aa0('0x1a')](_0x9aa0('0x20'),_0x181314);_0x7e052[_0x9aa0('0x21')]();}};}; \ 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 020c331..5019ed5 100644 --- a/server/services/routing/server/applications/utils.js +++ b/server/services/routing/server/applications/utils.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['message','account','interaction','mustache','lodash','exports','render','body','contact'];(function(_0x146e03,_0x4e0e75){var _0x43f720=function(_0x3b4fe8){while(--_0x3b4fe8){_0x146e03['push'](_0x146e03['shift']());}};_0x43f720(++_0x4e0e75);}(_0xa9e0,0x123));var _0x0a9e=function(_0x134c2e,_0x3573c4){_0x134c2e=_0x134c2e-0x0;var _0x2825db=_0xa9e0[_0x134c2e];return _0x2825db;};'use strict';var Mustache=require(_0x0a9e('0x0'));var _=require(_0x0a9e('0x1'));module[_0x0a9e('0x2')]={'getMustacheRender':function(_0x5dd881,_0x550fbc){return Mustache[_0x0a9e('0x3')](_0x5dd881,_['merge'](_0x550fbc[_0x0a9e('0x4')],{'contact':_0x550fbc[_0x0a9e('0x5')],'message':_0x550fbc[_0x0a9e('0x6')],'account':_0x550fbc[_0x0a9e('0x7')],'interaction':_0x550fbc[_0x0a9e('0x8')],'list':_0x550fbc['list']}))||'';}}; \ No newline at end of file +var _0xd8b0=['merge','body','contact','message','list','mustache','lodash','render'];(function(_0x2d7bb1,_0x1f1433){var _0x1695f1=function(_0x45d259){while(--_0x45d259){_0x2d7bb1['push'](_0x2d7bb1['shift']());}};_0x1695f1(++_0x1f1433);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var Mustache=require(_0x0d8b('0x0'));var _=require(_0x0d8b('0x1'));module['exports']={'getMustacheRender':function(_0x585166,_0x4b72b0){return Mustache[_0x0d8b('0x2')](_0x585166,_[_0x0d8b('0x3')](_0x4b72b0[_0x0d8b('0x4')],{'contact':_0x4b72b0[_0x0d8b('0x5')],'message':_0x4b72b0[_0x0d8b('0x6')],'account':_0x4b72b0['account'],'interaction':_0x4b72b0['interaction'],'list':_0x4b72b0[_0x0d8b('0x7')]}))||'';}}; \ No newline at end of file diff --git a/server/services/routing/server/index.js b/server/services/routing/server/index.js index 19161fb..47d5507 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 _0x4483=['stack','message\x20is\x20empty','end','hasOwnProperty','capacity','CurrentCapacity','updateRealtime','agent\x20not\x20found','values','chatQueues','available','loggedIn','name','paused','waiting','mailQueues','openchannelQueues','smsQueues','faxQueues','whatsappQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','server','http','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','lodash','util','path','bluebird','uuid','./applications/utils','../../../config/environment','../../../config/logger','../rpc/openchannelQueueReport','../rpc/mailQueueReport','../rpc/chatQueueReport','../rpc/smsQueueReport','../rpc/faxQueueReport','../rpc/whatsappQueueReport','../lib/rule-engine','format','%s.%s.%s','isNil','IntervalId','Intervals','interval','rules','channel','message','interaction','applications','length','existsSync','join','app','toLowerCase','autoreply','split','mail','push','slice','appdata','dialogflowv2','amazonlex','tag','tvox','account','notificationTemplate','ChatWebsiteId','ContactId','body','%s:%s:%s','./interval','condition','intervals','./applications/','consequence','priority','info','on\x20interval','error','Please\x20create\x20a\x20new\x20file\x20under','.js','execute','Applications\x20executed','stringify','complete','routing\x20is\x20empty','agent','agents','busy','busyQueue','emit','QueueReport','update','UserId'];(function(_0x36d1b6,_0x317571){var _0x23226d=function(_0x262592){while(--_0x262592){_0x36d1b6['push'](_0x36d1b6['shift']());}};_0x23226d(++_0x317571);}(_0x4483,0x1a3));var _0x3448=function(_0x21c8e0,_0x19e628){_0x21c8e0=_0x21c8e0-0x0;var _0xbd6c91=_0x4483[_0x21c8e0];return _0xbd6c91;};'use strict';var _=require(_0x3448('0x0'));var util=require(_0x3448('0x1'));var path=require(_0x3448('0x2'));var fs=require('fs');var jayson=require('jayson/promise');var BPromise=require(_0x3448('0x3'));var uuid=require(_0x3448('0x4'));var utils=require(_0x3448('0x5'));var config=require(_0x3448('0x6'));var logger=require(_0x3448('0x7'))('routing');var rpc={'openchannelQueueReport':require(_0x3448('0x8')),'mailQueueReport':require(_0x3448('0x9')),'chatQueueReport':require(_0x3448('0xa')),'smsQueueReport':require(_0x3448('0xb')),'faxQueueReport':require(_0x3448('0xc')),'whatsappQueueReport':require(_0x3448('0xd'))};var RuleEngine=require(_0x3448('0xe'));function getId(_0x34b926,_0x5923ee,_0x5c82c6){return util[_0x3448('0xf')](_0x3448('0x10'),_0x34b926,_0x5923ee||0x0,_0x5c82c6||0x0);}function getIntervals(_0xc36409,_0x6f82ca){var _0x3f4364=[];if(!_[_0x3448('0x11')](_0x6f82ca[_0x3448('0x12')])&&!_[_0x3448('0x11')](_0xc36409[_0x6f82ca[_0x3448('0x12')]])&&!_[_0x3448('0x11')](_0xc36409[_0x6f82ca[_0x3448('0x12')]]['Intervals'])){_0x3f4364=_['map'](_0xc36409[_0x6f82ca[_0x3448('0x12')]][_0x3448('0x13')],'interval');}else if(!_[_0x3448('0x11')](_0x6f82ca[_0x3448('0x14')])){_0x3f4364=[_0x6f82ca[_0x3448('0x14')]];}return _0x3f4364;}exports['listen']=function(_0x14104c){_0x14104c[_0x3448('0x15')]={};return new BPromise(function(_0x4daf3e,_0x2387a3){var _0x2c2da6={'Start':function(_0x46784f){var _0x4fc70f=this;return new Promise(function(_0x472518,_0x28f5b9){if(_0x46784f){try{var _0x13610a=[];var _0x30f8dd=getId(_0x46784f[_0x3448('0x16')],_0x46784f[_0x3448('0x17')]?_0x46784f[_0x3448('0x17')]['id']:0x0,_0x46784f[_0x3448('0x18')]?_0x46784f['interaction']['id']:0x0);if(_0x46784f[_0x3448('0x19')]&&_['isArray'](_0x46784f['applications'])&&_0x46784f['applications'][_0x3448('0x1a')]){for(var _0x278736=0x0;_0x278736<_0x46784f[_0x3448('0x19')]['length'];_0x278736+=0x1){var _0x3df082=_0x46784f[_0x3448('0x19')][_0x278736];if(fs[_0x3448('0x1b')](path[_0x3448('0x1c')](__dirname,_0x3448('0x19'),_0x3df082[_0x3448('0x1d')]+'.js'))){var _0x54c7ee=[];switch(_0x3df082['app'][_0x3448('0x1e')]()){case _0x3448('0x1f'):var _0x4b3d74=_0x3df082['appdata'][_0x3448('0x20')](',');if(_0x46784f[_0x3448('0x16')]===_0x3448('0x21')){_0x54c7ee[_0x3448('0x22')](_0x4b3d74[0x0]);_0x54c7ee[_0x3448('0x22')](_0x4b3d74[0x1]);_0x54c7ee['push'](_0x4b3d74[_0x3448('0x23')](0x2,_0x4b3d74[_0x3448('0x1a')])[_0x3448('0x1c')](','));}else{_0x54c7ee[_0x3448('0x22')](_0x4b3d74[0x0]);_0x54c7ee[_0x3448('0x22')](_0x4b3d74['slice'](0x1,_0x4b3d74[_0x3448('0x1a')])[_0x3448('0x1c')](','));}break;case'dialogflow':var _0x19a479=_0x3df082[_0x3448('0x24')][_0x3448('0x20')](',');_0x54c7ee[_0x3448('0x22')](_0x19a479[0x0]);_0x54c7ee[_0x3448('0x22')](_0x19a479[0x1]);_0x54c7ee[_0x3448('0x22')](_0x19a479[_0x3448('0x23')](0x2,_0x19a479[_0x3448('0x1a')])['join'](','));break;case _0x3448('0x25'):var _0x450704=_0x3df082[_0x3448('0x24')]['split'](',');_0x54c7ee[_0x3448('0x22')](_0x450704[0x0]);_0x54c7ee['push'](_0x450704[0x1]);_0x54c7ee['push'](_0x450704[0x2]);_0x54c7ee['push'](_0x450704[0x3]);_0x54c7ee[_0x3448('0x22')](_0x450704[_0x3448('0x23')](0x4,_0x450704['length'])['join'](','));break;case _0x3448('0x26'):var _0x37ceac=_0x3df082[_0x3448('0x24')][_0x3448('0x20')](',');_0x54c7ee['push'](_0x37ceac[0x0]);_0x54c7ee[_0x3448('0x22')](_0x37ceac[0x1]);_0x54c7ee[_0x3448('0x22')](_0x37ceac[0x2]);_0x54c7ee[_0x3448('0x22')](_0x37ceac[0x3]);_0x54c7ee['push'](_0x37ceac[_0x3448('0x23')](0x4,_0x37ceac[_0x3448('0x1a')])['join'](','));break;case'message':_0x54c7ee[_0x3448('0x22')](_0x3df082[_0x3448('0x24')]);break;case _0x3448('0x27'):_0x54c7ee[_0x3448('0x22')](_0x3df082['TagId']);_0x54c7ee[_0x3448('0x22')](_0x3df082[_0x3448('0x24')]);break;case _0x3448('0x28'):var _0x30b6b0=utils['getMustacheRender'](_0x46784f[_0x3448('0x29')][_0x3448('0x2a')],_0x46784f);var _0x5ea47c=_0x3df082[_0x3448('0x24')][_0x3448('0x20')](',');_0x54c7ee[_0x3448('0x22')](_0x5ea47c[0x0]);_0x54c7ee[_0x3448('0x22')](_0x5ea47c[0x1]);_0x54c7ee[_0x3448('0x22')](_0x5ea47c[0x2]);_0x54c7ee[_0x3448('0x22')](_0x5ea47c[0x3]);_0x54c7ee[_0x3448('0x22')](_0x5ea47c[0x4]);_0x54c7ee[_0x3448('0x22')](_0x5ea47c[0x5]);_0x54c7ee[_0x3448('0x22')](_0x5ea47c[0x6]);_0x54c7ee['push'](_0x5ea47c[0x7]);_0x54c7ee['push'](_0x5ea47c[0x8]);_0x54c7ee[_0x3448('0x22')](_0x5ea47c[0x9]);_0x54c7ee['push'](_0x5ea47c[0xa]);_0x54c7ee[_0x3448('0x22')](_0x46784f[_0x3448('0x18')]['id']);_0x54c7ee[_0x3448('0x22')](_0x46784f[_0x3448('0x17')]['id']);_0x54c7ee['push'](_0x3df082[_0x3448('0x2b')]);_0x54c7ee[_0x3448('0x22')](_0x46784f[_0x3448('0x18')][_0x3448('0x2c')]);_0x54c7ee[_0x3448('0x22')](_0x46784f[_0x3448('0x2d')][_0x3448('0x2d')]);_0x54c7ee[_0x3448('0x22')](_0x30b6b0);break;default:_0x54c7ee=_[_0x3448('0x11')](_0x3df082['appdata'])?[]:_0x3df082[_0x3448('0x24')][_0x3448('0x20')](',');}var _0x322b46={'id':util[_0x3448('0xf')](_0x3448('0x2e'),_0x30f8dd,_0x3df082['id'],_0x3df082['app']),'condition':require(_0x3448('0x2f'))[_0x3448('0x30')](_0x30f8dd,getIntervals(_0x14104c[_0x3448('0x31')],_0x3df082),_0x14104c),'consequence':require(_0x3448('0x32')+_0x3df082[_0x3448('0x1d')])[_0x3448('0x33')](_0x30f8dd,_0x54c7ee,_0x14104c,_0x46784f),'p':_0x3df082[_0x3448('0x34')]||0x0};logger[_0x3448('0x35')]('Push\x20new\x20rule',_0x322b46['id'],_0x3448('0x36'),getIntervals(_0x14104c[_0x3448('0x31')],_0x3df082)[_0x3448('0x1c')]('\x20|\x20'));_0x13610a[_0x3448('0x22')](_0x322b46);}else{logger[_0x3448('0x37')](_0x3448('0x38'),path[_0x3448('0x1c')](__dirname,_0x3448('0x19'),_0x3df082[_0x3448('0x1d')]+_0x3448('0x39')));}}_0x14104c['rules'][_0x30f8dd]=new RuleEngine(_0x13610a);_0x14104c[_0x3448('0x15')][_0x30f8dd][_0x3448('0x3a')](_0x46784f,function(_0x1e7fb7){logger[_0x3448('0x35')](_0x3448('0x3b'),JSON[_0x3448('0x3c')](_0x1e7fb7['matchPath']));if(_0x14104c[_0x3448('0x15')][_0x30f8dd]){_0x14104c['rules'][_0x30f8dd]['emit'](_0x3448('0x3d'));}});return _0x472518({'code':0xc8,'message':_0x46784f});}else{logger[_0x3448('0x35')]('No\x20applications\x20to\x20execute');return _0x472518({'code':0xc8,'message':_0x46784f});}}catch(_0x3a700f){logger[_0x3448('0x37')](_0x3a700f['stack']);return _0x28f5b9(_0x4fc70f[_0x3448('0x37')](0x1f4,_0x3a700f));}}return _0x28f5b9(_0x3448('0x3e'));});},'AcceptMessage':function(_0x5d4263){var _0x35f875=this;return new Promise(function(_0x1186c9,_0x1fcd85){if(_0x5d4263[_0x3448('0x3f')]&&_0x5d4263[_0x3448('0x3f')]['id']){if(_0x14104c[_0x3448('0x40')][_0x5d4263[_0x3448('0x3f')]['id']]){_0x14104c['agents'][_0x5d4263['agent']['id']][_0x3448('0x41')]=![];_0x14104c[_0x3448('0x40')][_0x5d4263[_0x3448('0x3f')]['id']][_0x3448('0x42')]=undefined;}}if(_0x5d4263['message']&&_0x5d4263[_0x3448('0x17')]['id']){try{var _0x198e30=getId(_0x5d4263[_0x3448('0x16')],_0x5d4263[_0x3448('0x17')]?_0x5d4263[_0x3448('0x17')]['id']:0x0,_0x5d4263['interaction']?_0x5d4263[_0x3448('0x18')]['id']:0x0);if(_0x14104c['rules'][_0x198e30]){_0x14104c[_0x3448('0x15')][_0x198e30][_0x3448('0x43')]('end');if(rpc[_0x5d4263[_0x3448('0x16')]+_0x3448('0x44')]){rpc[_0x5d4263[_0x3448('0x16')]+_0x3448('0x44')][_0x3448('0x45')](_0x198e30,{'UserId':_0x5d4263[_0x3448('0x17')][_0x3448('0x46')]})['catch'](function(_0x23dbda){logger[_0x3448('0x37')]('error\x20update\x20queue\x20report');});}}return _0x1186c9({'code':0xc8,'message':_0x5d4263});}catch(_0x5a81dd){logger[_0x3448('0x37')](_0x5a81dd[_0x3448('0x47')]);return _0x1fcd85(_0x35f875['error'](0x1f4,_0x5a81dd));}}logger['error'](_0x3448('0x48'));return _0x1fcd85(_0x35f875[_0x3448('0x37')](0x1f4,_0x3448('0x48')));});},'RejectMessage':function(_0x430e74){var _0x176e60=this;return new Promise(function(_0x39db50,_0x2aea70){if(_0x430e74['agent']&&_0x430e74['agent']['id']){try{if(_0x14104c['agents'][_0x430e74[_0x3448('0x3f')]['id']]){_0x14104c[_0x3448('0x40')][_0x430e74['agent']['id']][_0x3448('0x41')]=![];_0x14104c[_0x3448('0x40')][_0x430e74['agent']['id']][_0x3448('0x42')]=undefined;}return _0x39db50({'code':0xc8,'message':_0x430e74});}catch(_0x93669){logger['error'](_0x93669[_0x3448('0x47')]);return _0x2aea70(_0x176e60[_0x3448('0x37')](0x1f4,_0x93669));}}logger[_0x3448('0x37')](_0x3448('0x48'));return _0x2aea70(_0x176e60[_0x3448('0x37')](0x1f4,_0x3448('0x48')));});},'AbandonInteraction':function(_0xeda861){var _0x1b7d87=this;return new Promise(function(_0x4520a1,_0x4926aa){if(_0xeda861[_0x3448('0x16')]&&_0xeda861['interaction']&&_0xeda861[_0x3448('0x18')]['id']){try{var _0x108b99=getId(_0xeda861[_0x3448('0x16')],_0xeda861[_0x3448('0x17')]?_0xeda861[_0x3448('0x17')]['id']:0x0,_0xeda861[_0x3448('0x18')]?_0xeda861['interaction']['id']:0x0);if(_0x14104c[_0x3448('0x15')][_0x108b99]){_0x14104c['rules'][_0x108b99][_0x3448('0x43')](_0x3448('0x49'));}return _0x4520a1({'code':0xc8,'message':_0xeda861});}catch(_0x3bf4d2){logger[_0x3448('0x37')](_0x3bf4d2[_0x3448('0x47')]);return _0x4926aa(_0x1b7d87['error'](0x1f4,_0x3bf4d2));}}logger['error'](_0x3448('0x48'));return _0x4926aa(_0x1b7d87[_0x3448('0x37')](0x1f4,_0x3448('0x48')));});},'AgentCapacity':function(_0x5a51bb){var _0x7c00fe=this;return new Promise(function(_0x3eb57b,_0x1e4fb9){if(_0x14104c[_0x3448('0x40')][_0x3448('0x4a')](_0x5a51bb['id'])){for(var _0x28205e in _0x5a51bb[_0x3448('0x4b')]){if(_0x5a51bb[_0x3448('0x4b')][_0x3448('0x4a')](_0x28205e)){if(_0x14104c[_0x3448('0x40')][_0x5a51bb['id']][_0x3448('0x4a')](_0x28205e+_0x3448('0x4c'))){_0x14104c[_0x3448('0x40')][_0x5a51bb['id']][_0x28205e+_0x3448('0x4c')]=parseInt(_0x5a51bb[_0x3448('0x4b')][_0x28205e],0xa);}}}_0x14104c[_0x3448('0x40')][_0x5a51bb['id']][_0x3448('0x4d')]();return _0x3eb57b({'code':0xc8,'message':_0x14104c[_0x3448('0x40')][_0x5a51bb['id']]});}else{return _0x1e4fb9(_0x7c00fe['error'](0x1f4,_0x3448('0x4e')));}});},'Agents':function(_0x4864d1){return new Promise(function(_0x29a8fb,_0x4f10dc){var _0x1f1e3c=_[_0x3448('0x4f')](_0x14104c['agents']);_0x29a8fb({'count':_0x1f1e3c[_0x3448('0x1a')],'rows':_0x1f1e3c});});},'ChatQueues':function(_0x2f6517){return new Promise(function(_0x54cddd,_0x4f6902){var _0x599350=[];for(var _0x4864ae in _0x14104c['chatQueues']){if(_0x14104c[_0x3448('0x50')][_0x3448('0x4a')](_0x4864ae)){var _0x5be195=_0x14104c['chatQueues'][_0x4864ae];var _0x1385b9={'id':_0x5be195['id'],'available':_0x5be195[_0x3448('0x51')],'loggedIn':_0x5be195[_0x3448('0x52')],'name':_0x5be195[_0x3448('0x53')],'paused':_0x5be195[_0x3448('0x54')],'waiting':_0x5be195[_0x3448('0x55')]};_0x599350[_0x3448('0x22')](_0x1385b9);}}_0x54cddd({'count':_0x599350[_0x3448('0x1a')],'rows':_0x599350});});},'MailQueues':function(_0x2cf3ef){return new Promise(function(_0x347412,_0x143b28){var _0x4369bd=[];for(var _0x41f84c in _0x14104c[_0x3448('0x56')]){if(_0x14104c['mailQueues'][_0x3448('0x4a')](_0x41f84c)){var _0x2dcf50=_0x14104c['mailQueues'][_0x41f84c];var _0x407b6a={'id':_0x2dcf50['id'],'available':_0x2dcf50[_0x3448('0x51')],'loggedIn':_0x2dcf50['loggedIn'],'name':_0x2dcf50[_0x3448('0x53')],'paused':_0x2dcf50[_0x3448('0x54')],'waiting':_0x2dcf50[_0x3448('0x55')]};_0x4369bd['push'](_0x407b6a);}}_0x347412({'count':_0x4369bd['length'],'rows':_0x4369bd});});},'OpenchannelQueues':function(_0x41d459){return new Promise(function(_0x489b70,_0x31dfc5){var _0x42c146=[];for(var _0x5d952a in _0x14104c['openchannelQueues']){if(_0x14104c[_0x3448('0x57')][_0x3448('0x4a')](_0x5d952a)){var _0x6ca224=_0x14104c['openchannelQueues'][_0x5d952a];var _0x4b8b33={'id':_0x6ca224['id'],'available':_0x6ca224[_0x3448('0x51')],'loggedIn':_0x6ca224[_0x3448('0x52')],'name':_0x6ca224[_0x3448('0x53')],'paused':_0x6ca224[_0x3448('0x54')],'waiting':_0x6ca224[_0x3448('0x55')]};_0x42c146[_0x3448('0x22')](_0x4b8b33);}}_0x489b70({'count':_0x42c146['length'],'rows':_0x42c146});});},'SmsQueues':function(_0x2ec688){return new Promise(function(_0x5dbbc5,_0x3f7a64){var _0x2cca2f=[];for(var _0x487174 in _0x14104c[_0x3448('0x58')]){if(_0x14104c[_0x3448('0x58')]['hasOwnProperty'](_0x487174)){var _0x4b793f=_0x14104c[_0x3448('0x58')][_0x487174];var _0x26ce48={'id':_0x4b793f['id'],'available':_0x4b793f[_0x3448('0x51')],'loggedIn':_0x4b793f[_0x3448('0x52')],'name':_0x4b793f[_0x3448('0x53')],'paused':_0x4b793f[_0x3448('0x54')],'waiting':_0x4b793f[_0x3448('0x55')]};_0x2cca2f[_0x3448('0x22')](_0x26ce48);}}_0x5dbbc5({'count':_0x2cca2f[_0x3448('0x1a')],'rows':_0x2cca2f});});},'FaxQueues':function(_0x3d7867){return new Promise(function(_0x36cfb4,_0xc0d8f1){var _0x46c693=[];for(var _0x11d62f in _0x14104c[_0x3448('0x59')]){if(_0x14104c[_0x3448('0x59')]['hasOwnProperty'](_0x11d62f)){var _0x4efd6c=_0x14104c[_0x3448('0x59')][_0x11d62f];var _0x4d2af5={'id':_0x4efd6c['id'],'available':_0x4efd6c[_0x3448('0x51')],'loggedIn':_0x4efd6c[_0x3448('0x52')],'name':_0x4efd6c['name'],'paused':_0x4efd6c[_0x3448('0x54')],'waiting':_0x4efd6c['waiting']};_0x46c693[_0x3448('0x22')](_0x4d2af5);}}_0x36cfb4({'count':_0x46c693[_0x3448('0x1a')],'rows':_0x46c693});});},'WhatsappQueues':function(_0x2dbd3c){return new Promise(function(_0x3a64cc,_0x349554){var _0x5f46a4=[];for(var _0xe21908 in _0x14104c[_0x3448('0x5a')]){if(_0x14104c[_0x3448('0x5a')]['hasOwnProperty'](_0xe21908)){var _0x2f1236=_0x14104c[_0x3448('0x5a')][_0xe21908];var _0x17c22b={'id':_0x2f1236['id'],'available':_0x2f1236['available'],'loggedIn':_0x2f1236[_0x3448('0x52')],'name':_0x2f1236['name'],'paused':_0x2f1236['paused'],'waiting':_0x2f1236[_0x3448('0x55')]};_0x5f46a4['push'](_0x17c22b);}}_0x3a64cc({'count':_0x5f46a4[_0x3448('0x1a')],'rows':_0x5f46a4});});},'ChatQueuesWaitingInteractions':function(_0x4ef3a5){return new Promise(function(_0x26a6db,_0x961895){var _0x4dcdae=_['values'](_0x14104c[_0x3448('0x5b')]);_0x26a6db({'count':_0x4dcdae[_0x3448('0x1a')],'rows':_0x4dcdae});});},'MailQueuesWaitingInteractions':function(_0x48fffc){return new Promise(function(_0x3cdb3c,_0x28ebdd){var _0x513a01=_[_0x3448('0x4f')](_0x14104c[_0x3448('0x5c')]);_0x3cdb3c({'count':_0x513a01[_0x3448('0x1a')],'rows':_0x513a01});});},'OpenchannelQueuesWaitingInteractions':function(_0xc92ddf){return new Promise(function(_0x577570,_0x37c395){var _0x5be142=_[_0x3448('0x4f')](_0x14104c['openchannelQueuesWaitingInteractions']);_0x577570({'count':_0x5be142[_0x3448('0x1a')],'rows':_0x5be142});});},'SmsQueuesWaitingInteractions':function(_0x20a047){return new Promise(function(_0x4117da,_0x4e0709){var _0x17ebc9=_[_0x3448('0x4f')](_0x14104c['smsQueuesWaitingInteractions']);_0x4117da({'count':_0x17ebc9[_0x3448('0x1a')],'rows':_0x17ebc9});});},'FaxQueuesWaitingInteractions':function(_0x51f6b0){return new Promise(function(_0x520950,_0x1022fa){var _0x5394b1=_[_0x3448('0x4f')](_0x14104c[_0x3448('0x5d')]);_0x520950({'count':_0x5394b1[_0x3448('0x1a')],'rows':_0x5394b1});});},'WhatsappQueuesWaitingInteractions':function(_0x59c822){return new Promise(function(_0x3b4de4,_0x716797){var _0x45f399=_[_0x3448('0x4f')](_0x14104c[_0x3448('0x5e')]);_0x3b4de4({'count':_0x45f399[_0x3448('0x1a')],'rows':_0x45f399});});}};var _0x203466=jayson[_0x3448('0x5f')](_0x2c2da6)[_0x3448('0x60')]();_0x203466['on'](_0x3448('0x37'),function(_0x7073d8){logger[_0x3448('0x37')](JSON[_0x3448('0x3c')](_0x7073d8));return _0x2387a3(_0x7073d8);});_0x203466['listen'](0x232c,'127.0.0.1',function(){console['log'](_0x3448('0x61'),0x232c);return _0x4daf3e('RPC\x20listening\x20on\x20port:'+0x232c);});});}; \ No newline at end of file +var _0x3140=['toLowerCase','autoreply','appdata','channel','mail','push','slice','split','amazonlex','TagId','tvox','getMustacheRender','notificationTemplate','ContactId','body','format','condition','intervals','./applications/','consequence','info','Push\x20new\x20rule','on\x20interval','\x20|\x20','Please\x20create\x20a\x20new\x20file\x20under','.js','execute','stringify','matchPath','emit','complete','No\x20applications\x20to\x20execute','stack','error','routing\x20is\x20empty','agent','agents','busy','busyQueue','end','QueueReport','update','UserId','catch','error\x20update\x20queue\x20report','message\x20is\x20empty','capacity','hasOwnProperty','CurrentCapacity','updateRealtime','agent\x20not\x20found','values','available','loggedIn','name','paused','waiting','mailQueues','openchannelQueues','smsQueues','faxQueues','whatsappQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','server','http','127.0.0.1','log','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','lodash','util','path','jayson/promise','./applications/utils','../../../config/environment','../../../config/logger','routing','../rpc/openchannelQueueReport','../rpc/mailQueueReport','../rpc/chatQueueReport','../rpc/smsQueueReport','../rpc/faxQueueReport','../rpc/whatsappQueueReport','../lib/rule-engine','isNil','IntervalId','Intervals','map','interval','listen','rules','message','interaction','applications','length','existsSync','join','app'];(function(_0x510595,_0x408467){var _0x36fdb8=function(_0x16483d){while(--_0x16483d){_0x510595['push'](_0x510595['shift']());}};_0x36fdb8(++_0x408467);}(_0x3140,0xaf));var _0x0314=function(_0x40dc7e,_0x322488){_0x40dc7e=_0x40dc7e-0x0;var _0x31f6d4=_0x3140[_0x40dc7e];return _0x31f6d4;};'use strict';var _=require(_0x0314('0x0'));var util=require(_0x0314('0x1'));var path=require(_0x0314('0x2'));var fs=require('fs');var jayson=require(_0x0314('0x3'));var BPromise=require('bluebird');var uuid=require('uuid');var utils=require(_0x0314('0x4'));var config=require(_0x0314('0x5'));var logger=require(_0x0314('0x6'))(_0x0314('0x7'));var rpc={'openchannelQueueReport':require(_0x0314('0x8')),'mailQueueReport':require(_0x0314('0x9')),'chatQueueReport':require(_0x0314('0xa')),'smsQueueReport':require(_0x0314('0xb')),'faxQueueReport':require(_0x0314('0xc')),'whatsappQueueReport':require(_0x0314('0xd'))};var RuleEngine=require(_0x0314('0xe'));function getId(_0x495b27,_0x26031f,_0x2d87d2){return util['format']('%s.%s.%s',_0x495b27,_0x26031f||0x0,_0x2d87d2||0x0);}function getIntervals(_0xf2561e,_0x4e6545){var _0x17bde3=[];if(!_[_0x0314('0xf')](_0x4e6545[_0x0314('0x10')])&&!_[_0x0314('0xf')](_0xf2561e[_0x4e6545[_0x0314('0x10')]])&&!_[_0x0314('0xf')](_0xf2561e[_0x4e6545['IntervalId']][_0x0314('0x11')])){_0x17bde3=_[_0x0314('0x12')](_0xf2561e[_0x4e6545[_0x0314('0x10')]][_0x0314('0x11')],_0x0314('0x13'));}else if(!_[_0x0314('0xf')](_0x4e6545[_0x0314('0x13')])){_0x17bde3=[_0x4e6545['interval']];}return _0x17bde3;}exports[_0x0314('0x14')]=function(_0xbe0b07){_0xbe0b07[_0x0314('0x15')]={};return new BPromise(function(_0x12d026,_0x40566e){var _0x398c91={'Start':function(_0x413bfa){var _0x3ea356=this;return new Promise(function(_0x5e460f,_0xb9730b){if(_0x413bfa){try{var _0x24cd42=[];var _0x1f23c6=getId(_0x413bfa['channel'],_0x413bfa[_0x0314('0x16')]?_0x413bfa['message']['id']:0x0,_0x413bfa['interaction']?_0x413bfa[_0x0314('0x17')]['id']:0x0);if(_0x413bfa[_0x0314('0x18')]&&_['isArray'](_0x413bfa[_0x0314('0x18')])&&_0x413bfa[_0x0314('0x18')]['length']){for(var _0x1a25cf=0x0;_0x1a25cf<_0x413bfa['applications'][_0x0314('0x19')];_0x1a25cf+=0x1){var _0x41f75e=_0x413bfa[_0x0314('0x18')][_0x1a25cf];if(fs[_0x0314('0x1a')](path[_0x0314('0x1b')](__dirname,_0x0314('0x18'),_0x41f75e['app']+'.js'))){var _0x20305b=[];switch(_0x41f75e[_0x0314('0x1c')][_0x0314('0x1d')]()){case _0x0314('0x1e'):var _0x3ec03d=_0x41f75e[_0x0314('0x1f')]['split'](',');if(_0x413bfa[_0x0314('0x20')]===_0x0314('0x21')){_0x20305b['push'](_0x3ec03d[0x0]);_0x20305b[_0x0314('0x22')](_0x3ec03d[0x1]);_0x20305b[_0x0314('0x22')](_0x3ec03d[_0x0314('0x23')](0x2,_0x3ec03d[_0x0314('0x19')])[_0x0314('0x1b')](','));}else{_0x20305b[_0x0314('0x22')](_0x3ec03d[0x0]);_0x20305b['push'](_0x3ec03d[_0x0314('0x23')](0x1,_0x3ec03d[_0x0314('0x19')])[_0x0314('0x1b')](','));}break;case'dialogflow':var _0x29b4b5=_0x41f75e[_0x0314('0x1f')]['split'](',');_0x20305b['push'](_0x29b4b5[0x0]);_0x20305b[_0x0314('0x22')](_0x29b4b5[0x1]);_0x20305b[_0x0314('0x22')](_0x29b4b5['slice'](0x2,_0x29b4b5[_0x0314('0x19')])[_0x0314('0x1b')](','));break;case'dialogflowv2':var _0x547ab3=_0x41f75e[_0x0314('0x1f')][_0x0314('0x24')](',');_0x20305b['push'](_0x547ab3[0x0]);_0x20305b[_0x0314('0x22')](_0x547ab3[0x1]);_0x20305b[_0x0314('0x22')](_0x547ab3[0x2]);_0x20305b[_0x0314('0x22')](_0x547ab3[0x3]);_0x20305b['push'](_0x547ab3[_0x0314('0x23')](0x4,_0x547ab3[_0x0314('0x19')])[_0x0314('0x1b')](','));break;case _0x0314('0x25'):var _0x549b0b=_0x41f75e[_0x0314('0x1f')]['split'](',');_0x20305b['push'](_0x549b0b[0x0]);_0x20305b[_0x0314('0x22')](_0x549b0b[0x1]);_0x20305b[_0x0314('0x22')](_0x549b0b[0x2]);_0x20305b[_0x0314('0x22')](_0x549b0b[0x3]);_0x20305b['push'](_0x549b0b[_0x0314('0x23')](0x4,_0x549b0b['length'])[_0x0314('0x1b')](','));break;case'message':_0x20305b['push'](_0x41f75e[_0x0314('0x1f')]);break;case'tag':_0x20305b[_0x0314('0x22')](_0x41f75e[_0x0314('0x26')]);_0x20305b[_0x0314('0x22')](_0x41f75e[_0x0314('0x1f')]);break;case _0x0314('0x27'):var _0x1a9ff7=utils[_0x0314('0x28')](_0x413bfa['account'][_0x0314('0x29')],_0x413bfa);var _0x28c6d0=_0x41f75e[_0x0314('0x1f')][_0x0314('0x24')](',');_0x20305b[_0x0314('0x22')](_0x28c6d0[0x0]);_0x20305b[_0x0314('0x22')](_0x28c6d0[0x1]);_0x20305b['push'](_0x28c6d0[0x2]);_0x20305b[_0x0314('0x22')](_0x28c6d0[0x3]);_0x20305b['push'](_0x28c6d0[0x4]);_0x20305b[_0x0314('0x22')](_0x28c6d0[0x5]);_0x20305b['push'](_0x28c6d0[0x6]);_0x20305b[_0x0314('0x22')](_0x28c6d0[0x7]);_0x20305b['push'](_0x28c6d0[0x8]);_0x20305b['push'](_0x28c6d0[0x9]);_0x20305b['push'](_0x28c6d0[0xa]);_0x20305b[_0x0314('0x22')](_0x413bfa[_0x0314('0x17')]['id']);_0x20305b[_0x0314('0x22')](_0x413bfa[_0x0314('0x16')]['id']);_0x20305b[_0x0314('0x22')](_0x41f75e['ChatWebsiteId']);_0x20305b[_0x0314('0x22')](_0x413bfa[_0x0314('0x17')][_0x0314('0x2a')]);_0x20305b['push'](_0x413bfa[_0x0314('0x2b')]['body']);_0x20305b[_0x0314('0x22')](_0x1a9ff7);break;default:_0x20305b=_['isNil'](_0x41f75e[_0x0314('0x1f')])?[]:_0x41f75e['appdata']['split'](',');}var _0x370539={'id':util[_0x0314('0x2c')]('%s:%s:%s',_0x1f23c6,_0x41f75e['id'],_0x41f75e[_0x0314('0x1c')]),'condition':require('./interval')[_0x0314('0x2d')](_0x1f23c6,getIntervals(_0xbe0b07[_0x0314('0x2e')],_0x41f75e),_0xbe0b07),'consequence':require(_0x0314('0x2f')+_0x41f75e[_0x0314('0x1c')])[_0x0314('0x30')](_0x1f23c6,_0x20305b,_0xbe0b07,_0x413bfa),'p':_0x41f75e['priority']||0x0};logger[_0x0314('0x31')](_0x0314('0x32'),_0x370539['id'],_0x0314('0x33'),getIntervals(_0xbe0b07['intervals'],_0x41f75e)[_0x0314('0x1b')](_0x0314('0x34')));_0x24cd42[_0x0314('0x22')](_0x370539);}else{logger['error'](_0x0314('0x35'),path['join'](__dirname,_0x0314('0x18'),_0x41f75e[_0x0314('0x1c')]+_0x0314('0x36')));}}_0xbe0b07['rules'][_0x1f23c6]=new RuleEngine(_0x24cd42);_0xbe0b07[_0x0314('0x15')][_0x1f23c6][_0x0314('0x37')](_0x413bfa,function(_0x588e65){logger['info']('Applications\x20executed',JSON[_0x0314('0x38')](_0x588e65[_0x0314('0x39')]));if(_0xbe0b07[_0x0314('0x15')][_0x1f23c6]){_0xbe0b07['rules'][_0x1f23c6][_0x0314('0x3a')](_0x0314('0x3b'));}});return _0x5e460f({'code':0xc8,'message':_0x413bfa});}else{logger[_0x0314('0x31')](_0x0314('0x3c'));return _0x5e460f({'code':0xc8,'message':_0x413bfa});}}catch(_0x3896cb){logger['error'](_0x3896cb[_0x0314('0x3d')]);return _0xb9730b(_0x3ea356[_0x0314('0x3e')](0x1f4,_0x3896cb));}}return _0xb9730b(_0x0314('0x3f'));});},'AcceptMessage':function(_0x192b74){var _0x1b7292=this;return new Promise(function(_0x209ea9,_0x186181){if(_0x192b74['agent']&&_0x192b74[_0x0314('0x40')]['id']){if(_0xbe0b07[_0x0314('0x41')][_0x192b74['agent']['id']]){_0xbe0b07[_0x0314('0x41')][_0x192b74[_0x0314('0x40')]['id']][_0x0314('0x42')]=![];_0xbe0b07['agents'][_0x192b74['agent']['id']][_0x0314('0x43')]=undefined;}}if(_0x192b74[_0x0314('0x16')]&&_0x192b74[_0x0314('0x16')]['id']){try{var _0x44c467=getId(_0x192b74[_0x0314('0x20')],_0x192b74[_0x0314('0x16')]?_0x192b74[_0x0314('0x16')]['id']:0x0,_0x192b74['interaction']?_0x192b74[_0x0314('0x17')]['id']:0x0);if(_0xbe0b07['rules'][_0x44c467]){_0xbe0b07[_0x0314('0x15')][_0x44c467][_0x0314('0x3a')](_0x0314('0x44'));if(rpc[_0x192b74[_0x0314('0x20')]+_0x0314('0x45')]){rpc[_0x192b74['channel']+'QueueReport'][_0x0314('0x46')](_0x44c467,{'UserId':_0x192b74[_0x0314('0x16')][_0x0314('0x47')]})[_0x0314('0x48')](function(_0x5b3c49){logger[_0x0314('0x3e')](_0x0314('0x49'));});}}return _0x209ea9({'code':0xc8,'message':_0x192b74});}catch(_0x2b601a){logger[_0x0314('0x3e')](_0x2b601a[_0x0314('0x3d')]);return _0x186181(_0x1b7292[_0x0314('0x3e')](0x1f4,_0x2b601a));}}logger[_0x0314('0x3e')]('message\x20is\x20empty');return _0x186181(_0x1b7292[_0x0314('0x3e')](0x1f4,_0x0314('0x4a')));});},'RejectMessage':function(_0x2fed7d){var _0x577a91=this;return new Promise(function(_0x123916,_0x11695d){if(_0x2fed7d['agent']&&_0x2fed7d[_0x0314('0x40')]['id']){try{if(_0xbe0b07[_0x0314('0x41')][_0x2fed7d[_0x0314('0x40')]['id']]){_0xbe0b07[_0x0314('0x41')][_0x2fed7d['agent']['id']][_0x0314('0x42')]=![];_0xbe0b07[_0x0314('0x41')][_0x2fed7d[_0x0314('0x40')]['id']][_0x0314('0x43')]=undefined;}return _0x123916({'code':0xc8,'message':_0x2fed7d});}catch(_0x227ee1){logger[_0x0314('0x3e')](_0x227ee1[_0x0314('0x3d')]);return _0x11695d(_0x577a91[_0x0314('0x3e')](0x1f4,_0x227ee1));}}logger[_0x0314('0x3e')](_0x0314('0x4a'));return _0x11695d(_0x577a91['error'](0x1f4,_0x0314('0x4a')));});},'AbandonInteraction':function(_0x305568){var _0xf29a33=this;return new Promise(function(_0x176b9f,_0x1da12b){if(_0x305568[_0x0314('0x20')]&&_0x305568[_0x0314('0x17')]&&_0x305568['interaction']['id']){try{var _0x5c4e26=getId(_0x305568['channel'],_0x305568[_0x0314('0x16')]?_0x305568[_0x0314('0x16')]['id']:0x0,_0x305568['interaction']?_0x305568[_0x0314('0x17')]['id']:0x0);if(_0xbe0b07[_0x0314('0x15')][_0x5c4e26]){_0xbe0b07[_0x0314('0x15')][_0x5c4e26]['emit']('end');}return _0x176b9f({'code':0xc8,'message':_0x305568});}catch(_0x2e29ce){logger[_0x0314('0x3e')](_0x2e29ce['stack']);return _0x1da12b(_0xf29a33[_0x0314('0x3e')](0x1f4,_0x2e29ce));}}logger['error'](_0x0314('0x4a'));return _0x1da12b(_0xf29a33[_0x0314('0x3e')](0x1f4,_0x0314('0x4a')));});},'AgentCapacity':function(_0x37764f){var _0x4c4420=this;return new Promise(function(_0x9c35f1,_0x3fc295){if(_0xbe0b07[_0x0314('0x41')]['hasOwnProperty'](_0x37764f['id'])){for(var _0x59ae7f in _0x37764f[_0x0314('0x4b')]){if(_0x37764f[_0x0314('0x4b')][_0x0314('0x4c')](_0x59ae7f)){if(_0xbe0b07[_0x0314('0x41')][_0x37764f['id']][_0x0314('0x4c')](_0x59ae7f+_0x0314('0x4d'))){_0xbe0b07['agents'][_0x37764f['id']][_0x59ae7f+_0x0314('0x4d')]=parseInt(_0x37764f['capacity'][_0x59ae7f],0xa);}}}_0xbe0b07['agents'][_0x37764f['id']][_0x0314('0x4e')]();return _0x9c35f1({'code':0xc8,'message':_0xbe0b07['agents'][_0x37764f['id']]});}else{return _0x3fc295(_0x4c4420[_0x0314('0x3e')](0x1f4,_0x0314('0x4f')));}});},'Agents':function(_0x26c174){return new Promise(function(_0x3b25cb,_0x2a7b05){var _0x308985=_[_0x0314('0x50')](_0xbe0b07[_0x0314('0x41')]);_0x3b25cb({'count':_0x308985['length'],'rows':_0x308985});});},'ChatQueues':function(_0x545bd8){return new Promise(function(_0x524fce,_0x277979){var _0xf480fe=[];for(var _0x582451 in _0xbe0b07['chatQueues']){if(_0xbe0b07['chatQueues'][_0x0314('0x4c')](_0x582451)){var _0x17dbb9=_0xbe0b07['chatQueues'][_0x582451];var _0x273dc6={'id':_0x17dbb9['id'],'available':_0x17dbb9[_0x0314('0x51')],'loggedIn':_0x17dbb9[_0x0314('0x52')],'name':_0x17dbb9[_0x0314('0x53')],'paused':_0x17dbb9[_0x0314('0x54')],'waiting':_0x17dbb9[_0x0314('0x55')]};_0xf480fe['push'](_0x273dc6);}}_0x524fce({'count':_0xf480fe[_0x0314('0x19')],'rows':_0xf480fe});});},'MailQueues':function(_0x274845){return new Promise(function(_0x15b523,_0x5a69ac){var _0x1adb61=[];for(var _0x23b551 in _0xbe0b07[_0x0314('0x56')]){if(_0xbe0b07['mailQueues'][_0x0314('0x4c')](_0x23b551)){var _0x1aabca=_0xbe0b07['mailQueues'][_0x23b551];var _0x3cada6={'id':_0x1aabca['id'],'available':_0x1aabca[_0x0314('0x51')],'loggedIn':_0x1aabca[_0x0314('0x52')],'name':_0x1aabca[_0x0314('0x53')],'paused':_0x1aabca[_0x0314('0x54')],'waiting':_0x1aabca['waiting']};_0x1adb61[_0x0314('0x22')](_0x3cada6);}}_0x15b523({'count':_0x1adb61[_0x0314('0x19')],'rows':_0x1adb61});});},'OpenchannelQueues':function(_0x47a93f){return new Promise(function(_0x58f666,_0x186dde){var _0x381a5d=[];for(var _0x30726f in _0xbe0b07[_0x0314('0x57')]){if(_0xbe0b07[_0x0314('0x57')][_0x0314('0x4c')](_0x30726f)){var _0x2c96e1=_0xbe0b07['openchannelQueues'][_0x30726f];var _0x76f0b9={'id':_0x2c96e1['id'],'available':_0x2c96e1[_0x0314('0x51')],'loggedIn':_0x2c96e1[_0x0314('0x52')],'name':_0x2c96e1[_0x0314('0x53')],'paused':_0x2c96e1['paused'],'waiting':_0x2c96e1[_0x0314('0x55')]};_0x381a5d[_0x0314('0x22')](_0x76f0b9);}}_0x58f666({'count':_0x381a5d['length'],'rows':_0x381a5d});});},'SmsQueues':function(_0xf38fa4){return new Promise(function(_0x24a6a5,_0x557eb2){var _0x50f6fa=[];for(var _0x138bf9 in _0xbe0b07[_0x0314('0x58')]){if(_0xbe0b07[_0x0314('0x58')]['hasOwnProperty'](_0x138bf9)){var _0x5f0d0d=_0xbe0b07[_0x0314('0x58')][_0x138bf9];var _0xdb6ce7={'id':_0x5f0d0d['id'],'available':_0x5f0d0d[_0x0314('0x51')],'loggedIn':_0x5f0d0d[_0x0314('0x52')],'name':_0x5f0d0d[_0x0314('0x53')],'paused':_0x5f0d0d['paused'],'waiting':_0x5f0d0d[_0x0314('0x55')]};_0x50f6fa[_0x0314('0x22')](_0xdb6ce7);}}_0x24a6a5({'count':_0x50f6fa[_0x0314('0x19')],'rows':_0x50f6fa});});},'FaxQueues':function(_0x403d3f){return new Promise(function(_0x197653,_0x2f08db){var _0x144929=[];for(var _0x68ac7f in _0xbe0b07[_0x0314('0x59')]){if(_0xbe0b07['faxQueues'][_0x0314('0x4c')](_0x68ac7f)){var _0x1f1464=_0xbe0b07[_0x0314('0x59')][_0x68ac7f];var _0x453bf7={'id':_0x1f1464['id'],'available':_0x1f1464[_0x0314('0x51')],'loggedIn':_0x1f1464[_0x0314('0x52')],'name':_0x1f1464[_0x0314('0x53')],'paused':_0x1f1464[_0x0314('0x54')],'waiting':_0x1f1464[_0x0314('0x55')]};_0x144929[_0x0314('0x22')](_0x453bf7);}}_0x197653({'count':_0x144929[_0x0314('0x19')],'rows':_0x144929});});},'WhatsappQueues':function(_0x55a6f2){return new Promise(function(_0x2238e8,_0x2b1493){var _0x4b50f6=[];for(var _0x53aa21 in _0xbe0b07[_0x0314('0x5a')]){if(_0xbe0b07[_0x0314('0x5a')][_0x0314('0x4c')](_0x53aa21)){var _0x2ff22c=_0xbe0b07[_0x0314('0x5a')][_0x53aa21];var _0x987585={'id':_0x2ff22c['id'],'available':_0x2ff22c[_0x0314('0x51')],'loggedIn':_0x2ff22c[_0x0314('0x52')],'name':_0x2ff22c[_0x0314('0x53')],'paused':_0x2ff22c[_0x0314('0x54')],'waiting':_0x2ff22c[_0x0314('0x55')]};_0x4b50f6['push'](_0x987585);}}_0x2238e8({'count':_0x4b50f6[_0x0314('0x19')],'rows':_0x4b50f6});});},'ChatQueuesWaitingInteractions':function(_0x17e2bd){return new Promise(function(_0x44ff6f,_0x110212){var _0x2da3db=_['values'](_0xbe0b07[_0x0314('0x5b')]);_0x44ff6f({'count':_0x2da3db['length'],'rows':_0x2da3db});});},'MailQueuesWaitingInteractions':function(_0x3b2b6a){return new Promise(function(_0x59d100,_0x4ddec0){var _0x40074f=_['values'](_0xbe0b07[_0x0314('0x5c')]);_0x59d100({'count':_0x40074f[_0x0314('0x19')],'rows':_0x40074f});});},'OpenchannelQueuesWaitingInteractions':function(_0x6ece9a){return new Promise(function(_0x12789d,_0x4fca70){var _0x1bb95f=_[_0x0314('0x50')](_0xbe0b07['openchannelQueuesWaitingInteractions']);_0x12789d({'count':_0x1bb95f[_0x0314('0x19')],'rows':_0x1bb95f});});},'SmsQueuesWaitingInteractions':function(_0x5acfa3){return new Promise(function(_0x3688c7,_0x410bd6){var _0x230cd6=_[_0x0314('0x50')](_0xbe0b07[_0x0314('0x5d')]);_0x3688c7({'count':_0x230cd6[_0x0314('0x19')],'rows':_0x230cd6});});},'FaxQueuesWaitingInteractions':function(_0x4c3bb4){return new Promise(function(_0x2bd970,_0x4561ed){var _0x2c87d5=_[_0x0314('0x50')](_0xbe0b07[_0x0314('0x5e')]);_0x2bd970({'count':_0x2c87d5[_0x0314('0x19')],'rows':_0x2c87d5});});},'WhatsappQueuesWaitingInteractions':function(_0x3d0b71){return new Promise(function(_0x3f7f87,_0x259faa){var _0x5cd3bb=_[_0x0314('0x50')](_0xbe0b07[_0x0314('0x5f')]);_0x3f7f87({'count':_0x5cd3bb[_0x0314('0x19')],'rows':_0x5cd3bb});});}};var _0x182909=jayson[_0x0314('0x60')](_0x398c91)[_0x0314('0x61')]();_0x182909['on']('error',function(_0x353a37){logger['error'](JSON[_0x0314('0x38')](_0x353a37));return _0x40566e(_0x353a37);});_0x182909[_0x0314('0x14')](0x232c,_0x0314('0x62'),function(){console[_0x0314('0x63')](_0x0314('0x64'),0x232c);return _0x12d026(_0x0314('0x65')+0x232c);});});}; \ No newline at end of file diff --git a/server/services/routing/server/interval.js b/server/services/routing/server/interval.js index 6d3d51e..08dec35 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 _0x0103=['then','error','result','condition','rules','info','[%s][INTERVAL]\x20ROUTING\x20STOPPED','stop','length','push','Command','iftime\x20%s','message','indexOf','true','catch','[%s][INTERVAL]\x20%s','all','some','[%s][INTERVAL]\x20%s\x20%s','join','\x20|\x20','when','log','stack','util','bluebird','../../../config/logger','client','http','request'];(function(_0x5c9b96,_0x1c6293){var _0x149fb7=function(_0x4beb56){while(--_0x4beb56){_0x5c9b96['push'](_0x5c9b96['shift']());}};_0x149fb7(++_0x1c6293);}(_0x0103,0x1ea));var _0x3010=function(_0x18032f,_0x4f4e45){_0x18032f=_0x18032f-0x0;var _0xb0b2b8=_0x0103[_0x18032f];return _0xb0b2b8;};'use strict';var util=require(_0x3010('0x0'));var BPromise=require(_0x3010('0x1'));var jayson=require('jayson/promise');var _=require('lodash');var logger=require(_0x3010('0x2'))('routing');var client=jayson[_0x3010('0x3')][_0x3010('0x4')]({'port':0x232a});function request(_0x4114b3,_0x1e2ca1){return new BPromise(function(_0xe7e5ea,_0x21c5c6){return client[_0x3010('0x5')](_0x4114b3,_0x1e2ca1)[_0x3010('0x6')](function(_0x15fac7){if(_0x15fac7[_0x3010('0x7')]){return _0x21c5c6(_0x15fac7[_0x3010('0x7')]['message']);}else{return _0xe7e5ea(_0x15fac7[_0x3010('0x8')]);}})['catch'](function(_0x54bc0f){return _0x21c5c6(_0x54bc0f);});});}exports[_0x3010('0x9')]=function(_0x30e8a1,_0x456ec8,_0x559fba){return function(_0x5b8269){if(_0x559fba[_0x3010('0xa')]&&!_0x559fba[_0x3010('0xa')][_0x30e8a1]){logger[_0x3010('0xb')](_0x3010('0xc'),_0x30e8a1);return _0x5b8269[_0x3010('0xd')]();}var _0x1d9d2d=[];for(var _0x2218ce=0x0;_0x2218ce<_0x456ec8[_0x3010('0xe')];_0x2218ce+=0x1){_0x1d9d2d[_0x3010('0xf')](request(_0x3010('0x10'),{'command':util['format'](_0x3010('0x11'),_0x456ec8[_0x2218ce])})[_0x3010('0x6')](function(_0x5c9eee){return _0x5c9eee&&_0x5c9eee[_0x3010('0x12')]&&_0x5c9eee['message'][_0x3010('0x13')](_0x3010('0x14'))>=0x0?!![]:![];})[_0x3010('0x15')](function(_0x30aca4){logger[_0x3010('0x7')](_0x3010('0x16'),_0x30e8a1,_0x456ec8[_0x2218ce]);}));}BPromise[_0x3010('0x17')](_0x1d9d2d)[_0x3010('0x6')](function(_0x4f9aa9){var _0xa9f709=_[_0x3010('0x18')](_0x4f9aa9);logger[_0x3010('0xb')](_0x3010('0x19'),_0x30e8a1,_0x456ec8[_0x3010('0x1a')](_0x3010('0x1b')),_0xa9f709);_0x5b8269[_0x3010('0x1c')](_0xa9f709);})['catch'](function(_0x265b8f){console[_0x3010('0x1d')](_0x265b8f);logger[_0x3010('0x7')]('[%s][INTERVAL]\x20%s\x20%s',_0x30e8a1,_0x456ec8[_0x3010('0x1a')](_0x3010('0x1b')),_0x265b8f[_0x3010('0x1e')]);_0x5b8269[_0x3010('0xd')]();});};}; \ No newline at end of file +var _0x982f=['info','[%s][INTERVAL]\x20ROUTING\x20STOPPED','stop','length','push','iftime\x20%s','message','indexOf','true','[%s][INTERVAL]\x20%s','all','some','[%s][INTERVAL]\x20%s\x20%s','\x20|\x20','log','join','stack','util','bluebird','jayson/promise','lodash','../../../config/logger','client','http','request','then','error','catch','condition','rules'];(function(_0x25662e,_0x4cec68){var _0x59b7bc=function(_0xafb159){while(--_0xafb159){_0x25662e['push'](_0x25662e['shift']());}};_0x59b7bc(++_0x4cec68);}(_0x982f,0x1f1));var _0xf982=function(_0x363a85,_0x31e8b9){_0x363a85=_0x363a85-0x0;var _0x2a0904=_0x982f[_0x363a85];return _0x2a0904;};'use strict';var util=require(_0xf982('0x0'));var BPromise=require(_0xf982('0x1'));var jayson=require(_0xf982('0x2'));var _=require(_0xf982('0x3'));var logger=require(_0xf982('0x4'))('routing');var client=jayson[_0xf982('0x5')][_0xf982('0x6')]({'port':0x232a});function request(_0x544194,_0x41aea8){return new BPromise(function(_0x46f38b,_0x3558d1){return client[_0xf982('0x7')](_0x544194,_0x41aea8)[_0xf982('0x8')](function(_0x3af4b4){if(_0x3af4b4[_0xf982('0x9')]){return _0x3558d1(_0x3af4b4['error']['message']);}else{return _0x46f38b(_0x3af4b4['result']);}})[_0xf982('0xa')](function(_0x239275){return _0x3558d1(_0x239275);});});}exports[_0xf982('0xb')]=function(_0x1ed01a,_0x65ed6c,_0x5099a1){return function(_0x2e9d3d){if(_0x5099a1[_0xf982('0xc')]&&!_0x5099a1['rules'][_0x1ed01a]){logger[_0xf982('0xd')](_0xf982('0xe'),_0x1ed01a);return _0x2e9d3d[_0xf982('0xf')]();}var _0x1ccd06=[];for(var _0x416d61=0x0;_0x416d61<_0x65ed6c[_0xf982('0x10')];_0x416d61+=0x1){_0x1ccd06[_0xf982('0x11')](request('Command',{'command':util['format'](_0xf982('0x12'),_0x65ed6c[_0x416d61])})[_0xf982('0x8')](function(_0x3c54d5){return _0x3c54d5&&_0x3c54d5[_0xf982('0x13')]&&_0x3c54d5[_0xf982('0x13')][_0xf982('0x14')](_0xf982('0x15'))>=0x0?!![]:![];})['catch'](function(_0x97aee7){logger[_0xf982('0x9')](_0xf982('0x16'),_0x1ed01a,_0x65ed6c[_0x416d61]);}));}BPromise[_0xf982('0x17')](_0x1ccd06)['then'](function(_0x169360){var _0x209f30=_[_0xf982('0x18')](_0x169360);logger[_0xf982('0xd')](_0xf982('0x19'),_0x1ed01a,_0x65ed6c['join'](_0xf982('0x1a')),_0x209f30);_0x2e9d3d['when'](_0x209f30);})[_0xf982('0xa')](function(_0xc27c44){console[_0xf982('0x1b')](_0xc27c44);logger[_0xf982('0x9')](_0xf982('0x19'),_0x1ed01a,_0x65ed6c[_0xf982('0x1c')](_0xf982('0x1a')),_0xc27c44[_0xf982('0x1d')]);_0x2e9d3d[_0xf982('0xf')]();});};}; \ No newline at end of file diff --git a/server/services/xdr/agents.controller.js b/server/services/xdr/agents.controller.js index 250fcab..8e1ba47 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 _0xc900=['rejected','indexOf','splice','agent','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','./utils','format','[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','channel','queue','membername','interface','calleridnum','connectedlinenum','getVoiceQueueByName','then','type','agentacw','agentcomplete','acw','acwtime','acwTimeout','CreateVoiceAgentReport','destuniqueid','agentcalled','debug','uniqueid','agentcalledAt','now','connectedlinename','info','[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','[%s][agents][agentcalled]','agentringnoanswer','isNil','[%s][agents][agentringnoanswer]','[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout','lastevent','timeout','holdtime','ringtime','push','error','queuecallerabandon','forIn','includes','[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','reason','abandoned','talktime','agentconnect','[%s][agents][agentconnect]','[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','connect','agentringnoanswerAt','answered_elsewhere','answeredelsewheredestinationuniqueid','answeredelsewheremembername','[%s][agents][agentcomplete]','[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcompleteAt','diffTime','agentconnectAt','complete','blindtransfer','[%s][agents][blindtransfer]','transfereruniqueid','transfer','transfertype','blind','transferexten','extension','attendedtransfer','origtransfereruniqueid','origtransfererlinkedid','secondtransfereruniqueid','[%s][agents][attendedtransfer]\x20agent:%s','transfereeuniqueid','agententerreason','clone','ATTENDED','secondtransfererexten','transfertargetuniqueid','calleridname','[%s][agents][attendedtransfer]','[%s][agents][hangup]','cause'];(function(_0x4087c8,_0x5f0e4e){var _0x312c03=function(_0x5085e1){while(--_0x5085e1){_0x4087c8['push'](_0x4087c8['shift']());}};_0x312c03(++_0x5f0e4e);}(_0xc900,0xb3));var _0x0c90=function(_0xe95156,_0x5e05aa){_0xe95156=_0xe95156-0x0;var _0x92004e=_0xc900[_0xe95156];return _0x92004e;};'use strict';var _=require('lodash');var util=require('util');var utils=require(_0x0c90('0x0'));var agents={};var transfers={};var unanswered=[];function writeDB(_0x546406,_0x435691){utils['info'](util[_0x0c90('0x1')](_0x0c90('0x2'),_0x546406['uniqueid'],_0x546406[_0x0c90('0x3')],_0x546406[_0x0c90('0x4')],_0x546406[_0x0c90('0x5')],_0x546406[_0x0c90('0x6')],_0x546406[_0x0c90('0x7')],_0x546406[_0x0c90('0x8')],_0x546406['lastevent']));if(_0x546406[_0x0c90('0x4')]){utils[_0x0c90('0x9')](_0x546406[_0x0c90('0x4')])[_0x0c90('0xa')](function(_0x128656){if(_0x128656){_0x546406[_0x0c90('0xb')]=_0x128656[_0x0c90('0xb')];_0x546406[_0x0c90('0xc')]=_0x546406[_0x0c90('0xd')]?_0x128656[_0x0c90('0xe')]:![];_0x546406[_0x0c90('0xf')]=_0x546406[_0x0c90('0xc')]?_0x128656[_0x0c90('0x10')]:0x0;}utils['request'](_0x0c90('0x11'),_0x546406);});}else{utils['request'](_0x0c90('0x11'),_0x546406);}if(_0x435691){delete transfers[_0x546406['uniqueid']];}else{delete agents[_0x546406[_0x0c90('0x12')]];}}exports[_0x0c90('0x13')]=function(_0x4535a2){try{utils[_0x0c90('0x14')](util[_0x0c90('0x1')]('[%s][agents][agentcalled]',_0x4535a2[_0x0c90('0x15')]),_0x4535a2);agents[_0x4535a2[_0x0c90('0x12')]]=_0x4535a2;agents[_0x4535a2['destuniqueid']][_0x0c90('0x16')]=utils[_0x0c90('0x17')]();agents[_0x4535a2[_0x0c90('0x12')]]['lastevent']='called';agents[_0x4535a2[_0x0c90('0x12')]][_0x0c90('0x8')]=null;agents[_0x4535a2[_0x0c90('0x12')]][_0x0c90('0x18')]=null;utils[_0x0c90('0x19')](util[_0x0c90('0x1')](_0x0c90('0x1a'),_0x4535a2['uniqueid'],agents[_0x4535a2[_0x0c90('0x12')]][_0x0c90('0x5')],_0x4535a2[_0x0c90('0x12')]));}catch(_0x26835c){utils['error'](util[_0x0c90('0x1')](_0x0c90('0x1b'),_0x4535a2[_0x0c90('0x15')]),_0x26835c);}};exports[_0x0c90('0x1c')]=function(_0x315932){try{if(!_[_0x0c90('0x1d')](agents[_0x315932['destuniqueid']])){utils[_0x0c90('0x14')](util['format'](_0x0c90('0x1e'),_0x315932[_0x0c90('0x15')]),_0x315932);utils['info'](util[_0x0c90('0x1')](_0x0c90('0x1f'),_0x315932[_0x0c90('0x15')],agents[_0x315932[_0x0c90('0x12')]][_0x0c90('0x5')],_0x315932[_0x0c90('0x12')]));agents[_0x315932['destuniqueid']][_0x0c90('0x1c')]=!![];agents[_0x315932[_0x0c90('0x12')]]['agentringnoanswerAt']=utils['now']();agents[_0x315932[_0x0c90('0x12')]][_0x0c90('0x20')]=_0x0c90('0x21');agents[_0x315932[_0x0c90('0x12')]]['reason']=_0x0c90('0x21');agents[_0x315932[_0x0c90('0x12')]][_0x0c90('0x22')]=_0x315932[_0x0c90('0x23')]?parseInt(_0x315932[_0x0c90('0x23')])/0x3e8:0x0;agents[_0x315932[_0x0c90('0x12')]]['talktime']=0x0;unanswered[_0x0c90('0x24')](_0x315932[_0x0c90('0x12')]);}}catch(_0x39f1b2){utils[_0x0c90('0x25')](util['format']('[%s][agents][agentringnoanswer]',_0x315932[_0x0c90('0x15')]),_0x39f1b2);}};exports[_0x0c90('0x26')]=function(_0x3bff04){try{_[_0x0c90('0x27')](agents,function(_0x119e09,_0x562664){if(_0x119e09[_0x0c90('0x15')]==_0x3bff04[_0x0c90('0x15')]&&!_[_0x0c90('0x28')](unanswered,_0x119e09['destuniqueid'])){utils[_0x0c90('0x14')](util['format']('[%s][agents][queuecallerabandon]',_0x3bff04[_0x0c90('0x15')]),_0x3bff04);utils[_0x0c90('0x19')](util[_0x0c90('0x1')](_0x0c90('0x29'),_0x3bff04['uniqueid'],_0x119e09[_0x0c90('0x5')],_0x119e09['destuniqueid']));_0x119e09[_0x0c90('0x1c')]=!![];_0x119e09['agentringnoanswerAt']=utils[_0x0c90('0x17')]();_0x119e09[_0x0c90('0x20')]='abandoned';_0x119e09[_0x0c90('0x2a')]=_0x0c90('0x2b');_0x119e09[_0x0c90('0x22')]=_0x3bff04[_0x0c90('0x22')];_0x119e09[_0x0c90('0x2c')]=0x0;writeDB(_0x119e09);}});}catch(_0x1517c9){utils[_0x0c90('0x25')](util[_0x0c90('0x1')]('[%s][agents][queuecallerabandon]',_0x3bff04[_0x0c90('0x15')]),_0x1517c9);}};exports[_0x0c90('0x2d')]=function(_0x404f78){try{if(agents[_0x404f78[_0x0c90('0x12')]]){utils['debug'](util[_0x0c90('0x1')](_0x0c90('0x2e'),_0x404f78[_0x0c90('0x15')]),_0x404f78);utils[_0x0c90('0x19')](util[_0x0c90('0x1')](_0x0c90('0x2f'),_0x404f78[_0x0c90('0x15')],agents[_0x404f78[_0x0c90('0x12')]]['membername'],_0x404f78[_0x0c90('0x12')]));agents[_0x404f78[_0x0c90('0x12')]]['agentconnectAt']=utils[_0x0c90('0x17')]();agents[_0x404f78[_0x0c90('0x12')]][_0x0c90('0x8')]=_0x404f78[_0x0c90('0x8')];agents[_0x404f78[_0x0c90('0x12')]]['connectedlinename']=_0x404f78[_0x0c90('0x18')];agents[_0x404f78[_0x0c90('0x12')]][_0x0c90('0x22')]=_0x404f78[_0x0c90('0x23')];agents[_0x404f78[_0x0c90('0x12')]][_0x0c90('0x20')]=_0x0c90('0x30');_[_0x0c90('0x27')](agents,function(_0x11a8e3,_0x4f0227){if(_0x11a8e3[_0x0c90('0x12')]!=_0x404f78['destuniqueid']&&_0x11a8e3[_0x0c90('0x15')]==_0x404f78['uniqueid']){_0x11a8e3[_0x0c90('0x2c')]=0x0;_0x11a8e3[_0x0c90('0x22')]=_0x404f78['ringtime'];_0x11a8e3['agentringnoanswer']=!![];_0x11a8e3[_0x0c90('0x31')]=utils['now']();_0x11a8e3[_0x0c90('0x20')]=_0x0c90('0x32');_0x11a8e3[_0x0c90('0x2a')]='answered_elsewhere';_0x11a8e3[_0x0c90('0x33')]=_0x404f78[_0x0c90('0x12')];_0x11a8e3[_0x0c90('0x34')]=_0x404f78[_0x0c90('0x5')];writeDB(_0x11a8e3);}});}}catch(_0x2139c3){utils[_0x0c90('0x25')](util['format'](_0x0c90('0x2e'),_0x404f78[_0x0c90('0x15')]),_0x2139c3);}};exports[_0x0c90('0xd')]=function(_0x399115){try{if(!_[_0x0c90('0x1d')](agents[_0x399115[_0x0c90('0x12')]])){utils[_0x0c90('0x14')](util['format'](_0x0c90('0x35'),_0x399115['uniqueid']),_0x399115);utils[_0x0c90('0x19')](util[_0x0c90('0x1')](_0x0c90('0x36'),_0x399115[_0x0c90('0x15')],agents[_0x399115[_0x0c90('0x12')]][_0x0c90('0x5')],_0x399115[_0x0c90('0x12')]));agents[_0x399115[_0x0c90('0x12')]][_0x0c90('0xd')]=!![];agents[_0x399115[_0x0c90('0x12')]][_0x0c90('0x37')]=utils[_0x0c90('0x17')]();agents[_0x399115[_0x0c90('0x12')]][_0x0c90('0x2c')]=utils[_0x0c90('0x38')](agents[_0x399115['destuniqueid']][_0x0c90('0x37')],agents[_0x399115[_0x0c90('0x12')]][_0x0c90('0x39')]);agents[_0x399115[_0x0c90('0x12')]][_0x0c90('0x2a')]=_0x399115[_0x0c90('0x2a')];agents[_0x399115[_0x0c90('0x12')]][_0x0c90('0x20')]=_0x0c90('0x3a');writeDB(agents[_0x399115[_0x0c90('0x12')]]);}}catch(_0x2f25ad){utils[_0x0c90('0x25')](util[_0x0c90('0x1')](_0x0c90('0x35'),_0x399115['uniqueid']),_0x2f25ad);}};exports[_0x0c90('0x3b')]=function(_0x38f492){try{if(!_['isNil'](agents[_0x38f492['transfereruniqueid']])){utils['debug'](util[_0x0c90('0x1')](_0x0c90('0x3c'),_0x38f492[_0x0c90('0x15')]),_0x38f492);utils[_0x0c90('0x19')](util[_0x0c90('0x1')]('[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s',_0x38f492[_0x0c90('0x15')],agents[_0x38f492[_0x0c90('0x3d')]][_0x0c90('0x5')],agents[_0x38f492['transfereruniqueid']][_0x0c90('0x15')]));agents[_0x38f492[_0x0c90('0x3d')]][_0x0c90('0x3e')]=!![];agents[_0x38f492[_0x0c90('0x3d')]][_0x0c90('0x3f')]=_0x0c90('0x40');agents[_0x38f492[_0x0c90('0x3d')]][_0x0c90('0x41')]=_0x38f492[_0x0c90('0x42')];agents[_0x38f492[_0x0c90('0x3d')]]['transferuniqueid']=agents[_0x38f492[_0x0c90('0x3d')]]['uniqueid'];}}catch(_0xda4331){utils[_0x0c90('0x25')](util[_0x0c90('0x1')](_0x0c90('0x3c'),_0x38f492[_0x0c90('0x15')]),_0xda4331);}};exports[_0x0c90('0x43')]=function(_0x58dcfc){try{utils['debug'](util['format']('[%s][agents][attendedtransfer]',_0x58dcfc[_0x0c90('0x44')]),_0x58dcfc);if(_0x58dcfc[_0x0c90('0x44')]==_0x58dcfc[_0x0c90('0x45')]){if(!_['isNil'](agents[_0x58dcfc[_0x0c90('0x46')]])){utils[_0x0c90('0x19')](util['format'](_0x0c90('0x47'),_0x58dcfc['origtransfereruniqueid'],agents[_0x58dcfc[_0x0c90('0x46')]][_0x0c90('0x5')]));agents[_0x58dcfc[_0x0c90('0x46')]][_0x0c90('0x3e')]=!![];agents[_0x58dcfc['secondtransfereruniqueid']][_0x0c90('0x3f')]='ATTENDED';agents[_0x58dcfc[_0x0c90('0x46')]][_0x0c90('0x41')]=_0x58dcfc['origtransfererexten'];agents[_0x58dcfc['secondtransfereruniqueid']]['transferuniqueid']=_0x58dcfc[_0x0c90('0x44')];}if(_0x58dcfc[_0x0c90('0x48')]&&agents[_0x58dcfc[_0x0c90('0x48')]]){agents[_0x58dcfc[_0x0c90('0x48')]][_0x0c90('0x49')]=0x1;transfers[_0x58dcfc['transfereeuniqueid']]=_[_0x0c90('0x4a')](agents[_0x58dcfc[_0x0c90('0x48')]]);transfers[_0x58dcfc['transfereeuniqueid']][_0x0c90('0x7')]=agents[_0x58dcfc['secondtransfereruniqueid']][_0x0c90('0x7')];transfers[_0x58dcfc[_0x0c90('0x48')]]['calleridname']=agents[_0x58dcfc[_0x0c90('0x46')]]['calleridname'];transfers[_0x58dcfc['transfereeuniqueid']]['agentcalledAt']=utils[_0x0c90('0x17')]();transfers[_0x58dcfc[_0x0c90('0x48')]][_0x0c90('0x39')]=utils[_0x0c90('0x17')]();transfers[_0x58dcfc['transfereeuniqueid']]['holdtime']=0x0;transfers[_0x58dcfc[_0x0c90('0x48')]][_0x0c90('0x49')]=0x2;}}else if(_0x58dcfc[_0x0c90('0x46')]==_0x58dcfc['secondtransfererlinkedid']){if(!_[_0x0c90('0x1d')](agents[_0x58dcfc[_0x0c90('0x44')]])){utils[_0x0c90('0x19')](util['format'](_0x0c90('0x47'),_0x58dcfc[_0x0c90('0x44')],agents[_0x58dcfc[_0x0c90('0x44')]]['membername']));agents[_0x58dcfc[_0x0c90('0x44')]][_0x0c90('0x3e')]=!![];agents[_0x58dcfc[_0x0c90('0x44')]][_0x0c90('0x3f')]=_0x0c90('0x4b');agents[_0x58dcfc[_0x0c90('0x44')]][_0x0c90('0x41')]=_0x58dcfc[_0x0c90('0x4c')];agents[_0x58dcfc[_0x0c90('0x44')]]['transferuniqueid']=_0x58dcfc['secondtransfereruniqueid'];}if(_0x58dcfc[_0x0c90('0x4d')]&&agents[_0x58dcfc[_0x0c90('0x4d')]]){agents[_0x58dcfc[_0x0c90('0x4d')]][_0x0c90('0x49')]=0x1;transfers[_0x58dcfc[_0x0c90('0x4d')]]=_[_0x0c90('0x4a')](agents[_0x58dcfc[_0x0c90('0x4d')]]);transfers[_0x58dcfc[_0x0c90('0x4d')]][_0x0c90('0x7')]=agents[_0x58dcfc[_0x0c90('0x44')]][_0x0c90('0x7')];transfers[_0x58dcfc[_0x0c90('0x4d')]][_0x0c90('0x4e')]=agents[_0x58dcfc[_0x0c90('0x44')]][_0x0c90('0x4e')];transfers[_0x58dcfc['transfertargetuniqueid']][_0x0c90('0x16')]=utils[_0x0c90('0x17')]();transfers[_0x58dcfc[_0x0c90('0x4d')]]['agentconnectAt']=utils['now']();transfers[_0x58dcfc[_0x0c90('0x4d')]]['holdtime']=0x0;transfers[_0x58dcfc[_0x0c90('0x4d')]][_0x0c90('0x49')]=0x2;}}}catch(_0x57fb18){utils[_0x0c90('0x25')](util[_0x0c90('0x1')](_0x0c90('0x4f'),_0x58dcfc[_0x0c90('0x44')]),_0x57fb18);}};exports['hangup']=function(_0x5f2628){try{utils['debug'](util[_0x0c90('0x1')](_0x0c90('0x50'),_0x5f2628[_0x0c90('0x15')]),_0x5f2628);if(agents[_0x5f2628[_0x0c90('0x15')]]&&agents[_0x5f2628['uniqueid']][_0x0c90('0x2a')]==='timeout'){if(_0x5f2628[_0x0c90('0x51')]==='21'){agents[_0x5f2628[_0x0c90('0x15')]][_0x0c90('0x2a')]='rejected';agents[_0x5f2628[_0x0c90('0x15')]][_0x0c90('0x20')]=_0x0c90('0x52');}utils[_0x0c90('0x19')](util['format']('[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s',_0x5f2628[_0x0c90('0x15')],agents[_0x5f2628['uniqueid']][_0x0c90('0x5')],agents[_0x5f2628[_0x0c90('0x15')]][_0x0c90('0x2a')],agents[_0x5f2628[_0x0c90('0x15')]][_0x0c90('0x20')]));writeDB(agents[_0x5f2628[_0x0c90('0x15')]]);var _0x2321eb=unanswered[_0x0c90('0x53')](_0x5f2628[_0x0c90('0x15')]);if(_0x2321eb>-0x1){unanswered[_0x0c90('0x54')](_0x2321eb,0x1);}}if(transfers[_0x5f2628['uniqueid']]){transfers[_0x5f2628[_0x0c90('0x15')]][_0x0c90('0xd')]=!![];transfers[_0x5f2628[_0x0c90('0x15')]][_0x0c90('0x37')]=utils[_0x0c90('0x17')]();transfers[_0x5f2628[_0x0c90('0x15')]][_0x0c90('0x2c')]=utils[_0x0c90('0x38')](transfers[_0x5f2628[_0x0c90('0x15')]][_0x0c90('0x37')],transfers[_0x5f2628['uniqueid']][_0x0c90('0x39')]);transfers[_0x5f2628[_0x0c90('0x15')]][_0x0c90('0x2a')]=_0x0c90('0x55');transfers[_0x5f2628['uniqueid']][_0x0c90('0x20')]=_0x0c90('0x3a');utils[_0x0c90('0x19')](util['format'](_0x0c90('0x56'),_0x5f2628[_0x0c90('0x15')],transfers[_0x5f2628['uniqueid']][_0x0c90('0x5')],transfers[_0x5f2628['uniqueid']][_0x0c90('0x2a')],transfers[_0x5f2628['uniqueid']]['lastevent']));writeDB(transfers[_0x5f2628[_0x0c90('0x15')]],!![]);}if(agents[_0x5f2628[_0x0c90('0x15')]]&&agents[_0x5f2628['uniqueid']]['agentconnectAt']){agents[_0x5f2628[_0x0c90('0x15')]][_0x0c90('0xd')]=!![];agents[_0x5f2628['uniqueid']]['agentcompleteAt']=utils[_0x0c90('0x17')]();agents[_0x5f2628['uniqueid']][_0x0c90('0x2c')]=utils[_0x0c90('0x38')](agents[_0x5f2628[_0x0c90('0x15')]][_0x0c90('0x37')],agents[_0x5f2628[_0x0c90('0x15')]]['agentconnectAt']);agents[_0x5f2628[_0x0c90('0x15')]][_0x0c90('0x2a')]=agents[_0x5f2628[_0x0c90('0x15')]]['transfer']?'transfer':_0x0c90('0x55');agents[_0x5f2628[_0x0c90('0x15')]][_0x0c90('0x20')]='complete';utils['info'](util['format'](_0x0c90('0x56'),_0x5f2628['uniqueid'],agents[_0x5f2628['uniqueid']]['membername'],agents[_0x5f2628['uniqueid']][_0x0c90('0x2a')],agents[_0x5f2628[_0x0c90('0x15')]][_0x0c90('0x20')]));writeDB(agents[_0x5f2628[_0x0c90('0x15')]]);}}catch(_0x16c383){utils['error'](util['format']('[%s][agents][hangup]',_0x5f2628[_0x0c90('0x15')]),_0x16c383);}}; \ No newline at end of file +var _0x69d3=['isNil','[%s][agents][agentringnoanswer]','agentringnoanswerAt','timeout','reason','holdtime','ringtime','talktime','push','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','connect','answered_elsewhere','answeredelsewheremembername','agentcompleteAt','diffTime','complete','[%s][agents][agentcomplete]','blindtransfer','transfereruniqueid','[%s][agents][blindtransfer]','transfer','transfertype','blind','transferexten','extension','transferuniqueid','attendedtransfer','origtransfereruniqueid','[%s][agents][attendedtransfer]\x20agent:%s','secondtransfereruniqueid','ATTENDED','transfereeuniqueid','agententerreason','clone','calleridname','secondtransfererlinkedid','transfertargetuniqueid','[%s][agents][attendedtransfer]','hangup','[%s][agents][hangup]','rejected','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','splice','agent','lodash','util','./utils','info','uniqueid','membername','interface','calleridnum','connectedlinenum','lastevent','queue','getVoiceQueueByName','then','type','agentacw','agentcomplete','acw','acwTimeout','request','CreateVoiceAgentReport','agentcalled','debug','format','[%s][agents][agentcalled]','agentcalledAt','now','destuniqueid','called','connectedlinename','error','agentringnoanswer'];(function(_0x1807bb,_0x12a17a){var _0x303b1f=function(_0x31d2d2){while(--_0x31d2d2){_0x1807bb['push'](_0x1807bb['shift']());}};_0x303b1f(++_0x12a17a);}(_0x69d3,0xda));var _0x369d=function(_0x109cf6,_0x221c9d){_0x109cf6=_0x109cf6-0x0;var _0x427a19=_0x69d3[_0x109cf6];return _0x427a19;};'use strict';var _=require(_0x369d('0x0'));var util=require(_0x369d('0x1'));var utils=require(_0x369d('0x2'));var agents={};var transfers={};var unanswered=[];function writeDB(_0x52c3ba,_0x47591f){utils[_0x369d('0x3')](util['format']('[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s',_0x52c3ba[_0x369d('0x4')],_0x52c3ba['channel'],_0x52c3ba['queue'],_0x52c3ba[_0x369d('0x5')],_0x52c3ba[_0x369d('0x6')],_0x52c3ba[_0x369d('0x7')],_0x52c3ba[_0x369d('0x8')],_0x52c3ba[_0x369d('0x9')]));if(_0x52c3ba[_0x369d('0xa')]){utils[_0x369d('0xb')](_0x52c3ba[_0x369d('0xa')])[_0x369d('0xc')](function(_0x580727){if(_0x580727){_0x52c3ba['type']=_0x580727[_0x369d('0xd')];_0x52c3ba[_0x369d('0xe')]=_0x52c3ba[_0x369d('0xf')]?_0x580727[_0x369d('0x10')]:![];_0x52c3ba['acwtime']=_0x52c3ba['agentacw']?_0x580727[_0x369d('0x11')]:0x0;}utils[_0x369d('0x12')](_0x369d('0x13'),_0x52c3ba);});}else{utils[_0x369d('0x12')](_0x369d('0x13'),_0x52c3ba);}if(_0x47591f){delete transfers[_0x52c3ba[_0x369d('0x4')]];}else{delete agents[_0x52c3ba['destuniqueid']];}}exports[_0x369d('0x14')]=function(_0x9d016){try{utils[_0x369d('0x15')](util[_0x369d('0x16')](_0x369d('0x17'),_0x9d016['uniqueid']),_0x9d016);agents[_0x9d016['destuniqueid']]=_0x9d016;agents[_0x9d016['destuniqueid']][_0x369d('0x18')]=utils[_0x369d('0x19')]();agents[_0x9d016[_0x369d('0x1a')]]['lastevent']=_0x369d('0x1b');agents[_0x9d016[_0x369d('0x1a')]][_0x369d('0x8')]=null;agents[_0x9d016['destuniqueid']][_0x369d('0x1c')]=null;utils[_0x369d('0x3')](util['format']('[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called',_0x9d016['uniqueid'],agents[_0x9d016[_0x369d('0x1a')]][_0x369d('0x5')],_0x9d016[_0x369d('0x1a')]));}catch(_0x4ddcb2){utils[_0x369d('0x1d')](util[_0x369d('0x16')](_0x369d('0x17'),_0x9d016[_0x369d('0x4')]),_0x4ddcb2);}};exports[_0x369d('0x1e')]=function(_0x538ca4){try{if(!_[_0x369d('0x1f')](agents[_0x538ca4[_0x369d('0x1a')]])){utils[_0x369d('0x15')](util[_0x369d('0x16')](_0x369d('0x20'),_0x538ca4[_0x369d('0x4')]),_0x538ca4);utils[_0x369d('0x3')](util[_0x369d('0x16')]('[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout',_0x538ca4['uniqueid'],agents[_0x538ca4[_0x369d('0x1a')]][_0x369d('0x5')],_0x538ca4[_0x369d('0x1a')]));agents[_0x538ca4[_0x369d('0x1a')]][_0x369d('0x1e')]=!![];agents[_0x538ca4[_0x369d('0x1a')]][_0x369d('0x21')]=utils['now']();agents[_0x538ca4['destuniqueid']][_0x369d('0x9')]=_0x369d('0x22');agents[_0x538ca4[_0x369d('0x1a')]][_0x369d('0x23')]=_0x369d('0x22');agents[_0x538ca4[_0x369d('0x1a')]][_0x369d('0x24')]=_0x538ca4['ringtime']?parseInt(_0x538ca4[_0x369d('0x25')])/0x3e8:0x0;agents[_0x538ca4[_0x369d('0x1a')]][_0x369d('0x26')]=0x0;unanswered[_0x369d('0x27')](_0x538ca4[_0x369d('0x1a')]);}}catch(_0x41367a){utils[_0x369d('0x1d')](util['format'](_0x369d('0x20'),_0x538ca4['uniqueid']),_0x41367a);}};exports['queuecallerabandon']=function(_0x38feda){try{_[_0x369d('0x28')](agents,function(_0x5844c7,_0x104540){if(_0x5844c7['uniqueid']==_0x38feda[_0x369d('0x4')]&&!_[_0x369d('0x29')](unanswered,_0x5844c7[_0x369d('0x1a')])){utils[_0x369d('0x15')](util[_0x369d('0x16')](_0x369d('0x2a'),_0x38feda[_0x369d('0x4')]),_0x38feda);utils['info'](util[_0x369d('0x16')](_0x369d('0x2b'),_0x38feda[_0x369d('0x4')],_0x5844c7[_0x369d('0x5')],_0x5844c7[_0x369d('0x1a')]));_0x5844c7[_0x369d('0x1e')]=!![];_0x5844c7[_0x369d('0x21')]=utils[_0x369d('0x19')]();_0x5844c7['lastevent']=_0x369d('0x2c');_0x5844c7[_0x369d('0x23')]=_0x369d('0x2c');_0x5844c7[_0x369d('0x24')]=_0x38feda[_0x369d('0x24')];_0x5844c7['talktime']=0x0;writeDB(_0x5844c7);}});}catch(_0x35f326){utils[_0x369d('0x1d')](util[_0x369d('0x16')](_0x369d('0x2a'),_0x38feda[_0x369d('0x4')]),_0x35f326);}};exports[_0x369d('0x2d')]=function(_0x50c033){try{if(agents[_0x50c033[_0x369d('0x1a')]]){utils[_0x369d('0x15')](util[_0x369d('0x16')](_0x369d('0x2e'),_0x50c033[_0x369d('0x4')]),_0x50c033);utils[_0x369d('0x3')](util[_0x369d('0x16')](_0x369d('0x2f'),_0x50c033[_0x369d('0x4')],agents[_0x50c033[_0x369d('0x1a')]][_0x369d('0x5')],_0x50c033[_0x369d('0x1a')]));agents[_0x50c033[_0x369d('0x1a')]][_0x369d('0x30')]=utils[_0x369d('0x19')]();agents[_0x50c033[_0x369d('0x1a')]][_0x369d('0x8')]=_0x50c033[_0x369d('0x8')];agents[_0x50c033[_0x369d('0x1a')]][_0x369d('0x1c')]=_0x50c033[_0x369d('0x1c')];agents[_0x50c033[_0x369d('0x1a')]][_0x369d('0x24')]=_0x50c033[_0x369d('0x25')];agents[_0x50c033['destuniqueid']]['lastevent']=_0x369d('0x31');_[_0x369d('0x28')](agents,function(_0x8a1ef5,_0x401bc7){if(_0x8a1ef5[_0x369d('0x1a')]!=_0x50c033[_0x369d('0x1a')]&&_0x8a1ef5[_0x369d('0x4')]==_0x50c033[_0x369d('0x4')]){_0x8a1ef5[_0x369d('0x26')]=0x0;_0x8a1ef5['holdtime']=_0x50c033[_0x369d('0x25')];_0x8a1ef5[_0x369d('0x1e')]=!![];_0x8a1ef5[_0x369d('0x21')]=utils[_0x369d('0x19')]();_0x8a1ef5[_0x369d('0x9')]=_0x369d('0x32');_0x8a1ef5[_0x369d('0x23')]=_0x369d('0x32');_0x8a1ef5['answeredelsewheredestinationuniqueid']=_0x50c033['destuniqueid'];_0x8a1ef5[_0x369d('0x33')]=_0x50c033[_0x369d('0x5')];writeDB(_0x8a1ef5);}});}}catch(_0x30909a){utils['error'](util['format']('[%s][agents][agentconnect]',_0x50c033[_0x369d('0x4')]),_0x30909a);}};exports[_0x369d('0xf')]=function(_0x55dfde){try{if(!_[_0x369d('0x1f')](agents[_0x55dfde[_0x369d('0x1a')]])){utils[_0x369d('0x15')](util[_0x369d('0x16')]('[%s][agents][agentcomplete]',_0x55dfde[_0x369d('0x4')]),_0x55dfde);utils['info'](util[_0x369d('0x16')]('[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete',_0x55dfde[_0x369d('0x4')],agents[_0x55dfde[_0x369d('0x1a')]][_0x369d('0x5')],_0x55dfde['destuniqueid']));agents[_0x55dfde['destuniqueid']][_0x369d('0xf')]=!![];agents[_0x55dfde[_0x369d('0x1a')]][_0x369d('0x34')]=utils['now']();agents[_0x55dfde[_0x369d('0x1a')]][_0x369d('0x26')]=utils[_0x369d('0x35')](agents[_0x55dfde[_0x369d('0x1a')]][_0x369d('0x34')],agents[_0x55dfde[_0x369d('0x1a')]][_0x369d('0x30')]);agents[_0x55dfde[_0x369d('0x1a')]][_0x369d('0x23')]=_0x55dfde['reason'];agents[_0x55dfde[_0x369d('0x1a')]][_0x369d('0x9')]=_0x369d('0x36');writeDB(agents[_0x55dfde[_0x369d('0x1a')]]);}}catch(_0x27e2c7){utils[_0x369d('0x1d')](util['format'](_0x369d('0x37'),_0x55dfde[_0x369d('0x4')]),_0x27e2c7);}};exports[_0x369d('0x38')]=function(_0x44a357){try{if(!_[_0x369d('0x1f')](agents[_0x44a357[_0x369d('0x39')]])){utils[_0x369d('0x15')](util[_0x369d('0x16')](_0x369d('0x3a'),_0x44a357[_0x369d('0x4')]),_0x44a357);utils[_0x369d('0x3')](util[_0x369d('0x16')]('[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s',_0x44a357[_0x369d('0x4')],agents[_0x44a357[_0x369d('0x39')]][_0x369d('0x5')],agents[_0x44a357[_0x369d('0x39')]][_0x369d('0x4')]));agents[_0x44a357['transfereruniqueid']][_0x369d('0x3b')]=!![];agents[_0x44a357['transfereruniqueid']][_0x369d('0x3c')]=_0x369d('0x3d');agents[_0x44a357[_0x369d('0x39')]][_0x369d('0x3e')]=_0x44a357[_0x369d('0x3f')];agents[_0x44a357[_0x369d('0x39')]][_0x369d('0x40')]=agents[_0x44a357[_0x369d('0x39')]][_0x369d('0x4')];}}catch(_0x9f1544){utils['error'](util['format'](_0x369d('0x3a'),_0x44a357[_0x369d('0x4')]),_0x9f1544);}};exports[_0x369d('0x41')]=function(_0x4226de){try{utils[_0x369d('0x15')](util['format']('[%s][agents][attendedtransfer]',_0x4226de[_0x369d('0x42')]),_0x4226de);if(_0x4226de[_0x369d('0x42')]==_0x4226de['origtransfererlinkedid']){if(!_[_0x369d('0x1f')](agents[_0x4226de['secondtransfereruniqueid']])){utils[_0x369d('0x3')](util[_0x369d('0x16')](_0x369d('0x43'),_0x4226de['origtransfereruniqueid'],agents[_0x4226de[_0x369d('0x44')]][_0x369d('0x5')]));agents[_0x4226de[_0x369d('0x44')]][_0x369d('0x3b')]=!![];agents[_0x4226de['secondtransfereruniqueid']]['transfertype']=_0x369d('0x45');agents[_0x4226de[_0x369d('0x44')]][_0x369d('0x3e')]=_0x4226de['origtransfererexten'];agents[_0x4226de[_0x369d('0x44')]][_0x369d('0x40')]=_0x4226de[_0x369d('0x42')];}if(_0x4226de['transfereeuniqueid']&&agents[_0x4226de['transfereeuniqueid']]){agents[_0x4226de[_0x369d('0x46')]][_0x369d('0x47')]=0x1;transfers[_0x4226de[_0x369d('0x46')]]=_[_0x369d('0x48')](agents[_0x4226de['transfereeuniqueid']]);transfers[_0x4226de[_0x369d('0x46')]][_0x369d('0x7')]=agents[_0x4226de[_0x369d('0x44')]][_0x369d('0x7')];transfers[_0x4226de[_0x369d('0x46')]]['calleridname']=agents[_0x4226de[_0x369d('0x44')]][_0x369d('0x49')];transfers[_0x4226de[_0x369d('0x46')]]['agentcalledAt']=utils[_0x369d('0x19')]();transfers[_0x4226de['transfereeuniqueid']][_0x369d('0x30')]=utils['now']();transfers[_0x4226de['transfereeuniqueid']]['holdtime']=0x0;transfers[_0x4226de['transfereeuniqueid']][_0x369d('0x47')]=0x2;}}else if(_0x4226de['secondtransfereruniqueid']==_0x4226de[_0x369d('0x4a')]){if(!_['isNil'](agents[_0x4226de[_0x369d('0x42')]])){utils[_0x369d('0x3')](util[_0x369d('0x16')]('[%s][agents][attendedtransfer]\x20agent:%s',_0x4226de[_0x369d('0x42')],agents[_0x4226de[_0x369d('0x42')]][_0x369d('0x5')]));agents[_0x4226de[_0x369d('0x42')]][_0x369d('0x3b')]=!![];agents[_0x4226de[_0x369d('0x42')]]['transfertype']=_0x369d('0x45');agents[_0x4226de['origtransfereruniqueid']]['transferexten']=_0x4226de['secondtransfererexten'];agents[_0x4226de[_0x369d('0x42')]][_0x369d('0x40')]=_0x4226de[_0x369d('0x44')];}if(_0x4226de[_0x369d('0x4b')]&&agents[_0x4226de[_0x369d('0x4b')]]){agents[_0x4226de[_0x369d('0x4b')]][_0x369d('0x47')]=0x1;transfers[_0x4226de[_0x369d('0x4b')]]=_[_0x369d('0x48')](agents[_0x4226de[_0x369d('0x4b')]]);transfers[_0x4226de[_0x369d('0x4b')]][_0x369d('0x7')]=agents[_0x4226de[_0x369d('0x42')]][_0x369d('0x7')];transfers[_0x4226de[_0x369d('0x4b')]][_0x369d('0x49')]=agents[_0x4226de['origtransfereruniqueid']][_0x369d('0x49')];transfers[_0x4226de['transfertargetuniqueid']][_0x369d('0x18')]=utils[_0x369d('0x19')]();transfers[_0x4226de[_0x369d('0x4b')]][_0x369d('0x30')]=utils[_0x369d('0x19')]();transfers[_0x4226de['transfertargetuniqueid']][_0x369d('0x24')]=0x0;transfers[_0x4226de['transfertargetuniqueid']]['agententerreason']=0x2;}}}catch(_0x3ee715){utils[_0x369d('0x1d')](util[_0x369d('0x16')](_0x369d('0x4c'),_0x4226de[_0x369d('0x42')]),_0x3ee715);}};exports[_0x369d('0x4d')]=function(_0x341d93){try{utils[_0x369d('0x15')](util['format'](_0x369d('0x4e'),_0x341d93[_0x369d('0x4')]),_0x341d93);if(agents[_0x341d93['uniqueid']]&&agents[_0x341d93[_0x369d('0x4')]][_0x369d('0x23')]===_0x369d('0x22')){if(_0x341d93['cause']==='21'){agents[_0x341d93[_0x369d('0x4')]]['reason']=_0x369d('0x4f');agents[_0x341d93[_0x369d('0x4')]][_0x369d('0x9')]=_0x369d('0x4f');}utils[_0x369d('0x3')](util[_0x369d('0x16')](_0x369d('0x50'),_0x341d93['uniqueid'],agents[_0x341d93[_0x369d('0x4')]][_0x369d('0x5')],agents[_0x341d93['uniqueid']][_0x369d('0x23')],agents[_0x341d93['uniqueid']][_0x369d('0x9')]));writeDB(agents[_0x341d93[_0x369d('0x4')]]);var _0x2b7897=unanswered['indexOf'](_0x341d93[_0x369d('0x4')]);if(_0x2b7897>-0x1){unanswered[_0x369d('0x51')](_0x2b7897,0x1);}}if(transfers[_0x341d93['uniqueid']]){transfers[_0x341d93[_0x369d('0x4')]][_0x369d('0xf')]=!![];transfers[_0x341d93[_0x369d('0x4')]]['agentcompleteAt']=utils[_0x369d('0x19')]();transfers[_0x341d93[_0x369d('0x4')]][_0x369d('0x26')]=utils[_0x369d('0x35')](transfers[_0x341d93[_0x369d('0x4')]]['agentcompleteAt'],transfers[_0x341d93[_0x369d('0x4')]][_0x369d('0x30')]);transfers[_0x341d93[_0x369d('0x4')]][_0x369d('0x23')]=_0x369d('0x52');transfers[_0x341d93['uniqueid']]['lastevent']=_0x369d('0x36');utils[_0x369d('0x3')](util[_0x369d('0x16')](_0x369d('0x50'),_0x341d93[_0x369d('0x4')],transfers[_0x341d93[_0x369d('0x4')]]['membername'],transfers[_0x341d93[_0x369d('0x4')]][_0x369d('0x23')],transfers[_0x341d93['uniqueid']][_0x369d('0x9')]));writeDB(transfers[_0x341d93['uniqueid']],!![]);}if(agents[_0x341d93[_0x369d('0x4')]]&&agents[_0x341d93['uniqueid']][_0x369d('0x30')]){agents[_0x341d93[_0x369d('0x4')]]['agentcomplete']=!![];agents[_0x341d93[_0x369d('0x4')]]['agentcompleteAt']=utils[_0x369d('0x19')]();agents[_0x341d93['uniqueid']]['talktime']=utils[_0x369d('0x35')](agents[_0x341d93[_0x369d('0x4')]][_0x369d('0x34')],agents[_0x341d93[_0x369d('0x4')]][_0x369d('0x30')]);agents[_0x341d93['uniqueid']][_0x369d('0x23')]=agents[_0x341d93[_0x369d('0x4')]][_0x369d('0x3b')]?_0x369d('0x3b'):_0x369d('0x52');agents[_0x341d93[_0x369d('0x4')]][_0x369d('0x9')]=_0x369d('0x36');utils[_0x369d('0x3')](util['format'](_0x369d('0x50'),_0x341d93[_0x369d('0x4')],agents[_0x341d93[_0x369d('0x4')]][_0x369d('0x5')],agents[_0x341d93['uniqueid']][_0x369d('0x23')],agents[_0x341d93['uniqueid']][_0x369d('0x9')]));writeDB(agents[_0x341d93[_0x369d('0x4')]]);}}catch(_0x34a225){utils[_0x369d('0x1d')](util[_0x369d('0x16')](_0x369d('0x4e'),_0x341d93[_0x369d('0x4')]),_0x34a225);}}; \ No newline at end of file diff --git a/server/services/xdr/calls.controller.js b/server/services/xdr/calls.controller.js index 4c42f89..5112285 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 _0x5bd7=['queue','membername','interface','calleridnum','connectedlinenum','lastevent','then','UserId','request','CreateVoiceCallReport','debug','linkedid','info','[%s][calls][newchannel]\x20context:%s\x20exten:%s','exten','accountcode','context','channel','now','DOCUMENTATION','error','newstate','isNil','channelstate','[%s][calls][newstate]\x20context:%s\x20channel:%s','systemanswertime','transfer','[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','destinationchannel','answertime','disposition','hangup','callerid','calleridname','[%s][calls][hangup]\x20callerid:%s\x20reason:%s','cause-txt','endtime','duration','diffTime','starttime','billableseconds','[%s][calls][hangup]','localtwolinkedid','origtransfereruniqueid','transfereechannel','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','secondtransfererchannel','transfertargetchannel','origtransfererchannel','userfield','[%s][calls][attendedtransfer]','musiconholdstart','musiconholdstartAt','[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s','[%s][calls][musiconholdstart]','musiconholdstop','mohtime','[%s][calls][musiconholdstop]\x20mohtime:%s','[%s][calls][musiconholdstop]','[%s][calls][varset]','value','variable','[%s][calls][varset]\x20variable:xmd-phone\x20value:%s','destination','xmd-callerid-preview','xmd-callerid','[%s][calls][varset]\x20variable:%s\x20value:%s','xmd-queue','xmcs-queue','lastapplication','Queue','lastdata','xmd-contactid','ContactId','xmd-cdrtype','type','outboundrouteid','[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s','sipcallid','[%s][calls][varset]\x20variable:sipcallid\x20value:%s','[%s][calls][newexten]','[%s][calls][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','set','startsWith','cdr','lastIndexOf','includes','noop','execif','util','./utils','./transfers.controller','FAILED','NO\x20ANSWER','ANSWERED','BUSY','blinds','uniqueid','format','[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s'];(function(_0x5d6456,_0x58ecc7){var _0x4d66c1=function(_0x4335e3){while(--_0x4335e3){_0x5d6456['push'](_0x5d6456['shift']());}};_0x4d66c1(++_0x58ecc7);}(_0x5bd7,0x12a));var _0x75bd=function(_0x5ee8a5,_0x122937){_0x5ee8a5=_0x5ee8a5-0x0;var _0xadeae9=_0x5bd7[_0x5ee8a5];return _0xadeae9;};'use strict';var _=require('lodash');var util=require(_0x75bd('0x0'));var utils=require(_0x75bd('0x1'));var transfers=require(_0x75bd('0x2'));var dispositions=['NO\x20ANSWER',_0x75bd('0x3'),'FAILED',_0x75bd('0x4'),_0x75bd('0x4'),'NO\x20ANSWER',_0x75bd('0x5'),_0x75bd('0x6'),_0x75bd('0x3'),'FAILED',_0x75bd('0x3')];var channels={};function writeDB(_0x2d6b6a){var _0x70cd30;if(transfers[_0x75bd('0x7')][_0x2d6b6a[_0x75bd('0x8')]]){_0x70cd30=_0x2d6b6a[_0x75bd('0x8')];_0x2d6b6a[_0x75bd('0x8')]=transfers['blinds'][_0x2d6b6a[_0x75bd('0x8')]]['transfereeuniqueid'];}utils['info'](util[_0x75bd('0x9')](_0x75bd('0xa'),_0x2d6b6a[_0x75bd('0x8')],_0x2d6b6a['channel'],_0x2d6b6a[_0x75bd('0xb')],_0x2d6b6a[_0x75bd('0xc')],_0x2d6b6a[_0x75bd('0xd')],_0x2d6b6a[_0x75bd('0xe')],_0x2d6b6a[_0x75bd('0xf')],_0x2d6b6a[_0x75bd('0x10')]));if(_0x2d6b6a['accountcode']){utils['getUserByInternal'](_0x2d6b6a['accountcode'])[_0x75bd('0x11')](function(_0x147532){if(_0x147532){_0x2d6b6a[_0x75bd('0x12')]=_0x147532['id'];}utils[_0x75bd('0x13')](_0x75bd('0x14'),_0x2d6b6a);});}else{utils[_0x75bd('0x13')](_0x75bd('0x14'),_0x2d6b6a);}if(channels[_0x2d6b6a[_0x75bd('0x8')]]){delete channels[_0x2d6b6a[_0x75bd('0x8')]];}else if(_0x70cd30&&channels[_0x70cd30]){if(!transfers['blinds'][_0x70cd30]['recording'])delete transfers['blinds'][_0x70cd30];delete channels[_0x70cd30];}}exports['newchannel']=function(_0x38df20){try{utils[_0x75bd('0x15')](util['format']('[%s][calls][newchannel]',_0x38df20[_0x75bd('0x8')]),_0x38df20);if(_0x38df20[_0x75bd('0x8')]==_0x38df20[_0x75bd('0x16')]&&_0x38df20['channel']!='OutgoingSpoolFailed'){utils[_0x75bd('0x17')](util['format'](_0x75bd('0x18'),_0x38df20[_0x75bd('0x8')],_0x38df20['context'],_0x38df20[_0x75bd('0x19')]));channels[_0x38df20['uniqueid']]={'uniqueid':_0x38df20['uniqueid'],'accountcode':_0x38df20[_0x75bd('0x1a')],'source':_0x38df20[_0x75bd('0xe')],'destination':_0x38df20[_0x75bd('0x19')],'destinationcontext':_0x38df20[_0x75bd('0x1b')],'channel':_0x38df20[_0x75bd('0x1c')],'starttime':utils[_0x75bd('0x1d')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0x75bd('0x4'),'amaflags':_0x75bd('0x1e')};}}catch(_0x4a8c0e){utils[_0x75bd('0x1f')](util[_0x75bd('0x9')]('[%s][calls][newchannel]',_0x38df20[_0x75bd('0x8')]),_0x4a8c0e);}};exports[_0x75bd('0x20')]=function(_0x4b53ff){try{utils[_0x75bd('0x15')](util[_0x75bd('0x9')]('[%s][calls][newstate]',_0x4b53ff[_0x75bd('0x8')]),_0x4b53ff);if(!_[_0x75bd('0x21')](channels[_0x4b53ff[_0x75bd('0x8')]])&&_0x4b53ff[_0x75bd('0x22')]==0x6){utils[_0x75bd('0x17')](util['format'](_0x75bd('0x23'),_0x4b53ff[_0x75bd('0x8')],_0x4b53ff['context'],_0x4b53ff['channel']));if(_['isNil'](channels[_0x4b53ff['uniqueid']][_0x75bd('0x24')])){channels[_0x4b53ff[_0x75bd('0x8')]]['systemanswertime']=utils['now']();}}else if(!_[_0x75bd('0x21')](channels[_0x4b53ff[_0x75bd('0x16')]])&&_0x4b53ff[_0x75bd('0x22')]==0x6&&_0x4b53ff['context']!=_0x75bd('0x25')){utils[_0x75bd('0x17')](util[_0x75bd('0x9')](_0x75bd('0x26'),_0x4b53ff[_0x75bd('0x8')],_0x4b53ff[_0x75bd('0x16')],_0x4b53ff[_0x75bd('0x1b')],_0x4b53ff[_0x75bd('0x1c')]));channels[_0x4b53ff[_0x75bd('0x16')]][_0x75bd('0x1a')]=_0x4b53ff['accountcode'];channels[_0x4b53ff['linkedid']][_0x75bd('0x27')]=_0x4b53ff[_0x75bd('0x1c')];if(_['isNil'](channels[_0x4b53ff['linkedid']][_0x75bd('0x28')])){channels[_0x4b53ff[_0x75bd('0x16')]]['answertime']=utils[_0x75bd('0x1d')]();}channels[_0x4b53ff[_0x75bd('0x16')]][_0x75bd('0x29')]=dispositions[_['toNumber'](_0x4b53ff['channelstate'])]||_0x75bd('0x5');}}catch(_0x121ee1){utils[_0x75bd('0x1f')](util[_0x75bd('0x9')]('[%s][calls][newstate]',_0x4b53ff['uniqueid']),_0x121ee1);}};exports[_0x75bd('0x2a')]=function(_0x4f1d75){try{if(!_[_0x75bd('0x21')](channels[_0x4f1d75[_0x75bd('0x8')]])){utils['debug'](util[_0x75bd('0x9')]('[%s][calls][hangup]',_0x4f1d75[_0x75bd('0x8')]),_0x4f1d75);if(_[_0x75bd('0x21')](channels[_0x4f1d75[_0x75bd('0x8')]][_0x75bd('0x2b')])){channels[_0x4f1d75[_0x75bd('0x8')]][_0x75bd('0x2b')]=_0x4f1d75[_0x75bd('0x2c')]+'\x20<'+_0x4f1d75[_0x75bd('0xe')]+'>';}utils[_0x75bd('0x17')](util[_0x75bd('0x9')](_0x75bd('0x2d'),_0x4f1d75[_0x75bd('0x8')],channels[_0x4f1d75[_0x75bd('0x8')]][_0x75bd('0x2b')],_0x4f1d75[_0x75bd('0x2e')]));channels[_0x4f1d75[_0x75bd('0x8')]][_0x75bd('0x2f')]=utils[_0x75bd('0x1d')]();channels[_0x4f1d75[_0x75bd('0x8')]][_0x75bd('0x30')]=utils[_0x75bd('0x31')](channels[_0x4f1d75[_0x75bd('0x8')]][_0x75bd('0x2f')],channels[_0x4f1d75[_0x75bd('0x8')]][_0x75bd('0x32')]);channels[_0x4f1d75[_0x75bd('0x8')]][_0x75bd('0x33')]=channels[_0x4f1d75[_0x75bd('0x8')]][_0x75bd('0x28')]?utils[_0x75bd('0x31')](channels[_0x4f1d75[_0x75bd('0x8')]][_0x75bd('0x2f')],channels[_0x4f1d75['uniqueid']]['answertime']):0x0;writeDB(channels[_0x4f1d75['uniqueid']]);}}catch(_0x3fee55){utils[_0x75bd('0x1f')](util[_0x75bd('0x9')](_0x75bd('0x34'),_0x4f1d75[_0x75bd('0x8')]),_0x3fee55);}};exports['attendedtransfer']=function(_0x248707){try{if(!_[_0x75bd('0x21')](channels[_0x248707[_0x75bd('0x35')]])){utils[_0x75bd('0x15')](util[_0x75bd('0x9')]('[%s][calls][attendedtransfer]',_0x248707[_0x75bd('0x36')]),_0x248707);if(channels[_0x248707[_0x75bd('0x35')]][_0x75bd('0x1c')]==_0x248707[_0x75bd('0x37')]){utils[_0x75bd('0x17')](util[_0x75bd('0x9')](_0x75bd('0x38'),_0x248707[_0x75bd('0x36')],_0x248707[_0x75bd('0x35')],_0x248707['secondtransfererchannel']));channels[_0x248707[_0x75bd('0x35')]][_0x75bd('0x27')]=_0x248707[_0x75bd('0x39')];channels[_0x248707[_0x75bd('0x35')]]['userfield']='_attended';}else if(channels[_0x248707[_0x75bd('0x35')]][_0x75bd('0x1c')]=_0x248707[_0x75bd('0x3a')]){utils[_0x75bd('0x17')](util[_0x75bd('0x9')](_0x75bd('0x38'),_0x248707[_0x75bd('0x36')],_0x248707[_0x75bd('0x35')],_0x248707[_0x75bd('0x3b')]));channels[_0x248707[_0x75bd('0x35')]][_0x75bd('0x27')]=_0x248707[_0x75bd('0x3b')];channels[_0x248707[_0x75bd('0x35')]][_0x75bd('0x3c')]='_attended';}}}catch(_0x536ced){utils[_0x75bd('0x1f')](util[_0x75bd('0x9')](_0x75bd('0x3d'),_0x248707[_0x75bd('0x36')]),_0x536ced);}};exports[_0x75bd('0x3e')]=function(_0x19d2ef){try{if(!_[_0x75bd('0x21')](channels[_0x19d2ef['uniqueid']])){utils[_0x75bd('0x15')](util['format']('[%s][calls][musiconholdstart]',_0x19d2ef['uniqueid']),_0x19d2ef);channels[_0x19d2ef[_0x75bd('0x8')]][_0x75bd('0x3f')]=utils[_0x75bd('0x1d')]();utils['info'](util['format'](_0x75bd('0x40'),_0x19d2ef[_0x75bd('0x8')],channels[_0x19d2ef[_0x75bd('0x8')]]['musiconholdstartAt']));}}catch(_0x5088b3){utils[_0x75bd('0x1f')](util[_0x75bd('0x9')](_0x75bd('0x41'),_0x19d2ef['uniqueid']),_0x5088b3);}};exports[_0x75bd('0x42')]=function(_0x2f2aae){try{if(!_[_0x75bd('0x21')](channels[_0x2f2aae[_0x75bd('0x8')]])){utils[_0x75bd('0x15')](util[_0x75bd('0x9')]('[%s][calls][musiconholdstop]',_0x2f2aae[_0x75bd('0x8')]),_0x2f2aae);if(!_[_0x75bd('0x21')](channels[_0x2f2aae['uniqueid']][_0x75bd('0x3f')])){channels[_0x2f2aae['uniqueid']][_0x75bd('0x43')]+=utils['diffTime'](utils[_0x75bd('0x1d')](),channels[_0x2f2aae[_0x75bd('0x8')]][_0x75bd('0x3f')]);utils['info'](util[_0x75bd('0x9')](_0x75bd('0x44'),_0x2f2aae['uniqueid'],channels[_0x2f2aae['uniqueid']]['mohtime']));delete channels[_0x2f2aae[_0x75bd('0x8')]]['musiconholdstartAt'];}}}catch(_0x2e1a71){utils['error'](util[_0x75bd('0x9')](_0x75bd('0x45'),_0x2f2aae[_0x75bd('0x8')]),_0x2e1a71);}};exports['varset']=function(_0x10021c){try{if(!_[_0x75bd('0x21')](channels[_0x10021c[_0x75bd('0x8')]])){utils['debug'](util[_0x75bd('0x9')](_0x75bd('0x46'),_0x10021c['uniqueid']),_0x10021c);if(!_[_0x75bd('0x21')](_0x10021c['variable']['xmd-originatecalleridnum'])){utils[_0x75bd('0x17')](util[_0x75bd('0x9')]('[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s',_0x10021c[_0x75bd('0x8')],_0x10021c[_0x75bd('0x47')]));channels[_0x10021c[_0x75bd('0x8')]]['source']=_0x10021c[_0x75bd('0x47')];}if(!_[_0x75bd('0x21')](_0x10021c[_0x75bd('0x48')]['xmd-phone'])){utils[_0x75bd('0x17')](util['format'](_0x75bd('0x49'),_0x10021c['uniqueid'],_0x10021c[_0x75bd('0x47')]));channels[_0x10021c['uniqueid']][_0x75bd('0x4a')]=_0x10021c[_0x75bd('0x47')];channels[_0x10021c[_0x75bd('0x8')]][_0x75bd('0x2b')]='\x22'+_0x10021c[_0x75bd('0x47')]+'\x22\x20<'+_0x10021c['value']+'>';}if(!_['isNil'](_0x10021c[_0x75bd('0x48')][_0x75bd('0x4b')])||!_['isNil'](_0x10021c['variable'][_0x75bd('0x4c')])){utils[_0x75bd('0x17')](util['format'](_0x75bd('0x4d'),_0x10021c[_0x75bd('0x8')],!_[_0x75bd('0x21')](_0x10021c[_0x75bd('0x48')][_0x75bd('0x4b')])?_0x75bd('0x4b'):_0x75bd('0x4c'),_0x10021c['value']));channels[_0x10021c[_0x75bd('0x8')]][_0x75bd('0x2b')]=_0x10021c[_0x75bd('0x47')];}if(!_[_0x75bd('0x21')](_0x10021c[_0x75bd('0x48')][_0x75bd('0x4e')])||!_[_0x75bd('0x21')](_0x10021c[_0x75bd('0x48')][_0x75bd('0x4f')])){utils[_0x75bd('0x17')](util[_0x75bd('0x9')]('[%s][calls][varset]\x20variable:%s\x20value:%s',_0x10021c[_0x75bd('0x8')],!_['isNil'](_0x10021c[_0x75bd('0x48')]['xmd-queue'])?_0x75bd('0x4e'):_0x75bd('0x4f'),_0x10021c[_0x75bd('0x47')]));channels[_0x10021c[_0x75bd('0x8')]][_0x75bd('0x50')]=_0x75bd('0x51');channels[_0x10021c[_0x75bd('0x8')]][_0x75bd('0x52')]=_0x10021c[_0x75bd('0x47')];channels[_0x10021c['uniqueid']][_0x75bd('0xb')]=!![];}if(!_[_0x75bd('0x21')](_0x10021c['variable'][_0x75bd('0x53')])){utils[_0x75bd('0x17')](util[_0x75bd('0x9')]('[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s',_0x10021c['uniqueid'],_0x10021c['value']));channels[_0x10021c[_0x75bd('0x8')]][_0x75bd('0x54')]=_0x10021c[_0x75bd('0x47')];}if(!_[_0x75bd('0x21')](_0x10021c['variable'][_0x75bd('0x55')])){utils[_0x75bd('0x17')](util[_0x75bd('0x9')]('[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s',_0x10021c[_0x75bd('0x8')],_0x10021c[_0x75bd('0x47')]));channels[_0x10021c[_0x75bd('0x8')]][_0x75bd('0x56')]=_0x10021c[_0x75bd('0x47')];}if(!_['isNil'](_0x10021c[_0x75bd('0x48')][_0x75bd('0x57')])){utils[_0x75bd('0x17')](util['format'](_0x75bd('0x58'),_0x10021c[_0x75bd('0x8')],_0x10021c[_0x75bd('0x47')]));channels[_0x10021c['uniqueid']]['routeid']=_0x10021c['value'];}if(!_[_0x75bd('0x21')](_0x10021c['variable'][_0x75bd('0x59')])){utils[_0x75bd('0x17')](util[_0x75bd('0x9')](_0x75bd('0x5a'),_0x10021c[_0x75bd('0x8')],_0x10021c[_0x75bd('0x47')]));channels[_0x10021c[_0x75bd('0x8')]]['sipcallid']=_0x10021c['value'];}}}catch(_0x1b57a5){utils['error'](util[_0x75bd('0x9')](_0x75bd('0x46'),_0x10021c[_0x75bd('0x8')]),_0x1b57a5);}};exports['newexten']=function(_0x5dbf6c){try{if(!_[_0x75bd('0x21')](channels[_0x5dbf6c[_0x75bd('0x8')]])){utils[_0x75bd('0x15')](util['format'](_0x75bd('0x5b'),_0x5dbf6c[_0x75bd('0x8')]),_0x5dbf6c);utils['info'](util['format'](_0x75bd('0x5c'),_0x5dbf6c[_0x75bd('0x8')],_0x5dbf6c[_0x75bd('0x5d')],_0x5dbf6c[_0x75bd('0x5e')]));if(_0x5dbf6c['application'][_0x75bd('0x5f')]()==_0x75bd('0x60')&&_[_0x75bd('0x61')](_0x5dbf6c['appdata']['toLowerCase'](),_0x75bd('0x62'))){var _0x7190f6=_0x5dbf6c[_0x75bd('0x5e')]['split']('=');var _0x2f29e9=_0x7190f6[0x0]['substring'](_0x7190f6[0x0][_0x75bd('0x63')]('(')+0x1,_0x7190f6[0x0]['lastIndexOf'](')'));var _0x4992c5=_0x7190f6[0x1];channels[_0x5dbf6c[_0x75bd('0x8')]][_0x2f29e9]=_0x4992c5;}if(!_[_0x75bd('0x64')]([_0x75bd('0x2a'),_0x75bd('0x65'),_0x75bd('0x66'),_0x75bd('0x60'),'gotoif'],_0x5dbf6c[_0x75bd('0x5d')][_0x75bd('0x5f')]())){channels[_0x5dbf6c[_0x75bd('0x8')]][_0x75bd('0x50')]=_0x5dbf6c[_0x75bd('0x5d')];channels[_0x5dbf6c['uniqueid']][_0x75bd('0x52')]=_0x5dbf6c[_0x75bd('0x5e')];}}}catch(_0x676db1){utils[_0x75bd('0x1f')](util[_0x75bd('0x9')](_0x75bd('0x5b'),_0x5dbf6c[_0x75bd('0x8')]),_0x676db1);}}; \ No newline at end of file +var _0xf963=['systemanswertime','transfer','[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','destinationchannel','toNumber','[%s][calls][hangup]','callerid','calleridname','[%s][calls][hangup]\x20callerid:%s\x20reason:%s','cause-txt','diffTime','starttime','answertime','endtime','attendedtransfer','[%s][calls][attendedtransfer]','origtransfereruniqueid','localtwolinkedid','transfereechannel','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','secondtransfererchannel','userfield','_attended','transfertargetchannel','origtransfererchannel','musiconholdstart','[%s][calls][musiconholdstart]','musiconholdstartAt','[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s','musiconholdstop','[%s][calls][musiconholdstop]','[%s][calls][musiconholdstop]\x20mohtime:%s','mohtime','varset','variable','[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','value','source','xmd-phone','[%s][calls][varset]\x20variable:xmd-phone\x20value:%s','\x22\x20<','xmd-callerid-preview','xmd-callerid','xmd-queue','xmcs-queue','[%s][calls][varset]\x20variable:%s\x20value:%s','lastapplication','Queue','lastdata','xmd-contactid','xmd-cdrtype','type','outboundrouteid','[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s','routeid','sipcallid','[%s][calls][varset]\x20variable:sipcallid\x20value:%s','newexten','[%s][calls][newexten]','[%s][calls][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','startsWith','cdr','split','substring','lastIndexOf','hangup','noop','execif','set','gotoif','lodash','./transfers.controller','NO\x20ANSWER','ANSWERED','FAILED','uniqueid','info','format','[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','channel','membername','interface','calleridnum','connectedlinenum','accountcode','then','request','blinds','recording','newchannel','debug','[%s][calls][newchannel]','linkedid','[%s][calls][newchannel]\x20context:%s\x20exten:%s','context','exten','now','DOCUMENTATION','error','newstate','isNil','channelstate','[%s][calls][newstate]\x20context:%s\x20channel:%s'];(function(_0x100274,_0x3608d8){var _0x4345d8=function(_0x4e7873){while(--_0x4e7873){_0x100274['push'](_0x100274['shift']());}};_0x4345d8(++_0x3608d8);}(_0xf963,0x11d));var _0x3f96=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0xf963[_0x1ac595];return _0x455fff;};'use strict';var _=require(_0x3f96('0x0'));var util=require('util');var utils=require('./utils');var transfers=require(_0x3f96('0x1'));var dispositions=[_0x3f96('0x2'),'FAILED','FAILED',_0x3f96('0x2'),_0x3f96('0x2'),_0x3f96('0x2'),_0x3f96('0x3'),'BUSY',_0x3f96('0x4'),'FAILED',_0x3f96('0x4')];var channels={};function writeDB(_0x43633b){var _0x422ffd;if(transfers['blinds'][_0x43633b[_0x3f96('0x5')]]){_0x422ffd=_0x43633b[_0x3f96('0x5')];_0x43633b['uniqueid']=transfers['blinds'][_0x43633b['uniqueid']]['transfereeuniqueid'];}utils[_0x3f96('0x6')](util[_0x3f96('0x7')](_0x3f96('0x8'),_0x43633b[_0x3f96('0x5')],_0x43633b[_0x3f96('0x9')],_0x43633b['queue'],_0x43633b[_0x3f96('0xa')],_0x43633b[_0x3f96('0xb')],_0x43633b[_0x3f96('0xc')],_0x43633b[_0x3f96('0xd')],_0x43633b['lastevent']));if(_0x43633b[_0x3f96('0xe')]){utils['getUserByInternal'](_0x43633b[_0x3f96('0xe')])[_0x3f96('0xf')](function(_0xdf9325){if(_0xdf9325){_0x43633b['UserId']=_0xdf9325['id'];}utils[_0x3f96('0x10')]('CreateVoiceCallReport',_0x43633b);});}else{utils[_0x3f96('0x10')]('CreateVoiceCallReport',_0x43633b);}if(channels[_0x43633b['uniqueid']]){delete channels[_0x43633b['uniqueid']];}else if(_0x422ffd&&channels[_0x422ffd]){if(!transfers[_0x3f96('0x11')][_0x422ffd][_0x3f96('0x12')])delete transfers[_0x3f96('0x11')][_0x422ffd];delete channels[_0x422ffd];}}exports[_0x3f96('0x13')]=function(_0x569d2e){try{utils[_0x3f96('0x14')](util[_0x3f96('0x7')](_0x3f96('0x15'),_0x569d2e['uniqueid']),_0x569d2e);if(_0x569d2e[_0x3f96('0x5')]==_0x569d2e[_0x3f96('0x16')]&&_0x569d2e[_0x3f96('0x9')]!='OutgoingSpoolFailed'){utils[_0x3f96('0x6')](util[_0x3f96('0x7')](_0x3f96('0x17'),_0x569d2e[_0x3f96('0x5')],_0x569d2e[_0x3f96('0x18')],_0x569d2e[_0x3f96('0x19')]));channels[_0x569d2e['uniqueid']]={'uniqueid':_0x569d2e[_0x3f96('0x5')],'accountcode':_0x569d2e['accountcode'],'source':_0x569d2e[_0x3f96('0xc')],'destination':_0x569d2e[_0x3f96('0x19')],'destinationcontext':_0x569d2e['context'],'channel':_0x569d2e[_0x3f96('0x9')],'starttime':utils[_0x3f96('0x1a')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':'NO\x20ANSWER','amaflags':_0x3f96('0x1b')};}}catch(_0x3bde31){utils[_0x3f96('0x1c')](util[_0x3f96('0x7')](_0x3f96('0x15'),_0x569d2e[_0x3f96('0x5')]),_0x3bde31);}};exports[_0x3f96('0x1d')]=function(_0x4fbcd9){try{utils['debug'](util[_0x3f96('0x7')]('[%s][calls][newstate]',_0x4fbcd9['uniqueid']),_0x4fbcd9);if(!_[_0x3f96('0x1e')](channels[_0x4fbcd9['uniqueid']])&&_0x4fbcd9[_0x3f96('0x1f')]==0x6){utils['info'](util[_0x3f96('0x7')](_0x3f96('0x20'),_0x4fbcd9[_0x3f96('0x5')],_0x4fbcd9[_0x3f96('0x18')],_0x4fbcd9[_0x3f96('0x9')]));if(_[_0x3f96('0x1e')](channels[_0x4fbcd9['uniqueid']][_0x3f96('0x21')])){channels[_0x4fbcd9[_0x3f96('0x5')]]['systemanswertime']=utils[_0x3f96('0x1a')]();}}else if(!_[_0x3f96('0x1e')](channels[_0x4fbcd9['linkedid']])&&_0x4fbcd9[_0x3f96('0x1f')]==0x6&&_0x4fbcd9['context']!=_0x3f96('0x22')){utils['info'](util[_0x3f96('0x7')](_0x3f96('0x23'),_0x4fbcd9[_0x3f96('0x5')],_0x4fbcd9[_0x3f96('0x16')],_0x4fbcd9[_0x3f96('0x18')],_0x4fbcd9[_0x3f96('0x9')]));channels[_0x4fbcd9[_0x3f96('0x16')]][_0x3f96('0xe')]=_0x4fbcd9[_0x3f96('0xe')];channels[_0x4fbcd9[_0x3f96('0x16')]][_0x3f96('0x24')]=_0x4fbcd9[_0x3f96('0x9')];if(_[_0x3f96('0x1e')](channels[_0x4fbcd9['linkedid']]['answertime'])){channels[_0x4fbcd9[_0x3f96('0x16')]]['answertime']=utils[_0x3f96('0x1a')]();}channels[_0x4fbcd9[_0x3f96('0x16')]]['disposition']=dispositions[_[_0x3f96('0x25')](_0x4fbcd9['channelstate'])]||_0x3f96('0x3');}}catch(_0x4d5019){utils[_0x3f96('0x1c')](util[_0x3f96('0x7')]('[%s][calls][newstate]',_0x4fbcd9[_0x3f96('0x5')]),_0x4d5019);}};exports['hangup']=function(_0x7a2d24){try{if(!_['isNil'](channels[_0x7a2d24[_0x3f96('0x5')]])){utils[_0x3f96('0x14')](util[_0x3f96('0x7')](_0x3f96('0x26'),_0x7a2d24[_0x3f96('0x5')]),_0x7a2d24);if(_['isNil'](channels[_0x7a2d24[_0x3f96('0x5')]][_0x3f96('0x27')])){channels[_0x7a2d24[_0x3f96('0x5')]][_0x3f96('0x27')]=_0x7a2d24[_0x3f96('0x28')]+'\x20<'+_0x7a2d24[_0x3f96('0xc')]+'>';}utils['info'](util[_0x3f96('0x7')](_0x3f96('0x29'),_0x7a2d24['uniqueid'],channels[_0x7a2d24[_0x3f96('0x5')]][_0x3f96('0x27')],_0x7a2d24[_0x3f96('0x2a')]));channels[_0x7a2d24[_0x3f96('0x5')]]['endtime']=utils[_0x3f96('0x1a')]();channels[_0x7a2d24[_0x3f96('0x5')]]['duration']=utils[_0x3f96('0x2b')](channels[_0x7a2d24['uniqueid']]['endtime'],channels[_0x7a2d24[_0x3f96('0x5')]][_0x3f96('0x2c')]);channels[_0x7a2d24[_0x3f96('0x5')]]['billableseconds']=channels[_0x7a2d24[_0x3f96('0x5')]][_0x3f96('0x2d')]?utils['diffTime'](channels[_0x7a2d24[_0x3f96('0x5')]][_0x3f96('0x2e')],channels[_0x7a2d24[_0x3f96('0x5')]]['answertime']):0x0;writeDB(channels[_0x7a2d24[_0x3f96('0x5')]]);}}catch(_0x2c8a5b){utils[_0x3f96('0x1c')](util[_0x3f96('0x7')](_0x3f96('0x26'),_0x7a2d24['uniqueid']),_0x2c8a5b);}};exports[_0x3f96('0x2f')]=function(_0x415fa5){try{if(!_[_0x3f96('0x1e')](channels[_0x415fa5['localtwolinkedid']])){utils['debug'](util['format'](_0x3f96('0x30'),_0x415fa5[_0x3f96('0x31')]),_0x415fa5);if(channels[_0x415fa5[_0x3f96('0x32')]]['channel']==_0x415fa5[_0x3f96('0x33')]){utils['info'](util[_0x3f96('0x7')](_0x3f96('0x34'),_0x415fa5[_0x3f96('0x31')],_0x415fa5[_0x3f96('0x32')],_0x415fa5[_0x3f96('0x35')]));channels[_0x415fa5[_0x3f96('0x32')]][_0x3f96('0x24')]=_0x415fa5[_0x3f96('0x35')];channels[_0x415fa5[_0x3f96('0x32')]][_0x3f96('0x36')]=_0x3f96('0x37');}else if(channels[_0x415fa5[_0x3f96('0x32')]][_0x3f96('0x9')]=_0x415fa5[_0x3f96('0x38')]){utils['info'](util[_0x3f96('0x7')](_0x3f96('0x34'),_0x415fa5[_0x3f96('0x31')],_0x415fa5['localtwolinkedid'],_0x415fa5[_0x3f96('0x39')]));channels[_0x415fa5[_0x3f96('0x32')]][_0x3f96('0x24')]=_0x415fa5['origtransfererchannel'];channels[_0x415fa5[_0x3f96('0x32')]][_0x3f96('0x36')]=_0x3f96('0x37');}}}catch(_0x12fb89){utils[_0x3f96('0x1c')](util[_0x3f96('0x7')](_0x3f96('0x30'),_0x415fa5[_0x3f96('0x31')]),_0x12fb89);}};exports[_0x3f96('0x3a')]=function(_0x40a455){try{if(!_['isNil'](channels[_0x40a455['uniqueid']])){utils[_0x3f96('0x14')](util[_0x3f96('0x7')](_0x3f96('0x3b'),_0x40a455[_0x3f96('0x5')]),_0x40a455);channels[_0x40a455['uniqueid']][_0x3f96('0x3c')]=utils[_0x3f96('0x1a')]();utils[_0x3f96('0x6')](util[_0x3f96('0x7')](_0x3f96('0x3d'),_0x40a455[_0x3f96('0x5')],channels[_0x40a455[_0x3f96('0x5')]][_0x3f96('0x3c')]));}}catch(_0x233f5c){utils['error'](util['format']('[%s][calls][musiconholdstart]',_0x40a455[_0x3f96('0x5')]),_0x233f5c);}};exports[_0x3f96('0x3e')]=function(_0x1a2505){try{if(!_['isNil'](channels[_0x1a2505[_0x3f96('0x5')]])){utils['debug'](util[_0x3f96('0x7')](_0x3f96('0x3f'),_0x1a2505[_0x3f96('0x5')]),_0x1a2505);if(!_[_0x3f96('0x1e')](channels[_0x1a2505['uniqueid']][_0x3f96('0x3c')])){channels[_0x1a2505['uniqueid']]['mohtime']+=utils[_0x3f96('0x2b')](utils['now'](),channels[_0x1a2505[_0x3f96('0x5')]][_0x3f96('0x3c')]);utils[_0x3f96('0x6')](util['format'](_0x3f96('0x40'),_0x1a2505[_0x3f96('0x5')],channels[_0x1a2505[_0x3f96('0x5')]][_0x3f96('0x41')]));delete channels[_0x1a2505[_0x3f96('0x5')]][_0x3f96('0x3c')];}}}catch(_0x1a5d4f){utils[_0x3f96('0x1c')](util[_0x3f96('0x7')]('[%s][calls][musiconholdstop]',_0x1a2505[_0x3f96('0x5')]),_0x1a5d4f);}};exports[_0x3f96('0x42')]=function(_0x26e140){try{if(!_['isNil'](channels[_0x26e140[_0x3f96('0x5')]])){utils['debug'](util[_0x3f96('0x7')]('[%s][calls][varset]',_0x26e140[_0x3f96('0x5')]),_0x26e140);if(!_['isNil'](_0x26e140[_0x3f96('0x43')]['xmd-originatecalleridnum'])){utils[_0x3f96('0x6')](util['format'](_0x3f96('0x44'),_0x26e140[_0x3f96('0x5')],_0x26e140[_0x3f96('0x45')]));channels[_0x26e140[_0x3f96('0x5')]][_0x3f96('0x46')]=_0x26e140[_0x3f96('0x45')];}if(!_[_0x3f96('0x1e')](_0x26e140[_0x3f96('0x43')][_0x3f96('0x47')])){utils[_0x3f96('0x6')](util['format'](_0x3f96('0x48'),_0x26e140['uniqueid'],_0x26e140[_0x3f96('0x45')]));channels[_0x26e140[_0x3f96('0x5')]]['destination']=_0x26e140[_0x3f96('0x45')];channels[_0x26e140[_0x3f96('0x5')]][_0x3f96('0x27')]='\x22'+_0x26e140[_0x3f96('0x45')]+_0x3f96('0x49')+_0x26e140[_0x3f96('0x45')]+'>';}if(!_['isNil'](_0x26e140[_0x3f96('0x43')]['xmd-callerid-preview'])||!_[_0x3f96('0x1e')](_0x26e140[_0x3f96('0x43')]['xmd-callerid'])){utils['info'](util['format']('[%s][calls][varset]\x20variable:%s\x20value:%s',_0x26e140[_0x3f96('0x5')],!_['isNil'](_0x26e140[_0x3f96('0x43')]['xmd-callerid-preview'])?_0x3f96('0x4a'):_0x3f96('0x4b'),_0x26e140[_0x3f96('0x45')]));channels[_0x26e140[_0x3f96('0x5')]][_0x3f96('0x27')]=_0x26e140[_0x3f96('0x45')];}if(!_[_0x3f96('0x1e')](_0x26e140[_0x3f96('0x43')][_0x3f96('0x4c')])||!_[_0x3f96('0x1e')](_0x26e140[_0x3f96('0x43')][_0x3f96('0x4d')])){utils[_0x3f96('0x6')](util['format'](_0x3f96('0x4e'),_0x26e140[_0x3f96('0x5')],!_[_0x3f96('0x1e')](_0x26e140['variable']['xmd-queue'])?_0x3f96('0x4c'):_0x3f96('0x4d'),_0x26e140[_0x3f96('0x45')]));channels[_0x26e140[_0x3f96('0x5')]][_0x3f96('0x4f')]=_0x3f96('0x50');channels[_0x26e140[_0x3f96('0x5')]][_0x3f96('0x51')]=_0x26e140[_0x3f96('0x45')];channels[_0x26e140[_0x3f96('0x5')]]['queue']=!![];}if(!_[_0x3f96('0x1e')](_0x26e140[_0x3f96('0x43')][_0x3f96('0x52')])){utils['info'](util['format']('[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s',_0x26e140[_0x3f96('0x5')],_0x26e140[_0x3f96('0x45')]));channels[_0x26e140['uniqueid']]['ContactId']=_0x26e140['value'];}if(!_['isNil'](_0x26e140[_0x3f96('0x43')][_0x3f96('0x53')])){utils[_0x3f96('0x6')](util['format']('[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s',_0x26e140[_0x3f96('0x5')],_0x26e140[_0x3f96('0x45')]));channels[_0x26e140[_0x3f96('0x5')]][_0x3f96('0x54')]=_0x26e140[_0x3f96('0x45')];}if(!_[_0x3f96('0x1e')](_0x26e140[_0x3f96('0x43')][_0x3f96('0x55')])){utils[_0x3f96('0x6')](util['format'](_0x3f96('0x56'),_0x26e140['uniqueid'],_0x26e140['value']));channels[_0x26e140[_0x3f96('0x5')]][_0x3f96('0x57')]=_0x26e140[_0x3f96('0x45')];}if(!_['isNil'](_0x26e140['variable'][_0x3f96('0x58')])){utils[_0x3f96('0x6')](util['format'](_0x3f96('0x59'),_0x26e140[_0x3f96('0x5')],_0x26e140[_0x3f96('0x45')]));channels[_0x26e140['uniqueid']][_0x3f96('0x58')]=_0x26e140[_0x3f96('0x45')];}}}catch(_0x100826){utils[_0x3f96('0x1c')](util[_0x3f96('0x7')]('[%s][calls][varset]',_0x26e140[_0x3f96('0x5')]),_0x100826);}};exports[_0x3f96('0x5a')]=function(_0x4f12bd){try{if(!_[_0x3f96('0x1e')](channels[_0x4f12bd['uniqueid']])){utils['debug'](util['format'](_0x3f96('0x5b'),_0x4f12bd[_0x3f96('0x5')]),_0x4f12bd);utils[_0x3f96('0x6')](util[_0x3f96('0x7')](_0x3f96('0x5c'),_0x4f12bd[_0x3f96('0x5')],_0x4f12bd[_0x3f96('0x5d')],_0x4f12bd[_0x3f96('0x5e')]));if(_0x4f12bd[_0x3f96('0x5d')][_0x3f96('0x5f')]()=='set'&&_[_0x3f96('0x60')](_0x4f12bd['appdata'][_0x3f96('0x5f')](),_0x3f96('0x61'))){var _0x2a7370=_0x4f12bd['appdata'][_0x3f96('0x62')]('=');var _0x220873=_0x2a7370[0x0][_0x3f96('0x63')](_0x2a7370[0x0][_0x3f96('0x64')]('(')+0x1,_0x2a7370[0x0][_0x3f96('0x64')](')'));var _0x4fbbcf=_0x2a7370[0x1];channels[_0x4f12bd[_0x3f96('0x5')]][_0x220873]=_0x4fbbcf;}if(!_['includes']([_0x3f96('0x65'),_0x3f96('0x66'),_0x3f96('0x67'),_0x3f96('0x68'),_0x3f96('0x69')],_0x4f12bd[_0x3f96('0x5d')][_0x3f96('0x5f')]())){channels[_0x4f12bd[_0x3f96('0x5')]][_0x3f96('0x4f')]=_0x4f12bd['application'];channels[_0x4f12bd[_0x3f96('0x5')]][_0x3f96('0x51')]=_0x4f12bd[_0x3f96('0x5e')];}}}catch(_0x5a7808){utils[_0x3f96('0x1c')](util[_0x3f96('0x7')](_0x3f96('0x5b'),_0x4f12bd['uniqueid']),_0x5a7808);}}; \ No newline at end of file diff --git a/server/services/xdr/core.controller.js b/server/services/xdr/core.controller.js index 1af766e..f796d3a 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 _0xcc70=['error','[core]\x20error','close','info','managerevent','./utils','connect','[core]\x20shutdown','fullybooted','[core]\x20fullybooted'];(function(_0x403fc7,_0x32931a){var _0x5d0827=function(_0x5ea698){while(--_0x5ea698){_0x403fc7['push'](_0x403fc7['shift']());}};_0x5d0827(++_0x32931a);}(_0xcc70,0xa5));var _0x0cc7=function(_0x1d94d1,_0x347bb8){_0x1d94d1=_0x1d94d1-0x0;var _0x23c397=_0xcc70[_0x1d94d1];return _0x23c397;};'use strict';var utils=require(_0x0cc7('0x0'));exports[_0x0cc7('0x1')]=function(){utils['info']('[core]\x20connected');};exports['shutdown']=function(){utils['info'](_0x0cc7('0x2'));};exports[_0x0cc7('0x3')]=function(){utils['info'](_0x0cc7('0x4'));};exports[_0x0cc7('0x5')]=function(_0x2d1b3e){utils[_0x0cc7('0x5')](_0x0cc7('0x6'),_0x2d1b3e);};exports[_0x0cc7('0x7')]=function(){utils[_0x0cc7('0x8')]('[core]\x20close');};exports[_0x0cc7('0x9')]=function(_0x49464f){}; \ No newline at end of file +var _0xafbc=['[core]\x20connected','shutdown','[core]\x20shutdown','fullybooted','[core]\x20fullybooted','error','[core]\x20error','close','[core]\x20close','managerevent','./utils','info'];(function(_0x24d1fc,_0x114691){var _0xcc71e4=function(_0x1c32d1){while(--_0x1c32d1){_0x24d1fc['push'](_0x24d1fc['shift']());}};_0xcc71e4(++_0x114691);}(_0xafbc,0xa6));var _0xcafb=function(_0x106ce0,_0x53c1d4){_0x106ce0=_0x106ce0-0x0;var _0x4c42dd=_0xafbc[_0x106ce0];return _0x4c42dd;};'use strict';var utils=require(_0xcafb('0x0'));exports['connect']=function(){utils[_0xcafb('0x1')](_0xcafb('0x2'));};exports[_0xcafb('0x3')]=function(){utils[_0xcafb('0x1')](_0xcafb('0x4'));};exports[_0xcafb('0x5')]=function(){utils[_0xcafb('0x1')](_0xcafb('0x6'));};exports[_0xcafb('0x7')]=function(_0x501c6f){utils['error'](_0xcafb('0x8'),_0x501c6f);};exports[_0xcafb('0x9')]=function(){utils['info'](_0xcafb('0xa'));};exports[_0xcafb('0xb')]=function(_0xc36343){}; \ No newline at end of file diff --git a/server/services/xdr/dials.controller.js b/server/services/xdr/dials.controller.js index f8b436f..00158d8 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 _0x393f=['split','error','[%s][dials][varset]','isNil','variable','outboundrouteid','[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s','value','dialbegin','[%s][dials][dialbegin]','now','lastevent','called','[%s][dials][hangup]\x20starttime:%s\x20lastevent:called','starttime','dialend','[%s][dials][dialend]','ANSWER','assign','[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect','[%s][dials][dialend]\x20dialstatus:%s','hangup','calleridnum','complete','duration','endtime','holdtime','diffTime','answertime','lodash','util','./utils','info','format','[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s','uniqueid','channel','dialstring','connectedlinenum','dialstatus','CreateVoiceDialReport','newexten','debug','[%s][dials][newexten]','[%s][dials][newexten]\x20application:%s\x20appdata:%s','appdata','application','toLowerCase','set','cdr(routeid)'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x393f,0x117));var _0xf393=function(_0x19fc86,_0x3f25b6){_0x19fc86=_0x19fc86-0x0;var _0x2da0f4=_0x393f[_0x19fc86];return _0x2da0f4;};'use strict';var _=require(_0xf393('0x0'));var util=require(_0xf393('0x1'));var utils=require(_0xf393('0x2'));var dials={};function writeDB(_0x119096){utils[_0xf393('0x3')](util[_0xf393('0x4')](_0xf393('0x5'),_0x119096[_0xf393('0x6')],_0x119096[_0xf393('0x7')],_0x119096[_0xf393('0x8')],_0x119096['calleridnum'],_0x119096[_0xf393('0x9')],_0x119096[_0xf393('0xa')]));utils['request'](_0xf393('0xb'),_0x119096);delete dials[_0x119096[_0xf393('0x6')]];}exports[_0xf393('0xc')]=function(_0x2fd793){try{utils[_0xf393('0xd')](util[_0xf393('0x4')](_0xf393('0xe'),_0x2fd793[_0xf393('0x6')]),_0x2fd793);utils[_0xf393('0x3')](util[_0xf393('0x4')](_0xf393('0xf'),_0x2fd793[_0xf393('0x6')],_0x2fd793['application'],_0x2fd793[_0xf393('0x10')]));if(_0x2fd793[_0xf393('0x11')][_0xf393('0x12')]()==_0xf393('0x13')&&_['startsWith'](_0x2fd793[_0xf393('0x10')][_0xf393('0x12')](),_0xf393('0x14'))){var _0x77266e=_0x2fd793['appdata'][_0xf393('0x15')]('=');dials[_0x2fd793[_0xf393('0x6')]]={'routeId':_0x77266e[0x1]};}}catch(_0x1c648c){utils[_0xf393('0x16')](util[_0xf393('0x4')]('[%s][dials][newexten]',_0x2fd793[_0xf393('0x6')]),_0x1c648c);}};exports['varset']=function(_0x4a35da){try{utils[_0xf393('0xd')](util[_0xf393('0x4')](_0xf393('0x17'),_0x4a35da['uniqueid']),_0x4a35da);if(!_[_0xf393('0x18')](_0x4a35da[_0xf393('0x19')][_0xf393('0x1a')])){utils['info'](util[_0xf393('0x4')](_0xf393('0x1b'),_0x4a35da[_0xf393('0x6')],_0x4a35da[_0xf393('0x1c')]));dials[_0x4a35da[_0xf393('0x6')]]={'routeId':_0x4a35da[_0xf393('0x1c')]};}}catch(_0x335fc1){utils[_0xf393('0x16')](util[_0xf393('0x4')](_0xf393('0x17'),_0x4a35da['uniqueid']),_0x335fc1);}};exports[_0xf393('0x1d')]=function(_0xc8e17f){try{if(!_[_0xf393('0x18')](dials[_0xc8e17f[_0xf393('0x6')]])){utils[_0xf393('0xd')](util[_0xf393('0x4')](_0xf393('0x1e'),_0xc8e17f[_0xf393('0x6')]),_0xc8e17f);dials[_0xc8e17f[_0xf393('0x6')]]=_['assign'](dials[_0xc8e17f[_0xf393('0x6')]],_0xc8e17f);dials[_0xc8e17f['uniqueid']]['starttime']=utils[_0xf393('0x1f')]();dials[_0xc8e17f['uniqueid']][_0xf393('0x20')]=_0xf393('0x21');utils[_0xf393('0x3')](util[_0xf393('0x4')](_0xf393('0x22'),_0xc8e17f[_0xf393('0x6')],dials[_0xc8e17f[_0xf393('0x6')]][_0xf393('0x23')]));}}catch(_0x201d90){utils[_0xf393('0x16')](util[_0xf393('0x4')](_0xf393('0x1e'),_0xc8e17f['uniqueid']),_0x201d90);}};exports[_0xf393('0x24')]=function(_0x1faa9f){try{if(!_[_0xf393('0x18')](dials[_0x1faa9f[_0xf393('0x6')]])){utils[_0xf393('0xd')](util[_0xf393('0x4')](_0xf393('0x25'),_0x1faa9f[_0xf393('0x6')]),_0x1faa9f);dials[_0x1faa9f[_0xf393('0x6')]][_0xf393('0xa')]=_0x1faa9f[_0xf393('0xa')];if(_0x1faa9f[_0xf393('0xa')]==_0xf393('0x26')){dials[_0x1faa9f[_0xf393('0x6')]]=_[_0xf393('0x27')](dials[_0x1faa9f['uniqueid']],_0x1faa9f);dials[_0x1faa9f[_0xf393('0x6')]]['answertime']=utils[_0xf393('0x1f')]();dials[_0x1faa9f['uniqueid']]['lastevent']='connect';utils[_0xf393('0x3')](util[_0xf393('0x4')](_0xf393('0x28'),_0x1faa9f[_0xf393('0x6')],_0x1faa9f[_0xf393('0xa')],dials[_0x1faa9f[_0xf393('0x6')]]['answertime']));}else{utils[_0xf393('0x3')](util[_0xf393('0x4')](_0xf393('0x29'),_0x1faa9f[_0xf393('0x6')],_0x1faa9f[_0xf393('0xa')]));}}}catch(_0x3ee49a){utils[_0xf393('0x16')](util[_0xf393('0x4')](_0xf393('0x25'),_0x1faa9f[_0xf393('0x6')]),_0x3ee49a);}};exports[_0xf393('0x2a')]=function(_0x5e2fec){try{if(!_[_0xf393('0x18')](dials[_0x5e2fec[_0xf393('0x6')]])){utils[_0xf393('0xd')](util[_0xf393('0x4')]('[%s][dials][hangup]',_0x5e2fec['uniqueid']),_0x5e2fec);utils[_0xf393('0x3')](util[_0xf393('0x4')]('[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s',_0x5e2fec[_0xf393('0x6')],_0x5e2fec[_0xf393('0x2b')],_0x5e2fec['calleridname'],_0x5e2fec['cause-txt']));dials[_0x5e2fec[_0xf393('0x6')]]=_['assign'](dials[_0x5e2fec[_0xf393('0x6')]],{'endtime':utils['now'](),'lastevent':_0xf393('0x2c')});dials[_0x5e2fec[_0xf393('0x6')]][_0xf393('0x2d')]=utils['diffTime'](dials[_0x5e2fec[_0xf393('0x6')]][_0xf393('0x2e')],dials[_0x5e2fec[_0xf393('0x6')]][_0xf393('0x23')]);dials[_0x5e2fec[_0xf393('0x6')]][_0xf393('0x2f')]=utils[_0xf393('0x30')](dials[_0x5e2fec[_0xf393('0x6')]][_0xf393('0x31')]||dials[_0x5e2fec[_0xf393('0x6')]][_0xf393('0x2e')],dials[_0x5e2fec['uniqueid']]['starttime']);dials[_0x5e2fec[_0xf393('0x6')]]['billableseconds']=dials[_0x5e2fec['uniqueid']][_0xf393('0x31')]?utils[_0xf393('0x30')](dials[_0x5e2fec[_0xf393('0x6')]]['endtime'],dials[_0x5e2fec[_0xf393('0x6')]][_0xf393('0x31')]):0x0;writeDB(dials[_0x5e2fec['uniqueid']]);}}catch(_0x16d201){utils[_0xf393('0x16')](util['format']('[%s][dials][hangup]',_0x5e2fec['uniqueid']),_0x16d201);}}; \ No newline at end of file +var _0x2bdb=['[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s','value','[%s][dials][dialbegin]','assign','lastevent','called','[%s][dials][hangup]\x20starttime:%s\x20lastevent:called','[%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]','complete','duration','diffTime','endtime','starttime','holdtime','lodash','./utils','info','format','[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s','uniqueid','channel','dialstring','calleridnum','connectedlinenum','dialstatus','request','CreateVoiceDialReport','newexten','[%s][dials][newexten]','[%s][dials][newexten]\x20application:%s\x20appdata:%s','application','toLowerCase','set','appdata','cdr(routeid)','split','error','debug','[%s][dials][varset]','isNil','variable','outboundrouteid'];(function(_0x19ac7c,_0x2d0d9d){var _0x1d641f=function(_0x397246){while(--_0x397246){_0x19ac7c['push'](_0x19ac7c['shift']());}};_0x1d641f(++_0x2d0d9d);}(_0x2bdb,0xac));var _0xb2bd=function(_0x49cfc7,_0x3a8634){_0x49cfc7=_0x49cfc7-0x0;var _0x108050=_0x2bdb[_0x49cfc7];return _0x108050;};'use strict';var _=require(_0xb2bd('0x0'));var util=require('util');var utils=require(_0xb2bd('0x1'));var dials={};function writeDB(_0x1809d3){utils[_0xb2bd('0x2')](util[_0xb2bd('0x3')](_0xb2bd('0x4'),_0x1809d3[_0xb2bd('0x5')],_0x1809d3[_0xb2bd('0x6')],_0x1809d3[_0xb2bd('0x7')],_0x1809d3[_0xb2bd('0x8')],_0x1809d3[_0xb2bd('0x9')],_0x1809d3[_0xb2bd('0xa')]));utils[_0xb2bd('0xb')](_0xb2bd('0xc'),_0x1809d3);delete dials[_0x1809d3['uniqueid']];}exports[_0xb2bd('0xd')]=function(_0x3baf86){try{utils['debug'](util['format'](_0xb2bd('0xe'),_0x3baf86[_0xb2bd('0x5')]),_0x3baf86);utils['info'](util[_0xb2bd('0x3')](_0xb2bd('0xf'),_0x3baf86[_0xb2bd('0x5')],_0x3baf86[_0xb2bd('0x10')],_0x3baf86['appdata']));if(_0x3baf86['application'][_0xb2bd('0x11')]()==_0xb2bd('0x12')&&_['startsWith'](_0x3baf86[_0xb2bd('0x13')][_0xb2bd('0x11')](),_0xb2bd('0x14'))){var _0x4f5431=_0x3baf86['appdata'][_0xb2bd('0x15')]('=');dials[_0x3baf86[_0xb2bd('0x5')]]={'routeId':_0x4f5431[0x1]};}}catch(_0x4ce81f){utils[_0xb2bd('0x16')](util[_0xb2bd('0x3')](_0xb2bd('0xe'),_0x3baf86[_0xb2bd('0x5')]),_0x4ce81f);}};exports['varset']=function(_0x3741a9){try{utils[_0xb2bd('0x17')](util[_0xb2bd('0x3')](_0xb2bd('0x18'),_0x3741a9[_0xb2bd('0x5')]),_0x3741a9);if(!_[_0xb2bd('0x19')](_0x3741a9[_0xb2bd('0x1a')][_0xb2bd('0x1b')])){utils[_0xb2bd('0x2')](util['format'](_0xb2bd('0x1c'),_0x3741a9[_0xb2bd('0x5')],_0x3741a9[_0xb2bd('0x1d')]));dials[_0x3741a9['uniqueid']]={'routeId':_0x3741a9['value']};}}catch(_0x2125ee){utils[_0xb2bd('0x16')](util['format'](_0xb2bd('0x18'),_0x3741a9['uniqueid']),_0x2125ee);}};exports['dialbegin']=function(_0x5911bf){try{if(!_[_0xb2bd('0x19')](dials[_0x5911bf[_0xb2bd('0x5')]])){utils['debug'](util[_0xb2bd('0x3')](_0xb2bd('0x1e'),_0x5911bf[_0xb2bd('0x5')]),_0x5911bf);dials[_0x5911bf[_0xb2bd('0x5')]]=_[_0xb2bd('0x1f')](dials[_0x5911bf[_0xb2bd('0x5')]],_0x5911bf);dials[_0x5911bf[_0xb2bd('0x5')]]['starttime']=utils['now']();dials[_0x5911bf[_0xb2bd('0x5')]][_0xb2bd('0x20')]=_0xb2bd('0x21');utils[_0xb2bd('0x2')](util[_0xb2bd('0x3')](_0xb2bd('0x22'),_0x5911bf['uniqueid'],dials[_0x5911bf[_0xb2bd('0x5')]]['starttime']));}}catch(_0x4e6fba){utils[_0xb2bd('0x16')](util[_0xb2bd('0x3')](_0xb2bd('0x1e'),_0x5911bf[_0xb2bd('0x5')]),_0x4e6fba);}};exports['dialend']=function(_0x16fd34){try{if(!_[_0xb2bd('0x19')](dials[_0x16fd34[_0xb2bd('0x5')]])){utils[_0xb2bd('0x17')](util['format'](_0xb2bd('0x23'),_0x16fd34[_0xb2bd('0x5')]),_0x16fd34);dials[_0x16fd34[_0xb2bd('0x5')]][_0xb2bd('0xa')]=_0x16fd34[_0xb2bd('0xa')];if(_0x16fd34[_0xb2bd('0xa')]==_0xb2bd('0x24')){dials[_0x16fd34[_0xb2bd('0x5')]]=_[_0xb2bd('0x1f')](dials[_0x16fd34['uniqueid']],_0x16fd34);dials[_0x16fd34['uniqueid']][_0xb2bd('0x25')]=utils[_0xb2bd('0x26')]();dials[_0x16fd34['uniqueid']][_0xb2bd('0x20')]=_0xb2bd('0x27');utils[_0xb2bd('0x2')](util[_0xb2bd('0x3')](_0xb2bd('0x28'),_0x16fd34[_0xb2bd('0x5')],_0x16fd34[_0xb2bd('0xa')],dials[_0x16fd34[_0xb2bd('0x5')]][_0xb2bd('0x25')]));}else{utils['info'](util[_0xb2bd('0x3')](_0xb2bd('0x29'),_0x16fd34['uniqueid'],_0x16fd34['dialstatus']));}}}catch(_0x119e21){utils[_0xb2bd('0x16')](util[_0xb2bd('0x3')](_0xb2bd('0x23'),_0x16fd34['uniqueid']),_0x119e21);}};exports[_0xb2bd('0x2a')]=function(_0x102e38){try{if(!_[_0xb2bd('0x19')](dials[_0x102e38['uniqueid']])){utils[_0xb2bd('0x17')](util[_0xb2bd('0x3')](_0xb2bd('0x2b'),_0x102e38[_0xb2bd('0x5')]),_0x102e38);utils[_0xb2bd('0x2')](util[_0xb2bd('0x3')]('[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s',_0x102e38[_0xb2bd('0x5')],_0x102e38[_0xb2bd('0x8')],_0x102e38['calleridname'],_0x102e38['cause-txt']));dials[_0x102e38[_0xb2bd('0x5')]]=_[_0xb2bd('0x1f')](dials[_0x102e38[_0xb2bd('0x5')]],{'endtime':utils['now'](),'lastevent':_0xb2bd('0x2c')});dials[_0x102e38[_0xb2bd('0x5')]][_0xb2bd('0x2d')]=utils[_0xb2bd('0x2e')](dials[_0x102e38['uniqueid']][_0xb2bd('0x2f')],dials[_0x102e38[_0xb2bd('0x5')]][_0xb2bd('0x30')]);dials[_0x102e38[_0xb2bd('0x5')]][_0xb2bd('0x31')]=utils[_0xb2bd('0x2e')](dials[_0x102e38[_0xb2bd('0x5')]]['answertime']||dials[_0x102e38[_0xb2bd('0x5')]]['endtime'],dials[_0x102e38[_0xb2bd('0x5')]][_0xb2bd('0x30')]);dials[_0x102e38[_0xb2bd('0x5')]]['billableseconds']=dials[_0x102e38[_0xb2bd('0x5')]]['answertime']?utils[_0xb2bd('0x2e')](dials[_0x102e38['uniqueid']][_0xb2bd('0x2f')],dials[_0x102e38[_0xb2bd('0x5')]][_0xb2bd('0x25')]):0x0;writeDB(dials[_0x102e38[_0xb2bd('0x5')]]);}}catch(_0x15a657){utils[_0xb2bd('0x16')](util[_0xb2bd('0x3')](_0xb2bd('0x2b'),_0x102e38['uniqueid']),_0x15a657);}}; \ No newline at end of file diff --git a/server/services/xdr/index.js b/server/services/xdr/index.js index 43b9b31..92ec31e 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 _0x5adb=['info','Asterisk\x20disabled\x20on\x20localhost','./calls.controller','./queues.controller','./recordings.controller','./members.controller','./dials.controller','./transfers.controller','./core.controller','connect','shutdown','fullybooted','close','managerevent','devicestatechange','debug','format','[%s][index][devicestatechange]','device','error','agentcalled','[%s][index][agentcalled]','uniqueid','agentringnoanswer','[%s][index][agentringnoanswer]','agentconnect','[%s][index][agentconnect]','[%s][index][agentcomplete]','agentcomplete','queuecallerabandon','[%s][index][queuecallerabandon]','queuecallerjoin','[%s][index][queuecallerjoin]','queuecallerleave','[%s][index][queuecallerleave]','musiconholdstart','[%s][index][musiconholdstart]','musiconholdstop','[%s][index][musiconholdstop]','newstate','[%s][index][newstate]','hangup','[%s][index][hangup]','cdr','[%s][index][cdr]','blindtransfer','[%s][index][blindtransfer]','attendedtransfer','[%s][index][attendedtransfer]','origtransfereruniqueid','varset','[%s][index][varset]','newexten','[%s][index][newexten]','[%s][index][newchannel]','newchannel','dialbegin','[%s]dialbegin','dialend','[%s][index][dialend]','../../config/environment','./utils','xdr','disabled','env','production','local','asterisk','port','username','password','keepConnected'];(function(_0x59e85f,_0x5c6331){var _0x578a18=function(_0x6f24a){while(--_0x6f24a){_0x59e85f['push'](_0x59e85f['shift']());}};_0x578a18(++_0x5c6331);}(_0x5adb,0x84));var _0xb5ad=function(_0x12f4d8,_0x1f6d82){_0x12f4d8=_0x12f4d8-0x0;var _0x265413=_0x5adb[_0x12f4d8];return _0x265413;};var AsteriskManager=require('asterisk-manager');var config=require(_0xb5ad('0x0'));var utils=require(_0xb5ad('0x1'));var util=require('util');var isXDREnabled=config[_0xb5ad('0x2')]&&!config['xdr'][_0xb5ad('0x3')];var isProduction=config[_0xb5ad('0x4')]===_0xb5ad('0x5')||![];var isLocalAsterisk=config['xdr']&&config[_0xb5ad('0x2')][_0xb5ad('0x6')]===!![]||![];var ami=new AsteriskManager(config[_0xb5ad('0x7')][_0xb5ad('0x8')],config['asterisk']['ip'],config[_0xb5ad('0x7')][_0xb5ad('0x9')],config['asterisk'][_0xb5ad('0xa')],!![]);ami[_0xb5ad('0xb')]();if(!isXDREnabled){utils[_0xb5ad('0xc')]('XDR\x20DISABLED');}else if(!isProduction&&!isLocalAsterisk){utils['info'](_0xb5ad('0xd'));}else{var agents=require('./agents.controller');var calls=require(_0xb5ad('0xe'));var queues=require(_0xb5ad('0xf'));var recordings=require(_0xb5ad('0x10'));var members=require(_0xb5ad('0x11'));var dials=require(_0xb5ad('0x12'));var transfers=require(_0xb5ad('0x13'));var core=require(_0xb5ad('0x14'));ami['on']('connect',core[_0xb5ad('0x15')]);ami['on'](_0xb5ad('0x16'),core[_0xb5ad('0x16')]);ami['on'](_0xb5ad('0x17'),core[_0xb5ad('0x17')]);ami['on']('error',core['error']);ami['on']('close',core[_0xb5ad('0x18')]);ami['on'](_0xb5ad('0x19'),core[_0xb5ad('0x19')]);ami['on'](_0xb5ad('0x1a'),function(_0x2270f3){try{utils[_0xb5ad('0x1b')](util[_0xb5ad('0x1c')](_0xb5ad('0x1d'),_0x2270f3[_0xb5ad('0x1e')]),_0x2270f3);members['devicestatechange'](_0x2270f3);}catch(_0xda94c9){utils[_0xb5ad('0x1f')](util[_0xb5ad('0x1c')]('[%s][index][devicestatechange]',_0x2270f3[_0xb5ad('0x1e')]),_0xda94c9);}});ami['on'](_0xb5ad('0x20'),function(_0x5c2f77){try{utils['debug'](util[_0xb5ad('0x1c')](_0xb5ad('0x21'),_0x5c2f77[_0xb5ad('0x22')]),_0x5c2f77);agents[_0xb5ad('0x20')](_0x5c2f77);}catch(_0xcde831){utils['error'](util[_0xb5ad('0x1c')](_0xb5ad('0x21'),_0x5c2f77[_0xb5ad('0x22')]),_0xcde831);}});ami['on'](_0xb5ad('0x23'),function(_0x2524c6){try{utils[_0xb5ad('0x1b')](util['format']('[%s][index][agentringnoanswer]',_0x2524c6[_0xb5ad('0x22')]),_0x2524c6);agents['agentringnoanswer'](_0x2524c6);}catch(_0x2b2198){utils[_0xb5ad('0x1f')](util[_0xb5ad('0x1c')](_0xb5ad('0x24'),_0x2524c6[_0xb5ad('0x22')]),_0x2b2198);}});ami['on'](_0xb5ad('0x25'),function(_0x7fb2d3){try{utils[_0xb5ad('0x1b')](util[_0xb5ad('0x1c')](_0xb5ad('0x26'),_0x7fb2d3[_0xb5ad('0x22')]),_0x7fb2d3);agents[_0xb5ad('0x25')](_0x7fb2d3);queues[_0xb5ad('0x25')](_0x7fb2d3);}catch(_0x560215){utils[_0xb5ad('0x1f')](util[_0xb5ad('0x1c')]('[%s][index][agentconnect]',_0x7fb2d3[_0xb5ad('0x22')]),_0x560215);}});ami['on']('agentcomplete',function(_0x288134){try{utils[_0xb5ad('0x1b')](util[_0xb5ad('0x1c')](_0xb5ad('0x27'),_0x288134['uniqueid']),_0x288134);agents['agentcomplete'](_0x288134);queues[_0xb5ad('0x28')](_0x288134);members['agentcomplete'](_0x288134);}catch(_0x4a00c3){utils[_0xb5ad('0x1f')](util[_0xb5ad('0x1c')](_0xb5ad('0x27'),_0x288134[_0xb5ad('0x22')]),_0x4a00c3);}});ami['on'](_0xb5ad('0x29'),function(_0x421d85){try{utils[_0xb5ad('0x1b')](util[_0xb5ad('0x1c')](_0xb5ad('0x2a'),_0x421d85['uniqueid']),_0x421d85);agents[_0xb5ad('0x29')](_0x421d85);queues[_0xb5ad('0x29')](_0x421d85);}catch(_0x4e1b32){utils['error'](util[_0xb5ad('0x1c')](_0xb5ad('0x2a'),_0x421d85['uniqueid']),_0x4e1b32);}});ami['on']('queuecallerjoin',function(_0x2c540b){try{utils['debug'](util[_0xb5ad('0x1c')]('[%s][index][queuecallerjoin]',_0x2c540b[_0xb5ad('0x22')]),_0x2c540b);queues[_0xb5ad('0x2b')](_0x2c540b);recordings[_0xb5ad('0x2b')](_0x2c540b);}catch(_0x41473c){utils[_0xb5ad('0x1f')](util[_0xb5ad('0x1c')](_0xb5ad('0x2c'),_0x2c540b['uniqueid']),_0x41473c);}});ami['on'](_0xb5ad('0x2d'),function(_0x17fde6){try{utils[_0xb5ad('0x1b')](util['format'](_0xb5ad('0x2e'),_0x17fde6[_0xb5ad('0x22')]),_0x17fde6);queues[_0xb5ad('0x2d')](_0x17fde6);}catch(_0x2e9452){utils[_0xb5ad('0x1f')](util[_0xb5ad('0x1c')](_0xb5ad('0x2e'),_0x17fde6[_0xb5ad('0x22')]),_0x2e9452);}});ami['on'](_0xb5ad('0x2f'),function(_0x3b4515){try{utils[_0xb5ad('0x1b')](util[_0xb5ad('0x1c')](_0xb5ad('0x30'),_0x3b4515[_0xb5ad('0x22')]),_0x3b4515);queues['musiconholdstart'](_0x3b4515);calls[_0xb5ad('0x2f')](_0x3b4515);}catch(_0x12e807){utils[_0xb5ad('0x1f')](util[_0xb5ad('0x1c')]('[%s][index][musiconholdstart]',_0x3b4515[_0xb5ad('0x22')]),_0x12e807);}});ami['on'](_0xb5ad('0x31'),function(_0x3d396f){try{utils[_0xb5ad('0x1b')](util[_0xb5ad('0x1c')]('[%s][index][musiconholdstop]',_0x3d396f[_0xb5ad('0x22')]),_0x3d396f);queues[_0xb5ad('0x31')](_0x3d396f);calls[_0xb5ad('0x31')](_0x3d396f);}catch(_0x26a8ed){utils[_0xb5ad('0x1f')](util[_0xb5ad('0x1c')](_0xb5ad('0x32'),_0x3d396f['uniqueid']),_0x26a8ed);}});ami['on'](_0xb5ad('0x33'),function(_0x50fdfc){try{utils['debug'](util[_0xb5ad('0x1c')]('[%s][index][newstate]',_0x50fdfc[_0xb5ad('0x22')]),_0x50fdfc);calls[_0xb5ad('0x33')](_0x50fdfc);recordings[_0xb5ad('0x33')](_0x50fdfc);}catch(_0x56feae){utils[_0xb5ad('0x1f')](util[_0xb5ad('0x1c')](_0xb5ad('0x34'),_0x50fdfc[_0xb5ad('0x22')]),_0x56feae);}});ami['on'](_0xb5ad('0x35'),function(_0x5e7f5d){try{utils['debug'](util[_0xb5ad('0x1c')]('[%s][index][hangup]',_0x5e7f5d[_0xb5ad('0x22')]),_0x5e7f5d);calls['hangup'](_0x5e7f5d);recordings['hangup'](_0x5e7f5d);dials[_0xb5ad('0x35')](_0x5e7f5d);agents[_0xb5ad('0x35')](_0x5e7f5d);queues[_0xb5ad('0x35')](_0x5e7f5d);}catch(_0x10248b){utils[_0xb5ad('0x1f')](util[_0xb5ad('0x1c')](_0xb5ad('0x36'),_0x5e7f5d[_0xb5ad('0x22')]),_0x10248b);}});ami['on'](_0xb5ad('0x37'),function(_0x577c9c){try{utils[_0xb5ad('0x1b')](util[_0xb5ad('0x1c')](_0xb5ad('0x38'),_0x577c9c[_0xb5ad('0x22')]),_0x577c9c);members['cdr'](_0x577c9c);}catch(_0xfe56e8){utils[_0xb5ad('0x1f')](util[_0xb5ad('0x1c')](_0xb5ad('0x38'),_0x577c9c[_0xb5ad('0x22')]),_0xfe56e8);}});ami['on'](_0xb5ad('0x39'),function(_0x3eba2c){try{utils[_0xb5ad('0x1b')](util[_0xb5ad('0x1c')]('[%s][index][blindtransfer]',_0x3eba2c['uniqueid']),_0x3eba2c);queues['blindtransfer'](_0x3eba2c);agents[_0xb5ad('0x39')](_0x3eba2c);transfers[_0xb5ad('0x39')](_0x3eba2c);recordings['blindtransfer'](_0x3eba2c);}catch(_0x322b16){utils[_0xb5ad('0x1f')](util[_0xb5ad('0x1c')](_0xb5ad('0x3a'),_0x3eba2c['uniqueid']),_0x322b16);}});ami['on'](_0xb5ad('0x3b'),function(_0xdb989f){try{utils[_0xb5ad('0x1b')](util['format'](_0xb5ad('0x3c'),_0xdb989f[_0xb5ad('0x3d')]),_0xdb989f);queues[_0xb5ad('0x3b')](_0xdb989f);transfers['attendedtransfer'](_0xdb989f);agents[_0xb5ad('0x3b')](_0xdb989f);calls[_0xb5ad('0x3b')](_0xdb989f);}catch(_0x18f36a){utils[_0xb5ad('0x1f')](util[_0xb5ad('0x1c')](_0xb5ad('0x3c'),_0xdb989f[_0xb5ad('0x3d')]),_0x18f36a);}});ami['on'](_0xb5ad('0x3e'),function(_0x5ba087){try{utils[_0xb5ad('0x1b')](util[_0xb5ad('0x1c')]('[%s][index][varset]',_0x5ba087[_0xb5ad('0x22')]),_0x5ba087);queues['varset'](_0x5ba087);recordings[_0xb5ad('0x3e')](_0x5ba087);calls[_0xb5ad('0x3e')](_0x5ba087);dials[_0xb5ad('0x3e')](_0x5ba087);}catch(_0x3d2d82){utils[_0xb5ad('0x1f')](util[_0xb5ad('0x1c')](_0xb5ad('0x3f'),_0x5ba087[_0xb5ad('0x22')]),_0x3d2d82);}});ami['on'](_0xb5ad('0x40'),function(_0x482ab0){try{utils[_0xb5ad('0x1b')](util[_0xb5ad('0x1c')](_0xb5ad('0x41'),_0x482ab0[_0xb5ad('0x22')]),_0x482ab0);calls['newexten'](_0x482ab0);recordings['newexten'](_0x482ab0);dials[_0xb5ad('0x40')](_0x482ab0);}catch(_0x4fe0e0){utils['error'](util[_0xb5ad('0x1c')](_0xb5ad('0x41'),_0x482ab0['uniqueid']),_0x4fe0e0);}});ami['on']('newchannel',function(_0x2b123a){try{utils[_0xb5ad('0x1b')](util[_0xb5ad('0x1c')](_0xb5ad('0x42'),_0x2b123a['uniqueid']),_0x2b123a);calls[_0xb5ad('0x43')](_0x2b123a);recordings[_0xb5ad('0x43')](_0x2b123a);}catch(_0x42ea73){utils[_0xb5ad('0x1f')](util[_0xb5ad('0x1c')](_0xb5ad('0x42'),_0x2b123a[_0xb5ad('0x22')]),_0x42ea73);}});ami['on'](_0xb5ad('0x44'),function(_0x27b22a){try{utils[_0xb5ad('0x1b')](util['format']('[%s][index][dialbegin]',_0x27b22a[_0xb5ad('0x22')]),_0x27b22a);dials[_0xb5ad('0x44')](_0x27b22a);}catch(_0x442576){utils[_0xb5ad('0x1f')](util[_0xb5ad('0x1c')](_0xb5ad('0x45'),_0x27b22a[_0xb5ad('0x22')]),_0x442576);}});ami['on'](_0xb5ad('0x46'),function(_0x5d3c5c){try{utils[_0xb5ad('0x1b')](util['format'](_0xb5ad('0x47'),_0x5d3c5c[_0xb5ad('0x22')]),_0x5d3c5c);dials[_0xb5ad('0x46')](_0x5d3c5c);}catch(_0x37f237){utils[_0xb5ad('0x1f')](util[_0xb5ad('0x1c')](_0xb5ad('0x47'),_0x5d3c5c[_0xb5ad('0x22')]),_0x37f237);}});} \ No newline at end of file +var _0x017e=['./members.controller','./transfers.controller','./core.controller','connect','shutdown','fullybooted','error','close','managerevent','devicestatechange','debug','device','format','[%s][index][devicestatechange]','agentcalled','[%s][index][agentcalled]','uniqueid','agentringnoanswer','[%s][index][agentringnoanswer]','agentconnect','[%s][index][agentconnect]','agentcomplete','[%s][index][agentcomplete]','queuecallerabandon','[%s][index][queuecallerabandon]','queuecallerjoin','[%s][index][queuecallerjoin]','queuecallerleave','[%s][index][queuecallerleave]','musiconholdstart','[%s][index][musiconholdstart]','musiconholdstop','[%s][index][musiconholdstop]','[%s][index][newstate]','newstate','hangup','[%s][index][hangup]','[%s][index][cdr]','cdr','blindtransfer','[%s][index][blindtransfer]','attendedtransfer','[%s][index][attendedtransfer]','origtransfereruniqueid','varset','[%s][index][varset]','newexten','[%s][index][newexten]','newchannel','[%s][index][newchannel]','[%s][index][dialbegin]','dialbegin','[%s]dialbegin','dialend','[%s][index][dialend]','asterisk-manager','./utils','xdr','disabled','env','production','asterisk','port','password','keepConnected','info','XDR\x20DISABLED','./agents.controller','./calls.controller','./queues.controller','./recordings.controller'];(function(_0x935a04,_0x3bc5be){var _0x102e74=function(_0x3bd581){while(--_0x3bd581){_0x935a04['push'](_0x935a04['shift']());}};_0x102e74(++_0x3bc5be);}(_0x017e,0x10c));var _0xe017=function(_0xbb7389,_0x12b29d){_0xbb7389=_0xbb7389-0x0;var _0x12537b=_0x017e[_0xbb7389];return _0x12537b;};var AsteriskManager=require(_0xe017('0x0'));var config=require('../../config/environment');var utils=require(_0xe017('0x1'));var util=require('util');var isXDREnabled=config[_0xe017('0x2')]&&!config[_0xe017('0x2')][_0xe017('0x3')];var isProduction=config[_0xe017('0x4')]===_0xe017('0x5')||![];var isLocalAsterisk=config['xdr']&&config[_0xe017('0x2')]['local']===!![]||![];var ami=new AsteriskManager(config[_0xe017('0x6')][_0xe017('0x7')],config[_0xe017('0x6')]['ip'],config[_0xe017('0x6')]['username'],config[_0xe017('0x6')][_0xe017('0x8')],!![]);ami[_0xe017('0x9')]();if(!isXDREnabled){utils[_0xe017('0xa')](_0xe017('0xb'));}else if(!isProduction&&!isLocalAsterisk){utils[_0xe017('0xa')]('Asterisk\x20disabled\x20on\x20localhost');}else{var agents=require(_0xe017('0xc'));var calls=require(_0xe017('0xd'));var queues=require(_0xe017('0xe'));var recordings=require(_0xe017('0xf'));var members=require(_0xe017('0x10'));var dials=require('./dials.controller');var transfers=require(_0xe017('0x11'));var core=require(_0xe017('0x12'));ami['on'](_0xe017('0x13'),core[_0xe017('0x13')]);ami['on'](_0xe017('0x14'),core['shutdown']);ami['on'](_0xe017('0x15'),core[_0xe017('0x15')]);ami['on'](_0xe017('0x16'),core[_0xe017('0x16')]);ami['on'](_0xe017('0x17'),core[_0xe017('0x17')]);ami['on'](_0xe017('0x18'),core[_0xe017('0x18')]);ami['on'](_0xe017('0x19'),function(_0x204132){try{utils[_0xe017('0x1a')](util['format']('[%s][index][devicestatechange]',_0x204132[_0xe017('0x1b')]),_0x204132);members['devicestatechange'](_0x204132);}catch(_0x3d2cda){utils['error'](util[_0xe017('0x1c')](_0xe017('0x1d'),_0x204132[_0xe017('0x1b')]),_0x3d2cda);}});ami['on'](_0xe017('0x1e'),function(_0x3aa40b){try{utils['debug'](util[_0xe017('0x1c')](_0xe017('0x1f'),_0x3aa40b[_0xe017('0x20')]),_0x3aa40b);agents[_0xe017('0x1e')](_0x3aa40b);}catch(_0x5f598a){utils[_0xe017('0x16')](util[_0xe017('0x1c')](_0xe017('0x1f'),_0x3aa40b[_0xe017('0x20')]),_0x5f598a);}});ami['on'](_0xe017('0x21'),function(_0x3335c6){try{utils['debug'](util[_0xe017('0x1c')](_0xe017('0x22'),_0x3335c6[_0xe017('0x20')]),_0x3335c6);agents[_0xe017('0x21')](_0x3335c6);}catch(_0x5299d1){utils[_0xe017('0x16')](util['format'](_0xe017('0x22'),_0x3335c6[_0xe017('0x20')]),_0x5299d1);}});ami['on']('agentconnect',function(_0x46965a){try{utils[_0xe017('0x1a')](util['format']('[%s][index][agentconnect]',_0x46965a[_0xe017('0x20')]),_0x46965a);agents[_0xe017('0x23')](_0x46965a);queues[_0xe017('0x23')](_0x46965a);}catch(_0x50414a){utils[_0xe017('0x16')](util[_0xe017('0x1c')](_0xe017('0x24'),_0x46965a[_0xe017('0x20')]),_0x50414a);}});ami['on'](_0xe017('0x25'),function(_0x3e7a70){try{utils[_0xe017('0x1a')](util['format'](_0xe017('0x26'),_0x3e7a70[_0xe017('0x20')]),_0x3e7a70);agents[_0xe017('0x25')](_0x3e7a70);queues[_0xe017('0x25')](_0x3e7a70);members[_0xe017('0x25')](_0x3e7a70);}catch(_0x2f4bc0){utils[_0xe017('0x16')](util[_0xe017('0x1c')](_0xe017('0x26'),_0x3e7a70[_0xe017('0x20')]),_0x2f4bc0);}});ami['on'](_0xe017('0x27'),function(_0x2ffd1c){try{utils['debug'](util[_0xe017('0x1c')](_0xe017('0x28'),_0x2ffd1c[_0xe017('0x20')]),_0x2ffd1c);agents[_0xe017('0x27')](_0x2ffd1c);queues[_0xe017('0x27')](_0x2ffd1c);}catch(_0x2b3efc){utils['error'](util['format']('[%s][index][queuecallerabandon]',_0x2ffd1c[_0xe017('0x20')]),_0x2b3efc);}});ami['on'](_0xe017('0x29'),function(_0x19dc31){try{utils['debug'](util[_0xe017('0x1c')]('[%s][index][queuecallerjoin]',_0x19dc31[_0xe017('0x20')]),_0x19dc31);queues['queuecallerjoin'](_0x19dc31);recordings['queuecallerjoin'](_0x19dc31);}catch(_0x28c005){utils[_0xe017('0x16')](util[_0xe017('0x1c')](_0xe017('0x2a'),_0x19dc31['uniqueid']),_0x28c005);}});ami['on'](_0xe017('0x2b'),function(_0x162919){try{utils['debug'](util['format'](_0xe017('0x2c'),_0x162919[_0xe017('0x20')]),_0x162919);queues[_0xe017('0x2b')](_0x162919);}catch(_0x4dd17f){utils[_0xe017('0x16')](util[_0xe017('0x1c')](_0xe017('0x2c'),_0x162919[_0xe017('0x20')]),_0x4dd17f);}});ami['on'](_0xe017('0x2d'),function(_0x4dbff6){try{utils['debug'](util[_0xe017('0x1c')](_0xe017('0x2e'),_0x4dbff6[_0xe017('0x20')]),_0x4dbff6);queues['musiconholdstart'](_0x4dbff6);calls['musiconholdstart'](_0x4dbff6);}catch(_0x4f7e9c){utils[_0xe017('0x16')](util['format'](_0xe017('0x2e'),_0x4dbff6[_0xe017('0x20')]),_0x4f7e9c);}});ami['on'](_0xe017('0x2f'),function(_0xabf03c){try{utils['debug'](util[_0xe017('0x1c')](_0xe017('0x30'),_0xabf03c[_0xe017('0x20')]),_0xabf03c);queues[_0xe017('0x2f')](_0xabf03c);calls['musiconholdstop'](_0xabf03c);}catch(_0x4089e2){utils[_0xe017('0x16')](util[_0xe017('0x1c')](_0xe017('0x30'),_0xabf03c['uniqueid']),_0x4089e2);}});ami['on']('newstate',function(_0x13d147){try{utils[_0xe017('0x1a')](util[_0xe017('0x1c')](_0xe017('0x31'),_0x13d147[_0xe017('0x20')]),_0x13d147);calls[_0xe017('0x32')](_0x13d147);recordings['newstate'](_0x13d147);}catch(_0x5eefdb){utils[_0xe017('0x16')](util[_0xe017('0x1c')]('[%s][index][newstate]',_0x13d147['uniqueid']),_0x5eefdb);}});ami['on'](_0xe017('0x33'),function(_0x3921ab){try{utils[_0xe017('0x1a')](util[_0xe017('0x1c')](_0xe017('0x34'),_0x3921ab[_0xe017('0x20')]),_0x3921ab);calls[_0xe017('0x33')](_0x3921ab);recordings['hangup'](_0x3921ab);dials['hangup'](_0x3921ab);agents[_0xe017('0x33')](_0x3921ab);queues['hangup'](_0x3921ab);}catch(_0x2602ab){utils[_0xe017('0x16')](util[_0xe017('0x1c')](_0xe017('0x34'),_0x3921ab[_0xe017('0x20')]),_0x2602ab);}});ami['on']('cdr',function(_0xa26ee4){try{utils[_0xe017('0x1a')](util['format'](_0xe017('0x35'),_0xa26ee4[_0xe017('0x20')]),_0xa26ee4);members[_0xe017('0x36')](_0xa26ee4);}catch(_0x42382a){utils['error'](util['format'](_0xe017('0x35'),_0xa26ee4['uniqueid']),_0x42382a);}});ami['on'](_0xe017('0x37'),function(_0x5e4e67){try{utils[_0xe017('0x1a')](util[_0xe017('0x1c')](_0xe017('0x38'),_0x5e4e67['uniqueid']),_0x5e4e67);queues['blindtransfer'](_0x5e4e67);agents[_0xe017('0x37')](_0x5e4e67);transfers[_0xe017('0x37')](_0x5e4e67);recordings[_0xe017('0x37')](_0x5e4e67);}catch(_0x4648f3){utils['error'](util['format']('[%s][index][blindtransfer]',_0x5e4e67[_0xe017('0x20')]),_0x4648f3);}});ami['on'](_0xe017('0x39'),function(_0x5a3b21){try{utils[_0xe017('0x1a')](util[_0xe017('0x1c')](_0xe017('0x3a'),_0x5a3b21['origtransfereruniqueid']),_0x5a3b21);queues[_0xe017('0x39')](_0x5a3b21);transfers[_0xe017('0x39')](_0x5a3b21);agents[_0xe017('0x39')](_0x5a3b21);calls[_0xe017('0x39')](_0x5a3b21);}catch(_0x164184){utils[_0xe017('0x16')](util[_0xe017('0x1c')](_0xe017('0x3a'),_0x5a3b21[_0xe017('0x3b')]),_0x164184);}});ami['on'](_0xe017('0x3c'),function(_0xfcf5d8){try{utils[_0xe017('0x1a')](util[_0xe017('0x1c')](_0xe017('0x3d'),_0xfcf5d8[_0xe017('0x20')]),_0xfcf5d8);queues[_0xe017('0x3c')](_0xfcf5d8);recordings['varset'](_0xfcf5d8);calls['varset'](_0xfcf5d8);dials[_0xe017('0x3c')](_0xfcf5d8);}catch(_0x59fa18){utils[_0xe017('0x16')](util[_0xe017('0x1c')](_0xe017('0x3d'),_0xfcf5d8['uniqueid']),_0x59fa18);}});ami['on'](_0xe017('0x3e'),function(_0x308900){try{utils['debug'](util[_0xe017('0x1c')](_0xe017('0x3f'),_0x308900[_0xe017('0x20')]),_0x308900);calls[_0xe017('0x3e')](_0x308900);recordings[_0xe017('0x3e')](_0x308900);dials['newexten'](_0x308900);}catch(_0x457371){utils['error'](util[_0xe017('0x1c')](_0xe017('0x3f'),_0x308900[_0xe017('0x20')]),_0x457371);}});ami['on'](_0xe017('0x40'),function(_0x5fc719){try{utils[_0xe017('0x1a')](util[_0xe017('0x1c')](_0xe017('0x41'),_0x5fc719[_0xe017('0x20')]),_0x5fc719);calls[_0xe017('0x40')](_0x5fc719);recordings[_0xe017('0x40')](_0x5fc719);}catch(_0x32b125){utils['error'](util[_0xe017('0x1c')](_0xe017('0x41'),_0x5fc719[_0xe017('0x20')]),_0x32b125);}});ami['on']('dialbegin',function(_0x5eab3b){try{utils[_0xe017('0x1a')](util[_0xe017('0x1c')](_0xe017('0x42'),_0x5eab3b[_0xe017('0x20')]),_0x5eab3b);dials[_0xe017('0x43')](_0x5eab3b);}catch(_0x540461){utils[_0xe017('0x16')](util[_0xe017('0x1c')](_0xe017('0x44'),_0x5eab3b[_0xe017('0x20')]),_0x540461);}});ami['on'](_0xe017('0x45'),function(_0xc1d2fd){try{utils['debug'](util[_0xe017('0x1c')](_0xe017('0x46'),_0xc1d2fd[_0xe017('0x20')]),_0xc1d2fd);dials[_0xe017('0x45')](_0xc1d2fd);}catch(_0x1a37e6){utils[_0xe017('0x16')](util[_0xe017('0x1c')](_0xe017('0x46'),_0xc1d2fd[_0xe017('0x20')]),_0x1a37e6);}});} \ No newline at end of file diff --git a/server/services/xdr/members.controller.js b/server/services/xdr/members.controller.js index 728e7e5..5d403f9 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 _0xc788=['voice','TALKING','now','agent','NOT_INUSE','exitAt','duration','diffTime','enterAt','[%s][members][devicestatechange]','agentcomplete','isNil','[%s][members][agentcomplete]','[%s][members][agentcomplete]\x20interface:%s\x20queue:%s','queue','assign','cdr','[%s][members][cdr]','data1','source','destination','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','data3','destinationchannel','lodash','util','Local/_attended@transfer','Queue:','info','format','[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s','uniqueid','interface','channel','data2','type','then','membername','internal','request','CreateMemberReport','getUserByName','split','catch','error','[%s][members][writeDB]','devicestatechange','debug','device','[%s][members][devicestatechange]\x20state:%s\x20interface:%s','state','INUSE','BUSY'];(function(_0x523adf,_0x3e1620){var _0x283870=function(_0xa0e816){while(--_0xa0e816){_0x523adf['push'](_0x523adf['shift']());}};_0x283870(++_0x3e1620);}(_0xc788,0x82));var _0x8c78=function(_0x54b458,_0x4da21b){_0x54b458=_0x54b458-0x0;var _0x18d704=_0xc788[_0x54b458];return _0x18d704;};'use strict';var _=require(_0x8c78('0x0'));var util=require(_0x8c78('0x1'));var utils=require('./utils');var members={};var exclude=[_0x8c78('0x2'),_0x8c78('0x3')];function writeDB(_0x52f57d){utils[_0x8c78('0x4')](util[_0x8c78('0x5')](_0x8c78('0x6'),_0x52f57d[_0x8c78('0x7')],_0x52f57d[_0x8c78('0x8')],_0x52f57d[_0x8c78('0x9')],_0x52f57d[_0x8c78('0xa')],_0x52f57d['membername'],_0x52f57d[_0x8c78('0xb')]));if(_0x52f57d[_0x8c78('0x8')]){utils['getUserByInterface'](_0x52f57d[_0x8c78('0x8')])[_0x8c78('0xc')](function(_0x556424){if(_0x556424){_0x52f57d[_0x8c78('0xd')]=_0x556424['name'];_0x52f57d['internal']=_0x556424[_0x8c78('0xe')];utils[_0x8c78('0xf')](_0x8c78('0x10'),_0x52f57d);}else{utils[_0x8c78('0x11')](_0x52f57d[_0x8c78('0x8')][_0x8c78('0x12')]('/')[0x1])['then'](function(_0x9696ff){if(_0x9696ff){_0x52f57d['membername']=_0x9696ff['name'];_0x52f57d[_0x8c78('0xe')]=_0x9696ff[_0x8c78('0xe')];utils['request'](_0x8c78('0x10'),_0x52f57d);}});}})[_0x8c78('0x13')](function(_0x5ed393){utils[_0x8c78('0x14')](util['format'](_0x8c78('0x15'),_0x52f57d['uniqueid']),_0x5ed393);});}delete members[_0x52f57d[_0x8c78('0x8')]];}function startsWith(_0x2c5e82,_0x54370c){return _['some'](_0x2c5e82,function(_0x129547){return _['startsWith'](_0x54370c,_0x129547);});}exports[_0x8c78('0x16')]=function(_0x5b4f9f){try{utils[_0x8c78('0x17')](util['format']('[%s][members][devicestatechange]',members[_0x5b4f9f[_0x8c78('0x18')]]?members[_0x5b4f9f[_0x8c78('0x18')]][_0x8c78('0x7')]:_0x5b4f9f[_0x8c78('0x18')]),_0x5b4f9f);utils[_0x8c78('0x4')](util[_0x8c78('0x5')](_0x8c78('0x19'),members[_0x5b4f9f['device']]?members[_0x5b4f9f[_0x8c78('0x18')]][_0x8c78('0x7')]:_0x5b4f9f[_0x8c78('0x18')],_0x5b4f9f['state'],_0x5b4f9f[_0x8c78('0x18')]));switch(_0x5b4f9f[_0x8c78('0x1a')]){case _0x8c78('0x1b'):case _0x8c78('0x1c'):if(!startsWith(exclude,_0x5b4f9f[_0x8c78('0x18')])){members[_0x5b4f9f[_0x8c78('0x18')]]={'channel':_0x8c78('0x1d'),'interface':_0x5b4f9f[_0x8c78('0x18')],'type':_0x8c78('0x1e'),'enterAt':utils[_0x8c78('0x1f')](),'role':_0x8c78('0x20')};}break;case _0x8c78('0x21'):if(!_['isNil'](members[_0x5b4f9f['device']])){members[_0x5b4f9f['device']][_0x8c78('0x22')]=utils[_0x8c78('0x1f')]();members[_0x5b4f9f['device']][_0x8c78('0x23')]=utils[_0x8c78('0x24')](members[_0x5b4f9f[_0x8c78('0x18')]][_0x8c78('0x22')],members[_0x5b4f9f[_0x8c78('0x18')]][_0x8c78('0x25')]);if(members[_0x5b4f9f[_0x8c78('0x18')]][_0x8c78('0x7')]){writeDB(members[_0x5b4f9f[_0x8c78('0x18')]]);}}break;default:break;}}catch(_0x29f8e1){utils[_0x8c78('0x14')](util[_0x8c78('0x5')](_0x8c78('0x26'),members[_0x5b4f9f['device']]?members[_0x5b4f9f['device']][_0x8c78('0x7')]:_0x5b4f9f[_0x8c78('0x18')]),_0x29f8e1);}};exports[_0x8c78('0x27')]=function(_0x3a8384){try{if(!_[_0x8c78('0x28')](members[_0x3a8384[_0x8c78('0x8')]])){utils['debug'](util['format'](_0x8c78('0x29'),_0x3a8384[_0x8c78('0x7')]),_0x3a8384);utils[_0x8c78('0x4')](util[_0x8c78('0x5')](_0x8c78('0x2a'),_0x3a8384[_0x8c78('0x7')],_0x3a8384['interface'],_0x3a8384[_0x8c78('0x2b')]));members[_0x3a8384['interface']]=_[_0x8c78('0x2c')](members[_0x3a8384[_0x8c78('0x8')]],{'data4':_0x3a8384[_0x8c78('0x2b')],'uniqueid':_0x3a8384[_0x8c78('0x7')]});}}catch(_0x291a1f){utils[_0x8c78('0x14')](util[_0x8c78('0x5')](_0x8c78('0x29'),_0x3a8384['uniqueid']),_0x291a1f);}};exports[_0x8c78('0x2d')]=function(_0x491e4b){try{utils[_0x8c78('0x17')](util['format'](_0x8c78('0x2e'),_0x491e4b[_0x8c78('0x7')]),_0x491e4b);if(_0x491e4b[_0x8c78('0x9')]){var _0x334884=_0x491e4b[_0x8c78('0x9')][_0x8c78('0x12')]('-')[0x0];if(!_[_0x8c78('0x28')](members[_0x334884])){members[_0x334884]=_[_0x8c78('0x2c')](members[_0x334884],{'data1':members[_0x334884][_0x8c78('0x2f')]||_0x491e4b[_0x8c78('0xb')],'data2':members[_0x334884][_0x8c78('0xa')]||_0x491e4b[_0x8c78('0x30')],'data3':members[_0x334884]['data3']||_0x491e4b[_0x8c78('0x31')],'uniqueid':members[_0x334884][_0x8c78('0x7')]||_0x491e4b['uniqueid']});utils[_0x8c78('0x4')](util[_0x8c78('0x5')](_0x8c78('0x32'),_0x491e4b[_0x8c78('0x7')],members[_0x334884][_0x8c78('0x2f')],members[_0x334884][_0x8c78('0xa')],members[_0x334884][_0x8c78('0x33')]));if(members[_0x334884][_0x8c78('0x22')]){writeDB(members[_0x334884]);}}}if(_0x491e4b[_0x8c78('0x34')]){var _0x2bf89a=_0x491e4b['destinationchannel'][_0x8c78('0x12')]('-')[0x0];if(!_[_0x8c78('0x28')](members[_0x2bf89a])){members[_0x2bf89a]=_['assign'](members[_0x2bf89a],{'data1':members[_0x2bf89a]['data1']||_0x491e4b[_0x8c78('0xb')],'data2':members[_0x2bf89a]['data2']||_0x491e4b['source'],'data3':members[_0x2bf89a][_0x8c78('0x33')]||_0x491e4b[_0x8c78('0x31')],'uniqueid':members[_0x2bf89a][_0x8c78('0x7')]||_0x491e4b[_0x8c78('0x7')]});utils['info'](util[_0x8c78('0x5')](_0x8c78('0x32'),_0x491e4b[_0x8c78('0x7')],members[_0x2bf89a][_0x8c78('0x2f')],members[_0x2bf89a][_0x8c78('0xa')],members[_0x2bf89a][_0x8c78('0x33')]));if(members[_0x2bf89a]['exitAt']){writeDB(members[_0x2bf89a]);}}}}catch(_0x4541fc){utils[_0x8c78('0x14')](util[_0x8c78('0x5')](_0x8c78('0x2e'),_0x491e4b['uniqueid']),_0x4541fc);}}; \ No newline at end of file +var _0x7a0a=['./utils','Local/_attended@transfer','Queue:','info','format','[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s','uniqueid','interface','channel','data2','type','getUserByInterface','then','internal','request','CreateMemberReport','getUserByName','split','membername','name','catch','error','[%s][members][writeDB]','startsWith','debug','device','[%s][members][devicestatechange]\x20state:%s\x20interface:%s','state','BUSY','voice','TALKING','now','agent','isNil','exitAt','duration','enterAt','[%s][members][agentcomplete]','[%s][members][agentcomplete]\x20interface:%s\x20queue:%s','queue','assign','cdr','[%s][members][cdr]','source','data3','destination','data1','destinationchannel','lodash','util'];(function(_0x59c6da,_0x5da044){var _0x599cc6=function(_0x265519){while(--_0x265519){_0x59c6da['push'](_0x59c6da['shift']());}};_0x599cc6(++_0x5da044);}(_0x7a0a,0xc6));var _0xa7a0=function(_0x16fcfe,_0x15434b){_0x16fcfe=_0x16fcfe-0x0;var _0x123068=_0x7a0a[_0x16fcfe];return _0x123068;};'use strict';var _=require(_0xa7a0('0x0'));var util=require(_0xa7a0('0x1'));var utils=require(_0xa7a0('0x2'));var members={};var exclude=[_0xa7a0('0x3'),_0xa7a0('0x4')];function writeDB(_0x2accf4){utils[_0xa7a0('0x5')](util[_0xa7a0('0x6')](_0xa7a0('0x7'),_0x2accf4[_0xa7a0('0x8')],_0x2accf4[_0xa7a0('0x9')],_0x2accf4[_0xa7a0('0xa')],_0x2accf4[_0xa7a0('0xb')],_0x2accf4['membername'],_0x2accf4[_0xa7a0('0xc')]));if(_0x2accf4[_0xa7a0('0x9')]){utils[_0xa7a0('0xd')](_0x2accf4[_0xa7a0('0x9')])[_0xa7a0('0xe')](function(_0x583208){if(_0x583208){_0x2accf4['membername']=_0x583208['name'];_0x2accf4['internal']=_0x583208[_0xa7a0('0xf')];utils[_0xa7a0('0x10')](_0xa7a0('0x11'),_0x2accf4);}else{utils[_0xa7a0('0x12')](_0x2accf4[_0xa7a0('0x9')][_0xa7a0('0x13')]('/')[0x1])[_0xa7a0('0xe')](function(_0x543ab5){if(_0x543ab5){_0x2accf4[_0xa7a0('0x14')]=_0x543ab5[_0xa7a0('0x15')];_0x2accf4[_0xa7a0('0xf')]=_0x543ab5[_0xa7a0('0xf')];utils[_0xa7a0('0x10')]('CreateMemberReport',_0x2accf4);}});}})[_0xa7a0('0x16')](function(_0x27eb8b){utils[_0xa7a0('0x17')](util[_0xa7a0('0x6')](_0xa7a0('0x18'),_0x2accf4[_0xa7a0('0x8')]),_0x27eb8b);});}delete members[_0x2accf4[_0xa7a0('0x9')]];}function startsWith(_0x37c1b6,_0x2dca94){return _['some'](_0x37c1b6,function(_0x20bf85){return _[_0xa7a0('0x19')](_0x2dca94,_0x20bf85);});}exports['devicestatechange']=function(_0x1f6e18){try{utils[_0xa7a0('0x1a')](util[_0xa7a0('0x6')]('[%s][members][devicestatechange]',members[_0x1f6e18[_0xa7a0('0x1b')]]?members[_0x1f6e18[_0xa7a0('0x1b')]][_0xa7a0('0x8')]:_0x1f6e18[_0xa7a0('0x1b')]),_0x1f6e18);utils['info'](util['format'](_0xa7a0('0x1c'),members[_0x1f6e18['device']]?members[_0x1f6e18[_0xa7a0('0x1b')]][_0xa7a0('0x8')]:_0x1f6e18[_0xa7a0('0x1b')],_0x1f6e18[_0xa7a0('0x1d')],_0x1f6e18[_0xa7a0('0x1b')]));switch(_0x1f6e18['state']){case'INUSE':case _0xa7a0('0x1e'):if(!startsWith(exclude,_0x1f6e18[_0xa7a0('0x1b')])){members[_0x1f6e18[_0xa7a0('0x1b')]]={'channel':_0xa7a0('0x1f'),'interface':_0x1f6e18[_0xa7a0('0x1b')],'type':_0xa7a0('0x20'),'enterAt':utils[_0xa7a0('0x21')](),'role':_0xa7a0('0x22')};}break;case'NOT_INUSE':if(!_[_0xa7a0('0x23')](members[_0x1f6e18['device']])){members[_0x1f6e18['device']][_0xa7a0('0x24')]=utils[_0xa7a0('0x21')]();members[_0x1f6e18[_0xa7a0('0x1b')]][_0xa7a0('0x25')]=utils['diffTime'](members[_0x1f6e18[_0xa7a0('0x1b')]]['exitAt'],members[_0x1f6e18['device']][_0xa7a0('0x26')]);if(members[_0x1f6e18[_0xa7a0('0x1b')]][_0xa7a0('0x8')]){writeDB(members[_0x1f6e18['device']]);}}break;default:break;}}catch(_0x5f45b4){utils['error'](util[_0xa7a0('0x6')]('[%s][members][devicestatechange]',members[_0x1f6e18[_0xa7a0('0x1b')]]?members[_0x1f6e18['device']]['uniqueid']:_0x1f6e18[_0xa7a0('0x1b')]),_0x5f45b4);}};exports['agentcomplete']=function(_0x2a8c5d){try{if(!_[_0xa7a0('0x23')](members[_0x2a8c5d['interface']])){utils[_0xa7a0('0x1a')](util[_0xa7a0('0x6')](_0xa7a0('0x27'),_0x2a8c5d[_0xa7a0('0x8')]),_0x2a8c5d);utils[_0xa7a0('0x5')](util['format'](_0xa7a0('0x28'),_0x2a8c5d[_0xa7a0('0x8')],_0x2a8c5d[_0xa7a0('0x9')],_0x2a8c5d[_0xa7a0('0x29')]));members[_0x2a8c5d[_0xa7a0('0x9')]]=_[_0xa7a0('0x2a')](members[_0x2a8c5d[_0xa7a0('0x9')]],{'data4':_0x2a8c5d[_0xa7a0('0x29')],'uniqueid':_0x2a8c5d[_0xa7a0('0x8')]});}}catch(_0xaf5cd7){utils['error'](util['format']('[%s][members][agentcomplete]',_0x2a8c5d[_0xa7a0('0x8')]),_0xaf5cd7);}};exports[_0xa7a0('0x2b')]=function(_0x463c14){try{utils[_0xa7a0('0x1a')](util[_0xa7a0('0x6')](_0xa7a0('0x2c'),_0x463c14['uniqueid']),_0x463c14);if(_0x463c14['channel']){var _0x4f6dc2=_0x463c14['channel'][_0xa7a0('0x13')]('-')[0x0];if(!_[_0xa7a0('0x23')](members[_0x4f6dc2])){members[_0x4f6dc2]=_[_0xa7a0('0x2a')](members[_0x4f6dc2],{'data1':members[_0x4f6dc2]['data1']||_0x463c14['type'],'data2':members[_0x4f6dc2][_0xa7a0('0xb')]||_0x463c14[_0xa7a0('0x2d')],'data3':members[_0x4f6dc2][_0xa7a0('0x2e')]||_0x463c14[_0xa7a0('0x2f')],'uniqueid':members[_0x4f6dc2]['uniqueid']||_0x463c14[_0xa7a0('0x8')]});utils['info'](util[_0xa7a0('0x6')]('[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s',_0x463c14[_0xa7a0('0x8')],members[_0x4f6dc2][_0xa7a0('0x30')],members[_0x4f6dc2]['data2'],members[_0x4f6dc2][_0xa7a0('0x2e')]));if(members[_0x4f6dc2][_0xa7a0('0x24')]){writeDB(members[_0x4f6dc2]);}}}if(_0x463c14[_0xa7a0('0x31')]){var _0x4fdf32=_0x463c14['destinationchannel'][_0xa7a0('0x13')]('-')[0x0];if(!_[_0xa7a0('0x23')](members[_0x4fdf32])){members[_0x4fdf32]=_[_0xa7a0('0x2a')](members[_0x4fdf32],{'data1':members[_0x4fdf32][_0xa7a0('0x30')]||_0x463c14[_0xa7a0('0xc')],'data2':members[_0x4fdf32][_0xa7a0('0xb')]||_0x463c14['source'],'data3':members[_0x4fdf32][_0xa7a0('0x2e')]||_0x463c14[_0xa7a0('0x2f')],'uniqueid':members[_0x4fdf32][_0xa7a0('0x8')]||_0x463c14['uniqueid']});utils[_0xa7a0('0x5')](util[_0xa7a0('0x6')]('[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s',_0x463c14[_0xa7a0('0x8')],members[_0x4fdf32][_0xa7a0('0x30')],members[_0x4fdf32][_0xa7a0('0xb')],members[_0x4fdf32][_0xa7a0('0x2e')]));if(members[_0x4fdf32]['exitAt']){writeDB(members[_0x4fdf32]);}}}}catch(_0x59cb02){utils[_0xa7a0('0x17')](util[_0xa7a0('0x6')]('[%s][members][cdr]',_0x463c14['uniqueid']),_0x59cb02);}}; \ No newline at end of file diff --git a/server/services/xdr/queues.controller.js b/server/services/xdr/queues.controller.js index e21fb76..aee23a3 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 _0xa556=['agentcomplete','[%s][queues][agentcomplete]','queuecallercomplete','transfer','TRANSFER','COMPLETEDBY','reason','[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s','blindtransfer','transfereeuniqueid','[%s][queues][blindtransfer]','transfertype','BLIND','transferexten','extension','BLINDTRANSFER','[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER','attendedtransfer','origtransfereruniqueid','secondtransfererlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','origtransfererexten','ATTENDED','transferuniqueid','ATTENDEDTRANSFER','origtransfererlinkedid','transfereelinkedid','clone','transfertargetuniqueid','calleridname','mohtime','[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s','secondtransfereruniqueid','transfertargetlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','musiconholdstart','[%s][queues][musiconholdstart]','musiconholdstartAt','[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s','musiconholdstop','[%s][queues][musiconholdstop]','[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s','lodash','util','./utils','info','[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s','uniqueid','queue','calleridnum','accountcode','queuecallerexitreason','getVoiceQueueByName','type','CreateVoiceQueueReport','request','transfereduniqueid','queuecallerjoin','debug','format','[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s','position','assign','now','[%s][queues][queuecallerjoin]','hangup','isNil','[%s][queues][hangup]','queuecallerleaveAt','queuecallerabandon','queuecallerexit','queuecallercompleteAt','[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s','[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s','name','queuecallerenterreason','varset','[%s][queues][varset]','value','CONTINUE','queuecallerabandonAt','queuecallerexitAt','toUpperCase','[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s','queueposition','EXITWITHKEY','[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s','error','[%s][queues][queuecallerabandon]','[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s','queuecallerleave','[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s','connectedlinenum','connectedlinename','holdtime','diffTime','queuecallerjoinAt','count','[%s][queues][queuecallerleave]','agentconnect','[%s][queues][agentconnect]','[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s','destaccountcode','assigned','lastAssignedTo','membername'];(function(_0x545b71,_0x4f44eb){var _0x26e587=function(_0x293b81){while(--_0x293b81){_0x545b71['push'](_0x545b71['shift']());}};_0x26e587(++_0x4f44eb);}(_0xa556,0x96));var _0x6a55=function(_0x2adbeb,_0x5581be){_0x2adbeb=_0x2adbeb-0x0;var _0x5e18a6=_0xa556[_0x2adbeb];return _0x5e18a6;};'use strict';var _=require(_0x6a55('0x0'));var util=require(_0x6a55('0x1'));var utils=require(_0x6a55('0x2'));var queues={};function writeDB(_0xa7f438){utils[_0x6a55('0x3')](util['format'](_0x6a55('0x4'),_0xa7f438[_0x6a55('0x5')],_0xa7f438['channel'],_0xa7f438[_0x6a55('0x6')],_0xa7f438['lastAssignedTo'],_0xa7f438[_0x6a55('0x7')],_0xa7f438[_0x6a55('0x8')],_0xa7f438[_0x6a55('0x9')]));if(_0xa7f438['queue']){utils[_0x6a55('0xa')](_0xa7f438[_0x6a55('0x6')])['then'](function(_0x52c044){if(_0x52c044){_0xa7f438[_0x6a55('0xb')]=_0x52c044['type'];}utils['request'](_0x6a55('0xc'),_0xa7f438);});}else{utils[_0x6a55('0xd')](_0x6a55('0xc'),_0xa7f438);}if(_0xa7f438['transfereduniqueid']){delete queues[_0xa7f438[_0x6a55('0xe')]];}else{delete queues[_0xa7f438[_0x6a55('0x5')]];}}exports[_0x6a55('0xf')]=function(_0x1ad6b6){try{utils[_0x6a55('0x10')](util['format']('[%s][queues][queuecallerjoin]',_0x1ad6b6[_0x6a55('0x5')]),_0x1ad6b6);utils[_0x6a55('0x3')](util[_0x6a55('0x11')](_0x6a55('0x12'),_0x1ad6b6[_0x6a55('0x5')],_0x1ad6b6[_0x6a55('0x6')],_0x1ad6b6[_0x6a55('0x13')]));queues[_0x1ad6b6[_0x6a55('0x5')]]=_[_0x6a55('0x14')](_0x1ad6b6,{'originalposition':_0x1ad6b6[_0x6a55('0x13')],'queuecallerjoinAt':utils[_0x6a55('0x15')](),'mohtime':0x0});}catch(_0x1a9ff8){utils['error'](util[_0x6a55('0x11')](_0x6a55('0x16'),_0x1ad6b6[_0x6a55('0x5')]),_0x1a9ff8);}};exports[_0x6a55('0x17')]=function(_0x2ae63c){try{if(!_[_0x6a55('0x18')](queues[_0x2ae63c[_0x6a55('0x5')]])){utils[_0x6a55('0x10')](util[_0x6a55('0x11')](_0x6a55('0x19'),_0x2ae63c[_0x6a55('0x5')]),_0x2ae63c);if(queues[_0x2ae63c['uniqueid']][_0x6a55('0x1a')]){if(!queues[_0x2ae63c['uniqueid']][_0x6a55('0x1b')]&&!queues[_0x2ae63c[_0x6a55('0x5')]][_0x6a55('0x1c')]){queues[_0x2ae63c[_0x6a55('0x5')]]['queuecallercomplete']=!![];queues[_0x2ae63c[_0x6a55('0x5')]][_0x6a55('0x1d')]=utils[_0x6a55('0x15')]();queues[_0x2ae63c['uniqueid']][_0x6a55('0x9')]='COMPLETEDBYAGENT';}utils[_0x6a55('0x3')](util['format'](_0x6a55('0x1e'),_0x2ae63c['uniqueid'],queues[_0x2ae63c['uniqueid']]['name'],queues[_0x2ae63c['uniqueid']]['queuecallerexitreason']));writeDB(queues[_0x2ae63c[_0x6a55('0x5')]]);}else if(queues[_0x2ae63c['uniqueid']][_0x6a55('0xe')]){utils['info'](util[_0x6a55('0x11')](_0x6a55('0x1f'),_0x2ae63c['uniqueid'],queues[_0x2ae63c[_0x6a55('0x5')]][_0x6a55('0x20')],queues[_0x2ae63c[_0x6a55('0x5')]][_0x6a55('0xe')]));queues[queues[_0x2ae63c[_0x6a55('0x5')]]['transfereduniqueid']]=queues[_0x2ae63c['uniqueid']];queues[queues[_0x2ae63c['uniqueid']][_0x6a55('0xe')]][_0x6a55('0x21')]=0x2;delete queues[_0x2ae63c[_0x6a55('0x5')]];}}}catch(_0x534f86){utils['error'](util[_0x6a55('0x11')](_0x6a55('0x19'),_0x2ae63c[_0x6a55('0x5')]),_0x534f86);}};exports[_0x6a55('0x22')]=function(_0x16ed46){try{utils[_0x6a55('0x10')](util[_0x6a55('0x11')](_0x6a55('0x23'),_0x16ed46[_0x6a55('0x5')]),_0x16ed46);if(!_[_0x6a55('0x18')](_0x16ed46['variable']['queuestatus'])&&_0x16ed46[_0x6a55('0x24')]['toUpperCase']()!==_0x6a55('0x25')){if(!_[_0x6a55('0x18')](queues[_0x16ed46['uniqueid']])){queues[_0x16ed46[_0x6a55('0x5')]][_0x6a55('0x1b')]=![];queues[_0x16ed46[_0x6a55('0x5')]][_0x6a55('0x26')]=null;queues[_0x16ed46[_0x6a55('0x5')]]['queuecallerexit']=!![];queues[_0x16ed46[_0x6a55('0x5')]][_0x6a55('0x27')]=utils[_0x6a55('0x15')]();queues[_0x16ed46[_0x6a55('0x5')]]['queuecallerexitreason']=_0x16ed46['value'][_0x6a55('0x28')]();utils['info'](util['format'](_0x6a55('0x29'),_0x16ed46[_0x6a55('0x5')],queues[_0x16ed46[_0x6a55('0x5')]]['name'],_0x16ed46[_0x6a55('0x24')],queues[_0x16ed46['uniqueid']][_0x6a55('0x9')]));writeDB(queues[_0x16ed46[_0x6a55('0x5')]]);}}else if(!_[_0x6a55('0x18')](_0x16ed46['variable'][_0x6a55('0x2a')])){if(!_[_0x6a55('0x18')](queues[_0x16ed46['uniqueid']])&&!queues[_0x16ed46['uniqueid']][_0x6a55('0x1b')]){queues[_0x16ed46[_0x6a55('0x5')]][_0x6a55('0x1b')]=![];queues[_0x16ed46['uniqueid']]['queuecallerabandonAt']=null;queues[_0x16ed46[_0x6a55('0x5')]][_0x6a55('0x1c')]=!![];queues[_0x16ed46['uniqueid']][_0x6a55('0x27')]=utils[_0x6a55('0x15')]();queues[_0x16ed46['uniqueid']][_0x6a55('0x9')]=_0x6a55('0x2b');utils[_0x6a55('0x3')](util[_0x6a55('0x11')](_0x6a55('0x2c'),_0x16ed46['uniqueid'],queues[_0x16ed46[_0x6a55('0x5')]][_0x6a55('0x20')],_0x16ed46[_0x6a55('0x24')],queues[_0x16ed46[_0x6a55('0x5')]]['queuecallerexitreason']));}}}catch(_0x268f0d){utils[_0x6a55('0x2d')](util[_0x6a55('0x11')](_0x6a55('0x23'),_0x16ed46[_0x6a55('0x5')]),_0x268f0d);}};exports[_0x6a55('0x1b')]=function(_0x215738){try{if(!_['isNil'](queues[_0x215738[_0x6a55('0x5')]])){utils[_0x6a55('0x10')](util['format'](_0x6a55('0x2e'),_0x215738[_0x6a55('0x5')]),_0x215738);queues[_0x215738[_0x6a55('0x5')]][_0x6a55('0x1c')]=![];queues[_0x215738[_0x6a55('0x5')]][_0x6a55('0x27')]=null;queues[_0x215738['uniqueid']]['queuecallerabandon']=!![];queues[_0x215738[_0x6a55('0x5')]]['queuecallerabandonAt']=utils[_0x6a55('0x15')]();queues[_0x215738[_0x6a55('0x5')]][_0x6a55('0x9')]='ABANDONED';utils[_0x6a55('0x3')](util[_0x6a55('0x11')](_0x6a55('0x2f'),_0x215738[_0x6a55('0x5')],queues[_0x215738[_0x6a55('0x5')]][_0x6a55('0x20')],queues[_0x215738[_0x6a55('0x5')]][_0x6a55('0x9')]));}}catch(_0x378011){utils[_0x6a55('0x2d')](util['format'](_0x6a55('0x2e'),_0x215738['uniqueid']),_0x378011);}};exports[_0x6a55('0x30')]=function(_0x45ec9f){try{if(!_[_0x6a55('0x18')](queues[_0x45ec9f[_0x6a55('0x5')]])){utils['debug'](util['format']('[%s][queues][queuecallerleave]',_0x45ec9f['uniqueid']),_0x45ec9f);utils[_0x6a55('0x3')](util[_0x6a55('0x11')](_0x6a55('0x31'),_0x45ec9f[_0x6a55('0x5')],queues[_0x45ec9f[_0x6a55('0x5')]]['name'],_0x45ec9f[_0x6a55('0x32')],_0x45ec9f[_0x6a55('0x33')]));queues[_0x45ec9f[_0x6a55('0x5')]]['queuecallerleave']=!![];queues[_0x45ec9f[_0x6a55('0x5')]]['queuecallerleaveAt']=utils[_0x6a55('0x15')]();queues[_0x45ec9f[_0x6a55('0x5')]][_0x6a55('0x34')]=utils[_0x6a55('0x35')](queues[_0x45ec9f['uniqueid']][_0x6a55('0x1a')],queues[_0x45ec9f['uniqueid']][_0x6a55('0x36')]);queues[_0x45ec9f[_0x6a55('0x5')]][_0x6a55('0x13')]=_0x45ec9f[_0x6a55('0x13')];queues[_0x45ec9f['uniqueid']][_0x6a55('0x37')]=_0x45ec9f['count'];queues[_0x45ec9f[_0x6a55('0x5')]][_0x6a55('0x32')]=_0x45ec9f[_0x6a55('0x32')];queues[_0x45ec9f[_0x6a55('0x5')]][_0x6a55('0x33')]=_0x45ec9f[_0x6a55('0x33')];}}catch(_0x316ebe){utils[_0x6a55('0x2d')](util['format'](_0x6a55('0x38'),_0x45ec9f['uniqueid']),_0x316ebe);}};exports[_0x6a55('0x39')]=function(_0x40495e){try{if(!_[_0x6a55('0x18')](queues[_0x40495e[_0x6a55('0x5')]])){utils[_0x6a55('0x10')](util[_0x6a55('0x11')](_0x6a55('0x3a'),_0x40495e[_0x6a55('0x5')]),_0x40495e);utils['info'](util[_0x6a55('0x11')](_0x6a55('0x3b'),_0x40495e[_0x6a55('0x5')],queues[_0x40495e['uniqueid']]['name'],_0x40495e['membername'],_0x40495e[_0x6a55('0x3c')]));queues[_0x40495e[_0x6a55('0x5')]][_0x6a55('0x1b')]=![];queues[_0x40495e['uniqueid']][_0x6a55('0x1b')]=![];queues[_0x40495e[_0x6a55('0x5')]]['queuecallerabandonAt']=null;queues[_0x40495e[_0x6a55('0x5')]][_0x6a55('0x1c')]=![];queues[_0x40495e[_0x6a55('0x5')]][_0x6a55('0x9')]=null;queues[_0x40495e[_0x6a55('0x5')]][_0x6a55('0x27')]=null;queues[_0x40495e[_0x6a55('0x5')]][_0x6a55('0x3d')]=!![];queues[_0x40495e[_0x6a55('0x5')]][_0x6a55('0x8')]=_0x40495e[_0x6a55('0x3c')];queues[_0x40495e[_0x6a55('0x5')]][_0x6a55('0x3e')]=_0x40495e[_0x6a55('0x3f')];}}catch(_0x5e654b){utils[_0x6a55('0x2d')](util[_0x6a55('0x11')](_0x6a55('0x3a'),_0x40495e[_0x6a55('0x5')]),_0x5e654b);}};exports[_0x6a55('0x40')]=function(_0x40f533){try{if(!_[_0x6a55('0x18')](queues[_0x40f533[_0x6a55('0x5')]])){if(queues[_0x40f533[_0x6a55('0x5')]][_0x6a55('0x1a')]){utils['debug'](util[_0x6a55('0x11')](_0x6a55('0x41'),_0x40f533[_0x6a55('0x5')]),_0x40f533);queues[_0x40f533[_0x6a55('0x5')]][_0x6a55('0x1b')]=![];queues[_0x40f533[_0x6a55('0x5')]][_0x6a55('0x1b')]=![];queues[_0x40f533['uniqueid']][_0x6a55('0x26')]=null;queues[_0x40f533['uniqueid']]['queuecallerexit']=![];queues[_0x40f533[_0x6a55('0x5')]][_0x6a55('0x27')]=null;queues[_0x40f533[_0x6a55('0x5')]][_0x6a55('0x3d')]=!![];queues[_0x40f533[_0x6a55('0x5')]][_0x6a55('0x3e')]=_0x40f533[_0x6a55('0x3f')];queues[_0x40f533['uniqueid']][_0x6a55('0x42')]=!![];queues[_0x40f533['uniqueid']][_0x6a55('0x1d')]=utils[_0x6a55('0x15')]();if(_0x40f533['reason']==_0x6a55('0x43')){if(!queues[_0x40f533['uniqueid']][_0x6a55('0x43')]){queues[_0x40f533[_0x6a55('0x5')]][_0x6a55('0x9')]=_0x6a55('0x44');}}else{queues[_0x40f533[_0x6a55('0x5')]][_0x6a55('0x9')]=_0x6a55('0x45')+_0x40f533[_0x6a55('0x46')][_0x6a55('0x28')]();}utils[_0x6a55('0x3')](util[_0x6a55('0x11')](_0x6a55('0x47'),_0x40f533['uniqueid'],queues[_0x40f533[_0x6a55('0x5')]]['name'],_0x40f533[_0x6a55('0x3f')],queues[_0x40f533[_0x6a55('0x5')]][_0x6a55('0x9')]));writeDB(queues[_0x40f533[_0x6a55('0x5')]]);}}}catch(_0x5c14bf){utils[_0x6a55('0x2d')](util[_0x6a55('0x11')](_0x6a55('0x41'),_0x40f533[_0x6a55('0x5')]),_0x5c14bf);}};exports[_0x6a55('0x48')]=function(_0x574ed4){try{if(!_[_0x6a55('0x18')](queues[_0x574ed4[_0x6a55('0x49')]])){utils[_0x6a55('0x10')](util[_0x6a55('0x11')](_0x6a55('0x4a'),_0x574ed4[_0x6a55('0x5')]),_0x574ed4);queues[_0x574ed4['transfereeuniqueid']][_0x6a55('0x43')]=!![];queues[_0x574ed4[_0x6a55('0x49')]][_0x6a55('0x4b')]=_0x6a55('0x4c');queues[_0x574ed4[_0x6a55('0x49')]][_0x6a55('0x4d')]=_0x574ed4[_0x6a55('0x4e')];queues[_0x574ed4[_0x6a55('0x49')]]['transferuniqueid']=_0x574ed4[_0x6a55('0x49')];queues[_0x574ed4[_0x6a55('0x49')]]['queuecallerexitreason']=_0x6a55('0x4f');utils[_0x6a55('0x3')](util[_0x6a55('0x11')](_0x6a55('0x50'),_0x574ed4[_0x6a55('0x5')],queues[_0x574ed4[_0x6a55('0x49')]]['name'],_0x574ed4['transfereeuniqueid'],_0x574ed4['extension']));}}catch(_0x480e75){utils['error'](util[_0x6a55('0x11')](_0x6a55('0x4a'),_0x574ed4[_0x6a55('0x5')]),_0x480e75);}};exports[_0x6a55('0x51')]=function(_0x4d7e68){try{utils[_0x6a55('0x10')](util[_0x6a55('0x11')]('[%s][queues][attendedtransfer]',_0x4d7e68[_0x6a55('0x52')]),_0x4d7e68);if(_0x4d7e68[_0x6a55('0x52')]==_0x4d7e68['origtransfererlinkedid']){if(!_['isNil'](queues[_0x4d7e68[_0x6a55('0x53')]])){utils[_0x6a55('0x3')](util[_0x6a55('0x11')](_0x6a55('0x54'),_0x4d7e68[_0x6a55('0x52')],queues[_0x4d7e68[_0x6a55('0x53')]][_0x6a55('0x20')],_0x4d7e68[_0x6a55('0x55')]));queues[_0x4d7e68[_0x6a55('0x53')]][_0x6a55('0x43')]=!![];queues[_0x4d7e68[_0x6a55('0x53')]][_0x6a55('0x4b')]=_0x6a55('0x56');queues[_0x4d7e68[_0x6a55('0x53')]][_0x6a55('0x4d')]=_0x4d7e68[_0x6a55('0x55')];queues[_0x4d7e68[_0x6a55('0x53')]][_0x6a55('0x57')]=_0x4d7e68['origtransfereruniqueid'];queues[_0x4d7e68[_0x6a55('0x53')]][_0x6a55('0x9')]=_0x6a55('0x58');}if(!_[_0x6a55('0x18')](queues[_0x4d7e68[_0x6a55('0x59')]])){if(_0x4d7e68[_0x6a55('0x5a')]&&queues[_0x4d7e68[_0x6a55('0x5a')]]){queues[_0x4d7e68[_0x6a55('0x5a')]][_0x6a55('0x21')]=0x1;queues[_0x4d7e68[_0x6a55('0x49')]]=_[_0x6a55('0x5b')](queues[_0x4d7e68[_0x6a55('0x5a')]]);queues[_0x4d7e68[_0x6a55('0x49')]][_0x6a55('0xe')]=_0x4d7e68[_0x6a55('0x5c')];queues[_0x4d7e68['transfereeuniqueid']][_0x6a55('0x21')]=0x2;queues[_0x4d7e68['transfereeuniqueid']]['calleridnum']=queues[_0x4d7e68[_0x6a55('0x53')]][_0x6a55('0x7')];queues[_0x4d7e68[_0x6a55('0x49')]][_0x6a55('0x5d')]=queues[_0x4d7e68[_0x6a55('0x53')]][_0x6a55('0x5d')];queues[_0x4d7e68['transfereeuniqueid']][_0x6a55('0x36')]=utils[_0x6a55('0x15')]();queues[_0x4d7e68[_0x6a55('0x49')]][_0x6a55('0x1a')]=utils[_0x6a55('0x15')]();queues[_0x4d7e68[_0x6a55('0x49')]][_0x6a55('0x34')]=0x0;queues[_0x4d7e68[_0x6a55('0x49')]][_0x6a55('0x5e')]=0x0;utils[_0x6a55('0x3')](util[_0x6a55('0x11')](_0x6a55('0x5f'),_0x4d7e68['origtransfereruniqueid'],queues[_0x4d7e68['transfereeuniqueid']][_0x6a55('0x20')],queues[_0x4d7e68[_0x6a55('0x49')]]['calleridnum'],queues[_0x4d7e68['transfereeuniqueid']]['calleridname']));}else{utils['info'](util['format']('[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s',_0x4d7e68['origtransfereruniqueid'],queues[_0x4d7e68[_0x6a55('0x59')]][_0x6a55('0x20')],_0x4d7e68[_0x6a55('0x53')]));queues[_0x4d7e68['origtransfererlinkedid']]['transfereduniqueid']=_0x4d7e68[_0x6a55('0x53')];}}}else if(_0x4d7e68['secondtransfereruniqueid']==_0x4d7e68['secondtransfererlinkedid']){if(!_['isNil'](queues[_0x4d7e68['origtransfererlinkedid']])){utils['info'](util['format']('[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER',_0x4d7e68[_0x6a55('0x52')],queues[_0x4d7e68[_0x6a55('0x59')]][_0x6a55('0x20')],_0x4d7e68[_0x6a55('0x60')],_0x4d7e68['secondtransfererexten']));queues[_0x4d7e68[_0x6a55('0x59')]][_0x6a55('0x43')]=!![];queues[_0x4d7e68['origtransfererlinkedid']][_0x6a55('0x4b')]=_0x6a55('0x56');queues[_0x4d7e68[_0x6a55('0x59')]]['transferexten']=_0x4d7e68['secondtransfererexten'];queues[_0x4d7e68[_0x6a55('0x59')]]['transferuniqueid']=_0x4d7e68[_0x6a55('0x60')];queues[_0x4d7e68[_0x6a55('0x59')]][_0x6a55('0x9')]='ATTENDEDTRANSFER';}if(!_[_0x6a55('0x18')](queues[_0x4d7e68[_0x6a55('0x53')]])){if(_0x4d7e68['transfertargetlinkedid']&&queues[_0x4d7e68[_0x6a55('0x61')]]){queues[_0x4d7e68[_0x6a55('0x61')]][_0x6a55('0x21')]=0x1;queues[_0x4d7e68[_0x6a55('0x5c')]]=_[_0x6a55('0x5b')](queues[_0x4d7e68['transfertargetlinkedid']]);queues[_0x4d7e68[_0x6a55('0x5c')]][_0x6a55('0xe')]=_0x4d7e68[_0x6a55('0x5c')];queues[_0x4d7e68[_0x6a55('0x5c')]][_0x6a55('0x21')]=0x2;queues[_0x4d7e68[_0x6a55('0x5c')]][_0x6a55('0x7')]=queues[_0x4d7e68['origtransfererlinkedid']]['calleridnum'];queues[_0x4d7e68[_0x6a55('0x5c')]]['calleridname']=queues[_0x4d7e68[_0x6a55('0x59')]]['calleridname'];queues[_0x4d7e68[_0x6a55('0x5c')]][_0x6a55('0x36')]=utils[_0x6a55('0x15')]();queues[_0x4d7e68[_0x6a55('0x5c')]][_0x6a55('0x1a')]=utils[_0x6a55('0x15')]();queues[_0x4d7e68[_0x6a55('0x5c')]][_0x6a55('0x34')]=0x0;queues[_0x4d7e68[_0x6a55('0x5c')]][_0x6a55('0x5e')]=0x0;utils[_0x6a55('0x3')](util[_0x6a55('0x11')](_0x6a55('0x62'),_0x4d7e68[_0x6a55('0x52')],queues[_0x4d7e68[_0x6a55('0x5c')]][_0x6a55('0x20')],queues[_0x4d7e68[_0x6a55('0x5c')]][_0x6a55('0xe')],queues[_0x4d7e68['transfertargetuniqueid']][_0x6a55('0x7')],queues[_0x4d7e68['transfertargetuniqueid']][_0x6a55('0x5d')]));}else{utils['info'](util[_0x6a55('0x11')](_0x6a55('0x63'),_0x4d7e68['origtransfereruniqueid'],queues[_0x4d7e68[_0x6a55('0x53')]][_0x6a55('0x20')],_0x4d7e68[_0x6a55('0x59')]));queues[_0x4d7e68[_0x6a55('0x53')]][_0x6a55('0xe')]=_0x4d7e68['origtransfererlinkedid'];}}}}catch(_0x21f740){utils['error'](util['format']('[%s][queues][attendedtransfer]',_0x4d7e68[_0x6a55('0x52')]),_0x21f740);}};exports[_0x6a55('0x64')]=function(_0x128f2a){try{if(!_[_0x6a55('0x18')](queues[_0x128f2a['uniqueid']])){utils[_0x6a55('0x10')](util[_0x6a55('0x11')](_0x6a55('0x65'),_0x128f2a['uniqueid']),_0x128f2a);queues[_0x128f2a[_0x6a55('0x5')]][_0x6a55('0x66')]=utils[_0x6a55('0x15')]();utils['info'](util[_0x6a55('0x11')](_0x6a55('0x67'),_0x128f2a['uniqueid'],queues[_0x128f2a['uniqueid']][_0x6a55('0x20')],queues[_0x128f2a[_0x6a55('0x5')]][_0x6a55('0x66')]));}}catch(_0x593c95){utils[_0x6a55('0x2d')](util[_0x6a55('0x11')](_0x6a55('0x65'),_0x128f2a['uniqueid']),_0x593c95);}};exports[_0x6a55('0x68')]=function(_0x1aceb7){try{if(!_[_0x6a55('0x18')](queues[_0x1aceb7['uniqueid']])){if(!_[_0x6a55('0x18')](queues[_0x1aceb7[_0x6a55('0x5')]][_0x6a55('0x66')])){utils[_0x6a55('0x10')](util[_0x6a55('0x11')](_0x6a55('0x69'),_0x1aceb7[_0x6a55('0x5')]),_0x1aceb7);queues[_0x1aceb7[_0x6a55('0x5')]][_0x6a55('0x5e')]+=utils['diffTime'](utils[_0x6a55('0x15')](),queues[_0x1aceb7['uniqueid']][_0x6a55('0x66')]);utils[_0x6a55('0x3')](util[_0x6a55('0x11')](_0x6a55('0x6a'),_0x1aceb7[_0x6a55('0x5')],queues[_0x1aceb7[_0x6a55('0x5')]][_0x6a55('0x20')],queues[_0x1aceb7[_0x6a55('0x5')]][_0x6a55('0x5e')]));delete queues[_0x1aceb7[_0x6a55('0x5')]][_0x6a55('0x66')];}}}catch(_0x1c276a){utils[_0x6a55('0x2d')](util[_0x6a55('0x11')]('[%s][queues][musiconholdstop]',_0x1aceb7[_0x6a55('0x5')]),_0x1c276a);}}; \ No newline at end of file +var _0x1dd3=['[%s][queues][varset]','[%s][queues][queuecallerabandon]','ABANDONED','[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s','queuecallerleave','[%s][queues][queuecallerleave]','[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s','connectedlinenum','connectedlinename','holdtime','diffTime','queuecallerjoinAt','position','count','agentconnect','[%s][queues][agentconnect]','[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s','membername','destaccountcode','queuecallerexitAt','assigned','agentcomplete','[%s][queues][agentcomplete]','reason','transfer','TRANSFER','COMPLETEDBY','blindtransfer','transfereeuniqueid','[%s][queues][blindtransfer]','BLIND','extension','[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER','attendedtransfer','[%s][queues][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','secondtransfererlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','origtransfererexten','transfertype','transferuniqueid','ATTENDEDTRANSFER','transfereelinkedid','transfertargetuniqueid','calleridnum','calleridname','mohtime','[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s','secondtransfereruniqueid','[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','transferexten','secondtransfererexten','transfertargetlinkedid','clone','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','musiconholdstart','[%s][queues][musiconholdstart]','musiconholdstartAt','[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s','musiconholdstop','[%s][queues][musiconholdstop]','[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s','lodash','util','format','[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s','uniqueid','channel','lastAssignedTo','accountcode','then','type','CreateVoiceQueueReport','request','transfereduniqueid','queuecallerjoin','debug','[%s][queues][queuecallerjoin]','info','[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s','queue','assign','error','hangup','queuecallerleaveAt','queuecallerabandon','queuecallerexit','queuecallercomplete','queuecallercompleteAt','now','queuecallerexitreason','COMPLETEDBYAGENT','[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s','name','queuecallerenterreason','[%s][queues][hangup]','varset','isNil','queuestatus','value','toUpperCase','CONTINUE','queuecallerabandonAt','[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s','queueposition','[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s'];(function(_0x365ea3,_0x1ce969){var _0x3c95a8=function(_0x3b5fce){while(--_0x3b5fce){_0x365ea3['push'](_0x365ea3['shift']());}};_0x3c95a8(++_0x1ce969);}(_0x1dd3,0x184));var _0x31dd=function(_0x405d00,_0x395604){_0x405d00=_0x405d00-0x0;var _0xfa3103=_0x1dd3[_0x405d00];return _0xfa3103;};'use strict';var _=require(_0x31dd('0x0'));var util=require(_0x31dd('0x1'));var utils=require('./utils');var queues={};function writeDB(_0x4dc51b){utils['info'](util[_0x31dd('0x2')](_0x31dd('0x3'),_0x4dc51b[_0x31dd('0x4')],_0x4dc51b[_0x31dd('0x5')],_0x4dc51b['queue'],_0x4dc51b[_0x31dd('0x6')],_0x4dc51b['calleridnum'],_0x4dc51b[_0x31dd('0x7')],_0x4dc51b['queuecallerexitreason']));if(_0x4dc51b['queue']){utils['getVoiceQueueByName'](_0x4dc51b['queue'])[_0x31dd('0x8')](function(_0x370f65){if(_0x370f65){_0x4dc51b[_0x31dd('0x9')]=_0x370f65['type'];}utils['request'](_0x31dd('0xa'),_0x4dc51b);});}else{utils[_0x31dd('0xb')](_0x31dd('0xa'),_0x4dc51b);}if(_0x4dc51b[_0x31dd('0xc')]){delete queues[_0x4dc51b[_0x31dd('0xc')]];}else{delete queues[_0x4dc51b[_0x31dd('0x4')]];}}exports[_0x31dd('0xd')]=function(_0x1e3b84){try{utils[_0x31dd('0xe')](util[_0x31dd('0x2')](_0x31dd('0xf'),_0x1e3b84[_0x31dd('0x4')]),_0x1e3b84);utils[_0x31dd('0x10')](util['format'](_0x31dd('0x11'),_0x1e3b84[_0x31dd('0x4')],_0x1e3b84[_0x31dd('0x12')],_0x1e3b84['position']));queues[_0x1e3b84[_0x31dd('0x4')]]=_[_0x31dd('0x13')](_0x1e3b84,{'originalposition':_0x1e3b84['position'],'queuecallerjoinAt':utils['now'](),'mohtime':0x0});}catch(_0x3e3add){utils[_0x31dd('0x14')](util[_0x31dd('0x2')](_0x31dd('0xf'),_0x1e3b84[_0x31dd('0x4')]),_0x3e3add);}};exports[_0x31dd('0x15')]=function(_0x2a00e5){try{if(!_['isNil'](queues[_0x2a00e5[_0x31dd('0x4')]])){utils[_0x31dd('0xe')](util[_0x31dd('0x2')]('[%s][queues][hangup]',_0x2a00e5[_0x31dd('0x4')]),_0x2a00e5);if(queues[_0x2a00e5[_0x31dd('0x4')]][_0x31dd('0x16')]){if(!queues[_0x2a00e5[_0x31dd('0x4')]][_0x31dd('0x17')]&&!queues[_0x2a00e5[_0x31dd('0x4')]][_0x31dd('0x18')]){queues[_0x2a00e5[_0x31dd('0x4')]][_0x31dd('0x19')]=!![];queues[_0x2a00e5['uniqueid']][_0x31dd('0x1a')]=utils[_0x31dd('0x1b')]();queues[_0x2a00e5['uniqueid']][_0x31dd('0x1c')]=_0x31dd('0x1d');}utils['info'](util[_0x31dd('0x2')](_0x31dd('0x1e'),_0x2a00e5[_0x31dd('0x4')],queues[_0x2a00e5['uniqueid']][_0x31dd('0x1f')],queues[_0x2a00e5[_0x31dd('0x4')]][_0x31dd('0x1c')]));writeDB(queues[_0x2a00e5[_0x31dd('0x4')]]);}else if(queues[_0x2a00e5[_0x31dd('0x4')]][_0x31dd('0xc')]){utils[_0x31dd('0x10')](util['format']('[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s',_0x2a00e5[_0x31dd('0x4')],queues[_0x2a00e5[_0x31dd('0x4')]][_0x31dd('0x1f')],queues[_0x2a00e5[_0x31dd('0x4')]][_0x31dd('0xc')]));queues[queues[_0x2a00e5[_0x31dd('0x4')]][_0x31dd('0xc')]]=queues[_0x2a00e5[_0x31dd('0x4')]];queues[queues[_0x2a00e5[_0x31dd('0x4')]][_0x31dd('0xc')]][_0x31dd('0x20')]=0x2;delete queues[_0x2a00e5[_0x31dd('0x4')]];}}}catch(_0x47da9c){utils[_0x31dd('0x14')](util[_0x31dd('0x2')](_0x31dd('0x21'),_0x2a00e5['uniqueid']),_0x47da9c);}};exports[_0x31dd('0x22')]=function(_0x7844a7){try{utils[_0x31dd('0xe')](util['format']('[%s][queues][varset]',_0x7844a7[_0x31dd('0x4')]),_0x7844a7);if(!_[_0x31dd('0x23')](_0x7844a7['variable'][_0x31dd('0x24')])&&_0x7844a7[_0x31dd('0x25')][_0x31dd('0x26')]()!==_0x31dd('0x27')){if(!_[_0x31dd('0x23')](queues[_0x7844a7['uniqueid']])){queues[_0x7844a7[_0x31dd('0x4')]]['queuecallerabandon']=![];queues[_0x7844a7[_0x31dd('0x4')]][_0x31dd('0x28')]=null;queues[_0x7844a7[_0x31dd('0x4')]][_0x31dd('0x18')]=!![];queues[_0x7844a7['uniqueid']]['queuecallerexitAt']=utils[_0x31dd('0x1b')]();queues[_0x7844a7['uniqueid']][_0x31dd('0x1c')]=_0x7844a7[_0x31dd('0x25')][_0x31dd('0x26')]();utils[_0x31dd('0x10')](util[_0x31dd('0x2')](_0x31dd('0x29'),_0x7844a7[_0x31dd('0x4')],queues[_0x7844a7[_0x31dd('0x4')]]['name'],_0x7844a7[_0x31dd('0x25')],queues[_0x7844a7['uniqueid']][_0x31dd('0x1c')]));writeDB(queues[_0x7844a7[_0x31dd('0x4')]]);}}else if(!_['isNil'](_0x7844a7['variable'][_0x31dd('0x2a')])){if(!_[_0x31dd('0x23')](queues[_0x7844a7['uniqueid']])&&!queues[_0x7844a7[_0x31dd('0x4')]][_0x31dd('0x17')]){queues[_0x7844a7[_0x31dd('0x4')]][_0x31dd('0x17')]=![];queues[_0x7844a7[_0x31dd('0x4')]]['queuecallerabandonAt']=null;queues[_0x7844a7[_0x31dd('0x4')]][_0x31dd('0x18')]=!![];queues[_0x7844a7[_0x31dd('0x4')]]['queuecallerexitAt']=utils['now']();queues[_0x7844a7[_0x31dd('0x4')]]['queuecallerexitreason']='EXITWITHKEY';utils['info'](util[_0x31dd('0x2')](_0x31dd('0x2b'),_0x7844a7['uniqueid'],queues[_0x7844a7['uniqueid']][_0x31dd('0x1f')],_0x7844a7['value'],queues[_0x7844a7[_0x31dd('0x4')]]['queuecallerexitreason']));}}}catch(_0x18ab11){utils['error'](util['format'](_0x31dd('0x2c'),_0x7844a7['uniqueid']),_0x18ab11);}};exports[_0x31dd('0x17')]=function(_0x5f46b8){try{if(!_[_0x31dd('0x23')](queues[_0x5f46b8[_0x31dd('0x4')]])){utils[_0x31dd('0xe')](util['format'](_0x31dd('0x2d'),_0x5f46b8['uniqueid']),_0x5f46b8);queues[_0x5f46b8['uniqueid']][_0x31dd('0x18')]=![];queues[_0x5f46b8[_0x31dd('0x4')]]['queuecallerexitAt']=null;queues[_0x5f46b8[_0x31dd('0x4')]]['queuecallerabandon']=!![];queues[_0x5f46b8[_0x31dd('0x4')]][_0x31dd('0x28')]=utils[_0x31dd('0x1b')]();queues[_0x5f46b8['uniqueid']]['queuecallerexitreason']=_0x31dd('0x2e');utils['info'](util[_0x31dd('0x2')](_0x31dd('0x2f'),_0x5f46b8[_0x31dd('0x4')],queues[_0x5f46b8[_0x31dd('0x4')]][_0x31dd('0x1f')],queues[_0x5f46b8[_0x31dd('0x4')]][_0x31dd('0x1c')]));}}catch(_0x7aaf3f){utils[_0x31dd('0x14')](util[_0x31dd('0x2')](_0x31dd('0x2d'),_0x5f46b8[_0x31dd('0x4')]),_0x7aaf3f);}};exports[_0x31dd('0x30')]=function(_0x2cac80){try{if(!_[_0x31dd('0x23')](queues[_0x2cac80[_0x31dd('0x4')]])){utils[_0x31dd('0xe')](util[_0x31dd('0x2')](_0x31dd('0x31'),_0x2cac80[_0x31dd('0x4')]),_0x2cac80);utils[_0x31dd('0x10')](util[_0x31dd('0x2')](_0x31dd('0x32'),_0x2cac80[_0x31dd('0x4')],queues[_0x2cac80[_0x31dd('0x4')]]['name'],_0x2cac80[_0x31dd('0x33')],_0x2cac80[_0x31dd('0x34')]));queues[_0x2cac80[_0x31dd('0x4')]][_0x31dd('0x30')]=!![];queues[_0x2cac80[_0x31dd('0x4')]][_0x31dd('0x16')]=utils['now']();queues[_0x2cac80[_0x31dd('0x4')]][_0x31dd('0x35')]=utils[_0x31dd('0x36')](queues[_0x2cac80[_0x31dd('0x4')]]['queuecallerleaveAt'],queues[_0x2cac80[_0x31dd('0x4')]][_0x31dd('0x37')]);queues[_0x2cac80[_0x31dd('0x4')]][_0x31dd('0x38')]=_0x2cac80[_0x31dd('0x38')];queues[_0x2cac80['uniqueid']][_0x31dd('0x39')]=_0x2cac80[_0x31dd('0x39')];queues[_0x2cac80['uniqueid']][_0x31dd('0x33')]=_0x2cac80[_0x31dd('0x33')];queues[_0x2cac80['uniqueid']][_0x31dd('0x34')]=_0x2cac80[_0x31dd('0x34')];}}catch(_0x23c82a){utils['error'](util[_0x31dd('0x2')]('[%s][queues][queuecallerleave]',_0x2cac80[_0x31dd('0x4')]),_0x23c82a);}};exports[_0x31dd('0x3a')]=function(_0x3b004f){try{if(!_[_0x31dd('0x23')](queues[_0x3b004f['uniqueid']])){utils[_0x31dd('0xe')](util[_0x31dd('0x2')](_0x31dd('0x3b'),_0x3b004f[_0x31dd('0x4')]),_0x3b004f);utils[_0x31dd('0x10')](util[_0x31dd('0x2')](_0x31dd('0x3c'),_0x3b004f[_0x31dd('0x4')],queues[_0x3b004f['uniqueid']][_0x31dd('0x1f')],_0x3b004f[_0x31dd('0x3d')],_0x3b004f[_0x31dd('0x3e')]));queues[_0x3b004f['uniqueid']][_0x31dd('0x17')]=![];queues[_0x3b004f[_0x31dd('0x4')]]['queuecallerabandon']=![];queues[_0x3b004f[_0x31dd('0x4')]][_0x31dd('0x28')]=null;queues[_0x3b004f[_0x31dd('0x4')]][_0x31dd('0x18')]=![];queues[_0x3b004f['uniqueid']][_0x31dd('0x1c')]=null;queues[_0x3b004f[_0x31dd('0x4')]][_0x31dd('0x3f')]=null;queues[_0x3b004f[_0x31dd('0x4')]][_0x31dd('0x40')]=!![];queues[_0x3b004f[_0x31dd('0x4')]][_0x31dd('0x7')]=_0x3b004f[_0x31dd('0x3e')];queues[_0x3b004f[_0x31dd('0x4')]][_0x31dd('0x6')]=_0x3b004f['membername'];}}catch(_0xeb75d2){utils[_0x31dd('0x14')](util[_0x31dd('0x2')](_0x31dd('0x3b'),_0x3b004f[_0x31dd('0x4')]),_0xeb75d2);}};exports[_0x31dd('0x41')]=function(_0xd37ff6){try{if(!_[_0x31dd('0x23')](queues[_0xd37ff6[_0x31dd('0x4')]])){if(queues[_0xd37ff6['uniqueid']][_0x31dd('0x16')]){utils[_0x31dd('0xe')](util[_0x31dd('0x2')](_0x31dd('0x42'),_0xd37ff6['uniqueid']),_0xd37ff6);queues[_0xd37ff6['uniqueid']][_0x31dd('0x17')]=![];queues[_0xd37ff6['uniqueid']][_0x31dd('0x17')]=![];queues[_0xd37ff6[_0x31dd('0x4')]][_0x31dd('0x28')]=null;queues[_0xd37ff6[_0x31dd('0x4')]][_0x31dd('0x18')]=![];queues[_0xd37ff6[_0x31dd('0x4')]]['queuecallerexitAt']=null;queues[_0xd37ff6[_0x31dd('0x4')]][_0x31dd('0x40')]=!![];queues[_0xd37ff6[_0x31dd('0x4')]]['lastAssignedTo']=_0xd37ff6[_0x31dd('0x3d')];queues[_0xd37ff6[_0x31dd('0x4')]][_0x31dd('0x19')]=!![];queues[_0xd37ff6[_0x31dd('0x4')]][_0x31dd('0x1a')]=utils[_0x31dd('0x1b')]();if(_0xd37ff6[_0x31dd('0x43')]==_0x31dd('0x44')){if(!queues[_0xd37ff6[_0x31dd('0x4')]][_0x31dd('0x44')]){queues[_0xd37ff6[_0x31dd('0x4')]]['queuecallerexitreason']=_0x31dd('0x45');}}else{queues[_0xd37ff6[_0x31dd('0x4')]][_0x31dd('0x1c')]=_0x31dd('0x46')+_0xd37ff6[_0x31dd('0x43')]['toUpperCase']();}utils[_0x31dd('0x10')](util['format']('[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s',_0xd37ff6['uniqueid'],queues[_0xd37ff6[_0x31dd('0x4')]][_0x31dd('0x1f')],_0xd37ff6['membername'],queues[_0xd37ff6[_0x31dd('0x4')]][_0x31dd('0x1c')]));writeDB(queues[_0xd37ff6[_0x31dd('0x4')]]);}}}catch(_0x49d5f3){utils[_0x31dd('0x14')](util[_0x31dd('0x2')](_0x31dd('0x42'),_0xd37ff6[_0x31dd('0x4')]),_0x49d5f3);}};exports[_0x31dd('0x47')]=function(_0x4f8421){try{if(!_['isNil'](queues[_0x4f8421[_0x31dd('0x48')]])){utils[_0x31dd('0xe')](util[_0x31dd('0x2')](_0x31dd('0x49'),_0x4f8421[_0x31dd('0x4')]),_0x4f8421);queues[_0x4f8421[_0x31dd('0x48')]][_0x31dd('0x44')]=!![];queues[_0x4f8421[_0x31dd('0x48')]]['transfertype']=_0x31dd('0x4a');queues[_0x4f8421[_0x31dd('0x48')]]['transferexten']=_0x4f8421[_0x31dd('0x4b')];queues[_0x4f8421[_0x31dd('0x48')]]['transferuniqueid']=_0x4f8421[_0x31dd('0x48')];queues[_0x4f8421[_0x31dd('0x48')]][_0x31dd('0x1c')]='BLINDTRANSFER';utils['info'](util['format'](_0x31dd('0x4c'),_0x4f8421[_0x31dd('0x4')],queues[_0x4f8421[_0x31dd('0x48')]]['name'],_0x4f8421[_0x31dd('0x48')],_0x4f8421[_0x31dd('0x4b')]));}}catch(_0x8e62e3){utils[_0x31dd('0x14')](util[_0x31dd('0x2')](_0x31dd('0x49'),_0x4f8421[_0x31dd('0x4')]),_0x8e62e3);}};exports[_0x31dd('0x4d')]=function(_0x28f241){try{utils[_0x31dd('0xe')](util[_0x31dd('0x2')](_0x31dd('0x4e'),_0x28f241[_0x31dd('0x4f')]),_0x28f241);if(_0x28f241[_0x31dd('0x4f')]==_0x28f241[_0x31dd('0x50')]){if(!_[_0x31dd('0x23')](queues[_0x28f241[_0x31dd('0x51')]])){utils['info'](util[_0x31dd('0x2')](_0x31dd('0x52'),_0x28f241[_0x31dd('0x4f')],queues[_0x28f241[_0x31dd('0x51')]][_0x31dd('0x1f')],_0x28f241[_0x31dd('0x53')]));queues[_0x28f241[_0x31dd('0x51')]][_0x31dd('0x44')]=!![];queues[_0x28f241['secondtransfererlinkedid']][_0x31dd('0x54')]='ATTENDED';queues[_0x28f241[_0x31dd('0x51')]]['transferexten']=_0x28f241[_0x31dd('0x53')];queues[_0x28f241[_0x31dd('0x51')]][_0x31dd('0x55')]=_0x28f241[_0x31dd('0x4f')];queues[_0x28f241[_0x31dd('0x51')]][_0x31dd('0x1c')]=_0x31dd('0x56');}if(!_[_0x31dd('0x23')](queues[_0x28f241[_0x31dd('0x50')]])){if(_0x28f241['transfereelinkedid']&&queues[_0x28f241[_0x31dd('0x57')]]){queues[_0x28f241['transfereelinkedid']][_0x31dd('0x20')]=0x1;queues[_0x28f241[_0x31dd('0x48')]]=_['clone'](queues[_0x28f241[_0x31dd('0x57')]]);queues[_0x28f241[_0x31dd('0x48')]][_0x31dd('0xc')]=_0x28f241[_0x31dd('0x58')];queues[_0x28f241[_0x31dd('0x48')]][_0x31dd('0x20')]=0x2;queues[_0x28f241[_0x31dd('0x48')]][_0x31dd('0x59')]=queues[_0x28f241['secondtransfererlinkedid']][_0x31dd('0x59')];queues[_0x28f241[_0x31dd('0x48')]][_0x31dd('0x5a')]=queues[_0x28f241['secondtransfererlinkedid']][_0x31dd('0x5a')];queues[_0x28f241[_0x31dd('0x48')]]['queuecallerjoinAt']=utils['now']();queues[_0x28f241[_0x31dd('0x48')]][_0x31dd('0x16')]=utils['now']();queues[_0x28f241[_0x31dd('0x48')]]['holdtime']=0x0;queues[_0x28f241[_0x31dd('0x48')]][_0x31dd('0x5b')]=0x0;utils[_0x31dd('0x10')](util[_0x31dd('0x2')](_0x31dd('0x5c'),_0x28f241[_0x31dd('0x4f')],queues[_0x28f241['transfereeuniqueid']][_0x31dd('0x1f')],queues[_0x28f241[_0x31dd('0x48')]]['calleridnum'],queues[_0x28f241[_0x31dd('0x48')]]['calleridname']));}else{utils[_0x31dd('0x10')](util[_0x31dd('0x2')]('[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s',_0x28f241[_0x31dd('0x4f')],queues[_0x28f241[_0x31dd('0x50')]][_0x31dd('0x1f')],_0x28f241[_0x31dd('0x51')]));queues[_0x28f241['origtransfererlinkedid']]['transfereduniqueid']=_0x28f241['secondtransfererlinkedid'];}}}else if(_0x28f241[_0x31dd('0x5d')]==_0x28f241[_0x31dd('0x51')]){if(!_[_0x31dd('0x23')](queues[_0x28f241[_0x31dd('0x50')]])){utils[_0x31dd('0x10')](util[_0x31dd('0x2')](_0x31dd('0x5e'),_0x28f241[_0x31dd('0x4f')],queues[_0x28f241['origtransfererlinkedid']][_0x31dd('0x1f')],_0x28f241[_0x31dd('0x5d')],_0x28f241['secondtransfererexten']));queues[_0x28f241['origtransfererlinkedid']][_0x31dd('0x44')]=!![];queues[_0x28f241[_0x31dd('0x50')]][_0x31dd('0x54')]='ATTENDED';queues[_0x28f241['origtransfererlinkedid']][_0x31dd('0x5f')]=_0x28f241[_0x31dd('0x60')];queues[_0x28f241[_0x31dd('0x50')]][_0x31dd('0x55')]=_0x28f241['secondtransfereruniqueid'];queues[_0x28f241[_0x31dd('0x50')]]['queuecallerexitreason']=_0x31dd('0x56');}if(!_['isNil'](queues[_0x28f241[_0x31dd('0x51')]])){if(_0x28f241['transfertargetlinkedid']&&queues[_0x28f241[_0x31dd('0x61')]]){queues[_0x28f241[_0x31dd('0x61')]][_0x31dd('0x20')]=0x1;queues[_0x28f241[_0x31dd('0x58')]]=_[_0x31dd('0x62')](queues[_0x28f241[_0x31dd('0x61')]]);queues[_0x28f241[_0x31dd('0x58')]][_0x31dd('0xc')]=_0x28f241['transfertargetuniqueid'];queues[_0x28f241['transfertargetuniqueid']][_0x31dd('0x20')]=0x2;queues[_0x28f241[_0x31dd('0x58')]][_0x31dd('0x59')]=queues[_0x28f241[_0x31dd('0x50')]][_0x31dd('0x59')];queues[_0x28f241[_0x31dd('0x58')]][_0x31dd('0x5a')]=queues[_0x28f241[_0x31dd('0x50')]]['calleridname'];queues[_0x28f241[_0x31dd('0x58')]]['queuecallerjoinAt']=utils[_0x31dd('0x1b')]();queues[_0x28f241[_0x31dd('0x58')]][_0x31dd('0x16')]=utils[_0x31dd('0x1b')]();queues[_0x28f241[_0x31dd('0x58')]][_0x31dd('0x35')]=0x0;queues[_0x28f241[_0x31dd('0x58')]]['mohtime']=0x0;utils[_0x31dd('0x10')](util[_0x31dd('0x2')](_0x31dd('0x63'),_0x28f241[_0x31dd('0x4f')],queues[_0x28f241['transfertargetuniqueid']][_0x31dd('0x1f')],queues[_0x28f241['transfertargetuniqueid']]['transfereduniqueid'],queues[_0x28f241[_0x31dd('0x58')]][_0x31dd('0x59')],queues[_0x28f241[_0x31dd('0x58')]][_0x31dd('0x5a')]));}else{utils['info'](util[_0x31dd('0x2')](_0x31dd('0x64'),_0x28f241['origtransfereruniqueid'],queues[_0x28f241[_0x31dd('0x51')]][_0x31dd('0x1f')],_0x28f241['origtransfererlinkedid']));queues[_0x28f241[_0x31dd('0x51')]][_0x31dd('0xc')]=_0x28f241[_0x31dd('0x50')];}}}}catch(_0x5eb370){utils['error'](util[_0x31dd('0x2')](_0x31dd('0x4e'),_0x28f241[_0x31dd('0x4f')]),_0x5eb370);}};exports[_0x31dd('0x65')]=function(_0x2f1c4e){try{if(!_['isNil'](queues[_0x2f1c4e[_0x31dd('0x4')]])){utils[_0x31dd('0xe')](util[_0x31dd('0x2')](_0x31dd('0x66'),_0x2f1c4e[_0x31dd('0x4')]),_0x2f1c4e);queues[_0x2f1c4e[_0x31dd('0x4')]][_0x31dd('0x67')]=utils[_0x31dd('0x1b')]();utils[_0x31dd('0x10')](util['format'](_0x31dd('0x68'),_0x2f1c4e[_0x31dd('0x4')],queues[_0x2f1c4e[_0x31dd('0x4')]]['name'],queues[_0x2f1c4e['uniqueid']]['musiconholdstartAt']));}}catch(_0x503e8a){utils[_0x31dd('0x14')](util['format']('[%s][queues][musiconholdstart]',_0x2f1c4e['uniqueid']),_0x503e8a);}};exports[_0x31dd('0x69')]=function(_0x277f88){try{if(!_[_0x31dd('0x23')](queues[_0x277f88['uniqueid']])){if(!_[_0x31dd('0x23')](queues[_0x277f88[_0x31dd('0x4')]]['musiconholdstartAt'])){utils['debug'](util[_0x31dd('0x2')](_0x31dd('0x6a'),_0x277f88[_0x31dd('0x4')]),_0x277f88);queues[_0x277f88[_0x31dd('0x4')]][_0x31dd('0x5b')]+=utils['diffTime'](utils[_0x31dd('0x1b')](),queues[_0x277f88[_0x31dd('0x4')]][_0x31dd('0x67')]);utils[_0x31dd('0x10')](util[_0x31dd('0x2')](_0x31dd('0x6b'),_0x277f88[_0x31dd('0x4')],queues[_0x277f88[_0x31dd('0x4')]][_0x31dd('0x1f')],queues[_0x277f88[_0x31dd('0x4')]][_0x31dd('0x5b')]));delete queues[_0x277f88[_0x31dd('0x4')]][_0x31dd('0x67')];}}}catch(_0x365902){utils[_0x31dd('0x14')](util[_0x31dd('0x2')](_0x31dd('0x6a'),_0x277f88[_0x31dd('0x4')]),_0x365902);}}; \ No newline at end of file diff --git a/server/services/xdr/recordings.controller.js b/server/services/xdr/recordings.controller.js index 1007a72..97450f0 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 _0xe753=['then','name','CreateVoiceRecording','request','newchannel','debug','[%s][recordings][newchannel]','linkedid','info','[%s][recordings][newchannel]\x20context:%s\x20exten:%s','context','exten','channel','newstate','[%s][recordings][newstate]','isNil','channelstate','[%s][recordings][newstate]\x20context:%s\x20channel:%s','error','varset','variable','mixmonitor_filename','[%s][recordings][varset]','[%s][recordings][varset]\x20variable:%s\x20value:%s','value','endsWith','replace','.wav49','.WAV','monitors','hangup','[%s][recordings][hangup]','[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s','calleridnum','calleridname','cause-txt','connectedlinenum','connectedlinename','type','outbound','clone','newexten','[%s][recordings][newexten]','[%s][recordings][newexten]\x20application:%s\x20appdata:%s','toLowerCase','set','startsWith','appdata','cdr','lastIndexOf','queuecallerjoin','[%s][recordings][queuecallerjoin]','[%s][recordings][queuecallerjoin]\x20queue:%s','queue','blindtransfer','[%s][recordings][blindtransfer]','[%s][recordings][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transfereecalleridnum','transfereecalleridname','transfereruniqueid','lodash','util','./transfers.controller','format','[%s][recordings][writeDB]','blinds','uniqueid','transfereeuniqueid','accountcode','getUserByInternal'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe753,0x82));var _0x3e75=function(_0x17aa6b,_0x375e08){_0x17aa6b=_0x17aa6b-0x0;var _0x5da3e7=_0xe753[_0x17aa6b];return _0x5da3e7;};'use strict';var _=require(_0x3e75('0x0'));var util=require(_0x3e75('0x1'));var utils=require('./utils');var transfers=require(_0x3e75('0x2'));var recordings={};function writeDB(_0x1f05fc){var _0x4eea96;utils['info'](util[_0x3e75('0x3')](_0x3e75('0x4'),_0x1f05fc['uniqueid']));if(transfers[_0x3e75('0x5')][_0x1f05fc[_0x3e75('0x6')]]){_0x4eea96=_0x1f05fc[_0x3e75('0x6')];_0x1f05fc['uniqueid']=transfers['blinds'][_0x1f05fc[_0x3e75('0x6')]][_0x3e75('0x7')];}if(_0x1f05fc[_0x3e75('0x8')]){utils[_0x3e75('0x9')](_0x1f05fc['accountcode'])[_0x3e75('0xa')](function(_0x1881be){if(_0x1881be){_0x1f05fc['membername']=_0x1881be[_0x3e75('0xb')];_0x1f05fc['UserId']=_0x1881be['id'];}utils['request'](_0x3e75('0xc'),_0x1f05fc);});}else{utils[_0x3e75('0xd')](_0x3e75('0xc'),_0x1f05fc);}if(_0x4eea96)delete transfers['blinds'][_0x4eea96];}exports[_0x3e75('0xe')]=function(_0x5cd1c9){try{utils[_0x3e75('0xf')](util[_0x3e75('0x3')](_0x3e75('0x10'),_0x5cd1c9[_0x3e75('0x6')]),_0x5cd1c9);if(_0x5cd1c9['uniqueid']==_0x5cd1c9[_0x3e75('0x11')]){utils[_0x3e75('0x12')](util[_0x3e75('0x3')](_0x3e75('0x13'),_0x5cd1c9[_0x3e75('0x6')],_0x5cd1c9[_0x3e75('0x14')],_0x5cd1c9[_0x3e75('0x15')]));recordings[_0x5cd1c9[_0x3e75('0x6')]]={'uniqueid':_0x5cd1c9[_0x3e75('0x6')],'accountcode':_0x5cd1c9[_0x3e75('0x8')],'exten':_0x5cd1c9[_0x3e75('0x15')],'context':_0x5cd1c9[_0x3e75('0x14')],'channel':_0x5cd1c9[_0x3e75('0x16')],'monitors':[]};}}catch(_0x200d1b){utils['error'](util[_0x3e75('0x3')](_0x3e75('0x10'),_0x5cd1c9[_0x3e75('0x6')]),_0x200d1b);}};exports[_0x3e75('0x17')]=function(_0x119964){try{utils[_0x3e75('0xf')](util[_0x3e75('0x3')](_0x3e75('0x18'),_0x119964[_0x3e75('0x6')]),_0x119964);if(!_[_0x3e75('0x19')](recordings[_0x119964[_0x3e75('0x6')]])&&_0x119964[_0x3e75('0x1a')]==0x6){utils[_0x3e75('0x12')](util['format'](_0x3e75('0x1b'),_0x119964[_0x3e75('0x6')],_0x119964[_0x3e75('0x14')],_0x119964[_0x3e75('0x16')]));}else if(!_[_0x3e75('0x19')](recordings[_0x119964['linkedid']])&&_0x119964[_0x3e75('0x1a')]==0x6&&_0x119964[_0x3e75('0x14')]!='transfer'){utils[_0x3e75('0x12')](util[_0x3e75('0x3')]('[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s',_0x119964[_0x3e75('0x6')],_0x119964[_0x3e75('0x11')],_0x119964[_0x3e75('0x14')],_0x119964['channel']));recordings[_0x119964[_0x3e75('0x11')]][_0x3e75('0x8')]=_0x119964[_0x3e75('0x8')];}}catch(_0x29f71c){utils[_0x3e75('0x1c')](util[_0x3e75('0x3')](_0x3e75('0x18'),_0x119964[_0x3e75('0x6')]),_0x29f71c);}};exports[_0x3e75('0x1d')]=function(_0x790a01){try{if(!_[_0x3e75('0x19')](_0x790a01['variable'])&&!_[_0x3e75('0x19')](_0x790a01[_0x3e75('0x1e')][_0x3e75('0x1f')])){utils[_0x3e75('0xf')](util[_0x3e75('0x3')](_0x3e75('0x20'),_0x790a01[_0x3e75('0x6')]),_0x790a01);utils[_0x3e75('0x12')](util[_0x3e75('0x3')](_0x3e75('0x21'),_0x790a01[_0x3e75('0x6')],_0x790a01[_0x3e75('0x1e')],_0x790a01[_0x3e75('0x22')]));if(_[_0x3e75('0x23')](_0x790a01[_0x3e75('0x22')],'.wav49')){_0x790a01[_0x3e75('0x22')]=_0x790a01['value'][_0x3e75('0x24')](_0x3e75('0x25'),_0x3e75('0x26'));}if(recordings[_0x790a01[_0x3e75('0x11')]]){var _0x543a10=_['find'](recordings[_0x790a01[_0x3e75('0x11')]]['monitors'],{'value':_0x790a01[_0x3e75('0x22')]});if(_[_0x3e75('0x19')](_0x543a10)){recordings[_0x790a01[_0x3e75('0x11')]][_0x3e75('0x27')]['push']({'value':_0x790a01['value']});}}}}catch(_0x41b820){utils[_0x3e75('0x1c')](util[_0x3e75('0x3')](_0x3e75('0x20'),_0x790a01['uniqueid']),_0x41b820);}};exports[_0x3e75('0x28')]=function(_0x4fb356){try{if(!_[_0x3e75('0x19')](recordings[_0x4fb356[_0x3e75('0x6')]])){utils[_0x3e75('0xf')](util[_0x3e75('0x3')](_0x3e75('0x29'),_0x4fb356[_0x3e75('0x6')]),_0x4fb356);utils[_0x3e75('0x12')](util[_0x3e75('0x3')](_0x3e75('0x2a'),_0x4fb356['uniqueid'],_0x4fb356[_0x3e75('0x2b')],_0x4fb356[_0x3e75('0x2c')],_0x4fb356[_0x3e75('0x2d')]));recordings[_0x4fb356[_0x3e75('0x6')]][_0x3e75('0x2b')]=_0x4fb356[_0x3e75('0x2b')];recordings[_0x4fb356[_0x3e75('0x6')]][_0x3e75('0x2c')]=_0x4fb356[_0x3e75('0x2c')];recordings[_0x4fb356[_0x3e75('0x6')]][_0x3e75('0x2e')]=_0x4fb356[_0x3e75('0x2e')];recordings[_0x4fb356[_0x3e75('0x6')]][_0x3e75('0x2f')]=_0x4fb356[_0x3e75('0x2f')];if(recordings[_0x4fb356[_0x3e75('0x6')]][_0x3e75('0x30')]==_0x3e75('0x31')&&recordings[_0x4fb356[_0x3e75('0x6')]]['accountcode']){recordings[_0x4fb356[_0x3e75('0x6')]]['connectedlinenum']=recordings[_0x4fb356[_0x3e75('0x6')]][_0x3e75('0x8')];recordings[_0x4fb356[_0x3e75('0x6')]]['connectedlinename']='';}recordings[_0x4fb356['uniqueid']][_0x3e75('0x27')]['forEach'](function(_0x1bece9){var _0x3d790c=_[_0x3e75('0x32')](recordings[_0x4fb356[_0x3e75('0x6')]]);_0x3d790c[_0x3e75('0x22')]=_0x1bece9['value'];writeDB(_0x3d790c);});delete recordings[_0x4fb356[_0x3e75('0x6')]];}}catch(_0x41ae8b){utils['error'](util[_0x3e75('0x3')](_0x3e75('0x29'),_0x4fb356[_0x3e75('0x6')]),_0x41ae8b);}};exports[_0x3e75('0x33')]=function(_0x1b3fe0){try{if(!_[_0x3e75('0x19')](recordings[_0x1b3fe0[_0x3e75('0x6')]])){utils[_0x3e75('0xf')](util[_0x3e75('0x3')](_0x3e75('0x34'),_0x1b3fe0['uniqueid']),_0x1b3fe0);utils[_0x3e75('0x12')](util[_0x3e75('0x3')](_0x3e75('0x35'),_0x1b3fe0[_0x3e75('0x6')],_0x1b3fe0['application'],_0x1b3fe0['appdata']));if(_0x1b3fe0['application'][_0x3e75('0x36')]()==_0x3e75('0x37')&&_[_0x3e75('0x38')](_0x1b3fe0[_0x3e75('0x39')][_0x3e75('0x36')](),_0x3e75('0x3a'))){var _0x207803=_0x1b3fe0[_0x3e75('0x39')]['split']('=');var _0x280c50=_0x207803[0x0]['substring'](_0x207803[0x0][_0x3e75('0x3b')]('(')+0x1,_0x207803[0x0]['lastIndexOf'](')'));var _0xd318d6=_0x207803[0x1];recordings[_0x1b3fe0[_0x3e75('0x6')]][_0x280c50]=_0xd318d6;}}}catch(_0xdb22ca){utils['error'](util[_0x3e75('0x3')](_0x3e75('0x34'),_0x1b3fe0[_0x3e75('0x6')]),_0xdb22ca);}};exports[_0x3e75('0x3c')]=function(_0xf44c7f){try{if(!_[_0x3e75('0x19')](recordings[_0xf44c7f[_0x3e75('0x6')]])){utils[_0x3e75('0xf')](util[_0x3e75('0x3')](_0x3e75('0x3d'),_0xf44c7f[_0x3e75('0x6')]),_0xf44c7f);utils[_0x3e75('0x12')](util[_0x3e75('0x3')](_0x3e75('0x3e'),_0xf44c7f['uniqueid'],_0xf44c7f[_0x3e75('0x3f')]));recordings[_0xf44c7f[_0x3e75('0x6')]][_0x3e75('0x3f')]=_0xf44c7f[_0x3e75('0x3f')];}}catch(_0x5ca888){utils[_0x3e75('0x1c')](util[_0x3e75('0x3')]('[%s][recordings][queuecallerjoin]',_0xf44c7f[_0x3e75('0x6')]),_0x5ca888);}};exports[_0x3e75('0x40')]=function(_0x151baa){try{utils[_0x3e75('0xf')](util[_0x3e75('0x3')](_0x3e75('0x41'),_0x151baa[_0x3e75('0x6')]),_0x151baa);utils['info'](util[_0x3e75('0x3')](_0x3e75('0x42'),_0x151baa['uniqueid'],_0x151baa['transferercalleridnum'],_0x151baa['transferercalleridname'],_0x151baa[_0x3e75('0x43')],_0x151baa[_0x3e75('0x44')]));if(recordings[_0x151baa[_0x3e75('0x45')]]&&transfers['blinds'][_0x151baa[_0x3e75('0x45')]]){transfers[_0x3e75('0x5')][_0x151baa[_0x3e75('0x45')]]['recording']=!![];}}catch(_0x106db3){utils[_0x3e75('0x1c')](util[_0x3e75('0x3')](_0x3e75('0x41'),_0x151baa[_0x3e75('0x6')]),_0x106db3);}}; \ No newline at end of file +var _0x5f20=['[%s][recordings][newexten]','application','toLowerCase','set','appdata','split','substring','[%s][recordings][queuecallerjoin]','[%s][recordings][queuecallerjoin]\x20queue:%s','queue','blindtransfer','[%s][recordings][blindtransfer]','[%s][recordings][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridnum','transferercalleridname','transfereecalleridnum','transfereecalleridname','transfereruniqueid','recording','lodash','util','./utils','./transfers.controller','info','format','uniqueid','blinds','transfereeuniqueid','accountcode','getUserByInternal','then','membername','name','UserId','request','CreateVoiceRecording','debug','[%s][recordings][newchannel]','linkedid','[%s][recordings][newchannel]\x20context:%s\x20exten:%s','context','exten','channel','error','newstate','[%s][recordings][newstate]','isNil','transfer','[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','varset','variable','mixmonitor_filename','[%s][recordings][varset]','value','endsWith','replace','.WAV','find','monitors','push','hangup','[%s][recordings][hangup]','[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s','calleridnum','calleridname','cause-txt','connectedlinenum','connectedlinename','type','forEach','clone'];(function(_0x4dedee,_0x36d78b){var _0x5bcd62=function(_0x4457b6){while(--_0x4457b6){_0x4dedee['push'](_0x4dedee['shift']());}};_0x5bcd62(++_0x36d78b);}(_0x5f20,0x176));var _0x05f2=function(_0x474bc0,_0x26989c){_0x474bc0=_0x474bc0-0x0;var _0x4b24cf=_0x5f20[_0x474bc0];return _0x4b24cf;};'use strict';var _=require(_0x05f2('0x0'));var util=require(_0x05f2('0x1'));var utils=require(_0x05f2('0x2'));var transfers=require(_0x05f2('0x3'));var recordings={};function writeDB(_0x466d4e){var _0x344285;utils[_0x05f2('0x4')](util[_0x05f2('0x5')]('[%s][recordings][writeDB]',_0x466d4e[_0x05f2('0x6')]));if(transfers[_0x05f2('0x7')][_0x466d4e[_0x05f2('0x6')]]){_0x344285=_0x466d4e[_0x05f2('0x6')];_0x466d4e[_0x05f2('0x6')]=transfers[_0x05f2('0x7')][_0x466d4e[_0x05f2('0x6')]][_0x05f2('0x8')];}if(_0x466d4e[_0x05f2('0x9')]){utils[_0x05f2('0xa')](_0x466d4e[_0x05f2('0x9')])[_0x05f2('0xb')](function(_0x57380f){if(_0x57380f){_0x466d4e[_0x05f2('0xc')]=_0x57380f[_0x05f2('0xd')];_0x466d4e[_0x05f2('0xe')]=_0x57380f['id'];}utils[_0x05f2('0xf')](_0x05f2('0x10'),_0x466d4e);});}else{utils[_0x05f2('0xf')](_0x05f2('0x10'),_0x466d4e);}if(_0x344285)delete transfers[_0x05f2('0x7')][_0x344285];}exports['newchannel']=function(_0x5c50fd){try{utils[_0x05f2('0x11')](util[_0x05f2('0x5')](_0x05f2('0x12'),_0x5c50fd['uniqueid']),_0x5c50fd);if(_0x5c50fd[_0x05f2('0x6')]==_0x5c50fd[_0x05f2('0x13')]){utils[_0x05f2('0x4')](util[_0x05f2('0x5')](_0x05f2('0x14'),_0x5c50fd[_0x05f2('0x6')],_0x5c50fd[_0x05f2('0x15')],_0x5c50fd[_0x05f2('0x16')]));recordings[_0x5c50fd[_0x05f2('0x6')]]={'uniqueid':_0x5c50fd[_0x05f2('0x6')],'accountcode':_0x5c50fd['accountcode'],'exten':_0x5c50fd[_0x05f2('0x16')],'context':_0x5c50fd[_0x05f2('0x15')],'channel':_0x5c50fd[_0x05f2('0x17')],'monitors':[]};}}catch(_0x10fcc3){utils[_0x05f2('0x18')](util[_0x05f2('0x5')]('[%s][recordings][newchannel]',_0x5c50fd['uniqueid']),_0x10fcc3);}};exports[_0x05f2('0x19')]=function(_0x3e2480){try{utils[_0x05f2('0x11')](util[_0x05f2('0x5')](_0x05f2('0x1a'),_0x3e2480[_0x05f2('0x6')]),_0x3e2480);if(!_[_0x05f2('0x1b')](recordings[_0x3e2480[_0x05f2('0x6')]])&&_0x3e2480['channelstate']==0x6){utils[_0x05f2('0x4')](util[_0x05f2('0x5')]('[%s][recordings][newstate]\x20context:%s\x20channel:%s',_0x3e2480[_0x05f2('0x6')],_0x3e2480[_0x05f2('0x15')],_0x3e2480['channel']));}else if(!_[_0x05f2('0x1b')](recordings[_0x3e2480[_0x05f2('0x13')]])&&_0x3e2480['channelstate']==0x6&&_0x3e2480[_0x05f2('0x15')]!=_0x05f2('0x1c')){utils[_0x05f2('0x4')](util[_0x05f2('0x5')](_0x05f2('0x1d'),_0x3e2480[_0x05f2('0x6')],_0x3e2480[_0x05f2('0x13')],_0x3e2480[_0x05f2('0x15')],_0x3e2480['channel']));recordings[_0x3e2480['linkedid']]['accountcode']=_0x3e2480[_0x05f2('0x9')];}}catch(_0x15fc48){utils[_0x05f2('0x18')](util['format'](_0x05f2('0x1a'),_0x3e2480[_0x05f2('0x6')]),_0x15fc48);}};exports[_0x05f2('0x1e')]=function(_0x3cde24){try{if(!_['isNil'](_0x3cde24[_0x05f2('0x1f')])&&!_[_0x05f2('0x1b')](_0x3cde24[_0x05f2('0x1f')][_0x05f2('0x20')])){utils[_0x05f2('0x11')](util[_0x05f2('0x5')](_0x05f2('0x21'),_0x3cde24[_0x05f2('0x6')]),_0x3cde24);utils[_0x05f2('0x4')](util['format']('[%s][recordings][varset]\x20variable:%s\x20value:%s',_0x3cde24[_0x05f2('0x6')],_0x3cde24[_0x05f2('0x1f')],_0x3cde24[_0x05f2('0x22')]));if(_[_0x05f2('0x23')](_0x3cde24[_0x05f2('0x22')],'.wav49')){_0x3cde24['value']=_0x3cde24[_0x05f2('0x22')][_0x05f2('0x24')]('.wav49',_0x05f2('0x25'));}if(recordings[_0x3cde24[_0x05f2('0x13')]]){var _0xa98855=_[_0x05f2('0x26')](recordings[_0x3cde24['linkedid']]['monitors'],{'value':_0x3cde24['value']});if(_[_0x05f2('0x1b')](_0xa98855)){recordings[_0x3cde24[_0x05f2('0x13')]][_0x05f2('0x27')][_0x05f2('0x28')]({'value':_0x3cde24[_0x05f2('0x22')]});}}}}catch(_0x2c20cd){utils[_0x05f2('0x18')](util[_0x05f2('0x5')](_0x05f2('0x21'),_0x3cde24[_0x05f2('0x6')]),_0x2c20cd);}};exports[_0x05f2('0x29')]=function(_0xd7649){try{if(!_[_0x05f2('0x1b')](recordings[_0xd7649[_0x05f2('0x6')]])){utils[_0x05f2('0x11')](util[_0x05f2('0x5')](_0x05f2('0x2a'),_0xd7649['uniqueid']),_0xd7649);utils[_0x05f2('0x4')](util[_0x05f2('0x5')](_0x05f2('0x2b'),_0xd7649[_0x05f2('0x6')],_0xd7649[_0x05f2('0x2c')],_0xd7649[_0x05f2('0x2d')],_0xd7649[_0x05f2('0x2e')]));recordings[_0xd7649[_0x05f2('0x6')]][_0x05f2('0x2c')]=_0xd7649[_0x05f2('0x2c')];recordings[_0xd7649[_0x05f2('0x6')]]['calleridname']=_0xd7649['calleridname'];recordings[_0xd7649['uniqueid']][_0x05f2('0x2f')]=_0xd7649['connectedlinenum'];recordings[_0xd7649['uniqueid']]['connectedlinename']=_0xd7649[_0x05f2('0x30')];if(recordings[_0xd7649['uniqueid']][_0x05f2('0x31')]=='outbound'&&recordings[_0xd7649[_0x05f2('0x6')]][_0x05f2('0x9')]){recordings[_0xd7649[_0x05f2('0x6')]][_0x05f2('0x2f')]=recordings[_0xd7649['uniqueid']][_0x05f2('0x9')];recordings[_0xd7649['uniqueid']][_0x05f2('0x30')]='';}recordings[_0xd7649['uniqueid']]['monitors'][_0x05f2('0x32')](function(_0x497cff){var _0x31178a=_[_0x05f2('0x33')](recordings[_0xd7649['uniqueid']]);_0x31178a[_0x05f2('0x22')]=_0x497cff[_0x05f2('0x22')];writeDB(_0x31178a);});delete recordings[_0xd7649[_0x05f2('0x6')]];}}catch(_0x29c802){utils['error'](util[_0x05f2('0x5')](_0x05f2('0x2a'),_0xd7649[_0x05f2('0x6')]),_0x29c802);}};exports['newexten']=function(_0x2aedfb){try{if(!_['isNil'](recordings[_0x2aedfb[_0x05f2('0x6')]])){utils[_0x05f2('0x11')](util['format'](_0x05f2('0x34'),_0x2aedfb[_0x05f2('0x6')]),_0x2aedfb);utils[_0x05f2('0x4')](util[_0x05f2('0x5')]('[%s][recordings][newexten]\x20application:%s\x20appdata:%s',_0x2aedfb[_0x05f2('0x6')],_0x2aedfb[_0x05f2('0x35')],_0x2aedfb['appdata']));if(_0x2aedfb[_0x05f2('0x35')][_0x05f2('0x36')]()==_0x05f2('0x37')&&_['startsWith'](_0x2aedfb[_0x05f2('0x38')][_0x05f2('0x36')](),'cdr')){var _0x56b457=_0x2aedfb[_0x05f2('0x38')][_0x05f2('0x39')]('=');var _0x2eead2=_0x56b457[0x0][_0x05f2('0x3a')](_0x56b457[0x0]['lastIndexOf']('(')+0x1,_0x56b457[0x0]['lastIndexOf'](')'));var _0x21b225=_0x56b457[0x1];recordings[_0x2aedfb[_0x05f2('0x6')]][_0x2eead2]=_0x21b225;}}}catch(_0x3c6e78){utils[_0x05f2('0x18')](util[_0x05f2('0x5')](_0x05f2('0x34'),_0x2aedfb[_0x05f2('0x6')]),_0x3c6e78);}};exports['queuecallerjoin']=function(_0x12e958){try{if(!_[_0x05f2('0x1b')](recordings[_0x12e958['uniqueid']])){utils[_0x05f2('0x11')](util['format'](_0x05f2('0x3b'),_0x12e958[_0x05f2('0x6')]),_0x12e958);utils[_0x05f2('0x4')](util[_0x05f2('0x5')](_0x05f2('0x3c'),_0x12e958[_0x05f2('0x6')],_0x12e958[_0x05f2('0x3d')]));recordings[_0x12e958[_0x05f2('0x6')]][_0x05f2('0x3d')]=_0x12e958[_0x05f2('0x3d')];}}catch(_0x3f9ab7){utils[_0x05f2('0x18')](util[_0x05f2('0x5')](_0x05f2('0x3b'),_0x12e958['uniqueid']),_0x3f9ab7);}};exports[_0x05f2('0x3e')]=function(_0x3fc2b5){try{utils[_0x05f2('0x11')](util[_0x05f2('0x5')](_0x05f2('0x3f'),_0x3fc2b5[_0x05f2('0x6')]),_0x3fc2b5);utils[_0x05f2('0x4')](util[_0x05f2('0x5')](_0x05f2('0x40'),_0x3fc2b5[_0x05f2('0x6')],_0x3fc2b5[_0x05f2('0x41')],_0x3fc2b5[_0x05f2('0x42')],_0x3fc2b5[_0x05f2('0x43')],_0x3fc2b5[_0x05f2('0x44')]));if(recordings[_0x3fc2b5['transfereruniqueid']]&&transfers[_0x05f2('0x7')][_0x3fc2b5['transfereruniqueid']]){transfers[_0x05f2('0x7')][_0x3fc2b5[_0x05f2('0x45')]][_0x05f2('0x46')]=!![];}}catch(_0x37642f){utils[_0x05f2('0x18')](util[_0x05f2('0x5')]('[%s][recordings][blindtransfer]',_0x3fc2b5[_0x05f2('0x6')]),_0x37642f);}}; \ No newline at end of file diff --git a/server/services/xdr/transfers.controller.js b/server/services/xdr/transfers.controller.js index cd27046..c38d3f4 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 _0xea06=['request','CreateVoiceTransferReport','blindtransfer','debug','[%s][transfers][blindtransfer]','format','[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','uniqueid','transferercalleridnum','transferercalleridname','transfereecalleridnum','blind','blinds','error','[%s][transfers][attendedtransfer]','[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','origtransferercalleridname','transfertargetcalleridnum','assign','origtransfererchannel','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','origtransferercontext','origtransfererexten','isNil','transfereechannel','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetexten','lodash','./utils','info','type','attended','origtransfereruniqueid'];(function(_0x32f38b,_0x1b4fc7){var _0x15ec9b=function(_0x1331da){while(--_0x1331da){_0x32f38b['push'](_0x32f38b['shift']());}};_0x15ec9b(++_0x1b4fc7);}(_0xea06,0x159));var _0x6ea0=function(_0x30e796,_0x3539c6){_0x30e796=_0x30e796-0x0;var _0x355bff=_0xea06[_0x30e796];return _0x355bff;};'use strict';var _=require(_0x6ea0('0x0'));var util=require('util');var utils=require(_0x6ea0('0x1'));function writeDB(_0x3573f9){utils[_0x6ea0('0x2')](util['format']('[%s][transfers][writeDB]\x20type:%s',_0x3573f9[_0x6ea0('0x3')]===_0x6ea0('0x4')?_0x3573f9[_0x6ea0('0x5')]:_0x3573f9['uniqueid'],_0x3573f9[_0x6ea0('0x3')]));utils[_0x6ea0('0x6')](_0x6ea0('0x7'),_0x3573f9);}exports['blinds']={};exports[_0x6ea0('0x8')]=function(_0x51b83a){try{utils[_0x6ea0('0x9')](util['format'](_0x6ea0('0xa'),_0x51b83a['uniqueid']),_0x51b83a);utils[_0x6ea0('0x2')](util[_0x6ea0('0xb')](_0x6ea0('0xc'),_0x51b83a[_0x6ea0('0xd')],_0x51b83a[_0x6ea0('0xe')],_0x51b83a[_0x6ea0('0xf')],_0x51b83a[_0x6ea0('0x10')],_0x51b83a['transfereecalleridname']));_0x51b83a[_0x6ea0('0x3')]=_0x6ea0('0x11');exports[_0x6ea0('0x12')][_0x51b83a['transfereruniqueid']]=_0x51b83a;writeDB(_0x51b83a);}catch(_0x455c26){utils[_0x6ea0('0x13')](util[_0x6ea0('0xb')](_0x6ea0('0xa'),_0x51b83a[_0x6ea0('0xd')]),_0x455c26);}};exports['attendedtransfer']=function(_0x2ebebf){try{utils[_0x6ea0('0x9')](util[_0x6ea0('0xb')](_0x6ea0('0x14'),_0x2ebebf[_0x6ea0('0x5')]),_0x2ebebf);utils[_0x6ea0('0x2')](util['format'](_0x6ea0('0x15'),_0x2ebebf[_0x6ea0('0x5')],_0x2ebebf['origtransferercalleridnum'],_0x2ebebf[_0x6ea0('0x16')],_0x2ebebf[_0x6ea0('0x17')],_0x2ebebf['transfertargetcalleridname']));_0x2ebebf=_[_0x6ea0('0x18')](_0x2ebebf,{'transfererchannel':_0x2ebebf[_0x6ea0('0x19')],'transferercalleridnum':_0x2ebebf['origtransferercalleridnum'],'transferercalleridname':_0x2ebebf['origtransferercalleridname'],'transfererconnectedlinenum':_0x2ebebf[_0x6ea0('0x1a')],'transfererconnectedlinename':_0x2ebebf[_0x6ea0('0x1b')],'transfereraccountcode':_0x2ebebf[_0x6ea0('0x1c')],'transferercontext':_0x2ebebf[_0x6ea0('0x1d')],'transfererexten':_0x2ebebf[_0x6ea0('0x1e')],'transfererlinkedid':_0x2ebebf[_0x6ea0('0x1f')],'context':_0x2ebebf[_0x6ea0('0x20')],'extension':_0x2ebebf[_0x6ea0('0x21')],'type':'attended'});if(_[_0x6ea0('0x22')](_0x2ebebf[_0x6ea0('0x23')])){_0x2ebebf=_['assign'](_0x2ebebf,{'transfereechannel':_0x2ebebf['transfertargetchannel'],'transfereecalleridnum':_0x2ebebf[_0x6ea0('0x17')],'transfereecalleridname':_0x2ebebf[_0x6ea0('0x24')],'transfereeconnectedlinenum':_0x2ebebf[_0x6ea0('0x25')],'transfereeconnectedlinename':_0x2ebebf['transfertargetconnectedlinename'],'transfereeaccountcode':_0x2ebebf['transfertargetaccountcode'],'transfereecontext':_0x2ebebf['transfertargetcontext'],'transfereeexten':_0x2ebebf[_0x6ea0('0x26')],'transfereelinkedid':_0x2ebebf['transfertargetlinkedid']});}writeDB(_0x2ebebf);}catch(_0x415522){utils[_0x6ea0('0x13')](util[_0x6ea0('0xb')](_0x6ea0('0x14'),_0x2ebebf[_0x6ea0('0x5')]),_0x415522);}}; \ No newline at end of file +var _0xd57b=['transfereecalleridname','blind','transfereruniqueid','error','[%s][transfers][attendedtransfer]','[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','origtransferercalleridname','transfertargetcalleridnum','transfertargetcalleridname','assign','origtransferercalleridnum','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','origtransfererexten','isNil','transfereechannel','transfertargetchannel','transfertargetaccountcode','transfertargetexten','transfertargetlinkedid','lodash','util','./utils','format','type','attended','origtransfereruniqueid','request','blinds','blindtransfer','debug','[%s][transfers][blindtransfer]','uniqueid','info','[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridnum','transferercalleridname','transfereecalleridnum'];(function(_0x509f32,_0x1ddd4f){var _0x48be5c=function(_0x249e1c){while(--_0x249e1c){_0x509f32['push'](_0x509f32['shift']());}};_0x48be5c(++_0x1ddd4f);}(_0xd57b,0x114));var _0xbd57=function(_0xbb14db,_0x3ee8c6){_0xbb14db=_0xbb14db-0x0;var _0x36bed7=_0xd57b[_0xbb14db];return _0x36bed7;};'use strict';var _=require(_0xbd57('0x0'));var util=require(_0xbd57('0x1'));var utils=require(_0xbd57('0x2'));function writeDB(_0x26ed67){utils['info'](util[_0xbd57('0x3')]('[%s][transfers][writeDB]\x20type:%s',_0x26ed67[_0xbd57('0x4')]===_0xbd57('0x5')?_0x26ed67[_0xbd57('0x6')]:_0x26ed67['uniqueid'],_0x26ed67[_0xbd57('0x4')]));utils[_0xbd57('0x7')]('CreateVoiceTransferReport',_0x26ed67);}exports[_0xbd57('0x8')]={};exports[_0xbd57('0x9')]=function(_0x23bd0c){try{utils[_0xbd57('0xa')](util[_0xbd57('0x3')](_0xbd57('0xb'),_0x23bd0c[_0xbd57('0xc')]),_0x23bd0c);utils[_0xbd57('0xd')](util['format'](_0xbd57('0xe'),_0x23bd0c['uniqueid'],_0x23bd0c[_0xbd57('0xf')],_0x23bd0c[_0xbd57('0x10')],_0x23bd0c[_0xbd57('0x11')],_0x23bd0c[_0xbd57('0x12')]));_0x23bd0c[_0xbd57('0x4')]=_0xbd57('0x13');exports[_0xbd57('0x8')][_0x23bd0c[_0xbd57('0x14')]]=_0x23bd0c;writeDB(_0x23bd0c);}catch(_0xdacb3c){utils[_0xbd57('0x15')](util[_0xbd57('0x3')](_0xbd57('0xb'),_0x23bd0c[_0xbd57('0xc')]),_0xdacb3c);}};exports['attendedtransfer']=function(_0x528e07){try{utils[_0xbd57('0xa')](util[_0xbd57('0x3')](_0xbd57('0x16'),_0x528e07[_0xbd57('0x6')]),_0x528e07);utils['info'](util[_0xbd57('0x3')](_0xbd57('0x17'),_0x528e07[_0xbd57('0x6')],_0x528e07['origtransferercalleridnum'],_0x528e07[_0xbd57('0x18')],_0x528e07[_0xbd57('0x19')],_0x528e07[_0xbd57('0x1a')]));_0x528e07=_[_0xbd57('0x1b')](_0x528e07,{'transfererchannel':_0x528e07['origtransfererchannel'],'transferercalleridnum':_0x528e07[_0xbd57('0x1c')],'transferercalleridname':_0x528e07[_0xbd57('0x18')],'transfererconnectedlinenum':_0x528e07[_0xbd57('0x1d')],'transfererconnectedlinename':_0x528e07[_0xbd57('0x1e')],'transfereraccountcode':_0x528e07[_0xbd57('0x1f')],'transferercontext':_0x528e07[_0xbd57('0x20')],'transfererexten':_0x528e07[_0xbd57('0x21')],'transfererlinkedid':_0x528e07[_0xbd57('0x22')],'context':_0x528e07['origtransferercontext'],'extension':_0x528e07[_0xbd57('0x23')],'type':_0xbd57('0x5')});if(_[_0xbd57('0x24')](_0x528e07[_0xbd57('0x25')])){_0x528e07=_['assign'](_0x528e07,{'transfereechannel':_0x528e07[_0xbd57('0x26')],'transfereecalleridnum':_0x528e07['transfertargetcalleridnum'],'transfereecalleridname':_0x528e07[_0xbd57('0x1a')],'transfereeconnectedlinenum':_0x528e07['transfertargetconnectedlinenum'],'transfereeconnectedlinename':_0x528e07['transfertargetconnectedlinename'],'transfereeaccountcode':_0x528e07[_0xbd57('0x27')],'transfereecontext':_0x528e07['transfertargetcontext'],'transfereeexten':_0x528e07[_0xbd57('0x28')],'transfereelinkedid':_0x528e07[_0xbd57('0x29')]});}writeDB(_0x528e07);}catch(_0x3e79b0){utils[_0xbd57('0x15')](util[_0xbd57('0x3')](_0xbd57('0x16'),_0x528e07[_0xbd57('0x6')]),_0x3e79b0);}}; \ No newline at end of file diff --git a/server/services/xdr/utils.js b/server/services/xdr/utils.js index e3f0b19..7a85a42 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 _0x047e=['[utils][getUserByInternal]\x20internal:%s\x20%s','notfound','[utils][getUserByInternal]','getUserByInterface','[utils][getUserByInterface]\x20interface:%s\x20%s','found','[utils][getUserByInterface]','getUserByName','[utils][getUserByName]','getVoiceQueueByName','GetVoiceQueue','type','acw','acwTimeout','[utils][getVoiceQueueByName]\x20name:%s','[utils][getVoiceQueueByName]\x20name:%s\x20%s','addTime','format','seconds','YYYY-MM-DD\x20HH:mm:ss','diffTime','diff','sumTime','isAfter','isBefore','bluebird','moment','util','client','http','../../config/logger','info','inspect','debug','error','request','then','catch','GetUser','internal','name','[utils][getUser]\x20where:%s','result','length'];(function(_0x529ba6,_0x4c0633){var _0x4d3abe=function(_0x88d0ab){while(--_0x88d0ab){_0x529ba6['push'](_0x529ba6['shift']());}};_0x4d3abe(++_0x4c0633);}(_0x047e,0x121));var _0xe047=function(_0xd496b7,_0x263338){_0xd496b7=_0xd496b7-0x0;var _0x49c9eb=_0x047e[_0xd496b7];return _0x49c9eb;};'use strict';var BPromise=require(_0xe047('0x0'));var jayson=require('jayson/promise');var moment=require(_0xe047('0x1'));var util=require(_0xe047('0x2'));var client=jayson[_0xe047('0x3')][_0xe047('0x4')]({'port':0x2329});var logger=require(_0xe047('0x5'))('xdr');exports[_0xe047('0x6')]=function(_0x54f84d,_0x5100a3){logger['info'](_0x54f84d,_0x5100a3?util[_0xe047('0x7')](_0x5100a3,{'showHidden':![],'depth':null}):'');};exports[_0xe047('0x8')]=function(_0x4a0e18,_0x402fa8){logger[_0xe047('0x8')](_0x4a0e18,_0x402fa8?util[_0xe047('0x7')](_0x402fa8,{'showHidden':![],'depth':null}):'');};exports[_0xe047('0x9')]=function(_0x2400de,_0x1c9012){logger[_0xe047('0x9')](_0x2400de,_0x1c9012?util['inspect'](_0x1c9012,{'showHidden':![],'depth':null}):'');};exports['request']=function(_0x5361aa,_0x2abdfe){return client[_0xe047('0xa')](_0x5361aa,{'body':_0x2abdfe})[_0xe047('0xb')](function(_0x458165){logger[_0xe047('0x8')]('[utils][request]\x20name:%s',_0x5361aa,_0x458165?util[_0xe047('0x7')](_0x458165,{'showHidden':![],'depth':null}):'');})[_0xe047('0xc')](function(_0x312490){logger[_0xe047('0x9')]('[utils][request]\x20name:%s',_0x5361aa,_0x312490?util[_0xe047('0x7')](_0x312490,{'showHidden':![],'depth':null}):'');});};function getUser(_0x4e5ac6){return client[_0xe047('0xa')](_0xe047('0xd'),{'options':{'raw':!![],'attributes':['id',_0xe047('0xe'),_0xe047('0xf'),'interface'],'where':_0x4e5ac6,'limit':0x1}})[_0xe047('0xb')](function(_0x36e7ef){logger[_0xe047('0x8')](_0xe047('0x10'),JSON['stringify'](_0x4e5ac6),_0x36e7ef?util[_0xe047('0x7')](_0x36e7ef,{'showHidden':![],'depth':null}):'');return _0x36e7ef[_0xe047('0x11')][_0xe047('0x12')]?_0x36e7ef['result'][0x0]:null;});}exports['getUserByInternal']=function(_0x48b83a){return new BPromise(function(_0x34e968,_0x5c8448){if(_0x48b83a){return getUser({'internal':_0x48b83a})[_0xe047('0xb')](function(_0x48a675){logger[_0xe047('0x6')](_0xe047('0x13'),_0x48b83a,_0x48a675?'found':_0xe047('0x14'));return _0x34e968(_0x48a675);})[_0xe047('0xc')](function(_0x2390ea){logger[_0xe047('0x9')](_0xe047('0x15'),_0x2390ea?util[_0xe047('0x7')](_0x2390ea,{'showHidden':![],'depth':null}):'');return _0x34e968(null);});}return _0x34e968(null);});};exports[_0xe047('0x16')]=function(_0x14a339){return new BPromise(function(_0x9d37bc,_0x1e3222){if(_0x14a339){return getUser({'interface':_0x14a339})['then'](function(_0x4c564a){logger[_0xe047('0x6')](_0xe047('0x17'),_0x14a339,_0x4c564a?_0xe047('0x18'):'notfound');return _0x9d37bc(_0x4c564a);})['catch'](function(_0x249480){logger[_0xe047('0x9')](_0xe047('0x19'),_0x249480?util[_0xe047('0x7')](_0x249480,{'showHidden':![],'depth':null}):'');return _0x9d37bc(null);});}return _0x9d37bc(null);});};exports[_0xe047('0x1a')]=function(_0x14a45d){return new BPromise(function(_0x3c0919,_0x5eed16){if(_0x14a45d){return getUser({'name':_0x14a45d})['then'](function(_0x20007f){logger[_0xe047('0x6')]('[utils][getUserByName]\x20name:%s\x20%s',_0x14a45d,_0x20007f?'found':_0xe047('0x14'));return _0x3c0919(_0x20007f);})[_0xe047('0xc')](function(_0x109934){logger['error'](_0xe047('0x1b'),_0x109934?util[_0xe047('0x7')](_0x109934,{'showHidden':![],'depth':null}):'');return _0x3c0919(null);});}return _0x3c0919(null);});};exports[_0xe047('0x1c')]=function(_0x5c2c36){return new BPromise(function(_0x4d057d,_0x5e71d5){if(_0x5c2c36){return client[_0xe047('0xa')](_0xe047('0x1d'),{'options':{'raw':!![],'attributes':['id',_0xe047('0xf'),_0xe047('0x1e'),_0xe047('0x1f'),_0xe047('0x20')],'where':{'name':_0x5c2c36},'limit':0x1}})[_0xe047('0xb')](function(_0x346cc5){logger[_0xe047('0x8')](_0xe047('0x21'),_0x5c2c36,_0x346cc5?util['inspect'](_0x346cc5,{'showHidden':![],'depth':null}):'');logger[_0xe047('0x6')](_0xe047('0x22'),_0x5c2c36,_0x346cc5?'found':_0xe047('0x14'));return _0x4d057d(_0x346cc5[_0xe047('0x11')]['length']?_0x346cc5[_0xe047('0x11')][0x0]:null);})['catch'](function(_0x445e1f){logger['error']('[utils][getVoiceQueueByName]',_0x445e1f?util[_0xe047('0x7')](_0x445e1f,{'showHidden':![],'depth':null}):'');return _0x4d057d(null);});}return _0x4d057d(null);});};exports[_0xe047('0x23')]=function(_0xe0359d,_0xee8e87){return moment(_0xe0359d)['add'](_0xee8e87,'seconds')[_0xe047('0x24')]('YYYY-MM-DD\x20HH:mm:ss');};exports['subtractTime']=function(_0x5af6ca,_0x34eaa2){return moment(_0x5af6ca)['subtract'](_0x34eaa2,_0xe047('0x25'))['format'](_0xe047('0x26'));};exports[_0xe047('0x27')]=function(_0x3bcb90,_0x12ae22){return moment(_0x3bcb90)[_0xe047('0x28')](moment(_0x12ae22),_0xe047('0x25'));};exports[_0xe047('0x29')]=function(_0x2a98a8,_0x5e2ffb){return parseInt(_0x2a98a8,0xa)+parseInt(_0x5e2ffb,0xa);};exports['now']=function(){return moment()[_0xe047('0x24')](_0xe047('0x26'));};exports[_0xe047('0x2a')]=function(_0x52d35f,_0x3d6fdd){if(_0x3d6fdd){return moment(_0x52d35f)[_0xe047('0x2a')](_0x3d6fdd);}return!![];};exports[_0xe047('0x2b')]=function(_0x23b720,_0x3bb324){if(_0x3bb324){return moment(_0x23b720)['isBefore'](_0x3bb324);}else if(_0x23b720){return!![];}return![];}; \ No newline at end of file +var _0xc165=['catch','internal','name','interface','[utils][getUser]\x20where:%s','stringify','result','length','getUserByInternal','[utils][getUserByInternal]\x20internal:%s\x20%s','found','notfound','[utils][getUserByInternal]','getUserByInterface','[utils][getUserByInterface]','getUserByName','[utils][getUserByName]','GetVoiceQueue','type','[utils][getVoiceQueueByName]\x20name:%s','[utils][getVoiceQueueByName]\x20name:%s\x20%s','[utils][getVoiceQueueByName]','addTime','add','seconds','format','YYYY-MM-DD\x20HH:mm:ss','subtractTime','subtract','diffTime','now','isAfter','isBefore','bluebird','jayson/promise','moment','util','client','http','xdr','info','inspect','debug','error','request','then','[utils][request]\x20name:%s'];(function(_0xa06077,_0x153ab4){var _0x372015=function(_0x496ef1){while(--_0x496ef1){_0xa06077['push'](_0xa06077['shift']());}};_0x372015(++_0x153ab4);}(_0xc165,0x199));var _0x5c16=function(_0x3f9024,_0x48d0e5){_0x3f9024=_0x3f9024-0x0;var _0x3c931c=_0xc165[_0x3f9024];return _0x3c931c;};'use strict';var BPromise=require(_0x5c16('0x0'));var jayson=require(_0x5c16('0x1'));var moment=require(_0x5c16('0x2'));var util=require(_0x5c16('0x3'));var client=jayson[_0x5c16('0x4')][_0x5c16('0x5')]({'port':0x2329});var logger=require('../../config/logger')(_0x5c16('0x6'));exports[_0x5c16('0x7')]=function(_0x549c80,_0x5db36f){logger[_0x5c16('0x7')](_0x549c80,_0x5db36f?util[_0x5c16('0x8')](_0x5db36f,{'showHidden':![],'depth':null}):'');};exports['debug']=function(_0x27ba5b,_0x31702d){logger[_0x5c16('0x9')](_0x27ba5b,_0x31702d?util[_0x5c16('0x8')](_0x31702d,{'showHidden':![],'depth':null}):'');};exports[_0x5c16('0xa')]=function(_0x5351a4,_0x30eaa2){logger[_0x5c16('0xa')](_0x5351a4,_0x30eaa2?util[_0x5c16('0x8')](_0x30eaa2,{'showHidden':![],'depth':null}):'');};exports[_0x5c16('0xb')]=function(_0x342dac,_0x500576){return client[_0x5c16('0xb')](_0x342dac,{'body':_0x500576})[_0x5c16('0xc')](function(_0x4ff4f6){logger[_0x5c16('0x9')](_0x5c16('0xd'),_0x342dac,_0x4ff4f6?util['inspect'](_0x4ff4f6,{'showHidden':![],'depth':null}):'');})[_0x5c16('0xe')](function(_0x115b6a){logger['error'](_0x5c16('0xd'),_0x342dac,_0x115b6a?util[_0x5c16('0x8')](_0x115b6a,{'showHidden':![],'depth':null}):'');});};function getUser(_0xedc838){return client[_0x5c16('0xb')]('GetUser',{'options':{'raw':!![],'attributes':['id',_0x5c16('0xf'),_0x5c16('0x10'),_0x5c16('0x11')],'where':_0xedc838,'limit':0x1}})[_0x5c16('0xc')](function(_0x5e4512){logger[_0x5c16('0x9')](_0x5c16('0x12'),JSON[_0x5c16('0x13')](_0xedc838),_0x5e4512?util[_0x5c16('0x8')](_0x5e4512,{'showHidden':![],'depth':null}):'');return _0x5e4512[_0x5c16('0x14')][_0x5c16('0x15')]?_0x5e4512[_0x5c16('0x14')][0x0]:null;});}exports[_0x5c16('0x16')]=function(_0x523146){return new BPromise(function(_0x3d54b0,_0x328288){if(_0x523146){return getUser({'internal':_0x523146})[_0x5c16('0xc')](function(_0x438e6c){logger['info'](_0x5c16('0x17'),_0x523146,_0x438e6c?_0x5c16('0x18'):_0x5c16('0x19'));return _0x3d54b0(_0x438e6c);})[_0x5c16('0xe')](function(_0x33b68a){logger['error'](_0x5c16('0x1a'),_0x33b68a?util[_0x5c16('0x8')](_0x33b68a,{'showHidden':![],'depth':null}):'');return _0x3d54b0(null);});}return _0x3d54b0(null);});};exports[_0x5c16('0x1b')]=function(_0x1fb45a){return new BPromise(function(_0x4dca0c,_0x5b3929){if(_0x1fb45a){return getUser({'interface':_0x1fb45a})[_0x5c16('0xc')](function(_0x163441){logger[_0x5c16('0x7')]('[utils][getUserByInterface]\x20interface:%s\x20%s',_0x1fb45a,_0x163441?_0x5c16('0x18'):'notfound');return _0x4dca0c(_0x163441);})[_0x5c16('0xe')](function(_0x3df05b){logger[_0x5c16('0xa')](_0x5c16('0x1c'),_0x3df05b?util[_0x5c16('0x8')](_0x3df05b,{'showHidden':![],'depth':null}):'');return _0x4dca0c(null);});}return _0x4dca0c(null);});};exports[_0x5c16('0x1d')]=function(_0x12cfc4){return new BPromise(function(_0x1b1520,_0x8a9247){if(_0x12cfc4){return getUser({'name':_0x12cfc4})[_0x5c16('0xc')](function(_0x2a1393){logger[_0x5c16('0x7')]('[utils][getUserByName]\x20name:%s\x20%s',_0x12cfc4,_0x2a1393?'found':_0x5c16('0x19'));return _0x1b1520(_0x2a1393);})[_0x5c16('0xe')](function(_0x4d04b6){logger['error'](_0x5c16('0x1e'),_0x4d04b6?util[_0x5c16('0x8')](_0x4d04b6,{'showHidden':![],'depth':null}):'');return _0x1b1520(null);});}return _0x1b1520(null);});};exports['getVoiceQueueByName']=function(_0x444757){return new BPromise(function(_0x5f1079,_0x39e21b){if(_0x444757){return client[_0x5c16('0xb')](_0x5c16('0x1f'),{'options':{'raw':!![],'attributes':['id',_0x5c16('0x10'),_0x5c16('0x20'),'acw','acwTimeout'],'where':{'name':_0x444757},'limit':0x1}})[_0x5c16('0xc')](function(_0x535fd1){logger[_0x5c16('0x9')](_0x5c16('0x21'),_0x444757,_0x535fd1?util[_0x5c16('0x8')](_0x535fd1,{'showHidden':![],'depth':null}):'');logger[_0x5c16('0x7')](_0x5c16('0x22'),_0x444757,_0x535fd1?'found':'notfound');return _0x5f1079(_0x535fd1[_0x5c16('0x14')][_0x5c16('0x15')]?_0x535fd1['result'][0x0]:null);})[_0x5c16('0xe')](function(_0x458d69){logger[_0x5c16('0xa')](_0x5c16('0x23'),_0x458d69?util[_0x5c16('0x8')](_0x458d69,{'showHidden':![],'depth':null}):'');return _0x5f1079(null);});}return _0x5f1079(null);});};exports[_0x5c16('0x24')]=function(_0x2d1b6a,_0x3c53eb){return moment(_0x2d1b6a)[_0x5c16('0x25')](_0x3c53eb,_0x5c16('0x26'))[_0x5c16('0x27')](_0x5c16('0x28'));};exports[_0x5c16('0x29')]=function(_0x4040f8,_0x3f8253){return moment(_0x4040f8)[_0x5c16('0x2a')](_0x3f8253,_0x5c16('0x26'))[_0x5c16('0x27')](_0x5c16('0x28'));};exports[_0x5c16('0x2b')]=function(_0x5782c4,_0x5206c4){return moment(_0x5782c4)['diff'](moment(_0x5206c4),_0x5c16('0x26'));};exports['sumTime']=function(_0x19f7b4,_0x49960c){return parseInt(_0x19f7b4,0xa)+parseInt(_0x49960c,0xa);};exports[_0x5c16('0x2c')]=function(){return moment()[_0x5c16('0x27')](_0x5c16('0x28'));};exports[_0x5c16('0x2d')]=function(_0x5ae7a2,_0x339f2a){if(_0x339f2a){return moment(_0x5ae7a2)[_0x5c16('0x2d')](_0x339f2a);}return!![];};exports[_0x5c16('0x2e')]=function(_0x418f1f,_0x2ce4c4){if(_0x2ce4c4){return moment(_0x418f1f)[_0x5c16('0x2e')](_0x2ce4c4);}else if(_0x418f1f){return!![];}return![];}; \ No newline at end of file diff --git a/server/utils/client-side-logger.js b/server/utils/client-side-logger.js index 826d3b0..8bd2c8f 100644 --- a/server/utils/client-side-logger.js +++ b/server/utils/client-side-logger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3027=['agent_name','fs-extra','lodash','express-winston','path','util','./loggers','fileLogger','./safe-template','safeTemplate','./mask-sensitive-data','maskSensitiveData','join','/var','log','client','role','name','ensureDir','catch','user','then','no-user','data','timestamp','api','auth','set','use','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','isEmpty','\x20body=%s','body','method','x-forwarded-for','headers','connection','remoteAddress','statusCode','responseTime','inspect','logger','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s','agent_id','format','url','device','other'];(function(_0x46fff0,_0x2ec3c0){var _0x259045=function(_0x2a41d3){while(--_0x2a41d3){_0x46fff0['push'](_0x46fff0['shift']());}};_0x259045(++_0x2ec3c0);}(_0x3027,0xf1));var _0x7302=function(_0x47f038,_0x68f37b){_0x47f038=_0x47f038-0x0;var _0x211674=_0x3027[_0x47f038];return _0x211674;};var fs=require(_0x7302('0x0'));var _=require(_0x7302('0x1'));var ewinston=require(_0x7302('0x2'));var path=require(_0x7302('0x3'));var util=require(_0x7302('0x4'));var fileLogger=require(_0x7302('0x5'))[_0x7302('0x6')];var safeTemplate=require(_0x7302('0x7'))[_0x7302('0x8')];var maskSensitiveData=require(_0x7302('0x9'))[_0x7302('0xa')];function ClientSideLogger(){function _0x3ef107(_0x1edf7f){var _0x11cbd3=path[_0x7302('0xb')](_0x7302('0xc'),_0x7302('0xd'),'xcally');var _0x1ac903=path['join'](_0x7302('0xe'),_0x1edf7f[_0x7302('0xf')]+'-'+_0x1edf7f[_0x7302('0x10')]);return fs[_0x7302('0x11')](path[_0x7302('0xb')](_0x11cbd3,_0x1ac903))['then'](function(){var _0x21b1d1=fileLogger(_0x7302('0xe'),path[_0x7302('0xb')](_0x11cbd3,_0x1ac903));return _0x21b1d1;})[_0x7302('0x12')](function(_0x53e7cf){throw _0x53e7cf;});}this['log']=function(_0x3b3c15,_0xc6756c,_0x4b2486,_0xbe1a3a){return _0x3ef107(_0x3b3c15[_0x7302('0x13')])[_0x7302('0x14')](function(_0x5bbe13){var _0x61f9d=_0x5bbe13[_0xc6756c];return _0x61f9d;})['then'](function(_0x2732ed){var _0x20a996=_0x3b3c15[_0x7302('0x13')]?_0x3b3c15[_0x7302('0x13')]['id']:_0x7302('0x15');var _0x35af70=_0xbe1a3a[_0x7302('0x16')];var _0x576f7d=_0xbe1a3a[_0x7302('0x17')];var _0x4f4438=new Date(Number(_0x576f7d));return _0x2732ed(_0x20a996,_0x4f4438,_0x4b2486,_0x35af70);})[_0x7302('0x12')](function(_0xdc466e){fileLogger(_0x7302('0xe'))['error'](_0xdc466e);});};}function setupLoggers(_0xda6a5e){return new Promise(function(_0x5d25d5){var _0x435ace=new ClientSideLogger();var _0x27cb0a=fileLogger(_0x7302('0x18'));var _0x532e52=fileLogger(_0x7302('0x19'));_0xda6a5e[_0x7302('0x1a')]('client-side-logger',_0x435ace);_0xda6a5e[_0x7302('0x1b')](ewinston['logger']({'winstonInstance':_0x27cb0a,'meta':![],'statusLevels':!![],'msg':function(_0x46d19a,_0x3dca95){var _0x2822a5=_0x7302('0x1c');if(!_[_0x7302('0x1d')](_0x46d19a['body'])){_0x2822a5+=_0x7302('0x1e');var _0x48772e=_0x46d19a[_0x7302('0x1f')];maskSensitiveData(_0x48772e);}return safeTemplate(util['format'](_0x2822a5,_0x46d19a[_0x7302('0x20')],_0x46d19a['headers'][_0x7302('0x21')]?_0x46d19a[_0x7302('0x22')]['x-forwarded-for']:_0x46d19a[_0x7302('0x23')][_0x7302('0x24')]||_0x46d19a['ip'],_0x46d19a['url'],_0x3dca95[_0x7302('0x25')],_0x3dca95[_0x7302('0x26')],_0x46d19a[_0x7302('0x13')]?_0x46d19a[_0x7302('0x13')]['id']:null,_0x46d19a[_0x7302('0x13')]?_0x46d19a[_0x7302('0x13')][_0x7302('0x10')]:null,_0x46d19a[_0x7302('0x13')]?_0x46d19a[_0x7302('0x13')][_0x7302('0xf')]:null,_0x48772e?util[_0x7302('0x27')](_0x48772e,![],null):''));}}));_0xda6a5e[_0x7302('0x1b')](ewinston[_0x7302('0x28')]({'winstonInstance':_0x532e52,'meta':![],'statusLevels':!![],'msg':function(_0x5ead63,_0x2426b3){var _0x2a162e=_0x7302('0x29');if(_0x5ead63['body']&&_0x5ead63['body']['device']&&_0x5ead63['body'][_0x7302('0x2a')]){_0x2a162e='%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)';}return util[_0x7302('0x2b')](_0x2a162e,_0x5ead63[_0x7302('0x20')],_0x5ead63['headers'][_0x7302('0x21')]?_0x5ead63[_0x7302('0x22')][_0x7302('0x21')]:_0x5ead63['connection'][_0x7302('0x24')]||_0x5ead63['ip'],_0x5ead63[_0x7302('0x2c')],_0x2426b3[_0x7302('0x25')],_0x2426b3[_0x7302('0x26')],_0x5ead63['user']?_0x5ead63[_0x7302('0x13')]['id']:null,_0x5ead63[_0x7302('0x13')]?_0x5ead63[_0x7302('0x13')][_0x7302('0x10')]:null,_0x5ead63[_0x7302('0x13')]?_0x5ead63[_0x7302('0x13')][_0x7302('0xf')]:null,_0x5ead63[_0x7302('0x1f')]&&_0x5ead63[_0x7302('0x1f')][_0x7302('0x2d')]?_0x5ead63[_0x7302('0x1f')][_0x7302('0x2d')]:_0x7302('0x2e'),_0x5ead63['body']&&_0x5ead63['body'][_0x7302('0x2a')]?_0x5ead63[_0x7302('0x1f')][_0x7302('0x2a')]:'',_0x5ead63[_0x7302('0x1f')]&&_0x5ead63['body'][_0x7302('0x2f')]?_0x5ead63[_0x7302('0x1f')][_0x7302('0x2f')]:'');},'ignoreRoute':function(_0x326951){var _0x5bcefe=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x5bcefe['test'](_0x326951[_0x7302('0x2c')]);}}));return _0x5d25d5();});}exports['setupLoggers']=setupLoggers; \ No newline at end of file +var _0x41c9=['./safe-template','safeTemplate','./mask-sensitive-data','maskSensitiveData','join','log','client','role','name','ensureDir','then','catch','user','no-user','data','timestamp','error','api','set','use','logger','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','isEmpty','\x20body=%s','format','method','headers','x-forwarded-for','connection','url','statusCode','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s','body','device','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)','remoteAddress','other','agent_id','agent_name','test','setupLoggers','fs-extra','lodash','path','util','./loggers'];(function(_0x5a5092,_0x87124d){var _0xe1ec05=function(_0x2e91f8){while(--_0x2e91f8){_0x5a5092['push'](_0x5a5092['shift']());}};_0xe1ec05(++_0x87124d);}(_0x41c9,0xb3));var _0x941c=function(_0x108e48,_0x2626e6){_0x108e48=_0x108e48-0x0;var _0x25e6bb=_0x41c9[_0x108e48];return _0x25e6bb;};var fs=require(_0x941c('0x0'));var _=require(_0x941c('0x1'));var ewinston=require('express-winston');var path=require(_0x941c('0x2'));var util=require(_0x941c('0x3'));var fileLogger=require(_0x941c('0x4'))['fileLogger'];var safeTemplate=require(_0x941c('0x5'))[_0x941c('0x6')];var maskSensitiveData=require(_0x941c('0x7'))[_0x941c('0x8')];function ClientSideLogger(){function _0x3749af(_0x2b1d73){var _0x2cfd16=path[_0x941c('0x9')]('/var',_0x941c('0xa'),'xcally');var _0xbfefd2=path['join'](_0x941c('0xb'),_0x2b1d73[_0x941c('0xc')]+'-'+_0x2b1d73[_0x941c('0xd')]);return fs[_0x941c('0xe')](path[_0x941c('0x9')](_0x2cfd16,_0xbfefd2))[_0x941c('0xf')](function(){var _0x2af9ff=fileLogger(_0x941c('0xb'),path[_0x941c('0x9')](_0x2cfd16,_0xbfefd2));return _0x2af9ff;})[_0x941c('0x10')](function(_0x3dec85){throw _0x3dec85;});}this[_0x941c('0xa')]=function(_0x7253cd,_0x37c5fc,_0x3b7d27,_0x45bb1d){return _0x3749af(_0x7253cd[_0x941c('0x11')])[_0x941c('0xf')](function(_0x504520){var _0xfb9d05=_0x504520[_0x37c5fc];return _0xfb9d05;})[_0x941c('0xf')](function(_0x518421){var _0x327413=_0x7253cd['user']?_0x7253cd[_0x941c('0x11')]['id']:_0x941c('0x12');var _0x214559=_0x45bb1d[_0x941c('0x13')];var _0x5d2c5c=_0x45bb1d[_0x941c('0x14')];var _0x2d269a=new Date(Number(_0x5d2c5c));return _0x518421(_0x327413,_0x2d269a,_0x3b7d27,_0x214559);})[_0x941c('0x10')](function(_0x36b705){fileLogger(_0x941c('0xb'))[_0x941c('0x15')](_0x36b705);});};}function setupLoggers(_0x4517d0){return new Promise(function(_0x6dd487){var _0x2d7dfe=new ClientSideLogger();var _0xf2a079=fileLogger(_0x941c('0x16'));var _0x1d4b86=fileLogger('auth');_0x4517d0[_0x941c('0x17')]('client-side-logger',_0x2d7dfe);_0x4517d0[_0x941c('0x18')](ewinston[_0x941c('0x19')]({'winstonInstance':_0xf2a079,'meta':![],'statusLevels':!![],'msg':function(_0x378766,_0x1e91ef){var _0x180f86=_0x941c('0x1a');if(!_[_0x941c('0x1b')](_0x378766['body'])){_0x180f86+=_0x941c('0x1c');var _0x251018=_0x378766['body'];maskSensitiveData(_0x251018);}return safeTemplate(util[_0x941c('0x1d')](_0x180f86,_0x378766[_0x941c('0x1e')],_0x378766[_0x941c('0x1f')][_0x941c('0x20')]?_0x378766[_0x941c('0x1f')][_0x941c('0x20')]:_0x378766[_0x941c('0x21')]['remoteAddress']||_0x378766['ip'],_0x378766[_0x941c('0x22')],_0x1e91ef[_0x941c('0x23')],_0x1e91ef['responseTime'],_0x378766[_0x941c('0x11')]?_0x378766[_0x941c('0x11')]['id']:null,_0x378766['user']?_0x378766[_0x941c('0x11')][_0x941c('0xd')]:null,_0x378766[_0x941c('0x11')]?_0x378766[_0x941c('0x11')][_0x941c('0xc')]:null,_0x251018?util['inspect'](_0x251018,![],null):''));}}));_0x4517d0['use'](ewinston['logger']({'winstonInstance':_0x1d4b86,'meta':![],'statusLevels':!![],'msg':function(_0x889819,_0x561f5a){var _0x59e2ec=_0x941c('0x24');if(_0x889819['body']&&_0x889819[_0x941c('0x25')][_0x941c('0x26')]&&_0x889819[_0x941c('0x25')]['agent_id']){_0x59e2ec=_0x941c('0x27');}return util[_0x941c('0x1d')](_0x59e2ec,_0x889819[_0x941c('0x1e')],_0x889819[_0x941c('0x1f')][_0x941c('0x20')]?_0x889819[_0x941c('0x1f')][_0x941c('0x20')]:_0x889819[_0x941c('0x21')][_0x941c('0x28')]||_0x889819['ip'],_0x889819['url'],_0x561f5a[_0x941c('0x23')],_0x561f5a['responseTime'],_0x889819[_0x941c('0x11')]?_0x889819[_0x941c('0x11')]['id']:null,_0x889819[_0x941c('0x11')]?_0x889819[_0x941c('0x11')][_0x941c('0xd')]:null,_0x889819[_0x941c('0x11')]?_0x889819[_0x941c('0x11')][_0x941c('0xc')]:null,_0x889819[_0x941c('0x25')]&&_0x889819[_0x941c('0x25')]['device']?_0x889819[_0x941c('0x25')][_0x941c('0x26')]:_0x941c('0x29'),_0x889819[_0x941c('0x25')]&&_0x889819[_0x941c('0x25')][_0x941c('0x2a')]?_0x889819['body'][_0x941c('0x2a')]:'',_0x889819[_0x941c('0x25')]&&_0x889819['body']['agent_name']?_0x889819['body'][_0x941c('0x2b')]:'');},'ignoreRoute':function(_0x1579cc){var _0x135a1d=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x135a1d[_0x941c('0x2c')](_0x1579cc['url']);}}));return _0x6dd487();});}exports[_0x941c('0x2d')]=setupLoggers; \ No newline at end of file diff --git a/server/utils/loggers.js b/server/utils/loggers.js index 4baee73..afec6f5 100644 --- a/server/utils/loggers.js +++ b/server/utils/loggers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0fed=['%s-%s','error','File','Console','consoleLogger','fileLogger','path','util','moment','winston','../config/environment','debugLevel','toLowerCase','info','redBG\x20white','red','bold\x20yellow','white','bold\x20white','bold\x20green','gray','bold\x20magenta','bold\x20blue','addColors','%s-%s.log','message','replace','{{{','}}}','format','YYYY-MM-DD\x20HH:mm:ss','toUpperCase','meta','keys','length','stringify','level','Logger','warn','transports'];(function(_0x1da939,_0x86ed38){var _0x5ee281=function(_0x5aa275){while(--_0x5aa275){_0x1da939['push'](_0x1da939['shift']());}};_0x5ee281(++_0x86ed38);}(_0x0fed,0x1be));var _0xd0fe=function(_0x56b499,_0x362fe3){_0x56b499=_0x56b499-0x0;var _0x1c05c3=_0x0fed[_0x56b499];return _0x1c05c3;};'use strict';var path=require(_0xd0fe('0x0'));var util=require(_0xd0fe('0x1'));var moment=require(_0xd0fe('0x2'));var winston=require(_0xd0fe('0x3'));var config=require(_0xd0fe('0x4'));var debugLevel=config[_0xd0fe('0x5')]?config['debugLevel'][_0xd0fe('0x6')]():_0xd0fe('0x7');var XC_LOG_LEVELS={'fatal':0x0,'error':0x0,'warn':0x1,'info':0x2,'print':0x2,'success':0x2,'http':0x3,'verbose':0x4,'debug':0x5,'silly':0x6};var XC_LOG_COLORS={'fatal':_0xd0fe('0x8'),'error':_0xd0fe('0x9'),'warn':_0xd0fe('0xa'),'info':_0xd0fe('0xb'),'print':_0xd0fe('0xc'),'success':_0xd0fe('0xd'),'http':_0xd0fe('0xe'),'verbose':_0xd0fe('0xf'),'debug':_0xd0fe('0x10'),'silly':'bold\x20cyan'};winston[_0xd0fe('0x11')](XC_LOG_COLORS);function getLogFileName(_0x17d6d4,_0x847bd4,_0x386823){var _0x4167b2=_0x17d6d4||'/var/log/xcally';return path['join'](_0x4167b2,util['format'](_0xd0fe('0x12'),_0x847bd4,_0x386823));}function formatter(_0x12b9ae,_0x39b29f){_0x39b29f[_0xd0fe('0x13')]=_0x39b29f[_0xd0fe('0x13')][_0xd0fe('0x14')](/@@{/g,_0xd0fe('0x15'))[_0xd0fe('0x14')](/}@@/g,_0xd0fe('0x16'))[_0xd0fe('0x14')](/@{/g,'{{')[_0xd0fe('0x14')](/}@/g,'}}');return util[_0xd0fe('0x17')]('[%s]\x20[%s]\x20%s\x20-\x20%s',moment()['format'](_0xd0fe('0x18')),_0x39b29f['level'][_0xd0fe('0x19')](),_0x12b9ae,_0x39b29f[_0xd0fe('0x13')]);}function fileFormat(_0xbf13f6,_0x53cc18){_0x53cc18['message']=_0x53cc18['message'][_0xd0fe('0x14')](/@@{/g,_0xd0fe('0x15'))[_0xd0fe('0x14')](/}@@/g,_0xd0fe('0x16'))['replace'](/@{/g,'{{')[_0xd0fe('0x14')](/}@/g,'}}');var _0x193669=_0x53cc18[_0xd0fe('0x1a')]&&Object[_0xd0fe('0x1b')](_0x53cc18[_0xd0fe('0x1a')])[_0xd0fe('0x1c')]?'\x0a\x09'+JSON[_0xd0fe('0x1d')](_0x53cc18['meta']):'';return util[_0xd0fe('0x17')]('[%s]\x20[%s]\x20%s\x20-\x20%s\x20%s',moment()[_0xd0fe('0x17')]('YYYY-MM-DD\x20HH:mm:ss'),_0x53cc18[_0xd0fe('0x1e')][_0xd0fe('0x19')](),_0xbf13f6,_0x53cc18[_0xd0fe('0x13')],_0x193669);}function consoleLogger(){var _0x168ed3=new winston[(_0xd0fe('0x1f'))]({'levels':XC_LOG_LEVELS,'transports':[new winston['transports']['Console']({'level':_0xd0fe('0x20'),'json':![],'formatter':function(_0x17d6ec){return formatter('',_0x17d6ec);}})]});return _0x168ed3;}function fileLogger(_0x2ad109,_0x516901){var _0x68a726=new winston['Logger']({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0xd0fe('0x21'))]['File']({'name':util[_0xd0fe('0x17')](_0xd0fe('0x22'),_0x2ad109,'error'),'filename':getLogFileName(_0x516901,_0x2ad109,'error'),'level':_0xd0fe('0x23'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x1ccc12){return fileFormat(_0x2ad109,_0x1ccc12);}}),new winston[(_0xd0fe('0x21'))][(_0xd0fe('0x24'))]({'name':util[_0xd0fe('0x17')](_0xd0fe('0x22'),_0x2ad109,debugLevel),'filename':getLogFileName(_0x516901,_0x2ad109,debugLevel),'level':debugLevel,'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x55fcf2){return fileFormat(_0x2ad109,_0x55fcf2);}}),new winston[(_0xd0fe('0x21'))][(_0xd0fe('0x25'))]({'level':_0xd0fe('0x20'),'json':![],'formatter':function(_0x15bfde){return fileFormat(_0x2ad109,_0x15bfde);}})]});return _0x68a726;}exports[_0xd0fe('0x26')]=consoleLogger;exports[_0xd0fe('0x27')]=fileLogger; \ No newline at end of file +var _0x8530=['[%s]\x20[%s]\x20%s\x20-\x20%s\x20%s','toUpperCase','Logger','transports','Console','File','%s-%s','error','consoleLogger','fileLogger','path','util','moment','../config/environment','debugLevel','toLowerCase','info','redBG\x20white','bold\x20yellow','bold\x20white','bold\x20green','gray','bold\x20blue','bold\x20cyan','addColors','/var/log/xcally','join','format','message','replace','{{{','}}}','[%s]\x20[%s]\x20%s\x20-\x20%s','YYYY-MM-DD\x20HH:mm:ss','level','meta','keys','length','stringify'];(function(_0xd37208,_0x1d0391){var _0x5d70e0=function(_0x2b5755){while(--_0x2b5755){_0xd37208['push'](_0xd37208['shift']());}};_0x5d70e0(++_0x1d0391);}(_0x8530,0x11b));var _0x0853=function(_0x4ca423,_0x2ee54f){_0x4ca423=_0x4ca423-0x0;var _0x1db20e=_0x8530[_0x4ca423];return _0x1db20e;};'use strict';var path=require(_0x0853('0x0'));var util=require(_0x0853('0x1'));var moment=require(_0x0853('0x2'));var winston=require('winston');var config=require(_0x0853('0x3'));var debugLevel=config[_0x0853('0x4')]?config[_0x0853('0x4')][_0x0853('0x5')]():_0x0853('0x6');var XC_LOG_LEVELS={'fatal':0x0,'error':0x0,'warn':0x1,'info':0x2,'print':0x2,'success':0x2,'http':0x3,'verbose':0x4,'debug':0x5,'silly':0x6};var XC_LOG_COLORS={'fatal':_0x0853('0x7'),'error':'red','warn':_0x0853('0x8'),'info':'white','print':_0x0853('0x9'),'success':_0x0853('0xa'),'http':_0x0853('0xb'),'verbose':'bold\x20magenta','debug':_0x0853('0xc'),'silly':_0x0853('0xd')};winston[_0x0853('0xe')](XC_LOG_COLORS);function getLogFileName(_0x965f49,_0x26aef5,_0xa2d89e){var _0x3ca43a=_0x965f49||_0x0853('0xf');return path[_0x0853('0x10')](_0x3ca43a,util[_0x0853('0x11')]('%s-%s.log',_0x26aef5,_0xa2d89e));}function formatter(_0x5861ed,_0x5c2b53){_0x5c2b53[_0x0853('0x12')]=_0x5c2b53[_0x0853('0x12')][_0x0853('0x13')](/@@{/g,_0x0853('0x14'))[_0x0853('0x13')](/}@@/g,_0x0853('0x15'))['replace'](/@{/g,'{{')['replace'](/}@/g,'}}');return util['format'](_0x0853('0x16'),moment()[_0x0853('0x11')](_0x0853('0x17')),_0x5c2b53[_0x0853('0x18')]['toUpperCase'](),_0x5861ed,_0x5c2b53[_0x0853('0x12')]);}function fileFormat(_0x5b6d1f,_0x152dfe){_0x152dfe[_0x0853('0x12')]=_0x152dfe[_0x0853('0x12')][_0x0853('0x13')](/@@{/g,'{{{')[_0x0853('0x13')](/}@@/g,_0x0853('0x15'))[_0x0853('0x13')](/@{/g,'{{')[_0x0853('0x13')](/}@/g,'}}');var _0x3e8c41=_0x152dfe[_0x0853('0x19')]&&Object[_0x0853('0x1a')](_0x152dfe[_0x0853('0x19')])[_0x0853('0x1b')]?'\x0a\x09'+JSON[_0x0853('0x1c')](_0x152dfe['meta']):'';return util['format'](_0x0853('0x1d'),moment()[_0x0853('0x11')](_0x0853('0x17')),_0x152dfe[_0x0853('0x18')][_0x0853('0x1e')](),_0x5b6d1f,_0x152dfe[_0x0853('0x12')],_0x3e8c41);}function consoleLogger(){var _0x2ff155=new winston[(_0x0853('0x1f'))]({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0x0853('0x20'))][(_0x0853('0x21'))]({'level':'warn','json':![],'formatter':function(_0x51aabf){return formatter('',_0x51aabf);}})]});return _0x2ff155;}function fileLogger(_0x1eec46,_0x319636){var _0x2f5419=new winston['Logger']({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0x0853('0x20'))][(_0x0853('0x22'))]({'name':util[_0x0853('0x11')](_0x0853('0x23'),_0x1eec46,_0x0853('0x24')),'filename':getLogFileName(_0x319636,_0x1eec46,'error'),'level':_0x0853('0x24'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x46be04){return fileFormat(_0x1eec46,_0x46be04);}}),new winston[(_0x0853('0x20'))][(_0x0853('0x22'))]({'name':util[_0x0853('0x11')](_0x0853('0x23'),_0x1eec46,debugLevel),'filename':getLogFileName(_0x319636,_0x1eec46,debugLevel),'level':debugLevel,'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x4fb0da){return fileFormat(_0x1eec46,_0x4fb0da);}}),new winston['transports'][(_0x0853('0x21'))]({'level':'warn','json':![],'formatter':function(_0x189110){return fileFormat(_0x1eec46,_0x189110);}})]});return _0x2f5419;}exports[_0x0853('0x25')]=consoleLogger;exports[_0x0853('0x26')]=fileLogger; \ No newline at end of file diff --git a/server/utils/mask-sensitive-data.js b/server/utils/mask-sensitive-data.js index b3ee320..6bd25b0 100644 --- a/server/utils/mask-sensitive-data.js +++ b/server/utils/mask-sensitive-data.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdb28=['registry','oldPassword','isPlainObject','length','isString','replace','@@{','}@@','exports','maskSensitiveData','lodash','username','password','newPassword','firstName','lastName','street','phone','mobile','email','clientId','code','accessKey','tenantId','token','channelSecret','accessToken','accessTokenSecret','consumerKey','consumerSecret','membername','calleridnum','exten','clientEmail','privateKey','accesskeyid','secretaccesskey','key','accountSid','localstationid','dsn','secret'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0xdb28,0x106));var _0x8db2=function(_0x577487,_0x15ff69){_0x577487=_0x577487-0x0;var _0x127926=_0xdb28[_0x577487];return _0x127926;};var _=require(_0x8db2('0x0'));var sensitiveFields=[_0x8db2('0x1'),_0x8db2('0x2'),_0x8db2('0x3'),'apiKey',_0x8db2('0x4'),_0x8db2('0x5'),_0x8db2('0x6'),_0x8db2('0x7'),_0x8db2('0x8'),'fax',_0x8db2('0x9'),_0x8db2('0xa'),'clientSecret','securityToken',_0x8db2('0xb'),_0x8db2('0xc'),_0x8db2('0xd'),_0x8db2('0xe'),_0x8db2('0xf'),_0x8db2('0x10'),_0x8db2('0x11'),'authToken',_0x8db2('0x12'),_0x8db2('0x13'),_0x8db2('0x14'),'calleridname',_0x8db2('0x15'),_0x8db2('0x16'),'vidaooApiKey',_0x8db2('0x17'),_0x8db2('0x18'),_0x8db2('0x19'),_0x8db2('0x1a'),_0x8db2('0x1b'),'user','pass',_0x8db2('0x1c'),_0x8db2('0x1d'),_0x8db2('0x1e'),_0x8db2('0x1f'),_0x8db2('0x20'),_0x8db2('0x21')];function maskSensitiveData(_0x2f177a){const _0x3c96a7=/(?!^)[\s\S](?!$)/g;if(_[_0x8db2('0x22')](_0x2f177a)){for(const _0x16c8c2 in _0x2f177a){if(_['isArray'](_0x2f177a[_0x16c8c2])){for(let _0x13b0f5=0x0;_0x13b0f5<_0x2f177a[_0x16c8c2][_0x8db2('0x23')];_0x13b0f5++){maskSensitiveData(_0x2f177a[_0x16c8c2][_0x13b0f5]);}}else if(_['isPlainObject'](_0x2f177a[_0x16c8c2])){maskSensitiveData(_0x2f177a[_0x16c8c2]);}else if(_[_0x8db2('0x24')](_0x2f177a[_0x16c8c2])){_0x2f177a[_0x16c8c2]=_0x2f177a[_0x16c8c2][_0x8db2('0x25')](/{{{/g,_0x8db2('0x26'))[_0x8db2('0x25')](/}}}/g,_0x8db2('0x27'))[_0x8db2('0x25')](/{{/g,'@{')['replace'](/}}/g,'}@');if(_['includes'](sensitiveFields,_0x16c8c2)){_0x2f177a[_0x16c8c2]=_0x2f177a[_0x16c8c2][_0x8db2('0x25')](_0x3c96a7,'*');}}}}}module[_0x8db2('0x28')][_0x8db2('0x29')]=maskSensitiveData; \ No newline at end of file +var _0x1967=['secret','registry','isPlainObject','isArray','length','isString','replace','@@{','}@@','includes','exports','username','password','newPassword','apiKey','firstName','lastName','street','phone','mobile','fax','clientId','clientSecret','securityToken','code','accessKey','tenantId','channelSecret','accessToken','accessTokenSecret','authToken','consumerKey','calleridname','calleridnum','exten','vidaooApiKey','clientEmail','privateKey','accesskeyid','secretaccesskey','key','user','pass','localstationid','dsn'];(function(_0x28669c,_0x1f62c4){var _0x4a3af6=function(_0x3e25d5){while(--_0x3e25d5){_0x28669c['push'](_0x28669c['shift']());}};_0x4a3af6(++_0x1f62c4);}(_0x1967,0x173));var _0x7196=function(_0x4cc803,_0x3d656c){_0x4cc803=_0x4cc803-0x0;var _0x3bda19=_0x1967[_0x4cc803];return _0x3bda19;};var _=require('lodash');var sensitiveFields=[_0x7196('0x0'),_0x7196('0x1'),_0x7196('0x2'),_0x7196('0x3'),_0x7196('0x4'),_0x7196('0x5'),_0x7196('0x6'),_0x7196('0x7'),_0x7196('0x8'),_0x7196('0x9'),'email',_0x7196('0xa'),_0x7196('0xb'),_0x7196('0xc'),_0x7196('0xd'),_0x7196('0xe'),_0x7196('0xf'),'token',_0x7196('0x10'),_0x7196('0x11'),_0x7196('0x12'),_0x7196('0x13'),_0x7196('0x14'),'consumerSecret','membername',_0x7196('0x15'),_0x7196('0x16'),_0x7196('0x17'),_0x7196('0x18'),_0x7196('0x19'),_0x7196('0x1a'),_0x7196('0x1b'),_0x7196('0x1c'),_0x7196('0x1d'),_0x7196('0x1e'),_0x7196('0x1f'),'accountSid',_0x7196('0x20'),_0x7196('0x21'),_0x7196('0x22'),_0x7196('0x23'),'oldPassword'];function maskSensitiveData(_0x31c778){const _0x539414=/(?!^)[\s\S](?!$)/g;if(_[_0x7196('0x24')](_0x31c778)){for(const _0x2590a6 in _0x31c778){if(_[_0x7196('0x25')](_0x31c778[_0x2590a6])){for(let _0x3ed1ad=0x0;_0x3ed1ad<_0x31c778[_0x2590a6][_0x7196('0x26')];_0x3ed1ad++){maskSensitiveData(_0x31c778[_0x2590a6][_0x3ed1ad]);}}else if(_[_0x7196('0x24')](_0x31c778[_0x2590a6])){maskSensitiveData(_0x31c778[_0x2590a6]);}else if(_[_0x7196('0x27')](_0x31c778[_0x2590a6])){_0x31c778[_0x2590a6]=_0x31c778[_0x2590a6][_0x7196('0x28')](/{{{/g,_0x7196('0x29'))[_0x7196('0x28')](/}}}/g,_0x7196('0x2a'))['replace'](/{{/g,'@{')['replace'](/}}/g,'}@');if(_[_0x7196('0x2b')](sensitiveFields,_0x2590a6)){_0x31c778[_0x2590a6]=_0x31c778[_0x2590a6][_0x7196('0x28')](_0x539414,'*');}}}}}module[_0x7196('0x2c')]['maskSensitiveData']=maskSensitiveData; \ No newline at end of file diff --git a/server/utils/safe-template.js b/server/utils/safe-template.js index e878773..e6601a4 100644 --- a/server/utils/safe-template.js +++ b/server/utils/safe-template.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8603=['{\x20{\x20','\x20}\x20}','string','replace','isArray','keys','reduce','exports'];(function(_0x5f5838,_0x46c89d){var _0x5e015b=function(_0x3decf4){while(--_0x3decf4){_0x5f5838['push'](_0x5f5838['shift']());}};_0x5e015b(++_0x46c89d);}(_0x8603,0x190));var _0x3860=function(_0x144728,_0x11b05b){_0x144728=_0x144728-0x0;var _0x54cde2=_0x8603[_0x144728];return _0x54cde2;};var _=require('lodash');var mustacheLikeBracketsRx=/(\{|\}){2}/gm;function bracketsReplacer(_0x2f848f){return _0x2f848f==='{{'?_0x3860('0x0'):_0x3860('0x1');}function safeTemplate(_0x51bfda){var _0x4961d6=_0x51bfda;if(typeof _0x51bfda===_0x3860('0x2')){_0x4961d6=_0x51bfda[_0x3860('0x3')](mustacheLikeBracketsRx,bracketsReplacer);}else if(Array[_0x3860('0x4')](_0x51bfda)){_0x4961d6=_0x51bfda['map'](function(_0x2fc97a){return safeTemplate(_0x2fc97a);});}else if(_['isPlainObject'](_0x51bfda)){_0x4961d6=Object[_0x3860('0x5')](_0x51bfda)[_0x3860('0x6')](function(_0x1eca44,_0xd3ce26){_0x1eca44[_0xd3ce26]=safeTemplate(_0x51bfda[_0xd3ce26]);return _0x1eca44;},{});}return _0x4961d6;}module[_0x3860('0x7')]['safeTemplate']=safeTemplate; \ No newline at end of file +var _0x9354=['map','isPlainObject','keys','reduce','exports','safeTemplate','{\x20{\x20','string','replace'];(function(_0x37b544,_0x4f6d1d){var _0x5dc42=function(_0x562614){while(--_0x562614){_0x37b544['push'](_0x37b544['shift']());}};_0x5dc42(++_0x4f6d1d);}(_0x9354,0x96));var _0x4935=function(_0x46884f,_0x2b5c5a){_0x46884f=_0x46884f-0x0;var _0x78c6c0=_0x9354[_0x46884f];return _0x78c6c0;};var _=require('lodash');var mustacheLikeBracketsRx=/(\{|\}){2}/gm;function bracketsReplacer(_0x42d9d9){return _0x42d9d9==='{{'?_0x4935('0x0'):'\x20}\x20}';}function safeTemplate(_0x263dd5){var _0x2a4993=_0x263dd5;if(typeof _0x263dd5===_0x4935('0x1')){_0x2a4993=_0x263dd5[_0x4935('0x2')](mustacheLikeBracketsRx,bracketsReplacer);}else if(Array['isArray'](_0x263dd5)){_0x2a4993=_0x263dd5[_0x4935('0x3')](function(_0x2d509b){return safeTemplate(_0x2d509b);});}else if(_[_0x4935('0x4')](_0x263dd5)){_0x2a4993=Object[_0x4935('0x5')](_0x263dd5)[_0x4935('0x6')](function(_0x2e47bd,_0x118d36){_0x2e47bd[_0x118d36]=safeTemplate(_0x263dd5[_0x118d36]);return _0x2e47bd;},{});}return _0x2a4993;}module[_0x4935('0x7')][_0x4935('0x8')]=safeTemplate; \ No newline at end of file -- 1.7.1